diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..b722260d --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +build/ +./app.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..980303fa --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,44 @@ +// eslint-disable-next-line no-undef +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint', 'prettier'], + extends: [ + 'airbnb-base', + 'airbnb-typescript/base', + 'plugin:@typescript-eslint/recommended', + 'prettier', + ], + parserOptions: { + project: './tsconfig.json', + }, + rules: { + 'prettier/prettier': 'error', + + // airbnb overrides ------------------------------------ + curly: ['error', 'multi-or-nest', 'consistent'], + 'no-console': 'off', + 'no-continue': 'off', + // let's not disallow for...of loops :/ + 'no-restricted-syntax': [ + 'error', + 'ForInStatement', + 'LabeledStatement', + 'WithStatement', + ], + + // import (part of airbnb) overrides ------------------ + 'import/no-import-module-exports': 'off', + 'import/prefer-default-export': 'off', + + // @typescript-eslint/recommended overrides ----------- + '@typescript-eslint/lines-between-class-members': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }, + ], + '@typescript-eslint/no-floating-promises': 'error', + }, +}; diff --git a/.gitignore b/.gitignore index 49ce24b4..c7137d63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /.idea -/test.js env.json -/build \ No newline at end of file +node_modules/ +build/ +/test.js diff --git a/.homeychangelog.json b/.homeychangelog.json index eb18ccb0..7a0b634e 100644 --- a/.homeychangelog.json +++ b/.homeychangelog.json @@ -100,5 +100,17 @@ }, "1.4.13": { "en": "Bug fix for price fetch scheduling" + }, + "1.5.0": { + "en": "Support for Homey Bridge. Add trigger and condition for top/bottom X hours today. Outdoor temperature for Home removed. Fix parsing high prices." + }, + "1.5.1": { + "en": "Fix for showing both old and new price capabilities at the same time" + }, + "1.5.2": { + "en": "Using updated price information from the Tibber API" + }, + "1.5.5": { + "en": "Support Homey Bridge. Add trigger and condition for top/bottom X hours today. Outdoor temperature for Home removed. Using updated price information from the Tibber API. Fix parsing high prices." } } diff --git a/.homeycompose/app.json b/.homeycompose/app.json index d32b50db..446c6fd1 100644 --- a/.homeycompose/app.json +++ b/.homeycompose/app.json @@ -1,12 +1,16 @@ { "id": "com.tibber", - "version": "1.4.13", - "compatibility": ">=1.5.0", + "version": "1.5.5", + "compatibility": ">=5.0.0", + "platforms": [ + "local", + "cloud" + ], + "sdk": 3, "author": { "name": "Tibber AS", "email": "hello@tibber.com" }, - "sdk": 2, "brandColor": "#23B8CC", "name": { "en": "Tibber" diff --git a/.homeycompose/capabilities/measure_price_level.json b/.homeycompose/capabilities/measure_price_level.json new file mode 100644 index 00000000..bde598f5 --- /dev/null +++ b/.homeycompose/capabilities/measure_price_level.json @@ -0,0 +1,29 @@ +{ + "type": "enum", + "title": { + "en": "Price level" + }, + "getable": true, + "setable": false, + "values": [ + { + "id": "LOW", + "title": { + "en": "Low" + } + }, + { + "id": "NORMAL", + "title": { + "en": "Normal" + } + }, + { + "id": "HIGH", + "title": { + "en": "High" + } + } + ], + "icon": "/drivers/home/assets/dollar.svg" +} diff --git a/.homeycompose/capabilities/measure_price_total.json b/.homeycompose/capabilities/measure_price_total.json new file mode 100644 index 00000000..4320d987 --- /dev/null +++ b/.homeycompose/capabilities/measure_price_total.json @@ -0,0 +1,12 @@ +{ + "type": "number", + "title": { + "en": "Current price" + }, + "getable": true, + "setable": false, + "units": { + "en": "kr" + }, + "icon": "/drivers/home/assets/dollar.svg" +} diff --git a/.homeycompose/capabilities/price_level.json b/.homeycompose/capabilities/price_level.json index ad88fbb7..fe4e546b 100644 --- a/.homeycompose/capabilities/price_level.json +++ b/.homeycompose/capabilities/price_level.json @@ -37,5 +37,6 @@ } } ], - "icon": "/drivers/home/assets/dollar.svg" + "icon": "/drivers/home/assets/dollar.svg", + "uiComponent": null } diff --git a/.homeycompose/capabilities/price_total.json b/.homeycompose/capabilities/price_total.json index 4320d987..49895cd9 100644 --- a/.homeycompose/capabilities/price_total.json +++ b/.homeycompose/capabilities/price_total.json @@ -8,5 +8,6 @@ "units": { "en": "kr" }, - "icon": "/drivers/home/assets/dollar.svg" + "icon": "/drivers/home/assets/dollar.svg", + "uiComponent": null } diff --git a/.homeycompose/flow/triggers/current.L1_changed.json b/.homeycompose/flow/triggers/current.L1_changed.json new file mode 100644 index 00000000..fc43fe49 --- /dev/null +++ b/.homeycompose/flow/triggers/current.L1_changed.json @@ -0,0 +1,23 @@ +{ + "id": "current.L1_changed", + "title": { + "en": "Current phase 1 changed" + }, + "tokens": [ + { + "name": "currentL1", + "type": "number", + "title": { + "en": "Current phase 1" + } + } + ], + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=pulse|watty" + } + ], + "platforms": ["local", "cloud"] +} diff --git a/.homeycompose/flow/triggers/current.L2_changed.json b/.homeycompose/flow/triggers/current.L2_changed.json new file mode 100644 index 00000000..d12a9f27 --- /dev/null +++ b/.homeycompose/flow/triggers/current.L2_changed.json @@ -0,0 +1,23 @@ +{ + "id": "current.L2_changed", + "title": { + "en": "Current phase 2 changed" + }, + "tokens": [ + { + "name": "currentL2", + "type": "number", + "title": { + "en": "Current phase 2" + } + } + ], + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=pulse|watty" + } + ], + "platforms": ["local", "cloud"] +} diff --git a/.homeycompose/flow/triggers/current.L3_changed.json b/.homeycompose/flow/triggers/current.L3_changed.json new file mode 100644 index 00000000..d4f5cbf7 --- /dev/null +++ b/.homeycompose/flow/triggers/current.L3_changed.json @@ -0,0 +1,23 @@ +{ + "id": "current.L3_changed", + "title": { + "en": "Current phase 3 changed" + }, + "tokens": [ + { + "name": "currentL3", + "type": "number", + "title": { + "en": "Current phase 3" + } + } + ], + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=pulse|watty" + } + ], + "platforms": ["local", "cloud"] +} diff --git a/.homeyplugins.json b/.homeyplugins.json deleted file mode 100644 index 79b8283e..00000000 --- a/.homeyplugins.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - { - "id": "compose" - } -] diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..9293735b --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +12.22.6 diff --git a/@types/http.min/index.d.ts b/@types/http.min/index.d.ts new file mode 100644 index 00000000..09976915 --- /dev/null +++ b/@types/http.min/index.d.ts @@ -0,0 +1 @@ +declare module 'http.min'; diff --git a/CREDITS.md b/CREDITS.md index 9c0da9c1..9fa0bea5 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,5 +1,3 @@ Original implementation by [Espen Ljosland](https://github.com/slasktrat/com.tibber) Dollar icon made by [Dave Gandy](https://www.flaticon.com/authors/dave-gandy) from www.flaticon.com - -Outdoor temperature by [MET Norway](https://api.met.no/weatherapi/documentation) \ No newline at end of file diff --git a/README.md b/README.md index 8acf4fbe..21e4bf89 100644 --- a/README.md +++ b/README.md @@ -1,104 +1,266 @@ # Tibber -Integration with Tibber, with Pulse support! +Integration with Tibber, with Pulse and Watty support. -  ## Flow cards ### Device: *__Home__* + #### Triggers + - Price changed -- Temperature changed - Current price is at today's lowest - Current price is at today's highest -- Current price is at the lowest among the next [x] hours -- Current price is at the highest among the next [x] hours +- Current price is at its lowest among the next [x] hours +- Current price is at its highest among the next [x] hours - Current price is [x] percent below today's average - Current price is [x] percent above today's average - Current price is [x] percent below average of the next [y] hours - Current price is [x] percent above average of the next [y] hours -- Current price is one of todays lowest [x] prices -- Current price is one of todays highest [x] prices -- Consumption report (triggers when new data is available, normally once a week. Every hour if you have a Pulse device) -  +- Current price is one of today's lowest [x] prices +- Current price is one of today's highest [x] prices +- Consumption is reported (triggers when new data is available, normally once a week. Every hour if you + have a Pulse device) +   + #### Conditions + - Current price below/above -- Outdoor temperature below/above - Current price is at today's lowest - Current price is at today's highest -- Current price is at the lowest among the next [x] hours -- Current price is at the highest among the next [x] hours +- Current price is at its lowest among the next [x] hours +- Current price is at its highest among the next [x] hours - Current price is [x] percent below today's average - Current price is [x] percent above today's average - Current price is [x] percent below average of the next [y] hours - Current price is [x] percent above average of the next [y] hours -- Current price is one of todays lowest [x] prices -- Current price is one of todays highest [x] prices -  +- Current price is one of today's lowest [x] prices +- Current price is one of today's highest [x] prices   + #### Actions + - Send push notification (through Tibber app)   -### Device: *__Pulse__* + +### Device: *__Pulse__* / *__Watty__* + #### Triggers + - Power changed - Consumption since midnight changed - Cost since midnight changed -- Daily consumption report +- Daily consumption is reported   + ### Release Notes +### 1.5.5 + +- Breaking change: Outdoor temperature capability for Home has been removed. Please use a separate weather app if you need temperature actions for your flows (there are plenty). Any flows that were using this need to be set up anew. +- Support for Homey Bridge +- Add trigger and condition for top/bottom X hours today +- Using updated price information from the Tibber API +- Fix parsing high prices + +#### 1.4.13 + +- Bug fix for price fetch scheduling + +#### 1.4.12 + +- Update readme to include price level trigger + +#### 1.4.11 + +- Add price level capability automatically + +#### 1.4.10 + +- Change price level to an enumeration + +#### 1.4.9 + +- Deactivate device if home can't be found anymore. Add price level indicator. Fix current triggers +for L2 and L3. + +#### 1.4.8 + +- Fix push notification flow + +#### 1.4.7 + +- Fix crash related to Pulse/Watty trigger registration + +#### 1.4.6 + +- Update readme + +#### 1.4.5 + +- Set description and support URL + +#### 1.4.4 + +- Update readme + +#### 1.4.3 + +- New triggers for currents reported by Pulse and Watty + +#### 1.4.2 + +- Bug fix for keeping track of last logged daily consumption + +#### 1.4.1 + +- Bug fix for calculating amount of hours to be fetched for consumption report + +#### 1.4.0 + +- Rewrite of Tibber API data access to reduce load at hour shift +- Use a cache for day-ahead-prices for today and tomorrow +- Home non-real time consumption report is now enabled with an advanced parameter (default to false) +- Support for displaying real time current per phase for Pulse and Watty + +#### 1.3.11 + +- Increase data fetch timeout. Fix data fetch retry logic. + +#### 1.3.10 + +- New Dark Sky API key + +#### 1.3.9 + +- Improved API request tracing + +#### 1.3.8 + +- Improved query tracing + +#### 1.3.7 + +- Increase GraphQL client timeout + +#### 1.3.6 + +- Set timeout for GraphQl queries + +#### 1.3.5 + +- Fix Tibber icon color dropped by homey cli + +#### 1.3.4 + +- Avoid error in price triggers when last price is not populated + +#### 1.3.3 + +- Logo and brand color + +#### 1.3.2 + +- Tibber logo and brand color + +#### 1.3.1 + +- Tibber logo and brand color + +#### 1.3.0 + +- New Tibber logo + +#### 1.2.7 + +- Allow production power being reported less frequently than power + +#### 1.2.6 + +- Update measure_power even when it's 0 or same as previous + #### 1.2.5 + - Support for retrieving production power from Pulse + #### 1.2.4 + - Added a note about re-adding a Pulse/Watty device in case fetching data timeouts + #### 1.2.3 + - Fixed fetching current temperature for home location + #### 1.2.2 + - Bug fix for missing flowcard id + #### 1.2.1 + - Correct Watty images + #### 1.2.0 + - Support for pairing Watty and bug fixes + #### 1.1.0 -- Support for Energy API - Pulse and Watty show up as a cumulative devices in the Homey energy section + +- Support for Energy API - Pulse and Watty show up as a cumulative devices in the Homey energy + section + #### 1.0.12 -- Fixed app crashing on api timeout #14 -  + +- Fixed app crashing on API timeout (#14) + #### 1.0.10 + - Fixed weather forecast (#13) -  +   + #### 1.0.9 + - Fixed #12 -  + #### 1.0.8 -- Added 4 new trigger and 4 new condition cards for price at today's lowest/highest and above/below a set average + +- Added 4 new trigger and 4 new condition cards for price at today's lowest/highest and above/below + a set average - Added fallback code for re-initiating Pulse subscription if no data for 10 minutes -  + #### 1.0.6 + - Added condition cards for lowest/highest price among the next [x] hours -- Added cost calculation to Pulse for users without a (paying) subscription, based on nordpool prices. Note: Net spot prices/without any taxes, fees, etc. +- Added cost calculation to Pulse for users without a (paying) subscription, based on nordpool + prices. Note: Net spot prices/without any taxes, fees, etc. - Minor fixes -  + #### 1.0.4 + - Fixed flow triggers broken in 2.0 -  + #### 1.0.3 + - Registering capability value before triggering flow action (fixed issue #5) -  +   + #### 1.0.2 -- Added support for Pulse without a (paying) subscription (N.B. cost is not available without subscription so accumulated cost will never have any value and cost related triggers will never fire) -  + +- Added support for Pulse without a (paying) subscription (N.B. cost is not available without + subscription so accumulated cost will never have any value and cost related triggers will never + fire) + #### 1.0.1 + - Added trigger cards for lowest/highest price among the next [x] hours -  + #### 1.0.0 + - Initial public version -  + #### 1.2.0 -- Bug fixes. Added Watty as a energy device. +- Bug fixes. Added Watty as an energy device. ### Known Issues -- Currently, the users Tibber subscription needs to be be confirmed or started to use the Tibber app. \ No newline at end of file +- Currently, the user's Tibber subscription needs to be confirmed or started to use the Tibber app. diff --git a/README.txt b/README.txt index 73b40e79..f1e2a34e 100644 --- a/README.txt +++ b/README.txt @@ -1,50 +1,5 @@ -Integration with Tibber, with Pulse and Watty support. +Integration with Tibber, with Pulse and Watty support -New: Pulse and Watty now supports displaying current for phase 1, 2 and 3. In order to show new values in Homey you will need to remove and re-add Pulse/Watty device. -New: Home hourly and daily consumption report is now disabled by default. You can enable it in the Home device's advanced settings. +As a Tibber customer, automate your home based on the current electricity price. -Flow cards - -Device: Home -Triggers -- Price changed -- Temperature changed -- Current price is at today's lowest -- Current price is at today's highest -- Current price is at the lowest among the next [x] hours -- Current price is at the highest among the next [x] hours -- Current price is [x] percent below today's average -- Current price is [x] percent above today's average -- Current price is [x] percent below average of the next [y] hours -- Current price is [x] percent above average of the next [y] hours -- Consumption report (triggers when new data is available, normally once a week. Every hour if you have a Pulse device) -- You can use price level to make smart decisions based on the electricity price. These are local to the current day and include: - VERY_EXPENSIVE - EXPENSIVE - NORMAL - CHEAP - VERY_CHEAP - Please note that these are relative bands where VERY_EXPENSIVE can apply for several individual hours or continuous time slots for example. - -Conditions -- Current price below/above -- Outdoor temperature below/above -- Current price is at today's lowest -- Current price is at today's highest -- Current price is at the lowest among the next [x] hours -- Current price is at the highest among the next [x] hours -- Current price is [x] percent below today's average -- Current price is [x] percent above today's average -- Current price is [x] percent below average of the next [y] hours -- Current price is [x] percent above average of the next [y] hours - -Actions -- Send push notification (through Tibber app) - -Device: Pulse and Watty -Triggers -- Power changed -- Current for phase 1, 2 or 3 changed -- Consumption since midnight changed -- Cost since midnight changed -- Daily consumption report +If you also have a Pulse or Watty device, build automations based on your real time electricity consumption. \ No newline at end of file diff --git a/app.js b/app.js deleted file mode 100644 index 9f9912f4..00000000 --- a/app.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; -require('newrelic'); - -const Homey = require('homey'), - _ = require('lodash'); - -class TibberApp extends Homey.App { - - onInit() { - this.log('Tibber app is running...'); - - let v = Homey.ManagerSettings.get('v'); - if(v !== 2) { - this.log('Cleaning logs'); - Homey.ManagerSettings.set('v', 2); - this.cleanupLogs('*').catch(console.error); - } - } - - async cleanupLogs(prefix) { - let logs = await Homey.ManagerInsights.getLogs(); - _.each(logs, async log => { - if(prefix === '*' || _.startsWith(log.name, prefix)) { - console.log('Deleting log', log.name); - await Homey.ManagerInsights.deleteLog(log); - } - }) - } -} - -module.exports = TibberApp; \ No newline at end of file diff --git a/app.json b/app.json index 05cf0a6a..8cbc0961 100644 --- a/app.json +++ b/app.json @@ -1,13 +1,17 @@ { "_comment": "This file is generated. Please edit .homeycompose/app.json instead.", "id": "com.tibber", - "version": "1.4.13", - "compatibility": ">=1.5.0", + "version": "1.5.5", + "compatibility": ">=5.0.0", + "platforms": [ + "local", + "cloud" + ], + "sdk": 3, "author": { "name": "Tibber AS", "email": "hello@tibber.com" }, - "sdk": 2, "brandColor": "#23B8CC", "name": { "en": "Tibber" @@ -29,6 +33,84 @@ "support": "mailto:hello@tibber.com", "flow": { "triggers": [ + { + "id": "current.L1_changed", + "title": { + "en": "Current phase 1 changed" + }, + "tokens": [ + { + "name": "currentL1", + "type": "number", + "title": { + "en": "Current phase 1" + } + } + ], + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=pulse|watty" + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "current.L2_changed", + "title": { + "en": "Current phase 2 changed" + }, + "tokens": [ + { + "name": "currentL2", + "type": "number", + "title": { + "en": "Current phase 2" + } + } + ], + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=pulse|watty" + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "current.L3_changed", + "title": { + "en": "Current phase 3 changed" + }, + "tokens": [ + { + "name": "currentL3", + "type": "number", + "title": { + "en": "Current phase 3" + } + } + ], + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=pulse|watty" + } + ], + "platforms": [ + "local", + "cloud" + ] + }, { "id": "price_changed", "title": { @@ -64,27 +146,9 @@ } } ], - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=home" - } - ] - }, - { - "id": "temperature_changed", - "title": { - "en": "Temperature changed" - }, - "tokens": [ - { - "name": "temperature", - "type": "number", - "title": { - "en": "Temperature" - } - } + "platforms": [ + "local", + "cloud" ], "args": [ { @@ -99,6 +163,10 @@ "title": { "en": "Current price is [x] percent below average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent below average of the next [[hours]] hours" + }, + "tokens": [], "args": [ { "type": "device", @@ -108,17 +176,27 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -126,6 +204,10 @@ "title": { "en": "Current price is [x] percent above average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent above average of the next [[hours]] hours" + }, + "tokens": [], "args": [ { "type": "device", @@ -135,17 +217,27 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "2" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -153,6 +245,9 @@ "title": { "en": "Current price is [x] percent below today's average" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent below today's average" + }, "args": [ { "type": "device", @@ -162,10 +257,17 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -173,6 +275,9 @@ "title": { "en": "Current price is [x] percent above today's average" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent above today's average" + }, "args": [ { "type": "device", @@ -182,16 +287,26 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "price_at_lowest", "title": { - "en": "Current price is at the lowest among the next [x] hours" + "en": "Current price is at its lowest among the next [x] hours" + }, + "titleFormatted": { + "en": "Current price is at its lowest among the next [[hours]] hours" }, "args": [ { @@ -202,16 +317,26 @@ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "price_at_highest", "title": { - "en": "Current price is at the highest among the next [x] hours" + "en": "Current price is at its highest among the next [y] hours" + }, + "titleFormatted": { + "en": "Current price is at its highest among the next [[hours]] hours" }, "args": [ { @@ -222,10 +347,17 @@ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -233,6 +365,10 @@ "title": { "en": "Current price is at today's lowest" }, + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -246,6 +382,10 @@ "title": { "en": "Current price is at today's highest" }, + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -257,7 +397,10 @@ { "id": "price_among_lowest_today", "title": { - "en": "Current price is one of todays lowest [x] prices" + "en": "Current price is one of today's lowest [x] prices" + }, + "titleFormatted": { + "en": "Current price is one of today's lowest [[ranked_hours]] prices" }, "args": [ { @@ -268,16 +411,26 @@ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "price_among_highest_today", "title": { - "en": "Current price is one of todays highest [x] prices" + "en": "Current price is one of today's highest [x] prices" + }, + "titleFormatted": { + "en": "Current price is one of today's highest [[ranked_hours]] prices" }, "args": [ { @@ -288,16 +441,23 @@ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "consumption_report", "title": { - "en": "Consumption report" + "en": "Consumption is reported" }, "tokens": [ { @@ -315,6 +475,10 @@ } } ], + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -337,6 +501,10 @@ } } ], + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -359,6 +527,10 @@ } } ], + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -370,7 +542,7 @@ { "id": "daily_consumption_report", "title": { - "en": "Daily consumption report" + "en": "Daily consumption is reported" }, "tokens": [ { @@ -388,6 +560,10 @@ } } ], + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -410,71 +586,9 @@ } } ], - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=pulse" - } - ] - }, - { - "id": "current.L1_changed", - "title": { - "en": "Current phase 1 changed" - }, - "tokens": [ - { - "name": "currentL1", - "type": "number", - "title": { - "en": "Current phase 1" - } - } - ], - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=pulse" - } - ] - }, - { - "id": "current.L2_changed", - "title": { - "en": "Current phase 2 changed" - }, - "tokens": [ - { - "name": "currentL2", - "type": "number", - "title": { - "en": "Current phase 2" - } - } - ], - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=pulse" - } - ] - }, - { - "id": "current.L3_changed", - "title": { - "en": "Current phase 3 changed" - }, - "tokens": [ - { - "name": "currentL3", - "type": "number", - "title": { - "en": "Current phase 3" - } - } + "platforms": [ + "local", + "cloud" ], "args": [ { @@ -498,6 +612,10 @@ } } ], + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -520,6 +638,10 @@ } } ], + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -531,7 +653,7 @@ { "id": "watty_daily_consumption_report", "title": { - "en": "Daily consumption report" + "en": "Daily consumption is reported" }, "tokens": [ { @@ -549,6 +671,10 @@ } } ], + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -571,71 +697,9 @@ } } ], - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=watty" - } - ] - }, - { - "id": "current.L1_changed", - "title": { - "en": "Current phase 1 changed" - }, - "tokens": [ - { - "name": "currentL1", - "type": "number", - "title": { - "en": "Current phase 1" - } - } - ], - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=watty" - } - ] - }, - { - "id": "current.L2_changed", - "title": { - "en": "Current phase 2 changed" - }, - "tokens": [ - { - "name": "currentL2", - "type": "number", - "title": { - "en": "Current phase 2" - } - } - ], - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=watty" - } - ] - }, - { - "id": "current.L3_changed", - "title": { - "en": "Current phase 3 changed" - }, - "tokens": [ - { - "name": "currentL3", - "type": "number", - "title": { - "en": "Current phase 3" - } - } + "platforms": [ + "local", + "cloud" ], "args": [ { @@ -652,25 +716,8 @@ "title": { "en": "Current price !{{below|above}}" }, - "args": [ - { - "type": "device", - "name": "device", - "filter": "driver_id=home" - }, - { - "name": "price", - "type": "number", - "placeholder": { - "en": "price" - } - } - ] - }, - { - "id": "temperature_below", - "title": { - "en": "Outdoor temperature !{{below|above}}" + "titleFormatted": { + "en": "Current price is !{{below|above}} [[price]]" }, "args": [ { @@ -679,12 +726,19 @@ "filter": "driver_id=home" }, { - "name": "temperature", + "name": "price", "type": "number", + "title": { + "en": "Price" + }, "placeholder": { - "en": "temperature" + "en": "0.2" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -692,6 +746,9 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent below average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent below average of the next [[hours]] hours" + }, "args": [ { "type": "device", @@ -701,17 +758,27 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -719,6 +786,9 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent above average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent above average of the next [[hours]] hours" + }, "args": [ { "type": "device", @@ -728,17 +798,27 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -746,6 +826,9 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent below today's average" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent below today's average" + }, "args": [ { "type": "device", @@ -755,10 +838,17 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -766,6 +856,9 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent above today's average" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent above today's average" + }, "args": [ { "type": "device", @@ -775,16 +868,26 @@ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "cond_price_at_lowest", "title": { - "en": "Current price !{{is|isn't}} at the lowest among the next [x] hours" + "en": "Current price !{{is|isn't}} at its lowest among the next [x] hours" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} at its lowest among the next [[hours]] hours" }, "args": [ { @@ -795,16 +898,26 @@ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "cond_price_at_highest", "title": { - "en": "Current price !{{is|isn't}} at the highest among the next [x] hours" + "en": "Current price !{{is|isn't}} at its highest among the next [x] hours" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} at its highest among the next [[hours]] hours" }, "args": [ { @@ -815,10 +928,17 @@ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -826,6 +946,10 @@ "title": { "en": "Current price !{{is|isn't}} at today's lowest" }, + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -839,6 +963,10 @@ "title": { "en": "Current price !{{is|isn't}} at today's highest" }, + "platforms": [ + "local", + "cloud" + ], "args": [ { "type": "device", @@ -850,7 +978,10 @@ { "id": "cond_price_among_lowest_today", "title": { - "en": "Current price !{{is|isn't}} one of todays lowest [x] prices" + "en": "Current price !{{is|isn't}} one of today's lowest [x] prices" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} one of today's lowest [[ranked_hours]] prices" }, "args": [ { @@ -861,16 +992,26 @@ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "3" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "cond_price_among_highest_today", "title": { - "en": "Current price !{{is|isn't}} one of todays highest [x] prices" + "en": "Current price !{{is|isn't}} one of today's highest [x] prices" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} one of today's highest [[ranked_hours]] prices" }, "args": [ { @@ -881,10 +1022,17 @@ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "3" } } + ], + "platforms": [ + "local", + "cloud" ] } ], @@ -894,6 +1042,9 @@ "title": { "en": "Send Tibber push notification" }, + "titleFormatted": { + "en": "Send Tibber push notification with [[title]] and [[message]]" + }, "args": [ { "type": "device", @@ -902,12 +1053,22 @@ }, { "name": "title", - "type": "text" + "type": "text", + "title": { + "en": "Title" + } }, { "name": "message", - "type": "text" + "type": "text", + "title": { + "en": "Message" + } } + ], + "platforms": [ + "local", + "cloud" ] } ] @@ -917,6 +1078,13 @@ "name": { "en": "Home" }, + "platforms": [ + "local", + "cloud" + ], + "connectivity": [ + "cloud" + ], "mobile": { "components": [ { @@ -927,35 +1095,23 @@ "id": "sensor", "options": { "icons": { - "price_total": "/drivers/home/assets/dollar.svg" + "measure_price_total": "/drivers/home/assets/dollar.svg" } }, "capabilities": [ - "price_total" - ] - }, - { - "id": "sensor", - "capabilities": [ - "measure_temperature" + "measure_price_total", + "measure_price_level" ] } ] }, "capabilities": [ - "price_total", - "price_level", - "measure_temperature" + "measure_price_total", + "measure_price_level" ], "capabilitiesOptions": { - "price_total": { + "measure_price_total": { "preventInsights": true - }, - "measure_temperature": { - "preventInsights": true, - "title": { - "en": "Outdoor" - } } }, "class": "other", @@ -999,6 +1155,13 @@ "name": { "en": "Pulse" }, + "platforms": [ + "local", + "cloud" + ], + "connectivity": [ + "cloud" + ], "mobile": { "components": [ { @@ -1228,6 +1391,13 @@ "name": { "en": "Watty" }, + "platforms": [ + "local", + "cloud" + ], + "connectivity": [ + "cloud" + ], "mobile": { "components": [ { @@ -1467,6 +1637,47 @@ }, "icon": "/drivers/pulse/assets/dollar.svg" }, + "measure_price_level": { + "type": "enum", + "title": { + "en": "Price level" + }, + "getable": true, + "setable": false, + "values": [ + { + "id": "LOW", + "title": { + "en": "Low" + } + }, + { + "id": "NORMAL", + "title": { + "en": "Normal" + } + }, + { + "id": "HIGH", + "title": { + "en": "High" + } + } + ], + "icon": "/drivers/home/assets/dollar.svg" + }, + "measure_price_total": { + "type": "number", + "title": { + "en": "Current price" + }, + "getable": true, + "setable": false, + "units": { + "en": "kr" + }, + "icon": "/drivers/home/assets/dollar.svg" + }, "price_level": { "type": "enum", "title": { @@ -1506,7 +1717,8 @@ } } ], - "icon": "/drivers/home/assets/dollar.svg" + "icon": "/drivers/home/assets/dollar.svg", + "uiComponent": null }, "price_total": { "type": "number", @@ -1518,7 +1730,8 @@ "units": { "en": "kr" }, - "icon": "/drivers/home/assets/dollar.svg" + "icon": "/drivers/home/assets/dollar.svg", + "uiComponent": null } } } \ No newline at end of file diff --git a/app.ts b/app.ts new file mode 100644 index 00000000..26c274a6 --- /dev/null +++ b/app.ts @@ -0,0 +1,35 @@ +import sourceMapSupport from 'source-map-support'; +import 'newrelic'; +import { App } from 'homey'; + +sourceMapSupport.install(); + +class TibberApp extends App { + async onInit() { + this.log('Tibber app is running...'); + + const v = this.homey.settings.get('v'); + if (v !== 2) { + this.log('Cleaning logs'); + this.homey.settings.set('v', 2); + this.cleanupLogs('*').catch(console.error); + } + } + + async cleanupLogs(prefix: string) { + if (prefix !== '*') return; + const logs = await this.homey.insights.getLogs(); + + await Promise.all( + logs + .filter(({ name }) => name.startsWith(prefix)) + .map((log) => { + console.log('Deleting log', log.name); + return this.homey.insights.deleteLog(log); + }), + ); + } +} + +// workaround for `The class exported in '' must extend Homey.` error +module.exports = TibberApp; diff --git a/drivers/home/device.js b/drivers/home/device.js deleted file mode 100644 index 7bd976ee..00000000 --- a/drivers/home/device.js +++ /dev/null @@ -1,519 +0,0 @@ -'use strict'; - -const Homey = require('homey'), - _ = require('lodash'), - http = require('http.min'), - moment = require('moment-timezone'), - Promise = require('bluebird'), - { tibber, getRandomDelay } = require('../../lib/tibber'), - newrelic = require('newrelic'); - -class MyDevice extends Homey.Device { - - async onInit() { - - this._tibber = tibber({ - log: this.log, - homeId: this.getData().id, - token: this.getData().t - }); - - if(!this.getData().address) - return this.setUnavailable("You will need to remove and add this home as new device"); - - this._deviceLabel = this.getName(); - this._insightId = this._deviceLabel.replace(/[^a-z0-9]/ig,'_').toLowerCase(); - this._lastPrice = undefined; - this._lastTemperature = undefined; - this._location = { lat:this.getData().address.latitude, lon:this.getData().address.longitude }; - - this._priceChangedTrigger = new Homey.FlowCardTriggerDevice('price_changed'); - this._priceChangedTrigger.register(); - - this._temperatureChangedTrigger = new Homey.FlowCardTriggerDevice('temperature_changed'); - this._temperatureChangedTrigger.register(); - - this._consumptionReportTrigger = new Homey.FlowCardTriggerDevice('consumption_report'); - this._consumptionReportTrigger.register(); - - this._priceBelowAvgTrigger = new Homey.FlowCardTriggerDevice('price_below_avg'); - this._priceBelowAvgTrigger - .register() - .registerRunListener(this._priceAvgComparer.bind(this)); - - this._priceAboveAvgTrigger = new Homey.FlowCardTriggerDevice('price_above_avg'); - this._priceAboveAvgTrigger - .register() - .registerRunListener(this._priceAvgComparer.bind(this)); - - this._priceBelowAvgTodayTrigger = new Homey.FlowCardTriggerDevice('price_below_avg_today'); - this._priceBelowAvgTodayTrigger - .register() - .registerRunListener(this._priceAvgComparer.bind(this)); - - this._priceAboveAvgTodayTrigger = new Homey.FlowCardTriggerDevice('price_above_avg_today'); - this._priceAboveAvgTodayTrigger - .register() - .registerRunListener(this._priceAvgComparer.bind(this)); - - this._priceAtLowestTrigger = new Homey.FlowCardTriggerDevice('price_at_lowest'); - this._priceAtLowestTrigger - .register() - .registerRunListener(this._priceMinMaxComparer.bind(this)); - - this._priceAtHighestTrigger = new Homey.FlowCardTriggerDevice('price_at_highest'); - this._priceAtHighestTrigger - .register() - .registerRunListener(this._priceMinMaxComparer.bind(this)); - - this._priceAtLowestTodayTrigger = new Homey.FlowCardTriggerDevice('price_at_lowest_today'); - this._priceAtLowestTodayTrigger.register(); //Cannot use registerRunListener as the card have no arguments - - this._priceAtHighestTodayTrigger = new Homey.FlowCardTriggerDevice('price_at_highest_today'); - this._priceAtHighestTodayTrigger.register(); //Cannot use registerRunListener as the card have no arguments - - this._priceAmongLowestTrigger = new Homey.FlowCardTriggerDevice('price_among_lowest_today'); - this._priceAmongLowestTrigger - .register() - .registerRunListener(this._priceMinMaxComparer.bind(this)); - - this._priceAmongHighestTrigger = new Homey.FlowCardTriggerDevice('price_among_highest_today'); - this._priceAmongHighestTrigger - .register() - .registerRunListener(this._priceMinMaxComparer.bind(this)); - - this._currentPriceBelowCondition = new Homey.FlowCardCondition('current_price_below'); - this._currentPriceBelowCondition - .register() - .registerRunListener(args => args.price > _.get(this._lastPrice, 'total')); - - this._currentPriceBelowAvgCondition = new Homey.FlowCardCondition('cond_price_below_avg'); - this._currentPriceBelowAvgCondition - .register() - .registerRunListener(args => this._priceAvgComparer(args, { below: true })); - - this._currentPriceAboveAvgCondition = new Homey.FlowCardCondition('cond_price_above_avg'); - this._currentPriceAboveAvgCondition - .register() - .registerRunListener(args => this._priceAvgComparer(args, { below: false })); - - this._currentPriceBelowAvgTodayCondition = new Homey.FlowCardCondition('cond_price_below_avg_today'); - this._currentPriceBelowAvgTodayCondition - .register() - .registerRunListener(args => this._priceAvgComparer(args, { below: true })); - - this._currentPriceAboveAvgTodayCondition = new Homey.FlowCardCondition('cond_price_above_avg_today'); - this._currentPriceAboveAvgTodayCondition - .register() - .registerRunListener(args => this._priceAvgComparer(args, { below: false })); - - this._currentPriceAtLowestCondition = new Homey.FlowCardCondition('cond_price_at_lowest'); - this._currentPriceAtLowestCondition - .register() - .registerRunListener(args => this._priceMinMaxComparer(args, { lowest: true })); - - this._currentPriceAtHighestCondition = new Homey.FlowCardCondition('cond_price_at_highest'); - this._currentPriceAtHighestCondition - .register() - .registerRunListener(args => this._priceMinMaxComparer(args, { lowest: false })); - - this._currentPriceAtLowestTodayCondition = new Homey.FlowCardCondition('cond_price_at_lowest_today'); - this._currentPriceAtLowestTodayCondition - .register() - .registerRunListener(args => this._priceMinMaxComparer(args, { lowest: true })); - - this._currentPriceAtHighestTodayCondition = new Homey.FlowCardCondition('cond_price_at_highest_today'); - this._currentPriceAtHighestTodayCondition - .register() - .registerRunListener(args => this._priceMinMaxComparer(args, { lowest: false })); - - this._currentPriceAmongLowestTodayCondition = new Homey.FlowCardCondition('cond_price_among_lowest_today'); - this._currentPriceAmongLowestTodayCondition - .register() - .registerRunListener(args => this._priceMinMaxComparer(args, { lowest: true })); - - this._currentPriceAmongHighestTodayCondition = new Homey.FlowCardCondition('cond_price_among_highest_today'); - this._currentPriceAmongHighestTodayCondition - .register() - .registerRunListener(args => this._priceMinMaxComparer(args, { lowest: false })); - - this._outdoorTemperatureBelowCondition = new Homey.FlowCardCondition('temperature_below'); - this._outdoorTemperatureBelowCondition - .register() - .registerRunListener(args => args.temperature > this._lastTemperature); - - this._sendPushNotificationAction = new Homey.FlowCardAction('sendPushNotification'); - this._sendPushNotificationAction - .register() - .registerRunListener(args => this._tibber.sendPush(args.title, args.message)); - - if (!this.hasCapability('price_level')) - await this.addCapability('price_level'); - - this.log(`Tibber home device ${this.getName()} has been initialized`); - return this.updateData(); - } - - onDeleted() { - this.log('Device deleted:', this._deviceLabel); - - Homey.ManagerSettings.set(`${this._insightId}_lastLoggedDailyConsumption`, undefined); - Homey.ManagerSettings.set(`${this._insightId}_lastLoggerHourlyConsumption`, undefined); - - return Homey.app.cleanupLogs(this._insightId); - } - - async getTemperature() { - try { - this.log(`Fetching temperature with api key ${Homey.env.DS_API_KEY} for coordinates ${this._location.lat},${this._location.lon}`); - let temperature; - try - { - const forecast = await newrelic.startWebTransaction('Get temperature', () => http.json(`https://api.darksky.net/forecast/${Homey.env.DS_API_KEY}/${this._location.lat},${this._location.lon}?units=si`)); - temperature = _.get(forecast, 'currently.temperature'); - this.log(`Fetched temperature ${temperature}`); - } - catch (error) - { - this.log(`Error fetching temperature ${JSON.stringify(error)}`); - } - - if(temperature && temperature !== this._lastTemperature) - { - this._lastTemperature = temperature; - this.setCapabilityValue('measure_temperature', temperature).catch(console.error); - - this.log('Triggering temperature_changed', temperature); - this._temperatureChangedTrigger.trigger(this, temperature); - - let temperatureLogger = await this._createGetLog(`${this._insightId}_temperature`, { - label: `${this.getLoggerPrefix()}Outdoor temperature`, - type: 'number', - decimals: true - }); - temperatureLogger.createEntry(temperature, new Date()).catch(console.error); - } - } - catch (e) { - console.error(`Error fetching weather forecast (${this._location.lat},${this._location.lon})`, e); - } - } - - isConsumptionReportEnabled() { - return this.getSetting('enable_consumption_report') || false; - } - - async updateData() { - try { - this.log(`Begin update`); - - // Fetch and update price triggers - const priceInfoNextHours = await this._tibber.getPriceInfoCached(); - this.onPriceData(priceInfoNextHours); - - // Fetch and update temperature - await this.getTemperature(); - - // Fetch and update consumption report if enabled - if (this.isConsumptionReportEnabled()) { - this.log(`Consumption report enabled. Begin update`); - const now = moment(); - const lastLoggedDailyConsumption = this.getLastLoggedDailyConsumption(); - let daysToFetch = 14; - if (lastLoggedDailyConsumption) { - const durationSinceLastDailyConsumption = moment.duration(now.diff(moment(lastLoggedDailyConsumption))); - daysToFetch = Math.floor(durationSinceLastDailyConsumption.asDays()); - } - - const lastLoggedHourlyConsumption = this.getLastLoggedHourlyConsumption(); - let hoursToFetch = 200; - if (lastLoggedHourlyConsumption) { - var durationSinceLastHourlyConsumption = moment.duration(now.diff(moment(lastLoggedHourlyConsumption))); - hoursToFetch = Math.floor(durationSinceLastHourlyConsumption.asHours()); - } - - this.log(`Last logged daily consumption at ${lastLoggedDailyConsumption} hourly consumption at ${lastLoggedHourlyConsumption}. Fetch ${daysToFetch} days ${hoursToFetch} hours`); - - if (!lastLoggedDailyConsumption || !lastLoggedHourlyConsumption) { - const consumptionData = await this._tibber.getConsumptionData(daysToFetch, hoursToFetch); - await this.onConsumptionData(consumptionData); - } - else if (!hoursToFetch && !daysToFetch) { - this.log(`Consumption data up to date. Skip fetch.`); - } - else { - const delay = getRandomDelay(0, 59 * 60); - this.log(`Schedule consumption fetch for ${daysToFetch} days ${hoursToFetch} hours after ${delay} seconds.`); - setTimeout(async () => { - const consumptionData = await this._tibber.getConsumptionData(daysToFetch, hoursToFetch); - await this.onConsumptionData(consumptionData); - }, delay * 1000); - } - } - - const nextHour = moment().add(1, 'hour').startOf('hour'); - this.log(`Next time to run update is at ${nextHour.format()}`); - const delay = moment.duration(nextHour.diff(moment())); - this.scheduleUpdate(delay.asSeconds()); - - this.log(`End update`); - } - catch(e) { - this.log('Error fetching data', e); - - const errorCode = _.get(e, 'response.errors[0].extensions.code'); - this.log('Received error code', errorCode); - if (errorCode == 'HOME_NOT_FOUND') { - this.log(`Home with id ${this.getData().id} not found. Set device unavailable`); - await this.setUnavailable('Tibber home with specified id not found. Please re-add device.'); - return; - } - - //Try again after a delay - const delay = getRandomDelay(0, 5 * 60); - this.scheduleUpdate(delay); - } - } - - scheduleUpdate(seconds) { - this.log(`Scheduling update again in ${seconds} seconds`); - setTimeout(this.updateData.bind(this), seconds * 1000); - } - - getLoggerPrefix() { - return this.getDriver().getDevices().length > 1 ? (`${this._deviceLabel} `) : ''; - } - - async onPriceData(priceInfoNextHours) { - const currentHour = moment().startOf('hour'); - const priceInfoCurrent = _.find(priceInfoNextHours, (p) => currentHour.isSame(moment(p.startsAt))) - if (!priceInfoCurrent) { - this.log(`Error finding current price info for ${currentHour.format()}. Abort.`, priceInfoNextHours); - return; - } - - if(_.get(priceInfoCurrent, 'startsAt') !== _.get(this._lastPrice, 'startsAt')) { - this._lastPrice = priceInfoCurrent; - this._priceInfoNextHours = priceInfoNextHours; - - if(priceInfoCurrent.total !== null) { - this.setCapabilityValue("price_total", priceInfoCurrent.total).catch(console.error); - this.setCapabilityValue("price_level", priceInfoCurrent.level).catch(console.error); - - this._priceChangedTrigger.trigger(this, priceInfoCurrent); - this.log('Triggering price_changed', priceInfoCurrent); - - let priceLogger = await this._createGetLog(`${this._insightId}_price`, { - label: `${this.getLoggerPrefix()}Current price`, - type: 'number', - decimals: true - }); - priceLogger.createEntry(priceInfoCurrent.total, moment(priceInfoCurrent.startsAt).toDate()).catch(console.error); - - if(priceInfoNextHours) { - this._priceBelowAvgTrigger.trigger(this, null, { below: true }).catch(console.error); - this._priceBelowAvgTodayTrigger.trigger(this, null, { below: true }).catch(console.error); - this._priceAboveAvgTrigger.trigger(this, null, { below: false }).catch(console.error); - this._priceAboveAvgTodayTrigger.trigger(this, null, { below: false }).catch(console.error); - this._priceAtLowestTrigger.trigger(this, null, { lowest: true }).catch(console.error); - this._priceAtHighestTrigger.trigger(this, null, { lowest: false }).catch(console.error); - this._priceAmongLowestTrigger.trigger(this, null, { lowest: true }).catch(console.error); - this._priceAmongHighestTrigger.trigger(this, null, { lowest: true }).catch(console.error); - - if(this._priceMinMaxComparer({}, { lowest: true })) - this._priceAtLowestTodayTrigger.trigger(this, null, { lowest: true }).catch(console.error); - if(this._priceMinMaxComparer({}, { lowest: false })) - this._priceAtHighestTodayTrigger.trigger(this, null, { lowest: false }).catch(console.error); - } - } - } - } - - getLastLoggedDailyConsumption() { - return Homey.ManagerSettings.get(`${this._insightId}_lastLoggedDailyConsumption`); - } - - setLastLoggedDailyConsumption(value) { - Homey.ManagerSettings.set(`${this._insightId}_lastLoggedDailyConsumption`, value); - } - - getLastLoggedHourlyConsumption() { - return Homey.ManagerSettings.get(`${this._insightId}_lastLoggerHourlyConsumption`); - } - - setLastLoggedHourlyConsumption(value) { - Homey.ManagerSettings.set(`${this._insightId}_lastLoggerHourlyConsumption`, value); - } - - async onConsumptionData(data) { - - try { - const lastLoggedDailyConsumption = this.getLastLoggedDailyConsumption(); - const consumptionsSinceLastReport = []; - const dailyConsumptions = _.get(data, 'viewer.home.daily.nodes') || []; - await Promise.mapSeries(dailyConsumptions, async dailyConsumption => { - if (dailyConsumption.consumption !== null) { - if (lastLoggedDailyConsumption && moment(dailyConsumption.to) <= moment(lastLoggedDailyConsumption)) - return; - - consumptionsSinceLastReport.push(dailyConsumption); - this.setLastLoggedDailyConsumption(dailyConsumption.to); - - this.log('Got daily consumption', dailyConsumption); - let consumptionLogger = await this._createGetLog(`${this._insightId}_dailyConsumption`, { - label: `${this.getLoggerPrefix()}Daily consumption`, - type: 'number', - decimals: true - }); - - consumptionLogger.createEntry(dailyConsumption.consumption, moment(dailyConsumption.to).toDate()).catch(console.error); - - let costLogger = await this._createGetLog(`${this._insightId}_dailyCost`, { - label: `${this.getLoggerPrefix()}Daily total cost`, - type: 'number', - decimals: true - }); - costLogger.createEntry(dailyConsumption.totalCost, moment(dailyConsumption.to).toDate()).catch(console.error); - } - }); - - if (consumptionsSinceLastReport.length > 0) - this._consumptionReportTrigger.trigger(this, { - consumption: +_.sumBy(consumptionsSinceLastReport, 'consumption').toFixed(2), - totalCost: +_.sumBy(consumptionsSinceLastReport, 'totalCost').toFixed(2), - unitCost: +_.sumBy(consumptionsSinceLastReport, 'unitCost').toFixed(2), - unitPrice: +_.meanBy(consumptionsSinceLastReport, 'unitPrice').toFixed(2) - }); - } - catch (e) { - console.error('Error logging daily consumption', e); - } - - try { - const lastLoggedHourlyConsumption = this.getLastLoggedHourlyConsumption(); - const hourlyConsumptions = _.get(data, 'viewer.home.hourly.nodes') || []; - await Promise.mapSeries(hourlyConsumptions, async hourlyConsumption => { - if (hourlyConsumption.consumption !== null) { - if (lastLoggedHourlyConsumption && moment(hourlyConsumption.to) <= moment(lastLoggedHourlyConsumption)) - return; - - this.setLastLoggedHourlyConsumption(hourlyConsumption.to); - - this.log('Got hourly consumption', hourlyConsumption); - let consumptionLogger = await this._createGetLog(`${this._insightId}hourlyConsumption`, { - label: `${this.getLoggerPrefix()}Hourly consumption`, - type: 'number', - decimals: true - }); - - consumptionLogger.createEntry(hourlyConsumption.consumption, moment(hourlyConsumption.to).toDate()).catch(console.error); - - let costLogger = await this._createGetLog(`${this._insightId}_hourlyCost`, { - label: `${this.getLoggerPrefix()}Hourly total cost`, - type: 'number', - decimals: true - }); - costLogger.createEntry(hourlyConsumption.totalCost, moment(hourlyConsumption.to).toDate()).catch(console.error); - } - }); - } - catch (e) { - console.error('Error logging hourly consumption', e); - } - } - - _priceAvgComparer(args, state) { - if (args.hours === 0) - return false; - - const now = moment(); - let avgPriceNextHours; - if(args.hours) - avgPriceNextHours = _(this._priceInfoNextHours) - .filter(p => args.hours > 0 ? moment(p.startsAt).isAfter(now) : moment(p.startsAt).isBefore(now)) - .take(Math.abs(args.hours)) - .meanBy(x => x.total); - else - avgPriceNextHours = _(this._priceInfoNextHours) - .filter(p => moment(p.startsAt).add(30, 'minutes').isSame(now, 'day')) - .meanBy(x => x.total); - - if (avgPriceNextHours.length == 0) { - this.log(`Cannot determine condition. No prices for next hours available.`); - return false; - } - - if (!this._lastPrice) - return false; - - let diffAvgCurrent = (this._lastPrice.total - avgPriceNextHours) / avgPriceNextHours * 100; - if (state.below) - diffAvgCurrent = diffAvgCurrent * -1; - - this.log(`${this._lastPrice.total.toFixed(2)} is ${diffAvgCurrent.toFixed(2)}% ${state.below ? 'below' : 'above'} avg (${avgPriceNextHours.toFixed(2)}) ${args.hours ? 'next ' + args.hours + ' hours' : 'today'}. Condition of min ${args.percentage} percentage met = ${diffAvgCurrent > args.percentage}`); - return diffAvgCurrent > args.percentage; - } - - _priceMinMaxComparer(args, state) { - if (args.hours === 0 || args.ranked_hours === 0) - return false; - - const now = moment(); - let pricesNextHours; - if(args.hours) - pricesNextHours = _(this._priceInfoNextHours) - .filter(p => args.hours > 0 ? moment(p.startsAt).isAfter(now) : moment(p.startsAt).isBefore(now)) - .take(Math.abs(args.hours)) - .value(); - else - pricesNextHours = _(this._priceInfoNextHours) - .filter(p => moment(p.startsAt).add(30, 'minutes').isSame(now, 'day')) - .value(); - - if (pricesNextHours.length == 0) { - this.log(`Cannot determine condition. No prices for next hours available.`); - return false; - } - - let conditionMet; - if(args.ranked_hours) { - sortedHours = _.sortBy(pricesNextHours, ['total']); - currentHourRank = _.findIndex(pricesNextHours, ['startsAt', this._lastPrice.startsAt]); - if (currentHourRank < 0) { - this.log(`Could not find the current hour rank among today's hours`); - return false - } - - conditionMet = state.lowest ? currentHourRank < args.ranked_hours - : currentHourRank >= sortedHours.length - args.ranked_hours - - this.log(`${this._lastPrice.total.toFixed(2)} is among the ${state.lowest ? 'lowest' : 'highest'} ${args.ranked_hours} hours today = ${conditionMet}`); - } else { - toCompare = state.lowest ? _.minBy(pricesNextHours, 'total').total - : _.maxBy(pricesNextHours, 'total').total; - - conditionMet = state.lowest ? this._lastPrice.total <= toCompare - : this._lastPrice.total >= toCompare; - - this.log(`${this._lastPrice.total.toFixed(2)} is ${state.lowest ? 'lower than the lowest' : 'higher than the highest'} (${toCompare}) ${args.hours ? 'among the next ' + args.hours + ' hours' : 'today'} = ${conditionMet}`); - } - - return conditionMet; - } - - async _createGetLog(name, options) { - try { - let log = await Homey.ManagerInsights.getLog(name); - return log; - } - catch(e) { - console.error('Could not find log ' + name + '. Creating new log.', e); - if(!options.title) - options.title = options.label; //for 2.0 support - - return Homey.ManagerInsights.createLog(name, options); - } - } -} - -module.exports = MyDevice; \ No newline at end of file diff --git a/drivers/home/device.ts b/drivers/home/device.ts new file mode 100644 index 00000000..e413662d --- /dev/null +++ b/drivers/home/device.ts @@ -0,0 +1,756 @@ +import { Device, FlowCard, FlowCardTriggerDevice } from 'homey'; +import _ from 'lodash'; +import moment from 'moment-timezone'; +import { mapSeries } from 'bluebird'; +import { ClientError } from 'graphql-request/dist/types'; +import { + TibberApi, + getRandomDelay, + PriceRatingEntry, + ConsumptionData, + ConsumptionNode, +} from '../../lib/tibber'; + +const priceLevelMap = { + LOW: 'CHEAP', + NORMAL: 'NORMAL', + HIGH: 'HIGH', +}; + +class HomeDevice extends Device { + #tibber!: TibberApi; + #deviceLabel!: string; + #insightId!: string; + #priceInfoNextHours!: PriceRatingEntry[]; + #lastPrice?: PriceRatingEntry; + #location!: { lat: number; lon: number }; + #priceChangedTrigger!: FlowCardTriggerDevice; + #consumptionReportTrigger!: FlowCardTriggerDevice; + #priceBelowAvgTrigger!: FlowCardTriggerDevice; + #priceAboveAvgTrigger!: FlowCardTriggerDevice; + #priceBelowAvgTodayTrigger!: FlowCardTriggerDevice; + #priceAboveAvgTodayTrigger!: FlowCardTriggerDevice; + #priceAtLowestTrigger!: FlowCardTriggerDevice; + #priceAtHighestTrigger!: FlowCardTriggerDevice; + #priceAtLowestTodayTrigger!: FlowCardTriggerDevice; + #priceAtHighestTodayTrigger!: FlowCardTriggerDevice; + #priceAmongLowestTrigger!: FlowCardTriggerDevice; + #priceAmongHighestTrigger!: FlowCardTriggerDevice; + #currentPriceBelowCondition!: FlowCard; + #currentPriceBelowAvgCondition!: FlowCard; + #currentPriceAboveAvgCondition!: FlowCard; + #currentPriceBelowAvgTodayCondition!: FlowCard; + #currentPriceAboveAvgTodayCondition!: FlowCard; + #currentPriceAtLowestCondition!: FlowCard; + #currentPriceAtHighestCondition!: FlowCard; + #currentPriceAtLowestTodayCondition!: FlowCard; + #currentPriceAtHighestTodayCondition!: FlowCard; + #currentPriceAmongLowestTodayCondition!: FlowCard; + #currentPriceAmongHighestTodayCondition!: FlowCard; + #sendPushNotificationAction!: FlowCard; + #hasDeprecatedTotalPriceCapability = false; + #hasDeprecatedPriceLevelCapability = false; + + async onInit() { + // `price_total` was deprecated in favor of `measure_price_total` (so it could be used as a device indicator) + // and `price_level` was deprecated in favor of `measure_price_level` (because it went from 5 enum values to 3) + // we don't want to remove them completely and break users' flow cards using them + this.#hasDeprecatedTotalPriceCapability = this.hasCapability('price_total'); + this.#hasDeprecatedTotalPriceCapability = this.hasCapability('price_level'); + + const data = this.getData(); + const { id: homeId, t: token } = data; + + this.#tibber = new TibberApi(this.log, this.homey.settings, homeId, token); + + if (data.address === undefined) { + return this.setUnavailable( + 'You will need to remove and add this home as new device', + ); + } + + this.#deviceLabel = this.getName(); + this.#insightId = this.#deviceLabel + .replace(/[^a-z0-9]/gi, '_') + .toLowerCase(); + this.#lastPrice = undefined; + const { latitude: lat, longitude: lon } = data.address; + this.#location = { lat, lon }; + + this.#priceChangedTrigger = + this.homey.flow.getDeviceTriggerCard('price_changed'); + + this.#consumptionReportTrigger = + this.homey.flow.getDeviceTriggerCard('consumption_report'); + + this.#priceBelowAvgTrigger = + this.homey.flow.getDeviceTriggerCard('price_below_avg'); + this.#priceBelowAvgTrigger.registerRunListener( + this.#priceAvgComparer.bind(this), + ); + + this.#priceAboveAvgTrigger = + this.homey.flow.getDeviceTriggerCard('price_above_avg'); + this.#priceAboveAvgTrigger.registerRunListener( + this.#priceAvgComparer.bind(this), + ); + + this.#priceBelowAvgTodayTrigger = this.homey.flow.getDeviceTriggerCard( + 'price_below_avg_today', + ); + this.#priceBelowAvgTodayTrigger.registerRunListener( + this.#priceAvgComparer.bind(this), + ); + + this.#priceAboveAvgTodayTrigger = this.homey.flow.getDeviceTriggerCard( + 'price_above_avg_today', + ); + this.#priceAboveAvgTodayTrigger.registerRunListener( + this.#priceAvgComparer.bind(this), + ); + + this.#priceAtLowestTrigger = + this.homey.flow.getDeviceTriggerCard('price_at_lowest'); + this.#priceAtLowestTrigger.registerRunListener( + this.#priceMinMaxComparer.bind(this), + ); + + this.#priceAtHighestTrigger = + this.homey.flow.getDeviceTriggerCard('price_at_highest'); + this.#priceAtHighestTrigger.registerRunListener( + this.#priceMinMaxComparer.bind(this), + ); + + this.#priceAtLowestTodayTrigger = this.homey.flow.getDeviceTriggerCard( + 'price_at_lowest_today', + ); + + this.#priceAtHighestTodayTrigger = this.homey.flow.getDeviceTriggerCard( + 'price_at_highest_today', + ); + + this.#priceAmongLowestTrigger = this.homey.flow.getDeviceTriggerCard( + 'price_among_lowest_today', + ); + this.#priceAmongLowestTrigger.registerRunListener( + this.#priceMinMaxComparer.bind(this), + ); + + this.#priceAmongHighestTrigger = this.homey.flow.getDeviceTriggerCard( + 'price_among_highest_today', + ); + this.#priceAmongHighestTrigger.registerRunListener( + this.#priceMinMaxComparer.bind(this), + ); + + this.#currentPriceBelowCondition = this.homey.flow.getConditionCard( + 'current_price_below', + ); + this.#currentPriceBelowCondition.registerRunListener((args, _state) => { + if (this.#lastPrice === undefined) return false; + return args.price > Number(this.#lastPrice.total); + }); + + this.#currentPriceBelowAvgCondition = this.homey.flow.getConditionCard( + 'cond_price_below_avg', + ); + this.#currentPriceBelowAvgCondition.registerRunListener((args) => + this.#priceAvgComparer(args, { below: true }), + ); + + this.#currentPriceAboveAvgCondition = this.homey.flow.getConditionCard( + 'cond_price_above_avg', + ); + this.#currentPriceAboveAvgCondition.registerRunListener((args) => + this.#priceAvgComparer(args, { below: false }), + ); + + this.#currentPriceBelowAvgTodayCondition = this.homey.flow.getConditionCard( + 'cond_price_below_avg_today', + ); + this.#currentPriceBelowAvgTodayCondition.registerRunListener((args) => + this.#priceAvgComparer(args, { below: true }), + ); + + this.#currentPriceAboveAvgTodayCondition = this.homey.flow.getConditionCard( + 'cond_price_above_avg_today', + ); + this.#currentPriceAboveAvgTodayCondition.registerRunListener((args) => + this.#priceAvgComparer(args, { below: false }), + ); + + this.#currentPriceAtLowestCondition = this.homey.flow.getConditionCard( + 'cond_price_at_lowest', + ); + this.#currentPriceAtLowestCondition.registerRunListener((args) => + this.#priceMinMaxComparer(args, { lowest: true }), + ); + + this.#currentPriceAtHighestCondition = this.homey.flow.getConditionCard( + 'cond_price_at_highest', + ); + this.#currentPriceAtHighestCondition.registerRunListener((args) => + this.#priceMinMaxComparer(args, { lowest: false }), + ); + + this.#currentPriceAtLowestTodayCondition = this.homey.flow.getConditionCard( + 'cond_price_at_lowest_today', + ); + this.#currentPriceAtLowestTodayCondition.registerRunListener((args) => + this.#priceMinMaxComparer(args, { lowest: true }), + ); + + this.#currentPriceAtHighestTodayCondition = + this.homey.flow.getConditionCard('cond_price_at_highest_today'); + this.#currentPriceAtHighestTodayCondition.registerRunListener((args) => + this.#priceMinMaxComparer(args, { lowest: false }), + ); + + this.#currentPriceAmongLowestTodayCondition = + this.homey.flow.getConditionCard('cond_price_among_lowest_today'); + this.#currentPriceAmongLowestTodayCondition.registerRunListener((args) => + this.#priceMinMaxComparer(args, { lowest: true }), + ); + + this.#currentPriceAmongHighestTodayCondition = + this.homey.flow.getConditionCard('cond_price_among_highest_today'); + this.#currentPriceAmongHighestTodayCondition.registerRunListener((args) => + this.#priceMinMaxComparer(args, { lowest: false }), + ); + + this.#sendPushNotificationAction = this.homey.flow.getActionCard( + 'sendPushNotification', + ); + this.#sendPushNotificationAction.registerRunListener((args) => + this.#tibber.sendPush(args.title, args.message), + ); + + if (!this.hasCapability('price_level')) + await this.addCapability('price_level'); + + if (!this.hasCapability('measure_price_level')) + await this.addCapability('measure_price_level'); + + if (!this.hasCapability('measure_price_total')) + await this.addCapability('measure_price_total'); + + if (this.hasCapability('measure_temperature')) { + await this.removeCapability('measure_temperature'); + await this.homey.notifications + .createNotification({ + excerpt: + 'Please note potential breaking changes with this version of the ' + + "Tibber app. Details available on the app's store page.", + }) + .catch(console.error); + } + + this.log(`Tibber home device ${this.getName()} has been initialized`); + return this.updateData(); + } + + onDeleted() { + this.log('Device deleted:', this.#deviceLabel); + + this.homey.settings.set( + `${this.#insightId}_lastLoggedDailyConsumption`, + undefined, + ); + this.homey.settings.set( + `${this.#insightId}_lastLoggerHourlyConsumption`, + undefined, + ); + + return this.homey.app?.cleanupLogs(this.#insightId); + } + + isConsumptionReportEnabled() { + return this.getSetting('enable_consumption_report') || false; + } + + async updateData() { + try { + this.log(`Begin update`); + + const priceInfoNextHours = await this.#tibber.getPriceInfoCached( + this.homey.setTimeout, + ); + this.onPriceData(priceInfoNextHours).catch(() => {}); + + if (this.isConsumptionReportEnabled()) { + this.log(`Consumption report enabled. Begin update`); + const now = moment(); + const lastLoggedDailyConsumption = this.getLastLoggedDailyConsumption(); + let daysToFetch = 14; + + if (lastLoggedDailyConsumption) { + const durationSinceLastDailyConsumption = moment.duration( + now.diff(moment(lastLoggedDailyConsumption)), + ); + daysToFetch = Math.floor(durationSinceLastDailyConsumption.asDays()); + } + + const lastLoggedHourlyConsumption = + this.getLastLoggedHourlyConsumption(); + + let hoursToFetch = 200; + if (lastLoggedHourlyConsumption) { + const durationSinceLastHourlyConsumption = moment.duration( + now.diff(moment(lastLoggedHourlyConsumption)), + ); + hoursToFetch = Math.floor( + durationSinceLastHourlyConsumption.asHours(), + ); + } + + this.log( + `Last logged daily consumption at ${lastLoggedDailyConsumption} hourly consumption at ${lastLoggedHourlyConsumption}. Fetch ${daysToFetch} days ${hoursToFetch} hours`, + ); + + if (!lastLoggedDailyConsumption || !lastLoggedHourlyConsumption) { + const consumptionData = await this.#tibber.getConsumptionData( + daysToFetch, + hoursToFetch, + ); + await this.onConsumptionData(consumptionData); + } else if (!hoursToFetch && !daysToFetch) { + this.log(`Consumption data up to date. Skip fetch.`); + } else { + const delay = getRandomDelay(0, 59 * 60); + this.log( + `Schedule consumption fetch for ${daysToFetch} days ${hoursToFetch} hours after ${delay} seconds.`, + ); + this.homey.setTimeout(async () => { + const consumptionData = await this.#tibber.getConsumptionData( + daysToFetch, + hoursToFetch, + ); + await this.onConsumptionData(consumptionData); + }, delay * 1000); + } + } + + const nextHour = moment().add(1, 'hour').startOf('hour'); + this.log(`Next time to run update is at ${nextHour.format()}`); + const delay = moment.duration(nextHour.diff(moment())); + this.scheduleUpdate(delay.asSeconds()); + + this.log(`End update`); + } catch (e) { + this.log('Error fetching data', e); + + const errorCode = (e as ClientError).response?.errors?.[0]?.extensions + ?.code; + + this.log('Received error code', errorCode); + if (errorCode === 'HOME_NOT_FOUND') { + this.log( + `Home with id ${this.getData().id} not found. Set device unavailable`, + ); + await this.setUnavailable( + 'Tibber home with specified id not found. Please re-add device.', + ); + return; + } + + // Try again after a delay + const delay = getRandomDelay(0, 5 * 60); + this.scheduleUpdate(delay); + } + } + + scheduleUpdate(seconds: number) { + this.log(`Scheduling update again in ${seconds} seconds`); + setTimeout(this.updateData.bind(this), seconds * 1000); + } + + getLoggerPrefix() { + return this.driver.getDevices().length > 1 ? `${this.#deviceLabel} ` : ''; + } + + async onPriceData(priceInfoNextHours: PriceRatingEntry[]) { + const currentHour = moment().startOf('hour'); + const priceInfoCurrent = priceInfoNextHours.find((p) => + currentHour.isSame(moment(p.time)), + ); + if (priceInfoCurrent === undefined) { + this.log( + `Error finding current price info for ${currentHour.format()}. Abort.`, + priceInfoNextHours, + ); + return; + } + + if (priceInfoCurrent.time !== this.#lastPrice?.time) { + this.#lastPrice = priceInfoCurrent; + this.#priceInfoNextHours = priceInfoNextHours; + + if (priceInfoCurrent.total !== null) { + this.setCapabilityValue( + 'measure_price_total', + priceInfoCurrent.total, + ).catch(console.error); + + // if the user has flow cards using the deprecated `price_total` capability, update that too, so we don't break existing cards + if (this.#hasDeprecatedTotalPriceCapability) { + this.setCapabilityValue('price_total', priceInfoCurrent.total).catch( + console.error, + ); + } + + this.setCapabilityValue( + 'measure_price_level', + priceInfoCurrent.level, + ).catch(console.error); + + // if the user has flow cards using the deprecated `price_level` capability, update that too, so we don't break existing cards + // this maps `LOW` to the old `CHEAP`, and `HIGH` to the old `EXPENSIVE` + if (this.#hasDeprecatedPriceLevelCapability) { + const level = priceLevelMap[priceInfoCurrent.level]; + this.setCapabilityValue('price_level', level).catch(console.error); + } + + this.#priceChangedTrigger + .trigger(this, priceInfoCurrent) + .catch(console.error); + this.log('Triggering price_changed', priceInfoCurrent); + + const priceLogger = await this.#createGetLog( + `${this.#insightId}_price`, + { + title: `${this.getLoggerPrefix()}Current price`, + type: 'number', + decimals: 1, + }, + ); + priceLogger.createEntry(priceInfoCurrent.total).catch(console.error); + + this.#priceBelowAvgTrigger + .trigger(this, undefined, { below: true }) + .catch(console.error); + + this.#priceBelowAvgTodayTrigger + .trigger(this, undefined, { below: true }) + .catch(console.error); + + this.#priceAboveAvgTrigger + .trigger(this, undefined, { below: false }) + .catch(console.error); + + this.#priceAboveAvgTodayTrigger + .trigger(this, undefined, { below: false }) + .catch(console.error); + + this.#priceAtLowestTrigger + .trigger(this, undefined, { lowest: true }) + .catch(console.error); + + this.#priceAtHighestTrigger + .trigger(this, undefined, { lowest: false }) + .catch(console.error); + + this.#priceAmongLowestTrigger + .trigger(this, undefined, { lowest: true }) + .catch(console.error); + + this.#priceAmongHighestTrigger + .trigger(this, undefined, { lowest: true }) + .catch(console.error); + + if (this.#priceMinMaxComparer({}, { lowest: true })) { + this.#priceAtLowestTodayTrigger + .trigger(this, undefined, { lowest: true }) + .catch(console.error); + } + + if (this.#priceMinMaxComparer({}, { lowest: false })) { + this.#priceAtHighestTodayTrigger + .trigger(this, undefined, { lowest: false }) + .catch(console.error); + } + } + } + } + + getLastLoggedDailyConsumption(): string { + return this.homey.settings.get( + `${this.#insightId}_lastLoggedDailyConsumption`, + ); + } + + setLastLoggedDailyConsumption(value: string) { + this.homey.settings.set( + `${this.#insightId}_lastLoggedDailyConsumption`, + value, + ); + } + + getLastLoggedHourlyConsumption(): string { + return this.homey.settings.get( + `${this.#insightId}_lastLoggerHourlyConsumption`, + ); + } + + setLastLoggedHourlyConsumption(value: string) { + this.homey.settings.set( + `${this.#insightId}_lastLoggerHourlyConsumption`, + value, + ); + } + + async onConsumptionData(data: ConsumptionData) { + try { + const lastLoggedDailyConsumption = this.getLastLoggedDailyConsumption(); + const consumptionsSinceLastReport: ConsumptionNode[] = []; + const dailyConsumptions: ConsumptionNode[] = + data.viewer.home?.daily?.nodes ?? []; + await mapSeries(dailyConsumptions, async (dailyConsumption) => { + if (dailyConsumption.consumption !== null) { + if ( + lastLoggedDailyConsumption && + moment(dailyConsumption.to) <= moment(lastLoggedDailyConsumption) + ) + return; + + consumptionsSinceLastReport.push(dailyConsumption); + this.setLastLoggedDailyConsumption(dailyConsumption.to); + + this.log('Got daily consumption', dailyConsumption); + const consumptionLogger = await this.#createGetLog( + `${this.#insightId}_dailyConsumption`, + { + title: `${this.getLoggerPrefix()}Daily consumption`, + type: 'number', + decimals: 1, + }, + ); + + consumptionLogger + .createEntry(dailyConsumption.consumption) + .catch(console.error); + + const costLogger = await this.#createGetLog( + `${this.#insightId}_dailyCost`, + { + title: `${this.getLoggerPrefix()}Daily total cost`, + type: 'number', + decimals: 1, + }, + ); + costLogger + .createEntry(dailyConsumption.totalCost) + .catch(console.error); + } + }); + + if (consumptionsSinceLastReport.length > 0) { + this.#consumptionReportTrigger + .trigger(this, { + consumption: Number( + _.sumBy(consumptionsSinceLastReport, 'consumption').toFixed(2), + ), + totalCost: Number( + _.sumBy(consumptionsSinceLastReport, 'totalCost').toFixed(2), + ), + unitCost: Number( + _.sumBy(consumptionsSinceLastReport, 'unitCost').toFixed(2), + ), + unitPrice: Number( + _.meanBy(consumptionsSinceLastReport, 'unitPrice').toFixed(2), + ), + }) + .catch(console.error); + } + } catch (e) { + console.error('Error logging daily consumption', e); + } + + try { + const lastLoggedHourlyConsumption = this.getLastLoggedHourlyConsumption(); + const hourlyConsumptions = data.viewer.home?.hourly?.nodes || []; + await mapSeries(hourlyConsumptions, async (hourlyConsumption) => { + if (hourlyConsumption.consumption !== null) { + if ( + lastLoggedHourlyConsumption && + moment(hourlyConsumption.to) <= moment(lastLoggedHourlyConsumption) + ) + return; + + this.setLastLoggedHourlyConsumption(hourlyConsumption.to); + + this.log('Got hourly consumption', hourlyConsumption); + const consumptionLogger = await this.#createGetLog( + `${this.#insightId}hourlyConsumption`, + { + title: `${this.getLoggerPrefix()}Hourly consumption`, + type: 'number', + decimals: 1, + }, + ); + + consumptionLogger + .createEntry(hourlyConsumption.consumption) + .catch(console.error); + + const costLogger = await this.#createGetLog( + `${this.#insightId}_hourlyCost`, + { + title: `${this.getLoggerPrefix()}Hourly total cost`, + type: 'number', + decimals: 1, + }, + ); + costLogger + .createEntry(hourlyConsumption.totalCost) + .catch(console.error); + } + }); + } catch (e) { + console.error('Error logging hourly consumption', e); + } + } + + #priceAvgComparer( + { hours, percentage }: { hours: number; percentage: number }, + { below }: { below: boolean }, + ): boolean { + if (hours === 0) return false; + + const now = moment(); + let avgPriceNextHours: number; + if (hours) { + avgPriceNextHours = _(this.#priceInfoNextHours) + .filter((p) => + hours > 0 + ? moment(p.time).isAfter(now) + : moment(p.time).isBefore(now), + ) + .take(Math.abs(hours)) + .meanBy((x) => x.total); + } else { + avgPriceNextHours = _(this.#priceInfoNextHours) + .filter((p) => moment(p.time).add(30, 'minutes').isSame(now, 'day')) + .meanBy((x) => x.total); + } + + if (avgPriceNextHours === undefined) { + this.log( + `Cannot determine condition. No prices for next hours available.`, + ); + return false; + } + + if (!this.#lastPrice) return false; + + let diffAvgCurrent = + ((this.#lastPrice.total - avgPriceNextHours) / avgPriceNextHours) * 100; + if (below) diffAvgCurrent *= -1; + + this.log( + `${this.#lastPrice.total.toFixed(2)} is ${diffAvgCurrent.toFixed(2)}% ${ + below ? 'below' : 'above' + } avg (${avgPriceNextHours.toFixed(2)}) ${ + hours ? `next ${hours} hours` : 'today' + }. Condition of min ${percentage} percentage met = ${ + diffAvgCurrent > percentage + }`, + ); + return diffAvgCurrent > percentage; + } + + #priceMinMaxComparer( + options: { hours?: number; ranked_hours?: number }, + { lowest }: { lowest: boolean }, + ) { + if (options.hours === 0 || options.ranked_hours === 0) return false; + + const now = moment(); + const pricesNextHours = + options.hours !== undefined + ? _(this.#priceInfoNextHours) + .filter((p) => + options.hours! > 0 + ? moment(p.time).isAfter(now) + : moment(p.time).isBefore(now), + ) + .take(Math.abs(options.hours)) + .value() + : _(this.#priceInfoNextHours) + .filter((p) => moment(p.time).add(30, 'minutes').isSame(now, 'day')) + .value(); + + if (!pricesNextHours.length) { + this.log( + `Cannot determine condition. No prices for next hours available.`, + ); + return false; + } + + if (this.#lastPrice === undefined) { + this.log(`Cannot determine condition. The last price is undefined`); + return false; + } + + let conditionMet; + if (options.ranked_hours !== undefined) { + const sortedHours = _.sortBy(pricesNextHours, ['total']); + const currentHourRank = _.findIndex( + pricesNextHours, + (p) => p.time === this.#lastPrice?.time, + ); + if (currentHourRank < 0) { + this.log(`Could not find the current hour rank among today's hours`); + return false; + } + + conditionMet = lowest + ? currentHourRank < options.ranked_hours + : currentHourRank >= sortedHours.length - options.ranked_hours; + + this.log( + `${this.#lastPrice.total.toFixed(2)} is among the ${ + lowest ? 'lowest' : 'highest' + } ${options.ranked_hours} hours today = ${conditionMet}`, + ); + } else { + const toCompare = lowest + ? _.minBy(pricesNextHours, 'total')!.total + : _.maxBy(pricesNextHours, 'total')!.total; + + conditionMet = lowest + ? this.#lastPrice.total <= toCompare + : this.#lastPrice.total >= toCompare; + + this.log( + `${this.#lastPrice.total.toFixed(2)} is ${ + lowest ? 'lower than the lowest' : 'higher than the highest' + } (${toCompare}) ${ + options.hours ? `among the next ${options.hours} hours` : 'today' + } = ${conditionMet}`, + ); + } + + return conditionMet; + } + + async #createGetLog( + name: string, + options: { + title: string; + type: string; + units?: string | undefined; + decimals?: number | undefined; + }, + ) { + try { + return await this.homey.insights.getLog(name); + } catch (e) { + console.info( + `Could not find log ${name} (error: ${e}). Creating new log.`, + ); + return await this.homey.insights.createLog(name, options); + } + } +} + +module.exports = HomeDevice; diff --git a/drivers/home/driver.compose.json b/drivers/home/driver.compose.json index 6d43177e..4fb01cc1 100644 --- a/drivers/home/driver.compose.json +++ b/drivers/home/driver.compose.json @@ -2,6 +2,13 @@ "name": { "en": "Home" }, + "platforms": [ + "local", + "cloud" + ], + "connectivity": [ + "cloud" + ], "mobile": { "components": [ { @@ -12,35 +19,23 @@ "id": "sensor", "options": { "icons": { - "price_total": "/drivers/home/assets/dollar.svg" + "measure_price_total": "/drivers/home/assets/dollar.svg" } }, "capabilities": [ - "price_total" - ] - }, - { - "id": "sensor", - "capabilities": [ - "measure_temperature" + "measure_price_total", + "measure_price_level" ] } ] }, "capabilities": [ - "price_total", - "price_level", - "measure_temperature" + "measure_price_total", + "measure_price_level" ], "capabilitiesOptions": { - "price_total": { + "measure_price_total": { "preventInsights": true - }, - "measure_temperature": { - "preventInsights": true, - "title": { - "en": "Outdoor" - } } }, "class": "other", @@ -76,5 +71,6 @@ "en": "Enable periodical fetch of Tibber consumption data to Homey Insights. Periodical fetch produces a lot of traffic towards Tibber API so enable only if needed." }, "value": false - }] + } + ] } diff --git a/drivers/home/driver.flow.compose.json b/drivers/home/driver.flow.compose.json index 283b49da..24b008d2 100644 --- a/drivers/home/driver.flow.compose.json +++ b/drivers/home/driver.flow.compose.json @@ -34,21 +34,10 @@ "en": "level" } } - ] - }, - { - "id": "temperature_changed", - "title": { - "en": "Temperature changed" - }, - "tokens": [ - { - "name": "temperature", - "type": "number", - "title": { - "en": "Temperature" - } - } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -56,21 +45,35 @@ "title": { "en": "Current price is [x] percent below average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent below average of the next [[hours]] hours" + }, + "tokens": [], "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -78,21 +81,35 @@ "title": { "en": "Current price is [x] percent above average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent above average of the next [[hours]] hours" + }, + "tokens": [], "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "2" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -100,14 +117,24 @@ "title": { "en": "Current price is [x] percent below today's average" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent below today's average" + }, "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -115,138 +142,197 @@ "title": { "en": "Current price is [x] percent above today's average" }, + "titleFormatted": { + "en": "Current price is [[percentage]] percent above today's average" + }, "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "price_at_lowest", "title": { - "en": "Current price is at the lowest among the next [x] hours" + "en": "Current price is at its lowest among the next [x] hours" + }, + "titleFormatted": { + "en": "Current price is at its lowest among the next [[hours]] hours" }, "args": [ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "price_at_highest", "title": { - "en": "Current price is at the highest among the next [x] hours" + "en": "Current price is at its highest among the next [y] hours" + }, + "titleFormatted": { + "en": "Current price is at its highest among the next [[hours]] hours" }, "args": [ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "price_at_lowest_today", "title": { "en": "Current price is at today's lowest" - } + }, + "platforms": [ + "local", + "cloud" + ] }, { "id": "price_at_highest_today", "title": { "en": "Current price is at today's highest" - } + }, + "platforms": [ + "local", + "cloud" + ] }, { "id": "price_among_lowest_today", "title": { - "en": "Current price is one of todays lowest [x] prices" + "en": "Current price is one of today's lowest [x] prices" + }, + "titleFormatted": { + "en": "Current price is one of today's lowest [[ranked_hours]] prices" }, "args": [ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "price_among_highest_today", "title": { - "en": "Current price is one of todays highest [x] prices" + "en": "Current price is one of today's highest [x] prices" + }, + "titleFormatted": { + "en": "Current price is one of today's highest [[ranked_hours]] prices" }, "args": [ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { - "id": "consumption_report", - "title": { - "en": "Consumption report" - }, - "tokens": [{ - "name": "consumption", - "type": "number", - "title": { - "en": "consumption" - } - }, { - "name": "totalCost", - "type": "number", - "title": { - "en": "cost" - } - } - ] - } - ], - "conditions": [ - { - "id": "current_price_below", + "id": "consumption_report", "title": { - "en": "Current price !{{below|above}}" + "en": "Consumption is reported" }, - "args": [ + "tokens": [ { - "name": "price", + "name": "consumption", "type": "number", - "placeholder": { - "en": "price" + "title": { + "en": "consumption" + } + }, + { + "name": "totalCost", + "type": "number", + "title": { + "en": "cost" } } + ], + "platforms": [ + "local", + "cloud" ] - }, + } + ], + "conditions": [ { - "id": "temperature_below", + "id": "current_price_below", "title": { - "en": "Outdoor temperature !{{below|above}}" + "en": "Current price !{{below|above}}" + }, + "titleFormatted": { + "en": "Current price is !{{below|above}} [[price]]" }, "args": [ { - "name": "temperature", + "name": "price", "type": "number", + "title": { + "en": "Price" + }, "placeholder": { - "en": "temperature" + "en": "0.2" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -254,21 +340,34 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent below average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent below average of the next [[hours]] hours" + }, "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -276,21 +375,34 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent above average of the next [y] hours" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent above average of the next [[hours]] hours" + }, "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } }, { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -298,14 +410,24 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent below today's average" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent below today's average" + }, "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { @@ -313,86 +435,144 @@ "title": { "en": "Current price !{{is|isn't}} [x] percent above today's average" }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} [[percentage]] percent above today's average" + }, "args": [ { "name": "percentage", "type": "number", + "title": { + "en": "Percentage" + }, "placeholder": { - "en": "percentage" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "cond_price_at_lowest", "title": { - "en": "Current price !{{is|isn't}} at the lowest among the next [x] hours" + "en": "Current price !{{is|isn't}} at its lowest among the next [x] hours" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} at its lowest among the next [[hours]] hours" }, "args": [ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "20" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "cond_price_at_highest", "title": { - "en": "Current price !{{is|isn't}} at the highest among the next [x] hours" + "en": "Current price !{{is|isn't}} at its highest among the next [x] hours" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} at its highest among the next [[hours]] hours" }, "args": [ { "name": "hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "1" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "cond_price_at_lowest_today", "title": { "en": "Current price !{{is|isn't}} at today's lowest" - } + }, + "platforms": [ + "local", + "cloud" + ] }, { "id": "cond_price_at_highest_today", "title": { "en": "Current price !{{is|isn't}} at today's highest" - } + }, + "platforms": [ + "local", + "cloud" + ] }, { "id": "cond_price_among_lowest_today", "title": { - "en": "Current price !{{is|isn't}} one of todays lowest [x] prices" + "en": "Current price !{{is|isn't}} one of today's lowest [x] prices" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} one of today's lowest [[ranked_hours]] prices" }, "args": [ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "3" } } + ], + "platforms": [ + "local", + "cloud" ] }, { "id": "cond_price_among_highest_today", "title": { - "en": "Current price !{{is|isn't}} one of todays highest [x] prices" + "en": "Current price !{{is|isn't}} one of today's highest [x] prices" + }, + "titleFormatted": { + "en": "Current price !{{is|isn't}} one of today's highest [[ranked_hours]] prices" }, "args": [ { "name": "ranked_hours", "type": "number", + "title": { + "en": "Hours" + }, "placeholder": { - "en": "hours" + "en": "3" } } + ], + "platforms": [ + "local", + "cloud" ] } ], @@ -402,15 +582,28 @@ "title": { "en": "Send Tibber push notification" }, + "titleFormatted": { + "en": "Send Tibber push notification with [[title]] and [[message]]" + }, "args": [ { "name": "title", - "type": "text" + "type": "text", + "title": { + "en": "Title" + } }, { "name": "message", - "type": "text" + "type": "text", + "title": { + "en": "Message" + } } + ], + "platforms": [ + "local", + "cloud" ] } ] diff --git a/drivers/home/driver.js b/drivers/home/driver.js deleted file mode 100644 index ed87b5a3..00000000 --- a/drivers/home/driver.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -const Homey = require('homey'), - _ = require('lodash'), - oauth = require('../../lib/oauth'), - { tibber } = require('../../lib/tibber'); - -class MyDriver extends Homey.Driver { - - onInit() { - this.log('Tibber home driver has been initialized'); - } - onPair( socket ) { - this._tibber = tibber({log: this.log}); - socket.on('list_devices', this.onPairListDevices.bind(this)); - oauth.initiateOauth(socket, this._tibber); - } - - onPairListDevices(data, callback) { - this._tibber.getHomes() - .then(data => { - let devices = _.reject(_.map(_.get(data, 'viewer.homes'), home => { - let isActive = _.get(home, 'currentSubscription.status') === 'running'; - if(!isActive) - return null; - - _.assign(home, {t:this._tibber.getDefaultToken()}); - let address = _.get(home, 'address.address1'); - return { - data: home, - name: address - }; - }), _.isNull); - - callback(null, devices.sort(MyDriver._compareHomeyDevice)); - }) - .catch(e => { - this.log('Error in onPairListDevices', e); - callback(new Error("Failed to retrieve data.")); - }); - } - - static _compareHomeyDevice(a, b) { - if (a.name < b.name) - return -1; - if (a.name > b.name) - return 1; - return 0; - } -} - -module.exports = MyDriver; \ No newline at end of file diff --git a/drivers/home/driver.ts b/drivers/home/driver.ts new file mode 100644 index 00000000..9d14158a --- /dev/null +++ b/drivers/home/driver.ts @@ -0,0 +1,38 @@ +import { Driver } from 'homey'; +import PairSession from 'homey/lib/PairSession'; +import { EventEmitter } from 'stream'; +import { createListDeviceHandler } from '../../lib/helpers'; +import { initiateOauth } from '../../lib/oauth'; +import { TibberApi } from '../../lib/tibber'; + +class HomeDriver extends Driver { + #tibber!: TibberApi; + + async onInit() { + this.log('Tibber Home driver has been initialized'); + } + + async onPair(session: PairSession) { + this.#tibber = new TibberApi(this.log, this.homey.settings); + + session.setHandler( + 'list_devices', + createListDeviceHandler( + this.log, + this.#tibber, + (home) => home?.currentSubscription?.status === 'running', + formatDeviceName, + ), + ); + + await initiateOauth( + this.homey, + session as unknown as EventEmitter, // this cast of `session` is due to `PairSession` missing `.emit()`, even though JS code examples call it + this.#tibber, + ); + } +} + +const formatDeviceName = (address: string | undefined) => `${address}`; + +module.exports = HomeDriver; diff --git a/drivers/pulse/device.js b/drivers/pulse/device.js deleted file mode 100644 index 82244e86..00000000 --- a/drivers/pulse/device.js +++ /dev/null @@ -1,198 +0,0 @@ -'use strict'; - -const Homey = require('homey'), - _ = require('lodash'), - moment = require('moment-timezone'), - http = require('http.min'), - { tibber } = require('../../lib/tibber'); - -class MyDevice extends Homey.Device { - - onInit() { - this._tibber = tibber({ - log: this.log, - homeId: this.getData().id, - token: this.getData().t - }); - - this._deviceId = this.getData().id; - this._throttle = this.getSetting('pulse_throttle') || 30; - - this._powerChangedTrigger = new Homey.FlowCardTriggerDevice('power_changed'); - this._powerChangedTrigger.register(); - - this._consumptionChangedTrigger = new Homey.FlowCardTriggerDevice('consumption_changed'); - this._consumptionChangedTrigger.register(); - - this._costChangedTrigger = new Homey.FlowCardTriggerDevice('cost_changed'); - this._costChangedTrigger.register(); - - this._currentL1ChangedTrigger = new Homey.FlowCardTriggerDevice('current.L1_changed'); - this._currentL1ChangedTrigger.register(); - this._currentL2ChangedTrigger = new Homey.FlowCardTriggerDevice('current.L2_changed'); - this._currentL2ChangedTrigger.register(); - this._currentL3ChangedTrigger = new Homey.FlowCardTriggerDevice('current.L3_changed'); - this._currentL3ChangedTrigger.register(); - - this._dailyConsumptionReportTrigger = new Homey.FlowCardTriggerDevice('daily_consumption_report'); - this._dailyConsumptionReportTrigger.register(); - - this.log(`Tibber pulse device ${this.getName()} has been initialized (throttle: ${this._throttle})`); - - //Resubscribe if no data for 10 minutes - this._resubscribeDebounce = _.debounce(this.subscribeToLive.bind(this), 10 * 60 * 1000); - this.subscribeToLive(); - } - - onSettings(oldSettingsObj, newSettingsObj, changedKeysArr, callback) { - this.log('Changing pulse settings'); - if (changedKeysArr.includes('pulse_throttle')) { - this.log('Updated throttle value: ', newSettingsObj.pulse_throttle); - this._throttle = Number(newSettingsObj.pulse_throttle) || 30; - } - if (changedKeysArr.includes('pulse_currency')) { - this.log('Updated currency value: ', newSettingsObj.pulse_currency); - this._currency = newSettingsObj.pulse_currency; - this._cachedNordpoolPrice = null; - } - if (changedKeysArr.includes('pulse_area')) { - this.log('Updated area value: ', newSettingsObj.pulse_area); - this._area = newSettingsObj.pulse_area; - this._cachedNordpoolPrice = null; - } - callback(null, true); - } - - subscribeToLive() { - this._resubscribeDebounce(); - if (this._wsSubsctiption && _.isFunction(this._wsSubsctiption.unsubscribe)) { - try { - this.log('Unsubscribing from previous connection'); - this._wsSubsctiption.unsubscribe(); - } - catch (e) { - this.log('Error unsubscribing from previous connection', e); - } - } - - this.log('Subscribing to live data for homeId', this._deviceId); - this._wsSubsctiption = this._tibber.subscribeToLive(this.subscribeCallback.bind(this)); - } - - async subscribeCallback(result) { - this._resubscribeDebounce(); - - let power = _.get(result, 'data.liveMeasurement.power'); - //this.log(`Received data.liveMeasurement.power`, power); - let powerProduction = _.get(result, 'data.liveMeasurement.powerProduction'); - //this.log(`Received data.liveMeasurement.powerProduction`, powerProduction); - if (powerProduction) - this._prevPowerProduction = powerProduction; - - if (this._prevUpdate && moment().diff(this._prevUpdate, 'seconds') < this._throttle) - return; - - const measure_power = power || -powerProduction || -this._prevPowerProduction; - this.log(`Set measure_power capability to`, measure_power); - this.setCapabilityValue("measure_power", measure_power).catch(console.error); - this._prevUpdate = moment(); - - if (measure_power !== this._prevPower) { - this._prevPower = measure_power; - this.log(`Trigger power changed`, measure_power); - this._powerChangedTrigger.trigger(this, { power: measure_power }).catch(console.error); - } - - const currentL1 = _.get(result, 'data.liveMeasurement.currentL1'); - if (currentL1) this.setCapabilityValue("measure_current.L1", currentL1).catch(console.error); - if (currentL1 !== this._prevCurrentL1) { - this._prevCurrentL1 = currentL1; - this.log(`Trigger current L1 changed`, currentL1); - this._currentL1ChangedTrigger.trigger(this, { currentL1: currentL1 }).catch(console.error); - } - const currentL2 = _.get(result, 'data.liveMeasurement.currentL2'); - if (currentL2) this.setCapabilityValue("measure_current.L2", currentL2).catch(console.error); - if (currentL2 !== this._prevCurrentL2) { - this._prevCurrentL2 = currentL2; - this.log(`Trigger current L2 changed`, currentL2); - this._currentL2ChangedTrigger.trigger(this, { currentL2: currentL2 }).catch(console.error); - } - const currentL3 = _.get(result, 'data.liveMeasurement.currentL3'); - if (currentL3) this.setCapabilityValue("measure_current.L3", currentL3).catch(console.error); - if (currentL3 !== this._prevCurrentL3) { - this._prevCurrentL3 = currentL3; - this.log(`Trigger current L3 changed`, currentL3); - this._currentL3ChangedTrigger.trigger(this, { currentL3: currentL3 }).catch(console.error); - } - - const consumption = _.get(result, 'data.liveMeasurement.accumulatedConsumption'); - if (consumption && _.isNumber(consumption)) { - const fixedConsumtion = +consumption.toFixed(2); - if (fixedConsumtion !== this._prevConsumption) { - if (fixedConsumtion < this._prevConsumption) //Consumption has been reset - { - this.log('Triggering daily consumption report'); - this._dailyConsumptionReportTrigger.trigger(this, { consumption: this._prevConsumption, cost: this._prevCost }).catch(console.error) - } - - this._prevConsumption = fixedConsumtion; - this.setCapabilityValue("meter_power", fixedConsumtion).catch(console.error); - this._consumptionChangedTrigger.trigger(this, { consumption: fixedConsumtion }).catch(console.error); - } - } - - let cost = _.get(result, 'data.liveMeasurement.accumulatedCost'); - if (!cost) { - try { - const now = moment(); - if (!this._cachedNordpoolPrice || this._cachedNordpoolPrice.hour !== now.hour()) { - const area = this._area || 'Oslo'; - const currency = this._currency || 'NOK'; - this.log(`Using nordpool prices. Currency: ${currency} - Area: ${area}`); - const result = await http.json(`https://www.nordpoolgroup.com/api/marketdata/page/10?currency=${currency},${currency},${currency},${currency}&endDate=${moment().format("DD-MM-YYYY")}`); - const areaCurrentPrice = _(_.get(result, 'data.Rows')) - .filter(row => !row.IsExtraRow && moment.tz(row.StartTime, 'Europe/Oslo').isBefore(now) && moment.tz(row.EndTime, 'Europe/Oslo').isAfter(now)) - .map(row => row.Columns) - .first() - .find(a => a.Name === area); - - if (areaCurrentPrice) { - let currentPrice = Number(areaCurrentPrice.Value.replace(',', '.').trim()) / 1000; - this._cachedNordpoolPrice = { hour: now.hour(), price: currentPrice }; - this.log(`Found price for ${now.format()} for area ${area} ${currentPrice}`); - } - - } - if (_.isNumber(this._cachedNordpoolPrice.price)) - cost = this._cachedNordpoolPrice.price * consumption; - } - catch (e) { - console.error('Error fetching prices from nordpool', e); - } - } - - if (cost && _.isNumber(cost)) { - const fixedCost = +cost.toFixed(2); - if (fixedCost !== this._prevCost) { - this._prevCost = fixedCost; - this.setCapabilityValue("accumulatedCost", fixedCost).catch(console.error); - this._costChangedTrigger.trigger(this, { cost: fixedCost }).catch(console.error); - } - } - } - - onDeleted() { - if (this._wsSubsctiption && _.isFunction(this._wsSubsctiption.unsubscribe)) { - try { - this.log('Unsubscribing from previous connection'); - this._wsSubsctiption.unsubscribe(); - this._resubscribeDebounce.cancel(); - } - catch (e) { - this.log('Error unsubscribing from previous connection', e); - } - } - }; -} - -module.exports = MyDevice; \ No newline at end of file diff --git a/drivers/pulse/device.ts b/drivers/pulse/device.ts new file mode 100644 index 00000000..2e133dcd --- /dev/null +++ b/drivers/pulse/device.ts @@ -0,0 +1,307 @@ +import { Device, FlowCardTriggerDevice } from 'homey'; +import _ from 'lodash'; +import moment from 'moment-timezone'; +import http from 'http.min'; +import { Subscription } from 'apollo-client/util/Observable'; +import { LiveMeasurement, TibberApi } from '../../lib/tibber'; +import { NordpoolPriceResult } from '../../lib/types'; + +class PulseDevice extends Device { + #tibber!: TibberApi; + #deviceId!: string; + #throttle!: number; + #currency?: string; + #cachedNordpoolPrice: { hour: number; price: number } | null = null; + #area?: string; + #prevPowerProduction?: number; + #prevUpdate?: moment.Moment; + #prevPower?: number; + #prevCurrentL1?: number; + #prevCurrentL2?: number; + #prevCurrentL3?: number; + #prevConsumption?: number; + #prevCost?: number; + #wsSubscription!: Subscription; + #resubscribeDebounce!: _.DebouncedFunc<() => void>; + #powerChangedTrigger!: FlowCardTriggerDevice; + #consumptionChangedTrigger!: FlowCardTriggerDevice; + #costChangedTrigger!: FlowCardTriggerDevice; + #currentL1ChangedTrigger!: FlowCardTriggerDevice; + #currentL2ChangedTrigger!: FlowCardTriggerDevice; + #currentL3ChangedTrigger!: FlowCardTriggerDevice; + #dailyConsumptionReportTrigger!: FlowCardTriggerDevice; + + async onInit() { + const { id, t: token } = this.getData(); + + this.#tibber = new TibberApi(this.log, this.homey.settings, id, token); + this.#deviceId = id; + this.#throttle = this.getSetting('pulse_throttle') || 30; + + this.#powerChangedTrigger = + this.homey.flow.getDeviceTriggerCard('power_changed'); + + this.#consumptionChangedTrigger = this.homey.flow.getDeviceTriggerCard( + 'consumption_changed', + ); + + this.#costChangedTrigger = + this.homey.flow.getDeviceTriggerCard('cost_changed'); + + this.#currentL1ChangedTrigger = + this.homey.flow.getDeviceTriggerCard('current.L1_changed'); + + this.#currentL2ChangedTrigger = + this.homey.flow.getDeviceTriggerCard('current.L2_changed'); + + this.#currentL3ChangedTrigger = + this.homey.flow.getDeviceTriggerCard('current.L3_changed'); + + this.#dailyConsumptionReportTrigger = this.homey.flow.getDeviceTriggerCard( + 'daily_consumption_report', + ); + + this.log( + `Tibber pulse device ${this.getName()} has been initialized (throttle: ${ + this.#throttle + })`, + ); + + // Resubscribe if no data for 10 minutes + this.#resubscribeDebounce = _.debounce( + this.#subscribeToLive.bind(this), + 10 * 60 * 1000, + ); + this.#subscribeToLive(); + } + + async onSettings({ + newSettings, + changedKeys, + }: { + oldSettings: { [key: string]: string }; + newSettings: { [key: string]: string }; + changedKeys: string[]; + }) { + this.log('Changing pulse settings'); + + if (changedKeys.includes('pulse_throttle')) { + this.log('Updated throttle value: ', newSettings.pulse_throttle); + this.#throttle = Number(newSettings.pulse_throttle) || 30; + } + if (changedKeys.includes('pulse_currency')) { + this.log('Updated currency value: ', newSettings.pulse_currency); + this.#currency = newSettings.pulse_currency; + this.#cachedNordpoolPrice = null; + } + if (changedKeys.includes('pulse_area')) { + this.log('Updated area value: ', newSettings.pulse_area); + this.#area = newSettings.pulse_area; + this.#cachedNordpoolPrice = null; + } + } + + #subscribeToLive() { + this.#resubscribeDebounce(); + if ( + this.#wsSubscription && + _.isFunction(this.#wsSubscription.unsubscribe) + ) { + try { + this.log('Unsubscribing from previous connection'); + this.#wsSubscription.unsubscribe(); + } catch (e) { + this.log('Error unsubscribing from previous connection', e); + } + } + + this.log('Subscribing to live data for homeId', this.#deviceId); + this.#wsSubscription = this.#tibber.subscribeToLive( + this.subscribeCallback.bind(this), + ); + } + + async subscribeCallback(result: LiveMeasurement) { + this.#resubscribeDebounce(); + + const power = result.data?.liveMeasurement?.power; + const powerProduction = result.data?.liveMeasurement?.powerProduction; + if (powerProduction) this.#prevPowerProduction = powerProduction; + + if ( + this.#prevUpdate && + moment().diff(this.#prevUpdate, 'seconds') < this.#throttle + ) + return; + + const measurePower = + power || -powerProduction! || -this.#prevPowerProduction!; + this.log(`Set measure_power capability to`, measurePower); + this.setCapabilityValue('measure_power', measurePower).catch(console.error); + this.#prevUpdate = moment(); + + if (measurePower !== this.#prevPower) { + this.#prevPower = measurePower; + this.log(`Trigger power changed`, measurePower.toFixed(9)); + this.#powerChangedTrigger + .trigger(this, { power: measurePower }) + .catch(console.error); + } + + const currentL1 = result.data?.liveMeasurement?.currentL1; + if (currentL1) { + this.setCapabilityValue('measure_current.L1', currentL1).catch( + console.error, + ); + } + + if (currentL1 !== this.#prevCurrentL1) { + this.#prevCurrentL1 = currentL1!; + this.log(`Trigger current L1 changed`, currentL1); + this.#currentL1ChangedTrigger + .trigger(this, { currentL1 }) + .catch(console.error); + } + + const currentL2 = result.data?.liveMeasurement?.currentL2; + if (currentL2) { + this.setCapabilityValue('measure_current.L2', currentL2).catch( + console.error, + ); + } + + if (currentL2 !== this.#prevCurrentL2) { + this.#prevCurrentL2 = currentL2!; + this.log(`Trigger current L2 changed`, currentL2); + this.#currentL2ChangedTrigger + .trigger(this, { currentL2 }) + .catch(console.error); + } + + const currentL3 = result.data?.liveMeasurement?.currentL3; + if (currentL3) { + this.setCapabilityValue('measure_current.L3', currentL3).catch( + console.error, + ); + } + + if (currentL3 !== this.#prevCurrentL3) { + this.#prevCurrentL3 = currentL3!; + this.log(`Trigger current L3 changed`, currentL3); + this.#currentL3ChangedTrigger + .trigger(this, { currentL3 }) + .catch(console.error); + } + + const consumption = result.data?.liveMeasurement?.accumulatedConsumption; + if (consumption && _.isNumber(consumption)) { + const fixedConsumption = Number(consumption.toFixed(2)); + if (fixedConsumption !== this.#prevConsumption) { + if (fixedConsumption < this.#prevConsumption!) { + // Consumption has been reset + this.log('Triggering daily consumption report'); + this.#dailyConsumptionReportTrigger + .trigger(this, { + consumption: this.#prevConsumption, + cost: this.#prevCost, + }) + .catch(console.error); + } + + this.#prevConsumption = fixedConsumption; + this.setCapabilityValue('meter_power', fixedConsumption).catch( + console.error, + ); + this.#consumptionChangedTrigger + .trigger(this, { consumption: fixedConsumption }) + .catch(console.error); + } + } + + let cost = result.data?.liveMeasurement?.accumulatedCost; + if (!cost) { + try { + const now = moment(); + if ( + !this.#cachedNordpoolPrice || + this.#cachedNordpoolPrice.hour !== now.hour() + ) { + const area = this.#area || 'Oslo'; + const currency = this.#currency || 'NOK'; + this.log( + `Using nordpool prices. Currency: ${currency} - Area: ${area}`, + ); + const priceResult: NordpoolPriceResult = await http.json( + `https://www.nordpoolgroup.com/api/marketdata/page/10?currency=${currency},${currency},${currency},${currency}&endDate=${moment().format( + 'DD-MM-YYYY', + )}`, + ); + const filteredRows = (priceResult.data.Rows ?? []) + .filter( + (row) => + !row.IsExtraRow && + moment.tz(row.StartTime, 'Europe/Oslo').isBefore(now) && + moment.tz(row.EndTime, 'Europe/Oslo').isAfter(now), + ) + .map((row) => row.Columns); + + const areaCurrentPrice = filteredRows.length + ? filteredRows[0].find((a: { Name: string }) => a.Name === area) + : undefined; + + if (areaCurrentPrice !== undefined) { + const currentPrice = + Number( + areaCurrentPrice.Value.replace(',', '.') + .replace(' ', '') + .trim(), + ) / 1000; + + this.#cachedNordpoolPrice = { + hour: now.hour(), + price: currentPrice, + }; + this.log( + `Found price for ${now.format()} for area ${area} ${currentPrice}`, + ); + } + } + + if (_.isNumber(this.#cachedNordpoolPrice?.price)) + cost = this.#cachedNordpoolPrice!.price * consumption!; + } catch (e) { + console.error('Error fetching prices from nordpool', e); + } + } + + if (cost && _.isNumber(cost)) { + const fixedCost = Number(cost.toFixed(2)); + if (fixedCost === this.#prevCost) return; + + this.#prevCost = fixedCost; + this.setCapabilityValue('accumulatedCost', fixedCost).catch( + console.error, + ); + this.#costChangedTrigger + .trigger(this, { cost: fixedCost }) + .catch(console.error); + } + } + + onDeleted() { + if ( + this.#wsSubscription && + _.isFunction(this.#wsSubscription.unsubscribe) + ) { + try { + this.log('Unsubscribing from previous connection'); + this.#wsSubscription.unsubscribe(); + this.#resubscribeDebounce.cancel(); + } catch (e) { + this.log('Error unsubscribing from previous connection', e); + } + } + } +} + +module.exports = PulseDevice; diff --git a/drivers/pulse/driver.compose.json b/drivers/pulse/driver.compose.json index 8fca61c3..0ec5b6c4 100644 --- a/drivers/pulse/driver.compose.json +++ b/drivers/pulse/driver.compose.json @@ -2,6 +2,13 @@ "name": { "en": "Pulse" }, + "platforms": [ + "local", + "cloud" + ], + "connectivity": [ + "cloud" + ], "mobile": { "components": [ { diff --git a/drivers/pulse/driver.flow.compose.json b/drivers/pulse/driver.flow.compose.json index ec98e0c6..dfd0bade 100644 --- a/drivers/pulse/driver.flow.compose.json +++ b/drivers/pulse/driver.flow.compose.json @@ -1,116 +1,87 @@ { - "triggers": [ + "triggers": [ + { + "id": "consumption_changed", + "title": { + "en": "Consumption since midnight changed" + }, + "tokens": [ { - "id": "consumption_changed", - "title": { - "en": "Consumption since midnight changed" - }, - "tokens": [ - { - "name": "consumption", - "type": "number", - "title": { - "en": "Consumption" - } - } - ] - }, - { - "id": "cost_changed", - "title": { - "en": "Cost since midnight changed" - }, - "tokens": [ - { - "name": "cost", - "type": "number", - "title": { - "en": "Cost" - } - } - ] - }, - { - "id": "daily_consumption_report", - "title": { - "en": "Daily consumption report" - }, - "tokens": [ - { - "name": "consumption", - "type": "number", - "title": { - "en": "consumption" - } - }, - { - "name": "cost", - "type": "number", - "title": { - "en": "cost" - } - } - ] - }, + "name": "consumption", + "type": "number", + "title": { + "en": "Consumption" + } + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "cost_changed", + "title": { + "en": "Cost since midnight changed" + }, + "tokens": [ { - "id": "power_changed", - "title": { - "en": "Power changed" - }, - "tokens": [ - { - "name": "power", - "type": "number", - "title": { - "en": "Power" - } - } - ] - }, + "name": "cost", + "type": "number", + "title": { + "en": "Cost" + } + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "daily_consumption_report", + "title": { + "en": "Daily consumption is reported" + }, + "tokens": [ { - "id": "current.L1_changed", - "title": { - "en": "Current phase 1 changed" - }, - "tokens": [ - { - "name": "currentL1", - "type": "number", - "title": { - "en": "Current phase 1" - } - } - ] + "name": "consumption", + "type": "number", + "title": { + "en": "consumption" + } }, { - "id": "current.L2_changed", - "title": { - "en": "Current phase 2 changed" - }, - "tokens": [ - { - "name": "currentL2", - "type": "number", - "title": { - "en": "Current phase 2" - } - } - ] - }, + "name": "cost", + "type": "number", + "title": { + "en": "cost" + } + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "power_changed", + "title": { + "en": "Power changed" + }, + "tokens": [ { - "id": "current.L3_changed", - "title": { - "en": "Current phase 3 changed" - }, - "tokens": [ - { - "name": "currentL3", - "type": "number", - "title": { - "en": "Current phase 3" - } - } - ] + "name": "power", + "type": "number", + "title": { + "en": "Power" + } } - ] + ], + "platforms": [ + "local", + "cloud" + ] + } + ] } \ No newline at end of file diff --git a/drivers/pulse/driver.js b/drivers/pulse/driver.js deleted file mode 100644 index 1a1d1fd4..00000000 --- a/drivers/pulse/driver.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -const Homey = require('homey'), - _ = require('lodash'), - oauth = require('../../lib/oauth'), - { tibber } = require('../../lib/tibber'); - -class MyDriver extends Homey.Driver { - - onInit() { - this.log('Tibber pulse driver has been initialized'); - } - onPair( socket ) { - this._tibber = tibber({log: this.log}); - socket.on('list_devices', this.onPairListDevices.bind(this)); - oauth.initiateOauth(socket, this._tibber); - } - - onPairListDevices(data, callback) { - this._tibber.getHomes() - .then(data => { - let devices = _.reject(_.map(_.get(data, 'viewer.homes'), home => { - let hasPulse = !!_.get(home, 'features.realTimeConsumptionEnabled'); - if(!hasPulse) - return null; - - _.assign(home, { t: this._tibber.getDefaultToken() }); - let address = _.get(home, 'address.address1'); - return { - data: home, - name: `Pulse ${address}` - }; - }), _.isNull); - - callback(null, devices.sort(MyDriver._compareHomeyDevice)); - }) - .catch(e => { - this.log('Error in onPairListDevices', e); - callback(new Error("Failed to retrieve data.")); - }); - } - - static _compareHomeyDevice(a, b) { - if (a.name < b.name) - return -1; - if (a.name > b.name) - return 1; - return 0; - } -} - -module.exports = MyDriver; \ No newline at end of file diff --git a/drivers/pulse/driver.ts b/drivers/pulse/driver.ts new file mode 100644 index 00000000..fc1008ab --- /dev/null +++ b/drivers/pulse/driver.ts @@ -0,0 +1,38 @@ +import { Driver } from 'homey'; +import PairSession from 'homey/lib/PairSession'; +import { EventEmitter } from 'stream'; +import { createListDeviceHandler } from '../../lib/helpers'; +import { initiateOauth } from '../../lib/oauth'; +import { TibberApi } from '../../lib/tibber'; + +class PulseDriver extends Driver { + #tibber!: TibberApi; + + async onInit() { + this.log('Tibber Pulse driver has been initialized'); + } + + async onPair(session: PairSession) { + this.#tibber = new TibberApi(this.log, this.homey.settings); + + session.setHandler( + 'list_devices', + createListDeviceHandler( + this.log, + this.#tibber, + (home) => Boolean(home?.features?.realTimeConsumptionEnabled), + formatDeviceName, + ), + ); + + await initiateOauth( + this.homey, + session as unknown as EventEmitter, // this cast of `session` is due to `PairSession` missing `.emit()`, even though JS code examples call it + this.#tibber, + ); + } +} + +const formatDeviceName = (address: string | undefined) => `Pulse ${address}`; + +module.exports = PulseDriver; diff --git a/drivers/watty/device.js b/drivers/watty/device.js deleted file mode 100644 index 563587d8..00000000 --- a/drivers/watty/device.js +++ /dev/null @@ -1,196 +0,0 @@ -'use strict'; - -const Homey = require('homey'), - _ = require('lodash'), - moment = require('moment-timezone'), - http = require('http.min'), - { tibber } = require('../../lib/tibber'); - -class MyDevice extends Homey.Device { - - onInit() { - this._tibber = tibber({ - log: this.log, - homeId: this.getData().id, - token: this.getData().t - }); - this._deviceId = this.getData().id; - this._throttle = this.getSetting('pulse_throttle') || 30; - - this._powerChangedTrigger = new Homey.FlowCardTriggerDevice('watty_power_changed'); - this._powerChangedTrigger.register(); - - this._consumptionChangedTrigger = new Homey.FlowCardTriggerDevice('watty_consumption_changed'); - this._consumptionChangedTrigger.register(); - - this._costChangedTrigger = new Homey.FlowCardTriggerDevice('watty_cost_changed'); - this._costChangedTrigger.register(); - - this._currentL1ChangedTrigger = new Homey.FlowCardTriggerDevice('current.L1_changed'); - this._currentL1ChangedTrigger.register(); - this._currentL2ChangedTrigger = new Homey.FlowCardTriggerDevice('current.L2_changed'); - this._currentL2ChangedTrigger.register(); - this._currentL3ChangedTrigger = new Homey.FlowCardTriggerDevice('current.L3_changed'); - this._currentL3ChangedTrigger.register(); - - this._dailyConsumptionReportTrigger = new Homey.FlowCardTriggerDevice('watty_daily_consumption_report'); - this._dailyConsumptionReportTrigger.register(); - - this.log(`Tibber Watty device ${this.getName()} has been initialized (throttle: ${this._throttle})`); - - //Resubscribe if no data for 10 minutes - this._resubscribeDebounce = _.debounce(this.subscribeToLive.bind(this), 10 * 60 * 1000); - this.subscribeToLive(); - } - - onSettings(oldSettingsObj, newSettingsObj, changedKeysArr, callback) { - if (changedKeysArr.includes('pulse_throttle')) { - this.log('Updated throttle value: ', newSettingsObj.pulse_throttle); - this._throttle = Number(newSettingsObj.pulse_throttle) || 30; - } - if (changedKeysArr.includes('pulse_currency')) { - this.log('Updated currency value: ', newSettingsObj.pulse_currency); - this._currency = newSettingsObj.pulse_currency; - this._cachedNordpoolPrice = null; - } - if (changedKeysArr.includes('pulse_area')) { - this.log('Updated area value: ', newSettingsObj.pulse_area); - this._area = newSettingsObj.pulse_area; - this._cachedNordpoolPrice = null; - } - callback(null, true); - } - - subscribeToLive() { - this._resubscribeDebounce(); - if(this._wsSubsctiption && _.isFunction(this._wsSubsctiption.unsubscribe)) - { - try { - this.log('Unsubscribing from previous connection'); - this._wsSubsctiption.unsubscribe(); - } - catch (e) { - this.log('Error unsubscribing from previous connection', e); - } - } - - this.log('Subscribing to live data for homeId', this._deviceId); - this._wsSubsctiption = this._tibber.subscribeToLive(this.subscribeCallback.bind(this)); - } - - async subscribeCallback(result) { - this._resubscribeDebounce(); - - let power = _.get(result, 'data.liveMeasurement.power'); - //this.log(`Received data.liveMeasurement.power`, power); - let powerProduction = _.get(result, 'data.liveMeasurement.powerProduction'); - //this.log(`Received data.liveMeasurement.powerProduction`, powerProduction); - if (powerProduction) - this._prevPowerProduction = powerProduction; - - if (this._prevUpdate && moment().diff(this._prevUpdate, 'seconds') < this._throttle) - return; - - const measure_power = power || -powerProduction || -this._prevPowerProduction; - this.log(`Set measure_power capability to`, measure_power); - this.setCapabilityValue("measure_power", measure_power).catch(console.error); - this._prevUpdate = moment(); - - if (measure_power !== this._prevPower) { - this._prevPower = measure_power; - this.log(`Trigger power changed`, measure_power); - this._powerChangedTrigger.trigger(this, { power: measure_power }).catch(console.error); - } - - const currentL1 = _.get(result, 'data.liveMeasurement.currentL1'); - if (currentL1) this.setCapabilityValue("measure_current.L1", currentL1).catch(console.error); - if (currentL1 !== this._prevCurrentL1) { - this._prevCurrentL1 = currentL1; - this.log(`Trigger current L1 changed`, currentL1); - this._currentL1ChangedTrigger.trigger(this, { currentL1: currentL1 }).catch(console.error); - } - const currentL2 = _.get(result, 'data.liveMeasurement.currentL2'); - if (currentL2) this.setCapabilityValue("measure_current.L2", currentL2).catch(console.error); - if (currentL2 !== this._prevCurrentL2) { - this._prevCurrentL2 = currentL2; - this.log(`Trigger current L2 changed`, currentL2); - this._currentL2ChangedTrigger.trigger(this, { currentL2: currentL2 }).catch(console.error); - } - const currentL3 = _.get(result, 'data.liveMeasurement.currentL3'); - if (currentL3) this.setCapabilityValue("measure_current.L3", currentL3).catch(console.error); - if (currentL3 !== this._prevCurrentL3) { - this._prevCurrentL3 = currentL3; - this.log(`Trigger current L3 changed`, currentL3); - this._currentL3ChangedTrigger.trigger(this, { currentL3: currentL3 }).catch(console.error); - } - - const consumption = _.get(result, 'data.liveMeasurement.accumulatedConsumption'); - if(consumption && _.isNumber(consumption)) { - const fixedConsumtion = +consumption.toFixed(2); - if(fixedConsumtion !== this._prevConsumption) { - if(fixedConsumtion < this._prevConsumption) //Consumption has been reset - { - this.log('Triggering daily consumption report'); - this._dailyConsumptionReportTrigger.trigger(this, {consumption: this._prevConsumption, cost: this._prevCost}).catch(console.error) - } - - this._prevConsumption = fixedConsumtion; - this.setCapabilityValue("meter_power", fixedConsumtion).catch(console.error); - this._consumptionChangedTrigger.trigger(this, { consumption: fixedConsumtion }).catch(console.error); - } - } - - let cost = _.get(result, 'data.liveMeasurement.accumulatedCost'); - if(!cost) { - try { - const now = moment(); - if(!this._cachedNordpoolPrice || this._cachedNordpoolPrice.hour !== now.hour()) { - const area = this._area || 'Oslo'; - const currency = this._currency || 'NOK'; - this.log(`Using nordpool prices. Currency: ${currency} - Area: ${area}`); - const result = await http.json(`https://www.nordpoolgroup.com/api/marketdata/page/10?currency=${currency},${currency},${currency},${currency}&endDate=${moment().format("DD-MM-YYYY")}`); - const areaCurrentPrice = _(_.get(result, 'data.Rows')) - .filter(row => !row.IsExtraRow && moment.tz(row.StartTime, 'Europe/Oslo').isBefore(now) && moment.tz(row.EndTime, 'Europe/Oslo').isAfter(now)) - .map(row => row.Columns) - .first() - .find(a => a.Name === area); - - if(areaCurrentPrice) { - let currentPrice = Number(areaCurrentPrice.Value.replace(',', '.').trim()) / 1000; - this._cachedNordpoolPrice = { hour: now.hour(), price: currentPrice }; - } - } - if(_.isNumber(this._cachedNordpoolPrice.price)) - cost = this._cachedNordpoolPrice.price * consumption; - } - catch (e) { - console.error('Error fetching prices from nordpool', e); - } - } - - if(cost && _.isNumber(cost)) { - const fixedCost = +cost.toFixed(2); - if(fixedCost !== this._prevCost) { - this._prevCost = fixedCost; - this.setCapabilityValue("accumulatedCost", fixedCost).catch(console.error); - this._costChangedTrigger.trigger(this, { cost: fixedCost}).catch(console.error); - } - } - } - - onDeleted() { - if(this._wsSubsctiption && _.isFunction(this._wsSubsctiption.unsubscribe)) - { - try { - this.log('Unsubscribing from previous connection'); - this._wsSubsctiption.unsubscribe(); - this._resubscribeDebounce.cancel(); - } - catch (e) { - this.log('Error unsubscribing from previous connection', e); - } - } - }; -} - -module.exports = MyDevice; \ No newline at end of file diff --git a/drivers/watty/device.ts b/drivers/watty/device.ts new file mode 100644 index 00000000..64866332 --- /dev/null +++ b/drivers/watty/device.ts @@ -0,0 +1,312 @@ +import { Device, FlowCardTriggerDevice } from 'homey'; +import _ from 'lodash'; +import moment from 'moment-timezone'; +import http from 'http.min'; +import { Subscription } from 'apollo-client/util/Observable'; +import { LiveMeasurement, TibberApi } from '../../lib/tibber'; +import { NordpoolPriceResult } from '../../lib/types'; + +class WattyDevice extends Device { + #tibber!: TibberApi; + #deviceId!: string; + #throttle!: number; + #currency?: string; + #cachedNordpoolPrice: { hour: number; price: number } | null = null; + #area?: string; + #prevPowerProduction?: number; + #prevUpdate?: moment.Moment; + #prevPower?: number; + #prevCurrentL1?: number; + #prevCurrentL2?: number; + #prevCurrentL3?: number; + #prevConsumption!: number; + #prevCost?: number; + #wsSubscription!: Subscription; + #resubscribeDebounce!: _.DebouncedFunc<() => void>; + #powerChangedTrigger!: FlowCardTriggerDevice; + #consumptionChangedTrigger!: FlowCardTriggerDevice; + #costChangedTrigger!: FlowCardTriggerDevice; + #currentL1ChangedTrigger!: FlowCardTriggerDevice; + #currentL2ChangedTrigger!: FlowCardTriggerDevice; + #currentL3ChangedTrigger!: FlowCardTriggerDevice; + #dailyConsumptionReportTrigger!: FlowCardTriggerDevice; + + async onInit() { + const { id, t: token } = this.getData(); + + this.#tibber = new TibberApi(this.log, this.homey.settings, id, token); + this.#deviceId = id; + this.#throttle = this.getSetting('pulse_throttle') || 30; + + this.#powerChangedTrigger = this.homey.flow.getDeviceTriggerCard( + 'watty_power_changed', + ); + + this.#consumptionChangedTrigger = this.homey.flow.getDeviceTriggerCard( + 'watty_consumption_changed', + ); + + this.#costChangedTrigger = + this.homey.flow.getDeviceTriggerCard('watty_cost_changed'); + + this.#currentL1ChangedTrigger = + this.homey.flow.getDeviceTriggerCard('current.L1_changed'); + + this.#currentL2ChangedTrigger = + this.homey.flow.getDeviceTriggerCard('current.L2_changed'); + + this.#currentL3ChangedTrigger = + this.homey.flow.getDeviceTriggerCard('current.L3_changed'); + + this.#dailyConsumptionReportTrigger = this.homey.flow.getDeviceTriggerCard( + 'watty_daily_consumption_report', + ); + + this.log( + `Tibber Watty device ${this.getName()} has been initialized (throttle: ${ + this.#throttle + })`, + ); + + // Resubscribe if no data for 10 minutes + this.#resubscribeDebounce = _.debounce( + this.#subscribeToLive.bind(this), + 10 * 60 * 1000, + ); + this.#subscribeToLive(); + } + + async onSettings({ + newSettings, + changedKeys, + }: { + oldSettings: { [key: string]: string }; + newSettings: { [key: string]: string }; + changedKeys: string[]; + }) { + if (changedKeys.includes('pulse_throttle')) { + this.log('Updated throttle value: ', newSettings.pulse_throttle); + this.#throttle = Number(newSettings.pulse_throttle) || 30; + } + if (changedKeys.includes('pulse_currency')) { + this.log('Updated currency value: ', newSettings.pulse_currency); + this.#currency = newSettings.pulse_currency; + this.#cachedNordpoolPrice = null; + } + if (changedKeys.includes('pulse_area')) { + this.log('Updated area value: ', newSettings.pulse_area); + this.#area = newSettings.pulse_area; + this.#cachedNordpoolPrice = null; + } + } + + #subscribeToLive() { + this.#resubscribeDebounce(); + if ( + this.#wsSubscription && + _.isFunction(this.#wsSubscription.unsubscribe) + ) { + try { + this.log('Unsubscribing from previous connection'); + this.#wsSubscription.unsubscribe(); + } catch (e) { + this.log('Error unsubscribing from previous connection', e); + } + } + + this.log('Subscribing to live data for homeId', this.#deviceId); + this.#wsSubscription = this.#tibber.subscribeToLive( + this.subscribeCallback.bind(this), + ); + } + + async subscribeCallback(result: LiveMeasurement) { + this.#resubscribeDebounce(); + + const power = result.data?.liveMeasurement?.power; + const powerProduction = result.data?.liveMeasurement?.powerProduction; + + if (powerProduction) this.#prevPowerProduction = powerProduction; + + if ( + this.#prevUpdate && + moment().diff(this.#prevUpdate, 'seconds') < this.#throttle + ) + return; + + const measurePower = + power || -powerProduction! || -this.#prevPowerProduction!; + this.log(`Set measure_power capability to`, measurePower); + this.setCapabilityValue('measure_power', measurePower).catch(console.error); + this.#prevUpdate = moment(); + + if (measurePower !== this.#prevPower) { + this.#prevPower = measurePower; + this.log(`Trigger power changed`, measurePower); + this.#powerChangedTrigger + .trigger(this, { power: measurePower }) + .catch(console.error); + } + + const currentL1 = result.data?.liveMeasurement?.currentL1; + if (currentL1) { + this.setCapabilityValue('measure_current.L1', currentL1).catch( + console.error, + ); + } + + if (currentL1 !== this.#prevCurrentL1) { + this.#prevCurrentL1 = currentL1!; + this.log(`Trigger current L1 changed`, currentL1); + this.#currentL1ChangedTrigger + .trigger(this, { currentL1 }) + .catch(console.error); + } + + const currentL2 = result.data?.liveMeasurement?.currentL2; + if (currentL2) { + this.setCapabilityValue('measure_current.L2', currentL2).catch( + console.error, + ); + } + + if (currentL2 !== this.#prevCurrentL2) { + this.#prevCurrentL2 = currentL2!; + this.log(`Trigger current L2 changed`, currentL2); + this.#currentL2ChangedTrigger + .trigger(this, { currentL2 }) + .catch(console.error); + } + + const currentL3 = result.data?.liveMeasurement?.currentL3; + if (currentL3) { + this.setCapabilityValue('measure_current.L3', currentL3).catch( + console.error, + ); + } + + if (currentL3 !== this.#prevCurrentL3) { + this.#prevCurrentL3 = currentL3!; + this.log(`Trigger current L3 changed`, currentL3); + this.#currentL3ChangedTrigger + .trigger(this, { currentL3 }) + .catch(console.error); + } + + const consumption = result.data?.liveMeasurement?.accumulatedConsumption; + if (consumption && _.isNumber(consumption)) { + const fixedConsumption = Number(consumption.toFixed(2)); + if (fixedConsumption !== this.#prevConsumption) { + if (fixedConsumption < this.#prevConsumption) { + // consumption has been reset + this.log('Triggering daily consumption report'); + this.#dailyConsumptionReportTrigger + .trigger(this, { + consumption: this.#prevConsumption, + cost: this.#prevCost, + }) + .catch(console.error); + } + + this.#prevConsumption = fixedConsumption; + this.setCapabilityValue('meter_power', fixedConsumption).catch( + console.error, + ); + this.#consumptionChangedTrigger + .trigger(this, { consumption: fixedConsumption }) + .catch(console.error); + } + } + + let cost = result.data?.liveMeasurement?.accumulatedCost; + if (!cost) { + try { + const now = moment(); + if ( + !this.#cachedNordpoolPrice || + this.#cachedNordpoolPrice.hour !== now.hour() + ) { + const area = this.#area || 'Oslo'; + const currency = this.#currency || 'NOK'; + this.log( + `Using nordpool prices. Currency: ${currency} - Area: ${area}`, + ); + const priceResult: NordpoolPriceResult = await http.json( + `https://www.nordpoolgroup.com/api/marketdata/page/10?currency=${currency},${currency},${currency},${currency}&endDate=${moment().format( + 'DD-MM-YYYY', + )}`, + ); + const filteredRows = (priceResult?.data.Rows ?? []) + .filter( + (row: { + IsExtraRow: boolean; + StartTime: string; + EndTime: string; + }) => + !row.IsExtraRow && + moment.tz(row.StartTime, 'Europe/Oslo').isBefore(now) && + moment.tz(row.EndTime, 'Europe/Oslo').isAfter(now), + ) + .map((row) => row.Columns); + + const areaCurrentPrice = filteredRows.length + ? filteredRows[0].find((a: { Name: string }) => a.Name === area) + : undefined; + + if (areaCurrentPrice !== undefined) { + const currentPrice = + Number( + areaCurrentPrice.Value.replace(',', '.') + .replace(' ', '') + .trim(), + ) / 1000; + + this.#cachedNordpoolPrice = { + hour: now.hour(), + price: currentPrice, + }; + this.log( + `Found price for ${now.format()} for area ${area} ${currentPrice}`, + ); + } + } + + if (!_.isNumber(this.#cachedNordpoolPrice?.price)) return; + + cost = this.#cachedNordpoolPrice!.price * consumption!; + } catch (e) { + console.error('Error fetching prices from nordpool', e); + } + } + + if (cost && _.isNumber(cost)) { + const fixedCost = Number(cost.toFixed(2)); + if (fixedCost !== this.#prevCost) { + this.#prevCost = fixedCost; + this.setCapabilityValue('accumulatedCost', fixedCost).catch( + console.error, + ); + this.#costChangedTrigger + .trigger(this, { cost: fixedCost }) + .catch(console.error); + } + } + } + + onDeleted() { + if ( + this.#wsSubscription && + _.isFunction(this.#wsSubscription.unsubscribe) + ) { + try { + this.log('Unsubscribing from previous connection'); + this.#wsSubscription.unsubscribe(); + this.#resubscribeDebounce.cancel(); + } catch (e) { + this.log('Error unsubscribing from previous connection', e); + } + } + } +} + +module.exports = WattyDevice; diff --git a/drivers/watty/driver.compose.json b/drivers/watty/driver.compose.json index 3fbbafcd..2d895378 100644 --- a/drivers/watty/driver.compose.json +++ b/drivers/watty/driver.compose.json @@ -2,6 +2,13 @@ "name": { "en": "Watty" }, + "platforms": [ + "local", + "cloud" + ], + "connectivity": [ + "cloud" + ], "mobile": { "components": [ { diff --git a/drivers/watty/driver.flow.compose.json b/drivers/watty/driver.flow.compose.json index 6ca8b4c5..9a26c40b 100644 --- a/drivers/watty/driver.flow.compose.json +++ b/drivers/watty/driver.flow.compose.json @@ -1,116 +1,87 @@ { - "triggers": [ + "triggers": [ + { + "id": "watty_consumption_changed", + "title": { + "en": "Consumption since midnight changed" + }, + "tokens": [ { - "id": "watty_consumption_changed", - "title": { - "en": "Consumption since midnight changed" - }, - "tokens": [ - { - "name": "consumption", - "type": "number", - "title": { - "en": "Consumption" - } - } - ] - }, - { - "id": "watty_cost_changed", - "title": { - "en": "Cost since midnight changed" - }, - "tokens": [ - { - "name": "cost", - "type": "number", - "title": { - "en": "Cost" - } - } - ] - }, - { - "id": "watty_daily_consumption_report", - "title": { - "en": "Daily consumption report" - }, - "tokens": [ - { - "name": "consumption", - "type": "number", - "title": { - "en": "consumption" - } - }, - { - "name": "cost", - "type": "number", - "title": { - "en": "cost" - } - } - ] - }, + "name": "consumption", + "type": "number", + "title": { + "en": "Consumption" + } + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "watty_cost_changed", + "title": { + "en": "Cost since midnight changed" + }, + "tokens": [ { - "id": "watty_power_changed", - "title": { - "en": "Power changed" - }, - "tokens": [ - { - "name": "power", - "type": "number", - "title": { - "en": "Power" - } - } - ] - }, + "name": "cost", + "type": "number", + "title": { + "en": "Cost" + } + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "watty_daily_consumption_report", + "title": { + "en": "Daily consumption is reported" + }, + "tokens": [ { - "id": "current.L1_changed", - "title": { - "en": "Current phase 1 changed" - }, - "tokens": [ - { - "name": "currentL1", - "type": "number", - "title": { - "en": "Current phase 1" - } - } - ] + "name": "consumption", + "type": "number", + "title": { + "en": "consumption" + } }, { - "id": "current.L2_changed", - "title": { - "en": "Current phase 2 changed" - }, - "tokens": [ - { - "name": "currentL2", - "type": "number", - "title": { - "en": "Current phase 2" - } - } - ] - }, + "name": "cost", + "type": "number", + "title": { + "en": "cost" + } + } + ], + "platforms": [ + "local", + "cloud" + ] + }, + { + "id": "watty_power_changed", + "title": { + "en": "Power changed" + }, + "tokens": [ { - "id": "current.L3_changed", - "title": { - "en": "Current phase 3 changed" - }, - "tokens": [ - { - "name": "currentL3", - "type": "number", - "title": { - "en": "Current phase 3" - } - } - ] + "name": "power", + "type": "number", + "title": { + "en": "Power" + } } - ] + ], + "platforms": [ + "local", + "cloud" + ] + } + ] } \ No newline at end of file diff --git a/drivers/watty/driver.js b/drivers/watty/driver.js deleted file mode 100644 index 22b27c88..00000000 --- a/drivers/watty/driver.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -const Homey = require('homey'), - _ = require('lodash'), - oauth = require('../../lib/oauth'), - { tibber } = require('../../lib/tibber'); - -class MyDriver extends Homey.Driver { - - onInit() { - this.log('Tibber Watty driver has been initialized'); - } - onPair(socket) { - this._tibber = tibber({log: this.log}); - socket.on('list_devices', this.onPairListDevices.bind(this)); - oauth.initiateOauth(socket, this._tibber); - } - - onPairListDevices(data, callback) { - this._tibber.getHomes() - .then(data => { - let devices = _.reject(_.map(_.get(data, 'viewer.homes'), home => { - let realTimeConsumptionDevice = !!_.get(home, 'features.realTimeConsumptionEnabled'); - if (!realTimeConsumptionDevice) - return null; - - _.assign(home, { t: this._tibber.getDefaultToken() }); - let address = _.get(home, 'address.address1'); - return { - data: home, - name: `Watty ${address}` - }; - }), _.isNull); - - callback(null, devices.sort(MyDriver._compareHomeyDevice)); - }) - .catch(e => { - this.log('Error in onPairListDevices', e); - callback(new Error("Failed to retrieve data.")); - }); - } - - static _compareHomeyDevice(a, b) { - if (a.name < b.name) - return -1; - if (a.name > b.name) - return 1; - return 0; - } -} - -module.exports = MyDriver; \ No newline at end of file diff --git a/drivers/watty/driver.ts b/drivers/watty/driver.ts new file mode 100644 index 00000000..1dcbb2dd --- /dev/null +++ b/drivers/watty/driver.ts @@ -0,0 +1,39 @@ +import { Driver } from 'homey'; +import PairSession from 'homey/lib/PairSession'; +import _ from 'lodash'; +import { EventEmitter } from 'stream'; +import { createListDeviceHandler } from '../../lib/helpers'; +import { initiateOauth } from '../../lib/oauth'; +import { TibberApi } from '../../lib/tibber'; + +class WattyDriver extends Driver { + #tibber!: TibberApi; + + async onInit() { + this.log('Tibber Watty driver has been initialized'); + } + + async onPair(session: PairSession) { + this.#tibber = new TibberApi(this.log, this.homey.settings); + + session.setHandler( + 'list_devices', + createListDeviceHandler( + this.log, + this.#tibber, + (home) => Boolean(home?.features?.realTimeConsumptionEnabled), + formatDeviceName, + ), + ); + + await initiateOauth( + this.homey, + session as unknown as EventEmitter, // this cast of `session` is due to `PairSession` missing `.emit()`, even though JS code examples call it + this.#tibber, + ); + } +} + +const formatDeviceName = (address: string | undefined) => `Watty ${address}`; + +module.exports = WattyDriver; diff --git a/globals.d.ts b/globals.d.ts new file mode 100644 index 00000000..e2ae355d --- /dev/null +++ b/globals.d.ts @@ -0,0 +1,9 @@ +// noinspection ES6UnusedImports +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { App } from 'homey'; + +declare module 'homey' { + export interface App { + cleanupLogs(prefix: string): void; + } +} diff --git a/lib/helpers.ts b/lib/helpers.ts new file mode 100644 index 00000000..a0842f51 --- /dev/null +++ b/lib/helpers.ts @@ -0,0 +1,54 @@ +import PairSession from 'homey/lib/PairSession'; +import _ from 'lodash'; +import { Home, Logger, TibberApi } from './tibber'; + +export interface HomeFilterPredicate { + (home: Home): boolean; +} + +export interface HomeDevice { + name: string; + data: Home & { + t: string; + }; +} + +export const createListDeviceHandler = + ( + log: Logger, + tibber: TibberApi, + filterPredicate: HomeFilterPredicate, + deviceNameFormatter: (address: string | undefined) => string, + ): PairSession.Handler => + async (_data): Promise => { + try { + const { + viewer: { homes }, + } = await tibber.getHomes(); + + const devices: HomeDevice[] = homes + .filter(filterPredicate) + .map((home) => { + const address = home.address?.address1; + return { + name: deviceNameFormatter(address), + data: { + ...home, + t: tibber.getDefaultToken(), + }, + }; + }); + + devices.sort(sortByName); + return devices; + } catch (err) { + log('Error in list device handler called from `onPair`', err); + throw new Error('Failed to retrieve data.'); + } + }; + +const sortByName = (a: { name: string }, b: { name: string }): number => { + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + return 0; +}; diff --git a/lib/oauth.js b/lib/oauth.js deleted file mode 100644 index 445557ec..00000000 --- a/lib/oauth.js +++ /dev/null @@ -1,52 +0,0 @@ -const Homey = require('homey'), - http = require('http.min'); - -module.exports = { - initiateOauth: initiateOauth -}; - -function initiateOauth(socket, tibber) { - let state = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10); - const redirectUrl = 'https://callback.athom.com/oauth2/callback/'; - let apiBaseUrl = 'https://thewall.tibber.com'; - let apiAuthUrl = `${apiBaseUrl}/connect/authorize?state=${state}&scope=tibber_graph&response_type=code&client_id=${Homey.env.CLIENT_ID}&redirect_uri=${redirectUrl}`; - - let myOAuth2Callback = new Homey.CloudOAuth2Callback(apiAuthUrl); - myOAuth2Callback - .on('url', url => { - socket.emit('url', url); - }) - .on('code', async code => { - try { - const result = await http.post({ - uri: `${apiBaseUrl}/connect/token`, - form: { - client_id: Homey.env.CLIENT_ID, - client_secret: Homey.env.CLIENT_SECRET, - grant_type: 'authorization_code', - redirect_uri: redirectUrl, - code: code, - }, - }); - - if (result.response.statusCode !== 200) { - console.error('request failed', result.response); - socket.emit('error', new Error(`Request failed with code ${result.response.statusCode}`)); - return Homey.app.error('api -> failed to fetch tokens', result.response.statusCode); - } - - let params = JSON.parse(result.data); - tibber.setDefaultToken(params.access_token); - socket.emit('authorized'); - } catch (err) { - console.error('request failed', err); - socket.emit('error', new Error(`Error fetching tokens`)); - Homey.app.error('api -> error fetching tokens:', err); - } - }) - .generate() - .catch( err => { - console.error(err); - socket.emit('error', err); - }); -} \ No newline at end of file diff --git a/lib/oauth.ts b/lib/oauth.ts new file mode 100644 index 00000000..aa860081 --- /dev/null +++ b/lib/oauth.ts @@ -0,0 +1,62 @@ +import { App, env } from 'homey'; +import ManagerCloud from 'homey/manager/cloud'; +import http from 'http.min'; +import { EventEmitter } from 'stream'; +import { TibberApi } from './tibber'; + +export const initiateOauth = async ( + { app, cloud }: { app: App; cloud: ManagerCloud }, + session: EventEmitter, + tibber: TibberApi, +) => { + const state = Math.random() + .toString(36) + .replace(/[^a-z]+/g, '') + .substr(0, 10); + const redirectUrl = 'https://callback.athom.com/oauth2/callback/'; + const apiBaseUrl = 'https://thewall.tibber.com'; + const apiAuthUrl = `${apiBaseUrl}/connect/authorize?state=${state}&scope=tibber_graph&response_type=code&client_id=${env.CLIENT_ID}&redirect_uri=${redirectUrl}`; + + const myOAuth2Callback = await cloud.createOAuth2Callback(apiAuthUrl); + myOAuth2Callback + .on('url', (url) => { + session.emit('url', url); + }) + .on('code', async (code) => { + try { + const result = await http.post({ + uri: `${apiBaseUrl}/connect/token`, + form: { + client_id: env.CLIENT_ID, + client_secret: env.CLIENT_SECRET, + grant_type: 'authorization_code', + redirect_uri: redirectUrl, + code, + }, + }); + + if (result.response.statusCode !== 200) { + console.error('request failed', result.response); + session.emit( + 'error', + new Error(`Request failed with code ${result.response.statusCode}`), + ); + + return app.error( + 'api -> failed to fetch tokens', + result.response.statusCode, + ); + } + + const params = JSON.parse(result.data); + tibber.setDefaultToken(params.access_token); + session.emit('authorized'); + } catch (err) { + console.error('request failed', err); + session.emit('error', new Error(`Error fetching tokens`)); + app.error('api -> error fetching tokens:', err); + } + + return undefined; + }); +}; diff --git a/lib/queries.js b/lib/queries.js deleted file mode 100644 index 5048ab25..00000000 --- a/lib/queries.js +++ /dev/null @@ -1,130 +0,0 @@ -const gql = require('graphql-tag'); - -module.exports = { - getHomesQuery: getHomesQuery, - getPriceQuery: getPriceQuery, - getConsumptionQuery: getConsumptionQuery, - getPushMessage: getPushMessage, - getSubscriptionQuery: getSubscriptionQuery -}; - -function getHomesQuery() { - return `{ - viewer { - homes { - id - timeZone - address { - address1 - postalCode - city - latitude - longitude - } - features { - realTimeConsumptionEnabled - } - currentSubscription { - status - } - } - } - }`; -} - -function getPriceQuery(homeId) { - return `{ - viewer { - home(id:"${homeId}") { - currentSubscription { - status - priceInfo { - current { - total - energy - tax - startsAt - level - } - today { - total - energy - tax - startsAt - level - } - tomorrow { - total - energy - tax - startsAt - level - } - } - } - } - } - }`; -} - -function getConsumptionQuery(homeId, daysToFetch, hoursToFetch) { - return `{ - viewer { - home(id:"${homeId}") { - daily: consumption(resolution: DAILY, last: ${daysToFetch}) { - nodes { - from - to - totalCost - unitCost - unitPrice - unitPriceVAT - consumption - consumptionUnit - } - }, - hourly: consumption(resolution: HOURLY, last: ${hoursToFetch}) { - nodes { - from - to - totalCost - consumption - } - } - } - } - }`; -} - -function getPushMessage(title, message) { - return `mutation{ - sendPushNotification(input: { - title: "${title}", - message: "${message}", - screenToOpen: CONSUMPTION - }){ - successful - pushedToNumberOfDevices - } - }`; -} - -function getSubscriptionQuery(homeId) { - return gql` - subscription{ - liveMeasurement(homeId:"${homeId}"){ - timestamp - power - accumulatedConsumption - accumulatedCost - currency - minPower - averagePower - maxPower - powerProduction - currentL1 - currentL2 - currentL3 - } - }`; -} diff --git a/lib/queries.ts b/lib/queries.ts new file mode 100644 index 00000000..6394c145 --- /dev/null +++ b/lib/queries.ts @@ -0,0 +1,104 @@ +import gql from 'graphql-tag'; + +export const queries = { + getHomesQuery: () => `{ + viewer { + homes { + id + timeZone + address { + address1 + postalCode + city + latitude + longitude + } + features { + realTimeConsumptionEnabled + } + currentSubscription { + status + } + } + } + }`, + + getPriceQuery: (homeId: string) => `{ + viewer { + home(id:"${homeId}") { + currentSubscription { + priceRating { + hourly { + entries { + time + total + energy + tax + level + } + } + } + } + } + } + }`, + + getConsumptionQuery: ( + homeId: string, + daysToFetch: number, + hoursToFetch: number, + ) => `{ + viewer { + home(id:"${homeId}") { + daily: consumption(resolution: DAILY, last: ${daysToFetch}) { + nodes { + from + to + totalCost + unitCost + unitPrice + unitPriceVAT + consumption + consumptionUnit + } + }, + hourly: consumption(resolution: HOURLY, last: ${hoursToFetch}) { + nodes { + from + to + totalCost + consumption + } + } + } + } + }`, + + getPushMessage: (title: string, message: string) => `mutation{ + sendPushNotification(input: { + title: "${title}", + message: "${message}", + screenToOpen: CONSUMPTION + }){ + successful + pushedToNumberOfDevices + } + }`, + + getSubscriptionQuery: (homeId: string) => gql`subscription{ + liveMeasurement(homeId:"${homeId}"){ + timestamp + power + accumulatedConsumption + accumulatedCost + currency + minPower + averagePower + maxPower + powerProduction + currentL1 + currentL2 + currentL3 + } + }`, +}; diff --git a/lib/tibber.js b/lib/tibber.js deleted file mode 100644 index 656de2f6..00000000 --- a/lib/tibber.js +++ /dev/null @@ -1,189 +0,0 @@ -const Homey = require('homey'), - _ = require('lodash'), - queries = require('./queries'), - ws = require('ws'), - ApolloBoost = require('apollo-client'), - ApolloClient = ApolloBoost.default, - { GraphQLClient } = require('graphql-request'), - { WebSocketLink } = require("apollo-link-ws"), - { InMemoryCache } = require("apollo-cache-inmemory"), - newrelic = require('newrelic'), - moment = require('moment-timezone'); - -module.exports = { tibber, getRandomDelay } - -function getRandomDelay(min, max) { - return Math.floor(Math.random() * (max - min) + min); -} - -function tibber(dependencies) { - let { log, homeId, token } = dependencies; - - log(`Initialize Tibber client for home ${homeId} using token ${token}`); - - let _client = undefined; - const host = 'https://api.tibber.com'; - const path = '/v1-beta/gql'; - function getClient() { - if (!token) - token = getDefaultToken(); - if (!token) - throw new Error("Access token not set"); - - if (!_client) - _client = new GraphQLClient(`${host}${path}`, { - timeout: 5 * 60 * 1000, - headers: { - Authorization: `Bearer ${token}`, - 'User-Agent': 'Homey (Tibber App)' - }, - }); - - return _client; - } - - async function getHomes() { - let client = getClient(); - log('Get homes'); - return newrelic.startWebTransaction('Get homes', () => client.request(queries.getHomesQuery()) - .then(data => { - return data; - }) - .catch(e => { - console.error(`${new Date()} Error while fetching home data`, e); - throw e; - })); - } - - let priceInfoNextHours = []; - async function getPriceInfoCached() { - - // Cache empty. Fetch immediately - if (!priceInfoNextHours.length) { - log(`No price infos cached. Fetch prices immediately.`); - priceInfoNextHours = getPriceInfo(); - return priceInfoNextHours; - } - - const lastPriceInfoDay = moment(_.last(priceInfoNextHours).startsAt).startOf('day'); - log(`last price info entry is for day ${lastPriceInfoDay.format()}`); - - const now = moment(); - const today = moment().startOf('day'); - const tomorrow = moment().add(1, 'day').startOf('day'); - - // Last cache entry too old. Fetch immediately - if (lastPriceInfoDay < tomorrow) { - log(`Last price info entry is before tomorrow. Re-fetch prices immediately.`); - priceInfoNextHours = getPriceInfo(); - return priceInfoNextHours; - } - - // Last cache entry is ok but there might be new prices available. Fetch after delay to avoid hitting the api at the same time - const expectedPricePublishTime = today.add(13, 'hours'); - log(`Expected price publish time is after ${expectedPricePublishTime.format()}`); - if (now > expectedPricePublishTime) { - const delay = getRandomDelay(0, 50 * 60); - log(`Last price info entry is before tomorrow and current time is after 13:00. Schedule re-fetch prices after ${delay} seconds.`); - setTimeout(async () => { - priceInfoNextHours = await getPriceInfo() - }, delay * 1000); - return priceInfoNextHours; - } - - // Last cache entry ok and no new prices available yet - log(`Last price info entry is up-to-date`); - return priceInfoNextHours; - } - - async function getPriceInfo() { - let client = getClient(); - log('Get prices'); - const data = await newrelic.startWebTransaction('Get prices', () => client.request(queries.getPriceQuery(homeId))) - .catch(e => { - console.error(`${new Date()} Error while fetching price data`, e); - throw e; - }); - - const priceInfoToday = _.get(data, 'viewer.home.currentSubscription.priceInfo.today'); - const priceInfoTomorrow = _.get(data, 'viewer.home.currentSubscription.priceInfo.tomorrow'); - if(priceInfoToday && priceInfoTomorrow) - priceInfoNextHours = priceInfoToday.concat(priceInfoTomorrow); - else if (priceInfoToday) - priceInfoNextHours = priceInfoToday; - - return priceInfoNextHours; - } - - async function getConsumptionData(daysToFetch, hoursToFetch) { - let client = getClient(); - log(`Get consumption for ${daysToFetch} days ${hoursToFetch} hours`); - return newrelic.startWebTransaction('Get consumption', () => client.request(queries.getConsumptionQuery(homeId, daysToFetch, hoursToFetch))) - .catch(e => { - console.error(`${new Date()} Error while fetching consumption data`, e); - throw e; - }); - } - - async function sendPush(title, message) { - log('Send push notification'); - let client = getClient(); - let push = queries.getPushMessage(title, message); - return client.request(push) - .then(result => { - console.log(`${new Date()} Push notification sent`, result); - }) - .catch(e => { - console.error(`${new Date()} Error sending push notification`, e); - throw e; - }); - } - - function subscribeToLive(callback) { - log('Subscribe to live'); - if (!token) - token = getDefaultToken(); - if (!token) - throw new Error("Access token not set"); - - const wsLink = new WebSocketLink({ - uri: 'wss://api.tibber.com/v1-beta/gql/subscriptions', - options: { - reconnect: false, - connectionParams: { - token: token, - } - }, - webSocketImpl: ws - }); - - const wsClient = new ApolloClient({ - link: wsLink, - cache: new InMemoryCache() - }); - - return wsClient.subscribe({ - query: queries.getSubscriptionQuery(homeId), - variables: {} - }).subscribe(callback, console.error); - } - - function setDefaultToken(token) { - Homey.ManagerSettings.set('token', token); - } - - function getDefaultToken() { - return Homey.ManagerSettings.get('token'); - } - - return { - getHomes: getHomes, - getPriceInfoCached: getPriceInfoCached, - getConsumptionData: getConsumptionData, - sendPush: sendPush, - subscribeToLive: subscribeToLive, - setDefaultToken: setDefaultToken, - getDefaultToken: getDefaultToken - }; -} - diff --git a/lib/tibber.ts b/lib/tibber.ts new file mode 100644 index 00000000..bc4ed432 --- /dev/null +++ b/lib/tibber.ts @@ -0,0 +1,310 @@ +import _ from 'lodash'; +import ws from 'ws'; +import ApolloClient from 'apollo-client'; +import { GraphQLClient } from 'graphql-request'; +import { InMemoryCache } from 'apollo-cache-inmemory'; +import { WebSocketLink } from 'apollo-link-ws'; +import moment from 'moment-timezone'; +import type ManagerSettings from 'homey/manager/settings'; +import newrelic from 'newrelic'; +import { queries } from './queries'; + +export interface Logger { + (message: string, data?: unknown): void; +} + +export interface LiveMeasurement { + data?: { + liveMeasurement: { + timestamp: string; + power: number | null; + accumulatedConsumption: number | null; + accumulatedCost: number | null; + currency: string | null; + minPower: number | null; + averagePower: number | null; + maxPower: number | null; + powerProduction: number | null; + currentL1: number | null; + currentL2: number | null; + currentL3: number | null; + } | null; + }; +} + +export interface ConsumptionNode { + from: string; + to: string; + consumption: number; + totalCost: number; +} + +export interface ConsumptionData { + viewer: { + home: { + daily: { + nodes: ConsumptionNode[]; + } | null; + hourly: { + nodes: ConsumptionNode[]; + } | null; + } | null; + }; +} + +export interface PriceRatingResponse { + viewer: { + home: { + currentSubscription: { + priceRating: { + hourly: { + entries: PriceRatingEntry[]; + }; + } | null; + } | null; + }; + }; +} + +export interface PriceRatingEntry { + time: string; + total: number; + energy: number; + tax: number; + level: 'LOW' | 'NORMAL' | 'HIGH'; +} + +export interface Homes { + viewer: { + homes: Home[]; + }; +} + +export type Home = { + id: string; + name: string; + timeZone: string; + address: { + address1: string; + postalCode: string; + city: string; + latitude: string; + longitude: string; + }; + features: Partial<{ + realTimeConsumptionEnabled: boolean; + }> | null; + currentSubscription: Partial<{ + status: 'running' | 'awaiting time restriction'; + }> | null; +}; + +const apiHost = 'https://api.tibber.com'; +const apiPath = '/v1-beta/gql'; +const liveSubscriptionUrl = 'wss://api.tibber.com/v1-beta/gql/subscriptions'; + +export const getRandomDelay = (min: number, max: number) => + Math.floor(Math.random() * (max - min) + min); + +export class TibberApi { + readonly #log: Logger; + #homeySettings: ManagerSettings; + #priceInfoNextHours: PriceRatingEntry[] = []; + #homeId?: string; + #token?: string; + #client?: GraphQLClient; + + constructor( + log: Logger, + homeySettings: ManagerSettings, + homeId?: string, + token?: string, + ) { + this.#log = log; + this.#homeySettings = homeySettings; + this.#token = token; + this.#homeId = homeId; + this.#log( + `Initialize Tibber client for home ${homeId} using token ${token}`, + ); + } + + #getClient(): GraphQLClient { + if (this.#token === undefined) this.#token = this.getDefaultToken(); + if (this.#token === undefined) throw new Error('Access token not set'); + + if (this.#client === undefined) { + this.#client = new GraphQLClient(`${apiHost}${apiPath}`, { + timeout: 5 * 60 * 1000, + headers: { + Authorization: `Bearer ${this.#token}`, + 'User-Agent': 'Homey (Tibber App)', + }, + }); + } + + return this.#client; + } + + async getHomes(): Promise { + const client = this.#getClient(); + this.#log('Get homes'); + return newrelic.startWebTransaction('Get homes', () => + client + .request(queries.getHomesQuery()) + .then((data) => data) + .catch((e) => { + console.error(`${new Date()} Error while fetching home data`, e); + throw e; + }), + ); + } + + async getPriceInfoCached( + homeySetTimeout: ( + callback: (...args: unknown[]) => void, + ms: number, + ...args: unknown[] + ) => NodeJS.Timeout, + ) { + // Cache empty. Fetch immediately + if (!this.#priceInfoNextHours.length) { + this.#log(`No price infos cached. Fetch prices immediately.`); + this.#priceInfoNextHours = await this.#getPriceInfo(); + return this.#priceInfoNextHours; + } + + const last = _.last(this.#priceInfoNextHours) as PriceRatingEntry; + const lastPriceInfoDay = moment(last.time).startOf('day'); + this.#log(`last price info entry is for day ${lastPriceInfoDay.format()}`); + + const now = moment(); + const today = moment().startOf('day'); + const tomorrow = moment().add(1, 'day').startOf('day'); + + // Last cache entry too old. Fetch immediately + if (lastPriceInfoDay < tomorrow) { + this.#log( + `Last price info entry is before tomorrow. Re-fetch prices immediately.`, + ); + this.#priceInfoNextHours = await this.#getPriceInfo(); + return this.#priceInfoNextHours; + } + + // Last cache entry is ok but there might be new prices available. Fetch after delay to avoid hitting the api at the same time + const expectedPricePublishTime = today.add(13, 'hours'); + this.#log( + `Expected price publish time is after ${expectedPricePublishTime.format()}`, + ); + + if (now > expectedPricePublishTime) { + const delay = getRandomDelay(0, 50 * 60); + this.#log( + `Last price info entry is before tomorrow and current time is after 13:00. Schedule re-fetch prices after ${delay} seconds.`, + ); + homeySetTimeout(async () => { + this.#priceInfoNextHours = await this.#getPriceInfo(); + }, delay * 1000); + + return this.#priceInfoNextHours; + } + + // Last cache entry ok and no new prices available yet + this.#log(`Last price info entry is up-to-date`); + return this.#priceInfoNextHours; + } + + async #getPriceInfo(): Promise { + const client = this.#getClient(); + + this.#log('Get prices'); + const data: PriceRatingResponse = await newrelic.startWebTransaction( + 'Get prices', + () => + client.request(queries.getPriceQuery(this.#homeId!)).catch((e) => { + console.error(`${new Date()} Error while fetching price data`, e); + throw e; + }), + ); + + this.#priceInfoNextHours = + data.viewer?.home?.currentSubscription?.priceRating?.hourly.entries ?? []; + + return this.#priceInfoNextHours; + } + + async getConsumptionData( + daysToFetch: number, + hoursToFetch: number, + ): Promise { + const client = this.#getClient(); + this.#log(`Get consumption for ${daysToFetch} days ${hoursToFetch} hours`); + return newrelic.startWebTransaction('Get consumption', () => + client + .request( + queries.getConsumptionQuery(this.#homeId!, daysToFetch, hoursToFetch), + ) + .catch((e) => { + console.error( + `${new Date()} Error while fetching consumption data`, + e, + ); + throw e; + }), + ); + } + + async sendPush(title: string, message: string) { + this.#log('Send push notification'); + const client = this.#getClient(); + const push = queries.getPushMessage(title, message); + return newrelic.startWebTransaction('Send push notification', () => + client + .request(push) + .then((result) => { + console.log(`${new Date()} Push notification sent`, result); + }) + .catch((e) => { + console.error(`${new Date()} Error sending push notification`, e); + throw e; + }), + ); + } + + subscribeToLive(callback: (result: LiveMeasurement) => Promise) { + this.#log('Subscribe to live'); + if (this.#token === undefined) this.#token = this.getDefaultToken(); + if (this.#token === undefined) throw new Error('Access token not set'); + + const wsLink = new WebSocketLink({ + uri: liveSubscriptionUrl, + options: { + reconnect: false, + connectionParams: { + token: this.#token, + }, + }, + webSocketImpl: ws, + }); + + const wsClient = new ApolloClient({ + link: wsLink, + cache: new InMemoryCache(), + }); + + return wsClient + .subscribe({ + query: queries.getSubscriptionQuery(this.#homeId!), + variables: {}, + }) + .subscribe(callback, console.error); + } + + setDefaultToken(token: string) { + this.#homeySettings.set('token', token); + } + + getDefaultToken() { + return this.#homeySettings.get('token'); + } +} diff --git a/lib/types.ts b/lib/types.ts new file mode 100644 index 00000000..d6245c5c --- /dev/null +++ b/lib/types.ts @@ -0,0 +1,13 @@ +export interface NordpoolPriceResult { + data: { + Rows?: { + IsExtraRow: boolean; + StartTime: string; + EndTime: string; + Columns: { + Name: string; + Value: string; + }[]; + }[]; + }; +} diff --git a/newrelic.js b/newrelic.js index 2ec8a467..da16b3b9 100644 --- a/newrelic.js +++ b/newrelic.js @@ -1,4 +1,4 @@ -'use strict' +// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-unresolved const Homey = require('homey'); /** * New Relic agent configuration. @@ -17,17 +17,15 @@ exports.config = { license_key: Homey.env.NEW_RELIC_LICENCE_KEY, logging: { - //enabled: false, enabled: false, /** * Level at which to log. 'trace' is most useful to New Relic when diagnosing * issues with the agent, 'info' and higher will impose the least overhead on * production applications. */ - //level: 'info', level: 'info', filepath: 'stdout', - diagnostics: false + diagnostics: false, }, agent_enabled: true, @@ -38,7 +36,7 @@ exports.config = { */ allow_all_headers: true, distributed_tracing: { - enabled: true + enabled: true, }, attributes: { /** @@ -59,8 +57,8 @@ exports.config = { 'response.headers.authorization', 'response.headers.proxyAuthorization', 'response.headers.setCookie*', - 'response.headers.x*' - ] + 'response.headers.x*', + ], }, // serverless_mode: { enabled: true }, plugins: { @@ -68,6 +66,6 @@ exports.config = { * Controls usage of the native metrics module which samples VM and event * loop data. */ - native_metrics: { enabled: false } - } -} + native_metrics: { enabled: false }, + }, +}; diff --git a/node_modules/.bin/gp12-pem b/node_modules/.bin/gp12-pem deleted file mode 120000 index cfbbf67b..00000000 --- a/node_modules/.bin/gp12-pem +++ /dev/null @@ -1 +0,0 @@ -../google-p12-pem/build/src/bin/gp12-pem.js \ No newline at end of file diff --git a/node_modules/.bin/mime b/node_modules/.bin/mime deleted file mode 120000 index fbb7ee0e..00000000 --- a/node_modules/.bin/mime +++ /dev/null @@ -1 +0,0 @@ -../mime/cli.js \ No newline at end of file diff --git a/node_modules/.bin/newrelic-naming-rules b/node_modules/.bin/newrelic-naming-rules deleted file mode 120000 index 3653cd04..00000000 --- a/node_modules/.bin/newrelic-naming-rules +++ /dev/null @@ -1 +0,0 @@ -../newrelic/bin/test-naming-rules.js \ No newline at end of file diff --git a/node_modules/.bin/pbjs b/node_modules/.bin/pbjs deleted file mode 120000 index a96b24a4..00000000 --- a/node_modules/.bin/pbjs +++ /dev/null @@ -1 +0,0 @@ -../protobufjs/bin/pbjs \ No newline at end of file diff --git a/node_modules/.bin/pbts b/node_modules/.bin/pbts deleted file mode 120000 index b4c7c520..00000000 --- a/node_modules/.bin/pbts +++ /dev/null @@ -1 +0,0 @@ -../protobufjs/bin/pbts \ No newline at end of file diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver deleted file mode 120000 index 317eb293..00000000 --- a/node_modules/.bin/semver +++ /dev/null @@ -1 +0,0 @@ -../semver/bin/semver \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/LICENSE b/node_modules/@grpc/grpc-js/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/node_modules/@grpc/grpc-js/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@grpc/grpc-js/README.md b/node_modules/@grpc/grpc-js/README.md deleted file mode 100644 index 4bb4da02..00000000 --- a/node_modules/@grpc/grpc-js/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Pure JavaScript gRPC Client - -## Installation - -Node 12 is recommended. The exact set of compatible Node versions can be found in the `engines` field of the `package.json` file. - -```sh -npm install @grpc/grpc-js -``` - -## Documentation - -Documentation specifically for the `@grpc/grpc-js` package is currently not available. However, [documentation is available for the `grpc` package](https://grpc.github.io/grpc/node/grpc.html), and the two packages contain mostly the same interface. There are a few notable differences, however, and these differences are noted in the "Migrating from grpc" section below. - -## Features - -- Clients -- Automatic reconnection -- Servers -- Streaming -- Metadata -- Partial compression support: clients can decompress response messages -- Pick first and round robin load balancing policies -- Client Interceptors -- Connection Keepalives -- HTTP Connect support (proxies) - -This library does not directly handle `.proto` files. To use `.proto` files with this library we recommend using the `@grpc/proto-loader` package. - -## Migrating from [`grpc`](https://www.npmjs.com/package/grpc) - -`@grpc/grpc-js` is almost a drop-in replacement for `grpc`, but you may need to make a few code changes to use it: - -- If you are currently loading `.proto` files using `grpc.load`, that function is not available in this library. You should instead load your `.proto` files using `@grpc/proto-loader` and load the resulting package definition objects into `@grpc/grpc-js` using `grpc.loadPackageDefinition`. -- If you are currently loading packages generated by `grpc-tools`, you should instead generate your files using the `generate_package_definition` option in `grpc-tools`, then load the object exported by the generated file into `@grpc/grpc-js` using `grpc.loadPackageDefinition`. -- If you have a server and you are using `Server#bind` to bind ports, you will need to use `Server#bindAsync` instead. - -## Some Notes on API Guarantees - -The public API of this library follows semantic versioning, with some caveats: - -- Some methods are prefixed with an underscore. These methods are internal and should not be considered part of the public API. -- The class `Call` is only exposed due to limitations of TypeScript. It should not be considered part of the public API. -- In general, any API that is exposed by this library but is not exposed by the `grpc` library is likely an error and should not be considered part of the public API. -- The `grpc.experimental` namespace contains APIs that have not stabilized. Any API in that namespace may break in any minor version update. diff --git a/node_modules/@grpc/grpc-js/build/src/backoff-timeout.d.ts b/node_modules/@grpc/grpc-js/build/src/backoff-timeout.d.ts deleted file mode 100644 index 5f4fc73c..00000000 --- a/node_modules/@grpc/grpc-js/build/src/backoff-timeout.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export interface BackoffOptions { - initialDelay?: number; - multiplier?: number; - jitter?: number; - maxDelay?: number; -} -export declare class BackoffTimeout { - private callback; - private initialDelay; - private multiplier; - private maxDelay; - private jitter; - private nextDelay; - private timerId; - private running; - constructor(callback: () => void, options?: BackoffOptions); - /** - * Call the callback after the current amount of delay time - */ - runOnce(): void; - /** - * Stop the timer. The callback will not be called until `runOnce` is called - * again. - */ - stop(): void; - /** - * Reset the delay time to its initial value. - */ - reset(): void; - isRunning(): boolean; -} diff --git a/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js b/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js deleted file mode 100644 index 9f05187a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js +++ /dev/null @@ -1,91 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BackoffTimeout = void 0; -const INITIAL_BACKOFF_MS = 1000; -const BACKOFF_MULTIPLIER = 1.6; -const MAX_BACKOFF_MS = 120000; -const BACKOFF_JITTER = 0.2; -/** - * Get a number uniformly at random in the range [min, max) - * @param min - * @param max - */ -function uniformRandom(min, max) { - return Math.random() * (max - min) + min; -} -class BackoffTimeout { - constructor(callback, options) { - this.callback = callback; - this.initialDelay = INITIAL_BACKOFF_MS; - this.multiplier = BACKOFF_MULTIPLIER; - this.maxDelay = MAX_BACKOFF_MS; - this.jitter = BACKOFF_JITTER; - this.running = false; - if (options) { - if (options.initialDelay) { - this.initialDelay = options.initialDelay; - } - if (options.multiplier) { - this.multiplier = options.multiplier; - } - if (options.jitter) { - this.jitter = options.jitter; - } - if (options.maxDelay) { - this.maxDelay = options.maxDelay; - } - } - this.nextDelay = this.initialDelay; - this.timerId = setTimeout(() => { }, 0); - clearTimeout(this.timerId); - } - /** - * Call the callback after the current amount of delay time - */ - runOnce() { - this.running = true; - this.timerId = setTimeout(() => { - this.callback(); - this.running = false; - }, this.nextDelay); - const nextBackoff = Math.min(this.nextDelay * this.multiplier, this.maxDelay); - const jitterMagnitude = nextBackoff * this.jitter; - this.nextDelay = - nextBackoff + uniformRandom(-jitterMagnitude, jitterMagnitude); - } - /** - * Stop the timer. The callback will not be called until `runOnce` is called - * again. - */ - stop() { - clearTimeout(this.timerId); - this.running = false; - } - /** - * Reset the delay time to its initial value. - */ - reset() { - this.nextDelay = this.initialDelay; - } - isRunning() { - return this.running; - } -} -exports.BackoffTimeout = BackoffTimeout; -//# sourceMappingURL=backoff-timeout.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js.map b/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js.map deleted file mode 100644 index 5006ef1e..00000000 --- a/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"backoff-timeout.js","sourceRoot":"","sources":["../../src/backoff-timeout.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;GAIG;AACH,SAAS,aAAa,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3C,CAAC;AASD,MAAa,cAAc;IASzB,YAAoB,QAAoB,EAAE,OAAwB;QAA9C,aAAQ,GAAR,QAAQ,CAAY;QARhC,iBAAY,GAAW,kBAAkB,CAAC;QAC1C,eAAU,GAAW,kBAAkB,CAAC;QACxC,aAAQ,GAAW,cAAc,CAAC;QAClC,WAAM,GAAW,cAAc,CAAC;QAGhC,YAAO,GAAG,KAAK,CAAC;QAGtB,IAAI,OAAO,EAAE;YACX,IAAI,OAAO,CAAC,YAAY,EAAE;gBACxB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;aAC1C;YACD,IAAI,OAAO,CAAC,UAAU,EAAE;gBACtB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;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CAkEC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.d.ts b/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.d.ts deleted file mode 100644 index aaed84fb..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Call } from './call-stream'; -import { Channel } from './channel'; -import { BaseFilter, Filter, FilterFactory } from './filter'; -import { Metadata } from './metadata'; -export declare class CallCredentialsFilter extends BaseFilter implements Filter { - private readonly channel; - private readonly stream; - private serviceUrl; - constructor(channel: Channel, stream: Call); - sendMetadata(metadata: Promise): Promise; -} -export declare class CallCredentialsFilterFactory implements FilterFactory { - private readonly channel; - constructor(channel: Channel); - createFilter(callStream: Call): CallCredentialsFilter; -} diff --git a/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js b/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js deleted file mode 100644 index 15a50ebc..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CallCredentialsFilterFactory = exports.CallCredentialsFilter = void 0; -const filter_1 = require("./filter"); -const constants_1 = require("./constants"); -const uri_parser_1 = require("./uri-parser"); -class CallCredentialsFilter extends filter_1.BaseFilter { - constructor(channel, stream) { - var _a, _b; - super(); - this.channel = channel; - this.stream = stream; - this.channel = channel; - this.stream = stream; - const splitPath = stream.getMethod().split('/'); - let serviceName = ''; - /* The standard path format is "/{serviceName}/{methodName}", so if we split - * by '/', the first item should be empty and the second should be the - * service name */ - if (splitPath.length >= 2) { - serviceName = splitPath[1]; - } - const hostname = (_b = (_a = uri_parser_1.splitHostPort(stream.getHost())) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : 'localhost'; - /* Currently, call credentials are only allowed on HTTPS connections, so we - * can assume that the scheme is "https" */ - this.serviceUrl = `https://${hostname}/${serviceName}`; - } - async sendMetadata(metadata) { - const credentials = this.stream.getCredentials(); - const credsMetadata = credentials.generateMetadata({ - service_url: this.serviceUrl, - }); - const resultMetadata = await metadata; - resultMetadata.merge(await credsMetadata); - if (resultMetadata.get('authorization').length > 1) { - this.stream.cancelWithStatus(constants_1.Status.INTERNAL, '"authorization" metadata cannot have multiple values'); - } - return resultMetadata; - } -} -exports.CallCredentialsFilter = CallCredentialsFilter; -class CallCredentialsFilterFactory { - constructor(channel) { - this.channel = channel; - this.channel = channel; - } - createFilter(callStream) { - return new CallCredentialsFilter(this.channel, callStream); - } -} -exports.CallCredentialsFilterFactory = CallCredentialsFilterFactory; -//# sourceMappingURL=call-credentials-filter.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js.map b/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js.map deleted file mode 100644 index bd220712..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-credentials-filter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"call-credentials-filter.js","sourceRoot":"","sources":["../../src/call-credentials-filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,qCAA6D;AAE7D,2CAAqC;AACrC,6CAA6C;AAE7C,MAAa,qBAAsB,SAAQ,mBAAU;IAEnD,YACmB,OAAgB,EAChB,MAAY;;QAE7B,KAAK,EAAE,CAAC;QAHS,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAM;QAG7B,IAAI,CAAC,OAAO,GAAG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AAE,UAAU,CAAC,CAAC;IAC7D,CAAC;CACF;AATD,oEASC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call-credentials.d.ts b/node_modules/@grpc/grpc-js/build/src/call-credentials.d.ts deleted file mode 100644 index d055fd27..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-credentials.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Metadata } from './metadata'; -export interface CallMetadataOptions { - service_url: string; -} -export declare type CallMetadataGenerator = (options: CallMetadataOptions, cb: (err: Error | null, metadata?: Metadata) => void) => void; -export interface OldOAuth2Client { - getRequestMetadata: (url: string, callback: (err: Error | null, headers?: { - [index: string]: string; - }) => void) => void; -} -export interface CurrentOAuth2Client { - getRequestHeaders: (url?: string) => Promise<{ - [index: string]: string; - }>; -} -export declare type OAuth2Client = OldOAuth2Client | CurrentOAuth2Client; -/** - * A class that represents a generic method of adding authentication-related - * metadata on a per-request basis. - */ -export declare abstract class CallCredentials { - /** - * Asynchronously generates a new Metadata object. - * @param options Options used in generating the Metadata object. - */ - abstract generateMetadata(options: CallMetadataOptions): Promise; - /** - * Creates a new CallCredentials object from properties of both this and - * another CallCredentials object. This object's metadata generator will be - * called first. - * @param callCredentials The other CallCredentials object. - */ - abstract compose(callCredentials: CallCredentials): CallCredentials; - /** - * Check whether two call credentials objects are equal. Separate - * SingleCallCredentials with identical metadata generator functions are - * equal. - * @param other The other CallCredentials object to compare with. - */ - abstract _equals(other: CallCredentials): boolean; - /** - * Creates a new CallCredentials object from a given function that generates - * Metadata objects. - * @param metadataGenerator A function that accepts a set of options, and - * generates a Metadata object based on these options, which is passed back - * to the caller via a supplied (err, metadata) callback. - */ - static createFromMetadataGenerator(metadataGenerator: CallMetadataGenerator): CallCredentials; - /** - * Create a gRPC credential from a Google credential object. - * @param googleCredentials The authentication client to use. - * @return The resulting CallCredentials object. - */ - static createFromGoogleCredential(googleCredentials: OAuth2Client): CallCredentials; - static createEmpty(): CallCredentials; -} diff --git a/node_modules/@grpc/grpc-js/build/src/call-credentials.js b/node_modules/@grpc/grpc-js/build/src/call-credentials.js deleted file mode 100644 index ee2f367c..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-credentials.js +++ /dev/null @@ -1,149 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CallCredentials = void 0; -const metadata_1 = require("./metadata"); -function isCurrentOauth2Client(client) { - return ('getRequestHeaders' in client && - typeof client.getRequestHeaders === 'function'); -} -/** - * A class that represents a generic method of adding authentication-related - * metadata on a per-request basis. - */ -class CallCredentials { - /** - * Creates a new CallCredentials object from a given function that generates - * Metadata objects. - * @param metadataGenerator A function that accepts a set of options, and - * generates a Metadata object based on these options, which is passed back - * to the caller via a supplied (err, metadata) callback. - */ - static createFromMetadataGenerator(metadataGenerator) { - return new SingleCallCredentials(metadataGenerator); - } - /** - * Create a gRPC credential from a Google credential object. - * @param googleCredentials The authentication client to use. - * @return The resulting CallCredentials object. - */ - static createFromGoogleCredential(googleCredentials) { - return CallCredentials.createFromMetadataGenerator((options, callback) => { - let getHeaders; - if (isCurrentOauth2Client(googleCredentials)) { - getHeaders = googleCredentials.getRequestHeaders(options.service_url); - } - else { - getHeaders = new Promise((resolve, reject) => { - googleCredentials.getRequestMetadata(options.service_url, (err, headers) => { - if (err) { - reject(err); - return; - } - resolve(headers); - }); - }); - } - getHeaders.then((headers) => { - const metadata = new metadata_1.Metadata(); - for (const key of Object.keys(headers)) { - metadata.add(key, headers[key]); - } - callback(null, metadata); - }, (err) => { - callback(err); - }); - }); - } - static createEmpty() { - return new EmptyCallCredentials(); - } -} -exports.CallCredentials = CallCredentials; -class ComposedCallCredentials extends CallCredentials { - constructor(creds) { - super(); - this.creds = creds; - } - async generateMetadata(options) { - const base = new metadata_1.Metadata(); - const generated = await Promise.all(this.creds.map((cred) => cred.generateMetadata(options))); - for (const gen of generated) { - base.merge(gen); - } - return base; - } - compose(other) { - return new ComposedCallCredentials(this.creds.concat([other])); - } - _equals(other) { - if (this === other) { - return true; - } - if (other instanceof ComposedCallCredentials) { - return this.creds.every((value, index) => value._equals(other.creds[index])); - } - else { - return false; - } - } -} -class SingleCallCredentials extends CallCredentials { - constructor(metadataGenerator) { - super(); - this.metadataGenerator = metadataGenerator; - } - generateMetadata(options) { - return new Promise((resolve, reject) => { - this.metadataGenerator(options, (err, metadata) => { - if (metadata !== undefined) { - resolve(metadata); - } - else { - reject(err); - } - }); - }); - } - compose(other) { - return new ComposedCallCredentials([this, other]); - } - _equals(other) { - if (this === other) { - return true; - } - if (other instanceof SingleCallCredentials) { - return this.metadataGenerator === other.metadataGenerator; - } - else { - return false; - } - } -} -class EmptyCallCredentials extends CallCredentials { - generateMetadata(options) { - return Promise.resolve(new metadata_1.Metadata()); - } - compose(other) { - return other; - } - _equals(other) { - return other instanceof EmptyCallCredentials; - } -} -//# sourceMappingURL=call-credentials.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call-credentials.js.map b/node_modules/@grpc/grpc-js/build/src/call-credentials.js.map deleted file mode 100644 index b78a2cec..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-credentials.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"call-credentials.js","sourceRoot":"","sources":["../../src/call-credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yCAAsC;AA+BtC,SAAS,qBAAqB,CAC5B,MAAoB;IAEpB,OAAO,CACL,mBAAmB,IAAI,MAAM;QAC7B,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAA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sBAAiB,GAAjB,iBAAiB,CAAuB;IAE5D,CAAC;IAED,gBAAgB,CAAC,OAA4B;QAC3C,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC/C,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;gBAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;oBAC1B,OAAO,CAAC,QAAQ,CAAC,CAAC;iBACnB;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,OAAO,IAAI,uBAAuB,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,IAAI,IAAI,KAAK,KAAK,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QACD,IAAI,KAAK,YAAY,qBAAqB,EAAE;YAC1C,OAAO,IAAI,CAAC,iBAAiB,KAAK,KAAK,CAAC,iBAAiB,CAAC;SAC3D;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF;AAED,MAAM,oBAAqB,SAAQ,eAAe;IAChD,gBAAgB,CAAC,OAA4B;QAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,mBAAQ,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,OAAO,KAAK,YAAY,oBAAoB,CAAC;IAC/C,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call-stream.d.ts b/node_modules/@grpc/grpc-js/build/src/call-stream.d.ts deleted file mode 100644 index b4664c11..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-stream.d.ts +++ /dev/null @@ -1,148 +0,0 @@ -/// -import * as http2 from 'http2'; -import { CallCredentials } from './call-credentials'; -import { Status } from './constants'; -import { Filter, FilterFactory } from './filter'; -import { FilterStackFactory } from './filter-stack'; -import { Metadata } from './metadata'; -import { ChannelImplementation } from './channel'; -import { Subchannel } from './subchannel'; -import { ServerSurfaceCall } from './server-call'; -export declare type Deadline = Date | number; -export interface CallStreamOptions { - deadline: Deadline; - flags: number; - host: string; - parentCall: ServerSurfaceCall | null; -} -export declare type PartialCallStreamOptions = Partial; -export interface StatusObject { - code: Status; - details: string; - metadata: Metadata; -} -export declare const enum WriteFlags { - BufferHint = 1, - NoCompress = 2, - WriteThrough = 4 -} -export interface WriteObject { - message: Buffer; - flags?: number; -} -export interface MetadataListener { - (metadata: Metadata, next: (metadata: Metadata) => void): void; -} -export interface MessageListener { - (message: any, next: (message: any) => void): void; -} -export interface StatusListener { - (status: StatusObject, next: (status: StatusObject) => void): void; -} -export interface FullListener { - onReceiveMetadata: MetadataListener; - onReceiveMessage: MessageListener; - onReceiveStatus: StatusListener; -} -export declare type Listener = Partial; -/** - * An object with methods for handling the responses to a call. - */ -export interface InterceptingListener { - onReceiveMetadata(metadata: Metadata): void; - onReceiveMessage(message: any): void; - onReceiveStatus(status: StatusObject): void; -} -export declare function isInterceptingListener(listener: Listener | InterceptingListener): listener is InterceptingListener; -export declare class InterceptingListenerImpl implements InterceptingListener { - private listener; - private nextListener; - private processingMessage; - private pendingStatus; - constructor(listener: FullListener, nextListener: InterceptingListener); - onReceiveMetadata(metadata: Metadata): void; - onReceiveMessage(message: any): void; - onReceiveStatus(status: StatusObject): void; -} -export interface WriteCallback { - (error?: Error | null): void; -} -export interface MessageContext { - callback?: WriteCallback; - flags?: number; -} -export interface Call { - cancelWithStatus(status: Status, details: string): void; - getPeer(): string; - start(metadata: Metadata, listener: InterceptingListener): void; - sendMessageWithContext(context: MessageContext, message: Buffer): void; - startRead(): void; - halfClose(): void; - getDeadline(): Deadline; - getCredentials(): CallCredentials; - setCredentials(credentials: CallCredentials): void; - getMethod(): string; - getHost(): string; -} -export declare class Http2CallStream implements Call { - private readonly methodName; - private readonly channel; - private readonly options; - private readonly channelCallCredentials; - private readonly callNumber; - credentials: CallCredentials; - filterStack: Filter; - private http2Stream; - private pendingRead; - private isWriteFilterPending; - private pendingWrite; - private pendingWriteCallback; - private writesClosed; - private decoder; - private isReadFilterPending; - private canPush; - /** - * Indicates that an 'end' event has come from the http2 stream, so there - * will be no more data events. - */ - private readsClosed; - private statusOutput; - private unpushedReadMessages; - private unfilteredReadMessages; - private mappedStatusCode; - private finalStatus; - private subchannel; - private disconnectListener; - private listener; - constructor(methodName: string, channel: ChannelImplementation, options: CallStreamOptions, filterStackFactory: FilterStackFactory, channelCallCredentials: CallCredentials, callNumber: number); - private outputStatus; - private trace; - /** - * On first call, emits a 'status' event with the given StatusObject. - * Subsequent calls are no-ops. - * @param status The status of the call. - */ - private endCall; - private maybeOutputStatus; - private push; - private handleFilterError; - private handleFilteredRead; - private filterReceivedMessage; - private tryPush; - private handleTrailers; - attachHttp2Stream(stream: http2.ClientHttp2Stream, subchannel: Subchannel, extraFilterFactory?: FilterFactory): void; - start(metadata: Metadata, listener: InterceptingListener): void; - private destroyHttp2Stream; - cancelWithStatus(status: Status, details: string): void; - getDeadline(): Deadline; - getCredentials(): CallCredentials; - setCredentials(credentials: CallCredentials): void; - getStatus(): StatusObject | null; - getPeer(): string; - getMethod(): string; - getHost(): string; - startRead(): void; - private maybeCloseWrites; - sendMessageWithContext(context: MessageContext, message: Buffer): void; - halfClose(): void; -} diff --git a/node_modules/@grpc/grpc-js/build/src/call-stream.js b/node_modules/@grpc/grpc-js/build/src/call-stream.js deleted file mode 100644 index 1dca827a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-stream.js +++ /dev/null @@ -1,571 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Http2CallStream = exports.InterceptingListenerImpl = exports.isInterceptingListener = void 0; -const http2 = require("http2"); -const constants_1 = require("./constants"); -const filter_stack_1 = require("./filter-stack"); -const metadata_1 = require("./metadata"); -const stream_decoder_1 = require("./stream-decoder"); -const logging = require("./logging"); -const constants_2 = require("./constants"); -const TRACER_NAME = 'call_stream'; -const { HTTP2_HEADER_STATUS, HTTP2_HEADER_CONTENT_TYPE, NGHTTP2_CANCEL, } = http2.constants; -function isInterceptingListener(listener) { - return (listener.onReceiveMetadata !== undefined && - listener.onReceiveMetadata.length === 1); -} -exports.isInterceptingListener = isInterceptingListener; -class InterceptingListenerImpl { - constructor(listener, nextListener) { - this.listener = listener; - this.nextListener = nextListener; - this.processingMessage = false; - this.pendingStatus = null; - } - onReceiveMetadata(metadata) { - this.listener.onReceiveMetadata(metadata, (metadata) => { - this.nextListener.onReceiveMetadata(metadata); - }); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message) { - /* If this listener processes messages asynchronously, the last message may - * be reordered with respect to the status */ - this.processingMessage = true; - this.listener.onReceiveMessage(message, (msg) => { - this.processingMessage = false; - this.nextListener.onReceiveMessage(msg); - if (this.pendingStatus) { - this.nextListener.onReceiveStatus(this.pendingStatus); - } - }); - } - onReceiveStatus(status) { - this.listener.onReceiveStatus(status, (processedStatus) => { - if (this.processingMessage) { - this.pendingStatus = processedStatus; - } - else { - this.nextListener.onReceiveStatus(processedStatus); - } - }); - } -} -exports.InterceptingListenerImpl = InterceptingListenerImpl; -class Http2CallStream { - constructor(methodName, channel, options, filterStackFactory, channelCallCredentials, callNumber) { - this.methodName = methodName; - this.channel = channel; - this.options = options; - this.channelCallCredentials = channelCallCredentials; - this.callNumber = callNumber; - this.http2Stream = null; - this.pendingRead = false; - this.isWriteFilterPending = false; - this.pendingWrite = null; - this.pendingWriteCallback = null; - this.writesClosed = false; - this.decoder = new stream_decoder_1.StreamDecoder(); - this.isReadFilterPending = false; - this.canPush = false; - /** - * Indicates that an 'end' event has come from the http2 stream, so there - * will be no more data events. - */ - this.readsClosed = false; - this.statusOutput = false; - this.unpushedReadMessages = []; - this.unfilteredReadMessages = []; - // Status code mapped from :status. To be used if grpc-status is not received - this.mappedStatusCode = constants_1.Status.UNKNOWN; - // This is populated (non-null) if and only if the call has ended - this.finalStatus = null; - this.subchannel = null; - this.listener = null; - this.filterStack = filterStackFactory.createFilter(this); - this.credentials = channelCallCredentials; - this.disconnectListener = () => { - this.endCall({ - code: constants_1.Status.UNAVAILABLE, - details: 'Connection dropped', - metadata: new metadata_1.Metadata(), - }); - }; - if (this.options.parentCall && this.options.flags & constants_1.Propagate.CANCELLATION) { - this.options.parentCall.on('cancelled', () => { - this.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled by parent call'); - }); - } - } - outputStatus() { - /* Precondition: this.finalStatus !== null */ - if (!this.statusOutput) { - this.statusOutput = true; - const filteredStatus = this.filterStack.receiveTrailers(this.finalStatus); - /* We delay the actual action of bubbling up the status to insulate the - * cleanup code in this class from any errors that may be thrown in the - * upper layers as a result of bubbling up the status. In particular, - * if the status is not OK, the "error" event may be emitted - * synchronously at the top level, which will result in a thrown error if - * the user does not handle that event. */ - process.nextTick(() => { - var _a; - (_a = this.listener) === null || _a === void 0 ? void 0 : _a.onReceiveStatus(filteredStatus); - }); - if (this.subchannel) { - this.subchannel.callUnref(); - this.subchannel.removeDisconnectListener(this.disconnectListener); - } - } - } - trace(text) { - logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, '[' + this.callNumber + '] ' + text); - } - /** - * On first call, emits a 'status' event with the given StatusObject. - * Subsequent calls are no-ops. - * @param status The status of the call. - */ - endCall(status) { - /* If the status is OK and a new status comes in (e.g. from a - * deserialization failure), that new status takes priority */ - if (this.finalStatus === null || this.finalStatus.code === constants_1.Status.OK) { - this.trace('ended with status: code=' + - status.code + - ' details="' + - status.details + - '"'); - this.finalStatus = status; - this.maybeOutputStatus(); - } - this.destroyHttp2Stream(); - } - maybeOutputStatus() { - if (this.finalStatus !== null) { - /* The combination check of readsClosed and that the two message buffer - * arrays are empty checks that there all incoming data has been fully - * processed */ - if (this.finalStatus.code !== constants_1.Status.OK || - (this.readsClosed && - this.unpushedReadMessages.length === 0 && - this.unfilteredReadMessages.length === 0 && - !this.isReadFilterPending)) { - this.outputStatus(); - } - } - } - push(message) { - this.trace('pushing to reader message of length ' + - (message instanceof Buffer ? message.length : null)); - this.canPush = false; - process.nextTick(() => { - var _a; - /* If we have already output the status any later messages should be - * ignored, and can cause out-of-order operation errors higher up in the - * stack. Checking as late as possible here to avoid any race conditions. - */ - if (this.statusOutput) { - return; - } - (_a = this.listener) === null || _a === void 0 ? void 0 : _a.onReceiveMessage(message); - this.maybeOutputStatus(); - }); - } - handleFilterError(error) { - this.cancelWithStatus(constants_1.Status.INTERNAL, error.message); - } - handleFilteredRead(message) { - /* If we the call has already ended with an error, we don't want to do - * anything with this message. Dropping it on the floor is correct - * behavior */ - if (this.finalStatus !== null && this.finalStatus.code !== constants_1.Status.OK) { - this.maybeOutputStatus(); - return; - } - this.isReadFilterPending = false; - if (this.canPush) { - this.http2Stream.pause(); - this.push(message); - } - else { - this.trace('unpushedReadMessages.push message of length ' + message.length); - this.unpushedReadMessages.push(message); - } - if (this.unfilteredReadMessages.length > 0) { - /* nextMessage is guaranteed not to be undefined because - unfilteredReadMessages is non-empty */ - const nextMessage = this.unfilteredReadMessages.shift(); - this.filterReceivedMessage(nextMessage); - } - } - filterReceivedMessage(framedMessage) { - /* If we the call has already ended with an error, we don't want to do - * anything with this message. Dropping it on the floor is correct - * behavior */ - if (this.finalStatus !== null && this.finalStatus.code !== constants_1.Status.OK) { - this.maybeOutputStatus(); - return; - } - this.trace('filterReceivedMessage of length ' + framedMessage.length); - this.isReadFilterPending = true; - this.filterStack - .receiveMessage(Promise.resolve(framedMessage)) - .then(this.handleFilteredRead.bind(this), this.handleFilterError.bind(this)); - } - tryPush(messageBytes) { - if (this.isReadFilterPending) { - this.trace('unfilteredReadMessages.push message of length ' + - (messageBytes && messageBytes.length)); - this.unfilteredReadMessages.push(messageBytes); - } - else { - this.filterReceivedMessage(messageBytes); - } - } - handleTrailers(headers) { - let headersString = ''; - for (const header of Object.keys(headers)) { - headersString += '\t\t' + header + ': ' + headers[header] + '\n'; - } - this.trace('Received server trailers:\n' + headersString); - let metadata; - try { - metadata = metadata_1.Metadata.fromHttp2Headers(headers); - } - catch (e) { - metadata = new metadata_1.Metadata(); - } - const metadataMap = metadata.getMap(); - let code = this.mappedStatusCode; - if (code === constants_1.Status.UNKNOWN && - typeof metadataMap['grpc-status'] === 'string') { - const receivedStatus = Number(metadataMap['grpc-status']); - if (receivedStatus in constants_1.Status) { - code = receivedStatus; - this.trace('received status code ' + receivedStatus + ' from server'); - } - metadata.remove('grpc-status'); - } - let details = ''; - if (typeof metadataMap['grpc-message'] === 'string') { - details = decodeURI(metadataMap['grpc-message']); - metadata.remove('grpc-message'); - this.trace('received status details string "' + details + '" from server'); - } - const status = { code, details, metadata }; - let finalStatus; - try { - // Attempt to assign final status. - finalStatus = this.filterStack.receiveTrailers(status); - } - catch (error) { - // This is a no-op if the call was already ended when handling headers. - this.endCall({ - code: constants_1.Status.INTERNAL, - details: 'Failed to process received status', - metadata: new metadata_1.Metadata(), - }); - return; - } - // This is a no-op if the call was already ended when handling headers. - this.endCall(finalStatus); - } - attachHttp2Stream(stream, subchannel, extraFilterFactory) { - if (extraFilterFactory !== undefined) { - this.filterStack = new filter_stack_1.FilterStack([ - this.filterStack, - extraFilterFactory.createFilter(this), - ]); - } - if (this.finalStatus !== null) { - stream.close(NGHTTP2_CANCEL); - } - else { - this.trace('attachHttp2Stream from subchannel ' + subchannel.getAddress()); - this.http2Stream = stream; - this.subchannel = subchannel; - subchannel.addDisconnectListener(this.disconnectListener); - subchannel.callRef(); - stream.on('response', (headers, flags) => { - var _a; - let headersString = ''; - for (const header of Object.keys(headers)) { - headersString += '\t\t' + header + ': ' + headers[header] + '\n'; - } - this.trace('Received server headers:\n' + headersString); - switch (headers[':status']) { - // TODO(murgatroid99): handle 100 and 101 - case 400: - this.mappedStatusCode = constants_1.Status.INTERNAL; - break; - case 401: - this.mappedStatusCode = constants_1.Status.UNAUTHENTICATED; - break; - case 403: - this.mappedStatusCode = constants_1.Status.PERMISSION_DENIED; - break; - case 404: - this.mappedStatusCode = constants_1.Status.UNIMPLEMENTED; - break; - case 429: - case 502: - case 503: - case 504: - this.mappedStatusCode = constants_1.Status.UNAVAILABLE; - break; - default: - this.mappedStatusCode = constants_1.Status.UNKNOWN; - } - if (flags & http2.constants.NGHTTP2_FLAG_END_STREAM) { - this.handleTrailers(headers); - } - else { - let metadata; - try { - metadata = metadata_1.Metadata.fromHttp2Headers(headers); - } - catch (error) { - this.endCall({ - code: constants_1.Status.UNKNOWN, - details: error.message, - metadata: new metadata_1.Metadata(), - }); - return; - } - try { - const finalMetadata = this.filterStack.receiveMetadata(metadata); - (_a = this.listener) === null || _a === void 0 ? void 0 : _a.onReceiveMetadata(finalMetadata); - } - catch (error) { - this.endCall({ - code: constants_1.Status.UNKNOWN, - details: error.message, - metadata: new metadata_1.Metadata(), - }); - } - } - }); - stream.on('trailers', this.handleTrailers.bind(this)); - stream.on('data', (data) => { - this.trace('receive HTTP/2 data frame of length ' + data.length); - const messages = this.decoder.write(data); - for (const message of messages) { - this.trace('parsed message of length ' + message.length); - this.tryPush(message); - } - }); - stream.on('end', () => { - this.readsClosed = true; - this.maybeOutputStatus(); - }); - stream.on('close', () => { - var _a; - this.trace('HTTP/2 stream closed with code ' + stream.rstCode); - /* If we have a final status with an OK status code, that means that - * we have received all of the messages and we have processed the - * trailers and the call completed successfully, so it doesn't matter - * how the stream ends after that */ - if (((_a = this.finalStatus) === null || _a === void 0 ? void 0 : _a.code) === constants_1.Status.OK) { - return; - } - let code; - let details = ''; - switch (stream.rstCode) { - case http2.constants.NGHTTP2_NO_ERROR: - /* If we get a NO_ERROR code and we already have a status, the - * stream completed properly and we just haven't fully processed - * it yet */ - if (this.finalStatus !== null) { - return; - } - code = constants_1.Status.INTERNAL; - details = `Received RST_STREAM with code ${stream.rstCode}`; - break; - case http2.constants.NGHTTP2_REFUSED_STREAM: - code = constants_1.Status.UNAVAILABLE; - details = 'Stream refused by server'; - break; - case http2.constants.NGHTTP2_CANCEL: - code = constants_1.Status.CANCELLED; - details = 'Call cancelled'; - break; - case http2.constants.NGHTTP2_ENHANCE_YOUR_CALM: - code = constants_1.Status.RESOURCE_EXHAUSTED; - details = 'Bandwidth exhausted'; - break; - case http2.constants.NGHTTP2_INADEQUATE_SECURITY: - code = constants_1.Status.PERMISSION_DENIED; - details = 'Protocol not secure enough'; - break; - case http2.constants.NGHTTP2_INTERNAL_ERROR: - code = constants_1.Status.INTERNAL; - /* This error code was previously handled in the default case, and - * there are several instances of it online, so I wanted to - * preserve the original error message so that people find existing - * information in searches, but also include the more recognizable - * "Internal server error" message. */ - details = `Received RST_STREAM with code ${stream.rstCode} (Internal server error)`; - break; - default: - code = constants_1.Status.INTERNAL; - details = `Received RST_STREAM with code ${stream.rstCode}`; - } - // This is a no-op if trailers were received at all. - // This is OK, because status codes emitted here correspond to more - // catastrophic issues that prevent us from receiving trailers in the - // first place. - this.endCall({ code, details, metadata: new metadata_1.Metadata() }); - }); - stream.on('error', (err) => { - /* We need an error handler here to stop "Uncaught Error" exceptions - * from bubbling up. However, errors here should all correspond to - * "close" events, where we will handle the error more granularly */ - }); - if (!this.pendingRead) { - stream.pause(); - } - if (this.pendingWrite) { - if (!this.pendingWriteCallback) { - throw new Error('Invalid state in write handling code'); - } - this.trace('sending data chunk of length ' + - this.pendingWrite.length + - ' (deferred)'); - stream.write(this.pendingWrite, this.pendingWriteCallback); - } - this.maybeCloseWrites(); - } - } - start(metadata, listener) { - this.trace('Sending metadata'); - this.listener = listener; - this.channel._startCallStream(this, metadata); - } - destroyHttp2Stream() { - var _a; - // The http2 stream could already have been destroyed if cancelWithStatus - // is called in response to an internal http2 error. - if (this.http2Stream !== null && !this.http2Stream.destroyed) { - /* If the call has ended with an OK status, communicate that when closing - * the stream, partly to avoid a situation in which we detect an error - * RST_STREAM as a result after we have the status */ - let code; - if (((_a = this.finalStatus) === null || _a === void 0 ? void 0 : _a.code) === constants_1.Status.OK) { - code = http2.constants.NGHTTP2_NO_ERROR; - } - else { - code = http2.constants.NGHTTP2_CANCEL; - } - this.trace('close http2 stream with code ' + code); - this.http2Stream.close(code); - } - } - cancelWithStatus(status, details) { - this.trace('cancelWithStatus code: ' + status + ' details: "' + details + '"'); - this.endCall({ code: status, details, metadata: new metadata_1.Metadata() }); - } - getDeadline() { - if (this.options.parentCall && this.options.flags & constants_1.Propagate.DEADLINE) { - return this.options.parentCall.getDeadline(); - } - else { - return this.options.deadline; - } - } - getCredentials() { - return this.credentials; - } - setCredentials(credentials) { - this.credentials = this.channelCallCredentials.compose(credentials); - } - getStatus() { - return this.finalStatus; - } - getPeer() { - var _a, _b; - return (_b = (_a = this.subchannel) === null || _a === void 0 ? void 0 : _a.getAddress()) !== null && _b !== void 0 ? _b : this.channel.getTarget(); - } - getMethod() { - return this.methodName; - } - getHost() { - return this.options.host; - } - startRead() { - /* If the stream has ended with an error, we should not emit any more - * messages and we should communicate that the stream has ended */ - if (this.finalStatus !== null && this.finalStatus.code !== constants_1.Status.OK) { - this.readsClosed = true; - this.maybeOutputStatus(); - return; - } - this.canPush = true; - if (this.http2Stream === null) { - this.pendingRead = true; - } - else { - if (this.unpushedReadMessages.length > 0) { - const nextMessage = this.unpushedReadMessages.shift(); - this.push(nextMessage); - return; - } - /* Only resume reading from the http2Stream if we don't have any pending - * messages to emit */ - this.http2Stream.resume(); - } - } - maybeCloseWrites() { - if (this.writesClosed && - !this.isWriteFilterPending && - this.http2Stream !== null) { - this.trace('calling end() on HTTP/2 stream'); - this.http2Stream.end(); - } - } - sendMessageWithContext(context, message) { - var _a; - this.trace('write() called with message of length ' + message.length); - const writeObj = { - message, - flags: context.flags, - }; - const cb = (_a = context.callback) !== null && _a !== void 0 ? _a : (() => { }); - this.isWriteFilterPending = true; - this.filterStack.sendMessage(Promise.resolve(writeObj)).then((message) => { - this.isWriteFilterPending = false; - if (this.http2Stream === null) { - this.trace('deferring writing data chunk of length ' + message.message.length); - this.pendingWrite = message.message; - this.pendingWriteCallback = cb; - } - else { - this.trace('sending data chunk of length ' + message.message.length); - this.http2Stream.write(message.message, cb); - this.maybeCloseWrites(); - } - }, this.handleFilterError.bind(this)); - } - halfClose() { - this.trace('end() called'); - this.writesClosed = true; - this.maybeCloseWrites(); - } -} -exports.Http2CallStream = Http2CallStream; -//# sourceMappingURL=call-stream.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call-stream.js.map b/node_modules/@grpc/grpc-js/build/src/call-stream.js.map deleted file mode 100644 index 1febdcba..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call-stream.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"call-stream.js","sourceRoot":"","sources":["../../src/call-stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+BAA+B;AAG/B,2CAAgD;AAEhD,iDAAiE;AACjE,yCAAsC;AACtC,qDAAiD;AAGjD,qCAAqC;AACrC,2CAA2C;AAG3C,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,MAAM,EACJ,mBAAmB,EACnB,yBAAyB,EACzB,cAAc,GACf,GAAG,KAAK,CAAC,SAAS,CAAC;AA6DpB,SAAgB,sBAAsB,CACpC,QAAyC;IAEzC,OAAO,CACL,QAAQ,CAAC,iBAAiB,KAAK,SAAS;QACxC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC,CACxC,CAAC;AACJ,CAAC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AAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,SAAS;QACP,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;CACF;AA7iBD,0CA6iBC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call.d.ts b/node_modules/@grpc/grpc-js/build/src/call.d.ts deleted file mode 100644 index f193ea8f..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/// -import { EventEmitter } from 'events'; -import { Duplex, Readable, Writable } from 'stream'; -import { StatusObject } from './call-stream'; -import { EmitterAugmentation1 } from './events'; -import { Metadata } from './metadata'; -import { ObjectReadable, ObjectWritable, WriteCallback } from './object-stream'; -import { InterceptingCallInterface } from './client-interceptors'; -/** - * A type extending the built-in Error object with additional fields. - */ -export declare type ServiceError = StatusObject & Error; -/** - * A base type for all user-facing values returned by client-side method calls. - */ -export declare type SurfaceCall = { - call?: InterceptingCallInterface; - cancel(): void; - getPeer(): string; -} & EmitterAugmentation1<'metadata', Metadata> & EmitterAugmentation1<'status', StatusObject> & EventEmitter; -/** - * A type representing the return value of a unary method call. - */ -export declare type ClientUnaryCall = SurfaceCall; -/** - * A type representing the return value of a server stream method call. - */ -export declare type ClientReadableStream = { - deserialize: (chunk: Buffer) => ResponseType; -} & SurfaceCall & ObjectReadable; -/** - * A type representing the return value of a client stream method call. - */ -export declare type ClientWritableStream = { - serialize: (value: RequestType) => Buffer; -} & SurfaceCall & ObjectWritable; -/** - * A type representing the return value of a bidirectional stream method call. - */ -export declare type ClientDuplexStream = ClientWritableStream & ClientReadableStream; -/** - * Construct a ServiceError from a StatusObject. This function exists primarily - * as an attempt to make the error stack trace clearly communicate that the - * error is not necessarily a problem in gRPC itself. - * @param status - */ -export declare function callErrorFromStatus(status: StatusObject): ServiceError; -export declare class ClientUnaryCallImpl extends EventEmitter implements ClientUnaryCall { - call?: InterceptingCallInterface; - constructor(); - cancel(): void; - getPeer(): string; -} -export declare class ClientReadableStreamImpl extends Readable implements ClientReadableStream { - readonly deserialize: (chunk: Buffer) => ResponseType; - call?: InterceptingCallInterface; - constructor(deserialize: (chunk: Buffer) => ResponseType); - cancel(): void; - getPeer(): string; - _read(_size: number): void; -} -export declare class ClientWritableStreamImpl extends Writable implements ClientWritableStream { - readonly serialize: (value: RequestType) => Buffer; - call?: InterceptingCallInterface; - constructor(serialize: (value: RequestType) => Buffer); - cancel(): void; - getPeer(): string; - _write(chunk: RequestType, encoding: string, cb: WriteCallback): void; - _final(cb: Function): void; -} -export declare class ClientDuplexStreamImpl extends Duplex implements ClientDuplexStream { - readonly serialize: (value: RequestType) => Buffer; - readonly deserialize: (chunk: Buffer) => ResponseType; - call?: InterceptingCallInterface; - constructor(serialize: (value: RequestType) => Buffer, deserialize: (chunk: Buffer) => ResponseType); - cancel(): void; - getPeer(): string; - _read(_size: number): void; - _write(chunk: RequestType, encoding: string, cb: WriteCallback): void; - _final(cb: Function): void; -} diff --git a/node_modules/@grpc/grpc-js/build/src/call.js b/node_modules/@grpc/grpc-js/build/src/call.js deleted file mode 100644 index c78cfa65..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call.js +++ /dev/null @@ -1,134 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientDuplexStreamImpl = exports.ClientWritableStreamImpl = exports.ClientReadableStreamImpl = exports.ClientUnaryCallImpl = exports.callErrorFromStatus = void 0; -const events_1 = require("events"); -const stream_1 = require("stream"); -const constants_1 = require("./constants"); -/** - * Construct a ServiceError from a StatusObject. This function exists primarily - * as an attempt to make the error stack trace clearly communicate that the - * error is not necessarily a problem in gRPC itself. - * @param status - */ -function callErrorFromStatus(status) { - const message = `${status.code} ${constants_1.Status[status.code]}: ${status.details}`; - return Object.assign(new Error(message), status); -} -exports.callErrorFromStatus = callErrorFromStatus; -class ClientUnaryCallImpl extends events_1.EventEmitter { - constructor() { - super(); - } - cancel() { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); - } - getPeer() { - var _a, _b; - return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; - } -} -exports.ClientUnaryCallImpl = ClientUnaryCallImpl; -class ClientReadableStreamImpl extends stream_1.Readable { - constructor(deserialize) { - super({ objectMode: true }); - this.deserialize = deserialize; - } - cancel() { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); - } - getPeer() { - var _a, _b; - return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; - } - _read(_size) { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead(); - } -} -exports.ClientReadableStreamImpl = ClientReadableStreamImpl; -class ClientWritableStreamImpl extends stream_1.Writable { - constructor(serialize) { - super({ objectMode: true }); - this.serialize = serialize; - } - cancel() { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); - } - getPeer() { - var _a, _b; - return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; - } - _write(chunk, encoding, cb) { - var _a; - const context = { - callback: cb, - }; - const flags = Number(encoding); - if (!Number.isNaN(flags)) { - context.flags = flags; - } - (_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk); - } - _final(cb) { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose(); - cb(); - } -} -exports.ClientWritableStreamImpl = ClientWritableStreamImpl; -class ClientDuplexStreamImpl extends stream_1.Duplex { - constructor(serialize, deserialize) { - super({ objectMode: true }); - this.serialize = serialize; - this.deserialize = deserialize; - } - cancel() { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); - } - getPeer() { - var _a, _b; - return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; - } - _read(_size) { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead(); - } - _write(chunk, encoding, cb) { - var _a; - const context = { - callback: cb, - }; - const flags = Number(encoding); - if (!Number.isNaN(flags)) { - context.flags = flags; - } - (_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk); - } - _final(cb) { - var _a; - (_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose(); - cb(); - } -} -exports.ClientDuplexStreamImpl = ClientDuplexStreamImpl; -//# sourceMappingURL=call.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/call.js.map b/node_modules/@grpc/grpc-js/build/src/call.js.map deleted file mode 100644 index a85066a0..00000000 --- a/node_modules/@grpc/grpc-js/build/src/call.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/call.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mCAAsC;AACtC,mCAAoD;AAGpD,2CAAqC;AAmDrC;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,MAAoB;IACtD,MAAM,OAAO,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI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Q,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACxB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;SACvB;QACD,MAAA,IAAI,CAAC,IAAI,0CAAE,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE;IACpD,CAAC;IAED,MAAM,CAAC,EAAY;;QACjB,MAAA,IAAI,CAAC,IAAI,0CAAE,SAAS,GAAG;QACvB,EAAE,EAAE,CAAC;IACP,CAAC;CACF;AArCD,wDAqCC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/channel-credentials.d.ts b/node_modules/@grpc/grpc-js/build/src/channel-credentials.d.ts deleted file mode 100644 index ba70157b..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel-credentials.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/// -import { ConnectionOptions } from 'tls'; -import { CallCredentials } from './call-credentials'; -/** - * A certificate as received by the checkServerIdentity callback. - */ -export interface Certificate { - /** - * The raw certificate in DER form. - */ - raw: Buffer; -} -/** - * A callback that will receive the expected hostname and presented peer - * certificate as parameters. The callback should return an error to - * indicate that the presented certificate is considered invalid and - * otherwise returned undefined. - */ -export declare type CheckServerIdentityCallback = (hostname: string, cert: Certificate) => Error | undefined; -/** - * Additional peer verification options that can be set when creating - * SSL credentials. - */ -export interface VerifyOptions { - /** - * If set, this callback will be invoked after the usual hostname verification - * has been performed on the peer certificate. - */ - checkServerIdentity?: CheckServerIdentityCallback; -} -/** - * A class that contains credentials for communicating over a channel, as well - * as a set of per-call credentials, which are applied to every method call made - * over a channel initialized with an instance of this class. - */ -export declare abstract class ChannelCredentials { - protected callCredentials: CallCredentials; - protected constructor(callCredentials?: CallCredentials); - /** - * Returns a copy of this object with the included set of per-call credentials - * expanded to include callCredentials. - * @param callCredentials A CallCredentials object to associate with this - * instance. - */ - abstract compose(callCredentials: CallCredentials): ChannelCredentials; - /** - * Gets the set of per-call credentials associated with this instance. - */ - _getCallCredentials(): CallCredentials; - /** - * Gets a SecureContext object generated from input parameters if this - * instance was created with createSsl, or null if this instance was created - * with createInsecure. - */ - abstract _getConnectionOptions(): ConnectionOptions | null; - /** - * Indicates whether this credentials object creates a secure channel. - */ - abstract _isSecure(): boolean; - /** - * Check whether two channel credentials objects are equal. Two secure - * credentials are equal if they were constructed with the same parameters. - * @param other The other ChannelCredentials Object - */ - abstract _equals(other: ChannelCredentials): boolean; - /** - * Return a new ChannelCredentials instance with a given set of credentials. - * The resulting instance can be used to construct a Channel that communicates - * over TLS. - * @param rootCerts The root certificate data. - * @param privateKey The client certificate private key, if available. - * @param certChain The client certificate key chain, if available. - */ - static createSsl(rootCerts?: Buffer | null, privateKey?: Buffer | null, certChain?: Buffer | null, verifyOptions?: VerifyOptions): ChannelCredentials; - /** - * Return a new ChannelCredentials instance with no credentials. - */ - static createInsecure(): ChannelCredentials; -} -export declare function createGoogleDefaultCredentials(): ChannelCredentials; diff --git a/node_modules/@grpc/grpc-js/build/src/channel-credentials.js b/node_modules/@grpc/grpc-js/build/src/channel-credentials.js deleted file mode 100644 index 803a25e0..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel-credentials.js +++ /dev/null @@ -1,186 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createGoogleDefaultCredentials = exports.ChannelCredentials = void 0; -const tls_1 = require("tls"); -const call_credentials_1 = require("./call-credentials"); -const tls_helpers_1 = require("./tls-helpers"); -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function verifyIsBufferOrNull(obj, friendlyName) { - if (obj && !(obj instanceof Buffer)) { - throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`); - } -} -function bufferOrNullEqual(buf1, buf2) { - if (buf1 === null && buf2 === null) { - return true; - } - else { - return buf1 !== null && buf2 !== null && buf1.equals(buf2); - } -} -/** - * A class that contains credentials for communicating over a channel, as well - * as a set of per-call credentials, which are applied to every method call made - * over a channel initialized with an instance of this class. - */ -class ChannelCredentials { - constructor(callCredentials) { - this.callCredentials = callCredentials || call_credentials_1.CallCredentials.createEmpty(); - } - /** - * Gets the set of per-call credentials associated with this instance. - */ - _getCallCredentials() { - return this.callCredentials; - } - /** - * Return a new ChannelCredentials instance with a given set of credentials. - * The resulting instance can be used to construct a Channel that communicates - * over TLS. - * @param rootCerts The root certificate data. - * @param privateKey The client certificate private key, if available. - * @param certChain The client certificate key chain, if available. - */ - static createSsl(rootCerts, privateKey, certChain, verifyOptions) { - verifyIsBufferOrNull(rootCerts, 'Root certificate'); - verifyIsBufferOrNull(privateKey, 'Private key'); - verifyIsBufferOrNull(certChain, 'Certificate chain'); - if (privateKey && !certChain) { - throw new Error('Private key must be given with accompanying certificate chain'); - } - if (!privateKey && certChain) { - throw new Error('Certificate chain must be given with accompanying private key'); - } - return new SecureChannelCredentialsImpl(rootCerts || tls_helpers_1.getDefaultRootsData(), privateKey || null, certChain || null, verifyOptions || {}); - } - /** - * Return a new ChannelCredentials instance with no credentials. - */ - static createInsecure() { - return new InsecureChannelCredentialsImpl(); - } -} -exports.ChannelCredentials = ChannelCredentials; -class InsecureChannelCredentialsImpl extends ChannelCredentials { - constructor(callCredentials) { - super(callCredentials); - } - compose(callCredentials) { - throw new Error('Cannot compose insecure credentials'); - } - _getConnectionOptions() { - return null; - } - _isSecure() { - return false; - } - _equals(other) { - return other instanceof InsecureChannelCredentialsImpl; - } -} -class SecureChannelCredentialsImpl extends ChannelCredentials { - constructor(rootCerts, privateKey, certChain, verifyOptions) { - super(); - this.rootCerts = rootCerts; - this.privateKey = privateKey; - this.certChain = certChain; - this.verifyOptions = verifyOptions; - const secureContext = tls_1.createSecureContext({ - ca: rootCerts || undefined, - key: privateKey || undefined, - cert: certChain || undefined, - ciphers: tls_helpers_1.CIPHER_SUITES, - }); - this.connectionOptions = { secureContext }; - if (verifyOptions && verifyOptions.checkServerIdentity) { - this.connectionOptions.checkServerIdentity = (host, cert) => { - return verifyOptions.checkServerIdentity(host, { raw: cert.raw }); - }; - } - } - compose(callCredentials) { - const combinedCallCredentials = this.callCredentials.compose(callCredentials); - return new ComposedChannelCredentialsImpl(this, combinedCallCredentials); - } - _getConnectionOptions() { - // Copy to prevent callers from mutating this.connectionOptions - return Object.assign({}, this.connectionOptions); - } - _isSecure() { - return true; - } - _equals(other) { - if (this === other) { - return true; - } - if (other instanceof SecureChannelCredentialsImpl) { - if (!bufferOrNullEqual(this.rootCerts, other.rootCerts)) { - return false; - } - if (!bufferOrNullEqual(this.privateKey, other.privateKey)) { - return false; - } - if (!bufferOrNullEqual(this.certChain, other.certChain)) { - return false; - } - return (this.verifyOptions.checkServerIdentity === - other.verifyOptions.checkServerIdentity); - } - else { - return false; - } - } -} -class ComposedChannelCredentialsImpl extends ChannelCredentials { - constructor(channelCredentials, callCreds) { - super(callCreds); - this.channelCredentials = channelCredentials; - } - compose(callCredentials) { - const combinedCallCredentials = this.callCredentials.compose(callCredentials); - return new ComposedChannelCredentialsImpl(this.channelCredentials, combinedCallCredentials); - } - _getConnectionOptions() { - return this.channelCredentials._getConnectionOptions(); - } - _isSecure() { - return true; - } - _equals(other) { - if (this === other) { - return true; - } - if (other instanceof ComposedChannelCredentialsImpl) { - return (this.channelCredentials._equals(other.channelCredentials) && - this.callCredentials._equals(other.callCredentials)); - } - else { - return false; - } - } -} -function createGoogleDefaultCredentials() { - const GoogleAuth = require('google-auth-library') - .GoogleAuth; - const sslCreds = ChannelCredentials.createSsl(); - const googleAuthCreds = call_credentials_1.CallCredentials.createFromGoogleCredential(new GoogleAuth()); - return sslCreds.compose(googleAuthCreds); -} -exports.createGoogleDefaultCredentials = createGoogleDefaultCredentials; -//# sourceMappingURL=channel-credentials.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/channel-credentials.js.map b/node_modules/@grpc/grpc-js/build/src/channel-credentials.js.map deleted file mode 100644 index 56045cb2..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel-credentials.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"channel-credentials.js","sourceRoot":"","sources":["../../src/channel-credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,6BAA8E;AAE9E,yDAAqD;AACrD,+CAAmE;AAGnE,8DAA8D;AAC9D,SAAS,oBAAoB,CAAC,GAAQ,EAAE,YAAoB;IAC1D,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,YAAY,MAAM,CAAC,EAAE;QACnC,MAAM,IAAI,SAAS,CAAC,GAAG,YAAY,kCAAkC,CAAC,CAAC;KACxE;AACH,CAAC;AAuBD,SAAS,iBAAiB,CAAC,IAAmB,EAAE,IAAmB;IACjE,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;SAAM;QACL,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAC5D;AACH,CAAC;AAcD;;;;GAIG;AACH,MAAsB,kBAAkB;IAGtC,YAAsB,eAAiC;QACrD,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI,kCAAe,CAAC,WAAW,EAAE,CAAC;IAC1E,CAAC;IASD;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAqBD;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CACd,SAAyB,EACzB,UAA0B,EAC1B,SAAyB,EACzB,aAA6B;QAE7B,oBAAoB,CAAC,SAAS,EAAE,kBAAkB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ACF,OAAO,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;AAC3C,CAAC;AARD,wEAQC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/channel-options.d.ts b/node_modules/@grpc/grpc-js/build/src/channel-options.d.ts deleted file mode 100644 index d54e91ec..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel-options.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * An interface that contains options used when initializing a Channel instance. - */ -export interface ChannelOptions { - 'grpc.ssl_target_name_override'?: string; - 'grpc.primary_user_agent'?: string; - 'grpc.secondary_user_agent'?: string; - 'grpc.default_authority'?: string; - 'grpc.keepalive_time_ms'?: number; - 'grpc.keepalive_timeout_ms'?: number; - 'grpc.keepalive_permit_without_calls'?: number; - 'grpc.service_config'?: string; - 'grpc.max_concurrent_streams'?: number; - 'grpc.initial_reconnect_backoff_ms'?: number; - 'grpc.max_reconnect_backoff_ms'?: number; - 'grpc.use_local_subchannel_pool'?: number; - 'grpc.max_send_message_length'?: number; - 'grpc.max_receive_message_length'?: number; - 'grpc.enable_http_proxy'?: number; - 'grpc.http_connect_target'?: string; - 'grpc.http_connect_creds'?: string; - [key: string]: any; -} -/** - * This is for checking provided options at runtime. This is an object for - * easier membership checking. - */ -export declare const recognizedOptions: { - 'grpc.ssl_target_name_override': boolean; - 'grpc.primary_user_agent': boolean; - 'grpc.secondary_user_agent': boolean; - 'grpc.default_authority': boolean; - 'grpc.keepalive_time_ms': boolean; - 'grpc.keepalive_timeout_ms': boolean; - 'grpc.keepalive_permit_without_calls': boolean; - 'grpc.service_config': boolean; - 'grpc.max_concurrent_streams': boolean; - 'grpc.initial_reconnect_backoff_ms': boolean; - 'grpc.max_reconnect_backoff_ms': boolean; - 'grpc.use_local_subchannel_pool': boolean; - 'grpc.max_send_message_length': boolean; - 'grpc.max_receive_message_length': boolean; - 'grpc.enable_http_proxy': boolean; -}; -export declare function channelOptionsEqual(options1: ChannelOptions, options2: ChannelOptions): boolean; diff --git a/node_modules/@grpc/grpc-js/build/src/channel-options.js b/node_modules/@grpc/grpc-js/build/src/channel-options.js deleted file mode 100644 index 05fabb60..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel-options.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.channelOptionsEqual = exports.recognizedOptions = void 0; -/** - * This is for checking provided options at runtime. This is an object for - * easier membership checking. - */ -exports.recognizedOptions = { - 'grpc.ssl_target_name_override': true, - 'grpc.primary_user_agent': true, - 'grpc.secondary_user_agent': true, - 'grpc.default_authority': true, - 'grpc.keepalive_time_ms': true, - 'grpc.keepalive_timeout_ms': true, - 'grpc.keepalive_permit_without_calls': true, - 'grpc.service_config': true, - 'grpc.max_concurrent_streams': true, - 'grpc.initial_reconnect_backoff_ms': true, - 'grpc.max_reconnect_backoff_ms': true, - 'grpc.use_local_subchannel_pool': true, - 'grpc.max_send_message_length': true, - 'grpc.max_receive_message_length': true, - 'grpc.enable_http_proxy': true, -}; -function channelOptionsEqual(options1, options2) { - const keys1 = Object.keys(options1).sort(); - const keys2 = Object.keys(options2).sort(); - if (keys1.length !== keys2.length) { - return false; - } - for (let i = 0; i < keys1.length; i += 1) { - if (keys1[i] !== keys2[i]) { - return false; - } - if (options1[keys1[i]] !== options2[keys2[i]]) { - return false; - } - } - return true; -} -exports.channelOptionsEqual = channelOptionsEqual; -//# sourceMappingURL=channel-options.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/channel-options.js.map b/node_modules/@grpc/grpc-js/build/src/channel-options.js.map deleted file mode 100644 index b5f76023..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel-options.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"channel-options.js","sourceRoot":"","sources":["../../src/channel-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AA0BH;;;GAGG;AACU,QAAA,iBAAiB,GAAG;IAC/B,+BAA+B,EAAE,IAAI;IACrC,yBAAyB,EAAE,IAAI;IAC/B,2BAA2B,EAAE,IAAI;IACjC,wBAAwB,EAAE,IAAI;IAC9B,wBAAwB,EAAE,IAAI;IAC9B,2BAA2B,EAAE,IAAI;IACjC,qCAAqC,EAAE,IAAI;IAC3C,qBAAqB,EAAE,IAAI;IAC3B,6BAA6B,EAAE,IAAI;IACnC,mCAAmC,EAAE,IAAI;IACzC,+BAA+B,EAAE,IAAI;IACrC,gCAAgC,EAAE,IAAI;IACtC,8BAA8B,EAAE,IAAI;IACpC,iCAAiC,EAAE,IAAI;IACvC,wBAAwB,EAAE,IAAI;CAC/B,CAAC;AAEF,SAAgB,mBAAmB,CACjC,QAAwB,EACxB,QAAwB;IAExB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;QACjC,OAAO,KAAK,CAAC;KACd;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACxC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE;YACzB,OAAO,KAAK,CAAC;SACd;QACD,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;YAC7C,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAlBD,kDAkBC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/channel.d.ts b/node_modules/@grpc/grpc-js/build/src/channel.d.ts deleted file mode 100644 index 44935b1a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Deadline, Call, Http2CallStream } from './call-stream'; -import { ChannelCredentials } from './channel-credentials'; -import { ChannelOptions } from './channel-options'; -import { Metadata } from './metadata'; -import { ServerSurfaceCall } from './server-call'; -export declare enum ConnectivityState { - IDLE = 0, - CONNECTING = 1, - READY = 2, - TRANSIENT_FAILURE = 3, - SHUTDOWN = 4 -} -/** - * An interface that represents a communication channel to a server specified - * by a given address. - */ -export interface Channel { - /** - * Close the channel. This has the same functionality as the existing - * grpc.Client.prototype.close - */ - close(): void; - /** - * Return the target that this channel connects to - */ - getTarget(): string; - /** - * Get the channel's current connectivity state. This method is here mainly - * because it is in the existing internal Channel class, and there isn't - * another good place to put it. - * @param tryToConnect If true, the channel will start connecting if it is - * idle. Otherwise, idle channels will only start connecting when a - * call starts. - */ - getConnectivityState(tryToConnect: boolean): ConnectivityState; - /** - * Watch for connectivity state changes. This is also here mainly because - * it is in the existing external Channel class. - * @param currentState The state to watch for transitions from. This should - * always be populated by calling getConnectivityState immediately - * before. - * @param deadline A deadline for waiting for a state change - * @param callback Called with no error when a state change, or with an - * error if the deadline passes without a state change. - */ - watchConnectivityState(currentState: ConnectivityState, deadline: Date | number, callback: (error?: Error) => void): void; - /** - * Create a call object. Call is an opaque type that is used by the Client - * class. This function is called by the gRPC library when starting a - * request. Implementers should return an instance of Call that is returned - * from calling createCall on an instance of the provided Channel class. - * @param method The full method string to request. - * @param deadline The call deadline - * @param host A host string override for making the request - * @param parentCall A server call to propagate some information from - * @param propagateFlags A bitwise combination of elements of grpc.propagate - * that indicates what information to propagate from parentCall. - */ - createCall(method: string, deadline: Deadline, host: string | null | undefined, parentCall: ServerSurfaceCall | null, propagateFlags: number | null | undefined): Call; -} -export declare class ChannelImplementation implements Channel { - private readonly credentials; - private readonly options; - private resolvingLoadBalancer; - private subchannelPool; - private connectivityState; - private currentPicker; - private pickQueue; - private connectivityStateWatchers; - private defaultAuthority; - private filterStackFactory; - private target; - /** - * This timer does not do anything on its own. Its purpose is to hold the - * event loop open while there are any pending calls for the channel that - * have not yet been assigned to specific subchannels. In other words, - * the invariant is that callRefTimer is reffed if and only if pickQueue - * is non-empty. - */ - private callRefTimer; - constructor(target: string, credentials: ChannelCredentials, options: ChannelOptions); - private pushPick; - /** - * Check the picker output for the given call and corresponding metadata, - * and take any relevant actions. Should not be called while iterating - * over pickQueue. - * @param callStream - * @param callMetadata - */ - private tryPick; - private removeConnectivityStateWatcher; - private updateState; - _startCallStream(stream: Http2CallStream, metadata: Metadata): void; - close(): void; - getTarget(): string; - getConnectivityState(tryToConnect: boolean): ConnectivityState; - watchConnectivityState(currentState: ConnectivityState, deadline: Date | number, callback: (error?: Error) => void): void; - createCall(method: string, deadline: Deadline, host: string | null | undefined, parentCall: ServerSurfaceCall | null, propagateFlags: number | null | undefined): Call; -} diff --git a/node_modules/@grpc/grpc-js/build/src/channel.js b/node_modules/@grpc/grpc-js/build/src/channel.js deleted file mode 100644 index b08e1a5d..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel.js +++ /dev/null @@ -1,345 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ChannelImplementation = exports.ConnectivityState = void 0; -const call_stream_1 = require("./call-stream"); -const channel_credentials_1 = require("./channel-credentials"); -const resolving_load_balancer_1 = require("./resolving-load-balancer"); -const subchannel_pool_1 = require("./subchannel-pool"); -const picker_1 = require("./picker"); -const constants_1 = require("./constants"); -const filter_stack_1 = require("./filter-stack"); -const call_credentials_filter_1 = require("./call-credentials-filter"); -const deadline_filter_1 = require("./deadline-filter"); -const compression_filter_1 = require("./compression-filter"); -const resolver_1 = require("./resolver"); -const logging_1 = require("./logging"); -const max_message_size_filter_1 = require("./max-message-size-filter"); -const http_proxy_1 = require("./http_proxy"); -const uri_parser_1 = require("./uri-parser"); -var ConnectivityState; -(function (ConnectivityState) { - ConnectivityState[ConnectivityState["IDLE"] = 0] = "IDLE"; - ConnectivityState[ConnectivityState["CONNECTING"] = 1] = "CONNECTING"; - ConnectivityState[ConnectivityState["READY"] = 2] = "READY"; - ConnectivityState[ConnectivityState["TRANSIENT_FAILURE"] = 3] = "TRANSIENT_FAILURE"; - ConnectivityState[ConnectivityState["SHUTDOWN"] = 4] = "SHUTDOWN"; -})(ConnectivityState = exports.ConnectivityState || (exports.ConnectivityState = {})); -/** - * See https://nodejs.org/api/timers.html#timers_setinterval_callback_delay_args - */ -const MAX_TIMEOUT_TIME = 2147483647; -let nextCallNumber = 0; -function getNewCallNumber() { - const callNumber = nextCallNumber; - nextCallNumber += 1; - if (nextCallNumber >= Number.MAX_SAFE_INTEGER) { - nextCallNumber = 0; - } - return callNumber; -} -class ChannelImplementation { - constructor(target, credentials, options) { - var _a, _b, _c; - this.credentials = credentials; - this.options = options; - this.connectivityState = ConnectivityState.IDLE; - this.currentPicker = new picker_1.UnavailablePicker(); - this.pickQueue = []; - this.connectivityStateWatchers = []; - if (typeof target !== 'string') { - throw new TypeError('Channel target must be a string'); - } - if (!(credentials instanceof channel_credentials_1.ChannelCredentials)) { - throw new TypeError('Channel credentials must be a ChannelCredentials object'); - } - if (options) { - if (typeof options !== 'object' || - !Object.values(options).every((value) => typeof value === 'string' || - typeof value === 'number' || - typeof value === 'undefined')) { - throw new TypeError('Channel options must be an object with string or number values'); - } - } - const originalTargetUri = uri_parser_1.parseUri(target); - if (originalTargetUri === null) { - throw new Error(`Could not parse target name "${target}"`); - } - /* This ensures that the target has a scheme that is registered with the - * resolver */ - const defaultSchemeMapResult = resolver_1.mapUriDefaultScheme(originalTargetUri); - if (defaultSchemeMapResult === null) { - throw new Error(`Could not find a default scheme for target name "${target}"`); - } - this.callRefTimer = setInterval(() => { }, MAX_TIMEOUT_TIME); - (_b = (_a = this.callRefTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); - if (this.options['grpc.default_authority']) { - this.defaultAuthority = this.options['grpc.default_authority']; - } - else { - this.defaultAuthority = resolver_1.getDefaultAuthority(defaultSchemeMapResult); - } - const proxyMapResult = http_proxy_1.mapProxyName(defaultSchemeMapResult, options); - this.target = proxyMapResult.target; - this.options = Object.assign({}, this.options, proxyMapResult.extraOptions); - /* The global boolean parameter to getSubchannelPool has the inverse meaning to what - * the grpc.use_local_subchannel_pool channel option means. */ - this.subchannelPool = subchannel_pool_1.getSubchannelPool(((_c = options['grpc.use_local_subchannel_pool']) !== null && _c !== void 0 ? _c : 0) === 0); - const channelControlHelper = { - createSubchannel: (subchannelAddress, subchannelArgs) => { - return this.subchannelPool.getOrCreateSubchannel(this.target, subchannelAddress, Object.assign({}, this.options, subchannelArgs), this.credentials); - }, - updateState: (connectivityState, picker) => { - var _a, _b; - this.currentPicker = picker; - const queueCopy = this.pickQueue.slice(); - (_b = (_a = this.callRefTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); - this.pickQueue = []; - for (const { callStream, callMetadata } of queueCopy) { - this.tryPick(callStream, callMetadata); - } - this.updateState(connectivityState); - }, - requestReresolution: () => { - // This should never be called. - throw new Error('Resolving load balancer should never call requestReresolution'); - }, - }; - this.resolvingLoadBalancer = new resolving_load_balancer_1.ResolvingLoadBalancer(this.target, channelControlHelper, options); - this.filterStackFactory = new filter_stack_1.FilterStackFactory([ - new call_credentials_filter_1.CallCredentialsFilterFactory(this), - new deadline_filter_1.DeadlineFilterFactory(this), - new max_message_size_filter_1.MaxMessageSizeFilterFactory(this.options), - new compression_filter_1.CompressionFilterFactory(this), - ]); - } - pushPick(callStream, callMetadata) { - var _a, _b; - (_b = (_a = this.callRefTimer).ref) === null || _b === void 0 ? void 0 : _b.call(_a); - this.pickQueue.push({ callStream, callMetadata }); - } - /** - * Check the picker output for the given call and corresponding metadata, - * and take any relevant actions. Should not be called while iterating - * over pickQueue. - * @param callStream - * @param callMetadata - */ - tryPick(callStream, callMetadata) { - var _a, _b, _c; - const pickResult = this.currentPicker.pick({ metadata: callMetadata }); - logging_1.trace(constants_1.LogVerbosity.DEBUG, 'channel', 'Pick result: ' + - picker_1.PickResultType[pickResult.pickResultType] + - ' subchannel: ' + ((_a = pickResult.subchannel) === null || _a === void 0 ? void 0 : _a.getAddress()) + - ' status: ' + ((_b = pickResult.status) === null || _b === void 0 ? void 0 : _b.code) + - ' ' + ((_c = pickResult.status) === null || _c === void 0 ? void 0 : _c.details)); - switch (pickResult.pickResultType) { - case picker_1.PickResultType.COMPLETE: - if (pickResult.subchannel === null) { - callStream.cancelWithStatus(constants_1.Status.UNAVAILABLE, 'Request dropped by load balancing policy'); - // End the call with an error - } - else { - /* If the subchannel is not in the READY state, that indicates a bug - * somewhere in the load balancer or picker. So, we log an error and - * queue the pick to be tried again later. */ - if (pickResult.subchannel.getConnectivityState() !== - ConnectivityState.READY) { - logging_1.log(constants_1.LogVerbosity.ERROR, 'Error: COMPLETE pick result subchannel ' + - pickResult.subchannel.getAddress() + - ' has state ' + - ConnectivityState[pickResult.subchannel.getConnectivityState()]); - this.pushPick(callStream, callMetadata); - break; - } - /* We need to clone the callMetadata here because the transparent - * retry code in the promise resolution handler use the same - * callMetadata object, so it needs to stay unmodified */ - callStream.filterStack - .sendMetadata(Promise.resolve(callMetadata.clone())) - .then((finalMetadata) => { - var _a, _b; - const subchannelState = pickResult.subchannel.getConnectivityState(); - if (subchannelState === ConnectivityState.READY) { - try { - pickResult.subchannel.startCallStream(finalMetadata, callStream, (_a = pickResult.extraFilterFactory) !== null && _a !== void 0 ? _a : undefined); - /* If we reach this point, the call stream has started - * successfully */ - (_b = pickResult.onCallStarted) === null || _b === void 0 ? void 0 : _b.call(pickResult); - } - catch (error) { - if (error.code === - 'ERR_HTTP2_GOAWAY_SESSION') { - /* An error here indicates that something went wrong with - * the picked subchannel's http2 stream right before we - * tried to start the stream. We are handling a promise - * result here, so this is asynchronous with respect to the - * original tryPick call, so calling it again is not - * recursive. We call tryPick immediately instead of - * queueing this pick again because handling the queue is - * triggered by state changes, and we want to immediately - * check if the state has already changed since the - * previous tryPick call. We do this instead of cancelling - * the stream because the correct behavior may be - * re-queueing instead, based on the logic in the rest of - * tryPick */ - logging_1.trace(constants_1.LogVerbosity.INFO, 'channel', 'Failed to start call on picked subchannel ' + - pickResult.subchannel.getAddress() + - ' with error ' + - error.message + - '. Retrying pick'); - this.tryPick(callStream, callMetadata); - } - else { - logging_1.trace(constants_1.LogVerbosity.INFO, 'channel', 'Failed to start call on picked subchanel ' + - pickResult.subchannel.getAddress() + - ' with error ' + - error.message + - '. Ending call'); - callStream.cancelWithStatus(constants_1.Status.INTERNAL, 'Failed to start HTTP/2 stream'); - } - } - } - else { - /* The logic for doing this here is the same as in the catch - * block above */ - logging_1.trace(constants_1.LogVerbosity.INFO, 'channel', 'Picked subchannel ' + - pickResult.subchannel.getAddress() + - ' has state ' + - ConnectivityState[subchannelState] + - ' after metadata filters. Retrying pick'); - this.tryPick(callStream, callMetadata); - } - }, (error) => { - // We assume the error code isn't 0 (Status.OK) - callStream.cancelWithStatus(error.code || constants_1.Status.UNKNOWN, `Getting metadata from plugin failed with error: ${error.message}`); - }); - } - break; - case picker_1.PickResultType.QUEUE: - this.pushPick(callStream, callMetadata); - break; - case picker_1.PickResultType.TRANSIENT_FAILURE: - if (callMetadata.getOptions().waitForReady) { - this.pushPick(callStream, callMetadata); - } - else { - callStream.cancelWithStatus(pickResult.status.code, pickResult.status.details); - } - break; - case picker_1.PickResultType.DROP: - callStream.cancelWithStatus(pickResult.status.code, pickResult.status.details); - break; - default: - throw new Error(`Invalid state: unknown pickResultType ${pickResult.pickResultType}`); - } - } - removeConnectivityStateWatcher(watcherObject) { - const watcherIndex = this.connectivityStateWatchers.findIndex((value) => value === watcherObject); - if (watcherIndex >= 0) { - this.connectivityStateWatchers.splice(watcherIndex, 1); - } - } - updateState(newState) { - logging_1.trace(constants_1.LogVerbosity.DEBUG, 'connectivity_state', uri_parser_1.uriToString(this.target) + - ' ' + - ConnectivityState[this.connectivityState] + - ' -> ' + - ConnectivityState[newState]); - this.connectivityState = newState; - const watchersCopy = this.connectivityStateWatchers.slice(); - for (const watcherObject of watchersCopy) { - if (newState !== watcherObject.currentState) { - if (watcherObject.timer) { - clearTimeout(watcherObject.timer); - } - this.removeConnectivityStateWatcher(watcherObject); - watcherObject.callback(); - } - } - } - _startCallStream(stream, metadata) { - this.tryPick(stream, metadata.clone()); - } - close() { - this.resolvingLoadBalancer.destroy(); - this.updateState(ConnectivityState.SHUTDOWN); - clearInterval(this.callRefTimer); - this.subchannelPool.unrefUnusedSubchannels(); - } - getTarget() { - return uri_parser_1.uriToString(this.target); - } - getConnectivityState(tryToConnect) { - const connectivityState = this.connectivityState; - if (tryToConnect) { - this.resolvingLoadBalancer.exitIdle(); - } - return connectivityState; - } - watchConnectivityState(currentState, deadline, callback) { - let timer = null; - if (deadline !== Infinity) { - const deadlineDate = deadline instanceof Date ? deadline : new Date(deadline); - const now = new Date(); - if (deadline === -Infinity || deadlineDate <= now) { - process.nextTick(callback, new Error('Deadline passed without connectivity state change')); - return; - } - timer = setTimeout(() => { - this.removeConnectivityStateWatcher(watcherObject); - callback(new Error('Deadline passed without connectivity state change')); - }, deadlineDate.getTime() - now.getTime()); - } - const watcherObject = { - currentState, - callback, - timer - }; - this.connectivityStateWatchers.push(watcherObject); - } - createCall(method, deadline, host, parentCall, propagateFlags) { - if (typeof method !== 'string') { - throw new TypeError('Channel#createCall: method must be a string'); - } - if (!(typeof deadline === 'number' || deadline instanceof Date)) { - throw new TypeError('Channel#createCall: deadline must be a number or Date'); - } - if (this.connectivityState === ConnectivityState.SHUTDOWN) { - throw new Error('Channel has been shut down'); - } - const callNumber = getNewCallNumber(); - logging_1.trace(constants_1.LogVerbosity.DEBUG, 'channel', uri_parser_1.uriToString(this.target) + - ' createCall [' + - callNumber + - '] method="' + - method + - '", deadline=' + - deadline); - const finalOptions = { - deadline: deadline, - flags: propagateFlags !== null && propagateFlags !== void 0 ? propagateFlags : constants_1.Propagate.DEFAULTS, - host: host !== null && host !== void 0 ? host : this.defaultAuthority, - parentCall: parentCall, - }; - const stream = new call_stream_1.Http2CallStream(method, this, finalOptions, this.filterStackFactory, this.credentials._getCallCredentials(), callNumber); - return stream; - } -} -exports.ChannelImplementation = ChannelImplementation; -//# sourceMappingURL=channel.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/channel.js.map b/node_modules/@grpc/grpc-js/build/src/channel.js.map deleted file mode 100644 index 73d6d019..00000000 --- a/node_modules/@grpc/grpc-js/build/src/channel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/channel.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+CAKuB;AACvB,+DAA2D;AAE3D,uEAAkE;AAClE,uDAAsE;AAEtE,qCAAqE;AAErE,2CAA8D;AAC9D,iDAAoD;AACpD,uEAAyE;AACzE,uDAA0D;AAC1D,6DAAgE;AAChE,yCAAsE;AACtE,uCAAuC;AAEvC,uEAAwE;AACxE,6CAA4C;AAC5C,6CAA8D;AAI9D,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,yDAAI,CAAA;IACJ,qEAAU,CAAA;IACV,2DAAK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CAAC,QAAQ,EAAE;YACzD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SAC/C;QACD,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;QACtC,eAAK,CACH,wBAAY,CAAC,KAAK,EAClB,SAAS,EACT,wBAAW,CAAC,IAAI,CAAC,MAAM,CAAC;YACtB,eAAe;YACf,UAAU;YACV,YAAY;YACZ,MAAM;YACN,cAAc;YACd,QAAQ,CACX,CAAC;QACF,MAAM,YAAY,GAAsB;YACtC,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,qBAAS,CAAC,QAAQ;YAC3C,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI,CAAC,gBAAgB;YACnC,UAAU,EAAE,UAAU;SACvB,CAAC;QACF,MAAM,MAAM,GAAoB,IAAI,6BAAe,CACjD,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,EACtC,UAAU,CACX,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAtaD,sDAsaC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/client-interceptors.d.ts b/node_modules/@grpc/grpc-js/build/src/client-interceptors.d.ts deleted file mode 100644 index c9a383f8..00000000 --- a/node_modules/@grpc/grpc-js/build/src/client-interceptors.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { Metadata } from './metadata'; -import { Listener, MetadataListener, MessageListener, StatusListener, InterceptingListener, MessageContext } from './call-stream'; -import { Status } from './constants'; -import { Channel } from './channel'; -import { CallOptions } from './client'; -import { CallCredentials } from './call-credentials'; -import { ClientMethodDefinition } from './make-client'; -/** - * Error class associated with passing both interceptors and interceptor - * providers to a client constructor or as call options. - */ -export declare class InterceptorConfigurationError extends Error { - constructor(message: string); -} -export interface MetadataRequester { - (metadata: Metadata, listener: InterceptingListener, next: (metadata: Metadata, listener: InterceptingListener | Listener) => void): void; -} -export interface MessageRequester { - (message: any, next: (message: any) => void): void; -} -export interface CloseRequester { - (next: () => void): void; -} -export interface CancelRequester { - (next: () => void): void; -} -/** - * An object with methods for intercepting and modifying outgoing call operations. - */ -export interface FullRequester { - start: MetadataRequester; - sendMessage: MessageRequester; - halfClose: CloseRequester; - cancel: CancelRequester; -} -export declare type Requester = Partial; -export declare class ListenerBuilder { - private metadata; - private message; - private status; - withOnReceiveMetadata(onReceiveMetadata: MetadataListener): this; - withOnReceiveMessage(onReceiveMessage: MessageListener): this; - withOnReceiveStatus(onReceiveStatus: StatusListener): this; - build(): Listener; -} -export declare class RequesterBuilder { - private start; - private message; - private halfClose; - private cancel; - withStart(start: MetadataRequester): this; - withSendMessage(sendMessage: MessageRequester): this; - withHalfClose(halfClose: CloseRequester): this; - withCancel(cancel: CancelRequester): this; - build(): Requester; -} -export interface InterceptorOptions extends CallOptions { - method_definition: ClientMethodDefinition; -} -export interface InterceptingCallInterface { - cancelWithStatus(status: Status, details: string): void; - getPeer(): string; - start(metadata: Metadata, listener?: Partial): void; - sendMessageWithContext(context: MessageContext, message: any): void; - sendMessage(message: any): void; - startRead(): void; - halfClose(): void; - setCredentials(credentials: CallCredentials): void; -} -export declare class InterceptingCall implements InterceptingCallInterface { - private nextCall; - /** - * The requester that this InterceptingCall uses to modify outgoing operations - */ - private requester; - /** - * Indicates that a message has been passed to the listener's onReceiveMessage - * method it has not been passed to the corresponding next callback - */ - private processingMessage; - /** - * Indicates that a status was received but could not be propagated because - * a message was still being processed. - */ - private pendingHalfClose; - constructor(nextCall: InterceptingCallInterface, requester?: Requester); - cancelWithStatus(status: Status, details: string): void; - getPeer(): string; - start(metadata: Metadata, interceptingListener?: Partial): void; - sendMessageWithContext(context: MessageContext, message: any): void; - sendMessage(message: any): void; - startRead(): void; - halfClose(): void; - setCredentials(credentials: CallCredentials): void; -} -export interface NextCall { - (options: InterceptorOptions): InterceptingCallInterface; -} -export interface Interceptor { - (options: InterceptorOptions, nextCall: NextCall): InterceptingCall; -} -export interface InterceptorProvider { - (methodDefinition: ClientMethodDefinition): Interceptor; -} -export interface InterceptorArguments { - clientInterceptors: Interceptor[]; - clientInterceptorProviders: InterceptorProvider[]; - callInterceptors: Interceptor[]; - callInterceptorProviders: InterceptorProvider[]; -} -export declare function getInterceptingCall(interceptorArgs: InterceptorArguments, methodDefinition: ClientMethodDefinition, options: CallOptions, channel: Channel): InterceptingCallInterface; diff --git a/node_modules/@grpc/grpc-js/build/src/client-interceptors.js b/node_modules/@grpc/grpc-js/build/src/client-interceptors.js deleted file mode 100644 index d1420da2..00000000 --- a/node_modules/@grpc/grpc-js/build/src/client-interceptors.js +++ /dev/null @@ -1,402 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getInterceptingCall = exports.InterceptingCall = exports.RequesterBuilder = exports.ListenerBuilder = exports.InterceptorConfigurationError = void 0; -const metadata_1 = require("./metadata"); -const call_stream_1 = require("./call-stream"); -const constants_1 = require("./constants"); -/** - * Error class associated with passing both interceptors and interceptor - * providers to a client constructor or as call options. - */ -class InterceptorConfigurationError extends Error { - constructor(message) { - super(message); - this.name = 'InterceptorConfigurationError'; - Error.captureStackTrace(this, InterceptorConfigurationError); - } -} -exports.InterceptorConfigurationError = InterceptorConfigurationError; -class ListenerBuilder { - constructor() { - this.metadata = undefined; - this.message = undefined; - this.status = undefined; - } - withOnReceiveMetadata(onReceiveMetadata) { - this.metadata = onReceiveMetadata; - return this; - } - withOnReceiveMessage(onReceiveMessage) { - this.message = onReceiveMessage; - return this; - } - withOnReceiveStatus(onReceiveStatus) { - this.status = onReceiveStatus; - return this; - } - build() { - return { - onReceiveMetadata: this.metadata, - onReceiveMessage: this.message, - onReceiveStatus: this.status, - }; - } -} -exports.ListenerBuilder = ListenerBuilder; -class RequesterBuilder { - constructor() { - this.start = undefined; - this.message = undefined; - this.halfClose = undefined; - this.cancel = undefined; - } - withStart(start) { - this.start = start; - return this; - } - withSendMessage(sendMessage) { - this.message = sendMessage; - return this; - } - withHalfClose(halfClose) { - this.halfClose = halfClose; - return this; - } - withCancel(cancel) { - this.cancel = cancel; - return this; - } - build() { - return { - start: this.start, - sendMessage: this.message, - halfClose: this.halfClose, - cancel: this.cancel, - }; - } -} -exports.RequesterBuilder = RequesterBuilder; -/** - * A Listener with a default pass-through implementation of each method. Used - * for filling out Listeners with some methods omitted. - */ -const defaultListener = { - onReceiveMetadata: (metadata, next) => { - next(metadata); - }, - onReceiveMessage: (message, next) => { - next(message); - }, - onReceiveStatus: (status, next) => { - next(status); - }, -}; -/** - * A Requester with a default pass-through implementation of each method. Used - * for filling out Requesters with some methods omitted. - */ -const defaultRequester = { - start: (metadata, listener, next) => { - next(metadata, listener); - }, - sendMessage: (message, next) => { - next(message); - }, - halfClose: (next) => { - next(); - }, - cancel: (next) => { - next(); - }, -}; -class InterceptingCall { - constructor(nextCall, requester) { - var _a, _b, _c, _d; - this.nextCall = nextCall; - /** - * Indicates that a message has been passed to the listener's onReceiveMessage - * method it has not been passed to the corresponding next callback - */ - this.processingMessage = false; - /** - * Indicates that a status was received but could not be propagated because - * a message was still being processed. - */ - this.pendingHalfClose = false; - if (requester) { - this.requester = { - start: (_a = requester.start) !== null && _a !== void 0 ? _a : defaultRequester.start, - sendMessage: (_b = requester.sendMessage) !== null && _b !== void 0 ? _b : defaultRequester.sendMessage, - halfClose: (_c = requester.halfClose) !== null && _c !== void 0 ? _c : defaultRequester.halfClose, - cancel: (_d = requester.cancel) !== null && _d !== void 0 ? _d : defaultRequester.cancel, - }; - } - else { - this.requester = defaultRequester; - } - } - cancelWithStatus(status, details) { - this.requester.cancel(() => { - this.nextCall.cancelWithStatus(status, details); - }); - } - getPeer() { - return this.nextCall.getPeer(); - } - start(metadata, interceptingListener) { - var _a, _b, _c, _d, _e, _f; - const fullInterceptingListener = { - onReceiveMetadata: (_b = (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMetadata) === null || _a === void 0 ? void 0 : _a.bind(interceptingListener)) !== null && _b !== void 0 ? _b : ((metadata) => { }), - onReceiveMessage: (_d = (_c = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMessage) === null || _c === void 0 ? void 0 : _c.bind(interceptingListener)) !== null && _d !== void 0 ? _d : ((message) => { }), - onReceiveStatus: (_f = (_e = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveStatus) === null || _e === void 0 ? void 0 : _e.bind(interceptingListener)) !== null && _f !== void 0 ? _f : ((status) => { }), - }; - this.requester.start(metadata, fullInterceptingListener, (md, listener) => { - var _a, _b, _c; - let finalInterceptingListener; - if (call_stream_1.isInterceptingListener(listener)) { - finalInterceptingListener = listener; - } - else { - const fullListener = { - onReceiveMetadata: (_a = listener.onReceiveMetadata) !== null && _a !== void 0 ? _a : defaultListener.onReceiveMetadata, - onReceiveMessage: (_b = listener.onReceiveMessage) !== null && _b !== void 0 ? _b : defaultListener.onReceiveMessage, - onReceiveStatus: (_c = listener.onReceiveStatus) !== null && _c !== void 0 ? _c : defaultListener.onReceiveStatus, - }; - finalInterceptingListener = new call_stream_1.InterceptingListenerImpl(fullListener, fullInterceptingListener); - } - this.nextCall.start(md, finalInterceptingListener); - }); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessageWithContext(context, message) { - this.processingMessage = true; - this.requester.sendMessage(message, (finalMessage) => { - this.processingMessage = false; - this.nextCall.sendMessageWithContext(context, finalMessage); - if (this.pendingHalfClose) { - this.nextCall.halfClose(); - } - }); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessage(message) { - this.sendMessageWithContext({}, message); - } - startRead() { - this.nextCall.startRead(); - } - halfClose() { - this.requester.halfClose(() => { - if (this.processingMessage) { - this.pendingHalfClose = true; - } - else { - this.nextCall.halfClose(); - } - }); - } - setCredentials(credentials) { - this.nextCall.setCredentials(credentials); - } -} -exports.InterceptingCall = InterceptingCall; -function getCall(channel, path, options) { - var _a, _b; - const deadline = (_a = options.deadline) !== null && _a !== void 0 ? _a : Infinity; - const host = options.host; - const parent = (_b = options.parent) !== null && _b !== void 0 ? _b : null; - const propagateFlags = options.propagate_flags; - const credentials = options.credentials; - const call = channel.createCall(path, deadline, host, parent, propagateFlags); - if (credentials) { - call.setCredentials(credentials); - } - return call; -} -/** - * InterceptingCall implementation that directly owns the underlying Call - * object and handles serialization and deseraizliation. - */ -class BaseInterceptingCall { - constructor(call, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - methodDefinition) { - this.call = call; - this.methodDefinition = methodDefinition; - } - cancelWithStatus(status, details) { - this.call.cancelWithStatus(status, details); - } - getPeer() { - return this.call.getPeer(); - } - setCredentials(credentials) { - this.call.setCredentials(credentials); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessageWithContext(context, message) { - let serialized; - try { - serialized = this.methodDefinition.requestSerialize(message); - this.call.sendMessageWithContext(context, serialized); - } - catch (e) { - this.call.cancelWithStatus(constants_1.Status.INTERNAL, `Request message serialization failure: ${e.message}`); - } - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessage(message) { - this.sendMessageWithContext({}, message); - } - start(metadata, interceptingListener) { - let readError = null; - this.call.start(metadata, { - onReceiveMetadata: (metadata) => { - var _a; - (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMetadata) === null || _a === void 0 ? void 0 : _a.call(interceptingListener, metadata); - }, - onReceiveMessage: (message) => { - var _a; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let deserialized; - try { - deserialized = this.methodDefinition.responseDeserialize(message); - (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMessage) === null || _a === void 0 ? void 0 : _a.call(interceptingListener, deserialized); - } - catch (e) { - readError = { - code: constants_1.Status.INTERNAL, - details: `Response message parsing error: ${e.message}`, - metadata: new metadata_1.Metadata(), - }; - this.call.cancelWithStatus(readError.code, readError.details); - } - }, - onReceiveStatus: (status) => { - var _a, _b; - if (readError) { - (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveStatus) === null || _a === void 0 ? void 0 : _a.call(interceptingListener, readError); - } - else { - (_b = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveStatus) === null || _b === void 0 ? void 0 : _b.call(interceptingListener, status); - } - }, - }); - } - startRead() { - this.call.startRead(); - } - halfClose() { - this.call.halfClose(); - } -} -/** - * BaseInterceptingCall with special-cased behavior for methods with unary - * responses. - */ -class BaseUnaryInterceptingCall extends BaseInterceptingCall { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - constructor(call, methodDefinition) { - super(call, methodDefinition); - } - start(metadata, listener) { - var _a, _b; - let receivedMessage = false; - const wrapperListener = { - onReceiveMetadata: (_b = (_a = listener === null || listener === void 0 ? void 0 : listener.onReceiveMetadata) === null || _a === void 0 ? void 0 : _a.bind(listener)) !== null && _b !== void 0 ? _b : ((metadata) => { }), - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage: (message) => { - var _a; - receivedMessage = true; - (_a = listener === null || listener === void 0 ? void 0 : listener.onReceiveMessage) === null || _a === void 0 ? void 0 : _a.call(listener, message); - }, - onReceiveStatus: (status) => { - var _a, _b; - if (!receivedMessage) { - (_a = listener === null || listener === void 0 ? void 0 : listener.onReceiveMessage) === null || _a === void 0 ? void 0 : _a.call(listener, null); - } - (_b = listener === null || listener === void 0 ? void 0 : listener.onReceiveStatus) === null || _b === void 0 ? void 0 : _b.call(listener, status); - }, - }; - super.start(metadata, wrapperListener); - this.call.startRead(); - } -} -/** - * BaseInterceptingCall with special-cased behavior for methods with streaming - * responses. - */ -class BaseStreamingInterceptingCall extends BaseInterceptingCall { -} -function getBottomInterceptingCall(channel, options, -// eslint-disable-next-line @typescript-eslint/no-explicit-any -methodDefinition) { - const call = getCall(channel, methodDefinition.path, options); - if (methodDefinition.responseStream) { - return new BaseStreamingInterceptingCall(call, methodDefinition); - } - else { - return new BaseUnaryInterceptingCall(call, methodDefinition); - } -} -function getInterceptingCall(interceptorArgs, -// eslint-disable-next-line @typescript-eslint/no-explicit-any -methodDefinition, options, channel) { - if (interceptorArgs.clientInterceptors.length > 0 && - interceptorArgs.clientInterceptorProviders.length > 0) { - throw new InterceptorConfigurationError('Both interceptors and interceptor_providers were passed as options ' + - 'to the client constructor. Only one of these is allowed.'); - } - if (interceptorArgs.callInterceptors.length > 0 && - interceptorArgs.callInterceptorProviders.length > 0) { - throw new InterceptorConfigurationError('Both interceptors and interceptor_providers were passed as call ' + - 'options. Only one of these is allowed.'); - } - let interceptors = []; - // Interceptors passed to the call override interceptors passed to the client constructor - if (interceptorArgs.callInterceptors.length > 0 || - interceptorArgs.callInterceptorProviders.length > 0) { - interceptors = [] - .concat(interceptorArgs.callInterceptors, interceptorArgs.callInterceptorProviders.map((provider) => provider(methodDefinition))) - .filter((interceptor) => interceptor); - // Filter out falsy values when providers return nothing - } - else { - interceptors = [] - .concat(interceptorArgs.clientInterceptors, interceptorArgs.clientInterceptorProviders.map((provider) => provider(methodDefinition))) - .filter((interceptor) => interceptor); - // Filter out falsy values when providers return nothing - } - const interceptorOptions = Object.assign({}, options, { - method_definition: methodDefinition, - }); - /* For each interceptor in the list, the nextCall function passed to it is - * based on the next interceptor in the list, using a nextCall function - * constructed with the following interceptor in the list, and so on. The - * initialValue, which is effectively at the end of the list, is a nextCall - * function that invokes getBottomInterceptingCall, the result of which - * handles (de)serialization and also gets the underlying call from the - * channel. */ - const getCall = interceptors.reduceRight((nextCall, nextInterceptor) => { - return (currentOptions) => nextInterceptor(currentOptions, nextCall); - }, (finalOptions) => getBottomInterceptingCall(channel, finalOptions, methodDefinition)); - return getCall(interceptorOptions); -} -exports.getInterceptingCall = getInterceptingCall; -//# sourceMappingURL=client-interceptors.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/client-interceptors.js.map b/node_modules/@grpc/grpc-js/build/src/client-interceptors.js.map deleted file mode 100644 index c3d86aec..00000000 --- a/node_modules/@grpc/grpc-js/build/src/client-interceptors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-interceptors.js","sourceRoot":"","sources":["../../src/client-interceptors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yCAAsC;AACtC,+CAYuB;AACvB,2CAAqC;AAMrC;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;IAC/D,CAAC;CACF;AAND,sEAMC;AAsCD,MAAa,eAAe;IAA5B;QACU,aAAQ,GAAiC,SAAS,CAAC;QACnD,YAAO,GAAgC,SAAS,CAAC;QACjD,WAAM,GAA+B,SAAS,CAAC;IAwBzD,CAAC;IAtBC,qBAAqB,CAAC,iBAAmC;QACvD,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB,CAAC,gBAAiC;QACpD,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mBAAmB,CAAC,eAA+B;QACjD,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO;YACL,iB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B,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxD,QAAQ,CAAC,gBAAgB,CAAC,CAC3B,CACF;aACA,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;QACxC,wDAAwD;KACzD;SAAM;QACL,YAAY,GAAI,EAAoB;aACjC,MAAM,CACL,eAAe,CAAC,kBAAkB,EAClC,eAAe,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1D,QAAQ,CAAC,gBAAgB,CAAC,CAC3B,CACF;aACA,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;QACxC,wDAAwD;KACzD;IACD,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;QACpD,iBAAiB,EAAE,gBAAgB;KACpC,CAAC,CAAC;IACH;;;;;;kBAMc;IACd,MAAM,OAAO,GAAa,YAAY,CAAC,WAAW,CAChD,CAAC,QAAkB,EAAE,eAA4B,EAAE,EAAE;QACnD,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,eAAe,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAC,EACD,CAAC,YAAgC,EAAE,EAAE,CACnC,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,gBAAgB,CAAC,CACrE,CAAC;IACF,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACrC,CAAC;AArED,kDAqEC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/client.d.ts b/node_modules/@grpc/grpc-js/build/src/client.d.ts deleted file mode 100644 index 8b2a5e20..00000000 --- a/node_modules/@grpc/grpc-js/build/src/client.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/// -import { ClientDuplexStream, ClientReadableStream, ClientUnaryCall, ClientWritableStream, ServiceError, SurfaceCall } from './call'; -import { CallCredentials } from './call-credentials'; -import { Deadline } from './call-stream'; -import { Channel } from './channel'; -import { ChannelCredentials } from './channel-credentials'; -import { ChannelOptions } from './channel-options'; -import { Metadata } from './metadata'; -import { ClientMethodDefinition } from './make-client'; -import { Interceptor, InterceptorProvider } from './client-interceptors'; -import { ServerUnaryCall, ServerReadableStream, ServerWritableStream, ServerDuplexStream } from './server-call'; -declare const CHANNEL_SYMBOL: unique symbol; -declare const INTERCEPTOR_SYMBOL: unique symbol; -declare const INTERCEPTOR_PROVIDER_SYMBOL: unique symbol; -declare const CALL_INVOCATION_TRANSFORMER_SYMBOL: unique symbol; -export interface UnaryCallback { - (err: ServiceError | null, value?: ResponseType): void; -} -export interface CallOptions { - deadline?: Deadline; - host?: string; - parent?: ServerUnaryCall | ServerReadableStream | ServerWritableStream | ServerDuplexStream; - propagate_flags?: number; - credentials?: CallCredentials; - interceptors?: Interceptor[]; - interceptor_providers?: InterceptorProvider[]; -} -export interface CallProperties { - argument?: RequestType; - metadata: Metadata; - call: SurfaceCall; - channel: Channel; - methodDefinition: ClientMethodDefinition; - callOptions: CallOptions; - callback?: UnaryCallback; -} -export interface CallInvocationTransformer { - (callProperties: CallProperties): CallProperties; -} -export declare type ClientOptions = Partial & { - channelOverride?: Channel; - channelFactoryOverride?: (address: string, credentials: ChannelCredentials, options: ClientOptions) => Channel; - interceptors?: Interceptor[]; - interceptor_providers?: InterceptorProvider[]; - callInvocationTransformer?: CallInvocationTransformer; -}; -/** - * A generic gRPC client. Primarily useful as a base class for all generated - * clients. - */ -export declare class Client { - private readonly [CHANNEL_SYMBOL]; - private readonly [INTERCEPTOR_SYMBOL]; - private readonly [INTERCEPTOR_PROVIDER_SYMBOL]; - private readonly [CALL_INVOCATION_TRANSFORMER_SYMBOL]?; - constructor(address: string, credentials: ChannelCredentials, options?: ClientOptions); - close(): void; - getChannel(): Channel; - waitForReady(deadline: Deadline, callback: (error?: Error) => void): void; - private checkOptionalUnaryResponseArguments; - makeUnaryRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, options: CallOptions, callback: UnaryCallback): ClientUnaryCall; - makeUnaryRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, callback: UnaryCallback): ClientUnaryCall; - makeUnaryRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, options: CallOptions, callback: UnaryCallback): ClientUnaryCall; - makeUnaryRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, callback: UnaryCallback): ClientUnaryCall; - makeClientStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, options: CallOptions, callback: UnaryCallback): ClientWritableStream; - makeClientStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, callback: UnaryCallback): ClientWritableStream; - makeClientStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, options: CallOptions, callback: UnaryCallback): ClientWritableStream; - makeClientStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, callback: UnaryCallback): ClientWritableStream; - private checkMetadataAndOptions; - makeServerStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, options?: CallOptions): ClientReadableStream; - makeServerStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, options?: CallOptions): ClientReadableStream; - makeBidiStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, options?: CallOptions): ClientDuplexStream; - makeBidiStreamRequest(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, options?: CallOptions): ClientDuplexStream; -} -export {}; diff --git a/node_modules/@grpc/grpc-js/build/src/client.js b/node_modules/@grpc/grpc-js/build/src/client.js deleted file mode 100644 index 93b70f20..00000000 --- a/node_modules/@grpc/grpc-js/build/src/client.js +++ /dev/null @@ -1,396 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Client = void 0; -const call_1 = require("./call"); -const channel_1 = require("./channel"); -const constants_1 = require("./constants"); -const metadata_1 = require("./metadata"); -const client_interceptors_1 = require("./client-interceptors"); -const CHANNEL_SYMBOL = Symbol(); -const INTERCEPTOR_SYMBOL = Symbol(); -const INTERCEPTOR_PROVIDER_SYMBOL = Symbol(); -const CALL_INVOCATION_TRANSFORMER_SYMBOL = Symbol(); -/** - * A generic gRPC client. Primarily useful as a base class for all generated - * clients. - */ -class Client { - constructor(address, credentials, options = {}) { - var _a, _b; - options = Object.assign({}, options); - this[INTERCEPTOR_SYMBOL] = (_a = options.interceptors) !== null && _a !== void 0 ? _a : []; - delete options.interceptors; - this[INTERCEPTOR_PROVIDER_SYMBOL] = (_b = options.interceptor_providers) !== null && _b !== void 0 ? _b : []; - delete options.interceptor_providers; - if (this[INTERCEPTOR_SYMBOL].length > 0 && - this[INTERCEPTOR_PROVIDER_SYMBOL].length > 0) { - throw new Error('Both interceptors and interceptor_providers were passed as options ' + - 'to the client constructor. Only one of these is allowed.'); - } - this[CALL_INVOCATION_TRANSFORMER_SYMBOL] = - options.callInvocationTransformer; - delete options.callInvocationTransformer; - if (options.channelOverride) { - this[CHANNEL_SYMBOL] = options.channelOverride; - } - else if (options.channelFactoryOverride) { - const channelFactoryOverride = options.channelFactoryOverride; - delete options.channelFactoryOverride; - this[CHANNEL_SYMBOL] = channelFactoryOverride(address, credentials, options); - } - else { - this[CHANNEL_SYMBOL] = new channel_1.ChannelImplementation(address, credentials, options); - } - } - close() { - this[CHANNEL_SYMBOL].close(); - } - getChannel() { - return this[CHANNEL_SYMBOL]; - } - waitForReady(deadline, callback) { - const checkState = (err) => { - if (err) { - callback(new Error('Failed to connect before the deadline')); - return; - } - let newState; - try { - newState = this[CHANNEL_SYMBOL].getConnectivityState(true); - } - catch (e) { - callback(new Error('The channel has been closed')); - return; - } - if (newState === channel_1.ConnectivityState.READY) { - callback(); - } - else { - try { - this[CHANNEL_SYMBOL].watchConnectivityState(newState, deadline, checkState); - } - catch (e) { - callback(new Error('The channel has been closed')); - } - } - }; - setImmediate(checkState); - } - checkOptionalUnaryResponseArguments(arg1, arg2, arg3) { - if (arg1 instanceof Function) { - return { metadata: new metadata_1.Metadata(), options: {}, callback: arg1 }; - } - else if (arg2 instanceof Function) { - if (arg1 instanceof metadata_1.Metadata) { - return { metadata: arg1, options: {}, callback: arg2 }; - } - else { - return { metadata: new metadata_1.Metadata(), options: arg1, callback: arg2 }; - } - } - else { - if (!(arg1 instanceof metadata_1.Metadata && - arg2 instanceof Object && - arg3 instanceof Function)) { - throw new Error('Incorrect arguments passed'); - } - return { metadata: arg1, options: arg2, callback: arg3 }; - } - } - makeUnaryRequest(method, serialize, deserialize, argument, metadata, options, callback) { - var _a, _b; - const checkedArguments = this.checkOptionalUnaryResponseArguments(metadata, options, callback); - const methodDefinition = { - path: method, - requestStream: false, - responseStream: false, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties = { - argument: argument, - metadata: checkedArguments.metadata, - call: new call_1.ClientUnaryCallImpl(), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - callback: checkedArguments.callback, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); - } - const emitter = callProperties.call; - const interceptorArgs = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], - callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], - }; - const call = client_interceptors_1.getInterceptingCall(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - emitter.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let responseMessage = null; - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata: (metadata) => { - emitter.emit('metadata', metadata); - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message) { - if (responseMessage !== null) { - call.cancelWithStatus(constants_1.Status.INTERNAL, 'Too many responses received'); - } - responseMessage = message; - }, - onReceiveStatus(status) { - if (receivedStatus) { - return; - } - receivedStatus = true; - if (status.code === constants_1.Status.OK) { - callProperties.callback(null, responseMessage); - } - else { - callProperties.callback(call_1.callErrorFromStatus(status)); - } - emitter.emit('status', status); - }, - }); - call.sendMessage(argument); - call.halfClose(); - return emitter; - } - makeClientStreamRequest(method, serialize, deserialize, metadata, options, callback) { - var _a, _b; - const checkedArguments = this.checkOptionalUnaryResponseArguments(metadata, options, callback); - const methodDefinition = { - path: method, - requestStream: true, - responseStream: false, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties = { - metadata: checkedArguments.metadata, - call: new call_1.ClientWritableStreamImpl(serialize), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - callback: checkedArguments.callback, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); - } - const emitter = callProperties.call; - const interceptorArgs = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], - callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], - }; - const call = client_interceptors_1.getInterceptingCall(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - emitter.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let responseMessage = null; - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata: (metadata) => { - emitter.emit('metadata', metadata); - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message) { - if (responseMessage !== null) { - call.cancelWithStatus(constants_1.Status.INTERNAL, 'Too many responses received'); - } - responseMessage = message; - }, - onReceiveStatus(status) { - if (receivedStatus) { - return; - } - receivedStatus = true; - if (status.code === constants_1.Status.OK) { - callProperties.callback(null, responseMessage); - } - else { - callProperties.callback(call_1.callErrorFromStatus(status)); - } - emitter.emit('status', status); - }, - }); - return emitter; - } - checkMetadataAndOptions(arg1, arg2) { - let metadata; - let options; - if (arg1 instanceof metadata_1.Metadata) { - metadata = arg1; - if (arg2) { - options = arg2; - } - else { - options = {}; - } - } - else { - if (arg1) { - options = arg1; - } - else { - options = {}; - } - metadata = new metadata_1.Metadata(); - } - return { metadata, options }; - } - makeServerStreamRequest(method, serialize, deserialize, argument, metadata, options) { - var _a, _b; - const checkedArguments = this.checkMetadataAndOptions(metadata, options); - const methodDefinition = { - path: method, - requestStream: false, - responseStream: true, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties = { - argument: argument, - metadata: checkedArguments.metadata, - call: new call_1.ClientReadableStreamImpl(deserialize), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); - } - const stream = callProperties.call; - const interceptorArgs = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], - callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], - }; - const call = client_interceptors_1.getInterceptingCall(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - stream.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata(metadata) { - stream.emit('metadata', metadata); - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message) { - stream.push(message); - }, - onReceiveStatus(status) { - if (receivedStatus) { - return; - } - receivedStatus = true; - stream.push(null); - if (status.code !== constants_1.Status.OK) { - stream.emit('error', call_1.callErrorFromStatus(status)); - } - stream.emit('status', status); - }, - }); - call.sendMessage(argument); - call.halfClose(); - return stream; - } - makeBidiStreamRequest(method, serialize, deserialize, metadata, options) { - var _a, _b; - const checkedArguments = this.checkMetadataAndOptions(metadata, options); - const methodDefinition = { - path: method, - requestStream: true, - responseStream: true, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties = { - metadata: checkedArguments.metadata, - call: new call_1.ClientDuplexStreamImpl(serialize, deserialize), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); - } - const stream = callProperties.call; - const interceptorArgs = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], - callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], - }; - const call = client_interceptors_1.getInterceptingCall(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - stream.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata(metadata) { - stream.emit('metadata', metadata); - }, - onReceiveMessage(message) { - stream.push(message); - }, - onReceiveStatus(status) { - if (receivedStatus) { - return; - } - receivedStatus = true; - stream.push(null); - if (status.code !== constants_1.Status.OK) { - stream.emit('error', call_1.callErrorFromStatus(status)); - } - stream.emit('status', status); - }, - }); - return stream; - } -} -exports.Client = Client; -//# sourceMappingURL=client.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/client.js.map b/node_modules/@grpc/grpc-js/build/src/client.js.map deleted file mode 100644 index dffc7b3a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/client.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,iCAYgB;AAGhB,uCAA8E;AAG9E,2CAAqC;AACrC,yCAAsC;AAEtC,+DAM+B;AAQ/B,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC;AAChC,MAAM,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AAQ,EAAE,MAAM,CAAC,CAAC;YAChC,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArjBD,wBAqjBC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/compression-filter.d.ts b/node_modules/@grpc/grpc-js/build/src/compression-filter.d.ts deleted file mode 100644 index 9fef493b..00000000 --- a/node_modules/@grpc/grpc-js/build/src/compression-filter.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// -import { Call, WriteObject } from './call-stream'; -import { Channel } from './channel'; -import { BaseFilter, Filter, FilterFactory } from './filter'; -import { Metadata } from './metadata'; -export declare class CompressionFilter extends BaseFilter implements Filter { - private sendCompression; - private receiveCompression; - sendMetadata(metadata: Promise): Promise; - receiveMetadata(metadata: Metadata): Metadata; - sendMessage(message: Promise): Promise; - receiveMessage(message: Promise): Promise; -} -export declare class CompressionFilterFactory implements FilterFactory { - private readonly channel; - constructor(channel: Channel); - createFilter(callStream: Call): CompressionFilter; -} diff --git a/node_modules/@grpc/grpc-js/build/src/compression-filter.js b/node_modules/@grpc/grpc-js/build/src/compression-filter.js deleted file mode 100644 index 8d49b4b0..00000000 --- a/node_modules/@grpc/grpc-js/build/src/compression-filter.js +++ /dev/null @@ -1,201 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CompressionFilterFactory = exports.CompressionFilter = void 0; -const zlib = require("zlib"); -const filter_1 = require("./filter"); -class CompressionHandler { - /** - * @param message Raw uncompressed message bytes - * @param compress Indicates whether the message should be compressed - * @return Framed message, compressed if applicable - */ - async writeMessage(message, compress) { - let messageBuffer = message; - if (compress) { - messageBuffer = await this.compressMessage(messageBuffer); - } - const output = Buffer.allocUnsafe(messageBuffer.length + 5); - output.writeUInt8(compress ? 1 : 0, 0); - output.writeUInt32BE(messageBuffer.length, 1); - messageBuffer.copy(output, 5); - return output; - } - /** - * @param data Framed message, possibly compressed - * @return Uncompressed message - */ - async readMessage(data) { - const compressed = data.readUInt8(0) === 1; - let messageBuffer = data.slice(5); - if (compressed) { - messageBuffer = await this.decompressMessage(messageBuffer); - } - return messageBuffer; - } -} -class IdentityHandler extends CompressionHandler { - async compressMessage(message) { - return message; - } - async writeMessage(message, compress) { - const output = Buffer.allocUnsafe(message.length + 5); - /* With "identity" compression, messages should always be marked as - * uncompressed */ - output.writeUInt8(0, 0); - output.writeUInt32BE(message.length, 1); - message.copy(output, 5); - return output; - } - decompressMessage(message) { - return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity')); - } -} -class DeflateHandler extends CompressionHandler { - compressMessage(message) { - return new Promise((resolve, reject) => { - zlib.deflate(message, (err, output) => { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - decompressMessage(message) { - return new Promise((resolve, reject) => { - zlib.inflate(message, (err, output) => { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } -} -class GzipHandler extends CompressionHandler { - compressMessage(message) { - return new Promise((resolve, reject) => { - zlib.gzip(message, (err, output) => { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - decompressMessage(message) { - return new Promise((resolve, reject) => { - zlib.unzip(message, (err, output) => { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } -} -class UnknownHandler extends CompressionHandler { - constructor(compressionName) { - super(); - this.compressionName = compressionName; - } - compressMessage(message) { - return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`)); - } - decompressMessage(message) { - // This should be unreachable - return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`)); - } -} -function getCompressionHandler(compressionName) { - switch (compressionName) { - case 'identity': - return new IdentityHandler(); - case 'deflate': - return new DeflateHandler(); - case 'gzip': - return new GzipHandler(); - default: - return new UnknownHandler(compressionName); - } -} -class CompressionFilter extends filter_1.BaseFilter { - constructor() { - super(...arguments); - this.sendCompression = new IdentityHandler(); - this.receiveCompression = new IdentityHandler(); - } - async sendMetadata(metadata) { - const headers = await metadata; - headers.set('grpc-accept-encoding', 'identity,deflate,gzip'); - headers.set('accept-encoding', 'identity,gzip'); - return headers; - } - receiveMetadata(metadata) { - const receiveEncoding = metadata.get('grpc-encoding'); - if (receiveEncoding.length > 0) { - const encoding = receiveEncoding[0]; - if (typeof encoding === 'string') { - this.receiveCompression = getCompressionHandler(encoding); - } - } - metadata.remove('grpc-encoding'); - metadata.remove('grpc-accept-encoding'); - return metadata; - } - async sendMessage(message) { - /* This filter is special. The input message is the bare message bytes, - * and the output is a framed and possibly compressed message. For this - * reason, this filter should be at the bottom of the filter stack */ - const resolvedMessage = await message; - const compress = resolvedMessage.flags === undefined - ? false - : (resolvedMessage.flags & 2 /* NoCompress */) === 0; - return { - message: await this.sendCompression.writeMessage(resolvedMessage.message, compress), - flags: resolvedMessage.flags, - }; - } - async receiveMessage(message) { - /* This filter is also special. The input message is framed and possibly - * compressed, and the output message is deframed and uncompressed. So - * this is another reason that this filter should be at the bottom of the - * filter stack. */ - return this.receiveCompression.readMessage(await message); - } -} -exports.CompressionFilter = CompressionFilter; -class CompressionFilterFactory { - constructor(channel) { - this.channel = channel; - } - createFilter(callStream) { - return new CompressionFilter(); - } -} -exports.CompressionFilterFactory = CompressionFilterFactory; -//# sourceMappingURL=compression-filter.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/compression-filter.js.map b/node_modules/@grpc/grpc-js/build/src/compression-filter.js.map deleted file mode 100644 index a6102bdc..00000000 --- a/node_modules/@grpc/grpc-js/build/src/compression-filter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"compression-filter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;QAC5D,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,eAAe,CAAC,YAAY,CAC9C,eAAe,CAAC,OAAO,EACvB,QAAQ,CACT;YACD,KAAK,EAAE,eAAe,CAAC,KAAK;SAC7B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAwB;QAC3C;;;2BAGmB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,MAAM,OAAO,CAAC,CAAC;IAC5D,CAAC;CACF;AAhDD,8CAgDC;AAED,MAAa,wBAAwB;IAEnC,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IACjD,YAAY,CAAC,UAAgB;QAC3B,OAAO,IAAI,iBAAiB,EAAE,CAAC;IACjC,CAAC;CACF;AAND,4DAMC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/constants.d.ts b/node_modules/@grpc/grpc-js/build/src/constants.d.ts deleted file mode 100644 index 99900849..00000000 --- a/node_modules/@grpc/grpc-js/build/src/constants.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -export declare enum Status { - OK = 0, - CANCELLED = 1, - UNKNOWN = 2, - INVALID_ARGUMENT = 3, - DEADLINE_EXCEEDED = 4, - NOT_FOUND = 5, - ALREADY_EXISTS = 6, - PERMISSION_DENIED = 7, - RESOURCE_EXHAUSTED = 8, - FAILED_PRECONDITION = 9, - ABORTED = 10, - OUT_OF_RANGE = 11, - UNIMPLEMENTED = 12, - INTERNAL = 13, - UNAVAILABLE = 14, - DATA_LOSS = 15, - UNAUTHENTICATED = 16 -} -export declare enum LogVerbosity { - DEBUG = 0, - INFO = 1, - ERROR = 2 -} -/** - * NOTE: This enum is not currently used in any implemented API in this - * library. It is included only for type parity with the other implementation. - */ -export declare enum Propagate { - DEADLINE = 1, - CENSUS_STATS_CONTEXT = 2, - CENSUS_TRACING_CONTEXT = 4, - CANCELLATION = 8, - DEFAULTS = 65535 -} -export declare const DEFAULT_MAX_SEND_MESSAGE_LENGTH = -1; -export declare const DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH: number; diff --git a/node_modules/@grpc/grpc-js/build/src/constants.js b/node_modules/@grpc/grpc-js/build/src/constants.js deleted file mode 100644 index 499c0f9f..00000000 --- a/node_modules/@grpc/grpc-js/build/src/constants.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH = exports.DEFAULT_MAX_SEND_MESSAGE_LENGTH = exports.Propagate = exports.LogVerbosity = exports.Status = void 0; -var Status; -(function (Status) { - Status[Status["OK"] = 0] = "OK"; - Status[Status["CANCELLED"] = 1] = "CANCELLED"; - Status[Status["UNKNOWN"] = 2] = "UNKNOWN"; - Status[Status["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT"; - Status[Status["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED"; - Status[Status["NOT_FOUND"] = 5] = "NOT_FOUND"; - Status[Status["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS"; - Status[Status["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED"; - Status[Status["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED"; - Status[Status["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION"; - Status[Status["ABORTED"] = 10] = "ABORTED"; - Status[Status["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE"; - Status[Status["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED"; - Status[Status["INTERNAL"] = 13] = "INTERNAL"; - Status[Status["UNAVAILABLE"] = 14] = "UNAVAILABLE"; - Status[Status["DATA_LOSS"] = 15] = "DATA_LOSS"; - Status[Status["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED"; -})(Status = exports.Status || (exports.Status = {})); -var LogVerbosity; -(function (LogVerbosity) { - LogVerbosity[LogVerbosity["DEBUG"] = 0] = "DEBUG"; - LogVerbosity[LogVerbosity["INFO"] = 1] = "INFO"; - LogVerbosity[LogVerbosity["ERROR"] = 2] = "ERROR"; -})(LogVerbosity = exports.LogVerbosity || (exports.LogVerbosity = {})); -/** - * NOTE: This enum is not currently used in any implemented API in this - * library. It is included only for type parity with the other implementation. - */ -var Propagate; -(function (Propagate) { - Propagate[Propagate["DEADLINE"] = 1] = "DEADLINE"; - Propagate[Propagate["CENSUS_STATS_CONTEXT"] = 2] = "CENSUS_STATS_CONTEXT"; - Propagate[Propagate["CENSUS_TRACING_CONTEXT"] = 4] = "CENSUS_TRACING_CONTEXT"; - Propagate[Propagate["CANCELLATION"] = 8] = "CANCELLATION"; - // https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/propagation_bits.h#L43 - Propagate[Propagate["DEFAULTS"] = 65535] = "DEFAULTS"; -})(Propagate = exports.Propagate || (exports.Propagate = {})); -// -1 means unlimited -exports.DEFAULT_MAX_SEND_MESSAGE_LENGTH = -1; -// 4 MB default -exports.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH = 4 * 1024 * 1024; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/constants.js.map b/node_modules/@grpc/grpc-js/build/src/constants.js.map deleted file mode 100644 index d7255305..00000000 --- a/node_modules/@grpc/grpc-js/build/src/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,IAAY,MAkBX;AAlBD,WAAY,MAAM;IAChB,+BAAM,CAAA;IACN,6CAAS,CAAA;IACT,yCAAO,CAAA;IACP,2DAAgB,CAAA;IAChB,6DAAiB,CAAA;IACjB,6CAAS,CAAA;IACT,uDAAc,CAAA;IACd,6DAAiB,CAAA;IACjB,+DAAkB,CAAA;IAClB,iEAAmB,CAAA;IACnB,0CAAO,CAAA;IACP,oDAAY,CAAA;IACZ,sDAAa,CAAA;IACb,4CAAQ,CAAA;IACR,kDAAW,CAAA;IACX,8CAAS,CAAA;IACT,0DAAe,CAAA;AACjB,CAAC,EAlBW,MAAM,GAAN,cAAM,KAAN,cAAM,QAkBjB;AAED,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iDAAS,CAAA;IACT,+CAAI,CAAA;IACJ,iDAAK,CAAA;AACP,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED;;;GAGG;AACH,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,iDAAY,CAAA;IACZ,yEAAwB,CAAA;IACxB,6EAA0B,CAAA;IAC1B,yDAAgB,CAAA;IAChB,4FAA4F;IAC5F,qDAAmI,CAAA;AACrI,CAAC,EAPW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAOpB;AAED,qBAAqB;AACR,QAAA,+BAA+B,GAAG,CAAC,CAAC,CAAC;AAElD,eAAe;AACF,QAAA,kCAAkC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/deadline-filter.d.ts b/node_modules/@grpc/grpc-js/build/src/deadline-filter.d.ts deleted file mode 100644 index a40102e5..00000000 --- a/node_modules/@grpc/grpc-js/build/src/deadline-filter.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Call, StatusObject } from './call-stream'; -import { Channel } from './channel'; -import { BaseFilter, Filter, FilterFactory } from './filter'; -import { Metadata } from './metadata'; -export declare class DeadlineFilter extends BaseFilter implements Filter { - private readonly channel; - private readonly callStream; - private timer; - private deadline; - constructor(channel: Channel, callStream: Call); - sendMetadata(metadata: Promise): Promise; - receiveTrailers(status: StatusObject): StatusObject; -} -export declare class DeadlineFilterFactory implements FilterFactory { - private readonly channel; - constructor(channel: Channel); - createFilter(callStream: Call): DeadlineFilter; -} diff --git a/node_modules/@grpc/grpc-js/build/src/deadline-filter.js b/node_modules/@grpc/grpc-js/build/src/deadline-filter.js deleted file mode 100644 index 56338d76..00000000 --- a/node_modules/@grpc/grpc-js/build/src/deadline-filter.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DeadlineFilterFactory = exports.DeadlineFilter = void 0; -const constants_1 = require("./constants"); -const filter_1 = require("./filter"); -const units = [ - ['m', 1], - ['S', 1000], - ['M', 60 * 1000], - ['H', 60 * 60 * 1000], -]; -function getDeadline(deadline) { - const now = new Date().getTime(); - const timeoutMs = Math.max(deadline - now, 0); - for (const [unit, factor] of units) { - const amount = timeoutMs / factor; - if (amount < 1e8) { - return String(Math.ceil(amount)) + unit; - } - } - throw new Error('Deadline is too far in the future'); -} -class DeadlineFilter extends filter_1.BaseFilter { - constructor(channel, callStream) { - var _a, _b; - super(); - this.channel = channel; - this.callStream = callStream; - this.timer = null; - const callDeadline = callStream.getDeadline(); - if (callDeadline instanceof Date) { - this.deadline = callDeadline.getTime(); - } - else { - this.deadline = callDeadline; - } - const now = new Date().getTime(); - let timeout = this.deadline - now; - if (timeout < 0) { - timeout = 0; - } - if (this.deadline !== Infinity) { - this.timer = setTimeout(() => { - callStream.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED, 'Deadline exceeded'); - }, timeout); - (_b = (_a = this.timer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); - } - } - async sendMetadata(metadata) { - if (this.deadline === Infinity) { - return metadata; - } - /* The input metadata promise depends on the original channel.connect() - * promise, so when it is complete that implies that the channel is - * connected */ - const finalMetadata = await metadata; - const timeoutString = getDeadline(this.deadline); - finalMetadata.set('grpc-timeout', timeoutString); - return finalMetadata; - } - receiveTrailers(status) { - if (this.timer) { - clearTimeout(this.timer); - } - return status; - } -} -exports.DeadlineFilter = DeadlineFilter; -class DeadlineFilterFactory { - constructor(channel) { - this.channel = channel; - } - createFilter(callStream) { - return new DeadlineFilter(this.channel, callStream); - } -} -exports.DeadlineFilterFactory = DeadlineFilterFactory; -//# sourceMappingURL=deadline-filter.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/deadline-filter.js.map b/node_modules/@grpc/grpc-js/build/src/deadline-filter.js.map deleted file mode 100644 index dca3f46f..00000000 --- a/node_modules/@grpc/grpc-js/build/src/deadline-filter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"deadline-filter.js","sourceRoot":"","sources":["../../src/deadline-filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,2CAAqC;AACrC,qCAA6D;AAG7D,MAAM,KAAK,GAA4B;IACrC,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;IAChB,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,SAAS,WAAW,CAAC,QAAgB;IACnC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,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AED,KAAK,CAAC,YAAY,CAAC,QAA2B;QAC5C,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC9B,OAAO,QAAQ,CAAC;SACjB;QACD;;uBAEe;QACf,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC;QACrC,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;QACjD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,eAAe,CAAC,MAAoB;QAClC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjDD,wCAiDC;AAED,MAAa,qBAAqB;IAChC,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,YAAY,CAAC,UAAgB;QAC3B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;CACF;AAND,sDAMC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/events.d.ts b/node_modules/@grpc/grpc-js/build/src/events.d.ts deleted file mode 100644 index d1a764e5..00000000 --- a/node_modules/@grpc/grpc-js/build/src/events.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface EmitterAugmentation1 { - addListener(event: Name, listener: (arg1: Arg) => void): this; - emit(event: Name, arg1: Arg): boolean; - on(event: Name, listener: (arg1: Arg) => void): this; - once(event: Name, listener: (arg1: Arg) => void): this; - prependListener(event: Name, listener: (arg1: Arg) => void): this; - prependOnceListener(event: Name, listener: (arg1: Arg) => void): this; - removeListener(event: Name, listener: (arg1: Arg) => void): this; -} diff --git a/node_modules/@grpc/grpc-js/build/src/events.js b/node_modules/@grpc/grpc-js/build/src/events.js deleted file mode 100644 index 082ed9bf..00000000 --- a/node_modules/@grpc/grpc-js/build/src/events.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/events.js.map b/node_modules/@grpc/grpc-js/build/src/events.js.map deleted file mode 100644 index ba39b5d6..00000000 --- a/node_modules/@grpc/grpc-js/build/src/events.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/experimental.d.ts b/node_modules/@grpc/grpc-js/build/src/experimental.d.ts deleted file mode 100644 index 28407a5c..00000000 --- a/node_modules/@grpc/grpc-js/build/src/experimental.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export { trace } from './logging'; -export { Resolver, ResolverListener, registerResolver } from './resolver'; -export { GrpcUri, uriToString } from './uri-parser'; -export { ServiceConfig } from './service-config'; -export { createGoogleDefaultCredentials } from './channel-credentials'; -export { BackoffTimeout } from './backoff-timeout'; -export { LoadBalancer, LoadBalancingConfig, ChannelControlHelper, registerLoadBalancerType, getFirstUsableConfig, validateLoadBalancingConfig } from './load-balancer'; -export { SubchannelAddress, subchannelAddressToString } from './subchannel'; -export { ChildLoadBalancerHandler } from './load-balancer-child-handler'; -export { Picker, UnavailablePicker, QueuePicker, PickResult, PickArgs, PickResultType } from './picker'; -export { Call as CallStream } from './call-stream'; -export { Filter, BaseFilter, FilterFactory } from './filter'; -export { FilterStackFactory } from './filter-stack'; diff --git a/node_modules/@grpc/grpc-js/build/src/experimental.js b/node_modules/@grpc/grpc-js/build/src/experimental.js deleted file mode 100644 index 200ab96b..00000000 --- a/node_modules/@grpc/grpc-js/build/src/experimental.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var logging_1 = require("./logging"); -Object.defineProperty(exports, "trace", { enumerable: true, get: function () { return logging_1.trace; } }); -var resolver_1 = require("./resolver"); -Object.defineProperty(exports, "registerResolver", { enumerable: true, get: function () { return resolver_1.registerResolver; } }); -var uri_parser_1 = require("./uri-parser"); -Object.defineProperty(exports, "uriToString", { enumerable: true, get: function () { return uri_parser_1.uriToString; } }); -var channel_credentials_1 = require("./channel-credentials"); -Object.defineProperty(exports, "createGoogleDefaultCredentials", { enumerable: true, get: function () { return channel_credentials_1.createGoogleDefaultCredentials; } }); -var backoff_timeout_1 = require("./backoff-timeout"); -Object.defineProperty(exports, "BackoffTimeout", { enumerable: true, get: function () { return backoff_timeout_1.BackoffTimeout; } }); -var load_balancer_1 = require("./load-balancer"); -Object.defineProperty(exports, "registerLoadBalancerType", { enumerable: true, get: function () { return load_balancer_1.registerLoadBalancerType; } }); -Object.defineProperty(exports, "getFirstUsableConfig", { enumerable: true, get: function () { return load_balancer_1.getFirstUsableConfig; } }); -Object.defineProperty(exports, "validateLoadBalancingConfig", { enumerable: true, get: function () { return load_balancer_1.validateLoadBalancingConfig; } }); -var subchannel_1 = require("./subchannel"); -Object.defineProperty(exports, "subchannelAddressToString", { enumerable: true, get: function () { return subchannel_1.subchannelAddressToString; } }); -var load_balancer_child_handler_1 = require("./load-balancer-child-handler"); -Object.defineProperty(exports, "ChildLoadBalancerHandler", { enumerable: true, get: function () { return load_balancer_child_handler_1.ChildLoadBalancerHandler; } }); -var picker_1 = require("./picker"); -Object.defineProperty(exports, "UnavailablePicker", { enumerable: true, get: function () { return picker_1.UnavailablePicker; } }); -Object.defineProperty(exports, "QueuePicker", { enumerable: true, get: function () { return picker_1.QueuePicker; } }); -Object.defineProperty(exports, "PickResultType", { enumerable: true, get: function () { return picker_1.PickResultType; } }); -var filter_1 = require("./filter"); -Object.defineProperty(exports, "BaseFilter", { enumerable: true, get: function () { return filter_1.BaseFilter; } }); -var filter_stack_1 = require("./filter-stack"); -Object.defineProperty(exports, "FilterStackFactory", { enumerable: true, get: function () { return filter_stack_1.FilterStackFactory; } }); -//# sourceMappingURL=experimental.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/experimental.js.map b/node_modules/@grpc/grpc-js/build/src/experimental.js.map deleted file mode 100644 index 07ad3cdd..00000000 --- a/node_modules/@grpc/grpc-js/build/src/experimental.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"experimental.js","sourceRoot":"","sources":["../../src/experimental.ts"],"names":[],"mappings":";;AAAA,qCAAkC;AAAzB,gGAAA,KAAK,OAAA;AACd,uCAA0E;AAArC,4GAAA,gBAAgB,OAAA;AACrD,2CAAoD;AAAlC,yGAAA,WAAW,OAAA;AAE7B,6DAAuE;AAA9D,qIAAA,8BAA8B,OAAA;AACvC,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,iDAAuK;AAArG,yHAAA,wBAAwB,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AAAE,4HAAA,2BAA2B,OAAA;AAC7I,2CAA4E;AAAhD,uHAAA,yBAAyB,OAAA;AACrD,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,mCAAwG;AAAvF,2GAAA,iBAAiB,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAwB,wGAAA,cAAc,OAAA;AAErF,mCAA6D;AAA5C,oGAAA,UAAU,OAAA;AAC3B,+CAAoD;AAA3C,kHAAA,kBAAkB,OAAA"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/filter-stack.d.ts b/node_modules/@grpc/grpc-js/build/src/filter-stack.d.ts deleted file mode 100644 index 8202d252..00000000 --- a/node_modules/@grpc/grpc-js/build/src/filter-stack.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// -import { Call, StatusObject, WriteObject } from './call-stream'; -import { Filter, FilterFactory } from './filter'; -import { Metadata } from './metadata'; -export declare class FilterStack implements Filter { - private readonly filters; - constructor(filters: Filter[]); - sendMetadata(metadata: Promise): Promise; - receiveMetadata(metadata: Metadata): Metadata; - sendMessage(message: Promise): Promise; - receiveMessage(message: Promise): Promise; - receiveTrailers(status: StatusObject): StatusObject; -} -export declare class FilterStackFactory implements FilterFactory { - private readonly factories; - constructor(factories: Array>); - createFilter(callStream: Call): FilterStack; -} diff --git a/node_modules/@grpc/grpc-js/build/src/filter-stack.js b/node_modules/@grpc/grpc-js/build/src/filter-stack.js deleted file mode 100644 index 8797fc07..00000000 --- a/node_modules/@grpc/grpc-js/build/src/filter-stack.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FilterStackFactory = exports.FilterStack = void 0; -class FilterStack { - constructor(filters) { - this.filters = filters; - } - sendMetadata(metadata) { - let result = metadata; - for (let i = 0; i < this.filters.length; i++) { - result = this.filters[i].sendMetadata(result); - } - return result; - } - receiveMetadata(metadata) { - let result = metadata; - for (let i = this.filters.length - 1; i >= 0; i--) { - result = this.filters[i].receiveMetadata(result); - } - return result; - } - sendMessage(message) { - let result = message; - for (let i = 0; i < this.filters.length; i++) { - result = this.filters[i].sendMessage(result); - } - return result; - } - receiveMessage(message) { - let result = message; - for (let i = this.filters.length - 1; i >= 0; i--) { - result = this.filters[i].receiveMessage(result); - } - return result; - } - receiveTrailers(status) { - let result = status; - for (let i = this.filters.length - 1; i >= 0; i--) { - result = this.filters[i].receiveTrailers(result); - } - return result; - } -} -exports.FilterStack = FilterStack; -class FilterStackFactory { - constructor(factories) { - this.factories = factories; - } - createFilter(callStream) { - return new FilterStack(this.factories.map((factory) => factory.createFilter(callStream))); - } -} -exports.FilterStackFactory = FilterStackFactory; -//# sourceMappingURL=filter-stack.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/filter-stack.js.map b/node_modules/@grpc/grpc-js/build/src/filter-stack.js.map deleted file mode 100644 index 88f4dbb2..00000000 --- a/node_modules/@grpc/grpc-js/build/src/filter-stack.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filter-stack.js","sourceRoot":"","sources":["../../src/filter-stack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAMH,MAAa,WAAW;IACtB,YAA6B,OAAiB;QAAjB,YAAO,GAAP,OAAO,CAAU;IAAG,CAAC;IAElD,YAAY,CAAC,QAA2B;QACtC,IAAI,MAAM,GAAsB,QAAQ,CAAC;QAEzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;SAC/C;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,eAAe,CAAC,QAAkB;QAChC,IAAI,MAAM,GAAa,QAAQ,CAAC;QAEhC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YACjD,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAA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CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAClE,CAAC;IACJ,CAAC;CACF;AARD,gDAQC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/filter.d.ts b/node_modules/@grpc/grpc-js/build/src/filter.d.ts deleted file mode 100644 index 52c9f173..00000000 --- a/node_modules/@grpc/grpc-js/build/src/filter.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// -import { Call, StatusObject, WriteObject } from './call-stream'; -import { Metadata } from './metadata'; -/** - * Filter classes represent related per-call logic and state that is primarily - * used to modify incoming and outgoing data - */ -export interface Filter { - sendMetadata(metadata: Promise): Promise; - receiveMetadata(metadata: Metadata): Metadata; - sendMessage(message: Promise): Promise; - receiveMessage(message: Promise): Promise; - receiveTrailers(status: StatusObject): StatusObject; -} -export declare abstract class BaseFilter implements Filter { - sendMetadata(metadata: Promise): Promise; - receiveMetadata(metadata: Metadata): Metadata; - sendMessage(message: Promise): Promise; - receiveMessage(message: Promise): Promise; - receiveTrailers(status: StatusObject): StatusObject; -} -export interface FilterFactory { - createFilter(callStream: Call): T; -} diff --git a/node_modules/@grpc/grpc-js/build/src/filter.js b/node_modules/@grpc/grpc-js/build/src/filter.js deleted file mode 100644 index d888a82e..00000000 --- a/node_modules/@grpc/grpc-js/build/src/filter.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BaseFilter = void 0; -class BaseFilter { - async sendMetadata(metadata) { - return metadata; - } - receiveMetadata(metadata) { - return metadata; - } - async sendMessage(message) { - return message; - } - async receiveMessage(message) { - return message; - } - receiveTrailers(status) { - return status; - } -} -exports.BaseFilter = BaseFilter; -//# sourceMappingURL=filter.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/filter.js.map b/node_modules/@grpc/grpc-js/build/src/filter.js.map deleted file mode 100644 index 6b33baed..00000000 --- a/node_modules/@grpc/grpc-js/build/src/filter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAqBH,MAAsB,UAAU;IAC9B,KAAK,CAAC,YAAY,CAAC,QAA2B;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,eAAe,CAAC,QAAkB;QAChC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA6B;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAwB;QAC3C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,eAAe,CAAC,MAAoB;QAClC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AApBD,gCAoBC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/http_proxy.d.ts b/node_modules/@grpc/grpc-js/build/src/http_proxy.d.ts deleted file mode 100644 index 8e6f3e36..00000000 --- a/node_modules/@grpc/grpc-js/build/src/http_proxy.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// -import { Socket } from 'net'; -import * as tls from 'tls'; -import { SubchannelAddress } from './subchannel'; -import { ChannelOptions } from './channel-options'; -import { GrpcUri } from './uri-parser'; -export interface ProxyMapResult { - target: GrpcUri; - extraOptions: ChannelOptions; -} -export declare function mapProxyName(target: GrpcUri, options: ChannelOptions): ProxyMapResult; -export interface ProxyConnectionResult { - socket?: Socket; - realTarget?: GrpcUri; -} -export declare function getProxiedConnection(address: SubchannelAddress, channelOptions: ChannelOptions, connectionOptions: tls.ConnectionOptions): Promise; diff --git a/node_modules/@grpc/grpc-js/build/src/http_proxy.js b/node_modules/@grpc/grpc-js/build/src/http_proxy.js deleted file mode 100644 index 38ee28d8..00000000 --- a/node_modules/@grpc/grpc-js/build/src/http_proxy.js +++ /dev/null @@ -1,237 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getProxiedConnection = exports.mapProxyName = void 0; -const logging_1 = require("./logging"); -const constants_1 = require("./constants"); -const resolver_1 = require("./resolver"); -const http = require("http"); -const tls = require("tls"); -const logging = require("./logging"); -const subchannel_1 = require("./subchannel"); -const uri_parser_1 = require("./uri-parser"); -const url_1 = require("url"); -const TRACER_NAME = 'proxy'; -function trace(text) { - logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); -} -function getProxyInfo() { - let proxyEnv = ''; - let envVar = ''; - /* Prefer using 'grpc_proxy'. Fallback on 'http_proxy' if it is not set. - * Also prefer using 'https_proxy' with fallback on 'http_proxy'. The - * fallback behavior can be removed if there's a demand for it. - */ - if (process.env.grpc_proxy) { - envVar = 'grpc_proxy'; - proxyEnv = process.env.grpc_proxy; - } - else if (process.env.https_proxy) { - envVar = 'https_proxy'; - proxyEnv = process.env.https_proxy; - } - else if (process.env.http_proxy) { - envVar = 'http_proxy'; - proxyEnv = process.env.http_proxy; - } - else { - return {}; - } - let proxyUrl; - try { - proxyUrl = new url_1.URL(proxyEnv); - } - catch (e) { - logging_1.log(constants_1.LogVerbosity.ERROR, `cannot parse value of "${envVar}" env var`); - return {}; - } - if (proxyUrl.protocol !== 'http:') { - logging_1.log(constants_1.LogVerbosity.ERROR, `"${proxyUrl.protocol}" scheme not supported in proxy URI`); - return {}; - } - let userCred = null; - if (proxyUrl.username) { - if (proxyUrl.password) { - logging_1.log(constants_1.LogVerbosity.INFO, 'userinfo found in proxy URI'); - userCred = `${proxyUrl.username}:${proxyUrl.password}`; - } - else { - userCred = proxyUrl.username; - } - } - const hostname = proxyUrl.hostname; - let port = proxyUrl.port; - /* The proxy URL uses the scheme "http:", which has a default port number of - * 80. We need to set that explicitly here if it is omitted because otherwise - * it will use gRPC's default port 443. */ - if (port === '') { - port = '80'; - } - const result = { - address: `${hostname}:${port}` - }; - if (userCred) { - result.creds = userCred; - } - trace('Proxy server ' + result.address + ' set by environment variable ' + envVar); - return result; -} -function getNoProxyHostList() { - /* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */ - let noProxyStr = process.env.no_grpc_proxy; - let envVar = 'no_grpc_proxy'; - if (!noProxyStr) { - noProxyStr = process.env.no_proxy; - envVar = 'no_proxy'; - } - if (noProxyStr) { - trace('No proxy server list set by environment variable ' + envVar); - return noProxyStr.split(','); - } - else { - return []; - } -} -function mapProxyName(target, options) { - var _a; - const noProxyResult = { - target: target, - extraOptions: {}, - }; - if (((_a = options['grpc.enable_http_proxy']) !== null && _a !== void 0 ? _a : 1) === 0) { - return noProxyResult; - } - const proxyInfo = getProxyInfo(); - if (!proxyInfo.address) { - return noProxyResult; - } - const hostPort = uri_parser_1.splitHostPort(target.path); - if (!hostPort) { - return noProxyResult; - } - const serverHost = hostPort.host; - for (const host of getNoProxyHostList()) { - if (host === serverHost) { - trace('Not using proxy for target in no_proxy list: ' + uri_parser_1.uriToString(target)); - return noProxyResult; - } - } - const extraOptions = { - 'grpc.http_connect_target': uri_parser_1.uriToString(target), - }; - if (proxyInfo.creds) { - extraOptions['grpc.http_connect_creds'] = proxyInfo.creds; - } - return { - target: { - scheme: 'dns', - path: proxyInfo.address, - }, - extraOptions: extraOptions, - }; -} -exports.mapProxyName = mapProxyName; -function getProxiedConnection(address, channelOptions, connectionOptions) { - if (!('grpc.http_connect_target' in channelOptions)) { - return Promise.resolve({}); - } - const realTarget = channelOptions['grpc.http_connect_target']; - const parsedTarget = uri_parser_1.parseUri(realTarget); - if (parsedTarget === null) { - return Promise.resolve({}); - } - const options = { - method: 'CONNECT', - path: parsedTarget.path, - }; - // Connect to the subchannel address as a proxy - if (subchannel_1.isTcpSubchannelAddress(address)) { - options.host = address.host; - options.port = address.port; - } - else { - options.socketPath = address.path; - } - if ('grpc.http_connect_creds' in channelOptions) { - options.headers = { - 'Proxy-Authorization': 'Basic ' + - Buffer.from(channelOptions['grpc.http_connect_creds']).toString('base64'), - }; - } - const proxyAddressString = subchannel_1.subchannelAddressToString(address); - trace('Using proxy ' + proxyAddressString + ' to connect to ' + options.path); - return new Promise((resolve, reject) => { - const request = http.request(options); - request.once('connect', (res, socket, head) => { - var _a; - request.removeAllListeners(); - socket.removeAllListeners(); - if (res.statusCode === 200) { - trace('Successfully connected to ' + - options.path + - ' through proxy ' + - proxyAddressString); - if ('secureContext' in connectionOptions) { - /* The proxy is connecting to a TLS server, so upgrade this socket - * connection to a TLS connection. - * This is a workaround for https://github.com/nodejs/node/issues/32922 - * See https://github.com/grpc/grpc-node/pull/1369 for more info. */ - const targetPath = resolver_1.getDefaultAuthority(parsedTarget); - const hostPort = uri_parser_1.splitHostPort(targetPath); - const remoteHost = (_a = hostPort === null || hostPort === void 0 ? void 0 : hostPort.host) !== null && _a !== void 0 ? _a : targetPath; - const cts = tls.connect(Object.assign({ host: remoteHost, servername: remoteHost, socket: socket }, connectionOptions), () => { - trace('Successfully established a TLS connection to ' + - options.path + - ' through proxy ' + - proxyAddressString); - resolve({ socket: cts, realTarget: parsedTarget }); - }); - cts.on('error', () => { - reject(); - }); - } - else { - resolve({ - socket, - realTarget: parsedTarget, - }); - } - } - else { - logging_1.log(constants_1.LogVerbosity.ERROR, 'Failed to connect to ' + - options.path + - ' through proxy ' + - proxyAddressString + - ' with status ' + - res.statusCode); - reject(); - } - }); - request.once('error', (err) => { - request.removeAllListeners(); - logging_1.log(constants_1.LogVerbosity.ERROR, 'Failed to connect to proxy ' + - proxyAddressString + - ' with error ' + - err.message); - reject(); - }); - request.end(); - }); -} -exports.getProxiedConnection = getProxiedConnection; -//# sourceMappingURL=http_proxy.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/http_proxy.js.map b/node_modules/@grpc/grpc-js/build/src/http_proxy.js.map deleted file mode 100644 index 8b4dbc22..00000000 --- a/node_modules/@grpc/grpc-js/build/src/http_proxy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"http_proxy.js","sourceRoot":"","sources":["../../src/http_proxy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,uCAAgC;AAChC,2CAA2C;AAC3C,yCAAiD;AAEjD,6BAA6B;AAC7B,2BAA2B;AAC3B,qCAAqC;AACrC,6CAIsB;AAEtB,6CAA6E;AAC7E,6BAA0B;AAE1B,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAOD,SAAS,YAAY;IACnB,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB;;;OAGG;IACH,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;QAC1B,MAAM,GAAG,YAAY,CAAC;QACtB,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;KACnC;SAAM,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;QAClC,MAAM,GAAG,aAAa,CAAC;QACvB,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;KACpC;SAAM,IA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AAM,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC;oBACrD,CAAC,CACF,CAAC;oBACF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;wBACnB,MAAM,EAAE,CAAC;oBACX,CAAC,CAAC,CAAC;iBACJ;qBAAM;oBACL,OAAO,CAAC;wBACN,MAAM;wBACN,UAAU,EAAE,YAAY;qBACzB,CAAC,CAAC;iBACJ;aACF;iBAAM;gBACL,aAAG,CACD,wBAAY,CAAC,KAAK,EAClB,uBAAuB;oBACrB,OAAO,CAAC,IAAI;oBACZ,iBAAiB;oBACjB,kBAAkB;oBAClB,eAAe;oBACf,GAAG,CAAC,UAAU,CACjB,CAAC;gBACF,MAAM,EAAE,CAAC;aACV;QACH,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC;YAC7B,aAAG,CACD,wBAAY,CAAC,KAAK,EAClB,6BAA6B;gBAC3B,kBAAkB;gBAClB,cAAc;gBACd,GAAG,CAAC,OAAO,CACd,CAAC;YACF,MAAM,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC;AA5GD,oDA4GC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/index.d.ts b/node_modules/@grpc/grpc-js/build/src/index.d.ts deleted file mode 100644 index beedaf28..00000000 --- a/node_modules/@grpc/grpc-js/build/src/index.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// -import { ClientDuplexStream, ClientReadableStream, ClientUnaryCall, ClientWritableStream, ServiceError } from './call'; -import { CallCredentials, OAuth2Client } from './call-credentials'; -import { Deadline, StatusObject } from './call-stream'; -import { Channel, ConnectivityState, ChannelImplementation } from './channel'; -import { ChannelCredentials } from './channel-credentials'; -import { CallOptions, Client, ClientOptions, CallInvocationTransformer, CallProperties, UnaryCallback } from './client'; -import { LogVerbosity, Status, Propagate } from './constants'; -import { Deserialize, loadPackageDefinition, makeClientConstructor, MethodDefinition, Serialize, ServiceDefinition } from './make-client'; -import { Metadata, MetadataValue } from './metadata'; -import { Server, UntypedHandleCall, UntypedServiceImplementation } from './server'; -import { KeyCertPair, ServerCredentials } from './server-credentials'; -import { StatusBuilder } from './status-builder'; -import { handleBidiStreamingCall, handleServerStreamingCall, handleClientStreamingCall, handleUnaryCall, sendUnaryData, ServerUnaryCall, ServerReadableStream, ServerWritableStream, ServerDuplexStream } from './server-call'; -export { OAuth2Client }; -/**** Client Credentials ****/ -export declare const credentials: { - /** - * Combine a ChannelCredentials with any number of CallCredentials into a - * single ChannelCredentials object. - * @param channelCredentials The ChannelCredentials object. - * @param callCredentials Any number of CallCredentials objects. - * @return The resulting ChannelCredentials object. - */ - combineChannelCredentials: (channelCredentials: ChannelCredentials, ...callCredentials: CallCredentials[]) => ChannelCredentials; - /** - * Combine any number of CallCredentials into a single CallCredentials - * object. - * @param first The first CallCredentials object. - * @param additional Any number of additional CallCredentials objects. - * @return The resulting CallCredentials object. - */ - combineCallCredentials: (first: CallCredentials, ...additional: CallCredentials[]) => CallCredentials; - createInsecure: typeof ChannelCredentials.createInsecure; - createSsl: typeof ChannelCredentials.createSsl; - createFromMetadataGenerator: typeof CallCredentials.createFromMetadataGenerator; - createFromGoogleCredential: typeof CallCredentials.createFromGoogleCredential; - createEmpty: typeof CallCredentials.createEmpty; -}; -/**** Metadata ****/ -export { Metadata, MetadataValue }; -/**** Constants ****/ -export { LogVerbosity as logVerbosity, Status as status, ConnectivityState as connectivityState, Propagate as propagate, }; -/**** Client ****/ -export { Client, ClientOptions, loadPackageDefinition, makeClientConstructor, makeClientConstructor as makeGenericClientConstructor, CallProperties, CallInvocationTransformer, ChannelImplementation as Channel, Channel as ChannelInterface, UnaryCallback as requestCallback, }; -/** - * Close a Client object. - * @param client The client to close. - */ -export declare const closeClient: (client: Client) => void; -export declare const waitForClientReady: (client: Client, deadline: Date | number, callback: (error?: Error | undefined) => void) => void; -export { sendUnaryData, ChannelCredentials, CallCredentials, Deadline, Serialize as serialize, Deserialize as deserialize, ClientUnaryCall, ClientReadableStream, ClientWritableStream, ClientDuplexStream, CallOptions, MethodDefinition, StatusObject, ServiceError, ServerUnaryCall, ServerReadableStream, ServerWritableStream, ServerDuplexStream, ServiceDefinition, UntypedHandleCall, UntypedServiceImplementation, }; -/**** Server ****/ -export { handleBidiStreamingCall, handleServerStreamingCall, handleUnaryCall, handleClientStreamingCall }; -export declare type Call = ClientUnaryCall | ClientReadableStream | ClientWritableStream | ClientDuplexStream; -/**** Unimplemented function stubs ****/ -export declare const loadObject: (value: any, options: any) => never; -export declare const load: (filename: any, format: any, options: any) => never; -export declare const setLogger: (logger: Partial) => void; -export declare const setLogVerbosity: (verbosity: LogVerbosity) => void; -export { Server }; -export { ServerCredentials }; -export { KeyCertPair }; -export declare const getClientChannel: (client: Client) => Channel; -export { StatusBuilder }; -export { Listener } from './call-stream'; -export { Requester, ListenerBuilder, RequesterBuilder, Interceptor, InterceptorOptions, InterceptorProvider, InterceptingCall, InterceptorConfigurationError, } from './client-interceptors'; -export { GrpcObject } from './make-client'; -export { ChannelOptions } from './channel-options'; -import * as experimental from './experimental'; -export { experimental }; diff --git a/node_modules/@grpc/grpc-js/build/src/index.js b/node_modules/@grpc/grpc-js/build/src/index.js deleted file mode 100644 index 658e8c3f..00000000 --- a/node_modules/@grpc/grpc-js/build/src/index.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.experimental = exports.StatusBuilder = exports.getClientChannel = exports.ServerCredentials = exports.Server = exports.setLogVerbosity = exports.setLogger = exports.load = exports.loadObject = exports.CallCredentials = exports.ChannelCredentials = exports.waitForClientReady = exports.closeClient = exports.Channel = exports.makeGenericClientConstructor = exports.makeClientConstructor = exports.loadPackageDefinition = exports.Client = exports.propagate = exports.connectivityState = exports.status = exports.logVerbosity = exports.Metadata = exports.credentials = void 0; -const semver = require("semver"); -const call_credentials_1 = require("./call-credentials"); -Object.defineProperty(exports, "CallCredentials", { enumerable: true, get: function () { return call_credentials_1.CallCredentials; } }); -const channel_1 = require("./channel"); -Object.defineProperty(exports, "connectivityState", { enumerable: true, get: function () { return channel_1.ConnectivityState; } }); -Object.defineProperty(exports, "Channel", { enumerable: true, get: function () { return channel_1.ChannelImplementation; } }); -const channel_credentials_1 = require("./channel-credentials"); -Object.defineProperty(exports, "ChannelCredentials", { enumerable: true, get: function () { return channel_credentials_1.ChannelCredentials; } }); -const client_1 = require("./client"); -Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } }); -const constants_1 = require("./constants"); -Object.defineProperty(exports, "logVerbosity", { enumerable: true, get: function () { return constants_1.LogVerbosity; } }); -Object.defineProperty(exports, "status", { enumerable: true, get: function () { return constants_1.Status; } }); -Object.defineProperty(exports, "propagate", { enumerable: true, get: function () { return constants_1.Propagate; } }); -const logging = require("./logging"); -const make_client_1 = require("./make-client"); -Object.defineProperty(exports, "loadPackageDefinition", { enumerable: true, get: function () { return make_client_1.loadPackageDefinition; } }); -Object.defineProperty(exports, "makeClientConstructor", { enumerable: true, get: function () { return make_client_1.makeClientConstructor; } }); -Object.defineProperty(exports, "makeGenericClientConstructor", { enumerable: true, get: function () { return make_client_1.makeClientConstructor; } }); -const metadata_1 = require("./metadata"); -Object.defineProperty(exports, "Metadata", { enumerable: true, get: function () { return metadata_1.Metadata; } }); -const server_1 = require("./server"); -Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return server_1.Server; } }); -const server_credentials_1 = require("./server-credentials"); -Object.defineProperty(exports, "ServerCredentials", { enumerable: true, get: function () { return server_credentials_1.ServerCredentials; } }); -const status_builder_1 = require("./status-builder"); -Object.defineProperty(exports, "StatusBuilder", { enumerable: true, get: function () { return status_builder_1.StatusBuilder; } }); -const supportedNodeVersions = require('../../package.json').engines.node; -if (!semver.satisfies(process.version, supportedNodeVersions)) { - throw new Error(`@grpc/grpc-js only works on Node ${supportedNodeVersions}`); -} -/**** Client Credentials ****/ -// Using assign only copies enumerable properties, which is what we want -exports.credentials = { - /** - * Combine a ChannelCredentials with any number of CallCredentials into a - * single ChannelCredentials object. - * @param channelCredentials The ChannelCredentials object. - * @param callCredentials Any number of CallCredentials objects. - * @return The resulting ChannelCredentials object. - */ - combineChannelCredentials: (channelCredentials, ...callCredentials) => { - return callCredentials.reduce((acc, other) => acc.compose(other), channelCredentials); - }, - /** - * Combine any number of CallCredentials into a single CallCredentials - * object. - * @param first The first CallCredentials object. - * @param additional Any number of additional CallCredentials objects. - * @return The resulting CallCredentials object. - */ - combineCallCredentials: (first, ...additional) => { - return additional.reduce((acc, other) => acc.compose(other), first); - }, - // from channel-credentials.ts - createInsecure: channel_credentials_1.ChannelCredentials.createInsecure, - createSsl: channel_credentials_1.ChannelCredentials.createSsl, - // from call-credentials.ts - createFromMetadataGenerator: call_credentials_1.CallCredentials.createFromMetadataGenerator, - createFromGoogleCredential: call_credentials_1.CallCredentials.createFromGoogleCredential, - createEmpty: call_credentials_1.CallCredentials.createEmpty, -}; -/** - * Close a Client object. - * @param client The client to close. - */ -exports.closeClient = (client) => client.close(); -exports.waitForClientReady = (client, deadline, callback) => client.waitForReady(deadline, callback); -/* eslint-enable @typescript-eslint/no-explicit-any */ -/**** Unimplemented function stubs ****/ -/* eslint-disable @typescript-eslint/no-explicit-any */ -exports.loadObject = (value, options) => { - throw new Error('Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'); -}; -exports.load = (filename, format, options) => { - throw new Error('Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'); -}; -exports.setLogger = (logger) => { - logging.setLogger(logger); -}; -exports.setLogVerbosity = (verbosity) => { - logging.setLoggerVerbosity(verbosity); -}; -exports.getClientChannel = (client) => { - return client_1.Client.prototype.getChannel.call(client); -}; -var client_interceptors_1 = require("./client-interceptors"); -Object.defineProperty(exports, "ListenerBuilder", { enumerable: true, get: function () { return client_interceptors_1.ListenerBuilder; } }); -Object.defineProperty(exports, "RequesterBuilder", { enumerable: true, get: function () { return client_interceptors_1.RequesterBuilder; } }); -Object.defineProperty(exports, "InterceptingCall", { enumerable: true, get: function () { return client_interceptors_1.InterceptingCall; } }); -Object.defineProperty(exports, "InterceptorConfigurationError", { enumerable: true, get: function () { return client_interceptors_1.InterceptorConfigurationError; } }); -const experimental = require("./experimental"); -exports.experimental = experimental; -const resolver = require("./resolver"); -const load_balancer = require("./load-balancer"); -(() => { - resolver.registerAll(); - load_balancer.registerAll(); -})(); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/index.js.map b/node_modules/@grpc/grpc-js/build/src/index.js.map deleted file mode 100644 index cdcb60b0..00000000 --- a/node_modules/@grpc/grpc-js/build/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,iCAAiC;AASjC,yDAAmE;AA4IjE,gGA5IO,kCAAe,OA4IP;AA1IjB,uCAA8E;AAqGvD,kGArGL,2BAAiB,OAqGK;AAeb,wFApHU,+BAAqB,OAoHxB;AAnHlC,+DAA2D;AAwIzD,mGAxIO,wCAAkB,OAwIP;AAvIpB,qCAOkB;AAoGhB,uFAzGA,eAAM,OAyGA;AAnGR,2CAA8D;AAyF5C,6FAzFT,wBAAY,OAyFS;AAClB,uFA1FW,kBAAM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AErB,uCAAuC;AACvC,iDAAiD;AAEjD,CAAC,GAAG,EAAE;IACJ,QAAQ,CAAC,WAAW,EAAE,CAAC;IACvB,aAAa,CAAC,WAAW,EAAE,CAAC;AAC9B,CAAC,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.d.ts b/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.d.ts deleted file mode 100644 index d3b3ea06..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { LoadBalancer, ChannelControlHelper, LoadBalancingConfig } from './load-balancer'; -import { SubchannelAddress } from './subchannel'; -export declare class ChildLoadBalancerHandler implements LoadBalancer { - private readonly channelControlHelper; - private currentChild; - private pendingChild; - private ChildPolicyHelper; - constructor(channelControlHelper: ChannelControlHelper); - /** - * Prerequisites: lbConfig !== null and lbConfig.name is registered - * @param addressList - * @param lbConfig - * @param attributes - */ - updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig, attributes: { - [key: string]: unknown; - }): void; - exitIdle(): void; - resetBackoff(): void; - destroy(): void; - getTypeName(): string; -} diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js b/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js deleted file mode 100644 index f68d4e1a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js +++ /dev/null @@ -1,135 +0,0 @@ -"use strict"; -/* - * Copyright 2020 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ChildLoadBalancerHandler = void 0; -const load_balancer_1 = require("./load-balancer"); -const channel_1 = require("./channel"); -const TYPE_NAME = 'child_load_balancer_helper'; -class ChildLoadBalancerHandler { - constructor(channelControlHelper) { - this.channelControlHelper = channelControlHelper; - this.currentChild = null; - this.pendingChild = null; - this.ChildPolicyHelper = class { - constructor(parent) { - this.parent = parent; - this.child = null; - } - createSubchannel(subchannelAddress, subchannelArgs) { - return this.parent.channelControlHelper.createSubchannel(subchannelAddress, subchannelArgs); - } - updateState(connectivityState, picker) { - var _a; - if (this.calledByPendingChild()) { - if (connectivityState !== channel_1.ConnectivityState.READY) { - return; - } - (_a = this.parent.currentChild) === null || _a === void 0 ? void 0 : _a.destroy(); - this.parent.currentChild = this.parent.pendingChild; - this.parent.pendingChild = null; - } - else if (!this.calledByCurrentChild()) { - return; - } - this.parent.channelControlHelper.updateState(connectivityState, picker); - } - requestReresolution() { - var _a; - const latestChild = (_a = this.parent.pendingChild) !== null && _a !== void 0 ? _a : this.parent.currentChild; - if (this.child === latestChild) { - this.parent.channelControlHelper.requestReresolution(); - } - } - setChild(newChild) { - this.child = newChild; - } - calledByPendingChild() { - return this.child === this.parent.pendingChild; - } - calledByCurrentChild() { - return this.child === this.parent.currentChild; - } - }; - } - /** - * Prerequisites: lbConfig !== null and lbConfig.name is registered - * @param addressList - * @param lbConfig - * @param attributes - */ - updateAddressList(addressList, lbConfig, attributes) { - let childToUpdate; - if (this.currentChild === null || - this.currentChild.getTypeName() !== lbConfig.getLoadBalancerName()) { - const newHelper = new this.ChildPolicyHelper(this); - const newChild = load_balancer_1.createLoadBalancer(lbConfig, newHelper); - newHelper.setChild(newChild); - if (this.currentChild === null) { - this.currentChild = newChild; - childToUpdate = this.currentChild; - } - else { - if (this.pendingChild) { - this.pendingChild.destroy(); - } - this.pendingChild = newChild; - childToUpdate = this.pendingChild; - } - } - else { - if (this.pendingChild === null) { - childToUpdate = this.currentChild; - } - else { - childToUpdate = this.pendingChild; - } - } - childToUpdate.updateAddressList(addressList, lbConfig, attributes); - } - exitIdle() { - if (this.currentChild) { - this.currentChild.resetBackoff(); - if (this.pendingChild) { - this.pendingChild.resetBackoff(); - } - } - } - resetBackoff() { - if (this.currentChild) { - this.currentChild.resetBackoff(); - if (this.pendingChild) { - this.pendingChild.resetBackoff(); - } - } - } - destroy() { - if (this.currentChild) { - this.currentChild.destroy(); - this.currentChild = null; - } - if (this.pendingChild) { - this.pendingChild.destroy(); - this.pendingChild = null; - } - } - getTypeName() { - return TYPE_NAME; - } -} -exports.ChildLoadBalancerHandler = ChildLoadBalancerHandler; -//# sourceMappingURL=load-balancer-child-handler.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js.map b/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js.map deleted file mode 100644 index f5f9ab25..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-balancer-child-handler.js","sourceRoot":"","sources":["../../src/load-balancer-child-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mDAKyB;AAGzB,uCAA8C;AAG9C,MAAM,SAAS,GAAG,4BAA4B,CAAC;AAE/C,MAAa,wBAAwB;IA8CnC,YAA6B,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;QA7C/D,iBAAY,GAAwB,IAAI,CAAC;QACzC,iBAAY,GAAwB,IAAI,CAAC;QAEzC,sBAAiB,GAAG;YAE1B,YAAoB,MAAgC;gBAAhC,WAAM,GAAN,MAAM,CAA0B;gBAD5C,UAAK,GAAwB,IAAI,CAAC;YACa,CAAC;YACxD,gBAAgB,CACd,iBAAoC,EACpC,cAA8B;gBAE9B,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,CACtD,iBAAiB,EACjB,cAAc,CACf,CAAC;YACJ,CAAC;YACD,WAAW,CAAC,iBAAoC,E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;SACF;IACH,CAAC;IACD,OAAO;QACL,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;IACH,CAAC;IACD,WAAW;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAnHD,4DAmHC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.d.ts b/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.d.ts deleted file mode 100644 index a80bd8b1..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { LoadBalancer, ChannelControlHelper, LoadBalancingConfig } from './load-balancer'; -import { SubchannelAddress } from './subchannel'; -export declare class PickFirstLoadBalancingConfig implements LoadBalancingConfig { - getLoadBalancerName(): string; - constructor(); - toJsonObject(): object; - static createFromJson(obj: any): PickFirstLoadBalancingConfig; -} -export declare class PickFirstLoadBalancer implements LoadBalancer { - private readonly channelControlHelper; - /** - * The list of backend addresses most recently passed to `updateAddressList`. - */ - private latestAddressList; - /** - * The list of subchannels this load balancer is currently attempting to - * connect to. - */ - private subchannels; - /** - * The current connectivity state of the load balancer. - */ - private currentState; - /** - * The index within the `subchannels` array of the subchannel with the most - * recently started connection attempt. - */ - private currentSubchannelIndex; - private subchannelStateCounts; - /** - * The currently picked subchannel used for making calls. Populated if - * and only if the load balancer's current state is READY. In that case, - * the subchannel's current state is also READY. - */ - private currentPick; - /** - * Listener callback attached to each subchannel in the `subchannels` list - * while establishing a connection. - */ - private subchannelStateListener; - /** - * Listener callback attached to the current picked subchannel. - */ - private pickedSubchannelStateListener; - /** - * Timer reference for the timer tracking when to start - */ - private connectionDelayTimeout; - private triedAllSubchannels; - /** - * Load balancer that attempts to connect to each backend in the address list - * in order, and picks the first one that connects, using it for every - * request. - * @param channelControlHelper `ChannelControlHelper` instance provided by - * this load balancer's owner. - */ - constructor(channelControlHelper: ChannelControlHelper); - private startNextSubchannelConnecting; - /** - * Have a single subchannel in the `subchannels` list start connecting. - * @param subchannelIndex The index into the `subchannels` list. - */ - private startConnecting; - private pickSubchannel; - private updateState; - private resetSubchannelList; - /** - * Start connecting to the address list most recently passed to - * `updateAddressList`. - */ - private connectToAddressList; - updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig): void; - exitIdle(): void; - resetBackoff(): void; - destroy(): void; - getTypeName(): string; -} -export declare function setup(): void; diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js b/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js deleted file mode 100644 index 94284af6..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js +++ /dev/null @@ -1,359 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.setup = exports.PickFirstLoadBalancer = exports.PickFirstLoadBalancingConfig = void 0; -const load_balancer_1 = require("./load-balancer"); -const channel_1 = require("./channel"); -const picker_1 = require("./picker"); -const subchannel_1 = require("./subchannel"); -const logging = require("./logging"); -const constants_1 = require("./constants"); -const TRACER_NAME = 'pick_first'; -function trace(text) { - logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); -} -const TYPE_NAME = 'pick_first'; -/** - * Delay after starting a connection on a subchannel before starting a - * connection on the next subchannel in the list, for Happy Eyeballs algorithm. - */ -const CONNECTION_DELAY_INTERVAL_MS = 250; -class PickFirstLoadBalancingConfig { - getLoadBalancerName() { - return TYPE_NAME; - } - constructor() { } - toJsonObject() { - return { - [TYPE_NAME]: {} - }; - } - static createFromJson(obj) { - return new PickFirstLoadBalancingConfig(); - } -} -exports.PickFirstLoadBalancingConfig = PickFirstLoadBalancingConfig; -/** - * Picker for a `PickFirstLoadBalancer` in the READY state. Always returns the - * picked subchannel. - */ -class PickFirstPicker { - constructor(subchannel) { - this.subchannel = subchannel; - } - pick(pickArgs) { - return { - pickResultType: picker_1.PickResultType.COMPLETE, - subchannel: this.subchannel, - status: null, - extraFilterFactory: null, - onCallStarted: null, - }; - } -} -class PickFirstLoadBalancer { - /** - * Load balancer that attempts to connect to each backend in the address list - * in order, and picks the first one that connects, using it for every - * request. - * @param channelControlHelper `ChannelControlHelper` instance provided by - * this load balancer's owner. - */ - constructor(channelControlHelper) { - this.channelControlHelper = channelControlHelper; - /** - * The list of backend addresses most recently passed to `updateAddressList`. - */ - this.latestAddressList = []; - /** - * The list of subchannels this load balancer is currently attempting to - * connect to. - */ - this.subchannels = []; - /** - * The current connectivity state of the load balancer. - */ - this.currentState = channel_1.ConnectivityState.IDLE; - /** - * The index within the `subchannels` array of the subchannel with the most - * recently started connection attempt. - */ - this.currentSubchannelIndex = 0; - /** - * The currently picked subchannel used for making calls. Populated if - * and only if the load balancer's current state is READY. In that case, - * the subchannel's current state is also READY. - */ - this.currentPick = null; - this.triedAllSubchannels = false; - this.subchannelStateCounts = { - [channel_1.ConnectivityState.CONNECTING]: 0, - [channel_1.ConnectivityState.IDLE]: 0, - [channel_1.ConnectivityState.READY]: 0, - [channel_1.ConnectivityState.SHUTDOWN]: 0, - [channel_1.ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannelStateListener = (subchannel, previousState, newState) => { - this.subchannelStateCounts[previousState] -= 1; - this.subchannelStateCounts[newState] += 1; - /* If the subchannel we most recently attempted to start connecting - * to goes into TRANSIENT_FAILURE, immediately try to start - * connecting to the next one instead of waiting for the connection - * delay timer. */ - if (subchannel === this.subchannels[this.currentSubchannelIndex] && - newState === channel_1.ConnectivityState.TRANSIENT_FAILURE) { - this.startNextSubchannelConnecting(); - } - if (newState === channel_1.ConnectivityState.READY) { - this.pickSubchannel(subchannel); - return; - } - else { - if (this.triedAllSubchannels && - this.subchannelStateCounts[channel_1.ConnectivityState.IDLE] === - this.subchannels.length) { - /* If all of the subchannels are IDLE we should go back to a - * basic IDLE state where there is no subchannel list to avoid - * holding unused resources */ - this.resetSubchannelList(); - this.updateState(channel_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this)); - return; - } - if (this.currentPick === null) { - if (this.triedAllSubchannels) { - let newLBState; - if (this.subchannelStateCounts[channel_1.ConnectivityState.CONNECTING] > 0) { - newLBState = channel_1.ConnectivityState.CONNECTING; - } - else if (this.subchannelStateCounts[channel_1.ConnectivityState.TRANSIENT_FAILURE] > - 0) { - newLBState = channel_1.ConnectivityState.TRANSIENT_FAILURE; - } - else { - newLBState = channel_1.ConnectivityState.IDLE; - } - if (newLBState !== this.currentState) { - if (newLBState === channel_1.ConnectivityState.TRANSIENT_FAILURE) { - this.updateState(newLBState, new picker_1.UnavailablePicker()); - } - else { - this.updateState(newLBState, new picker_1.QueuePicker(this)); - } - } - } - else { - this.updateState(channel_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this)); - } - } - } - }; - this.pickedSubchannelStateListener = (subchannel, previousState, newState) => { - if (newState !== channel_1.ConnectivityState.READY) { - this.currentPick = null; - subchannel.unref(); - subchannel.removeConnectivityStateListener(this.pickedSubchannelStateListener); - if (this.subchannels.length > 0) { - if (this.triedAllSubchannels) { - let newLBState; - if (this.subchannelStateCounts[channel_1.ConnectivityState.CONNECTING] > 0) { - newLBState = channel_1.ConnectivityState.CONNECTING; - } - else if (this.subchannelStateCounts[channel_1.ConnectivityState.TRANSIENT_FAILURE] > - 0) { - newLBState = channel_1.ConnectivityState.TRANSIENT_FAILURE; - } - else { - newLBState = channel_1.ConnectivityState.IDLE; - } - if (newLBState === channel_1.ConnectivityState.TRANSIENT_FAILURE) { - this.updateState(newLBState, new picker_1.UnavailablePicker()); - } - else { - this.updateState(newLBState, new picker_1.QueuePicker(this)); - } - } - else { - this.updateState(channel_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this)); - } - } - else { - /* We don't need to backoff here because this only happens if a - * subchannel successfully connects then disconnects, so it will not - * create a loop of attempting to connect to an unreachable backend - */ - this.updateState(channel_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this)); - } - } - }; - this.connectionDelayTimeout = setTimeout(() => { }, 0); - clearTimeout(this.connectionDelayTimeout); - } - startNextSubchannelConnecting() { - if (this.triedAllSubchannels) { - return; - } - for (const [index, subchannel] of this.subchannels.entries()) { - if (index > this.currentSubchannelIndex) { - const subchannelState = subchannel.getConnectivityState(); - if (subchannelState === channel_1.ConnectivityState.IDLE || - subchannelState === channel_1.ConnectivityState.CONNECTING) { - this.startConnecting(index); - return; - } - } - } - this.triedAllSubchannels = true; - } - /** - * Have a single subchannel in the `subchannels` list start connecting. - * @param subchannelIndex The index into the `subchannels` list. - */ - startConnecting(subchannelIndex) { - clearTimeout(this.connectionDelayTimeout); - this.currentSubchannelIndex = subchannelIndex; - if (this.subchannels[subchannelIndex].getConnectivityState() === - channel_1.ConnectivityState.IDLE) { - trace('Start connecting to subchannel with address ' + - this.subchannels[subchannelIndex].getAddress()); - process.nextTick(() => { - this.subchannels[subchannelIndex].startConnecting(); - }); - } - this.connectionDelayTimeout = setTimeout(() => { - this.startNextSubchannelConnecting(); - }, CONNECTION_DELAY_INTERVAL_MS); - } - pickSubchannel(subchannel) { - trace('Pick subchannel with address ' + subchannel.getAddress()); - if (this.currentPick !== null) { - this.currentPick.unref(); - this.currentPick.removeConnectivityStateListener(this.pickedSubchannelStateListener); - } - this.currentPick = subchannel; - this.updateState(channel_1.ConnectivityState.READY, new PickFirstPicker(subchannel)); - subchannel.addConnectivityStateListener(this.pickedSubchannelStateListener); - subchannel.ref(); - this.resetSubchannelList(); - clearTimeout(this.connectionDelayTimeout); - } - updateState(newState, picker) { - trace(channel_1.ConnectivityState[this.currentState] + - ' -> ' + - channel_1.ConnectivityState[newState]); - this.currentState = newState; - this.channelControlHelper.updateState(newState, picker); - } - resetSubchannelList() { - for (const subchannel of this.subchannels) { - subchannel.removeConnectivityStateListener(this.subchannelStateListener); - subchannel.unref(); - } - this.currentSubchannelIndex = 0; - this.subchannelStateCounts = { - [channel_1.ConnectivityState.CONNECTING]: 0, - [channel_1.ConnectivityState.IDLE]: 0, - [channel_1.ConnectivityState.READY]: 0, - [channel_1.ConnectivityState.SHUTDOWN]: 0, - [channel_1.ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannels = []; - this.triedAllSubchannels = false; - } - /** - * Start connecting to the address list most recently passed to - * `updateAddressList`. - */ - connectToAddressList() { - this.resetSubchannelList(); - trace('Connect to address list ' + - this.latestAddressList.map((address) => subchannel_1.subchannelAddressToString(address))); - this.subchannels = this.latestAddressList.map((address) => this.channelControlHelper.createSubchannel(address, {})); - for (const subchannel of this.subchannels) { - subchannel.ref(); - } - for (const subchannel of this.subchannels) { - subchannel.addConnectivityStateListener(this.subchannelStateListener); - this.subchannelStateCounts[subchannel.getConnectivityState()] += 1; - if (subchannel.getConnectivityState() === channel_1.ConnectivityState.READY) { - this.pickSubchannel(subchannel); - this.resetSubchannelList(); - return; - } - } - for (const [index, subchannel] of this.subchannels.entries()) { - const subchannelState = subchannel.getConnectivityState(); - if (subchannelState === channel_1.ConnectivityState.IDLE || - subchannelState === channel_1.ConnectivityState.CONNECTING) { - this.startConnecting(index); - if (this.currentPick === null) { - this.updateState(channel_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this)); - } - return; - } - } - // If the code reaches this point, every subchannel must be in TRANSIENT_FAILURE - if (this.currentPick === null) { - this.updateState(channel_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker()); - } - } - updateAddressList(addressList, lbConfig) { - // lbConfig has no useful information for pick first load balancing - /* To avoid unnecessary churn, we only do something with this address list - * if we're not currently trying to establish a connection, or if the new - * address list is different from the existing one */ - if (this.subchannels.length === 0 || - !this.latestAddressList.every((value, index) => addressList[index] === value)) { - this.latestAddressList = addressList; - this.connectToAddressList(); - } - } - exitIdle() { - for (const subchannel of this.subchannels) { - subchannel.startConnecting(); - } - if (this.currentState === channel_1.ConnectivityState.IDLE) { - if (this.latestAddressList.length > 0) { - this.connectToAddressList(); - } - } - if (this.currentState === channel_1.ConnectivityState.IDLE || - this.triedAllSubchannels) { - this.channelControlHelper.requestReresolution(); - } - } - resetBackoff() { - /* The pick first load balancer does not have a connection backoff, so this - * does nothing */ - } - destroy() { - this.resetSubchannelList(); - if (this.currentPick !== null) { - this.currentPick.unref(); - this.currentPick.removeConnectivityStateListener(this.pickedSubchannelStateListener); - } - } - getTypeName() { - return TYPE_NAME; - } -} -exports.PickFirstLoadBalancer = PickFirstLoadBalancer; -function setup() { - load_balancer_1.registerLoadBalancerType(TYPE_NAME, PickFirstLoadBalancer, PickFirstLoadBalancingConfig); -} -exports.setup = setup; -//# sourceMappingURL=load-balancer-pick-first.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js.map b/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js.map deleted file mode 100644 index d33d83ff..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-balancer-pick-first.js","sourceRoot":"","sources":["../../src/load-balancer-pick-first.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mDAKyB;AACzB,uCAA8C;AAC9C,qCAOkB;AAClB,6CAKsB;AACtB,qCAAqC;AACrC,2CAA2C;AAE3C,MAAM,WAAW,GAAG,YAAY,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B,CACnC,CAAC;SACH;IACH,CAAC;IAED,WAAW;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArWD,sDAqWC;AAED,SAAgB,KAAK;IACnB,wCAAwB,CAAC,SAAS,EAAE,qBAAqB,EAAE,4BAA4B,CAAC,CAAC;AAC3F,CAAC;AAFD,sBAEC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.d.ts b/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.d.ts deleted file mode 100644 index 87d5be55..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { LoadBalancer, ChannelControlHelper, LoadBalancingConfig } from './load-balancer'; -import { SubchannelAddress } from './subchannel'; -export declare class RoundRobinLoadBalancer implements LoadBalancer { - private readonly channelControlHelper; - private subchannels; - private currentState; - private subchannelStateListener; - private subchannelStateCounts; - private currentReadyPicker; - constructor(channelControlHelper: ChannelControlHelper); - private calculateAndUpdateState; - private updateState; - private resetSubchannelList; - updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig): void; - exitIdle(): void; - resetBackoff(): void; - destroy(): void; - getTypeName(): string; -} -export declare function setup(): void; diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js b/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js deleted file mode 100644 index 322c9ff6..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.setup = exports.RoundRobinLoadBalancer = void 0; -const load_balancer_1 = require("./load-balancer"); -const channel_1 = require("./channel"); -const picker_1 = require("./picker"); -const subchannel_1 = require("./subchannel"); -const logging = require("./logging"); -const constants_1 = require("./constants"); -const TRACER_NAME = 'round_robin'; -function trace(text) { - logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); -} -const TYPE_NAME = 'round_robin'; -class RoundRobinLoadBalancingConfig { - getLoadBalancerName() { - return TYPE_NAME; - } - constructor() { } - toJsonObject() { - return { - [TYPE_NAME]: {} - }; - } - static createFromJson(obj) { - return new RoundRobinLoadBalancingConfig(); - } -} -class RoundRobinPicker { - constructor(subchannelList, nextIndex = 0) { - this.subchannelList = subchannelList; - this.nextIndex = nextIndex; - } - pick(pickArgs) { - const pickedSubchannel = this.subchannelList[this.nextIndex]; - this.nextIndex = (this.nextIndex + 1) % this.subchannelList.length; - return { - pickResultType: picker_1.PickResultType.COMPLETE, - subchannel: pickedSubchannel, - status: null, - extraFilterFactory: null, - onCallStarted: null, - }; - } - /** - * Check what the next subchannel returned would be. Used by the load - * balancer implementation to preserve this part of the picker state if - * possible when a subchannel connects or disconnects. - */ - peekNextSubchannel() { - return this.subchannelList[this.nextIndex]; - } -} -class RoundRobinLoadBalancer { - constructor(channelControlHelper) { - this.channelControlHelper = channelControlHelper; - this.subchannels = []; - this.currentState = channel_1.ConnectivityState.IDLE; - this.currentReadyPicker = null; - this.subchannelStateCounts = { - [channel_1.ConnectivityState.CONNECTING]: 0, - [channel_1.ConnectivityState.IDLE]: 0, - [channel_1.ConnectivityState.READY]: 0, - [channel_1.ConnectivityState.SHUTDOWN]: 0, - [channel_1.ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannelStateListener = (subchannel, previousState, newState) => { - this.subchannelStateCounts[previousState] -= 1; - this.subchannelStateCounts[newState] += 1; - this.calculateAndUpdateState(); - if (newState === channel_1.ConnectivityState.TRANSIENT_FAILURE) { - this.channelControlHelper.requestReresolution(); - } - if (newState === channel_1.ConnectivityState.TRANSIENT_FAILURE || - newState === channel_1.ConnectivityState.IDLE) { - subchannel.startConnecting(); - } - }; - } - calculateAndUpdateState() { - if (this.subchannelStateCounts[channel_1.ConnectivityState.READY] > 0) { - const readySubchannels = this.subchannels.filter((subchannel) => subchannel.getConnectivityState() === channel_1.ConnectivityState.READY); - let index = 0; - if (this.currentReadyPicker !== null) { - index = readySubchannels.indexOf(this.currentReadyPicker.peekNextSubchannel()); - if (index < 0) { - index = 0; - } - } - this.updateState(channel_1.ConnectivityState.READY, new RoundRobinPicker(readySubchannels, index)); - } - else if (this.subchannelStateCounts[channel_1.ConnectivityState.CONNECTING] > 0) { - this.updateState(channel_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this)); - } - else if (this.subchannelStateCounts[channel_1.ConnectivityState.TRANSIENT_FAILURE] > 0) { - this.updateState(channel_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker()); - } - else { - this.updateState(channel_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this)); - } - } - updateState(newState, picker) { - trace(channel_1.ConnectivityState[this.currentState] + - ' -> ' + - channel_1.ConnectivityState[newState]); - if (newState === channel_1.ConnectivityState.READY) { - this.currentReadyPicker = picker; - } - else { - this.currentReadyPicker = null; - } - this.currentState = newState; - this.channelControlHelper.updateState(newState, picker); - } - resetSubchannelList() { - for (const subchannel of this.subchannels) { - subchannel.removeConnectivityStateListener(this.subchannelStateListener); - subchannel.unref(); - } - this.subchannelStateCounts = { - [channel_1.ConnectivityState.CONNECTING]: 0, - [channel_1.ConnectivityState.IDLE]: 0, - [channel_1.ConnectivityState.READY]: 0, - [channel_1.ConnectivityState.SHUTDOWN]: 0, - [channel_1.ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannels = []; - } - updateAddressList(addressList, lbConfig) { - this.resetSubchannelList(); - trace('Connect to address list ' + - addressList.map((address) => subchannel_1.subchannelAddressToString(address))); - this.subchannels = addressList.map((address) => this.channelControlHelper.createSubchannel(address, {})); - for (const subchannel of this.subchannels) { - subchannel.ref(); - subchannel.addConnectivityStateListener(this.subchannelStateListener); - const subchannelState = subchannel.getConnectivityState(); - this.subchannelStateCounts[subchannelState] += 1; - if (subchannelState === channel_1.ConnectivityState.IDLE || - subchannelState === channel_1.ConnectivityState.TRANSIENT_FAILURE) { - subchannel.startConnecting(); - } - } - this.calculateAndUpdateState(); - } - exitIdle() { - for (const subchannel of this.subchannels) { - subchannel.startConnecting(); - } - } - resetBackoff() { - /* The pick first load balancer does not have a connection backoff, so this - * does nothing */ - } - destroy() { - this.resetSubchannelList(); - } - getTypeName() { - return TYPE_NAME; - } -} -exports.RoundRobinLoadBalancer = RoundRobinLoadBalancer; -function setup() { - load_balancer_1.registerLoadBalancerType(TYPE_NAME, RoundRobinLoadBalancer, RoundRobinLoadBalancingConfig); -} -exports.setup = setup; -//# sourceMappingURL=load-balancer-round-robin.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js.map b/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js.map deleted file mode 100644 index 1fc5ff82..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-balancer-round-robin.js","sourceRoot":"","sources":["../../src/load-balancer-round-robin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mDAKyB;AACzB,uCAA8C;AAC9C,qCAOkB;AAClB,6CAKsB;AACtB,qCAAqC;AACrC,2CAA2C;AAE3C,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC,MAAM,6BAA6B;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,UAAU,CAAC,eAAe,EAAE,CAAC;SAC9B;IACH,CAAC;IACD,YAAY;QACV;0BACkB;IACpB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IACD,WAAW;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAjJD,wDAiJC;AAED,SAAgB,KAAK;IACnB,wCAAwB,CAAC,SAAS,EAAE,sBAAsB,EAAE,6BAA6B,CAAC,CAAC;AAC7F,CAAC;AAFD,sBAEC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer.d.ts b/node_modules/@grpc/grpc-js/build/src/load-balancer.d.ts deleted file mode 100644 index 6a03dc3e..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { ChannelOptions } from './channel-options'; -import { Subchannel, SubchannelAddress } from './subchannel'; -import { ConnectivityState } from './channel'; -import { Picker } from './picker'; -/** - * A collection of functions associated with a channel that a load balancer - * can call as necessary. - */ -export interface ChannelControlHelper { - /** - * Returns a subchannel connected to the specified address. - * @param subchannelAddress The address to connect to - * @param subchannelArgs Extra channel arguments specified by the load balancer - */ - createSubchannel(subchannelAddress: SubchannelAddress, subchannelArgs: ChannelOptions): Subchannel; - /** - * Passes a new subchannel picker up to the channel. This is called if either - * the connectivity state changes or if a different picker is needed for any - * other reason. - * @param connectivityState New connectivity state - * @param picker New picker - */ - updateState(connectivityState: ConnectivityState, picker: Picker): void; - /** - * Request new data from the resolver. - */ - requestReresolution(): void; -} -/** - * Tracks one or more connected subchannels and determines which subchannel - * each request should use. - */ -export interface LoadBalancer { - /** - * Gives the load balancer a new list of addresses to start connecting to. - * The load balancer will start establishing connections with the new list, - * but will continue using any existing connections until the new connections - * are established - * @param addressList The new list of addresses to connect to - * @param lbConfig The load balancing config object from the service config, - * if one was provided - */ - updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig, attributes: { - [key: string]: unknown; - }): void; - /** - * If the load balancer is currently in the IDLE state, start connecting. - */ - exitIdle(): void; - /** - * If the load balancer is currently in the CONNECTING or TRANSIENT_FAILURE - * state, reset the current connection backoff timeout to its base value and - * transition to CONNECTING if in TRANSIENT_FAILURE. - */ - resetBackoff(): void; - /** - * The load balancer unrefs all of its subchannels and stops calling methods - * of its channel control helper. - */ - destroy(): void; - /** - * Get the type name for this load balancer type. Must be constant across an - * entire load balancer implementation class and must match the name that the - * balancer implementation class was registered with. - */ - getTypeName(): string; -} -export interface LoadBalancerConstructor { - new (channelControlHelper: ChannelControlHelper): LoadBalancer; -} -export interface LoadBalancingConfig { - getLoadBalancerName(): string; - toJsonObject(): object; -} -export interface LoadBalancingConfigConstructor { - new (...args: any): LoadBalancingConfig; - createFromJson(obj: any): LoadBalancingConfig; -} -export declare function registerLoadBalancerType(typeName: string, loadBalancerType: LoadBalancerConstructor, loadBalancingConfigType: LoadBalancingConfigConstructor): void; -export declare function createLoadBalancer(config: LoadBalancingConfig, channelControlHelper: ChannelControlHelper): LoadBalancer | null; -export declare function isLoadBalancerNameRegistered(typeName: string): boolean; -export declare function getFirstUsableConfig(configs: LoadBalancingConfig[], defaultPickFirst?: true): LoadBalancingConfig; -export declare function validateLoadBalancingConfig(obj: any): LoadBalancingConfig; -export declare function registerAll(): void; diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer.js b/node_modules/@grpc/grpc-js/build/src/load-balancer.js deleted file mode 100644 index 8e740544..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.registerAll = exports.validateLoadBalancingConfig = exports.getFirstUsableConfig = exports.isLoadBalancerNameRegistered = exports.createLoadBalancer = exports.registerLoadBalancerType = void 0; -const load_balancer_pick_first = require("./load-balancer-pick-first"); -const load_balancer_round_robin = require("./load-balancer-round-robin"); -const registeredLoadBalancerTypes = {}; -function registerLoadBalancerType(typeName, loadBalancerType, loadBalancingConfigType) { - registeredLoadBalancerTypes[typeName] = { - LoadBalancer: loadBalancerType, - LoadBalancingConfig: loadBalancingConfigType - }; -} -exports.registerLoadBalancerType = registerLoadBalancerType; -function createLoadBalancer(config, channelControlHelper) { - const typeName = config.getLoadBalancerName(); - if (typeName in registeredLoadBalancerTypes) { - return new registeredLoadBalancerTypes[typeName].LoadBalancer(channelControlHelper); - } - else { - return null; - } -} -exports.createLoadBalancer = createLoadBalancer; -function isLoadBalancerNameRegistered(typeName) { - return typeName in registeredLoadBalancerTypes; -} -exports.isLoadBalancerNameRegistered = isLoadBalancerNameRegistered; -function getFirstUsableConfig(configs, defaultPickFirst = false) { - for (const config of configs) { - if (config.getLoadBalancerName() in registeredLoadBalancerTypes) { - return config; - } - } - if (defaultPickFirst) { - return new load_balancer_pick_first.PickFirstLoadBalancingConfig(); - } - else { - return null; - } -} -exports.getFirstUsableConfig = getFirstUsableConfig; -function validateLoadBalancingConfig(obj) { - if (!(obj !== null && (typeof obj === 'object'))) { - throw new Error('Load balancing config must be an object'); - } - const keys = Object.keys(obj); - if (keys.length !== 1) { - throw new Error('Provided load balancing config has multiple conflicting entries'); - } - const typeName = keys[0]; - if (typeName in registeredLoadBalancerTypes) { - return registeredLoadBalancerTypes[typeName].LoadBalancingConfig.createFromJson(obj[typeName]); - } - else { - throw new Error(`Unrecognized load balancing config name ${typeName}`); - } -} -exports.validateLoadBalancingConfig = validateLoadBalancingConfig; -function registerAll() { - load_balancer_pick_first.setup(); - load_balancer_round_robin.setup(); -} -exports.registerAll = registerAll; -//# sourceMappingURL=load-balancer.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/load-balancer.js.map b/node_modules/@grpc/grpc-js/build/src/load-balancer.js.map deleted file mode 100644 index 9ec03105..00000000 --- a/node_modules/@grpc/grpc-js/build/src/load-balancer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-balancer.js","sourceRoot":"","sources":["../../src/load-balancer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAMH,uEAAuE;AACvE,yEAAyE;AAsFzE,MAAM,2BAA2B,GAK7B,EAAE,CAAC;AAEP,SAAgB,wBAAwB,CACtC,QAAgB,EAChB,gBAAyC,EACzC,uBAAuD;IAEvD,2BAA2B,CAAC,QAAQ,CAAC,GAAG;QACtC,YAAY,EAAE,gBAAgB;QAC9B,mBAAmB,EAAE,uBAAuB;KAC7C,CAAC;AACJ,CAAC;AATD,4DASC;AAED,SAAgB,kBAAkB,CAChC,MAA2B,EAC3B,oBAA0C;IAE1C,MAAM,QAAQ,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAC9C,IAAI,QAAQ,IAAI,2BAA2B,EAAE;QAC3C,OAAO,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;KACrF;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAVD,gDAUC;AAED,SAAgB,4BAA4B,CAAC,QAAgB;IAC3D,OAAO,QAAQ,IAAI,2BAA2B,CAAC;AACjD,CAAC;AAFD,oEAEC;AAGD,SAAgB,oBAAoB,CAClC,OAA8B,EAC9B,mBAA4B,KAAK;IAEjC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,IAAI,MAAM,CAAC,mBAAmB,EAAE,IAAI,2BAA2B,EAAE;YAC/D,OAAO,MAAM,CAAC;SACf;KACF;IACD,IAAI,gBAAgB,EAAE;QACpB,OAAO,IAAI,wBAAwB,CAAC,4BAA4B,EAAE,CAAA;KACnE;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAdD,oDAcC;AAED,SAAgB,2BAA2B,CAAC,GAAQ;IAClD,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,IAAK,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,EAAE;QACjD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;KACpF;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,QAAQ,IAAI,2BAA2B,EAAE;QAC3C,OAAO,2BAA2B,CAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;KAChG;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,2CAA2C,QAAQ,EAAE,CAAC,CAAC;KACxE;AACH,CAAC;AAdD,kEAcC;AAED,SAAgB,WAAW;IACzB,wBAAwB,CAAC,KAAK,EAAE,CAAC;IACjC,yBAAyB,CAAC,KAAK,EAAE,CAAC;AACpC,CAAC;AAHD,kCAGC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/logging.d.ts b/node_modules/@grpc/grpc-js/build/src/logging.d.ts deleted file mode 100644 index 8de60013..00000000 --- a/node_modules/@grpc/grpc-js/build/src/logging.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -import { LogVerbosity } from './constants'; -export declare const getLogger: () => Partial; -export declare const setLogger: (logger: Partial) => void; -export declare const setLoggerVerbosity: (verbosity: LogVerbosity) => void; -export declare const log: (severity: LogVerbosity, ...args: any[]) => void; -export declare function trace(severity: LogVerbosity, tracer: string, text: string): void; diff --git a/node_modules/@grpc/grpc-js/build/src/logging.js b/node_modules/@grpc/grpc-js/build/src/logging.js deleted file mode 100644 index e578cf54..00000000 --- a/node_modules/@grpc/grpc-js/build/src/logging.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -var _a, _b, _c, _d; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.trace = exports.log = exports.setLoggerVerbosity = exports.setLogger = exports.getLogger = void 0; -const constants_1 = require("./constants"); -let _logger = console; -let _logVerbosity = constants_1.LogVerbosity.ERROR; -const verbosityString = (_b = (_a = process.env.GRPC_NODE_VERBOSITY) !== null && _a !== void 0 ? _a : process.env.GRPC_VERBOSITY) !== null && _b !== void 0 ? _b : ''; -switch (verbosityString) { - case 'DEBUG': - _logVerbosity = constants_1.LogVerbosity.DEBUG; - break; - case 'INFO': - _logVerbosity = constants_1.LogVerbosity.INFO; - break; - case 'ERROR': - _logVerbosity = constants_1.LogVerbosity.ERROR; - break; - default: - // Ignore any other values -} -exports.getLogger = () => { - return _logger; -}; -exports.setLogger = (logger) => { - _logger = logger; -}; -exports.setLoggerVerbosity = (verbosity) => { - _logVerbosity = verbosity; -}; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -exports.log = (severity, ...args) => { - if (severity >= _logVerbosity && typeof _logger.error === 'function') { - _logger.error(...args); - } -}; -const tracersString = (_d = (_c = process.env.GRPC_NODE_TRACE) !== null && _c !== void 0 ? _c : process.env.GRPC_TRACE) !== null && _d !== void 0 ? _d : ''; -const enabledTracers = tracersString.split(','); -const allEnabled = enabledTracers.includes('all'); -function trace(severity, tracer, text) { - if (allEnabled || enabledTracers.includes(tracer)) { - exports.log(severity, new Date().toISOString() + ' | ' + tracer + ' | ' + text); - } -} -exports.trace = trace; -//# sourceMappingURL=logging.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/logging.js.map b/node_modules/@grpc/grpc-js/build/src/logging.js.map deleted file mode 100644 index eeb23f7f..00000000 --- a/node_modules/@grpc/grpc-js/build/src/logging.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;AAEH,2CAA2C;AAE3C,IAAI,OAAO,GAAqB,OAAO,CAAC;AACxC,IAAI,aAAa,GAAiB,wBAAY,CAAC,KAAK,CAAC;AAErD,MAAM,eAAe,eAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,mCAAI,OAAO,CAAC,GAAG,CAAC,cAAc,mCAAI,EAAE,CAAC;AAE5F,QAAQ,eAAe,EAAE;IACvB,KAAK,OAAO;QACV,aAAa,GAAG,wBAAY,CAAC,KAAK,CAAC;QACnC,MAAM;IACR,KAAK,MAAM;QACT,aAAa,GAAG,wBAAY,CAAC,IAAI,CAAC;QAClC,MAAM;IACR,KAAK,OAAO;QACV,aAAa,GAAG,wBAAY,CAAC,KAAK,CAAC;QACnC,MAAM;IACR,QAAQ;IACR,0BAA0B;CAC3B;AAEY,QAAA,SAAS,GAAG,GAAqB,EAAE;IAC9C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEW,QAAA,SAAS,GAAG,CAAC,MAAwB,EAAQ,EAAE;IAC1D,OAAO,GAAG,MAAM,CAAC;AACnB,CAAC,CAAC;AAEW,QAAA,kBAAkB,GAAG,CAAC,SAAuB,EAAQ,EAAE;IAClE,aAAa,GAAG,SAAS,CAAC;AAC5B,CAAC,CAAC;AAEF,8DAA8D;AACjD,QAAA,GAAG,GAAG,CAAC,QAAsB,EAAE,GAAG,IAAW,EAAQ,EAAE;IAClE,IAAI,QAAQ,IAAI,aAAa,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE;QACpE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;KACxB;AACH,CAAC,CAAC;AAEF,MAAM,aAAa,eAAG,OAAO,CAAC,GAAG,CAAC,eAAe,mCAAI,OAAO,CAAC,GAAG,CAAC,UAAU,mCAAI,EAAE,CAAC;AAClF,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAElD,SAAgB,KAAK,CACnB,QAAsB,EACtB,MAAc,EACd,IAAY;IAEZ,IAAI,UAAU,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjD,WAAG,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;KACzE;AACH,CAAC;AARD,sBAQC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/make-client.d.ts b/node_modules/@grpc/grpc-js/build/src/make-client.d.ts deleted file mode 100644 index 9b53541e..00000000 --- a/node_modules/@grpc/grpc-js/build/src/make-client.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// -import { ChannelCredentials } from './channel-credentials'; -import { ChannelOptions } from './channel-options'; -import { Client } from './client'; -import { UntypedServiceImplementation } from './server'; -export interface Serialize { - (value: T): Buffer; -} -export interface Deserialize { - (bytes: Buffer): T; -} -export interface ClientMethodDefinition { - path: string; - requestStream: boolean; - responseStream: boolean; - requestSerialize: Serialize; - responseDeserialize: Deserialize; - originalName?: string; -} -export interface ServerMethodDefinition { - path: string; - requestStream: boolean; - responseStream: boolean; - responseSerialize: Serialize; - requestDeserialize: Deserialize; - originalName?: string; -} -export interface MethodDefinition extends ClientMethodDefinition, ServerMethodDefinition { -} -export declare type ServiceDefinition = { - readonly [index in keyof ImplementationType]: MethodDefinition; -}; -export interface ProtobufTypeDefinition { - format: string; - type: object; - fileDescriptorProtos: Buffer[]; -} -export interface PackageDefinition { - [index: string]: ServiceDefinition | ProtobufTypeDefinition; -} -export interface ServiceClient extends Client { - [methodName: string]: Function; -} -export interface ServiceClientConstructor { - new (address: string, credentials: ChannelCredentials, options?: Partial): ServiceClient; - service: ServiceDefinition; -} -/** - * Creates a constructor for a client with the given methods, as specified in - * the methods argument. The resulting class will have an instance method for - * each method in the service, which is a partial application of one of the - * [Client]{@link grpc.Client} request methods, depending on `requestSerialize` - * and `responseSerialize`, with the `method`, `serialize`, and `deserialize` - * arguments predefined. - * @param methods An object mapping method names to - * method attributes - * @param serviceName The fully qualified name of the service - * @param classOptions An options object. - * @return New client constructor, which is a subclass of - * {@link grpc.Client}, and has the same arguments as that constructor. - */ -export declare function makeClientConstructor(methods: ServiceDefinition, serviceName: string, classOptions?: {}): ServiceClientConstructor; -export interface GrpcObject { - [index: string]: GrpcObject | ServiceClientConstructor | ProtobufTypeDefinition; -} -/** - * Load a gRPC package definition as a gRPC object hierarchy. - * @param packageDef The package definition object. - * @return The resulting gRPC object. - */ -export declare function loadPackageDefinition(packageDef: PackageDefinition): GrpcObject; diff --git a/node_modules/@grpc/grpc-js/build/src/make-client.js b/node_modules/@grpc/grpc-js/build/src/make-client.js deleted file mode 100644 index 4ef5691a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/make-client.js +++ /dev/null @@ -1,135 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.loadPackageDefinition = exports.makeClientConstructor = void 0; -const client_1 = require("./client"); -/** - * Map with short names for each of the requester maker functions. Used in - * makeClientConstructor - * @private - */ -const requesterFuncs = { - unary: client_1.Client.prototype.makeUnaryRequest, - server_stream: client_1.Client.prototype.makeServerStreamRequest, - client_stream: client_1.Client.prototype.makeClientStreamRequest, - bidi: client_1.Client.prototype.makeBidiStreamRequest, -}; -/** - * Creates a constructor for a client with the given methods, as specified in - * the methods argument. The resulting class will have an instance method for - * each method in the service, which is a partial application of one of the - * [Client]{@link grpc.Client} request methods, depending on `requestSerialize` - * and `responseSerialize`, with the `method`, `serialize`, and `deserialize` - * arguments predefined. - * @param methods An object mapping method names to - * method attributes - * @param serviceName The fully qualified name of the service - * @param classOptions An options object. - * @return New client constructor, which is a subclass of - * {@link grpc.Client}, and has the same arguments as that constructor. - */ -function makeClientConstructor(methods, serviceName, classOptions) { - if (!classOptions) { - classOptions = {}; - } - class ServiceClientImpl extends client_1.Client { - } - Object.keys(methods).forEach((name) => { - if (name === '__proto__') { - return; - } - const attrs = methods[name]; - let methodType; - // TODO(murgatroid99): Verify that we don't need this anymore - if (typeof name === 'string' && name.charAt(0) === '$') { - throw new Error('Method names cannot start with $'); - } - if (attrs.requestStream) { - if (attrs.responseStream) { - methodType = 'bidi'; - } - else { - methodType = 'client_stream'; - } - } - else { - if (attrs.responseStream) { - methodType = 'server_stream'; - } - else { - methodType = 'unary'; - } - } - const serialize = attrs.requestSerialize; - const deserialize = attrs.responseDeserialize; - const methodFunc = partial(requesterFuncs[methodType], attrs.path, serialize, deserialize); - ServiceClientImpl.prototype[name] = methodFunc; - // Associate all provided attributes with the method - Object.assign(ServiceClientImpl.prototype[name], attrs); - if (attrs.originalName && attrs.originalName !== '__proto__') { - ServiceClientImpl.prototype[attrs.originalName] = - ServiceClientImpl.prototype[name]; - } - }); - ServiceClientImpl.service = methods; - return ServiceClientImpl; -} -exports.makeClientConstructor = makeClientConstructor; -function partial(fn, path, serialize, deserialize) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return function (...args) { - return fn.call(this, path, serialize, deserialize, ...args); - }; -} -function isProtobufTypeDefinition(obj) { - return 'format' in obj; -} -/** - * Load a gRPC package definition as a gRPC object hierarchy. - * @param packageDef The package definition object. - * @return The resulting gRPC object. - */ -function loadPackageDefinition(packageDef) { - const result = {}; - for (const serviceFqn in packageDef) { - if (Object.prototype.hasOwnProperty.call(packageDef, serviceFqn)) { - const service = packageDef[serviceFqn]; - const nameComponents = serviceFqn.split('.'); - if (nameComponents.some(comp => comp === '__proto__')) { - continue; - } - const serviceName = nameComponents[nameComponents.length - 1]; - let current = result; - for (const packageName of nameComponents.slice(0, -1)) { - if (!current[packageName]) { - current[packageName] = {}; - } - current = current[packageName]; - } - if (isProtobufTypeDefinition(service)) { - current[serviceName] = service; - } - else { - current[serviceName] = makeClientConstructor(service, serviceName, {}); - } - } - } - return result; -} -exports.loadPackageDefinition = loadPackageDefinition; -//# sourceMappingURL=make-client.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/make-client.js.map b/node_modules/@grpc/grpc-js/build/src/make-client.js.map deleted file mode 100644 index fe667c66..00000000 --- a/node_modules/@grpc/grpc-js/build/src/make-client.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"make-client.js","sourceRoot":"","sources":["../../src/make-client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,qCAAkC;AAmDlC;;;;GAIG;AACH,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,eAAM,CAAC,SAAS,CAAC,gBAAgB;IACxC,aAAa,EAAE,eAAM,CAAC,SAAS,CAAC,uBAAuB;IACvD,aAAa,EAAE,eAAM,CAAC,SAAS,CAAC,uBAAuB;IACvD,IAAI,EAAE,eAAM,CAAC,SAAS,CAAC,qBAAqB;CAC7C,CAAC;AAeF;;;;;;;;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K,MAAM,WAAW,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;gBACrD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;oBACzB,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;iBAC3B;gBACD,OAAO,GAAG,OAAO,CAAC,WAAW,CAAe,CAAC;aAC9C;YACD,IAAI,wBAAwB,CAAC,OAAO,CAAC,EAAE;gBACrC,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;aAChC;iBAAM;gBACL,OAAO,CAAC,WAAW,CAAC,GAAG,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;aACxE;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AA3BD,sDA2BC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.d.ts b/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.d.ts deleted file mode 100644 index b3a46115..00000000 --- a/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// -import { BaseFilter, Filter, FilterFactory } from "./filter"; -import { Call, WriteObject } from "./call-stream"; -import { ChannelOptions } from "./channel-options"; -export declare class MaxMessageSizeFilter extends BaseFilter implements Filter { - private readonly options; - private readonly callStream; - private maxSendMessageSize; - private maxReceiveMessageSize; - constructor(options: ChannelOptions, callStream: Call); - sendMessage(message: Promise): Promise; - receiveMessage(message: Promise): Promise; -} -export declare class MaxMessageSizeFilterFactory implements FilterFactory { - private readonly options; - constructor(options: ChannelOptions); - createFilter(callStream: Call): MaxMessageSizeFilter; -} diff --git a/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js b/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js deleted file mode 100644 index dd8ab24f..00000000 --- a/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -/* - * Copyright 2020 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MaxMessageSizeFilterFactory = exports.MaxMessageSizeFilter = void 0; -const filter_1 = require("./filter"); -const constants_1 = require("./constants"); -class MaxMessageSizeFilter extends filter_1.BaseFilter { - constructor(options, callStream) { - super(); - this.options = options; - this.callStream = callStream; - this.maxSendMessageSize = constants_1.DEFAULT_MAX_SEND_MESSAGE_LENGTH; - this.maxReceiveMessageSize = constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH; - if ('grpc.max_send_message_length' in options) { - this.maxSendMessageSize = options['grpc.max_send_message_length']; - } - if ('grpc.max_receive_message_length' in options) { - this.maxReceiveMessageSize = options['grpc.max_receive_message_length']; - } - } - async sendMessage(message) { - /* A configured size of -1 means that there is no limit, so skip the check - * entirely */ - if (this.maxSendMessageSize === -1) { - return message; - } - else { - const concreteMessage = await message; - if (concreteMessage.message.length > this.maxSendMessageSize) { - this.callStream.cancelWithStatus(constants_1.Status.RESOURCE_EXHAUSTED, `Sent message larger than max (${concreteMessage.message.length} vs. ${this.maxSendMessageSize})`); - return Promise.reject('Message too large'); - } - else { - return concreteMessage; - } - } - } - async receiveMessage(message) { - /* A configured size of -1 means that there is no limit, so skip the check - * entirely */ - if (this.maxReceiveMessageSize === -1) { - return message; - } - else { - const concreteMessage = await message; - if (concreteMessage.length > this.maxReceiveMessageSize) { - this.callStream.cancelWithStatus(constants_1.Status.RESOURCE_EXHAUSTED, `Received message larger than max (${concreteMessage.length} vs. ${this.maxReceiveMessageSize})`); - return Promise.reject('Message too large'); - } - else { - return concreteMessage; - } - } - } -} -exports.MaxMessageSizeFilter = MaxMessageSizeFilter; -class MaxMessageSizeFilterFactory { - constructor(options) { - this.options = options; - } - createFilter(callStream) { - return new MaxMessageSizeFilter(this.options, callStream); - } -} -exports.MaxMessageSizeFilterFactory = MaxMessageSizeFilterFactory; -//# sourceMappingURL=max-message-size-filter.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js.map b/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js.map deleted file mode 100644 index d3ab6859..00000000 --- a/node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"max-message-size-filter.js","sourceRoot":"","sources":["../../src/max-message-size-filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,qCAA6D;AAE7D,2CAA0G;AAG1G,MAAa,oBAAqB,SAAQ,mBAAU;IAGlD,YACmB,OAAuB,EACvB,UAAgB;QAEjC,KAAK,EAAE,CAAC;QAHS,YAAO,GAAP,OAAO,CAAgB;QACvB,eAAU,GAAV,UAAU,CAAM;QAJ3B,uBAAkB,GAAW,2CAA+B,CAAC;QAC7D,0BAAqB,GAAW,8CAAkC,CAAC;QAMzE,IAAI,8BAA8B,IAAI,OAAO,EAAE;YAC7C,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,8BAA8B,CAAE,CAAC;SACpE;QACD,IAAI,iCAAiC,IAAI,OAAO,EAAE;YAChD,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,iCAAiC,CAAE,CAAC;SAC1E;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA6B;QAC7C;sBACc;QACd,IAAI,IAAI,CAAC,kBAAkB,KAAK,CAAC,CAAC,EAAE;YAClC,OAAO,OAAO,CAAC;SAChB;aAAM;YACL,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC;YACtC,IAAI,eAAe,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE;gBAC5D,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,kBAAM,CAAC,kBAAkB,EAAE,iCAAiC,eAAe,CAAC,OAAO,CAAC,MAAM,QAAQ,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;gBAC/J,OAAO,OAAO,CAAC,MAAM,CAAc,mBAAmB,CAAC,CAAC;aACzD;iBAAM;gBACL,OAAO,eAAe,CAAC;aACxB;SACF;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAwB;QAC3C;sBACc;QACd,IAAI,IAAI,CAAC,qBAAqB,KAAK,CAAC,CAAC,EAAE;YACrC,OAAO,OAAO,CAAC;SAChB;aAAM;YACL,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC;YACtC,IAAI,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,EAAE;gBACvD,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,kBAAM,CAAC,kBAAkB,EAAE,qCAAqC,eAAe,CAAC,MAAM,QAAQ,IAAI,CAAC,qBAAqB,GAAG,CAAC,CAAC;gBAC9J,OAAO,OAAO,CAAC,MAAM,CAAS,mBAAmB,CAAC,CAAC;aACpD;iBAAM;gBACL,OAAO,eAAe,CAAC;aACxB;SACF;IACH,CAAC;CACF;AA/CD,oDA+CC;AAED,MAAa,2BAA2B;IACtC,YAA6B,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAExD,YAAY,CAAC,UAAgB;QAC3B,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5D,CAAC;CACF;AAND,kEAMC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/metadata.d.ts b/node_modules/@grpc/grpc-js/build/src/metadata.d.ts deleted file mode 100644 index 26fbb941..00000000 --- a/node_modules/@grpc/grpc-js/build/src/metadata.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/// -import * as http2 from 'http2'; -export declare type MetadataValue = string | Buffer; -export declare type MetadataObject = Map; -export interface MetadataOptions { - idempotentRequest?: boolean; - waitForReady?: boolean; - cacheableRequest?: boolean; - corked?: boolean; -} -/** - * A class for storing metadata. Keys are normalized to lowercase ASCII. - */ -export declare class Metadata { - protected internalRepr: MetadataObject; - private options; - constructor(options?: MetadataOptions); - /** - * Sets the given value for the given key by replacing any other values - * associated with that key. Normalizes the key. - * @param key The key to whose value should be set. - * @param value The value to set. Must be a buffer if and only - * if the normalized key ends with '-bin'. - */ - set(key: string, value: MetadataValue): void; - /** - * Adds the given value for the given key by appending to a list of previous - * values associated with that key. Normalizes the key. - * @param key The key for which a new value should be appended. - * @param value The value to add. Must be a buffer if and only - * if the normalized key ends with '-bin'. - */ - add(key: string, value: MetadataValue): void; - /** - * Removes the given key and any associated values. Normalizes the key. - * @param key The key whose values should be removed. - */ - remove(key: string): void; - /** - * Gets a list of all values associated with the key. Normalizes the key. - * @param key The key whose value should be retrieved. - * @return A list of values associated with the given key. - */ - get(key: string): MetadataValue[]; - /** - * Gets a plain object mapping each key to the first value associated with it. - * This reflects the most common way that people will want to see metadata. - * @return A key/value mapping of the metadata. - */ - getMap(): { - [key: string]: MetadataValue; - }; - /** - * Clones the metadata object. - * @return The newly cloned object. - */ - clone(): Metadata; - /** - * Merges all key-value pairs from a given Metadata object into this one. - * If both this object and the given object have values in the same key, - * values from the other Metadata object will be appended to this object's - * values. - * @param other A Metadata object. - */ - merge(other: Metadata): void; - setOptions(options: MetadataOptions): void; - getOptions(): MetadataOptions; - /** - * Creates an OutgoingHttpHeaders object that can be used with the http2 API. - */ - toHttp2Headers(): http2.OutgoingHttpHeaders; - private _getCoreRepresentation; - /** - * Returns a new Metadata object based fields in a given IncomingHttpHeaders - * object. - * @param headers An IncomingHttpHeaders object. - */ - static fromHttp2Headers(headers: http2.IncomingHttpHeaders): Metadata; -} diff --git a/node_modules/@grpc/grpc-js/build/src/metadata.js b/node_modules/@grpc/grpc-js/build/src/metadata.js deleted file mode 100644 index d2068610..00000000 --- a/node_modules/@grpc/grpc-js/build/src/metadata.js +++ /dev/null @@ -1,250 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Metadata = void 0; -const logging_1 = require("./logging"); -const constants_1 = require("./constants"); -const LEGAL_KEY_REGEX = /^[0-9a-z_.-]+$/; -const LEGAL_NON_BINARY_VALUE_REGEX = /^[ -~]*$/; -function isLegalKey(key) { - return LEGAL_KEY_REGEX.test(key); -} -function isLegalNonBinaryValue(value) { - return LEGAL_NON_BINARY_VALUE_REGEX.test(value); -} -function isBinaryKey(key) { - return key.endsWith('-bin'); -} -function isCustomMetadata(key) { - return !key.startsWith('grpc-'); -} -function normalizeKey(key) { - return key.toLowerCase(); -} -function validate(key, value) { - if (!isLegalKey(key)) { - throw new Error('Metadata key "' + key + '" contains illegal characters'); - } - if (value !== null && value !== undefined) { - if (isBinaryKey(key)) { - if (!(value instanceof Buffer)) { - throw new Error("keys that end with '-bin' must have Buffer values"); - } - } - else { - if (value instanceof Buffer) { - throw new Error("keys that don't end with '-bin' must have String values"); - } - if (!isLegalNonBinaryValue(value)) { - throw new Error('Metadata string value "' + value + '" contains illegal characters'); - } - } - } -} -/** - * A class for storing metadata. Keys are normalized to lowercase ASCII. - */ -class Metadata { - constructor(options) { - this.internalRepr = new Map(); - if (options === undefined) { - this.options = {}; - } - else { - this.options = options; - } - } - /** - * Sets the given value for the given key by replacing any other values - * associated with that key. Normalizes the key. - * @param key The key to whose value should be set. - * @param value The value to set. Must be a buffer if and only - * if the normalized key ends with '-bin'. - */ - set(key, value) { - key = normalizeKey(key); - validate(key, value); - this.internalRepr.set(key, [value]); - } - /** - * Adds the given value for the given key by appending to a list of previous - * values associated with that key. Normalizes the key. - * @param key The key for which a new value should be appended. - * @param value The value to add. Must be a buffer if and only - * if the normalized key ends with '-bin'. - */ - add(key, value) { - key = normalizeKey(key); - validate(key, value); - const existingValue = this.internalRepr.get(key); - if (existingValue === undefined) { - this.internalRepr.set(key, [value]); - } - else { - existingValue.push(value); - } - } - /** - * Removes the given key and any associated values. Normalizes the key. - * @param key The key whose values should be removed. - */ - remove(key) { - key = normalizeKey(key); - validate(key); - this.internalRepr.delete(key); - } - /** - * Gets a list of all values associated with the key. Normalizes the key. - * @param key The key whose value should be retrieved. - * @return A list of values associated with the given key. - */ - get(key) { - key = normalizeKey(key); - validate(key); - return this.internalRepr.get(key) || []; - } - /** - * Gets a plain object mapping each key to the first value associated with it. - * This reflects the most common way that people will want to see metadata. - * @return A key/value mapping of the metadata. - */ - getMap() { - const result = {}; - this.internalRepr.forEach((values, key) => { - if (values.length > 0) { - const v = values[0]; - result[key] = v instanceof Buffer ? v.slice() : v; - } - }); - return result; - } - /** - * Clones the metadata object. - * @return The newly cloned object. - */ - clone() { - const newMetadata = new Metadata(this.options); - const newInternalRepr = newMetadata.internalRepr; - this.internalRepr.forEach((value, key) => { - const clonedValue = value.map((v) => { - if (v instanceof Buffer) { - return Buffer.from(v); - } - else { - return v; - } - }); - newInternalRepr.set(key, clonedValue); - }); - return newMetadata; - } - /** - * Merges all key-value pairs from a given Metadata object into this one. - * If both this object and the given object have values in the same key, - * values from the other Metadata object will be appended to this object's - * values. - * @param other A Metadata object. - */ - merge(other) { - other.internalRepr.forEach((values, key) => { - const mergedValue = (this.internalRepr.get(key) || []).concat(values); - this.internalRepr.set(key, mergedValue); - }); - } - setOptions(options) { - this.options = options; - } - getOptions() { - return this.options; - } - /** - * Creates an OutgoingHttpHeaders object that can be used with the http2 API. - */ - toHttp2Headers() { - // NOTE: Node <8.9 formats http2 headers incorrectly. - const result = {}; - this.internalRepr.forEach((values, key) => { - // We assume that the user's interaction with this object is limited to - // through its public API (i.e. keys and values are already validated). - result[key] = values.map((value) => { - if (value instanceof Buffer) { - return value.toString('base64'); - } - else { - return value; - } - }); - }); - return result; - } - // For compatibility with the other Metadata implementation - _getCoreRepresentation() { - return this.internalRepr; - } - /** - * Returns a new Metadata object based fields in a given IncomingHttpHeaders - * object. - * @param headers An IncomingHttpHeaders object. - */ - static fromHttp2Headers(headers) { - const result = new Metadata(); - Object.keys(headers).forEach((key) => { - // Reserved headers (beginning with `:`) are not valid keys. - if (key.charAt(0) === ':') { - return; - } - const values = headers[key]; - try { - if (isBinaryKey(key)) { - if (Array.isArray(values)) { - values.forEach((value) => { - result.add(key, Buffer.from(value, 'base64')); - }); - } - else if (values !== undefined) { - if (isCustomMetadata(key)) { - values.split(',').forEach((v) => { - result.add(key, Buffer.from(v.trim(), 'base64')); - }); - } - else { - result.add(key, Buffer.from(values, 'base64')); - } - } - } - else { - if (Array.isArray(values)) { - values.forEach((value) => { - result.add(key, value); - }); - } - else if (values !== undefined) { - result.add(key, values); - } - } - } - catch (error) { - const message = `Failed to add metadata entry ${key}: ${values}. ${error.message}. For more information see https://github.com/grpc/grpc-node/issues/1173`; - logging_1.log(constants_1.LogVerbosity.ERROR, message); - } - }); - return result; - } -} -exports.Metadata = Metadata; -//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/metadata.js.map b/node_modules/@grpc/grpc-js/build/src/metadata.js.map deleted file mode 100644 index 2088f19d..00000000 --- a/node_modules/@grpc/grpc-js/build/src/metadata.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,uCAAgC;AAChC,2CAA2C;AAC3C,MAAM,eAAe,GAAG,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AAC,KAAK,EAAE,OAAO,CAAC,CAAC;aAClC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5MD,4BA4MC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/object-stream.d.ts b/node_modules/@grpc/grpc-js/build/src/object-stream.d.ts deleted file mode 100644 index d8dfe9e6..00000000 --- a/node_modules/@grpc/grpc-js/build/src/object-stream.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// -import { Duplex, Readable, Writable } from 'stream'; -import { EmitterAugmentation1 } from './events'; -export declare type WriteCallback = (error: Error | null | undefined) => void; -export interface IntermediateObjectReadable extends Readable { - read(size?: number): any & T; -} -export declare type ObjectReadable = { - read(size?: number): T; -} & EmitterAugmentation1<'data', T> & IntermediateObjectReadable; -export interface IntermediateObjectWritable extends Writable { - _write(chunk: any & T, encoding: string, callback: Function): void; - write(chunk: any & T, cb?: WriteCallback): boolean; - write(chunk: any & T, encoding?: any, cb?: WriteCallback): boolean; - setDefaultEncoding(encoding: string): this; - end(): void; - end(chunk: any & T, cb?: Function): void; - end(chunk: any & T, encoding?: any, cb?: Function): void; -} -export interface ObjectWritable extends IntermediateObjectWritable { - _write(chunk: T, encoding: string, callback: Function): void; - write(chunk: T, cb?: Function): boolean; - write(chunk: T, encoding?: any, cb?: Function): boolean; - setDefaultEncoding(encoding: string): this; - end(): void; - end(chunk: T, cb?: Function): void; - end(chunk: T, encoding?: any, cb?: Function): void; -} -export declare type ObjectDuplex = { - read(size?: number): U; - _write(chunk: T, encoding: string, callback: Function): void; - write(chunk: T, cb?: Function): boolean; - write(chunk: T, encoding?: any, cb?: Function): boolean; - end(): void; - end(chunk: T, cb?: Function): void; - end(chunk: T, encoding?: any, cb?: Function): void; -} & Duplex & ObjectWritable & ObjectReadable; diff --git a/node_modules/@grpc/grpc-js/build/src/object-stream.js b/node_modules/@grpc/grpc-js/build/src/object-stream.js deleted file mode 100644 index b9476565..00000000 --- a/node_modules/@grpc/grpc-js/build/src/object-stream.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=object-stream.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/object-stream.js.map b/node_modules/@grpc/grpc-js/build/src/object-stream.js.map deleted file mode 100644 index fe8b6244..00000000 --- a/node_modules/@grpc/grpc-js/build/src/object-stream.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"object-stream.js","sourceRoot":"","sources":["../../src/object-stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/picker.d.ts b/node_modules/@grpc/grpc-js/build/src/picker.d.ts deleted file mode 100644 index 4cc50c8e..00000000 --- a/node_modules/@grpc/grpc-js/build/src/picker.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { Subchannel } from './subchannel'; -import { StatusObject } from './call-stream'; -import { Metadata } from './metadata'; -import { LoadBalancer } from './load-balancer'; -import { FilterFactory, Filter } from './filter'; -export declare enum PickResultType { - COMPLETE = 0, - QUEUE = 1, - TRANSIENT_FAILURE = 2, - DROP = 3 -} -export interface PickResult { - pickResultType: PickResultType; - /** - * The subchannel to use as the transport for the call. Only meaningful if - * `pickResultType` is COMPLETE. If null, indicates that the call should be - * dropped. - */ - subchannel: Subchannel | null; - /** - * The status object to end the call with. Populated if and only if - * `pickResultType` is TRANSIENT_FAILURE. - */ - status: StatusObject | null; - /** - * Extra FilterFactory (can be multiple encapsulated in a FilterStackFactory) - * provided by the load balancer to be used with the call. For technical - * reasons filters from this factory will not see sendMetadata events. - */ - extraFilterFactory: FilterFactory | null; - onCallStarted: (() => void) | null; -} -export interface CompletePickResult extends PickResult { - pickResultType: PickResultType.COMPLETE; - subchannel: Subchannel | null; - status: null; - extraFilterFactory: FilterFactory | null; - onCallStarted: (() => void) | null; -} -export interface QueuePickResult extends PickResult { - pickResultType: PickResultType.QUEUE; - subchannel: null; - status: null; - extraFilterFactory: null; - onCallStarted: null; -} -export interface TransientFailurePickResult extends PickResult { - pickResultType: PickResultType.TRANSIENT_FAILURE; - subchannel: null; - status: StatusObject; - extraFilterFactory: null; - onCallStarted: null; -} -export interface DropCallPickResult extends PickResult { - pickResultType: PickResultType.DROP; - subchannel: null; - status: StatusObject; - extraFilterFactory: null; - onCallStarted: null; -} -export interface PickArgs { - metadata: Metadata; -} -/** - * A proxy object representing the momentary state of a load balancer. Picks - * subchannels or returns other information based on that state. Should be - * replaced every time the load balancer changes state. - */ -export interface Picker { - pick(pickArgs: PickArgs): PickResult; -} -/** - * A standard picker representing a load balancer in the TRANSIENT_FAILURE - * state. Always responds to every pick request with an UNAVAILABLE status. - */ -export declare class UnavailablePicker implements Picker { - private status; - constructor(status?: StatusObject); - pick(pickArgs: PickArgs): TransientFailurePickResult; -} -/** - * A standard picker representing a load balancer in the IDLE or CONNECTING - * state. Always responds to every pick request with a QUEUE pick result - * indicating that the pick should be tried again with the next `Picker`. Also - * reports back to the load balancer that a connection should be established - * once any pick is attempted. - */ -export declare class QueuePicker { - private loadBalancer; - private calledExitIdle; - constructor(loadBalancer: LoadBalancer); - pick(pickArgs: PickArgs): QueuePickResult; -} diff --git a/node_modules/@grpc/grpc-js/build/src/picker.js b/node_modules/@grpc/grpc-js/build/src/picker.js deleted file mode 100644 index cdd9598c..00000000 --- a/node_modules/@grpc/grpc-js/build/src/picker.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.QueuePicker = exports.UnavailablePicker = exports.PickResultType = void 0; -const metadata_1 = require("./metadata"); -const constants_1 = require("./constants"); -var PickResultType; -(function (PickResultType) { - PickResultType[PickResultType["COMPLETE"] = 0] = "COMPLETE"; - PickResultType[PickResultType["QUEUE"] = 1] = "QUEUE"; - PickResultType[PickResultType["TRANSIENT_FAILURE"] = 2] = "TRANSIENT_FAILURE"; - PickResultType[PickResultType["DROP"] = 3] = "DROP"; -})(PickResultType = exports.PickResultType || (exports.PickResultType = {})); -/** - * A standard picker representing a load balancer in the TRANSIENT_FAILURE - * state. Always responds to every pick request with an UNAVAILABLE status. - */ -class UnavailablePicker { - constructor(status) { - if (status !== undefined) { - this.status = status; - } - else { - this.status = { - code: constants_1.Status.UNAVAILABLE, - details: 'No connection established', - metadata: new metadata_1.Metadata(), - }; - } - } - pick(pickArgs) { - return { - pickResultType: PickResultType.TRANSIENT_FAILURE, - subchannel: null, - status: this.status, - extraFilterFactory: null, - onCallStarted: null, - }; - } -} -exports.UnavailablePicker = UnavailablePicker; -/** - * A standard picker representing a load balancer in the IDLE or CONNECTING - * state. Always responds to every pick request with a QUEUE pick result - * indicating that the pick should be tried again with the next `Picker`. Also - * reports back to the load balancer that a connection should be established - * once any pick is attempted. - */ -class QueuePicker { - // Constructed with a load balancer. Calls exitIdle on it the first time pick is called - constructor(loadBalancer) { - this.loadBalancer = loadBalancer; - this.calledExitIdle = false; - } - pick(pickArgs) { - if (!this.calledExitIdle) { - process.nextTick(() => { - this.loadBalancer.exitIdle(); - }); - this.calledExitIdle = true; - } - return { - pickResultType: PickResultType.QUEUE, - subchannel: null, - status: null, - extraFilterFactory: null, - onCallStarted: null, - }; - } -} -exports.QueuePicker = QueuePicker; -//# sourceMappingURL=picker.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/picker.js.map b/node_modules/@grpc/grpc-js/build/src/picker.js.map deleted file mode 100644 index c50a9916..00000000 --- a/node_modules/@grpc/grpc-js/build/src/picker.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"picker.js","sourceRoot":"","sources":["../../src/picker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,yCAAsC;AACtC,2CAAqC;AAIrC,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,2DAAQ,CAAA;IACR,qDAAK,CAAA;IACL,6EAAiB,CAAA;IACjB,mDAAI,CAAA;AACN,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB;AAqED;;;GAGG;AACH,MAAa,iBAAiB;IAE5B,YAAY,MAAqB;QAC/B,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;aAAM;YACL,IAAI,CAAC,MAAM,GAAG;gBACZ,IAAI,EAAE,kBAAM,CAAC,WAAW;gBACxB,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,IAAI,mBAAQ,EAAE;aACzB,CAAC;SACH;IACH,CAAC;IACD,IAAI,CAAC,QAAkB;QACrB,OAAO;YACL,cAAc,EAAE,cAAc,CAAC,iBAAiB;YAChD,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,kBAAkB,EAAE,IAAI;YACxB,aAAa,EAAE,IAAI;SACpB,CAAC;IACJ,CAAC;CACF;AAtBD,8CAsBC;AAED;;;;;;GAMG;AACH,MAAa,WAAW;IAEtB,uFAAuF;IACvF,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAFtC,mBAAc,GAAG,KAAK,CAAC;IAEkB,CAAC;IAElD,IAAI,CAAC,QAAkB;QACrB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACpB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC/B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;SAC5B;QACD,OAAO;YACL,cAAc,EAAE,cAAc,CAAC,KAAK;YACpC,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,IAAI;YACZ,kBAAkB,EAAE,IAAI;YACxB,aAAa,EAAE,IAAI;SACpB,CAAC;IACJ,CAAC;CACF;AApBD,kCAoBC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolver-dns.d.ts b/node_modules/@grpc/grpc-js/build/src/resolver-dns.d.ts deleted file mode 100644 index 7e89e9bb..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver-dns.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Set up the DNS resolver class by registering it as the handler for the - * "dns:" prefix and as the default resolver. - */ -export declare function setup(): void; -export interface DnsUrl { - host: string; - port?: string; -} diff --git a/node_modules/@grpc/grpc-js/build/src/resolver-dns.js b/node_modules/@grpc/grpc-js/build/src/resolver-dns.js deleted file mode 100644 index 841cb874..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver-dns.js +++ /dev/null @@ -1,227 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.setup = void 0; -const resolver_1 = require("./resolver"); -const dns = require("dns"); -const util = require("util"); -const service_config_1 = require("./service-config"); -const constants_1 = require("./constants"); -const metadata_1 = require("./metadata"); -const logging = require("./logging"); -const constants_2 = require("./constants"); -const uri_parser_1 = require("./uri-parser"); -const net_1 = require("net"); -const TRACER_NAME = 'dns_resolver'; -function trace(text) { - logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text); -} -/** - * The default TCP port to connect to if not explicitly specified in the target. - */ -const DEFAULT_PORT = 443; -const resolveTxtPromise = util.promisify(dns.resolveTxt); -const dnsLookupPromise = util.promisify(dns.lookup); -/** - * Merge any number of arrays into a single alternating array - * @param arrays - */ -function mergeArrays(...arrays) { - const result = []; - for (let i = 0; i < - Math.max.apply(null, arrays.map((array) => array.length)); i++) { - for (const array of arrays) { - if (i < array.length) { - result.push(array[i]); - } - } - } - return result; -} -/** - * Resolver implementation that handles DNS names and IP addresses. - */ -class DnsResolver { - constructor(target, listener, channelOptions) { - var _a, _b; - this.target = target; - this.listener = listener; - this.pendingLookupPromise = null; - this.pendingTxtPromise = null; - this.latestLookupResult = null; - this.latestServiceConfig = null; - this.latestServiceConfigError = null; - trace('Resolver constructed for target ' + uri_parser_1.uriToString(target)); - const hostPort = uri_parser_1.splitHostPort(target.path); - if (hostPort === null) { - this.ipResult = null; - this.dnsHostname = null; - this.port = null; - } - else { - if (net_1.isIPv4(hostPort.host) || net_1.isIPv6(hostPort.host)) { - this.ipResult = [ - { - host: hostPort.host, - port: (_a = hostPort.port) !== null && _a !== void 0 ? _a : DEFAULT_PORT, - }, - ]; - this.dnsHostname = null; - this.port = null; - } - else { - this.ipResult = null; - this.dnsHostname = hostPort.host; - this.port = (_b = hostPort.port) !== null && _b !== void 0 ? _b : DEFAULT_PORT; - } - } - this.percentage = Math.random() * 100; - this.defaultResolutionError = { - code: constants_1.Status.UNAVAILABLE, - details: `Name resolution failed for target ${uri_parser_1.uriToString(this.target)}`, - metadata: new metadata_1.Metadata(), - }; - } - /** - * If the target is an IP address, just provide that address as a result. - * Otherwise, initiate A, AAAA, and TXT lookups - */ - startResolution() { - if (this.ipResult !== null) { - trace('Returning IP address for target ' + uri_parser_1.uriToString(this.target)); - setImmediate(() => { - this.listener.onSuccessfulResolution(this.ipResult, null, null, {}); - }); - return; - } - if (this.dnsHostname === null) { - setImmediate(() => { - this.listener.onError({ - code: constants_1.Status.UNAVAILABLE, - details: `Failed to parse DNS address ${uri_parser_1.uriToString(this.target)}`, - metadata: new metadata_1.Metadata(), - }); - }); - } - else { - /* We clear out latestLookupResult here to ensure that it contains the - * latest result since the last time we started resolving. That way, the - * TXT resolution handler can use it, but only if it finishes second. We - * don't clear out any previous service config results because it's - * better to use a service config that's slightly out of date than to - * revert to an effectively blank one. */ - this.latestLookupResult = null; - const hostname = this.dnsHostname; - /* We lookup both address families here and then split them up later - * because when looking up a single family, dns.lookup outputs an error - * if the name exists but there are no records for that family, and that - * error is indistinguishable from other kinds of errors */ - this.pendingLookupPromise = dnsLookupPromise(hostname, { all: true }); - this.pendingLookupPromise.then((addressList) => { - this.pendingLookupPromise = null; - const ip4Addresses = addressList.filter((addr) => addr.family === 4); - const ip6Addresses = addressList.filter((addr) => addr.family === 6); - this.latestLookupResult = mergeArrays(ip6Addresses, ip4Addresses).map((addr) => ({ host: addr.address, port: +this.port })); - const allAddressesString = '[' + - this.latestLookupResult - .map((addr) => addr.host + ':' + addr.port) - .join(',') + - ']'; - trace('Resolved addresses for target ' + - uri_parser_1.uriToString(this.target) + - ': ' + - allAddressesString); - if (this.latestLookupResult.length === 0) { - this.listener.onError(this.defaultResolutionError); - return; - } - /* If the TXT lookup has not yet finished, both of the last two - * arguments will be null, which is the equivalent of getting an - * empty TXT response. When the TXT lookup does finish, its handler - * can update the service config by using the same address list */ - this.listener.onSuccessfulResolution(this.latestLookupResult, this.latestServiceConfig, this.latestServiceConfigError, {}); - }, (err) => { - trace('Resolution error for target ' + - uri_parser_1.uriToString(this.target) + - ': ' + - err.message); - this.pendingLookupPromise = null; - this.listener.onError(this.defaultResolutionError); - }); - /* If there already is a still-pending TXT resolution, we can just use - * that result when it comes in */ - if (this.pendingTxtPromise === null) { - /* We handle the TXT query promise differently than the others because - * the name resolution attempt as a whole is a success even if the TXT - * lookup fails */ - this.pendingTxtPromise = resolveTxtPromise(hostname); - this.pendingTxtPromise.then((txtRecord) => { - this.pendingTxtPromise = null; - try { - this.latestServiceConfig = service_config_1.extractAndSelectServiceConfig(txtRecord, this.percentage); - } - catch (err) { - this.latestServiceConfigError = { - code: constants_1.Status.UNAVAILABLE, - details: 'Parsing service config failed', - metadata: new metadata_1.Metadata(), - }; - } - if (this.latestLookupResult !== null) { - /* We rely here on the assumption that calling this function with - * identical parameters will be essentialy idempotent, and calling - * it with the same address list and a different service config - * should result in a fast and seamless switchover. */ - this.listener.onSuccessfulResolution(this.latestLookupResult, this.latestServiceConfig, this.latestServiceConfigError, {}); - } - }, (err) => { - /* If TXT lookup fails we should do nothing, which means that we - * continue to use the result of the most recent successful lookup, - * or the default null config object if there has never been a - * successful lookup. We do not set the latestServiceConfigError - * here because that is specifically used for response validation - * errors. We still need to handle this error so that it does not - * bubble up as an unhandled promise rejection. */ - }); - } - } - } - updateResolution() { - trace('Resolution update requested for target ' + uri_parser_1.uriToString(this.target)); - if (this.pendingLookupPromise === null) { - this.startResolution(); - } - } - /** - * Get the default authority for the given target. For IP targets, that is - * the IP address. For DNS targets, it is the hostname. - * @param target - */ - static getDefaultAuthority(target) { - return target.path; - } -} -/** - * Set up the DNS resolver class by registering it as the handler for the - * "dns:" prefix and as the default resolver. - */ -function setup() { - resolver_1.registerResolver('dns', DnsResolver); - resolver_1.registerDefaultScheme('dns'); -} -exports.setup = setup; -//# sourceMappingURL=resolver-dns.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolver-dns.js.map b/node_modules/@grpc/grpc-js/build/src/resolver-dns.js.map deleted file mode 100644 index 81a4f406..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver-dns.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolver-dns.js","sourceRoot":"","sources":["../../src/resolver-dns.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAKoB;AACpB,2BAA2B;AAC3B,6BAA6B;AAC7B,qDAAgF;AAChF,2CAAqC;AAErC,yCAAsC;AACtC,qCAAqC;AACrC,2CAA2C;AAE3C,6CAAmE;AACnE,6BAAqC;AAGrC,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACzD,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAEpD;;;GAGG;AACH,SAAS,WAAW,CAAI,GAAG,MAAa;IACtC,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KACE,IAAI,CAAC,GAAG,CAAC,EACT,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,KAAK,CACZ,IAAI,EACJ,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CACpC,EACD,CAAC,EAAE,EACH;QACA,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACvB;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,WAAW;IAWf,YACU,MAAe,EACf,QAA0B,E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BAAmB,CAAC,MAAe;QACxC,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,KAAK;IACnB,2BAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACrC,gCAAqB,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAHD,sBAGC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolver-uds.d.ts b/node_modules/@grpc/grpc-js/build/src/resolver-uds.d.ts deleted file mode 100644 index 2bec6781..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver-uds.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function setup(): void; diff --git a/node_modules/@grpc/grpc-js/build/src/resolver-uds.js b/node_modules/@grpc/grpc-js/build/src/resolver-uds.js deleted file mode 100644 index 58275406..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver-uds.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.setup = void 0; -const resolver_1 = require("./resolver"); -class UdsResolver { - constructor(target, listener, channelOptions) { - this.listener = listener; - this.addresses = []; - let path; - if (target.authority === '') { - path = '/' + target.path; - } - else { - path = target.path; - } - this.addresses = [{ path }]; - } - updateResolution() { - process.nextTick(this.listener.onSuccessfulResolution, this.addresses, null, null, {}); - } - static getDefaultAuthority(target) { - return 'localhost'; - } -} -function setup() { - resolver_1.registerResolver('unix', UdsResolver); -} -exports.setup = setup; -//# sourceMappingURL=resolver-uds.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolver-uds.js.map b/node_modules/@grpc/grpc-js/build/src/resolver-uds.js.map deleted file mode 100644 index bc516ff0..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver-uds.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolver-uds.js","sourceRoot":"","sources":["../../src/resolver-uds.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAA0E;AAK1E,MAAM,WAAW;IAEf,YACE,MAAe,EACP,QAA0B,EAClC,cAA8B;QADtB,aAAQ,GAAR,QAAQ,CAAkB;QAH5B,cAAS,GAAwB,EAAE,CAAC;QAM1C,IAAI,IAAY,CAAC;QACjB,IAAI,MAAM,CAAC,SAAS,KAAK,EAAE,EAAE;YAC3B,IAAI,GAAG,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC;SAC1B;aAAM;YACL,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;SACpB;QACD,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,gBAAgB;QACd,OAAO,CAAC,QAAQ,CACd,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EACpC,IAAI,CAAC,SAAS,EACd,IAAI,EACJ,IAAI,EACJ,EAAE,CACH,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,mBAAmB,CAAC,MAAe;QACxC,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAED,SAAgB,KAAK;IACnB,2BAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC;AAFD,sBAEC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolver.d.ts b/node_modules/@grpc/grpc-js/build/src/resolver.d.ts deleted file mode 100644 index 7a7a71c4..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { ServiceConfig } from './service-config'; -import { StatusObject } from './call-stream'; -import { SubchannelAddress } from './subchannel'; -import { GrpcUri } from './uri-parser'; -import { ChannelOptions } from './channel-options'; -/** - * A listener object passed to the resolver's constructor that provides name - * resolution updates back to the resolver's owner. - */ -export interface ResolverListener { - /** - * Called whenever the resolver has new name resolution results to report - * @param addressList The new list of backend addresses - * @param serviceConfig The new service configuration corresponding to the - * `addressList`. Will be `null` if no service configuration was - * retrieved or if the service configuration was invalid - * @param serviceConfigError If non-`null`, indicates that the retrieved - * service configuration was invalid - */ - onSuccessfulResolution(addressList: SubchannelAddress[], serviceConfig: ServiceConfig | null, serviceConfigError: StatusObject | null, attributes: { - [key: string]: unknown; - }): void; - /** - * Called whenever a name resolution attempt fails. - * @param error Describes how resolution failed - */ - onError(error: StatusObject): void; -} -/** - * A resolver class that handles one or more of the name syntax schemes defined - * in the [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md) - */ -export interface Resolver { - /** - * Indicates that the caller wants new name resolution data. Calling this - * function may eventually result in calling one of the `ResolverListener` - * functions, but that is not guaranteed. Those functions will never be - * called synchronously with the constructor or updateResolution. - */ - updateResolution(): void; -} -export interface ResolverConstructor { - new (target: GrpcUri, listener: ResolverListener, channelOptions: ChannelOptions): Resolver; - /** - * Get the default authority for a target. This loosely corresponds to that - * target's hostname. Throws an error if this resolver class cannot parse the - * `target`. - * @param target - */ - getDefaultAuthority(target: GrpcUri): string; -} -/** - * Register a resolver class to handle target names prefixed with the `prefix` - * string. This prefix should correspond to a URI scheme name listed in the - * [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md) - * @param prefix - * @param resolverClass - */ -export declare function registerResolver(scheme: string, resolverClass: ResolverConstructor): void; -/** - * Register a default resolver to handle target names that do not start with - * any registered prefix. - * @param resolverClass - */ -export declare function registerDefaultScheme(scheme: string): void; -/** - * Create a name resolver for the specified target, if possible. Throws an - * error if no such name resolver can be created. - * @param target - * @param listener - */ -export declare function createResolver(target: GrpcUri, listener: ResolverListener, options: ChannelOptions): Resolver; -/** - * Get the default authority for the specified target, if possible. Throws an - * error if no registered name resolver can parse that target string. - * @param target - */ -export declare function getDefaultAuthority(target: GrpcUri): string; -export declare function mapUriDefaultScheme(target: GrpcUri): GrpcUri | null; -export declare function registerAll(): void; diff --git a/node_modules/@grpc/grpc-js/build/src/resolver.js b/node_modules/@grpc/grpc-js/build/src/resolver.js deleted file mode 100644 index 128c06de..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.registerAll = exports.mapUriDefaultScheme = exports.getDefaultAuthority = exports.createResolver = exports.registerDefaultScheme = exports.registerResolver = void 0; -const resolver_dns = require("./resolver-dns"); -const resolver_uds = require("./resolver-uds"); -const uri_parser_1 = require("./uri-parser"); -const registeredResolvers = {}; -let defaultScheme = null; -/** - * Register a resolver class to handle target names prefixed with the `prefix` - * string. This prefix should correspond to a URI scheme name listed in the - * [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md) - * @param prefix - * @param resolverClass - */ -function registerResolver(scheme, resolverClass) { - registeredResolvers[scheme] = resolverClass; -} -exports.registerResolver = registerResolver; -/** - * Register a default resolver to handle target names that do not start with - * any registered prefix. - * @param resolverClass - */ -function registerDefaultScheme(scheme) { - defaultScheme = scheme; -} -exports.registerDefaultScheme = registerDefaultScheme; -/** - * Create a name resolver for the specified target, if possible. Throws an - * error if no such name resolver can be created. - * @param target - * @param listener - */ -function createResolver(target, listener, options) { - if (target.scheme !== undefined && target.scheme in registeredResolvers) { - return new registeredResolvers[target.scheme](target, listener, options); - } - else { - throw new Error(`No resolver could be created for target ${uri_parser_1.uriToString(target)}`); - } -} -exports.createResolver = createResolver; -/** - * Get the default authority for the specified target, if possible. Throws an - * error if no registered name resolver can parse that target string. - * @param target - */ -function getDefaultAuthority(target) { - if (target.scheme !== undefined && target.scheme in registeredResolvers) { - return registeredResolvers[target.scheme].getDefaultAuthority(target); - } - else { - throw new Error(`Invalid target ${uri_parser_1.uriToString(target)}`); - } -} -exports.getDefaultAuthority = getDefaultAuthority; -function mapUriDefaultScheme(target) { - if (target.scheme === undefined || !(target.scheme in registeredResolvers)) { - if (defaultScheme !== null) { - return { - scheme: defaultScheme, - authority: undefined, - path: uri_parser_1.uriToString(target), - }; - } - else { - return null; - } - } - return target; -} -exports.mapUriDefaultScheme = mapUriDefaultScheme; -function registerAll() { - resolver_dns.setup(); - resolver_uds.setup(); -} -exports.registerAll = registerAll; -//# sourceMappingURL=resolver.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolver.js.map b/node_modules/@grpc/grpc-js/build/src/resolver.js.map deleted file mode 100644 index 39eabb38..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolver.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,+CAA+C;AAC/C,+CAA+C;AAG/C,6CAAoD;AA2DpD,MAAM,mBAAmB,GAA8C,EAAE,CAAC;AAC1E,IAAI,aAAa,GAAkB,IAAI,CAAC;AAExC;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,MAAc,EACd,aAAkC;IAElC,mBAAmB,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC;AAC9C,CAAC;AALD,4CAKC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,MAAc;IAClD,aAAa,GAAG,MAAM,CAAC;AACzB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ACvB,CAAC;AAHD,kCAGC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.d.ts b/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.d.ts deleted file mode 100644 index adebb6ab..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { ChannelControlHelper, LoadBalancer, LoadBalancingConfig } from './load-balancer'; -import { SubchannelAddress } from './subchannel'; -import { GrpcUri } from './uri-parser'; -import { ChannelOptions } from './channel-options'; -export declare class ResolvingLoadBalancer implements LoadBalancer { - private readonly target; - private readonly channelControlHelper; - private readonly channelOptions; - /** - * The resolver class constructed for the target address. - */ - private innerResolver; - private childLoadBalancer; - private latestChildState; - private latestChildPicker; - /** - * This resolving load balancer's current connectivity state. - */ - private currentState; - private readonly defaultServiceConfig; - /** - * The service config object from the last successful resolution, if - * available. A value of null indicates that we have not yet received a valid - * service config from the resolver. - */ - private previousServiceConfig; - /** - * The backoff timer for handling name resolution failures. - */ - private readonly backoffTimeout; - /** - * Indicates whether we should attempt to resolve again after the backoff - * timer runs out. - */ - private continueResolving; - /** - * Wrapper class that behaves like a `LoadBalancer` and also handles name - * resolution internally. - * @param target The address of the backend to connect to. - * @param channelControlHelper `ChannelControlHelper` instance provided by - * this load balancer's owner. - * @param defaultServiceConfig The default service configuration to be used - * if none is provided by the name resolver. A `null` value indicates - * that the default behavior should be the default unconfigured behavior. - * In practice, that means using the "pick first" load balancer - * implmentation - */ - constructor(target: GrpcUri, channelControlHelper: ChannelControlHelper, channelOptions: ChannelOptions); - private updateResolution; - private updateState; - private handleResolutionFailure; - exitIdle(): void; - updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig | null): void; - resetBackoff(): void; - destroy(): void; - getTypeName(): string; -} diff --git a/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js b/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js deleted file mode 100644 index bcde6e0f..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js +++ /dev/null @@ -1,213 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResolvingLoadBalancer = void 0; -const load_balancer_1 = require("./load-balancer"); -const service_config_1 = require("./service-config"); -const channel_1 = require("./channel"); -const resolver_1 = require("./resolver"); -const picker_1 = require("./picker"); -const backoff_timeout_1 = require("./backoff-timeout"); -const constants_1 = require("./constants"); -const metadata_1 = require("./metadata"); -const logging = require("./logging"); -const constants_2 = require("./constants"); -const uri_parser_1 = require("./uri-parser"); -const load_balancer_child_handler_1 = require("./load-balancer-child-handler"); -const TRACER_NAME = 'resolving_load_balancer'; -function trace(text) { - logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text); -} -const DEFAULT_LOAD_BALANCER_NAME = 'pick_first'; -class ResolvingLoadBalancer { - /** - * Wrapper class that behaves like a `LoadBalancer` and also handles name - * resolution internally. - * @param target The address of the backend to connect to. - * @param channelControlHelper `ChannelControlHelper` instance provided by - * this load balancer's owner. - * @param defaultServiceConfig The default service configuration to be used - * if none is provided by the name resolver. A `null` value indicates - * that the default behavior should be the default unconfigured behavior. - * In practice, that means using the "pick first" load balancer - * implmentation - */ - constructor(target, channelControlHelper, channelOptions) { - this.target = target; - this.channelControlHelper = channelControlHelper; - this.channelOptions = channelOptions; - this.latestChildState = channel_1.ConnectivityState.IDLE; - this.latestChildPicker = new picker_1.QueuePicker(this); - /** - * This resolving load balancer's current connectivity state. - */ - this.currentState = channel_1.ConnectivityState.IDLE; - /** - * The service config object from the last successful resolution, if - * available. A value of null indicates that we have not yet received a valid - * service config from the resolver. - */ - this.previousServiceConfig = null; - /** - * Indicates whether we should attempt to resolve again after the backoff - * timer runs out. - */ - this.continueResolving = false; - if (channelOptions['grpc.service_config']) { - this.defaultServiceConfig = service_config_1.validateServiceConfig(JSON.parse(channelOptions['grpc.service_config'])); - } - else { - this.defaultServiceConfig = { - loadBalancingConfig: [], - methodConfig: [], - }; - } - this.updateState(channel_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this)); - this.childLoadBalancer = new load_balancer_child_handler_1.ChildLoadBalancerHandler({ - createSubchannel: channelControlHelper.createSubchannel.bind(channelControlHelper), - requestReresolution: () => { - /* If the backoffTimeout is running, we're still backing off from - * making resolve requests, so we shouldn't make another one here. - * In that case, the backoff timer callback will call - * updateResolution */ - if (this.backoffTimeout.isRunning()) { - this.continueResolving = true; - } - else { - this.updateResolution(); - } - }, - updateState: (newState, picker) => { - this.latestChildState = newState; - this.latestChildPicker = picker; - this.updateState(newState, picker); - }, - }); - this.innerResolver = resolver_1.createResolver(target, { - onSuccessfulResolution: (addressList, serviceConfig, serviceConfigError, attributes) => { - var _a; - let workingServiceConfig = null; - /* This first group of conditionals implements the algorithm described - * in https://github.com/grpc/proposal/blob/master/A21-service-config-error-handling.md - * in the section called "Behavior on receiving a new gRPC Config". - */ - if (serviceConfig === null) { - // Step 4 and 5 - if (serviceConfigError === null) { - // Step 5 - this.previousServiceConfig = null; - workingServiceConfig = this.defaultServiceConfig; - } - else { - // Step 4 - if (this.previousServiceConfig === null) { - // Step 4.ii - this.handleResolutionFailure(serviceConfigError); - } - else { - // Step 4.i - workingServiceConfig = this.previousServiceConfig; - } - } - } - else { - // Step 3 - workingServiceConfig = serviceConfig; - this.previousServiceConfig = serviceConfig; - } - const workingConfigList = (_a = workingServiceConfig === null || workingServiceConfig === void 0 ? void 0 : workingServiceConfig.loadBalancingConfig) !== null && _a !== void 0 ? _a : []; - const loadBalancingConfig = load_balancer_1.getFirstUsableConfig(workingConfigList, true); - if (loadBalancingConfig === null) { - // There were load balancing configs but none are supported. This counts as a resolution failure - this.handleResolutionFailure({ - code: constants_1.Status.UNAVAILABLE, - details: 'All load balancer options in service config are not compatible', - metadata: new metadata_1.Metadata(), - }); - return; - } - this.childLoadBalancer.updateAddressList(addressList, loadBalancingConfig, attributes); - }, - onError: (error) => { - this.handleResolutionFailure(error); - }, - }, channelOptions); - this.backoffTimeout = new backoff_timeout_1.BackoffTimeout(() => { - if (this.continueResolving) { - this.updateResolution(); - this.continueResolving = false; - } - else { - this.updateState(this.latestChildState, this.latestChildPicker); - } - }); - } - updateResolution() { - this.innerResolver.updateResolution(); - if (this.currentState === channel_1.ConnectivityState.IDLE) { - this.updateState(channel_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this)); - } - } - updateState(connectivityState, picker) { - trace(uri_parser_1.uriToString(this.target) + - ' ' + - channel_1.ConnectivityState[this.currentState] + - ' -> ' + - channel_1.ConnectivityState[connectivityState]); - // Ensure that this.exitIdle() is called by the picker - if (connectivityState === channel_1.ConnectivityState.IDLE) { - picker = new picker_1.QueuePicker(this); - } - this.currentState = connectivityState; - this.channelControlHelper.updateState(connectivityState, picker); - } - handleResolutionFailure(error) { - if (this.latestChildState === channel_1.ConnectivityState.IDLE) { - this.updateState(channel_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker(error)); - } - this.backoffTimeout.runOnce(); - } - exitIdle() { - this.childLoadBalancer.exitIdle(); - if (this.currentState === channel_1.ConnectivityState.IDLE) { - if (this.backoffTimeout.isRunning()) { - this.continueResolving = true; - } - else { - this.updateResolution(); - } - this.updateState(channel_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this)); - } - } - updateAddressList(addressList, lbConfig) { - throw new Error('updateAddressList not supported on ResolvingLoadBalancer'); - } - resetBackoff() { - this.backoffTimeout.reset(); - this.childLoadBalancer.resetBackoff(); - } - destroy() { - this.childLoadBalancer.destroy(); - this.updateState(channel_1.ConnectivityState.SHUTDOWN, new picker_1.UnavailablePicker()); - } - getTypeName() { - return 'resolving_load_balancer'; - } -} -exports.ResolvingLoadBalancer = ResolvingLoadBalancer; -//# sourceMappingURL=resolving-load-balancer.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js.map b/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js.map deleted file mode 100644 index 05e28f65..00000000 --- a/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolving-load-balancer.js","sourceRoot":"","sources":["../../src/resolving-load-balancer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mDAKyB;AACzB,qDAAwE;AACxE,uCAA8C;AAC9C,yCAAsD;AAEtD,qCAAkE;AAClE,uDAAmD;AACnD,2CAAqC;AAErC,yCAAsC;AACtC,qCAAqC;AACrC,2CAA2C;AAE3C,6CAAoD;AACpD,+EAAyE;AAIzE,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAE9C,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEhD,MAAa,qBAAqB;IAgChC;;;;;;;;;;;OAWG;IACH,YACmB,MAAe,EACf,oBAA0C,EAC1C,cAA8B;QAF9B,WAAM,GAAN,MAAM,CAAS;QACf,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,mBAAc,GAAd,cAAc,CAAgB;QAxCzC,qBAAgB,GAAsB,2BAAiB,CAAC,IAAI,CAAC;QAC7D,sBAAiB,GAAW,IAAI,oBAAW,CAAC,IAAI,CAAC,CAAC;QAC1D;;WAEG;QACK,iBAAY,GAAsB,2BAAiB,CAAC,IAAI,CAAC;QAEjE;;;;WAIG;QACK,0BAAqB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AC;IAChC,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,YAAY,KAAK,2BAAiB,CAAC,IAAI,EAAE;YAChD,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE;gBACnC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;aAC/B;iBAAM;gBACL,IAAI,CAAC,gBAAgB,EAAE,CAAC;aACzB;YACD,IAAI,CAAC,WAAW,CAAC,2BAAiB,CAAC,UAAU,EAAE,IAAI,oBAAW,CAAC,IAAI,CAAC,CAAC,CAAC;SACvE;IACH,CAAC;IAED,iBAAiB,CACf,WAAgC,EAChC,QAAoC;QAEpC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,YAAY;QACV,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,WAAW,CAAC,2BAAiB,CAAC,QAAQ,EAAE,IAAI,0BAAiB,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,WAAW;QACT,OAAO,yBAAyB,CAAC;IACnC,CAAC;CACF;AAzND,sDAyNC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/server-call.d.ts b/node_modules/@grpc/grpc-js/build/src/server-call.d.ts deleted file mode 100644 index ffec28c2..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server-call.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -/// -import { EventEmitter } from 'events'; -import * as http2 from 'http2'; -import { Duplex, Readable, Writable } from 'stream'; -import { Deadline, StatusObject } from './call-stream'; -import { Deserialize, Serialize } from './make-client'; -import { Metadata } from './metadata'; -import { ObjectReadable, ObjectWritable } from './object-stream'; -import { ChannelOptions } from './channel-options'; -export declare type ServerStatusResponse = Partial; -export declare type ServerErrorResponse = ServerStatusResponse & Error; -export declare type ServerSurfaceCall = { - cancelled: boolean; - readonly metadata: Metadata; - getPeer(): string; - sendMetadata(responseMetadata: Metadata): void; - getDeadline(): Deadline; -} & EventEmitter; -export declare type ServerUnaryCall = ServerSurfaceCall & { - request: RequestType; -}; -export declare type ServerReadableStream = ServerSurfaceCall & ObjectReadable; -export declare type ServerWritableStream = ServerSurfaceCall & ObjectWritable & { - request: RequestType; - end: (metadata?: Metadata) => void; -}; -export declare type ServerDuplexStream = ServerSurfaceCall & ObjectReadable & ObjectWritable & { - end: (metadata?: Metadata) => void; -}; -export declare class ServerUnaryCallImpl extends EventEmitter implements ServerUnaryCall { - private call; - metadata: Metadata; - request: RequestType; - cancelled: boolean; - constructor(call: Http2ServerCallStream, metadata: Metadata, request: RequestType); - getPeer(): string; - sendMetadata(responseMetadata: Metadata): void; - getDeadline(): Deadline; -} -export declare class ServerReadableStreamImpl extends Readable implements ServerReadableStream { - private call; - metadata: Metadata; - deserialize: Deserialize; - cancelled: boolean; - constructor(call: Http2ServerCallStream, metadata: Metadata, deserialize: Deserialize); - _read(size: number): void; - getPeer(): string; - sendMetadata(responseMetadata: Metadata): void; - getDeadline(): Deadline; -} -export declare class ServerWritableStreamImpl extends Writable implements ServerWritableStream { - private call; - metadata: Metadata; - serialize: Serialize; - request: RequestType; - cancelled: boolean; - private trailingMetadata; - constructor(call: Http2ServerCallStream, metadata: Metadata, serialize: Serialize, request: RequestType); - getPeer(): string; - sendMetadata(responseMetadata: Metadata): void; - getDeadline(): Deadline; - _write(chunk: ResponseType, encoding: string, callback: (...args: any[]) => void): void; - _final(callback: Function): void; - end(metadata?: any): void; -} -export declare class ServerDuplexStreamImpl extends Duplex implements ServerDuplexStream { - private call; - metadata: Metadata; - serialize: Serialize; - deserialize: Deserialize; - cancelled: boolean; - private trailingMetadata; - constructor(call: Http2ServerCallStream, metadata: Metadata, serialize: Serialize, deserialize: Deserialize); - getPeer(): string; - sendMetadata(responseMetadata: Metadata): void; - getDeadline(): Deadline; - end(metadata?: any): void; -} -export declare type sendUnaryData = (error: ServerErrorResponse | ServerStatusResponse | null, value?: ResponseType | null, trailer?: Metadata, flags?: number) => void; -export declare type handleUnaryCall = (call: ServerUnaryCall, callback: sendUnaryData) => void; -export declare type handleClientStreamingCall = (call: ServerReadableStream, callback: sendUnaryData) => void; -export declare type handleServerStreamingCall = (call: ServerWritableStream) => void; -export declare type handleBidiStreamingCall = (call: ServerDuplexStream) => void; -export declare type HandleCall = handleUnaryCall | handleClientStreamingCall | handleServerStreamingCall | handleBidiStreamingCall; -export interface UnaryHandler { - func: handleUnaryCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} -export interface ClientStreamingHandler { - func: handleClientStreamingCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} -export interface ServerStreamingHandler { - func: handleServerStreamingCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} -export interface BidiStreamingHandler { - func: handleBidiStreamingCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} -export declare type Handler = UnaryHandler | ClientStreamingHandler | ServerStreamingHandler | BidiStreamingHandler; -export declare type HandlerType = 'bidi' | 'clientStream' | 'serverStream' | 'unary'; -export declare class Http2ServerCallStream extends EventEmitter { - private stream; - private handler; - private options; - cancelled: boolean; - deadlineTimer: NodeJS.Timer; - private deadline; - private wantTrailers; - private metadataSent; - private canPush; - private isPushPending; - private bufferedMessages; - private messagesToPush; - private maxSendMessageSize; - private maxReceiveMessageSize; - constructor(stream: http2.ServerHttp2Stream, handler: Handler, options: ChannelOptions); - private checkCancelled; - sendMetadata(customMetadata?: Metadata): void; - receiveMetadata(headers: http2.IncomingHttpHeaders): Metadata | undefined; - receiveUnaryMessage(): Promise; - serializeMessage(value: ResponseType): Buffer; - deserializeMessage(bytes: Buffer): RequestType; - sendUnaryMessage(err: ServerErrorResponse | ServerStatusResponse | null, value?: ResponseType | null, metadata?: Metadata, flags?: number): Promise; - sendStatus(statusObj: StatusObject): void; - sendError(error: ServerErrorResponse | ServerStatusResponse): void; - write(chunk: Buffer): boolean | undefined; - resume(): void; - setupSurfaceCall(call: ServerSurfaceCall): void; - setupReadable(readable: ServerReadableStream | ServerDuplexStream): void; - consumeUnpushedMessages(readable: ServerReadableStream | ServerDuplexStream): boolean; - private pushOrBufferMessage; - private pushMessage; - getPeer(): string; - getDeadline(): Deadline; -} diff --git a/node_modules/@grpc/grpc-js/build/src/server-call.js b/node_modules/@grpc/grpc-js/build/src/server-call.js deleted file mode 100644 index d9733b07..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server-call.js +++ /dev/null @@ -1,538 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Http2ServerCallStream = exports.ServerDuplexStreamImpl = exports.ServerWritableStreamImpl = exports.ServerReadableStreamImpl = exports.ServerUnaryCallImpl = void 0; -const events_1 = require("events"); -const http2 = require("http2"); -const stream_1 = require("stream"); -const constants_1 = require("./constants"); -const metadata_1 = require("./metadata"); -const stream_decoder_1 = require("./stream-decoder"); -const logging = require("./logging"); -const TRACER_NAME = 'server_call'; -function trace(text) { - logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); -} -const GRPC_ACCEPT_ENCODING_HEADER = 'grpc-accept-encoding'; -const GRPC_ENCODING_HEADER = 'grpc-encoding'; -const GRPC_MESSAGE_HEADER = 'grpc-message'; -const GRPC_STATUS_HEADER = 'grpc-status'; -const GRPC_TIMEOUT_HEADER = 'grpc-timeout'; -const DEADLINE_REGEX = /(\d{1,8})\s*([HMSmun])/; -const deadlineUnitsToMs = { - H: 3600000, - M: 60000, - S: 1000, - m: 1, - u: 0.001, - n: 0.000001, -}; -const defaultResponseHeaders = { - // TODO(cjihrig): Remove these encoding headers from the default response - // once compression is integrated. - [GRPC_ACCEPT_ENCODING_HEADER]: 'identity', - [GRPC_ENCODING_HEADER]: 'identity', - [http2.constants.HTTP2_HEADER_STATUS]: http2.constants.HTTP_STATUS_OK, - [http2.constants.HTTP2_HEADER_CONTENT_TYPE]: 'application/grpc+proto', -}; -const defaultResponseOptions = { - waitForTrailers: true, -}; -class ServerUnaryCallImpl extends events_1.EventEmitter { - constructor(call, metadata, request) { - super(); - this.call = call; - this.metadata = metadata; - this.request = request; - this.cancelled = false; - this.call.setupSurfaceCall(this); - } - getPeer() { - return this.call.getPeer(); - } - sendMetadata(responseMetadata) { - this.call.sendMetadata(responseMetadata); - } - getDeadline() { - return this.call.getDeadline(); - } -} -exports.ServerUnaryCallImpl = ServerUnaryCallImpl; -class ServerReadableStreamImpl extends stream_1.Readable { - constructor(call, metadata, deserialize) { - super({ objectMode: true }); - this.call = call; - this.metadata = metadata; - this.deserialize = deserialize; - this.cancelled = false; - this.call.setupSurfaceCall(this); - this.call.setupReadable(this); - } - _read(size) { - if (!this.call.consumeUnpushedMessages(this)) { - return; - } - this.call.resume(); - } - getPeer() { - return this.call.getPeer(); - } - sendMetadata(responseMetadata) { - this.call.sendMetadata(responseMetadata); - } - getDeadline() { - return this.call.getDeadline(); - } -} -exports.ServerReadableStreamImpl = ServerReadableStreamImpl; -class ServerWritableStreamImpl extends stream_1.Writable { - constructor(call, metadata, serialize, request) { - super({ objectMode: true }); - this.call = call; - this.metadata = metadata; - this.serialize = serialize; - this.request = request; - this.cancelled = false; - this.trailingMetadata = new metadata_1.Metadata(); - this.call.setupSurfaceCall(this); - this.on('error', (err) => { - this.call.sendError(err); - this.end(); - }); - } - getPeer() { - return this.call.getPeer(); - } - sendMetadata(responseMetadata) { - this.call.sendMetadata(responseMetadata); - } - getDeadline() { - return this.call.getDeadline(); - } - _write(chunk, encoding, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - callback) { - try { - const response = this.call.serializeMessage(chunk); - if (!this.call.write(response)) { - this.call.once('drain', callback); - return; - } - } - catch (err) { - err.code = constants_1.Status.INTERNAL; - this.emit('error', err); - } - callback(); - } - _final(callback) { - this.call.sendStatus({ - code: constants_1.Status.OK, - details: 'OK', - metadata: this.trailingMetadata, - }); - callback(null); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - end(metadata) { - if (metadata) { - this.trailingMetadata = metadata; - } - super.end(); - } -} -exports.ServerWritableStreamImpl = ServerWritableStreamImpl; -class ServerDuplexStreamImpl extends stream_1.Duplex { - constructor(call, metadata, serialize, deserialize) { - super({ objectMode: true }); - this.call = call; - this.metadata = metadata; - this.serialize = serialize; - this.deserialize = deserialize; - this.cancelled = false; - this.trailingMetadata = new metadata_1.Metadata(); - this.call.setupSurfaceCall(this); - this.call.setupReadable(this); - this.on('error', (err) => { - this.call.sendError(err); - this.end(); - }); - } - getPeer() { - return this.call.getPeer(); - } - sendMetadata(responseMetadata) { - this.call.sendMetadata(responseMetadata); - } - getDeadline() { - return this.call.getDeadline(); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - end(metadata) { - if (metadata) { - this.trailingMetadata = metadata; - } - super.end(); - } -} -exports.ServerDuplexStreamImpl = ServerDuplexStreamImpl; -ServerDuplexStreamImpl.prototype._read = - ServerReadableStreamImpl.prototype._read; -ServerDuplexStreamImpl.prototype._write = - ServerWritableStreamImpl.prototype._write; -ServerDuplexStreamImpl.prototype._final = - ServerWritableStreamImpl.prototype._final; -ServerDuplexStreamImpl.prototype.end = ServerWritableStreamImpl.prototype.end; -// Internal class that wraps the HTTP2 request. -class Http2ServerCallStream extends events_1.EventEmitter { - constructor(stream, handler, options) { - super(); - this.stream = stream; - this.handler = handler; - this.options = options; - this.cancelled = false; - this.deadlineTimer = setTimeout(() => { }, 0); - this.deadline = Infinity; - this.wantTrailers = false; - this.metadataSent = false; - this.canPush = false; - this.isPushPending = false; - this.bufferedMessages = []; - this.messagesToPush = []; - this.maxSendMessageSize = constants_1.DEFAULT_MAX_SEND_MESSAGE_LENGTH; - this.maxReceiveMessageSize = constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH; - this.stream.once('error', (err) => { - /* We need an error handler to avoid uncaught error event exceptions, but - * there is nothing we can reasonably do here. Any error event should - * have a corresponding close event, which handles emitting the cancelled - * event. And the stream is now in a bad state, so we can't reasonably - * expect to be able to send an error over it. */ - }); - this.stream.once('close', () => { - var _a; - trace('Request to method ' + ((_a = this.handler) === null || _a === void 0 ? void 0 : _a.path) + - ' stream closed with rstCode ' + - this.stream.rstCode); - this.cancelled = true; - this.emit('cancelled', 'cancelled'); - }); - this.stream.on('drain', () => { - this.emit('drain'); - }); - if ('grpc.max_send_message_length' in options) { - this.maxSendMessageSize = options['grpc.max_send_message_length']; - } - if ('grpc.max_receive_message_length' in options) { - this.maxReceiveMessageSize = options['grpc.max_receive_message_length']; - } - // Clear noop timer - clearTimeout(this.deadlineTimer); - } - checkCancelled() { - /* In some cases the stream can become destroyed before the close event - * fires. That creates a race condition that this check works around */ - if (this.stream.destroyed) { - this.cancelled = true; - } - return this.cancelled; - } - sendMetadata(customMetadata) { - if (this.checkCancelled()) { - return; - } - if (this.metadataSent) { - return; - } - this.metadataSent = true; - const custom = customMetadata ? customMetadata.toHttp2Headers() : null; - // TODO(cjihrig): Include compression headers. - const headers = Object.assign({}, defaultResponseHeaders, custom); - this.stream.respond(headers, defaultResponseOptions); - } - receiveMetadata(headers) { - const metadata = metadata_1.Metadata.fromHttp2Headers(headers); - // TODO(cjihrig): Receive compression metadata. - const timeoutHeader = metadata.get(GRPC_TIMEOUT_HEADER); - if (timeoutHeader.length > 0) { - const match = timeoutHeader[0].toString().match(DEADLINE_REGEX); - if (match === null) { - const err = new Error('Invalid deadline'); - err.code = constants_1.Status.OUT_OF_RANGE; - this.sendError(err); - return; - } - const timeout = (+match[1] * deadlineUnitsToMs[match[2]]) | 0; - const now = new Date(); - this.deadline = now.setMilliseconds(now.getMilliseconds() + timeout); - this.deadlineTimer = setTimeout(handleExpiredDeadline, timeout, this); - metadata.remove(GRPC_TIMEOUT_HEADER); - } - // Remove several headers that should not be propagated to the application - metadata.remove(http2.constants.HTTP2_HEADER_ACCEPT_ENCODING); - metadata.remove(http2.constants.HTTP2_HEADER_TE); - metadata.remove(http2.constants.HTTP2_HEADER_CONTENT_TYPE); - metadata.remove('grpc-encoding'); - metadata.remove('grpc-accept-encoding'); - return metadata; - } - receiveUnaryMessage() { - return new Promise((resolve, reject) => { - const stream = this.stream; - const chunks = []; - let totalLength = 0; - stream.on('data', (data) => { - chunks.push(data); - totalLength += data.byteLength; - }); - stream.once('end', async () => { - try { - const requestBytes = Buffer.concat(chunks, totalLength); - if (this.maxReceiveMessageSize !== -1 && - requestBytes.length > this.maxReceiveMessageSize) { - this.sendError({ - code: constants_1.Status.RESOURCE_EXHAUSTED, - details: `Received message larger than max (${requestBytes.length} vs. ${this.maxReceiveMessageSize})`, - }); - resolve(); - } - resolve(this.deserializeMessage(requestBytes)); - } - catch (err) { - err.code = constants_1.Status.INTERNAL; - this.sendError(err); - resolve(); - } - }); - }); - } - serializeMessage(value) { - const messageBuffer = this.handler.serialize(value); - // TODO(cjihrig): Call compression aware serializeMessage(). - const byteLength = messageBuffer.byteLength; - const output = Buffer.allocUnsafe(byteLength + 5); - output.writeUInt8(0, 0); - output.writeUInt32BE(byteLength, 1); - messageBuffer.copy(output, 5); - return output; - } - deserializeMessage(bytes) { - // TODO(cjihrig): Call compression aware deserializeMessage(). - const receivedMessage = bytes.slice(5); - return this.handler.deserialize(receivedMessage); - } - async sendUnaryMessage(err, value, metadata, flags) { - if (this.checkCancelled()) { - return; - } - if (!metadata) { - metadata = new metadata_1.Metadata(); - } - if (err) { - if (!Object.prototype.hasOwnProperty.call(err, 'metadata')) { - err.metadata = metadata; - } - this.sendError(err); - return; - } - try { - const response = this.serializeMessage(value); - this.write(response); - this.sendStatus({ code: constants_1.Status.OK, details: 'OK', metadata }); - } - catch (err) { - err.code = constants_1.Status.INTERNAL; - this.sendError(err); - } - } - sendStatus(statusObj) { - var _a; - if (this.checkCancelled()) { - return; - } - trace('Request to method ' + ((_a = this.handler) === null || _a === void 0 ? void 0 : _a.path) + - ' ended with status code: ' + - constants_1.Status[statusObj.code] + - ' details: ' + - statusObj.details); - clearTimeout(this.deadlineTimer); - if (!this.wantTrailers) { - this.wantTrailers = true; - this.stream.once('wantTrailers', () => { - const trailersToSend = Object.assign({ - [GRPC_STATUS_HEADER]: statusObj.code, - [GRPC_MESSAGE_HEADER]: encodeURI(statusObj.details), - }, statusObj.metadata.toHttp2Headers()); - this.stream.sendTrailers(trailersToSend); - }); - this.sendMetadata(); - this.stream.end(); - } - } - sendError(error) { - if (this.checkCancelled()) { - return; - } - const status = { - code: constants_1.Status.UNKNOWN, - details: 'message' in error ? error.message : 'Unknown Error', - metadata: 'metadata' in error && error.metadata !== undefined - ? error.metadata - : new metadata_1.Metadata(), - }; - if ('code' in error && - typeof error.code === 'number' && - Number.isInteger(error.code)) { - status.code = error.code; - if ('details' in error && typeof error.details === 'string') { - status.details = error.details; - } - } - this.sendStatus(status); - } - write(chunk) { - if (this.checkCancelled()) { - return; - } - if (this.maxSendMessageSize !== -1 && - chunk.length > this.maxSendMessageSize) { - this.sendError({ - code: constants_1.Status.RESOURCE_EXHAUSTED, - details: `Sent message larger than max (${chunk.length} vs. ${this.maxSendMessageSize})`, - }); - return; - } - this.sendMetadata(); - return this.stream.write(chunk); - } - resume() { - this.stream.resume(); - } - setupSurfaceCall(call) { - this.once('cancelled', (reason) => { - call.cancelled = true; - call.emit('cancelled', reason); - }); - } - setupReadable(readable) { - const decoder = new stream_decoder_1.StreamDecoder(); - this.stream.on('data', async (data) => { - const messages = decoder.write(data); - for (const message of messages) { - if (this.maxReceiveMessageSize !== -1 && - message.length > this.maxReceiveMessageSize) { - this.sendError({ - code: constants_1.Status.RESOURCE_EXHAUSTED, - details: `Received message larger than max (${message.length} vs. ${this.maxReceiveMessageSize})`, - }); - return; - } - this.pushOrBufferMessage(readable, message); - } - }); - this.stream.once('end', () => { - this.pushOrBufferMessage(readable, null); - }); - } - consumeUnpushedMessages(readable) { - this.canPush = true; - while (this.messagesToPush.length > 0) { - const nextMessage = this.messagesToPush.shift(); - const canPush = readable.push(nextMessage); - if (nextMessage === null || canPush === false) { - this.canPush = false; - break; - } - } - return this.canPush; - } - pushOrBufferMessage(readable, messageBytes) { - if (this.isPushPending) { - this.bufferedMessages.push(messageBytes); - } - else { - this.pushMessage(readable, messageBytes); - } - } - async pushMessage(readable, messageBytes) { - if (messageBytes === null) { - if (this.canPush) { - readable.push(null); - } - else { - this.messagesToPush.push(null); - } - return; - } - this.isPushPending = true; - try { - const deserialized = await this.deserializeMessage(messageBytes); - if (this.canPush) { - if (!readable.push(deserialized)) { - this.canPush = false; - this.stream.pause(); - } - } - else { - this.messagesToPush.push(deserialized); - } - } - catch (error) { - // Ignore any remaining messages when errors occur. - this.bufferedMessages.length = 0; - if (!('code' in error && - typeof error.code === 'number' && - Number.isInteger(error.code) && - error.code >= constants_1.Status.OK && - error.code <= constants_1.Status.UNAUTHENTICATED)) { - // The error code is not a valid gRPC code so its being overwritten. - error.code = constants_1.Status.INTERNAL; - } - readable.emit('error', error); - } - this.isPushPending = false; - if (this.bufferedMessages.length > 0) { - this.pushMessage(readable, this.bufferedMessages.shift()); - } - } - getPeer() { - const socket = this.stream.session.socket; - if (socket.remoteAddress) { - if (socket.remotePort) { - return `${socket.remoteAddress}:${socket.remotePort}`; - } - else { - return socket.remoteAddress; - } - } - else { - return 'unknown'; - } - } - getDeadline() { - return this.deadline; - } -} -exports.Http2ServerCallStream = Http2ServerCallStream; -function handleExpiredDeadline(call) { - const err = new Error('Deadline exceeded'); - err.code = constants_1.Status.DEADLINE_EXCEEDED; - call.sendError(err); - call.cancelled = true; - call.emit('cancelled', 'deadline'); -} -//# sourceMappingURL=server-call.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/server-call.js.map b/node_modules/@grpc/grpc-js/build/src/server-call.js.map deleted file mode 100644 index 38c89f0a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server-call.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"server-call.js","sourceRoot":"","sources":["../../src/server-call.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mCAAsC;AACtC,+BAA+B;AAC/B,mCAAoD;AAGpD,2CAKqB;AAErB,yCAAsC;AACtC,qDAAiD;AAGjD,qCAAqC;AAErC,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAMD,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;AAC3D,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC3C,MAAM,kBAAkB,GAAG,aAAa,CAAC;AACzC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC3C,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,MAAM,iBAAiB,GAA+B;IACpD,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,QAAQ;CACZ,CAAC;AACF,MAAM,sBAAsB,GAAG;IAC7B,yEAAyE;IACzE,kCAAkC;IAClC,CAAC,2BAA2B,CAAC,EAAE,UAAU;IACzC,CAAC,oBAAoB,CAAC,EAAE,UAAU;IAClC,CAAC,KAAK,CAAC,SAAS,CAAC,mBAA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/grpc-js/build/src/server-credentials.d.ts b/node_modules/@grpc/grpc-js/build/src/server-credentials.d.ts deleted file mode 100644 index e9efcdad..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server-credentials.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -import { SecureServerOptions } from 'http2'; -export interface KeyCertPair { - private_key: Buffer; - cert_chain: Buffer; -} -export declare abstract class ServerCredentials { - abstract _isSecure(): boolean; - abstract _getSettings(): SecureServerOptions | null; - static createInsecure(): ServerCredentials; - static createSsl(rootCerts: Buffer | null, keyCertPairs: KeyCertPair[], checkClientCertificate?: boolean): ServerCredentials; -} diff --git a/node_modules/@grpc/grpc-js/build/src/server-credentials.js b/node_modules/@grpc/grpc-js/build/src/server-credentials.js deleted file mode 100644 index 35cea62b..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server-credentials.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ServerCredentials = void 0; -const tls_helpers_1 = require("./tls-helpers"); -class ServerCredentials { - static createInsecure() { - return new InsecureServerCredentials(); - } - static createSsl(rootCerts, keyCertPairs, checkClientCertificate = false) { - if (rootCerts !== null && !Buffer.isBuffer(rootCerts)) { - throw new TypeError('rootCerts must be null or a Buffer'); - } - if (!Array.isArray(keyCertPairs)) { - throw new TypeError('keyCertPairs must be an array'); - } - if (typeof checkClientCertificate !== 'boolean') { - throw new TypeError('checkClientCertificate must be a boolean'); - } - const cert = []; - const key = []; - for (let i = 0; i < keyCertPairs.length; i++) { - const pair = keyCertPairs[i]; - if (pair === null || typeof pair !== 'object') { - throw new TypeError(`keyCertPair[${i}] must be an object`); - } - if (!Buffer.isBuffer(pair.private_key)) { - throw new TypeError(`keyCertPair[${i}].private_key must be a Buffer`); - } - if (!Buffer.isBuffer(pair.cert_chain)) { - throw new TypeError(`keyCertPair[${i}].cert_chain must be a Buffer`); - } - cert.push(pair.cert_chain); - key.push(pair.private_key); - } - return new SecureServerCredentials({ - ca: rootCerts || tls_helpers_1.getDefaultRootsData() || undefined, - cert, - key, - requestCert: checkClientCertificate, - ciphers: tls_helpers_1.CIPHER_SUITES, - }); - } -} -exports.ServerCredentials = ServerCredentials; -class InsecureServerCredentials extends ServerCredentials { - _isSecure() { - return false; - } - _getSettings() { - return null; - } -} -class SecureServerCredentials extends ServerCredentials { - constructor(options) { - super(); - this.options = options; - } - _isSecure() { - return true; - } - _getSettings() { - return this.options; - } -} -//# sourceMappingURL=server-credentials.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/server-credentials.js.map b/node_modules/@grpc/grpc-js/build/src/server-credentials.js.map deleted file mode 100644 index d9a8cd5a..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server-credentials.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"server-credentials.js","sourceRoot":"","sources":["../../src/server-credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,+CAAmE;AAOnE,MAAsB,iBAAiB;IAIrC,MAAM,CAAC,cAAc;QACnB,OAAO,IAAI,yBAAyB,EAAE,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,SAAS,CACd,SAAwB,EACxB,YAA2B,EAC3B,sBAAsB,GAAG,KAAK;QAE9B,IAAI,SAAS,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YACrD,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;SAC3D;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAA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C;IACf,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,uBAAwB,SAAQ,iBAAiB;IAGrD,YAAY,OAA4B;QACtC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/server.d.ts b/node_modules/@grpc/grpc-js/build/src/server.d.ts deleted file mode 100644 index 268f2db9..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Deserialize, Serialize, ServiceDefinition } from './make-client'; -import { HandleCall } from './server-call'; -import { ServerCredentials } from './server-credentials'; -import { ChannelOptions } from './channel-options'; -export declare type UntypedHandleCall = HandleCall; -export interface UntypedServiceImplementation { - [name: string]: UntypedHandleCall; -} -export declare class Server { - private http2ServerList; - private handlers; - private sessions; - private started; - private options; - constructor(options?: ChannelOptions); - addProtoService(): void; - addService(service: ServiceDefinition, implementation: UntypedServiceImplementation): void; - removeService(service: ServiceDefinition): void; - bind(port: string, creds: ServerCredentials): void; - bindAsync(port: string, creds: ServerCredentials, callback: (error: Error | null, port: number) => void): void; - forceShutdown(): void; - register(name: string, handler: HandleCall, serialize: Serialize, deserialize: Deserialize, type: string): boolean; - unregister(name: string): boolean; - start(): void; - tryShutdown(callback: (error?: Error) => void): void; - addHttp2Port(): void; - private _setupHandlers; -} diff --git a/node_modules/@grpc/grpc-js/build/src/server.js b/node_modules/@grpc/grpc-js/build/src/server.js deleted file mode 100644 index 92c0339b..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server.js +++ /dev/null @@ -1,479 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Server = void 0; -const http2 = require("http2"); -const constants_1 = require("./constants"); -const metadata_1 = require("./metadata"); -const server_call_1 = require("./server-call"); -const resolver_1 = require("./resolver"); -const logging = require("./logging"); -const subchannel_1 = require("./subchannel"); -const uri_parser_1 = require("./uri-parser"); -const TRACER_NAME = 'server'; -function trace(text) { - logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); -} -function noop() { } -function getUnimplementedStatusResponse(methodName) { - return { - code: constants_1.Status.UNIMPLEMENTED, - details: `The server does not implement the method ${methodName}`, - metadata: new metadata_1.Metadata(), - }; -} -function getDefaultHandler(handlerType, methodName) { - const unimplementedStatusResponse = getUnimplementedStatusResponse(methodName); - switch (handlerType) { - case 'unary': - return (call, callback) => { - callback(unimplementedStatusResponse, null); - }; - case 'clientStream': - return (call, callback) => { - callback(unimplementedStatusResponse, null); - }; - case 'serverStream': - return (call) => { - call.emit('error', unimplementedStatusResponse); - }; - case 'bidi': - return (call) => { - call.emit('error', unimplementedStatusResponse); - }; - default: - throw new Error(`Invalid handlerType ${handlerType}`); - } -} -class Server { - constructor(options) { - this.http2ServerList = []; - this.handlers = new Map(); - this.sessions = new Set(); - this.started = false; - this.options = options !== null && options !== void 0 ? options : {}; - } - addProtoService() { - throw new Error('Not implemented. Use addService() instead'); - } - addService(service, implementation) { - if (service === null || - typeof service !== 'object' || - implementation === null || - typeof implementation !== 'object') { - throw new Error('addService() requires two objects as arguments'); - } - const serviceKeys = Object.keys(service); - if (serviceKeys.length === 0) { - throw new Error('Cannot add an empty service to a server'); - } - serviceKeys.forEach((name) => { - const attrs = service[name]; - let methodType; - if (attrs.requestStream) { - if (attrs.responseStream) { - methodType = 'bidi'; - } - else { - methodType = 'clientStream'; - } - } - else { - if (attrs.responseStream) { - methodType = 'serverStream'; - } - else { - methodType = 'unary'; - } - } - let implFn = implementation[name]; - let impl; - if (implFn === undefined && typeof attrs.originalName === 'string') { - implFn = implementation[attrs.originalName]; - } - if (implFn !== undefined) { - impl = implFn.bind(implementation); - } - else { - impl = getDefaultHandler(methodType, name); - } - const success = this.register(attrs.path, impl, attrs.responseSerialize, attrs.requestDeserialize, methodType); - if (success === false) { - throw new Error(`Method handler for ${attrs.path} already provided.`); - } - }); - } - removeService(service) { - if (service === null || - typeof service !== 'object') { - throw new Error('removeService() requires object as argument'); - } - const serviceKeys = Object.keys(service); - serviceKeys.forEach((name) => { - const attrs = service[name]; - this.unregister(attrs.path); - }); - } - bind(port, creds) { - throw new Error('Not implemented. Use bindAsync() instead'); - } - bindAsync(port, creds, callback) { - if (this.started === true) { - throw new Error('server is already started'); - } - if (typeof port !== 'string') { - throw new TypeError('port must be a string'); - } - if (creds === null || typeof creds !== 'object') { - throw new TypeError('creds must be an object'); - } - if (typeof callback !== 'function') { - throw new TypeError('callback must be a function'); - } - const initialPortUri = uri_parser_1.parseUri(port); - if (initialPortUri === null) { - throw new Error(`Could not parse port "${port}"`); - } - const portUri = resolver_1.mapUriDefaultScheme(initialPortUri); - if (portUri === null) { - throw new Error(`Could not get a default scheme for port "${port}"`); - } - const serverOptions = { - maxSendHeaderBlockLength: Number.MAX_SAFE_INTEGER - }; - if ('grpc.max_concurrent_streams' in this.options) { - serverOptions.settings = { - maxConcurrentStreams: this.options['grpc.max_concurrent_streams'], - }; - } - const setupServer = () => { - let http2Server; - if (creds._isSecure()) { - const secureServerOptions = Object.assign(serverOptions, creds._getSettings()); - http2Server = http2.createSecureServer(secureServerOptions); - } - else { - http2Server = http2.createServer(serverOptions); - } - http2Server.setTimeout(0, noop); - this._setupHandlers(http2Server); - return http2Server; - }; - const bindSpecificPort = (addressList, portNum, previousCount) => { - if (addressList.length === 0) { - return Promise.resolve({ port: portNum, count: previousCount }); - } - return Promise.all(addressList.map((address) => { - trace('Attempting to bind ' + subchannel_1.subchannelAddressToString(address)); - let addr; - if (subchannel_1.isTcpSubchannelAddress(address)) { - addr = { - host: address.host, - port: portNum, - }; - } - else { - addr = address; - } - const http2Server = setupServer(); - return new Promise((resolve, reject) => { - function onError(err) { - resolve(err); - } - http2Server.once('error', onError); - http2Server.listen(addr, () => { - trace('Successfully bound ' + subchannel_1.subchannelAddressToString(address)); - this.http2ServerList.push(http2Server); - const boundAddress = http2Server.address(); - if (typeof boundAddress === 'string') { - resolve(portNum); - } - else { - resolve(boundAddress.port); - } - http2Server.removeListener('error', onError); - }); - }); - })).then((results) => { - let count = 0; - for (const result of results) { - if (typeof result === 'number') { - count += 1; - if (result !== portNum) { - throw new Error('Invalid state: multiple port numbers added from single address'); - } - } - } - return { - port: portNum, - count: count + previousCount, - }; - }); - }; - const bindWildcardPort = (addressList) => { - if (addressList.length === 0) { - return Promise.resolve({ port: 0, count: 0 }); - } - const address = addressList[0]; - const http2Server = setupServer(); - return new Promise((resolve, reject) => { - function onError(err) { - resolve(bindWildcardPort(addressList.slice(1))); - } - http2Server.once('error', onError); - http2Server.listen(address, () => { - this.http2ServerList.push(http2Server); - resolve(bindSpecificPort(addressList.slice(1), http2Server.address().port, 1)); - http2Server.removeListener('error', onError); - }); - }); - }; - const resolverListener = { - onSuccessfulResolution: (addressList, serviceConfig, serviceConfigError) => { - // We only want one resolution result. Discard all future results - resolverListener.onSuccessfulResolution = () => { }; - if (addressList.length === 0) { - callback(new Error(`No addresses resolved for port ${port}`), 0); - return; - } - let bindResultPromise; - if (subchannel_1.isTcpSubchannelAddress(addressList[0])) { - if (addressList[0].port === 0) { - bindResultPromise = bindWildcardPort(addressList); - } - else { - bindResultPromise = bindSpecificPort(addressList, addressList[0].port, 0); - } - } - else { - // Use an arbitrary non-zero port for non-TCP addresses - bindResultPromise = bindSpecificPort(addressList, 1, 0); - } - bindResultPromise.then((bindResult) => { - if (bindResult.count === 0) { - const errorString = `No address added out of total ${addressList.length} resolved`; - logging.log(constants_1.LogVerbosity.ERROR, errorString); - callback(new Error(errorString), 0); - } - else { - if (bindResult.count < addressList.length) { - logging.log(constants_1.LogVerbosity.INFO, `WARNING Only ${bindResult.count} addresses added out of total ${addressList.length} resolved`); - } - callback(null, bindResult.port); - } - }, (error) => { - const errorString = `No address added out of total ${addressList.length} resolved`; - logging.log(constants_1.LogVerbosity.ERROR, errorString); - callback(new Error(errorString), 0); - }); - }, - onError: (error) => { - callback(new Error(error.details), 0); - }, - }; - const resolver = resolver_1.createResolver(portUri, resolverListener, this.options); - resolver.updateResolution(); - } - forceShutdown() { - // Close the server if it is still running. - for (const http2Server of this.http2ServerList) { - if (http2Server.listening) { - http2Server.close(); - } - } - this.started = false; - // Always destroy any available sessions. It's possible that one or more - // tryShutdown() calls are in progress. Don't wait on them to finish. - this.sessions.forEach((session) => { - // Cast NGHTTP2_CANCEL to any because TypeScript doesn't seem to - // recognize destroy(code) as a valid signature. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - session.destroy(http2.constants.NGHTTP2_CANCEL); - }); - this.sessions.clear(); - } - register(name, handler, serialize, deserialize, type) { - if (this.handlers.has(name)) { - return false; - } - this.handlers.set(name, { - func: handler, - serialize, - deserialize, - type, - path: name, - }); - return true; - } - unregister(name) { - return this.handlers.delete(name); - } - start() { - if (this.http2ServerList.length === 0 || - this.http2ServerList.every((http2Server) => http2Server.listening !== true)) { - throw new Error('server must be bound in order to start'); - } - if (this.started === true) { - throw new Error('server is already started'); - } - this.started = true; - } - tryShutdown(callback) { - let pendingChecks = 0; - function maybeCallback() { - pendingChecks--; - if (pendingChecks === 0) { - callback(); - } - } - // Close the server if necessary. - this.started = false; - for (const http2Server of this.http2ServerList) { - if (http2Server.listening) { - pendingChecks++; - http2Server.close(maybeCallback); - } - } - this.sessions.forEach((session) => { - if (!session.closed) { - pendingChecks += 1; - session.close(maybeCallback); - } - }); - if (pendingChecks === 0) { - callback(); - } - } - addHttp2Port() { - throw new Error('Not yet implemented'); - } - _setupHandlers(http2Server) { - if (http2Server === null) { - return; - } - http2Server.on('stream', (stream, headers) => { - const contentType = headers[http2.constants.HTTP2_HEADER_CONTENT_TYPE]; - if (typeof contentType !== 'string' || - !contentType.startsWith('application/grpc')) { - stream.respond({ - [http2.constants.HTTP2_HEADER_STATUS]: http2.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE, - }, { endStream: true }); - return; - } - try { - const path = headers[http2.constants.HTTP2_HEADER_PATH]; - const serverAddress = http2Server.address(); - let serverAddressString = 'null'; - if (serverAddress) { - if (typeof serverAddress === 'string') { - serverAddressString = serverAddress; - } - else { - serverAddressString = - serverAddress.address + ':' + serverAddress.port; - } - } - trace('Received call to method ' + - path + - ' at address ' + - serverAddressString); - const handler = this.handlers.get(path); - if (handler === undefined) { - trace('No handler registered for method ' + - path + - '. Sending UNIMPLEMENTED status.'); - throw getUnimplementedStatusResponse(path); - } - const call = new server_call_1.Http2ServerCallStream(stream, handler, this.options); - const metadata = call.receiveMetadata(headers); - switch (handler.type) { - case 'unary': - handleUnary(call, handler, metadata); - break; - case 'clientStream': - handleClientStreaming(call, handler, metadata); - break; - case 'serverStream': - handleServerStreaming(call, handler, metadata); - break; - case 'bidi': - handleBidiStreaming(call, handler, metadata); - break; - default: - throw new Error(`Unknown handler type: ${handler.type}`); - } - } - catch (err) { - const call = new server_call_1.Http2ServerCallStream(stream, null, this.options); - if (err.code === undefined) { - err.code = constants_1.Status.INTERNAL; - } - call.sendError(err); - } - }); - http2Server.on('session', (session) => { - if (!this.started) { - session.destroy(); - return; - } - this.sessions.add(session); - session.on('close', () => { - this.sessions.delete(session); - }); - }); - } -} -exports.Server = Server; -async function handleUnary(call, handler, metadata) { - const request = await call.receiveUnaryMessage(); - if (request === undefined || call.cancelled) { - return; - } - const emitter = new server_call_1.ServerUnaryCallImpl(call, metadata, request); - handler.func(emitter, (err, value, trailer, flags) => { - call.sendUnaryMessage(err, value, trailer, flags); - }); -} -function handleClientStreaming(call, handler, metadata) { - const stream = new server_call_1.ServerReadableStreamImpl(call, metadata, handler.deserialize); - function respond(err, value, trailer, flags) { - stream.destroy(); - call.sendUnaryMessage(err, value, trailer, flags); - } - if (call.cancelled) { - return; - } - stream.on('error', respond); - handler.func(stream, respond); -} -async function handleServerStreaming(call, handler, metadata) { - const request = await call.receiveUnaryMessage(); - if (request === undefined || call.cancelled) { - return; - } - const stream = new server_call_1.ServerWritableStreamImpl(call, metadata, handler.serialize, request); - handler.func(stream); -} -function handleBidiStreaming(call, handler, metadata) { - const stream = new server_call_1.ServerDuplexStreamImpl(call, metadata, handler.serialize, handler.deserialize); - if (call.cancelled) { - return; - } - handler.func(stream); -} -//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/server.js.map b/node_modules/@grpc/grpc-js/build/src/server.js.map deleted file mode 100644 index 6292fcbf..00000000 --- a/node_modules/@grpc/grpc-js/build/src/server.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+BAA+B;AAI/B,2CAAmD;AAEnD,yCAAsC;AACtC,+CAoBuB;AAGvB,yCAIoB;AACpB,qCAAqC;AACrC,6CAKsB;AACtB,6CAAwC;AAExC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAE7B,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAOD,SAAS,IAAI,KAAU,CAAC;AAExB,SAAS,8BAA8B,CACrC,UAAkB;IAElB,OAAO;QACL,IAAI,EAAE,kBAAM,CAAC,aAAa;QAC1B,OAAO,EAAE,4CAA4C,UAAU,EAAE;QACjE,QAAQ,EAAE,IAAI,mBAAQ,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CAAC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/service-config.d.ts b/node_modules/@grpc/grpc-js/build/src/service-config.d.ts deleted file mode 100644 index 58982990..00000000 --- a/node_modules/@grpc/grpc-js/build/src/service-config.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { LoadBalancingConfig } from './load-balancer'; -export interface MethodConfigName { - service: string; - method?: string; -} -export interface MethodConfig { - name: MethodConfigName[]; - waitForReady?: boolean; - timeout?: string; - maxRequestBytes?: number; - maxResponseBytes?: number; -} -export interface ServiceConfig { - loadBalancingPolicy?: string; - loadBalancingConfig: LoadBalancingConfig[]; - methodConfig: MethodConfig[]; -} -export interface ServiceConfigCanaryConfig { - clientLanguage?: string[]; - percentage?: number; - clientHostname?: string[]; - serviceConfig: ServiceConfig; -} -export declare function validateServiceConfig(obj: any): ServiceConfig; -/** - * Find the "grpc_config" record among the TXT records, parse its value as JSON, validate its contents, - * and select a service config with selection fields that all match this client. Most of these steps - * can fail with an error; the caller must handle any errors thrown this way. - * @param txtRecord The TXT record array that is output from a successful call to dns.resolveTxt - * @param percentage A number chosen from the range [0, 100) that is used to select which config to use - * @return The service configuration to use, given the percentage value, or null if the service config - * data has a valid format but none of the options match the current client. - */ -export declare function extractAndSelectServiceConfig(txtRecord: string[][], percentage: number): ServiceConfig | null; diff --git a/node_modules/@grpc/grpc-js/build/src/service-config.js b/node_modules/@grpc/grpc-js/build/src/service-config.js deleted file mode 100644 index 04bcefe0..00000000 --- a/node_modules/@grpc/grpc-js/build/src/service-config.js +++ /dev/null @@ -1,264 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.extractAndSelectServiceConfig = exports.validateServiceConfig = void 0; -/* This file implements gRFC A2 and the service config spec: - * https://github.com/grpc/proposal/blob/master/A2-service-configs-in-dns.md - * https://github.com/grpc/grpc/blob/master/doc/service_config.md. Each - * function here takes an object with unknown structure and returns its - * specific object type if the input has the right structure, and throws an - * error otherwise. */ -/* The any type is purposely used here. All functions validate their input at - * runtime */ -/* eslint-disable @typescript-eslint/no-explicit-any */ -const os = require("os"); -const load_balancer_1 = require("./load-balancer"); -/** - * Recognizes a number with up to 9 digits after the decimal point, followed by - * an "s", representing a number of seconds. - */ -const TIMEOUT_REGEX = /^\d+(\.\d{1,9})?s$/; -/** - * Client language name used for determining whether this client matches a - * `ServiceConfigCanaryConfig`'s `clientLanguage` list. - */ -const CLIENT_LANGUAGE_STRING = 'node'; -function validateName(obj) { - if (!('service' in obj) || typeof obj.service !== 'string') { - throw new Error('Invalid method config name: invalid service'); - } - const result = { - service: obj.service, - }; - if ('method' in obj) { - if (typeof obj.method === 'string') { - result.method = obj.method; - } - else { - throw new Error('Invalid method config name: invalid method'); - } - } - return result; -} -function validateMethodConfig(obj) { - const result = { - name: [], - }; - if (!('name' in obj) || !Array.isArray(obj.name)) { - throw new Error('Invalid method config: invalid name array'); - } - for (const name of obj.name) { - result.name.push(validateName(name)); - } - if ('waitForReady' in obj) { - if (typeof obj.waitForReady !== 'boolean') { - throw new Error('Invalid method config: invalid waitForReady'); - } - result.waitForReady = obj.waitForReady; - } - if ('timeout' in obj) { - if (!(typeof obj.timeout === 'string') || - !TIMEOUT_REGEX.test(obj.timeout)) { - throw new Error('Invalid method config: invalid timeout'); - } - result.timeout = obj.timeout; - } - if ('maxRequestBytes' in obj) { - if (typeof obj.maxRequestBytes !== 'number') { - throw new Error('Invalid method config: invalid maxRequestBytes'); - } - result.maxRequestBytes = obj.maxRequestBytes; - } - if ('maxResponseBytes' in obj) { - if (typeof obj.maxResponseBytes !== 'number') { - throw new Error('Invalid method config: invalid maxRequestBytes'); - } - result.maxResponseBytes = obj.maxResponseBytes; - } - return result; -} -function validateServiceConfig(obj) { - const result = { - loadBalancingConfig: [], - methodConfig: [], - }; - if ('loadBalancingPolicy' in obj) { - if (typeof obj.loadBalancingPolicy === 'string') { - result.loadBalancingPolicy = obj.loadBalancingPolicy; - } - else { - throw new Error('Invalid service config: invalid loadBalancingPolicy'); - } - } - if ('loadBalancingConfig' in obj) { - if (Array.isArray(obj.loadBalancingConfig)) { - for (const config of obj.loadBalancingConfig) { - result.loadBalancingConfig.push(load_balancer_1.validateLoadBalancingConfig(config)); - } - } - else { - throw new Error('Invalid service config: invalid loadBalancingConfig'); - } - } - if ('methodConfig' in obj) { - if (Array.isArray(obj.methodConfig)) { - for (const methodConfig of obj.methodConfig) { - result.methodConfig.push(validateMethodConfig(methodConfig)); - } - } - } - // Validate method name uniqueness - const seenMethodNames = []; - for (const methodConfig of result.methodConfig) { - for (const name of methodConfig.name) { - for (const seenName of seenMethodNames) { - if (name.service === seenName.service && - name.method === seenName.method) { - throw new Error(`Invalid service config: duplicate name ${name.service}/${name.method}`); - } - } - seenMethodNames.push(name); - } - } - return result; -} -exports.validateServiceConfig = validateServiceConfig; -function validateCanaryConfig(obj) { - if (!('serviceConfig' in obj)) { - throw new Error('Invalid service config choice: missing service config'); - } - const result = { - serviceConfig: validateServiceConfig(obj.serviceConfig), - }; - if ('clientLanguage' in obj) { - if (Array.isArray(obj.clientLanguage)) { - result.clientLanguage = []; - for (const lang of obj.clientLanguage) { - if (typeof lang === 'string') { - result.clientLanguage.push(lang); - } - else { - throw new Error('Invalid service config choice: invalid clientLanguage'); - } - } - } - else { - throw new Error('Invalid service config choice: invalid clientLanguage'); - } - } - if ('clientHostname' in obj) { - if (Array.isArray(obj.clientHostname)) { - result.clientHostname = []; - for (const lang of obj.clientHostname) { - if (typeof lang === 'string') { - result.clientHostname.push(lang); - } - else { - throw new Error('Invalid service config choice: invalid clientHostname'); - } - } - } - else { - throw new Error('Invalid service config choice: invalid clientHostname'); - } - } - if ('percentage' in obj) { - if (typeof obj.percentage === 'number' && - 0 <= obj.percentage && - obj.percentage <= 100) { - result.percentage = obj.percentage; - } - else { - throw new Error('Invalid service config choice: invalid percentage'); - } - } - // Validate that no unexpected fields are present - const allowedFields = [ - 'clientLanguage', - 'percentage', - 'clientHostname', - 'serviceConfig', - ]; - for (const field in obj) { - if (!allowedFields.includes(field)) { - throw new Error(`Invalid service config choice: unexpected field ${field}`); - } - } - return result; -} -function validateAndSelectCanaryConfig(obj, percentage) { - if (!Array.isArray(obj)) { - throw new Error('Invalid service config list'); - } - for (const config of obj) { - const validatedConfig = validateCanaryConfig(config); - /* For each field, we check if it is present, then only discard the - * config if the field value does not match the current client */ - if (typeof validatedConfig.percentage === 'number' && - percentage > validatedConfig.percentage) { - continue; - } - if (Array.isArray(validatedConfig.clientHostname)) { - let hostnameMatched = false; - for (const hostname of validatedConfig.clientHostname) { - if (hostname === os.hostname()) { - hostnameMatched = true; - } - } - if (!hostnameMatched) { - continue; - } - } - if (Array.isArray(validatedConfig.clientLanguage)) { - let languageMatched = false; - for (const language of validatedConfig.clientLanguage) { - if (language === CLIENT_LANGUAGE_STRING) { - languageMatched = true; - } - } - if (!languageMatched) { - continue; - } - } - return validatedConfig.serviceConfig; - } - throw new Error('No matching service config found'); -} -/** - * Find the "grpc_config" record among the TXT records, parse its value as JSON, validate its contents, - * and select a service config with selection fields that all match this client. Most of these steps - * can fail with an error; the caller must handle any errors thrown this way. - * @param txtRecord The TXT record array that is output from a successful call to dns.resolveTxt - * @param percentage A number chosen from the range [0, 100) that is used to select which config to use - * @return The service configuration to use, given the percentage value, or null if the service config - * data has a valid format but none of the options match the current client. - */ -function extractAndSelectServiceConfig(txtRecord, percentage) { - for (const record of txtRecord) { - if (record.length > 0 && record[0].startsWith('grpc_config=')) { - /* Treat the list of strings in this record as a single string and remove - * "grpc_config=" from the beginning. The rest should be a JSON string */ - const recordString = record.join('').substring('grpc_config='.length); - const recordJson = JSON.parse(recordString); - return validateAndSelectCanaryConfig(recordJson, percentage); - } - } - return null; -} -exports.extractAndSelectServiceConfig = extractAndSelectServiceConfig; -//# sourceMappingURL=service-config.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/service-config.js.map b/node_modules/@grpc/grpc-js/build/src/service-config.js.map deleted file mode 100644 index e22b1412..00000000 --- a/node_modules/@grpc/grpc-js/build/src/service-config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"service-config.js","sourceRoot":"","sources":["../../src/service-config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH;;;;;sBAKsB;AAEtB;aACa;AACb,uDAAuD;AAEvD,yBAAyB;AACzB,mDAAmF;AA4BnF;;;GAGG;AACH,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C;;;GAGG;AACH,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAEtC,SAAS,YAAY,CAAC,GAAQ;IAC5B,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE;QAC1D,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAChE;IACD,MAAM,MAAM,GAAqB;QAC/B,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB,CAAC;IACF,IAAI,QAAQ,IAAI,GAAG,EAAE;QACnB,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE;YAClC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;SAC5B;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAQ;IACpC,MAAM,MAAM,GAAiB;QAC3B,IAAI,EAAE,EAAE;KACT,CAAC;IACF,IAAI,CAAC,CAAC,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,CAAC;YAC5B,KAAK,MAAM,QAAQ,IAAI,eAAe,CAAC,cAAc,EAAE;gBACrD,IAAI,QAAQ,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE;oBAC9B,eAAe,GAAG,IAAI,CAAC;iBACxB;aACF;YACD,IAAI,CAAC,eAAe,EAAE;gBACpB,SAAS;aACV;SACF;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE;YACjD,IAAI,eAAe,GAAG,KAAK,CAAC;YAC5B,KAAK,MAAM,QAAQ,IAAI,eAAe,CAAC,cAAc,EAAE;gBACrD,IAAI,QAAQ,KAAK,sBAAsB,EAAE;oBACvC,eAAe,GAAG,IAAI,CAAC;iBACxB;aACF;YACD,IAAI,CAAC,eAAe,EAAE;gBACpB,SAAS;aACV;SACF;QACD,OAAO,eAAe,CAAC,aAAa,CAAC;KACtC;IACD,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,6BAA6B,CAC3C,SAAqB,EACrB,UAAkB;IAElB,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE;QAC9B,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;YAC7D;qFACyE;YACzE,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACtE,MAAM,UAAU,GAAQ,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACjD,OAAO,6BAA6B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;SAC9D;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAdD,sEAcC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/status-builder.d.ts b/node_modules/@grpc/grpc-js/build/src/status-builder.d.ts deleted file mode 100644 index e8fbcec1..00000000 --- a/node_modules/@grpc/grpc-js/build/src/status-builder.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { StatusObject } from './call-stream'; -import { Status } from './constants'; -import { Metadata } from './metadata'; -/** - * A builder for gRPC status objects. - */ -export declare class StatusBuilder { - private code; - private details; - private metadata; - constructor(); - /** - * Adds a status code to the builder. - */ - withCode(code: Status): this; - /** - * Adds details to the builder. - */ - withDetails(details: string): this; - /** - * Adds metadata to the builder. - */ - withMetadata(metadata: Metadata): this; - /** - * Builds the status object. - */ - build(): Partial; -} diff --git a/node_modules/@grpc/grpc-js/build/src/status-builder.js b/node_modules/@grpc/grpc-js/build/src/status-builder.js deleted file mode 100644 index 7426e54b..00000000 --- a/node_modules/@grpc/grpc-js/build/src/status-builder.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StatusBuilder = void 0; -/** - * A builder for gRPC status objects. - */ -class StatusBuilder { - constructor() { - this.code = null; - this.details = null; - this.metadata = null; - } - /** - * Adds a status code to the builder. - */ - withCode(code) { - this.code = code; - return this; - } - /** - * Adds details to the builder. - */ - withDetails(details) { - this.details = details; - return this; - } - /** - * Adds metadata to the builder. - */ - withMetadata(metadata) { - this.metadata = metadata; - return this; - } - /** - * Builds the status object. - */ - build() { - const status = {}; - if (this.code !== null) { - status.code = this.code; - } - if (this.details !== null) { - status.details = this.details; - } - if (this.metadata !== null) { - status.metadata = this.metadata; - } - return status; - } -} -exports.StatusBuilder = StatusBuilder; -//# sourceMappingURL=status-builder.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/status-builder.js.map b/node_modules/@grpc/grpc-js/build/src/status-builder.js.map deleted file mode 100644 index 3543d396..00000000 --- a/node_modules/@grpc/grpc-js/build/src/status-builder.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"status-builder.js","sourceRoot":"","sources":["../../src/status-builder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAMH;;GAEG;AACH,MAAa,aAAa;IAKxB;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,IAAY;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,QAAkB;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK;QACH,MAAM,MAAM,GAA0B,EAAE,CAAC;QAEzC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;YACtB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;SACzB;QAED,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE;YACzB,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;SAC/B;QAED,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;YAC1B,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;SACjC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAvDD,sCAuDC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/stream-decoder.d.ts b/node_modules/@grpc/grpc-js/build/src/stream-decoder.d.ts deleted file mode 100644 index 512962f1..00000000 --- a/node_modules/@grpc/grpc-js/build/src/stream-decoder.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// -export declare class StreamDecoder { - private readState; - private readCompressFlag; - private readPartialSize; - private readSizeRemaining; - private readMessageSize; - private readPartialMessage; - private readMessageRemaining; - write(data: Buffer): Buffer[]; -} diff --git a/node_modules/@grpc/grpc-js/build/src/stream-decoder.js b/node_modules/@grpc/grpc-js/build/src/stream-decoder.js deleted file mode 100644 index 5c64d429..00000000 --- a/node_modules/@grpc/grpc-js/build/src/stream-decoder.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StreamDecoder = void 0; -var ReadState; -(function (ReadState) { - ReadState[ReadState["NO_DATA"] = 0] = "NO_DATA"; - ReadState[ReadState["READING_SIZE"] = 1] = "READING_SIZE"; - ReadState[ReadState["READING_MESSAGE"] = 2] = "READING_MESSAGE"; -})(ReadState || (ReadState = {})); -class StreamDecoder { - constructor() { - this.readState = ReadState.NO_DATA; - this.readCompressFlag = Buffer.alloc(1); - this.readPartialSize = Buffer.alloc(4); - this.readSizeRemaining = 4; - this.readMessageSize = 0; - this.readPartialMessage = []; - this.readMessageRemaining = 0; - } - write(data) { - let readHead = 0; - let toRead; - const result = []; - while (readHead < data.length) { - switch (this.readState) { - case ReadState.NO_DATA: - this.readCompressFlag = data.slice(readHead, readHead + 1); - readHead += 1; - this.readState = ReadState.READING_SIZE; - this.readPartialSize.fill(0); - this.readSizeRemaining = 4; - this.readMessageSize = 0; - this.readMessageRemaining = 0; - this.readPartialMessage = []; - break; - case ReadState.READING_SIZE: - toRead = Math.min(data.length - readHead, this.readSizeRemaining); - data.copy(this.readPartialSize, 4 - this.readSizeRemaining, readHead, readHead + toRead); - this.readSizeRemaining -= toRead; - readHead += toRead; - // readSizeRemaining >=0 here - if (this.readSizeRemaining === 0) { - this.readMessageSize = this.readPartialSize.readUInt32BE(0); - this.readMessageRemaining = this.readMessageSize; - if (this.readMessageRemaining > 0) { - this.readState = ReadState.READING_MESSAGE; - } - else { - const message = Buffer.concat([this.readCompressFlag, this.readPartialSize], 5); - this.readState = ReadState.NO_DATA; - result.push(message); - } - } - break; - case ReadState.READING_MESSAGE: - toRead = Math.min(data.length - readHead, this.readMessageRemaining); - this.readPartialMessage.push(data.slice(readHead, readHead + toRead)); - this.readMessageRemaining -= toRead; - readHead += toRead; - // readMessageRemaining >=0 here - if (this.readMessageRemaining === 0) { - // At this point, we have read a full message - const framedMessageBuffers = [ - this.readCompressFlag, - this.readPartialSize, - ].concat(this.readPartialMessage); - const framedMessage = Buffer.concat(framedMessageBuffers, this.readMessageSize + 5); - this.readState = ReadState.NO_DATA; - result.push(framedMessage); - } - break; - default: - throw new Error('Unexpected read state'); - } - } - return result; - } -} -exports.StreamDecoder = StreamDecoder; -//# sourceMappingURL=stream-decoder.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/stream-decoder.js.map b/node_modules/@grpc/grpc-js/build/src/stream-decoder.js.map deleted file mode 100644 index adc033e8..00000000 --- a/node_modules/@grpc/grpc-js/build/src/stream-decoder.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stream-decoder.js","sourceRoot":"","sources":["../../src/stream-decoder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AA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gCAAgC;oBAChC,IAAI,IAAI,CAAC,oBAAoB,KAAK,CAAC,EAAE;wBACnC,6CAA6C;wBAC7C,MAAM,oBAAoB,GAAG;4BAC3B,IAAI,CAAC,gBAAgB;4BACrB,IAAI,CAAC,eAAe;yBACrB,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;wBAClC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CACjC,oBAAoB,EACpB,IAAI,CAAC,eAAe,GAAG,CAAC,CACzB,CAAC;wBAEF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;wBACnC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;qBAC5B;oBACD,MAAM;gBACR;oBACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;aAC5C;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjFD,sCAiFC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/subchannel-pool.d.ts b/node_modules/@grpc/grpc-js/build/src/subchannel-pool.d.ts deleted file mode 100644 index 48347b58..00000000 --- a/node_modules/@grpc/grpc-js/build/src/subchannel-pool.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ChannelOptions } from './channel-options'; -import { Subchannel, SubchannelAddress } from './subchannel'; -import { ChannelCredentials } from './channel-credentials'; -import { GrpcUri } from './uri-parser'; -export declare class SubchannelPool { - private global; - private pool; - /** - * A timer of a task performing a periodic subchannel cleanup. - */ - private cleanupTimer; - /** - * A pool of subchannels use for making connections. Subchannels with the - * exact same parameters will be reused. - * @param global If true, this is the global subchannel pool. Otherwise, it - * is the pool for a single channel. - */ - constructor(global: boolean); - /** - * Unrefs all unused subchannels and cancels the cleanup task if all - * subchannels have been unrefed. - */ - unrefUnusedSubchannels(): void; - /** - * Ensures that the cleanup task is spawned. - */ - ensureCleanupTask(): void; - /** - * Get a subchannel if one already exists with exactly matching parameters. - * Otherwise, create and save a subchannel with those parameters. - * @param channelTarget - * @param subchannelTarget - * @param channelArguments - * @param channelCredentials - */ - getOrCreateSubchannel(channelTargetUri: GrpcUri, subchannelTarget: SubchannelAddress, channelArguments: ChannelOptions, channelCredentials: ChannelCredentials): Subchannel; -} -/** - * Get either the global subchannel pool, or a new subchannel pool. - * @param global - */ -export declare function getSubchannelPool(global: boolean): SubchannelPool; diff --git a/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js b/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js deleted file mode 100644 index eff135c9..00000000 --- a/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js +++ /dev/null @@ -1,140 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getSubchannelPool = exports.SubchannelPool = void 0; -const channel_options_1 = require("./channel-options"); -const subchannel_1 = require("./subchannel"); -const uri_parser_1 = require("./uri-parser"); -// 10 seconds in milliseconds. This value is arbitrary. -/** - * The amount of time in between checks for dropping subchannels that have no - * other references - */ -const REF_CHECK_INTERVAL = 10000; -class SubchannelPool { - /** - * A pool of subchannels use for making connections. Subchannels with the - * exact same parameters will be reused. - * @param global If true, this is the global subchannel pool. Otherwise, it - * is the pool for a single channel. - */ - constructor(global) { - this.global = global; - this.pool = Object.create(null); - /** - * A timer of a task performing a periodic subchannel cleanup. - */ - this.cleanupTimer = null; - } - /** - * Unrefs all unused subchannels and cancels the cleanup task if all - * subchannels have been unrefed. - */ - unrefUnusedSubchannels() { - let allSubchannelsUnrefed = true; - /* These objects are created with Object.create(null), so they do not - * have a prototype, which means that for (... in ...) loops over them - * do not need to be filtered */ - // eslint-disable-disable-next-line:forin - for (const channelTarget in this.pool) { - const subchannelObjArray = this.pool[channelTarget]; - const refedSubchannels = subchannelObjArray.filter((value) => !value.subchannel.unrefIfOneRef()); - if (refedSubchannels.length > 0) { - allSubchannelsUnrefed = false; - } - /* For each subchannel in the pool, try to unref it if it has - * exactly one ref (which is the ref from the pool itself). If that - * does happen, remove the subchannel from the pool */ - this.pool[channelTarget] = refedSubchannels; - } - /* Currently we do not delete keys with empty values. If that results - * in significant memory usage we should change it. */ - // Cancel the cleanup task if all subchannels have been unrefed. - if (allSubchannelsUnrefed && this.cleanupTimer !== null) { - clearInterval(this.cleanupTimer); - this.cleanupTimer = null; - } - } - /** - * Ensures that the cleanup task is spawned. - */ - ensureCleanupTask() { - var _a, _b; - if (this.global && this.cleanupTimer === null) { - this.cleanupTimer = setInterval(() => { - this.unrefUnusedSubchannels(); - }, REF_CHECK_INTERVAL); - // Unref because this timer should not keep the event loop running. - // Call unref only if it exists to address electron/electron#21162 - (_b = (_a = this.cleanupTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); - } - } - /** - * Get a subchannel if one already exists with exactly matching parameters. - * Otherwise, create and save a subchannel with those parameters. - * @param channelTarget - * @param subchannelTarget - * @param channelArguments - * @param channelCredentials - */ - getOrCreateSubchannel(channelTargetUri, subchannelTarget, channelArguments, channelCredentials) { - this.ensureCleanupTask(); - const channelTarget = uri_parser_1.uriToString(channelTargetUri); - if (channelTarget in this.pool) { - const subchannelObjArray = this.pool[channelTarget]; - for (const subchannelObj of subchannelObjArray) { - if (subchannel_1.subchannelAddressEqual(subchannelTarget, subchannelObj.subchannelAddress) && - channel_options_1.channelOptionsEqual(channelArguments, subchannelObj.channelArguments) && - channelCredentials._equals(subchannelObj.channelCredentials)) { - return subchannelObj.subchannel; - } - } - } - // If we get here, no matching subchannel was found - const subchannel = new subchannel_1.Subchannel(channelTargetUri, subchannelTarget, channelArguments, channelCredentials); - if (!(channelTarget in this.pool)) { - this.pool[channelTarget] = []; - } - this.pool[channelTarget].push({ - subchannelAddress: subchannelTarget, - channelArguments, - channelCredentials, - subchannel, - }); - if (this.global) { - subchannel.ref(); - } - return subchannel; - } -} -exports.SubchannelPool = SubchannelPool; -const globalSubchannelPool = new SubchannelPool(true); -/** - * Get either the global subchannel pool, or a new subchannel pool. - * @param global - */ -function getSubchannelPool(global) { - if (global) { - return globalSubchannelPool; - } - else { - return new SubchannelPool(false); - } -} -exports.getSubchannelPool = getSubchannelPool; -//# sourceMappingURL=subchannel-pool.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js.map b/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js.map deleted file mode 100644 index 5f0156e4..00000000 --- a/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subchannel-pool.js","sourceRoot":"","sources":["../../src/subchannel-pool.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,uDAAwE;AACxE,6CAIsB;AAEtB,6CAAoD;AAEpD,uDAAuD;AACvD;;;GAGG;AACH,MAAM,kBAAkB,GAAG,KAAM,CAAC;AAElC,MAAa,cAAc;IAezB;;;;;OAKG;IACH,YAAoB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QApB3B,SAAI,GAOR,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAExB;;WAEG;QACK,iBAAY,GAAwB,IAAI,CAAC;IAQX,CAAC;IAEvC;;;OAGG;IACH,sBAAsB;QACpB,IAAI,qBAAqB,GAAG,IAAI,CAAC;QAEjC;;wCAEgC;QAChC,yCAAyC;QACzC,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,IAAI,EAAE;YACrC,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAEpD,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,MAAM,CAChD,CA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BAAgB,EAChB,aAAa,CAAC,gBAAgB,CAC/B;oBACD,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAC5D;oBACA,OAAO,aAAa,CAAC,UAAU,CAAC;iBACjC;aACF;SACF;QACD,mDAAmD;QACnD,MAAM,UAAU,GAAG,IAAI,uBAAU,CAC/B,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,CACnB,CAAC;QACF,IAAI,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE;YACjC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;SAC/B;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC;YAC5B,iBAAiB,EAAE,gBAAgB;YACnC,gBAAgB;YAChB,kBAAkB;YAClB,UAAU;SACX,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,UAAU,CAAC,GAAG,EAAE,CAAC;SAClB;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAlID,wCAkIC;AAED,MAAM,oBAAoB,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;AAEtD;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,MAAe;IAC/C,IAAI,MAAM,EAAE;QACV,OAAO,oBAAoB,CAAC;KAC7B;SAAM;QACL,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC;KAClC;AACH,CAAC;AAND,8CAMC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/subchannel.d.ts b/node_modules/@grpc/grpc-js/build/src/subchannel.d.ts deleted file mode 100644 index 55cb89e6..00000000 --- a/node_modules/@grpc/grpc-js/build/src/subchannel.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { ChannelCredentials } from './channel-credentials'; -import { Metadata } from './metadata'; -import { Http2CallStream } from './call-stream'; -import { ChannelOptions } from './channel-options'; -import { ConnectivityState } from './channel'; -import { GrpcUri } from './uri-parser'; -import { FilterFactory, Filter } from './filter'; -export declare type ConnectivityStateListener = (subchannel: Subchannel, previousState: ConnectivityState, newState: ConnectivityState) => void; -export interface TcpSubchannelAddress { - port: number; - host: string; -} -export interface IpcSubchannelAddress { - path: string; -} -/** - * This represents a single backend address to connect to. This interface is a - * subset of net.SocketConnectOpts, i.e. the options described at - * https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener. - * Those are in turn a subset of the options that can be passed to http2.connect. - */ -export declare type SubchannelAddress = TcpSubchannelAddress | IpcSubchannelAddress; -export declare function isTcpSubchannelAddress(address: SubchannelAddress): address is TcpSubchannelAddress; -export declare function subchannelAddressEqual(address1: SubchannelAddress, address2: SubchannelAddress): boolean; -export declare function subchannelAddressToString(address: SubchannelAddress): string; -export declare class Subchannel { - private channelTarget; - private subchannelAddress; - private options; - private credentials; - /** - * The subchannel's current connectivity state. Invariant: `session` === `null` - * if and only if `connectivityState` is IDLE or TRANSIENT_FAILURE. - */ - private connectivityState; - /** - * The underlying http2 session used to make requests. - */ - private session; - /** - * Indicates that the subchannel should transition from TRANSIENT_FAILURE to - * CONNECTING instead of IDLE when the backoff timeout ends. - */ - private continueConnecting; - /** - * A list of listener functions that will be called whenever the connectivity - * state changes. Will be modified by `addConnectivityStateListener` and - * `removeConnectivityStateListener` - */ - private stateListeners; - /** - * A list of listener functions that will be called when the underlying - * socket disconnects. Used for ending active calls with an UNAVAILABLE - * status. - */ - private disconnectListeners; - private backoffTimeout; - /** - * The complete user agent string constructed using channel args. - */ - private userAgent; - /** - * The amount of time in between sending pings - */ - private keepaliveTimeMs; - /** - * The amount of time to wait for an acknowledgement after sending a ping - */ - private keepaliveTimeoutMs; - /** - * Timer reference for timeout that indicates when to send the next ping - */ - private keepaliveIntervalId; - /** - * Timer reference tracking when the most recent ping will be considered lost - */ - private keepaliveTimeoutId; - /** - * Indicates whether keepalive pings should be sent without any active calls - */ - private keepaliveWithoutCalls; - /** - * Tracks calls with references to this subchannel - */ - private callRefcount; - /** - * Tracks channels and subchannel pools with references to this subchannel - */ - private refcount; - /** - * A string representation of the subchannel address, for logging/tracing - */ - private subchannelAddressString; - /** - * A class representing a connection to a single backend. - * @param channelTarget The target string for the channel as a whole - * @param subchannelAddress The address for the backend that this subchannel - * will connect to - * @param options The channel options, plus any specific subchannel options - * for this subchannel - * @param credentials The channel credentials used to establish this - * connection - */ - constructor(channelTarget: GrpcUri, subchannelAddress: SubchannelAddress, options: ChannelOptions, credentials: ChannelCredentials); - private handleBackoffTimer; - /** - * Start a backoff timer with the current nextBackoff timeout - */ - private startBackoff; - private stopBackoff; - private sendPing; - private startKeepalivePings; - private stopKeepalivePings; - private createSession; - private startConnectingInternal; - /** - * Initiate a state transition from any element of oldStates to the new - * state. If the current connectivityState is not in oldStates, do nothing. - * @param oldStates The set of states to transition from - * @param newState The state to transition to - * @returns True if the state changed, false otherwise - */ - private transitionToState; - /** - * Check if the subchannel associated with zero calls and with zero channels. - * If so, shut it down. - */ - private checkBothRefcounts; - callRef(): void; - callUnref(): void; - ref(): void; - unref(): void; - unrefIfOneRef(): boolean; - /** - * Start a stream on the current session with the given `metadata` as headers - * and then attach it to the `callStream`. Must only be called if the - * subchannel's current connectivity state is READY. - * @param metadata - * @param callStream - */ - startCallStream(metadata: Metadata, callStream: Http2CallStream, extraFilterFactory?: FilterFactory): void; - /** - * If the subchannel is currently IDLE, start connecting and switch to the - * CONNECTING state. If the subchannel is current in TRANSIENT_FAILURE, - * the next time it would transition to IDLE, start connecting again instead. - * Otherwise, do nothing. - */ - startConnecting(): void; - /** - * Get the subchannel's current connectivity state. - */ - getConnectivityState(): ConnectivityState; - /** - * Add a listener function to be called whenever the subchannel's - * connectivity state changes. - * @param listener - */ - addConnectivityStateListener(listener: ConnectivityStateListener): void; - /** - * Remove a listener previously added with `addConnectivityStateListener` - * @param listener A reference to a function previously passed to - * `addConnectivityStateListener` - */ - removeConnectivityStateListener(listener: ConnectivityStateListener): void; - addDisconnectListener(listener: () => void): void; - removeDisconnectListener(listener: () => void): void; - /** - * Reset the backoff timeout, and immediately start connecting if in backoff. - */ - resetBackoff(): void; - getAddress(): string; -} diff --git a/node_modules/@grpc/grpc-js/build/src/subchannel.js b/node_modules/@grpc/grpc-js/build/src/subchannel.js deleted file mode 100644 index 5a51c48c..00000000 --- a/node_modules/@grpc/grpc-js/build/src/subchannel.js +++ /dev/null @@ -1,606 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Subchannel = exports.subchannelAddressToString = exports.subchannelAddressEqual = exports.isTcpSubchannelAddress = void 0; -const http2 = require("http2"); -const tls_1 = require("tls"); -const channel_1 = require("./channel"); -const backoff_timeout_1 = require("./backoff-timeout"); -const resolver_1 = require("./resolver"); -const logging = require("./logging"); -const constants_1 = require("./constants"); -const http_proxy_1 = require("./http_proxy"); -const net = require("net"); -const uri_parser_1 = require("./uri-parser"); -const clientVersion = require('../../package.json').version; -const TRACER_NAME = 'subchannel'; -function trace(text) { - logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); -} -function refTrace(text) { - logging.trace(constants_1.LogVerbosity.DEBUG, 'subchannel_refcount', text); -} -const MIN_CONNECT_TIMEOUT_MS = 20000; -const INITIAL_BACKOFF_MS = 1000; -const BACKOFF_MULTIPLIER = 1.6; -const MAX_BACKOFF_MS = 120000; -const BACKOFF_JITTER = 0.2; -/* setInterval and setTimeout only accept signed 32 bit integers. JS doesn't - * have a constant for the max signed 32 bit integer, so this is a simple way - * to calculate it */ -const KEEPALIVE_MAX_TIME_MS = ~(1 << 31); -const KEEPALIVE_TIMEOUT_MS = 20000; -const { HTTP2_HEADER_AUTHORITY, HTTP2_HEADER_CONTENT_TYPE, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_TE, HTTP2_HEADER_USER_AGENT, } = http2.constants; -/** - * Get a number uniformly at random in the range [min, max) - * @param min - * @param max - */ -function uniformRandom(min, max) { - return Math.random() * (max - min) + min; -} -const tooManyPingsData = Buffer.from('too_many_pings', 'ascii'); -function isTcpSubchannelAddress(address) { - return 'port' in address; -} -exports.isTcpSubchannelAddress = isTcpSubchannelAddress; -function subchannelAddressEqual(address1, address2) { - if (isTcpSubchannelAddress(address1)) { - return (isTcpSubchannelAddress(address2) && - address1.host === address2.host && - address1.port === address2.port); - } - else { - return !isTcpSubchannelAddress(address2) && address1.path === address2.path; - } -} -exports.subchannelAddressEqual = subchannelAddressEqual; -function subchannelAddressToString(address) { - if (isTcpSubchannelAddress(address)) { - return address.host + ':' + address.port; - } - else { - return address.path; - } -} -exports.subchannelAddressToString = subchannelAddressToString; -class Subchannel { - /** - * A class representing a connection to a single backend. - * @param channelTarget The target string for the channel as a whole - * @param subchannelAddress The address for the backend that this subchannel - * will connect to - * @param options The channel options, plus any specific subchannel options - * for this subchannel - * @param credentials The channel credentials used to establish this - * connection - */ - constructor(channelTarget, subchannelAddress, options, credentials) { - this.channelTarget = channelTarget; - this.subchannelAddress = subchannelAddress; - this.options = options; - this.credentials = credentials; - /** - * The subchannel's current connectivity state. Invariant: `session` === `null` - * if and only if `connectivityState` is IDLE or TRANSIENT_FAILURE. - */ - this.connectivityState = channel_1.ConnectivityState.IDLE; - /** - * The underlying http2 session used to make requests. - */ - this.session = null; - /** - * Indicates that the subchannel should transition from TRANSIENT_FAILURE to - * CONNECTING instead of IDLE when the backoff timeout ends. - */ - this.continueConnecting = false; - /** - * A list of listener functions that will be called whenever the connectivity - * state changes. Will be modified by `addConnectivityStateListener` and - * `removeConnectivityStateListener` - */ - this.stateListeners = []; - /** - * A list of listener functions that will be called when the underlying - * socket disconnects. Used for ending active calls with an UNAVAILABLE - * status. - */ - this.disconnectListeners = []; - /** - * The amount of time in between sending pings - */ - this.keepaliveTimeMs = KEEPALIVE_MAX_TIME_MS; - /** - * The amount of time to wait for an acknowledgement after sending a ping - */ - this.keepaliveTimeoutMs = KEEPALIVE_TIMEOUT_MS; - /** - * Indicates whether keepalive pings should be sent without any active calls - */ - this.keepaliveWithoutCalls = false; - /** - * Tracks calls with references to this subchannel - */ - this.callRefcount = 0; - /** - * Tracks channels and subchannel pools with references to this subchannel - */ - this.refcount = 0; - // Build user-agent string. - this.userAgent = [ - options['grpc.primary_user_agent'], - `grpc-node-js/${clientVersion}`, - options['grpc.secondary_user_agent'], - ] - .filter((e) => e) - .join(' '); // remove falsey values first - if ('grpc.keepalive_time_ms' in options) { - this.keepaliveTimeMs = options['grpc.keepalive_time_ms']; - } - if ('grpc.keepalive_timeout_ms' in options) { - this.keepaliveTimeoutMs = options['grpc.keepalive_timeout_ms']; - } - if ('grpc.keepalive_permit_without_calls' in options) { - this.keepaliveWithoutCalls = options['grpc.keepalive_permit_without_calls'] === 1; - } - else { - this.keepaliveWithoutCalls = false; - } - this.keepaliveIntervalId = setTimeout(() => { }, 0); - clearTimeout(this.keepaliveIntervalId); - this.keepaliveTimeoutId = setTimeout(() => { }, 0); - clearTimeout(this.keepaliveTimeoutId); - const backoffOptions = { - initialDelay: options['grpc.initial_reconnect_backoff_ms'], - maxDelay: options['grpc.max_reconnect_backoff_ms'], - }; - this.backoffTimeout = new backoff_timeout_1.BackoffTimeout(() => { - this.handleBackoffTimer(); - }, backoffOptions); - this.subchannelAddressString = subchannelAddressToString(subchannelAddress); - } - handleBackoffTimer() { - if (this.continueConnecting) { - this.transitionToState([channel_1.ConnectivityState.TRANSIENT_FAILURE], channel_1.ConnectivityState.CONNECTING); - } - else { - this.transitionToState([channel_1.ConnectivityState.TRANSIENT_FAILURE], channel_1.ConnectivityState.IDLE); - } - } - /** - * Start a backoff timer with the current nextBackoff timeout - */ - startBackoff() { - this.backoffTimeout.runOnce(); - } - stopBackoff() { - this.backoffTimeout.stop(); - this.backoffTimeout.reset(); - } - sendPing() { - logging.trace(constants_1.LogVerbosity.DEBUG, 'keepalive', 'Sending ping to ' + this.subchannelAddressString); - this.keepaliveTimeoutId = setTimeout(() => { - this.transitionToState([channel_1.ConnectivityState.READY], channel_1.ConnectivityState.IDLE); - }, this.keepaliveTimeoutMs); - this.session.ping((err, duration, payload) => { - clearTimeout(this.keepaliveTimeoutId); - }); - } - startKeepalivePings() { - this.keepaliveIntervalId = setInterval(() => { - this.sendPing(); - }, this.keepaliveTimeMs); - /* Don't send a ping immediately because whatever caused us to start - * sending pings should also involve some network activity. */ - } - stopKeepalivePings() { - clearInterval(this.keepaliveIntervalId); - clearTimeout(this.keepaliveTimeoutId); - } - createSession(proxyConnectionResult) { - var _a, _b, _c; - const targetAuthority = resolver_1.getDefaultAuthority((_a = proxyConnectionResult.realTarget) !== null && _a !== void 0 ? _a : this.channelTarget); - let connectionOptions = this.credentials._getConnectionOptions() || {}; - connectionOptions.maxSendHeaderBlockLength = Number.MAX_SAFE_INTEGER; - let addressScheme = 'http://'; - if ('secureContext' in connectionOptions) { - addressScheme = 'https://'; - // If provided, the value of grpc.ssl_target_name_override should be used - // to override the target hostname when checking server identity. - // This option is used for testing only. - if (this.options['grpc.ssl_target_name_override']) { - const sslTargetNameOverride = this.options['grpc.ssl_target_name_override']; - connectionOptions.checkServerIdentity = (host, cert) => { - return tls_1.checkServerIdentity(sslTargetNameOverride, cert); - }; - connectionOptions.servername = sslTargetNameOverride; - } - else { - const authorityHostname = (_c = (_b = uri_parser_1.splitHostPort(targetAuthority)) === null || _b === void 0 ? void 0 : _b.host) !== null && _c !== void 0 ? _c : 'localhost'; - // We want to always set servername to support SNI - connectionOptions.servername = authorityHostname; - } - if (proxyConnectionResult.socket) { - /* This is part of the workaround for - * https://github.com/nodejs/node/issues/32922. Without that bug, - * proxyConnectionResult.socket would always be a plaintext socket and - * this would say - * connectionOptions.socket = proxyConnectionResult.socket; */ - connectionOptions.createConnection = (authority, option) => { - return proxyConnectionResult.socket; - }; - } - } - else { - /* In all but the most recent versions of Node, http2.connect does not use - * the options when establishing plaintext connections, so we need to - * establish that connection explicitly. */ - connectionOptions.createConnection = (authority, option) => { - if (proxyConnectionResult.socket) { - return proxyConnectionResult.socket; - } - else { - /* net.NetConnectOpts is declared in a way that is more restrictive - * than what net.connect will actually accept, so we use the type - * assertion to work around that. */ - return net.connect(this.subchannelAddress); - } - }; - } - connectionOptions = Object.assign(Object.assign({}, connectionOptions), this.subchannelAddress); - /* http2.connect uses the options here: - * https://github.com/nodejs/node/blob/70c32a6d190e2b5d7b9ff9d5b6a459d14e8b7d59/lib/internal/http2/core.js#L3028-L3036 - * The spread operator overides earlier values with later ones, so any port - * or host values in the options will be used rather than any values extracted - * from the first argument. In addition, the path overrides the host and port, - * as documented for plaintext connections here: - * https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener - * and for TLS connections here: - * https://nodejs.org/api/tls.html#tls_tls_connect_options_callback. In - * earlier versions of Node, http2.connect passes these options to - * tls.connect but not net.connect, so in the insecure case we still need - * to set the createConnection option above to create the connection - * explicitly. We cannot do that in the TLS case because http2.connect - * passes necessary additional options to tls.connect. - * The first argument just needs to be parseable as a URL and the scheme - * determines whether the connection will be established over TLS or not. - */ - const session = http2.connect(addressScheme + targetAuthority, connectionOptions); - this.session = session; - session.unref(); - /* For all of these events, check if the session at the time of the event - * is the same one currently attached to this subchannel, to ensure that - * old events from previous connection attempts cannot cause invalid state - * transitions. */ - session.once('connect', () => { - if (this.session === session) { - this.transitionToState([channel_1.ConnectivityState.CONNECTING], channel_1.ConnectivityState.READY); - } - }); - session.once('close', () => { - if (this.session === session) { - this.transitionToState([channel_1.ConnectivityState.CONNECTING], channel_1.ConnectivityState.TRANSIENT_FAILURE); - /* Transitioning directly to IDLE here should be OK because we are not - * doing any backoff, because a connection was established at some - * point */ - this.transitionToState([channel_1.ConnectivityState.READY], channel_1.ConnectivityState.IDLE); - } - }); - session.once('goaway', (errorCode, lastStreamID, opaqueData) => { - if (this.session === session) { - /* See the last paragraph of - * https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md#basic-keepalive */ - if (errorCode === http2.constants.NGHTTP2_ENHANCE_YOUR_CALM && - opaqueData.equals(tooManyPingsData)) { - this.keepaliveTimeMs = Math.min(2 * this.keepaliveTimeMs, KEEPALIVE_MAX_TIME_MS); - logging.log(constants_1.LogVerbosity.ERROR, `Connection to ${uri_parser_1.uriToString(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTimeMs} ms`); - } - trace(this.subchannelAddressString + - ' connection closed by GOAWAY with code ' + - errorCode); - this.transitionToState([channel_1.ConnectivityState.CONNECTING, channel_1.ConnectivityState.READY], channel_1.ConnectivityState.IDLE); - } - }); - session.once('error', (error) => { - /* Do nothing here. Any error should also trigger a close event, which is - * where we want to handle that. */ - trace(this.subchannelAddressString + - ' connection closed with error ' + - error.message); - }); - } - startConnectingInternal() { - var _a, _b; - /* Pass connection options through to the proxy so that it's able to - * upgrade it's connection to support tls if needed. - * This is a workaround for https://github.com/nodejs/node/issues/32922 - * See https://github.com/grpc/grpc-node/pull/1369 for more info. */ - const connectionOptions = this.credentials._getConnectionOptions() || {}; - if ('secureContext' in connectionOptions) { - connectionOptions.ALPNProtocols = ['h2']; - // If provided, the value of grpc.ssl_target_name_override should be used - // to override the target hostname when checking server identity. - // This option is used for testing only. - if (this.options['grpc.ssl_target_name_override']) { - const sslTargetNameOverride = this.options['grpc.ssl_target_name_override']; - connectionOptions.checkServerIdentity = (host, cert) => { - return tls_1.checkServerIdentity(sslTargetNameOverride, cert); - }; - connectionOptions.servername = sslTargetNameOverride; - } - else { - if ('grpc.http_connect_target' in this.options) { - /* This is more or less how servername will be set in createSession - * if a connection is successfully established through the proxy. - * If the proxy is not used, these connectionOptions are discarded - * anyway */ - const targetPath = resolver_1.getDefaultAuthority((_a = uri_parser_1.parseUri(this.options['grpc.http_connect_target'])) !== null && _a !== void 0 ? _a : { - path: 'localhost', - }); - const hostPort = uri_parser_1.splitHostPort(targetPath); - connectionOptions.servername = (_b = hostPort === null || hostPort === void 0 ? void 0 : hostPort.host) !== null && _b !== void 0 ? _b : targetPath; - } - } - } - http_proxy_1.getProxiedConnection(this.subchannelAddress, this.options, connectionOptions).then((result) => { - this.createSession(result); - }, (reason) => { - this.transitionToState([channel_1.ConnectivityState.CONNECTING], channel_1.ConnectivityState.TRANSIENT_FAILURE); - }); - } - /** - * Initiate a state transition from any element of oldStates to the new - * state. If the current connectivityState is not in oldStates, do nothing. - * @param oldStates The set of states to transition from - * @param newState The state to transition to - * @returns True if the state changed, false otherwise - */ - transitionToState(oldStates, newState) { - if (oldStates.indexOf(this.connectivityState) === -1) { - return false; - } - trace(this.subchannelAddressString + - ' ' + - channel_1.ConnectivityState[this.connectivityState] + - ' -> ' + - channel_1.ConnectivityState[newState]); - const previousState = this.connectivityState; - this.connectivityState = newState; - switch (newState) { - case channel_1.ConnectivityState.READY: - this.stopBackoff(); - this.session.socket.once('close', () => { - for (const listener of this.disconnectListeners) { - listener(); - } - }); - if (this.keepaliveWithoutCalls) { - this.startKeepalivePings(); - } - break; - case channel_1.ConnectivityState.CONNECTING: - this.startBackoff(); - this.startConnectingInternal(); - this.continueConnecting = false; - break; - case channel_1.ConnectivityState.TRANSIENT_FAILURE: - if (this.session) { - this.session.close(); - } - this.session = null; - this.stopKeepalivePings(); - /* If the backoff timer has already ended by the time we get to the - * TRANSIENT_FAILURE state, we want to immediately transition out of - * TRANSIENT_FAILURE as though the backoff timer is ending right now */ - if (!this.backoffTimeout.isRunning()) { - process.nextTick(() => { - this.handleBackoffTimer(); - }); - } - break; - case channel_1.ConnectivityState.IDLE: - if (this.session) { - this.session.close(); - } - this.session = null; - this.stopKeepalivePings(); - break; - default: - throw new Error(`Invalid state: unknown ConnectivityState ${newState}`); - } - /* We use a shallow copy of the stateListeners array in case a listener - * is removed during this iteration */ - for (const listener of [...this.stateListeners]) { - listener(this, previousState, newState); - } - return true; - } - /** - * Check if the subchannel associated with zero calls and with zero channels. - * If so, shut it down. - */ - checkBothRefcounts() { - /* If no calls, channels, or subchannel pools have any more references to - * this subchannel, we can be sure it will never be used again. */ - if (this.callRefcount === 0 && this.refcount === 0) { - this.transitionToState([ - channel_1.ConnectivityState.CONNECTING, - channel_1.ConnectivityState.IDLE, - channel_1.ConnectivityState.READY, - ], channel_1.ConnectivityState.TRANSIENT_FAILURE); - } - } - callRef() { - refTrace(this.subchannelAddressString + - ' callRefcount ' + - this.callRefcount + - ' -> ' + - (this.callRefcount + 1)); - if (this.callRefcount === 0) { - if (this.session) { - this.session.ref(); - } - if (!this.keepaliveWithoutCalls) { - this.startKeepalivePings(); - } - } - this.callRefcount += 1; - } - callUnref() { - refTrace(this.subchannelAddressString + - ' callRefcount ' + - this.callRefcount + - ' -> ' + - (this.callRefcount - 1)); - this.callRefcount -= 1; - if (this.callRefcount === 0) { - if (this.session) { - this.session.unref(); - } - if (!this.keepaliveWithoutCalls) { - this.stopKeepalivePings(); - } - this.checkBothRefcounts(); - } - } - ref() { - refTrace(this.subchannelAddressString + - ' refcount ' + - this.refcount + - ' -> ' + - (this.refcount + 1)); - this.refcount += 1; - } - unref() { - refTrace(this.subchannelAddressString + - ' refcount ' + - this.refcount + - ' -> ' + - (this.refcount - 1)); - this.refcount -= 1; - this.checkBothRefcounts(); - } - unrefIfOneRef() { - if (this.refcount === 1) { - this.unref(); - return true; - } - return false; - } - /** - * Start a stream on the current session with the given `metadata` as headers - * and then attach it to the `callStream`. Must only be called if the - * subchannel's current connectivity state is READY. - * @param metadata - * @param callStream - */ - startCallStream(metadata, callStream, extraFilterFactory) { - const headers = metadata.toHttp2Headers(); - headers[HTTP2_HEADER_AUTHORITY] = callStream.getHost(); - headers[HTTP2_HEADER_USER_AGENT] = this.userAgent; - headers[HTTP2_HEADER_CONTENT_TYPE] = 'application/grpc'; - headers[HTTP2_HEADER_METHOD] = 'POST'; - headers[HTTP2_HEADER_PATH] = callStream.getMethod(); - headers[HTTP2_HEADER_TE] = 'trailers'; - let http2Stream; - /* In theory, if an error is thrown by session.request because session has - * become unusable (e.g. because it has received a goaway), this subchannel - * should soon see the corresponding close or goaway event anyway and leave - * READY. But we have seen reports that this does not happen - * (https://github.com/googleapis/nodejs-firestore/issues/1023#issuecomment-653204096) - * so for defense in depth, we just discard the session when we see an - * error here. - */ - try { - http2Stream = this.session.request(headers); - } - catch (e) { - this.transitionToState([channel_1.ConnectivityState.READY], channel_1.ConnectivityState.TRANSIENT_FAILURE); - throw e; - } - let headersString = ''; - for (const header of Object.keys(headers)) { - headersString += '\t\t' + header + ': ' + headers[header] + '\n'; - } - logging.trace(constants_1.LogVerbosity.DEBUG, 'call_stream', 'Starting stream on subchannel ' + this.subchannelAddressString + ' with headers\n' + headersString); - callStream.attachHttp2Stream(http2Stream, this, extraFilterFactory); - } - /** - * If the subchannel is currently IDLE, start connecting and switch to the - * CONNECTING state. If the subchannel is current in TRANSIENT_FAILURE, - * the next time it would transition to IDLE, start connecting again instead. - * Otherwise, do nothing. - */ - startConnecting() { - /* First, try to transition from IDLE to connecting. If that doesn't happen - * because the state is not currently IDLE, check if it is - * TRANSIENT_FAILURE, and if so indicate that it should go back to - * connecting after the backoff timer ends. Otherwise do nothing */ - if (!this.transitionToState([channel_1.ConnectivityState.IDLE], channel_1.ConnectivityState.CONNECTING)) { - if (this.connectivityState === channel_1.ConnectivityState.TRANSIENT_FAILURE) { - this.continueConnecting = true; - } - } - } - /** - * Get the subchannel's current connectivity state. - */ - getConnectivityState() { - return this.connectivityState; - } - /** - * Add a listener function to be called whenever the subchannel's - * connectivity state changes. - * @param listener - */ - addConnectivityStateListener(listener) { - this.stateListeners.push(listener); - } - /** - * Remove a listener previously added with `addConnectivityStateListener` - * @param listener A reference to a function previously passed to - * `addConnectivityStateListener` - */ - removeConnectivityStateListener(listener) { - const listenerIndex = this.stateListeners.indexOf(listener); - if (listenerIndex > -1) { - this.stateListeners.splice(listenerIndex, 1); - } - } - addDisconnectListener(listener) { - this.disconnectListeners.push(listener); - } - removeDisconnectListener(listener) { - const listenerIndex = this.disconnectListeners.indexOf(listener); - if (listenerIndex > -1) { - this.disconnectListeners.splice(listenerIndex, 1); - } - } - /** - * Reset the backoff timeout, and immediately start connecting if in backoff. - */ - resetBackoff() { - this.backoffTimeout.reset(); - this.transitionToState([channel_1.ConnectivityState.TRANSIENT_FAILURE], channel_1.ConnectivityState.CONNECTING); - } - getAddress() { - return this.subchannelAddressString; - } -} -exports.Subchannel = Subchannel; -//# sourceMappingURL=subchannel.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/subchannel.js.map b/node_modules/@grpc/grpc-js/build/src/subchannel.js.map deleted file mode 100644 index 79b61038..00000000 --- a/node_modules/@grpc/grpc-js/build/src/subchannel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subchannel.js","sourceRoot":"","sources":["../../src/subchannel.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+BAA+B;AAK/B,6BAA2D;AAC3D,uCAA8C;AAC9C,uDAAmE;AACnE,yCAAiD;AACjD,qCAAqC;AACrC,2CAA2C;AAC3C,6CAA2E;AAC3E,2BAA2B;AAC3B,6CAA6E;AAI7E,MAAM,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAE5D,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,qBAAqB,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,MA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AAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,+BAA+B,CAAC,QAAmC;QACjE,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5D,IAAI,aAAa,GAAG,CAAC,CAAC,EAAE;YACtB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;SAC9C;IACH,CAAC;IAED,qBAAqB,CAAC,QAAoB;QACxC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,wBAAwB,CAAC,QAAoB;QAC3C,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,aAAa,GAAG,CAAC,CAAC,EAAE;YACtB,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;SACnD;IACH,CAAC;IAED;;OAEG;IACH,YAAY;QACV,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CACpB,CAAC,2BAAiB,CAAC,iBAAiB,CAAC,EACrC,2BAAiB,CAAC,UAAU,CAC7B,CAAC;IACJ,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;CACF;AA1pBD,gCA0pBC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/tls-helpers.d.ts b/node_modules/@grpc/grpc-js/build/src/tls-helpers.d.ts deleted file mode 100644 index 54f2dba5..00000000 --- a/node_modules/@grpc/grpc-js/build/src/tls-helpers.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -export declare const CIPHER_SUITES: string | undefined; -export declare function getDefaultRootsData(): Buffer | null; diff --git a/node_modules/@grpc/grpc-js/build/src/tls-helpers.js b/node_modules/@grpc/grpc-js/build/src/tls-helpers.js deleted file mode 100644 index d1183441..00000000 --- a/node_modules/@grpc/grpc-js/build/src/tls-helpers.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getDefaultRootsData = exports.CIPHER_SUITES = void 0; -const fs = require("fs"); -exports.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES; -const DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH; -let defaultRootsData = null; -function getDefaultRootsData() { - if (DEFAULT_ROOTS_FILE_PATH) { - if (defaultRootsData === null) { - defaultRootsData = fs.readFileSync(DEFAULT_ROOTS_FILE_PATH); - } - return defaultRootsData; - } - return null; -} -exports.getDefaultRootsData = getDefaultRootsData; -//# sourceMappingURL=tls-helpers.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/tls-helpers.js.map b/node_modules/@grpc/grpc-js/build/src/tls-helpers.js.map deleted file mode 100644 index 7557efc1..00000000 --- a/node_modules/@grpc/grpc-js/build/src/tls-helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tls-helpers.js","sourceRoot":"","sources":["../../src/tls-helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yBAAyB;AAEZ,QAAA,aAAa,GACxB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAErC,MAAM,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC;AAE7E,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAE3C,SAAgB,mBAAmB;IACjC,IAAI,uBAAuB,EAAE;QAC3B,IAAI,gBAAgB,KAAK,IAAI,EAAE;YAC7B,gBAAgB,GAAG,EAAE,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;SAC7D;QACD,OAAO,gBAAgB,CAAC;KACzB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AARD,kDAQC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/uri-parser.d.ts b/node_modules/@grpc/grpc-js/build/src/uri-parser.d.ts deleted file mode 100644 index c4d71aa0..00000000 --- a/node_modules/@grpc/grpc-js/build/src/uri-parser.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export interface GrpcUri { - scheme?: string; - authority?: string; - path: string; -} -export declare function parseUri(uriString: string): GrpcUri | null; -export interface HostPort { - host: string; - port?: number; -} -export declare function splitHostPort(path: string): HostPort | null; -export declare function uriToString(uri: GrpcUri): string; diff --git a/node_modules/@grpc/grpc-js/build/src/uri-parser.js b/node_modules/@grpc/grpc-js/build/src/uri-parser.js deleted file mode 100644 index 0a85d6db..00000000 --- a/node_modules/@grpc/grpc-js/build/src/uri-parser.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -/* - * Copyright 2020 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.uriToString = exports.splitHostPort = exports.parseUri = void 0; -/* - * The groups correspond to URI parts as follows: - * 1. scheme - * 2. authority - * 3. path - */ -const URI_REGEX = /^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/; -function parseUri(uriString) { - const parsedUri = URI_REGEX.exec(uriString); - if (parsedUri === null) { - return null; - } - return { - scheme: parsedUri[1], - authority: parsedUri[2], - path: parsedUri[3], - }; -} -exports.parseUri = parseUri; -const NUMBER_REGEX = /^\d+$/; -function splitHostPort(path) { - if (path.startsWith('[')) { - const hostEnd = path.indexOf(']'); - if (hostEnd === -1) { - return null; - } - const host = path.substring(1, hostEnd); - /* Only an IPv6 address should be in bracketed notation, and an IPv6 - * address should have at least one colon */ - if (host.indexOf(':') === -1) { - return null; - } - if (path.length > hostEnd + 1) { - if (path[hostEnd + 1] === ':') { - const portString = path.substring(hostEnd + 2); - if (NUMBER_REGEX.test(portString)) { - return { - host: host, - port: +portString, - }; - } - else { - return null; - } - } - else { - return null; - } - } - else { - return { - host, - }; - } - } - else { - const splitPath = path.split(':'); - /* Exactly one colon means that this is host:port. Zero colons means that - * there is no port. And multiple colons means that this is a bare IPv6 - * address with no port */ - if (splitPath.length === 2) { - if (NUMBER_REGEX.test(splitPath[1])) { - return { - host: splitPath[0], - port: +splitPath[1], - }; - } - else { - return null; - } - } - else { - return { - host: path, - }; - } - } -} -exports.splitHostPort = splitHostPort; -function uriToString(uri) { - let result = ''; - if (uri.scheme !== undefined) { - result += uri.scheme + ':'; - } - if (uri.authority !== undefined) { - result += '//' + uri.authority + '/'; - } - result += uri.path; - return result; -} -exports.uriToString = uriToString; -//# sourceMappingURL=uri-parser.js.map \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/build/src/uri-parser.js.map b/node_modules/@grpc/grpc-js/build/src/uri-parser.js.map deleted file mode 100644 index 82b872cc..00000000 --- a/node_modules/@grpc/grpc-js/build/src/uri-parser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uri-parser.js","sourceRoot":"","sources":["../../src/uri-parser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAQH;;;;;GAKG;AACH,MAAM,SAAS,GAAG,iDAAiD,CAAC;AAEpE,SAAgB,QAAQ,CA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;aACL,CAAC;SACH;KACF;SAAM;QACL,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC;;kCAE0B;QAC1B,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1B,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;gBACnC,OAAO;oBACL,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;oBAClB,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;iBACpB,CAAC;aACH;iBAAM;gBACL,OAAO,IAAI,CAAC;aACb;SACF;aAAM;YACL,OAAO;gBACL,IAAI,EAAE,IAAI;aACX,CAAC;SACH;KACF;AACH,CAAC;AAnDD,sCAmDC;AAED,SAAgB,WAAW,CAAC,GAAY;IACtC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;QAC5B,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;KAC5B;IACD,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS,EAAE;QAC/B,MAAM,IAAI,IAAI,GAAG,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC;KACtC;IACD,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC;IACnB,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,kCAUC"} \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/node_modules/.bin/semver b/node_modules/@grpc/grpc-js/node_modules/.bin/semver deleted file mode 120000 index 5aaadf42..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/.bin/semver +++ /dev/null @@ -1 +0,0 @@ -../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/LICENSE b/node_modules/@grpc/grpc-js/node_modules/@types/node/LICENSE deleted file mode 100644 index 9e841e7a..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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 diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/README.md b/node_modules/@grpc/grpc-js/node_modules/@types/node/README.md deleted file mode 100644 index 0a71d593..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/node` - -# Summary -This package contains type definitions for Node.js (http://nodejs.org/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v12. - -### Additional Details - * Last updated: Wed, 25 Nov 2020 06:26:18 GMT - * Dependencies: none - * Global values: `Buffer`, `NodeJS`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout` - -# Credits -These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Zane Hannan AU](https://github.com/ZaneHannanAU), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), and [Jason Kwok](https://github.com/JasonHK). diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/assert.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/assert.d.ts deleted file mode 100644 index 1a8441e6..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/assert.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -declare module 'assert' { - function assert(value: any, message?: string | Error): asserts value; - namespace assert { - class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - code: 'ERR_ASSERTION'; - - constructor(options?: { - message?: string; - actual?: any; - expected?: any; - operator?: string; - stackStartFn?: Function; - }); - } - - class CallTracker { - calls(exact?: number): () => void; - calls any>(fn?: Func, exact?: number): Func; - report(): CallTrackerReportInformation[]; - verify(): void; - } - interface CallTrackerReportInformation { - message: string; - /** The actual number of times the function was called. */ - actual: number; - /** The number of times the function was expected to be called. */ - expected: number; - /** The name of the function that is wrapped. */ - operator: string; - /** A stack trace of the function. */ - stack: object; - } - - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: any, - expected: any, - message?: string | Error, - operator?: string, - stackStartFn?: Function, - ): never; - function ok(value: any, message?: string | Error): asserts value; - /** @deprecated since v9.9.0 - use strictEqual() instead. */ - function equal(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notStrictEqual() instead. */ - function notEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */ - function deepEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */ - function notDeepEqual(actual: any, expected: any, message?: string | Error): void; - function strictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - function notStrictEqual(actual: any, expected: any, message?: string | Error): void; - function deepStrictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; - - function throws(block: () => any, message?: string | Error): void; - function throws(block: () => any, error: RegExp | Function | Object | Error, message?: string | Error): void; - function doesNotThrow(block: () => any, message?: string | Error): void; - function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void; - - function ifError(value: any): asserts value is null | undefined; - - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: RegExp | Function | Object | Error, - message?: string | Error, - ): Promise; - function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: RegExp | Function, - message?: string | Error, - ): Promise; - - const strict: Omit< - typeof assert, - | 'equal' - | 'notEqual' - | 'deepEqual' - | 'notDeepEqual' - | 'ok' - | 'strictEqual' - | 'deepStrictEqual' - | 'ifError' - | 'strict' - > & { - (value: any, message?: string | Error): asserts value; - equal: typeof strictEqual; - notEqual: typeof notStrictEqual; - deepEqual: typeof deepStrictEqual; - notDeepEqual: typeof notDeepStrictEqual; - - // Mapped types and assertion functions are incompatible? - // TS2775: Assertions require every name in the call target - // to be declared with an explicit type annotation. - ok: typeof ok; - strictEqual: typeof strictEqual; - deepStrictEqual: typeof deepStrictEqual; - ifError: typeof ifError; - strict: typeof strict; - }; - } - - export = assert; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/async_hooks.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/async_hooks.d.ts deleted file mode 100644 index 4fe95da2..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/async_hooks.d.ts +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Async Hooks module: https://nodejs.org/api/async_hooks.html - */ -declare module "async_hooks" { - /** - * Returns the asyncId of the current execution context. - */ - function executionAsyncId(): number; - - /** - * The resource representing the current execution. - * Useful to store data within the resource. - * - * Resource objects returned by `executionAsyncResource()` are most often internal - * Node.js handle objects with undocumented APIs. Using any functions or properties - * on the object is likely to crash your application and should be avoided. - * - * Using `executionAsyncResource()` in the top-level execution context will - * return an empty object as there is no handle or request object to use, - * but having an object representing the top-level can be helpful. - */ - function executionAsyncResource(): object; - - /** - * Returns the ID of the resource responsible for calling the callback that is currently being executed. - */ - function triggerAsyncId(): number; - - interface HookCallbacks { - /** - * Called when a class is constructed that has the possibility to emit an asynchronous event. - * @param asyncId a unique ID for the async resource - * @param type the type of the async resource - * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created - * @param resource reference to the resource representing the async operation, needs to be released during destroy - */ - init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; - - /** - * When an asynchronous operation is initiated or completes a callback is called to notify the user. - * The before callback is called just before said callback is executed. - * @param asyncId the unique identifier assigned to the resource about to execute the callback. - */ - before?(asyncId: number): void; - - /** - * Called immediately after the callback specified in before is completed. - * @param asyncId the unique identifier assigned to the resource which has executed the callback. - */ - after?(asyncId: number): void; - - /** - * Called when a promise has resolve() called. This may not be in the same execution id - * as the promise itself. - * @param asyncId the unique id for the promise that was resolve()d. - */ - promiseResolve?(asyncId: number): void; - - /** - * Called after the resource corresponding to asyncId is destroyed - * @param asyncId a unique ID for the async resource - */ - destroy?(asyncId: number): void; - } - - interface AsyncHook { - /** - * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. - */ - enable(): this; - - /** - * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. - */ - disable(): this; - } - - /** - * Registers functions to be called for different lifetime events of each async operation. - * @param options the callbacks to register - * @return an AsyncHooks instance used for disabling and enabling hooks - */ - function createHook(options: HookCallbacks): AsyncHook; - - interface AsyncResourceOptions { - /** - * The ID of the execution context that created this async event. - * Default: `executionAsyncId()` - */ - triggerAsyncId?: number; - - /** - * Disables automatic `emitDestroy` when the object is garbage collected. - * This usually does not need to be set (even if `emitDestroy` is called - * manually), unless the resource's `asyncId` is retrieved and the - * sensitive API's `emitDestroy` is called with it. - * Default: `false` - */ - requireManualDestroy?: boolean; - } - - /** - * The class AsyncResource was designed to be extended by the embedder's async resources. - * Using this users can easily trigger the lifetime events of their own resources. - */ - class AsyncResource { - /** - * AsyncResource() is meant to be extended. Instantiating a - * new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * async_hook.executionAsyncId() is used. - * @param type The type of async event. - * @param triggerAsyncId The ID of the execution context that created - * this async event (default: `executionAsyncId()`), or an - * AsyncResourceOptions object (since 9.3) - */ - constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); - - /** - * Binds the given function to the current execution context. - * @param fn The function to bind to the current execution context. - * @param type An optional name to associate with the underlying `AsyncResource`. - */ - static bind any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource }; - - /** - * Binds the given function to execute to this `AsyncResource`'s scope. - * @param fn The function to bind to the current `AsyncResource`. - */ - bind any>(fn: Func): Func & { asyncResource: AsyncResource }; - - /** - * Call the provided function with the provided arguments in the - * execution context of the async resource. This will establish the - * context, trigger the AsyncHooks before callbacks, call the function, - * trigger the AsyncHooks after callbacks, and then restore the original - * execution context. - * @param fn The function to call in the execution context of this - * async resource. - * @param thisArg The receiver to be used for the function call. - * @param args Optional arguments to pass to the function. - */ - runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; - - /** - * Call AsyncHooks destroy callbacks. - */ - emitDestroy(): void; - - /** - * @return the unique ID assigned to this AsyncResource instance. - */ - asyncId(): number; - - /** - * @return the trigger ID for this AsyncResource instance. - */ - triggerAsyncId(): number; - } - - /** - * When having multiple instances of `AsyncLocalStorage`, they are independent - * from each other. It is safe to instantiate this class multiple times. - */ - class AsyncLocalStorage { - /** - * This method disables the instance of `AsyncLocalStorage`. All subsequent calls - * to `asyncLocalStorage.getStore()` will return `undefined` until - * `asyncLocalStorage.run()` or `asyncLocalStorage.runSyncAndReturn()` - * is called again. - * - * When calling `asyncLocalStorage.disable()`, all current contexts linked to the - * instance will be exited. - * - * Calling `asyncLocalStorage.disable()` is required before the - * `asyncLocalStorage` can be garbage collected. This does not apply to stores - * provided by the `asyncLocalStorage`, as those objects are garbage collected - * along with the corresponding async resources. - * - * This method is to be used when the `asyncLocalStorage` is not in use anymore - * in the current process. - */ - disable(): void; - - /** - * This method returns the current store. - * If this method is called outside of an asynchronous context initialized by - * calling `asyncLocalStorage.run` or `asyncLocalStorage.runAndReturn`, it will - * return `undefined`. - */ - getStore(): T | undefined; - - /** - * Calling `asyncLocalStorage.run(callback)` will create a new asynchronous - * context. - * Within the callback function and the asynchronous operations from the callback, - * `asyncLocalStorage.getStore()` will return an instance of `Map` known as - * "the store". This store will be persistent through the following - * asynchronous calls. - * - * The callback will be ran asynchronously. Optionally, arguments can be passed - * to the function. They will be passed to the callback function. - * - * If an error is thrown by the callback function, it will not be caught by - * a `try/catch` block as the callback is ran in a new asynchronous resource. - * Also, the stacktrace will be impacted by the asynchronous call. - */ - // TODO: Apply generic vararg once available - run(store: T, callback: (...args: any[]) => void, ...args: any[]): void; - - /** - * Calling `asyncLocalStorage.exit(callback)` will create a new asynchronous - * context. - * Within the callback function and the asynchronous operations from the callback, - * `asyncLocalStorage.getStore()` will return `undefined`. - * - * The callback will be ran asynchronously. Optionally, arguments can be passed - * to the function. They will be passed to the callback function. - * - * If an error is thrown by the callback function, it will not be caught by - * a `try/catch` block as the callback is ran in a new asynchronous resource. - * Also, the stacktrace will be impacted by the asynchronous call. - */ - exit(callback: (...args: any[]) => void, ...args: any[]): void; - - /** - * This methods runs a function synchronously outside of a context and return its - * return value. The store is not accessible within the callback function or - * the asynchronous operations created within the callback. - * - * Optionally, arguments can be passed to the function. They will be passed to - * the callback function. - * - * If the callback function throws an error, it will be thrown by - * `exitSyncAndReturn` too. The stacktrace will not be impacted by this call and - * the context will be re-entered. - */ - exitSyncAndReturn(callback: (...args: any[]) => R, ...args: any[]): R; - - /** - * Calling `asyncLocalStorage.enterWith(store)` will transition into the context - * for the remainder of the current synchronous execution and will persist - * through any following asynchronous calls. - */ - enterWith(store: T): void; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/base.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/base.d.ts deleted file mode 100644 index fa671790..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/base.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.7. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7 -// - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// - -// TypeScript 3.7-specific augmentations: -/// diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/buffer.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/buffer.d.ts deleted file mode 100644 index 7eb1061b..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/buffer.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module "buffer" { - export const INSPECT_MAX_BYTES: number; - export const kMaxLength: number; - export const kStringMaxLength: number; - export const constants: { - MAX_LENGTH: number; - MAX_STRING_LENGTH: number; - }; - const BuffType: typeof Buffer; - - export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary"; - - export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; - - export const SlowBuffer: { - /** @deprecated since v6.0.0, use Buffer.allocUnsafeSlow() */ - new(size: number): Buffer; - prototype: Buffer; - }; - - export { BuffType as Buffer }; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/child_process.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/child_process.d.ts deleted file mode 100644 index ead1b7ed..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/child_process.d.ts +++ /dev/null @@ -1,492 +0,0 @@ -declare module "child_process" { - import * as events from "events"; - import * as net from "net"; - import { Writable, Readable, Stream, Pipe } from "stream"; - - interface ChildProcess extends events.EventEmitter { - stdin: Writable | null; - stdout: Readable | null; - stderr: Readable | null; - readonly channel?: Pipe | null; - readonly stdio: [ - Writable | null, // stdin - Readable | null, // stdout - Readable | null, // stderr - Readable | Writable | null | undefined, // extra - Readable | Writable | null | undefined // extra - ]; - readonly killed: boolean; - readonly pid: number; - readonly connected: boolean; - readonly exitCode: number | null; - readonly signalCode: number | null; - readonly spawnargs: string[]; - readonly spawnfile: string; - kill(signal?: NodeJS.Signals | number): boolean; - send(message: any, callback?: (error: Error | null) => void): boolean; - send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error | null) => void): boolean; - send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error | null) => void): boolean; - disconnect(): void; - unref(): void; - ref(): void; - - /** - * events.EventEmitter - * 1. close - * 2. disconnect - * 3. error - * 4. exit - * 5. message - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", code: number, signal: NodeJS.Signals): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; - } - - // return this object when stdio option is undefined or not specified - interface ChildProcessWithoutNullStreams extends ChildProcess { - stdin: Writable; - stdout: Readable; - stderr: Readable; - readonly stdio: [ - Writable, // stdin - Readable, // stdout - Readable, // stderr - Readable | Writable | null | undefined, // extra, no modification - Readable | Writable | null | undefined // extra, no modification - ]; - } - - // return this object when stdio option is a tuple of 3 - interface ChildProcessByStdio< - I extends null | Writable, - O extends null | Readable, - E extends null | Readable, - > extends ChildProcess { - stdin: I; - stdout: O; - stderr: E; - readonly stdio: [ - I, - O, - E, - Readable | Writable | null | undefined, // extra, no modification - Readable | Writable | null | undefined // extra, no modification - ]; - } - - interface MessageOptions { - keepOpen?: boolean; - } - - type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>; - - interface ProcessEnvOptions { - uid?: number; - gid?: number; - cwd?: string; - env?: NodeJS.ProcessEnv; - } - - interface CommonOptions extends ProcessEnvOptions { - /** - * @default true - */ - windowsHide?: boolean; - /** - * @default 0 - */ - timeout?: number; - } - - interface SpawnOptions extends CommonOptions { - argv0?: string; - stdio?: StdioOptions; - detached?: boolean; - shell?: boolean | string; - windowsVerbatimArguments?: boolean; - } - - interface SpawnOptionsWithoutStdio extends SpawnOptions { - stdio?: 'pipe' | Array; - } - - type StdioNull = 'inherit' | 'ignore' | Stream; - type StdioPipe = undefined | null | 'pipe'; - - interface SpawnOptionsWithStdioTuple< - Stdin extends StdioNull | StdioPipe, - Stdout extends StdioNull | StdioPipe, - Stderr extends StdioNull | StdioPipe, - > extends SpawnOptions { - stdio: [Stdin, Stdout, Stderr]; - } - - // overloads of spawn without 'args' - function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - - function spawn(command: string, options: SpawnOptions): ChildProcess; - - // overloads of spawn with 'args' - function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - - function spawn(command: string, args: ReadonlyArray, options: SpawnOptions): ChildProcess; - - interface ExecOptions extends CommonOptions { - shell?: string; - maxBuffer?: number; - killSignal?: NodeJS.Signals | number; - } - - interface ExecOptionsWithStringEncoding extends ExecOptions { - encoding: BufferEncoding; - } - - interface ExecOptionsWithBufferEncoding extends ExecOptions { - encoding: string | null; // specify `null`. - } - - interface ExecException extends Error { - cmd?: string; - killed?: boolean; - code?: number; - signal?: NodeJS.Signals; - } - - // no `options` definitely means stdout/stderr are `string`. - function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function exec(command: string, options: { encoding: string } & ExecOptions, callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; - - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function exec( - command: string, - options: ({ encoding?: string | null } & ExecOptions) | undefined | null, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - - interface PromiseWithChild extends Promise { - child: ChildProcess; - } - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace exec { - function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - } - - interface ExecFileOptions extends CommonOptions { - maxBuffer?: number; - killSignal?: NodeJS.Signals | number; - windowsVerbatimArguments?: boolean; - shell?: boolean | string; - } - interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { - encoding: 'buffer' | null; - } - interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { - encoding: string; - } - - function execFile(file: string): ChildProcess; - function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; - function execFile(file: string, args?: ReadonlyArray | null): ChildProcess; - function execFile(file: string, args: ReadonlyArray | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; - - // no `options` definitely means stdout/stderr are `string`. - function execFile(file: string, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithStringEncoding, - callback: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function execFile( - file: string, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function execFile(file: string, options: ExecFileOptions, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptions, - callback: (error: ExecException | null, stdout: string, stderr: string) => void - ): ChildProcess; - - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function execFile( - file: string, - options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, - callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, - ): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, - callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, - ): ChildProcess; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace execFile { - function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__( - file: string, - args: ReadonlyArray | undefined | null, - options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, - ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - } - - interface ForkOptions extends ProcessEnvOptions { - execPath?: string; - execArgv?: string[]; - silent?: boolean; - stdio?: StdioOptions; - detached?: boolean; - windowsVerbatimArguments?: boolean; - } - function fork(modulePath: string, options?: ForkOptions): ChildProcess; - function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; - - interface SpawnSyncOptions extends CommonOptions { - argv0?: string; // Not specified in the docs - input?: string | NodeJS.ArrayBufferView; - stdio?: StdioOptions; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: string; - shell?: boolean | string; - windowsVerbatimArguments?: boolean; - } - interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { - encoding: BufferEncoding; - } - interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { - encoding: string; // specify `null`. - } - interface SpawnSyncReturns { - pid: number; - output: string[]; - stdout: T; - stderr: T; - status: number | null; - signal: NodeJS.Signals | null; - error?: Error; - } - function spawnSync(command: string): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns; - - interface ExecSyncOptions extends CommonOptions { - input?: string | Uint8Array; - stdio?: StdioOptions; - shell?: string; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: string; - } - interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { - encoding: BufferEncoding; - } - interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { - encoding: string; // specify `null`. - } - function execSync(command: string): Buffer; - function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string; - function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer; - function execSync(command: string, options?: ExecSyncOptions): Buffer; - - interface ExecFileSyncOptions extends CommonOptions { - input?: string | NodeJS.ArrayBufferView; - stdio?: StdioOptions; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: string; - shell?: boolean | string; - } - interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { - encoding: BufferEncoding; - } - interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { - encoding: string; // specify `null`. - } - function execFileSync(command: string): Buffer; - function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): Buffer; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/cluster.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/cluster.d.ts deleted file mode 100644 index 43340ff8..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/cluster.d.ts +++ /dev/null @@ -1,260 +0,0 @@ -declare module "cluster" { - import * as child from "child_process"; - import * as events from "events"; - import * as net from "net"; - - // interfaces - interface ClusterSettings { - execArgv?: string[]; // default: process.execArgv - exec?: string; - args?: string[]; - silent?: boolean; - stdio?: any[]; - uid?: number; - gid?: number; - inspectPort?: number | (() => number); - } - - interface Address { - address: string; - port: number; - addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6" - } - - class Worker extends events.EventEmitter { - id: number; - process: child.ChildProcess; - send(message: any, sendHandle?: any, callback?: (error: Error | null) => void): boolean; - kill(signal?: string): void; - destroy(signal?: string): void; - disconnect(): void; - isConnected(): boolean; - isDead(): boolean; - exitedAfterDisconnect: boolean; - - /** - * events.EventEmitter - * 1. disconnect - * 2. error - * 3. exit - * 4. listening - * 5. message - * 6. online - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "exit", listener: (code: number, signal: string) => void): this; - addListener(event: "listening", listener: (address: Address) => void): this; - addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "exit", code: number, signal: string): boolean; - emit(event: "listening", address: Address): boolean; - emit(event: "message", message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "exit", listener: (code: number, signal: string) => void): this; - on(event: "listening", listener: (address: Address) => void): this; - on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "exit", listener: (code: number, signal: string) => void): this; - once(event: "listening", listener: (address: Address) => void): this; - once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependListener(event: "listening", listener: (address: Address) => void): this; - prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependOnceListener(event: "listening", listener: (address: Address) => void): this; - prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "online", listener: () => void): this; - } - - interface Cluster extends events.EventEmitter { - Worker: Worker; - disconnect(callback?: () => void): void; - fork(env?: any): Worker; - isMaster: boolean; - isWorker: boolean; - // TODO: cluster.schedulingPolicy - settings: ClusterSettings; - setupMaster(settings?: ClusterSettings): void; - worker?: Worker; - workers?: { - [index: string]: Worker | undefined - }; - - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: (worker: Worker) => void): this; - addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - addListener(event: "fork", listener: (worker: Worker) => void): this; - addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: (worker: Worker) => void): this; - addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect", worker: Worker): boolean; - emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - emit(event: "fork", worker: Worker): boolean; - emit(event: "listening", worker: Worker, address: Address): boolean; - emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online", worker: Worker): boolean; - emit(event: "setup", settings: ClusterSettings): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: (worker: Worker) => void): this; - on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - on(event: "fork", listener: (worker: Worker) => void): this; - on(event: "listening", listener: (worker: Worker, address: Address) => void): this; - on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: (worker: Worker) => void): this; - on(event: "setup", listener: (settings: ClusterSettings) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: (worker: Worker) => void): this; - once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - once(event: "fork", listener: (worker: Worker) => void): this; - once(event: "listening", listener: (worker: Worker, address: Address) => void): this; - once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: (worker: Worker) => void): this; - once(event: "setup", listener: (settings: ClusterSettings) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependListener(event: "fork", listener: (worker: Worker) => void): this; - prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: (worker: Worker) => void): this; - prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependOnceListener(event: "fork", listener: (worker: Worker) => void): this; - prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; - prependOnceListener(event: "online", listener: (worker: Worker) => void): this; - prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - } - - function disconnect(callback?: () => void): void; - function fork(env?: any): Worker; - const isMaster: boolean; - const isWorker: boolean; - // TODO: cluster.schedulingPolicy - const settings: ClusterSettings; - function setupMaster(settings?: ClusterSettings): void; - const worker: Worker; - const workers: { - [index: string]: Worker | undefined - }; - - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - function addListener(event: string, listener: (...args: any[]) => void): Cluster; - function addListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function addListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function addListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function addListener(event: "online", listener: (worker: Worker) => void): Cluster; - function addListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function emit(event: string | symbol, ...args: any[]): boolean; - function emit(event: "disconnect", worker: Worker): boolean; - function emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - function emit(event: "fork", worker: Worker): boolean; - function emit(event: "listening", worker: Worker, address: Address): boolean; - function emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - function emit(event: "online", worker: Worker): boolean; - function emit(event: "setup", settings: ClusterSettings): boolean; - - function on(event: string, listener: (...args: any[]) => void): Cluster; - function on(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function on(event: "fork", listener: (worker: Worker) => void): Cluster; - function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. - function on(event: "online", listener: (worker: Worker) => void): Cluster; - function on(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function once(event: string, listener: (...args: any[]) => void): Cluster; - function once(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function once(event: "fork", listener: (worker: Worker) => void): Cluster; - function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. - function once(event: "online", listener: (worker: Worker) => void): Cluster; - function once(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function removeListener(event: string, listener: (...args: any[]) => void): Cluster; - function removeAllListeners(event?: string): Cluster; - function setMaxListeners(n: number): Cluster; - function getMaxListeners(): number; - function listeners(event: string): Function[]; - function listenerCount(type: string): number; - - function prependListener(event: string, listener: (...args: any[]) => void): Cluster; - function prependListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function prependListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function prependListener(event: "online", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function prependOnceListener(event: string, listener: (...args: any[]) => void): Cluster; - function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function prependOnceListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function eventNames(): string[]; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/console.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/console.d.ts deleted file mode 100644 index d30d13f8..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/console.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "console" { - export = console; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/constants.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/constants.d.ts deleted file mode 100644 index ebd463b2..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/constants.d.ts +++ /dev/null @@ -1,448 +0,0 @@ -/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ -declare module "constants" { - /** @deprecated since v6.3.0 - use `os.constants.errno.E2BIG` instead. */ - const E2BIG: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EACCES` instead. */ - const EACCES: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EADDRINUSE` instead. */ - const EADDRINUSE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EADDRNOTAVAIL` instead. */ - const EADDRNOTAVAIL: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EAFNOSUPPORT` instead. */ - const EAFNOSUPPORT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EAGAIN` instead. */ - const EAGAIN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EALREADY` instead. */ - const EALREADY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EBADF` instead. */ - const EBADF: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EBADMSG` instead. */ - const EBADMSG: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EBUSY` instead. */ - const EBUSY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ECANCELED` instead. */ - const ECANCELED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ECHILD` instead. */ - const ECHILD: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNABORTED` instead. */ - const ECONNABORTED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNREFUSED` instead. */ - const ECONNREFUSED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNRESET` instead. */ - const ECONNRESET: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EDEADLK` instead. */ - const EDEADLK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EDESTADDRREQ` instead. */ - const EDESTADDRREQ: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EDOM` instead. */ - const EDOM: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EEXIST` instead. */ - const EEXIST: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EFAULT` instead. */ - const EFAULT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EFBIG` instead. */ - const EFBIG: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EHOSTUNREACH` instead. */ - const EHOSTUNREACH: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EIDRM` instead. */ - const EIDRM: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EILSEQ` instead. */ - const EILSEQ: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EINPROGRESS` instead. */ - const EINPROGRESS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EINTR` instead. */ - const EINTR: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EINVAL` instead. */ - const EINVAL: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EIO` instead. */ - const EIO: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EISCONN` instead. */ - const EISCONN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EISDIR` instead. */ - const EISDIR: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ELOOP` instead. */ - const ELOOP: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EMFILE` instead. */ - const EMFILE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EMLINK` instead. */ - const EMLINK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EMSGSIZE` instead. */ - const EMSGSIZE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENAMETOOLONG` instead. */ - const ENAMETOOLONG: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENETDOWN` instead. */ - const ENETDOWN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENETRESET` instead. */ - const ENETRESET: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENETUNREACH` instead. */ - const ENETUNREACH: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENFILE` instead. */ - const ENFILE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOBUFS` instead. */ - const ENOBUFS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENODATA` instead. */ - const ENODATA: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENODEV` instead. */ - const ENODEV: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOENT` instead. */ - const ENOENT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOEXEC` instead. */ - const ENOEXEC: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOLCK` instead. */ - const ENOLCK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOLINK` instead. */ - const ENOLINK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOMEM` instead. */ - const ENOMEM: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOMSG` instead. */ - const ENOMSG: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOPROTOOPT` instead. */ - const ENOPROTOOPT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSPC` instead. */ - const ENOSPC: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSR` instead. */ - const ENOSR: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSTR` instead. */ - const ENOSTR: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSYS` instead. */ - const ENOSYS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTCONN` instead. */ - const ENOTCONN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTDIR` instead. */ - const ENOTDIR: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTEMPTY` instead. */ - const ENOTEMPTY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTSOCK` instead. */ - const ENOTSOCK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTSUP` instead. */ - const ENOTSUP: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTTY` instead. */ - const ENOTTY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ENXIO` instead. */ - const ENXIO: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EOPNOTSUPP` instead. */ - const EOPNOTSUPP: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EOVERFLOW` instead. */ - const EOVERFLOW: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EPERM` instead. */ - const EPERM: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EPIPE` instead. */ - const EPIPE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTO` instead. */ - const EPROTO: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTONOSUPPORT` instead. */ - const EPROTONOSUPPORT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTOTYPE` instead. */ - const EPROTOTYPE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ERANGE` instead. */ - const ERANGE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EROFS` instead. */ - const EROFS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ESPIPE` instead. */ - const ESPIPE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ESRCH` instead. */ - const ESRCH: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ETIME` instead. */ - const ETIME: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ETIMEDOUT` instead. */ - const ETIMEDOUT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.ETXTBSY` instead. */ - const ETXTBSY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EWOULDBLOCK` instead. */ - const EWOULDBLOCK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.EXDEV` instead. */ - const EXDEV: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINTR` instead. */ - const WSAEINTR: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEBADF` instead. */ - const WSAEBADF: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEACCES` instead. */ - const WSAEACCES: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEFAULT` instead. */ - const WSAEFAULT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVAL` instead. */ - const WSAEINVAL: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEMFILE` instead. */ - const WSAEMFILE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEWOULDBLOCK` instead. */ - const WSAEWOULDBLOCK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINPROGRESS` instead. */ - const WSAEINPROGRESS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEALREADY` instead. */ - const WSAEALREADY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTSOCK` instead. */ - const WSAENOTSOCK: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDESTADDRREQ` instead. */ - const WSAEDESTADDRREQ: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEMSGSIZE` instead. */ - const WSAEMSGSIZE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROTOTYPE` instead. */ - const WSAEPROTOTYPE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOPROTOOPT` instead. */ - const WSAENOPROTOOPT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROTONOSUPPORT` instead. */ - const WSAEPROTONOSUPPORT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESOCKTNOSUPPORT` instead. */ - const WSAESOCKTNOSUPPORT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEOPNOTSUPP` instead. */ - const WSAEOPNOTSUPP: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPFNOSUPPORT` instead. */ - const WSAEPFNOSUPPORT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEAFNOSUPPORT` instead. */ - const WSAEAFNOSUPPORT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEADDRINUSE` instead. */ - const WSAEADDRINUSE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEADDRNOTAVAIL` instead. */ - const WSAEADDRNOTAVAIL: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETDOWN` instead. */ - const WSAENETDOWN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETUNREACH` instead. */ - const WSAENETUNREACH: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETRESET` instead. */ - const WSAENETRESET: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNABORTED` instead. */ - const WSAECONNABORTED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNRESET` instead. */ - const WSAECONNRESET: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOBUFS` instead. */ - const WSAENOBUFS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEISCONN` instead. */ - const WSAEISCONN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTCONN` instead. */ - const WSAENOTCONN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESHUTDOWN` instead. */ - const WSAESHUTDOWN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAETOOMANYREFS` instead. */ - const WSAETOOMANYREFS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAETIMEDOUT` instead. */ - const WSAETIMEDOUT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNREFUSED` instead. */ - const WSAECONNREFUSED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAELOOP` instead. */ - const WSAELOOP: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENAMETOOLONG` instead. */ - const WSAENAMETOOLONG: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEHOSTDOWN` instead. */ - const WSAEHOSTDOWN: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEHOSTUNREACH` instead. */ - const WSAEHOSTUNREACH: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTEMPTY` instead. */ - const WSAENOTEMPTY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROCLIM` instead. */ - const WSAEPROCLIM: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEUSERS` instead. */ - const WSAEUSERS: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDQUOT` instead. */ - const WSAEDQUOT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESTALE` instead. */ - const WSAESTALE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEREMOTE` instead. */ - const WSAEREMOTE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSASYSNOTREADY` instead. */ - const WSASYSNOTREADY: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAVERNOTSUPPORTED` instead. */ - const WSAVERNOTSUPPORTED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSANOTINITIALISED` instead. */ - const WSANOTINITIALISED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDISCON` instead. */ - const WSAEDISCON: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOMORE` instead. */ - const WSAENOMORE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECANCELLED` instead. */ - const WSAECANCELLED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVALIDPROCTABLE` instead. */ - const WSAEINVALIDPROCTABLE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVALIDPROVIDER` instead. */ - const WSAEINVALIDPROVIDER: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROVIDERFAILEDINIT` instead. */ - const WSAEPROVIDERFAILEDINIT: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSASYSCALLFAILURE` instead. */ - const WSASYSCALLFAILURE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSASERVICE_NOT_FOUND` instead. */ - const WSASERVICE_NOT_FOUND: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSATYPE_NOT_FOUND` instead. */ - const WSATYPE_NOT_FOUND: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSA_E_NO_MORE` instead. */ - const WSA_E_NO_MORE: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSA_E_CANCELLED` instead. */ - const WSA_E_CANCELLED: number; - /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEREFUSED` instead. */ - const WSAEREFUSED: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGHUP` instead. */ - const SIGHUP: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGINT` instead. */ - const SIGINT: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGILL` instead. */ - const SIGILL: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGABRT` instead. */ - const SIGABRT: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGFPE` instead. */ - const SIGFPE: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGKILL` instead. */ - const SIGKILL: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSEGV` instead. */ - const SIGSEGV: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTERM` instead. */ - const SIGTERM: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGBREAK` instead. */ - const SIGBREAK: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGWINCH` instead. */ - const SIGWINCH: number; - const SSL_OP_ALL: number; - const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - const SSL_OP_CIPHER_SERVER_PREFERENCE: number; - const SSL_OP_CISCO_ANYCONNECT: number; - const SSL_OP_COOKIE_EXCHANGE: number; - const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - const SSL_OP_EPHEMERAL_RSA: number; - const SSL_OP_LEGACY_SERVER_CONNECT: number; - const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; - const SSL_OP_MICROSOFT_SESS_ID_BUG: number; - const SSL_OP_MSIE_SSLV2_RSA_PADDING: number; - const SSL_OP_NETSCAPE_CA_DN_BUG: number; - const SSL_OP_NETSCAPE_CHALLENGE_BUG: number; - const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; - const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; - const SSL_OP_NO_COMPRESSION: number; - const SSL_OP_NO_QUERY_MTU: number; - const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - const SSL_OP_NO_SSLv2: number; - const SSL_OP_NO_SSLv3: number; - const SSL_OP_NO_TICKET: number; - const SSL_OP_NO_TLSv1: number; - const SSL_OP_NO_TLSv1_1: number; - const SSL_OP_NO_TLSv1_2: number; - const SSL_OP_PKCS1_CHECK_1: number; - const SSL_OP_PKCS1_CHECK_2: number; - const SSL_OP_SINGLE_DH_USE: number; - const SSL_OP_SINGLE_ECDH_USE: number; - const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; - const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; - const SSL_OP_TLS_BLOCK_PADDING_BUG: number; - const SSL_OP_TLS_D5_BUG: number; - const SSL_OP_TLS_ROLLBACK_BUG: number; - const ENGINE_METHOD_DSA: number; - const ENGINE_METHOD_DH: number; - const ENGINE_METHOD_RAND: number; - const ENGINE_METHOD_ECDH: number; - const ENGINE_METHOD_ECDSA: number; - const ENGINE_METHOD_CIPHERS: number; - const ENGINE_METHOD_DIGESTS: number; - const ENGINE_METHOD_STORE: number; - const ENGINE_METHOD_PKEY_METHS: number; - const ENGINE_METHOD_PKEY_ASN1_METHS: number; - const ENGINE_METHOD_ALL: number; - const ENGINE_METHOD_NONE: number; - const DH_CHECK_P_NOT_SAFE_PRIME: number; - const DH_CHECK_P_NOT_PRIME: number; - const DH_UNABLE_TO_CHECK_GENERATOR: number; - const DH_NOT_SUITABLE_GENERATOR: number; - const RSA_PKCS1_PADDING: number; - const RSA_SSLV23_PADDING: number; - const RSA_NO_PADDING: number; - const RSA_PKCS1_OAEP_PADDING: number; - const RSA_X931_PADDING: number; - const RSA_PKCS1_PSS_PADDING: number; - const POINT_CONVERSION_COMPRESSED: number; - const POINT_CONVERSION_UNCOMPRESSED: number; - const POINT_CONVERSION_HYBRID: number; - const O_RDONLY: number; - const O_WRONLY: number; - const O_RDWR: number; - const S_IFMT: number; - const S_IFREG: number; - const S_IFDIR: number; - const S_IFCHR: number; - const S_IFBLK: number; - const S_IFIFO: number; - const S_IFSOCK: number; - const S_IRWXU: number; - const S_IRUSR: number; - const S_IWUSR: number; - const S_IXUSR: number; - const S_IRWXG: number; - const S_IRGRP: number; - const S_IWGRP: number; - const S_IXGRP: number; - const S_IRWXO: number; - const S_IROTH: number; - const S_IWOTH: number; - const S_IXOTH: number; - const S_IFLNK: number; - const O_CREAT: number; - const O_EXCL: number; - const O_NOCTTY: number; - const O_DIRECTORY: number; - const O_NOATIME: number; - const O_NOFOLLOW: number; - const O_SYNC: number; - const O_DSYNC: number; - const O_SYMLINK: number; - const O_DIRECT: number; - const O_NONBLOCK: number; - const O_TRUNC: number; - const O_APPEND: number; - const F_OK: number; - const R_OK: number; - const W_OK: number; - const X_OK: number; - const COPYFILE_EXCL: number; - const COPYFILE_FICLONE: number; - const COPYFILE_FICLONE_FORCE: number; - const UV_UDP_REUSEADDR: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGQUIT` instead. */ - const SIGQUIT: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTRAP` instead. */ - const SIGTRAP: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGIOT` instead. */ - const SIGIOT: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGBUS` instead. */ - const SIGBUS: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUSR1` instead. */ - const SIGUSR1: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUSR2` instead. */ - const SIGUSR2: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPIPE` instead. */ - const SIGPIPE: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGALRM` instead. */ - const SIGALRM: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGCHLD` instead. */ - const SIGCHLD: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSTKFLT` instead. */ - const SIGSTKFLT: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGCONT` instead. */ - const SIGCONT: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSTOP` instead. */ - const SIGSTOP: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTSTP` instead. */ - const SIGTSTP: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTTIN` instead. */ - const SIGTTIN: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTTOU` instead. */ - const SIGTTOU: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGURG` instead. */ - const SIGURG: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGXCPU` instead. */ - const SIGXCPU: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGXFSZ` instead. */ - const SIGXFSZ: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGVTALRM` instead. */ - const SIGVTALRM: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPROF` instead. */ - const SIGPROF: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGIO` instead. */ - const SIGIO: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPOLL` instead. */ - const SIGPOLL: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPWR` instead. */ - const SIGPWR: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSYS` instead. */ - const SIGSYS: number; - /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUNUSED` instead. */ - const SIGUNUSED: number; - const defaultCoreCipherList: string; - const defaultCipherList: string; - const ENGINE_METHOD_RSA: number; - const ALPN_ENABLED: number; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/crypto.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/crypto.d.ts deleted file mode 100644 index ec72d850..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/crypto.d.ts +++ /dev/null @@ -1,764 +0,0 @@ -declare module "crypto" { - import * as stream from "stream"; - - interface Certificate { - exportChallenge(spkac: BinaryLike): Buffer; - exportPublicKey(spkac: BinaryLike): Buffer; - verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - } - const Certificate: { - new(): Certificate; - (): Certificate; - }; - - namespace constants { // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants - const OPENSSL_VERSION_NUMBER: number; - - /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ - const SSL_OP_ALL: number; - /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_CIPHER_SERVER_PREFERENCE: number; - /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */ - const SSL_OP_CISCO_ANYCONNECT: number; - /** Instructs OpenSSL to turn on cookie exchange. */ - const SSL_OP_COOKIE_EXCHANGE: number; - /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ - const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ - const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - /** Instructs OpenSSL to always use the tmp_rsa key when performing RSA operations. */ - const SSL_OP_EPHEMERAL_RSA: number; - /** Allows initial connection to servers that do not support RI. */ - const SSL_OP_LEGACY_SERVER_CONNECT: number; - const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; - const SSL_OP_MICROSOFT_SESS_ID_BUG: number; - /** Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. */ - const SSL_OP_MSIE_SSLV2_RSA_PADDING: number; - const SSL_OP_NETSCAPE_CA_DN_BUG: number; - const SSL_OP_NETSCAPE_CHALLENGE_BUG: number; - const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; - const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; - /** Instructs OpenSSL to disable support for SSL/TLS compression. */ - const SSL_OP_NO_COMPRESSION: number; - const SSL_OP_NO_QUERY_MTU: number; - /** Instructs OpenSSL to always start a new session when performing renegotiation. */ - const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - const SSL_OP_NO_SSLv2: number; - const SSL_OP_NO_SSLv3: number; - const SSL_OP_NO_TICKET: number; - const SSL_OP_NO_TLSv1: number; - const SSL_OP_NO_TLSv1_1: number; - const SSL_OP_NO_TLSv1_2: number; - const SSL_OP_PKCS1_CHECK_1: number; - const SSL_OP_PKCS1_CHECK_2: number; - /** Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. */ - const SSL_OP_SINGLE_DH_USE: number; - /** Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. */ - const SSL_OP_SINGLE_ECDH_USE: number; - const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; - const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; - const SSL_OP_TLS_BLOCK_PADDING_BUG: number; - const SSL_OP_TLS_D5_BUG: number; - /** Instructs OpenSSL to disable version rollback attack detection. */ - const SSL_OP_TLS_ROLLBACK_BUG: number; - - const ENGINE_METHOD_RSA: number; - const ENGINE_METHOD_DSA: number; - const ENGINE_METHOD_DH: number; - const ENGINE_METHOD_RAND: number; - const ENGINE_METHOD_EC: number; - const ENGINE_METHOD_CIPHERS: number; - const ENGINE_METHOD_DIGESTS: number; - const ENGINE_METHOD_PKEY_METHS: number; - const ENGINE_METHOD_PKEY_ASN1_METHS: number; - const ENGINE_METHOD_ALL: number; - const ENGINE_METHOD_NONE: number; - - const DH_CHECK_P_NOT_SAFE_PRIME: number; - const DH_CHECK_P_NOT_PRIME: number; - const DH_UNABLE_TO_CHECK_GENERATOR: number; - const DH_NOT_SUITABLE_GENERATOR: number; - - const ALPN_ENABLED: number; - - const RSA_PKCS1_PADDING: number; - const RSA_SSLV23_PADDING: number; - const RSA_NO_PADDING: number; - const RSA_PKCS1_OAEP_PADDING: number; - const RSA_X931_PADDING: number; - const RSA_PKCS1_PSS_PADDING: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ - const RSA_PSS_SALTLEN_DIGEST: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ - const RSA_PSS_SALTLEN_MAX_SIGN: number; - /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ - const RSA_PSS_SALTLEN_AUTO: number; - - const POINT_CONVERSION_COMPRESSED: number; - const POINT_CONVERSION_UNCOMPRESSED: number; - const POINT_CONVERSION_HYBRID: number; - - /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ - const defaultCoreCipherList: string; - /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ - const defaultCipherList: string; - } - - interface HashOptions extends stream.TransformOptions { - /** - * For XOF hash functions such as `shake256`, the - * outputLength option can be used to specify the desired output length in bytes. - */ - outputLength?: number; - } - - /** @deprecated since v10.0.0 */ - const fips: boolean; - - function createHash(algorithm: string, options?: HashOptions): Hash; - function createHmac(algorithm: string, key: BinaryLike, options?: stream.TransformOptions): Hmac; - - type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1"; - type HexBase64Latin1Encoding = "latin1" | "hex" | "base64"; - type Utf8AsciiBinaryEncoding = "utf8" | "ascii" | "binary"; - type HexBase64BinaryEncoding = "binary" | "base64" | "hex"; - type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; - - class Hash extends stream.Transform { - private constructor(); - update(data: BinaryLike): Hash; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash; - digest(): Buffer; - digest(encoding: HexBase64Latin1Encoding): string; - } - class Hmac extends stream.Transform { - private constructor(); - update(data: BinaryLike): Hmac; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac; - digest(): Buffer; - digest(encoding: HexBase64Latin1Encoding): string; - } - - type KeyObjectType = 'secret' | 'public' | 'private'; - - interface KeyExportOptions { - type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1'; - format: T; - cipher?: string; - passphrase?: string | Buffer; - } - - class KeyObject { - private constructor(); - asymmetricKeyType?: KeyType; - /** - * For asymmetric keys, this property represents the size of the embedded key in - * bytes. This property is `undefined` for symmetric keys. - */ - asymmetricKeySize?: number; - export(options: KeyExportOptions<'pem'>): string | Buffer; - export(options?: KeyExportOptions<'der'>): Buffer; - symmetricKeySize?: number; - type: KeyObjectType; - } - - type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm'; - type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm'; - - type BinaryLike = string | NodeJS.ArrayBufferView; - - type CipherKey = BinaryLike | KeyObject; - - interface CipherCCMOptions extends stream.TransformOptions { - authTagLength: number; - } - interface CipherGCMOptions extends stream.TransformOptions { - authTagLength?: number; - } - /** @deprecated since v10.0.0 use createCipheriv() */ - function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; - /** @deprecated since v10.0.0 use createCipheriv() */ - function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM; - /** @deprecated since v10.0.0 use createCipheriv() */ - function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher; - - function createCipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options: CipherCCMOptions - ): CipherCCM; - function createCipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options?: CipherGCMOptions - ): CipherGCM; - function createCipheriv( - algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions - ): Cipher; - - class Cipher extends stream.Transform { - private constructor(); - update(data: BinaryLike): Buffer; - update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer; - update(data: NodeJS.ArrayBufferView, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string; - update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string; - final(): Buffer; - final(output_encoding: string): string; - setAutoPadding(auto_padding?: boolean): this; - // getAuthTag(): Buffer; - // setAAD(buffer: NodeJS.ArrayBufferView): this; - } - interface CipherCCM extends Cipher { - setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this; - getAuthTag(): Buffer; - } - interface CipherGCM extends Cipher { - setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this; - getAuthTag(): Buffer; - } - /** @deprecated since v10.0.0 use createDecipheriv() */ - function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; - /** @deprecated since v10.0.0 use createDecipheriv() */ - function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; - /** @deprecated since v10.0.0 use createDecipheriv() */ - function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; - - function createDecipheriv( - algorithm: CipherCCMTypes, - key: BinaryLike, - iv: BinaryLike | null, - options: CipherCCMOptions, - ): DecipherCCM; - function createDecipheriv( - algorithm: CipherGCMTypes, - key: BinaryLike, - iv: BinaryLike | null, - options?: CipherGCMOptions, - ): DecipherGCM; - function createDecipheriv(algorithm: string, key: BinaryLike, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher; - - class Decipher extends stream.Transform { - private constructor(); - update(data: NodeJS.ArrayBufferView): Buffer; - update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer; - update(data: NodeJS.ArrayBufferView, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string; - update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string; - final(): Buffer; - final(output_encoding: string): string; - setAutoPadding(auto_padding?: boolean): this; - // setAuthTag(tag: NodeJS.ArrayBufferView): this; - // setAAD(buffer: NodeJS.ArrayBufferView): this; - } - interface DecipherCCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this; - } - interface DecipherGCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this; - } - - interface PrivateKeyInput { - key: string | Buffer; - format?: KeyFormat; - type?: 'pkcs1' | 'pkcs8' | 'sec1'; - passphrase?: string | Buffer; - } - - interface PublicKeyInput { - key: string | Buffer; - format?: KeyFormat; - type?: 'pkcs1' | 'spki'; - } - - function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject; - function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject; - function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; - - function createSign(algorithm: string, options?: stream.WritableOptions): Signer; - - type DSAEncoding = 'der' | 'ieee-p1363'; - - interface SigningOptions { - /** - * @See crypto.constants.RSA_PKCS1_PADDING - */ - padding?: number; - saltLength?: number; - dsaEncoding?: DSAEncoding; - } - - interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions { - } - interface SignKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions { - } - interface VerifyKeyObjectInput extends SigningOptions { - key: KeyObject; - } - - type KeyLike = string | Buffer | KeyObject; - - class Signer extends stream.Writable { - private constructor(); - - update(data: BinaryLike): Signer; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; - sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, output_format: HexBase64Latin1Encoding): string; - } - - function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; - class Verify extends stream.Writable { - private constructor(); - - update(data: BinaryLike): Verify; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify; - verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean; - verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: HexBase64Latin1Encoding): boolean; - // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format - // The signature field accepts a TypedArray type, but it is only available starting ES2017 - } - function createDiffieHellman(prime_length: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman; - class DiffieHellman { - private constructor(); - generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; - computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; - getPrime(): Buffer; - getPrime(encoding: HexBase64Latin1Encoding): string; - getGenerator(): Buffer; - getGenerator(encoding: HexBase64Latin1Encoding): string; - getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: HexBase64Latin1Encoding): string; - setPublicKey(public_key: NodeJS.ArrayBufferView): void; - setPublicKey(public_key: string, encoding: string): void; - setPrivateKey(private_key: NodeJS.ArrayBufferView): void; - setPrivateKey(private_key: string, encoding: string): void; - verifyError: number; - } - function getDiffieHellman(group_name: string): DiffieHellman; - function pbkdf2( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - callback: (err: Error | null, derivedKey: Buffer) => any, - ): void; - function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer; - - function randomBytes(size: number): Buffer; - function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - function pseudoRandomBytes(size: number): Buffer; - function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - - function randomInt(max: number): number; - function randomInt(min: number, max: number): number; - function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; - function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; - - function randomFillSync(buffer: T, offset?: number, size?: number): T; - function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void; - function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void; - function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void; - - interface ScryptOptions { - N?: number; - r?: number; - p?: number; - maxmem?: number; - } - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - options: ScryptOptions, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; - - interface RsaPublicKey { - key: KeyLike; - padding?: number; - } - interface RsaPrivateKey { - key: KeyLike; - passphrase?: string; - /** - * @default 'sha1' - */ - oaepHash?: string; - oaepLabel?: NodeJS.TypedArray; - padding?: number; - } - function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function getCiphers(): string[]; - function getCurves(): string[]; - function getFips(): 1 | 0; - function getHashes(): string[]; - class ECDH { - private constructor(); - static convertKey( - key: BinaryLike, - curve: string, - inputEncoding?: HexBase64Latin1Encoding, - outputEncoding?: "latin1" | "hex" | "base64", - format?: "uncompressed" | "compressed" | "hybrid", - ): Buffer | string; - generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; - computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; - computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: HexBase64Latin1Encoding): string; - getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; - setPrivateKey(private_key: NodeJS.ArrayBufferView): void; - setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void; - } - function createECDH(curve_name: string): ECDH; - function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; - /** @deprecated since v10.0.0 */ - const DEFAULT_ENCODING: string; - - type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; - type KeyFormat = 'pem' | 'der'; - - interface BasePrivateKeyEncodingOptions { - format: T; - cipher?: string; - passphrase?: string; - } - - interface KeyPairKeyObjectResult { - publicKey: KeyObject; - privateKey: KeyObject; - } - - interface ED25519KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface ED448KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface X25519KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface X448KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface ECKeyPairKeyObjectOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - } - - interface RSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - - /** - * @default 0x10001 - */ - publicExponent?: number; - } - - interface DSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - - /** - * Size of q in bits - */ - divisorLength: number; - } - - interface RSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * @default 0x10001 - */ - publicExponent?: number; - - publicKeyEncoding: { - type: 'pkcs1' | 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs1' | 'pkcs8'; - }; - } - - interface DSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface ECKeyPairOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - - publicKeyEncoding: { - type: 'pkcs1' | 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'sec1' | 'pkcs8'; - }; - } - - interface ED25519KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface ED448KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface X25519KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface X448KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface KeyPairSyncResult { - publicKey: T1; - privateKey: T2; - } - - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - namespace generateKeyPair { - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "x25519", options?: X25519KeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; - } - - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been - * passed to [`crypto.createPrivateKey()`][]. - */ - function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; - - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been - * passed to [`crypto.createPublicKey()`][]. - */ - function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): Buffer; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/dgram.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/dgram.d.ts deleted file mode 100644 index 300dfecf..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/dgram.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -declare module "dgram" { - import { AddressInfo } from "net"; - import * as dns from "dns"; - import * as events from "events"; - - interface RemoteInfo { - address: string; - family: 'IPv4' | 'IPv6'; - port: number; - size: number; - } - - interface BindOptions { - port?: number; - address?: string; - exclusive?: boolean; - fd?: number; - } - - type SocketType = "udp4" | "udp6"; - - interface SocketOptions { - type: SocketType; - reuseAddr?: boolean; - /** - * @default false - */ - ipv6Only?: boolean; - recvBufferSize?: number; - sendBufferSize?: number; - lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; - } - - function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - - class Socket extends events.EventEmitter { - addMembership(multicastAddress: string, multicastInterface?: string): void; - address(): AddressInfo; - bind(port?: number, address?: string, callback?: () => void): void; - bind(port?: number, callback?: () => void): void; - bind(callback?: () => void): void; - bind(options: BindOptions, callback?: () => void): void; - close(callback?: () => void): void; - connect(port: number, address?: string, callback?: () => void): void; - connect(port: number, callback: () => void): void; - disconnect(): void; - dropMembership(multicastAddress: string, multicastInterface?: string): void; - getRecvBufferSize(): number; - getSendBufferSize(): number; - ref(): this; - remoteAddress(): AddressInfo; - send(msg: string | Uint8Array | ReadonlyArray, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array | ReadonlyArray, port?: number, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array | ReadonlyArray, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void; - setBroadcast(flag: boolean): void; - setMulticastInterface(multicastInterface: string): void; - setMulticastLoopback(flag: boolean): void; - setMulticastTTL(ttl: number): void; - setRecvBufferSize(size: number): void; - setSendBufferSize(size: number): void; - setTTL(ttl: number): void; - unref(): this; - - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. error - * 4. listening - * 5. message - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/dns.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/dns.d.ts deleted file mode 100644 index d2b05056..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/dns.d.ts +++ /dev/null @@ -1,366 +0,0 @@ -declare module "dns" { - // Supported getaddrinfo flags. - const ADDRCONFIG: number; - const V4MAPPED: number; - - interface LookupOptions { - family?: number; - hints?: number; - all?: boolean; - verbatim?: boolean; - } - - interface LookupOneOptions extends LookupOptions { - all?: false; - } - - interface LookupAllOptions extends LookupOptions { - all: true; - } - - interface LookupAddress { - address: string; - family: number; - } - - function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; - function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; - function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lookup { - function __promisify__(hostname: string, options: LookupAllOptions): Promise; - function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; - function __promisify__(hostname: string, options: LookupOptions): Promise; - } - - function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; - - namespace lookupService { - function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; - } - - interface ResolveOptions { - ttl: boolean; - } - - interface ResolveWithTtlOptions extends ResolveOptions { - ttl: true; - } - - interface RecordWithTtl { - address: string; - ttl: number; - } - - /** @deprecated Use AnyARecord or AnyAaaaRecord instead. */ - type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; - - interface AnyARecord extends RecordWithTtl { - type: "A"; - } - - interface AnyAaaaRecord extends RecordWithTtl { - type: "AAAA"; - } - - interface MxRecord { - priority: number; - exchange: string; - } - - interface AnyMxRecord extends MxRecord { - type: "MX"; - } - - interface NaptrRecord { - flags: string; - service: string; - regexp: string; - replacement: string; - order: number; - preference: number; - } - - interface AnyNaptrRecord extends NaptrRecord { - type: "NAPTR"; - } - - interface SoaRecord { - nsname: string; - hostmaster: string; - serial: number; - refresh: number; - retry: number; - expire: number; - minttl: number; - } - - interface AnySoaRecord extends SoaRecord { - type: "SOA"; - } - - interface SrvRecord { - priority: number; - weight: number; - port: number; - name: string; - } - - interface AnySrvRecord extends SrvRecord { - type: "SRV"; - } - - interface AnyTxtRecord { - type: "TXT"; - entries: string[]; - } - - interface AnyNsRecord { - type: "NS"; - value: string; - } - - interface AnyPtrRecord { - type: "PTR"; - value: string; - } - - interface AnyCnameRecord { - type: "CNAME"; - value: string; - } - - type AnyRecord = AnyARecord | - AnyAaaaRecord | - AnyCnameRecord | - AnyMxRecord | - AnyNaptrRecord | - AnyNsRecord | - AnyPtrRecord | - AnySoaRecord | - AnySrvRecord | - AnyTxtRecord; - - function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; - function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; - function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; - function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; - function resolve( - hostname: string, - rrtype: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, - ): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve { - function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - function __promisify__(hostname: string, rrtype: "ANY"): Promise; - function __promisify__(hostname: string, rrtype: "MX"): Promise; - function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; - function __promisify__(hostname: string, rrtype: "SOA"): Promise; - function __promisify__(hostname: string, rrtype: "SRV"): Promise; - function __promisify__(hostname: string, rrtype: "TXT"): Promise; - function __promisify__(hostname: string, rrtype: string): Promise; - } - - function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; - function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve4 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - - function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; - function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve6 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - - function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolveCname { - function __promisify__(hostname: string): Promise; - } - - function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; - namespace resolveMx { - function __promisify__(hostname: string): Promise; - } - - function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; - namespace resolveNaptr { - function __promisify__(hostname: string): Promise; - } - - function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolveNs { - function __promisify__(hostname: string): Promise; - } - - function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolvePtr { - function __promisify__(hostname: string): Promise; - } - - function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; - namespace resolveSoa { - function __promisify__(hostname: string): Promise; - } - - function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; - namespace resolveSrv { - function __promisify__(hostname: string): Promise; - } - - function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; - namespace resolveTxt { - function __promisify__(hostname: string): Promise; - } - - function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; - namespace resolveAny { - function __promisify__(hostname: string): Promise; - } - - function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; - function setServers(servers: ReadonlyArray): void; - function getServers(): string[]; - - // Error codes - const NODATA: string; - const FORMERR: string; - const SERVFAIL: string; - const NOTFOUND: string; - const NOTIMP: string; - const REFUSED: string; - const BADQUERY: string; - const BADNAME: string; - const BADFAMILY: string; - const BADRESP: string; - const CONNREFUSED: string; - const TIMEOUT: string; - const EOF: string; - const FILE: string; - const NOMEM: string; - const DESTRUCTION: string; - const BADSTR: string; - const BADFLAGS: string; - const NONAME: string; - const BADHINTS: string; - const NOTINITIALIZED: string; - const LOADIPHLPAPI: string; - const ADDRGETNETWORKPARAMS: string; - const CANCELLED: string; - - class Resolver { - getServers: typeof getServers; - setServers: typeof setServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - cancel(): void; - } - - namespace promises { - function getServers(): string[]; - - function lookup(hostname: string, family: number): Promise; - function lookup(hostname: string, options: LookupOneOptions): Promise; - function lookup(hostname: string, options: LookupAllOptions): Promise; - function lookup(hostname: string, options: LookupOptions): Promise; - function lookup(hostname: string): Promise; - - function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>; - - function resolve(hostname: string): Promise; - function resolve(hostname: string, rrtype: "A"): Promise; - function resolve(hostname: string, rrtype: "AAAA"): Promise; - function resolve(hostname: string, rrtype: "ANY"): Promise; - function resolve(hostname: string, rrtype: "CNAME"): Promise; - function resolve(hostname: string, rrtype: "MX"): Promise; - function resolve(hostname: string, rrtype: "NAPTR"): Promise; - function resolve(hostname: string, rrtype: "NS"): Promise; - function resolve(hostname: string, rrtype: "PTR"): Promise; - function resolve(hostname: string, rrtype: "SOA"): Promise; - function resolve(hostname: string, rrtype: "SRV"): Promise; - function resolve(hostname: string, rrtype: "TXT"): Promise; - function resolve(hostname: string, rrtype: string): Promise; - - function resolve4(hostname: string): Promise; - function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve4(hostname: string, options: ResolveOptions): Promise; - - function resolve6(hostname: string): Promise; - function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve6(hostname: string, options: ResolveOptions): Promise; - - function resolveAny(hostname: string): Promise; - - function resolveCname(hostname: string): Promise; - - function resolveMx(hostname: string): Promise; - - function resolveNaptr(hostname: string): Promise; - - function resolveNs(hostname: string): Promise; - - function resolvePtr(hostname: string): Promise; - - function resolveSoa(hostname: string): Promise; - - function resolveSrv(hostname: string): Promise; - - function resolveTxt(hostname: string): Promise; - - function reverse(ip: string): Promise; - - function setServers(servers: ReadonlyArray): void; - - class Resolver { - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - setServers: typeof setServers; - } - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/domain.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/domain.d.ts deleted file mode 100644 index 45e388c4..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/domain.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module "domain" { - import * as events from "events"; - - class Domain extends events.EventEmitter implements NodeJS.Domain { - run(fn: (...args: any[]) => T, ...args: any[]): T; - add(emitter: events.EventEmitter | NodeJS.Timer): void; - remove(emitter: events.EventEmitter | NodeJS.Timer): void; - bind(cb: T): T; - intercept(cb: T): T; - members: Array; - enter(): void; - exit(): void; - } - - function create(): Domain; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/events.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/events.d.ts deleted file mode 100644 index 65344224..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/events.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -declare module "events" { - class internal extends NodeJS.EventEmitter { } - - interface NodeEventTarget { - once(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface DOMEventTarget { - addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any; - } - - namespace internal { - function once(emitter: NodeEventTarget, event: string | symbol): Promise; - function once(emitter: DOMEventTarget, event: string): Promise; - - /** - * This symbol shall be used to install a listener for only monitoring `'error'` - * events. Listeners installed using this symbol are called before the regular - * `'error'` listeners are called. - * - * Installing a listener using this symbol does not change the behavior once an - * `'error'` event is emitted, therefore the process will still crash if no - * regular `'error'` listener is installed. - */ - const errorMonitor: unique symbol; - - class EventEmitter extends internal { - /** @deprecated since v4.0.0 */ - static listenerCount(emitter: EventEmitter, event: string | symbol): number; - static defaultMaxListeners: number; - - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - removeAllListeners(event?: string | symbol): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: string | symbol): Function[]; - rawListeners(event: string | symbol): Function[]; - emit(event: string | symbol, ...args: any[]): boolean; - eventNames(): Array; - listenerCount(type: string | symbol): number; - } - } - - export = internal; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/fs.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/fs.d.ts deleted file mode 100644 index 9e0740e7..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/fs.d.ts +++ /dev/null @@ -1,2516 +0,0 @@ -declare module "fs" { - import * as stream from "stream"; - import * as events from "events"; - import { URL } from "url"; - - /** - * Valid types for path values in "fs". - */ - type PathLike = string | Buffer | URL; - - type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; - - interface StatsBase { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - - dev: T; - ino: T; - mode: T; - nlink: T; - uid: T; - gid: T; - rdev: T; - size: T; - blksize: T; - blocks: T; - atimeMs: T; - mtimeMs: T; - ctimeMs: T; - birthtimeMs: T; - atime: Date; - mtime: Date; - ctime: Date; - birthtime: Date; - } - - interface Stats extends StatsBase { - } - - class Stats { - } - - class Dirent { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - name: string; - } - - /** - * A class representing a directory stream. - */ - class Dir { - readonly path: string; - - /** - * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. - */ - [Symbol.asyncIterator](): AsyncIterableIterator; - - /** - * Asynchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - */ - close(): Promise; - close(cb: NoParamCallback): void; - - /** - * Synchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - */ - closeSync(): void; - - /** - * Asynchronously read the next directory entry via `readdir(3)` as an `Dirent`. - * After the read is completed, a value is returned that will be resolved with an `Dirent`, or `null` if there are no more directory entries to read. - * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. - */ - read(): Promise; - read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; - - /** - * Synchronously read the next directory entry via `readdir(3)` as a `Dirent`. - * If there are no more directory entries to read, null will be returned. - * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. - */ - readSync(): Dirent; - } - - interface FSWatcher extends events.EventEmitter { - close(): void; - - /** - * events.EventEmitter - * 1. change - * 2. error - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "close", listener: () => void): this; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "close", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "close", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "close", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - } - - class ReadStream extends stream.Readable { - close(): void; - bytesRead: number; - path: string | Buffer; - - /** - * events.EventEmitter - * 1. open - * 2. close - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "close", listener: () => void): this; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "close", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "close", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "close", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - } - - class WriteStream extends stream.Writable { - close(): void; - bytesWritten: number; - path: string | Buffer; - - /** - * events.EventEmitter - * 1. open - * 2. close - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "close", listener: () => void): this; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "close", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "close", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "close", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - } - - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace rename { - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; - } - - /** - * Synchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function renameSync(oldPath: PathLike, newPath: PathLike): void; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function truncate(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace truncate { - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(path: PathLike, len?: number | null): Promise; - } - - /** - * Synchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncateSync(path: PathLike, len?: number | null): void; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - */ - function ftruncate(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace ftruncate { - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(fd: number, len?: number | null): Promise; - } - - /** - * Synchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function ftruncateSync(fd: number, len?: number | null): void; - - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace chown { - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - - /** - * Synchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chownSync(path: PathLike, uid: number, gid: number): void; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fchown { - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function __promisify__(fd: number, uid: number, gid: number): Promise; - } - - /** - * Synchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function fchownSync(fd: number, uid: number, gid: number): void; - - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lchown { - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - - /** - * Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchownSync(path: PathLike, uid: number, gid: number): void; - - /** - * Changes the access and modification times of a file in the same way as `fs.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lutimes { - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`, - * or throws an exception when parameters are incorrect or the operation fails. - * This is the synchronous version of `fs.lutimes()`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmod(path: PathLike, mode: string | number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace chmod { - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: string | number): Promise; - } - - /** - * Synchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmodSync(path: PathLike, mode: string | number): void; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmod(fd: number, mode: string | number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fchmod { - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(fd: number, mode: string | number): Promise; - } - - /** - * Synchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmodSync(fd: number, mode: string | number): void; - - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmod(path: PathLike, mode: string | number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lchmod { - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: string | number): Promise; - } - - /** - * Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmodSync(path: PathLike, mode: string | number): void; - - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function stat(path: PathLike, options: BigIntOptions, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void; - function stat(path: PathLike, options: StatOptions, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; - function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace stat { - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options: BigIntOptions): Promise; - function __promisify__(path: PathLike, options: StatOptions): Promise; - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function statSync(path: PathLike, options: BigIntOptions): BigIntStats; - function statSync(path: PathLike, options: StatOptions): Stats | BigIntStats; - function statSync(path: PathLike): Stats; - - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fstat { - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function fstatSync(fd: number): Stats; - - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lstat { - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstatSync(path: PathLike): Stats; - - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace link { - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; - } - - /** - * Synchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function linkSync(existingPath: PathLike, newPath: PathLike): void; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - */ - function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace symlink { - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; - - type Type = "dir" | "file" | "junction"; - } - - /** - * Synchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink( - path: PathLike, - options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void - ): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace readlink { - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - } - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlinkSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlinkSync(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer; - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlinkSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath( - path: PathLike, - options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void - ): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace realpath { - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - function native( - path: PathLike, - options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void - ): void; - function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; - function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; - function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; - } - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpathSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpathSync(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer; - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpathSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer; - - namespace realpathSync { - function native(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - function native(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer; - function native(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer; - } - - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlink(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace unlink { - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlinkSync(path: PathLike): void; - - interface RmDirOptions { - /** - * If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is - * encountered, Node.js will retry the operation with a linear backoff wait of - * 100ms longer on each try. This option represents the number of retries. This - * option is ignored if the `recursive` option is not `true`. - * @default 3 - */ - maxRetries?: number; - /** - * If `true`, perform a recursive directory removal. In - * recursive mode, errors are not reported if `path` does not exist, and - * operations are retried on failure. - * @experimental - * @default false - */ - recursive?: boolean; - /** - * If an `EMFILE` error is encountered, Node.js will - * retry the operation with a linear backoff of 1ms longer on each try until the - * timeout duration passes this limit. This option is ignored if the `recursive` - * option is not `true`. - * @default 1000 - */ - emfileWait?: number; - } - - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdir(path: PathLike, callback: NoParamCallback): void; - function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace rmdir { - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options?: RmDirOptions): Promise; - } - - /** - * Synchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdirSync(path: PathLike, options?: RmDirOptions): void; - - interface MakeDirectoryOptions { - /** - * Indicates whether parent folders should be created. - * @default false - */ - recursive?: boolean; - /** - * A file mode. If a string is passed, it is parsed as an octal integer. If not specified - * @default 0o777. - */ - mode?: number | string; - } - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function mkdir(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace mkdir { - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise; - } - - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdirSync(path: PathLike, options?: number | string | MakeDirectoryOptions | null): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - */ - function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace mkdtemp { - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: { encoding?: string | null } | string | null): Promise; - } - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtempSync(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtempSync(prefix: string, options: { encoding: "buffer" } | "buffer"): Buffer; - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtempSync(prefix: string, options?: { encoding?: string | null } | string | null): string | Buffer; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null, - callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, - ): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace readdir { - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent - */ - function __promisify__(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise; - } - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdirSync(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): string[] | Buffer[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdirSync(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Dirent[]; - - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function close(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace close { - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function closeSync(fd: number): void; - - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace open { - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function __promisify__(path: PathLike, flags: string | number, mode?: string | number | null): Promise; - } - - /** - * Synchronous open(2) - open and possibly create a file, returning a file descriptor.. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function openSync(path: PathLike, flags: string | number, mode?: string | number | null): number; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace utimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Synchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace futimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(fd: number, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Synchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function fsync(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fsync { - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function fsyncSync(fd: number): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - */ - function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - */ - function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - */ - function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function write( - fd: number, - string: any, - position: number | undefined | null, - encoding: string | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - */ - function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace write { - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function __promisify__( - fd: number, - buffer?: TBuffer, - offset?: number, - length?: number, - position?: number | null, - ): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function __promisify__(fd: number, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; - } - - /** - * Synchronously writes `buffer` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number; - - /** - * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function writeSync(fd: number, string: any, position?: number | null, encoding?: string | null): number; - - /** - * Asynchronously reads data from the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace read { - /** - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function __promisify__( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null - ): Promise<{ bytesRead: number, buffer: TBuffer }>; - } - - /** - * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read. - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | number, - options: { encoding?: string | null; flag?: string; } | string | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, - ): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - */ - function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace readFile { - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options: { encoding: string; flag?: string; } | string): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): Promise; - } - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`. - */ - function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer; - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFileSync(path: PathLike | number, options: { encoding: string; flag?: string; } | string): string; - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFileSync(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): string | Buffer; - - type WriteFileOptions = { encoding?: string | null; mode?: number | string; flag?: string; } | string | null; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback): void; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - function writeFile(path: PathLike | number, data: any, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace writeFile { - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function __promisify__(path: PathLike | number, data: any, options?: WriteFileOptions): Promise; - } - - /** - * Synchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFileSync(path: PathLike | number, data: any, options?: WriteFileOptions): void; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback): void; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - function appendFile(file: PathLike | number, data: any, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace appendFile { - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function __promisify__(file: PathLike | number, data: any, options?: WriteFileOptions): Promise; - } - - /** - * Synchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFileSync(file: PathLike | number, data: any, options?: WriteFileOptions): void; - - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - */ - function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void; - - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void; - - /** - * Stop watching for changes on `filename`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch( - filename: PathLike, - options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null, - listener?: (event: string, filename: string) => void, - ): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch(filename: PathLike, options: { encoding: "buffer", persistent?: boolean, recursive?: boolean } | "buffer", listener?: (event: string, filename: Buffer) => void): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch( - filename: PathLike, - options: { encoding?: string | null, persistent?: boolean, recursive?: boolean } | string | null, - listener?: (event: string, filename: string | Buffer) => void, - ): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function watch(filename: PathLike, listener?: (event: string, filename: string) => any): FSWatcher; - - /** - * Asynchronously tests whether or not the given path exists by checking with the file system. - * @deprecated - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function exists(path: PathLike, callback: (exists: boolean) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace exists { - /** - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronously tests whether or not the given path exists by checking with the file system. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function existsSync(path: PathLike): boolean; - - namespace constants { - // File Access Constants - - /** Constant for fs.access(). File is visible to the calling process. */ - const F_OK: number; - - /** Constant for fs.access(). File can be read by the calling process. */ - const R_OK: number; - - /** Constant for fs.access(). File can be written by the calling process. */ - const W_OK: number; - - /** Constant for fs.access(). File can be executed by the calling process. */ - const X_OK: number; - - // File Copy Constants - - /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ - const COPYFILE_EXCL: number; - - /** - * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. - */ - const COPYFILE_FICLONE: number; - - /** - * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then the operation will fail with an error. - */ - const COPYFILE_FICLONE_FORCE: number; - - // File Open Constants - - /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ - const O_RDONLY: number; - - /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ - const O_WRONLY: number; - - /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ - const O_RDWR: number; - - /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ - const O_CREAT: number; - - /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ - const O_EXCL: number; - - /** - * Constant for fs.open(). Flag indicating that if path identifies a terminal device, - * opening the path shall not cause that terminal to become the controlling terminal for the process - * (if the process does not already have one). - */ - const O_NOCTTY: number; - - /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ - const O_TRUNC: number; - - /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ - const O_APPEND: number; - - /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ - const O_DIRECTORY: number; - - /** - * constant for fs.open(). - * Flag indicating reading accesses to the file system will no longer result in - * an update to the atime information associated with the file. - * This flag is available on Linux operating systems only. - */ - const O_NOATIME: number; - - /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ - const O_NOFOLLOW: number; - - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ - const O_SYNC: number; - - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ - const O_DSYNC: number; - - /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ - const O_SYMLINK: number; - - /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ - const O_DIRECT: number; - - /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ - const O_NONBLOCK: number; - - // File Type Constants - - /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ - const S_IFMT: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ - const S_IFREG: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ - const S_IFDIR: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ - const S_IFCHR: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ - const S_IFBLK: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ - const S_IFIFO: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ - const S_IFLNK: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ - const S_IFSOCK: number; - - // File Mode Constants - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ - const S_IRWXU: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ - const S_IRUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ - const S_IWUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ - const S_IXUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ - const S_IRWXG: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ - const S_IRGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ - const S_IWGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ - const S_IXGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ - const S_IRWXO: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ - const S_IROTH: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ - const S_IWOTH: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ - const S_IXOTH: number; - - /** - * When set, a memory file mapping is used to access the file. This flag - * is available on Windows operating systems only. On other operating systems, - * this flag is ignored. - */ - const UV_FS_O_FILEMAP: number; - } - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace access { - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike, mode?: number): Promise; - } - - /** - * Synchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function accessSync(path: PathLike, mode?: number): void; - - /** - * Returns a new `ReadStream` object. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function createReadStream(path: PathLike, options?: string | { - flags?: string; - encoding?: string; - fd?: number; - mode?: number; - autoClose?: boolean; - /** - * @default false - */ - emitClose?: boolean; - start?: number; - end?: number; - highWaterMark?: number; - }): ReadStream; - - /** - * Returns a new `WriteStream` object. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function createWriteStream(path: PathLike, options?: string | { - flags?: string; - encoding?: string; - fd?: number; - mode?: number; - autoClose?: boolean; - emitClose?: boolean; - start?: number; - highWaterMark?: number; - }): WriteStream; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function fdatasync(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fdatasync { - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function fdatasyncSync(fd: number): void; - - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - */ - function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. - */ - function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace copyFile { - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. - * The only supported flag is fs.constants.COPYFILE_EXCL, - * which causes the copy operation to fail if dest already exists. - */ - function __promisify__(src: PathLike, dst: PathLike, flags?: number): Promise; - } - - /** - * Synchronously copies src to dest. By default, dest is overwritten if it already exists. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. - * The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. - */ - function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void; - - /** - * Write an array of ArrayBufferViews to the file specified by fd using writev(). - * position is the offset from the beginning of the file where this data should be written. - * It is unsafe to use fs.writev() multiple times on the same file without waiting for the callback. For this scenario, use fs.createWriteStream(). - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to the end of the file. - */ - function writev( - fd: number, - buffers: ReadonlyArray, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - function writev( - fd: number, - buffers: ReadonlyArray, - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - - interface WriteVResult { - bytesWritten: number; - buffers: NodeJS.ArrayBufferView[]; - } - - namespace writev { - function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; - } - - /** - * See `writev`. - */ - function writevSync(fd: number, buffers: ReadonlyArray, position?: number): number; - - interface OpenDirOptions { - encoding?: BufferEncoding; - } - - function opendirSync(path: string, options?: OpenDirOptions): Dir; - - function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - - namespace opendir { - function __promisify__(path: string, options?: OpenDirOptions): Promise; - } - - namespace promises { - interface FileHandle { - /** - * Gets the file descriptor for this file handle. - */ - readonly fd: number; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for appending. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - */ - chown(uid: number, gid: number): Promise; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - chmod(mode: string | number): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - */ - datasync(): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - */ - sync(): Promise; - - /** - * Asynchronously reads data from the file. - * The `FileHandle` must have been opened for reading. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - read(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: { encoding?: null, flag?: string | number } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - */ - stat(): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param len If not specified, defaults to `0`. - */ - truncate(len?: number): Promise; - - /** - * Asynchronously change file timestamps of the file. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - utimes(atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously writes `buffer` to the file. - * The `FileHandle` must have been opened for writing. - * @param buffer The buffer that the data will be written to. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - write(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * See `fs.writev` promisified version. - */ - writev(buffers: ReadonlyArray, position?: number): Promise; - - /** - * Asynchronous close(2) - close a `FileHandle`. - */ - close(): Promise; - } - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, mode?: number): Promise; - - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. The only - * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if - * `dest` already exists. - */ - function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise; - - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not - * supplied, defaults to `0o666`. - */ - function open(path: PathLike, flags: string | number, mode?: string | number): Promise; - - /** - * Asynchronously reads data from the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If - * `null`, data will be read from the current position. - */ - function read( - handle: FileHandle, - buffer: TBuffer, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise<{ bytesRead: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write( - handle: FileHandle, - buffer: TBuffer, - offset?: number | null, - length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; - - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function rename(oldPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncate(path: PathLike, len?: number): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param handle A `FileHandle`. - * @param len If not specified, defaults to `0`. - */ - function ftruncate(handle: FileHandle, len?: number): Promise; - - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdir(path: PathLike, options?: RmDirOptions): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param handle A `FileHandle`. - */ - function fdatasync(handle: FileHandle): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param handle A `FileHandle`. - */ - function fsync(handle: FileHandle): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - * @param handle A `FileHandle`. - */ - function fstat(handle: FileHandle): Promise; - - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstat(path: PathLike): Promise; - - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function stat(path: PathLike): Promise; - - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function link(existingPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlink(path: PathLike): Promise; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param handle A `FileHandle`. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmod(handle: FileHandle, mode: string | number): Promise; - - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmod(path: PathLike, mode: string | number): Promise; - - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmod(path: PathLike, mode: string | number): Promise; - - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param handle A `FileHandle`. - */ - function fchown(handle: FileHandle, uid: number, gid: number): Promise; - - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; - - function opendir(path: string, options?: OpenDirOptions): Promise; - } - - interface BigIntStats extends StatsBase { - } - - class BigIntStats { - atimeNs: bigint; - mtimeNs: bigint; - ctimeNs: bigint; - birthtimeNs: bigint; - } - - interface BigIntOptions { - bigint: true; - } - - interface StatOptions { - bigint: boolean; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/globals.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/globals.d.ts deleted file mode 100644 index 2b07e98c..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/globals.d.ts +++ /dev/null @@ -1,1216 +0,0 @@ -// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build -interface Console { - Console: NodeJS.ConsoleConstructor; - /** - * A simple assertion test that verifies whether `value` is truthy. - * If it is not, an `AssertionError` is thrown. - * If provided, the error `message` is formatted using `util.format()` and used as the error message. - */ - assert(value: any, message?: string, ...optionalParams: any[]): void; - /** - * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY. - * When `stdout` is not a TTY, this method does nothing. - */ - clear(): void; - /** - * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`. - */ - count(label?: string): void; - /** - * Resets the internal counter specific to `label`. - */ - countReset(label?: string): void; - /** - * The `console.debug()` function is an alias for {@link console.log()}. - */ - debug(message?: any, ...optionalParams: any[]): void; - /** - * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`. - * This function bypasses any custom `inspect()` function defined on `obj`. - */ - dir(obj: any, options?: NodeJS.InspectOptions): void; - /** - * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting - */ - dirxml(...data: any[]): void; - /** - * Prints to `stderr` with newline. - */ - error(message?: any, ...optionalParams: any[]): void; - /** - * Increases indentation of subsequent lines by two spaces. - * If one or more `label`s are provided, those are printed first without the additional indentation. - */ - group(...label: any[]): void; - /** - * The `console.groupCollapsed()` function is an alias for {@link console.group()}. - */ - groupCollapsed(...label: any[]): void; - /** - * Decreases indentation of subsequent lines by two spaces. - */ - groupEnd(): void; - /** - * The {@link console.info()} function is an alias for {@link console.log()}. - */ - info(message?: any, ...optionalParams: any[]): void; - /** - * Prints to `stdout` with newline. - */ - log(message?: any, ...optionalParams: any[]): void; - /** - * This method does not display anything unless used in the inspector. - * Prints to `stdout` the array `array` formatted as a table. - */ - table(tabularData: any, properties?: ReadonlyArray): void; - /** - * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`. - */ - time(label?: string): void; - /** - * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`. - */ - timeEnd(label?: string): void; - /** - * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`. - */ - timeLog(label?: string, ...data: any[]): void; - /** - * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code. - */ - trace(message?: any, ...optionalParams: any[]): void; - /** - * The {@link console.warn()} function is an alias for {@link console.error()}. - */ - warn(message?: any, ...optionalParams: any[]): void; - - // --- Inspector mode only --- - /** - * This method does not display anything unless used in the inspector. - * The console.markTimeline() method is the deprecated form of console.timeStamp(). - * - * @deprecated Use console.timeStamp() instead. - */ - markTimeline(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Starts a JavaScript CPU profile with an optional label. - */ - profile(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. - */ - profileEnd(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Adds an event with the label `label` to the Timeline panel of the inspector. - */ - timeStamp(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * The console.timeline() method is the deprecated form of console.time(). - * - * @deprecated Use console.time() instead. - */ - timeline(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * The console.timelineEnd() method is the deprecated form of console.timeEnd(). - * - * @deprecated Use console.timeEnd() instead. - */ - timelineEnd(label?: string): void; -} - -interface Error { - stack?: string; -} - -// Declare "static" methods in Error -interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: Object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces - */ - prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any; - - stackTraceLimit: number; -} - -interface SymbolConstructor { - readonly observable: symbol; -} - -// Node.js ESNEXT support -interface String { - /** Removes whitespace from the left end of a string. */ - trimLeft(): string; - /** Removes whitespace from the right end of a string. */ - trimRight(): string; - - /** Returns a copy with leading whitespace removed. */ - trimStart(): string; - /** Returns a copy with trailing whitespace removed. */ - trimEnd(): string; -} - -interface ImportMeta { - url: string; -} - -/*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ -declare var process: NodeJS.Process; -declare var console: Console; - -declare var __filename: string; -declare var __dirname: string; - -declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; -declare namespace setTimeout { - function __promisify__(ms: number): Promise; - function __promisify__(ms: number, value: T): Promise; -} -declare function clearTimeout(timeoutId: NodeJS.Timeout): void; -declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; -declare function clearInterval(intervalId: NodeJS.Timeout): void; -declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; -declare namespace setImmediate { - function __promisify__(): Promise; - function __promisify__(value: T): Promise; -} -declare function clearImmediate(immediateId: NodeJS.Immediate): void; - -declare function queueMicrotask(callback: () => void): void; - -// TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. -interface NodeRequireFunction { - (id: string): any; -} - -interface NodeRequireCache { - [path: string]: NodeModule; -} - -interface NodeRequire extends NodeRequireFunction { - resolve: RequireResolve; - cache: NodeRequireCache; - /** - * @deprecated - */ - extensions: NodeExtensions; - main: NodeModule | undefined; -} - -interface RequireResolve { - (id: string, options?: { paths?: string[]; }): string; - paths(request: string): string[] | null; -} - -interface NodeExtensions { - '.js': (m: NodeModule, filename: string) => any; - '.json': (m: NodeModule, filename: string) => any; - '.node': (m: NodeModule, filename: string) => any; - [ext: string]: (m: NodeModule, filename: string) => any; -} - -declare var require: NodeRequire; - -interface NodeModule { - exports: any; - require: NodeRequireFunction; - id: string; - filename: string; - loaded: boolean; - /** @deprecated since 12.19.0 Please use `require.main` and `module.children` instead. */ - parent: NodeModule | null | undefined; - children: NodeModule[]; - /** - * @since 11.14.0 - * - * The directory name of the module. This is usually the same as the path.dirname() of the module.id. - */ - path: string; - paths: string[]; -} - -declare var module: NodeModule; - -// Same as module.exports -declare var exports: any; - -// Buffer class -type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; - -interface Buffer { - constructor: typeof Buffer; - readBigUInt64BE(offset?: number): bigint; - readBigUInt64LE(offset?: number): bigint; - readBigInt64BE(offset?: number): bigint; - readBigInt64LE(offset?: number): bigint; - writeBigInt64BE(value: bigint, offset?: number): number; - writeBigInt64LE(value: bigint, offset?: number): number; - writeBigUInt64BE(value: bigint, offset?: number): number; - writeBigUInt64LE(value: bigint, offset?: number): number; -} - -/** - * Raw data is stored in instances of the Buffer class. - * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. - * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - */ -declare class Buffer extends Uint8Array { - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. - */ - constructor(str: string, encoding?: BufferEncoding); - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). - */ - constructor(size: number); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - constructor(array: Uint8Array); - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}/{SharedArrayBuffer}. - * - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. - */ - constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - constructor(array: ReadonlyArray); - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. - */ - constructor(buffer: Buffer); - /** - * When passed a reference to the .buffer property of a TypedArray instance, - * the newly created Buffer will share the same allocated memory as the TypedArray. - * The optional {byteOffset} and {length} arguments specify a memory range - * within the {arrayBuffer} that will be shared by the Buffer. - * - * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer() - */ - static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param data data to create a new Buffer - */ - static from(data: ReadonlyArray): Buffer; - static from(data: Uint8Array): Buffer; - /** - * Creates a new buffer containing the coerced value of an object - * A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants. - * @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`. - */ - static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - */ - static from(str: string, encoding?: BufferEncoding): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param values to create a new Buffer - */ - static of(...items: number[]): Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - static isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - static isEncoding(encoding: string): encoding is BufferEncoding; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - static byteLength( - string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, - encoding?: BufferEncoding - ): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - static concat(list: ReadonlyArray, totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - static compare(buf1: Uint8Array, buf2: Uint8Array): number; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @param fill if specified, buffer will be initialized by calling buf.fill(fill). - * If parameter is omitted, buffer will be filled with zeros. - * @param encoding encoding used for call to buf.fill while initalizing - */ - static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafe(size: number): Buffer; - /** - * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafeSlow(size: number): Buffer; - /** - * This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified. - */ - static poolSize: number; - - write(string: string, encoding?: BufferEncoding): number; - write(string: string, offset: number, encoding?: BufferEncoding): number; - write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; - toString(encoding?: string, start?: number, end?: number): string; - toJSON(): { type: 'Buffer'; data: number[] }; - equals(otherBuffer: Uint8Array): boolean; - compare( - otherBuffer: Uint8Array, - targetStart?: number, - targetEnd?: number, - sourceStart?: number, - sourceEnd?: number - ): number; - copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - /** - * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices. - * - * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory. - * - * @param begin Where the new `Buffer` will start. Default: `0`. - * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`. - */ - slice(begin?: number, end?: number): Buffer; - /** - * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices. - * - * This method is compatible with `Uint8Array#subarray()`. - * - * @param begin Where the new `Buffer` will start. Default: `0`. - * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`. - */ - subarray(begin?: number, end?: number): Buffer; - writeUIntLE(value: number, offset: number, byteLength: number): number; - writeUIntBE(value: number, offset: number, byteLength: number): number; - writeIntLE(value: number, offset: number, byteLength: number): number; - writeIntBE(value: number, offset: number, byteLength: number): number; - readUIntLE(offset: number, byteLength: number): number; - readUIntBE(offset: number, byteLength: number): number; - readIntLE(offset: number, byteLength: number): number; - readIntBE(offset: number, byteLength: number): number; - readUInt8(offset: number): number; - readUInt16LE(offset: number): number; - readUInt16BE(offset: number): number; - readUInt32LE(offset: number): number; - readUInt32BE(offset: number): number; - readInt8(offset: number): number; - readInt16LE(offset: number): number; - readInt16BE(offset: number): number; - readInt32LE(offset: number): number; - readInt32BE(offset: number): number; - readFloatLE(offset: number): number; - readFloatBE(offset: number): number; - readDoubleLE(offset: number): number; - readDoubleBE(offset: number): number; - reverse(): this; - swap16(): Buffer; - swap32(): Buffer; - swap64(): Buffer; - writeUInt8(value: number, offset: number): number; - writeUInt16LE(value: number, offset: number): number; - writeUInt16BE(value: number, offset: number): number; - writeUInt32LE(value: number, offset: number): number; - writeUInt32BE(value: number, offset: number): number; - writeInt8(value: number, offset: number): number; - writeInt16LE(value: number, offset: number): number; - writeInt16BE(value: number, offset: number): number; - writeInt32LE(value: number, offset: number): number; - writeInt32BE(value: number, offset: number): number; - writeFloatLE(value: number, offset: number): number; - writeFloatBE(value: number, offset: number): number; - writeDoubleLE(value: number, offset: number): number; - writeDoubleBE(value: number, offset: number): number; - - fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; - - indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - entries(): IterableIterator<[number, number]>; - includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; - keys(): IterableIterator; - values(): IterableIterator; -} - -/*----------------------------------------------* -* * -* GLOBAL INTERFACES * -* * -*-----------------------------------------------*/ -declare namespace NodeJS { - interface InspectOptions { - /** - * If set to `true`, getters are going to be - * inspected as well. If set to `'get'` only getters without setter are going - * to be inspected. If set to `'set'` only getters having a corresponding - * setter are going to be inspected. This might cause side effects depending on - * the getter function. - * @default `false` - */ - getters?: 'get' | 'set' | boolean; - showHidden?: boolean; - /** - * @default 2 - */ - depth?: number | null; - colors?: boolean; - customInspect?: boolean; - showProxy?: boolean; - maxArrayLength?: number | null; - breakLength?: number; - /** - * Setting this to `false` causes each object key - * to be displayed on a new line. It will also add new lines to text that is - * longer than `breakLength`. If set to a number, the most `n` inner elements - * are united on a single line as long as all properties fit into - * `breakLength`. Short array elements are also grouped together. Note that no - * text will be reduced below 16 characters, no matter the `breakLength` size. - * For more information, see the example below. - * @default `true` - */ - compact?: boolean | number; - sorted?: boolean | ((a: string, b: string) => number); - } - - interface ConsoleConstructorOptions { - stdout: WritableStream; - stderr?: WritableStream; - ignoreErrors?: boolean; - colorMode?: boolean | 'auto'; - inspectOptions?: InspectOptions; - } - - interface ConsoleConstructor { - prototype: Console; - new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console; - new(options: ConsoleConstructorOptions): Console; - } - - interface CallSite { - /** - * Value of "this" - */ - getThis(): any; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ - getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ - getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | null; - - /** - * Current line number [if this function was defined in a script] - */ - getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ - isEval(): boolean; - - /** - * Is this call in native V8 code? - */ - isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; - } - - interface ErrnoException extends Error { - errno?: number; - code?: string; - path?: string; - syscall?: string; - stack?: string; - } - - class EventEmitter { - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - removeAllListeners(event?: string | symbol): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: string | symbol): Function[]; - rawListeners(event: string | symbol): Function[]; - emit(event: string | symbol, ...args: any[]): boolean; - listenerCount(type: string | symbol): number; - // Added in Node 6... - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - eventNames(): Array; - } - - interface ReadableStream extends EventEmitter { - readable: boolean; - read(size?: number): string | Buffer; - setEncoding(encoding: string): this; - pause(): this; - resume(): this; - isPaused(): boolean; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: WritableStream): this; - unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; - wrap(oldStream: ReadableStream): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableStream extends EventEmitter { - writable: boolean; - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; - write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean; - end(cb?: () => void): void; - end(data: string | Uint8Array, cb?: () => void): void; - end(str: string, encoding?: string, cb?: () => void): void; - } - - interface ReadWriteStream extends ReadableStream, WritableStream { } - - interface Domain extends EventEmitter { - run(fn: (...args: any[]) => T, ...args: any[]): T; - add(emitter: EventEmitter | Timer): void; - remove(emitter: EventEmitter | Timer): void; - bind(cb: T): T; - intercept(cb: T): T; - - addListener(event: string, listener: (...args: any[]) => void): this; - on(event: string, listener: (...args: any[]) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - removeListener(event: string, listener: (...args: any[]) => void): this; - removeAllListeners(event?: string): this; - } - - interface MemoryUsage { - rss: number; - heapTotal: number; - heapUsed: number; - external: number; - } - - interface CpuUsage { - user: number; - system: number; - } - - interface ProcessRelease { - name: string; - sourceUrl?: string; - headersUrl?: string; - libUrl?: string; - lts?: string; - } - - interface ProcessVersions { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - modules: string; - openssl: string; - } - - type Platform = 'aix' - | 'android' - | 'darwin' - | 'freebsd' - | 'linux' - | 'openbsd' - | 'sunos' - | 'win32' - | 'cygwin' - | 'netbsd'; - - type Signals = - "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | - "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | - "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | - "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO"; - - type MultipleResolveType = 'resolve' | 'reject'; - - type BeforeExitListener = (code: number) => void; - type DisconnectListener = () => void; - type ExitListener = (code: number) => void; - type RejectionHandledListener = (promise: Promise) => void; - type UncaughtExceptionListener = (error: Error) => void; - type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise) => void; - type WarningListener = (warning: Error) => void; - type MessageListener = (message: any, sendHandle: any) => void; - type SignalsListener = (signal: Signals) => void; - type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; - type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; - type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: any) => void; - - interface Socket extends ReadWriteStream { - isTTY?: true; - } - - interface ProcessEnv { - [key: string]: string | undefined; - } - - interface HRTime { - (time?: [number, number]): [number, number]; - bigint(): bigint; - } - - interface ProcessReport { - /** - * Directory where the report is written. - * working directory of the Node.js process. - * @default '' indicating that reports are written to the current - */ - directory: string; - - /** - * Filename where the report is written. - * The default value is the empty string. - * @default '' the output filename will be comprised of a timestamp, - * PID, and sequence number. - */ - filename: string; - - /** - * Returns a JSON-formatted diagnostic report for the running process. - * The report's JavaScript stack trace is taken from err, if present. - */ - getReport(err?: Error): string; - - /** - * If true, a diagnostic report is generated on fatal errors, - * such as out of memory errors or failed C++ assertions. - * @default false - */ - reportOnFatalError: boolean; - - /** - * If true, a diagnostic report is generated when the process - * receives the signal specified by process.report.signal. - * @defaul false - */ - reportOnSignal: boolean; - - /** - * If true, a diagnostic report is generated on uncaught exception. - * @default false - */ - reportOnUncaughtException: boolean; - - /** - * The signal used to trigger the creation of a diagnostic report. - * @default 'SIGUSR2' - */ - signal: Signals; - - /** - * Writes a diagnostic report to a file. If filename is not provided, the default filename - * includes the date, time, PID, and a sequence number. - * The report's JavaScript stack trace is taken from err, if present. - * - * @param fileName Name of the file where the report is written. - * This should be a relative path, that will be appended to the directory specified in - * `process.report.directory`, or the current working directory of the Node.js process, - * if unspecified. - * @param error A custom error used for reporting the JavaScript stack. - * @return Filename of the generated report. - */ - writeReport(fileName?: string): string; - writeReport(error?: Error): string; - writeReport(fileName?: string, err?: Error): string; - } - - interface ResourceUsage { - fsRead: number; - fsWrite: number; - involuntaryContextSwitches: number; - ipcReceived: number; - ipcSent: number; - majorPageFault: number; - maxRSS: number; - minorPageFault: number; - sharedMemorySize: number; - signalsCount: number; - swappedOut: number; - systemCPUTime: number; - unsharedDataSize: number; - unsharedStackSize: number; - userCPUTime: number; - voluntaryContextSwitches: number; - } - - interface Process extends EventEmitter { - /** - * Can also be a tty.WriteStream, not typed due to limitation.s - */ - stdout: WriteStream; - /** - * Can also be a tty.WriteStream, not typed due to limitation.s - */ - stderr: WriteStream; - stdin: ReadStream; - openStdin(): Socket; - argv: string[]; - argv0: string; - execArgv: string[]; - execPath: string; - abort(): never; - chdir(directory: string): void; - cwd(): string; - debugPort: number; - emitWarning(warning: string | Error, name?: string, ctor?: Function): void; - env: ProcessEnv; - exit(code?: number): never; - exitCode?: number; - getgid(): number; - setgid(id: number | string): void; - getuid(): number; - setuid(id: number | string): void; - geteuid(): number; - seteuid(id: number | string): void; - getegid(): number; - setegid(id: number | string): void; - getgroups(): number[]; - setgroups(groups: ReadonlyArray): void; - setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; - hasUncaughtExceptionCaptureCallback(): boolean; - version: string; - versions: ProcessVersions; - config: { - target_defaults: { - cflags: any[]; - default_configuration: string; - defines: string[]; - include_dirs: string[]; - libraries: string[]; - }; - variables: { - clang: number; - host_arch: string; - node_install_npm: boolean; - node_install_waf: boolean; - node_prefix: string; - node_shared_openssl: boolean; - node_shared_v8: boolean; - node_shared_zlib: boolean; - node_use_dtrace: boolean; - node_use_etw: boolean; - node_use_openssl: boolean; - target_arch: string; - v8_no_strict_aliasing: number; - v8_use_snapshot: boolean; - visibility: string; - }; - }; - kill(pid: number, signal?: string | number): true; - pid: number; - ppid: number; - title: string; - arch: string; - platform: Platform; - mainModule?: NodeModule; - memoryUsage(): MemoryUsage; - cpuUsage(previousValue?: CpuUsage): CpuUsage; - nextTick(callback: Function, ...args: any[]): void; - release: ProcessRelease; - features: { - inspector: boolean; - debug: boolean; - uv: boolean; - ipv6: boolean; - tls_alpn: boolean; - tls_sni: boolean; - tls_ocsp: boolean; - tls: boolean; - }; - /** - * @deprecated since v12.19.0 - Calling process.umask() with no argument causes - * the process-wide umask to be written twice. This introduces a race condition between threads, - * and is a potential security vulnerability. There is no safe, cross-platform alternative API. - */ - umask(): number; - /** - * Can only be set if not in worker thread. - */ - umask(mask: string | number): number; - uptime(): number; - hrtime: HRTime; - domain: Domain; - - // Worker - send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean; - disconnect(): void; - connected: boolean; - - /** - * The `process.allowedNodeEnvironmentFlags` property is a special, - * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][] - * environment variable. - */ - allowedNodeEnvironmentFlags: ReadonlySet; - - /** - * Only available with `--experimental-report` - */ - report?: ProcessReport; - - resourceUsage(): ResourceUsage; - - /** - * EventEmitter - * 1. beforeExit - * 2. disconnect - * 3. exit - * 4. message - * 5. rejectionHandled - * 6. uncaughtException - * 7. unhandledRejection - * 8. warning - * 9. message - * 10. - * 11. newListener/removeListener inherited from EventEmitter - */ - addListener(event: "beforeExit", listener: BeforeExitListener): this; - addListener(event: "disconnect", listener: DisconnectListener): this; - addListener(event: "exit", listener: ExitListener): this; - addListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - addListener(event: "warning", listener: WarningListener): this; - addListener(event: "message", listener: MessageListener): this; - addListener(event: Signals, listener: SignalsListener): this; - addListener(event: "newListener", listener: NewListenerListener): this; - addListener(event: "removeListener", listener: RemoveListenerListener): this; - addListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - emit(event: "beforeExit", code: number): boolean; - emit(event: "disconnect"): boolean; - emit(event: "exit", code: number): boolean; - emit(event: "rejectionHandled", promise: Promise): boolean; - emit(event: "uncaughtException", error: Error): boolean; - emit(event: "unhandledRejection", reason: any, promise: Promise): boolean; - emit(event: "warning", warning: Error): boolean; - emit(event: "message", message: any, sendHandle: any): this; - emit(event: Signals, signal: Signals): boolean; - emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this; - emit(event: "multipleResolves", listener: MultipleResolveListener): this; - - on(event: "beforeExit", listener: BeforeExitListener): this; - on(event: "disconnect", listener: DisconnectListener): this; - on(event: "exit", listener: ExitListener): this; - on(event: "rejectionHandled", listener: RejectionHandledListener): this; - on(event: "uncaughtException", listener: UncaughtExceptionListener): this; - on(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - on(event: "warning", listener: WarningListener): this; - on(event: "message", listener: MessageListener): this; - on(event: Signals, listener: SignalsListener): this; - on(event: "newListener", listener: NewListenerListener): this; - on(event: "removeListener", listener: RemoveListenerListener): this; - on(event: "multipleResolves", listener: MultipleResolveListener): this; - - once(event: "beforeExit", listener: BeforeExitListener): this; - once(event: "disconnect", listener: DisconnectListener): this; - once(event: "exit", listener: ExitListener): this; - once(event: "rejectionHandled", listener: RejectionHandledListener): this; - once(event: "uncaughtException", listener: UncaughtExceptionListener): this; - once(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - once(event: "warning", listener: WarningListener): this; - once(event: "message", listener: MessageListener): this; - once(event: Signals, listener: SignalsListener): this; - once(event: "newListener", listener: NewListenerListener): this; - once(event: "removeListener", listener: RemoveListenerListener): this; - once(event: "multipleResolves", listener: MultipleResolveListener): this; - - prependListener(event: "beforeExit", listener: BeforeExitListener): this; - prependListener(event: "disconnect", listener: DisconnectListener): this; - prependListener(event: "exit", listener: ExitListener): this; - prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependListener(event: "warning", listener: WarningListener): this; - prependListener(event: "message", listener: MessageListener): this; - prependListener(event: Signals, listener: SignalsListener): this; - prependListener(event: "newListener", listener: NewListenerListener): this; - prependListener(event: "removeListener", listener: RemoveListenerListener): this; - prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; - prependOnceListener(event: "disconnect", listener: DisconnectListener): this; - prependOnceListener(event: "exit", listener: ExitListener): this; - prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependOnceListener(event: "warning", listener: WarningListener): this; - prependOnceListener(event: "message", listener: MessageListener): this; - prependOnceListener(event: Signals, listener: SignalsListener): this; - prependOnceListener(event: "newListener", listener: NewListenerListener): this; - prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this; - prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - listeners(event: "beforeExit"): BeforeExitListener[]; - listeners(event: "disconnect"): DisconnectListener[]; - listeners(event: "exit"): ExitListener[]; - listeners(event: "rejectionHandled"): RejectionHandledListener[]; - listeners(event: "uncaughtException"): UncaughtExceptionListener[]; - listeners(event: "unhandledRejection"): UnhandledRejectionListener[]; - listeners(event: "warning"): WarningListener[]; - listeners(event: "message"): MessageListener[]; - listeners(event: Signals): SignalsListener[]; - listeners(event: "newListener"): NewListenerListener[]; - listeners(event: "removeListener"): RemoveListenerListener[]; - listeners(event: "multipleResolves"): MultipleResolveListener[]; - } - - interface Global { - Array: typeof Array; - ArrayBuffer: typeof ArrayBuffer; - Boolean: typeof Boolean; - Buffer: typeof Buffer; - DataView: typeof DataView; - Date: typeof Date; - Error: typeof Error; - EvalError: typeof EvalError; - Float32Array: typeof Float32Array; - Float64Array: typeof Float64Array; - Function: typeof Function; - GLOBAL: Global; - Infinity: typeof Infinity; - Int16Array: typeof Int16Array; - Int32Array: typeof Int32Array; - Int8Array: typeof Int8Array; - Intl: typeof Intl; - JSON: typeof JSON; - Map: MapConstructor; - Math: typeof Math; - NaN: typeof NaN; - Number: typeof Number; - Object: typeof Object; - Promise: Function; - RangeError: typeof RangeError; - ReferenceError: typeof ReferenceError; - RegExp: typeof RegExp; - Set: SetConstructor; - String: typeof String; - Symbol: Function; - SyntaxError: typeof SyntaxError; - TypeError: typeof TypeError; - URIError: typeof URIError; - Uint16Array: typeof Uint16Array; - Uint32Array: typeof Uint32Array; - Uint8Array: typeof Uint8Array; - Uint8ClampedArray: Function; - WeakMap: WeakMapConstructor; - WeakSet: WeakSetConstructor; - clearImmediate: (immediateId: Immediate) => void; - clearInterval: (intervalId: Timeout) => void; - clearTimeout: (timeoutId: Timeout) => void; - console: typeof console; - decodeURI: typeof decodeURI; - decodeURIComponent: typeof decodeURIComponent; - encodeURI: typeof encodeURI; - encodeURIComponent: typeof encodeURIComponent; - escape: (str: string) => string; - eval: typeof eval; - global: Global; - isFinite: typeof isFinite; - isNaN: typeof isNaN; - parseFloat: typeof parseFloat; - parseInt: typeof parseInt; - process: Process; - root: Global; - setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate; - setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; - setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; - queueMicrotask: typeof queueMicrotask; - undefined: typeof undefined; - unescape: (str: string) => string; - gc: () => void; - v8debug?: any; - } - - // compatibility with older typings - interface Timer { - hasRef(): boolean; - ref(): this; - refresh(): this; - unref(): this; - [Symbol.toPrimitive](): number; - } - - class Immediate { - hasRef(): boolean; - ref(): this; - unref(): this; - _onImmediate: Function; // to distinguish it from the Timeout class - } - - class Timeout implements Timer { - hasRef(): boolean; - ref(): this; - refresh(): this; - unref(): this; - [Symbol.toPrimitive](): number; - } - - class Module { - static runMain(): void; - static wrap(code: string): string; - - /** - * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead. - */ - static createRequireFromPath(path: string): NodeRequire; - static createRequire(path: string): NodeRequire; - static builtinModules: string[]; - - static Module: typeof Module; - - exports: any; - require: NodeRequireFunction; - id: string; - filename: string; - loaded: boolean; - /** @deprecated since 12.19.0 Please use `require.main` and `module.children` instead. */ - parent: Module | null | undefined; - children: Module[]; - /** - * @since 11.14.0 - * - * The directory name of the module. This is usually the same as the path.dirname() of the module.id. - */ - path: string; - paths: string[]; - - constructor(id: string, parent?: Module); - } - - interface Dict { - [key: string]: T | undefined; - } - - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float32Array - | Float64Array; - type ArrayBufferView = TypedArray | DataView; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/globals.global.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/globals.global.d.ts deleted file mode 100644 index d66acba6..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: NodeJS.Global & typeof globalThis; diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/http.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/http.d.ts deleted file mode 100644 index 7073827a..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/http.d.ts +++ /dev/null @@ -1,382 +0,0 @@ -declare module "http" { - import * as events from "events"; - import * as stream from "stream"; - import { URL } from "url"; - import { Socket, Server as NetServer } from "net"; - - // incoming headers will never contain number - interface IncomingHttpHeaders { - 'accept'?: string; - 'accept-language'?: string; - 'accept-patch'?: string; - 'accept-ranges'?: string; - 'access-control-allow-credentials'?: string; - 'access-control-allow-headers'?: string; - 'access-control-allow-methods'?: string; - 'access-control-allow-origin'?: string; - 'access-control-expose-headers'?: string; - 'access-control-max-age'?: string; - 'access-control-request-headers'?: string; - 'access-control-request-method'?: string; - 'age'?: string; - 'allow'?: string; - 'alt-svc'?: string; - 'authorization'?: string; - 'cache-control'?: string; - 'connection'?: string; - 'content-disposition'?: string; - 'content-encoding'?: string; - 'content-language'?: string; - 'content-length'?: string; - 'content-location'?: string; - 'content-range'?: string; - 'content-type'?: string; - 'cookie'?: string; - 'date'?: string; - 'expect'?: string; - 'expires'?: string; - 'forwarded'?: string; - 'from'?: string; - 'host'?: string; - 'if-match'?: string; - 'if-modified-since'?: string; - 'if-none-match'?: string; - 'if-unmodified-since'?: string; - 'last-modified'?: string; - 'location'?: string; - 'origin'?: string; - 'pragma'?: string; - 'proxy-authenticate'?: string; - 'proxy-authorization'?: string; - 'public-key-pins'?: string; - 'range'?: string; - 'referer'?: string; - 'retry-after'?: string; - 'set-cookie'?: string[]; - 'strict-transport-security'?: string; - 'tk'?: string; - 'trailer'?: string; - 'transfer-encoding'?: string; - 'upgrade'?: string; - 'user-agent'?: string; - 'vary'?: string; - 'via'?: string; - 'warning'?: string; - 'www-authenticate'?: string; - [header: string]: string | string[] | undefined; - } - - // outgoing headers allows numbers (as they are converted internally to strings) - interface OutgoingHttpHeaders { - [header: string]: number | string | string[] | undefined; - } - - interface ClientRequestArgs { - protocol?: string | null; - host?: string | null; - hostname?: string | null; - family?: number; - port?: number | string | null; - defaultPort?: number | string; - localAddress?: string; - socketPath?: string; - method?: string; - path?: string | null; - headers?: OutgoingHttpHeaders; - auth?: string | null; - agent?: Agent | boolean; - _defaultAgent?: Agent; - timeout?: number; - setHost?: boolean; - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 - createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket; - } - - interface ServerOptions { - IncomingMessage?: typeof IncomingMessage; - ServerResponse?: typeof ServerResponse; - } - - type RequestListener = (req: IncomingMessage, res: ServerResponse) => void; - - class Server extends NetServer { - constructor(requestListener?: RequestListener); - constructor(options: ServerOptions, requestListener?: RequestListener); - - setTimeout(msecs?: number, callback?: () => void): this; - setTimeout(callback: () => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @default 2000 - * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount} - */ - maxHeadersCount: number | null; - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP headers. - * @default 40000 - * {@link https://nodejs.org/api/http.html#http_server_headerstimeout} - */ - headersTimeout: number; - keepAliveTimeout: number; - } - - // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js - class OutgoingMessage extends stream.Writable { - upgrading: boolean; - chunkedEncoding: boolean; - shouldKeepAlive: boolean; - useChunkedEncodingByDefault: boolean; - sendDate: boolean; - finished: boolean; - headersSent: boolean; - connection: Socket; - - constructor(); - - setTimeout(msecs: number, callback?: () => void): this; - setHeader(name: string, value: number | string | ReadonlyArray): void; - getHeader(name: string): number | string | string[] | undefined; - getHeaders(): OutgoingHttpHeaders; - getHeaderNames(): string[]; - hasHeader(name: string): boolean; - removeHeader(name: string): void; - addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; - flushHeaders(): void; - } - - // https://github.com/nodejs/node/blob/master/lib/_http_server.js#L108-L256 - class ServerResponse extends OutgoingMessage { - statusCode: number; - statusMessage: string; - writableFinished: boolean; - - constructor(req: IncomingMessage); - - assignSocket(socket: Socket): void; - detachSocket(socket: Socket): void; - // https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53 - // no args in writeContinue callback - writeContinue(callback?: () => void): void; - writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeProcessing(): void; - } - - interface InformationEvent { - statusCode: number; - statusMessage: string; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - } - - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77 - class ClientRequest extends OutgoingMessage { - connection: Socket; - socket: Socket; - aborted: boolean; - host: string; - protocol: string; - - constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); - - readonly path: string; - abort(): void; - onSocket(socket: Socket): void; - setTimeout(timeout: number, callback?: () => void): this; - setNoDelay(noDelay?: boolean): void; - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - - addListener(event: 'abort', listener: () => void): this; - addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - addListener(event: 'continue', listener: () => void): this; - addListener(event: 'information', listener: (info: InformationEvent) => void): this; - addListener(event: 'response', listener: (response: IncomingMessage) => void): this; - addListener(event: 'socket', listener: (socket: Socket) => void): this; - addListener(event: 'timeout', listener: () => void): this; - addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - addListener(event: 'close', listener: () => void): this; - addListener(event: 'drain', listener: () => void): this; - addListener(event: 'error', listener: (err: Error) => void): this; - addListener(event: 'finish', listener: () => void): this; - addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - on(event: 'abort', listener: () => void): this; - on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: 'continue', listener: () => void): this; - on(event: 'information', listener: (info: InformationEvent) => void): this; - on(event: 'response', listener: (response: IncomingMessage) => void): this; - on(event: 'socket', listener: (socket: Socket) => void): this; - on(event: 'timeout', listener: () => void): this; - on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: 'close', listener: () => void): this; - on(event: 'drain', listener: () => void): this; - on(event: 'error', listener: (err: Error) => void): this; - on(event: 'finish', listener: () => void): this; - on(event: 'pipe', listener: (src: stream.Readable) => void): this; - on(event: 'unpipe', listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: 'abort', listener: () => void): this; - once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: 'continue', listener: () => void): this; - once(event: 'information', listener: (info: InformationEvent) => void): this; - once(event: 'response', listener: (response: IncomingMessage) => void): this; - once(event: 'socket', listener: (socket: Socket) => void): this; - once(event: 'timeout', listener: () => void): this; - once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: 'close', listener: () => void): this; - once(event: 'drain', listener: () => void): this; - once(event: 'error', listener: (err: Error) => void): this; - once(event: 'finish', listener: () => void): this; - once(event: 'pipe', listener: (src: stream.Readable) => void): this; - once(event: 'unpipe', listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: 'abort', listener: () => void): this; - prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependListener(event: 'continue', listener: () => void): this; - prependListener(event: 'information', listener: (info: InformationEvent) => void): this; - prependListener(event: 'response', listener: (response: IncomingMessage) => void): this; - prependListener(event: 'socket', listener: (socket: Socket) => void): this; - prependListener(event: 'timeout', listener: () => void): this; - prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependListener(event: 'close', listener: () => void): this; - prependListener(event: 'drain', listener: () => void): this; - prependListener(event: 'error', listener: (err: Error) => void): this; - prependListener(event: 'finish', listener: () => void): this; - prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: 'abort', listener: () => void): this; - prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependOnceListener(event: 'continue', listener: () => void): this; - prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this; - prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this; - prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this; - prependOnceListener(event: 'timeout', listener: () => void): this; - prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependOnceListener(event: 'close', listener: () => void): this; - prependOnceListener(event: 'drain', listener: () => void): this; - prependOnceListener(event: 'error', listener: (err: Error) => void): this; - prependOnceListener(event: 'finish', listener: () => void): this; - prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - class IncomingMessage extends stream.Readable { - constructor(socket: Socket); - - aborted: boolean; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - complete: boolean; - connection: Socket; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - trailers: { [key: string]: string | undefined }; - rawTrailers: string[]; - setTimeout(msecs: number, callback?: () => void): this; - /** - * Only valid for request obtained from http.Server. - */ - method?: string; - /** - * Only valid for request obtained from http.Server. - */ - url?: string; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusCode?: number; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusMessage?: string; - socket: Socket; - destroy(error?: Error): void; - } - - interface AgentOptions { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number; - /** - * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. - */ - maxTotalSockets?: number; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number; - /** - * Socket timeout in milliseconds. This will set the timeout after the socket is connected. - */ - timeout?: number; - } - - class Agent { - maxFreeSockets: number; - maxSockets: number; - maxTotalSockets: number; - readonly sockets: { - readonly [key: string]: Socket[]; - }; - readonly requests: { - readonly [key: string]: IncomingMessage[]; - }; - - constructor(opts?: AgentOptions); - - /** - * Destroy any sockets that are currently in use by the agent. - * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, - * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, - * sockets may hang open for quite a long time before the server terminates them. - */ - destroy(): void; - } - - const METHODS: string[]; - - const STATUS_CODES: { - [errorCode: number]: string | undefined; - [errorCode: string]: string | undefined; - }; - - function createServer(requestListener?: RequestListener): Server; - function createServer(options: ServerOptions, requestListener?: RequestListener): Server; - - // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, - // create interface RequestOptions would make the naming more clear to developers - interface RequestOptions extends ClientRequestArgs { } - function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - let globalAgent: Agent; - - /** - * Read-only property specifying the maximum allowed size of HTTP headers in bytes. - * Defaults to 8KB. Configurable using the [`--max-http-header-size`][] CLI option. - */ - const maxHeaderSize: number; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/http2.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/http2.d.ts deleted file mode 100644 index ea401b5f..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/http2.d.ts +++ /dev/null @@ -1,947 +0,0 @@ -declare module "http2" { - import * as events from "events"; - import * as fs from "fs"; - import * as net from "net"; - import * as stream from "stream"; - import * as tls from "tls"; - import * as url from "url"; - - import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from "http"; - export { OutgoingHttpHeaders } from "http"; - - export interface IncomingHttpStatusHeader { - ":status"?: number; - } - - export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { - ":path"?: string; - ":method"?: string; - ":authority"?: string; - ":scheme"?: string; - } - - // Http2Stream - - export interface StreamPriorityOptions { - exclusive?: boolean; - parent?: number; - weight?: number; - silent?: boolean; - } - - export interface StreamState { - localWindowSize?: number; - state?: number; - localClose?: number; - remoteClose?: number; - sumDependencyWeight?: number; - weight?: number; - } - - export interface ServerStreamResponseOptions { - endStream?: boolean; - waitForTrailers?: boolean; - } - - export interface StatOptions { - offset: number; - length: number; - } - - export interface ServerStreamFileResponseOptions { - statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; - waitForTrailers?: boolean; - offset?: number; - length?: number; - } - - export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { - onError?(err: NodeJS.ErrnoException): void; - } - - export interface Http2Stream extends stream.Duplex { - readonly aborted: boolean; - readonly bufferSize: number; - readonly closed: boolean; - readonly destroyed: boolean; - /** - * Set the true if the END_STREAM flag was set in the request or response HEADERS frame received, - * indicating that no additional data should be received and the readable side of the Http2Stream will be closed. - */ - readonly endAfterHeaders: boolean; - readonly id?: number; - readonly pending: boolean; - readonly rstCode: number; - readonly sentHeaders: OutgoingHttpHeaders; - readonly sentInfoHeaders?: OutgoingHttpHeaders[]; - readonly sentTrailers?: OutgoingHttpHeaders; - readonly session: Http2Session; - readonly state: StreamState; - - close(code?: number, callback?: () => void): void; - priority(options: StreamPriorityOptions): void; - setTimeout(msecs: number, callback?: () => void): void; - sendTrailers(headers: OutgoingHttpHeaders): void; - - addListener(event: "aborted", listener: () => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: "streamClosed", listener: (code: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "wantTrailers", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "aborted"): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "frameError", frameType: number, errorCode: number): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: "streamClosed", code: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "wantTrailers"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "aborted", listener: () => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: "streamClosed", listener: (code: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "wantTrailers", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "aborted", listener: () => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: "streamClosed", listener: (code: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "wantTrailers", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "aborted", listener: () => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "streamClosed", listener: (code: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "wantTrailers", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "aborted", listener: () => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "wantTrailers", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ClientHttp2Stream extends Http2Stream { - addListener(event: "continue", listener: () => {}): this; - addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "continue"): boolean; - emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "continue", listener: () => {}): this; - on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "continue", listener: () => {}): this; - once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "continue", listener: () => {}): this; - prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "continue", listener: () => {}): this; - prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ServerHttp2Stream extends Http2Stream { - readonly headersSent: boolean; - readonly pushAllowed: boolean; - additionalHeaders(headers: OutgoingHttpHeaders): void; - pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; - pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; - respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; - respondWithFD(fd: number | fs.promises.FileHandle, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; - respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; - } - - // Http2Session - - export interface Settings { - headerTableSize?: number; - enablePush?: boolean; - initialWindowSize?: number; - maxFrameSize?: number; - maxConcurrentStreams?: number; - maxHeaderListSize?: number; - enableConnectProtocol?: boolean; - } - - export interface ClientSessionRequestOptions { - endStream?: boolean; - exclusive?: boolean; - parent?: number; - weight?: number; - waitForTrailers?: boolean; - } - - export interface SessionState { - effectiveLocalWindowSize?: number; - effectiveRecvDataLength?: number; - nextStreamID?: number; - localWindowSize?: number; - lastProcStreamID?: number; - remoteWindowSize?: number; - outboundQueueSize?: number; - deflateDynamicTableSize?: number; - inflateDynamicTableSize?: number; - } - - export interface Http2Session extends events.EventEmitter { - readonly alpnProtocol?: string; - readonly closed: boolean; - readonly connecting: boolean; - readonly destroyed: boolean; - readonly encrypted?: boolean; - readonly localSettings: Settings; - readonly originSet?: string[]; - readonly pendingSettingsAck: boolean; - readonly remoteSettings: Settings; - readonly socket: net.Socket | tls.TLSSocket; - readonly state: SessionState; - readonly type: number; - - close(callback?: () => void): void; - destroy(error?: Error, code?: number): void; - goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; - ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ping(payload: NodeJS.ArrayBufferView, callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ref(): void; - setTimeout(msecs: number, callback?: () => void): void; - settings(settings: Settings): void; - unref(): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - addListener(event: "localSettings", listener: (settings: Settings) => void): this; - addListener(event: "ping", listener: () => void): this; - addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; - emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; - emit(event: "localSettings", settings: Settings): boolean; - emit(event: "ping"): boolean; - emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - on(event: "localSettings", listener: (settings: Settings) => void): this; - on(event: "ping", listener: () => void): this; - on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - once(event: "localSettings", listener: (settings: Settings) => void): this; - once(event: "ping", listener: () => void): this; - once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - prependListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependListener(event: "ping", listener: () => void): this; - prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "ping", listener: () => void): this; - prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ClientHttp2Session extends Http2Session { - request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; - - addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - addListener(event: "origin", listener: (origins: string[]) => void): this; - addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; - emit(event: "origin", origins: ReadonlyArray): boolean; - emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - on(event: "origin", listener: (origins: string[]) => void): this; - on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - once(event: "origin", listener: (origins: string[]) => void): this; - once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependListener(event: "origin", listener: (origins: string[]) => void): this; - prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependOnceListener(event: "origin", listener: (origins: string[]) => void): this; - prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface AlternativeServiceOptions { - origin: number | string | url.URL; - } - - export interface ServerHttp2Session extends Http2Session { - readonly server: Http2Server | Http2SecureServer; - - altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; - origin(...args: Array): void; - - addListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - // Http2Server - - export interface SessionOptions { - maxDeflateDynamicTableSize?: number; - maxSessionMemory?: number; - maxHeaderListPairs?: number; - maxOutstandingPings?: number; - maxSendHeaderBlockLength?: number; - paddingStrategy?: number; - peerMaxConcurrentStreams?: number; - settings?: Settings; - - selectPadding?(frameLen: number, maxFrameLen: number): number; - createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex; - } - - export interface ClientSessionOptions extends SessionOptions { - maxReservedRemoteStreams?: number; - createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex; - } - - export interface ServerSessionOptions extends SessionOptions { - Http1IncomingMessage?: typeof IncomingMessage; - Http1ServerResponse?: typeof ServerResponse; - Http2ServerRequest?: typeof Http2ServerRequest; - Http2ServerResponse?: typeof Http2ServerResponse; - } - - export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { } - export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { } - - export interface ServerOptions extends ServerSessionOptions { } - - export interface SecureServerOptions extends SecureServerSessionOptions { - allowHTTP1?: boolean; - origins?: string[]; - } - - export interface Http2Server extends net.Server { - addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - setTimeout(msec?: number, callback?: () => void): this; - } - - export interface Http2SecureServer extends tls.Server { - addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - setTimeout(msec?: number, callback?: () => void): this; - } - - export class Http2ServerRequest extends stream.Readable { - constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray); - - readonly aborted: boolean; - readonly authority: string; - readonly headers: IncomingHttpHeaders; - readonly httpVersion: string; - readonly method: string; - readonly rawHeaders: string[]; - readonly rawTrailers: string[]; - readonly scheme: string; - readonly socket: net.Socket | tls.TLSSocket; - readonly stream: ServerHttp2Stream; - readonly trailers: IncomingHttpHeaders; - readonly url: string; - - setTimeout(msecs: number, callback?: () => void): void; - read(size?: number): Buffer | string | null; - - addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "aborted", hadError: boolean, code: number): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "end"): boolean; - emit(event: "readable"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export class Http2ServerResponse extends stream.Stream { - constructor(stream: ServerHttp2Stream); - - readonly connection: net.Socket | tls.TLSSocket; - readonly finished: boolean; - readonly headersSent: boolean; - readonly socket: net.Socket | tls.TLSSocket; - readonly stream: ServerHttp2Stream; - sendDate: boolean; - statusCode: number; - statusMessage: ''; - addTrailers(trailers: OutgoingHttpHeaders): void; - end(callback?: () => void): void; - end(data: string | Uint8Array, callback?: () => void): void; - end(data: string | Uint8Array, encoding: string, callback?: () => void): void; - getHeader(name: string): string; - getHeaderNames(): string[]; - getHeaders(): OutgoingHttpHeaders; - hasHeader(name: string): boolean; - removeHeader(name: string): void; - setHeader(name: string, value: number | string | ReadonlyArray): void; - setTimeout(msecs: number, callback?: () => void): void; - write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; - write(chunk: string | Uint8Array, encoding: string, callback?: (err: Error) => void): boolean; - writeContinue(): void; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; - createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - // Public API - - export namespace constants { - const NGHTTP2_SESSION_SERVER: number; - const NGHTTP2_SESSION_CLIENT: number; - const NGHTTP2_STREAM_STATE_IDLE: number; - const NGHTTP2_STREAM_STATE_OPEN: number; - const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; - const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; - const NGHTTP2_STREAM_STATE_CLOSED: number; - const NGHTTP2_NO_ERROR: number; - const NGHTTP2_PROTOCOL_ERROR: number; - const NGHTTP2_INTERNAL_ERROR: number; - const NGHTTP2_FLOW_CONTROL_ERROR: number; - const NGHTTP2_SETTINGS_TIMEOUT: number; - const NGHTTP2_STREAM_CLOSED: number; - const NGHTTP2_FRAME_SIZE_ERROR: number; - const NGHTTP2_REFUSED_STREAM: number; - const NGHTTP2_CANCEL: number; - const NGHTTP2_COMPRESSION_ERROR: number; - const NGHTTP2_CONNECT_ERROR: number; - const NGHTTP2_ENHANCE_YOUR_CALM: number; - const NGHTTP2_INADEQUATE_SECURITY: number; - const NGHTTP2_HTTP_1_1_REQUIRED: number; - const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; - const NGHTTP2_FLAG_NONE: number; - const NGHTTP2_FLAG_END_STREAM: number; - const NGHTTP2_FLAG_END_HEADERS: number; - const NGHTTP2_FLAG_ACK: number; - const NGHTTP2_FLAG_PADDED: number; - const NGHTTP2_FLAG_PRIORITY: number; - const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; - const DEFAULT_SETTINGS_ENABLE_PUSH: number; - const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; - const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; - const MAX_MAX_FRAME_SIZE: number; - const MIN_MAX_FRAME_SIZE: number; - const MAX_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_DEFAULT_WEIGHT: number; - const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; - const NGHTTP2_SETTINGS_ENABLE_PUSH: number; - const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; - const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; - const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; - const PADDING_STRATEGY_NONE: number; - const PADDING_STRATEGY_MAX: number; - const PADDING_STRATEGY_CALLBACK: number; - const HTTP2_HEADER_STATUS: string; - const HTTP2_HEADER_METHOD: string; - const HTTP2_HEADER_AUTHORITY: string; - const HTTP2_HEADER_SCHEME: string; - const HTTP2_HEADER_PATH: string; - const HTTP2_HEADER_ACCEPT_CHARSET: string; - const HTTP2_HEADER_ACCEPT_ENCODING: string; - const HTTP2_HEADER_ACCEPT_LANGUAGE: string; - const HTTP2_HEADER_ACCEPT_RANGES: string; - const HTTP2_HEADER_ACCEPT: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; - const HTTP2_HEADER_AGE: string; - const HTTP2_HEADER_ALLOW: string; - const HTTP2_HEADER_AUTHORIZATION: string; - const HTTP2_HEADER_CACHE_CONTROL: string; - const HTTP2_HEADER_CONNECTION: string; - const HTTP2_HEADER_CONTENT_DISPOSITION: string; - const HTTP2_HEADER_CONTENT_ENCODING: string; - const HTTP2_HEADER_CONTENT_LANGUAGE: string; - const HTTP2_HEADER_CONTENT_LENGTH: string; - const HTTP2_HEADER_CONTENT_LOCATION: string; - const HTTP2_HEADER_CONTENT_MD5: string; - const HTTP2_HEADER_CONTENT_RANGE: string; - const HTTP2_HEADER_CONTENT_TYPE: string; - const HTTP2_HEADER_COOKIE: string; - const HTTP2_HEADER_DATE: string; - const HTTP2_HEADER_ETAG: string; - const HTTP2_HEADER_EXPECT: string; - const HTTP2_HEADER_EXPIRES: string; - const HTTP2_HEADER_FROM: string; - const HTTP2_HEADER_HOST: string; - const HTTP2_HEADER_IF_MATCH: string; - const HTTP2_HEADER_IF_MODIFIED_SINCE: string; - const HTTP2_HEADER_IF_NONE_MATCH: string; - const HTTP2_HEADER_IF_RANGE: string; - const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; - const HTTP2_HEADER_LAST_MODIFIED: string; - const HTTP2_HEADER_LINK: string; - const HTTP2_HEADER_LOCATION: string; - const HTTP2_HEADER_MAX_FORWARDS: string; - const HTTP2_HEADER_PREFER: string; - const HTTP2_HEADER_PROXY_AUTHENTICATE: string; - const HTTP2_HEADER_PROXY_AUTHORIZATION: string; - const HTTP2_HEADER_RANGE: string; - const HTTP2_HEADER_REFERER: string; - const HTTP2_HEADER_REFRESH: string; - const HTTP2_HEADER_RETRY_AFTER: string; - const HTTP2_HEADER_SERVER: string; - const HTTP2_HEADER_SET_COOKIE: string; - const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; - const HTTP2_HEADER_TRANSFER_ENCODING: string; - const HTTP2_HEADER_TE: string; - const HTTP2_HEADER_UPGRADE: string; - const HTTP2_HEADER_USER_AGENT: string; - const HTTP2_HEADER_VARY: string; - const HTTP2_HEADER_VIA: string; - const HTTP2_HEADER_WWW_AUTHENTICATE: string; - const HTTP2_HEADER_HTTP2_SETTINGS: string; - const HTTP2_HEADER_KEEP_ALIVE: string; - const HTTP2_HEADER_PROXY_CONNECTION: string; - const HTTP2_METHOD_ACL: string; - const HTTP2_METHOD_BASELINE_CONTROL: string; - const HTTP2_METHOD_BIND: string; - const HTTP2_METHOD_CHECKIN: string; - const HTTP2_METHOD_CHECKOUT: string; - const HTTP2_METHOD_CONNECT: string; - const HTTP2_METHOD_COPY: string; - const HTTP2_METHOD_DELETE: string; - const HTTP2_METHOD_GET: string; - const HTTP2_METHOD_HEAD: string; - const HTTP2_METHOD_LABEL: string; - const HTTP2_METHOD_LINK: string; - const HTTP2_METHOD_LOCK: string; - const HTTP2_METHOD_MERGE: string; - const HTTP2_METHOD_MKACTIVITY: string; - const HTTP2_METHOD_MKCALENDAR: string; - const HTTP2_METHOD_MKCOL: string; - const HTTP2_METHOD_MKREDIRECTREF: string; - const HTTP2_METHOD_MKWORKSPACE: string; - const HTTP2_METHOD_MOVE: string; - const HTTP2_METHOD_OPTIONS: string; - const HTTP2_METHOD_ORDERPATCH: string; - const HTTP2_METHOD_PATCH: string; - const HTTP2_METHOD_POST: string; - const HTTP2_METHOD_PRI: string; - const HTTP2_METHOD_PROPFIND: string; - const HTTP2_METHOD_PROPPATCH: string; - const HTTP2_METHOD_PUT: string; - const HTTP2_METHOD_REBIND: string; - const HTTP2_METHOD_REPORT: string; - const HTTP2_METHOD_SEARCH: string; - const HTTP2_METHOD_TRACE: string; - const HTTP2_METHOD_UNBIND: string; - const HTTP2_METHOD_UNCHECKOUT: string; - const HTTP2_METHOD_UNLINK: string; - const HTTP2_METHOD_UNLOCK: string; - const HTTP2_METHOD_UPDATE: string; - const HTTP2_METHOD_UPDATEREDIRECTREF: string; - const HTTP2_METHOD_VERSION_CONTROL: string; - const HTTP_STATUS_CONTINUE: number; - const HTTP_STATUS_SWITCHING_PROTOCOLS: number; - const HTTP_STATUS_PROCESSING: number; - const HTTP_STATUS_OK: number; - const HTTP_STATUS_CREATED: number; - const HTTP_STATUS_ACCEPTED: number; - const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; - const HTTP_STATUS_NO_CONTENT: number; - const HTTP_STATUS_RESET_CONTENT: number; - const HTTP_STATUS_PARTIAL_CONTENT: number; - const HTTP_STATUS_MULTI_STATUS: number; - const HTTP_STATUS_ALREADY_REPORTED: number; - const HTTP_STATUS_IM_USED: number; - const HTTP_STATUS_MULTIPLE_CHOICES: number; - const HTTP_STATUS_MOVED_PERMANENTLY: number; - const HTTP_STATUS_FOUND: number; - const HTTP_STATUS_SEE_OTHER: number; - const HTTP_STATUS_NOT_MODIFIED: number; - const HTTP_STATUS_USE_PROXY: number; - const HTTP_STATUS_TEMPORARY_REDIRECT: number; - const HTTP_STATUS_PERMANENT_REDIRECT: number; - const HTTP_STATUS_BAD_REQUEST: number; - const HTTP_STATUS_UNAUTHORIZED: number; - const HTTP_STATUS_PAYMENT_REQUIRED: number; - const HTTP_STATUS_FORBIDDEN: number; - const HTTP_STATUS_NOT_FOUND: number; - const HTTP_STATUS_METHOD_NOT_ALLOWED: number; - const HTTP_STATUS_NOT_ACCEPTABLE: number; - const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; - const HTTP_STATUS_REQUEST_TIMEOUT: number; - const HTTP_STATUS_CONFLICT: number; - const HTTP_STATUS_GONE: number; - const HTTP_STATUS_LENGTH_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_FAILED: number; - const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; - const HTTP_STATUS_URI_TOO_LONG: number; - const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; - const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; - const HTTP_STATUS_EXPECTATION_FAILED: number; - const HTTP_STATUS_TEAPOT: number; - const HTTP_STATUS_MISDIRECTED_REQUEST: number; - const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; - const HTTP_STATUS_LOCKED: number; - const HTTP_STATUS_FAILED_DEPENDENCY: number; - const HTTP_STATUS_UNORDERED_COLLECTION: number; - const HTTP_STATUS_UPGRADE_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_REQUIRED: number; - const HTTP_STATUS_TOO_MANY_REQUESTS: number; - const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; - const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; - const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; - const HTTP_STATUS_NOT_IMPLEMENTED: number; - const HTTP_STATUS_BAD_GATEWAY: number; - const HTTP_STATUS_SERVICE_UNAVAILABLE: number; - const HTTP_STATUS_GATEWAY_TIMEOUT: number; - const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; - const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; - const HTTP_STATUS_INSUFFICIENT_STORAGE: number; - const HTTP_STATUS_LOOP_DETECTED: number; - const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; - const HTTP_STATUS_NOT_EXTENDED: number; - const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; - } - - export function getDefaultSettings(): Settings; - export function getPackedSettings(settings: Settings): Buffer; - export function getUnpackedSettings(buf: Uint8Array): Settings; - - export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; - export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; - - export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; - export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; - - export function connect(authority: string | url.URL, listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session; - export function connect( - authority: string | url.URL, - options?: ClientSessionOptions | SecureClientSessionOptions, - listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void - ): ClientHttp2Session; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/https.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/https.d.ts deleted file mode 100644 index 6f33dbd0..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/https.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -declare module "https" { - import * as tls from "tls"; - import * as events from "events"; - import * as http from "http"; - import { URL } from "url"; - - type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; - - type RequestOptions = http.RequestOptions & tls.SecureContextOptions & { - rejectUnauthorized?: boolean; // Defaults to true - servername?: string; // SNI TLS Extension - }; - - interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { - rejectUnauthorized?: boolean; - maxCachedSessions?: number; - } - - class Agent extends http.Agent { - constructor(options?: AgentOptions); - options: AgentOptions; - } - - class Server extends tls.Server { - constructor(requestListener?: http.RequestListener); - constructor(options: ServerOptions, requestListener?: http.RequestListener); - - setTimeout(callback: () => void): this; - setTimeout(msecs?: number, callback?: () => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @default 2000 - * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount} - */ - maxHeadersCount: number | null; - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP headers. - * @default 40000 - * {@link https://nodejs.org/api/http.html#http_server_headerstimeout} - */ - headersTimeout: number; - keepAliveTimeout: number; - } - - function createServer(requestListener?: http.RequestListener): Server; - function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server; - function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - let globalAgent: Agent; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/index.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/index.d.ts deleted file mode 100644 index a3f591e0..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Type definitions for non-npm package Node.js 12.19 -// Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped -// Alberto Schiabel -// Alexander T. -// Alvis HT Tang -// Andrew Makarov -// Benjamin Toueg -// Bruno Scheufler -// Chigozirim C. -// David Junger -// Deividas Bakanas -// Eugene Y. Q. Shen -// Flarna -// Hannes Magnusson -// Hoàng Văn Khải -// Huw -// Kelvin Jin -// Klaus Meinhardt -// Lishude -// Mariusz Wiktorczyk -// Mohsen Azimi -// Nicolas Even -// Nikita Galkin -// Parambir Singh -// Sebastian Silbermann -// Simon Schick -// Thomas den Hollander -// Wilco Bakker -// wwwy3y3 -// Zane Hannan AU -// Samuel Ainsworth -// Kyle Uehlein -// Jordi Oliveras Rovira -// Thanik Bhongbhibhat -// Marcin Kopacz -// Trivikram Kamat -// Minh Son Nguyen -// Junxiao Shi -// Ilia Baryshnikov -// ExE Boss -// Jason Kwok -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// NOTE: These definitions support NodeJS and TypeScript 3.7. -// This isn't strictly needed since 3.7 has the assert module, but this way we're consistent. -// Typically type modificatons should be made in base.d.ts instead of here - -/// diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/inspector.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/inspector.d.ts deleted file mode 100644 index b14aed2b..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/inspector.d.ts +++ /dev/null @@ -1,3034 +0,0 @@ -// tslint:disable-next-line:dt-header -// Type definitions for inspector - -// These definitions are auto-generated. -// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330 -// for more information. - -// tslint:disable:max-line-length - -/** - * The inspector module provides an API for interacting with the V8 inspector. - */ -declare module "inspector" { - import { EventEmitter } from 'events'; - - interface InspectorNotification { - method: string; - params: T; - } - - namespace Schema { - /** - * Description of the protocol domain. - */ - interface Domain { - /** - * Domain name. - */ - name: string; - /** - * Domain version. - */ - version: string; - } - - interface GetDomainsReturnType { - /** - * List of supported domains. - */ - domains: Domain[]; - } - } - - namespace Runtime { - /** - * Unique script identifier. - */ - type ScriptId = string; - - /** - * Unique object identifier. - */ - type RemoteObjectId = string; - - /** - * Primitive value which cannot be JSON-stringified. - */ - type UnserializableValue = string; - - /** - * Mirror object referencing original JavaScript object. - */ - interface RemoteObject { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - /** - * Object class (constructor) name. Specified for object type values only. - */ - className?: string; - /** - * Remote object value in case of primitive values or JSON values (if it was requested). - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified does not have value, but gets this property. - */ - unserializableValue?: UnserializableValue; - /** - * String representation of the object. - */ - description?: string; - /** - * Unique object identifier (for non-primitive values). - */ - objectId?: RemoteObjectId; - /** - * Preview containing abbreviated property values. Specified for object type values only. - * @experimental - */ - preview?: ObjectPreview; - /** - * @experimental - */ - customPreview?: CustomPreview; - } - - /** - * @experimental - */ - interface CustomPreview { - header: string; - hasBody: boolean; - formatterObjectId: RemoteObjectId; - bindRemoteObjectFunctionId: RemoteObjectId; - configObjectId?: RemoteObjectId; - } - - /** - * Object containing abbreviated remote object value. - * @experimental - */ - interface ObjectPreview { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - /** - * String representation of the object. - */ - description?: string; - /** - * True iff some of the properties or entries of the original object did not fit. - */ - overflow: boolean; - /** - * List of the properties. - */ - properties: PropertyPreview[]; - /** - * List of the entries. Specified for map and set subtype values only. - */ - entries?: EntryPreview[]; - } - - /** - * @experimental - */ - interface PropertyPreview { - /** - * Property name. - */ - name: string; - /** - * Object type. Accessor means that the property itself is an accessor property. - */ - type: string; - /** - * User-friendly property value string. - */ - value?: string; - /** - * Nested value preview. - */ - valuePreview?: ObjectPreview; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - } - - /** - * @experimental - */ - interface EntryPreview { - /** - * Preview of the key. Specified for map-like collection entries. - */ - key?: ObjectPreview; - /** - * Preview of the value. - */ - value: ObjectPreview; - } - - /** - * Object property descriptor. - */ - interface PropertyDescriptor { - /** - * Property name or symbol description. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject; - /** - * True if the value associated with the property may be changed (data descriptors only). - */ - writable?: boolean; - /** - * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). - */ - get?: RemoteObject; - /** - * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). - */ - set?: RemoteObject; - /** - * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. - */ - configurable: boolean; - /** - * True if this property shows up during enumeration of the properties on the corresponding object. - */ - enumerable: boolean; - /** - * True if the result was thrown during the evaluation. - */ - wasThrown?: boolean; - /** - * True if the property is owned for the object. - */ - isOwn?: boolean; - /** - * Property symbol object, if the property is of the symbol type. - */ - symbol?: RemoteObject; - } - - /** - * Object internal property descriptor. This property isn't normally visible in JavaScript code. - */ - interface InternalPropertyDescriptor { - /** - * Conventional property name. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject; - } - - /** - * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. - */ - interface CallArgument { - /** - * Primitive value or serializable javascript object. - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified. - */ - unserializableValue?: UnserializableValue; - /** - * Remote object handle. - */ - objectId?: RemoteObjectId; - } - - /** - * Id of an execution context. - */ - type ExecutionContextId = number; - - /** - * Description of an isolated world. - */ - interface ExecutionContextDescription { - /** - * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. - */ - id: ExecutionContextId; - /** - * Execution context origin. - */ - origin: string; - /** - * Human readable name describing given context. - */ - name: string; - /** - * Embedder-specific auxiliary data. - */ - auxData?: {}; - } - - /** - * Detailed information about exception (or error) that was thrown during script compilation or execution. - */ - interface ExceptionDetails { - /** - * Exception id. - */ - exceptionId: number; - /** - * Exception text, which should be used together with exception object when available. - */ - text: string; - /** - * Line number of the exception location (0-based). - */ - lineNumber: number; - /** - * Column number of the exception location (0-based). - */ - columnNumber: number; - /** - * Script ID of the exception location. - */ - scriptId?: ScriptId; - /** - * URL of the exception location, to be used when the script was not reported. - */ - url?: string; - /** - * JavaScript stack trace if available. - */ - stackTrace?: StackTrace; - /** - * Exception object if available. - */ - exception?: RemoteObject; - /** - * Identifier of the context where exception happened. - */ - executionContextId?: ExecutionContextId; - } - - /** - * Number of milliseconds since epoch. - */ - type Timestamp = number; - - /** - * Stack entry for runtime errors and assertions. - */ - interface CallFrame { - /** - * JavaScript function name. - */ - functionName: string; - /** - * JavaScript script id. - */ - scriptId: ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * JavaScript script line number (0-based). - */ - lineNumber: number; - /** - * JavaScript script column number (0-based). - */ - columnNumber: number; - } - - /** - * Call frames for assertions or error messages. - */ - interface StackTrace { - /** - * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. - */ - description?: string; - /** - * JavaScript function name. - */ - callFrames: CallFrame[]; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - */ - parent?: StackTrace; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - * @experimental - */ - parentId?: StackTraceId; - } - - /** - * Unique identifier of current debugger. - * @experimental - */ - type UniqueDebuggerId = string; - - /** - * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. - * @experimental - */ - interface StackTraceId { - id: string; - debuggerId?: UniqueDebuggerId; - } - - interface EvaluateParameterType { - /** - * Expression to evaluate. - */ - expression: string; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - contextId?: ExecutionContextId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - } - - interface AwaitPromiseParameterType { - /** - * Identifier of the promise. - */ - promiseObjectId: RemoteObjectId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean; - } - - interface CallFunctionOnParameterType { - /** - * Declaration of the function to call. - */ - functionDeclaration: string; - /** - * Identifier of the object to call function on. Either objectId or executionContextId should be specified. - */ - objectId?: RemoteObjectId; - /** - * Call arguments. All call arguments must belong to the same JavaScript world as the target object. - */ - arguments?: CallArgument[]; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - /** - * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. - */ - executionContextId?: ExecutionContextId; - /** - * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. - */ - objectGroup?: string; - } - - interface GetPropertiesParameterType { - /** - * Identifier of the object to return properties for. - */ - objectId: RemoteObjectId; - /** - * If true, returns properties belonging only to the element itself, not to its prototype chain. - */ - ownProperties?: boolean; - /** - * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - * @experimental - */ - accessorPropertiesOnly?: boolean; - /** - * Whether preview should be generated for the results. - * @experimental - */ - generatePreview?: boolean; - } - - interface ReleaseObjectParameterType { - /** - * Identifier of the object to release. - */ - objectId: RemoteObjectId; - } - - interface ReleaseObjectGroupParameterType { - /** - * Symbolic object group name. - */ - objectGroup: string; - } - - interface SetCustomObjectFormatterEnabledParameterType { - enabled: boolean; - } - - interface CompileScriptParameterType { - /** - * Expression to compile. - */ - expression: string; - /** - * Source url to be set for the script. - */ - sourceURL: string; - /** - * Specifies whether the compiled script should be persisted. - */ - persistScript: boolean; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId; - } - - interface RunScriptParameterType { - /** - * Id of the script to run. - */ - scriptId: ScriptId; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - } - - interface QueryObjectsParameterType { - /** - * Identifier of the prototype to return objects for. - */ - prototypeObjectId: RemoteObjectId; - } - - interface GlobalLexicalScopeNamesParameterType { - /** - * Specifies in which execution context to lookup global scope variables. - */ - executionContextId?: ExecutionContextId; - } - - interface EvaluateReturnType { - /** - * Evaluation result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface AwaitPromiseReturnType { - /** - * Promise result. Will contain rejected value if promise was rejected. - */ - result: RemoteObject; - /** - * Exception details if stack strace is available. - */ - exceptionDetails?: ExceptionDetails; - } - - interface CallFunctionOnReturnType { - /** - * Call result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface GetPropertiesReturnType { - /** - * Object properties. - */ - result: PropertyDescriptor[]; - /** - * Internal object properties (only of the element itself). - */ - internalProperties?: InternalPropertyDescriptor[]; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface CompileScriptReturnType { - /** - * Id of the script. - */ - scriptId?: ScriptId; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface RunScriptReturnType { - /** - * Run result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface QueryObjectsReturnType { - /** - * Array with objects. - */ - objects: RemoteObject; - } - - interface GlobalLexicalScopeNamesReturnType { - names: string[]; - } - - interface ExecutionContextCreatedEventDataType { - /** - * A newly created execution context. - */ - context: ExecutionContextDescription; - } - - interface ExecutionContextDestroyedEventDataType { - /** - * Id of the destroyed context - */ - executionContextId: ExecutionContextId; - } - - interface ExceptionThrownEventDataType { - /** - * Timestamp of the exception. - */ - timestamp: Timestamp; - exceptionDetails: ExceptionDetails; - } - - interface ExceptionRevokedEventDataType { - /** - * Reason describing why exception was revoked. - */ - reason: string; - /** - * The id of revoked exception, as reported in exceptionThrown. - */ - exceptionId: number; - } - - interface ConsoleAPICalledEventDataType { - /** - * Type of the call. - */ - type: string; - /** - * Call arguments. - */ - args: RemoteObject[]; - /** - * Identifier of the context where the call was made. - */ - executionContextId: ExecutionContextId; - /** - * Call timestamp. - */ - timestamp: Timestamp; - /** - * Stack trace captured when the call was made. - */ - stackTrace?: StackTrace; - /** - * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. - * @experimental - */ - context?: string; - } - - interface InspectRequestedEventDataType { - object: RemoteObject; - hints: {}; - } - } - - namespace Debugger { - /** - * Breakpoint identifier. - */ - type BreakpointId = string; - - /** - * Call frame identifier. - */ - type CallFrameId = string; - - /** - * Location in the source code. - */ - interface Location { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - } - - /** - * Location in the source code. - * @experimental - */ - interface ScriptPosition { - lineNumber: number; - columnNumber: number; - } - - /** - * JavaScript call frame. Array of call frames form the call stack. - */ - interface CallFrame { - /** - * Call frame identifier. This identifier is only valid while the virtual machine is paused. - */ - callFrameId: CallFrameId; - /** - * Name of the JavaScript function called on this call frame. - */ - functionName: string; - /** - * Location in the source code. - */ - functionLocation?: Location; - /** - * Location in the source code. - */ - location: Location; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Scope chain for this call frame. - */ - scopeChain: Scope[]; - /** - * this object for this call frame. - */ - this: Runtime.RemoteObject; - /** - * The value being returned, if the function is at return point. - */ - returnValue?: Runtime.RemoteObject; - } - - /** - * Scope description. - */ - interface Scope { - /** - * Scope type. - */ - type: string; - /** - * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. - */ - object: Runtime.RemoteObject; - name?: string; - /** - * Location in the source code where scope starts - */ - startLocation?: Location; - /** - * Location in the source code where scope ends - */ - endLocation?: Location; - } - - /** - * Search match for resource. - */ - interface SearchMatch { - /** - * Line number in resource content. - */ - lineNumber: number; - /** - * Line with match content. - */ - lineContent: string; - } - - interface BreakLocation { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - type?: string; - } - - interface SetBreakpointsActiveParameterType { - /** - * New value for breakpoints active state. - */ - active: boolean; - } - - interface SetSkipAllPausesParameterType { - /** - * New value for skip pauses state. - */ - skip: boolean; - } - - interface SetBreakpointByUrlParameterType { - /** - * Line number to set breakpoint at. - */ - lineNumber: number; - /** - * URL of the resources to set breakpoint on. - */ - url?: string; - /** - * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. - */ - urlRegex?: string; - /** - * Script hash of the resources to set breakpoint on. - */ - scriptHash?: string; - /** - * Offset in the line to set breakpoint at. - */ - columnNumber?: number; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - interface SetBreakpointParameterType { - /** - * Location to set breakpoint in. - */ - location: Location; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - interface RemoveBreakpointParameterType { - breakpointId: BreakpointId; - } - - interface GetPossibleBreakpointsParameterType { - /** - * Start of range to search possible breakpoint locations in. - */ - start: Location; - /** - * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. - */ - end?: Location; - /** - * Only consider locations which are in the same (non-nested) function as start. - */ - restrictToFunction?: boolean; - } - - interface ContinueToLocationParameterType { - /** - * Location to continue to. - */ - location: Location; - targetCallFrames?: string; - } - - interface PauseOnAsyncCallParameterType { - /** - * Debugger will pause when async call with given stack trace is started. - */ - parentStackTraceId: Runtime.StackTraceId; - } - - interface StepIntoParameterType { - /** - * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. - * @experimental - */ - breakOnAsyncCall?: boolean; - } - - interface GetStackTraceParameterType { - stackTraceId: Runtime.StackTraceId; - } - - interface SearchInContentParameterType { - /** - * Id of the script to search in. - */ - scriptId: Runtime.ScriptId; - /** - * String to search for. - */ - query: string; - /** - * If true, search is case sensitive. - */ - caseSensitive?: boolean; - /** - * If true, treats string parameter as regex. - */ - isRegex?: boolean; - } - - interface SetScriptSourceParameterType { - /** - * Id of the script to edit. - */ - scriptId: Runtime.ScriptId; - /** - * New content of the script. - */ - scriptSource: string; - /** - * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. - */ - dryRun?: boolean; - } - - interface RestartFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - } - - interface GetScriptSourceParameterType { - /** - * Id of the script to get source for. - */ - scriptId: Runtime.ScriptId; - } - - interface SetPauseOnExceptionsParameterType { - /** - * Pause on exceptions mode. - */ - state: string; - } - - interface EvaluateOnCallFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - /** - * Expression to evaluate. - */ - expression: string; - /** - * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). - */ - objectGroup?: string; - /** - * Specifies whether command line API should be available to the evaluated expression, defaults to false. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether to throw an exception if side effect cannot be ruled out during evaluation. - */ - throwOnSideEffect?: boolean; - } - - interface SetVariableValueParameterType { - /** - * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. - */ - scopeNumber: number; - /** - * Variable name. - */ - variableName: string; - /** - * New variable value. - */ - newValue: Runtime.CallArgument; - /** - * Id of callframe that holds variable. - */ - callFrameId: CallFrameId; - } - - interface SetReturnValueParameterType { - /** - * New return value. - */ - newValue: Runtime.CallArgument; - } - - interface SetAsyncCallStackDepthParameterType { - /** - * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). - */ - maxDepth: number; - } - - interface SetBlackboxPatternsParameterType { - /** - * Array of regexps that will be used to check script url for blackbox state. - */ - patterns: string[]; - } - - interface SetBlackboxedRangesParameterType { - /** - * Id of the script. - */ - scriptId: Runtime.ScriptId; - positions: ScriptPosition[]; - } - - interface EnableReturnType { - /** - * Unique identifier of the debugger. - * @experimental - */ - debuggerId: Runtime.UniqueDebuggerId; - } - - interface SetBreakpointByUrlReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * List of the locations this breakpoint resolved into upon addition. - */ - locations: Location[]; - } - - interface SetBreakpointReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * Location this breakpoint resolved into. - */ - actualLocation: Location; - } - - interface GetPossibleBreakpointsReturnType { - /** - * List of the possible breakpoint locations. - */ - locations: BreakLocation[]; - } - - interface GetStackTraceReturnType { - stackTrace: Runtime.StackTrace; - } - - interface SearchInContentReturnType { - /** - * List of search matches. - */ - result: SearchMatch[]; - } - - interface SetScriptSourceReturnType { - /** - * New stack trace in case editing has happened while VM was stopped. - */ - callFrames?: CallFrame[]; - /** - * Whether current call stack was modified after applying the changes. - */ - stackChanged?: boolean; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - /** - * Exception details if any. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - interface RestartFrameReturnType { - /** - * New stack trace. - */ - callFrames: CallFrame[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - } - - interface GetScriptSourceReturnType { - /** - * Script source. - */ - scriptSource: string; - } - - interface EvaluateOnCallFrameReturnType { - /** - * Object wrapper for the evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - interface ScriptParsedEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * True, if this script is generated as a result of the live edit operation. - * @experimental - */ - isLiveEdit?: boolean; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean; - /** - * This script length. - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - interface ScriptFailedToParseEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean; - /** - * This script length. - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - interface BreakpointResolvedEventDataType { - /** - * Breakpoint unique identifier. - */ - breakpointId: BreakpointId; - /** - * Actual breakpoint location. - */ - location: Location; - } - - interface PausedEventDataType { - /** - * Call stack the virtual machine stopped on. - */ - callFrames: CallFrame[]; - /** - * Pause reason. - */ - reason: string; - /** - * Object containing break-specific auxiliary properties. - */ - data?: {}; - /** - * Hit breakpoints IDs - */ - hitBreakpoints?: string[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - /** - * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. - * @experimental - */ - asyncCallStackTraceId?: Runtime.StackTraceId; - } - } - - namespace Console { - /** - * Console message. - */ - interface ConsoleMessage { - /** - * Message source. - */ - source: string; - /** - * Message severity. - */ - level: string; - /** - * Message text. - */ - text: string; - /** - * URL of the message origin. - */ - url?: string; - /** - * Line number in the resource that generated this message (1-based). - */ - line?: number; - /** - * Column number in the resource that generated this message (1-based). - */ - column?: number; - } - - interface MessageAddedEventDataType { - /** - * Console message that has been added. - */ - message: ConsoleMessage; - } - } - - namespace Profiler { - /** - * Profile node. Holds callsite information, execution statistics and child nodes. - */ - interface ProfileNode { - /** - * Unique id of the node. - */ - id: number; - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Number of samples where this node was on top of the call stack. - */ - hitCount?: number; - /** - * Child node ids. - */ - children?: number[]; - /** - * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. - */ - deoptReason?: string; - /** - * An array of source position ticks. - */ - positionTicks?: PositionTickInfo[]; - } - - /** - * Profile. - */ - interface Profile { - /** - * The list of profile nodes. First item is the root node. - */ - nodes: ProfileNode[]; - /** - * Profiling start timestamp in microseconds. - */ - startTime: number; - /** - * Profiling end timestamp in microseconds. - */ - endTime: number; - /** - * Ids of samples top nodes. - */ - samples?: number[]; - /** - * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. - */ - timeDeltas?: number[]; - } - - /** - * Specifies a number of samples attributed to a certain source position. - */ - interface PositionTickInfo { - /** - * Source line number (1-based). - */ - line: number; - /** - * Number of samples attributed to the source line. - */ - ticks: number; - } - - /** - * Coverage data for a source range. - */ - interface CoverageRange { - /** - * JavaScript script source offset for the range start. - */ - startOffset: number; - /** - * JavaScript script source offset for the range end. - */ - endOffset: number; - /** - * Collected execution count of the source range. - */ - count: number; - } - - /** - * Coverage data for a JavaScript function. - */ - interface FunctionCoverage { - /** - * JavaScript function name. - */ - functionName: string; - /** - * Source ranges inside the function with coverage data. - */ - ranges: CoverageRange[]; - /** - * Whether coverage data for this function has block granularity. - */ - isBlockCoverage: boolean; - } - - /** - * Coverage data for a JavaScript script. - */ - interface ScriptCoverage { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Functions contained in the script that has coverage data. - */ - functions: FunctionCoverage[]; - } - - /** - * Describes a type collected during runtime. - * @experimental - */ - interface TypeObject { - /** - * Name of a type collected with type profiling. - */ - name: string; - } - - /** - * Source offset and types for a parameter or return value. - * @experimental - */ - interface TypeProfileEntry { - /** - * Source offset of the parameter or end of function for return values. - */ - offset: number; - /** - * The types for this parameter or return value. - */ - types: TypeObject[]; - } - - /** - * Type profile data collected during runtime for a JavaScript script. - * @experimental - */ - interface ScriptTypeProfile { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Type profile entries for parameters and return values of the functions in the script. - */ - entries: TypeProfileEntry[]; - } - - interface SetSamplingIntervalParameterType { - /** - * New sampling interval in microseconds. - */ - interval: number; - } - - interface StartPreciseCoverageParameterType { - /** - * Collect accurate call counts beyond simple 'covered' or 'not covered'. - */ - callCount?: boolean; - /** - * Collect block-based coverage. - */ - detailed?: boolean; - } - - interface StopReturnType { - /** - * Recorded profile. - */ - profile: Profile; - } - - interface TakePreciseCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - - interface GetBestEffortCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - - interface TakeTypeProfileReturnType { - /** - * Type profile for all scripts since startTypeProfile() was turned on. - */ - result: ScriptTypeProfile[]; - } - - interface ConsoleProfileStartedEventDataType { - id: string; - /** - * Location of console.profile(). - */ - location: Debugger.Location; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - - interface ConsoleProfileFinishedEventDataType { - id: string; - /** - * Location of console.profileEnd(). - */ - location: Debugger.Location; - profile: Profile; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - } - - namespace HeapProfiler { - /** - * Heap snapshot object id. - */ - type HeapSnapshotObjectId = string; - - /** - * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - */ - interface SamplingHeapProfileNode { - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Allocations size in bytes for the node excluding children. - */ - selfSize: number; - /** - * Child nodes. - */ - children: SamplingHeapProfileNode[]; - } - - /** - * Profile. - */ - interface SamplingHeapProfile { - head: SamplingHeapProfileNode; - } - - interface StartTrackingHeapObjectsParameterType { - trackAllocations?: boolean; - } - - interface StopTrackingHeapObjectsParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. - */ - reportProgress?: boolean; - } - - interface TakeHeapSnapshotParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - */ - reportProgress?: boolean; - } - - interface GetObjectByHeapObjectIdParameterType { - objectId: HeapSnapshotObjectId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - } - - interface AddInspectedHeapObjectParameterType { - /** - * Heap snapshot object id to be accessible by means of $x command line API. - */ - heapObjectId: HeapSnapshotObjectId; - } - - interface GetHeapObjectIdParameterType { - /** - * Identifier of the object to get heap object id for. - */ - objectId: Runtime.RemoteObjectId; - } - - interface StartSamplingParameterType { - /** - * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. - */ - samplingInterval?: number; - } - - interface GetObjectByHeapObjectIdReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - } - - interface GetHeapObjectIdReturnType { - /** - * Id of the heap snapshot object corresponding to the passed remote object id. - */ - heapSnapshotObjectId: HeapSnapshotObjectId; - } - - interface StopSamplingReturnType { - /** - * Recorded sampling heap profile. - */ - profile: SamplingHeapProfile; - } - - interface GetSamplingProfileReturnType { - /** - * Return the sampling profile being collected. - */ - profile: SamplingHeapProfile; - } - - interface AddHeapSnapshotChunkEventDataType { - chunk: string; - } - - interface ReportHeapSnapshotProgressEventDataType { - done: number; - total: number; - finished?: boolean; - } - - interface LastSeenObjectIdEventDataType { - lastSeenObjectId: number; - timestamp: number; - } - - interface HeapStatsUpdateEventDataType { - /** - * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. - */ - statsUpdate: number[]; - } - } - - namespace NodeTracing { - interface TraceConfig { - /** - * Controls how the trace buffer stores data. - */ - recordMode?: string; - /** - * Included category filters. - */ - includedCategories: string[]; - } - - interface StartParameterType { - traceConfig: TraceConfig; - } - - interface GetCategoriesReturnType { - /** - * A list of supported tracing categories. - */ - categories: string[]; - } - - interface DataCollectedEventDataType { - value: Array<{}>; - } - } - - namespace NodeWorker { - type WorkerID = string; - - /** - * Unique identifier of attached debugging session. - */ - type SessionID = string; - - interface WorkerInfo { - workerId: WorkerID; - type: string; - title: string; - url: string; - } - - interface SendMessageToWorkerParameterType { - message: string; - /** - * Identifier of the session. - */ - sessionId: SessionID; - } - - interface EnableParameterType { - /** - * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - * message to run them. - */ - waitForDebuggerOnStart: boolean; - } - - interface DetachParameterType { - sessionId: SessionID; - } - - interface AttachedToWorkerEventDataType { - /** - * Identifier assigned to the session used to send/receive messages. - */ - sessionId: SessionID; - workerInfo: WorkerInfo; - waitingForDebugger: boolean; - } - - interface DetachedFromWorkerEventDataType { - /** - * Detached session identifier. - */ - sessionId: SessionID; - } - - interface ReceivedMessageFromWorkerEventDataType { - /** - * Identifier of a session which sends a message. - */ - sessionId: SessionID; - message: string; - } - } - - namespace NodeRuntime { - interface NotifyWhenWaitingForDisconnectParameterType { - enabled: boolean; - } - } - - /** - * The inspector.Session is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications. - */ - class Session extends EventEmitter { - /** - * Create a new instance of the inspector.Session class. - * The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend. - */ - constructor(); - - /** - * Connects a session to the inspector back-end. - * An exception will be thrown if there is already a connected session established either - * through the API or by a front-end connected to the Inspector WebSocket port. - */ - connect(): void; - - /** - * Immediately close the session. All pending message callbacks will be called with an error. - * session.connect() will need to be called to be able to send messages again. - * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. - */ - disconnect(): void; - - /** - * Posts a message to the inspector back-end. callback will be notified when a response is received. - * callback is a function that accepts two optional arguments - error and message-specific result. - */ - post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void; - post(method: string, callback?: (err: Error | null, params?: {}) => void): void; - - /** - * Returns supported domains. - */ - post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; - - /** - * Evaluates expression on global object. - */ - post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - post(method: "Runtime.evaluate", callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - - /** - * Add handler to promise with given promise object id. - */ - post(method: "Runtime.awaitPromise", params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - post(method: "Runtime.awaitPromise", callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - - /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.callFunctionOn", params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - post(method: "Runtime.callFunctionOn", callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - - /** - * Returns properties of a given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.getProperties", params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - post(method: "Runtime.getProperties", callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - - /** - * Releases remote object with given id. - */ - post(method: "Runtime.releaseObject", params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObject", callback?: (err: Error | null) => void): void; - - /** - * Releases all remote objects that belong to a given group. - */ - post(method: "Runtime.releaseObjectGroup", params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObjectGroup", callback?: (err: Error | null) => void): void; - - /** - * Tells inspected instance to run if it was waiting for debugger to attach. - */ - post(method: "Runtime.runIfWaitingForDebugger", callback?: (err: Error | null) => void): void; - - /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. - */ - post(method: "Runtime.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables reporting of execution contexts creation. - */ - post(method: "Runtime.disable", callback?: (err: Error | null) => void): void; - - /** - * Discards collected exceptions and console API calls. - */ - post(method: "Runtime.discardConsoleEntries", callback?: (err: Error | null) => void): void; - - /** - * @experimental - */ - post(method: "Runtime.setCustomObjectFormatterEnabled", params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.setCustomObjectFormatterEnabled", callback?: (err: Error | null) => void): void; - - /** - * Compiles expression. - */ - post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - post(method: "Runtime.compileScript", callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - - /** - * Runs script with given id in a given context. - */ - post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - - post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - - /** - * Returns all let, const and class variables from global scope. - */ - post( - method: "Runtime.globalLexicalScopeNames", - params?: Runtime.GlobalLexicalScopeNamesParameterType, - callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void - ): void; - post(method: "Runtime.globalLexicalScopeNames", callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; - - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: "Debugger.enable", callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; - - /** - * Disables debugger for given page. - */ - post(method: "Debugger.disable", callback?: (err: Error | null) => void): void; - - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBreakpointsActive", callback?: (err: Error | null) => void): void; - - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setSkipAllPauses", callback?: (err: Error | null) => void): void; - - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - post(method: "Debugger.setBreakpointByUrl", callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - post(method: "Debugger.setBreakpoint", callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - - /** - * Removes JavaScript breakpoint. - */ - post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.removeBreakpoint", callback?: (err: Error | null) => void): void; - - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. - */ - post( - method: "Debugger.getPossibleBreakpoints", - params?: Debugger.GetPossibleBreakpointsParameterType, - callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void - ): void; - post(method: "Debugger.getPossibleBreakpoints", callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - - /** - * Continues execution until specific location is reached. - */ - post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.continueToLocation", callback?: (err: Error | null) => void): void; - - /** - * @experimental - */ - post(method: "Debugger.pauseOnAsyncCall", params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.pauseOnAsyncCall", callback?: (err: Error | null) => void): void; - - /** - * Steps over the statement. - */ - post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void; - - /** - * Steps into the function call. - */ - post(method: "Debugger.stepInto", params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.stepInto", callback?: (err: Error | null) => void): void; - - /** - * Steps out of the function call. - */ - post(method: "Debugger.stepOut", callback?: (err: Error | null) => void): void; - - /** - * Stops on the next JavaScript statement. - */ - post(method: "Debugger.pause", callback?: (err: Error | null) => void): void; - - /** - * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: "Debugger.scheduleStepIntoAsync", callback?: (err: Error | null) => void): void; - - /** - * Resumes JavaScript execution. - */ - post(method: "Debugger.resume", callback?: (err: Error | null) => void): void; - - /** - * Returns stack trace with given stackTraceId. - * @experimental - */ - post(method: "Debugger.getStackTrace", params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - post(method: "Debugger.getStackTrace", callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - - /** - * Searches for given string in script content. - */ - post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - post(method: "Debugger.searchInContent", callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - - /** - * Edits JavaScript source live. - */ - post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - post(method: "Debugger.setScriptSource", callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - - /** - * Restarts particular call frame from the beginning. - */ - post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - post(method: "Debugger.restartFrame", callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - - /** - * Returns source for the script with given id. - */ - post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - post(method: "Debugger.getScriptSource", callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setPauseOnExceptions", callback?: (err: Error | null) => void): void; - - /** - * Evaluates expression on a given call frame. - */ - post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - post(method: "Debugger.evaluateOnCallFrame", callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setVariableValue", callback?: (err: Error | null) => void): void; - - /** - * Changes return value in top frame. Available only at return break position. - * @experimental - */ - post(method: "Debugger.setReturnValue", params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setReturnValue", callback?: (err: Error | null) => void): void; - - /** - * Enables or disables async call stacks tracking. - */ - post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setAsyncCallStackDepth", callback?: (err: Error | null) => void): void; - - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxPatterns", callback?: (err: Error | null) => void): void; - - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxedRanges", callback?: (err: Error | null) => void): void; - - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: "Console.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: "Console.disable", callback?: (err: Error | null) => void): void; - - /** - * Does nothing. - */ - post(method: "Console.clearMessages", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.disable", callback?: (err: Error | null) => void): void; - - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.setSamplingInterval", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.start", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.stop", callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; - - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - */ - post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.startPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - */ - post(method: "Profiler.stopPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - */ - post(method: "Profiler.takePreciseCoverage", callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; - - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - */ - post(method: "Profiler.getBestEffortCoverage", callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; - - /** - * Enable type profile. - * @experimental - */ - post(method: "Profiler.startTypeProfile", callback?: (err: Error | null) => void): void; - - /** - * Disable type profile. Disabling releases type profile data collected so far. - * @experimental - */ - post(method: "Profiler.stopTypeProfile", callback?: (err: Error | null) => void): void; - - /** - * Collect type profile. - * @experimental - */ - post(method: "Profiler.takeTypeProfile", callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; - - post(method: "HeapProfiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.disable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.stopTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.collectGarbage", callback?: (err: Error | null) => void): void; - - post( - method: "HeapProfiler.getObjectByHeapObjectId", - params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, - callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void - ): void; - post(method: "HeapProfiler.getObjectByHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.addInspectedHeapObject", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: "HeapProfiler.getHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - - post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startSampling", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; - - post(method: "HeapProfiler.getSamplingProfile", callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; - - /** - * Gets supported tracing categories. - */ - post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; - - /** - * Start trace events collection. - */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void; - - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void; - - /** - * Sends protocol message over session with given id. - */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void; - - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void; - - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void; - - /** - * Detached from the worker with given sessionId. - */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void; - - /** - * Enable the `NodeRuntime.waitingForDisconnect`. - */ - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", callback?: (err: Error | null) => void): void; - - // Events - - addListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - addListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - addListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - addListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - addListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - addListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - addListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "inspectorNotification", message: InspectorNotification<{}>): boolean; - emit(event: "Runtime.executionContextCreated", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextsCleared"): boolean; - emit(event: "Runtime.exceptionThrown", message: InspectorNotification): boolean; - emit(event: "Runtime.exceptionRevoked", message: InspectorNotification): boolean; - emit(event: "Runtime.consoleAPICalled", message: InspectorNotification): boolean; - emit(event: "Runtime.inspectRequested", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptParsed", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification): boolean; - emit(event: "Debugger.breakpointResolved", message: InspectorNotification): boolean; - emit(event: "Debugger.paused", message: InspectorNotification): boolean; - emit(event: "Debugger.resumed"): boolean; - emit(event: "Console.messageAdded", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.addHeapSnapshotChunk", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.resetProfiles"): boolean; - emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; - emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; - emit(event: "NodeTracing.tracingComplete"): boolean; - emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeRuntime.waitingForDisconnect"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - on(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - on(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - on(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - on(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - on(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - on(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.resetProfiles", listener: () => void): this; - on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - on(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - once(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - once(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - once(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - once(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - once(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - once(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.resetProfiles", listener: () => void): this; - once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - once(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - prependListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependOnceListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependOnceListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependOnceListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - prependOnceListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependOnceListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependOnceListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - } - - // Top Level API - - /** - * Activate inspector on host and port. Equivalent to node --inspect=[[host:]port], but can be done programatically after node has started. - * If wait is true, will block until a client has connected to the inspect port and flow control has been passed to the debugger client. - * @param port Port to listen on for inspector connections. Optional, defaults to what was specified on the CLI. - * @param host Host to listen on for inspector connections. Optional, defaults to what was specified on the CLI. - * @param wait Block until a client has connected. Optional, defaults to false. - */ - function open(port?: number, host?: string, wait?: boolean): void; - - /** - * Deactivate the inspector. Blocks until there are no active connections. - */ - function close(): void; - - /** - * Return the URL of the active inspector, or `undefined` if there is none. - */ - function url(): string | undefined; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/module.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/module.d.ts deleted file mode 100644 index f512be7e..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/module.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "module" { - export = NodeJS.Module; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/net.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/net.d.ts deleted file mode 100644 index 1e4f9718..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/net.d.ts +++ /dev/null @@ -1,268 +0,0 @@ -declare module "net" { - import * as stream from "stream"; - import * as events from "events"; - import * as dns from "dns"; - - type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; - - interface AddressInfo { - address: string; - family: string; - port: number; - } - - interface SocketConstructorOpts { - fd?: number; - allowHalfOpen?: boolean; - readable?: boolean; - writable?: boolean; - } - - interface OnReadOpts { - buffer: Uint8Array | (() => Uint8Array); - /** - * This function is called for every chunk of incoming data. - * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer. - * Return false from this function to implicitly pause() the socket. - */ - callback(bytesWritten: number, buf: Uint8Array): boolean; - } - - interface ConnectOpts { - /** - * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket. - * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will - * still be emitted as normal and methods like pause() and resume() will also behave as expected. - */ - onread?: OnReadOpts; - } - - interface TcpSocketConnectOpts extends ConnectOpts { - port: number; - host?: string; - localAddress?: string; - localPort?: number; - hints?: number; - family?: number; - lookup?: LookupFunction; - } - - interface IpcSocketConnectOpts extends ConnectOpts { - path: string; - } - - type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; - - class Socket extends stream.Duplex { - constructor(options?: SocketConstructorOpts); - - // Extended base methods - write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; - write(str: Uint8Array | string, encoding?: string, cb?: (err?: Error) => void): boolean; - - connect(options: SocketConnectOpts, connectionListener?: () => void): this; - connect(port: number, host: string, connectionListener?: () => void): this; - connect(port: number, connectionListener?: () => void): this; - connect(path: string, connectionListener?: () => void): this; - - setEncoding(encoding?: string): this; - pause(): this; - resume(): this; - setTimeout(timeout: number, callback?: () => void): this; - setNoDelay(noDelay?: boolean): this; - setKeepAlive(enable?: boolean, initialDelay?: number): this; - address(): AddressInfo | string; - unref(): void; - ref(): void; - - readonly bufferSize: number; - readonly bytesRead: number; - readonly bytesWritten: number; - readonly connecting: boolean; - readonly destroyed: boolean; - readonly localAddress: string; - readonly localPort: number; - readonly remoteAddress?: string; - readonly remoteFamily?: string; - readonly remotePort?: number; - - // Extended base methods - end(cb?: () => void): void; - end(buffer: Uint8Array | string, cb?: () => void): void; - end(str: Uint8Array | string, encoding?: string, cb?: () => void): void; - - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. data - * 4. drain - * 5. end - * 6. error - * 7. lookup - * 8. timeout - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (had_error: boolean) => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "data", listener: (data: Buffer) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - addListener(event: "timeout", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", had_error: boolean): boolean; - emit(event: "connect"): boolean; - emit(event: "data", data: Buffer): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean; - emit(event: "timeout"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (had_error: boolean) => void): this; - on(event: "connect", listener: () => void): this; - on(event: "data", listener: (data: Buffer) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - on(event: "timeout", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (had_error: boolean) => void): this; - once(event: "connect", listener: () => void): this; - once(event: "data", listener: (data: Buffer) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - once(event: "timeout", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (had_error: boolean) => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "data", listener: (data: Buffer) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - prependListener(event: "timeout", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (had_error: boolean) => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "data", listener: (data: Buffer) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - } - - interface ListenOptions { - port?: number; - host?: string; - backlog?: number; - path?: string; - exclusive?: boolean; - readableAll?: boolean; - writableAll?: boolean; - /** - * @default false - */ - ipv6Only?: boolean; - } - - // https://github.com/nodejs/node/blob/master/lib/net.js - class Server extends events.EventEmitter { - constructor(connectionListener?: (socket: Socket) => void); - constructor(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void); - - listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, hostname?: string, listeningListener?: () => void): this; - listen(port?: number, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, listeningListener?: () => void): this; - listen(path: string, backlog?: number, listeningListener?: () => void): this; - listen(path: string, listeningListener?: () => void): this; - listen(options: ListenOptions, listeningListener?: () => void): this; - listen(handle: any, backlog?: number, listeningListener?: () => void): this; - listen(handle: any, listeningListener?: () => void): this; - close(callback?: (err?: Error) => void): this; - address(): AddressInfo | string | null; - getConnections(cb: (error: Error | null, count: number) => void): void; - ref(): this; - unref(): this; - maxConnections: number; - connections: number; - listening: boolean; - - /** - * events.EventEmitter - * 1. close - * 2. connection - * 3. error - * 4. listening - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - } - - interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { - timeout?: number; - } - - interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { - timeout?: number; - } - - type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; - - function createServer(connectionListener?: (socket: Socket) => void): Server; - function createServer(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void): Server; - function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; - function connect(port: number, host?: string, connectionListener?: () => void): Socket; - function connect(path: string, connectionListener?: () => void): Socket; - function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; - function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; - function createConnection(path: string, connectionListener?: () => void): Socket; - function isIP(input: string): number; - function isIPv4(input: string): boolean; - function isIPv6(input: string): boolean; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/os.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/os.d.ts deleted file mode 100644 index 37c45a9f..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/os.d.ts +++ /dev/null @@ -1,263 +0,0 @@ -declare module "os" { - interface CpuInfo { - model: string; - speed: number; - times: { - user: number; - nice: number; - sys: number; - idle: number; - irq: number; - }; - } - - interface NetworkInterfaceBase { - address: string; - netmask: string; - mac: string; - internal: boolean; - cidr: string | null; - } - - interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { - family: "IPv4"; - } - - interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { - family: "IPv6"; - scopeid: number; - } - - interface UserInfo { - username: T; - uid: number; - gid: number; - shell: T; - homedir: T; - } - - type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; - - function hostname(): string; - function loadavg(): number[]; - function uptime(): number; - function freemem(): number; - function totalmem(): number; - function cpus(): CpuInfo[]; - function type(): string; - function release(): string; - function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] }; - function homedir(): string; - function userInfo(options: { encoding: 'buffer' }): UserInfo; - function userInfo(options?: { encoding: string }): UserInfo; - const constants: { - UV_UDP_REUSEADDR: number; - // signals: { [key in NodeJS.Signals]: number; }; @todo: change after migration to typescript 2.1 - signals: { - SIGHUP: number; - SIGINT: number; - SIGQUIT: number; - SIGILL: number; - SIGTRAP: number; - SIGABRT: number; - SIGIOT: number; - SIGBUS: number; - SIGFPE: number; - SIGKILL: number; - SIGUSR1: number; - SIGSEGV: number; - SIGUSR2: number; - SIGPIPE: number; - SIGALRM: number; - SIGTERM: number; - SIGCHLD: number; - SIGSTKFLT: number; - SIGCONT: number; - SIGSTOP: number; - SIGTSTP: number; - SIGBREAK: number; - SIGTTIN: number; - SIGTTOU: number; - SIGURG: number; - SIGXCPU: number; - SIGXFSZ: number; - SIGVTALRM: number; - SIGPROF: number; - SIGWINCH: number; - SIGIO: number; - SIGPOLL: number; - SIGLOST: number; - SIGPWR: number; - SIGINFO: number; - SIGSYS: number; - SIGUNUSED: number; - }; - errno: { - E2BIG: number; - EACCES: number; - EADDRINUSE: number; - EADDRNOTAVAIL: number; - EAFNOSUPPORT: number; - EAGAIN: number; - EALREADY: number; - EBADF: number; - EBADMSG: number; - EBUSY: number; - ECANCELED: number; - ECHILD: number; - ECONNABORTED: number; - ECONNREFUSED: number; - ECONNRESET: number; - EDEADLK: number; - EDESTADDRREQ: number; - EDOM: number; - EDQUOT: number; - EEXIST: number; - EFAULT: number; - EFBIG: number; - EHOSTUNREACH: number; - EIDRM: number; - EILSEQ: number; - EINPROGRESS: number; - EINTR: number; - EINVAL: number; - EIO: number; - EISCONN: number; - EISDIR: number; - ELOOP: number; - EMFILE: number; - EMLINK: number; - EMSGSIZE: number; - EMULTIHOP: number; - ENAMETOOLONG: number; - ENETDOWN: number; - ENETRESET: number; - ENETUNREACH: number; - ENFILE: number; - ENOBUFS: number; - ENODATA: number; - ENODEV: number; - ENOENT: number; - ENOEXEC: number; - ENOLCK: number; - ENOLINK: number; - ENOMEM: number; - ENOMSG: number; - ENOPROTOOPT: number; - ENOSPC: number; - ENOSR: number; - ENOSTR: number; - ENOSYS: number; - ENOTCONN: number; - ENOTDIR: number; - ENOTEMPTY: number; - ENOTSOCK: number; - ENOTSUP: number; - ENOTTY: number; - ENXIO: number; - EOPNOTSUPP: number; - EOVERFLOW: number; - EPERM: number; - EPIPE: number; - EPROTO: number; - EPROTONOSUPPORT: number; - EPROTOTYPE: number; - ERANGE: number; - EROFS: number; - ESPIPE: number; - ESRCH: number; - ESTALE: number; - ETIME: number; - ETIMEDOUT: number; - ETXTBSY: number; - EWOULDBLOCK: number; - EXDEV: number; - WSAEINTR: number; - WSAEBADF: number; - WSAEACCES: number; - WSAEFAULT: number; - WSAEINVAL: number; - WSAEMFILE: number; - WSAEWOULDBLOCK: number; - WSAEINPROGRESS: number; - WSAEALREADY: number; - WSAENOTSOCK: number; - WSAEDESTADDRREQ: number; - WSAEMSGSIZE: number; - WSAEPROTOTYPE: number; - WSAENOPROTOOPT: number; - WSAEPROTONOSUPPORT: number; - WSAESOCKTNOSUPPORT: number; - WSAEOPNOTSUPP: number; - WSAEPFNOSUPPORT: number; - WSAEAFNOSUPPORT: number; - WSAEADDRINUSE: number; - WSAEADDRNOTAVAIL: number; - WSAENETDOWN: number; - WSAENETUNREACH: number; - WSAENETRESET: number; - WSAECONNABORTED: number; - WSAECONNRESET: number; - WSAENOBUFS: number; - WSAEISCONN: number; - WSAENOTCONN: number; - WSAESHUTDOWN: number; - WSAETOOMANYREFS: number; - WSAETIMEDOUT: number; - WSAECONNREFUSED: number; - WSAELOOP: number; - WSAENAMETOOLONG: number; - WSAEHOSTDOWN: number; - WSAEHOSTUNREACH: number; - WSAENOTEMPTY: number; - WSAEPROCLIM: number; - WSAEUSERS: number; - WSAEDQUOT: number; - WSAESTALE: number; - WSAEREMOTE: number; - WSASYSNOTREADY: number; - WSAVERNOTSUPPORTED: number; - WSANOTINITIALISED: number; - WSAEDISCON: number; - WSAENOMORE: number; - WSAECANCELLED: number; - WSAEINVALIDPROCTABLE: number; - WSAEINVALIDPROVIDER: number; - WSAEPROVIDERFAILEDINIT: number; - WSASYSCALLFAILURE: number; - WSASERVICE_NOT_FOUND: number; - WSATYPE_NOT_FOUND: number; - WSA_E_NO_MORE: number; - WSA_E_CANCELLED: number; - WSAEREFUSED: number; - }; - priority: { - PRIORITY_LOW: number; - PRIORITY_BELOW_NORMAL: number; - PRIORITY_NORMAL: number; - PRIORITY_ABOVE_NORMAL: number; - PRIORITY_HIGH: number; - PRIORITY_HIGHEST: number; - } - }; - function arch(): string; - function platform(): NodeJS.Platform; - function tmpdir(): string; - const EOL: string; - function endianness(): "BE" | "LE"; - /** - * Gets the priority of a process. - * Defaults to current process. - */ - function getPriority(pid?: number): number; - /** - * Sets the priority of the current process. - * @param priority Must be in range of -20 to 19 - */ - function setPriority(priority: number): void; - /** - * Sets the priority of the process specified process. - * @param priority Must be in range of -20 to 19 - */ - function setPriority(pid: number, priority: number): void; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/package.json b/node_modules/@grpc/grpc-js/node_modules/@types/node/package.json deleted file mode 100644 index d5043292..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/package.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "_from": "@types/node@^12.12.47", - "_id": "@types/node@12.19.7", - "_inBundle": false, - "_integrity": "sha512-zvjOU1g4CpPilbTDUATnZCUb/6lARMRAqzT7ILwl1P3YvU2leEcZ2+fw9+Jrw/paXB1CgQyXTrN4hWDtqT9O2A==", - "_location": "/@grpc/grpc-js/@types/node", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/node@^12.12.47", - "name": "@types/node", - "escapedName": "@types%2fnode", - "scope": "@types", - "rawSpec": "^12.12.47", - "saveSpec": null, - "fetchSpec": "^12.12.47" - }, - "_requiredBy": [ - "/@grpc/grpc-js" - ], - "_resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.7.tgz", - "_shasum": "cf8b6ac088dd9182ac9a1d765f787a8d12490c04", - "_spec": "@types/node@^12.12.47", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/@grpc/grpc-js", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Microsoft TypeScript", - "url": "https://github.com/Microsoft" - }, - { - "name": "DefinitelyTyped", - "url": "https://github.com/DefinitelyTyped" - }, - { - "name": "Alberto Schiabel", - "url": "https://github.com/jkomyno" - }, - { - "name": "Alexander T.", - "url": "https://github.com/a-tarasyuk" - }, - { - "name": "Alvis HT Tang", - "url": "https://github.com/alvis" - }, - { - "name": "Andrew Makarov", - "url": "https://github.com/r3nya" - }, - { - "name": "Benjamin Toueg", - "url": "https://github.com/btoueg" - }, - { - "name": "Bruno Scheufler", - "url": "https://github.com/brunoscheufler" - }, - { - "name": "Chigozirim C.", - "url": "https://github.com/smac89" - }, - { - "name": "David Junger", - "url": "https://github.com/touffy" - }, - { - "name": "Deividas Bakanas", - "url": "https://github.com/DeividasBakanas" - }, - { - "name": "Eugene Y. Q. Shen", - "url": "https://github.com/eyqs" - }, - { - "name": "Flarna", - "url": "https://github.com/Flarna" - }, - { - "name": "Hannes Magnusson", - "url": "https://github.com/Hannes-Magnusson-CK" - }, - { - "name": "Hoàng Văn Khải", - "url": "https://github.com/KSXGitHub" - }, - { - "name": "Huw", - "url": "https://github.com/hoo29" - }, - { - "name": "Kelvin Jin", - "url": "https://github.com/kjin" - }, - { - "name": "Klaus Meinhardt", - "url": "https://github.com/ajafff" - }, - { - "name": "Lishude", - "url": "https://github.com/islishude" - }, - { - "name": "Mariusz Wiktorczyk", - "url": "https://github.com/mwiktorczyk" - }, - { - "name": "Mohsen Azimi", - "url": "https://github.com/mohsen1" - }, - { - "name": "Nicolas Even", - "url": "https://github.com/n-e" - }, - { - "name": "Nikita Galkin", - "url": "https://github.com/galkin" - }, - { - "name": "Parambir Singh", - "url": "https://github.com/parambirs" - }, - { - "name": "Sebastian Silbermann", - "url": "https://github.com/eps1lon" - }, - { - "name": "Simon Schick", - "url": "https://github.com/SimonSchick" - }, - { - "name": "Thomas den Hollander", - "url": "https://github.com/ThomasdenH" - }, - { - "name": "Wilco Bakker", - "url": "https://github.com/WilcoBakker" - }, - { - "name": "wwwy3y3", - "url": "https://github.com/wwwy3y3" - }, - { - "name": "Zane Hannan AU", - "url": "https://github.com/ZaneHannanAU" - }, - { - "name": "Samuel Ainsworth", - "url": "https://github.com/samuela" - }, - { - "name": "Kyle Uehlein", - "url": "https://github.com/kuehlein" - }, - { - "name": "Jordi Oliveras Rovira", - "url": "https://github.com/j-oliveras" - }, - { - "name": "Thanik Bhongbhibhat", - "url": "https://github.com/bhongy" - }, - { - "name": "Marcin Kopacz", - "url": "https://github.com/chyzwar" - }, - { - "name": "Trivikram Kamat", - "url": "https://github.com/trivikr" - }, - { - "name": "Minh Son Nguyen", - "url": "https://github.com/nguymin4" - }, - { - "name": "Junxiao Shi", - "url": "https://github.com/yoursunny" - }, - { - "name": "Ilia Baryshnikov", - "url": "https://github.com/qwelias" - }, - { - "name": "ExE Boss", - "url": "https://github.com/ExE-Boss" - }, - { - "name": "Jason Kwok", - "url": "https://github.com/JasonHK" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for Node.js", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/node", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/node" - }, - "scripts": {}, - "typeScriptVersion": "3.3", - "types": "index.d.ts", - "typesPublisherContentHash": "eb2d669c9c3ace7b48a571fbb9cf7bd493f62d84524b80d7edf02ee6be35e0e0", - "typesVersions": { - "<=3.3": { - "*": [ - "ts3.3/*" - ] - }, - "<=3.6": { - "*": [ - "ts3.6/*" - ] - } - }, - "version": "12.19.7" -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/path.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/path.d.ts deleted file mode 100644 index 2f4a5491..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/path.d.ts +++ /dev/null @@ -1,159 +0,0 @@ -declare module "path" { - /** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ - interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; - } - interface FormatInputPathObject { - /** - * The root of the path such as '/' or 'c:\' - */ - root?: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir?: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base?: string; - /** - * The file extension (if any) such as '.html' - */ - ext?: string; - /** - * The file name without extension (if any) such as 'index' - */ - name?: string; - } - - /** - * Normalize a string path, reducing '..' and '.' parts. - * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. - * - * @param p string path to normalize. - */ - function normalize(p: string): string; - /** - * Join all arguments together and normalize the resulting path. - * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. - * - * @param paths paths to join. - */ - function join(...paths: string[]): string; - /** - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - * - * Starting from leftmost {from} parameter, resolves {to} to an absolute path. - * - * If {to} isn't already absolute, {from} arguments are prepended in right to left order, - * until an absolute path is found. If after using all {from} paths still no absolute path is found, - * the current working directory is used as well. The resulting path is normalized, - * and trailing slashes are removed unless the path gets resolved to the root directory. - * - * @param pathSegments string paths to join. Non-string arguments are ignored. - */ - function resolve(...pathSegments: string[]): string; - /** - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - * - * @param path path to test. - */ - function isAbsolute(path: string): boolean; - /** - * Solve the relative path from {from} to {to}. - * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. - */ - function relative(from: string, to: string): string; - /** - * Return the directory name of a path. Similar to the Unix dirname command. - * - * @param p the path to evaluate. - */ - function dirname(p: string): string; - /** - * Return the last portion of a path. Similar to the Unix basename command. - * Often used to extract the file name from a fully qualified path. - * - * @param p the path to evaluate. - * @param ext optionally, an extension to remove from the result. - */ - function basename(p: string, ext?: string): string; - /** - * Return the extension of the path, from the last '.' to end of string in the last portion of the path. - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string - * - * @param p the path to evaluate. - */ - function extname(p: string): string; - /** - * The platform-specific file separator. '\\' or '/'. - */ - const sep: '\\' | '/'; - /** - * The platform-specific file delimiter. ';' or ':'. - */ - const delimiter: ';' | ':'; - /** - * Returns an object from a path string - the opposite of format(). - * - * @param pathString path to evaluate. - */ - function parse(pathString: string): ParsedPath; - /** - * Returns a path string from an object - the opposite of parse(). - * - * @param pathString path to evaluate. - */ - function format(pathObject: FormatInputPathObject): string; - - namespace posix { - function normalize(p: string): string; - function join(...paths: string[]): string; - function resolve(...pathSegments: string[]): string; - function isAbsolute(p: string): boolean; - function relative(from: string, to: string): string; - function dirname(p: string): string; - function basename(p: string, ext?: string): string; - function extname(p: string): string; - const sep: string; - const delimiter: string; - function parse(p: string): ParsedPath; - function format(pP: FormatInputPathObject): string; - } - - namespace win32 { - function normalize(p: string): string; - function join(...paths: string[]): string; - function resolve(...pathSegments: string[]): string; - function isAbsolute(p: string): boolean; - function relative(from: string, to: string): string; - function dirname(p: string): string; - function basename(p: string, ext?: string): string; - function extname(p: string): string; - const sep: string; - const delimiter: string; - function parse(p: string): ParsedPath; - function format(pP: FormatInputPathObject): string; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/perf_hooks.d.ts deleted file mode 100644 index 9b6109f2..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/perf_hooks.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -declare module "perf_hooks" { - import { AsyncResource } from "async_hooks"; - - interface PerformanceEntry { - /** - * The total number of milliseconds elapsed for this entry. - * This value will not be meaningful for all Performance Entry types. - */ - readonly duration: number; - - /** - * The name of the performance entry. - */ - readonly name: string; - - /** - * The high resolution millisecond timestamp marking the starting time of the Performance Entry. - */ - readonly startTime: number; - - /** - * The type of the performance entry. - * Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'. - */ - readonly entryType: string; - - /** - * When performanceEntry.entryType is equal to 'gc', the performance.kind property identifies - * the type of garbage collection operation that occurred. - * The value may be one of perf_hooks.constants. - */ - readonly kind?: number; - } - - interface PerformanceNodeTiming extends PerformanceEntry { - /** - * The high resolution millisecond timestamp at which the Node.js process completed bootstrap. - * If bootstrapping has not yet finished, the property has the value of -1. - */ - readonly bootstrapComplete: number; - - /** - * The high resolution millisecond timestamp at which the Node.js process completed bootstrapping. - * If bootstrapping has not yet finished, the property has the value of -1. - */ - readonly environment: number; - - /** - * The high resolution millisecond timestamp at which the Node.js environment was initialized. - */ - readonly idleTime: number; - - /** - * The high resolution millisecond timestamp at which the Node.js event loop exited. - * If the event loop has not yet exited, the property has the value of -1. - * It can only have a value of not -1 in a handler of the 'exit' event. - */ - readonly loopExit: number; - - /** - * The high resolution millisecond timestamp at which the Node.js event loop started. - * If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of -1. - */ - readonly loopStart: number; - - /** - * The high resolution millisecond timestamp at which the Node.js process was initialized. - */ - readonly nodeStart: number; - - /** - * The high resolution millisecond timestamp at which the V8 platform was initialized. - */ - readonly v8Start: number; - } - - interface EventLoopUtilization { - idle: number; - active: number; - utilization: number; - } - - interface Performance { - /** - * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. - * If name is provided, removes only the named mark. - * @param name - */ - clearMarks(name?: string): void; - - /** - * Creates a new PerformanceMark entry in the Performance Timeline. - * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', - * and whose performanceEntry.duration is always 0. - * Performance marks are used to mark specific significant moments in the Performance Timeline. - * @param name - */ - mark(name?: string): void; - - /** - * Creates a new PerformanceMeasure entry in the Performance Timeline. - * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', - * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. - * - * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify - * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, - * then startMark is set to timeOrigin by default. - * - * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp - * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. - * @param name - * @param startMark - * @param endMark - */ - measure(name: string, startMark: string, endMark: string): void; - - /** - * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. - */ - readonly nodeTiming: PerformanceNodeTiming; - - /** - * @return the current high resolution millisecond timestamp - */ - now(): number; - - /** - * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. - */ - readonly timeOrigin: number; - - /** - * Wraps a function within a new function that measures the running time of the wrapped function. - * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. - * @param fn - */ - timerify any>(fn: T): T; - - /** - * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. - * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). - * No other CPU idle time is taken into consideration. - * - * @param util1 The result of a previous call to eventLoopUtilization() - * @param util2 The result of a previous call to eventLoopUtilization() prior to util1 - */ - eventLoopUtilization(util1?: EventLoopUtilization, util2?: EventLoopUtilization): EventLoopUtilization; - } - - interface PerformanceObserverEntryList { - /** - * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime. - */ - getEntries(): PerformanceEntry[]; - - /** - * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type. - */ - getEntriesByName(name: string, type?: string): PerformanceEntry[]; - - /** - * @return Returns a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.entryType is equal to type. - */ - getEntriesByType(type: string): PerformanceEntry[]; - } - - type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; - - class PerformanceObserver extends AsyncResource { - constructor(callback: PerformanceObserverCallback); - - /** - * Disconnects the PerformanceObserver instance from all notifications. - */ - disconnect(): void; - - /** - * Subscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified by options.entryTypes. - * When options.buffered is false, the callback will be invoked once for every PerformanceEntry instance. - * Property buffered defaults to false. - * @param options - */ - observe(options: { entryTypes: ReadonlyArray, buffered?: boolean }): void; - } - - namespace constants { - const NODE_PERFORMANCE_GC_MAJOR: number; - const NODE_PERFORMANCE_GC_MINOR: number; - const NODE_PERFORMANCE_GC_INCREMENTAL: number; - const NODE_PERFORMANCE_GC_WEAKCB: number; - } - - const performance: Performance; - - interface EventLoopMonitorOptions { - /** - * The sampling rate in milliseconds. - * Must be greater than zero. - * @default 10 - */ - resolution?: number; - } - - interface EventLoopDelayMonitor { - /** - * Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started. - */ - enable(): boolean; - /** - * Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped. - */ - disable(): boolean; - - /** - * Resets the collected histogram data. - */ - reset(): void; - - /** - * Returns the value at the given percentile. - * @param percentile A percentile value between 1 and 100. - */ - percentile(percentile: number): number; - - /** - * A `Map` object detailing the accumulated percentile distribution. - */ - readonly percentiles: Map; - - /** - * The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold. - */ - readonly exceeds: number; - - /** - * The minimum recorded event loop delay. - */ - readonly min: number; - - /** - * The maximum recorded event loop delay. - */ - readonly max: number; - - /** - * The mean of the recorded event loop delays. - */ - readonly mean: number; - - /** - * The standard deviation of the recorded event loop delays. - */ - readonly stddev: number; - } - - function monitorEventLoopDelay(options?: EventLoopMonitorOptions): EventLoopDelayMonitor; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/process.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/process.d.ts deleted file mode 100644 index d007d4e0..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/process.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare module "process" { - import * as tty from "tty"; - - global { - namespace NodeJS { - // this namespace merge is here because these are specifically used - // as the type for process.stdin, process.stdout, and process.stderr. - // they can't live in tty.d.ts because we need to disambiguate the imported name. - interface ReadStream extends tty.ReadStream {} - interface WriteStream extends tty.WriteStream {} - } - } - - export = process; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/punycode.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/punycode.d.ts deleted file mode 100644 index 2b771d45..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/punycode.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -declare module "punycode" { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function decode(string: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function encode(string: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function toUnicode(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function toASCII(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const ucs2: ucs2; - interface ucs2 { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - decode(string: string): number[]; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - encode(codePoints: ReadonlyArray): string; - } - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const version: string; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/querystring.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/querystring.d.ts deleted file mode 100644 index 4faba0f5..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/querystring.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare module "querystring" { - interface StringifyOptions { - encodeURIComponent?: (str: string) => string; - } - - interface ParseOptions { - maxKeys?: number; - decodeURIComponent?: (str: string) => string; - } - - interface ParsedUrlQuery { [key: string]: string | string[]; } - - interface ParsedUrlQueryInput { - [key: string]: string | number | boolean | ReadonlyArray | ReadonlyArray | ReadonlyArray | undefined | null; - } - - function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; - function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; - /** - * The querystring.encode() function is an alias for querystring.stringify(). - */ - const encode: typeof stringify; - /** - * The querystring.decode() function is an alias for querystring.parse(). - */ - const decode: typeof parse; - function escape(str: string): string; - function unescape(str: string): string; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/readline.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/readline.d.ts deleted file mode 100644 index 3fd7e008..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/readline.d.ts +++ /dev/null @@ -1,158 +0,0 @@ -declare module "readline" { - import * as events from "events"; - import * as stream from "stream"; - - interface Key { - sequence?: string; - name?: string; - ctrl?: boolean; - meta?: boolean; - shift?: boolean; - } - - class Interface extends events.EventEmitter { - readonly terminal: boolean; - - // Need direct access to line/cursor data, for use in external processes - // see: https://github.com/nodejs/node/issues/30347 - /** The current input data */ - readonly line: string; - /** The current cursor position in the input line */ - readonly cursor: number; - - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface - */ - protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface - */ - protected constructor(options: ReadLineOptions); - - setPrompt(prompt: string): void; - prompt(preserveCursor?: boolean): void; - question(query: string, callback: (answer: string) => void): void; - pause(): this; - resume(): this; - close(): void; - write(data: string | Buffer, key?: Key): void; - - /** - * events.EventEmitter - * 1. close - * 2. line - * 3. pause - * 4. resume - * 5. SIGCONT - * 6. SIGINT - * 7. SIGTSTP - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - type ReadLine = Interface; // type forwarded for backwards compatiblity - - type Completer = (line: string) => CompleterResult; - type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any; - - type CompleterResult = [string[], string]; - - interface ReadLineOptions { - input: NodeJS.ReadableStream; - output?: NodeJS.WritableStream; - completer?: Completer | AsyncCompleter; - terminal?: boolean; - historySize?: number; - prompt?: string; - crlfDelay?: number; - removeHistoryDuplicates?: boolean; - escapeCodeTimeout?: number; - } - - function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; - function createInterface(options: ReadLineOptions): Interface; - function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; - - type Direction = -1 | 0 | 1; - - /** - * Clears the current line of this WriteStream in a direction identified by `dir`. - */ - function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; - /** - * Clears this `WriteStream` from the current cursor down. - */ - function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor to the specified position. - */ - function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor relative to its current position. - */ - function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/repl.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/repl.d.ts deleted file mode 100644 index bc5ea0b7..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/repl.d.ts +++ /dev/null @@ -1,390 +0,0 @@ -declare module "repl" { - import { Interface, Completer, AsyncCompleter } from "readline"; - import { Context } from "vm"; - import { InspectOptions } from "util"; - - interface ReplOptions { - /** - * The input prompt to display. - * Default: `"> "` - */ - prompt?: string; - /** - * The `Readable` stream from which REPL input will be read. - * Default: `process.stdin` - */ - input?: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - * Default: `process.stdout` - */ - output?: NodeJS.WritableStream; - /** - * If `true`, specifies that the output should be treated as a TTY terminal, and have - * ANSI/VT100 escape codes written to it. - * Default: checking the value of the `isTTY` property on the output stream upon - * instantiation. - */ - terminal?: boolean; - /** - * The function to be used when evaluating each given line of input. - * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can - * error with `repl.Recoverable` to indicate the input was incomplete and prompt for - * additional lines. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions - */ - eval?: REPLEval; - /** - * If `true`, specifies that the default `writer` function should include ANSI color - * styling to REPL output. If a custom `writer` function is provided then this has no - * effect. - * Default: the REPL instance's `terminal` value. - */ - useColors?: boolean; - /** - * If `true`, specifies that the default evaluation function will use the JavaScript - * `global` as the context as opposed to creating a new separate context for the REPL - * instance. The node CLI REPL sets this value to `true`. - * Default: `false`. - */ - useGlobal?: boolean; - /** - * If `true`, specifies that the default writer will not output the return value of a - * command if it evaluates to `undefined`. - * Default: `false`. - */ - ignoreUndefined?: boolean; - /** - * The function to invoke to format the output of each command before writing to `output`. - * Default: a wrapper for `util.inspect`. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output - */ - writer?: REPLWriter; - /** - * An optional function used for custom Tab auto completion. - * - * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function - */ - completer?: Completer | AsyncCompleter; - /** - * A flag that specifies whether the default evaluator executes all JavaScript commands in - * strict mode or default (sloppy) mode. - * Accepted values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - /** - * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is - * pressed. This cannot be used together with a custom `eval` function. - * Default: `false`. - */ - breakEvalOnSigint?: boolean; - } - - type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; - type REPLWriter = (this: REPLServer, obj: any) => string; - - /** - * This is the default "writer" value, if none is passed in the REPL options, - * and it can be overridden by custom print functions. - */ - const writer: REPLWriter & { options: InspectOptions }; - - type REPLCommandAction = (this: REPLServer, text: string) => void; - - interface REPLCommand { - /** - * Help text to be displayed when `.help` is entered. - */ - help?: string; - /** - * The function to execute, optionally accepting a single string argument. - */ - action: REPLCommandAction; - } - - /** - * Provides a customizable Read-Eval-Print-Loop (REPL). - * - * Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those - * according to a user-defined evaluation function, then output the result. Input and output - * may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`. - * - * Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style - * line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session - * state, error recovery, and customizable evaluation functions. - * - * Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_ - * be created directly using the JavaScript `new` keyword. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl - */ - class REPLServer extends Interface { - /** - * The `vm.Context` provided to the `eval` function to be used for JavaScript - * evaluation. - */ - readonly context: Context; - /** - * Outdated alias for `input`. - */ - readonly inputStream: NodeJS.ReadableStream; - /** - * Outdated alias for `output`. - */ - readonly outputStream: NodeJS.WritableStream; - /** - * The `Readable` stream from which REPL input will be read. - */ - readonly input: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - */ - readonly output: NodeJS.WritableStream; - /** - * The commands registered via `replServer.defineCommand()`. - */ - readonly commands: { readonly [name: string]: REPLCommand | undefined }; - /** - * A value indicating whether the REPL is currently in "editor mode". - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys - */ - readonly editorMode: boolean; - /** - * A value indicating whether the `_` variable has been assigned. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreAssigned: boolean; - /** - * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly last: any; - /** - * A value indicating whether the `_error` variable has been assigned. - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreErrAssigned: boolean; - /** - * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly lastError: any; - /** - * Specified in the REPL options, this is the function to be used when evaluating each - * given line of input. If not specified in the REPL options, this is an async wrapper - * for the JavaScript `eval()` function. - */ - readonly eval: REPLEval; - /** - * Specified in the REPL options, this is a value indicating whether the default - * `writer` function should include ANSI color styling to REPL output. - */ - readonly useColors: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `eval` - * function will use the JavaScript `global` as the context as opposed to creating a new - * separate context for the REPL instance. - */ - readonly useGlobal: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `writer` - * function should output the result of a command if it evaluates to `undefined`. - */ - readonly ignoreUndefined: boolean; - /** - * Specified in the REPL options, this is the function to invoke to format the output of - * each command before writing to `outputStream`. If not specified in the REPL options, - * this will be a wrapper for `util.inspect`. - */ - readonly writer: REPLWriter; - /** - * Specified in the REPL options, this is the function to use for custom Tab auto-completion. - */ - readonly completer: Completer | AsyncCompleter; - /** - * Specified in the REPL options, this is a flag that specifies whether the default `eval` - * function should execute all JavaScript commands in strict mode or default (sloppy) mode. - * Possible values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - - /** - * NOTE: According to the documentation: - * - * > Instances of `repl.REPLServer` are created using the `repl.start()` method and - * > _should not_ be created directly using the JavaScript `new` keyword. - * - * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver - */ - private constructor(); - - /** - * Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked - * by typing a `.` followed by the `keyword`. - * - * @param keyword The command keyword (_without_ a leading `.` character). - * @param cmd The function to invoke when the command is processed. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd - */ - defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; - /** - * Readies the REPL instance for input from the user, printing the configured `prompt` to a - * new line in the `output` and resuming the `input` to accept new input. - * - * When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'. - * - * This method is primarily intended to be called from within the action function for - * commands registered using the `replServer.defineCommand()` method. - * - * @param preserveCursor When `true`, the cursor placement will not be reset to `0`. - */ - displayPrompt(preserveCursor?: boolean): void; - /** - * Clears any command that has been buffered but not yet executed. - * - * This method is primarily intended to be called from within the action function for - * commands registered using the `replServer.defineCommand()` method. - * - * @since v9.0.0 - */ - clearBufferedCommand(): void; - - /** - * Initializes a history log file for the REPL instance. When executing the - * Node.js binary and using the command line REPL, a history file is initialized - * by default. However, this is not the case when creating a REPL - * programmatically. Use this method to initialize a history log file when working - * with REPL instances programmatically. - * @param path The path to the history file - */ - setupHistory(path: string, cb: (err: Error | null, repl: this) => void): void; - - /** - * events.EventEmitter - * 1. close - inherited from `readline.Interface` - * 2. line - inherited from `readline.Interface` - * 3. pause - inherited from `readline.Interface` - * 4. resume - inherited from `readline.Interface` - * 5. SIGCONT - inherited from `readline.Interface` - * 6. SIGINT - inherited from `readline.Interface` - * 7. SIGTSTP - inherited from `readline.Interface` - * 8. exit - * 9. reset - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (context: Context) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "exit"): boolean; - emit(event: "reset", context: Context): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (context: Context) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (context: Context) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (context: Context) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (context: Context) => void): this; - } - - /** - * A flag passed in the REPL options. Evaluates expressions in sloppy mode. - */ - const REPL_MODE_SLOPPY: symbol; // TODO: unique symbol - - /** - * A flag passed in the REPL options. Evaluates expressions in strict mode. - * This is equivalent to prefacing every repl statement with `'use strict'`. - */ - const REPL_MODE_STRICT: symbol; // TODO: unique symbol - - /** - * Creates and starts a `repl.REPLServer` instance. - * - * @param options The options for the `REPLServer`. If `options` is a string, then it specifies - * the input prompt. - */ - function start(options?: string | ReplOptions): REPLServer; - - /** - * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors - */ - class Recoverable extends SyntaxError { - err: Error; - - constructor(err: Error); - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/stream.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/stream.d.ts deleted file mode 100644 index 8218b6a4..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/stream.d.ts +++ /dev/null @@ -1,333 +0,0 @@ -declare module "stream" { - import * as events from "events"; - - class internal extends events.EventEmitter { - pipe(destination: T, options?: { end?: boolean; }): T; - } - - namespace internal { - class Stream extends internal { } - - interface ReadableOptions { - highWaterMark?: number; - encoding?: string; - objectMode?: boolean; - read?(this: Readable, size: number): void; - destroy?(this: Readable, error: Error | null, callback: (error: Error | null) => void): void; - autoDestroy?: boolean; - } - - class Readable extends Stream implements NodeJS.ReadableStream { - /** - * A utility method for creating Readable Streams out of iterators. - */ - static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; - - readable: boolean; - readonly readableEncoding: BufferEncoding | null; - readonly readableEnded: boolean; - readonly readableFlowing: boolean | null; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableObjectMode: boolean; - destroyed: boolean; - constructor(opts?: ReadableOptions); - _read(size: number): void; - read(size?: number): any; - setEncoding(encoding: string): this; - pause(): this; - resume(): this; - isPaused(): boolean; - unpipe(destination?: NodeJS.WritableStream): this; - unshift(chunk: any, encoding?: BufferEncoding): void; - wrap(oldStream: NodeJS.ReadableStream): this; - push(chunk: any, encoding?: string): boolean; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - destroy(error?: Error): void; - - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. end - * 4. readable - * 5. error - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "end"): boolean; - emit(event: "readable"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "end", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "end", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableOptions { - highWaterMark?: number; - decodeStrings?: boolean; - defaultEncoding?: string; - objectMode?: boolean; - emitClose?: boolean; - write?(this: Writable, chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - writev?(this: Writable, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void; - final?(this: Writable, callback: (error?: Error | null) => void): void; - autoDestroy?: boolean; - } - - class Writable extends Stream implements NodeJS.WritableStream { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - destroyed: boolean; - constructor(opts?: WritableOptions); - _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, encoding: string, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: string): this; - end(cb?: () => void): void; - end(chunk: any, cb?: () => void): void; - end(chunk: any, encoding: string, cb?: () => void): void; - cork(): void; - uncork(): void; - destroy(error?: Error): void; - - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. drain - * 3. error - * 4. finish - * 5. pipe - * 6. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean; - readableObjectMode?: boolean; - writableObjectMode?: boolean; - readableHighWaterMark?: number; - writableHighWaterMark?: number; - read?(this: Duplex, size: number): void; - write?(this: Duplex, chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - writev?(this: Duplex, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - final?(this: Duplex, callback: (error?: Error | null) => void): void; - destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void; - } - - // Note: Duplex extends both Readable and Writable. - class Duplex extends Readable implements Writable { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - constructor(opts?: DuplexOptions); - _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: string): this; - end(cb?: () => void): void; - end(chunk: any, cb?: () => void): void; - end(chunk: any, encoding?: string, cb?: () => void): void; - cork(): void; - uncork(): void; - } - - type TransformCallback = (error?: Error | null, data?: any) => void; - - interface TransformOptions extends DuplexOptions { - read?(this: Transform, size: number): void; - write?(this: Transform, chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - writev?(this: Transform, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - final?(this: Transform, callback: (error?: Error | null) => void): void; - destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void; - transform?(this: Transform, chunk: any, encoding: string, callback: TransformCallback): void; - flush?(this: Transform, callback: TransformCallback): void; - } - - class Transform extends Duplex { - constructor(opts?: TransformOptions); - _transform(chunk: any, encoding: string, callback: TransformCallback): void; - _flush(callback: TransformCallback): void; - } - - class PassThrough extends Transform { } - - interface FinishedOptions { - error?: boolean; - readable?: boolean; - writable?: boolean; - } - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; - namespace finished { - function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise; - } - - function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; - function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: T, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): T; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: NodeJS.ReadWriteStream, - stream5: T, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): T; - function pipeline( - streams: ReadonlyArray, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): NodeJS.WritableStream; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array void)>, - ): NodeJS.WritableStream; - namespace pipeline { - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise; - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.WritableStream): Promise; - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: NodeJS.WritableStream): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: NodeJS.ReadWriteStream, - stream5: NodeJS.WritableStream, - ): Promise; - function __promisify__(streams: ReadonlyArray): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array, - ): Promise; - } - - interface Pipe { - close(): void; - hasRef(): boolean; - ref(): void; - unref(): void; - } - } - - export = internal; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/string_decoder.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/string_decoder.d.ts deleted file mode 100644 index fe0e0b4d..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/string_decoder.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module "string_decoder" { - class StringDecoder { - constructor(encoding?: string); - write(buffer: Buffer): string; - end(buffer?: Buffer): string; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/timers.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/timers.d.ts deleted file mode 100644 index e64a6735..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/timers.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module "timers" { - function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; - namespace setTimeout { - function __promisify__(ms: number): Promise; - function __promisify__(ms: number, value: T): Promise; - } - function clearTimeout(timeoutId: NodeJS.Timeout): void; - function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; - function clearInterval(intervalId: NodeJS.Timeout): void; - function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; - namespace setImmediate { - function __promisify__(): Promise; - function __promisify__(value: T): Promise; - } - function clearImmediate(immediateId: NodeJS.Immediate): void; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/tls.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/tls.d.ts deleted file mode 100644 index 4321f9b3..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/tls.d.ts +++ /dev/null @@ -1,714 +0,0 @@ -declare module "tls" { - import * as crypto from "crypto"; - import * as dns from "dns"; - import * as net from "net"; - import * as stream from "stream"; - - const CLIENT_RENEG_LIMIT: number; - const CLIENT_RENEG_WINDOW: number; - - interface Certificate { - /** - * Country code. - */ - C: string; - /** - * Street. - */ - ST: string; - /** - * Locality. - */ - L: string; - /** - * Organization. - */ - O: string; - /** - * Organizational unit. - */ - OU: string; - /** - * Common name. - */ - CN: string; - } - - interface PeerCertificate { - subject: Certificate; - issuer: Certificate; - subjectaltname: string; - infoAccess: { [index: string]: string[] | undefined }; - modulus: string; - exponent: string; - valid_from: string; - valid_to: string; - fingerprint: string; - fingerprint256: string; - ext_key_usage: string[]; - serialNumber: string; - raw: Buffer; - } - - interface DetailedPeerCertificate extends PeerCertificate { - issuerCertificate: DetailedPeerCertificate; - } - - interface CipherNameAndProtocol { - /** - * The cipher name. - */ - name: string; - /** - * SSL/TLS protocol version. - */ - version: string; - } - - interface EphemeralKeyInfo { - /** - * The supported types are 'DH' and 'ECDH'. - */ - type: string; - /** - * The name property is available only when type is 'ECDH'. - */ - name?: string; - /** - * The size of parameter of an ephemeral key exchange. - */ - size: number; - } - - interface KeyObject { - /** - * Private keys in PEM format. - */ - pem: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string; - } - - interface PxfObject { - /** - * PFX or PKCS12 encoded private key and certificate chain. - */ - buf: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string; - } - - interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * If true the TLS socket will be instantiated in server-mode. - * Defaults to false. - */ - isServer?: boolean; - /** - * An optional net.Server instance. - */ - server?: net.Server; - - /** - * An optional Buffer instance containing a TLS session. - */ - session?: Buffer; - /** - * If true, specifies that the OCSP status request extension will be - * added to the client hello and an 'OCSPResponse' event will be - * emitted on the socket before establishing a secure communication - */ - requestOCSP?: boolean; - } - - class TLSSocket extends net.Socket { - /** - * Construct a new tls.TLSSocket object from an existing TCP socket. - */ - constructor(socket: net.Socket, options?: TLSSocketOptions); - - /** - * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false. - */ - authorized: boolean; - /** - * The reason why the peer's certificate has not been verified. - * This property becomes available only when tlsSocket.authorized === false. - */ - authorizationError: Error; - /** - * Static boolean value, always true. - * May be used to distinguish TLS sockets from regular ones. - */ - encrypted: boolean; - - /** - * String containing the selected ALPN protocol. - * When ALPN has no selected protocol, tlsSocket.alpnProtocol equals false. - */ - alpnProtocol?: string; - - /** - * Returns an object representing the local certificate. The returned - * object has some properties corresponding to the fields of the - * certificate. - * - * See tls.TLSSocket.getPeerCertificate() for an example of the - * certificate structure. - * - * If there is no local certificate, an empty object will be returned. - * If the socket has been destroyed, null will be returned. - */ - getCertificate(): PeerCertificate | object | null; - /** - * Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection. - * @returns Returns an object representing the cipher name - * and the SSL/TLS protocol version of the current connection. - */ - getCipher(): CipherNameAndProtocol; - /** - * Returns an object representing the type, name, and size of parameter - * of an ephemeral key exchange in Perfect Forward Secrecy on a client - * connection. It returns an empty object when the key exchange is not - * ephemeral. As this is only supported on a client socket; null is - * returned if called on a server socket. The supported types are 'DH' - * and 'ECDH'. The name property is available only when type is 'ECDH'. - * - * For example: { type: 'ECDH', name: 'prime256v1', size: 256 }. - */ - getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; - /** - * Returns the latest Finished message that has - * been sent to the socket as part of a SSL/TLS handshake, or undefined - * if no Finished message has been sent yet. - * - * As the Finished messages are message digests of the complete - * handshake (with a total of 192 bits for TLS 1.0 and more for SSL - * 3.0), they can be used for external authentication procedures when - * the authentication provided by SSL/TLS is not desired or is not - * enough. - * - * Corresponds to the SSL_get_finished routine in OpenSSL and may be - * used to implement the tls-unique channel binding from RFC 5929. - */ - getFinished(): Buffer | undefined; - /** - * Returns an object representing the peer's certificate. - * The returned object has some properties corresponding to the field of the certificate. - * If detailed argument is true the full chain with issuer property will be returned, - * if false only the top certificate without issuer property. - * If the peer does not provide a certificate, it returns null or an empty object. - * @param detailed - If true; the full chain with issuer property will be returned. - * @returns An object representing the peer's certificate. - */ - getPeerCertificate(detailed: true): DetailedPeerCertificate; - getPeerCertificate(detailed?: false): PeerCertificate; - getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; - /** - * Returns the latest Finished message that is expected or has actually - * been received from the socket as part of a SSL/TLS handshake, or - * undefined if there is no Finished message so far. - * - * As the Finished messages are message digests of the complete - * handshake (with a total of 192 bits for TLS 1.0 and more for SSL - * 3.0), they can be used for external authentication procedures when - * the authentication provided by SSL/TLS is not desired or is not - * enough. - * - * Corresponds to the SSL_get_peer_finished routine in OpenSSL and may - * be used to implement the tls-unique channel binding from RFC 5929. - */ - getPeerFinished(): Buffer | undefined; - /** - * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. - * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. - * The value `null` will be returned for server sockets or disconnected client sockets. - * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. - * @returns negotiated SSL/TLS protocol version of the current connection - */ - getProtocol(): string | null; - /** - * Could be used to speed up handshake establishment when reconnecting to the server. - * @returns ASN.1 encoded TLS session or undefined if none was negotiated. - */ - getSession(): Buffer | undefined; - /** - * Returns a list of signature algorithms shared between the server and - * the client in the order of decreasing preference. - */ - getSharedSigalgs(): string[]; - /** - * NOTE: Works only with client TLS sockets. - * Useful only for debugging, for session reuse provide session option to tls.connect(). - * @returns TLS session ticket or undefined if none was negotiated. - */ - getTLSTicket(): Buffer | undefined; - /** - * Returns true if the session was reused, false otherwise. - */ - isSessionReused(): boolean; - /** - * Initiate TLS renegotiation process. - * - * NOTE: Can be used to request peer's certificate after the secure connection has been established. - * ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout. - * @param options - The options may contain the following fields: rejectUnauthorized, - * requestCert (See tls.createServer() for details). - * @param callback - callback(err) will be executed with null as err, once the renegotiation - * is successfully completed. - * @return `undefined` when socket is destroy, `false` if negotiaion can't be initiated. - */ - renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): undefined | boolean; - /** - * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). - * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by - * the TLS layer until the entire fragment is received and its integrity is verified; - * large fragments can span multiple roundtrips, and their processing can be delayed due to packet - * loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, - * which may decrease overall server throughput. - * @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512). - * @returns Returns true on success, false otherwise. - */ - setMaxSendFragment(size: number): boolean; - - /** - * Disables TLS renegotiation for this TLSSocket instance. Once called, - * attempts to renegotiate will trigger an 'error' event on the - * TLSSocket. - */ - disableRenegotiation(): void; - - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * - * Note: The format of the output is identical to the output of `openssl s_client - * -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's - * `SSL_trace()` function, the format is undocumented, can change without notice, - * and should not be relied on. - */ - enableTrace(): void; - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - addListener(event: "secureConnect", listener: () => void): this; - addListener(event: "session", listener: (session: Buffer) => void): this; - addListener(event: "keylog", listener: (line: Buffer) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "OCSPResponse", response: Buffer): boolean; - emit(event: "secureConnect"): boolean; - emit(event: "session", session: Buffer): boolean; - emit(event: "keylog", line: Buffer): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "OCSPResponse", listener: (response: Buffer) => void): this; - on(event: "secureConnect", listener: () => void): this; - on(event: "session", listener: (session: Buffer) => void): this; - on(event: "keylog", listener: (line: Buffer) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "OCSPResponse", listener: (response: Buffer) => void): this; - once(event: "secureConnect", listener: () => void): this; - once(event: "session", listener: (session: Buffer) => void): this; - once(event: "keylog", listener: (line: Buffer) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependListener(event: "secureConnect", listener: () => void): this; - prependListener(event: "session", listener: (session: Buffer) => void): this; - prependListener(event: "keylog", listener: (line: Buffer) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependOnceListener(event: "secureConnect", listener: () => void): this; - prependOnceListener(event: "session", listener: (session: Buffer) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this; - } - - interface CommonConnectionOptions { - /** - * An optional TLS context object from tls.createSecureContext() - */ - secureContext?: SecureContext; - - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * @default false - */ - enableTrace?: boolean; - /** - * If true the server will request a certificate from clients that - * connect and attempt to verify that certificate. Defaults to - * false. - */ - requestCert?: boolean; - /** - * An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) - */ - ALPNProtocols?: string[] | Uint8Array[] | Uint8Array; - /** - * SNICallback(servername, cb) A function that will be - * called if the client supports SNI TLS extension. Two arguments - * will be passed when called: servername and cb. SNICallback should - * invoke cb(null, ctx), where ctx is a SecureContext instance. - * (tls.createSecureContext(...) can be used to get a proper - * SecureContext.) If SNICallback wasn't provided the default callback - * with high-level API will be used (see below). - */ - SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - /** - * If true the server will reject any connection which is not - * authorized with the list of supplied CAs. This option only has an - * effect if requestCert is true. - * @default true - */ - rejectUnauthorized?: boolean; - } - - interface TlsOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * Abort the connection if the SSL/TLS handshake does not finish in the - * specified number of milliseconds. A 'tlsClientError' is emitted on - * the tls.Server object whenever a handshake times out. Default: - * 120000 (120 seconds). - */ - handshakeTimeout?: number; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number; - /** - * 48-bytes of cryptographically strong pseudo-random data. - */ - ticketKeys?: Buffer; - } - - interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { - host?: string; - port?: number; - path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. - socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket - checkServerIdentity?: typeof checkServerIdentity; - servername?: string; // SNI TLS Extension - session?: Buffer; - minDHSize?: number; - lookup?: net.LookupFunction; - timeout?: number; - } - - class Server extends net.Server { - /** - * The server.addContext() method adds a secure context that will be - * used if the client request's SNI name matches the supplied hostname - * (or wildcard). - */ - addContext(hostName: string, credentials: SecureContextOptions): void; - /** - * Returns the session ticket keys. - */ - getTicketKeys(): Buffer; - /** - * - * The server.setSecureContext() method replaces the - * secure context of an existing server. Existing connections to the - * server are not interrupted. - */ - setSecureContext(details: SecureContextOptions): void; - /** - * The server.setSecureContext() method replaces the secure context of - * an existing server. Existing connections to the server are not - * interrupted. - */ - setTicketKeys(keys: Buffer): void; - - /** - * events.EventEmitter - * 1. tlsClientError - * 2. newSession - * 3. OCSPRequest - * 4. resumeSession - * 5. secureConnection - * 6. keylog - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - addListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean; - emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; - emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; - emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - once(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - } - - interface SecurePair { - encrypted: TLSSocket; - cleartext: TLSSocket; - } - - type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; - - interface SecureContextOptions { - /** - * Optionally override the trusted CA certificates. Default is to trust - * the well-known CAs curated by Mozilla. Mozilla's CAs are completely - * replaced when CAs are explicitly specified using this option. - */ - ca?: string | Buffer | Array; - /** - * Cert chains in PEM format. One cert chain should be provided per - * private key. Each cert chain should consist of the PEM formatted - * certificate for a provided private key, followed by the PEM - * formatted intermediate certificates (if any), in order, and not - * including the root CA (the root CA must be pre-known to the peer, - * see ca). When providing multiple cert chains, they do not have to - * be in the same order as their private keys in key. If the - * intermediate certificates are not provided, the peer will not be - * able to validate the certificate, and the handshake will fail. - */ - cert?: string | Buffer | Array; - /** - * Colon-separated list of supported signature algorithms. The list - * can contain digest algorithms (SHA256, MD5 etc.), public key - * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g - * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). - */ - sigalgs?: string; - /** - * Cipher suite specification, replacing the default. For more - * information, see modifying the default cipher suite. Permitted - * ciphers can be obtained via tls.getCiphers(). Cipher names must be - * uppercased in order for OpenSSL to accept them. - */ - ciphers?: string; - /** - * Name of an OpenSSL engine which can provide the client certificate. - */ - clientCertEngine?: string; - /** - * PEM formatted CRLs (Certificate Revocation Lists). - */ - crl?: string | Buffer | Array; - /** - * Diffie Hellman parameters, required for Perfect Forward Secrecy. Use - * openssl dhparam to create the parameters. The key length must be - * greater than or equal to 1024 bits or else an error will be thrown. - * Although 1024 bits is permissible, use 2048 bits or larger for - * stronger security. If omitted or invalid, the parameters are - * silently discarded and DHE ciphers will not be available. - */ - dhparam?: string | Buffer; - /** - * A string describing a named curve or a colon separated list of curve - * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key - * agreement. Set to auto to select the curve automatically. Use - * crypto.getCurves() to obtain a list of available curve names. On - * recent releases, openssl ecparam -list_curves will also display the - * name and description of each available elliptic curve. Default: - * tls.DEFAULT_ECDH_CURVE. - */ - ecdhCurve?: string; - /** - * Attempt to use the server's cipher suite preferences instead of the - * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be - * set in secureOptions - */ - honorCipherOrder?: boolean; - /** - * Private keys in PEM format. PEM allows the option of private keys - * being encrypted. Encrypted keys will be decrypted with - * options.passphrase. Multiple keys using different algorithms can be - * provided either as an array of unencrypted key strings or buffers, - * or an array of objects in the form {pem: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted keys will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - key?: string | Buffer | Array; - /** - * Name of an OpenSSL engine to get private key from. Should be used - * together with privateKeyIdentifier. - */ - privateKeyEngine?: string; - /** - * Identifier of a private key managed by an OpenSSL engine. Should be - * used together with privateKeyEngine. Should not be set together with - * key, because both options define a private key in different ways. - */ - privateKeyIdentifier?: string; - /** - * Optionally set the maximum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. - * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using - * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to - * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. - */ - maxVersion?: SecureVersion; - /** - * Optionally set the minimum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. It is not recommended to use - * less than TLSv1.2, but it may be required for interoperability. - * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using - * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to - * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. - */ - minVersion?: SecureVersion; - /** - * Shared passphrase used for a single private key and/or a PFX. - */ - passphrase?: string; - /** - * PFX or PKCS12 encoded private key and certificate chain. pfx is an - * alternative to providing key and cert individually. PFX is usually - * encrypted, if it is, passphrase will be used to decrypt it. Multiple - * PFX can be provided either as an array of unencrypted PFX buffers, - * or an array of objects in the form {buf: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted PFX will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - pfx?: string | Buffer | Array; - /** - * Optionally affect the OpenSSL protocol behavior, which is not - * usually necessary. This should be used carefully if at all! Value is - * a numeric bitmask of the SSL_OP_* options from OpenSSL Options - */ - secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options - /** - * Legacy mechanism to select the TLS protocol version to use, it does - * not support independent control of the minimum and maximum version, - * and does not support limiting the protocol to TLSv1.3. Use - * minVersion and maxVersion instead. The possible values are listed as - * SSL_METHODS, use the function names as strings. For example, use - * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow - * any TLS protocol version up to TLSv1.3. It is not recommended to use - * TLS versions less than 1.2, but it may be required for - * interoperability. Default: none, see minVersion. - */ - secureProtocol?: string; - /** - * Opaque identifier used by servers to ensure session state is not - * shared between applications. Unused by clients. - */ - sessionIdContext?: string; - /** - * 48-bytes of cryptographically strong pseudo-random data. - * See Session Resumption for more information. - */ - ticketKeys?: Buffer; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number; - } - - interface SecureContext { - context: any; - } - - /* - * Verifies the certificate `cert` is issued to host `host`. - * @host The hostname to verify the certificate against - * @cert PeerCertificate representing the peer's certificate - * - * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined. - */ - function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined; - function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; - function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; - function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - /** - * @deprecated - */ - function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; - function createSecureContext(options?: SecureContextOptions): SecureContext; - function getCiphers(): string[]; - - /** - * The default curve name to use for ECDH key agreement in a tls server. - * The default value is 'auto'. See tls.createSecureContext() for further - * information. - */ - let DEFAULT_ECDH_CURVE: string; - /** - * The default value of the maxVersion option of - * tls.createSecureContext(). It can be assigned any of the supported TLS - * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: - * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets - * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the highest maximum - * is used. - */ - let DEFAULT_MAX_VERSION: SecureVersion; - /** - * The default value of the minVersion option of tls.createSecureContext(). - * It can be assigned any of the supported TLS protocol versions, - * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless - * changed using CLI options. Using --tls-min-v1.0 sets the default to - * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using - * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options - * are provided, the lowest minimum is used. - */ - let DEFAULT_MIN_VERSION: SecureVersion; - - /** - * An immutable array of strings representing the root certificates (in PEM - * format) used for verifying peer certificates. This is the default value - * of the ca option to tls.createSecureContext(). - */ - const rootCertificates: ReadonlyArray; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/trace_events.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/trace_events.d.ts deleted file mode 100644 index 1f3a89c4..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/trace_events.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -declare module "trace_events" { - /** - * The `Tracing` object is used to enable or disable tracing for sets of - * categories. Instances are created using the - * `trace_events.createTracing()` method. - * - * When created, the `Tracing` object is disabled. Calling the - * `tracing.enable()` method adds the categories to the set of enabled trace - * event categories. Calling `tracing.disable()` will remove the categories - * from the set of enabled trace event categories. - */ - interface Tracing { - /** - * A comma-separated list of the trace event categories covered by this - * `Tracing` object. - */ - readonly categories: string; - - /** - * Disables this `Tracing` object. - * - * Only trace event categories _not_ covered by other enabled `Tracing` - * objects and _not_ specified by the `--trace-event-categories` flag - * will be disabled. - */ - disable(): void; - - /** - * Enables this `Tracing` object for the set of categories covered by - * the `Tracing` object. - */ - enable(): void; - - /** - * `true` only if the `Tracing` object has been enabled. - */ - readonly enabled: boolean; - } - - interface CreateTracingOptions { - /** - * An array of trace category names. Values included in the array are - * coerced to a string when possible. An error will be thrown if the - * value cannot be coerced. - */ - categories: string[]; - } - - /** - * Creates and returns a Tracing object for the given set of categories. - */ - function createTracing(options: CreateTracingOptions): Tracing; - - /** - * Returns a comma-separated list of all currently-enabled trace event - * categories. The current set of enabled trace event categories is - * determined by the union of all currently-enabled `Tracing` objects and - * any categories enabled using the `--trace-event-categories` flag. - */ - function getEnabledCategories(): string | undefined; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/assert.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/assert.d.ts deleted file mode 100644 index a5032a94..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/assert.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -declare module 'assert' { - function assert(value: any, message?: string | Error): void; - namespace assert { - class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - code: 'ERR_ASSERTION'; - - constructor(options?: { - message?: string; - actual?: any; - expected?: any; - operator?: string; - stackStartFn?: Function; - }); - } - - class CallTracker { - calls(exact?: number): () => void; - calls any>(fn?: Func, exact?: number): Func; - report(): CallTrackerReportInformation[]; - verify(): void; - } - interface CallTrackerReportInformation { - message: string; - /** The actual number of times the function was called. */ - actual: number; - /** The number of times the function was expected to be called. */ - expected: number; - /** The name of the function that is wrapped. */ - operator: string; - /** A stack trace of the function. */ - stack: object; - } - - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: any, - expected: any, - message?: string | Error, - operator?: string, - stackStartFn?: Function, - ): never; - function ok(value: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use strictEqual() instead. */ - function equal(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notStrictEqual() instead. */ - function notEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */ - function deepEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */ - function notDeepEqual(actual: any, expected: any, message?: string | Error): void; - function strictEqual(actual: any, expected: any, message?: string | Error): void; - function notStrictEqual(actual: any, expected: any, message?: string | Error): void; - function deepStrictEqual(actual: any, expected: any, message?: string | Error): void; - function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; - - function throws(block: () => any, message?: string | Error): void; - function throws(block: () => any, error: RegExp | Function | Object | Error, message?: string | Error): void; - function doesNotThrow(block: () => any, message?: string | Error): void; - function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void; - - function ifError(value: any): void; - - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: RegExp | Function | Object | Error, - message?: string | Error, - ): Promise; - function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: RegExp | Function, - message?: string | Error, - ): Promise; - - const strict: typeof assert; - } - - export = assert; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/base.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/base.d.ts deleted file mode 100644 index 0276b86e..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/base.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.2. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.2/base.d.ts - Definitions specific to TypeScript 3.2 -// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with global and assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/globals.global.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/globals.global.d.ts deleted file mode 100644 index 8e854665..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: NodeJS.Global; diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/index.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/index.d.ts deleted file mode 100644 index 28aaabb2..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.3/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.2. -// This is requried to enable globalThis support for global in ts3.4 without causing errors -// This is requried to enable typing assert in ts3.7 without causing errors -// Typically type modifiations should be made in base.d.ts instead of here - -/// -/// -/// diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.6/base.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.6/base.d.ts deleted file mode 100644 index 06c2905a..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.6/base.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.4. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.4/base.d.ts - Definitions specific to TypeScript 3.4 -// - ~/ts3.4/index.d.ts - Definitions specific to TypeScript 3.4 with assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// - -// TypeScript 3.5-specific augmentations: -/// -/// diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.6/index.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.6/index.d.ts deleted file mode 100644 index 428717ba..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/ts3.6/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.4. -// This is required to enable typing assert in ts3.7 without causing errors -// Typically type modifications should be made in base.d.ts instead of here - -/// - -/// diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/tty.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/tty.d.ts deleted file mode 100644 index 78543663..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/tty.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -declare module "tty" { - import * as net from "net"; - - function isatty(fd: number): boolean; - class ReadStream extends net.Socket { - constructor(fd: number, options?: net.SocketConstructorOpts); - isRaw: boolean; - setRawMode(mode: boolean): this; - isTTY: boolean; - } - /** - * -1 - to the left from cursor - * 0 - the entire line - * 1 - to the right from cursor - */ - type Direction = -1 | 0 | 1; - class WriteStream extends net.Socket { - constructor(fd: number); - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "resize", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "resize"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "resize", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "resize", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "resize", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "resize", listener: () => void): this; - - /** - * Clears the current line of this WriteStream in a direction identified by `dir`. - */ - clearLine(dir: Direction, callback?: () => void): boolean; - /** - * Clears this `WriteStream` from the current cursor down. - */ - clearScreenDown(callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor to the specified position. - */ - cursorTo(x: number, y?: number, callback?: () => void): boolean; - cursorTo(x: number, callback: () => void): boolean; - /** - * Moves this WriteStream's cursor relative to its current position. - */ - moveCursor(dx: number, dy: number, callback?: () => void): boolean; - /** - * @default `process.env` - */ - getColorDepth(env?: {}): number; - hasColors(depth?: number): boolean; - hasColors(env?: {}): boolean; - hasColors(depth: number, env?: {}): boolean; - getWindowSize(): [number, number]; - columns: number; - rows: number; - isTTY: boolean; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/url.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/url.d.ts deleted file mode 100644 index 23e02c5d..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/url.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -declare module "url" { - import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring'; - - // Input to `url.format` - interface UrlObject { - auth?: string | null; - hash?: string | null; - host?: string | null; - hostname?: string | null; - href?: string | null; - path?: string | null; - pathname?: string | null; - protocol?: string | null; - search?: string | null; - slashes?: boolean | null; - port?: string | number | null; - query?: string | null | ParsedUrlQueryInput; - } - - // Output of `url.parse` - interface Url { - auth: string | null; - hash: string | null; - host: string | null; - hostname: string | null; - href: string; - path: string | null; - pathname: string | null; - protocol: string | null; - search: string | null; - slashes: boolean | null; - port: string | null; - query: string | null | ParsedUrlQuery; - } - - interface UrlWithParsedQuery extends Url { - query: ParsedUrlQuery; - } - - interface UrlWithStringQuery extends Url { - query: string | null; - } - - function parse(urlStr: string): UrlWithStringQuery; - function parse(urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery; - function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; - function parse(urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; - - function format(URL: URL, options?: URLFormatOptions): string; - function format(urlObject: UrlObject | string): string; - function resolve(from: string, to: string): string; - - function domainToASCII(domain: string): string; - function domainToUnicode(domain: string): string; - - /** - * This function ensures the correct decodings of percent-encoded characters as - * well as ensuring a cross-platform valid absolute path string. - * @param url The file URL string or URL object to convert to a path. - */ - function fileURLToPath(url: string | URL): string; - - /** - * This function ensures that path is resolved absolutely, and that the URL - * control characters are correctly encoded when converting into a File URL. - * @param url The path to convert to a File URL. - */ - function pathToFileURL(url: string): URL; - - interface URLFormatOptions { - auth?: boolean; - fragment?: boolean; - search?: boolean; - unicode?: boolean; - } - - class URL { - constructor(input: string, base?: string | URL); - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - readonly searchParams: URLSearchParams; - username: string; - toString(): string; - toJSON(): string; - } - - class URLSearchParams implements Iterable<[string, string]> { - constructor(init?: URLSearchParams | string | { [key: string]: string | ReadonlyArray | undefined } | Iterable<[string, string]> | ReadonlyArray<[string, string]>); - append(name: string, value: string): void; - delete(name: string): void; - entries(): IterableIterator<[string, string]>; - forEach(callback: (value: string, name: string, searchParams: this) => void): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - keys(): IterableIterator; - set(name: string, value: string): void; - sort(): void; - toString(): string; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[string, string]>; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/util.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/util.d.ts deleted file mode 100644 index de7b56fc..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/util.d.ts +++ /dev/null @@ -1,200 +0,0 @@ -declare module "util" { - interface InspectOptions extends NodeJS.InspectOptions { } - function format(format: any, ...param: any[]): string; - function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string; - /** @deprecated since v0.11.3 - use a third party module instead. */ - function log(string: string): void; - function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - function inspect(object: any, options: InspectOptions): string; - namespace inspect { - const custom: unique symbol; - let colors: { - [color: string]: [number, number] | undefined - }; - let styles: { - [style: string]: string | undefined - }; - let defaultOptions: InspectOptions; - /** - * Allows changing inspect settings from the repl. - */ - let replDefaults: InspectOptions; - } - /** @deprecated since v4.0.0 - use `Array.isArray()` instead. */ - function isArray(object: any): object is any[]; - /** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */ - function isRegExp(object: any): object is RegExp; - /** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */ - function isDate(object: any): object is Date; - /** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */ - function isError(object: any): object is Error; - function inherits(constructor: any, superConstructor: any): void; - function debuglog(key: string): (msg: string, ...param: any[]) => void; - /** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */ - function isBoolean(object: any): object is boolean; - /** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */ - function isBuffer(object: any): object is Buffer; - /** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */ - function isFunction(object: any): boolean; - /** @deprecated since v4.0.0 - use `value === null` instead. */ - function isNull(object: any): object is null; - /** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */ - function isNullOrUndefined(object: any): object is null | undefined; - /** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */ - function isNumber(object: any): object is number; - /** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */ - function isObject(object: any): boolean; - /** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */ - function isPrimitive(object: any): boolean; - /** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */ - function isString(object: any): object is string; - /** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */ - function isSymbol(object: any): object is symbol; - /** @deprecated since v4.0.0 - use `value === undefined` instead. */ - function isUndefined(object: any): object is undefined; - function deprecate(fn: T, message: string, code?: string): T; - function isDeepStrictEqual(val1: any, val2: any): boolean; - - interface CustomPromisify extends Function { - __promisify__: TCustom; - } - - function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - - function promisify(fn: CustomPromisify): TCustom; - function promisify(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise; - function promisify(fn: (callback: (err?: any) => void) => void): () => Promise; - function promisify(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void): - (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void): - (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - function promisify(fn: Function): Function; - namespace promisify { - const custom: unique symbol; - } - - namespace types { - function isAnyArrayBuffer(object: any): object is ArrayBufferLike; - function isArgumentsObject(object: any): object is IArguments; - function isArrayBuffer(object: any): object is ArrayBuffer; - function isArrayBufferView(object: any): object is NodeJS.ArrayBufferView; - function isAsyncFunction(object: any): boolean; - function isBigInt64Array(value: any): value is BigInt64Array; - function isBigUint64Array(value: any): value is BigUint64Array; - function isBooleanObject(object: any): object is Boolean; - function isBoxedPrimitive(object: any): object is String | Number | BigInt | Boolean | Symbol; - function isDataView(object: any): object is DataView; - function isDate(object: any): object is Date; - function isExternal(object: any): boolean; - function isFloat32Array(object: any): object is Float32Array; - function isFloat64Array(object: any): object is Float64Array; - function isGeneratorFunction(object: any): object is GeneratorFunction; - function isGeneratorObject(object: any): object is Generator; - function isInt8Array(object: any): object is Int8Array; - function isInt16Array(object: any): object is Int16Array; - function isInt32Array(object: any): object is Int32Array; - function isMap( - object: T | {}, - ): object is T extends ReadonlyMap - ? unknown extends T - ? never - : ReadonlyMap - : Map; - function isMapIterator(object: any): boolean; - function isModuleNamespaceObject(value: any): boolean; - function isNativeError(object: any): object is Error; - function isNumberObject(object: any): object is Number; - function isPromise(object: any): object is Promise; - function isProxy(object: any): boolean; - function isRegExp(object: any): object is RegExp; - function isSet( - object: T | {}, - ): object is T extends ReadonlySet - ? unknown extends T - ? never - : ReadonlySet - : Set; - function isSetIterator(object: any): boolean; - function isSharedArrayBuffer(object: any): object is SharedArrayBuffer; - function isStringObject(object: any): object is String; - function isSymbolObject(object: any): object is Symbol; - function isTypedArray(object: any): object is NodeJS.TypedArray; - function isUint8Array(object: any): object is Uint8Array; - function isUint8ClampedArray(object: any): object is Uint8ClampedArray; - function isUint16Array(object: any): object is Uint16Array; - function isUint32Array(object: any): object is Uint32Array; - function isWeakMap(object: any): object is WeakMap; - function isWeakSet(object: any): object is WeakSet; - /** @deprecated Removed in v14.0.0 */ - function isWebAssemblyCompiledModule(object: any): boolean; - } - - class TextDecoder { - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; - constructor( - encoding?: string, - options?: { fatal?: boolean; ignoreBOM?: boolean } - ); - decode( - input?: NodeJS.ArrayBufferView | ArrayBuffer | null, - options?: { stream?: boolean } - ): string; - } - - interface EncodeIntoResult { - /** - * The read Unicode code units of input. - */ - - read: number; - /** - * The written UTF-8 bytes of output. - */ - written: number; - } - - class TextEncoder { - readonly encoding: string; - encode(input?: string): Uint8Array; - encodeInto(input: string, output: Uint8Array): EncodeIntoResult; - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/v8.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/v8.d.ts deleted file mode 100644 index 2e2706e2..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/v8.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -declare module "v8" { - import { Readable } from "stream"; - - interface HeapSpaceInfo { - space_name: string; - space_size: number; - space_used_size: number; - space_available_size: number; - physical_space_size: number; - } - - // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ - type DoesZapCodeSpaceFlag = 0 | 1; - - interface HeapInfo { - total_heap_size: number; - total_heap_size_executable: number; - total_physical_size: number; - total_available_size: number; - used_heap_size: number; - heap_size_limit: number; - malloced_memory: number; - peak_malloced_memory: number; - does_zap_garbage: DoesZapCodeSpaceFlag; - number_of_native_contexts: number; - number_of_detached_contexts: number; - } - - interface HeapCodeStatistics { - code_and_metadata_size: number; - bytecode_and_metadata_size: number; - external_script_source_size: number; - } - - /** - * Returns an integer representing a "version tag" derived from the V8 version, command line flags and detected CPU features. - * This is useful for determining whether a vm.Script cachedData buffer is compatible with this instance of V8. - */ - function cachedDataVersionTag(): number; - - function getHeapStatistics(): HeapInfo; - function getHeapSpaceStatistics(): HeapSpaceInfo[]; - function setFlagsFromString(flags: string): void; - /** - * Generates a snapshot of the current V8 heap and returns a Readable - * Stream that may be used to read the JSON serialized representation. - * This conversation was marked as resolved by joyeecheung - * This JSON stream format is intended to be used with tools such as - * Chrome DevTools. The JSON schema is undocumented and specific to the - * V8 engine, and may change from one version of V8 to the next. - */ - function getHeapSnapshot(): Readable; - - /** - * - * @param fileName The file path where the V8 heap snapshot is to be - * saved. If not specified, a file name with the pattern - * `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be - * generated, where `{pid}` will be the PID of the Node.js process, - * `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from - * the main Node.js thread or the id of a worker thread. - */ - function writeHeapSnapshot(fileName?: string): string; - - function getHeapCodeStatistics(): HeapCodeStatistics; - - /** - * @experimental - */ - class Serializer { - /** - * Writes out a header, which includes the serialization format version. - */ - writeHeader(): void; - - /** - * Serializes a JavaScript value and adds the serialized representation to the internal buffer. - * This throws an error if value cannot be serialized. - */ - writeValue(val: any): boolean; - - /** - * Returns the stored internal buffer. - * This serializer should not be used once the buffer is released. - * Calling this method results in undefined behavior if a previous write has failed. - */ - releaseBuffer(): Buffer; - - /** - * Marks an ArrayBuffer as having its contents transferred out of band.\ - * Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer(). - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - - /** - * Write a raw 32-bit unsigned integer. - */ - writeUint32(value: number): void; - - /** - * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. - */ - writeUint64(hi: number, lo: number): void; - - /** - * Write a JS number value. - */ - writeDouble(value: number): void; - - /** - * Write raw bytes into the serializer’s internal buffer. - * The deserializer will require a way to compute the length of the buffer. - */ - writeRawBytes(buffer: NodeJS.TypedArray): void; - } - - /** - * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, - * and only stores the part of their underlying `ArrayBuffers` that they are referring to. - * @experimental - */ - class DefaultSerializer extends Serializer { - } - - /** - * @experimental - */ - class Deserializer { - constructor(data: NodeJS.TypedArray); - /** - * Reads and validates a header (including the format version). - * May, for example, reject an invalid or unsupported wire format. - * In that case, an Error is thrown. - */ - readHeader(): boolean; - - /** - * Deserializes a JavaScript value from the buffer and returns it. - */ - readValue(): any; - - /** - * Marks an ArrayBuffer as having its contents transferred out of band. - * Pass the corresponding `ArrayBuffer` in the serializing context to serializer.transferArrayBuffer() - * (or return the id from serializer._getSharedArrayBufferId() in the case of SharedArrayBuffers). - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - - /** - * Reads the underlying wire format version. - * Likely mostly to be useful to legacy code reading old wire format versions. - * May not be called before .readHeader(). - */ - getWireFormatVersion(): number; - - /** - * Read a raw 32-bit unsigned integer and return it. - */ - readUint32(): number; - - /** - * Read a raw 64-bit unsigned integer and return it as an array [hi, lo] with two 32-bit unsigned integer entries. - */ - readUint64(): [number, number]; - - /** - * Read a JS number value. - */ - readDouble(): number; - - /** - * Read raw bytes from the deserializer’s internal buffer. - * The length parameter must correspond to the length of the buffer that was passed to serializer.writeRawBytes(). - */ - readRawBytes(length: number): Buffer; - } - - /** - * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, - * and only stores the part of their underlying `ArrayBuffers` that they are referring to. - * @experimental - */ - class DefaultDeserializer extends Deserializer { - } - - /** - * Uses a `DefaultSerializer` to serialize value into a buffer. - * @experimental - */ - function serialize(value: any): Buffer; - - /** - * Uses a `DefaultDeserializer` with default options to read a JS value from a buffer. - * @experimental - */ - function deserialize(data: NodeJS.TypedArray): any; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/vm.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/vm.d.ts deleted file mode 100644 index c0dcaae8..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/vm.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -declare module "vm" { - interface Context { - [key: string]: any; - } - interface BaseOptions { - /** - * Specifies the filename used in stack traces produced by this script. - * Default: `''`. - */ - filename?: string; - /** - * Specifies the line number offset that is displayed in stack traces produced by this script. - * Default: `0`. - */ - lineOffset?: number; - /** - * Specifies the column number offset that is displayed in stack traces produced by this script. - * Default: `0` - */ - columnOffset?: number; - } - interface ScriptOptions extends BaseOptions { - displayErrors?: boolean; - timeout?: number; - cachedData?: Buffer; - produceCachedData?: boolean; - } - interface RunningScriptOptions extends BaseOptions { - /** - * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * Default: `true`. - */ - displayErrors?: boolean; - /** - * Specifies the number of milliseconds to execute code before terminating execution. - * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer. - */ - timeout?: number; - /** - * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. - * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that. - * If execution is terminated, an `Error` will be thrown. - * Default: `false`. - */ - breakOnSigint?: boolean; - } - interface CompileFunctionOptions extends BaseOptions { - /** - * Provides an optional data with V8's code cache data for the supplied source. - */ - cachedData?: Buffer; - /** - * Specifies whether to produce new cache data. - * Default: `false`, - */ - produceCachedData?: boolean; - /** - * The sandbox/context in which the said function should be compiled in. - */ - parsingContext?: Context; - - /** - * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling - */ - contextExtensions?: Object[]; - } - - interface CreateContextOptions { - /** - * Human-readable name of the newly created context. - * @default 'VM Context i' Where i is an ascending numerical index of the created context. - */ - name?: string; - /** - * Corresponds to the newly created context for display purposes. - * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary), - * like the value of the `url.origin` property of a URL object. - * Most notably, this string should omit the trailing slash, as that denotes a path. - * @default '' - */ - origin?: string; - codeGeneration?: { - /** - * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc) - * will throw an EvalError. - * @default true - */ - strings?: boolean; - /** - * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError. - * @default true - */ - wasm?: boolean; - }; - } - - class Script { - constructor(code: string, options?: ScriptOptions); - runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any; - runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any; - runInThisContext(options?: RunningScriptOptions): any; - createCachedData(): Buffer; - } - function createContext(sandbox?: Context, options?: CreateContextOptions): Context; - function isContext(sandbox: Context): boolean; - function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any; - function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any; - function runInThisContext(code: string, options?: RunningScriptOptions | string): any; - function compileFunction(code: string, params?: ReadonlyArray, options?: CompileFunctionOptions): Function; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/wasi.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/wasi.d.ts deleted file mode 100644 index 21f64fa3..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/wasi.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -declare module 'wasi' { - interface WASIOptions { - /** - * An array of strings that the WebAssembly application will - * see as command line arguments. The first argument is the virtual path to the - * WASI command itself. - */ - args?: string[]; - - /** - * An object similar to `process.env` that the WebAssembly - * application will see as its environment. - */ - env?: object; - - /** - * This object represents the WebAssembly application's - * sandbox directory structure. The string keys of `preopens` are treated as - * directories within the sandbox. The corresponding values in `preopens` are - * the real paths to those directories on the host machine. - */ - preopens?: NodeJS.Dict; - - /** - * By default, WASI applications terminate the Node.js - * process via the `__wasi_proc_exit()` function. Setting this option to `true` - * causes `wasi.start()` to return the exit code rather than terminate the - * process. - * @default false - */ - returnOnExit?: boolean; - } - - class WASI { - constructor(options?: WASIOptions); - /** - * - * Attempt to begin execution of `instance` by invoking its `_start()` export. - * If `instance` does not contain a `_start()` export, then `start()` attempts to - * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports - * is present on `instance`, then `start()` does nothing. - * - * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named - * `memory`. If `instance` does not have a `memory` export an exception is thrown. - */ - start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib. - - /** - * Is an object that implements the WASI system call API. This object - * should be passed as the `wasi_snapshot_preview1` import during the instantiation of a - * [`WebAssembly.Instance`][]. - */ - readonly wasiImport: NodeJS.Dict; // TODO: Narrow to DOM types - } -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/worker_threads.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/worker_threads.d.ts deleted file mode 100644 index f5d4ea75..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/worker_threads.d.ts +++ /dev/null @@ -1,207 +0,0 @@ -declare module "worker_threads" { - import { Context } from "vm"; - import { EventEmitter } from "events"; - import { Readable, Writable } from "stream"; - import { promises } from "fs"; - - const isMainThread: boolean; - const parentPort: null | MessagePort; - const resourceLimits: ResourceLimits; - const SHARE_ENV: unique symbol; - const threadId: number; - const workerData: any; - - class MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; - } - - type TransferListItem = ArrayBuffer | MessagePort | promises.FileHandle; - - class MessagePort extends EventEmitter { - close(): void; - postMessage(value: any, transferList?: ReadonlyArray): void; - ref(): void; - unref(): void; - start(): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "message", listener: (value: any) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "message", value: any): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "message", listener: (value: any) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "message", listener: (value: any) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "message", listener: (value: any) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "message", listener: (value: any) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "message", listener: (value: any) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - off(event: "close", listener: () => void): this; - off(event: "message", listener: (value: any) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface WorkerOptions { - eval?: boolean; - env?: NodeJS.ProcessEnv | typeof SHARE_ENV; - workerData?: any; - stdin?: boolean; - stdout?: boolean; - stderr?: boolean; - execArgv?: string[]; - resourceLimits?: ResourceLimits; - /** - * Additional data to send in the first worker message. - */ - transferList?: TransferListItem[]; - trackUnmanagedFds?: boolean; - } - - interface ResourceLimits { - /** - * The maximum size of a heap space for recently created objects. - */ - maxYoungGenerationSizeMb?: number; - /** - * The maximum size of the main heap in MB. - */ - maxOldGenerationSizeMb?: number; - /** - * The size of a pre-allocated memory range used for generated code. - */ - codeRangeSizeMb?: number; - /** - * The default maximum stack size for the thread. Small values may lead to unusable Worker instances. - * @default 4 - */ - stackSizeMb?: number; - } - - class Worker extends EventEmitter { - readonly stdin: Writable | null; - readonly stdout: Readable; - readonly stderr: Readable; - readonly threadId: number; - readonly resourceLimits?: ResourceLimits; - - constructor(filename: string, options?: WorkerOptions); - - postMessage(value: any, transferList?: ReadonlyArray): void; - ref(): void; - unref(): void; - /** - * Stop all JavaScript execution in the worker thread as soon as possible. - * Returns a Promise for the exit code that is fulfilled when the `exit` event is emitted. - */ - terminate(): Promise; - - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (exitCode: number) => void): this; - addListener(event: "message", listener: (value: any) => void): this; - addListener(event: "messageerror", listener: (error: Error) => void): this; - addListener(event: "online", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "error", err: Error): boolean; - emit(event: "exit", exitCode: number): boolean; - emit(event: "message", value: any): boolean; - emit(event: "messageerror", error: Error): boolean; - emit(event: "online"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (exitCode: number) => void): this; - on(event: "message", listener: (value: any) => void): this; - on(event: "messageerror", listener: (error: Error) => void): this; - on(event: "online", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (exitCode: number) => void): this; - once(event: "message", listener: (value: any) => void): this; - once(event: "messageerror", listener: (error: Error) => void): this; - once(event: "online", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (exitCode: number) => void): this; - prependListener(event: "message", listener: (value: any) => void): this; - prependListener(event: "messageerror", listener: (error: Error) => void): this; - prependListener(event: "online", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "exit", listener: (exitCode: number) => void): this; - prependOnceListener(event: "message", listener: (value: any) => void): this; - prependOnceListener(event: "messageerror", listener: (error: Error) => void): this; - prependOnceListener(event: "online", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "exit", listener: (exitCode: number) => void): this; - removeListener(event: "message", listener: (value: any) => void): this; - removeListener(event: "messageerror", listener: (error: Error) => void): this; - removeListener(event: "online", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - off(event: "error", listener: (err: Error) => void): this; - off(event: "exit", listener: (exitCode: number) => void): this; - off(event: "message", listener: (value: any) => void): this; - off(event: "messageerror", listener: (error: Error) => void): this; - off(event: "online", listener: () => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - } - - /** - * Mark an object as not transferable. - * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored. - * - * In particular, this makes sense for objects that can be cloned, rather than transferred, - * and which are used by other objects on the sending side. For example, Node.js marks - * the `ArrayBuffer`s it uses for its Buffer pool with this. - * - * This operation cannot be undone. - */ - function markAsUntransferable(object: object): void; - - /** - * Transfer a `MessagePort` to a different `vm` Context. The original `port` - * object will be rendered unusable, and the returned `MessagePort` instance will - * take its place. - * - * The returned `MessagePort` will be an object in the target context, and will - * inherit from its global `Object` class. Objects passed to the - * `port.onmessage()` listener will also be created in the target context - * and inherit from its global `Object` class. - * - * However, the created `MessagePort` will no longer inherit from - * `EventEmitter`, and only `port.onmessage()` can be used to receive - * events using it. - */ - function moveMessagePortToContext(port: MessagePort, context: Context): MessagePort; - - /** - * Receive a single message from a given `MessagePort`. If no message is available, - * `undefined` is returned, otherwise an object with a single `message` property - * that contains the message payload, corresponding to the oldest message in the - * `MessagePort`’s queue. - */ - function receiveMessageOnPort(port: MessagePort): { message: any } | undefined; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/@types/node/zlib.d.ts b/node_modules/@grpc/grpc-js/node_modules/@types/node/zlib.d.ts deleted file mode 100644 index 41daa9c1..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/@types/node/zlib.d.ts +++ /dev/null @@ -1,356 +0,0 @@ -declare module "zlib" { - import * as stream from "stream"; - - interface ZlibOptions { - /** - * @default constants.Z_NO_FLUSH - */ - flush?: number; - /** - * @default constants.Z_FINISH - */ - finishFlush?: number; - /** - * @default 16*1024 - */ - chunkSize?: number; - windowBits?: number; - level?: number; // compression only - memLevel?: number; // compression only - strategy?: number; // compression only - dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default - info?: boolean; - maxOutputLength?: number; - } - - interface BrotliOptions { - /** - * @default constants.BROTLI_OPERATION_PROCESS - */ - flush?: number; - /** - * @default constants.BROTLI_OPERATION_FINISH - */ - finishFlush?: number; - /** - * @default 16*1024 - */ - chunkSize?: number; - params?: { - /** - * Each key is a `constants.BROTLI_*` constant. - */ - [key: number]: boolean | number; - }; - maxOutputLength?: number; - } - - interface Zlib { - /** @deprecated Use bytesWritten instead. */ - readonly bytesRead: number; - readonly bytesWritten: number; - shell?: boolean | string; - close(callback?: () => void): void; - flush(kind?: number, callback?: () => void): void; - flush(callback?: () => void): void; - } - - interface ZlibParams { - params(level: number, strategy: number, callback: () => void): void; - } - - interface ZlibReset { - reset(): void; - } - - interface BrotliCompress extends stream.Transform, Zlib { } - interface BrotliDecompress extends stream.Transform, Zlib { } - interface Gzip extends stream.Transform, Zlib { } - interface Gunzip extends stream.Transform, Zlib { } - interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams { } - interface Inflate extends stream.Transform, Zlib, ZlibReset { } - interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams { } - interface InflateRaw extends stream.Transform, Zlib, ZlibReset { } - interface Unzip extends stream.Transform, Zlib { } - - function createBrotliCompress(options?: BrotliOptions): BrotliCompress; - function createBrotliDecompress(options?: BrotliOptions): BrotliDecompress; - function createGzip(options?: ZlibOptions): Gzip; - function createGunzip(options?: ZlibOptions): Gunzip; - function createDeflate(options?: ZlibOptions): Deflate; - function createInflate(options?: ZlibOptions): Inflate; - function createDeflateRaw(options?: ZlibOptions): DeflateRaw; - function createInflateRaw(options?: ZlibOptions): InflateRaw; - function createUnzip(options?: ZlibOptions): Unzip; - - type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView; - - type CompressCallback = (error: Error | null, result: Buffer) => void; - - function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; - function brotliCompress(buf: InputType, callback: CompressCallback): void; - namespace brotliCompress { - function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; - } - - function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer; - - function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; - function brotliDecompress(buf: InputType, callback: CompressCallback): void; - namespace brotliDecompress { - function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; - } - - function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer; - - function deflate(buf: InputType, callback: CompressCallback): void; - function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace deflate { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function deflateSync(buf: InputType, options?: ZlibOptions): Buffer; - - function deflateRaw(buf: InputType, callback: CompressCallback): void; - function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace deflateRaw { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; - - function gzip(buf: InputType, callback: CompressCallback): void; - function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace gzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function gzipSync(buf: InputType, options?: ZlibOptions): Buffer; - - function gunzip(buf: InputType, callback: CompressCallback): void; - function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace gunzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer; - - function inflate(buf: InputType, callback: CompressCallback): void; - function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace inflate { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function inflateSync(buf: InputType, options?: ZlibOptions): Buffer; - - function inflateRaw(buf: InputType, callback: CompressCallback): void; - function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace inflateRaw { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; - - function unzip(buf: InputType, callback: CompressCallback): void; - function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace unzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function unzipSync(buf: InputType, options?: ZlibOptions): Buffer; - - namespace constants { - const BROTLI_DECODE: number; - const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number; - const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number; - const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number; - const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number; - const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number; - const BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number; - const BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number; - const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number; - const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number; - const BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number; - const BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number; - const BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number; - const BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number; - const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number; - const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number; - const BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number; - const BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number; - const BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number; - const BROTLI_DECODER_ERROR_FORMAT_RESERVED: number; - const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number; - const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number; - const BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number; - const BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number; - const BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number; - const BROTLI_DECODER_ERROR_UNREACHABLE: number; - const BROTLI_DECODER_NEEDS_MORE_INPUT: number; - const BROTLI_DECODER_NEEDS_MORE_OUTPUT: number; - const BROTLI_DECODER_NO_ERROR: number; - const BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number; - const BROTLI_DECODER_PARAM_LARGE_WINDOW: number; - const BROTLI_DECODER_RESULT_ERROR: number; - const BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number; - const BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number; - const BROTLI_DECODER_RESULT_SUCCESS: number; - const BROTLI_DECODER_SUCCESS: number; - - const BROTLI_DEFAULT_MODE: number; - const BROTLI_DEFAULT_QUALITY: number; - const BROTLI_DEFAULT_WINDOW: number; - const BROTLI_ENCODE: number; - const BROTLI_LARGE_MAX_WINDOW_BITS: number; - const BROTLI_MAX_INPUT_BLOCK_BITS: number; - const BROTLI_MAX_QUALITY: number; - const BROTLI_MAX_WINDOW_BITS: number; - const BROTLI_MIN_INPUT_BLOCK_BITS: number; - const BROTLI_MIN_QUALITY: number; - const BROTLI_MIN_WINDOW_BITS: number; - - const BROTLI_MODE_FONT: number; - const BROTLI_MODE_GENERIC: number; - const BROTLI_MODE_TEXT: number; - - const BROTLI_OPERATION_EMIT_METADATA: number; - const BROTLI_OPERATION_FINISH: number; - const BROTLI_OPERATION_FLUSH: number; - const BROTLI_OPERATION_PROCESS: number; - - const BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number; - const BROTLI_PARAM_LARGE_WINDOW: number; - const BROTLI_PARAM_LGBLOCK: number; - const BROTLI_PARAM_LGWIN: number; - const BROTLI_PARAM_MODE: number; - const BROTLI_PARAM_NDIRECT: number; - const BROTLI_PARAM_NPOSTFIX: number; - const BROTLI_PARAM_QUALITY: number; - const BROTLI_PARAM_SIZE_HINT: number; - - const DEFLATE: number; - const DEFLATERAW: number; - const GUNZIP: number; - const GZIP: number; - const INFLATE: number; - const INFLATERAW: number; - const UNZIP: number; - - const Z_NO_FLUSH: number; - const Z_PARTIAL_FLUSH: number; - const Z_SYNC_FLUSH: number; - const Z_FULL_FLUSH: number; - const Z_FINISH: number; - const Z_BLOCK: number; - const Z_TREES: number; - - const Z_OK: number; - const Z_STREAM_END: number; - const Z_NEED_DICT: number; - const Z_ERRNO: number; - const Z_STREAM_ERROR: number; - const Z_DATA_ERROR: number; - const Z_MEM_ERROR: number; - const Z_BUF_ERROR: number; - const Z_VERSION_ERROR: number; - - const Z_NO_COMPRESSION: number; - const Z_BEST_SPEED: number; - const Z_BEST_COMPRESSION: number; - const Z_DEFAULT_COMPRESSION: number; - - const Z_FILTERED: number; - const Z_HUFFMAN_ONLY: number; - const Z_RLE: number; - const Z_FIXED: number; - const Z_DEFAULT_STRATEGY: number; - - const Z_DEFAULT_WINDOWBITS: number; - const Z_MIN_WINDOWBITS: number; - const Z_MAX_WINDOWBITS: number; - - const Z_MIN_CHUNK: number; - const Z_MAX_CHUNK: number; - const Z_DEFAULT_CHUNK: number; - - const Z_MIN_MEMLEVEL: number; - const Z_MAX_MEMLEVEL: number; - const Z_DEFAULT_MEMLEVEL: number; - - const Z_MIN_LEVEL: number; - const Z_MAX_LEVEL: number; - const Z_DEFAULT_LEVEL: number; - - const ZLIB_VERNUM: number; - } - - // Allowed flush values. - /** @deprecated Use `constants.Z_NO_FLUSH` */ - const Z_NO_FLUSH: number; - /** @deprecated Use `constants.Z_PARTIAL_FLUSH` */ - const Z_PARTIAL_FLUSH: number; - /** @deprecated Use `constants.Z_SYNC_FLUSH` */ - const Z_SYNC_FLUSH: number; - /** @deprecated Use `constants.Z_FULL_FLUSH` */ - const Z_FULL_FLUSH: number; - /** @deprecated Use `constants.Z_FINISH` */ - const Z_FINISH: number; - /** @deprecated Use `constants.Z_BLOCK` */ - const Z_BLOCK: number; - /** @deprecated Use `constants.Z_TREES` */ - const Z_TREES: number; - - // Return codes for the compression/decompression functions. - // Negative values are errors, positive values are used for special but normal events. - /** @deprecated Use `constants.Z_OK` */ - const Z_OK: number; - /** @deprecated Use `constants.Z_STREAM_END` */ - const Z_STREAM_END: number; - /** @deprecated Use `constants.Z_NEED_DICT` */ - const Z_NEED_DICT: number; - /** @deprecated Use `constants.Z_ERRNO` */ - const Z_ERRNO: number; - /** @deprecated Use `constants.Z_STREAM_ERROR` */ - const Z_STREAM_ERROR: number; - /** @deprecated Use `constants.Z_DATA_ERROR` */ - const Z_DATA_ERROR: number; - /** @deprecated Use `constants.Z_MEM_ERROR` */ - const Z_MEM_ERROR: number; - /** @deprecated Use `constants.Z_BUF_ERROR` */ - const Z_BUF_ERROR: number; - /** @deprecated Use `constants.Z_VERSION_ERROR` */ - const Z_VERSION_ERROR: number; - - // Compression levels. - /** @deprecated Use `constants.Z_NO_COMPRESSION` */ - const Z_NO_COMPRESSION: number; - /** @deprecated Use `constants.Z_BEST_SPEED` */ - const Z_BEST_SPEED: number; - /** @deprecated Use `constants.Z_BEST_COMPRESSION` */ - const Z_BEST_COMPRESSION: number; - /** @deprecated Use `constants.Z_DEFAULT_COMPRESSION` */ - const Z_DEFAULT_COMPRESSION: number; - - // Compression strategy. - /** @deprecated Use `constants.Z_FILTERED` */ - const Z_FILTERED: number; - /** @deprecated Use `constants.Z_HUFFMAN_ONLY` */ - const Z_HUFFMAN_ONLY: number; - /** @deprecated Use `constants.Z_RLE` */ - const Z_RLE: number; - /** @deprecated Use `constants.Z_FIXED` */ - const Z_FIXED: number; - /** @deprecated Use `constants.Z_DEFAULT_STRATEGY` */ - const Z_DEFAULT_STRATEGY: number; - - /** @deprecated */ - const Z_BINARY: number; - /** @deprecated */ - const Z_TEXT: number; - /** @deprecated */ - const Z_ASCII: number; - /** @deprecated */ - const Z_UNKNOWN: number; - /** @deprecated */ - const Z_DEFLATED: number; -} diff --git a/node_modules/@grpc/grpc-js/node_modules/semver/CHANGELOG.md b/node_modules/@grpc/grpc-js/node_modules/semver/CHANGELOG.md deleted file mode 100644 index f567dd3f..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/semver/CHANGELOG.md +++ /dev/null @@ -1,70 +0,0 @@ -# changes log - -## 6.2.0 - -* Coerce numbers to strings when passed to semver.coerce() -* Add `rtl` option to coerce from right to left - -## 6.1.3 - -* Handle X-ranges properly in includePrerelease mode - -## 6.1.2 - -* Do not throw when testing invalid version strings - -## 6.1.1 - -* Add options support for semver.coerce() -* Handle undefined version passed to Range.test - -## 6.1.0 - -* Add semver.compareBuild function -* Support `*` in semver.intersects - -## 6.0 - -* Fix `intersects` logic. - - This is technically a bug fix, but since it is also a change to behavior - that may require users updating their code, it is marked as a major - version increment. - -## 5.7 - -* Add `minVersion` method - -## 5.6 - -* Move boolean `loose` param to an options object, with - backwards-compatibility protection. -* Add ability to opt out of special prerelease version handling with - the `includePrerelease` option flag. - -## 5.5 - -* Add version coercion capabilities - -## 5.4 - -* Add intersection checking - -## 5.3 - -* Add `minSatisfying` method - -## 5.2 - -* Add `prerelease(v)` that returns prerelease components - -## 5.1 - -* Add Backus-Naur for ranges -* Remove excessively cute inspection methods - -## 5.0 - -* Remove AMD/Browserified build artifacts -* Fix ltr and gtr when using the `*` range -* Fix for range `*` with a prerelease identifier diff --git a/node_modules/@grpc/grpc-js/node_modules/semver/LICENSE b/node_modules/@grpc/grpc-js/node_modules/semver/LICENSE deleted file mode 100644 index 19129e31..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/semver/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. diff --git a/node_modules/@grpc/grpc-js/node_modules/semver/README.md b/node_modules/@grpc/grpc-js/node_modules/semver/README.md deleted file mode 100644 index 2293a14f..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/semver/README.md +++ /dev/null @@ -1,443 +0,0 @@ -semver(1) -- The semantic versioner for npm -=========================================== - -## Install - -```bash -npm install semver -```` - -## Usage - -As a node module: - -```js -const semver = require('semver') - -semver.valid('1.2.3') // '1.2.3' -semver.valid('a.b.c') // null -semver.clean(' =v1.2.3 ') // '1.2.3' -semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true -semver.gt('1.2.3', '9.8.7') // false -semver.lt('1.2.3', '9.8.7') // true -semver.minVersion('>=1.0.0') // '1.0.0' -semver.valid(semver.coerce('v2')) // '2.0.0' -semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' -``` - -As a command-line utility: - -``` -$ semver -h - -A JavaScript implementation of the https://semver.org/ specification -Copyright Isaac Z. Schlueter - -Usage: semver [options] [ [...]] -Prints valid versions sorted by SemVer precedence - -Options: --r --range - Print versions that match the specified range. - --i --increment [] - Increment a version by the specified level. Level can - be one of: major, minor, patch, premajor, preminor, - prepatch, or prerelease. Default level is 'patch'. - Only one version may be specified. - ---preid - Identifier to be used to prefix premajor, preminor, - prepatch or prerelease version increments. - --l --loose - Interpret versions and ranges loosely - --p --include-prerelease - Always include prerelease versions in range matching - --c --coerce - Coerce a string into SemVer if possible - (does not imply --loose) - ---rtl - Coerce version strings right to left - ---ltr - Coerce version strings left to right (default) - -Program exits successfully if any valid version satisfies -all supplied ranges, and prints all satisfying versions. - -If no satisfying versions are found, then exits failure. - -Versions are printed in ascending order, so supplying -multiple versions to the utility will just sort them. -``` - -## Versions - -A "version" is described by the `v2.0.0` specification found at -. - -A leading `"="` or `"v"` character is stripped off and ignored. - -## Ranges - -A `version range` is a set of `comparators` which specify versions -that satisfy the range. - -A `comparator` is composed of an `operator` and a `version`. The set -of primitive `operators` is: - -* `<` Less than -* `<=` Less than or equal to -* `>` Greater than -* `>=` Greater than or equal to -* `=` Equal. If no operator is specified, then equality is assumed, - so this operator is optional, but MAY be included. - -For example, the comparator `>=1.2.7` would match the versions -`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` -or `1.1.0`. - -Comparators can be joined by whitespace to form a `comparator set`, -which is satisfied by the **intersection** of all of the comparators -it includes. - -A range is composed of one or more comparator sets, joined by `||`. A -version matches a range if and only if every comparator in at least -one of the `||`-separated comparator sets is satisfied by the version. - -For example, the range `>=1.2.7 <1.3.0` would match the versions -`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, -or `1.1.0`. - -The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, -`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. - -### Prerelease Tags - -If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then -it will only be allowed to satisfy comparator sets if at least one -comparator with the same `[major, minor, patch]` tuple also has a -prerelease tag. - -For example, the range `>1.2.3-alpha.3` would be allowed to match the -version `1.2.3-alpha.7`, but it would *not* be satisfied by -`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater -than" `1.2.3-alpha.3` according to the SemVer sort rules. The version -range only accepts prerelease tags on the `1.2.3` version. The -version `3.4.5` *would* satisfy the range, because it does not have a -prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. - -The purpose for this behavior is twofold. First, prerelease versions -frequently are updated very quickly, and contain many breaking changes -that are (by the author's design) not yet fit for public consumption. -Therefore, by default, they are excluded from range matching -semantics. - -Second, a user who has opted into using a prerelease version has -clearly indicated the intent to use *that specific* set of -alpha/beta/rc versions. By including a prerelease tag in the range, -the user is indicating that they are aware of the risk. However, it -is still not appropriate to assume that they have opted into taking a -similar risk on the *next* set of prerelease versions. - -Note that this behavior can be suppressed (treating all prerelease -versions as if they were normal versions, for the purpose of range -matching) by setting the `includePrerelease` flag on the options -object to any -[functions](https://github.com/npm/node-semver#functions) that do -range matching. - -#### Prerelease Identifiers - -The method `.inc` takes an additional `identifier` string argument that -will append the value of the string as a prerelease identifier: - -```javascript -semver.inc('1.2.3', 'prerelease', 'beta') -// '1.2.4-beta.0' -``` - -command-line example: - -```bash -$ semver 1.2.3 -i prerelease --preid beta -1.2.4-beta.0 -``` - -Which then can be used to increment further: - -```bash -$ semver 1.2.4-beta.0 -i prerelease -1.2.4-beta.1 -``` - -### Advanced Range Syntax - -Advanced range syntax desugars to primitive comparators in -deterministic ways. - -Advanced ranges may be combined in the same way as primitive -comparators using white space or `||`. - -#### Hyphen Ranges `X.Y.Z - A.B.C` - -Specifies an inclusive set. - -* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` - -If a partial version is provided as the first version in the inclusive -range, then the missing pieces are replaced with zeroes. - -* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` - -If a partial version is provided as the second version in the -inclusive range, then all versions that start with the supplied parts -of the tuple are accepted, but nothing that would be greater than the -provided tuple parts. - -* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` -* `1.2.3 - 2` := `>=1.2.3 <3.0.0` - -#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` - -Any of `X`, `x`, or `*` may be used to "stand in" for one of the -numeric values in the `[major, minor, patch]` tuple. - -* `*` := `>=0.0.0` (Any version satisfies) -* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) -* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) - -A partial version range is treated as an X-Range, so the special -character is in fact optional. - -* `""` (empty string) := `*` := `>=0.0.0` -* `1` := `1.x.x` := `>=1.0.0 <2.0.0` -* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` - -#### Tilde Ranges `~1.2.3` `~1.2` `~1` - -Allows patch-level changes if a minor version is specified on the -comparator. Allows minor-level changes if not. - -* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` -* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) -* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) -* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` -* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) -* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) -* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. - -#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` - -Allows changes that do not modify the left-most non-zero element in the -`[major, minor, patch]` tuple. In other words, this allows patch and -minor updates for versions `1.0.0` and above, patch updates for -versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. - -Many authors treat a `0.x` version as if the `x` were the major -"breaking-change" indicator. - -Caret ranges are ideal when an author may make breaking changes -between `0.2.4` and `0.3.0` releases, which is a common practice. -However, it presumes that there will *not* be breaking changes between -`0.2.4` and `0.2.5`. It allows for changes that are presumed to be -additive (but non-breaking), according to commonly observed practices. - -* `^1.2.3` := `>=1.2.3 <2.0.0` -* `^0.2.3` := `>=0.2.3 <0.3.0` -* `^0.0.3` := `>=0.0.3 <0.0.4` -* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. -* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the - `0.0.3` version *only* will be allowed, if they are greater than or - equal to `beta`. So, `0.0.3-pr.2` would be allowed. - -When parsing caret ranges, a missing `patch` value desugars to the -number `0`, but will allow flexibility within that value, even if the -major and minor versions are both `0`. - -* `^1.2.x` := `>=1.2.0 <2.0.0` -* `^0.0.x` := `>=0.0.0 <0.1.0` -* `^0.0` := `>=0.0.0 <0.1.0` - -A missing `minor` and `patch` values will desugar to zero, but also -allow flexibility within those values, even if the major version is -zero. - -* `^1.x` := `>=1.0.0 <2.0.0` -* `^0.x` := `>=0.0.0 <1.0.0` - -### Range Grammar - -Putting all this together, here is a Backus-Naur grammar for ranges, -for the benefit of parser authors: - -```bnf -range-set ::= range ( logical-or range ) * -logical-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' - ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '.' part ) * -part ::= nr | [-0-9A-Za-z]+ -``` - -## Functions - -All methods and classes take a final `options` object argument. All -options in this object are `false` by default. The options supported -are: - -- `loose` Be more forgiving about not-quite-valid semver strings. - (Any resulting output will always be 100% strict compliant, of - course.) For backwards compatibility reasons, if the `options` - argument is a boolean value instead of an object, it is interpreted - to be the `loose` param. -- `includePrerelease` Set to suppress the [default - behavior](https://github.com/npm/node-semver#prerelease-tags) of - excluding prerelease tagged versions from ranges unless they are - explicitly opted into. - -Strict-mode Comparators and Ranges will be strict about the SemVer -strings that they parse. - -* `valid(v)`: Return the parsed version, or null if it's not valid. -* `inc(v, release)`: Return the version incremented by the release - type (`major`, `premajor`, `minor`, `preminor`, `patch`, - `prepatch`, or `prerelease`), or null if it's not valid - * `premajor` in one call will bump the version up to the next major - version and down to a prerelease of that major version. - `preminor`, and `prepatch` work the same way. - * If called from a non-prerelease version, the `prerelease` will work the - same as `prepatch`. It increments the patch version, then makes a - prerelease. If the input version is already a prerelease it simply - increments it. -* `prerelease(v)`: Returns an array of prerelease components, or null - if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` -* `major(v)`: Return the major version number. -* `minor(v)`: Return the minor version number. -* `patch(v)`: Return the patch version number. -* `intersects(r1, r2, loose)`: Return true if the two supplied ranges - or comparators intersect. -* `parse(v)`: Attempt to parse a string as a semantic version, returning either - a `SemVer` object or `null`. - -### Comparison - -* `gt(v1, v2)`: `v1 > v2` -* `gte(v1, v2)`: `v1 >= v2` -* `lt(v1, v2)`: `v1 < v2` -* `lte(v1, v2)`: `v1 <= v2` -* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, - even if they're not the exact same string. You already know how to - compare strings. -* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. -* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call - the corresponding function above. `"==="` and `"!=="` do simple - string comparison, but are included for completeness. Throws if an - invalid comparison string is provided. -* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions - in descending order when passed to `Array.sort()`. -* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions - are equal. Sorts in ascending order if passed to `Array.sort()`. - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `diff(v1, v2)`: Returns difference between two versions by the release type - (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), - or null if the versions are the same. - -### Comparators - -* `intersects(comparator)`: Return true if the comparators intersect - -### Ranges - -* `validRange(range)`: Return the valid range or null if it's not valid -* `satisfies(version, range)`: Return true if the version satisfies the - range. -* `maxSatisfying(versions, range)`: Return the highest version in the list - that satisfies the range, or `null` if none of them do. -* `minSatisfying(versions, range)`: Return the lowest version in the list - that satisfies the range, or `null` if none of them do. -* `minVersion(range)`: Return the lowest version that can possibly match - the given range. -* `gtr(version, range)`: Return `true` if version is greater than all the - versions possible in the range. -* `ltr(version, range)`: Return `true` if version is less than all the - versions possible in the range. -* `outside(version, range, hilo)`: Return true if the version is outside - the bounds of the range in either the high or low direction. The - `hilo` argument must be either the string `'>'` or `'<'`. (This is - the function called by `gtr` and `ltr`.) -* `intersects(range)`: Return true if any of the ranges comparators intersect - -Note that, since ranges may be non-contiguous, a version might not be -greater than a range, less than a range, *or* satisfy a range! For -example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` -until `2.0.0`, so the version `1.2.10` would not be greater than the -range (because `2.0.1` satisfies, which is higher), nor less than the -range (since `1.2.8` satisfies, which is lower), and it also does not -satisfy the range. - -If you want to know if a version satisfies or does not satisfy a -range, use the `satisfies(version, range)` function. - -### Coercion - -* `coerce(version, options)`: Coerces a string to semver if possible - -This aims to provide a very forgiving translation of a non-semver string to -semver. It looks for the first digit in a string, and consumes all -remaining characters which satisfy at least a partial semver (e.g., `1`, -`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer -versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All -surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes -`3.4.0`). Only text which lacks digits will fail coercion (`version one` -is not valid). The maximum length for any semver component considered for -coercion is 16 characters; longer components will be ignored -(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any -semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value -components are invalid (`9999999999999999.4.7.4` is likely invalid). - -If the `options.rtl` flag is set, then `coerce` will return the right-most -coercible tuple that does not share an ending index with a longer coercible -tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not -`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of -any other overlapping SemVer tuple. - -### Clean - -* `clean(version)`: Clean a string to be a valid semver if possible - -This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. - -ex. -* `s.clean(' = v 2.1.5foo')`: `null` -* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` -* `s.clean(' = v 2.1.5-foo')`: `null` -* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` -* `s.clean('=v2.1.5')`: `'2.1.5'` -* `s.clean(' =v2.1.5')`: `2.1.5` -* `s.clean(' 2.1.5 ')`: `'2.1.5'` -* `s.clean('~1.0.0')`: `null` diff --git a/node_modules/@grpc/grpc-js/node_modules/semver/bin/semver.js b/node_modules/@grpc/grpc-js/node_modules/semver/bin/semver.js deleted file mode 100644 index 666034a7..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/semver/bin/semver.js +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env node -// Standalone semver comparison program. -// Exits successfully and prints matching version(s) if -// any supplied version is valid and passes all tests. - -var argv = process.argv.slice(2) - -var versions = [] - -var range = [] - -var inc = null - -var version = require('../package.json').version - -var loose = false - -var includePrerelease = false - -var coerce = false - -var rtl = false - -var identifier - -var semver = require('../semver') - -var reverse = false - -var options = {} - -main() - -function main () { - if (!argv.length) return help() - while (argv.length) { - var a = argv.shift() - var indexOfEqualSign = a.indexOf('=') - if (indexOfEqualSign !== -1) { - a = a.slice(0, indexOfEqualSign) - argv.unshift(a.slice(indexOfEqualSign + 1)) - } - switch (a) { - case '-rv': case '-rev': case '--rev': case '--reverse': - reverse = true - break - case '-l': case '--loose': - loose = true - break - case '-p': case '--include-prerelease': - includePrerelease = true - break - case '-v': case '--version': - versions.push(argv.shift()) - break - case '-i': case '--inc': case '--increment': - switch (argv[0]) { - case 'major': case 'minor': case 'patch': case 'prerelease': - case 'premajor': case 'preminor': case 'prepatch': - inc = argv.shift() - break - default: - inc = 'patch' - break - } - break - case '--preid': - identifier = argv.shift() - break - case '-r': case '--range': - range.push(argv.shift()) - break - case '-c': case '--coerce': - coerce = true - break - case '--rtl': - rtl = true - break - case '--ltr': - rtl = false - break - case '-h': case '--help': case '-?': - return help() - default: - versions.push(a) - break - } - } - - var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } - - versions = versions.map(function (v) { - return coerce ? (semver.coerce(v, options) || { version: v }).version : v - }).filter(function (v) { - return semver.valid(v) - }) - if (!versions.length) return fail() - if (inc && (versions.length !== 1 || range.length)) { return failInc() } - - for (var i = 0, l = range.length; i < l; i++) { - versions = versions.filter(function (v) { - return semver.satisfies(v, range[i], options) - }) - if (!versions.length) return fail() - } - return success(versions) -} - -function failInc () { - console.error('--inc can only be used on a single version with no range') - fail() -} - -function fail () { process.exit(1) } - -function success () { - var compare = reverse ? 'rcompare' : 'compare' - versions.sort(function (a, b) { - return semver[compare](a, b, options) - }).map(function (v) { - return semver.clean(v, options) - }).map(function (v) { - return inc ? semver.inc(v, inc, options, identifier) : v - }).forEach(function (v, i, _) { console.log(v) }) -} - -function help () { - console.log(['SemVer ' + version, - '', - 'A JavaScript implementation of the https://semver.org/ specification', - 'Copyright Isaac Z. Schlueter', - '', - 'Usage: semver [options] [ [...]]', - 'Prints valid versions sorted by SemVer precedence', - '', - 'Options:', - '-r --range ', - ' Print versions that match the specified range.', - '', - '-i --increment []', - ' Increment a version by the specified level. Level can', - ' be one of: major, minor, patch, premajor, preminor,', - " prepatch, or prerelease. Default level is 'patch'.", - ' Only one version may be specified.', - '', - '--preid ', - ' Identifier to be used to prefix premajor, preminor,', - ' prepatch or prerelease version increments.', - '', - '-l --loose', - ' Interpret versions and ranges loosely', - '', - '-p --include-prerelease', - ' Always include prerelease versions in range matching', - '', - '-c --coerce', - ' Coerce a string into SemVer if possible', - ' (does not imply --loose)', - '', - '--rtl', - ' Coerce version strings right to left', - '', - '--ltr', - ' Coerce version strings left to right (default)', - '', - 'Program exits successfully if any valid version satisfies', - 'all supplied ranges, and prints all satisfying versions.', - '', - 'If no satisfying versions are found, then exits failure.', - '', - 'Versions are printed in ascending order, so supplying', - 'multiple versions to the utility will just sort them.' - ].join('\n')) -} diff --git a/node_modules/@grpc/grpc-js/node_modules/semver/package.json b/node_modules/@grpc/grpc-js/node_modules/semver/package.json deleted file mode 100644 index 1dc7a53a..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/semver/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "_from": "semver@^6.2.0", - "_id": "semver@6.3.0", - "_inBundle": false, - "_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "_location": "/@grpc/grpc-js/semver", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "semver@^6.2.0", - "name": "semver", - "escapedName": "semver", - "rawSpec": "^6.2.0", - "saveSpec": null, - "fetchSpec": "^6.2.0" - }, - "_requiredBy": [ - "/@grpc/grpc-js" - ], - "_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "_shasum": "ee0a64c8af5e8ceea67687b133761e1becbd1d3d", - "_spec": "semver@^6.2.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/@grpc/grpc-js", - "bin": { - "semver": "bin/semver.js" - }, - "bugs": { - "url": "https://github.com/npm/node-semver/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "The semantic version parser used by npm.", - "devDependencies": { - "tap": "^14.3.1" - }, - "files": [ - "bin", - "range.bnf", - "semver.js" - ], - "homepage": "https://github.com/npm/node-semver#readme", - "license": "ISC", - "main": "semver.js", - "name": "semver", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/node-semver.git" - }, - "scripts": { - "postpublish": "git push origin --follow-tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap" - }, - "tap": { - "check-coverage": true - }, - "version": "6.3.0" -} diff --git a/node_modules/@grpc/grpc-js/node_modules/semver/range.bnf b/node_modules/@grpc/grpc-js/node_modules/semver/range.bnf deleted file mode 100644 index d4c6ae0d..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/semver/range.bnf +++ /dev/null @@ -1,16 +0,0 @@ -range-set ::= range ( logical-or range ) * -logical-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' - ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | [1-9] ( [0-9] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '.' part ) * -part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/@grpc/grpc-js/node_modules/semver/semver.js b/node_modules/@grpc/grpc-js/node_modules/semver/semver.js deleted file mode 100644 index 636fa436..00000000 --- a/node_modules/@grpc/grpc-js/node_modules/semver/semver.js +++ /dev/null @@ -1,1596 +0,0 @@ -exports = module.exports = SemVer - -var debug -/* istanbul ignore next */ -if (typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG)) { - debug = function () { - var args = Array.prototype.slice.call(arguments, 0) - args.unshift('SEMVER') - console.log.apply(console, args) - } -} else { - debug = function () {} -} - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0' - -var MAX_LENGTH = 256 -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16 - -// The actual regexps go on exports.re -var re = exports.re = [] -var src = exports.src = [] -var t = exports.tokens = {} -var R = 0 - -function tok (n) { - t[n] = R++ -} - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -tok('NUMERICIDENTIFIER') -src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' -tok('NUMERICIDENTIFIERLOOSE') -src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -tok('NONNUMERICIDENTIFIER') -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' - -// ## Main Version -// Three dot-separated numeric identifiers. - -tok('MAINVERSION') -src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIER] + ')' - -tok('MAINVERSIONLOOSE') -src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')' - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -tok('PRERELEASEIDENTIFIER') -src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + - '|' + src[t.NONNUMERICIDENTIFIER] + ')' - -tok('PRERELEASEIDENTIFIERLOOSE') -src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + - '|' + src[t.NONNUMERICIDENTIFIER] + ')' - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -tok('PRERELEASE') -src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + - '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))' - -tok('PRERELEASELOOSE') -src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))' - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -tok('BUILDIDENTIFIER') -src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -tok('BUILD') -src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + - '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))' - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -tok('FULL') -tok('FULLPLAIN') -src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + - src[t.PRERELEASE] + '?' + - src[t.BUILD] + '?' - -src[t.FULL] = '^' + src[t.FULLPLAIN] + '$' - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -tok('LOOSEPLAIN') -src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + - src[t.PRERELEASELOOSE] + '?' + - src[t.BUILD] + '?' - -tok('LOOSE') -src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$' - -tok('GTLT') -src[t.GTLT] = '((?:<|>)?=?)' - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -tok('XRANGEIDENTIFIERLOOSE') -src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' -tok('XRANGEIDENTIFIER') -src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*' - -tok('XRANGEPLAIN') -src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + - '(?:' + src[t.PRERELEASE] + ')?' + - src[t.BUILD] + '?' + - ')?)?' - -tok('XRANGEPLAINLOOSE') -src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[t.PRERELEASELOOSE] + ')?' + - src[t.BUILD] + '?' + - ')?)?' - -tok('XRANGE') -src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$' -tok('XRANGELOOSE') -src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$' - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -tok('COERCE') -src[t.COERCE] = '(^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])' -tok('COERCERTL') -re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -tok('LONETILDE') -src[t.LONETILDE] = '(?:~>?)' - -tok('TILDETRIM') -src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' -re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') -var tildeTrimReplace = '$1~' - -tok('TILDE') -src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$' -tok('TILDELOOSE') -src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$' - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -tok('LONECARET') -src[t.LONECARET] = '(?:\\^)' - -tok('CARETTRIM') -src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' -re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') -var caretTrimReplace = '$1^' - -tok('CARET') -src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$' -tok('CARETLOOSE') -src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$' - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -tok('COMPARATORLOOSE') -src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$' -tok('COMPARATOR') -src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$' - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -tok('COMPARATORTRIM') -src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + - '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')' - -// this one has to use the /g flag -re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') -var comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -tok('HYPHENRANGE') -src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[t.XRANGEPLAIN] + ')' + - '\\s*$' - -tok('HYPHENRANGELOOSE') -src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[t.XRANGEPLAINLOOSE] + ')' + - '\\s*$' - -// Star ranges basically just allow anything at all. -tok('STAR') -src[t.STAR] = '(<|>)?=?\\s*\\*' - -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]) - if (!re[i]) { - re[i] = new RegExp(src[i]) - } -} - -exports.parse = parse -function parse (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - var r = options.loose ? re[t.LOOSE] : re[t.FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} - -exports.valid = valid -function valid (version, options) { - var v = parse(version, options) - return v ? v.version : null -} - -exports.clean = clean -function clean (version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} - -exports.SemVer = SemVer - -function SemVer (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === options.loose) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - - var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) - - if (!m) { - throw new TypeError('Invalid Version: ' + version) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() -} - -SemVer.prototype.format = function () { - this.version = this.major + '.' + this.minor + '.' + this.patch - if (this.prerelease.length) { - this.version += '-' + this.prerelease.join('.') - } - return this.version -} - -SemVer.prototype.toString = function () { - return this.version -} - -SemVer.prototype.compare = function (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return this.compareMain(other) || this.comparePre(other) -} - -SemVer.prototype.compareMain = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) -} - -SemVer.prototype.comparePre = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - var i = 0 - do { - var a = this.prerelease[i] - var b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} - -SemVer.prototype.compareBuild = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - var i = 0 - do { - var a = this.build[i] - var b = other.build[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} - -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - var i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } - } - break - - default: - throw new Error('invalid increment argument: ' + release) - } - this.format() - this.raw = this.version - return this -} - -exports.inc = inc -function inc (version, release, loose, identifier) { - if (typeof (loose) === 'string') { - identifier = loose - loose = undefined - } - - try { - return new SemVer(version, loose).inc(release, identifier).version - } catch (er) { - return null - } -} - -exports.diff = diff -function diff (version1, version2) { - if (eq(version1, version2)) { - return null - } else { - var v1 = parse(version1) - var v2 = parse(version2) - var prefix = '' - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre' - var defaultResult = 'prerelease' - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} - -exports.compareIdentifiers = compareIdentifiers - -var numeric = /^[0-9]+$/ -function compareIdentifiers (a, b) { - var anum = numeric.test(a) - var bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -exports.rcompareIdentifiers = rcompareIdentifiers -function rcompareIdentifiers (a, b) { - return compareIdentifiers(b, a) -} - -exports.major = major -function major (a, loose) { - return new SemVer(a, loose).major -} - -exports.minor = minor -function minor (a, loose) { - return new SemVer(a, loose).minor -} - -exports.patch = patch -function patch (a, loose) { - return new SemVer(a, loose).patch -} - -exports.compare = compare -function compare (a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)) -} - -exports.compareLoose = compareLoose -function compareLoose (a, b) { - return compare(a, b, true) -} - -exports.compareBuild = compareBuild -function compareBuild (a, b, loose) { - var versionA = new SemVer(a, loose) - var versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} - -exports.rcompare = rcompare -function rcompare (a, b, loose) { - return compare(b, a, loose) -} - -exports.sort = sort -function sort (list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(a, b, loose) - }) -} - -exports.rsort = rsort -function rsort (list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(b, a, loose) - }) -} - -exports.gt = gt -function gt (a, b, loose) { - return compare(a, b, loose) > 0 -} - -exports.lt = lt -function lt (a, b, loose) { - return compare(a, b, loose) < 0 -} - -exports.eq = eq -function eq (a, b, loose) { - return compare(a, b, loose) === 0 -} - -exports.neq = neq -function neq (a, b, loose) { - return compare(a, b, loose) !== 0 -} - -exports.gte = gte -function gte (a, b, loose) { - return compare(a, b, loose) >= 0 -} - -exports.lte = lte -function lte (a, b, loose) { - return compare(a, b, loose) <= 0 -} - -exports.cmp = cmp -function cmp (a, op, b, loose) { - switch (op) { - case '===': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a === b - - case '!==': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) - - default: - throw new TypeError('Invalid operator: ' + op) - } -} - -exports.Comparator = Comparator -function Comparator (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - if (!(this instanceof Comparator)) { - return new Comparator(comp, options) - } - - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) -} - -var ANY = {} -Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - var m = comp.match(r) - - if (!m) { - throw new TypeError('Invalid comparator: ' + comp) - } - - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } -} - -Comparator.prototype.toString = function () { - return this.value -} - -Comparator.prototype.test = function (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY || version === ANY) { - return true - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - return cmp(version, this.operator, this.semver, this.options) -} - -Comparator.prototype.intersects = function (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - var rangeTmp - - if (this.operator === '') { - if (this.value === '') { - return true - } - rangeTmp = new Range(comp.value, options) - return satisfies(this.value, rangeTmp, options) - } else if (comp.operator === '') { - if (comp.value === '') { - return true - } - rangeTmp = new Range(this.value, options) - return satisfies(comp.semver, rangeTmp, options) - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - var sameSemVer = this.semver.version === comp.semver.version - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')) - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')) - - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan -} - -exports.Range = Range -function Range (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (range instanceof Range) { - if (range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - return new Range(range.value, options) - } - - if (!(this instanceof Range)) { - return new Range(range, options) - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First, split based on boolean or || - this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { - return this.parseRange(range.trim()) - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length - }) - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) - } - - this.format() -} - -Range.prototype.format = function () { - this.range = this.set.map(function (comps) { - return comps.join(' ').trim() - }).join('||').trim() - return this.range -} - -Range.prototype.toString = function () { - return this.range -} - -Range.prototype.parseRange = function (range) { - var loose = this.options.loose - range = range.trim() - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - var set = range.split(' ').map(function (comp) { - return parseComparator(comp, this.options) - }, this).join(' ').split(/\s+/) - if (this.options.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function (comp) { - return !!comp.match(compRe) - }) - } - set = set.map(function (comp) { - return new Comparator(comp, this.options) - }, this) - - return set -} - -Range.prototype.intersects = function (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some(function (thisComparators) { - return ( - isSatisfiable(thisComparators, options) && - range.set.some(function (rangeComparators) { - return ( - isSatisfiable(rangeComparators, options) && - thisComparators.every(function (thisComparator) { - return rangeComparators.every(function (rangeComparator) { - return thisComparator.intersects(rangeComparator, options) - }) - }) - ) - }) - ) - }) -} - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -function isSatisfiable (comparators, options) { - var result = true - var remainingComparators = comparators.slice() - var testComparator = remainingComparators.pop() - - while (result && remainingComparators.length) { - result = remainingComparators.every(function (otherComparator) { - return testComparator.intersects(otherComparator, options) - }) - - testComparator = remainingComparators.pop() - } - - return result -} - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators -function toComparators (range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value - }).join(' ').trim().split(' ') - }) -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator (comp, options) { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp -} - -function isX (id) { - return !id || id.toLowerCase() === 'x' || id === '*' -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceTilde(comp, options) - }).join(' ') -} - -function replaceTilde (comp, options) { - var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] - return comp.replace(r, function (_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else if (pr) { - debug('replaceTilde pr', pr) - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } else { - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceCaret(comp, options) - }).join(' ') -} - -function replaceCaret (comp, options) { - debug('caret', comp, options) - var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] - return comp.replace(r, function (_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - if (M === '0') { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else { - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + (+M + 1) + '.0.0' - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0' - } - } - - debug('caret return', ret) - return ret - }) -} - -function replaceXRanges (comp, options) { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map(function (comp) { - return replaceXRange(comp, options) - }).join(' ') -} - -function replaceXRange (comp, options) { - comp = comp.trim() - var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] - return comp.replace(r, function (ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - var xM = isX(M) - var xm = xM || isX(m) - var xp = xm || isX(p) - var anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' - } - - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - ret = gtlt + M + '.' + m + '.' + p + pr - } else if (xm) { - ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr - } else if (xp) { - ret = '>=' + M + '.' + m + '.0' + pr + - ' <' + M + '.' + (+m + 1) + '.0' + pr - } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars (comp, options) { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') -} - -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = '>=' + fM + '.0.0' - } else if (isX(fp)) { - from = '>=' + fM + '.' + fm + '.0' - } else { - from = '>=' + from - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = '<' + (+tM + 1) + '.0.0' - } else if (isX(tp)) { - to = '<' + tM + '.' + (+tm + 1) + '.0' - } else if (tpr) { - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr - } else { - to = '<=' + to - } - - return (from + ' ' + to).trim() -} - -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false -} - -function testSet (set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} - -exports.satisfies = satisfies -function satisfies (version, range, options) { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} - -exports.maxSatisfying = maxSatisfying -function maxSatisfying (versions, range, options) { - var max = null - var maxSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} - -exports.minSatisfying = minSatisfying -function minSatisfying (versions, range, options) { - var min = null - var minSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} - -exports.minVersion = minVersion -function minVersion (range, loose) { - range = new Range(range, loose) - - var minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error('Unexpected operation: ' + comparator.operator) - } - }) - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} - -exports.validRange = validRange -function validRange (range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} - -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr -function ltr (version, range, options) { - return outside(version, range, '<', options) -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr -function gtr (version, range, options) { - return outside(version, range, '>', options) -} - -exports.outside = outside -function outside (version, range, hilo, options) { - version = new SemVer(version, options) - range = new Range(range, options) - - var gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - var high = null - var low = null - - comparators.forEach(function (comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} - -exports.prerelease = prerelease -function prerelease (version, options) { - var parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} - -exports.intersects = intersects -function intersects (r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} - -exports.coerce = coerce -function coerce (version, options) { - if (version instanceof SemVer) { - return version - } - - if (typeof version === 'number') { - version = String(version) - } - - if (typeof version !== 'string') { - return null - } - - options = options || {} - - var match = null - if (!options.rtl) { - match = version.match(re[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - var next - while ((next = re[t.COERCERTL].exec(version)) && - (!match || match.index + match[0].length !== version.length) - ) { - if (!match || - next.index + next[0].length !== match.index + match[0].length) { - match = next - } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 - } - - if (match === null) { - return null - } - - return parse(match[2] + - '.' + (match[3] || '0') + - '.' + (match[4] || '0'), options) -} diff --git a/node_modules/@grpc/grpc-js/package.json b/node_modules/@grpc/grpc-js/package.json deleted file mode 100644 index 2a60bbdb..00000000 --- a/node_modules/@grpc/grpc-js/package.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "_from": "@grpc/grpc-js@1.2.0", - "_id": "@grpc/grpc-js@1.2.0", - "_inBundle": false, - "_integrity": "sha512-09H50V7rmz0gFrGz6IbP49z9A8+2p4yZYcNDEb7bytr90vWn52VBQE1a+LMBlrucmNN0wSsiCr3TJx+dStHTng==", - "_location": "/@grpc/grpc-js", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@grpc/grpc-js@1.2.0", - "name": "@grpc/grpc-js", - "escapedName": "@grpc%2fgrpc-js", - "scope": "@grpc", - "rawSpec": "1.2.0", - "saveSpec": null, - "fetchSpec": "1.2.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.2.0.tgz", - "_shasum": "4ff1ac4cdf7eb2af80d3c67316be9c2308d8d9bf", - "_spec": "@grpc/grpc-js@1.2.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "Google Inc." - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Google Inc." - } - ], - "dependencies": { - "@types/node": "^12.12.47", - "google-auth-library": "^6.1.1", - "semver": "^6.2.0" - }, - "deprecated": false, - "description": "gRPC Library for Node - pure JS implementation", - "devDependencies": { - "@grpc/proto-loader": "^0.5.5", - "@types/gulp": "^4.0.6", - "@types/gulp-mocha": "0.0.32", - "@types/lodash": "^4.14.108", - "@types/mocha": "^5.2.6", - "@types/ncp": "^2.0.1", - "@types/pify": "^3.0.2", - "@types/semver": "^6.0.1", - "@types/yargs": "^15.0.5", - "clang-format": "^1.0.55", - "execa": "^2.0.3", - "gts": "^2.0.0", - "gulp": "^4.0.2", - "gulp-mocha": "^6.0.0", - "lodash": "^4.17.4", - "mocha-jenkins-reporter": "^0.4.1", - "ncp": "^2.0.0", - "pify": "^4.0.1", - "rimraf": "^3.0.2", - "ts-node": "^8.3.0", - "typescript": "^3.7.2", - "yargs": "^15.4.1" - }, - "engines": { - "node": "^8.13.0 || >=10.10.0" - }, - "files": [ - "src/**/*.ts", - "build/src/*.{js,d.ts,js.map}", - "LICENSE", - "deps/envoy-api/envoy/api/v2/**/*.proto", - "deps/envoy-api/envoy/config/**/*.proto", - "deps/envoy-api/envoy/service/**/*.proto", - "deps/envoy-api/envoy/type/**/*.proto", - "deps/udpa/udpa/**/*.proto", - "deps/googleapis/google/api/*.proto", - "deps/googleapis/google/rpc/*.proto", - "deps/protoc-gen-validate/validate/**/*.proto" - ], - "homepage": "https://grpc.io/", - "keywords": [], - "license": "Apache-2.0", - "main": "build/src/index.js", - "name": "@grpc/grpc-js", - "repository": { - "type": "git", - "url": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js" - }, - "scripts": { - "build": "npm run compile", - "check": "gts check src/**/*.ts", - "clean": "node -e 'require(\"rimraf\")(\"./build\", () => {})'", - "compile": "tsc -p .", - "fix": "gts fix src/*.ts", - "format": "clang-format -i -style=\"{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}\" src/*.ts test/*.ts", - "lint": "npm run check", - "posttest": "npm run check", - "prepare": "npm run compile", - "pretest": "npm run compile", - "test": "gulp test" - }, - "types": "build/src/index.d.ts", - "version": "1.2.0" -} diff --git a/node_modules/@grpc/grpc-js/src/backoff-timeout.ts b/node_modules/@grpc/grpc-js/src/backoff-timeout.ts deleted file mode 100644 index 8cad14f7..00000000 --- a/node_modules/@grpc/grpc-js/src/backoff-timeout.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -const INITIAL_BACKOFF_MS = 1000; -const BACKOFF_MULTIPLIER = 1.6; -const MAX_BACKOFF_MS = 120000; -const BACKOFF_JITTER = 0.2; - -/** - * Get a number uniformly at random in the range [min, max) - * @param min - * @param max - */ -function uniformRandom(min: number, max: number) { - return Math.random() * (max - min) + min; -} - -export interface BackoffOptions { - initialDelay?: number; - multiplier?: number; - jitter?: number; - maxDelay?: number; -} - -export class BackoffTimeout { - private initialDelay: number = INITIAL_BACKOFF_MS; - private multiplier: number = BACKOFF_MULTIPLIER; - private maxDelay: number = MAX_BACKOFF_MS; - private jitter: number = BACKOFF_JITTER; - private nextDelay: number; - private timerId: NodeJS.Timer; - private running = false; - - constructor(private callback: () => void, options?: BackoffOptions) { - if (options) { - if (options.initialDelay) { - this.initialDelay = options.initialDelay; - } - if (options.multiplier) { - this.multiplier = options.multiplier; - } - if (options.jitter) { - this.jitter = options.jitter; - } - if (options.maxDelay) { - this.maxDelay = options.maxDelay; - } - } - this.nextDelay = this.initialDelay; - this.timerId = setTimeout(() => {}, 0); - clearTimeout(this.timerId); - } - - /** - * Call the callback after the current amount of delay time - */ - runOnce() { - this.running = true; - this.timerId = setTimeout(() => { - this.callback(); - this.running = false; - }, this.nextDelay); - const nextBackoff = Math.min( - this.nextDelay * this.multiplier, - this.maxDelay - ); - const jitterMagnitude = nextBackoff * this.jitter; - this.nextDelay = - nextBackoff + uniformRandom(-jitterMagnitude, jitterMagnitude); - } - - /** - * Stop the timer. The callback will not be called until `runOnce` is called - * again. - */ - stop() { - clearTimeout(this.timerId); - this.running = false; - } - - /** - * Reset the delay time to its initial value. - */ - reset() { - this.nextDelay = this.initialDelay; - } - - isRunning() { - return this.running; - } -} diff --git a/node_modules/@grpc/grpc-js/src/call-credentials-filter.ts b/node_modules/@grpc/grpc-js/src/call-credentials-filter.ts deleted file mode 100644 index 5263d97f..00000000 --- a/node_modules/@grpc/grpc-js/src/call-credentials-filter.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Call } from './call-stream'; -import { Channel } from './channel'; -import { BaseFilter, Filter, FilterFactory } from './filter'; -import { Metadata } from './metadata'; -import { Status } from './constants'; -import { splitHostPort } from './uri-parser'; - -export class CallCredentialsFilter extends BaseFilter implements Filter { - private serviceUrl: string; - constructor( - private readonly channel: Channel, - private readonly stream: Call - ) { - super(); - this.channel = channel; - this.stream = stream; - const splitPath: string[] = stream.getMethod().split('/'); - let serviceName = ''; - /* The standard path format is "/{serviceName}/{methodName}", so if we split - * by '/', the first item should be empty and the second should be the - * service name */ - if (splitPath.length >= 2) { - serviceName = splitPath[1]; - } - const hostname = splitHostPort(stream.getHost())?.host ?? 'localhost'; - /* Currently, call credentials are only allowed on HTTPS connections, so we - * can assume that the scheme is "https" */ - this.serviceUrl = `https://${hostname}/${serviceName}`; - } - - async sendMetadata(metadata: Promise): Promise { - const credentials = this.stream.getCredentials(); - const credsMetadata = credentials.generateMetadata({ - service_url: this.serviceUrl, - }); - const resultMetadata = await metadata; - resultMetadata.merge(await credsMetadata); - if (resultMetadata.get('authorization').length > 1) { - this.stream.cancelWithStatus( - Status.INTERNAL, - '"authorization" metadata cannot have multiple values' - ); - } - return resultMetadata; - } -} - -export class CallCredentialsFilterFactory - implements FilterFactory { - constructor(private readonly channel: Channel) { - this.channel = channel; - } - - createFilter(callStream: Call): CallCredentialsFilter { - return new CallCredentialsFilter(this.channel, callStream); - } -} diff --git a/node_modules/@grpc/grpc-js/src/call-credentials.ts b/node_modules/@grpc/grpc-js/src/call-credentials.ts deleted file mode 100644 index bbc88a89..00000000 --- a/node_modules/@grpc/grpc-js/src/call-credentials.ts +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Metadata } from './metadata'; - -export interface CallMetadataOptions { - service_url: string; -} - -export type CallMetadataGenerator = ( - options: CallMetadataOptions, - cb: (err: Error | null, metadata?: Metadata) => void -) => void; - -// google-auth-library pre-v2.0.0 does not have getRequestHeaders -// but has getRequestMetadata, which is deprecated in v2.0.0 -export interface OldOAuth2Client { - getRequestMetadata: ( - url: string, - callback: ( - err: Error | null, - headers?: { - [index: string]: string; - } - ) => void - ) => void; -} - -export interface CurrentOAuth2Client { - getRequestHeaders: (url?: string) => Promise<{ [index: string]: string }>; -} - -export type OAuth2Client = OldOAuth2Client | CurrentOAuth2Client; - -function isCurrentOauth2Client( - client: OAuth2Client -): client is CurrentOAuth2Client { - return ( - 'getRequestHeaders' in client && - typeof client.getRequestHeaders === 'function' - ); -} - -/** - * A class that represents a generic method of adding authentication-related - * metadata on a per-request basis. - */ -export abstract class CallCredentials { - /** - * Asynchronously generates a new Metadata object. - * @param options Options used in generating the Metadata object. - */ - abstract generateMetadata(options: CallMetadataOptions): Promise; - /** - * Creates a new CallCredentials object from properties of both this and - * another CallCredentials object. This object's metadata generator will be - * called first. - * @param callCredentials The other CallCredentials object. - */ - abstract compose(callCredentials: CallCredentials): CallCredentials; - - /** - * Check whether two call credentials objects are equal. Separate - * SingleCallCredentials with identical metadata generator functions are - * equal. - * @param other The other CallCredentials object to compare with. - */ - abstract _equals(other: CallCredentials): boolean; - - /** - * Creates a new CallCredentials object from a given function that generates - * Metadata objects. - * @param metadataGenerator A function that accepts a set of options, and - * generates a Metadata object based on these options, which is passed back - * to the caller via a supplied (err, metadata) callback. - */ - static createFromMetadataGenerator( - metadataGenerator: CallMetadataGenerator - ): CallCredentials { - return new SingleCallCredentials(metadataGenerator); - } - - /** - * Create a gRPC credential from a Google credential object. - * @param googleCredentials The authentication client to use. - * @return The resulting CallCredentials object. - */ - static createFromGoogleCredential( - googleCredentials: OAuth2Client - ): CallCredentials { - return CallCredentials.createFromMetadataGenerator((options, callback) => { - let getHeaders: Promise<{ [index: string]: string }>; - if (isCurrentOauth2Client(googleCredentials)) { - getHeaders = googleCredentials.getRequestHeaders(options.service_url); - } else { - getHeaders = new Promise((resolve, reject) => { - googleCredentials.getRequestMetadata( - options.service_url, - (err, headers) => { - if (err) { - reject(err); - return; - } - resolve(headers); - } - ); - }); - } - getHeaders.then( - (headers) => { - const metadata = new Metadata(); - for (const key of Object.keys(headers)) { - metadata.add(key, headers[key]); - } - callback(null, metadata); - }, - (err) => { - callback(err); - } - ); - }); - } - - static createEmpty(): CallCredentials { - return new EmptyCallCredentials(); - } -} - -class ComposedCallCredentials extends CallCredentials { - constructor(private creds: CallCredentials[]) { - super(); - } - - async generateMetadata(options: CallMetadataOptions): Promise { - const base: Metadata = new Metadata(); - const generated: Metadata[] = await Promise.all( - this.creds.map((cred) => cred.generateMetadata(options)) - ); - for (const gen of generated) { - base.merge(gen); - } - return base; - } - - compose(other: CallCredentials): CallCredentials { - return new ComposedCallCredentials(this.creds.concat([other])); - } - - _equals(other: CallCredentials): boolean { - if (this === other) { - return true; - } - if (other instanceof ComposedCallCredentials) { - return this.creds.every((value, index) => - value._equals(other.creds[index]) - ); - } else { - return false; - } - } -} - -class SingleCallCredentials extends CallCredentials { - constructor(private metadataGenerator: CallMetadataGenerator) { - super(); - } - - generateMetadata(options: CallMetadataOptions): Promise { - return new Promise((resolve, reject) => { - this.metadataGenerator(options, (err, metadata) => { - if (metadata !== undefined) { - resolve(metadata); - } else { - reject(err); - } - }); - }); - } - - compose(other: CallCredentials): CallCredentials { - return new ComposedCallCredentials([this, other]); - } - - _equals(other: CallCredentials): boolean { - if (this === other) { - return true; - } - if (other instanceof SingleCallCredentials) { - return this.metadataGenerator === other.metadataGenerator; - } else { - return false; - } - } -} - -class EmptyCallCredentials extends CallCredentials { - generateMetadata(options: CallMetadataOptions): Promise { - return Promise.resolve(new Metadata()); - } - - compose(other: CallCredentials): CallCredentials { - return other; - } - - _equals(other: CallCredentials): boolean { - return other instanceof EmptyCallCredentials; - } -} diff --git a/node_modules/@grpc/grpc-js/src/call-stream.ts b/node_modules/@grpc/grpc-js/src/call-stream.ts deleted file mode 100644 index 32b85165..00000000 --- a/node_modules/@grpc/grpc-js/src/call-stream.ts +++ /dev/null @@ -1,726 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import * as http2 from 'http2'; - -import { CallCredentials } from './call-credentials'; -import { Propagate, Status } from './constants'; -import { Filter, FilterFactory } from './filter'; -import { FilterStackFactory, FilterStack } from './filter-stack'; -import { Metadata } from './metadata'; -import { StreamDecoder } from './stream-decoder'; -import { ChannelImplementation } from './channel'; -import { Subchannel } from './subchannel'; -import * as logging from './logging'; -import { LogVerbosity } from './constants'; -import { ServerSurfaceCall } from './server-call'; - -const TRACER_NAME = 'call_stream'; - -const { - HTTP2_HEADER_STATUS, - HTTP2_HEADER_CONTENT_TYPE, - NGHTTP2_CANCEL, -} = http2.constants; - -export type Deadline = Date | number; - -export interface CallStreamOptions { - deadline: Deadline; - flags: number; - host: string; - parentCall: ServerSurfaceCall | null; -} - -export type PartialCallStreamOptions = Partial; - -export interface StatusObject { - code: Status; - details: string; - metadata: Metadata; -} - -export const enum WriteFlags { - BufferHint = 1, - NoCompress = 2, - WriteThrough = 4, -} - -export interface WriteObject { - message: Buffer; - flags?: number; -} - -export interface MetadataListener { - (metadata: Metadata, next: (metadata: Metadata) => void): void; -} - -export interface MessageListener { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (message: any, next: (message: any) => void): void; -} - -export interface StatusListener { - (status: StatusObject, next: (status: StatusObject) => void): void; -} - -export interface FullListener { - onReceiveMetadata: MetadataListener; - onReceiveMessage: MessageListener; - onReceiveStatus: StatusListener; -} - -export type Listener = Partial; - -/** - * An object with methods for handling the responses to a call. - */ -export interface InterceptingListener { - onReceiveMetadata(metadata: Metadata): void; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message: any): void; - onReceiveStatus(status: StatusObject): void; -} - -export function isInterceptingListener( - listener: Listener | InterceptingListener -): listener is InterceptingListener { - return ( - listener.onReceiveMetadata !== undefined && - listener.onReceiveMetadata.length === 1 - ); -} - -export class InterceptingListenerImpl implements InterceptingListener { - private processingMessage = false; - private pendingStatus: StatusObject | null = null; - constructor( - private listener: FullListener, - private nextListener: InterceptingListener - ) {} - - onReceiveMetadata(metadata: Metadata): void { - this.listener.onReceiveMetadata(metadata, (metadata) => { - this.nextListener.onReceiveMetadata(metadata); - }); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message: any): void { - /* If this listener processes messages asynchronously, the last message may - * be reordered with respect to the status */ - this.processingMessage = true; - this.listener.onReceiveMessage(message, (msg) => { - this.processingMessage = false; - this.nextListener.onReceiveMessage(msg); - if (this.pendingStatus) { - this.nextListener.onReceiveStatus(this.pendingStatus); - } - }); - } - onReceiveStatus(status: StatusObject): void { - this.listener.onReceiveStatus(status, (processedStatus) => { - if (this.processingMessage) { - this.pendingStatus = processedStatus; - } else { - this.nextListener.onReceiveStatus(processedStatus); - } - }); - } -} - -export interface WriteCallback { - (error?: Error | null): void; -} - -export interface MessageContext { - callback?: WriteCallback; - flags?: number; -} - -export interface Call { - cancelWithStatus(status: Status, details: string): void; - getPeer(): string; - start(metadata: Metadata, listener: InterceptingListener): void; - sendMessageWithContext(context: MessageContext, message: Buffer): void; - startRead(): void; - halfClose(): void; - - getDeadline(): Deadline; - getCredentials(): CallCredentials; - setCredentials(credentials: CallCredentials): void; - getMethod(): string; - getHost(): string; -} - -export class Http2CallStream implements Call { - credentials: CallCredentials; - filterStack: Filter; - private http2Stream: http2.ClientHttp2Stream | null = null; - private pendingRead = false; - private isWriteFilterPending = false; - private pendingWrite: Buffer | null = null; - private pendingWriteCallback: WriteCallback | null = null; - private writesClosed = false; - - private decoder = new StreamDecoder(); - - private isReadFilterPending = false; - private canPush = false; - /** - * Indicates that an 'end' event has come from the http2 stream, so there - * will be no more data events. - */ - private readsClosed = false; - - private statusOutput = false; - - private unpushedReadMessages: Buffer[] = []; - private unfilteredReadMessages: Buffer[] = []; - - // Status code mapped from :status. To be used if grpc-status is not received - private mappedStatusCode: Status = Status.UNKNOWN; - - // This is populated (non-null) if and only if the call has ended - private finalStatus: StatusObject | null = null; - - private subchannel: Subchannel | null = null; - private disconnectListener: () => void; - - private listener: InterceptingListener | null = null; - - constructor( - private readonly methodName: string, - private readonly channel: ChannelImplementation, - private readonly options: CallStreamOptions, - filterStackFactory: FilterStackFactory, - private readonly channelCallCredentials: CallCredentials, - private readonly callNumber: number - ) { - this.filterStack = filterStackFactory.createFilter(this); - this.credentials = channelCallCredentials; - this.disconnectListener = () => { - this.endCall({ - code: Status.UNAVAILABLE, - details: 'Connection dropped', - metadata: new Metadata(), - }); - }; - if (this.options.parentCall && this.options.flags & Propagate.CANCELLATION) { - this.options.parentCall.on('cancelled', () => { - this.cancelWithStatus(Status.CANCELLED, 'Cancelled by parent call'); - }); - } - } - - private outputStatus() { - /* Precondition: this.finalStatus !== null */ - if (!this.statusOutput) { - this.statusOutput = true; - const filteredStatus = this.filterStack.receiveTrailers( - this.finalStatus! - ); - /* We delay the actual action of bubbling up the status to insulate the - * cleanup code in this class from any errors that may be thrown in the - * upper layers as a result of bubbling up the status. In particular, - * if the status is not OK, the "error" event may be emitted - * synchronously at the top level, which will result in a thrown error if - * the user does not handle that event. */ - process.nextTick(() => { - this.listener?.onReceiveStatus(filteredStatus); - }); - if (this.subchannel) { - this.subchannel.callUnref(); - this.subchannel.removeDisconnectListener(this.disconnectListener); - } - } - } - - private trace(text: string): void { - logging.trace( - LogVerbosity.DEBUG, - TRACER_NAME, - '[' + this.callNumber + '] ' + text - ); - } - - /** - * On first call, emits a 'status' event with the given StatusObject. - * Subsequent calls are no-ops. - * @param status The status of the call. - */ - private endCall(status: StatusObject): void { - /* If the status is OK and a new status comes in (e.g. from a - * deserialization failure), that new status takes priority */ - if (this.finalStatus === null || this.finalStatus.code === Status.OK) { - this.trace( - 'ended with status: code=' + - status.code + - ' details="' + - status.details + - '"' - ); - this.finalStatus = status; - this.maybeOutputStatus(); - } - this.destroyHttp2Stream(); - } - - private maybeOutputStatus() { - if (this.finalStatus !== null) { - /* The combination check of readsClosed and that the two message buffer - * arrays are empty checks that there all incoming data has been fully - * processed */ - if ( - this.finalStatus.code !== Status.OK || - (this.readsClosed && - this.unpushedReadMessages.length === 0 && - this.unfilteredReadMessages.length === 0 && - !this.isReadFilterPending) - ) { - this.outputStatus(); - } - } - } - - private push(message: Buffer): void { - this.trace( - 'pushing to reader message of length ' + - (message instanceof Buffer ? message.length : null) - ); - this.canPush = false; - process.nextTick(() => { - /* If we have already output the status any later messages should be - * ignored, and can cause out-of-order operation errors higher up in the - * stack. Checking as late as possible here to avoid any race conditions. - */ - if (this.statusOutput) { - return; - } - this.listener?.onReceiveMessage(message); - this.maybeOutputStatus(); - }); - } - - private handleFilterError(error: Error) { - this.cancelWithStatus(Status.INTERNAL, error.message); - } - - private handleFilteredRead(message: Buffer) { - /* If we the call has already ended with an error, we don't want to do - * anything with this message. Dropping it on the floor is correct - * behavior */ - if (this.finalStatus !== null && this.finalStatus.code !== Status.OK) { - this.maybeOutputStatus(); - return; - } - this.isReadFilterPending = false; - if (this.canPush) { - this.http2Stream!.pause(); - this.push(message); - } else { - this.trace( - 'unpushedReadMessages.push message of length ' + message.length - ); - this.unpushedReadMessages.push(message); - } - if (this.unfilteredReadMessages.length > 0) { - /* nextMessage is guaranteed not to be undefined because - unfilteredReadMessages is non-empty */ - const nextMessage = this.unfilteredReadMessages.shift()!; - this.filterReceivedMessage(nextMessage); - } - } - - private filterReceivedMessage(framedMessage: Buffer) { - /* If we the call has already ended with an error, we don't want to do - * anything with this message. Dropping it on the floor is correct - * behavior */ - if (this.finalStatus !== null && this.finalStatus.code !== Status.OK) { - this.maybeOutputStatus(); - return; - } - this.trace('filterReceivedMessage of length ' + framedMessage.length); - this.isReadFilterPending = true; - this.filterStack - .receiveMessage(Promise.resolve(framedMessage)) - .then( - this.handleFilteredRead.bind(this), - this.handleFilterError.bind(this) - ); - } - - private tryPush(messageBytes: Buffer): void { - if (this.isReadFilterPending) { - this.trace( - 'unfilteredReadMessages.push message of length ' + - (messageBytes && messageBytes.length) - ); - this.unfilteredReadMessages.push(messageBytes); - } else { - this.filterReceivedMessage(messageBytes); - } - } - - private handleTrailers(headers: http2.IncomingHttpHeaders) { - let headersString = ''; - for (const header of Object.keys(headers)) { - headersString += '\t\t' + header + ': ' + headers[header] + '\n'; - } - this.trace('Received server trailers:\n' + headersString); - let metadata: Metadata; - try { - metadata = Metadata.fromHttp2Headers(headers); - } catch (e) { - metadata = new Metadata(); - } - const metadataMap = metadata.getMap(); - let code: Status = this.mappedStatusCode; - if ( - code === Status.UNKNOWN && - typeof metadataMap['grpc-status'] === 'string' - ) { - const receivedStatus = Number(metadataMap['grpc-status']); - if (receivedStatus in Status) { - code = receivedStatus; - this.trace('received status code ' + receivedStatus + ' from server'); - } - metadata.remove('grpc-status'); - } - let details = ''; - if (typeof metadataMap['grpc-message'] === 'string') { - details = decodeURI(metadataMap['grpc-message']); - metadata.remove('grpc-message'); - this.trace( - 'received status details string "' + details + '" from server' - ); - } - const status: StatusObject = { code, details, metadata }; - let finalStatus; - try { - // Attempt to assign final status. - finalStatus = this.filterStack.receiveTrailers(status); - } catch (error) { - // This is a no-op if the call was already ended when handling headers. - this.endCall({ - code: Status.INTERNAL, - details: 'Failed to process received status', - metadata: new Metadata(), - }); - return; - } - // This is a no-op if the call was already ended when handling headers. - this.endCall(finalStatus); - } - - attachHttp2Stream( - stream: http2.ClientHttp2Stream, - subchannel: Subchannel, - extraFilterFactory?: FilterFactory - ): void { - if (extraFilterFactory !== undefined) { - this.filterStack = new FilterStack([ - this.filterStack, - extraFilterFactory.createFilter(this), - ]); - } - if (this.finalStatus !== null) { - stream.close(NGHTTP2_CANCEL); - } else { - this.trace( - 'attachHttp2Stream from subchannel ' + subchannel.getAddress() - ); - this.http2Stream = stream; - this.subchannel = subchannel; - subchannel.addDisconnectListener(this.disconnectListener); - subchannel.callRef(); - stream.on('response', (headers, flags) => { - let headersString = ''; - for (const header of Object.keys(headers)) { - headersString += '\t\t' + header + ': ' + headers[header] + '\n'; - } - this.trace('Received server headers:\n' + headersString); - switch (headers[':status']) { - // TODO(murgatroid99): handle 100 and 101 - case 400: - this.mappedStatusCode = Status.INTERNAL; - break; - case 401: - this.mappedStatusCode = Status.UNAUTHENTICATED; - break; - case 403: - this.mappedStatusCode = Status.PERMISSION_DENIED; - break; - case 404: - this.mappedStatusCode = Status.UNIMPLEMENTED; - break; - case 429: - case 502: - case 503: - case 504: - this.mappedStatusCode = Status.UNAVAILABLE; - break; - default: - this.mappedStatusCode = Status.UNKNOWN; - } - - if (flags & http2.constants.NGHTTP2_FLAG_END_STREAM) { - this.handleTrailers(headers); - } else { - let metadata: Metadata; - try { - metadata = Metadata.fromHttp2Headers(headers); - } catch (error) { - this.endCall({ - code: Status.UNKNOWN, - details: error.message, - metadata: new Metadata(), - }); - return; - } - try { - const finalMetadata = this.filterStack.receiveMetadata(metadata); - this.listener?.onReceiveMetadata(finalMetadata); - } catch (error) { - this.endCall({ - code: Status.UNKNOWN, - details: error.message, - metadata: new Metadata(), - }); - } - } - }); - stream.on('trailers', this.handleTrailers.bind(this)); - stream.on('data', (data: Buffer) => { - this.trace('receive HTTP/2 data frame of length ' + data.length); - const messages = this.decoder.write(data); - - for (const message of messages) { - this.trace('parsed message of length ' + message.length); - this.tryPush(message); - } - }); - stream.on('end', () => { - this.readsClosed = true; - this.maybeOutputStatus(); - }); - stream.on('close', () => { - this.trace('HTTP/2 stream closed with code ' + stream.rstCode); - /* If we have a final status with an OK status code, that means that - * we have received all of the messages and we have processed the - * trailers and the call completed successfully, so it doesn't matter - * how the stream ends after that */ - if (this.finalStatus?.code === Status.OK) { - return; - } - let code: Status; - let details = ''; - switch (stream.rstCode) { - case http2.constants.NGHTTP2_NO_ERROR: - /* If we get a NO_ERROR code and we already have a status, the - * stream completed properly and we just haven't fully processed - * it yet */ - if (this.finalStatus !== null) { - return; - } - code = Status.INTERNAL; - details = `Received RST_STREAM with code ${stream.rstCode}`; - break; - case http2.constants.NGHTTP2_REFUSED_STREAM: - code = Status.UNAVAILABLE; - details = 'Stream refused by server'; - break; - case http2.constants.NGHTTP2_CANCEL: - code = Status.CANCELLED; - details = 'Call cancelled'; - break; - case http2.constants.NGHTTP2_ENHANCE_YOUR_CALM: - code = Status.RESOURCE_EXHAUSTED; - details = 'Bandwidth exhausted'; - break; - case http2.constants.NGHTTP2_INADEQUATE_SECURITY: - code = Status.PERMISSION_DENIED; - details = 'Protocol not secure enough'; - break; - case http2.constants.NGHTTP2_INTERNAL_ERROR: - code = Status.INTERNAL; - /* This error code was previously handled in the default case, and - * there are several instances of it online, so I wanted to - * preserve the original error message so that people find existing - * information in searches, but also include the more recognizable - * "Internal server error" message. */ - details = `Received RST_STREAM with code ${stream.rstCode} (Internal server error)`; - break; - default: - code = Status.INTERNAL; - details = `Received RST_STREAM with code ${stream.rstCode}`; - } - // This is a no-op if trailers were received at all. - // This is OK, because status codes emitted here correspond to more - // catastrophic issues that prevent us from receiving trailers in the - // first place. - this.endCall({ code, details, metadata: new Metadata() }); - }); - stream.on('error', (err: Error) => { - /* We need an error handler here to stop "Uncaught Error" exceptions - * from bubbling up. However, errors here should all correspond to - * "close" events, where we will handle the error more granularly */ - }); - if (!this.pendingRead) { - stream.pause(); - } - if (this.pendingWrite) { - if (!this.pendingWriteCallback) { - throw new Error('Invalid state in write handling code'); - } - this.trace( - 'sending data chunk of length ' + - this.pendingWrite.length + - ' (deferred)' - ); - stream.write(this.pendingWrite, this.pendingWriteCallback); - } - this.maybeCloseWrites(); - } - } - - start(metadata: Metadata, listener: InterceptingListener) { - this.trace('Sending metadata'); - this.listener = listener; - this.channel._startCallStream(this, metadata); - } - - private destroyHttp2Stream() { - // The http2 stream could already have been destroyed if cancelWithStatus - // is called in response to an internal http2 error. - if (this.http2Stream !== null && !this.http2Stream.destroyed) { - /* If the call has ended with an OK status, communicate that when closing - * the stream, partly to avoid a situation in which we detect an error - * RST_STREAM as a result after we have the status */ - let code: number; - if (this.finalStatus?.code === Status.OK) { - code = http2.constants.NGHTTP2_NO_ERROR; - } else { - code = http2.constants.NGHTTP2_CANCEL; - } - this.trace('close http2 stream with code ' + code); - this.http2Stream.close(code); - } - } - - cancelWithStatus(status: Status, details: string): void { - this.trace( - 'cancelWithStatus code: ' + status + ' details: "' + details + '"' - ); - this.endCall({ code: status, details, metadata: new Metadata() }); - } - - getDeadline(): Deadline { - if (this.options.parentCall && this.options.flags & Propagate.DEADLINE) { - return this.options.parentCall.getDeadline(); - } else { - return this.options.deadline; - } - } - - getCredentials(): CallCredentials { - return this.credentials; - } - - setCredentials(credentials: CallCredentials): void { - this.credentials = this.channelCallCredentials.compose(credentials); - } - - getStatus(): StatusObject | null { - return this.finalStatus; - } - - getPeer(): string { - return this.subchannel?.getAddress() ?? this.channel.getTarget(); - } - - getMethod(): string { - return this.methodName; - } - - getHost(): string { - return this.options.host; - } - - startRead() { - /* If the stream has ended with an error, we should not emit any more - * messages and we should communicate that the stream has ended */ - if (this.finalStatus !== null && this.finalStatus.code !== Status.OK) { - this.readsClosed = true; - this.maybeOutputStatus(); - return; - } - this.canPush = true; - if (this.http2Stream === null) { - this.pendingRead = true; - } else { - if (this.unpushedReadMessages.length > 0) { - const nextMessage: Buffer = this.unpushedReadMessages.shift()!; - this.push(nextMessage); - return; - } - /* Only resume reading from the http2Stream if we don't have any pending - * messages to emit */ - this.http2Stream.resume(); - } - } - - private maybeCloseWrites() { - if ( - this.writesClosed && - !this.isWriteFilterPending && - this.http2Stream !== null - ) { - this.trace('calling end() on HTTP/2 stream'); - this.http2Stream.end(); - } - } - - sendMessageWithContext(context: MessageContext, message: Buffer) { - this.trace('write() called with message of length ' + message.length); - const writeObj: WriteObject = { - message, - flags: context.flags, - }; - const cb: WriteCallback = context.callback ?? (() => {}); - this.isWriteFilterPending = true; - this.filterStack.sendMessage(Promise.resolve(writeObj)).then((message) => { - this.isWriteFilterPending = false; - if (this.http2Stream === null) { - this.trace( - 'deferring writing data chunk of length ' + message.message.length - ); - this.pendingWrite = message.message; - this.pendingWriteCallback = cb; - } else { - this.trace('sending data chunk of length ' + message.message.length); - this.http2Stream.write(message.message, cb); - this.maybeCloseWrites(); - } - }, this.handleFilterError.bind(this)); - } - - halfClose() { - this.trace('end() called'); - this.writesClosed = true; - this.maybeCloseWrites(); - } -} diff --git a/node_modules/@grpc/grpc-js/src/call.ts b/node_modules/@grpc/grpc-js/src/call.ts deleted file mode 100644 index cfe37ecf..00000000 --- a/node_modules/@grpc/grpc-js/src/call.ts +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { EventEmitter } from 'events'; -import { Duplex, Readable, Writable } from 'stream'; - -import { StatusObject, MessageContext } from './call-stream'; -import { Status } from './constants'; -import { EmitterAugmentation1 } from './events'; -import { Metadata } from './metadata'; -import { ObjectReadable, ObjectWritable, WriteCallback } from './object-stream'; -import { InterceptingCallInterface } from './client-interceptors'; - -/** - * A type extending the built-in Error object with additional fields. - */ -export type ServiceError = StatusObject & Error; - -/** - * A base type for all user-facing values returned by client-side method calls. - */ -export type SurfaceCall = { - call?: InterceptingCallInterface; - cancel(): void; - getPeer(): string; -} & EmitterAugmentation1<'metadata', Metadata> & - EmitterAugmentation1<'status', StatusObject> & - EventEmitter; - -/** - * A type representing the return value of a unary method call. - */ -export type ClientUnaryCall = SurfaceCall; - -/** - * A type representing the return value of a server stream method call. - */ -export type ClientReadableStream = { - deserialize: (chunk: Buffer) => ResponseType; -} & SurfaceCall & - ObjectReadable; - -/** - * A type representing the return value of a client stream method call. - */ -export type ClientWritableStream = { - serialize: (value: RequestType) => Buffer; -} & SurfaceCall & - ObjectWritable; - -/** - * A type representing the return value of a bidirectional stream method call. - */ -export type ClientDuplexStream< - RequestType, - ResponseType -> = ClientWritableStream & ClientReadableStream; - -/** - * Construct a ServiceError from a StatusObject. This function exists primarily - * as an attempt to make the error stack trace clearly communicate that the - * error is not necessarily a problem in gRPC itself. - * @param status - */ -export function callErrorFromStatus(status: StatusObject): ServiceError { - const message = `${status.code} ${Status[status.code]}: ${status.details}`; - return Object.assign(new Error(message), status); -} - -export class ClientUnaryCallImpl extends EventEmitter - implements ClientUnaryCall { - public call?: InterceptingCallInterface; - constructor() { - super(); - } - - cancel(): void { - this.call?.cancelWithStatus(Status.CANCELLED, 'Cancelled on client'); - } - - getPeer(): string { - return this.call?.getPeer() ?? 'unknown'; - } -} - -export class ClientReadableStreamImpl extends Readable - implements ClientReadableStream { - public call?: InterceptingCallInterface; - constructor(readonly deserialize: (chunk: Buffer) => ResponseType) { - super({ objectMode: true }); - } - - cancel(): void { - this.call?.cancelWithStatus(Status.CANCELLED, 'Cancelled on client'); - } - - getPeer(): string { - return this.call?.getPeer() ?? 'unknown'; - } - - _read(_size: number): void { - this.call?.startRead(); - } -} - -export class ClientWritableStreamImpl extends Writable - implements ClientWritableStream { - public call?: InterceptingCallInterface; - constructor(readonly serialize: (value: RequestType) => Buffer) { - super({ objectMode: true }); - } - - cancel(): void { - this.call?.cancelWithStatus(Status.CANCELLED, 'Cancelled on client'); - } - - getPeer(): string { - return this.call?.getPeer() ?? 'unknown'; - } - - _write(chunk: RequestType, encoding: string, cb: WriteCallback) { - const context: MessageContext = { - callback: cb, - }; - const flags = Number(encoding); - if (!Number.isNaN(flags)) { - context.flags = flags; - } - this.call?.sendMessageWithContext(context, chunk); - } - - _final(cb: Function) { - this.call?.halfClose(); - cb(); - } -} - -export class ClientDuplexStreamImpl extends Duplex - implements ClientDuplexStream { - public call?: InterceptingCallInterface; - constructor( - readonly serialize: (value: RequestType) => Buffer, - readonly deserialize: (chunk: Buffer) => ResponseType - ) { - super({ objectMode: true }); - } - - cancel(): void { - this.call?.cancelWithStatus(Status.CANCELLED, 'Cancelled on client'); - } - - getPeer(): string { - return this.call?.getPeer() ?? 'unknown'; - } - - _read(_size: number): void { - this.call?.startRead(); - } - - _write(chunk: RequestType, encoding: string, cb: WriteCallback) { - const context: MessageContext = { - callback: cb, - }; - const flags = Number(encoding); - if (!Number.isNaN(flags)) { - context.flags = flags; - } - this.call?.sendMessageWithContext(context, chunk); - } - - _final(cb: Function) { - this.call?.halfClose(); - cb(); - } -} diff --git a/node_modules/@grpc/grpc-js/src/channel-credentials.ts b/node_modules/@grpc/grpc-js/src/channel-credentials.ts deleted file mode 100644 index aadf638b..00000000 --- a/node_modules/@grpc/grpc-js/src/channel-credentials.ts +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { ConnectionOptions, createSecureContext, PeerCertificate } from 'tls'; - -import { CallCredentials } from './call-credentials'; -import { CIPHER_SUITES, getDefaultRootsData } from './tls-helpers'; -import { GoogleAuth as GoogleAuthType } from 'google-auth-library'; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function verifyIsBufferOrNull(obj: any, friendlyName: string): void { - if (obj && !(obj instanceof Buffer)) { - throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`); - } -} - -/** - * A certificate as received by the checkServerIdentity callback. - */ -export interface Certificate { - /** - * The raw certificate in DER form. - */ - raw: Buffer; -} - -/** - * A callback that will receive the expected hostname and presented peer - * certificate as parameters. The callback should return an error to - * indicate that the presented certificate is considered invalid and - * otherwise returned undefined. - */ -export type CheckServerIdentityCallback = ( - hostname: string, - cert: Certificate -) => Error | undefined; - -function bufferOrNullEqual(buf1: Buffer | null, buf2: Buffer | null) { - if (buf1 === null && buf2 === null) { - return true; - } else { - return buf1 !== null && buf2 !== null && buf1.equals(buf2); - } -} - -/** - * Additional peer verification options that can be set when creating - * SSL credentials. - */ -export interface VerifyOptions { - /** - * If set, this callback will be invoked after the usual hostname verification - * has been performed on the peer certificate. - */ - checkServerIdentity?: CheckServerIdentityCallback; -} - -/** - * A class that contains credentials for communicating over a channel, as well - * as a set of per-call credentials, which are applied to every method call made - * over a channel initialized with an instance of this class. - */ -export abstract class ChannelCredentials { - protected callCredentials: CallCredentials; - - protected constructor(callCredentials?: CallCredentials) { - this.callCredentials = callCredentials || CallCredentials.createEmpty(); - } - /** - * Returns a copy of this object with the included set of per-call credentials - * expanded to include callCredentials. - * @param callCredentials A CallCredentials object to associate with this - * instance. - */ - abstract compose(callCredentials: CallCredentials): ChannelCredentials; - - /** - * Gets the set of per-call credentials associated with this instance. - */ - _getCallCredentials(): CallCredentials { - return this.callCredentials; - } - - /** - * Gets a SecureContext object generated from input parameters if this - * instance was created with createSsl, or null if this instance was created - * with createInsecure. - */ - abstract _getConnectionOptions(): ConnectionOptions | null; - - /** - * Indicates whether this credentials object creates a secure channel. - */ - abstract _isSecure(): boolean; - - /** - * Check whether two channel credentials objects are equal. Two secure - * credentials are equal if they were constructed with the same parameters. - * @param other The other ChannelCredentials Object - */ - abstract _equals(other: ChannelCredentials): boolean; - - /** - * Return a new ChannelCredentials instance with a given set of credentials. - * The resulting instance can be used to construct a Channel that communicates - * over TLS. - * @param rootCerts The root certificate data. - * @param privateKey The client certificate private key, if available. - * @param certChain The client certificate key chain, if available. - */ - static createSsl( - rootCerts?: Buffer | null, - privateKey?: Buffer | null, - certChain?: Buffer | null, - verifyOptions?: VerifyOptions - ): ChannelCredentials { - verifyIsBufferOrNull(rootCerts, 'Root certificate'); - verifyIsBufferOrNull(privateKey, 'Private key'); - verifyIsBufferOrNull(certChain, 'Certificate chain'); - if (privateKey && !certChain) { - throw new Error( - 'Private key must be given with accompanying certificate chain' - ); - } - if (!privateKey && certChain) { - throw new Error( - 'Certificate chain must be given with accompanying private key' - ); - } - return new SecureChannelCredentialsImpl( - rootCerts || getDefaultRootsData(), - privateKey || null, - certChain || null, - verifyOptions || {} - ); - } - - /** - * Return a new ChannelCredentials instance with no credentials. - */ - static createInsecure(): ChannelCredentials { - return new InsecureChannelCredentialsImpl(); - } -} - -class InsecureChannelCredentialsImpl extends ChannelCredentials { - constructor(callCredentials?: CallCredentials) { - super(callCredentials); - } - - compose(callCredentials: CallCredentials): ChannelCredentials { - throw new Error('Cannot compose insecure credentials'); - } - - _getConnectionOptions(): ConnectionOptions | null { - return null; - } - _isSecure(): boolean { - return false; - } - _equals(other: ChannelCredentials): boolean { - return other instanceof InsecureChannelCredentialsImpl; - } -} - -class SecureChannelCredentialsImpl extends ChannelCredentials { - connectionOptions: ConnectionOptions; - - constructor( - private rootCerts: Buffer | null, - private privateKey: Buffer | null, - private certChain: Buffer | null, - private verifyOptions: VerifyOptions - ) { - super(); - const secureContext = createSecureContext({ - ca: rootCerts || undefined, - key: privateKey || undefined, - cert: certChain || undefined, - ciphers: CIPHER_SUITES, - }); - this.connectionOptions = { secureContext }; - if (verifyOptions && verifyOptions.checkServerIdentity) { - this.connectionOptions.checkServerIdentity = ( - host: string, - cert: PeerCertificate - ) => { - return verifyOptions.checkServerIdentity!(host, { raw: cert.raw }); - }; - } - } - - compose(callCredentials: CallCredentials): ChannelCredentials { - const combinedCallCredentials = this.callCredentials.compose( - callCredentials - ); - return new ComposedChannelCredentialsImpl(this, combinedCallCredentials); - } - - _getConnectionOptions(): ConnectionOptions | null { - // Copy to prevent callers from mutating this.connectionOptions - return { ...this.connectionOptions }; - } - _isSecure(): boolean { - return true; - } - _equals(other: ChannelCredentials): boolean { - if (this === other) { - return true; - } - if (other instanceof SecureChannelCredentialsImpl) { - if (!bufferOrNullEqual(this.rootCerts, other.rootCerts)) { - return false; - } - if (!bufferOrNullEqual(this.privateKey, other.privateKey)) { - return false; - } - if (!bufferOrNullEqual(this.certChain, other.certChain)) { - return false; - } - return ( - this.verifyOptions.checkServerIdentity === - other.verifyOptions.checkServerIdentity - ); - } else { - return false; - } - } -} - -class ComposedChannelCredentialsImpl extends ChannelCredentials { - constructor( - private channelCredentials: SecureChannelCredentialsImpl, - callCreds: CallCredentials - ) { - super(callCreds); - } - compose(callCredentials: CallCredentials) { - const combinedCallCredentials = this.callCredentials.compose( - callCredentials - ); - return new ComposedChannelCredentialsImpl( - this.channelCredentials, - combinedCallCredentials - ); - } - - _getConnectionOptions(): ConnectionOptions | null { - return this.channelCredentials._getConnectionOptions(); - } - _isSecure(): boolean { - return true; - } - _equals(other: ChannelCredentials): boolean { - if (this === other) { - return true; - } - if (other instanceof ComposedChannelCredentialsImpl) { - return ( - this.channelCredentials._equals(other.channelCredentials) && - this.callCredentials._equals(other.callCredentials) - ); - } else { - return false; - } - } -} - -export function createGoogleDefaultCredentials(): ChannelCredentials { - const GoogleAuth = require('google-auth-library') - .GoogleAuth as typeof GoogleAuthType; - const sslCreds = ChannelCredentials.createSsl(); - const googleAuthCreds = CallCredentials.createFromGoogleCredential( - new GoogleAuth() - ); - return sslCreds.compose(googleAuthCreds); -} diff --git a/node_modules/@grpc/grpc-js/src/channel-options.ts b/node_modules/@grpc/grpc-js/src/channel-options.ts deleted file mode 100644 index df6cbb2b..00000000 --- a/node_modules/@grpc/grpc-js/src/channel-options.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** - * An interface that contains options used when initializing a Channel instance. - */ -export interface ChannelOptions { - 'grpc.ssl_target_name_override'?: string; - 'grpc.primary_user_agent'?: string; - 'grpc.secondary_user_agent'?: string; - 'grpc.default_authority'?: string; - 'grpc.keepalive_time_ms'?: number; - 'grpc.keepalive_timeout_ms'?: number; - 'grpc.keepalive_permit_without_calls'?: number; - 'grpc.service_config'?: string; - 'grpc.max_concurrent_streams'?: number; - 'grpc.initial_reconnect_backoff_ms'?: number; - 'grpc.max_reconnect_backoff_ms'?: number; - 'grpc.use_local_subchannel_pool'?: number; - 'grpc.max_send_message_length'?: number; - 'grpc.max_receive_message_length'?: number; - 'grpc.enable_http_proxy'?: number; - 'grpc.http_connect_target'?: string; - 'grpc.http_connect_creds'?: string; - [key: string]: any; -} - -/** - * This is for checking provided options at runtime. This is an object for - * easier membership checking. - */ -export const recognizedOptions = { - 'grpc.ssl_target_name_override': true, - 'grpc.primary_user_agent': true, - 'grpc.secondary_user_agent': true, - 'grpc.default_authority': true, - 'grpc.keepalive_time_ms': true, - 'grpc.keepalive_timeout_ms': true, - 'grpc.keepalive_permit_without_calls': true, - 'grpc.service_config': true, - 'grpc.max_concurrent_streams': true, - 'grpc.initial_reconnect_backoff_ms': true, - 'grpc.max_reconnect_backoff_ms': true, - 'grpc.use_local_subchannel_pool': true, - 'grpc.max_send_message_length': true, - 'grpc.max_receive_message_length': true, - 'grpc.enable_http_proxy': true, -}; - -export function channelOptionsEqual( - options1: ChannelOptions, - options2: ChannelOptions -) { - const keys1 = Object.keys(options1).sort(); - const keys2 = Object.keys(options2).sort(); - if (keys1.length !== keys2.length) { - return false; - } - for (let i = 0; i < keys1.length; i += 1) { - if (keys1[i] !== keys2[i]) { - return false; - } - if (options1[keys1[i]] !== options2[keys2[i]]) { - return false; - } - } - return true; -} diff --git a/node_modules/@grpc/grpc-js/src/channel.ts b/node_modules/@grpc/grpc-js/src/channel.ts deleted file mode 100644 index e1a76c09..00000000 --- a/node_modules/@grpc/grpc-js/src/channel.ts +++ /dev/null @@ -1,556 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - Deadline, - Call, - Http2CallStream, - CallStreamOptions, -} from './call-stream'; -import { ChannelCredentials } from './channel-credentials'; -import { ChannelOptions } from './channel-options'; -import { ResolvingLoadBalancer } from './resolving-load-balancer'; -import { SubchannelPool, getSubchannelPool } from './subchannel-pool'; -import { ChannelControlHelper } from './load-balancer'; -import { UnavailablePicker, Picker, PickResultType } from './picker'; -import { Metadata } from './metadata'; -import { Status, LogVerbosity, Propagate } from './constants'; -import { FilterStackFactory } from './filter-stack'; -import { CallCredentialsFilterFactory } from './call-credentials-filter'; -import { DeadlineFilterFactory } from './deadline-filter'; -import { CompressionFilterFactory } from './compression-filter'; -import { getDefaultAuthority, mapUriDefaultScheme } from './resolver'; -import { trace, log } from './logging'; -import { SubchannelAddress } from './subchannel'; -import { MaxMessageSizeFilterFactory } from './max-message-size-filter'; -import { mapProxyName } from './http_proxy'; -import { GrpcUri, parseUri, uriToString } from './uri-parser'; -import { ServerSurfaceCall } from './server-call'; -import { SurfaceCall } from './call'; - -export enum ConnectivityState { - IDLE, - CONNECTING, - READY, - TRANSIENT_FAILURE, - SHUTDOWN, -} - -/** - * See https://nodejs.org/api/timers.html#timers_setinterval_callback_delay_args - */ -const MAX_TIMEOUT_TIME = 2147483647; - -let nextCallNumber = 0; - -function getNewCallNumber(): number { - const callNumber = nextCallNumber; - nextCallNumber += 1; - if (nextCallNumber >= Number.MAX_SAFE_INTEGER) { - nextCallNumber = 0; - } - return callNumber; -} - -/** - * An interface that represents a communication channel to a server specified - * by a given address. - */ -export interface Channel { - /** - * Close the channel. This has the same functionality as the existing - * grpc.Client.prototype.close - */ - close(): void; - /** - * Return the target that this channel connects to - */ - getTarget(): string; - /** - * Get the channel's current connectivity state. This method is here mainly - * because it is in the existing internal Channel class, and there isn't - * another good place to put it. - * @param tryToConnect If true, the channel will start connecting if it is - * idle. Otherwise, idle channels will only start connecting when a - * call starts. - */ - getConnectivityState(tryToConnect: boolean): ConnectivityState; - /** - * Watch for connectivity state changes. This is also here mainly because - * it is in the existing external Channel class. - * @param currentState The state to watch for transitions from. This should - * always be populated by calling getConnectivityState immediately - * before. - * @param deadline A deadline for waiting for a state change - * @param callback Called with no error when a state change, or with an - * error if the deadline passes without a state change. - */ - watchConnectivityState( - currentState: ConnectivityState, - deadline: Date | number, - callback: (error?: Error) => void - ): void; - /** - * Create a call object. Call is an opaque type that is used by the Client - * class. This function is called by the gRPC library when starting a - * request. Implementers should return an instance of Call that is returned - * from calling createCall on an instance of the provided Channel class. - * @param method The full method string to request. - * @param deadline The call deadline - * @param host A host string override for making the request - * @param parentCall A server call to propagate some information from - * @param propagateFlags A bitwise combination of elements of grpc.propagate - * that indicates what information to propagate from parentCall. - */ - createCall( - method: string, - deadline: Deadline, - host: string | null | undefined, - parentCall: ServerSurfaceCall | null, - propagateFlags: number | null | undefined - ): Call; -} - -interface ConnectivityStateWatcher { - currentState: ConnectivityState; - timer: NodeJS.Timeout | null; - callback: (error?: Error) => void; -} - -export class ChannelImplementation implements Channel { - private resolvingLoadBalancer: ResolvingLoadBalancer; - private subchannelPool: SubchannelPool; - private connectivityState: ConnectivityState = ConnectivityState.IDLE; - private currentPicker: Picker = new UnavailablePicker(); - private pickQueue: Array<{ - callStream: Http2CallStream; - callMetadata: Metadata; - }> = []; - private connectivityStateWatchers: ConnectivityStateWatcher[] = []; - private defaultAuthority: string; - private filterStackFactory: FilterStackFactory; - private target: GrpcUri; - /** - * This timer does not do anything on its own. Its purpose is to hold the - * event loop open while there are any pending calls for the channel that - * have not yet been assigned to specific subchannels. In other words, - * the invariant is that callRefTimer is reffed if and only if pickQueue - * is non-empty. - */ - private callRefTimer: NodeJS.Timer; - constructor( - target: string, - private readonly credentials: ChannelCredentials, - private readonly options: ChannelOptions - ) { - if (typeof target !== 'string') { - throw new TypeError('Channel target must be a string'); - } - if (!(credentials instanceof ChannelCredentials)) { - throw new TypeError( - 'Channel credentials must be a ChannelCredentials object' - ); - } - if (options) { - if ( - typeof options !== 'object' || - !Object.values(options).every( - (value) => - typeof value === 'string' || - typeof value === 'number' || - typeof value === 'undefined' - ) - ) { - throw new TypeError( - 'Channel options must be an object with string or number values' - ); - } - } - const originalTargetUri = parseUri(target); - if (originalTargetUri === null) { - throw new Error(`Could not parse target name "${target}"`); - } - /* This ensures that the target has a scheme that is registered with the - * resolver */ - const defaultSchemeMapResult = mapUriDefaultScheme(originalTargetUri); - if (defaultSchemeMapResult === null) { - throw new Error( - `Could not find a default scheme for target name "${target}"` - ); - } - - this.callRefTimer = setInterval(() => {}, MAX_TIMEOUT_TIME); - this.callRefTimer.unref?.(); - - if (this.options['grpc.default_authority']) { - this.defaultAuthority = this.options['grpc.default_authority'] as string; - } else { - this.defaultAuthority = getDefaultAuthority(defaultSchemeMapResult); - } - const proxyMapResult = mapProxyName(defaultSchemeMapResult, options); - this.target = proxyMapResult.target; - this.options = Object.assign({}, this.options, proxyMapResult.extraOptions); - - /* The global boolean parameter to getSubchannelPool has the inverse meaning to what - * the grpc.use_local_subchannel_pool channel option means. */ - this.subchannelPool = getSubchannelPool( - (options['grpc.use_local_subchannel_pool'] ?? 0) === 0 - ); - const channelControlHelper: ChannelControlHelper = { - createSubchannel: ( - subchannelAddress: SubchannelAddress, - subchannelArgs: ChannelOptions - ) => { - return this.subchannelPool.getOrCreateSubchannel( - this.target, - subchannelAddress, - Object.assign({}, this.options, subchannelArgs), - this.credentials - ); - }, - updateState: (connectivityState: ConnectivityState, picker: Picker) => { - this.currentPicker = picker; - const queueCopy = this.pickQueue.slice(); - this.callRefTimer.unref?.(); - this.pickQueue = []; - for (const { callStream, callMetadata } of queueCopy) { - this.tryPick(callStream, callMetadata); - } - this.updateState(connectivityState); - }, - requestReresolution: () => { - // This should never be called. - throw new Error( - 'Resolving load balancer should never call requestReresolution' - ); - }, - }; - this.resolvingLoadBalancer = new ResolvingLoadBalancer( - this.target, - channelControlHelper, - options - ); - this.filterStackFactory = new FilterStackFactory([ - new CallCredentialsFilterFactory(this), - new DeadlineFilterFactory(this), - new MaxMessageSizeFilterFactory(this.options), - new CompressionFilterFactory(this), - ]); - } - - private pushPick(callStream: Http2CallStream, callMetadata: Metadata) { - this.callRefTimer.ref?.(); - this.pickQueue.push({ callStream, callMetadata }); - } - - /** - * Check the picker output for the given call and corresponding metadata, - * and take any relevant actions. Should not be called while iterating - * over pickQueue. - * @param callStream - * @param callMetadata - */ - private tryPick(callStream: Http2CallStream, callMetadata: Metadata) { - const pickResult = this.currentPicker.pick({ metadata: callMetadata }); - trace( - LogVerbosity.DEBUG, - 'channel', - 'Pick result: ' + - PickResultType[pickResult.pickResultType] + - ' subchannel: ' + - pickResult.subchannel?.getAddress() + - ' status: ' + - pickResult.status?.code + - ' ' + - pickResult.status?.details - ); - switch (pickResult.pickResultType) { - case PickResultType.COMPLETE: - if (pickResult.subchannel === null) { - callStream.cancelWithStatus( - Status.UNAVAILABLE, - 'Request dropped by load balancing policy' - ); - // End the call with an error - } else { - /* If the subchannel is not in the READY state, that indicates a bug - * somewhere in the load balancer or picker. So, we log an error and - * queue the pick to be tried again later. */ - if ( - pickResult.subchannel!.getConnectivityState() !== - ConnectivityState.READY - ) { - log( - LogVerbosity.ERROR, - 'Error: COMPLETE pick result subchannel ' + - pickResult.subchannel!.getAddress() + - ' has state ' + - ConnectivityState[pickResult.subchannel!.getConnectivityState()] - ); - this.pushPick(callStream, callMetadata); - break; - } - /* We need to clone the callMetadata here because the transparent - * retry code in the promise resolution handler use the same - * callMetadata object, so it needs to stay unmodified */ - callStream.filterStack - .sendMetadata(Promise.resolve(callMetadata.clone())) - .then( - (finalMetadata) => { - const subchannelState: ConnectivityState = pickResult.subchannel!.getConnectivityState(); - if (subchannelState === ConnectivityState.READY) { - try { - pickResult.subchannel!.startCallStream( - finalMetadata, - callStream, - pickResult.extraFilterFactory ?? undefined - ); - /* If we reach this point, the call stream has started - * successfully */ - pickResult.onCallStarted?.(); - } catch (error) { - if ( - (error as NodeJS.ErrnoException).code === - 'ERR_HTTP2_GOAWAY_SESSION' - ) { - /* An error here indicates that something went wrong with - * the picked subchannel's http2 stream right before we - * tried to start the stream. We are handling a promise - * result here, so this is asynchronous with respect to the - * original tryPick call, so calling it again is not - * recursive. We call tryPick immediately instead of - * queueing this pick again because handling the queue is - * triggered by state changes, and we want to immediately - * check if the state has already changed since the - * previous tryPick call. We do this instead of cancelling - * the stream because the correct behavior may be - * re-queueing instead, based on the logic in the rest of - * tryPick */ - trace( - LogVerbosity.INFO, - 'channel', - 'Failed to start call on picked subchannel ' + - pickResult.subchannel!.getAddress() + - ' with error ' + - (error as Error).message + - '. Retrying pick' - ); - this.tryPick(callStream, callMetadata); - } else { - trace( - LogVerbosity.INFO, - 'channel', - 'Failed to start call on picked subchanel ' + - pickResult.subchannel!.getAddress() + - ' with error ' + - (error as Error).message + - '. Ending call' - ); - callStream.cancelWithStatus( - Status.INTERNAL, - 'Failed to start HTTP/2 stream' - ); - } - } - } else { - /* The logic for doing this here is the same as in the catch - * block above */ - trace( - LogVerbosity.INFO, - 'channel', - 'Picked subchannel ' + - pickResult.subchannel!.getAddress() + - ' has state ' + - ConnectivityState[subchannelState] + - ' after metadata filters. Retrying pick' - ); - this.tryPick(callStream, callMetadata); - } - }, - (error: Error & { code: number }) => { - // We assume the error code isn't 0 (Status.OK) - callStream.cancelWithStatus( - error.code || Status.UNKNOWN, - `Getting metadata from plugin failed with error: ${error.message}` - ); - } - ); - } - break; - case PickResultType.QUEUE: - this.pushPick(callStream, callMetadata); - break; - case PickResultType.TRANSIENT_FAILURE: - if (callMetadata.getOptions().waitForReady) { - this.pushPick(callStream, callMetadata); - } else { - callStream.cancelWithStatus( - pickResult.status!.code, - pickResult.status!.details - ); - } - break; - case PickResultType.DROP: - callStream.cancelWithStatus( - pickResult.status!.code, - pickResult.status!.details - ); - break; - default: - throw new Error( - `Invalid state: unknown pickResultType ${pickResult.pickResultType}` - ); - } - } - - private removeConnectivityStateWatcher( - watcherObject: ConnectivityStateWatcher - ) { - const watcherIndex = this.connectivityStateWatchers.findIndex( - (value) => value === watcherObject - ); - if (watcherIndex >= 0) { - this.connectivityStateWatchers.splice(watcherIndex, 1); - } - } - - private updateState(newState: ConnectivityState): void { - trace( - LogVerbosity.DEBUG, - 'connectivity_state', - uriToString(this.target) + - ' ' + - ConnectivityState[this.connectivityState] + - ' -> ' + - ConnectivityState[newState] - ); - this.connectivityState = newState; - const watchersCopy = this.connectivityStateWatchers.slice(); - for (const watcherObject of watchersCopy) { - if (newState !== watcherObject.currentState) { - if(watcherObject.timer) { - clearTimeout(watcherObject.timer); - } - this.removeConnectivityStateWatcher(watcherObject); - watcherObject.callback(); - } - } - } - - _startCallStream(stream: Http2CallStream, metadata: Metadata) { - this.tryPick(stream, metadata.clone()); - } - - close() { - this.resolvingLoadBalancer.destroy(); - this.updateState(ConnectivityState.SHUTDOWN); - clearInterval(this.callRefTimer); - - this.subchannelPool.unrefUnusedSubchannels(); - } - - getTarget() { - return uriToString(this.target); - } - - getConnectivityState(tryToConnect: boolean) { - const connectivityState = this.connectivityState; - if (tryToConnect) { - this.resolvingLoadBalancer.exitIdle(); - } - return connectivityState; - } - - watchConnectivityState( - currentState: ConnectivityState, - deadline: Date | number, - callback: (error?: Error) => void - ): void { - let timer = null; - if(deadline !== Infinity) { - const deadlineDate: Date = - deadline instanceof Date ? deadline : new Date(deadline); - const now = new Date(); - if (deadline === -Infinity || deadlineDate <= now) { - process.nextTick( - callback, - new Error('Deadline passed without connectivity state change') - ); - return; - } - timer = setTimeout(() => { - this.removeConnectivityStateWatcher(watcherObject); - callback( - new Error('Deadline passed without connectivity state change') - ); - }, deadlineDate.getTime() - now.getTime()) - } - const watcherObject = { - currentState, - callback, - timer - }; - this.connectivityStateWatchers.push(watcherObject); - } - - createCall( - method: string, - deadline: Deadline, - host: string | null | undefined, - parentCall: ServerSurfaceCall | null, - propagateFlags: number | null | undefined - ): Call { - if (typeof method !== 'string') { - throw new TypeError('Channel#createCall: method must be a string'); - } - if (!(typeof deadline === 'number' || deadline instanceof Date)) { - throw new TypeError( - 'Channel#createCall: deadline must be a number or Date' - ); - } - if (this.connectivityState === ConnectivityState.SHUTDOWN) { - throw new Error('Channel has been shut down'); - } - const callNumber = getNewCallNumber(); - trace( - LogVerbosity.DEBUG, - 'channel', - uriToString(this.target) + - ' createCall [' + - callNumber + - '] method="' + - method + - '", deadline=' + - deadline - ); - const finalOptions: CallStreamOptions = { - deadline: deadline, - flags: propagateFlags ?? Propagate.DEFAULTS, - host: host ?? this.defaultAuthority, - parentCall: parentCall, - }; - const stream: Http2CallStream = new Http2CallStream( - method, - this, - finalOptions, - this.filterStackFactory, - this.credentials._getCallCredentials(), - callNumber - ); - return stream; - } -} diff --git a/node_modules/@grpc/grpc-js/src/client-interceptors.ts b/node_modules/@grpc/grpc-js/src/client-interceptors.ts deleted file mode 100644 index 09e7f5aa..00000000 --- a/node_modules/@grpc/grpc-js/src/client-interceptors.ts +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Metadata } from './metadata'; -import { - StatusObject, - Listener, - MetadataListener, - MessageListener, - StatusListener, - FullListener, - InterceptingListener, - InterceptingListenerImpl, - isInterceptingListener, - MessageContext, - Call, -} from './call-stream'; -import { Status } from './constants'; -import { Channel } from './channel'; -import { CallOptions } from './client'; -import { CallCredentials } from './call-credentials'; -import { ClientMethodDefinition } from './make-client'; - -/** - * Error class associated with passing both interceptors and interceptor - * providers to a client constructor or as call options. - */ -export class InterceptorConfigurationError extends Error { - constructor(message: string) { - super(message); - this.name = 'InterceptorConfigurationError'; - Error.captureStackTrace(this, InterceptorConfigurationError); - } -} - -export interface MetadataRequester { - ( - metadata: Metadata, - listener: InterceptingListener, - next: ( - metadata: Metadata, - listener: InterceptingListener | Listener - ) => void - ): void; -} - -export interface MessageRequester { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (message: any, next: (message: any) => void): void; -} - -export interface CloseRequester { - (next: () => void): void; -} - -export interface CancelRequester { - (next: () => void): void; -} - -/** - * An object with methods for intercepting and modifying outgoing call operations. - */ -export interface FullRequester { - start: MetadataRequester; - sendMessage: MessageRequester; - halfClose: CloseRequester; - cancel: CancelRequester; -} - -export type Requester = Partial; - -export class ListenerBuilder { - private metadata: MetadataListener | undefined = undefined; - private message: MessageListener | undefined = undefined; - private status: StatusListener | undefined = undefined; - - withOnReceiveMetadata(onReceiveMetadata: MetadataListener): this { - this.metadata = onReceiveMetadata; - return this; - } - - withOnReceiveMessage(onReceiveMessage: MessageListener): this { - this.message = onReceiveMessage; - return this; - } - - withOnReceiveStatus(onReceiveStatus: StatusListener): this { - this.status = onReceiveStatus; - return this; - } - - build(): Listener { - return { - onReceiveMetadata: this.metadata, - onReceiveMessage: this.message, - onReceiveStatus: this.status, - }; - } -} - -export class RequesterBuilder { - private start: MetadataRequester | undefined = undefined; - private message: MessageRequester | undefined = undefined; - private halfClose: CloseRequester | undefined = undefined; - private cancel: CancelRequester | undefined = undefined; - - withStart(start: MetadataRequester): this { - this.start = start; - return this; - } - - withSendMessage(sendMessage: MessageRequester): this { - this.message = sendMessage; - return this; - } - - withHalfClose(halfClose: CloseRequester): this { - this.halfClose = halfClose; - return this; - } - - withCancel(cancel: CancelRequester): this { - this.cancel = cancel; - return this; - } - - build(): Requester { - return { - start: this.start, - sendMessage: this.message, - halfClose: this.halfClose, - cancel: this.cancel, - }; - } -} - -/** - * A Listener with a default pass-through implementation of each method. Used - * for filling out Listeners with some methods omitted. - */ -const defaultListener: FullListener = { - onReceiveMetadata: (metadata, next) => { - next(metadata); - }, - onReceiveMessage: (message, next) => { - next(message); - }, - onReceiveStatus: (status, next) => { - next(status); - }, -}; - -/** - * A Requester with a default pass-through implementation of each method. Used - * for filling out Requesters with some methods omitted. - */ -const defaultRequester: FullRequester = { - start: (metadata, listener, next) => { - next(metadata, listener); - }, - sendMessage: (message, next) => { - next(message); - }, - halfClose: (next) => { - next(); - }, - cancel: (next) => { - next(); - }, -}; - -export interface InterceptorOptions extends CallOptions { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - method_definition: ClientMethodDefinition; -} - -export interface InterceptingCallInterface { - cancelWithStatus(status: Status, details: string): void; - getPeer(): string; - start(metadata: Metadata, listener?: Partial): void; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessageWithContext(context: MessageContext, message: any): void; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessage(message: any): void; - startRead(): void; - halfClose(): void; - - setCredentials(credentials: CallCredentials): void; -} - -export class InterceptingCall implements InterceptingCallInterface { - /** - * The requester that this InterceptingCall uses to modify outgoing operations - */ - private requester: FullRequester; - /** - * Indicates that a message has been passed to the listener's onReceiveMessage - * method it has not been passed to the corresponding next callback - */ - private processingMessage = false; - /** - * Indicates that a status was received but could not be propagated because - * a message was still being processed. - */ - private pendingHalfClose = false; - constructor( - private nextCall: InterceptingCallInterface, - requester?: Requester - ) { - if (requester) { - this.requester = { - start: requester.start ?? defaultRequester.start, - sendMessage: requester.sendMessage ?? defaultRequester.sendMessage, - halfClose: requester.halfClose ?? defaultRequester.halfClose, - cancel: requester.cancel ?? defaultRequester.cancel, - }; - } else { - this.requester = defaultRequester; - } - } - - cancelWithStatus(status: Status, details: string) { - this.requester.cancel(() => { - this.nextCall.cancelWithStatus(status, details); - }); - } - - getPeer() { - return this.nextCall.getPeer(); - } - start( - metadata: Metadata, - interceptingListener?: Partial - ): void { - const fullInterceptingListener: InterceptingListener = { - onReceiveMetadata: - interceptingListener?.onReceiveMetadata?.bind(interceptingListener) ?? - ((metadata) => {}), - onReceiveMessage: - interceptingListener?.onReceiveMessage?.bind(interceptingListener) ?? - ((message) => {}), - onReceiveStatus: - interceptingListener?.onReceiveStatus?.bind(interceptingListener) ?? - ((status) => {}), - }; - this.requester.start(metadata, fullInterceptingListener, (md, listener) => { - let finalInterceptingListener: InterceptingListener; - if (isInterceptingListener(listener)) { - finalInterceptingListener = listener; - } else { - const fullListener: FullListener = { - onReceiveMetadata: - listener.onReceiveMetadata ?? defaultListener.onReceiveMetadata, - onReceiveMessage: - listener.onReceiveMessage ?? defaultListener.onReceiveMessage, - onReceiveStatus: - listener.onReceiveStatus ?? defaultListener.onReceiveStatus, - }; - finalInterceptingListener = new InterceptingListenerImpl( - fullListener, - fullInterceptingListener - ); - } - this.nextCall.start(md, finalInterceptingListener); - }); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessageWithContext(context: MessageContext, message: any): void { - this.processingMessage = true; - this.requester.sendMessage(message, (finalMessage) => { - this.processingMessage = false; - this.nextCall.sendMessageWithContext(context, finalMessage); - if (this.pendingHalfClose) { - this.nextCall.halfClose(); - } - }); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessage(message: any): void { - this.sendMessageWithContext({}, message); - } - startRead(): void { - this.nextCall.startRead(); - } - halfClose(): void { - this.requester.halfClose(() => { - if (this.processingMessage) { - this.pendingHalfClose = true; - } else { - this.nextCall.halfClose(); - } - }); - } - setCredentials(credentials: CallCredentials): void { - this.nextCall.setCredentials(credentials); - } -} - -function getCall(channel: Channel, path: string, options: CallOptions): Call { - const deadline = options.deadline ?? Infinity; - const host = options.host; - const parent = options.parent ?? null; - const propagateFlags = options.propagate_flags; - const credentials = options.credentials; - const call = channel.createCall(path, deadline, host, parent, propagateFlags); - if (credentials) { - call.setCredentials(credentials); - } - return call; -} - -/** - * InterceptingCall implementation that directly owns the underlying Call - * object and handles serialization and deseraizliation. - */ -class BaseInterceptingCall implements InterceptingCallInterface { - constructor( - protected call: Call, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - protected methodDefinition: ClientMethodDefinition - ) {} - cancelWithStatus(status: Status, details: string): void { - this.call.cancelWithStatus(status, details); - } - getPeer(): string { - return this.call.getPeer(); - } - setCredentials(credentials: CallCredentials): void { - this.call.setCredentials(credentials); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessageWithContext(context: MessageContext, message: any): void { - let serialized: Buffer; - try { - serialized = this.methodDefinition.requestSerialize(message); - this.call.sendMessageWithContext(context, serialized); - } catch (e) { - this.call.cancelWithStatus(Status.INTERNAL, `Request message serialization failure: ${e.message}`); - } - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - sendMessage(message: any) { - this.sendMessageWithContext({}, message); - } - start( - metadata: Metadata, - interceptingListener?: Partial - ): void { - let readError: StatusObject | null = null; - this.call.start(metadata, { - onReceiveMetadata: (metadata) => { - interceptingListener?.onReceiveMetadata?.(metadata); - }, - onReceiveMessage: (message) => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let deserialized: any; - try { - deserialized = this.methodDefinition.responseDeserialize(message); - interceptingListener?.onReceiveMessage?.(deserialized); - } catch (e) { - readError = { - code: Status.INTERNAL, - details: `Response message parsing error: ${e.message}`, - metadata: new Metadata(), - }; - this.call.cancelWithStatus(readError.code, readError.details); - } - }, - onReceiveStatus: (status) => { - if (readError) { - interceptingListener?.onReceiveStatus?.(readError); - } else { - interceptingListener?.onReceiveStatus?.(status); - } - }, - }); - } - startRead() { - this.call.startRead(); - } - halfClose(): void { - this.call.halfClose(); - } -} - -/** - * BaseInterceptingCall with special-cased behavior for methods with unary - * responses. - */ -class BaseUnaryInterceptingCall extends BaseInterceptingCall - implements InterceptingCallInterface { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - constructor(call: Call, methodDefinition: ClientMethodDefinition) { - super(call, methodDefinition); - } - start(metadata: Metadata, listener?: Partial): void { - let receivedMessage = false; - const wrapperListener: InterceptingListener = { - onReceiveMetadata: - listener?.onReceiveMetadata?.bind(listener) ?? ((metadata) => {}), - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage: (message: any) => { - receivedMessage = true; - listener?.onReceiveMessage?.(message); - }, - onReceiveStatus: (status: StatusObject) => { - if (!receivedMessage) { - listener?.onReceiveMessage?.(null); - } - listener?.onReceiveStatus?.(status); - }, - }; - super.start(metadata, wrapperListener); - this.call.startRead(); - } -} - -/** - * BaseInterceptingCall with special-cased behavior for methods with streaming - * responses. - */ -class BaseStreamingInterceptingCall extends BaseInterceptingCall - implements InterceptingCallInterface {} - -function getBottomInterceptingCall( - channel: Channel, - options: InterceptorOptions, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - methodDefinition: ClientMethodDefinition -) { - const call = getCall(channel, methodDefinition.path, options); - if (methodDefinition.responseStream) { - return new BaseStreamingInterceptingCall(call, methodDefinition); - } else { - return new BaseUnaryInterceptingCall(call, methodDefinition); - } -} - -export interface NextCall { - (options: InterceptorOptions): InterceptingCallInterface; -} - -export interface Interceptor { - (options: InterceptorOptions, nextCall: NextCall): InterceptingCall; -} - -export interface InterceptorProvider { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (methodDefinition: ClientMethodDefinition): Interceptor; -} - -export interface InterceptorArguments { - clientInterceptors: Interceptor[]; - clientInterceptorProviders: InterceptorProvider[]; - callInterceptors: Interceptor[]; - callInterceptorProviders: InterceptorProvider[]; -} - -export function getInterceptingCall( - interceptorArgs: InterceptorArguments, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - methodDefinition: ClientMethodDefinition, - options: CallOptions, - channel: Channel -): InterceptingCallInterface { - if ( - interceptorArgs.clientInterceptors.length > 0 && - interceptorArgs.clientInterceptorProviders.length > 0 - ) { - throw new InterceptorConfigurationError( - 'Both interceptors and interceptor_providers were passed as options ' + - 'to the client constructor. Only one of these is allowed.' - ); - } - if ( - interceptorArgs.callInterceptors.length > 0 && - interceptorArgs.callInterceptorProviders.length > 0 - ) { - throw new InterceptorConfigurationError( - 'Both interceptors and interceptor_providers were passed as call ' + - 'options. Only one of these is allowed.' - ); - } - let interceptors: Interceptor[] = []; - // Interceptors passed to the call override interceptors passed to the client constructor - if ( - interceptorArgs.callInterceptors.length > 0 || - interceptorArgs.callInterceptorProviders.length > 0 - ) { - interceptors = ([] as Interceptor[]) - .concat( - interceptorArgs.callInterceptors, - interceptorArgs.callInterceptorProviders.map((provider) => - provider(methodDefinition) - ) - ) - .filter((interceptor) => interceptor); - // Filter out falsy values when providers return nothing - } else { - interceptors = ([] as Interceptor[]) - .concat( - interceptorArgs.clientInterceptors, - interceptorArgs.clientInterceptorProviders.map((provider) => - provider(methodDefinition) - ) - ) - .filter((interceptor) => interceptor); - // Filter out falsy values when providers return nothing - } - const interceptorOptions = Object.assign({}, options, { - method_definition: methodDefinition, - }); - /* For each interceptor in the list, the nextCall function passed to it is - * based on the next interceptor in the list, using a nextCall function - * constructed with the following interceptor in the list, and so on. The - * initialValue, which is effectively at the end of the list, is a nextCall - * function that invokes getBottomInterceptingCall, the result of which - * handles (de)serialization and also gets the underlying call from the - * channel. */ - const getCall: NextCall = interceptors.reduceRight( - (nextCall: NextCall, nextInterceptor: Interceptor) => { - return (currentOptions) => nextInterceptor(currentOptions, nextCall); - }, - (finalOptions: InterceptorOptions) => - getBottomInterceptingCall(channel, finalOptions, methodDefinition) - ); - return getCall(interceptorOptions); -} diff --git a/node_modules/@grpc/grpc-js/src/client.ts b/node_modules/@grpc/grpc-js/src/client.ts deleted file mode 100644 index 5f78ffe5..00000000 --- a/node_modules/@grpc/grpc-js/src/client.ts +++ /dev/null @@ -1,673 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - ClientDuplexStream, - ClientDuplexStreamImpl, - ClientReadableStream, - ClientReadableStreamImpl, - ClientUnaryCall, - ClientUnaryCallImpl, - ClientWritableStream, - ClientWritableStreamImpl, - ServiceError, - callErrorFromStatus, - SurfaceCall, -} from './call'; -import { CallCredentials } from './call-credentials'; -import { Deadline, StatusObject } from './call-stream'; -import { Channel, ConnectivityState, ChannelImplementation } from './channel'; -import { ChannelCredentials } from './channel-credentials'; -import { ChannelOptions } from './channel-options'; -import { Status } from './constants'; -import { Metadata } from './metadata'; -import { ClientMethodDefinition } from './make-client'; -import { - getInterceptingCall, - Interceptor, - InterceptorProvider, - InterceptorArguments, - InterceptingCallInterface, -} from './client-interceptors'; -import { - ServerUnaryCall, - ServerReadableStream, - ServerWritableStream, - ServerDuplexStream, -} from './server-call'; - -const CHANNEL_SYMBOL = Symbol(); -const INTERCEPTOR_SYMBOL = Symbol(); -const INTERCEPTOR_PROVIDER_SYMBOL = Symbol(); -const CALL_INVOCATION_TRANSFORMER_SYMBOL = Symbol(); - -export interface UnaryCallback { - (err: ServiceError | null, value?: ResponseType): void; -} - -/* eslint-disable @typescript-eslint/no-explicit-any */ -export interface CallOptions { - deadline?: Deadline; - host?: string; - parent?: - | ServerUnaryCall - | ServerReadableStream - | ServerWritableStream - | ServerDuplexStream; - propagate_flags?: number; - credentials?: CallCredentials; - interceptors?: Interceptor[]; - interceptor_providers?: InterceptorProvider[]; -} -/* eslint-enable @typescript-eslint/no-explicit-any */ - -export interface CallProperties { - argument?: RequestType; - metadata: Metadata; - call: SurfaceCall; - channel: Channel; - methodDefinition: ClientMethodDefinition; - callOptions: CallOptions; - callback?: UnaryCallback; -} - -export interface CallInvocationTransformer { - (callProperties: CallProperties): CallProperties; // eslint-disable-line @typescript-eslint/no-explicit-any -} - -export type ClientOptions = Partial & { - channelOverride?: Channel; - channelFactoryOverride?: ( - address: string, - credentials: ChannelCredentials, - options: ClientOptions - ) => Channel; - interceptors?: Interceptor[]; - interceptor_providers?: InterceptorProvider[]; - callInvocationTransformer?: CallInvocationTransformer; -}; - -/** - * A generic gRPC client. Primarily useful as a base class for all generated - * clients. - */ -export class Client { - private readonly [CHANNEL_SYMBOL]: Channel; - private readonly [INTERCEPTOR_SYMBOL]: Interceptor[]; - private readonly [INTERCEPTOR_PROVIDER_SYMBOL]: InterceptorProvider[]; - private readonly [CALL_INVOCATION_TRANSFORMER_SYMBOL]?: CallInvocationTransformer; - constructor( - address: string, - credentials: ChannelCredentials, - options: ClientOptions = {} - ) { - options = Object.assign({}, options); - this[INTERCEPTOR_SYMBOL] = options.interceptors ?? []; - delete options.interceptors; - this[INTERCEPTOR_PROVIDER_SYMBOL] = options.interceptor_providers ?? []; - delete options.interceptor_providers; - if ( - this[INTERCEPTOR_SYMBOL].length > 0 && - this[INTERCEPTOR_PROVIDER_SYMBOL].length > 0 - ) { - throw new Error( - 'Both interceptors and interceptor_providers were passed as options ' + - 'to the client constructor. Only one of these is allowed.' - ); - } - this[CALL_INVOCATION_TRANSFORMER_SYMBOL] = - options.callInvocationTransformer; - delete options.callInvocationTransformer; - if (options.channelOverride) { - this[CHANNEL_SYMBOL] = options.channelOverride; - } else if (options.channelFactoryOverride) { - const channelFactoryOverride = options.channelFactoryOverride; - delete options.channelFactoryOverride; - this[CHANNEL_SYMBOL] = channelFactoryOverride( - address, - credentials, - options - ); - } else { - this[CHANNEL_SYMBOL] = new ChannelImplementation( - address, - credentials, - options - ); - } - } - - close(): void { - this[CHANNEL_SYMBOL].close(); - } - - getChannel(): Channel { - return this[CHANNEL_SYMBOL]; - } - - waitForReady(deadline: Deadline, callback: (error?: Error) => void): void { - const checkState = (err?: Error) => { - if (err) { - callback(new Error('Failed to connect before the deadline')); - return; - } - let newState; - try { - newState = this[CHANNEL_SYMBOL].getConnectivityState(true); - } catch (e) { - callback(new Error('The channel has been closed')); - return; - } - if (newState === ConnectivityState.READY) { - callback(); - } else { - try { - this[CHANNEL_SYMBOL].watchConnectivityState( - newState, - deadline, - checkState - ); - } catch (e) { - callback(new Error('The channel has been closed')); - } - } - }; - setImmediate(checkState); - } - - private checkOptionalUnaryResponseArguments( - arg1: Metadata | CallOptions | UnaryCallback, - arg2?: CallOptions | UnaryCallback, - arg3?: UnaryCallback - ): { - metadata: Metadata; - options: CallOptions; - callback: UnaryCallback; - } { - if (arg1 instanceof Function) { - return { metadata: new Metadata(), options: {}, callback: arg1 }; - } else if (arg2 instanceof Function) { - if (arg1 instanceof Metadata) { - return { metadata: arg1, options: {}, callback: arg2 }; - } else { - return { metadata: new Metadata(), options: arg1, callback: arg2 }; - } - } else { - if ( - !( - arg1 instanceof Metadata && - arg2 instanceof Object && - arg3 instanceof Function - ) - ) { - throw new Error('Incorrect arguments passed'); - } - return { metadata: arg1, options: arg2, callback: arg3 }; - } - } - - makeUnaryRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - metadata: Metadata, - options: CallOptions, - callback: UnaryCallback - ): ClientUnaryCall; - makeUnaryRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - metadata: Metadata, - callback: UnaryCallback - ): ClientUnaryCall; - makeUnaryRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - options: CallOptions, - callback: UnaryCallback - ): ClientUnaryCall; - makeUnaryRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - callback: UnaryCallback - ): ClientUnaryCall; - makeUnaryRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - metadata: Metadata | CallOptions | UnaryCallback, - options?: CallOptions | UnaryCallback, - callback?: UnaryCallback - ): ClientUnaryCall { - const checkedArguments = this.checkOptionalUnaryResponseArguments< - ResponseType - >(metadata, options, callback); - const methodDefinition: ClientMethodDefinition< - RequestType, - ResponseType - > = { - path: method, - requestStream: false, - responseStream: false, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties: CallProperties = { - argument: argument, - metadata: checkedArguments.metadata, - call: new ClientUnaryCallImpl(), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - callback: checkedArguments.callback, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL]!( - callProperties - ) as CallProperties; - } - const emitter: ClientUnaryCall = callProperties.call; - const interceptorArgs: InterceptorArguments = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: callProperties.callOptions.interceptors ?? [], - callInterceptorProviders: - callProperties.callOptions.interceptor_providers ?? [], - }; - const call: InterceptingCallInterface = getInterceptingCall( - interceptorArgs, - callProperties.methodDefinition, - callProperties.callOptions, - callProperties.channel - ); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - emitter.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let responseMessage: ResponseType | null = null; - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata: (metadata) => { - emitter.emit('metadata', metadata); - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message: any) { - if (responseMessage !== null) { - call.cancelWithStatus(Status.INTERNAL, 'Too many responses received'); - } - responseMessage = message; - }, - onReceiveStatus(status: StatusObject) { - if (receivedStatus) { - return; - } - receivedStatus = true; - if (status.code === Status.OK) { - callProperties.callback!(null, responseMessage!); - } else { - callProperties.callback!(callErrorFromStatus(status)); - } - emitter.emit('status', status); - }, - }); - call.sendMessage(argument); - call.halfClose(); - return emitter; - } - - makeClientStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - metadata: Metadata, - options: CallOptions, - callback: UnaryCallback - ): ClientWritableStream; - makeClientStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - metadata: Metadata, - callback: UnaryCallback - ): ClientWritableStream; - makeClientStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - options: CallOptions, - callback: UnaryCallback - ): ClientWritableStream; - makeClientStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - callback: UnaryCallback - ): ClientWritableStream; - makeClientStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - metadata: Metadata | CallOptions | UnaryCallback, - options?: CallOptions | UnaryCallback, - callback?: UnaryCallback - ): ClientWritableStream { - const checkedArguments = this.checkOptionalUnaryResponseArguments< - ResponseType - >(metadata, options, callback); - const methodDefinition: ClientMethodDefinition< - RequestType, - ResponseType - > = { - path: method, - requestStream: true, - responseStream: false, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties: CallProperties = { - metadata: checkedArguments.metadata, - call: new ClientWritableStreamImpl(serialize), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - callback: checkedArguments.callback, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL]!( - callProperties - ) as CallProperties; - } - const emitter: ClientWritableStream = callProperties.call as ClientWritableStream< - RequestType - >; - const interceptorArgs: InterceptorArguments = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: callProperties.callOptions.interceptors ?? [], - callInterceptorProviders: - callProperties.callOptions.interceptor_providers ?? [], - }; - const call: InterceptingCallInterface = getInterceptingCall( - interceptorArgs, - callProperties.methodDefinition, - callProperties.callOptions, - callProperties.channel - ); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - emitter.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let responseMessage: ResponseType | null = null; - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata: (metadata) => { - emitter.emit('metadata', metadata); - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message: any) { - if (responseMessage !== null) { - call.cancelWithStatus(Status.INTERNAL, 'Too many responses received'); - } - responseMessage = message; - }, - onReceiveStatus(status: StatusObject) { - if (receivedStatus) { - return; - } - receivedStatus = true; - if (status.code === Status.OK) { - callProperties.callback!(null, responseMessage!); - } else { - callProperties.callback!(callErrorFromStatus(status)); - } - emitter.emit('status', status); - }, - }); - return emitter; - } - - private checkMetadataAndOptions( - arg1?: Metadata | CallOptions, - arg2?: CallOptions - ): { metadata: Metadata; options: CallOptions } { - let metadata: Metadata; - let options: CallOptions; - if (arg1 instanceof Metadata) { - metadata = arg1; - if (arg2) { - options = arg2; - } else { - options = {}; - } - } else { - if (arg1) { - options = arg1; - } else { - options = {}; - } - metadata = new Metadata(); - } - return { metadata, options }; - } - - makeServerStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - metadata: Metadata, - options?: CallOptions - ): ClientReadableStream; - makeServerStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - options?: CallOptions - ): ClientReadableStream; - makeServerStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - argument: RequestType, - metadata?: Metadata | CallOptions, - options?: CallOptions - ): ClientReadableStream { - const checkedArguments = this.checkMetadataAndOptions(metadata, options); - const methodDefinition: ClientMethodDefinition< - RequestType, - ResponseType - > = { - path: method, - requestStream: false, - responseStream: true, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties: CallProperties = { - argument: argument, - metadata: checkedArguments.metadata, - call: new ClientReadableStreamImpl(deserialize), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL]!( - callProperties - ) as CallProperties; - } - const stream: ClientReadableStream = callProperties.call as ClientReadableStream< - ResponseType - >; - const interceptorArgs: InterceptorArguments = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: callProperties.callOptions.interceptors ?? [], - callInterceptorProviders: - callProperties.callOptions.interceptor_providers ?? [], - }; - const call: InterceptingCallInterface = getInterceptingCall( - interceptorArgs, - callProperties.methodDefinition, - callProperties.callOptions, - callProperties.channel - ); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - stream.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata(metadata: Metadata) { - stream.emit('metadata', metadata); - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - onReceiveMessage(message: any) { - stream.push(message); - }, - onReceiveStatus(status: StatusObject) { - if (receivedStatus) { - return; - } - receivedStatus = true; - stream.push(null); - if (status.code !== Status.OK) { - stream.emit('error', callErrorFromStatus(status)); - } - stream.emit('status', status); - }, - }); - call.sendMessage(argument); - call.halfClose(); - return stream; - } - - makeBidiStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - metadata: Metadata, - options?: CallOptions - ): ClientDuplexStream; - makeBidiStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - options?: CallOptions - ): ClientDuplexStream; - makeBidiStreamRequest( - method: string, - serialize: (value: RequestType) => Buffer, - deserialize: (value: Buffer) => ResponseType, - metadata?: Metadata | CallOptions, - options?: CallOptions - ): ClientDuplexStream { - const checkedArguments = this.checkMetadataAndOptions(metadata, options); - const methodDefinition: ClientMethodDefinition< - RequestType, - ResponseType - > = { - path: method, - requestStream: true, - responseStream: true, - requestSerialize: serialize, - responseDeserialize: deserialize, - }; - let callProperties: CallProperties = { - metadata: checkedArguments.metadata, - call: new ClientDuplexStreamImpl( - serialize, - deserialize - ), - channel: this[CHANNEL_SYMBOL], - methodDefinition: methodDefinition, - callOptions: checkedArguments.options, - }; - if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { - callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL]!( - callProperties - ) as CallProperties; - } - const stream: ClientDuplexStream< - RequestType, - ResponseType - > = callProperties.call as ClientDuplexStream; - const interceptorArgs: InterceptorArguments = { - clientInterceptors: this[INTERCEPTOR_SYMBOL], - clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], - callInterceptors: callProperties.callOptions.interceptors ?? [], - callInterceptorProviders: - callProperties.callOptions.interceptor_providers ?? [], - }; - const call: InterceptingCallInterface = getInterceptingCall( - interceptorArgs, - callProperties.methodDefinition, - callProperties.callOptions, - callProperties.channel - ); - /* This needs to happen before the emitter is used. Unfortunately we can't - * enforce this with the type system. We need to construct this emitter - * before calling the CallInvocationTransformer, and we need to create the - * call after that. */ - stream.call = call; - if (callProperties.callOptions.credentials) { - call.setCredentials(callProperties.callOptions.credentials); - } - let receivedStatus = false; - call.start(callProperties.metadata, { - onReceiveMetadata(metadata: Metadata) { - stream.emit('metadata', metadata); - }, - onReceiveMessage(message: Buffer) { - stream.push(message) - }, - onReceiveStatus(status: StatusObject) { - if (receivedStatus) { - return; - } - receivedStatus = true; - stream.push(null); - if (status.code !== Status.OK) { - stream.emit('error', callErrorFromStatus(status)); - } - stream.emit('status', status); - }, - }); - return stream; - } -} diff --git a/node_modules/@grpc/grpc-js/src/compression-filter.ts b/node_modules/@grpc/grpc-js/src/compression-filter.ts deleted file mode 100644 index 6f40ee4b..00000000 --- a/node_modules/@grpc/grpc-js/src/compression-filter.ts +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import * as zlib from 'zlib'; - -import { Call, WriteFlags, WriteObject } from './call-stream'; -import { Channel } from './channel'; -import { BaseFilter, Filter, FilterFactory } from './filter'; -import { Metadata, MetadataValue } from './metadata'; - -abstract class CompressionHandler { - protected abstract compressMessage(message: Buffer): Promise; - protected abstract decompressMessage(data: Buffer): Promise; - /** - * @param message Raw uncompressed message bytes - * @param compress Indicates whether the message should be compressed - * @return Framed message, compressed if applicable - */ - async writeMessage(message: Buffer, compress: boolean): Promise { - let messageBuffer = message; - if (compress) { - messageBuffer = await this.compressMessage(messageBuffer); - } - const output = Buffer.allocUnsafe(messageBuffer.length + 5); - output.writeUInt8(compress ? 1 : 0, 0); - output.writeUInt32BE(messageBuffer.length, 1); - messageBuffer.copy(output, 5); - return output; - } - /** - * @param data Framed message, possibly compressed - * @return Uncompressed message - */ - async readMessage(data: Buffer): Promise { - const compressed = data.readUInt8(0) === 1; - let messageBuffer = data.slice(5); - if (compressed) { - messageBuffer = await this.decompressMessage(messageBuffer); - } - return messageBuffer; - } -} - -class IdentityHandler extends CompressionHandler { - async compressMessage(message: Buffer) { - return message; - } - - async writeMessage(message: Buffer, compress: boolean): Promise { - const output = Buffer.allocUnsafe(message.length + 5); - /* With "identity" compression, messages should always be marked as - * uncompressed */ - output.writeUInt8(0, 0); - output.writeUInt32BE(message.length, 1); - message.copy(output, 5); - return output; - } - - decompressMessage(message: Buffer): Promise { - return Promise.reject( - new Error( - 'Received compressed message but "grpc-encoding" header was identity' - ) - ); - } -} - -class DeflateHandler extends CompressionHandler { - compressMessage(message: Buffer) { - return new Promise((resolve, reject) => { - zlib.deflate(message, (err, output) => { - if (err) { - reject(err); - } else { - resolve(output); - } - }); - }); - } - - decompressMessage(message: Buffer) { - return new Promise((resolve, reject) => { - zlib.inflate(message, (err, output) => { - if (err) { - reject(err); - } else { - resolve(output); - } - }); - }); - } -} - -class GzipHandler extends CompressionHandler { - compressMessage(message: Buffer) { - return new Promise((resolve, reject) => { - zlib.gzip(message, (err, output) => { - if (err) { - reject(err); - } else { - resolve(output); - } - }); - }); - } - - decompressMessage(message: Buffer) { - return new Promise((resolve, reject) => { - zlib.unzip(message, (err, output) => { - if (err) { - reject(err); - } else { - resolve(output); - } - }); - }); - } -} - -class UnknownHandler extends CompressionHandler { - constructor(private readonly compressionName: string) { - super(); - } - compressMessage(message: Buffer): Promise { - return Promise.reject( - new Error( - `Received message compressed with unsupported compression method ${this.compressionName}` - ) - ); - } - - decompressMessage(message: Buffer): Promise { - // This should be unreachable - return Promise.reject( - new Error(`Compression method not supported: ${this.compressionName}`) - ); - } -} - -function getCompressionHandler(compressionName: string): CompressionHandler { - switch (compressionName) { - case 'identity': - return new IdentityHandler(); - case 'deflate': - return new DeflateHandler(); - case 'gzip': - return new GzipHandler(); - default: - return new UnknownHandler(compressionName); - } -} - -export class CompressionFilter extends BaseFilter implements Filter { - private sendCompression: CompressionHandler = new IdentityHandler(); - private receiveCompression: CompressionHandler = new IdentityHandler(); - async sendMetadata(metadata: Promise): Promise { - const headers: Metadata = await metadata; - headers.set('grpc-accept-encoding', 'identity,deflate,gzip'); - headers.set('accept-encoding', 'identity,gzip'); - return headers; - } - - receiveMetadata(metadata: Metadata): Metadata { - const receiveEncoding: MetadataValue[] = metadata.get('grpc-encoding'); - if (receiveEncoding.length > 0) { - const encoding: MetadataValue = receiveEncoding[0]; - if (typeof encoding === 'string') { - this.receiveCompression = getCompressionHandler(encoding); - } - } - metadata.remove('grpc-encoding'); - metadata.remove('grpc-accept-encoding'); - return metadata; - } - - async sendMessage(message: Promise): Promise { - /* This filter is special. The input message is the bare message bytes, - * and the output is a framed and possibly compressed message. For this - * reason, this filter should be at the bottom of the filter stack */ - const resolvedMessage: WriteObject = await message; - const compress = - resolvedMessage.flags === undefined - ? false - : (resolvedMessage.flags & WriteFlags.NoCompress) === 0; - return { - message: await this.sendCompression.writeMessage( - resolvedMessage.message, - compress - ), - flags: resolvedMessage.flags, - }; - } - - async receiveMessage(message: Promise) { - /* This filter is also special. The input message is framed and possibly - * compressed, and the output message is deframed and uncompressed. So - * this is another reason that this filter should be at the bottom of the - * filter stack. */ - return this.receiveCompression.readMessage(await message); - } -} - -export class CompressionFilterFactory - implements FilterFactory { - constructor(private readonly channel: Channel) {} - createFilter(callStream: Call): CompressionFilter { - return new CompressionFilter(); - } -} diff --git a/node_modules/@grpc/grpc-js/src/constants.ts b/node_modules/@grpc/grpc-js/src/constants.ts deleted file mode 100644 index d30b78f0..00000000 --- a/node_modules/@grpc/grpc-js/src/constants.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -export enum Status { - OK = 0, - CANCELLED, - UNKNOWN, - INVALID_ARGUMENT, - DEADLINE_EXCEEDED, - NOT_FOUND, - ALREADY_EXISTS, - PERMISSION_DENIED, - RESOURCE_EXHAUSTED, - FAILED_PRECONDITION, - ABORTED, - OUT_OF_RANGE, - UNIMPLEMENTED, - INTERNAL, - UNAVAILABLE, - DATA_LOSS, - UNAUTHENTICATED, -} - -export enum LogVerbosity { - DEBUG = 0, - INFO, - ERROR, -} - -/** - * NOTE: This enum is not currently used in any implemented API in this - * library. It is included only for type parity with the other implementation. - */ -export enum Propagate { - DEADLINE = 1, - CENSUS_STATS_CONTEXT = 2, - CENSUS_TRACING_CONTEXT = 4, - CANCELLATION = 8, - // https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/propagation_bits.h#L43 - DEFAULTS = 0xffff | Propagate.DEADLINE | Propagate.CENSUS_STATS_CONTEXT | Propagate.CENSUS_TRACING_CONTEXT | Propagate.CANCELLATION, -} - -// -1 means unlimited -export const DEFAULT_MAX_SEND_MESSAGE_LENGTH = -1; - -// 4 MB default -export const DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH = 4 * 1024 * 1024; diff --git a/node_modules/@grpc/grpc-js/src/deadline-filter.ts b/node_modules/@grpc/grpc-js/src/deadline-filter.ts deleted file mode 100644 index 2306bb8f..00000000 --- a/node_modules/@grpc/grpc-js/src/deadline-filter.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Call, StatusObject } from './call-stream'; -import { Channel } from './channel'; -import { Status } from './constants'; -import { BaseFilter, Filter, FilterFactory } from './filter'; -import { Metadata } from './metadata'; - -const units: Array<[string, number]> = [ - ['m', 1], - ['S', 1000], - ['M', 60 * 1000], - ['H', 60 * 60 * 1000], -]; - -function getDeadline(deadline: number) { - const now = new Date().getTime(); - const timeoutMs = Math.max(deadline - now, 0); - for (const [unit, factor] of units) { - const amount = timeoutMs / factor; - if (amount < 1e8) { - return String(Math.ceil(amount)) + unit; - } - } - throw new Error('Deadline is too far in the future'); -} - -export class DeadlineFilter extends BaseFilter implements Filter { - private timer: NodeJS.Timer | null = null; - private deadline: number; - constructor( - private readonly channel: Channel, - private readonly callStream: Call - ) { - super(); - const callDeadline = callStream.getDeadline(); - if (callDeadline instanceof Date) { - this.deadline = callDeadline.getTime(); - } else { - this.deadline = callDeadline; - } - const now: number = new Date().getTime(); - let timeout = this.deadline - now; - if (timeout < 0) { - timeout = 0; - } - if (this.deadline !== Infinity) { - this.timer = setTimeout(() => { - callStream.cancelWithStatus( - Status.DEADLINE_EXCEEDED, - 'Deadline exceeded' - ); - }, timeout); - this.timer.unref?.(); - } - } - - async sendMetadata(metadata: Promise) { - if (this.deadline === Infinity) { - return metadata; - } - /* The input metadata promise depends on the original channel.connect() - * promise, so when it is complete that implies that the channel is - * connected */ - const finalMetadata = await metadata; - const timeoutString = getDeadline(this.deadline); - finalMetadata.set('grpc-timeout', timeoutString); - return finalMetadata; - } - - receiveTrailers(status: StatusObject) { - if (this.timer) { - clearTimeout(this.timer); - } - return status; - } -} - -export class DeadlineFilterFactory implements FilterFactory { - constructor(private readonly channel: Channel) {} - - createFilter(callStream: Call): DeadlineFilter { - return new DeadlineFilter(this.channel, callStream); - } -} diff --git a/node_modules/@grpc/grpc-js/src/events.ts b/node_modules/@grpc/grpc-js/src/events.ts deleted file mode 100644 index 7718746d..00000000 --- a/node_modules/@grpc/grpc-js/src/events.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -export interface EmitterAugmentation1 { - addListener(event: Name, listener: (arg1: Arg) => void): this; - emit(event: Name, arg1: Arg): boolean; - on(event: Name, listener: (arg1: Arg) => void): this; - once(event: Name, listener: (arg1: Arg) => void): this; - prependListener(event: Name, listener: (arg1: Arg) => void): this; - prependOnceListener(event: Name, listener: (arg1: Arg) => void): this; - removeListener(event: Name, listener: (arg1: Arg) => void): this; -} diff --git a/node_modules/@grpc/grpc-js/src/experimental.ts b/node_modules/@grpc/grpc-js/src/experimental.ts deleted file mode 100644 index 1c9658d0..00000000 --- a/node_modules/@grpc/grpc-js/src/experimental.ts +++ /dev/null @@ -1,13 +0,0 @@ -export { trace } from './logging'; -export { Resolver, ResolverListener, registerResolver } from './resolver'; -export { GrpcUri, uriToString } from './uri-parser'; -export { ServiceConfig } from './service-config'; -export { createGoogleDefaultCredentials } from './channel-credentials'; -export { BackoffTimeout } from './backoff-timeout'; -export { LoadBalancer, LoadBalancingConfig, ChannelControlHelper, registerLoadBalancerType, getFirstUsableConfig, validateLoadBalancingConfig } from './load-balancer'; -export { SubchannelAddress, subchannelAddressToString } from './subchannel'; -export { ChildLoadBalancerHandler } from './load-balancer-child-handler'; -export { Picker, UnavailablePicker, QueuePicker, PickResult, PickArgs, PickResultType } from './picker'; -export { Call as CallStream } from './call-stream'; -export { Filter, BaseFilter, FilterFactory } from './filter'; -export { FilterStackFactory } from './filter-stack'; \ No newline at end of file diff --git a/node_modules/@grpc/grpc-js/src/filter-stack.ts b/node_modules/@grpc/grpc-js/src/filter-stack.ts deleted file mode 100644 index a656a409..00000000 --- a/node_modules/@grpc/grpc-js/src/filter-stack.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Call, StatusObject, WriteObject } from './call-stream'; -import { Filter, FilterFactory } from './filter'; -import { Metadata } from './metadata'; - -export class FilterStack implements Filter { - constructor(private readonly filters: Filter[]) {} - - sendMetadata(metadata: Promise) { - let result: Promise = metadata; - - for (let i = 0; i < this.filters.length; i++) { - result = this.filters[i].sendMetadata(result); - } - - return result; - } - - receiveMetadata(metadata: Metadata) { - let result: Metadata = metadata; - - for (let i = this.filters.length - 1; i >= 0; i--) { - result = this.filters[i].receiveMetadata(result); - } - - return result; - } - - sendMessage(message: Promise): Promise { - let result: Promise = message; - - for (let i = 0; i < this.filters.length; i++) { - result = this.filters[i].sendMessage(result); - } - - return result; - } - - receiveMessage(message: Promise): Promise { - let result: Promise = message; - - for (let i = this.filters.length - 1; i >= 0; i--) { - result = this.filters[i].receiveMessage(result); - } - - return result; - } - - receiveTrailers(status: StatusObject): StatusObject { - let result: StatusObject = status; - - for (let i = this.filters.length - 1; i >= 0; i--) { - result = this.filters[i].receiveTrailers(result); - } - - return result; - } -} - -export class FilterStackFactory implements FilterFactory { - constructor(private readonly factories: Array>) {} - - createFilter(callStream: Call): FilterStack { - return new FilterStack( - this.factories.map((factory) => factory.createFilter(callStream)) - ); - } -} diff --git a/node_modules/@grpc/grpc-js/src/filter.ts b/node_modules/@grpc/grpc-js/src/filter.ts deleted file mode 100644 index c1e412ae..00000000 --- a/node_modules/@grpc/grpc-js/src/filter.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Call, StatusObject, WriteObject } from './call-stream'; -import { Metadata } from './metadata'; - -/** - * Filter classes represent related per-call logic and state that is primarily - * used to modify incoming and outgoing data - */ -export interface Filter { - sendMetadata(metadata: Promise): Promise; - - receiveMetadata(metadata: Metadata): Metadata; - - sendMessage(message: Promise): Promise; - - receiveMessage(message: Promise): Promise; - - receiveTrailers(status: StatusObject): StatusObject; -} - -export abstract class BaseFilter implements Filter { - async sendMetadata(metadata: Promise): Promise { - return metadata; - } - - receiveMetadata(metadata: Metadata): Metadata { - return metadata; - } - - async sendMessage(message: Promise): Promise { - return message; - } - - async receiveMessage(message: Promise): Promise { - return message; - } - - receiveTrailers(status: StatusObject): StatusObject { - return status; - } -} - -export interface FilterFactory { - createFilter(callStream: Call): T; -} diff --git a/node_modules/@grpc/grpc-js/src/http_proxy.ts b/node_modules/@grpc/grpc-js/src/http_proxy.ts deleted file mode 100644 index f6921378..00000000 --- a/node_modules/@grpc/grpc-js/src/http_proxy.ts +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { log } from './logging'; -import { LogVerbosity } from './constants'; -import { getDefaultAuthority } from './resolver'; -import { Socket } from 'net'; -import * as http from 'http'; -import * as tls from 'tls'; -import * as logging from './logging'; -import { - SubchannelAddress, - isTcpSubchannelAddress, - subchannelAddressToString, -} from './subchannel'; -import { ChannelOptions } from './channel-options'; -import { GrpcUri, parseUri, splitHostPort, uriToString } from './uri-parser'; -import { URL } from 'url'; - -const TRACER_NAME = 'proxy'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -interface ProxyInfo { - address?: string; - creds?: string; -} - -function getProxyInfo(): ProxyInfo { - let proxyEnv = ''; - let envVar = ''; - /* Prefer using 'grpc_proxy'. Fallback on 'http_proxy' if it is not set. - * Also prefer using 'https_proxy' with fallback on 'http_proxy'. The - * fallback behavior can be removed if there's a demand for it. - */ - if (process.env.grpc_proxy) { - envVar = 'grpc_proxy'; - proxyEnv = process.env.grpc_proxy; - } else if (process.env.https_proxy) { - envVar = 'https_proxy'; - proxyEnv = process.env.https_proxy; - } else if (process.env.http_proxy) { - envVar = 'http_proxy'; - proxyEnv = process.env.http_proxy; - } else { - return {}; - } - let proxyUrl: URL; - try { - proxyUrl = new URL(proxyEnv); - } catch (e) { - log(LogVerbosity.ERROR, `cannot parse value of "${envVar}" env var`); - return {}; - } - if (proxyUrl.protocol !== 'http:') { - log( - LogVerbosity.ERROR, - `"${proxyUrl.protocol}" scheme not supported in proxy URI` - ); - return {}; - } - let userCred: string | null = null; - if (proxyUrl.username) { - if (proxyUrl.password) { - log(LogVerbosity.INFO, 'userinfo found in proxy URI'); - userCred = `${proxyUrl.username}:${proxyUrl.password}`; - } else { - userCred = proxyUrl.username; - } - } - const hostname = proxyUrl.hostname; - let port = proxyUrl.port; - /* The proxy URL uses the scheme "http:", which has a default port number of - * 80. We need to set that explicitly here if it is omitted because otherwise - * it will use gRPC's default port 443. */ - if (port === '') { - port = '80'; - } - const result: ProxyInfo = { - address: `${hostname}:${port}` - }; - if (userCred) { - result.creds = userCred; - } - trace( - 'Proxy server ' + result.address + ' set by environment variable ' + envVar - ); - return result; -} - -function getNoProxyHostList(): string[] { - /* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */ - let noProxyStr: string | undefined = process.env.no_grpc_proxy; - let envVar = 'no_grpc_proxy'; - if (!noProxyStr) { - noProxyStr = process.env.no_proxy; - envVar = 'no_proxy'; - } - if (noProxyStr) { - trace('No proxy server list set by environment variable ' + envVar); - return noProxyStr.split(','); - } else { - return []; - } -} - -export interface ProxyMapResult { - target: GrpcUri; - extraOptions: ChannelOptions; -} - -export function mapProxyName( - target: GrpcUri, - options: ChannelOptions -): ProxyMapResult { - const noProxyResult: ProxyMapResult = { - target: target, - extraOptions: {}, - }; - if ((options['grpc.enable_http_proxy'] ?? 1) === 0) { - return noProxyResult; - } - const proxyInfo = getProxyInfo(); - if (!proxyInfo.address) { - return noProxyResult; - } - const hostPort = splitHostPort(target.path); - if (!hostPort) { - return noProxyResult; - } - const serverHost = hostPort.host; - for (const host of getNoProxyHostList()) { - if (host === serverHost) { - trace('Not using proxy for target in no_proxy list: ' + uriToString(target)); - return noProxyResult; - } - } - const extraOptions: ChannelOptions = { - 'grpc.http_connect_target': uriToString(target), - }; - if (proxyInfo.creds) { - extraOptions['grpc.http_connect_creds'] = proxyInfo.creds; - } - return { - target: { - scheme: 'dns', - path: proxyInfo.address, - }, - extraOptions: extraOptions, - }; -} - -export interface ProxyConnectionResult { - socket?: Socket; - realTarget?: GrpcUri; -} - -export function getProxiedConnection( - address: SubchannelAddress, - channelOptions: ChannelOptions, - connectionOptions: tls.ConnectionOptions -): Promise { - if (!('grpc.http_connect_target' in channelOptions)) { - return Promise.resolve({}); - } - const realTarget = channelOptions['grpc.http_connect_target'] as string; - const parsedTarget = parseUri(realTarget); - if (parsedTarget === null) { - return Promise.resolve({}); - } - const options: http.RequestOptions = { - method: 'CONNECT', - path: parsedTarget.path, - }; - // Connect to the subchannel address as a proxy - if (isTcpSubchannelAddress(address)) { - options.host = address.host; - options.port = address.port; - } else { - options.socketPath = address.path; - } - if ('grpc.http_connect_creds' in channelOptions) { - options.headers = { - 'Proxy-Authorization': - 'Basic ' + - Buffer.from( - channelOptions['grpc.http_connect_creds'] as string - ).toString('base64'), - }; - } - const proxyAddressString = subchannelAddressToString(address); - trace('Using proxy ' + proxyAddressString + ' to connect to ' + options.path); - return new Promise((resolve, reject) => { - const request = http.request(options); - request.once('connect', (res, socket, head) => { - request.removeAllListeners(); - socket.removeAllListeners(); - if (res.statusCode === 200) { - trace( - 'Successfully connected to ' + - options.path + - ' through proxy ' + - proxyAddressString - ); - if ('secureContext' in connectionOptions) { - /* The proxy is connecting to a TLS server, so upgrade this socket - * connection to a TLS connection. - * This is a workaround for https://github.com/nodejs/node/issues/32922 - * See https://github.com/grpc/grpc-node/pull/1369 for more info. */ - const targetPath = getDefaultAuthority(parsedTarget); - const hostPort = splitHostPort(targetPath); - const remoteHost = hostPort?.host ?? targetPath; - - const cts = tls.connect( - { - host: remoteHost, - servername: remoteHost, - socket: socket, - ...connectionOptions, - }, - () => { - trace( - 'Successfully established a TLS connection to ' + - options.path + - ' through proxy ' + - proxyAddressString - ); - resolve({ socket: cts, realTarget: parsedTarget }); - } - ); - cts.on('error', () => { - reject(); - }); - } else { - resolve({ - socket, - realTarget: parsedTarget, - }); - } - } else { - log( - LogVerbosity.ERROR, - 'Failed to connect to ' + - options.path + - ' through proxy ' + - proxyAddressString + - ' with status ' + - res.statusCode - ); - reject(); - } - }); - request.once('error', (err) => { - request.removeAllListeners(); - log( - LogVerbosity.ERROR, - 'Failed to connect to proxy ' + - proxyAddressString + - ' with error ' + - err.message - ); - reject(); - }); - request.end(); - }); -} diff --git a/node_modules/@grpc/grpc-js/src/index.ts b/node_modules/@grpc/grpc-js/src/index.ts deleted file mode 100644 index e90ac4be..00000000 --- a/node_modules/@grpc/grpc-js/src/index.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import * as semver from 'semver'; - -import { - ClientDuplexStream, - ClientReadableStream, - ClientUnaryCall, - ClientWritableStream, - ServiceError, -} from './call'; -import { CallCredentials, OAuth2Client } from './call-credentials'; -import { Deadline, StatusObject } from './call-stream'; -import { Channel, ConnectivityState, ChannelImplementation } from './channel'; -import { ChannelCredentials } from './channel-credentials'; -import { - CallOptions, - Client, - ClientOptions, - CallInvocationTransformer, - CallProperties, - UnaryCallback, -} from './client'; -import { LogVerbosity, Status, Propagate } from './constants'; -import * as logging from './logging'; -import { - Deserialize, - loadPackageDefinition, - makeClientConstructor, - MethodDefinition, - Serialize, - ServiceDefinition, -} from './make-client'; -import { Metadata, MetadataValue } from './metadata'; -import { - Server, - UntypedHandleCall, - UntypedServiceImplementation, -} from './server'; -import { KeyCertPair, ServerCredentials } from './server-credentials'; -import { StatusBuilder } from './status-builder'; -import { - handleBidiStreamingCall, - handleServerStreamingCall, - handleClientStreamingCall, - handleUnaryCall, - sendUnaryData, - ServerUnaryCall, - ServerReadableStream, - ServerWritableStream, - ServerDuplexStream, -} from './server-call'; - -const supportedNodeVersions = require('../../package.json').engines.node; -if (!semver.satisfies(process.version, supportedNodeVersions)) { - throw new Error(`@grpc/grpc-js only works on Node ${supportedNodeVersions}`); -} - -export { OAuth2Client }; - -/**** Client Credentials ****/ - -// Using assign only copies enumerable properties, which is what we want -export const credentials = { - /** - * Combine a ChannelCredentials with any number of CallCredentials into a - * single ChannelCredentials object. - * @param channelCredentials The ChannelCredentials object. - * @param callCredentials Any number of CallCredentials objects. - * @return The resulting ChannelCredentials object. - */ - combineChannelCredentials: ( - channelCredentials: ChannelCredentials, - ...callCredentials: CallCredentials[] - ): ChannelCredentials => { - return callCredentials.reduce( - (acc, other) => acc.compose(other), - channelCredentials - ); - }, - - /** - * Combine any number of CallCredentials into a single CallCredentials - * object. - * @param first The first CallCredentials object. - * @param additional Any number of additional CallCredentials objects. - * @return The resulting CallCredentials object. - */ - combineCallCredentials: ( - first: CallCredentials, - ...additional: CallCredentials[] - ): CallCredentials => { - return additional.reduce((acc, other) => acc.compose(other), first); - }, - - // from channel-credentials.ts - createInsecure: ChannelCredentials.createInsecure, - createSsl: ChannelCredentials.createSsl, - - // from call-credentials.ts - createFromMetadataGenerator: CallCredentials.createFromMetadataGenerator, - createFromGoogleCredential: CallCredentials.createFromGoogleCredential, - createEmpty: CallCredentials.createEmpty, -}; - -/**** Metadata ****/ - -export { Metadata, MetadataValue }; - -/**** Constants ****/ - -export { - LogVerbosity as logVerbosity, - Status as status, - ConnectivityState as connectivityState, - Propagate as propagate, - // TODO: Other constants as well -}; - -/**** Client ****/ - -export { - Client, - ClientOptions, - loadPackageDefinition, - makeClientConstructor, - makeClientConstructor as makeGenericClientConstructor, - CallProperties, - CallInvocationTransformer, - ChannelImplementation as Channel, - Channel as ChannelInterface, - UnaryCallback as requestCallback, -}; - -/** - * Close a Client object. - * @param client The client to close. - */ -export const closeClient = (client: Client) => client.close(); - -export const waitForClientReady = ( - client: Client, - deadline: Date | number, - callback: (error?: Error) => void -) => client.waitForReady(deadline, callback); - -/* Interfaces */ - -export { - sendUnaryData, - ChannelCredentials, - CallCredentials, - Deadline, - Serialize as serialize, - Deserialize as deserialize, - ClientUnaryCall, - ClientReadableStream, - ClientWritableStream, - ClientDuplexStream, - CallOptions, - MethodDefinition, - StatusObject, - ServiceError, - ServerUnaryCall, - ServerReadableStream, - ServerWritableStream, - ServerDuplexStream, - ServiceDefinition, - UntypedHandleCall, - UntypedServiceImplementation, -}; - -/**** Server ****/ - -export { handleBidiStreamingCall, handleServerStreamingCall, handleUnaryCall, handleClientStreamingCall }; - -/* eslint-disable @typescript-eslint/no-explicit-any */ -export type Call = - | ClientUnaryCall - | ClientReadableStream - | ClientWritableStream - | ClientDuplexStream; -/* eslint-enable @typescript-eslint/no-explicit-any */ - -/**** Unimplemented function stubs ****/ - -/* eslint-disable @typescript-eslint/no-explicit-any */ - -export const loadObject = (value: any, options: any) => { - throw new Error( - 'Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead' - ); -}; - -export const load = (filename: any, format: any, options: any) => { - throw new Error( - 'Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead' - ); -}; - -export const setLogger = (logger: Partial): void => { - logging.setLogger(logger); -}; - -export const setLogVerbosity = (verbosity: LogVerbosity): void => { - logging.setLoggerVerbosity(verbosity); -}; - -export { Server }; -export { ServerCredentials }; -export { KeyCertPair }; - -export const getClientChannel = (client: Client) => { - return Client.prototype.getChannel.call(client); -}; - -export { StatusBuilder }; - -export { Listener } from './call-stream'; - -export { - Requester, - ListenerBuilder, - RequesterBuilder, - Interceptor, - InterceptorOptions, - InterceptorProvider, - InterceptingCall, - InterceptorConfigurationError, -} from './client-interceptors'; - -export { GrpcObject } from './make-client'; - -export { ChannelOptions } from './channel-options'; - -import * as experimental from './experimental'; -export { experimental }; - -import * as resolver from './resolver'; -import * as load_balancer from './load-balancer'; - -(() => { - resolver.registerAll(); - load_balancer.registerAll(); -})(); diff --git a/node_modules/@grpc/grpc-js/src/load-balancer-child-handler.ts b/node_modules/@grpc/grpc-js/src/load-balancer-child-handler.ts deleted file mode 100644 index 337174c0..00000000 --- a/node_modules/@grpc/grpc-js/src/load-balancer-child-handler.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2020 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - LoadBalancer, - ChannelControlHelper, - createLoadBalancer, - LoadBalancingConfig -} from './load-balancer'; -import { SubchannelAddress, Subchannel } from './subchannel'; -import { ChannelOptions } from './channel-options'; -import { ConnectivityState } from './channel'; -import { Picker } from './picker'; - -const TYPE_NAME = 'child_load_balancer_helper'; - -export class ChildLoadBalancerHandler implements LoadBalancer { - private currentChild: LoadBalancer | null = null; - private pendingChild: LoadBalancer | null = null; - - private ChildPolicyHelper = class { - private child: LoadBalancer | null = null; - constructor(private parent: ChildLoadBalancerHandler) {} - createSubchannel( - subchannelAddress: SubchannelAddress, - subchannelArgs: ChannelOptions - ): Subchannel { - return this.parent.channelControlHelper.createSubchannel( - subchannelAddress, - subchannelArgs - ); - } - updateState(connectivityState: ConnectivityState, picker: Picker): void { - if (this.calledByPendingChild()) { - if (connectivityState !== ConnectivityState.READY) { - return; - } - this.parent.currentChild?.destroy(); - this.parent.currentChild = this.parent.pendingChild; - this.parent.pendingChild = null; - } else if (!this.calledByCurrentChild()) { - return; - } - this.parent.channelControlHelper.updateState(connectivityState, picker); - } - requestReresolution(): void { - const latestChild = this.parent.pendingChild ?? this.parent.currentChild; - if (this.child === latestChild) { - this.parent.channelControlHelper.requestReresolution(); - } - } - setChild(newChild: LoadBalancer) { - this.child = newChild; - } - private calledByPendingChild(): boolean { - return this.child === this.parent.pendingChild; - } - private calledByCurrentChild(): boolean { - return this.child === this.parent.currentChild; - } - }; - - constructor(private readonly channelControlHelper: ChannelControlHelper) {} - - /** - * Prerequisites: lbConfig !== null and lbConfig.name is registered - * @param addressList - * @param lbConfig - * @param attributes - */ - updateAddressList( - addressList: SubchannelAddress[], - lbConfig: LoadBalancingConfig, - attributes: { [key: string]: unknown } - ): void { - let childToUpdate: LoadBalancer; - if ( - this.currentChild === null || - this.currentChild.getTypeName() !== lbConfig.getLoadBalancerName() - ) { - const newHelper = new this.ChildPolicyHelper(this); - const newChild = createLoadBalancer(lbConfig, newHelper)!; - newHelper.setChild(newChild); - if (this.currentChild === null) { - this.currentChild = newChild; - childToUpdate = this.currentChild; - } else { - if (this.pendingChild) { - this.pendingChild.destroy(); - } - this.pendingChild = newChild; - childToUpdate = this.pendingChild; - } - } else { - if (this.pendingChild === null) { - childToUpdate = this.currentChild; - } else { - childToUpdate = this.pendingChild; - } - } - childToUpdate.updateAddressList(addressList, lbConfig, attributes); - } - exitIdle(): void { - if (this.currentChild) { - this.currentChild.resetBackoff(); - if (this.pendingChild) { - this.pendingChild.resetBackoff(); - } - } - } - resetBackoff(): void { - if (this.currentChild) { - this.currentChild.resetBackoff(); - if (this.pendingChild) { - this.pendingChild.resetBackoff(); - } - } - } - destroy(): void { - if (this.currentChild) { - this.currentChild.destroy(); - this.currentChild = null; - } - if (this.pendingChild) { - this.pendingChild.destroy(); - this.pendingChild = null; - } - } - getTypeName(): string { - return TYPE_NAME; - } -} diff --git a/node_modules/@grpc/grpc-js/src/load-balancer-pick-first.ts b/node_modules/@grpc/grpc-js/src/load-balancer-pick-first.ts deleted file mode 100644 index 31dc1784..00000000 --- a/node_modules/@grpc/grpc-js/src/load-balancer-pick-first.ts +++ /dev/null @@ -1,461 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - LoadBalancer, - ChannelControlHelper, - registerLoadBalancerType, - LoadBalancingConfig -} from './load-balancer'; -import { ConnectivityState } from './channel'; -import { - QueuePicker, - Picker, - PickArgs, - CompletePickResult, - PickResultType, - UnavailablePicker, -} from './picker'; -import { - Subchannel, - ConnectivityStateListener, - SubchannelAddress, - subchannelAddressToString, -} from './subchannel'; -import * as logging from './logging'; -import { LogVerbosity } from './constants'; - -const TRACER_NAME = 'pick_first'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -const TYPE_NAME = 'pick_first'; - -/** - * Delay after starting a connection on a subchannel before starting a - * connection on the next subchannel in the list, for Happy Eyeballs algorithm. - */ -const CONNECTION_DELAY_INTERVAL_MS = 250; - -export class PickFirstLoadBalancingConfig implements LoadBalancingConfig { - getLoadBalancerName(): string { - return TYPE_NAME; - } - - constructor() {} - - toJsonObject(): object { - return { - [TYPE_NAME]: {} - }; - } - - static createFromJson(obj: any) { - return new PickFirstLoadBalancingConfig(); - } -} - -/** - * Picker for a `PickFirstLoadBalancer` in the READY state. Always returns the - * picked subchannel. - */ -class PickFirstPicker implements Picker { - constructor(private subchannel: Subchannel) {} - - pick(pickArgs: PickArgs): CompletePickResult { - return { - pickResultType: PickResultType.COMPLETE, - subchannel: this.subchannel, - status: null, - extraFilterFactory: null, - onCallStarted: null, - }; - } -} - -interface ConnectivityStateCounts { - [ConnectivityState.CONNECTING]: number; - [ConnectivityState.IDLE]: number; - [ConnectivityState.READY]: number; - [ConnectivityState.SHUTDOWN]: number; - [ConnectivityState.TRANSIENT_FAILURE]: number; -} - -export class PickFirstLoadBalancer implements LoadBalancer { - /** - * The list of backend addresses most recently passed to `updateAddressList`. - */ - private latestAddressList: SubchannelAddress[] = []; - /** - * The list of subchannels this load balancer is currently attempting to - * connect to. - */ - private subchannels: Subchannel[] = []; - /** - * The current connectivity state of the load balancer. - */ - private currentState: ConnectivityState = ConnectivityState.IDLE; - /** - * The index within the `subchannels` array of the subchannel with the most - * recently started connection attempt. - */ - private currentSubchannelIndex = 0; - - private subchannelStateCounts: ConnectivityStateCounts; - /** - * The currently picked subchannel used for making calls. Populated if - * and only if the load balancer's current state is READY. In that case, - * the subchannel's current state is also READY. - */ - private currentPick: Subchannel | null = null; - /** - * Listener callback attached to each subchannel in the `subchannels` list - * while establishing a connection. - */ - private subchannelStateListener: ConnectivityStateListener; - /** - * Listener callback attached to the current picked subchannel. - */ - private pickedSubchannelStateListener: ConnectivityStateListener; - /** - * Timer reference for the timer tracking when to start - */ - private connectionDelayTimeout: NodeJS.Timeout; - - private triedAllSubchannels = false; - - /** - * Load balancer that attempts to connect to each backend in the address list - * in order, and picks the first one that connects, using it for every - * request. - * @param channelControlHelper `ChannelControlHelper` instance provided by - * this load balancer's owner. - */ - constructor(private readonly channelControlHelper: ChannelControlHelper) { - this.subchannelStateCounts = { - [ConnectivityState.CONNECTING]: 0, - [ConnectivityState.IDLE]: 0, - [ConnectivityState.READY]: 0, - [ConnectivityState.SHUTDOWN]: 0, - [ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannelStateListener = ( - subchannel: Subchannel, - previousState: ConnectivityState, - newState: ConnectivityState - ) => { - this.subchannelStateCounts[previousState] -= 1; - this.subchannelStateCounts[newState] += 1; - /* If the subchannel we most recently attempted to start connecting - * to goes into TRANSIENT_FAILURE, immediately try to start - * connecting to the next one instead of waiting for the connection - * delay timer. */ - if ( - subchannel === this.subchannels[this.currentSubchannelIndex] && - newState === ConnectivityState.TRANSIENT_FAILURE - ) { - this.startNextSubchannelConnecting(); - } - if (newState === ConnectivityState.READY) { - this.pickSubchannel(subchannel); - return; - } else { - if ( - this.triedAllSubchannels && - this.subchannelStateCounts[ConnectivityState.IDLE] === - this.subchannels.length - ) { - /* If all of the subchannels are IDLE we should go back to a - * basic IDLE state where there is no subchannel list to avoid - * holding unused resources */ - this.resetSubchannelList(); - this.updateState(ConnectivityState.IDLE, new QueuePicker(this)); - return; - } - if (this.currentPick === null) { - if (this.triedAllSubchannels) { - let newLBState: ConnectivityState; - if (this.subchannelStateCounts[ConnectivityState.CONNECTING] > 0) { - newLBState = ConnectivityState.CONNECTING; - } else if ( - this.subchannelStateCounts[ConnectivityState.TRANSIENT_FAILURE] > - 0 - ) { - newLBState = ConnectivityState.TRANSIENT_FAILURE; - } else { - newLBState = ConnectivityState.IDLE; - } - if (newLBState !== this.currentState) { - if (newLBState === ConnectivityState.TRANSIENT_FAILURE) { - this.updateState(newLBState, new UnavailablePicker()); - } else { - this.updateState(newLBState, new QueuePicker(this)); - } - } - } else { - this.updateState( - ConnectivityState.CONNECTING, - new QueuePicker(this) - ); - } - } - } - }; - this.pickedSubchannelStateListener = ( - subchannel: Subchannel, - previousState: ConnectivityState, - newState: ConnectivityState - ) => { - if (newState !== ConnectivityState.READY) { - this.currentPick = null; - subchannel.unref(); - subchannel.removeConnectivityStateListener( - this.pickedSubchannelStateListener - ); - if (this.subchannels.length > 0) { - if (this.triedAllSubchannels) { - let newLBState: ConnectivityState; - if (this.subchannelStateCounts[ConnectivityState.CONNECTING] > 0) { - newLBState = ConnectivityState.CONNECTING; - } else if ( - this.subchannelStateCounts[ConnectivityState.TRANSIENT_FAILURE] > - 0 - ) { - newLBState = ConnectivityState.TRANSIENT_FAILURE; - } else { - newLBState = ConnectivityState.IDLE; - } - if (newLBState === ConnectivityState.TRANSIENT_FAILURE) { - this.updateState(newLBState, new UnavailablePicker()); - } else { - this.updateState(newLBState, new QueuePicker(this)); - } - } else { - this.updateState( - ConnectivityState.CONNECTING, - new QueuePicker(this) - ); - } - } else { - /* We don't need to backoff here because this only happens if a - * subchannel successfully connects then disconnects, so it will not - * create a loop of attempting to connect to an unreachable backend - */ - this.updateState(ConnectivityState.IDLE, new QueuePicker(this)); - } - } - }; - this.connectionDelayTimeout = setTimeout(() => {}, 0); - clearTimeout(this.connectionDelayTimeout); - } - - private startNextSubchannelConnecting() { - if (this.triedAllSubchannels) { - return; - } - for (const [index, subchannel] of this.subchannels.entries()) { - if (index > this.currentSubchannelIndex) { - const subchannelState = subchannel.getConnectivityState(); - if ( - subchannelState === ConnectivityState.IDLE || - subchannelState === ConnectivityState.CONNECTING - ) { - this.startConnecting(index); - return; - } - } - } - this.triedAllSubchannels = true; - } - - /** - * Have a single subchannel in the `subchannels` list start connecting. - * @param subchannelIndex The index into the `subchannels` list. - */ - private startConnecting(subchannelIndex: number) { - clearTimeout(this.connectionDelayTimeout); - this.currentSubchannelIndex = subchannelIndex; - if ( - this.subchannels[subchannelIndex].getConnectivityState() === - ConnectivityState.IDLE - ) { - trace( - 'Start connecting to subchannel with address ' + - this.subchannels[subchannelIndex].getAddress() - ); - process.nextTick(() => { - this.subchannels[subchannelIndex].startConnecting(); - }); - } - this.connectionDelayTimeout = setTimeout(() => { - this.startNextSubchannelConnecting(); - }, CONNECTION_DELAY_INTERVAL_MS); - } - - private pickSubchannel(subchannel: Subchannel) { - trace('Pick subchannel with address ' + subchannel.getAddress()); - if (this.currentPick !== null) { - this.currentPick.unref(); - this.currentPick.removeConnectivityStateListener( - this.pickedSubchannelStateListener - ); - } - this.currentPick = subchannel; - this.updateState(ConnectivityState.READY, new PickFirstPicker(subchannel)); - subchannel.addConnectivityStateListener(this.pickedSubchannelStateListener); - subchannel.ref(); - this.resetSubchannelList(); - clearTimeout(this.connectionDelayTimeout); - } - - private updateState(newState: ConnectivityState, picker: Picker) { - trace( - ConnectivityState[this.currentState] + - ' -> ' + - ConnectivityState[newState] - ); - this.currentState = newState; - this.channelControlHelper.updateState(newState, picker); - } - - private resetSubchannelList() { - for (const subchannel of this.subchannels) { - subchannel.removeConnectivityStateListener(this.subchannelStateListener); - subchannel.unref(); - } - this.currentSubchannelIndex = 0; - this.subchannelStateCounts = { - [ConnectivityState.CONNECTING]: 0, - [ConnectivityState.IDLE]: 0, - [ConnectivityState.READY]: 0, - [ConnectivityState.SHUTDOWN]: 0, - [ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannels = []; - this.triedAllSubchannels = false; - } - - /** - * Start connecting to the address list most recently passed to - * `updateAddressList`. - */ - private connectToAddressList(): void { - this.resetSubchannelList(); - trace( - 'Connect to address list ' + - this.latestAddressList.map((address) => - subchannelAddressToString(address) - ) - ); - this.subchannels = this.latestAddressList.map((address) => - this.channelControlHelper.createSubchannel(address, {}) - ); - for (const subchannel of this.subchannels) { - subchannel.ref(); - } - for (const subchannel of this.subchannels) { - subchannel.addConnectivityStateListener(this.subchannelStateListener); - this.subchannelStateCounts[subchannel.getConnectivityState()] += 1; - if (subchannel.getConnectivityState() === ConnectivityState.READY) { - this.pickSubchannel(subchannel); - this.resetSubchannelList(); - return; - } - } - for (const [index, subchannel] of this.subchannels.entries()) { - const subchannelState = subchannel.getConnectivityState(); - if ( - subchannelState === ConnectivityState.IDLE || - subchannelState === ConnectivityState.CONNECTING - ) { - this.startConnecting(index); - if (this.currentPick === null) { - this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this)); - } - return; - } - } - // If the code reaches this point, every subchannel must be in TRANSIENT_FAILURE - if (this.currentPick === null) { - this.updateState( - ConnectivityState.TRANSIENT_FAILURE, - new UnavailablePicker() - ); - } - } - - updateAddressList( - addressList: SubchannelAddress[], - lbConfig: LoadBalancingConfig - ): void { - // lbConfig has no useful information for pick first load balancing - /* To avoid unnecessary churn, we only do something with this address list - * if we're not currently trying to establish a connection, or if the new - * address list is different from the existing one */ - if ( - this.subchannels.length === 0 || - !this.latestAddressList.every( - (value, index) => addressList[index] === value - ) - ) { - this.latestAddressList = addressList; - this.connectToAddressList(); - } - } - - exitIdle() { - for (const subchannel of this.subchannels) { - subchannel.startConnecting(); - } - if (this.currentState === ConnectivityState.IDLE) { - if (this.latestAddressList.length > 0) { - this.connectToAddressList(); - } - } - if ( - this.currentState === ConnectivityState.IDLE || - this.triedAllSubchannels - ) { - this.channelControlHelper.requestReresolution(); - } - } - - resetBackoff() { - /* The pick first load balancer does not have a connection backoff, so this - * does nothing */ - } - - destroy() { - this.resetSubchannelList(); - if (this.currentPick !== null) { - this.currentPick.unref(); - this.currentPick.removeConnectivityStateListener( - this.pickedSubchannelStateListener - ); - } - } - - getTypeName(): string { - return TYPE_NAME; - } -} - -export function setup(): void { - registerLoadBalancerType(TYPE_NAME, PickFirstLoadBalancer, PickFirstLoadBalancingConfig); -} diff --git a/node_modules/@grpc/grpc-js/src/load-balancer-round-robin.ts b/node_modules/@grpc/grpc-js/src/load-balancer-round-robin.ts deleted file mode 100644 index fc9bef0c..00000000 --- a/node_modules/@grpc/grpc-js/src/load-balancer-round-robin.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - LoadBalancer, - ChannelControlHelper, - registerLoadBalancerType, - LoadBalancingConfig -} from './load-balancer'; -import { ConnectivityState } from './channel'; -import { - QueuePicker, - Picker, - PickArgs, - CompletePickResult, - PickResultType, - UnavailablePicker, -} from './picker'; -import { - Subchannel, - ConnectivityStateListener, - SubchannelAddress, - subchannelAddressToString, -} from './subchannel'; -import * as logging from './logging'; -import { LogVerbosity } from './constants'; - -const TRACER_NAME = 'round_robin'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -const TYPE_NAME = 'round_robin'; - -class RoundRobinLoadBalancingConfig implements LoadBalancingConfig { - getLoadBalancerName(): string { - return TYPE_NAME; - } - - constructor() {} - - toJsonObject(): object { - return { - [TYPE_NAME]: {} - }; - } - - static createFromJson(obj: any) { - return new RoundRobinLoadBalancingConfig(); - } -} - -class RoundRobinPicker implements Picker { - constructor( - private readonly subchannelList: Subchannel[], - private nextIndex = 0 - ) {} - - pick(pickArgs: PickArgs): CompletePickResult { - const pickedSubchannel = this.subchannelList[this.nextIndex]; - this.nextIndex = (this.nextIndex + 1) % this.subchannelList.length; - return { - pickResultType: PickResultType.COMPLETE, - subchannel: pickedSubchannel, - status: null, - extraFilterFactory: null, - onCallStarted: null, - }; - } - - /** - * Check what the next subchannel returned would be. Used by the load - * balancer implementation to preserve this part of the picker state if - * possible when a subchannel connects or disconnects. - */ - peekNextSubchannel(): Subchannel { - return this.subchannelList[this.nextIndex]; - } -} - -interface ConnectivityStateCounts { - [ConnectivityState.CONNECTING]: number; - [ConnectivityState.IDLE]: number; - [ConnectivityState.READY]: number; - [ConnectivityState.SHUTDOWN]: number; - [ConnectivityState.TRANSIENT_FAILURE]: number; -} - -export class RoundRobinLoadBalancer implements LoadBalancer { - private subchannels: Subchannel[] = []; - - private currentState: ConnectivityState = ConnectivityState.IDLE; - - private subchannelStateListener: ConnectivityStateListener; - - private subchannelStateCounts: ConnectivityStateCounts; - - private currentReadyPicker: RoundRobinPicker | null = null; - - constructor(private readonly channelControlHelper: ChannelControlHelper) { - this.subchannelStateCounts = { - [ConnectivityState.CONNECTING]: 0, - [ConnectivityState.IDLE]: 0, - [ConnectivityState.READY]: 0, - [ConnectivityState.SHUTDOWN]: 0, - [ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannelStateListener = ( - subchannel: Subchannel, - previousState: ConnectivityState, - newState: ConnectivityState - ) => { - this.subchannelStateCounts[previousState] -= 1; - this.subchannelStateCounts[newState] += 1; - this.calculateAndUpdateState(); - - if (newState === ConnectivityState.TRANSIENT_FAILURE) { - this.channelControlHelper.requestReresolution(); - } - if ( - newState === ConnectivityState.TRANSIENT_FAILURE || - newState === ConnectivityState.IDLE - ) { - subchannel.startConnecting(); - } - }; - } - - private calculateAndUpdateState() { - if (this.subchannelStateCounts[ConnectivityState.READY] > 0) { - const readySubchannels = this.subchannels.filter( - (subchannel) => - subchannel.getConnectivityState() === ConnectivityState.READY - ); - let index = 0; - if (this.currentReadyPicker !== null) { - index = readySubchannels.indexOf( - this.currentReadyPicker.peekNextSubchannel() - ); - if (index < 0) { - index = 0; - } - } - this.updateState( - ConnectivityState.READY, - new RoundRobinPicker(readySubchannels, index) - ); - } else if (this.subchannelStateCounts[ConnectivityState.CONNECTING] > 0) { - this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this)); - } else if ( - this.subchannelStateCounts[ConnectivityState.TRANSIENT_FAILURE] > 0 - ) { - this.updateState( - ConnectivityState.TRANSIENT_FAILURE, - new UnavailablePicker() - ); - } else { - this.updateState(ConnectivityState.IDLE, new QueuePicker(this)); - } - } - - private updateState(newState: ConnectivityState, picker: Picker) { - trace( - ConnectivityState[this.currentState] + - ' -> ' + - ConnectivityState[newState] - ); - if (newState === ConnectivityState.READY) { - this.currentReadyPicker = picker as RoundRobinPicker; - } else { - this.currentReadyPicker = null; - } - this.currentState = newState; - this.channelControlHelper.updateState(newState, picker); - } - - private resetSubchannelList() { - for (const subchannel of this.subchannels) { - subchannel.removeConnectivityStateListener(this.subchannelStateListener); - subchannel.unref(); - } - this.subchannelStateCounts = { - [ConnectivityState.CONNECTING]: 0, - [ConnectivityState.IDLE]: 0, - [ConnectivityState.READY]: 0, - [ConnectivityState.SHUTDOWN]: 0, - [ConnectivityState.TRANSIENT_FAILURE]: 0, - }; - this.subchannels = []; - } - - updateAddressList( - addressList: SubchannelAddress[], - lbConfig: LoadBalancingConfig - ): void { - this.resetSubchannelList(); - trace( - 'Connect to address list ' + - addressList.map((address) => subchannelAddressToString(address)) - ); - this.subchannels = addressList.map((address) => - this.channelControlHelper.createSubchannel(address, {}) - ); - for (const subchannel of this.subchannels) { - subchannel.ref(); - subchannel.addConnectivityStateListener(this.subchannelStateListener); - const subchannelState = subchannel.getConnectivityState(); - this.subchannelStateCounts[subchannelState] += 1; - if ( - subchannelState === ConnectivityState.IDLE || - subchannelState === ConnectivityState.TRANSIENT_FAILURE - ) { - subchannel.startConnecting(); - } - } - this.calculateAndUpdateState(); - } - - exitIdle(): void { - for (const subchannel of this.subchannels) { - subchannel.startConnecting(); - } - } - resetBackoff(): void { - /* The pick first load balancer does not have a connection backoff, so this - * does nothing */ - } - destroy(): void { - this.resetSubchannelList(); - } - getTypeName(): string { - return TYPE_NAME; - } -} - -export function setup() { - registerLoadBalancerType(TYPE_NAME, RoundRobinLoadBalancer, RoundRobinLoadBalancingConfig); -} diff --git a/node_modules/@grpc/grpc-js/src/load-balancer.ts b/node_modules/@grpc/grpc-js/src/load-balancer.ts deleted file mode 100644 index 8d5c7c83..00000000 --- a/node_modules/@grpc/grpc-js/src/load-balancer.ts +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { ChannelOptions } from './channel-options'; -import { Subchannel, SubchannelAddress } from './subchannel'; -import { ConnectivityState } from './channel'; -import { Picker } from './picker'; -import * as load_balancer_pick_first from './load-balancer-pick-first'; -import * as load_balancer_round_robin from './load-balancer-round-robin'; - -/** - * A collection of functions associated with a channel that a load balancer - * can call as necessary. - */ -export interface ChannelControlHelper { - /** - * Returns a subchannel connected to the specified address. - * @param subchannelAddress The address to connect to - * @param subchannelArgs Extra channel arguments specified by the load balancer - */ - createSubchannel( - subchannelAddress: SubchannelAddress, - subchannelArgs: ChannelOptions - ): Subchannel; - /** - * Passes a new subchannel picker up to the channel. This is called if either - * the connectivity state changes or if a different picker is needed for any - * other reason. - * @param connectivityState New connectivity state - * @param picker New picker - */ - updateState(connectivityState: ConnectivityState, picker: Picker): void; - /** - * Request new data from the resolver. - */ - requestReresolution(): void; -} - -/** - * Tracks one or more connected subchannels and determines which subchannel - * each request should use. - */ -export interface LoadBalancer { - /** - * Gives the load balancer a new list of addresses to start connecting to. - * The load balancer will start establishing connections with the new list, - * but will continue using any existing connections until the new connections - * are established - * @param addressList The new list of addresses to connect to - * @param lbConfig The load balancing config object from the service config, - * if one was provided - */ - updateAddressList( - addressList: SubchannelAddress[], - lbConfig: LoadBalancingConfig, - attributes: { [key: string]: unknown } - ): void; - /** - * If the load balancer is currently in the IDLE state, start connecting. - */ - exitIdle(): void; - /** - * If the load balancer is currently in the CONNECTING or TRANSIENT_FAILURE - * state, reset the current connection backoff timeout to its base value and - * transition to CONNECTING if in TRANSIENT_FAILURE. - */ - resetBackoff(): void; - /** - * The load balancer unrefs all of its subchannels and stops calling methods - * of its channel control helper. - */ - destroy(): void; - /** - * Get the type name for this load balancer type. Must be constant across an - * entire load balancer implementation class and must match the name that the - * balancer implementation class was registered with. - */ - getTypeName(): string; -} - -export interface LoadBalancerConstructor { - new (channelControlHelper: ChannelControlHelper): LoadBalancer; -} - -export interface LoadBalancingConfig { - getLoadBalancerName(): string; - toJsonObject(): object; -} - -export interface LoadBalancingConfigConstructor { - new(...args: any): LoadBalancingConfig; - createFromJson(obj: any): LoadBalancingConfig; -} - -const registeredLoadBalancerTypes: { - [name: string]: { - LoadBalancer: LoadBalancerConstructor, - LoadBalancingConfig: LoadBalancingConfigConstructor - }; -} = {}; - -export function registerLoadBalancerType( - typeName: string, - loadBalancerType: LoadBalancerConstructor, - loadBalancingConfigType: LoadBalancingConfigConstructor -) { - registeredLoadBalancerTypes[typeName] = { - LoadBalancer: loadBalancerType, - LoadBalancingConfig: loadBalancingConfigType - }; -} - -export function createLoadBalancer( - config: LoadBalancingConfig, - channelControlHelper: ChannelControlHelper -): LoadBalancer | null { - const typeName = config.getLoadBalancerName(); - if (typeName in registeredLoadBalancerTypes) { - return new registeredLoadBalancerTypes[typeName].LoadBalancer(channelControlHelper); - } else { - return null; - } -} - -export function isLoadBalancerNameRegistered(typeName: string): boolean { - return typeName in registeredLoadBalancerTypes; -} - -export function getFirstUsableConfig(configs: LoadBalancingConfig[], defaultPickFirst?: true): LoadBalancingConfig; -export function getFirstUsableConfig( - configs: LoadBalancingConfig[], - defaultPickFirst: boolean = false -): LoadBalancingConfig | null { - for (const config of configs) { - if (config.getLoadBalancerName() in registeredLoadBalancerTypes) { - return config; - } - } - if (defaultPickFirst) { - return new load_balancer_pick_first.PickFirstLoadBalancingConfig() - } else { - return null; - } -} - -export function validateLoadBalancingConfig(obj: any): LoadBalancingConfig { - if (!(obj !== null && (typeof obj === 'object'))) { - throw new Error('Load balancing config must be an object'); - } - const keys = Object.keys(obj); - if (keys.length !== 1) { - throw new Error('Provided load balancing config has multiple conflicting entries'); - } - const typeName = keys[0]; - if (typeName in registeredLoadBalancerTypes) { - return registeredLoadBalancerTypes[typeName].LoadBalancingConfig.createFromJson(obj[typeName]); - } else { - throw new Error(`Unrecognized load balancing config name ${typeName}`); - } -} - -export function registerAll() { - load_balancer_pick_first.setup(); - load_balancer_round_robin.setup(); -} diff --git a/node_modules/@grpc/grpc-js/src/logging.ts b/node_modules/@grpc/grpc-js/src/logging.ts deleted file mode 100644 index 1140e8d8..00000000 --- a/node_modules/@grpc/grpc-js/src/logging.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { LogVerbosity } from './constants'; - -let _logger: Partial = console; -let _logVerbosity: LogVerbosity = LogVerbosity.ERROR; - -const verbosityString = process.env.GRPC_NODE_VERBOSITY ?? process.env.GRPC_VERBOSITY ?? ''; - -switch (verbosityString) { - case 'DEBUG': - _logVerbosity = LogVerbosity.DEBUG; - break; - case 'INFO': - _logVerbosity = LogVerbosity.INFO; - break; - case 'ERROR': - _logVerbosity = LogVerbosity.ERROR; - break; - default: - // Ignore any other values -} - -export const getLogger = (): Partial => { - return _logger; -}; - -export const setLogger = (logger: Partial): void => { - _logger = logger; -}; - -export const setLoggerVerbosity = (verbosity: LogVerbosity): void => { - _logVerbosity = verbosity; -}; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export const log = (severity: LogVerbosity, ...args: any[]): void => { - if (severity >= _logVerbosity && typeof _logger.error === 'function') { - _logger.error(...args); - } -}; - -const tracersString = process.env.GRPC_NODE_TRACE ?? process.env.GRPC_TRACE ?? ''; -const enabledTracers = tracersString.split(','); -const allEnabled = enabledTracers.includes('all'); - -export function trace( - severity: LogVerbosity, - tracer: string, - text: string -): void { - if (allEnabled || enabledTracers.includes(tracer)) { - log(severity, new Date().toISOString() + ' | ' + tracer + ' | ' + text); - } -} diff --git a/node_modules/@grpc/grpc-js/src/make-client.ts b/node_modules/@grpc/grpc-js/src/make-client.ts deleted file mode 100644 index 05f06b89..00000000 --- a/node_modules/@grpc/grpc-js/src/make-client.ts +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { ChannelCredentials } from './channel-credentials'; -import { ChannelOptions } from './channel-options'; -import { Client } from './client'; -import { UntypedServiceImplementation } from './server'; - -export interface Serialize { - (value: T): Buffer; -} - -export interface Deserialize { - (bytes: Buffer): T; -} - -export interface ClientMethodDefinition { - path: string; - requestStream: boolean; - responseStream: boolean; - requestSerialize: Serialize; - responseDeserialize: Deserialize; - originalName?: string; -} - -export interface ServerMethodDefinition { - path: string; - requestStream: boolean; - responseStream: boolean; - responseSerialize: Serialize; - requestDeserialize: Deserialize; - originalName?: string; -} - -export interface MethodDefinition - extends ClientMethodDefinition, - ServerMethodDefinition {} - -/* eslint-disable @typescript-eslint/no-explicit-any */ -export type ServiceDefinition< - ImplementationType = UntypedServiceImplementation -> = { - readonly [index in keyof ImplementationType]: MethodDefinition; -}; -/* eslint-enable @typescript-eslint/no-explicit-any */ - -export interface ProtobufTypeDefinition { - format: string; - type: object; - fileDescriptorProtos: Buffer[]; -} - -export interface PackageDefinition { - [index: string]: ServiceDefinition | ProtobufTypeDefinition; -} - -/** - * Map with short names for each of the requester maker functions. Used in - * makeClientConstructor - * @private - */ -const requesterFuncs = { - unary: Client.prototype.makeUnaryRequest, - server_stream: Client.prototype.makeServerStreamRequest, - client_stream: Client.prototype.makeClientStreamRequest, - bidi: Client.prototype.makeBidiStreamRequest, -}; - -export interface ServiceClient extends Client { - [methodName: string]: Function; -} - -export interface ServiceClientConstructor { - new ( - address: string, - credentials: ChannelCredentials, - options?: Partial - ): ServiceClient; - service: ServiceDefinition; -} - -/** - * Creates a constructor for a client with the given methods, as specified in - * the methods argument. The resulting class will have an instance method for - * each method in the service, which is a partial application of one of the - * [Client]{@link grpc.Client} request methods, depending on `requestSerialize` - * and `responseSerialize`, with the `method`, `serialize`, and `deserialize` - * arguments predefined. - * @param methods An object mapping method names to - * method attributes - * @param serviceName The fully qualified name of the service - * @param classOptions An options object. - * @return New client constructor, which is a subclass of - * {@link grpc.Client}, and has the same arguments as that constructor. - */ -export function makeClientConstructor( - methods: ServiceDefinition, - serviceName: string, - classOptions?: {} -): ServiceClientConstructor { - if (!classOptions) { - classOptions = {}; - } - - class ServiceClientImpl extends Client implements ServiceClient { - static service: ServiceDefinition; - [methodName: string]: Function; - } - - Object.keys(methods).forEach((name) => { - if (name === '__proto__') { - return; - } - const attrs = methods[name]; - let methodType: keyof typeof requesterFuncs; - // TODO(murgatroid99): Verify that we don't need this anymore - if (typeof name === 'string' && name.charAt(0) === '$') { - throw new Error('Method names cannot start with $'); - } - if (attrs.requestStream) { - if (attrs.responseStream) { - methodType = 'bidi'; - } else { - methodType = 'client_stream'; - } - } else { - if (attrs.responseStream) { - methodType = 'server_stream'; - } else { - methodType = 'unary'; - } - } - const serialize = attrs.requestSerialize; - const deserialize = attrs.responseDeserialize; - const methodFunc = partial( - requesterFuncs[methodType], - attrs.path, - serialize, - deserialize - ); - ServiceClientImpl.prototype[name] = methodFunc; - // Associate all provided attributes with the method - Object.assign(ServiceClientImpl.prototype[name], attrs); - if (attrs.originalName && attrs.originalName !== '__proto__') { - ServiceClientImpl.prototype[attrs.originalName] = - ServiceClientImpl.prototype[name]; - } - }); - - ServiceClientImpl.service = methods; - - return ServiceClientImpl; -} - -function partial( - fn: Function, - path: string, - serialize: Function, - deserialize: Function -): Function { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return function (this: any, ...args: any[]) { - return fn.call(this, path, serialize, deserialize, ...args); - }; -} - -export interface GrpcObject { - [index: string]: - | GrpcObject - | ServiceClientConstructor - | ProtobufTypeDefinition; -} - -function isProtobufTypeDefinition( - obj: ServiceDefinition | ProtobufTypeDefinition -): obj is ProtobufTypeDefinition { - return 'format' in obj; -} - -/** - * Load a gRPC package definition as a gRPC object hierarchy. - * @param packageDef The package definition object. - * @return The resulting gRPC object. - */ -export function loadPackageDefinition( - packageDef: PackageDefinition -): GrpcObject { - const result: GrpcObject = {}; - for (const serviceFqn in packageDef) { - if (Object.prototype.hasOwnProperty.call(packageDef, serviceFqn)) { - const service = packageDef[serviceFqn]; - const nameComponents = serviceFqn.split('.'); - if (nameComponents.some(comp => comp === '__proto__')) { - continue; - } - const serviceName = nameComponents[nameComponents.length - 1]; - let current = result; - for (const packageName of nameComponents.slice(0, -1)) { - if (!current[packageName]) { - current[packageName] = {}; - } - current = current[packageName] as GrpcObject; - } - if (isProtobufTypeDefinition(service)) { - current[serviceName] = service; - } else { - current[serviceName] = makeClientConstructor(service, serviceName, {}); - } - } - } - return result; -} diff --git a/node_modules/@grpc/grpc-js/src/max-message-size-filter.ts b/node_modules/@grpc/grpc-js/src/max-message-size-filter.ts deleted file mode 100644 index f820c02e..00000000 --- a/node_modules/@grpc/grpc-js/src/max-message-size-filter.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2020 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { BaseFilter, Filter, FilterFactory } from "./filter"; -import { Call, WriteObject } from "./call-stream"; -import { Status, DEFAULT_MAX_SEND_MESSAGE_LENGTH, DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH } from "./constants"; -import { ChannelOptions } from "./channel-options"; - -export class MaxMessageSizeFilter extends BaseFilter implements Filter { - private maxSendMessageSize: number = DEFAULT_MAX_SEND_MESSAGE_LENGTH; - private maxReceiveMessageSize: number = DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH; - constructor( - private readonly options: ChannelOptions, - private readonly callStream: Call - ) { - super(); - if ('grpc.max_send_message_length' in options) { - this.maxSendMessageSize = options['grpc.max_send_message_length']!; - } - if ('grpc.max_receive_message_length' in options) { - this.maxReceiveMessageSize = options['grpc.max_receive_message_length']!; - } - } - - async sendMessage(message: Promise): Promise { - /* A configured size of -1 means that there is no limit, so skip the check - * entirely */ - if (this.maxSendMessageSize === -1) { - return message; - } else { - const concreteMessage = await message; - if (concreteMessage.message.length > this.maxSendMessageSize) { - this.callStream.cancelWithStatus(Status.RESOURCE_EXHAUSTED, `Sent message larger than max (${concreteMessage.message.length} vs. ${this.maxSendMessageSize})`); - return Promise.reject('Message too large'); - } else { - return concreteMessage; - } - } - } - - async receiveMessage(message: Promise): Promise { - /* A configured size of -1 means that there is no limit, so skip the check - * entirely */ - if (this.maxReceiveMessageSize === -1) { - return message; - } else { - const concreteMessage = await message; - if (concreteMessage.length > this.maxReceiveMessageSize) { - this.callStream.cancelWithStatus(Status.RESOURCE_EXHAUSTED, `Received message larger than max (${concreteMessage.length} vs. ${this.maxReceiveMessageSize})`); - return Promise.reject('Message too large'); - } else { - return concreteMessage; - } - } - } -} - -export class MaxMessageSizeFilterFactory implements FilterFactory { - constructor(private readonly options: ChannelOptions) {} - - createFilter(callStream: Call): MaxMessageSizeFilter { - return new MaxMessageSizeFilter(this.options, callStream); - } -} diff --git a/node_modules/@grpc/grpc-js/src/metadata.ts b/node_modules/@grpc/grpc-js/src/metadata.ts deleted file mode 100644 index 4947bf0a..00000000 --- a/node_modules/@grpc/grpc-js/src/metadata.ts +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import * as http2 from 'http2'; -import { log } from './logging'; -import { LogVerbosity } from './constants'; -const LEGAL_KEY_REGEX = /^[0-9a-z_.-]+$/; -const LEGAL_NON_BINARY_VALUE_REGEX = /^[ -~]*$/; - -export type MetadataValue = string | Buffer; -export type MetadataObject = Map; - -function isLegalKey(key: string): boolean { - return LEGAL_KEY_REGEX.test(key); -} - -function isLegalNonBinaryValue(value: string): boolean { - return LEGAL_NON_BINARY_VALUE_REGEX.test(value); -} - -function isBinaryKey(key: string): boolean { - return key.endsWith('-bin'); -} - -function isCustomMetadata(key: string): boolean { - return !key.startsWith('grpc-'); -} - -function normalizeKey(key: string): string { - return key.toLowerCase(); -} - -function validate(key: string, value?: MetadataValue): void { - if (!isLegalKey(key)) { - throw new Error('Metadata key "' + key + '" contains illegal characters'); - } - if (value !== null && value !== undefined) { - if (isBinaryKey(key)) { - if (!(value instanceof Buffer)) { - throw new Error("keys that end with '-bin' must have Buffer values"); - } - } else { - if (value instanceof Buffer) { - throw new Error( - "keys that don't end with '-bin' must have String values" - ); - } - if (!isLegalNonBinaryValue(value)) { - throw new Error( - 'Metadata string value "' + value + '" contains illegal characters' - ); - } - } - } -} - -export interface MetadataOptions { - /* Signal that the request is idempotent. Defaults to false */ - idempotentRequest?: boolean; - /* Signal that the call should not return UNAVAILABLE before it has - * started. Defaults to false. */ - waitForReady?: boolean; - /* Signal that the call is cacheable. GRPC is free to use GET verb. - * Defaults to false */ - cacheableRequest?: boolean; - /* Signal that the initial metadata should be corked. Defaults to false. */ - corked?: boolean; -} - -/** - * A class for storing metadata. Keys are normalized to lowercase ASCII. - */ -export class Metadata { - protected internalRepr: MetadataObject = new Map(); - private options: MetadataOptions; - - constructor(options?: MetadataOptions) { - if (options === undefined) { - this.options = {}; - } else { - this.options = options; - } - } - - /** - * Sets the given value for the given key by replacing any other values - * associated with that key. Normalizes the key. - * @param key The key to whose value should be set. - * @param value The value to set. Must be a buffer if and only - * if the normalized key ends with '-bin'. - */ - set(key: string, value: MetadataValue): void { - key = normalizeKey(key); - validate(key, value); - this.internalRepr.set(key, [value]); - } - - /** - * Adds the given value for the given key by appending to a list of previous - * values associated with that key. Normalizes the key. - * @param key The key for which a new value should be appended. - * @param value The value to add. Must be a buffer if and only - * if the normalized key ends with '-bin'. - */ - add(key: string, value: MetadataValue): void { - key = normalizeKey(key); - validate(key, value); - - const existingValue: MetadataValue[] | undefined = this.internalRepr.get( - key - ); - - if (existingValue === undefined) { - this.internalRepr.set(key, [value]); - } else { - existingValue.push(value); - } - } - - /** - * Removes the given key and any associated values. Normalizes the key. - * @param key The key whose values should be removed. - */ - remove(key: string): void { - key = normalizeKey(key); - validate(key); - this.internalRepr.delete(key); - } - - /** - * Gets a list of all values associated with the key. Normalizes the key. - * @param key The key whose value should be retrieved. - * @return A list of values associated with the given key. - */ - get(key: string): MetadataValue[] { - key = normalizeKey(key); - validate(key); - return this.internalRepr.get(key) || []; - } - - /** - * Gets a plain object mapping each key to the first value associated with it. - * This reflects the most common way that people will want to see metadata. - * @return A key/value mapping of the metadata. - */ - getMap(): { [key: string]: MetadataValue } { - const result: { [key: string]: MetadataValue } = {}; - - this.internalRepr.forEach((values, key) => { - if (values.length > 0) { - const v = values[0]; - result[key] = v instanceof Buffer ? v.slice() : v; - } - }); - return result; - } - - /** - * Clones the metadata object. - * @return The newly cloned object. - */ - clone(): Metadata { - const newMetadata = new Metadata(this.options); - const newInternalRepr = newMetadata.internalRepr; - - this.internalRepr.forEach((value, key) => { - const clonedValue: MetadataValue[] = value.map((v) => { - if (v instanceof Buffer) { - return Buffer.from(v); - } else { - return v; - } - }); - - newInternalRepr.set(key, clonedValue); - }); - - return newMetadata; - } - - /** - * Merges all key-value pairs from a given Metadata object into this one. - * If both this object and the given object have values in the same key, - * values from the other Metadata object will be appended to this object's - * values. - * @param other A Metadata object. - */ - merge(other: Metadata): void { - other.internalRepr.forEach((values, key) => { - const mergedValue: MetadataValue[] = ( - this.internalRepr.get(key) || [] - ).concat(values); - - this.internalRepr.set(key, mergedValue); - }); - } - - setOptions(options: MetadataOptions) { - this.options = options; - } - - getOptions(): MetadataOptions { - return this.options; - } - - /** - * Creates an OutgoingHttpHeaders object that can be used with the http2 API. - */ - toHttp2Headers(): http2.OutgoingHttpHeaders { - // NOTE: Node <8.9 formats http2 headers incorrectly. - const result: http2.OutgoingHttpHeaders = {}; - this.internalRepr.forEach((values, key) => { - // We assume that the user's interaction with this object is limited to - // through its public API (i.e. keys and values are already validated). - result[key] = values.map((value) => { - if (value instanceof Buffer) { - return value.toString('base64'); - } else { - return value; - } - }); - }); - return result; - } - - // For compatibility with the other Metadata implementation - private _getCoreRepresentation() { - return this.internalRepr; - } - - /** - * Returns a new Metadata object based fields in a given IncomingHttpHeaders - * object. - * @param headers An IncomingHttpHeaders object. - */ - static fromHttp2Headers(headers: http2.IncomingHttpHeaders): Metadata { - const result = new Metadata(); - Object.keys(headers).forEach((key) => { - // Reserved headers (beginning with `:`) are not valid keys. - if (key.charAt(0) === ':') { - return; - } - - const values = headers[key]; - - try { - if (isBinaryKey(key)) { - if (Array.isArray(values)) { - values.forEach((value) => { - result.add(key, Buffer.from(value, 'base64')); - }); - } else if (values !== undefined) { - if (isCustomMetadata(key)) { - values.split(',').forEach((v) => { - result.add(key, Buffer.from(v.trim(), 'base64')); - }); - } else { - result.add(key, Buffer.from(values, 'base64')); - } - } - } else { - if (Array.isArray(values)) { - values.forEach((value) => { - result.add(key, value); - }); - } else if (values !== undefined) { - result.add(key, values); - } - } - } catch (error) { - const message = `Failed to add metadata entry ${key}: ${values}. ${error.message}. For more information see https://github.com/grpc/grpc-node/issues/1173`; - log(LogVerbosity.ERROR, message); - } - }); - return result; - } -} diff --git a/node_modules/@grpc/grpc-js/src/object-stream.ts b/node_modules/@grpc/grpc-js/src/object-stream.ts deleted file mode 100644 index b17058a7..00000000 --- a/node_modules/@grpc/grpc-js/src/object-stream.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Duplex, Readable, Writable } from 'stream'; -import { EmitterAugmentation1 } from './events'; - -/* eslint-disable @typescript-eslint/no-explicit-any */ - -export type WriteCallback = (error: Error | null | undefined) => void; - -export interface IntermediateObjectReadable extends Readable { - read(size?: number): any & T; -} - -export type ObjectReadable = { - read(size?: number): T; -} & EmitterAugmentation1<'data', T> & - IntermediateObjectReadable; - -export interface IntermediateObjectWritable extends Writable { - _write(chunk: any & T, encoding: string, callback: Function): void; - write(chunk: any & T, cb?: WriteCallback): boolean; - write(chunk: any & T, encoding?: any, cb?: WriteCallback): boolean; - setDefaultEncoding(encoding: string): this; - end(): void; - end(chunk: any & T, cb?: Function): void; - end(chunk: any & T, encoding?: any, cb?: Function): void; -} - -export interface ObjectWritable extends IntermediateObjectWritable { - _write(chunk: T, encoding: string, callback: Function): void; - write(chunk: T, cb?: Function): boolean; - write(chunk: T, encoding?: any, cb?: Function): boolean; - setDefaultEncoding(encoding: string): this; - end(): void; - end(chunk: T, cb?: Function): void; - end(chunk: T, encoding?: any, cb?: Function): void; -} - -export type ObjectDuplex = { - read(size?: number): U; - - _write(chunk: T, encoding: string, callback: Function): void; - write(chunk: T, cb?: Function): boolean; - write(chunk: T, encoding?: any, cb?: Function): boolean; - end(): void; - end(chunk: T, cb?: Function): void; - end(chunk: T, encoding?: any, cb?: Function): void; -} & Duplex & - ObjectWritable & - ObjectReadable; diff --git a/node_modules/@grpc/grpc-js/src/picker.ts b/node_modules/@grpc/grpc-js/src/picker.ts deleted file mode 100644 index 184047b2..00000000 --- a/node_modules/@grpc/grpc-js/src/picker.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { Subchannel } from './subchannel'; -import { StatusObject } from './call-stream'; -import { Metadata } from './metadata'; -import { Status } from './constants'; -import { LoadBalancer } from './load-balancer'; -import { FilterFactory, Filter } from './filter'; - -export enum PickResultType { - COMPLETE, - QUEUE, - TRANSIENT_FAILURE, - DROP, -} - -export interface PickResult { - pickResultType: PickResultType; - /** - * The subchannel to use as the transport for the call. Only meaningful if - * `pickResultType` is COMPLETE. If null, indicates that the call should be - * dropped. - */ - subchannel: Subchannel | null; - /** - * The status object to end the call with. Populated if and only if - * `pickResultType` is TRANSIENT_FAILURE. - */ - status: StatusObject | null; - /** - * Extra FilterFactory (can be multiple encapsulated in a FilterStackFactory) - * provided by the load balancer to be used with the call. For technical - * reasons filters from this factory will not see sendMetadata events. - */ - extraFilterFactory: FilterFactory | null; - onCallStarted: (() => void) | null; -} - -export interface CompletePickResult extends PickResult { - pickResultType: PickResultType.COMPLETE; - subchannel: Subchannel | null; - status: null; - extraFilterFactory: FilterFactory | null; - onCallStarted: (() => void) | null; -} - -export interface QueuePickResult extends PickResult { - pickResultType: PickResultType.QUEUE; - subchannel: null; - status: null; - extraFilterFactory: null; - onCallStarted: null; -} - -export interface TransientFailurePickResult extends PickResult { - pickResultType: PickResultType.TRANSIENT_FAILURE; - subchannel: null; - status: StatusObject; - extraFilterFactory: null; - onCallStarted: null; -} - -export interface DropCallPickResult extends PickResult { - pickResultType: PickResultType.DROP; - subchannel: null; - status: StatusObject; - extraFilterFactory: null; - onCallStarted: null; -} - -export interface PickArgs { - metadata: Metadata; -} - -/** - * A proxy object representing the momentary state of a load balancer. Picks - * subchannels or returns other information based on that state. Should be - * replaced every time the load balancer changes state. - */ -export interface Picker { - pick(pickArgs: PickArgs): PickResult; -} - -/** - * A standard picker representing a load balancer in the TRANSIENT_FAILURE - * state. Always responds to every pick request with an UNAVAILABLE status. - */ -export class UnavailablePicker implements Picker { - private status: StatusObject; - constructor(status?: StatusObject) { - if (status !== undefined) { - this.status = status; - } else { - this.status = { - code: Status.UNAVAILABLE, - details: 'No connection established', - metadata: new Metadata(), - }; - } - } - pick(pickArgs: PickArgs): TransientFailurePickResult { - return { - pickResultType: PickResultType.TRANSIENT_FAILURE, - subchannel: null, - status: this.status, - extraFilterFactory: null, - onCallStarted: null, - }; - } -} - -/** - * A standard picker representing a load balancer in the IDLE or CONNECTING - * state. Always responds to every pick request with a QUEUE pick result - * indicating that the pick should be tried again with the next `Picker`. Also - * reports back to the load balancer that a connection should be established - * once any pick is attempted. - */ -export class QueuePicker { - private calledExitIdle = false; - // Constructed with a load balancer. Calls exitIdle on it the first time pick is called - constructor(private loadBalancer: LoadBalancer) {} - - pick(pickArgs: PickArgs): QueuePickResult { - if (!this.calledExitIdle) { - process.nextTick(() => { - this.loadBalancer.exitIdle(); - }); - this.calledExitIdle = true; - } - return { - pickResultType: PickResultType.QUEUE, - subchannel: null, - status: null, - extraFilterFactory: null, - onCallStarted: null, - }; - } -} diff --git a/node_modules/@grpc/grpc-js/src/resolver-dns.ts b/node_modules/@grpc/grpc-js/src/resolver-dns.ts deleted file mode 100644 index 2db8a5e4..00000000 --- a/node_modules/@grpc/grpc-js/src/resolver-dns.ts +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - Resolver, - ResolverListener, - registerResolver, - registerDefaultScheme, -} from './resolver'; -import * as dns from 'dns'; -import * as util from 'util'; -import { extractAndSelectServiceConfig, ServiceConfig } from './service-config'; -import { Status } from './constants'; -import { StatusObject } from './call-stream'; -import { Metadata } from './metadata'; -import * as logging from './logging'; -import { LogVerbosity } from './constants'; -import { SubchannelAddress, TcpSubchannelAddress } from './subchannel'; -import { GrpcUri, uriToString, splitHostPort } from './uri-parser'; -import { isIPv6, isIPv4 } from 'net'; -import { ChannelOptions } from './channel-options'; - -const TRACER_NAME = 'dns_resolver'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -/** - * The default TCP port to connect to if not explicitly specified in the target. - */ -const DEFAULT_PORT = 443; - -const resolveTxtPromise = util.promisify(dns.resolveTxt); -const dnsLookupPromise = util.promisify(dns.lookup); - -/** - * Merge any number of arrays into a single alternating array - * @param arrays - */ -function mergeArrays(...arrays: T[][]): T[] { - const result: T[] = []; - for ( - let i = 0; - i < - Math.max.apply( - null, - arrays.map((array) => array.length) - ); - i++ - ) { - for (const array of arrays) { - if (i < array.length) { - result.push(array[i]); - } - } - } - return result; -} - -/** - * Resolver implementation that handles DNS names and IP addresses. - */ -class DnsResolver implements Resolver { - private readonly ipResult: SubchannelAddress[] | null; - private readonly dnsHostname: string | null; - private readonly port: number | null; - private pendingLookupPromise: Promise | null = null; - private pendingTxtPromise: Promise | null = null; - private latestLookupResult: TcpSubchannelAddress[] | null = null; - private latestServiceConfig: ServiceConfig | null = null; - private latestServiceConfigError: StatusObject | null = null; - private percentage: number; - private defaultResolutionError: StatusObject; - constructor( - private target: GrpcUri, - private listener: ResolverListener, - channelOptions: ChannelOptions - ) { - trace('Resolver constructed for target ' + uriToString(target)); - const hostPort = splitHostPort(target.path); - if (hostPort === null) { - this.ipResult = null; - this.dnsHostname = null; - this.port = null; - } else { - if (isIPv4(hostPort.host) || isIPv6(hostPort.host)) { - this.ipResult = [ - { - host: hostPort.host, - port: hostPort.port ?? DEFAULT_PORT, - }, - ]; - this.dnsHostname = null; - this.port = null; - } else { - this.ipResult = null; - this.dnsHostname = hostPort.host; - this.port = hostPort.port ?? DEFAULT_PORT; - } - } - this.percentage = Math.random() * 100; - - this.defaultResolutionError = { - code: Status.UNAVAILABLE, - details: `Name resolution failed for target ${uriToString(this.target)}`, - metadata: new Metadata(), - }; - } - - /** - * If the target is an IP address, just provide that address as a result. - * Otherwise, initiate A, AAAA, and TXT lookups - */ - private startResolution() { - if (this.ipResult !== null) { - trace('Returning IP address for target ' + uriToString(this.target)); - setImmediate(() => { - this.listener.onSuccessfulResolution(this.ipResult!, null, null, {}); - }); - return; - } - if (this.dnsHostname === null) { - setImmediate(() => { - this.listener.onError({ - code: Status.UNAVAILABLE, - details: `Failed to parse DNS address ${uriToString(this.target)}`, - metadata: new Metadata(), - }); - }); - } else { - /* We clear out latestLookupResult here to ensure that it contains the - * latest result since the last time we started resolving. That way, the - * TXT resolution handler can use it, but only if it finishes second. We - * don't clear out any previous service config results because it's - * better to use a service config that's slightly out of date than to - * revert to an effectively blank one. */ - this.latestLookupResult = null; - const hostname: string = this.dnsHostname; - /* We lookup both address families here and then split them up later - * because when looking up a single family, dns.lookup outputs an error - * if the name exists but there are no records for that family, and that - * error is indistinguishable from other kinds of errors */ - this.pendingLookupPromise = dnsLookupPromise(hostname, { all: true }); - this.pendingLookupPromise.then( - (addressList) => { - this.pendingLookupPromise = null; - const ip4Addresses: dns.LookupAddress[] = addressList.filter( - (addr) => addr.family === 4 - ); - const ip6Addresses: dns.LookupAddress[] = addressList.filter( - (addr) => addr.family === 6 - ); - this.latestLookupResult = mergeArrays( - ip6Addresses, - ip4Addresses - ).map((addr) => ({ host: addr.address, port: +this.port! })); - const allAddressesString: string = - '[' + - this.latestLookupResult - .map((addr) => addr.host + ':' + addr.port) - .join(',') + - ']'; - trace( - 'Resolved addresses for target ' + - uriToString(this.target) + - ': ' + - allAddressesString - ); - if (this.latestLookupResult.length === 0) { - this.listener.onError(this.defaultResolutionError); - return; - } - /* If the TXT lookup has not yet finished, both of the last two - * arguments will be null, which is the equivalent of getting an - * empty TXT response. When the TXT lookup does finish, its handler - * can update the service config by using the same address list */ - this.listener.onSuccessfulResolution( - this.latestLookupResult, - this.latestServiceConfig, - this.latestServiceConfigError, - {} - ); - }, - (err) => { - trace( - 'Resolution error for target ' + - uriToString(this.target) + - ': ' + - (err as Error).message - ); - this.pendingLookupPromise = null; - this.listener.onError(this.defaultResolutionError); - } - ); - /* If there already is a still-pending TXT resolution, we can just use - * that result when it comes in */ - if (this.pendingTxtPromise === null) { - /* We handle the TXT query promise differently than the others because - * the name resolution attempt as a whole is a success even if the TXT - * lookup fails */ - this.pendingTxtPromise = resolveTxtPromise(hostname); - this.pendingTxtPromise.then( - (txtRecord) => { - this.pendingTxtPromise = null; - try { - this.latestServiceConfig = extractAndSelectServiceConfig( - txtRecord, - this.percentage - ); - } catch (err) { - this.latestServiceConfigError = { - code: Status.UNAVAILABLE, - details: 'Parsing service config failed', - metadata: new Metadata(), - }; - } - if (this.latestLookupResult !== null) { - /* We rely here on the assumption that calling this function with - * identical parameters will be essentialy idempotent, and calling - * it with the same address list and a different service config - * should result in a fast and seamless switchover. */ - this.listener.onSuccessfulResolution( - this.latestLookupResult, - this.latestServiceConfig, - this.latestServiceConfigError, - {} - ); - } - }, - (err) => { - /* If TXT lookup fails we should do nothing, which means that we - * continue to use the result of the most recent successful lookup, - * or the default null config object if there has never been a - * successful lookup. We do not set the latestServiceConfigError - * here because that is specifically used for response validation - * errors. We still need to handle this error so that it does not - * bubble up as an unhandled promise rejection. */ - } - ); - } - } - } - - updateResolution() { - trace('Resolution update requested for target ' + uriToString(this.target)); - if (this.pendingLookupPromise === null) { - this.startResolution(); - } - } - - /** - * Get the default authority for the given target. For IP targets, that is - * the IP address. For DNS targets, it is the hostname. - * @param target - */ - static getDefaultAuthority(target: GrpcUri): string { - return target.path; - } -} - -/** - * Set up the DNS resolver class by registering it as the handler for the - * "dns:" prefix and as the default resolver. - */ -export function setup(): void { - registerResolver('dns', DnsResolver); - registerDefaultScheme('dns'); -} - -export interface DnsUrl { - host: string; - port?: string; -} diff --git a/node_modules/@grpc/grpc-js/src/resolver-uds.ts b/node_modules/@grpc/grpc-js/src/resolver-uds.ts deleted file mode 100644 index 14bc0176..00000000 --- a/node_modules/@grpc/grpc-js/src/resolver-uds.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Resolver, ResolverListener, registerResolver } from './resolver'; -import { SubchannelAddress } from './subchannel'; -import { GrpcUri } from './uri-parser'; -import { ChannelOptions } from './channel-options'; - -class UdsResolver implements Resolver { - private addresses: SubchannelAddress[] = []; - constructor( - target: GrpcUri, - private listener: ResolverListener, - channelOptions: ChannelOptions - ) { - let path: string; - if (target.authority === '') { - path = '/' + target.path; - } else { - path = target.path; - } - this.addresses = [{ path }]; - } - updateResolution(): void { - process.nextTick( - this.listener.onSuccessfulResolution, - this.addresses, - null, - null, - {} - ); - } - - static getDefaultAuthority(target: GrpcUri): string { - return 'localhost'; - } -} - -export function setup() { - registerResolver('unix', UdsResolver); -} diff --git a/node_modules/@grpc/grpc-js/src/resolver.ts b/node_modules/@grpc/grpc-js/src/resolver.ts deleted file mode 100644 index 57c750ae..00000000 --- a/node_modules/@grpc/grpc-js/src/resolver.ts +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { ServiceConfig } from './service-config'; -import * as resolver_dns from './resolver-dns'; -import * as resolver_uds from './resolver-uds'; -import { StatusObject } from './call-stream'; -import { SubchannelAddress } from './subchannel'; -import { GrpcUri, uriToString } from './uri-parser'; -import { ChannelOptions } from './channel-options'; - -/** - * A listener object passed to the resolver's constructor that provides name - * resolution updates back to the resolver's owner. - */ -export interface ResolverListener { - /** - * Called whenever the resolver has new name resolution results to report - * @param addressList The new list of backend addresses - * @param serviceConfig The new service configuration corresponding to the - * `addressList`. Will be `null` if no service configuration was - * retrieved or if the service configuration was invalid - * @param serviceConfigError If non-`null`, indicates that the retrieved - * service configuration was invalid - */ - onSuccessfulResolution( - addressList: SubchannelAddress[], - serviceConfig: ServiceConfig | null, - serviceConfigError: StatusObject | null, - attributes: { [key: string]: unknown } - ): void; - /** - * Called whenever a name resolution attempt fails. - * @param error Describes how resolution failed - */ - onError(error: StatusObject): void; -} - -/** - * A resolver class that handles one or more of the name syntax schemes defined - * in the [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md) - */ -export interface Resolver { - /** - * Indicates that the caller wants new name resolution data. Calling this - * function may eventually result in calling one of the `ResolverListener` - * functions, but that is not guaranteed. Those functions will never be - * called synchronously with the constructor or updateResolution. - */ - updateResolution(): void; -} - -export interface ResolverConstructor { - new ( - target: GrpcUri, - listener: ResolverListener, - channelOptions: ChannelOptions - ): Resolver; - /** - * Get the default authority for a target. This loosely corresponds to that - * target's hostname. Throws an error if this resolver class cannot parse the - * `target`. - * @param target - */ - getDefaultAuthority(target: GrpcUri): string; -} - -const registeredResolvers: { [scheme: string]: ResolverConstructor } = {}; -let defaultScheme: string | null = null; - -/** - * Register a resolver class to handle target names prefixed with the `prefix` - * string. This prefix should correspond to a URI scheme name listed in the - * [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md) - * @param prefix - * @param resolverClass - */ -export function registerResolver( - scheme: string, - resolverClass: ResolverConstructor -) { - registeredResolvers[scheme] = resolverClass; -} - -/** - * Register a default resolver to handle target names that do not start with - * any registered prefix. - * @param resolverClass - */ -export function registerDefaultScheme(scheme: string) { - defaultScheme = scheme; -} - -/** - * Create a name resolver for the specified target, if possible. Throws an - * error if no such name resolver can be created. - * @param target - * @param listener - */ -export function createResolver( - target: GrpcUri, - listener: ResolverListener, - options: ChannelOptions -): Resolver { - if (target.scheme !== undefined && target.scheme in registeredResolvers) { - return new registeredResolvers[target.scheme](target, listener, options); - } else { - throw new Error( - `No resolver could be created for target ${uriToString(target)}` - ); - } -} - -/** - * Get the default authority for the specified target, if possible. Throws an - * error if no registered name resolver can parse that target string. - * @param target - */ -export function getDefaultAuthority(target: GrpcUri): string { - if (target.scheme !== undefined && target.scheme in registeredResolvers) { - return registeredResolvers[target.scheme].getDefaultAuthority(target); - } else { - throw new Error(`Invalid target ${uriToString(target)}`); - } -} - -export function mapUriDefaultScheme(target: GrpcUri): GrpcUri | null { - if (target.scheme === undefined || !(target.scheme in registeredResolvers)) { - if (defaultScheme !== null) { - return { - scheme: defaultScheme, - authority: undefined, - path: uriToString(target), - }; - } else { - return null; - } - } - return target; -} - -export function registerAll() { - resolver_dns.setup(); - resolver_uds.setup(); -} diff --git a/node_modules/@grpc/grpc-js/src/resolving-load-balancer.ts b/node_modules/@grpc/grpc-js/src/resolving-load-balancer.ts deleted file mode 100644 index 2ce59d0c..00000000 --- a/node_modules/@grpc/grpc-js/src/resolving-load-balancer.ts +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { - ChannelControlHelper, - LoadBalancer, - getFirstUsableConfig, - LoadBalancingConfig -} from './load-balancer'; -import { ServiceConfig, validateServiceConfig } from './service-config'; -import { ConnectivityState } from './channel'; -import { createResolver, Resolver } from './resolver'; -import { ServiceError } from './call'; -import { Picker, UnavailablePicker, QueuePicker } from './picker'; -import { BackoffTimeout } from './backoff-timeout'; -import { Status } from './constants'; -import { StatusObject } from './call-stream'; -import { Metadata } from './metadata'; -import * as logging from './logging'; -import { LogVerbosity } from './constants'; -import { SubchannelAddress } from './subchannel'; -import { GrpcUri, uriToString } from './uri-parser'; -import { ChildLoadBalancerHandler } from './load-balancer-child-handler'; -import { ChannelOptions } from './channel-options'; -import { PickFirstLoadBalancingConfig } from './load-balancer-pick-first'; - -const TRACER_NAME = 'resolving_load_balancer'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -const DEFAULT_LOAD_BALANCER_NAME = 'pick_first'; - -export class ResolvingLoadBalancer implements LoadBalancer { - /** - * The resolver class constructed for the target address. - */ - private innerResolver: Resolver; - - private childLoadBalancer: ChildLoadBalancerHandler; - private latestChildState: ConnectivityState = ConnectivityState.IDLE; - private latestChildPicker: Picker = new QueuePicker(this); - /** - * This resolving load balancer's current connectivity state. - */ - private currentState: ConnectivityState = ConnectivityState.IDLE; - private readonly defaultServiceConfig: ServiceConfig; - /** - * The service config object from the last successful resolution, if - * available. A value of null indicates that we have not yet received a valid - * service config from the resolver. - */ - private previousServiceConfig: ServiceConfig | null = null; - - /** - * The backoff timer for handling name resolution failures. - */ - private readonly backoffTimeout: BackoffTimeout; - - /** - * Indicates whether we should attempt to resolve again after the backoff - * timer runs out. - */ - private continueResolving = false; - - /** - * Wrapper class that behaves like a `LoadBalancer` and also handles name - * resolution internally. - * @param target The address of the backend to connect to. - * @param channelControlHelper `ChannelControlHelper` instance provided by - * this load balancer's owner. - * @param defaultServiceConfig The default service configuration to be used - * if none is provided by the name resolver. A `null` value indicates - * that the default behavior should be the default unconfigured behavior. - * In practice, that means using the "pick first" load balancer - * implmentation - */ - constructor( - private readonly target: GrpcUri, - private readonly channelControlHelper: ChannelControlHelper, - private readonly channelOptions: ChannelOptions - ) { - if (channelOptions['grpc.service_config']) { - this.defaultServiceConfig = validateServiceConfig( - JSON.parse(channelOptions['grpc.service_config']!) - ); - } else { - this.defaultServiceConfig = { - loadBalancingConfig: [], - methodConfig: [], - }; - } - this.updateState(ConnectivityState.IDLE, new QueuePicker(this)); - this.childLoadBalancer = new ChildLoadBalancerHandler({ - createSubchannel: channelControlHelper.createSubchannel.bind( - channelControlHelper - ), - requestReresolution: () => { - /* If the backoffTimeout is running, we're still backing off from - * making resolve requests, so we shouldn't make another one here. - * In that case, the backoff timer callback will call - * updateResolution */ - if (this.backoffTimeout.isRunning()) { - this.continueResolving = true; - } else { - this.updateResolution(); - } - }, - updateState: (newState: ConnectivityState, picker: Picker) => { - this.latestChildState = newState; - this.latestChildPicker = picker; - this.updateState(newState, picker); - }, - }); - this.innerResolver = createResolver( - target, - { - onSuccessfulResolution: ( - addressList: SubchannelAddress[], - serviceConfig: ServiceConfig | null, - serviceConfigError: ServiceError | null, - attributes: { [key: string]: unknown } - ) => { - let workingServiceConfig: ServiceConfig | null = null; - /* This first group of conditionals implements the algorithm described - * in https://github.com/grpc/proposal/blob/master/A21-service-config-error-handling.md - * in the section called "Behavior on receiving a new gRPC Config". - */ - if (serviceConfig === null) { - // Step 4 and 5 - if (serviceConfigError === null) { - // Step 5 - this.previousServiceConfig = null; - workingServiceConfig = this.defaultServiceConfig; - } else { - // Step 4 - if (this.previousServiceConfig === null) { - // Step 4.ii - this.handleResolutionFailure(serviceConfigError); - } else { - // Step 4.i - workingServiceConfig = this.previousServiceConfig; - } - } - } else { - // Step 3 - workingServiceConfig = serviceConfig; - this.previousServiceConfig = serviceConfig; - } - const workingConfigList = - workingServiceConfig?.loadBalancingConfig ?? []; - const loadBalancingConfig = getFirstUsableConfig(workingConfigList, true); - if (loadBalancingConfig === null) { - // There were load balancing configs but none are supported. This counts as a resolution failure - this.handleResolutionFailure({ - code: Status.UNAVAILABLE, - details: - 'All load balancer options in service config are not compatible', - metadata: new Metadata(), - }); - return; - } - this.childLoadBalancer.updateAddressList( - addressList, - loadBalancingConfig, - attributes - ); - }, - onError: (error: StatusObject) => { - this.handleResolutionFailure(error); - }, - }, - channelOptions - ); - - this.backoffTimeout = new BackoffTimeout(() => { - if (this.continueResolving) { - this.updateResolution(); - this.continueResolving = false; - } else { - this.updateState(this.latestChildState, this.latestChildPicker); - } - }); - } - - private updateResolution() { - this.innerResolver.updateResolution(); - if (this.currentState === ConnectivityState.IDLE) { - this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this)); - } - } - - private updateState(connectivityState: ConnectivityState, picker: Picker) { - trace( - uriToString(this.target) + - ' ' + - ConnectivityState[this.currentState] + - ' -> ' + - ConnectivityState[connectivityState] - ); - // Ensure that this.exitIdle() is called by the picker - if (connectivityState === ConnectivityState.IDLE) { - picker = new QueuePicker(this); - } - this.currentState = connectivityState; - this.channelControlHelper.updateState(connectivityState, picker); - } - - private handleResolutionFailure(error: StatusObject) { - if (this.latestChildState === ConnectivityState.IDLE) { - this.updateState( - ConnectivityState.TRANSIENT_FAILURE, - new UnavailablePicker(error) - ); - } - this.backoffTimeout.runOnce(); - } - - exitIdle() { - this.childLoadBalancer.exitIdle(); - if (this.currentState === ConnectivityState.IDLE) { - if (this.backoffTimeout.isRunning()) { - this.continueResolving = true; - } else { - this.updateResolution(); - } - this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this)); - } - } - - updateAddressList( - addressList: SubchannelAddress[], - lbConfig: LoadBalancingConfig | null - ) { - throw new Error('updateAddressList not supported on ResolvingLoadBalancer'); - } - - resetBackoff() { - this.backoffTimeout.reset(); - this.childLoadBalancer.resetBackoff(); - } - - destroy() { - this.childLoadBalancer.destroy(); - this.updateState(ConnectivityState.SHUTDOWN, new UnavailablePicker()); - } - - getTypeName() { - return 'resolving_load_balancer'; - } -} diff --git a/node_modules/@grpc/grpc-js/src/server-call.ts b/node_modules/@grpc/grpc-js/src/server-call.ts deleted file mode 100644 index aa8bd647..00000000 --- a/node_modules/@grpc/grpc-js/src/server-call.ts +++ /dev/null @@ -1,818 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { EventEmitter } from 'events'; -import * as http2 from 'http2'; -import { Duplex, Readable, Writable } from 'stream'; - -import { Deadline, StatusObject } from './call-stream'; -import { - Status, - DEFAULT_MAX_SEND_MESSAGE_LENGTH, - DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH, - LogVerbosity, -} from './constants'; -import { Deserialize, Serialize } from './make-client'; -import { Metadata } from './metadata'; -import { StreamDecoder } from './stream-decoder'; -import { ObjectReadable, ObjectWritable } from './object-stream'; -import { ChannelOptions } from './channel-options'; -import * as logging from './logging'; - -const TRACER_NAME = 'server_call'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -interface DeadlineUnitIndexSignature { - [name: string]: number; -} - -const GRPC_ACCEPT_ENCODING_HEADER = 'grpc-accept-encoding'; -const GRPC_ENCODING_HEADER = 'grpc-encoding'; -const GRPC_MESSAGE_HEADER = 'grpc-message'; -const GRPC_STATUS_HEADER = 'grpc-status'; -const GRPC_TIMEOUT_HEADER = 'grpc-timeout'; -const DEADLINE_REGEX = /(\d{1,8})\s*([HMSmun])/; -const deadlineUnitsToMs: DeadlineUnitIndexSignature = { - H: 3600000, - M: 60000, - S: 1000, - m: 1, - u: 0.001, - n: 0.000001, -}; -const defaultResponseHeaders = { - // TODO(cjihrig): Remove these encoding headers from the default response - // once compression is integrated. - [GRPC_ACCEPT_ENCODING_HEADER]: 'identity', - [GRPC_ENCODING_HEADER]: 'identity', - [http2.constants.HTTP2_HEADER_STATUS]: http2.constants.HTTP_STATUS_OK, - [http2.constants.HTTP2_HEADER_CONTENT_TYPE]: 'application/grpc+proto', -}; -const defaultResponseOptions = { - waitForTrailers: true, -} as http2.ServerStreamResponseOptions; - -export type ServerStatusResponse = Partial; - -export type ServerErrorResponse = ServerStatusResponse & Error; - -export type ServerSurfaceCall = { - cancelled: boolean; - readonly metadata: Metadata; - getPeer(): string; - sendMetadata(responseMetadata: Metadata): void; - getDeadline(): Deadline; -} & EventEmitter; - -export type ServerUnaryCall = ServerSurfaceCall & { - request: RequestType; -}; -export type ServerReadableStream< - RequestType, - ResponseType -> = ServerSurfaceCall & ObjectReadable; -export type ServerWritableStream< - RequestType, - ResponseType -> = ServerSurfaceCall & - ObjectWritable & { - request: RequestType; - end: (metadata?: Metadata) => void; - }; -export type ServerDuplexStream = ServerSurfaceCall & - ObjectReadable & - ObjectWritable & { end: (metadata?: Metadata) => void }; - -export class ServerUnaryCallImpl extends EventEmitter - implements ServerUnaryCall { - cancelled: boolean; - - constructor( - private call: Http2ServerCallStream, - public metadata: Metadata, - public request: RequestType - ) { - super(); - this.cancelled = false; - this.call.setupSurfaceCall(this); - } - - getPeer(): string { - return this.call.getPeer(); - } - - sendMetadata(responseMetadata: Metadata): void { - this.call.sendMetadata(responseMetadata); - } - - getDeadline(): Deadline { - return this.call.getDeadline(); - } -} - -export class ServerReadableStreamImpl - extends Readable - implements ServerReadableStream { - cancelled: boolean; - - constructor( - private call: Http2ServerCallStream, - public metadata: Metadata, - public deserialize: Deserialize - ) { - super({ objectMode: true }); - this.cancelled = false; - this.call.setupSurfaceCall(this); - this.call.setupReadable(this); - } - - _read(size: number) { - if (!this.call.consumeUnpushedMessages(this)) { - return; - } - - this.call.resume(); - } - - getPeer(): string { - return this.call.getPeer(); - } - - sendMetadata(responseMetadata: Metadata): void { - this.call.sendMetadata(responseMetadata); - } - - getDeadline(): Deadline { - return this.call.getDeadline(); - } -} - -export class ServerWritableStreamImpl - extends Writable - implements ServerWritableStream { - cancelled: boolean; - private trailingMetadata: Metadata; - - constructor( - private call: Http2ServerCallStream, - public metadata: Metadata, - public serialize: Serialize, - public request: RequestType - ) { - super({ objectMode: true }); - this.cancelled = false; - this.trailingMetadata = new Metadata(); - this.call.setupSurfaceCall(this); - - this.on('error', (err) => { - this.call.sendError(err); - this.end(); - }); - } - - getPeer(): string { - return this.call.getPeer(); - } - - sendMetadata(responseMetadata: Metadata): void { - this.call.sendMetadata(responseMetadata); - } - - getDeadline(): Deadline { - return this.call.getDeadline(); - } - - _write( - chunk: ResponseType, - encoding: string, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - callback: (...args: any[]) => void - ) { - try { - const response = this.call.serializeMessage(chunk); - - if (!this.call.write(response)) { - this.call.once('drain', callback); - return; - } - } catch (err) { - err.code = Status.INTERNAL; - this.emit('error', err); - } - - callback(); - } - - _final(callback: Function): void { - this.call.sendStatus({ - code: Status.OK, - details: 'OK', - metadata: this.trailingMetadata, - }); - callback(null); - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - end(metadata?: any) { - if (metadata) { - this.trailingMetadata = metadata; - } - - super.end(); - } -} - -export class ServerDuplexStreamImpl extends Duplex - implements ServerDuplexStream { - cancelled: boolean; - private trailingMetadata: Metadata; - - constructor( - private call: Http2ServerCallStream, - public metadata: Metadata, - public serialize: Serialize, - public deserialize: Deserialize - ) { - super({ objectMode: true }); - this.cancelled = false; - this.trailingMetadata = new Metadata(); - this.call.setupSurfaceCall(this); - this.call.setupReadable(this); - - this.on('error', (err) => { - this.call.sendError(err); - this.end(); - }); - } - - getPeer(): string { - return this.call.getPeer(); - } - - sendMetadata(responseMetadata: Metadata): void { - this.call.sendMetadata(responseMetadata); - } - - getDeadline(): Deadline { - return this.call.getDeadline(); - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - end(metadata?: any) { - if (metadata) { - this.trailingMetadata = metadata; - } - - super.end(); - } -} - -ServerDuplexStreamImpl.prototype._read = - ServerReadableStreamImpl.prototype._read; -ServerDuplexStreamImpl.prototype._write = - ServerWritableStreamImpl.prototype._write; -ServerDuplexStreamImpl.prototype._final = - ServerWritableStreamImpl.prototype._final; -ServerDuplexStreamImpl.prototype.end = ServerWritableStreamImpl.prototype.end; - -// Unary response callback signature. -export type sendUnaryData = ( - error: ServerErrorResponse | ServerStatusResponse | null, - value?: ResponseType | null, - trailer?: Metadata, - flags?: number -) => void; - -// User provided handler for unary calls. -export type handleUnaryCall = ( - call: ServerUnaryCall, - callback: sendUnaryData -) => void; - -// User provided handler for client streaming calls. -export type handleClientStreamingCall = ( - call: ServerReadableStream, - callback: sendUnaryData -) => void; - -// User provided handler for server streaming calls. -export type handleServerStreamingCall = ( - call: ServerWritableStream -) => void; - -// User provided handler for bidirectional streaming calls. -export type handleBidiStreamingCall = ( - call: ServerDuplexStream -) => void; - -export type HandleCall = - | handleUnaryCall - | handleClientStreamingCall - | handleServerStreamingCall - | handleBidiStreamingCall; - -export interface UnaryHandler { - func: handleUnaryCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} - -export interface ClientStreamingHandler { - func: handleClientStreamingCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} - -export interface ServerStreamingHandler { - func: handleServerStreamingCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} - -export interface BidiStreamingHandler { - func: handleBidiStreamingCall; - serialize: Serialize; - deserialize: Deserialize; - type: HandlerType; - path: string; -} - -export type Handler = - | UnaryHandler - | ClientStreamingHandler - | ServerStreamingHandler - | BidiStreamingHandler; - -export type HandlerType = 'bidi' | 'clientStream' | 'serverStream' | 'unary'; - -// Internal class that wraps the HTTP2 request. -export class Http2ServerCallStream< - RequestType, - ResponseType -> extends EventEmitter { - cancelled = false; - deadlineTimer: NodeJS.Timer = setTimeout(() => {}, 0); - private deadline: Deadline = Infinity; - private wantTrailers = false; - private metadataSent = false; - private canPush = false; - private isPushPending = false; - private bufferedMessages: Array = []; - private messagesToPush: Array = []; - private maxSendMessageSize: number = DEFAULT_MAX_SEND_MESSAGE_LENGTH; - private maxReceiveMessageSize: number = DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH; - - constructor( - private stream: http2.ServerHttp2Stream, - private handler: Handler, - private options: ChannelOptions - ) { - super(); - - this.stream.once('error', (err: ServerErrorResponse) => { - /* We need an error handler to avoid uncaught error event exceptions, but - * there is nothing we can reasonably do here. Any error event should - * have a corresponding close event, which handles emitting the cancelled - * event. And the stream is now in a bad state, so we can't reasonably - * expect to be able to send an error over it. */ - }); - - this.stream.once('close', () => { - trace( - 'Request to method ' + - this.handler?.path + - ' stream closed with rstCode ' + - this.stream.rstCode - ); - this.cancelled = true; - this.emit('cancelled', 'cancelled'); - }); - - this.stream.on('drain', () => { - this.emit('drain'); - }); - - if ('grpc.max_send_message_length' in options) { - this.maxSendMessageSize = options['grpc.max_send_message_length']!; - } - if ('grpc.max_receive_message_length' in options) { - this.maxReceiveMessageSize = options['grpc.max_receive_message_length']!; - } - - // Clear noop timer - clearTimeout(this.deadlineTimer); - } - - private checkCancelled(): boolean { - /* In some cases the stream can become destroyed before the close event - * fires. That creates a race condition that this check works around */ - if (this.stream.destroyed) { - this.cancelled = true; - } - return this.cancelled; - } - - sendMetadata(customMetadata?: Metadata) { - if (this.checkCancelled()) { - return; - } - - if (this.metadataSent) { - return; - } - - this.metadataSent = true; - const custom = customMetadata ? customMetadata.toHttp2Headers() : null; - // TODO(cjihrig): Include compression headers. - const headers = Object.assign({}, defaultResponseHeaders, custom); - this.stream.respond(headers, defaultResponseOptions); - } - - receiveMetadata(headers: http2.IncomingHttpHeaders) { - const metadata = Metadata.fromHttp2Headers(headers); - - // TODO(cjihrig): Receive compression metadata. - - const timeoutHeader = metadata.get(GRPC_TIMEOUT_HEADER); - - if (timeoutHeader.length > 0) { - const match = timeoutHeader[0].toString().match(DEADLINE_REGEX); - - if (match === null) { - const err = new Error('Invalid deadline') as ServerErrorResponse; - err.code = Status.OUT_OF_RANGE; - this.sendError(err); - return; - } - - const timeout = (+match[1] * deadlineUnitsToMs[match[2]]) | 0; - - const now = new Date(); - this.deadline = now.setMilliseconds(now.getMilliseconds() + timeout); - this.deadlineTimer = setTimeout(handleExpiredDeadline, timeout, this); - metadata.remove(GRPC_TIMEOUT_HEADER); - } - - // Remove several headers that should not be propagated to the application - metadata.remove(http2.constants.HTTP2_HEADER_ACCEPT_ENCODING); - metadata.remove(http2.constants.HTTP2_HEADER_TE); - metadata.remove(http2.constants.HTTP2_HEADER_CONTENT_TYPE); - metadata.remove('grpc-encoding'); - metadata.remove('grpc-accept-encoding'); - - return metadata; - } - - receiveUnaryMessage(): Promise { - return new Promise((resolve, reject) => { - const stream = this.stream; - const chunks: Buffer[] = []; - let totalLength = 0; - - stream.on('data', (data: Buffer) => { - chunks.push(data); - totalLength += data.byteLength; - }); - - stream.once('end', async () => { - try { - const requestBytes = Buffer.concat(chunks, totalLength); - if ( - this.maxReceiveMessageSize !== -1 && - requestBytes.length > this.maxReceiveMessageSize - ) { - this.sendError({ - code: Status.RESOURCE_EXHAUSTED, - details: `Received message larger than max (${requestBytes.length} vs. ${this.maxReceiveMessageSize})`, - }); - resolve(); - } - - resolve(this.deserializeMessage(requestBytes)); - } catch (err) { - err.code = Status.INTERNAL; - this.sendError(err); - resolve(); - } - }); - }); - } - - serializeMessage(value: ResponseType) { - const messageBuffer = this.handler.serialize(value); - - // TODO(cjihrig): Call compression aware serializeMessage(). - const byteLength = messageBuffer.byteLength; - const output = Buffer.allocUnsafe(byteLength + 5); - output.writeUInt8(0, 0); - output.writeUInt32BE(byteLength, 1); - messageBuffer.copy(output, 5); - return output; - } - - deserializeMessage(bytes: Buffer) { - // TODO(cjihrig): Call compression aware deserializeMessage(). - const receivedMessage = bytes.slice(5); - - return this.handler.deserialize(receivedMessage); - } - - async sendUnaryMessage( - err: ServerErrorResponse | ServerStatusResponse | null, - value?: ResponseType | null, - metadata?: Metadata, - flags?: number - ) { - if (this.checkCancelled()) { - return; - } - if (!metadata) { - metadata = new Metadata(); - } - - if (err) { - if (!Object.prototype.hasOwnProperty.call(err, 'metadata')) { - err.metadata = metadata; - } - this.sendError(err); - return; - } - - try { - const response = this.serializeMessage(value!); - - this.write(response); - this.sendStatus({ code: Status.OK, details: 'OK', metadata }); - } catch (err) { - err.code = Status.INTERNAL; - this.sendError(err); - } - } - - sendStatus(statusObj: StatusObject) { - if (this.checkCancelled()) { - return; - } - - trace( - 'Request to method ' + - this.handler?.path + - ' ended with status code: ' + - Status[statusObj.code] + - ' details: ' + - statusObj.details - ); - - clearTimeout(this.deadlineTimer); - - if (!this.wantTrailers) { - this.wantTrailers = true; - this.stream.once('wantTrailers', () => { - const trailersToSend = Object.assign( - { - [GRPC_STATUS_HEADER]: statusObj.code, - [GRPC_MESSAGE_HEADER]: encodeURI(statusObj.details as string), - }, - statusObj.metadata.toHttp2Headers() - ); - - this.stream.sendTrailers(trailersToSend); - }); - this.sendMetadata(); - this.stream.end(); - } - } - - sendError(error: ServerErrorResponse | ServerStatusResponse) { - if (this.checkCancelled()) { - return; - } - const status: StatusObject = { - code: Status.UNKNOWN, - details: 'message' in error ? error.message : 'Unknown Error', - metadata: - 'metadata' in error && error.metadata !== undefined - ? error.metadata - : new Metadata(), - }; - - if ( - 'code' in error && - typeof error.code === 'number' && - Number.isInteger(error.code) - ) { - status.code = error.code; - - if ('details' in error && typeof error.details === 'string') { - status.details = error.details!; - } - } - - this.sendStatus(status); - } - - write(chunk: Buffer) { - if (this.checkCancelled()) { - return; - } - - if ( - this.maxSendMessageSize !== -1 && - chunk.length > this.maxSendMessageSize - ) { - this.sendError({ - code: Status.RESOURCE_EXHAUSTED, - details: `Sent message larger than max (${chunk.length} vs. ${this.maxSendMessageSize})`, - }); - return; - } - - this.sendMetadata(); - return this.stream.write(chunk); - } - - resume() { - this.stream.resume(); - } - - setupSurfaceCall(call: ServerSurfaceCall) { - this.once('cancelled', (reason) => { - call.cancelled = true; - call.emit('cancelled', reason); - }); - } - - setupReadable( - readable: - | ServerReadableStream - | ServerDuplexStream - ) { - const decoder = new StreamDecoder(); - - this.stream.on('data', async (data: Buffer) => { - const messages = decoder.write(data); - - for (const message of messages) { - if ( - this.maxReceiveMessageSize !== -1 && - message.length > this.maxReceiveMessageSize - ) { - this.sendError({ - code: Status.RESOURCE_EXHAUSTED, - details: `Received message larger than max (${message.length} vs. ${this.maxReceiveMessageSize})`, - }); - return; - } - this.pushOrBufferMessage(readable, message); - } - }); - - this.stream.once('end', () => { - this.pushOrBufferMessage(readable, null); - }); - } - - consumeUnpushedMessages( - readable: - | ServerReadableStream - | ServerDuplexStream - ): boolean { - this.canPush = true; - - while (this.messagesToPush.length > 0) { - const nextMessage = this.messagesToPush.shift(); - const canPush = readable.push(nextMessage); - - if (nextMessage === null || canPush === false) { - this.canPush = false; - break; - } - } - - return this.canPush; - } - - private pushOrBufferMessage( - readable: - | ServerReadableStream - | ServerDuplexStream, - messageBytes: Buffer | null - ): void { - if (this.isPushPending) { - this.bufferedMessages.push(messageBytes); - } else { - this.pushMessage(readable, messageBytes); - } - } - - private async pushMessage( - readable: - | ServerReadableStream - | ServerDuplexStream, - messageBytes: Buffer | null - ) { - if (messageBytes === null) { - if (this.canPush) { - readable.push(null); - } else { - this.messagesToPush.push(null); - } - - return; - } - - this.isPushPending = true; - - try { - const deserialized = await this.deserializeMessage(messageBytes); - - if (this.canPush) { - if (!readable.push(deserialized)) { - this.canPush = false; - this.stream.pause(); - } - } else { - this.messagesToPush.push(deserialized); - } - } catch (error) { - // Ignore any remaining messages when errors occur. - this.bufferedMessages.length = 0; - - if ( - !( - 'code' in error && - typeof error.code === 'number' && - Number.isInteger(error.code) && - error.code >= Status.OK && - error.code <= Status.UNAUTHENTICATED - ) - ) { - // The error code is not a valid gRPC code so its being overwritten. - error.code = Status.INTERNAL; - } - - readable.emit('error', error); - } - - this.isPushPending = false; - - if (this.bufferedMessages.length > 0) { - this.pushMessage( - readable, - this.bufferedMessages.shift() as Buffer | null - ); - } - } - - getPeer(): string { - const socket = this.stream.session.socket; - if (socket.remoteAddress) { - if (socket.remotePort) { - return `${socket.remoteAddress}:${socket.remotePort}`; - } else { - return socket.remoteAddress; - } - } else { - return 'unknown'; - } - } - - getDeadline(): Deadline { - return this.deadline; - } -} - -/* eslint-disable @typescript-eslint/no-explicit-any */ -type UntypedServerCall = Http2ServerCallStream; - -function handleExpiredDeadline(call: UntypedServerCall) { - const err = new Error('Deadline exceeded') as ServerErrorResponse; - err.code = Status.DEADLINE_EXCEEDED; - - call.sendError(err); - call.cancelled = true; - call.emit('cancelled', 'deadline'); -} diff --git a/node_modules/@grpc/grpc-js/src/server-credentials.ts b/node_modules/@grpc/grpc-js/src/server-credentials.ts deleted file mode 100644 index 17ab2980..00000000 --- a/node_modules/@grpc/grpc-js/src/server-credentials.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { SecureServerOptions } from 'http2'; -import { CIPHER_SUITES, getDefaultRootsData } from './tls-helpers'; - -export interface KeyCertPair { - private_key: Buffer; - cert_chain: Buffer; -} - -export abstract class ServerCredentials { - abstract _isSecure(): boolean; - abstract _getSettings(): SecureServerOptions | null; - - static createInsecure(): ServerCredentials { - return new InsecureServerCredentials(); - } - - static createSsl( - rootCerts: Buffer | null, - keyCertPairs: KeyCertPair[], - checkClientCertificate = false - ): ServerCredentials { - if (rootCerts !== null && !Buffer.isBuffer(rootCerts)) { - throw new TypeError('rootCerts must be null or a Buffer'); - } - - if (!Array.isArray(keyCertPairs)) { - throw new TypeError('keyCertPairs must be an array'); - } - - if (typeof checkClientCertificate !== 'boolean') { - throw new TypeError('checkClientCertificate must be a boolean'); - } - - const cert = []; - const key = []; - - for (let i = 0; i < keyCertPairs.length; i++) { - const pair = keyCertPairs[i]; - - if (pair === null || typeof pair !== 'object') { - throw new TypeError(`keyCertPair[${i}] must be an object`); - } - - if (!Buffer.isBuffer(pair.private_key)) { - throw new TypeError(`keyCertPair[${i}].private_key must be a Buffer`); - } - - if (!Buffer.isBuffer(pair.cert_chain)) { - throw new TypeError(`keyCertPair[${i}].cert_chain must be a Buffer`); - } - - cert.push(pair.cert_chain); - key.push(pair.private_key); - } - - return new SecureServerCredentials({ - ca: rootCerts || getDefaultRootsData() || undefined, - cert, - key, - requestCert: checkClientCertificate, - ciphers: CIPHER_SUITES, - }); - } -} - -class InsecureServerCredentials extends ServerCredentials { - _isSecure(): boolean { - return false; - } - - _getSettings(): null { - return null; - } -} - -class SecureServerCredentials extends ServerCredentials { - private options: SecureServerOptions; - - constructor(options: SecureServerOptions) { - super(); - this.options = options; - } - - _isSecure(): boolean { - return true; - } - - _getSettings(): SecureServerOptions { - return this.options; - } -} diff --git a/node_modules/@grpc/grpc-js/src/server.ts b/node_modules/@grpc/grpc-js/src/server.ts deleted file mode 100644 index 335a11fc..00000000 --- a/node_modules/@grpc/grpc-js/src/server.ts +++ /dev/null @@ -1,744 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import * as http2 from 'http2'; -import { AddressInfo } from 'net'; - -import { ServiceError } from './call'; -import { Status, LogVerbosity } from './constants'; -import { Deserialize, Serialize, ServiceDefinition } from './make-client'; -import { Metadata } from './metadata'; -import { - BidiStreamingHandler, - ClientStreamingHandler, - HandleCall, - Handler, - HandlerType, - Http2ServerCallStream, - sendUnaryData, - ServerDuplexStream, - ServerDuplexStreamImpl, - ServerReadableStream, - ServerReadableStreamImpl, - ServerStreamingHandler, - ServerUnaryCall, - ServerUnaryCallImpl, - ServerWritableStream, - ServerWritableStreamImpl, - UnaryHandler, - ServerErrorResponse, - ServerStatusResponse, -} from './server-call'; -import { ServerCredentials } from './server-credentials'; -import { ChannelOptions } from './channel-options'; -import { - createResolver, - ResolverListener, - mapUriDefaultScheme, -} from './resolver'; -import * as logging from './logging'; -import { - SubchannelAddress, - TcpSubchannelAddress, - isTcpSubchannelAddress, - subchannelAddressToString, -} from './subchannel'; -import { parseUri } from './uri-parser'; - -const TRACER_NAME = 'server'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -interface BindResult { - port: number; - count: number; -} - -function noop(): void {} - -function getUnimplementedStatusResponse( - methodName: string -): Partial { - return { - code: Status.UNIMPLEMENTED, - details: `The server does not implement the method ${methodName}`, - metadata: new Metadata(), - }; -} - -/* eslint-disable @typescript-eslint/no-explicit-any */ -type UntypedUnaryHandler = UnaryHandler; -type UntypedClientStreamingHandler = ClientStreamingHandler; -type UntypedServerStreamingHandler = ServerStreamingHandler; -type UntypedBidiStreamingHandler = BidiStreamingHandler; -export type UntypedHandleCall = HandleCall; -type UntypedHandler = Handler; -export interface UntypedServiceImplementation { - [name: string]: UntypedHandleCall; -} - -function getDefaultHandler(handlerType: HandlerType, methodName: string) { - const unimplementedStatusResponse = getUnimplementedStatusResponse( - methodName - ); - switch (handlerType) { - case 'unary': - return ( - call: ServerUnaryCall, - callback: sendUnaryData - ) => { - callback(unimplementedStatusResponse as ServiceError, null); - }; - case 'clientStream': - return ( - call: ServerReadableStream, - callback: sendUnaryData - ) => { - callback(unimplementedStatusResponse as ServiceError, null); - }; - case 'serverStream': - return (call: ServerWritableStream) => { - call.emit('error', unimplementedStatusResponse); - }; - case 'bidi': - return (call: ServerDuplexStream) => { - call.emit('error', unimplementedStatusResponse); - }; - default: - throw new Error(`Invalid handlerType ${handlerType}`); - } -} - -export class Server { - private http2ServerList: (http2.Http2Server | http2.Http2SecureServer)[] = []; - - private handlers: Map = new Map< - string, - UntypedHandler - >(); - private sessions = new Set(); - private started = false; - private options: ChannelOptions; - - constructor(options?: ChannelOptions) { - this.options = options ?? {}; - } - - addProtoService(): void { - throw new Error('Not implemented. Use addService() instead'); - } - - addService( - service: ServiceDefinition, - implementation: UntypedServiceImplementation - ): void { - if ( - service === null || - typeof service !== 'object' || - implementation === null || - typeof implementation !== 'object' - ) { - throw new Error('addService() requires two objects as arguments'); - } - - const serviceKeys = Object.keys(service); - - if (serviceKeys.length === 0) { - throw new Error('Cannot add an empty service to a server'); - } - - serviceKeys.forEach((name) => { - const attrs = service[name]; - let methodType: HandlerType; - - if (attrs.requestStream) { - if (attrs.responseStream) { - methodType = 'bidi'; - } else { - methodType = 'clientStream'; - } - } else { - if (attrs.responseStream) { - methodType = 'serverStream'; - } else { - methodType = 'unary'; - } - } - - let implFn = implementation[name]; - let impl; - - if (implFn === undefined && typeof attrs.originalName === 'string') { - implFn = implementation[attrs.originalName]; - } - - if (implFn !== undefined) { - impl = implFn.bind(implementation); - } else { - impl = getDefaultHandler(methodType, name); - } - - const success = this.register( - attrs.path, - impl as UntypedHandleCall, - attrs.responseSerialize, - attrs.requestDeserialize, - methodType - ); - - if (success === false) { - throw new Error(`Method handler for ${attrs.path} already provided.`); - } - }); - } - - removeService(service: ServiceDefinition): void { - if ( - service === null || - typeof service !== 'object' - ) { - throw new Error('removeService() requires object as argument'); - } - - const serviceKeys = Object.keys(service); - serviceKeys.forEach((name) => { - const attrs = service[name]; - this.unregister(attrs.path); - }); - } - - bind(port: string, creds: ServerCredentials): void { - throw new Error('Not implemented. Use bindAsync() instead'); - } - - bindAsync( - port: string, - creds: ServerCredentials, - callback: (error: Error | null, port: number) => void - ): void { - if (this.started === true) { - throw new Error('server is already started'); - } - - if (typeof port !== 'string') { - throw new TypeError('port must be a string'); - } - - if (creds === null || typeof creds !== 'object') { - throw new TypeError('creds must be an object'); - } - - if (typeof callback !== 'function') { - throw new TypeError('callback must be a function'); - } - - const initialPortUri = parseUri(port); - if (initialPortUri === null) { - throw new Error(`Could not parse port "${port}"`); - } - const portUri = mapUriDefaultScheme(initialPortUri); - if (portUri === null) { - throw new Error(`Could not get a default scheme for port "${port}"`); - } - - const serverOptions: http2.ServerOptions = { - maxSendHeaderBlockLength: Number.MAX_SAFE_INTEGER - }; - if ('grpc.max_concurrent_streams' in this.options) { - serverOptions.settings = { - maxConcurrentStreams: this.options['grpc.max_concurrent_streams'], - }; - } - - const setupServer = (): http2.Http2Server | http2.Http2SecureServer => { - let http2Server: http2.Http2Server | http2.Http2SecureServer; - if (creds._isSecure()) { - const secureServerOptions = Object.assign( - serverOptions, - creds._getSettings()! - ); - http2Server = http2.createSecureServer(secureServerOptions); - } else { - http2Server = http2.createServer(serverOptions); - } - - http2Server.setTimeout(0, noop); - this._setupHandlers(http2Server); - return http2Server; - }; - - const bindSpecificPort = ( - addressList: SubchannelAddress[], - portNum: number, - previousCount: number - ): Promise => { - if (addressList.length === 0) { - return Promise.resolve({ port: portNum, count: previousCount }); - } - return Promise.all( - addressList.map((address) => { - trace('Attempting to bind ' + subchannelAddressToString(address)); - let addr: SubchannelAddress; - if (isTcpSubchannelAddress(address)) { - addr = { - host: (address as TcpSubchannelAddress).host, - port: portNum, - }; - } else { - addr = address; - } - - const http2Server = setupServer(); - return new Promise((resolve, reject) => { - function onError(err: Error): void { - resolve(err); - } - - http2Server.once('error', onError); - - http2Server.listen(addr, () => { - trace('Successfully bound ' + subchannelAddressToString(address)); - this.http2ServerList.push(http2Server); - const boundAddress = http2Server.address()!; - if (typeof boundAddress === 'string') { - resolve(portNum); - } else { - resolve(boundAddress.port); - } - http2Server.removeListener('error', onError); - }); - }); - }) - ).then((results) => { - let count = 0; - for (const result of results) { - if (typeof result === 'number') { - count += 1; - if (result !== portNum) { - throw new Error( - 'Invalid state: multiple port numbers added from single address' - ); - } - } - } - return { - port: portNum, - count: count + previousCount, - }; - }); - }; - - const bindWildcardPort = ( - addressList: SubchannelAddress[] - ): Promise => { - if (addressList.length === 0) { - return Promise.resolve({ port: 0, count: 0 }); - } - const address = addressList[0]; - const http2Server = setupServer(); - return new Promise((resolve, reject) => { - function onError(err: Error): void { - resolve(bindWildcardPort(addressList.slice(1))); - } - - http2Server.once('error', onError); - - http2Server.listen(address, () => { - this.http2ServerList.push(http2Server); - resolve( - bindSpecificPort( - addressList.slice(1), - (http2Server.address() as AddressInfo).port, - 1 - ) - ); - http2Server.removeListener('error', onError); - }); - }); - }; - - const resolverListener: ResolverListener = { - onSuccessfulResolution: ( - addressList, - serviceConfig, - serviceConfigError - ) => { - // We only want one resolution result. Discard all future results - resolverListener.onSuccessfulResolution = () => {}; - if (addressList.length === 0) { - callback(new Error(`No addresses resolved for port ${port}`), 0); - return; - } - let bindResultPromise: Promise; - if (isTcpSubchannelAddress(addressList[0])) { - if (addressList[0].port === 0) { - bindResultPromise = bindWildcardPort(addressList); - } else { - bindResultPromise = bindSpecificPort( - addressList, - addressList[0].port, - 0 - ); - } - } else { - // Use an arbitrary non-zero port for non-TCP addresses - bindResultPromise = bindSpecificPort(addressList, 1, 0); - } - bindResultPromise.then( - (bindResult) => { - if (bindResult.count === 0) { - const errorString = `No address added out of total ${addressList.length} resolved`; - logging.log(LogVerbosity.ERROR, errorString); - callback(new Error(errorString), 0); - } else { - if (bindResult.count < addressList.length) { - logging.log( - LogVerbosity.INFO, - `WARNING Only ${bindResult.count} addresses added out of total ${addressList.length} resolved` - ); - } - callback(null, bindResult.port); - } - }, - (error) => { - const errorString = `No address added out of total ${addressList.length} resolved`; - logging.log(LogVerbosity.ERROR, errorString); - callback(new Error(errorString), 0); - } - ); - }, - onError: (error) => { - callback(new Error(error.details), 0); - }, - }; - - const resolver = createResolver(portUri, resolverListener, this.options); - resolver.updateResolution(); - } - - forceShutdown(): void { - // Close the server if it is still running. - - for (const http2Server of this.http2ServerList) { - if (http2Server.listening) { - http2Server.close(); - } - } - - this.started = false; - - // Always destroy any available sessions. It's possible that one or more - // tryShutdown() calls are in progress. Don't wait on them to finish. - this.sessions.forEach((session) => { - // Cast NGHTTP2_CANCEL to any because TypeScript doesn't seem to - // recognize destroy(code) as a valid signature. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - session.destroy(http2.constants.NGHTTP2_CANCEL as any); - }); - this.sessions.clear(); - } - - register( - name: string, - handler: HandleCall, - serialize: Serialize, - deserialize: Deserialize, - type: string - ): boolean { - if (this.handlers.has(name)) { - return false; - } - - this.handlers.set(name, { - func: handler, - serialize, - deserialize, - type, - path: name, - } as UntypedHandler); - return true; - } - - unregister(name: string): boolean { - return this.handlers.delete(name); - } - - start(): void { - if ( - this.http2ServerList.length === 0 || - this.http2ServerList.every( - (http2Server) => http2Server.listening !== true - ) - ) { - throw new Error('server must be bound in order to start'); - } - - if (this.started === true) { - throw new Error('server is already started'); - } - - this.started = true; - } - - tryShutdown(callback: (error?: Error) => void): void { - let pendingChecks = 0; - - function maybeCallback(): void { - pendingChecks--; - - if (pendingChecks === 0) { - callback(); - } - } - - // Close the server if necessary. - this.started = false; - - for (const http2Server of this.http2ServerList) { - if (http2Server.listening) { - pendingChecks++; - http2Server.close(maybeCallback); - } - } - - this.sessions.forEach((session) => { - if (!session.closed) { - pendingChecks += 1; - session.close(maybeCallback); - } - }); - if (pendingChecks === 0) { - callback(); - } - } - - addHttp2Port(): void { - throw new Error('Not yet implemented'); - } - - private _setupHandlers( - http2Server: http2.Http2Server | http2.Http2SecureServer - ): void { - if (http2Server === null) { - return; - } - - http2Server.on( - 'stream', - (stream: http2.ServerHttp2Stream, headers: http2.IncomingHttpHeaders) => { - const contentType = headers[http2.constants.HTTP2_HEADER_CONTENT_TYPE]; - - if ( - typeof contentType !== 'string' || - !contentType.startsWith('application/grpc') - ) { - stream.respond( - { - [http2.constants.HTTP2_HEADER_STATUS]: - http2.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE, - }, - { endStream: true } - ); - return; - } - - try { - const path = headers[http2.constants.HTTP2_HEADER_PATH] as string; - const serverAddress = http2Server.address(); - let serverAddressString = 'null'; - if (serverAddress) { - if (typeof serverAddress === 'string') { - serverAddressString = serverAddress; - } else { - serverAddressString = - serverAddress.address + ':' + serverAddress.port; - } - } - trace( - 'Received call to method ' + - path + - ' at address ' + - serverAddressString - ); - const handler = this.handlers.get(path); - - if (handler === undefined) { - trace( - 'No handler registered for method ' + - path + - '. Sending UNIMPLEMENTED status.' - ); - throw getUnimplementedStatusResponse(path); - } - - const call = new Http2ServerCallStream(stream, handler, this.options); - const metadata: Metadata = call.receiveMetadata(headers) as Metadata; - switch (handler.type) { - case 'unary': - handleUnary(call, handler as UntypedUnaryHandler, metadata); - break; - case 'clientStream': - handleClientStreaming( - call, - handler as UntypedClientStreamingHandler, - metadata - ); - break; - case 'serverStream': - handleServerStreaming( - call, - handler as UntypedServerStreamingHandler, - metadata - ); - break; - case 'bidi': - handleBidiStreaming( - call, - handler as UntypedBidiStreamingHandler, - metadata - ); - break; - default: - throw new Error(`Unknown handler type: ${handler.type}`); - } - } catch (err) { - const call = new Http2ServerCallStream(stream, null!, this.options); - - if (err.code === undefined) { - err.code = Status.INTERNAL; - } - - call.sendError(err); - } - } - ); - - http2Server.on('session', (session) => { - if (!this.started) { - session.destroy(); - return; - } - - this.sessions.add(session); - - session.on('close', () => { - this.sessions.delete(session); - }); - }); - } -} - -async function handleUnary( - call: Http2ServerCallStream, - handler: UnaryHandler, - metadata: Metadata -): Promise { - const request = await call.receiveUnaryMessage(); - - if (request === undefined || call.cancelled) { - return; - } - - const emitter = new ServerUnaryCallImpl( - call, - metadata, - request - ); - - handler.func( - emitter, - ( - err: ServerErrorResponse | ServerStatusResponse | null, - value?: ResponseType | null, - trailer?: Metadata, - flags?: number - ) => { - call.sendUnaryMessage(err, value, trailer, flags); - } - ); -} - -function handleClientStreaming( - call: Http2ServerCallStream, - handler: ClientStreamingHandler, - metadata: Metadata -): void { - const stream = new ServerReadableStreamImpl( - call, - metadata, - handler.deserialize - ); - - function respond( - err: ServerErrorResponse | ServerStatusResponse | null, - value?: ResponseType | null, - trailer?: Metadata, - flags?: number - ) { - stream.destroy(); - call.sendUnaryMessage(err, value, trailer, flags); - } - - if (call.cancelled) { - return; - } - - stream.on('error', respond); - handler.func(stream, respond); -} - -async function handleServerStreaming( - call: Http2ServerCallStream, - handler: ServerStreamingHandler, - metadata: Metadata -): Promise { - const request = await call.receiveUnaryMessage(); - - if (request === undefined || call.cancelled) { - return; - } - - const stream = new ServerWritableStreamImpl( - call, - metadata, - handler.serialize, - request - ); - - handler.func(stream); -} - -function handleBidiStreaming( - call: Http2ServerCallStream, - handler: BidiStreamingHandler, - metadata: Metadata -): void { - const stream = new ServerDuplexStreamImpl( - call, - metadata, - handler.serialize, - handler.deserialize - ); - - if (call.cancelled) { - return; - } - - handler.func(stream); -} diff --git a/node_modules/@grpc/grpc-js/src/service-config.ts b/node_modules/@grpc/grpc-js/src/service-config.ts deleted file mode 100644 index ed225e08..00000000 --- a/node_modules/@grpc/grpc-js/src/service-config.ts +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* This file implements gRFC A2 and the service config spec: - * https://github.com/grpc/proposal/blob/master/A2-service-configs-in-dns.md - * https://github.com/grpc/grpc/blob/master/doc/service_config.md. Each - * function here takes an object with unknown structure and returns its - * specific object type if the input has the right structure, and throws an - * error otherwise. */ - -/* The any type is purposely used here. All functions validate their input at - * runtime */ -/* eslint-disable @typescript-eslint/no-explicit-any */ - -import * as os from 'os'; -import { LoadBalancingConfig, validateLoadBalancingConfig } from './load-balancer'; - -export interface MethodConfigName { - service: string; - method?: string; -} - -export interface MethodConfig { - name: MethodConfigName[]; - waitForReady?: boolean; - timeout?: string; - maxRequestBytes?: number; - maxResponseBytes?: number; -} - -export interface ServiceConfig { - loadBalancingPolicy?: string; - loadBalancingConfig: LoadBalancingConfig[]; - methodConfig: MethodConfig[]; -} - -export interface ServiceConfigCanaryConfig { - clientLanguage?: string[]; - percentage?: number; - clientHostname?: string[]; - serviceConfig: ServiceConfig; -} - -/** - * Recognizes a number with up to 9 digits after the decimal point, followed by - * an "s", representing a number of seconds. - */ -const TIMEOUT_REGEX = /^\d+(\.\d{1,9})?s$/; - -/** - * Client language name used for determining whether this client matches a - * `ServiceConfigCanaryConfig`'s `clientLanguage` list. - */ -const CLIENT_LANGUAGE_STRING = 'node'; - -function validateName(obj: any): MethodConfigName { - if (!('service' in obj) || typeof obj.service !== 'string') { - throw new Error('Invalid method config name: invalid service'); - } - const result: MethodConfigName = { - service: obj.service, - }; - if ('method' in obj) { - if (typeof obj.method === 'string') { - result.method = obj.method; - } else { - throw new Error('Invalid method config name: invalid method'); - } - } - return result; -} - -function validateMethodConfig(obj: any): MethodConfig { - const result: MethodConfig = { - name: [], - }; - if (!('name' in obj) || !Array.isArray(obj.name)) { - throw new Error('Invalid method config: invalid name array'); - } - for (const name of obj.name) { - result.name.push(validateName(name)); - } - if ('waitForReady' in obj) { - if (typeof obj.waitForReady !== 'boolean') { - throw new Error('Invalid method config: invalid waitForReady'); - } - result.waitForReady = obj.waitForReady; - } - if ('timeout' in obj) { - if ( - !(typeof obj.timeout === 'string') || - !TIMEOUT_REGEX.test(obj.timeout) - ) { - throw new Error('Invalid method config: invalid timeout'); - } - result.timeout = obj.timeout; - } - if ('maxRequestBytes' in obj) { - if (typeof obj.maxRequestBytes !== 'number') { - throw new Error('Invalid method config: invalid maxRequestBytes'); - } - result.maxRequestBytes = obj.maxRequestBytes; - } - if ('maxResponseBytes' in obj) { - if (typeof obj.maxResponseBytes !== 'number') { - throw new Error('Invalid method config: invalid maxRequestBytes'); - } - result.maxResponseBytes = obj.maxResponseBytes; - } - return result; -} - -export function validateServiceConfig(obj: any): ServiceConfig { - const result: ServiceConfig = { - loadBalancingConfig: [], - methodConfig: [], - }; - if ('loadBalancingPolicy' in obj) { - if (typeof obj.loadBalancingPolicy === 'string') { - result.loadBalancingPolicy = obj.loadBalancingPolicy; - } else { - throw new Error('Invalid service config: invalid loadBalancingPolicy'); - } - } - if ('loadBalancingConfig' in obj) { - if (Array.isArray(obj.loadBalancingConfig)) { - for (const config of obj.loadBalancingConfig) { - result.loadBalancingConfig.push(validateLoadBalancingConfig(config)); - } - } else { - throw new Error('Invalid service config: invalid loadBalancingConfig'); - } - } - if ('methodConfig' in obj) { - if (Array.isArray(obj.methodConfig)) { - for (const methodConfig of obj.methodConfig) { - result.methodConfig.push(validateMethodConfig(methodConfig)); - } - } - } - // Validate method name uniqueness - const seenMethodNames: MethodConfigName[] = []; - for (const methodConfig of result.methodConfig) { - for (const name of methodConfig.name) { - for (const seenName of seenMethodNames) { - if ( - name.service === seenName.service && - name.method === seenName.method - ) { - throw new Error( - `Invalid service config: duplicate name ${name.service}/${name.method}` - ); - } - } - seenMethodNames.push(name); - } - } - return result; -} - -function validateCanaryConfig(obj: any): ServiceConfigCanaryConfig { - if (!('serviceConfig' in obj)) { - throw new Error('Invalid service config choice: missing service config'); - } - const result: ServiceConfigCanaryConfig = { - serviceConfig: validateServiceConfig(obj.serviceConfig), - }; - if ('clientLanguage' in obj) { - if (Array.isArray(obj.clientLanguage)) { - result.clientLanguage = []; - for (const lang of obj.clientLanguage) { - if (typeof lang === 'string') { - result.clientLanguage.push(lang); - } else { - throw new Error( - 'Invalid service config choice: invalid clientLanguage' - ); - } - } - } else { - throw new Error('Invalid service config choice: invalid clientLanguage'); - } - } - if ('clientHostname' in obj) { - if (Array.isArray(obj.clientHostname)) { - result.clientHostname = []; - for (const lang of obj.clientHostname) { - if (typeof lang === 'string') { - result.clientHostname.push(lang); - } else { - throw new Error( - 'Invalid service config choice: invalid clientHostname' - ); - } - } - } else { - throw new Error('Invalid service config choice: invalid clientHostname'); - } - } - if ('percentage' in obj) { - if ( - typeof obj.percentage === 'number' && - 0 <= obj.percentage && - obj.percentage <= 100 - ) { - result.percentage = obj.percentage; - } else { - throw new Error('Invalid service config choice: invalid percentage'); - } - } - // Validate that no unexpected fields are present - const allowedFields = [ - 'clientLanguage', - 'percentage', - 'clientHostname', - 'serviceConfig', - ]; - for (const field in obj) { - if (!allowedFields.includes(field)) { - throw new Error( - `Invalid service config choice: unexpected field ${field}` - ); - } - } - return result; -} - -function validateAndSelectCanaryConfig( - obj: any, - percentage: number -): ServiceConfig { - if (!Array.isArray(obj)) { - throw new Error('Invalid service config list'); - } - for (const config of obj) { - const validatedConfig = validateCanaryConfig(config); - /* For each field, we check if it is present, then only discard the - * config if the field value does not match the current client */ - if ( - typeof validatedConfig.percentage === 'number' && - percentage > validatedConfig.percentage - ) { - continue; - } - if (Array.isArray(validatedConfig.clientHostname)) { - let hostnameMatched = false; - for (const hostname of validatedConfig.clientHostname) { - if (hostname === os.hostname()) { - hostnameMatched = true; - } - } - if (!hostnameMatched) { - continue; - } - } - if (Array.isArray(validatedConfig.clientLanguage)) { - let languageMatched = false; - for (const language of validatedConfig.clientLanguage) { - if (language === CLIENT_LANGUAGE_STRING) { - languageMatched = true; - } - } - if (!languageMatched) { - continue; - } - } - return validatedConfig.serviceConfig; - } - throw new Error('No matching service config found'); -} - -/** - * Find the "grpc_config" record among the TXT records, parse its value as JSON, validate its contents, - * and select a service config with selection fields that all match this client. Most of these steps - * can fail with an error; the caller must handle any errors thrown this way. - * @param txtRecord The TXT record array that is output from a successful call to dns.resolveTxt - * @param percentage A number chosen from the range [0, 100) that is used to select which config to use - * @return The service configuration to use, given the percentage value, or null if the service config - * data has a valid format but none of the options match the current client. - */ -export function extractAndSelectServiceConfig( - txtRecord: string[][], - percentage: number -): ServiceConfig | null { - for (const record of txtRecord) { - if (record.length > 0 && record[0].startsWith('grpc_config=')) { - /* Treat the list of strings in this record as a single string and remove - * "grpc_config=" from the beginning. The rest should be a JSON string */ - const recordString = record.join('').substring('grpc_config='.length); - const recordJson: any = JSON.parse(recordString); - return validateAndSelectCanaryConfig(recordJson, percentage); - } - } - return null; -} diff --git a/node_modules/@grpc/grpc-js/src/status-builder.ts b/node_modules/@grpc/grpc-js/src/status-builder.ts deleted file mode 100644 index 1109af1a..00000000 --- a/node_modules/@grpc/grpc-js/src/status-builder.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { StatusObject } from './call-stream'; -import { Status } from './constants'; -import { Metadata } from './metadata'; - -/** - * A builder for gRPC status objects. - */ -export class StatusBuilder { - private code: Status | null; - private details: string | null; - private metadata: Metadata | null; - - constructor() { - this.code = null; - this.details = null; - this.metadata = null; - } - - /** - * Adds a status code to the builder. - */ - withCode(code: Status): this { - this.code = code; - return this; - } - - /** - * Adds details to the builder. - */ - withDetails(details: string): this { - this.details = details; - return this; - } - - /** - * Adds metadata to the builder. - */ - withMetadata(metadata: Metadata): this { - this.metadata = metadata; - return this; - } - - /** - * Builds the status object. - */ - build(): Partial { - const status: Partial = {}; - - if (this.code !== null) { - status.code = this.code; - } - - if (this.details !== null) { - status.details = this.details; - } - - if (this.metadata !== null) { - status.metadata = this.metadata; - } - - return status; - } -} diff --git a/node_modules/@grpc/grpc-js/src/stream-decoder.ts b/node_modules/@grpc/grpc-js/src/stream-decoder.ts deleted file mode 100644 index 671ad41a..00000000 --- a/node_modules/@grpc/grpc-js/src/stream-decoder.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -enum ReadState { - NO_DATA, - READING_SIZE, - READING_MESSAGE, -} - -export class StreamDecoder { - private readState: ReadState = ReadState.NO_DATA; - private readCompressFlag: Buffer = Buffer.alloc(1); - private readPartialSize: Buffer = Buffer.alloc(4); - private readSizeRemaining = 4; - private readMessageSize = 0; - private readPartialMessage: Buffer[] = []; - private readMessageRemaining = 0; - - write(data: Buffer): Buffer[] { - let readHead = 0; - let toRead: number; - const result: Buffer[] = []; - - while (readHead < data.length) { - switch (this.readState) { - case ReadState.NO_DATA: - this.readCompressFlag = data.slice(readHead, readHead + 1); - readHead += 1; - this.readState = ReadState.READING_SIZE; - this.readPartialSize.fill(0); - this.readSizeRemaining = 4; - this.readMessageSize = 0; - this.readMessageRemaining = 0; - this.readPartialMessage = []; - break; - case ReadState.READING_SIZE: - toRead = Math.min(data.length - readHead, this.readSizeRemaining); - data.copy( - this.readPartialSize, - 4 - this.readSizeRemaining, - readHead, - readHead + toRead - ); - this.readSizeRemaining -= toRead; - readHead += toRead; - // readSizeRemaining >=0 here - if (this.readSizeRemaining === 0) { - this.readMessageSize = this.readPartialSize.readUInt32BE(0); - this.readMessageRemaining = this.readMessageSize; - if (this.readMessageRemaining > 0) { - this.readState = ReadState.READING_MESSAGE; - } else { - const message = Buffer.concat( - [this.readCompressFlag, this.readPartialSize], - 5 - ); - - this.readState = ReadState.NO_DATA; - result.push(message); - } - } - break; - case ReadState.READING_MESSAGE: - toRead = Math.min(data.length - readHead, this.readMessageRemaining); - this.readPartialMessage.push(data.slice(readHead, readHead + toRead)); - this.readMessageRemaining -= toRead; - readHead += toRead; - // readMessageRemaining >=0 here - if (this.readMessageRemaining === 0) { - // At this point, we have read a full message - const framedMessageBuffers = [ - this.readCompressFlag, - this.readPartialSize, - ].concat(this.readPartialMessage); - const framedMessage = Buffer.concat( - framedMessageBuffers, - this.readMessageSize + 5 - ); - - this.readState = ReadState.NO_DATA; - result.push(framedMessage); - } - break; - default: - throw new Error('Unexpected read state'); - } - } - - return result; - } -} diff --git a/node_modules/@grpc/grpc-js/src/subchannel-pool.ts b/node_modules/@grpc/grpc-js/src/subchannel-pool.ts deleted file mode 100644 index d28e3eac..00000000 --- a/node_modules/@grpc/grpc-js/src/subchannel-pool.ts +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { ChannelOptions, channelOptionsEqual } from './channel-options'; -import { - Subchannel, - SubchannelAddress, - subchannelAddressEqual, -} from './subchannel'; -import { ChannelCredentials } from './channel-credentials'; -import { GrpcUri, uriToString } from './uri-parser'; - -// 10 seconds in milliseconds. This value is arbitrary. -/** - * The amount of time in between checks for dropping subchannels that have no - * other references - */ -const REF_CHECK_INTERVAL = 10_000; - -export class SubchannelPool { - private pool: { - [channelTarget: string]: Array<{ - subchannelAddress: SubchannelAddress; - channelArguments: ChannelOptions; - channelCredentials: ChannelCredentials; - subchannel: Subchannel; - }>; - } = Object.create(null); - - /** - * A timer of a task performing a periodic subchannel cleanup. - */ - private cleanupTimer: NodeJS.Timer | null = null; - - /** - * A pool of subchannels use for making connections. Subchannels with the - * exact same parameters will be reused. - * @param global If true, this is the global subchannel pool. Otherwise, it - * is the pool for a single channel. - */ - constructor(private global: boolean) {} - - /** - * Unrefs all unused subchannels and cancels the cleanup task if all - * subchannels have been unrefed. - */ - unrefUnusedSubchannels(): void { - let allSubchannelsUnrefed = true; - - /* These objects are created with Object.create(null), so they do not - * have a prototype, which means that for (... in ...) loops over them - * do not need to be filtered */ - // eslint-disable-disable-next-line:forin - for (const channelTarget in this.pool) { - const subchannelObjArray = this.pool[channelTarget]; - - const refedSubchannels = subchannelObjArray.filter( - (value) => !value.subchannel.unrefIfOneRef() - ); - - if (refedSubchannels.length > 0) { - allSubchannelsUnrefed = false; - } - - /* For each subchannel in the pool, try to unref it if it has - * exactly one ref (which is the ref from the pool itself). If that - * does happen, remove the subchannel from the pool */ - this.pool[channelTarget] = refedSubchannels; - } - /* Currently we do not delete keys with empty values. If that results - * in significant memory usage we should change it. */ - - // Cancel the cleanup task if all subchannels have been unrefed. - if (allSubchannelsUnrefed && this.cleanupTimer !== null) { - clearInterval(this.cleanupTimer); - this.cleanupTimer = null; - } - } - - /** - * Ensures that the cleanup task is spawned. - */ - ensureCleanupTask(): void { - if (this.global && this.cleanupTimer === null) { - this.cleanupTimer = setInterval(() => { - this.unrefUnusedSubchannels(); - }, REF_CHECK_INTERVAL); - - // Unref because this timer should not keep the event loop running. - // Call unref only if it exists to address electron/electron#21162 - this.cleanupTimer.unref?.(); - } - } - - /** - * Get a subchannel if one already exists with exactly matching parameters. - * Otherwise, create and save a subchannel with those parameters. - * @param channelTarget - * @param subchannelTarget - * @param channelArguments - * @param channelCredentials - */ - getOrCreateSubchannel( - channelTargetUri: GrpcUri, - subchannelTarget: SubchannelAddress, - channelArguments: ChannelOptions, - channelCredentials: ChannelCredentials - ): Subchannel { - this.ensureCleanupTask(); - const channelTarget = uriToString(channelTargetUri); - if (channelTarget in this.pool) { - const subchannelObjArray = this.pool[channelTarget]; - for (const subchannelObj of subchannelObjArray) { - if ( - subchannelAddressEqual( - subchannelTarget, - subchannelObj.subchannelAddress - ) && - channelOptionsEqual( - channelArguments, - subchannelObj.channelArguments - ) && - channelCredentials._equals(subchannelObj.channelCredentials) - ) { - return subchannelObj.subchannel; - } - } - } - // If we get here, no matching subchannel was found - const subchannel = new Subchannel( - channelTargetUri, - subchannelTarget, - channelArguments, - channelCredentials - ); - if (!(channelTarget in this.pool)) { - this.pool[channelTarget] = []; - } - this.pool[channelTarget].push({ - subchannelAddress: subchannelTarget, - channelArguments, - channelCredentials, - subchannel, - }); - if (this.global) { - subchannel.ref(); - } - return subchannel; - } -} - -const globalSubchannelPool = new SubchannelPool(true); - -/** - * Get either the global subchannel pool, or a new subchannel pool. - * @param global - */ -export function getSubchannelPool(global: boolean): SubchannelPool { - if (global) { - return globalSubchannelPool; - } else { - return new SubchannelPool(false); - } -} diff --git a/node_modules/@grpc/grpc-js/src/subchannel.ts b/node_modules/@grpc/grpc-js/src/subchannel.ts deleted file mode 100644 index c32ee43e..00000000 --- a/node_modules/@grpc/grpc-js/src/subchannel.ts +++ /dev/null @@ -1,797 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import * as http2 from 'http2'; -import { ChannelCredentials } from './channel-credentials'; -import { Metadata } from './metadata'; -import { Http2CallStream } from './call-stream'; -import { ChannelOptions } from './channel-options'; -import { PeerCertificate, checkServerIdentity } from 'tls'; -import { ConnectivityState } from './channel'; -import { BackoffTimeout, BackoffOptions } from './backoff-timeout'; -import { getDefaultAuthority } from './resolver'; -import * as logging from './logging'; -import { LogVerbosity } from './constants'; -import { getProxiedConnection, ProxyConnectionResult } from './http_proxy'; -import * as net from 'net'; -import { GrpcUri, parseUri, splitHostPort, uriToString } from './uri-parser'; -import { ConnectionOptions } from 'tls'; -import { FilterFactory, Filter } from './filter'; - -const clientVersion = require('../../package.json').version; - -const TRACER_NAME = 'subchannel'; - -function trace(text: string): void { - logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); -} - -function refTrace(text: string): void { - logging.trace(LogVerbosity.DEBUG, 'subchannel_refcount', text); -} - -const MIN_CONNECT_TIMEOUT_MS = 20000; -const INITIAL_BACKOFF_MS = 1000; -const BACKOFF_MULTIPLIER = 1.6; -const MAX_BACKOFF_MS = 120000; -const BACKOFF_JITTER = 0.2; - -/* setInterval and setTimeout only accept signed 32 bit integers. JS doesn't - * have a constant for the max signed 32 bit integer, so this is a simple way - * to calculate it */ -const KEEPALIVE_MAX_TIME_MS = ~(1 << 31); -const KEEPALIVE_TIMEOUT_MS = 20000; - -export type ConnectivityStateListener = ( - subchannel: Subchannel, - previousState: ConnectivityState, - newState: ConnectivityState -) => void; - -const { - HTTP2_HEADER_AUTHORITY, - HTTP2_HEADER_CONTENT_TYPE, - HTTP2_HEADER_METHOD, - HTTP2_HEADER_PATH, - HTTP2_HEADER_TE, - HTTP2_HEADER_USER_AGENT, -} = http2.constants; - -/** - * Get a number uniformly at random in the range [min, max) - * @param min - * @param max - */ -function uniformRandom(min: number, max: number) { - return Math.random() * (max - min) + min; -} - -const tooManyPingsData: Buffer = Buffer.from('too_many_pings', 'ascii'); - -export interface TcpSubchannelAddress { - port: number; - host: string; -} - -export interface IpcSubchannelAddress { - path: string; -} - -/** - * This represents a single backend address to connect to. This interface is a - * subset of net.SocketConnectOpts, i.e. the options described at - * https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener. - * Those are in turn a subset of the options that can be passed to http2.connect. - */ -export type SubchannelAddress = TcpSubchannelAddress | IpcSubchannelAddress; - -export function isTcpSubchannelAddress( - address: SubchannelAddress -): address is TcpSubchannelAddress { - return 'port' in address; -} - -export function subchannelAddressEqual( - address1: SubchannelAddress, - address2: SubchannelAddress -): boolean { - if (isTcpSubchannelAddress(address1)) { - return ( - isTcpSubchannelAddress(address2) && - address1.host === address2.host && - address1.port === address2.port - ); - } else { - return !isTcpSubchannelAddress(address2) && address1.path === address2.path; - } -} - -export function subchannelAddressToString(address: SubchannelAddress): string { - if (isTcpSubchannelAddress(address)) { - return address.host + ':' + address.port; - } else { - return address.path; - } -} - -export class Subchannel { - /** - * The subchannel's current connectivity state. Invariant: `session` === `null` - * if and only if `connectivityState` is IDLE or TRANSIENT_FAILURE. - */ - private connectivityState: ConnectivityState = ConnectivityState.IDLE; - /** - * The underlying http2 session used to make requests. - */ - private session: http2.ClientHttp2Session | null = null; - /** - * Indicates that the subchannel should transition from TRANSIENT_FAILURE to - * CONNECTING instead of IDLE when the backoff timeout ends. - */ - private continueConnecting = false; - /** - * A list of listener functions that will be called whenever the connectivity - * state changes. Will be modified by `addConnectivityStateListener` and - * `removeConnectivityStateListener` - */ - private stateListeners: ConnectivityStateListener[] = []; - - /** - * A list of listener functions that will be called when the underlying - * socket disconnects. Used for ending active calls with an UNAVAILABLE - * status. - */ - private disconnectListeners: Array<() => void> = []; - - private backoffTimeout: BackoffTimeout; - - /** - * The complete user agent string constructed using channel args. - */ - private userAgent: string; - - /** - * The amount of time in between sending pings - */ - private keepaliveTimeMs: number = KEEPALIVE_MAX_TIME_MS; - /** - * The amount of time to wait for an acknowledgement after sending a ping - */ - private keepaliveTimeoutMs: number = KEEPALIVE_TIMEOUT_MS; - /** - * Timer reference for timeout that indicates when to send the next ping - */ - private keepaliveIntervalId: NodeJS.Timer; - /** - * Timer reference tracking when the most recent ping will be considered lost - */ - private keepaliveTimeoutId: NodeJS.Timer; - /** - * Indicates whether keepalive pings should be sent without any active calls - */ - private keepaliveWithoutCalls: boolean = false; - - /** - * Tracks calls with references to this subchannel - */ - private callRefcount = 0; - /** - * Tracks channels and subchannel pools with references to this subchannel - */ - private refcount = 0; - - /** - * A string representation of the subchannel address, for logging/tracing - */ - private subchannelAddressString: string; - - /** - * A class representing a connection to a single backend. - * @param channelTarget The target string for the channel as a whole - * @param subchannelAddress The address for the backend that this subchannel - * will connect to - * @param options The channel options, plus any specific subchannel options - * for this subchannel - * @param credentials The channel credentials used to establish this - * connection - */ - constructor( - private channelTarget: GrpcUri, - private subchannelAddress: SubchannelAddress, - private options: ChannelOptions, - private credentials: ChannelCredentials - ) { - // Build user-agent string. - this.userAgent = [ - options['grpc.primary_user_agent'], - `grpc-node-js/${clientVersion}`, - options['grpc.secondary_user_agent'], - ] - .filter((e) => e) - .join(' '); // remove falsey values first - - if ('grpc.keepalive_time_ms' in options) { - this.keepaliveTimeMs = options['grpc.keepalive_time_ms']!; - } - if ('grpc.keepalive_timeout_ms' in options) { - this.keepaliveTimeoutMs = options['grpc.keepalive_timeout_ms']!; - } - if ('grpc.keepalive_permit_without_calls' in options) { - this.keepaliveWithoutCalls = options['grpc.keepalive_permit_without_calls'] === 1; - } else { - this.keepaliveWithoutCalls = false; - } - this.keepaliveIntervalId = setTimeout(() => {}, 0); - clearTimeout(this.keepaliveIntervalId); - this.keepaliveTimeoutId = setTimeout(() => {}, 0); - clearTimeout(this.keepaliveTimeoutId); - const backoffOptions: BackoffOptions = { - initialDelay: options['grpc.initial_reconnect_backoff_ms'], - maxDelay: options['grpc.max_reconnect_backoff_ms'], - }; - this.backoffTimeout = new BackoffTimeout(() => { - this.handleBackoffTimer(); - }, backoffOptions); - this.subchannelAddressString = subchannelAddressToString(subchannelAddress); - } - - private handleBackoffTimer() { - if (this.continueConnecting) { - this.transitionToState( - [ConnectivityState.TRANSIENT_FAILURE], - ConnectivityState.CONNECTING - ); - } else { - this.transitionToState( - [ConnectivityState.TRANSIENT_FAILURE], - ConnectivityState.IDLE - ); - } - } - - /** - * Start a backoff timer with the current nextBackoff timeout - */ - private startBackoff() { - this.backoffTimeout.runOnce(); - } - - private stopBackoff() { - this.backoffTimeout.stop(); - this.backoffTimeout.reset(); - } - - private sendPing() { - logging.trace(LogVerbosity.DEBUG, 'keepalive', 'Sending ping to ' + this.subchannelAddressString); - this.keepaliveTimeoutId = setTimeout(() => { - this.transitionToState([ConnectivityState.READY], ConnectivityState.IDLE); - }, this.keepaliveTimeoutMs); - this.session!.ping( - (err: Error | null, duration: number, payload: Buffer) => { - clearTimeout(this.keepaliveTimeoutId); - } - ); - } - - private startKeepalivePings() { - this.keepaliveIntervalId = setInterval(() => { - this.sendPing(); - }, this.keepaliveTimeMs); - /* Don't send a ping immediately because whatever caused us to start - * sending pings should also involve some network activity. */ - } - - private stopKeepalivePings() { - clearInterval(this.keepaliveIntervalId); - clearTimeout(this.keepaliveTimeoutId); - } - - private createSession(proxyConnectionResult: ProxyConnectionResult) { - const targetAuthority = getDefaultAuthority( - proxyConnectionResult.realTarget ?? this.channelTarget - ); - let connectionOptions: http2.SecureClientSessionOptions = - this.credentials._getConnectionOptions() || {}; - connectionOptions.maxSendHeaderBlockLength = Number.MAX_SAFE_INTEGER; - let addressScheme = 'http://'; - if ('secureContext' in connectionOptions) { - addressScheme = 'https://'; - // If provided, the value of grpc.ssl_target_name_override should be used - // to override the target hostname when checking server identity. - // This option is used for testing only. - if (this.options['grpc.ssl_target_name_override']) { - const sslTargetNameOverride = this.options[ - 'grpc.ssl_target_name_override' - ]!; - connectionOptions.checkServerIdentity = ( - host: string, - cert: PeerCertificate - ): Error | undefined => { - return checkServerIdentity(sslTargetNameOverride, cert); - }; - connectionOptions.servername = sslTargetNameOverride; - } else { - const authorityHostname = - splitHostPort(targetAuthority)?.host ?? 'localhost'; - // We want to always set servername to support SNI - connectionOptions.servername = authorityHostname; - } - if (proxyConnectionResult.socket) { - /* This is part of the workaround for - * https://github.com/nodejs/node/issues/32922. Without that bug, - * proxyConnectionResult.socket would always be a plaintext socket and - * this would say - * connectionOptions.socket = proxyConnectionResult.socket; */ - connectionOptions.createConnection = (authority, option) => { - return proxyConnectionResult.socket!; - }; - } - } else { - /* In all but the most recent versions of Node, http2.connect does not use - * the options when establishing plaintext connections, so we need to - * establish that connection explicitly. */ - connectionOptions.createConnection = (authority, option) => { - if (proxyConnectionResult.socket) { - return proxyConnectionResult.socket; - } else { - /* net.NetConnectOpts is declared in a way that is more restrictive - * than what net.connect will actually accept, so we use the type - * assertion to work around that. */ - return net.connect(this.subchannelAddress); - } - }; - } - - connectionOptions = { - ...connectionOptions, - ...this.subchannelAddress, - }; - - /* http2.connect uses the options here: - * https://github.com/nodejs/node/blob/70c32a6d190e2b5d7b9ff9d5b6a459d14e8b7d59/lib/internal/http2/core.js#L3028-L3036 - * The spread operator overides earlier values with later ones, so any port - * or host values in the options will be used rather than any values extracted - * from the first argument. In addition, the path overrides the host and port, - * as documented for plaintext connections here: - * https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener - * and for TLS connections here: - * https://nodejs.org/api/tls.html#tls_tls_connect_options_callback. In - * earlier versions of Node, http2.connect passes these options to - * tls.connect but not net.connect, so in the insecure case we still need - * to set the createConnection option above to create the connection - * explicitly. We cannot do that in the TLS case because http2.connect - * passes necessary additional options to tls.connect. - * The first argument just needs to be parseable as a URL and the scheme - * determines whether the connection will be established over TLS or not. - */ - const session = http2.connect( - addressScheme + targetAuthority, - connectionOptions - ); - this.session = session; - session.unref(); - /* For all of these events, check if the session at the time of the event - * is the same one currently attached to this subchannel, to ensure that - * old events from previous connection attempts cannot cause invalid state - * transitions. */ - session.once('connect', () => { - if (this.session === session) { - this.transitionToState( - [ConnectivityState.CONNECTING], - ConnectivityState.READY - ); - } - }); - session.once('close', () => { - if (this.session === session) { - this.transitionToState( - [ConnectivityState.CONNECTING], - ConnectivityState.TRANSIENT_FAILURE - ); - /* Transitioning directly to IDLE here should be OK because we are not - * doing any backoff, because a connection was established at some - * point */ - this.transitionToState( - [ConnectivityState.READY], - ConnectivityState.IDLE - ); - } - }); - session.once( - 'goaway', - (errorCode: number, lastStreamID: number, opaqueData: Buffer) => { - if (this.session === session) { - /* See the last paragraph of - * https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md#basic-keepalive */ - if ( - errorCode === http2.constants.NGHTTP2_ENHANCE_YOUR_CALM && - opaqueData.equals(tooManyPingsData) - ) { - this.keepaliveTimeMs = Math.min( - 2 * this.keepaliveTimeMs, - KEEPALIVE_MAX_TIME_MS - ); - logging.log( - LogVerbosity.ERROR, - `Connection to ${uriToString(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTimeMs} ms` - ); - } - trace( - this.subchannelAddressString + - ' connection closed by GOAWAY with code ' + - errorCode - ); - this.transitionToState( - [ConnectivityState.CONNECTING, ConnectivityState.READY], - ConnectivityState.IDLE - ); - } - } - ); - session.once('error', (error) => { - /* Do nothing here. Any error should also trigger a close event, which is - * where we want to handle that. */ - trace( - this.subchannelAddressString + - ' connection closed with error ' + - (error as Error).message - ); - }); - } - - private startConnectingInternal() { - /* Pass connection options through to the proxy so that it's able to - * upgrade it's connection to support tls if needed. - * This is a workaround for https://github.com/nodejs/node/issues/32922 - * See https://github.com/grpc/grpc-node/pull/1369 for more info. */ - const connectionOptions: ConnectionOptions = - this.credentials._getConnectionOptions() || {}; - - if ('secureContext' in connectionOptions) { - connectionOptions.ALPNProtocols = ['h2']; - // If provided, the value of grpc.ssl_target_name_override should be used - // to override the target hostname when checking server identity. - // This option is used for testing only. - if (this.options['grpc.ssl_target_name_override']) { - const sslTargetNameOverride = this.options[ - 'grpc.ssl_target_name_override' - ]!; - connectionOptions.checkServerIdentity = ( - host: string, - cert: PeerCertificate - ): Error | undefined => { - return checkServerIdentity(sslTargetNameOverride, cert); - }; - connectionOptions.servername = sslTargetNameOverride; - } else { - if ('grpc.http_connect_target' in this.options) { - /* This is more or less how servername will be set in createSession - * if a connection is successfully established through the proxy. - * If the proxy is not used, these connectionOptions are discarded - * anyway */ - const targetPath = getDefaultAuthority( - parseUri(this.options['grpc.http_connect_target'] as string) ?? { - path: 'localhost', - } - ); - const hostPort = splitHostPort(targetPath); - connectionOptions.servername = hostPort?.host ?? targetPath; - } - } - } - - getProxiedConnection( - this.subchannelAddress, - this.options, - connectionOptions - ).then( - (result) => { - this.createSession(result); - }, - (reason) => { - this.transitionToState( - [ConnectivityState.CONNECTING], - ConnectivityState.TRANSIENT_FAILURE - ); - } - ); - } - - /** - * Initiate a state transition from any element of oldStates to the new - * state. If the current connectivityState is not in oldStates, do nothing. - * @param oldStates The set of states to transition from - * @param newState The state to transition to - * @returns True if the state changed, false otherwise - */ - private transitionToState( - oldStates: ConnectivityState[], - newState: ConnectivityState - ): boolean { - if (oldStates.indexOf(this.connectivityState) === -1) { - return false; - } - trace( - this.subchannelAddressString + - ' ' + - ConnectivityState[this.connectivityState] + - ' -> ' + - ConnectivityState[newState] - ); - const previousState = this.connectivityState; - this.connectivityState = newState; - switch (newState) { - case ConnectivityState.READY: - this.stopBackoff(); - this.session!.socket.once('close', () => { - for (const listener of this.disconnectListeners) { - listener(); - } - }); - if (this.keepaliveWithoutCalls) { - this.startKeepalivePings(); - } - break; - case ConnectivityState.CONNECTING: - this.startBackoff(); - this.startConnectingInternal(); - this.continueConnecting = false; - break; - case ConnectivityState.TRANSIENT_FAILURE: - if (this.session) { - this.session.close(); - } - this.session = null; - this.stopKeepalivePings(); - /* If the backoff timer has already ended by the time we get to the - * TRANSIENT_FAILURE state, we want to immediately transition out of - * TRANSIENT_FAILURE as though the backoff timer is ending right now */ - if (!this.backoffTimeout.isRunning()) { - process.nextTick(() => { - this.handleBackoffTimer(); - }); - } - break; - case ConnectivityState.IDLE: - if (this.session) { - this.session.close(); - } - this.session = null; - this.stopKeepalivePings(); - break; - default: - throw new Error(`Invalid state: unknown ConnectivityState ${newState}`); - } - /* We use a shallow copy of the stateListeners array in case a listener - * is removed during this iteration */ - for (const listener of [...this.stateListeners]) { - listener(this, previousState, newState); - } - return true; - } - - /** - * Check if the subchannel associated with zero calls and with zero channels. - * If so, shut it down. - */ - private checkBothRefcounts() { - /* If no calls, channels, or subchannel pools have any more references to - * this subchannel, we can be sure it will never be used again. */ - if (this.callRefcount === 0 && this.refcount === 0) { - this.transitionToState( - [ - ConnectivityState.CONNECTING, - ConnectivityState.IDLE, - ConnectivityState.READY, - ], - ConnectivityState.TRANSIENT_FAILURE - ); - } - } - - callRef() { - refTrace( - this.subchannelAddressString + - ' callRefcount ' + - this.callRefcount + - ' -> ' + - (this.callRefcount + 1) - ); - if (this.callRefcount === 0) { - if (this.session) { - this.session.ref(); - } - if (!this.keepaliveWithoutCalls) { - this.startKeepalivePings(); - } - } - this.callRefcount += 1; - } - - callUnref() { - refTrace( - this.subchannelAddressString + - ' callRefcount ' + - this.callRefcount + - ' -> ' + - (this.callRefcount - 1) - ); - this.callRefcount -= 1; - if (this.callRefcount === 0) { - if (this.session) { - this.session.unref(); - } - if (!this.keepaliveWithoutCalls) { - this.stopKeepalivePings(); - } - this.checkBothRefcounts(); - } - } - - ref() { - refTrace( - this.subchannelAddressString + - ' refcount ' + - this.refcount + - ' -> ' + - (this.refcount + 1) - ); - this.refcount += 1; - } - - unref() { - refTrace( - this.subchannelAddressString + - ' refcount ' + - this.refcount + - ' -> ' + - (this.refcount - 1) - ); - this.refcount -= 1; - this.checkBothRefcounts(); - } - - unrefIfOneRef(): boolean { - if (this.refcount === 1) { - this.unref(); - return true; - } - return false; - } - - /** - * Start a stream on the current session with the given `metadata` as headers - * and then attach it to the `callStream`. Must only be called if the - * subchannel's current connectivity state is READY. - * @param metadata - * @param callStream - */ - startCallStream( - metadata: Metadata, - callStream: Http2CallStream, - extraFilterFactory?: FilterFactory - ) { - const headers = metadata.toHttp2Headers(); - headers[HTTP2_HEADER_AUTHORITY] = callStream.getHost(); - headers[HTTP2_HEADER_USER_AGENT] = this.userAgent; - headers[HTTP2_HEADER_CONTENT_TYPE] = 'application/grpc'; - headers[HTTP2_HEADER_METHOD] = 'POST'; - headers[HTTP2_HEADER_PATH] = callStream.getMethod(); - headers[HTTP2_HEADER_TE] = 'trailers'; - let http2Stream: http2.ClientHttp2Stream; - /* In theory, if an error is thrown by session.request because session has - * become unusable (e.g. because it has received a goaway), this subchannel - * should soon see the corresponding close or goaway event anyway and leave - * READY. But we have seen reports that this does not happen - * (https://github.com/googleapis/nodejs-firestore/issues/1023#issuecomment-653204096) - * so for defense in depth, we just discard the session when we see an - * error here. - */ - try { - http2Stream = this.session!.request(headers); - } catch (e) { - this.transitionToState( - [ConnectivityState.READY], - ConnectivityState.TRANSIENT_FAILURE - ); - throw e; - } - let headersString = ''; - for (const header of Object.keys(headers)) { - headersString += '\t\t' + header + ': ' + headers[header] + '\n'; - } - logging.trace(LogVerbosity.DEBUG, 'call_stream', 'Starting stream on subchannel ' + this.subchannelAddressString + ' with headers\n' + headersString); - callStream.attachHttp2Stream(http2Stream, this, extraFilterFactory); - } - - /** - * If the subchannel is currently IDLE, start connecting and switch to the - * CONNECTING state. If the subchannel is current in TRANSIENT_FAILURE, - * the next time it would transition to IDLE, start connecting again instead. - * Otherwise, do nothing. - */ - startConnecting() { - /* First, try to transition from IDLE to connecting. If that doesn't happen - * because the state is not currently IDLE, check if it is - * TRANSIENT_FAILURE, and if so indicate that it should go back to - * connecting after the backoff timer ends. Otherwise do nothing */ - if ( - !this.transitionToState( - [ConnectivityState.IDLE], - ConnectivityState.CONNECTING - ) - ) { - if (this.connectivityState === ConnectivityState.TRANSIENT_FAILURE) { - this.continueConnecting = true; - } - } - } - - /** - * Get the subchannel's current connectivity state. - */ - getConnectivityState() { - return this.connectivityState; - } - - /** - * Add a listener function to be called whenever the subchannel's - * connectivity state changes. - * @param listener - */ - addConnectivityStateListener(listener: ConnectivityStateListener) { - this.stateListeners.push(listener); - } - - /** - * Remove a listener previously added with `addConnectivityStateListener` - * @param listener A reference to a function previously passed to - * `addConnectivityStateListener` - */ - removeConnectivityStateListener(listener: ConnectivityStateListener) { - const listenerIndex = this.stateListeners.indexOf(listener); - if (listenerIndex > -1) { - this.stateListeners.splice(listenerIndex, 1); - } - } - - addDisconnectListener(listener: () => void) { - this.disconnectListeners.push(listener); - } - - removeDisconnectListener(listener: () => void) { - const listenerIndex = this.disconnectListeners.indexOf(listener); - if (listenerIndex > -1) { - this.disconnectListeners.splice(listenerIndex, 1); - } - } - - /** - * Reset the backoff timeout, and immediately start connecting if in backoff. - */ - resetBackoff() { - this.backoffTimeout.reset(); - this.transitionToState( - [ConnectivityState.TRANSIENT_FAILURE], - ConnectivityState.CONNECTING - ); - } - - getAddress(): string { - return this.subchannelAddressString; - } -} diff --git a/node_modules/@grpc/grpc-js/src/tls-helpers.ts b/node_modules/@grpc/grpc-js/src/tls-helpers.ts deleted file mode 100644 index 3f7a62e7..00000000 --- a/node_modules/@grpc/grpc-js/src/tls-helpers.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import * as fs from 'fs'; - -export const CIPHER_SUITES: string | undefined = - process.env.GRPC_SSL_CIPHER_SUITES; - -const DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH; - -let defaultRootsData: Buffer | null = null; - -export function getDefaultRootsData(): Buffer | null { - if (DEFAULT_ROOTS_FILE_PATH) { - if (defaultRootsData === null) { - defaultRootsData = fs.readFileSync(DEFAULT_ROOTS_FILE_PATH); - } - return defaultRootsData; - } - return null; -} diff --git a/node_modules/@grpc/grpc-js/src/uri-parser.ts b/node_modules/@grpc/grpc-js/src/uri-parser.ts deleted file mode 100644 index 20c3d53b..00000000 --- a/node_modules/@grpc/grpc-js/src/uri-parser.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2020 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -export interface GrpcUri { - scheme?: string; - authority?: string; - path: string; -} - -/* - * The groups correspond to URI parts as follows: - * 1. scheme - * 2. authority - * 3. path - */ -const URI_REGEX = /^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/; - -export function parseUri(uriString: string): GrpcUri | null { - const parsedUri = URI_REGEX.exec(uriString); - if (parsedUri === null) { - return null; - } - return { - scheme: parsedUri[1], - authority: parsedUri[2], - path: parsedUri[3], - }; -} - -export interface HostPort { - host: string; - port?: number; -} - -const NUMBER_REGEX = /^\d+$/; - -export function splitHostPort(path: string): HostPort | null { - if (path.startsWith('[')) { - const hostEnd = path.indexOf(']'); - if (hostEnd === -1) { - return null; - } - const host = path.substring(1, hostEnd); - /* Only an IPv6 address should be in bracketed notation, and an IPv6 - * address should have at least one colon */ - if (host.indexOf(':') === -1) { - return null; - } - if (path.length > hostEnd + 1) { - if (path[hostEnd + 1] === ':') { - const portString = path.substring(hostEnd + 2); - if (NUMBER_REGEX.test(portString)) { - return { - host: host, - port: +portString, - }; - } else { - return null; - } - } else { - return null; - } - } else { - return { - host, - }; - } - } else { - const splitPath = path.split(':'); - /* Exactly one colon means that this is host:port. Zero colons means that - * there is no port. And multiple colons means that this is a bare IPv6 - * address with no port */ - if (splitPath.length === 2) { - if (NUMBER_REGEX.test(splitPath[1])) { - return { - host: splitPath[0], - port: +splitPath[1], - }; - } else { - return null; - } - } else { - return { - host: path, - }; - } - } -} - -export function uriToString(uri: GrpcUri): string { - let result = ''; - if (uri.scheme !== undefined) { - result += uri.scheme + ':'; - } - if (uri.authority !== undefined) { - result += '//' + uri.authority + '/'; - } - result += uri.path; - return result; -} diff --git a/node_modules/@grpc/proto-loader/LICENSE b/node_modules/@grpc/proto-loader/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/node_modules/@grpc/proto-loader/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@grpc/proto-loader/README.md b/node_modules/@grpc/proto-loader/README.md deleted file mode 100644 index 481b8629..00000000 --- a/node_modules/@grpc/proto-loader/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# gRPC Protobuf Loader - -A utility package for loading `.proto` files for use with gRPC, using the latest Protobuf.js package. -Please refer to [protobuf.js' documentation](https://github.com/dcodeIO/protobuf.js/blob/master/README.md) -to understands its features and limitations. - -## Installation - -```sh -npm install @grpc/proto-loader -``` - -## Usage - -```js -const protoLoader = require('@grpc/proto-loader'); -const grpcLibrary = require('grpc'); -// OR -const grpcLibrary = require('@grpc/grpc-js'); - -protoLoader.load(protoFileName, options).then(packageDefinition => { - const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition); -}); -// OR -const packageDefinition = protoLoader.loadSync(protoFileName, options); -const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition); -``` - -The options parameter is an object that can have the following optional properties: - -| Field name | Valid values | Description -|------------|--------------|------------ -| `keepCase` | `true` or `false` | Preserve field names. The default is to change them to camel case. -| `longs` | `String` or `Number` | The type to use to represent `long` values. Defaults to a `Long` object type. -| `enums` | `String` | The type to use to represent `enum` values. Defaults to the numeric value. -| `bytes` | `Array` or `String` | The type to use to represent `bytes` values. Defaults to `Buffer`. -| `defaults` | `true` or `false` | Set default values on output objects. Defaults to `false`. -| `arrays` | `true` or `false` | Set empty arrays for missing array values even if `defaults` is `false` Defaults to `false`. -| `objects` | `true` or `false` | Set empty objects for missing object values even if `defaults` is `false` Defaults to `false`. -| `oneofs` | `true` or `false` | Set virtual oneof properties to the present field's name. Defaults to `false`. -| `includeDirs` | An array of strings | A list of search paths for imported `.proto` files. - -The following options object closely approximates the existing behavior of `grpc.load`: - -```js -const options = { - keepCase: true, - longs: String, - enums: String, - defaults: true, - oneofs: true -} -``` diff --git a/node_modules/@grpc/proto-loader/build/src/index.d.ts b/node_modules/@grpc/proto-loader/build/src/index.d.ts deleted file mode 100644 index a4e0dc79..00000000 --- a/node_modules/@grpc/proto-loader/build/src/index.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/// -import * as Protobuf from 'protobufjs'; -import * as descriptor from 'protobufjs/ext/descriptor'; -declare module 'protobufjs' { - interface Type { - toDescriptor(protoVersion: string): Protobuf.Message & descriptor.IDescriptorProto; - } - interface Root { - toDescriptor(protoVersion: string): Protobuf.Message & descriptor.IFileDescriptorSet; - } - interface Enum { - toDescriptor(protoVersion: string): Protobuf.Message & descriptor.IEnumDescriptorProto; - } -} -export interface Serialize { - (value: T): Buffer; -} -export interface Deserialize { - (bytes: Buffer): T; -} -export interface ProtobufTypeDefinition { - format: string; - type: object; - fileDescriptorProtos: Buffer[]; -} -export interface MessageTypeDefinition extends ProtobufTypeDefinition { - format: 'Protocol Buffer 3 DescriptorProto'; -} -export interface EnumTypeDefinition extends ProtobufTypeDefinition { - format: 'Protocol Buffer 3 EnumDescriptorProto'; -} -export interface MethodDefinition { - path: string; - requestStream: boolean; - responseStream: boolean; - requestSerialize: Serialize; - responseSerialize: Serialize; - requestDeserialize: Deserialize; - responseDeserialize: Deserialize; - originalName?: string; - requestType: MessageTypeDefinition; - responseType: MessageTypeDefinition; -} -export interface ServiceDefinition { - [index: string]: MethodDefinition; -} -export declare type AnyDefinition = ServiceDefinition | MessageTypeDefinition | EnumTypeDefinition; -export interface PackageDefinition { - [index: string]: AnyDefinition; -} -export declare type Options = Protobuf.IParseOptions & Protobuf.IConversionOptions & { - includeDirs?: string[]; -}; -/** - * Load a .proto file with the specified options. - * @param filename One or multiple file paths to load. Can be an absolute path - * or relative to an include path. - * @param options.keepCase Preserve field names. The default is to change them - * to camel case. - * @param options.longs The type that should be used to represent `long` values. - * Valid options are `Number` and `String`. Defaults to a `Long` object type - * from a library. - * @param options.enums The type that should be used to represent `enum` values. - * The only valid option is `String`. Defaults to the numeric value. - * @param options.bytes The type that should be used to represent `bytes` - * values. Valid options are `Array` and `String`. The default is to use - * `Buffer`. - * @param options.defaults Set default values on output objects. Defaults to - * `false`. - * @param options.arrays Set empty arrays for missing array values even if - * `defaults` is `false`. Defaults to `false`. - * @param options.objects Set empty objects for missing object values even if - * `defaults` is `false`. Defaults to `false`. - * @param options.oneofs Set virtual oneof properties to the present field's - * name - * @param options.includeDirs Paths to search for imported `.proto` files. - */ -export declare function load(filename: string | string[], options?: Options): Promise; -export declare function loadSync(filename: string | string[], options?: Options): PackageDefinition; diff --git a/node_modules/@grpc/proto-loader/build/src/index.js b/node_modules/@grpc/proto-loader/build/src/index.js deleted file mode 100644 index 637eefe0..00000000 --- a/node_modules/@grpc/proto-loader/build/src/index.js +++ /dev/null @@ -1,234 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * @license - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -const fs = require("fs"); -const path = require("path"); -const Protobuf = require("protobufjs"); -const descriptor = require("protobufjs/ext/descriptor"); -const camelCase = require("lodash.camelcase"); -const descriptorOptions = { - longs: String, - enums: String, - bytes: String, - defaults: true, - oneofs: true, - json: true, -}; -function joinName(baseName, name) { - if (baseName === '') { - return name; - } - else { - return baseName + '.' + name; - } -} -function isHandledReflectionObject(obj) { - return (obj instanceof Protobuf.Service || - obj instanceof Protobuf.Type || - obj instanceof Protobuf.Enum); -} -function isNamespaceBase(obj) { - return obj instanceof Protobuf.Namespace || obj instanceof Protobuf.Root; -} -function getAllHandledReflectionObjects(obj, parentName) { - const objName = joinName(parentName, obj.name); - if (isHandledReflectionObject(obj)) { - return [[objName, obj]]; - } - else { - if (isNamespaceBase(obj) && typeof obj.nested !== 'undefined') { - return Object.keys(obj.nested) - .map(name => { - return getAllHandledReflectionObjects(obj.nested[name], objName); - }) - .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []); - } - } - return []; -} -function createDeserializer(cls, options) { - return function deserialize(argBuf) { - return cls.toObject(cls.decode(argBuf), options); - }; -} -function createSerializer(cls) { - return function serialize(arg) { - const message = cls.fromObject(arg); - return cls.encode(message).finish(); - }; -} -function createMethodDefinition(method, serviceName, options, fileDescriptors) { - /* This is only ever called after the corresponding root.resolveAll(), so we - * can assume that the resolved request and response types are non-null */ - const requestType = method.resolvedRequestType; - const responseType = method.resolvedResponseType; - return { - path: '/' + serviceName + '/' + method.name, - requestStream: !!method.requestStream, - responseStream: !!method.responseStream, - requestSerialize: createSerializer(requestType), - requestDeserialize: createDeserializer(requestType, options), - responseSerialize: createSerializer(responseType), - responseDeserialize: createDeserializer(responseType, options), - // TODO(murgatroid99): Find a better way to handle this - originalName: camelCase(method.name), - requestType: createMessageDefinition(requestType, fileDescriptors), - responseType: createMessageDefinition(responseType, fileDescriptors), - }; -} -function createServiceDefinition(service, name, options, fileDescriptors) { - const def = {}; - for (const method of service.methodsArray) { - def[method.name] = createMethodDefinition(method, name, options, fileDescriptors); - } - return def; -} -function createMessageDefinition(message, fileDescriptors) { - const messageDescriptor = message.toDescriptor('proto3'); - return { - format: 'Protocol Buffer 3 DescriptorProto', - type: messageDescriptor.$type.toObject(messageDescriptor, descriptorOptions), - fileDescriptorProtos: fileDescriptors, - }; -} -function createEnumDefinition(enumType, fileDescriptors) { - const enumDescriptor = enumType.toDescriptor('proto3'); - return { - format: 'Protocol Buffer 3 EnumDescriptorProto', - type: enumDescriptor.$type.toObject(enumDescriptor, descriptorOptions), - fileDescriptorProtos: fileDescriptors, - }; -} -/** - * function createDefinition(obj: Protobuf.Service, name: string, options: - * Options): ServiceDefinition; function createDefinition(obj: Protobuf.Type, - * name: string, options: Options): MessageTypeDefinition; function - * createDefinition(obj: Protobuf.Enum, name: string, options: Options): - * EnumTypeDefinition; - */ -function createDefinition(obj, name, options, fileDescriptors) { - if (obj instanceof Protobuf.Service) { - return createServiceDefinition(obj, name, options, fileDescriptors); - } - else if (obj instanceof Protobuf.Type) { - return createMessageDefinition(obj, fileDescriptors); - } - else if (obj instanceof Protobuf.Enum) { - return createEnumDefinition(obj, fileDescriptors); - } - else { - throw new Error('Type mismatch in reflection object handling'); - } -} -function createPackageDefinition(root, options) { - const def = {}; - root.resolveAll(); - const descriptorList = root.toDescriptor('proto3').file; - const bufferList = descriptorList.map(value => Buffer.from(descriptor.FileDescriptorProto.encode(value).finish())); - for (const [name, obj] of getAllHandledReflectionObjects(root, '')) { - def[name] = createDefinition(obj, name, options, bufferList); - } - return def; -} -function addIncludePathResolver(root, includePaths) { - const originalResolvePath = root.resolvePath; - root.resolvePath = (origin, target) => { - if (path.isAbsolute(target)) { - return target; - } - for (const directory of includePaths) { - const fullPath = path.join(directory, target); - try { - fs.accessSync(fullPath, fs.constants.R_OK); - return fullPath; - } - catch (err) { - continue; - } - } - process.emitWarning(`${target} not found in any of the include paths ${includePaths}`); - return originalResolvePath(origin, target); - }; -} -/** - * Load a .proto file with the specified options. - * @param filename One or multiple file paths to load. Can be an absolute path - * or relative to an include path. - * @param options.keepCase Preserve field names. The default is to change them - * to camel case. - * @param options.longs The type that should be used to represent `long` values. - * Valid options are `Number` and `String`. Defaults to a `Long` object type - * from a library. - * @param options.enums The type that should be used to represent `enum` values. - * The only valid option is `String`. Defaults to the numeric value. - * @param options.bytes The type that should be used to represent `bytes` - * values. Valid options are `Array` and `String`. The default is to use - * `Buffer`. - * @param options.defaults Set default values on output objects. Defaults to - * `false`. - * @param options.arrays Set empty arrays for missing array values even if - * `defaults` is `false`. Defaults to `false`. - * @param options.objects Set empty objects for missing object values even if - * `defaults` is `false`. Defaults to `false`. - * @param options.oneofs Set virtual oneof properties to the present field's - * name - * @param options.includeDirs Paths to search for imported `.proto` files. - */ -function load(filename, options) { - const root = new Protobuf.Root(); - options = options || {}; - if (!!options.includeDirs) { - if (!Array.isArray(options.includeDirs)) { - return Promise.reject(new Error('The includeDirs option must be an array')); - } - addIncludePathResolver(root, options.includeDirs); - } - return root.load(filename, options).then(loadedRoot => { - loadedRoot.resolveAll(); - return createPackageDefinition(root, options); - }); -} -exports.load = load; -function loadSync(filename, options) { - const root = new Protobuf.Root(); - options = options || {}; - if (!!options.includeDirs) { - if (!Array.isArray(options.includeDirs)) { - throw new Error('The includeDirs option must be an array'); - } - addIncludePathResolver(root, options.includeDirs); - } - const loadedRoot = root.loadSync(filename, options); - loadedRoot.resolveAll(); - return createPackageDefinition(root, options); -} -exports.loadSync = loadSync; -// Load Google's well-known proto files that aren't exposed by Protobuf.js. -// Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp, -// and wrappers. compiler/plugin is excluded in Protobuf.js and here. -// Using constant strings for compatibility with tools like Webpack -const apiDescriptor = require('protobufjs/google/protobuf/api.json'); -const descriptorDescriptor = require('protobufjs/google/protobuf/descriptor.json'); -const sourceContextDescriptor = require('protobufjs/google/protobuf/source_context.json'); -const typeDescriptor = require('protobufjs/google/protobuf/type.json'); -Protobuf.common('api', apiDescriptor.nested.google.nested.protobuf.nested); -Protobuf.common('descriptor', descriptorDescriptor.nested.google.nested.protobuf.nested); -Protobuf.common('source_context', sourceContextDescriptor.nested.google.nested.protobuf.nested); -Protobuf.common('type', typeDescriptor.nested.google.nested.protobuf.nested); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@grpc/proto-loader/package.json b/node_modules/@grpc/proto-loader/package.json deleted file mode 100644 index aa192962..00000000 --- a/node_modules/@grpc/proto-loader/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "_from": "@grpc/proto-loader@^0.5.5", - "_id": "@grpc/proto-loader@0.5.5", - "_inBundle": false, - "_integrity": "sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ==", - "_location": "/@grpc/proto-loader", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@grpc/proto-loader@^0.5.5", - "name": "@grpc/proto-loader", - "escapedName": "@grpc%2fproto-loader", - "scope": "@grpc", - "rawSpec": "^0.5.5", - "saveSpec": null, - "fetchSpec": "^0.5.5" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz", - "_shasum": "6725e7a1827bdf8e92e29fbf4e9ef0203c0906a9", - "_spec": "@grpc/proto-loader@^0.5.5", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "Google Inc." - }, - "bugs": { - "url": "https://github.com/grpc/grpc-node/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Michael Lumish", - "email": "mlumish@google.com" - } - ], - "dependencies": { - "lodash.camelcase": "^4.3.0", - "protobufjs": "^6.8.6" - }, - "deprecated": false, - "description": "gRPC utility library for loading .proto files", - "devDependencies": { - "@types/lodash.camelcase": "^4.3.4", - "@types/node": "^10.12.5", - "clang-format": "^1.2.2", - "gts": "^1.1.0", - "rimraf": "^3.0.2", - "typescript": "~3.3.3333" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "LICENSE", - "build/src/*.d.ts", - "build/src/*.js" - ], - "homepage": "https://grpc.io/", - "license": "Apache-2.0", - "main": "build/src/index.js", - "name": "@grpc/proto-loader", - "repository": { - "type": "git", - "url": "git+https://github.com/grpc/grpc-node.git" - }, - "scripts": { - "build": "npm run compile", - "check": "gts check", - "clean": "node -e 'require(\"rimraf\")(\"./build\", () => {})'", - "compile": "tsc -p .", - "fix": "gts fix", - "format": "clang-format -i -style=\"{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}\" src/*.ts test/*.ts", - "lint": "tslint -c node_modules/google-ts-style/tslint.json -p . -t codeFrame --type-check", - "posttest": "npm run check", - "prepare": "npm run compile", - "pretest": "npm run compile", - "test": "gulp test" - }, - "typings": "build/src/index.d.ts", - "version": "0.5.5" -} diff --git a/node_modules/@newrelic/aws-sdk/CHANGELOG.md b/node_modules/@newrelic/aws-sdk/CHANGELOG.md deleted file mode 100644 index ede78b91..00000000 --- a/node_modules/@newrelic/aws-sdk/CHANGELOG.md +++ /dev/null @@ -1,93 +0,0 @@ -### 3.0.0 (2020-11-02): - -* Removed Node v8.x from CI. -* Added Node v14.x to CI. -* Update README for consistency with New Relic OSS repositories -* Remove Code of Conduct doc and link to New Relic org Code of Conduct in - Contributing doc. - -### 2.0.0 (2020-08-03): - -* Updated to Apache 2.0 license. -* Bumped minimum peer dependency (and dev dependency) of newrelic (agent) to 6.11 for license matching. -* Added third party notices file and metadata for dependencies. -* Updated README with more detail. -* Added issue templates for bugs and enhancements. -* Added code of conduct file. -* Added contributing guide. -* Added pull request template. -* Migrated CI to GitHub Actions. -* Added copyright headers to all source files. -* Bumped @newrelic/test-utils to 4.0.0 -* Added additional items to .npmignore. -* Removed AWS servers as dependency for versioned tests. - Enables versioned test to run successfully for forked repo PRs. - -### 1.1.3 (2020-06-12): - -* Fixed issue where instrumentation would produce a `TypeError: Cannot read property 'lastIndexOf' of undefined` error if a program called `sqs.receiveMessage` without a `QueueUrl` parameter. - -### 1.1.2 (2020-02-20): - -* Fixed issue where instrumentation would crash pulling `host` and `port` values when `AmazonDaxClient` was used as the service for `DocumentClient.` - - `AmazonDaxClient` requests will report 'unknown' for `host` and `port` attributes. Other oddities may still exist until DAX officially supported. - -### 1.1.1 (2020-01-27): - -* Bumps DynamoDB tap.test timeout to avoid versioned test terminations when table creates are slow. - -### 1.1.0 (2020-01-23): - -* Adds official support for API promise calls. - For example: `await ddb.createTable(params).promise()`. - - * Fixed issue where external spans/segments would be incorrectly created in addition to more specific types such as datastore spans/segments. This also resulted in missing attributes from the more specific spans/segments. - * Fixed issue where spans/segments would not have timing update appropriately upon promise resolution. These would show sub-millisecond execution time as the time captured was the execution of the initial function not accounting for async execution. - -* Adds check before applying instrumentation to avoid breaking for very old versions of `aws-sdk`. - -### 1.0.0 (2019-10-25): - -* **BREAKING** Removed support for Node 6, 7, and 9. - - The minimum supported version is now Node v8. For further information on our support policy, see: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent. - -### 0.3.0 (2019-07-18): - -* Adds support for DocumentClient API calls to be captured as Datastore segments/metrics. - - Supported calls are: `get`, `put`, `update`, `delete`, `query` and `scan`. These will be named according to the underlying DynamoDB operation that is executed. For example: `get` will be named `getItem`. DocumentClient calls not listed above will still be captured as Externals. - -* Fixed issue that would prevent multiple DynamoDB instances from being instrumented. - -* Replaced `database_name` with `collection` in DynamoDB attributes. - -* Moved `name` property to the root of DynamoDB segment description object. - - Previously, segments were being incorrectly named `"Datastore/operation/DynamoDB/undefined"`, due to the operation name being misplaced. - - -### 0.2.0 (2019-02-19): - -* Added instrumentation for SNS `publish` API. - -* Added instrumentation for SQS `sendMessage`, `sendMessageBatch` and - `receiveMessageBatch` APIs. - - -### 0.1.0 (2019-02-13): - -* Added instrumentation for services to be recorded as HTTP externals. - - * APIGateway - * ELB - * ElastiCache - * Lambda - * RDS - * Redshift - * Rekognition - * S3 - * SES - -* Added instrumentation for DynamoDB. diff --git a/node_modules/@newrelic/aws-sdk/CONTRIBUTING.md b/node_modules/@newrelic/aws-sdk/CONTRIBUTING.md deleted file mode 100644 index a18fd61d..00000000 --- a/node_modules/@newrelic/aws-sdk/CONTRIBUTING.md +++ /dev/null @@ -1,101 +0,0 @@ -# Guidelines for Contributing Code - -New Relic welcomes code contributions by the Node community to this module, and -have taken effort to make this process easy for both contributors and our -development team. - -## Feature Requests - -Feature requests should be submitted in the [Issue tracker](../../issues), with -a description of the expected behavior & use case. Before submitting an Issue, -please search for similar ones in the [closed -issues](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement). - -## Pull Requests - -We can only accept PRs for version v2.0.0 or greater due to open source -licensing restrictions. - -## Code of Conduct - -Before contributing please read the [code of conduct](https://github.com/newrelic/.github/blob/main/CODE_OF_CONDUCT.md) - -Note that our [code of conduct](https://github.com/newrelic/.github/blob/main/CODE_OF_CONDUCT.md) applies to all platforms -and venues related to this project; please follow it in all your interactions -with the project and its participants. - -## Contributor License Agreement - -Keep in mind that when you submit your Pull Request, you'll need to sign the -CLA via the click-through using CLA-Assistant. If you'd like to execute our -corporate CLA, or if you have any questions, please drop us an email at -opensource@newrelic.com. - -For more information about CLAs, please check out Alex Russell’s excellent -post, [“Why Do I Need to Sign -This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/). - -## Slack - -We host a public Slack with a dedicated channel for contributors and -maintainers of open source projects hosted by New Relic. If you are -contributing to this project, you're welcome to request access to the -\#oss-contributors channel in the newrelicusers.slack.com workspace. To request -access, see https://newrelicusers-signup.herokuapp.com/. - -## PR Guidelines - -### Version Support - -When contributing, keep in mind that New Relic customers (that's you!) are running many different versions of Node, some of them pretty old. Changes that depend on the newest version of Node will probably be rejected, especially if they replace something backwards compatible. - -Be aware that the instrumentation needs to work with a wide range of versions of the instrumented modules, and that code that looks nonsensical or overcomplicated may be that way for compatibility-related reasons. Read all the comments and check the related tests before deciding whether existing code is incorrect. - -If you’re planning on contributing a new feature or an otherwise complex contribution, we kindly ask you to start a conversation with the maintainer team by opening up an Github issue first. - -### General Guidelines - -In general, we try to limit adding third-party production dependencies. If one is necessary, please be prepared to make a clear case for the need. - -### Coding Style Guidelines/Conventions - -We use eslint to enforce certain coding standards. Please see our [.eslintrc](./.eslintrc.js) file for specific rule configuration. - -### Testing Guidelines - -The aws-sdk instrumentation module includes a suite of unit and functional tests which should be used to -verify your changes don't break existing functionality. - -Unit tests are stored in `tests/`. They're written in -[node-tap](https://github.com/isaacs/node-tap), and have the extension `.tap.js`. - -Functional tests against specific versions of instrumented modules are stored -in `test/versioned/`. They are also written in `node-tap`. - -#### Running Tests - -Running the test suite is simple. Just run: - - npm test - -This will install all the necessary modules and run the unit tests in standalone mode, followed by -the functional tests if all of the unit tests pass. - -To just run unit tests, run the following: - - npm run unit - -#### Writing Tests - -For most contributions it is strongly recommended to add additional tests which -exercise your changes. This helps us efficiently incorporate your changes into -our mainline codebase and provides a safeguard that your change won't be broken -by future development. Because of this, we require that all changes come with -tests. You are welcome to submit pull requests with untested changes, but they -won't be merged until you or the development team have an opportunity to write -tests for them. - -There are some rare cases where code changes do not result in changed -functionality (e.g. a performance optimization) and new tests are not required. -In general, including tests with your pull request dramatically increases the -chances it will be accepted. \ No newline at end of file diff --git a/node_modules/@newrelic/aws-sdk/LICENSE b/node_modules/@newrelic/aws-sdk/LICENSE deleted file mode 100644 index f49a4e16..00000000 --- a/node_modules/@newrelic/aws-sdk/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/node_modules/@newrelic/aws-sdk/README.md b/node_modules/@newrelic/aws-sdk/README.md deleted file mode 100644 index 3a9478de..00000000 --- a/node_modules/@newrelic/aws-sdk/README.md +++ /dev/null @@ -1,88 +0,0 @@ -[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus) - -# New Relic AWS SDK Instrumentation [![aws-sdk Instrumentation CI][1]][2] - -New Relic's official AWS SDK package instrumentation for use with [the Node.js agent](https://github.com/newrelic/node-newrelic). Provides instrumentation for the [AWS SDK (`aws-sdk`)](https://www.npmjs.com/package/aws-sdk) npm package. - -## Installation - -This package is [a dependency of the the Node Agent](https://github.com/newrelic/node-newrelic/blob/2121ffdc5001ea1bf9ab473138b9446c1f2a7eef/package.json#L147), and the average user should not need to install it manually. - -If you are not the average user, you can add this package to your project using your package manager of choice (`npm` below), and then `require` the module into your project. - -``` -$ npm install @newrelic/aws-sdk -``` - -```javascript -// index.js -require('@newrelic/aws-sdk') -``` - -## Getting Started - -Our instrumentation automatically tracks all SDK calls as "external" activities. In addition, the following have more specific instrumentation to capture additional data store or queue information. - -- Amazon DynamoDB -- Amazon Simple Notification Service (SNS) -- Amazon Simple Queue Service (SQS) - -## Testing - -This module includes a list of unit and functional tests. To run these tests, use the following command - - $ npm run test - -You may also run individual test suites with the following commands - - $ npm run unit - $ npm run versioned - -## Support - -Should you need assistance with New Relic products, you are in good hands with several support channels. - -If the issue has been confirmed as a bug or is a feature request, please file a GitHub issue. - -**Support Channels** - -* [New Relic and AWS](https://docs.newrelic.com/docs/accounts/install-new-relic/partner-based-installation/new-relic-aws-amazon-web-services). AWS specific agent documentation -* [New Relic Documentation](https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/introduction-new-relic-nodejs): Comprehensive guidance for using our platform -* [New Relic Community](https://discuss.newrelic.com/c/support-products-agents/node-js-agent/): The best place to engage in troubleshooting questions -* [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications -* [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level -* [New Relic Technical Support](https://support.newrelic.com/) 24/7/365 ticketed support. Read more about our [Technical Support Offerings](https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/support-plan). - -## Privacy - -At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise. - -We define "Personal Data" as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address and email address. - -Please review [New Relic’s General Data Privacy Notice](https://newrelic.com/termsandconditions/privacy) for more information. - -## Roadmap -See our [roadmap](https://github.com/newrelic/node-newrelic/blob/main/ROADMAP_Node.md), to learn more about our product vision, understand our plans, and provide us valuable feedback. - -## Contribute - -We encourage your contributions to improve New Relic's AWS SDK Instrumentation! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. - -If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com. - -**A note about vulnerabilities** - -As noted in our [security policy](https://github.com/newrelic/node-newrelic-aws-sdk/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals. - -If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic). - -If you would like to contribute to this project, please review [these guidelines](https://github.com/newrelic/node-newrelic-aws-sdk/blob/main/CONTRIBUTING.md). - -To [all contributors](https://github.com/newrelic/node-newrelic-aws-sdk/graphs/contributors), we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to -the [New Relic AWS SDK Instrumentation](https://opensource.newrelic.com/newrelic/node-newrelic-aws-sdk) package. - -## License -The New Relic AWS SDK Instrumentation package is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License. - -[1]: https://github.com/newrelic/node-newrelic-aws-sdk/workflows/aws-sdk%20Instrumentation%20CI/badge.svg -[2]: https://github.com/newrelic/node-newrelic-aws-sdk/actions?query=workflow%3A%22aws-sdk+Instrumentation+CI%22 diff --git a/node_modules/@newrelic/aws-sdk/THIRD_PARTY_NOTICES.md b/node_modules/@newrelic/aws-sdk/THIRD_PARTY_NOTICES.md deleted file mode 100644 index c42d6af1..00000000 --- a/node_modules/@newrelic/aws-sdk/THIRD_PARTY_NOTICES.md +++ /dev/null @@ -1,778 +0,0 @@ -# Third Party Notices - -The New Relic AWS-SDK Instrumentation uses source code from third party libraries which carry -their own copyright notices and license terms. These notices are provided -below. - -In the event that a required notice is missing or incorrect, please notify us -by e-mailing [open-source@newrelic.com](mailto:open-source@newrelic.com). - -For any licenses that require the disclosure of source -code, the source code can be found at [https://github.com/newrelic/node-newrelic-aws-sdk](https://github.com/newrelic/node-newrelic-aws-sdk). - -## Content - -**[dependencies](#dependencies)** - - -**[devDependencies](#devDependencies)** - -* [@newrelic/test-utilities](#newrelictest-utilities) -* [async](#async) -* [aws-sdk](#aws-sdk) -* [eslint](#eslint) -* [newrelic](#newrelic) -* [sinon](#sinon) -* [tap](#tap) - - -## dependencies - - -## devDependencies - -### @newrelic/test-utilities - -This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v4.1.2](https://github.com/newrelic/node-test-utilities/tree/v4.1.2)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v4.1.2/LICENSE): - -``` - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -``` - -### async - -This product includes source derived from [async](https://github.com/caolan/async) ([v2.6.3](https://github.com/caolan/async/tree/v2.6.3)), distributed under the [MIT License](https://github.com/caolan/async/blob/v2.6.3/LICENSE): - -``` -Copyright (c) 2010-2018 Caolan McMahon - -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. - -``` - -### aws-sdk - -This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.561.0](https://github.com/aws/aws-sdk-js/tree/v2.561.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js/blob/v2.561.0/LICENSE.txt): - -``` - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -``` - -### eslint - -This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v5.16.0](https://github.com/eslint/eslint/tree/v5.16.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v5.16.0/LICENSE): - -``` -Copyright JS Foundation and other contributors, https://js.foundation - -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. - -``` - -### newrelic - -This product includes source derived from [newrelic](https://github.com/newrelic/node-newrelic) ([v6.14.0](https://github.com/newrelic/node-newrelic/tree/v6.14.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic/blob/v6.14.0/LICENSE): - -``` - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -``` - -### sinon - -This product includes source derived from [sinon](https://github.com/sinonjs/sinon) ([v7.5.0](https://github.com/sinonjs/sinon/tree/v7.5.0)), distributed under the [BSD-3-Clause License](https://github.com/sinonjs/sinon/blob/v7.5.0/LICENSE): - -``` -(The BSD License) - -Copyright (c) 2010-2017, Christian Johansen, christian@cjohansen.no -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of Christian Johansen nor the names of his contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -``` - -### tap - -This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v12.7.0](https://github.com/tapjs/node-tap/tree/v12.7.0)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v12.7.0/LICENSE): - -``` -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - -``` - ------ - -Portions copyright Node.js contributors. Depending on your existing libraries and package management settings, -your systems may call externally maintained libraries in addition to those listed above. -See [here](https://nodejs.org/en/docs/meta/topics/dependencies/) and [here](https://github.com/nodejs/node/blob/v4.3.1/LICENSE) -for additional details regarding externally maintained libraries and certain related licenses and notices.” \ No newline at end of file diff --git a/node_modules/@newrelic/aws-sdk/index.js b/node_modules/@newrelic/aws-sdk/index.js deleted file mode 100644 index 42c6b734..00000000 --- a/node_modules/@newrelic/aws-sdk/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -/** - * Allows users to `require('@newrelic/aws-sdk')` directly in their app. If they - * for some reason choose to explicitly use an older version of our instrumentation - * then the supportability metrics for custom instrumentation will trigger. - */ -const newrelic = require('newrelic') -newrelic.instrumentConglomerate('aws-sdk', require('./lib/instrumentation')) diff --git a/node_modules/@newrelic/aws-sdk/lib/core.js b/node_modules/@newrelic/aws-sdk/lib/core.js deleted file mode 100644 index d46b301c..00000000 --- a/node_modules/@newrelic/aws-sdk/lib/core.js +++ /dev/null @@ -1,109 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const UNKNOWN = 'Unknown' - -function validate(shim, AWS) { - if (!shim.isFunction(AWS.NodeHttpClient)) { - shim.logger.debug('Could not find NodeHttpClient, not instrumenting.') - return false - } - if ( - !shim.isFunction(AWS.Service) || - !shim.isFunction(AWS.Service.prototype.makeRequest) - ) { - shim.logger.debug('Could not find AWS.Service#makeRequest, not instrumenting.') - return false - } - return true -} - -function instrument(shim, AWS) { - shim.wrap(AWS.NodeHttpClient.prototype, 'handleRequest', wrapHandleRequest) - shim.wrapReturn(AWS.Service.prototype, 'makeRequest', wrapMakeRequest) -} - -function wrapHandleRequest(shim, handleRequest) { - return function wrappedHandleRequest(httpRequest) { - if (httpRequest) { - if (!httpRequest.headers) { - httpRequest.headers = Object.create(null) - } - httpRequest.headers[shim.DISABLE_DT] = true - } else { - shim.logger.debug('Unknown arguments to AWS.NodeHttpClient#handleRequest!') - } - - return handleRequest.apply(this, arguments) - } -} - -function wrapMakeRequest(shim, fn, name, request) { - if (!request) { - shim.logger.trace('No request object returned from Service#makeRequest') - return - } - - const service = getServiceName(this) - const region = this.config && this.config.region - request.on('complete', function onAwsRequestComplete() { - const httpRequest = request.httpRequest && request.httpRequest.stream - const segment = shim.getSegment(httpRequest) - if (!httpRequest || !segment) { - shim.logger.trace('No segment found for request, not extracting information.') - return - } - - const requestRegion = request.httpRequest.region - const requestId = request.response && request.response.requestId - - segment.addAttribute('aws.operation', request.operation || UNKNOWN) - segment.addAttribute('aws.requestId', requestId || UNKNOWN) - segment.addAttribute('aws.service', service || UNKNOWN) - segment.addAttribute('aws.region', requestRegion || region || UNKNOWN) - }) - - shim.wrap(request, 'promise', function wrapPromiseFunc(shim, original) { - const activeSegment = shim.getActiveSegment() - - return function wrappedPromiseFunc() { - if (!activeSegment) { - return original.apply(this, arguments) - } - - const promise = shim.applySegment(original, activeSegment, false, this, arguments) - - // TODO: convert to shim.bindPromise() once released. - return shim.interceptPromise(promise, function thenTouch() { - activeSegment.opaque = false - activeSegment.touch() - }) - } - }) -} - -function getServiceName(service) { - if (service.api && (service.api.abbreviation || service.api.serviceId)) { - return service.api.abbreviation || service.api.serviceId - } - - // In theory, getting the `constructor.prototype` should be redundant with - // checking `service`. However, the aws-sdk dynamically generates classes and - // doing this deep check was the recommended method by the maintainers. - const constructor = service.constructor - const api = constructor && constructor.prototype && constructor.prototype.api - if (api) { - return api.abbreviation || api.serviceId - } - return null -} - -module.exports = { - name: 'core', - type: 'generic', - validate, - instrument -} diff --git a/node_modules/@newrelic/aws-sdk/lib/dynamodb.js b/node_modules/@newrelic/aws-sdk/lib/dynamodb.js deleted file mode 100644 index ae08db9c..00000000 --- a/node_modules/@newrelic/aws-sdk/lib/dynamodb.js +++ /dev/null @@ -1,95 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const DDB_OPERATIONS = [ - 'putItem', - 'getItem', - 'updateItem', - 'deleteItem', - 'createTable', - 'deleteTable', - 'query', - 'scan' -] - -const DOC_CLIENT_OPERATIONS = [ - 'get', - 'put', - 'update', - 'delete', - 'query', - 'scan' -] - -function instrument(shim, AWS) { - shim.setDatastore(shim.DYNAMODB) - - // DynamoDB's service API methods are dynamically generated - // in the constructor so we have to wrap the return. - shim.wrapReturn(AWS, 'DynamoDB', function wrapDynamo(shim, fn, name, ddb) { - shim.recordOperation( - ddb, - DDB_OPERATIONS, - function wrapMethod(shim, original, operationName, args) { - const params = args[0] - - return { - name: operationName, - parameters: { - host: this.endpoint && this.endpoint.host, - port_path_or_id: this.endpoint && this.endpoint.port, - collection: params && params.TableName || 'Unknown' - }, - callback: shim.LAST, - opaque: true - } - } - ) - }) - - // DocumentClient's API is predefined so we can instrument the prototype. - // DocumentClient does defer to DynamoDB but it also does enough individual - // steps for the request we want to hide that instrumenting specifically and - // setting to opaque is currently required. - const docClientProto = AWS.DynamoDB.DocumentClient.prototype - shim.recordOperation( - docClientProto, - DOC_CLIENT_OPERATIONS, - function wrapOperation(shim, original, operationName, args) { - const params = args[0] - const dynamoOperation = this.serviceClientOperationsMap[operationName] - - // DocumentClient can be defined with a different service such as AmazonDaxClient. - // In these cases, an endpoint property may not exist. In the DAX case, - // the eventual cached endpoint to be hit is not known at this point. - const endpoint = this.service && this.service.endpoint - - return { - name: dynamoOperation, - parameters: { - host: endpoint && endpoint.host, - port_path_or_id: endpoint && endpoint.port, - collection: params && params.TableName || 'Unknown' - }, - callback: shim.LAST, - opaque: true - } - } - ) -} - -module.exports = { - name: 'dynamodb', - type: 'datastore', - instrument, - validate: (shim, AWS) => { - if (!shim.isFunction(AWS.DynamoDB)) { - shim.logger.debug('Could not find DynamoDB, not instrumenting.') - return false - } - return true - } -} diff --git a/node_modules/@newrelic/aws-sdk/lib/instrumentation-helper.js b/node_modules/@newrelic/aws-sdk/lib/instrumentation-helper.js deleted file mode 100644 index eeb435c7..00000000 --- a/node_modules/@newrelic/aws-sdk/lib/instrumentation-helper.js +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -/** - * Series of tests to determine if the library - * has the features needed to provide instrumentation - */ -const instrumentationSupported = function instrumentationSupported(AWS) { - // instrumentation requires the serviceClientOperationsMap property - if (!AWS || - !AWS.DynamoDB || - !AWS.DynamoDB.DocumentClient || - !AWS.DynamoDB.DocumentClient.prototype || - !AWS.DynamoDB.DocumentClient.prototype.serviceClientOperationsMap) { - return false - } - - return true -} - -module.exports = { - instrumentationSupported -} diff --git a/node_modules/@newrelic/aws-sdk/lib/instrumentation.js b/node_modules/@newrelic/aws-sdk/lib/instrumentation.js deleted file mode 100644 index 47a8ad75..00000000 --- a/node_modules/@newrelic/aws-sdk/lib/instrumentation.js +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const INSTRUMENTATIONS = [ - require('./core'), - require('./dynamodb'), - require('./sqs'), - require('./sns') -] - -const helper = require('./instrumentation-helper') - -module.exports = function initialize(shim, AWS) { - if (!helper.instrumentationSupported(AWS)) { - return false - } - // Validate every instrumentation before attempting to run any of them. - for (let instrumentation of INSTRUMENTATIONS) { - if (!instrumentation.validate(shim, AWS)) { - return false - } - } - - for (let instrumentation of INSTRUMENTATIONS) { - const subshim = shim.makeSpecializedShim(instrumentation.type, instrumentation.name) - instrumentation.instrument(subshim, AWS) - } - - return true -} diff --git a/node_modules/@newrelic/aws-sdk/lib/sns.js b/node_modules/@newrelic/aws-sdk/lib/sns.js deleted file mode 100644 index 08a58748..00000000 --- a/node_modules/@newrelic/aws-sdk/lib/sns.js +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -module.exports = { - name: 'sns', - type: 'message', - validate: (shim, AWS) => { - if (!shim.isFunction(AWS.SNS)) { - shim.logger.debug('Could not find SNS, not instrumenting.') - return false - } - return true - }, - instrument -} - -function instrument(shim, AWS) { - shim.setLibrary(shim.SNS) - - shim.wrapReturn(AWS, 'SNS', function wrapSns(shim, original, name, sns) { - shim.recordProduce(sns, 'publish', wrapPublish) - }) -} - -function wrapPublish(shim, original, name, args) { - return { - callback: shim.LAST, - destinationName: getDestinationName(args[0]), - destinationType: shim.TOPIC, - opaque: true - } -} - -function getDestinationName({TopicArn, TargetArn}) { - return TopicArn || TargetArn || 'PhoneNumber' // We don't want the value of PhoneNumber -} diff --git a/node_modules/@newrelic/aws-sdk/lib/sqs.js b/node_modules/@newrelic/aws-sdk/lib/sqs.js deleted file mode 100644 index 99b9f2ee..00000000 --- a/node_modules/@newrelic/aws-sdk/lib/sqs.js +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const {grabLastUrlSegment} = require('./util') -module.exports = { - name: 'sqs', - type: 'message', - validate, - instrument -} - -function validate(shim, AWS) { - if (!shim.isFunction(AWS.SQS)) { - shim.logger.debug('Could not find AWS.SQS') - - return false - } - - return true -} - -function instrument(shim, AWS) { - // This needs to happen before any instrumentation - shim.setLibrary(shim.SQS) - - shim.wrapReturn(AWS, 'SQS', function wrapSqs(shim, original, name, sqs) { - shim.recordProduce(sqs, 'sendMessage', recordMessageApi) - shim.recordProduce(sqs, 'sendMessageBatch', recordMessageApi) - shim.recordConsume(sqs, 'receiveMessage', recordMessageApi) - }) -} - -function recordMessageApi(shim, original, name, args) { - const params = args[0] - const queueName = grabLastUrlSegment(params.QueueUrl) - - return { - callback: shim.LAST, - destinationName: queueName, - destinationType: shim.QUEUE, - opaque: true - } -} - - diff --git a/node_modules/@newrelic/aws-sdk/lib/util.js b/node_modules/@newrelic/aws-sdk/lib/util.js deleted file mode 100644 index 952d7f48..00000000 --- a/node_modules/@newrelic/aws-sdk/lib/util.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' -function grabLastUrlSegment(url = '/') { - // cast URL as string, and an empty - // string for null, undefined, NaN etc. - url = '' + (url || '/') - const lastSlashIndex = url.lastIndexOf('/') - const lastItem = url.substr(lastSlashIndex + 1) - - return lastItem -} - -module.exports = { - grabLastUrlSegment -} diff --git a/node_modules/@newrelic/aws-sdk/nr-hooks.js b/node_modules/@newrelic/aws-sdk/nr-hooks.js deleted file mode 100644 index d9af41c5..00000000 --- a/node_modules/@newrelic/aws-sdk/nr-hooks.js +++ /dev/null @@ -1,11 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -module.exports = [{ - type: 'conglomerate', - moduleName: 'aws-sdk', - onRequire: require('./lib/instrumentation') -}] diff --git a/node_modules/@newrelic/aws-sdk/package.json b/node_modules/@newrelic/aws-sdk/package.json deleted file mode 100644 index 55ac921a..00000000 --- a/node_modules/@newrelic/aws-sdk/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_from": "@newrelic/aws-sdk@^3.0.0", - "_id": "@newrelic/aws-sdk@3.0.0", - "_inBundle": false, - "_integrity": "sha512-8sS0MBrvmdCOVsCe7NpNReKU06fhNnvsT60+VmzZNbv1nqPNbtOuUVERzukF/85XWU7Lk/r+ikUyGHX+Emlb4w==", - "_location": "/@newrelic/aws-sdk", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@newrelic/aws-sdk@^3.0.0", - "name": "@newrelic/aws-sdk", - "escapedName": "@newrelic%2faws-sdk", - "scope": "@newrelic", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/@newrelic/aws-sdk/-/aws-sdk-3.0.0.tgz", - "_shasum": "00d5e75e2206cdf3d71418e4f031b52b45991f9f", - "_spec": "@newrelic/aws-sdk@^3.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "bugs": { - "url": "https://github.com/newrelic/node-newrelic-aws-sdk/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "New Relic instrumentation of the aws-sdk package.", - "devDependencies": { - "@newrelic/test-utilities": "^4.0.0", - "async": "^2.6.1", - "aws-sdk": "^2.403.0", - "eslint": "^5.12.1", - "newrelic": "^6.11.0", - "sinon": "^7.2.3", - "tap": "^12.4.0" - }, - "engines": { - "node": ">=10.0.0" - }, - "homepage": "https://github.com/newrelic/node-newrelic-aws-sdk#readme", - "license": "Apache-2.0", - "main": "index.js", - "name": "@newrelic/aws-sdk", - "peerDependencies": { - "newrelic": ">=6.11.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/newrelic/node-newrelic-aws-sdk.git" - }, - "scripts": { - "lint": "eslint *.js lib tests", - "test": "npm run unit && npm run versioned", - "unit": "tap tests/unit/**/*.tap.js", - "versioned": "versioned-tests --minor -i 2 'tests/versioned/*.tap.js'" - }, - "version": "3.0.0" -} diff --git a/node_modules/@newrelic/aws-sdk/tests/unit/util.tap.js b/node_modules/@newrelic/aws-sdk/tests/unit/util.tap.js deleted file mode 100644 index 0b8ab0f3..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/unit/util.tap.js +++ /dev/null @@ -1,37 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' -const tap = require('tap') -const {grabLastUrlSegment} = require('../../lib/util') -tap.test('Utility Functions', (t) => { - t.ok(grabLastUrlSegment, 'imported function successfully') - - const fixtures = [ - { - input: '/foo/baz/bar', - output: 'bar' - }, - { - input: null, - output: '' - }, - { - input: undefined, - output: '' - }, - { - input: NaN, - output: '' - } - ] - - for (const [, fixture] of fixtures.entries()) { - const result = grabLastUrlSegment(fixture.input) - t.equals( - result, fixture.output, `expecting ${result} to equal ${fixture.output}` - ) - } - t.end() -}) diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/amazon-dax-client.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/amazon-dax-client.tap.js deleted file mode 100644 index 605dcde9..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/amazon-dax-client.tap.js +++ /dev/null @@ -1,117 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -const common = require('./common') -const { FAKE_CREDENTIALS } = require('./aws-server-stubs') - -// This will not resolve / allow web requests. Even with real ones, requests -// have to execute within the same VPC as the DAX configuration. When adding DAX support, -// we may be able to fake part of this via nock or similar. -const DAX_ENDPOINTS = [ - 'this.is.not.real1.amazonaws.com:8111', - 'this.is.not.real2.amazonaws.com:8111' -] - -tap.test('amazon-dax-client', (t) => { - t.autoend() - - let helper = null - let AWS = null - let daxClient = null - let docClient = null - - t.beforeEach((done) => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - - - AWS = require('aws-sdk') - const AmazonDaxClient = require('amazon-dax-client') - - daxClient = new AmazonDaxClient({ - credentials: FAKE_CREDENTIALS, - endpoints: DAX_ENDPOINTS, - maxRetries: 0 // fail fast - }) - docClient = new AWS.DynamoDB.DocumentClient({ service: daxClient }) - - done() - }) - - t.afterEach((done) => { - helper && helper.unload() - - helper = null - AWS = null - daxClient = null - docClient = null - - done() - }) - - t.test('should not crash when using DAX', (t) => { - helper.runInTransaction(() => { - // We don't need a successful case to repro - const getParam = getDocItemParams('TableDoesNotExist', 'ArtistDoesNotExist') - docClient.get(getParam, (err) => { - t.ok(err) - t.end() - }) - }) - }) - - t.test('should capture instance data as unknown using DAX', (t) => { - helper.runInTransaction((transaction) => { - // We don't need a successful case to repro - const getParam = getDocItemParams('TableDoesNotExist', 'ArtistDoesNotExist') - docClient.get(getParam, (err) => { - t.ok(err) - - const root = transaction.trace.root - - // Won't have the attributes cause not making web request... - const segments = common.getMatchingSegments(t, root, common.DATASTORE_PATTERN) - - t.equal(segments.length, 1) - - const externalSegments = common.checkAWSAttributes(t, root, common.EXTERN_PATTERN) - t.equal(externalSegments.length, 0, 'should not have any External segments') - - const segment = segments[0] - t.equal(segment.name, 'Datastore/operation/DynamoDB/getItem') - - const attrs = segment.attributes.get(common.SEGMENT_DESTINATION) - t.matches(attrs, { - host: 'unknown', - port_path_or_id: 'unknown', - collection: 'TableDoesNotExist', - product: 'DynamoDB' - }, 'should have expected attributes') - - t.end() - }) - }) - }) -}) - -function getDocItemParams(tableName, uniqueArtist) { - const params = { - Key: { - Artist: uniqueArtist, - SongTitle: 'Call Me Today' - }, - TableName: tableName - } - - return params -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-sdk.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-sdk.tap.js deleted file mode 100644 index a2080c71..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-sdk.tap.js +++ /dev/null @@ -1,120 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const sinon = require('sinon') -const tap = require('tap') -const utils = require('@newrelic/test-utilities') -utils.assert.extendTap(tap) - -const { createEmptyResponseServer, FAKE_CREDENTIALS } = require('./aws-server-stubs') - -tap.test('aws-sdk', (t) => { - t.autoend() - - let helper = null - let AWS = null - - let server = null - let endpoint = null - - t.beforeEach((done) => { - server = createEmptyResponseServer() - server.listen(0, () => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - AWS = require('aws-sdk') - AWS.config.update({region: 'us-east-1'}) - - endpoint = `http://localhost:${server.address().port}` - done() - }) - }) - - t.afterEach((done) => { - server.close() - server = null - - helper && helper.unload() - AWS = null - done() - }) - - t.test('should mark requests to be dt-disabled', {skip: true}, (t) => { - // http because we've changed endpoint to be http - const http = require('http') - sinon.spy(http, 'request') - t.tearDown(() => { - // `afterEach` runs before `tearDown`, so the sinon spy may have already - // been removed. - if (http.request.restore) { - http.request.restore() - } - }) - - const s3 = new AWS.S3({ - apiVersion: '2006-03-01', - credentials: FAKE_CREDENTIALS, - endpoint: endpoint, - // allows using generic endpoint, instead of needing a - // bucket.endpoint server setup. - s3ForcePathStyle: true, - params: {Bucket: 'bucket'} - }) - s3.listObjects({Delimiter: '/'}, (err) => { - t.error(err) - - if (t.ok(http.request.calledOnce, 'should call http.request')) { - const args = http.request.getCall(0).args - const headers = args[0].headers - const symbols = Object.getOwnPropertySymbols(headers).filter((s) => { - return s.toString() === 'Symbol(Disable distributed tracing)' - }) - t.equal(symbols.length, 1, 'should have disabled dt') - } - t.end() - }) - }) - - t.test('should maintain transaction state in promises', (t) => { - const service = new AWS.SES({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - helper.runInTransaction((tx) => { - service.cloneReceiptRuleSet({ - OriginalRuleSetName: 'RuleSetToClone', - RuleSetName: 'RuleSetToCreate' - }).promise().then(() => { - t.transaction(tx) - tx.end() - ender() - }) - }) - - // Run two concurrent promises to check for conflation - helper.runInTransaction((tx) => { - service.cloneReceiptRuleSet({ - OriginalRuleSetName: 'RuleSetToClone', - RuleSetName: 'RuleSetToCreate' - }).promise().then(() => { - t.transaction(tx) - tx.end() - ender() - }) - }) - - let count = 0 - function ender() { - if (++count === 2) { - t.end() - } - } - }) -}) diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/empty-response-server/index.js b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/empty-response-server/index.js deleted file mode 100644 index fce3b71b..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/empty-response-server/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const http = require('http') - -function createEmptyResponseServer() { - const server = http.createServer(function(req, res) { - if ( - req.method === 'GET' || - req.method === 'POST' || - req.method === 'PUT' || - req.method === 'HEAD' || - req.method === 'DELETE' - ) { - handlePost(req, res) - return - } - - // sometimes the aws-sdk will obfuscate this error - // so logging out. - // eslint-disable-next-line no-console - console.log('Unhandled request method: ', req.method) - - res.statusCode = 500 - res.end('Unhandled request method') - }) - - return server -} - -function handlePost(req, res) { - req.on('data', () => {}) - - req.on('end', () => { - // currently, some tests do not rely on real responses back. - // it is enough to return something valid to the client. - res.end() - }) -} - -module.exports = createEmptyResponseServer diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/index.js b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/index.js deleted file mode 100644 index 36d0522a..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/index.js +++ /dev/null @@ -1,21 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const createSqsServer = require('./sqs-server') -const createEmptyResponseServer = require('./empty-response-server') - -// Specific values are unimportant because we'll be hitting our -// custom servers. But they need to be populated. -const FAKE_CREDENTIALS = { - accessKeyId: 'FAKE ID', - secretAccessKey: 'FAKE KEY' -} - -module.exports = { - createSqsServer, - createEmptyResponseServer, - FAKE_CREDENTIALS -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/index.js b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/index.js deleted file mode 100644 index c62be5b2..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/index.js +++ /dev/null @@ -1,181 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const http = require('http') -const fs = require('fs') -const path = require('path') - -function createSqsServer() { - const server = http.createServer(function(req, res) { - if (req.method === 'POST') { - handleSqsPost(req, res) - return - } - - res.statusCode = 500 - res.end() - }) - - return server -} - -function handleSqsPost(req, res) { - let body = '' - - req.on('data', chunk => { - body += chunk.toString() - }) - - req.on('end', () => { - const endpoint = `http://localhost:${req.connection.localPort}` - const parsed = parseBody(body) - - const getDataFunction = createGetDataFromAction(endpoint, parsed) - - getDataFunction((err, data) => { - if (err) { - res.statusCode = 500 - // eslint-disable-next-line no-console - console.log(err) - } - - res.end(data) - }) - }) -} - -function createGetDataFromAction(endpoint, body) { - switch (body.Action) { - case 'CreateQueue': - return getCreateQueueResponse.bind(null, endpoint, body.QueueName) - case 'SendMessage': - return getSendMessageResponse.bind(null) - case 'SendMessageBatch': - return getSendMessageBatchResponse.bind(null) - case 'ReceiveMessage': - return getReceiveMessageResponse.bind(null) - default: - return function actionNotImplemented(callback) { - setImmediate(() => { - callback(new Error('Action not implemented')) - }) - } - } -} - -function parseBody(body) { - const parsed = Object.create(null) - - const items = body.split('&') - items.forEach((item) => { - const [key, value] = item.split('=') - parsed[key] = value - }) - - return parsed -} - -let createQueueResponse = null -function getCreateQueueResponse(endpoint, queueName, callback) { - if (createQueueResponse) { - const modifiedResponse = replaceQueueUrl(createQueueResponse, endpoint, queueName) - - setImmediate(() => { - callback(null, modifiedResponse) - }) - return - } - - readFromXml('create-queue-response.xml', (err, data) => { - if (err) { - callback(err) - return - } - - createQueueResponse = data - const modifiedResponse = replaceQueueUrl(createQueueResponse, endpoint, queueName) - - callback(null, modifiedResponse) - }) -} - -function replaceQueueUrl(xml, endpoint, queueName) { - const modifiedResponse = xml.replace( - '', - `${endpoint}/queue/${queueName}` - ) - - return modifiedResponse -} - -let sendMessageResponse = null -function getSendMessageResponse(callback) { - if (sendMessageResponse) { - setImmediate(() => { - callback(null, sendMessageResponse) - }) - return - } - - readFromXml('send-message-response.xml', (err, data) => { - if (err) { - callback(err) - return - } - - sendMessageResponse = data - callback(null, sendMessageResponse) - }) -} - -let sendMessageBatchResponse = null -function getSendMessageBatchResponse(callback) { - if (sendMessageBatchResponse) { - setImmediate(() => { - callback(null, sendMessageBatchResponse) - }) - return - } - - readFromXml('send-message-batch-response.xml', (err, data) => { - if (err) { - callback(err) - return - } - - sendMessageBatchResponse = data - callback(null, sendMessageBatchResponse) - }) -} - -let receiveMessageResponse = null -function getReceiveMessageResponse(callback) { - if (receiveMessageResponse) { - setImmediate(() => { - callback(null, receiveMessageResponse) - }) - return - } - - readFromXml('receive-message-response.xml', (err, data) => { - if (err) { - callback(err) - return - } - - receiveMessageResponse = data - callback(null, receiveMessageResponse) - }) -} - -function readFromXml(fileName, callback) { - const fullPath = path.join(__dirname, 'responses', fileName) - fs.readFile(fullPath, 'utf8', function(err, data) { - callback(err, data) - }) -} - -module.exports = createSqsServer diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/create-queue-response.xml b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/create-queue-response.xml deleted file mode 100644 index 7ee7c8bc..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/create-queue-response.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - cb919c0a-9bce-4afe-9b48-9bdf2412bb67 - - \ No newline at end of file diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/receive-message-response.xml b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/receive-message-response.xml deleted file mode 100644 index 73df7542..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/receive-message-response.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 5fea7756-0ea4-451a-a703-a558b933e274 - - MbZj6wDWliJvwwJaBV3dcjk2YW2vA3STFFljTM8tJJg6HRG6PYSasuWXPJBCw - Lj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQQE - auMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0= - - fafb00f5732ab283681e124bf8747ed1 - This is a test message - - SenderId - 195004372649 - - - SentTimestamp - 1238099229000 - - - ApproximateReceiveCount - 2 - - - ApproximateFirstReceiveTimestamp - 1595887234772 - - - - - b6633655-283d-45b4-aee4-4e84e0ae6afa - - \ No newline at end of file diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/send-message-batch-response.xml b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/send-message-batch-response.xml deleted file mode 100644 index 323d1a32..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/send-message-batch-response.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - ONE - 0a5231c7-8bff-4955-be2e-8dc7c50a25fa - 8b2f30468657cfc118bbbebb6ad52b5a - - - TWO - 15ee1ed3-87e7-40c1-bdaa-2e49968ea7e9 - 446e666e0c0a8695b7a9693c082bc5da - - - - ca1ad5d0-8271-408b-8d0f-1351bf547e74 - - \ No newline at end of file diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/send-message-response.xml b/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/send-message-response.xml deleted file mode 100644 index 813da254..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/aws-server-stubs/sqs-server/responses/send-message-response.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - fafb00f5732ab283681e124bf8747ed1 - 5fea7756-0ea4-451a-a703-a558b933e274 - - - 27daac76-34dd-47df-bd01-1f6e873584a0 - - \ No newline at end of file diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/common.js b/node_modules/@newrelic/aws-sdk/tests/versioned/common.js deleted file mode 100644 index 3e6a7c00..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/common.js +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const DATASTORE_PATTERN = /^Datastore/ -const EXTERN_PATTERN = /^External\/.*/ -const SNS_PATTERN = /^MessageBroker\/SNS\/Topic/ -const SQS_PATTERN = /^MessageBroker\/SQS\/Queue/ - -const SEGMENT_DESTINATION = 0x20 - -function checkAWSAttributes(t, segment, pattern, markedSegments = []) { - const expectedAttrs = { - 'aws.operation': String, - 'aws.service': String, - 'aws.requestId': String, - 'aws.region': String - } - - if (pattern.test(segment.name)) { - markedSegments.push(segment) - const attrs = segment.attributes.get(SEGMENT_DESTINATION) - t.matches(attrs, expectedAttrs, 'should have aws attributes') - } - segment.children.forEach((child) => { - checkAWSAttributes(t, child, pattern, markedSegments) - }) - - return markedSegments -} - -function getMatchingSegments(t, segment, pattern, markedSegments = []) { - if (pattern.test(segment.name)) { - markedSegments.push(segment) - } - - segment.children.forEach((child) => { - getMatchingSegments(t, child, pattern, markedSegments) - }) - - return markedSegments -} - -module.exports = { - DATASTORE_PATTERN, - EXTERN_PATTERN, - SNS_PATTERN, - SQS_PATTERN, - - SEGMENT_DESTINATION, - - checkAWSAttributes, - getMatchingSegments -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/dynamodb.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/dynamodb.tap.js deleted file mode 100644 index a7f35876..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/dynamodb.tap.js +++ /dev/null @@ -1,283 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') -const async = require('async') - -const common = require('./common') -const { createEmptyResponseServer, FAKE_CREDENTIALS } = require('./aws-server-stubs') - -tap.test('DynamoDB', (t) => { - t.autoend() - - let helper = null - let AWS = null - - let tableName = null - let tests = null - - let server = null - - t.beforeEach((done) => { - server = createEmptyResponseServer() - server.listen(0, () => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - - AWS = require('aws-sdk') - - const endpoint = `http://localhost:${server.address().port}` - const ddb = new AWS.DynamoDB({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint, - region: 'us-east-1' - }) - const docClient = new AWS.DynamoDB.DocumentClient({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint, - region: 'us-east-1' - }) - - tableName = `delete-aws-sdk-test-table-${Math.floor(Math.random() * 100000)}` - tests = createTests(ddb, docClient, tableName) - - done() - }) - }) - - t.afterEach((done) => { - server.close() - server = null - - helper && helper.unload() - helper = null - - AWS = null - tests = null - tableName = null - - done() - }) - - t.test('commands with callback', (t) => { - helper.runInTransaction((tx) => { - async.eachSeries(tests, (cfg, cb) => { - t.comment(`Testing ${cfg.method}`) - cfg.api[cfg.method](cfg.params, (err) => { - t.error(err) - - return setImmediate(cb) - }) - }, () => { - tx.end() - - const args = [t, tests, tx] - setImmediate(finish, ...args) - }) - }) - }) - - t.test('commands with promises', (t) => { - helper.runInTransaction(async function(tx) { - // Execute commands in order - // Await works because this is in a for-loop / no callback api - for (let i = 0; i < tests.length; i++) { - const cfg = tests[i] - - t.comment(`Testing ${cfg.method}`) - - try { - await cfg.api[cfg.method](cfg.params).promise() - } catch (err) { - t.error(err) - } - } - - tx.end() - - const args = [t, tests, tx] - setImmediate(finish, ...args) - }) - }) -}) - -function finish(t, tests, tx) { - const root = tx.trace.root - const segments = common.checkAWSAttributes(t, root, common.DATASTORE_PATTERN) - - t.equal( - segments.length, - tests.length, - `should have ${tests.length} aws datastore segments` - ) - - const externalSegments = common.checkAWSAttributes(t, root, common.EXTERN_PATTERN) - t.equal(externalSegments.length, 0, 'should not have any External segments') - - segments.forEach((segment, i) => { - const operation = tests[i].operation - t.equal( - segment.name, - `Datastore/operation/DynamoDB/${operation}`, - 'should have operation in segment name' - ) - const attrs = segment.attributes.get(common.SEGMENT_DESTINATION) - t.matches(attrs, { - 'host': String, - 'port_path_or_id': String, - 'product': 'DynamoDB', - 'collection': String, - 'aws.operation': operation, - 'aws.requestId': String, - 'aws.region': 'us-east-1', - 'aws.service': 'DynamoDB' - }, 'should have expected attributes') - }) - - t.end() -} - -function createTests(ddb, docClient, tableName) { - const ddbUniqueArtist = `DELETE_One You Know ${Math.floor(Math.random() * 100000)}` - const createTblParams = getCreateTableParams(tableName) - const putItemParams = getPutItemParams(tableName, ddbUniqueArtist) - const itemParams = getItemParams(tableName, ddbUniqueArtist) - const queryParams = getQueryParams(tableName, ddbUniqueArtist) - const deleteTableParams = getDeleteTableParams(tableName) - - const docUniqueArtist = `DELETE_One You Know ${Math.floor(Math.random() * 100000)}` - const docPutParams = getDocPutItemParams(tableName, docUniqueArtist) - const docItemParams = getDocItemParams(tableName, docUniqueArtist) - const docQueryParams = getDocQueryParams(tableName, docUniqueArtist) - - const composedTests = [ - {api: ddb, method: 'createTable', params: createTblParams, operation: 'createTable'}, - {api: ddb, method: 'putItem', params: putItemParams, operation: 'putItem'}, - {api: ddb, method: 'getItem', params: itemParams, operation: 'getItem'}, - {api: ddb, method: 'updateItem', params: itemParams, operation: 'updateItem'}, - {api: ddb, method: 'scan', params: {TableName: tableName}, operation: 'scan'}, - {api: ddb, method: 'query', params: queryParams, operation: 'query'}, - {api: ddb, method: 'deleteItem', params: itemParams, operation: 'deleteItem'}, - - {api: docClient, method: 'put', params: docPutParams, operation: 'putItem'}, - {api: docClient, method: 'get', params: docItemParams, operation: 'getItem'}, - {api: docClient, method: 'update', params: docItemParams, operation: 'updateItem'}, - {api: docClient, method: 'scan', params: {TableName: tableName}, operation: 'scan'}, - {api: docClient, method: 'query', params: docQueryParams, operation: 'query'}, - {api: docClient, method: 'delete', params: docItemParams, operation: 'deleteItem'}, - - {api: ddb, method: 'deleteTable', params: deleteTableParams, operation: 'deleteTable'} - ] - - return composedTests -} - -function getCreateTableParams(tableName) { - const params = { - AttributeDefinitions: [ - {AttributeName: 'Artist', AttributeType: 'S'}, - {AttributeName: 'SongTitle', AttributeType: 'S'} - ], - KeySchema: [ - {AttributeName: 'Artist', KeyType: 'HASH'}, - {AttributeName: 'SongTitle', KeyType: 'RANGE'} - ], - ProvisionedThroughput: { - ReadCapacityUnits: 5, - WriteCapacityUnits: 5 - }, - TableName: tableName - } - - return params -} - -function getPutItemParams(tableName, uniqueArtist) { - const params = { - Item: { - AlbumTitle: {S: 'Somewhat Famous'}, - Artist: {S: uniqueArtist}, - SongTitle: {S: 'Call Me Today'} - }, - TableName: tableName - } - - return params -} - -function getItemParams(tableName, uniqueArtist) { - const params = { - Key: { - Artist: {S: uniqueArtist}, - SongTitle: {S: 'Call Me Today'} - }, - TableName: tableName - } - - return params -} - -function getQueryParams(tableName, uniqueArtist) { - const params = { - ExpressionAttributeValues: { - ':v1': {S: uniqueArtist} - }, - KeyConditionExpression: 'Artist = :v1', - TableName: tableName - } - - return params -} - -function getDeleteTableParams(tableName) { - const params = { - TableName: tableName - } - - return params -} - -function getDocPutItemParams(tableName, uniqueArtist) { - const params = { - Item: { - AlbumTitle: 'Somewhat Famous', - Artist: uniqueArtist, - SongTitle: 'Call Me Today' - }, - TableName: tableName - } - - return params -} - -function getDocItemParams(tableName, uniqueArtist) { - const params = { - Key: { - Artist: uniqueArtist, - SongTitle: 'Call Me Today' - }, - TableName: tableName - } - - return params -} - -function getDocQueryParams(tableName, uniqueArtist) { - const params = { - ExpressionAttributeValues: { - ':v1': uniqueArtist - }, - KeyConditionExpression: 'Artist = :v1', - TableName: tableName - } - - return params -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/http-services.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/http-services.tap.js deleted file mode 100644 index 5b493180..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/http-services.tap.js +++ /dev/null @@ -1,228 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -const common = require('./common') -const { createEmptyResponseServer, FAKE_CREDENTIALS } = require('./aws-server-stubs') - -tap.test('AWS HTTP Services', (t) => { - t.autoend() - - let helper = null - let AWS = null - - let server = null - let endpoint = null - - t.beforeEach((done) => { - server = createEmptyResponseServer() - server.listen(0, () => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - AWS = require('aws-sdk') - AWS.config.update({region: 'us-east-1'}) - - endpoint = `http://localhost:${server.address().port}` - done() - }) - }) - - t.afterEach((done) => { - server.close() - server = null - - helper && helper.unload() - done() - }) - - t.test('APIGateway', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.APIGateway({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.createApiKey({ - customerId: 'STRING_VALUE', - description: 'STRING_VALUE', - enabled: true || false, - generateDistinctId: true || false, - name: 'STRING_VALUE', - stageKeys: [ - { - restApiId: 'STRING_VALUE', - stageName: 'STRING_VALUE' - } - ], - value: 'STRING_VALUE' - }, () => { - tx.end() - setImmediate(finish, t, 'API Gateway', 'createApiKey', tx) - }) - }) - }) - - t.test('ELB', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.ELB({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.addTags({ - LoadBalancerNames: [ - 'my-load-balancer' - ], - Tags: [{ - Key: 'project', - Value: 'lima' - }, { - Key: 'department', - Value: 'digital-media' - }] - }, () => { - tx.end() - setImmediate(finish, t, 'Elastic Load Balancing', 'addTags', tx) - }) - }) - }) - - t.test('ElastiCache', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.ElastiCache({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.addTagsToResource({ - ResourceName: 'STRING_VALUE', /* required */ - Tags: [ /* required */ - { - Key: 'STRING_VALUE', - Value: 'STRING_VALUE' - } - ] - }, () => { - tx.end() - setImmediate(finish, t, 'ElastiCache', 'addTagsToResource', tx) - }) - }) - }) - - t.test('Lambda', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.Lambda({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.addLayerVersionPermission({ - Action: 'lambda:GetLayerVersion', /* required */ - LayerName: 'STRING_VALUE', /* required */ - Principal: '*', /* required */ - StatementId: 'STRING_VALUE', /* required */ - VersionNumber: 2, /* required */ - OrganizationId: 'o-0123456789', - RevisionId: 'STRING_VALUE' - }, () => { - tx.end() - setImmediate(finish, t, 'Lambda', 'addLayerVersionPermission', tx) - }) - }) - }) - - t.test('RDS', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.RDS({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.addRoleToDBCluster({ - DBClusterIdentifier: 'STRING_VALUE', /* required */ - RoleArn: 'arn:aws:iam::123456789012:role/AuroraAccessRole' /* required */ - }, () => { - tx.end() - setImmediate(finish, t, 'Amazon RDS', 'addRoleToDBCluster', tx) - }) - }) - }) - - t.test('Redshift', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.Redshift({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.acceptReservedNodeExchange({ - ReservedNodeId: 'STRING_VALUE', /* required */ - TargetReservedNodeOfferingId: 'STRING_VALUE' /* required */ - }, () => { - tx.end() - setImmediate(finish, t, 'Redshift', 'acceptReservedNodeExchange', tx) - }) - }) - }) - - t.test('Rekognition', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.Rekognition({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.compareFaces({ - SimilarityThreshold: 90, - SourceImage: { - S3Object: { - Bucket: 'mybucket', - Name: 'mysourceimage' - } - }, - TargetImage: { - S3Object: { - Bucket: 'mybucket', - Name: 'mytargetimage' - } - } - }, () => { - tx.end() - setImmediate(finish, t, 'Rekognition', 'compareFaces', tx) - }) - }) - }) - - t.test('SES', (t) => { - helper.runInTransaction((tx) => { - const service = new AWS.SES({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint - }) - service.cloneReceiptRuleSet({ - OriginalRuleSetName: 'RuleSetToClone', - RuleSetName: 'RuleSetToCreate' - }, () => { - tx.end() - setImmediate(finish, t, 'Amazon SES', 'cloneReceiptRuleSet', tx) - }) - }) - }) -}) - -function finish(t, service, operation, tx) { - const externals = common.checkAWSAttributes(t, tx.trace.root, common.EXTERN_PATTERN) - if (t.equal(externals.length, 1, 'should have an aws external')) { - const attrs = externals[0].attributes.get(common.SEGMENT_DESTINATION) - t.matches(attrs, { - 'aws.operation': operation, - 'aws.requestId': String, - 'aws.service': service, - 'aws.region': 'us-east-1' - }, 'should have expected attributes') - } - - t.end() -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/instrumentation-supported.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/instrumentation-supported.tap.js deleted file mode 100644 index e4ee89ef..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/instrumentation-supported.tap.js +++ /dev/null @@ -1,47 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') -const instrumentationHelper = require('../../lib/instrumentation-helper') -utils.assert.extendTap(tap) - -tap.test('instrumentation is supported', (t) => { - t.autoend() - - let helper = null - let AWS = null - - t.beforeEach((done) => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - AWS = require('aws-sdk') - done() - }) - - t.afterEach((done) => { - helper && helper.unload() - AWS = null - done() - }) - - t.test('AWS should have newrelic attributes', (t) => { - t.assert(AWS.__NR_instrumented, 'Found __NR_instrumented') - t.end() - }) - - t.test('instrumentation supported function', (t) => { - t.assert( - instrumentationHelper.instrumentationSupported(AWS), - 'instrumentationSupported returned true' - ) - t.end() - }) -}) diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/instrumentation-unsupported.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/instrumentation-unsupported.tap.js deleted file mode 100644 index ca30d07a..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/instrumentation-unsupported.tap.js +++ /dev/null @@ -1,47 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') -const instrumentationHelper = require('../../lib/instrumentation-helper') -utils.assert.extendTap(tap) - -tap.test('instrumentation is supported', (t) => { - t.autoend() - - let helper = null - let AWS = null - - t.beforeEach((done) => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - AWS = require('aws-sdk') - done() - }) - - t.afterEach((done) => { - helper && helper.unload() - AWS = null - done() - }) - - t.test('AWS should not have newrelic attributes', (t) => { - t.assert(!AWS.__NR_instrumented, '__NR_instrumented not present') - t.end() - }) - - t.test('instrumentation supported function', (t) => { - t.assert( - !instrumentationHelper.instrumentationSupported(AWS), - 'instrumentationSupported returned false' - ) - t.end() - }) -}) diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/newrelic.js b/node_modules/@newrelic/aws-sdk/tests/versioned/newrelic.js deleted file mode 100644 index 102eab6b..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/newrelic.js +++ /dev/null @@ -1,24 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -exports.config = { - app_name: ['My Application'], - license_key: 'license key here', - logging: { - level: 'trace', - filepath: '../../../newrelic_agent.log' - }, - utilization: { - detect_aws: false, - detect_pcf: false, - detect_azure: false, - detect_gcp: false, - detect_docker: false - }, - transaction_tracer: { - enabled: true - } -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/package.json b/node_modules/@newrelic/aws-sdk/tests/versioned/package.json deleted file mode 100644 index bccf0343..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "aws-sdk-tests", - "version": "0.0.0", - "private": true, - "tests": [ - { - "engines": { - "node": ">=10.0" - }, - "dependencies": { - "aws-sdk": { - "versions": "2.2.48" - } - }, - "files": [ - "instrumentation-unsupported.tap.js" - ] - }, - { - "engines": { - "node": ">=10.0" - }, - "dependencies": { - "aws-sdk": { - "versions": ">=2.380.0", - "samples": 10 - } - }, - "files": [ - "aws-sdk.tap.js", - "dynamodb.tap.js", - "http-services.tap.js", - "instrumentation-supported.tap.js", - "s3.tap.js", - "sqs.tap.js", - "sns.tap.js" - ] - }, - { - "engines": { - "node": ">=10.0" - }, - "dependencies": { - "aws-sdk": { - "versions": ">=2.380.0", - "samples": 10 - }, - "amazon-dax-client": ">=1.0.2" - }, - "files": [ - "amazon-dax-client.tap.js" - ] - } - ], - "dependencies": {} -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/s3.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/s3.tap.js deleted file mode 100644 index 44d39aa0..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/s3.tap.js +++ /dev/null @@ -1,125 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -const common = require('./common') -const { createEmptyResponseServer, FAKE_CREDENTIALS } = require('./aws-server-stubs') - -tap.test('S3 buckets', (t) => { - t.autoend() - - let helper = null - let AWS = null - let S3 = null - - let server = null - - t.beforeEach((done) => { - server = createEmptyResponseServer() - server.listen(0, () => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - AWS = require('aws-sdk') - S3 = new AWS.S3({ - credentials: FAKE_CREDENTIALS, - endpoint: `http://localhost:${server.address().port}`, - // allows using generic endpoint, instead of needing a - // bucket.endpoint server setup. - s3ForcePathStyle: true, - apiVersion: '2006-03-01' - }) - done() - }) - }) - - t.afterEach((done) => { - server.close() - server = null - - helper && helper.unload() - done() - }) - - t.test('commands with callbacks', (t) => { - const Bucket = 'delete-aws-sdk-test-bucket-' + Math.floor(Math.random() * 100000) - - helper.runInTransaction((tx) => { - S3.headBucket({Bucket}, (err) => { - t.error(err) - - S3.createBucket({Bucket}, (err) => { - t.error(err) - - S3.deleteBucket({Bucket}, (err) => { - t.error(err) - tx.end() - - const args = [t, tx] - setImmediate(finish, ...args) - }) - }) - }) - }) - }) - - t.test('commands with promises', (t) => { - const Bucket = 'delete-aws-sdk-test-bucket-' + Math.floor(Math.random() * 100000) - - helper.runInTransaction(async tx => { - try { - await S3.headBucket({Bucket}).promise() - } catch (err) { - t.error(err) - } - - try { - // using pathstyle will result in the params being mutated due to this call, - // which is why the params are manually pasted in each call. - await S3.createBucket({Bucket}).promise() - } catch (err) { - t.error(err) - } - - try { - await S3.deleteBucket({Bucket}).promise() - } catch (err) { - t.error(err) - } - - tx.end() - - const args = [t, tx] - setImmediate(finish, ...args) - }) - }) -}) - -function finish(t, tx) { - const externals = common.checkAWSAttributes(t, tx.trace.root, common.EXTERN_PATTERN) - t.equal(externals.length, 3, 'should have 3 aws externals') - const [head, create, del] = externals - checkAttrs(t, head, 'headBucket') - checkAttrs(t, create, 'createBucket') - checkAttrs(t, del, 'deleteBucket') - - t.end() -} - -function checkAttrs(t, segment, operation) { - const attrs = segment.attributes.get(common.SEGMENT_DESTINATION) - t.matches(attrs, { - 'aws.operation': operation, - 'aws.requestId': String, - 'aws.service': 'Amazon S3', - 'aws.region': 'us-east-1' - }, `should have expected attributes for ${operation}`) -} diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/sns.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/sns.tap.js deleted file mode 100644 index e53a048b..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/sns.tap.js +++ /dev/null @@ -1,104 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -const common = require('./common') -const { createEmptyResponseServer, FAKE_CREDENTIALS } = require('./aws-server-stubs') - -tap.test('SNS', (t) => { - t.autoend() - - let helper = null - let AWS = null - let sns = null - let TopicArn = null - - let server = null - - t.beforeEach((done) => { - server = createEmptyResponseServer() - server.listen(0, () => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - AWS = require('aws-sdk') - - sns = new AWS.SNS({ - credentials: FAKE_CREDENTIALS, - endpoint: `http://localhost:${server.address().port}`, - region: 'us-east-1' - }) - - done() - }) - }) - - t.afterEach((done) => { - server.close() - server = null - - helper && helper.unload() - - done() - }) - - t.test('publish with callback', (t) => { - helper.runInTransaction((tx) => { - const params = {TopicArn, Message: 'Hello!'} - - sns.publish(params, (err) => { - t.error(err) - tx.end() - - const args = [t, tx] - setImmediate(finish, ...args) - }) - }) - }) - - t.test('publish with promise', (t) => { - helper.runInTransaction(async tx => { - const params = {TopicArn, Message: 'Hello!'} - - try { - await sns.publish(params).promise() - } catch (error) { - t.error(error) - } - - tx.end() - - const args = [t, tx] - setImmediate(finish, ...args) - }) - }) -}) - -function finish(t, tx) { - const root = tx.trace.root - - const messages = common.checkAWSAttributes(t, root, common.SNS_PATTERN) - t.equal(messages.length, 1, 'should have 1 message broker segment') - - const externalSegments = common.checkAWSAttributes(t, root, common.EXTERN_PATTERN) - t.equal(externalSegments.length, 0, 'should not have any External segments') - - const attrs = messages[0].attributes.get(common.SEGMENT_DESTINATION) - t.matches(attrs, { - 'aws.operation': 'publish', - 'aws.requestId': String, - 'aws.service': 'Amazon SNS', - 'aws.region': 'us-east-1' - }, 'should have expected attributes for publish') - - t.end() -} - diff --git a/node_modules/@newrelic/aws-sdk/tests/versioned/sqs.tap.js b/node_modules/@newrelic/aws-sdk/tests/versioned/sqs.tap.js deleted file mode 100644 index e3bff216..00000000 --- a/node_modules/@newrelic/aws-sdk/tests/versioned/sqs.tap.js +++ /dev/null @@ -1,286 +0,0 @@ -/* -* Copyright 2020 New Relic Corporation. All rights reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -const common = require('./common') -const { createSqsServer, FAKE_CREDENTIALS } = require('./aws-server-stubs') - -const AWS_REGION = 'us-east-1' - -tap.test('SQS API', (t) => { - t.autoend() - - let helper = null - let AWS = null - let sqs = null - - let queueName = null - let queueUrl = null - let sendMessageRequestId = null - let sendMessageBatchRequestId = null - let receiveMessageRequestId = null - - let server = null - - t.beforeEach((done) => { - server = createSqsServer() - server.listen(0, () => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'aws-sdk', - type: 'conglomerate', - onRequire: require('../../lib/instrumentation') - }) - - AWS = require('aws-sdk') - - const endpoint = `http://localhost:${server.address().port}` - sqs = new AWS.SQS({ - credentials: FAKE_CREDENTIALS, - endpoint: endpoint, - apiVersion: '2012-11-05', - region: AWS_REGION - }) - - queueName = 'delete-aws-sdk-test-queue-' + Math.floor(Math.random() * 100000) - - done() - }) - }) - - t.afterEach((done) => { - helper && helper.unload() - - server.close() - server = null - - helper = null - sqs = null - AWS = null - - queueName = null - queueUrl = null - sendMessageRequestId = null - sendMessageBatchRequestId = null - receiveMessageRequestId = null - - done() - }) - - t.test('commands with callback', (t) => { - const createParams = getCreateParams(queueName) - sqs.createQueue(createParams, function(createErr, createData) { - t.error(createErr) - - queueUrl = createData.QueueUrl - - helper.runInTransaction((transaction) => { - const sendMessageParams = getSendMessageParams(queueUrl) - sqs.sendMessage(sendMessageParams, (sendErr, sendData) => { - t.error(sendErr) - t.ok(sendData.MessageId) - - sendMessageRequestId = getRequestId(t, sendData) - - const sendMessageBatchParams = getSendMessageBatchParams(queueUrl) - sqs.sendMessageBatch(sendMessageBatchParams, (sendBatchErr, sendBatchData) => { - t.error(sendBatchErr) - t.ok(sendBatchData.Successful) - - sendMessageBatchRequestId = getRequestId(t, sendBatchData) - - const receiveMessageParams = getReceiveMessageParams(queueUrl) - sqs.receiveMessage(receiveMessageParams, (receiveErr, receiveData) => { - t.error(receiveErr) - t.ok(receiveData.Messages) - - receiveMessageRequestId = getRequestId(t, receiveData) - - transaction.end() - - const args = [t, transaction] - setImmediate(finish, ...args) - }) - }) - }) - }) - }) - }) - - t.test('commands with promises', (t) => { - const createParams = getCreateParams(queueName) - sqs.createQueue(createParams, function(createErr, createData) { - t.error(createErr) - - queueUrl = createData.QueueUrl - - helper.runInTransaction(async transaction => { - try { - const sendMessageParams = getSendMessageParams(queueUrl) - const sendData = await sqs.sendMessage(sendMessageParams).promise() - t.ok(sendData.MessageId) - - sendMessageRequestId = getRequestId(t, sendData) - } catch (error) { - t.error(error) - } - - try { - const sendMessageBatchParams = getSendMessageBatchParams(queueUrl) - const sendBatchData = - await sqs.sendMessageBatch(sendMessageBatchParams).promise() - t.ok(sendBatchData.Successful) - - sendMessageBatchRequestId = getRequestId(t, sendBatchData) - } catch (error) { - t.error(error) - } - - try { - const receiveMessageParams = getReceiveMessageParams(queueUrl) - const receiveData = await sqs.receiveMessage(receiveMessageParams).promise() - t.ok(receiveData.Messages) - - receiveMessageRequestId = getRequestId(t, receiveData) - } catch (error) { - t.error(error) - } - - transaction.end() - - const args = [t, transaction] - setImmediate(finish, ...args) - }) - }) - }) - - function finish(t, transaction) { - const expectedSegmentCount = 3 - - const root = transaction.trace.root - const segments = common.checkAWSAttributes(t, root, common.SQS_PATTERN) - - t.equal( - segments.length, - expectedSegmentCount, - `should have ${expectedSegmentCount} AWS MessageBroker/SQS segments` - ) - - const externalSegments = common.checkAWSAttributes(t, root, common.EXTERN_PATTERN) - t.equal(externalSegments.length, 0, 'should not have any External segments') - - const [sendMessage, sendMessageBatch, receiveMessage] = segments - - checkName(t, sendMessage.name, 'Produce', queueName) - checkAttributes(t, sendMessage, 'sendMessage', sendMessageRequestId) - - checkName(t, sendMessageBatch.name, 'Produce', queueName) - checkAttributes(t, sendMessageBatch, 'sendMessageBatch', sendMessageBatchRequestId) - - checkName(t, receiveMessage.name, 'Consume', queueName) - checkAttributes(t, receiveMessage, 'receiveMessage', receiveMessageRequestId) - - t.end() - } -}) - -function checkName(t, name, action, queueName) { - const specificName = `/${action}/Named/${queueName}` - - t.matches(name, specificName, 'should have correct name') -} - -function checkAttributes(t, segment, operation, expectedRequestId) { - const actualAttributes = segment.attributes.get(common.SEGMENT_DESTINATION) - - const expectedAttributes = { - 'aws.operation': operation, - 'aws.requestId': expectedRequestId, - 'aws.service': 'Amazon SQS', - 'aws.region': AWS_REGION - } - - t.matches( - actualAttributes, - expectedAttributes, - `should have expected attributes for ${operation}` - ) -} - -function getRequestId(t, apiReturnedData) { - t.ok(apiReturnedData.ResponseMetadata) - - return apiReturnedData.ResponseMetadata.RequestId -} - -function getCreateParams(queueName) { - const params = { - QueueName: queueName, - Attributes: { - MessageRetentionPeriod: '1200' // 20 minutes - } - } - - return params -} - -function getSendMessageParams(queueUrl) { - const params = { - MessageAttributes: { - Attr1: { - DataType: 'String', - StringValue: 'One' - } - }, - MessageBody: 'This is a test message', - QueueUrl: queueUrl - } - - return params -} - -function getSendMessageBatchParams(queueUrl) { - const params = { - Entries: [ - { - Id: 'ONE', - MessageBody: 'ONE BODY', - MessageAttributes: { - Attribute1: {DataType: 'String', StringValue: 'Value 1'}, - Attribute2: {DataType: 'String', StringValue: 'Value 2'} - } - }, - { - Id: 'TWO', - MessageBody: 'TWO BODY', - MessageAttributes: { - Attribute1: {DataType: 'String', StringValue: 'Value 1'}, - Attribute2: {DataType: 'String', StringValue: 'Value 2'} - } - } - ], - QueueUrl: queueUrl - } - - return params -} - -function getReceiveMessageParams(queueUrl) { - const params = { - AttributeNames: [ - 'SentTimestamp' - ], - MaxNumberOfMessages: 2, - MessageAttributeNames: [ - 'All' - ], - QueueUrl: queueUrl - } - - return params -} diff --git a/node_modules/@newrelic/aws-sdk/third_party_manifest.json b/node_modules/@newrelic/aws-sdk/third_party_manifest.json deleted file mode 100644 index d5854403..00000000 --- a/node_modules/@newrelic/aws-sdk/third_party_manifest.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "lastUpdated": "Mon Nov 02 2020 12:09:18 GMT-0800 (Pacific Standard Time)", - "projectName": "New Relic AWS-SDK Instrumentation", - "projectUrl": "https://github.com/newrelic/node-newrelic-aws-sdk", - "includeDev": true, - "dependencies": {}, - "devDependencies": { - "@newrelic/test-utilities@4.1.2": { - "name": "@newrelic/test-utilities", - "version": "4.1.2", - "range": "^4.0.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-test-utilities", - "versionedRepoUrl": "https://github.com/newrelic/node-test-utilities/tree/v4.1.2", - "licenseFile": "node_modules/@newrelic/test-utilities/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-test-utilities/blob/v4.1.2/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "async@2.6.3": { - "name": "async", - "version": "2.6.3", - "range": "^2.6.1", - "licenses": "MIT", - "repoUrl": "https://github.com/caolan/async", - "versionedRepoUrl": "https://github.com/caolan/async/tree/v2.6.3", - "licenseFile": "node_modules/async/LICENSE", - "licenseUrl": "https://github.com/caolan/async/blob/v2.6.3/LICENSE", - "licenseTextSource": "file", - "publisher": "Caolan McMahon" - }, - "aws-sdk@2.561.0": { - "name": "aws-sdk", - "version": "2.561.0", - "range": "^2.403.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/aws/aws-sdk-js", - "versionedRepoUrl": "https://github.com/aws/aws-sdk-js/tree/v2.561.0", - "licenseFile": "node_modules/aws-sdk/LICENSE.txt", - "licenseUrl": "https://github.com/aws/aws-sdk-js/blob/v2.561.0/LICENSE.txt", - "licenseTextSource": "file", - "publisher": "Amazon Web Services", - "url": "https://aws.amazon.com/" - }, - "eslint@5.16.0": { - "name": "eslint", - "version": "5.16.0", - "range": "^5.12.1", - "licenses": "MIT", - "repoUrl": "https://github.com/eslint/eslint", - "versionedRepoUrl": "https://github.com/eslint/eslint/tree/v5.16.0", - "licenseFile": "node_modules/eslint/LICENSE", - "licenseUrl": "https://github.com/eslint/eslint/blob/v5.16.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Nicholas C. Zakas", - "email": "nicholas+npm@nczconsulting.com" - }, - "newrelic@6.14.0": { - "name": "newrelic", - "version": "6.14.0", - "range": "^6.11.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-newrelic", - "versionedRepoUrl": "https://github.com/newrelic/node-newrelic/tree/v6.14.0", - "licenseFile": "node_modules/newrelic/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-newrelic/blob/v6.14.0/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "sinon@7.5.0": { - "name": "sinon", - "version": "7.5.0", - "range": "^7.2.3", - "licenses": "BSD-3-Clause", - "repoUrl": "https://github.com/sinonjs/sinon", - "versionedRepoUrl": "https://github.com/sinonjs/sinon/tree/v7.5.0", - "licenseFile": "node_modules/sinon/LICENSE", - "licenseUrl": "https://github.com/sinonjs/sinon/blob/v7.5.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Christian Johansen" - }, - "tap@12.7.0": { - "name": "tap", - "version": "12.7.0", - "range": "^12.4.0", - "licenses": "ISC", - "repoUrl": "https://github.com/tapjs/node-tap", - "versionedRepoUrl": "https://github.com/tapjs/node-tap/tree/v12.7.0", - "licenseFile": "node_modules/tap/LICENSE", - "licenseUrl": "https://github.com/tapjs/node-tap/blob/v12.7.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - } - } -} diff --git a/node_modules/@newrelic/koa/CONTRIBUTING.md b/node_modules/@newrelic/koa/CONTRIBUTING.md deleted file mode 100644 index 28c4ef86..00000000 --- a/node_modules/@newrelic/koa/CONTRIBUTING.md +++ /dev/null @@ -1,103 +0,0 @@ -# Guidelines for Contributing Code - -New Relic welcomes code contributions by the Node community to this module, and -have taken effort to make this process easy for both contributors and our -development team. - -## Process - -### Feature Requests - -Feature requests should be submitted in the [Issue tracker](../../issues), with -a description of the expected behavior & use case. Before submitting an Issue, -please search for similar ones in the [closed -issues](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement). - -### Pull Requests - -We can only accept PRs for version v4.0.0 or greater due to open source -licensing restrictions. - -### Code of Conduct - -Before contributing please read the [code of conduct](./CODE_OF_CONDUCT.md) - -Note that our [code of conduct](./CODE_OF_CONDUCT.md) applies to all platforms -and venues related to this project; please follow it in all your interactions -with the project and its participants. - -### Contributor License Agreement - -Keep in mind that when you submit your Pull Request, you'll need to sign the -CLA via the click-through using CLA-Assistant. If you'd like to execute our -corporate CLA, or if you have any questions, please drop us an email at -opensource@newrelic.com. - -For more information about CLAs, please check out Alex Russell’s excellent -post, [“Why Do I Need to Sign -This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/). - -### Slack - -We host a public Slack with a dedicated channel for contributors and -maintainers of open source projects hosted by New Relic. If you are -contributing to this project, you're welcome to request access to the -\#oss-contributors channel in the newrelicusers.slack.com workspace. To request -access, see https://newrelicusers-signup.herokuapp.com/. - -## PR Guidelines - -### Version Support - -When contributing, keep in mind that New Relic customers (that's you!) are running many different versions of Node, some of them pretty old. Changes that depend on the newest version of Node will probably be rejected, especially if they replace something backwards compatible. - -Be aware that the instrumentation needs to work with a wide range of versions of the instrumented modules, and that code that looks nonsensical or overcomplicated may be that way for compatibility-related reasons. Read all the comments and check the related tests before deciding whether existing code is incorrect. - -If you’re planning on contributing a new feature or an otherwise complex contribution, we kindly ask you to start a conversation with the maintainer team by opening up an Github issue first. - -### General Guidelines - -In general, we try to limit adding third-party production dependencies. If one is necessary, please be prepared to make a clear case for the need. - -### Coding Style Guidelines/Conventions - -We use eslint to enforce certain coding standards. Please see our [.eslintrc](./.eslintrc.js) file for specific rule configuration. - -### Testing Guidelines - -The koa instrumentation module includes a suite of unit and functional tests which should be used to -verify your changes don't break existing functionality. - -Unit tests are stored in `tests/`. They're written in -[node-tap](https://github.com/isaacs/node-tap), and have the extension `.tap.js`. - -Functional tests against specific versions of instrumented modules are stored -in `test/versioned/`. They are also written in `node-tap`. - -#### Running Tests - -Running the test suite is simple. Just run: - - npm test - -This will install all the necessary modules and run the unit tests in standalone mode, followed by -the functional tests if all of the unit tests pass. - -To just run unit tests, run the following: - - npm run unit - -#### Writing Tests - -For most contributions it is strongly recommended to add additional tests which -exercise your changes. This helps us efficiently incorporate your changes into -our mainline codebase and provides a safeguard that your change won't be broken -by future development. Because of this, we require that all changes come with -tests. You are welcome to submit pull requests with untested changes, but they -won't be merged until you or the development team have an opportunity to write -tests for them. - -There are some rare cases where code changes do not result in changed -functionality (e.g. a performance optimization) and new tests are not required. -In general, including tests with your pull request dramatically increases the -chances it will be accepted. diff --git a/node_modules/@newrelic/koa/LICENSE b/node_modules/@newrelic/koa/LICENSE deleted file mode 100644 index b09cd785..00000000 --- a/node_modules/@newrelic/koa/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@newrelic/koa/NEWS.md b/node_modules/@newrelic/koa/NEWS.md deleted file mode 100644 index 0873370c..00000000 --- a/node_modules/@newrelic/koa/NEWS.md +++ /dev/null @@ -1,129 +0,0 @@ -### 5.0.0 (2020-11-02) - -* Removed Node v8.x from CI - -### 4.1.0 (2020-10-13) - -* Fixed bug where _matchedRoute instrumentation would throw if there was - no active transaction. - - Thank you to @jgeurts for the contribution! - -* Added Node 14 testing to CI. - - Thank you to @jgeurts for the contribution! - - Node 14 appears safe to use with this package based on existing testing. Official - sign-off on Node 14 support for the Node.js agent all supporting packages will come - in a future release. - -* Bumped node-test-utilities to ^4.0.0. - -* Added additional dependency language to bottom of third party notices. - -* Updated README, contrib guidelines and templates to better match new open - by default standards. - -* Updated readme with community-plus header. - -* Updated README as part of the repo consistency project. - -* Added additional files to npm ignore. - -* Added open source policy workflow to repository. - -### 4.0.0 (2020-07-13) - -* Updated to Apache 2.0 license. -* Bumped minimum peer dependency (and dev dependency) of newrelic (agent) to 6.11 for license matching. -* Added code of conduct file. -* Updated readme with more detail. -* Updated pull request template. -* Added issue templates for bugs and enhancements. -* Updated contributing guide. -* Migrated CI to GitHub Actions. -* Added copyright headers to all source files. -* Removed Coveralls integration. -* Added third party notices file and metadata for dependencies. -* Bumped minimum versions of tap, coveralls and semver. -* Added repository property to package.json. -* Limited koa-router and @koa/router tests to below versions with known naming issues (8.0.3+). -* Modified router-instrumentation.js to fully conform with linting rules. - -### 3.0.0 (2019-10-18): -* add @koa/router instrumentation - - Thanks to @zacanger for this contribution. - -* **BREAKING** Removed support for Node 6, 7, and 9. - - The minimum supported version is now Node v8. For further information on our support policy, see: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent. - -* Added support for Node v12. - -* Bumps `tap` to latest major version. - -### 2.0.0 (2019-05-21): - -* `koa-router` instrumentation now names transactions after the internal `koa-router` matched route. In the case of multiple matches, the last matched route that can serve requests is used. - -* Added `allowedMethods` middleware coverage. - -* Fixed issue where `koa` middleware instrumentation did not accurately track `next` method. This could impact custom transaction naming and router framework naming, in certain situations. - -### 1.0.8 (2019-01-07): - -* Bumped `@newrelic/test-utilities` dependency to v3.0.0. - -### 1.0.7 (2018-11-5): - -* Adds support for naming transactions without setting the `context.body` property. - -* Added missing instrumentation hooks when module imported directly. - -* Upgraded dev dependencies. - -### 1.0.6 (2018-09-12): - -* Fixed coveralls link in readme to point at default branch. - -* Removed testing on Node 4 and 5 for Koa and dependent modules. - - Koa versions that supported Node 4 and 5 had an open dependency on `debug` - (e.g. `"debug": "*"`). The latest major version of `debug` no longer works on - Node <6 thus rendering these older versions of Koa unusable on Node <6 as well. - -### 1.0.5 (2018-04-12): - -* Upgraded `newrelic` peerDep semver to allow newest major version. - - Thanks @cesine for the PR! - -### 1.0.4 (2018-04-11): - -* Moved `methods` from `devDependencies` to `dependencies`. - - This fixes an error caused by an oversight in the last release, which included `methods` used as a core dep. - -### 1.0.3 (2018-04-10): - -* Added support for the `koa-route` routing module. - - Transactions will now be correctly named when routing using the `koa-route` - module. Huge thanks to @shumsky for the contribution! - -### 1.0.2 (2018-03-22): - -* Added check against `Koa.prototype` before instrumenting. - - This ensures that we aren't wrapping versions below 2.0, which would break once middleware - are executed. - -### 1.0.1 (2018-03-15): - -* Updated instrumentation to hook into `context.response._body` instead of - `context.body`. - - This ensures delegation is not overridden regardless of whether users define - the body directly on `ctx`, or on `ctx.response`. Thanks @qventura for the investigation! - modules. diff --git a/node_modules/@newrelic/koa/README.md b/node_modules/@newrelic/koa/README.md deleted file mode 100644 index 606285f8..00000000 --- a/node_modules/@newrelic/koa/README.md +++ /dev/null @@ -1,104 +0,0 @@ -[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus) - -# New Relic Koa instrumentation [![koa instrumentation CI][1]][2] - -New Relic's official Koa framework instrumentation for use with the -New Relic [Node.js agent](https://github.com/newrelic/node-newrelic). - -This module is a dependency of the agent and is installed by default when you install the agent. - -## Installation - -Typically, most users use the version auto-installed by the agent. You can see agent install instructions [here](https://github.com/newrelic/node-newrelic#installation-and-getting-started). - -In some cases, installing a specific version is ideal. For example, new features or major changes might be released via a major version update to this module, prior to inclusion in the main New Relic Node.js Agent. - -``` -npm install @newrelic/koa -``` - -```js -// index.js -require('@newrelic/koa') -``` - -For more information, please see the agent [installation guide][3]. - -## Getting Started - -Our [API and developer documentation](http://newrelic.github.io/node-newrelic/docs/) for writing instrumentation will be of help. We particularly recommend the tutorials and various "shim" API documentation. - -## Usage - -In addition to the Koa framework, we support additional specific routing modules. - -### Supported Routing Modules - -- koa-router -- koa-route - -For more information, please see the agent [compatibility and requirements][4]. - -## Testing - -The module includes a suite of unit and functional tests which should be used to -verify that your changes don't break existing functionality. - -All tests are stored in `tests/` and are written using -[Tap](https://www.npmjs.com/package/tap) with the extension `.tap.js`. - -To run the full suite, run: `npm test`. - -Individual test scripts include: - -``` -npm run unit -npm run versioned -``` - -## Support - -Should you need assistance with New Relic products, you are in good hands with several support channels. - -If the issue has been confirmed as a bug or is a feature request, please file a GitHub issue. - -**Support Channels** - -* [New Relic Documentation](https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/introduction-new-relic-nodejs): Comprehensive guidance for using our platform -* [New Relic Community](https://discuss.newrelic.com/c/support-products-agents/node-js-agent/): The best place to engage in troubleshooting questions -* [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications -* [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level -* [New Relic Technical Support](https://support.newrelic.com/) 24/7/365 ticketed support. Read more about our [Technical Support Offerings](https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/support-plan). - -## Privacy -At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise. - -We define “Personal Data” as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address and email address. - -For more information, review [New Relic’s General Data Privacy Notice](https://newrelic.com/termsandconditions/privacy). - -## Contribute - -We encourage your contributions to improve the koa instrumentation module! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. - -If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com. - -**A note about vulnerabilities** - -As noted in our [security policy](https://github.com/newrelic/node-newrelic-koa/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals. - -If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic). - -If you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md). - -To [all contributors](https://github.com/newrelic/node-newrelic-koa/graphs/contributors), we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to [New Relic Koa (Node)](https://opensource.newrelic.com/projects/newrelic/node-newrelic-koa). - -## License -New Relic Koa instrumentation is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License. - -New Relic Koa instrumentation also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document. - -[1]: https://github.com/newrelic/node-newrelic-koa/workflows/koa%20Instrumentation%20CI/badge.svg -[2]: https://github.com/newrelic/node-newrelic-koa/actions -[3]: https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/install-nodejs-agent -[4]: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent diff --git a/node_modules/@newrelic/koa/THIRD_PARTY_NOTICES.md b/node_modules/@newrelic/koa/THIRD_PARTY_NOTICES.md deleted file mode 100644 index 14fdc9d4..00000000 --- a/node_modules/@newrelic/koa/THIRD_PARTY_NOTICES.md +++ /dev/null @@ -1,666 +0,0 @@ -# Third Party Notices - -The New Relic Koa Instrumentation uses source code from third party libraries which carry -their own copyright notices and license terms. These notices are provided -below. - -In the event that a required notice is missing or incorrect, please notify us -by e-mailing [open-source@newrelic.com](mailto:open-source@newrelic.com). - -For any licenses that require the disclosure of source -code, the source code can be found at [https://github.com/newrelic/node-newrelic-koa](https://github.com/newrelic/node-newrelic-koa). - -## Content - -**[dependencies](#dependencies)** - -* [methods](#methods) - -**[devDependencies](#devDependencies)** - -* [@koa/router](#koarouter) -* [@newrelic/test-utilities](#newrelictest-utilities) -* [eslint](#eslint) -* [koa-route](#koa-route) -* [koa-router](#koa-router) -* [koa](#koa) -* [newrelic](#newrelic) -* [semver](#semver) -* [tap](#tap) - - -## dependencies - -### methods - -This product includes source derived from [methods](https://github.com/jshttp/methods) ([v1.1.2](https://github.com/jshttp/methods/tree/v1.1.2)), distributed under the [MIT License](https://github.com/jshttp/methods/blob/v1.1.2/LICENSE): - -``` -(The MIT License) - -Copyright (c) 2013-2014 TJ Holowaychuk -Copyright (c) 2015-2016 Douglas Christopher Wilson - -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. - - -``` - - -## devDependencies - -### @koa/router - -This product includes source derived from [@koa/router](https://github.com/koajs/koa-router) ([v8.0.8](https://github.com/koajs/koa-router/tree/v8.0.8)), distributed under the [MIT License](https://github.com/koajs/koa-router/blob/v8.0.8/LICENSE): - -``` -The MIT License (MIT) - -Copyright (c) 2015 Alexander C. Mingoia - -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. - -``` - -### @newrelic/test-utilities - -This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v4.1.1](https://github.com/newrelic/node-test-utilities/tree/v4.1.1)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v4.1.1/LICENSE): - -``` - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -``` - -### eslint - -This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v5.16.0](https://github.com/eslint/eslint/tree/v5.16.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v5.16.0/LICENSE): - -``` -Copyright JS Foundation and other contributors, https://js.foundation - -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. - -``` - -### koa-route - -This product includes source derived from [koa-route](https://github.com/koajs/route) ([v3.2.0](https://github.com/koajs/route/tree/3.2.0)), distributed under the [MIT License](https://github.com/koajs/route/blob/3.2.0/Readme.md): - -``` -MIT License Copyright (c) - -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 (including the next paragraph) 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. -``` - -### koa-router - -This product includes source derived from [koa-router](https://github.com/alexmingoia/koa-router) ([v7.4.0](https://github.com/alexmingoia/koa-router/tree/v7.4.0)), distributed under the [MIT License](https://github.com/alexmingoia/koa-router/blob/v7.4.0/LICENSE): - -``` -The MIT License (MIT) - -Copyright (c) 2015 Alexander C. Mingoia - -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. - -``` - -### koa - -This product includes source derived from [koa](https://github.com/koajs/koa) ([v2.13.0](https://github.com/koajs/koa/tree/v2.13.0)), distributed under the [MIT License](https://github.com/koajs/koa/blob/v2.13.0/LICENSE): - -``` -(The MIT License) - -Copyright (c) 2019 Koa contributors - -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. - -``` - -### newrelic - -This product includes source derived from [newrelic](https://github.com/newrelic/node-newrelic) ([v6.13.1](https://github.com/newrelic/node-newrelic/tree/v6.13.1)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic/blob/v6.13.1/LICENSE): - -``` - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -``` - -### semver - -This product includes source derived from [semver](https://github.com/npm/node-semver) ([v5.7.1](https://github.com/npm/node-semver/tree/v5.7.1)), distributed under the [ISC License](https://github.com/npm/node-semver/blob/v5.7.1/LICENSE): - -``` -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - -``` - -### tap - -This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v14.10.8](https://github.com/tapjs/node-tap/tree/v14.10.8)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v14.10.8/LICENSE): - -``` -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - -``` - ------ - -Portions copyright Node.js contributors. Depending on your existing libraries and package management settings, -your systems may call externally maintained libraries in addition to those listed above. -See [here](https://nodejs.org/en/docs/meta/topics/dependencies/) and [here](https://github.com/nodejs/node/blob/v4.3.1/LICENSE) -for additional details regarding externally maintained libraries and certain related licenses and notices.” diff --git a/node_modules/@newrelic/koa/index.js b/node_modules/@newrelic/koa/index.js deleted file mode 100644 index a0842166..00000000 --- a/node_modules/@newrelic/koa/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/** - * Allows users to `require('@newrelic/koa')` directly in their app. If they - * for some reason choose to explicitly use an older version of our instrumentation - * then the supportability metrics for custom instrumentation will trigger. - */ -const newrelic = require('newrelic') -newrelic.instrumentWebframework('koa', require('./lib/instrumentation')) -newrelic.instrumentWebframework('koa-route', require('./lib/route-instrumentation')) -newrelic.instrumentWebframework('koa-router', require('./lib/router-instrumentation')) diff --git a/node_modules/@newrelic/koa/lib/instrumentation.js b/node_modules/@newrelic/koa/lib/instrumentation.js deleted file mode 100644 index bb4b50d2..00000000 --- a/node_modules/@newrelic/koa/lib/instrumentation.js +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function initialize(shim, Koa) { - if (!shim || !Koa || Object.keys(Koa.prototype).length > 1) { - shim.logger.debug( - 'Koa instrumentation function called with incorrect arguments, not instrumenting.' - ) - return - } - - shim.setFramework(shim.KOA) - - shim.wrapMiddlewareMounter(Koa.prototype, 'use', wrapMiddleware) - shim.wrapReturn(Koa.prototype, 'createContext', wrapCreateContext) - - // The application is used to handle unhandled errors in the application. We - // want to notice those. - shim.wrap(Koa.prototype, 'emit', function wrapper(shim, original) { - return function wrappedEmit(evt, err, ctx) { - if (evt === 'error' && ctx) { - shim.noticeError(ctx.req, err) - } - return original.apply(this, arguments) - } - }) -} - -function wrapMiddleware(shim, middleware) { - // Skip middleware that are already wrapped. - if (shim.isWrapped(middleware)) { - return middleware - } - - if (middleware.router) { - shim.logger.info( - [ - 'Found uninstrumented router property on Koa middleware.', - 'This may indicate either an unsupported routing library is being used,', - 'or a particular version of a supported library is not fully instrumented.' - ].join(' ') - ) - } - - return shim.recordMiddleware(middleware, { - type: shim.MIDDLEWARE, - promise: true, - appendPath: true, - next: shim.LAST, - req: function getReq(shim, fn, fnName, args) { - return args[0] && args[0].req - } - }) -} - -function wrapCreateContext(shim, fn, fnName, context) { - // Many of the properties on the `context` object are just aliases for the same - // property on the `request` or `response` objects. We take advantage of this - // by just intercepting the `request` or `response` property and don't touch - // the `context` property. - // - // See: https://github.com/koajs/koa/blob/master/lib/context.js#L186-L241 - - // The `context.body` and `context.response.body` properties are how users set - // the response contents. It is roughly equivalent to `res.send()` in Express. - // Under the hood, these set the `_body` property on the `context.response`. - context.__NR_body = context.response.body - context.__NR_bodySet = false - Object.defineProperty(context.response, '_body', { - get: () => context.__NR_body, - set: function setBody(val) { - if (!context.__NR_koaRouter) { - shim.savePossibleTransactionName(context.req) - } - context.__NR_body = val - context.__NR_bodySet = true - } - }) - - context.__NR_matchedRoute = null - context.__NR_koaRouter = false - Object.defineProperty(context, '_matchedRoute', { - get: () => context.__NR_matchedRoute, - set: (val) => { - const match = getLayerForTransactionName(context) - - // match should never be undefined given _matchedRoute was set - if (match) { - const tx = shim.agent.tracer.getTransaction() - - // Transaction may be null, see: - // - https://github.com/newrelic/node-newrelic-koa/issues/32 - // - https://github.com/newrelic/node-newrelic-koa/issues/33 - if (tx) { - if (context.__NR_matchedRoute) { - tx.nameState.popPath() - } - - tx.nameState.appendPath(match.path) - tx.nameState.markPath() - } - } - - context.__NR_matchedRoute = val - // still true if somehow match is undefined because we are - // using koa-router naming and don't want to allow default naming - context.__NR_koaRouter = true - } - }) - - // Sometimes people just set `context.status` or `context.response.status` - // without setting a body. When this happens we'll want to use that as the - // response point to name the transaction. `context.status` is just an alias - // for `context.response.status` so we only wrap the latter. - const statusDescriptor = getInheritedPropertyDescriptor(context.response, 'status') - if (!statusDescriptor) { - shim.logger.debug('Failed to find status descriptor on context.response') - return - } else if (!statusDescriptor.get || !statusDescriptor.set) { - shim.logger.debug(statusDescriptor, 'Status descriptor missing getter/setter pair') - return - } - - Object.defineProperty(context.response, 'status', { - get: () => statusDescriptor.get.call(context.response), - set: function setStatus(val) { - if (!context.__NR_bodySet && !context.__NR_koaRouter) { - shim.savePossibleTransactionName(context.req) - } - return statusDescriptor.set.call(this, val) - } - }) -} - -function getLayerForTransactionName(context) { - // Context.matched might be null - // See https://github.com/newrelic/node-newrelic-koa/pull/29 - if (!context.matched) { - return null - } - for (let i = context.matched.length - 1; i >= 0; i--) { - const layer = context.matched[i] - if (layer.opts.end) { - return layer - } - } - - return null -} - -function getInheritedPropertyDescriptor(obj, property) { - let proto = obj - let descriptor = null - do { - descriptor = Object.getOwnPropertyDescriptor(proto, property) - proto = Object.getPrototypeOf(proto) - } while (!descriptor && proto) - - return descriptor -} diff --git a/node_modules/@newrelic/koa/lib/route-instrumentation.js b/node_modules/@newrelic/koa/lib/route-instrumentation.js deleted file mode 100644 index 18597715..00000000 --- a/node_modules/@newrelic/koa/lib/route-instrumentation.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const methods = require('methods') - -module.exports = function instrumentRoute(shim, route) { - shim.setFramework(shim.KOA) - - methods.forEach(function wrap(method) { - shim.wrap(route, method, function wrapMethod(shim, methodFn) { - return function wrappedMethod() { - const middleware = methodFn.apply(route, arguments) - return shim.recordMiddleware(middleware, { - type: shim.MIDDLEWARE, - route: arguments[0], - next: shim.LAST, - name: shim.getName(arguments[1]), - promise: true, - req: function getReq(shim, fn, fnName, args) { - return args[0] && args[0].req - } - }) - } - }) - }) -} diff --git a/node_modules/@newrelic/koa/lib/router-instrumentation.js b/node_modules/@newrelic/koa/lib/router-instrumentation.js deleted file mode 100644 index 99a6a1e2..00000000 --- a/node_modules/@newrelic/koa/lib/router-instrumentation.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function instrumentRouter(shim, Router) { - shim.setFramework(shim.KOA) - - const proto = Router.prototype - - shim.wrapReturn(proto, 'register', wrapMiddleware) - shim.wrapReturn(proto, 'allowedMethods', wrapAllowedMethods) - shim.wrapReturn(proto, 'routes', wrapRoutes) - shim.wrapReturn(proto, 'middleware', wrapRoutes) - - shim.wrapMiddlewareMounter(proto, 'param', { - route: shim.FIRST, - wrapper: function wrapParamware(shim, paramware, fnName, route) { - return shim.recordParamware(paramware, { - name: route, - next: shim.LAST, - promise: true, - appendPath: false, - req: function getReq(shim, fn, _fnName, args) { - return args[1] && args[1].req - } - }) - } - }) - - function wrapMiddleware(shim, fn, name, layer) { - if (!isLayer(layer)) { - return - } - - const spec = { - route: () => layer.path, // defer retrieval - type: shim.MIDDLEWARE, - next: shim.LAST, - promise: true, - appendPath: false, - req: function getReq(shim, func, fnName, args) { - return args[0] && args[0].req - } - } - - layer.stack = layer.stack.map(function wrapLayerMiddleware(m) { - // allowedMethods middleware can exist in a stack so we need to - // protect against re-instrumenting. - if (shim.isWrapped(m)) { - return m - } - - return shim.recordMiddleware(m, spec) - }) - } -} - -function wrapAllowedMethods(shim, fn, name, allowedMethodsMiddleware) { - const wrapped = shim.wrap(allowedMethodsMiddleware, wrapAllowedMethodsMiddleware) - - return shim.recordMiddleware(wrapped, { - name: allowedMethodsMiddleware.name, - type: shim.MIDDLEWARE, - promise: true, - appendPath: false, - next: shim.LAST, - req: function getReq(shim, func, fnName, args) { - return args[0] && args[0].req - } - }) -} - -function wrapAllowedMethodsMiddleware(shim, original) { - return function setRouteHandledOnContextWrapper() { - const [ctx] = shim.argsToArray.apply(shim, arguments) - ctx.__NR_koaRouter = true - - return original.apply(this, arguments) - } -} - -function wrapRoutes(shim, fn, name, dispatchMiddleware) { - if (shim.isWrapped(dispatchMiddleware)) { - return dispatchMiddleware - } - const wrappedDispatch = shim.recordMiddleware(dispatchMiddleware, { - type: shim.ROUTER, - promise: true, - appendPath: false, - next: shim.LAST, - req: function getReq(shim, func, fnName, args) { - return args[0] && args[0].req - } - }) - - // copy keys from dispatchMiddleware to wrapped version - return Object.assign(wrappedDispatch, dispatchMiddleware) -} - -function isLayer(obj) { - return !!(obj.paramNames && obj.path) -} diff --git a/node_modules/@newrelic/koa/nr-hooks.js b/node_modules/@newrelic/koa/nr-hooks.js deleted file mode 100644 index f25ef707..00000000 --- a/node_modules/@newrelic/koa/nr-hooks.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = [{ - type: 'web-framework', - moduleName: 'koa', - onRequire: require('./lib/instrumentation') -}, { - type: 'web-framework', - moduleName: 'koa-router', - onRequire: require('./lib/router-instrumentation') -}, { - type: 'web-framework', - moduleName: '@koa/router', - onRequire: require('./lib/router-instrumentation') -}, { - type: 'web-framework', - moduleName: 'koa-route', - onRequire: require('./lib/route-instrumentation') -}] diff --git a/node_modules/@newrelic/koa/package.json b/node_modules/@newrelic/koa/package.json deleted file mode 100644 index 9dcf088d..00000000 --- a/node_modules/@newrelic/koa/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "@newrelic/koa@^5.0.0", - "_id": "@newrelic/koa@5.0.0", - "_inBundle": false, - "_integrity": "sha512-4jzRXnUe38gQkZI8K4tWQ6CNdCNTi5uKILf1dTkyT6LpGxzDSLPwVyJ6xtMSMzr8SjIPG7lyNoWe42q8wFA7jg==", - "_location": "/@newrelic/koa", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@newrelic/koa@^5.0.0", - "name": "@newrelic/koa", - "escapedName": "@newrelic%2fkoa", - "scope": "@newrelic", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/@newrelic/koa/-/koa-5.0.0.tgz", - "_shasum": "ab9668c56a7a68ee37a6791382bd83b3824a7acf", - "_spec": "@newrelic/koa@^5.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "bugs": { - "url": "https://github.com/newrelic/node-newrelic-koa/issues" - }, - "bundleDependencies": false, - "dependencies": { - "methods": "^1.1.2" - }, - "deprecated": false, - "description": "Koa instrumentation for the New Relic Node agent", - "devDependencies": { - "@koa/router": "^8.0.0", - "@newrelic/test-utilities": "^4.0.0", - "eslint": "^5.8.0", - "koa": "^2.6.1", - "koa-route": "^3.2.0", - "koa-router": "^7.4.0", - "newrelic": "^6.11.0", - "semver": "^5.7.1", - "tap": "^14.10.7" - }, - "directories": { - "lib": "lib", - "test": "tests" - }, - "engines": { - "node": ">=10.0.0" - }, - "homepage": "https://github.com/newrelic/node-newrelic-koa#readme", - "license": "Apache-2.0", - "main": "index.js", - "name": "@newrelic/koa", - "peerDependencies": { - "newrelic": ">=6.11.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/newrelic/node-newrelic-koa.git" - }, - "scripts": { - "lint": "eslint *.js lib tests", - "test": "npm run unit && npm run versioned", - "unit": "tap tests/unit/**/*.tap.js --no-coverage", - "versioned": "versioned-tests --minor -i 2 'tests/versioned/*.tap.js'" - }, - "version": "5.0.0" -} diff --git a/node_modules/@newrelic/koa/tests/unit/koa.tap.js b/node_modules/@newrelic/koa/tests/unit/koa.tap.js deleted file mode 100644 index 5d71caa0..00000000 --- a/node_modules/@newrelic/koa/tests/unit/koa.tap.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var tap = require('tap') -var utils = require('@newrelic/test-utilities') - -utils.tap - -tap.test('Koa instrumentation', function(t) { - var helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'koa', - type: 'web-framework', - onRequire: require('../../lib/instrumentation') - }) - var Koa = require('koa') - - var wrapped = [ 'createContext', 'use', 'emit' ] - var notWrapped = [ - 'handleRequest', 'listen', 'toJSON', - 'inspect', 'callback', 'onerror' - ] - - wrapped.forEach(function(method) { - t.ok(Koa.prototype[method].__NR_original, method + ' is wrapped, as expected') - }) - notWrapped.forEach(function(method) { - t.notOk(Koa.prototype[method].__NR_original, method + ' is not wrapped, as expected') - }) - - helper && helper.unload() - t.end() -}) diff --git a/node_modules/@newrelic/koa/tests/unit/newrelic.js b/node_modules/@newrelic/koa/tests/unit/newrelic.js deleted file mode 100644 index 5bfe5371..00000000 --- a/node_modules/@newrelic/koa/tests/unit/newrelic.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -exports.config = { - app_name: ['My Application'], - license_key: 'license key here', - logging: { - level: 'trace', - filepath: '../../../newrelic_agent.log' - }, - utilization: { - detect_aws: false, - detect_pcf: false, - detect_azure: false, - detect_gcp: false, - detect_docker: false - }, - transaction_tracer: { - enabled: true - } -} diff --git a/node_modules/@newrelic/koa/tests/unit/route.tap.js b/node_modules/@newrelic/koa/tests/unit/route.tap.js deleted file mode 100644 index 53b0759a..00000000 --- a/node_modules/@newrelic/koa/tests/unit/route.tap.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var tap = require('tap') -var utils = require('@newrelic/test-utilities') -var methods = require('methods') - -tap.test('koa-route', function(t) { - var helper = utils.TestAgent.makeInstrumented() - - t.tearDown(function() { - helper.unload() - }) - - helper.registerInstrumentation({ - type: 'web-framework', - moduleName: 'koa-route', - onRequire: require('../../lib/route-instrumentation.js') - }) - - t.test('methods', function(t) { - var route = require('koa-route') - methods.forEach(function checkWrapped(method) { - t.type( - route[method].__NR_original, - 'function', - method + ' should be wrapped' - ) - }) - t.end() - }) - - t.autoend() -}) diff --git a/node_modules/@newrelic/koa/tests/unit/router.tap.js b/node_modules/@newrelic/koa/tests/unit/router.tap.js deleted file mode 100644 index 69b0ff51..00000000 --- a/node_modules/@newrelic/koa/tests/unit/router.tap.js +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var tap = require('tap') -var utils = require('@newrelic/test-utilities') -var methods = require('methods') -var instrumentation = require('../../lib/router-instrumentation.js') - -var WRAPPED_METHODS = [ - 'param', - 'register', - 'routes', - 'middleware', - 'allowedMethods' -] - -var UNWRAPPED_METHODS = methods.concat([ - 'use', - 'prefix', - 'all', - 'redirect', - 'route', - 'url', - 'match' -]) - -var UNWRAPPED_STATIC_METHODS = [ - 'url' -] - -tap.test('koa-router', function tests(t) { - var helper = utils.TestAgent.makeInstrumented() - t.tearDown(function() {helper.unload()}) - helper.registerInstrumentation({ - type: 'web-framework', - moduleName: 'koa-router', - onRequire: instrumentation - }) - - t.test('mounting paramware', function(t) { - var Router = require('koa-router') - var router = new Router() - router.param('second', function() {}) - t.type( - router.params.second.__NR_original, - 'function', - 'param function should be wrapped' - ) - t.end() - }) - - t.test('methods', function(t) { - var Router = require('koa-router') - WRAPPED_METHODS.forEach(function checkWrapped(method) { - t.type( - Router.prototype[method].__NR_original, - 'function', - method + ' should be a wrapped method on the prototype' - ) - }) - UNWRAPPED_METHODS.forEach(function checkUnwrapped(method) { - t.type( - Router.prototype[method].__NR_original, - 'undefined', - method + ' should be a unwrapped method on the prototype' - ) - }) - UNWRAPPED_STATIC_METHODS.forEach(function checkUnwrappedStatic(method) { - t.type( - Router[method].__NR_original, - 'undefined', - method + ' should be an unwrapped static method' - ) - }) - t.end() - }) - t.autoend() -}) - -tap.test('@koa/router', function tests(t) { - var helper = utils.TestAgent.makeInstrumented() - t.tearDown(function() {helper.unload()}) - helper.registerInstrumentation({ - type: 'web-framework', - moduleName: '@koa/router', - onRequire: instrumentation - }) - - t.test('mounting paramware', function(t) { - var Router = require('@koa/router') - var router = new Router() - router.param('second', function() {}) - t.type( - router.params.second.__NR_original, - 'function', - 'param function should be wrapped' - ) - t.end() - }) - - t.test('methods', function(t) { - var Router = require('@koa/router') - WRAPPED_METHODS.forEach(function checkWrapped(method) { - t.type( - Router.prototype[method].__NR_original, - 'function', - method + ' should be a wrapped method on the prototype' - ) - }) - UNWRAPPED_METHODS.forEach(function checkUnwrapped(method) { - t.type( - Router.prototype[method].__NR_original, - 'undefined', - method + ' should be a unwrapped method on the prototype' - ) - }) - UNWRAPPED_STATIC_METHODS.forEach(function checkUnwrappedStatic(method) { - t.type( - Router[method].__NR_original, - 'undefined', - method + ' should be an unwrapped static method' - ) - }) - t.end() - }) - t.autoend() -}) diff --git a/node_modules/@newrelic/koa/tests/versioned/koa-route.tap.js b/node_modules/@newrelic/koa/tests/versioned/koa-route.tap.js deleted file mode 100644 index 06c44a4c..00000000 --- a/node_modules/@newrelic/koa/tests/versioned/koa-route.tap.js +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var tap = require('tap') -var utils = require('@newrelic/test-utilities') -var http = require('http') - -utils(tap) - -tap.test('koa-route instrumentation', function(t) { - var helper = null - var app = null - var server = null - var route = null - - t.beforeEach(function(done) { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'koa', - type: 'web-framework', - onRequire: require('../../lib/instrumentation') - }) - helper.registerInstrumentation({ - moduleName: 'koa-route', - type: 'web-framework', - onRequire: require('../../lib/route-instrumentation') - }) - var Koa = require('koa') - app = new Koa() - route = require('koa-route') - done() - }) - - t.afterEach(function(done) { - server.close() - app = null - route = null - helper && helper.unload() - done() - }) - - t.test('should name and produce segments for koa-route middleware', function(t) { - var first = route.get('/resource', function firstMiddleware(ctx) { - ctx.body = 'hello' - }) - app.use(first) - helper.agent.on('transactionFinished', function(tx) { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//resource', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//resource' - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//resource', - 'transaction should be named after the middleware responsible for responding' - ) - t.end() - }) - run('/resource') - }) - - t.test('should name the transaction after the last responder', function(t) { - var first = route.get('/:first', function firstMiddleware(ctx, param, next) { - ctx.body = 'first' - return next() - }) - var second = route.get('/:second', function secondMiddleware(ctx) { - ctx.body = 'second' - }) - app.use(first) - app.use(second) - helper.agent.on('transactionFinished', function(tx) { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [ - { - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - } - ] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the middleware responsible for responding' - ) - t.end() - }) - run() - }) - - t.test('should name the transaction properly when responding after next', function(t) { - var first = route.get('/:first', function firstMiddleware(ctx, param, next) { - return next().then(function respond() { - ctx.body = 'first' - }) - }) - var second = route.get('/:second', function secondMiddleware(ctx) { - ctx.body = 'second' - }) - app.use(first) - app.use(second) - helper.agent.on('transactionFinished', function(tx) { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [ - { - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - } - ] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the middleware responsible for responding' - ) - t.end() - }) - run() - }) - - t.test('should work with early responding', function(t) { - var first = route.get('/:first', function firstMiddleware(ctx) { - ctx.body = 'first' - return Promise.resolve() - }) - var second = route.get('/:second', function secondMiddleware(ctx) { - ctx.body = 'second' - }) - app.use(first) - app.use(second) - helper.agent.on('transactionFinished', function(tx) { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the middleware responsible for responding' - ) - t.end() - }) - run() - }) - - t.test( - 'should name the transaction after the source of the error that occurred', - function(t) { - var first = route.get('/:first', function firstMiddleware(ctx, param, next) { - return next() - }) - var second = route.get('/:second', function secondMiddleware() { - throw new Error('some error') - }) - app.use(first) - app.use(second) - helper.agent.on('transactionFinished', function(tx) { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [ - { - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - } - ] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the middleware responsible for responding' - ) - t.end() - }) - run() - }) - - t.test('should work properly when used along with non-route middleware', function(t) { - var first = function firstMiddleware(ctx, next) { - return next() - } - var second = route.get('/resource', function secondMiddleware(ctx, next) { - ctx.body = 'hello' - return next() - }) - var third = function thirdMiddleware(ctx, next) { - return next() - } - app.use(first) - app.use(second) - app.use(third) - helper.agent.on('transactionFinished', function(tx) { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//resource', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware', - children: [ - { - name: 'Nodejs/Middleware/Koa/secondMiddleware//resource', - children: [ - { - name: 'Nodejs/Middleware/Koa/thirdMiddleware' - } - ] - } - ] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//resource', - 'transaction should be named after the middleware responsible for responding' - ) - t.end() - }) - run('/resource') - }) - - t.autoend() - - function run(path) { - server = app.listen(0, function() { - http.get({ - port: server.address().port, - path: path || '/123' - }).end() - }) - } -}) diff --git a/node_modules/@newrelic/koa/tests/versioned/koa-router.tap.js b/node_modules/@newrelic/koa/tests/versioned/koa-router.tap.js deleted file mode 100644 index e989fa60..00000000 --- a/node_modules/@newrelic/koa/tests/versioned/koa-router.tap.js +++ /dev/null @@ -1,2047 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') -const http = require('http') - -utils(tap) - -tap.test('koa-router instrumentation', (t) => { - let helper = null - let app = null - let server = null - let router = null - let Router = null - - const paramMiddlewareName = 'Nodejs/Middleware/Koa/middleware//:first' - - function testSetup(done) { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'koa', - type: 'web-framework', - onRequire: require('../../lib/instrumentation') - }) - helper.registerInstrumentation({ - moduleName: 'koa-router', - type: 'web-framework', - onRequire: require('../../lib/router-instrumentation') - }) - const Koa = require('koa') - app = new Koa() - Router = require('koa-router') - router = new Router() - done() - } - - function tearDown(done) { - server.close(() => { - app = null - router = null - Router = null - helper && helper.unload() - - server = null - - done() - }) - } - - t.test('with single router', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name and produce segments for matched path', (t) => { - router.get( - '/:first', - function firstMiddleware(ctx, next) { - next().then(() => { - ctx.body = 'first' - }) - }, - function secondMiddleware(ctx) { - ctx.body = 'second' - } - ) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:first' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should name after matched path using middleware() alias', (t) => { - router.get('/:first', function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.middleware()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should handle transaction state loss', (t) => { - let savedCtx = null - router.get('/:any', (ctx) => { - savedCtx = ctx - }) - app.use(router.middleware()) - helper.agent.on('transactionFinished', () => { - t.doesNotThrow(() => savedCtx._matchedRoute = 'test') - t.end() - }) - run() - }) - - t.test('should name and produce segments for matched regex path', (t) => { - router.get(/.*rst$/, function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//.*rst$', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//.*rst$/' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//.*rst$', - 'transaction should be named after the matched regex pattern' - ) - t.end() - }) - run('/first') - }) - - t.test('should name and produce segments for matched wildcard path', (t) => { - router.get('/:first/(.*)', function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/(.*)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first/(.*)' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/(.*)', - 'transaction should be named after the matched regex path' - ) - t.end() - }) - run('/123/456') - }) - - t.test('should name and produce segments with router paramware', (t) => { - router.param('first', function firstParamware(id, ctx, next) { - ctx.body = 'first' - return next() - }) - router.get('/:first', function firstMiddleware(ctx, next) { - return next() - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: paramMiddlewareName, - children: [{ - name: 'Nodejs/Middleware/Koa/firstParamware//[param handler :first]', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should name transaction after matched path with erroring parameware', (t) => { - router.param('first', function firstParamware() { - throw new Error('wrong param') - }) - router.get('/:first', function firstMiddleware() {}) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: paramMiddlewareName, - children: [{ - name: 'Nodejs/Middleware/Koa/firstParamware//[param handler :first]' - }] - }] - }] - }] - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should name the transaction after the last matched path (layer)', (t) => { - router.get('/:first', function firstMiddleware(ctx, next) { - ctx.body = 'first' - return next().then(function someMoreContent() { - ctx.body = 'first' - }) - }) - router.get('/:second', function secondMiddleware(ctx) { - ctx.body += ' second' - }) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('tx name should not be named after error handling middleware', (t) => { - app.use(function errorHandler(ctx, next) { - return next().catch((err) => { - ctx.body = { err: err.message } - }) - }) - - router.get('/:first', function firstMiddleware(ctx) { - ctx.throw(400, '☃') - }) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/errorHandler', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - }] - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 0, 'should not record error') - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched layer path' - ) - t.end() - }) - run() - }) - - t.test('transaction name should not be affected by unhandled error', (t) => { - app.use(function errorHandler(ctx, next) { - return next() - }) - - router.get('/:first', function firstMiddleware(ctx) { - ctx.throw(400, '☃') - }) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/errorHandler', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - }] - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'error should be recorded') - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched layer path' - ) - t.end() - }) - run() - }) - - t.test('should name tx after route declarations with supported http methods', (t) => { - // This will register the same middleware (i.e. secondMiddleware) - // under both the /:first and /:second routes. Use does not register middleware - // w/ supported methods they cannot handle routes. - router.use(['/:first', '/:second'], function secondMiddleware(ctx, next) { - ctx.body += ' second' - return next() - }) - router.get('/:second', function terminalMiddleware(ctx) { - ctx.body = ' second' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second', - children: [{ - name: 'Nodejs/Middleware/Koa/terminalMiddleware//:second' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the last matched path' - ) - t.end() - }) - run() - }) - - t.test('names transaction (not found) with array of paths and no handler', (t) => { - // This will register the same middleware (i.e. secondMiddleware) - // under both the /:first and /:second routes. - router.use(['/:first', '/:second'], function secondMiddleware(ctx, next) { - ctx.body += ' second' - return next() - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - children: [{ - name: 'Koa/Router: /' - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - 'transaction should be named (not found)' - ) - t.end() - }) - run() - }) - - t.test( - 'names tx (not found) when no matching route and base middleware does not set body', - (t) => { - app.use(function baseMiddleware(ctx, next) { - next() - }) - - // This will register the same middleware (i.e. secondMiddleware) - // under both the /:first and /:second routes. - router.get('/first', function secondMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - children: [{ - name: 'Nodejs/Middleware/Koa/baseMiddleware', - children: [{ - name: 'Koa/Router: /' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - 'transaction should be named (not found)' - ) - t.end() - }) - run('/') - } - ) - }) - - t.test('using multipler routers', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name transaction after last route for identical matches', (t) => { - Router = require('koa-router') - const router2 = new Router() - router.get('/:first', function firstMiddleware(ctx, next) { - ctx.body = 'first' - return next() - }) - - router2.get('/:second', function secondMiddleware(ctx) { - ctx.body += ' second' - }) - app.use(router.routes()) - app.use(router2.routes()) - helper.agent.on('transactionFinished', (tx) => { - // NOTE: due to an implementation detail in koa-compose, - // sequential middleware will show up as nested. This is due to - // the dispatch function blocking its returned promise on the - // resolution of a recursively returned promise. - // https://github.com/koajs/compose/blob/e754ca3c13e9248b3f453d98ea0b618e09578e2d/index.js#L42-L44 - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the most specific matched path' - ) - t.end() - }) - run() - }) - - t.test('should name tx after last matched route even if body not set', (t) => { - Router = require('koa-router') - const router2 = new Router() - router.get('/first', function firstMiddleware(ctx, next) { - ctx.body = 'first' - return next() - }) - - router2.get('/:second', function secondMiddleware() {}) - app.use(router.routes()) - app.use(router2.routes()) - helper.agent.on('transactionFinished', (tx) => { - // NOTE: due to an implementation detail in koa-compose, - // sequential middleware will show up as nested. This is due to - // the dispatch function blocking its returned promise on the - // resolution of a recursively returned promise. - // https://github.com/koajs/compose/blob/e754ca3c13e9248b3f453d98ea0b618e09578e2d/index.js#L42-L44 - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the last matched path' - ) - t.end() - }) - run('/first') - }) - }) - - t.test('using nested or prefixed routers', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name after most last matched path', (t) => { - var router2 = new Router() - router2.get('/:second', function secondMiddleware(ctx) { - ctx.body = ' second' - }) - router.use('/:first', router2.routes()) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:first/:second' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/:second', - 'transaction should be named after the last matched path' - ) - t.end() - }) - run('/123/456/') - }) - - t.test('app-level middleware should not rename tx from matched path', (t) => { - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'do not want this to set the name' - }) - }) - - const nestedRouter = new Router() - nestedRouter.get('/:second', function terminalMiddleware(ctx) { - ctx.body = 'this is a test' - }) - nestedRouter.get('/second', function secondMiddleware(ctx) { - ctx.body = 'want this to set the name' - }) - router.use('/:first', nestedRouter.routes()) - app.use(router.routes()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/terminalMiddleware//:first/:second' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - 'should be named after last matched route' - ) - t.end() - }) - run('/123/second') - }) - - t.test('app-level middleware should not rename tx from matched prefix path', (t) => { - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'do not want this to set the name' - }) - }) - - router.get('/:second', function terminalMiddleware(ctx) { - ctx.body = 'this is a test' - }) - router.get('/second', function secondMiddleware(ctx) { - ctx.body = 'want this to set the name' - }) - router.prefix('/:first') - app.use(router.routes()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/terminalMiddleware//:first/:second' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - 'should be named after the last matched path' - ) - t.end() - }) - run('/123/second') - }) - }) - - t.test('using allowedMethods', (t) => { - t.autoend() - - t.test('with throw: true', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name transaction after status `method now allowed` message', (t) => { - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'transaction should be named after corresponding status code message' - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('should name transaction after status `not implemented` message', (t) => { - router = new Router({ methods: ['POST'] }) - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - 'transaction should be named after corresponding status code message' - ) - - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('error handler normalizes tx name if body is reset without status', (t) => { - app.use(function errorHandler(ctx, next) { - return next().catch(() => { - // resetting the body without manually persisting ctx.status - // results in status 200 - ctx.body = { msg: 'error is handled' } - }) - }) - - const nestedRouter = new Router() - nestedRouter.post('/:second', function terminalMiddleware(ctx) { - ctx.body = 'would want this to set name if verb were correct' - }) - router.use('/:first', nestedRouter.routes(), nestedRouter.allowedMethods()) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/NormalizedUri/*', - children: [{ - name: 'Nodejs/Middleware/Koa/errorHandler', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/NormalizedUri/*', - 'should have normalized transaction name' - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 0, 'error should not be recorded') - t.end() - }) - run('/123/456') - }) - - t.test( - 'should name tx after status message when base middleware does not set body', - (t) => { - // Because allowedMethods throws & no user catching, it is considered - // unhandled and will push the base route back on - app.use(function baseMiddleware(ctx, next) { - return next() - // does not set ctx.body or ctx.status - }) - - const nestedRouter = new Router() - nestedRouter.post('/:second', function terminalMiddleware(ctx) { - ctx.body = 'would want this to set name if verb were correct' - }) - router.use('/:first', nestedRouter.routes(), nestedRouter.allowedMethods()) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Nodejs/Middleware/Koa/baseMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'should name after returned status code' - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'should notice thrown error') - - t.end() - }) - run('/123/456') - } - ) - }) - - t.test('with throw: false', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name transaction after status `method now allowed` message', (t) => { - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'transaction should be named after corresponding status code message' - ) - // Agent will automatically create error for 405 status code. - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('should name transaction after status `not implemented` message', (t) => { - router = new Router({ methods: ['POST'] }) - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - 'transaction should be named after corresponding status code message' - ) - // Agent will automatically create error for 501 status code. - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('should name tx after `method not allowed` with prefixed router', (t) => { - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'should not set the name' - }) - }) - router.post('/second', function secondMiddleware(ctx) { - ctx.body = 'should not set the name' - }) - router.prefix('/:first') - app.use(router.routes()) - app.use(router.allowedMethods()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'transaction should be named after corresponding status code message' - ) - t.end() - }) - run('/123/second') - }) - - t.test('should name tx after `not implemented` with prefixed router', (t) => { - router = new Router({ methods: ['POST'] }) - - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'should not set the name' - }) - }) - router.post('/second', function secondMiddleware(ctx) { - ctx.body = 'should not set the name' - }) - router.prefix('/:first') - app.use(router.routes()) - app.use(router.allowedMethods()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - 'transaction should be named after corresponding status code message' - ) - t.end() - }) - run('/123/first') - }) - - t.test('should name and produce segments for existing matched path', (t) => { - router = new Router({ methods: ['GET'] }) - router.get('/:first', function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - app.use(router.allowedMethods()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - }) - }) - - t.autoend() - - function run(path) { - server = app.listen(0, function() { - http.get({ - port: server.address().port, - path: path || '/123' - }).end() - }) - } -}) - -tap.test('@koa/router instrumentation', (t) => { - let helper = null - let app = null - let server = null - let router = null - let Router = null - - const paramMiddlewareName = 'Nodejs/Middleware/Koa/middleware//:first' - - function testSetup(done) { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'koa', - type: 'web-framework', - onRequire: require('../../lib/instrumentation') - }) - helper.registerInstrumentation({ - moduleName: '@koa/router', - type: 'web-framework', - onRequire: require('../../lib/router-instrumentation') - }) - const Koa = require('koa') - app = new Koa() - Router = require('@koa/router') - router = new Router() - done() - } - - function tearDown(done) { - server.close(() => { - app = null - router = null - Router = null - helper && helper.unload() - - server = null - - done() - }) - } - - t.test('with single router', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name and produce segments for matched path', (t) => { - router.get( - '/:first', - function firstMiddleware(ctx, next) { - next().then(() => { - ctx.body = 'first' - }) - }, - function secondMiddleware(ctx) { - ctx.body = 'second' - } - ) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:first' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should name after matched path using middleware() alias', (t) => { - router.get('/:first', function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.middleware()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should name and produce segments for matched regex path', (t) => { - router.get(/.*rst$/, function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//.*rst$', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//.*rst$/' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//.*rst$', - 'transaction should be named after the matched regex pattern' - ) - t.end() - }) - run('/first') - }) - - t.test('should name and produce segments for matched wildcard path', (t) => { - router.get('/:first/(.*)', function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/(.*)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first/(.*)' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/(.*)', - 'transaction should be named after the matched regex path' - ) - t.end() - }) - run('/123/456') - }) - - t.test('should name and produce segments with router paramware', (t) => { - router.param('first', function firstParamware(id, ctx, next) { - ctx.body = 'first' - return next() - }) - router.get('/:first', function firstMiddleware(ctx, next) { - return next() - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: paramMiddlewareName, - children: [{ - name: 'Nodejs/Middleware/Koa/firstParamware//[param handler :first]', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should name transaction after matched path with erroring parameware', (t) => { - router.param('first', function firstParamware() { - throw new Error('wrong param') - }) - router.get('/:first', function firstMiddleware() {}) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: paramMiddlewareName, - children: [{ - name: 'Nodejs/Middleware/Koa/firstParamware//[param handler :first]' - }] - }] - }] - }] - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('should name the transaction after the last matched path (layer)', (t) => { - router.get('/:first', function firstMiddleware(ctx, next) { - ctx.body = 'first' - return next().then(function someMoreContent() { - ctx.body = 'first' - }) - }) - router.get('/:second', function secondMiddleware(ctx) { - ctx.body += ' second' - }) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - - t.test('tx name should not be named after error handling middleware', (t) => { - app.use(function errorHandler(ctx, next) { - return next().catch((err) => { - ctx.body = { err: err.message } - }) - }) - - router.get('/:first', function firstMiddleware(ctx) { - ctx.throw(400, '☃') - }) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/errorHandler', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - }] - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 0, 'should not record error') - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched layer path' - ) - t.end() - }) - run() - }) - - t.test('transaction name should not be affected by unhandled error', (t) => { - app.use(function errorHandler(ctx, next) { - return next() - }) - - router.get('/:first', function firstMiddleware(ctx) { - ctx.throw(400, '☃') - }) - - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/errorHandler', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - }] - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'error should be recorded') - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched layer path' - ) - t.end() - }) - run() - }) - - t.test('should name tx after route declarations with supported http methods', (t) => { - // This will register the same middleware (i.e. secondMiddleware) - // under both the /:first and /:second routes. Use does not register middleware - // w/ supported methods they cannot handle routes. - router.use(['/:first', '/:second'], function secondMiddleware(ctx, next) { - ctx.body += ' second' - return next() - }) - router.get('/:second', function terminalMiddleware(ctx) { - ctx.body = ' second' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:first', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second', - children: [{ - name: 'Nodejs/Middleware/Koa/terminalMiddleware//:second' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the last matched path' - ) - t.end() - }) - run() - }) - - t.test('names transaction (not found) with array of paths and no handler', (t) => { - // This will register the same middleware (i.e. secondMiddleware) - // under both the /:first and /:second routes. - router.use(['/:first', '/:second'], function secondMiddleware(ctx, next) { - ctx.body += ' second' - return next() - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - children: [{ - name: 'Koa/Router: /' - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - 'transaction should be named (not found)' - ) - t.end() - }) - run() - }) - - t.test( - 'names tx (not found) when no matching route and base middleware does not set body', - (t) => { - app.use(function baseMiddleware(ctx, next) { - next() - }) - - // This will register the same middleware (i.e. secondMiddleware) - // under both the /:first and /:second routes. - router.get('/first', function secondMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - children: [{ - name: 'Nodejs/Middleware/Koa/baseMiddleware', - children: [{ - name: 'Koa/Router: /' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - 'transaction should be named (not found)' - ) - t.end() - }) - run('/') - } - ) - }) - - t.test('using multipler routers', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name transaction after last route for identical matches', (t) => { - Router = require('@koa/router') - const router2 = new Router() - router.get('/:first', function firstMiddleware(ctx, next) { - ctx.body = 'first' - return next() - }) - - router2.get('/:second', function secondMiddleware(ctx) { - ctx.body += ' second' - }) - app.use(router.routes()) - app.use(router2.routes()) - helper.agent.on('transactionFinished', (tx) => { - // NOTE: due to an implementation detail in koa-compose, - // sequential middleware will show up as nested. This is due to - // the dispatch function blocking its returned promise on the - // resolution of a recursively returned promise. - // https://github.com/koajs/compose/blob/e754ca3c13e9248b3f453d98ea0b618e09578e2d/index.js#L42-L44 - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the most specific matched path' - ) - t.end() - }) - run() - }) - - t.test('should name tx after last matched route even if body not set', (t) => { - Router = require('@koa/router') - const router2 = new Router() - router.get('/first', function firstMiddleware(ctx, next) { - ctx.body = 'first' - return next() - }) - - router2.get('/:second', function secondMiddleware() {}) - app.use(router.routes()) - app.use(router2.routes()) - helper.agent.on('transactionFinished', (tx) => { - // NOTE: due to an implementation detail in koa-compose, - // sequential middleware will show up as nested. This is due to - // the dispatch function blocking its returned promise on the - // resolution of a recursively returned promise. - // https://github.com/koajs/compose/blob/e754ca3c13e9248b3f453d98ea0b618e09578e2d/index.js#L42-L44 - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:second' - }] - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:second', - 'transaction should be named after the last matched path' - ) - t.end() - }) - run('/first') - }) - }) - - t.test('using nested or prefixed routers', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name after most last matched path', (t) => { - var router2 = new Router() - router2.get('/:second', function secondMiddleware(ctx) { - ctx.body = ' second' - }) - router.use('/:first', router2.routes()) - app.use(router.routes()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/:second', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/secondMiddleware//:first/:second' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/:second', - 'transaction should be named after the last matched path' - ) - t.end() - }) - run('/123/456/') - }) - - t.test('app-level middleware should not rename tx from matched path', (t) => { - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'do not want this to set the name' - }) - }) - - const nestedRouter = new Router() - nestedRouter.get('/:second', function terminalMiddleware(ctx) { - ctx.body = 'this is a test' - }) - nestedRouter.get('/second', function secondMiddleware(ctx) { - ctx.body = 'want this to set the name' - }) - router.use('/:first', nestedRouter.routes()) - app.use(router.routes()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/terminalMiddleware//:first/:second' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - 'should be named after last matched route' - ) - t.end() - }) - run('/123/second') - }) - - t.test('app-level middleware should not rename tx from matched prefix path', (t) => { - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'do not want this to set the name' - }) - }) - - router.get('/:second', function terminalMiddleware(ctx) { - ctx.body = 'this is a test' - }) - router.get('/second', function secondMiddleware(ctx) { - ctx.body = 'want this to set the name' - }) - router.prefix('/:first') - app.use(router.routes()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/terminalMiddleware//:first/:second' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first/second', - 'should be named after the last matched path' - ) - t.end() - }) - run('/123/second') - }) - }) - - t.test('using allowedMethods', (t) => { - t.autoend() - - t.test('with throw: true', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name transaction after status `method now allowed` message', (t) => { - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'transaction should be named after corresponding status code message' - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('should name transaction after status `not implemented` message', (t) => { - router = new Router({ methods: ['POST'] }) - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - 'transaction should be named after corresponding status code message' - ) - - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('error handler normalizes tx name if body is reset without status', (t) => { - app.use(function errorHandler(ctx, next) { - return next().catch(() => { - // resetting the body without manually persisting ctx.status - // results in status 200 - ctx.body = { msg: 'error is handled' } - }) - }) - - const nestedRouter = new Router() - nestedRouter.post('/:second', function terminalMiddleware(ctx) { - ctx.body = 'would want this to set name if verb were correct' - }) - router.use('/:first', nestedRouter.routes(), nestedRouter.allowedMethods()) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/NormalizedUri/*', - children: [{ - name: 'Nodejs/Middleware/Koa/errorHandler', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/NormalizedUri/*', - 'should have normalized transaction name' - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 0, 'error should not be recorded') - t.end() - }) - run('/123/456') - }) - - t.test( - 'should name tx after status message when base middleware does not set body', - (t) => { - // Because allowedMethods throws & no user catching, it is considered - // unhandled and will push the base route back on - app.use(function baseMiddleware(ctx, next) { - return next() - // does not set ctx.body or ctx.status - }) - - const nestedRouter = new Router() - nestedRouter.post('/:second', function terminalMiddleware(ctx) { - ctx.body = 'would want this to set name if verb were correct' - }) - router.use('/:first', nestedRouter.routes(), nestedRouter.allowedMethods()) - app.use(router.routes()) - app.use(router.allowedMethods({throw: true})) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Nodejs/Middleware/Koa/baseMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'should name after returned status code' - ) - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'should notice thrown error') - - t.end() - }) - run('/123/456') - } - ) - }) - - t.test('with throw: false', (t) => { - t.beforeEach((done) => testSetup(done)) - t.afterEach((done) => tearDown(done)) - t.autoend() - - t.test('should name transaction after status `method now allowed` message', (t) => { - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'transaction should be named after corresponding status code message' - ) - // Agent will automatically create error for 405 status code. - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('should name transaction after status `not implemented` message', (t) => { - router = new Router({ methods: ['POST'] }) - router.post('/:first', function firstMiddleware() {}) - app.use(router.routes()) - app.use(router.allowedMethods()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - 'transaction should be named after corresponding status code message' - ) - // Agent will automatically create error for 501 status code. - const errors = helper.agent.errors.eventAggregator - t.equal(errors.length, 1, 'the error has been recorded') - t.end() - }) - run() - }) - - t.test('should name tx after `method not allowed` with prefixed router', (t) => { - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'should not set the name' - }) - }) - router.post('/second', function secondMiddleware(ctx) { - ctx.body = 'should not set the name' - }) - router.prefix('/:first') - app.use(router.routes()) - app.use(router.allowedMethods()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(method not allowed)', - 'transaction should be named after corresponding status code message' - ) - t.end() - }) - run('/123/second') - }) - - t.test('should name tx after `not implemented` with prefixed router', (t) => { - router = new Router({ methods: ['POST'] }) - - app.use(function appLevelMiddleware(ctx, next) { - return next().then(() => { - ctx.body = 'should not set the name' - }) - }) - router.post('/second', function secondMiddleware(ctx) { - ctx.body = 'should not set the name' - }) - router.prefix('/:first') - app.use(router.routes()) - app.use(router.allowedMethods()) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - children: [{ - name: 'Nodejs/Middleware/Koa/appLevelMiddleware', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/allowedMethods' - }] - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not implemented)', - 'transaction should be named after corresponding status code message' - ) - t.end() - }) - run('/123/first') - }) - - t.test('should name and produce segments for existing matched path', (t) => { - router = new Router({ methods: ['GET'] }) - router.get('/:first', function firstMiddleware(ctx) { - ctx.body = 'first' - }) - app.use(router.routes()) - app.use(router.allowedMethods()) - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments( - tx.trace.root, [{ - name: 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - children: [{ - name: 'Koa/Router: /', - children: [{ - name: 'Nodejs/Middleware/Koa/firstMiddleware//:first' - }] - }] - }] - ) - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//:first', - 'transaction should be named after the matched path' - ) - t.end() - }) - run() - }) - }) - }) - - t.autoend() - - function run(path) { - server = app.listen(0, function() { - http.get({ - port: server.address().port, - path: path || '/123' - }).end() - }) - } -}) diff --git a/node_modules/@newrelic/koa/tests/versioned/koa-v1.tap.js b/node_modules/@newrelic/koa/tests/versioned/koa-v1.tap.js deleted file mode 100644 index 079e9324..00000000 --- a/node_modules/@newrelic/koa/tests/versioned/koa-v1.tap.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -/* eslint-env es6 */ -'use strict' - -var tap = require('tap') -var utils = require('@newrelic/test-utilities') -var http = require('http') - -tap.test('Koa v1', function(t) { - var helper = null - var app = null - var server = null - - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'koa', - type: 'web-framework', - onRequire: require('../../lib/instrumentation') - }) - var koa = require('koa') - app = koa() - - t.tearDown(function() { - server && server.close() - app = null - helper && helper.unload() - }) - - t.test('is not instrumented', function(t) { - app.use(function* main() { - this.body = 'done' - }) - - helper.agent.on('transactionFinished', function(tx) { - var segment = tx.trace.root.children[0] - t.equal(segment.name, 'WebTransaction/NormalizedUri/*') - t.end() - }) - - run() - }) - - t.autoend() - - function run() { - server = app.listen(0, function() { - http.get({port: server.address().port}, function(res) { - if (res.body) { - t.equal(res.body, 'done') - } - }).end() - }) - } -}) diff --git a/node_modules/@newrelic/koa/tests/versioned/koa.tap.js b/node_modules/@newrelic/koa/tests/versioned/koa.tap.js deleted file mode 100644 index c77ba925..00000000 --- a/node_modules/@newrelic/koa/tests/versioned/koa.tap.js +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') -const http = require('http') - -utils(tap) - -tap.test('Koa instrumentation', (t) => { - t.autoend() - - let helper = null - let app = null - let server = null - - t.beforeEach((done) => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'koa', - type: 'web-framework', - onRequire: require('../../lib/instrumentation') - }) - const Koa = require('koa') - app = new Koa() - done() - }) - - t.afterEach((done) => { - server && server.close() - app = null - helper && helper.unload() - done() - }) - - t.test('Should name after koa framework and verb when body set', (t) => { - t.plan(2) - - app.use(function one(ctx, next) { - return next().then(() => { - // do nothing - }) - }) - - app.use(function two(ctx) { - ctx.body = 'done' - }) - - helper.agent.on('transactionFinished', (tx) => { - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//', - 'should have name without post-response name info' - ) - }) - - run(t) - }) - - t.test('Should name (not found) when no work is performed', (t) => { - t.plan(2) - - app.use(function one(ctx, next) { - return next().then(() => { - // do nothing - }) - }) - - app.use(function two() { - // do nothing - }) - - helper.agent.on('transactionFinished', (tx) => { - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET/(not found)', - 'should name after status code message' - ) - }) - - run(t, 'Not Found') - }) - - - t.test('names the transaction after the middleware that sets the body', (t) => { - t.plan(2) - - app.use(function one(ctx, next) { - const tx = helper.getTransaction() - return next().then(() => tx.nameState.appendPath('one-end')) - }) - - app.use(function two(ctx) { - const tx = helper.getTransaction() - tx.nameState.appendPath('two') - ctx.body = 'done' - }) - - helper.agent.on('transactionFinished', (tx) => { - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//two', - 'should have name without post-response name info' - ) - }) - - run(t) - }) - - t.test('names the transaction after the last middleware that sets the body', (t) => { - t.plan(2) - - app.use(function one(ctx, next) { - const tx = helper.getTransaction() - return next().then(() => tx.nameState.appendPath('one-end')) - }) - - app.use(function two(ctx, next) { - const tx = helper.getTransaction() - tx.nameState.appendPath('two') - ctx.body = 'not actually done' - return next() - }) - - app.use(function three(ctx) { - const tx = helper.getTransaction() - tx.nameState.appendPath('three') - ctx.body = 'done' - }) - - helper.agent.on('transactionFinished', (tx) => { - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//three', - 'should have name without post-response name info' - ) - }) - - run(t) - }) - - t.test('names the transaction off the status setting middleware', (t) => { - t.plan(4) - - app.use(function one(ctx, next) { - const tx = helper.getTransaction() - return next().then(() => tx.nameState.appendPath('one-end')) - }) - - app.use(function two(ctx) { - const tx = helper.getTransaction() - tx.nameState.appendPath('two') - ctx.status = 202 - }) - - helper.agent.on('transactionFinished', (tx) => { - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//two', - 'should have name without post-response name info' - ) - }) - - run(t, 'Accepted', (err, res) => { - t.error(err) - t.equal(res.statusCode, 202, 'should not interfere with status code setting') - }) - }) - - t.test('names the transaction when body set even if status set after', (t) => { - t.plan(4) - - app.use(function one(ctx, next) { - const tx = helper.getTransaction() - return next().then(() => tx.nameState.appendPath('one-end')) - }) - - app.use(function two(ctx) { - const tx = helper.getTransaction() - tx.nameState.appendPath('two') - ctx.body = 'done' - - tx.nameState.appendPath('setting-status') - ctx.status = 202 - }) - - helper.agent.on('transactionFinished', (tx) => { - t.equal( - tx.name, - 'WebTransaction/WebFrameworkUri/Koa/GET//two', - 'should have name without post-response name info' - ) - }) - - run(t, (err, res) => { - t.error(err) - t.equal(res.statusCode, 202, 'should not interfere with status code setting') - }) - }) - - t.test('produces transaction trace with multiple middleware', (t) => { - t.plan(2) - - app.use(function one(ctx, next) { - return next() - }) - app.use(function two(ctx) { - ctx.response.body = 'done' - }) - - helper.agent.on('transactionFinished', (tx) => { - checkSegments(t, tx) - }) - - run(t) - }) - - t.test('correctly records actions interspersed among middleware', (t) => { - t.plan(2) - - app.use(function one(ctx, next) { - helper.agent.tracer.createSegment('testSegment') - return next().then(function() { - helper.agent.tracer.createSegment('nestedSegment') - }) - }) - app.use(function two(ctx, next) { - return new Promise(function(resolve) { - setTimeout(resolve, 10) - }) - .then(next) - }) - app.use(function three(ctx) { - ctx.body = 'done' - }) - - helper.agent.on('transactionFinished', (tx) => { - t.exactSegments(tx.trace.root, [ - { - name: 'WebTransaction/WebFrameworkUri/Koa/GET//', - children: [{ - name: 'Nodejs/Middleware/Koa/one', - children: [ - {name: 'Truncated/testSegment'}, - { - name: 'Nodejs/Middleware/Koa/two', - children: [ - {name: 'timers.setTimeout'}, - {name: 'Nodejs/Middleware/Koa/three'} - ] - }, - {name: 'Truncated/nestedSegment'} - ] - }] - } - ]) - }) - - run(t) - }) - - t.test('maintains transaction state between middleware', (t) => { - t.plan(5) - - var tasks = [] - var intervalId = setInterval(function() { - while (tasks.length) { - tasks.pop()() - } - }, 10) - - t.tearDown(function() { - clearInterval(intervalId) - }) - var tx - - app.use(function one(ctx, next) { - tx = helper.agent.getTransaction() - return new Promise(executor) - - function executor(resolve) { - tasks.push(function() { - next().then(function() { - t.transaction(tx) - resolve() - }) - }) - } - }) - app.use(function two(ctx, next) { - t.transaction(tx, 'two has transaction context') - return next() - }) - app.use(function three(ctx) { - t.transaction(tx, 'three has transaction context') - ctx.body = 'done' - }) - - helper.agent.on('transactionFinished', function(txn) { - checkSegments(t, txn) - }) - - run(t) - }) - - t.test('errors handled within middleware are not recorded', (t) => { - t.plan(4) - - app.use(function one(ctx, next) { - return next().catch(function(err) { - t.equal(err.message, 'middleware error', 'caught expected error') - ctx.status = 200 - ctx.body = 'handled error' - }) - }) - app.use(function two(ctx) { - throw new Error('middleware error') - ctx.body = 'done' - }) - - helper.agent.on('transactionFinished', (tx) => { - var errors = helper.agent.errors.traceAggregator.errors - t.equal(errors.length, 0, 'no errors are recorded') - checkSegments(t, tx) - }) - - run(t, 'handled error') - }) - - t.test('errors not handled by middleware are recorded', (t) => { - t.plan(5) - - app.use(function one(ctx, next) { - return next().catch(function(err) { - t.equal(err.message, 'middleware error', 'caught expected error') - ctx.status = 500 - ctx.body = 'error is not actually handled' - }) - }) - app.use(function two() { - throw new Error('middleware error') - }) - - helper.agent.on('transactionFinished', (tx) => { - var errors = helper.agent.errors.traceAggregator.errors - t.equal(errors.length, 1, 'recorded expected number of errors') - var error = errors[0][2] - t.equal(error, 'middleware error', 'recorded expected error') - checkSegments(t, tx) - }) - run(t, 'error is not actually handled') - }) - - t.test('errors caught by default error listener are recorded', (t) => { - t.plan(5) - - app.use(function one(ctx, next) { - return next() - }) - app.use(function two() { - throw new Error('middleware error') - }) - app.on('error', function(err) { - t.equal(err.message, 'middleware error', 'caught expected error') - }) - - helper.agent.on('transactionFinished', (tx) => { - var errors = helper.agent.errors.traceAggregator.errors - t.equal(errors.length, 1, 'recorded expected number of errors') - var error = errors[0][2] - t.equal(error, 'middleware error', 'recorded expected error') - checkSegments(t, tx) - }) - run(t, 'Internal Server Error') - }) - - function run(t, expected, cb) { - if (typeof expected !== 'string') { - // run(t [, cb]) - cb = expected - expected = 'done' - } - - server = app.listen(0, () => { - http.get({port: server.address().port}, (res) => { - let body = '' - res.on('data', (data) => body += data.toString('utf8')) - res.on('error', (err) => cb && cb(err)) - res.on('end', () => { - if (expected) { - t.equal(body, expected, 'should send expected response') - } - if (cb) { - cb(null, res) - } - }) - }) - }) - } -}) - -function checkSegments(t, tx) { - t.exactSegments( - tx.trace.root, - [{ - // Until koa-router is instrumented and transaction naming is addressed, - // names will be inconsistent depending on whether there is an error. - name: tx.name, - children: [{ - name: 'Nodejs/Middleware/Koa/one', - children: [ - {name: 'Nodejs/Middleware/Koa/two'} - ] - }] - }] - ) -} diff --git a/node_modules/@newrelic/koa/tests/versioned/newrelic.js b/node_modules/@newrelic/koa/tests/versioned/newrelic.js deleted file mode 100644 index 5bfe5371..00000000 --- a/node_modules/@newrelic/koa/tests/versioned/newrelic.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -exports.config = { - app_name: ['My Application'], - license_key: 'license key here', - logging: { - level: 'trace', - filepath: '../../../newrelic_agent.log' - }, - utilization: { - detect_aws: false, - detect_pcf: false, - detect_azure: false, - detect_gcp: false, - detect_docker: false - }, - transaction_tracer: { - enabled: true - } -} diff --git a/node_modules/@newrelic/koa/tests/versioned/package.json b/node_modules/@newrelic/koa/tests/versioned/package.json deleted file mode 100644 index 1700f0a9..00000000 --- a/node_modules/@newrelic/koa/tests/versioned/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "koa-tests", - "version": "0.0.0", - "private": true, - "tests": [ - { - "engines": { - "node": ">=10" - }, - "dependencies": { - "koa": "^1.5.0" - }, - "files": [ - "koa-v1.tap.js" - ], - "notes": [ - "Koa <2.5.2 had debug as a wide-open dependency (semver check was `*`).", - "Debug v4 dropped support for Node <6, thus rendering these older versions", - "of Koa inoperable on Node <6." - ] - }, - { - "engines": { - "node": ">=10" - }, - "dependencies": { - "koa": ">=2.0.0" - }, - "files": [ - "koa.tap.js" - ] - }, - { - "engines": { - "node": ">=10" - }, - "dependencies": { - "koa": ">=2.0.0", - "@koa/router": ">=8.0.0 <=8.0.2", - "koa-router": ">=7.1.0 <=8.0.2" - }, - "files": [ - "koa-router.tap.js" - ] - }, - { - "engines": { - "node": ">=10" - }, - "dependencies": { - "koa": ">=2.0.0", - "koa-route": ">=3.0.0" - }, - "files": [ - "koa-route.tap.js" - ] - } - ], - "dependencies": {} -} diff --git a/node_modules/@newrelic/koa/third_party_manifest.json b/node_modules/@newrelic/koa/third_party_manifest.json deleted file mode 100644 index 613d05ce..00000000 --- a/node_modules/@newrelic/koa/third_party_manifest.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "lastUpdated": "Mon Nov 02 2020 14:05:46 GMT-0800 (Pacific Standard Time)", - "projectName": "New Relic Koa Instrumentation", - "projectUrl": "https://github.com/newrelic/node-newrelic-koa", - "includeDev": true, - "dependencies": { - "methods@1.1.2": { - "name": "methods", - "version": "1.1.2", - "range": "^1.1.2", - "licenses": "MIT", - "repoUrl": "https://github.com/jshttp/methods", - "versionedRepoUrl": "https://github.com/jshttp/methods/tree/v1.1.2", - "licenseFile": "node_modules/methods/LICENSE", - "licenseUrl": "https://github.com/jshttp/methods/blob/v1.1.2/LICENSE", - "licenseTextSource": "file" - } - }, - "devDependencies": { - "@koa/router@8.0.8": { - "name": "@koa/router", - "version": "8.0.8", - "range": "^8.0.0", - "licenses": "MIT", - "repoUrl": "https://github.com/koajs/koa-router", - "versionedRepoUrl": "https://github.com/koajs/koa-router/tree/v8.0.8", - "licenseFile": "node_modules/@koa/router/LICENSE", - "licenseUrl": "https://github.com/koajs/koa-router/blob/v8.0.8/LICENSE", - "licenseTextSource": "file", - "publisher": "Alex Mingoia", - "email": "talk@alexmingoia.com" - }, - "@newrelic/test-utilities@4.1.1": { - "name": "@newrelic/test-utilities", - "version": "4.1.1", - "range": "^4.0.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-test-utilities", - "versionedRepoUrl": "https://github.com/newrelic/node-test-utilities/tree/v4.1.1", - "licenseFile": "node_modules/@newrelic/test-utilities/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-test-utilities/blob/v4.1.1/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "eslint@5.16.0": { - "name": "eslint", - "version": "5.16.0", - "range": "^5.8.0", - "licenses": "MIT", - "repoUrl": "https://github.com/eslint/eslint", - "versionedRepoUrl": "https://github.com/eslint/eslint/tree/v5.16.0", - "licenseFile": "node_modules/eslint/LICENSE", - "licenseUrl": "https://github.com/eslint/eslint/blob/v5.16.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Nicholas C. Zakas", - "email": "nicholas+npm@nczconsulting.com" - }, - "koa-route@3.2.0": { - "name": "koa-route", - "version": "3.2.0", - "range": "^3.2.0", - "licenses": "MIT", - "repoUrl": "https://github.com/koajs/route", - "versionedRepoUrl": "https://github.com/koajs/route/tree/3.2.0", - "licenseFile": "node_modules/koa-route/Readme.md", - "licenseUrl": "https://github.com/koajs/route/blob/3.2.0/Readme.md", - "licenseTextSource": "spdx" - }, - "koa-router@7.4.0": { - "name": "koa-router", - "version": "7.4.0", - "range": "^7.4.0", - "licenses": "MIT", - "repoUrl": "https://github.com/alexmingoia/koa-router", - "versionedRepoUrl": "https://github.com/alexmingoia/koa-router/tree/v7.4.0", - "licenseFile": "node_modules/koa-router/LICENSE", - "licenseUrl": "https://github.com/alexmingoia/koa-router/blob/v7.4.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Alex Mingoia", - "email": "talk@alexmingoia.com" - }, - "koa@2.13.0": { - "name": "koa", - "version": "2.13.0", - "range": "^2.6.1", - "licenses": "MIT", - "repoUrl": "https://github.com/koajs/koa", - "versionedRepoUrl": "https://github.com/koajs/koa/tree/v2.13.0", - "licenseFile": "node_modules/koa/LICENSE", - "licenseUrl": "https://github.com/koajs/koa/blob/v2.13.0/LICENSE", - "licenseTextSource": "file" - }, - "newrelic@6.13.1": { - "name": "newrelic", - "version": "6.13.1", - "range": "^6.11.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-newrelic", - "versionedRepoUrl": "https://github.com/newrelic/node-newrelic/tree/v6.13.1", - "licenseFile": "node_modules/newrelic/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-newrelic/blob/v6.13.1/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "semver@5.7.1": { - "name": "semver", - "version": "5.7.1", - "range": "^5.6.0", - "licenses": "ISC", - "repoUrl": "https://github.com/npm/node-semver", - "versionedRepoUrl": "https://github.com/npm/node-semver/tree/v5.7.1", - "licenseFile": "node_modules/tap/node_modules/semver/LICENSE", - "licenseUrl": "https://github.com/npm/node-semver/blob/v5.7.1/LICENSE", - "licenseTextSource": "file" - }, - "tap@14.10.8": { - "name": "tap", - "version": "14.10.8", - "range": "^14.10.7", - "licenses": "ISC", - "repoUrl": "https://github.com/tapjs/node-tap", - "versionedRepoUrl": "https://github.com/tapjs/node-tap/tree/v14.10.8", - "licenseFile": "node_modules/tap/LICENSE", - "licenseUrl": "https://github.com/tapjs/node-tap/blob/v14.10.8/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - } - } -} diff --git a/node_modules/@newrelic/native-metrics/CHANGELOG.md b/node_modules/@newrelic/native-metrics/CHANGELOG.md deleted file mode 100644 index 5e8d2264..00000000 --- a/node_modules/@newrelic/native-metrics/CHANGELOG.md +++ /dev/null @@ -1,205 +0,0 @@ -### v6.0.0 (2020-11-03): - -* Removed Node v8.x from ci. -* Updated README to be consistent with OSS template. -* Added open source policy workflow. -* Supressing warnings during installation on alpine docker image. - Thank you @eyedean for the contribution. -* Updated name and job-name in release workflow. -* Filtered out tags for CI workflow to prevent running on tag push for releases. The release job handles full testing. - -### v5.3.0 (2020-08-06): - -* Updated to Apache 2.0 license. -* Added third party notices file and metadata for dependencies. -* Updated README with more detail. -* Added issue templates for bugs and enhancements. -* Added code of conduct file. -* Updated contributing guide. -* Added pull request template. -* Migrated CI to GitHub Actions. -* Added copyright headers to all source files. -* Added additional items to .npmignore. - -### v5.2.0 (2020-06-01): - -* Added special binary naming case to enable usage in Electron environments. - - Enables the module to be used in Electron environments when built with tools that add 'electron' to `npm_config_runtime` or `npm_config_disturl` (such as `electron-rebuild` or `electron-builder`). In this case, the ABI is left-off of the file name. - - Many thanks to @frankrobert-ls for raising the issue and providing a patch! - - Please Note: Electron is not officially supported and other issues may still exist with the module in these environments. - -### v5.1.0 (2020-05-06): - -* Upgraded `nan` to ^2.14.1 to resolve 'GetContents' deprecation warning with Node 14. - - Includes addition of Node 14 coverage and builds. Many thanks to @abetomo for the contribution. - -### v5.0.0 (2019-10-16): - -* **BREAKING** Removed support for Node 6, 7, 9 and 11. - - The minimum supported version of the native metrics module is now Node v8. For further information on our support policy, see: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent. - -* Added support for Node v12. - -### v4.1.0 (2019-02-07): - -* Added support for insecure (http) binary hosts. Use at your own discretion. - - The default host remains as New Relic's binary repository behind an `https` - server. To use an `http` endpoint you must manually configure it yourself. - - Special thanks to Adam Brett (@adambrett) and Guilherme Nagatomo (@guilhermehn) - for contributing this feature. - -### v4.0.0 (2019-01-22): - -* **BREAKING**: Dropped support for Node versions <6. - -* Added pre-execution log message calling out that this is an optional - dependency in the agent. - -* Simplified final error by removing most of the confusing `Failed to...` - messages. - -### v3.1.2 (2018-10-22): - -* Corrected check for build flags to base on gyp version, not Node version. - - Previously, when checking if the old `\t:` syntax should be used, this looked - for Node <10.8.0. Now this looks for node-gyp <3.7.0. This accounts for - situations where users install their own versions of node-gyp. - - Special thanks to Eric Boureau (@eboureau) for contributing this fix. - -### v3.1.1 (2018-09-10): - -* Fixed building the module on Windows with Node v10.8.0 or greater. - - Special thanks to Elmar Burke (@elmarburke) for this contribution! - -### v3.1.0 (2018-07-02): - -* Added support for caching prebuilt binaries for firewalled deployments. - - Simply set the `NR_NATIVE_METRICS_DOWNLOAD_HOST` environment variable to the - protocol and host for the download (e.g. `http://your-internal-cache/`) and - `NR_NATIVE_METRICS_REMOTE_PATH` to the path to the download folder (e.g. - `path/to/downloads/folder`). - - Special thanks to Adam Brett (@adambrett) for contributing this feature. - -* Added support and pre-built binaries for Node 10. - -### v3.0.0 (2018-06-04): - -* **BREAKING** Removed support for Node 0.12. - - The minimum supported version of the native metrics module is now Node v4. - -* **BREAKING** Removed `gc` event in favor of `getGCMetrics()` method. - - The `gc` event will no longer be emitted for each garbage collection by V8. - Instead, metrics for garbage collections are aggregated in C++ and can be - retrieved by calling `getGCMetrics()`. Like `getLoopMetrics()`, this new - method will reset the aggregated metrics. - -* Added pre-built binaries for Node 5 and 7. - -### v2.4.0 (2018-04-20): - -* Added `NR_NATIVE_METRICS_NO_BUILD` and `NR_NATIVE_METRICS_NO_DOWNLOAD` - environment variables. - - These are just environment variable versions of the `--no-build` and - `--no-download` flags introduced in v2.3.0. - -### v2.3.0 (2018-04-19): - -* Added `--no-build` and `--no-download` flags for install script. - - These flags prevent the installer for the native metrics from either building - or downloading binaries. If both are specified, `--no-download` is ignored. - -### v2.2.0 (2018-02-12): - -* The package will now pull down pre-built binaries if compilation fails. - - After confirming that the binary downloading functionality works, the feature - has been enabled by default. The installation script will still default to a - fresh build where possible, using the download option as a fall back. - -* The process will no longer be held open due to pending timers. - - Previously, the timer used to calculate the CPU usage by a tick of the event - loop was left pending, causing the process to hang. - - -### v2.1.2 (2017-09-26): - -* Metric timers no longer hold the process open. - -Thanks to @samshull for the contribution! - -### v2.1.1 (2017-04-03): - -* Fixed build error on Windows thanks to Maximilian Haupt (@0x7f). - -* Added C++-layer unit testing using [gtest](https://github.com/google/googletest). - -* Updated readme with correct installation for the New Relic Agent v1. - -### v2.1.0 (2017-02-06): - -* Added an event loop CPU usage metric. - - The module will now report round trip CPU usage metrics for Node's event loop. This - metric can be read off with `nativeMetrics.getLoopMetrics()` and will - represent the amount of CPU time per tick of the event loop. - -### v2.0.2 (2017-01-19): - -* Removed pre-compiling binaries using the `node-pre-gyp` module. - - Previously we provided pre-compiled binaries for certain platforms and versions of Node. - However, this caused issues for customers using shrinkwrapping. In order to support - shrinkwrapping as well as all versions of Node and npm that our customers use, we have - decided to remove this feature. This means that in order to use this module, users now - need to have a compiler on the machine where it is being installed. - See [node-gyp] (https://www.npmjs.com/package/node-gyp#installation) for more - information on compiling native addons. - -### v2.0.0 (2017-01-04): - -* Removed support for Node 0.10. - - The `segfault-handler` dependency no longer compiles on Node 0.10 in our tests. - -* The `node-pre-gyp` module is now a bundled dependency. - - Previously it was installed using a preinstall script, which was causing an issue with - shrinkwrapping parent projects. Thanks to Robert Rossman (@Alaneor) for - the contribution! - -* Added License section to the Readme file. - -### v1.0.0 (2016-12-07): - -* General release. No code changes from v0.1.1. - -### v0.1.1 (2016-12-05): - -* Added guard against binding GC events more than once. - -* Removed OS X from Travis to temporarily get around extremely long builds. - Added script to run tests locally across multiple versions of Node. - -* Added test for checking licenses of dependencies. - -### v0.1.0 (2016-11-29): - -* Added `gc` event with duration and type of garbage collection. -* Added `usage` event with current and diff of resource usage stats. diff --git a/node_modules/@newrelic/native-metrics/CODE_OF_CONDUCT.md b/node_modules/@newrelic/native-metrics/CODE_OF_CONDUCT.md deleted file mode 100644 index c0a8fa66..00000000 --- a/node_modules/@newrelic/native-metrics/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,5 +0,0 @@ -### Hello! We're glad you've joined us. - -We believe participation in our community should be a harassment free experience for everyone. - -Learn more about our guidelines and principles by reading our [Code of Conduct](https://opensource.newrelic.com/code-of-conduct/) on our Open Source Website. \ No newline at end of file diff --git a/node_modules/@newrelic/native-metrics/CONTRIBUTING.md b/node_modules/@newrelic/native-metrics/CONTRIBUTING.md deleted file mode 100644 index b21e38f1..00000000 --- a/node_modules/@newrelic/native-metrics/CONTRIBUTING.md +++ /dev/null @@ -1,98 +0,0 @@ -# Guidelines for Contributing Code - -New Relic welcomes code contributions by the Node community to this module, and -have taken effort to make this process easy for both contributors and our -development team. - -## Feature Requests - -Feature requests should be submitted in the [Issue tracker](../../issues), with -a description of the expected behavior & use case. Before submitting an Issue, -please search for similar ones in the [closed -issues](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement). - -## Pull Requests - -We can only accept PRs for version v5.3.0 or greater due to open source -licensing restrictions. - -## Code of Conduct - -Before contributing please read the [code of conduct](./CODE_OF_CONDUCT.md) - -Note that our [code of conduct](./CODE_OF_CONDUCT.md) applies to all platforms -and venues related to this project; please follow it in all your interactions -with the project and its participants. - -## Contributor License Agreement - -Keep in mind that when you submit your Pull Request, you'll need to sign the -CLA via the click-through using CLA-Assistant. If you'd like to execute our -corporate CLA, or if you have any questions, please drop us an email at -opensource@newrelic.com. - -For more information about CLAs, please check out Alex Russell’s excellent -post, [“Why Do I Need to Sign -This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/). - -## Slack - -We host a public Slack with a dedicated channel for contributors and -maintainers of open source projects hosted by New Relic. If you are -contributing to this project, you're welcome to request access to the -\#oss-contributors channel in the newrelicusers.slack.com workspace. To request -access, see https://newrelicusers-signup.herokuapp.com/. - -## PR Guidelines - -### Version Support - -When contributing, keep in mind that New Relic customers (that's you!) are running many different versions of Node, some of them pretty old. Changes that depend on the newest version of Node will probably be rejected, especially if they replace something backwards compatible. - -Be aware that the instrumentation needs to work with a wide range of versions of the instrumented modules, and that code that looks nonsensical or overcomplicated may be that way for compatibility-related reasons. Read all the comments and check the related tests before deciding whether existing code is incorrect. - -If you’re planning on contributing a new feature or an otherwise complex contribution, we kindly ask you to start a conversation with the maintainer team by opening up an Github issue first. - -### General Guidelines - -In general, we try to limit adding third-party production dependencies. If one is necessary, please be prepared to make a clear case for the need. - -### Coding Style Guidelines/Conventions - -We use eslint to enforce certain coding standards. Please see our [.eslintrc](./.eslintrc.js) file for specific rule configuration. - -### Testing Guidelines - -The native metrics module includes a suite of unit and functional tests which should be used to -verify your changes don't break existing functionality. - -All tests are stored in `tests/` and are written using -[node-tap](https://www.npmjs.com/package/tap) with the extension `.tap.js`. - -#### Running Tests - -Running the test suite is simple. Just run: - - npm test - -This will install all the necessary modules and run the unit tests in standalone mode, followed by -the functional tests if all of the unit tests pass. - -To just run unit tests, run the following: - - npm run unit - -#### Writing Tests - -For most contributions it is strongly recommended to add additional tests which -exercise your changes. This helps us efficiently incorporate your changes into -our mainline codebase and provides a safeguard that your change won't be broken -by future development. Because of this, we require that all changes come with -tests. You are welcome to submit pull requests with untested changes, but they -won't be merged until you or the development team have an opportunity to write -tests for them. - -There are some rare cases where code changes do not result in changed -functionality (e.g. a performance optimization) and new tests are not required. -In general, including tests with your pull request dramatically increases the -chances it will be accepted. diff --git a/node_modules/@newrelic/native-metrics/LICENSE b/node_modules/@newrelic/native-metrics/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/node_modules/@newrelic/native-metrics/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@newrelic/native-metrics/README.md b/node_modules/@newrelic/native-metrics/README.md deleted file mode 100644 index 1bd3d8f8..00000000 --- a/node_modules/@newrelic/native-metrics/README.md +++ /dev/null @@ -1,173 +0,0 @@ -[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus) - -# Native Metrics for New Relic Node.js Agent [![native-metrics CI][ci-badge]][ci-link] - -This module provides hooks into the native layer of Node.js to provide metrics for -the [New Relic Node.js Agent][npm-newrelic]. It gathers information that isn't -available at the JS layer about the V8 virtual machine and the process health. -It comes packaged with the New Relic Agent since v2, and there is nothing that -needs to be done. For Agent v1 you need only to install the module alongside -[`newrelic`][npm-newrelic]. - -## Installation and Getting Started - -Typically, most users use the version auto-installed by the agent. - -In some cases, installing a specific version is ideal. For example, new features or major changes might be released via a major version update to this module, prior to inclusion in the main New Relic Node.js agent. - -``` -$ npm install --save @newrelic/native-metrics -``` - -Note that this is a native module and thus must be compiled to function. -Pre-built binaries are provided for Linux servers running supported versions of -Node. If you are not using Linux or not using a supported version of Node, you -will need to have a compiler installed on the machine where this is to be -deployed. See [node-gyp](https://www.npmjs.com/package/node-gyp#installation) -for more information on compiling native addons. - -If you prepare and package deployments on one machine and install them on -another, the two machines must have the same operating system and architecture. -If they are not, you will need to re-build the native module after deploying in -order to get the correct binaries. - -During installation, the module will first attempt build from source on the -target machine. If that fails, it will attempt to download a pre-built binary -for your system. You can disable the download attempt by setting -`NR_NATIVE_METRICS_NO_DOWNLOAD` to `true` in your environment before -installation. - -```sh -$ export NR_NATIVE_METRICS_NO_DOWNLOAD=true -$ npm install @newrelic/native-metrics -``` - -If you would like to skip the build step and only attempt to download a -pre-build binary, set `NR_NATIVE_METRICS_NO_BUILD` to `true`. - -```sh -$ export NR_NATIVE_METRICS_NO_BUILD=true -$ npm install @newrelic/native-metrics -``` - -If both env vars are set, `NO_BUILD` will override `NO_DOWNLOAD`. - -If you are working behind a firewall and want to cache the downloads internally -you can set the value of the download host and remote path instead of forcing a -build: - -```sh -$ export NR_NATIVE_METRICS_DOWNLOAD_HOST=http://your-internal-cache/ -$ export NR_NATIVE_METRICS_REMOTE_PATH=path/to/download/folder/ -$ npm install @newrelic/native-metrics -``` - -For more information, please see the agent [installation guide][install-node] and [compatibility and requirements][compatibility]. - -## Usage - -```js -var getMetricEmitter = require('@newrelic/native-metrics') - -var emitter = getMetricEmitter() -if (emitter.gcEnabled) { - setInterval(() => { - var gcMetrics = emitter.getGCMetrics() - for (var type in gcMetrics) { - console.log('GC type name:', type) - console.log('GC type id:', gcMetrics[type].typeId) - console.log('GC metrics:', gcMetrics[type].metrics) - } - }, 1000) -} -if (emitter.usageEnabled) { - emitter.on('usage', (usage) => console.log(usage)) -} -if (emitter.loopEnabled) { - setInterval(() => { - var loopMetrics = emitter.getLoopMetrics() - console.log('Total time:', loopMetrics.usage.total) - console.log('Min time:', loopMetrics.usage.min) - console.log('Max time:', loopMetrics.usage.max) - console.log('Sum of squares:', loopMetrics.usage.sumOfSquares) - console.log('Count:', loopMetrics.usage.count) - }, 1000) -} -``` - -The metric emitter keeps a referenced timer running for its periodic sampling -events. For a graceful shutdown of the process call `NativeMetricEmitter#unbind`. - -```js -getMetricEmitter().unbind() // Process will now close gracefully. -``` - -If you would like to change the period of the sampling, simply unbind and then -call `NativeMetricEmitter#bind` with the new period. - -```js -var emitter = getMetricEmitter({timeout: 15000}) -emitter.unbind() -emitter.bind(10000) // Samples will now fire once every 10 seconds. -``` - -## Testing - -This module includes a list of unit and functional tests. To run these tests, use the following command - - $ npm run test - -You may also run individual test suites with the following commands - - $ npm run unit - $ npm run integration - -## Support - -Should you need assistance with New Relic products, you are in good hands with several support channels. - -If the issue has been confirmed as a bug or is a feature request, please file a GitHub issue. - -**Support Channels** - -* [New Relic Documentation](https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/introduction-new-relic-nodejs): Comprehensive guidance for using our platform -* [New Relic Community](https://discuss.newrelic.com/tags/nodeagent): The best place to engage in troubleshooting questions -* [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications -* [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level -* [New Relic Technical Support](https://support.newrelic.com/) 24/7/365 ticketed support. Read more about our [Technical Support Offerings](https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/support-plan). - -## Privacy - -At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise. - -We define "Personal Data" as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address and email address. - -Please review [New Relic’s General Data Privacy Notice](https://newrelic.com/termsandconditions/privacy) for more information. - -## Roadmap -See our [roadmap](https://github.com/newrelic/node-newrelic/blob/main/ROADMAP_Node.md), to learn more about our product vision, understand our plans, and provide us valuable feedback. - -## Contribute - -We encourage your contributions to improve Native Metrics for the New Relic Node.js Agent! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. - -If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com. - -To [all contributors](https://github.com/newrelic/node-native-metrics/graphs/contributors), we thank you! Without your contribution, this project would not be what it is today. - -If you would like to contribute to this project, please review [these guidelines](https://github.com/newrelic/node-native-metrics/blob/main/CONTRIBUTING.md). - -**A note about vulnerabilities** - -As noted in our [security policy](https://github.com/newrelic/node-native-metrics/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals. - -If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic). - -## License -The Native Metrics for New Relic Node.js Agent package is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License. - -[ci-badge]: https://github.com/newrelic/node-native-metrics/workflows/native-metrics%20CI/badge.svg -[ci-link]: https://github.com/newrelic/node-native-metrics/actions?query=workflow%3A%22native-metrics+CI%22 -[npm-newrelic]: https://www.npmjs.com/package/newrelic -[install-node]: https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/install-nodejs-agent -[compatibility]: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent \ No newline at end of file diff --git a/node_modules/@newrelic/native-metrics/THIRD_PARTY_NOTICES.md b/node_modules/@newrelic/native-metrics/THIRD_PARTY_NOTICES.md deleted file mode 100644 index b1f3d5cb..00000000 --- a/node_modules/@newrelic/native-metrics/THIRD_PARTY_NOTICES.md +++ /dev/null @@ -1,404 +0,0 @@ -# Third Party Notices - -The Native Metrics for New Relic Node Agent uses source code from third party libraries which carry -their own copyright notices and license terms. These notices are provided -below. - -In the event that a required notice is missing or incorrect, please notify us -by e-mailing [open-source@newrelic.com](mailto:open-source@newrelic.com). - -For any licenses that require the disclosure of source -code, the source code can be found at [https://github.com/newrelic/node-native-metrics](https://github.com/newrelic/node-native-metrics). - -## Content - -**[dependencies](#dependencies)** - -* [nan](#nan) -* [semver](#semver) - -**[devDependencies](#devDependencies)** - -* [async](#async) -* [aws-sdk](#aws-sdk) -* [eslint](#eslint) -* [segfault-handler](#segfault-handler) -* [tap](#tap) - - -## dependencies - -### nan - -This product includes source derived from [nan](https://github.com/nodejs/nan) ([v2.14.1](https://github.com/nodejs/nan/tree/v2.14.1)), distributed under the [MIT License](https://github.com/nodejs/nan/blob/v2.14.1/LICENSE.md): - -``` -The MIT License (MIT) -===================== - -Copyright (c) 2018 NAN contributors ------------------------------------ - -*NAN contributors listed at * - -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. - -``` - -### semver - -This product includes source derived from [semver](https://github.com/npm/node-semver) ([v5.7.1](https://github.com/npm/node-semver/tree/v5.7.1)), distributed under the [ISC License](https://github.com/npm/node-semver/blob/v5.7.1/LICENSE): - -``` -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - -``` - - -## devDependencies - -### async - -This product includes source derived from [async](https://github.com/caolan/async) ([v2.6.3](https://github.com/caolan/async/tree/v2.6.3)), distributed under the [MIT License](https://github.com/caolan/async/blob/v2.6.3/LICENSE): - -``` -Copyright (c) 2010-2018 Caolan McMahon - -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. - -``` - -### aws-sdk - -This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.549.0](https://github.com/aws/aws-sdk-js/tree/v2.549.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js/blob/v2.549.0/LICENSE.txt): - -``` - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -``` - -### eslint - -This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v4.19.1](https://github.com/eslint/eslint/tree/v4.19.1)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v4.19.1/LICENSE): - -``` -Copyright JS Foundation and other contributors, https://js.foundation - -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. - -``` - -### segfault-handler - -This product includes source derived from [segfault-handler](https://github.com/ddopson/node-segfault-handler) ([v1.3.0](https://github.com/ddopson/node-segfault-handler/tree/v1.3.0)), distributed under the [BSD-3-Clause License](https://github.com/ddopson/node-segfault-handler/blob/v1.3.0/LICENSE): - -``` -Copyright (c) 2015-2019 Dave Dopson. -Copyright (c) 2019 Kenneth Geisshirt. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITYcAND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHERcIN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -``` - -### tap - -This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v14.10.7](https://github.com/tapjs/node-tap/tree/v14.10.7)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v14.10.7/LICENSE): - -``` -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - -``` - ------ - -Portions copyright Node.js contributors. Depending on your existing libraries and package management settings, -your systems may call externally maintained libraries in addition to those listed above. -See [here](https://nodejs.org/en/docs/meta/topics/dependencies/) and [here](https://github.com/nodejs/node/blob/v4.3.1/LICENSE) -for additional details regarding externally maintained libraries and certain related licenses and notices. diff --git a/node_modules/@newrelic/native-metrics/bin/test-all-node.sh b/node_modules/@newrelic/native-metrics/bin/test-all-node.sh deleted file mode 100644 index b5079957..00000000 --- a/node_modules/@newrelic/native-metrics/bin/test-all-node.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash -# -# Copyright 2020 New Relic Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# - -. "$(brew --prefix nvm)/nvm.sh" - -NODE_VERSIONS=(0.12 4 6 8 9) - -for version in ${NODE_VERSIONS[@]}; do - echo " -- Node $version" - nvm install $version && \ - npm install --no-download && \ - npm test && \ - rm -rf node_modules || \ - exit $? -done diff --git a/node_modules/@newrelic/native-metrics/binding.gyp b/node_modules/@newrelic/native-metrics/binding.gyp deleted file mode 100644 index 9caf9d8f..00000000 --- a/node_modules/@newrelic/native-metrics/binding.gyp +++ /dev/null @@ -1,47 +0,0 @@ -{ - "targets": [{ - "target_name": "native_metrics", - "sources": [ - "src/native_metrics.cpp", - "src/GCBinder.hpp", - "src/GCBinder.cpp", - "src/LoopChecker.hpp", - "src/LoopChecker.cpp", - "src/Metric.hpp", - "src/RUsageMeter.hpp", - "src/RUsageMeter.cpp" - ], - "defines": [ - "NOMINMAX" - ], - "include_dirs": [ - "src", - "> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = rm -rf "$@" && cp -af "$<" "$@" - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,native_metrics.target.mk)))),) - include native_metrics.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /home/jstaro/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/jstaro/dev/com.tibber.athom/node_modules/@newrelic/native-metrics/build/config.gypi -I/home/jstaro/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/jstaro/.cache/node-gyp/12.22.6/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/jstaro/.cache/node-gyp/12.22.6" "-Dnode_gyp_dir=/home/jstaro/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/home/jstaro/.cache/node-gyp/12.22.6/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/jstaro/dev/com.tibber.athom/node_modules/@newrelic/native-metrics" "-Dnode_engine=v8" binding.gyp -Makefile: $(srcdir)/../../../../../.cache/node-gyp/12.22.6/include/node/common.gypi $(srcdir)/../../../../../.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/native_metrics.node.d b/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/native_metrics.node.d deleted file mode 100644 index 3ab09672..00000000 --- a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/native_metrics.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/native_metrics.node := rm -rf "Release/native_metrics.node" && cp -af "Release/obj.target/native_metrics.node" "Release/native_metrics.node" diff --git a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics.node.d b/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics.node.d deleted file mode 100644 index 0b2962e6..00000000 --- a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/obj.target/native_metrics.node := g++ -shared -pthread -rdynamic -m64 -Wl,-soname=native_metrics.node -o Release/obj.target/native_metrics.node -Wl,--start-group Release/obj.target/native_metrics/src/native_metrics.o Release/obj.target/native_metrics/src/GCBinder.o Release/obj.target/native_metrics/src/LoopChecker.o Release/obj.target/native_metrics/src/RUsageMeter.o -Wl,--end-group diff --git a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/GCBinder.o.d b/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/GCBinder.o.d deleted file mode 100644 index 2aaa561f..00000000 --- a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/GCBinder.o.d +++ /dev/null @@ -1,62 +0,0 @@ -cmd_Release/obj.target/native_metrics/src/GCBinder.o := g++ '-DNODE_GYP_MODULE_NAME=native_metrics' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNOMINMAX' '-DBUILDING_NODE_EXTENSION' -I/home/jstaro/.cache/node-gyp/12.22.6/include/node -I/home/jstaro/.cache/node-gyp/12.22.6/src -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/config -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/openssl/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/uv/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/zlib -I/home/jstaro/.cache/node-gyp/12.22.6/deps/v8/include -I../src -I../../../nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -Wno-cast-function-type -MMD -MF ./Release/.deps/Release/obj.target/native_metrics/src/GCBinder.o.d.raw -c -o Release/obj.target/native_metrics/src/GCBinder.o ../src/GCBinder.cpp -Release/obj.target/native_metrics/src/GCBinder.o: ../src/GCBinder.cpp \ - ../src/GCBinder.hpp ../../../nan/nan.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h \ - ../../../nan/nan_callbacks.h ../../../nan/nan_callbacks_12_inl.h \ - ../../../nan/nan_maybe_43_inl.h ../../../nan/nan_converters.h \ - ../../../nan/nan_converters_43_inl.h ../../../nan/nan_new.h \ - ../../../nan/nan_implementation_12_inl.h \ - ../../../nan/nan_persistent_12_inl.h ../../../nan/nan_weak.h \ - ../../../nan/nan_object_wrap.h ../../../nan/nan_private.h \ - ../../../nan/nan_typedarray_contents.h ../../../nan/nan_json.h \ - ../src/Metric.hpp -../src/GCBinder.cpp: -../src/GCBinder.hpp: -../../../nan/nan.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h: -../../../nan/nan_callbacks.h: -../../../nan/nan_callbacks_12_inl.h: -../../../nan/nan_maybe_43_inl.h: -../../../nan/nan_converters.h: -../../../nan/nan_converters_43_inl.h: -../../../nan/nan_new.h: -../../../nan/nan_implementation_12_inl.h: -../../../nan/nan_persistent_12_inl.h: -../../../nan/nan_weak.h: -../../../nan/nan_object_wrap.h: -../../../nan/nan_private.h: -../../../nan/nan_typedarray_contents.h: -../../../nan/nan_json.h: -../src/Metric.hpp: diff --git a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/LoopChecker.o.d b/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/LoopChecker.o.d deleted file mode 100644 index 912b0c3d..00000000 --- a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/LoopChecker.o.d +++ /dev/null @@ -1,63 +0,0 @@ -cmd_Release/obj.target/native_metrics/src/LoopChecker.o := g++ '-DNODE_GYP_MODULE_NAME=native_metrics' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNOMINMAX' '-DBUILDING_NODE_EXTENSION' -I/home/jstaro/.cache/node-gyp/12.22.6/include/node -I/home/jstaro/.cache/node-gyp/12.22.6/src -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/config -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/openssl/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/uv/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/zlib -I/home/jstaro/.cache/node-gyp/12.22.6/deps/v8/include -I../src -I../../../nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -Wno-cast-function-type -MMD -MF ./Release/.deps/Release/obj.target/native_metrics/src/LoopChecker.o.d.raw -c -o Release/obj.target/native_metrics/src/LoopChecker.o ../src/LoopChecker.cpp -Release/obj.target/native_metrics/src/LoopChecker.o: \ - ../src/LoopChecker.cpp \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h \ - ../src/LoopChecker.hpp ../../../nan/nan.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h \ - ../../../nan/nan_callbacks.h ../../../nan/nan_callbacks_12_inl.h \ - ../../../nan/nan_maybe_43_inl.h ../../../nan/nan_converters.h \ - ../../../nan/nan_converters_43_inl.h ../../../nan/nan_new.h \ - ../../../nan/nan_implementation_12_inl.h \ - ../../../nan/nan_persistent_12_inl.h ../../../nan/nan_weak.h \ - ../../../nan/nan_object_wrap.h ../../../nan/nan_private.h \ - ../../../nan/nan_typedarray_contents.h ../../../nan/nan_json.h \ - ../src/Metric.hpp -../src/LoopChecker.cpp: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h: -../src/LoopChecker.hpp: -../../../nan/nan.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h: -../../../nan/nan_callbacks.h: -../../../nan/nan_callbacks_12_inl.h: -../../../nan/nan_maybe_43_inl.h: -../../../nan/nan_converters.h: -../../../nan/nan_converters_43_inl.h: -../../../nan/nan_new.h: -../../../nan/nan_implementation_12_inl.h: -../../../nan/nan_persistent_12_inl.h: -../../../nan/nan_weak.h: -../../../nan/nan_object_wrap.h: -../../../nan/nan_private.h: -../../../nan/nan_typedarray_contents.h: -../../../nan/nan_json.h: -../src/Metric.hpp: diff --git a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/RUsageMeter.o.d b/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/RUsageMeter.o.d deleted file mode 100644 index 07470296..00000000 --- a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/RUsageMeter.o.d +++ /dev/null @@ -1,61 +0,0 @@ -cmd_Release/obj.target/native_metrics/src/RUsageMeter.o := g++ '-DNODE_GYP_MODULE_NAME=native_metrics' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNOMINMAX' '-DBUILDING_NODE_EXTENSION' -I/home/jstaro/.cache/node-gyp/12.22.6/include/node -I/home/jstaro/.cache/node-gyp/12.22.6/src -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/config -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/openssl/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/uv/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/zlib -I/home/jstaro/.cache/node-gyp/12.22.6/deps/v8/include -I../src -I../../../nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -Wno-cast-function-type -MMD -MF ./Release/.deps/Release/obj.target/native_metrics/src/RUsageMeter.o.d.raw -c -o Release/obj.target/native_metrics/src/RUsageMeter.o ../src/RUsageMeter.cpp -Release/obj.target/native_metrics/src/RUsageMeter.o: \ - ../src/RUsageMeter.cpp ../../../nan/nan.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h \ - ../../../nan/nan_callbacks.h ../../../nan/nan_callbacks_12_inl.h \ - ../../../nan/nan_maybe_43_inl.h ../../../nan/nan_converters.h \ - ../../../nan/nan_converters_43_inl.h ../../../nan/nan_new.h \ - ../../../nan/nan_implementation_12_inl.h \ - ../../../nan/nan_persistent_12_inl.h ../../../nan/nan_weak.h \ - ../../../nan/nan_object_wrap.h ../../../nan/nan_private.h \ - ../../../nan/nan_typedarray_contents.h ../../../nan/nan_json.h \ - ../src/RUsageMeter.hpp -../src/RUsageMeter.cpp: -../../../nan/nan.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h: -../../../nan/nan_callbacks.h: -../../../nan/nan_callbacks_12_inl.h: -../../../nan/nan_maybe_43_inl.h: -../../../nan/nan_converters.h: -../../../nan/nan_converters_43_inl.h: -../../../nan/nan_new.h: -../../../nan/nan_implementation_12_inl.h: -../../../nan/nan_persistent_12_inl.h: -../../../nan/nan_weak.h: -../../../nan/nan_object_wrap.h: -../../../nan/nan_private.h: -../../../nan/nan_typedarray_contents.h: -../../../nan/nan_json.h: -../src/RUsageMeter.hpp: diff --git a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/native_metrics.o.d b/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/native_metrics.o.d deleted file mode 100644 index 3bcc01ed..00000000 --- a/node_modules/@newrelic/native-metrics/build/Release/.deps/Release/obj.target/native_metrics/src/native_metrics.o.d +++ /dev/null @@ -1,65 +0,0 @@ -cmd_Release/obj.target/native_metrics/src/native_metrics.o := g++ '-DNODE_GYP_MODULE_NAME=native_metrics' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNOMINMAX' '-DBUILDING_NODE_EXTENSION' -I/home/jstaro/.cache/node-gyp/12.22.6/include/node -I/home/jstaro/.cache/node-gyp/12.22.6/src -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/config -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/openssl/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/uv/include -I/home/jstaro/.cache/node-gyp/12.22.6/deps/zlib -I/home/jstaro/.cache/node-gyp/12.22.6/deps/v8/include -I../src -I../../../nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -Wno-cast-function-type -MMD -MF ./Release/.deps/Release/obj.target/native_metrics/src/native_metrics.o.d.raw -c -o Release/obj.target/native_metrics/src/native_metrics.o ../src/native_metrics.cpp -Release/obj.target/native_metrics/src/native_metrics.o: \ - ../src/native_metrics.cpp ../../../nan/nan.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h \ - /home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h \ - ../../../nan/nan_callbacks.h ../../../nan/nan_callbacks_12_inl.h \ - ../../../nan/nan_maybe_43_inl.h ../../../nan/nan_converters.h \ - ../../../nan/nan_converters_43_inl.h ../../../nan/nan_new.h \ - ../../../nan/nan_implementation_12_inl.h \ - ../../../nan/nan_persistent_12_inl.h ../../../nan/nan_weak.h \ - ../../../nan/nan_object_wrap.h ../../../nan/nan_private.h \ - ../../../nan/nan_typedarray_contents.h ../../../nan/nan_json.h \ - ../src/GCBinder.hpp ../src/Metric.hpp ../src/LoopChecker.hpp \ - ../src/RUsageMeter.hpp -../src/native_metrics.cpp: -../../../nan/nan.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/errno.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/unix.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/threadpool.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/uv/linux.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-internal.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8config.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/v8-platform.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_version.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_buffer.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node.h: -/home/jstaro/.cache/node-gyp/12.22.6/include/node/node_object_wrap.h: -../../../nan/nan_callbacks.h: -../../../nan/nan_callbacks_12_inl.h: -../../../nan/nan_maybe_43_inl.h: -../../../nan/nan_converters.h: -../../../nan/nan_converters_43_inl.h: -../../../nan/nan_new.h: -../../../nan/nan_implementation_12_inl.h: -../../../nan/nan_persistent_12_inl.h: -../../../nan/nan_weak.h: -../../../nan/nan_object_wrap.h: -../../../nan/nan_private.h: -../../../nan/nan_typedarray_contents.h: -../../../nan/nan_json.h: -../src/GCBinder.hpp: -../src/Metric.hpp: -../src/LoopChecker.hpp: -../src/RUsageMeter.hpp: diff --git a/node_modules/@newrelic/native-metrics/build/Release/_newrelic_native_metrics-6_0_0-native_metrics-72-linux-x64.node b/node_modules/@newrelic/native-metrics/build/Release/_newrelic_native_metrics-6_0_0-native_metrics-72-linux-x64.node deleted file mode 100755 index 82d61fd8..00000000 Binary files a/node_modules/@newrelic/native-metrics/build/Release/_newrelic_native_metrics-6_0_0-native_metrics-72-linux-x64.node and /dev/null differ diff --git a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics.node b/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics.node deleted file mode 100755 index 82d61fd8..00000000 Binary files a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics.node and /dev/null differ diff --git a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/GCBinder.o b/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/GCBinder.o deleted file mode 100644 index 041aaa63..00000000 Binary files a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/GCBinder.o and /dev/null differ diff --git a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/LoopChecker.o b/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/LoopChecker.o deleted file mode 100644 index 62e68a8b..00000000 Binary files a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/LoopChecker.o and /dev/null differ diff --git a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/RUsageMeter.o b/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/RUsageMeter.o deleted file mode 100644 index 33d85d27..00000000 Binary files a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/RUsageMeter.o and /dev/null differ diff --git a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/native_metrics.o b/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/native_metrics.o deleted file mode 100644 index ccdd15a5..00000000 Binary files a/node_modules/@newrelic/native-metrics/build/Release/obj.target/native_metrics/src/native_metrics.o and /dev/null differ diff --git a/node_modules/@newrelic/native-metrics/build/binding.Makefile b/node_modules/@newrelic/native-metrics/build/binding.Makefile deleted file mode 100644 index 3c683fda..00000000 --- a/node_modules/@newrelic/native-metrics/build/binding.Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# This file is generated by gyp; do not edit. - -export builddir_name ?= ./build/. -.PHONY: all -all: - $(MAKE) native_metrics diff --git a/node_modules/@newrelic/native-metrics/build/config.gypi b/node_modules/@newrelic/native-metrics/build/config.gypi deleted file mode 100644 index 079ff9b9..00000000 --- a/node_modules/@newrelic/native-metrics/build/config.gypi +++ /dev/null @@ -1,203 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "asan": 0, - "build_v8_with_gn": "false", - "coverage": "false", - "dcheck_always_on": 0, - "debug_nghttp2": "false", - "debug_node": "false", - "enable_lto": "false", - "enable_pgo_generate": "false", - "enable_pgo_use": "false", - "force_dynamic_crt": 0, - "gas_version": "2.27", - "host_arch": "x64", - "icu_data_in": "../../deps/icu-small/source/data/in/icudt67l.dat", - "icu_default_data": "", - "icu_endianness": "l", - "icu_gyp_path": "tools/icu/icu-generic.gyp", - "icu_locales": "en,root", - "icu_path": "deps/icu-small", - "icu_small": "true", - "icu_ver_major": "67", - "is_debug": 0, - "llvm_version": "0.0", - "napi_build_version": "8", - "node_byteorder": "little", - "node_debug_lib": "false", - "node_enable_d8": "false", - "node_install_npm": "true", - "node_module_version": 72, - "node_no_browser_globals": "false", - "node_prefix": "/", - "node_release_urlbase": "https://nodejs.org/download/release/", - "node_shared": "false", - "node_shared_brotli": "false", - "node_shared_cares": "false", - "node_shared_http_parser": "false", - "node_shared_libuv": "false", - "node_shared_nghttp2": "false", - "node_shared_openssl": "false", - "node_shared_zlib": "false", - "node_tag": "", - "node_target_type": "executable", - "node_use_bundled_v8": "true", - "node_use_dtrace": "false", - "node_use_etw": "false", - "node_use_node_code_cache": "true", - "node_use_node_snapshot": "true", - "node_use_openssl": "true", - "node_use_v8_platform": "true", - "node_with_ltcg": "false", - "node_without_node_options": "false", - "openssl_fips": "", - "openssl_is_fips": "false", - "ossfuzz": "false", - "shlib_suffix": "so.72", - "target_arch": "x64", - "v8_enable_gdbjit": 0, - "v8_enable_i18n_support": 1, - "v8_enable_inspector": 1, - "v8_enable_lite_mode": 0, - "v8_enable_object_print": 1, - "v8_no_strict_aliasing": 1, - "v8_optimized_debug": 1, - "v8_promise_internal_field_count": 1, - "v8_random_seed": 0, - "v8_trace_maps": 0, - "v8_use_siphash": 1, - "v8_use_snapshot": 1, - "want_separate_host_toolset": 0, - "nodedir": "/home/jstaro/.cache/node-gyp/12.22.6", - "standalone_static_library": 1, - "cache_lock_stale": "60000", - "ham_it_up": "", - "legacy_bundling": "", - "sign_git_tag": "", - "user_agent": "npm/6.14.15 node/v12.22.6 linux x64", - "always_auth": "", - "bin_links": "true", - "key": "", - "allow_same_version": "", - "description": "true", - "fetch_retries": "2", - "heading": "npm", - "if_present": "", - "init_version": "1.0.0", - "user": "1000", - "prefer_online": "", - "force": "", - "only": "", - "read_only": "", - "cache_min": "10", - "init_license": "ISC", - "editor": "vi", - "rollback": "true", - "tag_version_prefix": "v", - "cache_max": "Infinity", - "timing": "", - "userconfig": "/home/jstaro/.npmrc", - "engine_strict": "", - "init_author_name": "", - "init_author_url": "", - "preid": "", - "tmp": "/tmp", - "depth": "Infinity", - "package_lock_only": "", - "save_dev": "", - "usage": "", - "metrics_registry": "https://registry.npmjs.org/", - "otp": "", - "package_lock": "true", - "progress": "true", - "https_proxy": "", - "save_prod": "", - "audit": "true", - "cidr": "", - "onload_script": "", - "sso_type": "oauth", - "rebuild_bundle": "true", - "save_bundle": "", - "shell": "/bin/zsh", - "dry_run": "", - "format_package_lock": "true", - "prefix": "/home/jstaro/.nvm/versions/node/v12.22.6", - "scope": "", - "browser": "", - "cache_lock_wait": "10000", - "ignore_prepublish": "", - "registry": "https://registry.npmjs.org/", - "save_optional": "", - "searchopts": "", - "versions": "", - "cache": "/home/jstaro/.npm", - "send_metrics": "", - "global_style": "", - "ignore_scripts": "", - "version": "", - "local_address": "", - "viewer": "man", - "node_gyp": "/home/jstaro/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js", - "audit_level": "low", - "prefer_offline": "", - "color": "true", - "sign_git_commit": "", - "fetch_retry_mintimeout": "10000", - "maxsockets": "50", - "offline": "", - "sso_poll_frequency": "500", - "umask": "0022", - "fund": "true", - "fetch_retry_maxtimeout": "60000", - "logs_max": "10", - "message": "%s", - "ca": "", - "cert": "", - "global": "", - "link": "", - "access": "", - "also": "", - "save": "true", - "unicode": "true", - "before": "", - "long": "", - "production": "", - "searchlimit": "20", - "unsafe_perm": "true", - "update_notifier": "true", - "auth_type": "legacy", - "node_version": "12.22.6", - "tag": "latest", - "git_tag_version": "true", - "commit_hooks": "true", - "script_shell": "", - "shrinkwrap": "true", - "fetch_retry_factor": "10", - "save_exact": "", - "strict_ssl": "true", - "dev": "", - "globalconfig": "/home/jstaro/.nvm/versions/node/v12.22.6/etc/npmrc", - "init_module": "/home/jstaro/.npm-init.js", - "parseable": "", - "globalignorefile": "/home/jstaro/.nvm/versions/node/v12.22.6/etc/npmignore", - "cache_lock_retries": "10", - "searchstaleness": "900", - "node_options": "", - "save_prefix": "^", - "scripts_prepend_node_path": "warn-only", - "group": "1000", - "init_author_email": "", - "searchexclude": "", - "git": "git", - "optional": "true", - "json": "" - } -} diff --git a/node_modules/@newrelic/native-metrics/build/native_metrics.target.mk b/node_modules/@newrelic/native-metrics/build/native_metrics.target.mk deleted file mode 100644 index ff2a33d0..00000000 --- a/node_modules/@newrelic/native-metrics/build/native_metrics.target.mk +++ /dev/null @@ -1,168 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := native_metrics -DEFS_Debug := \ - '-DNODE_GYP_MODULE_NAME=native_metrics' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DNOMINMAX' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' \ - '-DV8_ENABLE_CHECKS' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -g \ - -O0 - -# Flags passed to only C files. -CFLAGS_C_Debug := - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++1y \ - -Wno-cast-function-type - -INCS_Debug := \ - -I/home/jstaro/.cache/node-gyp/12.22.6/include/node \ - -I/home/jstaro/.cache/node-gyp/12.22.6/src \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/config \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/openssl/include \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/uv/include \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/zlib \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/v8/include \ - -I$(srcdir)/src \ - -I$(srcdir)/../../nan - -DEFS_Release := \ - '-DNODE_GYP_MODULE_NAME=native_metrics' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DNOMINMAX' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -O3 \ - -fno-omit-frame-pointer - -# Flags passed to only C files. -CFLAGS_C_Release := - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++1y \ - -Wno-cast-function-type - -INCS_Release := \ - -I/home/jstaro/.cache/node-gyp/12.22.6/include/node \ - -I/home/jstaro/.cache/node-gyp/12.22.6/src \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/config \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/openssl/openssl/include \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/uv/include \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/zlib \ - -I/home/jstaro/.cache/node-gyp/12.22.6/deps/v8/include \ - -I$(srcdir)/src \ - -I$(srcdir)/../../nan - -OBJS := \ - $(obj).target/$(TARGET)/src/native_metrics.o \ - $(obj).target/$(TARGET)/src/GCBinder.o \ - $(obj).target/$(TARGET)/src/LoopChecker.o \ - $(obj).target/$(TARGET)/src/RUsageMeter.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -pthread \ - -rdynamic \ - -m64 - -LDFLAGS_Release := \ - -pthread \ - -rdynamic \ - -m64 - -LIBS := - -$(obj).target/native_metrics.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(obj).target/native_metrics.node: LIBS := $(LIBS) -$(obj).target/native_metrics.node: TOOLSET := $(TOOLSET) -$(obj).target/native_metrics.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(obj).target/native_metrics.node -# Add target alias -.PHONY: native_metrics -native_metrics: $(builddir)/native_metrics.node - -# Copy this to the executable output path. -$(builddir)/native_metrics.node: TOOLSET := $(TOOLSET) -$(builddir)/native_metrics.node: $(obj).target/native_metrics.node FORCE_DO_CMD - $(call do_cmd,copy) - -all_deps += $(builddir)/native_metrics.node -# Short alias for building this executable. -.PHONY: native_metrics.node -native_metrics.node: $(obj).target/native_metrics.node $(builddir)/native_metrics.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/native_metrics.node - diff --git a/node_modules/@newrelic/native-metrics/compatability.md b/node_modules/@newrelic/native-metrics/compatability.md deleted file mode 100644 index b5be64f0..00000000 --- a/node_modules/@newrelic/native-metrics/compatability.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Node Compatability Notes -This document details issues specific to certain versions of node in regards to -the native metrics module. It is a living document to be updated as new problems -are found. - -### CPU Metrics -Our native module relies on the function `uv_getrusage` to measure CPU usage. -This function was added to libuv in [version 0.11.20][libuv 0.11.20] which was -incorporated into Node in [version 0.11.12][node 0.11.12]. As of the time of -this writing, both CPU measurements and loop timing require this function and -thus can not be supported on earlier node versions. - -[libuv 0.11.20]: https://github.com/libuv/libuv/releases/tag/v0.11.20 -[node 0.11.12]: https://github.com/nodejs/node/releases/tag/v0.11.12 diff --git a/node_modules/@newrelic/native-metrics/index.js b/node_modules/@newrelic/native-metrics/index.js deleted file mode 100644 index 689af078..00000000 --- a/node_modules/@newrelic/native-metrics/index.js +++ /dev/null @@ -1,219 +0,0 @@ -'use strict' - -var EventEmitter = require('events').EventEmitter -var util = require('util') -var preBuild = require('./lib/pre-build') -var natives = preBuild.load('native_metrics') - - -var DEFAULT_TIMEOUT = 15 * 1000 // 15 seconds -var GC_TYPE_NAMES = { - '1': 'Scavenge', - '2': 'MarkSweepCompact', - '4': 'IncrementalMarking', - '8': 'ProcessWeakCallbacks', - - '3': 'All', // Node v4 and earlier only have Scavenge and MarkSweepCompact. - '15': 'All' -} - - -/** - * Constructs a metric emitter. This constructor is for internal use only. - * - * {@link NativeMetricEmitter#bind} is called as part of construction. - * - * @constructor - * @classdesc - * Emits events for various native events or periodic sampling. - * - * @param {number} [opts.timeout] - * The number of milliseconds between samplings. Defaults to 15 seconds. - */ -function NativeMetricEmitter(opts) { - opts = opts || {timeout: DEFAULT_TIMEOUT} - EventEmitter.call(this) - this.bound = false - this._timeout = null - - this._rusageMeter = new natives.RUsageMeter() - this.usageEnabled = true - - this._gcBinder = new natives.GCBinder() - this.gcEnabled = true - - this._loopChecker = new natives.LoopChecker() - this.loopEnabled = true - - this.bind(opts.timeout) -} -util.inherits(NativeMetricEmitter, EventEmitter) - -/** - * @interface RUsageStats - * - * @description - * Resource usage statistics. - * - * Properties marked (X) are unmaintained by the operating system and are - * likely to be just `0`. - * - * @property {number} ru_utime - user CPU time used in milliseconds - * @property {number} ru_stime - system CPU time used in milliseconds - * @property {number} ru_maxrss - maximum resident set size in bytes - * @property {number} ru_ixrss - integral shared memory size (X) - * @property {number} ru_idrss - integral unshared data size (X) - * @property {number} ru_isrss - integral unshared stack size (X) - * @property {number} ru_minflt - page reclaims (soft page faults) (X) - * @property {number} ru_majflt - page faults (hard page faults) - * @property {number} ru_nswap - swaps (X) - * @property {number} ru_inblock - block input operations - * @property {number} ru_oublock - block output operations - * @property {number} ru_msgsnd - IPC messages sent (X) - * @property {number} ru_msgrcv - IPC messages received (X) - * @property {number} ru_nsignals - signals received (X) - * @property {number} ru_nvcsw - voluntary context switches (X) - * @property {number} ru_nivcsw - involuntary context switches (X) - * - * @see http://docs.libuv.org/en/v1.x/misc.html#c.uv_getrusage - * @see http://docs.libuv.org/en/v1.x/misc.html#c.uv_rusage_t - */ - -/** - * @interface LoopMetrics - * - * @description - * A mapping of loop concepts to metrics about them. All values are in - * microseconds. - * - * @property {Metric} usage - CPU usage per tick metrics. - */ - -/** - * @interface GCMetrics - * - * @description - * Garbage collection results. - * - * @property {number} typeId - The numeric ID of the gc type. - * @property {string} type - The nice name version of the gc type. - * @property {Metric} metrics - Accumulated metric data in milliseconds. - */ - -/** - * @interface Metric - * - * @description - * A bundle of values taken from some measurement. - * - * @property {number} total - The sum of all values measured. - * @property {number} min - The smallest value measured. - * @property {number} max - The largest value measured. - * @property {number} sumOfSquares - The sum of the square of each value. - * @property {number} count - The number of values measured. - */ - -/** - * Binds the emitter to the internal, V8 hooks to start populating data. - * - * @fires NativeMetricEmitter#gc - * @fires NativeMetricEmitter#usage - * - * @param {number} [timeout] - * The number of milliseconds between samplings. Defaults to 15 seconds. - */ -NativeMetricEmitter.prototype.bind = function bind(timeout) { - if (this.bound) { - return - } - - timeout = timeout || DEFAULT_TIMEOUT - this._gcBinder.bind() - this._loopChecker.bind() - - this._timeout = setTimeout(nativeMetricTimeout.bind(this), timeout).unref() - function nativeMetricTimeout() { - if (this._rusageMeter) { - /** - * Resource usage sampling event. - * - * @event NativeMetricEmitter#usage - * @type {object} - * - * @property {RUsageStats} diff - The change in stats since last sampling. - * @property {RUsageStats} current - The current usage statistics. - */ - this.emit('usage', this._rusageMeter.read()) - } - if (this.bound) { - this._timeout = setTimeout(nativeMetricTimeout.bind(this), timeout).unref() - } - } - - this.bound = true -} - -/** - * Removes internal hooks and stops any open sampling timers. - */ -NativeMetricEmitter.prototype.unbind = function unbind() { - if (!this.bound) { - return - } - - this._gcBinder.unbind() - this._loopChecker.unbind() - clearTimeout(this._timeout) - this.bound = false -} - -/** - * Retrieves the current loop metrics and resets the counters. - * - * @return {LoopMetrics} The current loop metrics. - */ -NativeMetricEmitter.prototype.getLoopMetrics = function getLoopMetrics() { - return this._loopChecker.read() -} - -/** - * Retrieves the accumulated garbage collection metrics. - * - * After retrieval, the metrics are reset internally. Only GC types that have - * happened at least once since the last retrieval are returned. - * - * @return {object.} An object mapping GC type names to - * information on the GC events that happened. - */ -NativeMetricEmitter.prototype.getGCMetrics = function getGCMetrics() { - var gcMetrics = this._gcBinder.read() - var results = Object.create(null) - for (var typeId in gcMetrics) { - if (gcMetrics.hasOwnProperty(typeId) && gcMetrics[typeId].count > 0) { - var typeName = GC_TYPE_NAMES[String(typeId)] - results[typeName] = { - typeId: parseInt(typeId, 10), - type: typeName, - metrics: gcMetrics[typeId] - } - } - } - - return results -} - -var emitter = null - -/** - * Retrieves the {@link NativeMetricEmitter} singleton instance. - * - * @param {object} [opts] - * Options for constructing the emitter. See {@link NativeMetricEmitter} for - * default values. Only used on the first call to construct the instance. - */ -module.exports = function getMetricEmitter(opts) { - if (!emitter) { - emitter = new NativeMetricEmitter(opts) - } - return emitter -} diff --git a/node_modules/@newrelic/native-metrics/lib/pre-build.js b/node_modules/@newrelic/native-metrics/lib/pre-build.js deleted file mode 100644 index 17dfccb1..00000000 --- a/node_modules/@newrelic/native-metrics/lib/pre-build.js +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// This file is largely based upon the work done for node-pre-gyp. We are not -// using that module directly due to issues we've run into with the intricacies -// of various node and npm versions that we must support. -// https://www.npmjs.com/package/node-pre-gyp - -// XXX This file must not have any deps. This file will run during the install -// XXX step of the module and we are _not_ guaranteed that the dependencies have -// XXX already installed. Core modules are okay. -var cp = require('child_process') -var fs = require('fs') -var http = require('http') -var https = require('https') -var os = require('os') -var path = require('path') -var semver = require('semver') -var zlib = require('zlib') - - -var CPU_COUNT = os.cpus().length -var IS_WIN = process.platform === 'win32' -var HAS_OLD_NODE_GYP_ARGS_FOR_WINDOWS = semver.lt(gypVersion() || '0.0.0', '3.7.0') -var S3_BUCKET = 'nr-downloads-main' - -var DOWNLOAD_HOST = process.env.NR_NATIVE_METRICS_DOWNLOAD_HOST - || 'https://download.newrelic.com/' - -var REMOTE_PATH = process.env.NR_NATIVE_METRICS_REMOTE_PATH - || 'nodejs_agent/builds/' - -var PACKAGE_ROOT = path.resolve(__dirname, '..') -var BUILD_PATH = path.resolve(PACKAGE_ROOT, './build/Release') - -var opts = {} -exports.load = load - -if (require.main === module) { - var argv = parseArgs(process.argv, opts) - executeCli(argv[2], argv[3]) -} - -function _getFileName(target) { - var abi = process.versions.modules - var arch = process.arch - var platform = process.platform - var pkg = require('../package') - var pkgName = pkg.name.replace(/[^\w]/g, '_') - var pkgVersion = pkg.version.toString().replace(/[^\w]/g, '_') - - if (!abi || !arch || !target || !platform || !pkg || !pkgName || !pkgVersion) { - throw new Error('Missing information for naming compiled binary.') - } - - /** - * Electron forks Node and has its own custom ABI versions. Because of this, - * the ABI version.included in the binary filename causes issues related to - * mismatched Node versions. A quick + temporary fix for this is to strip out - * the ABI name for suspected Electron builds. Tools such as `electron-builder` - * and `electron-rebuild` will include environment variables to work with - * node-gyp. We can look at those env vars to see if they have been patched - * to contain the word 'electron'. - * For more context: https://github.com/newrelic/node-native-metrics/pull/75 - * It's worth pointing out that this is a patch and not a solution as this will - * have other (minor) repercussions - */ - if ( - (process.env.npm_config_runtime || '').includes('electron') || - (process.env.npm_config_disturl || '').includes('electron') - ) { - return [pkgName, pkgVersion, target, platform, arch].join('-') - } - - return [pkgName, pkgVersion, target, abi, platform, arch].join('-') -} - -function getBinFileName(target) { - return _getFileName(target) + '.node' -} - -function getPackageFileName(target) { - return _getFileName(target) + '.gz' -} - -function load(target) { - return require(path.join(BUILD_PATH, getBinFileName(target))) -} - -function makePath(pathToMake, cb) { - var accessRights = null - if (fs.constants) { - accessRights = fs.constants.R_OK | fs.constants.W_OK - } else { - // TODO: Remove this when deprecating Node v5 and below. - accessRights = fs.R_OK | fs.W_OK - } - - // We only want to make the parts after the package directory. - pathToMake = path.relative(PACKAGE_ROOT, pathToMake) - - // Now that we have a relative path, split it into the parts we need to make. - var pathParts = pathToMake.split(path.sep) - _make(-1, PACKAGE_ROOT, cb) - - function _make(i, p, cb) { - if (++i >= pathParts.length) { - return cb() - } - p = path.join(p, pathParts[i]) - - fs.access(p, accessRights, function fsAccessCB(err) { - if (!err) { - // It exists and we have read+write access! Move on to the next part. - return _make(i, p, cb) - } else if (err.code !== 'ENOENT') { - // It exists but we don't have read+write access! This is a problem. - return cb(new Error('Do not have access to "' + p + '": ' + err)) - } - - // It probably does not exist, so try to make it. - fs.mkdir(p, function fsMkDirCB(err) { - if (err) { - return cb(err) - } - _make(i, p, cb) - }) - }) - } -} - -function findNodeGyp() { - // This code heavily borrows from node-pre-gyp. - // https://github.com/mapbox/node-pre-gyp/blob/e0b3b6/lib/util/compile.js#L18-L55 - - // First, look for it in the NPM environment variable. - var gypPath = null - if (process.env.npm_config_node_gyp) { - try { - gypPath = process.env.npm_config_node_gyp - if (fs.existsSync(gypPath)) { - return gypPath - } - } catch (err) { - // This method failed, hopefully the next will succeed... - } - } - - // Next, see if the package is installed somewhere. - try { - var gypPkgPath = require.resolve('node-gyp') - gypPath = path.resolve(gypPkgPath, '../../bin/node-gyp.js') - if (fs.existsSync(gypPath)) { - return gypPath - } - } catch (err) { - // This method failed, hopefully the next will succeed... - } - - // Then look for it in NPM's install location. - try { - var npmPkgPath = require.resolve('npm') - gypPath = path.resolve(npmPkgPath, '../../node_modules/node-gyp/bin/node-gyp.js') - if (fs.existsSync(gypPath)) { - return gypPath - } - } catch (err) { - // This method failed, hopefully the next will succeed... - } - - // All of that failed, now look for it next to node itself. - var nodeNpmPkgPath = path.resolve(process.execPath, '../../lib/node_modules/npm/') - gypPath = path.join(nodeNpmPkgPath, 'node_modules/node-gyp/bin/node-gyp.js') - if (fs.existsSync(gypPath)) { - return gypPath - } - - return null -} - -function gypVersion() { - var cmd = null - var args = ['-v'] - var gyp = findNodeGyp() - if (gyp) { - args.unshift(gyp) // push_front - cmd = process.execPath - } else { - cmd = IS_WIN ? 'node-gyp.cmd' : 'node-gyp' - } - - var child = cp.spawnSync(cmd, args) - var match = /v(\d+\.\d+\.\d+)/.exec(child.stdout) - return match && match[1] -} - -function execGyp(args, cb) { - var cmd = null - var gyp = findNodeGyp() - if (gyp) { - args.unshift(gyp) // push_front - cmd = process.execPath - } else { - cmd = IS_WIN ? 'node-gyp.cmd' : 'node-gyp' - } - - var spawnOpts = {} - if (!opts.quiet) { - spawnOpts.stdio = [0, 1, 2] - } - console.log('> ' + cmd + ' ' + args.join(' ')) // eslint-disable-line no-console - - var child = cp.spawn(cmd, args, spawnOpts) - child.on('error', cb) - child.on('close', function onGypClose(code) { - if (code !== 0) { - cb(new Error('Command exited with non-zero code: ' + code)) - } else { - cb(null) - } - }) -} - -function build(target, rebuild, cb) { - if (IS_WIN && HAS_OLD_NODE_GYP_ARGS_FOR_WINDOWS) { - target = '/t:' + target - } - - var cmds = rebuild ? ['clean', 'configure'] : ['configure'] - - execGyp(cmds, function cleanCb(err) { - if (err) { - return cb(err) - } - - var jobs = Math.round(CPU_COUNT / 2) - execGyp(['build', '-j', jobs, target], cb) - }) -} - -function moveBuild(target, cb) { - var filePath = path.join(BUILD_PATH, target + '.node') - var destination = path.join(BUILD_PATH, getBinFileName(target)) - fs.rename(filePath, destination, cb) -} - -function download(target, cb) { - /* eslint-disable no-console */ - var hasCalledBack = false - var fileName = getPackageFileName(target) - var url = DOWNLOAD_HOST + REMOTE_PATH + fileName - - if (DOWNLOAD_HOST.startsWith('https:')) { - var client = https - } else { - console.log( - 'Falling back to http, please consider enabling SSL on ' + DOWNLOAD_HOST - ) - var client = http - } - - client.get(url, function getFile(res) { - if (res.statusCode === 404) { - return cb(new Error('No pre-built artifacts for your OS/architecture.')) - } else if (res.statusCode !== 200) { - return cb(new Error('Failed to download ' + url + ': code ' + res.statusCode)) - } - - var unzip = zlib.createGunzip() - var buffers = [] - var size = 0 - res.pipe(unzip).on('data', function onResData(data) { - buffers.push(data) - size += data.length - }) - - res.on('error', function onResError(err) { - if (!hasCalledBack) { - hasCalledBack = true - cb(new Error('Failed to download ' + url + ': ' + err.message)) - } - }) - - unzip.on('error', function onResError(err) { - if (!hasCalledBack) { - hasCalledBack = true - cb(new Error('Failed to unzip ' + url + ': ' + err.message)) - } - }) - - unzip.on('end', function onResEnd() { - if (hasCalledBack) { - return - } - hasCalledBack = true - cb(null, Buffer.concat(buffers, size)) - }) - - res.resume() - }) - /* eslint-enable no-console */ -} - -function saveDownload(target, data, cb) { - makePath(BUILD_PATH, function makePathCB(err) { - if (err) { - return cb(err) - } - - var filePath = path.join(BUILD_PATH, getBinFileName(target)) - fs.writeFile(filePath, data, cb) - }) -} - -function install(target, cb) { - var errors = [] - - var noBuild = opts['no-build'] || process.env.NR_NATIVE_METRICS_NO_BUILD - var noDownload = opts['no-download'] || process.env.NR_NATIVE_METRICS_NO_DOWNLOAD - - // If NR_NATIVE_METRICS_NO_BUILD env var is specified, jump straight to downloading - if (noBuild) { - return doDownload() - } - - // Otherwise, first attempt to build the package using the source. If that fails, try - // downloading the package. If that also fails, whoops! - build(target, true, function buildCB(err) { - if (!err) { - return moveBuild(target, function moveBuildCB(err) { - if (err) { - errors.push(err) - doDownload() - } else { - doCallback() - } - }) - } - errors.push(err) - - // Building failed, try downloading. - doDownload() - }) - - function doDownload() { - if (noDownload && !noBuild) { - return doCallback(new Error('Downloading is disabled.')) - } - - download(target, function downloadCB(err, data) { - if (err) { - return doCallback(err) - } - - saveDownload(target, data, doCallback) - }) - } - - function doCallback(err) { - if (err) { - errors.push(err) - cb(err) - } else { - cb() - } - } -} - -function upload(target, cb) { - // XXX This is the one external dep allowed by this module. The aws-sdk must - // XXX be a dev-dep of the module and uploading should only be done after - // XXX installing. - - const zip = zlib.createGzip() - fs.createReadStream(path.join(BUILD_PATH, getBinFileName(target))).pipe(zip) - - // AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set in the environment. - const AWS = require('aws-sdk') - const s3 = new AWS.S3() - const key = path.join(REMOTE_PATH, getPackageFileName(target)) - - s3.upload({ - Bucket: S3_BUCKET, - Key: key, - Body: zip - }, function s3UploadCb(err) { - if (err) { - cb(new Error('Failed to upload file: ' + err.message)) - } else { - cb() - } - }) -} - -function parseArgs(_argv, _opts) { - var args = [] - for (var i = 0; i < _argv.length; ++i) { - if (/^--/.test(_argv[i])) { - _opts[_argv[i].substr(2)] = true - } else { - args.push(_argv[i]) - } - } - return args -} - -function executeCli(cmd, target) { - /* eslint-disable no-console */ - console.log( - [ - '============================================================================', - `Attempting ${cmd} in native-metrics module. Please note that this is an`, - 'OPTIONAL dependency, and any resultant errors in this process will not', - 'affect the general performance of the New Relic agent, but event loop and', - 'garbage collection metrics will not be collected.', - '============================================================================', - '' - ].join('\n') - ) - - if (cmd === 'build' || cmd === 'rebuild') { - build(target, cmd === 'rebuild', function buildCb(err) { - if (err) { - _endCli(err) - } else { - moveBuild(target, _endCli) - } - }) - } else if (cmd === 'install') { - install(target, _endCli) - } else if (cmd === 'upload') { - upload(target, _endCli) - } - - function _endCli(err) { - if (err) { - console.error(`Failed to execute native-metrics ${cmd}: ${err.message}`) - process.exit(1) - } else { - console.log(cmd + ' successful: ' + _getFileName(target)) - } - } - /* eslint-enable no-console */ -} diff --git a/node_modules/@newrelic/native-metrics/package.json b/node_modules/@newrelic/native-metrics/package.json deleted file mode 100644 index 7783e9a0..00000000 --- a/node_modules/@newrelic/native-metrics/package.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "_args": [ - [ - "@newrelic/native-metrics@6.0.0", - "/home/jstaro/dev/com.tibber.athom" - ] - ], - "_from": "@newrelic/native-metrics@6.0.0", - "_id": "@newrelic/native-metrics@6.0.0", - "_inBundle": false, - "_integrity": "sha512-EUdlsv25dEMT+8SOV02Xfk2E3UTo2fH33lVmnv/CSllH6+ljJDAfG0Ib5zY92Qmaj+oiThbfRpSYOlUfH+Uuiw==", - "_location": "/@newrelic/native-metrics", - "_optional": true, - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@newrelic/native-metrics@6.0.0", - "name": "@newrelic/native-metrics", - "escapedName": "@newrelic%2fnative-metrics", - "scope": "@newrelic", - "rawSpec": "6.0.0", - "saveSpec": null, - "fetchSpec": "6.0.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/@newrelic/native-metrics/-/native-metrics-6.0.0.tgz", - "_spec": "6.0.0", - "_where": "/home/jstaro/dev/com.tibber.athom", - "author": { - "name": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "bugs": { - "url": "https://github.com/newrelic/node-native-metrics/issues" - }, - "contributors": [ - { - "name": "Natalie Wolfe", - "email": "nwolfe@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Peter Svetlichny", - "email": "psvetlichny@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Alan Storm", - "email": "astorm@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Bryan Clement", - "email": "bclement@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Michael Goin", - "email": "mgoin@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Nick Tzaperas", - "email": "ntzaperas@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Carlo Pearson", - "email": "cpearson@newrelic.com", - "url": "https://newrelic.com" - } - ], - "dependencies": { - "nan": "^2.14.1", - "semver": "^5.5.1" - }, - "description": "A module for generating metrics from V8.", - "devDependencies": { - "async": "^2.6.1", - "aws-sdk": "^2.266.1", - "eslint": "^4.19.1", - "segfault-handler": "^1.3.0", - "tap": "^14.10.7" - }, - "engines": { - "node": ">=10", - "npm": ">=3" - }, - "homepage": "https://github.com/newrelic/node-native-metrics#readme", - "keywords": [ - "newrelic", - "gc", - "metrics", - "stats", - "gc-stats", - "gc stats", - "gc metrics", - "native-metrics", - "native metrics" - ], - "license": "Apache-2.0", - "main": "index.js", - "name": "@newrelic/native-metrics", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/newrelic/node-native-metrics.git" - }, - "scripts": { - "build": "node ./lib/pre-build.js build native_metrics", - "clean": "node-gyp clean", - "install": "node ./lib/pre-build.js install native_metrics", - "integration": "tap --timeout 360000 --jobs=1 --no-coverage tests/integration/*.tap.js", - "lint": "eslint .", - "native": "node tests/native/*.js", - "rebuild": "node ./lib/pre-build.js rebuild native_metrics", - "test": "npm run lint && npm run unit && npm run integration", - "unit": "tap --expose-gc --jobs=1 --no-coverage tests/unit/*.tap.js", - "upload": "node ./lib/pre-build.js upload native_metrics" - }, - "version": "6.0.0" -} diff --git a/node_modules/@newrelic/native-metrics/src/GCBinder.cpp b/node_modules/@newrelic/native-metrics/src/GCBinder.cpp deleted file mode 100644 index 61f0cdda..00000000 --- a/node_modules/@newrelic/native-metrics/src/GCBinder.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - - -#include "GCBinder.hpp" - -namespace nr { - -GCBinder* GCBinder::_instance = NULL; // TODO: nullptr once we drop Node <4. - -NAN_METHOD(GCBinder::New) { - if (_instance != NULL) { - return Nan::ThrowError("GCBinder instance already created."); - } - - GCBinder* obj = new GCBinder(); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); -} - -NAN_METHOD(GCBinder::Read) { - Nan::HandleScope scope; - GCBinder* self = GCBinder::Unwrap(info.This()); - - v8::Local results = Nan::New(); - for (auto& metrics : self->_gcMetrics) { - // first == type, second == metrics - Nan::Set( - results, - Nan::New((double)metrics.first), - metrics.second.asJSObject() - ); - metrics.second.reset(); - } - - info.GetReturnValue().Set(results); -} - -void GCBinder::_gcEnd(const v8::GCType type) { - // HR times are in nanoseconds. A duration of 70 milliseconds in nanoseconds - // would overflow a `Metric`'s `sumOfSquares` field. It is entirely - // believable that a 70 ms GC event could occur, so we will convert everything - // to milliseconds and store them as doubles instead. - uint64_t durationHr = uv_hrtime() - _gcStartTimeHR; - _gcMetrics[type] += durationHr / 1000000.0; // 1 million ns per ms -} - -} diff --git a/node_modules/@newrelic/native-metrics/src/GCBinder.hpp b/node_modules/@newrelic/native-metrics/src/GCBinder.hpp deleted file mode 100644 index 7bf47f2e..00000000 --- a/node_modules/@newrelic/native-metrics/src/GCBinder.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include - -#include "Metric.hpp" - -namespace nr { - -class GCBinder : public Nan::ObjectWrap { -public: - static NAN_MODULE_INIT(Init) { - v8::Local clas = Nan::New(New); - clas->SetClassName(Nan::New("GCBinder").ToLocalChecked()); - clas->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(clas, "bind", Bind); - SetPrototypeMethod(clas, "unbind", Unbind); - SetPrototypeMethod(clas, "read", Read); - - constructor().Reset(Nan::GetFunction(clas).ToLocalChecked()); - Nan::Set( - target, - Nan::New("GCBinder").ToLocalChecked(), - Nan::GetFunction(clas).ToLocalChecked() - ); - } - - static NAN_METHOD(New); - - /** - * Binds into the GC event hooks. - */ - static NAN_METHOD(Bind) { - _bind(); - } - - /** - * Removes hooks into the GC events. - */ - static NAN_METHOD(Unbind) { - _unbind(); - } - - static NAN_METHOD(Read); - - GCBinder(): - _gcStartTimeHR(uv_hrtime()) - { - _instance = this; - } - - ~GCBinder() { - _unbind(); - _instance = NULL; - } - -private: - static GCBinder* _instance; - - static NAN_GC_CALLBACK(_gcPrologue) { - if (GCBinder::_instance) { - GCBinder::_instance->_gcStart(); - } - } - - static NAN_GC_CALLBACK(_gcEpilogue) { - if (GCBinder::_instance) { - GCBinder::_instance->_gcEnd(type); - } - } - - static void _bind() { - Nan::AddGCPrologueCallback(_gcPrologue); - Nan::AddGCEpilogueCallback(_gcEpilogue); - } - - static void _unbind() { - Nan::RemoveGCPrologueCallback(_gcPrologue); - Nan::RemoveGCEpilogueCallback(_gcEpilogue); - } - - static inline Nan::Persistent & constructor() { - // ??? - static Nan::Persistent _constructor; - return _constructor; - } - - void _gcStart() { - _gcStartTimeHR = uv_hrtime(); - } - - void _gcEnd(const v8::GCType type); - - uint64_t _gcStartTimeHR; - std::map> _gcMetrics; -}; - -} diff --git a/node_modules/@newrelic/native-metrics/src/LoopChecker.cpp b/node_modules/@newrelic/native-metrics/src/LoopChecker.cpp deleted file mode 100644 index ba7b2b76..00000000 --- a/node_modules/@newrelic/native-metrics/src/LoopChecker.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - - -#include -#include - -#include "LoopChecker.hpp" - -const uint64_t SEC_TO_MICRO = static_cast(1e6); - -namespace nr { - -uint64_t getUsageSumInUS() { - uv_rusage_t usage; - uv_getrusage(&usage); - return ( - usage.ru_utime.tv_sec * SEC_TO_MICRO + - usage.ru_utime.tv_usec + - usage.ru_stime.tv_sec * SEC_TO_MICRO + - usage.ru_stime.tv_usec - ); -} - -NAN_METHOD(LoopChecker::Read) { - Nan::HandleScope scope; - LoopChecker* self = LoopChecker::Unwrap(info.This()); - - v8::Local results = Nan::New(); - Nan::Set(results, Nan::New("usage").ToLocalChecked(), self->_tickUsageMetric.asJSObject()); - - info.GetReturnValue().Set(results); - self->_tickUsageMetric.reset(); -} - -LoopChecker::LoopChecker(): - _checkUsage(getUsageSumInUS()) -{ - uv_check_init(uv_default_loop(), &_checkHandle); - uv_unref((uv_handle_t*)&_checkHandle); - _checkHandle.data = (void*)this; -} - -void LoopChecker::_checkCB(uv_check_t* handle) { - LoopChecker* self = (LoopChecker*)handle->data; - const uint64_t usage = getUsageSumInUS(); - - self->_tickUsageMetric += usage - self->_checkUsage; - self->_checkUsage = usage; -} - -} diff --git a/node_modules/@newrelic/native-metrics/src/LoopChecker.hpp b/node_modules/@newrelic/native-metrics/src/LoopChecker.hpp deleted file mode 100644 index c35aa283..00000000 --- a/node_modules/@newrelic/native-metrics/src/LoopChecker.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include - -#include "Metric.hpp" - -namespace nr { - -class LoopChecker : public Nan::ObjectWrap { -public: - static NAN_MODULE_INIT(Init) { - v8::Local clas = Nan::New(New); - clas->SetClassName(Nan::New("LoopChecker").ToLocalChecked()); - clas->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(clas, "bind", Bind); - SetPrototypeMethod(clas, "unbind", Unbind); - SetPrototypeMethod(clas, "read", Read); - - constructor().Reset(Nan::GetFunction(clas).ToLocalChecked()); - Nan::Set( - target, - Nan::New("LoopChecker").ToLocalChecked(), - Nan::GetFunction(clas).ToLocalChecked() - ); - } - - static NAN_METHOD(New) { - LoopChecker* obj = new LoopChecker(); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(Bind) { - LoopChecker* self = LoopChecker::Unwrap(info.This()); - uv_check_start(&self->_checkHandle, &LoopChecker::_checkCB); - } - - static NAN_METHOD(Unbind) { - LoopChecker* self = LoopChecker::Unwrap(info.This()); - uv_check_stop(&self->_checkHandle); - } - - static NAN_METHOD(Read); - -private: - LoopChecker(); - - static inline Nan::Persistent & constructor() { - static Nan::Persistent _constructor; - return _constructor; - } - - static void _checkCB(uv_check_t* handle); - - uv_check_t _checkHandle; - uint64_t _checkUsage; - Metric _tickUsageMetric; -}; - -} diff --git a/node_modules/@newrelic/native-metrics/src/Metric.hpp b/node_modules/@newrelic/native-metrics/src/Metric.hpp deleted file mode 100644 index 7e132c8f..00000000 --- a/node_modules/@newrelic/native-metrics/src/Metric.hpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include - -namespace nr { - -template -class Metric { -public: - typedef T value_type; - - Metric(): - _total((value_type)0), - _min((value_type)0), - _max((value_type)0), - _sumOfSquares((value_type)0), - _count((value_type)0) - {} - - Metric& operator+=(const value_type& val) { - _total += val; - if (_count == 0) { - _min = _max = val; - } else { - _min = std::min(_min, val); - _max = std::max(_max, val); - } - _sumOfSquares += val * val; - ++_count; - - return *this; - } - - const value_type& total() const { - return _total; - } - - const value_type& min() const { - return _min; - } - - const value_type& max() const { - return _max; - } - - const value_type& sumOfSquares() const { - return _sumOfSquares; - } - - const value_type& count() const { - return _count; - } - - void reset() { - _total = (value_type)0; - _min = (value_type)0; - _max = (value_type)0; - _sumOfSquares = (value_type)0; - _count = (value_type)0; - } - - v8::Local asJSObject() const { - v8::Local results = Nan::New(); - #define SET(key, val) \ - Nan::Set( \ - results, \ - Nan::New(key).ToLocalChecked(), \ - Nan::New((double)(val)) \ - ) - - SET("total", total()); - SET("min", min()); - SET("max", max()); - SET("sumOfSquares", sumOfSquares()); - SET("count", count()); - #undef SET - - return results; - } - -private: - value_type _total; - value_type _min; - value_type _max; - value_type _sumOfSquares; - value_type _count; -}; - -} diff --git a/node_modules/@newrelic/native-metrics/src/RUsageMeter.cpp b/node_modules/@newrelic/native-metrics/src/RUsageMeter.cpp deleted file mode 100644 index ef35340d..00000000 --- a/node_modules/@newrelic/native-metrics/src/RUsageMeter.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - - -#include -#include -#include - -#include "RUsageMeter.hpp" - -namespace nr { - -NAN_METHOD(RUsageMeter::Read) { - Nan::HandleScope scope; - - // Update our stats. - RUsageMeter* self = RUsageMeter::Unwrap(info.This()); - self->_read(); - - // Build the results object. - v8::Local results = Nan::New(); - Nan::Set( - results, - Nan::New("diff").ToLocalChecked(), - self->_usageToJSObj(self->_usageDiff) - ); - Nan::Set( - results, - Nan::New("current").ToLocalChecked(), - self->_usageToJSObj(self->_lastUsage) - ); - - // Return the results. - info.GetReturnValue().Set(results); -} - -void RUsageMeter::_read() { - uv_rusage_t nextUsage; - uv_getrusage(&nextUsage); - - #define DIFF(X) _usageDiff.X = nextUsage.X - _lastUsage.X - DIFF(ru_utime.tv_sec); - DIFF(ru_utime.tv_usec); - DIFF(ru_stime.tv_sec); - DIFF(ru_stime.tv_usec); - DIFF(ru_maxrss); - DIFF(ru_ixrss); - DIFF(ru_idrss); - DIFF(ru_isrss); - DIFF(ru_minflt); - DIFF(ru_majflt); - DIFF(ru_nswap); - DIFF(ru_inblock); - DIFF(ru_oublock); - DIFF(ru_msgsnd); - DIFF(ru_msgrcv); - DIFF(ru_nsignals); - DIFF(ru_nvcsw); - DIFF(ru_nivcsw); - #undef DIFF - - std::memcpy(&_lastUsage, &nextUsage, sizeof(uv_rusage_t)); -} - -v8::Local RUsageMeter::_usageToJSObj(const uv_rusage_t& usage) { - // Convert the CPU times into millisecond floating point values. - double utime = ( - (double)(usage.ru_utime.tv_sec * 1000.0) + - (double)(usage.ru_utime.tv_usec / 1000.0) - ); - double stime = ( - (double)(usage.ru_stime.tv_sec * 1000.0) + - (double)(usage.ru_stime.tv_usec / 1000.0) - ); - - // Copy all the values to V8 objects. - v8::Local obj = Nan::New(); - #define SET(key, val) \ - Nan::Set(obj, Nan::New(key).ToLocalChecked(), Nan::New((double)val)) - SET("ru_utime", utime); - SET("ru_stime", stime); - SET("ru_maxrss", usage.ru_maxrss); - SET("ru_ixrss", usage.ru_ixrss); - SET("ru_idrss", usage.ru_idrss); - SET("ru_isrss", usage.ru_isrss); - SET("ru_minflt", usage.ru_minflt); - SET("ru_majflt", usage.ru_majflt); - SET("ru_nswap", usage.ru_nswap); - SET("ru_inblock", usage.ru_inblock); - SET("ru_oublock", usage.ru_oublock); - SET("ru_msgsnd", usage.ru_msgsnd); - SET("ru_msgrcv", usage.ru_msgrcv); - SET("ru_nsignals", usage.ru_nsignals); - SET("ru_nvcsw", usage.ru_nvcsw); - SET("ru_nivcsw", usage.ru_nivcsw); - #undef SET - - return obj; -} - -} diff --git a/node_modules/@newrelic/native-metrics/src/RUsageMeter.hpp b/node_modules/@newrelic/native-metrics/src/RUsageMeter.hpp deleted file mode 100644 index 472d5afa..00000000 --- a/node_modules/@newrelic/native-metrics/src/RUsageMeter.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include - -namespace nr { - -class RUsageMeter : public Nan::ObjectWrap { -public: - /** - * Initialze the RUsageMeter JS class. - */ - static NAN_MODULE_INIT(Init) { - v8::Local clas = Nan::New(New); - clas->SetClassName(Nan::New("RUsageMeter").ToLocalChecked()); - clas->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(clas, "read", Read); - - constructor().Reset(Nan::GetFunction(clas).ToLocalChecked()); - Nan::Set( - target, - Nan::New("RUsageMeter").ToLocalChecked(), - Nan::GetFunction(clas).ToLocalChecked() - ); - } - - /** - * JS constructor. - */ - static NAN_METHOD(New) { - RUsageMeter* obj = new RUsageMeter(); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - /** - * Performs internal update of resource usage and returns the diff. - * - * @return The diff of the last usage reading and this one. - */ - static NAN_METHOD(Read); - - RUsageMeter() { - std::memset(&_lastUsage, 0, sizeof(uv_rusage_t)); - } - -private: - static inline Nan::Persistent & constructor() { - // ??? - static Nan::Persistent _constructor; - return _constructor; - } - - /** - * Fetches the latest resource usage numbers from libuv and updates the diff. - */ - void _read(); - - /** - * Copies `uv_rusage_t` instances into new JS objects. - * - * @param usage The resource usage stats to copy. - * - * @return A JS object containing all the values of the given usage data. - */ - v8::Local _usageToJSObj(const uv_rusage_t& usage); - - uv_rusage_t _usageDiff; - uv_rusage_t _lastUsage; -}; - -} diff --git a/node_modules/@newrelic/native-metrics/src/native_metrics.cpp b/node_modules/@newrelic/native-metrics/src/native_metrics.cpp deleted file mode 100644 index 84e903a7..00000000 --- a/node_modules/@newrelic/native-metrics/src/native_metrics.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - - -#include - -#include "GCBinder.hpp" -#include "LoopChecker.hpp" -#include "RUsageMeter.hpp" - -namespace nr { - -NAN_MODULE_INIT(Init) { - Nan::HandleScope scope; - GCBinder::Init(target); - RUsageMeter::Init(target); - LoopChecker::Init(target); -} - -NODE_MODULE(native_metrics, Init) - -} diff --git a/node_modules/@newrelic/native-metrics/third_party_manifest.json b/node_modules/@newrelic/native-metrics/third_party_manifest.json deleted file mode 100644 index 4d9b9e5b..00000000 --- a/node_modules/@newrelic/native-metrics/third_party_manifest.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "lastUpdated": "Mon Nov 02 2020 16:32:24 GMT-0800 (Pacific Standard Time)", - "projectName": "Native Metrics for New Relic Node Agent", - "projectUrl": "https://github.com/newrelic/node-native-metrics", - "includeDev": true, - "dependencies": { - "nan@2.14.1": { - "name": "nan", - "version": "2.14.1", - "range": "^2.14.1", - "licenses": "MIT", - "repoUrl": "https://github.com/nodejs/nan", - "versionedRepoUrl": "https://github.com/nodejs/nan/tree/v2.14.1", - "licenseFile": "node_modules/nan/LICENSE.md", - "licenseUrl": "https://github.com/nodejs/nan/blob/v2.14.1/LICENSE.md", - "licenseTextSource": "file" - }, - "semver@5.7.1": { - "name": "semver", - "version": "5.7.1", - "range": "^5.5.1", - "licenses": "ISC", - "repoUrl": "https://github.com/npm/node-semver", - "versionedRepoUrl": "https://github.com/npm/node-semver/tree/v5.7.1", - "licenseFile": "node_modules/semver/LICENSE", - "licenseUrl": "https://github.com/npm/node-semver/blob/v5.7.1/LICENSE", - "licenseTextSource": "file" - } - }, - "devDependencies": { - "async@2.6.3": { - "name": "async", - "version": "2.6.3", - "range": "^2.6.1", - "licenses": "MIT", - "repoUrl": "https://github.com/caolan/async", - "versionedRepoUrl": "https://github.com/caolan/async/tree/v2.6.3", - "licenseFile": "node_modules/async/LICENSE", - "licenseUrl": "https://github.com/caolan/async/blob/v2.6.3/LICENSE", - "licenseTextSource": "file", - "publisher": "Caolan McMahon" - }, - "aws-sdk@2.549.0": { - "name": "aws-sdk", - "version": "2.549.0", - "range": "^2.266.1", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/aws/aws-sdk-js", - "versionedRepoUrl": "https://github.com/aws/aws-sdk-js/tree/v2.549.0", - "licenseFile": "node_modules/aws-sdk/LICENSE.txt", - "licenseUrl": "https://github.com/aws/aws-sdk-js/blob/v2.549.0/LICENSE.txt", - "licenseTextSource": "file", - "publisher": "Amazon Web Services", - "url": "https://aws.amazon.com/" - }, - "eslint@4.19.1": { - "name": "eslint", - "version": "4.19.1", - "range": "^4.19.1", - "licenses": "MIT", - "repoUrl": "https://github.com/eslint/eslint", - "versionedRepoUrl": "https://github.com/eslint/eslint/tree/v4.19.1", - "licenseFile": "node_modules/eslint/LICENSE", - "licenseUrl": "https://github.com/eslint/eslint/blob/v4.19.1/LICENSE", - "licenseTextSource": "file", - "publisher": "Nicholas C. Zakas", - "email": "nicholas+npm@nczconsulting.com" - }, - "segfault-handler@1.3.0": { - "name": "segfault-handler", - "version": "1.3.0", - "range": "^1.3.0", - "licenses": "BSD-3-Clause", - "repoUrl": "https://github.com/ddopson/node-segfault-handler", - "versionedRepoUrl": "https://github.com/ddopson/node-segfault-handler/tree/v1.3.0", - "licenseFile": "node_modules/segfault-handler/LICENSE", - "licenseUrl": "https://github.com/ddopson/node-segfault-handler/blob/v1.3.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Kenneth Geisshirt", - "email": "geisshirt@gmail.com" - }, - "tap@14.10.7": { - "name": "tap", - "version": "14.10.7", - "range": "^14.10.7", - "licenses": "ISC", - "repoUrl": "https://github.com/tapjs/node-tap", - "versionedRepoUrl": "https://github.com/tapjs/node-tap/tree/v14.10.7", - "licenseFile": "node_modules/tap/LICENSE", - "licenseUrl": "https://github.com/tapjs/node-tap/blob/v14.10.7/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - } - } -} diff --git a/node_modules/@newrelic/superagent/CHANGELOG.md b/node_modules/@newrelic/superagent/CHANGELOG.md deleted file mode 100644 index b30f9c1e..00000000 --- a/node_modules/@newrelic/superagent/CHANGELOG.md +++ /dev/null @@ -1,58 +0,0 @@ -### 4.0.0 (2020-11-02): - -* Added Node v14.x to CI. -* Removed Node v8.x from CI. -* Updates to README, guidelines, and templates to match New Relic OSS template. -* Bumped node-test-utilities version to ^4.0.0. - -### 3.0.0 (2020-07-16): - -* Updated to Apache 2.0 license. -* Bumped minimum peer dependency (and dev dependency) of newrelic (agent) to 6.11 for license matching. -* Added third party notices file and metadata for dependencies. -* Updated readme with more detail. -* Added issue templates for bugs and enhancements. -* Added code of conduct file. -* Added contributing guide. -* Added pull request template. -* Migrated CI to GitHub Actions. -* Added copyright headers to all source files. -* Added repository property to package.json. -* Removed Coveralls integration. -* Bumped minimum versions of tap, eslint and @newrelic/test-utilities. -* Added .vscode to .gitignore. -* Added additional items to .npmignore. - -### 2.0.1 (2020-02-26): - -* Support the fixed segment naming in Node 8 - -### 2.0.0 (2019-10-28): - -* **BREAKING** Removed support for Node 6, 7, and 9. - - The minimum supported version is now Node v8. For further information on our support policy, see: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent. - -* Added support for Node v12. - -### 1.0.3 (2019-03-04): - -* Added missing `LICENSE` file. - - Thanks @jreidgreer for the catch! - -### 1.0.2 (2019-01-07): - -* Updated `@newrelic/test-utilities` dependency to v3.0.0. - -### 1.0.1 (2018-11-20): -* Updated versioned test ranges to account for superagent v4 dropping support - for node versions <6 - -* Pinned tap version to 11. - -### 1.0.0 (2018-09-10): - -* Initial release of super agent instrumentation. - - Fixes context state management for callbacks and promises. diff --git a/node_modules/@newrelic/superagent/CONTRIBUTING.md b/node_modules/@newrelic/superagent/CONTRIBUTING.md deleted file mode 100644 index 882ecd18..00000000 --- a/node_modules/@newrelic/superagent/CONTRIBUTING.md +++ /dev/null @@ -1,116 +0,0 @@ -# Guidelines for Contributing Code - -New Relic welcomes code contributions by the Node community to this module, and -have taken effort to make this process easy for both contributors and our -development team. - -## Feature Requests - -Feature requests should be submitted in the [Issue tracker](../../issues), with -a description of the expected behavior & use case. Before submitting an Issue, -please search for similar ones in the [closed -issues](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement). - -## Pull Requests - -We can only accept PRs for version v3.0.0 or greater due to open source -licensing restrictions. - -## Code of Conduct - -Before contributing please read the [code of -conduct](https://github.com/newrelic/.github/blob/main/CODE_OF_CONDUCT.md) - -Note that our [code of -conduct](https://github.com/newrelic/.github/blob/main/CODE_OF_CONDUCT.md) -applies to all platforms -and venues related to this project; please follow it in all your interactions -with the project and its participants. - -## Contributor License Agreement - -Keep in mind that when you submit your Pull Request, you'll need to sign the -CLA via the click-through using CLA-Assistant. If you'd like to execute our -corporate CLA, or if you have any questions, please drop us an email at -opensource@newrelic.com. - -For more information about CLAs, please check out Alex Russell’s excellent -post, [“Why Do I Need to Sign -This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/). - -## Slack - -We host a public Slack with a dedicated channel for contributors and -maintainers of open source projects hosted by New Relic. If you are -contributing to this project, you're welcome to request access to the -\#oss-contributors channel in the newrelicusers.slack.com workspace. To request -access, see https://newrelicusers-signup.herokuapp.com/. - -## PR Guidelines - -### Version Support - -When contributing, keep in mind that New Relic customers (that's you!) are -running many different versions of Node, some of them pretty old. Changes that -depend on the newest version of Node will probably be rejected, especially if -they replace something backwards compatible. - -Be aware that the instrumentation needs to work with a wide range of versions of -the instrumented modules, and that code that looks nonsensical or -overcomplicated may be that way for compatibility-related reasons. Read all the -comments and check the related tests before deciding whether existing code is -incorrect. - -If you’re planning on contributing a new feature or an otherwise complex -contribution, we kindly ask you to start a conversation with the maintainer team -by opening up an Github issue first. - -### General Guidelines - -In general, we try to limit adding third-party production dependencies. If one -is necessary, please be prepared to make a clear case for the need. - -### Coding Style Guidelines/Conventions - -We use eslint to enforce certain coding standards. Please see our -[.eslintrc](./.eslintrc.js) file for specific rule configuration. - -### Testing Guidelines - -The superagent instrumentation module includes a suite of unit and functional -tests which should be used to verify your changes don't break existing -functionality. - -Unit tests are stored in `tests/`. They're written in -[node-tap](https://github.com/isaacs/node-tap), and have the extension `.tap.js`. - -Functional tests against specific versions of instrumented modules are stored -in `test/versioned/`. They are also written in `node-tap`. - -#### Running Tests - -Running the test suite is simple. Just run: - - npm test - -This will install all the necessary modules and run the unit tests in standalone -mode, followed by the functional tests if all of the unit tests pass. - -To just run unit tests, run the following: - - npm run unit - -#### Writing Tests - -For most contributions it is strongly recommended to add additional tests which -exercise your changes. This helps us efficiently incorporate your changes into -our mainline codebase and provides a safeguard that your change won't be broken -by future development. Because of this, we require that all changes come with -tests. You are welcome to submit pull requests with untested changes, but they -won't be merged until you or the development team have an opportunity to write -tests for them. - -There are some rare cases where code changes do not result in changed -functionality (e.g. a performance optimization) and new tests are not required. -In general, including tests with your pull request dramatically increases the -chances it will be accepted. diff --git a/node_modules/@newrelic/superagent/LICENSE b/node_modules/@newrelic/superagent/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/node_modules/@newrelic/superagent/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@newrelic/superagent/README.md b/node_modules/@newrelic/superagent/README.md deleted file mode 100644 index b376a6cc..00000000 --- a/node_modules/@newrelic/superagent/README.md +++ /dev/null @@ -1,89 +0,0 @@ -[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus) - -# New Relic SuperAgent instrumentation [![superagent Instrumentation CI][1]][2] -New Relic's official SuperAgent framework instrumentation for use with the -New Relic [Node.js agent](https://github.com/newrelic/node-newrelic). - -This module is a dependency of the agent and is installed by default when you install the agent. - -## Installation and Getting Started -Typically, most users use the version auto-installed by the agent. You can see agent install instructions [here](https://github.com/newrelic/node-newrelic#installation-and-getting-started). - -In some cases, installing a specific version is ideal. For example, new features or major changes might be released via a major version update to this module, prior to inclusion in the main New Relic Node.js agent. - -``` -npm install @newrelic/superagent -``` - -```js -// index.js -require('@newrelic/superagent') -``` - -For more information, please see the agent [installation guide][3] and [compatibility and requirements][4]. - -Our [API and developer documentation](http://newrelic.github.io/node-newrelic/docs/) for writing instrumentation will be of help. We particularly recommend the tutorials and various "shim" API documentation. - -## Testing -The module includes a suite of unit and functional tests which should be used to -verify that your changes don't break existing functionality. - -All tests are stored in `tests/` and are written using -[Node-Tap](https://www.npmjs.com/package/tap) with the extension `.tap.js`. - -To run the full suite, run: `npm test`. - -Individual test scripts include: - -``` -npm run unit -npm run versioned -``` - -## Support - -Should you need assistance with New Relic products, you are in good hands with several support channels. - -If the issue has been confirmed as a bug or is a feature request, please file a GitHub issue. - -**Support Channels** - -* [New Relic Documentation](https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/introduction-new-relic-nodejs): Comprehensive guidance for using our platform -* [New Relic Community](https://discuss.newrelic.com/c/support-products-agents/node-js-agent/): The best place to engage in troubleshooting questions -* [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications -* [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level -* [New Relic Technical Support](https://support.newrelic.com/) 24/7/365 ticketed support. Read more about our [Technical Support Offerings](https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/support-plan). - - -## Privacy -At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise. - -We define “Personal Data” as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address and email address. - -For more information, review [New Relic’s General Data Privacy Notice](https://newrelic.com/termsandconditions/privacy). - -## Contribute - -We encourage your contributions to improve the superagent instrumentation module! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. - -If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com. - -**A note about vulnerabilities** - -As noted in our [security policy](https://github.com/newrelic/node-newrelic-superagent/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals. - -If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic). - -If you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md). - -To [all contributors](https://github.com/newrelic/node-newrelic-superagent/graphs/contributors), we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to [New Relic SuperAgent (Node)](https://opensource.newrelic.com/projects/newrelic/node-newrelic-superagent). - -## License -New Relic SuperAgent instrumentation is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License. - -New Relic SuperAgent instrumentation also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document. - -[1]: https://github.com/newrelic/node-newrelic-superagent/workflows/superagent%20Instrumentation%20CI/badge.svg -[2]: https://github.com/newrelic/node-newrelic-superagent/actions?query=workflow%3A%22superagent+Instrumentation+CI%22 -[3]: https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/install-nodejs-agent -[4]: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent diff --git a/node_modules/@newrelic/superagent/THIRD_PARTY_NOTICES.md b/node_modules/@newrelic/superagent/THIRD_PARTY_NOTICES.md deleted file mode 100644 index 9d097ef3..00000000 --- a/node_modules/@newrelic/superagent/THIRD_PARTY_NOTICES.md +++ /dev/null @@ -1,591 +0,0 @@ -# Third Party Notices - -The New Relic SuperAgent Instrumentation uses source code from third party libraries which carry -their own copyright notices and license terms. These notices are provided -below. - -In the event that a required notice is missing or incorrect, please notify us -by e-mailing [open-source@newrelic.com](mailto:open-source@newrelic.com). - -For any licenses that require the disclosure of source -code, the source code can be found at [https://github.com/newrelic/node-newrelic-superagent](https://github.com/newrelic/node-newrelic-superagent). - -## Content - -**[dependencies](#dependencies)** - -* [methods](#methods) - -**[devDependencies](#devDependencies)** - -* [@newrelic/test-utilities](#newrelictest-utilities) -* [eslint](#eslint) -* [newrelic](#newrelic) -* [semver](#semver) -* [superagent](#superagent) -* [tap](#tap) - - -## dependencies - -### methods - -This product includes source derived from [methods](https://github.com/jshttp/methods) ([v1.1.2](https://github.com/jshttp/methods/tree/v1.1.2)), distributed under the [MIT License](https://github.com/jshttp/methods/blob/v1.1.2/LICENSE): - -``` -(The MIT License) - -Copyright (c) 2013-2014 TJ Holowaychuk -Copyright (c) 2015-2016 Douglas Christopher Wilson - -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. - - -``` - - -## devDependencies - -### @newrelic/test-utilities - -This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v4.1.2](https://github.com/newrelic/node-test-utilities/tree/v4.1.2)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v4.1.2/LICENSE): - -``` - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -``` - -### eslint - -This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v6.8.0](https://github.com/eslint/eslint/tree/v6.8.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v6.8.0/LICENSE): - -``` -Copyright JS Foundation and other contributors, https://js.foundation - -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. - -``` - -### newrelic - -This product includes source derived from [newrelic](https://github.com/newrelic/node-newrelic) ([v6.14.0](https://github.com/newrelic/node-newrelic/tree/v6.14.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic/blob/v6.14.0/LICENSE): - -``` - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -``` - -### semver - -This product includes source derived from [semver](https://github.com/npm/node-semver) ([v5.7.1](https://github.com/npm/node-semver/tree/v5.7.1)), distributed under the [ISC License](https://github.com/npm/node-semver/blob/v5.7.1/LICENSE): - -``` -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - -``` - -### superagent - -This product includes source derived from [superagent](https://github.com/visionmedia/superagent) ([v3.8.3](https://github.com/visionmedia/superagent/tree/v3.8.3)), distributed under the [MIT License](https://github.com/visionmedia/superagent/blob/v3.8.3/LICENSE): - -``` -(The MIT License) - -Copyright (c) 2014-2016 TJ Holowaychuk - -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. - -``` - -### tap - -This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v14.10.8](https://github.com/tapjs/node-tap/tree/v14.10.8)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v14.10.8/LICENSE): - -``` -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - -``` - ------ - -Portions copyright Node.js contributors. Depending on your existing libraries and package management settings, -your systems may call externally maintained libraries in addition to those listed above. -See [here](https://nodejs.org/en/docs/meta/topics/dependencies/) and [here](https://github.com/nodejs/node/blob/v4.3.1/LICENSE) -for additional details regarding externally maintained libraries and certain related licenses and notices.” diff --git a/node_modules/@newrelic/superagent/index.js b/node_modules/@newrelic/superagent/index.js deleted file mode 100644 index fefc25ba..00000000 --- a/node_modules/@newrelic/superagent/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/** - * Allows users to `require('@newrelic/superagent')` directly in their app. If - * they for some reason choose to explicitly use an older version of our - * instrumentation then the supportability metrics for custom instrumentation - * will trigger. - */ -var newrelic = require('newrelic') -newrelic.instrument('superagent', require('./lib/instrumentation')) diff --git a/node_modules/@newrelic/superagent/lib/instrumentation.js b/node_modules/@newrelic/superagent/lib/instrumentation.js deleted file mode 100644 index d2bd9ba5..00000000 --- a/node_modules/@newrelic/superagent/lib/instrumentation.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const methods = require('methods') - -module.exports = function instrument(shim, superagent) { - shim.wrapExport(superagent, function wrapRequest(shim, request) { - if (!shim.isFunction(request)) { - shim.logger.debug('Not wrapping export, expected a function.') - return request - } - - const wrapped = shim.wrapReturn(request, wrapSuperAgentReq) - Object.assign(wrapped, request) - shim.wrapReturn(wrapped, methods, wrapSuperAgentReq) - - return wrapped - }) - - const proto = superagent.Request && superagent.Request.prototype - if (proto) { - shim.wrapReturn(proto, 'request', wrapHttpReq) - shim.wrap(proto, 'callback', wrapCallback) - shim.wrap(proto, 'then', wrapThen) - } -} - -function wrapSuperAgentReq(shim, fn, name, req) { - // If the request already has a segment associated with it, then we'll use that - // one for future context. If it doesn't we'll bind it to the current segment. - const segment = shim.getSegment(req) || shim.getActiveSegment() - if (segment) { - shim.storeSegment(req, segment) - shim.bindSegment(req, 'request', segment, false) - } -} - -function wrapHttpReq(shim, fn, name, req) { - const segment = shim.getSegment(req) - if (segment) { - shim.storeSegment(this, segment) - } -} - -function wrapCallback(shim, callback) { - return function wrappedCallback() { - const segment = shim.getSegment(this) - if (segment && segment.transaction.isActive()) { - shim.bindCallbackSegment(this, '_callback', segment) - } - return callback.apply(this, arguments) - } -} - -function wrapThen(shim, then) { - return function wrappedThen(resolve, reject) { - const segment = shim.getSegment(this) || shim.getActiveSegment() - if (!segment) { - return then.apply(this, arguments) - } - - return shim.applySegment(then, segment, false, this, [resolve, reject]) - } -} diff --git a/node_modules/@newrelic/superagent/nr-hooks.js b/node_modules/@newrelic/superagent/nr-hooks.js deleted file mode 100644 index cfaa4067..00000000 --- a/node_modules/@newrelic/superagent/nr-hooks.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = [{ - type: 'generic', - moduleName: 'superagent', - onRequire: require('./lib/instrumentation') -}] diff --git a/node_modules/@newrelic/superagent/package.json b/node_modules/@newrelic/superagent/package.json deleted file mode 100644 index 2b7edd8a..00000000 --- a/node_modules/@newrelic/superagent/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_from": "@newrelic/superagent@^4.0.0", - "_id": "@newrelic/superagent@4.0.0", - "_inBundle": false, - "_integrity": "sha512-n4iNrsV0908yHNZPNof7rm/mffclHaIxprCCWk15b4IRJik2VrtuIrK3mboUgNdv5pX4P7EZytY/D6kJgFkDGw==", - "_location": "/@newrelic/superagent", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@newrelic/superagent@^4.0.0", - "name": "@newrelic/superagent", - "escapedName": "@newrelic%2fsuperagent", - "scope": "@newrelic", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/@newrelic/superagent/-/superagent-4.0.0.tgz", - "_shasum": "e3c53825b64aa73a3c5f6d98ed0ccc97f86dbc42", - "_spec": "@newrelic/superagent@^4.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "New Relic Node.js Agent Team", - "email": "nodejs@newrelic.com" - }, - "bugs": { - "url": "https://github.com/newrelic/node-newrelic-superagent/issues" - }, - "bundleDependencies": false, - "dependencies": { - "methods": "^1.1.2" - }, - "deprecated": false, - "description": "New Relic instrumentation for the `superagent` package.", - "devDependencies": { - "@newrelic/test-utilities": "^4.0.0", - "eslint": "^6.8.0", - "newrelic": "^6.11.0", - "semver": "^5.5.0", - "superagent": "^3.8.3", - "tap": "^14.10.7" - }, - "engines": { - "node": ">=10.0" - }, - "homepage": "https://github.com/newrelic/node-newrelic-superagent#readme", - "license": "Apache-2.0", - "main": "index.js", - "name": "@newrelic/superagent", - "peerDependencies": { - "newrelic": ">=6.11.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/newrelic/node-newrelic-superagent.git" - }, - "scripts": { - "lint": "eslint *.js lib tests", - "test": "npm run lint && npm run unit && npm run versioned", - "unit": "tap tests/unit/**/*.tap.js --no-coverage", - "versioned": "versioned-tests --minor -i 2 'tests/versioned/*.tap.js'" - }, - "version": "4.0.0" -} diff --git a/node_modules/@newrelic/superagent/tests/unit/newrelic.js b/node_modules/@newrelic/superagent/tests/unit/newrelic.js deleted file mode 100644 index 7dd46597..00000000 --- a/node_modules/@newrelic/superagent/tests/unit/newrelic.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -exports.config = { - app_name: ['My Application'], - license_key: 'license key here', - logging: { - level: 'trace', - filepath: '../../newrelic_agent.log' - }, - utilization: { - detect_aws: false, - detect_pcf: false, - detect_azure: false, - detect_gcp: false, - detect_docker: false - }, - transaction_tracer: { - enabled: true - } -} diff --git a/node_modules/@newrelic/superagent/tests/unit/superagent.tap.js b/node_modules/@newrelic/superagent/tests/unit/superagent.tap.js deleted file mode 100644 index 6a2574f7..00000000 --- a/node_modules/@newrelic/superagent/tests/unit/superagent.tap.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -tap.test('SuperAgent instrumentation', (t) => { - const helper = utils.TestAgent.makeInstrumented() - t.tearDown(() => helper.unload()) - - helper.registerInstrumentation({ - moduleName: 'superagent', - type: 'generic', - onRequire: '../../lib/instrumentation' - }) - const superagent = require('superagent') - - t.ok(superagent.Request, 'should not remove Request class') - t.type(superagent.Request.prototype.then, 'function') - t.type(superagent.Request.prototype.end, 'function') - - t.end() -}) diff --git a/node_modules/@newrelic/superagent/tests/versioned/async-await.tap.js b/node_modules/@newrelic/superagent/tests/versioned/async-await.tap.js deleted file mode 100644 index 1e6fcfd3..00000000 --- a/node_modules/@newrelic/superagent/tests/versioned/async-await.tap.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -utils(tap) - -const EXTERNAL_NAME = /External\/newrelic.com(:443)*\// - -tap.test('SuperAgent instrumentation with async/await', (t) => { - t.autoend() - - let helper = null - let request = null - t.beforeEach((done) => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'superagent', - type: 'generic', - onRequire: require('../../lib/instrumentation'), - onError: done - }) - request = require('superagent') - done() - }) - t.afterEach((done) => { - helper.unload() - done() - }) - - t.test('should maintain transaction context with promises', (t) => { - helper.runInTransaction(async function(tx) { - await request.get('https://newrelic.com') - - t.transaction(tx) - t.segments(tx.trace.root, [{ - name: EXTERNAL_NAME, - children: [{name: 'Callback: '}] // CB created by superagent - }]) - t.end() - }) - }) -}) diff --git a/node_modules/@newrelic/superagent/tests/versioned/newrelic.js b/node_modules/@newrelic/superagent/tests/versioned/newrelic.js deleted file mode 100644 index 7dd46597..00000000 --- a/node_modules/@newrelic/superagent/tests/versioned/newrelic.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -exports.config = { - app_name: ['My Application'], - license_key: 'license key here', - logging: { - level: 'trace', - filepath: '../../newrelic_agent.log' - }, - utilization: { - detect_aws: false, - detect_pcf: false, - detect_azure: false, - detect_gcp: false, - detect_docker: false - }, - transaction_tracer: { - enabled: true - } -} diff --git a/node_modules/@newrelic/superagent/tests/versioned/package.json b/node_modules/@newrelic/superagent/tests/versioned/package.json deleted file mode 100644 index 1c2cb8d2..00000000 --- a/node_modules/@newrelic/superagent/tests/versioned/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "superagent-tests", - "version": "0.0.0", - "private": true, - "tests": [{ - "engines": { - "node": ">=10" - }, - "dependencies": { - "superagent": ">=2" - }, - "files": [ - "async-await.tap.js", - "superagent.tap.js" - ] - }] -} diff --git a/node_modules/@newrelic/superagent/tests/versioned/superagent.tap.js b/node_modules/@newrelic/superagent/tests/versioned/superagent.tap.js deleted file mode 100644 index cdd5cd73..00000000 --- a/node_modules/@newrelic/superagent/tests/versioned/superagent.tap.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const tap = require('tap') -const utils = require('@newrelic/test-utilities') - -utils(tap) - -const EXTERNAL_NAME = /External\/newrelic.com(:443)*\// - -tap.test('SuperAgent instrumentation', (t) => { - t.autoend() - - let helper = null - let request = null - t.beforeEach((done) => { - helper = utils.TestAgent.makeInstrumented() - helper.registerInstrumentation({ - moduleName: 'superagent', - type: 'generic', - onRequire: require('../../lib/instrumentation'), - onError: done - }) - request = require('superagent') - done() - }) - t.afterEach((done) => { - helper.unload() - done() - }) - - t.test('should maintain transaction context with callbacks', (t) => { - helper.runInTransaction((tx) => { - request.get('https://newrelic.com', function testCallback() { - t.transaction(tx) - t.segments(tx.trace.root, [{ - name: EXTERNAL_NAME, - children: [{name: 'Callback: testCallback'}] - }]) - t.end() - }) - }) - }) - - t.test('should maintain transaction context with promises', (t) => { - helper.runInTransaction((tx) => { - request.get('https://newrelic.com').then(function testThen() { - t.transaction(tx) - t.segments(tx.trace.root, [{ - name: EXTERNAL_NAME, - children: [{name: 'Callback: '}] // CB created by superagent - }]) - t.end() - }) - }) - }) -}) diff --git a/node_modules/@newrelic/superagent/third_party_manifest.json b/node_modules/@newrelic/superagent/third_party_manifest.json deleted file mode 100644 index ec02f651..00000000 --- a/node_modules/@newrelic/superagent/third_party_manifest.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "lastUpdated": "Mon Nov 02 2020 14:46:12 GMT-0800 (Pacific Standard Time)", - "projectName": "New Relic SuperAgent Instrumentation", - "projectUrl": "https://github.com/newrelic/node-newrelic-superagent", - "includeDev": true, - "dependencies": { - "methods@1.1.2": { - "name": "methods", - "version": "1.1.2", - "range": "^1.1.2", - "licenses": "MIT", - "repoUrl": "https://github.com/jshttp/methods", - "versionedRepoUrl": "https://github.com/jshttp/methods/tree/v1.1.2", - "licenseFile": "node_modules/methods/LICENSE", - "licenseUrl": "https://github.com/jshttp/methods/blob/v1.1.2/LICENSE", - "licenseTextSource": "file" - } - }, - "devDependencies": { - "@newrelic/test-utilities@4.1.2": { - "name": "@newrelic/test-utilities", - "version": "4.1.2", - "range": "^4.0.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-test-utilities", - "versionedRepoUrl": "https://github.com/newrelic/node-test-utilities/tree/v4.1.2", - "licenseFile": "node_modules/@newrelic/test-utilities/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-test-utilities/blob/v4.1.2/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "eslint@6.8.0": { - "name": "eslint", - "version": "6.8.0", - "range": "^6.8.0", - "licenses": "MIT", - "repoUrl": "https://github.com/eslint/eslint", - "versionedRepoUrl": "https://github.com/eslint/eslint/tree/v6.8.0", - "licenseFile": "node_modules/eslint/LICENSE", - "licenseUrl": "https://github.com/eslint/eslint/blob/v6.8.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Nicholas C. Zakas", - "email": "nicholas+npm@nczconsulting.com" - }, - "newrelic@6.14.0": { - "name": "newrelic", - "version": "6.14.0", - "range": "^6.11.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-newrelic", - "versionedRepoUrl": "https://github.com/newrelic/node-newrelic/tree/v6.14.0", - "licenseFile": "node_modules/newrelic/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-newrelic/blob/v6.14.0/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "semver@5.7.1": { - "name": "semver", - "version": "5.7.1", - "range": "^5.5.0", - "licenses": "ISC", - "repoUrl": "https://github.com/npm/node-semver", - "versionedRepoUrl": "https://github.com/npm/node-semver/tree/v5.7.1", - "licenseFile": "node_modules/semver/LICENSE", - "licenseUrl": "https://github.com/npm/node-semver/blob/v5.7.1/LICENSE", - "licenseTextSource": "file" - }, - "superagent@3.8.3": { - "name": "superagent", - "version": "3.8.3", - "range": "^3.8.3", - "licenses": "MIT", - "repoUrl": "https://github.com/visionmedia/superagent", - "versionedRepoUrl": "https://github.com/visionmedia/superagent/tree/v3.8.3", - "licenseFile": "node_modules/superagent/LICENSE", - "licenseUrl": "https://github.com/visionmedia/superagent/blob/v3.8.3/LICENSE", - "licenseTextSource": "file", - "publisher": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "tap@14.10.8": { - "name": "tap", - "version": "14.10.8", - "range": "^14.10.7", - "licenses": "ISC", - "repoUrl": "https://github.com/tapjs/node-tap", - "versionedRepoUrl": "https://github.com/tapjs/node-tap/tree/v14.10.8", - "licenseFile": "node_modules/tap/LICENSE", - "licenseUrl": "https://github.com/tapjs/node-tap/blob/v14.10.8/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - } - } -} diff --git a/node_modules/@protobufjs/aspromise/LICENSE b/node_modules/@protobufjs/aspromise/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/aspromise/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/aspromise/README.md b/node_modules/@protobufjs/aspromise/README.md deleted file mode 100644 index c7ae36f0..00000000 --- a/node_modules/@protobufjs/aspromise/README.md +++ /dev/null @@ -1,13 +0,0 @@ -@protobufjs/aspromise -===================== -[![npm](https://img.shields.io/npm/v/@protobufjs/aspromise.svg)](https://www.npmjs.com/package/@protobufjs/aspromise) - -Returns a promise from a node-style callback function. - -API ---- - -* **asPromise(fn: `function`, ctx: `Object`, ...params: `*`): `Promise<*>`**
- Returns a promise from a node-style callback function. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/aspromise/index.d.ts b/node_modules/@protobufjs/aspromise/index.d.ts deleted file mode 100644 index 3db03dbe..00000000 --- a/node_modules/@protobufjs/aspromise/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export = asPromise; - -type asPromiseCallback = (error: Error | null, ...params: any[]) => {}; - -/** - * Returns a promise from a node-style callback function. - * @memberof util - * @param {asPromiseCallback} fn Function to call - * @param {*} ctx Function context - * @param {...*} params Function arguments - * @returns {Promise<*>} Promisified function - */ -declare function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise; diff --git a/node_modules/@protobufjs/aspromise/index.js b/node_modules/@protobufjs/aspromise/index.js deleted file mode 100644 index d6f642cb..00000000 --- a/node_modules/@protobufjs/aspromise/index.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; -module.exports = asPromise; - -/** - * Callback as used by {@link util.asPromise}. - * @typedef asPromiseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {...*} params Additional arguments - * @returns {undefined} - */ - -/** - * Returns a promise from a node-style callback function. - * @memberof util - * @param {asPromiseCallback} fn Function to call - * @param {*} ctx Function context - * @param {...*} params Function arguments - * @returns {Promise<*>} Promisified function - */ -function asPromise(fn, ctx/*, varargs */) { - var params = new Array(arguments.length - 1), - offset = 0, - index = 2, - pending = true; - while (index < arguments.length) - params[offset++] = arguments[index++]; - return new Promise(function executor(resolve, reject) { - params[offset] = function callback(err/*, varargs */) { - if (pending) { - pending = false; - if (err) - reject(err); - else { - var params = new Array(arguments.length - 1), - offset = 0; - while (offset < params.length) - params[offset++] = arguments[offset]; - resolve.apply(null, params); - } - } - }; - try { - fn.apply(ctx || null, params); - } catch (err) { - if (pending) { - pending = false; - reject(err); - } - } - }); -} diff --git a/node_modules/@protobufjs/aspromise/package.json b/node_modules/@protobufjs/aspromise/package.json deleted file mode 100644 index 6280affe..00000000 --- a/node_modules/@protobufjs/aspromise/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "_from": "@protobufjs/aspromise@^1.1.2", - "_id": "@protobufjs/aspromise@1.1.2", - "_inBundle": false, - "_integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=", - "_location": "/@protobufjs/aspromise", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/aspromise@^1.1.2", - "name": "@protobufjs/aspromise", - "escapedName": "@protobufjs%2faspromise", - "scope": "@protobufjs", - "rawSpec": "^1.1.2", - "saveSpec": null, - "fetchSpec": "^1.1.2" - }, - "_requiredBy": [ - "/@protobufjs/fetch", - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "_shasum": "9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf", - "_spec": "@protobufjs/aspromise@^1.1.2", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Returns a promise from a node-style callback function.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/aspromise", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.2" -} diff --git a/node_modules/@protobufjs/aspromise/tests/index.js b/node_modules/@protobufjs/aspromise/tests/index.js deleted file mode 100644 index cfdb258a..00000000 --- a/node_modules/@protobufjs/aspromise/tests/index.js +++ /dev/null @@ -1,130 +0,0 @@ -var tape = require("tape"); - -var asPromise = require(".."); - -tape.test("aspromise", function(test) { - - test.test(this.name + " - resolve", function(test) { - - function fn(arg1, arg2, callback) { - test.equal(this, ctx, "function should be called with this = ctx"); - test.equal(arg1, 1, "function should be called with arg1 = 1"); - test.equal(arg2, 2, "function should be called with arg2 = 2"); - callback(null, arg2); - } - - var ctx = {}; - - var promise = asPromise(fn, ctx, 1, 2); - promise.then(function(arg2) { - test.equal(arg2, 2, "promise should be resolved with arg2 = 2"); - test.end(); - }).catch(function(err) { - test.fail("promise should not be rejected (" + err + ")"); - }); - }); - - test.test(this.name + " - reject", function(test) { - - function fn(arg1, arg2, callback) { - test.equal(this, ctx, "function should be called with this = ctx"); - test.equal(arg1, 1, "function should be called with arg1 = 1"); - test.equal(arg2, 2, "function should be called with arg2 = 2"); - callback(arg1); - } - - var ctx = {}; - - var promise = asPromise(fn, ctx, 1, 2); - promise.then(function() { - test.fail("promise should not be resolved"); - }).catch(function(err) { - test.equal(err, 1, "promise should be rejected with err = 1"); - test.end(); - }); - }); - - test.test(this.name + " - resolve twice", function(test) { - - function fn(arg1, arg2, callback) { - test.equal(this, ctx, "function should be called with this = ctx"); - test.equal(arg1, 1, "function should be called with arg1 = 1"); - test.equal(arg2, 2, "function should be called with arg2 = 2"); - callback(null, arg2); - callback(null, arg1); - } - - var ctx = {}; - var count = 0; - - var promise = asPromise(fn, ctx, 1, 2); - promise.then(function(arg2) { - test.equal(arg2, 2, "promise should be resolved with arg2 = 2"); - if (++count > 1) - test.fail("promise should not be resolved twice"); - test.end(); - }).catch(function(err) { - test.fail("promise should not be rejected (" + err + ")"); - }); - }); - - test.test(this.name + " - reject twice", function(test) { - - function fn(arg1, arg2, callback) { - test.equal(this, ctx, "function should be called with this = ctx"); - test.equal(arg1, 1, "function should be called with arg1 = 1"); - test.equal(arg2, 2, "function should be called with arg2 = 2"); - callback(arg1); - callback(arg2); - } - - var ctx = {}; - var count = 0; - - var promise = asPromise(fn, ctx, 1, 2); - promise.then(function() { - test.fail("promise should not be resolved"); - }).catch(function(err) { - test.equal(err, 1, "promise should be rejected with err = 1"); - if (++count > 1) - test.fail("promise should not be rejected twice"); - test.end(); - }); - }); - - test.test(this.name + " - reject error", function(test) { - - function fn(callback) { - test.ok(arguments.length === 1 && typeof callback === "function", "function should be called with just a callback"); - throw 3; - } - - var promise = asPromise(fn, null); - promise.then(function() { - test.fail("promise should not be resolved"); - }).catch(function(err) { - test.equal(err, 3, "promise should be rejected with err = 3"); - test.end(); - }); - }); - - test.test(this.name + " - reject and error", function(test) { - - function fn(callback) { - callback(3); - throw 4; - } - - var count = 0; - - var promise = asPromise(fn, null); - promise.then(function() { - test.fail("promise should not be resolved"); - }).catch(function(err) { - test.equal(err, 3, "promise should be rejected with err = 3"); - if (++count > 1) - test.fail("promise should not be rejected twice"); - test.end(); - }); - }); -}); diff --git a/node_modules/@protobufjs/base64/LICENSE b/node_modules/@protobufjs/base64/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/base64/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/base64/README.md b/node_modules/@protobufjs/base64/README.md deleted file mode 100644 index b06cb0a2..00000000 --- a/node_modules/@protobufjs/base64/README.md +++ /dev/null @@ -1,19 +0,0 @@ -@protobufjs/base64 -================== -[![npm](https://img.shields.io/npm/v/@protobufjs/base64.svg)](https://www.npmjs.com/package/@protobufjs/base64) - -A minimal base64 implementation for number arrays. - -API ---- - -* **base64.length(string: `string`): `number`**
- Calculates the byte length of a base64 encoded string. - -* **base64.encode(buffer: `Uint8Array`, start: `number`, end: `number`): `string`**
- Encodes a buffer to a base64 encoded string. - -* **base64.decode(string: `string`, buffer: `Uint8Array`, offset: `number`): `number`**
- Decodes a base64 encoded string to a buffer. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/base64/index.d.ts b/node_modules/@protobufjs/base64/index.d.ts deleted file mode 100644 index 085d0a7a..00000000 --- a/node_modules/@protobufjs/base64/index.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Calculates the byte length of a base64 encoded string. - * @param {string} string Base64 encoded string - * @returns {number} Byte length - */ -export function length(string: string): number; - -/** - * Encodes a buffer to a base64 encoded string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} Base64 encoded string - */ -export function encode(buffer: Uint8Array, start: number, end: number): string; - -/** - * Decodes a base64 encoded string to a buffer. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Number of bytes written - * @throws {Error} If encoding is invalid - */ -export function decode(string: string, buffer: Uint8Array, offset: number): number; - -/** - * Tests if the specified string appears to be base64 encoded. - * @param {string} string String to test - * @returns {boolean} `true` if it appears to be base64 encoded, otherwise false - */ -export function test(string: string): boolean; diff --git a/node_modules/@protobufjs/base64/index.js b/node_modules/@protobufjs/base64/index.js deleted file mode 100644 index 6146f543..00000000 --- a/node_modules/@protobufjs/base64/index.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; - -/** - * A minimal base64 implementation for number arrays. - * @memberof util - * @namespace - */ -var base64 = exports; - -/** - * Calculates the byte length of a base64 encoded string. - * @param {string} string Base64 encoded string - * @returns {number} Byte length - */ -base64.length = function length(string) { - var p = string.length; - if (!p) - return 0; - var n = 0; - while (--p % 4 > 1 && string.charAt(p) === "=") - ++n; - return Math.ceil(string.length * 3) / 4 - n; -}; - -// Base64 encoding table -var b64 = new Array(64); - -// Base64 decoding table -var s64 = new Array(123); - -// 65..90, 97..122, 48..57, 43, 47 -for (var i = 0; i < 64;) - s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; - -/** - * Encodes a buffer to a base64 encoded string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} Base64 encoded string - */ -base64.encode = function encode(buffer, start, end) { - var parts = null, - chunk = []; - var i = 0, // output index - j = 0, // goto index - t; // temporary - while (start < end) { - var b = buffer[start++]; - switch (j) { - case 0: - chunk[i++] = b64[b >> 2]; - t = (b & 3) << 4; - j = 1; - break; - case 1: - chunk[i++] = b64[t | b >> 4]; - t = (b & 15) << 2; - j = 2; - break; - case 2: - chunk[i++] = b64[t | b >> 6]; - chunk[i++] = b64[b & 63]; - j = 0; - break; - } - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (j) { - chunk[i++] = b64[t]; - chunk[i++] = 61; - if (j === 1) - chunk[i++] = 61; - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -var invalidEncoding = "invalid encoding"; - -/** - * Decodes a base64 encoded string to a buffer. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Number of bytes written - * @throws {Error} If encoding is invalid - */ -base64.decode = function decode(string, buffer, offset) { - var start = offset; - var j = 0, // goto index - t; // temporary - for (var i = 0; i < string.length;) { - var c = string.charCodeAt(i++); - if (c === 61 && j > 1) - break; - if ((c = s64[c]) === undefined) - throw Error(invalidEncoding); - switch (j) { - case 0: - t = c; - j = 1; - break; - case 1: - buffer[offset++] = t << 2 | (c & 48) >> 4; - t = c; - j = 2; - break; - case 2: - buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; - t = c; - j = 3; - break; - case 3: - buffer[offset++] = (t & 3) << 6 | c; - j = 0; - break; - } - } - if (j === 1) - throw Error(invalidEncoding); - return offset - start; -}; - -/** - * Tests if the specified string appears to be base64 encoded. - * @param {string} string String to test - * @returns {boolean} `true` if probably base64 encoded, otherwise false - */ -base64.test = function test(string) { - return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); -}; diff --git a/node_modules/@protobufjs/base64/package.json b/node_modules/@protobufjs/base64/package.json deleted file mode 100644 index 55ec6759..00000000 --- a/node_modules/@protobufjs/base64/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "@protobufjs/base64@^1.1.2", - "_id": "@protobufjs/base64@1.1.2", - "_inBundle": false, - "_integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", - "_location": "/@protobufjs/base64", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/base64@^1.1.2", - "name": "@protobufjs/base64", - "escapedName": "@protobufjs%2fbase64", - "scope": "@protobufjs", - "rawSpec": "^1.1.2", - "saveSpec": null, - "fetchSpec": "^1.1.2" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "_shasum": "4c85730e59b9a1f1f349047dbf24296034bb2735", - "_spec": "@protobufjs/base64@^1.1.2", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A minimal base64 implementation for number arrays.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/base64", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.2" -} diff --git a/node_modules/@protobufjs/base64/tests/index.js b/node_modules/@protobufjs/base64/tests/index.js deleted file mode 100644 index 6ede32c2..00000000 --- a/node_modules/@protobufjs/base64/tests/index.js +++ /dev/null @@ -1,46 +0,0 @@ -var tape = require("tape"); - -var base64 = require(".."); - -var strings = { - "": "", - "a": "YQ==", - "ab": "YWI=", - "abcdefg": "YWJjZGVmZw==", - "abcdefgh": "YWJjZGVmZ2g=", - "abcdefghi": "YWJjZGVmZ2hp" -}; - -tape.test("base64", function(test) { - - Object.keys(strings).forEach(function(str) { - var enc = strings[str]; - - test.equal(base64.test(enc), true, "should detect '" + enc + "' to be base64 encoded"); - - var len = base64.length(enc); - test.equal(len, str.length, "should calculate '" + enc + "' as " + str.length + " bytes"); - - var buf = new Array(len); - var len2 = base64.decode(enc, buf, 0); - test.equal(len2, len, "should decode '" + enc + "' to " + len + " bytes"); - - test.equal(String.fromCharCode.apply(String, buf), str, "should decode '" + enc + "' to '" + str + "'"); - - var enc2 = base64.encode(buf, 0, buf.length); - test.equal(enc2, enc, "should encode '" + str + "' to '" + enc + "'"); - - }); - - test.throws(function() { - var buf = new Array(10); - base64.decode("YQ!", buf, 0); - }, Error, "should throw if encoding is invalid"); - - test.throws(function() { - var buf = new Array(10); - base64.decode("Y", buf, 0); - }, Error, "should throw if string is truncated"); - - test.end(); -}); diff --git a/node_modules/@protobufjs/codegen/LICENSE b/node_modules/@protobufjs/codegen/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/codegen/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/codegen/README.md b/node_modules/@protobufjs/codegen/README.md deleted file mode 100644 index 577c43ed..00000000 --- a/node_modules/@protobufjs/codegen/README.md +++ /dev/null @@ -1,49 +0,0 @@ -@protobufjs/codegen -=================== -[![npm](https://img.shields.io/npm/v/@protobufjs/codegen.svg)](https://www.npmjs.com/package/@protobufjs/codegen) - -A minimalistic code generation utility. - -API ---- - -* **codegen([functionParams: `string[]`], [functionName: string]): `Codegen`**
- Begins generating a function. - -* **codegen.verbose = `false`**
- When set to true, codegen will log generated code to console. Useful for debugging. - -Invoking **codegen** returns an appender function that appends code to the function's body and returns itself: - -* **Codegen(formatString: `string`, [...formatParams: `any`]): Codegen**
- Appends code to the function's body. The format string can contain placeholders specifying the types of inserted format parameters: - - * `%d`: Number (integer or floating point value) - * `%f`: Floating point value - * `%i`: Integer value - * `%j`: JSON.stringify'ed value - * `%s`: String value - * `%%`: Percent sign
- -* **Codegen([scope: `Object.`]): `Function`**
- Finishes the function and returns it. - -* **Codegen.toString([functionNameOverride: `string`]): `string`**
- Returns the function as a string. - -Example -------- - -```js -var codegen = require("@protobufjs/codegen"); - -var add = codegen(["a", "b"], "add") // A function with parameters "a" and "b" named "add" - ("// awesome comment") // adds the line to the function's body - ("return a + b - c + %d", 1) // replaces %d with 1 and adds the line to the body - ({ c: 1 }); // adds "c" with a value of 1 to the function's scope - -console.log(add.toString()); // function add(a, b) { return a + b - c + 1 } -console.log(add(1, 2)); // calculates 1 + 2 - 1 + 1 = 3 -``` - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/codegen/index.d.ts b/node_modules/@protobufjs/codegen/index.d.ts deleted file mode 100644 index f8ed9089..00000000 --- a/node_modules/@protobufjs/codegen/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export = codegen; - -/** - * Appends code to the function's body. - * @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any - * @param [formatParams] Format parameters - * @returns Itself or the generated function if finished - * @throws {Error} If format parameter counts do not match - */ -type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function); - -/** - * Begins generating a function. - * @param functionParams Function parameter names - * @param [functionName] Function name if not anonymous - * @returns Appender that appends code to the function's body - */ -declare function codegen(functionParams: string[], functionName?: string): Codegen; - -/** - * Begins generating a function. - * @param [functionName] Function name if not anonymous - * @returns Appender that appends code to the function's body - */ -declare function codegen(functionName?: string): Codegen; - -declare namespace codegen { - - /** When set to `true`, codegen will log generated code to console. Useful for debugging. */ - let verbose: boolean; -} diff --git a/node_modules/@protobufjs/codegen/index.js b/node_modules/@protobufjs/codegen/index.js deleted file mode 100644 index af005cb0..00000000 --- a/node_modules/@protobufjs/codegen/index.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -module.exports = codegen; - -/** - * Begins generating a function. - * @memberof util - * @param {string[]} functionParams Function parameter names - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - */ -function codegen(functionParams, functionName) { - - /* istanbul ignore if */ - if (typeof functionParams === "string") { - functionName = functionParams; - functionParams = undefined; - } - - var body = []; - - /** - * Appends code to the function's body or finishes generation. - * @typedef Codegen - * @type {function} - * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any - * @param {...*} [formatParams] Format parameters - * @returns {Codegen|Function} Itself or the generated function if finished - * @throws {Error} If format parameter counts do not match - */ - - function Codegen(formatStringOrScope) { - // note that explicit array handling below makes this ~50% faster - - // finish the function - if (typeof formatStringOrScope !== "string") { - var source = toString(); - if (codegen.verbose) - console.log("codegen: " + source); // eslint-disable-line no-console - source = "return " + source; - if (formatStringOrScope) { - var scopeKeys = Object.keys(formatStringOrScope), - scopeParams = new Array(scopeKeys.length + 1), - scopeValues = new Array(scopeKeys.length), - scopeOffset = 0; - while (scopeOffset < scopeKeys.length) { - scopeParams[scopeOffset] = scopeKeys[scopeOffset]; - scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; - } - scopeParams[scopeOffset] = source; - return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func - } - return Function(source)(); // eslint-disable-line no-new-func - } - - // otherwise append to body - var formatParams = new Array(arguments.length - 1), - formatOffset = 0; - while (formatOffset < formatParams.length) - formatParams[formatOffset] = arguments[++formatOffset]; - formatOffset = 0; - formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) { - var value = formatParams[formatOffset++]; - switch ($1) { - case "d": case "f": return String(Number(value)); - case "i": return String(Math.floor(value)); - case "j": return JSON.stringify(value); - case "s": return String(value); - } - return "%"; - }); - if (formatOffset !== formatParams.length) - throw Error("parameter count mismatch"); - body.push(formatStringOrScope); - return Codegen; - } - - function toString(functionNameOverride) { - return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}"; - } - - Codegen.toString = toString; - return Codegen; -} - -/** - * Begins generating a function. - * @memberof util - * @function codegen - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - * @variation 2 - */ - -/** - * When set to `true`, codegen will log generated code to console. Useful for debugging. - * @name util.codegen.verbose - * @type {boolean} - */ -codegen.verbose = false; diff --git a/node_modules/@protobufjs/codegen/package.json b/node_modules/@protobufjs/codegen/package.json deleted file mode 100644 index d5f9e400..00000000 --- a/node_modules/@protobufjs/codegen/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "_from": "@protobufjs/codegen@^2.0.4", - "_id": "@protobufjs/codegen@2.0.4", - "_inBundle": false, - "_integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", - "_location": "/@protobufjs/codegen", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/codegen@^2.0.4", - "name": "@protobufjs/codegen", - "escapedName": "@protobufjs%2fcodegen", - "scope": "@protobufjs", - "rawSpec": "^2.0.4", - "saveSpec": null, - "fetchSpec": "^2.0.4" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "_shasum": "7ef37f0d010fb028ad1ad59722e506d9262815cb", - "_spec": "@protobufjs/codegen@^2.0.4", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A minimalistic code generation utility.", - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/codegen", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "types": "index.d.ts", - "version": "2.0.4" -} diff --git a/node_modules/@protobufjs/codegen/tests/index.js b/node_modules/@protobufjs/codegen/tests/index.js deleted file mode 100644 index b189117d..00000000 --- a/node_modules/@protobufjs/codegen/tests/index.js +++ /dev/null @@ -1,13 +0,0 @@ -var codegen = require(".."); - -// new require("benchmark").Suite().add("add", function() { - -var add = codegen(["a", "b"], "add") - ("// awesome comment") - ("return a + b - c + %d", 1) - ({ c: 1 }); - -if (add(1, 2) !== 3) - throw Error("failed"); - -// }).on("cycle", function(event) { process.stdout.write(String(event.target) + "\n"); }).run(); diff --git a/node_modules/@protobufjs/eventemitter/LICENSE b/node_modules/@protobufjs/eventemitter/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/eventemitter/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/eventemitter/README.md b/node_modules/@protobufjs/eventemitter/README.md deleted file mode 100644 index 528e725e..00000000 --- a/node_modules/@protobufjs/eventemitter/README.md +++ /dev/null @@ -1,22 +0,0 @@ -@protobufjs/eventemitter -======================== -[![npm](https://img.shields.io/npm/v/@protobufjs/eventemitter.svg)](https://www.npmjs.com/package/@protobufjs/eventemitter) - -A minimal event emitter. - -API ---- - -* **new EventEmitter()**
- Constructs a new event emitter instance. - -* **EventEmitter#on(evt: `string`, fn: `function`, [ctx: `Object`]): `EventEmitter`**
- Registers an event listener. - -* **EventEmitter#off([evt: `string`], [fn: `function`]): `EventEmitter`**
- Removes an event listener or any matching listeners if arguments are omitted. - -* **EventEmitter#emit(evt: `string`, ...args: `*`): `EventEmitter`**
- Emits an event by calling its listeners with the specified arguments. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/eventemitter/index.d.ts b/node_modules/@protobufjs/eventemitter/index.d.ts deleted file mode 100644 index f1778238..00000000 --- a/node_modules/@protobufjs/eventemitter/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -export = EventEmitter; - -/** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ -declare class EventEmitter { - - /** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ - constructor(); - - /** - * Registers an event listener. - * @param {string} evt Event name - * @param {function} fn Listener - * @param {*} [ctx] Listener context - * @returns {util.EventEmitter} `this` - */ - on(evt: string, fn: () => any, ctx?: any): EventEmitter; - - /** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param {string} [evt] Event name. Removes all listeners if omitted. - * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns {util.EventEmitter} `this` - */ - off(evt?: string, fn?: () => any): EventEmitter; - - /** - * Emits an event by calling its listeners with the specified arguments. - * @param {string} evt Event name - * @param {...*} args Arguments - * @returns {util.EventEmitter} `this` - */ - emit(evt: string, ...args: any[]): EventEmitter; -} diff --git a/node_modules/@protobufjs/eventemitter/index.js b/node_modules/@protobufjs/eventemitter/index.js deleted file mode 100644 index f766fd07..00000000 --- a/node_modules/@protobufjs/eventemitter/index.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -module.exports = EventEmitter; - -/** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ -function EventEmitter() { - - /** - * Registered listeners. - * @type {Object.} - * @private - */ - this._listeners = {}; -} - -/** - * Registers an event listener. - * @param {string} evt Event name - * @param {function} fn Listener - * @param {*} [ctx] Listener context - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.on = function on(evt, fn, ctx) { - (this._listeners[evt] || (this._listeners[evt] = [])).push({ - fn : fn, - ctx : ctx || this - }); - return this; -}; - -/** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param {string} [evt] Event name. Removes all listeners if omitted. - * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.off = function off(evt, fn) { - if (evt === undefined) - this._listeners = {}; - else { - if (fn === undefined) - this._listeners[evt] = []; - else { - var listeners = this._listeners[evt]; - for (var i = 0; i < listeners.length;) - if (listeners[i].fn === fn) - listeners.splice(i, 1); - else - ++i; - } - } - return this; -}; - -/** - * Emits an event by calling its listeners with the specified arguments. - * @param {string} evt Event name - * @param {...*} args Arguments - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.emit = function emit(evt) { - var listeners = this._listeners[evt]; - if (listeners) { - var args = [], - i = 1; - for (; i < arguments.length;) - args.push(arguments[i++]); - for (i = 0; i < listeners.length;) - listeners[i].fn.apply(listeners[i++].ctx, args); - } - return this; -}; diff --git a/node_modules/@protobufjs/eventemitter/package.json b/node_modules/@protobufjs/eventemitter/package.json deleted file mode 100644 index dab3f47e..00000000 --- a/node_modules/@protobufjs/eventemitter/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "@protobufjs/eventemitter@^1.1.0", - "_id": "@protobufjs/eventemitter@1.1.0", - "_inBundle": false, - "_integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=", - "_location": "/@protobufjs/eventemitter", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/eventemitter@^1.1.0", - "name": "@protobufjs/eventemitter", - "escapedName": "@protobufjs%2feventemitter", - "scope": "@protobufjs", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "_shasum": "355cbc98bafad5978f9ed095f397621f1d066b70", - "_spec": "@protobufjs/eventemitter@^1.1.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A minimal event emitter.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/eventemitter", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.0" -} diff --git a/node_modules/@protobufjs/eventemitter/tests/index.js b/node_modules/@protobufjs/eventemitter/tests/index.js deleted file mode 100644 index 390958fd..00000000 --- a/node_modules/@protobufjs/eventemitter/tests/index.js +++ /dev/null @@ -1,47 +0,0 @@ -var tape = require("tape"); - -var EventEmitter = require(".."); - -tape.test("eventemitter", function(test) { - - var ee = new EventEmitter(); - var fn; - var ctx = {}; - - test.doesNotThrow(function() { - ee.emit("a", 1); - ee.off(); - ee.off("a"); - ee.off("a", function() {}); - }, "should not throw if no listeners are registered"); - - test.equal(ee.on("a", function(arg1) { - test.equal(this, ctx, "should be called with this = ctx"); - test.equal(arg1, 1, "should be called with arg1 = 1"); - }, ctx), ee, "should return itself when registering events"); - ee.emit("a", 1); - - ee.off("a"); - test.same(ee._listeners, { a: [] }, "should remove all listeners of the respective event when calling off(evt)"); - - ee.off(); - test.same(ee._listeners, {}, "should remove all listeners when just calling off()"); - - ee.on("a", fn = function(arg1) { - test.equal(this, ctx, "should be called with this = ctx"); - test.equal(arg1, 1, "should be called with arg1 = 1"); - }, ctx).emit("a", 1); - - ee.off("a", fn); - test.same(ee._listeners, { a: [] }, "should remove the exact listener when calling off(evt, fn)"); - - ee.on("a", function() { - test.equal(this, ee, "should be called with this = ee"); - }).emit("a"); - - test.doesNotThrow(function() { - ee.off("a", fn); - }, "should not throw if no such listener is found"); - - test.end(); -}); diff --git a/node_modules/@protobufjs/fetch/LICENSE b/node_modules/@protobufjs/fetch/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/fetch/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/fetch/README.md b/node_modules/@protobufjs/fetch/README.md deleted file mode 100644 index 1ebf4d4f..00000000 --- a/node_modules/@protobufjs/fetch/README.md +++ /dev/null @@ -1,13 +0,0 @@ -@protobufjs/fetch -================= -[![npm](https://img.shields.io/npm/v/@protobufjs/fetch.svg)](https://www.npmjs.com/package/@protobufjs/fetch) - -Fetches the contents of a file accross node and browsers. - -API ---- - -* **fetch(path: `string`, [options: { binary: boolean } ], [callback: `function(error: ?Error, [contents: string])`]): `Promise|undefined`** - Fetches the contents of a file. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/fetch/index.d.ts b/node_modules/@protobufjs/fetch/index.d.ts deleted file mode 100644 index ab0820cd..00000000 --- a/node_modules/@protobufjs/fetch/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -export = fetch; - -/** - * Node-style callback as used by {@link util.fetch}. - * @typedef FetchCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {string} [contents] File contents, if there hasn't been an error - * @returns {undefined} - */ -type FetchCallback = (error: Error, contents?: string) => void; - -/** - * Options as used by {@link util.fetch}. - * @typedef FetchOptions - * @type {Object} - * @property {boolean} [binary=false] Whether expecting a binary response - * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest - */ - -interface FetchOptions { - binary?: boolean; - xhr?: boolean -} - -/** - * Fetches the contents of a file. - * @memberof util - * @param {string} filename File path or url - * @param {FetchOptions} options Fetch options - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -declare function fetch(filename: string, options: FetchOptions, callback: FetchCallback): void; - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ -declare function fetch(path: string, callback: FetchCallback): void; - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchOptions} [options] Fetch options - * @returns {Promise} Promise - * @variation 3 - */ -declare function fetch(path: string, options?: FetchOptions): Promise<(string|Uint8Array)>; diff --git a/node_modules/@protobufjs/fetch/index.js b/node_modules/@protobufjs/fetch/index.js deleted file mode 100644 index d92aa689..00000000 --- a/node_modules/@protobufjs/fetch/index.js +++ /dev/null @@ -1,115 +0,0 @@ -"use strict"; -module.exports = fetch; - -var asPromise = require("@protobufjs/aspromise"), - inquire = require("@protobufjs/inquire"); - -var fs = inquire("fs"); - -/** - * Node-style callback as used by {@link util.fetch}. - * @typedef FetchCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {string} [contents] File contents, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Options as used by {@link util.fetch}. - * @typedef FetchOptions - * @type {Object} - * @property {boolean} [binary=false] Whether expecting a binary response - * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest - */ - -/** - * Fetches the contents of a file. - * @memberof util - * @param {string} filename File path or url - * @param {FetchOptions} options Fetch options - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -function fetch(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = {}; - } else if (!options) - options = {}; - - if (!callback) - return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this - - // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found. - if (!options.xhr && fs && fs.readFile) - return fs.readFile(filename, function fetchReadFileCallback(err, contents) { - return err && typeof XMLHttpRequest !== "undefined" - ? fetch.xhr(filename, options, callback) - : err - ? callback(err) - : callback(null, options.binary ? contents : contents.toString("utf8")); - }); - - // use the XHR version otherwise. - return fetch.xhr(filename, options, callback); -} - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchOptions} [options] Fetch options - * @returns {Promise} Promise - * @variation 3 - */ - -/**/ -fetch.xhr = function fetch_xhr(filename, options, callback) { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() { - - if (xhr.readyState !== 4) - return undefined; - - // local cors security errors return status 0 / empty string, too. afaik this cannot be - // reliably distinguished from an actually empty file for security reasons. feel free - // to send a pull request if you are aware of a solution. - if (xhr.status !== 0 && xhr.status !== 200) - return callback(Error("status " + xhr.status)); - - // if binary data is expected, make sure that some sort of array is returned, even if - // ArrayBuffers are not supported. the binary string fallback, however, is unsafe. - if (options.binary) { - var buffer = xhr.response; - if (!buffer) { - buffer = []; - for (var i = 0; i < xhr.responseText.length; ++i) - buffer.push(xhr.responseText.charCodeAt(i) & 255); - } - return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); - } - return callback(null, xhr.responseText); - }; - - if (options.binary) { - // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers - if ("overrideMimeType" in xhr) - xhr.overrideMimeType("text/plain; charset=x-user-defined"); - xhr.responseType = "arraybuffer"; - } - - xhr.open("GET", filename); - xhr.send(); -}; diff --git a/node_modules/@protobufjs/fetch/package.json b/node_modules/@protobufjs/fetch/package.json deleted file mode 100644 index 656db4a0..00000000 --- a/node_modules/@protobufjs/fetch/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "_from": "@protobufjs/fetch@^1.1.0", - "_id": "@protobufjs/fetch@1.1.0", - "_inBundle": false, - "_integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "_location": "/@protobufjs/fetch", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/fetch@^1.1.0", - "name": "@protobufjs/fetch", - "escapedName": "@protobufjs%2ffetch", - "scope": "@protobufjs", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "_shasum": "ba99fb598614af65700c1619ff06d454b0d84c45", - "_spec": "@protobufjs/fetch@^1.1.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - }, - "deprecated": false, - "description": "Fetches the contents of a file accross node and browsers.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/fetch", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.0" -} diff --git a/node_modules/@protobufjs/fetch/tests/index.js b/node_modules/@protobufjs/fetch/tests/index.js deleted file mode 100644 index b7fbf817..00000000 --- a/node_modules/@protobufjs/fetch/tests/index.js +++ /dev/null @@ -1,16 +0,0 @@ -var tape = require("tape"); - -var fetch = require(".."); - -tape.test("fetch", function(test) { - - if (typeof Promise !== "undefined") { - var promise = fetch("NOTFOUND"); - promise.catch(function() {}); - test.ok(promise instanceof Promise, "should return a promise if callback has been omitted"); - } - - // TODO - some way to test this properly? - - test.end(); -}); diff --git a/node_modules/@protobufjs/float/LICENSE b/node_modules/@protobufjs/float/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/float/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/float/README.md b/node_modules/@protobufjs/float/README.md deleted file mode 100644 index e475fc92..00000000 --- a/node_modules/@protobufjs/float/README.md +++ /dev/null @@ -1,102 +0,0 @@ -@protobufjs/float -================= -[![npm](https://img.shields.io/npm/v/@protobufjs/float.svg)](https://www.npmjs.com/package/@protobufjs/float) - -Reads / writes floats / doubles from / to buffers in both modern and ancient browsers. Fast. - -API ---- - -* **writeFloatLE(val: `number`, buf: `Uint8Array`, pos: `number`)**
- Writes a 32 bit float to a buffer using little endian byte order. - -* **writeFloatBE(val: `number`, buf: `Uint8Array`, pos: `number`)**
- Writes a 32 bit float to a buffer using big endian byte order. - -* **readFloatLE(buf: `Uint8Array`, pos: `number`): `number`**
- Reads a 32 bit float from a buffer using little endian byte order. - -* **readFloatBE(buf: `Uint8Array`, pos: `number`): `number`**
- Reads a 32 bit float from a buffer using big endian byte order. - -* **writeDoubleLE(val: `number`, buf: `Uint8Array`, pos: `number`)**
- Writes a 64 bit double to a buffer using little endian byte order. - -* **writeDoubleBE(val: `number`, buf: `Uint8Array`, pos: `number`)**
- Writes a 64 bit double to a buffer using big endian byte order. - -* **readDoubleLE(buf: `Uint8Array`, pos: `number`): `number`**
- Reads a 64 bit double from a buffer using little endian byte order. - -* **readDoubleBE(buf: `Uint8Array`, pos: `number`): `number`**
- Reads a 64 bit double from a buffer using big endian byte order. - -Performance ------------ -There is a simple benchmark included comparing raw read/write performance of this library (float), float's fallback for old browsers, the [ieee754](https://www.npmjs.com/package/ieee754) module and node's [buffer](https://nodejs.org/api/buffer.html). On an i7-2600k running node 6.9.1 it yields: - -``` -benchmarking writeFloat performance ... - -float x 42,741,625 ops/sec ±1.75% (81 runs sampled) -float (fallback) x 11,272,532 ops/sec ±1.12% (85 runs sampled) -ieee754 x 8,653,337 ops/sec ±1.18% (84 runs sampled) -buffer x 12,412,414 ops/sec ±1.41% (83 runs sampled) -buffer (noAssert) x 13,471,149 ops/sec ±1.09% (84 runs sampled) - - float was fastest - float (fallback) was 73.5% slower - ieee754 was 79.6% slower - buffer was 70.9% slower - buffer (noAssert) was 68.3% slower - -benchmarking readFloat performance ... - -float x 44,382,729 ops/sec ±1.70% (84 runs sampled) -float (fallback) x 20,925,938 ops/sec ±0.86% (87 runs sampled) -ieee754 x 17,189,009 ops/sec ±1.01% (87 runs sampled) -buffer x 10,518,437 ops/sec ±1.04% (83 runs sampled) -buffer (noAssert) x 11,031,636 ops/sec ±1.15% (87 runs sampled) - - float was fastest - float (fallback) was 52.5% slower - ieee754 was 61.0% slower - buffer was 76.1% slower - buffer (noAssert) was 75.0% slower - -benchmarking writeDouble performance ... - -float x 38,624,906 ops/sec ±0.93% (83 runs sampled) -float (fallback) x 10,457,811 ops/sec ±1.54% (85 runs sampled) -ieee754 x 7,681,130 ops/sec ±1.11% (83 runs sampled) -buffer x 12,657,876 ops/sec ±1.03% (83 runs sampled) -buffer (noAssert) x 13,372,795 ops/sec ±0.84% (85 runs sampled) - - float was fastest - float (fallback) was 73.1% slower - ieee754 was 80.1% slower - buffer was 67.3% slower - buffer (noAssert) was 65.3% slower - -benchmarking readDouble performance ... - -float x 40,527,888 ops/sec ±1.05% (84 runs sampled) -float (fallback) x 18,696,480 ops/sec ±0.84% (86 runs sampled) -ieee754 x 14,074,028 ops/sec ±1.04% (87 runs sampled) -buffer x 10,092,367 ops/sec ±1.15% (84 runs sampled) -buffer (noAssert) x 10,623,793 ops/sec ±0.96% (84 runs sampled) - - float was fastest - float (fallback) was 53.8% slower - ieee754 was 65.3% slower - buffer was 75.1% slower - buffer (noAssert) was 73.8% slower -``` - -To run it yourself: - -``` -$> npm run bench -``` - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/float/bench/index.js b/node_modules/@protobufjs/float/bench/index.js deleted file mode 100644 index 911f4617..00000000 --- a/node_modules/@protobufjs/float/bench/index.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; - -var float = require(".."), - ieee754 = require("ieee754"), - newSuite = require("./suite"); - -var F32 = Float32Array; -var F64 = Float64Array; -delete global.Float32Array; -delete global.Float64Array; -var floatFallback = float({}); -global.Float32Array = F32; -global.Float64Array = F64; - -var buf = new Buffer(8); - -newSuite("writeFloat") -.add("float", function() { - float.writeFloatLE(0.1, buf, 0); -}) -.add("float (fallback)", function() { - floatFallback.writeFloatLE(0.1, buf, 0); -}) -.add("ieee754", function() { - ieee754.write(buf, 0.1, 0, true, 23, 4); -}) -.add("buffer", function() { - buf.writeFloatLE(0.1, 0); -}) -.add("buffer (noAssert)", function() { - buf.writeFloatLE(0.1, 0, true); -}) -.run(); - -newSuite("readFloat") -.add("float", function() { - float.readFloatLE(buf, 0); -}) -.add("float (fallback)", function() { - floatFallback.readFloatLE(buf, 0); -}) -.add("ieee754", function() { - ieee754.read(buf, 0, true, 23, 4); -}) -.add("buffer", function() { - buf.readFloatLE(0); -}) -.add("buffer (noAssert)", function() { - buf.readFloatLE(0, true); -}) -.run(); - -newSuite("writeDouble") -.add("float", function() { - float.writeDoubleLE(0.1, buf, 0); -}) -.add("float (fallback)", function() { - floatFallback.writeDoubleLE(0.1, buf, 0); -}) -.add("ieee754", function() { - ieee754.write(buf, 0.1, 0, true, 52, 8); -}) -.add("buffer", function() { - buf.writeDoubleLE(0.1, 0); -}) -.add("buffer (noAssert)", function() { - buf.writeDoubleLE(0.1, 0, true); -}) -.run(); - -newSuite("readDouble") -.add("float", function() { - float.readDoubleLE(buf, 0); -}) -.add("float (fallback)", function() { - floatFallback.readDoubleLE(buf, 0); -}) -.add("ieee754", function() { - ieee754.read(buf, 0, true, 52, 8); -}) -.add("buffer", function() { - buf.readDoubleLE(0); -}) -.add("buffer (noAssert)", function() { - buf.readDoubleLE(0, true); -}) -.run(); diff --git a/node_modules/@protobufjs/float/bench/suite.js b/node_modules/@protobufjs/float/bench/suite.js deleted file mode 100644 index e8016d23..00000000 --- a/node_modules/@protobufjs/float/bench/suite.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -module.exports = newSuite; - -var benchmark = require("benchmark"), - chalk = require("chalk"); - -var padSize = 27; - -function newSuite(name) { - var benches = []; - return new benchmark.Suite(name) - .on("add", function(event) { - benches.push(event.target); - }) - .on("start", function() { - process.stdout.write("benchmarking " + name + " performance ...\n\n"); - }) - .on("cycle", function(event) { - process.stdout.write(String(event.target) + "\n"); - }) - .on("complete", function() { - if (benches.length > 1) { - var fastest = this.filter("fastest"), // eslint-disable-line no-invalid-this - fastestHz = getHz(fastest[0]); - process.stdout.write("\n" + chalk.white(pad(fastest[0].name, padSize)) + " was " + chalk.green("fastest") + "\n"); - benches.forEach(function(bench) { - if (fastest.indexOf(bench) === 0) - return; - var hz = hz = getHz(bench); - var percent = (1 - hz / fastestHz) * 100; - process.stdout.write(chalk.white(pad(bench.name, padSize)) + " was " + chalk.red(percent.toFixed(1) + "% slower") + "\n"); - }); - } - process.stdout.write("\n"); - }); -} - -function getHz(bench) { - return 1 / (bench.stats.mean + bench.stats.moe); -} - -function pad(str, len, l) { - while (str.length < len) - str = l ? str + " " : " " + str; - return str; -} diff --git a/node_modules/@protobufjs/float/index.d.ts b/node_modules/@protobufjs/float/index.d.ts deleted file mode 100644 index ab05de36..00000000 --- a/node_modules/@protobufjs/float/index.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Writes a 32 bit float to a buffer using little endian byte order. - * @name writeFloatLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ -export function writeFloatLE(val: number, buf: Uint8Array, pos: number): void; - -/** - * Writes a 32 bit float to a buffer using big endian byte order. - * @name writeFloatBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ -export function writeFloatBE(val: number, buf: Uint8Array, pos: number): void; - -/** - * Reads a 32 bit float from a buffer using little endian byte order. - * @name readFloatLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ -export function readFloatLE(buf: Uint8Array, pos: number): number; - -/** - * Reads a 32 bit float from a buffer using big endian byte order. - * @name readFloatBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ -export function readFloatBE(buf: Uint8Array, pos: number): number; - -/** - * Writes a 64 bit double to a buffer using little endian byte order. - * @name writeDoubleLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ -export function writeDoubleLE(val: number, buf: Uint8Array, pos: number): void; - -/** - * Writes a 64 bit double to a buffer using big endian byte order. - * @name writeDoubleBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ -export function writeDoubleBE(val: number, buf: Uint8Array, pos: number): void; - -/** - * Reads a 64 bit double from a buffer using little endian byte order. - * @name readDoubleLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ -export function readDoubleLE(buf: Uint8Array, pos: number): number; - -/** - * Reads a 64 bit double from a buffer using big endian byte order. - * @name readDoubleBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ -export function readDoubleBE(buf: Uint8Array, pos: number): number; diff --git a/node_modules/@protobufjs/float/index.js b/node_modules/@protobufjs/float/index.js deleted file mode 100644 index 52ba3aa2..00000000 --- a/node_modules/@protobufjs/float/index.js +++ /dev/null @@ -1,335 +0,0 @@ -"use strict"; - -module.exports = factory(factory); - -/** - * Reads / writes floats / doubles from / to buffers. - * @name util.float - * @namespace - */ - -/** - * Writes a 32 bit float to a buffer using little endian byte order. - * @name util.float.writeFloatLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 32 bit float to a buffer using big endian byte order. - * @name util.float.writeFloatBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 32 bit float from a buffer using little endian byte order. - * @name util.float.readFloatLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 32 bit float from a buffer using big endian byte order. - * @name util.float.readFloatBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Writes a 64 bit double to a buffer using little endian byte order. - * @name util.float.writeDoubleLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 64 bit double to a buffer using big endian byte order. - * @name util.float.writeDoubleBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 64 bit double from a buffer using little endian byte order. - * @name util.float.readDoubleLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 64 bit double from a buffer using big endian byte order. - * @name util.float.readDoubleBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -// Factory function for the purpose of node-based testing in modified global environments -function factory(exports) { - - // float: typed array - if (typeof Float32Array !== "undefined") (function() { - - var f32 = new Float32Array([ -0 ]), - f8b = new Uint8Array(f32.buffer), - le = f8b[3] === 128; - - function writeFloat_f32_cpy(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - } - - function writeFloat_f32_rev(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[3]; - buf[pos + 1] = f8b[2]; - buf[pos + 2] = f8b[1]; - buf[pos + 3] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; - /* istanbul ignore next */ - exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; - - function readFloat_f32_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - return f32[0]; - } - - function readFloat_f32_rev(buf, pos) { - f8b[3] = buf[pos ]; - f8b[2] = buf[pos + 1]; - f8b[1] = buf[pos + 2]; - f8b[0] = buf[pos + 3]; - return f32[0]; - } - - /* istanbul ignore next */ - exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; - /* istanbul ignore next */ - exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; - - // float: ieee754 - })(); else (function() { - - function writeFloat_ieee754(writeUint, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); - else if (isNaN(val)) - writeUint(2143289344, buf, pos); - else if (val > 3.4028234663852886e+38) // +-Infinity - writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); - else if (val < 1.1754943508222875e-38) // denormal - writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); - else { - var exponent = Math.floor(Math.log(val) / Math.LN2), - mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; - writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); - } - } - - exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); - exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); - - function readFloat_ieee754(readUint, buf, pos) { - var uint = readUint(buf, pos), - sign = (uint >> 31) * 2 + 1, - exponent = uint >>> 23 & 255, - mantissa = uint & 8388607; - return exponent === 255 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 1.401298464324817e-45 * mantissa - : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); - } - - exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); - exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); - - })(); - - // double: typed array - if (typeof Float64Array !== "undefined") (function() { - - var f64 = new Float64Array([-0]), - f8b = new Uint8Array(f64.buffer), - le = f8b[7] === 128; - - function writeDouble_f64_cpy(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - buf[pos + 4] = f8b[4]; - buf[pos + 5] = f8b[5]; - buf[pos + 6] = f8b[6]; - buf[pos + 7] = f8b[7]; - } - - function writeDouble_f64_rev(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[7]; - buf[pos + 1] = f8b[6]; - buf[pos + 2] = f8b[5]; - buf[pos + 3] = f8b[4]; - buf[pos + 4] = f8b[3]; - buf[pos + 5] = f8b[2]; - buf[pos + 6] = f8b[1]; - buf[pos + 7] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; - /* istanbul ignore next */ - exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; - - function readDouble_f64_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - f8b[4] = buf[pos + 4]; - f8b[5] = buf[pos + 5]; - f8b[6] = buf[pos + 6]; - f8b[7] = buf[pos + 7]; - return f64[0]; - } - - function readDouble_f64_rev(buf, pos) { - f8b[7] = buf[pos ]; - f8b[6] = buf[pos + 1]; - f8b[5] = buf[pos + 2]; - f8b[4] = buf[pos + 3]; - f8b[3] = buf[pos + 4]; - f8b[2] = buf[pos + 5]; - f8b[1] = buf[pos + 6]; - f8b[0] = buf[pos + 7]; - return f64[0]; - } - - /* istanbul ignore next */ - exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; - /* istanbul ignore next */ - exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; - - // double: ieee754 - })(); else (function() { - - function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) { - writeUint(0, buf, pos + off0); - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); - } else if (isNaN(val)) { - writeUint(0, buf, pos + off0); - writeUint(2146959360, buf, pos + off1); - } else if (val > 1.7976931348623157e+308) { // +-Infinity - writeUint(0, buf, pos + off0); - writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); - } else { - var mantissa; - if (val < 2.2250738585072014e-308) { // denormal - mantissa = val / 5e-324; - writeUint(mantissa >>> 0, buf, pos + off0); - writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); - } else { - var exponent = Math.floor(Math.log(val) / Math.LN2); - if (exponent === 1024) - exponent = 1023; - mantissa = val * Math.pow(2, -exponent); - writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); - writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); - } - } - } - - exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); - exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); - - function readDouble_ieee754(readUint, off0, off1, buf, pos) { - var lo = readUint(buf, pos + off0), - hi = readUint(buf, pos + off1); - var sign = (hi >> 31) * 2 + 1, - exponent = hi >>> 20 & 2047, - mantissa = 4294967296 * (hi & 1048575) + lo; - return exponent === 2047 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 5e-324 * mantissa - : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); - } - - exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); - exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); - - })(); - - return exports; -} - -// uint helpers - -function writeUintLE(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -function writeUintBE(val, buf, pos) { - buf[pos ] = val >>> 24; - buf[pos + 1] = val >>> 16 & 255; - buf[pos + 2] = val >>> 8 & 255; - buf[pos + 3] = val & 255; -} - -function readUintLE(buf, pos) { - return (buf[pos ] - | buf[pos + 1] << 8 - | buf[pos + 2] << 16 - | buf[pos + 3] << 24) >>> 0; -} - -function readUintBE(buf, pos) { - return (buf[pos ] << 24 - | buf[pos + 1] << 16 - | buf[pos + 2] << 8 - | buf[pos + 3]) >>> 0; -} diff --git a/node_modules/@protobufjs/float/package.json b/node_modules/@protobufjs/float/package.json deleted file mode 100644 index 5a887aca..00000000 --- a/node_modules/@protobufjs/float/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "_from": "@protobufjs/float@^1.0.2", - "_id": "@protobufjs/float@1.0.2", - "_inBundle": false, - "_integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=", - "_location": "/@protobufjs/float", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/float@^1.0.2", - "name": "@protobufjs/float", - "escapedName": "@protobufjs%2ffloat", - "scope": "@protobufjs", - "rawSpec": "^1.0.2", - "saveSpec": null, - "fetchSpec": "^1.0.2" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "_shasum": "5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1", - "_spec": "@protobufjs/float@^1.0.2", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Reads / writes floats / doubles from / to buffers in both modern and ancient browsers.", - "devDependencies": { - "benchmark": "^2.1.4", - "chalk": "^1.1.3", - "ieee754": "^1.1.8", - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/float", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "bench": "node bench", - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.0.2" -} diff --git a/node_modules/@protobufjs/float/tests/index.js b/node_modules/@protobufjs/float/tests/index.js deleted file mode 100644 index 62f08275..00000000 --- a/node_modules/@protobufjs/float/tests/index.js +++ /dev/null @@ -1,100 +0,0 @@ -var tape = require("tape"); - -var float = require(".."); - -tape.test("float", function(test) { - - // default - test.test(test.name + " - typed array", function(test) { - runTest(float, test); - }); - - // ieee754 - test.test(test.name + " - fallback", function(test) { - var F32 = global.Float32Array, - F64 = global.Float64Array; - delete global.Float32Array; - delete global.Float64Array; - runTest(float({}), test); - global.Float32Array = F32; - global.Float64Array = F64; - }); -}); - -function runTest(float, test) { - - var common = [ - 0, - -0, - Infinity, - -Infinity, - 0.125, - 1024.5, - -4096.5, - NaN - ]; - - test.test(test.name + " - using 32 bits", function(test) { - common.concat([ - 3.4028234663852886e+38, - 1.1754943508222875e-38, - 1.1754946310819804e-39 - ]) - .forEach(function(value) { - var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString(); - test.ok( - checkValue(value, 4, float.readFloatLE, float.writeFloatLE, Buffer.prototype.writeFloatLE), - "should write and read back " + strval + " (32 bit LE)" - ); - test.ok( - checkValue(value, 4, float.readFloatBE, float.writeFloatBE, Buffer.prototype.writeFloatBE), - "should write and read back " + strval + " (32 bit BE)" - ); - }); - test.end(); - }); - - test.test(test.name + " - using 64 bits", function(test) { - common.concat([ - 1.7976931348623157e+308, - 2.2250738585072014e-308, - 2.2250738585072014e-309 - ]) - .forEach(function(value) { - var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString(); - test.ok( - checkValue(value, 8, float.readDoubleLE, float.writeDoubleLE, Buffer.prototype.writeDoubleLE), - "should write and read back " + strval + " (64 bit LE)" - ); - test.ok( - checkValue(value, 8, float.readDoubleBE, float.writeDoubleBE, Buffer.prototype.writeDoubleBE), - "should write and read back " + strval + " (64 bit BE)" - ); - }); - test.end(); - }); - - test.end(); -} - -function checkValue(value, size, read, write, write_comp) { - var buffer = new Buffer(size); - write(value, buffer, 0); - var value_comp = read(buffer, 0); - var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString(); - if (value !== value) { - if (value_comp === value_comp) - return false; - } else if (value_comp !== value) - return false; - - var buffer_comp = new Buffer(size); - write_comp.call(buffer_comp, value, 0); - for (var i = 0; i < size; ++i) - if (buffer[i] !== buffer_comp[i]) { - console.error(">", buffer, buffer_comp); - return false; - } - - return true; -} \ No newline at end of file diff --git a/node_modules/@protobufjs/inquire/.npmignore b/node_modules/@protobufjs/inquire/.npmignore deleted file mode 100644 index c3fc82ec..00000000 --- a/node_modules/@protobufjs/inquire/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -npm-debug.* -node_modules/ -coverage/ diff --git a/node_modules/@protobufjs/inquire/LICENSE b/node_modules/@protobufjs/inquire/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/inquire/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/inquire/README.md b/node_modules/@protobufjs/inquire/README.md deleted file mode 100644 index 3eabd864..00000000 --- a/node_modules/@protobufjs/inquire/README.md +++ /dev/null @@ -1,13 +0,0 @@ -@protobufjs/inquire -=================== -[![npm](https://img.shields.io/npm/v/@protobufjs/inquire.svg)](https://www.npmjs.com/package/@protobufjs/inquire) - -Requires a module only if available and hides the require call from bundlers. - -API ---- - -* **inquire(moduleName: `string`): `?Object`**
- Requires a module only if available. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/inquire/index.d.ts b/node_modules/@protobufjs/inquire/index.d.ts deleted file mode 100644 index 1f5a865c..00000000 --- a/node_modules/@protobufjs/inquire/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export = inquire; - -/** - * Requires a module only if available. - * @memberof util - * @param {string} moduleName Module to require - * @returns {?Object} Required module if available and not empty, otherwise `null` - */ -declare function inquire(moduleName: string): Object; diff --git a/node_modules/@protobufjs/inquire/index.js b/node_modules/@protobufjs/inquire/index.js deleted file mode 100644 index 1a1f238a..00000000 --- a/node_modules/@protobufjs/inquire/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -module.exports = inquire; - -/** - * Requires a module only if available. - * @memberof util - * @param {string} moduleName Module to require - * @returns {?Object} Required module if available and not empty, otherwise `null` - */ -function inquire(moduleName) { - try { - var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval - if (mod && (mod.length || Object.keys(mod).length)) - return mod; - } catch (e) {} // eslint-disable-line no-empty - return null; -} diff --git a/node_modules/@protobufjs/inquire/package.json b/node_modules/@protobufjs/inquire/package.json deleted file mode 100644 index b893a987..00000000 --- a/node_modules/@protobufjs/inquire/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "_from": "@protobufjs/inquire@^1.1.0", - "_id": "@protobufjs/inquire@1.1.0", - "_inBundle": false, - "_integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=", - "_location": "/@protobufjs/inquire", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/inquire@^1.1.0", - "name": "@protobufjs/inquire", - "escapedName": "@protobufjs%2finquire", - "scope": "@protobufjs", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/@protobufjs/fetch", - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "_shasum": "ff200e3e7cf2429e2dcafc1140828e8cc638f089", - "_spec": "@protobufjs/inquire@^1.1.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Requires a module only if available and hides the require call from bundlers.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/inquire", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.0" -} diff --git a/node_modules/@protobufjs/inquire/tests/data/array.js b/node_modules/@protobufjs/inquire/tests/data/array.js deleted file mode 100644 index 0847b28b..00000000 --- a/node_modules/@protobufjs/inquire/tests/data/array.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = [1]; diff --git a/node_modules/@protobufjs/inquire/tests/data/emptyArray.js b/node_modules/@protobufjs/inquire/tests/data/emptyArray.js deleted file mode 100644 index e0a30c5d..00000000 --- a/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = []; diff --git a/node_modules/@protobufjs/inquire/tests/data/emptyObject.js b/node_modules/@protobufjs/inquire/tests/data/emptyObject.js deleted file mode 100644 index f053ebf7..00000000 --- a/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/node_modules/@protobufjs/inquire/tests/data/object.js b/node_modules/@protobufjs/inquire/tests/data/object.js deleted file mode 100644 index 3b75bcac..00000000 --- a/node_modules/@protobufjs/inquire/tests/data/object.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { a: 1 }; diff --git a/node_modules/@protobufjs/inquire/tests/index.js b/node_modules/@protobufjs/inquire/tests/index.js deleted file mode 100644 index 4a555ca2..00000000 --- a/node_modules/@protobufjs/inquire/tests/index.js +++ /dev/null @@ -1,20 +0,0 @@ -var tape = require("tape"); - -var inquire = require(".."); - -tape.test("inquire", function(test) { - - test.equal(inquire("buffer").Buffer, Buffer, "should be able to require \"buffer\""); - - test.equal(inquire("%invalid"), null, "should not be able to require \"%invalid\""); - - test.equal(inquire("./tests/data/emptyObject"), null, "should return null when requiring a module exporting an empty object"); - - test.equal(inquire("./tests/data/emptyArray"), null, "should return null when requiring a module exporting an empty array"); - - test.same(inquire("./tests/data/object"), { a: 1 }, "should return the object if a non-empty object"); - - test.same(inquire("./tests/data/array"), [ 1 ], "should return the module if a non-empty array"); - - test.end(); -}); diff --git a/node_modules/@protobufjs/path/LICENSE b/node_modules/@protobufjs/path/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/path/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/path/README.md b/node_modules/@protobufjs/path/README.md deleted file mode 100644 index 1c1a2ba2..00000000 --- a/node_modules/@protobufjs/path/README.md +++ /dev/null @@ -1,19 +0,0 @@ -@protobufjs/path -================ -[![npm](https://img.shields.io/npm/v/@protobufjs/path.svg)](https://www.npmjs.com/package/@protobufjs/path) - -A minimal path module to resolve Unix, Windows and URL paths alike. - -API ---- - -* **path.isAbsolute(path: `string`): `boolean`**
- Tests if the specified path is absolute. - -* **path.normalize(path: `string`): `string`**
- Normalizes the specified path. - -* **path.resolve(originPath: `string`, includePath: `string`, [alreadyNormalized=false: `boolean`]): `string`**
- Resolves the specified include path against the specified origin path. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/path/index.d.ts b/node_modules/@protobufjs/path/index.d.ts deleted file mode 100644 index b664d81f..00000000 --- a/node_modules/@protobufjs/path/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Tests if the specified path is absolute. - * @param {string} path Path to test - * @returns {boolean} `true` if path is absolute - */ -export function isAbsolute(path: string): boolean; - -/** - * Normalizes the specified path. - * @param {string} path Path to normalize - * @returns {string} Normalized path - */ -export function normalize(path: string): string; - -/** - * Resolves the specified include path against the specified origin path. - * @param {string} originPath Path to the origin file - * @param {string} includePath Include path relative to origin path - * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized - * @returns {string} Path to the include file - */ -export function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string; diff --git a/node_modules/@protobufjs/path/index.js b/node_modules/@protobufjs/path/index.js deleted file mode 100644 index 7c7fb723..00000000 --- a/node_modules/@protobufjs/path/index.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -/** - * A minimal path module to resolve Unix, Windows and URL paths alike. - * @memberof util - * @namespace - */ -var path = exports; - -var isAbsolute = -/** - * Tests if the specified path is absolute. - * @param {string} path Path to test - * @returns {boolean} `true` if path is absolute - */ -path.isAbsolute = function isAbsolute(path) { - return /^(?:\/|\w+:)/.test(path); -}; - -var normalize = -/** - * Normalizes the specified path. - * @param {string} path Path to normalize - * @returns {string} Normalized path - */ -path.normalize = function normalize(path) { - path = path.replace(/\\/g, "/") - .replace(/\/{2,}/g, "/"); - var parts = path.split("/"), - absolute = isAbsolute(path), - prefix = ""; - if (absolute) - prefix = parts.shift() + "/"; - for (var i = 0; i < parts.length;) { - if (parts[i] === "..") { - if (i > 0 && parts[i - 1] !== "..") - parts.splice(--i, 2); - else if (absolute) - parts.splice(i, 1); - else - ++i; - } else if (parts[i] === ".") - parts.splice(i, 1); - else - ++i; - } - return prefix + parts.join("/"); -}; - -/** - * Resolves the specified include path against the specified origin path. - * @param {string} originPath Path to the origin file - * @param {string} includePath Include path relative to origin path - * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized - * @returns {string} Path to the include file - */ -path.resolve = function resolve(originPath, includePath, alreadyNormalized) { - if (!alreadyNormalized) - includePath = normalize(includePath); - if (isAbsolute(includePath)) - return includePath; - if (!alreadyNormalized) - originPath = normalize(originPath); - return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; -}; diff --git a/node_modules/@protobufjs/path/package.json b/node_modules/@protobufjs/path/package.json deleted file mode 100644 index 5a9ff1e7..00000000 --- a/node_modules/@protobufjs/path/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "@protobufjs/path@^1.1.2", - "_id": "@protobufjs/path@1.1.2", - "_inBundle": false, - "_integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=", - "_location": "/@protobufjs/path", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/path@^1.1.2", - "name": "@protobufjs/path", - "escapedName": "@protobufjs%2fpath", - "scope": "@protobufjs", - "rawSpec": "^1.1.2", - "saveSpec": null, - "fetchSpec": "^1.1.2" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "_shasum": "6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d", - "_spec": "@protobufjs/path@^1.1.2", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A minimal path module to resolve Unix, Windows and URL paths alike.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/path", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.2" -} diff --git a/node_modules/@protobufjs/path/tests/index.js b/node_modules/@protobufjs/path/tests/index.js deleted file mode 100644 index 9c23bc96..00000000 --- a/node_modules/@protobufjs/path/tests/index.js +++ /dev/null @@ -1,60 +0,0 @@ -var tape = require("tape"); - -var path = require(".."); - -tape.test("path", function(test) { - - test.ok(path.isAbsolute("X:\\some\\path\\file.js"), "should identify absolute windows paths"); - test.ok(path.isAbsolute("/some/path/file.js"), "should identify absolute unix paths"); - - test.notOk(path.isAbsolute("some\\path\\file.js"), "should identify relative windows paths"); - test.notOk(path.isAbsolute("some/path/file.js"), "should identify relative unix paths"); - - var paths = [ - { - actual: "X:\\some\\..\\.\\path\\\\file.js", - normal: "X:/path/file.js", - resolve: { - origin: "X:/path/origin.js", - expected: "X:/path/file.js" - } - }, { - actual: "some\\..\\.\\path\\\\file.js", - normal: "path/file.js", - resolve: { - origin: "X:/path/origin.js", - expected: "X:/path/path/file.js" - } - }, { - actual: "/some/.././path//file.js", - normal: "/path/file.js", - resolve: { - origin: "/path/origin.js", - expected: "/path/file.js" - } - }, { - actual: "some/.././path//file.js", - normal: "path/file.js", - resolve: { - origin: "", - expected: "path/file.js" - } - }, { - actual: ".././path//file.js", - normal: "../path/file.js" - }, { - actual: "/.././path//file.js", - normal: "/path/file.js" - } - ]; - - paths.forEach(function(p) { - test.equal(path.normalize(p.actual), p.normal, "should normalize " + p.actual); - if (p.resolve) { - test.equal(path.resolve(p.resolve.origin, p.actual), p.resolve.expected, "should resolve " + p.actual); - test.equal(path.resolve(p.resolve.origin, p.normal, true), p.resolve.expected, "should resolve " + p.normal + " (already normalized)"); - } - }); - - test.end(); -}); diff --git a/node_modules/@protobufjs/pool/.npmignore b/node_modules/@protobufjs/pool/.npmignore deleted file mode 100644 index c3fc82ec..00000000 --- a/node_modules/@protobufjs/pool/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -npm-debug.* -node_modules/ -coverage/ diff --git a/node_modules/@protobufjs/pool/LICENSE b/node_modules/@protobufjs/pool/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/pool/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/pool/README.md b/node_modules/@protobufjs/pool/README.md deleted file mode 100644 index 9fb0e973..00000000 --- a/node_modules/@protobufjs/pool/README.md +++ /dev/null @@ -1,13 +0,0 @@ -@protobufjs/pool -================ -[![npm](https://img.shields.io/npm/v/@protobufjs/pool.svg)](https://www.npmjs.com/package/@protobufjs/pool) - -A general purpose buffer pool. - -API ---- - -* **pool(alloc: `function(size: number): Uint8Array`, slice: `function(this: Uint8Array, start: number, end: number): Uint8Array`, [size=8192: `number`]): `function(size: number): Uint8Array`**
- Creates a pooled allocator. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/pool/index.d.ts b/node_modules/@protobufjs/pool/index.d.ts deleted file mode 100644 index 23fe38c5..00000000 --- a/node_modules/@protobufjs/pool/index.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export = pool; - -/** - * An allocator as used by {@link util.pool}. - * @typedef PoolAllocator - * @type {function} - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ -type PoolAllocator = (size: number) => Uint8Array; - -/** - * A slicer as used by {@link util.pool}. - * @typedef PoolSlicer - * @type {function} - * @param {number} start Start offset - * @param {number} end End offset - * @returns {Uint8Array} Buffer slice - * @this {Uint8Array} - */ -type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array; - -/** - * A general purpose buffer pool. - * @memberof util - * @function - * @param {PoolAllocator} alloc Allocator - * @param {PoolSlicer} slice Slicer - * @param {number} [size=8192] Slab size - * @returns {PoolAllocator} Pooled allocator - */ -declare function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator; diff --git a/node_modules/@protobufjs/pool/index.js b/node_modules/@protobufjs/pool/index.js deleted file mode 100644 index 6c666f65..00000000 --- a/node_modules/@protobufjs/pool/index.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; -module.exports = pool; - -/** - * An allocator as used by {@link util.pool}. - * @typedef PoolAllocator - * @type {function} - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ - -/** - * A slicer as used by {@link util.pool}. - * @typedef PoolSlicer - * @type {function} - * @param {number} start Start offset - * @param {number} end End offset - * @returns {Uint8Array} Buffer slice - * @this {Uint8Array} - */ - -/** - * A general purpose buffer pool. - * @memberof util - * @function - * @param {PoolAllocator} alloc Allocator - * @param {PoolSlicer} slice Slicer - * @param {number} [size=8192] Slab size - * @returns {PoolAllocator} Pooled allocator - */ -function pool(alloc, slice, size) { - var SIZE = size || 8192; - var MAX = SIZE >>> 1; - var slab = null; - var offset = SIZE; - return function pool_alloc(size) { - if (size < 1 || size > MAX) - return alloc(size); - if (offset + size > SIZE) { - slab = alloc(SIZE); - offset = 0; - } - var buf = slice.call(slab, offset, offset += size); - if (offset & 7) // align to 32 bit - offset = (offset | 7) + 1; - return buf; - }; -} diff --git a/node_modules/@protobufjs/pool/package.json b/node_modules/@protobufjs/pool/package.json deleted file mode 100644 index 3ed8f0f5..00000000 --- a/node_modules/@protobufjs/pool/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "@protobufjs/pool@^1.1.0", - "_id": "@protobufjs/pool@1.1.0", - "_inBundle": false, - "_integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=", - "_location": "/@protobufjs/pool", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/pool@^1.1.0", - "name": "@protobufjs/pool", - "escapedName": "@protobufjs%2fpool", - "scope": "@protobufjs", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "_shasum": "09fd15f2d6d3abfa9b65bc366506d6ad7846ff54", - "_spec": "@protobufjs/pool@^1.1.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A general purpose buffer pool.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/pool", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.0" -} diff --git a/node_modules/@protobufjs/pool/tests/index.js b/node_modules/@protobufjs/pool/tests/index.js deleted file mode 100644 index 5d1a921f..00000000 --- a/node_modules/@protobufjs/pool/tests/index.js +++ /dev/null @@ -1,33 +0,0 @@ -var tape = require("tape"); - -var pool = require(".."); - -if (typeof Uint8Array !== "undefined") -tape.test("pool", function(test) { - - var alloc = pool(function(size) { return new Uint8Array(size); }, Uint8Array.prototype.subarray); - - var buf1 = alloc(0); - test.equal(buf1.length, 0, "should allocate a buffer of size 0"); - - var buf2 = alloc(1); - test.equal(buf2.length, 1, "should allocate a buffer of size 1 (initializes slab)"); - - test.notEqual(buf2.buffer, buf1.buffer, "should not reference the same backing buffer if previous buffer had size 0"); - test.equal(buf2.byteOffset, 0, "should allocate at byteOffset 0 when using a new slab"); - - buf1 = alloc(1); - test.equal(buf1.buffer, buf2.buffer, "should reference the same backing buffer when allocating a chunk fitting into the slab"); - test.equal(buf1.byteOffset, 8, "should align slices to 32 bit and this allocate at byteOffset 8"); - - var buf3 = alloc(4097); - test.notEqual(buf3.buffer, buf2.buffer, "should not reference the same backing buffer when allocating a buffer larger than half the backing buffer's size"); - - buf2 = alloc(4096); - test.equal(buf2.buffer, buf1.buffer, "should reference the same backing buffer when allocating a buffer smaller or equal than half the backing buffer's size"); - - buf1 = alloc(4096); - test.notEqual(buf1.buffer, buf2.buffer, "should not reference the same backing buffer when the slab is exhausted (initializes new slab)"); - - test.end(); -}); \ No newline at end of file diff --git a/node_modules/@protobufjs/utf8/.npmignore b/node_modules/@protobufjs/utf8/.npmignore deleted file mode 100644 index c3fc82ec..00000000 --- a/node_modules/@protobufjs/utf8/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -npm-debug.* -node_modules/ -coverage/ diff --git a/node_modules/@protobufjs/utf8/LICENSE b/node_modules/@protobufjs/utf8/LICENSE deleted file mode 100644 index be2b397e..00000000 --- a/node_modules/@protobufjs/utf8/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@protobufjs/utf8/README.md b/node_modules/@protobufjs/utf8/README.md deleted file mode 100644 index c936d9b0..00000000 --- a/node_modules/@protobufjs/utf8/README.md +++ /dev/null @@ -1,20 +0,0 @@ -@protobufjs/utf8 -================ -[![npm](https://img.shields.io/npm/v/@protobufjs/utf8.svg)](https://www.npmjs.com/package/@protobufjs/utf8) - -A minimal UTF8 implementation for number arrays. - -API ---- - -* **utf8.length(string: `string`): `number`**
- Calculates the UTF8 byte length of a string. - -* **utf8.read(buffer: `Uint8Array`, start: `number`, end: `number`): `string`**
- Reads UTF8 bytes as a string. - -* **utf8.write(string: `string`, buffer: `Uint8Array`, offset: `number`): `number`**
- Writes a string as UTF8 bytes. - - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/@protobufjs/utf8/index.d.ts b/node_modules/@protobufjs/utf8/index.d.ts deleted file mode 100644 index 2f1d0ab1..00000000 --- a/node_modules/@protobufjs/utf8/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Calculates the UTF8 byte length of a string. - * @param {string} string String - * @returns {number} Byte length - */ -export function length(string: string): number; - -/** - * Reads UTF8 bytes as a string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} String read - */ -export function read(buffer: Uint8Array, start: number, end: number): string; - -/** - * Writes a string as UTF8 bytes. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Bytes written - */ -export function write(string: string, buffer: Uint8Array, offset: number): number; diff --git a/node_modules/@protobufjs/utf8/index.js b/node_modules/@protobufjs/utf8/index.js deleted file mode 100644 index 43c52981..00000000 --- a/node_modules/@protobufjs/utf8/index.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; - -/** - * A minimal UTF8 implementation for number arrays. - * @memberof util - * @namespace - */ -var utf8 = exports; - -/** - * Calculates the UTF8 byte length of a string. - * @param {string} string String - * @returns {number} Byte length - */ -utf8.length = function utf8_length(string) { - var len = 0, - c = 0; - for (var i = 0; i < string.length; ++i) { - c = string.charCodeAt(i); - if (c < 128) - len += 1; - else if (c < 2048) - len += 2; - else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { - ++i; - len += 4; - } else - len += 3; - } - return len; -}; - -/** - * Reads UTF8 bytes as a string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} String read - */ -utf8.read = function utf8_read(buffer, start, end) { - var len = end - start; - if (len < 1) - return ""; - var parts = null, - chunk = [], - i = 0, // char offset - t; // temporary - while (start < end) { - t = buffer[start++]; - if (t < 128) - chunk[i++] = t; - else if (t > 191 && t < 224) - chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; - else if (t > 239 && t < 365) { - t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; - chunk[i++] = 0xD800 + (t >> 10); - chunk[i++] = 0xDC00 + (t & 1023); - } else - chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -/** - * Writes a string as UTF8 bytes. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Bytes written - */ -utf8.write = function utf8_write(string, buffer, offset) { - var start = offset, - c1, // character 1 - c2; // character 2 - for (var i = 0; i < string.length; ++i) { - c1 = string.charCodeAt(i); - if (c1 < 128) { - buffer[offset++] = c1; - } else if (c1 < 2048) { - buffer[offset++] = c1 >> 6 | 192; - buffer[offset++] = c1 & 63 | 128; - } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - ++i; - buffer[offset++] = c1 >> 18 | 240; - buffer[offset++] = c1 >> 12 & 63 | 128; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } else { - buffer[offset++] = c1 >> 12 | 224; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } - } - return offset - start; -}; diff --git a/node_modules/@protobufjs/utf8/package.json b/node_modules/@protobufjs/utf8/package.json deleted file mode 100644 index 7865d87f..00000000 --- a/node_modules/@protobufjs/utf8/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "@protobufjs/utf8@^1.1.0", - "_id": "@protobufjs/utf8@1.1.0", - "_inBundle": false, - "_integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", - "_location": "/@protobufjs/utf8", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@protobufjs/utf8@^1.1.0", - "name": "@protobufjs/utf8", - "escapedName": "@protobufjs%2futf8", - "scope": "@protobufjs", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "_shasum": "a777360b5b39a1a2e5106f8e858f2fd2d060c570", - "_spec": "@protobufjs/utf8@^1.1.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A minimal UTF8 implementation for number arrays.", - "devDependencies": { - "istanbul": "^0.4.5", - "tape": "^4.6.3" - }, - "homepage": "https://github.com/dcodeIO/protobuf.js#readme", - "license": "BSD-3-Clause", - "main": "index.js", - "name": "@protobufjs/utf8", - "repository": { - "type": "git", - "url": "git+https://github.com/dcodeIO/protobuf.js.git" - }, - "scripts": { - "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", - "test": "tape tests/*.js" - }, - "types": "index.d.ts", - "version": "1.1.0" -} diff --git a/node_modules/@protobufjs/utf8/tests/data/utf8.txt b/node_modules/@protobufjs/utf8/tests/data/utf8.txt deleted file mode 100644 index 580b4c4e..00000000 --- a/node_modules/@protobufjs/utf8/tests/data/utf8.txt +++ /dev/null @@ -1,216 +0,0 @@ -UTF-8 encoded sample plain-text file -‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -Markus Kuhn [ˈmaʳkʊs kuːn] — 2002-07-25 CC BY - - -The ASCII compatible UTF-8 encoding used in this plain-text file -is defined in Unicode, ISO 10646-1, and RFC 2279. - - -Using Unicode/UTF-8, you can write in emails and source code things such as - -Mathematics and sciences: - - ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫ - ⎪⎢⎜│a²+b³ ⎟⎥⎪ - ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪ - ⎪⎢⎜⎷ c₈ ⎟⎥⎪ - ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬ - ⎪⎢⎜ ∞ ⎟⎥⎪ - ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪ - ⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪ - 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭ - -Linguistics and dictionaries: - - ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn - Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ] - -APL: - - ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈ - -Nicer typography in plain text files: - - ╔══════════════════════════════════════════╗ - ║ ║ - ║ • ‘single’ and “double” quotes ║ - ║ ║ - ║ • Curly apostrophes: “We’ve been here” ║ - ║ ║ - ║ • Latin-1 apostrophe and accents: '´` ║ - ║ ║ - ║ • ‚deutsche‘ „Anführungszeichen“ ║ - ║ ║ - ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║ - ║ ║ - ║ • ASCII safety test: 1lI|, 0OD, 8B ║ - ║ ╭─────────╮ ║ - ║ • the euro symbol: │ 14.95 € │ ║ - ║ ╰─────────╯ ║ - ╚══════════════════════════════════════════╝ - -Combining characters: - - STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑ - -Greek (in Polytonic): - - The Greek anthem: - - Σὲ γνωρίζω ἀπὸ τὴν κόψη - τοῦ σπαθιοῦ τὴν τρομερή, - σὲ γνωρίζω ἀπὸ τὴν ὄψη - ποὺ μὲ βία μετράει τὴ γῆ. - - ᾿Απ᾿ τὰ κόκκαλα βγαλμένη - τῶν ῾Ελλήνων τὰ ἱερά - καὶ σὰν πρῶτα ἀνδρειωμένη - χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά! - - From a speech of Demosthenes in the 4th century BC: - - Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι, - ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς - λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ - τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿ - εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ - πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν - οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι, - οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν - ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον - τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι - γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν - προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους - σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ - τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ - τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς - τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον. - - Δημοσθένους, Γ´ ᾿Ολυνθιακὸς - -Georgian: - - From a Unicode conference invitation: - - გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო - კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს, - ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს - ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი, - ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება - ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში, - ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში. - -Russian: - - From a Unicode conference invitation: - - Зарегистрируйтесь сейчас на Десятую Международную Конференцию по - Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии. - Конференция соберет широкий круг экспертов по вопросам глобального - Интернета и Unicode, локализации и интернационализации, воплощению и - применению Unicode в различных операционных системах и программных - приложениях, шрифтах, верстке и многоязычных компьютерных системах. - -Thai (UCS Level 2): - - Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese - classic 'San Gua'): - - [----------------------------|------------------------] - ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่ - สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา - ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา - โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ - เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ - ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ - พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้ - ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ - - (The above is a two-column text. If combining characters are handled - correctly, the lines of the second column should be aligned with the - | character above.) - -Ethiopian: - - Proverbs in the Amharic language: - - ሰማይ አይታረስ ንጉሥ አይከሰስ። - ብላ ካለኝ እንደአባቴ በቆመጠኝ። - ጌጥ ያለቤቱ ቁምጥና ነው። - ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው። - የአፍ ወለምታ በቅቤ አይታሽም። - አይጥ በበላ ዳዋ ተመታ። - ሲተረጉሙ ይደረግሙ። - ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል። - ድር ቢያብር አንበሳ ያስር። - ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም። - እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም። - የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ። - ሥራ ከመፍታት ልጄን ላፋታት። - ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል። - የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ። - ተንጋሎ ቢተፉ ተመልሶ ባፉ። - ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው። - እግርህን በፍራሽህ ልክ ዘርጋ። - -Runes: - - ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ - - (Old English, which transcribed into Latin reads 'He cwaeth that he - bude thaem lande northweardum with tha Westsae.' and means 'He said - that he lived in the northern land near the Western Sea.') - -Braille: - - ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌ - - ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞ - ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎ - ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂ - ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙ - ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑ - ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲ - - ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ - - ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹ - ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞ - ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕ - ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹ - ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎ - ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎ - ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳ - ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞ - ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ - - (The first couple of paragraphs of "A Christmas Carol" by Dickens) - -Compact font selection example text: - - ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789 - abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ - –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд - ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა - -Greetings in various languages: - - Hello world, Καλημέρα κόσμε, コンニチハ - -Box drawing alignment tests: █ - ▉ - ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳ - ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳ - ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳ - ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳ - ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎ - ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏ - ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█ - ▝▀▘▙▄▟ - -Surrogates: - -𠜎 𠜱 𠝹 𠱓 𠱸 𠲖 𠳏 𠳕 𠴕 𠵼 𠵿 𠸎 𠸏 𠹷 𠺝 𠺢 𠻗 𠻹 𠻺 𠼭 𠼮 𠽌 𠾴 𠾼 𠿪 𡁜 𡁯 𡁵 𡁶 𡁻 𡃁 -𡃉 𡇙 𢃇 𢞵 𢫕 𢭃 𢯊 𢱑 𢱕 𢳂 𢴈 𢵌 𢵧 𢺳 𣲷 𤓓 𤶸 𤷪 𥄫 𦉘 𦟌 𦧲 𦧺 𧨾 𨅝 𨈇 𨋢 𨳊 𨳍 𨳒 𩶘 diff --git a/node_modules/@protobufjs/utf8/tests/index.js b/node_modules/@protobufjs/utf8/tests/index.js deleted file mode 100644 index 16d169e0..00000000 --- a/node_modules/@protobufjs/utf8/tests/index.js +++ /dev/null @@ -1,57 +0,0 @@ -var tape = require("tape"); - -var utf8 = require(".."); - -var data = require("fs").readFileSync(require.resolve("./data/utf8.txt")), - dataStr = data.toString("utf8"); - -tape.test("utf8", function(test) { - - test.test(test.name + " - length", function(test) { - test.equal(utf8.length(""), 0, "should return a byte length of zero for an empty string"); - - test.equal(utf8.length(dataStr), Buffer.byteLength(dataStr), "should return the same byte length as node buffers"); - - test.end(); - }); - - test.test(test.name + " - read", function(test) { - var comp = utf8.read([], 0, 0); - test.equal(comp, "", "should decode an empty buffer to an empty string"); - - comp = utf8.read(data, 0, data.length); - test.equal(comp, data.toString("utf8"), "should decode to the same byte data as node buffers"); - - var longData = Buffer.concat([data, data, data, data]); - comp = utf8.read(longData, 0, longData.length); - test.equal(comp, longData.toString("utf8"), "should decode to the same byte data as node buffers (long)"); - - var chunkData = new Buffer(data.toString("utf8").substring(0, 8192)); - comp = utf8.read(chunkData, 0, chunkData.length); - test.equal(comp, chunkData.toString("utf8"), "should decode to the same byte data as node buffers (chunk size)"); - - test.end(); - }); - - test.test(test.name + " - write", function(test) { - var buf = new Buffer(0); - test.equal(utf8.write("", buf, 0), 0, "should encode an empty string to an empty buffer"); - - var len = utf8.length(dataStr); - buf = new Buffer(len); - test.equal(utf8.write(dataStr, buf, 0), len, "should encode to exactly " + len + " bytes"); - - test.equal(buf.length, data.length, "should encode to a buffer length equal to that of node buffers"); - - for (var i = 0; i < buf.length; ++i) { - if (buf[i] !== data[i]) { - test.fail("should encode to the same buffer data as node buffers (offset " + i + ")"); - return; - } - } - test.pass("should encode to the same buffer data as node buffers"); - - test.end(); - }); - -}); diff --git a/node_modules/@types/long/LICENSE b/node_modules/@types/long/LICENSE deleted file mode 100644 index 21071075..00000000 --- a/node_modules/@types/long/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - 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 diff --git a/node_modules/@types/long/README.md b/node_modules/@types/long/README.md deleted file mode 100644 index df7297cb..00000000 --- a/node_modules/@types/long/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/long` - -# Summary -This package contains type definitions for long.js (https://github.com/dcodeIO/long.js). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/long. - -### Additional Details - * Last updated: Wed, 22 Jan 2020 19:19:46 GMT - * Dependencies: none - * Global values: `Long` - -# Credits -These definitions were written by Peter Kooijmans (https://github.com/peterkooijmans). diff --git a/node_modules/@types/long/index.d.ts b/node_modules/@types/long/index.d.ts deleted file mode 100644 index 39f8ab50..00000000 --- a/node_modules/@types/long/index.d.ts +++ /dev/null @@ -1,389 +0,0 @@ -// Type definitions for long.js 4.0.0 -// Project: https://github.com/dcodeIO/long.js -// Definitions by: Peter Kooijmans -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Definitions by: Denis Cappellin - -export = Long; -export as namespace Long; - -declare const Long: Long.LongConstructor; -type Long = Long.Long; -declare namespace Long { - interface LongConstructor { - /** - * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. - */ - new( low: number, high?: number, unsigned?: boolean ): Long; - prototype: Long; - /** - * Maximum unsigned value. - */ - MAX_UNSIGNED_VALUE: Long; - - /** - * Maximum signed value. - */ - MAX_VALUE: Long; - - /** - * Minimum signed value. - */ - MIN_VALUE: Long; - - /** - * Signed negative one. - */ - NEG_ONE: Long; - - /** - * Signed one. - */ - ONE: Long; - - /** - * Unsigned one. - */ - UONE: Long; - - /** - * Unsigned zero. - */ - UZERO: Long; - - /** - * Signed zero - */ - ZERO: Long; - - /** - * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. - */ - fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long; - - /** - * Returns a Long representing the given 32 bit integer value. - */ - fromInt( value: number, unsigned?: boolean ): Long; - - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - */ - fromNumber( value: number, unsigned?: boolean ): Long; - - /** - * Returns a Long representation of the given string, written using the specified radix. - */ - fromString( str: string, unsigned?: boolean | number, radix?: number ): Long; - - /** - * Creates a Long from its byte representation. - */ - fromBytes( bytes: number[], unsigned?: boolean, le?: boolean ): Long; - - /** - * Creates a Long from its little endian byte representation. - */ - fromBytesLE( bytes: number[], unsigned?: boolean ): Long; - - /** - * Creates a Long from its little endian byte representation. - */ - fromBytesBE( bytes: number[], unsigned?: boolean ): Long; - - /** - * Tests if the specified object is a Long. - */ - isLong( obj: any ): obj is Long; - - /** - * Converts the specified value to a Long. - */ - fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long; - } - interface Long - { - /** - * The high 32 bits as a signed value. - */ - high: number; - - /** - * The low 32 bits as a signed value. - */ - low: number; - - /** - * Whether unsigned or not. - */ - unsigned: boolean; - - /** - * Returns the sum of this and the specified Long. - */ - add( addend: number | Long | string ): Long; - - /** - * Returns the bitwise AND of this Long and the specified. - */ - and( other: Long | number | string ): Long; - - /** - * Compares this Long's value with the specified's. - */ - compare( other: Long | number | string ): number; - - /** - * Compares this Long's value with the specified's. - */ - comp( other: Long | number | string ): number; - - /** - * Returns this Long divided by the specified. - */ - divide( divisor: Long | number | string ): Long; - - /** - * Returns this Long divided by the specified. - */ - div( divisor: Long | number | string ): Long; - - /** - * Tests if this Long's value equals the specified's. - */ - equals( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value equals the specified's. - */ - eq( other: Long | number | string ): boolean; - - /** - * Gets the high 32 bits as a signed integer. - */ - getHighBits(): number; - - /** - * Gets the high 32 bits as an unsigned integer. - */ - getHighBitsUnsigned(): number; - - /** - * Gets the low 32 bits as a signed integer. - */ - getLowBits(): number; - - /** - * Gets the low 32 bits as an unsigned integer. - */ - getLowBitsUnsigned(): number; - - /** - * Gets the number of bits needed to represent the absolute value of this Long. - */ - getNumBitsAbs(): number; - - /** - * Tests if this Long's value is greater than the specified's. - */ - greaterThan( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than the specified's. - */ - gt( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - greaterThanOrEqual( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - gte( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is even. - */ - isEven(): boolean; - - /** - * Tests if this Long's value is negative. - */ - isNegative(): boolean; - - /** - * Tests if this Long's value is odd. - */ - isOdd(): boolean; - - /** - * Tests if this Long's value is positive. - */ - isPositive(): boolean; - - /** - * Tests if this Long's value equals zero. - */ - isZero(): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lessThan( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lt( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lessThanOrEqual( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lte( other: Long | number | string ): boolean; - - /** - * Returns this Long modulo the specified. - */ - modulo( other: Long | number | string ): Long; - - /** - * Returns this Long modulo the specified. - */ - mod( other: Long | number | string ): Long; - - /** - * Returns the product of this and the specified Long. - */ - multiply( multiplier: Long | number | string ): Long; - - /** - * Returns the product of this and the specified Long. - */ - mul( multiplier: Long | number | string ): Long; - - /** - * Negates this Long's value. - */ - negate(): Long; - - /** - * Negates this Long's value. - */ - neg(): Long; - - /** - * Returns the bitwise NOT of this Long. - */ - not(): Long; - - /** - * Tests if this Long's value differs from the specified's. - */ - notEquals( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value differs from the specified's. - */ - neq( other: Long | number | string ): boolean; - - /** - * Returns the bitwise OR of this Long and the specified. - */ - or( other: Long | number | string ): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shiftLeft( numBits: number | Long ): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shl( numBits: number | Long ): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shiftRight( numBits: number | Long ): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shr( numBits: number | Long ): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shiftRightUnsigned( numBits: number | Long ): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shru( numBits: number | Long ): Long; - - /** - * Returns the difference of this and the specified Long. - */ - subtract( subtrahend: number | Long | string ): Long; - - /** - * Returns the difference of this and the specified Long. - */ - sub( subtrahend: number | Long |string ): Long; - - /** - * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. - */ - toInt(): number; - - /** - * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). - */ - toNumber(): number; - - /** - * Converts this Long to its byte representation. - */ - - toBytes( le?: boolean ): number[]; - - /** - * Converts this Long to its little endian byte representation. - */ - - toBytesLE(): number[]; - - /** - * Converts this Long to its big endian byte representation. - */ - - toBytesBE(): number[]; - - /** - * Converts this Long to signed. - */ - toSigned(): Long; - - /** - * Converts the Long to a string written in the specified radix. - */ - toString( radix?: number ): string; - - /** - * Converts this Long to unsigned. - */ - toUnsigned(): Long; - - /** - * Returns the bitwise XOR of this Long and the given one. - */ - xor( other: Long | number | string ): Long; - } -} diff --git a/node_modules/@types/long/package.json b/node_modules/@types/long/package.json deleted file mode 100644 index 6192336c..00000000 --- a/node_modules/@types/long/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "_from": "@types/long@^4.0.1", - "_id": "@types/long@4.0.1", - "_inBundle": false, - "_integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==", - "_location": "/@types/long", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/long@^4.0.1", - "name": "@types/long", - "escapedName": "@types%2flong", - "scope": "@types", - "rawSpec": "^4.0.1", - "saveSpec": null, - "fetchSpec": "^4.0.1" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", - "_shasum": "459c65fa1867dafe6a8f322c4c51695663cc55e9", - "_spec": "@types/long@^4.0.1", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Peter Kooijmans", - "url": "https://github.com/peterkooijmans" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for long.js", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/long", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/long" - }, - "scripts": {}, - "typeScriptVersion": "2.8", - "types": "index.d.ts", - "typesPublisherContentHash": "5a2ae1424989c49d7303e1f5cc510288bfab1e71e0e2143cdcb9d24ff1c3dc8e", - "version": "4.0.1" -} diff --git a/node_modules/@types/node/LICENSE b/node_modules/@types/node/LICENSE deleted file mode 100644 index 9e841e7a..00000000 --- a/node_modules/@types/node/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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 diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md deleted file mode 100644 index 69850c76..00000000 --- a/node_modules/@types/node/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/node` - -# Summary -This package contains type definitions for Node.js (http://nodejs.org/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. - -### Additional Details - * Last updated: Mon, 09 Nov 2020 19:41:27 GMT - * Dependencies: none - * Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout` - -# Credits -These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), and [Victor Perin](https://github.com/victorperin). diff --git a/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts deleted file mode 100644 index 94fcb73c..00000000 --- a/node_modules/@types/node/assert.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -declare module 'assert' { - /** An alias of `assert.ok()`. */ - function assert(value: any, message?: string | Error): asserts value; - namespace assert { - class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - code: 'ERR_ASSERTION'; - - constructor(options?: { - /** If provided, the error message is set to this value. */ - message?: string; - /** The `actual` property on the error instance. */ - actual?: any; - /** The `expected` property on the error instance. */ - expected?: any; - /** The `operator` property on the error instance. */ - operator?: string; - /** If provided, the generated stack trace omits frames before this function. */ - stackStartFn?: Function; - }); - } - - class CallTracker { - calls(exact?: number): () => void; - calls any>(fn?: Func, exact?: number): Func; - report(): CallTrackerReportInformation[]; - verify(): void; - } - interface CallTrackerReportInformation { - message: string; - /** The actual number of times the function was called. */ - actual: number; - /** The number of times the function was expected to be called. */ - expected: number; - /** The name of the function that is wrapped. */ - operator: string; - /** A stack trace of the function. */ - stack: object; - } - - type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error; - - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: any, - expected: any, - message?: string | Error, - operator?: string, - stackStartFn?: Function, - ): never; - function ok(value: any, message?: string | Error): asserts value; - /** @deprecated since v9.9.0 - use strictEqual() instead. */ - function equal(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notStrictEqual() instead. */ - function notEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */ - function deepEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */ - function notDeepEqual(actual: any, expected: any, message?: string | Error): void; - function strictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - function notStrictEqual(actual: any, expected: any, message?: string | Error): void; - function deepStrictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; - - function throws(block: () => any, message?: string | Error): void; - function throws(block: () => any, error: AssertPredicate, message?: string | Error): void; - function doesNotThrow(block: () => any, message?: string | Error): void; - function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void; - - function ifError(value: any): asserts value is null | undefined; - - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: RegExp | Function, - message?: string | Error, - ): Promise; - - function match(value: string, regExp: RegExp, message?: string | Error): void; - function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; - - const strict: Omit< - typeof assert, - | 'strict' - | 'deepEqual' - | 'notDeepEqual' - | 'equal' - | 'notEqual' - | 'ok' - | 'strictEqual' - | 'deepStrictEqual' - | 'ifError' - > & { - (value: any, message?: string | Error): asserts value; - strict: typeof strict; - deepEqual: typeof deepStrictEqual; - notDeepEqual: typeof notDeepStrictEqual; - equal: typeof strictEqual; - notEqual: typeof notStrictEqual; - ok(value: any, message?: string | Error): asserts value; - strictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - deepStrictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - ifError(value: any): asserts value is null | undefined; - }; - } - - export = assert; -} diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts deleted file mode 100644 index ab35e5db..00000000 --- a/node_modules/@types/node/async_hooks.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Async Hooks module: https://nodejs.org/api/async_hooks.html - */ -declare module "async_hooks" { - /** - * Returns the asyncId of the current execution context. - */ - function executionAsyncId(): number; - - /** - * The resource representing the current execution. - * Useful to store data within the resource. - * - * Resource objects returned by `executionAsyncResource()` are most often internal - * Node.js handle objects with undocumented APIs. Using any functions or properties - * on the object is likely to crash your application and should be avoided. - * - * Using `executionAsyncResource()` in the top-level execution context will - * return an empty object as there is no handle or request object to use, - * but having an object representing the top-level can be helpful. - */ - function executionAsyncResource(): object; - - /** - * Returns the ID of the resource responsible for calling the callback that is currently being executed. - */ - function triggerAsyncId(): number; - - interface HookCallbacks { - /** - * Called when a class is constructed that has the possibility to emit an asynchronous event. - * @param asyncId a unique ID for the async resource - * @param type the type of the async resource - * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created - * @param resource reference to the resource representing the async operation, needs to be released during destroy - */ - init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; - - /** - * When an asynchronous operation is initiated or completes a callback is called to notify the user. - * The before callback is called just before said callback is executed. - * @param asyncId the unique identifier assigned to the resource about to execute the callback. - */ - before?(asyncId: number): void; - - /** - * Called immediately after the callback specified in before is completed. - * @param asyncId the unique identifier assigned to the resource which has executed the callback. - */ - after?(asyncId: number): void; - - /** - * Called when a promise has resolve() called. This may not be in the same execution id - * as the promise itself. - * @param asyncId the unique id for the promise that was resolve()d. - */ - promiseResolve?(asyncId: number): void; - - /** - * Called after the resource corresponding to asyncId is destroyed - * @param asyncId a unique ID for the async resource - */ - destroy?(asyncId: number): void; - } - - interface AsyncHook { - /** - * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. - */ - enable(): this; - - /** - * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. - */ - disable(): this; - } - - /** - * Registers functions to be called for different lifetime events of each async operation. - * @param options the callbacks to register - * @return an AsyncHooks instance used for disabling and enabling hooks - */ - function createHook(options: HookCallbacks): AsyncHook; - - interface AsyncResourceOptions { - /** - * The ID of the execution context that created this async event. - * Default: `executionAsyncId()` - */ - triggerAsyncId?: number; - - /** - * Disables automatic `emitDestroy` when the object is garbage collected. - * This usually does not need to be set (even if `emitDestroy` is called - * manually), unless the resource's `asyncId` is retrieved and the - * sensitive API's `emitDestroy` is called with it. - * Default: `false` - */ - requireManualDestroy?: boolean; - } - - /** - * The class AsyncResource was designed to be extended by the embedder's async resources. - * Using this users can easily trigger the lifetime events of their own resources. - */ - class AsyncResource { - /** - * AsyncResource() is meant to be extended. Instantiating a - * new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * async_hook.executionAsyncId() is used. - * @param type The type of async event. - * @param triggerAsyncId The ID of the execution context that created - * this async event (default: `executionAsyncId()`), or an - * AsyncResourceOptions object (since 9.3) - */ - constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); - - /** - * Binds the given function to the current execution context. - * @param fn The function to bind to the current execution context. - * @param type An optional name to associate with the underlying `AsyncResource`. - */ - static bind any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource }; - - /** - * Binds the given function to execute to this `AsyncResource`'s scope. - * @param fn The function to bind to the current `AsyncResource`. - */ - bind any>(fn: Func): Func & { asyncResource: AsyncResource }; - - /** - * Call the provided function with the provided arguments in the - * execution context of the async resource. This will establish the - * context, trigger the AsyncHooks before callbacks, call the function, - * trigger the AsyncHooks after callbacks, and then restore the original - * execution context. - * @param fn The function to call in the execution context of this - * async resource. - * @param thisArg The receiver to be used for the function call. - * @param args Optional arguments to pass to the function. - */ - runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; - - /** - * Call AsyncHooks destroy callbacks. - */ - emitDestroy(): void; - - /** - * @return the unique ID assigned to this AsyncResource instance. - */ - asyncId(): number; - - /** - * @return the trigger ID for this AsyncResource instance. - */ - triggerAsyncId(): number; - } - - /** - * When having multiple instances of `AsyncLocalStorage`, they are independent - * from each other. It is safe to instantiate this class multiple times. - */ - class AsyncLocalStorage { - /** - * This method disables the instance of `AsyncLocalStorage`. All subsequent calls - * to `asyncLocalStorage.getStore()` will return `undefined` until - * `asyncLocalStorage.run()` is called again. - * - * When calling `asyncLocalStorage.disable()`, all current contexts linked to the - * instance will be exited. - * - * Calling `asyncLocalStorage.disable()` is required before the - * `asyncLocalStorage` can be garbage collected. This does not apply to stores - * provided by the `asyncLocalStorage`, as those objects are garbage collected - * along with the corresponding async resources. - * - * This method is to be used when the `asyncLocalStorage` is not in use anymore - * in the current process. - */ - disable(): void; - - /** - * This method returns the current store. If this method is called outside of an - * asynchronous context initialized by calling `asyncLocalStorage.run`, it will - * return `undefined`. - */ - getStore(): T | undefined; - - /** - * This methods runs a function synchronously within a context and return its - * return value. The store is not accessible outside of the callback function or - * the asynchronous operations created within the callback. - * - * Optionally, arguments can be passed to the function. They will be passed to the - * callback function. - * - * I the callback function throws an error, it will be thrown by `run` too. The - * stacktrace will not be impacted by this call and the context will be exited. - */ - // TODO: Apply generic vararg once available - run(store: T, callback: (...args: any[]) => R, ...args: any[]): R; - - /** - * This methods runs a function synchronously outside of a context and return its - * return value. The store is not accessible within the callback function or the - * asynchronous operations created within the callback. - * - * Optionally, arguments can be passed to the function. They will be passed to the - * callback function. - * - * If the callback function throws an error, it will be thrown by `exit` too. The - * stacktrace will not be impacted by this call and the context will be - * re-entered. - */ - // TODO: Apply generic vararg once available - exit(callback: (...args: any[]) => R, ...args: any[]): R; - - /** - * Calling `asyncLocalStorage.enterWith(store)` will transition into the context - * for the remainder of the current synchronous execution and will persist - * through any following asynchronous calls. - */ - enterWith(store: T): void; - } -} diff --git a/node_modules/@types/node/base.d.ts b/node_modules/@types/node/base.d.ts deleted file mode 100644 index fa671790..00000000 --- a/node_modules/@types/node/base.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.7. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7 -// - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// - -// TypeScript 3.7-specific augmentations: -/// diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts deleted file mode 100644 index 76c92cf8..00000000 --- a/node_modules/@types/node/buffer.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module "buffer" { - export const INSPECT_MAX_BYTES: number; - export const kMaxLength: number; - export const kStringMaxLength: number; - export const constants: { - MAX_LENGTH: number; - MAX_STRING_LENGTH: number; - }; - const BuffType: typeof Buffer; - - export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary"; - - export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; - - export const SlowBuffer: { - /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */ - new(size: number): Buffer; - prototype: Buffer; - }; - - export { BuffType as Buffer }; -} diff --git a/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts deleted file mode 100644 index b53e91e7..00000000 --- a/node_modules/@types/node/child_process.d.ts +++ /dev/null @@ -1,509 +0,0 @@ -declare module "child_process" { - import { BaseEncodingOptions } from 'fs'; - import * as events from "events"; - import * as net from "net"; - import { Writable, Readable, Stream, Pipe } from "stream"; - - type Serializable = string | object | number | boolean; - type SendHandle = net.Socket | net.Server; - - interface ChildProcess extends events.EventEmitter { - stdin: Writable | null; - stdout: Readable | null; - stderr: Readable | null; - readonly channel?: Pipe | null; - readonly stdio: [ - Writable | null, // stdin - Readable | null, // stdout - Readable | null, // stderr - Readable | Writable | null | undefined, // extra - Readable | Writable | null | undefined // extra - ]; - readonly killed: boolean; - readonly pid: number; - readonly connected: boolean; - readonly exitCode: number | null; - readonly signalCode: NodeJS.Signals | null; - readonly spawnargs: string[]; - readonly spawnfile: string; - kill(signal?: NodeJS.Signals | number): boolean; - send(message: Serializable, callback?: (error: Error | null) => void): boolean; - send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; - send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean; - disconnect(): void; - unref(): void; - ref(): void; - - /** - * events.EventEmitter - * 1. close - * 2. disconnect - * 3. error - * 4. exit - * 5. message - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", code: number, signal: NodeJS.Signals): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - } - - // return this object when stdio option is undefined or not specified - interface ChildProcessWithoutNullStreams extends ChildProcess { - stdin: Writable; - stdout: Readable; - stderr: Readable; - readonly stdio: [ - Writable, // stdin - Readable, // stdout - Readable, // stderr - Readable | Writable | null | undefined, // extra, no modification - Readable | Writable | null | undefined // extra, no modification - ]; - } - - // return this object when stdio option is a tuple of 3 - interface ChildProcessByStdio< - I extends null | Writable, - O extends null | Readable, - E extends null | Readable, - > extends ChildProcess { - stdin: I; - stdout: O; - stderr: E; - readonly stdio: [ - I, - O, - E, - Readable | Writable | null | undefined, // extra, no modification - Readable | Writable | null | undefined // extra, no modification - ]; - } - - interface MessageOptions { - keepOpen?: boolean; - } - - type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>; - - type SerializationType = 'json' | 'advanced'; - - interface MessagingOptions { - /** - * Specify the kind of serialization used for sending messages between processes. - * @default 'json' - */ - serialization?: SerializationType; - } - - interface ProcessEnvOptions { - uid?: number; - gid?: number; - cwd?: string; - env?: NodeJS.ProcessEnv; - } - - interface CommonOptions extends ProcessEnvOptions { - /** - * @default true - */ - windowsHide?: boolean; - /** - * @default 0 - */ - timeout?: number; - } - - interface CommonSpawnOptions extends CommonOptions, MessagingOptions { - argv0?: string; - stdio?: StdioOptions; - shell?: boolean | string; - windowsVerbatimArguments?: boolean; - } - - interface SpawnOptions extends CommonSpawnOptions { - detached?: boolean; - } - - interface SpawnOptionsWithoutStdio extends SpawnOptions { - stdio?: 'pipe' | Array; - } - - type StdioNull = 'inherit' | 'ignore' | Stream; - type StdioPipe = undefined | null | 'pipe'; - - interface SpawnOptionsWithStdioTuple< - Stdin extends StdioNull | StdioPipe, - Stdout extends StdioNull | StdioPipe, - Stderr extends StdioNull | StdioPipe, - > extends SpawnOptions { - stdio: [Stdin, Stdout, Stderr]; - } - - // overloads of spawn without 'args' - function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - - function spawn(command: string, options: SpawnOptions): ChildProcess; - - // overloads of spawn with 'args' - function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - - function spawn(command: string, args: ReadonlyArray, options: SpawnOptions): ChildProcess; - - interface ExecOptions extends CommonOptions { - shell?: string; - maxBuffer?: number; - killSignal?: NodeJS.Signals | number; - } - - interface ExecOptionsWithStringEncoding extends ExecOptions { - encoding: BufferEncoding; - } - - interface ExecOptionsWithBufferEncoding extends ExecOptions { - encoding: BufferEncoding | null; // specify `null`. - } - - interface ExecException extends Error { - cmd?: string; - killed?: boolean; - code?: number; - signal?: NodeJS.Signals; - } - - // no `options` definitely means stdout/stderr are `string`. - function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function exec( - command: string, - options: { encoding: BufferEncoding } & ExecOptions, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function exec( - command: string, - options: (BaseEncodingOptions & ExecOptions) | undefined | null, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - - interface PromiseWithChild extends Promise { - child: ChildProcess; - } - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace exec { - function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - } - - interface ExecFileOptions extends CommonOptions { - maxBuffer?: number; - killSignal?: NodeJS.Signals | number; - windowsVerbatimArguments?: boolean; - shell?: boolean | string; - } - interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { - encoding: 'buffer' | null; - } - interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - - function execFile(file: string): ChildProcess; - function execFile(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess; - function execFile(file: string, args?: ReadonlyArray | null): ChildProcess; - function execFile(file: string, args: ReadonlyArray | undefined | null, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess; - - // no `options` definitely means stdout/stderr are `string`. - function execFile(file: string, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithStringEncoding, - callback: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function execFile( - file: string, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function execFile(file: string, options: ExecFileOptions, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptions, - callback: (error: ExecException | null, stdout: string, stderr: string) => void - ): ChildProcess; - - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function execFile( - file: string, - options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, - callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, - ): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, - callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, - ): ChildProcess; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace execFile { - function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__( - file: string, - args: ReadonlyArray | undefined | null, - options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, - ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - } - - interface ForkOptions extends ProcessEnvOptions, MessagingOptions { - execPath?: string; - execArgv?: string[]; - silent?: boolean; - stdio?: StdioOptions; - detached?: boolean; - windowsVerbatimArguments?: boolean; - } - function fork(modulePath: string, options?: ForkOptions): ChildProcess; - function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; - - interface SpawnSyncOptions extends CommonSpawnOptions { - input?: string | NodeJS.ArrayBufferView; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: BufferEncoding | 'buffer' | null; - } - interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { - encoding: BufferEncoding; - } - interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { - encoding?: 'buffer' | null; - } - interface SpawnSyncReturns { - pid: number; - output: string[]; - stdout: T; - stderr: T; - status: number | null; - signal: NodeJS.Signals | null; - error?: Error; - } - function spawnSync(command: string): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns; - - interface ExecSyncOptions extends CommonOptions { - input?: string | Uint8Array; - stdio?: StdioOptions; - shell?: string; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: BufferEncoding | 'buffer' | null; - } - interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { - encoding: BufferEncoding; - } - interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { - encoding?: 'buffer' | null; - } - function execSync(command: string): Buffer; - function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string; - function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer; - function execSync(command: string, options?: ExecSyncOptions): Buffer; - - interface ExecFileSyncOptions extends CommonOptions { - input?: string | NodeJS.ArrayBufferView; - stdio?: StdioOptions; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: BufferEncoding; - shell?: boolean | string; - } - interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { - encoding: BufferEncoding; - } - interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { - encoding: BufferEncoding; // specify `null`. - } - function execFileSync(command: string): Buffer; - function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): Buffer; -} diff --git a/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts deleted file mode 100644 index 0ef6c2a0..00000000 --- a/node_modules/@types/node/cluster.d.ts +++ /dev/null @@ -1,262 +0,0 @@ -declare module "cluster" { - import * as child from "child_process"; - import * as events from "events"; - import * as net from "net"; - - // interfaces - interface ClusterSettings { - execArgv?: string[]; // default: process.execArgv - exec?: string; - args?: string[]; - silent?: boolean; - stdio?: any[]; - uid?: number; - gid?: number; - inspectPort?: number | (() => number); - } - - interface Address { - address: string; - port: number; - addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6" - } - - class Worker extends events.EventEmitter { - id: number; - process: child.ChildProcess; - send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean; - kill(signal?: string): void; - destroy(signal?: string): void; - disconnect(): void; - isConnected(): boolean; - isDead(): boolean; - exitedAfterDisconnect: boolean; - - /** - * events.EventEmitter - * 1. disconnect - * 2. error - * 3. exit - * 4. listening - * 5. message - * 6. online - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "exit", listener: (code: number, signal: string) => void): this; - addListener(event: "listening", listener: (address: Address) => void): this; - addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "exit", code: number, signal: string): boolean; - emit(event: "listening", address: Address): boolean; - emit(event: "message", message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "exit", listener: (code: number, signal: string) => void): this; - on(event: "listening", listener: (address: Address) => void): this; - on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "exit", listener: (code: number, signal: string) => void): this; - once(event: "listening", listener: (address: Address) => void): this; - once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependListener(event: "listening", listener: (address: Address) => void): this; - prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependOnceListener(event: "listening", listener: (address: Address) => void): this; - prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "online", listener: () => void): this; - } - - interface Cluster extends events.EventEmitter { - Worker: Worker; - disconnect(callback?: () => void): void; - fork(env?: any): Worker; - isMaster: boolean; - isWorker: boolean; - schedulingPolicy: number; - settings: ClusterSettings; - setupMaster(settings?: ClusterSettings): void; - worker?: Worker; - workers?: NodeJS.Dict; - - readonly SCHED_NONE: number; - readonly SCHED_RR: number; - - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: (worker: Worker) => void): this; - addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - addListener(event: "fork", listener: (worker: Worker) => void): this; - addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: (worker: Worker) => void): this; - addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect", worker: Worker): boolean; - emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - emit(event: "fork", worker: Worker): boolean; - emit(event: "listening", worker: Worker, address: Address): boolean; - emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online", worker: Worker): boolean; - emit(event: "setup", settings: ClusterSettings): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: (worker: Worker) => void): this; - on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - on(event: "fork", listener: (worker: Worker) => void): this; - on(event: "listening", listener: (worker: Worker, address: Address) => void): this; - on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: (worker: Worker) => void): this; - on(event: "setup", listener: (settings: ClusterSettings) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: (worker: Worker) => void): this; - once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - once(event: "fork", listener: (worker: Worker) => void): this; - once(event: "listening", listener: (worker: Worker, address: Address) => void): this; - once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: (worker: Worker) => void): this; - once(event: "setup", listener: (settings: ClusterSettings) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependListener(event: "fork", listener: (worker: Worker) => void): this; - prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: (worker: Worker) => void): this; - prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependOnceListener(event: "fork", listener: (worker: Worker) => void): this; - prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; - prependOnceListener(event: "online", listener: (worker: Worker) => void): this; - prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - } - - const SCHED_NONE: number; - const SCHED_RR: number; - - function disconnect(callback?: () => void): void; - function fork(env?: any): Worker; - const isMaster: boolean; - const isWorker: boolean; - let schedulingPolicy: number; - const settings: ClusterSettings; - function setupMaster(settings?: ClusterSettings): void; - const worker: Worker; - const workers: NodeJS.Dict; - - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - function addListener(event: string, listener: (...args: any[]) => void): Cluster; - function addListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function addListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function addListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function addListener(event: "online", listener: (worker: Worker) => void): Cluster; - function addListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function emit(event: string | symbol, ...args: any[]): boolean; - function emit(event: "disconnect", worker: Worker): boolean; - function emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - function emit(event: "fork", worker: Worker): boolean; - function emit(event: "listening", worker: Worker, address: Address): boolean; - function emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - function emit(event: "online", worker: Worker): boolean; - function emit(event: "setup", settings: ClusterSettings): boolean; - - function on(event: string, listener: (...args: any[]) => void): Cluster; - function on(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function on(event: "fork", listener: (worker: Worker) => void): Cluster; - function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. - function on(event: "online", listener: (worker: Worker) => void): Cluster; - function on(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function once(event: string, listener: (...args: any[]) => void): Cluster; - function once(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function once(event: "fork", listener: (worker: Worker) => void): Cluster; - function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. - function once(event: "online", listener: (worker: Worker) => void): Cluster; - function once(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function removeListener(event: string, listener: (...args: any[]) => void): Cluster; - function removeAllListeners(event?: string): Cluster; - function setMaxListeners(n: number): Cluster; - function getMaxListeners(): number; - function listeners(event: string): Function[]; - function listenerCount(type: string): number; - - function prependListener(event: string, listener: (...args: any[]) => void): Cluster; - function prependListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function prependListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function prependListener(event: "online", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function prependOnceListener(event: string, listener: (...args: any[]) => void): Cluster; - function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function prependOnceListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function eventNames(): string[]; -} diff --git a/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts deleted file mode 100644 index 178beb45..00000000 --- a/node_modules/@types/node/console.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -declare module "console" { - import { InspectOptions } from 'util'; - - global { - // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build - interface Console { - Console: NodeJS.ConsoleConstructor; - /** - * A simple assertion test that verifies whether `value` is truthy. - * If it is not, an `AssertionError` is thrown. - * If provided, the error `message` is formatted using `util.format()` and used as the error message. - */ - assert(value: any, message?: string, ...optionalParams: any[]): void; - /** - * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY. - * When `stdout` is not a TTY, this method does nothing. - */ - clear(): void; - /** - * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`. - */ - count(label?: string): void; - /** - * Resets the internal counter specific to `label`. - */ - countReset(label?: string): void; - /** - * The `console.debug()` function is an alias for {@link console.log()}. - */ - debug(message?: any, ...optionalParams: any[]): void; - /** - * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`. - * This function bypasses any custom `inspect()` function defined on `obj`. - */ - dir(obj: any, options?: InspectOptions): void; - /** - * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting - */ - dirxml(...data: any[]): void; - /** - * Prints to `stderr` with newline. - */ - error(message?: any, ...optionalParams: any[]): void; - /** - * Increases indentation of subsequent lines by two spaces. - * If one or more `label`s are provided, those are printed first without the additional indentation. - */ - group(...label: any[]): void; - /** - * The `console.groupCollapsed()` function is an alias for {@link console.group()}. - */ - groupCollapsed(...label: any[]): void; - /** - * Decreases indentation of subsequent lines by two spaces. - */ - groupEnd(): void; - /** - * The {@link console.info()} function is an alias for {@link console.log()}. - */ - info(message?: any, ...optionalParams: any[]): void; - /** - * Prints to `stdout` with newline. - */ - log(message?: any, ...optionalParams: any[]): void; - /** - * This method does not display anything unless used in the inspector. - * Prints to `stdout` the array `array` formatted as a table. - */ - table(tabularData: any, properties?: ReadonlyArray): void; - /** - * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`. - */ - time(label?: string): void; - /** - * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`. - */ - timeEnd(label?: string): void; - /** - * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`. - */ - timeLog(label?: string, ...data: any[]): void; - /** - * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code. - */ - trace(message?: any, ...optionalParams: any[]): void; - /** - * The {@link console.warn()} function is an alias for {@link console.error()}. - */ - warn(message?: any, ...optionalParams: any[]): void; - - // --- Inspector mode only --- - /** - * This method does not display anything unless used in the inspector. - * Starts a JavaScript CPU profile with an optional label. - */ - profile(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. - */ - profileEnd(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Adds an event with the label `label` to the Timeline panel of the inspector. - */ - timeStamp(label?: string): void; - } - - var console: Console; - - namespace NodeJS { - interface ConsoleConstructorOptions { - stdout: WritableStream; - stderr?: WritableStream; - ignoreErrors?: boolean; - colorMode?: boolean | 'auto'; - inspectOptions?: InspectOptions; - } - - interface ConsoleConstructor { - prototype: Console; - new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console; - new(options: ConsoleConstructorOptions): Console; - } - - interface Global { - console: typeof console; - } - } - } - - export = console; -} diff --git a/node_modules/@types/node/constants.d.ts b/node_modules/@types/node/constants.d.ts deleted file mode 100644 index d124ae66..00000000 --- a/node_modules/@types/node/constants.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ -declare module "constants" { - import { constants as osConstants, SignalConstants } from 'os'; - import { constants as cryptoConstants } from 'crypto'; - import { constants as fsConstants } from 'fs'; - const exp: typeof osConstants.errno & typeof osConstants.priority & SignalConstants & typeof cryptoConstants & typeof fsConstants; - export = exp; -} diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts deleted file mode 100644 index 17660cf5..00000000 --- a/node_modules/@types/node/crypto.d.ts +++ /dev/null @@ -1,775 +0,0 @@ -declare module "crypto" { - import * as stream from "stream"; - - interface Certificate { - exportChallenge(spkac: BinaryLike): Buffer; - exportPublicKey(spkac: BinaryLike): Buffer; - verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - } - const Certificate: { - new(): Certificate; - (): Certificate; - }; - - namespace constants { // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants - const OPENSSL_VERSION_NUMBER: number; - - /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ - const SSL_OP_ALL: number; - /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_CIPHER_SERVER_PREFERENCE: number; - /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */ - const SSL_OP_CISCO_ANYCONNECT: number; - /** Instructs OpenSSL to turn on cookie exchange. */ - const SSL_OP_COOKIE_EXCHANGE: number; - /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ - const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ - const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - /** Instructs OpenSSL to always use the tmp_rsa key when performing RSA operations. */ - const SSL_OP_EPHEMERAL_RSA: number; - /** Allows initial connection to servers that do not support RI. */ - const SSL_OP_LEGACY_SERVER_CONNECT: number; - const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; - const SSL_OP_MICROSOFT_SESS_ID_BUG: number; - /** Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. */ - const SSL_OP_MSIE_SSLV2_RSA_PADDING: number; - const SSL_OP_NETSCAPE_CA_DN_BUG: number; - const SSL_OP_NETSCAPE_CHALLENGE_BUG: number; - const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; - const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; - /** Instructs OpenSSL to disable support for SSL/TLS compression. */ - const SSL_OP_NO_COMPRESSION: number; - const SSL_OP_NO_QUERY_MTU: number; - /** Instructs OpenSSL to always start a new session when performing renegotiation. */ - const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - const SSL_OP_NO_SSLv2: number; - const SSL_OP_NO_SSLv3: number; - const SSL_OP_NO_TICKET: number; - const SSL_OP_NO_TLSv1: number; - const SSL_OP_NO_TLSv1_1: number; - const SSL_OP_NO_TLSv1_2: number; - const SSL_OP_PKCS1_CHECK_1: number; - const SSL_OP_PKCS1_CHECK_2: number; - /** Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. */ - const SSL_OP_SINGLE_DH_USE: number; - /** Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. */ - const SSL_OP_SINGLE_ECDH_USE: number; - const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; - const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; - const SSL_OP_TLS_BLOCK_PADDING_BUG: number; - const SSL_OP_TLS_D5_BUG: number; - /** Instructs OpenSSL to disable version rollback attack detection. */ - const SSL_OP_TLS_ROLLBACK_BUG: number; - - const ENGINE_METHOD_RSA: number; - const ENGINE_METHOD_DSA: number; - const ENGINE_METHOD_DH: number; - const ENGINE_METHOD_RAND: number; - const ENGINE_METHOD_EC: number; - const ENGINE_METHOD_CIPHERS: number; - const ENGINE_METHOD_DIGESTS: number; - const ENGINE_METHOD_PKEY_METHS: number; - const ENGINE_METHOD_PKEY_ASN1_METHS: number; - const ENGINE_METHOD_ALL: number; - const ENGINE_METHOD_NONE: number; - - const DH_CHECK_P_NOT_SAFE_PRIME: number; - const DH_CHECK_P_NOT_PRIME: number; - const DH_UNABLE_TO_CHECK_GENERATOR: number; - const DH_NOT_SUITABLE_GENERATOR: number; - - const ALPN_ENABLED: number; - - const RSA_PKCS1_PADDING: number; - const RSA_SSLV23_PADDING: number; - const RSA_NO_PADDING: number; - const RSA_PKCS1_OAEP_PADDING: number; - const RSA_X931_PADDING: number; - const RSA_PKCS1_PSS_PADDING: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ - const RSA_PSS_SALTLEN_DIGEST: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ - const RSA_PSS_SALTLEN_MAX_SIGN: number; - /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ - const RSA_PSS_SALTLEN_AUTO: number; - - const POINT_CONVERSION_COMPRESSED: number; - const POINT_CONVERSION_UNCOMPRESSED: number; - const POINT_CONVERSION_HYBRID: number; - - /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ - const defaultCoreCipherList: string; - /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ - const defaultCipherList: string; - } - - interface HashOptions extends stream.TransformOptions { - /** - * For XOF hash functions such as `shake256`, the - * outputLength option can be used to specify the desired output length in bytes. - */ - outputLength?: number; - } - - /** @deprecated since v10.0.0 */ - const fips: boolean; - - function createHash(algorithm: string, options?: HashOptions): Hash; - function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; - - type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1"; - type HexBase64Latin1Encoding = "latin1" | "hex" | "base64"; - type Utf8AsciiBinaryEncoding = "utf8" | "ascii" | "binary"; - type HexBase64BinaryEncoding = "binary" | "base64" | "hex"; - type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; - - class Hash extends stream.Transform { - private constructor(); - copy(): Hash; - update(data: BinaryLike): Hash; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash; - digest(): Buffer; - digest(encoding: HexBase64Latin1Encoding): string; - } - class Hmac extends stream.Transform { - private constructor(); - update(data: BinaryLike): Hmac; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac; - digest(): Buffer; - digest(encoding: HexBase64Latin1Encoding): string; - } - - type KeyObjectType = 'secret' | 'public' | 'private'; - - interface KeyExportOptions { - type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1'; - format: T; - cipher?: string; - passphrase?: string | Buffer; - } - - class KeyObject { - private constructor(); - asymmetricKeyType?: KeyType; - /** - * For asymmetric keys, this property represents the size of the embedded key in - * bytes. This property is `undefined` for symmetric keys. - */ - asymmetricKeySize?: number; - export(options: KeyExportOptions<'pem'>): string | Buffer; - export(options?: KeyExportOptions<'der'>): Buffer; - symmetricKeySize?: number; - type: KeyObjectType; - } - - type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305'; - type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm'; - - type BinaryLike = string | NodeJS.ArrayBufferView; - - type CipherKey = BinaryLike | KeyObject; - - interface CipherCCMOptions extends stream.TransformOptions { - authTagLength: number; - } - interface CipherGCMOptions extends stream.TransformOptions { - authTagLength?: number; - } - /** @deprecated since v10.0.0 use `createCipheriv()` */ - function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; - /** @deprecated since v10.0.0 use `createCipheriv()` */ - function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM; - /** @deprecated since v10.0.0 use `createCipheriv()` */ - function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher; - - function createCipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options: CipherCCMOptions - ): CipherCCM; - function createCipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options?: CipherGCMOptions - ): CipherGCM; - function createCipheriv( - algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions - ): Cipher; - - class Cipher extends stream.Transform { - private constructor(); - update(data: BinaryLike): Buffer; - update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer; - update(data: NodeJS.ArrayBufferView, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string; - update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string; - final(): Buffer; - final(output_encoding: BufferEncoding): string; - setAutoPadding(auto_padding?: boolean): this; - // getAuthTag(): Buffer; - // setAAD(buffer: NodeJS.ArrayBufferView): this; - } - interface CipherCCM extends Cipher { - setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this; - getAuthTag(): Buffer; - } - interface CipherGCM extends Cipher { - setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this; - getAuthTag(): Buffer; - } - /** @deprecated since v10.0.0 use `createDecipheriv()` */ - function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; - /** @deprecated since v10.0.0 use `createDecipheriv()` */ - function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; - /** @deprecated since v10.0.0 use `createDecipheriv()` */ - function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; - - function createDecipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options: CipherCCMOptions, - ): DecipherCCM; - function createDecipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options?: CipherGCMOptions, - ): DecipherGCM; - function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher; - - class Decipher extends stream.Transform { - private constructor(); - update(data: NodeJS.ArrayBufferView): Buffer; - update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer; - update(data: NodeJS.ArrayBufferView, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string; - update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string; - final(): Buffer; - final(output_encoding: BufferEncoding): string; - setAutoPadding(auto_padding?: boolean): this; - // setAuthTag(tag: NodeJS.ArrayBufferView): this; - // setAAD(buffer: NodeJS.ArrayBufferView): this; - } - interface DecipherCCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this; - } - interface DecipherGCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this; - } - - interface PrivateKeyInput { - key: string | Buffer; - format?: KeyFormat; - type?: 'pkcs1' | 'pkcs8' | 'sec1'; - passphrase?: string | Buffer; - } - - interface PublicKeyInput { - key: string | Buffer; - format?: KeyFormat; - type?: 'pkcs1' | 'spki'; - } - - function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject; - function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject; - function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; - - function createSign(algorithm: string, options?: stream.WritableOptions): Signer; - - type DSAEncoding = 'der' | 'ieee-p1363'; - - interface SigningOptions { - /** - * @See crypto.constants.RSA_PKCS1_PADDING - */ - padding?: number; - saltLength?: number; - dsaEncoding?: DSAEncoding; - } - - interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions { - } - interface SignKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions { - } - interface VerifyKeyObjectInput extends SigningOptions { - key: KeyObject; - } - - type KeyLike = string | Buffer | KeyObject; - - class Signer extends stream.Writable { - private constructor(); - - update(data: BinaryLike): Signer; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; - sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, output_format: HexBase64Latin1Encoding): string; - } - - function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; - class Verify extends stream.Writable { - private constructor(); - - update(data: BinaryLike): Verify; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify; - verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean; - verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: HexBase64Latin1Encoding): boolean; - // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format - // The signature field accepts a TypedArray type, but it is only available starting ES2017 - } - function createDiffieHellman(prime_length: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman; - class DiffieHellman { - private constructor(); - generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; - computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; - getPrime(): Buffer; - getPrime(encoding: HexBase64Latin1Encoding): string; - getGenerator(): Buffer; - getGenerator(encoding: HexBase64Latin1Encoding): string; - getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: HexBase64Latin1Encoding): string; - setPublicKey(public_key: NodeJS.ArrayBufferView): void; - setPublicKey(public_key: string, encoding: BufferEncoding): void; - setPrivateKey(private_key: NodeJS.ArrayBufferView): void; - setPrivateKey(private_key: string, encoding: BufferEncoding): void; - verifyError: number; - } - function getDiffieHellman(group_name: string): DiffieHellman; - function pbkdf2( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - callback: (err: Error | null, derivedKey: Buffer) => any, - ): void; - function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer; - - function randomBytes(size: number): Buffer; - function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - function pseudoRandomBytes(size: number): Buffer; - function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - - function randomInt(max: number): number; - function randomInt(min: number, max: number): number; - function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; - function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; - - function randomFillSync(buffer: T, offset?: number, size?: number): T; - function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void; - function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void; - function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void; - - interface ScryptOptions { - N?: number; - r?: number; - p?: number; - maxmem?: number; - } - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - options: ScryptOptions, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; - - interface RsaPublicKey { - key: KeyLike; - padding?: number; - } - interface RsaPrivateKey { - key: KeyLike; - passphrase?: string; - /** - * @default 'sha1' - */ - oaepHash?: string; - oaepLabel?: NodeJS.TypedArray; - padding?: number; - } - function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function getCiphers(): string[]; - function getCurves(): string[]; - function getFips(): 1 | 0; - function getHashes(): string[]; - class ECDH { - private constructor(); - static convertKey( - key: BinaryLike, - curve: string, - inputEncoding?: HexBase64Latin1Encoding, - outputEncoding?: "latin1" | "hex" | "base64", - format?: "uncompressed" | "compressed" | "hybrid", - ): Buffer | string; - generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; - computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; - computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: HexBase64Latin1Encoding): string; - getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; - setPrivateKey(private_key: NodeJS.ArrayBufferView): void; - setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void; - } - function createECDH(curve_name: string): ECDH; - function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; - /** @deprecated since v10.0.0 */ - const DEFAULT_ENCODING: BufferEncoding; - - type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; - type KeyFormat = 'pem' | 'der'; - - interface BasePrivateKeyEncodingOptions { - format: T; - cipher?: string; - passphrase?: string; - } - - interface KeyPairKeyObjectResult { - publicKey: KeyObject; - privateKey: KeyObject; - } - - interface ED25519KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface ED448KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface X25519KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface X448KeyPairKeyObjectOptions { - /** - * No options. - */ - } - - interface ECKeyPairKeyObjectOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - } - - interface RSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - - /** - * @default 0x10001 - */ - publicExponent?: number; - } - - interface DSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - - /** - * Size of q in bits - */ - divisorLength: number; - } - - interface RSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * @default 0x10001 - */ - publicExponent?: number; - - publicKeyEncoding: { - type: 'pkcs1' | 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs1' | 'pkcs8'; - }; - } - - interface DSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface ECKeyPairOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - - publicKeyEncoding: { - type: 'pkcs1' | 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'sec1' | 'pkcs8'; - }; - } - - interface ED25519KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface ED448KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface X25519KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface X448KeyPairOptions { - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface KeyPairSyncResult { - publicKey: T1; - privateKey: T2; - } - - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - namespace generateKeyPair { - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "x25519", options?: X25519KeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; - } - - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been - * passed to [`crypto.createPrivateKey()`][]. - */ - function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; - - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been - * passed to [`crypto.createPublicKey()`][]. - */ - function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean; - - /** - * Computes the Diffie-Hellman secret based on a privateKey and a publicKey. - * Both keys must have the same asymmetricKeyType, which must be one of - * 'dh' (for Diffie-Hellman), 'ec' (for ECDH), 'x448', or 'x25519' (for ECDH-ES). - */ - function diffieHellman(options: { - privateKey: KeyObject; - publicKey: KeyObject - }): Buffer; -} diff --git a/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts deleted file mode 100644 index 73f2aa71..00000000 --- a/node_modules/@types/node/dgram.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -declare module "dgram" { - import { AddressInfo } from "net"; - import * as dns from "dns"; - import * as events from "events"; - - interface RemoteInfo { - address: string; - family: 'IPv4' | 'IPv6'; - port: number; - size: number; - } - - interface BindOptions { - port?: number; - address?: string; - exclusive?: boolean; - fd?: number; - } - - type SocketType = "udp4" | "udp6"; - - interface SocketOptions { - type: SocketType; - reuseAddr?: boolean; - /** - * @default false - */ - ipv6Only?: boolean; - recvBufferSize?: number; - sendBufferSize?: number; - lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; - } - - function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - - class Socket extends events.EventEmitter { - addMembership(multicastAddress: string, multicastInterface?: string): void; - address(): AddressInfo; - bind(port?: number, address?: string, callback?: () => void): void; - bind(port?: number, callback?: () => void): void; - bind(callback?: () => void): void; - bind(options: BindOptions, callback?: () => void): void; - close(callback?: () => void): void; - connect(port: number, address?: string, callback?: () => void): void; - connect(port: number, callback: () => void): void; - disconnect(): void; - dropMembership(multicastAddress: string, multicastInterface?: string): void; - getRecvBufferSize(): number; - getSendBufferSize(): number; - ref(): this; - remoteAddress(): AddressInfo; - send(msg: string | Uint8Array | ReadonlyArray, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array | ReadonlyArray, port?: number, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array | ReadonlyArray, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void; - setBroadcast(flag: boolean): void; - setMulticastInterface(multicastInterface: string): void; - setMulticastLoopback(flag: boolean): void; - setMulticastTTL(ttl: number): void; - setRecvBufferSize(size: number): void; - setSendBufferSize(size: number): void; - setTTL(ttl: number): void; - unref(): this; - /** - * Tells the kernel to join a source-specific multicast channel at the given - * `sourceAddress` and `groupAddress`, using the `multicastInterface` with the - * `IP_ADD_SOURCE_MEMBERSHIP` socket option. - * If the `multicastInterface` argument - * is not specified, the operating system will choose one interface and will add - * membership to it. - * To add membership to every available interface, call - * `socket.addSourceSpecificMembership()` multiple times, once per interface. - */ - addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - - /** - * Instructs the kernel to leave a source-specific multicast channel at the given - * `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` - * socket option. This method is automatically called by the kernel when the - * socket is closed or the process terminates, so most apps will never have - * reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - */ - dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. error - * 4. listening - * 5. message - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - } -} diff --git a/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts deleted file mode 100644 index 8ce88644..00000000 --- a/node_modules/@types/node/dns.d.ts +++ /dev/null @@ -1,371 +0,0 @@ -declare module "dns" { - // Supported getaddrinfo flags. - const ADDRCONFIG: number; - const V4MAPPED: number; - /** - * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as - * well as IPv4 mapped IPv6 addresses. - */ - const ALL: number; - - interface LookupOptions { - family?: number; - hints?: number; - all?: boolean; - verbatim?: boolean; - } - - interface LookupOneOptions extends LookupOptions { - all?: false; - } - - interface LookupAllOptions extends LookupOptions { - all: true; - } - - interface LookupAddress { - address: string; - family: number; - } - - function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; - function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; - function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lookup { - function __promisify__(hostname: string, options: LookupAllOptions): Promise; - function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; - function __promisify__(hostname: string, options: LookupOptions): Promise; - } - - function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; - - namespace lookupService { - function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; - } - - interface ResolveOptions { - ttl: boolean; - } - - interface ResolveWithTtlOptions extends ResolveOptions { - ttl: true; - } - - interface RecordWithTtl { - address: string; - ttl: number; - } - - /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ - type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; - - interface AnyARecord extends RecordWithTtl { - type: "A"; - } - - interface AnyAaaaRecord extends RecordWithTtl { - type: "AAAA"; - } - - interface MxRecord { - priority: number; - exchange: string; - } - - interface AnyMxRecord extends MxRecord { - type: "MX"; - } - - interface NaptrRecord { - flags: string; - service: string; - regexp: string; - replacement: string; - order: number; - preference: number; - } - - interface AnyNaptrRecord extends NaptrRecord { - type: "NAPTR"; - } - - interface SoaRecord { - nsname: string; - hostmaster: string; - serial: number; - refresh: number; - retry: number; - expire: number; - minttl: number; - } - - interface AnySoaRecord extends SoaRecord { - type: "SOA"; - } - - interface SrvRecord { - priority: number; - weight: number; - port: number; - name: string; - } - - interface AnySrvRecord extends SrvRecord { - type: "SRV"; - } - - interface AnyTxtRecord { - type: "TXT"; - entries: string[]; - } - - interface AnyNsRecord { - type: "NS"; - value: string; - } - - interface AnyPtrRecord { - type: "PTR"; - value: string; - } - - interface AnyCnameRecord { - type: "CNAME"; - value: string; - } - - type AnyRecord = AnyARecord | - AnyAaaaRecord | - AnyCnameRecord | - AnyMxRecord | - AnyNaptrRecord | - AnyNsRecord | - AnyPtrRecord | - AnySoaRecord | - AnySrvRecord | - AnyTxtRecord; - - function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; - function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; - function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; - function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; - function resolve( - hostname: string, - rrtype: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, - ): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve { - function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - function __promisify__(hostname: string, rrtype: "ANY"): Promise; - function __promisify__(hostname: string, rrtype: "MX"): Promise; - function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; - function __promisify__(hostname: string, rrtype: "SOA"): Promise; - function __promisify__(hostname: string, rrtype: "SRV"): Promise; - function __promisify__(hostname: string, rrtype: "TXT"): Promise; - function __promisify__(hostname: string, rrtype: string): Promise; - } - - function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; - function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve4 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - - function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; - function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve6 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - - function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolveCname { - function __promisify__(hostname: string): Promise; - } - - function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; - namespace resolveMx { - function __promisify__(hostname: string): Promise; - } - - function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; - namespace resolveNaptr { - function __promisify__(hostname: string): Promise; - } - - function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolveNs { - function __promisify__(hostname: string): Promise; - } - - function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolvePtr { - function __promisify__(hostname: string): Promise; - } - - function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; - namespace resolveSoa { - function __promisify__(hostname: string): Promise; - } - - function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; - namespace resolveSrv { - function __promisify__(hostname: string): Promise; - } - - function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; - namespace resolveTxt { - function __promisify__(hostname: string): Promise; - } - - function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; - namespace resolveAny { - function __promisify__(hostname: string): Promise; - } - - function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; - function setServers(servers: ReadonlyArray): void; - function getServers(): string[]; - - // Error codes - const NODATA: string; - const FORMERR: string; - const SERVFAIL: string; - const NOTFOUND: string; - const NOTIMP: string; - const REFUSED: string; - const BADQUERY: string; - const BADNAME: string; - const BADFAMILY: string; - const BADRESP: string; - const CONNREFUSED: string; - const TIMEOUT: string; - const EOF: string; - const FILE: string; - const NOMEM: string; - const DESTRUCTION: string; - const BADSTR: string; - const BADFLAGS: string; - const NONAME: string; - const BADHINTS: string; - const NOTINITIALIZED: string; - const LOADIPHLPAPI: string; - const ADDRGETNETWORKPARAMS: string; - const CANCELLED: string; - - class Resolver { - getServers: typeof getServers; - setServers: typeof setServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - cancel(): void; - } - - namespace promises { - function getServers(): string[]; - - function lookup(hostname: string, family: number): Promise; - function lookup(hostname: string, options: LookupOneOptions): Promise; - function lookup(hostname: string, options: LookupAllOptions): Promise; - function lookup(hostname: string, options: LookupOptions): Promise; - function lookup(hostname: string): Promise; - - function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>; - - function resolve(hostname: string): Promise; - function resolve(hostname: string, rrtype: "A"): Promise; - function resolve(hostname: string, rrtype: "AAAA"): Promise; - function resolve(hostname: string, rrtype: "ANY"): Promise; - function resolve(hostname: string, rrtype: "CNAME"): Promise; - function resolve(hostname: string, rrtype: "MX"): Promise; - function resolve(hostname: string, rrtype: "NAPTR"): Promise; - function resolve(hostname: string, rrtype: "NS"): Promise; - function resolve(hostname: string, rrtype: "PTR"): Promise; - function resolve(hostname: string, rrtype: "SOA"): Promise; - function resolve(hostname: string, rrtype: "SRV"): Promise; - function resolve(hostname: string, rrtype: "TXT"): Promise; - function resolve(hostname: string, rrtype: string): Promise; - - function resolve4(hostname: string): Promise; - function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve4(hostname: string, options: ResolveOptions): Promise; - - function resolve6(hostname: string): Promise; - function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve6(hostname: string, options: ResolveOptions): Promise; - - function resolveAny(hostname: string): Promise; - - function resolveCname(hostname: string): Promise; - - function resolveMx(hostname: string): Promise; - - function resolveNaptr(hostname: string): Promise; - - function resolveNs(hostname: string): Promise; - - function resolvePtr(hostname: string): Promise; - - function resolveSoa(hostname: string): Promise; - - function resolveSrv(hostname: string): Promise; - - function resolveTxt(hostname: string): Promise; - - function reverse(ip: string): Promise; - - function setServers(servers: ReadonlyArray): void; - - class Resolver { - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - setServers: typeof setServers; - } - } -} diff --git a/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts deleted file mode 100644 index 63dcc9b0..00000000 --- a/node_modules/@types/node/domain.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module "domain" { - import { EventEmitter } from "events"; - - global { - namespace NodeJS { - interface Domain extends EventEmitter { - run(fn: (...args: any[]) => T, ...args: any[]): T; - add(emitter: EventEmitter | Timer): void; - remove(emitter: EventEmitter | Timer): void; - bind(cb: T): T; - intercept(cb: T): T; - } - } - } - - interface Domain extends NodeJS.Domain {} - class Domain extends EventEmitter { - members: Array; - enter(): void; - exit(): void; - } - - function create(): Domain; -} diff --git a/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts deleted file mode 100644 index c7399f18..00000000 --- a/node_modules/@types/node/events.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -declare module "events" { - interface EventEmitterOptions { - /** - * Enables automatic capturing of promise rejection. - */ - captureRejections?: boolean; - } - - interface NodeEventTarget { - once(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface DOMEventTarget { - addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any; - } - - namespace EventEmitter { - function once(emitter: NodeEventTarget, event: string | symbol): Promise; - function once(emitter: DOMEventTarget, event: string): Promise; - function on(emitter: EventEmitter, event: string): AsyncIterableIterator; - const captureRejectionSymbol: unique symbol; - - /** - * This symbol shall be used to install a listener for only monitoring `'error'` - * events. Listeners installed using this symbol are called before the regular - * `'error'` listeners are called. - * - * Installing a listener using this symbol does not change the behavior once an - * `'error'` event is emitted, therefore the process will still crash if no - * regular `'error'` listener is installed. - */ - const errorMonitor: unique symbol; - /** - * Sets or gets the default captureRejection value for all emitters. - */ - let captureRejections: boolean; - - interface EventEmitter extends NodeJS.EventEmitter { - } - - class EventEmitter { - constructor(options?: EventEmitterOptions); - /** @deprecated since v4.0.0 */ - static listenerCount(emitter: EventEmitter, event: string | symbol): number; - static defaultMaxListeners: number; - /** - * This symbol shall be used to install a listener for only monitoring `'error'` - * events. Listeners installed using this symbol are called before the regular - * `'error'` listeners are called. - * - * Installing a listener using this symbol does not change the behavior once an - * `'error'` event is emitted, therefore the process will still crash if no - * regular `'error'` listener is installed. - */ - static readonly errorMonitor: unique symbol; - } - } - - global { - namespace NodeJS { - interface EventEmitter { - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - removeAllListeners(event?: string | symbol): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: string | symbol): Function[]; - rawListeners(event: string | symbol): Function[]; - emit(event: string | symbol, ...args: any[]): boolean; - listenerCount(event: string | symbol): number; - // Added in Node 6... - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - eventNames(): Array; - } - } - } - - export = EventEmitter; -} diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts deleted file mode 100644 index c9710216..00000000 --- a/node_modules/@types/node/fs.d.ts +++ /dev/null @@ -1,2239 +0,0 @@ -declare module "fs" { - import * as stream from "stream"; - import * as events from "events"; - import { URL } from "url"; - import * as promises from 'fs/promises'; - - export { promises }; - /** - * Valid types for path values in "fs". - */ - export type PathLike = string | Buffer | URL; - - export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; - - export type BufferEncodingOption = 'buffer' | { encoding: 'buffer' }; - - export interface BaseEncodingOptions { - encoding?: BufferEncoding | null; - } - - export type OpenMode = number | string; - - export type Mode = number | string; - - export interface StatsBase { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - - dev: T; - ino: T; - mode: T; - nlink: T; - uid: T; - gid: T; - rdev: T; - size: T; - blksize: T; - blocks: T; - atimeMs: T; - mtimeMs: T; - ctimeMs: T; - birthtimeMs: T; - atime: Date; - mtime: Date; - ctime: Date; - birthtime: Date; - } - - export interface Stats extends StatsBase { - } - - export class Stats { - } - - export class Dirent { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - name: string; - } - - /** - * A class representing a directory stream. - */ - export class Dir { - readonly path: string; - - /** - * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. - */ - [Symbol.asyncIterator](): AsyncIterableIterator; - - /** - * Asynchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - */ - close(): Promise; - close(cb: NoParamCallback): void; - - /** - * Synchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - */ - closeSync(): void; - - /** - * Asynchronously read the next directory entry via `readdir(3)` as an `Dirent`. - * After the read is completed, a value is returned that will be resolved with an `Dirent`, or `null` if there are no more directory entries to read. - * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. - */ - read(): Promise; - read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; - - /** - * Synchronously read the next directory entry via `readdir(3)` as a `Dirent`. - * If there are no more directory entries to read, null will be returned. - * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. - */ - readSync(): Dirent; - } - - export interface FSWatcher extends events.EventEmitter { - close(): void; - - /** - * events.EventEmitter - * 1. change - * 2. error - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "close", listener: () => void): this; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "close", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "close", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "close", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - } - - export class ReadStream extends stream.Readable { - close(): void; - bytesRead: number; - path: string | Buffer; - pending: boolean; - - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "ready", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "ready", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export class WriteStream extends stream.Writable { - close(): void; - bytesWritten: number; - path: string | Buffer; - pending: boolean; - - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "ready", listener: () => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "ready", listener: () => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace rename { - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; - } - - /** - * Synchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function renameSync(oldPath: PathLike, newPath: PathLike): void; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function truncate(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace truncate { - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(path: PathLike, len?: number | null): Promise; - } - - /** - * Synchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - export function truncateSync(path: PathLike, len?: number | null): void; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - */ - export function ftruncate(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace ftruncate { - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(fd: number, len?: number | null): Promise; - } - - /** - * Synchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - export function ftruncateSync(fd: number, len?: number | null): void; - - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace chown { - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - - /** - * Synchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function chownSync(path: PathLike, uid: number, gid: number): void; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace fchown { - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function __promisify__(fd: number, uid: number, gid: number): Promise; - } - - /** - * Synchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - export function fchownSync(fd: number, uid: number, gid: number): void; - - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace lchown { - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - - /** - * Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function lchownSync(path: PathLike, uid: number, gid: number): void; - - /** - * Changes the access and modification times of a file in the same way as `fs.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - export function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace lutimes { - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`, - * or throws an exception when parameters are incorrect or the operation fails. - * This is the synchronous version of `fs.lutimes()`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - export function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace chmod { - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - - /** - * Synchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - export function chmodSync(path: PathLike, mode: Mode): void; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace fchmod { - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(fd: number, mode: Mode): Promise; - } - - /** - * Synchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - export function fchmodSync(fd: number, mode: Mode): void; - - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace lchmod { - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - - /** - * Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - export function lchmodSync(path: PathLike, mode: Mode): void; - - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function stat(path: PathLike, options: BigIntOptions, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void; - export function stat(path: PathLike, options: StatOptions, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; - export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace stat { - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options: BigIntOptions): Promise; - function __promisify__(path: PathLike, options: StatOptions): Promise; - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function statSync(path: PathLike, options: BigIntOptions): BigIntStats; - export function statSync(path: PathLike, options: StatOptions): Stats | BigIntStats; - export function statSync(path: PathLike): Stats; - - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace fstat { - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - export function fstatSync(fd: number): Stats; - - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace lstat { - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function lstatSync(path: PathLike): Stats; - - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace link { - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; - } - - /** - * Synchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function linkSync(existingPath: PathLike, newPath: PathLike): void; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - */ - export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace symlink { - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; - - type Type = "dir" | "file" | "junction"; - } - - /** - * Synchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink( - path: PathLike, - options: BaseEncodingOptions | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void - ): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace readlink { - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise; - } - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string; - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer; - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath( - path: PathLike, - options: BaseEncodingOptions | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void - ): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace realpath { - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise; - - function native( - path: PathLike, - options: BaseEncodingOptions | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void - ): void; - function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; - function native(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; - function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; - } - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string; - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer; - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer; - - export namespace realpathSync { - function native(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string; - function native(path: PathLike, options: BufferEncodingOption): Buffer; - function native(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer; - } - - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function unlink(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace unlink { - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function unlinkSync(path: PathLike): void; - - export interface RmDirOptions { - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number; - /** - * @deprecated since v14.14.0 In future versions of Node.js, - * `fs.rmdir(path, { recursive: true })` will throw on nonexistent - * paths, or when given a file as a target. - * Use `fs.rm(path, { recursive: true, force: true })` instead. - * - * If `true`, perform a recursive directory removal. In - * recursive mode, errors are not reported if `path` does not exist, and - * operations are retried on failure. - * @default false - */ - recursive?: boolean; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number; - } - - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function rmdir(path: PathLike, callback: NoParamCallback): void; - export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace rmdir { - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options?: RmDirOptions): Promise; - } - - /** - * Synchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function rmdirSync(path: PathLike, options?: RmDirOptions): void; - - export interface RmOptions { - /** - * When `true`, exceptions will be ignored if `path` does not exist. - * @default false - */ - force?: boolean; - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number; - /** - * If `true`, perform a recursive directory removal. In - * recursive mode, errors are not reported if `path` does not exist, and - * operations are retried on failure. - * @default false - */ - recursive?: boolean; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number; - } - - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). - */ - export function rm(path: PathLike, callback: NoParamCallback): void; - export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace rm { - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). - */ - function __promisify__(path: PathLike, options?: RmOptions): Promise; - } - - /** - * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). - */ - export function rmSync(path: PathLike, options?: RmOptions): void; - - export interface MakeDirectoryOptions { - /** - * Indicates whether parent folders should be created. - * If a folder was created, the path to the first created folder will be returned. - * @default false - */ - recursive?: boolean; - /** - * A file mode. If a string is passed, it is parsed as an octal integer. If not specified - * @default 0o777 - */ - mode?: Mode; - } - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path: string) => void): void; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null | undefined, callback: NoParamCallback): void; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path: string | undefined) => void): void; - - /** - * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function mkdir(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace mkdir { - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; - } - - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string; - - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): void; - - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp(prefix: string, options: BaseEncodingOptions | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp(prefix: string, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - */ - export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace mkdtemp { - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options: BufferEncodingOption): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: BaseEncodingOptions | string | null): Promise; - } - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): string; - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer; - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options?: BaseEncodingOptions | string | null): string | Buffer; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, - ): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdir(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace readdir { - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent - */ - function __promisify__(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Promise; - } - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): string[] | Buffer[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdirSync(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Dirent[]; - - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - export function close(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace close { - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - export function closeSync(fd: number): void; - - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - export function open(path: PathLike, flags: OpenMode, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function open(path: PathLike, flags: OpenMode, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace open { - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise; - } - - /** - * Synchronous open(2) - open and possibly create a file, returning a file descriptor.. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - export function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace utimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Synchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - export function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - export function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace futimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(fd: number, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Synchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - export function futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - export function fsync(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace fsync { - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - export function fsyncSync(fd: number): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - */ - export function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function write( - fd: number, - string: string, - position: number | undefined | null, - encoding: BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - export function write(fd: number, string: string, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - */ - export function write(fd: number, string: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace write { - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function __promisify__( - fd: number, - buffer?: TBuffer, - offset?: number, - length?: number, - position?: number | null, - ): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function __promisify__(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>; - } - - /** - * Synchronously writes `buffer` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - export function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number; - - /** - * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number; - - /** - * Asynchronously reads data from the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - export function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace read { - /** - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function __promisify__( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null - ): Promise<{ bytesRead: number, buffer: TBuffer }>; - } - - export interface ReadSyncOptions { - /** - * @default 0 - */ - offset?: number; - /** - * @default `length of buffer` - */ - length?: number; - /** - * @default null - */ - position?: number | null; - } - - /** - * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read. - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number; - - /** - * Similar to the above `fs.readSync` function, this version takes an optional `options` object. - * If no `options` object is specified, it will default with the above values. - */ - export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile( - path: PathLike | number, - options: BaseEncodingOptions & { flag?: string; } | string | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, - ): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - */ - export function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace readFile { - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | string): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | string | null): Promise; - } - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer; - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | BufferEncoding): string; - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | BufferEncoding | null): string | Buffer; - - export type WriteFileOptions = BaseEncodingOptions & { mode?: Mode; flag?: string; } | string | null; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - export function writeFile(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function writeFile(path: PathLike | number, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace writeFile { - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function __promisify__(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise; - } - - /** - * Synchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - export function writeFileSync(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): void; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - export function appendFile(file: PathLike | number, data: string | Uint8Array, options: WriteFileOptions, callback: NoParamCallback): void; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function appendFile(file: PathLike | number, data: string | Uint8Array, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace appendFile { - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function __promisify__(file: PathLike | number, data: string | Uint8Array, options?: WriteFileOptions): Promise; - } - - /** - * Synchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - export function appendFileSync(file: PathLike | number, data: string | Uint8Array, options?: WriteFileOptions): void; - - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - */ - export function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void; - - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void; - - /** - * Stop watching for changes on `filename`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - export function watch( - filename: PathLike, - options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null, - listener?: (event: string, filename: string) => void, - ): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - export function watch(filename: PathLike, options: { encoding: "buffer", persistent?: boolean, recursive?: boolean } | "buffer", listener?: (event: string, filename: Buffer) => void): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - export function watch( - filename: PathLike, - options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | string | null, - listener?: (event: string, filename: string | Buffer) => void, - ): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function watch(filename: PathLike, listener?: (event: string, filename: string) => any): FSWatcher; - - /** - * Asynchronously tests whether or not the given path exists by checking with the file system. - * @deprecated since v1.0.0 Use `fs.stat()` or `fs.access()` instead - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function exists(path: PathLike, callback: (exists: boolean) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace exists { - /** - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronously tests whether or not the given path exists by checking with the file system. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function existsSync(path: PathLike): boolean; - - export namespace constants { - // File Access Constants - - /** Constant for fs.access(). File is visible to the calling process. */ - const F_OK: number; - - /** Constant for fs.access(). File can be read by the calling process. */ - const R_OK: number; - - /** Constant for fs.access(). File can be written by the calling process. */ - const W_OK: number; - - /** Constant for fs.access(). File can be executed by the calling process. */ - const X_OK: number; - - // File Copy Constants - - /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ - const COPYFILE_EXCL: number; - - /** - * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. - */ - const COPYFILE_FICLONE: number; - - /** - * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then the operation will fail with an error. - */ - const COPYFILE_FICLONE_FORCE: number; - - // File Open Constants - - /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ - const O_RDONLY: number; - - /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ - const O_WRONLY: number; - - /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ - const O_RDWR: number; - - /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ - const O_CREAT: number; - - /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ - const O_EXCL: number; - - /** - * Constant for fs.open(). Flag indicating that if path identifies a terminal device, - * opening the path shall not cause that terminal to become the controlling terminal for the process - * (if the process does not already have one). - */ - const O_NOCTTY: number; - - /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ - const O_TRUNC: number; - - /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ - const O_APPEND: number; - - /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ - const O_DIRECTORY: number; - - /** - * constant for fs.open(). - * Flag indicating reading accesses to the file system will no longer result in - * an update to the atime information associated with the file. - * This flag is available on Linux operating systems only. - */ - const O_NOATIME: number; - - /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ - const O_NOFOLLOW: number; - - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ - const O_SYNC: number; - - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ - const O_DSYNC: number; - - /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ - const O_SYMLINK: number; - - /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ - const O_DIRECT: number; - - /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ - const O_NONBLOCK: number; - - // File Type Constants - - /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ - const S_IFMT: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ - const S_IFREG: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ - const S_IFDIR: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ - const S_IFCHR: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ - const S_IFBLK: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ - const S_IFIFO: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ - const S_IFLNK: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ - const S_IFSOCK: number; - - // File Mode Constants - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ - const S_IRWXU: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ - const S_IRUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ - const S_IWUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ - const S_IXUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ - const S_IRWXG: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ - const S_IRGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ - const S_IWGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ - const S_IXGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ - const S_IRWXO: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ - const S_IROTH: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ - const S_IWOTH: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ - const S_IXOTH: number; - - /** - * When set, a memory file mapping is used to access the file. This flag - * is available on Windows operating systems only. On other operating systems, - * this flag is ignored. - */ - const UV_FS_O_FILEMAP: number; - } - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function access(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace access { - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike, mode?: number): Promise; - } - - /** - * Synchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function accessSync(path: PathLike, mode?: number): void; - - /** - * Returns a new `ReadStream` object. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function createReadStream(path: PathLike, options?: string | { - flags?: string; - encoding?: BufferEncoding; - fd?: number; - mode?: number; - autoClose?: boolean; - /** - * @default false - */ - emitClose?: boolean; - start?: number; - end?: number; - highWaterMark?: number; - }): ReadStream; - - /** - * Returns a new `WriteStream` object. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - export function createWriteStream(path: PathLike, options?: string | { - flags?: string; - encoding?: BufferEncoding; - fd?: number; - mode?: number; - autoClose?: boolean; - emitClose?: boolean; - start?: number; - highWaterMark?: number; - }): WriteStream; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - export function fdatasync(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace fdatasync { - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - export function fdatasyncSync(fd: number): void; - - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - */ - export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. - */ - export function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - export namespace copyFile { - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. - * The only supported flag is fs.constants.COPYFILE_EXCL, - * which causes the copy operation to fail if dest already exists. - */ - function __promisify__(src: PathLike, dst: PathLike, flags?: number): Promise; - } - - /** - * Synchronously copies src to dest. By default, dest is overwritten if it already exists. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. - * The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. - */ - export function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void; - - /** - * Write an array of ArrayBufferViews to the file specified by fd using writev(). - * position is the offset from the beginning of the file where this data should be written. - * It is unsafe to use fs.writev() multiple times on the same file without waiting for the callback. For this scenario, use fs.createWriteStream(). - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to the end of the file. - */ - export function writev( - fd: number, - buffers: ReadonlyArray, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - export function writev( - fd: number, - buffers: ReadonlyArray, - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - - export interface WriteVResult { - bytesWritten: number; - buffers: NodeJS.ArrayBufferView[]; - } - - export namespace writev { - function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; - } - - /** - * See `writev`. - */ - export function writevSync(fd: number, buffers: ReadonlyArray, position?: number): number; - - export function readv( - fd: number, - buffers: ReadonlyArray, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - export function readv( - fd: number, - buffers: ReadonlyArray, - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - - export interface ReadVResult { - bytesRead: number; - buffers: NodeJS.ArrayBufferView[]; - } - - export namespace readv { - function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; - } - - /** - * See `readv`. - */ - export function readvSync(fd: number, buffers: ReadonlyArray, position?: number): number; - - export interface OpenDirOptions { - encoding?: BufferEncoding; - /** - * Number of directory entries that are buffered - * internally when reading from the directory. Higher values lead to better - * performance but higher memory usage. - * @default 32 - */ - bufferSize?: number; - } - - export function opendirSync(path: string, options?: OpenDirOptions): Dir; - - export function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - export function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - - export namespace opendir { - function __promisify__(path: string, options?: OpenDirOptions): Promise; - } - - export interface BigIntStats extends StatsBase { - } - - export class BigIntStats { - atimeNs: bigint; - mtimeNs: bigint; - ctimeNs: bigint; - birthtimeNs: bigint; - } - - export interface BigIntOptions { - bigint: true; - } - - export interface StatOptions { - bigint: boolean; - } -} diff --git a/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts deleted file mode 100644 index 1753c863..00000000 --- a/node_modules/@types/node/fs/promises.d.ts +++ /dev/null @@ -1,555 +0,0 @@ -declare module 'fs/promises' { - import { - Stats, - WriteVResult, - ReadVResult, - PathLike, - RmDirOptions, - RmOptions, - MakeDirectoryOptions, - Dirent, - OpenDirOptions, - Dir, - BaseEncodingOptions, - BufferEncodingOption, - OpenMode, - Mode, - } from 'fs'; - - interface FileHandle { - /** - * Gets the file descriptor for this file handle. - */ - readonly fd: number; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for appending. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - */ - chown(uid: number, gid: number): Promise; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - chmod(mode: Mode): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - */ - datasync(): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - */ - sync(): Promise; - - /** - * Asynchronously reads data from the file. - * The `FileHandle` must have been opened for reading. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - read(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: { encoding?: null, flag?: OpenMode } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - */ - stat(): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param len If not specified, defaults to `0`. - */ - truncate(len?: number): Promise; - - /** - * Asynchronously change file timestamps of the file. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - utimes(atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously writes `buffer` to the file. - * The `FileHandle` must have been opened for writing. - * @param buffer The buffer that the data will be written to. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - write(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - write(data: string | Uint8Array, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise; - - /** - * See `fs.writev` promisified version. - */ - writev(buffers: ReadonlyArray, position?: number): Promise; - - /** - * See `fs.readv` promisified version. - */ - readv(buffers: ReadonlyArray, position?: number): Promise; - - /** - * Asynchronous close(2) - close a `FileHandle`. - */ - close(): Promise; - } - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, mode?: number): Promise; - - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. The only - * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if - * `dest` already exists. - */ - function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise; - - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not - * supplied, defaults to `0o666`. - */ - function open(path: PathLike, flags: string | number, mode?: Mode): Promise; - - /** - * Asynchronously reads data from the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If - * `null`, data will be read from the current position. - */ - function read( - handle: FileHandle, - buffer: TBuffer, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise<{ bytesRead: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write( - handle: FileHandle, - buffer: TBuffer, - offset?: number | null, - length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function write(handle: FileHandle, string: string, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>; - - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function rename(oldPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncate(path: PathLike, len?: number): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param handle A `FileHandle`. - * @param len If not specified, defaults to `0`. - */ - function ftruncate(handle: FileHandle, len?: number): Promise; - - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdir(path: PathLike, options?: RmDirOptions): Promise; - - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). - */ - function rm(path: PathLike, options?: RmOptions): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param handle A `FileHandle`. - */ - function fdatasync(handle: FileHandle): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param handle A `FileHandle`. - */ - function fsync(handle: FileHandle): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: BufferEncodingOption): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: BaseEncodingOptions | string | null): Promise; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - * @param handle A `FileHandle`. - */ - function fstat(handle: FileHandle): Promise; - - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstat(path: PathLike): Promise; - - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function stat(path: PathLike): Promise; - - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function link(existingPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlink(path: PathLike): Promise; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param handle A `FileHandle`. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmod(handle: FileHandle, mode: Mode): Promise; - - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmod(path: PathLike, mode: Mode): Promise; - - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmod(path: PathLike, mode: Mode): Promise; - - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param handle A `FileHandle`. - */ - function fchown(handle: FileHandle, uid: number, gid: number): Promise; - - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: BufferEncodingOption): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): Promise; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise; - - function opendir(path: string, options?: OpenDirOptions): Promise; -} diff --git a/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts deleted file mode 100644 index 12419609..00000000 --- a/node_modules/@types/node/globals.d.ts +++ /dev/null @@ -1,607 +0,0 @@ -// Declare "static" methods in Error -interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces - */ - prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any; - - stackTraceLimit: number; -} - -// Node.js ESNEXT support -interface String { - /** Removes whitespace from the left end of a string. */ - trimLeft(): string; - /** Removes whitespace from the right end of a string. */ - trimRight(): string; - - /** Returns a copy with leading whitespace removed. */ - trimStart(): string; - /** Returns a copy with trailing whitespace removed. */ - trimEnd(): string; -} - -interface ImportMeta { - url: string; -} - -/*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ - -// For backwards compability -interface NodeRequire extends NodeJS.Require {} -interface RequireResolve extends NodeJS.RequireResolve {} -interface NodeModule extends NodeJS.Module {} - -declare var process: NodeJS.Process; -declare var console: Console; - -declare var __filename: string; -declare var __dirname: string; - -declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; -declare namespace setTimeout { - function __promisify__(ms: number): Promise; - function __promisify__(ms: number, value: T): Promise; -} -declare function clearTimeout(timeoutId: NodeJS.Timeout): void; -declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; -declare function clearInterval(intervalId: NodeJS.Timeout): void; -declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; -declare namespace setImmediate { - function __promisify__(): Promise; - function __promisify__(value: T): Promise; -} -declare function clearImmediate(immediateId: NodeJS.Immediate): void; - -declare function queueMicrotask(callback: () => void): void; - -declare var require: NodeRequire; -declare var module: NodeModule; - -// Same as module.exports -declare var exports: any; - -// Buffer class -type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; - -/** - * Raw data is stored in instances of the Buffer class. - * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. - * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - */ -declare class Buffer extends Uint8Array { - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. - */ - constructor(str: string, encoding?: BufferEncoding); - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). - */ - constructor(size: number); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - constructor(array: Uint8Array); - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}/{SharedArrayBuffer}. - * - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. - */ - constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - constructor(array: ReadonlyArray); - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. - */ - constructor(buffer: Buffer); - /** - * When passed a reference to the .buffer property of a TypedArray instance, - * the newly created Buffer will share the same allocated memory as the TypedArray. - * The optional {byteOffset} and {length} arguments specify a memory range - * within the {arrayBuffer} that will be shared by the Buffer. - * - * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer() - */ - static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param data data to create a new Buffer - */ - static from(data: ReadonlyArray): Buffer; - static from(data: Uint8Array): Buffer; - /** - * Creates a new buffer containing the coerced value of an object - * A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants. - * @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`. - */ - static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - */ - static from(str: string, encoding?: BufferEncoding): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param values to create a new Buffer - */ - static of(...items: number[]): Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - static isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - static isEncoding(encoding: string): encoding is BufferEncoding; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - static byteLength( - string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, - encoding?: BufferEncoding - ): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - static concat(list: ReadonlyArray, totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - static compare(buf1: Uint8Array, buf2: Uint8Array): number; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @param fill if specified, buffer will be initialized by calling buf.fill(fill). - * If parameter is omitted, buffer will be filled with zeros. - * @param encoding encoding used for call to buf.fill while initalizing - */ - static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafe(size: number): Buffer; - /** - * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafeSlow(size: number): Buffer; - /** - * This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified. - */ - static poolSize: number; - - write(string: string, encoding?: BufferEncoding): number; - write(string: string, offset: number, encoding?: BufferEncoding): number; - write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; - toString(encoding?: BufferEncoding, start?: number, end?: number): string; - toJSON(): { type: 'Buffer'; data: number[] }; - equals(otherBuffer: Uint8Array): boolean; - compare( - otherBuffer: Uint8Array, - targetStart?: number, - targetEnd?: number, - sourceStart?: number, - sourceEnd?: number - ): number; - copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - /** - * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices. - * - * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory. - * - * @param begin Where the new `Buffer` will start. Default: `0`. - * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`. - */ - slice(begin?: number, end?: number): Buffer; - /** - * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices. - * - * This method is compatible with `Uint8Array#subarray()`. - * - * @param begin Where the new `Buffer` will start. Default: `0`. - * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`. - */ - subarray(begin?: number, end?: number): Buffer; - writeBigInt64BE(value: bigint, offset?: number): number; - writeBigInt64LE(value: bigint, offset?: number): number; - writeBigUInt64BE(value: bigint, offset?: number): number; - writeBigUInt64LE(value: bigint, offset?: number): number; - writeUIntLE(value: number, offset: number, byteLength: number): number; - writeUIntBE(value: number, offset: number, byteLength: number): number; - writeIntLE(value: number, offset: number, byteLength: number): number; - writeIntBE(value: number, offset: number, byteLength: number): number; - readBigUInt64BE(offset?: number): bigint; - readBigUInt64LE(offset?: number): bigint; - readBigInt64BE(offset?: number): bigint; - readBigInt64LE(offset?: number): bigint; - readUIntLE(offset: number, byteLength: number): number; - readUIntBE(offset: number, byteLength: number): number; - readIntLE(offset: number, byteLength: number): number; - readIntBE(offset: number, byteLength: number): number; - readUInt8(offset?: number): number; - readUInt16LE(offset?: number): number; - readUInt16BE(offset?: number): number; - readUInt32LE(offset?: number): number; - readUInt32BE(offset?: number): number; - readInt8(offset?: number): number; - readInt16LE(offset?: number): number; - readInt16BE(offset?: number): number; - readInt32LE(offset?: number): number; - readInt32BE(offset?: number): number; - readFloatLE(offset?: number): number; - readFloatBE(offset?: number): number; - readDoubleLE(offset?: number): number; - readDoubleBE(offset?: number): number; - reverse(): this; - swap16(): Buffer; - swap32(): Buffer; - swap64(): Buffer; - writeUInt8(value: number, offset?: number): number; - writeUInt16LE(value: number, offset?: number): number; - writeUInt16BE(value: number, offset?: number): number; - writeUInt32LE(value: number, offset?: number): number; - writeUInt32BE(value: number, offset?: number): number; - writeInt8(value: number, offset?: number): number; - writeInt16LE(value: number, offset?: number): number; - writeInt16BE(value: number, offset?: number): number; - writeInt32LE(value: number, offset?: number): number; - writeInt32BE(value: number, offset?: number): number; - writeFloatLE(value: number, offset?: number): number; - writeFloatBE(value: number, offset?: number): number; - writeDoubleLE(value: number, offset?: number): number; - writeDoubleBE(value: number, offset?: number): number; - - fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; - - indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - entries(): IterableIterator<[number, number]>; - includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; - keys(): IterableIterator; - values(): IterableIterator; -} - -/*----------------------------------------------* -* * -* GLOBAL INTERFACES * -* * -*-----------------------------------------------*/ -declare namespace NodeJS { - interface InspectOptions { - /** - * If set to `true`, getters are going to be - * inspected as well. If set to `'get'` only getters without setter are going - * to be inspected. If set to `'set'` only getters having a corresponding - * setter are going to be inspected. This might cause side effects depending on - * the getter function. - * @default `false` - */ - getters?: 'get' | 'set' | boolean; - showHidden?: boolean; - /** - * @default 2 - */ - depth?: number | null; - colors?: boolean; - customInspect?: boolean; - showProxy?: boolean; - maxArrayLength?: number | null; - /** - * Specifies the maximum number of characters to - * include when formatting. Set to `null` or `Infinity` to show all elements. - * Set to `0` or negative to show no characters. - * @default Infinity - */ - maxStringLength?: number | null; - breakLength?: number; - /** - * Setting this to `false` causes each object key - * to be displayed on a new line. It will also add new lines to text that is - * longer than `breakLength`. If set to a number, the most `n` inner elements - * are united on a single line as long as all properties fit into - * `breakLength`. Short array elements are also grouped together. Note that no - * text will be reduced below 16 characters, no matter the `breakLength` size. - * For more information, see the example below. - * @default `true` - */ - compact?: boolean | number; - sorted?: boolean | ((a: string, b: string) => number); - } - - interface CallSite { - /** - * Value of "this" - */ - getThis(): any; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ - getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ - getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | null; - - /** - * Current line number [if this function was defined in a script] - */ - getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ - isEval(): boolean; - - /** - * Is this call in native V8 code? - */ - isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; - } - - interface ErrnoException extends Error { - errno?: number; - code?: string; - path?: string; - syscall?: string; - stack?: string; - } - - interface ReadableStream extends EventEmitter { - readable: boolean; - read(size?: number): string | Buffer; - setEncoding(encoding: BufferEncoding): this; - pause(): this; - resume(): this; - isPaused(): boolean; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: WritableStream): this; - unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; - wrap(oldStream: ReadableStream): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableStream extends EventEmitter { - writable: boolean; - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; - write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; - end(cb?: () => void): void; - end(data: string | Uint8Array, cb?: () => void): void; - end(str: string, encoding?: BufferEncoding, cb?: () => void): void; - } - - interface ReadWriteStream extends ReadableStream, WritableStream { } - - interface Global { - Array: typeof Array; - ArrayBuffer: typeof ArrayBuffer; - Boolean: typeof Boolean; - Buffer: typeof Buffer; - DataView: typeof DataView; - Date: typeof Date; - Error: typeof Error; - EvalError: typeof EvalError; - Float32Array: typeof Float32Array; - Float64Array: typeof Float64Array; - Function: typeof Function; - Infinity: typeof Infinity; - Int16Array: typeof Int16Array; - Int32Array: typeof Int32Array; - Int8Array: typeof Int8Array; - Intl: typeof Intl; - JSON: typeof JSON; - Map: MapConstructor; - Math: typeof Math; - NaN: typeof NaN; - Number: typeof Number; - Object: typeof Object; - Promise: typeof Promise; - RangeError: typeof RangeError; - ReferenceError: typeof ReferenceError; - RegExp: typeof RegExp; - Set: SetConstructor; - String: typeof String; - Symbol: Function; - SyntaxError: typeof SyntaxError; - TypeError: typeof TypeError; - URIError: typeof URIError; - Uint16Array: typeof Uint16Array; - Uint32Array: typeof Uint32Array; - Uint8Array: typeof Uint8Array; - Uint8ClampedArray: typeof Uint8ClampedArray; - WeakMap: WeakMapConstructor; - WeakSet: WeakSetConstructor; - clearImmediate: (immediateId: Immediate) => void; - clearInterval: (intervalId: Timeout) => void; - clearTimeout: (timeoutId: Timeout) => void; - decodeURI: typeof decodeURI; - decodeURIComponent: typeof decodeURIComponent; - encodeURI: typeof encodeURI; - encodeURIComponent: typeof encodeURIComponent; - escape: (str: string) => string; - eval: typeof eval; - global: Global; - isFinite: typeof isFinite; - isNaN: typeof isNaN; - parseFloat: typeof parseFloat; - parseInt: typeof parseInt; - setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate; - setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; - setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; - queueMicrotask: typeof queueMicrotask; - undefined: typeof undefined; - unescape: (str: string) => string; - gc: () => void; - v8debug?: any; - } - - interface RefCounted { - ref(): this; - unref(): this; - } - - // compatibility with older typings - interface Timer extends RefCounted { - hasRef(): boolean; - refresh(): this; - [Symbol.toPrimitive](): number; - } - - interface Immediate extends RefCounted { - hasRef(): boolean; - _onImmediate: Function; // to distinguish it from the Timeout class - } - - interface Timeout extends Timer { - hasRef(): boolean; - refresh(): this; - [Symbol.toPrimitive](): number; - } - - type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array; - type ArrayBufferView = TypedArray | DataView; - - interface Require { - (id: string): any; - resolve: RequireResolve; - cache: Dict; - /** - * @deprecated - */ - extensions: RequireExtensions; - main: Module | undefined; - } - - interface RequireResolve { - (id: string, options?: { paths?: string[]; }): string; - paths(request: string): string[] | null; - } - - interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { - '.js': (m: Module, filename: string) => any; - '.json': (m: Module, filename: string) => any; - '.node': (m: Module, filename: string) => any; - } - interface Module { - exports: any; - require: Require; - id: string; - filename: string; - loaded: boolean; - /** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */ - parent: Module | null | undefined; - children: Module[]; - /** - * @since 11.14.0 - * - * The directory name of the module. This is usually the same as the path.dirname() of the module.id. - */ - path: string; - paths: string[]; - } - - interface Dict { - [key: string]: T | undefined; - } - - interface ReadOnlyDict { - readonly [key: string]: T | undefined; - } -} diff --git a/node_modules/@types/node/globals.global.d.ts b/node_modules/@types/node/globals.global.d.ts deleted file mode 100644 index d66acba6..00000000 --- a/node_modules/@types/node/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: NodeJS.Global & typeof globalThis; diff --git a/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts deleted file mode 100644 index 72a478ae..00000000 --- a/node_modules/@types/node/http.d.ts +++ /dev/null @@ -1,422 +0,0 @@ -declare module "http" { - import * as stream from "stream"; - import { URL } from "url"; - import { Socket, Server as NetServer } from "net"; - - // incoming headers will never contain number - interface IncomingHttpHeaders extends NodeJS.Dict { - 'accept'?: string; - 'accept-language'?: string; - 'accept-patch'?: string; - 'accept-ranges'?: string; - 'access-control-allow-credentials'?: string; - 'access-control-allow-headers'?: string; - 'access-control-allow-methods'?: string; - 'access-control-allow-origin'?: string; - 'access-control-expose-headers'?: string; - 'access-control-max-age'?: string; - 'access-control-request-headers'?: string; - 'access-control-request-method'?: string; - 'age'?: string; - 'allow'?: string; - 'alt-svc'?: string; - 'authorization'?: string; - 'cache-control'?: string; - 'connection'?: string; - 'content-disposition'?: string; - 'content-encoding'?: string; - 'content-language'?: string; - 'content-length'?: string; - 'content-location'?: string; - 'content-range'?: string; - 'content-type'?: string; - 'cookie'?: string; - 'date'?: string; - 'expect'?: string; - 'expires'?: string; - 'forwarded'?: string; - 'from'?: string; - 'host'?: string; - 'if-match'?: string; - 'if-modified-since'?: string; - 'if-none-match'?: string; - 'if-unmodified-since'?: string; - 'last-modified'?: string; - 'location'?: string; - 'origin'?: string; - 'pragma'?: string; - 'proxy-authenticate'?: string; - 'proxy-authorization'?: string; - 'public-key-pins'?: string; - 'range'?: string; - 'referer'?: string; - 'retry-after'?: string; - 'sec-websocket-accept'?: string; - 'sec-websocket-extensions'?: string; - 'sec-websocket-key'?: string; - 'sec-websocket-protocol'?: string; - 'sec-websocket-version'?: string; - 'set-cookie'?: string[]; - 'strict-transport-security'?: string; - 'tk'?: string; - 'trailer'?: string; - 'transfer-encoding'?: string; - 'upgrade'?: string; - 'user-agent'?: string; - 'vary'?: string; - 'via'?: string; - 'warning'?: string; - 'www-authenticate'?: string; - } - - // outgoing headers allows numbers (as they are converted internally to strings) - type OutgoingHttpHeader = number | string | string[]; - - interface OutgoingHttpHeaders extends NodeJS.Dict { - } - - interface ClientRequestArgs { - protocol?: string | null; - host?: string | null; - hostname?: string | null; - family?: number; - port?: number | string | null; - defaultPort?: number | string; - localAddress?: string; - socketPath?: string; - /** - * @default 8192 - */ - maxHeaderSize?: number; - method?: string; - path?: string | null; - headers?: OutgoingHttpHeaders; - auth?: string | null; - agent?: Agent | boolean; - _defaultAgent?: Agent; - timeout?: number; - setHost?: boolean; - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 - createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket; - } - - interface ServerOptions { - IncomingMessage?: typeof IncomingMessage; - ServerResponse?: typeof ServerResponse; - /** - * Optionally overrides the value of - * [`--max-http-header-size`][] for requests received by this server, i.e. - * the maximum length of request headers in bytes. - * @default 8192 - */ - maxHeaderSize?: number; - /** - * Use an insecure HTTP parser that accepts invalid HTTP headers when true. - * Using the insecure parser should be avoided. - * See --insecure-http-parser for more information. - * @default false - */ - insecureHTTPParser?: boolean; - } - - type RequestListener = (req: IncomingMessage, res: ServerResponse) => void; - - interface HttpBase { - setTimeout(msecs?: number, callback?: () => void): this; - setTimeout(callback: () => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @default 2000 - * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount} - */ - maxHeadersCount: number | null; - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP headers. - * @default 60000 - * {@link https://nodejs.org/api/http.html#http_server_headerstimeout} - */ - headersTimeout: number; - keepAliveTimeout: number; - /** - * Sets the timeout value in milliseconds for receiving the entire request from the client. - * @default 0 - * {@link https://nodejs.org/api/http.html#http_server_requesttimeout} - */ - requestTimeout: number; - } - - interface Server extends HttpBase {} - class Server extends NetServer { - constructor(requestListener?: RequestListener); - constructor(options: ServerOptions, requestListener?: RequestListener); - } - - // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js - class OutgoingMessage extends stream.Writable { - upgrading: boolean; - chunkedEncoding: boolean; - shouldKeepAlive: boolean; - useChunkedEncodingByDefault: boolean; - sendDate: boolean; - /** - * @deprecated Use `writableEnded` instead. - */ - finished: boolean; - headersSent: boolean; - /** - * @deprecate Use `socket` instead. - */ - connection: Socket | null; - socket: Socket | null; - - constructor(); - - setTimeout(msecs: number, callback?: () => void): this; - setHeader(name: string, value: number | string | ReadonlyArray): void; - getHeader(name: string): number | string | string[] | undefined; - getHeaders(): OutgoingHttpHeaders; - getHeaderNames(): string[]; - hasHeader(name: string): boolean; - removeHeader(name: string): void; - addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; - flushHeaders(): void; - } - - // https://github.com/nodejs/node/blob/master/lib/_http_server.js#L108-L256 - class ServerResponse extends OutgoingMessage { - statusCode: number; - statusMessage: string; - - constructor(req: IncomingMessage); - - assignSocket(socket: Socket): void; - detachSocket(socket: Socket): void; - // https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53 - // no args in writeContinue callback - writeContinue(callback?: () => void): void; - writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; - writeProcessing(): void; - } - - interface InformationEvent { - statusCode: number; - statusMessage: string; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - } - - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77 - class ClientRequest extends OutgoingMessage { - aborted: boolean; - host: string; - protocol: string; - - constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); - - method: string; - path: string; - abort(): void; - onSocket(socket: Socket): void; - setTimeout(timeout: number, callback?: () => void): this; - setNoDelay(noDelay?: boolean): void; - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - - addListener(event: 'abort', listener: () => void): this; - addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - addListener(event: 'continue', listener: () => void): this; - addListener(event: 'information', listener: (info: InformationEvent) => void): this; - addListener(event: 'response', listener: (response: IncomingMessage) => void): this; - addListener(event: 'socket', listener: (socket: Socket) => void): this; - addListener(event: 'timeout', listener: () => void): this; - addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - addListener(event: 'close', listener: () => void): this; - addListener(event: 'drain', listener: () => void): this; - addListener(event: 'error', listener: (err: Error) => void): this; - addListener(event: 'finish', listener: () => void): this; - addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - on(event: 'abort', listener: () => void): this; - on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: 'continue', listener: () => void): this; - on(event: 'information', listener: (info: InformationEvent) => void): this; - on(event: 'response', listener: (response: IncomingMessage) => void): this; - on(event: 'socket', listener: (socket: Socket) => void): this; - on(event: 'timeout', listener: () => void): this; - on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: 'close', listener: () => void): this; - on(event: 'drain', listener: () => void): this; - on(event: 'error', listener: (err: Error) => void): this; - on(event: 'finish', listener: () => void): this; - on(event: 'pipe', listener: (src: stream.Readable) => void): this; - on(event: 'unpipe', listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: 'abort', listener: () => void): this; - once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: 'continue', listener: () => void): this; - once(event: 'information', listener: (info: InformationEvent) => void): this; - once(event: 'response', listener: (response: IncomingMessage) => void): this; - once(event: 'socket', listener: (socket: Socket) => void): this; - once(event: 'timeout', listener: () => void): this; - once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: 'close', listener: () => void): this; - once(event: 'drain', listener: () => void): this; - once(event: 'error', listener: (err: Error) => void): this; - once(event: 'finish', listener: () => void): this; - once(event: 'pipe', listener: (src: stream.Readable) => void): this; - once(event: 'unpipe', listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: 'abort', listener: () => void): this; - prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependListener(event: 'continue', listener: () => void): this; - prependListener(event: 'information', listener: (info: InformationEvent) => void): this; - prependListener(event: 'response', listener: (response: IncomingMessage) => void): this; - prependListener(event: 'socket', listener: (socket: Socket) => void): this; - prependListener(event: 'timeout', listener: () => void): this; - prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependListener(event: 'close', listener: () => void): this; - prependListener(event: 'drain', listener: () => void): this; - prependListener(event: 'error', listener: (err: Error) => void): this; - prependListener(event: 'finish', listener: () => void): this; - prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: 'abort', listener: () => void): this; - prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependOnceListener(event: 'continue', listener: () => void): this; - prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this; - prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this; - prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this; - prependOnceListener(event: 'timeout', listener: () => void): this; - prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependOnceListener(event: 'close', listener: () => void): this; - prependOnceListener(event: 'drain', listener: () => void): this; - prependOnceListener(event: 'error', listener: (err: Error) => void): this; - prependOnceListener(event: 'finish', listener: () => void): this; - prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - class IncomingMessage extends stream.Readable { - constructor(socket: Socket); - - aborted: boolean; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - complete: boolean; - /** - * @deprecate Use `socket` instead. - */ - connection: Socket; - socket: Socket; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - trailers: NodeJS.Dict; - rawTrailers: string[]; - setTimeout(msecs: number, callback?: () => void): this; - /** - * Only valid for request obtained from http.Server. - */ - method?: string; - /** - * Only valid for request obtained from http.Server. - */ - url?: string; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusCode?: number; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusMessage?: string; - destroy(error?: Error): void; - } - - interface AgentOptions { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number; - /** - * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. - */ - maxTotalSockets?: number; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number; - /** - * Socket timeout in milliseconds. This will set the timeout after the socket is connected. - */ - timeout?: number; - /** - * Scheduling strategy to apply when picking the next free socket to use. Default: 'fifo'. - */ - scheduling?: 'fifo' | 'lifo'; - } - - class Agent { - maxFreeSockets: number; - maxSockets: number; - maxTotalSockets: number; - readonly freeSockets: NodeJS.ReadOnlyDict; - readonly sockets: NodeJS.ReadOnlyDict; - readonly requests: NodeJS.ReadOnlyDict; - - constructor(opts?: AgentOptions); - - /** - * Destroy any sockets that are currently in use by the agent. - * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, - * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, - * sockets may hang open for quite a long time before the server terminates them. - */ - destroy(): void; - } - - const METHODS: string[]; - - const STATUS_CODES: { - [errorCode: number]: string | undefined; - [errorCode: string]: string | undefined; - }; - - function createServer(requestListener?: RequestListener): Server; - function createServer(options: ServerOptions, requestListener?: RequestListener): Server; - - // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, - // create interface RequestOptions would make the naming more clear to developers - interface RequestOptions extends ClientRequestArgs { } - function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - let globalAgent: Agent; - - /** - * Read-only property specifying the maximum allowed size of HTTP headers in bytes. - * Defaults to 16KB. Configurable using the [`--max-http-header-size`][] CLI option. - */ - const maxHeaderSize: number; -} diff --git a/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts deleted file mode 100644 index 07882931..00000000 --- a/node_modules/@types/node/http2.d.ts +++ /dev/null @@ -1,952 +0,0 @@ -declare module "http2" { - import * as events from "events"; - import * as fs from "fs"; - import * as net from "net"; - import * as stream from "stream"; - import * as tls from "tls"; - import * as url from "url"; - - import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from "http"; - export { OutgoingHttpHeaders } from "http"; - - export interface IncomingHttpStatusHeader { - ":status"?: number; - } - - export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { - ":path"?: string; - ":method"?: string; - ":authority"?: string; - ":scheme"?: string; - } - - // Http2Stream - - export interface StreamPriorityOptions { - exclusive?: boolean; - parent?: number; - weight?: number; - silent?: boolean; - } - - export interface StreamState { - localWindowSize?: number; - state?: number; - localClose?: number; - remoteClose?: number; - sumDependencyWeight?: number; - weight?: number; - } - - export interface ServerStreamResponseOptions { - endStream?: boolean; - waitForTrailers?: boolean; - } - - export interface StatOptions { - offset: number; - length: number; - } - - export interface ServerStreamFileResponseOptions { - statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; - waitForTrailers?: boolean; - offset?: number; - length?: number; - } - - export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { - onError?(err: NodeJS.ErrnoException): void; - } - - export interface Http2Stream extends stream.Duplex { - readonly aborted: boolean; - readonly bufferSize: number; - readonly closed: boolean; - readonly destroyed: boolean; - /** - * Set the true if the END_STREAM flag was set in the request or response HEADERS frame received, - * indicating that no additional data should be received and the readable side of the Http2Stream will be closed. - */ - readonly endAfterHeaders: boolean; - readonly id?: number; - readonly pending: boolean; - readonly rstCode: number; - readonly sentHeaders: OutgoingHttpHeaders; - readonly sentInfoHeaders?: OutgoingHttpHeaders[]; - readonly sentTrailers?: OutgoingHttpHeaders; - readonly session: Http2Session; - readonly state: StreamState; - - close(code?: number, callback?: () => void): void; - priority(options: StreamPriorityOptions): void; - setTimeout(msecs: number, callback?: () => void): void; - sendTrailers(headers: OutgoingHttpHeaders): void; - - addListener(event: "aborted", listener: () => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: "streamClosed", listener: (code: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "wantTrailers", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "aborted"): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "frameError", frameType: number, errorCode: number): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: "streamClosed", code: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "wantTrailers"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "aborted", listener: () => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: "streamClosed", listener: (code: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "wantTrailers", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "aborted", listener: () => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: "streamClosed", listener: (code: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "wantTrailers", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "aborted", listener: () => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "streamClosed", listener: (code: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "wantTrailers", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "aborted", listener: () => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "wantTrailers", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ClientHttp2Stream extends Http2Stream { - addListener(event: "continue", listener: () => {}): this; - addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "continue"): boolean; - emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "continue", listener: () => {}): this; - on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "continue", listener: () => {}): this; - once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "continue", listener: () => {}): this; - prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "continue", listener: () => {}): this; - prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ServerHttp2Stream extends Http2Stream { - readonly headersSent: boolean; - readonly pushAllowed: boolean; - additionalHeaders(headers: OutgoingHttpHeaders): void; - pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; - pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; - respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; - respondWithFD(fd: number | fs.promises.FileHandle, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; - respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; - } - - // Http2Session - - export interface Settings { - headerTableSize?: number; - enablePush?: boolean; - initialWindowSize?: number; - maxFrameSize?: number; - maxConcurrentStreams?: number; - maxHeaderListSize?: number; - enableConnectProtocol?: boolean; - } - - export interface ClientSessionRequestOptions { - endStream?: boolean; - exclusive?: boolean; - parent?: number; - weight?: number; - waitForTrailers?: boolean; - } - - export interface SessionState { - effectiveLocalWindowSize?: number; - effectiveRecvDataLength?: number; - nextStreamID?: number; - localWindowSize?: number; - lastProcStreamID?: number; - remoteWindowSize?: number; - outboundQueueSize?: number; - deflateDynamicTableSize?: number; - inflateDynamicTableSize?: number; - } - - export interface Http2Session extends events.EventEmitter { - readonly alpnProtocol?: string; - readonly closed: boolean; - readonly connecting: boolean; - readonly destroyed: boolean; - readonly encrypted?: boolean; - readonly localSettings: Settings; - readonly originSet?: string[]; - readonly pendingSettingsAck: boolean; - readonly remoteSettings: Settings; - readonly socket: net.Socket | tls.TLSSocket; - readonly state: SessionState; - readonly type: number; - - close(callback?: () => void): void; - destroy(error?: Error, code?: number): void; - goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; - ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ping(payload: NodeJS.ArrayBufferView, callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ref(): void; - setTimeout(msecs: number, callback?: () => void): void; - settings(settings: Settings): void; - unref(): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - addListener(event: "localSettings", listener: (settings: Settings) => void): this; - addListener(event: "ping", listener: () => void): this; - addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; - emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; - emit(event: "localSettings", settings: Settings): boolean; - emit(event: "ping"): boolean; - emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - on(event: "localSettings", listener: (settings: Settings) => void): this; - on(event: "ping", listener: () => void): this; - on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - once(event: "localSettings", listener: (settings: Settings) => void): this; - once(event: "ping", listener: () => void): this; - once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - prependListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependListener(event: "ping", listener: () => void): this; - prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "ping", listener: () => void): this; - prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ClientHttp2Session extends Http2Session { - request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; - - addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - addListener(event: "origin", listener: (origins: string[]) => void): this; - addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; - emit(event: "origin", origins: ReadonlyArray): boolean; - emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - on(event: "origin", listener: (origins: string[]) => void): this; - on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - once(event: "origin", listener: (origins: string[]) => void): this; - once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependListener(event: "origin", listener: (origins: string[]) => void): this; - prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependOnceListener(event: "origin", listener: (origins: string[]) => void): this; - prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface AlternativeServiceOptions { - origin: number | string | url.URL; - } - - export interface ServerHttp2Session extends Http2Session { - readonly server: Http2Server | Http2SecureServer; - - altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; - origin(...args: Array): void; - - addListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - // Http2Server - - export interface SessionOptions { - maxDeflateDynamicTableSize?: number; - maxSessionMemory?: number; - maxHeaderListPairs?: number; - maxOutstandingPings?: number; - maxSendHeaderBlockLength?: number; - paddingStrategy?: number; - peerMaxConcurrentStreams?: number; - settings?: Settings; - - selectPadding?(frameLen: number, maxFrameLen: number): number; - createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex; - } - - export interface ClientSessionOptions extends SessionOptions { - maxReservedRemoteStreams?: number; - createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex; - protocol?: 'http:' | 'https:'; - } - - export interface ServerSessionOptions extends SessionOptions { - Http1IncomingMessage?: typeof IncomingMessage; - Http1ServerResponse?: typeof ServerResponse; - Http2ServerRequest?: typeof Http2ServerRequest; - Http2ServerResponse?: typeof Http2ServerResponse; - } - - export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { } - export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { } - - export interface ServerOptions extends ServerSessionOptions { } - - export interface SecureServerOptions extends SecureServerSessionOptions { - allowHTTP1?: boolean; - origins?: string[]; - } - - export interface Http2Server extends net.Server { - addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - setTimeout(msec?: number, callback?: () => void): this; - } - - export interface Http2SecureServer extends tls.Server { - addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - setTimeout(msec?: number, callback?: () => void): this; - } - - export class Http2ServerRequest extends stream.Readable { - constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray); - - readonly aborted: boolean; - readonly authority: string; - readonly connection: net.Socket | tls.TLSSocket; - readonly complete: boolean; - readonly headers: IncomingHttpHeaders; - readonly httpVersion: string; - readonly httpVersionMinor: number; - readonly httpVersionMajor: number; - readonly method: string; - readonly rawHeaders: string[]; - readonly rawTrailers: string[]; - readonly scheme: string; - readonly socket: net.Socket | tls.TLSSocket; - readonly stream: ServerHttp2Stream; - readonly trailers: IncomingHttpHeaders; - readonly url: string; - - setTimeout(msecs: number, callback?: () => void): void; - read(size?: number): Buffer | string | null; - - addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "aborted", hadError: boolean, code: number): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "end"): boolean; - emit(event: "readable"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export class Http2ServerResponse extends stream.Stream { - constructor(stream: ServerHttp2Stream); - - readonly connection: net.Socket | tls.TLSSocket; - readonly finished: boolean; - readonly headersSent: boolean; - readonly socket: net.Socket | tls.TLSSocket; - readonly stream: ServerHttp2Stream; - sendDate: boolean; - statusCode: number; - statusMessage: ''; - addTrailers(trailers: OutgoingHttpHeaders): void; - end(callback?: () => void): void; - end(data: string | Uint8Array, callback?: () => void): void; - end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): void; - getHeader(name: string): string; - getHeaderNames(): string[]; - getHeaders(): OutgoingHttpHeaders; - hasHeader(name: string): boolean; - removeHeader(name: string): void; - setHeader(name: string, value: number | string | ReadonlyArray): void; - setTimeout(msecs: number, callback?: () => void): void; - write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; - write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean; - writeContinue(): void; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; - createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - // Public API - - export namespace constants { - const NGHTTP2_SESSION_SERVER: number; - const NGHTTP2_SESSION_CLIENT: number; - const NGHTTP2_STREAM_STATE_IDLE: number; - const NGHTTP2_STREAM_STATE_OPEN: number; - const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; - const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; - const NGHTTP2_STREAM_STATE_CLOSED: number; - const NGHTTP2_NO_ERROR: number; - const NGHTTP2_PROTOCOL_ERROR: number; - const NGHTTP2_INTERNAL_ERROR: number; - const NGHTTP2_FLOW_CONTROL_ERROR: number; - const NGHTTP2_SETTINGS_TIMEOUT: number; - const NGHTTP2_STREAM_CLOSED: number; - const NGHTTP2_FRAME_SIZE_ERROR: number; - const NGHTTP2_REFUSED_STREAM: number; - const NGHTTP2_CANCEL: number; - const NGHTTP2_COMPRESSION_ERROR: number; - const NGHTTP2_CONNECT_ERROR: number; - const NGHTTP2_ENHANCE_YOUR_CALM: number; - const NGHTTP2_INADEQUATE_SECURITY: number; - const NGHTTP2_HTTP_1_1_REQUIRED: number; - const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; - const NGHTTP2_FLAG_NONE: number; - const NGHTTP2_FLAG_END_STREAM: number; - const NGHTTP2_FLAG_END_HEADERS: number; - const NGHTTP2_FLAG_ACK: number; - const NGHTTP2_FLAG_PADDED: number; - const NGHTTP2_FLAG_PRIORITY: number; - const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; - const DEFAULT_SETTINGS_ENABLE_PUSH: number; - const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; - const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; - const MAX_MAX_FRAME_SIZE: number; - const MIN_MAX_FRAME_SIZE: number; - const MAX_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_DEFAULT_WEIGHT: number; - const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; - const NGHTTP2_SETTINGS_ENABLE_PUSH: number; - const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; - const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; - const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; - const PADDING_STRATEGY_NONE: number; - const PADDING_STRATEGY_MAX: number; - const PADDING_STRATEGY_CALLBACK: number; - const HTTP2_HEADER_STATUS: string; - const HTTP2_HEADER_METHOD: string; - const HTTP2_HEADER_AUTHORITY: string; - const HTTP2_HEADER_SCHEME: string; - const HTTP2_HEADER_PATH: string; - const HTTP2_HEADER_ACCEPT_CHARSET: string; - const HTTP2_HEADER_ACCEPT_ENCODING: string; - const HTTP2_HEADER_ACCEPT_LANGUAGE: string; - const HTTP2_HEADER_ACCEPT_RANGES: string; - const HTTP2_HEADER_ACCEPT: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; - const HTTP2_HEADER_AGE: string; - const HTTP2_HEADER_ALLOW: string; - const HTTP2_HEADER_AUTHORIZATION: string; - const HTTP2_HEADER_CACHE_CONTROL: string; - const HTTP2_HEADER_CONNECTION: string; - const HTTP2_HEADER_CONTENT_DISPOSITION: string; - const HTTP2_HEADER_CONTENT_ENCODING: string; - const HTTP2_HEADER_CONTENT_LANGUAGE: string; - const HTTP2_HEADER_CONTENT_LENGTH: string; - const HTTP2_HEADER_CONTENT_LOCATION: string; - const HTTP2_HEADER_CONTENT_MD5: string; - const HTTP2_HEADER_CONTENT_RANGE: string; - const HTTP2_HEADER_CONTENT_TYPE: string; - const HTTP2_HEADER_COOKIE: string; - const HTTP2_HEADER_DATE: string; - const HTTP2_HEADER_ETAG: string; - const HTTP2_HEADER_EXPECT: string; - const HTTP2_HEADER_EXPIRES: string; - const HTTP2_HEADER_FROM: string; - const HTTP2_HEADER_HOST: string; - const HTTP2_HEADER_IF_MATCH: string; - const HTTP2_HEADER_IF_MODIFIED_SINCE: string; - const HTTP2_HEADER_IF_NONE_MATCH: string; - const HTTP2_HEADER_IF_RANGE: string; - const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; - const HTTP2_HEADER_LAST_MODIFIED: string; - const HTTP2_HEADER_LINK: string; - const HTTP2_HEADER_LOCATION: string; - const HTTP2_HEADER_MAX_FORWARDS: string; - const HTTP2_HEADER_PREFER: string; - const HTTP2_HEADER_PROXY_AUTHENTICATE: string; - const HTTP2_HEADER_PROXY_AUTHORIZATION: string; - const HTTP2_HEADER_RANGE: string; - const HTTP2_HEADER_REFERER: string; - const HTTP2_HEADER_REFRESH: string; - const HTTP2_HEADER_RETRY_AFTER: string; - const HTTP2_HEADER_SERVER: string; - const HTTP2_HEADER_SET_COOKIE: string; - const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; - const HTTP2_HEADER_TRANSFER_ENCODING: string; - const HTTP2_HEADER_TE: string; - const HTTP2_HEADER_UPGRADE: string; - const HTTP2_HEADER_USER_AGENT: string; - const HTTP2_HEADER_VARY: string; - const HTTP2_HEADER_VIA: string; - const HTTP2_HEADER_WWW_AUTHENTICATE: string; - const HTTP2_HEADER_HTTP2_SETTINGS: string; - const HTTP2_HEADER_KEEP_ALIVE: string; - const HTTP2_HEADER_PROXY_CONNECTION: string; - const HTTP2_METHOD_ACL: string; - const HTTP2_METHOD_BASELINE_CONTROL: string; - const HTTP2_METHOD_BIND: string; - const HTTP2_METHOD_CHECKIN: string; - const HTTP2_METHOD_CHECKOUT: string; - const HTTP2_METHOD_CONNECT: string; - const HTTP2_METHOD_COPY: string; - const HTTP2_METHOD_DELETE: string; - const HTTP2_METHOD_GET: string; - const HTTP2_METHOD_HEAD: string; - const HTTP2_METHOD_LABEL: string; - const HTTP2_METHOD_LINK: string; - const HTTP2_METHOD_LOCK: string; - const HTTP2_METHOD_MERGE: string; - const HTTP2_METHOD_MKACTIVITY: string; - const HTTP2_METHOD_MKCALENDAR: string; - const HTTP2_METHOD_MKCOL: string; - const HTTP2_METHOD_MKREDIRECTREF: string; - const HTTP2_METHOD_MKWORKSPACE: string; - const HTTP2_METHOD_MOVE: string; - const HTTP2_METHOD_OPTIONS: string; - const HTTP2_METHOD_ORDERPATCH: string; - const HTTP2_METHOD_PATCH: string; - const HTTP2_METHOD_POST: string; - const HTTP2_METHOD_PRI: string; - const HTTP2_METHOD_PROPFIND: string; - const HTTP2_METHOD_PROPPATCH: string; - const HTTP2_METHOD_PUT: string; - const HTTP2_METHOD_REBIND: string; - const HTTP2_METHOD_REPORT: string; - const HTTP2_METHOD_SEARCH: string; - const HTTP2_METHOD_TRACE: string; - const HTTP2_METHOD_UNBIND: string; - const HTTP2_METHOD_UNCHECKOUT: string; - const HTTP2_METHOD_UNLINK: string; - const HTTP2_METHOD_UNLOCK: string; - const HTTP2_METHOD_UPDATE: string; - const HTTP2_METHOD_UPDATEREDIRECTREF: string; - const HTTP2_METHOD_VERSION_CONTROL: string; - const HTTP_STATUS_CONTINUE: number; - const HTTP_STATUS_SWITCHING_PROTOCOLS: number; - const HTTP_STATUS_PROCESSING: number; - const HTTP_STATUS_OK: number; - const HTTP_STATUS_CREATED: number; - const HTTP_STATUS_ACCEPTED: number; - const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; - const HTTP_STATUS_NO_CONTENT: number; - const HTTP_STATUS_RESET_CONTENT: number; - const HTTP_STATUS_PARTIAL_CONTENT: number; - const HTTP_STATUS_MULTI_STATUS: number; - const HTTP_STATUS_ALREADY_REPORTED: number; - const HTTP_STATUS_IM_USED: number; - const HTTP_STATUS_MULTIPLE_CHOICES: number; - const HTTP_STATUS_MOVED_PERMANENTLY: number; - const HTTP_STATUS_FOUND: number; - const HTTP_STATUS_SEE_OTHER: number; - const HTTP_STATUS_NOT_MODIFIED: number; - const HTTP_STATUS_USE_PROXY: number; - const HTTP_STATUS_TEMPORARY_REDIRECT: number; - const HTTP_STATUS_PERMANENT_REDIRECT: number; - const HTTP_STATUS_BAD_REQUEST: number; - const HTTP_STATUS_UNAUTHORIZED: number; - const HTTP_STATUS_PAYMENT_REQUIRED: number; - const HTTP_STATUS_FORBIDDEN: number; - const HTTP_STATUS_NOT_FOUND: number; - const HTTP_STATUS_METHOD_NOT_ALLOWED: number; - const HTTP_STATUS_NOT_ACCEPTABLE: number; - const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; - const HTTP_STATUS_REQUEST_TIMEOUT: number; - const HTTP_STATUS_CONFLICT: number; - const HTTP_STATUS_GONE: number; - const HTTP_STATUS_LENGTH_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_FAILED: number; - const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; - const HTTP_STATUS_URI_TOO_LONG: number; - const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; - const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; - const HTTP_STATUS_EXPECTATION_FAILED: number; - const HTTP_STATUS_TEAPOT: number; - const HTTP_STATUS_MISDIRECTED_REQUEST: number; - const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; - const HTTP_STATUS_LOCKED: number; - const HTTP_STATUS_FAILED_DEPENDENCY: number; - const HTTP_STATUS_UNORDERED_COLLECTION: number; - const HTTP_STATUS_UPGRADE_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_REQUIRED: number; - const HTTP_STATUS_TOO_MANY_REQUESTS: number; - const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; - const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; - const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; - const HTTP_STATUS_NOT_IMPLEMENTED: number; - const HTTP_STATUS_BAD_GATEWAY: number; - const HTTP_STATUS_SERVICE_UNAVAILABLE: number; - const HTTP_STATUS_GATEWAY_TIMEOUT: number; - const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; - const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; - const HTTP_STATUS_INSUFFICIENT_STORAGE: number; - const HTTP_STATUS_LOOP_DETECTED: number; - const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; - const HTTP_STATUS_NOT_EXTENDED: number; - const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; - } - - export function getDefaultSettings(): Settings; - export function getPackedSettings(settings: Settings): Buffer; - export function getUnpackedSettings(buf: Uint8Array): Settings; - - export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; - export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; - - export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; - export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; - - export function connect(authority: string | url.URL, listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session; - export function connect( - authority: string | url.URL, - options?: ClientSessionOptions | SecureClientSessionOptions, - listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void - ): ClientHttp2Session; -} diff --git a/node_modules/@types/node/https.d.ts b/node_modules/@types/node/https.d.ts deleted file mode 100644 index 24326c9d..00000000 --- a/node_modules/@types/node/https.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare module "https" { - import * as tls from "tls"; - import * as events from "events"; - import * as http from "http"; - import { URL } from "url"; - - type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; - - type RequestOptions = http.RequestOptions & tls.SecureContextOptions & { - rejectUnauthorized?: boolean; // Defaults to true - servername?: string; // SNI TLS Extension - }; - - interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { - rejectUnauthorized?: boolean; - maxCachedSessions?: number; - } - - class Agent extends http.Agent { - constructor(options?: AgentOptions); - options: AgentOptions; - } - - interface Server extends http.HttpBase {} - class Server extends tls.Server { - constructor(requestListener?: http.RequestListener); - constructor(options: ServerOptions, requestListener?: http.RequestListener); - } - - function createServer(requestListener?: http.RequestListener): Server; - function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server; - function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - let globalAgent: Agent; -} diff --git a/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts deleted file mode 100644 index af956eed..00000000 --- a/node_modules/@types/node/index.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -// Type definitions for non-npm package Node.js 14.14 -// Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped -// Alberto Schiabel -// Alexander T. -// Alvis HT Tang -// Andrew Makarov -// Benjamin Toueg -// Bruno Scheufler -// Chigozirim C. -// David Junger -// Deividas Bakanas -// Eugene Y. Q. Shen -// Flarna -// Hannes Magnusson -// Hoàng Văn Khải -// Huw -// Kelvin Jin -// Klaus Meinhardt -// Lishude -// Mariusz Wiktorczyk -// Mohsen Azimi -// Nicolas Even -// Nikita Galkin -// Parambir Singh -// Sebastian Silbermann -// Simon Schick -// Thomas den Hollander -// Wilco Bakker -// wwwy3y3 -// Samuel Ainsworth -// Kyle Uehlein -// Jordi Oliveras Rovira -// Thanik Bhongbhibhat -// Marcin Kopacz -// Trivikram Kamat -// Minh Son Nguyen -// Junxiao Shi -// Ilia Baryshnikov -// ExE Boss -// Surasak Chaisurin -// Piotr Błażejewicz -// Anna Henningsen -// Jason Kwok -// Victor Perin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// NOTE: These definitions support NodeJS and TypeScript 3.7. -// Typically type modifications should be made in base.d.ts instead of here - -/// - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.8 -// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5 - -// NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides -// within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions -// prior to TypeScript 3.5, so the older definitions will be found here. diff --git a/node_modules/@types/node/inspector.d.ts b/node_modules/@types/node/inspector.d.ts deleted file mode 100644 index 1c577346..00000000 --- a/node_modules/@types/node/inspector.d.ts +++ /dev/null @@ -1,3041 +0,0 @@ -// tslint:disable-next-line:dt-header -// Type definitions for inspector - -// These definitions are auto-generated. -// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330 -// for more information. - -// tslint:disable:max-line-length - -/** - * The inspector module provides an API for interacting with the V8 inspector. - */ -declare module "inspector" { - import { EventEmitter } from 'events'; - - interface InspectorNotification { - method: string; - params: T; - } - - namespace Schema { - /** - * Description of the protocol domain. - */ - interface Domain { - /** - * Domain name. - */ - name: string; - /** - * Domain version. - */ - version: string; - } - - interface GetDomainsReturnType { - /** - * List of supported domains. - */ - domains: Domain[]; - } - } - - namespace Runtime { - /** - * Unique script identifier. - */ - type ScriptId = string; - - /** - * Unique object identifier. - */ - type RemoteObjectId = string; - - /** - * Primitive value which cannot be JSON-stringified. - */ - type UnserializableValue = string; - - /** - * Mirror object referencing original JavaScript object. - */ - interface RemoteObject { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - /** - * Object class (constructor) name. Specified for object type values only. - */ - className?: string; - /** - * Remote object value in case of primitive values or JSON values (if it was requested). - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified does not have value, but gets this property. - */ - unserializableValue?: UnserializableValue; - /** - * String representation of the object. - */ - description?: string; - /** - * Unique object identifier (for non-primitive values). - */ - objectId?: RemoteObjectId; - /** - * Preview containing abbreviated property values. Specified for object type values only. - * @experimental - */ - preview?: ObjectPreview; - /** - * @experimental - */ - customPreview?: CustomPreview; - } - - /** - * @experimental - */ - interface CustomPreview { - header: string; - hasBody: boolean; - formatterObjectId: RemoteObjectId; - bindRemoteObjectFunctionId: RemoteObjectId; - configObjectId?: RemoteObjectId; - } - - /** - * Object containing abbreviated remote object value. - * @experimental - */ - interface ObjectPreview { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - /** - * String representation of the object. - */ - description?: string; - /** - * True iff some of the properties or entries of the original object did not fit. - */ - overflow: boolean; - /** - * List of the properties. - */ - properties: PropertyPreview[]; - /** - * List of the entries. Specified for map and set subtype values only. - */ - entries?: EntryPreview[]; - } - - /** - * @experimental - */ - interface PropertyPreview { - /** - * Property name. - */ - name: string; - /** - * Object type. Accessor means that the property itself is an accessor property. - */ - type: string; - /** - * User-friendly property value string. - */ - value?: string; - /** - * Nested value preview. - */ - valuePreview?: ObjectPreview; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - } - - /** - * @experimental - */ - interface EntryPreview { - /** - * Preview of the key. Specified for map-like collection entries. - */ - key?: ObjectPreview; - /** - * Preview of the value. - */ - value: ObjectPreview; - } - - /** - * Object property descriptor. - */ - interface PropertyDescriptor { - /** - * Property name or symbol description. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject; - /** - * True if the value associated with the property may be changed (data descriptors only). - */ - writable?: boolean; - /** - * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). - */ - get?: RemoteObject; - /** - * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). - */ - set?: RemoteObject; - /** - * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. - */ - configurable: boolean; - /** - * True if this property shows up during enumeration of the properties on the corresponding object. - */ - enumerable: boolean; - /** - * True if the result was thrown during the evaluation. - */ - wasThrown?: boolean; - /** - * True if the property is owned for the object. - */ - isOwn?: boolean; - /** - * Property symbol object, if the property is of the symbol type. - */ - symbol?: RemoteObject; - } - - /** - * Object internal property descriptor. This property isn't normally visible in JavaScript code. - */ - interface InternalPropertyDescriptor { - /** - * Conventional property name. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject; - } - - /** - * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. - */ - interface CallArgument { - /** - * Primitive value or serializable javascript object. - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified. - */ - unserializableValue?: UnserializableValue; - /** - * Remote object handle. - */ - objectId?: RemoteObjectId; - } - - /** - * Id of an execution context. - */ - type ExecutionContextId = number; - - /** - * Description of an isolated world. - */ - interface ExecutionContextDescription { - /** - * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. - */ - id: ExecutionContextId; - /** - * Execution context origin. - */ - origin: string; - /** - * Human readable name describing given context. - */ - name: string; - /** - * Embedder-specific auxiliary data. - */ - auxData?: {}; - } - - /** - * Detailed information about exception (or error) that was thrown during script compilation or execution. - */ - interface ExceptionDetails { - /** - * Exception id. - */ - exceptionId: number; - /** - * Exception text, which should be used together with exception object when available. - */ - text: string; - /** - * Line number of the exception location (0-based). - */ - lineNumber: number; - /** - * Column number of the exception location (0-based). - */ - columnNumber: number; - /** - * Script ID of the exception location. - */ - scriptId?: ScriptId; - /** - * URL of the exception location, to be used when the script was not reported. - */ - url?: string; - /** - * JavaScript stack trace if available. - */ - stackTrace?: StackTrace; - /** - * Exception object if available. - */ - exception?: RemoteObject; - /** - * Identifier of the context where exception happened. - */ - executionContextId?: ExecutionContextId; - } - - /** - * Number of milliseconds since epoch. - */ - type Timestamp = number; - - /** - * Stack entry for runtime errors and assertions. - */ - interface CallFrame { - /** - * JavaScript function name. - */ - functionName: string; - /** - * JavaScript script id. - */ - scriptId: ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * JavaScript script line number (0-based). - */ - lineNumber: number; - /** - * JavaScript script column number (0-based). - */ - columnNumber: number; - } - - /** - * Call frames for assertions or error messages. - */ - interface StackTrace { - /** - * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. - */ - description?: string; - /** - * JavaScript function name. - */ - callFrames: CallFrame[]; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - */ - parent?: StackTrace; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - * @experimental - */ - parentId?: StackTraceId; - } - - /** - * Unique identifier of current debugger. - * @experimental - */ - type UniqueDebuggerId = string; - - /** - * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. - * @experimental - */ - interface StackTraceId { - id: string; - debuggerId?: UniqueDebuggerId; - } - - interface EvaluateParameterType { - /** - * Expression to evaluate. - */ - expression: string; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - contextId?: ExecutionContextId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - } - - interface AwaitPromiseParameterType { - /** - * Identifier of the promise. - */ - promiseObjectId: RemoteObjectId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean; - } - - interface CallFunctionOnParameterType { - /** - * Declaration of the function to call. - */ - functionDeclaration: string; - /** - * Identifier of the object to call function on. Either objectId or executionContextId should be specified. - */ - objectId?: RemoteObjectId; - /** - * Call arguments. All call arguments must belong to the same JavaScript world as the target object. - */ - arguments?: CallArgument[]; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - /** - * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. - */ - executionContextId?: ExecutionContextId; - /** - * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. - */ - objectGroup?: string; - } - - interface GetPropertiesParameterType { - /** - * Identifier of the object to return properties for. - */ - objectId: RemoteObjectId; - /** - * If true, returns properties belonging only to the element itself, not to its prototype chain. - */ - ownProperties?: boolean; - /** - * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - * @experimental - */ - accessorPropertiesOnly?: boolean; - /** - * Whether preview should be generated for the results. - * @experimental - */ - generatePreview?: boolean; - } - - interface ReleaseObjectParameterType { - /** - * Identifier of the object to release. - */ - objectId: RemoteObjectId; - } - - interface ReleaseObjectGroupParameterType { - /** - * Symbolic object group name. - */ - objectGroup: string; - } - - interface SetCustomObjectFormatterEnabledParameterType { - enabled: boolean; - } - - interface CompileScriptParameterType { - /** - * Expression to compile. - */ - expression: string; - /** - * Source url to be set for the script. - */ - sourceURL: string; - /** - * Specifies whether the compiled script should be persisted. - */ - persistScript: boolean; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId; - } - - interface RunScriptParameterType { - /** - * Id of the script to run. - */ - scriptId: ScriptId; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - } - - interface QueryObjectsParameterType { - /** - * Identifier of the prototype to return objects for. - */ - prototypeObjectId: RemoteObjectId; - } - - interface GlobalLexicalScopeNamesParameterType { - /** - * Specifies in which execution context to lookup global scope variables. - */ - executionContextId?: ExecutionContextId; - } - - interface EvaluateReturnType { - /** - * Evaluation result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface AwaitPromiseReturnType { - /** - * Promise result. Will contain rejected value if promise was rejected. - */ - result: RemoteObject; - /** - * Exception details if stack strace is available. - */ - exceptionDetails?: ExceptionDetails; - } - - interface CallFunctionOnReturnType { - /** - * Call result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface GetPropertiesReturnType { - /** - * Object properties. - */ - result: PropertyDescriptor[]; - /** - * Internal object properties (only of the element itself). - */ - internalProperties?: InternalPropertyDescriptor[]; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface CompileScriptReturnType { - /** - * Id of the script. - */ - scriptId?: ScriptId; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface RunScriptReturnType { - /** - * Run result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface QueryObjectsReturnType { - /** - * Array with objects. - */ - objects: RemoteObject; - } - - interface GlobalLexicalScopeNamesReturnType { - names: string[]; - } - - interface ExecutionContextCreatedEventDataType { - /** - * A newly created execution context. - */ - context: ExecutionContextDescription; - } - - interface ExecutionContextDestroyedEventDataType { - /** - * Id of the destroyed context - */ - executionContextId: ExecutionContextId; - } - - interface ExceptionThrownEventDataType { - /** - * Timestamp of the exception. - */ - timestamp: Timestamp; - exceptionDetails: ExceptionDetails; - } - - interface ExceptionRevokedEventDataType { - /** - * Reason describing why exception was revoked. - */ - reason: string; - /** - * The id of revoked exception, as reported in exceptionThrown. - */ - exceptionId: number; - } - - interface ConsoleAPICalledEventDataType { - /** - * Type of the call. - */ - type: string; - /** - * Call arguments. - */ - args: RemoteObject[]; - /** - * Identifier of the context where the call was made. - */ - executionContextId: ExecutionContextId; - /** - * Call timestamp. - */ - timestamp: Timestamp; - /** - * Stack trace captured when the call was made. - */ - stackTrace?: StackTrace; - /** - * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. - * @experimental - */ - context?: string; - } - - interface InspectRequestedEventDataType { - object: RemoteObject; - hints: {}; - } - } - - namespace Debugger { - /** - * Breakpoint identifier. - */ - type BreakpointId = string; - - /** - * Call frame identifier. - */ - type CallFrameId = string; - - /** - * Location in the source code. - */ - interface Location { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - } - - /** - * Location in the source code. - * @experimental - */ - interface ScriptPosition { - lineNumber: number; - columnNumber: number; - } - - /** - * JavaScript call frame. Array of call frames form the call stack. - */ - interface CallFrame { - /** - * Call frame identifier. This identifier is only valid while the virtual machine is paused. - */ - callFrameId: CallFrameId; - /** - * Name of the JavaScript function called on this call frame. - */ - functionName: string; - /** - * Location in the source code. - */ - functionLocation?: Location; - /** - * Location in the source code. - */ - location: Location; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Scope chain for this call frame. - */ - scopeChain: Scope[]; - /** - * this object for this call frame. - */ - this: Runtime.RemoteObject; - /** - * The value being returned, if the function is at return point. - */ - returnValue?: Runtime.RemoteObject; - } - - /** - * Scope description. - */ - interface Scope { - /** - * Scope type. - */ - type: string; - /** - * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. - */ - object: Runtime.RemoteObject; - name?: string; - /** - * Location in the source code where scope starts - */ - startLocation?: Location; - /** - * Location in the source code where scope ends - */ - endLocation?: Location; - } - - /** - * Search match for resource. - */ - interface SearchMatch { - /** - * Line number in resource content. - */ - lineNumber: number; - /** - * Line with match content. - */ - lineContent: string; - } - - interface BreakLocation { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - type?: string; - } - - interface SetBreakpointsActiveParameterType { - /** - * New value for breakpoints active state. - */ - active: boolean; - } - - interface SetSkipAllPausesParameterType { - /** - * New value for skip pauses state. - */ - skip: boolean; - } - - interface SetBreakpointByUrlParameterType { - /** - * Line number to set breakpoint at. - */ - lineNumber: number; - /** - * URL of the resources to set breakpoint on. - */ - url?: string; - /** - * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. - */ - urlRegex?: string; - /** - * Script hash of the resources to set breakpoint on. - */ - scriptHash?: string; - /** - * Offset in the line to set breakpoint at. - */ - columnNumber?: number; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - interface SetBreakpointParameterType { - /** - * Location to set breakpoint in. - */ - location: Location; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - interface RemoveBreakpointParameterType { - breakpointId: BreakpointId; - } - - interface GetPossibleBreakpointsParameterType { - /** - * Start of range to search possible breakpoint locations in. - */ - start: Location; - /** - * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. - */ - end?: Location; - /** - * Only consider locations which are in the same (non-nested) function as start. - */ - restrictToFunction?: boolean; - } - - interface ContinueToLocationParameterType { - /** - * Location to continue to. - */ - location: Location; - targetCallFrames?: string; - } - - interface PauseOnAsyncCallParameterType { - /** - * Debugger will pause when async call with given stack trace is started. - */ - parentStackTraceId: Runtime.StackTraceId; - } - - interface StepIntoParameterType { - /** - * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. - * @experimental - */ - breakOnAsyncCall?: boolean; - } - - interface GetStackTraceParameterType { - stackTraceId: Runtime.StackTraceId; - } - - interface SearchInContentParameterType { - /** - * Id of the script to search in. - */ - scriptId: Runtime.ScriptId; - /** - * String to search for. - */ - query: string; - /** - * If true, search is case sensitive. - */ - caseSensitive?: boolean; - /** - * If true, treats string parameter as regex. - */ - isRegex?: boolean; - } - - interface SetScriptSourceParameterType { - /** - * Id of the script to edit. - */ - scriptId: Runtime.ScriptId; - /** - * New content of the script. - */ - scriptSource: string; - /** - * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. - */ - dryRun?: boolean; - } - - interface RestartFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - } - - interface GetScriptSourceParameterType { - /** - * Id of the script to get source for. - */ - scriptId: Runtime.ScriptId; - } - - interface SetPauseOnExceptionsParameterType { - /** - * Pause on exceptions mode. - */ - state: string; - } - - interface EvaluateOnCallFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - /** - * Expression to evaluate. - */ - expression: string; - /** - * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). - */ - objectGroup?: string; - /** - * Specifies whether command line API should be available to the evaluated expression, defaults to false. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether to throw an exception if side effect cannot be ruled out during evaluation. - */ - throwOnSideEffect?: boolean; - } - - interface SetVariableValueParameterType { - /** - * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. - */ - scopeNumber: number; - /** - * Variable name. - */ - variableName: string; - /** - * New variable value. - */ - newValue: Runtime.CallArgument; - /** - * Id of callframe that holds variable. - */ - callFrameId: CallFrameId; - } - - interface SetReturnValueParameterType { - /** - * New return value. - */ - newValue: Runtime.CallArgument; - } - - interface SetAsyncCallStackDepthParameterType { - /** - * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). - */ - maxDepth: number; - } - - interface SetBlackboxPatternsParameterType { - /** - * Array of regexps that will be used to check script url for blackbox state. - */ - patterns: string[]; - } - - interface SetBlackboxedRangesParameterType { - /** - * Id of the script. - */ - scriptId: Runtime.ScriptId; - positions: ScriptPosition[]; - } - - interface EnableReturnType { - /** - * Unique identifier of the debugger. - * @experimental - */ - debuggerId: Runtime.UniqueDebuggerId; - } - - interface SetBreakpointByUrlReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * List of the locations this breakpoint resolved into upon addition. - */ - locations: Location[]; - } - - interface SetBreakpointReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * Location this breakpoint resolved into. - */ - actualLocation: Location; - } - - interface GetPossibleBreakpointsReturnType { - /** - * List of the possible breakpoint locations. - */ - locations: BreakLocation[]; - } - - interface GetStackTraceReturnType { - stackTrace: Runtime.StackTrace; - } - - interface SearchInContentReturnType { - /** - * List of search matches. - */ - result: SearchMatch[]; - } - - interface SetScriptSourceReturnType { - /** - * New stack trace in case editing has happened while VM was stopped. - */ - callFrames?: CallFrame[]; - /** - * Whether current call stack was modified after applying the changes. - */ - stackChanged?: boolean; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - /** - * Exception details if any. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - interface RestartFrameReturnType { - /** - * New stack trace. - */ - callFrames: CallFrame[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - } - - interface GetScriptSourceReturnType { - /** - * Script source. - */ - scriptSource: string; - } - - interface EvaluateOnCallFrameReturnType { - /** - * Object wrapper for the evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - interface ScriptParsedEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * True, if this script is generated as a result of the live edit operation. - * @experimental - */ - isLiveEdit?: boolean; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean; - /** - * This script length. - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - interface ScriptFailedToParseEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean; - /** - * This script length. - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - interface BreakpointResolvedEventDataType { - /** - * Breakpoint unique identifier. - */ - breakpointId: BreakpointId; - /** - * Actual breakpoint location. - */ - location: Location; - } - - interface PausedEventDataType { - /** - * Call stack the virtual machine stopped on. - */ - callFrames: CallFrame[]; - /** - * Pause reason. - */ - reason: string; - /** - * Object containing break-specific auxiliary properties. - */ - data?: {}; - /** - * Hit breakpoints IDs - */ - hitBreakpoints?: string[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - /** - * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. - * @experimental - */ - asyncCallStackTraceId?: Runtime.StackTraceId; - } - } - - namespace Console { - /** - * Console message. - */ - interface ConsoleMessage { - /** - * Message source. - */ - source: string; - /** - * Message severity. - */ - level: string; - /** - * Message text. - */ - text: string; - /** - * URL of the message origin. - */ - url?: string; - /** - * Line number in the resource that generated this message (1-based). - */ - line?: number; - /** - * Column number in the resource that generated this message (1-based). - */ - column?: number; - } - - interface MessageAddedEventDataType { - /** - * Console message that has been added. - */ - message: ConsoleMessage; - } - } - - namespace Profiler { - /** - * Profile node. Holds callsite information, execution statistics and child nodes. - */ - interface ProfileNode { - /** - * Unique id of the node. - */ - id: number; - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Number of samples where this node was on top of the call stack. - */ - hitCount?: number; - /** - * Child node ids. - */ - children?: number[]; - /** - * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. - */ - deoptReason?: string; - /** - * An array of source position ticks. - */ - positionTicks?: PositionTickInfo[]; - } - - /** - * Profile. - */ - interface Profile { - /** - * The list of profile nodes. First item is the root node. - */ - nodes: ProfileNode[]; - /** - * Profiling start timestamp in microseconds. - */ - startTime: number; - /** - * Profiling end timestamp in microseconds. - */ - endTime: number; - /** - * Ids of samples top nodes. - */ - samples?: number[]; - /** - * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. - */ - timeDeltas?: number[]; - } - - /** - * Specifies a number of samples attributed to a certain source position. - */ - interface PositionTickInfo { - /** - * Source line number (1-based). - */ - line: number; - /** - * Number of samples attributed to the source line. - */ - ticks: number; - } - - /** - * Coverage data for a source range. - */ - interface CoverageRange { - /** - * JavaScript script source offset for the range start. - */ - startOffset: number; - /** - * JavaScript script source offset for the range end. - */ - endOffset: number; - /** - * Collected execution count of the source range. - */ - count: number; - } - - /** - * Coverage data for a JavaScript function. - */ - interface FunctionCoverage { - /** - * JavaScript function name. - */ - functionName: string; - /** - * Source ranges inside the function with coverage data. - */ - ranges: CoverageRange[]; - /** - * Whether coverage data for this function has block granularity. - */ - isBlockCoverage: boolean; - } - - /** - * Coverage data for a JavaScript script. - */ - interface ScriptCoverage { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Functions contained in the script that has coverage data. - */ - functions: FunctionCoverage[]; - } - - /** - * Describes a type collected during runtime. - * @experimental - */ - interface TypeObject { - /** - * Name of a type collected with type profiling. - */ - name: string; - } - - /** - * Source offset and types for a parameter or return value. - * @experimental - */ - interface TypeProfileEntry { - /** - * Source offset of the parameter or end of function for return values. - */ - offset: number; - /** - * The types for this parameter or return value. - */ - types: TypeObject[]; - } - - /** - * Type profile data collected during runtime for a JavaScript script. - * @experimental - */ - interface ScriptTypeProfile { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Type profile entries for parameters and return values of the functions in the script. - */ - entries: TypeProfileEntry[]; - } - - interface SetSamplingIntervalParameterType { - /** - * New sampling interval in microseconds. - */ - interval: number; - } - - interface StartPreciseCoverageParameterType { - /** - * Collect accurate call counts beyond simple 'covered' or 'not covered'. - */ - callCount?: boolean; - /** - * Collect block-based coverage. - */ - detailed?: boolean; - } - - interface StopReturnType { - /** - * Recorded profile. - */ - profile: Profile; - } - - interface TakePreciseCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - - interface GetBestEffortCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - - interface TakeTypeProfileReturnType { - /** - * Type profile for all scripts since startTypeProfile() was turned on. - */ - result: ScriptTypeProfile[]; - } - - interface ConsoleProfileStartedEventDataType { - id: string; - /** - * Location of console.profile(). - */ - location: Debugger.Location; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - - interface ConsoleProfileFinishedEventDataType { - id: string; - /** - * Location of console.profileEnd(). - */ - location: Debugger.Location; - profile: Profile; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - } - - namespace HeapProfiler { - /** - * Heap snapshot object id. - */ - type HeapSnapshotObjectId = string; - - /** - * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - */ - interface SamplingHeapProfileNode { - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Allocations size in bytes for the node excluding children. - */ - selfSize: number; - /** - * Child nodes. - */ - children: SamplingHeapProfileNode[]; - } - - /** - * Profile. - */ - interface SamplingHeapProfile { - head: SamplingHeapProfileNode; - } - - interface StartTrackingHeapObjectsParameterType { - trackAllocations?: boolean; - } - - interface StopTrackingHeapObjectsParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. - */ - reportProgress?: boolean; - } - - interface TakeHeapSnapshotParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - */ - reportProgress?: boolean; - } - - interface GetObjectByHeapObjectIdParameterType { - objectId: HeapSnapshotObjectId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - } - - interface AddInspectedHeapObjectParameterType { - /** - * Heap snapshot object id to be accessible by means of $x command line API. - */ - heapObjectId: HeapSnapshotObjectId; - } - - interface GetHeapObjectIdParameterType { - /** - * Identifier of the object to get heap object id for. - */ - objectId: Runtime.RemoteObjectId; - } - - interface StartSamplingParameterType { - /** - * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. - */ - samplingInterval?: number; - } - - interface GetObjectByHeapObjectIdReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - } - - interface GetHeapObjectIdReturnType { - /** - * Id of the heap snapshot object corresponding to the passed remote object id. - */ - heapSnapshotObjectId: HeapSnapshotObjectId; - } - - interface StopSamplingReturnType { - /** - * Recorded sampling heap profile. - */ - profile: SamplingHeapProfile; - } - - interface GetSamplingProfileReturnType { - /** - * Return the sampling profile being collected. - */ - profile: SamplingHeapProfile; - } - - interface AddHeapSnapshotChunkEventDataType { - chunk: string; - } - - interface ReportHeapSnapshotProgressEventDataType { - done: number; - total: number; - finished?: boolean; - } - - interface LastSeenObjectIdEventDataType { - lastSeenObjectId: number; - timestamp: number; - } - - interface HeapStatsUpdateEventDataType { - /** - * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. - */ - statsUpdate: number[]; - } - } - - namespace NodeTracing { - interface TraceConfig { - /** - * Controls how the trace buffer stores data. - */ - recordMode?: string; - /** - * Included category filters. - */ - includedCategories: string[]; - } - - interface StartParameterType { - traceConfig: TraceConfig; - } - - interface GetCategoriesReturnType { - /** - * A list of supported tracing categories. - */ - categories: string[]; - } - - interface DataCollectedEventDataType { - value: Array<{}>; - } - } - - namespace NodeWorker { - type WorkerID = string; - - /** - * Unique identifier of attached debugging session. - */ - type SessionID = string; - - interface WorkerInfo { - workerId: WorkerID; - type: string; - title: string; - url: string; - } - - interface SendMessageToWorkerParameterType { - message: string; - /** - * Identifier of the session. - */ - sessionId: SessionID; - } - - interface EnableParameterType { - /** - * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - * message to run them. - */ - waitForDebuggerOnStart: boolean; - } - - interface DetachParameterType { - sessionId: SessionID; - } - - interface AttachedToWorkerEventDataType { - /** - * Identifier assigned to the session used to send/receive messages. - */ - sessionId: SessionID; - workerInfo: WorkerInfo; - waitingForDebugger: boolean; - } - - interface DetachedFromWorkerEventDataType { - /** - * Detached session identifier. - */ - sessionId: SessionID; - } - - interface ReceivedMessageFromWorkerEventDataType { - /** - * Identifier of a session which sends a message. - */ - sessionId: SessionID; - message: string; - } - } - - namespace NodeRuntime { - interface NotifyWhenWaitingForDisconnectParameterType { - enabled: boolean; - } - } - - /** - * The inspector.Session is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications. - */ - class Session extends EventEmitter { - /** - * Create a new instance of the inspector.Session class. - * The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend. - */ - constructor(); - - /** - * Connects a session to the inspector back-end. - * An exception will be thrown if there is already a connected session established either - * through the API or by a front-end connected to the Inspector WebSocket port. - */ - connect(): void; - - /** - * Immediately close the session. All pending message callbacks will be called with an error. - * session.connect() will need to be called to be able to send messages again. - * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. - */ - disconnect(): void; - - /** - * Posts a message to the inspector back-end. callback will be notified when a response is received. - * callback is a function that accepts two optional arguments - error and message-specific result. - */ - post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void; - post(method: string, callback?: (err: Error | null, params?: {}) => void): void; - - /** - * Returns supported domains. - */ - post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; - - /** - * Evaluates expression on global object. - */ - post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - post(method: "Runtime.evaluate", callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - - /** - * Add handler to promise with given promise object id. - */ - post(method: "Runtime.awaitPromise", params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - post(method: "Runtime.awaitPromise", callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - - /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.callFunctionOn", params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - post(method: "Runtime.callFunctionOn", callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - - /** - * Returns properties of a given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.getProperties", params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - post(method: "Runtime.getProperties", callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - - /** - * Releases remote object with given id. - */ - post(method: "Runtime.releaseObject", params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObject", callback?: (err: Error | null) => void): void; - - /** - * Releases all remote objects that belong to a given group. - */ - post(method: "Runtime.releaseObjectGroup", params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObjectGroup", callback?: (err: Error | null) => void): void; - - /** - * Tells inspected instance to run if it was waiting for debugger to attach. - */ - post(method: "Runtime.runIfWaitingForDebugger", callback?: (err: Error | null) => void): void; - - /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. - */ - post(method: "Runtime.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables reporting of execution contexts creation. - */ - post(method: "Runtime.disable", callback?: (err: Error | null) => void): void; - - /** - * Discards collected exceptions and console API calls. - */ - post(method: "Runtime.discardConsoleEntries", callback?: (err: Error | null) => void): void; - - /** - * @experimental - */ - post(method: "Runtime.setCustomObjectFormatterEnabled", params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.setCustomObjectFormatterEnabled", callback?: (err: Error | null) => void): void; - - /** - * Compiles expression. - */ - post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - post(method: "Runtime.compileScript", callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - - /** - * Runs script with given id in a given context. - */ - post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - - post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - - /** - * Returns all let, const and class variables from global scope. - */ - post( - method: "Runtime.globalLexicalScopeNames", - params?: Runtime.GlobalLexicalScopeNamesParameterType, - callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void - ): void; - post(method: "Runtime.globalLexicalScopeNames", callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; - - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: "Debugger.enable", callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; - - /** - * Disables debugger for given page. - */ - post(method: "Debugger.disable", callback?: (err: Error | null) => void): void; - - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBreakpointsActive", callback?: (err: Error | null) => void): void; - - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setSkipAllPauses", callback?: (err: Error | null) => void): void; - - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - post(method: "Debugger.setBreakpointByUrl", callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - post(method: "Debugger.setBreakpoint", callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - - /** - * Removes JavaScript breakpoint. - */ - post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.removeBreakpoint", callback?: (err: Error | null) => void): void; - - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. - */ - post( - method: "Debugger.getPossibleBreakpoints", - params?: Debugger.GetPossibleBreakpointsParameterType, - callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void - ): void; - post(method: "Debugger.getPossibleBreakpoints", callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - - /** - * Continues execution until specific location is reached. - */ - post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.continueToLocation", callback?: (err: Error | null) => void): void; - - /** - * @experimental - */ - post(method: "Debugger.pauseOnAsyncCall", params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.pauseOnAsyncCall", callback?: (err: Error | null) => void): void; - - /** - * Steps over the statement. - */ - post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void; - - /** - * Steps into the function call. - */ - post(method: "Debugger.stepInto", params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.stepInto", callback?: (err: Error | null) => void): void; - - /** - * Steps out of the function call. - */ - post(method: "Debugger.stepOut", callback?: (err: Error | null) => void): void; - - /** - * Stops on the next JavaScript statement. - */ - post(method: "Debugger.pause", callback?: (err: Error | null) => void): void; - - /** - * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: "Debugger.scheduleStepIntoAsync", callback?: (err: Error | null) => void): void; - - /** - * Resumes JavaScript execution. - */ - post(method: "Debugger.resume", callback?: (err: Error | null) => void): void; - - /** - * Returns stack trace with given stackTraceId. - * @experimental - */ - post(method: "Debugger.getStackTrace", params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - post(method: "Debugger.getStackTrace", callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - - /** - * Searches for given string in script content. - */ - post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - post(method: "Debugger.searchInContent", callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - - /** - * Edits JavaScript source live. - */ - post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - post(method: "Debugger.setScriptSource", callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - - /** - * Restarts particular call frame from the beginning. - */ - post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - post(method: "Debugger.restartFrame", callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - - /** - * Returns source for the script with given id. - */ - post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - post(method: "Debugger.getScriptSource", callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setPauseOnExceptions", callback?: (err: Error | null) => void): void; - - /** - * Evaluates expression on a given call frame. - */ - post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - post(method: "Debugger.evaluateOnCallFrame", callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setVariableValue", callback?: (err: Error | null) => void): void; - - /** - * Changes return value in top frame. Available only at return break position. - * @experimental - */ - post(method: "Debugger.setReturnValue", params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setReturnValue", callback?: (err: Error | null) => void): void; - - /** - * Enables or disables async call stacks tracking. - */ - post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setAsyncCallStackDepth", callback?: (err: Error | null) => void): void; - - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxPatterns", callback?: (err: Error | null) => void): void; - - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxedRanges", callback?: (err: Error | null) => void): void; - - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: "Console.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: "Console.disable", callback?: (err: Error | null) => void): void; - - /** - * Does nothing. - */ - post(method: "Console.clearMessages", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.disable", callback?: (err: Error | null) => void): void; - - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.setSamplingInterval", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.start", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.stop", callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; - - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - */ - post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.startPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - */ - post(method: "Profiler.stopPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - */ - post(method: "Profiler.takePreciseCoverage", callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; - - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - */ - post(method: "Profiler.getBestEffortCoverage", callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; - - /** - * Enable type profile. - * @experimental - */ - post(method: "Profiler.startTypeProfile", callback?: (err: Error | null) => void): void; - - /** - * Disable type profile. Disabling releases type profile data collected so far. - * @experimental - */ - post(method: "Profiler.stopTypeProfile", callback?: (err: Error | null) => void): void; - - /** - * Collect type profile. - * @experimental - */ - post(method: "Profiler.takeTypeProfile", callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; - - post(method: "HeapProfiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.disable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.stopTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.collectGarbage", callback?: (err: Error | null) => void): void; - - post( - method: "HeapProfiler.getObjectByHeapObjectId", - params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, - callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void - ): void; - post(method: "HeapProfiler.getObjectByHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.addInspectedHeapObject", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: "HeapProfiler.getHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - - post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startSampling", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; - - post(method: "HeapProfiler.getSamplingProfile", callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; - - /** - * Gets supported tracing categories. - */ - post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; - - /** - * Start trace events collection. - */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void; - - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void; - - /** - * Sends protocol message over session with given id. - */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void; - - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void; - - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void; - - /** - * Detached from the worker with given sessionId. - */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void; - - /** - * Enable the `NodeRuntime.waitingForDisconnect`. - */ - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", callback?: (err: Error | null) => void): void; - - // Events - - addListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - addListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - addListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - addListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - addListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - addListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - addListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "inspectorNotification", message: InspectorNotification<{}>): boolean; - emit(event: "Runtime.executionContextCreated", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextsCleared"): boolean; - emit(event: "Runtime.exceptionThrown", message: InspectorNotification): boolean; - emit(event: "Runtime.exceptionRevoked", message: InspectorNotification): boolean; - emit(event: "Runtime.consoleAPICalled", message: InspectorNotification): boolean; - emit(event: "Runtime.inspectRequested", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptParsed", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification): boolean; - emit(event: "Debugger.breakpointResolved", message: InspectorNotification): boolean; - emit(event: "Debugger.paused", message: InspectorNotification): boolean; - emit(event: "Debugger.resumed"): boolean; - emit(event: "Console.messageAdded", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.addHeapSnapshotChunk", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.resetProfiles"): boolean; - emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; - emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; - emit(event: "NodeTracing.tracingComplete"): boolean; - emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeRuntime.waitingForDisconnect"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - on(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - on(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - on(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - on(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - on(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - on(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.resetProfiles", listener: () => void): this; - on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - on(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - once(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - once(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - once(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - once(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - once(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - once(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.resetProfiles", listener: () => void): this; - once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - once(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - prependListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependOnceListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependOnceListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependOnceListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - prependOnceListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependOnceListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependOnceListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - } - - // Top Level API - - /** - * Activate inspector on host and port. Equivalent to node --inspect=[[host:]port], but can be done programatically after node has started. - * If wait is true, will block until a client has connected to the inspect port and flow control has been passed to the debugger client. - * @param port Port to listen on for inspector connections. Optional, defaults to what was specified on the CLI. - * @param host Host to listen on for inspector connections. Optional, defaults to what was specified on the CLI. - * @param wait Block until a client has connected. Optional, defaults to false. - */ - function open(port?: number, host?: string, wait?: boolean): void; - - /** - * Deactivate the inspector. Blocks until there are no active connections. - */ - function close(): void; - - /** - * Return the URL of the active inspector, or `undefined` if there is none. - */ - function url(): string | undefined; - - /** - * Blocks until a client (existing or connected later) has sent - * `Runtime.runIfWaitingForDebugger` command. - * An exception will be thrown if there is no active inspector. - */ - function waitForDebugger(): void; -} diff --git a/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts deleted file mode 100644 index ffb4a6ee..00000000 --- a/node_modules/@types/node/module.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -declare module "module" { - import { URL } from "url"; - namespace Module { - /** - * Updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports. - * It does not add or remove exported names from the ES Modules. - */ - function syncBuiltinESMExports(): void; - - function findSourceMap(path: string, error?: Error): SourceMap; - interface SourceMapPayload { - file: string; - version: number; - sources: string[]; - sourcesContent: string[]; - names: string[]; - mappings: string; - sourceRoot: string; - } - - interface SourceMapping { - generatedLine: number; - generatedColumn: number; - originalSource: string; - originalLine: number; - originalColumn: number; - } - - class SourceMap { - readonly payload: SourceMapPayload; - constructor(payload: SourceMapPayload); - findEntry(line: number, column: number): SourceMapping; - } - } - interface Module extends NodeModule {} - class Module { - static runMain(): void; - static wrap(code: string): string; - - /** - * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead. - */ - static createRequireFromPath(path: string): NodeRequire; - static createRequire(path: string | URL): NodeRequire; - static builtinModules: string[]; - - static Module: typeof Module; - - constructor(id: string, parent?: Module); - } - export = Module; -} diff --git a/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts deleted file mode 100644 index e6ee1bb9..00000000 --- a/node_modules/@types/node/net.d.ts +++ /dev/null @@ -1,268 +0,0 @@ -declare module "net" { - import * as stream from "stream"; - import * as events from "events"; - import * as dns from "dns"; - - type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; - - interface AddressInfo { - address: string; - family: string; - port: number; - } - - interface SocketConstructorOpts { - fd?: number; - allowHalfOpen?: boolean; - readable?: boolean; - writable?: boolean; - } - - interface OnReadOpts { - buffer: Uint8Array | (() => Uint8Array); - /** - * This function is called for every chunk of incoming data. - * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer. - * Return false from this function to implicitly pause() the socket. - */ - callback(bytesWritten: number, buf: Uint8Array): boolean; - } - - interface ConnectOpts { - /** - * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket. - * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will - * still be emitted as normal and methods like pause() and resume() will also behave as expected. - */ - onread?: OnReadOpts; - } - - interface TcpSocketConnectOpts extends ConnectOpts { - port: number; - host?: string; - localAddress?: string; - localPort?: number; - hints?: number; - family?: number; - lookup?: LookupFunction; - } - - interface IpcSocketConnectOpts extends ConnectOpts { - path: string; - } - - type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; - - class Socket extends stream.Duplex { - constructor(options?: SocketConstructorOpts); - - // Extended base methods - write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; - write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean; - - connect(options: SocketConnectOpts, connectionListener?: () => void): this; - connect(port: number, host: string, connectionListener?: () => void): this; - connect(port: number, connectionListener?: () => void): this; - connect(path: string, connectionListener?: () => void): this; - - setEncoding(encoding?: BufferEncoding): this; - pause(): this; - resume(): this; - setTimeout(timeout: number, callback?: () => void): this; - setNoDelay(noDelay?: boolean): this; - setKeepAlive(enable?: boolean, initialDelay?: number): this; - address(): AddressInfo | {}; - unref(): this; - ref(): this; - - readonly bufferSize: number; - readonly bytesRead: number; - readonly bytesWritten: number; - readonly connecting: boolean; - readonly destroyed: boolean; - readonly localAddress: string; - readonly localPort: number; - readonly remoteAddress?: string; - readonly remoteFamily?: string; - readonly remotePort?: number; - - // Extended base methods - end(cb?: () => void): void; - end(buffer: Uint8Array | string, cb?: () => void): void; - end(str: Uint8Array | string, encoding?: BufferEncoding, cb?: () => void): void; - - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. data - * 4. drain - * 5. end - * 6. error - * 7. lookup - * 8. timeout - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (had_error: boolean) => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "data", listener: (data: Buffer) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - addListener(event: "timeout", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", had_error: boolean): boolean; - emit(event: "connect"): boolean; - emit(event: "data", data: Buffer): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean; - emit(event: "timeout"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (had_error: boolean) => void): this; - on(event: "connect", listener: () => void): this; - on(event: "data", listener: (data: Buffer) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - on(event: "timeout", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (had_error: boolean) => void): this; - once(event: "connect", listener: () => void): this; - once(event: "data", listener: (data: Buffer) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - once(event: "timeout", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (had_error: boolean) => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "data", listener: (data: Buffer) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - prependListener(event: "timeout", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (had_error: boolean) => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "data", listener: (data: Buffer) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - } - - interface ListenOptions { - port?: number; - host?: string; - backlog?: number; - path?: string; - exclusive?: boolean; - readableAll?: boolean; - writableAll?: boolean; - /** - * @default false - */ - ipv6Only?: boolean; - } - - // https://github.com/nodejs/node/blob/master/lib/net.js - class Server extends events.EventEmitter { - constructor(connectionListener?: (socket: Socket) => void); - constructor(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void); - - listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, hostname?: string, listeningListener?: () => void): this; - listen(port?: number, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, listeningListener?: () => void): this; - listen(path: string, backlog?: number, listeningListener?: () => void): this; - listen(path: string, listeningListener?: () => void): this; - listen(options: ListenOptions, listeningListener?: () => void): this; - listen(handle: any, backlog?: number, listeningListener?: () => void): this; - listen(handle: any, listeningListener?: () => void): this; - close(callback?: (err?: Error) => void): this; - address(): AddressInfo | string | null; - getConnections(cb: (error: Error | null, count: number) => void): void; - ref(): this; - unref(): this; - maxConnections: number; - connections: number; - listening: boolean; - - /** - * events.EventEmitter - * 1. close - * 2. connection - * 3. error - * 4. listening - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - } - - interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { - timeout?: number; - } - - interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { - timeout?: number; - } - - type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; - - function createServer(connectionListener?: (socket: Socket) => void): Server; - function createServer(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void): Server; - function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; - function connect(port: number, host?: string, connectionListener?: () => void): Socket; - function connect(path: string, connectionListener?: () => void): Socket; - function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; - function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; - function createConnection(path: string, connectionListener?: () => void): Socket; - function isIP(input: string): number; - function isIPv4(input: string): boolean; - function isIPv6(input: string): boolean; -} diff --git a/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts deleted file mode 100644 index 1aadc68e..00000000 --- a/node_modules/@types/node/os.d.ts +++ /dev/null @@ -1,239 +0,0 @@ -declare module "os" { - interface CpuInfo { - model: string; - speed: number; - times: { - user: number; - nice: number; - sys: number; - idle: number; - irq: number; - }; - } - - interface NetworkInterfaceBase { - address: string; - netmask: string; - mac: string; - internal: boolean; - cidr: string | null; - } - - interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { - family: "IPv4"; - } - - interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { - family: "IPv6"; - scopeid: number; - } - - interface UserInfo { - username: T; - uid: number; - gid: number; - shell: T; - homedir: T; - } - - type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; - - function hostname(): string; - function loadavg(): number[]; - function uptime(): number; - function freemem(): number; - function totalmem(): number; - function cpus(): CpuInfo[]; - function type(): string; - function release(): string; - function networkInterfaces(): NodeJS.Dict; - function homedir(): string; - function userInfo(options: { encoding: 'buffer' }): UserInfo; - function userInfo(options?: { encoding: BufferEncoding }): UserInfo; - - type SignalConstants = { - [key in NodeJS.Signals]: number; - }; - - namespace constants { - const UV_UDP_REUSEADDR: number; - namespace signals {} - const signals: SignalConstants; - namespace errno { - const E2BIG: number; - const EACCES: number; - const EADDRINUSE: number; - const EADDRNOTAVAIL: number; - const EAFNOSUPPORT: number; - const EAGAIN: number; - const EALREADY: number; - const EBADF: number; - const EBADMSG: number; - const EBUSY: number; - const ECANCELED: number; - const ECHILD: number; - const ECONNABORTED: number; - const ECONNREFUSED: number; - const ECONNRESET: number; - const EDEADLK: number; - const EDESTADDRREQ: number; - const EDOM: number; - const EDQUOT: number; - const EEXIST: number; - const EFAULT: number; - const EFBIG: number; - const EHOSTUNREACH: number; - const EIDRM: number; - const EILSEQ: number; - const EINPROGRESS: number; - const EINTR: number; - const EINVAL: number; - const EIO: number; - const EISCONN: number; - const EISDIR: number; - const ELOOP: number; - const EMFILE: number; - const EMLINK: number; - const EMSGSIZE: number; - const EMULTIHOP: number; - const ENAMETOOLONG: number; - const ENETDOWN: number; - const ENETRESET: number; - const ENETUNREACH: number; - const ENFILE: number; - const ENOBUFS: number; - const ENODATA: number; - const ENODEV: number; - const ENOENT: number; - const ENOEXEC: number; - const ENOLCK: number; - const ENOLINK: number; - const ENOMEM: number; - const ENOMSG: number; - const ENOPROTOOPT: number; - const ENOSPC: number; - const ENOSR: number; - const ENOSTR: number; - const ENOSYS: number; - const ENOTCONN: number; - const ENOTDIR: number; - const ENOTEMPTY: number; - const ENOTSOCK: number; - const ENOTSUP: number; - const ENOTTY: number; - const ENXIO: number; - const EOPNOTSUPP: number; - const EOVERFLOW: number; - const EPERM: number; - const EPIPE: number; - const EPROTO: number; - const EPROTONOSUPPORT: number; - const EPROTOTYPE: number; - const ERANGE: number; - const EROFS: number; - const ESPIPE: number; - const ESRCH: number; - const ESTALE: number; - const ETIME: number; - const ETIMEDOUT: number; - const ETXTBSY: number; - const EWOULDBLOCK: number; - const EXDEV: number; - const WSAEINTR: number; - const WSAEBADF: number; - const WSAEACCES: number; - const WSAEFAULT: number; - const WSAEINVAL: number; - const WSAEMFILE: number; - const WSAEWOULDBLOCK: number; - const WSAEINPROGRESS: number; - const WSAEALREADY: number; - const WSAENOTSOCK: number; - const WSAEDESTADDRREQ: number; - const WSAEMSGSIZE: number; - const WSAEPROTOTYPE: number; - const WSAENOPROTOOPT: number; - const WSAEPROTONOSUPPORT: number; - const WSAESOCKTNOSUPPORT: number; - const WSAEOPNOTSUPP: number; - const WSAEPFNOSUPPORT: number; - const WSAEAFNOSUPPORT: number; - const WSAEADDRINUSE: number; - const WSAEADDRNOTAVAIL: number; - const WSAENETDOWN: number; - const WSAENETUNREACH: number; - const WSAENETRESET: number; - const WSAECONNABORTED: number; - const WSAECONNRESET: number; - const WSAENOBUFS: number; - const WSAEISCONN: number; - const WSAENOTCONN: number; - const WSAESHUTDOWN: number; - const WSAETOOMANYREFS: number; - const WSAETIMEDOUT: number; - const WSAECONNREFUSED: number; - const WSAELOOP: number; - const WSAENAMETOOLONG: number; - const WSAEHOSTDOWN: number; - const WSAEHOSTUNREACH: number; - const WSAENOTEMPTY: number; - const WSAEPROCLIM: number; - const WSAEUSERS: number; - const WSAEDQUOT: number; - const WSAESTALE: number; - const WSAEREMOTE: number; - const WSASYSNOTREADY: number; - const WSAVERNOTSUPPORTED: number; - const WSANOTINITIALISED: number; - const WSAEDISCON: number; - const WSAENOMORE: number; - const WSAECANCELLED: number; - const WSAEINVALIDPROCTABLE: number; - const WSAEINVALIDPROVIDER: number; - const WSAEPROVIDERFAILEDINIT: number; - const WSASYSCALLFAILURE: number; - const WSASERVICE_NOT_FOUND: number; - const WSATYPE_NOT_FOUND: number; - const WSA_E_NO_MORE: number; - const WSA_E_CANCELLED: number; - const WSAEREFUSED: number; - } - namespace priority { - const PRIORITY_LOW: number; - const PRIORITY_BELOW_NORMAL: number; - const PRIORITY_NORMAL: number; - const PRIORITY_ABOVE_NORMAL: number; - const PRIORITY_HIGH: number; - const PRIORITY_HIGHEST: number; - } - } - - function arch(): string; - /** - * Returns a string identifying the kernel version. - * On POSIX systems, the operating system release is determined by calling - * [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available, - * `GetVersionExW()` will be used. See - * https://en.wikipedia.org/wiki/Uname#Examples for more information. - */ - function version(): string; - function platform(): NodeJS.Platform; - function tmpdir(): string; - const EOL: string; - function endianness(): "BE" | "LE"; - /** - * Gets the priority of a process. - * Defaults to current process. - */ - function getPriority(pid?: number): number; - /** - * Sets the priority of the current process. - * @param priority Must be in range of -20 to 19 - */ - function setPriority(priority: number): void; - /** - * Sets the priority of the process specified process. - * @param priority Must be in range of -20 to 19 - */ - function setPriority(pid: number, priority: number): void; -} diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json deleted file mode 100644 index b8557313..00000000 --- a/node_modules/@types/node/package.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "_from": "@types/node@>=6", - "_id": "@types/node@14.14.7", - "_inBundle": false, - "_integrity": "sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg==", - "_location": "/@types/node", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/node@>=6", - "name": "@types/node", - "escapedName": "@types%2fnode", - "scope": "@types", - "rawSpec": ">=6", - "saveSpec": null, - "fetchSpec": ">=6" - }, - "_requiredBy": [ - "/@wry/context" - ], - "_resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.7.tgz", - "_shasum": "8ea1e8f8eae2430cf440564b98c6dfce1ec5945d", - "_spec": "@types/node@>=6", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/@wry/context", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Microsoft TypeScript", - "url": "https://github.com/Microsoft" - }, - { - "name": "DefinitelyTyped", - "url": "https://github.com/DefinitelyTyped" - }, - { - "name": "Alberto Schiabel", - "url": "https://github.com/jkomyno" - }, - { - "name": "Alexander T.", - "url": "https://github.com/a-tarasyuk" - }, - { - "name": "Alvis HT Tang", - "url": "https://github.com/alvis" - }, - { - "name": "Andrew Makarov", - "url": "https://github.com/r3nya" - }, - { - "name": "Benjamin Toueg", - "url": "https://github.com/btoueg" - }, - { - "name": "Bruno Scheufler", - "url": "https://github.com/brunoscheufler" - }, - { - "name": "Chigozirim C.", - "url": "https://github.com/smac89" - }, - { - "name": "David Junger", - "url": "https://github.com/touffy" - }, - { - "name": "Deividas Bakanas", - "url": "https://github.com/DeividasBakanas" - }, - { - "name": "Eugene Y. Q. Shen", - "url": "https://github.com/eyqs" - }, - { - "name": "Flarna", - "url": "https://github.com/Flarna" - }, - { - "name": "Hannes Magnusson", - "url": "https://github.com/Hannes-Magnusson-CK" - }, - { - "name": "Hoàng Văn Khải", - "url": "https://github.com/KSXGitHub" - }, - { - "name": "Huw", - "url": "https://github.com/hoo29" - }, - { - "name": "Kelvin Jin", - "url": "https://github.com/kjin" - }, - { - "name": "Klaus Meinhardt", - "url": "https://github.com/ajafff" - }, - { - "name": "Lishude", - "url": "https://github.com/islishude" - }, - { - "name": "Mariusz Wiktorczyk", - "url": "https://github.com/mwiktorczyk" - }, - { - "name": "Mohsen Azimi", - "url": "https://github.com/mohsen1" - }, - { - "name": "Nicolas Even", - "url": "https://github.com/n-e" - }, - { - "name": "Nikita Galkin", - "url": "https://github.com/galkin" - }, - { - "name": "Parambir Singh", - "url": "https://github.com/parambirs" - }, - { - "name": "Sebastian Silbermann", - "url": "https://github.com/eps1lon" - }, - { - "name": "Simon Schick", - "url": "https://github.com/SimonSchick" - }, - { - "name": "Thomas den Hollander", - "url": "https://github.com/ThomasdenH" - }, - { - "name": "Wilco Bakker", - "url": "https://github.com/WilcoBakker" - }, - { - "name": "wwwy3y3", - "url": "https://github.com/wwwy3y3" - }, - { - "name": "Samuel Ainsworth", - "url": "https://github.com/samuela" - }, - { - "name": "Kyle Uehlein", - "url": "https://github.com/kuehlein" - }, - { - "name": "Jordi Oliveras Rovira", - "url": "https://github.com/j-oliveras" - }, - { - "name": "Thanik Bhongbhibhat", - "url": "https://github.com/bhongy" - }, - { - "name": "Marcin Kopacz", - "url": "https://github.com/chyzwar" - }, - { - "name": "Trivikram Kamat", - "url": "https://github.com/trivikr" - }, - { - "name": "Minh Son Nguyen", - "url": "https://github.com/nguymin4" - }, - { - "name": "Junxiao Shi", - "url": "https://github.com/yoursunny" - }, - { - "name": "Ilia Baryshnikov", - "url": "https://github.com/qwelias" - }, - { - "name": "ExE Boss", - "url": "https://github.com/ExE-Boss" - }, - { - "name": "Surasak Chaisurin", - "url": "https://github.com/Ryan-Willpower" - }, - { - "name": "Piotr Błażejewicz", - "url": "https://github.com/peterblazejewicz" - }, - { - "name": "Anna Henningsen", - "url": "https://github.com/addaleax" - }, - { - "name": "Jason Kwok", - "url": "https://github.com/JasonHK" - }, - { - "name": "Victor Perin", - "url": "https://github.com/victorperin" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for Node.js", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/node", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/node" - }, - "scripts": {}, - "typeScriptVersion": "3.2", - "types": "index.d.ts", - "typesPublisherContentHash": "88e95df99ef95fe14df191e0260dc6af6db6b322ebecd22b3f94bf66f3851705", - "typesVersions": { - "<=3.4": { - "*": [ - "ts3.4/*" - ] - }, - "<=3.6": { - "*": [ - "ts3.6/*" - ] - } - }, - "version": "14.14.7" -} diff --git a/node_modules/@types/node/path.d.ts b/node_modules/@types/node/path.d.ts deleted file mode 100644 index 0273d58e..00000000 --- a/node_modules/@types/node/path.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -declare module "path" { - namespace path { - /** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ - interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; - } - - interface FormatInputPathObject { - /** - * The root of the path such as '/' or 'c:\' - */ - root?: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir?: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base?: string; - /** - * The file extension (if any) such as '.html' - */ - ext?: string; - /** - * The file name without extension (if any) such as 'index' - */ - name?: string; - } - - interface PlatformPath { - /** - * Normalize a string path, reducing '..' and '.' parts. - * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. - * - * @param p string path to normalize. - */ - normalize(p: string): string; - /** - * Join all arguments together and normalize the resulting path. - * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. - * - * @param paths paths to join. - */ - join(...paths: string[]): string; - /** - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - * - * Starting from leftmost {from} parameter, resolves {to} to an absolute path. - * - * If {to} isn't already absolute, {from} arguments are prepended in right to left order, - * until an absolute path is found. If after using all {from} paths still no absolute path is found, - * the current working directory is used as well. The resulting path is normalized, - * and trailing slashes are removed unless the path gets resolved to the root directory. - * - * @param pathSegments string paths to join. Non-string arguments are ignored. - */ - resolve(...pathSegments: string[]): string; - /** - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - * - * @param path path to test. - */ - isAbsolute(p: string): boolean; - /** - * Solve the relative path from {from} to {to}. - * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. - */ - relative(from: string, to: string): string; - /** - * Return the directory name of a path. Similar to the Unix dirname command. - * - * @param p the path to evaluate. - */ - dirname(p: string): string; - /** - * Return the last portion of a path. Similar to the Unix basename command. - * Often used to extract the file name from a fully qualified path. - * - * @param p the path to evaluate. - * @param ext optionally, an extension to remove from the result. - */ - basename(p: string, ext?: string): string; - /** - * Return the extension of the path, from the last '.' to end of string in the last portion of the path. - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string - * - * @param p the path to evaluate. - */ - extname(p: string): string; - /** - * The platform-specific file separator. '\\' or '/'. - */ - readonly sep: string; - /** - * The platform-specific file delimiter. ';' or ':'. - */ - readonly delimiter: string; - /** - * Returns an object from a path string - the opposite of format(). - * - * @param pathString path to evaluate. - */ - parse(p: string): ParsedPath; - /** - * Returns a path string from an object - the opposite of parse(). - * - * @param pathString path to evaluate. - */ - format(pP: FormatInputPathObject): string; - /** - * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. - * If path is not a string, path will be returned without modifications. - * This method is meaningful only on Windows system. - * On POSIX systems, the method is non-operational and always returns path without modifications. - */ - toNamespacedPath(path: string): string; - /** - * Posix specific pathing. - * Same as parent object on posix. - */ - readonly posix: PlatformPath; - /** - * Windows specific pathing. - * Same as parent object on windows - */ - readonly win32: PlatformPath; - } - } - const path: path.PlatformPath; - export = path; -} diff --git a/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@types/node/perf_hooks.d.ts deleted file mode 100644 index bbea9387..00000000 --- a/node_modules/@types/node/perf_hooks.d.ts +++ /dev/null @@ -1,271 +0,0 @@ -declare module 'perf_hooks' { - import { AsyncResource } from 'async_hooks'; - - type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http'; - - interface PerformanceEntry { - /** - * The total number of milliseconds elapsed for this entry. - * This value will not be meaningful for all Performance Entry types. - */ - readonly duration: number; - - /** - * The name of the performance entry. - */ - readonly name: string; - - /** - * The high resolution millisecond timestamp marking the starting time of the Performance Entry. - */ - readonly startTime: number; - - /** - * The type of the performance entry. - * Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'. - */ - readonly entryType: EntryType; - - /** - * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies - * the type of garbage collection operation that occurred. - * See perf_hooks.constants for valid values. - */ - readonly kind?: number; - - /** - * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` - * property contains additional information about garbage collection operation. - * See perf_hooks.constants for valid values. - */ - readonly flags?: number; - } - - interface PerformanceNodeTiming extends PerformanceEntry { - /** - * The high resolution millisecond timestamp at which the Node.js process completed bootstrap. - */ - readonly bootstrapComplete: number; - - /** - * The high resolution millisecond timestamp at which the Node.js process completed bootstrapping. - * If bootstrapping has not yet finished, the property has the value of -1. - */ - readonly environment: number; - - /** - * The high resolution millisecond timestamp at which the Node.js environment was initialized. - */ - readonly idleTime: number; - - /** - * The high resolution millisecond timestamp of the amount of time the event loop has been idle - * within the event loop's event provider (e.g. `epoll_wait`). This does not take CPU usage - * into consideration. If the event loop has not yet started (e.g., in the first tick of the main script), - * the property has the value of 0. - */ - readonly loopExit: number; - - /** - * The high resolution millisecond timestamp at which the Node.js event loop started. - * If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of -1. - */ - readonly loopStart: number; - - /** - * The high resolution millisecond timestamp at which the V8 platform was initialized. - */ - readonly v8Start: number; - } - - interface EventLoopUtilization { - idle: number; - active: number; - utilization: number; - } - - interface Performance { - /** - * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. - * If name is provided, removes only the named mark. - * @param name - */ - clearMarks(name?: string): void; - - /** - * Creates a new PerformanceMark entry in the Performance Timeline. - * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', - * and whose performanceEntry.duration is always 0. - * Performance marks are used to mark specific significant moments in the Performance Timeline. - * @param name - */ - mark(name?: string): void; - - /** - * Creates a new PerformanceMeasure entry in the Performance Timeline. - * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', - * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. - * - * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify - * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, - * then startMark is set to timeOrigin by default. - * - * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp - * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. - * @param name - * @param startMark - * @param endMark - */ - measure(name: string, startMark: string, endMark: string): void; - - /** - * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. - */ - readonly nodeTiming: PerformanceNodeTiming; - - /** - * @return the current high resolution millisecond timestamp - */ - now(): number; - - /** - * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. - */ - readonly timeOrigin: number; - - /** - * Wraps a function within a new function that measures the running time of the wrapped function. - * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. - * @param fn - */ - timerify any>(fn: T): T; - - /** - * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. - * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). - * No other CPU idle time is taken into consideration. - * - * @param util1 The result of a previous call to eventLoopUtilization() - * @param util2 The result of a previous call to eventLoopUtilization() prior to util1 - */ - eventLoopUtilization(util1?: EventLoopUtilization, util2?: EventLoopUtilization): EventLoopUtilization; - } - - interface PerformanceObserverEntryList { - /** - * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime. - */ - getEntries(): PerformanceEntry[]; - - /** - * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type. - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - - /** - * @return Returns a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.entryType is equal to type. - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - } - - type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; - - class PerformanceObserver extends AsyncResource { - constructor(callback: PerformanceObserverCallback); - - /** - * Disconnects the PerformanceObserver instance from all notifications. - */ - disconnect(): void; - - /** - * Subscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified by options.entryTypes. - * When options.buffered is false, the callback will be invoked once for every PerformanceEntry instance. - * Property buffered defaults to false. - * @param options - */ - observe(options: { entryTypes: ReadonlyArray; buffered?: boolean }): void; - } - - namespace constants { - const NODE_PERFORMANCE_GC_MAJOR: number; - const NODE_PERFORMANCE_GC_MINOR: number; - const NODE_PERFORMANCE_GC_INCREMENTAL: number; - const NODE_PERFORMANCE_GC_WEAKCB: number; - - const NODE_PERFORMANCE_GC_FLAGS_NO: number; - const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; - const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; - const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; - const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; - } - - const performance: Performance; - - interface EventLoopMonitorOptions { - /** - * The sampling rate in milliseconds. - * Must be greater than zero. - * @default 10 - */ - resolution?: number; - } - - interface EventLoopDelayMonitor { - /** - * Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started. - */ - enable(): boolean; - /** - * Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped. - */ - disable(): boolean; - - /** - * Resets the collected histogram data. - */ - reset(): void; - - /** - * Returns the value at the given percentile. - * @param percentile A percentile value between 1 and 100. - */ - percentile(percentile: number): number; - - /** - * A `Map` object detailing the accumulated percentile distribution. - */ - readonly percentiles: Map; - - /** - * The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold. - */ - readonly exceeds: number; - - /** - * The minimum recorded event loop delay. - */ - readonly min: number; - - /** - * The maximum recorded event loop delay. - */ - readonly max: number; - - /** - * The mean of the recorded event loop delays. - */ - readonly mean: number; - - /** - * The standard deviation of the recorded event loop delays. - */ - readonly stddev: number; - } - - function monitorEventLoopDelay(options?: EventLoopMonitorOptions): EventLoopDelayMonitor; -} diff --git a/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts deleted file mode 100644 index bd386264..00000000 --- a/node_modules/@types/node/process.d.ts +++ /dev/null @@ -1,408 +0,0 @@ -declare module "process" { - import * as tty from "tty"; - - global { - var process: NodeJS.Process; - - namespace NodeJS { - // this namespace merge is here because these are specifically used - // as the type for process.stdin, process.stdout, and process.stderr. - // they can't live in tty.d.ts because we need to disambiguate the imported name. - interface ReadStream extends tty.ReadStream {} - interface WriteStream extends tty.WriteStream {} - - interface MemoryUsage { - rss: number; - heapTotal: number; - heapUsed: number; - external: number; - arrayBuffers: number; - } - - interface CpuUsage { - user: number; - system: number; - } - - interface ProcessRelease { - name: string; - sourceUrl?: string; - headersUrl?: string; - libUrl?: string; - lts?: string; - } - - interface ProcessVersions extends Dict { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - modules: string; - openssl: string; - } - - type Platform = 'aix' - | 'android' - | 'darwin' - | 'freebsd' - | 'linux' - | 'openbsd' - | 'sunos' - | 'win32' - | 'cygwin' - | 'netbsd'; - - type Signals = - "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | - "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | - "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | - "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO"; - - type MultipleResolveType = 'resolve' | 'reject'; - - type BeforeExitListener = (code: number) => void; - type DisconnectListener = () => void; - type ExitListener = (code: number) => void; - type RejectionHandledListener = (promise: Promise) => void; - type UncaughtExceptionListener = (error: Error) => void; - type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise) => void; - type WarningListener = (warning: Error) => void; - type MessageListener = (message: any, sendHandle: any) => void; - type SignalsListener = (signal: Signals) => void; - type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; - type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; - type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: any) => void; - - interface Socket extends ReadWriteStream { - isTTY?: true; - } - - // Alias for compatibility - interface ProcessEnv extends Dict {} - - interface HRTime { - (time?: [number, number]): [number, number]; - bigint(): bigint; - } - - interface ProcessReport { - /** - * Directory where the report is written. - * working directory of the Node.js process. - * @default '' indicating that reports are written to the current - */ - directory: string; - - /** - * Filename where the report is written. - * The default value is the empty string. - * @default '' the output filename will be comprised of a timestamp, - * PID, and sequence number. - */ - filename: string; - - /** - * Returns a JSON-formatted diagnostic report for the running process. - * The report's JavaScript stack trace is taken from err, if present. - */ - getReport(err?: Error): string; - - /** - * If true, a diagnostic report is generated on fatal errors, - * such as out of memory errors or failed C++ assertions. - * @default false - */ - reportOnFatalError: boolean; - - /** - * If true, a diagnostic report is generated when the process - * receives the signal specified by process.report.signal. - * @defaul false - */ - reportOnSignal: boolean; - - /** - * If true, a diagnostic report is generated on uncaught exception. - * @default false - */ - reportOnUncaughtException: boolean; - - /** - * The signal used to trigger the creation of a diagnostic report. - * @default 'SIGUSR2' - */ - signal: Signals; - - /** - * Writes a diagnostic report to a file. If filename is not provided, the default filename - * includes the date, time, PID, and a sequence number. - * The report's JavaScript stack trace is taken from err, if present. - * - * @param fileName Name of the file where the report is written. - * This should be a relative path, that will be appended to the directory specified in - * `process.report.directory`, or the current working directory of the Node.js process, - * if unspecified. - * @param error A custom error used for reporting the JavaScript stack. - * @return Filename of the generated report. - */ - writeReport(fileName?: string): string; - writeReport(error?: Error): string; - writeReport(fileName?: string, err?: Error): string; - } - - interface ResourceUsage { - fsRead: number; - fsWrite: number; - involuntaryContextSwitches: number; - ipcReceived: number; - ipcSent: number; - majorPageFault: number; - maxRSS: number; - minorPageFault: number; - sharedMemorySize: number; - signalsCount: number; - swappedOut: number; - systemCPUTime: number; - unsharedDataSize: number; - unsharedStackSize: number; - userCPUTime: number; - voluntaryContextSwitches: number; - } - - interface Process extends EventEmitter { - /** - * Can also be a tty.WriteStream, not typed due to limitations. - */ - stdout: WriteStream & { - fd: 1; - }; - /** - * Can also be a tty.WriteStream, not typed due to limitations. - */ - stderr: WriteStream & { - fd: 2; - }; - stdin: ReadStream & { - fd: 0; - }; - openStdin(): Socket; - argv: string[]; - argv0: string; - execArgv: string[]; - execPath: string; - abort(): void; - chdir(directory: string): void; - cwd(): string; - debugPort: number; - emitWarning(warning: string | Error, name?: string, ctor?: Function): void; - env: ProcessEnv; - exit(code?: number): never; - exitCode?: number; - getgid(): number; - setgid(id: number | string): void; - getuid(): number; - setuid(id: number | string): void; - geteuid(): number; - seteuid(id: number | string): void; - getegid(): number; - setegid(id: number | string): void; - getgroups(): number[]; - setgroups(groups: ReadonlyArray): void; - setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; - hasUncaughtExceptionCaptureCallback(): boolean; - version: string; - versions: ProcessVersions; - config: { - target_defaults: { - cflags: any[]; - default_configuration: string; - defines: string[]; - include_dirs: string[]; - libraries: string[]; - }; - variables: { - clang: number; - host_arch: string; - node_install_npm: boolean; - node_install_waf: boolean; - node_prefix: string; - node_shared_openssl: boolean; - node_shared_v8: boolean; - node_shared_zlib: boolean; - node_use_dtrace: boolean; - node_use_etw: boolean; - node_use_openssl: boolean; - target_arch: string; - v8_no_strict_aliasing: number; - v8_use_snapshot: boolean; - visibility: string; - }; - }; - kill(pid: number, signal?: string | number): true; - pid: number; - ppid: number; - title: string; - arch: string; - platform: Platform; - /** @deprecated since v14.0.0 - use `require.main` instead. */ - mainModule?: Module; - memoryUsage(): MemoryUsage; - cpuUsage(previousValue?: CpuUsage): CpuUsage; - nextTick(callback: Function, ...args: any[]): void; - release: ProcessRelease; - features: { - inspector: boolean; - debug: boolean; - uv: boolean; - ipv6: boolean; - tls_alpn: boolean; - tls_sni: boolean; - tls_ocsp: boolean; - tls: boolean; - }; - /** - * @deprecated since v14.0.0 - Calling process.umask() with no argument causes - * the process-wide umask to be written twice. This introduces a race condition between threads, - * and is a potential security vulnerability. There is no safe, cross-platform alternative API. - */ - umask(): number; - /** - * Can only be set if not in worker thread. - */ - umask(mask: string | number): number; - uptime(): number; - hrtime: HRTime; - domain: Domain; - - // Worker - send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean; - disconnect(): void; - connected: boolean; - - /** - * The `process.allowedNodeEnvironmentFlags` property is a special, - * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][] - * environment variable. - */ - allowedNodeEnvironmentFlags: ReadonlySet; - - /** - * Only available with `--experimental-report` - */ - report?: ProcessReport; - - resourceUsage(): ResourceUsage; - - traceDeprecation: boolean; - - /* EventEmitter */ - addListener(event: "beforeExit", listener: BeforeExitListener): this; - addListener(event: "disconnect", listener: DisconnectListener): this; - addListener(event: "exit", listener: ExitListener): this; - addListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - addListener(event: "warning", listener: WarningListener): this; - addListener(event: "message", listener: MessageListener): this; - addListener(event: Signals, listener: SignalsListener): this; - addListener(event: "newListener", listener: NewListenerListener): this; - addListener(event: "removeListener", listener: RemoveListenerListener): this; - addListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - emit(event: "beforeExit", code: number): boolean; - emit(event: "disconnect"): boolean; - emit(event: "exit", code: number): boolean; - emit(event: "rejectionHandled", promise: Promise): boolean; - emit(event: "uncaughtException", error: Error): boolean; - emit(event: "uncaughtExceptionMonitor", error: Error): boolean; - emit(event: "unhandledRejection", reason: any, promise: Promise): boolean; - emit(event: "warning", warning: Error): boolean; - emit(event: "message", message: any, sendHandle: any): this; - emit(event: Signals, signal: Signals): boolean; - emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this; - emit(event: "multipleResolves", listener: MultipleResolveListener): this; - - on(event: "beforeExit", listener: BeforeExitListener): this; - on(event: "disconnect", listener: DisconnectListener): this; - on(event: "exit", listener: ExitListener): this; - on(event: "rejectionHandled", listener: RejectionHandledListener): this; - on(event: "uncaughtException", listener: UncaughtExceptionListener): this; - on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - on(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - on(event: "warning", listener: WarningListener): this; - on(event: "message", listener: MessageListener): this; - on(event: Signals, listener: SignalsListener): this; - on(event: "newListener", listener: NewListenerListener): this; - on(event: "removeListener", listener: RemoveListenerListener): this; - on(event: "multipleResolves", listener: MultipleResolveListener): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "beforeExit", listener: BeforeExitListener): this; - once(event: "disconnect", listener: DisconnectListener): this; - once(event: "exit", listener: ExitListener): this; - once(event: "rejectionHandled", listener: RejectionHandledListener): this; - once(event: "uncaughtException", listener: UncaughtExceptionListener): this; - once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - once(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - once(event: "warning", listener: WarningListener): this; - once(event: "message", listener: MessageListener): this; - once(event: Signals, listener: SignalsListener): this; - once(event: "newListener", listener: NewListenerListener): this; - once(event: "removeListener", listener: RemoveListenerListener): this; - once(event: "multipleResolves", listener: MultipleResolveListener): this; - - prependListener(event: "beforeExit", listener: BeforeExitListener): this; - prependListener(event: "disconnect", listener: DisconnectListener): this; - prependListener(event: "exit", listener: ExitListener): this; - prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependListener(event: "warning", listener: WarningListener): this; - prependListener(event: "message", listener: MessageListener): this; - prependListener(event: Signals, listener: SignalsListener): this; - prependListener(event: "newListener", listener: NewListenerListener): this; - prependListener(event: "removeListener", listener: RemoveListenerListener): this; - prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; - prependOnceListener(event: "disconnect", listener: DisconnectListener): this; - prependOnceListener(event: "exit", listener: ExitListener): this; - prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependOnceListener(event: "warning", listener: WarningListener): this; - prependOnceListener(event: "message", listener: MessageListener): this; - prependOnceListener(event: Signals, listener: SignalsListener): this; - prependOnceListener(event: "newListener", listener: NewListenerListener): this; - prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this; - prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - listeners(event: "beforeExit"): BeforeExitListener[]; - listeners(event: "disconnect"): DisconnectListener[]; - listeners(event: "exit"): ExitListener[]; - listeners(event: "rejectionHandled"): RejectionHandledListener[]; - listeners(event: "uncaughtException"): UncaughtExceptionListener[]; - listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[]; - listeners(event: "unhandledRejection"): UnhandledRejectionListener[]; - listeners(event: "warning"): WarningListener[]; - listeners(event: "message"): MessageListener[]; - listeners(event: Signals): SignalsListener[]; - listeners(event: "newListener"): NewListenerListener[]; - listeners(event: "removeListener"): RemoveListenerListener[]; - listeners(event: "multipleResolves"): MultipleResolveListener[]; - } - - interface Global { - process: Process; - } - } - } - - export = process; -} diff --git a/node_modules/@types/node/punycode.d.ts b/node_modules/@types/node/punycode.d.ts deleted file mode 100644 index 2b771d45..00000000 --- a/node_modules/@types/node/punycode.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -declare module "punycode" { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function decode(string: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function encode(string: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function toUnicode(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function toASCII(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const ucs2: ucs2; - interface ucs2 { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - decode(string: string): number[]; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - encode(codePoints: ReadonlyArray): string; - } - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const version: string; -} diff --git a/node_modules/@types/node/querystring.d.ts b/node_modules/@types/node/querystring.d.ts deleted file mode 100644 index 3e204e7f..00000000 --- a/node_modules/@types/node/querystring.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -declare module "querystring" { - interface StringifyOptions { - encodeURIComponent?: (str: string) => string; - } - - interface ParseOptions { - maxKeys?: number; - decodeURIComponent?: (str: string) => string; - } - - interface ParsedUrlQuery extends NodeJS.Dict { } - - interface ParsedUrlQueryInput extends NodeJS.Dict | ReadonlyArray | ReadonlyArray | null> { - } - - function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; - function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; - /** - * The querystring.encode() function is an alias for querystring.stringify(). - */ - const encode: typeof stringify; - /** - * The querystring.decode() function is an alias for querystring.parse(). - */ - const decode: typeof parse; - function escape(str: string): string; - function unescape(str: string): string; -} diff --git a/node_modules/@types/node/readline.d.ts b/node_modules/@types/node/readline.d.ts deleted file mode 100644 index fbe4836f..00000000 --- a/node_modules/@types/node/readline.d.ts +++ /dev/null @@ -1,171 +0,0 @@ -declare module "readline" { - import * as events from "events"; - import * as stream from "stream"; - - interface Key { - sequence?: string; - name?: string; - ctrl?: boolean; - meta?: boolean; - shift?: boolean; - } - - class Interface extends events.EventEmitter { - readonly terminal: boolean; - - // Need direct access to line/cursor data, for use in external processes - // see: https://github.com/nodejs/node/issues/30347 - /** The current input data */ - readonly line: string; - /** The current cursor position in the input line */ - readonly cursor: number; - - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface - */ - protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface - */ - protected constructor(options: ReadLineOptions); - - setPrompt(prompt: string): void; - prompt(preserveCursor?: boolean): void; - question(query: string, callback: (answer: string) => void): void; - pause(): this; - resume(): this; - close(): void; - write(data: string | Buffer, key?: Key): void; - - /** - * Returns the real position of the cursor in relation to the input - * prompt + string. Long input (wrapping) strings, as well as multiple - * line prompts are included in the calculations. - */ - getCursorPos(): CursorPos; - - /** - * events.EventEmitter - * 1. close - * 2. line - * 3. pause - * 4. resume - * 5. SIGCONT - * 6. SIGINT - * 7. SIGTSTP - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - type ReadLine = Interface; // type forwarded for backwards compatiblity - - type Completer = (line: string) => CompleterResult; - type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any; - - type CompleterResult = [string[], string]; - - interface ReadLineOptions { - input: NodeJS.ReadableStream; - output?: NodeJS.WritableStream; - completer?: Completer | AsyncCompleter; - terminal?: boolean; - historySize?: number; - prompt?: string; - crlfDelay?: number; - removeHistoryDuplicates?: boolean; - escapeCodeTimeout?: number; - tabSize?: number; - } - - function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; - function createInterface(options: ReadLineOptions): Interface; - function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; - - type Direction = -1 | 0 | 1; - - interface CursorPos { - rows: number; - cols: number; - } - - /** - * Clears the current line of this WriteStream in a direction identified by `dir`. - */ - function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; - /** - * Clears this `WriteStream` from the current cursor down. - */ - function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor to the specified position. - */ - function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor relative to its current position. - */ - function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; -} diff --git a/node_modules/@types/node/repl.d.ts b/node_modules/@types/node/repl.d.ts deleted file mode 100644 index 4985b526..00000000 --- a/node_modules/@types/node/repl.d.ts +++ /dev/null @@ -1,395 +0,0 @@ -declare module "repl" { - import { Interface, Completer, AsyncCompleter } from "readline"; - import { Context } from "vm"; - import { InspectOptions } from "util"; - - interface ReplOptions { - /** - * The input prompt to display. - * Default: `"> "` - */ - prompt?: string; - /** - * The `Readable` stream from which REPL input will be read. - * Default: `process.stdin` - */ - input?: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - * Default: `process.stdout` - */ - output?: NodeJS.WritableStream; - /** - * If `true`, specifies that the output should be treated as a TTY terminal, and have - * ANSI/VT100 escape codes written to it. - * Default: checking the value of the `isTTY` property on the output stream upon - * instantiation. - */ - terminal?: boolean; - /** - * The function to be used when evaluating each given line of input. - * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can - * error with `repl.Recoverable` to indicate the input was incomplete and prompt for - * additional lines. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions - */ - eval?: REPLEval; - /** - * Defines if the repl prints output previews or not. - * @default `true` Always `false` in case `terminal` is falsy. - */ - preview?: boolean; - /** - * If `true`, specifies that the default `writer` function should include ANSI color - * styling to REPL output. If a custom `writer` function is provided then this has no - * effect. - * Default: the REPL instance's `terminal` value. - */ - useColors?: boolean; - /** - * If `true`, specifies that the default evaluation function will use the JavaScript - * `global` as the context as opposed to creating a new separate context for the REPL - * instance. The node CLI REPL sets this value to `true`. - * Default: `false`. - */ - useGlobal?: boolean; - /** - * If `true`, specifies that the default writer will not output the return value of a - * command if it evaluates to `undefined`. - * Default: `false`. - */ - ignoreUndefined?: boolean; - /** - * The function to invoke to format the output of each command before writing to `output`. - * Default: a wrapper for `util.inspect`. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output - */ - writer?: REPLWriter; - /** - * An optional function used for custom Tab auto completion. - * - * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function - */ - completer?: Completer | AsyncCompleter; - /** - * A flag that specifies whether the default evaluator executes all JavaScript commands in - * strict mode or default (sloppy) mode. - * Accepted values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - /** - * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is - * pressed. This cannot be used together with a custom `eval` function. - * Default: `false`. - */ - breakEvalOnSigint?: boolean; - } - - type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; - type REPLWriter = (this: REPLServer, obj: any) => string; - - /** - * This is the default "writer" value, if none is passed in the REPL options, - * and it can be overridden by custom print functions. - */ - const writer: REPLWriter & { options: InspectOptions }; - - type REPLCommandAction = (this: REPLServer, text: string) => void; - - interface REPLCommand { - /** - * Help text to be displayed when `.help` is entered. - */ - help?: string; - /** - * The function to execute, optionally accepting a single string argument. - */ - action: REPLCommandAction; - } - - /** - * Provides a customizable Read-Eval-Print-Loop (REPL). - * - * Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those - * according to a user-defined evaluation function, then output the result. Input and output - * may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`. - * - * Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style - * line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session - * state, error recovery, and customizable evaluation functions. - * - * Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_ - * be created directly using the JavaScript `new` keyword. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl - */ - class REPLServer extends Interface { - /** - * The `vm.Context` provided to the `eval` function to be used for JavaScript - * evaluation. - */ - readonly context: Context; - /** - * @deprecated since v14.3.0 - Use `input` instead. - */ - readonly inputStream: NodeJS.ReadableStream; - /** - * @deprecated since v14.3.0 - Use `output` instead. - */ - readonly outputStream: NodeJS.WritableStream; - /** - * The `Readable` stream from which REPL input will be read. - */ - readonly input: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - */ - readonly output: NodeJS.WritableStream; - /** - * The commands registered via `replServer.defineCommand()`. - */ - readonly commands: NodeJS.ReadOnlyDict; - /** - * A value indicating whether the REPL is currently in "editor mode". - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys - */ - readonly editorMode: boolean; - /** - * A value indicating whether the `_` variable has been assigned. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreAssigned: boolean; - /** - * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly last: any; - /** - * A value indicating whether the `_error` variable has been assigned. - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreErrAssigned: boolean; - /** - * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly lastError: any; - /** - * Specified in the REPL options, this is the function to be used when evaluating each - * given line of input. If not specified in the REPL options, this is an async wrapper - * for the JavaScript `eval()` function. - */ - readonly eval: REPLEval; - /** - * Specified in the REPL options, this is a value indicating whether the default - * `writer` function should include ANSI color styling to REPL output. - */ - readonly useColors: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `eval` - * function will use the JavaScript `global` as the context as opposed to creating a new - * separate context for the REPL instance. - */ - readonly useGlobal: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `writer` - * function should output the result of a command if it evaluates to `undefined`. - */ - readonly ignoreUndefined: boolean; - /** - * Specified in the REPL options, this is the function to invoke to format the output of - * each command before writing to `outputStream`. If not specified in the REPL options, - * this will be a wrapper for `util.inspect`. - */ - readonly writer: REPLWriter; - /** - * Specified in the REPL options, this is the function to use for custom Tab auto-completion. - */ - readonly completer: Completer | AsyncCompleter; - /** - * Specified in the REPL options, this is a flag that specifies whether the default `eval` - * function should execute all JavaScript commands in strict mode or default (sloppy) mode. - * Possible values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - - /** - * NOTE: According to the documentation: - * - * > Instances of `repl.REPLServer` are created using the `repl.start()` method and - * > _should not_ be created directly using the JavaScript `new` keyword. - * - * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver - */ - private constructor(); - - /** - * Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked - * by typing a `.` followed by the `keyword`. - * - * @param keyword The command keyword (_without_ a leading `.` character). - * @param cmd The function to invoke when the command is processed. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd - */ - defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; - /** - * Readies the REPL instance for input from the user, printing the configured `prompt` to a - * new line in the `output` and resuming the `input` to accept new input. - * - * When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'. - * - * This method is primarily intended to be called from within the action function for - * commands registered using the `replServer.defineCommand()` method. - * - * @param preserveCursor When `true`, the cursor placement will not be reset to `0`. - */ - displayPrompt(preserveCursor?: boolean): void; - /** - * Clears any command that has been buffered but not yet executed. - * - * This method is primarily intended to be called from within the action function for - * commands registered using the `replServer.defineCommand()` method. - * - * @since v9.0.0 - */ - clearBufferedCommand(): void; - - /** - * Initializes a history log file for the REPL instance. When executing the - * Node.js binary and using the command line REPL, a history file is initialized - * by default. However, this is not the case when creating a REPL - * programmatically. Use this method to initialize a history log file when working - * with REPL instances programmatically. - * @param path The path to the history file - */ - setupHistory(path: string, cb: (err: Error | null, repl: this) => void): void; - - /** - * events.EventEmitter - * 1. close - inherited from `readline.Interface` - * 2. line - inherited from `readline.Interface` - * 3. pause - inherited from `readline.Interface` - * 4. resume - inherited from `readline.Interface` - * 5. SIGCONT - inherited from `readline.Interface` - * 6. SIGINT - inherited from `readline.Interface` - * 7. SIGTSTP - inherited from `readline.Interface` - * 8. exit - * 9. reset - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (context: Context) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "exit"): boolean; - emit(event: "reset", context: Context): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (context: Context) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (context: Context) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (context: Context) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (context: Context) => void): this; - } - - /** - * A flag passed in the REPL options. Evaluates expressions in sloppy mode. - */ - const REPL_MODE_SLOPPY: unique symbol; - - /** - * A flag passed in the REPL options. Evaluates expressions in strict mode. - * This is equivalent to prefacing every repl statement with `'use strict'`. - */ - const REPL_MODE_STRICT: unique symbol; - - /** - * Creates and starts a `repl.REPLServer` instance. - * - * @param options The options for the `REPLServer`. If `options` is a string, then it specifies - * the input prompt. - */ - function start(options?: string | ReplOptions): REPLServer; - - /** - * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors - */ - class Recoverable extends SyntaxError { - err: Error; - - constructor(err: Error); - } -} diff --git a/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts deleted file mode 100644 index 7e189d95..00000000 --- a/node_modules/@types/node/stream.d.ts +++ /dev/null @@ -1,354 +0,0 @@ -declare module "stream" { - import * as events from "events"; - - class internal extends events.EventEmitter { - pipe(destination: T, options?: { end?: boolean; }): T; - } - - namespace internal { - class Stream extends internal { - constructor(opts?: ReadableOptions); - } - - interface ReadableOptions { - highWaterMark?: number; - encoding?: BufferEncoding; - objectMode?: boolean; - read?(this: Readable, size: number): void; - destroy?(this: Readable, error: Error | null, callback: (error: Error | null) => void): void; - autoDestroy?: boolean; - } - - class Readable extends Stream implements NodeJS.ReadableStream { - /** - * A utility method for creating Readable Streams out of iterators. - */ - static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; - - readable: boolean; - readonly readableEncoding: BufferEncoding | null; - readonly readableEnded: boolean; - readonly readableFlowing: boolean | null; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableObjectMode: boolean; - destroyed: boolean; - constructor(opts?: ReadableOptions); - _read(size: number): void; - read(size?: number): any; - setEncoding(encoding: BufferEncoding): this; - pause(): this; - resume(): this; - isPaused(): boolean; - unpipe(destination?: NodeJS.WritableStream): this; - unshift(chunk: any, encoding?: BufferEncoding): void; - wrap(oldStream: NodeJS.ReadableStream): this; - push(chunk: any, encoding?: BufferEncoding): boolean; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - destroy(error?: Error): void; - - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. end - * 4. error - * 5. pause - * 6. readable - * 7. resume - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "pause"): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableOptions { - highWaterMark?: number; - decodeStrings?: boolean; - defaultEncoding?: BufferEncoding; - objectMode?: boolean; - emitClose?: boolean; - write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - writev?(this: Writable, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void; - destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void; - final?(this: Writable, callback: (error?: Error | null) => void): void; - autoDestroy?: boolean; - } - - class Writable extends Stream implements NodeJS.WritableStream { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - readonly writableCorked: number; - destroyed: boolean; - constructor(opts?: WritableOptions); - _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - _writev?(chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, encoding: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: BufferEncoding): this; - end(cb?: () => void): void; - end(chunk: any, cb?: () => void): void; - end(chunk: any, encoding: BufferEncoding, cb?: () => void): void; - cork(): void; - uncork(): void; - destroy(error?: Error): void; - - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. drain - * 3. error - * 4. finish - * 5. pipe - * 6. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean; - readableObjectMode?: boolean; - writableObjectMode?: boolean; - readableHighWaterMark?: number; - writableHighWaterMark?: number; - writableCorked?: number; - read?(this: Duplex, size: number): void; - write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - writev?(this: Duplex, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void; - final?(this: Duplex, callback: (error?: Error | null) => void): void; - destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void; - } - - // Note: Duplex extends both Readable and Writable. - class Duplex extends Readable implements Writable { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - readonly writableCorked: number; - constructor(opts?: DuplexOptions); - _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - _writev?(chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: BufferEncoding): this; - end(cb?: () => void): void; - end(chunk: any, cb?: () => void): void; - end(chunk: any, encoding?: BufferEncoding, cb?: () => void): void; - cork(): void; - uncork(): void; - } - - type TransformCallback = (error?: Error | null, data?: any) => void; - - interface TransformOptions extends DuplexOptions { - read?(this: Transform, size: number): void; - write?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - writev?(this: Transform, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void; - final?(this: Transform, callback: (error?: Error | null) => void): void; - destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void; - transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; - flush?(this: Transform, callback: TransformCallback): void; - } - - class Transform extends Duplex { - constructor(opts?: TransformOptions); - _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; - _flush(callback: TransformCallback): void; - } - - class PassThrough extends Transform { } - - interface FinishedOptions { - error?: boolean; - readable?: boolean; - writable?: boolean; - } - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; - namespace finished { - function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise; - } - - function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; - function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: T, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): T; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: NodeJS.ReadWriteStream, - stream5: T, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): T; - function pipeline( - streams: ReadonlyArray, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): NodeJS.WritableStream; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array void)>, - ): NodeJS.WritableStream; - namespace pipeline { - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise; - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.WritableStream): Promise; - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: NodeJS.WritableStream): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: NodeJS.ReadWriteStream, - stream5: NodeJS.WritableStream, - ): Promise; - function __promisify__(streams: ReadonlyArray): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array, - ): Promise; - } - - interface Pipe { - close(): void; - hasRef(): boolean; - ref(): void; - unref(): void; - } - } - - export = internal; -} diff --git a/node_modules/@types/node/string_decoder.d.ts b/node_modules/@types/node/string_decoder.d.ts deleted file mode 100644 index a6a40601..00000000 --- a/node_modules/@types/node/string_decoder.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module "string_decoder" { - class StringDecoder { - constructor(encoding?: BufferEncoding); - write(buffer: Buffer): string; - end(buffer?: Buffer): string; - } -} diff --git a/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts deleted file mode 100644 index e64a6735..00000000 --- a/node_modules/@types/node/timers.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module "timers" { - function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; - namespace setTimeout { - function __promisify__(ms: number): Promise; - function __promisify__(ms: number, value: T): Promise; - } - function clearTimeout(timeoutId: NodeJS.Timeout): void; - function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; - function clearInterval(intervalId: NodeJS.Timeout): void; - function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; - namespace setImmediate { - function __promisify__(): Promise; - function __promisify__(value: T): Promise; - } - function clearImmediate(immediateId: NodeJS.Immediate): void; -} diff --git a/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts deleted file mode 100644 index 6092a6e8..00000000 --- a/node_modules/@types/node/tls.d.ts +++ /dev/null @@ -1,779 +0,0 @@ -declare module "tls" { - import * as crypto from "crypto"; - import * as dns from "dns"; - import * as net from "net"; - import * as stream from "stream"; - - const CLIENT_RENEG_LIMIT: number; - const CLIENT_RENEG_WINDOW: number; - - interface Certificate { - /** - * Country code. - */ - C: string; - /** - * Street. - */ - ST: string; - /** - * Locality. - */ - L: string; - /** - * Organization. - */ - O: string; - /** - * Organizational unit. - */ - OU: string; - /** - * Common name. - */ - CN: string; - } - - interface PeerCertificate { - subject: Certificate; - issuer: Certificate; - subjectaltname: string; - infoAccess: NodeJS.Dict; - modulus: string; - exponent: string; - valid_from: string; - valid_to: string; - fingerprint: string; - fingerprint256: string; - ext_key_usage: string[]; - serialNumber: string; - raw: Buffer; - } - - interface DetailedPeerCertificate extends PeerCertificate { - issuerCertificate: DetailedPeerCertificate; - } - - interface CipherNameAndProtocol { - /** - * The cipher name. - */ - name: string; - /** - * SSL/TLS protocol version. - */ - version: string; - - /** - * IETF name for the cipher suite. - */ - standardName: string; - } - - interface EphemeralKeyInfo { - /** - * The supported types are 'DH' and 'ECDH'. - */ - type: string; - /** - * The name property is available only when type is 'ECDH'. - */ - name?: string; - /** - * The size of parameter of an ephemeral key exchange. - */ - size: number; - } - - interface KeyObject { - /** - * Private keys in PEM format. - */ - pem: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string; - } - - interface PxfObject { - /** - * PFX or PKCS12 encoded private key and certificate chain. - */ - buf: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string; - } - - interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * If true the TLS socket will be instantiated in server-mode. - * Defaults to false. - */ - isServer?: boolean; - /** - * An optional net.Server instance. - */ - server?: net.Server; - - /** - * An optional Buffer instance containing a TLS session. - */ - session?: Buffer; - /** - * If true, specifies that the OCSP status request extension will be - * added to the client hello and an 'OCSPResponse' event will be - * emitted on the socket before establishing a secure communication - */ - requestOCSP?: boolean; - } - - class TLSSocket extends net.Socket { - /** - * Construct a new tls.TLSSocket object from an existing TCP socket. - */ - constructor(socket: net.Socket, options?: TLSSocketOptions); - - /** - * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false. - */ - authorized: boolean; - /** - * The reason why the peer's certificate has not been verified. - * This property becomes available only when tlsSocket.authorized === false. - */ - authorizationError: Error; - /** - * Static boolean value, always true. - * May be used to distinguish TLS sockets from regular ones. - */ - encrypted: boolean; - - /** - * String containing the selected ALPN protocol. - * When ALPN has no selected protocol, tlsSocket.alpnProtocol equals false. - */ - alpnProtocol?: string; - - /** - * Returns an object representing the local certificate. The returned - * object has some properties corresponding to the fields of the - * certificate. - * - * See tls.TLSSocket.getPeerCertificate() for an example of the - * certificate structure. - * - * If there is no local certificate, an empty object will be returned. - * If the socket has been destroyed, null will be returned. - */ - getCertificate(): PeerCertificate | object | null; - /** - * Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection. - * @returns Returns an object representing the cipher name - * and the SSL/TLS protocol version of the current connection. - */ - getCipher(): CipherNameAndProtocol; - /** - * Returns an object representing the type, name, and size of parameter - * of an ephemeral key exchange in Perfect Forward Secrecy on a client - * connection. It returns an empty object when the key exchange is not - * ephemeral. As this is only supported on a client socket; null is - * returned if called on a server socket. The supported types are 'DH' - * and 'ECDH'. The name property is available only when type is 'ECDH'. - * - * For example: { type: 'ECDH', name: 'prime256v1', size: 256 }. - */ - getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; - /** - * Returns the latest Finished message that has - * been sent to the socket as part of a SSL/TLS handshake, or undefined - * if no Finished message has been sent yet. - * - * As the Finished messages are message digests of the complete - * handshake (with a total of 192 bits for TLS 1.0 and more for SSL - * 3.0), they can be used for external authentication procedures when - * the authentication provided by SSL/TLS is not desired or is not - * enough. - * - * Corresponds to the SSL_get_finished routine in OpenSSL and may be - * used to implement the tls-unique channel binding from RFC 5929. - */ - getFinished(): Buffer | undefined; - /** - * Returns an object representing the peer's certificate. - * The returned object has some properties corresponding to the field of the certificate. - * If detailed argument is true the full chain with issuer property will be returned, - * if false only the top certificate without issuer property. - * If the peer does not provide a certificate, it returns null or an empty object. - * @param detailed - If true; the full chain with issuer property will be returned. - * @returns An object representing the peer's certificate. - */ - getPeerCertificate(detailed: true): DetailedPeerCertificate; - getPeerCertificate(detailed?: false): PeerCertificate; - getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; - /** - * Returns the latest Finished message that is expected or has actually - * been received from the socket as part of a SSL/TLS handshake, or - * undefined if there is no Finished message so far. - * - * As the Finished messages are message digests of the complete - * handshake (with a total of 192 bits for TLS 1.0 and more for SSL - * 3.0), they can be used for external authentication procedures when - * the authentication provided by SSL/TLS is not desired or is not - * enough. - * - * Corresponds to the SSL_get_peer_finished routine in OpenSSL and may - * be used to implement the tls-unique channel binding from RFC 5929. - */ - getPeerFinished(): Buffer | undefined; - /** - * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. - * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. - * The value `null` will be returned for server sockets or disconnected client sockets. - * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. - * @returns negotiated SSL/TLS protocol version of the current connection - */ - getProtocol(): string | null; - /** - * Could be used to speed up handshake establishment when reconnecting to the server. - * @returns ASN.1 encoded TLS session or undefined if none was negotiated. - */ - getSession(): Buffer | undefined; - /** - * Returns a list of signature algorithms shared between the server and - * the client in the order of decreasing preference. - */ - getSharedSigalgs(): string[]; - /** - * NOTE: Works only with client TLS sockets. - * Useful only for debugging, for session reuse provide session option to tls.connect(). - * @returns TLS session ticket or undefined if none was negotiated. - */ - getTLSTicket(): Buffer | undefined; - /** - * Returns true if the session was reused, false otherwise. - */ - isSessionReused(): boolean; - /** - * Initiate TLS renegotiation process. - * - * NOTE: Can be used to request peer's certificate after the secure connection has been established. - * ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout. - * @param options - The options may contain the following fields: rejectUnauthorized, - * requestCert (See tls.createServer() for details). - * @param callback - callback(err) will be executed with null as err, once the renegotiation - * is successfully completed. - * @return `undefined` when socket is destroy, `false` if negotiaion can't be initiated. - */ - renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): undefined | boolean; - /** - * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). - * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by - * the TLS layer until the entire fragment is received and its integrity is verified; - * large fragments can span multiple roundtrips, and their processing can be delayed due to packet - * loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, - * which may decrease overall server throughput. - * @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512). - * @returns Returns true on success, false otherwise. - */ - setMaxSendFragment(size: number): boolean; - - /** - * Disables TLS renegotiation for this TLSSocket instance. Once called, - * attempts to renegotiate will trigger an 'error' event on the - * TLSSocket. - */ - disableRenegotiation(): void; - - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * - * Note: The format of the output is identical to the output of `openssl s_client - * -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's - * `SSL_trace()` function, the format is undocumented, can change without notice, - * and should not be relied on. - */ - enableTrace(): void; - - /** - * @param length number of bytes to retrieve from keying material - * @param label an application specific label, typically this will be a value from the - * [IANA Exporter Label Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). - * @param context optionally provide a context. - */ - exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - addListener(event: "secureConnect", listener: () => void): this; - addListener(event: "session", listener: (session: Buffer) => void): this; - addListener(event: "keylog", listener: (line: Buffer) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "OCSPResponse", response: Buffer): boolean; - emit(event: "secureConnect"): boolean; - emit(event: "session", session: Buffer): boolean; - emit(event: "keylog", line: Buffer): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "OCSPResponse", listener: (response: Buffer) => void): this; - on(event: "secureConnect", listener: () => void): this; - on(event: "session", listener: (session: Buffer) => void): this; - on(event: "keylog", listener: (line: Buffer) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "OCSPResponse", listener: (response: Buffer) => void): this; - once(event: "secureConnect", listener: () => void): this; - once(event: "session", listener: (session: Buffer) => void): this; - once(event: "keylog", listener: (line: Buffer) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependListener(event: "secureConnect", listener: () => void): this; - prependListener(event: "session", listener: (session: Buffer) => void): this; - prependListener(event: "keylog", listener: (line: Buffer) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependOnceListener(event: "secureConnect", listener: () => void): this; - prependOnceListener(event: "session", listener: (session: Buffer) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this; - } - - interface CommonConnectionOptions { - /** - * An optional TLS context object from tls.createSecureContext() - */ - secureContext?: SecureContext; - - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * @default false - */ - enableTrace?: boolean; - /** - * If true the server will request a certificate from clients that - * connect and attempt to verify that certificate. Defaults to - * false. - */ - requestCert?: boolean; - /** - * An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) - */ - ALPNProtocols?: string[] | Uint8Array[] | Uint8Array; - /** - * SNICallback(servername, cb) A function that will be - * called if the client supports SNI TLS extension. Two arguments - * will be passed when called: servername and cb. SNICallback should - * invoke cb(null, ctx), where ctx is a SecureContext instance. - * (tls.createSecureContext(...) can be used to get a proper - * SecureContext.) If SNICallback wasn't provided the default callback - * with high-level API will be used (see below). - */ - SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - /** - * If true the server will reject any connection which is not - * authorized with the list of supplied CAs. This option only has an - * effect if requestCert is true. - * @default true - */ - rejectUnauthorized?: boolean; - } - - interface TlsOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * Abort the connection if the SSL/TLS handshake does not finish in the - * specified number of milliseconds. A 'tlsClientError' is emitted on - * the tls.Server object whenever a handshake times out. Default: - * 120000 (120 seconds). - */ - handshakeTimeout?: number; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number; - /** - * 48-bytes of cryptographically strong pseudo-random data. - */ - ticketKeys?: Buffer; - - /** - * - * @param socket - * @param identity identity parameter sent from the client. - * @return pre-shared key that must either be - * a buffer or `null` to stop the negotiation process. Returned PSK must be - * compatible with the selected cipher's digest. - * - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with the identity provided by the client. - * If the return value is `null` the negotiation process will stop and an - * "unknown_psk_identity" alert message will be sent to the other party. - * If the server wishes to hide the fact that the PSK identity was not known, - * the callback must provide some random data as `psk` to make the connection - * fail with "decrypt_error" before negotiation is finished. - * PSK ciphers are disabled by default, and using TLS-PSK thus - * requires explicitly specifying a cipher suite with the `ciphers` option. - * More information can be found in the RFC 4279. - */ - - pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; - /** - * hint to send to a client to help - * with selecting the identity during TLS-PSK negotiation. Will be ignored - * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be - * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. - */ - pskIdentityHint?: string; - } - - interface PSKCallbackNegotation { - psk: DataView | NodeJS.TypedArray; - identitty: string; - } - - interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { - host?: string; - port?: number; - path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. - socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket - checkServerIdentity?: typeof checkServerIdentity; - servername?: string; // SNI TLS Extension - session?: Buffer; - minDHSize?: number; - lookup?: net.LookupFunction; - timeout?: number; - /** - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with optional identity `hint` provided by the server or `null` - * in case of TLS 1.3 where `hint` was removed. - * It will be necessary to provide a custom `tls.checkServerIdentity()` - * for the connection as the default one will try to check hostname/IP - * of the server against the certificate but that's not applicable for PSK - * because there won't be a certificate present. - * More information can be found in the RFC 4279. - * - * @param hint message sent from the server to help client - * decide which identity to use during negotiation. - * Always `null` if TLS 1.3 is used. - * @returns Return `null` to stop the negotiation process. `psk` must be - * compatible with the selected cipher's digest. - * `identity` must use UTF-8 encoding. - */ - pskCallback?(hint: string | null): PSKCallbackNegotation | null; - } - - class Server extends net.Server { - /** - * The server.addContext() method adds a secure context that will be - * used if the client request's SNI name matches the supplied hostname - * (or wildcard). - */ - addContext(hostName: string, credentials: SecureContextOptions): void; - /** - * Returns the session ticket keys. - */ - getTicketKeys(): Buffer; - /** - * - * The server.setSecureContext() method replaces the - * secure context of an existing server. Existing connections to the - * server are not interrupted. - */ - setSecureContext(details: SecureContextOptions): void; - /** - * The server.setSecureContext() method replaces the secure context of - * an existing server. Existing connections to the server are not - * interrupted. - */ - setTicketKeys(keys: Buffer): void; - - /** - * events.EventEmitter - * 1. tlsClientError - * 2. newSession - * 3. OCSPRequest - * 4. resumeSession - * 5. secureConnection - * 6. keylog - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - addListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean; - emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; - emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; - emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - once(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - } - - interface SecurePair { - encrypted: TLSSocket; - cleartext: TLSSocket; - } - - type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; - - interface SecureContextOptions { - /** - * Optionally override the trusted CA certificates. Default is to trust - * the well-known CAs curated by Mozilla. Mozilla's CAs are completely - * replaced when CAs are explicitly specified using this option. - */ - ca?: string | Buffer | Array; - /** - * Cert chains in PEM format. One cert chain should be provided per - * private key. Each cert chain should consist of the PEM formatted - * certificate for a provided private key, followed by the PEM - * formatted intermediate certificates (if any), in order, and not - * including the root CA (the root CA must be pre-known to the peer, - * see ca). When providing multiple cert chains, they do not have to - * be in the same order as their private keys in key. If the - * intermediate certificates are not provided, the peer will not be - * able to validate the certificate, and the handshake will fail. - */ - cert?: string | Buffer | Array; - /** - * Colon-separated list of supported signature algorithms. The list - * can contain digest algorithms (SHA256, MD5 etc.), public key - * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g - * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). - */ - sigalgs?: string; - /** - * Cipher suite specification, replacing the default. For more - * information, see modifying the default cipher suite. Permitted - * ciphers can be obtained via tls.getCiphers(). Cipher names must be - * uppercased in order for OpenSSL to accept them. - */ - ciphers?: string; - /** - * Name of an OpenSSL engine which can provide the client certificate. - */ - clientCertEngine?: string; - /** - * PEM formatted CRLs (Certificate Revocation Lists). - */ - crl?: string | Buffer | Array; - /** - * Diffie Hellman parameters, required for Perfect Forward Secrecy. Use - * openssl dhparam to create the parameters. The key length must be - * greater than or equal to 1024 bits or else an error will be thrown. - * Although 1024 bits is permissible, use 2048 bits or larger for - * stronger security. If omitted or invalid, the parameters are - * silently discarded and DHE ciphers will not be available. - */ - dhparam?: string | Buffer; - /** - * A string describing a named curve or a colon separated list of curve - * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key - * agreement. Set to auto to select the curve automatically. Use - * crypto.getCurves() to obtain a list of available curve names. On - * recent releases, openssl ecparam -list_curves will also display the - * name and description of each available elliptic curve. Default: - * tls.DEFAULT_ECDH_CURVE. - */ - ecdhCurve?: string; - /** - * Attempt to use the server's cipher suite preferences instead of the - * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be - * set in secureOptions - */ - honorCipherOrder?: boolean; - /** - * Private keys in PEM format. PEM allows the option of private keys - * being encrypted. Encrypted keys will be decrypted with - * options.passphrase. Multiple keys using different algorithms can be - * provided either as an array of unencrypted key strings or buffers, - * or an array of objects in the form {pem: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted keys will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - key?: string | Buffer | Array; - /** - * Name of an OpenSSL engine to get private key from. Should be used - * together with privateKeyIdentifier. - */ - privateKeyEngine?: string; - /** - * Identifier of a private key managed by an OpenSSL engine. Should be - * used together with privateKeyEngine. Should not be set together with - * key, because both options define a private key in different ways. - */ - privateKeyIdentifier?: string; - /** - * Optionally set the maximum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. - * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using - * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to - * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. - */ - maxVersion?: SecureVersion; - /** - * Optionally set the minimum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. It is not recommended to use - * less than TLSv1.2, but it may be required for interoperability. - * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using - * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to - * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. - */ - minVersion?: SecureVersion; - /** - * Shared passphrase used for a single private key and/or a PFX. - */ - passphrase?: string; - /** - * PFX or PKCS12 encoded private key and certificate chain. pfx is an - * alternative to providing key and cert individually. PFX is usually - * encrypted, if it is, passphrase will be used to decrypt it. Multiple - * PFX can be provided either as an array of unencrypted PFX buffers, - * or an array of objects in the form {buf: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted PFX will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - pfx?: string | Buffer | Array; - /** - * Optionally affect the OpenSSL protocol behavior, which is not - * usually necessary. This should be used carefully if at all! Value is - * a numeric bitmask of the SSL_OP_* options from OpenSSL Options - */ - secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options - /** - * Legacy mechanism to select the TLS protocol version to use, it does - * not support independent control of the minimum and maximum version, - * and does not support limiting the protocol to TLSv1.3. Use - * minVersion and maxVersion instead. The possible values are listed as - * SSL_METHODS, use the function names as strings. For example, use - * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow - * any TLS protocol version up to TLSv1.3. It is not recommended to use - * TLS versions less than 1.2, but it may be required for - * interoperability. Default: none, see minVersion. - */ - secureProtocol?: string; - /** - * Opaque identifier used by servers to ensure session state is not - * shared between applications. Unused by clients. - */ - sessionIdContext?: string; - /** - * 48-bytes of cryptographically strong pseudo-random data. - * See Session Resumption for more information. - */ - ticketKeys?: Buffer; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number; - } - - interface SecureContext { - context: any; - } - - /* - * Verifies the certificate `cert` is issued to host `host`. - * @host The hostname to verify the certificate against - * @cert PeerCertificate representing the peer's certificate - * - * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined. - */ - function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined; - function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; - function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; - function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - /** - * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. - */ - function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; - function createSecureContext(options?: SecureContextOptions): SecureContext; - function getCiphers(): string[]; - - /** - * The default curve name to use for ECDH key agreement in a tls server. - * The default value is 'auto'. See tls.createSecureContext() for further - * information. - */ - let DEFAULT_ECDH_CURVE: string; - /** - * The default value of the maxVersion option of - * tls.createSecureContext(). It can be assigned any of the supported TLS - * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: - * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets - * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the highest maximum - * is used. - */ - let DEFAULT_MAX_VERSION: SecureVersion; - /** - * The default value of the minVersion option of tls.createSecureContext(). - * It can be assigned any of the supported TLS protocol versions, - * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless - * changed using CLI options. Using --tls-min-v1.0 sets the default to - * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using - * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options - * are provided, the lowest minimum is used. - */ - let DEFAULT_MIN_VERSION: SecureVersion; - - /** - * An immutable array of strings representing the root certificates (in PEM - * format) used for verifying peer certificates. This is the default value - * of the ca option to tls.createSecureContext(). - */ - const rootCertificates: ReadonlyArray; -} diff --git a/node_modules/@types/node/trace_events.d.ts b/node_modules/@types/node/trace_events.d.ts deleted file mode 100644 index 1f3a89c4..00000000 --- a/node_modules/@types/node/trace_events.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -declare module "trace_events" { - /** - * The `Tracing` object is used to enable or disable tracing for sets of - * categories. Instances are created using the - * `trace_events.createTracing()` method. - * - * When created, the `Tracing` object is disabled. Calling the - * `tracing.enable()` method adds the categories to the set of enabled trace - * event categories. Calling `tracing.disable()` will remove the categories - * from the set of enabled trace event categories. - */ - interface Tracing { - /** - * A comma-separated list of the trace event categories covered by this - * `Tracing` object. - */ - readonly categories: string; - - /** - * Disables this `Tracing` object. - * - * Only trace event categories _not_ covered by other enabled `Tracing` - * objects and _not_ specified by the `--trace-event-categories` flag - * will be disabled. - */ - disable(): void; - - /** - * Enables this `Tracing` object for the set of categories covered by - * the `Tracing` object. - */ - enable(): void; - - /** - * `true` only if the `Tracing` object has been enabled. - */ - readonly enabled: boolean; - } - - interface CreateTracingOptions { - /** - * An array of trace category names. Values included in the array are - * coerced to a string when possible. An error will be thrown if the - * value cannot be coerced. - */ - categories: string[]; - } - - /** - * Creates and returns a Tracing object for the given set of categories. - */ - function createTracing(options: CreateTracingOptions): Tracing; - - /** - * Returns a comma-separated list of all currently-enabled trace event - * categories. The current set of enabled trace event categories is - * determined by the union of all currently-enabled `Tracing` objects and - * any categories enabled using the `--trace-event-categories` flag. - */ - function getEnabledCategories(): string | undefined; -} diff --git a/node_modules/@types/node/ts3.4/assert.d.ts b/node_modules/@types/node/ts3.4/assert.d.ts deleted file mode 100644 index 4bc6c729..00000000 --- a/node_modules/@types/node/ts3.4/assert.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -declare module 'assert' { - /** An alias of `assert.ok()`. */ - function assert(value: any, message?: string | Error): void; - namespace assert { - class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - code: 'ERR_ASSERTION'; - - constructor(options?: { - /** If provided, the error message is set to this value. */ - message?: string; - /** The `actual` property on the error instance. */ - actual?: any; - /** The `expected` property on the error instance. */ - expected?: any; - /** The `operator` property on the error instance. */ - operator?: string; - /** If provided, the generated stack trace omits frames before this function. */ - stackStartFn?: Function; - }); - } - - class CallTracker { - calls(exact?: number): () => void; - calls any>(fn?: Func, exact?: number): Func; - report(): CallTrackerReportInformation[]; - verify(): void; - } - interface CallTrackerReportInformation { - message: string; - /** The actual number of times the function was called. */ - actual: number; - /** The number of times the function was expected to be called. */ - expected: number; - /** The name of the function that is wrapped. */ - operator: string; - /** A stack trace of the function. */ - stack: object; - } - - type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error; - - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: any, - expected: any, - message?: string | Error, - operator?: string, - stackStartFn?: Function, - ): never; - function ok(value: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use strictEqual() instead. */ - function equal(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notStrictEqual() instead. */ - function notEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */ - function deepEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */ - function notDeepEqual(actual: any, expected: any, message?: string | Error): void; - function strictEqual(actual: any, expected: any, message?: string | Error): void; - function notStrictEqual(actual: any, expected: any, message?: string | Error): void; - function deepStrictEqual(actual: any, expected: any, message?: string | Error): void; - function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; - - function throws(block: () => any, message?: string | Error): void; - function throws(block: () => any, error: AssertPredicate, message?: string | Error): void; - function doesNotThrow(block: () => any, message?: string | Error): void; - function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void; - - function ifError(value: any): void; - - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: RegExp | Function, - message?: string | Error, - ): Promise; - - function match(value: string, regExp: RegExp, message?: string | Error): void; - function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; - - const strict: typeof assert; - } - - export = assert; -} diff --git a/node_modules/@types/node/ts3.4/base.d.ts b/node_modules/@types/node/ts3.4/base.d.ts deleted file mode 100644 index 2ea04f58..00000000 --- a/node_modules/@types/node/ts3.4/base.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.2 - 3.4. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.2/base.d.ts - Definitions specific to TypeScript 3.2 -// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with global and assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: - -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/node_modules/@types/node/ts3.4/globals.global.d.ts b/node_modules/@types/node/ts3.4/globals.global.d.ts deleted file mode 100644 index 8e854665..00000000 --- a/node_modules/@types/node/ts3.4/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: NodeJS.Global; diff --git a/node_modules/@types/node/ts3.4/index.d.ts b/node_modules/@types/node/ts3.4/index.d.ts deleted file mode 100644 index 506b32a5..00000000 --- a/node_modules/@types/node/ts3.4/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.2 - 3.4. -// This is required to enable globalThis support for global in ts3.5 without causing errors -// This is required to enable typing assert in ts3.7 without causing errors -// Typically type modifiations should be made in base.d.ts instead of here - -/// -/// -/// diff --git a/node_modules/@types/node/ts3.6/base.d.ts b/node_modules/@types/node/ts3.6/base.d.ts deleted file mode 100644 index 05afa406..00000000 --- a/node_modules/@types/node/ts3.6/base.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.5. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.5/base.d.ts - Definitions specific to TypeScript 3.5 -// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5 with assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// - -// TypeScript 3.5-specific augmentations: -/// - -// TypeScript 3.5-specific augmentations: -/// diff --git a/node_modules/@types/node/ts3.6/index.d.ts b/node_modules/@types/node/ts3.6/index.d.ts deleted file mode 100644 index 7e6b98cc..00000000 --- a/node_modules/@types/node/ts3.6/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.5 - 3.6. -// This is required to enable typing assert in ts3.7 without causing errors -// Typically type modifications should be made in base.d.ts instead of here - -/// - -/// diff --git a/node_modules/@types/node/tty.d.ts b/node_modules/@types/node/tty.d.ts deleted file mode 100644 index 78543663..00000000 --- a/node_modules/@types/node/tty.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -declare module "tty" { - import * as net from "net"; - - function isatty(fd: number): boolean; - class ReadStream extends net.Socket { - constructor(fd: number, options?: net.SocketConstructorOpts); - isRaw: boolean; - setRawMode(mode: boolean): this; - isTTY: boolean; - } - /** - * -1 - to the left from cursor - * 0 - the entire line - * 1 - to the right from cursor - */ - type Direction = -1 | 0 | 1; - class WriteStream extends net.Socket { - constructor(fd: number); - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "resize", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "resize"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "resize", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "resize", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "resize", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "resize", listener: () => void): this; - - /** - * Clears the current line of this WriteStream in a direction identified by `dir`. - */ - clearLine(dir: Direction, callback?: () => void): boolean; - /** - * Clears this `WriteStream` from the current cursor down. - */ - clearScreenDown(callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor to the specified position. - */ - cursorTo(x: number, y?: number, callback?: () => void): boolean; - cursorTo(x: number, callback: () => void): boolean; - /** - * Moves this WriteStream's cursor relative to its current position. - */ - moveCursor(dx: number, dy: number, callback?: () => void): boolean; - /** - * @default `process.env` - */ - getColorDepth(env?: {}): number; - hasColors(depth?: number): boolean; - hasColors(env?: {}): boolean; - hasColors(depth: number, env?: {}): boolean; - getWindowSize(): [number, number]; - columns: number; - rows: number; - isTTY: boolean; - } -} diff --git a/node_modules/@types/node/url.d.ts b/node_modules/@types/node/url.d.ts deleted file mode 100644 index 2490c352..00000000 --- a/node_modules/@types/node/url.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -declare module "url" { - import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring'; - - // Input to `url.format` - interface UrlObject { - auth?: string | null; - hash?: string | null; - host?: string | null; - hostname?: string | null; - href?: string | null; - pathname?: string | null; - protocol?: string | null; - search?: string | null; - slashes?: boolean | null; - port?: string | number | null; - query?: string | null | ParsedUrlQueryInput; - } - - // Output of `url.parse` - interface Url { - auth: string | null; - hash: string | null; - host: string | null; - hostname: string | null; - href: string; - path: string | null; - pathname: string | null; - protocol: string | null; - search: string | null; - slashes: boolean | null; - port: string | null; - query: string | null | ParsedUrlQuery; - } - - interface UrlWithParsedQuery extends Url { - query: ParsedUrlQuery; - } - - interface UrlWithStringQuery extends Url { - query: string | null; - } - - function parse(urlStr: string): UrlWithStringQuery; - function parse(urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery; - function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; - function parse(urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; - - function format(URL: URL, options?: URLFormatOptions): string; - function format(urlObject: UrlObject | string): string; - function resolve(from: string, to: string): string; - - function domainToASCII(domain: string): string; - function domainToUnicode(domain: string): string; - - /** - * This function ensures the correct decodings of percent-encoded characters as - * well as ensuring a cross-platform valid absolute path string. - * @param url The file URL string or URL object to convert to a path. - */ - function fileURLToPath(url: string | URL): string; - - /** - * This function ensures that path is resolved absolutely, and that the URL - * control characters are correctly encoded when converting into a File URL. - * @param url The path to convert to a File URL. - */ - function pathToFileURL(url: string): URL; - - interface URLFormatOptions { - auth?: boolean; - fragment?: boolean; - search?: boolean; - unicode?: boolean; - } - - class URL { - constructor(input: string, base?: string | URL); - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - readonly searchParams: URLSearchParams; - username: string; - toString(): string; - toJSON(): string; - } - - class URLSearchParams implements Iterable<[string, string]> { - constructor(init?: URLSearchParams | string | NodeJS.Dict> | Iterable<[string, string]> | ReadonlyArray<[string, string]>); - append(name: string, value: string): void; - delete(name: string): void; - entries(): IterableIterator<[string, string]>; - forEach(callback: (value: string, name: string, searchParams: this) => void): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - keys(): IterableIterator; - set(name: string, value: string): void; - sort(): void; - toString(): string; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[string, string]>; - } -} diff --git a/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts deleted file mode 100644 index f4d1bda1..00000000 --- a/node_modules/@types/node/util.d.ts +++ /dev/null @@ -1,196 +0,0 @@ -declare module "util" { - interface InspectOptions extends NodeJS.InspectOptions { } - type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module'; - type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string; - interface InspectOptionsStylized extends InspectOptions { - stylize(text: string, styleType: Style): string; - } - function format(format: any, ...param: any[]): string; - function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string; - /** @deprecated since v0.11.3 - use a third party module instead. */ - function log(string: string): void; - function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - function inspect(object: any, options: InspectOptions): string; - namespace inspect { - let colors: NodeJS.Dict<[number, number]>; - let styles: { - [K in Style]: string - }; - let defaultOptions: InspectOptions; - /** - * Allows changing inspect settings from the repl. - */ - let replDefaults: InspectOptions; - const custom: unique symbol; - } - /** @deprecated since v4.0.0 - use `Array.isArray()` instead. */ - function isArray(object: any): object is any[]; - /** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */ - function isRegExp(object: any): object is RegExp; - /** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */ - function isDate(object: any): object is Date; - /** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */ - function isError(object: any): object is Error; - function inherits(constructor: any, superConstructor: any): void; - function debuglog(key: string): (msg: string, ...param: any[]) => void; - /** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */ - function isBoolean(object: any): object is boolean; - /** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */ - function isBuffer(object: any): object is Buffer; - /** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */ - function isFunction(object: any): boolean; - /** @deprecated since v4.0.0 - use `value === null` instead. */ - function isNull(object: any): object is null; - /** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */ - function isNullOrUndefined(object: any): object is null | undefined; - /** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */ - function isNumber(object: any): object is number; - /** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */ - function isObject(object: any): boolean; - /** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */ - function isPrimitive(object: any): boolean; - /** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */ - function isString(object: any): object is string; - /** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */ - function isSymbol(object: any): object is symbol; - /** @deprecated since v4.0.0 - use `value === undefined` instead. */ - function isUndefined(object: any): object is undefined; - function deprecate(fn: T, message: string, code?: string): T; - function isDeepStrictEqual(val1: any, val2: any): boolean; - - function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - - interface CustomPromisifyLegacy extends Function { - __promisify__: TCustom; - } - - interface CustomPromisifySymbol extends Function { - [promisify.custom]: TCustom; - } - - type CustomPromisify = CustomPromisifySymbol | CustomPromisifyLegacy; - - function promisify(fn: CustomPromisify): TCustom; - function promisify(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise; - function promisify(fn: (callback: (err?: any) => void) => void): () => Promise; - function promisify(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void): - (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void): - (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - function promisify(fn: Function): Function; - namespace promisify { - const custom: unique symbol; - } - - namespace types { - function isAnyArrayBuffer(object: any): boolean; - function isArgumentsObject(object: any): object is IArguments; - function isArrayBuffer(object: any): object is ArrayBuffer; - function isArrayBufferView(object: any): object is ArrayBufferView; - function isAsyncFunction(object: any): boolean; - function isBigInt64Array(value: any): value is BigInt64Array; - function isBigUint64Array(value: any): value is BigUint64Array; - function isBooleanObject(object: any): object is Boolean; - function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */); - function isDataView(object: any): object is DataView; - function isDate(object: any): object is Date; - function isExternal(object: any): boolean; - function isFloat32Array(object: any): object is Float32Array; - function isFloat64Array(object: any): object is Float64Array; - function isGeneratorFunction(object: any): boolean; - function isGeneratorObject(object: any): boolean; - function isInt8Array(object: any): object is Int8Array; - function isInt16Array(object: any): object is Int16Array; - function isInt32Array(object: any): object is Int32Array; - function isMap(object: any): boolean; - function isMapIterator(object: any): boolean; - function isModuleNamespaceObject(value: any): boolean; - function isNativeError(object: any): object is Error; - function isNumberObject(object: any): object is Number; - function isPromise(object: any): boolean; - function isProxy(object: any): boolean; - function isRegExp(object: any): object is RegExp; - function isSet(object: any): boolean; - function isSetIterator(object: any): boolean; - function isSharedArrayBuffer(object: any): boolean; - function isStringObject(object: any): boolean; - function isSymbolObject(object: any): boolean; - function isTypedArray(object: any): object is NodeJS.TypedArray; - function isUint8Array(object: any): object is Uint8Array; - function isUint8ClampedArray(object: any): object is Uint8ClampedArray; - function isUint16Array(object: any): object is Uint16Array; - function isUint32Array(object: any): object is Uint32Array; - function isWeakMap(object: any): boolean; - function isWeakSet(object: any): boolean; - function isWebAssemblyCompiledModule(object: any): boolean; - } - - class TextDecoder { - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; - constructor( - encoding?: string, - options?: { fatal?: boolean; ignoreBOM?: boolean } - ); - decode( - input?: NodeJS.ArrayBufferView | ArrayBuffer | null, - options?: { stream?: boolean } - ): string; - } - - interface EncodeIntoResult { - /** - * The read Unicode code units of input. - */ - - read: number; - /** - * The written UTF-8 bytes of output. - */ - written: number; - } - - class TextEncoder { - readonly encoding: string; - encode(input?: string): Uint8Array; - encodeInto(input: string, output: Uint8Array): EncodeIntoResult; - } -} diff --git a/node_modules/@types/node/v8.d.ts b/node_modules/@types/node/v8.d.ts deleted file mode 100644 index 7d950824..00000000 --- a/node_modules/@types/node/v8.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -declare module "v8" { - import { Readable } from "stream"; - - interface HeapSpaceInfo { - space_name: string; - space_size: number; - space_used_size: number; - space_available_size: number; - physical_space_size: number; - } - - // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ - type DoesZapCodeSpaceFlag = 0 | 1; - - interface HeapInfo { - total_heap_size: number; - total_heap_size_executable: number; - total_physical_size: number; - total_available_size: number; - used_heap_size: number; - heap_size_limit: number; - malloced_memory: number; - peak_malloced_memory: number; - does_zap_garbage: DoesZapCodeSpaceFlag; - number_of_native_contexts: number; - number_of_detached_contexts: number; - } - - interface HeapCodeStatistics { - code_and_metadata_size: number; - bytecode_and_metadata_size: number; - external_script_source_size: number; - } - - /** - * Returns an integer representing a "version tag" derived from the V8 version, command line flags and detected CPU features. - * This is useful for determining whether a vm.Script cachedData buffer is compatible with this instance of V8. - */ - function cachedDataVersionTag(): number; - - function getHeapStatistics(): HeapInfo; - function getHeapSpaceStatistics(): HeapSpaceInfo[]; - function setFlagsFromString(flags: string): void; - /** - * Generates a snapshot of the current V8 heap and returns a Readable - * Stream that may be used to read the JSON serialized representation. - * This conversation was marked as resolved by joyeecheung - * This JSON stream format is intended to be used with tools such as - * Chrome DevTools. The JSON schema is undocumented and specific to the - * V8 engine, and may change from one version of V8 to the next. - */ - function getHeapSnapshot(): Readable; - - /** - * - * @param fileName The file path where the V8 heap snapshot is to be - * saved. If not specified, a file name with the pattern - * `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be - * generated, where `{pid}` will be the PID of the Node.js process, - * `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from - * the main Node.js thread or the id of a worker thread. - */ - function writeHeapSnapshot(fileName?: string): string; - - function getHeapCodeStatistics(): HeapCodeStatistics; - - class Serializer { - /** - * Writes out a header, which includes the serialization format version. - */ - writeHeader(): void; - - /** - * Serializes a JavaScript value and adds the serialized representation to the internal buffer. - * This throws an error if value cannot be serialized. - */ - writeValue(val: any): boolean; - - /** - * Returns the stored internal buffer. - * This serializer should not be used once the buffer is released. - * Calling this method results in undefined behavior if a previous write has failed. - */ - releaseBuffer(): Buffer; - - /** - * Marks an ArrayBuffer as having its contents transferred out of band.\ - * Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer(). - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - - /** - * Write a raw 32-bit unsigned integer. - */ - writeUint32(value: number): void; - - /** - * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. - */ - writeUint64(hi: number, lo: number): void; - - /** - * Write a JS number value. - */ - writeDouble(value: number): void; - - /** - * Write raw bytes into the serializer’s internal buffer. - * The deserializer will require a way to compute the length of the buffer. - */ - writeRawBytes(buffer: NodeJS.TypedArray): void; - } - - /** - * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, - * and only stores the part of their underlying `ArrayBuffers` that they are referring to. - */ - class DefaultSerializer extends Serializer { - } - - class Deserializer { - constructor(data: NodeJS.TypedArray); - /** - * Reads and validates a header (including the format version). - * May, for example, reject an invalid or unsupported wire format. - * In that case, an Error is thrown. - */ - readHeader(): boolean; - - /** - * Deserializes a JavaScript value from the buffer and returns it. - */ - readValue(): any; - - /** - * Marks an ArrayBuffer as having its contents transferred out of band. - * Pass the corresponding `ArrayBuffer` in the serializing context to serializer.transferArrayBuffer() - * (or return the id from serializer._getSharedArrayBufferId() in the case of SharedArrayBuffers). - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - - /** - * Reads the underlying wire format version. - * Likely mostly to be useful to legacy code reading old wire format versions. - * May not be called before .readHeader(). - */ - getWireFormatVersion(): number; - - /** - * Read a raw 32-bit unsigned integer and return it. - */ - readUint32(): number; - - /** - * Read a raw 64-bit unsigned integer and return it as an array [hi, lo] with two 32-bit unsigned integer entries. - */ - readUint64(): [number, number]; - - /** - * Read a JS number value. - */ - readDouble(): number; - - /** - * Read raw bytes from the deserializer’s internal buffer. - * The length parameter must correspond to the length of the buffer that was passed to serializer.writeRawBytes(). - */ - readRawBytes(length: number): Buffer; - } - - /** - * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, - * and only stores the part of their underlying `ArrayBuffers` that they are referring to. - */ - class DefaultDeserializer extends Deserializer { - } - - /** - * Uses a `DefaultSerializer` to serialize value into a buffer. - */ - function serialize(value: any): Buffer; - - /** - * Uses a `DefaultDeserializer` with default options to read a JS value from a buffer. - */ - function deserialize(data: NodeJS.TypedArray): any; -} diff --git a/node_modules/@types/node/vm.d.ts b/node_modules/@types/node/vm.d.ts deleted file mode 100644 index 399c2a6a..00000000 --- a/node_modules/@types/node/vm.d.ts +++ /dev/null @@ -1,146 +0,0 @@ -declare module "vm" { - interface Context extends NodeJS.Dict { } - interface BaseOptions { - /** - * Specifies the filename used in stack traces produced by this script. - * Default: `''`. - */ - filename?: string; - /** - * Specifies the line number offset that is displayed in stack traces produced by this script. - * Default: `0`. - */ - lineOffset?: number; - /** - * Specifies the column number offset that is displayed in stack traces produced by this script. - * Default: `0` - */ - columnOffset?: number; - } - interface ScriptOptions extends BaseOptions { - displayErrors?: boolean; - timeout?: number; - cachedData?: Buffer; - produceCachedData?: boolean; - } - interface RunningScriptOptions extends BaseOptions { - /** - * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * Default: `true`. - */ - displayErrors?: boolean; - /** - * Specifies the number of milliseconds to execute code before terminating execution. - * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer. - */ - timeout?: number; - /** - * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. - * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that. - * If execution is terminated, an `Error` will be thrown. - * Default: `false`. - */ - breakOnSigint?: boolean; - /** - * If set to `afterEvaluate`, microtasks will be run immediately after the script has run. - */ - microtaskMode?: 'afterEvaluate'; - } - interface CompileFunctionOptions extends BaseOptions { - /** - * Provides an optional data with V8's code cache data for the supplied source. - */ - cachedData?: Buffer; - /** - * Specifies whether to produce new cache data. - * Default: `false`, - */ - produceCachedData?: boolean; - /** - * The sandbox/context in which the said function should be compiled in. - */ - parsingContext?: Context; - - /** - * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling - */ - contextExtensions?: Object[]; - } - - interface CreateContextOptions { - /** - * Human-readable name of the newly created context. - * @default 'VM Context i' Where i is an ascending numerical index of the created context. - */ - name?: string; - /** - * Corresponds to the newly created context for display purposes. - * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary), - * like the value of the `url.origin` property of a URL object. - * Most notably, this string should omit the trailing slash, as that denotes a path. - * @default '' - */ - origin?: string; - codeGeneration?: { - /** - * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc) - * will throw an EvalError. - * @default true - */ - strings?: boolean; - /** - * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError. - * @default true - */ - wasm?: boolean; - }; - } - - type MeasureMemoryMode = 'summary' | 'detailed'; - - interface MeasureMemoryOptions { - /** - * @default 'summary' - */ - mode?: MeasureMemoryMode; - context?: Context; - } - - interface MemoryMeasurement { - total: { - jsMemoryEstimate: number; - jsMemoryRange: [number, number]; - }; - } - - class Script { - constructor(code: string, options?: ScriptOptions); - runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any; - runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any; - runInThisContext(options?: RunningScriptOptions): any; - createCachedData(): Buffer; - } - function createContext(sandbox?: Context, options?: CreateContextOptions): Context; - function isContext(sandbox: Context): boolean; - function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any; - function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any; - function runInThisContext(code: string, options?: RunningScriptOptions | string): any; - function compileFunction(code: string, params?: ReadonlyArray, options?: CompileFunctionOptions): Function; - - /** - * Measure the memory known to V8 and used by the current execution context or a specified context. - * - * The format of the object that the returned Promise may resolve with is - * specific to the V8 engine and may change from one version of V8 to the next. - * - * The returned result is different from the statistics returned by - * `v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measures - * the memory reachable by V8 from a specific context, while - * `v8.getHeapSpaceStatistics()` measures the memory used by an instance - * of V8 engine, which can switch among multiple contexts that reference - * objects in the heap of one engine. - * - * @experimental - */ - function measureMemory(options?: MeasureMemoryOptions): Promise; -} diff --git a/node_modules/@types/node/wasi.d.ts b/node_modules/@types/node/wasi.d.ts deleted file mode 100644 index fe2b2aab..00000000 --- a/node_modules/@types/node/wasi.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -declare module 'wasi' { - interface WASIOptions { - /** - * An array of strings that the WebAssembly application will - * see as command line arguments. The first argument is the virtual path to the - * WASI command itself. - */ - args?: string[]; - - /** - * An object similar to `process.env` that the WebAssembly - * application will see as its environment. - */ - env?: object; - - /** - * This object represents the WebAssembly application's - * sandbox directory structure. The string keys of `preopens` are treated as - * directories within the sandbox. The corresponding values in `preopens` are - * the real paths to those directories on the host machine. - */ - preopens?: NodeJS.Dict; - - /** - * By default, WASI applications terminate the Node.js - * process via the `__wasi_proc_exit()` function. Setting this option to `true` - * causes `wasi.start()` to return the exit code rather than terminate the - * process. - * @default false - */ - returnOnExit?: boolean; - - /** - * The file descriptor used as standard input in the WebAssembly application. - * @default 0 - */ - stdin?: number; - - /** - * The file descriptor used as standard output in the WebAssembly application. - * @default 1 - */ - stdout?: number; - - /** - * The file descriptor used as standard error in the WebAssembly application. - * @default 2 - */ - stderr?: number; - } - - class WASI { - constructor(options?: WASIOptions); - /** - * - * Attempt to begin execution of `instance` by invoking its `_start()` export. - * If `instance` does not contain a `_start()` export, then `start()` attempts to - * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports - * is present on `instance`, then `start()` does nothing. - * - * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named - * `memory`. If `instance` does not have a `memory` export an exception is thrown. - * - * If `start()` is called more than once, an exception is thrown. - */ - start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib. - - /** - * Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present. - * If `instance` contains a `_start()` export, then an exception is thrown. - * - * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named - * `memory`. If `instance` does not have a `memory` export an exception is thrown. - * - * If `initialize()` is called more than once, an exception is thrown. - */ - initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib. - - /** - * Is an object that implements the WASI system call API. This object - * should be passed as the `wasi_snapshot_preview1` import during the instantiation of a - * [`WebAssembly.Instance`][]. - */ - readonly wasiImport: NodeJS.Dict; // TODO: Narrow to DOM types - } -} diff --git a/node_modules/@types/node/worker_threads.d.ts b/node_modules/@types/node/worker_threads.d.ts deleted file mode 100644 index 3a8881e6..00000000 --- a/node_modules/@types/node/worker_threads.d.ts +++ /dev/null @@ -1,238 +0,0 @@ -declare module "worker_threads" { - import { Context } from "vm"; - import { EventEmitter } from "events"; - import { Readable, Writable } from "stream"; - import { URL } from "url"; - import { FileHandle } from "fs/promises"; - - const isMainThread: boolean; - const parentPort: null | MessagePort; - const resourceLimits: ResourceLimits; - const SHARE_ENV: unique symbol; - const threadId: number; - const workerData: any; - - class MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; - } - - type TransferListItem = ArrayBuffer | MessagePort | FileHandle; - - class MessagePort extends EventEmitter { - close(): void; - postMessage(value: any, transferList?: ReadonlyArray): void; - ref(): void; - unref(): void; - start(): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "message", listener: (value: any) => void): this; - addListener(event: "messageerror", listener: (error: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "message", value: any): boolean; - emit(event: "messageerror", error: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "message", listener: (value: any) => void): this; - on(event: "messageerror", listener: (error: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "message", listener: (value: any) => void): this; - once(event: "messageerror", listener: (error: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "message", listener: (value: any) => void): this; - prependListener(event: "messageerror", listener: (error: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "message", listener: (value: any) => void): this; - prependOnceListener(event: "messageerror", listener: (error: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "message", listener: (value: any) => void): this; - removeListener(event: "messageerror", listener: (error: Error) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - off(event: "close", listener: () => void): this; - off(event: "message", listener: (value: any) => void): this; - off(event: "messageerror", listener: (error: Error) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface WorkerOptions { - /** - * List of arguments which would be stringified and appended to - * `process.argv` in the worker. This is mostly similar to the `workerData` - * but the values will be available on the global `process.argv` as if they - * were passed as CLI options to the script. - */ - argv?: any[]; - env?: NodeJS.Dict | typeof SHARE_ENV; - eval?: boolean; - workerData?: any; - stdin?: boolean; - stdout?: boolean; - stderr?: boolean; - execArgv?: string[]; - resourceLimits?: ResourceLimits; - /** - * Additional data to send in the first worker message. - */ - transferList?: TransferListItem[]; - trackUnmanagedFds?: boolean; - } - - interface ResourceLimits { - /** - * The maximum size of a heap space for recently created objects. - */ - maxYoungGenerationSizeMb?: number; - /** - * The maximum size of the main heap in MB. - */ - maxOldGenerationSizeMb?: number; - /** - * The size of a pre-allocated memory range used for generated code. - */ - codeRangeSizeMb?: number; - /** - * The default maximum stack size for the thread. Small values may lead to unusable Worker instances. - * @default 4 - */ - stackSizeMb?: number; - } - - class Worker extends EventEmitter { - readonly stdin: Writable | null; - readonly stdout: Readable; - readonly stderr: Readable; - readonly threadId: number; - readonly resourceLimits?: ResourceLimits; - - /** - * @param filename The path to the Worker’s main script or module. - * Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../, - * or a WHATWG URL object using file: protocol. If options.eval is true, this is a string containing JavaScript code rather than a path. - */ - constructor(filename: string | URL, options?: WorkerOptions); - - postMessage(value: any, transferList?: ReadonlyArray): void; - ref(): void; - unref(): void; - /** - * Stop all JavaScript execution in the worker thread as soon as possible. - * Returns a Promise for the exit code that is fulfilled when the `exit` event is emitted. - */ - terminate(): Promise; - - /** - * Returns a readable stream for a V8 snapshot of the current state of the Worker. - * See [`v8.getHeapSnapshot()`][] for more details. - * - * If the Worker thread is no longer running, which may occur before the - * [`'exit'` event][] is emitted, the returned `Promise` will be rejected - * immediately with an [`ERR_WORKER_NOT_RUNNING`][] error - */ - getHeapSnapshot(): Promise; - - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (exitCode: number) => void): this; - addListener(event: "message", listener: (value: any) => void): this; - addListener(event: "messageerror", listener: (error: Error) => void): this; - addListener(event: "online", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "error", err: Error): boolean; - emit(event: "exit", exitCode: number): boolean; - emit(event: "message", value: any): boolean; - emit(event: "messageerror", error: Error): boolean; - emit(event: "online"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (exitCode: number) => void): this; - on(event: "message", listener: (value: any) => void): this; - on(event: "messageerror", listener: (error: Error) => void): this; - on(event: "online", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (exitCode: number) => void): this; - once(event: "message", listener: (value: any) => void): this; - once(event: "messageerror", listener: (error: Error) => void): this; - once(event: "online", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (exitCode: number) => void): this; - prependListener(event: "message", listener: (value: any) => void): this; - prependListener(event: "messageerror", listener: (error: Error) => void): this; - prependListener(event: "online", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "exit", listener: (exitCode: number) => void): this; - prependOnceListener(event: "message", listener: (value: any) => void): this; - prependOnceListener(event: "messageerror", listener: (error: Error) => void): this; - prependOnceListener(event: "online", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "exit", listener: (exitCode: number) => void): this; - removeListener(event: "message", listener: (value: any) => void): this; - removeListener(event: "messageerror", listener: (error: Error) => void): this; - removeListener(event: "online", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - off(event: "error", listener: (err: Error) => void): this; - off(event: "exit", listener: (exitCode: number) => void): this; - off(event: "message", listener: (value: any) => void): this; - off(event: "messageerror", listener: (error: Error) => void): this; - off(event: "online", listener: () => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - } - - /** - * Mark an object as not transferable. - * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored. - * - * In particular, this makes sense for objects that can be cloned, rather than transferred, - * and which are used by other objects on the sending side. For example, Node.js marks - * the `ArrayBuffer`s it uses for its Buffer pool with this. - * - * This operation cannot be undone. - */ - function markAsUntransferable(object: object): void; - - /** - * Transfer a `MessagePort` to a different `vm` Context. The original `port` - * object will be rendered unusable, and the returned `MessagePort` instance will - * take its place. - * - * The returned `MessagePort` will be an object in the target context, and will - * inherit from its global `Object` class. Objects passed to the - * `port.onmessage()` listener will also be created in the target context - * and inherit from its global `Object` class. - * - * However, the created `MessagePort` will no longer inherit from - * `EventEmitter`, and only `port.onmessage()` can be used to receive - * events using it. - */ - function moveMessagePortToContext(port: MessagePort, context: Context): MessagePort; - - /** - * Receive a single message from a given `MessagePort`. If no message is available, - * `undefined` is returned, otherwise an object with a single `message` property - * that contains the message payload, corresponding to the oldest message in the - * `MessagePort`’s queue. - */ - function receiveMessageOnPort(port: MessagePort): { message: any } | undefined; -} diff --git a/node_modules/@types/node/zlib.d.ts b/node_modules/@types/node/zlib.d.ts deleted file mode 100644 index 754f5ed1..00000000 --- a/node_modules/@types/node/zlib.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -declare module "zlib" { - import * as stream from "stream"; - - interface ZlibOptions { - /** - * @default constants.Z_NO_FLUSH - */ - flush?: number; - /** - * @default constants.Z_FINISH - */ - finishFlush?: number; - /** - * @default 16*1024 - */ - chunkSize?: number; - windowBits?: number; - level?: number; // compression only - memLevel?: number; // compression only - strategy?: number; // compression only - dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default - info?: boolean; - maxOutputLength?: number; - } - - interface BrotliOptions { - /** - * @default constants.BROTLI_OPERATION_PROCESS - */ - flush?: number; - /** - * @default constants.BROTLI_OPERATION_FINISH - */ - finishFlush?: number; - /** - * @default 16*1024 - */ - chunkSize?: number; - params?: { - /** - * Each key is a `constants.BROTLI_*` constant. - */ - [key: number]: boolean | number; - }; - maxOutputLength?: number; - } - - interface Zlib { - /** @deprecated Use bytesWritten instead. */ - readonly bytesRead: number; - readonly bytesWritten: number; - shell?: boolean | string; - close(callback?: () => void): void; - flush(kind?: number, callback?: () => void): void; - flush(callback?: () => void): void; - } - - interface ZlibParams { - params(level: number, strategy: number, callback: () => void): void; - } - - interface ZlibReset { - reset(): void; - } - - interface BrotliCompress extends stream.Transform, Zlib { } - interface BrotliDecompress extends stream.Transform, Zlib { } - interface Gzip extends stream.Transform, Zlib { } - interface Gunzip extends stream.Transform, Zlib { } - interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams { } - interface Inflate extends stream.Transform, Zlib, ZlibReset { } - interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams { } - interface InflateRaw extends stream.Transform, Zlib, ZlibReset { } - interface Unzip extends stream.Transform, Zlib { } - - function createBrotliCompress(options?: BrotliOptions): BrotliCompress; - function createBrotliDecompress(options?: BrotliOptions): BrotliDecompress; - function createGzip(options?: ZlibOptions): Gzip; - function createGunzip(options?: ZlibOptions): Gunzip; - function createDeflate(options?: ZlibOptions): Deflate; - function createInflate(options?: ZlibOptions): Inflate; - function createDeflateRaw(options?: ZlibOptions): DeflateRaw; - function createInflateRaw(options?: ZlibOptions): InflateRaw; - function createUnzip(options?: ZlibOptions): Unzip; - - type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView; - - type CompressCallback = (error: Error | null, result: Buffer) => void; - - function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; - function brotliCompress(buf: InputType, callback: CompressCallback): void; - namespace brotliCompress { - function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; - } - - function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer; - - function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; - function brotliDecompress(buf: InputType, callback: CompressCallback): void; - namespace brotliDecompress { - function __promisify__(buffer: InputType, options?: BrotliOptions): Promise; - } - - function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer; - - function deflate(buf: InputType, callback: CompressCallback): void; - function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace deflate { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function deflateSync(buf: InputType, options?: ZlibOptions): Buffer; - - function deflateRaw(buf: InputType, callback: CompressCallback): void; - function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace deflateRaw { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; - - function gzip(buf: InputType, callback: CompressCallback): void; - function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace gzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function gzipSync(buf: InputType, options?: ZlibOptions): Buffer; - - function gunzip(buf: InputType, callback: CompressCallback): void; - function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace gunzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer; - - function inflate(buf: InputType, callback: CompressCallback): void; - function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace inflate { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function inflateSync(buf: InputType, options?: ZlibOptions): Buffer; - - function inflateRaw(buf: InputType, callback: CompressCallback): void; - function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace inflateRaw { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; - - function unzip(buf: InputType, callback: CompressCallback): void; - function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - namespace unzip { - function __promisify__(buffer: InputType, options?: ZlibOptions): Promise; - } - - function unzipSync(buf: InputType, options?: ZlibOptions): Buffer; - - namespace constants { - const BROTLI_DECODE: number; - const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number; - const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number; - const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number; - const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number; - const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number; - const BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number; - const BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number; - const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number; - const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number; - const BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number; - const BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number; - const BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number; - const BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number; - const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number; - const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number; - const BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number; - const BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number; - const BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number; - const BROTLI_DECODER_ERROR_FORMAT_RESERVED: number; - const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number; - const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number; - const BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number; - const BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number; - const BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number; - const BROTLI_DECODER_ERROR_UNREACHABLE: number; - const BROTLI_DECODER_NEEDS_MORE_INPUT: number; - const BROTLI_DECODER_NEEDS_MORE_OUTPUT: number; - const BROTLI_DECODER_NO_ERROR: number; - const BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number; - const BROTLI_DECODER_PARAM_LARGE_WINDOW: number; - const BROTLI_DECODER_RESULT_ERROR: number; - const BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number; - const BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number; - const BROTLI_DECODER_RESULT_SUCCESS: number; - const BROTLI_DECODER_SUCCESS: number; - - const BROTLI_DEFAULT_MODE: number; - const BROTLI_DEFAULT_QUALITY: number; - const BROTLI_DEFAULT_WINDOW: number; - const BROTLI_ENCODE: number; - const BROTLI_LARGE_MAX_WINDOW_BITS: number; - const BROTLI_MAX_INPUT_BLOCK_BITS: number; - const BROTLI_MAX_QUALITY: number; - const BROTLI_MAX_WINDOW_BITS: number; - const BROTLI_MIN_INPUT_BLOCK_BITS: number; - const BROTLI_MIN_QUALITY: number; - const BROTLI_MIN_WINDOW_BITS: number; - - const BROTLI_MODE_FONT: number; - const BROTLI_MODE_GENERIC: number; - const BROTLI_MODE_TEXT: number; - - const BROTLI_OPERATION_EMIT_METADATA: number; - const BROTLI_OPERATION_FINISH: number; - const BROTLI_OPERATION_FLUSH: number; - const BROTLI_OPERATION_PROCESS: number; - - const BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number; - const BROTLI_PARAM_LARGE_WINDOW: number; - const BROTLI_PARAM_LGBLOCK: number; - const BROTLI_PARAM_LGWIN: number; - const BROTLI_PARAM_MODE: number; - const BROTLI_PARAM_NDIRECT: number; - const BROTLI_PARAM_NPOSTFIX: number; - const BROTLI_PARAM_QUALITY: number; - const BROTLI_PARAM_SIZE_HINT: number; - - const DEFLATE: number; - const DEFLATERAW: number; - const GUNZIP: number; - const GZIP: number; - const INFLATE: number; - const INFLATERAW: number; - const UNZIP: number; - - // Allowed flush values. - const Z_NO_FLUSH: number; - const Z_PARTIAL_FLUSH: number; - const Z_SYNC_FLUSH: number; - const Z_FULL_FLUSH: number; - const Z_FINISH: number; - const Z_BLOCK: number; - const Z_TREES: number; - - // Return codes for the compression/decompression functions. - // Negative values are errors, positive values are used for special but normal events. - const Z_OK: number; - const Z_STREAM_END: number; - const Z_NEED_DICT: number; - const Z_ERRNO: number; - const Z_STREAM_ERROR: number; - const Z_DATA_ERROR: number; - const Z_MEM_ERROR: number; - const Z_BUF_ERROR: number; - const Z_VERSION_ERROR: number; - - // Compression levels. - const Z_NO_COMPRESSION: number; - const Z_BEST_SPEED: number; - const Z_BEST_COMPRESSION: number; - const Z_DEFAULT_COMPRESSION: number; - - // Compression strategy. - const Z_FILTERED: number; - const Z_HUFFMAN_ONLY: number; - const Z_RLE: number; - const Z_FIXED: number; - const Z_DEFAULT_STRATEGY: number; - - const Z_DEFAULT_WINDOWBITS: number; - const Z_MIN_WINDOWBITS: number; - const Z_MAX_WINDOWBITS: number; - - const Z_MIN_CHUNK: number; - const Z_MAX_CHUNK: number; - const Z_DEFAULT_CHUNK: number; - - const Z_MIN_MEMLEVEL: number; - const Z_MAX_MEMLEVEL: number; - const Z_DEFAULT_MEMLEVEL: number; - - const Z_MIN_LEVEL: number; - const Z_MAX_LEVEL: number; - const Z_DEFAULT_LEVEL: number; - - const ZLIB_VERNUM: number; - } - - // Allowed flush values. - /** @deprecated Use `constants.Z_NO_FLUSH` */ - const Z_NO_FLUSH: number; - /** @deprecated Use `constants.Z_PARTIAL_FLUSH` */ - const Z_PARTIAL_FLUSH: number; - /** @deprecated Use `constants.Z_SYNC_FLUSH` */ - const Z_SYNC_FLUSH: number; - /** @deprecated Use `constants.Z_FULL_FLUSH` */ - const Z_FULL_FLUSH: number; - /** @deprecated Use `constants.Z_FINISH` */ - const Z_FINISH: number; - /** @deprecated Use `constants.Z_BLOCK` */ - const Z_BLOCK: number; - /** @deprecated Use `constants.Z_TREES` */ - const Z_TREES: number; - - // Return codes for the compression/decompression functions. - // Negative values are errors, positive values are used for special but normal events. - /** @deprecated Use `constants.Z_OK` */ - const Z_OK: number; - /** @deprecated Use `constants.Z_STREAM_END` */ - const Z_STREAM_END: number; - /** @deprecated Use `constants.Z_NEED_DICT` */ - const Z_NEED_DICT: number; - /** @deprecated Use `constants.Z_ERRNO` */ - const Z_ERRNO: number; - /** @deprecated Use `constants.Z_STREAM_ERROR` */ - const Z_STREAM_ERROR: number; - /** @deprecated Use `constants.Z_DATA_ERROR` */ - const Z_DATA_ERROR: number; - /** @deprecated Use `constants.Z_MEM_ERROR` */ - const Z_MEM_ERROR: number; - /** @deprecated Use `constants.Z_BUF_ERROR` */ - const Z_BUF_ERROR: number; - /** @deprecated Use `constants.Z_VERSION_ERROR` */ - const Z_VERSION_ERROR: number; - - // Compression levels. - /** @deprecated Use `constants.Z_NO_COMPRESSION` */ - const Z_NO_COMPRESSION: number; - /** @deprecated Use `constants.Z_BEST_SPEED` */ - const Z_BEST_SPEED: number; - /** @deprecated Use `constants.Z_BEST_COMPRESSION` */ - const Z_BEST_COMPRESSION: number; - /** @deprecated Use `constants.Z_DEFAULT_COMPRESSION` */ - const Z_DEFAULT_COMPRESSION: number; - - // Compression strategy. - /** @deprecated Use `constants.Z_FILTERED` */ - const Z_FILTERED: number; - /** @deprecated Use `constants.Z_HUFFMAN_ONLY` */ - const Z_HUFFMAN_ONLY: number; - /** @deprecated Use `constants.Z_RLE` */ - const Z_RLE: number; - /** @deprecated Use `constants.Z_FIXED` */ - const Z_FIXED: number; - /** @deprecated Use `constants.Z_DEFAULT_STRATEGY` */ - const Z_DEFAULT_STRATEGY: number; - - /** @deprecated */ - const Z_BINARY: number; - /** @deprecated */ - const Z_TEXT: number; - /** @deprecated */ - const Z_ASCII: number; - /** @deprecated */ - const Z_UNKNOWN: number; - /** @deprecated */ - const Z_DEFLATED: number; -} diff --git a/node_modules/@types/zen-observable/LICENSE b/node_modules/@types/zen-observable/LICENSE deleted file mode 100644 index 9e841e7a..00000000 --- a/node_modules/@types/zen-observable/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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 diff --git a/node_modules/@types/zen-observable/README.md b/node_modules/@types/zen-observable/README.md deleted file mode 100644 index bf56ce37..00000000 --- a/node_modules/@types/zen-observable/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/zen-observable` - -# Summary -This package contains type definitions for zen-observable (https://github.com/zenparsing/zen-observable). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/zen-observable. - -### Additional Details - * Last updated: Sat, 05 Sep 2020 13:04:31 GMT - * Dependencies: none - * Global values: none - -# Credits -These definitions were written by [Kombu](https://github.com/aicest), [JounQin](https://github.com/JounQin), [Thomas](https://github.com/itomtom), and [BenoitZugmeyer](https://github.com/BenoitZugmeyer). diff --git a/node_modules/@types/zen-observable/esm.d.ts b/node_modules/@types/zen-observable/esm.d.ts deleted file mode 100644 index 786e2e63..00000000 --- a/node_modules/@types/zen-observable/esm.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Observable = require('.'); - -/** - * @see https://github.com/zenparsing/zen-observable/blob/master/esm.js - */ -export default Observable; -export { Observable }; -export * from './extras'; - -export type SubscriptionObserver = ZenObservable.SubscriptionObserver; -export type Subscription = ZenObservable.Subscription; -export type Observer = ZenObservable.Observer; -export type Subscriber = ZenObservable.Subscriber; -export type ObservableLike = ZenObservable.ObservableLike; diff --git a/node_modules/@types/zen-observable/extras.d.ts b/node_modules/@types/zen-observable/extras.d.ts deleted file mode 100644 index ccacdda7..00000000 --- a/node_modules/@types/zen-observable/extras.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -import Observable = require('.'); - -export function merge(): Observable; -export function merge(a: ZenObservable.ObservableLike): Observable; -export function merge(a: ZenObservable.ObservableLike, b: ZenObservable.ObservableLike): Observable; -export function merge( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, -): Observable; -export function merge( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, -): Observable; -export function merge( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, - e: ZenObservable.ObservableLike, -): Observable; -export function merge( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, - e: ZenObservable.ObservableLike, - f: ZenObservable.ObservableLike, -): Observable; -export function merge(...observables: Array>): Observable; - -export function combineLatest(): Observable; -export function combineLatest(a: ZenObservable.ObservableLike): Observable<[A]>; -export function combineLatest( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, -): Observable<[A, B]>; -export function combineLatest( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, -): Observable<[A, B, C]>; -export function combineLatest( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, -): Observable<[A, B, C, D]>; -export function combineLatest( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, - e: ZenObservable.ObservableLike, -): Observable<[A, B, C, D, E]>; -export function combineLatest( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, - e: ZenObservable.ObservableLike, - f: ZenObservable.ObservableLike, -): Observable<[A, B, C, D, E, F]>; -export function combineLatest(...observables: Array>): Observable; - -export function zip(): Observable; -export function zip(a: ZenObservable.ObservableLike): Observable<[A]>; -export function zip(a: ZenObservable.ObservableLike, b: ZenObservable.ObservableLike): Observable<[A, B]>; -export function zip( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, -): Observable<[A, B, C]>; -export function zip( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, -): Observable<[A, B, C, D]>; -export function zip( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, - e: ZenObservable.ObservableLike, -): Observable<[A, B, C, D, E]>; -export function zip( - a: ZenObservable.ObservableLike, - b: ZenObservable.ObservableLike, - c: ZenObservable.ObservableLike, - d: ZenObservable.ObservableLike, - e: ZenObservable.ObservableLike, - f: ZenObservable.ObservableLike, -): Observable<[A, B, C, D, E, F]>; -export function zip(...observables: Array>): Observable; diff --git a/node_modules/@types/zen-observable/index.d.ts b/node_modules/@types/zen-observable/index.d.ts deleted file mode 100644 index c242b92f..00000000 --- a/node_modules/@types/zen-observable/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Type definitions for zen-observable 0.8 -// Project: https://github.com/zenparsing/zen-observable -// Definitions by: Kombu -// JounQin -// Thomas -// BenoitZugmeyer -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare global { - interface SymbolConstructor { - readonly observable: symbol; - } - - namespace ZenObservable { - interface SubscriptionObserver { - closed: boolean; - next(value: T): void; - error(errorValue: any): void; - complete(): void; - } - - interface Subscription { - closed: boolean; - unsubscribe(): void; - } - - interface Observer { - start?(subscription: Subscription): any; - next?(value: T): void; - error?(errorValue: any): void; - complete?(): void; - } - - type Subscriber = (observer: SubscriptionObserver) => void | (() => void) | Subscription; - - interface ObservableLike { - subscribe?: Subscriber; - [Symbol.observable](): Observable | ObservableLike; - } - } -} - -declare class Observable { - constructor(subscriber: ZenObservable.Subscriber); - - subscribe(observer: ZenObservable.Observer): ZenObservable.Subscription; - subscribe( - onNext: (value: T) => void, - onError?: (error: any) => void, - onComplete?: () => void, - ): ZenObservable.Subscription; - - [Symbol.observable](): Observable; - - forEach(callback: (value: T) => void): Promise; - map(callback: (value: T) => R): Observable; - filter(callback: (value: T) => boolean): Observable; - reduce(callback: (previousValue: T, currentValue: T) => T, initialValue?: T): Observable; - reduce(callback: (previousValue: R, currentValue: T) => R, initialValue?: R): Observable; - flatMap(callback: (value: T) => ZenObservable.ObservableLike): Observable; - concat(...observable: Array>): Observable; - - static from(observable: Observable | ZenObservable.ObservableLike | ArrayLike): Observable; - static of(...items: R[]): Observable; -} - -declare namespace Observable {} - -export = Observable; diff --git a/node_modules/@types/zen-observable/package.json b/node_modules/@types/zen-observable/package.json deleted file mode 100644 index 9c68fcb3..00000000 --- a/node_modules/@types/zen-observable/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "@types/zen-observable@^0.8.0", - "_id": "@types/zen-observable@0.8.1", - "_inBundle": false, - "_integrity": "sha512-wmk0xQI6Yy7Fs/il4EpOcflG4uonUpYGqvZARESLc2oy4u69fkatFLbJOeW4Q6awO15P4rduAe6xkwHevpXcUQ==", - "_location": "/@types/zen-observable", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/zen-observable@^0.8.0", - "name": "@types/zen-observable", - "escapedName": "@types%2fzen-observable", - "scope": "@types", - "rawSpec": "^0.8.0", - "saveSpec": null, - "fetchSpec": "^0.8.0" - }, - "_requiredBy": [ - "/apollo-client" - ], - "_resolved": "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.1.tgz", - "_shasum": "5668c0bce55a91f2b9566b1d8a4c0a8dbbc79764", - "_spec": "@types/zen-observable@^0.8.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-client", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Kombu", - "url": "https://github.com/aicest" - }, - { - "name": "JounQin", - "url": "https://github.com/JounQin" - }, - { - "name": "Thomas", - "url": "https://github.com/itomtom" - }, - { - "name": "BenoitZugmeyer", - "url": "https://github.com/BenoitZugmeyer" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for zen-observable", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/zen-observable", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/zen-observable" - }, - "scripts": {}, - "typeScriptVersion": "3.1", - "types": "index.d.ts", - "typesPublisherContentHash": "1b87a74bdc7fa99869e1d37c6d4d89e9ad2251eec1c1880dc5bf9037a404fbbf", - "version": "0.8.1" -} diff --git a/node_modules/@tyriar/fibonacci-heap/LICENSE b/node_modules/@tyriar/fibonacci-heap/LICENSE deleted file mode 100644 index d5379b6f..00000000 --- a/node_modules/@tyriar/fibonacci-heap/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Daniel Imms, http://www.growingwiththeweb.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@tyriar/fibonacci-heap/README.md b/node_modules/@tyriar/fibonacci-heap/README.md deleted file mode 100644 index de6e8128..00000000 --- a/node_modules/@tyriar/fibonacci-heap/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# ts-fibonacci-heap - -[![Build Status](https://api.travis-ci.org/gwtw/ts-fibonacci-heap.svg?branch=master)](http://travis-ci.org/gwtw/ts-fibonacci-heap) -[![Coverage Status](https://coveralls.io/repos/github/gwtw/ts-fibonacci-heap/badge.svg?branch=master)](https://coveralls.io/github/gwtw/ts-fibonacci-heap?branch=master) - -A TypeScript implementation of the [Fibonacci heap](http://www.growingwiththeweb.com/data-structures/fibonacci-heap/overview/) data structure. - -Note that the primary purpose of this library is education but it should work in a production environment as well. It's certainly not as performant as it could be as it optimises for readability, abstraction and safety over raw performance. - -![](http://www.growingwiththeweb.com/images/data-structures/fibonacci-heap/fibonacci-heap.svg) - -## Features - -- 100% test coverage -- Supports all common heap operations -- Store keys with optional associated values -- Optional custom compare function that can utilize both key and value to give full control over the order of the data - -## Install - -```bash -npm install --save @tyriar/fibonacci-heap -``` - -## Usage - -See the [typings file](./typings/fibonacci-heap.d.ts) for the full API. - -```typescript -// Import npm module -import { FibonacciHeap } from '@tyriar/fibonacci-heap'; - -// Construct FibonacciHeap -const heap = new FibonacciHeap(); -// Insert keys only -heap.insert(3); -heap.insert(7); -// Insert keys and values -heap.insert(8, {foo: 'bar'}); -heap.insert(1, {foo: 'baz'}); - -// Extract all nodes in order -while (!heap.isEmpty()) { - const node = heap.extractMinimum(); - console.log('key: ' + node.key + ', value: ' + node.value); -} -// > key: 1, value: [object Object] -// > key: 3, value: undefined -// > key: 7, value: undefined -// > key: 8, value: [object Object] - -// Construct custom compare FibonacciHeap -const heap2 = new FibonacciHeap(function (a, b) { - return (a.key + a.value).localeCompare(b.key + b.value); -}); -heap2.insert('2', 'B'); -heap2.insert('1', 'a'); -heap2.insert('1', 'A'); -heap2.insert('2', 'b'); - -// Extract all nodes in order -while (!heap2.isEmpty()) { - const node = heap2.extractMinimum(); - console.log('key: ' + node.key + ', value: ' + node.value); -} -// > key: 1, value: a -// > key: 1, value: A -// > key: 2, value: b -// > key: 2, value: B -``` - -## Operation time complexity - -| Operation | Complexity | -| -------------- | ---------- | -| clear | Θ(1)\* | -| decreaseKey | Θ(1)\* | -| delete | O(log n)\* | -| extractMinimum | O(log n)\* | -| findMinimum | Θ(1) | -| insert | Θ(1) | -| isEmpty | Θ(1) | -| size | Θ(n) | -| union | Θ(1) | - -\* amortized diff --git a/node_modules/@tyriar/fibonacci-heap/lib/fibonacciHeap.js b/node_modules/@tyriar/fibonacci-heap/lib/fibonacciHeap.js deleted file mode 100644 index e6372446..00000000 --- a/node_modules/@tyriar/fibonacci-heap/lib/fibonacciHeap.js +++ /dev/null @@ -1,297 +0,0 @@ -"use strict"; -/** - * @license - * Copyright Daniel Imms - * Released under MIT license. See LICENSE in the project root for details. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = require("./node"); -var nodeListIterator_1 = require("./nodeListIterator"); -var FibonacciHeap = /** @class */ (function () { - function FibonacciHeap(compare) { - this._minNode = null; - this._nodeCount = 0; - this._compare = compare ? compare : this._defaultCompare; - } - /** - * Clears the heap's data, making it an empty heap. - */ - FibonacciHeap.prototype.clear = function () { - this._minNode = null; - this._nodeCount = 0; - }; - /** - * Decreases a key of a node. - * @param node The node to decrease the key of. - * @param newKey The new key to assign to the node. - */ - FibonacciHeap.prototype.decreaseKey = function (node, newKey) { - if (!node) { - throw new Error('Cannot decrease key of non-existent node'); - } - if (this._compare({ key: newKey }, { key: node.key }) > 0) { - throw new Error('New key is larger than old key'); - } - node.key = newKey; - var parent = node.parent; - if (parent && this._compare(node, parent) < 0) { - this._cut(node, parent, this._minNode); - this._cascadingCut(parent, this._minNode); - } - if (this._compare(node, this._minNode) < 0) { - this._minNode = node; - } - }; - /** - * Deletes a node. - * @param node The node to delete. - */ - FibonacciHeap.prototype.delete = function (node) { - // This is a special implementation of decreaseKey that sets the argument to - // the minimum value. This is necessary to make generic keys work, since there - // is no MIN_VALUE constant for generic types. - var parent = node.parent; - if (parent) { - this._cut(node, parent, this._minNode); - this._cascadingCut(parent, this._minNode); - } - this._minNode = node; - this.extractMinimum(); - }; - /** - * Extracts and returns the minimum node from the heap. - * @return The heap's minimum node or null if the heap is empty. - */ - FibonacciHeap.prototype.extractMinimum = function () { - var extractedMin = this._minNode; - if (extractedMin) { - // Set parent to null for the minimum's children - if (extractedMin.child) { - var child = extractedMin.child; - do { - child.parent = null; - child = child.next; - } while (child !== extractedMin.child); - } - var nextInRootList = null; - if (extractedMin.next !== extractedMin) { - nextInRootList = extractedMin.next; - } - // Remove min from root list - this._removeNodeFromList(extractedMin); - this._nodeCount--; - // Merge the children of the minimum node with the root list - this._minNode = this._mergeLists(nextInRootList, extractedMin.child); - if (this._minNode) { - this._minNode = this._consolidate(this._minNode); - } - } - return extractedMin; - }; - /** - * Returns the minimum node from the heap. - * @return The heap's minimum node or null if the heap is empty. - */ - FibonacciHeap.prototype.findMinimum = function () { - return this._minNode; - }; - /** - * Inserts a new key-value pair into the heap. - * @param key The key to insert. - * @param value The value to insert. - * @return node The inserted node. - */ - FibonacciHeap.prototype.insert = function (key, value) { - var node = new node_1.Node(key, value); - this._minNode = this._mergeLists(this._minNode, node); - this._nodeCount++; - return node; - }; - /** - * @return Whether the heap is empty. - */ - FibonacciHeap.prototype.isEmpty = function () { - return this._minNode === null; - }; - /** - * @return The size of the heap. - */ - FibonacciHeap.prototype.size = function () { - if (this._minNode === null) { - return 0; - } - return this._getNodeListSize(this._minNode); - }; - /** - * Joins another heap to this heap. - * @param other The other heap. - */ - FibonacciHeap.prototype.union = function (other) { - this._minNode = this._mergeLists(this._minNode, other._minNode); - this._nodeCount += other._nodeCount; - }; - /** - * Compares two nodes with each other. - * @param a The first key to compare. - * @param b The second key to compare. - * @return -1, 0 or 1 if a < b, a == b or a > b respectively. - */ - FibonacciHeap.prototype._defaultCompare = function (a, b) { - if (a.key > b.key) { - return 1; - } - if (a.key < b.key) { - return -1; - } - return 0; - }; - /** - * Cut the link between a node and its parent, moving the node to the root list. - * @param node The node being cut. - * @param parent The parent of the node being cut. - * @param minNode The minimum node in the root list. - * @return The heap's new minimum node. - */ - FibonacciHeap.prototype._cut = function (node, parent, minNode) { - node.parent = null; - parent.degree--; - if (node.next === node) { - parent.child = null; - } - else { - parent.child = node.next; - } - this._removeNodeFromList(node); - var newMinNode = this._mergeLists(minNode, node); - node.isMarked = false; - return newMinNode; - }; - /** - * Perform a cascading cut on a node; mark the node if it is not marked, - * otherwise cut the node and perform a cascading cut on its parent. - * @param node The node being considered to be cut. - * @param minNode The minimum node in the root list. - * @return The heap's new minimum node. - */ - FibonacciHeap.prototype._cascadingCut = function (node, minNode) { - var parent = node.parent; - if (parent) { - if (node.isMarked) { - minNode = this._cut(node, parent, minNode); - minNode = this._cascadingCut(parent, minNode); - } - else { - node.isMarked = true; - } - } - return minNode; - }; - /** - * Merge all trees of the same order together until there are no two trees of - * the same order. - * @param minNode The current minimum node. - * @return The new minimum node. - */ - FibonacciHeap.prototype._consolidate = function (minNode) { - var aux = []; - var it = new nodeListIterator_1.NodeListIterator(minNode); - while (it.hasNext()) { - var current = it.next(); - // If there exists another node with the same degree, merge them - var auxCurrent = aux[current.degree]; - while (auxCurrent) { - if (this._compare(current, auxCurrent) > 0) { - var temp = current; - current = auxCurrent; - auxCurrent = temp; - } - this._linkHeaps(auxCurrent, current); - aux[current.degree] = null; - current.degree++; - auxCurrent = aux[current.degree]; - } - aux[current.degree] = current; - } - var newMinNode = null; - for (var i = 0; i < aux.length; i++) { - var node = aux[i]; - if (node) { - // Remove siblings before merging - node.next = node; - node.prev = node; - newMinNode = this._mergeLists(newMinNode, node); - } - } - return newMinNode; - }; - /** - * Removes a node from a node list. - * @param node The node to remove. - */ - FibonacciHeap.prototype._removeNodeFromList = function (node) { - var prev = node.prev; - var next = node.next; - prev.next = next; - next.prev = prev; - node.next = node; - node.prev = node; - }; - /** - * Links two heaps of the same order together. - * - * @private - * @param max The heap with the larger root. - * @param min The heap with the smaller root. - */ - FibonacciHeap.prototype._linkHeaps = function (max, min) { - this._removeNodeFromList(max); - min.child = this._mergeLists(max, min.child); - max.parent = min; - max.isMarked = false; - }; - /** - * Merge two lists of nodes together. - * - * @private - * @param a The first list to merge. - * @param b The second list to merge. - * @return The new minimum node from the two lists. - */ - FibonacciHeap.prototype._mergeLists = function (a, b) { - if (!a) { - if (!b) { - return null; - } - return b; - } - if (!b) { - return a; - } - var temp = a.next; - a.next = b.next; - a.next.prev = a; - b.next = temp; - b.next.prev = b; - return this._compare(a, b) < 0 ? a : b; - }; - /** - * Gets the size of a node list. - * @param node A node within the node list. - * @return The size of the node list. - */ - FibonacciHeap.prototype._getNodeListSize = function (node) { - var count = 0; - var current = node; - do { - count++; - if (current.child) { - count += this._getNodeListSize(current.child); - } - current = current.next; - } while (current !== node); - return count; - }; - return FibonacciHeap; -}()); -exports.FibonacciHeap = FibonacciHeap; -//# sourceMappingURL=fibonacciHeap.js.map \ No newline at end of file diff --git a/node_modules/@tyriar/fibonacci-heap/lib/fibonacciHeap.js.map b/node_modules/@tyriar/fibonacci-heap/lib/fibonacciHeap.js.map deleted file mode 100644 index 13faf5f4..00000000 --- a/node_modules/@tyriar/fibonacci-heap/lib/fibonacciHeap.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fibonacciHeap.js","sourceRoot":"","sources":["../src/fibonacciHeap.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAEH,+BAA8B;AAC9B,uDAAsD;AAGtD;IAKE,uBACE,OAA+B;QALzB,aAAQ,GAAsB,IAAI,CAAC;QACnC,eAAU,GAAW,CAAC,CAAC;QAM7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC;IAC3D,CAAC;IAED;;OAEG;IACI,6BAAK,GAAZ;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,mCAAW,GAAlB,UAAmB,IAAgB,EAAE,MAAS;QAC5C,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC7D;QACD,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,EAAE,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAC,CAAC,GAAG,CAAC,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;QAClB,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;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QACd,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAEhB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACK,wCAAgB,GAAxB,UAAyB,IAAgB;QACvC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,GAAG;YACD,KAAK,EAAE,CAAC;YACR,IAAI,OAAO,CAAC,KAAK,EAAE;gBACjB,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;aAC/C;YACD,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;SACxB,QAAQ,OAAO,KAAK,IAAI,EAAE;QAE3B,OAAO,KAAK,CAAC;IACf,CAAC;IACH,oBAAC;AAAD,CAAC,AA3TD,IA2TC;AA3TY,sCAAa"} \ No newline at end of file diff --git a/node_modules/@tyriar/fibonacci-heap/lib/node.js b/node_modules/@tyriar/fibonacci-heap/lib/node.js deleted file mode 100644 index 89dea4e5..00000000 --- a/node_modules/@tyriar/fibonacci-heap/lib/node.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/** - * @license - * Copyright Daniel Imms - * Released under MIT license. See LICENSE in the project root for details. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var Node = /** @class */ (function () { - function Node(key, value) { - this.parent = null; - this.child = null; - this.degree = 0; - this.isMarked = false; - this.key = key; - this.value = value; - this.prev = this; - this.next = this; - } - return Node; -}()); -exports.Node = Node; -//# sourceMappingURL=node.js.map \ No newline at end of file diff --git a/node_modules/@tyriar/fibonacci-heap/lib/node.js.map b/node_modules/@tyriar/fibonacci-heap/lib/node.js.map deleted file mode 100644 index b6afc3f5..00000000 --- a/node_modules/@tyriar/fibonacci-heap/lib/node.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAIH;IAWE,cAAY,GAAM,EAAE,KAAS;QANtB,WAAM,GAAsB,IAAI,CAAC;QACjC,UAAK,GAAsB,IAAI,CAAC;QAEhC,WAAM,GAAW,CAAC,CAAC;QACnB,aAAQ,GAAY,KAAK,CAAC;QAG/B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACH,WAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,oBAAI"} \ No newline at end of file diff --git a/node_modules/@tyriar/fibonacci-heap/lib/nodeListIterator.js b/node_modules/@tyriar/fibonacci-heap/lib/nodeListIterator.js deleted file mode 100644 index 09fe184d..00000000 --- a/node_modules/@tyriar/fibonacci-heap/lib/nodeListIterator.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -/** - * @license - * Copyright Daniel Imms - * Released under MIT license. See LICENSE in the project root for details. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var NodeListIterator = /** @class */ (function () { - /** - * Creates an Iterator used to simplify the consolidate() method. It works by - * making a shallow copy of the nodes in the root list and iterating over the - * shallow copy instead of the source as the source will be modified. - * @param start A node from the root list. - */ - function NodeListIterator(start) { - this._index = -1; - this._items = []; - var current = start; - do { - this._items.push(current); - current = current.next; - } while (start !== current); - } - /** - * @return Whether there is a next node in the iterator. - */ - NodeListIterator.prototype.hasNext = function () { - return this._index < this._items.length - 1; - }; - /** - * @return The next node. - */ - NodeListIterator.prototype.next = function () { - return this._items[++this._index]; - }; - return NodeListIterator; -}()); -exports.NodeListIterator = NodeListIterator; -//# sourceMappingURL=nodeListIterator.js.map \ No newline at end of file diff --git a/node_modules/@tyriar/fibonacci-heap/lib/nodeListIterator.js.map b/node_modules/@tyriar/fibonacci-heap/lib/nodeListIterator.js.map deleted file mode 100644 index 53eb6fed..00000000 --- a/node_modules/@tyriar/fibonacci-heap/lib/nodeListIterator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nodeListIterator.js","sourceRoot":"","sources":["../src/nodeListIterator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAIH;IAIE;;;;;OAKG;IACH,0BAAY,KAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,GAAG;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1B,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;SACxB,QAAQ,KAAK,KAAK,OAAO,EAAE;IAC9B,CAAC;IAED;;OAEG;IACI,kCAAO,GAAd;QACE,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,+BAAI,GAAX;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IACH,uBAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCY,4CAAgB"} \ No newline at end of file diff --git a/node_modules/@tyriar/fibonacci-heap/package.json b/node_modules/@tyriar/fibonacci-heap/package.json deleted file mode 100644 index 27c4e195..00000000 --- a/node_modules/@tyriar/fibonacci-heap/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "_from": "@tyriar/fibonacci-heap@^2.0.7", - "_id": "@tyriar/fibonacci-heap@2.0.9", - "_inBundle": false, - "_integrity": "sha512-bYuSNomfn4hu2tPiDN+JZtnzCpSpbJ/PNeulmocDy3xN2X5OkJL65zo6rPZp65cPPhLF9vfT/dgE+RtFRCSxOA==", - "_location": "/@tyriar/fibonacci-heap", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@tyriar/fibonacci-heap@^2.0.7", - "name": "@tyriar/fibonacci-heap", - "escapedName": "@tyriar%2ffibonacci-heap", - "scope": "@tyriar", - "rawSpec": "^2.0.7", - "saveSpec": null, - "fetchSpec": "^2.0.7" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/@tyriar/fibonacci-heap/-/fibonacci-heap-2.0.9.tgz", - "_shasum": "df3dcbdb1b9182168601f6318366157ee16666e9", - "_spec": "@tyriar/fibonacci-heap@^2.0.7", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "Daniel Imms", - "url": "http://www.growingwiththeweb.com" - }, - "bugs": { - "url": "https://github.com/gwtw/ts-fibonacci-heap/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "An implementation of the Fibonacci heap data structure", - "devDependencies": { - "@types/chai": "^4.1.4", - "@types/mocha": "^5.2.5", - "chai": "^4.1.2", - "coveralls": "^3.0.0", - "mocha": "^5.2.0", - "nyc": "^11.4.1", - "tslint": "^5.9.1", - "tslint-consistent-codestyle": "^1.13.0", - "typescript": "^3.0.3" - }, - "files": [ - "lib/**/*.js", - "lib/**/*.js.map", - "!lib/test", - "src/**/*.ts", - "!src/test", - "typings/*.d.ts" - ], - "homepage": "https://github.com/gwtw/ts-fibonacci-heap", - "keywords": [ - "A*", - "computer science", - "data structure", - "dijkstra", - "heap", - "priority queue", - "tree" - ], - "license": "MIT", - "main": "./lib/fibonacciHeap.js", - "name": "@tyriar/fibonacci-heap", - "repository": { - "type": "git", - "url": "git+https://github.com/gwtw/ts-fibonacci-heap.git" - }, - "scripts": { - "build": "tsc", - "lint": "tslint --project .", - "prepublish": "npm run build", - "test": "nyc -x lib/test mocha lib/test/*.test.js", - "test-report": "nyc --reporter html mocha lib/test/*.test.js", - "watch": "tsc -w" - }, - "types": "typings/fibonacci-heap.d.ts", - "version": "2.0.9" -} diff --git a/node_modules/@tyriar/fibonacci-heap/src/fibonacciHeap.ts b/node_modules/@tyriar/fibonacci-heap/src/fibonacciHeap.ts deleted file mode 100644 index 07232535..00000000 --- a/node_modules/@tyriar/fibonacci-heap/src/fibonacciHeap.ts +++ /dev/null @@ -1,326 +0,0 @@ -/** - * @license - * Copyright Daniel Imms - * Released under MIT license. See LICENSE in the project root for details. - */ - -import { Node } from './node'; -import { NodeListIterator } from './nodeListIterator'; -import { FibonacciHeap as FibonacciHeapApi, CompareFunction, INode } from '@tyriar/fibonacci-heap'; - -export class FibonacciHeap implements FibonacciHeapApi { - private _minNode: Node | null = null; - private _nodeCount: number = 0; - private _compare: CompareFunction; - - constructor( - compare?: CompareFunction - ) { - this._compare = compare ? compare : this._defaultCompare; - } - - /** - * Clears the heap's data, making it an empty heap. - */ - public clear(): void { - this._minNode = null; - this._nodeCount = 0; - } - - /** - * Decreases a key of a node. - * @param node The node to decrease the key of. - * @param newKey The new key to assign to the node. - */ - public decreaseKey(node: Node, newKey: K): void { - if (!node) { - throw new Error('Cannot decrease key of non-existent node'); - } - if (this._compare({key: newKey}, {key: node.key}) > 0) { - throw new Error('New key is larger than old key'); - } - - node.key = newKey; - const parent = node.parent; - if (parent && this._compare(node, parent) < 0) { - this._cut(node, parent, >this._minNode); - this._cascadingCut(parent, >this._minNode); - } - if (this._compare(node, >this._minNode) < 0) { - this._minNode = node; - } - } - - /** - * Deletes a node. - * @param node The node to delete. - */ - public delete(node: Node): void { - // This is a special implementation of decreaseKey that sets the argument to - // the minimum value. This is necessary to make generic keys work, since there - // is no MIN_VALUE constant for generic types. - const parent = node.parent; - if (parent) { - this._cut(node, parent, >this._minNode); - this._cascadingCut(parent, >this._minNode); - } - this._minNode = node; - - this.extractMinimum(); - } - - /** - * Extracts and returns the minimum node from the heap. - * @return The heap's minimum node or null if the heap is empty. - */ - public extractMinimum(): Node | null { - const extractedMin = this._minNode; - if (extractedMin) { - // Set parent to null for the minimum's children - if (extractedMin.child) { - let child = extractedMin.child; - do { - child.parent = null; - child = child.next; - } while (child !== extractedMin.child); - } - - let nextInRootList = null; - if (extractedMin.next !== extractedMin) { - nextInRootList = extractedMin.next; - } - // Remove min from root list - this._removeNodeFromList(extractedMin); - this._nodeCount--; - - // Merge the children of the minimum node with the root list - this._minNode = this._mergeLists(nextInRootList, extractedMin.child); - if (this._minNode) { - this._minNode = this._consolidate(this._minNode); - } - } - return extractedMin; - } - - /** - * Returns the minimum node from the heap. - * @return The heap's minimum node or null if the heap is empty. - */ - public findMinimum(): Node | null { - return this._minNode; - } - - /** - * Inserts a new key-value pair into the heap. - * @param key The key to insert. - * @param value The value to insert. - * @return node The inserted node. - */ - public insert(key: K, value?: V): Node { - const node = new Node(key, value); - this._minNode = this._mergeLists(this._minNode, node); - this._nodeCount++; - return node; - } - - /** - * @return Whether the heap is empty. - */ - public isEmpty(): boolean { - return this._minNode === null; - } - - /** - * @return The size of the heap. - */ - public size(): number { - if (this._minNode === null) { - return 0; - } - return this._getNodeListSize(this._minNode); - } - - /** - * Joins another heap to this heap. - * @param other The other heap. - */ - public union(other: FibonacciHeap): void { - this._minNode = this._mergeLists(this._minNode, other._minNode); - this._nodeCount += other._nodeCount; - } - - /** - * Compares two nodes with each other. - * @param a The first key to compare. - * @param b The second key to compare. - * @return -1, 0 or 1 if a < b, a == b or a > b respectively. - */ - private _defaultCompare(a: INode, b: INode): number { - if (a.key > b.key) { - return 1; - } - if (a.key < b.key) { - return -1; - } - return 0; - } - - /** - * Cut the link between a node and its parent, moving the node to the root list. - * @param node The node being cut. - * @param parent The parent of the node being cut. - * @param minNode The minimum node in the root list. - * @return The heap's new minimum node. - */ - private _cut(node: Node, parent: Node, minNode: Node): Node | null { - node.parent = null; - parent.degree--; - if (node.next === node) { - parent.child = null; - } else { - parent.child = node.next; - } - this._removeNodeFromList(node); - const newMinNode = this._mergeLists(minNode, node); - node.isMarked = false; - return newMinNode; - } - - /** - * Perform a cascading cut on a node; mark the node if it is not marked, - * otherwise cut the node and perform a cascading cut on its parent. - * @param node The node being considered to be cut. - * @param minNode The minimum node in the root list. - * @return The heap's new minimum node. - */ - private _cascadingCut(node: Node, minNode: Node | null): Node | null { - const parent = node.parent; - if (parent) { - if (node.isMarked) { - minNode = this._cut(node, parent, >minNode); - minNode = this._cascadingCut(parent, minNode); - } else { - node.isMarked = true; - } - } - return minNode; - } - - /** - * Merge all trees of the same order together until there are no two trees of - * the same order. - * @param minNode The current minimum node. - * @return The new minimum node. - */ - private _consolidate(minNode: Node): Node | null { - - const aux = []; - const it = new NodeListIterator(minNode); - while (it.hasNext()) { - let current = it.next(); - - // If there exists another node with the same degree, merge them - let auxCurrent = aux[current.degree]; - while (auxCurrent) { - if (this._compare(current, auxCurrent) > 0) { - const temp = current; - current = auxCurrent; - auxCurrent = temp; - } - this._linkHeaps(auxCurrent, current); - aux[current.degree] = null; - current.degree++; - auxCurrent = aux[current.degree]; - } - - aux[current.degree] = current; - } - - let newMinNode = null; - for (let i = 0; i < aux.length; i++) { - const node = aux[i]; - if (node) { - // Remove siblings before merging - node.next = node; - node.prev = node; - newMinNode = this._mergeLists(newMinNode, node); - } - } - return newMinNode; - } - - /** - * Removes a node from a node list. - * @param node The node to remove. - */ - private _removeNodeFromList(node: Node): void { - const prev = node.prev; - const next = node.next; - prev.next = next; - next.prev = prev; - node.next = node; - node.prev = node; - } - - /** - * Links two heaps of the same order together. - * - * @private - * @param max The heap with the larger root. - * @param min The heap with the smaller root. - */ - private _linkHeaps(max: Node, min: Node): void { - this._removeNodeFromList(max); - min.child = this._mergeLists(max, min.child); - max.parent = min; - max.isMarked = false; - } - - /** - * Merge two lists of nodes together. - * - * @private - * @param a The first list to merge. - * @param b The second list to merge. - * @return The new minimum node from the two lists. - */ - private _mergeLists(a: Node | null, b: Node | null): Node | null { - if (!a) { - if (!b) { - return null; - } - return b; - } - if (!b) { - return a; - } - - const temp = a.next; - a.next = b.next; - a.next.prev = a; - b.next = temp; - b.next.prev = b; - - return this._compare(a, b) < 0 ? a : b; - } - - /** - * Gets the size of a node list. - * @param node A node within the node list. - * @return The size of the node list. - */ - private _getNodeListSize(node: Node): number { - let count = 0; - let current = node; - - do { - count++; - if (current.child) { - count += this._getNodeListSize(current.child); - } - current = current.next; - } while (current !== node); - - return count; - } -} diff --git a/node_modules/@tyriar/fibonacci-heap/src/node.ts b/node_modules/@tyriar/fibonacci-heap/src/node.ts deleted file mode 100644 index 82e5a3ad..00000000 --- a/node_modules/@tyriar/fibonacci-heap/src/node.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * Copyright Daniel Imms - * Released under MIT license. See LICENSE in the project root for details. - */ - -import { INode } from '@tyriar/fibonacci-heap'; - -export class Node implements INode { - public key: K; - public value: V | undefined; - public prev: Node; - public next: Node; - public parent: Node | null = null; - public child: Node | null = null; - - public degree: number = 0; - public isMarked: boolean = false; - - constructor(key: K, value?: V) { - this.key = key; - this.value = value; - this.prev = this; - this.next = this; - } -} diff --git a/node_modules/@tyriar/fibonacci-heap/src/nodeListIterator.ts b/node_modules/@tyriar/fibonacci-heap/src/nodeListIterator.ts deleted file mode 100644 index 4214cd2f..00000000 --- a/node_modules/@tyriar/fibonacci-heap/src/nodeListIterator.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright Daniel Imms - * Released under MIT license. See LICENSE in the project root for details. - */ - -import { Node } from './node'; - -export class NodeListIterator { - private _index: number; - private _items: Node[]; - - /** - * Creates an Iterator used to simplify the consolidate() method. It works by - * making a shallow copy of the nodes in the root list and iterating over the - * shallow copy instead of the source as the source will be modified. - * @param start A node from the root list. - */ - constructor(start: Node) { - this._index = -1; - this._items = []; - let current = start; - do { - this._items.push(current); - current = current.next; - } while (start !== current); - } - - /** - * @return Whether there is a next node in the iterator. - */ - public hasNext(): boolean { - return this._index < this._items.length - 1; - } - - /** - * @return The next node. - */ - public next(): Node { - return this._items[++this._index]; - } -} diff --git a/node_modules/@tyriar/fibonacci-heap/typings/fibonacci-heap.d.ts b/node_modules/@tyriar/fibonacci-heap/typings/fibonacci-heap.d.ts deleted file mode 100644 index 43d03789..00000000 --- a/node_modules/@tyriar/fibonacci-heap/typings/fibonacci-heap.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @license - * Copyright Daniel Imms - * Released under MIT license. See LICENSE in the project root for details. - */ - -declare module '@tyriar/fibonacci-heap' { - export type CompareFunction = (a: INode, b: INode) => number; - - export interface INode { - key: K; - value?: V; - } - - /** - * A Fibonacci heap data structure with a key and optional value. - */ - export class FibonacciHeap { - /** - * Creates a new Fibonacci heap. - * @param compare A custom compare function. - */ - constructor(compare?: CompareFunction); - - /** - * Clears the heap's data, making it an empty heap. - */ - clear(): void; - - /** - * Decreases a key of a node. - * @param node The node to decrease the key of. - * @param newKey The new key to assign to the node. - */ - decreaseKey(node: INode, newKey: K): void - - /** - * Deletes a node. - * @param node The node to delete. - */ - delete(node: INode): void; - - /** - * Extracts and returns the minimum node from the heap. - * @return The heap's minimum node or null if the heap is empty. - */ - extractMinimum(): INode | null; - - /** - * Returns the minimum node from the heap. - * @return The heap's minimum node or null if the heap is empty. - */ - findMinimum(): INode | null; - - /** - * Inserts a new key-value pair into the heap. - * @param key The key to insert. - * @param value The value to insert. - * @return node The inserted node. - */ - insert(key: K, value?: V): INode; - - /** - * @return Whether the heap is empty. - */ - isEmpty(): boolean; - - /** - * @return The size of the heap. - */ - size(): number; - - /** - * Joins another heap to this heap. - * @param other The other heap. - */ - union(other: FibonacciHeap): void; - } -} diff --git a/node_modules/@wry/context/LICENSE b/node_modules/@wry/context/LICENSE deleted file mode 100644 index 306c285a..00000000 --- a/node_modules/@wry/context/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Ben Newman - -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. diff --git a/node_modules/@wry/context/README.md b/node_modules/@wry/context/README.md deleted file mode 100644 index e294499f..00000000 --- a/node_modules/@wry/context/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# @wry/context - -Manage contextual information needed by synchronous or asynchronous -tasks without explicitly passing objects around. diff --git a/node_modules/@wry/context/lib/context.d.ts b/node_modules/@wry/context/lib/context.d.ts deleted file mode 100644 index 58076ea2..00000000 --- a/node_modules/@wry/context/lib/context.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// -import { Slot } from "./slot"; -export { Slot }; -export declare const bind: (callback: (...args: TArgs) => TResult) => (...args: TArgs) => TResult, noContext: (callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined) => TResult; -export { setTimeoutWithContext as setTimeout }; -declare function setTimeoutWithContext(callback: () => any, delay: number): NodeJS.Timer; -export declare function asyncFromGen(genFn: (...args: TArgs) => IterableIterator): (...args: TArgs) => Promise; -export declare function wrapYieldingFiberMethods(Fiber: F): F; diff --git a/node_modules/@wry/context/lib/context.esm.js b/node_modules/@wry/context/lib/context.esm.js deleted file mode 100644 index c383b023..00000000 --- a/node_modules/@wry/context/lib/context.esm.js +++ /dev/null @@ -1,199 +0,0 @@ -// This currentContext variable will only be used if the makeSlotClass -// function is called, which happens only if this is the first copy of the -// @wry/context package to be imported. -var currentContext = null; -// This unique internal object is used to denote the absence of a value -// for a given Slot, and is never exposed to outside code. -var MISSING_VALUE = {}; -var idCounter = 1; -// Although we can't do anything about the cost of duplicated code from -// accidentally bundling multiple copies of the @wry/context package, we can -// avoid creating the Slot class more than once using makeSlotClass. -var makeSlotClass = function () { return /** @class */ (function () { - function Slot() { - // If you have a Slot object, you can find out its slot.id, but you cannot - // guess the slot.id of a Slot you don't have access to, thanks to the - // randomized suffix. - this.id = [ - "slot", - idCounter++, - Date.now(), - Math.random().toString(36).slice(2), - ].join(":"); - } - Slot.prototype.hasValue = function () { - for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { - // We use the Slot object iself as a key to its value, which means the - // value cannot be obtained without a reference to the Slot object. - if (this.id in context_1.slots) { - var value = context_1.slots[this.id]; - if (value === MISSING_VALUE) - break; - if (context_1 !== currentContext) { - // Cache the value in currentContext.slots so the next lookup will - // be faster. This caching is safe because the tree of contexts and - // the values of the slots are logically immutable. - currentContext.slots[this.id] = value; - } - return true; - } - } - if (currentContext) { - // If a value was not found for this Slot, it's never going to be found - // no matter how many times we look it up, so we might as well cache - // the absence of the value, too. - currentContext.slots[this.id] = MISSING_VALUE; - } - return false; - }; - Slot.prototype.getValue = function () { - if (this.hasValue()) { - return currentContext.slots[this.id]; - } - }; - Slot.prototype.withValue = function (value, callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - var _a; - var slots = (_a = { - __proto__: null - }, - _a[this.id] = value, - _a); - var parent = currentContext; - currentContext = { parent: parent, slots: slots }; - try { - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = parent; - } - }; - // Capture the current context and wrap a callback function so that it - // reestablishes the captured context when called. - Slot.bind = function (callback) { - var context = currentContext; - return function () { - var saved = currentContext; - try { - currentContext = context; - return callback.apply(this, arguments); - } - finally { - currentContext = saved; - } - }; - }; - // Immediately run a callback function without any captured context. - Slot.noContext = function (callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - if (currentContext) { - var saved = currentContext; - try { - currentContext = null; - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = saved; - } - } - else { - return callback.apply(thisArg, args); - } - }; - return Slot; -}()); }; -// We store a single global implementation of the Slot class as a permanent -// non-enumerable symbol property of the Array constructor. This obfuscation -// does nothing to prevent access to the Slot class, but at least it ensures -// the implementation (i.e. currentContext) cannot be tampered with, and all -// copies of the @wry/context package (hopefully just one) will share the -// same Slot implementation. Since the first copy of the @wry/context package -// to be imported wins, this technique imposes a very high cost for any -// future breaking changes to the Slot class. -var globalKey = "@wry/context:Slot"; -var host = Array; -var Slot = host[globalKey] || function () { - var Slot = makeSlotClass(); - try { - Object.defineProperty(host, globalKey, { - value: host[globalKey] = Slot, - enumerable: false, - writable: false, - configurable: false, - }); - } - finally { - return Slot; - } -}(); - -var bind = Slot.bind, noContext = Slot.noContext; -function setTimeoutWithContext(callback, delay) { - return setTimeout(bind(callback), delay); -} -// Turn any generator function into an async function (using yield instead -// of await), with context automatically preserved across yields. -function asyncFromGen(genFn) { - return function () { - var gen = genFn.apply(this, arguments); - var boundNext = bind(gen.next); - var boundThrow = bind(gen.throw); - return new Promise(function (resolve, reject) { - function invoke(method, argument) { - try { - var result = method.call(gen, argument); - } - catch (error) { - return reject(error); - } - var next = result.done ? resolve : invokeNext; - if (isPromiseLike(result.value)) { - result.value.then(next, result.done ? reject : invokeThrow); - } - else { - next(result.value); - } - } - var invokeNext = function (value) { return invoke(boundNext, value); }; - var invokeThrow = function (error) { return invoke(boundThrow, error); }; - invokeNext(); - }); - }; -} -function isPromiseLike(value) { - return value && typeof value.then === "function"; -} -// If you use the fibers npm package to implement coroutines in Node.js, -// you should call this function at least once to ensure context management -// remains coherent across any yields. -var wrappedFibers = []; -function wrapYieldingFiberMethods(Fiber) { - // There can be only one implementation of Fiber per process, so this array - // should never grow longer than one element. - if (wrappedFibers.indexOf(Fiber) < 0) { - var wrap = function (obj, method) { - var fn = obj[method]; - obj[method] = function () { - return noContext(fn, arguments, this); - }; - }; - // These methods can yield, according to - // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 - wrap(Fiber, "yield"); - wrap(Fiber.prototype, "run"); - wrap(Fiber.prototype, "throwInto"); - wrappedFibers.push(Fiber); - } - return Fiber; -} - -export { Slot, asyncFromGen, bind, noContext, setTimeoutWithContext as setTimeout, wrapYieldingFiberMethods }; -//# sourceMappingURL=context.esm.js.map diff --git a/node_modules/@wry/context/lib/context.esm.js.map b/node_modules/@wry/context/lib/context.esm.js.map deleted file mode 100644 index 1473e8b2..00000000 --- a/node_modules/@wry/context/lib/context.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.esm.js","sources":["../src/slot.ts","../src/context.ts"],"sourcesContent":["type Context = {\n parent: Context | null;\n slots: { [slotId: string]: any };\n}\n\n// This currentContext variable will only be used if the makeSlotClass\n// function is called, which happens only if this is the first copy of the\n// @wry/context package to be imported.\nlet currentContext: Context | null = null;\n\n// This unique internal object is used to denote the absence of a value\n// for a given Slot, and is never exposed to outside code.\nconst MISSING_VALUE: any = {};\n\nlet idCounter = 1;\n\n// Although we can't do anything about the cost of duplicated code from\n// accidentally bundling multiple copies of the @wry/context package, we can\n// avoid creating the Slot class more than once using makeSlotClass.\nconst makeSlotClass = () => class Slot {\n // If you have a Slot object, you can find out its slot.id, but you cannot\n // guess the slot.id of a Slot you don't have access to, thanks to the\n // randomized suffix.\n public readonly id = [\n \"slot\",\n idCounter++,\n Date.now(),\n Math.random().toString(36).slice(2),\n ].join(\":\");\n\n public hasValue() {\n for (let context = currentContext; context; context = context.parent) {\n // We use the Slot object iself as a key to its value, which means the\n // value cannot be obtained without a reference to the Slot object.\n if (this.id in context.slots) {\n const value = context.slots[this.id];\n if (value === MISSING_VALUE) break;\n if (context !== currentContext) {\n // Cache the value in currentContext.slots so the next lookup will\n // be faster. This caching is safe because the tree of contexts and\n // the values of the slots are logically immutable.\n currentContext!.slots[this.id] = value;\n }\n return true;\n }\n }\n if (currentContext) {\n // If a value was not found for this Slot, it's never going to be found\n // no matter how many times we look it up, so we might as well cache\n // the absence of the value, too.\n currentContext.slots[this.id] = MISSING_VALUE;\n }\n return false;\n }\n\n public getValue(): TValue | undefined {\n if (this.hasValue()) {\n return currentContext!.slots[this.id] as TValue;\n }\n }\n\n public withValue(\n value: TValue,\n callback: (this: TThis, ...args: TArgs) => TResult,\n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args?: TArgs,\n thisArg?: TThis,\n ): TResult {\n const slots = {\n __proto__: null,\n [this.id]: value,\n };\n const parent = currentContext;\n currentContext = { parent, slots };\n try {\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg!, args!);\n } finally {\n currentContext = parent;\n }\n }\n\n // Capture the current context and wrap a callback function so that it\n // reestablishes the captured context when called.\n static bind(\n callback: (...args: TArgs) => TResult,\n ) {\n const context = currentContext;\n return function (this: any) {\n const saved = currentContext;\n try {\n currentContext = context;\n return callback.apply(this, arguments as any);\n } finally {\n currentContext = saved;\n }\n } as typeof callback;\n }\n\n // Immediately run a callback function without any captured context.\n static noContext(\n callback: (this: TThis, ...args: TArgs) => TResult,\n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args?: TArgs,\n thisArg?: TThis,\n ) {\n if (currentContext) {\n const saved = currentContext;\n try {\n currentContext = null;\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg!, args!);\n } finally {\n currentContext = saved;\n }\n } else {\n return callback.apply(thisArg!, args!);\n }\n }\n};\n\n// We store a single global implementation of the Slot class as a permanent\n// non-enumerable symbol property of the Array constructor. This obfuscation\n// does nothing to prevent access to the Slot class, but at least it ensures\n// the implementation (i.e. currentContext) cannot be tampered with, and all\n// copies of the @wry/context package (hopefully just one) will share the\n// same Slot implementation. Since the first copy of the @wry/context package\n// to be imported wins, this technique imposes a very high cost for any\n// future breaking changes to the Slot class.\nconst globalKey = \"@wry/context:Slot\";\nconst host = Array as any;\n\nexport const Slot: ReturnType = host[globalKey] || function () {\n const Slot = makeSlotClass();\n try {\n Object.defineProperty(host, globalKey, {\n value: host[globalKey] = Slot,\n enumerable: false,\n writable: false,\n configurable: false,\n });\n } finally {\n return Slot;\n }\n}();\n","import { Slot } from \"./slot\";\nexport { Slot }\nexport const { bind, noContext } = Slot;\n\n// Like global.setTimeout, except the callback runs with captured context.\nexport { setTimeoutWithContext as setTimeout };\nfunction setTimeoutWithContext(callback: () => any, delay: number) {\n return setTimeout(bind(callback), delay);\n}\n\n// Turn any generator function into an async function (using yield instead\n// of await), with context automatically preserved across yields.\nexport function asyncFromGen(\n genFn: (...args: TArgs) => IterableIterator,\n) {\n return function (this: any) {\n const gen = genFn.apply(this, arguments as any);\n const boundNext = bind(gen.next);\n const boundThrow = bind(gen.throw!);\n type Method = typeof boundNext | typeof boundThrow;\n\n return new Promise((resolve, reject) => {\n function invoke(method: Method, argument: any) {\n try {\n var result = method.call(gen, argument);\n } catch (error) {\n return reject(error);\n }\n const next = result.done ? resolve : invokeNext;\n if (isPromiseLike(result.value)) {\n result.value.then(next, result.done ? reject : invokeThrow);\n } else {\n next(result.value);\n }\n }\n const invokeNext = (value?: any) => invoke(boundNext, value);\n const invokeThrow = (error: any) => invoke(boundThrow, error);\n invokeNext();\n });\n } as (...args: TArgs) => Promise;\n}\n\nfunction isPromiseLike(value: any): value is PromiseLike {\n return value && typeof value.then === \"function\";\n}\n\n// If you use the fibers npm package to implement coroutines in Node.js,\n// you should call this function at least once to ensure context management\n// remains coherent across any yields.\nconst wrappedFibers: Function[] = [];\nexport function wrapYieldingFiberMethods(Fiber: F): F {\n // There can be only one implementation of Fiber per process, so this array\n // should never grow longer than one element.\n if (wrappedFibers.indexOf(Fiber) < 0) {\n const wrap = (obj: any, method: string) => {\n const fn = obj[method];\n obj[method] = function () {\n return noContext(fn, arguments as any, this);\n };\n }\n // These methods can yield, according to\n // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100\n wrap(Fiber, \"yield\");\n wrap(Fiber.prototype, \"run\");\n wrap(Fiber.prototype, \"throwInto\");\n wrappedFibers.push(Fiber);\n }\n return Fiber;\n}\n"],"names":[],"mappings":"AAKA;;;AAGA,IAAI,cAAc,GAAmB,IAAI,CAAC;;;AAI1C,IAAM,aAAa,GAAQ,EAAE,CAAC;AAE9B,IAAI,SAAS,GAAG,CAAC,CAAC;;;;AAKlB,IAAM,aAAa,GAAG,cAAM;IAAA;;;;QAIV,OAAE,GAAG;YACnB,MAAM;YACN,SAAS,EAAE;YACX,IAAI,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;SACpC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KA+Fb;IA7FQ,uBAAQ,GAAf;QACE,KAAK,IAAI,SAAO,GAAG,cAAc,EAAE,SAAO,EAAE,SAAO,GAAG,SAAO,CAAC,MAAM,EAAE;;;YAGpE,IAAI,IAAI,CAAC,EAAE,IAAI,SAAO,CAAC,KAAK,EAAE;gBAC5B,IAAM,KAAK,GAAG,SAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACrC,IAAI,KAAK,KAAK,aAAa;oBAAE,MAAM;gBACnC,IAAI,SAAO,KAAK,cAAc,EAAE;;;;oBAI9B,cAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;iBACxC;gBACD,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EAAE,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACnC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC3B;IACD,OAAO,KAAK,CAAC;CACd;;;;"} \ No newline at end of file diff --git a/node_modules/@wry/context/lib/context.js b/node_modules/@wry/context/lib/context.js deleted file mode 100644 index f21b28dd..00000000 --- a/node_modules/@wry/context/lib/context.js +++ /dev/null @@ -1,207 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -// This currentContext variable will only be used if the makeSlotClass -// function is called, which happens only if this is the first copy of the -// @wry/context package to be imported. -var currentContext = null; -// This unique internal object is used to denote the absence of a value -// for a given Slot, and is never exposed to outside code. -var MISSING_VALUE = {}; -var idCounter = 1; -// Although we can't do anything about the cost of duplicated code from -// accidentally bundling multiple copies of the @wry/context package, we can -// avoid creating the Slot class more than once using makeSlotClass. -var makeSlotClass = function () { return /** @class */ (function () { - function Slot() { - // If you have a Slot object, you can find out its slot.id, but you cannot - // guess the slot.id of a Slot you don't have access to, thanks to the - // randomized suffix. - this.id = [ - "slot", - idCounter++, - Date.now(), - Math.random().toString(36).slice(2), - ].join(":"); - } - Slot.prototype.hasValue = function () { - for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { - // We use the Slot object iself as a key to its value, which means the - // value cannot be obtained without a reference to the Slot object. - if (this.id in context_1.slots) { - var value = context_1.slots[this.id]; - if (value === MISSING_VALUE) - break; - if (context_1 !== currentContext) { - // Cache the value in currentContext.slots so the next lookup will - // be faster. This caching is safe because the tree of contexts and - // the values of the slots are logically immutable. - currentContext.slots[this.id] = value; - } - return true; - } - } - if (currentContext) { - // If a value was not found for this Slot, it's never going to be found - // no matter how many times we look it up, so we might as well cache - // the absence of the value, too. - currentContext.slots[this.id] = MISSING_VALUE; - } - return false; - }; - Slot.prototype.getValue = function () { - if (this.hasValue()) { - return currentContext.slots[this.id]; - } - }; - Slot.prototype.withValue = function (value, callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - var _a; - var slots = (_a = { - __proto__: null - }, - _a[this.id] = value, - _a); - var parent = currentContext; - currentContext = { parent: parent, slots: slots }; - try { - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = parent; - } - }; - // Capture the current context and wrap a callback function so that it - // reestablishes the captured context when called. - Slot.bind = function (callback) { - var context = currentContext; - return function () { - var saved = currentContext; - try { - currentContext = context; - return callback.apply(this, arguments); - } - finally { - currentContext = saved; - } - }; - }; - // Immediately run a callback function without any captured context. - Slot.noContext = function (callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - if (currentContext) { - var saved = currentContext; - try { - currentContext = null; - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = saved; - } - } - else { - return callback.apply(thisArg, args); - } - }; - return Slot; -}()); }; -// We store a single global implementation of the Slot class as a permanent -// non-enumerable symbol property of the Array constructor. This obfuscation -// does nothing to prevent access to the Slot class, but at least it ensures -// the implementation (i.e. currentContext) cannot be tampered with, and all -// copies of the @wry/context package (hopefully just one) will share the -// same Slot implementation. Since the first copy of the @wry/context package -// to be imported wins, this technique imposes a very high cost for any -// future breaking changes to the Slot class. -var globalKey = "@wry/context:Slot"; -var host = Array; -var Slot = host[globalKey] || function () { - var Slot = makeSlotClass(); - try { - Object.defineProperty(host, globalKey, { - value: host[globalKey] = Slot, - enumerable: false, - writable: false, - configurable: false, - }); - } - finally { - return Slot; - } -}(); - -var bind = Slot.bind, noContext = Slot.noContext; -function setTimeoutWithContext(callback, delay) { - return setTimeout(bind(callback), delay); -} -// Turn any generator function into an async function (using yield instead -// of await), with context automatically preserved across yields. -function asyncFromGen(genFn) { - return function () { - var gen = genFn.apply(this, arguments); - var boundNext = bind(gen.next); - var boundThrow = bind(gen.throw); - return new Promise(function (resolve, reject) { - function invoke(method, argument) { - try { - var result = method.call(gen, argument); - } - catch (error) { - return reject(error); - } - var next = result.done ? resolve : invokeNext; - if (isPromiseLike(result.value)) { - result.value.then(next, result.done ? reject : invokeThrow); - } - else { - next(result.value); - } - } - var invokeNext = function (value) { return invoke(boundNext, value); }; - var invokeThrow = function (error) { return invoke(boundThrow, error); }; - invokeNext(); - }); - }; -} -function isPromiseLike(value) { - return value && typeof value.then === "function"; -} -// If you use the fibers npm package to implement coroutines in Node.js, -// you should call this function at least once to ensure context management -// remains coherent across any yields. -var wrappedFibers = []; -function wrapYieldingFiberMethods(Fiber) { - // There can be only one implementation of Fiber per process, so this array - // should never grow longer than one element. - if (wrappedFibers.indexOf(Fiber) < 0) { - var wrap = function (obj, method) { - var fn = obj[method]; - obj[method] = function () { - return noContext(fn, arguments, this); - }; - }; - // These methods can yield, according to - // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 - wrap(Fiber, "yield"); - wrap(Fiber.prototype, "run"); - wrap(Fiber.prototype, "throwInto"); - wrappedFibers.push(Fiber); - } - return Fiber; -} - -exports.Slot = Slot; -exports.asyncFromGen = asyncFromGen; -exports.bind = bind; -exports.noContext = noContext; -exports.setTimeout = setTimeoutWithContext; -exports.wrapYieldingFiberMethods = wrapYieldingFiberMethods; diff --git a/node_modules/@wry/context/lib/context.js.map b/node_modules/@wry/context/lib/context.js.map deleted file mode 100644 index 80f18085..00000000 --- a/node_modules/@wry/context/lib/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AACrB,eADA,WAAI,CACA;AACE,QAAA,IAAI,GAAgB,WAAI,OAAlB,QAAA,SAAS,GAAK,WAAI,WAAC;AAIxC,SAAS,qBAAqB,CAAC,QAAmB,EAAE,KAAa;IA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B,CAAC;YAC9D,UAAU,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAyC,CAAC;AAC5C,CAAC;AA5BD,oCA4BC;AAED,SAAS,aAAa,CAAC,KAAU;IAC/B,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnD,CAAC;AAED,wEAAwE;AACxE,2EAA2E;AAC3E,sCAAsC;AACtC,IAAM,aAAa,GAAe,EAAE,CAAC;AACrC,SAAgB,wBAAwB,CAAqB,KAAQ;IACnE,2EAA2E;IAC3E,6CAA6C;IAC7C,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACpC,IAAM,IAAI,GAAG,UAAC,GAAQ,EAAE,MAAc;YACpC,IAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;YACvB,GAAG,CAAC,MAAM,CAAC,GAAG;gBACZ,OAAO,iBAAS,CAAC,EAAE,EAAE,SAAgB,EAAE,IAAI,CAAC,CAAC;YAC/C,CAAC,CAAC;QACJ,CAAC,CAAA;QACD,wCAAwC;QACxC,2GAA2G;QAC3G,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACnC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC3B;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAlBD,4DAkBC"} \ No newline at end of file diff --git a/node_modules/@wry/context/lib/slot.d.ts b/node_modules/@wry/context/lib/slot.d.ts deleted file mode 100644 index 5937e0a9..00000000 --- a/node_modules/@wry/context/lib/slot.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare const makeSlotClass: () => { - new (): { - readonly id: string; - hasValue(): boolean; - getValue(): TValue | undefined; - withValue(value: TValue, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult; - }; - bind(callback: (...args: TArgs) => TResult): (...args: TArgs) => TResult; - noContext(callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult; -}; -export declare const Slot: ReturnType; -export {}; diff --git a/node_modules/@wry/context/lib/slot.js b/node_modules/@wry/context/lib/slot.js deleted file mode 100644 index e1c64f7e..00000000 --- a/node_modules/@wry/context/lib/slot.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// This currentContext variable will only be used if the makeSlotClass -// function is called, which happens only if this is the first copy of the -// @wry/context package to be imported. -var currentContext = null; -// This unique internal object is used to denote the absence of a value -// for a given Slot, and is never exposed to outside code. -var MISSING_VALUE = {}; -var idCounter = 1; -// Although we can't do anything about the cost of duplicated code from -// accidentally bundling multiple copies of the @wry/context package, we can -// avoid creating the Slot class more than once using makeSlotClass. -var makeSlotClass = function () { return /** @class */ (function () { - function Slot() { - // If you have a Slot object, you can find out its slot.id, but you cannot - // guess the slot.id of a Slot you don't have access to, thanks to the - // randomized suffix. - this.id = [ - "slot", - idCounter++, - Date.now(), - Math.random().toString(36).slice(2), - ].join(":"); - } - Slot.prototype.hasValue = function () { - for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { - // We use the Slot object iself as a key to its value, which means the - // value cannot be obtained without a reference to the Slot object. - if (this.id in context_1.slots) { - var value = context_1.slots[this.id]; - if (value === MISSING_VALUE) - break; - if (context_1 !== currentContext) { - // Cache the value in currentContext.slots so the next lookup will - // be faster. This caching is safe because the tree of contexts and - // the values of the slots are logically immutable. - currentContext.slots[this.id] = value; - } - return true; - } - } - if (currentContext) { - // If a value was not found for this Slot, it's never going to be found - // no matter how many times we look it up, so we might as well cache - // the absence of the value, too. - currentContext.slots[this.id] = MISSING_VALUE; - } - return false; - }; - Slot.prototype.getValue = function () { - if (this.hasValue()) { - return currentContext.slots[this.id]; - } - }; - Slot.prototype.withValue = function (value, callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - var _a; - var slots = (_a = { - __proto__: null - }, - _a[this.id] = value, - _a); - var parent = currentContext; - currentContext = { parent: parent, slots: slots }; - try { - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = parent; - } - }; - // Capture the current context and wrap a callback function so that it - // reestablishes the captured context when called. - Slot.bind = function (callback) { - var context = currentContext; - return function () { - var saved = currentContext; - try { - currentContext = context; - return callback.apply(this, arguments); - } - finally { - currentContext = saved; - } - }; - }; - // Immediately run a callback function without any captured context. - Slot.noContext = function (callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - if (currentContext) { - var saved = currentContext; - try { - currentContext = null; - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = saved; - } - } - else { - return callback.apply(thisArg, args); - } - }; - return Slot; -}()); }; -// We store a single global implementation of the Slot class as a permanent -// non-enumerable symbol property of the Array constructor. This obfuscation -// does nothing to prevent access to the Slot class, but at least it ensures -// the implementation (i.e. currentContext) cannot be tampered with, and all -// copies of the @wry/context package (hopefully just one) will share the -// same Slot implementation. Since the first copy of the @wry/context package -// to be imported wins, this technique imposes a very high cost for any -// future breaking changes to the Slot class. -var globalKey = "@wry/context:Slot"; -var host = Array; -exports.Slot = host[globalKey] || function () { - var Slot = makeSlotClass(); - try { - Object.defineProperty(host, globalKey, { - value: host[globalKey] = Slot, - enumerable: false, - writable: false, - configurable: false, - }); - } - finally { - return Slot; - } -}(); -//# sourceMappingURL=slot.js.map \ No newline at end of file diff --git a/node_modules/@wry/context/lib/slot.js.map b/node_modules/@wry/context/lib/slot.js.map deleted file mode 100644 index 217f845d..00000000 --- a/node_modules/@wry/context/lib/slot.js.map +++ /dev/null @@ -1 +0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tB,qEAAqE;gBACrE,+CAA+C;gBAC/C,OAAO,QAAQ,CAAC,KAAK,CAAC,OAAQ,EAAE,IAAK,CAAC,CAAC;aACxC;oBAAS;gBACR,cAAc,GAAG,KAAK,CAAC;aACxB;SACF;aAAM;YACL,OAAO,QAAQ,CAAC,KAAK,CAAC,OAAQ,EAAE,IAAK,CAAC,CAAC;SACxC;IACH,CAAC;IACH,WAAC;AAAD,CAAC,AAxG2B,KAAA,CAwG3B,CAAC;AAEF,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,yEAAyE;AACzE,6EAA6E;AAC7E,uEAAuE;AACvE,6CAA6C;AAC7C,IAAM,SAAS,GAAG,mBAAmB,CAAC;AACtC,IAAM,IAAI,GAAG,KAAY,CAAC;AAEb,QAAA,IAAI,GAAqC,IAAI,CAAC,SAAS,CAAC,IAAI;IACvE,IAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,IAAI;QACF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE;YACrC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI;YAC7B,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;KACJ;YAAS;QACR,OAAO,IAAI,CAAC;KACb;AACH,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@wry/context/package.json b/node_modules/@wry/context/package.json deleted file mode 100644 index 3e6275f4..00000000 --- a/node_modules/@wry/context/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_args": [ - [ - "@wry/context@0.4.4", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "@wry/context@0.4.4", - "_id": "@wry/context@0.4.4", - "_inBundle": false, - "_integrity": "sha512-LrKVLove/zw6h2Md/KZyWxIkFM6AoyKp71OqpH9Hiip1csjPVoD3tPxlbQUNxEnHENks3UGgNpSBCAfq9KWuag==", - "_location": "/@wry/context", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@wry/context@0.4.4", - "name": "@wry/context", - "escapedName": "@wry%2fcontext", - "scope": "@wry", - "rawSpec": "0.4.4", - "saveSpec": null, - "fetchSpec": "0.4.4" - }, - "_requiredBy": [ - "/optimism" - ], - "_resolved": "https://registry.npmjs.org/@wry/context/-/context-0.4.4.tgz", - "_spec": "0.4.4", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Ben Newman", - "email": "ben@eloper.dev" - }, - "bugs": { - "url": "https://github.com/benjamn/wryware/issues" - }, - "dependencies": { - "@types/node": ">=6", - "tslib": "^1.9.3" - }, - "description": "Manage contextual information needed by (a)synchronous tasks without explicitly passing objects around", - "gitHead": "50e7d6181b0b937ad54b543118e823ad98e2bca9", - "homepage": "https://github.com/benjamn/wryware", - "keywords": [], - "license": "MIT", - "main": "lib/context.js", - "module": "lib/context.esm.js", - "name": "@wry/context", - "repository": { - "type": "git", - "url": "git+https://github.com/benjamn/wryware.git" - }, - "scripts": { - "build": "npm run clean && npm run tsc && npm run rollup", - "clean": "../../node_modules/.bin/rimraf lib", - "mocha": "../../scripts/test.sh lib/tests.js", - "prepublish": "npm run build", - "rollup": "../../node_modules/.bin/rollup -c", - "test": "npm run build && npm run mocha", - "tsc": "../../node_modules/.bin/tsc" - }, - "types": "lib/context.d.ts", - "version": "0.4.4" -} diff --git a/node_modules/@wry/context/rollup.config.js b/node_modules/@wry/context/rollup.config.js deleted file mode 100644 index 10eff162..00000000 --- a/node_modules/@wry/context/rollup.config.js +++ /dev/null @@ -1,40 +0,0 @@ -import typescriptPlugin from 'rollup-plugin-typescript2'; -import typescript from 'typescript'; - -const globals = { - __proto__: null, - tslib: "tslib", -}; - -function external(id) { - return id in globals; -} - -export default [{ - input: "src/context.ts", - external, - output: { - file: "lib/context.esm.js", - format: "esm", - sourcemap: true, - globals, - }, - plugins: [ - typescriptPlugin({ - typescript, - tsconfig: "./tsconfig.rollup.json", - }), - ], -}, { - input: "lib/context.esm.js", - external, - output: { - // Intentionally overwrite the context.js file written by tsc: - file: "lib/context.js", - format: "cjs", - exports: "named", - sourceMap: true, - name: "context", - globals, - }, -}]; diff --git a/node_modules/@wry/context/tsconfig.json b/node_modules/@wry/context/tsconfig.json deleted file mode 100644 index 1a79ad1e..00000000 --- a/node_modules/@wry/context/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./lib" - } -} diff --git a/node_modules/@wry/context/tsconfig.rollup.json b/node_modules/@wry/context/tsconfig.rollup.json deleted file mode 100644 index 02085be6..00000000 --- a/node_modules/@wry/context/tsconfig.rollup.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "es2015", - }, -} diff --git a/node_modules/@wry/equality/LICENSE b/node_modules/@wry/equality/LICENSE deleted file mode 100644 index 306c285a..00000000 --- a/node_modules/@wry/equality/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Ben Newman - -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. diff --git a/node_modules/@wry/equality/README.md b/node_modules/@wry/equality/README.md deleted file mode 100644 index 4505ebc6..00000000 --- a/node_modules/@wry/equality/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# @wry/equality - -Structural equality checking for JavaScript values, with correct handling -of cyclic references, and minimal bundle size. diff --git a/node_modules/@wry/equality/lib/equality.d.ts b/node_modules/@wry/equality/lib/equality.d.ts deleted file mode 100644 index fa9e8a4f..00000000 --- a/node_modules/@wry/equality/lib/equality.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Performs a deep equality check on two JavaScript values, tolerating cycles. - */ -export declare function equal(a: any, b: any): boolean; -export default equal; diff --git a/node_modules/@wry/equality/lib/equality.esm.js b/node_modules/@wry/equality/lib/equality.esm.js deleted file mode 100644 index 926da2eb..00000000 --- a/node_modules/@wry/equality/lib/equality.esm.js +++ /dev/null @@ -1,129 +0,0 @@ -var _a = Object.prototype, toString = _a.toString, hasOwnProperty = _a.hasOwnProperty; -var previousComparisons = new Map(); -/** - * Performs a deep equality check on two JavaScript values, tolerating cycles. - */ -function equal(a, b) { - try { - return check(a, b); - } - finally { - previousComparisons.clear(); - } -} -function check(a, b) { - // If the two values are strictly equal, our job is easy. - if (a === b) { - return true; - } - // Object.prototype.toString returns a representation of the runtime type of - // the given value that is considerably more precise than typeof. - var aTag = toString.call(a); - var bTag = toString.call(b); - // If the runtime types of a and b are different, they could maybe be equal - // under some interpretation of equality, but for simplicity and performance - // we just return false instead. - if (aTag !== bTag) { - return false; - } - switch (aTag) { - case '[object Array]': - // Arrays are a lot like other objects, but we can cheaply compare their - // lengths as a short-cut before comparing their elements. - if (a.length !== b.length) - return false; - // Fall through to object case... - case '[object Object]': { - if (previouslyCompared(a, b)) - return true; - var aKeys = Object.keys(a); - var bKeys = Object.keys(b); - // If `a` and `b` have a different number of enumerable keys, they - // must be different. - var keyCount = aKeys.length; - if (keyCount !== bKeys.length) - return false; - // Now make sure they have the same keys. - for (var k = 0; k < keyCount; ++k) { - if (!hasOwnProperty.call(b, aKeys[k])) { - return false; - } - } - // Finally, check deep equality of all child properties. - for (var k = 0; k < keyCount; ++k) { - var key = aKeys[k]; - if (!check(a[key], b[key])) { - return false; - } - } - return true; - } - case '[object Error]': - return a.name === b.name && a.message === b.message; - case '[object Number]': - // Handle NaN, which is !== itself. - if (a !== a) - return b !== b; - // Fall through to shared +a === +b case... - case '[object Boolean]': - case '[object Date]': - return +a === +b; - case '[object RegExp]': - case '[object String]': - return a == "" + b; - case '[object Map]': - case '[object Set]': { - if (a.size !== b.size) - return false; - if (previouslyCompared(a, b)) - return true; - var aIterator = a.entries(); - var isMap = aTag === '[object Map]'; - while (true) { - var info = aIterator.next(); - if (info.done) - break; - // If a instanceof Set, aValue === aKey. - var _a = info.value, aKey = _a[0], aValue = _a[1]; - // So this works the same way for both Set and Map. - if (!b.has(aKey)) { - return false; - } - // However, we care about deep equality of values only when dealing - // with Map structures. - if (isMap && !check(aValue, b.get(aKey))) { - return false; - } - } - return true; - } - } - // Otherwise the values are not equal. - return false; -} -function previouslyCompared(a, b) { - // Though cyclic references can make an object graph appear infinite from the - // perspective of a depth-first traversal, the graph still contains a finite - // number of distinct object references. We use the previousComparisons cache - // to avoid comparing the same pair of object references more than once, which - // guarantees termination (even if we end up comparing every object in one - // graph to every object in the other graph, which is extremely unlikely), - // while still allowing weird isomorphic structures (like rings with different - // lengths) a chance to pass the equality test. - var bSet = previousComparisons.get(a); - if (bSet) { - // Return true here because we can be sure false will be returned somewhere - // else if the objects are not equivalent. - if (bSet.has(b)) - return true; - } - else { - previousComparisons.set(a, bSet = new Set); - } - bSet.add(b); - return false; -} - -export default equal; -export { equal }; -//# sourceMappingURL=equality.esm.js.map diff --git a/node_modules/@wry/equality/lib/equality.esm.js.map b/node_modules/@wry/equality/lib/equality.esm.js.map deleted file mode 100644 index 79caa7db..00000000 --- a/node_modules/@wry/equality/lib/equality.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"equality.esm.js","sources":["../src/equality.ts"],"sourcesContent":["const { toString, hasOwnProperty } = Object.prototype;\nconst previousComparisons = new Map>();\n\n/**\n * Performs a deep equality check on two JavaScript values, tolerating cycles.\n */\nexport function equal(a: any, b: any): boolean {\n try {\n return check(a, b);\n } finally {\n previousComparisons.clear();\n }\n}\n\n// Allow default imports as well.\nexport default equal;\n\nfunction check(a: any, b: any): boolean {\n // If the two values are strictly equal, our job is easy.\n if (a === b) {\n return true;\n }\n\n // Object.prototype.toString returns a representation of the runtime type of\n // the given value that is considerably more precise than typeof.\n const aTag = toString.call(a);\n const bTag = toString.call(b);\n\n // If the runtime types of a and b are different, they could maybe be equal\n // under some interpretation of equality, but for simplicity and performance\n // we just return false instead.\n if (aTag !== bTag) {\n return false;\n }\n\n switch (aTag) {\n case '[object Array]':\n // Arrays are a lot like other objects, but we can cheaply compare their\n // lengths as a short-cut before comparing their elements.\n if (a.length !== b.length) return false;\n // Fall through to object case...\n case '[object Object]': {\n if (previouslyCompared(a, b)) return true;\n\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n // If `a` and `b` have a different number of enumerable keys, they\n // must be different.\n const keyCount = aKeys.length;\n if (keyCount !== bKeys.length) return false;\n\n // Now make sure they have the same keys.\n for (let k = 0; k < keyCount; ++k) {\n if (!hasOwnProperty.call(b, aKeys[k])) {\n return false;\n }\n }\n\n // Finally, check deep equality of all child properties.\n for (let k = 0; k < keyCount; ++k) {\n const key = aKeys[k];\n if (!check(a[key], b[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n case '[object Error]':\n return a.name === b.name && a.message === b.message;\n\n case '[object Number]':\n // Handle NaN, which is !== itself.\n if (a !== a) return b !== b;\n // Fall through to shared +a === +b case...\n case '[object Boolean]':\n case '[object Date]':\n return +a === +b;\n\n case '[object RegExp]':\n case '[object String]':\n return a == `${b}`;\n\n case '[object Map]':\n case '[object Set]': {\n if (a.size !== b.size) return false;\n if (previouslyCompared(a, b)) return true;\n\n const aIterator = a.entries();\n const isMap = aTag === '[object Map]';\n\n while (true) {\n const info = aIterator.next();\n if (info.done) break;\n\n // If a instanceof Set, aValue === aKey.\n const [aKey, aValue] = info.value;\n\n // So this works the same way for both Set and Map.\n if (!b.has(aKey)) {\n return false;\n }\n\n // However, we care about deep equality of values only when dealing\n // with Map structures.\n if (isMap && !check(aValue, b.get(aKey))) {\n return false;\n }\n }\n\n return true;\n }\n }\n\n // Otherwise the values are not equal.\n return false;\n}\n\nfunction previouslyCompared(a: object, b: object): boolean {\n // Though cyclic references can make an object graph appear infinite from the\n // perspective of a depth-first traversal, the graph still contains a finite\n // number of distinct object references. We use the previousComparisons cache\n // to avoid comparing the same pair of object references more than once, which\n // guarantees termination (even if we end up comparing every object in one\n // graph to every object in the other graph, which is extremely unlikely),\n // while still allowing weird isomorphic structures (like rings with different\n // lengths) a chance to pass the equality test.\n let bSet = previousComparisons.get(a);\n if (bSet) {\n // Return true here because we can be sure false will be returned somewhere\n // else if the objects are not equivalent.\n if (bSet.has(b)) return true;\n } else {\n previousComparisons.set(a, bSet = new Set);\n }\n bSet.add(b);\n return false;\n}\n"],"names":[],"mappings":"AAAM,IAAA,qBAA+C,EAA7C,sBAAQ,EAAE,kCAAmC,CAAC;AACtD,IAAM,mBAAmB,GAAG,IAAI,GAAG,EAAuB,CAAC;;;;AAK3D,SAAgB,KAAK,CAAC,CAAM,EAAE,CAAM;IAClC,IAAI;QACF,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACpB;YAAS;QACR,mBAAmB,CAAC,KAAK,EAAE,CAAC;KAC7B;CACF;AAED,AAGA,SAAS,KAAK,CAAC,CAAM,EAAE,CAAM;;IAE3B,IAAI,CAAC,KAAK,CAAC,EAAE;QACX,OAAO,IAAI,CAAC;KACb;;;IAID,IAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAM,IAAI,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R,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;KAC9B;SAAM;QACL,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;KAC5C;IACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC;CACd;;;;;"} \ No newline at end of file diff --git a/node_modules/@wry/equality/lib/equality.js b/node_modules/@wry/equality/lib/equality.js deleted file mode 100644 index f4744de4..00000000 --- a/node_modules/@wry/equality/lib/equality.js +++ /dev/null @@ -1,132 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var _a = Object.prototype, toString = _a.toString, hasOwnProperty = _a.hasOwnProperty; -var previousComparisons = new Map(); -/** - * Performs a deep equality check on two JavaScript values, tolerating cycles. - */ -function equal(a, b) { - try { - return check(a, b); - } - finally { - previousComparisons.clear(); - } -} -function check(a, b) { - // If the two values are strictly equal, our job is easy. - if (a === b) { - return true; - } - // Object.prototype.toString returns a representation of the runtime type of - // the given value that is considerably more precise than typeof. - var aTag = toString.call(a); - var bTag = toString.call(b); - // If the runtime types of a and b are different, they could maybe be equal - // under some interpretation of equality, but for simplicity and performance - // we just return false instead. - if (aTag !== bTag) { - return false; - } - switch (aTag) { - case '[object Array]': - // Arrays are a lot like other objects, but we can cheaply compare their - // lengths as a short-cut before comparing their elements. - if (a.length !== b.length) - return false; - // Fall through to object case... - case '[object Object]': { - if (previouslyCompared(a, b)) - return true; - var aKeys = Object.keys(a); - var bKeys = Object.keys(b); - // If `a` and `b` have a different number of enumerable keys, they - // must be different. - var keyCount = aKeys.length; - if (keyCount !== bKeys.length) - return false; - // Now make sure they have the same keys. - for (var k = 0; k < keyCount; ++k) { - if (!hasOwnProperty.call(b, aKeys[k])) { - return false; - } - } - // Finally, check deep equality of all child properties. - for (var k = 0; k < keyCount; ++k) { - var key = aKeys[k]; - if (!check(a[key], b[key])) { - return false; - } - } - return true; - } - case '[object Error]': - return a.name === b.name && a.message === b.message; - case '[object Number]': - // Handle NaN, which is !== itself. - if (a !== a) - return b !== b; - // Fall through to shared +a === +b case... - case '[object Boolean]': - case '[object Date]': - return +a === +b; - case '[object RegExp]': - case '[object String]': - return a == "" + b; - case '[object Map]': - case '[object Set]': { - if (a.size !== b.size) - return false; - if (previouslyCompared(a, b)) - return true; - var aIterator = a.entries(); - var isMap = aTag === '[object Map]'; - while (true) { - var info = aIterator.next(); - if (info.done) - break; - // If a instanceof Set, aValue === aKey. - var _a = info.value, aKey = _a[0], aValue = _a[1]; - // So this works the same way for both Set and Map. - if (!b.has(aKey)) { - return false; - } - // However, we care about deep equality of values only when dealing - // with Map structures. - if (isMap && !check(aValue, b.get(aKey))) { - return false; - } - } - return true; - } - } - // Otherwise the values are not equal. - return false; -} -function previouslyCompared(a, b) { - // Though cyclic references can make an object graph appear infinite from the - // perspective of a depth-first traversal, the graph still contains a finite - // number of distinct object references. We use the previousComparisons cache - // to avoid comparing the same pair of object references more than once, which - // guarantees termination (even if we end up comparing every object in one - // graph to every object in the other graph, which is extremely unlikely), - // while still allowing weird isomorphic structures (like rings with different - // lengths) a chance to pass the equality test. - var bSet = previousComparisons.get(a); - if (bSet) { - // Return true here because we can be sure false will be returned somewhere - // else if the objects are not equivalent. - if (bSet.has(b)) - return true; - } - else { - previousComparisons.set(a, bSet = new Set); - } - bSet.add(b); - return false; -} - -exports.default = equal; -exports.equal = equal; diff --git a/node_modules/@wry/equality/lib/equality.js.map b/node_modules/@wry/equality/lib/equality.js.map deleted file mode 100644 index 9b8f42ca..00000000 --- a/node_modules/@wry/equality/lib/equality.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"equality.js","sourceRoot":"","sources":["../src/equality.ts"],"names":[],"mappings":";;AAAM,IAAA,qBAA+C,EAA7C,sBAAQ,EAAE,kCAAmC,CAAC;AACtD,IAAM,mBAAmB,GAAG,IAAI,GAAG,EAAuB,CAAC;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IAAI,KAAK,cAAc,CAAC;YAEtC,OAAO,IAAI,EAAE;gBACX,IAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;gBAC9B,IAAI,IAAI,CAAC,IAAI;oBAAE,MAAM;gBAErB,wCAAwC;gBAClC,IAAA,eAA2B,EAA1B,YAAI,EAAE,cAAoB,CAAC;gBAElC,mDAAmD;gBACnD,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBAChB,OAAO,KAAK,CAAC;iBACd;gBAED,mEAAmE;gBACnE,uBAAuB;gBACvB,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE;oBACxC,OAAO,KAAK,CAAC;iBACd;aACF;YAED,OAAO,IAAI,CAAC;SACb;KACF;IAED,sCAAsC;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAS,EAAE,CAAS;IAC9C,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,8EAA8E;IAC9E,0EAA0E;IAC1E,0EAA0E;IAC1E,8EAA8E;IAC9E,+CAA+C;IAC/C,IAAI,IAAI,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,IAAI,EAAE;QACR,2EAA2E;QAC3E,0CAA0C;QAC1C,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;KAC9B;SAAM;QACL,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;KAC5C;IACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/@wry/equality/package.json b/node_modules/@wry/equality/package.json deleted file mode 100644 index 7ea6d1de..00000000 --- a/node_modules/@wry/equality/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_args": [ - [ - "@wry/equality@0.1.9", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "@wry/equality@0.1.9", - "_id": "@wry/equality@0.1.9", - "_inBundle": false, - "_integrity": "sha512-mB6ceGjpMGz1ZTza8HYnrPGos2mC6So4NhS1PtZ8s4Qt0K7fBiIGhpSxUbQmhwcSWE3no+bYxmI2OL6KuXYmoQ==", - "_location": "/@wry/equality", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@wry/equality@0.1.9", - "name": "@wry/equality", - "escapedName": "@wry%2fequality", - "scope": "@wry", - "rawSpec": "0.1.9", - "saveSpec": null, - "fetchSpec": "0.1.9" - }, - "_requiredBy": [ - "/apollo-utilities" - ], - "_resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.1.9.tgz", - "_spec": "0.1.9", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Ben Newman", - "email": "ben@eloper.dev" - }, - "bugs": { - "url": "https://github.com/benjamn/wryware/issues" - }, - "dependencies": { - "tslib": "^1.9.3" - }, - "description": "Structural equality checking for JavaScript values", - "gitHead": "50e7d6181b0b937ad54b543118e823ad98e2bca9", - "homepage": "https://github.com/benjamn/wryware", - "keywords": [], - "license": "MIT", - "main": "lib/equality.js", - "module": "lib/equality.esm.js", - "name": "@wry/equality", - "repository": { - "type": "git", - "url": "git+https://github.com/benjamn/wryware.git" - }, - "scripts": { - "build": "npm run clean && npm run tsc && npm run rollup", - "clean": "../../node_modules/.bin/rimraf lib", - "mocha": "../../scripts/test.sh lib/tests.js", - "prepublish": "npm run build", - "rollup": "../../node_modules/.bin/rollup -c", - "test": "npm run build && npm run mocha", - "tsc": "../../node_modules/.bin/tsc" - }, - "types": "lib/equality.d.ts", - "version": "0.1.9" -} diff --git a/node_modules/@wry/equality/rollup.config.js b/node_modules/@wry/equality/rollup.config.js deleted file mode 100644 index 78c338ca..00000000 --- a/node_modules/@wry/equality/rollup.config.js +++ /dev/null @@ -1,40 +0,0 @@ -import typescriptPlugin from 'rollup-plugin-typescript2'; -import typescript from 'typescript'; - -const globals = { - __proto__: null, - tslib: "tslib", -}; - -function external(id) { - return id in globals; -} - -export default [{ - input: "src/equality.ts", - external, - output: { - file: "lib/equality.esm.js", - format: "esm", - sourcemap: true, - globals, - }, - plugins: [ - typescriptPlugin({ - typescript, - tsconfig: "./tsconfig.rollup.json", - }), - ], -}, { - input: "lib/equality.esm.js", - external, - output: { - // Intentionally overwrite the equality.js file written by tsc: - file: "lib/equality.js", - format: "cjs", - exports: "named", - sourceMap: true, - name: "equality", - globals, - }, -}]; diff --git a/node_modules/@wry/equality/tsconfig.json b/node_modules/@wry/equality/tsconfig.json deleted file mode 100644 index 1a79ad1e..00000000 --- a/node_modules/@wry/equality/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./lib" - } -} diff --git a/node_modules/@wry/equality/tsconfig.rollup.json b/node_modules/@wry/equality/tsconfig.rollup.json deleted file mode 100644 index 02085be6..00000000 --- a/node_modules/@wry/equality/tsconfig.rollup.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "es2015", - }, -} diff --git a/node_modules/abort-controller/LICENSE b/node_modules/abort-controller/LICENSE deleted file mode 100644 index c914149a..00000000 --- a/node_modules/abort-controller/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Toru Nagashima - -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. diff --git a/node_modules/abort-controller/README.md b/node_modules/abort-controller/README.md deleted file mode 100644 index 9de3e45f..00000000 --- a/node_modules/abort-controller/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# abort-controller - -[![npm version](https://img.shields.io/npm/v/abort-controller.svg)](https://www.npmjs.com/package/abort-controller) -[![Downloads/month](https://img.shields.io/npm/dm/abort-controller.svg)](http://www.npmtrends.com/abort-controller) -[![Build Status](https://travis-ci.org/mysticatea/abort-controller.svg?branch=master)](https://travis-ci.org/mysticatea/abort-controller) -[![Coverage Status](https://codecov.io/gh/mysticatea/abort-controller/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/abort-controller) -[![Dependency Status](https://david-dm.org/mysticatea/abort-controller.svg)](https://david-dm.org/mysticatea/abort-controller) - -An implementation of [WHATWG AbortController interface](https://dom.spec.whatwg.org/#interface-abortcontroller). - -```js -import AbortController from "abort-controller" - -const controller = new AbortController() -const signal = controller.signal - -signal.addEventListener("abort", () => { - console.log("aborted!") -}) - -controller.abort() -``` - -> https://jsfiddle.net/1r2994qp/1/ - -## 💿 Installation - -Use [npm](https://www.npmjs.com/) to install then use a bundler. - -``` -npm install abort-controller -``` - -Or download from [`dist` directory](./dist). - -- [dist/abort-controller.mjs](dist/abort-controller.mjs) ... ES modules version. -- [dist/abort-controller.js](dist/abort-controller.js) ... Common JS version. -- [dist/abort-controller.umd.js](dist/abort-controller.umd.js) ... UMD (Universal Module Definition) version. This is transpiled by [Babel](https://babeljs.io/) for IE 11. - -## 📖 Usage - -### Basic - -```js -import AbortController from "abort-controller" -// or -const AbortController = require("abort-controller") - -// or UMD version defines a global variable: -const AbortController = window.AbortControllerShim -``` - -If your bundler recognizes `browser` field of `package.json`, the imported `AbortController` is the native one and it doesn't contain shim (even if the native implementation was nothing). -If you wanted to polyfill `AbortController` for IE, use `abort-controller/polyfill`. - -### Polyfilling - -Importing `abort-controller/polyfill` assigns the `AbortController` shim to the `AbortController` global variable if the native implementation was nothing. - -```js -import "abort-controller/polyfill" -// or -require("abort-controller/polyfill") -``` - -### API - -#### AbortController - -> https://dom.spec.whatwg.org/#interface-abortcontroller - -##### controller.signal - -The [AbortSignal](https://dom.spec.whatwg.org/#interface-AbortSignal) object which is associated to this controller. - -##### controller.abort() - -Notify `abort` event to listeners that the `signal` has. - -## 📰 Changelog - -- See [GitHub releases](https://github.com/mysticatea/abort-controller/releases). - -## 🍻 Contributing - -Contributing is welcome ❤️ - -Please use GitHub issues/PRs. - -### Development tools - -- `npm install` installs dependencies for development. -- `npm test` runs tests and measures code coverage. -- `npm run clean` removes temporary files of tests. -- `npm run coverage` opens code coverage of the previous test with your default browser. -- `npm run lint` runs ESLint. -- `npm run build` generates `dist` codes. -- `npm run watch` runs tests on each file change. diff --git a/node_modules/abort-controller/browser.js b/node_modules/abort-controller/browser.js deleted file mode 100644 index b0c5ec37..00000000 --- a/node_modules/abort-controller/browser.js +++ /dev/null @@ -1,13 +0,0 @@ -/*globals self, window */ -"use strict" - -/*eslint-disable @mysticatea/prettier */ -const { AbortController, AbortSignal } = - typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - /* otherwise */ undefined -/*eslint-enable @mysticatea/prettier */ - -module.exports = AbortController -module.exports.AbortSignal = AbortSignal -module.exports.default = AbortController diff --git a/node_modules/abort-controller/browser.mjs b/node_modules/abort-controller/browser.mjs deleted file mode 100644 index a8f321af..00000000 --- a/node_modules/abort-controller/browser.mjs +++ /dev/null @@ -1,11 +0,0 @@ -/*globals self, window */ - -/*eslint-disable @mysticatea/prettier */ -const { AbortController, AbortSignal } = - typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - /* otherwise */ undefined -/*eslint-enable @mysticatea/prettier */ - -export default AbortController -export { AbortController, AbortSignal } diff --git a/node_modules/abort-controller/dist/abort-controller.d.ts b/node_modules/abort-controller/dist/abort-controller.d.ts deleted file mode 100644 index 75852fb5..00000000 --- a/node_modules/abort-controller/dist/abort-controller.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { EventTarget } from "event-target-shim" - -type Events = { - abort: any -} -type EventAttributes = { - onabort: any -} -/** - * The signal class. - * @see https://dom.spec.whatwg.org/#abortsignal - */ -declare class AbortSignal extends EventTarget { - /** - * AbortSignal cannot be constructed directly. - */ - constructor() - /** - * Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise. - */ - readonly aborted: boolean -} -/** - * The AbortController. - * @see https://dom.spec.whatwg.org/#abortcontroller - */ -declare class AbortController { - /** - * Initialize this controller. - */ - constructor() - /** - * Returns the `AbortSignal` object associated with this object. - */ - readonly signal: AbortSignal - /** - * Abort and signal to any observers that the associated activity is to be aborted. - */ - abort(): void -} - -export default AbortController -export { AbortController, AbortSignal } diff --git a/node_modules/abort-controller/dist/abort-controller.js b/node_modules/abort-controller/dist/abort-controller.js deleted file mode 100644 index 49af7395..00000000 --- a/node_modules/abort-controller/dist/abort-controller.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @author Toru Nagashima - * See LICENSE file in root directory for full license. - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var eventTargetShim = require('event-target-shim'); - -/** - * The signal class. - * @see https://dom.spec.whatwg.org/#abortsignal - */ -class AbortSignal extends eventTargetShim.EventTarget { - /** - * AbortSignal cannot be constructed directly. - */ - constructor() { - super(); - throw new TypeError("AbortSignal cannot be constructed directly"); - } - /** - * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise. - */ - get aborted() { - const aborted = abortedFlags.get(this); - if (typeof aborted !== "boolean") { - throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`); - } - return aborted; - } -} -eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort"); -/** - * Create an AbortSignal object. - */ -function createAbortSignal() { - const signal = Object.create(AbortSignal.prototype); - eventTargetShim.EventTarget.call(signal); - abortedFlags.set(signal, false); - return signal; -} -/** - * Abort a given signal. - */ -function abortSignal(signal) { - if (abortedFlags.get(signal) !== false) { - return; - } - abortedFlags.set(signal, true); - signal.dispatchEvent({ type: "abort" }); -} -/** - * Aborted flag for each instances. - */ -const abortedFlags = new WeakMap(); -// Properties should be enumerable. -Object.defineProperties(AbortSignal.prototype, { - aborted: { enumerable: true }, -}); -// `toString()` should return `"[object AbortSignal]"` -if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { - Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { - configurable: true, - value: "AbortSignal", - }); -} - -/** - * The AbortController. - * @see https://dom.spec.whatwg.org/#abortcontroller - */ -class AbortController { - /** - * Initialize this controller. - */ - constructor() { - signals.set(this, createAbortSignal()); - } - /** - * Returns the `AbortSignal` object associated with this object. - */ - get signal() { - return getSignal(this); - } - /** - * Abort and signal to any observers that the associated activity is to be aborted. - */ - abort() { - abortSignal(getSignal(this)); - } -} -/** - * Associated signals. - */ -const signals = new WeakMap(); -/** - * Get the associated signal of a given controller. - */ -function getSignal(controller) { - const signal = signals.get(controller); - if (signal == null) { - throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`); - } - return signal; -} -// Properties should be enumerable. -Object.defineProperties(AbortController.prototype, { - signal: { enumerable: true }, - abort: { enumerable: true }, -}); -if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { - Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { - configurable: true, - value: "AbortController", - }); -} - -exports.AbortController = AbortController; -exports.AbortSignal = AbortSignal; -exports.default = AbortController; - -module.exports = AbortController -module.exports.AbortController = module.exports["default"] = AbortController -module.exports.AbortSignal = AbortSignal -//# sourceMappingURL=abort-controller.js.map diff --git a/node_modules/abort-controller/dist/abort-controller.js.map b/node_modules/abort-controller/dist/abort-controller.js.map deleted file mode 100644 index cfdcafdc..00000000 --- a/node_modules/abort-controller/dist/abort-controller.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abort-controller.js","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["EventTarget","defineEventAttribute"],"mappings":";;;;;;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQA,2BAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,C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KAAK,EAAE,aAAa;KACvB,CAAC,CAAA;CACL;;ACpFD;;;;AAIA,MAAqB,eAAe;;;;IAIhC;QACI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;KACzC;;;;IAKD,IAAW,MAAM;QACb,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;KACzB;;;;IAKM,KAAK;QACR,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KAC/B;CACJ;;;;AAKD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAgC,CAAA;;;;AAK3D,SAAS,SAAS,CAAC,UAA2B;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,SAAS,CACf,8DACI,UAAU,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,UAC1C,EAAE,CACL,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;CAChB;;AAGD,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,SAAS,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5B,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA;AAEF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QACjE,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAA;CACL;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/abort-controller/dist/abort-controller.mjs b/node_modules/abort-controller/dist/abort-controller.mjs deleted file mode 100644 index 88ba22d5..00000000 --- a/node_modules/abort-controller/dist/abort-controller.mjs +++ /dev/null @@ -1,118 +0,0 @@ -/** - * @author Toru Nagashima - * See LICENSE file in root directory for full license. - */ -import { EventTarget, defineEventAttribute } from 'event-target-shim'; - -/** - * The signal class. - * @see https://dom.spec.whatwg.org/#abortsignal - */ -class AbortSignal extends EventTarget { - /** - * AbortSignal cannot be constructed directly. - */ - constructor() { - super(); - throw new TypeError("AbortSignal cannot be constructed directly"); - } - /** - * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise. - */ - get aborted() { - const aborted = abortedFlags.get(this); - if (typeof aborted !== "boolean") { - throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`); - } - return aborted; - } -} -defineEventAttribute(AbortSignal.prototype, "abort"); -/** - * Create an AbortSignal object. - */ -function createAbortSignal() { - const signal = Object.create(AbortSignal.prototype); - EventTarget.call(signal); - abortedFlags.set(signal, false); - return signal; -} -/** - * Abort a given signal. - */ -function abortSignal(signal) { - if (abortedFlags.get(signal) !== false) { - return; - } - abortedFlags.set(signal, true); - signal.dispatchEvent({ type: "abort" }); -} -/** - * Aborted flag for each instances. - */ -const abortedFlags = new WeakMap(); -// Properties should be enumerable. -Object.defineProperties(AbortSignal.prototype, { - aborted: { enumerable: true }, -}); -// `toString()` should return `"[object AbortSignal]"` -if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { - Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { - configurable: true, - value: "AbortSignal", - }); -} - -/** - * The AbortController. - * @see https://dom.spec.whatwg.org/#abortcontroller - */ -class AbortController { - /** - * Initialize this controller. - */ - constructor() { - signals.set(this, createAbortSignal()); - } - /** - * Returns the `AbortSignal` object associated with this object. - */ - get signal() { - return getSignal(this); - } - /** - * Abort and signal to any observers that the associated activity is to be aborted. - */ - abort() { - abortSignal(getSignal(this)); - } -} -/** - * Associated signals. - */ -const signals = new WeakMap(); -/** - * Get the associated signal of a given controller. - */ -function getSignal(controller) { - const signal = signals.get(controller); - if (signal == null) { - throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`); - } - return signal; -} -// Properties should be enumerable. -Object.defineProperties(AbortController.prototype, { - signal: { enumerable: true }, - abort: { enumerable: true }, -}); -if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { - Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { - configurable: true, - value: "AbortController", - }); -} - -export default AbortController; -export { AbortController, AbortSignal }; -//# sourceMappingURL=abort-controller.mjs.map diff --git a/node_modules/abort-controller/dist/abort-controller.mjs.map b/node_modules/abort-controller/dist/abort-controller.mjs.map deleted file mode 100644 index 1e8fa6b0..00000000 --- a/node_modules/abort-controller/dist/abort-controller.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abort-controller.mjs","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport {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abort-controller/dist/abort-controller.umd.js b/node_modules/abort-controller/dist/abort-controller.umd.js deleted file mode 100644 index f643cfd6..00000000 --- a/node_modules/abort-controller/dist/abort-controller.umd.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @author Toru Nagashima - * See LICENSE file in root directory for full license. - */(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.AbortControllerShim={}))})(this,function(a){'use strict';function b(a){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},b(a)}function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c,d=0;d\n * @copyright 2015 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\n/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap}\n * @private\n */\nconst privateData = new WeakMap();\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap}\n * @private\n */\nconst wrappers = new WeakMap();\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event);\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n );\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n );\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true;\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault();\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n });\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true });\n\n // Define accessors\n const keys = Object.keys(event);\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key));\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget;\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this);\n\n data.stopped = true;\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation();\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this);\n\n data.stopped = true;\n data.immediateStopped = true;\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation();\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this));\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this);\n\n data.stopped = true;\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true;\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this));\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n});\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype);\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event);\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value;\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event;\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto);\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event);\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n });\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n const isFunc = typeof descriptor.value === \"function\";\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n );\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto);\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);\n wrappers.set(proto, wrapper);\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nfunction wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event));\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nfunction isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nfunction setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase;\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nfunction setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget;\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nfunction setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener;\n}\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap>}\n * @private\n */\nconst listenersMap = new WeakMap();\n\n// Listener types\nconst CAPTURE = 1;\nconst BUBBLE = 2;\nconst ATTRIBUTE = 3;\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget);\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this);\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next;\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null; // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this);\n\n // Traverse to the tail while removing old value.\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n } else {\n prev = node;\n }\n\n node = node.next;\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n };\n if (prev === null) {\n listeners.set(eventName, newNode);\n } else {\n prev.next = newNode;\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n );\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this);\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n });\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map());\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length);\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i];\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this);\n const optionsIsObj = isObject(options);\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options);\n const listenerType = capture ? CAPTURE : BUBBLE;\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n };\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName);\n if (node === undefined) {\n listeners.set(eventName, newNode);\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null;\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node;\n node = node.next;\n }\n\n // Add it.\n prev.next = newNode;\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this);\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options);\n const listenerType = capture ? CAPTURE : BUBBLE;\n\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n return\n }\n\n prev = node;\n node = node.next;\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this);\n const eventName = event.type;\n let node = listeners.get(eventName);\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event);\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null;\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n } else {\n prev = node;\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n );\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent);\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err);\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent);\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next;\n }\n setPassiveListener(wrappedEvent, null);\n setEventPhase(wrappedEvent, 0);\n setCurrentTarget(wrappedEvent, null);\n\n return !wrappedEvent.defaultPrevented\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n});\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);\n}\n\nexport default EventTarget;\nexport { defineEventAttribute, EventTarget };\n//# sourceMappingURL=event-target-shim.mjs.map\n","import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["pd","event","retv","privateData","get","console","assert","setCancelFlag","data","passiveListener","cancelable","canceled","preventDefault","error","Event","eventTarget","set","eventPhase","currentTarget","stopped","immediateStopped","timeStamp","Date","now","Object","defineProperty","value","enumerable","key","keys","i","length","defineRedirectDescriptor","configurable","defineCallDescriptor","apply","arguments","defineWrapper","BaseEvent","proto","CustomEvent","call","prototype","create","constructor","writable","descriptor","getOwnPropertyDescriptor","isFunc","getWrapper","wrapper","wrappers","getPrototypeOf","wrapEvent","Wrapper","isStopped","setEventPhase","setCurrentTarget","setPassiveListener","createAbortSignal","signal","AbortSignal","EventTarget","abortedFlags","abortSignal","dispatchEvent","type","getSignal","controller","signals","TypeError","WeakMap","target","composedPath","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","stopPropagation","stopImmediatePropagation","bubbles","defaultPrevented","composed","srcElement","cancelBubble","returnValue","initEvent","window","setPrototypeOf","aborted","defineEventAttribute","defineProperties","Symbol","_typeof","toStringTag","AbortController","abort"],"mappings":";;;+3CAkCA,QAASA,CAAAA,CAAT,CAAYC,CAAZ,CAAmB,IACTC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CAAqE,CACjES,YAAY,GADqD,CAEjEP,KAAK,CAAE,iBAF0D,CAArEF"} \ No newline at end of file diff --git a/node_modules/abort-controller/package.json b/node_modules/abort-controller/package.json deleted file mode 100644 index 4b45c6d6..00000000 --- a/node_modules/abort-controller/package.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "_from": "abort-controller@^3.0.0", - "_id": "abort-controller@3.0.0", - "_inBundle": false, - "_integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "_location": "/abort-controller", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "abort-controller@^3.0.0", - "name": "abort-controller", - "escapedName": "abort-controller", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/gaxios" - ], - "_resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "_shasum": "eaf54d53b62bae4138e809ca225c8439a6efb392", - "_spec": "abort-controller@^3.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gaxios", - "author": { - "name": "Toru Nagashima", - "url": "https://github.com/mysticatea" - }, - "browser": "./browser.js", - "bugs": { - "url": "https://github.com/mysticatea/abort-controller/issues" - }, - "bundleDependencies": false, - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "deprecated": false, - "description": "An implementation of WHATWG AbortController interface.", - "devDependencies": { - "@babel/core": "^7.2.2", - "@babel/plugin-transform-modules-commonjs": "^7.2.0", - "@babel/preset-env": "^7.3.0", - "@babel/register": "^7.0.0", - "@mysticatea/eslint-plugin": "^8.0.1", - "@mysticatea/spy": "^0.1.2", - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.18", - "assert": "^1.4.1", - "codecov": "^3.1.0", - "dts-bundle-generator": "^2.0.0", - "eslint": "^5.12.1", - "karma": "^3.1.4", - "karma-chrome-launcher": "^2.2.0", - "karma-coverage": "^1.1.2", - "karma-firefox-launcher": "^1.1.0", - "karma-growl-reporter": "^1.0.0", - "karma-ie-launcher": "^1.0.0", - "karma-mocha": "^1.3.0", - "karma-rollup-preprocessor": "^7.0.0-rc.2", - "mocha": "^5.2.0", - "npm-run-all": "^4.1.5", - "nyc": "^13.1.0", - "opener": "^1.5.1", - "rimraf": "^2.6.3", - "rollup": "^1.1.2", - "rollup-plugin-babel": "^4.3.2", - "rollup-plugin-babel-minify": "^7.0.0", - "rollup-plugin-commonjs": "^9.2.0", - "rollup-plugin-node-resolve": "^4.0.0", - "rollup-plugin-sourcemaps": "^0.4.2", - "rollup-plugin-typescript": "^1.0.0", - "rollup-watch": "^4.3.1", - "ts-node": "^8.0.1", - "type-tester": "^1.0.0", - "typescript": "^3.2.4" - }, - "engines": { - "node": ">=6.5" - }, - "files": [ - "dist", - "polyfill.*", - "browser.*" - ], - "homepage": "https://github.com/mysticatea/abort-controller#readme", - "keywords": [ - "w3c", - "whatwg", - "event", - "events", - "abort", - "cancel", - "abortcontroller", - "abortsignal", - "controller", - "signal", - "shim" - ], - "license": "MIT", - "main": "dist/abort-controller", - "name": "abort-controller", - "repository": { - "type": "git", - "url": "git+https://github.com/mysticatea/abort-controller.git" - }, - "scripts": { - "build": "run-s -s build:*", - "build:dts": "dts-bundle-generator -o dist/abort-controller.d.ts src/abort-controller.ts && ts-node scripts/fix-dts", - "build:rollup": "rollup -c", - "clean": "rimraf .nyc_output coverage", - "codecov": "codecov", - "coverage": "opener coverage/lcov-report/index.html", - "lint": "eslint . --ext .ts", - "postversion": "git push && git push --tags", - "preversion": "npm test", - "test": "run-s -s lint test:*", - "test:karma": "karma start --single-run", - "test:mocha": "nyc mocha test/*.ts", - "version": "npm run -s build && git add dist/*", - "watch": "run-p -s watch:*", - "watch:karma": "karma start --watch", - "watch:mocha": "mocha test/*.ts --require ts-node/register --watch-extensions ts --watch --growl" - }, - "version": "3.0.0" -} diff --git a/node_modules/abort-controller/polyfill.js b/node_modules/abort-controller/polyfill.js deleted file mode 100644 index 3ca89233..00000000 --- a/node_modules/abort-controller/polyfill.js +++ /dev/null @@ -1,21 +0,0 @@ -/*globals require, self, window */ -"use strict" - -const ac = require("./dist/abort-controller") - -/*eslint-disable @mysticatea/prettier */ -const g = - typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - typeof global !== "undefined" ? global : - /* otherwise */ undefined -/*eslint-enable @mysticatea/prettier */ - -if (g) { - if (typeof g.AbortController === "undefined") { - g.AbortController = ac.AbortController - } - if (typeof g.AbortSignal === "undefined") { - g.AbortSignal = ac.AbortSignal - } -} diff --git a/node_modules/abort-controller/polyfill.mjs b/node_modules/abort-controller/polyfill.mjs deleted file mode 100644 index 0602a64d..00000000 --- a/node_modules/abort-controller/polyfill.mjs +++ /dev/null @@ -1,19 +0,0 @@ -/*globals self, window */ -import * as ac from "./dist/abort-controller" - -/*eslint-disable @mysticatea/prettier */ -const g = - typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - typeof global !== "undefined" ? global : - /* otherwise */ undefined -/*eslint-enable @mysticatea/prettier */ - -if (g) { - if (typeof g.AbortController === "undefined") { - g.AbortController = ac.AbortController - } - if (typeof g.AbortSignal === "undefined") { - g.AbortSignal = ac.AbortSignal - } -} diff --git a/node_modules/agent-base/README.md b/node_modules/agent-base/README.md deleted file mode 100644 index d791f000..00000000 --- a/node_modules/agent-base/README.md +++ /dev/null @@ -1,145 +0,0 @@ -agent-base -========== -### Turn a function into an [`http.Agent`][http.Agent] instance -[![Build Status](https://github.com/TooTallNate/node-agent-base/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI) - -This module provides an `http.Agent` generator. That is, you pass it an async -callback function, and it returns a new `http.Agent` instance that will invoke the -given callback function when sending outbound HTTP requests. - -#### Some subclasses: - -Here's some more interesting uses of `agent-base`. -Send a pull request to list yours! - - * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints - * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints - * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS - * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS (v4a) proxy `http.Agent` implementation for HTTP and HTTPS - - -Installation ------------- - -Install with `npm`: - -``` bash -$ npm install agent-base -``` - - -Example -------- - -Here's a minimal example that creates a new `net.Socket` connection to the server -for every HTTP request (i.e. the equivalent of `agent: false` option): - -```js -var net = require('net'); -var tls = require('tls'); -var url = require('url'); -var http = require('http'); -var agent = require('agent-base'); - -var endpoint = 'http://nodejs.org/api/'; -var parsed = url.parse(endpoint); - -// This is the important part! -parsed.agent = agent(function (req, opts) { - var socket; - // `secureEndpoint` is true when using the https module - if (opts.secureEndpoint) { - socket = tls.connect(opts); - } else { - socket = net.connect(opts); - } - return socket; -}); - -// Everything else works just like normal... -http.get(parsed, function (res) { - console.log('"response" event!', res.headers); - res.pipe(process.stdout); -}); -``` - -Returning a Promise or using an `async` function is also supported: - -```js -agent(async function (req, opts) { - await sleep(1000); - // etc… -}); -``` - -Return another `http.Agent` instance to "pass through" the responsibility -for that HTTP request to that agent: - -```js -agent(function (req, opts) { - return opts.secureEndpoint ? https.globalAgent : http.globalAgent; -}); -``` - - -API ---- - -## Agent(Function callback[, Object options]) → [http.Agent][] - -Creates a base `http.Agent` that will execute the callback function `callback` -for every HTTP request that it is used as the `agent` for. The callback function -is responsible for creating a `stream.Duplex` instance of some kind that will be -used as the underlying socket in the HTTP request. - -The `options` object accepts the following properties: - - * `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional). - -The callback function should have the following signature: - -### callback(http.ClientRequest req, Object options, Function cb) → undefined - -The ClientRequest `req` can be accessed to read request headers and -and the path, etc. The `options` object contains the options passed -to the `http.request()`/`https.request()` function call, and is formatted -to be directly passed to `net.connect()`/`tls.connect()`, or however -else you want a Socket to be created. Pass the created socket to -the callback function `cb` once created, and the HTTP request will -continue to proceed. - -If the `https` module is used to invoke the HTTP request, then the -`secureEndpoint` property on `options` _will be set to `true`_. - - -License -------- - -(The MIT License) - -Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> - -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. - -[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent -[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent -[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent -[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent -[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent diff --git a/node_modules/agent-base/dist/src/index.d.ts b/node_modules/agent-base/dist/src/index.d.ts deleted file mode 100644 index 28fb567a..00000000 --- a/node_modules/agent-base/dist/src/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/// -import net from 'net'; -import http from 'http'; -import { EventEmitter } from 'events'; -declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent; -declare namespace createAgent { - var prototype: Agent; -} -declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent; -declare namespace createAgent { - var prototype: Agent; -} -declare namespace createAgent { - type ClientRequest = http.ClientRequest & { - _last?: boolean; - _hadError?: boolean; - method: string; - }; - type AgentCallbackReturn = net.Socket | createAgent.Agent | http.Agent; - type AgentCallbackCallback = (err: Error | null | undefined, socket: createAgent.AgentCallbackReturn) => void; - type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise; - type AgentCallback = typeof Agent.prototype.callback; - type AgentOptions = http.AgentOptions & {}; - type RequestOptions = http.RequestOptions & { - port: number; - secureEndpoint: boolean; - }; - /** - * Base `http.Agent` implementation. - * No pooling/keep-alive is implemented by default. - * - * @param {Function} callback - * @api public - */ - class Agent extends EventEmitter { - timeout: number | null; - options?: createAgent.AgentOptions; - maxFreeSockets: number; - maxSockets: number; - sockets: net.Socket[]; - requests: http.ClientRequest[]; - private promisifiedCallback?; - private explicitDefaultPort?; - private explicitProtocol?; - constructor(callback?: createAgent.AgentCallback | createAgent.AgentOptions, _opts?: createAgent.AgentOptions); - get defaultPort(): number; - set defaultPort(v: number); - get protocol(): string; - set protocol(v: string); - callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions, fn: createAgent.AgentCallbackCallback): void; - callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions): createAgent.AgentCallbackReturn | Promise; - /** - * Called by node-core's "_http_client.js" module when creating - * a new HTTP request with this Agent instance. - * - * @api public - */ - addRequest(req: ClientRequest, _opts: RequestOptions): void; - freeSocket(socket: net.Socket, opts: AgentOptions): void; - destroy(): void; - } -} -export = createAgent; diff --git a/node_modules/agent-base/dist/src/index.js b/node_modules/agent-base/dist/src/index.js deleted file mode 100644 index 788decac..00000000 --- a/node_modules/agent-base/dist/src/index.js +++ /dev/null @@ -1,206 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const events_1 = require("events"); -const promisify_1 = __importDefault(require("./promisify")); -function isAgentBase(v) { - return Boolean(v) && typeof v.addRequest === 'function'; -} -function isHttpAgent(v) { - return Boolean(v) && typeof v.addRequest === 'function'; -} -function isSecureEndpoint() { - const { stack } = new Error(); - if (typeof stack !== 'string') - return false; - return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1); -} -function createAgent(callback, opts) { - return new createAgent.Agent(callback, opts); -} -(function (createAgent) { - /** - * Base `http.Agent` implementation. - * No pooling/keep-alive is implemented by default. - * - * @param {Function} callback - * @api public - */ - class Agent extends events_1.EventEmitter { - constructor(callback, _opts) { - super(); - // The callback gets promisified lazily - this.promisifiedCallback = undefined; - let opts = _opts; - if (typeof callback === 'function') { - this.callback = callback; - } - else if (callback) { - opts = callback; - } - // timeout for the socket to be returned from the callback - this.timeout = null; - if (opts && typeof opts.timeout === 'number') { - this.timeout = opts.timeout; - } - this.options = opts || {}; - this.maxFreeSockets = 1; - this.maxSockets = 1; - this.sockets = []; - this.requests = []; - } - get defaultPort() { - if (typeof this.explicitDefaultPort === 'number') { - return this.explicitDefaultPort; - } - else { - return isSecureEndpoint() ? 443 : 80; - } - } - set defaultPort(v) { - this.explicitDefaultPort = v; - } - get protocol() { - if (typeof this.explicitProtocol === 'string') { - return this.explicitProtocol; - } - else { - return isSecureEndpoint() ? 'https:' : 'http:'; - } - } - set protocol(v) { - this.explicitProtocol = v; - } - callback(req, opts, fn) { - throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`'); - } - /** - * Called by node-core's "_http_client.js" module when creating - * a new HTTP request with this Agent instance. - * - * @api public - */ - addRequest(req, _opts) { - const ownOpts = Object.assign({}, _opts); - if (typeof ownOpts.secureEndpoint !== 'boolean') { - ownOpts.secureEndpoint = isSecureEndpoint(); - } - // Set default `host` for HTTP to localhost - if (ownOpts.host == null) { - ownOpts.host = 'localhost'; - } - // Set default `port` for HTTP if none was explicitly specified - if (ownOpts.port == null) { - ownOpts.port = ownOpts.secureEndpoint ? 443 : 80; - } - const opts = Object.assign(Object.assign({}, this.options), ownOpts); - if (opts.host && opts.path) { - // If both a `host` and `path` are specified then it's most likely the - // result of a `url.parse()` call... we need to remove the `path` portion so - // that `net.connect()` doesn't attempt to open that as a unix socket file. - delete opts.path; - } - delete opts.agent; - delete opts.hostname; - delete opts._defaultAgent; - delete opts.defaultPort; - delete opts.createConnection; - // Hint to use "Connection: close" - // XXX: non-documented `http` module API :( - req._last = true; - req.shouldKeepAlive = false; - // Create the `stream.Duplex` instance - let timedOut = false; - let timeout = null; - const timeoutMs = this.timeout; - const freeSocket = this.freeSocket; - function onerror(err) { - if (req._hadError) - return; - req.emit('error', err); - // For Safety. Some additional errors might fire later on - // and we need to make sure we don't double-fire the error event. - req._hadError = true; - } - function ontimeout() { - timeout = null; - timedOut = true; - const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`); - err.code = 'ETIMEOUT'; - onerror(err); - } - function callbackError(err) { - if (timedOut) - return; - if (timeout !== null) { - clearTimeout(timeout); - timeout = null; - } - onerror(err); - } - function onsocket(socket) { - let sock; - function onfree() { - freeSocket(sock, opts); - } - if (timedOut) - return; - if (timeout != null) { - clearTimeout(timeout); - timeout = null; - } - if (isAgentBase(socket) || isHttpAgent(socket)) { - // `socket` is actually an `http.Agent` instance, so - // relinquish responsibility for this `req` to the Agent - // from here on - socket.addRequest(req, opts); - return; - } - if (socket) { - sock = socket; - sock.on('free', onfree); - req.onSocket(sock); - return; - } - const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``); - onerror(err); - } - if (typeof this.callback !== 'function') { - onerror(new Error('`callback` is not defined')); - return; - } - if (!this.promisifiedCallback) { - if (this.callback.length >= 3) { - // Legacy callback function - convert to a Promise - this.promisifiedCallback = promisify_1.default(this.callback); - } - else { - this.promisifiedCallback = this.callback; - } - } - if (typeof timeoutMs === 'number' && timeoutMs > 0) { - timeout = setTimeout(ontimeout, timeoutMs); - } - if ('port' in opts && typeof opts.port !== 'number') { - opts.port = Number(opts.port); - } - try { - Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError); - } - catch (err) { - Promise.reject(err).catch(callbackError); - } - } - freeSocket(socket, opts) { - // TODO reuse sockets - socket.destroy(); - } - destroy() { } - } - createAgent.Agent = Agent; -})(createAgent || (createAgent = {})); -// So that `instanceof` works correctly -createAgent.prototype = createAgent.Agent.prototype; -module.exports = createAgent; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/agent-base/dist/src/index.js.map b/node_modules/agent-base/dist/src/index.js.map deleted file mode 100644 index 64065f66..00000000 --- a/node_modules/agent-base/dist/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAEA,mCAAsC;AACtC,4DAAoC;AAEpC,SAAS,WAAW,CAAC,CAAM;IAC1B,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAAC,CAAM;IAC1B,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAOD,SAAS,WAAW,CACnB,QAA+D,EAC/D,IAA+B;IAE/B,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,WA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AI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC9B;YAED,IAAI;gBACH,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CACxD,QAAQ,EACR,aAAa,CACb,CAAC;aACF;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;aACzC;QACF,CAAC;QAED,UAAU,CAAC,MAAkB,EAAE,IAAkB;YAChD,qBAAqB;YACrB,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;QAED,OAAO,KAAI,CAAC;KACZ;IA7OY,iBAAK,QA6OjB,CAAA;AACF,CAAC,EAxRS,WAAW,KAAX,WAAW,QAwRpB;AAED,uCAAuC;AACvC,WAAW,CAAC,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;AAEpD,iBAAS,WAAW,CAAC"} \ No newline at end of file diff --git a/node_modules/agent-base/dist/src/promisify.d.ts b/node_modules/agent-base/dist/src/promisify.d.ts deleted file mode 100644 index 02688696..00000000 --- a/node_modules/agent-base/dist/src/promisify.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ClientRequest, RequestOptions, AgentCallbackCallback, AgentCallbackPromise } from './index'; -declare type LegacyCallback = (req: ClientRequest, opts: RequestOptions, fn: AgentCallbackCallback) => void; -export default function promisify(fn: LegacyCallback): AgentCallbackPromise; -export {}; diff --git a/node_modules/agent-base/dist/src/promisify.js b/node_modules/agent-base/dist/src/promisify.js deleted file mode 100644 index b2f6132a..00000000 --- a/node_modules/agent-base/dist/src/promisify.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function promisify(fn) { - return function (req, opts) { - return new Promise((resolve, reject) => { - fn.call(this, req, opts, (err, rtn) => { - if (err) { - reject(err); - } - else { - resolve(rtn); - } - }); - }); - }; -} -exports.default = promisify; -//# sourceMappingURL=promisify.js.map \ No newline at end of file diff --git a/node_modules/agent-base/dist/src/promisify.js.map b/node_modules/agent-base/dist/src/promisify.js.map deleted file mode 100644 index cff52898..00000000 --- a/node_modules/agent-base/dist/src/promisify.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAwB,EAAE,EAAE;gBAC3D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"} \ No newline at end of file diff --git a/node_modules/agent-base/package.json b/node_modules/agent-base/package.json deleted file mode 100644 index ecc70dcc..00000000 --- a/node_modules/agent-base/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_from": "agent-base@5", - "_id": "agent-base@5.1.1", - "_inBundle": false, - "_integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", - "_location": "/agent-base", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "agent-base@5", - "name": "agent-base", - "escapedName": "agent-base", - "rawSpec": "5", - "saveSpec": null, - "fetchSpec": "5" - }, - "_requiredBy": [ - "/https-proxy-agent" - ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "_shasum": "e8fb3f242959db44d63be665db7a8e739537a32c", - "_spec": "agent-base@5", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/https-proxy-agent", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "bugs": { - "url": "https://github.com/TooTallNate/node-agent-base/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Turn a function into an `http.Agent` instance", - "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^10.5.3", - "@types/ws": "^6.0.3", - "@typescript-eslint/eslint-plugin": "1.6.0", - "@typescript-eslint/parser": "1.1.0", - "async-listen": "^1.2.0", - "cpy-cli": "^2.0.0", - "eslint": "5.16.0", - "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "4.1.0", - "eslint-import-resolver-typescript": "1.1.1", - "eslint-plugin-import": "2.16.0", - "eslint-plugin-jsx-a11y": "6.2.1", - "eslint-plugin-react": "7.12.4", - "mocha": "^6.2.0", - "rimraf": "^3.0.0", - "typescript": "^3.5.3", - "ws": "^3.0.0" - }, - "engines": { - "node": ">= 6.0.0" - }, - "files": [ - "dist/src" - ], - "homepage": "https://github.com/TooTallNate/node-agent-base#readme", - "keywords": [ - "http", - "agent", - "base", - "barebones", - "https" - ], - "license": "MIT", - "main": "dist/src/index", - "name": "agent-base", - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-agent-base.git" - }, - "scripts": { - "build": "tsc", - "postbuild": "cpy --parents src test '!**/*.ts' dist", - "prebuild": "rimraf dist", - "prepublishOnly": "npm run build", - "test": "mocha --reporter spec dist/test/*.js", - "test-lint": "eslint src --ext .js,.ts" - }, - "typings": "dist/src/index", - "version": "5.1.1" -} diff --git a/node_modules/apollo-cache-inmemory/CHANGELOG.md b/node_modules/apollo-cache-inmemory/CHANGELOG.md deleted file mode 100644 index 47c77f14..00000000 --- a/node_modules/apollo-cache-inmemory/CHANGELOG.md +++ /dev/null @@ -1,153 +0,0 @@ -# CHANGELOG - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md). - ----- - -### 1.3.0 - -- Optimize repeated `apollo-cache-inmemory` reads by caching partial query - results. As a consequence, watched queries will not be rebroadcast unless the - data have changed. - [PR #3394](https://github.com/apollographql/apollo-client/pull/3394) - -### 1.2.5 - -- No changes. - -### 1.2.4 - -- No changes. - -### 1.2.3 - -- Added optional generics to cache manipulation methods (typescript). - [PR #3541](https://github.com/apollographql/apollo-client/pull/3541) -- Restore non-enumerability of `resultFields[ID_KEY]`. - [PR #3544](https://github.com/apollographql/apollo-client/pull/3544) -- Cache query documents transformed by InMemoryCache. - [PR #3553](https://github.com/apollographql/apollo-client/pull/3553) - -### 1.2.2 - -- Fixed an issue that caused fragment only queries to sometimes fail. - [Issue #3402](https://github.com/apollographql/apollo-client/issues/3402) - [PR #3507](https://github.com/apollographql/apollo-client/pull/3507) -- Fixed cache invalidation for inlined mixed types in union fields within - arrays. - [PR #3422](https://github.com/apollographql/apollo-client/pull/3422) - -### 1.2.1 - -- Not documented - -### vNEXT -- Optimize repeated `apollo-cache-inmemory` reads by caching partial query results - [#3394](https://github.com/apollographql/apollo-client/pull/3394) - -### 1.2.0 - -- Various optimizations for cache read performance - [PR #3300](https://github.com/apollographql/apollo-client/pull/3300) -- Fix typo in documentation - -### 1.1.12 - -- Fix an edge case where fields that were unions of two types, one with an - `id`, one without an `id`, would cause the cache to throw while saving the - result - [PR #3159](https://github.com/apollographql/apollo-client/pull/3159) -- Map coverage to original source -- Fixed bug with cacheRedirects not getting attached - [PR #3016](https://github.com/apollographql/apollo-client/pull/3016) - -### 1.1.9 - -- Added `getCacheKey` function to cacheResolver context - [PR #2998](https://github.com/apollographql/apollo-client/pull/2998) -- Changed `cacheResolvers` to `cacheRedirects`, added deprecation warning - [PR #3001](https://github.com/apollographql/apollo-client/pull/3001) - -### 1.1.8 - -- Dependency updates -- Fix IntrospectionResultData type definition - [Issue #2959](https://github.com/apollographql/apollo-client/issues/2959) - -### 1.1.7 - -- Update to latest apollo-utilities to support directives in cache - -### 1.1.6 (unpublished) - -- Update to latest apollo-utilities - -### 1.1.5 - -- Update to latest apollo-cache base - [PR #2818](https://github.com/apollographql/apollo-client/pull/2818) - -### 1.1.4 - -- Change access modifier for data from "private" to "protected", to allow - InMemoryCache subclasses to access it. - -### 1.1.3 - -- Improves performance of in memory cache - -### 1.1.2 - -- Ensure that heuristics warnings do not fire in production - [PR #2611](https://github.com/apollographql/apollo-client/pull/2611) - -### 1.1.1 - -- Change some access modifiers "private" to "protected" to allow code reuse by - InMemoryCache subclasses. -- Improved rollup builds - -### 1.1.0 - -- Improve errors for id mismatch when writing to the store -- Make it possible to swap the cache implementation. For example, you might - want to use a `Map` to store the normalized objects, which can be faster - than writing by keys to an `Object`. This also allows for custom use cases, - such as emitting events on `.set()` or `.delete()` (think Observables), - which was otherwise impossible without the use of Proxies, that are only - available in some browsers. Unless you passed in the `store` to one of the - `apollo-cache-inmemory` functions, such as: `writeQueryToStore` or - `writeResultToStore`, no changes to your code are necessary. If you did - access the cache's functions directly, all you need to do is add a - `.toObject()` call on the cache — review the changes to the tests for [an example](https://github.com/apollographql/apollo-client/blob/cd563bcd1c2c15b973d0cdfd63332f5ee82da309/packages/apollo-cache-inmemory/src/__tests__/writeToStore.ts#L258). - For reasoning behind this change and more information, see - [Issue #2293](https://github.com/apollographql/apollo-client/issues/2293). - -### 1.0.0 - -- Don't broadcast query watchers during a transaction (for example, while - mutation results are being processed) - [Issue #2221](https://github.com/apollographql/apollo-client/issues/2221) - [PR #2358](https://github.com/apollographql/apollo-client/pull/2358) -- `readQuery` and `readFragment` return now the result instead of - `Cache.DiffResult` - [PR #2320](https://github.com/apollographql/apollo-client/pull/2320) - -### 0.2.0-rc.1 - -- Move to named export to be consistent with rest of apollo ecosystem - -### 0.2.0-beta.6 - -- Rename customResolvers to cacheResolvers with backwards compat - -### 0.2.0-beta.5 and lower - -- Fix error when missing __typename field in result - [PR #2225](https://github.com/apollographql/apollo-client/pull/2225) -- Refactored type usage -- Prevented logging on defered queries -- Refactored internal store from apollo-client into own package diff --git a/node_modules/apollo-cache-inmemory/LICENSE b/node_modules/apollo-cache-inmemory/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-cache-inmemory/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-cache-inmemory/README.md b/node_modules/apollo-cache-inmemory/README.md deleted file mode 100644 index f0ed8517..00000000 --- a/node_modules/apollo-cache-inmemory/README.md +++ /dev/null @@ -1,321 +0,0 @@ ---- -title: InMemoryCache -description: An explanation of `apollo-cache-inmemory` ---- - -`apollo-cache-inmemory` is the recommended cache implementation for Apollo Client 2.0. `InMemoryCache` is a normalized data store that supports all of Apollo Client 1.0's features without the dependency on Redux. - -In some instances, you may need to manipulate the cache directly, such as updating the store after a mutation. We'll cover some common use cases [here](#recipes). - -

Installation

- -``` -npm install apollo-cache-inmemory --save -``` - -After installing the package, you'll want to initialize the cache constructor. Then, you can pass in your newly created cache to ApolloClient. - -```js -import { InMemoryCache } from 'apollo-cache-inmemory'; -import { HttpLink } from 'apollo-link-http'; -import ApolloClient from 'apollo-client'; - -const cache = new InMemoryCache(); - -const client = new ApolloClient({ - link: new HttpLink(), - cache -}); -``` - -

Configuration

- -The `InMemoryCache` constructor takes an optional config object with properties to customize your cache: - -- addTypename: A boolean to determine whether to add __typename to the document (default: `true`) -- dataIdFromObject: A function that takes a data object and returns a unique identifier to be used when normalizing the data in the store. Learn more about how to customize `dataIdFromObject` in the [Normalization](#normalization) section. -- fragmentMatcher: By default, the `InMemoryCache` uses a heuristic fragment matcher. If you are using fragments on unions and interfaces, you will need to use an `IntrospectionFragmentMatcher`. For more information, please read [our guide to setting up fragment matching for unions & interfaces](https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher). - -

Normalization

- -The `InMemoryCache` normalizes your data before saving it to the store by splitting the result into individual objects, creating a unique identifier for each object, and storing those objects in a flattened data structure. By default, `InMemoryCache` will attempt to use the commonly found primary keys of `id` and `_id` for the unique identifier if they exist along with `__typename` on an object. - -If `id` and `_id` are not specified, or if `__typename` is not specified, `InMemoryCache` will fall back to the path to the object in the query, such as `ROOT_QUERY.allPeople.0` for the first record returned on the `allPeople` root query. - -This "getter" behavior for unique identifiers can be configured manually via the `dataIdFromObject` option passed to the `InMemoryCache` constructor, so you can pick which field is used if some of your data follows unorthodox primary key conventions. - -For example, if you wanted to key off of the `key` field for all of your data, you could configure `dataIdFromObject` like so: - -```js -const cache = new InMemoryCache({ - dataIdFromObject: object => object.key -}); -``` - -This also allows you to use different unique identifiers for different data types by keying off of the `__typename` property attached to every object typed by GraphQL. For example: - -```js -const cache = new InMemoryCache({ - dataIdFromObject: object => { - switch (object.__typename) { - case 'foo': return object.key; // use `key` as the primary key - case 'bar': return object.blah; // use `blah` as the priamry key - default: return object.id || object._id; // fall back to `id` and `_id` for all other types - } - } -}); -``` - -

Direct Cache Access

- -To interact directly with your cache, you can use the Apollo Client class methods readQuery, readFragment, writeQuery, and writeFragment. These methods are available to us via the [`DataProxy` interface](https://github.com/apollographql/apollo-client/blob/master/packages/apollo-cache/src/types/DataProxy.ts). Accessing these methods will vary slightly based on your view layer implementation. If you are using React, you can wrap your component in the `withApollo` higher order component, which will give you access to `this.props.client`. From there, you can use the methods to control your data. - -Any code demonstration in the following sections will assume that we have already initialized an instance of `ApolloClient` and that we have imported the `gql` tag from `graphql-tag`. - -

readQuery

- -The `readQuery` method is very similar to the [`query` method on `ApolloClient`][] except that `readQuery` will _never_ make a request to your GraphQL server. The `query` method, on the other hand, may send a request to your server if the appropriate data is not in your cache whereas `readQuery` will throw an error if the data is not in your cache. `readQuery` will _always_ read from the cache. You can use `readQuery` by giving it a GraphQL query like so: - -```js -const { todo } = client.readQuery({ - query: gql` - query ReadTodo { - todo(id: 5) { - id - text - completed - } - } - `, -}); -``` - -If all of the data needed to fulfill this read is in Apollo Client’s normalized data cache then a data object will be returned in the shape of the query you wanted to read. If not all of the data needed to fulfill this read is in Apollo Client’s cache then an error will be thrown instead, so make sure to only read data that you know you have! - -You can also pass variables into `readQuery`. - -```js -const { todo } = client.readQuery({ - query: gql` - query ReadTodo($id: Int!) { - todo(id: $id) { - id - text - completed - } - } - `, - variables: { - id: 5, - }, -}); -``` - -

readFragment

- -This method allows you great flexibility around the data in your cache. Whereas `readQuery` only allowed you to read data from your root query type, `readFragment` allows you to read data from _any node you have queried_. This is incredibly powerful. You use this method as follows: - -```js -const todo = client.readFragment({ - id: ..., // `id` is any id that could be returned by `dataIdFromObject`. - fragment: gql` - fragment myTodo on Todo { - id - text - completed - } - `, -}); -``` - -The first argument is the id of the data you want to read from the cache. That id must be a value that was returned by the `dataIdFromObject` function you defined when initializing `ApolloClient`. So for example if you initialized `ApolloClient` like so: - -```js -const client = new ApolloClient({ - ..., - dataIdFromObject: object => object.id, -}); -``` - -…and you requested a todo before with an id of `5`, then you can read that todo out of your cache with the following: - -```js -const todo = client.readFragment({ - id: '5', - fragment: gql` - fragment myTodo on Todo { - id - text - completed - } - `, -}); -``` - -> **Note:** Most people add a `__typename` to the id in `dataIdFromObject`. If you do this then don’t forget to add the `__typename` when you are reading a fragment as well. So for example your id may be `Todo_5` and not just `5`. - -If a todo with that id does not exist in the cache you will get `null` back. If a todo of that id does exist in the cache, but that todo does not have the `text` field then an error will be thrown. - -The beauty of `readFragment` is that the todo could have come from anywhere! The todo could have been selected as a singleton (`{ todo(id: 5) { ... } }`), the todo could have come from a list of todos (`{ todos { ... } }`), or the todo could have come from a mutation (`mutation { createTodo { ... } }`). As long as at some point your GraphQL server gave you a todo with the provided id and fields `id`, `text`, and `completed` you can read it from the cache at any part of your code. - -

writeQuery` and `writeFragment

- -Not only can you read arbitrary data from the Apollo Client cache, but you can also write any data that you would like to the cache. The methods you use to do this are `writeQuery` and `writeFragment`. They will allow you to change data in your local cache, but it is important to remember that *they will not change any data on your server*. If you reload your environment then changes made with `writeQuery` and `writeFragment` will disappear. - -These methods have the same signature as their `readQuery` and `readFragment` counterparts except they also require an additional `data` variable. So for example, if you wanted to update the `completed` flag locally for your todo with id `'5'` you could execute the following: - -```js -client.writeFragment({ - id: '5', - fragment: gql` - fragment myTodo on Todo { - completed - } - `, - data: { - completed: true, - }, -}); -``` - -Any subscriber to the Apollo Client store will instantly see this update and render new UI accordingly. - -> **Note:** Again, remember that using `writeQuery` or `writeFragment` only changes data *locally*. If you reload your environment then changes made with these methods will no longer exist. - -Or if you wanted to add a new todo to a list fetched from the server, you could use `readQuery` and `writeQuery` together. - -```js -const query = gql` - query MyTodoAppQuery { - todos { - id - text - completed - } - } -`; - -const data = client.readQuery({ query }); - -const myNewTodo = { - id: '6', - text: 'Start using Apollo Client.', - completed: false, -}; - -client.writeQuery({ - query, - data: { - todos: [...data.todos, myNewTodo], - }, -}); -``` - -

Recipes

- -Here are some common situations where you would need to access the cache directly. If you're manipulating the cache in an interesting way and would like your example to be featured, please send in a pull request! - -

Server side rendering

- -First, you will need to initialize an `InMemoryCache` on the server and create an instance of `ApolloClient`. In the initial serialized HTML payload from the server, you should include a script tag that extracts the data from the cache. - -```js -`` -``` - -On the client, you can rehydrate the cache using the initial data passed from the server: - -```js -cache: new Cache().restore(window.__APOLLO_STATE__) -``` - -If you would like to learn more about server side rendering, please check our our more in depth guide [here]. - - -

Updating the cache after a mutation

- -Being able to read and write to the Apollo cache from anywhere in your application gives you a lot of power over your data. However, there is one place where we most often want to update our cached data: after a mutation. As such, Apollo Client has optimized the experience for updating your cache with the read and write methods after a mutation with the `update` function. Let us say that we have the following GraphQL mutation: - -```graphql -mutation TodoCreateMutation($text: String!) { - createTodo(text: $text) { - id - text - completed - } -} -``` - -We may also have the following GraphQL query: - -```graphql -query TodoAppQuery { - todos { - id - text - completed - } -} -``` - -At the end of our mutation we want our query to include the new todo like we had sent our `TodoAppQuery` a second time after the mutation finished without actually sending the query. To do this we can use the `update` function provided as an option of the `client.mutate` method. To update your cache with the mutation just write code that looks like: - -```js -// We assume that the GraphQL operations `TodoCreateMutation` and -// `TodoAppQuery` have already been defined using the `gql` tag. - -const text = 'Hello, world!'; - -client.mutate({ - mutation: TodoCreateMutation, - variables: { - text, - }, - update: (proxy, { data: { createTodo } }) => { - // Read the data from our cache for this query. - const data = proxy.readQuery({ query: TodoAppQuery }); - - // Add our todo from the mutation to the end. - data.todos.push(createTodo); - - // Write our data back to the cache. - proxy.writeQuery({ query: TodoAppQuery, data }); - }, -}); -``` - -The first `proxy` argument is an instance of [`DataProxy`][] has the same four methods that we just learned exist on the Apollo Client: `readQuery`, `readFragment`, `writeQuery`, and `writeFragment`. The reason we call them on a `proxy` object here instead of on our `client` instance is that we can easily apply optimistic updates (which we will demonstrate in a bit). The `proxy` object also provides an isolated transaction which shields you from any other mutations going on at the same time, and the `proxy` object also batches writes together until the very end. - -If you provide an `optimisticResponse` option to the mutation then the `update` function will be run twice. Once immediately after you call `client.mutate` with the data from `optimisticResponse`. After the mutation successfully executes against the server the changes made in the first call to `update` will be rolled back and `update` will be called with the *actual* data returned by the mutation and not just the optimistic response. - -Putting it all together: - -```js -const text = 'Hello, world!'; - -client.mutate({ - mutation: TodoCreateMutation, - variables: { - text, - }, - optimisticResponse: { - id: -1, // -1 is a temporary id for the optimistic response. - text, - completed: false, - }, - update: (proxy, { data: { createTodo } }) => { - const data = proxy.readQuery({ query: TodoAppQuery }); - data.todos.push(createTodo); - proxy.writeQuery({ query: TodoAppQuery, data }); - }, -}); -``` - -As you can see the `update` function on `client.mutate` provides extra change management functionality specific to the use case of a mutation while still providing you the powerful data control APIs that are available on `client`. - -The `update` function is not a good place for side-effects as it may be called multiple times. Also, you may not call any of the methods on `proxy` asynchronously. - diff --git a/node_modules/apollo-cache-inmemory/jest.config.js b/node_modules/apollo-cache-inmemory/jest.config.js deleted file mode 100644 index 48f0a891..00000000 --- a/node_modules/apollo-cache-inmemory/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require('../../config/jest.config.settings'), -}; diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/cache.d.ts deleted file mode 100644 index 15fddf7f..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=cache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/cache.d.ts.map deleted file mode 100644 index 5e7ef9ad..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/__tests__/cache.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.js b/node_modules/apollo-cache-inmemory/lib/__tests__/cache.js deleted file mode 100644 index fa91d39d..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.js +++ /dev/null @@ -1,627 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var graphql_tag_1 = tslib_1.__importStar(require("graphql-tag")); -var apollo_utilities_1 = require("apollo-utilities"); -var lodash_1 = require("lodash"); -var __1 = require(".."); -graphql_tag_1.disableFragmentWarnings(); -describe('Cache', function () { - function itWithInitialData(message, initialDataForCaches, callback) { - var cachesList = [ - initialDataForCaches.map(function (data) { - return new __1.InMemoryCache({ - addTypename: false, - }).restore(lodash_1.cloneDeep(data)); - }), - initialDataForCaches.map(function (data) { - return new __1.InMemoryCache({ - addTypename: false, - resultCaching: false, - }).restore(lodash_1.cloneDeep(data)); - }), - initialDataForCaches.map(function (data) { - return new __1.InMemoryCache({ - addTypename: false, - freezeResults: true, - }).restore(lodash_1.cloneDeep(data)); - }), - ]; - cachesList.forEach(function (caches, i) { - it(message + (" (" + (i + 1) + "/" + cachesList.length + ")"), function () { - return callback.apply(void 0, caches); - }); - }); - } - function itWithCacheConfig(message, config, callback) { - var caches = [ - new __1.InMemoryCache(tslib_1.__assign(tslib_1.__assign({ addTypename: false }, config), { resultCaching: true })), - new __1.InMemoryCache(tslib_1.__assign(tslib_1.__assign({ addTypename: false }, config), { resultCaching: false })), - new __1.InMemoryCache(tslib_1.__assign(tslib_1.__assign({ addTypename: false }, config), { freezeResults: true })), - ]; - caches.forEach(function (cache, i) { - it(message + (" (" + (i + 1) + "/" + caches.length + ")"), function () { return callback(cache); }); - }); - } - describe('readQuery', function () { - itWithInitialData('will read some data from the store', [ - { - ROOT_QUERY: { - a: 1, - b: 2, - c: 3, - }, - }, - ], function (proxy) { - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n {\n a\n }\n "], ["\n {\n a\n }\n "]))), - }))).toEqual({ a: 1 }); - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n {\n b\n c\n }\n "], ["\n {\n b\n c\n }\n "]))), - }))).toEqual({ b: 2, c: 3 }); - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n {\n a\n b\n c\n }\n "], ["\n {\n a\n b\n c\n }\n "]))), - }))).toEqual({ a: 1, b: 2, c: 3 }); - }); - itWithInitialData('will read some deeply nested data from the store', [ - { - ROOT_QUERY: { - a: 1, - b: 2, - c: 3, - d: { - type: 'id', - id: 'foo', - generated: false, - }, - }, - foo: { - e: 4, - f: 5, - g: 6, - h: { - type: 'id', - id: 'bar', - generated: false, - }, - }, - bar: { - i: 7, - j: 8, - k: 9, - }, - }, - ], function (proxy) { - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n {\n a\n d {\n e\n }\n }\n "], ["\n {\n a\n d {\n e\n }\n }\n "]))), - }))).toEqual({ a: 1, d: { e: 4 } }); - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n {\n a\n d {\n e\n h {\n i\n }\n }\n }\n "], ["\n {\n a\n d {\n e\n h {\n i\n }\n }\n }\n "]))), - }))).toEqual({ a: 1, d: { e: 4, h: { i: 7 } } }); - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n {\n a\n b\n c\n d {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n }\n "], ["\n {\n a\n b\n c\n d {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n }\n "]))), - }))).toEqual({ - a: 1, - b: 2, - c: 3, - d: { e: 4, f: 5, g: 6, h: { i: 7, j: 8, k: 9 } }, - }); - }); - itWithInitialData('will read some data from the store with variables', [ - { - ROOT_QUERY: { - 'field({"literal":true,"value":42})': 1, - 'field({"literal":false,"value":42})': 2, - }, - }, - ], function (proxy) { - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "], ["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "]))), - variables: { - literal: false, - value: 42, - }, - }))).toEqual({ a: 1, b: 2 }); - }); - itWithInitialData('will read some data from the store with null variables', [ - { - ROOT_QUERY: { - 'field({"literal":false,"value":null})': 1, - }, - }, - ], function (proxy) { - expect(apollo_utilities_1.stripSymbols(proxy.readQuery({ - query: graphql_tag_1.default(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n query($literal: Boolean, $value: Int) {\n a: field(literal: $literal, value: $value)\n }\n "], ["\n query($literal: Boolean, $value: Int) {\n a: field(literal: $literal, value: $value)\n }\n "]))), - variables: { - literal: false, - value: null, - }, - }))).toEqual({ a: 1 }); - }); - itWithInitialData('should not mutate arguments passed in', [ - { - ROOT_QUERY: { - 'field({"literal":true,"value":42})': 1, - 'field({"literal":false,"value":42})': 2, - }, - }, - ], function (proxy) { - var options = { - query: graphql_tag_1.default(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "], ["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "]))), - variables: { - literal: false, - value: 42, - }, - }; - var preQueryCopy = lodash_1.cloneDeep(options); - expect(apollo_utilities_1.stripSymbols(proxy.readQuery(options))).toEqual({ a: 1, b: 2 }); - expect(preQueryCopy).toEqual(options); - }); - }); - describe('readFragment', function () { - itWithInitialData('will throw an error when there is no fragment', [ - {}, - ], function (proxy) { - expect(function () { - proxy.readFragment({ - id: 'x', - fragment: graphql_tag_1.default(templateObject_10 || (templateObject_10 = tslib_1.__makeTemplateObject(["\n query {\n a\n b\n c\n }\n "], ["\n query {\n a\n b\n c\n }\n "]))), - }); - }).toThrowError('Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - expect(function () { - proxy.readFragment({ - id: 'x', - fragment: graphql_tag_1.default(templateObject_11 || (templateObject_11 = tslib_1.__makeTemplateObject(["\n schema {\n query: Query\n }\n "], ["\n schema {\n query: Query\n }\n "]))), - }); - }).toThrowError('Found 0 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.'); - }); - itWithInitialData('will throw an error when there is more than one fragment but no fragment name', [{}], function (proxy) { - expect(function () { - proxy.readFragment({ - id: 'x', - fragment: graphql_tag_1.default(templateObject_12 || (templateObject_12 = tslib_1.__makeTemplateObject(["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n "], ["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n "]))), - }); - }).toThrowError('Found 2 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.'); - expect(function () { - proxy.readFragment({ - id: 'x', - fragment: graphql_tag_1.default(templateObject_13 || (templateObject_13 = tslib_1.__makeTemplateObject(["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n\n fragment c on C {\n c\n }\n "], ["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n\n fragment c on C {\n c\n }\n "]))), - }); - }).toThrowError('Found 3 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.'); - }); - itWithInitialData('will read some deeply nested data from the store at any id', [ - { - ROOT_QUERY: { - __typename: 'Type1', - a: 1, - b: 2, - c: 3, - d: { - type: 'id', - id: 'foo', - generated: false, - }, - }, - foo: { - __typename: 'Foo', - e: 4, - f: 5, - g: 6, - h: { - type: 'id', - id: 'bar', - generated: false, - }, - }, - bar: { - __typename: 'Bar', - i: 7, - j: 8, - k: 9, - }, - }, - ], function (proxy) { - expect(apollo_utilities_1.stripSymbols(proxy.readFragment({ - id: 'foo', - fragment: graphql_tag_1.default(templateObject_14 || (templateObject_14 = tslib_1.__makeTemplateObject(["\n fragment fragmentFoo on Foo {\n e\n h {\n i\n }\n }\n "], ["\n fragment fragmentFoo on Foo {\n e\n h {\n i\n }\n }\n "]))), - }))).toEqual({ e: 4, h: { i: 7 } }); - expect(apollo_utilities_1.stripSymbols(proxy.readFragment({ - id: 'foo', - fragment: graphql_tag_1.default(templateObject_15 || (templateObject_15 = tslib_1.__makeTemplateObject(["\n fragment fragmentFoo on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n "], ["\n fragment fragmentFoo on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n "]))), - }))).toEqual({ e: 4, f: 5, g: 6, h: { i: 7, j: 8, k: 9 } }); - expect(apollo_utilities_1.stripSymbols(proxy.readFragment({ - id: 'bar', - fragment: graphql_tag_1.default(templateObject_16 || (templateObject_16 = tslib_1.__makeTemplateObject(["\n fragment fragmentBar on Bar {\n i\n }\n "], ["\n fragment fragmentBar on Bar {\n i\n }\n "]))), - }))).toEqual({ i: 7 }); - expect(apollo_utilities_1.stripSymbols(proxy.readFragment({ - id: 'bar', - fragment: graphql_tag_1.default(templateObject_17 || (templateObject_17 = tslib_1.__makeTemplateObject(["\n fragment fragmentBar on Bar {\n i\n j\n k\n }\n "], ["\n fragment fragmentBar on Bar {\n i\n j\n k\n }\n "]))), - }))).toEqual({ i: 7, j: 8, k: 9 }); - expect(apollo_utilities_1.stripSymbols(proxy.readFragment({ - id: 'foo', - fragment: graphql_tag_1.default(templateObject_18 || (templateObject_18 = tslib_1.__makeTemplateObject(["\n fragment fragmentFoo on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment fragmentBar on Bar {\n i\n j\n k\n }\n "], ["\n fragment fragmentFoo on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment fragmentBar on Bar {\n i\n j\n k\n }\n "]))), - fragmentName: 'fragmentFoo', - }))).toEqual({ e: 4, f: 5, g: 6, h: { i: 7, j: 8, k: 9 } }); - expect(apollo_utilities_1.stripSymbols(proxy.readFragment({ - id: 'bar', - fragment: graphql_tag_1.default(templateObject_19 || (templateObject_19 = tslib_1.__makeTemplateObject(["\n fragment fragmentFoo on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment fragmentBar on Bar {\n i\n j\n k\n }\n "], ["\n fragment fragmentFoo on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment fragmentBar on Bar {\n i\n j\n k\n }\n "]))), - fragmentName: 'fragmentBar', - }))).toEqual({ i: 7, j: 8, k: 9 }); - }); - itWithInitialData('will read some data from the store with variables', [ - { - foo: { - __typename: 'Foo', - 'field({"literal":true,"value":42})': 1, - 'field({"literal":false,"value":42})': 2, - }, - }, - ], function (proxy) { - expect(apollo_utilities_1.stripSymbols(proxy.readFragment({ - id: 'foo', - fragment: graphql_tag_1.default(templateObject_20 || (templateObject_20 = tslib_1.__makeTemplateObject(["\n fragment foo on Foo {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "], ["\n fragment foo on Foo {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "]))), - variables: { - literal: false, - value: 42, - }, - }))).toEqual({ a: 1, b: 2 }); - }); - itWithInitialData('will return null when an id that can’t be found is provided', [ - {}, - { - bar: { __typename: 'Bar', a: 1, b: 2, c: 3 }, - }, - { - foo: { __typename: 'Foo', a: 1, b: 2, c: 3 }, - }, - ], function (client1, client2, client3) { - expect(apollo_utilities_1.stripSymbols(client1.readFragment({ - id: 'foo', - fragment: graphql_tag_1.default(templateObject_21 || (templateObject_21 = tslib_1.__makeTemplateObject(["\n fragment fooFragment on Foo {\n a\n b\n c\n }\n "], ["\n fragment fooFragment on Foo {\n a\n b\n c\n }\n "]))), - }))).toEqual(null); - expect(apollo_utilities_1.stripSymbols(client2.readFragment({ - id: 'foo', - fragment: graphql_tag_1.default(templateObject_22 || (templateObject_22 = tslib_1.__makeTemplateObject(["\n fragment fooFragment on Foo {\n a\n b\n c\n }\n "], ["\n fragment fooFragment on Foo {\n a\n b\n c\n }\n "]))), - }))).toEqual(null); - expect(apollo_utilities_1.stripSymbols(client3.readFragment({ - id: 'foo', - fragment: graphql_tag_1.default(templateObject_23 || (templateObject_23 = tslib_1.__makeTemplateObject(["\n fragment fooFragment on Foo {\n a\n b\n c\n }\n "], ["\n fragment fooFragment on Foo {\n a\n b\n c\n }\n "]))), - }))).toEqual({ a: 1, b: 2, c: 3 }); - }); - }); - describe('writeQuery', function () { - itWithInitialData('will write some data to the store', [{}], function (proxy) { - proxy.writeQuery({ - data: { a: 1 }, - query: graphql_tag_1.default(templateObject_24 || (templateObject_24 = tslib_1.__makeTemplateObject(["\n {\n a\n }\n "], ["\n {\n a\n }\n "]))), - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - a: 1, - }, - }); - proxy.writeQuery({ - data: { b: 2, c: 3 }, - query: graphql_tag_1.default(templateObject_25 || (templateObject_25 = tslib_1.__makeTemplateObject(["\n {\n b\n c\n }\n "], ["\n {\n b\n c\n }\n "]))), - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - a: 1, - b: 2, - c: 3, - }, - }); - proxy.writeQuery({ - data: { a: 4, b: 5, c: 6 }, - query: graphql_tag_1.default(templateObject_26 || (templateObject_26 = tslib_1.__makeTemplateObject(["\n {\n a\n b\n c\n }\n "], ["\n {\n a\n b\n c\n }\n "]))), - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - a: 4, - b: 5, - c: 6, - }, - }); - }); - itWithInitialData('will write some deeply nested data to the store', [{}], function (proxy) { - proxy.writeQuery({ - data: { a: 1, d: { e: 4 } }, - query: graphql_tag_1.default(templateObject_27 || (templateObject_27 = tslib_1.__makeTemplateObject(["\n {\n a\n d {\n e\n }\n }\n "], ["\n {\n a\n d {\n e\n }\n }\n "]))), - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - a: 1, - d: { - type: 'id', - id: '$ROOT_QUERY.d', - generated: true, - }, - }, - '$ROOT_QUERY.d': { - e: 4, - }, - }); - proxy.writeQuery({ - data: { a: 1, d: { h: { i: 7 } } }, - query: graphql_tag_1.default(templateObject_28 || (templateObject_28 = tslib_1.__makeTemplateObject(["\n {\n a\n d {\n h {\n i\n }\n }\n }\n "], ["\n {\n a\n d {\n h {\n i\n }\n }\n }\n "]))), - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - a: 1, - d: { - type: 'id', - id: '$ROOT_QUERY.d', - generated: true, - }, - }, - '$ROOT_QUERY.d': { - e: 4, - h: { - type: 'id', - id: '$ROOT_QUERY.d.h', - generated: true, - }, - }, - '$ROOT_QUERY.d.h': { - i: 7, - }, - }); - proxy.writeQuery({ - data: { - a: 1, - b: 2, - c: 3, - d: { e: 4, f: 5, g: 6, h: { i: 7, j: 8, k: 9 } }, - }, - query: graphql_tag_1.default(templateObject_29 || (templateObject_29 = tslib_1.__makeTemplateObject(["\n {\n a\n b\n c\n d {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n }\n "], ["\n {\n a\n b\n c\n d {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n }\n "]))), - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - a: 1, - b: 2, - c: 3, - d: { - type: 'id', - id: '$ROOT_QUERY.d', - generated: true, - }, - }, - '$ROOT_QUERY.d': { - e: 4, - f: 5, - g: 6, - h: { - type: 'id', - id: '$ROOT_QUERY.d.h', - generated: true, - }, - }, - '$ROOT_QUERY.d.h': { - i: 7, - j: 8, - k: 9, - }, - }); - }); - itWithInitialData('will write some data to the store with variables', [{}], function (proxy) { - proxy.writeQuery({ - data: { - a: 1, - b: 2, - }, - query: graphql_tag_1.default(templateObject_30 || (templateObject_30 = tslib_1.__makeTemplateObject(["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "], ["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "]))), - variables: { - literal: false, - value: 42, - }, - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - 'field({"literal":true,"value":42})': 1, - 'field({"literal":false,"value":42})': 2, - }, - }); - }); - itWithInitialData('will write some data to the store with variables where some are null', [{}], function (proxy) { - proxy.writeQuery({ - data: { - a: 1, - b: 2, - }, - query: graphql_tag_1.default(templateObject_31 || (templateObject_31 = tslib_1.__makeTemplateObject(["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "], ["\n query($literal: Boolean, $value: Int) {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "]))), - variables: { - literal: false, - value: null, - }, - }); - expect(proxy.extract()).toEqual({ - ROOT_QUERY: { - 'field({"literal":true,"value":42})': 1, - 'field({"literal":false,"value":null})': 2, - }, - }); - }); - }); - describe('writeFragment', function () { - itWithInitialData('will throw an error when there is no fragment', [{}], function (proxy) { - expect(function () { - proxy.writeFragment({ - data: {}, - id: 'x', - fragment: graphql_tag_1.default(templateObject_32 || (templateObject_32 = tslib_1.__makeTemplateObject(["\n query {\n a\n b\n c\n }\n "], ["\n query {\n a\n b\n c\n }\n "]))), - }); - }).toThrowError('Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - expect(function () { - proxy.writeFragment({ - data: {}, - id: 'x', - fragment: graphql_tag_1.default(templateObject_33 || (templateObject_33 = tslib_1.__makeTemplateObject(["\n schema {\n query: Query\n }\n "], ["\n schema {\n query: Query\n }\n "]))), - }); - }).toThrowError('Found 0 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.'); - }); - itWithInitialData('will throw an error when there is more than one fragment but no fragment name', [{}], function (proxy) { - expect(function () { - proxy.writeFragment({ - data: {}, - id: 'x', - fragment: graphql_tag_1.default(templateObject_34 || (templateObject_34 = tslib_1.__makeTemplateObject(["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n "], ["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n "]))), - }); - }).toThrowError('Found 2 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.'); - expect(function () { - proxy.writeFragment({ - data: {}, - id: 'x', - fragment: graphql_tag_1.default(templateObject_35 || (templateObject_35 = tslib_1.__makeTemplateObject(["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n\n fragment c on C {\n c\n }\n "], ["\n fragment a on A {\n a\n }\n\n fragment b on B {\n b\n }\n\n fragment c on C {\n c\n }\n "]))), - }); - }).toThrowError('Found 3 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.'); - }); - itWithCacheConfig('will write some deeply nested data into the store at any id', { - dataIdFromObject: function (o) { return o.id; }, - addTypename: false, - }, function (proxy) { - proxy.writeFragment({ - data: { __typename: 'Foo', e: 4, h: { id: 'bar', i: 7 } }, - id: 'foo', - fragment: graphql_tag_1.default(templateObject_36 || (templateObject_36 = tslib_1.__makeTemplateObject(["\n fragment fragmentFoo on Foo {\n e\n h {\n i\n }\n }\n "], ["\n fragment fragmentFoo on Foo {\n e\n h {\n i\n }\n }\n "]))), - }); - expect(proxy.extract()).toMatchSnapshot(); - proxy.writeFragment({ - data: { __typename: 'Foo', f: 5, g: 6, h: { id: 'bar', j: 8, k: 9 } }, - id: 'foo', - fragment: graphql_tag_1.default(templateObject_37 || (templateObject_37 = tslib_1.__makeTemplateObject(["\n fragment fragmentFoo on Foo {\n f\n g\n h {\n j\n k\n }\n }\n "], ["\n fragment fragmentFoo on Foo {\n f\n g\n h {\n j\n k\n }\n }\n "]))), - }); - expect(proxy.extract()).toMatchSnapshot(); - proxy.writeFragment({ - data: { i: 10, __typename: 'Bar' }, - id: 'bar', - fragment: graphql_tag_1.default(templateObject_38 || (templateObject_38 = tslib_1.__makeTemplateObject(["\n fragment fragmentBar on Bar {\n i\n }\n "], ["\n fragment fragmentBar on Bar {\n i\n }\n "]))), - }); - expect(proxy.extract()).toMatchSnapshot(); - proxy.writeFragment({ - data: { j: 11, k: 12, __typename: 'Bar' }, - id: 'bar', - fragment: graphql_tag_1.default(templateObject_39 || (templateObject_39 = tslib_1.__makeTemplateObject(["\n fragment fragmentBar on Bar {\n j\n k\n }\n "], ["\n fragment fragmentBar on Bar {\n j\n k\n }\n "]))), - }); - expect(proxy.extract()).toMatchSnapshot(); - proxy.writeFragment({ - data: { - __typename: 'Foo', - e: 4, - f: 5, - g: 6, - h: { __typename: 'Bar', id: 'bar', i: 7, j: 8, k: 9 }, - }, - id: 'foo', - fragment: graphql_tag_1.default(templateObject_40 || (templateObject_40 = tslib_1.__makeTemplateObject(["\n fragment fooFragment on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment barFragment on Bar {\n i\n j\n k\n }\n "], ["\n fragment fooFragment on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment barFragment on Bar {\n i\n j\n k\n }\n "]))), - fragmentName: 'fooFragment', - }); - expect(proxy.extract()).toMatchSnapshot(); - proxy.writeFragment({ - data: { __typename: 'Bar', i: 10, j: 11, k: 12 }, - id: 'bar', - fragment: graphql_tag_1.default(templateObject_41 || (templateObject_41 = tslib_1.__makeTemplateObject(["\n fragment fooFragment on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment barFragment on Bar {\n i\n j\n k\n }\n "], ["\n fragment fooFragment on Foo {\n e\n f\n g\n h {\n i\n j\n k\n }\n }\n\n fragment barFragment on Bar {\n i\n j\n k\n }\n "]))), - fragmentName: 'barFragment', - }); - expect(proxy.extract()).toMatchSnapshot(); - }); - itWithCacheConfig('writes data that can be read back', { - addTypename: true, - }, function (proxy) { - var readWriteFragment = graphql_tag_1.default(templateObject_42 || (templateObject_42 = tslib_1.__makeTemplateObject(["\n fragment aFragment on query {\n getSomething {\n id\n }\n }\n "], ["\n fragment aFragment on query {\n getSomething {\n id\n }\n }\n "]))); - var data = { - __typename: 'query', - getSomething: { id: '123', __typename: 'Something' }, - }; - proxy.writeFragment({ - data: data, - id: 'query', - fragment: readWriteFragment, - }); - var result = proxy.readFragment({ - fragment: readWriteFragment, - id: 'query', - }); - expect(apollo_utilities_1.stripSymbols(result)).toEqual(data); - }); - itWithCacheConfig('will write some data to the store with variables', { - addTypename: true, - }, function (proxy) { - proxy.writeFragment({ - data: { - a: 1, - b: 2, - __typename: 'Foo', - }, - id: 'foo', - fragment: graphql_tag_1.default(templateObject_43 || (templateObject_43 = tslib_1.__makeTemplateObject(["\n fragment foo on Foo {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "], ["\n fragment foo on Foo {\n a: field(literal: true, value: 42)\n b: field(literal: $literal, value: $value)\n }\n "]))), - variables: { - literal: false, - value: 42, - }, - }); - expect(proxy.extract()).toEqual({ - foo: { - __typename: 'Foo', - 'field({"literal":true,"value":42})': 1, - 'field({"literal":false,"value":42})': 2, - }, - }); - }); - }); - describe('performTransaction', function () { - itWithInitialData('will not broadcast mid-transaction', [{}], function (cache) { - var numBroadcasts = 0; - var query = graphql_tag_1.default(templateObject_44 || (templateObject_44 = tslib_1.__makeTemplateObject(["\n {\n a\n }\n "], ["\n {\n a\n }\n "]))); - cache.watch({ - query: query, - optimistic: false, - callback: function () { - numBroadcasts++; - }, - }); - expect(numBroadcasts).toEqual(0); - cache.performTransaction(function (proxy) { - proxy.writeQuery({ - data: { a: 1 }, - query: query, - }); - expect(numBroadcasts).toEqual(0); - proxy.writeQuery({ - data: { a: 4, b: 5, c: 6 }, - query: graphql_tag_1.default(templateObject_45 || (templateObject_45 = tslib_1.__makeTemplateObject(["\n {\n a\n b\n c\n }\n "], ["\n {\n a\n b\n c\n }\n "]))), - }); - expect(numBroadcasts).toEqual(0); - }); - expect(numBroadcasts).toEqual(1); - }); - }); - describe('performOptimisticTransaction', function () { - itWithInitialData('will only broadcast once', [{}], function (cache) { - var numBroadcasts = 0; - var query = graphql_tag_1.default(templateObject_46 || (templateObject_46 = tslib_1.__makeTemplateObject(["\n {\n a\n }\n "], ["\n {\n a\n }\n "]))); - cache.watch({ - query: query, - optimistic: true, - callback: function () { - numBroadcasts++; - }, - }); - expect(numBroadcasts).toEqual(0); - cache.recordOptimisticTransaction(function (proxy) { - proxy.writeQuery({ - data: { a: 1 }, - query: query, - }); - expect(numBroadcasts).toEqual(0); - proxy.writeQuery({ - data: { a: 4, b: 5, c: 6 }, - query: graphql_tag_1.default(templateObject_47 || (templateObject_47 = tslib_1.__makeTemplateObject(["\n {\n a\n b\n c\n }\n "], ["\n {\n a\n b\n c\n }\n "]))), - }); - expect(numBroadcasts).toEqual(0); - }, 1); - expect(numBroadcasts).toEqual(1); - }); - }); -}); -var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33, templateObject_34, templateObject_35, templateObject_36, templateObject_37, templateObject_38, templateObject_39, templateObject_40, templateObject_41, templateObject_42, templateObject_43, templateObject_44, templateObject_45, templateObject_46, templateObject_47; -//# sourceMappingURL=cache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/cache.js.map deleted file mode 100644 index 47c72f3c..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/cache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.js","sourceR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AAC,EAAE;oBACd,KAAK,OAAA;iBACN,CAAC,CAAC;gBAEH,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBAEjC,KAAK,CAAC,UAAU,CAAC;oBACf,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;oBAC1B,KAAK,EAAE,qBAAG,wLAAA,2GAMT,IAAA;iBACF,CAAC,CAAC;gBAEH,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACnC,CAAC,EACD,CAAQ,CACT,CAAC;YAEF,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.d.ts deleted file mode 100644 index f7a17109..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function withError(func: Function, regex: RegExp): any; -//# sourceMappingURL=diffAgainstStore.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.d.ts.map deleted file mode 100644 index bf5c66bd..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diffAgainstStore.d.ts","sourceRoot":"","sources":["../src/__tests__/diffAgainstStore.ts"],"names":[],"mappings":"AAaA,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,OActD"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.js b/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.js deleted file mode 100644 index 9db2e35a..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.js +++ /dev/null @@ -1,678 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var graphql_tag_1 = tslib_1.__importStar(require("graphql-tag")); -var apollo_utilities_1 = require("apollo-utilities"); -var objectCache_1 = require("../objectCache"); -var readFromStore_1 = require("../readFromStore"); -var writeToStore_1 = require("../writeToStore"); -var fragmentMatcher_1 = require("../fragmentMatcher"); -var inMemoryCache_1 = require("../inMemoryCache"); -var fragmentMatcherFunction = new fragmentMatcher_1.HeuristicFragmentMatcher().match; -graphql_tag_1.disableFragmentWarnings(); -function withError(func, regex) { - var message = null; - var error = console.error; - console.error = function (m) { - message = m; - }; - try { - var result = func(); - expect(message).toMatch(regex); - return result; - } - finally { - console.error = error; - } -} -exports.withError = withError; -describe('diffing queries against the store', function () { - var reader = new readFromStore_1.StoreReader(); - var writer = new writeToStore_1.StoreWriter(); - it('expects named fragments to return complete as true when diffd against ' + - 'the store', function () { - var store = objectCache_1.defaultNormalizedCacheFactory({}); - var queryResult = reader.diffQueryAgainstStore({ - store: store, - query: graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n query foo {\n ...root\n }\n\n fragment root on Query {\n nestedObj {\n innerArray {\n id\n someField\n }\n }\n }\n "], ["\n query foo {\n ...root\n }\n\n fragment root on Query {\n nestedObj {\n innerArray {\n id\n someField\n }\n }\n }\n "]))), - fragmentMatcherFunction: fragmentMatcherFunction, - config: { - dataIdFromObject: inMemoryCache_1.defaultDataIdFromObject, - }, - }); - expect(queryResult.complete).toEqual(false); - }); - it('expects inline fragments to return complete as true when diffd against ' + - 'the store', function () { - var store = objectCache_1.defaultNormalizedCacheFactory(); - var queryResult = reader.diffQueryAgainstStore({ - store: store, - query: graphql_tag_1.default(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n {\n ... on DummyQuery {\n nestedObj {\n innerArray {\n id\n otherField\n }\n }\n }\n ... on Query {\n nestedObj {\n innerArray {\n id\n someField\n }\n }\n }\n ... on DummyQuery2 {\n nestedObj {\n innerArray {\n id\n otherField2\n }\n }\n }\n }\n "], ["\n {\n ... on DummyQuery {\n nestedObj {\n innerArray {\n id\n otherField\n }\n }\n }\n ... on Query {\n nestedObj {\n innerArray {\n id\n someField\n }\n }\n }\n ... on DummyQuery2 {\n nestedObj {\n innerArray {\n id\n otherField2\n }\n }\n }\n }\n "]))), - fragmentMatcherFunction: fragmentMatcherFunction, - config: { - dataIdFromObject: inMemoryCache_1.defaultDataIdFromObject, - }, - }); - expect(queryResult.complete).toEqual(false); - }); - it('returns nothing when the store is enough', function () { - var query = graphql_tag_1.default(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"1\") {\n name\n }\n }\n "], ["\n {\n people_one(id: \"1\") {\n name\n }\n }\n "]))); - var result = { - people_one: { - name: 'Luke Skywalker', - }, - }; - var store = writer.writeQueryToStore({ - result: result, - query: query, - }); - expect(reader.diffQueryAgainstStore({ - store: store, - query: query, - }).complete).toBeTruthy(); - }); - it('caches root queries both under the ID of the node and the query name', function () { - var firstQuery = graphql_tag_1.default(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"1\") {\n __typename\n id\n name\n }\n }\n "], ["\n {\n people_one(id: \"1\") {\n __typename\n id\n name\n }\n }\n "]))); - var result = { - people_one: { - __typename: 'Person', - id: '1', - name: 'Luke Skywalker', - }, - }; - var getIdField = function (_a) { - var id = _a.id; - return id; - }; - var store = writer.writeQueryToStore({ - result: result, - query: firstQuery, - dataIdFromObject: getIdField, - }); - var secondQuery = graphql_tag_1.default(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"1\") {\n __typename\n id\n name\n }\n }\n "], ["\n {\n people_one(id: \"1\") {\n __typename\n id\n name\n }\n }\n "]))); - var complete = reader.diffQueryAgainstStore({ - store: store, - query: secondQuery, - }).complete; - expect(complete).toBeTruthy(); - expect(store.get('1')).toEqual(result.people_one); - }); - it('does not swallow errors other than field errors', function () { - var firstQuery = graphql_tag_1.default(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n query {\n person {\n powers\n }\n }\n "], ["\n query {\n person {\n powers\n }\n }\n "]))); - var firstResult = { - person: { - powers: 'the force', - }, - }; - var store = writer.writeQueryToStore({ - result: firstResult, - query: firstQuery, - }); - var unionQuery = graphql_tag_1.default(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n query {\n ...notARealFragment\n }\n "], ["\n query {\n ...notARealFragment\n }\n "]))); - return expect(function () { - reader.diffQueryAgainstStore({ - store: store, - query: unionQuery, - }); - }).toThrowError(/No fragment/); - }); - it('does not error on a correct query with union typed fragments', function () { - return withError(function () { - var firstQuery = graphql_tag_1.default(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n query {\n person {\n __typename\n firstName\n lastName\n }\n }\n "], ["\n query {\n person {\n __typename\n firstName\n lastName\n }\n }\n "]))); - var firstResult = { - person: { - __typename: 'Author', - firstName: 'John', - lastName: 'Smith', - }, - }; - var store = writer.writeQueryToStore({ - result: firstResult, - query: firstQuery, - }); - var unionQuery = graphql_tag_1.default(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n query {\n person {\n __typename\n ... on Author {\n firstName\n lastName\n }\n ... on Jedi {\n powers\n }\n }\n }\n "], ["\n query {\n person {\n __typename\n ... on Author {\n firstName\n lastName\n }\n ... on Jedi {\n powers\n }\n }\n }\n "]))); - var complete = reader.diffQueryAgainstStore({ - store: store, - query: unionQuery, - returnPartialData: false, - fragmentMatcherFunction: fragmentMatcherFunction, - }).complete; - expect(complete).toBe(false); - }, /IntrospectionFragmentMatcher/); - }); - it('does not error on a query with fields missing from all but one named fragment', function () { - var firstQuery = graphql_tag_1.default(templateObject_10 || (templateObject_10 = tslib_1.__makeTemplateObject(["\n query {\n person {\n __typename\n firstName\n lastName\n }\n }\n "], ["\n query {\n person {\n __typename\n firstName\n lastName\n }\n }\n "]))); - var firstResult = { - person: { - __typename: 'Author', - firstName: 'John', - lastName: 'Smith', - }, - }; - var store = writer.writeQueryToStore({ - result: firstResult, - query: firstQuery, - }); - var unionQuery = graphql_tag_1.default(templateObject_11 || (templateObject_11 = tslib_1.__makeTemplateObject(["\n query {\n person {\n __typename\n ...authorInfo\n ...jediInfo\n }\n }\n\n fragment authorInfo on Author {\n firstName\n }\n\n fragment jediInfo on Jedi {\n powers\n }\n "], ["\n query {\n person {\n __typename\n ...authorInfo\n ...jediInfo\n }\n }\n\n fragment authorInfo on Author {\n firstName\n }\n\n fragment jediInfo on Jedi {\n powers\n }\n "]))); - var complete = reader.diffQueryAgainstStore({ - store: store, - query: unionQuery, - }).complete; - expect(complete).toBe(false); - }); - it('throws an error on a query with fields missing from matching named fragments', function () { - var firstQuery = graphql_tag_1.default(templateObject_12 || (templateObject_12 = tslib_1.__makeTemplateObject(["\n query {\n person {\n __typename\n firstName\n lastName\n }\n }\n "], ["\n query {\n person {\n __typename\n firstName\n lastName\n }\n }\n "]))); - var firstResult = { - person: { - __typename: 'Author', - firstName: 'John', - lastName: 'Smith', - }, - }; - var store = writer.writeQueryToStore({ - result: firstResult, - query: firstQuery, - }); - var unionQuery = graphql_tag_1.default(templateObject_13 || (templateObject_13 = tslib_1.__makeTemplateObject(["\n query {\n person {\n __typename\n ...authorInfo2\n ...jediInfo2\n }\n }\n\n fragment authorInfo2 on Author {\n firstName\n address\n }\n\n fragment jediInfo2 on Jedi {\n jedi\n }\n "], ["\n query {\n person {\n __typename\n ...authorInfo2\n ...jediInfo2\n }\n }\n\n fragment authorInfo2 on Author {\n firstName\n address\n }\n\n fragment jediInfo2 on Jedi {\n jedi\n }\n "]))); - expect(function () { - reader.diffQueryAgainstStore({ - store: store, - query: unionQuery, - returnPartialData: false, - }); - }).toThrow(); - }); - it('returns available fields if returnPartialData is true', function () { - var firstQuery = graphql_tag_1.default(templateObject_14 || (templateObject_14 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"1\") {\n __typename\n id\n name\n }\n }\n "], ["\n {\n people_one(id: \"1\") {\n __typename\n id\n name\n }\n }\n "]))); - var firstResult = { - people_one: { - __typename: 'Person', - id: 'lukeId', - name: 'Luke Skywalker', - }, - }; - var store = writer.writeQueryToStore({ - result: firstResult, - query: firstQuery, - }); - var simpleQuery = graphql_tag_1.default(templateObject_15 || (templateObject_15 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"1\") {\n name\n age\n }\n }\n "], ["\n {\n people_one(id: \"1\") {\n name\n age\n }\n }\n "]))); - var inlineFragmentQuery = graphql_tag_1.default(templateObject_16 || (templateObject_16 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"1\") {\n ... on Person {\n name\n age\n }\n }\n }\n "], ["\n {\n people_one(id: \"1\") {\n ... on Person {\n name\n age\n }\n }\n }\n "]))); - var namedFragmentQuery = graphql_tag_1.default(templateObject_17 || (templateObject_17 = tslib_1.__makeTemplateObject(["\n query {\n people_one(id: \"1\") {\n ...personInfo\n }\n }\n\n fragment personInfo on Person {\n name\n age\n }\n "], ["\n query {\n people_one(id: \"1\") {\n ...personInfo\n }\n }\n\n fragment personInfo on Person {\n name\n age\n }\n "]))); - var simpleDiff = reader.diffQueryAgainstStore({ - store: store, - query: simpleQuery, - }); - expect(simpleDiff.result).toEqual({ - people_one: { - name: 'Luke Skywalker', - }, - }); - var inlineDiff = reader.diffQueryAgainstStore({ - store: store, - query: inlineFragmentQuery, - }); - expect(inlineDiff.result).toEqual({ - people_one: { - name: 'Luke Skywalker', - }, - }); - var namedDiff = reader.diffQueryAgainstStore({ - store: store, - query: namedFragmentQuery, - }); - expect(namedDiff.result).toEqual({ - people_one: { - name: 'Luke Skywalker', - }, - }); - expect(function () { - reader.diffQueryAgainstStore({ - store: store, - query: simpleQuery, - returnPartialData: false, - }); - }).toThrow(); - }); - it('will add a private id property', function () { - var query = graphql_tag_1.default(templateObject_18 || (templateObject_18 = tslib_1.__makeTemplateObject(["\n query {\n a {\n id\n b\n }\n c {\n d\n e {\n id\n f\n }\n g {\n h\n }\n }\n }\n "], ["\n query {\n a {\n id\n b\n }\n c {\n d\n e {\n id\n f\n }\n g {\n h\n }\n }\n }\n "]))); - var queryResult = { - a: [{ id: 'a:1', b: 1.1 }, { id: 'a:2', b: 1.2 }, { id: 'a:3', b: 1.3 }], - c: { - d: 2, - e: [ - { id: 'e:1', f: 3.1 }, - { id: 'e:2', f: 3.2 }, - { id: 'e:3', f: 3.3 }, - { id: 'e:4', f: 3.4 }, - { id: 'e:5', f: 3.5 }, - ], - g: { h: 4 }, - }, - }; - function dataIdFromObject(_a) { - var id = _a.id; - return id; - } - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - dataIdFromObject: dataIdFromObject, - }); - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - }).result; - expect(result).toEqual(queryResult); - expect(dataIdFromObject(result.a[0])).toBe('a:1'); - expect(dataIdFromObject(result.a[1])).toBe('a:2'); - expect(dataIdFromObject(result.a[2])).toBe('a:3'); - expect(dataIdFromObject(result.c.e[0])).toBe('e:1'); - expect(dataIdFromObject(result.c.e[1])).toBe('e:2'); - expect(dataIdFromObject(result.c.e[2])).toBe('e:3'); - expect(dataIdFromObject(result.c.e[3])).toBe('e:4'); - expect(dataIdFromObject(result.c.e[4])).toBe('e:5'); - }); - describe('referential equality preservation', function () { - it('will return the previous result if there are no changes', function () { - var query = graphql_tag_1.default(templateObject_19 || (templateObject_19 = tslib_1.__makeTemplateObject(["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "], ["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "]))); - var queryResult = { - a: { b: 1 }, - c: { d: 2, e: { f: 3 } }, - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - }); - var previousResult = { - a: { b: 1 }, - c: { d: 2, e: { f: 3 } }, - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result).toEqual(previousResult); - }); - it('will return parts of the previous result that changed', function () { - var query = graphql_tag_1.default(templateObject_20 || (templateObject_20 = tslib_1.__makeTemplateObject(["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "], ["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "]))); - var queryResult = { - a: { b: 1 }, - c: { d: 2, e: { f: 3 } }, - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - }); - var previousResult = { - a: { b: 1 }, - c: { d: 20, e: { f: 3 } }, - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result).not.toEqual(previousResult); - expect(result.a).toEqual(previousResult.a); - expect(result.c).not.toEqual(previousResult.c); - expect(result.c.e).toEqual(previousResult.c.e); - }); - it('will return the previous result if there are no changes in child arrays', function () { - var query = graphql_tag_1.default(templateObject_21 || (templateObject_21 = tslib_1.__makeTemplateObject(["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "], ["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "]))); - var queryResult = { - a: [{ b: 1.1 }, { b: 1.2 }, { b: 1.3 }], - c: { - d: 2, - e: [{ f: 3.1 }, { f: 3.2 }, { f: 3.3 }, { f: 3.4 }, { f: 3.5 }], - }, - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - }); - var previousResult = { - a: [{ b: 1.1 }, { b: 1.2 }, { b: 1.3 }], - c: { - d: 2, - e: [{ f: 3.1 }, { f: 3.2 }, { f: 3.3 }, { f: 3.4 }, { f: 3.5 }], - }, - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result).toEqual(previousResult); - }); - it('will not add zombie items when previousResult starts with the same items', function () { - var query = graphql_tag_1.default(templateObject_22 || (templateObject_22 = tslib_1.__makeTemplateObject(["\n query {\n a {\n b\n }\n }\n "], ["\n query {\n a {\n b\n }\n }\n "]))); - var queryResult = { - a: [{ b: 1.1 }, { b: 1.2 }], - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - }); - var previousResult = { - a: [{ b: 1.1 }, { b: 1.2 }, { b: 1.3 }], - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result.a[0]).toEqual(previousResult.a[0]); - expect(result.a[1]).toEqual(previousResult.a[1]); - }); - it('will return the previous result if there are no changes in nested child arrays', function () { - var query = graphql_tag_1.default(templateObject_23 || (templateObject_23 = tslib_1.__makeTemplateObject(["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "], ["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "]))); - var queryResult = { - a: [[[[[{ b: 1.1 }, { b: 1.2 }, { b: 1.3 }]]]]], - c: { - d: 2, - e: [[{ f: 3.1 }, { f: 3.2 }, { f: 3.3 }], [{ f: 3.4 }, { f: 3.5 }]], - }, - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - }); - var previousResult = { - a: [[[[[{ b: 1.1 }, { b: 1.2 }, { b: 1.3 }]]]]], - c: { - d: 2, - e: [[{ f: 3.1 }, { f: 3.2 }, { f: 3.3 }], [{ f: 3.4 }, { f: 3.5 }]], - }, - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result).toEqual(previousResult); - }); - it('will return parts of the previous result if there are changes in child arrays', function () { - var query = graphql_tag_1.default(templateObject_24 || (templateObject_24 = tslib_1.__makeTemplateObject(["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "], ["\n query {\n a {\n b\n }\n c {\n d\n e {\n f\n }\n }\n }\n "]))); - var queryResult = { - a: [{ b: 1.1 }, { b: 1.2 }, { b: 1.3 }], - c: { - d: 2, - e: [{ f: 3.1 }, { f: 3.2 }, { f: 3.3 }, { f: 3.4 }, { f: 3.5 }], - }, - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - }); - var previousResult = { - a: [{ b: 1.1 }, { b: -1.2 }, { b: 1.3 }], - c: { - d: 20, - e: [{ f: 3.1 }, { f: 3.2 }, { f: 3.3 }, { f: 3.4 }, { f: 3.5 }], - }, - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result).not.toEqual(previousResult); - expect(result.a).not.toEqual(previousResult.a); - expect(result.a[0]).toEqual(previousResult.a[0]); - expect(result.a[1]).not.toEqual(previousResult.a[1]); - expect(result.a[2]).toEqual(previousResult.a[2]); - expect(result.c).not.toEqual(previousResult.c); - expect(result.c.e).toEqual(previousResult.c.e); - expect(result.c.e[0]).toEqual(previousResult.c.e[0]); - expect(result.c.e[1]).toEqual(previousResult.c.e[1]); - expect(result.c.e[2]).toEqual(previousResult.c.e[2]); - expect(result.c.e[3]).toEqual(previousResult.c.e[3]); - expect(result.c.e[4]).toEqual(previousResult.c.e[4]); - }); - it('will return the same items in a different order with `dataIdFromObject`', function () { - var query = graphql_tag_1.default(templateObject_25 || (templateObject_25 = tslib_1.__makeTemplateObject(["\n query {\n a {\n id\n b\n }\n c {\n d\n e {\n id\n f\n }\n g {\n h\n }\n }\n }\n "], ["\n query {\n a {\n id\n b\n }\n c {\n d\n e {\n id\n f\n }\n g {\n h\n }\n }\n }\n "]))); - var queryResult = { - a: [ - { id: 'a:1', b: 1.1 }, - { id: 'a:2', b: 1.2 }, - { id: 'a:3', b: 1.3 }, - ], - c: { - d: 2, - e: [ - { id: 'e:1', f: 3.1 }, - { id: 'e:2', f: 3.2 }, - { id: 'e:3', f: 3.3 }, - { id: 'e:4', f: 3.4 }, - { id: 'e:5', f: 3.5 }, - ], - g: { h: 4 }, - }, - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - dataIdFromObject: function (_a) { - var id = _a.id; - return id; - }, - }); - var previousResult = { - a: [ - { id: 'a:3', b: 1.3 }, - { id: 'a:2', b: 1.2 }, - { id: 'a:1', b: 1.1 }, - ], - c: { - d: 2, - e: [ - { id: 'e:4', f: 3.4 }, - { id: 'e:2', f: 3.2 }, - { id: 'e:5', f: 3.5 }, - { id: 'e:3', f: 3.3 }, - { id: 'e:1', f: 3.1 }, - ], - g: { h: 4 }, - }, - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result).not.toEqual(previousResult); - expect(result.a).not.toEqual(previousResult.a); - expect(result.a[0]).toEqual(previousResult.a[2]); - expect(result.a[1]).toEqual(previousResult.a[1]); - expect(result.a[2]).toEqual(previousResult.a[0]); - expect(result.c).not.toEqual(previousResult.c); - expect(result.c.e).not.toEqual(previousResult.c.e); - expect(result.c.e[0]).toEqual(previousResult.c.e[4]); - expect(result.c.e[1]).toEqual(previousResult.c.e[1]); - expect(result.c.e[2]).toEqual(previousResult.c.e[3]); - expect(result.c.e[3]).toEqual(previousResult.c.e[0]); - expect(result.c.e[4]).toEqual(previousResult.c.e[2]); - expect(result.c.g).toEqual(previousResult.c.g); - }); - it('will return the same JSON scalar field object', function () { - var query = graphql_tag_1.default(templateObject_26 || (templateObject_26 = tslib_1.__makeTemplateObject(["\n {\n a {\n b\n c\n }\n d {\n e\n f\n }\n }\n "], ["\n {\n a {\n b\n c\n }\n d {\n e\n f\n }\n }\n "]))); - var queryResult = { - a: { b: 1, c: { x: 2, y: 3, z: 4 } }, - d: { e: 5, f: { x: 6, y: 7, z: 8 } }, - }; - var store = writer.writeQueryToStore({ - query: query, - result: queryResult, - }); - var previousResult = { - a: { b: 1, c: { x: 2, y: 3, z: 4 } }, - d: { e: 50, f: { x: 6, y: 7, z: 8 } }, - }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: query, - previousResult: previousResult, - }).result; - expect(result).toEqual(queryResult); - expect(result).not.toEqual(previousResult); - expect(result.a).toEqual(previousResult.a); - expect(result.d).not.toEqual(previousResult.d); - expect(result.d.f).toEqual(previousResult.d.f); - }); - it('will preserve equality with custom resolvers', function () { - var listQuery = graphql_tag_1.default(templateObject_27 || (templateObject_27 = tslib_1.__makeTemplateObject(["\n {\n people {\n id\n name\n __typename\n }\n }\n "], ["\n {\n people {\n id\n name\n __typename\n }\n }\n "]))); - var listResult = { - people: [ - { - id: '4', - name: 'Luke Skywalker', - __typename: 'Person', - }, - ], - }; - var itemQuery = graphql_tag_1.default(templateObject_28 || (templateObject_28 = tslib_1.__makeTemplateObject(["\n {\n person(id: 4) {\n id\n name\n __typename\n }\n }\n "], ["\n {\n person(id: 4) {\n id\n name\n __typename\n }\n }\n "]))); - var dataIdFromObject = function (obj) { return obj.id; }; - var store = writer.writeQueryToStore({ - query: listQuery, - result: listResult, - dataIdFromObject: dataIdFromObject, - }); - var previousResult = { - person: listResult.people[0], - }; - var cacheRedirects = { - Query: { - person: function (_, args) { - return apollo_utilities_1.toIdValue({ id: args['id'], typename: 'Person' }); - }, - }, - }; - var config = { dataIdFromObject: dataIdFromObject, cacheRedirects: cacheRedirects }; - var result = reader.diffQueryAgainstStore({ - store: store, - query: itemQuery, - previousResult: previousResult, - config: config, - }).result; - expect(result).toEqual(previousResult); - }); - }); - describe('malformed queries', function () { - it('throws for non-scalar query fields without selection sets', function () { - var validQuery = graphql_tag_1.default(templateObject_29 || (templateObject_29 = tslib_1.__makeTemplateObject(["\n query getMessageList {\n messageList {\n id\n __typename\n message\n }\n }\n "], ["\n query getMessageList {\n messageList {\n id\n __typename\n message\n }\n }\n "]))); - var invalidQuery = graphql_tag_1.default(templateObject_30 || (templateObject_30 = tslib_1.__makeTemplateObject(["\n query getMessageList {\n # This field needs a selection set because its value is an array\n # of non-scalar objects.\n messageList\n }\n "], ["\n query getMessageList {\n # This field needs a selection set because its value is an array\n # of non-scalar objects.\n messageList\n }\n "]))); - var store = writer.writeQueryToStore({ - query: validQuery, - result: { - messageList: [ - { - id: 1, - __typename: 'Message', - message: 'hi', - }, - { - id: 2, - __typename: 'Message', - message: 'hello', - }, - { - id: 3, - __typename: 'Message', - message: 'hey', - }, - ], - }, - }); - try { - reader.diffQueryAgainstStore({ - store: store, - query: invalidQuery, - }); - throw new Error('should have thrown'); - } - catch (e) { - expect(e.message).toEqual('Missing selection set for object of type Message returned for query field messageList'); - } - }); - }); - describe('issue #4081', function () { - it('should not return results containing cycles', function () { - var company = { - __typename: 'Company', - id: 1, - name: 'Apollo', - users: [], - }; - company.users.push({ - __typename: 'User', - id: 1, - name: 'Ben', - company: company, - }, { - __typename: 'User', - id: 2, - name: 'James', - company: company, - }); - var query = graphql_tag_1.default(templateObject_31 || (templateObject_31 = tslib_1.__makeTemplateObject(["\n query Query {\n user {\n ...UserFragment\n company {\n users {\n ...UserFragment\n }\n }\n }\n }\n\n fragment UserFragment on User {\n id\n name\n company {\n id\n name\n }\n }\n "], ["\n query Query {\n user {\n ...UserFragment\n company {\n users {\n ...UserFragment\n }\n }\n }\n }\n\n fragment UserFragment on User {\n id\n name\n company {\n id\n name\n }\n }\n "]))); - function check(store) { - var result = reader.diffQueryAgainstStore({ store: store, query: query }).result; - var json = JSON.stringify(result); - company.users.forEach(function (user) { - expect(json).toContain(JSON.stringify(user.name)); - }); - expect(result).toEqual({ - user: { - id: 1, - name: 'Ben', - company: { - id: 1, - name: 'Apollo', - users: [ - { - id: 1, - name: 'Ben', - company: { - id: 1, - name: 'Apollo', - }, - }, - { - id: 2, - name: 'James', - company: { - id: 1, - name: 'Apollo', - }, - }, - ], - }, - }, - }); - } - check(writer.writeQueryToStore({ - query: query, - result: { - user: company.users[0], - }, - })); - check(writer.writeQueryToStore({ - dataIdFromObject: inMemoryCache_1.defaultDataIdFromObject, - query: query, - result: { - user: company.users[0], - }, - })); - }); - }); -}); -var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31; -//# sourceMappingURL=diffAgainstStore.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.js.map deleted file mode 100644 index d9c17242..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/diffAgainstStore.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diffAgainstStore.js","sourceRoot":"","sources":["../../src/__tests__/diffAgainstStore.ts"],"names":[],"mappings":";;;AAAA,iEAA2D;AAC3D,qDAA6C;AAE7C,8CAA+D;AAC/D,kDAA+C;AAC/C,gDAA8C;AAC9C,sDAA8D;AAC9D,kDAA2D;AAG3D,IAAM,uBAAuB,GAAG,IAAI,0CAAwB,EAAE,CAAC,KAAK,CAAC;AAErE,qCAAuB,EAAE,CAAC;AAC1B,SAAgB,SAAS,CAAC,IAAc,EAAE,KAAa;IACrD,IAAI,OAAO,GAAW,IAAa,CAAC;IAC5B,IAAA,qBAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,GAAG,UAAC,CAAM;QACrB,OAAO,GAAG,CAAC,CAAC;IACd,CAAC,CAAC;IAEF,IAAI;QACF,IAAM,MAAM,GAAG,IAAI,EAAE,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC;KACf;YAAS;QACR,OAAO,CAAC,KAAK,GAAG,KAAK,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AC,CAAC;gBAEpC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,IAAS;oBAC9B,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACpD,CAAC,CAAC,CAAC;gBAEH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;oBACrB,IAAI,EAAE;wBACJ,EAAE,EAAE,CAAC;wBACL,IAAI,EAAE,KAAK;wBACX,OAAO,EAAE;4BACP,EAAE,EAAE,CAAC;4BACL,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE;gCACL;oCACE,EAAE,EAAE,CAAC;oCACL,IAAI,EAAE,KAAK;oCACX,OAAO,EAAE;wCACP,EAAE,EAAE,CAAC;wCACL,IAAI,EAAE,QAAQ;qCACf;iCACF;gCACD;oCACE,EAAE,EAAE,CAAC;oCACL,IAAI,EAAE,OAAO;oCACb,OAAO,EAAE;wCACP,EAAE,EAAE,CAAC;wCACL,IAAI,EAAE,QAAQ;qCACf;iCACF;6BACF;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;YAGD,KAAK,CACH,MAAM,CAAC,iBAAiB,CAAC;gBACvB,KAAK,OAAA;gBACL,MAAM,EAAE;oBACN,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;iBACvB;aACF,CAAC,CACH,CAAC;YAGF,KAAK,CACH,MAAM,CAAC,iBAAiB,CAAC;gBACvB,gBAAgB,EAAE,uCAAuB;gBACzC,KAAK,OAAA;gBACL,MAAM,EAAE;oBACN,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;iBACvB;aACF,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.d.ts deleted file mode 100644 index c7c71213..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=fragmentMatcher.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.d.ts.map deleted file mode 100644 index 23193f35..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragmentMatcher.d.ts","sourceRoot":"","sources":["../src/__tests__/fragmentMatcher.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.js b/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.js deleted file mode 100644 index cba24f2e..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var fragmentMatcher_1 = require("../fragmentMatcher"); -var objectCache_1 = require("../objectCache"); -var inMemoryCache_1 = require("../inMemoryCache"); -var graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag")); -describe('FragmentMatcher', function () { - it('can match against the root Query', function () { - var cache = new inMemoryCache_1.InMemoryCache({ - addTypename: true, - }); - var query = graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n query AllPeople {\n people {\n id\n name\n }\n ...PeopleTypes\n }\n fragment PeopleTypes on Query {\n __type(name: \"Person\") {\n name\n kind\n }\n }\n "], ["\n query AllPeople {\n people {\n id\n name\n }\n ...PeopleTypes\n }\n fragment PeopleTypes on Query {\n __type(name: \"Person\") {\n name\n kind\n }\n }\n "]))); - var data = { - people: [ - { - __typename: 'Person', - id: 123, - name: 'Ben', - }, - ], - __type: { - __typename: '__Type', - name: 'Person', - kind: 'OBJECT', - }, - }; - cache.writeQuery({ query: query, data: data }); - expect(cache.readQuery({ query: query })).toEqual(data); - }); -}); -describe('IntrospectionFragmentMatcher', function () { - it('will throw an error if match is called if it is not ready', function () { - var ifm = new fragmentMatcher_1.IntrospectionFragmentMatcher(); - expect(function () { return ifm.match(); }).toThrowError(/called before/); - }); - it('can be seeded with an introspection query result', function () { - var ifm = new fragmentMatcher_1.IntrospectionFragmentMatcher({ - introspectionQueryResultData: { - __schema: { - types: [ - { - kind: 'UNION', - name: 'Item', - possibleTypes: [ - { - name: 'ItemA', - }, - { - name: 'ItemB', - }, - ], - }, - ], - }, - }, - }); - var store = objectCache_1.defaultNormalizedCacheFactory({ - a: { - __typename: 'ItemB', - }, - }); - var idValue = { - type: 'id', - id: 'a', - generated: false, - }; - var readStoreContext = { - store: store, - returnPartialData: false, - hasMissingField: false, - cacheRedirects: {}, - }; - expect(ifm.match(idValue, 'Item', readStoreContext)).toBe(true); - expect(ifm.match(idValue, 'NotAnItem', readStoreContext)).toBe(false); - }); -}); -var templateObject_1; -//# sourceMappingURL=fragmentMatcher.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.js.map deleted file mode 100644 index 68d20355..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/fragmentMatcher.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragmentMatcher.js","sourceRoot":"","sources":["../../src/__tests__/fragmentMatcher.ts"],"names":[],"mappings":";;;AAAA,sDAAkE;AAClE,8CAA+D;AAE/D,kDAAiD;AACjD,oEAA8B;AAE9B,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,EAAE,CAAC,kCAAkC,EAAE;QACrC,IAAM,KAAK,GAAG,IAAI,6BAAa,CAAC;YAC9B,WAAW,EAAE,I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;aACpB;SACF,CAAC,CAAC;QAEH,IAAM,OAAO,GAAG;YACd,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,GAAG;YACP,SAAS,EAAE,KAAK;SACjB,CAAC;QAEF,IAAM,gBAAgB,GAAG;YACvB,KAAK,OAAA;YACL,iBAAiB,EAAE,KAAK;YACxB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,EAAE;SACC,CAAC;QAEtB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAc,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAc,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,CACnE,KAAK,CACN,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.d.ts deleted file mode 100644 index 7a55a8b3..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.d.ts +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=mapCache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.d.ts.map deleted file mode 100644 index c5374f3c..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mapCache.d.ts","sourceRoot":"","sources":["../src/__tests__/mapCache.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.js b/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.js deleted file mode 100644 index e6fcb73e..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.js +++ /dev/null @@ -1,18 +0,0 @@ -jest.mock('../objectCache', function () { - var _a = require('../mapCache'), MapCache = _a.MapCache, mapNormalizedCacheFactory = _a.mapNormalizedCacheFactory; - return { - ObjectCache: MapCache, - defaultNormalizedCacheFactory: mapNormalizedCacheFactory, - }; -}); -describe('MapCache', function () { - require('./objectCache'); - require('./cache'); - require('./diffAgainstStore'); - require('./fragmentMatcher'); - require('./readFromStore'); - require('./diffAgainstStore'); - require('./roundtrip'); - require('./writeToStore'); -}); -//# sourceMappingURL=mapCache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.js.map deleted file mode 100644 index e343f39e..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/mapCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mapCache.js","sourceRoot":"","sources":["../../src/__tests__/mapCache.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;IACpB,IAAA,2BAAgE,EAA9D,sBAAQ,EAAE,wDAAoD,CAAC;IACvE,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,6BAA6B,EAAE,yBAAyB;KACzD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,UAAU,EAAE;IAGnB,OAAO,CAAC,eAAe,CAAC,CAAC;IACzB,OAAO,CAAC,SAAS,CAAC,CAAC;IACnB,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9B,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9B,OAAO,CAAC,aAAa,CAAC,CAAC;IACvB,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.d.ts deleted file mode 100644 index d609d534..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=objectCache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.d.ts.map deleted file mode 100644 index a2b4f7ee..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"objectCache.d.ts","sourceRoot":"","sources":["../src/__tests__/objectCache.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.js b/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.js deleted file mode 100644 index 714519dc..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var objectCache_1 = require("../objectCache"); -describe('ObjectCache', function () { - it('should create an empty cache', function () { - var cache = new objectCache_1.ObjectCache(); - expect(cache.toObject()).toEqual({}); - }); - it('should create a cache based on an Object', function () { - var contents = { a: {} }; - var cache = new objectCache_1.ObjectCache(contents); - expect(cache.toObject()).toEqual(contents); - }); - it("should .get() an object from the store by dataId", function () { - var contents = { a: {} }; - var cache = new objectCache_1.ObjectCache(contents); - expect(cache.get('a')).toBe(contents.a); - }); - it("should .set() an object from the store by dataId", function () { - var obj = {}; - var cache = new objectCache_1.ObjectCache(); - cache.set('a', obj); - expect(cache.get('a')).toBe(obj); - }); - it("should .clear() the store", function () { - var obj = {}; - var cache = new objectCache_1.ObjectCache(); - cache.set('a', obj); - cache.clear(); - expect(cache.get('a')).toBeUndefined(); - }); -}); -//# sourceMappingURL=objectCache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.js.map deleted file mode 100644 index 9d00c386..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"objectCache.js","sourceRoot":"","sources":["../../src/__tests__/objectCache.ts"],"names":[],"mappings":";;AAAA,8CAA6C;AAG7C,QAAQ,CAAC,aAAa,EAAE;IACtB,EAAE,CAAC,8BAA8B,EAAE;QACjC,IAAM,KAAK,GAAG,IAAI,yBAAW,EAAE,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE;QAC7C,IAAM,QAAQ,GAA0B,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QAClD,IAAM,KAAK,GAAG,IAAI,yBAAW,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE;QACrD,IAAM,QAAQ,GAA0B,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QAClD,IAAM,KAAK,GAAG,IAAI,yBAAW,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE;QACrD,IAAM,GAAG,GAAG,EAAE,CAAC;QACf,IAAM,KAAK,GAAG,IAAI,yBAAW,EAAE,CAAC;QAChC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACpB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE;QAC9B,IAAM,GAAG,GAAG,EAAE,CAAC;QACf,IAAM,KAAK,GAAG,IAAI,yBAAW,EAAE,CAAC;QAChC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACpB,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.d.ts deleted file mode 100644 index a1ad772f..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=readFromStore.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.d.ts.map deleted file mode 100644 index 9a5c0b17..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"readFromStore.d.ts","sourceRoot":"","sources":["../src/__tests__/readFromStore.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.js b/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.js deleted file mode 100644 index 49fbc3c7..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.js +++ /dev/null @@ -1,555 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var lodash_1 = require("lodash"); -var graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag")); -var apollo_utilities_1 = require("apollo-utilities"); -var __1 = require("../"); -var readFromStore_1 = require("../readFromStore"); -var objectCache_1 = require("../objectCache"); -var fragmentMatcherFunction = new __1.HeuristicFragmentMatcher().match; -var diffAgainstStore_1 = require("./diffAgainstStore"); -describe('reading from the store', function () { - var reader = new readFromStore_1.StoreReader(); - it('runs a nested query with proper fragment fields in arrays', function () { - diffAgainstStore_1.withError(function () { - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: { - __typename: 'Query', - nestedObj: { type: 'id', id: 'abcde', generated: false }, - }, - abcde: { - id: 'abcde', - innerArray: [ - { type: 'id', generated: true, id: 'abcde.innerArray.0' }, - ], - }, - 'abcde.innerArray.0': { - id: 'abcdef', - someField: 3, - }, - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n {\n ... on DummyQuery {\n nestedObj {\n innerArray {\n id\n otherField\n }\n }\n }\n ... on Query {\n nestedObj {\n innerArray {\n id\n someField\n }\n }\n }\n ... on DummyQuery2 {\n nestedObj {\n innerArray {\n id\n otherField2\n }\n }\n }\n }\n "], ["\n {\n ... on DummyQuery {\n nestedObj {\n innerArray {\n id\n otherField\n }\n }\n }\n ... on Query {\n nestedObj {\n innerArray {\n id\n someField\n }\n }\n }\n ... on DummyQuery2 {\n nestedObj {\n innerArray {\n id\n otherField2\n }\n }\n }\n }\n "]))), - fragmentMatcherFunction: fragmentMatcherFunction, - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - nestedObj: { - innerArray: [{ id: 'abcdef', someField: 3 }], - }, - }); - }, /queries contain union or interface types/); - }); - it('rejects malformed queries', function () { - expect(function () { - reader.readQueryFromStore({ - store: objectCache_1.defaultNormalizedCacheFactory(), - query: graphql_tag_1.default(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n query {\n name\n }\n\n query {\n address\n }\n "], ["\n query {\n name\n }\n\n query {\n address\n }\n "]))), - }); - }).toThrowError(/2 operations/); - expect(function () { - reader.readQueryFromStore({ - store: objectCache_1.defaultNormalizedCacheFactory(), - query: graphql_tag_1.default(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n fragment x on y {\n name\n }\n "], ["\n fragment x on y {\n name\n }\n "]))), - }); - }).toThrowError(/contain a query/); - }); - it('runs a basic query', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: result, - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n query {\n stringField\n numberField\n }\n "], ["\n query {\n stringField\n numberField\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: result['stringField'], - numberField: result['numberField'], - }); - }); - it('runs a basic query with arguments', function () { - var query = graphql_tag_1.default(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n query {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "], ["\n query {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "]))); - var variables = { - intArg: 5, - floatArg: 3.14, - stringArg: 'This is a string!', - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: { - id: 'abcd', - nullField: null, - 'numberField({"floatArg":3.14,"intArg":5})': 5, - 'stringField({"arg":"This is a string!"})': 'Heyo', - }, - }); - var result = reader.readQueryFromStore({ - store: store, - query: query, - variables: variables, - }); - expect(apollo_utilities_1.stripSymbols(result)).toEqual({ - id: 'abcd', - nullField: null, - numberField: 5, - stringField: 'Heyo', - }); - }); - it('runs a basic query with custom directives', function () { - var query = graphql_tag_1.default(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n query {\n id\n firstName @include(if: true)\n lastName @upperCase\n birthDate @dateFormat(format: \"DD-MM-YYYY\")\n }\n "], ["\n query {\n id\n firstName @include(if: true)\n lastName @upperCase\n birthDate @dateFormat(format: \"DD-MM-YYYY\")\n }\n "]))); - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: { - id: 'abcd', - firstName: 'James', - 'lastName@upperCase': 'BOND', - 'birthDate@dateFormat({"format":"DD-MM-YYYY"})': '20-05-1940', - }, - }); - var result = reader.readQueryFromStore({ - store: store, - query: query, - }); - expect(apollo_utilities_1.stripSymbols(result)).toEqual({ - id: 'abcd', - firstName: 'James', - lastName: 'BOND', - birthDate: '20-05-1940', - }); - }); - it('runs a basic query with default values for arguments', function () { - var query = graphql_tag_1.default(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n query someBigQuery(\n $stringArg: String = \"This is a default string!\"\n $intArg: Int = 0\n $floatArg: Float\n ) {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "], ["\n query someBigQuery(\n $stringArg: String = \"This is a default string!\"\n $intArg: Int = 0\n $floatArg: Float\n ) {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "]))); - var variables = { - floatArg: 3.14, - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: { - id: 'abcd', - nullField: null, - 'numberField({"floatArg":3.14,"intArg":0})': 5, - 'stringField({"arg":"This is a default string!"})': 'Heyo', - }, - }); - var result = reader.readQueryFromStore({ - store: store, - query: query, - variables: variables, - }); - expect(apollo_utilities_1.stripSymbols(result)).toEqual({ - id: 'abcd', - nullField: null, - numberField: 5, - stringField: 'Heyo', - }); - }); - it('runs a nested query', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: { - id: 'abcde', - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedObj')), { - nestedObj: { - type: 'id', - id: 'abcde', - generated: false, - }, - }), - abcde: result.nestedObj, - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nestedObj {\n stringField\n numberField\n }\n }\n "], ["\n {\n stringField\n numberField\n nestedObj {\n stringField\n numberField\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - nestedObj: { - stringField: 'This is a string too!', - numberField: 6, - }, - }); - }); - it('runs a nested query with multiple fragments', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: { - id: 'abcde', - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - deepNestedObj: { - stringField: 'This is a deep string', - numberField: 7, - nullField: null, - }, - nullObject: null, - __typename: 'Item', - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedObj', 'deepNestedObj')), { - __typename: 'Query', - nestedObj: { - type: 'id', - id: 'abcde', - generated: false, - }, - }), - abcde: lodash_1.assign({}, result.nestedObj, { - deepNestedObj: { - type: 'id', - id: 'abcdef', - generated: false, - }, - }), - abcdef: result.deepNestedObj, - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nullField\n ... on Query {\n nestedObj {\n stringField\n nullField\n deepNestedObj {\n stringField\n nullField\n }\n }\n }\n ... on Query {\n nestedObj {\n numberField\n nullField\n deepNestedObj {\n numberField\n nullField\n }\n }\n }\n ... on Query {\n nullObject\n }\n }\n "], ["\n {\n stringField\n numberField\n nullField\n ... on Query {\n nestedObj {\n stringField\n nullField\n deepNestedObj {\n stringField\n nullField\n }\n }\n }\n ... on Query {\n nestedObj {\n numberField\n nullField\n deepNestedObj {\n numberField\n nullField\n }\n }\n }\n ... on Query {\n nullObject\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: { - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - deepNestedObj: { - stringField: 'This is a deep string', - numberField: 7, - nullField: null, - }, - }, - nullObject: null, - }); - }); - it('runs a nested query with an array without IDs', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedArray: [ - { - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - { - stringField: 'This is a string also!', - numberField: 7, - nullField: null, - }, - ], - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedArray')), { - nestedArray: [ - { type: 'id', generated: true, id: 'abcd.nestedArray.0' }, - { type: 'id', generated: true, id: 'abcd.nestedArray.1' }, - ], - }), - 'abcd.nestedArray.0': result.nestedArray[0], - 'abcd.nestedArray.1': result.nestedArray[1], - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_10 || (templateObject_10 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nestedArray {\n stringField\n numberField\n }\n }\n "], ["\n {\n stringField\n numberField\n nestedArray {\n stringField\n numberField\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - nestedArray: [ - { - stringField: 'This is a string too!', - numberField: 6, - }, - { - stringField: 'This is a string also!', - numberField: 7, - }, - ], - }); - }); - it('runs a nested query with an array without IDs and a null', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedArray: [ - null, - { - stringField: 'This is a string also!', - numberField: 7, - nullField: null, - }, - ], - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedArray')), { - nestedArray: [ - null, - { type: 'id', generated: true, id: 'abcd.nestedArray.1' }, - ], - }), - 'abcd.nestedArray.1': result.nestedArray[1], - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_11 || (templateObject_11 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nestedArray {\n stringField\n numberField\n }\n }\n "], ["\n {\n stringField\n numberField\n nestedArray {\n stringField\n numberField\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - nestedArray: [ - null, - { - stringField: 'This is a string also!', - numberField: 7, - }, - ], - }); - }); - it('runs a nested query with an array with IDs and a null', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedArray: [ - null, - { - id: 'abcde', - stringField: 'This is a string also!', - numberField: 7, - nullField: null, - }, - ], - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedArray')), { - nestedArray: [null, { type: 'id', generated: false, id: 'abcde' }], - }), - abcde: result.nestedArray[1], - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_12 || (templateObject_12 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nestedArray {\n id\n stringField\n numberField\n }\n }\n "], ["\n {\n stringField\n numberField\n nestedArray {\n id\n stringField\n numberField\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - nestedArray: [ - null, - { - id: 'abcde', - stringField: 'This is a string also!', - numberField: 7, - }, - ], - }); - }); - it('throws on a missing field', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ ROOT_QUERY: result }); - expect(function () { - reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_13 || (templateObject_13 = tslib_1.__makeTemplateObject(["\n {\n stringField\n missingField\n }\n "], ["\n {\n stringField\n missingField\n }\n "]))), - }); - }).toThrowError(/field missingField on object/); - }); - it('runs a nested query where the reference is null', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: null, - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedObj')), { - nestedObj: null, - }), - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_14 || (templateObject_14 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nestedObj {\n stringField\n numberField\n }\n }\n "], ["\n {\n stringField\n numberField\n nestedObj {\n stringField\n numberField\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - nestedObj: null, - }); - }); - it('runs an array of non-objects', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - simpleArray: ['one', 'two', 'three'], - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'simpleArray')), { - simpleArray: { - type: 'json', - json: result.simpleArray, - }, - }), - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_15 || (templateObject_15 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n simpleArray\n }\n "], ["\n {\n stringField\n numberField\n simpleArray\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - simpleArray: ['one', 'two', 'three'], - }); - }); - it('runs an array of non-objects with null', function () { - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - simpleArray: [null, 'two', 'three'], - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'simpleArray')), { - simpleArray: { - type: 'json', - json: result.simpleArray, - }, - }), - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_16 || (templateObject_16 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n simpleArray\n }\n "], ["\n {\n stringField\n numberField\n simpleArray\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - stringField: 'This is a string!', - numberField: 5, - simpleArray: [null, 'two', 'three'], - }); - }); - it('will read from an arbitrary root id', function () { - var data = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: { - id: 'abcde', - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - deepNestedObj: { - stringField: 'This is a deep string', - numberField: 7, - nullField: null, - }, - nullObject: null, - __typename: 'Item', - }; - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(data, 'nestedObj', 'deepNestedObj')), { - __typename: 'Query', - nestedObj: { - type: 'id', - id: 'abcde', - generated: false, - }, - }), - abcde: lodash_1.assign({}, data.nestedObj, { - deepNestedObj: { - type: 'id', - id: 'abcdef', - generated: false, - }, - }), - abcdef: data.deepNestedObj, - }); - var queryResult1 = reader.readQueryFromStore({ - store: store, - rootId: 'abcde', - query: graphql_tag_1.default(templateObject_17 || (templateObject_17 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nullField\n deepNestedObj {\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n stringField\n numberField\n nullField\n deepNestedObj {\n stringField\n numberField\n nullField\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult1)).toEqual({ - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - deepNestedObj: { - stringField: 'This is a deep string', - numberField: 7, - nullField: null, - }, - }); - var queryResult2 = reader.readQueryFromStore({ - store: store, - rootId: 'abcdef', - query: graphql_tag_1.default(templateObject_18 || (templateObject_18 = tslib_1.__makeTemplateObject(["\n {\n stringField\n numberField\n nullField\n }\n "], ["\n {\n stringField\n numberField\n nullField\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult2)).toEqual({ - stringField: 'This is a deep string', - numberField: 7, - nullField: null, - }); - }); - it('properly handles the connection directive', function () { - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: { - abc: [ - { - generated: true, - id: 'ROOT_QUERY.abc.0', - type: 'id', - }, - ], - }, - 'ROOT_QUERY.abc.0': { - name: 'efgh', - }, - }); - var queryResult = reader.readQueryFromStore({ - store: store, - query: graphql_tag_1.default(templateObject_19 || (templateObject_19 = tslib_1.__makeTemplateObject(["\n {\n books(skip: 0, limit: 2) @connection(key: \"abc\") {\n name\n }\n }\n "], ["\n {\n books(skip: 0, limit: 2) @connection(key: \"abc\") {\n name\n }\n }\n "]))), - }); - expect(apollo_utilities_1.stripSymbols(queryResult)).toEqual({ - books: [ - { - name: 'efgh', - }, - ], - }); - }); -}); -var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19; -//# sourceMappingURL=readFromStore.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.js.map deleted file mode 100644 index 93ec353e..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/readFromStore.js.map +++ /dev/null @@ -1 +0,0 @@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AA6B,CAAC;YAC1C,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH;wBACE,SAAS,EAAE,IAAI;wBACf,EAAE,EAAE,kBAAkB;wBACtB,IAAI,EAAE,IAAI;qBACX;iBACF;aACF;YACD,kBAAkB,EAAE;gBAClB,IAAI,EAAE,MAAM;aACb;SACF,CAAC,CAAC;QAEH,IAAM,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC;YAC5C,KAAK,OAAA;YACL,KAAK,EAAE,qBAAG,4MAAA,+HAMT,IAAA;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,+BAAY,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,MAAM;iBACb;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.d.ts deleted file mode 100644 index 519528bb..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=recordingCache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.d.ts.map deleted file mode 100644 index 0029a6c1..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"recordingCache.d.ts","sourceRoot":"","sources":["../src/__tests__/recordingCache.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.js b/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.js deleted file mode 100644 index 29ad65f3..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var inMemoryCache_1 = require("../inMemoryCache"); -var objectCache_1 = require("../objectCache"); -describe('OptimisticCacheLayer', function () { - function makeLayer(root) { - return new inMemoryCache_1.OptimisticCacheLayer('whatever', root, function () { }); - } - describe('returns correct values during recording', function () { - var data = { - Human: { __typename: 'Human', name: 'Mark' }, - Animal: { __typename: 'Mouse', name: '🐭' }, - }; - var dataToRecord = { - Human: { __typename: 'Human', name: 'John' }, - }; - var underlyingCache = new objectCache_1.ObjectCache(data); - var cache = makeLayer(underlyingCache); - beforeEach(function () { - cache = makeLayer(underlyingCache); - }); - it('should passthrough values if not defined in recording', function () { - expect(cache.get('Human')).toBe(data.Human); - expect(cache.get('Animal')).toBe(data.Animal); - }); - it('should return values defined during recording', function () { - cache.set('Human', dataToRecord.Human); - expect(cache.get('Human')).toBe(dataToRecord.Human); - expect(underlyingCache.get('Human')).toBe(data.Human); - }); - it('should return undefined for values deleted during recording', function () { - expect(cache.get('Animal')).toBe(data.Animal); - cache.delete('Animal'); - expect(cache.get('Animal')).toBeUndefined(); - expect(cache.toObject()).toHaveProperty('Animal'); - expect(underlyingCache.get('Animal')).toBe(data.Animal); - }); - }); - describe('returns correct result of a recorded transaction', function () { - var data = { - Human: { __typename: 'Human', name: 'Mark' }, - Animal: { __typename: 'Mouse', name: '🐭' }, - }; - var dataToRecord = { - Human: { __typename: 'Human', name: 'John' }, - }; - var underlyingCache = new objectCache_1.ObjectCache(data); - var cache = makeLayer(underlyingCache); - var recording; - beforeEach(function () { - cache = makeLayer(underlyingCache); - cache.set('Human', dataToRecord.Human); - cache.delete('Animal'); - recording = cache.toObject(); - }); - it('should contain the property indicating deletion', function () { - expect(recording).toHaveProperty('Animal'); - }); - it('should have recorded the changes made during recording', function () { - expect(recording).toEqual({ - Human: dataToRecord.Human, - Animal: undefined, - }); - }); - it('should keep the original data unaffected', function () { - expect(underlyingCache.toObject()).toEqual(data); - }); - }); -}); -//# sourceMappingURL=recordingCache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.js.map deleted file mode 100644 index 4c2dd1ce..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/recordingCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"recordingCache.js","sourceRoot":"","sources":["../../src/__tests__/recordingCache.ts"],"names":[],"mappings":";;AAAA,kDAAwD;AACxD,8CAA6C;AAG7C,QAAQ,CAAC,sBAAsB,EAAE;IAC/B,SAAS,SAAS,CAAC,IAAiB;QAClC,OAAO,IAAI,oCAAoB,CAAC,UAAU,EAAE,IAAI,EAAE,cAAO,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,QAAQ,CAAC,yCAAyC,EAAE;QAClD,IAAM,IAAI,GAAG;YACX,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;YAC5C,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;SAC5C,CAAC;QAEF,IAAM,YAAY,GAAG;YACnB,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;SAC7C,CAAC;QAEF,IAAM,eAAe,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;QACvC,UAAU,CAAC;YACT,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE;YAC1D,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ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OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;SAC7C,CAAC;QAEF,IAAM,eAAe,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;QACvC,IAAI,SAAgC,CAAC;QAErC,UAAU,CAAC;YACT,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;YACnC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YACvC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACvB,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE;YACpD,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wDAAwD,EAAE;YAC3D,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;gBACxB,KAAK,EAAE,YAAY,CAAC,KAAK;gBACzB,MAAM,EAAE,SAAS;aAClB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE;YAC7C,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.d.ts deleted file mode 100644 index dc8b7c36..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=roundtrip.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.d.ts.map deleted file mode 100644 index 148afc19..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"roundtrip.d.ts","sourceRoot":"","sources":["../src/__tests__/roundtrip.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.js b/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.js deleted file mode 100644 index bc932c57..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.js +++ /dev/null @@ -1,275 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag")); -var diffAgainstStore_1 = require("./diffAgainstStore"); -var writeToStore_1 = require("./writeToStore"); -var depTrackingCache_1 = require("../depTrackingCache"); -var __1 = require("../"); -var fragmentMatcherFunction = new __1.HeuristicFragmentMatcher().match; -function assertDeeplyFrozen(value, stack) { - if (stack === void 0) { stack = []; } - if (value !== null && typeof value === 'object' && stack.indexOf(value) < 0) { - expect(Object.isExtensible(value)).toBe(false); - expect(Object.isFrozen(value)).toBe(true); - stack.push(value); - Object.keys(value).forEach(function (key) { - assertDeeplyFrozen(value[key], stack); - }); - expect(stack.pop()).toBe(value); - } -} -function storeRoundtrip(query, result, variables) { - if (variables === void 0) { variables = {}; } - var reader = new __1.StoreReader(); - var immutableReader = new __1.StoreReader({ freezeResults: true }); - var writer = new __1.StoreWriter(); - var store = writer.writeQueryToStore({ - result: result, - query: query, - variables: variables, - }); - var readOptions = { - store: store, - query: query, - variables: variables, - fragmentMatcherFunction: fragmentMatcherFunction, - }; - var reconstructedResult = reader.readQueryFromStore(readOptions); - expect(reconstructedResult).toEqual(result); - expect(store).toBeInstanceOf(depTrackingCache_1.DepTrackingCache); - expect(reader.readQueryFromStore(readOptions)).toBe(reconstructedResult); - var immutableResult = immutableReader.readQueryFromStore(readOptions); - expect(immutableResult).toEqual(reconstructedResult); - expect(immutableReader.readQueryFromStore(readOptions)).toBe(immutableResult); - if (process.env.NODE_ENV !== 'production') { - try { - immutableResult.illegal = 'this should not work'; - throw new Error('unreached'); - } - catch (e) { - expect(e.message).not.toMatch(/unreached/); - expect(e).toBeInstanceOf(TypeError); - } - assertDeeplyFrozen(immutableResult); - } - writer.writeQueryToStore({ - store: store, - result: { oyez: 1234 }, - query: graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n {\n oyez\n }\n "], ["\n {\n oyez\n }\n "]))), - }); - var deletedRootResult = reader.readQueryFromStore(readOptions); - expect(deletedRootResult).toEqual(result); - if (deletedRootResult === reconstructedResult) { - return; - } - Object.keys(result).forEach(function (key) { - expect(deletedRootResult[key]).toBe(reconstructedResult[key]); - }); -} -describe('roundtrip', function () { - it('real graphql result', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"1\") {\n name\n }\n }\n "], ["\n {\n people_one(id: \"1\") {\n name\n }\n }\n "]))), { - people_one: { - name: 'Luke Skywalker', - }, - }); - }); - it('multidimensional array (#776)', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n {\n rows {\n value\n }\n }\n "], ["\n {\n rows {\n value\n }\n }\n "]))), { - rows: [[{ value: 1 }, { value: 2 }], [{ value: 3 }, { value: 4 }]], - }); - }); - it('array with null values (#1551)', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n {\n list {\n value\n }\n }\n "], ["\n {\n list {\n value\n }\n }\n "]))), { - list: [null, { value: 1 }], - }); - }); - it('enum arguments', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n {\n hero(episode: JEDI) {\n name\n }\n }\n "], ["\n {\n hero(episode: JEDI) {\n name\n }\n }\n "]))), { - hero: { - name: 'Luke Skywalker', - }, - }); - }); - it('with an alias', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n {\n luke: people_one(id: \"1\") {\n name\n }\n vader: people_one(id: \"4\") {\n name\n }\n }\n "], ["\n {\n luke: people_one(id: \"1\") {\n name\n }\n vader: people_one(id: \"4\") {\n name\n }\n }\n "]))), { - luke: { - name: 'Luke Skywalker', - }, - vader: { - name: 'Darth Vader', - }, - }); - }); - it('with variables', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n {\n luke: people_one(id: $lukeId) {\n name\n }\n vader: people_one(id: $vaderId) {\n name\n }\n }\n "], ["\n {\n luke: people_one(id: $lukeId) {\n name\n }\n vader: people_one(id: $vaderId) {\n name\n }\n }\n "]))), { - luke: { - name: 'Luke Skywalker', - }, - vader: { - name: 'Darth Vader', - }, - }, { - lukeId: '1', - vaderId: '4', - }); - }); - it('with GraphQLJSON scalar type', function () { - var updateClub = { - uid: '1d7f836018fc11e68d809dfee940f657', - name: 'Eple', - settings: { - name: 'eple', - currency: 'AFN', - calendarStretch: 2, - defaultPreAllocationPeriod: 1, - confirmationEmailCopy: null, - emailDomains: null, - }, - }; - storeRoundtrip(graphql_tag_1.default(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n {\n updateClub {\n uid\n name\n settings\n }\n }\n "], ["\n {\n updateClub {\n uid\n name\n settings\n }\n }\n "]))), { - updateClub: updateClub, - }); - expect(Object.isExtensible(updateClub)).toBe(true); - expect(Object.isFrozen(updateClub)).toBe(false); - }); - describe('directives', function () { - it('should be able to query with skip directive true', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n query {\n fortuneCookie @skip(if: true)\n }\n "], ["\n query {\n fortuneCookie @skip(if: true)\n }\n "]))), {}); - }); - it('should be able to query with skip directive false', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_10 || (templateObject_10 = tslib_1.__makeTemplateObject(["\n query {\n fortuneCookie @skip(if: false)\n }\n "], ["\n query {\n fortuneCookie @skip(if: false)\n }\n "]))), { fortuneCookie: 'live long and prosper' }); - }); - }); - describe('fragments', function () { - it('should work on null fields', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_11 || (templateObject_11 = tslib_1.__makeTemplateObject(["\n query {\n field {\n ... on Obj {\n stuff\n }\n }\n }\n "], ["\n query {\n field {\n ... on Obj {\n stuff\n }\n }\n }\n "]))), { - field: null, - }); - }); - it('should work on basic inline fragments', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_12 || (templateObject_12 = tslib_1.__makeTemplateObject(["\n query {\n field {\n __typename\n ... on Obj {\n stuff\n }\n }\n }\n "], ["\n query {\n field {\n __typename\n ... on Obj {\n stuff\n }\n }\n }\n "]))), { - field: { - __typename: 'Obj', - stuff: 'Result', - }, - }); - }); - it('should resolve on union types with inline fragments without typenames with warning', function () { - return writeToStore_1.withWarning(function () { - storeRoundtrip(graphql_tag_1.default(templateObject_13 || (templateObject_13 = tslib_1.__makeTemplateObject(["\n query {\n all_people {\n name\n ... on Jedi {\n side\n }\n ... on Droid {\n model\n }\n }\n }\n "], ["\n query {\n all_people {\n name\n ... on Jedi {\n side\n }\n ... on Droid {\n model\n }\n }\n }\n "]))), { - all_people: [ - { - name: 'Luke Skywalker', - side: 'bright', - }, - { - name: 'R2D2', - model: 'astromech', - }, - ], - }); - }, /using fragments/); - }); - it('should throw an error on two of the same inline fragment types', function () { - return expect(function () { - storeRoundtrip(graphql_tag_1.default(templateObject_14 || (templateObject_14 = tslib_1.__makeTemplateObject(["\n query {\n all_people {\n __typename\n name\n ... on Jedi {\n side\n }\n ... on Jedi {\n rank\n }\n }\n }\n "], ["\n query {\n all_people {\n __typename\n name\n ... on Jedi {\n side\n }\n ... on Jedi {\n rank\n }\n }\n }\n "]))), { - all_people: [ - { - __typename: 'Jedi', - name: 'Luke Skywalker', - side: 'bright', - }, - ], - }); - }).toThrowError(/Can\'t find field rank on object/); - }); - it('should resolve fields it can on interface with non matching inline fragments', function () { - return diffAgainstStore_1.withError(function () { - storeRoundtrip(graphql_tag_1.default(templateObject_15 || (templateObject_15 = tslib_1.__makeTemplateObject(["\n query {\n dark_forces {\n __typename\n name\n ... on Droid {\n model\n }\n }\n }\n "], ["\n query {\n dark_forces {\n __typename\n name\n ... on Droid {\n model\n }\n }\n }\n "]))), { - dark_forces: [ - { - __typename: 'Droid', - name: '8t88', - model: '88', - }, - { - __typename: 'Darth', - name: 'Anakin Skywalker', - }, - ], - }); - }, /IntrospectionFragmentMatcher/); - }); - it('should resolve on union types with spread fragments', function () { - return diffAgainstStore_1.withError(function () { - storeRoundtrip(graphql_tag_1.default(templateObject_16 || (templateObject_16 = tslib_1.__makeTemplateObject(["\n fragment jediFragment on Jedi {\n side\n }\n\n fragment droidFragment on Droid {\n model\n }\n\n query {\n all_people {\n __typename\n name\n ...jediFragment\n ...droidFragment\n }\n }\n "], ["\n fragment jediFragment on Jedi {\n side\n }\n\n fragment droidFragment on Droid {\n model\n }\n\n query {\n all_people {\n __typename\n name\n ...jediFragment\n ...droidFragment\n }\n }\n "]))), { - all_people: [ - { - __typename: 'Jedi', - name: 'Luke Skywalker', - side: 'bright', - }, - { - __typename: 'Droid', - name: 'R2D2', - model: 'astromech', - }, - ], - }); - }, /IntrospectionFragmentMatcher/); - }); - it('should work with a fragment on the actual interface or union', function () { - return diffAgainstStore_1.withError(function () { - storeRoundtrip(graphql_tag_1.default(templateObject_17 || (templateObject_17 = tslib_1.__makeTemplateObject(["\n fragment jediFragment on Character {\n side\n }\n\n fragment droidFragment on Droid {\n model\n }\n\n query {\n all_people {\n name\n __typename\n ...jediFragment\n ...droidFragment\n }\n }\n "], ["\n fragment jediFragment on Character {\n side\n }\n\n fragment droidFragment on Droid {\n model\n }\n\n query {\n all_people {\n name\n __typename\n ...jediFragment\n ...droidFragment\n }\n }\n "]))), { - all_people: [ - { - __typename: 'Jedi', - name: 'Luke Skywalker', - side: 'bright', - }, - { - __typename: 'Droid', - name: 'R2D2', - model: 'astromech', - }, - ], - }); - }, /IntrospectionFragmentMatcher/); - }); - it('should throw on error on two of the same spread fragment types', function () { - expect(function () { - return storeRoundtrip(graphql_tag_1.default(templateObject_18 || (templateObject_18 = tslib_1.__makeTemplateObject(["\n fragment jediSide on Jedi {\n side\n }\n\n fragment jediRank on Jedi {\n rank\n }\n\n query {\n all_people {\n __typename\n name\n ...jediSide\n ...jediRank\n }\n }\n "], ["\n fragment jediSide on Jedi {\n side\n }\n\n fragment jediRank on Jedi {\n rank\n }\n\n query {\n all_people {\n __typename\n name\n ...jediSide\n ...jediRank\n }\n }\n "]))), { - all_people: [ - { - __typename: 'Jedi', - name: 'Luke Skywalker', - side: 'bright', - }, - ], - }); - }).toThrowError(/Can\'t find field rank on object/); - }); - it('should resolve on @include and @skip with inline fragments', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_19 || (templateObject_19 = tslib_1.__makeTemplateObject(["\n query {\n person {\n name\n __typename\n ... on Jedi @include(if: true) {\n side\n }\n ... on Droid @skip(if: true) {\n model\n }\n }\n }\n "], ["\n query {\n person {\n name\n __typename\n ... on Jedi @include(if: true) {\n side\n }\n ... on Droid @skip(if: true) {\n model\n }\n }\n }\n "]))), { - person: { - __typename: 'Jedi', - name: 'Luke Skywalker', - side: 'bright', - }, - }); - }); - it('should resolve on @include and @skip with spread fragments', function () { - storeRoundtrip(graphql_tag_1.default(templateObject_20 || (templateObject_20 = tslib_1.__makeTemplateObject(["\n fragment jediFragment on Jedi {\n side\n }\n\n fragment droidFragment on Droid {\n model\n }\n\n query {\n person {\n name\n __typename\n ...jediFragment @include(if: true)\n ...droidFragment @skip(if: true)\n }\n }\n "], ["\n fragment jediFragment on Jedi {\n side\n }\n\n fragment droidFragment on Droid {\n model\n }\n\n query {\n person {\n name\n __typename\n ...jediFragment @include(if: true)\n ...droidFragment @skip(if: true)\n }\n }\n "]))), { - person: { - __typename: 'Jedi', - name: 'Luke Skywalker', - side: 'bright', - }, - }); - }); - }); -}); -var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20; -//# sourceMappingURL=roundtrip.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.js.map deleted file mode 100644 index 1b36787a..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/roundtrip.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"roundtrip.js","sourceRoot":"","sources":["../../src/__tests__/roundtrip.ts"],"names":[],"mappings":";;;AACA,oEAA8B;AAE9B,uDAA+C;AAC/C,+CAA6C;AAE7C,wDAAuD;AAEvD,yBAAyE;AAEzE,IAAM,uBAAuB,GAAG,IAAI,4BAAwB,EAAE,CAAC,KAAK,CAAC;AAErE,SAAS,kBAAkB,CAAC,KAAU,EAAE,KAAiB;IAAjB,sBAAA,EAAA,UAAiB;IACvD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QAC3E,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,MAAM,CAAC,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,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.d.ts b/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.d.ts deleted file mode 100644 index bd5caecc..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function withWarning(func: Function, regex: RegExp): Promise; -//# sourceMappingURL=writeToStore.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.d.ts.map b/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.d.ts.map deleted file mode 100644 index b0a79c29..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"writeToStore.d.ts","sourceRoot":"","sources":["../src/__tests__/writeToStore.ts"],"names":[],"mappings":"AA2BA,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAWxD"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.js b/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.js deleted file mode 100644 index 2c40feb7..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.js +++ /dev/null @@ -1,1523 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var lodash_1 = require("lodash"); -var graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag")); -var apollo_utilities_1 = require("apollo-utilities"); -var writeToStore_1 = require("../writeToStore"); -var objectCache_1 = require("../objectCache"); -var __1 = require("../"); -function withWarning(func, regex) { - var message = null; - var oldWarn = console.warn; - console.warn = function (m) { return (message = m); }; - return Promise.resolve(func()).then(function (val) { - expect(message).toMatch(regex); - console.warn = oldWarn; - return val; - }); -} -exports.withWarning = withWarning; -var getIdField = function (_a) { - var id = _a.id; - return id; -}; -describe('writing to the store', function () { - var writer = new writeToStore_1.StoreWriter(); - it('properly normalizes a trivial item', function () { - var query = graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }) - .toObject()).toEqual({ - ROOT_QUERY: result, - }); - }); - it('properly normalizes an aliased field', function () { - var query = graphql_tag_1.default(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n {\n id\n aliasedField: stringField\n numberField\n nullField\n }\n "], ["\n {\n id\n aliasedField: stringField\n numberField\n nullField\n }\n "]))); - var result = { - id: 'abcd', - aliasedField: 'This is a string!', - numberField: 5, - nullField: null, - }; - var normalized = writer.writeQueryToStore({ - result: result, - query: query, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - }, - }); - }); - it('properly normalizes a aliased fields with arguments', function () { - var query = graphql_tag_1.default(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n {\n id\n aliasedField1: stringField(arg: 1)\n aliasedField2: stringField(arg: 2)\n numberField\n nullField\n }\n "], ["\n {\n id\n aliasedField1: stringField(arg: 1)\n aliasedField2: stringField(arg: 2)\n numberField\n nullField\n }\n "]))); - var result = { - id: 'abcd', - aliasedField1: 'The arg was 1!', - aliasedField2: 'The arg was 2!', - numberField: 5, - nullField: null, - }; - var normalized = writer.writeQueryToStore({ - result: result, - query: query, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'abcd', - 'stringField({"arg":1})': 'The arg was 1!', - 'stringField({"arg":2})': 'The arg was 2!', - numberField: 5, - nullField: null, - }, - }); - }); - it('properly normalizes a query with variables', function () { - var query = graphql_tag_1.default(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "], ["\n {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "]))); - var variables = { - intArg: 5, - floatArg: 3.14, - stringArg: 'This is a string!', - }; - var result = { - id: 'abcd', - stringField: 'Heyo', - numberField: 5, - nullField: null, - }; - var normalized = writer.writeQueryToStore({ - result: result, - query: query, - variables: variables, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'abcd', - nullField: null, - 'numberField({"floatArg":3.14,"intArg":5})': 5, - 'stringField({"arg":"This is a string!"})': 'Heyo', - }, - }); - }); - it('properly normalizes a query with default values', function () { - var query = graphql_tag_1.default(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n query someBigQuery(\n $stringArg: String = \"This is a default string!\"\n $intArg: Int\n $floatArg: Float\n ) {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "], ["\n query someBigQuery(\n $stringArg: String = \"This is a default string!\"\n $intArg: Int\n $floatArg: Float\n ) {\n id\n stringField(arg: $stringArg)\n numberField(intArg: $intArg, floatArg: $floatArg)\n nullField\n }\n "]))); - var variables = { - intArg: 5, - floatArg: 3.14, - }; - var result = { - id: 'abcd', - stringField: 'Heyo', - numberField: 5, - nullField: null, - }; - var normalized = writer.writeQueryToStore({ - result: result, - query: query, - variables: variables, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'abcd', - nullField: null, - 'numberField({"floatArg":3.14,"intArg":5})': 5, - 'stringField({"arg":"This is a default string!"})': 'Heyo', - }, - }); - }); - it('properly normalizes a query with custom directives', function () { - var query = graphql_tag_1.default(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n query {\n id\n firstName @include(if: true)\n lastName @upperCase\n birthDate @dateFormat(format: \"DD-MM-YYYY\")\n }\n "], ["\n query {\n id\n firstName @include(if: true)\n lastName @upperCase\n birthDate @dateFormat(format: \"DD-MM-YYYY\")\n }\n "]))); - var result = { - id: 'abcd', - firstName: 'James', - lastName: 'BOND', - birthDate: '20-05-1940', - }; - var normalized = writer.writeQueryToStore({ - result: result, - query: query, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'abcd', - firstName: 'James', - 'lastName@upperCase': 'BOND', - 'birthDate@dateFormat({"format":"DD-MM-YYYY"})': '20-05-1940', - }, - }); - }); - it('properly normalizes a nested object with an ID', function () { - var _a; - var query = graphql_tag_1.default(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedObj {\n id\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedObj {\n id\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: { - id: 'abcde', - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }) - .toObject()).toEqual((_a = { - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedObj')), { - nestedObj: { - type: 'id', - id: result.nestedObj.id, - generated: false, - }, - }) - }, - _a[result.nestedObj.id] = result.nestedObj, - _a)); - }); - it('properly normalizes a nested object without an ID', function () { - var _a; - var query = graphql_tag_1.default(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedObj {\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedObj {\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: { - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }) - .toObject()).toEqual((_a = { - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedObj')), { - nestedObj: { - type: 'id', - id: "$ROOT_QUERY.nestedObj", - generated: true, - }, - }) - }, - _a["$ROOT_QUERY.nestedObj"] = result.nestedObj, - _a)); - }); - it('properly normalizes a nested object with arguments but without an ID', function () { - var _a; - var query = graphql_tag_1.default(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedObj(arg: \"val\") {\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedObj(arg: \"val\") {\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: { - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }) - .toObject()).toEqual((_a = { - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedObj')), { - 'nestedObj({"arg":"val"})': { - type: 'id', - id: "$ROOT_QUERY.nestedObj({\"arg\":\"val\"})", - generated: true, - }, - }) - }, - _a["$ROOT_QUERY.nestedObj({\"arg\":\"val\"})"] = result.nestedObj, - _a)); - }); - it('properly normalizes a nested array with IDs', function () { - var _a; - var query = graphql_tag_1.default(templateObject_10 || (templateObject_10 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n id\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n id\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedArray: [ - { - id: 'abcde', - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - { - id: 'abcdef', - stringField: 'This is a string also!', - numberField: 7, - nullField: null, - }, - ], - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }) - .toObject()).toEqual((_a = { - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedArray')), { - nestedArray: result.nestedArray.map(function (obj) { return ({ - type: 'id', - id: obj.id, - generated: false, - }); }), - }) - }, - _a[result.nestedArray[0].id] = result.nestedArray[0], - _a[result.nestedArray[1].id] = result.nestedArray[1], - _a)); - }); - it('properly normalizes a nested array with IDs and a null', function () { - var _a; - var query = graphql_tag_1.default(templateObject_11 || (templateObject_11 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n id\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n id\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedArray: [ - { - id: 'abcde', - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - null, - ], - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }) - .toObject()).toEqual((_a = { - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedArray')), { - nestedArray: [ - { type: 'id', id: result.nestedArray[0].id, generated: false }, - null, - ], - }) - }, - _a[result.nestedArray[0].id] = result.nestedArray[0], - _a)); - }); - it('properly normalizes a nested array without IDs', function () { - var _a; - var query = graphql_tag_1.default(templateObject_12 || (templateObject_12 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedArray: [ - { - stringField: 'This is a string too!', - numberField: 6, - nullField: null, - }, - { - stringField: 'This is a string also!', - numberField: 7, - nullField: null, - }, - ], - }; - var normalized = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }); - expect(normalized.toObject()).toEqual((_a = { - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedArray')), { - nestedArray: [ - { type: 'id', generated: true, id: "ROOT_QUERY.nestedArray.0" }, - { type: 'id', generated: true, id: "ROOT_QUERY.nestedArray.1" }, - ], - }) - }, - _a["ROOT_QUERY.nestedArray.0"] = result.nestedArray[0], - _a["ROOT_QUERY.nestedArray.1"] = result.nestedArray[1], - _a)); - }); - it('properly normalizes a nested array without IDs and a null item', function () { - var _a; - var query = graphql_tag_1.default(templateObject_13 || (templateObject_13 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedArray {\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedArray: [ - null, - { - stringField: 'This is a string also!', - numberField: 7, - nullField: null, - }, - ], - }; - var normalized = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }); - expect(normalized.toObject()).toEqual((_a = { - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedArray')), { - nestedArray: [ - null, - { type: 'id', generated: true, id: "ROOT_QUERY.nestedArray.1" }, - ], - }) - }, - _a["ROOT_QUERY.nestedArray.1"] = result.nestedArray[1], - _a)); - }); - it('properly normalizes an array of non-objects', function () { - var query = graphql_tag_1.default(templateObject_14 || (templateObject_14 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n simpleArray\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n simpleArray\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - simpleArray: ['one', 'two', 'three'], - }; - var normalized = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'simpleArray')), { - simpleArray: { - type: 'json', - json: [ - result.simpleArray[0], - result.simpleArray[1], - result.simpleArray[2], - ], - }, - }), - }); - }); - it('properly normalizes an array of non-objects with null', function () { - var query = graphql_tag_1.default(templateObject_15 || (templateObject_15 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n simpleArray\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n simpleArray\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - simpleArray: [null, 'two', 'three'], - }; - var normalized = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'simpleArray')), { - simpleArray: { - type: 'json', - json: [ - result.simpleArray[0], - result.simpleArray[1], - result.simpleArray[2], - ], - }, - }), - }); - }); - it('properly normalizes an object occurring in different graphql paths twice', function () { - var query = graphql_tag_1.default(templateObject_16 || (templateObject_16 = tslib_1.__makeTemplateObject(["\n {\n id\n object1 {\n id\n stringField\n }\n object2 {\n id\n numberField\n }\n }\n "], ["\n {\n id\n object1 {\n id\n stringField\n }\n object2 {\n id\n numberField\n }\n }\n "]))); - var result = { - id: 'a', - object1: { - id: 'aa', - stringField: 'string', - }, - object2: { - id: 'aa', - numberField: 1, - }, - }; - var normalized = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'a', - object1: { - type: 'id', - id: 'aa', - generated: false, - }, - object2: { - type: 'id', - id: 'aa', - generated: false, - }, - }, - aa: { - id: 'aa', - stringField: 'string', - numberField: 1, - }, - }); - }); - it('properly normalizes an object occurring in different graphql array paths twice', function () { - var query = graphql_tag_1.default(templateObject_17 || (templateObject_17 = tslib_1.__makeTemplateObject(["\n {\n id\n array1 {\n id\n stringField\n obj {\n id\n stringField\n }\n }\n array2 {\n id\n stringField\n obj {\n id\n numberField\n }\n }\n }\n "], ["\n {\n id\n array1 {\n id\n stringField\n obj {\n id\n stringField\n }\n }\n array2 {\n id\n stringField\n obj {\n id\n numberField\n }\n }\n }\n "]))); - var result = { - id: 'a', - array1: [ - { - id: 'aa', - stringField: 'string', - obj: { - id: 'aaa', - stringField: 'string', - }, - }, - ], - array2: [ - { - id: 'ab', - stringField: 'string2', - obj: { - id: 'aaa', - numberField: 1, - }, - }, - ], - }; - var normalized = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'a', - array1: [ - { - type: 'id', - id: 'aa', - generated: false, - }, - ], - array2: [ - { - type: 'id', - id: 'ab', - generated: false, - }, - ], - }, - aa: { - id: 'aa', - stringField: 'string', - obj: { - type: 'id', - id: 'aaa', - generated: false, - }, - }, - ab: { - id: 'ab', - stringField: 'string2', - obj: { - type: 'id', - id: 'aaa', - generated: false, - }, - }, - aaa: { - id: 'aaa', - stringField: 'string', - numberField: 1, - }, - }); - }); - it('properly normalizes an object occurring in the same graphql array path twice', function () { - var query = graphql_tag_1.default(templateObject_18 || (templateObject_18 = tslib_1.__makeTemplateObject(["\n {\n id\n array1 {\n id\n stringField\n obj {\n id\n stringField\n numberField\n }\n }\n }\n "], ["\n {\n id\n array1 {\n id\n stringField\n obj {\n id\n stringField\n numberField\n }\n }\n }\n "]))); - var result = { - id: 'a', - array1: [ - { - id: 'aa', - stringField: 'string', - obj: { - id: 'aaa', - stringField: 'string', - numberField: 1, - }, - }, - { - id: 'ab', - stringField: 'string2', - obj: { - id: 'aaa', - stringField: 'should not be written', - numberField: 2, - }, - }, - ], - }; - var normalized = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }); - expect(normalized.toObject()).toEqual({ - ROOT_QUERY: { - id: 'a', - array1: [ - { - type: 'id', - id: 'aa', - generated: false, - }, - { - type: 'id', - id: 'ab', - generated: false, - }, - ], - }, - aa: { - id: 'aa', - stringField: 'string', - obj: { - type: 'id', - id: 'aaa', - generated: false, - }, - }, - ab: { - id: 'ab', - stringField: 'string2', - obj: { - type: 'id', - id: 'aaa', - generated: false, - }, - }, - aaa: { - id: 'aaa', - stringField: 'string', - numberField: 1, - }, - }); - }); - it('merges nodes', function () { - var query = graphql_tag_1.default(templateObject_19 || (templateObject_19 = tslib_1.__makeTemplateObject(["\n {\n id\n numberField\n nullField\n }\n "], ["\n {\n id\n numberField\n nullField\n }\n "]))); - var result = { - id: 'abcd', - numberField: 5, - nullField: null, - }; - var store = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - dataIdFromObject: getIdField, - }); - var query2 = graphql_tag_1.default(templateObject_20 || (templateObject_20 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n nullField\n }\n "], ["\n {\n id\n stringField\n nullField\n }\n "]))); - var result2 = { - id: 'abcd', - stringField: 'This is a string!', - nullField: null, - }; - var store2 = writer.writeQueryToStore({ - store: store, - query: query2, - result: result2, - dataIdFromObject: getIdField, - }); - expect(store2.toObject()).toEqual({ - ROOT_QUERY: lodash_1.assign({}, result, result2), - }); - }); - it('properly normalizes a nested object that returns null', function () { - var query = graphql_tag_1.default(templateObject_21 || (templateObject_21 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n nestedObj {\n id\n stringField\n numberField\n nullField\n }\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n nestedObj {\n id\n stringField\n numberField\n nullField\n }\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - nestedObj: null, - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }) - .toObject()).toEqual({ - ROOT_QUERY: lodash_1.assign({}, lodash_1.assign({}, lodash_1.omit(result, 'nestedObj')), { - nestedObj: null, - }), - }); - }); - it('properly normalizes an object with an ID when no extension is passed', function () { - var query = graphql_tag_1.default(templateObject_22 || (templateObject_22 = tslib_1.__makeTemplateObject(["\n {\n people_one(id: \"5\") {\n id\n stringField\n }\n }\n "], ["\n {\n people_one(id: \"5\") {\n id\n stringField\n }\n }\n "]))); - var result = { - people_one: { - id: 'abcd', - stringField: 'This is a string!', - }, - }; - expect(writer - .writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }) - .toObject()).toEqual({ - ROOT_QUERY: { - 'people_one({"id":"5"})': { - type: 'id', - id: '$ROOT_QUERY.people_one({"id":"5"})', - generated: true, - }, - }, - '$ROOT_QUERY.people_one({"id":"5"})': { - id: 'abcd', - stringField: 'This is a string!', - }, - }); - }); - it('consistently serialize different types of input when passed inlined or as variable', function () { - var testData = [ - { - mutation: graphql_tag_1.default(templateObject_23 || (templateObject_23 = tslib_1.__makeTemplateObject(["\n mutation mut($in: Int!) {\n mut(inline: 5, variable: $in) {\n id\n }\n }\n "], ["\n mutation mut($in: Int!) {\n mut(inline: 5, variable: $in) {\n id\n }\n }\n "]))), - variables: { in: 5 }, - expected: 'mut({"inline":5,"variable":5})', - }, - { - mutation: graphql_tag_1.default(templateObject_24 || (templateObject_24 = tslib_1.__makeTemplateObject(["\n mutation mut($in: Float!) {\n mut(inline: 5.5, variable: $in) {\n id\n }\n }\n "], ["\n mutation mut($in: Float!) {\n mut(inline: 5.5, variable: $in) {\n id\n }\n }\n "]))), - variables: { in: 5.5 }, - expected: 'mut({"inline":5.5,"variable":5.5})', - }, - { - mutation: graphql_tag_1.default(templateObject_25 || (templateObject_25 = tslib_1.__makeTemplateObject(["\n mutation mut($in: String!) {\n mut(inline: \"abc\", variable: $in) {\n id\n }\n }\n "], ["\n mutation mut($in: String!) {\n mut(inline: \"abc\", variable: $in) {\n id\n }\n }\n "]))), - variables: { in: 'abc' }, - expected: 'mut({"inline":"abc","variable":"abc"})', - }, - { - mutation: graphql_tag_1.default(templateObject_26 || (templateObject_26 = tslib_1.__makeTemplateObject(["\n mutation mut($in: Array!) {\n mut(inline: [1, 2], variable: $in) {\n id\n }\n }\n "], ["\n mutation mut($in: Array!) {\n mut(inline: [1, 2], variable: $in) {\n id\n }\n }\n "]))), - variables: { in: [1, 2] }, - expected: 'mut({"inline":[1,2],"variable":[1,2]})', - }, - { - mutation: graphql_tag_1.default(templateObject_27 || (templateObject_27 = tslib_1.__makeTemplateObject(["\n mutation mut($in: Object!) {\n mut(inline: { a: 1 }, variable: $in) {\n id\n }\n }\n "], ["\n mutation mut($in: Object!) {\n mut(inline: { a: 1 }, variable: $in) {\n id\n }\n }\n "]))), - variables: { in: { a: 1 } }, - expected: 'mut({"inline":{"a":1},"variable":{"a":1}})', - }, - { - mutation: graphql_tag_1.default(templateObject_28 || (templateObject_28 = tslib_1.__makeTemplateObject(["\n mutation mut($in: Boolean!) {\n mut(inline: true, variable: $in) {\n id\n }\n }\n "], ["\n mutation mut($in: Boolean!) {\n mut(inline: true, variable: $in) {\n id\n }\n }\n "]))), - variables: { in: true }, - expected: 'mut({"inline":true,"variable":true})', - }, - ]; - function isOperationDefinition(definition) { - return definition.kind === 'OperationDefinition'; - } - function isField(selection) { - return selection.kind === 'Field'; - } - testData.forEach(function (data) { - data.mutation.definitions.forEach(function (definition) { - if (isOperationDefinition(definition)) { - definition.selectionSet.selections.forEach(function (selection) { - if (isField(selection)) { - expect(apollo_utilities_1.storeKeyNameFromField(selection, data.variables)).toEqual(data.expected); - } - }); - } - }); - }); - }); - it('properly normalizes a mutation with object or array parameters and variables', function () { - var mutation = graphql_tag_1.default(templateObject_29 || (templateObject_29 = tslib_1.__makeTemplateObject(["\n mutation some_mutation($nil: ID, $in: Object) {\n some_mutation(\n input: {\n id: \"5\"\n arr: [1, { a: \"b\" }]\n obj: { a: \"b\" }\n num: 5.5\n nil: $nil\n bo: true\n }\n ) {\n id\n }\n some_mutation_with_variables(input: $in) {\n id\n }\n }\n "], ["\n mutation some_mutation($nil: ID, $in: Object) {\n some_mutation(\n input: {\n id: \"5\"\n arr: [1, { a: \"b\" }]\n obj: { a: \"b\" }\n num: 5.5\n nil: $nil\n bo: true\n }\n ) {\n id\n }\n some_mutation_with_variables(input: $in) {\n id\n }\n }\n "]))); - var result = { - some_mutation: { - id: 'id', - }, - some_mutation_with_variables: { - id: 'id', - }, - }; - var variables = { - nil: null, - in: { - id: '5', - arr: [1, { a: 'b' }], - obj: { a: 'b' }, - num: 5.5, - nil: null, - bo: true, - }, - }; - function isOperationDefinition(value) { - return value.kind === 'OperationDefinition'; - } - mutation.definitions.map(function (def) { - if (isOperationDefinition(def)) { - expect(writer - .writeSelectionSetToStore({ - dataId: '5', - selectionSet: def.selectionSet, - result: lodash_1.cloneDeep(result), - context: { - store: objectCache_1.defaultNormalizedCacheFactory(), - variables: variables, - dataIdFromObject: function () { return '5'; }, - }, - }) - .toObject()).toEqual({ - '5': { - id: 'id', - 'some_mutation({"input":{"arr":[1,{"a":"b"}],"bo":true,"id":"5","nil":null,"num":5.5,"obj":{"a":"b"}}})': { - generated: false, - id: '5', - type: 'id', - }, - 'some_mutation_with_variables({"input":{"arr":[1,{"a":"b"}],"bo":true,"id":"5","nil":null,"num":5.5,"obj":{"a":"b"}}})': { - generated: false, - id: '5', - type: 'id', - }, - }, - }); - } - else { - throw 'No operation definition found'; - } - }); - }); - it('should write to store if `dataIdFromObject` returns an ID of 0', function () { - var query = graphql_tag_1.default(templateObject_30 || (templateObject_30 = tslib_1.__makeTemplateObject(["\n query {\n author {\n firstName\n id\n __typename\n }\n }\n "], ["\n query {\n author {\n firstName\n id\n __typename\n }\n }\n "]))); - var data = { - author: { - id: 0, - __typename: 'Author', - firstName: 'John', - }, - }; - var expStore = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: { - author: { - id: 0, - typename: 'Author', - type: 'id', - generated: false, - }, - }, - 0: { - id: data.author.id, - __typename: data.author.__typename, - firstName: data.author.firstName, - }, - }); - expect(writer - .writeQueryToStore({ - result: data, - query: query, - dataIdFromObject: function () { return 0; }, - }) - .toObject()).toEqual(expStore.toObject()); - }); - describe('type escaping', function () { - var dataIdFromObject = function (object) { - if (object.__typename && object.id) { - return object.__typename + '__' + object.id; - } - return undefined; - }; - it('should correctly escape generated ids', function () { - var query = graphql_tag_1.default(templateObject_31 || (templateObject_31 = tslib_1.__makeTemplateObject(["\n query {\n author {\n firstName\n lastName\n }\n }\n "], ["\n query {\n author {\n firstName\n lastName\n }\n }\n "]))); - var data = { - author: { - firstName: 'John', - lastName: 'Smith', - }, - }; - var expStore = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: { - author: { - type: 'id', - id: '$ROOT_QUERY.author', - generated: true, - }, - }, - '$ROOT_QUERY.author': data.author, - }); - expect(writer - .writeQueryToStore({ - result: data, - query: query, - }) - .toObject()).toEqual(expStore.toObject()); - }); - it('should correctly escape real ids', function () { - var _a; - var query = graphql_tag_1.default(templateObject_32 || (templateObject_32 = tslib_1.__makeTemplateObject(["\n query {\n author {\n firstName\n id\n __typename\n }\n }\n "], ["\n query {\n author {\n firstName\n id\n __typename\n }\n }\n "]))); - var data = { - author: { - firstName: 'John', - id: '129', - __typename: 'Author', - }, - }; - var expStore = objectCache_1.defaultNormalizedCacheFactory((_a = { - ROOT_QUERY: { - author: { - type: 'id', - id: dataIdFromObject(data.author), - generated: false, - typename: 'Author', - }, - } - }, - _a[dataIdFromObject(data.author)] = { - firstName: data.author.firstName, - id: data.author.id, - __typename: data.author.__typename, - }, - _a)); - expect(writer - .writeQueryToStore({ - result: data, - query: query, - dataIdFromObject: dataIdFromObject, - }) - .toObject()).toEqual(expStore.toObject()); - }); - it('should correctly escape json blobs', function () { - var _a; - var query = graphql_tag_1.default(templateObject_33 || (templateObject_33 = tslib_1.__makeTemplateObject(["\n query {\n author {\n info\n id\n __typename\n }\n }\n "], ["\n query {\n author {\n info\n id\n __typename\n }\n }\n "]))); - var data = { - author: { - info: { - name: 'John', - }, - id: '129', - __typename: 'Author', - }, - }; - var expStore = objectCache_1.defaultNormalizedCacheFactory((_a = { - ROOT_QUERY: { - author: { - type: 'id', - id: dataIdFromObject(data.author), - generated: false, - typename: 'Author', - }, - } - }, - _a[dataIdFromObject(data.author)] = { - __typename: data.author.__typename, - id: data.author.id, - info: { - type: 'json', - json: data.author.info, - }, - }, - _a)); - expect(writer - .writeQueryToStore({ - result: data, - query: query, - dataIdFromObject: dataIdFromObject, - }) - .toObject()).toEqual(expStore.toObject()); - }); - }); - it('should merge objects when overwriting a generated id with a real id', function () { - var dataWithoutId = { - author: { - firstName: 'John', - lastName: 'Smith', - __typename: 'Author', - }, - }; - var dataWithId = { - author: { - firstName: 'John', - id: '129', - __typename: 'Author', - }, - }; - var dataIdFromObject = function (object) { - if (object.__typename && object.id) { - return object.__typename + '__' + object.id; - } - return undefined; - }; - var queryWithoutId = graphql_tag_1.default(templateObject_34 || (templateObject_34 = tslib_1.__makeTemplateObject(["\n query {\n author {\n firstName\n lastName\n __typename\n }\n }\n "], ["\n query {\n author {\n firstName\n lastName\n __typename\n }\n }\n "]))); - var queryWithId = graphql_tag_1.default(templateObject_35 || (templateObject_35 = tslib_1.__makeTemplateObject(["\n query {\n author {\n firstName\n id\n __typename\n }\n }\n "], ["\n query {\n author {\n firstName\n id\n __typename\n }\n }\n "]))); - var expStoreWithoutId = objectCache_1.defaultNormalizedCacheFactory({ - '$ROOT_QUERY.author': { - firstName: 'John', - lastName: 'Smith', - __typename: 'Author', - }, - ROOT_QUERY: { - author: { - type: 'id', - id: '$ROOT_QUERY.author', - generated: true, - typename: 'Author', - }, - }, - }); - var expStoreWithId = objectCache_1.defaultNormalizedCacheFactory({ - Author__129: { - firstName: 'John', - lastName: 'Smith', - id: '129', - __typename: 'Author', - }, - ROOT_QUERY: { - author: { - type: 'id', - id: 'Author__129', - generated: false, - typename: 'Author', - }, - }, - }); - var storeWithoutId = writer.writeQueryToStore({ - result: dataWithoutId, - query: queryWithoutId, - dataIdFromObject: dataIdFromObject, - }); - expect(storeWithoutId.toObject()).toEqual(expStoreWithoutId.toObject()); - var storeWithId = writer.writeQueryToStore({ - result: dataWithId, - query: queryWithId, - store: storeWithoutId, - dataIdFromObject: dataIdFromObject, - }); - expect(storeWithId.toObject()).toEqual(expStoreWithId.toObject()); - }); - it('should allow a union of objects of a different type, when overwriting a generated id with a real id', function () { - var dataWithPlaceholder = { - author: { - hello: 'Foo', - __typename: 'Placeholder', - }, - }; - var dataWithAuthor = { - author: { - firstName: 'John', - lastName: 'Smith', - id: '129', - __typename: 'Author', - }, - }; - var dataIdFromObject = function (object) { - if (object.__typename && object.id) { - return object.__typename + '__' + object.id; - } - return undefined; - }; - var query = graphql_tag_1.default(templateObject_36 || (templateObject_36 = tslib_1.__makeTemplateObject(["\n query {\n author {\n ... on Author {\n firstName\n lastName\n id\n __typename\n }\n ... on Placeholder {\n hello\n __typename\n }\n }\n }\n "], ["\n query {\n author {\n ... on Author {\n firstName\n lastName\n id\n __typename\n }\n ... on Placeholder {\n hello\n __typename\n }\n }\n }\n "]))); - var expStoreWithPlaceholder = objectCache_1.defaultNormalizedCacheFactory({ - '$ROOT_QUERY.author': { - hello: 'Foo', - __typename: 'Placeholder', - }, - ROOT_QUERY: { - author: { - type: 'id', - id: '$ROOT_QUERY.author', - generated: true, - typename: 'Placeholder', - }, - }, - }); - var expStoreWithAuthor = objectCache_1.defaultNormalizedCacheFactory({ - Author__129: { - firstName: 'John', - lastName: 'Smith', - id: '129', - __typename: 'Author', - }, - ROOT_QUERY: { - author: { - type: 'id', - id: 'Author__129', - generated: false, - typename: 'Author', - }, - }, - }); - var store = writer.writeQueryToStore({ - result: dataWithPlaceholder, - query: query, - dataIdFromObject: dataIdFromObject, - }); - expect(store.toObject()).toEqual(expStoreWithPlaceholder.toObject()); - writer.writeQueryToStore({ - result: dataWithAuthor, - query: query, - store: store, - dataIdFromObject: dataIdFromObject, - }); - expect(store.toObject()).toEqual(expStoreWithAuthor.toObject()); - writer.writeQueryToStore({ - result: dataWithPlaceholder, - query: query, - store: store, - dataIdFromObject: dataIdFromObject, - }); - expect(store.toObject()).toEqual(tslib_1.__assign(tslib_1.__assign({}, expStoreWithAuthor.toObject()), expStoreWithPlaceholder.toObject())); - }); - it('does not swallow errors other than field errors', function () { - var query = graphql_tag_1.default(templateObject_37 || (templateObject_37 = tslib_1.__makeTemplateObject(["\n query {\n ...notARealFragment\n fortuneCookie\n }\n "], ["\n query {\n ...notARealFragment\n fortuneCookie\n }\n "]))); - var result = { - fortuneCookie: 'Star Wars unit tests are boring', - }; - expect(function () { - writer.writeQueryToStore({ - result: result, - query: query, - }); - }).toThrowError(/No fragment/); - }); - it('does not change object references if the value is the same', function () { - var query = graphql_tag_1.default(templateObject_38 || (templateObject_38 = tslib_1.__makeTemplateObject(["\n {\n id\n stringField\n numberField\n nullField\n }\n "], ["\n {\n id\n stringField\n numberField\n nullField\n }\n "]))); - var result = { - id: 'abcd', - stringField: 'This is a string!', - numberField: 5, - nullField: null, - }; - var store = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - }); - var newStore = writer.writeQueryToStore({ - query: query, - result: lodash_1.cloneDeep(result), - store: objectCache_1.defaultNormalizedCacheFactory(store.toObject()), - }); - Object.keys(store.toObject()).forEach(function (field) { - expect(store.get(field)).toEqual(newStore.get(field)); - }); - }); - describe('writeResultToStore shape checking', function () { - var query = graphql_tag_1.default(templateObject_39 || (templateObject_39 = tslib_1.__makeTemplateObject(["\n query {\n todos {\n id\n name\n description\n }\n }\n "], ["\n query {\n todos {\n id\n name\n description\n }\n }\n "]))); - it('should write the result data without validating its shape when a fragment matcher is not provided', function () { - var result = { - todos: [ - { - id: '1', - name: 'Todo 1', - }, - ], - }; - var newStore = writer.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: query, - dataIdFromObject: getIdField, - }); - expect(newStore.get('1')).toEqual(result.todos[0]); - }); - it('should warn when it receives the wrong data with non-union fragments (using an heuristic matcher)', function () { - var fragmentMatcherFunction = new __1.HeuristicFragmentMatcher().match; - var result = { - todos: [ - { - id: '1', - name: 'Todo 1', - }, - ], - }; - return withWarning(function () { - var newStore = writer.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: query, - dataIdFromObject: getIdField, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - expect(newStore.get('1')).toEqual(result.todos[0]); - }, /Missing field description/); - }); - it('should warn when it receives the wrong data inside a fragment (using an introspection matcher)', function () { - var fragmentMatcherFunction = new __1.IntrospectionFragmentMatcher({ - introspectionQueryResultData: { - __schema: { - types: [ - { - kind: 'UNION', - name: 'Todo', - possibleTypes: [ - { name: 'ShoppingCartItem' }, - { name: 'TaskItem' }, - ], - }, - ], - }, - }, - }).match; - var queryWithInterface = graphql_tag_1.default(templateObject_40 || (templateObject_40 = tslib_1.__makeTemplateObject(["\n query {\n todos {\n id\n name\n description\n ...TodoFragment\n }\n }\n\n fragment TodoFragment on Todo {\n ... on ShoppingCartItem {\n price\n __typename\n }\n ... on TaskItem {\n date\n __typename\n }\n __typename\n }\n "], ["\n query {\n todos {\n id\n name\n description\n ...TodoFragment\n }\n }\n\n fragment TodoFragment on Todo {\n ... on ShoppingCartItem {\n price\n __typename\n }\n ... on TaskItem {\n date\n __typename\n }\n __typename\n }\n "]))); - var result = { - todos: [ - { - id: '1', - name: 'Todo 1', - description: 'Description 1', - __typename: 'ShoppingCartItem', - }, - ], - }; - return withWarning(function () { - var newStore = writer.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: queryWithInterface, - dataIdFromObject: getIdField, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - expect(newStore.get('1')).toEqual(result.todos[0]); - }, /Missing field price/); - }); - it('should warn if a result is missing __typename when required (using an heuristic matcher)', function () { - var fragmentMatcherFunction = new __1.HeuristicFragmentMatcher().match; - var result = { - todos: [ - { - id: '1', - name: 'Todo 1', - description: 'Description 1', - }, - ], - }; - return withWarning(function () { - var newStore = writer.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: apollo_utilities_1.addTypenameToDocument(query), - dataIdFromObject: getIdField, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - expect(newStore.get('1')).toEqual(result.todos[0]); - }, /Missing field __typename/); - }); - it('should not warn if a field is null', function () { - var result = { - todos: null, - }; - var newStore = writer.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: query, - dataIdFromObject: getIdField, - }); - expect(newStore.get('ROOT_QUERY')).toEqual({ todos: null }); - }); - it('should not warn if a field is defered', function () { - var originalWarn = console.warn; - console.warn = jest.fn(function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - }); - var defered = graphql_tag_1.default(templateObject_41 || (templateObject_41 = tslib_1.__makeTemplateObject(["\n query LazyLoad {\n id\n expensive @defer\n }\n "], ["\n query LazyLoad {\n id\n expensive @defer\n }\n "]))); - var result = { - id: 1, - }; - var fragmentMatcherFunction = new __1.HeuristicFragmentMatcher().match; - var newStore = writer.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: defered, - dataIdFromObject: getIdField, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - expect(newStore.get('ROOT_QUERY')).toEqual({ id: 1 }); - expect(console.warn).not.toBeCalled(); - console.warn = originalWarn; - }); - }); - it('throws when trying to write an object without id that was previously queried with id', function () { - var store = objectCache_1.defaultNormalizedCacheFactory({ - ROOT_QUERY: lodash_1.assign({}, { - __typename: 'Query', - item: { - type: 'id', - id: 'abcd', - generated: false, - }, - }), - abcd: lodash_1.assign({}, { - id: 'abcd', - __typename: 'Item', - stringField: 'This is a string!', - }), - }); - expect(function () { - writer.writeQueryToStore({ - store: store, - result: { - item: { - __typename: 'Item', - stringField: 'This is still a string!', - }, - }, - query: graphql_tag_1.default(templateObject_42 || (templateObject_42 = tslib_1.__makeTemplateObject(["\n query Failure {\n item {\n stringField\n }\n }\n "], ["\n query Failure {\n item {\n stringField\n }\n }\n "]))), - dataIdFromObject: getIdField, - }); - }).toThrowErrorMatchingSnapshot(); - expect(function () { - writer.writeResultToStore({ - store: store, - result: { - item: { - __typename: 'Item', - stringField: 'This is still a string!', - }, - }, - dataId: 'ROOT_QUERY', - document: graphql_tag_1.default(templateObject_43 || (templateObject_43 = tslib_1.__makeTemplateObject(["\n query {\n item {\n stringField\n }\n }\n "], ["\n query {\n item {\n stringField\n }\n }\n "]))), - dataIdFromObject: getIdField, - }); - }).toThrowError(/stringField(.|\n)*abcd/g); - }); - it('properly handles the connection directive', function () { - var store = objectCache_1.defaultNormalizedCacheFactory(); - writer.writeQueryToStore({ - query: graphql_tag_1.default(templateObject_44 || (templateObject_44 = tslib_1.__makeTemplateObject(["\n {\n books(skip: 0, limit: 2) @connection(key: \"abc\") {\n name\n }\n }\n "], ["\n {\n books(skip: 0, limit: 2) @connection(key: \"abc\") {\n name\n }\n }\n "]))), - result: { - books: [ - { - name: 'abcd', - }, - ], - }, - store: store, - }); - writer.writeQueryToStore({ - query: graphql_tag_1.default(templateObject_45 || (templateObject_45 = tslib_1.__makeTemplateObject(["\n {\n books(skip: 2, limit: 4) @connection(key: \"abc\") {\n name\n }\n }\n "], ["\n {\n books(skip: 2, limit: 4) @connection(key: \"abc\") {\n name\n }\n }\n "]))), - result: { - books: [ - { - name: 'efgh', - }, - ], - }, - store: store, - }); - expect(store.toObject()).toEqual({ - ROOT_QUERY: { - abc: [ - { - generated: true, - id: 'ROOT_QUERY.abc.0', - type: 'id', - }, - ], - }, - 'ROOT_QUERY.abc.0': { - name: 'efgh', - }, - }); - }); - it('should keep reference when type of mixed inlined field changes', function () { - var store = objectCache_1.defaultNormalizedCacheFactory(); - var query = graphql_tag_1.default(templateObject_46 || (templateObject_46 = tslib_1.__makeTemplateObject(["\n query {\n animals {\n species {\n name\n }\n }\n }\n "], ["\n query {\n animals {\n species {\n name\n }\n }\n }\n "]))); - writer.writeQueryToStore({ - query: query, - result: { - animals: [ - { - __typename: 'Animal', - species: { - __typename: 'Cat', - name: 'cat', - }, - }, - ], - }, - store: store, - }); - expect(store.toObject()).toEqual({ - '$ROOT_QUERY.animals.0.species': { name: 'cat' }, - ROOT_QUERY: { - animals: [ - { - generated: true, - id: 'ROOT_QUERY.animals.0', - type: 'id', - typename: 'Animal', - }, - ], - }, - 'ROOT_QUERY.animals.0': { - species: { - generated: true, - id: '$ROOT_QUERY.animals.0.species', - type: 'id', - typename: 'Cat', - }, - }, - }); - writer.writeQueryToStore({ - query: query, - result: { - animals: [ - { - __typename: 'Animal', - species: { - __typename: 'Dog', - name: 'dog', - }, - }, - ], - }, - store: store, - }); - expect(store.toObject()).toEqual({ - '$ROOT_QUERY.animals.0.species': { name: 'dog' }, - ROOT_QUERY: { - animals: [ - { - generated: true, - id: 'ROOT_QUERY.animals.0', - type: 'id', - typename: 'Animal', - }, - ], - }, - 'ROOT_QUERY.animals.0': { - species: { - generated: true, - id: '$ROOT_QUERY.animals.0.species', - type: 'id', - typename: 'Dog', - }, - }, - }); - }); - it('should not keep reference when type of mixed inlined field changes to non-inlined field', function () { - var store = objectCache_1.defaultNormalizedCacheFactory(); - var dataIdFromObject = function (object) { - if (object.__typename && object.id) { - return object.__typename + '__' + object.id; - } - return undefined; - }; - var query = graphql_tag_1.default(templateObject_47 || (templateObject_47 = tslib_1.__makeTemplateObject(["\n query {\n animals {\n species {\n id\n name\n }\n }\n }\n "], ["\n query {\n animals {\n species {\n id\n name\n }\n }\n }\n "]))); - writer.writeQueryToStore({ - query: query, - result: { - animals: [ - { - __typename: 'Animal', - species: { - __typename: 'Cat', - name: 'cat', - }, - }, - ], - }, - dataIdFromObject: dataIdFromObject, - store: store, - }); - expect(store.toObject()).toEqual({ - '$ROOT_QUERY.animals.0.species': { name: 'cat' }, - ROOT_QUERY: { - animals: [ - { - generated: true, - id: 'ROOT_QUERY.animals.0', - type: 'id', - typename: 'Animal', - }, - ], - }, - 'ROOT_QUERY.animals.0': { - species: { - generated: true, - id: '$ROOT_QUERY.animals.0.species', - type: 'id', - typename: 'Cat', - }, - }, - }); - writer.writeQueryToStore({ - query: query, - result: { - animals: [ - { - __typename: 'Animal', - species: { - id: 'dog-species', - __typename: 'Dog', - name: 'dog', - }, - }, - ], - }, - dataIdFromObject: dataIdFromObject, - store: store, - }); - expect(store.toObject()).toEqual({ - '$ROOT_QUERY.animals.0.species': undefined, - 'Dog__dog-species': { - id: 'dog-species', - name: 'dog', - }, - ROOT_QUERY: { - animals: [ - { - generated: true, - id: 'ROOT_QUERY.animals.0', - type: 'id', - typename: 'Animal', - }, - ], - }, - 'ROOT_QUERY.animals.0': { - species: { - generated: false, - id: 'Dog__dog-species', - type: 'id', - typename: 'Dog', - }, - }, - }); - }); -}); -var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33, templateObject_34, templateObject_35, templateObject_36, templateObject_37, templateObject_38, templateObject_39, templateObject_40, templateObject_41, templateObject_42, templateObject_43, templateObject_44, templateObject_45, templateObject_46, templateObject_47; -//# sourceMappingURL=writeToStore.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.js.map b/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.js.map deleted file mode 100644 index ceefa3d3..00000000 --- a/node_modules/apollo-cache-inmemory/lib/__tests__/writeToStore.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"writeToStore.js","sourceRoot":"","sources":["../../src/__tests__/writeToStore.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AAUjD,oEAA8B;AAC9B,qDAI0B;AAE1B,gDAA8C;AAE9C,8CAA+D;AAE/D,yBAIa;AAEb,SAAgB,WAAW,CAAC,IAAc,EAAE,KAAa;IACvD,IAAI,OAAO,GAAW,IAAa,CAAC;IACpC,IAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7B,OAAO,CAAC,IAAI,GAAG,UAAC,CAAS,IAAK,OAAA,CAAC,OAAO,GAAG,CAAC,CAAC,EAAb,CAAa,CAAC;IAE5C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG;QACrC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;QACvB,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,kCAWC;AAED,IAAM,UAAU,GAAG,UAAC,EAAsB;QAApB,UAAE;IAAuB,OAAA,EAAE;AAAF,CAAE,CAAC;AAElD,QAAQ,CAAC,sBAAsB,EAAE;IAC/B,IAAM,MAAM,GAAG,IAAI,0BAAW,EAAE,CAAC;IAEjC,EAAE,CAAC,oCAAoC,EAAE;QACvC,IAAM,KAAK,GAAG,qBAAG,8KAAA,mGAOhB,IAAA,CAAC;QAEF,IAAM,MAAM,GAAQ;YAClB,EAAE,EAAE,MAAM;YACV,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,IAAI;SAChB,CAAC;QAEF,MAAM,CACJ,MAAM;aACH,iBAAiB,CAAC;YACjB,KAAK,OAAA;YACL,MAAM,EAAE,kBAAS,CAAC,MAAM,CAAC;SAC1B,CA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AE,EAAE,sBAAsB;wBAC1B,IAAI,EAAE,IAAI;wBACV,QAAQ,EAAE,QAAQ;qBACnB;iBACF;aACF;YACD,sBAAsB,EAAE;gBACtB,OAAO,EAAE;oBACP,SAAS,EAAE,KAAK;oBAChB,EAAE,EAAE,kBAAkB;oBACtB,IAAI,EAAE,IAAI;oBACV,QAAQ,EAAE,KAAK;iBAChB;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js b/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js deleted file mode 100644 index 425a2216..00000000 --- a/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js +++ /dev/null @@ -1,1280 +0,0 @@ -exports.__esModule = true; -exports.assertIdValue = assertIdValue; -exports.defaultDataIdFromObject = defaultDataIdFromObject; -exports.defaultNormalizedCacheFactory = defaultNormalizedCacheFactory$1; -exports.enhanceErrorWithDocument = enhanceErrorWithDocument; -exports.WriteError = exports.StoreWriter = exports.StoreReader = exports.ObjectCache = exports.IntrospectionFragmentMatcher = exports.InMemoryCache = exports.HeuristicFragmentMatcher = void 0; - -var _tslib = require("tslib"); - -var _apolloCache = require("apollo-cache"); - -var _apolloUtilities = require("apollo-utilities"); - -var _optimism = require("optimism"); - -var _tsInvariant = require("ts-invariant"); - -var haveWarned = false; - -function shouldWarn() { - var answer = !haveWarned; - - if (!(0, _apolloUtilities.isTest)()) { - haveWarned = true; - } - - return answer; -} - -var HeuristicFragmentMatcher = function () { - function HeuristicFragmentMatcher() {} - - HeuristicFragmentMatcher.prototype.ensureReady = function () { - return Promise.resolve(); - }; - - HeuristicFragmentMatcher.prototype.canBypassInit = function () { - return true; - }; - - HeuristicFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - - if (!obj) { - return isRootQuery; - } - - var _a = obj.__typename, - __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - - if (!__typename) { - if (shouldWarn()) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments."); - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Could not find __typename on Fragment ', typeCondition, obj); - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("DEPRECATION WARNING: using fragments without __typename is unsupported behavior " + "and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now."); - } - - return 'heuristic'; - } - - if (__typename === typeCondition) { - return true; - } - - if (shouldWarn()) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('You are using the simple (heuristic) fragment matcher, but your ' + 'queries contain union or interface types. Apollo Client will not be ' + 'able to accurately map fragments. To make this error go away, use ' + 'the `IntrospectionFragmentMatcher` as described in the docs: ' + 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher'); - } - - return 'heuristic'; - }; - - return HeuristicFragmentMatcher; -}(); - -exports.HeuristicFragmentMatcher = HeuristicFragmentMatcher; - -var IntrospectionFragmentMatcher = function () { - function IntrospectionFragmentMatcher(options) { - if (options && options.introspectionQueryResultData) { - this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData); - this.isReady = true; - } else { - this.isReady = false; - } - - this.match = this.match.bind(this); - } - - IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(this.isReady, 1) : (0, _tsInvariant.invariant)(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()'); - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - - if (!obj) { - return isRootQuery; - } - - var _a = obj.__typename, - __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(__typename, 2) : (0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj)); - - if (__typename === typeCondition) { - return true; - } - - var implementingTypes = this.possibleTypesMap[typeCondition]; - - if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) { - return true; - } - - return false; - }; - - IntrospectionFragmentMatcher.prototype.parseIntrospectionResult = function (introspectionResultData) { - var typeMap = {}; - - introspectionResultData.__schema.types.forEach(function (type) { - if (type.kind === 'UNION' || type.kind === 'INTERFACE') { - typeMap[type.name] = type.possibleTypes.map(function (implementingType) { - return implementingType.name; - }); - } - }); - - return typeMap; - }; - - return IntrospectionFragmentMatcher; -}(); - -exports.IntrospectionFragmentMatcher = IntrospectionFragmentMatcher; -var hasOwn = Object.prototype.hasOwnProperty; - -var DepTrackingCache = function () { - function DepTrackingCache(data) { - var _this = this; - - if (data === void 0) { - data = Object.create(null); - } - - this.data = data; - this.depend = (0, _optimism.wrap)(function (dataId) { - return _this.data[dataId]; - }, { - disposable: true, - makeCacheKey: function (dataId) { - return dataId; - } - }); - } - - DepTrackingCache.prototype.toObject = function () { - return this.data; - }; - - DepTrackingCache.prototype.get = function (dataId) { - this.depend(dataId); - return this.data[dataId]; - }; - - DepTrackingCache.prototype.set = function (dataId, value) { - var oldValue = this.data[dataId]; - - if (value !== oldValue) { - this.data[dataId] = value; - this.depend.dirty(dataId); - } - }; - - DepTrackingCache.prototype.delete = function (dataId) { - if (hasOwn.call(this.data, dataId)) { - delete this.data[dataId]; - this.depend.dirty(dataId); - } - }; - - DepTrackingCache.prototype.clear = function () { - this.replace(null); - }; - - DepTrackingCache.prototype.replace = function (newData) { - var _this = this; - - if (newData) { - Object.keys(newData).forEach(function (dataId) { - _this.set(dataId, newData[dataId]); - }); - Object.keys(this.data).forEach(function (dataId) { - if (!hasOwn.call(newData, dataId)) { - _this.delete(dataId); - } - }); - } else { - Object.keys(this.data).forEach(function (dataId) { - _this.delete(dataId); - }); - } - }; - - return DepTrackingCache; -}(); - -function defaultNormalizedCacheFactory(seed) { - return new DepTrackingCache(seed); -} - -var StoreReader = function () { - function StoreReader(_a) { - var _this = this; - - var _b = _a === void 0 ? {} : _a, - _c = _b.cacheKeyRoot, - cacheKeyRoot = _c === void 0 ? new _optimism.KeyTrie(_apolloUtilities.canUseWeakMap) : _c, - _d = _b.freezeResults, - freezeResults = _d === void 0 ? false : _d; - - var _e = this, - executeStoreQuery = _e.executeStoreQuery, - executeSelectionSet = _e.executeSelectionSet, - executeSubSelectedArray = _e.executeSubSelectedArray; - - this.freezeResults = freezeResults; - this.executeStoreQuery = (0, _optimism.wrap)(function (options) { - return executeStoreQuery.call(_this, options); - }, { - makeCacheKey: function (_a) { - var query = _a.query, - rootValue = _a.rootValue, - contextValue = _a.contextValue, - variableValues = _a.variableValues, - fragmentMatcher = _a.fragmentMatcher; - - if (contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(contextValue.store, query, fragmentMatcher, JSON.stringify(variableValues), rootValue.id); - } - } - }); - this.executeSelectionSet = (0, _optimism.wrap)(function (options) { - return executeSelectionSet.call(_this, options); - }, { - makeCacheKey: function (_a) { - var selectionSet = _a.selectionSet, - rootValue = _a.rootValue, - execContext = _a.execContext; - - if (execContext.contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, selectionSet, execContext.fragmentMatcher, JSON.stringify(execContext.variableValues), rootValue.id); - } - } - }); - this.executeSubSelectedArray = (0, _optimism.wrap)(function (options) { - return executeSubSelectedArray.call(_this, options); - }, { - makeCacheKey: function (_a) { - var field = _a.field, - array = _a.array, - execContext = _a.execContext; - - if (execContext.contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, field, array, JSON.stringify(execContext.variableValues)); - } - } - }); - } - - StoreReader.prototype.readQueryFromStore = function (options) { - return this.diffQueryAgainstStore((0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - returnPartialData: false - })).result; - }; - - StoreReader.prototype.diffQueryAgainstStore = function (_a) { - var store = _a.store, - query = _a.query, - variables = _a.variables, - previousResult = _a.previousResult, - _b = _a.returnPartialData, - returnPartialData = _b === void 0 ? true : _b, - _c = _a.rootId, - rootId = _c === void 0 ? 'ROOT_QUERY' : _c, - fragmentMatcherFunction = _a.fragmentMatcherFunction, - config = _a.config; - var queryDefinition = (0, _apolloUtilities.getQueryDefinition)(query); - variables = (0, _apolloUtilities.assign)({}, (0, _apolloUtilities.getDefaultValues)(queryDefinition), variables); - var context = { - store: store, - dataIdFromObject: config && config.dataIdFromObject, - cacheRedirects: config && config.cacheRedirects || {} - }; - var execResult = this.executeStoreQuery({ - query: query, - rootValue: { - type: 'id', - id: rootId, - generated: true, - typename: 'Query' - }, - contextValue: context, - variableValues: variables, - fragmentMatcher: fragmentMatcherFunction - }); - var hasMissingFields = execResult.missing && execResult.missing.length > 0; - - if (hasMissingFields && !returnPartialData) { - execResult.missing.forEach(function (info) { - if (info.tolerable) return; - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(8) : new _tsInvariant.InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); - }); - } - - if (previousResult) { - if ((0, _apolloUtilities.isEqual)(previousResult, execResult.result)) { - execResult.result = previousResult; - } - } - - return { - result: execResult.result, - complete: !hasMissingFields - }; - }; - - StoreReader.prototype.executeStoreQuery = function (_a) { - var query = _a.query, - rootValue = _a.rootValue, - contextValue = _a.contextValue, - variableValues = _a.variableValues, - _b = _a.fragmentMatcher, - fragmentMatcher = _b === void 0 ? defaultFragmentMatcher : _b; - var mainDefinition = (0, _apolloUtilities.getMainDefinition)(query); - var fragments = (0, _apolloUtilities.getFragmentDefinitions)(query); - var fragmentMap = (0, _apolloUtilities.createFragmentMap)(fragments); - var execContext = { - query: query, - fragmentMap: fragmentMap, - contextValue: contextValue, - variableValues: variableValues, - fragmentMatcher: fragmentMatcher - }; - return this.executeSelectionSet({ - selectionSet: mainDefinition.selectionSet, - rootValue: rootValue, - execContext: execContext - }); - }; - - StoreReader.prototype.executeSelectionSet = function (_a) { - var _this = this; - - var selectionSet = _a.selectionSet, - rootValue = _a.rootValue, - execContext = _a.execContext; - var fragmentMap = execContext.fragmentMap, - contextValue = execContext.contextValue, - variables = execContext.variableValues; - var finalResult = { - result: null - }; - var objectsToMerge = []; - var object = contextValue.store.get(rootValue.id); - var typename = object && object.__typename || rootValue.id === 'ROOT_QUERY' && 'Query' || void 0; - - function handleMissing(result) { - var _a; - - if (result.missing) { - finalResult.missing = finalResult.missing || []; - - (_a = finalResult.missing).push.apply(_a, result.missing); - } - - return result.result; - } - - selectionSet.selections.forEach(function (selection) { - var _a; - - if (!(0, _apolloUtilities.shouldInclude)(selection, variables)) { - return; - } - - if ((0, _apolloUtilities.isField)(selection)) { - var fieldResult = handleMissing(_this.executeField(object, typename, selection, execContext)); - - if (typeof fieldResult !== 'undefined') { - objectsToMerge.push((_a = {}, _a[(0, _apolloUtilities.resultKeyNameFromField)(selection)] = fieldResult, _a)); - } - } else { - var fragment = void 0; - - if ((0, _apolloUtilities.isInlineFragment)(selection)) { - fragment = selection; - } else { - fragment = fragmentMap[selection.name.value]; - - if (!fragment) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(9) : new _tsInvariant.InvariantError("No fragment named " + selection.name.value); - } - } - - var typeCondition = fragment.typeCondition && fragment.typeCondition.name.value; - var match = !typeCondition || execContext.fragmentMatcher(rootValue, typeCondition, contextValue); - - if (match) { - var fragmentExecResult = _this.executeSelectionSet({ - selectionSet: fragment.selectionSet, - rootValue: rootValue, - execContext: execContext - }); - - if (match === 'heuristic' && fragmentExecResult.missing) { - fragmentExecResult = (0, _tslib.__assign)((0, _tslib.__assign)({}, fragmentExecResult), { - missing: fragmentExecResult.missing.map(function (info) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, info), { - tolerable: true - }); - }) - }); - } - - objectsToMerge.push(handleMissing(fragmentExecResult)); - } - } - }); - finalResult.result = (0, _apolloUtilities.mergeDeepArray)(objectsToMerge); - - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(finalResult.result); - } - - return finalResult; - }; - - StoreReader.prototype.executeField = function (object, typename, field, execContext) { - var variables = execContext.variableValues, - contextValue = execContext.contextValue; - var fieldName = field.name.value; - var args = (0, _apolloUtilities.argumentsObjectFromField)(field, variables); - var info = { - resultKey: (0, _apolloUtilities.resultKeyNameFromField)(field), - directives: (0, _apolloUtilities.getDirectiveInfoFromField)(field, variables) - }; - var readStoreResult = readStoreResolver(object, typename, fieldName, args, contextValue, info); - - if (Array.isArray(readStoreResult.result)) { - return this.combineExecResults(readStoreResult, this.executeSubSelectedArray({ - field: field, - array: readStoreResult.result, - execContext: execContext - })); - } - - if (!field.selectionSet) { - assertSelectionSetForIdValue(field, readStoreResult.result); - - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - (0, _apolloUtilities.maybeDeepFreeze)(readStoreResult); - } - - return readStoreResult; - } - - if (readStoreResult.result == null) { - return readStoreResult; - } - - return this.combineExecResults(readStoreResult, this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: readStoreResult.result, - execContext: execContext - })); - }; - - StoreReader.prototype.combineExecResults = function () { - var execResults = []; - - for (var _i = 0; _i < arguments.length; _i++) { - execResults[_i] = arguments[_i]; - } - - var missing; - execResults.forEach(function (execResult) { - if (execResult.missing) { - missing = missing || []; - missing.push.apply(missing, execResult.missing); - } - }); - return { - result: execResults.pop().result, - missing: missing - }; - }; - - StoreReader.prototype.executeSubSelectedArray = function (_a) { - var _this = this; - - var field = _a.field, - array = _a.array, - execContext = _a.execContext; - var missing; - - function handleMissing(childResult) { - if (childResult.missing) { - missing = missing || []; - missing.push.apply(missing, childResult.missing); - } - - return childResult.result; - } - - array = array.map(function (item) { - if (item === null) { - return null; - } - - if (Array.isArray(item)) { - return handleMissing(_this.executeSubSelectedArray({ - field: field, - array: item, - execContext: execContext - })); - } - - if (field.selectionSet) { - return handleMissing(_this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: item, - execContext: execContext - })); - } - - assertSelectionSetForIdValue(field, item); - return item; - }); - - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(array); - } - - return { - result: array, - missing: missing - }; - }; - - return StoreReader; -}(); - -exports.StoreReader = StoreReader; - -function assertSelectionSetForIdValue(field, value) { - if (!field.selectionSet && (0, _apolloUtilities.isIdValue)(value)) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError("Missing selection set for object of type " + value.typename + " returned for query field " + field.name.value); - } -} - -function defaultFragmentMatcher() { - return true; -} - -function assertIdValue(idValue) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)((0, _apolloUtilities.isIdValue)(idValue), 11) : (0, _tsInvariant.invariant)((0, _apolloUtilities.isIdValue)(idValue), "Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue."); -} - -function readStoreResolver(object, typename, fieldName, args, context, _a) { - var resultKey = _a.resultKey, - directives = _a.directives; - var storeKeyName = fieldName; - - if (args || directives) { - storeKeyName = (0, _apolloUtilities.getStoreKeyName)(storeKeyName, args, directives); - } - - var fieldValue = void 0; - - if (object) { - fieldValue = object[storeKeyName]; - - if (typeof fieldValue === 'undefined' && context.cacheRedirects && typeof typename === 'string') { - var type = context.cacheRedirects[typename]; - - if (type) { - var resolver = type[fieldName]; - - if (resolver) { - fieldValue = resolver(object, args, { - getCacheKey: function (storeObj) { - var id = context.dataIdFromObject(storeObj); - return id && (0, _apolloUtilities.toIdValue)({ - id: id, - typename: storeObj.__typename - }); - } - }); - } - } - } - } - - if (typeof fieldValue === 'undefined') { - return { - result: fieldValue, - missing: [{ - object: object, - fieldName: storeKeyName, - tolerable: false - }] - }; - } - - if ((0, _apolloUtilities.isJsonValue)(fieldValue)) { - fieldValue = fieldValue.json; - } - - return { - result: fieldValue - }; -} - -var ObjectCache = function () { - function ObjectCache(data) { - if (data === void 0) { - data = Object.create(null); - } - - this.data = data; - } - - ObjectCache.prototype.toObject = function () { - return this.data; - }; - - ObjectCache.prototype.get = function (dataId) { - return this.data[dataId]; - }; - - ObjectCache.prototype.set = function (dataId, value) { - this.data[dataId] = value; - }; - - ObjectCache.prototype.delete = function (dataId) { - this.data[dataId] = void 0; - }; - - ObjectCache.prototype.clear = function () { - this.data = Object.create(null); - }; - - ObjectCache.prototype.replace = function (newData) { - this.data = newData || Object.create(null); - }; - - return ObjectCache; -}(); - -exports.ObjectCache = ObjectCache; - -function defaultNormalizedCacheFactory$1(seed) { - return new ObjectCache(seed); -} - -var WriteError = function (_super) { - (0, _tslib.__extends)(WriteError, _super); - - function WriteError() { - var _this = _super !== null && _super.apply(this, arguments) || this; - - _this.type = 'WriteError'; - return _this; - } - - return WriteError; -}(Error); - -exports.WriteError = WriteError; - -function enhanceErrorWithDocument(error, document) { - var enhancedError = new WriteError("Error writing result to store for query:\n " + JSON.stringify(document)); - enhancedError.message += '\n' + error.message; - enhancedError.stack = error.stack; - return enhancedError; -} - -var StoreWriter = function () { - function StoreWriter() {} - - StoreWriter.prototype.writeQueryToStore = function (_a) { - var query = _a.query, - result = _a.result, - _b = _a.store, - store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, - variables = _a.variables, - dataIdFromObject = _a.dataIdFromObject, - fragmentMatcherFunction = _a.fragmentMatcherFunction; - return this.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: query, - store: store, - variables: variables, - dataIdFromObject: dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction - }); - }; - - StoreWriter.prototype.writeResultToStore = function (_a) { - var dataId = _a.dataId, - result = _a.result, - document = _a.document, - _b = _a.store, - store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, - variables = _a.variables, - dataIdFromObject = _a.dataIdFromObject, - fragmentMatcherFunction = _a.fragmentMatcherFunction; - var operationDefinition = (0, _apolloUtilities.getOperationDefinition)(document); - - try { - return this.writeSelectionSetToStore({ - result: result, - dataId: dataId, - selectionSet: operationDefinition.selectionSet, - context: { - store: store, - processedData: {}, - variables: (0, _apolloUtilities.assign)({}, (0, _apolloUtilities.getDefaultValues)(operationDefinition), variables), - dataIdFromObject: dataIdFromObject, - fragmentMap: (0, _apolloUtilities.createFragmentMap)((0, _apolloUtilities.getFragmentDefinitions)(document)), - fragmentMatcherFunction: fragmentMatcherFunction - } - }); - } catch (e) { - throw enhanceErrorWithDocument(e, document); - } - }; - - StoreWriter.prototype.writeSelectionSetToStore = function (_a) { - var _this = this; - - var result = _a.result, - dataId = _a.dataId, - selectionSet = _a.selectionSet, - context = _a.context; - var variables = context.variables, - store = context.store, - fragmentMap = context.fragmentMap; - selectionSet.selections.forEach(function (selection) { - var _a; - - if (!(0, _apolloUtilities.shouldInclude)(selection, variables)) { - return; - } - - if ((0, _apolloUtilities.isField)(selection)) { - var resultFieldKey = (0, _apolloUtilities.resultKeyNameFromField)(selection); - var value = result[resultFieldKey]; - - if (typeof value !== 'undefined') { - _this.writeFieldToStore({ - dataId: dataId, - value: value, - field: selection, - context: context - }); - } else { - var isDefered = false; - var isClient = false; - - if (selection.directives && selection.directives.length) { - isDefered = selection.directives.some(function (directive) { - return directive.name && directive.name.value === 'defer'; - }); - isClient = selection.directives.some(function (directive) { - return directive.name && directive.name.value === 'client'; - }); - } - - if (!isDefered && !isClient && context.fragmentMatcherFunction) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("Missing field " + resultFieldKey + " in " + JSON.stringify(result, null, 2).substring(0, 100)); - } - } - } else { - var fragment = void 0; - - if ((0, _apolloUtilities.isInlineFragment)(selection)) { - fragment = selection; - } else { - fragment = (fragmentMap || {})[selection.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 3) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value + "."); - } - - var matches = true; - - if (context.fragmentMatcherFunction && fragment.typeCondition) { - var id = dataId || 'self'; - var idValue = (0, _apolloUtilities.toIdValue)({ - id: id, - typename: undefined - }); - var fakeContext = { - store: new ObjectCache((_a = {}, _a[id] = result, _a)), - cacheRedirects: {} - }; - var match = context.fragmentMatcherFunction(idValue, fragment.typeCondition.name.value, fakeContext); - - if (!(0, _apolloUtilities.isProduction)() && match === 'heuristic') { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('WARNING: heuristic fragment matching going on!'); - } - - matches = !!match; - } - - if (matches) { - _this.writeSelectionSetToStore({ - result: result, - selectionSet: fragment.selectionSet, - dataId: dataId, - context: context - }); - } - } - }); - return store; - }; - - StoreWriter.prototype.writeFieldToStore = function (_a) { - var _b; - - var field = _a.field, - value = _a.value, - dataId = _a.dataId, - context = _a.context; - var variables = context.variables, - dataIdFromObject = context.dataIdFromObject, - store = context.store; - var storeValue; - var storeObject; - var storeFieldName = (0, _apolloUtilities.storeKeyNameFromField)(field, variables); - - if (!field.selectionSet || value === null) { - storeValue = value != null && typeof value === 'object' ? { - type: 'json', - json: value - } : value; - } else if (Array.isArray(value)) { - var generatedId = dataId + "." + storeFieldName; - storeValue = this.processArrayValue(value, generatedId, field.selectionSet, context); - } else { - var valueDataId = dataId + "." + storeFieldName; - var generated = true; - - if (!isGeneratedId(valueDataId)) { - valueDataId = '$' + valueDataId; - } - - if (dataIdFromObject) { - var semanticId = dataIdFromObject(value); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 4) : (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.'); - - if (semanticId || typeof semanticId === 'number' && semanticId === 0) { - valueDataId = semanticId; - generated = false; - } - } - - if (!isDataProcessed(valueDataId, field, context.processedData)) { - this.writeSelectionSetToStore({ - dataId: valueDataId, - result: value, - selectionSet: field.selectionSet, - context: context - }); - } - - var typename = value.__typename; - storeValue = (0, _apolloUtilities.toIdValue)({ - id: valueDataId, - typename: typename - }, generated); - storeObject = store.get(dataId); - var escapedId = storeObject && storeObject[storeFieldName]; - - if (escapedId !== storeValue && (0, _apolloUtilities.isIdValue)(escapedId)) { - var hadTypename = escapedId.typename !== undefined; - var hasTypename = typename !== undefined; - var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, 5) : (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!hadTypename || hasTypename, 6) : (0, _tsInvariant.invariant)(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - - if (escapedId.generated) { - if (typenameChanged) { - if (!generated) { - store.delete(escapedId.id); - } - } else { - mergeWithGenerated(escapedId.id, storeValue.id, store); - } - } - } - } - - storeObject = store.get(dataId); - - if (!storeObject || !(0, _apolloUtilities.isEqual)(storeValue, storeObject[storeFieldName])) { - store.set(dataId, (0, _tslib.__assign)((0, _tslib.__assign)({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b))); - } - }; - - StoreWriter.prototype.processArrayValue = function (value, generatedId, selectionSet, context) { - var _this = this; - - return value.map(function (item, index) { - if (item === null) { - return null; - } - - var itemDataId = generatedId + "." + index; - - if (Array.isArray(item)) { - return _this.processArrayValue(item, itemDataId, selectionSet, context); - } - - var generated = true; - - if (context.dataIdFromObject) { - var semanticId = context.dataIdFromObject(item); - - if (semanticId) { - itemDataId = semanticId; - generated = false; - } - } - - if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) { - _this.writeSelectionSetToStore({ - dataId: itemDataId, - result: item, - selectionSet: selectionSet, - context: context - }); - } - - return (0, _apolloUtilities.toIdValue)({ - id: itemDataId, - typename: item.__typename - }, generated); - }); - }; - - return StoreWriter; -}(); - -exports.StoreWriter = StoreWriter; - -function isGeneratedId(id) { - return id[0] === '$'; -} - -function mergeWithGenerated(generatedKey, realKey, cache) { - if (generatedKey === realKey) { - return false; - } - - var generated = cache.get(generatedKey); - var real = cache.get(realKey); - var madeChanges = false; - Object.keys(generated).forEach(function (key) { - var value = generated[key]; - var realValue = real[key]; - - if ((0, _apolloUtilities.isIdValue)(value) && isGeneratedId(value.id) && (0, _apolloUtilities.isIdValue)(realValue) && !(0, _apolloUtilities.isEqual)(value, realValue) && mergeWithGenerated(value.id, realValue.id, cache)) { - madeChanges = true; - } - }); - cache.delete(generatedKey); - var newRealValue = (0, _tslib.__assign)((0, _tslib.__assign)({}, generated), real); - - if ((0, _apolloUtilities.isEqual)(newRealValue, real)) { - return madeChanges; - } - - cache.set(realKey, newRealValue); - return true; -} - -function isDataProcessed(dataId, field, processedData) { - if (!processedData) { - return false; - } - - if (processedData[dataId]) { - if (processedData[dataId].indexOf(field) >= 0) { - return true; - } else { - processedData[dataId].push(field); - } - } else { - processedData[dataId] = [field]; - } - - return false; -} - -var defaultConfig = { - fragmentMatcher: new HeuristicFragmentMatcher(), - dataIdFromObject: defaultDataIdFromObject, - addTypename: true, - resultCaching: true, - freezeResults: false -}; - -function defaultDataIdFromObject(result) { - if (result.__typename) { - if (result.id !== undefined) { - return result.__typename + ":" + result.id; - } - - if (result._id !== undefined) { - return result.__typename + ":" + result._id; - } - } - - return null; -} - -var hasOwn$1 = Object.prototype.hasOwnProperty; - -var OptimisticCacheLayer = function (_super) { - (0, _tslib.__extends)(OptimisticCacheLayer, _super); - - function OptimisticCacheLayer(optimisticId, parent, transaction) { - var _this = _super.call(this, Object.create(null)) || this; - - _this.optimisticId = optimisticId; - _this.parent = parent; - _this.transaction = transaction; - return _this; - } - - OptimisticCacheLayer.prototype.toObject = function () { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, this.parent.toObject()), this.data); - }; - - OptimisticCacheLayer.prototype.get = function (dataId) { - return hasOwn$1.call(this.data, dataId) ? this.data[dataId] : this.parent.get(dataId); - }; - - return OptimisticCacheLayer; -}(ObjectCache); - -var InMemoryCache = function (_super) { - (0, _tslib.__extends)(InMemoryCache, _super); - - function InMemoryCache(config) { - if (config === void 0) { - config = {}; - } - - var _this = _super.call(this) || this; - - _this.watches = new Set(); - _this.typenameDocumentCache = new Map(); - _this.cacheKeyRoot = new _optimism.KeyTrie(_apolloUtilities.canUseWeakMap); - _this.silenceBroadcast = false; - _this.config = (0, _tslib.__assign)((0, _tslib.__assign)({}, defaultConfig), config); - - if (_this.config.customResolvers) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.customResolvers; - } - - if (_this.config.cacheResolvers) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.cacheResolvers; - } - - _this.addTypename = !!_this.config.addTypename; - _this.data = _this.config.resultCaching ? new DepTrackingCache() : new ObjectCache(); - _this.optimisticData = _this.data; - _this.storeWriter = new StoreWriter(); - _this.storeReader = new StoreReader({ - cacheKeyRoot: _this.cacheKeyRoot, - freezeResults: config.freezeResults - }); - var cache = _this; - var maybeBroadcastWatch = cache.maybeBroadcastWatch; - _this.maybeBroadcastWatch = (0, _optimism.wrap)(function (c) { - return maybeBroadcastWatch.call(_this, c); - }, { - makeCacheKey: function (c) { - if (c.optimistic) { - return; - } - - if (c.previousResult) { - return; - } - - if (cache.data instanceof DepTrackingCache) { - return cache.cacheKeyRoot.lookup(c.query, JSON.stringify(c.variables)); - } - } - }); - return _this; - } - - InMemoryCache.prototype.restore = function (data) { - if (data) this.data.replace(data); - return this; - }; - - InMemoryCache.prototype.extract = function (optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return (optimistic ? this.optimisticData : this.data).toObject(); - }; - - InMemoryCache.prototype.read = function (options) { - if (typeof options.rootId === 'string' && typeof this.data.get(options.rootId) === 'undefined') { - return null; - } - - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.readQueryFromStore({ - store: options.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(options.query), - variables: options.variables, - rootId: options.rootId, - fragmentMatcherFunction: fragmentMatcherFunction, - previousResult: options.previousResult, - config: this.config - }) || null; - }; - - InMemoryCache.prototype.write = function (write) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - this.storeWriter.writeResultToStore({ - dataId: write.dataId, - result: write.result, - variables: write.variables, - document: this.transformDocument(write.query), - store: this.data, - dataIdFromObject: this.config.dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction - }); - this.broadcastWatches(); - }; - - InMemoryCache.prototype.diff = function (query) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.diffQueryAgainstStore({ - store: query.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(query.query), - variables: query.variables, - returnPartialData: query.returnPartialData, - previousResult: query.previousResult, - fragmentMatcherFunction: fragmentMatcherFunction, - config: this.config - }); - }; - - InMemoryCache.prototype.watch = function (watch) { - var _this = this; - - this.watches.add(watch); - return function () { - _this.watches.delete(watch); - }; - }; - - InMemoryCache.prototype.evict = function (query) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(7) : new _tsInvariant.InvariantError("eviction is not implemented on InMemory Cache"); - }; - - InMemoryCache.prototype.reset = function () { - this.data.clear(); - this.broadcastWatches(); - return Promise.resolve(); - }; - - InMemoryCache.prototype.removeOptimistic = function (idToRemove) { - var toReapply = []; - var removedCount = 0; - var layer = this.optimisticData; - - while (layer instanceof OptimisticCacheLayer) { - if (layer.optimisticId === idToRemove) { - ++removedCount; - } else { - toReapply.push(layer); - } - - layer = layer.parent; - } - - if (removedCount > 0) { - this.optimisticData = layer; - - while (toReapply.length > 0) { - var layer_1 = toReapply.pop(); - this.performTransaction(layer_1.transaction, layer_1.optimisticId); - } - - this.broadcastWatches(); - } - }; - - InMemoryCache.prototype.performTransaction = function (transaction, optimisticId) { - var _a = this, - data = _a.data, - silenceBroadcast = _a.silenceBroadcast; - - this.silenceBroadcast = true; - - if (typeof optimisticId === 'string') { - this.data = this.optimisticData = new OptimisticCacheLayer(optimisticId, this.optimisticData, transaction); - } - - try { - transaction(this); - } finally { - this.silenceBroadcast = silenceBroadcast; - this.data = data; - } - - this.broadcastWatches(); - }; - - InMemoryCache.prototype.recordOptimisticTransaction = function (transaction, id) { - return this.performTransaction(transaction, id); - }; - - InMemoryCache.prototype.transformDocument = function (document) { - if (this.addTypename) { - var result = this.typenameDocumentCache.get(document); - - if (!result) { - result = (0, _apolloUtilities.addTypenameToDocument)(document); - this.typenameDocumentCache.set(document, result); - this.typenameDocumentCache.set(result, result); - } - - return result; - } - - return document; - }; - - InMemoryCache.prototype.broadcastWatches = function () { - var _this = this; - - if (!this.silenceBroadcast) { - this.watches.forEach(function (c) { - return _this.maybeBroadcastWatch(c); - }); - } - }; - - InMemoryCache.prototype.maybeBroadcastWatch = function (c) { - c.callback(this.diff({ - query: c.query, - variables: c.variables, - previousResult: c.previousResult && c.previousResult(), - optimistic: c.optimistic - })); - }; - - return InMemoryCache; -}(_apolloCache.ApolloCache); - - -exports.InMemoryCache = InMemoryCache; diff --git a/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js.map b/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js.map deleted file mode 100644 index 9cd94a34..00000000 --- a/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/fragmentMatcher.ts","../src/depTrackingCache.ts","../src/readFromStore.ts","../src/objectCache.ts","../src/writeToStore.ts","../src/inMemory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,CAAC,cAAF,EAH5B;AAIR,MAAA,UAAU,EAAE,CAAC,CAAC;AAJN,KAAV,CADF;AAQD,GATO;;AAUV,SAAA,aAAA;AAjRA,C,CAAmC,wB","sourcesContent":["import { isTest, IdValue } from 'apollo-utilities';\nimport { invariant } from 'ts-invariant';\n\nimport {\n ReadStoreContext,\n FragmentMatcherInterface,\n PossibleTypesMap,\n IntrospectionResultData,\n} from './types';\n\nlet haveWarned = false;\n\nfunction shouldWarn() {\n const answer = !haveWarned;\n /* istanbul ignore if */\n if (!isTest()) {\n haveWarned = true;\n }\n return answer;\n}\n\n/**\n * This fragment matcher is very basic and unable to match union or interface type conditions\n */\nexport class HeuristicFragmentMatcher implements FragmentMatcherInterface {\n constructor() {\n // do nothing\n }\n\n public ensureReady() {\n return Promise.resolve();\n }\n\n public canBypassInit() {\n return true; // we don't need to initialize this fragment matcher.\n }\n\n public match(\n idValue: IdValue,\n typeCondition: string,\n context: ReadStoreContext,\n ): boolean | 'heuristic' {\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === 'ROOT_QUERY';\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/3507\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && 'Query' } = obj;\n\n if (!__typename) {\n if (shouldWarn()) {\n invariant.warn(`You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments.`);\n invariant.warn(\n 'Could not find __typename on Fragment ',\n typeCondition,\n obj,\n );\n invariant.warn(\n `DEPRECATION WARNING: using fragments without __typename is unsupported behavior ` +\n `and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now.`,\n );\n }\n\n return 'heuristic';\n }\n\n if (__typename === typeCondition) {\n return true;\n }\n\n // At this point we don't know if this fragment should match or not. It's\n // either:\n //\n // 1. (GOOD) A fragment on a matching interface or union.\n // 2. (BAD) A fragment on a non-matching concrete type or interface or union.\n //\n // If it's 2, we don't want it to match. If it's 1, we want it to match. We\n // can't tell the difference, so we warn the user, but still try to match\n // it (for backwards compatibility reasons). This unfortunately means that\n // using the `HeuristicFragmentMatcher` with unions and interfaces is\n // very unreliable. This will be addressed in a future major version of\n // Apollo Client, but for now the recommendation is to use the\n // `IntrospectionFragmentMatcher` when working with unions/interfaces.\n\n if (shouldWarn()) {\n invariant.error(\n 'You are using the simple (heuristic) fragment matcher, but your ' +\n 'queries contain union or interface types. Apollo Client will not be ' +\n 'able to accurately map fragments. To make this error go away, use ' +\n 'the `IntrospectionFragmentMatcher` as described in the docs: ' +\n 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher',\n );\n }\n\n return 'heuristic';\n }\n}\n\nexport class IntrospectionFragmentMatcher implements FragmentMatcherInterface {\n private isReady: boolean;\n private possibleTypesMap: PossibleTypesMap;\n\n constructor(options?: {\n introspectionQueryResultData?: IntrospectionResultData;\n }) {\n if (options && options.introspectionQueryResultData) {\n this.possibleTypesMap = this.parseIntrospectionResult(\n options.introspectionQueryResultData,\n );\n this.isReady = true;\n } else {\n this.isReady = false;\n }\n\n this.match = this.match.bind(this);\n }\n\n public match(\n idValue: IdValue,\n typeCondition: string,\n context: ReadStoreContext,\n ) {\n invariant(\n this.isReady,\n 'FragmentMatcher.match() was called before FragmentMatcher.init()',\n );\n\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === 'ROOT_QUERY';\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/4620\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && 'Query' } = obj;\n\n invariant(\n __typename,\n `Cannot match fragment because __typename property is missing: ${JSON.stringify(\n obj,\n )}`,\n );\n\n if (__typename === typeCondition) {\n return true;\n }\n\n const implementingTypes = this.possibleTypesMap[typeCondition];\n if (\n __typename &&\n implementingTypes &&\n implementingTypes.indexOf(__typename) > -1\n ) {\n return true;\n }\n\n return false;\n }\n\n private parseIntrospectionResult(\n introspectionResultData: IntrospectionResultData,\n ): PossibleTypesMap {\n const typeMap: PossibleTypesMap = {};\n introspectionResultData.__schema.types.forEach(type => {\n if (type.kind === 'UNION' || type.kind === 'INTERFACE') {\n typeMap[type.name] = type.possibleTypes.map(\n implementingType => implementingType.name,\n );\n }\n });\n return typeMap;\n }\n}\n","import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types';\nimport { wrap, OptimisticWrapperFunction } from 'optimism';\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nexport class DepTrackingCache implements NormalizedCache {\n // Wrapper function produced by the optimism library, used to depend on\n // dataId strings, for easy invalidation of specific IDs.\n private depend: OptimisticWrapperFunction<[string], StoreObject | undefined>;\n\n constructor(private data: NormalizedCacheObject = Object.create(null)) {\n this.depend = wrap((dataId: string) => this.data[dataId], {\n disposable: true,\n makeCacheKey(dataId: string) {\n return dataId;\n },\n });\n }\n\n public toObject(): NormalizedCacheObject {\n return this.data;\n }\n\n public get(dataId: string): StoreObject {\n this.depend(dataId);\n return this.data[dataId]!;\n }\n\n public set(dataId: string, value?: StoreObject) {\n const oldValue = this.data[dataId];\n if (value !== oldValue) {\n this.data[dataId] = value;\n this.depend.dirty(dataId);\n }\n }\n\n public delete(dataId: string): void {\n if (hasOwn.call(this.data, dataId)) {\n delete this.data[dataId];\n this.depend.dirty(dataId);\n }\n }\n\n public clear(): void {\n this.replace(null);\n }\n\n public replace(newData: NormalizedCacheObject | null): void {\n if (newData) {\n Object.keys(newData).forEach(dataId => {\n this.set(dataId, newData[dataId]);\n });\n Object.keys(this.data).forEach(dataId => {\n if (!hasOwn.call(newData, dataId)) {\n this.delete(dataId);\n }\n });\n } else {\n Object.keys(this.data).forEach(dataId => {\n this.delete(dataId);\n });\n }\n }\n}\n\nexport function defaultNormalizedCacheFactory(\n seed?: NormalizedCacheObject,\n): NormalizedCache {\n return new DepTrackingCache(seed);\n}\n","import {\n argumentsObjectFromField,\n assign,\n canUseWeakMap,\n createFragmentMap,\n DirectiveInfo,\n FragmentMap,\n getDefaultValues,\n getDirectiveInfoFromField,\n getFragmentDefinitions,\n getMainDefinition,\n getQueryDefinition,\n getStoreKeyName,\n IdValue,\n isEqual,\n isField,\n isIdValue,\n isInlineFragment,\n isJsonValue,\n maybeDeepFreeze,\n mergeDeepArray,\n resultKeyNameFromField,\n shouldInclude,\n StoreValue,\n toIdValue,\n} from 'apollo-utilities';\n\nimport { Cache } from 'apollo-cache';\n\nimport {\n ReadStoreContext,\n DiffQueryAgainstStoreOptions,\n ReadQueryOptions,\n StoreObject,\n} from './types';\n\nimport {\n DocumentNode,\n FieldNode,\n FragmentDefinitionNode,\n InlineFragmentNode,\n SelectionSetNode,\n} from 'graphql';\n\nimport { wrap, KeyTrie } from 'optimism';\nimport { DepTrackingCache } from './depTrackingCache';\nimport { invariant, InvariantError } from 'ts-invariant';\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: ReadStoreContext,\n) => boolean | 'heuristic';\n\ntype ExecContext = {\n query: DocumentNode;\n fragmentMap: FragmentMap;\n contextValue: ReadStoreContext;\n variableValues: VariableMap;\n fragmentMatcher: FragmentMatcher;\n};\n\ntype ExecInfo = {\n resultKey: string;\n directives: DirectiveInfo;\n};\n\nexport type ExecResultMissingField = {\n object: StoreObject;\n fieldName: string;\n tolerable: boolean;\n};\n\nexport type ExecResult = {\n result: R;\n // Empty array if no missing fields encountered while computing result.\n missing?: ExecResultMissingField[];\n};\n\ntype ExecStoreQueryOptions = {\n query: DocumentNode;\n rootValue: IdValue;\n contextValue: ReadStoreContext;\n variableValues: VariableMap;\n // Default matcher always matches all fragments\n fragmentMatcher?: FragmentMatcher;\n};\n\ntype ExecSelectionSetOptions = {\n selectionSet: SelectionSetNode;\n rootValue: any;\n execContext: ExecContext;\n};\n\ntype ExecSubSelectedArrayOptions = {\n field: FieldNode;\n array: any[];\n execContext: ExecContext;\n};\n\nexport interface StoreReaderConfig {\n cacheKeyRoot?: KeyTrie;\n freezeResults?: boolean;\n}\n\nexport class StoreReader {\n private freezeResults: boolean;\n\n constructor({\n cacheKeyRoot = new KeyTrie(canUseWeakMap),\n freezeResults = false,\n }: StoreReaderConfig = {}) {\n const {\n executeStoreQuery,\n executeSelectionSet,\n executeSubSelectedArray,\n } = this;\n\n this.freezeResults = freezeResults;\n\n this.executeStoreQuery = wrap((options: ExecStoreQueryOptions) => {\n return executeStoreQuery.call(this, options);\n }, {\n makeCacheKey({\n query,\n rootValue,\n contextValue,\n variableValues,\n fragmentMatcher,\n }: ExecStoreQueryOptions) {\n // The result of executeStoreQuery can be safely cached only if the\n // underlying store is capable of tracking dependencies and invalidating\n // the cache when relevant data have changed.\n if (contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n contextValue.store,\n query,\n fragmentMatcher,\n JSON.stringify(variableValues),\n rootValue.id,\n );\n }\n }\n });\n\n this.executeSelectionSet = wrap((options: ExecSelectionSetOptions) => {\n return executeSelectionSet.call(this, options);\n }, {\n makeCacheKey({\n selectionSet,\n rootValue,\n execContext,\n }: ExecSelectionSetOptions) {\n if (execContext.contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n execContext.contextValue.store,\n selectionSet,\n execContext.fragmentMatcher,\n JSON.stringify(execContext.variableValues),\n rootValue.id,\n );\n }\n }\n });\n\n this.executeSubSelectedArray = wrap((options: ExecSubSelectedArrayOptions) => {\n return executeSubSelectedArray.call(this, options);\n }, {\n makeCacheKey({ field, array, execContext }) {\n if (execContext.contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n execContext.contextValue.store,\n field,\n array,\n JSON.stringify(execContext.variableValues),\n );\n }\n }\n });\n }\n\n /**\n * Resolves the result of a query solely from the store (i.e. never hits the server).\n *\n * @param {Store} store The {@link NormalizedCache} used by Apollo for the `data` portion of the\n * store.\n *\n * @param {DocumentNode} query The query document to resolve from the data available in the store.\n *\n * @param {Object} [variables] A map from the name of a variable to its value. These variables can\n * be referenced by the query document.\n *\n * @param {any} previousResult The previous result returned by this function for the same query.\n * If nothing in the store changed since that previous result then values from the previous result\n * will be returned to preserve referential equality.\n */\n public readQueryFromStore(\n options: ReadQueryOptions,\n ): QueryType | undefined {\n return this.diffQueryAgainstStore({\n ...options,\n returnPartialData: false,\n }).result;\n }\n\n /**\n * Given a store and a query, return as much of the result as possible and\n * identify if any data was missing from the store.\n * @param {DocumentNode} query A parsed GraphQL query document\n * @param {Store} store The Apollo Client store object\n * @param {any} previousResult The previous result returned by this function for the same query\n * @return {result: Object, complete: [boolean]}\n */\n public diffQueryAgainstStore({\n store,\n query,\n variables,\n previousResult,\n returnPartialData = true,\n rootId = 'ROOT_QUERY',\n fragmentMatcherFunction,\n config,\n }: DiffQueryAgainstStoreOptions): Cache.DiffResult {\n // Throw the right validation error by trying to find a query in the document\n const queryDefinition = getQueryDefinition(query);\n\n variables = assign({}, getDefaultValues(queryDefinition), variables);\n\n const context: ReadStoreContext = {\n // Global settings\n store,\n dataIdFromObject: config && config.dataIdFromObject,\n cacheRedirects: (config && config.cacheRedirects) || {},\n };\n\n const execResult = this.executeStoreQuery({\n query,\n rootValue: {\n type: 'id',\n id: rootId,\n generated: true,\n typename: 'Query',\n },\n contextValue: context,\n variableValues: variables,\n fragmentMatcher: fragmentMatcherFunction,\n });\n\n const hasMissingFields =\n execResult.missing && execResult.missing.length > 0;\n\n if (hasMissingFields && ! returnPartialData) {\n execResult.missing!.forEach(info => {\n if (info.tolerable) return;\n throw new InvariantError(\n `Can't find field ${info.fieldName} on object ${JSON.stringify(\n info.object,\n null,\n 2,\n )}.`,\n );\n });\n }\n\n if (previousResult) {\n if (isEqual(previousResult, execResult.result)) {\n execResult.result = previousResult;\n }\n }\n\n return {\n result: execResult.result,\n complete: !hasMissingFields,\n };\n }\n\n /**\n * Based on graphql function from graphql-js:\n *\n * graphql(\n * schema: GraphQLSchema,\n * requestString: string,\n * rootValue?: ?any,\n * contextValue?: ?any,\n * variableValues?: ?{[key: string]: any},\n * operationName?: ?string\n * ): Promise\n *\n * The default export as of graphql-anywhere is sync as of 4.0,\n * but below is an exported alternative that is async.\n * In the 5.0 version, this will be the only export again\n * and it will be async\n *\n */\n private executeStoreQuery({\n query,\n rootValue,\n contextValue,\n variableValues,\n // Default matcher always matches all fragments\n fragmentMatcher = defaultFragmentMatcher,\n }: ExecStoreQueryOptions): ExecResult {\n const mainDefinition = getMainDefinition(query);\n const fragments = getFragmentDefinitions(query);\n const fragmentMap = createFragmentMap(fragments);\n const execContext: ExecContext = {\n query,\n fragmentMap,\n contextValue,\n variableValues,\n fragmentMatcher,\n };\n\n return this.executeSelectionSet({\n selectionSet: mainDefinition.selectionSet,\n rootValue,\n execContext,\n });\n }\n\n private executeSelectionSet({\n selectionSet,\n rootValue,\n execContext,\n }: ExecSelectionSetOptions): ExecResult {\n const { fragmentMap, contextValue, variableValues: variables } = execContext;\n const finalResult: ExecResult = { result: null };\n\n const objectsToMerge: { [key: string]: any }[] = [];\n\n const object: StoreObject = contextValue.store.get(rootValue.id);\n\n const typename =\n (object && object.__typename) ||\n (rootValue.id === 'ROOT_QUERY' && 'Query') ||\n void 0;\n\n function handleMissing(result: ExecResult): T {\n if (result.missing) {\n finalResult.missing = finalResult.missing || [];\n finalResult.missing.push(...result.missing);\n }\n return result.result;\n }\n\n selectionSet.selections.forEach(selection => {\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely\n return;\n }\n\n if (isField(selection)) {\n const fieldResult = handleMissing(\n this.executeField(object, typename, selection, execContext),\n );\n\n if (typeof fieldResult !== 'undefined') {\n objectsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n });\n }\n\n } else {\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment\n fragment = fragmentMap[selection.name.value];\n\n if (!fragment) {\n throw new InvariantError(`No fragment named ${selection.name.value}`);\n }\n }\n\n const typeCondition =\n fragment.typeCondition && fragment.typeCondition.name.value;\n\n const match =\n !typeCondition ||\n execContext.fragmentMatcher(rootValue, typeCondition, contextValue);\n\n if (match) {\n let fragmentExecResult = this.executeSelectionSet({\n selectionSet: fragment.selectionSet,\n rootValue,\n execContext,\n });\n\n if (match === 'heuristic' && fragmentExecResult.missing) {\n fragmentExecResult = {\n ...fragmentExecResult,\n missing: fragmentExecResult.missing.map(info => {\n return { ...info, tolerable: true };\n }),\n };\n }\n\n objectsToMerge.push(handleMissing(fragmentExecResult));\n }\n }\n });\n\n // Perform a single merge at the end so that we can avoid making more\n // defensive shallow copies than necessary.\n finalResult.result = mergeDeepArray(objectsToMerge);\n\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n Object.freeze(finalResult.result);\n }\n\n return finalResult;\n }\n\n private executeField(\n object: StoreObject,\n typename: string | void,\n field: FieldNode,\n execContext: ExecContext,\n ): ExecResult {\n const { variableValues: variables, contextValue } = execContext;\n const fieldName = field.name.value;\n const args = argumentsObjectFromField(field, variables);\n\n const info: ExecInfo = {\n resultKey: resultKeyNameFromField(field),\n directives: getDirectiveInfoFromField(field, variables),\n };\n\n const readStoreResult = readStoreResolver(\n object,\n typename,\n fieldName,\n args,\n contextValue,\n info,\n );\n\n if (Array.isArray(readStoreResult.result)) {\n return this.combineExecResults(\n readStoreResult,\n this.executeSubSelectedArray({\n field,\n array: readStoreResult.result,\n execContext,\n }),\n );\n }\n\n // Handle all scalar types here\n if (!field.selectionSet) {\n assertSelectionSetForIdValue(field, readStoreResult.result);\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n maybeDeepFreeze(readStoreResult);\n }\n return readStoreResult;\n }\n\n // From here down, the field has a selection set, which means it's trying to\n // query a GraphQLObjectType\n if (readStoreResult.result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return readStoreResult;\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n return this.combineExecResults(\n readStoreResult,\n this.executeSelectionSet({\n selectionSet: field.selectionSet,\n rootValue: readStoreResult.result,\n execContext,\n }),\n );\n }\n\n private combineExecResults(\n ...execResults: ExecResult[]\n ): ExecResult {\n let missing: ExecResultMissingField[] | undefined;\n execResults.forEach(execResult => {\n if (execResult.missing) {\n missing = missing || [];\n missing.push(...execResult.missing);\n }\n });\n return {\n result: execResults.pop()!.result,\n missing,\n };\n }\n\n private executeSubSelectedArray({\n field,\n array,\n execContext,\n }: ExecSubSelectedArrayOptions): ExecResult {\n let missing: ExecResultMissingField[] | undefined;\n\n function handleMissing(childResult: ExecResult): T {\n if (childResult.missing) {\n missing = missing || [];\n missing.push(...childResult.missing);\n }\n\n return childResult.result;\n }\n\n array = array.map(item => {\n // null value in array\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse\n if (Array.isArray(item)) {\n return handleMissing(this.executeSubSelectedArray({\n field,\n array: item,\n execContext,\n }));\n }\n\n // This is an object, run the selection set on it\n if (field.selectionSet) {\n return handleMissing(this.executeSelectionSet({\n selectionSet: field.selectionSet,\n rootValue: item,\n execContext,\n }));\n }\n\n assertSelectionSetForIdValue(field, item);\n\n return item;\n });\n\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n Object.freeze(array);\n }\n\n return { result: array, missing };\n }\n}\n\nfunction assertSelectionSetForIdValue(\n field: FieldNode,\n value: any,\n) {\n if (!field.selectionSet && isIdValue(value)) {\n throw new InvariantError(\n `Missing selection set for object of type ${\n value.typename\n } returned for query field ${field.name.value}`\n );\n }\n}\n\nfunction defaultFragmentMatcher() {\n return true;\n}\n\nexport function assertIdValue(idValue: IdValue) {\n invariant(isIdValue(idValue), `\\\nEncountered a sub-selection on the query, but the store doesn't have \\\nan object reference. This should never happen during normal use unless you have custom code \\\nthat is directly manipulating the store; please file an issue.`);\n}\n\nfunction readStoreResolver(\n object: StoreObject,\n typename: string | void,\n fieldName: string,\n args: any,\n context: ReadStoreContext,\n { resultKey, directives }: ExecInfo,\n): ExecResult {\n let storeKeyName = fieldName;\n if (args || directives) {\n // We happen to know here that getStoreKeyName returns its first\n // argument unmodified if there are no args or directives, so we can\n // avoid calling the function at all in that case, as a small but\n // important optimization to this frequently executed code.\n storeKeyName = getStoreKeyName(storeKeyName, args, directives);\n }\n\n let fieldValue: StoreValue | void = void 0;\n\n if (object) {\n fieldValue = object[storeKeyName];\n\n if (\n typeof fieldValue === 'undefined' &&\n context.cacheRedirects &&\n typeof typename === 'string'\n ) {\n // Look for the type in the custom resolver map\n const type = context.cacheRedirects[typename];\n if (type) {\n // Look for the field in the custom resolver map\n const resolver = type[fieldName];\n if (resolver) {\n fieldValue = resolver(object, args, {\n getCacheKey(storeObj: StoreObject) {\n const id = context.dataIdFromObject!(storeObj);\n return id && toIdValue({\n id,\n typename: storeObj.__typename,\n });\n },\n });\n }\n }\n }\n }\n\n if (typeof fieldValue === 'undefined') {\n return {\n result: fieldValue,\n missing: [{\n object,\n fieldName: storeKeyName,\n tolerable: false,\n }],\n };\n }\n\n if (isJsonValue(fieldValue)) {\n fieldValue = fieldValue.json;\n }\n\n return {\n result: fieldValue,\n };\n}\n","import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types';\n\nexport class ObjectCache implements NormalizedCache {\n constructor(protected data: NormalizedCacheObject = Object.create(null)) {}\n\n public toObject() {\n return this.data;\n }\n\n public get(dataId: string) {\n return this.data[dataId]!;\n }\n\n public set(dataId: string, value: StoreObject) {\n this.data[dataId] = value;\n }\n\n public delete(dataId: string) {\n this.data[dataId] = void 0;\n }\n\n public clear() {\n this.data = Object.create(null);\n }\n\n public replace(newData: NormalizedCacheObject) {\n this.data = newData || Object.create(null);\n }\n}\n\nexport function defaultNormalizedCacheFactory(\n seed?: NormalizedCacheObject,\n): NormalizedCache {\n return new ObjectCache(seed);\n}\n","import {\n SelectionSetNode,\n FieldNode,\n DocumentNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n} from 'graphql';\nimport { FragmentMatcher } from './readFromStore';\n\nimport {\n assign,\n createFragmentMap,\n FragmentMap,\n getDefaultValues,\n getFragmentDefinitions,\n getOperationDefinition,\n IdValue,\n isField,\n isIdValue,\n isInlineFragment,\n isProduction,\n resultKeyNameFromField,\n shouldInclude,\n storeKeyNameFromField,\n StoreValue,\n toIdValue,\n isEqual,\n} from 'apollo-utilities';\n\nimport { invariant } from 'ts-invariant';\n\nimport { ObjectCache } from './objectCache';\nimport { defaultNormalizedCacheFactory } from './depTrackingCache';\n\nimport {\n IdGetter,\n NormalizedCache,\n ReadStoreContext,\n StoreObject,\n} from './types';\n\nexport class WriteError extends Error {\n public type = 'WriteError';\n}\n\nexport function enhanceErrorWithDocument(error: Error, document: DocumentNode) {\n // XXX A bit hacky maybe ...\n const enhancedError = new WriteError(\n `Error writing result to store for query:\\n ${JSON.stringify(document)}`,\n );\n enhancedError.message += '\\n' + error.message;\n enhancedError.stack = error.stack;\n return enhancedError;\n}\n\nexport type WriteContext = {\n readonly store: NormalizedCache;\n readonly processedData?: { [x: string]: FieldNode[] };\n readonly variables?: any;\n readonly dataIdFromObject?: IdGetter;\n readonly fragmentMap?: FragmentMap;\n readonly fragmentMatcherFunction?: FragmentMatcher;\n};\n\nexport class StoreWriter {\n /**\n * Writes the result of a query to the store.\n *\n * @param result The result object returned for the query document.\n *\n * @param query The query document whose result we are writing to the store.\n *\n * @param store The {@link NormalizedCache} used by Apollo for the `data` portion of the store.\n *\n * @param variables A map from the name of a variable to its value. These variables can be\n * referenced by the query document.\n *\n * @param dataIdFromObject A function that returns an object identifier given a particular result\n * object. See the store documentation for details and an example of this function.\n *\n * @param fragmentMatcherFunction A function to use for matching fragment conditions in GraphQL documents\n */\n public writeQueryToStore({\n query,\n result,\n store = defaultNormalizedCacheFactory(),\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n }: {\n query: DocumentNode;\n result: Object;\n store?: NormalizedCache;\n variables?: Object;\n dataIdFromObject?: IdGetter;\n fragmentMatcherFunction?: FragmentMatcher;\n }): NormalizedCache {\n return this.writeResultToStore({\n dataId: 'ROOT_QUERY',\n result,\n document: query,\n store,\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n });\n }\n\n public writeResultToStore({\n dataId,\n result,\n document,\n store = defaultNormalizedCacheFactory(),\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n }: {\n dataId: string;\n result: any;\n document: DocumentNode;\n store?: NormalizedCache;\n variables?: Object;\n dataIdFromObject?: IdGetter;\n fragmentMatcherFunction?: FragmentMatcher;\n }): NormalizedCache {\n // XXX TODO REFACTOR: this is a temporary workaround until query normalization is made to work with documents.\n const operationDefinition = getOperationDefinition(document)!;\n\n try {\n return this.writeSelectionSetToStore({\n result,\n dataId,\n selectionSet: operationDefinition.selectionSet,\n context: {\n store,\n processedData: {},\n variables: assign(\n {},\n getDefaultValues(operationDefinition),\n variables,\n ),\n dataIdFromObject,\n fragmentMap: createFragmentMap(getFragmentDefinitions(document)),\n fragmentMatcherFunction,\n },\n });\n } catch (e) {\n throw enhanceErrorWithDocument(e, document);\n }\n }\n\n public writeSelectionSetToStore({\n result,\n dataId,\n selectionSet,\n context,\n }: {\n dataId: string;\n result: any;\n selectionSet: SelectionSetNode;\n context: WriteContext;\n }): NormalizedCache {\n const { variables, store, fragmentMap } = context;\n\n selectionSet.selections.forEach(selection => {\n if (!shouldInclude(selection, variables)) {\n return;\n }\n\n if (isField(selection)) {\n const resultFieldKey: string = resultKeyNameFromField(selection);\n const value: any = result[resultFieldKey];\n\n if (typeof value !== 'undefined') {\n this.writeFieldToStore({\n dataId,\n value,\n field: selection,\n context,\n });\n } else {\n let isDefered = false;\n let isClient = false;\n if (selection.directives && selection.directives.length) {\n // If this is a defered field we don't need to throw / warn.\n isDefered = selection.directives.some(\n directive => directive.name && directive.name.value === 'defer',\n );\n\n // When using the @client directive, it might be desirable in\n // some cases to want to write a selection set to the store,\n // without having all of the selection set values available.\n // This is because the @client field values might have already\n // been written to the cache separately (e.g. via Apollo\n // Cache's `writeData` capabilities). Because of this, we'll\n // skip the missing field warning for fields with @client\n // directives.\n isClient = selection.directives.some(\n directive => directive.name && directive.name.value === 'client',\n );\n }\n\n if (!isDefered && !isClient && context.fragmentMatcherFunction) {\n // XXX We'd like to throw an error, but for backwards compatibility's sake\n // we just print a warning for the time being.\n //throw new WriteError(`Missing field ${resultFieldKey} in ${JSON.stringify(result, null, 2).substring(0, 100)}`);\n invariant.warn(\n `Missing field ${resultFieldKey} in ${JSON.stringify(\n result,\n null,\n 2,\n ).substring(0, 100)}`,\n );\n }\n }\n } else {\n // This is not a field, so it must be a fragment, either inline or named\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // Named fragment\n fragment = (fragmentMap || {})[selection.name.value];\n invariant(fragment, `No fragment named ${selection.name.value}.`);\n }\n\n let matches = true;\n if (context.fragmentMatcherFunction && fragment.typeCondition) {\n // TODO we need to rewrite the fragment matchers for this to work properly and efficiently\n // Right now we have to pretend that we're passing in an idValue and that there's a store\n // on the context.\n const id = dataId || 'self';\n const idValue = toIdValue({ id, typename: undefined });\n const fakeContext: ReadStoreContext = {\n // NOTE: fakeContext always uses ObjectCache\n // since this is only to ensure the return value of 'matches'\n store: new ObjectCache({ [id]: result }),\n cacheRedirects: {},\n };\n const match = context.fragmentMatcherFunction(\n idValue,\n fragment.typeCondition.name.value,\n fakeContext,\n );\n if (!isProduction() && match === 'heuristic') {\n invariant.error('WARNING: heuristic fragment matching going on!');\n }\n matches = !!match;\n }\n\n if (matches) {\n this.writeSelectionSetToStore({\n result,\n selectionSet: fragment.selectionSet,\n dataId,\n context,\n });\n }\n }\n });\n\n return store;\n }\n\n private writeFieldToStore({\n field,\n value,\n dataId,\n context,\n }: {\n field: FieldNode;\n value: any;\n dataId: string;\n context: WriteContext;\n }) {\n const { variables, dataIdFromObject, store } = context;\n\n let storeValue: StoreValue;\n let storeObject: StoreObject;\n\n const storeFieldName: string = storeKeyNameFromField(field, variables);\n\n // If this is a scalar value...\n if (!field.selectionSet || value === null) {\n storeValue =\n value != null && typeof value === 'object'\n ? // If the scalar value is a JSON blob, we have to \"escape\" it so it can’t pretend to be\n // an id.\n { type: 'json', json: value }\n : // Otherwise, just store the scalar directly in the store.\n value;\n } else if (Array.isArray(value)) {\n const generatedId = `${dataId}.${storeFieldName}`;\n\n storeValue = this.processArrayValue(\n value,\n generatedId,\n field.selectionSet,\n context,\n );\n } else {\n // It's an object\n let valueDataId = `${dataId}.${storeFieldName}`;\n let generated = true;\n\n // We only prepend the '$' if the valueDataId isn't already a generated\n // id.\n if (!isGeneratedId(valueDataId)) {\n valueDataId = '$' + valueDataId;\n }\n\n if (dataIdFromObject) {\n const semanticId = dataIdFromObject(value);\n\n // We throw an error if the first character of the id is '$. This is\n // because we use that character to designate an Apollo-generated id\n // and we use the distinction between user-desiginated and application-provided\n // ids when managing overwrites.\n invariant(\n !semanticId || !isGeneratedId(semanticId),\n 'IDs returned by dataIdFromObject cannot begin with the \"$\" character.',\n );\n\n if (\n semanticId ||\n (typeof semanticId === 'number' && semanticId === 0)\n ) {\n valueDataId = semanticId;\n generated = false;\n }\n }\n\n if (!isDataProcessed(valueDataId, field, context.processedData)) {\n this.writeSelectionSetToStore({\n dataId: valueDataId,\n result: value,\n selectionSet: field.selectionSet,\n context,\n });\n }\n\n // We take the id and escape it (i.e. wrap it with an enclosing object).\n // This allows us to distinguish IDs from normal scalars.\n const typename = value.__typename;\n storeValue = toIdValue({ id: valueDataId, typename }, generated);\n\n // check if there was a generated id at the location where we're\n // about to place this new id. If there was, we have to merge the\n // data from that id with the data we're about to write in the store.\n storeObject = store.get(dataId);\n const escapedId =\n storeObject && (storeObject[storeFieldName] as IdValue | undefined);\n if (escapedId !== storeValue && isIdValue(escapedId)) {\n const hadTypename = escapedId.typename !== undefined;\n const hasTypename = typename !== undefined;\n const typenameChanged =\n hadTypename && hasTypename && escapedId.typename !== typename;\n\n // If there is already a real id in the store and the current id we\n // are dealing with is generated, we throw an error.\n // One exception we allow is when the typename has changed, which occurs\n // when schema defines a union, both with and without an ID in the same place.\n // checks if we \"lost\" the read id\n invariant(\n !generated || escapedId.generated || typenameChanged,\n `Store error: the application attempted to write an object with no provided id but the store already contains an id of ${\n escapedId.id\n } for this object. The selectionSet that was trying to be written is:\\n${\n JSON.stringify(field)\n }`,\n );\n\n // checks if we \"lost\" the typename\n invariant(\n !hadTypename || hasTypename,\n `Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of ${\n escapedId.typename\n } for the object of id ${escapedId.id}. The selectionSet that was trying to be written is:\\n${\n JSON.stringify(field)\n }`,\n );\n\n if (escapedId.generated) {\n // We should only merge if it's an object of the same type,\n // otherwise we should delete the generated object\n if (typenameChanged) {\n // Only delete the generated object when the old object was\n // inlined, and the new object is not. This is indicated by\n // the old id being generated, and the new id being real.\n if (!generated) {\n store.delete(escapedId.id);\n }\n } else {\n mergeWithGenerated(escapedId.id, (storeValue as IdValue).id, store);\n }\n }\n }\n }\n\n storeObject = store.get(dataId);\n if (!storeObject || !isEqual(storeValue, storeObject[storeFieldName])) {\n store.set(dataId, {\n ...storeObject,\n [storeFieldName]: storeValue,\n });\n }\n }\n\n private processArrayValue(\n value: any[],\n generatedId: string,\n selectionSet: SelectionSetNode,\n context: WriteContext,\n ): any[] {\n return value.map((item: any, index: any) => {\n if (item === null) {\n return null;\n }\n\n let itemDataId = `${generatedId}.${index}`;\n\n if (Array.isArray(item)) {\n return this.processArrayValue(item, itemDataId, selectionSet, context);\n }\n\n let generated = true;\n\n if (context.dataIdFromObject) {\n const semanticId = context.dataIdFromObject(item);\n\n if (semanticId) {\n itemDataId = semanticId;\n generated = false;\n }\n }\n\n if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) {\n this.writeSelectionSetToStore({\n dataId: itemDataId,\n result: item,\n selectionSet,\n context,\n });\n }\n\n return toIdValue(\n { id: itemDataId, typename: item.__typename },\n generated,\n );\n });\n }\n}\n\n// Checks if the id given is an id that was generated by Apollo\n// rather than by dataIdFromObject.\nfunction isGeneratedId(id: string): boolean {\n return id[0] === '$';\n}\n\nfunction mergeWithGenerated(\n generatedKey: string,\n realKey: string,\n cache: NormalizedCache,\n): boolean {\n if (generatedKey === realKey) {\n return false;\n }\n\n const generated = cache.get(generatedKey);\n const real = cache.get(realKey);\n let madeChanges = false;\n\n Object.keys(generated).forEach(key => {\n const value = generated[key];\n const realValue = real[key];\n\n if (\n isIdValue(value) &&\n isGeneratedId(value.id) &&\n isIdValue(realValue) &&\n !isEqual(value, realValue) &&\n mergeWithGenerated(value.id, realValue.id, cache)\n ) {\n madeChanges = true;\n }\n });\n\n cache.delete(generatedKey);\n const newRealValue = { ...generated, ...real };\n\n if (isEqual(newRealValue, real)) {\n return madeChanges;\n }\n\n cache.set(realKey, newRealValue);\n return true;\n}\n\nfunction isDataProcessed(\n dataId: string,\n field: FieldNode | SelectionSetNode,\n processedData?: { [x: string]: (FieldNode | SelectionSetNode)[] },\n): boolean {\n if (!processedData) {\n return false;\n }\n\n if (processedData[dataId]) {\n if (processedData[dataId].indexOf(field) >= 0) {\n return true;\n } else {\n processedData[dataId].push(field);\n }\n } else {\n processedData[dataId] = [field];\n }\n\n return false;\n}\n","// Make builtins like Map and Set safe to use with non-extensible objects.\nimport './fixPolyfills';\n\nimport { DocumentNode } from 'graphql';\n\nimport { Cache, ApolloCache, Transaction } from 'apollo-cache';\n\nimport { addTypenameToDocument, canUseWeakMap } from 'apollo-utilities';\n\nimport { wrap } from 'optimism';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { HeuristicFragmentMatcher } from './fragmentMatcher';\nimport {\n ApolloReducerConfig,\n NormalizedCache,\n NormalizedCacheObject,\n} from './types';\n\nimport { StoreReader } from './readFromStore';\nimport { StoreWriter } from './writeToStore';\nimport { DepTrackingCache } from './depTrackingCache';\nimport { KeyTrie } from 'optimism';\nimport { ObjectCache } from './objectCache';\n\nexport interface InMemoryCacheConfig extends ApolloReducerConfig {\n resultCaching?: boolean;\n freezeResults?: boolean;\n}\n\nconst defaultConfig: InMemoryCacheConfig = {\n fragmentMatcher: new HeuristicFragmentMatcher(),\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n freezeResults: false,\n};\n\nexport function defaultDataIdFromObject(result: any): string | null {\n if (result.__typename) {\n if (result.id !== undefined) {\n return `${result.__typename}:${result.id}`;\n }\n if (result._id !== undefined) {\n return `${result.__typename}:${result._id}`;\n }\n }\n return null;\n}\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nexport class OptimisticCacheLayer extends ObjectCache {\n constructor(\n public readonly optimisticId: string,\n // OptimisticCacheLayer objects always wrap some other parent cache, so\n // this.parent should never be null.\n public readonly parent: NormalizedCache,\n public readonly transaction: Transaction,\n ) {\n super(Object.create(null));\n }\n\n public toObject(): NormalizedCacheObject {\n return {\n ...this.parent.toObject(),\n ...this.data,\n };\n }\n\n // All the other accessor methods of ObjectCache work without knowing about\n // this.parent, but the get method needs to be overridden to implement the\n // fallback this.parent.get(dataId) behavior.\n public get(dataId: string) {\n return hasOwn.call(this.data, dataId)\n ? this.data[dataId]\n : this.parent.get(dataId);\n }\n}\n\nexport class InMemoryCache extends ApolloCache {\n private data: NormalizedCache;\n private optimisticData: NormalizedCache;\n\n protected config: InMemoryCacheConfig;\n private watches = new Set();\n private addTypename: boolean;\n private typenameDocumentCache = new Map();\n private storeReader: StoreReader;\n private storeWriter: StoreWriter;\n private cacheKeyRoot = new KeyTrie(canUseWeakMap);\n\n // Set this while in a transaction to prevent broadcasts...\n // don't forget to turn it back on!\n private silenceBroadcast: boolean = false;\n\n constructor(config: InMemoryCacheConfig = {}) {\n super();\n this.config = { ...defaultConfig, ...config };\n\n // backwards compat\n if ((this.config as any).customResolvers) {\n invariant.warn(\n 'customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.',\n );\n this.config.cacheRedirects = (this.config as any).customResolvers;\n }\n\n if ((this.config as any).cacheResolvers) {\n invariant.warn(\n 'cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.',\n );\n this.config.cacheRedirects = (this.config as any).cacheResolvers;\n }\n\n this.addTypename = !!this.config.addTypename;\n\n // Passing { resultCaching: false } in the InMemoryCache constructor options\n // will completely disable dependency tracking, which will improve memory\n // usage but worsen the performance of repeated reads.\n this.data = this.config.resultCaching\n ? new DepTrackingCache()\n : new ObjectCache();\n\n // When no optimistic writes are currently active, cache.optimisticData ===\n // cache.data, so there are no additional layers on top of the actual data.\n // When an optimistic update happens, this.optimisticData will become a\n // linked list of OptimisticCacheLayer objects that terminates with the\n // original this.data cache object.\n this.optimisticData = this.data;\n\n this.storeWriter = new StoreWriter();\n this.storeReader = new StoreReader({\n cacheKeyRoot: this.cacheKeyRoot,\n freezeResults: config.freezeResults,\n });\n\n const cache = this;\n const { maybeBroadcastWatch } = cache;\n this.maybeBroadcastWatch = wrap((c: Cache.WatchOptions) => {\n return maybeBroadcastWatch.call(this, c);\n }, {\n makeCacheKey(c: Cache.WatchOptions) {\n if (c.optimistic) {\n // If we're reading optimistic data, it doesn't matter if this.data\n // is a DepTrackingCache, since it will be ignored.\n return;\n }\n\n if (c.previousResult) {\n // If a previousResult was provided, assume the caller would prefer\n // to compare the previous data to the new data to determine whether\n // to broadcast, so we should disable caching by returning here, to\n // give maybeBroadcastWatch a chance to do that comparison.\n return;\n }\n\n if (cache.data instanceof DepTrackingCache) {\n // Return a cache key (thus enabling caching) only if we're currently\n // using a data store that can track cache dependencies.\n return cache.cacheKeyRoot.lookup(\n c.query,\n JSON.stringify(c.variables),\n );\n }\n }\n });\n }\n\n public restore(data: NormalizedCacheObject): this {\n if (data) this.data.replace(data);\n return this;\n }\n\n public extract(optimistic: boolean = false): NormalizedCacheObject {\n return (optimistic ? this.optimisticData : this.data).toObject();\n }\n\n public read(options: Cache.ReadOptions): T | null {\n if (typeof options.rootId === 'string' &&\n typeof this.data.get(options.rootId) === 'undefined') {\n return null;\n }\n\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n return this.storeReader.readQueryFromStore({\n store: options.optimistic ? this.optimisticData : this.data,\n query: this.transformDocument(options.query),\n variables: options.variables,\n rootId: options.rootId,\n fragmentMatcherFunction,\n previousResult: options.previousResult,\n config: this.config,\n }) || null;\n }\n\n public write(write: Cache.WriteOptions): void {\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n this.storeWriter.writeResultToStore({\n dataId: write.dataId,\n result: write.result,\n variables: write.variables,\n document: this.transformDocument(write.query),\n store: this.data,\n dataIdFromObject: this.config.dataIdFromObject,\n fragmentMatcherFunction,\n });\n\n this.broadcastWatches();\n }\n\n public diff(query: Cache.DiffOptions): Cache.DiffResult {\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n return this.storeReader.diffQueryAgainstStore({\n store: query.optimistic ? this.optimisticData : this.data,\n query: this.transformDocument(query.query),\n variables: query.variables,\n returnPartialData: query.returnPartialData,\n previousResult: query.previousResult,\n fragmentMatcherFunction,\n config: this.config,\n });\n }\n\n public watch(watch: Cache.WatchOptions): () => void {\n this.watches.add(watch);\n\n return () => {\n this.watches.delete(watch);\n };\n }\n\n public evict(query: Cache.EvictOptions): Cache.EvictionResult {\n throw new InvariantError(`eviction is not implemented on InMemory Cache`);\n }\n\n public reset(): Promise {\n this.data.clear();\n this.broadcastWatches();\n\n return Promise.resolve();\n }\n\n public removeOptimistic(idToRemove: string) {\n const toReapply: OptimisticCacheLayer[] = [];\n let removedCount = 0;\n let layer = this.optimisticData;\n\n while (layer instanceof OptimisticCacheLayer) {\n if (layer.optimisticId === idToRemove) {\n ++removedCount;\n } else {\n toReapply.push(layer);\n }\n layer = layer.parent;\n }\n\n if (removedCount > 0) {\n // Reset this.optimisticData to the first non-OptimisticCacheLayer object,\n // which is almost certainly this.data.\n this.optimisticData = layer;\n\n // Reapply the layers whose optimistic IDs do not match the removed ID.\n while (toReapply.length > 0) {\n const layer = toReapply.pop()!;\n this.performTransaction(layer.transaction, layer.optimisticId);\n }\n\n this.broadcastWatches();\n }\n }\n\n public performTransaction(\n transaction: Transaction,\n // This parameter is not part of the performTransaction signature inherited\n // from the ApolloCache abstract class, but it's useful because it saves us\n // from duplicating this implementation in recordOptimisticTransaction.\n optimisticId?: string,\n ) {\n const { data, silenceBroadcast } = this;\n this.silenceBroadcast = true;\n\n if (typeof optimisticId === 'string') {\n // Add a new optimistic layer and temporarily make this.data refer to\n // that layer for the duration of the transaction.\n this.data = this.optimisticData = new OptimisticCacheLayer(\n // Note that there can be multiple layers with the same optimisticId.\n // When removeOptimistic(id) is called for that id, all matching layers\n // will be removed, and the remaining layers will be reapplied.\n optimisticId,\n this.optimisticData,\n transaction,\n );\n }\n\n try {\n transaction(this);\n } finally {\n this.silenceBroadcast = silenceBroadcast;\n this.data = data;\n }\n\n // This broadcast does nothing if this.silenceBroadcast is true.\n this.broadcastWatches();\n }\n\n public recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ) {\n return this.performTransaction(transaction, id);\n }\n\n public transformDocument(document: DocumentNode): DocumentNode {\n if (this.addTypename) {\n let result = this.typenameDocumentCache.get(document);\n if (!result) {\n result = addTypenameToDocument(document);\n this.typenameDocumentCache.set(document, result);\n // If someone calls transformDocument and then mistakenly passes the\n // result back into an API that also calls transformDocument, make sure\n // we don't keep creating new query documents.\n this.typenameDocumentCache.set(result, result);\n }\n return result;\n }\n return document;\n }\n\n protected broadcastWatches() {\n if (!this.silenceBroadcast) {\n this.watches.forEach(c => this.maybeBroadcastWatch(c));\n }\n }\n\n // This method is wrapped in the constructor so that it will be called only\n // if the data that would be broadcast has changed.\n private maybeBroadcastWatch(c: Cache.WatchOptions) {\n c.callback(\n this.diff({\n query: c.query,\n variables: c.variables,\n previousResult: c.previousResult && c.previousResult(),\n optimistic: c.optimistic,\n }),\n );\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/bundle.cjs.min.js b/node_modules/apollo-cache-inmemory/lib/bundle.cjs.min.js deleted file mode 100644 index cd4f04fb..00000000 --- a/node_modules/apollo-cache-inmemory/lib/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.assertIdValue=function(e){(0,a.invariant)((0,r.isIdValue)(e),11)},exports.defaultDataIdFromObject=R,exports.defaultNormalizedCacheFactory=function(e){return new m(e)},exports.enhanceErrorWithDocument=v,exports.WriteError=exports.StoreWriter=exports.StoreReader=exports.ObjectCache=exports.IntrospectionFragmentMatcher=exports.InMemoryCache=exports.HeuristicFragmentMatcher=void 0;var e=require("tslib"),t=require("apollo-cache"),r=require("apollo-utilities"),i=require("optimism"),a=require("ts-invariant"),n=!1;function o(){var e=!n;return(0,r.isTest)()||(n=!0),e}var s=function(){function e(){}return e.prototype.ensureReady=function(){return Promise.resolve()},e.prototype.canBypassInit=function(){return!0},e.prototype.match=function(e,t,r){var i=r.store.get(e.id),a="ROOT_QUERY"===e.id;if(!i)return a;var n=i.__typename,s=void 0===n?a&&"Query":n;return s&&s===t||(o(),"heuristic")},e}();exports.HeuristicFragmentMatcher=s;var c=function(){function e(e){e&&e.introspectionQueryResultData?(this.possibleTypesMap=this.parseIntrospectionResult(e.introspectionQueryResultData),this.isReady=!0):this.isReady=!1,this.match=this.match.bind(this)}return e.prototype.match=function(e,t,r){(0,a.invariant)(this.isReady,1);var i=r.store.get(e.id),n="ROOT_QUERY"===e.id;if(!i)return n;var o=i.__typename,s=void 0===o?n&&"Query":o;if((0,a.invariant)(s,2),s===t)return!0;var c=this.possibleTypesMap[t];return!!(s&&c&&c.indexOf(s)>-1)},e.prototype.parseIntrospectionResult=function(e){var t={};return e.__schema.types.forEach(function(e){"UNION"!==e.kind&&"INTERFACE"!==e.kind||(t[e.name]=e.possibleTypes.map(function(e){return e.name}))}),t},e}();exports.IntrospectionFragmentMatcher=c;var u=Object.prototype.hasOwnProperty,l=function(){function e(e){var t=this;void 0===e&&(e=Object.create(null)),this.data=e,this.depend=(0,i.wrap)(function(e){return t.data[e]},{disposable:!0,makeCacheKey:function(e){return e}})}return e.prototype.toObject=function(){return this.data},e.prototype.get=function(e){return this.depend(e),this.data[e]},e.prototype.set=function(e,t){t!==this.data[e]&&(this.data[e]=t,this.depend.dirty(e))},e.prototype.delete=function(e){u.call(this.data,e)&&(delete this.data[e],this.depend.dirty(e))},e.prototype.clear=function(){this.replace(null)},e.prototype.replace=function(e){var t=this;e?(Object.keys(e).forEach(function(r){t.set(r,e[r])}),Object.keys(this.data).forEach(function(r){u.call(e,r)||t.delete(r)})):Object.keys(this.data).forEach(function(e){t.delete(e)})},e}();function d(e){return new l(e)}var p=function(){function t(e){var t=this,a=void 0===e?{}:e,n=a.cacheKeyRoot,o=void 0===n?new i.KeyTrie(r.canUseWeakMap):n,s=a.freezeResults,c=void 0!==s&&s,u=this.executeStoreQuery,d=this.executeSelectionSet,p=this.executeSubSelectedArray;this.freezeResults=c,this.executeStoreQuery=(0,i.wrap)(function(e){return u.call(t,e)},{makeCacheKey:function(e){var t=e.query,r=e.rootValue,i=e.contextValue,a=e.variableValues,n=e.fragmentMatcher;if(i.store instanceof l)return o.lookup(i.store,t,n,JSON.stringify(a),r.id)}}),this.executeSelectionSet=(0,i.wrap)(function(e){return d.call(t,e)},{makeCacheKey:function(e){var t=e.selectionSet,r=e.rootValue,i=e.execContext;if(i.contextValue.store instanceof l)return o.lookup(i.contextValue.store,t,i.fragmentMatcher,JSON.stringify(i.variableValues),r.id)}}),this.executeSubSelectedArray=(0,i.wrap)(function(e){return p.call(t,e)},{makeCacheKey:function(e){var t=e.field,r=e.array,i=e.execContext;if(i.contextValue.store instanceof l)return o.lookup(i.contextValue.store,t,r,JSON.stringify(i.variableValues))}})}return t.prototype.readQueryFromStore=function(t){return this.diffQueryAgainstStore((0,e.__assign)((0,e.__assign)({},t),{returnPartialData:!1})).result},t.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.variables,o=e.previousResult,s=e.returnPartialData,c=void 0===s||s,u=e.rootId,l=void 0===u?"ROOT_QUERY":u,d=e.fragmentMatcherFunction,p=e.config,f=(0,r.getQueryDefinition)(i);n=(0,r.assign)({},(0,r.getDefaultValues)(f),n);var h={store:t,dataIdFromObject:p&&p.dataIdFromObject,cacheRedirects:p&&p.cacheRedirects||{}},m=this.executeStoreQuery({query:i,rootValue:{type:"id",id:l,generated:!0,typename:"Query"},contextValue:h,variableValues:n,fragmentMatcher:d}),y=m.missing&&m.missing.length>0;return y&&!c&&m.missing.forEach(function(e){if(!e.tolerable)throw new a.InvariantError(8)}),o&&(0,r.isEqual)(o,m.result)&&(m.result=o),{result:m.result,complete:!y}},t.prototype.executeStoreQuery=function(e){var t=e.query,i=e.rootValue,a=e.contextValue,n=e.variableValues,o=e.fragmentMatcher,s=void 0===o?h:o,c=(0,r.getMainDefinition)(t),u=(0,r.getFragmentDefinitions)(t),l={query:t,fragmentMap:(0,r.createFragmentMap)(u),contextValue:a,variableValues:n,fragmentMatcher:s};return this.executeSelectionSet({selectionSet:c.selectionSet,rootValue:i,execContext:l})},t.prototype.executeSelectionSet=function(t){var i=this,n=t.selectionSet,o=t.rootValue,s=t.execContext,c=s.fragmentMap,u=s.contextValue,l=s.variableValues,d={result:null},p=[],f=u.store.get(o.id),h=f&&f.__typename||"ROOT_QUERY"===o.id&&"Query"||void 0;function m(e){var t;return e.missing&&(d.missing=d.missing||[],(t=d.missing).push.apply(t,e.missing)),e.result}return n.selections.forEach(function(t){var n;if((0,r.shouldInclude)(t,l))if((0,r.isField)(t)){var d=m(i.executeField(f,h,t,s));void 0!==d&&p.push(((n={})[(0,r.resultKeyNameFromField)(t)]=d,n))}else{var y=void 0;if((0,r.isInlineFragment)(t))y=t;else if(!(y=c[t.name.value]))throw new a.InvariantError(9);var v=y.typeCondition&&y.typeCondition.name.value,g=!v||s.fragmentMatcher(o,v,u);if(g){var S=i.executeSelectionSet({selectionSet:y.selectionSet,rootValue:o,execContext:s});"heuristic"===g&&S.missing&&(S=(0,e.__assign)((0,e.__assign)({},S),{missing:S.missing.map(function(t){return(0,e.__assign)((0,e.__assign)({},t),{tolerable:!0})})})),p.push(m(S))}}}),d.result=(0,r.mergeDeepArray)(p),this.freezeResults,d},t.prototype.executeField=function(e,t,i,a){var n=a.variableValues,o=a.contextValue,s=function(e,t,i,a,n,o){o.resultKey;var s=o.directives,c=i;(a||s)&&(c=(0,r.getStoreKeyName)(c,a,s));var u=void 0;if(e&&void 0===(u=e[c])&&n.cacheRedirects&&"string"==typeof t){var l=n.cacheRedirects[t];if(l){var d=l[i];d&&(u=d(e,a,{getCacheKey:function(e){var t=n.dataIdFromObject(e);return t&&(0,r.toIdValue)({id:t,typename:e.__typename})}}))}}if(void 0===u)return{result:u,missing:[{object:e,fieldName:c,tolerable:!1}]};(0,r.isJsonValue)(u)&&(u=u.json);return{result:u}}(e,t,i.name.value,(0,r.argumentsObjectFromField)(i,n),o,{resultKey:(0,r.resultKeyNameFromField)(i),directives:(0,r.getDirectiveInfoFromField)(i,n)});return Array.isArray(s.result)?this.combineExecResults(s,this.executeSubSelectedArray({field:i,array:s.result,execContext:a})):i.selectionSet?null==s.result?s:this.combineExecResults(s,this.executeSelectionSet({selectionSet:i.selectionSet,rootValue:s.result,execContext:a})):(f(i,s.result),this.freezeResults,s)},t.prototype.combineExecResults=function(){for(var e,t=[],r=0;r=0)return!0;r[e].push(t)}else r[e]=[t];return!1}exports.StoreWriter=g;var x={fragmentMatcher:new s,dataIdFromObject:R,addTypename:!0,resultCaching:!0,freezeResults:!1};function R(e){if(e.__typename){if(void 0!==e.id)return e.__typename+":"+e.id;if(void 0!==e._id)return e.__typename+":"+e._id}return null}var _=Object.prototype.hasOwnProperty,I=function(t){function r(e,r,i){var a=t.call(this,Object.create(null))||this;return a.optimisticId=e,a.parent=r,a.transaction=i,a}return(0,e.__extends)(r,t),r.prototype.toObject=function(){return(0,e.__assign)((0,e.__assign)({},this.parent.toObject()),this.data)},r.prototype.get=function(e){return _.call(this.data,e)?this.data[e]:this.parent.get(e)},r}(m),F=function(t){function n(a){void 0===a&&(a={});var n=t.call(this)||this;n.watches=new Set,n.typenameDocumentCache=new Map,n.cacheKeyRoot=new i.KeyTrie(r.canUseWeakMap),n.silenceBroadcast=!1,n.config=(0,e.__assign)((0,e.__assign)({},x),a),n.config.customResolvers&&(n.config.cacheRedirects=n.config.customResolvers),n.config.cacheResolvers&&(n.config.cacheRedirects=n.config.cacheResolvers),n.addTypename=!!n.config.addTypename,n.data=n.config.resultCaching?new l:new m,n.optimisticData=n.data,n.storeWriter=new g,n.storeReader=new p({cacheKeyRoot:n.cacheKeyRoot,freezeResults:a.freezeResults});var o=n,s=o.maybeBroadcastWatch;return n.maybeBroadcastWatch=(0,i.wrap)(function(e){return s.call(n,e)},{makeCacheKey:function(e){if(!e.optimistic&&!e.previousResult)return o.data instanceof l?o.cacheKeyRoot.lookup(e.query,JSON.stringify(e.variables)):void 0}}),n}return(0,e.__extends)(n,t),n.prototype.restore=function(e){return e&&this.data.replace(e),this},n.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).toObject()},n.prototype.read=function(e){if("string"==typeof e.rootId&&void 0===this.data.get(e.rootId))return null;var t=this.config.fragmentMatcher,r=t&&t.match;return this.storeReader.readQueryFromStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,rootId:e.rootId,fragmentMatcherFunction:r,previousResult:e.previousResult,config:this.config})||null},n.prototype.write=function(e){var t=this.config.fragmentMatcher,r=t&&t.match;this.storeWriter.writeResultToStore({dataId:e.dataId,result:e.result,variables:e.variables,document:this.transformDocument(e.query),store:this.data,dataIdFromObject:this.config.dataIdFromObject,fragmentMatcherFunction:r}),this.broadcastWatches()},n.prototype.diff=function(e){var t=this.config.fragmentMatcher,r=t&&t.match;return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,returnPartialData:e.returnPartialData,previousResult:e.previousResult,fragmentMatcherFunction:r,config:this.config})},n.prototype.watch=function(e){var t=this;return this.watches.add(e),function(){t.watches.delete(e)}},n.prototype.evict=function(e){throw new a.InvariantError(7)},n.prototype.reset=function(){return this.data.clear(),this.broadcastWatches(),Promise.resolve()},n.prototype.removeOptimistic=function(e){for(var t=[],r=0,i=this.optimisticData;i instanceof I;)i.optimisticId===e?++r:t.push(i),i=i.parent;if(r>0){for(this.optimisticData=i;t.length>0;){var a=t.pop();this.performTransaction(a.transaction,a.optimisticId)}this.broadcastWatches()}},n.prototype.performTransaction=function(e,t){var r=this.data,i=this.silenceBroadcast;this.silenceBroadcast=!0,"string"==typeof t&&(this.data=this.optimisticData=new I(t,this.optimisticData,e));try{e(this)}finally{this.silenceBroadcast=i,this.data=r}this.broadcastWatches()},n.prototype.recordOptimisticTransaction=function(e,t){return this.performTransaction(e,t)},n.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=(0,r.addTypenameToDocument)(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},n.prototype.broadcastWatches=function(){var e=this;this.silenceBroadcast||this.watches.forEach(function(t){return e.maybeBroadcastWatch(t)})},n.prototype.maybeBroadcastWatch=function(e){e.callback(this.diff({query:e.query,variables:e.variables,previousResult:e.previousResult&&e.previousResult(),optimistic:e.optimistic}))},n}(t.ApolloCache);exports.InMemoryCache=F; diff --git a/node_modules/apollo-cache-inmemory/lib/bundle.esm.js b/node_modules/apollo-cache-inmemory/lib/bundle.esm.js deleted file mode 100644 index 44ee01e1..00000000 --- a/node_modules/apollo-cache-inmemory/lib/bundle.esm.js +++ /dev/null @@ -1,984 +0,0 @@ -import { __assign, __extends } from 'tslib'; -import { ApolloCache } from 'apollo-cache'; -import { isTest, getQueryDefinition, assign, getDefaultValues, isEqual, getMainDefinition, getFragmentDefinitions, createFragmentMap, shouldInclude, isField, resultKeyNameFromField, isInlineFragment, mergeDeepArray, argumentsObjectFromField, getDirectiveInfoFromField, maybeDeepFreeze, isIdValue, getStoreKeyName, toIdValue, isJsonValue, canUseWeakMap, getOperationDefinition, isProduction, storeKeyNameFromField, addTypenameToDocument } from 'apollo-utilities'; -import { wrap, KeyTrie } from 'optimism'; -import { invariant, InvariantError } from 'ts-invariant'; - -var haveWarned = false; -function shouldWarn() { - var answer = !haveWarned; - if (!isTest()) { - haveWarned = true; - } - return answer; -} -var HeuristicFragmentMatcher = (function () { - function HeuristicFragmentMatcher() { - } - HeuristicFragmentMatcher.prototype.ensureReady = function () { - return Promise.resolve(); - }; - HeuristicFragmentMatcher.prototype.canBypassInit = function () { - return true; - }; - HeuristicFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - if (!obj) { - return isRootQuery; - } - var _a = obj.__typename, __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - if (!__typename) { - if (shouldWarn()) { - process.env.NODE_ENV === "production" || invariant.warn("You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments."); - process.env.NODE_ENV === "production" || invariant.warn('Could not find __typename on Fragment ', typeCondition, obj); - process.env.NODE_ENV === "production" || invariant.warn("DEPRECATION WARNING: using fragments without __typename is unsupported behavior " + - "and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now."); - } - return 'heuristic'; - } - if (__typename === typeCondition) { - return true; - } - if (shouldWarn()) { - process.env.NODE_ENV === "production" || invariant.error('You are using the simple (heuristic) fragment matcher, but your ' + - 'queries contain union or interface types. Apollo Client will not be ' + - 'able to accurately map fragments. To make this error go away, use ' + - 'the `IntrospectionFragmentMatcher` as described in the docs: ' + - 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher'); - } - return 'heuristic'; - }; - return HeuristicFragmentMatcher; -}()); -var IntrospectionFragmentMatcher = (function () { - function IntrospectionFragmentMatcher(options) { - if (options && options.introspectionQueryResultData) { - this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData); - this.isReady = true; - } - else { - this.isReady = false; - } - this.match = this.match.bind(this); - } - IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - process.env.NODE_ENV === "production" ? invariant(this.isReady, 1) : invariant(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()'); - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - if (!obj) { - return isRootQuery; - } - var _a = obj.__typename, __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - process.env.NODE_ENV === "production" ? invariant(__typename, 2) : invariant(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj)); - if (__typename === typeCondition) { - return true; - } - var implementingTypes = this.possibleTypesMap[typeCondition]; - if (__typename && - implementingTypes && - implementingTypes.indexOf(__typename) > -1) { - return true; - } - return false; - }; - IntrospectionFragmentMatcher.prototype.parseIntrospectionResult = function (introspectionResultData) { - var typeMap = {}; - introspectionResultData.__schema.types.forEach(function (type) { - if (type.kind === 'UNION' || type.kind === 'INTERFACE') { - typeMap[type.name] = type.possibleTypes.map(function (implementingType) { return implementingType.name; }); - } - }); - return typeMap; - }; - return IntrospectionFragmentMatcher; -}()); - -var hasOwn = Object.prototype.hasOwnProperty; -var DepTrackingCache = (function () { - function DepTrackingCache(data) { - var _this = this; - if (data === void 0) { data = Object.create(null); } - this.data = data; - this.depend = wrap(function (dataId) { return _this.data[dataId]; }, { - disposable: true, - makeCacheKey: function (dataId) { - return dataId; - }, - }); - } - DepTrackingCache.prototype.toObject = function () { - return this.data; - }; - DepTrackingCache.prototype.get = function (dataId) { - this.depend(dataId); - return this.data[dataId]; - }; - DepTrackingCache.prototype.set = function (dataId, value) { - var oldValue = this.data[dataId]; - if (value !== oldValue) { - this.data[dataId] = value; - this.depend.dirty(dataId); - } - }; - DepTrackingCache.prototype.delete = function (dataId) { - if (hasOwn.call(this.data, dataId)) { - delete this.data[dataId]; - this.depend.dirty(dataId); - } - }; - DepTrackingCache.prototype.clear = function () { - this.replace(null); - }; - DepTrackingCache.prototype.replace = function (newData) { - var _this = this; - if (newData) { - Object.keys(newData).forEach(function (dataId) { - _this.set(dataId, newData[dataId]); - }); - Object.keys(this.data).forEach(function (dataId) { - if (!hasOwn.call(newData, dataId)) { - _this.delete(dataId); - } - }); - } - else { - Object.keys(this.data).forEach(function (dataId) { - _this.delete(dataId); - }); - } - }; - return DepTrackingCache; -}()); -function defaultNormalizedCacheFactory(seed) { - return new DepTrackingCache(seed); -} - -var StoreReader = (function () { - function StoreReader(_a) { - var _this = this; - var _b = _a === void 0 ? {} : _a, _c = _b.cacheKeyRoot, cacheKeyRoot = _c === void 0 ? new KeyTrie(canUseWeakMap) : _c, _d = _b.freezeResults, freezeResults = _d === void 0 ? false : _d; - var _e = this, executeStoreQuery = _e.executeStoreQuery, executeSelectionSet = _e.executeSelectionSet, executeSubSelectedArray = _e.executeSubSelectedArray; - this.freezeResults = freezeResults; - this.executeStoreQuery = wrap(function (options) { - return executeStoreQuery.call(_this, options); - }, { - makeCacheKey: function (_a) { - var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, fragmentMatcher = _a.fragmentMatcher; - if (contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(contextValue.store, query, fragmentMatcher, JSON.stringify(variableValues), rootValue.id); - } - } - }); - this.executeSelectionSet = wrap(function (options) { - return executeSelectionSet.call(_this, options); - }, { - makeCacheKey: function (_a) { - var selectionSet = _a.selectionSet, rootValue = _a.rootValue, execContext = _a.execContext; - if (execContext.contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, selectionSet, execContext.fragmentMatcher, JSON.stringify(execContext.variableValues), rootValue.id); - } - } - }); - this.executeSubSelectedArray = wrap(function (options) { - return executeSubSelectedArray.call(_this, options); - }, { - makeCacheKey: function (_a) { - var field = _a.field, array = _a.array, execContext = _a.execContext; - if (execContext.contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, field, array, JSON.stringify(execContext.variableValues)); - } - } - }); - } - StoreReader.prototype.readQueryFromStore = function (options) { - return this.diffQueryAgainstStore(__assign(__assign({}, options), { returnPartialData: false })).result; - }; - StoreReader.prototype.diffQueryAgainstStore = function (_a) { - var store = _a.store, query = _a.query, variables = _a.variables, previousResult = _a.previousResult, _b = _a.returnPartialData, returnPartialData = _b === void 0 ? true : _b, _c = _a.rootId, rootId = _c === void 0 ? 'ROOT_QUERY' : _c, fragmentMatcherFunction = _a.fragmentMatcherFunction, config = _a.config; - var queryDefinition = getQueryDefinition(query); - variables = assign({}, getDefaultValues(queryDefinition), variables); - var context = { - store: store, - dataIdFromObject: config && config.dataIdFromObject, - cacheRedirects: (config && config.cacheRedirects) || {}, - }; - var execResult = this.executeStoreQuery({ - query: query, - rootValue: { - type: 'id', - id: rootId, - generated: true, - typename: 'Query', - }, - contextValue: context, - variableValues: variables, - fragmentMatcher: fragmentMatcherFunction, - }); - var hasMissingFields = execResult.missing && execResult.missing.length > 0; - if (hasMissingFields && !returnPartialData) { - execResult.missing.forEach(function (info) { - if (info.tolerable) - return; - throw process.env.NODE_ENV === "production" ? new InvariantError(8) : new InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); - }); - } - if (previousResult) { - if (isEqual(previousResult, execResult.result)) { - execResult.result = previousResult; - } - } - return { - result: execResult.result, - complete: !hasMissingFields, - }; - }; - StoreReader.prototype.executeStoreQuery = function (_a) { - var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, _b = _a.fragmentMatcher, fragmentMatcher = _b === void 0 ? defaultFragmentMatcher : _b; - var mainDefinition = getMainDefinition(query); - var fragments = getFragmentDefinitions(query); - var fragmentMap = createFragmentMap(fragments); - var execContext = { - query: query, - fragmentMap: fragmentMap, - contextValue: contextValue, - variableValues: variableValues, - fragmentMatcher: fragmentMatcher, - }; - return this.executeSelectionSet({ - selectionSet: mainDefinition.selectionSet, - rootValue: rootValue, - execContext: execContext, - }); - }; - StoreReader.prototype.executeSelectionSet = function (_a) { - var _this = this; - var selectionSet = _a.selectionSet, rootValue = _a.rootValue, execContext = _a.execContext; - var fragmentMap = execContext.fragmentMap, contextValue = execContext.contextValue, variables = execContext.variableValues; - var finalResult = { result: null }; - var objectsToMerge = []; - var object = contextValue.store.get(rootValue.id); - var typename = (object && object.__typename) || - (rootValue.id === 'ROOT_QUERY' && 'Query') || - void 0; - function handleMissing(result) { - var _a; - if (result.missing) { - finalResult.missing = finalResult.missing || []; - (_a = finalResult.missing).push.apply(_a, result.missing); - } - return result.result; - } - selectionSet.selections.forEach(function (selection) { - var _a; - if (!shouldInclude(selection, variables)) { - return; - } - if (isField(selection)) { - var fieldResult = handleMissing(_this.executeField(object, typename, selection, execContext)); - if (typeof fieldResult !== 'undefined') { - objectsToMerge.push((_a = {}, - _a[resultKeyNameFromField(selection)] = fieldResult, - _a)); - } - } - else { - var fragment = void 0; - if (isInlineFragment(selection)) { - fragment = selection; - } - else { - fragment = fragmentMap[selection.name.value]; - if (!fragment) { - throw process.env.NODE_ENV === "production" ? new InvariantError(9) : new InvariantError("No fragment named " + selection.name.value); - } - } - var typeCondition = fragment.typeCondition && fragment.typeCondition.name.value; - var match = !typeCondition || - execContext.fragmentMatcher(rootValue, typeCondition, contextValue); - if (match) { - var fragmentExecResult = _this.executeSelectionSet({ - selectionSet: fragment.selectionSet, - rootValue: rootValue, - execContext: execContext, - }); - if (match === 'heuristic' && fragmentExecResult.missing) { - fragmentExecResult = __assign(__assign({}, fragmentExecResult), { missing: fragmentExecResult.missing.map(function (info) { - return __assign(__assign({}, info), { tolerable: true }); - }) }); - } - objectsToMerge.push(handleMissing(fragmentExecResult)); - } - } - }); - finalResult.result = mergeDeepArray(objectsToMerge); - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(finalResult.result); - } - return finalResult; - }; - StoreReader.prototype.executeField = function (object, typename, field, execContext) { - var variables = execContext.variableValues, contextValue = execContext.contextValue; - var fieldName = field.name.value; - var args = argumentsObjectFromField(field, variables); - var info = { - resultKey: resultKeyNameFromField(field), - directives: getDirectiveInfoFromField(field, variables), - }; - var readStoreResult = readStoreResolver(object, typename, fieldName, args, contextValue, info); - if (Array.isArray(readStoreResult.result)) { - return this.combineExecResults(readStoreResult, this.executeSubSelectedArray({ - field: field, - array: readStoreResult.result, - execContext: execContext, - })); - } - if (!field.selectionSet) { - assertSelectionSetForIdValue(field, readStoreResult.result); - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - maybeDeepFreeze(readStoreResult); - } - return readStoreResult; - } - if (readStoreResult.result == null) { - return readStoreResult; - } - return this.combineExecResults(readStoreResult, this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: readStoreResult.result, - execContext: execContext, - })); - }; - StoreReader.prototype.combineExecResults = function () { - var execResults = []; - for (var _i = 0; _i < arguments.length; _i++) { - execResults[_i] = arguments[_i]; - } - var missing; - execResults.forEach(function (execResult) { - if (execResult.missing) { - missing = missing || []; - missing.push.apply(missing, execResult.missing); - } - }); - return { - result: execResults.pop().result, - missing: missing, - }; - }; - StoreReader.prototype.executeSubSelectedArray = function (_a) { - var _this = this; - var field = _a.field, array = _a.array, execContext = _a.execContext; - var missing; - function handleMissing(childResult) { - if (childResult.missing) { - missing = missing || []; - missing.push.apply(missing, childResult.missing); - } - return childResult.result; - } - array = array.map(function (item) { - if (item === null) { - return null; - } - if (Array.isArray(item)) { - return handleMissing(_this.executeSubSelectedArray({ - field: field, - array: item, - execContext: execContext, - })); - } - if (field.selectionSet) { - return handleMissing(_this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: item, - execContext: execContext, - })); - } - assertSelectionSetForIdValue(field, item); - return item; - }); - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(array); - } - return { result: array, missing: missing }; - }; - return StoreReader; -}()); -function assertSelectionSetForIdValue(field, value) { - if (!field.selectionSet && isIdValue(value)) { - throw process.env.NODE_ENV === "production" ? new InvariantError(10) : new InvariantError("Missing selection set for object of type " + value.typename + " returned for query field " + field.name.value); - } -} -function defaultFragmentMatcher() { - return true; -} -function assertIdValue(idValue) { - process.env.NODE_ENV === "production" ? invariant(isIdValue(idValue), 11) : invariant(isIdValue(idValue), "Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue."); -} -function readStoreResolver(object, typename, fieldName, args, context, _a) { - var resultKey = _a.resultKey, directives = _a.directives; - var storeKeyName = fieldName; - if (args || directives) { - storeKeyName = getStoreKeyName(storeKeyName, args, directives); - } - var fieldValue = void 0; - if (object) { - fieldValue = object[storeKeyName]; - if (typeof fieldValue === 'undefined' && - context.cacheRedirects && - typeof typename === 'string') { - var type = context.cacheRedirects[typename]; - if (type) { - var resolver = type[fieldName]; - if (resolver) { - fieldValue = resolver(object, args, { - getCacheKey: function (storeObj) { - var id = context.dataIdFromObject(storeObj); - return id && toIdValue({ - id: id, - typename: storeObj.__typename, - }); - }, - }); - } - } - } - } - if (typeof fieldValue === 'undefined') { - return { - result: fieldValue, - missing: [{ - object: object, - fieldName: storeKeyName, - tolerable: false, - }], - }; - } - if (isJsonValue(fieldValue)) { - fieldValue = fieldValue.json; - } - return { - result: fieldValue, - }; -} - -var ObjectCache = (function () { - function ObjectCache(data) { - if (data === void 0) { data = Object.create(null); } - this.data = data; - } - ObjectCache.prototype.toObject = function () { - return this.data; - }; - ObjectCache.prototype.get = function (dataId) { - return this.data[dataId]; - }; - ObjectCache.prototype.set = function (dataId, value) { - this.data[dataId] = value; - }; - ObjectCache.prototype.delete = function (dataId) { - this.data[dataId] = void 0; - }; - ObjectCache.prototype.clear = function () { - this.data = Object.create(null); - }; - ObjectCache.prototype.replace = function (newData) { - this.data = newData || Object.create(null); - }; - return ObjectCache; -}()); -function defaultNormalizedCacheFactory$1(seed) { - return new ObjectCache(seed); -} - -var WriteError = (function (_super) { - __extends(WriteError, _super); - function WriteError() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.type = 'WriteError'; - return _this; - } - return WriteError; -}(Error)); -function enhanceErrorWithDocument(error, document) { - var enhancedError = new WriteError("Error writing result to store for query:\n " + JSON.stringify(document)); - enhancedError.message += '\n' + error.message; - enhancedError.stack = error.stack; - return enhancedError; -} -var StoreWriter = (function () { - function StoreWriter() { - } - StoreWriter.prototype.writeQueryToStore = function (_a) { - var query = _a.query, result = _a.result, _b = _a.store, store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, variables = _a.variables, dataIdFromObject = _a.dataIdFromObject, fragmentMatcherFunction = _a.fragmentMatcherFunction; - return this.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: query, - store: store, - variables: variables, - dataIdFromObject: dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - }; - StoreWriter.prototype.writeResultToStore = function (_a) { - var dataId = _a.dataId, result = _a.result, document = _a.document, _b = _a.store, store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, variables = _a.variables, dataIdFromObject = _a.dataIdFromObject, fragmentMatcherFunction = _a.fragmentMatcherFunction; - var operationDefinition = getOperationDefinition(document); - try { - return this.writeSelectionSetToStore({ - result: result, - dataId: dataId, - selectionSet: operationDefinition.selectionSet, - context: { - store: store, - processedData: {}, - variables: assign({}, getDefaultValues(operationDefinition), variables), - dataIdFromObject: dataIdFromObject, - fragmentMap: createFragmentMap(getFragmentDefinitions(document)), - fragmentMatcherFunction: fragmentMatcherFunction, - }, - }); - } - catch (e) { - throw enhanceErrorWithDocument(e, document); - } - }; - StoreWriter.prototype.writeSelectionSetToStore = function (_a) { - var _this = this; - var result = _a.result, dataId = _a.dataId, selectionSet = _a.selectionSet, context = _a.context; - var variables = context.variables, store = context.store, fragmentMap = context.fragmentMap; - selectionSet.selections.forEach(function (selection) { - var _a; - if (!shouldInclude(selection, variables)) { - return; - } - if (isField(selection)) { - var resultFieldKey = resultKeyNameFromField(selection); - var value = result[resultFieldKey]; - if (typeof value !== 'undefined') { - _this.writeFieldToStore({ - dataId: dataId, - value: value, - field: selection, - context: context, - }); - } - else { - var isDefered = false; - var isClient = false; - if (selection.directives && selection.directives.length) { - isDefered = selection.directives.some(function (directive) { return directive.name && directive.name.value === 'defer'; }); - isClient = selection.directives.some(function (directive) { return directive.name && directive.name.value === 'client'; }); - } - if (!isDefered && !isClient && context.fragmentMatcherFunction) { - process.env.NODE_ENV === "production" || invariant.warn("Missing field " + resultFieldKey + " in " + JSON.stringify(result, null, 2).substring(0, 100)); - } - } - } - else { - var fragment = void 0; - if (isInlineFragment(selection)) { - fragment = selection; - } - else { - fragment = (fragmentMap || {})[selection.name.value]; - process.env.NODE_ENV === "production" ? invariant(fragment, 3) : invariant(fragment, "No fragment named " + selection.name.value + "."); - } - var matches = true; - if (context.fragmentMatcherFunction && fragment.typeCondition) { - var id = dataId || 'self'; - var idValue = toIdValue({ id: id, typename: undefined }); - var fakeContext = { - store: new ObjectCache((_a = {}, _a[id] = result, _a)), - cacheRedirects: {}, - }; - var match = context.fragmentMatcherFunction(idValue, fragment.typeCondition.name.value, fakeContext); - if (!isProduction() && match === 'heuristic') { - process.env.NODE_ENV === "production" || invariant.error('WARNING: heuristic fragment matching going on!'); - } - matches = !!match; - } - if (matches) { - _this.writeSelectionSetToStore({ - result: result, - selectionSet: fragment.selectionSet, - dataId: dataId, - context: context, - }); - } - } - }); - return store; - }; - StoreWriter.prototype.writeFieldToStore = function (_a) { - var _b; - var field = _a.field, value = _a.value, dataId = _a.dataId, context = _a.context; - var variables = context.variables, dataIdFromObject = context.dataIdFromObject, store = context.store; - var storeValue; - var storeObject; - var storeFieldName = storeKeyNameFromField(field, variables); - if (!field.selectionSet || value === null) { - storeValue = - value != null && typeof value === 'object' - ? - { type: 'json', json: value } - : - value; - } - else if (Array.isArray(value)) { - var generatedId = dataId + "." + storeFieldName; - storeValue = this.processArrayValue(value, generatedId, field.selectionSet, context); - } - else { - var valueDataId = dataId + "." + storeFieldName; - var generated = true; - if (!isGeneratedId(valueDataId)) { - valueDataId = '$' + valueDataId; - } - if (dataIdFromObject) { - var semanticId = dataIdFromObject(value); - process.env.NODE_ENV === "production" ? invariant(!semanticId || !isGeneratedId(semanticId), 4) : invariant(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.'); - if (semanticId || - (typeof semanticId === 'number' && semanticId === 0)) { - valueDataId = semanticId; - generated = false; - } - } - if (!isDataProcessed(valueDataId, field, context.processedData)) { - this.writeSelectionSetToStore({ - dataId: valueDataId, - result: value, - selectionSet: field.selectionSet, - context: context, - }); - } - var typename = value.__typename; - storeValue = toIdValue({ id: valueDataId, typename: typename }, generated); - storeObject = store.get(dataId); - var escapedId = storeObject && storeObject[storeFieldName]; - if (escapedId !== storeValue && isIdValue(escapedId)) { - var hadTypename = escapedId.typename !== undefined; - var hasTypename = typename !== undefined; - var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename; - process.env.NODE_ENV === "production" ? invariant(!generated || escapedId.generated || typenameChanged, 5) : invariant(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - process.env.NODE_ENV === "production" ? invariant(!hadTypename || hasTypename, 6) : invariant(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - if (escapedId.generated) { - if (typenameChanged) { - if (!generated) { - store.delete(escapedId.id); - } - } - else { - mergeWithGenerated(escapedId.id, storeValue.id, store); - } - } - } - } - storeObject = store.get(dataId); - if (!storeObject || !isEqual(storeValue, storeObject[storeFieldName])) { - store.set(dataId, __assign(__assign({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b))); - } - }; - StoreWriter.prototype.processArrayValue = function (value, generatedId, selectionSet, context) { - var _this = this; - return value.map(function (item, index) { - if (item === null) { - return null; - } - var itemDataId = generatedId + "." + index; - if (Array.isArray(item)) { - return _this.processArrayValue(item, itemDataId, selectionSet, context); - } - var generated = true; - if (context.dataIdFromObject) { - var semanticId = context.dataIdFromObject(item); - if (semanticId) { - itemDataId = semanticId; - generated = false; - } - } - if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) { - _this.writeSelectionSetToStore({ - dataId: itemDataId, - result: item, - selectionSet: selectionSet, - context: context, - }); - } - return toIdValue({ id: itemDataId, typename: item.__typename }, generated); - }); - }; - return StoreWriter; -}()); -function isGeneratedId(id) { - return id[0] === '$'; -} -function mergeWithGenerated(generatedKey, realKey, cache) { - if (generatedKey === realKey) { - return false; - } - var generated = cache.get(generatedKey); - var real = cache.get(realKey); - var madeChanges = false; - Object.keys(generated).forEach(function (key) { - var value = generated[key]; - var realValue = real[key]; - if (isIdValue(value) && - isGeneratedId(value.id) && - isIdValue(realValue) && - !isEqual(value, realValue) && - mergeWithGenerated(value.id, realValue.id, cache)) { - madeChanges = true; - } - }); - cache.delete(generatedKey); - var newRealValue = __assign(__assign({}, generated), real); - if (isEqual(newRealValue, real)) { - return madeChanges; - } - cache.set(realKey, newRealValue); - return true; -} -function isDataProcessed(dataId, field, processedData) { - if (!processedData) { - return false; - } - if (processedData[dataId]) { - if (processedData[dataId].indexOf(field) >= 0) { - return true; - } - else { - processedData[dataId].push(field); - } - } - else { - processedData[dataId] = [field]; - } - return false; -} - -var defaultConfig = { - fragmentMatcher: new HeuristicFragmentMatcher(), - dataIdFromObject: defaultDataIdFromObject, - addTypename: true, - resultCaching: true, - freezeResults: false, -}; -function defaultDataIdFromObject(result) { - if (result.__typename) { - if (result.id !== undefined) { - return result.__typename + ":" + result.id; - } - if (result._id !== undefined) { - return result.__typename + ":" + result._id; - } - } - return null; -} -var hasOwn$1 = Object.prototype.hasOwnProperty; -var OptimisticCacheLayer = (function (_super) { - __extends(OptimisticCacheLayer, _super); - function OptimisticCacheLayer(optimisticId, parent, transaction) { - var _this = _super.call(this, Object.create(null)) || this; - _this.optimisticId = optimisticId; - _this.parent = parent; - _this.transaction = transaction; - return _this; - } - OptimisticCacheLayer.prototype.toObject = function () { - return __assign(__assign({}, this.parent.toObject()), this.data); - }; - OptimisticCacheLayer.prototype.get = function (dataId) { - return hasOwn$1.call(this.data, dataId) - ? this.data[dataId] - : this.parent.get(dataId); - }; - return OptimisticCacheLayer; -}(ObjectCache)); -var InMemoryCache = (function (_super) { - __extends(InMemoryCache, _super); - function InMemoryCache(config) { - if (config === void 0) { config = {}; } - var _this = _super.call(this) || this; - _this.watches = new Set(); - _this.typenameDocumentCache = new Map(); - _this.cacheKeyRoot = new KeyTrie(canUseWeakMap); - _this.silenceBroadcast = false; - _this.config = __assign(__assign({}, defaultConfig), config); - if (_this.config.customResolvers) { - process.env.NODE_ENV === "production" || invariant.warn('customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.customResolvers; - } - if (_this.config.cacheResolvers) { - process.env.NODE_ENV === "production" || invariant.warn('cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.cacheResolvers; - } - _this.addTypename = !!_this.config.addTypename; - _this.data = _this.config.resultCaching - ? new DepTrackingCache() - : new ObjectCache(); - _this.optimisticData = _this.data; - _this.storeWriter = new StoreWriter(); - _this.storeReader = new StoreReader({ - cacheKeyRoot: _this.cacheKeyRoot, - freezeResults: config.freezeResults, - }); - var cache = _this; - var maybeBroadcastWatch = cache.maybeBroadcastWatch; - _this.maybeBroadcastWatch = wrap(function (c) { - return maybeBroadcastWatch.call(_this, c); - }, { - makeCacheKey: function (c) { - if (c.optimistic) { - return; - } - if (c.previousResult) { - return; - } - if (cache.data instanceof DepTrackingCache) { - return cache.cacheKeyRoot.lookup(c.query, JSON.stringify(c.variables)); - } - } - }); - return _this; - } - InMemoryCache.prototype.restore = function (data) { - if (data) - this.data.replace(data); - return this; - }; - InMemoryCache.prototype.extract = function (optimistic) { - if (optimistic === void 0) { optimistic = false; } - return (optimistic ? this.optimisticData : this.data).toObject(); - }; - InMemoryCache.prototype.read = function (options) { - if (typeof options.rootId === 'string' && - typeof this.data.get(options.rootId) === 'undefined') { - return null; - } - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.readQueryFromStore({ - store: options.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(options.query), - variables: options.variables, - rootId: options.rootId, - fragmentMatcherFunction: fragmentMatcherFunction, - previousResult: options.previousResult, - config: this.config, - }) || null; - }; - InMemoryCache.prototype.write = function (write) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - this.storeWriter.writeResultToStore({ - dataId: write.dataId, - result: write.result, - variables: write.variables, - document: this.transformDocument(write.query), - store: this.data, - dataIdFromObject: this.config.dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - this.broadcastWatches(); - }; - InMemoryCache.prototype.diff = function (query) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.diffQueryAgainstStore({ - store: query.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(query.query), - variables: query.variables, - returnPartialData: query.returnPartialData, - previousResult: query.previousResult, - fragmentMatcherFunction: fragmentMatcherFunction, - config: this.config, - }); - }; - InMemoryCache.prototype.watch = function (watch) { - var _this = this; - this.watches.add(watch); - return function () { - _this.watches.delete(watch); - }; - }; - InMemoryCache.prototype.evict = function (query) { - throw process.env.NODE_ENV === "production" ? new InvariantError(7) : new InvariantError("eviction is not implemented on InMemory Cache"); - }; - InMemoryCache.prototype.reset = function () { - this.data.clear(); - this.broadcastWatches(); - return Promise.resolve(); - }; - InMemoryCache.prototype.removeOptimistic = function (idToRemove) { - var toReapply = []; - var removedCount = 0; - var layer = this.optimisticData; - while (layer instanceof OptimisticCacheLayer) { - if (layer.optimisticId === idToRemove) { - ++removedCount; - } - else { - toReapply.push(layer); - } - layer = layer.parent; - } - if (removedCount > 0) { - this.optimisticData = layer; - while (toReapply.length > 0) { - var layer_1 = toReapply.pop(); - this.performTransaction(layer_1.transaction, layer_1.optimisticId); - } - this.broadcastWatches(); - } - }; - InMemoryCache.prototype.performTransaction = function (transaction, optimisticId) { - var _a = this, data = _a.data, silenceBroadcast = _a.silenceBroadcast; - this.silenceBroadcast = true; - if (typeof optimisticId === 'string') { - this.data = this.optimisticData = new OptimisticCacheLayer(optimisticId, this.optimisticData, transaction); - } - try { - transaction(this); - } - finally { - this.silenceBroadcast = silenceBroadcast; - this.data = data; - } - this.broadcastWatches(); - }; - InMemoryCache.prototype.recordOptimisticTransaction = function (transaction, id) { - return this.performTransaction(transaction, id); - }; - InMemoryCache.prototype.transformDocument = function (document) { - if (this.addTypename) { - var result = this.typenameDocumentCache.get(document); - if (!result) { - result = addTypenameToDocument(document); - this.typenameDocumentCache.set(document, result); - this.typenameDocumentCache.set(result, result); - } - return result; - } - return document; - }; - InMemoryCache.prototype.broadcastWatches = function () { - var _this = this; - if (!this.silenceBroadcast) { - this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c); }); - } - }; - InMemoryCache.prototype.maybeBroadcastWatch = function (c) { - c.callback(this.diff({ - query: c.query, - variables: c.variables, - previousResult: c.previousResult && c.previousResult(), - optimistic: c.optimistic, - })); - }; - return InMemoryCache; -}(ApolloCache)); - -export { HeuristicFragmentMatcher, InMemoryCache, IntrospectionFragmentMatcher, ObjectCache, StoreReader, StoreWriter, WriteError, assertIdValue, defaultDataIdFromObject, defaultNormalizedCacheFactory$1 as defaultNormalizedCacheFactory, enhanceErrorWithDocument }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-cache-inmemory/lib/bundle.esm.js.map b/node_modules/apollo-cache-inmemory/lib/bundle.esm.js.map deleted file mode 100644 index 98ebab5c..00000000 --- a/node_modules/apollo-cache-inmemory/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/fragmentMatcher.ts","../src/depTrackingCache.ts","../src/readFromStore.ts","../src/objectCache.ts","../src/writeToStore.ts","../src/inMemoryCache.ts"],"sourcesContent":["import { isTest, IdValue } from 'apollo-utilities';\nimport { invariant } from 'ts-invariant';\n\nimport {\n ReadStoreContext,\n FragmentMatcherInterface,\n PossibleTypesMap,\n IntrospectionResultData,\n} from './types';\n\nlet haveWarned = false;\n\nfunction shouldWarn() {\n const answer = !haveWarned;\n /* istanbul ignore if */\n if (!isTest()) {\n haveWarned = true;\n }\n return answer;\n}\n\n/**\n * This fragment matcher is very basic and unable to match union or interface type conditions\n */\nexport class HeuristicFragmentMatcher implements FragmentMatcherInterface {\n constructor() {\n // do nothing\n }\n\n public ensureReady() {\n return Promise.resolve();\n }\n\n public canBypassInit() {\n return true; // we don't need to initialize this fragment matcher.\n }\n\n public match(\n idValue: IdValue,\n typeCondition: string,\n context: ReadStoreContext,\n ): boolean | 'heuristic' {\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === 'ROOT_QUERY';\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/3507\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && 'Query' } = obj;\n\n if (!__typename) {\n if (shouldWarn()) {\n invariant.warn(`You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments.`);\n invariant.warn(\n 'Could not find __typename on Fragment ',\n typeCondition,\n obj,\n );\n invariant.warn(\n `DEPRECATION WARNING: using fragments without __typename is unsupported behavior ` +\n `and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now.`,\n );\n }\n\n return 'heuristic';\n }\n\n if (__typename === typeCondition) {\n return true;\n }\n\n // At this point we don't know if this fragment should match or not. It's\n // either:\n //\n // 1. (GOOD) A fragment on a matching interface or union.\n // 2. (BAD) A fragment on a non-matching concrete type or interface or union.\n //\n // If it's 2, we don't want it to match. If it's 1, we want it to match. We\n // can't tell the difference, so we warn the user, but still try to match\n // it (for backwards compatibility reasons). This unfortunately means that\n // using the `HeuristicFragmentMatcher` with unions and interfaces is\n // very unreliable. This will be addressed in a future major version of\n // Apollo Client, but for now the recommendation is to use the\n // `IntrospectionFragmentMatcher` when working with unions/interfaces.\n\n if (shouldWarn()) {\n invariant.error(\n 'You are using the simple (heuristic) fragment matcher, but your ' +\n 'queries contain union or interface types. Apollo Client will not be ' +\n 'able to accurately map fragments. To make this error go away, use ' +\n 'the `IntrospectionFragmentMatcher` as described in the docs: ' +\n 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher',\n );\n }\n\n return 'heuristic';\n }\n}\n\nexport class IntrospectionFragmentMatcher implements FragmentMatcherInterface {\n private isReady: boolean;\n private possibleTypesMap: PossibleTypesMap;\n\n constructor(options?: {\n introspectionQueryResultData?: IntrospectionResultData;\n }) {\n if (options && options.introspectionQueryResultData) {\n this.possibleTypesMap = this.parseIntrospectionResult(\n options.introspectionQueryResultData,\n );\n this.isReady = true;\n } else {\n this.isReady = false;\n }\n\n this.match = this.match.bind(this);\n }\n\n public match(\n idValue: IdValue,\n typeCondition: string,\n context: ReadStoreContext,\n ) {\n invariant(\n this.isReady,\n 'FragmentMatcher.match() was called before FragmentMatcher.init()',\n );\n\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === 'ROOT_QUERY';\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/4620\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && 'Query' } = obj;\n\n invariant(\n __typename,\n `Cannot match fragment because __typename property is missing: ${JSON.stringify(\n obj,\n )}`,\n );\n\n if (__typename === typeCondition) {\n return true;\n }\n\n const implementingTypes = this.possibleTypesMap[typeCondition];\n if (\n __typename &&\n implementingTypes &&\n implementingTypes.indexOf(__typename) > -1\n ) {\n return true;\n }\n\n return false;\n }\n\n private parseIntrospectionResult(\n introspectionResultData: IntrospectionResultData,\n ): PossibleTypesMap {\n const typeMap: PossibleTypesMap = {};\n introspectionResultData.__schema.types.forEach(type => {\n if (type.kind === 'UNION' || type.kind === 'INTERFACE') {\n typeMap[type.name] = type.possibleTypes.map(\n implementingType => implementingType.name,\n );\n }\n });\n return typeMap;\n }\n}\n","import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types';\nimport { wrap, OptimisticWrapperFunction } from 'optimism';\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nexport class DepTrackingCache implements NormalizedCache {\n // Wrapper function produced by the optimism library, used to depend on\n // dataId strings, for easy invalidation of specific IDs.\n private depend: OptimisticWrapperFunction<[string], StoreObject | undefined>;\n\n constructor(private data: NormalizedCacheObject = Object.create(null)) {\n this.depend = wrap((dataId: string) => this.data[dataId], {\n disposable: true,\n makeCacheKey(dataId: string) {\n return dataId;\n },\n });\n }\n\n public toObject(): NormalizedCacheObject {\n return this.data;\n }\n\n public get(dataId: string): StoreObject {\n this.depend(dataId);\n return this.data[dataId]!;\n }\n\n public set(dataId: string, value?: StoreObject) {\n const oldValue = this.data[dataId];\n if (value !== oldValue) {\n this.data[dataId] = value;\n this.depend.dirty(dataId);\n }\n }\n\n public delete(dataId: string): void {\n if (hasOwn.call(this.data, dataId)) {\n delete this.data[dataId];\n this.depend.dirty(dataId);\n }\n }\n\n public clear(): void {\n this.replace(null);\n }\n\n public replace(newData: NormalizedCacheObject | null): void {\n if (newData) {\n Object.keys(newData).forEach(dataId => {\n this.set(dataId, newData[dataId]);\n });\n Object.keys(this.data).forEach(dataId => {\n if (!hasOwn.call(newData, dataId)) {\n this.delete(dataId);\n }\n });\n } else {\n Object.keys(this.data).forEach(dataId => {\n this.delete(dataId);\n });\n }\n }\n}\n\nexport function defaultNormalizedCacheFactory(\n seed?: NormalizedCacheObject,\n): NormalizedCache {\n return new DepTrackingCache(seed);\n}\n","import {\n argumentsObjectFromField,\n assign,\n canUseWeakMap,\n createFragmentMap,\n DirectiveInfo,\n FragmentMap,\n getDefaultValues,\n getDirectiveInfoFromField,\n getFragmentDefinitions,\n getMainDefinition,\n getQueryDefinition,\n getStoreKeyName,\n IdValue,\n isEqual,\n isField,\n isIdValue,\n isInlineFragment,\n isJsonValue,\n maybeDeepFreeze,\n mergeDeepArray,\n resultKeyNameFromField,\n shouldInclude,\n StoreValue,\n toIdValue,\n} from 'apollo-utilities';\n\nimport { Cache } from 'apollo-cache';\n\nimport {\n ReadStoreContext,\n DiffQueryAgainstStoreOptions,\n ReadQueryOptions,\n StoreObject,\n} from './types';\n\nimport {\n DocumentNode,\n FieldNode,\n FragmentDefinitionNode,\n InlineFragmentNode,\n SelectionSetNode,\n} from 'graphql';\n\nimport { wrap, KeyTrie } from 'optimism';\nimport { DepTrackingCache } from './depTrackingCache';\nimport { invariant, InvariantError } from 'ts-invariant';\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: ReadStoreContext,\n) => boolean | 'heuristic';\n\ntype ExecContext = {\n query: DocumentNode;\n fragmentMap: FragmentMap;\n contextValue: ReadStoreContext;\n variableValues: VariableMap;\n fragmentMatcher: FragmentMatcher;\n};\n\ntype ExecInfo = {\n resultKey: string;\n directives: DirectiveInfo;\n};\n\nexport type ExecResultMissingField = {\n object: StoreObject;\n fieldName: string;\n tolerable: boolean;\n};\n\nexport type ExecResult = {\n result: R;\n // Empty array if no missing fields encountered while computing result.\n missing?: ExecResultMissingField[];\n};\n\ntype ExecStoreQueryOptions = {\n query: DocumentNode;\n rootValue: IdValue;\n contextValue: ReadStoreContext;\n variableValues: VariableMap;\n // Default matcher always matches all fragments\n fragmentMatcher?: FragmentMatcher;\n};\n\ntype ExecSelectionSetOptions = {\n selectionSet: SelectionSetNode;\n rootValue: any;\n execContext: ExecContext;\n};\n\ntype ExecSubSelectedArrayOptions = {\n field: FieldNode;\n array: any[];\n execContext: ExecContext;\n};\n\nexport interface StoreReaderConfig {\n cacheKeyRoot?: KeyTrie;\n freezeResults?: boolean;\n}\n\nexport class StoreReader {\n private freezeResults: boolean;\n\n constructor({\n cacheKeyRoot = new KeyTrie(canUseWeakMap),\n freezeResults = false,\n }: StoreReaderConfig = {}) {\n const {\n executeStoreQuery,\n executeSelectionSet,\n executeSubSelectedArray,\n } = this;\n\n this.freezeResults = freezeResults;\n\n this.executeStoreQuery = wrap((options: ExecStoreQueryOptions) => {\n return executeStoreQuery.call(this, options);\n }, {\n makeCacheKey({\n query,\n rootValue,\n contextValue,\n variableValues,\n fragmentMatcher,\n }: ExecStoreQueryOptions) {\n // The result of executeStoreQuery can be safely cached only if the\n // underlying store is capable of tracking dependencies and invalidating\n // the cache when relevant data have changed.\n if (contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n contextValue.store,\n query,\n fragmentMatcher,\n JSON.stringify(variableValues),\n rootValue.id,\n );\n }\n }\n });\n\n this.executeSelectionSet = wrap((options: ExecSelectionSetOptions) => {\n return executeSelectionSet.call(this, options);\n }, {\n makeCacheKey({\n selectionSet,\n rootValue,\n execContext,\n }: ExecSelectionSetOptions) {\n if (execContext.contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n execContext.contextValue.store,\n selectionSet,\n execContext.fragmentMatcher,\n JSON.stringify(execContext.variableValues),\n rootValue.id,\n );\n }\n }\n });\n\n this.executeSubSelectedArray = wrap((options: ExecSubSelectedArrayOptions) => {\n return executeSubSelectedArray.call(this, options);\n }, {\n makeCacheKey({ field, array, execContext }) {\n if (execContext.contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n execContext.contextValue.store,\n field,\n array,\n JSON.stringify(execContext.variableValues),\n );\n }\n }\n });\n }\n\n /**\n * Resolves the result of a query solely from the store (i.e. never hits the server).\n *\n * @param {Store} store The {@link NormalizedCache} used by Apollo for the `data` portion of the\n * store.\n *\n * @param {DocumentNode} query The query document to resolve from the data available in the store.\n *\n * @param {Object} [variables] A map from the name of a variable to its value. These variables can\n * be referenced by the query document.\n *\n * @param {any} previousResult The previous result returned by this function for the same query.\n * If nothing in the store changed since that previous result then values from the previous result\n * will be returned to preserve referential equality.\n */\n public readQueryFromStore(\n options: ReadQueryOptions,\n ): QueryType | undefined {\n return this.diffQueryAgainstStore({\n ...options,\n returnPartialData: false,\n }).result;\n }\n\n /**\n * Given a store and a query, return as much of the result as possible and\n * identify if any data was missing from the store.\n * @param {DocumentNode} query A parsed GraphQL query document\n * @param {Store} store The Apollo Client store object\n * @param {any} previousResult The previous result returned by this function for the same query\n * @return {result: Object, complete: [boolean]}\n */\n public diffQueryAgainstStore({\n store,\n query,\n variables,\n previousResult,\n returnPartialData = true,\n rootId = 'ROOT_QUERY',\n fragmentMatcherFunction,\n config,\n }: DiffQueryAgainstStoreOptions): Cache.DiffResult {\n // Throw the right validation error by trying to find a query in the document\n const queryDefinition = getQueryDefinition(query);\n\n variables = assign({}, getDefaultValues(queryDefinition), variables);\n\n const context: ReadStoreContext = {\n // Global settings\n store,\n dataIdFromObject: config && config.dataIdFromObject,\n cacheRedirects: (config && config.cacheRedirects) || {},\n };\n\n const execResult = this.executeStoreQuery({\n query,\n rootValue: {\n type: 'id',\n id: rootId,\n generated: true,\n typename: 'Query',\n },\n contextValue: context,\n variableValues: variables,\n fragmentMatcher: fragmentMatcherFunction,\n });\n\n const hasMissingFields =\n execResult.missing && execResult.missing.length > 0;\n\n if (hasMissingFields && ! returnPartialData) {\n execResult.missing!.forEach(info => {\n if (info.tolerable) return;\n throw new InvariantError(\n `Can't find field ${info.fieldName} on object ${JSON.stringify(\n info.object,\n null,\n 2,\n )}.`,\n );\n });\n }\n\n if (previousResult) {\n if (isEqual(previousResult, execResult.result)) {\n execResult.result = previousResult;\n }\n }\n\n return {\n result: execResult.result,\n complete: !hasMissingFields,\n };\n }\n\n /**\n * Based on graphql function from graphql-js:\n *\n * graphql(\n * schema: GraphQLSchema,\n * requestString: string,\n * rootValue?: ?any,\n * contextValue?: ?any,\n * variableValues?: ?{[key: string]: any},\n * operationName?: ?string\n * ): Promise\n *\n * The default export as of graphql-anywhere is sync as of 4.0,\n * but below is an exported alternative that is async.\n * In the 5.0 version, this will be the only export again\n * and it will be async\n *\n */\n private executeStoreQuery({\n query,\n rootValue,\n contextValue,\n variableValues,\n // Default matcher always matches all fragments\n fragmentMatcher = defaultFragmentMatcher,\n }: ExecStoreQueryOptions): ExecResult {\n const mainDefinition = getMainDefinition(query);\n const fragments = getFragmentDefinitions(query);\n const fragmentMap = createFragmentMap(fragments);\n const execContext: ExecContext = {\n query,\n fragmentMap,\n contextValue,\n variableValues,\n fragmentMatcher,\n };\n\n return this.executeSelectionSet({\n selectionSet: mainDefinition.selectionSet,\n rootValue,\n execContext,\n });\n }\n\n private executeSelectionSet({\n selectionSet,\n rootValue,\n execContext,\n }: ExecSelectionSetOptions): ExecResult {\n const { fragmentMap, contextValue, variableValues: variables } = execContext;\n const finalResult: ExecResult = { result: null };\n\n const objectsToMerge: { [key: string]: any }[] = [];\n\n const object: StoreObject = contextValue.store.get(rootValue.id);\n\n const typename =\n (object && object.__typename) ||\n (rootValue.id === 'ROOT_QUERY' && 'Query') ||\n void 0;\n\n function handleMissing(result: ExecResult): T {\n if (result.missing) {\n finalResult.missing = finalResult.missing || [];\n finalResult.missing.push(...result.missing);\n }\n return result.result;\n }\n\n selectionSet.selections.forEach(selection => {\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely\n return;\n }\n\n if (isField(selection)) {\n const fieldResult = handleMissing(\n this.executeField(object, typename, selection, execContext),\n );\n\n if (typeof fieldResult !== 'undefined') {\n objectsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n });\n }\n\n } else {\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment\n fragment = fragmentMap[selection.name.value];\n\n if (!fragment) {\n throw new InvariantError(`No fragment named ${selection.name.value}`);\n }\n }\n\n const typeCondition =\n fragment.typeCondition && fragment.typeCondition.name.value;\n\n const match =\n !typeCondition ||\n execContext.fragmentMatcher(rootValue, typeCondition, contextValue);\n\n if (match) {\n let fragmentExecResult = this.executeSelectionSet({\n selectionSet: fragment.selectionSet,\n rootValue,\n execContext,\n });\n\n if (match === 'heuristic' && fragmentExecResult.missing) {\n fragmentExecResult = {\n ...fragmentExecResult,\n missing: fragmentExecResult.missing.map(info => {\n return { ...info, tolerable: true };\n }),\n };\n }\n\n objectsToMerge.push(handleMissing(fragmentExecResult));\n }\n }\n });\n\n // Perform a single merge at the end so that we can avoid making more\n // defensive shallow copies than necessary.\n finalResult.result = mergeDeepArray(objectsToMerge);\n\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n Object.freeze(finalResult.result);\n }\n\n return finalResult;\n }\n\n private executeField(\n object: StoreObject,\n typename: string | void,\n field: FieldNode,\n execContext: ExecContext,\n ): ExecResult {\n const { variableValues: variables, contextValue } = execContext;\n const fieldName = field.name.value;\n const args = argumentsObjectFromField(field, variables);\n\n const info: ExecInfo = {\n resultKey: resultKeyNameFromField(field),\n directives: getDirectiveInfoFromField(field, variables),\n };\n\n const readStoreResult = readStoreResolver(\n object,\n typename,\n fieldName,\n args,\n contextValue,\n info,\n );\n\n if (Array.isArray(readStoreResult.result)) {\n return this.combineExecResults(\n readStoreResult,\n this.executeSubSelectedArray({\n field,\n array: readStoreResult.result,\n execContext,\n }),\n );\n }\n\n // Handle all scalar types here\n if (!field.selectionSet) {\n assertSelectionSetForIdValue(field, readStoreResult.result);\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n maybeDeepFreeze(readStoreResult);\n }\n return readStoreResult;\n }\n\n // From here down, the field has a selection set, which means it's trying to\n // query a GraphQLObjectType\n if (readStoreResult.result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return readStoreResult;\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n return this.combineExecResults(\n readStoreResult,\n this.executeSelectionSet({\n selectionSet: field.selectionSet,\n rootValue: readStoreResult.result,\n execContext,\n }),\n );\n }\n\n private combineExecResults(\n ...execResults: ExecResult[]\n ): ExecResult {\n let missing: ExecResultMissingField[] | undefined;\n execResults.forEach(execResult => {\n if (execResult.missing) {\n missing = missing || [];\n missing.push(...execResult.missing);\n }\n });\n return {\n result: execResults.pop()!.result,\n missing,\n };\n }\n\n private executeSubSelectedArray({\n field,\n array,\n execContext,\n }: ExecSubSelectedArrayOptions): ExecResult {\n let missing: ExecResultMissingField[] | undefined;\n\n function handleMissing(childResult: ExecResult): T {\n if (childResult.missing) {\n missing = missing || [];\n missing.push(...childResult.missing);\n }\n\n return childResult.result;\n }\n\n array = array.map(item => {\n // null value in array\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse\n if (Array.isArray(item)) {\n return handleMissing(this.executeSubSelectedArray({\n field,\n array: item,\n execContext,\n }));\n }\n\n // This is an object, run the selection set on it\n if (field.selectionSet) {\n return handleMissing(this.executeSelectionSet({\n selectionSet: field.selectionSet,\n rootValue: item,\n execContext,\n }));\n }\n\n assertSelectionSetForIdValue(field, item);\n\n return item;\n });\n\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n Object.freeze(array);\n }\n\n return { result: array, missing };\n }\n}\n\nfunction assertSelectionSetForIdValue(\n field: FieldNode,\n value: any,\n) {\n if (!field.selectionSet && isIdValue(value)) {\n throw new InvariantError(\n `Missing selection set for object of type ${\n value.typename\n } returned for query field ${field.name.value}`\n );\n }\n}\n\nfunction defaultFragmentMatcher() {\n return true;\n}\n\nexport function assertIdValue(idValue: IdValue) {\n invariant(isIdValue(idValue), `\\\nEncountered a sub-selection on the query, but the store doesn't have \\\nan object reference. This should never happen during normal use unless you have custom code \\\nthat is directly manipulating the store; please file an issue.`);\n}\n\nfunction readStoreResolver(\n object: StoreObject,\n typename: string | void,\n fieldName: string,\n args: any,\n context: ReadStoreContext,\n { resultKey, directives }: ExecInfo,\n): ExecResult {\n let storeKeyName = fieldName;\n if (args || directives) {\n // We happen to know here that getStoreKeyName returns its first\n // argument unmodified if there are no args or directives, so we can\n // avoid calling the function at all in that case, as a small but\n // important optimization to this frequently executed code.\n storeKeyName = getStoreKeyName(storeKeyName, args, directives);\n }\n\n let fieldValue: StoreValue | void = void 0;\n\n if (object) {\n fieldValue = object[storeKeyName];\n\n if (\n typeof fieldValue === 'undefined' &&\n context.cacheRedirects &&\n typeof typename === 'string'\n ) {\n // Look for the type in the custom resolver map\n const type = context.cacheRedirects[typename];\n if (type) {\n // Look for the field in the custom resolver map\n const resolver = type[fieldName];\n if (resolver) {\n fieldValue = resolver(object, args, {\n getCacheKey(storeObj: StoreObject) {\n const id = context.dataIdFromObject!(storeObj);\n return id && toIdValue({\n id,\n typename: storeObj.__typename,\n });\n },\n });\n }\n }\n }\n }\n\n if (typeof fieldValue === 'undefined') {\n return {\n result: fieldValue,\n missing: [{\n object,\n fieldName: storeKeyName,\n tolerable: false,\n }],\n };\n }\n\n if (isJsonValue(fieldValue)) {\n fieldValue = fieldValue.json;\n }\n\n return {\n result: fieldValue,\n };\n}\n","import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types';\n\nexport class ObjectCache implements NormalizedCache {\n constructor(protected data: NormalizedCacheObject = Object.create(null)) {}\n\n public toObject() {\n return this.data;\n }\n\n public get(dataId: string) {\n return this.data[dataId]!;\n }\n\n public set(dataId: string, value: StoreObject) {\n this.data[dataId] = value;\n }\n\n public delete(dataId: string) {\n this.data[dataId] = void 0;\n }\n\n public clear() {\n this.data = Object.create(null);\n }\n\n public replace(newData: NormalizedCacheObject) {\n this.data = newData || Object.create(null);\n }\n}\n\nexport function defaultNormalizedCacheFactory(\n seed?: NormalizedCacheObject,\n): NormalizedCache {\n return new ObjectCache(seed);\n}\n","import {\n SelectionSetNode,\n FieldNode,\n DocumentNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n} from 'graphql';\nimport { FragmentMatcher } from './readFromStore';\n\nimport {\n assign,\n createFragmentMap,\n FragmentMap,\n getDefaultValues,\n getFragmentDefinitions,\n getOperationDefinition,\n IdValue,\n isField,\n isIdValue,\n isInlineFragment,\n isProduction,\n resultKeyNameFromField,\n shouldInclude,\n storeKeyNameFromField,\n StoreValue,\n toIdValue,\n isEqual,\n} from 'apollo-utilities';\n\nimport { invariant } from 'ts-invariant';\n\nimport { ObjectCache } from './objectCache';\nimport { defaultNormalizedCacheFactory } from './depTrackingCache';\n\nimport {\n IdGetter,\n NormalizedCache,\n ReadStoreContext,\n StoreObject,\n} from './types';\n\nexport class WriteError extends Error {\n public type = 'WriteError';\n}\n\nexport function enhanceErrorWithDocument(error: Error, document: DocumentNode) {\n // XXX A bit hacky maybe ...\n const enhancedError = new WriteError(\n `Error writing result to store for query:\\n ${JSON.stringify(document)}`,\n );\n enhancedError.message += '\\n' + error.message;\n enhancedError.stack = error.stack;\n return enhancedError;\n}\n\nexport type WriteContext = {\n readonly store: NormalizedCache;\n readonly processedData?: { [x: string]: FieldNode[] };\n readonly variables?: any;\n readonly dataIdFromObject?: IdGetter;\n readonly fragmentMap?: FragmentMap;\n readonly fragmentMatcherFunction?: FragmentMatcher;\n};\n\nexport class StoreWriter {\n /**\n * Writes the result of a query to the store.\n *\n * @param result The result object returned for the query document.\n *\n * @param query The query document whose result we are writing to the store.\n *\n * @param store The {@link NormalizedCache} used by Apollo for the `data` portion of the store.\n *\n * @param variables A map from the name of a variable to its value. These variables can be\n * referenced by the query document.\n *\n * @param dataIdFromObject A function that returns an object identifier given a particular result\n * object. See the store documentation for details and an example of this function.\n *\n * @param fragmentMatcherFunction A function to use for matching fragment conditions in GraphQL documents\n */\n public writeQueryToStore({\n query,\n result,\n store = defaultNormalizedCacheFactory(),\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n }: {\n query: DocumentNode;\n result: Object;\n store?: NormalizedCache;\n variables?: Object;\n dataIdFromObject?: IdGetter;\n fragmentMatcherFunction?: FragmentMatcher;\n }): NormalizedCache {\n return this.writeResultToStore({\n dataId: 'ROOT_QUERY',\n result,\n document: query,\n store,\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n });\n }\n\n public writeResultToStore({\n dataId,\n result,\n document,\n store = defaultNormalizedCacheFactory(),\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n }: {\n dataId: string;\n result: any;\n document: DocumentNode;\n store?: NormalizedCache;\n variables?: Object;\n dataIdFromObject?: IdGetter;\n fragmentMatcherFunction?: FragmentMatcher;\n }): NormalizedCache {\n // XXX TODO REFACTOR: this is a temporary workaround until query normalization is made to work with documents.\n const operationDefinition = getOperationDefinition(document)!;\n\n try {\n return this.writeSelectionSetToStore({\n result,\n dataId,\n selectionSet: operationDefinition.selectionSet,\n context: {\n store,\n processedData: {},\n variables: assign(\n {},\n getDefaultValues(operationDefinition),\n variables,\n ),\n dataIdFromObject,\n fragmentMap: createFragmentMap(getFragmentDefinitions(document)),\n fragmentMatcherFunction,\n },\n });\n } catch (e) {\n throw enhanceErrorWithDocument(e, document);\n }\n }\n\n public writeSelectionSetToStore({\n result,\n dataId,\n selectionSet,\n context,\n }: {\n dataId: string;\n result: any;\n selectionSet: SelectionSetNode;\n context: WriteContext;\n }): NormalizedCache {\n const { variables, store, fragmentMap } = context;\n\n selectionSet.selections.forEach(selection => {\n if (!shouldInclude(selection, variables)) {\n return;\n }\n\n if (isField(selection)) {\n const resultFieldKey: string = resultKeyNameFromField(selection);\n const value: any = result[resultFieldKey];\n\n if (typeof value !== 'undefined') {\n this.writeFieldToStore({\n dataId,\n value,\n field: selection,\n context,\n });\n } else {\n let isDefered = false;\n let isClient = false;\n if (selection.directives && selection.directives.length) {\n // If this is a defered field we don't need to throw / warn.\n isDefered = selection.directives.some(\n directive => directive.name && directive.name.value === 'defer',\n );\n\n // When using the @client directive, it might be desirable in\n // some cases to want to write a selection set to the store,\n // without having all of the selection set values available.\n // This is because the @client field values might have already\n // been written to the cache separately (e.g. via Apollo\n // Cache's `writeData` capabilities). Because of this, we'll\n // skip the missing field warning for fields with @client\n // directives.\n isClient = selection.directives.some(\n directive => directive.name && directive.name.value === 'client',\n );\n }\n\n if (!isDefered && !isClient && context.fragmentMatcherFunction) {\n // XXX We'd like to throw an error, but for backwards compatibility's sake\n // we just print a warning for the time being.\n //throw new WriteError(`Missing field ${resultFieldKey} in ${JSON.stringify(result, null, 2).substring(0, 100)}`);\n invariant.warn(\n `Missing field ${resultFieldKey} in ${JSON.stringify(\n result,\n null,\n 2,\n ).substring(0, 100)}`,\n );\n }\n }\n } else {\n // This is not a field, so it must be a fragment, either inline or named\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // Named fragment\n fragment = (fragmentMap || {})[selection.name.value];\n invariant(fragment, `No fragment named ${selection.name.value}.`);\n }\n\n let matches = true;\n if (context.fragmentMatcherFunction && fragment.typeCondition) {\n // TODO we need to rewrite the fragment matchers for this to work properly and efficiently\n // Right now we have to pretend that we're passing in an idValue and that there's a store\n // on the context.\n const id = dataId || 'self';\n const idValue = toIdValue({ id, typename: undefined });\n const fakeContext: ReadStoreContext = {\n // NOTE: fakeContext always uses ObjectCache\n // since this is only to ensure the return value of 'matches'\n store: new ObjectCache({ [id]: result }),\n cacheRedirects: {},\n };\n const match = context.fragmentMatcherFunction(\n idValue,\n fragment.typeCondition.name.value,\n fakeContext,\n );\n if (!isProduction() && match === 'heuristic') {\n invariant.error('WARNING: heuristic fragment matching going on!');\n }\n matches = !!match;\n }\n\n if (matches) {\n this.writeSelectionSetToStore({\n result,\n selectionSet: fragment.selectionSet,\n dataId,\n context,\n });\n }\n }\n });\n\n return store;\n }\n\n private writeFieldToStore({\n field,\n value,\n dataId,\n context,\n }: {\n field: FieldNode;\n value: any;\n dataId: string;\n context: WriteContext;\n }) {\n const { variables, dataIdFromObject, store } = context;\n\n let storeValue: StoreValue;\n let storeObject: StoreObject;\n\n const storeFieldName: string = storeKeyNameFromField(field, variables);\n\n // If this is a scalar value...\n if (!field.selectionSet || value === null) {\n storeValue =\n value != null && typeof value === 'object'\n ? // If the scalar value is a JSON blob, we have to \"escape\" it so it can’t pretend to be\n // an id.\n { type: 'json', json: value }\n : // Otherwise, just store the scalar directly in the store.\n value;\n } else if (Array.isArray(value)) {\n const generatedId = `${dataId}.${storeFieldName}`;\n\n storeValue = this.processArrayValue(\n value,\n generatedId,\n field.selectionSet,\n context,\n );\n } else {\n // It's an object\n let valueDataId = `${dataId}.${storeFieldName}`;\n let generated = true;\n\n // We only prepend the '$' if the valueDataId isn't already a generated\n // id.\n if (!isGeneratedId(valueDataId)) {\n valueDataId = '$' + valueDataId;\n }\n\n if (dataIdFromObject) {\n const semanticId = dataIdFromObject(value);\n\n // We throw an error if the first character of the id is '$. This is\n // because we use that character to designate an Apollo-generated id\n // and we use the distinction between user-desiginated and application-provided\n // ids when managing overwrites.\n invariant(\n !semanticId || !isGeneratedId(semanticId),\n 'IDs returned by dataIdFromObject cannot begin with the \"$\" character.',\n );\n\n if (\n semanticId ||\n (typeof semanticId === 'number' && semanticId === 0)\n ) {\n valueDataId = semanticId;\n generated = false;\n }\n }\n\n if (!isDataProcessed(valueDataId, field, context.processedData)) {\n this.writeSelectionSetToStore({\n dataId: valueDataId,\n result: value,\n selectionSet: field.selectionSet,\n context,\n });\n }\n\n // We take the id and escape it (i.e. wrap it with an enclosing object).\n // This allows us to distinguish IDs from normal scalars.\n const typename = value.__typename;\n storeValue = toIdValue({ id: valueDataId, typename }, generated);\n\n // check if there was a generated id at the location where we're\n // about to place this new id. If there was, we have to merge the\n // data from that id with the data we're about to write in the store.\n storeObject = store.get(dataId);\n const escapedId =\n storeObject && (storeObject[storeFieldName] as IdValue | undefined);\n if (escapedId !== storeValue && isIdValue(escapedId)) {\n const hadTypename = escapedId.typename !== undefined;\n const hasTypename = typename !== undefined;\n const typenameChanged =\n hadTypename && hasTypename && escapedId.typename !== typename;\n\n // If there is already a real id in the store and the current id we\n // are dealing with is generated, we throw an error.\n // One exception we allow is when the typename has changed, which occurs\n // when schema defines a union, both with and without an ID in the same place.\n // checks if we \"lost\" the read id\n invariant(\n !generated || escapedId.generated || typenameChanged,\n `Store error: the application attempted to write an object with no provided id but the store already contains an id of ${\n escapedId.id\n } for this object. The selectionSet that was trying to be written is:\\n${\n JSON.stringify(field)\n }`,\n );\n\n // checks if we \"lost\" the typename\n invariant(\n !hadTypename || hasTypename,\n `Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of ${\n escapedId.typename\n } for the object of id ${escapedId.id}. The selectionSet that was trying to be written is:\\n${\n JSON.stringify(field)\n }`,\n );\n\n if (escapedId.generated) {\n // We should only merge if it's an object of the same type,\n // otherwise we should delete the generated object\n if (typenameChanged) {\n // Only delete the generated object when the old object was\n // inlined, and the new object is not. This is indicated by\n // the old id being generated, and the new id being real.\n if (!generated) {\n store.delete(escapedId.id);\n }\n } else {\n mergeWithGenerated(escapedId.id, (storeValue as IdValue).id, store);\n }\n }\n }\n }\n\n storeObject = store.get(dataId);\n if (!storeObject || !isEqual(storeValue, storeObject[storeFieldName])) {\n store.set(dataId, {\n ...storeObject,\n [storeFieldName]: storeValue,\n });\n }\n }\n\n private processArrayValue(\n value: any[],\n generatedId: string,\n selectionSet: SelectionSetNode,\n context: WriteContext,\n ): any[] {\n return value.map((item: any, index: any) => {\n if (item === null) {\n return null;\n }\n\n let itemDataId = `${generatedId}.${index}`;\n\n if (Array.isArray(item)) {\n return this.processArrayValue(item, itemDataId, selectionSet, context);\n }\n\n let generated = true;\n\n if (context.dataIdFromObject) {\n const semanticId = context.dataIdFromObject(item);\n\n if (semanticId) {\n itemDataId = semanticId;\n generated = false;\n }\n }\n\n if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) {\n this.writeSelectionSetToStore({\n dataId: itemDataId,\n result: item,\n selectionSet,\n context,\n });\n }\n\n return toIdValue(\n { id: itemDataId, typename: item.__typename },\n generated,\n );\n });\n }\n}\n\n// Checks if the id given is an id that was generated by Apollo\n// rather than by dataIdFromObject.\nfunction isGeneratedId(id: string): boolean {\n return id[0] === '$';\n}\n\nfunction mergeWithGenerated(\n generatedKey: string,\n realKey: string,\n cache: NormalizedCache,\n): boolean {\n if (generatedKey === realKey) {\n return false;\n }\n\n const generated = cache.get(generatedKey);\n const real = cache.get(realKey);\n let madeChanges = false;\n\n Object.keys(generated).forEach(key => {\n const value = generated[key];\n const realValue = real[key];\n\n if (\n isIdValue(value) &&\n isGeneratedId(value.id) &&\n isIdValue(realValue) &&\n !isEqual(value, realValue) &&\n mergeWithGenerated(value.id, realValue.id, cache)\n ) {\n madeChanges = true;\n }\n });\n\n cache.delete(generatedKey);\n const newRealValue = { ...generated, ...real };\n\n if (isEqual(newRealValue, real)) {\n return madeChanges;\n }\n\n cache.set(realKey, newRealValue);\n return true;\n}\n\nfunction isDataProcessed(\n dataId: string,\n field: FieldNode | SelectionSetNode,\n processedData?: { [x: string]: (FieldNode | SelectionSetNode)[] },\n): boolean {\n if (!processedData) {\n return false;\n }\n\n if (processedData[dataId]) {\n if (processedData[dataId].indexOf(field) >= 0) {\n return true;\n } else {\n processedData[dataId].push(field);\n }\n } else {\n processedData[dataId] = [field];\n }\n\n return false;\n}\n","// Make builtins like Map and Set safe to use with non-extensible objects.\nimport './fixPolyfills';\n\nimport { DocumentNode } from 'graphql';\n\nimport { Cache, ApolloCache, Transaction } from 'apollo-cache';\n\nimport { addTypenameToDocument, canUseWeakMap } from 'apollo-utilities';\n\nimport { wrap } from 'optimism';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { HeuristicFragmentMatcher } from './fragmentMatcher';\nimport {\n ApolloReducerConfig,\n NormalizedCache,\n NormalizedCacheObject,\n} from './types';\n\nimport { StoreReader } from './readFromStore';\nimport { StoreWriter } from './writeToStore';\nimport { DepTrackingCache } from './depTrackingCache';\nimport { KeyTrie } from 'optimism';\nimport { ObjectCache } from './objectCache';\n\nexport interface InMemoryCacheConfig extends ApolloReducerConfig {\n resultCaching?: boolean;\n freezeResults?: boolean;\n}\n\nconst defaultConfig: InMemoryCacheConfig = {\n fragmentMatcher: new HeuristicFragmentMatcher(),\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n freezeResults: false,\n};\n\nexport function defaultDataIdFromObject(result: any): string | null {\n if (result.__typename) {\n if (result.id !== undefined) {\n return `${result.__typename}:${result.id}`;\n }\n if (result._id !== undefined) {\n return `${result.__typename}:${result._id}`;\n }\n }\n return null;\n}\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nexport class OptimisticCacheLayer extends ObjectCache {\n constructor(\n public readonly optimisticId: string,\n // OptimisticCacheLayer objects always wrap some other parent cache, so\n // this.parent should never be null.\n public readonly parent: NormalizedCache,\n public readonly transaction: Transaction,\n ) {\n super(Object.create(null));\n }\n\n public toObject(): NormalizedCacheObject {\n return {\n ...this.parent.toObject(),\n ...this.data,\n };\n }\n\n // All the other accessor methods of ObjectCache work without knowing about\n // this.parent, but the get method needs to be overridden to implement the\n // fallback this.parent.get(dataId) behavior.\n public get(dataId: string) {\n return hasOwn.call(this.data, dataId)\n ? this.data[dataId]\n : this.parent.get(dataId);\n }\n}\n\nexport class InMemoryCache extends ApolloCache {\n private data: NormalizedCache;\n private optimisticData: NormalizedCache;\n\n protected config: InMemoryCacheConfig;\n private watches = new Set();\n private addTypename: boolean;\n private typenameDocumentCache = new Map();\n private storeReader: StoreReader;\n private storeWriter: StoreWriter;\n private cacheKeyRoot = new KeyTrie(canUseWeakMap);\n\n // Set this while in a transaction to prevent broadcasts...\n // don't forget to turn it back on!\n private silenceBroadcast: boolean = false;\n\n constructor(config: InMemoryCacheConfig = {}) {\n super();\n this.config = { ...defaultConfig, ...config };\n\n // backwards compat\n if ((this.config as any).customResolvers) {\n invariant.warn(\n 'customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.',\n );\n this.config.cacheRedirects = (this.config as any).customResolvers;\n }\n\n if ((this.config as any).cacheResolvers) {\n invariant.warn(\n 'cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.',\n );\n this.config.cacheRedirects = (this.config as any).cacheResolvers;\n }\n\n this.addTypename = !!this.config.addTypename;\n\n // Passing { resultCaching: false } in the InMemoryCache constructor options\n // will completely disable dependency tracking, which will improve memory\n // usage but worsen the performance of repeated reads.\n this.data = this.config.resultCaching\n ? new DepTrackingCache()\n : new ObjectCache();\n\n // When no optimistic writes are currently active, cache.optimisticData ===\n // cache.data, so there are no additional layers on top of the actual data.\n // When an optimistic update happens, this.optimisticData will become a\n // linked list of OptimisticCacheLayer objects that terminates with the\n // original this.data cache object.\n this.optimisticData = this.data;\n\n this.storeWriter = new StoreWriter();\n this.storeReader = new StoreReader({\n cacheKeyRoot: this.cacheKeyRoot,\n freezeResults: config.freezeResults,\n });\n\n const cache = this;\n const { maybeBroadcastWatch } = cache;\n this.maybeBroadcastWatch = wrap((c: Cache.WatchOptions) => {\n return maybeBroadcastWatch.call(this, c);\n }, {\n makeCacheKey(c: Cache.WatchOptions) {\n if (c.optimistic) {\n // If we're reading optimistic data, it doesn't matter if this.data\n // is a DepTrackingCache, since it will be ignored.\n return;\n }\n\n if (c.previousResult) {\n // If a previousResult was provided, assume the caller would prefer\n // to compare the previous data to the new data to determine whether\n // to broadcast, so we should disable caching by returning here, to\n // give maybeBroadcastWatch a chance to do that comparison.\n return;\n }\n\n if (cache.data instanceof DepTrackingCache) {\n // Return a cache key (thus enabling caching) only if we're currently\n // using a data store that can track cache dependencies.\n return cache.cacheKeyRoot.lookup(\n c.query,\n JSON.stringify(c.variables),\n );\n }\n }\n });\n }\n\n public restore(data: NormalizedCacheObject): this {\n if (data) this.data.replace(data);\n return this;\n }\n\n public extract(optimistic: boolean = false): NormalizedCacheObject {\n return (optimistic ? this.optimisticData : this.data).toObject();\n }\n\n public read(options: Cache.ReadOptions): T | null {\n if (typeof options.rootId === 'string' &&\n typeof this.data.get(options.rootId) === 'undefined') {\n return null;\n }\n\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n return this.storeReader.readQueryFromStore({\n store: options.optimistic ? this.optimisticData : this.data,\n query: this.transformDocument(options.query),\n variables: options.variables,\n rootId: options.rootId,\n fragmentMatcherFunction,\n previousResult: options.previousResult,\n config: this.config,\n }) || null;\n }\n\n public write(write: Cache.WriteOptions): void {\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n this.storeWriter.writeResultToStore({\n dataId: write.dataId,\n result: write.result,\n variables: write.variables,\n document: this.transformDocument(write.query),\n store: this.data,\n dataIdFromObject: this.config.dataIdFromObject,\n fragmentMatcherFunction,\n });\n\n this.broadcastWatches();\n }\n\n public diff(query: Cache.DiffOptions): Cache.DiffResult {\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n return this.storeReader.diffQueryAgainstStore({\n store: query.optimistic ? this.optimisticData : this.data,\n query: this.transformDocument(query.query),\n variables: query.variables,\n returnPartialData: query.returnPartialData,\n previousResult: query.previousResult,\n fragmentMatcherFunction,\n config: this.config,\n });\n }\n\n public watch(watch: Cache.WatchOptions): () => void {\n this.watches.add(watch);\n\n return () => {\n this.watches.delete(watch);\n };\n }\n\n public evict(query: Cache.EvictOptions): Cache.EvictionResult {\n throw new InvariantError(`eviction is not implemented on InMemory Cache`);\n }\n\n public reset(): Promise {\n this.data.clear();\n this.broadcastWatches();\n\n return Promise.resolve();\n }\n\n public removeOptimistic(idToRemove: string) {\n const toReapply: OptimisticCacheLayer[] = [];\n let removedCount = 0;\n let layer = this.optimisticData;\n\n while (layer instanceof OptimisticCacheLayer) {\n if (layer.optimisticId === idToRemove) {\n ++removedCount;\n } else {\n toReapply.push(layer);\n }\n layer = layer.parent;\n }\n\n if (removedCount > 0) {\n // Reset this.optimisticData to the first non-OptimisticCacheLayer object,\n // which is almost certainly this.data.\n this.optimisticData = layer;\n\n // Reapply the layers whose optimistic IDs do not match the removed ID.\n while (toReapply.length > 0) {\n const layer = toReapply.pop()!;\n this.performTransaction(layer.transaction, layer.optimisticId);\n }\n\n this.broadcastWatches();\n }\n }\n\n public performTransaction(\n transaction: Transaction,\n // This parameter is not part of the performTransaction signature inherited\n // from the ApolloCache abstract class, but it's useful because it saves us\n // from duplicating this implementation in recordOptimisticTransaction.\n optimisticId?: string,\n ) {\n const { data, silenceBroadcast } = this;\n this.silenceBroadcast = true;\n\n if (typeof optimisticId === 'string') {\n // Add a new optimistic layer and temporarily make this.data refer to\n // that layer for the duration of the transaction.\n this.data = this.optimisticData = new OptimisticCacheLayer(\n // Note that there can be multiple layers with the same optimisticId.\n // When removeOptimistic(id) is called for that id, all matching layers\n // will be removed, and the remaining layers will be reapplied.\n optimisticId,\n this.optimisticData,\n transaction,\n );\n }\n\n try {\n transaction(this);\n } finally {\n this.silenceBroadcast = silenceBroadcast;\n this.data = data;\n }\n\n // This broadcast does nothing if this.silenceBroadcast is true.\n this.broadcastWatches();\n }\n\n public recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ) {\n return this.performTransaction(transaction, id);\n }\n\n public transformDocument(document: DocumentNode): DocumentNode {\n if (this.addTypename) {\n let result = this.typenameDocumentCache.get(document);\n if (!result) {\n result = addTypenameToDocument(document);\n this.typenameDocumentCache.set(document, result);\n // If someone calls transformDocument and then mistakenly passes the\n // result back into an API that also calls transformDocument, make sure\n // we don't keep creating new query documents.\n this.typenameDocumentCache.set(result, result);\n }\n return result;\n }\n return document;\n }\n\n protected broadcastWatches() {\n if (!this.silenceBroadcast) {\n this.watches.forEach(c => this.maybeBroadcastWatch(c));\n }\n }\n\n // This method is wrapped in the constructor so that it will be called only\n // if the data that would be broadcast has changed.\n private maybeBroadcastWatch(c: Cache.WatchOptions) {\n c.callback(\n this.diff({\n query: c.query,\n variables: c.variables,\n previousResult: c.previousResult && c.previousResult(),\n optimistic: c.optimistic,\n }),\n );\n }\n}\n"],"names":["defaultNormalizedCacheFactory","hasOwn"],"mappings":";;;;;;AAUA,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,SAAS,UAAU;IACjB,IAAM,MAAM,GAAG,CAAC,U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CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;SACxD;KACF;IAIO,2CAAmB,GAA3B,UAA4B,CAAqB;QAC/C,CAAC,CAAC,QAAQ,CACR,IAAI,CAAC,IAAI,CAAC;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,cAAc,EAAE,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,cAAc,EAAE;YACtD,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC,CACH,CAAC;KACH;IACH,oBAAC;CAjRD,CAAmC,WAAW;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/bundle.umd.js b/node_modules/apollo-cache-inmemory/lib/bundle.umd.js deleted file mode 100644 index a25e9e07..00000000 --- a/node_modules/apollo-cache-inmemory/lib/bundle.umd.js +++ /dev/null @@ -1,1284 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "tslib", "apollo-cache", "apollo-utilities", "optimism", "ts-invariant"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("tslib"), require("apollo-cache"), require("apollo-utilities"), require("optimism"), require("ts-invariant")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.tslib, global.apolloCache, global.apolloUtilities, global.optimism, global.tsInvariant); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _tslib, _apolloCache, _apolloUtilities, _optimism, _tsInvariant) { - - _exports.__esModule = true; - _exports.assertIdValue = assertIdValue; - _exports.defaultDataIdFromObject = defaultDataIdFromObject; - _exports.defaultNormalizedCacheFactory = defaultNormalizedCacheFactory$1; - _exports.enhanceErrorWithDocument = enhanceErrorWithDocument; - _exports.WriteError = _exports.StoreWriter = _exports.StoreReader = _exports.ObjectCache = _exports.IntrospectionFragmentMatcher = _exports.InMemoryCache = _exports.HeuristicFragmentMatcher = void 0; - var haveWarned = false; - - function shouldWarn() { - var answer = !haveWarned; - - if (!(0, _apolloUtilities.isTest)()) { - haveWarned = true; - } - - return answer; - } - - var HeuristicFragmentMatcher = function () { - function HeuristicFragmentMatcher() {} - - HeuristicFragmentMatcher.prototype.ensureReady = function () { - return Promise.resolve(); - }; - - HeuristicFragmentMatcher.prototype.canBypassInit = function () { - return true; - }; - - HeuristicFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - - if (!obj) { - return isRootQuery; - } - - var _a = obj.__typename, - __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - - if (!__typename) { - if (shouldWarn()) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments."); - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Could not find __typename on Fragment ', typeCondition, obj); - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("DEPRECATION WARNING: using fragments without __typename is unsupported behavior " + "and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now."); - } - - return 'heuristic'; - } - - if (__typename === typeCondition) { - return true; - } - - if (shouldWarn()) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('You are using the simple (heuristic) fragment matcher, but your ' + 'queries contain union or interface types. Apollo Client will not be ' + 'able to accurately map fragments. To make this error go away, use ' + 'the `IntrospectionFragmentMatcher` as described in the docs: ' + 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher'); - } - - return 'heuristic'; - }; - - return HeuristicFragmentMatcher; - }(); - - _exports.HeuristicFragmentMatcher = HeuristicFragmentMatcher; - - var IntrospectionFragmentMatcher = function () { - function IntrospectionFragmentMatcher(options) { - if (options && options.introspectionQueryResultData) { - this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData); - this.isReady = true; - } else { - this.isReady = false; - } - - this.match = this.match.bind(this); - } - - IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(this.isReady, 1) : (0, _tsInvariant.invariant)(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()'); - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - - if (!obj) { - return isRootQuery; - } - - var _a = obj.__typename, - __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(__typename, 2) : (0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj)); - - if (__typename === typeCondition) { - return true; - } - - var implementingTypes = this.possibleTypesMap[typeCondition]; - - if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) { - return true; - } - - return false; - }; - - IntrospectionFragmentMatcher.prototype.parseIntrospectionResult = function (introspectionResultData) { - var typeMap = {}; - - introspectionResultData.__schema.types.forEach(function (type) { - if (type.kind === 'UNION' || type.kind === 'INTERFACE') { - typeMap[type.name] = type.possibleTypes.map(function (implementingType) { - return implementingType.name; - }); - } - }); - - return typeMap; - }; - - return IntrospectionFragmentMatcher; - }(); - - _exports.IntrospectionFragmentMatcher = IntrospectionFragmentMatcher; - var hasOwn = Object.prototype.hasOwnProperty; - - var DepTrackingCache = function () { - function DepTrackingCache(data) { - var _this = this; - - if (data === void 0) { - data = Object.create(null); - } - - this.data = data; - this.depend = (0, _optimism.wrap)(function (dataId) { - return _this.data[dataId]; - }, { - disposable: true, - makeCacheKey: function (dataId) { - return dataId; - } - }); - } - - DepTrackingCache.prototype.toObject = function () { - return this.data; - }; - - DepTrackingCache.prototype.get = function (dataId) { - this.depend(dataId); - return this.data[dataId]; - }; - - DepTrackingCache.prototype.set = function (dataId, value) { - var oldValue = this.data[dataId]; - - if (value !== oldValue) { - this.data[dataId] = value; - this.depend.dirty(dataId); - } - }; - - DepTrackingCache.prototype.delete = function (dataId) { - if (hasOwn.call(this.data, dataId)) { - delete this.data[dataId]; - this.depend.dirty(dataId); - } - }; - - DepTrackingCache.prototype.clear = function () { - this.replace(null); - }; - - DepTrackingCache.prototype.replace = function (newData) { - var _this = this; - - if (newData) { - Object.keys(newData).forEach(function (dataId) { - _this.set(dataId, newData[dataId]); - }); - Object.keys(this.data).forEach(function (dataId) { - if (!hasOwn.call(newData, dataId)) { - _this.delete(dataId); - } - }); - } else { - Object.keys(this.data).forEach(function (dataId) { - _this.delete(dataId); - }); - } - }; - - return DepTrackingCache; - }(); - - function defaultNormalizedCacheFactory(seed) { - return new DepTrackingCache(seed); - } - - var StoreReader = function () { - function StoreReader(_a) { - var _this = this; - - var _b = _a === void 0 ? {} : _a, - _c = _b.cacheKeyRoot, - cacheKeyRoot = _c === void 0 ? new _optimism.KeyTrie(_apolloUtilities.canUseWeakMap) : _c, - _d = _b.freezeResults, - freezeResults = _d === void 0 ? false : _d; - - var _e = this, - executeStoreQuery = _e.executeStoreQuery, - executeSelectionSet = _e.executeSelectionSet, - executeSubSelectedArray = _e.executeSubSelectedArray; - - this.freezeResults = freezeResults; - this.executeStoreQuery = (0, _optimism.wrap)(function (options) { - return executeStoreQuery.call(_this, options); - }, { - makeCacheKey: function (_a) { - var query = _a.query, - rootValue = _a.rootValue, - contextValue = _a.contextValue, - variableValues = _a.variableValues, - fragmentMatcher = _a.fragmentMatcher; - - if (contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(contextValue.store, query, fragmentMatcher, JSON.stringify(variableValues), rootValue.id); - } - } - }); - this.executeSelectionSet = (0, _optimism.wrap)(function (options) { - return executeSelectionSet.call(_this, options); - }, { - makeCacheKey: function (_a) { - var selectionSet = _a.selectionSet, - rootValue = _a.rootValue, - execContext = _a.execContext; - - if (execContext.contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, selectionSet, execContext.fragmentMatcher, JSON.stringify(execContext.variableValues), rootValue.id); - } - } - }); - this.executeSubSelectedArray = (0, _optimism.wrap)(function (options) { - return executeSubSelectedArray.call(_this, options); - }, { - makeCacheKey: function (_a) { - var field = _a.field, - array = _a.array, - execContext = _a.execContext; - - if (execContext.contextValue.store instanceof DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, field, array, JSON.stringify(execContext.variableValues)); - } - } - }); - } - - StoreReader.prototype.readQueryFromStore = function (options) { - return this.diffQueryAgainstStore((0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - returnPartialData: false - })).result; - }; - - StoreReader.prototype.diffQueryAgainstStore = function (_a) { - var store = _a.store, - query = _a.query, - variables = _a.variables, - previousResult = _a.previousResult, - _b = _a.returnPartialData, - returnPartialData = _b === void 0 ? true : _b, - _c = _a.rootId, - rootId = _c === void 0 ? 'ROOT_QUERY' : _c, - fragmentMatcherFunction = _a.fragmentMatcherFunction, - config = _a.config; - var queryDefinition = (0, _apolloUtilities.getQueryDefinition)(query); - variables = (0, _apolloUtilities.assign)({}, (0, _apolloUtilities.getDefaultValues)(queryDefinition), variables); - var context = { - store: store, - dataIdFromObject: config && config.dataIdFromObject, - cacheRedirects: config && config.cacheRedirects || {} - }; - var execResult = this.executeStoreQuery({ - query: query, - rootValue: { - type: 'id', - id: rootId, - generated: true, - typename: 'Query' - }, - contextValue: context, - variableValues: variables, - fragmentMatcher: fragmentMatcherFunction - }); - var hasMissingFields = execResult.missing && execResult.missing.length > 0; - - if (hasMissingFields && !returnPartialData) { - execResult.missing.forEach(function (info) { - if (info.tolerable) return; - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(8) : new _tsInvariant.InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); - }); - } - - if (previousResult) { - if ((0, _apolloUtilities.isEqual)(previousResult, execResult.result)) { - execResult.result = previousResult; - } - } - - return { - result: execResult.result, - complete: !hasMissingFields - }; - }; - - StoreReader.prototype.executeStoreQuery = function (_a) { - var query = _a.query, - rootValue = _a.rootValue, - contextValue = _a.contextValue, - variableValues = _a.variableValues, - _b = _a.fragmentMatcher, - fragmentMatcher = _b === void 0 ? defaultFragmentMatcher : _b; - var mainDefinition = (0, _apolloUtilities.getMainDefinition)(query); - var fragments = (0, _apolloUtilities.getFragmentDefinitions)(query); - var fragmentMap = (0, _apolloUtilities.createFragmentMap)(fragments); - var execContext = { - query: query, - fragmentMap: fragmentMap, - contextValue: contextValue, - variableValues: variableValues, - fragmentMatcher: fragmentMatcher - }; - return this.executeSelectionSet({ - selectionSet: mainDefinition.selectionSet, - rootValue: rootValue, - execContext: execContext - }); - }; - - StoreReader.prototype.executeSelectionSet = function (_a) { - var _this = this; - - var selectionSet = _a.selectionSet, - rootValue = _a.rootValue, - execContext = _a.execContext; - var fragmentMap = execContext.fragmentMap, - contextValue = execContext.contextValue, - variables = execContext.variableValues; - var finalResult = { - result: null - }; - var objectsToMerge = []; - var object = contextValue.store.get(rootValue.id); - var typename = object && object.__typename || rootValue.id === 'ROOT_QUERY' && 'Query' || void 0; - - function handleMissing(result) { - var _a; - - if (result.missing) { - finalResult.missing = finalResult.missing || []; - - (_a = finalResult.missing).push.apply(_a, result.missing); - } - - return result.result; - } - - selectionSet.selections.forEach(function (selection) { - var _a; - - if (!(0, _apolloUtilities.shouldInclude)(selection, variables)) { - return; - } - - if ((0, _apolloUtilities.isField)(selection)) { - var fieldResult = handleMissing(_this.executeField(object, typename, selection, execContext)); - - if (typeof fieldResult !== 'undefined') { - objectsToMerge.push((_a = {}, _a[(0, _apolloUtilities.resultKeyNameFromField)(selection)] = fieldResult, _a)); - } - } else { - var fragment = void 0; - - if ((0, _apolloUtilities.isInlineFragment)(selection)) { - fragment = selection; - } else { - fragment = fragmentMap[selection.name.value]; - - if (!fragment) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(9) : new _tsInvariant.InvariantError("No fragment named " + selection.name.value); - } - } - - var typeCondition = fragment.typeCondition && fragment.typeCondition.name.value; - var match = !typeCondition || execContext.fragmentMatcher(rootValue, typeCondition, contextValue); - - if (match) { - var fragmentExecResult = _this.executeSelectionSet({ - selectionSet: fragment.selectionSet, - rootValue: rootValue, - execContext: execContext - }); - - if (match === 'heuristic' && fragmentExecResult.missing) { - fragmentExecResult = (0, _tslib.__assign)((0, _tslib.__assign)({}, fragmentExecResult), { - missing: fragmentExecResult.missing.map(function (info) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, info), { - tolerable: true - }); - }) - }); - } - - objectsToMerge.push(handleMissing(fragmentExecResult)); - } - } - }); - finalResult.result = (0, _apolloUtilities.mergeDeepArray)(objectsToMerge); - - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(finalResult.result); - } - - return finalResult; - }; - - StoreReader.prototype.executeField = function (object, typename, field, execContext) { - var variables = execContext.variableValues, - contextValue = execContext.contextValue; - var fieldName = field.name.value; - var args = (0, _apolloUtilities.argumentsObjectFromField)(field, variables); - var info = { - resultKey: (0, _apolloUtilities.resultKeyNameFromField)(field), - directives: (0, _apolloUtilities.getDirectiveInfoFromField)(field, variables) - }; - var readStoreResult = readStoreResolver(object, typename, fieldName, args, contextValue, info); - - if (Array.isArray(readStoreResult.result)) { - return this.combineExecResults(readStoreResult, this.executeSubSelectedArray({ - field: field, - array: readStoreResult.result, - execContext: execContext - })); - } - - if (!field.selectionSet) { - assertSelectionSetForIdValue(field, readStoreResult.result); - - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - (0, _apolloUtilities.maybeDeepFreeze)(readStoreResult); - } - - return readStoreResult; - } - - if (readStoreResult.result == null) { - return readStoreResult; - } - - return this.combineExecResults(readStoreResult, this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: readStoreResult.result, - execContext: execContext - })); - }; - - StoreReader.prototype.combineExecResults = function () { - var execResults = []; - - for (var _i = 0; _i < arguments.length; _i++) { - execResults[_i] = arguments[_i]; - } - - var missing; - execResults.forEach(function (execResult) { - if (execResult.missing) { - missing = missing || []; - missing.push.apply(missing, execResult.missing); - } - }); - return { - result: execResults.pop().result, - missing: missing - }; - }; - - StoreReader.prototype.executeSubSelectedArray = function (_a) { - var _this = this; - - var field = _a.field, - array = _a.array, - execContext = _a.execContext; - var missing; - - function handleMissing(childResult) { - if (childResult.missing) { - missing = missing || []; - missing.push.apply(missing, childResult.missing); - } - - return childResult.result; - } - - array = array.map(function (item) { - if (item === null) { - return null; - } - - if (Array.isArray(item)) { - return handleMissing(_this.executeSubSelectedArray({ - field: field, - array: item, - execContext: execContext - })); - } - - if (field.selectionSet) { - return handleMissing(_this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: item, - execContext: execContext - })); - } - - assertSelectionSetForIdValue(field, item); - return item; - }); - - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(array); - } - - return { - result: array, - missing: missing - }; - }; - - return StoreReader; - }(); - - _exports.StoreReader = StoreReader; - - function assertSelectionSetForIdValue(field, value) { - if (!field.selectionSet && (0, _apolloUtilities.isIdValue)(value)) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError("Missing selection set for object of type " + value.typename + " returned for query field " + field.name.value); - } - } - - function defaultFragmentMatcher() { - return true; - } - - function assertIdValue(idValue) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)((0, _apolloUtilities.isIdValue)(idValue), 11) : (0, _tsInvariant.invariant)((0, _apolloUtilities.isIdValue)(idValue), "Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue."); - } - - function readStoreResolver(object, typename, fieldName, args, context, _a) { - var resultKey = _a.resultKey, - directives = _a.directives; - var storeKeyName = fieldName; - - if (args || directives) { - storeKeyName = (0, _apolloUtilities.getStoreKeyName)(storeKeyName, args, directives); - } - - var fieldValue = void 0; - - if (object) { - fieldValue = object[storeKeyName]; - - if (typeof fieldValue === 'undefined' && context.cacheRedirects && typeof typename === 'string') { - var type = context.cacheRedirects[typename]; - - if (type) { - var resolver = type[fieldName]; - - if (resolver) { - fieldValue = resolver(object, args, { - getCacheKey: function (storeObj) { - var id = context.dataIdFromObject(storeObj); - return id && (0, _apolloUtilities.toIdValue)({ - id: id, - typename: storeObj.__typename - }); - } - }); - } - } - } - } - - if (typeof fieldValue === 'undefined') { - return { - result: fieldValue, - missing: [{ - object: object, - fieldName: storeKeyName, - tolerable: false - }] - }; - } - - if ((0, _apolloUtilities.isJsonValue)(fieldValue)) { - fieldValue = fieldValue.json; - } - - return { - result: fieldValue - }; - } - - var ObjectCache = function () { - function ObjectCache(data) { - if (data === void 0) { - data = Object.create(null); - } - - this.data = data; - } - - ObjectCache.prototype.toObject = function () { - return this.data; - }; - - ObjectCache.prototype.get = function (dataId) { - return this.data[dataId]; - }; - - ObjectCache.prototype.set = function (dataId, value) { - this.data[dataId] = value; - }; - - ObjectCache.prototype.delete = function (dataId) { - this.data[dataId] = void 0; - }; - - ObjectCache.prototype.clear = function () { - this.data = Object.create(null); - }; - - ObjectCache.prototype.replace = function (newData) { - this.data = newData || Object.create(null); - }; - - return ObjectCache; - }(); - - _exports.ObjectCache = ObjectCache; - - function defaultNormalizedCacheFactory$1(seed) { - return new ObjectCache(seed); - } - - var WriteError = function (_super) { - (0, _tslib.__extends)(WriteError, _super); - - function WriteError() { - var _this = _super !== null && _super.apply(this, arguments) || this; - - _this.type = 'WriteError'; - return _this; - } - - return WriteError; - }(Error); - - _exports.WriteError = WriteError; - - function enhanceErrorWithDocument(error, document) { - var enhancedError = new WriteError("Error writing result to store for query:\n " + JSON.stringify(document)); - enhancedError.message += '\n' + error.message; - enhancedError.stack = error.stack; - return enhancedError; - } - - var StoreWriter = function () { - function StoreWriter() {} - - StoreWriter.prototype.writeQueryToStore = function (_a) { - var query = _a.query, - result = _a.result, - _b = _a.store, - store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, - variables = _a.variables, - dataIdFromObject = _a.dataIdFromObject, - fragmentMatcherFunction = _a.fragmentMatcherFunction; - return this.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: query, - store: store, - variables: variables, - dataIdFromObject: dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction - }); - }; - - StoreWriter.prototype.writeResultToStore = function (_a) { - var dataId = _a.dataId, - result = _a.result, - document = _a.document, - _b = _a.store, - store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, - variables = _a.variables, - dataIdFromObject = _a.dataIdFromObject, - fragmentMatcherFunction = _a.fragmentMatcherFunction; - var operationDefinition = (0, _apolloUtilities.getOperationDefinition)(document); - - try { - return this.writeSelectionSetToStore({ - result: result, - dataId: dataId, - selectionSet: operationDefinition.selectionSet, - context: { - store: store, - processedData: {}, - variables: (0, _apolloUtilities.assign)({}, (0, _apolloUtilities.getDefaultValues)(operationDefinition), variables), - dataIdFromObject: dataIdFromObject, - fragmentMap: (0, _apolloUtilities.createFragmentMap)((0, _apolloUtilities.getFragmentDefinitions)(document)), - fragmentMatcherFunction: fragmentMatcherFunction - } - }); - } catch (e) { - throw enhanceErrorWithDocument(e, document); - } - }; - - StoreWriter.prototype.writeSelectionSetToStore = function (_a) { - var _this = this; - - var result = _a.result, - dataId = _a.dataId, - selectionSet = _a.selectionSet, - context = _a.context; - var variables = context.variables, - store = context.store, - fragmentMap = context.fragmentMap; - selectionSet.selections.forEach(function (selection) { - var _a; - - if (!(0, _apolloUtilities.shouldInclude)(selection, variables)) { - return; - } - - if ((0, _apolloUtilities.isField)(selection)) { - var resultFieldKey = (0, _apolloUtilities.resultKeyNameFromField)(selection); - var value = result[resultFieldKey]; - - if (typeof value !== 'undefined') { - _this.writeFieldToStore({ - dataId: dataId, - value: value, - field: selection, - context: context - }); - } else { - var isDefered = false; - var isClient = false; - - if (selection.directives && selection.directives.length) { - isDefered = selection.directives.some(function (directive) { - return directive.name && directive.name.value === 'defer'; - }); - isClient = selection.directives.some(function (directive) { - return directive.name && directive.name.value === 'client'; - }); - } - - if (!isDefered && !isClient && context.fragmentMatcherFunction) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("Missing field " + resultFieldKey + " in " + JSON.stringify(result, null, 2).substring(0, 100)); - } - } - } else { - var fragment = void 0; - - if ((0, _apolloUtilities.isInlineFragment)(selection)) { - fragment = selection; - } else { - fragment = (fragmentMap || {})[selection.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 3) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value + "."); - } - - var matches = true; - - if (context.fragmentMatcherFunction && fragment.typeCondition) { - var id = dataId || 'self'; - var idValue = (0, _apolloUtilities.toIdValue)({ - id: id, - typename: undefined - }); - var fakeContext = { - store: new ObjectCache((_a = {}, _a[id] = result, _a)), - cacheRedirects: {} - }; - var match = context.fragmentMatcherFunction(idValue, fragment.typeCondition.name.value, fakeContext); - - if (!(0, _apolloUtilities.isProduction)() && match === 'heuristic') { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('WARNING: heuristic fragment matching going on!'); - } - - matches = !!match; - } - - if (matches) { - _this.writeSelectionSetToStore({ - result: result, - selectionSet: fragment.selectionSet, - dataId: dataId, - context: context - }); - } - } - }); - return store; - }; - - StoreWriter.prototype.writeFieldToStore = function (_a) { - var _b; - - var field = _a.field, - value = _a.value, - dataId = _a.dataId, - context = _a.context; - var variables = context.variables, - dataIdFromObject = context.dataIdFromObject, - store = context.store; - var storeValue; - var storeObject; - var storeFieldName = (0, _apolloUtilities.storeKeyNameFromField)(field, variables); - - if (!field.selectionSet || value === null) { - storeValue = value != null && typeof value === 'object' ? { - type: 'json', - json: value - } : value; - } else if (Array.isArray(value)) { - var generatedId = dataId + "." + storeFieldName; - storeValue = this.processArrayValue(value, generatedId, field.selectionSet, context); - } else { - var valueDataId = dataId + "." + storeFieldName; - var generated = true; - - if (!isGeneratedId(valueDataId)) { - valueDataId = '$' + valueDataId; - } - - if (dataIdFromObject) { - var semanticId = dataIdFromObject(value); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 4) : (0, _tsInvariant.invariant)(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.'); - - if (semanticId || typeof semanticId === 'number' && semanticId === 0) { - valueDataId = semanticId; - generated = false; - } - } - - if (!isDataProcessed(valueDataId, field, context.processedData)) { - this.writeSelectionSetToStore({ - dataId: valueDataId, - result: value, - selectionSet: field.selectionSet, - context: context - }); - } - - var typename = value.__typename; - storeValue = (0, _apolloUtilities.toIdValue)({ - id: valueDataId, - typename: typename - }, generated); - storeObject = store.get(dataId); - var escapedId = storeObject && storeObject[storeFieldName]; - - if (escapedId !== storeValue && (0, _apolloUtilities.isIdValue)(escapedId)) { - var hadTypename = escapedId.typename !== undefined; - var hasTypename = typename !== undefined; - var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, 5) : (0, _tsInvariant.invariant)(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!hadTypename || hasTypename, 6) : (0, _tsInvariant.invariant)(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - - if (escapedId.generated) { - if (typenameChanged) { - if (!generated) { - store.delete(escapedId.id); - } - } else { - mergeWithGenerated(escapedId.id, storeValue.id, store); - } - } - } - } - - storeObject = store.get(dataId); - - if (!storeObject || !(0, _apolloUtilities.isEqual)(storeValue, storeObject[storeFieldName])) { - store.set(dataId, (0, _tslib.__assign)((0, _tslib.__assign)({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b))); - } - }; - - StoreWriter.prototype.processArrayValue = function (value, generatedId, selectionSet, context) { - var _this = this; - - return value.map(function (item, index) { - if (item === null) { - return null; - } - - var itemDataId = generatedId + "." + index; - - if (Array.isArray(item)) { - return _this.processArrayValue(item, itemDataId, selectionSet, context); - } - - var generated = true; - - if (context.dataIdFromObject) { - var semanticId = context.dataIdFromObject(item); - - if (semanticId) { - itemDataId = semanticId; - generated = false; - } - } - - if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) { - _this.writeSelectionSetToStore({ - dataId: itemDataId, - result: item, - selectionSet: selectionSet, - context: context - }); - } - - return (0, _apolloUtilities.toIdValue)({ - id: itemDataId, - typename: item.__typename - }, generated); - }); - }; - - return StoreWriter; - }(); - - _exports.StoreWriter = StoreWriter; - - function isGeneratedId(id) { - return id[0] === '$'; - } - - function mergeWithGenerated(generatedKey, realKey, cache) { - if (generatedKey === realKey) { - return false; - } - - var generated = cache.get(generatedKey); - var real = cache.get(realKey); - var madeChanges = false; - Object.keys(generated).forEach(function (key) { - var value = generated[key]; - var realValue = real[key]; - - if ((0, _apolloUtilities.isIdValue)(value) && isGeneratedId(value.id) && (0, _apolloUtilities.isIdValue)(realValue) && !(0, _apolloUtilities.isEqual)(value, realValue) && mergeWithGenerated(value.id, realValue.id, cache)) { - madeChanges = true; - } - }); - cache.delete(generatedKey); - var newRealValue = (0, _tslib.__assign)((0, _tslib.__assign)({}, generated), real); - - if ((0, _apolloUtilities.isEqual)(newRealValue, real)) { - return madeChanges; - } - - cache.set(realKey, newRealValue); - return true; - } - - function isDataProcessed(dataId, field, processedData) { - if (!processedData) { - return false; - } - - if (processedData[dataId]) { - if (processedData[dataId].indexOf(field) >= 0) { - return true; - } else { - processedData[dataId].push(field); - } - } else { - processedData[dataId] = [field]; - } - - return false; - } - - var defaultConfig = { - fragmentMatcher: new HeuristicFragmentMatcher(), - dataIdFromObject: defaultDataIdFromObject, - addTypename: true, - resultCaching: true, - freezeResults: false - }; - - function defaultDataIdFromObject(result) { - if (result.__typename) { - if (result.id !== undefined) { - return result.__typename + ":" + result.id; - } - - if (result._id !== undefined) { - return result.__typename + ":" + result._id; - } - } - - return null; - } - - var hasOwn$1 = Object.prototype.hasOwnProperty; - - var OptimisticCacheLayer = function (_super) { - (0, _tslib.__extends)(OptimisticCacheLayer, _super); - - function OptimisticCacheLayer(optimisticId, parent, transaction) { - var _this = _super.call(this, Object.create(null)) || this; - - _this.optimisticId = optimisticId; - _this.parent = parent; - _this.transaction = transaction; - return _this; - } - - OptimisticCacheLayer.prototype.toObject = function () { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, this.parent.toObject()), this.data); - }; - - OptimisticCacheLayer.prototype.get = function (dataId) { - return hasOwn$1.call(this.data, dataId) ? this.data[dataId] : this.parent.get(dataId); - }; - - return OptimisticCacheLayer; - }(ObjectCache); - - var InMemoryCache = function (_super) { - (0, _tslib.__extends)(InMemoryCache, _super); - - function InMemoryCache(config) { - if (config === void 0) { - config = {}; - } - - var _this = _super.call(this) || this; - - _this.watches = new Set(); - _this.typenameDocumentCache = new Map(); - _this.cacheKeyRoot = new _optimism.KeyTrie(_apolloUtilities.canUseWeakMap); - _this.silenceBroadcast = false; - _this.config = (0, _tslib.__assign)((0, _tslib.__assign)({}, defaultConfig), config); - - if (_this.config.customResolvers) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.customResolvers; - } - - if (_this.config.cacheResolvers) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.cacheResolvers; - } - - _this.addTypename = !!_this.config.addTypename; - _this.data = _this.config.resultCaching ? new DepTrackingCache() : new ObjectCache(); - _this.optimisticData = _this.data; - _this.storeWriter = new StoreWriter(); - _this.storeReader = new StoreReader({ - cacheKeyRoot: _this.cacheKeyRoot, - freezeResults: config.freezeResults - }); - var cache = _this; - var maybeBroadcastWatch = cache.maybeBroadcastWatch; - _this.maybeBroadcastWatch = (0, _optimism.wrap)(function (c) { - return maybeBroadcastWatch.call(_this, c); - }, { - makeCacheKey: function (c) { - if (c.optimistic) { - return; - } - - if (c.previousResult) { - return; - } - - if (cache.data instanceof DepTrackingCache) { - return cache.cacheKeyRoot.lookup(c.query, JSON.stringify(c.variables)); - } - } - }); - return _this; - } - - InMemoryCache.prototype.restore = function (data) { - if (data) this.data.replace(data); - return this; - }; - - InMemoryCache.prototype.extract = function (optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return (optimistic ? this.optimisticData : this.data).toObject(); - }; - - InMemoryCache.prototype.read = function (options) { - if (typeof options.rootId === 'string' && typeof this.data.get(options.rootId) === 'undefined') { - return null; - } - - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.readQueryFromStore({ - store: options.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(options.query), - variables: options.variables, - rootId: options.rootId, - fragmentMatcherFunction: fragmentMatcherFunction, - previousResult: options.previousResult, - config: this.config - }) || null; - }; - - InMemoryCache.prototype.write = function (write) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - this.storeWriter.writeResultToStore({ - dataId: write.dataId, - result: write.result, - variables: write.variables, - document: this.transformDocument(write.query), - store: this.data, - dataIdFromObject: this.config.dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction - }); - this.broadcastWatches(); - }; - - InMemoryCache.prototype.diff = function (query) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.diffQueryAgainstStore({ - store: query.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(query.query), - variables: query.variables, - returnPartialData: query.returnPartialData, - previousResult: query.previousResult, - fragmentMatcherFunction: fragmentMatcherFunction, - config: this.config - }); - }; - - InMemoryCache.prototype.watch = function (watch) { - var _this = this; - - this.watches.add(watch); - return function () { - _this.watches.delete(watch); - }; - }; - - InMemoryCache.prototype.evict = function (query) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(7) : new _tsInvariant.InvariantError("eviction is not implemented on InMemory Cache"); - }; - - InMemoryCache.prototype.reset = function () { - this.data.clear(); - this.broadcastWatches(); - return Promise.resolve(); - }; - - InMemoryCache.prototype.removeOptimistic = function (idToRemove) { - var toReapply = []; - var removedCount = 0; - var layer = this.optimisticData; - - while (layer instanceof OptimisticCacheLayer) { - if (layer.optimisticId === idToRemove) { - ++removedCount; - } else { - toReapply.push(layer); - } - - layer = layer.parent; - } - - if (removedCount > 0) { - this.optimisticData = layer; - - while (toReapply.length > 0) { - var layer_1 = toReapply.pop(); - this.performTransaction(layer_1.transaction, layer_1.optimisticId); - } - - this.broadcastWatches(); - } - }; - - InMemoryCache.prototype.performTransaction = function (transaction, optimisticId) { - var _a = this, - data = _a.data, - silenceBroadcast = _a.silenceBroadcast; - - this.silenceBroadcast = true; - - if (typeof optimisticId === 'string') { - this.data = this.optimisticData = new OptimisticCacheLayer(optimisticId, this.optimisticData, transaction); - } - - try { - transaction(this); - } finally { - this.silenceBroadcast = silenceBroadcast; - this.data = data; - } - - this.broadcastWatches(); - }; - - InMemoryCache.prototype.recordOptimisticTransaction = function (transaction, id) { - return this.performTransaction(transaction, id); - }; - - InMemoryCache.prototype.transformDocument = function (document) { - if (this.addTypename) { - var result = this.typenameDocumentCache.get(document); - - if (!result) { - result = (0, _apolloUtilities.addTypenameToDocument)(document); - this.typenameDocumentCache.set(document, result); - this.typenameDocumentCache.set(result, result); - } - - return result; - } - - return document; - }; - - InMemoryCache.prototype.broadcastWatches = function () { - var _this = this; - - if (!this.silenceBroadcast) { - this.watches.forEach(function (c) { - return _this.maybeBroadcastWatch(c); - }); - } - }; - - InMemoryCache.prototype.maybeBroadcastWatch = function (c) { - c.callback(this.diff({ - query: c.query, - variables: c.variables, - previousResult: c.previousResult && c.previousResult(), - optimistic: c.optimistic - })); - }; - - return InMemoryCache; - }(_apolloCache.ApolloCache); - - - _exports.InMemoryCache = InMemoryCache; -}); diff --git a/node_modules/apollo-cache-inmemory/lib/bundle.umd.js.map b/node_modules/apollo-cache-inmemory/lib/bundle.umd.js.map deleted file mode 100644 index 867e016f..00000000 --- a/node_modules/apollo-cache-inmemory/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/fragmentMatcher.ts","../src/depTrackingCache.ts","../src/readFromStore.ts","../src/objectCache.ts","../src/writeToStore.ts","../src/inMemoryCache.ts"],"names":["defaultNormalizedCacheFactory","hasOwn"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,MAAI,UAAU,GAAG,KAAjB;;AAEA,WAAS,UAAT,GAAmB;AACjB,QAAM,MAAM,GAAG,CAAC,UAAhB;;AAEA,QAAI,CAAC,8BAAL,EAAe;AACb,MAAA,UAAU,GAAG,IAAb;AACD;;AACD,WAAO,MAAP;AACD;;AAKD,MAAA,wBAAA,GAAA,YAAA;AACE,aAAA,wBAAA,GAAA,CAEC;;AAEM,IAAA,wBAAA,CAAA,SAAA,CAAA,WAAA,GAAP,YAAA;AACE,aAAO,OAAO,CAAC,OAAR,EAAP;AACD,KAFM;;AAIA,IAAA,wBAAA,CAAA,SAAA,CAAA,aAAA,GAAP,YAAA;AACE,aAAO,IAAP;AACD,KAFM;;AAIA,IAAA,wBAAA,CAAA,SAAA,CAAA,KAAA,GAAP,UACE,OADF,EAEE,aAFF,EAGE,OAHF,EAG2B;AAEzB,UAAM,GAAG,GAAG,OAAO,CAAC,KAAR,CAAc,GAAd,CAAkB,OAAO,CAAC,EAA1B,CAAZ;AACA,UAAM,WAAW,GAAG,OAAO,CAAC,EAAR,KAAe,YAAnC;;AAEA,UAAI,CAAC,GAAL,EAAU;AAER,eAAO,WAAP;AACD;;AAEO,UAAA,EAAA,GAAA,GAAA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AAA;;AACE,UAAI,CAAC,KAAK,gBAAV,EAA4B;AAC1B,aAAK,OAAL,CAAa,OAAb,CAAqB,UAAA,CAAA,EAAC;AAAI,iBAAA,KAAI,CAAC,mBAAL,CAAyB,CAAzB,CAAA;AAA2B,SAArD;AACD;AACF,KAJS;;AAQF,IAAA,aAAA,CAAA,SAAA,CAAA,mBAAA,GAAR,UAA4B,CAA5B,EAAiD;AAC/C,MAAA,CAAC,CAAC,QAAF,CACE,KAAK,IAAL,CAAU;AACR,QAAA,KAAK,EAAE,CAAC,CAAC,KADD;AAER,QAAA,SAAS,EAAE,CAAC,CAAC,SAFL;AAGR,QAAA,cAAc,EAAE,CAAC,CAAC,cAAF,IAAoB,CAAC,CAAC,cAAF,EAH5B;AAIR,QAAA,UAAU,EAAE,CAAC,CAAC;AAJN,OAAV,CADF;AAQD,KATO;;AAUV,WAAA,aAAA;AAjRA,G,CAAmC,wB","sourcesContent":["import { isTest, IdValue } from 'apollo-utilities';\nimport { invariant } from 'ts-invariant';\n\nimport {\n ReadStoreContext,\n FragmentMatcherInterface,\n PossibleTypesMap,\n IntrospectionResultData,\n} from './types';\n\nlet haveWarned = false;\n\nfunction shouldWarn() {\n const answer = !haveWarned;\n /* istanbul ignore if */\n if (!isTest()) {\n haveWarned = true;\n }\n return answer;\n}\n\n/**\n * This fragment matcher is very basic and unable to match union or interface type conditions\n */\nexport class HeuristicFragmentMatcher implements FragmentMatcherInterface {\n constructor() {\n // do nothing\n }\n\n public ensureReady() {\n return Promise.resolve();\n }\n\n public canBypassInit() {\n return true; // we don't need to initialize this fragment matcher.\n }\n\n public match(\n idValue: IdValue,\n typeCondition: string,\n context: ReadStoreContext,\n ): boolean | 'heuristic' {\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === 'ROOT_QUERY';\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/3507\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && 'Query' } = obj;\n\n if (!__typename) {\n if (shouldWarn()) {\n invariant.warn(`You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments.`);\n invariant.warn(\n 'Could not find __typename on Fragment ',\n typeCondition,\n obj,\n );\n invariant.warn(\n `DEPRECATION WARNING: using fragments without __typename is unsupported behavior ` +\n `and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now.`,\n );\n }\n\n return 'heuristic';\n }\n\n if (__typename === typeCondition) {\n return true;\n }\n\n // At this point we don't know if this fragment should match or not. It's\n // either:\n //\n // 1. (GOOD) A fragment on a matching interface or union.\n // 2. (BAD) A fragment on a non-matching concrete type or interface or union.\n //\n // If it's 2, we don't want it to match. If it's 1, we want it to match. We\n // can't tell the difference, so we warn the user, but still try to match\n // it (for backwards compatibility reasons). This unfortunately means that\n // using the `HeuristicFragmentMatcher` with unions and interfaces is\n // very unreliable. This will be addressed in a future major version of\n // Apollo Client, but for now the recommendation is to use the\n // `IntrospectionFragmentMatcher` when working with unions/interfaces.\n\n if (shouldWarn()) {\n invariant.error(\n 'You are using the simple (heuristic) fragment matcher, but your ' +\n 'queries contain union or interface types. Apollo Client will not be ' +\n 'able to accurately map fragments. To make this error go away, use ' +\n 'the `IntrospectionFragmentMatcher` as described in the docs: ' +\n 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher',\n );\n }\n\n return 'heuristic';\n }\n}\n\nexport class IntrospectionFragmentMatcher implements FragmentMatcherInterface {\n private isReady: boolean;\n private possibleTypesMap: PossibleTypesMap;\n\n constructor(options?: {\n introspectionQueryResultData?: IntrospectionResultData;\n }) {\n if (options && options.introspectionQueryResultData) {\n this.possibleTypesMap = this.parseIntrospectionResult(\n options.introspectionQueryResultData,\n );\n this.isReady = true;\n } else {\n this.isReady = false;\n }\n\n this.match = this.match.bind(this);\n }\n\n public match(\n idValue: IdValue,\n typeCondition: string,\n context: ReadStoreContext,\n ) {\n invariant(\n this.isReady,\n 'FragmentMatcher.match() was called before FragmentMatcher.init()',\n );\n\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === 'ROOT_QUERY';\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/4620\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && 'Query' } = obj;\n\n invariant(\n __typename,\n `Cannot match fragment because __typename property is missing: ${JSON.stringify(\n obj,\n )}`,\n );\n\n if (__typename === typeCondition) {\n return true;\n }\n\n const implementingTypes = this.possibleTypesMap[typeCondition];\n if (\n __typename &&\n implementingTypes &&\n implementingTypes.indexOf(__typename) > -1\n ) {\n return true;\n }\n\n return false;\n }\n\n private parseIntrospectionResult(\n introspectionResultData: IntrospectionResultData,\n ): PossibleTypesMap {\n const typeMap: PossibleTypesMap = {};\n introspectionResultData.__schema.types.forEach(type => {\n if (type.kind === 'UNION' || type.kind === 'INTERFACE') {\n typeMap[type.name] = type.possibleTypes.map(\n implementingType => implementingType.name,\n );\n }\n });\n return typeMap;\n }\n}\n","import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types';\nimport { wrap, OptimisticWrapperFunction } from 'optimism';\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nexport class DepTrackingCache implements NormalizedCache {\n // Wrapper function produced by the optimism library, used to depend on\n // dataId strings, for easy invalidation of specific IDs.\n private depend: OptimisticWrapperFunction<[string], StoreObject | undefined>;\n\n constructor(private data: NormalizedCacheObject = Object.create(null)) {\n this.depend = wrap((dataId: string) => this.data[dataId], {\n disposable: true,\n makeCacheKey(dataId: string) {\n return dataId;\n },\n });\n }\n\n public toObject(): NormalizedCacheObject {\n return this.data;\n }\n\n public get(dataId: string): StoreObject {\n this.depend(dataId);\n return this.data[dataId]!;\n }\n\n public set(dataId: string, value?: StoreObject) {\n const oldValue = this.data[dataId];\n if (value !== oldValue) {\n this.data[dataId] = value;\n this.depend.dirty(dataId);\n }\n }\n\n public delete(dataId: string): void {\n if (hasOwn.call(this.data, dataId)) {\n delete this.data[dataId];\n this.depend.dirty(dataId);\n }\n }\n\n public clear(): void {\n this.replace(null);\n }\n\n public replace(newData: NormalizedCacheObject | null): void {\n if (newData) {\n Object.keys(newData).forEach(dataId => {\n this.set(dataId, newData[dataId]);\n });\n Object.keys(this.data).forEach(dataId => {\n if (!hasOwn.call(newData, dataId)) {\n this.delete(dataId);\n }\n });\n } else {\n Object.keys(this.data).forEach(dataId => {\n this.delete(dataId);\n });\n }\n }\n}\n\nexport function defaultNormalizedCacheFactory(\n seed?: NormalizedCacheObject,\n): NormalizedCache {\n return new DepTrackingCache(seed);\n}\n","import {\n argumentsObjectFromField,\n assign,\n canUseWeakMap,\n createFragmentMap,\n DirectiveInfo,\n FragmentMap,\n getDefaultValues,\n getDirectiveInfoFromField,\n getFragmentDefinitions,\n getMainDefinition,\n getQueryDefinition,\n getStoreKeyName,\n IdValue,\n isEqual,\n isField,\n isIdValue,\n isInlineFragment,\n isJsonValue,\n maybeDeepFreeze,\n mergeDeepArray,\n resultKeyNameFromField,\n shouldInclude,\n StoreValue,\n toIdValue,\n} from 'apollo-utilities';\n\nimport { Cache } from 'apollo-cache';\n\nimport {\n ReadStoreContext,\n DiffQueryAgainstStoreOptions,\n ReadQueryOptions,\n StoreObject,\n} from './types';\n\nimport {\n DocumentNode,\n FieldNode,\n FragmentDefinitionNode,\n InlineFragmentNode,\n SelectionSetNode,\n} from 'graphql';\n\nimport { wrap, KeyTrie } from 'optimism';\nimport { DepTrackingCache } from './depTrackingCache';\nimport { invariant, InvariantError } from 'ts-invariant';\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: ReadStoreContext,\n) => boolean | 'heuristic';\n\ntype ExecContext = {\n query: DocumentNode;\n fragmentMap: FragmentMap;\n contextValue: ReadStoreContext;\n variableValues: VariableMap;\n fragmentMatcher: FragmentMatcher;\n};\n\ntype ExecInfo = {\n resultKey: string;\n directives: DirectiveInfo;\n};\n\nexport type ExecResultMissingField = {\n object: StoreObject;\n fieldName: string;\n tolerable: boolean;\n};\n\nexport type ExecResult = {\n result: R;\n // Empty array if no missing fields encountered while computing result.\n missing?: ExecResultMissingField[];\n};\n\ntype ExecStoreQueryOptions = {\n query: DocumentNode;\n rootValue: IdValue;\n contextValue: ReadStoreContext;\n variableValues: VariableMap;\n // Default matcher always matches all fragments\n fragmentMatcher?: FragmentMatcher;\n};\n\ntype ExecSelectionSetOptions = {\n selectionSet: SelectionSetNode;\n rootValue: any;\n execContext: ExecContext;\n};\n\ntype ExecSubSelectedArrayOptions = {\n field: FieldNode;\n array: any[];\n execContext: ExecContext;\n};\n\nexport interface StoreReaderConfig {\n cacheKeyRoot?: KeyTrie;\n freezeResults?: boolean;\n}\n\nexport class StoreReader {\n private freezeResults: boolean;\n\n constructor({\n cacheKeyRoot = new KeyTrie(canUseWeakMap),\n freezeResults = false,\n }: StoreReaderConfig = {}) {\n const {\n executeStoreQuery,\n executeSelectionSet,\n executeSubSelectedArray,\n } = this;\n\n this.freezeResults = freezeResults;\n\n this.executeStoreQuery = wrap((options: ExecStoreQueryOptions) => {\n return executeStoreQuery.call(this, options);\n }, {\n makeCacheKey({\n query,\n rootValue,\n contextValue,\n variableValues,\n fragmentMatcher,\n }: ExecStoreQueryOptions) {\n // The result of executeStoreQuery can be safely cached only if the\n // underlying store is capable of tracking dependencies and invalidating\n // the cache when relevant data have changed.\n if (contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n contextValue.store,\n query,\n fragmentMatcher,\n JSON.stringify(variableValues),\n rootValue.id,\n );\n }\n }\n });\n\n this.executeSelectionSet = wrap((options: ExecSelectionSetOptions) => {\n return executeSelectionSet.call(this, options);\n }, {\n makeCacheKey({\n selectionSet,\n rootValue,\n execContext,\n }: ExecSelectionSetOptions) {\n if (execContext.contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n execContext.contextValue.store,\n selectionSet,\n execContext.fragmentMatcher,\n JSON.stringify(execContext.variableValues),\n rootValue.id,\n );\n }\n }\n });\n\n this.executeSubSelectedArray = wrap((options: ExecSubSelectedArrayOptions) => {\n return executeSubSelectedArray.call(this, options);\n }, {\n makeCacheKey({ field, array, execContext }) {\n if (execContext.contextValue.store instanceof DepTrackingCache) {\n return cacheKeyRoot.lookup(\n execContext.contextValue.store,\n field,\n array,\n JSON.stringify(execContext.variableValues),\n );\n }\n }\n });\n }\n\n /**\n * Resolves the result of a query solely from the store (i.e. never hits the server).\n *\n * @param {Store} store The {@link NormalizedCache} used by Apollo for the `data` portion of the\n * store.\n *\n * @param {DocumentNode} query The query document to resolve from the data available in the store.\n *\n * @param {Object} [variables] A map from the name of a variable to its value. These variables can\n * be referenced by the query document.\n *\n * @param {any} previousResult The previous result returned by this function for the same query.\n * If nothing in the store changed since that previous result then values from the previous result\n * will be returned to preserve referential equality.\n */\n public readQueryFromStore(\n options: ReadQueryOptions,\n ): QueryType | undefined {\n return this.diffQueryAgainstStore({\n ...options,\n returnPartialData: false,\n }).result;\n }\n\n /**\n * Given a store and a query, return as much of the result as possible and\n * identify if any data was missing from the store.\n * @param {DocumentNode} query A parsed GraphQL query document\n * @param {Store} store The Apollo Client store object\n * @param {any} previousResult The previous result returned by this function for the same query\n * @return {result: Object, complete: [boolean]}\n */\n public diffQueryAgainstStore({\n store,\n query,\n variables,\n previousResult,\n returnPartialData = true,\n rootId = 'ROOT_QUERY',\n fragmentMatcherFunction,\n config,\n }: DiffQueryAgainstStoreOptions): Cache.DiffResult {\n // Throw the right validation error by trying to find a query in the document\n const queryDefinition = getQueryDefinition(query);\n\n variables = assign({}, getDefaultValues(queryDefinition), variables);\n\n const context: ReadStoreContext = {\n // Global settings\n store,\n dataIdFromObject: config && config.dataIdFromObject,\n cacheRedirects: (config && config.cacheRedirects) || {},\n };\n\n const execResult = this.executeStoreQuery({\n query,\n rootValue: {\n type: 'id',\n id: rootId,\n generated: true,\n typename: 'Query',\n },\n contextValue: context,\n variableValues: variables,\n fragmentMatcher: fragmentMatcherFunction,\n });\n\n const hasMissingFields =\n execResult.missing && execResult.missing.length > 0;\n\n if (hasMissingFields && ! returnPartialData) {\n execResult.missing!.forEach(info => {\n if (info.tolerable) return;\n throw new InvariantError(\n `Can't find field ${info.fieldName} on object ${JSON.stringify(\n info.object,\n null,\n 2,\n )}.`,\n );\n });\n }\n\n if (previousResult) {\n if (isEqual(previousResult, execResult.result)) {\n execResult.result = previousResult;\n }\n }\n\n return {\n result: execResult.result,\n complete: !hasMissingFields,\n };\n }\n\n /**\n * Based on graphql function from graphql-js:\n *\n * graphql(\n * schema: GraphQLSchema,\n * requestString: string,\n * rootValue?: ?any,\n * contextValue?: ?any,\n * variableValues?: ?{[key: string]: any},\n * operationName?: ?string\n * ): Promise\n *\n * The default export as of graphql-anywhere is sync as of 4.0,\n * but below is an exported alternative that is async.\n * In the 5.0 version, this will be the only export again\n * and it will be async\n *\n */\n private executeStoreQuery({\n query,\n rootValue,\n contextValue,\n variableValues,\n // Default matcher always matches all fragments\n fragmentMatcher = defaultFragmentMatcher,\n }: ExecStoreQueryOptions): ExecResult {\n const mainDefinition = getMainDefinition(query);\n const fragments = getFragmentDefinitions(query);\n const fragmentMap = createFragmentMap(fragments);\n const execContext: ExecContext = {\n query,\n fragmentMap,\n contextValue,\n variableValues,\n fragmentMatcher,\n };\n\n return this.executeSelectionSet({\n selectionSet: mainDefinition.selectionSet,\n rootValue,\n execContext,\n });\n }\n\n private executeSelectionSet({\n selectionSet,\n rootValue,\n execContext,\n }: ExecSelectionSetOptions): ExecResult {\n const { fragmentMap, contextValue, variableValues: variables } = execContext;\n const finalResult: ExecResult = { result: null };\n\n const objectsToMerge: { [key: string]: any }[] = [];\n\n const object: StoreObject = contextValue.store.get(rootValue.id);\n\n const typename =\n (object && object.__typename) ||\n (rootValue.id === 'ROOT_QUERY' && 'Query') ||\n void 0;\n\n function handleMissing(result: ExecResult): T {\n if (result.missing) {\n finalResult.missing = finalResult.missing || [];\n finalResult.missing.push(...result.missing);\n }\n return result.result;\n }\n\n selectionSet.selections.forEach(selection => {\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely\n return;\n }\n\n if (isField(selection)) {\n const fieldResult = handleMissing(\n this.executeField(object, typename, selection, execContext),\n );\n\n if (typeof fieldResult !== 'undefined') {\n objectsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n });\n }\n\n } else {\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment\n fragment = fragmentMap[selection.name.value];\n\n if (!fragment) {\n throw new InvariantError(`No fragment named ${selection.name.value}`);\n }\n }\n\n const typeCondition =\n fragment.typeCondition && fragment.typeCondition.name.value;\n\n const match =\n !typeCondition ||\n execContext.fragmentMatcher(rootValue, typeCondition, contextValue);\n\n if (match) {\n let fragmentExecResult = this.executeSelectionSet({\n selectionSet: fragment.selectionSet,\n rootValue,\n execContext,\n });\n\n if (match === 'heuristic' && fragmentExecResult.missing) {\n fragmentExecResult = {\n ...fragmentExecResult,\n missing: fragmentExecResult.missing.map(info => {\n return { ...info, tolerable: true };\n }),\n };\n }\n\n objectsToMerge.push(handleMissing(fragmentExecResult));\n }\n }\n });\n\n // Perform a single merge at the end so that we can avoid making more\n // defensive shallow copies than necessary.\n finalResult.result = mergeDeepArray(objectsToMerge);\n\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n Object.freeze(finalResult.result);\n }\n\n return finalResult;\n }\n\n private executeField(\n object: StoreObject,\n typename: string | void,\n field: FieldNode,\n execContext: ExecContext,\n ): ExecResult {\n const { variableValues: variables, contextValue } = execContext;\n const fieldName = field.name.value;\n const args = argumentsObjectFromField(field, variables);\n\n const info: ExecInfo = {\n resultKey: resultKeyNameFromField(field),\n directives: getDirectiveInfoFromField(field, variables),\n };\n\n const readStoreResult = readStoreResolver(\n object,\n typename,\n fieldName,\n args,\n contextValue,\n info,\n );\n\n if (Array.isArray(readStoreResult.result)) {\n return this.combineExecResults(\n readStoreResult,\n this.executeSubSelectedArray({\n field,\n array: readStoreResult.result,\n execContext,\n }),\n );\n }\n\n // Handle all scalar types here\n if (!field.selectionSet) {\n assertSelectionSetForIdValue(field, readStoreResult.result);\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n maybeDeepFreeze(readStoreResult);\n }\n return readStoreResult;\n }\n\n // From here down, the field has a selection set, which means it's trying to\n // query a GraphQLObjectType\n if (readStoreResult.result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return readStoreResult;\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n return this.combineExecResults(\n readStoreResult,\n this.executeSelectionSet({\n selectionSet: field.selectionSet,\n rootValue: readStoreResult.result,\n execContext,\n }),\n );\n }\n\n private combineExecResults(\n ...execResults: ExecResult[]\n ): ExecResult {\n let missing: ExecResultMissingField[] | undefined;\n execResults.forEach(execResult => {\n if (execResult.missing) {\n missing = missing || [];\n missing.push(...execResult.missing);\n }\n });\n return {\n result: execResults.pop()!.result,\n missing,\n };\n }\n\n private executeSubSelectedArray({\n field,\n array,\n execContext,\n }: ExecSubSelectedArrayOptions): ExecResult {\n let missing: ExecResultMissingField[] | undefined;\n\n function handleMissing(childResult: ExecResult): T {\n if (childResult.missing) {\n missing = missing || [];\n missing.push(...childResult.missing);\n }\n\n return childResult.result;\n }\n\n array = array.map(item => {\n // null value in array\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse\n if (Array.isArray(item)) {\n return handleMissing(this.executeSubSelectedArray({\n field,\n array: item,\n execContext,\n }));\n }\n\n // This is an object, run the selection set on it\n if (field.selectionSet) {\n return handleMissing(this.executeSelectionSet({\n selectionSet: field.selectionSet,\n rootValue: item,\n execContext,\n }));\n }\n\n assertSelectionSetForIdValue(field, item);\n\n return item;\n });\n\n if (this.freezeResults && process.env.NODE_ENV !== 'production') {\n Object.freeze(array);\n }\n\n return { result: array, missing };\n }\n}\n\nfunction assertSelectionSetForIdValue(\n field: FieldNode,\n value: any,\n) {\n if (!field.selectionSet && isIdValue(value)) {\n throw new InvariantError(\n `Missing selection set for object of type ${\n value.typename\n } returned for query field ${field.name.value}`\n );\n }\n}\n\nfunction defaultFragmentMatcher() {\n return true;\n}\n\nexport function assertIdValue(idValue: IdValue) {\n invariant(isIdValue(idValue), `\\\nEncountered a sub-selection on the query, but the store doesn't have \\\nan object reference. This should never happen during normal use unless you have custom code \\\nthat is directly manipulating the store; please file an issue.`);\n}\n\nfunction readStoreResolver(\n object: StoreObject,\n typename: string | void,\n fieldName: string,\n args: any,\n context: ReadStoreContext,\n { resultKey, directives }: ExecInfo,\n): ExecResult {\n let storeKeyName = fieldName;\n if (args || directives) {\n // We happen to know here that getStoreKeyName returns its first\n // argument unmodified if there are no args or directives, so we can\n // avoid calling the function at all in that case, as a small but\n // important optimization to this frequently executed code.\n storeKeyName = getStoreKeyName(storeKeyName, args, directives);\n }\n\n let fieldValue: StoreValue | void = void 0;\n\n if (object) {\n fieldValue = object[storeKeyName];\n\n if (\n typeof fieldValue === 'undefined' &&\n context.cacheRedirects &&\n typeof typename === 'string'\n ) {\n // Look for the type in the custom resolver map\n const type = context.cacheRedirects[typename];\n if (type) {\n // Look for the field in the custom resolver map\n const resolver = type[fieldName];\n if (resolver) {\n fieldValue = resolver(object, args, {\n getCacheKey(storeObj: StoreObject) {\n const id = context.dataIdFromObject!(storeObj);\n return id && toIdValue({\n id,\n typename: storeObj.__typename,\n });\n },\n });\n }\n }\n }\n }\n\n if (typeof fieldValue === 'undefined') {\n return {\n result: fieldValue,\n missing: [{\n object,\n fieldName: storeKeyName,\n tolerable: false,\n }],\n };\n }\n\n if (isJsonValue(fieldValue)) {\n fieldValue = fieldValue.json;\n }\n\n return {\n result: fieldValue,\n };\n}\n","import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types';\n\nexport class ObjectCache implements NormalizedCache {\n constructor(protected data: NormalizedCacheObject = Object.create(null)) {}\n\n public toObject() {\n return this.data;\n }\n\n public get(dataId: string) {\n return this.data[dataId]!;\n }\n\n public set(dataId: string, value: StoreObject) {\n this.data[dataId] = value;\n }\n\n public delete(dataId: string) {\n this.data[dataId] = void 0;\n }\n\n public clear() {\n this.data = Object.create(null);\n }\n\n public replace(newData: NormalizedCacheObject) {\n this.data = newData || Object.create(null);\n }\n}\n\nexport function defaultNormalizedCacheFactory(\n seed?: NormalizedCacheObject,\n): NormalizedCache {\n return new ObjectCache(seed);\n}\n","import {\n SelectionSetNode,\n FieldNode,\n DocumentNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n} from 'graphql';\nimport { FragmentMatcher } from './readFromStore';\n\nimport {\n assign,\n createFragmentMap,\n FragmentMap,\n getDefaultValues,\n getFragmentDefinitions,\n getOperationDefinition,\n IdValue,\n isField,\n isIdValue,\n isInlineFragment,\n isProduction,\n resultKeyNameFromField,\n shouldInclude,\n storeKeyNameFromField,\n StoreValue,\n toIdValue,\n isEqual,\n} from 'apollo-utilities';\n\nimport { invariant } from 'ts-invariant';\n\nimport { ObjectCache } from './objectCache';\nimport { defaultNormalizedCacheFactory } from './depTrackingCache';\n\nimport {\n IdGetter,\n NormalizedCache,\n ReadStoreContext,\n StoreObject,\n} from './types';\n\nexport class WriteError extends Error {\n public type = 'WriteError';\n}\n\nexport function enhanceErrorWithDocument(error: Error, document: DocumentNode) {\n // XXX A bit hacky maybe ...\n const enhancedError = new WriteError(\n `Error writing result to store for query:\\n ${JSON.stringify(document)}`,\n );\n enhancedError.message += '\\n' + error.message;\n enhancedError.stack = error.stack;\n return enhancedError;\n}\n\nexport type WriteContext = {\n readonly store: NormalizedCache;\n readonly processedData?: { [x: string]: FieldNode[] };\n readonly variables?: any;\n readonly dataIdFromObject?: IdGetter;\n readonly fragmentMap?: FragmentMap;\n readonly fragmentMatcherFunction?: FragmentMatcher;\n};\n\nexport class StoreWriter {\n /**\n * Writes the result of a query to the store.\n *\n * @param result The result object returned for the query document.\n *\n * @param query The query document whose result we are writing to the store.\n *\n * @param store The {@link NormalizedCache} used by Apollo for the `data` portion of the store.\n *\n * @param variables A map from the name of a variable to its value. These variables can be\n * referenced by the query document.\n *\n * @param dataIdFromObject A function that returns an object identifier given a particular result\n * object. See the store documentation for details and an example of this function.\n *\n * @param fragmentMatcherFunction A function to use for matching fragment conditions in GraphQL documents\n */\n public writeQueryToStore({\n query,\n result,\n store = defaultNormalizedCacheFactory(),\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n }: {\n query: DocumentNode;\n result: Object;\n store?: NormalizedCache;\n variables?: Object;\n dataIdFromObject?: IdGetter;\n fragmentMatcherFunction?: FragmentMatcher;\n }): NormalizedCache {\n return this.writeResultToStore({\n dataId: 'ROOT_QUERY',\n result,\n document: query,\n store,\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n });\n }\n\n public writeResultToStore({\n dataId,\n result,\n document,\n store = defaultNormalizedCacheFactory(),\n variables,\n dataIdFromObject,\n fragmentMatcherFunction,\n }: {\n dataId: string;\n result: any;\n document: DocumentNode;\n store?: NormalizedCache;\n variables?: Object;\n dataIdFromObject?: IdGetter;\n fragmentMatcherFunction?: FragmentMatcher;\n }): NormalizedCache {\n // XXX TODO REFACTOR: this is a temporary workaround until query normalization is made to work with documents.\n const operationDefinition = getOperationDefinition(document)!;\n\n try {\n return this.writeSelectionSetToStore({\n result,\n dataId,\n selectionSet: operationDefinition.selectionSet,\n context: {\n store,\n processedData: {},\n variables: assign(\n {},\n getDefaultValues(operationDefinition),\n variables,\n ),\n dataIdFromObject,\n fragmentMap: createFragmentMap(getFragmentDefinitions(document)),\n fragmentMatcherFunction,\n },\n });\n } catch (e) {\n throw enhanceErrorWithDocument(e, document);\n }\n }\n\n public writeSelectionSetToStore({\n result,\n dataId,\n selectionSet,\n context,\n }: {\n dataId: string;\n result: any;\n selectionSet: SelectionSetNode;\n context: WriteContext;\n }): NormalizedCache {\n const { variables, store, fragmentMap } = context;\n\n selectionSet.selections.forEach(selection => {\n if (!shouldInclude(selection, variables)) {\n return;\n }\n\n if (isField(selection)) {\n const resultFieldKey: string = resultKeyNameFromField(selection);\n const value: any = result[resultFieldKey];\n\n if (typeof value !== 'undefined') {\n this.writeFieldToStore({\n dataId,\n value,\n field: selection,\n context,\n });\n } else {\n let isDefered = false;\n let isClient = false;\n if (selection.directives && selection.directives.length) {\n // If this is a defered field we don't need to throw / warn.\n isDefered = selection.directives.some(\n directive => directive.name && directive.name.value === 'defer',\n );\n\n // When using the @client directive, it might be desirable in\n // some cases to want to write a selection set to the store,\n // without having all of the selection set values available.\n // This is because the @client field values might have already\n // been written to the cache separately (e.g. via Apollo\n // Cache's `writeData` capabilities). Because of this, we'll\n // skip the missing field warning for fields with @client\n // directives.\n isClient = selection.directives.some(\n directive => directive.name && directive.name.value === 'client',\n );\n }\n\n if (!isDefered && !isClient && context.fragmentMatcherFunction) {\n // XXX We'd like to throw an error, but for backwards compatibility's sake\n // we just print a warning for the time being.\n //throw new WriteError(`Missing field ${resultFieldKey} in ${JSON.stringify(result, null, 2).substring(0, 100)}`);\n invariant.warn(\n `Missing field ${resultFieldKey} in ${JSON.stringify(\n result,\n null,\n 2,\n ).substring(0, 100)}`,\n );\n }\n }\n } else {\n // This is not a field, so it must be a fragment, either inline or named\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // Named fragment\n fragment = (fragmentMap || {})[selection.name.value];\n invariant(fragment, `No fragment named ${selection.name.value}.`);\n }\n\n let matches = true;\n if (context.fragmentMatcherFunction && fragment.typeCondition) {\n // TODO we need to rewrite the fragment matchers for this to work properly and efficiently\n // Right now we have to pretend that we're passing in an idValue and that there's a store\n // on the context.\n const id = dataId || 'self';\n const idValue = toIdValue({ id, typename: undefined });\n const fakeContext: ReadStoreContext = {\n // NOTE: fakeContext always uses ObjectCache\n // since this is only to ensure the return value of 'matches'\n store: new ObjectCache({ [id]: result }),\n cacheRedirects: {},\n };\n const match = context.fragmentMatcherFunction(\n idValue,\n fragment.typeCondition.name.value,\n fakeContext,\n );\n if (!isProduction() && match === 'heuristic') {\n invariant.error('WARNING: heuristic fragment matching going on!');\n }\n matches = !!match;\n }\n\n if (matches) {\n this.writeSelectionSetToStore({\n result,\n selectionSet: fragment.selectionSet,\n dataId,\n context,\n });\n }\n }\n });\n\n return store;\n }\n\n private writeFieldToStore({\n field,\n value,\n dataId,\n context,\n }: {\n field: FieldNode;\n value: any;\n dataId: string;\n context: WriteContext;\n }) {\n const { variables, dataIdFromObject, store } = context;\n\n let storeValue: StoreValue;\n let storeObject: StoreObject;\n\n const storeFieldName: string = storeKeyNameFromField(field, variables);\n\n // If this is a scalar value...\n if (!field.selectionSet || value === null) {\n storeValue =\n value != null && typeof value === 'object'\n ? // If the scalar value is a JSON blob, we have to \"escape\" it so it can’t pretend to be\n // an id.\n { type: 'json', json: value }\n : // Otherwise, just store the scalar directly in the store.\n value;\n } else if (Array.isArray(value)) {\n const generatedId = `${dataId}.${storeFieldName}`;\n\n storeValue = this.processArrayValue(\n value,\n generatedId,\n field.selectionSet,\n context,\n );\n } else {\n // It's an object\n let valueDataId = `${dataId}.${storeFieldName}`;\n let generated = true;\n\n // We only prepend the '$' if the valueDataId isn't already a generated\n // id.\n if (!isGeneratedId(valueDataId)) {\n valueDataId = '$' + valueDataId;\n }\n\n if (dataIdFromObject) {\n const semanticId = dataIdFromObject(value);\n\n // We throw an error if the first character of the id is '$. This is\n // because we use that character to designate an Apollo-generated id\n // and we use the distinction between user-desiginated and application-provided\n // ids when managing overwrites.\n invariant(\n !semanticId || !isGeneratedId(semanticId),\n 'IDs returned by dataIdFromObject cannot begin with the \"$\" character.',\n );\n\n if (\n semanticId ||\n (typeof semanticId === 'number' && semanticId === 0)\n ) {\n valueDataId = semanticId;\n generated = false;\n }\n }\n\n if (!isDataProcessed(valueDataId, field, context.processedData)) {\n this.writeSelectionSetToStore({\n dataId: valueDataId,\n result: value,\n selectionSet: field.selectionSet,\n context,\n });\n }\n\n // We take the id and escape it (i.e. wrap it with an enclosing object).\n // This allows us to distinguish IDs from normal scalars.\n const typename = value.__typename;\n storeValue = toIdValue({ id: valueDataId, typename }, generated);\n\n // check if there was a generated id at the location where we're\n // about to place this new id. If there was, we have to merge the\n // data from that id with the data we're about to write in the store.\n storeObject = store.get(dataId);\n const escapedId =\n storeObject && (storeObject[storeFieldName] as IdValue | undefined);\n if (escapedId !== storeValue && isIdValue(escapedId)) {\n const hadTypename = escapedId.typename !== undefined;\n const hasTypename = typename !== undefined;\n const typenameChanged =\n hadTypename && hasTypename && escapedId.typename !== typename;\n\n // If there is already a real id in the store and the current id we\n // are dealing with is generated, we throw an error.\n // One exception we allow is when the typename has changed, which occurs\n // when schema defines a union, both with and without an ID in the same place.\n // checks if we \"lost\" the read id\n invariant(\n !generated || escapedId.generated || typenameChanged,\n `Store error: the application attempted to write an object with no provided id but the store already contains an id of ${\n escapedId.id\n } for this object. The selectionSet that was trying to be written is:\\n${\n JSON.stringify(field)\n }`,\n );\n\n // checks if we \"lost\" the typename\n invariant(\n !hadTypename || hasTypename,\n `Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of ${\n escapedId.typename\n } for the object of id ${escapedId.id}. The selectionSet that was trying to be written is:\\n${\n JSON.stringify(field)\n }`,\n );\n\n if (escapedId.generated) {\n // We should only merge if it's an object of the same type,\n // otherwise we should delete the generated object\n if (typenameChanged) {\n // Only delete the generated object when the old object was\n // inlined, and the new object is not. This is indicated by\n // the old id being generated, and the new id being real.\n if (!generated) {\n store.delete(escapedId.id);\n }\n } else {\n mergeWithGenerated(escapedId.id, (storeValue as IdValue).id, store);\n }\n }\n }\n }\n\n storeObject = store.get(dataId);\n if (!storeObject || !isEqual(storeValue, storeObject[storeFieldName])) {\n store.set(dataId, {\n ...storeObject,\n [storeFieldName]: storeValue,\n });\n }\n }\n\n private processArrayValue(\n value: any[],\n generatedId: string,\n selectionSet: SelectionSetNode,\n context: WriteContext,\n ): any[] {\n return value.map((item: any, index: any) => {\n if (item === null) {\n return null;\n }\n\n let itemDataId = `${generatedId}.${index}`;\n\n if (Array.isArray(item)) {\n return this.processArrayValue(item, itemDataId, selectionSet, context);\n }\n\n let generated = true;\n\n if (context.dataIdFromObject) {\n const semanticId = context.dataIdFromObject(item);\n\n if (semanticId) {\n itemDataId = semanticId;\n generated = false;\n }\n }\n\n if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) {\n this.writeSelectionSetToStore({\n dataId: itemDataId,\n result: item,\n selectionSet,\n context,\n });\n }\n\n return toIdValue(\n { id: itemDataId, typename: item.__typename },\n generated,\n );\n });\n }\n}\n\n// Checks if the id given is an id that was generated by Apollo\n// rather than by dataIdFromObject.\nfunction isGeneratedId(id: string): boolean {\n return id[0] === '$';\n}\n\nfunction mergeWithGenerated(\n generatedKey: string,\n realKey: string,\n cache: NormalizedCache,\n): boolean {\n if (generatedKey === realKey) {\n return false;\n }\n\n const generated = cache.get(generatedKey);\n const real = cache.get(realKey);\n let madeChanges = false;\n\n Object.keys(generated).forEach(key => {\n const value = generated[key];\n const realValue = real[key];\n\n if (\n isIdValue(value) &&\n isGeneratedId(value.id) &&\n isIdValue(realValue) &&\n !isEqual(value, realValue) &&\n mergeWithGenerated(value.id, realValue.id, cache)\n ) {\n madeChanges = true;\n }\n });\n\n cache.delete(generatedKey);\n const newRealValue = { ...generated, ...real };\n\n if (isEqual(newRealValue, real)) {\n return madeChanges;\n }\n\n cache.set(realKey, newRealValue);\n return true;\n}\n\nfunction isDataProcessed(\n dataId: string,\n field: FieldNode | SelectionSetNode,\n processedData?: { [x: string]: (FieldNode | SelectionSetNode)[] },\n): boolean {\n if (!processedData) {\n return false;\n }\n\n if (processedData[dataId]) {\n if (processedData[dataId].indexOf(field) >= 0) {\n return true;\n } else {\n processedData[dataId].push(field);\n }\n } else {\n processedData[dataId] = [field];\n }\n\n return false;\n}\n","// Make builtins like Map and Set safe to use with non-extensible objects.\nimport './fixPolyfills';\n\nimport { DocumentNode } from 'graphql';\n\nimport { Cache, ApolloCache, Transaction } from 'apollo-cache';\n\nimport { addTypenameToDocument, canUseWeakMap } from 'apollo-utilities';\n\nimport { wrap } from 'optimism';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { HeuristicFragmentMatcher } from './fragmentMatcher';\nimport {\n ApolloReducerConfig,\n NormalizedCache,\n NormalizedCacheObject,\n} from './types';\n\nimport { StoreReader } from './readFromStore';\nimport { StoreWriter } from './writeToStore';\nimport { DepTrackingCache } from './depTrackingCache';\nimport { KeyTrie } from 'optimism';\nimport { ObjectCache } from './objectCache';\n\nexport interface InMemoryCacheConfig extends ApolloReducerConfig {\n resultCaching?: boolean;\n freezeResults?: boolean;\n}\n\nconst defaultConfig: InMemoryCacheConfig = {\n fragmentMatcher: new HeuristicFragmentMatcher(),\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n freezeResults: false,\n};\n\nexport function defaultDataIdFromObject(result: any): string | null {\n if (result.__typename) {\n if (result.id !== undefined) {\n return `${result.__typename}:${result.id}`;\n }\n if (result._id !== undefined) {\n return `${result.__typename}:${result._id}`;\n }\n }\n return null;\n}\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nexport class OptimisticCacheLayer extends ObjectCache {\n constructor(\n public readonly optimisticId: string,\n // OptimisticCacheLayer objects always wrap some other parent cache, so\n // this.parent should never be null.\n public readonly parent: NormalizedCache,\n public readonly transaction: Transaction,\n ) {\n super(Object.create(null));\n }\n\n public toObject(): NormalizedCacheObject {\n return {\n ...this.parent.toObject(),\n ...this.data,\n };\n }\n\n // All the other accessor methods of ObjectCache work without knowing about\n // this.parent, but the get method needs to be overridden to implement the\n // fallback this.parent.get(dataId) behavior.\n public get(dataId: string) {\n return hasOwn.call(this.data, dataId)\n ? this.data[dataId]\n : this.parent.get(dataId);\n }\n}\n\nexport class InMemoryCache extends ApolloCache {\n private data: NormalizedCache;\n private optimisticData: NormalizedCache;\n\n protected config: InMemoryCacheConfig;\n private watches = new Set();\n private addTypename: boolean;\n private typenameDocumentCache = new Map();\n private storeReader: StoreReader;\n private storeWriter: StoreWriter;\n private cacheKeyRoot = new KeyTrie(canUseWeakMap);\n\n // Set this while in a transaction to prevent broadcasts...\n // don't forget to turn it back on!\n private silenceBroadcast: boolean = false;\n\n constructor(config: InMemoryCacheConfig = {}) {\n super();\n this.config = { ...defaultConfig, ...config };\n\n // backwards compat\n if ((this.config as any).customResolvers) {\n invariant.warn(\n 'customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.',\n );\n this.config.cacheRedirects = (this.config as any).customResolvers;\n }\n\n if ((this.config as any).cacheResolvers) {\n invariant.warn(\n 'cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.',\n );\n this.config.cacheRedirects = (this.config as any).cacheResolvers;\n }\n\n this.addTypename = !!this.config.addTypename;\n\n // Passing { resultCaching: false } in the InMemoryCache constructor options\n // will completely disable dependency tracking, which will improve memory\n // usage but worsen the performance of repeated reads.\n this.data = this.config.resultCaching\n ? new DepTrackingCache()\n : new ObjectCache();\n\n // When no optimistic writes are currently active, cache.optimisticData ===\n // cache.data, so there are no additional layers on top of the actual data.\n // When an optimistic update happens, this.optimisticData will become a\n // linked list of OptimisticCacheLayer objects that terminates with the\n // original this.data cache object.\n this.optimisticData = this.data;\n\n this.storeWriter = new StoreWriter();\n this.storeReader = new StoreReader({\n cacheKeyRoot: this.cacheKeyRoot,\n freezeResults: config.freezeResults,\n });\n\n const cache = this;\n const { maybeBroadcastWatch } = cache;\n this.maybeBroadcastWatch = wrap((c: Cache.WatchOptions) => {\n return maybeBroadcastWatch.call(this, c);\n }, {\n makeCacheKey(c: Cache.WatchOptions) {\n if (c.optimistic) {\n // If we're reading optimistic data, it doesn't matter if this.data\n // is a DepTrackingCache, since it will be ignored.\n return;\n }\n\n if (c.previousResult) {\n // If a previousResult was provided, assume the caller would prefer\n // to compare the previous data to the new data to determine whether\n // to broadcast, so we should disable caching by returning here, to\n // give maybeBroadcastWatch a chance to do that comparison.\n return;\n }\n\n if (cache.data instanceof DepTrackingCache) {\n // Return a cache key (thus enabling caching) only if we're currently\n // using a data store that can track cache dependencies.\n return cache.cacheKeyRoot.lookup(\n c.query,\n JSON.stringify(c.variables),\n );\n }\n }\n });\n }\n\n public restore(data: NormalizedCacheObject): this {\n if (data) this.data.replace(data);\n return this;\n }\n\n public extract(optimistic: boolean = false): NormalizedCacheObject {\n return (optimistic ? this.optimisticData : this.data).toObject();\n }\n\n public read(options: Cache.ReadOptions): T | null {\n if (typeof options.rootId === 'string' &&\n typeof this.data.get(options.rootId) === 'undefined') {\n return null;\n }\n\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n return this.storeReader.readQueryFromStore({\n store: options.optimistic ? this.optimisticData : this.data,\n query: this.transformDocument(options.query),\n variables: options.variables,\n rootId: options.rootId,\n fragmentMatcherFunction,\n previousResult: options.previousResult,\n config: this.config,\n }) || null;\n }\n\n public write(write: Cache.WriteOptions): void {\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n this.storeWriter.writeResultToStore({\n dataId: write.dataId,\n result: write.result,\n variables: write.variables,\n document: this.transformDocument(write.query),\n store: this.data,\n dataIdFromObject: this.config.dataIdFromObject,\n fragmentMatcherFunction,\n });\n\n this.broadcastWatches();\n }\n\n public diff(query: Cache.DiffOptions): Cache.DiffResult {\n const { fragmentMatcher } = this.config;\n const fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match;\n\n return this.storeReader.diffQueryAgainstStore({\n store: query.optimistic ? this.optimisticData : this.data,\n query: this.transformDocument(query.query),\n variables: query.variables,\n returnPartialData: query.returnPartialData,\n previousResult: query.previousResult,\n fragmentMatcherFunction,\n config: this.config,\n });\n }\n\n public watch(watch: Cache.WatchOptions): () => void {\n this.watches.add(watch);\n\n return () => {\n this.watches.delete(watch);\n };\n }\n\n public evict(query: Cache.EvictOptions): Cache.EvictionResult {\n throw new InvariantError(`eviction is not implemented on InMemory Cache`);\n }\n\n public reset(): Promise {\n this.data.clear();\n this.broadcastWatches();\n\n return Promise.resolve();\n }\n\n public removeOptimistic(idToRemove: string) {\n const toReapply: OptimisticCacheLayer[] = [];\n let removedCount = 0;\n let layer = this.optimisticData;\n\n while (layer instanceof OptimisticCacheLayer) {\n if (layer.optimisticId === idToRemove) {\n ++removedCount;\n } else {\n toReapply.push(layer);\n }\n layer = layer.parent;\n }\n\n if (removedCount > 0) {\n // Reset this.optimisticData to the first non-OptimisticCacheLayer object,\n // which is almost certainly this.data.\n this.optimisticData = layer;\n\n // Reapply the layers whose optimistic IDs do not match the removed ID.\n while (toReapply.length > 0) {\n const layer = toReapply.pop()!;\n this.performTransaction(layer.transaction, layer.optimisticId);\n }\n\n this.broadcastWatches();\n }\n }\n\n public performTransaction(\n transaction: Transaction,\n // This parameter is not part of the performTransaction signature inherited\n // from the ApolloCache abstract class, but it's useful because it saves us\n // from duplicating this implementation in recordOptimisticTransaction.\n optimisticId?: string,\n ) {\n const { data, silenceBroadcast } = this;\n this.silenceBroadcast = true;\n\n if (typeof optimisticId === 'string') {\n // Add a new optimistic layer and temporarily make this.data refer to\n // that layer for the duration of the transaction.\n this.data = this.optimisticData = new OptimisticCacheLayer(\n // Note that there can be multiple layers with the same optimisticId.\n // When removeOptimistic(id) is called for that id, all matching layers\n // will be removed, and the remaining layers will be reapplied.\n optimisticId,\n this.optimisticData,\n transaction,\n );\n }\n\n try {\n transaction(this);\n } finally {\n this.silenceBroadcast = silenceBroadcast;\n this.data = data;\n }\n\n // This broadcast does nothing if this.silenceBroadcast is true.\n this.broadcastWatches();\n }\n\n public recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ) {\n return this.performTransaction(transaction, id);\n }\n\n public transformDocument(document: DocumentNode): DocumentNode {\n if (this.addTypename) {\n let result = this.typenameDocumentCache.get(document);\n if (!result) {\n result = addTypenameToDocument(document);\n this.typenameDocumentCache.set(document, result);\n // If someone calls transformDocument and then mistakenly passes the\n // result back into an API that also calls transformDocument, make sure\n // we don't keep creating new query documents.\n this.typenameDocumentCache.set(result, result);\n }\n return result;\n }\n return document;\n }\n\n protected broadcastWatches() {\n if (!this.silenceBroadcast) {\n this.watches.forEach(c => this.maybeBroadcastWatch(c));\n }\n }\n\n // This method is wrapped in the constructor so that it will be called only\n // if the data that would be broadcast has changed.\n private maybeBroadcastWatch(c: Cache.WatchOptions) {\n c.callback(\n this.diff({\n query: c.query,\n variables: c.variables,\n previousResult: c.previousResult && c.previousResult(),\n optimistic: c.optimistic,\n }),\n );\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.d.ts b/node_modules/apollo-cache-inmemory/lib/depTrackingCache.d.ts deleted file mode 100644 index 10aa0a68..00000000 --- a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types'; -export declare class DepTrackingCache implements NormalizedCache { - private data; - private depend; - constructor(data?: NormalizedCacheObject); - toObject(): NormalizedCacheObject; - get(dataId: string): StoreObject; - set(dataId: string, value?: StoreObject): void; - delete(dataId: string): void; - clear(): void; - replace(newData: NormalizedCacheObject | null): void; -} -export declare function defaultNormalizedCacheFactory(seed?: NormalizedCacheObject): NormalizedCache; -//# sourceMappingURL=depTrackingCache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/depTrackingCache.d.ts.map deleted file mode 100644 index 0a63627e..00000000 --- a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"depTrackingCache.d.ts","sourceRoot":"","sources":["src/depTrackingCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAK9E,qBAAa,gBAAiB,YAAW,eAAe;IAK1C,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,MAAM,CAA+D;gBAEzD,IAAI,GAAE,qBAA2C;IAS9D,QAAQ,IAAI,qBAAqB;IAIjC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IAKhC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW;IAQvC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAO5B,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,GAAG,IAAI;CAgB5D;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,CAAC,EAAE,qBAAqB,GAC3B,eAAe,CAEjB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.js b/node_modules/apollo-cache-inmemory/lib/depTrackingCache.js deleted file mode 100644 index c4441aa8..00000000 --- a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var optimism_1 = require("optimism"); -var hasOwn = Object.prototype.hasOwnProperty; -var DepTrackingCache = (function () { - function DepTrackingCache(data) { - var _this = this; - if (data === void 0) { data = Object.create(null); } - this.data = data; - this.depend = optimism_1.wrap(function (dataId) { return _this.data[dataId]; }, { - disposable: true, - makeCacheKey: function (dataId) { - return dataId; - }, - }); - } - DepTrackingCache.prototype.toObject = function () { - return this.data; - }; - DepTrackingCache.prototype.get = function (dataId) { - this.depend(dataId); - return this.data[dataId]; - }; - DepTrackingCache.prototype.set = function (dataId, value) { - var oldValue = this.data[dataId]; - if (value !== oldValue) { - this.data[dataId] = value; - this.depend.dirty(dataId); - } - }; - DepTrackingCache.prototype.delete = function (dataId) { - if (hasOwn.call(this.data, dataId)) { - delete this.data[dataId]; - this.depend.dirty(dataId); - } - }; - DepTrackingCache.prototype.clear = function () { - this.replace(null); - }; - DepTrackingCache.prototype.replace = function (newData) { - var _this = this; - if (newData) { - Object.keys(newData).forEach(function (dataId) { - _this.set(dataId, newData[dataId]); - }); - Object.keys(this.data).forEach(function (dataId) { - if (!hasOwn.call(newData, dataId)) { - _this.delete(dataId); - } - }); - } - else { - Object.keys(this.data).forEach(function (dataId) { - _this.delete(dataId); - }); - } - }; - return DepTrackingCache; -}()); -exports.DepTrackingCache = DepTrackingCache; -function defaultNormalizedCacheFactory(seed) { - return new DepTrackingCache(seed); -} -exports.defaultNormalizedCacheFactory = defaultNormalizedCacheFactory; -//# sourceMappingURL=depTrackingCache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.js.map b/node_modules/apollo-cache-inmemory/lib/depTrackingCache.js.map deleted file mode 100644 index 032dd214..00000000 --- a/node_modules/apollo-cache-inmemory/lib/depTrackingCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"depTrackingCache.js","sourceRoot":"","sources":["../src/depTrackingCache.ts"],"names":[],"mappings":";;AACA,qCAA2D;AAE3D,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AAE/C;IAKE,0BAAoB,IAAiD;QAArE,iBAOC;QAPmB,qBAAA,EAAA,OAA8B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAAjD,SAAI,GAAJ,IAAI,CAA6C;QACnE,IAAI,CAAC,MAAM,GAAG,eAAI,CAAC,UAAC,MAAc,IAAK,OAAA,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAjB,CAAiB,EAAE;YACxD,UAAU,EAAE,IAAI;YAChB,YAAY,EAAZ,UAAa,MAAc;gBACzB,OAAO,MAAM,CAAC;YAChB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,mCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAEM,8BAAG,GAAV,UAAW,MAAc;QACvB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAA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M,CAAC,MAAM,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AA1DD,IA0DC;AA1DY,4CAAgB;AA4D7B,SAAgB,6BAA6B,CAC3C,IAA4B;IAE5B,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAJD,sEAIC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.d.ts b/node_modules/apollo-cache-inmemory/lib/fixPolyfills.d.ts deleted file mode 100644 index 3dba080c..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=fixPolyfills.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.d.ts.map b/node_modules/apollo-cache-inmemory/lib/fixPolyfills.d.ts.map deleted file mode 100644 index 3a65eb41..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixPolyfills.d.ts","sourceRoot":"","sources":["src/fixPolyfills.ts"],"names":[],"mappings":"AAoDA,OAAO,EAAE,CAAA"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.js b/node_modules/apollo-cache-inmemory/lib/fixPolyfills.js deleted file mode 100644 index 4a686ea4..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var testMap = new Map(); -if (testMap.set(1, 2) !== testMap) { - var set_1 = testMap.set; - Map.prototype.set = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - set_1.apply(this, args); - return this; - }; -} -var testSet = new Set(); -if (testSet.add(3) !== testSet) { - var add_1 = testSet.add; - Set.prototype.add = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - add_1.apply(this, args); - return this; - }; -} -var frozen = {}; -if (typeof Object.freeze === 'function') { - Object.freeze(frozen); -} -try { - testMap.set(frozen, frozen).delete(frozen); -} -catch (_a) { - var wrap = function (method) { - return method && (function (obj) { - try { - testMap.set(obj, obj).delete(obj); - } - finally { - return method.call(Object, obj); - } - }); - }; - Object.freeze = wrap(Object.freeze); - Object.seal = wrap(Object.seal); - Object.preventExtensions = wrap(Object.preventExtensions); -} -//# sourceMappingURL=fixPolyfills.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.js.map b/node_modules/apollo-cache-inmemory/lib/fixPolyfills.js.map deleted file mode 100644 index b5c30353..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fixPolyfills.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fixPolyfills.js","sourceRoot":"","sources":["../src/fixPolyfills.ts"],"names":[],"mappings":";;AAEA,IAAM,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;AAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,EAAE;IACzB,IAAA,mBAAG,CAAa;IACxB,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG;QAAU,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACnC,KAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;CACH;AAGD,IAAM,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;AAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;IACtB,IAAA,mBAAG,CAAa;IACxB,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG;QAAU,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACnC,KAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;CACH;AAED,IAAM,MAAM,GAAG,EAAE,CAAC;AAClB,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;IACvC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,IAAI;IAOF,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CAC5C;AAAC,WAAM;IACN,IAAM,IAAI,GAAG,UAAC,MAAwB;QACpC,OAAO,MAAM,IAAI,CAAC,UAAA,GAAG;YACnB,IAAI;gBAEF,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aACnC;oBAAS;gBAGR,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;CAC3D"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.d.ts b/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.d.ts deleted file mode 100644 index 1b8ee5ac..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { IdValue } from 'apollo-utilities'; -import { ReadStoreContext, FragmentMatcherInterface, IntrospectionResultData } from './types'; -export declare class HeuristicFragmentMatcher implements FragmentMatcherInterface { - constructor(); - ensureReady(): Promise; - canBypassInit(): boolean; - match(idValue: IdValue, typeCondition: string, context: ReadStoreContext): boolean | 'heuristic'; -} -export declare class IntrospectionFragmentMatcher implements FragmentMatcherInterface { - private isReady; - private possibleTypesMap; - constructor(options?: { - introspectionQueryResultData?: IntrospectionResultData; - }); - match(idValue: IdValue, typeCondition: string, context: ReadStoreContext): boolean; - private parseIntrospectionResult; -} -//# sourceMappingURL=fragmentMatcher.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.d.ts.map b/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.d.ts.map deleted file mode 100644 index 40a4f020..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragmentMatcher.d.ts","sourceRoot":"","sources":["src/fragmentMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EAExB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAgBjB,qBAAa,wBAAyB,YAAW,wBAAwB;;IAKhE,WAAW;IAIX,aAAa;IAIb,KAAK,CACV,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,gBAAgB,GACxB,OAAO,GAAG,WAAW;CA6DzB;AAED,qBAAa,4BAA6B,YAAW,wBAAwB;IAC3E,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,CAAC,EAAE;QACpB,4BAA4B,CAAC,EAAE,uBAAuB,CAAC;KACxD;IAaM,KAAK,CACV,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,gBAAgB;IAwC3B,OAAO,CAAC,wBAAwB;CAajC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.js b/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.js deleted file mode 100644 index e3152caa..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var apollo_utilities_1 = require("apollo-utilities"); -var ts_invariant_1 = require("ts-invariant"); -var haveWarned = false; -function shouldWarn() { - var answer = !haveWarned; - if (!apollo_utilities_1.isTest()) { - haveWarned = true; - } - return answer; -} -var HeuristicFragmentMatcher = (function () { - function HeuristicFragmentMatcher() { - } - HeuristicFragmentMatcher.prototype.ensureReady = function () { - return Promise.resolve(); - }; - HeuristicFragmentMatcher.prototype.canBypassInit = function () { - return true; - }; - HeuristicFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - if (!obj) { - return isRootQuery; - } - var _a = obj.__typename, __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - if (!__typename) { - if (shouldWarn()) { - ts_invariant_1.invariant.warn("You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments."); - ts_invariant_1.invariant.warn('Could not find __typename on Fragment ', typeCondition, obj); - ts_invariant_1.invariant.warn("DEPRECATION WARNING: using fragments without __typename is unsupported behavior " + - "and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now."); - } - return 'heuristic'; - } - if (__typename === typeCondition) { - return true; - } - if (shouldWarn()) { - ts_invariant_1.invariant.error('You are using the simple (heuristic) fragment matcher, but your ' + - 'queries contain union or interface types. Apollo Client will not be ' + - 'able to accurately map fragments. To make this error go away, use ' + - 'the `IntrospectionFragmentMatcher` as described in the docs: ' + - 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher'); - } - return 'heuristic'; - }; - return HeuristicFragmentMatcher; -}()); -exports.HeuristicFragmentMatcher = HeuristicFragmentMatcher; -var IntrospectionFragmentMatcher = (function () { - function IntrospectionFragmentMatcher(options) { - if (options && options.introspectionQueryResultData) { - this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData); - this.isReady = true; - } - else { - this.isReady = false; - } - this.match = this.match.bind(this); - } - IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { - ts_invariant_1.invariant(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()'); - var obj = context.store.get(idValue.id); - var isRootQuery = idValue.id === 'ROOT_QUERY'; - if (!obj) { - return isRootQuery; - } - var _a = obj.__typename, __typename = _a === void 0 ? isRootQuery && 'Query' : _a; - ts_invariant_1.invariant(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj)); - if (__typename === typeCondition) { - return true; - } - var implementingTypes = this.possibleTypesMap[typeCondition]; - if (__typename && - implementingTypes && - implementingTypes.indexOf(__typename) > -1) { - return true; - } - return false; - }; - IntrospectionFragmentMatcher.prototype.parseIntrospectionResult = function (introspectionResultData) { - var typeMap = {}; - introspectionResultData.__schema.types.forEach(function (type) { - if (type.kind === 'UNION' || type.kind === 'INTERFACE') { - typeMap[type.name] = type.possibleTypes.map(function (implementingType) { return implementingType.name; }); - } - }); - return typeMap; - }; - return IntrospectionFragmentMatcher; -}()); -exports.IntrospectionFragmentMatcher = IntrospectionFragmentMatcher; -//# sourceMappingURL=fragmentMatcher.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.js.map b/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.js.map deleted file mode 100644 index f6e4c0bd..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcher.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragmentMatcher.js","sourceRoot":"","sources":["../src/fragmentMatcher.ts"],"names":[],"mappings":";;AAAA,qDAAmD;AACnD,6CAAyC;AASzC,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,SAAS,UAAU;IACjB,IAAM,MAA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,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE;gBACtD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CACzC,UAAA,gBAAgB,IAAI,OAAA,gBAAgB,CAAC,IAAI,EAArB,CAAqB,CAC1C,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,mCAAC;AAAD,CAAC,AA3ED,IA2EC;AA3EY,oEAA4B"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.d.ts b/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.d.ts deleted file mode 100644 index 4946cffb..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const query: any; -export default query; -//# sourceMappingURL=fragmentMatcherIntrospectionQuery.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.d.ts.map b/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.d.ts.map deleted file mode 100644 index 58ba5cdb..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragmentMatcherIntrospectionQuery.d.ts","sourceRoot":"","sources":["src/fragmentMatcherIntrospectionQuery.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,EAAE,GA8FZ,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.js b/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.js deleted file mode 100644 index c591b414..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var query = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__schema', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: 'types', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: 'kind', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: 'name', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: 'possibleTypes', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: 'name', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - ], -}; -exports.default = query; -//# sourceMappingURL=fragmentMatcherIntrospectionQuery.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.js.map b/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.js.map deleted file mode 100644 index d64dd3a1..00000000 --- a/node_modules/apollo-cache-inmemory/lib/fragmentMatcherIntrospectionQuery.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragmentMatcherIntrospectionQuery.js","sourceRoot":"","sources":["../src/fragmentMatcherIntrospectionQuery.ts"],"names":[],"mappings":";;AAAA,IAAM,KAAK,GAAQ;IACjB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE;QACX;YACE,IAAI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UAAU,EAAE,EAAE;gDACd,YAAY,EAAE;oDACZ,IAAI,EAAE,cAAc;oDACpB,UAAU,EAAE;wDACV;4DACE,IAAI,EAAE,OAAO;4DACb,KAAK,EAAE,IAAI;4DACX,IAAI,EAAE;gEACJ,IAAI,EAAE,MAAM;gEACZ,KAAK,EAAE,MAAM;6DACd;4DACD,SAAS,EAAE,EAAE;4DACb,UAAU,EAAE,EAAE;4DACd,YAAY,EAAE,IAAI;yDACnB;qDACF;iDACF;6CACF;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEF,kBAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts b/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts deleted file mode 100644 index 5c7f743e..00000000 --- a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import './fixPolyfills'; -import { DocumentNode } from 'graphql'; -import { Cache, ApolloCache, Transaction } from 'apollo-cache'; -import { ApolloReducerConfig, NormalizedCache, NormalizedCacheObject } from './types'; -import { ObjectCache } from './objectCache'; -export interface InMemoryCacheConfig extends ApolloReducerConfig { - resultCaching?: boolean; - freezeResults?: boolean; -} -export declare function defaultDataIdFromObject(result: any): string | null; -export declare class OptimisticCacheLayer extends ObjectCache { - readonly optimisticId: string; - readonly parent: NormalizedCache; - readonly transaction: Transaction; - constructor(optimisticId: string, parent: NormalizedCache, transaction: Transaction); - toObject(): NormalizedCacheObject; - get(dataId: string): import("./types").StoreObject; -} -export declare class InMemoryCache extends ApolloCache { - private data; - private optimisticData; - protected config: InMemoryCacheConfig; - private watches; - private addTypename; - private typenameDocumentCache; - private storeReader; - private storeWriter; - private cacheKeyRoot; - private silenceBroadcast; - constructor(config?: InMemoryCacheConfig); - restore(data: NormalizedCacheObject): this; - extract(optimistic?: boolean): NormalizedCacheObject; - read(options: Cache.ReadOptions): T | null; - write(write: Cache.WriteOptions): void; - diff(query: Cache.DiffOptions): Cache.DiffResult; - watch(watch: Cache.WatchOptions): () => void; - evict(query: Cache.EvictOptions): Cache.EvictionResult; - reset(): Promise; - removeOptimistic(idToRemove: string): void; - performTransaction(transaction: Transaction, optimisticId?: string): void; - recordOptimisticTransaction(transaction: Transaction, id: string): void; - transformDocument(document: DocumentNode): DocumentNode; - protected broadcastWatches(): void; - private maybeBroadcastWatch; -} -//# sourceMappingURL=inMemoryCache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts.map deleted file mode 100644 index 13bbabe3..00000000 --- a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"inMemoryCache.d.ts","sourceRoot":"","sources":["src/inMemoryCache.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAS/D,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAUD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAUlE;AAID,qBAAa,oBAAqB,SAAQ,WAAW;aAEjC,YAAY,EAAE,MAAM;aAGpB,MAAM,EAAE,eAAe;aACvB,WAAW,EAAE,WAAW,CAAC,qBAAqB,CAAC;gBAJ/C,YAAY,EAAE,MAAM,EAGpB,MAAM,EA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,WAAW,EAAE,WAAW,CAAC,qBAAqB,CAAC,EAC/C,EAAE,EAAE,MAAM;IAKL,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY;IAgB9D,SAAS,CAAC,gBAAgB;IAQ1B,OAAO,CAAC,mBAAmB;CAU5B"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.js b/node_modules/apollo-cache-inmemory/lib/inMemoryCache.js deleted file mode 100644 index 06bf62d7..00000000 --- a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.js +++ /dev/null @@ -1,239 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -require("./fixPolyfills"); -var apollo_cache_1 = require("apollo-cache"); -var apollo_utilities_1 = require("apollo-utilities"); -var optimism_1 = require("optimism"); -var ts_invariant_1 = require("ts-invariant"); -var fragmentMatcher_1 = require("./fragmentMatcher"); -var readFromStore_1 = require("./readFromStore"); -var writeToStore_1 = require("./writeToStore"); -var depTrackingCache_1 = require("./depTrackingCache"); -var optimism_2 = require("optimism"); -var objectCache_1 = require("./objectCache"); -var defaultConfig = { - fragmentMatcher: new fragmentMatcher_1.HeuristicFragmentMatcher(), - dataIdFromObject: defaultDataIdFromObject, - addTypename: true, - resultCaching: true, - freezeResults: false, -}; -function defaultDataIdFromObject(result) { - if (result.__typename) { - if (result.id !== undefined) { - return result.__typename + ":" + result.id; - } - if (result._id !== undefined) { - return result.__typename + ":" + result._id; - } - } - return null; -} -exports.defaultDataIdFromObject = defaultDataIdFromObject; -var hasOwn = Object.prototype.hasOwnProperty; -var OptimisticCacheLayer = (function (_super) { - tslib_1.__extends(OptimisticCacheLayer, _super); - function OptimisticCacheLayer(optimisticId, parent, transaction) { - var _this = _super.call(this, Object.create(null)) || this; - _this.optimisticId = optimisticId; - _this.parent = parent; - _this.transaction = transaction; - return _this; - } - OptimisticCacheLayer.prototype.toObject = function () { - return tslib_1.__assign(tslib_1.__assign({}, this.parent.toObject()), this.data); - }; - OptimisticCacheLayer.prototype.get = function (dataId) { - return hasOwn.call(this.data, dataId) - ? this.data[dataId] - : this.parent.get(dataId); - }; - return OptimisticCacheLayer; -}(objectCache_1.ObjectCache)); -exports.OptimisticCacheLayer = OptimisticCacheLayer; -var InMemoryCache = (function (_super) { - tslib_1.__extends(InMemoryCache, _super); - function InMemoryCache(config) { - if (config === void 0) { config = {}; } - var _this = _super.call(this) || this; - _this.watches = new Set(); - _this.typenameDocumentCache = new Map(); - _this.cacheKeyRoot = new optimism_2.KeyTrie(apollo_utilities_1.canUseWeakMap); - _this.silenceBroadcast = false; - _this.config = tslib_1.__assign(tslib_1.__assign({}, defaultConfig), config); - if (_this.config.customResolvers) { - ts_invariant_1.invariant.warn('customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.customResolvers; - } - if (_this.config.cacheResolvers) { - ts_invariant_1.invariant.warn('cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.'); - _this.config.cacheRedirects = _this.config.cacheResolvers; - } - _this.addTypename = !!_this.config.addTypename; - _this.data = _this.config.resultCaching - ? new depTrackingCache_1.DepTrackingCache() - : new objectCache_1.ObjectCache(); - _this.optimisticData = _this.data; - _this.storeWriter = new writeToStore_1.StoreWriter(); - _this.storeReader = new readFromStore_1.StoreReader({ - cacheKeyRoot: _this.cacheKeyRoot, - freezeResults: config.freezeResults, - }); - var cache = _this; - var maybeBroadcastWatch = cache.maybeBroadcastWatch; - _this.maybeBroadcastWatch = optimism_1.wrap(function (c) { - return maybeBroadcastWatch.call(_this, c); - }, { - makeCacheKey: function (c) { - if (c.optimistic) { - return; - } - if (c.previousResult) { - return; - } - if (cache.data instanceof depTrackingCache_1.DepTrackingCache) { - return cache.cacheKeyRoot.lookup(c.query, JSON.stringify(c.variables)); - } - } - }); - return _this; - } - InMemoryCache.prototype.restore = function (data) { - if (data) - this.data.replace(data); - return this; - }; - InMemoryCache.prototype.extract = function (optimistic) { - if (optimistic === void 0) { optimistic = false; } - return (optimistic ? this.optimisticData : this.data).toObject(); - }; - InMemoryCache.prototype.read = function (options) { - if (typeof options.rootId === 'string' && - typeof this.data.get(options.rootId) === 'undefined') { - return null; - } - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.readQueryFromStore({ - store: options.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(options.query), - variables: options.variables, - rootId: options.rootId, - fragmentMatcherFunction: fragmentMatcherFunction, - previousResult: options.previousResult, - config: this.config, - }) || null; - }; - InMemoryCache.prototype.write = function (write) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - this.storeWriter.writeResultToStore({ - dataId: write.dataId, - result: write.result, - variables: write.variables, - document: this.transformDocument(write.query), - store: this.data, - dataIdFromObject: this.config.dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - this.broadcastWatches(); - }; - InMemoryCache.prototype.diff = function (query) { - var fragmentMatcher = this.config.fragmentMatcher; - var fragmentMatcherFunction = fragmentMatcher && fragmentMatcher.match; - return this.storeReader.diffQueryAgainstStore({ - store: query.optimistic ? this.optimisticData : this.data, - query: this.transformDocument(query.query), - variables: query.variables, - returnPartialData: query.returnPartialData, - previousResult: query.previousResult, - fragmentMatcherFunction: fragmentMatcherFunction, - config: this.config, - }); - }; - InMemoryCache.prototype.watch = function (watch) { - var _this = this; - this.watches.add(watch); - return function () { - _this.watches.delete(watch); - }; - }; - InMemoryCache.prototype.evict = function (query) { - throw new ts_invariant_1.InvariantError("eviction is not implemented on InMemory Cache"); - }; - InMemoryCache.prototype.reset = function () { - this.data.clear(); - this.broadcastWatches(); - return Promise.resolve(); - }; - InMemoryCache.prototype.removeOptimistic = function (idToRemove) { - var toReapply = []; - var removedCount = 0; - var layer = this.optimisticData; - while (layer instanceof OptimisticCacheLayer) { - if (layer.optimisticId === idToRemove) { - ++removedCount; - } - else { - toReapply.push(layer); - } - layer = layer.parent; - } - if (removedCount > 0) { - this.optimisticData = layer; - while (toReapply.length > 0) { - var layer_1 = toReapply.pop(); - this.performTransaction(layer_1.transaction, layer_1.optimisticId); - } - this.broadcastWatches(); - } - }; - InMemoryCache.prototype.performTransaction = function (transaction, optimisticId) { - var _a = this, data = _a.data, silenceBroadcast = _a.silenceBroadcast; - this.silenceBroadcast = true; - if (typeof optimisticId === 'string') { - this.data = this.optimisticData = new OptimisticCacheLayer(optimisticId, this.optimisticData, transaction); - } - try { - transaction(this); - } - finally { - this.silenceBroadcast = silenceBroadcast; - this.data = data; - } - this.broadcastWatches(); - }; - InMemoryCache.prototype.recordOptimisticTransaction = function (transaction, id) { - return this.performTransaction(transaction, id); - }; - InMemoryCache.prototype.transformDocument = function (document) { - if (this.addTypename) { - var result = this.typenameDocumentCache.get(document); - if (!result) { - result = apollo_utilities_1.addTypenameToDocument(document); - this.typenameDocumentCache.set(document, result); - this.typenameDocumentCache.set(result, result); - } - return result; - } - return document; - }; - InMemoryCache.prototype.broadcastWatches = function () { - var _this = this; - if (!this.silenceBroadcast) { - this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c); }); - } - }; - InMemoryCache.prototype.maybeBroadcastWatch = function (c) { - c.callback(this.diff({ - query: c.query, - variables: c.variables, - previousResult: c.previousResult && c.previousResult(), - optimistic: c.optimistic, - })); - }; - return InMemoryCache; -}(apollo_cache_1.ApolloCache)); -exports.InMemoryCache = InMemoryCache; -//# sourceMappingURL=inMemoryCache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.js.map b/node_modules/apollo-cache-inmemory/lib/inMemoryCache.js.map deleted file mode 100644 index 5463f8ab..00000000 --- a/node_modules/apollo-cache-inmemory/lib/inMemoryCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"inMemoryCache.js","sourceRoot":"","sources":["../src/inMemoryCache.ts"],"names":[],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AAI,CAAC,MAAM,EAAE;gBACX,MAAM,GAAG,wCAAqB,CAAC,QAAQ,CAAC,CAAC;gBACzC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAIjD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aAChD;YACD,OAAO,MAAM,CAAC;SACf;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAES,wCAAgB,GAA1B;QAAA,iBAIC;QAHC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAA3B,CAA2B,CAAC,CAAC;SACxD;IACH,CAAC;IAIO,2CAAmB,GAA3B,UAA4B,CAAqB;QAC/C,CAAC,CAAC,QAAQ,CACR,IAAI,CAAC,IAAI,CAAC;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,cAAc,EAAE,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,cAAc,EAAE;YACtD,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IACH,oBAAC;AAAD,CAAC,AAjRD,CAAmC,0BAAW,GAiR7C;AAjRY,sCAAa"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/index.d.ts b/node_modules/apollo-cache-inmemory/lib/index.d.ts deleted file mode 100644 index dbc18441..00000000 --- a/node_modules/apollo-cache-inmemory/lib/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { InMemoryCache, InMemoryCacheConfig, defaultDataIdFromObject, } from './inMemoryCache'; -export * from './readFromStore'; -export * from './writeToStore'; -export * from './fragmentMatcher'; -export * from './objectCache'; -export * from './types'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/index.d.ts.map b/node_modules/apollo-cache-inmemory/lib/index.d.ts.map deleted file mode 100644 index 111c29e6..00000000 --- a/node_modules/apollo-cache-inmemory/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/index.js b/node_modules/apollo-cache-inmemory/lib/index.js deleted file mode 100644 index a4343949..00000000 --- a/node_modules/apollo-cache-inmemory/lib/index.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var inMemoryCache_1 = require("./inMemoryCache"); -exports.InMemoryCache = inMemoryCache_1.InMemoryCache; -exports.defaultDataIdFromObject = inMemoryCache_1.defaultDataIdFromObject; -tslib_1.__exportStar(require("./readFromStore"), exports); -tslib_1.__exportStar(require("./writeToStore"), exports); -tslib_1.__exportStar(require("./fragmentMatcher"), exports); -tslib_1.__exportStar(require("./objectCache"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/index.js.map b/node_modules/apollo-cache-inmemory/lib/index.js.map deleted file mode 100644 index 96285b26..00000000 --- a/node_modules/apollo-cache-inmemory/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAIyB;AAHvB,wCAAA,aAAa,CAAA;AAEb,kDAAA,uBAAuB,CAAA;AAGzB,0DAAgC;AAChC,yDAA+B;AAC/B,4DAAkC;AAClC,wDAA8B"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/mapCache.d.ts b/node_modules/apollo-cache-inmemory/lib/mapCache.d.ts deleted file mode 100644 index cc9b7aad..00000000 --- a/node_modules/apollo-cache-inmemory/lib/mapCache.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types'; -export declare class MapCache implements NormalizedCache { - private cache; - constructor(data?: NormalizedCacheObject); - get(dataId: string): StoreObject; - set(dataId: string, value: StoreObject): void; - delete(dataId: string): void; - clear(): void; - toObject(): NormalizedCacheObject; - replace(newData: NormalizedCacheObject): void; -} -export declare function mapNormalizedCacheFactory(seed?: NormalizedCacheObject): NormalizedCache; -//# sourceMappingURL=mapCache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/mapCache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/mapCache.d.ts.map deleted file mode 100644 index 26b61705..00000000 --- a/node_modules/apollo-cache-inmemory/lib/mapCache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mapCache.d.ts","sourceRoot":"","sources":["src/mapCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM9E,qBAAa,QAAS,YAAW,eAAe;IAC9C,OAAO,CAAC,KAAK,CAAuC;gBAExC,IAAI,GAAE,qBAA0B;IAIrC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IAIhC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;IAI7C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI5B,KAAK,IAAI,IAAI;IAIb,QAAQ,IAAI,qBAAqB;IAQjC,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;CAMrD;AAED,wBAAgB,yBAAyB,CACvC,IAAI,CAAC,EAAE,qBAAqB,GAC3B,eAAe,CAEjB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/mapCache.js b/node_modules/apollo-cache-inmemory/lib/mapCache.js deleted file mode 100644 index f3f870e2..00000000 --- a/node_modules/apollo-cache-inmemory/lib/mapCache.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var MapCache = (function () { - function MapCache(data) { - if (data === void 0) { data = {}; } - this.cache = new Map(Object.entries(data)); - } - MapCache.prototype.get = function (dataId) { - return this.cache.get("" + dataId); - }; - MapCache.prototype.set = function (dataId, value) { - this.cache.set("" + dataId, value); - }; - MapCache.prototype.delete = function (dataId) { - this.cache.delete("" + dataId); - }; - MapCache.prototype.clear = function () { - return this.cache.clear(); - }; - MapCache.prototype.toObject = function () { - var obj = {}; - this.cache.forEach(function (dataId, key) { - obj[key] = dataId; - }); - return obj; - }; - MapCache.prototype.replace = function (newData) { - var _this = this; - this.cache.clear(); - Object.entries(newData).forEach(function (_a) { - var dataId = _a[0], value = _a[1]; - return _this.cache.set(dataId, value); - }); - }; - return MapCache; -}()); -exports.MapCache = MapCache; -function mapNormalizedCacheFactory(seed) { - return new MapCache(seed); -} -exports.mapNormalizedCacheFactory = mapNormalizedCacheFactory; -//# sourceMappingURL=mapCache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/mapCache.js.map b/node_modules/apollo-cache-inmemory/lib/mapCache.js.map deleted file mode 100644 index 7bc739f9..00000000 --- a/node_modules/apollo-cache-inmemory/lib/mapCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mapCache.js","sourceRoot":"","sources":["../src/mapCache.ts"],"names":[],"mappings":";;AAMA;IAGE,kBAAY,IAAgC;QAAhC,qBAAA,EAAA,SAAgC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAA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_modules/apollo-cache-inmemory/lib/objectCache.d.ts deleted file mode 100644 index a3bb8f59..00000000 --- a/node_modules/apollo-cache-inmemory/lib/objectCache.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types'; -export declare class ObjectCache implements NormalizedCache { - protected data: NormalizedCacheObject; - constructor(data?: NormalizedCacheObject); - toObject(): NormalizedCacheObject; - get(dataId: string): StoreObject; - set(dataId: string, value: StoreObject): void; - delete(dataId: string): void; - clear(): void; - replace(newData: NormalizedCacheObject): void; -} -export declare function defaultNormalizedCacheFactory(seed?: NormalizedCacheObject): NormalizedCache; -//# sourceMappingURL=objectCache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/objectCache.d.ts.map b/node_modules/apollo-cache-inmemory/lib/objectCache.d.ts.map deleted file mode 100644 index 5219ce75..00000000 --- a/node_modules/apollo-cache-inmemory/lib/objectCache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"objectCache.d.ts","sourceRoot":"","sources":["src/objectCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE9E,qBAAa,WAAY,YAAW,eAAe;IACrC,SAAS,CAAC,IAAI,EAAE,qBAAqB;gBAA3B,IAAI,GAAE,qBAA2C;IAEhE,QAAQ;IAIR,GAAG,CAAC,MAAM,EAAE,MAAM;IAIlB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAItC,MAAM,CAAC,MAAM,EAAE,MAAM;IAIrB,KAAK;IAIL,OAAO,CAAC,OAAO,EAAE,qBAAqB;CAG9C;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,CAAC,EAAE,qBAAqB,GAC3B,eAAe,CAEjB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/objectCache.js b/node_modules/apollo-cache-inmemory/lib/objectCache.js deleted file mode 100644 index f55bac8d..00000000 --- a/node_modules/apollo-cache-inmemory/lib/objectCache.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var ObjectCache = (function () { - function ObjectCache(data) { - if (data === void 0) { data = Object.create(null); } - this.data = data; - } - ObjectCache.prototype.toObject = function () { - return this.data; - }; - ObjectCache.prototype.get = function (dataId) { - return this.data[dataId]; - }; - ObjectCache.prototype.set = function (dataId, value) { - this.data[dataId] = value; - }; - ObjectCache.prototype.delete = function (dataId) { - this.data[dataId] = void 0; - }; - ObjectCache.prototype.clear = function () { - this.data = Object.create(null); - }; - ObjectCache.prototype.replace = function (newData) { - this.data = newData || Object.create(null); - }; - return ObjectCache; -}()); -exports.ObjectCache = ObjectCache; -function defaultNormalizedCacheFactory(seed) { - return new ObjectCache(seed); -} -exports.defaultNormalizedCacheFactory = defaultNormalizedCacheFactory; -//# sourceMappingURL=objectCache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/objectCache.js.map b/node_modules/apollo-cache-inmemory/lib/objectCache.js.map deleted file mode 100644 index a42e368a..00000000 --- a/node_modules/apollo-cache-inmemory/lib/objectCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"objectCache.js","sourceRoot":"","sources":["../src/objectCache.ts"],"names":[],"mappings":";;AAEA;IACE,qBAAsB,IAAiD;QAAjD,qBAAA,EAAA,OAA8B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAAjD,SAAI,GAAJ,IAAI,CAA6C;IAAG,CAAC;IAEpE,8BAAQ,GAAf;QACE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAEM,yBAAG,GAAV,UAAW,MAAc;QACvB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAE,CAAC;IAC5B,CAAC;IAEM,yBAAG,GAAV,UAAW,MAAc,EAAE,KAAkB;QAC3C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IAC5B,CAAC;IAEM,4BAAM,GAAb,UAAc,MAAc;QAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,2BAAK,GAAZ;QACE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAEM,6BAAO,GAAd,UAAe,OAA8B;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IACH,kBAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,kCAAW;AA4BxB,SAAgB,6BAA6B,CAC3C,IAA4B;IAE5B,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAJD,sEAIC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/readFromStore.d.ts b/node_modules/apollo-cache-inmemory/lib/readFromStore.d.ts deleted file mode 100644 index 2cd75b9c..00000000 --- a/node_modules/apollo-cache-inmemory/lib/readFromStore.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { IdValue } from 'apollo-utilities'; -import { Cache } from 'apollo-cache'; -import { ReadStoreContext, DiffQueryAgainstStoreOptions, ReadQueryOptions, StoreObject } from './types'; -import { KeyTrie } from 'optimism'; -export declare type VariableMap = { - [name: string]: any; -}; -export declare type FragmentMatcher = (rootValue: any, typeCondition: string, context: ReadStoreContext) => boolean | 'heuristic'; -export declare type ExecResultMissingField = { - object: StoreObject; - fieldName: string; - tolerable: boolean; -}; -export declare type ExecResult = { - result: R; - missing?: ExecResultMissingField[]; -}; -export interface StoreReaderConfig { - cacheKeyRoot?: KeyTrie; - freezeResults?: boolean; -} -export declare class StoreReader { - private freezeResults; - constructor({ cacheKeyRoot, freezeResults, }?: StoreReaderConfig); - readQueryFromStore(options: ReadQueryOptions): QueryType | undefined; - diffQueryAgainstStore({ store, query, variables, previousResult, returnPartialData, rootId, fragmentMatcherFunction, config, }: DiffQueryAgainstStoreOptions): Cache.DiffResult; - private executeStoreQuery; - private executeSelectionSet; - private executeField; - private combineExecResults; - private executeSubSelectedArray; -} -export declare function assertIdValue(idValue: IdValue): void; -//# sourceMappingURL=readFromStore.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/readFromStore.d.ts.map b/node_modules/apollo-cache-inmemory/lib/readFromStore.d.ts.map deleted file mode 100644 index d5e70031..00000000 --- a/node_modules/apollo-cache-inmemory/lib/readFromStore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"readFromStore.d.ts","sourceRoot":"","sources":["src/readFromStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAaL,OAAO,EAYR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,gBAAgB,EAChB,WAAW,EACZ,MAAM,SAAS,CAAC;AAUjB,OAAO,EAAQ,OAAO,EAAE,MAAM,UAAU,CAAC;AAIzC,oBAAY,WAAW,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC;AAElD,oBAAY,eAAe,GAAG,CAC5B,SAAS,EAAE,GAAG,EACd,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,gBAAgB,KACtB,OAAO,GAAG,WAAW,CAAC;AAe3B,oBAAY,sBAAsB,GAAG;IACnC,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,oBAAY,UAAU,CAAC,CAAC,GAAG,GAAG,IAAI;IAChC,MAAM,EAAE,CAAC,CAAC;IAEV,OAAO,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACpC,CAAC;AAuBF,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,aAAa,CAAU;gBAEnB,EACV,YAAiD,EACjD,aAAqB,GACtB,GAAE,iBAAsB;IAqFlB,kBAAkB,CAAC,SAAS,EACjC,OAAO,EAAE,gBAAgB,GACxB,SAAS,GAAG,SAAS;IAejB,qBAAqB,CAAC,CAAC,EAAE,EAC9B,KAAK,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,iBAAwB,EACxB,MAAqB,EACrB,uBAAuB,EACvB,MAAM,GACP,EAAE,4BAA4B,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAwErD,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,mBAAmB;IA+F3B,OAAO,CAAC,YAAY;IA8DpB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,uBAAuB;CAmDhC;AAmBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,QAK7C"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/readFromStore.js b/node_modules/apollo-cache-inmemory/lib/readFromStore.js deleted file mode 100644 index da669e84..00000000 --- a/node_modules/apollo-cache-inmemory/lib/readFromStore.js +++ /dev/null @@ -1,318 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var apollo_utilities_1 = require("apollo-utilities"); -var optimism_1 = require("optimism"); -var depTrackingCache_1 = require("./depTrackingCache"); -var ts_invariant_1 = require("ts-invariant"); -var StoreReader = (function () { - function StoreReader(_a) { - var _this = this; - var _b = _a === void 0 ? {} : _a, _c = _b.cacheKeyRoot, cacheKeyRoot = _c === void 0 ? new optimism_1.KeyTrie(apollo_utilities_1.canUseWeakMap) : _c, _d = _b.freezeResults, freezeResults = _d === void 0 ? false : _d; - var _e = this, executeStoreQuery = _e.executeStoreQuery, executeSelectionSet = _e.executeSelectionSet, executeSubSelectedArray = _e.executeSubSelectedArray; - this.freezeResults = freezeResults; - this.executeStoreQuery = optimism_1.wrap(function (options) { - return executeStoreQuery.call(_this, options); - }, { - makeCacheKey: function (_a) { - var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, fragmentMatcher = _a.fragmentMatcher; - if (contextValue.store instanceof depTrackingCache_1.DepTrackingCache) { - return cacheKeyRoot.lookup(contextValue.store, query, fragmentMatcher, JSON.stringify(variableValues), rootValue.id); - } - } - }); - this.executeSelectionSet = optimism_1.wrap(function (options) { - return executeSelectionSet.call(_this, options); - }, { - makeCacheKey: function (_a) { - var selectionSet = _a.selectionSet, rootValue = _a.rootValue, execContext = _a.execContext; - if (execContext.contextValue.store instanceof depTrackingCache_1.DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, selectionSet, execContext.fragmentMatcher, JSON.stringify(execContext.variableValues), rootValue.id); - } - } - }); - this.executeSubSelectedArray = optimism_1.wrap(function (options) { - return executeSubSelectedArray.call(_this, options); - }, { - makeCacheKey: function (_a) { - var field = _a.field, array = _a.array, execContext = _a.execContext; - if (execContext.contextValue.store instanceof depTrackingCache_1.DepTrackingCache) { - return cacheKeyRoot.lookup(execContext.contextValue.store, field, array, JSON.stringify(execContext.variableValues)); - } - } - }); - } - StoreReader.prototype.readQueryFromStore = function (options) { - return this.diffQueryAgainstStore(tslib_1.__assign(tslib_1.__assign({}, options), { returnPartialData: false })).result; - }; - StoreReader.prototype.diffQueryAgainstStore = function (_a) { - var store = _a.store, query = _a.query, variables = _a.variables, previousResult = _a.previousResult, _b = _a.returnPartialData, returnPartialData = _b === void 0 ? true : _b, _c = _a.rootId, rootId = _c === void 0 ? 'ROOT_QUERY' : _c, fragmentMatcherFunction = _a.fragmentMatcherFunction, config = _a.config; - var queryDefinition = apollo_utilities_1.getQueryDefinition(query); - variables = apollo_utilities_1.assign({}, apollo_utilities_1.getDefaultValues(queryDefinition), variables); - var context = { - store: store, - dataIdFromObject: config && config.dataIdFromObject, - cacheRedirects: (config && config.cacheRedirects) || {}, - }; - var execResult = this.executeStoreQuery({ - query: query, - rootValue: { - type: 'id', - id: rootId, - generated: true, - typename: 'Query', - }, - contextValue: context, - variableValues: variables, - fragmentMatcher: fragmentMatcherFunction, - }); - var hasMissingFields = execResult.missing && execResult.missing.length > 0; - if (hasMissingFields && !returnPartialData) { - execResult.missing.forEach(function (info) { - if (info.tolerable) - return; - throw new ts_invariant_1.InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); - }); - } - if (previousResult) { - if (apollo_utilities_1.isEqual(previousResult, execResult.result)) { - execResult.result = previousResult; - } - } - return { - result: execResult.result, - complete: !hasMissingFields, - }; - }; - StoreReader.prototype.executeStoreQuery = function (_a) { - var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, _b = _a.fragmentMatcher, fragmentMatcher = _b === void 0 ? defaultFragmentMatcher : _b; - var mainDefinition = apollo_utilities_1.getMainDefinition(query); - var fragments = apollo_utilities_1.getFragmentDefinitions(query); - var fragmentMap = apollo_utilities_1.createFragmentMap(fragments); - var execContext = { - query: query, - fragmentMap: fragmentMap, - contextValue: contextValue, - variableValues: variableValues, - fragmentMatcher: fragmentMatcher, - }; - return this.executeSelectionSet({ - selectionSet: mainDefinition.selectionSet, - rootValue: rootValue, - execContext: execContext, - }); - }; - StoreReader.prototype.executeSelectionSet = function (_a) { - var _this = this; - var selectionSet = _a.selectionSet, rootValue = _a.rootValue, execContext = _a.execContext; - var fragmentMap = execContext.fragmentMap, contextValue = execContext.contextValue, variables = execContext.variableValues; - var finalResult = { result: null }; - var objectsToMerge = []; - var object = contextValue.store.get(rootValue.id); - var typename = (object && object.__typename) || - (rootValue.id === 'ROOT_QUERY' && 'Query') || - void 0; - function handleMissing(result) { - var _a; - if (result.missing) { - finalResult.missing = finalResult.missing || []; - (_a = finalResult.missing).push.apply(_a, result.missing); - } - return result.result; - } - selectionSet.selections.forEach(function (selection) { - var _a; - if (!apollo_utilities_1.shouldInclude(selection, variables)) { - return; - } - if (apollo_utilities_1.isField(selection)) { - var fieldResult = handleMissing(_this.executeField(object, typename, selection, execContext)); - if (typeof fieldResult !== 'undefined') { - objectsToMerge.push((_a = {}, - _a[apollo_utilities_1.resultKeyNameFromField(selection)] = fieldResult, - _a)); - } - } - else { - var fragment = void 0; - if (apollo_utilities_1.isInlineFragment(selection)) { - fragment = selection; - } - else { - fragment = fragmentMap[selection.name.value]; - if (!fragment) { - throw new ts_invariant_1.InvariantError("No fragment named " + selection.name.value); - } - } - var typeCondition = fragment.typeCondition && fragment.typeCondition.name.value; - var match = !typeCondition || - execContext.fragmentMatcher(rootValue, typeCondition, contextValue); - if (match) { - var fragmentExecResult = _this.executeSelectionSet({ - selectionSet: fragment.selectionSet, - rootValue: rootValue, - execContext: execContext, - }); - if (match === 'heuristic' && fragmentExecResult.missing) { - fragmentExecResult = tslib_1.__assign(tslib_1.__assign({}, fragmentExecResult), { missing: fragmentExecResult.missing.map(function (info) { - return tslib_1.__assign(tslib_1.__assign({}, info), { tolerable: true }); - }) }); - } - objectsToMerge.push(handleMissing(fragmentExecResult)); - } - } - }); - finalResult.result = apollo_utilities_1.mergeDeepArray(objectsToMerge); - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(finalResult.result); - } - return finalResult; - }; - StoreReader.prototype.executeField = function (object, typename, field, execContext) { - var variables = execContext.variableValues, contextValue = execContext.contextValue; - var fieldName = field.name.value; - var args = apollo_utilities_1.argumentsObjectFromField(field, variables); - var info = { - resultKey: apollo_utilities_1.resultKeyNameFromField(field), - directives: apollo_utilities_1.getDirectiveInfoFromField(field, variables), - }; - var readStoreResult = readStoreResolver(object, typename, fieldName, args, contextValue, info); - if (Array.isArray(readStoreResult.result)) { - return this.combineExecResults(readStoreResult, this.executeSubSelectedArray({ - field: field, - array: readStoreResult.result, - execContext: execContext, - })); - } - if (!field.selectionSet) { - assertSelectionSetForIdValue(field, readStoreResult.result); - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - apollo_utilities_1.maybeDeepFreeze(readStoreResult); - } - return readStoreResult; - } - if (readStoreResult.result == null) { - return readStoreResult; - } - return this.combineExecResults(readStoreResult, this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: readStoreResult.result, - execContext: execContext, - })); - }; - StoreReader.prototype.combineExecResults = function () { - var execResults = []; - for (var _i = 0; _i < arguments.length; _i++) { - execResults[_i] = arguments[_i]; - } - var missing; - execResults.forEach(function (execResult) { - if (execResult.missing) { - missing = missing || []; - missing.push.apply(missing, execResult.missing); - } - }); - return { - result: execResults.pop().result, - missing: missing, - }; - }; - StoreReader.prototype.executeSubSelectedArray = function (_a) { - var _this = this; - var field = _a.field, array = _a.array, execContext = _a.execContext; - var missing; - function handleMissing(childResult) { - if (childResult.missing) { - missing = missing || []; - missing.push.apply(missing, childResult.missing); - } - return childResult.result; - } - array = array.map(function (item) { - if (item === null) { - return null; - } - if (Array.isArray(item)) { - return handleMissing(_this.executeSubSelectedArray({ - field: field, - array: item, - execContext: execContext, - })); - } - if (field.selectionSet) { - return handleMissing(_this.executeSelectionSet({ - selectionSet: field.selectionSet, - rootValue: item, - execContext: execContext, - })); - } - assertSelectionSetForIdValue(field, item); - return item; - }); - if (this.freezeResults && process.env.NODE_ENV !== 'production') { - Object.freeze(array); - } - return { result: array, missing: missing }; - }; - return StoreReader; -}()); -exports.StoreReader = StoreReader; -function assertSelectionSetForIdValue(field, value) { - if (!field.selectionSet && apollo_utilities_1.isIdValue(value)) { - throw new ts_invariant_1.InvariantError("Missing selection set for object of type " + value.typename + " returned for query field " + field.name.value); - } -} -function defaultFragmentMatcher() { - return true; -} -function assertIdValue(idValue) { - ts_invariant_1.invariant(apollo_utilities_1.isIdValue(idValue), "Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue."); -} -exports.assertIdValue = assertIdValue; -function readStoreResolver(object, typename, fieldName, args, context, _a) { - var resultKey = _a.resultKey, directives = _a.directives; - var storeKeyName = fieldName; - if (args || directives) { - storeKeyName = apollo_utilities_1.getStoreKeyName(storeKeyName, args, directives); - } - var fieldValue = void 0; - if (object) { - fieldValue = object[storeKeyName]; - if (typeof fieldValue === 'undefined' && - context.cacheRedirects && - typeof typename === 'string') { - var type = context.cacheRedirects[typename]; - if (type) { - var resolver = type[fieldName]; - if (resolver) { - fieldValue = resolver(object, args, { - getCacheKey: function (storeObj) { - var id = context.dataIdFromObject(storeObj); - return id && apollo_utilities_1.toIdValue({ - id: id, - typename: storeObj.__typename, - }); - }, - }); - } - } - } - } - if (typeof fieldValue === 'undefined') { - return { - result: fieldValue, - missing: [{ - object: object, - fieldName: storeKeyName, - tolerable: false, - }], - }; - } - if (apollo_utilities_1.isJsonValue(fieldValue)) { - fieldValue = fieldValue.json; - } - return { - result: fieldValue, - }; -} -//# sourceMappingURL=readFromStore.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/readFromStore.js.map b/node_modules/apollo-cache-inmemory/lib/readFromStore.js.map deleted file mode 100644 index 6910eada..00000000 --- a/node_modules/apollo-cache-inmemory/lib/readFromStore.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"readFromStore.js","sourceRoot":"","sources":["../src/readFromStore.ts"],"names":[],"mappings":";;;AAAA,q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AU,GAAG,UAAU,CAAC,IAAI,CAAC;KAC9B;IAED,OAAO;QACL,MAAM,EAAE,UAAU;KACnB,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/types.d.ts b/node_modules/apollo-cache-inmemory/lib/types.d.ts deleted file mode 100644 index c20ea2b7..00000000 --- a/node_modules/apollo-cache-inmemory/lib/types.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { DocumentNode } from 'graphql'; -import { FragmentMatcher } from './readFromStore'; -import { Transaction } from 'apollo-cache'; -import { IdValue, StoreValue } from 'apollo-utilities'; -export interface IdGetterObj extends Object { - __typename?: string; - id?: string; -} -export declare type IdGetter = (value: IdGetterObj) => string | null | undefined; -export interface NormalizedCache { - get(dataId: string): StoreObject; - set(dataId: string, value: StoreObject): void; - delete(dataId: string): void; - clear(): void; - toObject(): NormalizedCacheObject; - replace(newData: NormalizedCacheObject): void; -} -export interface NormalizedCacheObject { - [dataId: string]: StoreObject | undefined; -} -export interface StoreObject { - __typename?: string; - [storeFieldKey: string]: StoreValue; -} -export declare type OptimisticStoreItem = { - id: string; - data: NormalizedCacheObject; - transaction: Transaction; -}; -export declare type ReadQueryOptions = { - store: NormalizedCache; - query: DocumentNode; - fragmentMatcherFunction?: FragmentMatcher; - variables?: Object; - previousResult?: any; - rootId?: string; - config?: ApolloReducerConfig; -}; -export declare type DiffQueryAgainstStoreOptions = ReadQueryOptions & { - returnPartialData?: boolean; -}; -export declare type ApolloReducerConfig = { - dataIdFromObject?: IdGetter; - fragmentMatcher?: FragmentMatcherInterface; - addTypename?: boolean; - cacheRedirects?: CacheResolverMap; -}; -export declare type ReadStoreContext = { - readonly store: NormalizedCache; - readonly cacheRedirects: CacheResolverMap; - readonly dataIdFromObject?: IdGetter; -}; -export interface FragmentMatcherInterface { - match(idValue: IdValue, typeCondition: string, context: ReadStoreContext): boolean | 'heuristic'; -} -export declare type PossibleTypesMap = { - [key: string]: string[]; -}; -export declare type IntrospectionResultData = { - __schema: { - types: { - kind: string; - name: string; - possibleTypes: { - name: string; - }[]; - }[]; - }; -}; -export declare type CacheResolver = (rootValue: any, args: { - [argName: string]: any; -}, context: any) => any; -export declare type CacheResolverMap = { - [typeName: string]: { - [fieldName: string]: CacheResolver; - }; -}; -export declare type CustomResolver = CacheResolver; -export declare type CustomResolverMap = CacheResolverMap; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/types.d.ts.map b/node_modules/apollo-cache-inmemory/lib/types.d.ts.map deleted file mode 100644 index 88468921..00000000 --- a/node_modules/apollo-cache-inmemory/lib/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,WAAY,SAAQ,MAAM;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AACD,MAAM,CAAC,OAAO,MAAM,QAAQ,GAAG,CAC7B,KAAK,EAAE,WAAW,KACf,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAM/B,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IACjC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,IAAI,IAAI,CAAC;IAMd,QAAQ,IAAI,qBAAqB,CAAC;IAIlC,OAAO,CAAC,OAAO,EAAE,qB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,MAAM,EACrB,OAAO,EAAE,gBAAgB,GACxB,OAAO,GAAG,WAAW,CAAC;CAC1B;AAED,oBAAY,gBAAgB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3D,oBAAY,uBAAuB,GAAG;IACpC,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,aAAa,EAAE;gBACb,IAAI,EAAE,MAAM,CAAC;aACd,EAAE,CAAC;SACL,EAAE,CAAC;KACL,CAAC;CACH,CAAC;AAEF,oBAAY,aAAa,GAAG,CAC1B,SAAS,EAAE,GAAG,EACd,IAAI,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAChC,OAAO,EAAE,GAAG,KACT,GAAG,CAAC;AAET,oBAAY,gBAAgB,GAAG;IAC7B,CAAC,QAAQ,EAAE,MAAM,GAAG;QAClB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC;KACpC,CAAC;CACH,CAAC;AAGF,oBAAY,cAAc,GAAG,aAAa,CAAC;AAC3C,oBAAY,iBAAiB,GAAG,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/types.js b/node_modules/apollo-cache-inmemory/lib/types.js deleted file mode 100644 index 11e638d1..00000000 --- a/node_modules/apollo-cache-inmemory/lib/types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/types.js.map b/node_modules/apollo-cache-inmemory/lib/types.js.map deleted file mode 100644 index c768b790..00000000 --- a/node_modules/apollo-cache-inmemory/lib/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/writeToStore.d.ts b/node_modules/apollo-cache-inmemory/lib/writeToStore.d.ts deleted file mode 100644 index 83d54aee..00000000 --- a/node_modules/apollo-cache-inmemory/lib/writeToStore.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { SelectionSetNode, FieldNode, DocumentNode } from 'graphql'; -import { FragmentMatcher } from './readFromStore'; -import { FragmentMap } from 'apollo-utilities'; -import { IdGetter, NormalizedCache } from './types'; -export declare class WriteError extends Error { - type: string; -} -export declare function enhanceErrorWithDocument(error: Error, document: DocumentNode): WriteError; -export declare type WriteContext = { - readonly store: NormalizedCache; - readonly processedData?: { - [x: string]: FieldNode[]; - }; - readonly variables?: any; - readonly dataIdFromObject?: IdGetter; - readonly fragmentMap?: FragmentMap; - readonly fragmentMatcherFunction?: FragmentMatcher; -}; -export declare class StoreWriter { - writeQueryToStore({ query, result, store, variables, dataIdFromObject, fragmentMatcherFunction, }: { - query: DocumentNode; - result: Object; - store?: NormalizedCache; - variables?: Object; - dataIdFromObject?: IdGetter; - fragmentMatcherFunction?: FragmentMatcher; - }): NormalizedCache; - writeResultToStore({ dataId, result, document, store, variables, dataIdFromObject, fragmentMatcherFunction, }: { - dataId: string; - result: any; - document: DocumentNode; - store?: NormalizedCache; - variables?: Object; - dataIdFromObject?: IdGetter; - fragmentMatcherFunction?: FragmentMatcher; - }): NormalizedCache; - writeSelectionSetToStore({ result, dataId, selectionSet, context, }: { - dataId: string; - result: any; - selectionSet: SelectionSetNode; - context: WriteContext; - }): NormalizedCache; - private writeFieldToStore; - private processArrayValue; -} -//# sourceMappingURL=writeToStore.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/writeToStore.d.ts.map b/node_modules/apollo-cache-inmemory/lib/writeToStore.d.ts.map deleted file mode 100644 index 6a821313..00000000 --- a/node_modules/apollo-cache-inmemory/lib/writeToStore.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"writeToStore.d.ts","sour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C,SAAS,EACT,gBAAgB,EAChB,uBAAuB,GACxB,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,GAAG,CAAC;QACZ,QAAQ,EAAE,YAAY,CAAC;QACvB,KAAK,CAAC,EAAE,eAAe,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,QAAQ,CAAC;QAC5B,uBAAuB,CAAC,EAAE,eAAe,CAAC;KAC3C,GAAG,eAAe;IA2BZ,wBAAwB,CAAC,EAC9B,MAAM,EACN,MAAM,EACN,YAAY,EACZ,OAAO,GACR,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,GAAG,CAAC;QACZ,YAAY,EAAE,gBAAgB,CAAC;QAC/B,OAAO,EAAE,YAAY,CAAC;KACvB,GAAG,eAAe;IAwGnB,OAAO,CAAC,iBAAiB;IAgJzB,OAAO,CAAC,iBAAiB;CA2C1B"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/writeToStore.js b/node_modules/apollo-cache-inmemory/lib/writeToStore.js deleted file mode 100644 index 5ec2a424..00000000 --- a/node_modules/apollo-cache-inmemory/lib/writeToStore.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var apollo_utilities_1 = require("apollo-utilities"); -var ts_invariant_1 = require("ts-invariant"); -var objectCache_1 = require("./objectCache"); -var depTrackingCache_1 = require("./depTrackingCache"); -var WriteError = (function (_super) { - tslib_1.__extends(WriteError, _super); - function WriteError() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.type = 'WriteError'; - return _this; - } - return WriteError; -}(Error)); -exports.WriteError = WriteError; -function enhanceErrorWithDocument(error, document) { - var enhancedError = new WriteError("Error writing result to store for query:\n " + JSON.stringify(document)); - enhancedError.message += '\n' + error.message; - enhancedError.stack = error.stack; - return enhancedError; -} -exports.enhanceErrorWithDocument = enhanceErrorWithDocument; -var StoreWriter = (function () { - function StoreWriter() { - } - StoreWriter.prototype.writeQueryToStore = function (_a) { - var query = _a.query, result = _a.result, _b = _a.store, store = _b === void 0 ? depTrackingCache_1.defaultNormalizedCacheFactory() : _b, variables = _a.variables, dataIdFromObject = _a.dataIdFromObject, fragmentMatcherFunction = _a.fragmentMatcherFunction; - return this.writeResultToStore({ - dataId: 'ROOT_QUERY', - result: result, - document: query, - store: store, - variables: variables, - dataIdFromObject: dataIdFromObject, - fragmentMatcherFunction: fragmentMatcherFunction, - }); - }; - StoreWriter.prototype.writeResultToStore = function (_a) { - var dataId = _a.dataId, result = _a.result, document = _a.document, _b = _a.store, store = _b === void 0 ? depTrackingCache_1.defaultNormalizedCacheFactory() : _b, variables = _a.variables, dataIdFromObject = _a.dataIdFromObject, fragmentMatcherFunction = _a.fragmentMatcherFunction; - var operationDefinition = apollo_utilities_1.getOperationDefinition(document); - try { - return this.writeSelectionSetToStore({ - result: result, - dataId: dataId, - selectionSet: operationDefinition.selectionSet, - context: { - store: store, - processedData: {}, - variables: apollo_utilities_1.assign({}, apollo_utilities_1.getDefaultValues(operationDefinition), variables), - dataIdFromObject: dataIdFromObject, - fragmentMap: apollo_utilities_1.createFragmentMap(apollo_utilities_1.getFragmentDefinitions(document)), - fragmentMatcherFunction: fragmentMatcherFunction, - }, - }); - } - catch (e) { - throw enhanceErrorWithDocument(e, document); - } - }; - StoreWriter.prototype.writeSelectionSetToStore = function (_a) { - var _this = this; - var result = _a.result, dataId = _a.dataId, selectionSet = _a.selectionSet, context = _a.context; - var variables = context.variables, store = context.store, fragmentMap = context.fragmentMap; - selectionSet.selections.forEach(function (selection) { - var _a; - if (!apollo_utilities_1.shouldInclude(selection, variables)) { - return; - } - if (apollo_utilities_1.isField(selection)) { - var resultFieldKey = apollo_utilities_1.resultKeyNameFromField(selection); - var value = result[resultFieldKey]; - if (typeof value !== 'undefined') { - _this.writeFieldToStore({ - dataId: dataId, - value: value, - field: selection, - context: context, - }); - } - else { - var isDefered = false; - var isClient = false; - if (selection.directives && selection.directives.length) { - isDefered = selection.directives.some(function (directive) { return directive.name && directive.name.value === 'defer'; }); - isClient = selection.directives.some(function (directive) { return directive.name && directive.name.value === 'client'; }); - } - if (!isDefered && !isClient && context.fragmentMatcherFunction) { - ts_invariant_1.invariant.warn("Missing field " + resultFieldKey + " in " + JSON.stringify(result, null, 2).substring(0, 100)); - } - } - } - else { - var fragment = void 0; - if (apollo_utilities_1.isInlineFragment(selection)) { - fragment = selection; - } - else { - fragment = (fragmentMap || {})[selection.name.value]; - ts_invariant_1.invariant(fragment, "No fragment named " + selection.name.value + "."); - } - var matches = true; - if (context.fragmentMatcherFunction && fragment.typeCondition) { - var id = dataId || 'self'; - var idValue = apollo_utilities_1.toIdValue({ id: id, typename: undefined }); - var fakeContext = { - store: new objectCache_1.ObjectCache((_a = {}, _a[id] = result, _a)), - cacheRedirects: {}, - }; - var match = context.fragmentMatcherFunction(idValue, fragment.typeCondition.name.value, fakeContext); - if (!apollo_utilities_1.isProduction() && match === 'heuristic') { - ts_invariant_1.invariant.error('WARNING: heuristic fragment matching going on!'); - } - matches = !!match; - } - if (matches) { - _this.writeSelectionSetToStore({ - result: result, - selectionSet: fragment.selectionSet, - dataId: dataId, - context: context, - }); - } - } - }); - return store; - }; - StoreWriter.prototype.writeFieldToStore = function (_a) { - var _b; - var field = _a.field, value = _a.value, dataId = _a.dataId, context = _a.context; - var variables = context.variables, dataIdFromObject = context.dataIdFromObject, store = context.store; - var storeValue; - var storeObject; - var storeFieldName = apollo_utilities_1.storeKeyNameFromField(field, variables); - if (!field.selectionSet || value === null) { - storeValue = - value != null && typeof value === 'object' - ? - { type: 'json', json: value } - : - value; - } - else if (Array.isArray(value)) { - var generatedId = dataId + "." + storeFieldName; - storeValue = this.processArrayValue(value, generatedId, field.selectionSet, context); - } - else { - var valueDataId = dataId + "." + storeFieldName; - var generated = true; - if (!isGeneratedId(valueDataId)) { - valueDataId = '$' + valueDataId; - } - if (dataIdFromObject) { - var semanticId = dataIdFromObject(value); - ts_invariant_1.invariant(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.'); - if (semanticId || - (typeof semanticId === 'number' && semanticId === 0)) { - valueDataId = semanticId; - generated = false; - } - } - if (!isDataProcessed(valueDataId, field, context.processedData)) { - this.writeSelectionSetToStore({ - dataId: valueDataId, - result: value, - selectionSet: field.selectionSet, - context: context, - }); - } - var typename = value.__typename; - storeValue = apollo_utilities_1.toIdValue({ id: valueDataId, typename: typename }, generated); - storeObject = store.get(dataId); - var escapedId = storeObject && storeObject[storeFieldName]; - if (escapedId !== storeValue && apollo_utilities_1.isIdValue(escapedId)) { - var hadTypename = escapedId.typename !== undefined; - var hasTypename = typename !== undefined; - var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename; - ts_invariant_1.invariant(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - ts_invariant_1.invariant(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); - if (escapedId.generated) { - if (typenameChanged) { - if (!generated) { - store.delete(escapedId.id); - } - } - else { - mergeWithGenerated(escapedId.id, storeValue.id, store); - } - } - } - } - storeObject = store.get(dataId); - if (!storeObject || !apollo_utilities_1.isEqual(storeValue, storeObject[storeFieldName])) { - store.set(dataId, tslib_1.__assign(tslib_1.__assign({}, storeObject), (_b = {}, _b[storeFieldName] = storeValue, _b))); - } - }; - StoreWriter.prototype.processArrayValue = function (value, generatedId, selectionSet, context) { - var _this = this; - return value.map(function (item, index) { - if (item === null) { - return null; - } - var itemDataId = generatedId + "." + index; - if (Array.isArray(item)) { - return _this.processArrayValue(item, itemDataId, selectionSet, context); - } - var generated = true; - if (context.dataIdFromObject) { - var semanticId = context.dataIdFromObject(item); - if (semanticId) { - itemDataId = semanticId; - generated = false; - } - } - if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) { - _this.writeSelectionSetToStore({ - dataId: itemDataId, - result: item, - selectionSet: selectionSet, - context: context, - }); - } - return apollo_utilities_1.toIdValue({ id: itemDataId, typename: item.__typename }, generated); - }); - }; - return StoreWriter; -}()); -exports.StoreWriter = StoreWriter; -function isGeneratedId(id) { - return id[0] === '$'; -} -function mergeWithGenerated(generatedKey, realKey, cache) { - if (generatedKey === realKey) { - return false; - } - var generated = cache.get(generatedKey); - var real = cache.get(realKey); - var madeChanges = false; - Object.keys(generated).forEach(function (key) { - var value = generated[key]; - var realValue = real[key]; - if (apollo_utilities_1.isIdValue(value) && - isGeneratedId(value.id) && - apollo_utilities_1.isIdValue(realValue) && - !apollo_utilities_1.isEqual(value, realValue) && - mergeWithGenerated(value.id, realValue.id, cache)) { - madeChanges = true; - } - }); - cache.delete(generatedKey); - var newRealValue = tslib_1.__assign(tslib_1.__assign({}, generated), real); - if (apollo_utilities_1.isEqual(newRealValue, real)) { - return madeChanges; - } - cache.set(realKey, newRealValue); - return true; -} -function isDataProcessed(dataId, field, processedData) { - if (!processedData) { - return false; - } - if (processedData[dataId]) { - if (processedData[dataId].indexOf(field) >= 0) { - return true; - } - else { - processedData[dataId].push(field); - } - } - else { - processedData[dataId] = [field]; - } - return false; -} -//# sourceMappingURL=writeToStore.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/lib/writeToStore.js.map b/node_modules/apollo-cache-inmemory/lib/writeToStore.js.map deleted file mode 100644 index b592a9c6..00000000 --- a/node_modules/apollo-cache-inmemory/lib/writeToStore.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"writeToStore.js","sourceRoot":"","sources":["../src/writeToStore.ts"],"names":[],"mappings":";;;AASA,qDAkB0B;AAE1B,6CAAyC;AAEzC,6CAA4C;AAC5C,uDAAmE;AASnE;IAAgC,sCAAK;IAArC;QAAA,qEAEC;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CHANGELOG.md b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/CHANGELOG.md deleted file mode 100644 index c9adb0e2..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/CHANGELOG.md +++ /dev/null @@ -1,72 +0,0 @@ -# CHANGELOG - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md). - ----- - -### 1.1.12 - -- No changes. - -### 1.1.11 - -- No changes. - -### 1.1.10 - -- Added optional generics to cache manipulation methods (typescript). - [PR #3541](https://github.com/apollographql/apollo-client/pull/3541) - -### 1.1.9 - -- No public facing functionality changes. -- Various internal code cleanup, tooling and dependency changes. - -### 1.1.8 - -- Not documented - -### 1.1.7 - -- Not documented - -### 1.1.6 - -- Improve code coverage -- Map coverage to original source - -### 1.1.3 - -- Dependency updates - -### 1.1.2 - -- Dependency updates - -### 1.1.1 - -- Dependency updates - -### 1.1.0 - -- Add cache.writeData to base cache type & DataProxy - [PR #2818](https://github.com/apollographql/apollo-client/pull/2818) - -### 1.0.3 - -- Dependency updates - -### 1.0.2 - -- Package dependency updates - -### 1.0.1 - -- Improved rollup builds - -### 1.0.0 - -- Initial solid cache API diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/LICENSE b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/jest.config.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/jest.config.js deleted file mode 100644 index 48f0a891..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require('../../config/jest.config.settings'), -}; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.js deleted file mode 100644 index 25b0a4e7..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.js +++ /dev/null @@ -1,194 +0,0 @@ -exports.__esModule = true; -exports.Cache = exports.ApolloCache = void 0; - -var _apolloUtilities = require("apollo-utilities"); - -function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [op] - }; - return out; -} - -function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType' - } - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [frag] - }; - return out; -} - -function selectionSetFromObj(obj) { - if (typeof obj === 'number' || typeof obj === 'boolean' || typeof obj === 'string' || typeof obj === 'undefined' || obj === null) { - return null; - } - - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key - }, - selectionSet: nestedSelSet || undefined - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections - }; - return selectionSet; -} - -var justTypenameQuery = { - kind: 'Document', - definitions: [{ - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename' - }, - arguments: [], - directives: [], - selectionSet: null - }] - } - }] -}; - -var ApolloCache = function () { - function ApolloCache() {} - - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables - }); - }; - - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName) - }); - }; - - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, - data = _a.data; - - if (typeof id !== 'undefined') { - var typenameResult = null; - - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery - }); - } catch (e) {} - - var __typename = typenameResult && typenameResult.__typename || '__ClientData'; - - var dataToWrite = Object.assign({ - __typename: __typename - }, data); - this.writeFragment({ - id: id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite - }); - } else { - this.writeQuery({ - query: queryFromPojo(data), - data: data - }); - } - }; - - return ApolloCache; -}(); - -exports.ApolloCache = ApolloCache; -var Cache; -exports.Cache = Cache; - -(function (Cache) {})(Cache || (exports.Cache = Cache = {})); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.js.map deleted file mode 100644 index dee6b947..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/utils.ts","../src/cache.ts","../src/types/Cache.ts"],"names":[],"mappings":";;;;;;;SAQgB,a,CAAc,G,EAAQ;AACpC,MAAM,EAAE,GAA4B;AAClC,IAAA,IAAI,EAAE,qBAD4B;AAElC,IAAA,SAAS,EAAE,OAFuB;AAGlC,IAAA,IAAI,EAAE;AACJ,MAAA,IAAI,EAAE,MADF;AAEJ,MAAA,KAAK,EAAE;AAFH,KAH4B;AAOlC,IAAA,YAAY,EAAE,mBAAmB,CAAC,GAAD;AAPC,GAApC;AAUA,MAAM,GAAG,GAAiB;AACxB,IAAA,IAAI,EAAE,UADkB;AAExB,IAAA,WAAW,EAAE,CAAC,EAAD;AAFW,GAA1B;AAKA,SAAO,GAAP;AACD;;AAED,SAAgB,gBAAhB,CAAiC,GAAjC,EAA2C,QAA3C,EAA4D;AAC1D,MAAM,IAAI,GAA2B;AACnC,IAAA,IAAI,EAAE,oBAD6B;AAEnC,IAAA,aAAa,EAAE;AACb,MAAA,IAAI,EAAE,WADO;AAEb,MAAA,IAAI,EAAE;AACJ,Q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ADsB;AAE9B,UAAA,UAAU,EAAE,KAFkB;AAG9B,UAAA,KAAK,EAAE;AAHuB,SAAf,CAAjB;AAKD,OAND,CAME,OAAO,CAAP,EAAU,CAEX;;AAGD,UAAM,UAAU,GACb,cAAc,IAAI,cAAc,CAAC,UAAlC,IAAiD,cADnD;;AAIA,UAAM,WAAW,GAAG,MAAM,CAAC,MAAP,CAAc;AAAE,QAAA,UAAU,EAAA;AAAZ,OAAd,EAA8B,IAA9B,CAApB;AAEA,WAAK,aAAL,CAAmB;AACjB,QAAA,EAAE,EAAA,EADe;AAEjB,QAAA,QAAQ,EAAE,gBAAgB,CAAC,WAAD,EAAc,UAAd,CAFT;AAGjB,QAAA,IAAI,EAAE;AAHW,OAAnB;AAKD,KA5BD,MA4BO;AACL,WAAK,UAAL,CAAgB;AAAE,QAAA,KAAK,EAAE,aAAa,CAAC,IAAD,CAAtB;AAA8B,QAAA,IAAI,EAAA;AAAlC,OAAhB;AACD;AACF,GAnCM;;AAoCT,SAAA,WAAA;AAAC,C;;;ICnJgB,K;;;AAAjB,CAAA,UAAiB,KAAjB,EAAsB,CAqCrB,CArCD,EAAiB,KAAK,qBAAL,KAAK,GAAA,EAAA,CAAtB,E","sourcesContent":["import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n FieldNode,\n FragmentDefinitionNode,\n} from 'graphql';\n\nexport function queryFromPojo(obj: any): DocumentNode {\n const op: OperationDefinitionNode = {\n kind: 'OperationDefinition',\n operation: 'query',\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [op],\n };\n\n return out;\n}\n\nexport function fragmentFromPojo(obj: any, typename?: string): DocumentNode {\n const frag: FragmentDefinitionNode = {\n kind: 'FragmentDefinition',\n typeCondition: {\n kind: 'NamedType',\n name: {\n kind: 'Name',\n value: typename || '__FakeType',\n },\n },\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [frag],\n };\n\n return out;\n}\n\nfunction selectionSetFromObj(obj: any): SelectionSetNode {\n if (\n typeof obj === 'number' ||\n typeof obj === 'boolean' ||\n typeof obj === 'string' ||\n typeof obj === 'undefined' ||\n obj === null\n ) {\n // No selection set here\n return null;\n }\n\n if (Array.isArray(obj)) {\n // GraphQL queries don't include arrays\n return selectionSetFromObj(obj[0]);\n }\n\n // Now we know it's an object\n const selections: FieldNode[] = [];\n\n Object.keys(obj).forEach(key => {\n const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]);\n\n const field: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: key,\n },\n selectionSet: nestedSelSet || undefined,\n };\n\n selections.push(field);\n });\n\n const selectionSet: SelectionSetNode = {\n kind: 'SelectionSet',\n selections,\n };\n\n return selectionSet;\n}\n\nexport const justTypenameQuery: DocumentNode = {\n kind: 'Document',\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n name: null,\n variableDefinitions: null,\n directives: [],\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'Field',\n alias: null,\n name: {\n kind: 'Name',\n value: '__typename',\n },\n arguments: [],\n directives: [],\n selectionSet: null,\n },\n ],\n },\n },\n ],\n};\n","import { DocumentNode } from 'graphql';\nimport { getFragmentQueryDocument } from 'apollo-utilities';\n\nimport { DataProxy, Cache } from './types';\nimport { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils';\n\nexport type Transaction = (c: ApolloCache) => void;\n\nexport abstract class ApolloCache implements DataProxy {\n // required to implement\n // core API\n public abstract read(\n query: Cache.ReadOptions,\n ): T | null;\n public abstract write(\n write: Cache.WriteOptions,\n ): void;\n public abstract diff(query: Cache.DiffOptions): Cache.DiffResult;\n public abstract watch(watch: Cache.WatchOptions): () => void;\n public abstract evict(\n query: Cache.EvictOptions,\n ): Cache.EvictionResult;\n public abstract reset(): Promise;\n\n // intializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // optimistic API\n public abstract removeOptimistic(id: string): void;\n\n // transactional API\n public abstract performTransaction(\n transaction: Transaction,\n ): void;\n public abstract recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ): void;\n\n // optional API\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n // experimental\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): QueryType | null {\n return this.read({\n query: options.query,\n variables: options.variables,\n optimistic,\n });\n }\n\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): FragmentType | null {\n return this.read({\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n variables: options.variables,\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery(\n options: Cache.WriteQueryOptions,\n ): void {\n this.write({\n dataId: 'ROOT_QUERY',\n result: options.data,\n query: options.query,\n variables: options.variables,\n });\n }\n\n public writeFragment(\n options: Cache.WriteFragmentOptions,\n ): void {\n this.write({\n dataId: options.id,\n result: options.data,\n variables: options.variables,\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n });\n }\n\n public writeData({\n id,\n data,\n }: Cache.WriteDataOptions): void {\n if (typeof id !== 'undefined') {\n let typenameResult = null;\n // Since we can't use fragments without having a typename in the store,\n // we need to make sure we have one.\n // To avoid overwriting an existing typename, we need to read it out first\n // and generate a fake one if none exists.\n try {\n typenameResult = this.read({\n rootId: id,\n optimistic: false,\n query: justTypenameQuery,\n });\n } catch (e) {\n // Do nothing, since an error just means no typename exists\n }\n\n // tslint:disable-next-line\n const __typename =\n (typenameResult && typenameResult.__typename) || '__ClientData';\n\n // Add a type here to satisfy the inmemory cache\n const dataToWrite = Object.assign({ __typename }, data);\n\n this.writeFragment({\n id,\n fragment: fragmentFromPojo(dataToWrite, __typename),\n data: dataToWrite,\n });\n } else {\n this.writeQuery({ query: queryFromPojo(data), data });\n }\n }\n}\n","import { DataProxy } from './DataProxy';\n\nexport namespace Cache {\n export type WatchCallback = (newData: any) => void;\n export interface EvictionResult {\n success: Boolean;\n }\n\n export interface ReadOptions\n extends DataProxy.Query {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n }\n\n export interface WriteOptions\n extends DataProxy.Query {\n dataId: string;\n result: TResult;\n }\n\n export interface DiffOptions extends ReadOptions {\n returnPartialData?: boolean;\n }\n\n export interface WatchOptions extends ReadOptions {\n callback: WatchCallback;\n }\n\n export interface EvictOptions\n extends DataProxy.Query {\n rootId?: string;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import WriteDataOptions = DataProxy.WriteDataOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.min.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.min.js deleted file mode 100644 index 5b9e384d..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.Cache=exports.ApolloCache=void 0;var e=require("apollo-utilities");function t(e){return{kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:i(e)}]}}function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return null;if(Array.isArray(e))return i(e[0]);var t=[];return Object.keys(e).forEach(function(n){var r={kind:"Field",name:{kind:"Name",value:n},selectionSet:i(e[n])||void 0};t.push(r)}),{kind:"SelectionSet",selections:t}}var n,r={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:null,variableDefinitions:null,directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:null,name:{kind:"Name",value:"__typename"},arguments:[],directives:[],selectionSet:null}]}}]},a=function(){function n(){}return n.prototype.transformDocument=function(e){return e},n.prototype.transformForLink=function(e){return e},n.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.read({query:e.query,variables:e.variables,optimistic:t})},n.prototype.readFragment=function(t,i){return void 0===i&&(i=!1),this.read({query:(0,e.getFragmentQueryDocument)(t.fragment,t.fragmentName),variables:t.variables,rootId:t.id,optimistic:i})},n.prototype.writeQuery=function(e){this.write({dataId:"ROOT_QUERY",result:e.data,query:e.query,variables:e.variables})},n.prototype.writeFragment=function(t){this.write({dataId:t.id,result:t.data,variables:t.variables,query:(0,e.getFragmentQueryDocument)(t.fragment,t.fragmentName)})},n.prototype.writeData=function(e){var n,a,o=e.id,u=e.data;if(void 0!==o){var l=null;try{l=this.read({rootId:o,optimistic:!1,query:r})}catch(e){}var s=l&&l.__typename||"__ClientData",d=Object.assign({__typename:s},u);this.writeFragment({id:o,fragment:(n=d,a=s,{kind:"Document",definitions:[{kind:"FragmentDefinition",typeCondition:{kind:"NamedType",name:{kind:"Name",value:a||"__FakeType"}},name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:i(n)}]}),data:d})}else this.writeQuery({query:t(u),data:u})},n}();exports.ApolloCache=a,exports.Cache=n,n||(exports.Cache=n={}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.esm.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.esm.js deleted file mode 100644 index 7f3e30ec..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.esm.js +++ /dev/null @@ -1,175 +0,0 @@ -import { getFragmentQueryDocument } from 'apollo-utilities'; - -function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [op], - }; - return out; -} -function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType', - }, - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [frag], - }; - return out; -} -function selectionSetFromObj(obj) { - if (typeof obj === 'number' || - typeof obj === 'boolean' || - typeof obj === 'string' || - typeof obj === 'undefined' || - obj === null) { - return null; - } - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key, - }, - selectionSet: nestedSelSet || undefined, - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections, - }; - return selectionSet; -} -var justTypenameQuery = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - ], - }, - }, - ], -}; - -var ApolloCache = (function () { - function ApolloCache() { - } - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables, - }); - }; - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - }); - }; - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, data = _a.data; - if (typeof id !== 'undefined') { - var typenameResult = null; - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery, - }); - } - catch (e) { - } - var __typename = (typenameResult && typenameResult.__typename) || '__ClientData'; - var dataToWrite = Object.assign({ __typename: __typename }, data); - this.writeFragment({ - id: id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite, - }); - } - else { - this.writeQuery({ query: queryFromPojo(data), data: data }); - } - }; - return ApolloCache; -}()); - -var Cache; -(function (Cache) { -})(Cache || (Cache = {})); - -export { ApolloCache, Cache }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.esm.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.esm.js.map deleted file mode 100644 index 04ac58c3..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/utils.ts","../src/cache.ts","../src/types/Cache.ts"],"sourcesContent":["import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n FieldNode,\n FragmentDefinitionNode,\n} from 'graphql';\n\nexport function queryFromPojo(obj: any): DocumentNode {\n const op: OperationDefinitionNode = {\n kind: 'OperationDefinition',\n operation: 'query',\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [op],\n };\n\n return out;\n}\n\nexport function fragmentFromPojo(obj: any, typename?: string): DocumentNode {\n const frag: FragmentDefinitionNode = {\n kind: 'FragmentDefinition',\n typeCondition: {\n kind: 'NamedType',\n name: {\n kind: 'Name',\n value: typename || '__FakeType',\n },\n },\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [frag],\n };\n\n return out;\n}\n\nfunction selectionSetFromObj(obj: any): SelectionSetNode {\n if (\n typeof obj === 'number' ||\n typeof obj === 'boolean' ||\n typeof obj === 'string' ||\n typeof obj === 'undefined' ||\n obj === null\n ) {\n // No selection set here\n return null;\n }\n\n if (Array.isArray(obj)) {\n // GraphQL queries don't include arrays\n return selectionSetFromObj(obj[0]);\n }\n\n // Now we know it's an object\n const selections: FieldNode[] = [];\n\n Object.keys(obj).forEach(key => {\n const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]);\n\n const field: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: key,\n },\n selectionSet: nestedSelSet || undefined,\n };\n\n selections.push(field);\n });\n\n const selectionSet: SelectionSetNode = {\n kind: 'SelectionSet',\n selections,\n };\n\n return selectionSet;\n}\n\nexport const justTypenameQuery: DocumentNode = {\n kind: 'Document',\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n name: null,\n variableDefinitions: null,\n directives: [],\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'Field',\n alias: null,\n name: {\n kind: 'Name',\n value: '__typename',\n },\n arguments: [],\n directives: [],\n selectionSet: null,\n },\n ],\n },\n },\n ],\n};\n","import { DocumentNode } from 'graphql';\nimport { getFragmentQueryDocument } from 'apollo-utilities';\n\nimport { DataProxy, Cache } from './types';\nimport { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils';\n\nexport type Transaction = (c: ApolloCache) => void;\n\nexport abstract class ApolloCache implements DataProxy {\n // required to implement\n // core API\n public abstract read(\n query: Cache.ReadOptions,\n ): T | null;\n public abstract write(\n write: Cache.WriteOptions,\n ): void;\n public abstract diff(query: Cache.DiffOptions): Cache.DiffResult;\n public abstract watch(watch: Cache.WatchOptions): () => void;\n public abstract evict(\n query: Cache.EvictOptions,\n ): Cache.EvictionResult;\n public abstract reset(): Promise;\n\n // intializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // optimistic API\n public abstract removeOptimistic(id: string): void;\n\n // transactional API\n public abstract performTransaction(\n transaction: Transaction,\n ): void;\n public abstract recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ): void;\n\n // optional API\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n // experimental\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): QueryType | null {\n return this.read({\n query: options.query,\n variables: options.variables,\n optimistic,\n });\n }\n\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): FragmentType | null {\n return this.read({\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n variables: options.variables,\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery(\n options: Cache.WriteQueryOptions,\n ): void {\n this.write({\n dataId: 'ROOT_QUERY',\n result: options.data,\n query: options.query,\n variables: options.variables,\n });\n }\n\n public writeFragment(\n options: Cache.WriteFragmentOptions,\n ): void {\n this.write({\n dataId: options.id,\n result: options.data,\n variables: options.variables,\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n });\n }\n\n public writeData({\n id,\n data,\n }: Cache.WriteDataOptions): void {\n if (typeof id !== 'undefined') {\n let typenameResult = null;\n // Since we can't use fragments without having a typename in the store,\n // we need to make sure we have one.\n // To avoid overwriting an existing typename, we need to read it out first\n // and generate a fake one if none exists.\n try {\n typenameResult = this.read({\n rootId: id,\n optimistic: false,\n query: justTypenameQuery,\n });\n } catch (e) {\n // Do nothing, since an error just means no typename exists\n }\n\n // tslint:disable-next-line\n const __typename =\n (typenameResult && typenameResult.__typename) || '__ClientData';\n\n // Add a type here to satisfy the inmemory cache\n const dataToWrite = Object.assign({ __typename }, data);\n\n this.writeFragment({\n id,\n fragment: fragmentFromPojo(dataToWrite, __typename),\n data: dataToWrite,\n });\n } else {\n this.writeQuery({ query: queryFromPojo(data), data });\n }\n }\n}\n","import { DataProxy } from './DataProxy';\n\nexport namespace Cache {\n export type WatchCallback = (newData: any) => void;\n export interface EvictionResult {\n success: Boolean;\n }\n\n export interface ReadOptions\n extends DataProxy.Query {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n }\n\n export interface WriteOptions\n extends DataProxy.Query {\n dataId: string;\n result: TResult;\n }\n\n export interface DiffOptions extends ReadOptions {\n returnPartialData?: boolean;\n }\n\n export interface WatchOptions extends ReadOptions {\n callback: WatchCallback;\n }\n\n export interface EvictOptions\n extends DataProxy.Query {\n rootId?: string;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import WriteDataOptions = DataProxy.WriteDataOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"],"names":[],"mappings":";;SAQgB,aAAa,CAAC,GAAQ;IACpC,IAAM,EAAE,GAA4B;QAClC,IAAI,EAAE,qBAAqB;QAC3B,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,KAAK,EA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C,MAAM,CAAC,EAAE,UAAU,YAAA,EAAE,EAAE,IAAI,CAAC,CAAC;YAExD,IAAI,CAAC,aAAa,CAAC;gBACjB,EAAE,IAAA;gBACF,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC;gBACnD,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;SACvD;KACF;IACH,kBAAC;CAAA;;ICnJgB,KAAK,CAqCrB;AArCD,WAAiB,KAAK;CAqCrB,EArCgB,KAAK,KAAL,KAAK,QAqCrB;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.umd.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.umd.js deleted file mode 100644 index 0edf921f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.umd.js +++ /dev/null @@ -1,208 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "apollo-utilities"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("apollo-utilities")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.apolloUtilities); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _apolloUtilities) { - - _exports.__esModule = true; - _exports.Cache = _exports.ApolloCache = void 0; - - function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [op] - }; - return out; - } - - function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType' - } - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [frag] - }; - return out; - } - - function selectionSetFromObj(obj) { - if (typeof obj === 'number' || typeof obj === 'boolean' || typeof obj === 'string' || typeof obj === 'undefined' || obj === null) { - return null; - } - - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key - }, - selectionSet: nestedSelSet || undefined - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections - }; - return selectionSet; - } - - var justTypenameQuery = { - kind: 'Document', - definitions: [{ - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename' - }, - arguments: [], - directives: [], - selectionSet: null - }] - } - }] - }; - - var ApolloCache = function () { - function ApolloCache() {} - - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables - }); - }; - - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName) - }); - }; - - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, - data = _a.data; - - if (typeof id !== 'undefined') { - var typenameResult = null; - - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery - }); - } catch (e) {} - - var __typename = typenameResult && typenameResult.__typename || '__ClientData'; - - var dataToWrite = Object.assign({ - __typename: __typename - }, data); - this.writeFragment({ - id: id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite - }); - } else { - this.writeQuery({ - query: queryFromPojo(data), - data: data - }); - } - }; - - return ApolloCache; - }(); - - _exports.ApolloCache = ApolloCache; - var Cache; - _exports.Cache = Cache; - - (function (Cache) {})(Cache || (_exports.Cache = Cache = {})); - -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.umd.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.umd.js.map deleted file mode 100644 index ce6fdb0e..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/utils.ts","../src/cache.ts","../src/types/Cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;WAQgB,a,CAAc,G,EAAQ;AACpC,QAAM,EAAE,GAA4B;AAClC,MAAA,IAAI,EAAE,qBAD4B;AAElC,MAAA,SAAS,EAAE,OAFuB;AAGlC,MAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,MADF;AAEJ,QAAA,KAAK,EAAE;AAFH,OAH4B;AAOlC,MAAA,YAAY,EAAE,mBAAmB,CAAC,GAAD;AAPC,KAApC;AAUA,QAAM,GAAG,GAAiB;AACxB,MAAA,IAAI,EAAE,UADkB;AAExB,MAAA,WAAW,EAAE,CAAC,EAAD;AAFW,KAA1B;AAKA,WAAO,GAAP;AACD;;AAED,WAAgB,gBAAhB,CAAiC,GAAjC,EAA2C,QAA3C,EAA4D;AAC1D,QAAM,IAAI,GAA2B;AACnC,MAAA,IAAI,EAA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c,GAAG,IAArB;;AAKA,YAAI;AACF,UAAA,cAAc,GAAG,KAAK,IAAL,CAAe;AAC9B,YAAA,MAAM,EAAE,EADsB;AAE9B,YAAA,UAAU,EAAE,KAFkB;AAG9B,YAAA,KAAK,EAAE;AAHuB,WAAf,CAAjB;AAKD,SAND,CAME,OAAO,CAAP,EAAU,CAEX;;AAGD,YAAM,UAAU,GACb,cAAc,IAAI,cAAc,CAAC,UAAlC,IAAiD,cADnD;;AAIA,YAAM,WAAW,GAAG,MAAM,CAAC,MAAP,CAAc;AAAE,UAAA,UAAU,EAAA;AAAZ,SAAd,EAA8B,IAA9B,CAApB;AAEA,aAAK,aAAL,CAAmB;AACjB,UAAA,EAAE,EAAA,EADe;AAEjB,UAAA,QAAQ,EAAE,gBAAgB,CAAC,WAAD,EAAc,UAAd,CAFT;AAGjB,UAAA,IAAI,EAAE;AAHW,SAAnB;AAKD,OA5BD,MA4BO;AACL,aAAK,UAAL,CAAgB;AAAE,UAAA,KAAK,EAAE,aAAa,CAAC,IAAD,CAAtB;AAA8B,UAAA,IAAI,EAAA;AAAlC,SAAhB;AACD;AACF,KAnCM;;AAoCT,WAAA,WAAA;AAAC,G;;;MCnJgB,K;;;AAAjB,GAAA,UAAiB,KAAjB,EAAsB,CAqCrB,CArCD,EAAiB,KAAK,sBAAL,KAAK,GAAA,EAAA,CAAtB,E","sourcesContent":["import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n FieldNode,\n FragmentDefinitionNode,\n} from 'graphql';\n\nexport function queryFromPojo(obj: any): DocumentNode {\n const op: OperationDefinitionNode = {\n kind: 'OperationDefinition',\n operation: 'query',\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [op],\n };\n\n return out;\n}\n\nexport function fragmentFromPojo(obj: any, typename?: string): DocumentNode {\n const frag: FragmentDefinitionNode = {\n kind: 'FragmentDefinition',\n typeCondition: {\n kind: 'NamedType',\n name: {\n kind: 'Name',\n value: typename || '__FakeType',\n },\n },\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [frag],\n };\n\n return out;\n}\n\nfunction selectionSetFromObj(obj: any): SelectionSetNode {\n if (\n typeof obj === 'number' ||\n typeof obj === 'boolean' ||\n typeof obj === 'string' ||\n typeof obj === 'undefined' ||\n obj === null\n ) {\n // No selection set here\n return null;\n }\n\n if (Array.isArray(obj)) {\n // GraphQL queries don't include arrays\n return selectionSetFromObj(obj[0]);\n }\n\n // Now we know it's an object\n const selections: FieldNode[] = [];\n\n Object.keys(obj).forEach(key => {\n const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]);\n\n const field: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: key,\n },\n selectionSet: nestedSelSet || undefined,\n };\n\n selections.push(field);\n });\n\n const selectionSet: SelectionSetNode = {\n kind: 'SelectionSet',\n selections,\n };\n\n return selectionSet;\n}\n\nexport const justTypenameQuery: DocumentNode = {\n kind: 'Document',\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n name: null,\n variableDefinitions: null,\n directives: [],\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'Field',\n alias: null,\n name: {\n kind: 'Name',\n value: '__typename',\n },\n arguments: [],\n directives: [],\n selectionSet: null,\n },\n ],\n },\n },\n ],\n};\n","import { DocumentNode } from 'graphql';\nimport { getFragmentQueryDocument } from 'apollo-utilities';\n\nimport { DataProxy, Cache } from './types';\nimport { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils';\n\nexport type Transaction = (c: ApolloCache) => void;\n\nexport abstract class ApolloCache implements DataProxy {\n // required to implement\n // core API\n public abstract read(\n query: Cache.ReadOptions,\n ): T | null;\n public abstract write(\n write: Cache.WriteOptions,\n ): void;\n public abstract diff(query: Cache.DiffOptions): Cache.DiffResult;\n public abstract watch(watch: Cache.WatchOptions): () => void;\n public abstract evict(\n query: Cache.EvictOptions,\n ): Cache.EvictionResult;\n public abstract reset(): Promise;\n\n // intializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // optimistic API\n public abstract removeOptimistic(id: string): void;\n\n // transactional API\n public abstract performTransaction(\n transaction: Transaction,\n ): void;\n public abstract recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ): void;\n\n // optional API\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n // experimental\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): QueryType | null {\n return this.read({\n query: options.query,\n variables: options.variables,\n optimistic,\n });\n }\n\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): FragmentType | null {\n return this.read({\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n variables: options.variables,\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery(\n options: Cache.WriteQueryOptions,\n ): void {\n this.write({\n dataId: 'ROOT_QUERY',\n result: options.data,\n query: options.query,\n variables: options.variables,\n });\n }\n\n public writeFragment(\n options: Cache.WriteFragmentOptions,\n ): void {\n this.write({\n dataId: options.id,\n result: options.data,\n variables: options.variables,\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n });\n }\n\n public writeData({\n id,\n data,\n }: Cache.WriteDataOptions): void {\n if (typeof id !== 'undefined') {\n let typenameResult = null;\n // Since we can't use fragments without having a typename in the store,\n // we need to make sure we have one.\n // To avoid overwriting an existing typename, we need to read it out first\n // and generate a fake one if none exists.\n try {\n typenameResult = this.read({\n rootId: id,\n optimistic: false,\n query: justTypenameQuery,\n });\n } catch (e) {\n // Do nothing, since an error just means no typename exists\n }\n\n // tslint:disable-next-line\n const __typename =\n (typenameResult && typenameResult.__typename) || '__ClientData';\n\n // Add a type here to satisfy the inmemory cache\n const dataToWrite = Object.assign({ __typename }, data);\n\n this.writeFragment({\n id,\n fragment: fragmentFromPojo(dataToWrite, __typename),\n data: dataToWrite,\n });\n } else {\n this.writeQuery({ query: queryFromPojo(data), data });\n }\n }\n}\n","import { DataProxy } from './DataProxy';\n\nexport namespace Cache {\n export type WatchCallback = (newData: any) => void;\n export interface EvictionResult {\n success: Boolean;\n }\n\n export interface ReadOptions\n extends DataProxy.Query {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n }\n\n export interface WriteOptions\n extends DataProxy.Query {\n dataId: string;\n result: TResult;\n }\n\n export interface DiffOptions extends ReadOptions {\n returnPartialData?: boolean;\n }\n\n export interface WatchOptions extends ReadOptions {\n callback: WatchCallback;\n }\n\n export interface EvictOptions\n extends DataProxy.Query {\n rootId?: string;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import WriteDataOptions = DataProxy.WriteDataOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.d.ts deleted file mode 100644 index b2a2fd03..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { DocumentNode } from 'graphql'; -import { DataProxy, Cache } from './types'; -export declare type Transaction = (c: ApolloCache) => void; -export declare abstract class ApolloCache implements DataProxy { - abstract read(query: Cache.ReadOptions): T | null; - abstract write(write: Cache.WriteOptions): void; - abstract diff(query: Cache.DiffOptions): Cache.DiffResult; - abstract watch(watch: Cache.WatchOptions): () => void; - abstract evict(query: Cache.EvictOptions): Cache.EvictionResult; - abstract reset(): Promise; - abstract restore(serializedState: TSerialized): ApolloCache; - abstract extract(optimistic?: boolean): TSerialized; - abstract removeOptimistic(id: string): void; - abstract performTransaction(transaction: Transaction): void; - abstract recordOptimisticTransaction(transaction: Transaction, id: string): void; - transformDocument(document: DocumentNode): DocumentNode; - transformForLink(document: DocumentNode): DocumentNode; - readQuery(options: DataProxy.Query, optimistic?: boolean): QueryType | null; - readFragment(options: DataProxy.Fragment, optimistic?: boolean): FragmentType | null; - writeQuery(options: Cache.WriteQueryOptions): void; - writeFragment(options: Cache.WriteFragmentOptions): void; - writeData({ id, data, }: Cache.WriteDataOptions): void; -} -//# sourceMappingURL=cache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.d.ts.map deleted file mode 100644 index 45ce1253..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAG3C,oBAAY,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEzD,8BAAsB,WAAW,CAAC,WAAW,CAAE,YAAW,SAAS;aAGjD,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,GAAG,EACtC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,GACnC,CAAC,GAAG,IAAI;aACK,KAA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AG,EAAE,UAAU,GAAG,GAAG,EAC7C,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,GAClD,IAAI;IASA,aAAa,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EAChD,OAAO,EAAE,KAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,GACrD,IAAI;IASA,SAAS,CAAC,KAAK,GAAG,GAAG,EAAE,EAC5B,EAAE,EACF,IAAI,GACL,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,IAAI;CAiCxC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.js deleted file mode 100644 index aec0779b..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var apollo_utilities_1 = require("apollo-utilities"); -var utils_1 = require("./utils"); -var ApolloCache = (function () { - function ApolloCache() { - } - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: apollo_utilities_1.getFragmentQueryDocument(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables, - }); - }; - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: apollo_utilities_1.getFragmentQueryDocument(options.fragment, options.fragmentName), - }); - }; - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, data = _a.data; - if (typeof id !== 'undefined') { - var typenameResult = null; - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: utils_1.justTypenameQuery, - }); - } - catch (e) { - } - var __typename = (typenameResult && typenameResult.__typename) || '__ClientData'; - var dataToWrite = Object.assign({ __typename: __typename }, data); - this.writeFragment({ - id: id, - fragment: utils_1.fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite, - }); - } - else { - this.writeQuery({ query: utils_1.queryFromPojo(data), data: data }); - } - }; - return ApolloCache; -}()); -exports.ApolloCache = ApolloCache; -//# sourceMappingURL=cache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.js.map deleted file mode 100644 index 348c78f5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/cache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";;AACA,qDAA4D;AAG5D,iCAA6E;AAI7E;IAAA;IA6IA,CAAC;IA/FQ,uCAAiB,GAAxB,UAAyB,QAAsB;QAC7C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,sCAAgB,GAAvB,UAAwB,QAAsB;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAQM,+BAAS,GAAhB,UACE,OAAoC,EACpC,UAA2B;QAA3B,2BAAA,EAAA,kBAA2B;QAE3B,OAAO,IAAI,CAAC,IAAI,CAAC;YACf,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,YAAA;SACX,CAAC,CAAC;IACL,CAAC;IAEM,kCAAY,GAAnB,UACE,OAAuC,EACvC,UAA2B;QAA3B,2BAAA,EAAA,kBAA2B;QAE3B,OAAO,IAAI,CA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ExD,IAAI,CAAC,aAAa,CAAC;gBACjB,EAAE,IAAA;gBACF,QAAQ,EAAE,wBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC;gBACnD,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,qBAAa,CAAC,IAAI,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;SACvD;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AA7ID,IA6IC;AA7IqB,kCAAW"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.d.ts deleted file mode 100644 index 5b294ac6..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './cache'; -export * from './types'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.d.ts.map deleted file mode 100644 index bc245457..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.js deleted file mode 100644 index decd22aa..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./cache"), exports); -tslib_1.__exportStar(require("./types"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.js.map deleted file mode 100644 index a385466c..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,kDAAwB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.d.ts deleted file mode 100644 index 5a9e6497..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { DataProxy } from './DataProxy'; -export declare namespace Cache { - type WatchCallback = (newData: any) => void; - interface EvictionResult { - success: Boolean; - } - interface ReadOptions extends DataProxy.Query { - rootId?: string; - previousResult?: any; - optimistic: boolean; - } - interface WriteOptions extends DataProxy.Query { - dataId: string; - result: TResult; - } - interface DiffOptions extends ReadOptions { - returnPartialData?: boolean; - } - interface WatchOptions extends ReadOptions { - callback: WatchCallback; - } - interface EvictOptions extends DataProxy.Query { - rootId?: string; - } - export import DiffResult = DataProxy.DiffResult; - export import WriteQueryOptions = DataProxy.WriteQueryOptions; - export import WriteFragmentOptions = DataProxy.WriteFragmentOptions; - export import WriteDataOptions = DataProxy.WriteDataOptions; - export import Fragment = DataProxy.Fragment; -} -//# sourceMappingURL=Cache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.d.ts.map deleted file mode 100644 index aa4f617f..00000000 --- a/node_modules/apollo-cache-inmemory/node_mod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AM,QAAQ,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;CAC7C"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.js deleted file mode 100644 index a2cebe56..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Cache; -(function (Cache) { -})(Cache = exports.Cache || (exports.Cache = {})); -//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.js.map deleted file mode 100644 index f92c62a7..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/Cache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/types/Cache.ts"],"names":[],"mappings":";;AAEA,IAAiB,KAAK,CAqCrB;AArCD,WAAiB,KAAK;AAqCtB,CAAC,EArCgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAqCrB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.d.ts deleted file mode 100644 index 2c27091f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare namespace DataProxy { - interface Query { - query: DocumentNode; - variables?: TVariables; - } - interface Fragment { - id: string; - fragment: DocumentNode; - fragmentName?: string; - variables?: TVariables; - } - interface WriteQueryOptions extends Query { - data: TData; - } - interface WriteFragmentOptions extends Fragment { - data: TData; - } - interface WriteDataOptions { - data: TData; - id?: string; - } - type DiffResult = { - result?: T; - complete?: boolean; - }; -} -export interface DataProxy { - readQuery(options: DataProxy.Query, optimistic?: boolean): QueryType | null; - readFragment(options: DataProxy.Fragment, optimistic?: boolean): FragmentType | null; - writeQuery(options: DataProxy.WriteQueryOptions): void; - writeFragment(options: DataProxy.WriteFragmentOptions): void; - writeData(options: DataProxy.WriteDataOptions): void; -} -//# sourceMappingURL=DataProxy.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.d.ts.map deleted file mode 100644 index 81d0ffc0..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DataProxy.d.ts","sourceRoot":"","sources":["../src/types/DataProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,yBAAiB,SAAS,CAAC;IACzB,UAAiB,KAAK,CAAC,UAAU;QAM/B,KAAK,EAAE,YAAY,CAAC;QAKpB,SAAS,CAAC,EAAE,UAAU,CAAC;KACxB;IAED,UAAiB,QAAQ,CAAC,UAAU;QAMlC,EAAE,EAAE,MAAM,CAAC;QAQX,QAAQ,EAAE,YAAY,CAAC;QAOvB,YAAY,CAAC,EAAE,MAAM,CAAC;QAKtB,SAAS,CAAC,EAAE,UAAU,CAAC;KACxB;IAED,UAAiB,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAClD,SAAQ,KAAK,CAAC,UAAU,CAAC;QAIzB,IAAI,EAAE,KAAK,CAAC;KACb;IAED,UAAiB,oBAAoB,CAAC,KAAK,EAAE,UAAU,CACrD,SAAQ,QAAQ,CAAC,UAAU,CAAC;QAI5B,IAAI,EAAE,KAAK,CAAC;KACb;IAED,UAAiB,gBAAgB,CAAC,KAAK;QAMrC,IAAI,EAAE,KAAK,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;KACb;IAED,KAAY,UAAU,CAAC,CAAC,IAAI;QAC1B,MAAM,CAAC,EAAE,CAAC,CAAC;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAQD,MAAM,WAAW,SAAS;IAIxB,SAAS,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,EACnC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,EACpC,UAAU,CAAC,EAAE,OAAO,GACnB,SAAS,GAAG,IAAI,CAAC;IAOpB,YAAY,CAAC,YAAY,EAAE,UAAU,GAAG,GAAG,EACzC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EACvC,UAAU,CAAC,EAAE,OAAO,GACnB,YAAY,GAAG,IAAI,CAAC;IAKvB,UAAU,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACtC,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,GACtD,IAAI,CAAC;IAOR,aAAa,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACzC,OAAO,EAAE,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,GACzD,IAAI,CAAC;IAQR,SAAS,CAAC,KAAK,GAAG,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CAC1E"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.js deleted file mode 100644 index e64cb3d2..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=DataProxy.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.js.map deleted file mode 100644 index 69756757..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/DataProxy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../src/types/DataProxy.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.d.ts deleted file mode 100644 index 4b63d048..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './DataProxy'; -export * from './Cache'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.d.ts.map deleted file mode 100644 index 856e64bc..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.js deleted file mode 100644 index 83309fe1..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./Cache"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.js.map deleted file mode 100644 index 3b77f7b1..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AACA,kDAAwB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.d.ts deleted file mode 100644 index 28514c9f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare function queryFromPojo(obj: any): DocumentNode; -export declare function fragmentFromPojo(obj: any, typename?: string): DocumentNode; -export declare const justTypenameQuery: DocumentNode; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.d.ts.map deleted file mode 100644 index f673d7a3..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKb,MAAM,SAAS,CAAC;AAEjB,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,CAiBpD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAuB1E;AA6CD,eAAO,MAAM,iBAAiB,EAAE,YA2B/B,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.js deleted file mode 100644 index 289e5182..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [op], - }; - return out; -} -exports.queryFromPojo = queryFromPojo; -function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType', - }, - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [frag], - }; - return out; -} -exports.fragmentFromPojo = fragmentFromPojo; -function selectionSetFromObj(obj) { - if (typeof obj === 'number' || - typeof obj === 'boolean' || - typeof obj === 'string' || - typeof obj === 'undefined' || - obj === null) { - return null; - } - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key, - }, - selectionSet: nestedSelSet || undefined, - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections, - }; - return selectionSet; -} -exports.justTypenameQuery = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - ], - }, - }, - ], -}; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.js.map deleted file mode 100644 index 465f5021..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/lib/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAQA,SAAgB,aAAa,CAAC,GAAQ;IACpC,IAAM,EAAE,GAA4B;QAClC,IAAI,EAAE,qBAAqB;QAC3B,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,sBAAsB;SAC9B;QACD,YAAY,EAAE,mBAAmB,CAAC,GAAG,CAAC;KACvC,CAAC;IAEF,IAAM,GAAG,GAAiB;QACxB,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,CAAC,EAAE,CAAC;KAClB,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC;AAjBD,sCAiBC;AAED,SAAgB,gBAAgB,CAAC,GAAQ,EAAE,QAAiB;IAC1D,IAAM,IAAI,GAA2B;QACnC,IAAI,EAAE,oBAAoB;QAC1B,aAAa,EAAE;YACb,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,QAAQ,IAAI,YAAY;aAChC;SACF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,sBAAsB;SAC9B;QACD,YAAY,EAAE,mBAAmB,CAAC,GAAG,CAAC;KACvC,CAAC;IAEF,IAAM,GAAG,GAAiB;QACxB,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,CAAC,IAAI,CAAC;KACpB,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC;AAvBD,4CAuBC;AAED,SAAS,mBAAmB,CAAC,GAAQ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YAAY;yBACpB;wBACD,SAAS,EAAE,EAAE;wBACb,UAAU,EAAE,EAAE;wBACd,YAAY,EAAE,IAAI;qBACnB;iBACF;aACF;SACF;KACF;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/package.json b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/package.json deleted file mode 100644 index 300d28a5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "_from": "apollo-cache@^1.3.5", - "_id": "apollo-cache@1.3.5", - "_inBundle": false, - "_integrity": "sha512-1XoDy8kJnyWY/i/+gLTEbYLnoiVtS8y7ikBr/IfmML4Qb+CM7dEEbIUOjnY716WqmZ/UpXIxTfJsY7rMcqiCXA==", - "_location": "/apollo-cache-inmemory/apollo-cache", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "apollo-cache@^1.3.5", - "name": "apollo-cache", - "escapedName": "apollo-cache", - "rawSpec": "^1.3.5", - "saveSpec": null, - "fetchSpec": "^1.3.5" - }, - "_requiredBy": [ - "/apollo-cache-inmemory" - ], - "_resolved": "https://registry.npmjs.org/apollo-cache/-/apollo-cache-1.3.5.tgz", - "_shasum": "9dbebfc8dbe8fe7f97ba568a224bca2c5d81f461", - "_spec": "apollo-cache@^1.3.5", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-cache-inmemory", - "author": { - "name": "James Baxley", - "email": "james@meteor.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "James Burgess", - "email": "jamesmillerburgess@gmail.com" - } - ], - "dependencies": { - "apollo-utilities": "^1.3.4", - "tslib": "^1.10.0" - }, - "deprecated": false, - "description": "Core abstract of Caching layer for Apollo Client", - "gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "license": "MIT", - "main": "./lib/bundle.cjs.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-cache", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "scripts": { - "build": "tsc -b .", - "bundle": "npx rollup -c rollup.config.js", - "clean": "rm -rf coverage/* lib/*", - "coverage": "jest --coverage", - "lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts && tslint -c \"../../config/tslint.json\" -p tsconfig.json tests/*.ts", - "postbuild": "npm run bundle", - "prebuild": "npm run clean", - "prepare": "npm run lint && npm run build", - "prepublishOnly": "npm run clean && npm run build", - "test": "tsc -p tsconfig.json --noEmit && jest", - "watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.3.5" -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/__snapshots__/utils.ts.snap b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/__snapshots__/utils.ts.snap deleted file mode 100644 index 2a167ec7..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/__snapshots__/utils.ts.snap +++ /dev/null @@ -1,63 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[ - `writing data with no query converts a JavaScript object to a query correctly arrays 1` -] = ` -"query GeneratedClientQuery { - number - bool - nested { - bool2 - undef - nullField - str - } -} -" -`; - -exports[ - `writing data with no query converts a JavaScript object to a query correctly basic 1` -] = ` -"query GeneratedClientQuery { - number - bool - bool2 - undef - nullField - str -} -" -`; - -exports[ - `writing data with no query converts a JavaScript object to a query correctly fragments 1` -] = ` -"fragment GeneratedClientQuery on __FakeType { - number - bool - nested { - bool2 - undef - nullField - str - } -} -" -`; - -exports[ - `writing data with no query converts a JavaScript object to a query correctly nested 1` -] = ` -"query GeneratedClientQuery { - number - bool - nested { - bool2 - undef - nullField - str - } -} -" -`; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/cache.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/cache.ts deleted file mode 100644 index 6f10d7c5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/cache.ts +++ /dev/null @@ -1,149 +0,0 @@ -import gql from 'graphql-tag'; - -import { ApolloCache as Cache } from '../cache'; - -class TestCache extends Cache {} - -describe('abstract cache', () => { - describe('transformDocument', () => { - it('returns the document', () => { - const test = new TestCache(); - expect(test.transformDocument('a')).toBe('a'); - }); - }); - - describe('transformForLink', () => { - it('returns the document', () => { - const test = new TestCache(); - expect(test.transformForLink('a')).toBe('a'); - }); - }); - - describe('readQuery', () => { - it('runs the read method', () => { - const test = new TestCache(); - test.read = jest.fn(); - - test.readQuery({}); - expect(test.read).toBeCalled(); - }); - - it('defaults optimistic to false', () => { - const test = new TestCache(); - test.read = ({ optimistic }) => optimistic; - - expect(test.readQuery({})).toBe(false); - expect(test.readQuery({}, true)).toBe(true); - }); - }); - - describe('readFragment', () => { - it('runs the read method', () => { - const test = new TestCache(); - test.read = jest.fn(); - const fragment = { - id: 'frag', - fragment: gql` - fragment a on b { - name - } - `, - }; - - test.readFragment(fragment); - expect(test.read).toBeCalled(); - }); - - it('defaults optimistic to false', () => { - const test = new TestCache(); - test.read = ({ optimistic }) => optimistic; - const fragment = { - id: 'frag', - fragment: gql` - fragment a on b { - name - } - `, - }; - - expect(test.readFragment(fragment)).toBe(false); - expect(test.readFragment(fragment, true)).toBe(true); - }); - }); - - describe('writeQuery', () => { - it('runs the write method', () => { - const test = new TestCache(); - test.write = jest.fn(); - - test.writeQuery({}); - expect(test.write).toBeCalled(); - }); - }); - - describe('writeFragment', () => { - it('runs the write method', () => { - const test = new TestCache(); - test.write = jest.fn(); - const fragment = { - id: 'frag', - fragment: gql` - fragment a on b { - name - } - `, - }; - - test.writeFragment(fragment); - expect(test.write).toBeCalled(); - }); - }); - - describe('writeData', () => { - it('either writes a fragment or a query', () => { - const test = new TestCache(); - test.read = jest.fn(); - test.writeFragment = jest.fn(); - test.writeQuery = jest.fn(); - - test.writeData({}); - expect(test.writeQuery).toBeCalled(); - - test.writeData({ id: 1 }); - expect(test.read).toBeCalled(); - expect(test.writeFragment).toBeCalled(); - - // Edge case for falsey id - test.writeData({ id: 0 }); - expect(test.read).toHaveBeenCalledTimes(2); - expect(test.writeFragment).toHaveBeenCalledTimes(2); - }); - - it('suppresses read errors', () => { - const test = new TestCache(); - test.read = () => { - throw new Error(); - }; - test.writeFragment = jest.fn(); - - expect(() => test.writeData({ id: 1 })).not.toThrow(); - expect(test.writeFragment).toBeCalled(); - }); - - it('reads __typename from typenameResult or defaults to __ClientData', () => { - const test = new TestCache(); - test.read = () => ({ __typename: 'a' }); - let res; - test.writeFragment = obj => - (res = obj.fragment.definitions[0].typeCondition.name.value); - - test.writeData({ id: 1 }); - expect(res).toBe('a'); - - test.read = () => ({}); - - test.writeData({ id: 1 }); - expect(res).toBe('__ClientData'); - }); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/utils.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/utils.ts deleted file mode 100644 index 953e0e12..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/__tests__/utils.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { print } from 'graphql/language/printer'; -import { queryFromPojo, fragmentFromPojo } from '../utils'; - -describe('writing data with no query', () => { - describe('converts a JavaScript object to a query correctly', () => { - it('basic', () => { - expect( - print( - queryFromPojo({ - number: 5, - bool: true, - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }), - ), - ).toMatchSnapshot(); - }); - - it('nested', () => { - expect( - print( - queryFromPojo({ - number: 5, - bool: true, - nested: { - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }, - }), - ), - ).toMatchSnapshot(); - }); - - it('arrays', () => { - expect( - print( - queryFromPojo({ - number: [5], - bool: [[true]], - nested: [ - { - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }, - ], - }), - ), - ).toMatchSnapshot(); - }); - - it('fragments', () => { - expect( - print( - fragmentFromPojo({ - number: [5], - bool: [[true]], - nested: [ - { - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }, - ], - }), - ), - ).toMatchSnapshot(); - }); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/cache.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/cache.ts deleted file mode 100644 index ab45b1a2..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/cache.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { DocumentNode } from 'graphql'; -import { getFragmentQueryDocument } from 'apollo-utilities'; - -import { DataProxy, Cache } from './types'; -import { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils'; - -export type Transaction = (c: ApolloCache) => void; - -export abstract class ApolloCache implements DataProxy { - // required to implement - // core API - public abstract read( - query: Cache.ReadOptions, - ): T | null; - public abstract write( - write: Cache.WriteOptions, - ): void; - public abstract diff(query: Cache.DiffOptions): Cache.DiffResult; - public abstract watch(watch: Cache.WatchOptions): () => void; - public abstract evict( - query: Cache.EvictOptions, - ): Cache.EvictionResult; - public abstract reset(): Promise; - - // intializer / offline / ssr API - /** - * Replaces existing state in the cache (if any) with the values expressed by - * `serializedState`. - * - * Called when hydrating a cache (server side rendering, or offline storage), - * and also (potentially) during hot reloads. - */ - public abstract restore( - serializedState: TSerialized, - ): ApolloCache; - - /** - * Exposes the cache's complete state, in a serializable format for later restoration. - */ - public abstract extract(optimistic?: boolean): TSerialized; - - // optimistic API - public abstract removeOptimistic(id: string): void; - - // transactional API - public abstract performTransaction( - transaction: Transaction, - ): void; - public abstract recordOptimisticTransaction( - transaction: Transaction, - id: string, - ): void; - - // optional API - public transformDocument(document: DocumentNode): DocumentNode { - return document; - } - // experimental - public transformForLink(document: DocumentNode): DocumentNode { - return document; - } - - // DataProxy API - /** - * - * @param options - * @param optimistic - */ - public readQuery( - options: DataProxy.Query, - optimistic: boolean = false, - ): QueryType | null { - return this.read({ - query: options.query, - variables: options.variables, - optimistic, - }); - } - - public readFragment( - options: DataProxy.Fragment, - optimistic: boolean = false, - ): FragmentType | null { - return this.read({ - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic, - }); - } - - public writeQuery( - options: Cache.WriteQueryOptions, - ): void { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables, - }); - } - - public writeFragment( - options: Cache.WriteFragmentOptions, - ): void { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - }); - } - - public writeData({ - id, - data, - }: Cache.WriteDataOptions): void { - if (typeof id !== 'undefined') { - let typenameResult = null; - // Since we can't use fragments without having a typename in the store, - // we need to make sure we have one. - // To avoid overwriting an existing typename, we need to read it out first - // and generate a fake one if none exists. - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery, - }); - } catch (e) { - // Do nothing, since an error just means no typename exists - } - - // tslint:disable-next-line - const __typename = - (typenameResult && typenameResult.__typename) || '__ClientData'; - - // Add a type here to satisfy the inmemory cache - const dataToWrite = Object.assign({ __typename }, data); - - this.writeFragment({ - id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite, - }); - } else { - this.writeQuery({ query: queryFromPojo(data), data }); - } - } -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/index.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/index.ts deleted file mode 100644 index 18273b71..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './cache'; -export * from './types'; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/Cache.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/Cache.ts deleted file mode 100644 index da6ef0bd..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/Cache.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { DataProxy } from './DataProxy'; - -export namespace Cache { - export type WatchCallback = (newData: any) => void; - export interface EvictionResult { - success: Boolean; - } - - export interface ReadOptions - extends DataProxy.Query { - rootId?: string; - previousResult?: any; - optimistic: boolean; - } - - export interface WriteOptions - extends DataProxy.Query { - dataId: string; - result: TResult; - } - - export interface DiffOptions extends ReadOptions { - returnPartialData?: boolean; - } - - export interface WatchOptions extends ReadOptions { - callback: WatchCallback; - } - - export interface EvictOptions - extends DataProxy.Query { - rootId?: string; - } - - export import DiffResult = DataProxy.DiffResult; - export import WriteQueryOptions = DataProxy.WriteQueryOptions; - export import WriteFragmentOptions = DataProxy.WriteFragmentOptions; - export import WriteDataOptions = DataProxy.WriteDataOptions; - export import Fragment = DataProxy.Fragment; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/DataProxy.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/DataProxy.ts deleted file mode 100644 index 8b85709a..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/DataProxy.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { DocumentNode } from 'graphql'; // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved - -export namespace DataProxy { - export interface Query { - /** - * The GraphQL query shape to be used constructed using the `gql` template - * string tag from `graphql-tag`. The query will be used to determine the - * shape of the data to be read. - */ - query: DocumentNode; - - /** - * Any variables that the GraphQL query may depend on. - */ - variables?: TVariables; - } - - export interface Fragment { - /** - * The root id to be used. This id should take the same form as the - * value returned by your `dataIdFromObject` function. If a value with your - * id does not exist in the store, `null` will be returned. - */ - id: string; - - /** - * A GraphQL document created using the `gql` template string tag from - * `graphql-tag` with one or more fragments which will be used to determine - * the shape of data to read. If you provide more than one fragment in this - * document then you must also specify `fragmentName` to select a single. - */ - fragment: DocumentNode; - - /** - * The name of the fragment in your GraphQL document to be used. If you do - * not provide a `fragmentName` and there is only one fragment in your - * `fragment` document then that fragment will be used. - */ - fragmentName?: string; - - /** - * Any variables that your GraphQL fragments depend on. - */ - variables?: TVariables; - } - - export interface WriteQueryOptions - extends Query { - /** - * The data you will be writing to the store. - */ - data: TData; - } - - export interface WriteFragmentOptions - extends Fragment { - /** - * The data you will be writing to the store. - */ - data: TData; - } - - export interface WriteDataOptions { - /** - * The data you will be writing to the store. - * It also takes an optional id property. - * The id is used to write a fragment to an existing object in the store. - */ - data: TData; - id?: string; - } - - export type DiffResult = { - result?: T; - complete?: boolean; - }; -} - -/** - * A proxy to the normalized data living in our store. This interface allows a - * user to read and write denormalized data which feels natural to the user - * whilst in the background this data is being converted into the normalized - * store format. - */ -export interface DataProxy { - /** - * Reads a GraphQL query from the root query id. - */ - readQuery( - options: DataProxy.Query, - optimistic?: boolean, - ): QueryType | null; - - /** - * Reads a GraphQL fragment from any arbitrary id. If there is more than - * one fragment in the provided document then a `fragmentName` must be - * provided to select the correct fragment. - */ - readFragment( - options: DataProxy.Fragment, - optimistic?: boolean, - ): FragmentType | null; - - /** - * Writes a GraphQL query to the root query id. - */ - writeQuery( - options: DataProxy.WriteQueryOptions, - ): void; - - /** - * Writes a GraphQL fragment to any arbitrary id. If there is more than - * one fragment in the provided document then a `fragmentName` must be - * provided to select the correct fragment. - */ - writeFragment( - options: DataProxy.WriteFragmentOptions, - ): void; - - /** - * Sugar for writeQuery & writeFragment. - * Writes data to the store without passing in a query. - * If you supply an id, the data will be written as a fragment to an existing object. - * Otherwise, the data is written to the root of the store. - */ - writeData(options: DataProxy.WriteDataOptions): void; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/index.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/index.ts deleted file mode 100644 index c44054d6..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/types/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './DataProxy'; -export * from './Cache'; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/utils.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/utils.ts deleted file mode 100644 index 7d88d0b9..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-cache/src/utils.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { - DocumentNode, - OperationDefinitionNode, - SelectionSetNode, - FieldNode, - FragmentDefinitionNode, -} from 'graphql'; - -export function queryFromPojo(obj: any): DocumentNode { - const op: OperationDefinitionNode = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - - const out: DocumentNode = { - kind: 'Document', - definitions: [op], - }; - - return out; -} - -export function fragmentFromPojo(obj: any, typename?: string): DocumentNode { - const frag: FragmentDefinitionNode = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType', - }, - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - - const out: DocumentNode = { - kind: 'Document', - definitions: [frag], - }; - - return out; -} - -function selectionSetFromObj(obj: any): SelectionSetNode { - if ( - typeof obj === 'number' || - typeof obj === 'boolean' || - typeof obj === 'string' || - typeof obj === 'undefined' || - obj === null - ) { - // No selection set here - return null; - } - - if (Array.isArray(obj)) { - // GraphQL queries don't include arrays - return selectionSetFromObj(obj[0]); - } - - // Now we know it's an object - const selections: FieldNode[] = []; - - Object.keys(obj).forEach(key => { - const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]); - - const field: FieldNode = { - kind: 'Field', - name: { - kind: 'Name', - value: key, - }, - selectionSet: nestedSelSet || undefined, - }; - - selections.push(field); - }); - - const selectionSet: SelectionSetNode = { - kind: 'SelectionSet', - selections, - }; - - return selectionSet; -} - -export const justTypenameQuery: DocumentNode = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - ], - }, - }, - ], -}; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/.flowconfig b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/.flowconfig deleted file mode 100644 index ffa2101c..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/.flowconfig +++ /dev/null @@ -1,8 +0,0 @@ -[ignore] - -[include] - -[libs] - -[options] -suppress_comment= \\(.\\|\n\\)*\\$ExpectError diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/CHANGELOG.md b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/CHANGELOG.md deleted file mode 100644 index 2cabb608..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/CHANGELOG.md +++ /dev/null @@ -1,106 +0,0 @@ -# CHANGELOG - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md). - ----- - -### 1.0.16 - -- Removed unnecessary whitespace from error message - [Issue #3398](https://github.com/apollographql/apollo-client/issues/3398) - [PR #3593](https://github.com/apollographql/apollo-client/pull/3593) - -### 1.0.15 - -- No changes - -### 1.0.14 - -- Store key names generated by `getStoreKeyName` now leverage a more - deterministic approach to handling JSON based strings. This prevents store - key names from differing when using `args` like - `{ prop1: 'value1', prop2: 'value2' }` and - `{ prop2: 'value2', prop1: 'value1' }`. - [PR #2869](https://github.com/apollographql/apollo-client/pull/2869) -- Avoid needless `hasOwnProperty` check in `deepFreeze`. - [PR #3545](https://github.com/apollographql/apollo-client/pull/3545) - -### 1.0.13 - -- Make `maybeDeepFreeze` a little more defensive, by always using - `Object.prototype.hasOwnProperty` (to avoid cases where the object being - frozen doesn't have its own `hasOwnProperty`). - [Issue #3426](https://github.com/apollographql/apollo-client/issues/3426) - [PR #3418](https://github.com/apollographql/apollo-client/pull/3418) -- Remove certain small internal caches to prevent memory leaks when using SSR. - [PR #3444](https://github.com/apollographql/apollo-client/pull/3444) - -### 1.0.12 - -- Not documented - -### 1.0.11 - -- `toIdValue` helper now takes an object with `id` and `typename` properties - as the preferred interface - [PR #3159](https://github.com/apollographql/apollo-client/pull/3159) -- Map coverage to original source -- Don't `deepFreeze` in development/test environments if ES6 symbols are - polyfilled - [PR #3082](https://github.com/apollographql/apollo-client/pull/3082) -- Added ability to include or ignore fragments in `getDirectivesFromDocument` - [PR #3010](https://github.com/apollographql/apollo-client/pull/3010) - -### 1.0.9 - -- Dependency updates -- Added getDirectivesFromDocument utility function - [PR #2974](https://github.com/apollographql/apollo-client/pull/2974) - -### 1.0.8 - -- Add client, rest, and export directives to list of known directives - [PR #2949](https://github.com/apollographql/apollo-client/pull/2949) - -### 1.0.7 - -- Fix typo in error message for invalid argument being passed to @skip or - @include directives - [PR #2867](https://github.com/apollographql/apollo-client/pull/2867) - -### 1.0.6 - -- Update `getStoreKeyName` to support custom directives - -### 1.0.5 - -- Package dependency updates - -### 1.0.4 - -- Package dependency updates - -### 1.0.3 - -- Package dependency updates - -### 1.0.2 - -- Improved rollup builds - -### 1.0.1 - -- Added config to remove selection set of directive matches test - -### 1.0.0 - -- Added utilities from hermes cache -- Added removeDirectivesFromDocument to allow cleaning of client only - directives -- Added hasDirectives to recurse the AST and return a boolean for an array of - directive names -- Improved performance of common store actions by memoizing addTypename and - removeConnectionDirective diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/LICENSE b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/jest.config.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/jest.config.js deleted file mode 100644 index 48f0a891..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require('../../config/jest.config.settings'), -}; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.js deleted file mode 100644 index 49d9f007..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.js +++ /dev/null @@ -1,1125 +0,0 @@ -exports.__esModule = true; -exports.addTypenameToDocument = addTypenameToDocument; -exports.argumentsObjectFromField = argumentsObjectFromField; -exports.assign = assign; -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -exports.checkDocument = checkDocument; -exports.cloneDeep = cloneDeep; -exports.createFragmentMap = createFragmentMap; -exports.getDefaultValues = getDefaultValues; -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -exports.getDirectiveNames = getDirectiveNames; -exports.getDirectivesFromDocument = getDirectivesFromDocument; -exports.getEnv = getEnv; -exports.getFragmentDefinition = getFragmentDefinition; -exports.getFragmentDefinitions = getFragmentDefinitions; -exports.getFragmentQueryDocument = getFragmentQueryDocument; -exports.getInclusionDirectives = getInclusionDirectives; -exports.getMainDefinition = getMainDefinition; -exports.getMutationDefinition = getMutationDefinition; -exports.getOperationDefinition = getOperationDefinition; -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -exports.getOperationName = getOperationName; -exports.getQueryDefinition = getQueryDefinition; -exports.getStoreKeyName = getStoreKeyName; -exports.graphQLResultHasError = graphQLResultHasError; -exports.hasClientExports = hasClientExports; -exports.hasDirectives = hasDirectives; -exports.isDevelopment = isDevelopment; -exports.isEnv = isEnv; -exports.isField = isField; -exports.isIdValue = isIdValue; -exports.isInlineFragment = isInlineFragment; -exports.isJsonValue = isJsonValue; -exports.isNumberValue = isNumberValue; -exports.isProduction = isProduction; -exports.isScalarValue = isScalarValue; -exports.isTest = isTest; -exports.maybeDeepFreeze = maybeDeepFreeze; -exports.mergeDeep = mergeDeep; -exports.mergeDeepArray = mergeDeepArray; -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -exports.resultKeyNameFromField = resultKeyNameFromField; -exports.shouldInclude = shouldInclude; -exports.storeKeyNameFromField = storeKeyNameFromField; -exports.stripSymbols = stripSymbols; -exports.toIdValue = toIdValue; -exports.tryFunctionOrLogError = tryFunctionOrLogError; -exports.valueFromNode = valueFromNode; -exports.valueToObjectRepresentation = valueToObjectRepresentation; -exports.variablesInOperation = variablesInOperation; -exports.warnOnceInDevelopment = warnOnceInDevelopment; -exports.canUseWeakMap = exports.isEqual = void 0; - -var _visitor = require("graphql/language/visitor"); - -var _tsInvariant = require("ts-invariant"); - -var _tslib = require("tslib"); - -var _fastJsonStableStringify = _interopRequireDefault(require("fast-json-stable-stringify")); - -var _equality = require("@wry/equality"); - -exports.isEqual = _equality.equal; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value) { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value) { - return value.kind === 'IntValue'; -} - -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} - -function isVariable(value) { - return value.kind === 'Variable'; -} - -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} - -function isListValue(value) { - return value.kind === 'ListValue'; -} - -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} - -function isNullValue(value) { - return value.kind === 'NullValue'; -} - -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } -} - -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - -function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; -} - -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; -} - -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} - -function isField(selection) { - return selection.kind === 'Field'; -} - -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} - -function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; -} - -function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); -} - -function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; -} - -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); -} - -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; -} - -function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; -} - -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); -} - -function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); -} - -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} - -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; -} - -function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} - -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} - -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; -} - -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; -} - -function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; -} - -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); -} - -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} - -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} - -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} - -function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} - -function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; -} - -function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } -}; - -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); -} - -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; -} - -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; -} - -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; -} - -function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); -} - -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } -}; - -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} - -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); -} - -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); -} - -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); -} - -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; -} - -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); -} - -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); -} - -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} - -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; -} - -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); -exports.canUseWeakMap = canUseWeakMap; -var toString = Object.prototype.toString; - -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; -} - -function isEnv(env) { - return getEnv() === env; -} - -function isProduction() { - return isEnv('production') === true; -} - -function isDevelopment() { - return isEnv('development') === true; -} - -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} - -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); -} - -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; -} - -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; -} - -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; -} - -var haveWarned = Object.create({}); - -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.js.map deleted file mode 100644 index a445ea6f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAiDgB,a,CAAc,K,EAAgB;AAC5C,SAAO,CAAC,aAAD,EAAgB,cAAhB,EAAgC,WAAhC,EAA6C,OAA7C,CAAqD,KAAK,CAAC,IAA3D,IAAmE,CAAC,CAA3E;AACD;;AAID,SAAgB,aAAhB,CAA8B,KAA9B,EAA8C;AAC5C,SAAO,CAAC,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ringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.min.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.min.js deleted file mode 100644 index a7ed4e22..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.addTypenameToDocument=function(e){return(0,n.visit)(y(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var i=e.selections;if(i){var o=i.some(function(e){return f(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))});if(!o){var a=t;if(!(f(a)&&a.directives&&a.directives.some(function(e){return"export"===e.name.value})))return(0,r.__assign)((0,r.__assign)({},e),{selections:(0,r.__spreadArrays)(i,[_])})}}}}}})},exports.argumentsObjectFromField=s,exports.assign=x,exports.buildQueryFromSelectionSet=function(e){if("query"===k(e).operation)return e;return(0,n.visit)(e,{OperationDefinition:{enter:function(e){return(0,r.__assign)((0,r.__assign)({},e),{operation:"query"})}}})},exports.checkDocument=y,exports.cloneDeep=function(e){return function e(n,t){switch(M.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach(function(n,i){r[i]=e(n,t)}),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach(function(r){i[r]=e(n[r],t)}),i;default:return n}}(e,new Map)},exports.createFragmentMap=O,exports.getDefaultValues=function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){var n=e.defaultValue;return n}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return a(r,n.name,t),r});return x.apply(void 0,(0,r.__spreadArrays)([{}],n))}return{}},exports.getDirectiveInfoFromField=function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=s(e,n)}),t}return null},exports.getDirectiveNames=m,exports.getDirectivesFromDocument=function(e,t){var i;return y(t),E((0,n.visit)(t,{SelectionSet:{enter:function(n,t,o,a){var u=a.join("-");if(!i||u===i||!u.startsWith(i)){if(n.selections){var c=n.selections.filter(function(n){return I(e,n)});return w(e,n,!1)&&(i=u),(0,r.__assign)((0,r.__assign)({},n),{selections:c})}return null}}}}))},exports.getEnv=J,exports.getFragmentDefinition=D,exports.getFragmentDefinitions=b,exports.getFragmentQueryDocument=function(e,n){var i=n,o=[];e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(11);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&((0,t.invariant)(1===o.length,12),i=o[0].name.value);return(0,r.__assign)((0,r.__assign)({},e),{definitions:(0,r.__spreadArrays)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],e.definitions)})},exports.getInclusionDirectives=g,exports.getMainDefinition=k,exports.getMutationDefinition=function(e){y(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return(0,t.invariant)(n,1),n},exports.getOperationDefinition=h,exports.getOperationDefinitionOrDie=function(e){var n=h(e);return(0,t.invariant)(n,5),n},exports.getOperationName=function(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null},exports.getQueryDefinition=function(e){var n=h(e);return(0,t.invariant)(n&&"query"===n.operation,6),n},exports.getStoreKeyName=c,exports.graphQLResultHasError=function(e){return e.errors&&e.errors.length},exports.hasClientExports=function(e){return e&&p(["client"],e)&&p(["export"],e)},exports.hasDirectives=p,exports.isDevelopment=Q,exports.isEnv=P,exports.isField=f,exports.isIdValue=function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},exports.isInlineFragment=l,exports.isJsonValue=function(e){return null!=e&&"object"==typeof e&&"json"===e.type},exports.isNumberValue=function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},exports.isProduction=L,exports.isScalarValue=function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},exports.isTest=T,exports.maybeDeepFreeze=function(e){if(Q()||T()){var n="function"==typeof Symbol&&"string"==typeof Symbol("");if(!n)return function e(n){Object.freeze(n);Object.getOwnPropertyNames(n).forEach(function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])});return n}(e)}return e},exports.mergeDeep=function(){for(var e=[],n=0;n0){var r=t.connection.filter?t.connection.filter:[];r.sort();var o=n,a={};return r.forEach(function(e){a[e]=o[e]}),t.connection.key+"("+JSON.stringify(a)+")"}return t.connection.key}var c=e;if(n){var s=(0,i.default)(n);c+="("+s+")"}return t&&Object.keys(t).forEach(function(e){-1===u.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?c+="@"+e+"("+JSON.stringify(t[e])+")":c+="@"+e)}),c}function s(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return a(t,r,i,n)}),t}return null}function f(e){return"Field"===e.kind}function l(e){return"InlineFragment"===e.kind}function v(e){throw new t.InvariantError(18)}function m(e){var t=[];return(0,n.visit)(e,{Directive:function(e){t.push(e.name.value)}}),t}function p(e,n){return m(n).some(function(n){return e.indexOf(n)>-1})}function d(e){var n=e.name.value;return"skip"===n||"include"===n}function g(e){return e?e.filter(d).map(function(e){var n=e.arguments;e.name.value;(0,t.invariant)(n&&1===n.length,14);var r=n[0];(0,t.invariant)(r.name&&"if"===r.name.value,15);var i=r.value;return(0,t.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),16),{directive:e,ifArgument:r}}):[]}function x(e){for(var n=[],t=1;t1){var r=[];n=K(n,r);for(var i=1;i -1; -} -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw process.env.NODE_ENV === "production" ? new InvariantError(17) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = stringify(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -function isField(selection) { - return selection.kind === 'Field'; -} -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return __assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new InvariantError(18) : new InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 13) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -function getDirectiveNames(doc) { - var names = []; - visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 14) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 15) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(11) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 12) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = __assign(__assign({}, document), { definitions: __spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} - -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? invariant(mutationDef, 1) : invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? invariant(doc && doc.kind === 'Document', 2) : invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(3) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 4) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? invariant(def, 5) : invariant(def, "GraphQL document is missing an operation"); - return def; -} -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 6) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 7) : invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? invariant(doc.definitions.length <= 1, 8) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 9) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw process.env.NODE_ENV === "production" ? new InvariantError(10) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, __spreadArrays([{}], defaultValues)); - } - return {}; -} -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -function addTypenameToDocument(doc) { - return visit(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return __assign(__assign({}, node), { selections: __spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - process.env.NODE_ENV === "production" || invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return __assign(__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visit(doc, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visit(document, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); - -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -function isEnv(env) { - return getEnv() === env; -} -function isProduction() { - return isEnv('production') === true; -} -function isDevelopment() { - return isEnv('development') === true; -} -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = __assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} - -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} - -export { addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getInclusionDirectives, getMainDefinition, getMutationDefinition, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getQueryDefinition, getStoreKeyName, graphQLResultHasError, hasClientExports, hasDirectives, isDevelopment, isEnv, isField, isIdValue, isInlineFragment, isJsonValue, isNumberValue, isProduction, isScalarValue, isTest, maybeDeepFreeze, mergeDeep, mergeDeepArray, removeArgumentsFromDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, removeDirectivesFromDocument, removeFragmentSpreadFromDocument, resultKeyNameFromField, shouldInclude, storeKeyNameFromField, stripSymbols, toIdValue, tryFunctionOrLogError, valueFromNode, valueToObjectRepresentation, variablesInOperation, warnOnceInDevelopment }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.esm.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.esm.js.map deleted file mode 100644 index 20578090..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\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,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,GAAI,KAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjC;aAAM;YACL,KAAK,cACH,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IACpC,KAAK,CACT,CAAC;SACH;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;CACd;;AChHD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAUrC,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAa;IAAb,qBAAA,EAAA,aAAa;IAC9D,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,CAAC,MAAM,EAAE,EAAE;YACb,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;CACF;;SCZe,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;CACzC;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.umd.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.umd.js deleted file mode 100644 index 4c8a17bb..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.umd.js +++ /dev/null @@ -1,1131 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "graphql/language/visitor", "ts-invariant", "tslib", "fast-json-stable-stringify", "@wry/equality"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("graphql/language/visitor"), require("ts-invariant"), require("tslib"), require("fast-json-stable-stringify"), require("@wry/equality")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.visitor, global.tsInvariant, global.tslib, global.fastJsonStableStringify, global.equality); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _visitor, _tsInvariant, _tslib, _fastJsonStableStringify, _equality) { - - _exports.__esModule = true; - _exports.addTypenameToDocument = addTypenameToDocument; - _exports.argumentsObjectFromField = argumentsObjectFromField; - _exports.assign = assign; - _exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; - _exports.checkDocument = checkDocument; - _exports.cloneDeep = cloneDeep; - _exports.createFragmentMap = createFragmentMap; - _exports.getDefaultValues = getDefaultValues; - _exports.getDirectiveInfoFromField = getDirectiveInfoFromField; - _exports.getDirectiveNames = getDirectiveNames; - _exports.getDirectivesFromDocument = getDirectivesFromDocument; - _exports.getEnv = getEnv; - _exports.getFragmentDefinition = getFragmentDefinition; - _exports.getFragmentDefinitions = getFragmentDefinitions; - _exports.getFragmentQueryDocument = getFragmentQueryDocument; - _exports.getInclusionDirectives = getInclusionDirectives; - _exports.getMainDefinition = getMainDefinition; - _exports.getMutationDefinition = getMutationDefinition; - _exports.getOperationDefinition = getOperationDefinition; - _exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; - _exports.getOperationName = getOperationName; - _exports.getQueryDefinition = getQueryDefinition; - _exports.getStoreKeyName = getStoreKeyName; - _exports.graphQLResultHasError = graphQLResultHasError; - _exports.hasClientExports = hasClientExports; - _exports.hasDirectives = hasDirectives; - _exports.isDevelopment = isDevelopment; - _exports.isEnv = isEnv; - _exports.isField = isField; - _exports.isIdValue = isIdValue; - _exports.isInlineFragment = isInlineFragment; - _exports.isJsonValue = isJsonValue; - _exports.isNumberValue = isNumberValue; - _exports.isProduction = isProduction; - _exports.isScalarValue = isScalarValue; - _exports.isTest = isTest; - _exports.maybeDeepFreeze = maybeDeepFreeze; - _exports.mergeDeep = mergeDeep; - _exports.mergeDeepArray = mergeDeepArray; - _exports.removeArgumentsFromDocument = removeArgumentsFromDocument; - _exports.removeClientSetsFromDocument = removeClientSetsFromDocument; - _exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; - _exports.removeDirectivesFromDocument = removeDirectivesFromDocument; - _exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; - _exports.resultKeyNameFromField = resultKeyNameFromField; - _exports.shouldInclude = shouldInclude; - _exports.storeKeyNameFromField = storeKeyNameFromField; - _exports.stripSymbols = stripSymbols; - _exports.toIdValue = toIdValue; - _exports.tryFunctionOrLogError = tryFunctionOrLogError; - _exports.valueFromNode = valueFromNode; - _exports.valueToObjectRepresentation = valueToObjectRepresentation; - _exports.variablesInOperation = variablesInOperation; - _exports.warnOnceInDevelopment = warnOnceInDevelopment; - _exports.canUseWeakMap = _exports.isEqual = void 0; - _fastJsonStableStringify = _interopRequireDefault(_fastJsonStableStringify); - _exports.isEqual = _equality.equal; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; - } - - function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; - } - - function isStringValue(value) { - return value.kind === 'StringValue'; - } - - function isBooleanValue(value) { - return value.kind === 'BooleanValue'; - } - - function isIntValue(value) { - return value.kind === 'IntValue'; - } - - function isFloatValue(value) { - return value.kind === 'FloatValue'; - } - - function isVariable(value) { - return value.kind === 'Variable'; - } - - function isObjectValue(value) { - return value.kind === 'ObjectValue'; - } - - function isListValue(value) { - return value.kind === 'ListValue'; - } - - function isEnumValue(value) { - return value.kind === 'EnumValue'; - } - - function isNullValue(value) { - return value.kind === 'NullValue'; - } - - function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } - } - - function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); - } - - var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - - function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; - } - - function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; - } - - function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; - } - - function isField(selection) { - return selection.kind === 'Field'; - } - - function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; - } - - function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; - } - - function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); - } - - function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; - } - - function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); - } - - function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } - } - - function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; - } - - function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); - } - - function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; - } - - function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); - } - - function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); - } - - function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; - } - - function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; - } - - function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; - } - - function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; - } - - function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; - } - - function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; - } - - function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; - } - - function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; - } - - function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; - } - - function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); - } - - function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; - } - - function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; - } - - function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); - } - - function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; - } - - function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; - } - - function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; - } - - function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; - } - - var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } - }; - - function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); - } - - function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; - } - - function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; - } - - function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; - } - - function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); - } - - var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } - }; - - function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); - } - - function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); - } - - function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); - } - - function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); - } - - function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; - } - - function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); - } - - function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); - } - - function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; - } - - function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; - } - - function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; - } - - var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); - _exports.canUseWeakMap = canUseWeakMap; - var toString = Object.prototype.toString; - - function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); - } - - function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } - } - - function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; - } - - function isEnv(env) { - return getEnv() === env; - } - - function isProduction() { - return isEnv('production') === true; - } - - function isDevelopment() { - return isEnv('development') === true; - } - - function isTest() { - return isEnv('test') === true; - } - - function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } - } - - function graphQLResultHasError(result) { - return result.errors && result.errors.length; - } - - function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; - } - - function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); - } - - function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; - } - - function isObject(obj) { - return obj !== null && typeof obj === 'object'; - } - - function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; - } - - function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; - } - - var haveWarned = Object.create({}); - - function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } - } - - function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); - } - -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.umd.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.umd.js.map deleted file mode 100644 index e69270f6..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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d;AACD,OAFD,MAEO;AACL,QAAA,OAAO,CAAC,IAAR,CAAa,GAAb;AACD;AACF;AACF;;WCZe,Y,CAAgB,I,EAAO;AACrC,WAAO,IAAI,CAAC,KAAL,CAAW,IAAI,CAAC,SAAL,CAAe,IAAf,CAAX,CAAP;AACD,G","sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.d.ts deleted file mode 100644 index ea10f218..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { FieldNode, SelectionNode, DirectiveNode, DocumentNode, ArgumentNode } from 'graphql'; -export declare type DirectiveInfo = { - [fieldName: string]: { - [argName: string]: any; - }; -}; -export declare function getDirectiveInfoFromField(field: FieldNode, variables: Object): DirectiveInfo; -export declare function shouldInclude(selection: SelectionNode, variables?: { - [name: string]: any; -}): boolean; -export declare function getDirectiveNames(doc: DocumentNode): string[]; -export declare function hasDirectives(names: string[], doc: DocumentNode): boolean; -export declare function hasClientExports(document: DocumentNode): boolean; -export declare type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; -export declare function getInclusionDirectives(directives: ReadonlyArray): InclusionDirectives; -//# sourceMappingURL=directives.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.d.ts.map deleted file mode 100644 index 4da04b61..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["src/directives.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,aAAa,EAGb,aAAa,EACb,YAAY,EACZ,YAAY,EAEb,MAAM,SAAS,CAAC;AAQjB,oBAAY,aAAa,GAAG;IAC1B,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,GAChB,aAAa,CAYf;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,aAAa,EACxB,SAAS,GAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAO,GACtC,OAAO,CAgBT;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,YAUlD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,YAAY,WAI/D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,WAMtD;AAED,oBAAY,mBAAmB,GAAG,KAAK,CAAC;IACtC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B,CAAC,CAAC;AAMH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,GACvC,mBAAmB,CA2BrB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.js deleted file mode 100644 index 41a8a9d4..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var visitor_1 = require("graphql/language/visitor"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = storeUtils_1.argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - ts_invariant_1.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -exports.shouldInclude = shouldInclude; -function getDirectiveNames(doc) { - var names = []; - visitor_1.visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -exports.getDirectiveNames = getDirectiveNames; -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -exports.hasDirectives = hasDirectives; -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -exports.hasClientExports = hasClientExports; -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - ts_invariant_1.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - ts_invariant_1.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - ts_invariant_1.invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} -exports.getInclusionDirectives = getInclusionDirectives; -//# sourceMappingURL=directives.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.js.map deleted file mode 100644 index 915e07f2..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/directives.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;AAaA,oDAAiD;AAEjD,6CAAyC;AAEzC,2CAAwD;AAMxD,SAAgB,yBAAyB,CACvC,KAAgB,EAChB,SAAiB;IAEjB,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE;QAC/C,IAAM,cAAY,GAAkB,EAAE,CAAC;QACvC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAwB;YAChD,cAAY,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,qCAAwB,CAC3D,SAAS,EACT,SAAS,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,cAAY,CAAC;KACrB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAfD,8DAeC;AAED,SAAgB,aAAa,CAC3B,SAAwB,EACxB,SAAuC;IAAvC,0BAAA,EAAA,cAAuC;IAEvC,OAAO,sBAAsB,CAC3B,SAAS,CAAC,UAAU,CACrB,CAAC,KAAK,CAAC,UAAC,EAAyB;YAAvB,wBAAS,EAAE,0BAAU;QAC9B,IAAI,WAAW,GAAY,KAAK,CAAC;QACjC,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;YACxC,WAAW,GAAG,SAAS,CAAE,UAAU,CAAC,KAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvE,wBAAS,CACP,WAAW,KAAK,KAAK,CAAC,EACtB,qCAAmC,SAAS,CAAC,IAAI,CAAC,KAAK,gBAAa,CACrE,CAAC;SACH;aAAM;YACL,WAAW,GAAI,UAAU,CAAC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,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;QAE3C,wBAAS,CACP,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EACrD,4CAA0C,aAAa,gBAAa,CACrE,CAAC;QAEF,IAAM,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACzC,wBAAS,CACP,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,EACjD,+BAA6B,aAAa,gBAAa,CACxD,CAAC;QAEF,IAAM,OAAO,GAAc,UAAU,CAAC,KAAK,CAAC;QAG5C,wBAAS,CACP,OAAO;YACL,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,EAClE,uBAAqB,aAAa,sDAAmD,CACtF,CAAC;QAEF,OAAO,EAAE,SAAS,WAAA,EAAE,UAAU,YAAA,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACV,CAAC;AA7BD,wDA6BC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.d.ts deleted file mode 100644 index 8b1f2312..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode; -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.d.ts.map deleted file mode 100644 index cbff38a8..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["src/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,SAAS,CAAC;AAyB/D,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,YAAY,CA+Dd"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.js deleted file mode 100644 index 5b6e8f87..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - ts_invariant_1.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = tslib_1.__assign(tslib_1.__assign({}, document), { definitions: tslib_1.__spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} -exports.getFragmentQueryDocument = getFragmentQueryDocument; -//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.js.map deleted file mode 100644 index ece1e375..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/fragments.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../src/fragments.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAwBzD,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAKtC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,UAAU;QAGrC,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,IAAI,6BAAc,CACtB,aAAW,UAAU,CAAC,SAAS,mBAC7B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,aAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,QACxD;gBACF,yFAAyF,CAC5F,CAAC;SACH;QAGD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC5C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC5B;IACH,CAAC,CAAC,CAAC;IAIH,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;QAC7C,wBAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,WACE,SAAS,CAAC,MAAM,sFACmE,CACtF,CAAC;QACF,kBAAkB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9C;IAID,IAAM,KAAK,yCACN,QAAQ,KACX,WAAW;YACT;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,SAAS,EAAE,OAAO;gBAClB,YAAY,EAAE;oBACZ,IAAI,EAAE,cAAc;oBACpB,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,gBAAgB;4BACtB,IAAI,EAAE;gCACJ,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,kBAAkB;6BAC1B;yBACF;qBACF;iBACF;aACF;WACE,QAAQ,CAAC,WAAW,IAE1B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAlED,4DAkEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.d.ts deleted file mode 100644 index 57050319..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from 'graphql'; -import { JsonValue } from './storeUtils'; -export declare function getMutationDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function checkDocument(doc: DocumentNode): DocumentNode; -export declare function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined; -export declare function getOperationDefinitionOrDie(document: DocumentNode): OperationDefinitionNode; -export declare function getOperationName(doc: DocumentNode): string | null; -export declare function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[]; -export declare function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode; -export declare function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode; -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} -export declare function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap; -export declare function getDefaultValues(definition: OperationDefinitionNode | undefined): { - [key: string]: JsonValue; -}; -export declare function variablesInOperation(operation: OperationDefinitionNode): Set; -//# sourceMappingURL=getFromAST.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.d.ts.map deleted file mode 100644 index ef2f9946..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"getFromAST.d.ts","sourceRoot":"","sources":["src/getFromAST.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,uBAAuB,CAYzB;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,gBA0B9C;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,uBAAuB,GAAG,SAAS,CAKrC;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,YAAY,GACrB,uBAAuB,CAIzB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CASjE;AAGD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,sBAAsB,EAAE,CAI1B;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,uBAAuB,CAS7E;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,sBAAsB,CAoBxB;AAOD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,YAAY,GACrB,uBAAuB,GAAG,sBAAsB,CA8BlD;AAKD,MAAM,WAAW,WAAW;IAC1B,CAAC,YAAY,EAAE,MAAM,GAAG,sBAAsB,CAAC;CAChD;AAID,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,sBAAsB,EAAO,GACvC,WAAW,CAOb;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,uBAAuB,GAAG,SAAS,GAC9C;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAyB9B;AAKD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,uBAAuB,GACjC,GAAG,CAAC,MAAM,CAAC,CASb"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.js deleted file mode 100644 index 39f4e5aa..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -var assign_1 = require("./util/assign"); -var storeUtils_1 = require("./storeUtils"); -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - ts_invariant_1.invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -exports.getMutationDefinition = getMutationDefinition; -function checkDocument(doc) { - ts_invariant_1.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - ts_invariant_1.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -exports.checkDocument = checkDocument; -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -exports.getOperationDefinition = getOperationDefinition; -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - ts_invariant_1.invariant(def, "GraphQL document is missing an operation"); - return def; -} -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -exports.getOperationName = getOperationName; -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -exports.getFragmentDefinitions = getFragmentDefinitions; -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - ts_invariant_1.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -exports.getQueryDefinition = getQueryDefinition; -function getFragmentDefinition(doc) { - ts_invariant_1.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - ts_invariant_1.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - ts_invariant_1.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -exports.getFragmentDefinition = getFragmentDefinition; -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw new ts_invariant_1.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -exports.getMainDefinition = getMainDefinition; -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -exports.createFragmentMap = createFragmentMap; -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - storeUtils_1.valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign_1.assign.apply(void 0, tslib_1.__spreadArrays([{}], defaultValues)); - } - return {}; -} -exports.getDefaultValues = getDefaultValues; -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} -exports.variablesInOperation = variablesInOperation; -//# sourceMappingURL=getFromAST.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.js.map deleted file mode 100644 index 88d74a5f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/getFromAST.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"getFromAST.js","sourceRoot":"","sources":["../src/getFromAST.ts"],"names":[],"mappings":";;;AAOA,6CAAyD;AAEzD,wCAAuC;AAEvC,2CAAsE;AAEtE,SAAgB,qBAAqB,CACnC,GAAiB;IAEjB,aAAa,CAAC,GAAG,CAAC,CAAC;IAEnB,IAAI,WAAW,GAAmC,GAAG,CAAC,WAAW,CAAC,MAAM,CACtE,UAAA,UAAU;QACR,OAAA,UAAU,CAAC,IAAI,KAAK,qBAAqB;YACzC,UAAU,CAAC,SAAS,KAAK,UAAU;IADnC,CACmC,CACtC,CAAC,CAAC,CAA4B,CAAC;IAEhC,wBAAS,CAAC,WAAW,EAAE,qCAAqC,CAAC,CAAC;IAE9D,OAAO,WAAW,CAAC;AACrB,CAAC;AAdD,sDAcC;AAGD,SAAgB,aAAa,CAAC,GAAiB;IAC7C,wBAAS,CACP,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O,EAAE,CAAC;AACZ,CAAC;AA3BD,4CA2BC;AAKD,SAAgB,oBAAoB,CAClC,SAAkC;IAElC,IAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,IAAI,SAAS,CAAC,mBAAmB,EAAE;QACjC,KAAyB,UAA6B,EAA7B,KAAA,SAAS,CAAC,mBAAmB,EAA7B,cAA6B,EAA7B,IAA6B,EAAE;YAAnD,IAAM,UAAU,SAAA;YACnB,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC3C;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAXD,oDAWC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.d.ts deleted file mode 100644 index 6e84d9df..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.d.ts.map deleted file mode 100644 index 65614a63..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.js deleted file mode 100644 index 0693303c..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./directives"), exports); -tslib_1.__exportStar(require("./fragments"), exports); -tslib_1.__exportStar(require("./getFromAST"), exports); -tslib_1.__exportStar(require("./transform"), exports); -tslib_1.__exportStar(require("./storeUtils"), exports); -tslib_1.__exportStar(require("./util/assign"), exports); -tslib_1.__exportStar(require("./util/canUse"), exports); -tslib_1.__exportStar(require("./util/cloneDeep"), exports); -tslib_1.__exportStar(require("./util/environment"), exports); -tslib_1.__exportStar(require("./util/errorHandling"), exports); -tslib_1.__exportStar(require("./util/isEqual"), exports); -tslib_1.__exportStar(require("./util/maybeDeepFreeze"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -tslib_1.__exportStar(require("./util/warnOnce"), exports); -tslib_1.__exportStar(require("./util/stripSymbols"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.js.map deleted file mode 100644 index 3c41b701..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,wDAA8B;AAC9B,2DAAiC;AACjC,6DAAmC;AACnC,+DAAqC;AACrC,yDAA+B;AAC/B,iEAAuC;AACvC,2DAAiC;AACjC,0DAAgC;AAChC,8DAAoC;AACpC,2DAAiC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.d.ts deleted file mode 100644 index 4ac253c6..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { DirectiveNode, FieldNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, EnumValueNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode } from 'graphql'; -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} -export interface JsonValue { - type: 'json'; - json: any; -} -export declare type ListValue = Array; -export declare type StoreValue = number | string | string[] | IdValue | ListValue | JsonValue | null | undefined | void | Object; -export declare type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; -export declare function isScalarValue(value: ValueNode): value is ScalarValue; -export declare type NumberValue = IntValueNode | FloatValueNode; -export declare function isNumberValue(value: ValueNode): value is NumberValue; -export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void; -export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string; -export declare type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; -export declare function getStoreKeyName(fieldName: string, args?: Object, directives?: Directives): string; -export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables: Object): Object; -export declare function resultKeyNameFromField(field: FieldNode): string; -export declare function isField(selection: SelectionNode): selection is FieldNode; -export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode; -export declare function isIdValue(idObject: StoreValue): idObject is IdValue; -export declare type IdConfig = { - id: string; - typename: string | undefined; -}; -export declare function toIdValue(idConfig: string | IdConfig, generated?: boolean): IdValue; -export declare function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue; -export declare type VariableValue = (node: VariableNode) => any; -export declare function valueFromNode(node: ValueNode, onVariable?: VariableValue): any; -//# sourceMappingURL=storeUtils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.d.ts.map deleted file mode 100644 index 531a9645..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["src/storeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAGhB,aAAa,EAEb,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;CACX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,EAAE,aAAa,GACvB,SAAS,IAAI,kBAAkB,CAEjC;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,IAAI,OAAO,CAInE;AAED,oBAAY,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAC3B,SAAS,UAAQ,GAChB,OAAO,CAQT;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,SAAS,CAM3E;AAMD,oBAAY,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC;AAKxD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,EACf,UAAU,GAAE,aAAwC,GACnD,GAAG,CAsBL"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.js deleted file mode 100644 index bf04bfb1..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.js +++ /dev/null @@ -1,225 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var fast_json_stable_stringify_1 = tslib_1.__importDefault(require("fast-json-stable-stringify")); -var ts_invariant_1 = require("ts-invariant"); -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} -exports.isScalarValue = isScalarValue; -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -exports.isNumberValue = isNumberValue; -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw new ts_invariant_1.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -exports.valueToObjectRepresentation = valueToObjectRepresentation; -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -exports.storeKeyNameFromField = storeKeyNameFromField; -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = fast_json_stable_stringify_1.default(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -exports.getStoreKeyName = getStoreKeyName; -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -exports.argumentsObjectFromField = argumentsObjectFromField; -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -exports.resultKeyNameFromField = resultKeyNameFromField; -function isField(selection) { - return selection.kind === 'Field'; -} -exports.isField = isField; -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -exports.isInlineFragment = isInlineFragment; -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -exports.isIdValue = isIdValue; -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return tslib_1.__assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -exports.toIdValue = toIdValue; -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -exports.isJsonValue = isJsonValue; -function defaultValueFromVariable(node) { - throw new ts_invariant_1.InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} -exports.valueFromNode = valueFromNode; -//# sourceMappingURL=storeUtils.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.js.map deleted file mode 100644 index bb07be7f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/storeUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.js","sourceRoot":"","sources":["../src/storeUtils.ts"],"names":[],"mappings":";;;AAkBA,kGAAmD;AACnD,6CAA8C;AA8B9C,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/E,CAAC;AAFD,sCAEC;AAID,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,C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W,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;gBAA5B,IAAM,KAAK,SAAA;gBACd,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aAClE;YACD,OAAO,KAAK,CAAC;SACd;QACD;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;AACH,CAAC;AAzBD,sCAyBC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.d.ts deleted file mode 100644 index f359faf5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { DocumentNode, DirectiveNode, FragmentDefinitionNode, ArgumentNode, FragmentSpreadNode, VariableDefinitionNode } from 'graphql'; -export declare type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; -export declare type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; -export declare type RemoveDirectiveConfig = RemoveNodeConfig; -export declare type GetDirectiveConfig = GetNodeConfig; -export declare type RemoveArgumentsConfig = RemoveNodeConfig; -export declare type GetFragmentSpreadConfig = GetNodeConfig; -export declare type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export declare type RemoveFragmentDefinitionConfig = RemoveNodeConfig; -export declare type RemoveVariableDefinitionConfig = RemoveNodeConfig; -export declare function removeDirectivesFromDocument(directives: RemoveDirectiveConfig[], doc: DocumentNode): DocumentNode | null; -export declare function addTypenameToDocument(doc: DocumentNode): DocumentNode; -export declare function removeConnectionDirectiveFromDocument(doc: DocumentNode): DocumentNode; -export declare function getDirectivesFromDocument(directives: GetDirectiveConfig[], doc: DocumentNode): DocumentNode; -export declare function removeArgumentsFromDocument(config: RemoveArgumentsConfig[], doc: DocumentNode): DocumentNode; -export declare function removeFragmentSpreadFromDocument(config: RemoveFragmentSpreadConfig[], doc: DocumentNode): DocumentNode; -export declare function buildQueryFromSelectionSet(document: DocumentNode): DocumentNode; -export declare function removeClientSetsFromDocument(document: DocumentNode): DocumentNode | null; -//# sourceMappingURL=transform.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.d.ts.map deleted file mode 100644 index 5d6140be..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAgBjB,oBAAY,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,oBAAY,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;CAC7B,CAAC;AAEF,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACpE,oBAAY,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;AAC9D,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACnE,oBAAY,uBAAuB,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACxE,oBAAY,0BAA0B,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAC9E,oBAAY,8BAA8B,GAAG,gBAAgB,CAC3D,sBAAsB,CACvB,CAAC;AACF,oBAAY,8BAA8B,GAAG,gBAAgB,CAC3D,sBAAsB,CACvB,CAAC;AA0CF,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,qBAAqB,EAAE,EACnC,GAAG,EAAE,YAAY,GAChB,YAAY,GAAG,IAAI,CAiHrB;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,CAkDrE;AAqBD,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,YAAY,gBAKtE;AAwCD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,kBAAkB,EAAE,EAChC,GAAG,EAAE,YAAY,GAChB,YAAY,CAqCd;AAeD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,qBAAqB,EAAE,EAC/B,GAAG,EAAE,YAAY,GAChB,YAAY,CAgDd;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,0BAA0B,EAAE,EACpC,GAAG,EAAE,YAAY,GAChB,YAAY,CAed;AA0BD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,YAAY,GACrB,YAAY,CAqBd;AAGD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,YAAY,GACrB,YAAY,GAAG,IAAI,CAoCrB"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.js deleted file mode 100644 index b85155c5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.js +++ /dev/null @@ -1,311 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var visitor_1 = require("graphql/language/visitor"); -var getFromAST_1 = require("./getFromAST"); -var filterInPlace_1 = require("./util/filterInPlace"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getFromAST_1.getOperationDefinition(doc) || getFromAST_1.getFragmentDefinition(doc), getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visitor_1.visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace_1.filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace_1.filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -function addTypenameToDocument(doc) { - return visitor_1.visit(getFromAST_1.checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (storeUtils_1.isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (storeUtils_1.isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: tslib_1.__spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -exports.addTypenameToDocument = addTypenameToDocument; -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - ts_invariant_1.invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], getFromAST_1.checkDocument(doc)); -} -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!storeUtils_1.isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - getFromAST_1.checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visitor_1.visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -exports.getDirectivesFromDocument = getDirectivesFromDocument; -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visitor_1.visit(doc, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visitor_1.visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((storeUtils_1.isField(selection) || storeUtils_1.isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getFromAST_1.getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visitor_1.visit(document, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -function removeClientSetsFromDocument(document) { - getFromAST_1.checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visitor_1.visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return storeUtils_1.isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.js.map deleted file mode 100644 index 4ea09818..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/transform.js.map +++ /dev/null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B,IAAI,WAAW,GAAG,4BAA4B,CAC5C;QACE;YACE,IAAI,EAAE,UAAC,SAAwB,IAAK,OAAA,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAjC,CAAiC;YACrE,MAAM,EAAE,IAAI;SACb;KACF,EACD,QAAQ,CACT,CAAC;IAMF,IAAI,WAAW,EAAE;QACf,WAAW,GAAG,eAAK,CAAC,WAAW,EAAE;YAC/B,kBAAkB,EAAE;gBAClB,KAAK,YAAC,IAAI;oBACR,IAAI,IAAI,CAAC,YAAY,EAAE;wBACrB,IAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CACvD,UAAA,SAAS;4BACP,OAAA,oBAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY;wBAA3D,CAA2D,CAC9D,CAAC;wBACF,IAAI,cAAc,EAAE;4BAClB,OAAO,IAAI,CAAC;yBACb;qBACF;gBACH,CAAC;aACF;SACF,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAtCD,oEAsCC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.d.ts deleted file mode 100644 index 306bddf7..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function assign(a: A, b: B): A & B; -export declare function assign(a: A, b: B, c: C): A & B & C; -export declare function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export declare function assign(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E; -export declare function assign(target: any, ...sources: Array): any; -//# sourceMappingURL=assign.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.d.ts.map deleted file mode 100644 index 20e9dbff..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/util/assign.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChD,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1E,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAClC,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACrB,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.js deleted file mode 100644 index 78e39015..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} -exports.assign = assign; -//# sourceMappingURL=assign.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.js.map deleted file mode 100644 index 6a697cc9..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/assign.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.js","sourceRoot":"","sources":["../../src/util/assign.ts"],"names":[],"mappings":";;AAiBA,SAAgB,MAAM,CACpB,MAA8B;IAC9B,iBAAyC;SAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;QAAzC,gCAAyC;;IAEzC,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM;QACpB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,IAAI,EAAE;YACpD,OAAO;SACR;QACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.d.ts deleted file mode 100644 index 53d76ab7..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const canUseWeakMap: boolean; -//# sourceMappingURL=canUse.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.d.ts.map deleted file mode 100644 index 74a2206a..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.d.ts","sourceRoot":"","sources":["../src/util/canUse.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAGzB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.js deleted file mode 100644 index c8caab97..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); -//# sourceMappingURL=canUse.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.js.map deleted file mode 100644 index e0e5e566..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/canUse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../src/util/canUse.ts"],"names":[],"mappings":";;AAAa,QAAA,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,IAAI,CAAC,CAC7D,OAAO,SAAS,KAAK,QAAQ;IAC7B,SAAS,CAAC,OAAO,KAAK,aAAa,CACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts deleted file mode 100644 index 61525aad..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function cloneDeep(value: T): T; -//# sourceMappingURL=cloneDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map deleted file mode 100644 index a871948f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cloneDeep.d.ts","sourceRoot":"","sources":["../src/util/cloneDeep.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAExC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.js deleted file mode 100644 index 8fbfb3fe..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -exports.cloneDeep = cloneDeep; -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} -//# sourceMappingURL=cloneDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.js.map deleted file mode 100644 index 36015d2d..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/cloneDeep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../src/util/cloneDeep.ts"],"names":[],"mappings":";;AAAQ,IAAA,oCAAQ,CAAsB;AAKtC,SAAgB,SAAS,CAAI,KAAQ;IACnC,OAAO,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAFD,8BAEC;AAED,SAAS,eAAe,CAAI,GAAM,EAAE,IAAmB;IACrD,QAAQ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC5B,KAAK,gBAAgB,CAAC,CAAC;YACrB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAM,MAAI,GAAe,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAI,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;gBAC7B,MAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED,KAAK,iBAAiB,CAAC,CAAC;YACtB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAGxC,IAAM,MAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;gBAC1B,MAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED;YACE,OAAO,GAAG,CAAC;KACZ;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.d.ts deleted file mode 100644 index 3dac4c1b..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function getEnv(): string | undefined; -export declare function isEnv(env: string): boolean; -export declare function isProduction(): boolean; -export declare function isDevelopment(): boolean; -export declare function isTest(): boolean; -//# sourceMappingURL=environment.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.d.ts.map deleted file mode 100644 index ac39af26..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/util/environment.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAO3C;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1C;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,wBAAgB,MAAM,IAAI,OAAO,CAEhC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.js deleted file mode 100644 index 13f120ef..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -exports.getEnv = getEnv; -function isEnv(env) { - return getEnv() === env; -} -exports.isEnv = isEnv; -function isProduction() { - return isEnv('production') === true; -} -exports.isProduction = isProduction; -function isDevelopment() { - return isEnv('development') === true; -} -exports.isDevelopment = isDevelopment; -function isTest() { - return isEnv('test') === true; -} -exports.isTest = isTest; -//# sourceMappingURL=environment.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.js.map deleted file mode 100644 index d7b9e1ae..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/environment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/util/environment.ts"],"names":[],"mappings":";;AAAA,SAAgB,MAAM;IACpB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;QAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC7B;IAGD,OAAO,aAAa,CAAC;AACvB,CAAC;AAPD,wBAOC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,MAAM,EAAE,KAAK,GAAG,CAAC;AAC1B,CAAC;AAFD,sBAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AACtC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAFD,sCAEC;AAED,SAAgB,MAAM;IACpB,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAChC,CAAC;AAFD,wBAEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.d.ts deleted file mode 100644 index d1d25c33..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ExecutionResult } from 'graphql'; -export declare function tryFunctionOrLogError(f: Function): any; -export declare function graphQLResultHasError(result: ExecutionResult): number; -//# sourceMappingURL=errorHandling.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map deleted file mode 100644 index 6955d016..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../src/util/errorHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,OAQhD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,UAE5D"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.js deleted file mode 100644 index a9955e19..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -exports.tryFunctionOrLogError = tryFunctionOrLogError; -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} -exports.graphQLResultHasError = graphQLResultHasError; -//# sourceMappingURL=errorHandling.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.js.map deleted file mode 100644 index 52b9fb6b..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/errorHandling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../src/util/errorHandling.ts"],"names":[],"mappings":";;AAEA,SAAgB,qBAAqB,CAAC,CAAW;IAC/C,IAAI;QACF,OAAO,CAAC,EAAE,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;KACF;AACH,CAAC;AARD,sDAQC;AAED,SAAgB,qBAAqB,CAAC,MAAuB;IAC3D,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC/C,CAAC;AAFD,sDAEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts deleted file mode 100644 index 429feb86..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function filterInPlace(array: T[], test: (elem: T) => boolean, context?: any): T[]; -//# sourceMappingURL=filterInPlace.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map deleted file mode 100644 index c45757b7..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.d.ts","sourceRoot":"","sources":["../src/util/filterInPlace.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAC1B,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,EAAE,CASL"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.js deleted file mode 100644 index 66b9dd6e..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} -exports.filterInPlace = filterInPlace; -//# sourceMappingURL=filterInPlace.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.js.map deleted file mode 100644 index d0e2a7dc..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/filterInPlace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.js","sourceRoot":"","sources":["../../src/util/filterInPlace.ts"],"names":[],"mappings":";;AAAA,SAAgB,aAAa,CAC3B,KAAU,EACV,IAA0B,EAC1B,OAAa;IAEb,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE;YACnC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;SACxB;IACH,CAAC,EAAE,OAAO,CAAC,CAAC;IACZ,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,sCAaC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.d.ts deleted file mode 100644 index fe095067..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; -//# sourceMappingURL=isEqual.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map deleted file mode 100644 index d2078c93..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../src/util/isEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.js deleted file mode 100644 index f7d228c8..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var equality_1 = require("@wry/equality"); -exports.isEqual = equality_1.equal; -//# sourceMappingURL=isEqual.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.js.map deleted file mode 100644 index c6fe9ba5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/isEqual.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.js","sourceRoot":"","sources":["../../src/util/isEqual.ts"],"names":[],"mappings":";;AAAA,0CAAiD;AAAxC,6BAAA,KAAK,CAAW"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts deleted file mode 100644 index e5c569ee..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function maybeDeepFreeze(obj: any): any; -//# sourceMappingURL=maybeDeepFreeze.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map deleted file mode 100644 index 99cb3ef8..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.d.ts","sourceRoot":"","sources":["../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,OAYvC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js deleted file mode 100644 index 2f7b836d..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (environment_1.isDevelopment() || environment_1.isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} -exports.maybeDeepFreeze = maybeDeepFreeze; -//# sourceMappingURL=maybeDeepFreeze.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map deleted file mode 100644 index ea62a05d..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AAItD,SAAS,UAAU,CAAC,CAAM;IACxB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEjB,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;QACjD,IACE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI;YAChB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;YAC9D,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EACzB;YACA,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,eAAe,CAAC,GAAQ;IACtC,IAAI,2BAAa,EAAE,IAAI,oBAAM,EAAE,EAAE;QAG/B,IAAM,kBAAkB,GACtB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC;QAEjE,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;SACxB;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAZD,0CAYC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts deleted file mode 100644 index d3c18919..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare type TupleToIntersection = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any; -export declare function mergeDeep(...sources: T): TupleToIntersection; -export declare function mergeDeepArray(sources: T[]): T; -//# sourceMappingURL=mergeDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map deleted file mode 100644 index d95732fc..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.d.ts","sourceRoot":"","sources":["../src/util/mergeDeep.ts"],"names":[],"mappings":"AAgBA,oBAAY,mBAAmB,CAAC,CAAC,SAAS,GAAG,EAAE,IAC7C,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GACvB,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GACpC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACjD,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC9D,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC3E,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;AAElC,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EACvC,GAAG,OAAO,EAAE,CAAC,GACZ,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAQD,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAWjD"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.js deleted file mode 100644 index e4100a26..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -exports.mergeDeep = mergeDeep; -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -exports.mergeDeepArray = mergeDeepArray; -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = tslib_1.__assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} -//# sourceMappingURL=mergeDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.js.map deleted file mode 100644 index 20393f8f..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/mergeDeep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.js","sourceRoot":"","sources":["../../src/util/mergeDeep.ts"],"names":[],"mappings":";;;AAAQ,IAAA,gDAAc,CAAsB;AAwB5C,SAAgB,SAAS;IACvB,iBAAa;SAAb,UAAa,EAAb,qBAAa,EAAb,IAAa;QAAb,4BAAa;;IAEb,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAJD,8BAIC;AAQD,SAAgB,cAAc,CAAI,OAAY;IAC5C,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAO,CAAC;IACnC,IAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7B,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,IAAM,UAAU,GAAU,EAAE,CAAC;QAC7B,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE;YAC9B,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;SACtD;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,wCAWC;AAED,SAAS,QAAQ,CA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AM;YACL,KAAK,sBACH,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IACpC,KAAK,CACT,CAAC;SACH;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts deleted file mode 100644 index 48d2b7cb..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function stripSymbols(data: T): T; -//# sourceMappingURL=stripSymbols.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map deleted file mode 100644 index 9e0384d8..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.d.ts","sourceRoot":"","sources":["../src/util/stripSymbols.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAE1C"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.js deleted file mode 100644 index bc978e58..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} -exports.stripSymbols = stripSymbols; -//# sourceMappingURL=stripSymbols.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.js.map deleted file mode 100644 index 3bbcc9c5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/stripSymbols.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.js","sourceRoot":"","sources":["../../src/util/stripSymbols.ts"],"names":[],"mappings":";;AAWA,SAAgB,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.d.ts deleted file mode 100644 index 0b7c1897..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function warnOnceInDevelopment(msg: string, type?: string): void; -//# sourceMappingURL=warnOnce.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map deleted file mode 100644 index 1b652a3c..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.d.ts","sourceRoot":"","sources":["../src/util/warnOnce.ts"],"names":[],"mappings":"AAYA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAS,QAW/D"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.js b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.js deleted file mode 100644 index 167ba8f0..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!environment_1.isProduction() && !haveWarned[msg]) { - if (!environment_1.isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} -exports.warnOnceInDevelopment = warnOnceInDevelopment; -//# sourceMappingURL=warnOnce.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.js.map b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.js.map deleted file mode 100644 index 63d8e3d1..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/lib/util/warnOnce.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.js","sourceRoot":"","sources":["../../src/util/warnOnce.ts"],"names":[],"mappings":";;AAAA,6CAAqD;AAErD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAUrC,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAa;IAAb,qBAAA,EAAA,aAAa;IAC9D,IAAI,CAAC,0BAAY,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,CAAC,oBAAM,EAAE,EAAE;YACb,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;AACH,CAAC;AAXD,sDAWC"} \ No newline at end of file diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/package.json b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/package.json deleted file mode 100644 index 3ae33bbc..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "_from": "apollo-utilities@^1.3.4", - "_id": "apollo-utilities@1.3.4", - "_inBundle": false, - "_integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "_location": "/apollo-cache-inmemory/apollo-utilities", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "apollo-utilities@^1.3.4", - "name": "apollo-utilities", - "escapedName": "apollo-utilities", - "rawSpec": "^1.3.4", - "saveSpec": null, - "fetchSpec": "^1.3.4" - }, - "_requiredBy": [ - "/apollo-cache-inmemory", - "/apollo-cache-inmemory/apollo-cache" - ], - "_resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "_shasum": "6129e438e8be201b6c55b0f13ce49d2c7175c9cf", - "_spec": "apollo-utilities@^1.3.4", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-cache-inmemory", - "author": { - "name": "James Baxley", - "email": "james@meteor.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "James Burgess", - "email": "jamesmillerburgess@gmail.com" - } - ], - "dependencies": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - }, - "deprecated": false, - "description": "Utilities for working with GraphQL ASTs", - "gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "license": "MIT", - "main": "./lib/bundle.cjs.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-utilities", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "scripts": { - "build": "tsc -b .", - "bundle": "npx rollup -c rollup.config.js", - "clean": "rm -rf coverage/* lib/*", - "coverage": "jest --coverage", - "lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts", - "postbuild": "npm run bundle", - "prebuild": "npm run clean", - "prepare": "npm run lint && npm run build", - "prepublishOnly": "npm run clean && npm run build", - "test": "tsc -p tsconfig.json --noEmit && jest", - "watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.3.4" -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/directives.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/directives.ts deleted file mode 100644 index eea3500a..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/directives.ts +++ /dev/null @@ -1,274 +0,0 @@ -import gql from 'graphql-tag'; -import { cloneDeep } from 'lodash'; - -import { shouldInclude, hasDirectives } from '../directives'; -import { getQueryDefinition } from '../getFromAST'; - -describe('hasDirective', () => { - it('should allow searching the ast for a directive', () => { - const query = gql` - query Simple { - field @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for all operation types', () => { - const query = gql` - { - field @live { - subField { - hello @live - } - } - } - `; - - const mutation = gql` - mutation Directive { - mutate { - field { - subField { - hello @live - } - } - } - } - `; - - const subscription = gql` - subscription LiveDirective { - sub { - field { - subField { - hello @live - } - } - } - } - `; - - [query, mutation, subscription].forEach(x => { - expect(hasDirectives(['live'], x)).toBe(true); - expect(hasDirectives(['defer'], x)).toBe(false); - }); - }); - it('works for simple fragments', () => { - const query = gql` - query Simple { - ...fieldFragment - } - - fragment fieldFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for nested fragments', () => { - const query = gql` - query Simple { - ...fieldFragment1 - } - - fragment fieldFragment1 on Field { - bar { - baz { - ...nestedFragment - } - } - } - - fragment nestedFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); -}); - -describe('shouldInclude', () => { - it('should should not include a skipped field', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include an included field', () => { - const query = gql` - query { - fortuneCookie @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a not include: false field', () => { - const query = gql` - query { - fortuneCookie @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a skip: false field', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a field if skip: false and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: false and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should leave the original query unmodified', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const queryClone = cloneDeep(query); - const field = getQueryDefinition(query).selectionSet.selections[0]; - shouldInclude(field, {}); - expect(query).toEqual(queryClone); - }); - - it('does not throw an error on an unsupported directive', () => { - const query = gql` - query { - fortuneCookie @dosomething(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).not.toThrow(); - }); - - it('throws an error on an invalid argument for the skip directive', () => { - const query = gql` - query { - fortuneCookie @skip(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid argument for the include directive', () => { - const query = gql` - query { - fortuneCookie @include(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid variable name within a directive argument', () => { - const query = gql` - query { - fortuneCookie @include(if: $neverDefined) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('evaluates variables on skip fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @skip(if: $shouldSkip) - } - `; - const variables = { - shouldSkip: true, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('evaluates variables on include fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @include(if: $shouldInclude) - } - `; - const variables = { - shouldInclude: false, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('throws an error if the value of the argument is not a variable or boolean', () => { - const query = gql` - query { - fortuneCookie @include(if: "string") - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/fragments.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/fragments.ts deleted file mode 100644 index 1c6cfa16..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/fragments.ts +++ /dev/null @@ -1,327 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { getFragmentQueryDocument } from '../fragments'; - -describe('getFragmentQueryDocument', () => { - it('will throw an error if there is an operation', () => { - expect(() => - getFragmentQueryDocument( - gql` - { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a query operation named 'Named'. No operations are allowed when using a fragment as a query. Only fragments are allowed.", - ); - expect(() => - getFragmentQueryDocument( - gql` - mutation Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a mutation operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - subscription Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a subscription operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - }); - - it('will throw an error if there is not exactly one fragment but no `fragmentName`', () => { - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - `); - }).toThrowError( - 'Found 2 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - - fragment baz on Baz { - g - h - i - } - `); - }).toThrowError( - 'Found 3 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - scalar Foo - `); - }).toThrowError( - 'Found 0 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - }); - - it('will create a query document where the single fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - `), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - `), - ); - }); - - it('will create a query document where the named fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'foo', - ), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'bar', - ), - ), - ).toEqual( - print(gql` - { - ...bar - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'baz', - ), - ), - ).toEqual( - print(gql` - { - ...baz - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/getFromAST.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/getFromAST.ts deleted file mode 100644 index a81a5f3c..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/getFromAST.ts +++ /dev/null @@ -1,316 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { FragmentDefinitionNode, OperationDefinitionNode } from 'graphql'; - -import { - checkDocument, - getFragmentDefinitions, - getQueryDefinition, - getMutationDefinition, - createFragmentMap, - FragmentMap, - getDefaultValues, - getOperationName, -} from '../getFromAST'; - -describe('AST utility functions', () => { - it('should correctly check a document for correctness', () => { - const multipleQueries = gql` - query { - author { - firstName - lastName - } - } - - query { - author { - address - } - } - `; - expect(() => { - checkDocument(multipleQueries); - }).toThrow(); - - const namedFragment = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - expect(() => { - checkDocument(namedFragment); - }).not.toThrow(); - }); - - it('should get fragment definitions from a document containing a single fragment', () => { - const singleFragmentDefinition = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(singleFragmentDefinition); - expect(actualResult.length).toEqual(expectedResult.length); - expect(print(actualResult[0])).toBe(print(expectedResult[0])); - }); - - it('should get fragment definitions from a document containing a multiple fragments', () => { - const multipleFragmentDefinitions = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - expectedDoc.definitions[1] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(multipleFragmentDefinitions); - expect(actualResult.map(print)).toEqual(expectedResult.map(print)); - }); - - it('should get the correct query definition out of a query containing multiple fragments', () => { - const queryWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedDoc = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getQueryDefinition(queryWithFragments); - - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should throw if we try to get the query definition of a document with no query', () => { - const mutationWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - expect(() => { - getQueryDefinition(mutationWithFragments); - }).toThrow(); - }); - - it('should get the correct mutation definition out of a mutation with multiple fragments', () => { - const mutationWithFragments = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getMutationDefinition(mutationWithFragments); - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should create the fragment map correctly', () => { - const fragments = getFragmentDefinitions(gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `); - const fragmentMap = createFragmentMap(fragments); - const expectedTable: FragmentMap = { - authorDetails: fragments[0], - moreAuthorDetails: fragments[1], - }; - expect(fragmentMap).toEqual(expectedTable); - }); - - it('should return an empty fragment map if passed undefined argument', () => { - expect(createFragmentMap(undefined)).toEqual({}); - }); - - it('should get the operation name out of a query', () => { - const query = gql` - query nameOfQuery { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfQuery'); - }); - - it('should get the operation name out of a mutation', () => { - const query = gql` - mutation nameOfMutation { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfMutation'); - }); - - it('should return null if the query does not have an operation name', () => { - const query = gql` - { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual(null); - }); - - it('should throw if type definitions found in document', () => { - const queryWithTypeDefination = gql` - fragment authorDetails on Author { - firstName - lastName - } - - query($search: AuthorSearchInputType) { - author(search: $search) { - ...authorDetails - } - } - - input AuthorSearchInputType { - firstName: String - } - `; - expect(() => { - getQueryDefinition(queryWithTypeDefination); - }).toThrowError( - 'Schema type definitions not allowed in queries. Found: "InputObjectTypeDefinition"', - ); - }); - - describe('getDefaultValues', () => { - it('will create an empty variable object if no default values are provided', () => { - const basicQuery = gql` - query people($first: Int, $second: String) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({}); - }); - - it('will create a variable object based on the definition node with default values', () => { - const basicQuery = gql` - query people($first: Int = 1, $second: String!) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - const complexMutation = gql` - mutation complexStuff( - $test: Input = { key1: ["value", "value2"], key2: { key3: 4 } } - ) { - complexStuff(test: $test) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({ - first: 1, - }); - expect(getDefaultValues(getMutationDefinition(complexMutation))).toEqual({ - test: { key1: ['value', 'value2'], key2: { key3: 4 } }, - }); - }); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/storeUtils.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/storeUtils.ts deleted file mode 100644 index ba459432..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/storeUtils.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { getStoreKeyName } from '../storeUtils'; - -describe('getStoreKeyName', () => { - it( - 'should return a deterministic version of the store key name no matter ' + - 'which order the args object properties are in', - () => { - const validStoreKeyName = - 'someField({"prop1":"value1","prop2":"value2"})'; - let generatedStoreKeyName = getStoreKeyName('someField', { - prop1: 'value1', - prop2: 'value2', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - - generatedStoreKeyName = getStoreKeyName('someField', { - prop2: 'value2', - prop1: 'value1', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - }, - ); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/transform.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/transform.ts deleted file mode 100644 index 26835f4c..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/__tests__/transform.ts +++ /dev/null @@ -1,1242 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { - addTypenameToDocument, - removeDirectivesFromDocument, - getDirectivesFromDocument, - removeConnectionDirectiveFromDocument, - removeArgumentsFromDocument, - removeFragmentSpreadFromDocument, - removeClientSetsFromDocument, -} from '../transform'; -import { getQueryDefinition } from '../getFromAST'; - -describe('removeArgumentsFromDocument', () => { - it('should remove a single variable', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - field { - child - foo - } - network - } - `; - const doc = removeArgumentsFromDocument([{ name: 'variable' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a single variable and the field from the query', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - network - } - `; - const doc = removeArgumentsFromDocument( - [{ name: 'variable', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeFragmentSpreadFromDocument', () => { - it('should remove a named fragment spread', () => { - const query = gql` - query Simple { - ...FragmentSpread - property - ...ValidSpread - } - - fragment FragmentSpread on Thing { - foo - bar - baz - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const expected = gql` - query Simple { - property - ...ValidSpread - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const doc = removeFragmentSpreadFromDocument( - [{ name: 'FragmentSpread', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeDirectivesFromDocument', () => { - it('should not remove unused variable definitions unless the field is removed', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) - networkField - } - `; - - const doc = removeDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove unused variable definitions associated with the removed directive', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove used variable definitions', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField(usingVariable: $variable) - } - `; - - const expected = gql` - query Simple($variable: String!) { - networkField(usingVariable: $variable) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove fragment spreads and definitions associated with the removed directive', () => { - const query = gql` - query Simple { - networkField - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove fragment spreads and definitions used without the removed directive', () => { - const query = gql` - query Simple { - networkField { - ...ClientFragment - } - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive [test function]', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives in the query', () => { - const query = gql` - query Simple { - field @storage(if: true) - other: field @storage - } - `; - - const expected = gql` - query Simple { - field - other: field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives of different kinds in the query', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other: field @client - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - other: field - } - `; - const removed = [ - { name: 'storage' }, - { - test: (directive: any) => directive.name.value === 'client', - }, - ]; - const doc = removeDirectivesFromDocument(removed, query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive and its field if needed', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should return null if the query is no longer valid [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(doc).toBe(null); - }); - - it('should return null only if the query is not valid', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(query)); - }); - - it('should return null only if the query is not valid through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should only remove values asked through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - bar - } - `; - - const expectedQuery = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - bar - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(expectedQuery)); - }); - - it('should return null even through fragments if needed', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should not throw in combination with addTypenameToDocument', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - expect(() => { - removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - addTypenameToDocument(query), - ); - }).not.toThrow(); - }); -}); - -describe('query transforms', () => { - it('should correctly add typenames', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not add duplicates', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not screw up on a FragmentSpread within the query AST', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should modify all definitions in a document', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - - fragment friendFields on User { - firstName - lastName - } - `; - - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - - fragment friendFields on User { - firstName - lastName - __typename - } - `; - - expect(print(expectedQuery)).toBe(print(newQueryDoc)); - }); - - it('should be able to apply a QueryTransformer correctly', () => { - const testQuery = gql` - query { - author { - firstName - lastName - } - } - `; - - const expectedQuery = getQueryDefinition(gql` - query { - author { - firstName - lastName - __typename - } - } - `); - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should be able to apply a MutationTransformer correctly', () => { - const testQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - } - } - `; - const expectedQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - __typename - } - } - `; - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(modifiedQuery)); - }); - - it('should add typename fields correctly on this one query', () => { - const testQuery = gql` - query Feed($type: FeedType!) { - # Eventually move this into a no fetch query right on the entry - # since we literally just need this info to determine whether to - # show upvote/downvote buttons - currentUser { - login - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - } - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query Feed($type: FeedType!) { - currentUser { - login - __typename - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - __typename - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - __typename - } - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should correctly remove connections', () => { - let testQuery = gql` - query { - author { - name @connection(key: "foo") { - firstName - lastName - } - } - } - `; - const newQueryDoc = removeConnectionDirectiveFromDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(expectedQueryStr).toBe(print(newQueryDoc)); - }); -}); - -describe('getDirectivesFromDocument', () => { - it('should get query with fields of storage directive ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of storage directive [test function] ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = getDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with multiple fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other @storage - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - other @storage - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of both storage and client directives ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [{ name: 'storage' }, { name: 'client' }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with different types of directive matchers ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [ - { name: 'storage' }, - { test: directive => directive.name.value === 'client' }, - ], - query, - ); - - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with nested fields ', () => { - const query = gql` - query Simple { - user { - firstName @client - email - } - } - `; - - const expected = gql` - query Simple { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should include all the nested fields of field that has client directive ', () => { - const query = gql` - query Simple { - user @client { - firstName - email - } - } - `; - - const expected = gql` - query Simple { - user @client { - firstName - email - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(null); - }); - - it('should get query with client fields in fragment', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in fragment with nested fields', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - lastName - } - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in multiple fragments', function() { - const query = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - product - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it("should return null if fragment didn't have client fields", function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(null)); - }); - - it('should get query with client fields when both fields and fragements are mixed', function() { - const query = gql` - query Simple { - user @client - product @storage - order - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - user @client - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation with client fields', () => { - const query = gql` - mutation { - login @client - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation fields of client only', () => { - const query = gql` - mutation { - login @client - updateUser - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - describe('includeAllFragments', () => { - it('= false: should remove the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, false); - expect(print(doc)).toBe(print(expected)); - }); - - it('= true: should include the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, true); - expect(print(doc)).toBe(print(expected)); - }); - }); -}); - -describe('removeClientSetsFromDocument', () => { - it('should remove @client fields from document', () => { - const query = gql` - query Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - query Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove @client fields from fragments', () => { - const query = gql` - fragment authorInfo on Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - fragment authorInfo on Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/declarations.d.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/declarations.d.ts deleted file mode 100644 index 69546655..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/declarations.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'fast-json-stable-stringify'; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/directives.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/directives.ts deleted file mode 100644 index 84c14aba..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/directives.ts +++ /dev/null @@ -1,127 +0,0 @@ -// Provides the methods that allow QueryManager to handle the `skip` and -// `include` directives within GraphQL. -import { - FieldNode, - SelectionNode, - VariableNode, - BooleanValueNode, - DirectiveNode, - DocumentNode, - ArgumentNode, - ValueNode, -} from 'graphql'; - -import { visit } from 'graphql/language/visitor'; - -import { invariant } from 'ts-invariant'; - -import { argumentsObjectFromField } from './storeUtils'; - -export type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }; -}; - -export function getDirectiveInfoFromField( - field: FieldNode, - variables: Object, -): DirectiveInfo { - if (field.directives && field.directives.length) { - const directiveObj: DirectiveInfo = {}; - field.directives.forEach((directive: DirectiveNode) => { - directiveObj[directive.name.value] = argumentsObjectFromField( - directive, - variables, - ); - }); - return directiveObj; - } - return null; -} - -export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any } = {}, -): boolean { - return getInclusionDirectives( - selection.directives, - ).every(({ directive, ifArgument }) => { - let evaledValue: boolean = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[(ifArgument.value as VariableNode).name.value]; - invariant( - evaledValue !== void 0, - `Invalid variable referenced in @${directive.name.value} directive.`, - ); - } else { - evaledValue = (ifArgument.value as BooleanValueNode).value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -export function getDirectiveNames(doc: DocumentNode) { - const names: string[] = []; - - visit(doc, { - Directive(node) { - names.push(node.name.value); - }, - }); - - return names; -} - -export function hasDirectives(names: string[], doc: DocumentNode) { - return getDirectiveNames(doc).some( - (name: string) => names.indexOf(name) > -1, - ); -} - -export function hasClientExports(document: DocumentNode) { - return ( - document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document) - ); -} - -export type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; - -function isInclusionDirective({ name: { value } }: DirectiveNode): boolean { - return value === 'skip' || value === 'include'; -} - -export function getInclusionDirectives( - directives: ReadonlyArray, -): InclusionDirectives { - return directives ? directives.filter(isInclusionDirective).map(directive => { - const directiveArguments = directive.arguments; - const directiveName = directive.name.value; - - invariant( - directiveArguments && directiveArguments.length === 1, - `Incorrect number of arguments for the @${directiveName} directive.`, - ); - - const ifArgument = directiveArguments[0]; - invariant( - ifArgument.name && ifArgument.name.value === 'if', - `Invalid argument for the @${directiveName} directive.`, - ); - - const ifValue: ValueNode = ifArgument.value; - - // means it has to be a variable value if this is a valid @skip or @include directive - invariant( - ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), - `Argument for the @${directiveName} directive must be a variable or a boolean value.`, - ); - - return { directive, ifArgument }; - }) : []; -} - diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/fragments.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/fragments.ts deleted file mode 100644 index f60c86a6..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/fragments.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { DocumentNode, FragmentDefinitionNode } from 'graphql'; -import { invariant, InvariantError } from 'ts-invariant'; - -/** - * Returns a query document which adds a single query operation that only - * spreads the target fragment inside of it. - * - * So for example a document of: - * - * ```graphql - * fragment foo on Foo { a b c } - * ``` - * - * Turns into: - * - * ```graphql - * { ...foo } - * - * fragment foo on Foo { a b c } - * ``` - * - * The target fragment will either be the only fragment in the document, or a - * fragment specified by the provided `fragmentName`. If there is more than one - * fragment, but a `fragmentName` was not defined then an error will be thrown. - */ -export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, -): DocumentNode { - let actualFragmentName = fragmentName; - - // Build an array of all our fragment definitions that will be used for - // validations. We also do some validations on the other definitions in the - // document while building this list. - const fragments: Array = []; - document.definitions.forEach(definition => { - // Throw an error if we encounter an operation definition because we will - // define our own operation definition later on. - if (definition.kind === 'OperationDefinition') { - throw new InvariantError( - `Found a ${definition.operation} operation${ - definition.name ? ` named '${definition.name.value}'` : '' - }. ` + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - } - // Add our definition to the fragments array if it is a fragment - // definition. - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - // If the user did not give us a fragment name then let us try to get a - // name from a single fragment in the definition. - if (typeof actualFragmentName === 'undefined') { - invariant( - fragments.length === 1, - `Found ${ - fragments.length - } fragments. \`fragmentName\` must be provided when there is not exactly 1 fragment.`, - ); - actualFragmentName = fragments[0].name.value; - } - - // Generate a query document with an operation that simply spreads the - // fragment inside of it. - const query: DocumentNode = { - ...document, - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - }, - ...document.definitions, - ], - }; - - return query; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/getFromAST.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/getFromAST.ts deleted file mode 100644 index febe5260..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/getFromAST.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { - DocumentNode, - OperationDefinitionNode, - FragmentDefinitionNode, - ValueNode, -} from 'graphql'; - -import { invariant, InvariantError } from 'ts-invariant'; - -import { assign } from './util/assign'; - -import { valueToObjectRepresentation, JsonValue } from './storeUtils'; - -export function getMutationDefinition( - doc: DocumentNode, -): OperationDefinitionNode { - checkDocument(doc); - - let mutationDef: OperationDefinitionNode | null = doc.definitions.filter( - definition => - definition.kind === 'OperationDefinition' && - definition.operation === 'mutation', - )[0] as OperationDefinitionNode; - - invariant(mutationDef, 'Must contain a mutation definition.'); - - return mutationDef; -} - -// Checks the document for errors and throws an exception if there is an error. -export function checkDocument(doc: DocumentNode) { - invariant( - doc && doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - const operations = doc.definitions - .filter(d => d.kind !== 'FragmentDefinition') - .map(definition => { - if (definition.kind !== 'OperationDefinition') { - throw new InvariantError( - `Schema type definitions not allowed in queries. Found: "${ - definition.kind - }"`, - ); - } - return definition; - }); - - invariant( - operations.length <= 1, - `Ambiguous GraphQL document: contains ${operations.length} operations`, - ); - - return doc; -} - -export function getOperationDefinition( - doc: DocumentNode, -): OperationDefinitionNode | undefined { - checkDocument(doc); - return doc.definitions.filter( - definition => definition.kind === 'OperationDefinition', - )[0] as OperationDefinitionNode; -} - -export function getOperationDefinitionOrDie( - document: DocumentNode, -): OperationDefinitionNode { - const def = getOperationDefinition(document); - invariant(def, `GraphQL document is missing an operation`); - return def; -} - -export function getOperationName(doc: DocumentNode): string | null { - return ( - doc.definitions - .filter( - definition => - definition.kind === 'OperationDefinition' && definition.name, - ) - .map((x: OperationDefinitionNode) => x.name.value)[0] || null - ); -} - -// Returns the FragmentDefinitions from a particular document as an array -export function getFragmentDefinitions( - doc: DocumentNode, -): FragmentDefinitionNode[] { - return doc.definitions.filter( - definition => definition.kind === 'FragmentDefinition', - ) as FragmentDefinitionNode[]; -} - -export function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode { - const queryDef = getOperationDefinition(doc) as OperationDefinitionNode; - - invariant( - queryDef && queryDef.operation === 'query', - 'Must contain a query definition.', - ); - - return queryDef; -} - -export function getFragmentDefinition( - doc: DocumentNode, -): FragmentDefinitionNode { - invariant( - doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - invariant( - doc.definitions.length <= 1, - 'Fragment must have exactly one definition.', - ); - - const fragmentDef = doc.definitions[0] as FragmentDefinitionNode; - - invariant( - fragmentDef.kind === 'FragmentDefinition', - 'Must be a fragment definition.', - ); - - return fragmentDef as FragmentDefinitionNode; -} - -/** - * Returns the first operation definition found in this document. - * If no operation definition is found, the first fragment definition will be returned. - * If no definitions are found, an error will be thrown. - */ -export function getMainDefinition( - queryDoc: DocumentNode, -): OperationDefinitionNode | FragmentDefinitionNode { - checkDocument(queryDoc); - - let fragmentDefinition; - - for (let definition of queryDoc.definitions) { - if (definition.kind === 'OperationDefinition') { - const operation = (definition as OperationDefinitionNode).operation; - if ( - operation === 'query' || - operation === 'mutation' || - operation === 'subscription' - ) { - return definition as OperationDefinitionNode; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - // we do this because we want to allow multiple fragment definitions - // to precede an operation definition. - fragmentDefinition = definition as FragmentDefinitionNode; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw new InvariantError( - 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.', - ); -} - -/** - * This is an interface that describes a map from fragment names to fragment definitions. - */ -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} - -// Utility function that takes a list of fragment definitions and makes a hash out of them -// that maps the name of the fragment to the fragment definition. -export function createFragmentMap( - fragments: FragmentDefinitionNode[] = [], -): FragmentMap { - const symTable: FragmentMap = {}; - fragments.forEach(fragment => { - symTable[fragment.name.value] = fragment; - }); - - return symTable; -} - -export function getDefaultValues( - definition: OperationDefinitionNode | undefined, -): { [key: string]: JsonValue } { - if ( - definition && - definition.variableDefinitions && - definition.variableDefinitions.length - ) { - const defaultValues = definition.variableDefinitions - .filter(({ defaultValue }) => defaultValue) - .map( - ({ variable, defaultValue }): { [key: string]: JsonValue } => { - const defaultValueObj: { [key: string]: JsonValue } = {}; - valueToObjectRepresentation( - defaultValueObj, - variable.name, - defaultValue as ValueNode, - ); - - return defaultValueObj; - }, - ); - - return assign({}, ...defaultValues); - } - - return {}; -} - -/** - * Returns the names of all variables declared by the operation. - */ -export function variablesInOperation( - operation: OperationDefinitionNode, -): Set { - const names = new Set(); - if (operation.variableDefinitions) { - for (const definition of operation.variableDefinitions) { - names.add(definition.variable.name.value); - } - } - - return names; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/index.js.flow b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/index.js.flow deleted file mode 100644 index a7fc594d..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/index.js.flow +++ /dev/null @@ -1,220 +0,0 @@ -// @flow -import type { - DirectiveNode, - StringValueNode, - BooleanValueNode, - IntValueNode, - FloatValueNode, - EnumValueNode, - VariableNode, - FieldNode, - FragmentDefinitionNode, - OperationDefinitionNode, - SelectionNode, - DocumentNode, - DefinitionNode, - ValueNode, - NameNode, -} from 'graphql'; - -declare module 'apollo-utilities' { - // storeUtils - declare export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | void; - } - - declare export interface JsonValue { - type: 'json'; - json: any; - } - - declare export type ListValue = Array; - - declare export type StoreValue = - | number - | string - | Array - | IdValue - | ListValue - | JsonValue - | null - | void - | Object; - - declare export type ScalarValue = - | StringValueNode - | BooleanValueNode - | EnumValueNode; - - declare export type NumberValue = IntValueNode | FloatValueNode; - - declare type isValueFn = (value: ValueNode) => boolean; - - declare export type isScalarValue = isValueFn; - declare export type isNumberValue = isValueFn; - declare export type isStringValue = isValueFn; - declare export type isBooleanValue = isValueFn; - declare export type isIntValue = isValueFn; - declare export type isFloatValue = isValueFn; - declare export type isVariable = isValueFn; - declare export type isObjectValue = isValueFn; - declare export type isListValue = isValueFn; - declare export type isEnumValue = isValueFn; - - declare export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, - ): any; - - declare export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, - ): string; - - declare export type Directives = { - [directiveName: string]: { - [argName: string]: any, - }, - }; - - declare export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, - ): string; - - declare export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, - ): ?Object; - - declare export function resultKeyNameFromField(field: FieldNode): string; - - declare export function isField(selection: SelectionNode): boolean; - - declare export function isInlineFragment(selection: SelectionNode): boolean; - - declare export function isIdValue(idObject: StoreValue): boolean; - - declare export type IdConfig = { - id: string, - typename: string | void, - }; - - declare export function toIdValue( - id: string | IdConfig, - generated?: boolean, - ): IdValue; - - declare export function isJsonValue(jsonObject: StoreValue): boolean; - - declare export type VariableValue = (node: VariableNode) => any; - - declare export function valueFromNode( - node: ValueNode, - onVariable: VariableValue, - ): any; - - // getFromAST - declare export function getMutationDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function checkDocument(doc: DocumentNode): void; - - declare export function getOperationDefinition( - doc: DocumentNode, - ): ?OperationDefinitionNode; - - declare export function getOperationDefinitionOrDie( - document: DocumentNode, - ): OperationDefinitionNode; - - declare export function getOperationName(doc: DocumentNode): ?string; - - declare export function getFragmentDefinitions( - doc: DocumentNode, - ): Array; - - declare export function getQueryDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function getFragmentDefinition( - doc: DocumentNode, - ): FragmentDefinitionNode; - - declare export function getMainDefinition( - queryDoc: DocumentNode, - ): OperationDefinitionNode | FragmentDefinitionNode; - - declare export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; - } - - declare export function createFragmentMap( - fragments: Array, - ): FragmentMap; - - declare export function getDefaultValues( - definition: ?OperationDefinitionNode, - ): { [key: string]: JsonValue }; - - // fragments - declare export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, - ): DocumentNode; - - declare export function variablesInOperation( - operation: OperationDefinitionNode, - ): Set; - - // directives - declare type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }, - }; - - declare export function getDirectiveInfoFromField( - field: FieldNode, - object: Object, - ): ?DirectiveInfo; - - declare export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any }, - ): boolean; - - declare export function flattenSelections( - selection: SelectionNode, - ): Array; - - declare export function getDirectiveNames(doc: DocumentNode): Array; - - declare export function hasDirectives( - names: Array, - doc: DocumentNode, - ): boolean; - - // transform - declare export type RemoveDirectiveConfig = { - name?: string, - test?: (directive: DirectiveNode) => boolean, - }; - - declare export function removeDirectivesFromDocument( - directives: Array, - doc: DocumentNode, - ): DocumentNode; - - declare export function addTypenameToDocument(doc: DocumentNode): void; - - declare export function removeConnectionDirectiveFromDocument( - doc: DocumentNode, - ): DocumentNode; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/index.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/index.ts deleted file mode 100644 index 18b0a815..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/storeUtils.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/storeUtils.ts deleted file mode 100644 index 2bd1e53a..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/storeUtils.ts +++ /dev/null @@ -1,340 +0,0 @@ -import { - DirectiveNode, - FieldNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - ObjectValueNode, - ListValueNode, - EnumValueNode, - NullValueNode, - VariableNode, - InlineFragmentNode, - ValueNode, - SelectionNode, - NameNode, -} from 'graphql'; - -import stringify from 'fast-json-stable-stringify'; -import { InvariantError } from 'ts-invariant'; - -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} - -export interface JsonValue { - type: 'json'; - json: any; -} - -export type ListValue = Array; - -export type StoreValue = - | number - | string - | string[] - | IdValue - | ListValue - | JsonValue - | null - | undefined - | void - | Object; - -export type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; - -export function isScalarValue(value: ValueNode): value is ScalarValue { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -export type NumberValue = IntValueNode | FloatValueNode; - -export function isNumberValue(value: ValueNode): value is NumberValue { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value: ValueNode): value is StringValueNode { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value: ValueNode): value is BooleanValueNode { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value: ValueNode): value is IntValueNode { - return value.kind === 'IntValue'; -} - -function isFloatValue(value: ValueNode): value is FloatValueNode { - return value.kind === 'FloatValue'; -} - -function isVariable(value: ValueNode): value is VariableNode { - return value.kind === 'Variable'; -} - -function isObjectValue(value: ValueNode): value is ObjectValueNode { - return value.kind === 'ObjectValue'; -} - -function isListValue(value: ValueNode): value is ListValueNode { - return value.kind === 'ListValue'; -} - -function isEnumValue(value: ValueNode): value is EnumValueNode { - return value.kind === 'EnumValue'; -} - -function isNullValue(value: ValueNode): value is NullValueNode { - return value.kind === 'NullValue'; -} - -export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, -) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - const nestedArgObj = {}; - value.fields.map(obj => - valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables), - ); - argObj[name.value] = nestedArgObj; - } else if (isVariable(value)) { - const variableValue = (variables || ({} as any))[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(listValue => { - const nestedArgArrayObj = {}; - valueToObjectRepresentation( - nestedArgArrayObj, - name, - listValue, - variables, - ); - return (nestedArgArrayObj as any)[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = (value as EnumValueNode).value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw new InvariantError( - `The inline argument "${name.value}" of kind "${(value as any).kind}"` + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.', - ); - } -} - -export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, -): string { - let directivesObj: any = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(directive => { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(({ name, value }) => - valueToObjectRepresentation( - directivesObj[directive.name.value], - name, - value, - variables, - ), - ); - } - }); - } - - let argObj: any = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -export type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; - -const KNOWN_DIRECTIVES: string[] = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; - -export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, -): string { - if ( - directives && - directives['connection'] && - directives['connection']['key'] - ) { - if ( - directives['connection']['filter'] && - (directives['connection']['filter'] as string[]).length > 0 - ) { - const filterKeys = directives['connection']['filter'] - ? (directives['connection']['filter'] as string[]) - : []; - filterKeys.sort(); - - const queryArgs = args as { [key: string]: any }; - const filteredArgs = {} as { [key: string]: any }; - filterKeys.forEach(key => { - filteredArgs[key] = queryArgs[key]; - }); - - return `${directives['connection']['key']}(${JSON.stringify( - filteredArgs, - )})`; - } else { - return directives['connection']['key']; - } - } - - let completeFieldName: string = fieldName; - - if (args) { - // We can't use `JSON.stringify` here since it's non-deterministic, - // and can lead to different store key names being created even though - // the `args` object used during creation has the same properties/values. - const stringifiedArgs: string = stringify(args); - completeFieldName += `(${stringifiedArgs})`; - } - - if (directives) { - Object.keys(directives).forEach(key => { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += `@${key}(${JSON.stringify(directives[key])})`; - } else { - completeFieldName += `@${key}`; - } - }); - } - - return completeFieldName; -} - -export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, -): Object { - if (field.arguments && field.arguments.length) { - const argObj: Object = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - return argObj; - } - - return null; -} - -export function resultKeyNameFromField(field: FieldNode): string { - return field.alias ? field.alias.value : field.name.value; -} - -export function isField(selection: SelectionNode): selection is FieldNode { - return selection.kind === 'Field'; -} - -export function isInlineFragment( - selection: SelectionNode, -): selection is InlineFragmentNode { - return selection.kind === 'InlineFragment'; -} - -export function isIdValue(idObject: StoreValue): idObject is IdValue { - return idObject && - (idObject as IdValue | JsonValue).type === 'id' && - typeof (idObject as IdValue).generated === 'boolean'; -} - -export type IdConfig = { - id: string; - typename: string | undefined; -}; - -export function toIdValue( - idConfig: string | IdConfig, - generated = false, -): IdValue { - return { - type: 'id', - generated, - ...(typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig), - }; -} - -export function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue { - return ( - jsonObject != null && - typeof jsonObject === 'object' && - (jsonObject as IdValue | JsonValue).type === 'json' - ); -} - -function defaultValueFromVariable(node: VariableNode) { - throw new InvariantError(`Variable nodes are not supported by valueFromNode`); -} - -export type VariableValue = (node: VariableNode) => any; - -/** - * Evaluate a ValueNode and yield its value in its natural JS form. - */ -export function valueFromNode( - node: ValueNode, - onVariable: VariableValue = defaultValueFromVariable, -): any { - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(v => valueFromNode(v, onVariable)); - case 'ObjectValue': { - const value: { [key: string]: any } = {}; - for (const field of node.fields) { - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/transform.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/transform.ts deleted file mode 100644 index d77b8e54..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/transform.ts +++ /dev/null @@ -1,542 +0,0 @@ -import { - DocumentNode, - SelectionNode, - SelectionSetNode, - OperationDefinitionNode, - FieldNode, - DirectiveNode, - FragmentDefinitionNode, - ArgumentNode, - FragmentSpreadNode, - VariableDefinitionNode, - VariableNode, -} from 'graphql'; -import { visit } from 'graphql/language/visitor'; - -import { - checkDocument, - getOperationDefinition, - getFragmentDefinition, - getFragmentDefinitions, - createFragmentMap, - FragmentMap, - getMainDefinition, -} from './getFromAST'; -import { filterInPlace } from './util/filterInPlace'; -import { invariant } from 'ts-invariant'; -import { isField, isInlineFragment } from './storeUtils'; - -export type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; - -export type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; - -export type RemoveDirectiveConfig = RemoveNodeConfig; -export type GetDirectiveConfig = GetNodeConfig; -export type RemoveArgumentsConfig = RemoveNodeConfig; -export type GetFragmentSpreadConfig = GetNodeConfig; -export type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export type RemoveFragmentDefinitionConfig = RemoveNodeConfig< - FragmentDefinitionNode ->; -export type RemoveVariableDefinitionConfig = RemoveNodeConfig< - VariableDefinitionNode ->; - -const TYPENAME_FIELD: FieldNode = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; - -function isEmpty( - op: OperationDefinitionNode | FragmentDefinitionNode, - fragments: FragmentMap, -): boolean { - return op.selectionSet.selections.every( - selection => - selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments), - ); -} - -function nullIfDocIsEmpty(doc: DocumentNode) { - return isEmpty( - getOperationDefinition(doc) || getFragmentDefinition(doc), - createFragmentMap(getFragmentDefinitions(doc)), - ) - ? null - : doc; -} - -function getDirectiveMatcher( - directives: (RemoveDirectiveConfig | GetDirectiveConfig)[], -) { - return function directiveMatcher(directive: DirectiveNode) { - return directives.some( - dir => - (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)), - ); - }; -} - -export function removeDirectivesFromDocument( - directives: RemoveDirectiveConfig[], - doc: DocumentNode, -): DocumentNode | null { - const variablesInUse: Record = Object.create(null); - let variablesToRemove: RemoveArgumentsConfig[] = []; - - const fragmentSpreadsInUse: Record = Object.create(null); - let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = []; - - let modifiedDoc = nullIfDocIsEmpty( - visit(doc, { - Variable: { - enter(node, _key, parent) { - // Store each variable that's referenced as part of an argument - // (excluding operation definition variables), so we know which - // variables are being used. If we later want to remove a variable - // we'll fist check to see if it's being used, before continuing with - // the removal. - if ( - (parent as VariableDefinitionNode).kind !== 'VariableDefinition' - ) { - variablesInUse[node.name.value] = true; - } - }, - }, - - Field: { - enter(node) { - if (directives && node.directives) { - // If `remove` is set to true for a directive, and a directive match - // is found for a field, remove the field as well. - const shouldRemoveField = directives.some( - directive => directive.remove, - ); - - if ( - shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives)) - ) { - if (node.arguments) { - // Store field argument variables so they can be removed - // from the operation definition. - node.arguments.forEach(arg => { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: (arg.value as VariableNode).name.value, - }); - } - }); - } - - if (node.selectionSet) { - // Store fragment spread names so they can be removed from the - // docuemnt. - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach( - frag => { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }, - ); - } - - // Remove the field. - return null; - } - } - }, - }, - - FragmentSpread: { - enter(node) { - // Keep track of referenced fragment spreads. This is used to - // determine if top level fragment definitions should be removed. - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - - Directive: { - enter(node) { - // If a matching directive is found, remove it. - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - }), - ); - - // If we've removed fields with arguments, make sure the associated - // variables are also removed from the rest of the document, as long as they - // aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length - ) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - // If we've removed selection sets with fragment spreads, make sure the - // associated fragment definitions are also removed from the rest of the - // document, as long as they aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name]) - .length - ) { - modifiedDoc = removeFragmentSpreadFromDocument( - fragmentSpreadsToRemove, - modifiedDoc, - ); - } - - return modifiedDoc; -} - -export function addTypenameToDocument(doc: DocumentNode): DocumentNode { - return visit(checkDocument(doc), { - SelectionSet: { - enter(node, _key, parent) { - // Don't add __typename to OperationDefinitions. - if ( - parent && - (parent as OperationDefinitionNode).kind === 'OperationDefinition' - ) { - return; - } - - // No changes if no selections. - const { selections } = node; - if (!selections) { - return; - } - - // If selections already have a __typename, or are part of an - // introspection query, do nothing. - const skip = selections.some(selection => { - return ( - isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0) - ); - }); - if (skip) { - return; - } - - // If this SelectionSet is @export-ed as an input variable, it should - // not have a __typename field (see issue #4691). - const field = parent as FieldNode; - if ( - isField(field) && - field.directives && - field.directives.some(d => d.name.value === 'export') - ) { - return; - } - - // Create and return a new SelectionSet with a __typename Field. - return { - ...node, - selections: [...selections, TYPENAME_FIELD], - }; - }, - }, - }); -} - -const connectionRemoveConfig = { - test: (directive: DirectiveNode) => { - const willRemove = directive.name.value === 'connection'; - if (willRemove) { - if ( - !directive.arguments || - !directive.arguments.some(arg => arg.name.value === 'key') - ) { - invariant.warn( - 'Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.', - ); - } - } - - return willRemove; - }, -}; - -export function removeConnectionDirectiveFromDocument(doc: DocumentNode) { - return removeDirectivesFromDocument( - [connectionRemoveConfig], - checkDocument(doc), - ); -} - -function hasDirectivesInSelectionSet( - directives: GetDirectiveConfig[], - selectionSet: SelectionSetNode, - nestedCheck = true, -): boolean { - return ( - selectionSet && - selectionSet.selections && - selectionSet.selections.some(selection => - hasDirectivesInSelection(directives, selection, nestedCheck), - ) - ); -} - -function hasDirectivesInSelection( - directives: GetDirectiveConfig[], - selection: SelectionNode, - nestedCheck = true, -): boolean { - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return ( - selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet( - directives, - selection.selectionSet, - nestedCheck, - )) - ); -} - -export function getDirectivesFromDocument( - directives: GetDirectiveConfig[], - doc: DocumentNode, -): DocumentNode { - checkDocument(doc); - - let parentPath: string; - - return nullIfDocIsEmpty( - visit(doc, { - SelectionSet: { - enter(node, _key, _parent, path) { - const currentPath = path.join('-'); - - if ( - !parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath) - ) { - if (node.selections) { - const selectionsWithDirectives = node.selections.filter( - selection => hasDirectivesInSelection(directives, selection), - ); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return { - ...node, - selections: selectionsWithDirectives, - }; - } else { - return null; - } - } - }, - }, - }), - ); -} - -function getArgumentMatcher(config: RemoveArgumentsConfig[]) { - return function argumentMatcher(argument: ArgumentNode) { - return config.some( - (aConfig: RemoveArgumentsConfig) => - argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))), - ); - }; -} - -export function removeArgumentsFromDocument( - config: RemoveArgumentsConfig[], - doc: DocumentNode, -): DocumentNode { - const argMatcher = getArgumentMatcher(config); - - return nullIfDocIsEmpty( - visit(doc, { - OperationDefinition: { - enter(node) { - return { - ...node, - // Remove matching top level variables definitions. - variableDefinitions: node.variableDefinitions.filter( - varDef => - !config.some(arg => arg.name === varDef.variable.name.value), - ), - }; - }, - }, - - Field: { - enter(node) { - // If `remove` is set to true for an argument, and an argument match - // is found for a field, remove the field as well. - const shouldRemoveField = config.some(argConfig => argConfig.remove); - - if (shouldRemoveField) { - let argMatchCount = 0; - node.arguments.forEach(arg => { - if (argMatcher(arg)) { - argMatchCount += 1; - } - }); - if (argMatchCount === 1) { - return null; - } - } - }, - }, - - Argument: { - enter(node) { - // Remove all matching arguments. - if (argMatcher(node)) { - return null; - } - }, - }, - }), - ); -} - -export function removeFragmentSpreadFromDocument( - config: RemoveFragmentSpreadConfig[], - doc: DocumentNode, -): DocumentNode { - function enter( - node: FragmentSpreadNode | FragmentDefinitionNode, - ): null | void { - if (config.some(def => def.name === node.name.value)) { - return null; - } - } - - return nullIfDocIsEmpty( - visit(doc, { - FragmentSpread: { enter }, - FragmentDefinition: { enter }, - }), - ); -} - -function getAllFragmentSpreadsFromSelectionSet( - selectionSet: SelectionSetNode, -): FragmentSpreadNode[] { - const allFragments: FragmentSpreadNode[] = []; - - selectionSet.selections.forEach(selection => { - if ( - (isField(selection) || isInlineFragment(selection)) && - selection.selectionSet - ) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach( - frag => allFragments.push(frag), - ); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - - return allFragments; -} - -// If the incoming document is a query, return it as is. Otherwise, build a -// new document containing a query operation based on the selection set -// of the previous main operation. -export function buildQueryFromSelectionSet( - document: DocumentNode, -): DocumentNode { - const definition = getMainDefinition(document); - const definitionOperation = (definition).operation; - - if (definitionOperation === 'query') { - // Already a query, so return the existing document. - return document; - } - - // Build a new query using the selection set of the main operation. - const modifiedDoc = visit(document, { - OperationDefinition: { - enter(node) { - return { - ...node, - operation: 'query', - }; - }, - }, - }); - return modifiedDoc; -} - -// Remove fields / selection sets that include an @client directive. -export function removeClientSetsFromDocument( - document: DocumentNode, -): DocumentNode | null { - checkDocument(document); - - let modifiedDoc = removeDirectivesFromDocument( - [ - { - test: (directive: DirectiveNode) => directive.name.value === 'client', - remove: true, - }, - ], - document, - ); - - // After a fragment definition has had its @client related document - // sets removed, if the only field it has left is a __typename field, - // remove the entire fragment operation to prevent it from being fired - // on the server. - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter(node) { - if (node.selectionSet) { - const isTypenameOnly = node.selectionSet.selections.every( - selection => - isField(selection) && selection.name.value === '__typename', - ); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - - return modifiedDoc; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/assign.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/assign.ts deleted file mode 100644 index 6d3ef045..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/assign.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { assign } from '../assign'; - -describe('assign', () => { - it('will merge many objects together', () => { - expect(assign({ a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 })).toEqual({ - a: 1, - b: 2, - c: 3, - }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 })).toEqual({ - a: 1, - b: 2, - c: 3, - d: 4, - }); - }); - - it('will merge many objects together shallowly', () => { - expect(assign({ x: { a: 1 } }, { x: { b: 2 } })).toEqual({ x: { b: 2 } }); - expect(assign({ x: { a: 1 } }, { x: { b: 2 } }, { x: { c: 3 } })).toEqual({ - x: { c: 3 }, - }); - expect( - assign( - { x: { a: 1 } }, - { x: { b: 2 } }, - { x: { c: 3 } }, - { x: { d: 4 } }, - ), - ).toEqual({ x: { d: 4 } }); - }); - - it('will mutate and return the source objects', () => { - const source1 = { a: 1 }; - const source2 = { a: 1 }; - const source3 = { a: 1 }; - - expect(assign(source1, { b: 2 })).toEqual(source1); - expect(assign(source2, { b: 2 }, { c: 3 })).toEqual(source2); - expect(assign(source3, { b: 2 }, { c: 3 }, { d: 4 })).toEqual(source3); - - expect(source1).toEqual({ a: 1, b: 2 }); - expect(source2).toEqual({ a: 1, b: 2, c: 3 }); - expect(source3).toEqual({ a: 1, b: 2, c: 3, d: 4 }); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts deleted file mode 100644 index 52b491b5..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { cloneDeep } from '../cloneDeep'; - -describe('cloneDeep', () => { - it('will clone primitive values', () => { - expect(cloneDeep(undefined)).toEqual(undefined); - expect(cloneDeep(null)).toEqual(null); - expect(cloneDeep(true)).toEqual(true); - expect(cloneDeep(false)).toEqual(false); - expect(cloneDeep(-1)).toEqual(-1); - expect(cloneDeep(+1)).toEqual(+1); - expect(cloneDeep(0.5)).toEqual(0.5); - expect(cloneDeep('hello')).toEqual('hello'); - expect(cloneDeep('world')).toEqual('world'); - }); - - it('will clone objects', () => { - const value1 = {}; - const value2 = { a: 1, b: 2, c: 3 }; - const value3 = { x: { a: 1, b: 2, c: 3 }, y: { a: 1, b: 2, c: 3 } }; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3.x).toEqual(value3.x); - expect(clonedValue3.y).toEqual(value3.y); - }); - - it('will clone arrays', () => { - const value1: Array = []; - const value2 = [1, 2, 3]; - const value3 = [[1, 2, 3], [1, 2, 3]]; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3[0]).toEqual(value3[0]); - expect(clonedValue3[1]).toEqual(value3[1]); - }); - - it('should not attempt to follow circular references', () => { - const someObject = { - prop1: 'value1', - anotherObject: null, - }; - const anotherObject = { - someObject, - }; - someObject.anotherObject = anotherObject; - let chk; - expect(() => { - chk = cloneDeep(someObject); - }).not.toThrow(); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/environment.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/environment.ts deleted file mode 100644 index dcb71538..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/environment.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { isEnv, isProduction, isDevelopment, isTest } from '../environment'; - -describe('environment', () => { - let keepEnv: string | undefined; - - beforeEach(() => { - // save the NODE_ENV - keepEnv = process.env.NODE_ENV; - }); - - afterEach(() => { - // restore the NODE_ENV - process.env.NODE_ENV = keepEnv; - }); - - describe('isEnv', () => { - it(`should match when there's a value`, () => { - ['production', 'development', 'test'].forEach(env => { - process.env.NODE_ENV = env; - expect(isEnv(env)).toBe(true); - }); - }); - - it(`should treat no proces.env.NODE_ENV as it'd be in development`, () => { - delete process.env.NODE_ENV; - expect(isEnv('development')).toBe(true); - }); - }); - - describe('isProduction', () => { - it('should return true if in production', () => { - process.env.NODE_ENV = 'production'; - expect(isProduction()).toBe(true); - }); - - it('should return false if not in production', () => { - process.env.NODE_ENV = 'test'; - expect(!isProduction()).toBe(true); - }); - }); - - describe('isTest', () => { - it('should return true if in test', () => { - process.env.NODE_ENV = 'test'; - expect(isTest()).toBe(true); - }); - - it('should return true if not in test', () => { - process.env.NODE_ENV = 'development'; - expect(!isTest()).toBe(true); - }); - }); - - describe('isDevelopment', () => { - it('should return true if in development', () => { - process.env.NODE_ENV = 'development'; - expect(isDevelopment()).toBe(true); - }); - - it('should return true if not in development and environment is defined', () => { - process.env.NODE_ENV = 'test'; - expect(!isDevelopment()).toBe(true); - }); - - it('should make development as the default environment', () => { - delete process.env.NODE_ENV; - expect(isDevelopment()).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts deleted file mode 100644 index e621a837..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { isEqual } from '../isEqual'; - -describe('isEqual', () => { - it('should return true for equal primitive values', () => { - expect(isEqual(undefined, undefined)).toBe(true); - expect(isEqual(null, null)).toBe(true); - expect(isEqual(true, true)).toBe(true); - expect(isEqual(false, false)).toBe(true); - expect(isEqual(-1, -1)).toBe(true); - expect(isEqual(+1, +1)).toBe(true); - expect(isEqual(42, 42)).toBe(true); - expect(isEqual(0, 0)).toBe(true); - expect(isEqual(0.5, 0.5)).toBe(true); - expect(isEqual('hello', 'hello')).toBe(true); - expect(isEqual('world', 'world')).toBe(true); - }); - - it('should return false for not equal primitive values', () => { - expect(!isEqual(undefined, null)).toBe(true); - expect(!isEqual(null, undefined)).toBe(true); - expect(!isEqual(true, false)).toBe(true); - expect(!isEqual(false, true)).toBe(true); - expect(!isEqual(-1, +1)).toBe(true); - expect(!isEqual(+1, -1)).toBe(true); - expect(!isEqual(42, 42.00000000000001)).toBe(true); - expect(!isEqual(0, 0.5)).toBe(true); - expect(!isEqual('hello', 'world')).toBe(true); - expect(!isEqual('world', 'hello')).toBe(true); - }); - - it('should return false when comparing primitives with objects', () => { - expect(!isEqual({}, null)).toBe(true); - expect(!isEqual(null, {})).toBe(true); - expect(!isEqual({}, true)).toBe(true); - expect(!isEqual(true, {})).toBe(true); - expect(!isEqual({}, 42)).toBe(true); - expect(!isEqual(42, {})).toBe(true); - expect(!isEqual({}, 'hello')).toBe(true); - expect(!isEqual('hello', {})).toBe(true); - }); - - it('should correctly compare shallow objects', () => { - expect(isEqual({}, {})).toBe(true); - expect(isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 3, b: 2, c: 1 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toBe(true); - expect(!isEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toBe(true); - }); - - it('should correctly compare deep objects', () => { - expect(isEqual({ x: {} }, { x: {} })).toBe(true); - expect( - isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2, c: 3 } }), - ).toBe(true); - expect( - !isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 3, b: 2, c: 1 } }), - ).toBe(true); - expect(!isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2 } })).toBe( - true, - ); - expect(!isEqual({ x: { a: 1, b: 2 } }, { x: { a: 1, b: 2, c: 3 } })).toBe( - true, - ); - }); - - it('should correctly compare deep objects without object prototype ', () => { - // Solves https://github.com/apollographql/apollo-client/issues/2132 - const objNoProto = Object.create(null); - objNoProto.a = { b: 2, c: [3, 4] }; - objNoProto.e = Object.create(null); - objNoProto.e.f = 5; - expect(isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 6 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: null })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, null)).toBe(true); - }); - - it('should correctly handle modified prototypes', () => { - Array.prototype.foo = null; - expect(isEqual([1, 2, 3], [1, 2, 3])).toBe(true); - expect(!isEqual([1, 2, 3], [1, 2, 4])).toBe(true); - delete Array.prototype.foo; - }); - - describe('comparing objects with circular refs', () => { - // copied with slight modification from lodash test suite - it('should compare objects with circular references', () => { - const object1 = {}, - object2 = {}; - - object1.a = object1; - object2.a = object2; - - expect(isEqual(object1, object2)).toBe(true); - - object1.b = 0; - object2.b = Object(0); - - expect(isEqual(object1, object2)).toBe(true); - - object1.c = Object(1); - object2.c = Object(2); - - expect(isEqual(object1, object2)).toBe(false); - - object1 = { a: 1, b: 2, c: 3 }; - object1.b = object1; - object2 = { a: 1, b: { a: 1, b: 2, c: 3 }, c: 3 }; - - expect(isEqual(object1, object2)).toBe(false); - }); - - it('should have transitive equivalence for circular references of objects', () => { - const object1 = {}, - object2 = { a: object1 }, - object3 = { a: object2 }; - - object1.a = object1; - - expect(isEqual(object1, object2)).toBe(true); - expect(isEqual(object2, object3)).toBe(true); - expect(isEqual(object1, object3)).toBe(true); - }); - - it('should compare objects with multiple circular references', () => { - const array1 = [{}], - array2 = [{}]; - - (array1[0].a = array1).push(array1); - (array2[0].a = array2).push(array2); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].b = 0; - array2[0].b = Object(0); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].c = Object(1); - array2[0].c = Object(2); - - expect(isEqual(array1, array2)).toBe(false); - }); - - it('should compare objects with complex circular references', () => { - const object1 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - const object2 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - object1.foo.b.c.d = object1; - object1.bar.b = object1.foo.b; - - object2.foo.b.c.d = object2; - object2.bar.b = object2.foo.b; - - expect(isEqual(object1, object2)).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts deleted file mode 100644 index c33cc60c..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { maybeDeepFreeze } from '../maybeDeepFreeze'; - -describe('maybeDeepFreeze', () => { - it('should deep freeze', () => { - const foo: any = { bar: undefined }; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - expect(foo.bar).toBeUndefined(); - }); - - it('should properly freeze objects without hasOwnProperty', () => { - const foo = Object.create(null); - foo.bar = undefined; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts deleted file mode 100644 index 13778069..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { mergeDeep, mergeDeepArray } from '../mergeDeep'; - -describe('mergeDeep', function() { - it('should return an object if first argument falsy', function() { - expect(mergeDeep()).toEqual({}); - expect(mergeDeep(null)).toEqual({}); - expect(mergeDeep(null, { foo: 42 })).toEqual({ foo: 42 }); - }); - - it('should preserve identity for single arguments', function() { - const arg = Object.create(null); - expect(mergeDeep(arg)).toBe(arg); - }); - - it('should preserve identity when merging non-conflicting objects', function() { - const a = { a: { name: 'ay' } }; - const b = { b: { name: 'bee' } }; - const c = mergeDeep(a, b); - expect(c.a).toBe(a.a); - expect(c.b).toBe(b.b); - expect(c).toEqual({ - a: { name: 'ay' }, - b: { name: 'bee' }, - }); - }); - - it('should shallow-copy conflicting fields', function() { - const a = { conflict: { fromA: [1, 2, 3] } }; - const b = { conflict: { fromB: [4, 5] } }; - const c = mergeDeep(a, b); - expect(c.conflict).not.toBe(a.conflict); - expect(c.conflict).not.toBe(b.conflict); - expect(c.conflict.fromA).toBe(a.conflict.fromA); - expect(c.conflict.fromB).toBe(b.conflict.fromB); - expect(c).toEqual({ - conflict: { - fromA: [1, 2, 3], - fromB: [4, 5], - }, - }); - }); - - it('should resolve conflicts among more than two objects', function() { - const sources = []; - - for (let i = 0; i < 100; ++i) { - sources.push({ - ['unique' + i]: { value: i }, - conflict: { - ['from' + i]: { value: i }, - nested: { - ['nested' + i]: { value: i }, - }, - }, - }); - } - - const merged = mergeDeep(...sources); - - sources.forEach((source, i) => { - expect(merged['unique' + i].value).toBe(i); - expect(source['unique' + i]).toBe(merged['unique' + i]); - - expect(merged.conflict).not.toBe(source.conflict); - expect(merged.conflict['from' + i].value).toBe(i); - expect(merged.conflict['from' + i]).toBe(source.conflict['from' + i]); - - expect(merged.conflict.nested).not.toBe(source.conflict.nested); - expect(merged.conflict.nested['nested' + i].value).toBe(i); - expect(merged.conflict.nested['nested' + i]).toBe( - source.conflict.nested['nested' + i], - ); - }); - }); - - it('can merge array elements', function() { - const a = [{ a: 1 }, { a: 'ay' }, 'a']; - const b = [{ b: 2 }, { b: 'bee' }, 'b']; - const c = [{ c: 3 }, { c: 'cee' }, 'c']; - const d = { 1: { d: 'dee' } }; - - expect(mergeDeep(a, b, c, d)).toEqual([ - { a: 1, b: 2, c: 3 }, - { a: 'ay', b: 'bee', c: 'cee', d: 'dee' }, - 'c', - ]); - }); - - it('lets the last conflicting value win', function() { - expect(mergeDeep('a', 'b', 'c')).toBe('c'); - - expect( - mergeDeep( - { a: 'a', conflict: 1 }, - { b: 'b', conflict: 2 }, - { c: 'c', conflict: 3 }, - ), - ).toEqual({ - a: 'a', - b: 'b', - c: 'c', - conflict: 3, - }); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - [/*empty*/, ['B'], 'D'], - )).toEqual( - ['a', ['B', 'c'], 'D'], - ); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - ['A', [/*empty*/, 'C']], - )).toEqual( - ['A', ['b', 'C'], 'd'], - ); - }); - - it('mergeDeep returns the intersection of its argument types', function() { - const abc = mergeDeep({ str: "hi", a: 1 }, { a: 3, b: 2 }, { b: 1, c: 2 }); - // The point of this test is that the following lines type-check without - // resorting to any `any` loopholes: - expect(abc.str.slice(0)).toBe("hi"); - expect(abc.a * 2).toBe(6); - expect(abc.b - 0).toBe(1); - expect(abc.c / 2).toBe(1); - }); - - it('mergeDeepArray returns the supertype of its argument types', function() { - class F { - check() { return "ok" }; - } - const fs: F[] = [new F, new F, new F]; - // Although mergeDeepArray doesn't have the same tuple type awareness as - // mergeDeep, it does infer that F should be the return type here: - expect(mergeDeepArray(fs).check()).toBe("ok"); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts deleted file mode 100644 index fd5594b8..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { stripSymbols } from '../stripSymbols'; - -interface SymbolConstructor { - (description?: string | number): symbol; -} - -declare const Symbol: SymbolConstructor; - -describe('stripSymbols', () => { - it('should strip symbols (only)', () => { - const sym = Symbol('id'); - const data = { foo: 'bar', [sym]: 'ROOT_QUERY' }; - expect(stripSymbols(data)).toEqual({ foo: 'bar' }); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts deleted file mode 100644 index 35c87534..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { warnOnceInDevelopment } from '../warnOnce'; - -let lastWarning: string | null; -let keepEnv: string | undefined; -let numCalls = 0; -let oldConsoleWarn: any; - -describe('warnOnce', () => { - beforeEach(() => { - keepEnv = process.env.NODE_ENV; - numCalls = 0; - lastWarning = null; - oldConsoleWarn = console.warn; - console.warn = (msg: any) => { - numCalls++; - lastWarning = msg; - }; - }); - afterEach(() => { - process.env.NODE_ENV = keepEnv; - console.warn = oldConsoleWarn; - }); - it('actually warns', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('hi'); - expect(lastWarning).toBe('hi'); - expect(numCalls).toEqual(1); - }); - - it('does not warn twice', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('ho'); - warnOnceInDevelopment('ho'); - expect(lastWarning).toEqual('ho'); - expect(numCalls).toEqual(1); - }); - - it('warns two different things once each', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('slow'); - expect(lastWarning).toEqual('slow'); - warnOnceInDevelopment('mo'); - expect(lastWarning).toEqual('mo'); - expect(numCalls).toEqual(2); - }); - - it('does not warn in production', () => { - process.env.NODE_ENV = 'production'; - warnOnceInDevelopment('lo'); - warnOnceInDevelopment('lo'); - expect(numCalls).toEqual(0); - }); - - it('warns many times in test', () => { - process.env.NODE_ENV = 'test'; - warnOnceInDevelopment('yo'); - warnOnceInDevelopment('yo'); - expect(lastWarning).toEqual('yo'); - expect(numCalls).toEqual(2); - }); -}); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/assign.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/assign.ts deleted file mode 100644 index 3a224329..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/assign.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Adds the properties of one or more source objects to a target object. Works exactly like - * `Object.assign`, but as a utility to maintain support for IE 11. - * - * @see https://github.com/apollostack/apollo-client/pull/1009 - */ -export function assign(a: A, b: B): A & B; -export function assign(a: A, b: B, c: C): A & B & C; -export function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export function assign( - a: A, - b: B, - c: C, - d: D, - e: E, -): A & B & C & D & E; -export function assign(target: any, ...sources: Array): any; -export function assign( - target: { [key: string]: any }, - ...sources: Array<{ [key: string]: any }> -): { [key: string]: any } { - sources.forEach(source => { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(key => { - target[key] = source[key]; - }); - }); - return target; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/canUse.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/canUse.ts deleted file mode 100644 index d9858679..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/canUse.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const canUseWeakMap = typeof WeakMap === 'function' && !( - typeof navigator === 'object' && - navigator.product === 'ReactNative' -); diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/cloneDeep.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/cloneDeep.ts deleted file mode 100644 index 961b4a82..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/cloneDeep.ts +++ /dev/null @@ -1,37 +0,0 @@ -const { toString } = Object.prototype; - -/** - * Deeply clones a value to create a new instance. - */ -export function cloneDeep(value: T): T { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val: T, seen: Map): T { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) return seen.get(val); - const copy: T & any[] = (val as any).slice(0); - seen.set(val, copy); - copy.forEach(function (child, i) { - copy[i] = cloneDeepHelper(child, seen); - }); - return copy; - } - - case "[object Object]": { - if (seen.has(val)) return seen.get(val); - // High fidelity polyfills of Object.create and Object.getPrototypeOf are - // possible in all JS environments, so we will assume they exist/work. - const copy = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy); - Object.keys(val).forEach(key => { - copy[key] = cloneDeepHelper((val as any)[key], seen); - }); - return copy; - } - - default: - return val; - } -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/environment.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/environment.ts deleted file mode 100644 index f4ad04e1..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/environment.ts +++ /dev/null @@ -1,24 +0,0 @@ -export function getEnv(): string | undefined { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - // default environment - return 'development'; -} - -export function isEnv(env: string): boolean { - return getEnv() === env; -} - -export function isProduction(): boolean { - return isEnv('production') === true; -} - -export function isDevelopment(): boolean { - return isEnv('development') === true; -} - -export function isTest(): boolean { - return isEnv('test') === true; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/errorHandling.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/errorHandling.ts deleted file mode 100644 index 25a16ca0..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/errorHandling.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ExecutionResult } from 'graphql'; - -export function tryFunctionOrLogError(f: Function) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -export function graphQLResultHasError(result: ExecutionResult) { - return result.errors && result.errors.length; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/filterInPlace.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/filterInPlace.ts deleted file mode 100644 index d5787cab..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/filterInPlace.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function filterInPlace( - array: T[], - test: (elem: T) => boolean, - context?: any, -): T[] { - let target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/isEqual.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/isEqual.ts deleted file mode 100644 index debf7429..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/isEqual.ts +++ /dev/null @@ -1 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts deleted file mode 100644 index d966d336..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { isDevelopment, isTest } from './environment'; - -// Taken (mostly) from https://github.com/substack/deep-freeze to avoid -// import hassles with rollup. -function deepFreeze(o: any) { - Object.freeze(o); - - Object.getOwnPropertyNames(o).forEach(function(prop) { - if ( - o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop]) - ) { - deepFreeze(o[prop]); - } - }); - - return o; -} - -export function maybeDeepFreeze(obj: any) { - if (isDevelopment() || isTest()) { - // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing - // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043). - const symbolIsPolyfilled = - typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/mergeDeep.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/mergeDeep.ts deleted file mode 100644 index d83a33fe..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/mergeDeep.ts +++ /dev/null @@ -1,115 +0,0 @@ -const { hasOwnProperty } = Object.prototype; - -// These mergeDeep and mergeDeepArray utilities merge any number of objects -// together, sharing as much memory as possible with the source objects, while -// remaining careful to avoid modifying any source objects. - -// Logically, the return type of mergeDeep should be the intersection of -// all the argument types. The binary call signature is by far the most -// common, but we support 0- through 5-ary as well. After that, the -// resulting type is just the inferred array element type. Note to nerds: -// there is a more clever way of doing this that converts the tuple type -// first to a union type (easy enough: T[number]) and then converts the -// union to an intersection type using distributive conditional type -// inference, but that approach has several fatal flaws (boolean becomes -// true & false, and the inferred type ends up as unknown in many cases), -// in addition to being nearly impossible to explain/understand. -export type TupleToIntersection = - T extends [infer A] ? A : - T extends [infer A, infer B] ? A & B : - T extends [infer A, infer B, infer C] ? A & B & C : - T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : - T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : - T extends (infer U)[] ? U : any; - -export function mergeDeep( - ...sources: T -): TupleToIntersection { - return mergeDeepArray(sources); -} - -// In almost any situation where you could succeed in getting the -// TypeScript compiler to infer a tuple type for the sources array, you -// could just use mergeDeep instead of mergeDeepArray, so instead of -// trying to convert T[] to an intersection type we just infer the array -// element type, which works perfectly when the sources array has a -// consistent element type. -export function mergeDeepArray(sources: T[]): T { - let target = sources[0] || {} as T; - const count = sources.length; - if (count > 1) { - const pastCopies: any[] = []; - target = shallowCopyForMerge(target, pastCopies); - for (let i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} - -function isObject(obj: any): obj is Record { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper( - target: any, - source: any, - pastCopies: any[], -) { - if (isObject(source) && isObject(target)) { - // In case the target has been frozen, make an extensible copy so that - // we can merge properties into the copy. - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(sourceKey => { - const sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - const targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - // When there is a key collision, we need to make a shallow copy of - // target[sourceKey] so the merge does not modify any source objects. - // To avoid making unnecessary copies, we use a simple array to track - // past copies, since it's safe to modify copies created earlier in - // the merge. We use an array for pastCopies instead of a Map or Set, - // since the number of copies should be relatively small, and some - // Map/Set polyfills modify their keys. - target[sourceKey] = mergeHelper( - shallowCopyForMerge(targetValue, pastCopies), - sourceValue, - pastCopies, - ); - } - } else { - // If there is no collision, the target can safely share memory with - // the source, and the recursion can terminate here. - target[sourceKey] = sourceValue; - } - }); - - return target; - } - - // If source (or target) is not an object, let source replace target. - return source; -} - -function shallowCopyForMerge(value: T, pastCopies: any[]): T { - if ( - value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0 - ) { - if (Array.isArray(value)) { - value = (value as any).slice(0); - } else { - value = { - __proto__: Object.getPrototypeOf(value), - ...value, - }; - } - pastCopies.push(value); - } - return value; -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/stripSymbols.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/stripSymbols.ts deleted file mode 100644 index 41cabae7..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/stripSymbols.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * In order to make assertions easier, this function strips `symbol`'s from - * the incoming data. - * - * This can be handy when running tests against `apollo-client` for example, - * since it adds `symbol`'s to the data in the store. Jest's `toEqual` - * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437), - * which means all test data used in a `toEqual` comparison would also have to - * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data - * we can compare against more simplified test data. - */ -export function stripSymbols(data: T): T { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/warnOnce.ts b/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/warnOnce.ts deleted file mode 100644 index 90f32321..00000000 --- a/node_modules/apollo-cache-inmemory/node_modules/apollo-utilities/src/util/warnOnce.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { isProduction, isTest } from './environment'; - -const haveWarned = Object.create({}); - -/** - * Print a warning only once in development. - * In production no warnings are printed. - * In test all warnings are printed. - * - * @param msg The warning message - * @param type warn or error (will call console.warn or console.error) - */ -export function warnOnceInDevelopment(msg: string, type = 'warn') { - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} diff --git a/node_modules/apollo-cache-inmemory/package.json b/node_modules/apollo-cache-inmemory/package.json deleted file mode 100644 index 10c2929f..00000000 --- a/node_modules/apollo-cache-inmemory/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_from": "apollo-cache-inmemory@latest", - "_id": "apollo-cache-inmemory@1.6.6", - "_inBundle": false, - "_integrity": "sha512-L8pToTW/+Xru2FFAhkZ1OA9q4V4nuvfoPecBM34DecAugUZEBhI2Hmpgnzq2hTKZ60LAMrlqiASm0aqAY6F8/A==", - "_location": "/apollo-cache-inmemory", - "_phantomChildren": { - "@wry/equality": "0.1.9", - "fast-json-stable-stringify": "2.0.0", - "ts-invariant": "0.4.4", - "tslib": "1.10.0" - }, - "_requested": { - "type": "tag", - "registry": true, - "raw": "apollo-cache-inmemory@latest", - "name": "apollo-cache-inmemory", - "escapedName": "apollo-cache-inmemory", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/apollo-cache-inmemory/-/apollo-cache-inmemory-1.6.6.tgz", - "_shasum": "56d1f2a463a6b9db32e9fa990af16d2a008206fd", - "_spec": "apollo-cache-inmemory@latest", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "James Baxley", - "email": "james@meteor.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "James Burgess", - "email": "jamesmillerburgess@gmail.com" - }, - { - "name": "Bazyli Brzóska", - "email": "bazyli.brzoska@gmail.com" - } - ], - "dependencies": { - "apollo-cache": "^1.3.5", - "apollo-utilities": "^1.3.4", - "optimism": "^0.10.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - }, - "deprecated": false, - "description": "Core abstract of Caching layer for Apollo Client", - "gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "license": "MIT", - "main": "./lib/bundle.cjs.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-cache-inmemory", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "scripts": { - "build": "tsc -b .", - "bundle": "npx rollup -c rollup.config.js", - "clean": "rm -rf coverage/* lib/*", - "coverage": "jest --coverage", - "lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts", - "postbuild": "npm run bundle", - "prebuild": "npm run clean", - "prepare": "npm run build", - "prepublishOnly": "npm run build", - "test": "tsc -p tsconfig.json --noEmit && jest", - "watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"" - }, - "sideEffects": [ - "./lib/fixPolyfills.js" - ], - "typings": "./lib/index.d.ts", - "version": "1.6.6" -} diff --git a/node_modules/apollo-cache/CHANGELOG.md b/node_modules/apollo-cache/CHANGELOG.md deleted file mode 100644 index c9adb0e2..00000000 --- a/node_modules/apollo-cache/CHANGELOG.md +++ /dev/null @@ -1,72 +0,0 @@ -# CHANGELOG - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md). - ----- - -### 1.1.12 - -- No changes. - -### 1.1.11 - -- No changes. - -### 1.1.10 - -- Added optional generics to cache manipulation methods (typescript). - [PR #3541](https://github.com/apollographql/apollo-client/pull/3541) - -### 1.1.9 - -- No public facing functionality changes. -- Various internal code cleanup, tooling and dependency changes. - -### 1.1.8 - -- Not documented - -### 1.1.7 - -- Not documented - -### 1.1.6 - -- Improve code coverage -- Map coverage to original source - -### 1.1.3 - -- Dependency updates - -### 1.1.2 - -- Dependency updates - -### 1.1.1 - -- Dependency updates - -### 1.1.0 - -- Add cache.writeData to base cache type & DataProxy - [PR #2818](https://github.com/apollographql/apollo-client/pull/2818) - -### 1.0.3 - -- Dependency updates - -### 1.0.2 - -- Package dependency updates - -### 1.0.1 - -- Improved rollup builds - -### 1.0.0 - -- Initial solid cache API diff --git a/node_modules/apollo-cache/LICENSE b/node_modules/apollo-cache/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-cache/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-cache/jest.config.js b/node_modules/apollo-cache/jest.config.js deleted file mode 100644 index 48f0a891..00000000 --- a/node_modules/apollo-cache/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require('../../config/jest.config.settings'), -}; diff --git a/node_modules/apollo-cache/lib/bundle.cjs.js b/node_modules/apollo-cache/lib/bundle.cjs.js deleted file mode 100644 index 25b0a4e7..00000000 --- a/node_modules/apollo-cache/lib/bundle.cjs.js +++ /dev/null @@ -1,194 +0,0 @@ -exports.__esModule = true; -exports.Cache = exports.ApolloCache = void 0; - -var _apolloUtilities = require("apollo-utilities"); - -function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [op] - }; - return out; -} - -function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType' - } - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [frag] - }; - return out; -} - -function selectionSetFromObj(obj) { - if (typeof obj === 'number' || typeof obj === 'boolean' || typeof obj === 'string' || typeof obj === 'undefined' || obj === null) { - return null; - } - - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key - }, - selectionSet: nestedSelSet || undefined - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections - }; - return selectionSet; -} - -var justTypenameQuery = { - kind: 'Document', - definitions: [{ - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename' - }, - arguments: [], - directives: [], - selectionSet: null - }] - } - }] -}; - -var ApolloCache = function () { - function ApolloCache() {} - - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables - }); - }; - - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName) - }); - }; - - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, - data = _a.data; - - if (typeof id !== 'undefined') { - var typenameResult = null; - - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery - }); - } catch (e) {} - - var __typename = typenameResult && typenameResult.__typename || '__ClientData'; - - var dataToWrite = Object.assign({ - __typename: __typename - }, data); - this.writeFragment({ - id: id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite - }); - } else { - this.writeQuery({ - query: queryFromPojo(data), - data: data - }); - } - }; - - return ApolloCache; -}(); - -exports.ApolloCache = ApolloCache; -var Cache; -exports.Cache = Cache; - -(function (Cache) {})(Cache || (exports.Cache = Cache = {})); diff --git a/node_modules/apollo-cache/lib/bundle.cjs.js.map b/node_modules/apollo-cache/lib/bundle.cjs.js.map deleted file mode 100644 index dee6b947..00000000 --- a/node_modules/apollo-cache/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/utils.ts","../src/cache.ts","../src/types/Cache.ts"],"names":[],"mappings":";;;;;;;SAQgB,a,CAAc,G,EAAQ;AACpC,MAAM,EAAE,GAA4B;AAClC,IAAA,IAAI,EAAE,qBAD4B;AAElC,IAAA,SAAS,EAAE,OAFuB;AAGlC,IAAA,IAAI,EAAE;AACJ,MAAA,IAAI,EAAE,MADF;AAEJ,MAAA,KAAK,EAAE;AAFH,KAH4B;AAOlC,IAAA,YAAY,EAAE,mBAAmB,CAAC,GAAD;AAPC,GAApC;AAUA,MAAM,GAAG,GAAiB;AACxB,IAAA,IAAI,EAAE,UADkB;AAExB,IAAA,WAAW,EAAE,CAAC,EAAD;AAFW,GAA1B;AAKA,SA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EAAA,GAAA,EAAA,CAAA,E;QACA,IAAA,GAAA,EAAA,CAAA,I;;AAEA,QAAI,OAAO,EAAP,KAAc,WAAlB,EAA+B;AAC7B,UAAI,cAAc,GAAG,IAArB;;AAKA,UAAI;AACF,QAAA,cAAc,GAAG,KAAK,IAAL,CAAe;AAC9B,UAAA,MAAM,EAAE,EADsB;AAE9B,UAAA,UAAU,EAAE,KAFkB;AAG9B,UAAA,KAAK,EAAE;AAHuB,SAAf,CAAjB;AAKD,OAND,CAME,OAAO,CAAP,EAAU,CAEX;;AAGD,UAAM,UAAU,GACb,cAAc,IAAI,cAAc,CAAC,UAAlC,IAAiD,cADnD;;AAIA,UAAM,WAAW,GAAG,MAAM,CAAC,MAAP,CAAc;AAAE,QAAA,UAAU,EAAA;AAAZ,OAAd,EAA8B,IAA9B,CAApB;AAEA,WAAK,aAAL,CAAmB;AACjB,QAAA,EAAE,EAAA,EADe;AAEjB,QAAA,QAAQ,EAAE,gBAAgB,CAAC,WAAD,EAAc,UAAd,CAFT;AAGjB,QAAA,IAAI,EAAE;AAHW,OAAnB;AAKD,KA5BD,MA4BO;AACL,WAAK,UAAL,CAAgB;AAAE,QAAA,KAAK,EAAE,aAAa,CAAC,IAAD,CAAtB;AAA8B,QAAA,IAAI,EAAA;AAAlC,OAAhB;AACD;AACF,GAnCM;;AAoCT,SAAA,WAAA;AAAC,C;;;ICnJgB,K;;;AAAjB,CAAA,UAAiB,KAAjB,EAAsB,CAqCrB,CArCD,EAAiB,KAAK,qBAAL,KAAK,GAAA,EAAA,CAAtB,E","sourcesContent":["import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n FieldNode,\n FragmentDefinitionNode,\n} from 'graphql';\n\nexport function queryFromPojo(obj: any): DocumentNode {\n const op: OperationDefinitionNode = {\n kind: 'OperationDefinition',\n operation: 'query',\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [op],\n };\n\n return out;\n}\n\nexport function fragmentFromPojo(obj: any, typename?: string): DocumentNode {\n const frag: FragmentDefinitionNode = {\n kind: 'FragmentDefinition',\n typeCondition: {\n kind: 'NamedType',\n name: {\n kind: 'Name',\n value: typename || '__FakeType',\n },\n },\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [frag],\n };\n\n return out;\n}\n\nfunction selectionSetFromObj(obj: any): SelectionSetNode {\n if (\n typeof obj === 'number' ||\n typeof obj === 'boolean' ||\n typeof obj === 'string' ||\n typeof obj === 'undefined' ||\n obj === null\n ) {\n // No selection set here\n return null;\n }\n\n if (Array.isArray(obj)) {\n // GraphQL queries don't include arrays\n return selectionSetFromObj(obj[0]);\n }\n\n // Now we know it's an object\n const selections: FieldNode[] = [];\n\n Object.keys(obj).forEach(key => {\n const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]);\n\n const field: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: key,\n },\n selectionSet: nestedSelSet || undefined,\n };\n\n selections.push(field);\n });\n\n const selectionSet: SelectionSetNode = {\n kind: 'SelectionSet',\n selections,\n };\n\n return selectionSet;\n}\n\nexport const justTypenameQuery: DocumentNode = {\n kind: 'Document',\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n name: null,\n variableDefinitions: null,\n directives: [],\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'Field',\n alias: null,\n name: {\n kind: 'Name',\n value: '__typename',\n },\n arguments: [],\n directives: [],\n selectionSet: null,\n },\n ],\n },\n },\n ],\n};\n","import { DocumentNode } from 'graphql';\nimport { getFragmentQueryDocument } from 'apollo-utilities';\n\nimport { DataProxy, Cache } from './types';\nimport { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils';\n\nexport type Transaction = (c: ApolloCache) => void;\n\nexport abstract class ApolloCache implements DataProxy {\n // required to implement\n // core API\n public abstract read(\n query: Cache.ReadOptions,\n ): T | null;\n public abstract write(\n write: Cache.WriteOptions,\n ): void;\n public abstract diff(query: Cache.DiffOptions): Cache.DiffResult;\n public abstract watch(watch: Cache.WatchOptions): () => void;\n public abstract evict(\n query: Cache.EvictOptions,\n ): Cache.EvictionResult;\n public abstract reset(): Promise;\n\n // intializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // optimistic API\n public abstract removeOptimistic(id: string): void;\n\n // transactional API\n public abstract performTransaction(\n transaction: Transaction,\n ): void;\n public abstract recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ): void;\n\n // optional API\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n // experimental\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): QueryType | null {\n return this.read({\n query: options.query,\n variables: options.variables,\n optimistic,\n });\n }\n\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): FragmentType | null {\n return this.read({\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n variables: options.variables,\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery(\n options: Cache.WriteQueryOptions,\n ): void {\n this.write({\n dataId: 'ROOT_QUERY',\n result: options.data,\n query: options.query,\n variables: options.variables,\n });\n }\n\n public writeFragment(\n options: Cache.WriteFragmentOptions,\n ): void {\n this.write({\n dataId: options.id,\n result: options.data,\n variables: options.variables,\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n });\n }\n\n public writeData({\n id,\n data,\n }: Cache.WriteDataOptions): void {\n if (typeof id !== 'undefined') {\n let typenameResult = null;\n // Since we can't use fragments without having a typename in the store,\n // we need to make sure we have one.\n // To avoid overwriting an existing typename, we need to read it out first\n // and generate a fake one if none exists.\n try {\n typenameResult = this.read({\n rootId: id,\n optimistic: false,\n query: justTypenameQuery,\n });\n } catch (e) {\n // Do nothing, since an error just means no typename exists\n }\n\n // tslint:disable-next-line\n const __typename =\n (typenameResult && typenameResult.__typename) || '__ClientData';\n\n // Add a type here to satisfy the inmemory cache\n const dataToWrite = Object.assign({ __typename }, data);\n\n this.writeFragment({\n id,\n fragment: fragmentFromPojo(dataToWrite, __typename),\n data: dataToWrite,\n });\n } else {\n this.writeQuery({ query: queryFromPojo(data), data });\n }\n }\n}\n","import { DataProxy } from './DataProxy';\n\nexport namespace Cache {\n export type WatchCallback = (newData: any) => void;\n export interface EvictionResult {\n success: Boolean;\n }\n\n export interface ReadOptions\n extends DataProxy.Query {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n }\n\n export interface WriteOptions\n extends DataProxy.Query {\n dataId: string;\n result: TResult;\n }\n\n export interface DiffOptions extends ReadOptions {\n returnPartialData?: boolean;\n }\n\n export interface WatchOptions extends ReadOptions {\n callback: WatchCallback;\n }\n\n export interface EvictOptions\n extends DataProxy.Query {\n rootId?: string;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import WriteDataOptions = DataProxy.WriteDataOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/bundle.cjs.min.js b/node_modules/apollo-cache/lib/bundle.cjs.min.js deleted file mode 100644 index 5b9e384d..00000000 --- a/node_modules/apollo-cache/lib/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.Cache=exports.ApolloCache=void 0;var e=require("apollo-utilities");function t(e){return{kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:i(e)}]}}function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return null;if(Array.isArray(e))return i(e[0]);var t=[];return Object.keys(e).forEach(function(n){var r={kind:"Field",name:{kind:"Name",value:n},selectionSet:i(e[n])||void 0};t.push(r)}),{kind:"SelectionSet",selections:t}}var n,r={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:null,variableDefinitions:null,directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:null,name:{kind:"Name",value:"__typename"},arguments:[],directives:[],selectionSet:null}]}}]},a=function(){function n(){}return n.prototype.transformDocument=function(e){return e},n.prototype.transformForLink=function(e){return e},n.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.read({query:e.query,variables:e.variables,optimistic:t})},n.prototype.readFragment=function(t,i){return void 0===i&&(i=!1),this.read({query:(0,e.getFragmentQueryDocument)(t.fragment,t.fragmentName),variables:t.variables,rootId:t.id,optimistic:i})},n.prototype.writeQuery=function(e){this.write({dataId:"ROOT_QUERY",result:e.data,query:e.query,variables:e.variables})},n.prototype.writeFragment=function(t){this.write({dataId:t.id,result:t.data,variables:t.variables,query:(0,e.getFragmentQueryDocument)(t.fragment,t.fragmentName)})},n.prototype.writeData=function(e){var n,a,o=e.id,u=e.data;if(void 0!==o){var l=null;try{l=this.read({rootId:o,optimistic:!1,query:r})}catch(e){}var s=l&&l.__typename||"__ClientData",d=Object.assign({__typename:s},u);this.writeFragment({id:o,fragment:(n=d,a=s,{kind:"Document",definitions:[{kind:"FragmentDefinition",typeCondition:{kind:"NamedType",name:{kind:"Name",value:a||"__FakeType"}},name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:i(n)}]}),data:d})}else this.writeQuery({query:t(u),data:u})},n}();exports.ApolloCache=a,exports.Cache=n,n||(exports.Cache=n={}); diff --git a/node_modules/apollo-cache/lib/bundle.esm.js b/node_modules/apollo-cache/lib/bundle.esm.js deleted file mode 100644 index 7f3e30ec..00000000 --- a/node_modules/apollo-cache/lib/bundle.esm.js +++ /dev/null @@ -1,175 +0,0 @@ -import { getFragmentQueryDocument } from 'apollo-utilities'; - -function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [op], - }; - return out; -} -function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType', - }, - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [frag], - }; - return out; -} -function selectionSetFromObj(obj) { - if (typeof obj === 'number' || - typeof obj === 'boolean' || - typeof obj === 'string' || - typeof obj === 'undefined' || - obj === null) { - return null; - } - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key, - }, - selectionSet: nestedSelSet || undefined, - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections, - }; - return selectionSet; -} -var justTypenameQuery = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - ], - }, - }, - ], -}; - -var ApolloCache = (function () { - function ApolloCache() { - } - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables, - }); - }; - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - }); - }; - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, data = _a.data; - if (typeof id !== 'undefined') { - var typenameResult = null; - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery, - }); - } - catch (e) { - } - var __typename = (typenameResult && typenameResult.__typename) || '__ClientData'; - var dataToWrite = Object.assign({ __typename: __typename }, data); - this.writeFragment({ - id: id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite, - }); - } - else { - this.writeQuery({ query: queryFromPojo(data), data: data }); - } - }; - return ApolloCache; -}()); - -var Cache; -(function (Cache) { -})(Cache || (Cache = {})); - -export { ApolloCache, Cache }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-cache/lib/bundle.esm.js.map b/node_modules/apollo-cache/lib/bundle.esm.js.map deleted file mode 100644 index 04ac58c3..00000000 --- a/node_modules/apollo-cache/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/utils.ts","../src/cache.ts","../src/types/Cache.ts"],"sourcesContent":["import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n FieldNode,\n FragmentDefinitionNode,\n} from 'graphql';\n\nexport function queryFromPojo(obj: any): DocumentNode {\n const op: OperationDefinitionNode = {\n kind: 'OperationDefinition',\n operation: 'query',\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [op],\n };\n\n return out;\n}\n\nexport function fragmentFromPojo(obj: any, typename?: string): DocumentNode {\n const frag: FragmentDefinitionNode = {\n kind: 'FragmentDefinition',\n typeCondition: {\n kind: 'NamedType',\n name: {\n kind: 'Name',\n value: typename || '__FakeType',\n },\n },\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [frag],\n };\n\n return out;\n}\n\nfunction selectionSetFromObj(obj: any): SelectionSetNode {\n if (\n typeof obj === 'number' ||\n typeof obj === 'boolean' ||\n typeof obj === 'string' ||\n typeof obj === 'undefined' ||\n obj === null\n ) {\n // No selection set here\n return null;\n }\n\n if (Array.isArray(obj)) {\n // GraphQL queries don't include arrays\n return selectionSetFromObj(obj[0]);\n }\n\n // Now we know it's an object\n const selections: FieldNode[] = [];\n\n Object.keys(obj).forEach(key => {\n const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]);\n\n const field: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: key,\n },\n selectionSet: nestedSelSet || undefined,\n };\n\n selections.push(field);\n });\n\n const selectionSet: SelectionSetNode = {\n kind: 'SelectionSet',\n selections,\n };\n\n return selectionSet;\n}\n\nexport const justTypenameQuery: DocumentNode = {\n kind: 'Document',\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n name: null,\n variableDefinitions: null,\n directives: [],\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'Field',\n alias: null,\n name: {\n kind: 'Name',\n value: '__typename',\n },\n arguments: [],\n directives: [],\n selectionSet: null,\n },\n ],\n },\n },\n ],\n};\n","import { DocumentNode } from 'graphql';\nimport { getFragmentQueryDocument } from 'apollo-utilities';\n\nimport { DataProxy, Cache } from './types';\nimport { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils';\n\nexport type Transaction = (c: ApolloCache) => void;\n\nexport abstract class ApolloCache implements DataProxy {\n // required to implement\n // core API\n public abstract read(\n query: Cache.ReadOptions,\n ): T | null;\n public abstract write(\n write: Cache.WriteOptions,\n ): void;\n public abstract diff(query: Cache.DiffOptions): Cache.DiffResult;\n public abstract watch(watch: Cache.WatchOptions): () => void;\n public abstract evict(\n query: Cache.EvictOptions,\n ): Cache.EvictionResult;\n public abstract reset(): Promise;\n\n // intializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // optimistic API\n public abstract removeOptimistic(id: string): void;\n\n // transactional API\n public abstract performTransaction(\n transaction: Transaction,\n ): void;\n public abstract recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ): void;\n\n // optional API\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n // experimental\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): QueryType | null {\n return this.read({\n query: options.query,\n variables: options.variables,\n optimistic,\n });\n }\n\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): FragmentType | null {\n return this.read({\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n variables: options.variables,\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery(\n options: Cache.WriteQueryOptions,\n ): void {\n this.write({\n dataId: 'ROOT_QUERY',\n result: options.data,\n query: options.query,\n variables: options.variables,\n });\n }\n\n public writeFragment(\n options: Cache.WriteFragmentOptions,\n ): void {\n this.write({\n dataId: options.id,\n result: options.data,\n variables: options.variables,\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n });\n }\n\n public writeData({\n id,\n data,\n }: Cache.WriteDataOptions): void {\n if (typeof id !== 'undefined') {\n let typenameResult = null;\n // Since we can't use fragments without having a typename in the store,\n // we need to make sure we have one.\n // To avoid overwriting an existing typename, we need to read it out first\n // and generate a fake one if none exists.\n try {\n typenameResult = this.read({\n rootId: id,\n optimistic: false,\n query: justTypenameQuery,\n });\n } catch (e) {\n // Do nothing, since an error just means no typename exists\n }\n\n // tslint:disable-next-line\n const __typename =\n (typenameResult && typenameResult.__typename) || '__ClientData';\n\n // Add a type here to satisfy the inmemory cache\n const dataToWrite = Object.assign({ __typename }, data);\n\n this.writeFragment({\n id,\n fragment: fragmentFromPojo(dataToWrite, __typename),\n data: dataToWrite,\n });\n } else {\n this.writeQuery({ query: queryFromPojo(data), data });\n }\n }\n}\n","import { DataProxy } from './DataProxy';\n\nexport namespace Cache {\n export type WatchCallback = (newData: any) => void;\n export interface EvictionResult {\n success: Boolean;\n }\n\n export interface ReadOptions\n extends DataProxy.Query {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n }\n\n export interface WriteOptions\n extends DataProxy.Query {\n dataId: string;\n result: TResult;\n }\n\n export interface DiffOptions extends ReadOptions {\n returnPartialData?: boolean;\n }\n\n export interface WatchOptions extends ReadOptions {\n callback: WatchCallback;\n }\n\n export interface EvictOptions\n extends DataProxy.Query {\n rootId?: string;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import WriteDataOptions = DataProxy.WriteDataOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"],"names":[],"mappings":";;SAQgB,aAAa,CAAC,GAAQ;IACpC,IAAM,EAAE,GAA4B;QAClC,IAAI,EAAE,qBAAqB;QAC3B,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE;YACJ,I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lE,IAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,YAAA,EAAE,EAAE,IAAI,CAAC,CAAC;YAExD,IAAI,CAAC,aAAa,CAAC;gBACjB,EAAE,IAAA;gBACF,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC;gBACnD,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;SACvD;KACF;IACH,kBAAC;CAAA;;ICnJgB,KAAK,CAqCrB;AArCD,WAAiB,KAAK;CAqCrB,EArCgB,KAAK,KAAL,KAAK,QAqCrB;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/bundle.umd.js b/node_modules/apollo-cache/lib/bundle.umd.js deleted file mode 100644 index 0edf921f..00000000 --- a/node_modules/apollo-cache/lib/bundle.umd.js +++ /dev/null @@ -1,208 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "apollo-utilities"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("apollo-utilities")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.apolloUtilities); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _apolloUtilities) { - - _exports.__esModule = true; - _exports.Cache = _exports.ApolloCache = void 0; - - function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [op] - }; - return out; - } - - function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType' - } - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery' - }, - selectionSet: selectionSetFromObj(obj) - }; - var out = { - kind: 'Document', - definitions: [frag] - }; - return out; - } - - function selectionSetFromObj(obj) { - if (typeof obj === 'number' || typeof obj === 'boolean' || typeof obj === 'string' || typeof obj === 'undefined' || obj === null) { - return null; - } - - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key - }, - selectionSet: nestedSelSet || undefined - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections - }; - return selectionSet; - } - - var justTypenameQuery = { - kind: 'Document', - definitions: [{ - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename' - }, - arguments: [], - directives: [], - selectionSet: null - }] - } - }] - }; - - var ApolloCache = function () { - function ApolloCache() {} - - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.read({ - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic - }); - }; - - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables - }); - }; - - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: (0, _apolloUtilities.getFragmentQueryDocument)(options.fragment, options.fragmentName) - }); - }; - - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, - data = _a.data; - - if (typeof id !== 'undefined') { - var typenameResult = null; - - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery - }); - } catch (e) {} - - var __typename = typenameResult && typenameResult.__typename || '__ClientData'; - - var dataToWrite = Object.assign({ - __typename: __typename - }, data); - this.writeFragment({ - id: id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite - }); - } else { - this.writeQuery({ - query: queryFromPojo(data), - data: data - }); - } - }; - - return ApolloCache; - }(); - - _exports.ApolloCache = ApolloCache; - var Cache; - _exports.Cache = Cache; - - (function (Cache) {})(Cache || (_exports.Cache = Cache = {})); - -}); diff --git a/node_modules/apollo-cache/lib/bundle.umd.js.map b/node_modules/apollo-cache/lib/bundle.umd.js.map deleted file mode 100644 index ce6fdb0e..00000000 --- a/node_modules/apollo-cache/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/utils.ts","../src/cache.ts","../src/types/Cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;WAQgB,a,CAAc,G,EAAQ;AACpC,QAAM,EAAE,GAA4B;AAClC,MAAA,IAAI,EAAE,qBAD4B;AAElC,MAAA,SAAS,EAAE,OAFuB;AAGlC,MAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,MADF;AAEJ,QAAA,KAAK,EAAE;AAFH,OAH4B;AAOlC,MAAA,YAAY,EAAE,mBAAmB,CAAC,GAAD;AAPC,KAApC;AAUA,QAAM,GAAG,GAAiB;AACxB,MAAA,IAAI,EAAE,UADkB;AAExB,MAAA,WAAW,EAAE,CAAC,EAAD;AAFW,KAA1B;AAKA,WAAO,GAAP;AACD;;AAED,WAAgB,gBAAhB,CAAiC,GAAjC,EAA2C,QAA3C,EAA4D;AAC1D,QAAM,IAAI,GAA2B;AACnC,MAAA,IAAI,EAAE,oBAD6B;AAEnC,MAAA,aAAa,EAAE;AACb,QAAA,IAAI,EAAE,WADO;AAEb,QAAA,IAAI,EAAE;AACJ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E,EADsB;AAE9B,YAAA,UAAU,EAAE,KAFkB;AAG9B,YAAA,KAAK,EAAE;AAHuB,WAAf,CAAjB;AAKD,SAND,CAME,OAAO,CAAP,EAAU,CAEX;;AAGD,YAAM,UAAU,GACb,cAAc,IAAI,cAAc,CAAC,UAAlC,IAAiD,cADnD;;AAIA,YAAM,WAAW,GAAG,MAAM,CAAC,MAAP,CAAc;AAAE,UAAA,UAAU,EAAA;AAAZ,SAAd,EAA8B,IAA9B,CAApB;AAEA,aAAK,aAAL,CAAmB;AACjB,UAAA,EAAE,EAAA,EADe;AAEjB,UAAA,QAAQ,EAAE,gBAAgB,CAAC,WAAD,EAAc,UAAd,CAFT;AAGjB,UAAA,IAAI,EAAE;AAHW,SAAnB;AAKD,OA5BD,MA4BO;AACL,aAAK,UAAL,CAAgB;AAAE,UAAA,KAAK,EAAE,aAAa,CAAC,IAAD,CAAtB;AAA8B,UAAA,IAAI,EAAA;AAAlC,SAAhB;AACD;AACF,KAnCM;;AAoCT,WAAA,WAAA;AAAC,G;;;MCnJgB,K;;;AAAjB,GAAA,UAAiB,KAAjB,EAAsB,CAqCrB,CArCD,EAAiB,KAAK,sBAAL,KAAK,GAAA,EAAA,CAAtB,E","sourcesContent":["import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n FieldNode,\n FragmentDefinitionNode,\n} from 'graphql';\n\nexport function queryFromPojo(obj: any): DocumentNode {\n const op: OperationDefinitionNode = {\n kind: 'OperationDefinition',\n operation: 'query',\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [op],\n };\n\n return out;\n}\n\nexport function fragmentFromPojo(obj: any, typename?: string): DocumentNode {\n const frag: FragmentDefinitionNode = {\n kind: 'FragmentDefinition',\n typeCondition: {\n kind: 'NamedType',\n name: {\n kind: 'Name',\n value: typename || '__FakeType',\n },\n },\n name: {\n kind: 'Name',\n value: 'GeneratedClientQuery',\n },\n selectionSet: selectionSetFromObj(obj),\n };\n\n const out: DocumentNode = {\n kind: 'Document',\n definitions: [frag],\n };\n\n return out;\n}\n\nfunction selectionSetFromObj(obj: any): SelectionSetNode {\n if (\n typeof obj === 'number' ||\n typeof obj === 'boolean' ||\n typeof obj === 'string' ||\n typeof obj === 'undefined' ||\n obj === null\n ) {\n // No selection set here\n return null;\n }\n\n if (Array.isArray(obj)) {\n // GraphQL queries don't include arrays\n return selectionSetFromObj(obj[0]);\n }\n\n // Now we know it's an object\n const selections: FieldNode[] = [];\n\n Object.keys(obj).forEach(key => {\n const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]);\n\n const field: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: key,\n },\n selectionSet: nestedSelSet || undefined,\n };\n\n selections.push(field);\n });\n\n const selectionSet: SelectionSetNode = {\n kind: 'SelectionSet',\n selections,\n };\n\n return selectionSet;\n}\n\nexport const justTypenameQuery: DocumentNode = {\n kind: 'Document',\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n name: null,\n variableDefinitions: null,\n directives: [],\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'Field',\n alias: null,\n name: {\n kind: 'Name',\n value: '__typename',\n },\n arguments: [],\n directives: [],\n selectionSet: null,\n },\n ],\n },\n },\n ],\n};\n","import { DocumentNode } from 'graphql';\nimport { getFragmentQueryDocument } from 'apollo-utilities';\n\nimport { DataProxy, Cache } from './types';\nimport { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils';\n\nexport type Transaction = (c: ApolloCache) => void;\n\nexport abstract class ApolloCache implements DataProxy {\n // required to implement\n // core API\n public abstract read(\n query: Cache.ReadOptions,\n ): T | null;\n public abstract write(\n write: Cache.WriteOptions,\n ): void;\n public abstract diff(query: Cache.DiffOptions): Cache.DiffResult;\n public abstract watch(watch: Cache.WatchOptions): () => void;\n public abstract evict(\n query: Cache.EvictOptions,\n ): Cache.EvictionResult;\n public abstract reset(): Promise;\n\n // intializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // optimistic API\n public abstract removeOptimistic(id: string): void;\n\n // transactional API\n public abstract performTransaction(\n transaction: Transaction,\n ): void;\n public abstract recordOptimisticTransaction(\n transaction: Transaction,\n id: string,\n ): void;\n\n // optional API\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n // experimental\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): QueryType | null {\n return this.read({\n query: options.query,\n variables: options.variables,\n optimistic,\n });\n }\n\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): FragmentType | null {\n return this.read({\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n variables: options.variables,\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery(\n options: Cache.WriteQueryOptions,\n ): void {\n this.write({\n dataId: 'ROOT_QUERY',\n result: options.data,\n query: options.query,\n variables: options.variables,\n });\n }\n\n public writeFragment(\n options: Cache.WriteFragmentOptions,\n ): void {\n this.write({\n dataId: options.id,\n result: options.data,\n variables: options.variables,\n query: getFragmentQueryDocument(options.fragment, options.fragmentName),\n });\n }\n\n public writeData({\n id,\n data,\n }: Cache.WriteDataOptions): void {\n if (typeof id !== 'undefined') {\n let typenameResult = null;\n // Since we can't use fragments without having a typename in the store,\n // we need to make sure we have one.\n // To avoid overwriting an existing typename, we need to read it out first\n // and generate a fake one if none exists.\n try {\n typenameResult = this.read({\n rootId: id,\n optimistic: false,\n query: justTypenameQuery,\n });\n } catch (e) {\n // Do nothing, since an error just means no typename exists\n }\n\n // tslint:disable-next-line\n const __typename =\n (typenameResult && typenameResult.__typename) || '__ClientData';\n\n // Add a type here to satisfy the inmemory cache\n const dataToWrite = Object.assign({ __typename }, data);\n\n this.writeFragment({\n id,\n fragment: fragmentFromPojo(dataToWrite, __typename),\n data: dataToWrite,\n });\n } else {\n this.writeQuery({ query: queryFromPojo(data), data });\n }\n }\n}\n","import { DataProxy } from './DataProxy';\n\nexport namespace Cache {\n export type WatchCallback = (newData: any) => void;\n export interface EvictionResult {\n success: Boolean;\n }\n\n export interface ReadOptions\n extends DataProxy.Query {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n }\n\n export interface WriteOptions\n extends DataProxy.Query {\n dataId: string;\n result: TResult;\n }\n\n export interface DiffOptions extends ReadOptions {\n returnPartialData?: boolean;\n }\n\n export interface WatchOptions extends ReadOptions {\n callback: WatchCallback;\n }\n\n export interface EvictOptions\n extends DataProxy.Query {\n rootId?: string;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import WriteDataOptions = DataProxy.WriteDataOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/cache.d.ts b/node_modules/apollo-cache/lib/cache.d.ts deleted file mode 100644 index b2a2fd03..00000000 --- a/node_modules/apollo-cache/lib/cache.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { DocumentNode } from 'graphql'; -import { DataProxy, Cache } from './types'; -export declare type Transaction = (c: ApolloCache) => void; -export declare abstract class ApolloCache implements DataProxy { - abstract read(query: Cache.ReadOptions): T | null; - abstract write(write: Cache.WriteOptions): void; - abstract diff(query: Cache.DiffOptions): Cache.DiffResult; - abstract watch(watch: Cache.WatchOptions): () => void; - abstract evict(query: Cache.EvictOptions): Cache.EvictionResult; - abstract reset(): Promise; - abstract restore(serializedState: TSerialized): ApolloCache; - abstract extract(optimistic?: boolean): TSerialized; - abstract removeOptimistic(id: string): void; - abstract performTransaction(transaction: Transaction): void; - abstract recordOptimisticTransaction(transaction: Transaction, id: string): void; - transformDocument(document: DocumentNode): DocumentNode; - transformForLink(document: DocumentNode): DocumentNode; - readQuery(options: DataProxy.Query, optimistic?: boolean): QueryType | null; - readFragment(options: DataProxy.Fragment, optimistic?: boolean): FragmentType | null; - writeQuery(options: Cache.WriteQueryOptions): void; - writeFragment(options: Cache.WriteFragmentOptions): void; - writeData({ id, data, }: Cache.WriteDataOptions): void; -} -//# sourceMappingURL=cache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/cache.d.ts.map b/node_modules/apollo-cache/lib/cache.d.ts.map deleted file mode 100644 index 45ce1253..00000000 --- a/node_modules/apollo-cache/lib/cache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAG3C,oBAAY,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEzD,8BAAsB,WAAW,CAAC,WAAW,CAAE,YAAW,SAAS;aAGjD,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,GAAG,EACtC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,GACnC,CAAC,GAAG,IAAI;aACK,KAAK,CAAC,OAAO,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACnD,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,GAC7C,IAAI;aACS,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,C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AAK,EAAE,UAAU,CAAC,GACrD,IAAI;IASA,SAAS,CAAC,KAAK,GAAG,GAAG,EAAE,EAC5B,EAAE,EACF,IAAI,GACL,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,IAAI;CAiCxC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/cache.js b/node_modules/apollo-cache/lib/cache.js deleted file mode 100644 index aec0779b..00000000 --- a/node_modules/apollo-cache/lib/cache.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var apollo_utilities_1 = require("apollo-utilities"); -var utils_1 = require("./utils"); -var ApolloCache = (function () { - function ApolloCache() { - } - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: options.query, - variables: options.variables, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.read({ - query: apollo_utilities_1.getFragmentQueryDocument(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic: optimistic, - }); - }; - ApolloCache.prototype.writeQuery = function (options) { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables, - }); - }; - ApolloCache.prototype.writeFragment = function (options) { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: apollo_utilities_1.getFragmentQueryDocument(options.fragment, options.fragmentName), - }); - }; - ApolloCache.prototype.writeData = function (_a) { - var id = _a.id, data = _a.data; - if (typeof id !== 'undefined') { - var typenameResult = null; - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: utils_1.justTypenameQuery, - }); - } - catch (e) { - } - var __typename = (typenameResult && typenameResult.__typename) || '__ClientData'; - var dataToWrite = Object.assign({ __typename: __typename }, data); - this.writeFragment({ - id: id, - fragment: utils_1.fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite, - }); - } - else { - this.writeQuery({ query: utils_1.queryFromPojo(data), data: data }); - } - }; - return ApolloCache; -}()); -exports.ApolloCache = ApolloCache; -//# sourceMappingURL=cache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/cache.js.map b/node_modules/apollo-cache/lib/cache.js.map deleted file mode 100644 index 348c78f5..00000000 --- a/node_modules/apollo-cache/lib/cache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";;AACA,qDAA4D;AAG5D,iCAA6E;AAI7E;IAAA;IA6IA,CAAC;IA/FQ,uCAAiB,GAAxB,UAAyB,QAAsB;QAC7C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,sCAAgB,GAAvB,UAAwB,QAAsB;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAQM,+BAAS,GAAhB,UACE,OAAoC,EACpC,UAA2B;QAA3B,2BAAA,EAAA,kBAA2B;QAE3B,OAAO,IAAI,CAAC,IAAI,CAAC;YACf,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,YAAA;SACX,CAAC,CAAC;IACL,CAAC;IAEM,kCAAY,GAAnB,UACE,OAAuC,EACvC,UAA2B;QAA3B,2BAAA,EAAA,kBAA2B;QAE3B,OAAO,IAAI,CAAC,IAAI,CAAC;YACf,KAAK,EAAE,2CAAwB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC;YACvE,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,MAAM,EAAE,OAAO,CAAC,EAAE;YAClB,UAAU,YAAA;SACX,CAAC,CAAC;IACL,CAAC;IAEM,gCAAU,GAAjB,UACE,OAAmD;QAEnD,IAAI,CAAC,KAAK,CAAC;YACT,MAAM,EAAE,YAAY;YACpB,MAAM,EAAE,OAAO,CAAC,IAAI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W"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/index.d.ts b/node_modules/apollo-cache/lib/index.d.ts deleted file mode 100644 index 5b294ac6..00000000 --- a/node_modules/apollo-cache/lib/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './cache'; -export * from './types'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/index.d.ts.map b/node_modules/apollo-cache/lib/index.d.ts.map deleted file mode 100644 index bc245457..00000000 --- a/node_modules/apollo-cache/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/index.js b/node_modules/apollo-cache/lib/index.js deleted file mode 100644 index decd22aa..00000000 --- a/node_modules/apollo-cache/lib/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./cache"), exports); -tslib_1.__exportStar(require("./types"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/index.js.map b/node_modules/apollo-cache/lib/index.js.map deleted file mode 100644 index a385466c..00000000 --- a/node_modules/apollo-cache/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,kDAAwB"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/Cache.d.ts b/node_modules/apollo-cache/lib/types/Cache.d.ts deleted file mode 100644 index 5a9e6497..00000000 --- a/node_modules/apollo-cache/lib/types/Cache.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { DataProxy } from './DataProxy'; -export declare namespace Cache { - type WatchCallback = (newData: any) => void; - interface EvictionResult { - success: Boolean; - } - interface ReadOptions extends DataProxy.Query { - rootId?: string; - previousResult?: any; - optimistic: boolean; - } - interface WriteOptions extends DataProxy.Query { - dataId: string; - result: TResult; - } - interface DiffOptions extends ReadOptions { - returnPartialData?: boolean; - } - interface WatchOptions extends ReadOptions { - callback: WatchCallback; - } - interface EvictOptions extends DataProxy.Query { - rootId?: string; - } - export import DiffResult = DataProxy.DiffResult; - export import WriteQueryOptions = DataProxy.WriteQueryOptions; - export import WriteFragmentOptions = DataProxy.WriteFragmentOptions; - export import WriteDataOptions = DataProxy.WriteDataOptions; - export import Fragment = DataProxy.Fragment; -} -//# sourceMappingURL=Cache.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/Cache.d.ts.map b/node_modules/apollo-cache/lib/types/Cache.d.ts.map deleted file mode 100644 index aa4f617f..00000000 --- a/node_modules/apollo-cache/lib/types/Cache.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../src/types/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,yBAAiB,KAAK,CAAC;IACrB,KAAY,aAAa,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACnD,UAAiB,cAAc;QAC7B,OAAO,EAAE,OAAO,CAAC;KAClB;IAED,UAAiB,WAAW,CAAC,UAAU,GAAG,GAAG,CAC3C,SAAQ,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC;QACnC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,GAAG,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;KACrB;IAED,UAAiB,YAAY,CAAC,OAAO,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,CAC3D,SAAQ,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC;QACnC,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,OAAO,CAAC;KACjB;IAED,UAAiB,WAAY,SAAQ,WAAW;QAC9C,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B;IAED,UAAiB,YAAa,SAAQ,WAAW;QAC/C,QAAQ,EAAE,aAAa,CAAC;KACzB;IAED,UAAiB,YAAY,CAAC,UAAU,GAAG,GAAG,CAC5C,SAAQ,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC;QACnC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAED,MAAM,QAAQ,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IAChD,MAAM,QAAQ,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;IAC9D,MAAM,QAAQ,oBAAoB,GAAG,SAAS,CAAC,oBAAoB,CAAC;IACpE,MAAM,QAAQ,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC;IAC5D,MAAM,QAAQ,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;CAC7C"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/Cache.js b/node_modules/apollo-cache/lib/types/Cache.js deleted file mode 100644 index a2cebe56..00000000 --- a/node_modules/apollo-cache/lib/types/Cache.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Cache; -(function (Cache) { -})(Cache = exports.Cache || (exports.Cache = {})); -//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/Cache.js.map b/node_modules/apollo-cache/lib/types/Cache.js.map deleted file mode 100644 index f92c62a7..00000000 --- a/node_modules/apollo-cache/lib/types/Cache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/types/Cache.ts"],"names":[],"mappings":";;AAEA,IAAiB,KAAK,CAqCrB;AArCD,WAAiB,KAAK;AAqCtB,CAAC,EArCgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAqCrB"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/DataProxy.d.ts b/node_modules/apollo-cache/lib/types/DataProxy.d.ts deleted file mode 100644 index 2c27091f..00000000 --- a/node_modules/apollo-cache/lib/types/DataProxy.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare namespace DataProxy { - interface Query { - query: DocumentNode; - variables?: TVariables; - } - interface Fragment { - id: string; - fragment: DocumentNode; - fragmentName?: string; - variables?: TVariables; - } - interface WriteQueryOptions extends Query { - data: TData; - } - interface WriteFragmentOptions extends Fragment { - data: TData; - } - interface WriteDataOptions { - data: TData; - id?: string; - } - type DiffResult = { - result?: T; - complete?: boolean; - }; -} -export interface DataProxy { - readQuery(options: DataProxy.Query, optimistic?: boolean): QueryType | null; - readFragment(options: DataProxy.Fragment, optimistic?: boolean): FragmentType | null; - writeQuery(options: DataProxy.WriteQueryOptions): void; - writeFragment(options: DataProxy.WriteFragmentOptions): void; - writeData(options: DataProxy.WriteDataOptions): void; -} -//# sourceMappingURL=DataProxy.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/DataProxy.d.ts.map b/node_modules/apollo-cache/lib/types/DataProxy.d.ts.map deleted file mode 100644 index 81d0ffc0..00000000 --- a/node_modules/apollo-cache/lib/types/DataProxy.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DataProxy.d.ts","sourceRoot":"","sources":["../src/types/DataProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,yBAAiB,SAAS,CAAC;IACzB,UAAiB,KAAK,CAAC,UAAU;QAM/B,KAAK,EAAE,YAAY,CAAC;QAKpB,SAAS,CAAC,EAAE,UAAU,CAAC;KACxB;IAED,UAAiB,QAAQ,CAAC,UAAU;QAMlC,EAAE,EAAE,MAAM,CAAC;QAQX,QAAQ,EAAE,YAAY,CAAC;QAOvB,YAAY,CAAC,EAAE,MAAM,CAAC;QAKtB,SAAS,CAAC,EAAE,UAAU,CAAC;K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C1E"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/DataProxy.js b/node_modules/apollo-cache/lib/types/DataProxy.js deleted file mode 100644 index e64cb3d2..00000000 --- a/node_modules/apollo-cache/lib/types/DataProxy.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=DataProxy.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/DataProxy.js.map b/node_modules/apollo-cache/lib/types/DataProxy.js.map deleted file mode 100644 index 69756757..00000000 --- a/node_modules/apollo-cache/lib/types/DataProxy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../src/types/DataProxy.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/index.d.ts b/node_modules/apollo-cache/lib/types/index.d.ts deleted file mode 100644 index 4b63d048..00000000 --- a/node_modules/apollo-cache/lib/types/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './DataProxy'; -export * from './Cache'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/index.d.ts.map b/node_modules/apollo-cache/lib/types/index.d.ts.map deleted file mode 100644 index 856e64bc..00000000 --- a/node_modules/apollo-cache/lib/types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/index.js b/node_modules/apollo-cache/lib/types/index.js deleted file mode 100644 index 83309fe1..00000000 --- a/node_modules/apollo-cache/lib/types/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./Cache"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/types/index.js.map b/node_modules/apollo-cache/lib/types/index.js.map deleted file mode 100644 index 3b77f7b1..00000000 --- a/node_modules/apollo-cache/lib/types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AACA,kDAAwB"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/utils.d.ts b/node_modules/apollo-cache/lib/utils.d.ts deleted file mode 100644 index 28514c9f..00000000 --- a/node_modules/apollo-cache/lib/utils.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare function queryFromPojo(obj: any): DocumentNode; -export declare function fragmentFromPojo(obj: any, typename?: string): DocumentNode; -export declare const justTypenameQuery: DocumentNode; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/utils.d.ts.map b/node_modules/apollo-cache/lib/utils.d.ts.map deleted file mode 100644 index f673d7a3..00000000 --- a/node_modules/apollo-cache/lib/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKb,MAAM,SAAS,CAAC;AAEjB,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,CAiBpD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAuB1E;AA6CD,eAAO,MAAM,iBAAiB,EAAE,YA2B/B,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/utils.js b/node_modules/apollo-cache/lib/utils.js deleted file mode 100644 index 289e5182..00000000 --- a/node_modules/apollo-cache/lib/utils.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function queryFromPojo(obj) { - var op = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [op], - }; - return out; -} -exports.queryFromPojo = queryFromPojo; -function fragmentFromPojo(obj, typename) { - var frag = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType', - }, - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - var out = { - kind: 'Document', - definitions: [frag], - }; - return out; -} -exports.fragmentFromPojo = fragmentFromPojo; -function selectionSetFromObj(obj) { - if (typeof obj === 'number' || - typeof obj === 'boolean' || - typeof obj === 'string' || - typeof obj === 'undefined' || - obj === null) { - return null; - } - if (Array.isArray(obj)) { - return selectionSetFromObj(obj[0]); - } - var selections = []; - Object.keys(obj).forEach(function (key) { - var nestedSelSet = selectionSetFromObj(obj[key]); - var field = { - kind: 'Field', - name: { - kind: 'Name', - value: key, - }, - selectionSet: nestedSelSet || undefined, - }; - selections.push(field); - }); - var selectionSet = { - kind: 'SelectionSet', - selections: selections, - }; - return selectionSet; -} -exports.justTypenameQuery = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - ], - }, - }, - ], -}; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/lib/utils.js.map b/node_modules/apollo-cache/lib/utils.js.map deleted file mode 100644 index 465f5021..00000000 --- a/node_modules/apollo-cache/lib/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAQA,SAAgB,aAAa,CAAC,GAAQ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AAgB,EAAE,CAAC;IAEnC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;QAC1B,IAAM,YAAY,GAAqB,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAErE,IAAM,KAAK,GAAc;YACvB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,GAAG;aACX;YACD,YAAY,EAAE,YAAY,IAAI,SAAS;SACxC,CAAC;QAEF,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,IAAM,YAAY,GAAqB;QACrC,IAAI,EAAE,cAAc;QACpB,UAAU,YAAA;KACX,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC;AAEY,QAAA,iBAAiB,GAAiB;IAC7C,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE;QACX;YACE,IAAI,EAAE,qBAAqB;YAC3B,SAAS,EAAE,OAAO;YAClB,IAAI,EAAE,IAAI;YACV,mBAAmB,EAAE,IAAI;YACzB,UAAU,EAAE,EAAE;YACd,YAAY,EAAE;gBACZ,IAAI,EAAE,cAAc;gBACpB,UAAU,EAAE;oBACV;wBACE,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,IAAI;wBACX,IAAI,EAAE;4BACJ,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,YAAY;yBACpB;wBACD,SAAS,EAAE,EAAE;wBACb,UAAU,EAAE,EAAE;wBACd,YAAY,EAAE,IAAI;qBACnB;iBACF;aACF;SACF;KACF;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/.flowconfig b/node_modules/apollo-cache/node_modules/apollo-utilities/.flowconfig deleted file mode 100644 index ffa2101c..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/.flowconfig +++ /dev/null @@ -1,8 +0,0 @@ -[ignore] - -[include] - -[libs] - -[options] -suppress_comment= \\(.\\|\n\\)*\\$ExpectError diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/CHANGELOG.md b/node_modules/apollo-cache/node_modules/apollo-utilities/CHANGELOG.md deleted file mode 100644 index 2cabb608..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/CHANGELOG.md +++ /dev/null @@ -1,106 +0,0 @@ -# CHANGELOG - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md). - ----- - -### 1.0.16 - -- Removed unnecessary whitespace from error message - [Issue #3398](https://github.com/apollographql/apollo-client/issues/3398) - [PR #3593](https://github.com/apollographql/apollo-client/pull/3593) - -### 1.0.15 - -- No changes - -### 1.0.14 - -- Store key names generated by `getStoreKeyName` now leverage a more - deterministic approach to handling JSON based strings. This prevents store - key names from differing when using `args` like - `{ prop1: 'value1', prop2: 'value2' }` and - `{ prop2: 'value2', prop1: 'value1' }`. - [PR #2869](https://github.com/apollographql/apollo-client/pull/2869) -- Avoid needless `hasOwnProperty` check in `deepFreeze`. - [PR #3545](https://github.com/apollographql/apollo-client/pull/3545) - -### 1.0.13 - -- Make `maybeDeepFreeze` a little more defensive, by always using - `Object.prototype.hasOwnProperty` (to avoid cases where the object being - frozen doesn't have its own `hasOwnProperty`). - [Issue #3426](https://github.com/apollographql/apollo-client/issues/3426) - [PR #3418](https://github.com/apollographql/apollo-client/pull/3418) -- Remove certain small internal caches to prevent memory leaks when using SSR. - [PR #3444](https://github.com/apollographql/apollo-client/pull/3444) - -### 1.0.12 - -- Not documented - -### 1.0.11 - -- `toIdValue` helper now takes an object with `id` and `typename` properties - as the preferred interface - [PR #3159](https://github.com/apollographql/apollo-client/pull/3159) -- Map coverage to original source -- Don't `deepFreeze` in development/test environments if ES6 symbols are - polyfilled - [PR #3082](https://github.com/apollographql/apollo-client/pull/3082) -- Added ability to include or ignore fragments in `getDirectivesFromDocument` - [PR #3010](https://github.com/apollographql/apollo-client/pull/3010) - -### 1.0.9 - -- Dependency updates -- Added getDirectivesFromDocument utility function - [PR #2974](https://github.com/apollographql/apollo-client/pull/2974) - -### 1.0.8 - -- Add client, rest, and export directives to list of known directives - [PR #2949](https://github.com/apollographql/apollo-client/pull/2949) - -### 1.0.7 - -- Fix typo in error message for invalid argument being passed to @skip or - @include directives - [PR #2867](https://github.com/apollographql/apollo-client/pull/2867) - -### 1.0.6 - -- Update `getStoreKeyName` to support custom directives - -### 1.0.5 - -- Package dependency updates - -### 1.0.4 - -- Package dependency updates - -### 1.0.3 - -- Package dependency updates - -### 1.0.2 - -- Improved rollup builds - -### 1.0.1 - -- Added config to remove selection set of directive matches test - -### 1.0.0 - -- Added utilities from hermes cache -- Added removeDirectivesFromDocument to allow cleaning of client only - directives -- Added hasDirectives to recurse the AST and return a boolean for an array of - directive names -- Improved performance of common store actions by memoizing addTypename and - removeConnectionDirective diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/LICENSE b/node_modules/apollo-cache/node_modules/apollo-utilities/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/jest.config.js b/node_modules/apollo-cache/node_modules/apollo-utilities/jest.config.js deleted file mode 100644 index 48f0a891..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require('../../config/jest.config.settings'), -}; diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.js deleted file mode 100644 index 49d9f007..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.js +++ /dev/null @@ -1,1125 +0,0 @@ -exports.__esModule = true; -exports.addTypenameToDocument = addTypenameToDocument; -exports.argumentsObjectFromField = argumentsObjectFromField; -exports.assign = assign; -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -exports.checkDocument = checkDocument; -exports.cloneDeep = cloneDeep; -exports.createFragmentMap = createFragmentMap; -exports.getDefaultValues = getDefaultValues; -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -exports.getDirectiveNames = getDirectiveNames; -exports.getDirectivesFromDocument = getDirectivesFromDocument; -exports.getEnv = getEnv; -exports.getFragmentDefinition = getFragmentDefinition; -exports.getFragmentDefinitions = getFragmentDefinitions; -exports.getFragmentQueryDocument = getFragmentQueryDocument; -exports.getInclusionDirectives = getInclusionDirectives; -exports.getMainDefinition = getMainDefinition; -exports.getMutationDefinition = getMutationDefinition; -exports.getOperationDefinition = getOperationDefinition; -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -exports.getOperationName = getOperationName; -exports.getQueryDefinition = getQueryDefinition; -exports.getStoreKeyName = getStoreKeyName; -exports.graphQLResultHasError = graphQLResultHasError; -exports.hasClientExports = hasClientExports; -exports.hasDirectives = hasDirectives; -exports.isDevelopment = isDevelopment; -exports.isEnv = isEnv; -exports.isField = isField; -exports.isIdValue = isIdValue; -exports.isInlineFragment = isInlineFragment; -exports.isJsonValue = isJsonValue; -exports.isNumberValue = isNumberValue; -exports.isProduction = isProduction; -exports.isScalarValue = isScalarValue; -exports.isTest = isTest; -exports.maybeDeepFreeze = maybeDeepFreeze; -exports.mergeDeep = mergeDeep; -exports.mergeDeepArray = mergeDeepArray; -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -exports.resultKeyNameFromField = resultKeyNameFromField; -exports.shouldInclude = shouldInclude; -exports.storeKeyNameFromField = storeKeyNameFromField; -exports.stripSymbols = stripSymbols; -exports.toIdValue = toIdValue; -exports.tryFunctionOrLogError = tryFunctionOrLogError; -exports.valueFromNode = valueFromNode; -exports.valueToObjectRepresentation = valueToObjectRepresentation; -exports.variablesInOperation = variablesInOperation; -exports.warnOnceInDevelopment = warnOnceInDevelopment; -exports.canUseWeakMap = exports.isEqual = void 0; - -var _visitor = require("graphql/language/visitor"); - -var _tsInvariant = require("ts-invariant"); - -var _tslib = require("tslib"); - -var _fastJsonStableStringify = _interopRequireDefault(require("fast-json-stable-stringify")); - -var _equality = require("@wry/equality"); - -exports.isEqual = _equality.equal; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value) { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value) { - return value.kind === 'IntValue'; -} - -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} - -function isVariable(value) { - return value.kind === 'Variable'; -} - -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} - -function isListValue(value) { - return value.kind === 'ListValue'; -} - -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} - -function isNullValue(value) { - return value.kind === 'NullValue'; -} - -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } -} - -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - -function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; -} - -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; -} - -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} - -function isField(selection) { - return selection.kind === 'Field'; -} - -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} - -function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; -} - -function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); -} - -function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; -} - -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); -} - -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; -} - -function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; -} - -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); -} - -function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); -} - -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} - -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; -} - -function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} - -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} - -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; -} - -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; -} - -function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; -} - -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); -} - -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} - -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} - -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} - -function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} - -function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; -} - -function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } -}; - -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); -} - -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; -} - -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; -} - -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; -} - -function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); -} - -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } -}; - -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} - -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); -} - -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); -} - -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); -} - -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; -} - -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); -} - -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); -} - -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} - -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; -} - -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); -exports.canUseWeakMap = canUseWeakMap; -var toString = Object.prototype.toString; - -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; -} - -function isEnv(env) { - return getEnv() === env; -} - -function isProduction() { - return isEnv('production') === true; -} - -function isDevelopment() { - return isEnv('development') === true; -} - -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} - -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); -} - -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; -} - -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; -} - -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; -} - -var haveWarned = Object.create({}); - -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.js.map deleted file mode 100644 index a445ea6f..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAiDgB,a,CAAc,K,EAAgB;AAC5C,SAAO,CAAC,aAAD,EAAgB,cAAhB,EAAgC,WAAhC,EAA6C,OAA7C,CAAqD,KAAK,CAAC,IAA3D,IAAmE,CAAC,CAA3E;AACD;;AAID,SAAgB,aAAhB,CAA8B,KAA9B,EAA8C;AAC5C,SAAO,CAAC,UAAD,EAAa,YAAb,EAA2B,OAA3B,CAAmC,KAAK,CAAC,IAAzC,IAAiD,CAAC,CAAzD;AACD;;AAED,SAAS,aAAT,CAAuB,KAAvB,EAAuC;AACrC,SAAO,KAAK,CAAC,IAAN,KAAe,aAAtB;AACD;;AAED,SAAS,cAAT,CAAwB,KAAxB,EAAwC;AACtC,SAAO,KAAK,CAAC,IAAN,KAAe,cAAtB;AACD;;AAED,SAAS,UAAT,CAAoB,KAApB,EAAoC;AAClC,SAAO,KAAK,CAAC,IAAN,KAAe,UAAtB;AACD;;AAED,SAAS,YAAT,CAAsB,KAAtB,EAAsC;AACpC,SAAO,KAAK,CAAC,IAAN,KAAe,YAAtB;AACD;;AAED,SAAS,UAAT,CAAoB,KAApB,EAAoC;AAClC,SAAO,KAAK,CAAC,IAAN,KAAe,UAAtB;AACD;;AAED,SAAS,aAAT,CAAuB,KAAvB,EAAuC;AACrC,SAAO,KAAK,CAAC,IAAN,KAAe,aAAtB;AACD;;AAED,SAAS,WAAT,CAAqB,KAArB,EAAqC;AACnC,SAAO,KAAK,CAAC,IAAN,KAAe,WAAtB;AACD;;AA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AAA;AAAA,IAAA,IAAA,GAAA,MAAA;AAAa;;AAC9D,MAAI,CAAC,YAAY,EAAb,IAAmB,CAAC,UAAU,CAAC,GAAD,CAAlC,EAAyC;AACvC,QAAI,CAAC,MAAM,EAAX,EAAe;AACb,MAAA,UAAU,CAAC,GAAD,CAAV,GAAkB,IAAlB;AACD;;AACD,QAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,MAAA,OAAO,CAAC,KAAR,CAAc,GAAd;AACD,KAFD,MAEO;AACL,MAAA,OAAO,CAAC,IAAR,CAAa,GAAb;AACD;AACF;AACF;;SCZe,Y,CAAgB,I,EAAO;AACrC,SAAO,IAAI,CAAC,KAAL,CAAW,IAAI,CAAC,SAAL,CAAe,IAAf,CAAX,CAAP;AACD,C","sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.min.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.min.js deleted file mode 100644 index a7ed4e22..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.addTypenameToDocument=function(e){return(0,n.visit)(y(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var i=e.selections;if(i){var o=i.some(function(e){return f(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))});if(!o){var a=t;if(!(f(a)&&a.directives&&a.directives.some(function(e){return"export"===e.name.value})))return(0,r.__assign)((0,r.__assign)({},e),{selections:(0,r.__spreadArrays)(i,[_])})}}}}}})},exports.argumentsObjectFromField=s,exports.assign=x,exports.buildQueryFromSelectionSet=function(e){if("query"===k(e).operation)return e;return(0,n.visit)(e,{OperationDefinition:{enter:function(e){return(0,r.__assign)((0,r.__assign)({},e),{operation:"query"})}}})},exports.checkDocument=y,exports.cloneDeep=function(e){return function e(n,t){switch(M.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach(function(n,i){r[i]=e(n,t)}),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach(function(r){i[r]=e(n[r],t)}),i;default:return n}}(e,new Map)},exports.createFragmentMap=O,exports.getDefaultValues=function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){var n=e.defaultValue;return n}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return a(r,n.name,t),r});return x.apply(void 0,(0,r.__spreadArrays)([{}],n))}return{}},exports.getDirectiveInfoFromField=function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=s(e,n)}),t}return null},exports.getDirectiveNames=m,exports.getDirectivesFromDocument=function(e,t){var i;return y(t),E((0,n.visit)(t,{SelectionSet:{enter:function(n,t,o,a){var u=a.join("-");if(!i||u===i||!u.startsWith(i)){if(n.selections){var c=n.selections.filter(function(n){return I(e,n)});return w(e,n,!1)&&(i=u),(0,r.__assign)((0,r.__assign)({},n),{selections:c})}return null}}}}))},exports.getEnv=J,exports.getFragmentDefinition=D,exports.getFragmentDefinitions=b,exports.getFragmentQueryDocument=function(e,n){var i=n,o=[];e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(11);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&((0,t.invariant)(1===o.length,12),i=o[0].name.value);return(0,r.__assign)((0,r.__assign)({},e),{definitions:(0,r.__spreadArrays)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],e.definitions)})},exports.getInclusionDirectives=g,exports.getMainDefinition=k,exports.getMutationDefinition=function(e){y(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return(0,t.invariant)(n,1),n},exports.getOperationDefinition=h,exports.getOperationDefinitionOrDie=function(e){var n=h(e);return(0,t.invariant)(n,5),n},exports.getOperationName=function(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null},exports.getQueryDefinition=function(e){var n=h(e);return(0,t.invariant)(n&&"query"===n.operation,6),n},exports.getStoreKeyName=c,exports.graphQLResultHasError=function(e){return e.errors&&e.errors.length},exports.hasClientExports=function(e){return e&&p(["client"],e)&&p(["export"],e)},exports.hasDirectives=p,exports.isDevelopment=Q,exports.isEnv=P,exports.isField=f,exports.isIdValue=function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},exports.isInlineFragment=l,exports.isJsonValue=function(e){return null!=e&&"object"==typeof e&&"json"===e.type},exports.isNumberValue=function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},exports.isProduction=L,exports.isScalarValue=function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},exports.isTest=T,exports.maybeDeepFreeze=function(e){if(Q()||T()){var n="function"==typeof Symbol&&"string"==typeof Symbol("");if(!n)return function e(n){Object.freeze(n);Object.getOwnPropertyNames(n).forEach(function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])});return n}(e)}return e},exports.mergeDeep=function(){for(var e=[],n=0;n0){var r=t.connection.filter?t.connection.filter:[];r.sort();var o=n,a={};return r.forEach(function(e){a[e]=o[e]}),t.connection.key+"("+JSON.stringify(a)+")"}return t.connection.key}var c=e;if(n){var s=(0,i.default)(n);c+="("+s+")"}return t&&Object.keys(t).forEach(function(e){-1===u.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?c+="@"+e+"("+JSON.stringify(t[e])+")":c+="@"+e)}),c}function s(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return a(t,r,i,n)}),t}return null}function f(e){return"Field"===e.kind}function l(e){return"InlineFragment"===e.kind}function v(e){throw new t.InvariantError(18)}function m(e){var t=[];return(0,n.visit)(e,{Directive:function(e){t.push(e.name.value)}}),t}function p(e,n){return m(n).some(function(n){return e.indexOf(n)>-1})}function d(e){var n=e.name.value;return"skip"===n||"include"===n}function g(e){return e?e.filter(d).map(function(e){var n=e.arguments;e.name.value;(0,t.invariant)(n&&1===n.length,14);var r=n[0];(0,t.invariant)(r.name&&"if"===r.name.value,15);var i=r.value;return(0,t.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),16),{directive:e,ifArgument:r}}):[]}function x(e){for(var n=[],t=1;t1){var r=[];n=K(n,r);for(var i=1;i -1; -} -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw process.env.NODE_ENV === "production" ? new InvariantError(17) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = stringify(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -function isField(selection) { - return selection.kind === 'Field'; -} -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return __assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new InvariantError(18) : new InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 13) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -function getDirectiveNames(doc) { - var names = []; - visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 14) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 15) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(11) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 12) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = __assign(__assign({}, document), { definitions: __spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} - -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? invariant(mutationDef, 1) : invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? invariant(doc && doc.kind === 'Document', 2) : invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(3) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 4) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? invariant(def, 5) : invariant(def, "GraphQL document is missing an operation"); - return def; -} -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 6) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 7) : invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? invariant(doc.definitions.length <= 1, 8) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 9) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw process.env.NODE_ENV === "production" ? new InvariantError(10) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, __spreadArrays([{}], defaultValues)); - } - return {}; -} -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -function addTypenameToDocument(doc) { - return visit(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return __assign(__assign({}, node), { selections: __spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - process.env.NODE_ENV === "production" || invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return __assign(__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visit(doc, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visit(document, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); - -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -function isEnv(env) { - return getEnv() === env; -} -function isProduction() { - return isEnv('production') === true; -} -function isDevelopment() { - return isEnv('development') === true; -} -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = __assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} - -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} - -export { addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getInclusionDirectives, getMainDefinition, getMutationDefinition, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getQueryDefinition, getStoreKeyName, graphQLResultHasError, hasClientExports, hasDirectives, isDevelopment, isEnv, isField, isIdValue, isInlineFragment, isJsonValue, isNumberValue, isProduction, isScalarValue, isTest, maybeDeepFreeze, mergeDeep, mergeDeepArray, removeArgumentsFromDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, removeDirectivesFromDocument, removeFragmentSpreadFromDocument, resultKeyNameFromField, shouldInclude, storeKeyNameFromField, stripSymbols, toIdValue, tryFunctionOrLogError, valueFromNode, valueToObjectRepresentation, variablesInOperation, warnOnceInDevelopment }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.esm.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.esm.js.map deleted file mode 100644 index 20578090..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"],"names":[],"mappings":";;;;;;SAiDgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9E;AAID,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5D;AAED,SAAS,aAAa,CAAC,KAAgB;IACrC,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;CACrC;AAED,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;CACtC;AAED,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;CAClC;AAED,SAAS,YAAY,CAAC,KAAgB;IACpC,OAAO,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;CACpC;AAED,SAAS,UAAU,CAAC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B;KACF;CACF;;SCZe,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;CACzC;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.umd.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.umd.js deleted file mode 100644 index 4c8a17bb..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.umd.js +++ /dev/null @@ -1,1131 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "graphql/language/visitor", "ts-invariant", "tslib", "fast-json-stable-stringify", "@wry/equality"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("graphql/language/visitor"), require("ts-invariant"), require("tslib"), require("fast-json-stable-stringify"), require("@wry/equality")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.visitor, global.tsInvariant, global.tslib, global.fastJsonStableStringify, global.equality); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _visitor, _tsInvariant, _tslib, _fastJsonStableStringify, _equality) { - - _exports.__esModule = true; - _exports.addTypenameToDocument = addTypenameToDocument; - _exports.argumentsObjectFromField = argumentsObjectFromField; - _exports.assign = assign; - _exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; - _exports.checkDocument = checkDocument; - _exports.cloneDeep = cloneDeep; - _exports.createFragmentMap = createFragmentMap; - _exports.getDefaultValues = getDefaultValues; - _exports.getDirectiveInfoFromField = getDirectiveInfoFromField; - _exports.getDirectiveNames = getDirectiveNames; - _exports.getDirectivesFromDocument = getDirectivesFromDocument; - _exports.getEnv = getEnv; - _exports.getFragmentDefinition = getFragmentDefinition; - _exports.getFragmentDefinitions = getFragmentDefinitions; - _exports.getFragmentQueryDocument = getFragmentQueryDocument; - _exports.getInclusionDirectives = getInclusionDirectives; - _exports.getMainDefinition = getMainDefinition; - _exports.getMutationDefinition = getMutationDefinition; - _exports.getOperationDefinition = getOperationDefinition; - _exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; - _exports.getOperationName = getOperationName; - _exports.getQueryDefinition = getQueryDefinition; - _exports.getStoreKeyName = getStoreKeyName; - _exports.graphQLResultHasError = graphQLResultHasError; - _exports.hasClientExports = hasClientExports; - _exports.hasDirectives = hasDirectives; - _exports.isDevelopment = isDevelopment; - _exports.isEnv = isEnv; - _exports.isField = isField; - _exports.isIdValue = isIdValue; - _exports.isInlineFragment = isInlineFragment; - _exports.isJsonValue = isJsonValue; - _exports.isNumberValue = isNumberValue; - _exports.isProduction = isProduction; - _exports.isScalarValue = isScalarValue; - _exports.isTest = isTest; - _exports.maybeDeepFreeze = maybeDeepFreeze; - _exports.mergeDeep = mergeDeep; - _exports.mergeDeepArray = mergeDeepArray; - _exports.removeArgumentsFromDocument = removeArgumentsFromDocument; - _exports.removeClientSetsFromDocument = removeClientSetsFromDocument; - _exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; - _exports.removeDirectivesFromDocument = removeDirectivesFromDocument; - _exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; - _exports.resultKeyNameFromField = resultKeyNameFromField; - _exports.shouldInclude = shouldInclude; - _exports.storeKeyNameFromField = storeKeyNameFromField; - _exports.stripSymbols = stripSymbols; - _exports.toIdValue = toIdValue; - _exports.tryFunctionOrLogError = tryFunctionOrLogError; - _exports.valueFromNode = valueFromNode; - _exports.valueToObjectRepresentation = valueToObjectRepresentation; - _exports.variablesInOperation = variablesInOperation; - _exports.warnOnceInDevelopment = warnOnceInDevelopment; - _exports.canUseWeakMap = _exports.isEqual = void 0; - _fastJsonStableStringify = _interopRequireDefault(_fastJsonStableStringify); - _exports.isEqual = _equality.equal; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; - } - - function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; - } - - function isStringValue(value) { - return value.kind === 'StringValue'; - } - - function isBooleanValue(value) { - return value.kind === 'BooleanValue'; - } - - function isIntValue(value) { - return value.kind === 'IntValue'; - } - - function isFloatValue(value) { - return value.kind === 'FloatValue'; - } - - function isVariable(value) { - return value.kind === 'Variable'; - } - - function isObjectValue(value) { - return value.kind === 'ObjectValue'; - } - - function isListValue(value) { - return value.kind === 'ListValue'; - } - - function isEnumValue(value) { - return value.kind === 'EnumValue'; - } - - function isNullValue(value) { - return value.kind === 'NullValue'; - } - - function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } - } - - function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); - } - - var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - - function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; - } - - function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; - } - - function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; - } - - function isField(selection) { - return selection.kind === 'Field'; - } - - function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; - } - - function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; - } - - function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); - } - - function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; - } - - function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); - } - - function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } - } - - function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; - } - - function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); - } - - function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; - } - - function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); - } - - function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); - } - - function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; - } - - function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; - } - - function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; - } - - function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; - } - - function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; - } - - function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; - } - - function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; - } - - function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; - } - - function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; - } - - function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); - } - - function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; - } - - function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; - } - - function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); - } - - function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; - } - - function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; - } - - function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; - } - - function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; - } - - var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } - }; - - function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); - } - - function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; - } - - function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; - } - - function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; - } - - function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); - } - - var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } - }; - - function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); - } - - function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); - } - - function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); - } - - function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); - } - - function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; - } - - function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); - } - - function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); - } - - function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; - } - - function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; - } - - function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; - } - - var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); - _exports.canUseWeakMap = canUseWeakMap; - var toString = Object.prototype.toString; - - function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); - } - - function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } - } - - function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; - } - - function isEnv(env) { - return getEnv() === env; - } - - function isProduction() { - return isEnv('production') === true; - } - - function isDevelopment() { - return isEnv('development') === true; - } - - function isTest() { - return isEnv('test') === true; - } - - function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } - } - - function graphQLResultHasError(result) { - return result.errors && result.errors.length; - } - - function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; - } - - function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); - } - - function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; - } - - function isObject(obj) { - return obj !== null && typeof obj === 'object'; - } - - function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; - } - - function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; - } - - var haveWarned = Object.create({}); - - function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } - } - - function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); - } - -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.umd.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.umd.js.map deleted file mode 100644 index e69270f6..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiDgB,a,CAAc,K,EAAgB;AAC5C,WAAO,CAAC,aAAD,EAAgB,cAAhB,EAAgC,WAAhC,EAA6C,OAA7C,CAAqD,KAAK,CAAC,IAA3D,IAAmE,CAAC,CAA3E;AACD;;AAID,WAAgB,aAAhB,CAA8B,KAA9B,EAA8C;AAC5C,WAAO,CAAC,UAAD,EAAa,YAAb,EAA2B,OAA3B,CAAmC,KAAK,CAAC,IAAzC,IAAiD,CAAC,CAAzD;AACD;;AAED,WAAS,aAAT,CAAuB,KAAvB,EAAuC;AACrC,WAAO,KAAK,CAAC,IAAN,KAAe,aAAtB;AACD;;AAED,WAAS,cAAT,CAAwB,KAAxB,EAAwC;AACtC,WAAO,KAAK,CAAC,IAAN,KAAe,cAAtB;AACD;;AAED,WAAS,UAAT,CAAoB,KAApB,EAAoC;AAClC,WAAO,KAAK,CAAC,IAAN,KAAe,UAAtB;AACD;;AAED,WAAS,YAAT,CAAsB,KAAtB,EAAsC;AACpC,WAAO,KAAK,CAAC,IAAN,KAAe,YAAtB;AACD;;AAED,WAAS,UAAT,CAAoB,KAApB,EAAoC;AAClC,WAAO,KAAK,CAAC,IAAN,KAAe,UAAtB;AACD;;AAED,WAAS,aAAT,CAAuB,KAAvB,EA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AAO,KAAP;AACD;;AChHD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAP,CAAc,EAAd,CAAnB;;AAUA,WAAgB,qBAAhB,CAAsC,GAAtC,EAAmD,IAAnD,EAAgE;AAAb,QAAA,IAAA,KAAA,KAAA,CAAA,EAAA;AAAA,MAAA,IAAA,GAAA,MAAA;AAAa;;AAC9D,QAAI,CAAC,YAAY,EAAb,IAAmB,CAAC,UAAU,CAAC,GAAD,CAAlC,EAAyC;AACvC,UAAI,CAAC,MAAM,EAAX,EAAe;AACb,QAAA,UAAU,CAAC,GAAD,CAAV,GAAkB,IAAlB;AACD;;AACD,UAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,QAAA,OAAO,CAAC,KAAR,CAAc,GAAd;AACD,OAFD,MAEO;AACL,QAAA,OAAO,CAAC,IAAR,CAAa,GAAb;AACD;AACF;AACF;;WCZe,Y,CAAgB,I,EAAO;AACrC,WAAO,IAAI,CAAC,KAAL,CAAW,IAAI,CAAC,SAAL,CAAe,IAAf,CAAX,CAAP;AACD,G","sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.d.ts deleted file mode 100644 index ea10f218..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { FieldNode, SelectionNode, DirectiveNode, DocumentNode, ArgumentNode } from 'graphql'; -export declare type DirectiveInfo = { - [fieldName: string]: { - [argName: string]: any; - }; -}; -export declare function getDirectiveInfoFromField(field: FieldNode, variables: Object): DirectiveInfo; -export declare function shouldInclude(selection: SelectionNode, variables?: { - [name: string]: any; -}): boolean; -export declare function getDirectiveNames(doc: DocumentNode): string[]; -export declare function hasDirectives(names: string[], doc: DocumentNode): boolean; -export declare function hasClientExports(document: DocumentNode): boolean; -export declare type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; -export declare function getInclusionDirectives(directives: ReadonlyArray): InclusionDirectives; -//# sourceMappingURL=directives.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.d.ts.map deleted file mode 100644 index 4da04b61..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["src/directives.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,aAAa,EAGb,aAAa,EACb,YAAY,EACZ,YAAY,EAEb,MAAM,SAAS,CAAC;AAQjB,oBAAY,aAAa,GAAG;IAC1B,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,GAChB,aAAa,CAYf;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,aAAa,EACxB,SAAS,GAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAO,GACtC,OAAO,CAgBT;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,YAUlD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,YAAY,WAI/D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,WAMtD;AAED,oBAAY,mBAAmB,GAAG,KAAK,CAAC;IACtC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B,CAAC,CAAC;AAMH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,GACvC,mBAAmB,CA2BrB"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.js deleted file mode 100644 index 41a8a9d4..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var visitor_1 = require("graphql/language/visitor"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = storeUtils_1.argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - ts_invariant_1.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -exports.shouldInclude = shouldInclude; -function getDirectiveNames(doc) { - var names = []; - visitor_1.visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -exports.getDirectiveNames = getDirectiveNames; -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -exports.hasDirectives = hasDirectives; -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -exports.hasClientExports = hasClientExports; -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - ts_invariant_1.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - ts_invariant_1.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - ts_invariant_1.invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} -exports.getInclusionDirectives = getInclusionDirectives; -//# sourceMappingURL=directives.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.js.map deleted file mode 100644 index 915e07f2..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/directives.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;AAaA,oDAAiD;AAEjD,6CAAyC;AAEzC,2CAAwD;AAMxD,SAAgB,yBAAyB,CACvC,KAAgB,EAChB,SAAiB;IAEjB,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE;QAC/C,IAAM,cAAY,GAAkB,EAAE,CAAC;QACvC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAwB;YAChD,cAAY,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,qCAAwB,CAC3D,SAAS,EACT,SAAS,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,cAAY,CAAC;KACrB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAfD,8DAeC;AAED,SAAgB,aAAa,CAC3B,SAAwB,EACxB,SAAuC;IAAvC,0BAAA,EAAA,cAAuC;IAEvC,OAAO,sBAAsB,CAC3B,SAAS,CAAC,UAAU,CACr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AQ,CAAC,EAAE,QAAQ,CAAC,CACpC,CAAC;AACJ,CAAC;AAND,4CAMC;AAOD,SAAS,oBAAoB,CAAC,EAAkC;QAAxB,qBAAK;IAC3C,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,SAAgB,sBAAsB,CACpC,UAAwC;IAExC,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,UAAA,SAAS;QACvE,IAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS,CAAC;QAC/C,IAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;QAE3C,wBAAS,CACP,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EACrD,4CAA0C,aAAa,gBAAa,CACrE,CAAC;QAEF,IAAM,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACzC,wBAAS,CACP,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,EACjD,+BAA6B,aAAa,gBAAa,CACxD,CAAC;QAEF,IAAM,OAAO,GAAc,UAAU,CAAC,KAAK,CAAC;QAG5C,wBAAS,CACP,OAAO;YACL,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,EAClE,uBAAqB,aAAa,sDAAmD,CACtF,CAAC;QAEF,OAAO,EAAE,SAAS,WAAA,EAAE,UAAU,YAAA,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACV,CAAC;AA7BD,wDA6BC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.d.ts deleted file mode 100644 index 8b1f2312..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode; -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.d.ts.map deleted file mode 100644 index cbff38a8..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["src/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,SAAS,CAAC;AAyB/D,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,YAAY,CA+Dd"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.js deleted file mode 100644 index 5b6e8f87..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - ts_invariant_1.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = tslib_1.__assign(tslib_1.__assign({}, document), { definitions: tslib_1.__spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} -exports.getFragmentQueryDocument = getFragmentQueryDocument; -//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.js.map deleted file mode 100644 index ece1e375..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/fragments.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../src/fragments.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAwBzD,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAKtC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,UAAU;QAGrC,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,IAAI,6BAAc,CACtB,aAAW,UAAU,CAAC,SAAS,mBAC7B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,aAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,QACxD;gBACF,yFAAyF,CAC5F,CAAC;SACH;QAGD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC5C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC5B;IACH,CAAC,CAAC,CAAC;IAIH,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;QAC7C,wBAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,WACE,SAAS,CAAC,MAAM,sFACmE,CACtF,CAAC;QACF,kBAAkB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9C;IAID,IAAM,KAAK,yCACN,QAAQ,KACX,WAAW;YACT;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,SAAS,EAAE,OAAO;gBAClB,YAAY,EAAE;oBACZ,IAAI,EAAE,cAAc;oBACpB,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,gBAAgB;4BACtB,IAAI,EAAE;gCACJ,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,kBAAkB;6BAC1B;yBACF;qBACF;iBACF;aACF;WACE,QAAQ,CAAC,WAAW,IAE1B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAlED,4DAkEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.d.ts deleted file mode 100644 index 57050319..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from 'graphql'; -import { JsonValue } from './storeUtils'; -export declare function getMutationDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function checkDocument(doc: DocumentNode): DocumentNode; -export declare function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined; -export declare function getOperationDefinitionOrDie(document: DocumentNode): OperationDefinitionNode; -export declare function getOperationName(doc: DocumentNode): string | null; -export declare function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[]; -export declare function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode; -export declare function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode; -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} -export declare function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap; -export declare function getDefaultValues(definition: OperationDefinitionNode | undefined): { - [key: string]: JsonValue; -}; -export declare function variablesInOperation(operation: OperationDefinitionNode): Set; -//# sourceMappingURL=getFromAST.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.d.ts.map deleted file mode 100644 index ef2f9946..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"getFromAST.d.ts","sourceRoot":"","sources":["src/getFromAST.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,uBAAuB,CAYzB;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,gBA0B9C;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,uBAAuB,GAAG,SAAS,CAKrC;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,YAAY,GACrB,uBAAuB,CAIzB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CASjE;AAGD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,sBAAsB,EAAE,CAI1B;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,uBAAuB,CAS7E;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,sBAAsB,CAoBxB;AAOD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,YAAY,GACrB,uBAAuB,GAAG,sBAAsB,CA8BlD;AAKD,MAAM,WAAW,WAAW;IAC1B,CAAC,YAAY,EAAE,MAAM,GAAG,sBAAsB,CAAC;CAChD;AAID,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,sBAAsB,EAAO,GACvC,WAAW,CAOb;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,uBAAuB,GAAG,SAAS,GAC9C;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAyB9B;AAKD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,uBAAuB,GACjC,GAAG,CAAC,MAAM,CAAC,CASb"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.js deleted file mode 100644 index 39f4e5aa..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -var assign_1 = require("./util/assign"); -var storeUtils_1 = require("./storeUtils"); -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - ts_invariant_1.invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -exports.getMutationDefinition = getMutationDefinition; -function checkDocument(doc) { - ts_invariant_1.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - ts_invariant_1.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -exports.checkDocument = checkDocument; -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -exports.getOperationDefinition = getOperationDefinition; -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - ts_invariant_1.invariant(def, "GraphQL document is missing an operation"); - return def; -} -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -exports.getOperationName = getOperationName; -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -exports.getFragmentDefinitions = getFragmentDefinitions; -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - ts_invariant_1.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -exports.getQueryDefinition = getQueryDefinition; -function getFragmentDefinition(doc) { - ts_invariant_1.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - ts_invariant_1.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - ts_invariant_1.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -exports.getFragmentDefinition = getFragmentDefinition; -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw new ts_invariant_1.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -exports.getMainDefinition = getMainDefinition; -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -exports.createFragmentMap = createFragmentMap; -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - storeUtils_1.valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign_1.assign.apply(void 0, tslib_1.__spreadArrays([{}], defaultValues)); - } - return {}; -} -exports.getDefaultValues = getDefaultValues; -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} -exports.variablesInOperation = variablesInOperation; -//# sourceMappingURL=getFromAST.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.js.map deleted file mode 100644 index 88d74a5f..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/getFromAST.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"getFromAST.js","sourceRoot":"","sources":["../src/getFromAST.ts"],"names":[],"mappings":";;;AAOA,6CAAyD;AAEzD,wCAAuC;AAEvC,2CAAsE;AAEtE,SAAgB,qBAAqB,CACnC,GAAiB;IAEjB,aAAa,CAAC,GAAG,CAAC,CAAC;IAEnB,IAAI,WAAW,GAAmC,GAAG,CAAC,WAAW,CAAC,MAAM,CACtE,UAAA,UAAU;QACR,OAAA,UAAU,CAAC,IAAI,KAAK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AAQ,EAAE,8BAAY;YACvB,IAAM,eAAe,GAAiC,EAAE,CAAC;YACzD,wCAA2B,CACzB,eAAe,EACf,QAAQ,CAAC,IAAI,EACb,YAAyB,CAC1B,CAAC;YAEF,OAAO,eAAe,CAAC;QACzB,CAAC,CACF,CAAC;QAEJ,OAAO,eAAM,uCAAC,EAAE,GAAK,aAAa,GAAE;KACrC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AA3BD,4CA2BC;AAKD,SAAgB,oBAAoB,CAClC,SAAkC;IAElC,IAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,IAAI,SAAS,CAAC,mBAAmB,EAAE;QACjC,KAAyB,UAA6B,EAA7B,KAAA,SAAS,CAAC,mBAAmB,EAA7B,cAA6B,EAA7B,IAA6B,EAAE;YAAnD,IAAM,UAAU,SAAA;YACnB,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC3C;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAXD,oDAWC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.d.ts deleted file mode 100644 index 6e84d9df..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.d.ts.map deleted file mode 100644 index 65614a63..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.js deleted file mode 100644 index 0693303c..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./directives"), exports); -tslib_1.__exportStar(require("./fragments"), exports); -tslib_1.__exportStar(require("./getFromAST"), exports); -tslib_1.__exportStar(require("./transform"), exports); -tslib_1.__exportStar(require("./storeUtils"), exports); -tslib_1.__exportStar(require("./util/assign"), exports); -tslib_1.__exportStar(require("./util/canUse"), exports); -tslib_1.__exportStar(require("./util/cloneDeep"), exports); -tslib_1.__exportStar(require("./util/environment"), exports); -tslib_1.__exportStar(require("./util/errorHandling"), exports); -tslib_1.__exportStar(require("./util/isEqual"), exports); -tslib_1.__exportStar(require("./util/maybeDeepFreeze"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -tslib_1.__exportStar(require("./util/warnOnce"), exports); -tslib_1.__exportStar(require("./util/stripSymbols"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.js.map deleted file mode 100644 index 3c41b701..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,wDAA8B;AAC9B,2DAAiC;AACjC,6DAAmC;AACnC,+DAAqC;AACrC,yDAA+B;AAC/B,iEAAuC;AACvC,2DAAiC;AACjC,0DAAgC;AAChC,8DAAoC;AACpC,2DAAiC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.d.ts deleted file mode 100644 index 4ac253c6..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { DirectiveNode, FieldNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, EnumValueNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode } from 'graphql'; -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} -export interface JsonValue { - type: 'json'; - json: any; -} -export declare type ListValue = Array; -export declare type StoreValue = number | string | string[] | IdValue | ListValue | JsonValue | null | undefined | void | Object; -export declare type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; -export declare function isScalarValue(value: ValueNode): value is ScalarValue; -export declare type NumberValue = IntValueNode | FloatValueNode; -export declare function isNumberValue(value: ValueNode): value is NumberValue; -export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void; -export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string; -export declare type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; -export declare function getStoreKeyName(fieldName: string, args?: Object, directives?: Directives): string; -export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables: Object): Object; -export declare function resultKeyNameFromField(field: FieldNode): string; -export declare function isField(selection: SelectionNode): selection is FieldNode; -export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode; -export declare function isIdValue(idObject: StoreValue): idObject is IdValue; -export declare type IdConfig = { - id: string; - typename: string | undefined; -}; -export declare function toIdValue(idConfig: string | IdConfig, generated?: boolean): IdValue; -export declare function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue; -export declare type VariableValue = (node: VariableNode) => any; -export declare function valueFromNode(node: ValueNode, onVariable?: VariableValue): any; -//# sourceMappingURL=storeUtils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.d.ts.map deleted file mode 100644 index 531a9645..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["src/storeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAGhB,aAAa,EAEb,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;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AE,SAAS,GAAG,MAAM,CAE/D;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,IAAI,SAAS,CAExE;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,aAAa,GACvB,SAAS,IAAI,kBAAkB,CAEjC;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,IAAI,OAAO,CAInE;AAED,oBAAY,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAC3B,SAAS,UAAQ,GAChB,OAAO,CAQT;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,SAAS,CAM3E;AAMD,oBAAY,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC;AAKxD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,EACf,UAAU,GAAE,aAAwC,GACnD,GAAG,CAsBL"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.js deleted file mode 100644 index bf04bfb1..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.js +++ /dev/null @@ -1,225 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var fast_json_stable_stringify_1 = tslib_1.__importDefault(require("fast-json-stable-stringify")); -var ts_invariant_1 = require("ts-invariant"); -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} -exports.isScalarValue = isScalarValue; -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -exports.isNumberValue = isNumberValue; -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw new ts_invariant_1.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -exports.valueToObjectRepresentation = valueToObjectRepresentation; -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -exports.storeKeyNameFromField = storeKeyNameFromField; -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = fast_json_stable_stringify_1.default(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -exports.getStoreKeyName = getStoreKeyName; -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -exports.argumentsObjectFromField = argumentsObjectFromField; -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -exports.resultKeyNameFromField = resultKeyNameFromField; -function isField(selection) { - return selection.kind === 'Field'; -} -exports.isField = isField; -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -exports.isInlineFragment = isInlineFragment; -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -exports.isIdValue = isIdValue; -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return tslib_1.__assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -exports.toIdValue = toIdValue; -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -exports.isJsonValue = isJsonValue; -function defaultValueFromVariable(node) { - throw new ts_invariant_1.InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} -exports.valueFromNode = valueFromNode; -//# sourceMappingURL=storeUtils.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.js.map deleted file mode 100644 index bb07be7f..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/storeUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.js","sourceRoot":"","sources":["../src/storeUtils.ts"],"names":[],"mappings":";;;AAkBA,kGAAmD;AACnD,6CAA8C;AA8B9C,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/E,CAAC;AAFD,sCAEC;AAID,SAAgB,aAAa,CAAC,KAAgB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B,CAAC,CAAC;QAC5D,KAAK,aAAa,CAAC,CAAC;YAClB,IAAM,KAAK,GAA2B,EAAE,CAAC;YACzC,KAAoB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;gBAA5B,IAAM,KAAK,SAAA;gBACd,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aAClE;YACD,OAAO,KAAK,CAAC;SACd;QACD;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;AACH,CAAC;AAzBD,sCAyBC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.d.ts deleted file mode 100644 index f359faf5..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { DocumentNode, DirectiveNode, FragmentDefinitionNode, ArgumentNode, FragmentSpreadNode, VariableDefinitionNode } from 'graphql'; -export declare type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; -export declare type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; -export declare type RemoveDirectiveConfig = RemoveNodeConfig; -export declare type GetDirectiveConfig = GetNodeConfig; -export declare type RemoveArgumentsConfig = RemoveNodeConfig; -export declare type GetFragmentSpreadConfig = GetNodeConfig; -export declare type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export declare type RemoveFragmentDefinitionConfig = RemoveNodeConfig; -export declare type RemoveVariableDefinitionConfig = RemoveNodeConfig; -export declare function removeDirectivesFromDocument(directives: RemoveDirectiveConfig[], doc: DocumentNode): DocumentNode | null; -export declare function addTypenameToDocument(doc: DocumentNode): DocumentNode; -export declare function removeConnectionDirectiveFromDocument(doc: DocumentNode): DocumentNode; -export declare function getDirectivesFromDocument(directives: GetDirectiveConfig[], doc: DocumentNode): DocumentNode; -export declare function removeArgumentsFromDocument(config: RemoveArgumentsConfig[], doc: DocumentNode): DocumentNode; -export declare function removeFragmentSpreadFromDocument(config: RemoveFragmentSpreadConfig[], doc: DocumentNode): DocumentNode; -export declare function buildQueryFromSelectionSet(document: DocumentNode): DocumentNode; -export declare function removeClientSetsFromDocument(document: DocumentNode): DocumentNode | null; -//# sourceMappingURL=transform.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.d.ts.map deleted file mode 100644 index 5d6140be..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAgBjB,oBAAY,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,oBAAY,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;CAC7B,CAAC;AAEF,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACpE,oBAAY,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;AAC9D,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACnE,oBAAY,uBAAuB,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACxE,oBAAY,0BAA0B,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAC9E,oBAAY,8BAA8B,GAAG,gBAAgB,CAC3D,sBAAsB,CACvB,CAAC;AACF,oBAAY,8BAA8B,GAAG,gBAAgB,CAC3D,sBAAsB,CACvB,CAAC;AA0CF,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,qBAAqB,EAAE,EACnC,GAAG,EAAE,YAAY,GAChB,YAAY,GAAG,IAAI,CAiHrB;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,CAkDrE;AAqBD,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,YAAY,gBAKtE;AAwCD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,kBAAkB,EAAE,EAChC,GAAG,EAAE,YAAY,GAChB,YAAY,CAqCd;AAeD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,qBAAqB,EAAE,EAC/B,GAAG,EAAE,YAAY,GAChB,YAAY,CAgDd;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,0BAA0B,EAAE,EACpC,GAAG,EAAE,YAAY,GAChB,YAAY,CAed;AA0BD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,YAAY,GACrB,YAAY,CAqBd;AAGD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,YAAY,GACrB,YAAY,GAAG,IAAI,CAoCrB"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.js deleted file mode 100644 index b85155c5..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.js +++ /dev/null @@ -1,311 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var visitor_1 = require("graphql/language/visitor"); -var getFromAST_1 = require("./getFromAST"); -var filterInPlace_1 = require("./util/filterInPlace"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getFromAST_1.getOperationDefinition(doc) || getFromAST_1.getFragmentDefinition(doc), getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visitor_1.visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace_1.filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace_1.filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -function addTypenameToDocument(doc) { - return visitor_1.visit(getFromAST_1.checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (storeUtils_1.isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (storeUtils_1.isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: tslib_1.__spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -exports.addTypenameToDocument = addTypenameToDocument; -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - ts_invariant_1.invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], getFromAST_1.checkDocument(doc)); -} -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!storeUtils_1.isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - getFromAST_1.checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visitor_1.visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -exports.getDirectivesFromDocument = getDirectivesFromDocument; -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visitor_1.visit(doc, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visitor_1.visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((storeUtils_1.isField(selection) || storeUtils_1.isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getFromAST_1.getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visitor_1.visit(document, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -function removeClientSetsFromDocument(document) { - getFromAST_1.checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visitor_1.visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return storeUtils_1.isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.js.map deleted file mode 100644 index 4ea09818..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/transform.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";;;AAaA,oDAAiD;AAEjD,2CAQsB;AACtB,sDAAqD;AACrD,6CAAyC;AACzC,2CAAyD;AAyBzD,IAAM,cAAc,GAAc;IAChC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,YAAY;KACpB;CACF,CAAC;AAEF,SAAS,OAAO,CACd,EAAoD,EACpD,SAAsB;IAEtB,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CACrC,UAAA,SAAS;QACP,OAAA,SAAS,CAAC,IAAI,KAAK,gBAAgB;YACnC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IADnD,CACmD,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAiB;IACzC,OAAO,OAAO,CACZ,mCAAsB,CAAC,GAAG,CAAC,IAAI,kCAAqB,CAAC,GAAG,CAAC,EACzD,8BAAiB,CAAC,mCAAsB,CAAC,GAAG,CAAC,CAAC,CAC/C;QACC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAED,SAAS,mBAAmB,CAC1B,UAA0D;IAE1D,OAAO,SAAS,gBAAgB,CAAC,SAAwB;QACvD,OAAO,UAAU,CAAC,IAAI,CACpB,UAAA,GAAG;YACD,OAAA,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;gBAC/C,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QADjC,CACiC,CACpC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,4BAA4B,CAC1C,UAAmC,EACnC,G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AAC,QAAQ,CAAC,CAAC;IAExB,IAAI,WAAW,GAAG,4BAA4B,CAC5C;QACE;YACE,IAAI,EAAE,UAAC,SAAwB,IAAK,OAAA,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAjC,CAAiC;YACrE,MAAM,EAAE,IAAI;SACb;KACF,EACD,QAAQ,CACT,CAAC;IAMF,IAAI,WAAW,EAAE;QACf,WAAW,GAAG,eAAK,CAAC,WAAW,EAAE;YAC/B,kBAAkB,EAAE;gBAClB,KAAK,YAAC,IAAI;oBACR,IAAI,IAAI,CAAC,YAAY,EAAE;wBACrB,IAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CACvD,UAAA,SAAS;4BACP,OAAA,oBAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY;wBAA3D,CAA2D,CAC9D,CAAC;wBACF,IAAI,cAAc,EAAE;4BAClB,OAAO,IAAI,CAAC;yBACb;qBACF;gBACH,CAAC;aACF;SACF,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAtCD,oEAsCC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.d.ts deleted file mode 100644 index 306bddf7..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function assign(a: A, b: B): A & B; -export declare function assign(a: A, b: B, c: C): A & B & C; -export declare function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export declare function assign(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E; -export declare function assign(target: any, ...sources: Array): any; -//# sourceMappingURL=assign.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.d.ts.map deleted file mode 100644 index 20e9dbff..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/util/assign.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChD,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1E,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAClC,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACrB,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.js deleted file mode 100644 index 78e39015..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} -exports.assign = assign; -//# sourceMappingURL=assign.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.js.map deleted file mode 100644 index 6a697cc9..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/assign.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.js","sourceRoot":"","sources":["../../src/util/assign.ts"],"names":[],"mappings":";;AAiBA,SAAgB,MAAM,CACpB,MAA8B;IAC9B,iBAAyC;SAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;QAAzC,gCAAyC;;IAEzC,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM;QACpB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,IAAI,EAAE;YACpD,OAAO;SACR;QACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.d.ts deleted file mode 100644 index 53d76ab7..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const canUseWeakMap: boolean; -//# sourceMappingURL=canUse.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.d.ts.map deleted file mode 100644 index 74a2206a..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.d.ts","sourceRoot":"","sources":["../src/util/canUse.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAGzB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.js deleted file mode 100644 index c8caab97..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); -//# sourceMappingURL=canUse.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.js.map deleted file mode 100644 index e0e5e566..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/canUse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../src/util/canUse.ts"],"names":[],"mappings":";;AAAa,QAAA,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,IAAI,CAAC,CAC7D,OAAO,SAAS,KAAK,QAAQ;IAC7B,SAAS,CAAC,OAAO,KAAK,aAAa,CACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts deleted file mode 100644 index 61525aad..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function cloneDeep(value: T): T; -//# sourceMappingURL=cloneDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map deleted file mode 100644 index a871948f..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cloneDeep.d.ts","sourceRoot":"","sources":["../src/util/cloneDeep.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAExC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.js deleted file mode 100644 index 8fbfb3fe..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -exports.cloneDeep = cloneDeep; -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} -//# sourceMappingURL=cloneDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.js.map deleted file mode 100644 index 36015d2d..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/cloneDeep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../src/util/cloneDeep.ts"],"names":[],"mappings":";;AAAQ,IAAA,oCAAQ,CAAsB;AAKtC,SAAgB,SAAS,CAAI,KAAQ;IACnC,OAAO,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAFD,8BAEC;AAED,SAAS,eAAe,CAAI,GAAM,EAAE,IAAmB;IACrD,QAAQ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC5B,KAAK,gBAAgB,CAAC,CAAC;YACrB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAM,MAAI,GAAe,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAI,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;gBAC7B,MAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED,KAAK,iBAAiB,CAAC,CAAC;YACtB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAGxC,IAAM,MAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;gBAC1B,MAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED;YACE,OAAO,GAAG,CAAC;KACZ;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.d.ts deleted file mode 100644 index 3dac4c1b..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function getEnv(): string | undefined; -export declare function isEnv(env: string): boolean; -export declare function isProduction(): boolean; -export declare function isDevelopment(): boolean; -export declare function isTest(): boolean; -//# sourceMappingURL=environment.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.d.ts.map deleted file mode 100644 index ac39af26..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/util/environment.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAO3C;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1C;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,wBAAgB,MAAM,IAAI,OAAO,CAEhC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.js deleted file mode 100644 index 13f120ef..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -exports.getEnv = getEnv; -function isEnv(env) { - return getEnv() === env; -} -exports.isEnv = isEnv; -function isProduction() { - return isEnv('production') === true; -} -exports.isProduction = isProduction; -function isDevelopment() { - return isEnv('development') === true; -} -exports.isDevelopment = isDevelopment; -function isTest() { - return isEnv('test') === true; -} -exports.isTest = isTest; -//# sourceMappingURL=environment.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.js.map deleted file mode 100644 index d7b9e1ae..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/environment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/util/environment.ts"],"names":[],"mappings":";;AAAA,SAAgB,MAAM;IACpB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;QAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC7B;IAGD,OAAO,aAAa,CAAC;AACvB,CAAC;AAPD,wBAOC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,MAAM,EAAE,KAAK,GAAG,CAAC;AAC1B,CAAC;AAFD,sBAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AACtC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAFD,sCAEC;AAED,SAAgB,MAAM;IACpB,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAChC,CAAC;AAFD,wBAEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.d.ts deleted file mode 100644 index d1d25c33..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ExecutionResult } from 'graphql'; -export declare function tryFunctionOrLogError(f: Function): any; -export declare function graphQLResultHasError(result: ExecutionResult): number; -//# sourceMappingURL=errorHandling.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map deleted file mode 100644 index 6955d016..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../src/util/errorHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,OAQhD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,UAE5D"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.js deleted file mode 100644 index a9955e19..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -exports.tryFunctionOrLogError = tryFunctionOrLogError; -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} -exports.graphQLResultHasError = graphQLResultHasError; -//# sourceMappingURL=errorHandling.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.js.map deleted file mode 100644 index 52b9fb6b..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/errorHandling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../src/util/errorHandling.ts"],"names":[],"mappings":";;AAEA,SAAgB,qBAAqB,CAAC,CAAW;IAC/C,IAAI;QACF,OAAO,CAAC,EAAE,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;KACF;AACH,CAAC;AARD,sDAQC;AAED,SAAgB,qBAAqB,CAAC,MAAuB;IAC3D,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC/C,CAAC;AAFD,sDAEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts deleted file mode 100644 index 429feb86..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function filterInPlace(array: T[], test: (elem: T) => boolean, context?: any): T[]; -//# sourceMappingURL=filterInPlace.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map deleted file mode 100644 index c45757b7..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.d.ts","sourceRoot":"","sources":["../src/util/filterInPlace.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAC1B,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,EAAE,CASL"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.js deleted file mode 100644 index 66b9dd6e..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} -exports.filterInPlace = filterInPlace; -//# sourceMappingURL=filterInPlace.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.js.map deleted file mode 100644 index d0e2a7dc..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/filterInPlace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.js","sourceRoot":"","sources":["../../src/util/filterInPlace.ts"],"names":[],"mappings":";;AAAA,SAAgB,aAAa,CAC3B,KAAU,EACV,IAA0B,EAC1B,OAAa;IAEb,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE;YACnC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;SACxB;IACH,CAAC,EAAE,OAAO,CAAC,CAAC;IACZ,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,sCAaC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.d.ts deleted file mode 100644 index fe095067..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; -//# sourceMappingURL=isEqual.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map deleted file mode 100644 index d2078c93..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../src/util/isEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.js deleted file mode 100644 index f7d228c8..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var equality_1 = require("@wry/equality"); -exports.isEqual = equality_1.equal; -//# sourceMappingURL=isEqual.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.js.map deleted file mode 100644 index c6fe9ba5..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/isEqual.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.js","sourceRoot":"","sources":["../../src/util/isEqual.ts"],"names":[],"mappings":";;AAAA,0CAAiD;AAAxC,6BAAA,KAAK,CAAW"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts deleted file mode 100644 index e5c569ee..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function maybeDeepFreeze(obj: any): any; -//# sourceMappingURL=maybeDeepFreeze.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map deleted file mode 100644 index 99cb3ef8..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.d.ts","sourceRoot":"","sources":["../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,OAYvC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js deleted file mode 100644 index 2f7b836d..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (environment_1.isDevelopment() || environment_1.isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} -exports.maybeDeepFreeze = maybeDeepFreeze; -//# sourceMappingURL=maybeDeepFreeze.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map deleted file mode 100644 index ea62a05d..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AAItD,SAAS,UAAU,CAAC,CAAM;IACxB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEjB,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;QACjD,IACE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI;YAChB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;YAC9D,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EACzB;YACA,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,eAAe,CAAC,GAAQ;IACtC,IAAI,2BAAa,EAAE,IAAI,oBAAM,EAAE,EAAE;QAG/B,IAAM,kBAAkB,GACtB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC;QAEjE,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;SACxB;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAZD,0CAYC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts deleted file mode 100644 index d3c18919..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare type TupleToIntersection = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any; -export declare function mergeDeep(...sources: T): TupleToIntersection; -export declare function mergeDeepArray(sources: T[]): T; -//# sourceMappingURL=mergeDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map deleted file mode 100644 index d95732fc..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.d.ts","sourceRoot":"","sources":["../src/util/mergeDeep.ts"],"names":[],"mappings":"AAgBA,oBAAY,mBAAmB,CAAC,CAAC,SAAS,GAAG,EAAE,IAC7C,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GACvB,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GACpC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACjD,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC9D,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC3E,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;AAElC,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EACvC,GAAG,OAAO,EAAE,CAAC,GACZ,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAQD,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAWjD"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.js deleted file mode 100644 index e4100a26..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -exports.mergeDeep = mergeDeep; -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -exports.mergeDeepArray = mergeDeepArray; -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = tslib_1.__assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} -//# sourceMappingURL=mergeDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.js.map deleted file mode 100644 index 20393f8f..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/mergeDeep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.js","sourceRoot":"","sources":["../../src/util/mergeDeep.ts"],"names":[],"mappings":";;;AAAQ,IAAA,gDAAc,CAAsB;AAwB5C,SAAgB,SAAS;IACvB,iBAAa;SAAb,UAAa,EAAb,qBAAa,EAAb,IAAa;QAAb,4BA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ACtC,IAAI,WAAW,KAAK,WAAW,EAAE;oBAQ/B,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAC7B,mBAAmB,CAAC,WAAW,EAAE,UAAU,CAAC,EAC5C,WAAW,EACX,UAAU,CACX,CAAC;iBACH;aACF;iBAAM;gBAGL,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;KACf;IAGD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAI,KAAQ,EAAE,UAAiB;IACzD,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAC7B;QACA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,GAAI,KAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjC;aAAM;YACL,KAAK,sBACH,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IACpC,KAAK,CACT,CAAC;SACH;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts deleted file mode 100644 index 48d2b7cb..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function stripSymbols(data: T): T; -//# sourceMappingURL=stripSymbols.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map deleted file mode 100644 index 9e0384d8..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.d.ts","sourceRoot":"","sources":["../src/util/stripSymbols.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAE1C"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.js deleted file mode 100644 index bc978e58..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} -exports.stripSymbols = stripSymbols; -//# sourceMappingURL=stripSymbols.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.js.map deleted file mode 100644 index 3bbcc9c5..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/stripSymbols.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.js","sourceRoot":"","sources":["../../src/util/stripSymbols.ts"],"names":[],"mappings":";;AAWA,SAAgB,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.d.ts deleted file mode 100644 index 0b7c1897..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function warnOnceInDevelopment(msg: string, type?: string): void; -//# sourceMappingURL=warnOnce.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map deleted file mode 100644 index 1b652a3c..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.d.ts","sourceRoot":"","sources":["../src/util/warnOnce.ts"],"names":[],"mappings":"AAYA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAS,QAW/D"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.js b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.js deleted file mode 100644 index 167ba8f0..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!environment_1.isProduction() && !haveWarned[msg]) { - if (!environment_1.isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} -exports.warnOnceInDevelopment = warnOnceInDevelopment; -//# sourceMappingURL=warnOnce.js.map \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.js.map b/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.js.map deleted file mode 100644 index 63d8e3d1..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/lib/util/warnOnce.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.js","sourceRoot":"","sources":["../../src/util/warnOnce.ts"],"names":[],"mappings":";;AAAA,6CAAqD;AAErD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAUrC,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAa;IAAb,qBAAA,EAAA,aAAa;IAC9D,IAAI,CAAC,0BAAY,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,CAAC,oBAAM,EAAE,EAAE;YACb,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;AACH,CAAC;AAXD,sDAWC"} \ No newline at end of file diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/package.json b/node_modules/apollo-cache/node_modules/apollo-utilities/package.json deleted file mode 100644 index de51224a..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "apollo-utilities@^1.3.4", - "_id": "apollo-utilities@1.3.4", - "_inBundle": false, - "_integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "_location": "/apollo-cache/apollo-utilities", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "apollo-utilities@^1.3.4", - "name": "apollo-utilities", - "escapedName": "apollo-utilities", - "rawSpec": "^1.3.4", - "saveSpec": null, - "fetchSpec": "^1.3.4" - }, - "_requiredBy": [ - "/apollo-cache" - ], - "_resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "_shasum": "6129e438e8be201b6c55b0f13ce49d2c7175c9cf", - "_spec": "apollo-utilities@^1.3.4", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-cache", - "author": { - "name": "James Baxley", - "email": "james@meteor.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "James Burgess", - "email": "jamesmillerburgess@gmail.com" - } - ], - "dependencies": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - }, - "deprecated": false, - "description": "Utilities for working with GraphQL ASTs", - "gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "license": "MIT", - "main": "./lib/bundle.cjs.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-utilities", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "scripts": { - "build": "tsc -b .", - "bundle": "npx rollup -c rollup.config.js", - "clean": "rm -rf coverage/* lib/*", - "coverage": "jest --coverage", - "lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts", - "postbuild": "npm run bundle", - "prebuild": "npm run clean", - "prepare": "npm run lint && npm run build", - "prepublishOnly": "npm run clean && npm run build", - "test": "tsc -p tsconfig.json --noEmit && jest", - "watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.3.4" -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/directives.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/directives.ts deleted file mode 100644 index eea3500a..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/directives.ts +++ /dev/null @@ -1,274 +0,0 @@ -import gql from 'graphql-tag'; -import { cloneDeep } from 'lodash'; - -import { shouldInclude, hasDirectives } from '../directives'; -import { getQueryDefinition } from '../getFromAST'; - -describe('hasDirective', () => { - it('should allow searching the ast for a directive', () => { - const query = gql` - query Simple { - field @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for all operation types', () => { - const query = gql` - { - field @live { - subField { - hello @live - } - } - } - `; - - const mutation = gql` - mutation Directive { - mutate { - field { - subField { - hello @live - } - } - } - } - `; - - const subscription = gql` - subscription LiveDirective { - sub { - field { - subField { - hello @live - } - } - } - } - `; - - [query, mutation, subscription].forEach(x => { - expect(hasDirectives(['live'], x)).toBe(true); - expect(hasDirectives(['defer'], x)).toBe(false); - }); - }); - it('works for simple fragments', () => { - const query = gql` - query Simple { - ...fieldFragment - } - - fragment fieldFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for nested fragments', () => { - const query = gql` - query Simple { - ...fieldFragment1 - } - - fragment fieldFragment1 on Field { - bar { - baz { - ...nestedFragment - } - } - } - - fragment nestedFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); -}); - -describe('shouldInclude', () => { - it('should should not include a skipped field', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include an included field', () => { - const query = gql` - query { - fortuneCookie @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a not include: false field', () => { - const query = gql` - query { - fortuneCookie @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a skip: false field', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a field if skip: false and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: false and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should leave the original query unmodified', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const queryClone = cloneDeep(query); - const field = getQueryDefinition(query).selectionSet.selections[0]; - shouldInclude(field, {}); - expect(query).toEqual(queryClone); - }); - - it('does not throw an error on an unsupported directive', () => { - const query = gql` - query { - fortuneCookie @dosomething(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).not.toThrow(); - }); - - it('throws an error on an invalid argument for the skip directive', () => { - const query = gql` - query { - fortuneCookie @skip(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid argument for the include directive', () => { - const query = gql` - query { - fortuneCookie @include(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid variable name within a directive argument', () => { - const query = gql` - query { - fortuneCookie @include(if: $neverDefined) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('evaluates variables on skip fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @skip(if: $shouldSkip) - } - `; - const variables = { - shouldSkip: true, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('evaluates variables on include fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @include(if: $shouldInclude) - } - `; - const variables = { - shouldInclude: false, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('throws an error if the value of the argument is not a variable or boolean', () => { - const query = gql` - query { - fortuneCookie @include(if: "string") - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/fragments.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/fragments.ts deleted file mode 100644 index 1c6cfa16..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/fragments.ts +++ /dev/null @@ -1,327 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { getFragmentQueryDocument } from '../fragments'; - -describe('getFragmentQueryDocument', () => { - it('will throw an error if there is an operation', () => { - expect(() => - getFragmentQueryDocument( - gql` - { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a query operation named 'Named'. No operations are allowed when using a fragment as a query. Only fragments are allowed.", - ); - expect(() => - getFragmentQueryDocument( - gql` - mutation Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a mutation operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - subscription Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a subscription operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - }); - - it('will throw an error if there is not exactly one fragment but no `fragmentName`', () => { - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - `); - }).toThrowError( - 'Found 2 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - - fragment baz on Baz { - g - h - i - } - `); - }).toThrowError( - 'Found 3 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - scalar Foo - `); - }).toThrowError( - 'Found 0 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - }); - - it('will create a query document where the single fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - `), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - `), - ); - }); - - it('will create a query document where the named fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'foo', - ), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'bar', - ), - ), - ).toEqual( - print(gql` - { - ...bar - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'baz', - ), - ), - ).toEqual( - print(gql` - { - ...baz - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/getFromAST.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/getFromAST.ts deleted file mode 100644 index a81a5f3c..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/getFromAST.ts +++ /dev/null @@ -1,316 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { FragmentDefinitionNode, OperationDefinitionNode } from 'graphql'; - -import { - checkDocument, - getFragmentDefinitions, - getQueryDefinition, - getMutationDefinition, - createFragmentMap, - FragmentMap, - getDefaultValues, - getOperationName, -} from '../getFromAST'; - -describe('AST utility functions', () => { - it('should correctly check a document for correctness', () => { - const multipleQueries = gql` - query { - author { - firstName - lastName - } - } - - query { - author { - address - } - } - `; - expect(() => { - checkDocument(multipleQueries); - }).toThrow(); - - const namedFragment = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - expect(() => { - checkDocument(namedFragment); - }).not.toThrow(); - }); - - it('should get fragment definitions from a document containing a single fragment', () => { - const singleFragmentDefinition = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(singleFragmentDefinition); - expect(actualResult.length).toEqual(expectedResult.length); - expect(print(actualResult[0])).toBe(print(expectedResult[0])); - }); - - it('should get fragment definitions from a document containing a multiple fragments', () => { - const multipleFragmentDefinitions = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - expectedDoc.definitions[1] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(multipleFragmentDefinitions); - expect(actualResult.map(print)).toEqual(expectedResult.map(print)); - }); - - it('should get the correct query definition out of a query containing multiple fragments', () => { - const queryWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedDoc = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getQueryDefinition(queryWithFragments); - - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should throw if we try to get the query definition of a document with no query', () => { - const mutationWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - expect(() => { - getQueryDefinition(mutationWithFragments); - }).toThrow(); - }); - - it('should get the correct mutation definition out of a mutation with multiple fragments', () => { - const mutationWithFragments = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getMutationDefinition(mutationWithFragments); - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should create the fragment map correctly', () => { - const fragments = getFragmentDefinitions(gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `); - const fragmentMap = createFragmentMap(fragments); - const expectedTable: FragmentMap = { - authorDetails: fragments[0], - moreAuthorDetails: fragments[1], - }; - expect(fragmentMap).toEqual(expectedTable); - }); - - it('should return an empty fragment map if passed undefined argument', () => { - expect(createFragmentMap(undefined)).toEqual({}); - }); - - it('should get the operation name out of a query', () => { - const query = gql` - query nameOfQuery { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfQuery'); - }); - - it('should get the operation name out of a mutation', () => { - const query = gql` - mutation nameOfMutation { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfMutation'); - }); - - it('should return null if the query does not have an operation name', () => { - const query = gql` - { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual(null); - }); - - it('should throw if type definitions found in document', () => { - const queryWithTypeDefination = gql` - fragment authorDetails on Author { - firstName - lastName - } - - query($search: AuthorSearchInputType) { - author(search: $search) { - ...authorDetails - } - } - - input AuthorSearchInputType { - firstName: String - } - `; - expect(() => { - getQueryDefinition(queryWithTypeDefination); - }).toThrowError( - 'Schema type definitions not allowed in queries. Found: "InputObjectTypeDefinition"', - ); - }); - - describe('getDefaultValues', () => { - it('will create an empty variable object if no default values are provided', () => { - const basicQuery = gql` - query people($first: Int, $second: String) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({}); - }); - - it('will create a variable object based on the definition node with default values', () => { - const basicQuery = gql` - query people($first: Int = 1, $second: String!) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - const complexMutation = gql` - mutation complexStuff( - $test: Input = { key1: ["value", "value2"], key2: { key3: 4 } } - ) { - complexStuff(test: $test) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({ - first: 1, - }); - expect(getDefaultValues(getMutationDefinition(complexMutation))).toEqual({ - test: { key1: ['value', 'value2'], key2: { key3: 4 } }, - }); - }); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/storeUtils.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/storeUtils.ts deleted file mode 100644 index ba459432..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/storeUtils.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { getStoreKeyName } from '../storeUtils'; - -describe('getStoreKeyName', () => { - it( - 'should return a deterministic version of the store key name no matter ' + - 'which order the args object properties are in', - () => { - const validStoreKeyName = - 'someField({"prop1":"value1","prop2":"value2"})'; - let generatedStoreKeyName = getStoreKeyName('someField', { - prop1: 'value1', - prop2: 'value2', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - - generatedStoreKeyName = getStoreKeyName('someField', { - prop2: 'value2', - prop1: 'value1', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - }, - ); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/transform.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/transform.ts deleted file mode 100644 index 26835f4c..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/__tests__/transform.ts +++ /dev/null @@ -1,1242 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { - addTypenameToDocument, - removeDirectivesFromDocument, - getDirectivesFromDocument, - removeConnectionDirectiveFromDocument, - removeArgumentsFromDocument, - removeFragmentSpreadFromDocument, - removeClientSetsFromDocument, -} from '../transform'; -import { getQueryDefinition } from '../getFromAST'; - -describe('removeArgumentsFromDocument', () => { - it('should remove a single variable', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - field { - child - foo - } - network - } - `; - const doc = removeArgumentsFromDocument([{ name: 'variable' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a single variable and the field from the query', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - network - } - `; - const doc = removeArgumentsFromDocument( - [{ name: 'variable', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeFragmentSpreadFromDocument', () => { - it('should remove a named fragment spread', () => { - const query = gql` - query Simple { - ...FragmentSpread - property - ...ValidSpread - } - - fragment FragmentSpread on Thing { - foo - bar - baz - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const expected = gql` - query Simple { - property - ...ValidSpread - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const doc = removeFragmentSpreadFromDocument( - [{ name: 'FragmentSpread', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeDirectivesFromDocument', () => { - it('should not remove unused variable definitions unless the field is removed', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) - networkField - } - `; - - const doc = removeDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove unused variable definitions associated with the removed directive', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove used variable definitions', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField(usingVariable: $variable) - } - `; - - const expected = gql` - query Simple($variable: String!) { - networkField(usingVariable: $variable) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove fragment spreads and definitions associated with the removed directive', () => { - const query = gql` - query Simple { - networkField - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove fragment spreads and definitions used without the removed directive', () => { - const query = gql` - query Simple { - networkField { - ...ClientFragment - } - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive [test function]', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives in the query', () => { - const query = gql` - query Simple { - field @storage(if: true) - other: field @storage - } - `; - - const expected = gql` - query Simple { - field - other: field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives of different kinds in the query', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other: field @client - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - other: field - } - `; - const removed = [ - { name: 'storage' }, - { - test: (directive: any) => directive.name.value === 'client', - }, - ]; - const doc = removeDirectivesFromDocument(removed, query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive and its field if needed', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should return null if the query is no longer valid [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(doc).toBe(null); - }); - - it('should return null only if the query is not valid', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(query)); - }); - - it('should return null only if the query is not valid through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should only remove values asked through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - bar - } - `; - - const expectedQuery = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - bar - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(expectedQuery)); - }); - - it('should return null even through fragments if needed', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should not throw in combination with addTypenameToDocument', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - expect(() => { - removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - addTypenameToDocument(query), - ); - }).not.toThrow(); - }); -}); - -describe('query transforms', () => { - it('should correctly add typenames', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not add duplicates', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not screw up on a FragmentSpread within the query AST', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should modify all definitions in a document', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - - fragment friendFields on User { - firstName - lastName - } - `; - - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - - fragment friendFields on User { - firstName - lastName - __typename - } - `; - - expect(print(expectedQuery)).toBe(print(newQueryDoc)); - }); - - it('should be able to apply a QueryTransformer correctly', () => { - const testQuery = gql` - query { - author { - firstName - lastName - } - } - `; - - const expectedQuery = getQueryDefinition(gql` - query { - author { - firstName - lastName - __typename - } - } - `); - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should be able to apply a MutationTransformer correctly', () => { - const testQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - } - } - `; - const expectedQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - __typename - } - } - `; - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(modifiedQuery)); - }); - - it('should add typename fields correctly on this one query', () => { - const testQuery = gql` - query Feed($type: FeedType!) { - # Eventually move this into a no fetch query right on the entry - # since we literally just need this info to determine whether to - # show upvote/downvote buttons - currentUser { - login - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - } - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query Feed($type: FeedType!) { - currentUser { - login - __typename - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - __typename - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - __typename - } - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should correctly remove connections', () => { - let testQuery = gql` - query { - author { - name @connection(key: "foo") { - firstName - lastName - } - } - } - `; - const newQueryDoc = removeConnectionDirectiveFromDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(expectedQueryStr).toBe(print(newQueryDoc)); - }); -}); - -describe('getDirectivesFromDocument', () => { - it('should get query with fields of storage directive ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of storage directive [test function] ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = getDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with multiple fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other @storage - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - other @storage - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of both storage and client directives ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [{ name: 'storage' }, { name: 'client' }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with different types of directive matchers ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [ - { name: 'storage' }, - { test: directive => directive.name.value === 'client' }, - ], - query, - ); - - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with nested fields ', () => { - const query = gql` - query Simple { - user { - firstName @client - email - } - } - `; - - const expected = gql` - query Simple { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should include all the nested fields of field that has client directive ', () => { - const query = gql` - query Simple { - user @client { - firstName - email - } - } - `; - - const expected = gql` - query Simple { - user @client { - firstName - email - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(null); - }); - - it('should get query with client fields in fragment', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in fragment with nested fields', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - lastName - } - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in multiple fragments', function() { - const query = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - product - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it("should return null if fragment didn't have client fields", function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(null)); - }); - - it('should get query with client fields when both fields and fragements are mixed', function() { - const query = gql` - query Simple { - user @client - product @storage - order - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - user @client - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation with client fields', () => { - const query = gql` - mutation { - login @client - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation fields of client only', () => { - const query = gql` - mutation { - login @client - updateUser - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - describe('includeAllFragments', () => { - it('= false: should remove the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, false); - expect(print(doc)).toBe(print(expected)); - }); - - it('= true: should include the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, true); - expect(print(doc)).toBe(print(expected)); - }); - }); -}); - -describe('removeClientSetsFromDocument', () => { - it('should remove @client fields from document', () => { - const query = gql` - query Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - query Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove @client fields from fragments', () => { - const query = gql` - fragment authorInfo on Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - fragment authorInfo on Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/declarations.d.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/declarations.d.ts deleted file mode 100644 index 69546655..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/declarations.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'fast-json-stable-stringify'; diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/directives.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/directives.ts deleted file mode 100644 index 84c14aba..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/directives.ts +++ /dev/null @@ -1,127 +0,0 @@ -// Provides the methods that allow QueryManager to handle the `skip` and -// `include` directives within GraphQL. -import { - FieldNode, - SelectionNode, - VariableNode, - BooleanValueNode, - DirectiveNode, - DocumentNode, - ArgumentNode, - ValueNode, -} from 'graphql'; - -import { visit } from 'graphql/language/visitor'; - -import { invariant } from 'ts-invariant'; - -import { argumentsObjectFromField } from './storeUtils'; - -export type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }; -}; - -export function getDirectiveInfoFromField( - field: FieldNode, - variables: Object, -): DirectiveInfo { - if (field.directives && field.directives.length) { - const directiveObj: DirectiveInfo = {}; - field.directives.forEach((directive: DirectiveNode) => { - directiveObj[directive.name.value] = argumentsObjectFromField( - directive, - variables, - ); - }); - return directiveObj; - } - return null; -} - -export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any } = {}, -): boolean { - return getInclusionDirectives( - selection.directives, - ).every(({ directive, ifArgument }) => { - let evaledValue: boolean = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[(ifArgument.value as VariableNode).name.value]; - invariant( - evaledValue !== void 0, - `Invalid variable referenced in @${directive.name.value} directive.`, - ); - } else { - evaledValue = (ifArgument.value as BooleanValueNode).value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -export function getDirectiveNames(doc: DocumentNode) { - const names: string[] = []; - - visit(doc, { - Directive(node) { - names.push(node.name.value); - }, - }); - - return names; -} - -export function hasDirectives(names: string[], doc: DocumentNode) { - return getDirectiveNames(doc).some( - (name: string) => names.indexOf(name) > -1, - ); -} - -export function hasClientExports(document: DocumentNode) { - return ( - document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document) - ); -} - -export type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; - -function isInclusionDirective({ name: { value } }: DirectiveNode): boolean { - return value === 'skip' || value === 'include'; -} - -export function getInclusionDirectives( - directives: ReadonlyArray, -): InclusionDirectives { - return directives ? directives.filter(isInclusionDirective).map(directive => { - const directiveArguments = directive.arguments; - const directiveName = directive.name.value; - - invariant( - directiveArguments && directiveArguments.length === 1, - `Incorrect number of arguments for the @${directiveName} directive.`, - ); - - const ifArgument = directiveArguments[0]; - invariant( - ifArgument.name && ifArgument.name.value === 'if', - `Invalid argument for the @${directiveName} directive.`, - ); - - const ifValue: ValueNode = ifArgument.value; - - // means it has to be a variable value if this is a valid @skip or @include directive - invariant( - ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), - `Argument for the @${directiveName} directive must be a variable or a boolean value.`, - ); - - return { directive, ifArgument }; - }) : []; -} - diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/fragments.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/fragments.ts deleted file mode 100644 index f60c86a6..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/fragments.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { DocumentNode, FragmentDefinitionNode } from 'graphql'; -import { invariant, InvariantError } from 'ts-invariant'; - -/** - * Returns a query document which adds a single query operation that only - * spreads the target fragment inside of it. - * - * So for example a document of: - * - * ```graphql - * fragment foo on Foo { a b c } - * ``` - * - * Turns into: - * - * ```graphql - * { ...foo } - * - * fragment foo on Foo { a b c } - * ``` - * - * The target fragment will either be the only fragment in the document, or a - * fragment specified by the provided `fragmentName`. If there is more than one - * fragment, but a `fragmentName` was not defined then an error will be thrown. - */ -export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, -): DocumentNode { - let actualFragmentName = fragmentName; - - // Build an array of all our fragment definitions that will be used for - // validations. We also do some validations on the other definitions in the - // document while building this list. - const fragments: Array = []; - document.definitions.forEach(definition => { - // Throw an error if we encounter an operation definition because we will - // define our own operation definition later on. - if (definition.kind === 'OperationDefinition') { - throw new InvariantError( - `Found a ${definition.operation} operation${ - definition.name ? ` named '${definition.name.value}'` : '' - }. ` + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - } - // Add our definition to the fragments array if it is a fragment - // definition. - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - // If the user did not give us a fragment name then let us try to get a - // name from a single fragment in the definition. - if (typeof actualFragmentName === 'undefined') { - invariant( - fragments.length === 1, - `Found ${ - fragments.length - } fragments. \`fragmentName\` must be provided when there is not exactly 1 fragment.`, - ); - actualFragmentName = fragments[0].name.value; - } - - // Generate a query document with an operation that simply spreads the - // fragment inside of it. - const query: DocumentNode = { - ...document, - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - }, - ...document.definitions, - ], - }; - - return query; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/getFromAST.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/getFromAST.ts deleted file mode 100644 index febe5260..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/getFromAST.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { - DocumentNode, - OperationDefinitionNode, - FragmentDefinitionNode, - ValueNode, -} from 'graphql'; - -import { invariant, InvariantError } from 'ts-invariant'; - -import { assign } from './util/assign'; - -import { valueToObjectRepresentation, JsonValue } from './storeUtils'; - -export function getMutationDefinition( - doc: DocumentNode, -): OperationDefinitionNode { - checkDocument(doc); - - let mutationDef: OperationDefinitionNode | null = doc.definitions.filter( - definition => - definition.kind === 'OperationDefinition' && - definition.operation === 'mutation', - )[0] as OperationDefinitionNode; - - invariant(mutationDef, 'Must contain a mutation definition.'); - - return mutationDef; -} - -// Checks the document for errors and throws an exception if there is an error. -export function checkDocument(doc: DocumentNode) { - invariant( - doc && doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - const operations = doc.definitions - .filter(d => d.kind !== 'FragmentDefinition') - .map(definition => { - if (definition.kind !== 'OperationDefinition') { - throw new InvariantError( - `Schema type definitions not allowed in queries. Found: "${ - definition.kind - }"`, - ); - } - return definition; - }); - - invariant( - operations.length <= 1, - `Ambiguous GraphQL document: contains ${operations.length} operations`, - ); - - return doc; -} - -export function getOperationDefinition( - doc: DocumentNode, -): OperationDefinitionNode | undefined { - checkDocument(doc); - return doc.definitions.filter( - definition => definition.kind === 'OperationDefinition', - )[0] as OperationDefinitionNode; -} - -export function getOperationDefinitionOrDie( - document: DocumentNode, -): OperationDefinitionNode { - const def = getOperationDefinition(document); - invariant(def, `GraphQL document is missing an operation`); - return def; -} - -export function getOperationName(doc: DocumentNode): string | null { - return ( - doc.definitions - .filter( - definition => - definition.kind === 'OperationDefinition' && definition.name, - ) - .map((x: OperationDefinitionNode) => x.name.value)[0] || null - ); -} - -// Returns the FragmentDefinitions from a particular document as an array -export function getFragmentDefinitions( - doc: DocumentNode, -): FragmentDefinitionNode[] { - return doc.definitions.filter( - definition => definition.kind === 'FragmentDefinition', - ) as FragmentDefinitionNode[]; -} - -export function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode { - const queryDef = getOperationDefinition(doc) as OperationDefinitionNode; - - invariant( - queryDef && queryDef.operation === 'query', - 'Must contain a query definition.', - ); - - return queryDef; -} - -export function getFragmentDefinition( - doc: DocumentNode, -): FragmentDefinitionNode { - invariant( - doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - invariant( - doc.definitions.length <= 1, - 'Fragment must have exactly one definition.', - ); - - const fragmentDef = doc.definitions[0] as FragmentDefinitionNode; - - invariant( - fragmentDef.kind === 'FragmentDefinition', - 'Must be a fragment definition.', - ); - - return fragmentDef as FragmentDefinitionNode; -} - -/** - * Returns the first operation definition found in this document. - * If no operation definition is found, the first fragment definition will be returned. - * If no definitions are found, an error will be thrown. - */ -export function getMainDefinition( - queryDoc: DocumentNode, -): OperationDefinitionNode | FragmentDefinitionNode { - checkDocument(queryDoc); - - let fragmentDefinition; - - for (let definition of queryDoc.definitions) { - if (definition.kind === 'OperationDefinition') { - const operation = (definition as OperationDefinitionNode).operation; - if ( - operation === 'query' || - operation === 'mutation' || - operation === 'subscription' - ) { - return definition as OperationDefinitionNode; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - // we do this because we want to allow multiple fragment definitions - // to precede an operation definition. - fragmentDefinition = definition as FragmentDefinitionNode; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw new InvariantError( - 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.', - ); -} - -/** - * This is an interface that describes a map from fragment names to fragment definitions. - */ -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} - -// Utility function that takes a list of fragment definitions and makes a hash out of them -// that maps the name of the fragment to the fragment definition. -export function createFragmentMap( - fragments: FragmentDefinitionNode[] = [], -): FragmentMap { - const symTable: FragmentMap = {}; - fragments.forEach(fragment => { - symTable[fragment.name.value] = fragment; - }); - - return symTable; -} - -export function getDefaultValues( - definition: OperationDefinitionNode | undefined, -): { [key: string]: JsonValue } { - if ( - definition && - definition.variableDefinitions && - definition.variableDefinitions.length - ) { - const defaultValues = definition.variableDefinitions - .filter(({ defaultValue }) => defaultValue) - .map( - ({ variable, defaultValue }): { [key: string]: JsonValue } => { - const defaultValueObj: { [key: string]: JsonValue } = {}; - valueToObjectRepresentation( - defaultValueObj, - variable.name, - defaultValue as ValueNode, - ); - - return defaultValueObj; - }, - ); - - return assign({}, ...defaultValues); - } - - return {}; -} - -/** - * Returns the names of all variables declared by the operation. - */ -export function variablesInOperation( - operation: OperationDefinitionNode, -): Set { - const names = new Set(); - if (operation.variableDefinitions) { - for (const definition of operation.variableDefinitions) { - names.add(definition.variable.name.value); - } - } - - return names; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/index.js.flow b/node_modules/apollo-cache/node_modules/apollo-utilities/src/index.js.flow deleted file mode 100644 index a7fc594d..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/index.js.flow +++ /dev/null @@ -1,220 +0,0 @@ -// @flow -import type { - DirectiveNode, - StringValueNode, - BooleanValueNode, - IntValueNode, - FloatValueNode, - EnumValueNode, - VariableNode, - FieldNode, - FragmentDefinitionNode, - OperationDefinitionNode, - SelectionNode, - DocumentNode, - DefinitionNode, - ValueNode, - NameNode, -} from 'graphql'; - -declare module 'apollo-utilities' { - // storeUtils - declare export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | void; - } - - declare export interface JsonValue { - type: 'json'; - json: any; - } - - declare export type ListValue = Array; - - declare export type StoreValue = - | number - | string - | Array - | IdValue - | ListValue - | JsonValue - | null - | void - | Object; - - declare export type ScalarValue = - | StringValueNode - | BooleanValueNode - | EnumValueNode; - - declare export type NumberValue = IntValueNode | FloatValueNode; - - declare type isValueFn = (value: ValueNode) => boolean; - - declare export type isScalarValue = isValueFn; - declare export type isNumberValue = isValueFn; - declare export type isStringValue = isValueFn; - declare export type isBooleanValue = isValueFn; - declare export type isIntValue = isValueFn; - declare export type isFloatValue = isValueFn; - declare export type isVariable = isValueFn; - declare export type isObjectValue = isValueFn; - declare export type isListValue = isValueFn; - declare export type isEnumValue = isValueFn; - - declare export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, - ): any; - - declare export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, - ): string; - - declare export type Directives = { - [directiveName: string]: { - [argName: string]: any, - }, - }; - - declare export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, - ): string; - - declare export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, - ): ?Object; - - declare export function resultKeyNameFromField(field: FieldNode): string; - - declare export function isField(selection: SelectionNode): boolean; - - declare export function isInlineFragment(selection: SelectionNode): boolean; - - declare export function isIdValue(idObject: StoreValue): boolean; - - declare export type IdConfig = { - id: string, - typename: string | void, - }; - - declare export function toIdValue( - id: string | IdConfig, - generated?: boolean, - ): IdValue; - - declare export function isJsonValue(jsonObject: StoreValue): boolean; - - declare export type VariableValue = (node: VariableNode) => any; - - declare export function valueFromNode( - node: ValueNode, - onVariable: VariableValue, - ): any; - - // getFromAST - declare export function getMutationDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function checkDocument(doc: DocumentNode): void; - - declare export function getOperationDefinition( - doc: DocumentNode, - ): ?OperationDefinitionNode; - - declare export function getOperationDefinitionOrDie( - document: DocumentNode, - ): OperationDefinitionNode; - - declare export function getOperationName(doc: DocumentNode): ?string; - - declare export function getFragmentDefinitions( - doc: DocumentNode, - ): Array; - - declare export function getQueryDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function getFragmentDefinition( - doc: DocumentNode, - ): FragmentDefinitionNode; - - declare export function getMainDefinition( - queryDoc: DocumentNode, - ): OperationDefinitionNode | FragmentDefinitionNode; - - declare export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; - } - - declare export function createFragmentMap( - fragments: Array, - ): FragmentMap; - - declare export function getDefaultValues( - definition: ?OperationDefinitionNode, - ): { [key: string]: JsonValue }; - - // fragments - declare export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, - ): DocumentNode; - - declare export function variablesInOperation( - operation: OperationDefinitionNode, - ): Set; - - // directives - declare type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }, - }; - - declare export function getDirectiveInfoFromField( - field: FieldNode, - object: Object, - ): ?DirectiveInfo; - - declare export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any }, - ): boolean; - - declare export function flattenSelections( - selection: SelectionNode, - ): Array; - - declare export function getDirectiveNames(doc: DocumentNode): Array; - - declare export function hasDirectives( - names: Array, - doc: DocumentNode, - ): boolean; - - // transform - declare export type RemoveDirectiveConfig = { - name?: string, - test?: (directive: DirectiveNode) => boolean, - }; - - declare export function removeDirectivesFromDocument( - directives: Array, - doc: DocumentNode, - ): DocumentNode; - - declare export function addTypenameToDocument(doc: DocumentNode): void; - - declare export function removeConnectionDirectiveFromDocument( - doc: DocumentNode, - ): DocumentNode; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/index.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/index.ts deleted file mode 100644 index 18b0a815..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/storeUtils.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/storeUtils.ts deleted file mode 100644 index 2bd1e53a..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/storeUtils.ts +++ /dev/null @@ -1,340 +0,0 @@ -import { - DirectiveNode, - FieldNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - ObjectValueNode, - ListValueNode, - EnumValueNode, - NullValueNode, - VariableNode, - InlineFragmentNode, - ValueNode, - SelectionNode, - NameNode, -} from 'graphql'; - -import stringify from 'fast-json-stable-stringify'; -import { InvariantError } from 'ts-invariant'; - -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} - -export interface JsonValue { - type: 'json'; - json: any; -} - -export type ListValue = Array; - -export type StoreValue = - | number - | string - | string[] - | IdValue - | ListValue - | JsonValue - | null - | undefined - | void - | Object; - -export type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; - -export function isScalarValue(value: ValueNode): value is ScalarValue { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -export type NumberValue = IntValueNode | FloatValueNode; - -export function isNumberValue(value: ValueNode): value is NumberValue { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value: ValueNode): value is StringValueNode { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value: ValueNode): value is BooleanValueNode { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value: ValueNode): value is IntValueNode { - return value.kind === 'IntValue'; -} - -function isFloatValue(value: ValueNode): value is FloatValueNode { - return value.kind === 'FloatValue'; -} - -function isVariable(value: ValueNode): value is VariableNode { - return value.kind === 'Variable'; -} - -function isObjectValue(value: ValueNode): value is ObjectValueNode { - return value.kind === 'ObjectValue'; -} - -function isListValue(value: ValueNode): value is ListValueNode { - return value.kind === 'ListValue'; -} - -function isEnumValue(value: ValueNode): value is EnumValueNode { - return value.kind === 'EnumValue'; -} - -function isNullValue(value: ValueNode): value is NullValueNode { - return value.kind === 'NullValue'; -} - -export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, -) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - const nestedArgObj = {}; - value.fields.map(obj => - valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables), - ); - argObj[name.value] = nestedArgObj; - } else if (isVariable(value)) { - const variableValue = (variables || ({} as any))[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(listValue => { - const nestedArgArrayObj = {}; - valueToObjectRepresentation( - nestedArgArrayObj, - name, - listValue, - variables, - ); - return (nestedArgArrayObj as any)[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = (value as EnumValueNode).value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw new InvariantError( - `The inline argument "${name.value}" of kind "${(value as any).kind}"` + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.', - ); - } -} - -export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, -): string { - let directivesObj: any = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(directive => { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(({ name, value }) => - valueToObjectRepresentation( - directivesObj[directive.name.value], - name, - value, - variables, - ), - ); - } - }); - } - - let argObj: any = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -export type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; - -const KNOWN_DIRECTIVES: string[] = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; - -export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, -): string { - if ( - directives && - directives['connection'] && - directives['connection']['key'] - ) { - if ( - directives['connection']['filter'] && - (directives['connection']['filter'] as string[]).length > 0 - ) { - const filterKeys = directives['connection']['filter'] - ? (directives['connection']['filter'] as string[]) - : []; - filterKeys.sort(); - - const queryArgs = args as { [key: string]: any }; - const filteredArgs = {} as { [key: string]: any }; - filterKeys.forEach(key => { - filteredArgs[key] = queryArgs[key]; - }); - - return `${directives['connection']['key']}(${JSON.stringify( - filteredArgs, - )})`; - } else { - return directives['connection']['key']; - } - } - - let completeFieldName: string = fieldName; - - if (args) { - // We can't use `JSON.stringify` here since it's non-deterministic, - // and can lead to different store key names being created even though - // the `args` object used during creation has the same properties/values. - const stringifiedArgs: string = stringify(args); - completeFieldName += `(${stringifiedArgs})`; - } - - if (directives) { - Object.keys(directives).forEach(key => { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += `@${key}(${JSON.stringify(directives[key])})`; - } else { - completeFieldName += `@${key}`; - } - }); - } - - return completeFieldName; -} - -export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, -): Object { - if (field.arguments && field.arguments.length) { - const argObj: Object = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - return argObj; - } - - return null; -} - -export function resultKeyNameFromField(field: FieldNode): string { - return field.alias ? field.alias.value : field.name.value; -} - -export function isField(selection: SelectionNode): selection is FieldNode { - return selection.kind === 'Field'; -} - -export function isInlineFragment( - selection: SelectionNode, -): selection is InlineFragmentNode { - return selection.kind === 'InlineFragment'; -} - -export function isIdValue(idObject: StoreValue): idObject is IdValue { - return idObject && - (idObject as IdValue | JsonValue).type === 'id' && - typeof (idObject as IdValue).generated === 'boolean'; -} - -export type IdConfig = { - id: string; - typename: string | undefined; -}; - -export function toIdValue( - idConfig: string | IdConfig, - generated = false, -): IdValue { - return { - type: 'id', - generated, - ...(typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig), - }; -} - -export function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue { - return ( - jsonObject != null && - typeof jsonObject === 'object' && - (jsonObject as IdValue | JsonValue).type === 'json' - ); -} - -function defaultValueFromVariable(node: VariableNode) { - throw new InvariantError(`Variable nodes are not supported by valueFromNode`); -} - -export type VariableValue = (node: VariableNode) => any; - -/** - * Evaluate a ValueNode and yield its value in its natural JS form. - */ -export function valueFromNode( - node: ValueNode, - onVariable: VariableValue = defaultValueFromVariable, -): any { - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(v => valueFromNode(v, onVariable)); - case 'ObjectValue': { - const value: { [key: string]: any } = {}; - for (const field of node.fields) { - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/transform.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/transform.ts deleted file mode 100644 index d77b8e54..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/transform.ts +++ /dev/null @@ -1,542 +0,0 @@ -import { - DocumentNode, - SelectionNode, - SelectionSetNode, - OperationDefinitionNode, - FieldNode, - DirectiveNode, - FragmentDefinitionNode, - ArgumentNode, - FragmentSpreadNode, - VariableDefinitionNode, - VariableNode, -} from 'graphql'; -import { visit } from 'graphql/language/visitor'; - -import { - checkDocument, - getOperationDefinition, - getFragmentDefinition, - getFragmentDefinitions, - createFragmentMap, - FragmentMap, - getMainDefinition, -} from './getFromAST'; -import { filterInPlace } from './util/filterInPlace'; -import { invariant } from 'ts-invariant'; -import { isField, isInlineFragment } from './storeUtils'; - -export type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; - -export type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; - -export type RemoveDirectiveConfig = RemoveNodeConfig; -export type GetDirectiveConfig = GetNodeConfig; -export type RemoveArgumentsConfig = RemoveNodeConfig; -export type GetFragmentSpreadConfig = GetNodeConfig; -export type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export type RemoveFragmentDefinitionConfig = RemoveNodeConfig< - FragmentDefinitionNode ->; -export type RemoveVariableDefinitionConfig = RemoveNodeConfig< - VariableDefinitionNode ->; - -const TYPENAME_FIELD: FieldNode = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; - -function isEmpty( - op: OperationDefinitionNode | FragmentDefinitionNode, - fragments: FragmentMap, -): boolean { - return op.selectionSet.selections.every( - selection => - selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments), - ); -} - -function nullIfDocIsEmpty(doc: DocumentNode) { - return isEmpty( - getOperationDefinition(doc) || getFragmentDefinition(doc), - createFragmentMap(getFragmentDefinitions(doc)), - ) - ? null - : doc; -} - -function getDirectiveMatcher( - directives: (RemoveDirectiveConfig | GetDirectiveConfig)[], -) { - return function directiveMatcher(directive: DirectiveNode) { - return directives.some( - dir => - (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)), - ); - }; -} - -export function removeDirectivesFromDocument( - directives: RemoveDirectiveConfig[], - doc: DocumentNode, -): DocumentNode | null { - const variablesInUse: Record = Object.create(null); - let variablesToRemove: RemoveArgumentsConfig[] = []; - - const fragmentSpreadsInUse: Record = Object.create(null); - let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = []; - - let modifiedDoc = nullIfDocIsEmpty( - visit(doc, { - Variable: { - enter(node, _key, parent) { - // Store each variable that's referenced as part of an argument - // (excluding operation definition variables), so we know which - // variables are being used. If we later want to remove a variable - // we'll fist check to see if it's being used, before continuing with - // the removal. - if ( - (parent as VariableDefinitionNode).kind !== 'VariableDefinition' - ) { - variablesInUse[node.name.value] = true; - } - }, - }, - - Field: { - enter(node) { - if (directives && node.directives) { - // If `remove` is set to true for a directive, and a directive match - // is found for a field, remove the field as well. - const shouldRemoveField = directives.some( - directive => directive.remove, - ); - - if ( - shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives)) - ) { - if (node.arguments) { - // Store field argument variables so they can be removed - // from the operation definition. - node.arguments.forEach(arg => { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: (arg.value as VariableNode).name.value, - }); - } - }); - } - - if (node.selectionSet) { - // Store fragment spread names so they can be removed from the - // docuemnt. - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach( - frag => { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }, - ); - } - - // Remove the field. - return null; - } - } - }, - }, - - FragmentSpread: { - enter(node) { - // Keep track of referenced fragment spreads. This is used to - // determine if top level fragment definitions should be removed. - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - - Directive: { - enter(node) { - // If a matching directive is found, remove it. - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - }), - ); - - // If we've removed fields with arguments, make sure the associated - // variables are also removed from the rest of the document, as long as they - // aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length - ) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - // If we've removed selection sets with fragment spreads, make sure the - // associated fragment definitions are also removed from the rest of the - // document, as long as they aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name]) - .length - ) { - modifiedDoc = removeFragmentSpreadFromDocument( - fragmentSpreadsToRemove, - modifiedDoc, - ); - } - - return modifiedDoc; -} - -export function addTypenameToDocument(doc: DocumentNode): DocumentNode { - return visit(checkDocument(doc), { - SelectionSet: { - enter(node, _key, parent) { - // Don't add __typename to OperationDefinitions. - if ( - parent && - (parent as OperationDefinitionNode).kind === 'OperationDefinition' - ) { - return; - } - - // No changes if no selections. - const { selections } = node; - if (!selections) { - return; - } - - // If selections already have a __typename, or are part of an - // introspection query, do nothing. - const skip = selections.some(selection => { - return ( - isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0) - ); - }); - if (skip) { - return; - } - - // If this SelectionSet is @export-ed as an input variable, it should - // not have a __typename field (see issue #4691). - const field = parent as FieldNode; - if ( - isField(field) && - field.directives && - field.directives.some(d => d.name.value === 'export') - ) { - return; - } - - // Create and return a new SelectionSet with a __typename Field. - return { - ...node, - selections: [...selections, TYPENAME_FIELD], - }; - }, - }, - }); -} - -const connectionRemoveConfig = { - test: (directive: DirectiveNode) => { - const willRemove = directive.name.value === 'connection'; - if (willRemove) { - if ( - !directive.arguments || - !directive.arguments.some(arg => arg.name.value === 'key') - ) { - invariant.warn( - 'Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.', - ); - } - } - - return willRemove; - }, -}; - -export function removeConnectionDirectiveFromDocument(doc: DocumentNode) { - return removeDirectivesFromDocument( - [connectionRemoveConfig], - checkDocument(doc), - ); -} - -function hasDirectivesInSelectionSet( - directives: GetDirectiveConfig[], - selectionSet: SelectionSetNode, - nestedCheck = true, -): boolean { - return ( - selectionSet && - selectionSet.selections && - selectionSet.selections.some(selection => - hasDirectivesInSelection(directives, selection, nestedCheck), - ) - ); -} - -function hasDirectivesInSelection( - directives: GetDirectiveConfig[], - selection: SelectionNode, - nestedCheck = true, -): boolean { - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return ( - selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet( - directives, - selection.selectionSet, - nestedCheck, - )) - ); -} - -export function getDirectivesFromDocument( - directives: GetDirectiveConfig[], - doc: DocumentNode, -): DocumentNode { - checkDocument(doc); - - let parentPath: string; - - return nullIfDocIsEmpty( - visit(doc, { - SelectionSet: { - enter(node, _key, _parent, path) { - const currentPath = path.join('-'); - - if ( - !parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath) - ) { - if (node.selections) { - const selectionsWithDirectives = node.selections.filter( - selection => hasDirectivesInSelection(directives, selection), - ); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return { - ...node, - selections: selectionsWithDirectives, - }; - } else { - return null; - } - } - }, - }, - }), - ); -} - -function getArgumentMatcher(config: RemoveArgumentsConfig[]) { - return function argumentMatcher(argument: ArgumentNode) { - return config.some( - (aConfig: RemoveArgumentsConfig) => - argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))), - ); - }; -} - -export function removeArgumentsFromDocument( - config: RemoveArgumentsConfig[], - doc: DocumentNode, -): DocumentNode { - const argMatcher = getArgumentMatcher(config); - - return nullIfDocIsEmpty( - visit(doc, { - OperationDefinition: { - enter(node) { - return { - ...node, - // Remove matching top level variables definitions. - variableDefinitions: node.variableDefinitions.filter( - varDef => - !config.some(arg => arg.name === varDef.variable.name.value), - ), - }; - }, - }, - - Field: { - enter(node) { - // If `remove` is set to true for an argument, and an argument match - // is found for a field, remove the field as well. - const shouldRemoveField = config.some(argConfig => argConfig.remove); - - if (shouldRemoveField) { - let argMatchCount = 0; - node.arguments.forEach(arg => { - if (argMatcher(arg)) { - argMatchCount += 1; - } - }); - if (argMatchCount === 1) { - return null; - } - } - }, - }, - - Argument: { - enter(node) { - // Remove all matching arguments. - if (argMatcher(node)) { - return null; - } - }, - }, - }), - ); -} - -export function removeFragmentSpreadFromDocument( - config: RemoveFragmentSpreadConfig[], - doc: DocumentNode, -): DocumentNode { - function enter( - node: FragmentSpreadNode | FragmentDefinitionNode, - ): null | void { - if (config.some(def => def.name === node.name.value)) { - return null; - } - } - - return nullIfDocIsEmpty( - visit(doc, { - FragmentSpread: { enter }, - FragmentDefinition: { enter }, - }), - ); -} - -function getAllFragmentSpreadsFromSelectionSet( - selectionSet: SelectionSetNode, -): FragmentSpreadNode[] { - const allFragments: FragmentSpreadNode[] = []; - - selectionSet.selections.forEach(selection => { - if ( - (isField(selection) || isInlineFragment(selection)) && - selection.selectionSet - ) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach( - frag => allFragments.push(frag), - ); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - - return allFragments; -} - -// If the incoming document is a query, return it as is. Otherwise, build a -// new document containing a query operation based on the selection set -// of the previous main operation. -export function buildQueryFromSelectionSet( - document: DocumentNode, -): DocumentNode { - const definition = getMainDefinition(document); - const definitionOperation = (definition).operation; - - if (definitionOperation === 'query') { - // Already a query, so return the existing document. - return document; - } - - // Build a new query using the selection set of the main operation. - const modifiedDoc = visit(document, { - OperationDefinition: { - enter(node) { - return { - ...node, - operation: 'query', - }; - }, - }, - }); - return modifiedDoc; -} - -// Remove fields / selection sets that include an @client directive. -export function removeClientSetsFromDocument( - document: DocumentNode, -): DocumentNode | null { - checkDocument(document); - - let modifiedDoc = removeDirectivesFromDocument( - [ - { - test: (directive: DirectiveNode) => directive.name.value === 'client', - remove: true, - }, - ], - document, - ); - - // After a fragment definition has had its @client related document - // sets removed, if the only field it has left is a __typename field, - // remove the entire fragment operation to prevent it from being fired - // on the server. - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter(node) { - if (node.selectionSet) { - const isTypenameOnly = node.selectionSet.selections.every( - selection => - isField(selection) && selection.name.value === '__typename', - ); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - - return modifiedDoc; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/assign.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/assign.ts deleted file mode 100644 index 6d3ef045..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/assign.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { assign } from '../assign'; - -describe('assign', () => { - it('will merge many objects together', () => { - expect(assign({ a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 })).toEqual({ - a: 1, - b: 2, - c: 3, - }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 })).toEqual({ - a: 1, - b: 2, - c: 3, - d: 4, - }); - }); - - it('will merge many objects together shallowly', () => { - expect(assign({ x: { a: 1 } }, { x: { b: 2 } })).toEqual({ x: { b: 2 } }); - expect(assign({ x: { a: 1 } }, { x: { b: 2 } }, { x: { c: 3 } })).toEqual({ - x: { c: 3 }, - }); - expect( - assign( - { x: { a: 1 } }, - { x: { b: 2 } }, - { x: { c: 3 } }, - { x: { d: 4 } }, - ), - ).toEqual({ x: { d: 4 } }); - }); - - it('will mutate and return the source objects', () => { - const source1 = { a: 1 }; - const source2 = { a: 1 }; - const source3 = { a: 1 }; - - expect(assign(source1, { b: 2 })).toEqual(source1); - expect(assign(source2, { b: 2 }, { c: 3 })).toEqual(source2); - expect(assign(source3, { b: 2 }, { c: 3 }, { d: 4 })).toEqual(source3); - - expect(source1).toEqual({ a: 1, b: 2 }); - expect(source2).toEqual({ a: 1, b: 2, c: 3 }); - expect(source3).toEqual({ a: 1, b: 2, c: 3, d: 4 }); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts deleted file mode 100644 index 52b491b5..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { cloneDeep } from '../cloneDeep'; - -describe('cloneDeep', () => { - it('will clone primitive values', () => { - expect(cloneDeep(undefined)).toEqual(undefined); - expect(cloneDeep(null)).toEqual(null); - expect(cloneDeep(true)).toEqual(true); - expect(cloneDeep(false)).toEqual(false); - expect(cloneDeep(-1)).toEqual(-1); - expect(cloneDeep(+1)).toEqual(+1); - expect(cloneDeep(0.5)).toEqual(0.5); - expect(cloneDeep('hello')).toEqual('hello'); - expect(cloneDeep('world')).toEqual('world'); - }); - - it('will clone objects', () => { - const value1 = {}; - const value2 = { a: 1, b: 2, c: 3 }; - const value3 = { x: { a: 1, b: 2, c: 3 }, y: { a: 1, b: 2, c: 3 } }; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3.x).toEqual(value3.x); - expect(clonedValue3.y).toEqual(value3.y); - }); - - it('will clone arrays', () => { - const value1: Array = []; - const value2 = [1, 2, 3]; - const value3 = [[1, 2, 3], [1, 2, 3]]; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3[0]).toEqual(value3[0]); - expect(clonedValue3[1]).toEqual(value3[1]); - }); - - it('should not attempt to follow circular references', () => { - const someObject = { - prop1: 'value1', - anotherObject: null, - }; - const anotherObject = { - someObject, - }; - someObject.anotherObject = anotherObject; - let chk; - expect(() => { - chk = cloneDeep(someObject); - }).not.toThrow(); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/environment.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/environment.ts deleted file mode 100644 index dcb71538..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/environment.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { isEnv, isProduction, isDevelopment, isTest } from '../environment'; - -describe('environment', () => { - let keepEnv: string | undefined; - - beforeEach(() => { - // save the NODE_ENV - keepEnv = process.env.NODE_ENV; - }); - - afterEach(() => { - // restore the NODE_ENV - process.env.NODE_ENV = keepEnv; - }); - - describe('isEnv', () => { - it(`should match when there's a value`, () => { - ['production', 'development', 'test'].forEach(env => { - process.env.NODE_ENV = env; - expect(isEnv(env)).toBe(true); - }); - }); - - it(`should treat no proces.env.NODE_ENV as it'd be in development`, () => { - delete process.env.NODE_ENV; - expect(isEnv('development')).toBe(true); - }); - }); - - describe('isProduction', () => { - it('should return true if in production', () => { - process.env.NODE_ENV = 'production'; - expect(isProduction()).toBe(true); - }); - - it('should return false if not in production', () => { - process.env.NODE_ENV = 'test'; - expect(!isProduction()).toBe(true); - }); - }); - - describe('isTest', () => { - it('should return true if in test', () => { - process.env.NODE_ENV = 'test'; - expect(isTest()).toBe(true); - }); - - it('should return true if not in test', () => { - process.env.NODE_ENV = 'development'; - expect(!isTest()).toBe(true); - }); - }); - - describe('isDevelopment', () => { - it('should return true if in development', () => { - process.env.NODE_ENV = 'development'; - expect(isDevelopment()).toBe(true); - }); - - it('should return true if not in development and environment is defined', () => { - process.env.NODE_ENV = 'test'; - expect(!isDevelopment()).toBe(true); - }); - - it('should make development as the default environment', () => { - delete process.env.NODE_ENV; - expect(isDevelopment()).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts deleted file mode 100644 index e621a837..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { isEqual } from '../isEqual'; - -describe('isEqual', () => { - it('should return true for equal primitive values', () => { - expect(isEqual(undefined, undefined)).toBe(true); - expect(isEqual(null, null)).toBe(true); - expect(isEqual(true, true)).toBe(true); - expect(isEqual(false, false)).toBe(true); - expect(isEqual(-1, -1)).toBe(true); - expect(isEqual(+1, +1)).toBe(true); - expect(isEqual(42, 42)).toBe(true); - expect(isEqual(0, 0)).toBe(true); - expect(isEqual(0.5, 0.5)).toBe(true); - expect(isEqual('hello', 'hello')).toBe(true); - expect(isEqual('world', 'world')).toBe(true); - }); - - it('should return false for not equal primitive values', () => { - expect(!isEqual(undefined, null)).toBe(true); - expect(!isEqual(null, undefined)).toBe(true); - expect(!isEqual(true, false)).toBe(true); - expect(!isEqual(false, true)).toBe(true); - expect(!isEqual(-1, +1)).toBe(true); - expect(!isEqual(+1, -1)).toBe(true); - expect(!isEqual(42, 42.00000000000001)).toBe(true); - expect(!isEqual(0, 0.5)).toBe(true); - expect(!isEqual('hello', 'world')).toBe(true); - expect(!isEqual('world', 'hello')).toBe(true); - }); - - it('should return false when comparing primitives with objects', () => { - expect(!isEqual({}, null)).toBe(true); - expect(!isEqual(null, {})).toBe(true); - expect(!isEqual({}, true)).toBe(true); - expect(!isEqual(true, {})).toBe(true); - expect(!isEqual({}, 42)).toBe(true); - expect(!isEqual(42, {})).toBe(true); - expect(!isEqual({}, 'hello')).toBe(true); - expect(!isEqual('hello', {})).toBe(true); - }); - - it('should correctly compare shallow objects', () => { - expect(isEqual({}, {})).toBe(true); - expect(isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 3, b: 2, c: 1 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toBe(true); - expect(!isEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toBe(true); - }); - - it('should correctly compare deep objects', () => { - expect(isEqual({ x: {} }, { x: {} })).toBe(true); - expect( - isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2, c: 3 } }), - ).toBe(true); - expect( - !isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 3, b: 2, c: 1 } }), - ).toBe(true); - expect(!isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2 } })).toBe( - true, - ); - expect(!isEqual({ x: { a: 1, b: 2 } }, { x: { a: 1, b: 2, c: 3 } })).toBe( - true, - ); - }); - - it('should correctly compare deep objects without object prototype ', () => { - // Solves https://github.com/apollographql/apollo-client/issues/2132 - const objNoProto = Object.create(null); - objNoProto.a = { b: 2, c: [3, 4] }; - objNoProto.e = Object.create(null); - objNoProto.e.f = 5; - expect(isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 6 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: null })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, null)).toBe(true); - }); - - it('should correctly handle modified prototypes', () => { - Array.prototype.foo = null; - expect(isEqual([1, 2, 3], [1, 2, 3])).toBe(true); - expect(!isEqual([1, 2, 3], [1, 2, 4])).toBe(true); - delete Array.prototype.foo; - }); - - describe('comparing objects with circular refs', () => { - // copied with slight modification from lodash test suite - it('should compare objects with circular references', () => { - const object1 = {}, - object2 = {}; - - object1.a = object1; - object2.a = object2; - - expect(isEqual(object1, object2)).toBe(true); - - object1.b = 0; - object2.b = Object(0); - - expect(isEqual(object1, object2)).toBe(true); - - object1.c = Object(1); - object2.c = Object(2); - - expect(isEqual(object1, object2)).toBe(false); - - object1 = { a: 1, b: 2, c: 3 }; - object1.b = object1; - object2 = { a: 1, b: { a: 1, b: 2, c: 3 }, c: 3 }; - - expect(isEqual(object1, object2)).toBe(false); - }); - - it('should have transitive equivalence for circular references of objects', () => { - const object1 = {}, - object2 = { a: object1 }, - object3 = { a: object2 }; - - object1.a = object1; - - expect(isEqual(object1, object2)).toBe(true); - expect(isEqual(object2, object3)).toBe(true); - expect(isEqual(object1, object3)).toBe(true); - }); - - it('should compare objects with multiple circular references', () => { - const array1 = [{}], - array2 = [{}]; - - (array1[0].a = array1).push(array1); - (array2[0].a = array2).push(array2); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].b = 0; - array2[0].b = Object(0); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].c = Object(1); - array2[0].c = Object(2); - - expect(isEqual(array1, array2)).toBe(false); - }); - - it('should compare objects with complex circular references', () => { - const object1 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - const object2 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - object1.foo.b.c.d = object1; - object1.bar.b = object1.foo.b; - - object2.foo.b.c.d = object2; - object2.bar.b = object2.foo.b; - - expect(isEqual(object1, object2)).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts deleted file mode 100644 index c33cc60c..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { maybeDeepFreeze } from '../maybeDeepFreeze'; - -describe('maybeDeepFreeze', () => { - it('should deep freeze', () => { - const foo: any = { bar: undefined }; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - expect(foo.bar).toBeUndefined(); - }); - - it('should properly freeze objects without hasOwnProperty', () => { - const foo = Object.create(null); - foo.bar = undefined; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts deleted file mode 100644 index 13778069..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { mergeDeep, mergeDeepArray } from '../mergeDeep'; - -describe('mergeDeep', function() { - it('should return an object if first argument falsy', function() { - expect(mergeDeep()).toEqual({}); - expect(mergeDeep(null)).toEqual({}); - expect(mergeDeep(null, { foo: 42 })).toEqual({ foo: 42 }); - }); - - it('should preserve identity for single arguments', function() { - const arg = Object.create(null); - expect(mergeDeep(arg)).toBe(arg); - }); - - it('should preserve identity when merging non-conflicting objects', function() { - const a = { a: { name: 'ay' } }; - const b = { b: { name: 'bee' } }; - const c = mergeDeep(a, b); - expect(c.a).toBe(a.a); - expect(c.b).toBe(b.b); - expect(c).toEqual({ - a: { name: 'ay' }, - b: { name: 'bee' }, - }); - }); - - it('should shallow-copy conflicting fields', function() { - const a = { conflict: { fromA: [1, 2, 3] } }; - const b = { conflict: { fromB: [4, 5] } }; - const c = mergeDeep(a, b); - expect(c.conflict).not.toBe(a.conflict); - expect(c.conflict).not.toBe(b.conflict); - expect(c.conflict.fromA).toBe(a.conflict.fromA); - expect(c.conflict.fromB).toBe(b.conflict.fromB); - expect(c).toEqual({ - conflict: { - fromA: [1, 2, 3], - fromB: [4, 5], - }, - }); - }); - - it('should resolve conflicts among more than two objects', function() { - const sources = []; - - for (let i = 0; i < 100; ++i) { - sources.push({ - ['unique' + i]: { value: i }, - conflict: { - ['from' + i]: { value: i }, - nested: { - ['nested' + i]: { value: i }, - }, - }, - }); - } - - const merged = mergeDeep(...sources); - - sources.forEach((source, i) => { - expect(merged['unique' + i].value).toBe(i); - expect(source['unique' + i]).toBe(merged['unique' + i]); - - expect(merged.conflict).not.toBe(source.conflict); - expect(merged.conflict['from' + i].value).toBe(i); - expect(merged.conflict['from' + i]).toBe(source.conflict['from' + i]); - - expect(merged.conflict.nested).not.toBe(source.conflict.nested); - expect(merged.conflict.nested['nested' + i].value).toBe(i); - expect(merged.conflict.nested['nested' + i]).toBe( - source.conflict.nested['nested' + i], - ); - }); - }); - - it('can merge array elements', function() { - const a = [{ a: 1 }, { a: 'ay' }, 'a']; - const b = [{ b: 2 }, { b: 'bee' }, 'b']; - const c = [{ c: 3 }, { c: 'cee' }, 'c']; - const d = { 1: { d: 'dee' } }; - - expect(mergeDeep(a, b, c, d)).toEqual([ - { a: 1, b: 2, c: 3 }, - { a: 'ay', b: 'bee', c: 'cee', d: 'dee' }, - 'c', - ]); - }); - - it('lets the last conflicting value win', function() { - expect(mergeDeep('a', 'b', 'c')).toBe('c'); - - expect( - mergeDeep( - { a: 'a', conflict: 1 }, - { b: 'b', conflict: 2 }, - { c: 'c', conflict: 3 }, - ), - ).toEqual({ - a: 'a', - b: 'b', - c: 'c', - conflict: 3, - }); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - [/*empty*/, ['B'], 'D'], - )).toEqual( - ['a', ['B', 'c'], 'D'], - ); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - ['A', [/*empty*/, 'C']], - )).toEqual( - ['A', ['b', 'C'], 'd'], - ); - }); - - it('mergeDeep returns the intersection of its argument types', function() { - const abc = mergeDeep({ str: "hi", a: 1 }, { a: 3, b: 2 }, { b: 1, c: 2 }); - // The point of this test is that the following lines type-check without - // resorting to any `any` loopholes: - expect(abc.str.slice(0)).toBe("hi"); - expect(abc.a * 2).toBe(6); - expect(abc.b - 0).toBe(1); - expect(abc.c / 2).toBe(1); - }); - - it('mergeDeepArray returns the supertype of its argument types', function() { - class F { - check() { return "ok" }; - } - const fs: F[] = [new F, new F, new F]; - // Although mergeDeepArray doesn't have the same tuple type awareness as - // mergeDeep, it does infer that F should be the return type here: - expect(mergeDeepArray(fs).check()).toBe("ok"); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts deleted file mode 100644 index fd5594b8..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { stripSymbols } from '../stripSymbols'; - -interface SymbolConstructor { - (description?: string | number): symbol; -} - -declare const Symbol: SymbolConstructor; - -describe('stripSymbols', () => { - it('should strip symbols (only)', () => { - const sym = Symbol('id'); - const data = { foo: 'bar', [sym]: 'ROOT_QUERY' }; - expect(stripSymbols(data)).toEqual({ foo: 'bar' }); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts deleted file mode 100644 index 35c87534..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { warnOnceInDevelopment } from '../warnOnce'; - -let lastWarning: string | null; -let keepEnv: string | undefined; -let numCalls = 0; -let oldConsoleWarn: any; - -describe('warnOnce', () => { - beforeEach(() => { - keepEnv = process.env.NODE_ENV; - numCalls = 0; - lastWarning = null; - oldConsoleWarn = console.warn; - console.warn = (msg: any) => { - numCalls++; - lastWarning = msg; - }; - }); - afterEach(() => { - process.env.NODE_ENV = keepEnv; - console.warn = oldConsoleWarn; - }); - it('actually warns', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('hi'); - expect(lastWarning).toBe('hi'); - expect(numCalls).toEqual(1); - }); - - it('does not warn twice', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('ho'); - warnOnceInDevelopment('ho'); - expect(lastWarning).toEqual('ho'); - expect(numCalls).toEqual(1); - }); - - it('warns two different things once each', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('slow'); - expect(lastWarning).toEqual('slow'); - warnOnceInDevelopment('mo'); - expect(lastWarning).toEqual('mo'); - expect(numCalls).toEqual(2); - }); - - it('does not warn in production', () => { - process.env.NODE_ENV = 'production'; - warnOnceInDevelopment('lo'); - warnOnceInDevelopment('lo'); - expect(numCalls).toEqual(0); - }); - - it('warns many times in test', () => { - process.env.NODE_ENV = 'test'; - warnOnceInDevelopment('yo'); - warnOnceInDevelopment('yo'); - expect(lastWarning).toEqual('yo'); - expect(numCalls).toEqual(2); - }); -}); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/assign.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/assign.ts deleted file mode 100644 index 3a224329..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/assign.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Adds the properties of one or more source objects to a target object. Works exactly like - * `Object.assign`, but as a utility to maintain support for IE 11. - * - * @see https://github.com/apollostack/apollo-client/pull/1009 - */ -export function assign(a: A, b: B): A & B; -export function assign(a: A, b: B, c: C): A & B & C; -export function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export function assign( - a: A, - b: B, - c: C, - d: D, - e: E, -): A & B & C & D & E; -export function assign(target: any, ...sources: Array): any; -export function assign( - target: { [key: string]: any }, - ...sources: Array<{ [key: string]: any }> -): { [key: string]: any } { - sources.forEach(source => { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(key => { - target[key] = source[key]; - }); - }); - return target; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/canUse.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/canUse.ts deleted file mode 100644 index d9858679..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/canUse.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const canUseWeakMap = typeof WeakMap === 'function' && !( - typeof navigator === 'object' && - navigator.product === 'ReactNative' -); diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/cloneDeep.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/cloneDeep.ts deleted file mode 100644 index 961b4a82..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/cloneDeep.ts +++ /dev/null @@ -1,37 +0,0 @@ -const { toString } = Object.prototype; - -/** - * Deeply clones a value to create a new instance. - */ -export function cloneDeep(value: T): T { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val: T, seen: Map): T { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) return seen.get(val); - const copy: T & any[] = (val as any).slice(0); - seen.set(val, copy); - copy.forEach(function (child, i) { - copy[i] = cloneDeepHelper(child, seen); - }); - return copy; - } - - case "[object Object]": { - if (seen.has(val)) return seen.get(val); - // High fidelity polyfills of Object.create and Object.getPrototypeOf are - // possible in all JS environments, so we will assume they exist/work. - const copy = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy); - Object.keys(val).forEach(key => { - copy[key] = cloneDeepHelper((val as any)[key], seen); - }); - return copy; - } - - default: - return val; - } -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/environment.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/environment.ts deleted file mode 100644 index f4ad04e1..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/environment.ts +++ /dev/null @@ -1,24 +0,0 @@ -export function getEnv(): string | undefined { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - // default environment - return 'development'; -} - -export function isEnv(env: string): boolean { - return getEnv() === env; -} - -export function isProduction(): boolean { - return isEnv('production') === true; -} - -export function isDevelopment(): boolean { - return isEnv('development') === true; -} - -export function isTest(): boolean { - return isEnv('test') === true; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/errorHandling.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/errorHandling.ts deleted file mode 100644 index 25a16ca0..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/errorHandling.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ExecutionResult } from 'graphql'; - -export function tryFunctionOrLogError(f: Function) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -export function graphQLResultHasError(result: ExecutionResult) { - return result.errors && result.errors.length; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/filterInPlace.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/filterInPlace.ts deleted file mode 100644 index d5787cab..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/filterInPlace.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function filterInPlace( - array: T[], - test: (elem: T) => boolean, - context?: any, -): T[] { - let target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/isEqual.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/isEqual.ts deleted file mode 100644 index debf7429..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/isEqual.ts +++ /dev/null @@ -1 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts deleted file mode 100644 index d966d336..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { isDevelopment, isTest } from './environment'; - -// Taken (mostly) from https://github.com/substack/deep-freeze to avoid -// import hassles with rollup. -function deepFreeze(o: any) { - Object.freeze(o); - - Object.getOwnPropertyNames(o).forEach(function(prop) { - if ( - o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop]) - ) { - deepFreeze(o[prop]); - } - }); - - return o; -} - -export function maybeDeepFreeze(obj: any) { - if (isDevelopment() || isTest()) { - // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing - // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043). - const symbolIsPolyfilled = - typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/mergeDeep.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/mergeDeep.ts deleted file mode 100644 index d83a33fe..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/mergeDeep.ts +++ /dev/null @@ -1,115 +0,0 @@ -const { hasOwnProperty } = Object.prototype; - -// These mergeDeep and mergeDeepArray utilities merge any number of objects -// together, sharing as much memory as possible with the source objects, while -// remaining careful to avoid modifying any source objects. - -// Logically, the return type of mergeDeep should be the intersection of -// all the argument types. The binary call signature is by far the most -// common, but we support 0- through 5-ary as well. After that, the -// resulting type is just the inferred array element type. Note to nerds: -// there is a more clever way of doing this that converts the tuple type -// first to a union type (easy enough: T[number]) and then converts the -// union to an intersection type using distributive conditional type -// inference, but that approach has several fatal flaws (boolean becomes -// true & false, and the inferred type ends up as unknown in many cases), -// in addition to being nearly impossible to explain/understand. -export type TupleToIntersection = - T extends [infer A] ? A : - T extends [infer A, infer B] ? A & B : - T extends [infer A, infer B, infer C] ? A & B & C : - T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : - T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : - T extends (infer U)[] ? U : any; - -export function mergeDeep( - ...sources: T -): TupleToIntersection { - return mergeDeepArray(sources); -} - -// In almost any situation where you could succeed in getting the -// TypeScript compiler to infer a tuple type for the sources array, you -// could just use mergeDeep instead of mergeDeepArray, so instead of -// trying to convert T[] to an intersection type we just infer the array -// element type, which works perfectly when the sources array has a -// consistent element type. -export function mergeDeepArray(sources: T[]): T { - let target = sources[0] || {} as T; - const count = sources.length; - if (count > 1) { - const pastCopies: any[] = []; - target = shallowCopyForMerge(target, pastCopies); - for (let i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} - -function isObject(obj: any): obj is Record { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper( - target: any, - source: any, - pastCopies: any[], -) { - if (isObject(source) && isObject(target)) { - // In case the target has been frozen, make an extensible copy so that - // we can merge properties into the copy. - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(sourceKey => { - const sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - const targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - // When there is a key collision, we need to make a shallow copy of - // target[sourceKey] so the merge does not modify any source objects. - // To avoid making unnecessary copies, we use a simple array to track - // past copies, since it's safe to modify copies created earlier in - // the merge. We use an array for pastCopies instead of a Map or Set, - // since the number of copies should be relatively small, and some - // Map/Set polyfills modify their keys. - target[sourceKey] = mergeHelper( - shallowCopyForMerge(targetValue, pastCopies), - sourceValue, - pastCopies, - ); - } - } else { - // If there is no collision, the target can safely share memory with - // the source, and the recursion can terminate here. - target[sourceKey] = sourceValue; - } - }); - - return target; - } - - // If source (or target) is not an object, let source replace target. - return source; -} - -function shallowCopyForMerge(value: T, pastCopies: any[]): T { - if ( - value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0 - ) { - if (Array.isArray(value)) { - value = (value as any).slice(0); - } else { - value = { - __proto__: Object.getPrototypeOf(value), - ...value, - }; - } - pastCopies.push(value); - } - return value; -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/stripSymbols.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/stripSymbols.ts deleted file mode 100644 index 41cabae7..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/stripSymbols.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * In order to make assertions easier, this function strips `symbol`'s from - * the incoming data. - * - * This can be handy when running tests against `apollo-client` for example, - * since it adds `symbol`'s to the data in the store. Jest's `toEqual` - * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437), - * which means all test data used in a `toEqual` comparison would also have to - * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data - * we can compare against more simplified test data. - */ -export function stripSymbols(data: T): T { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/warnOnce.ts b/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/warnOnce.ts deleted file mode 100644 index 90f32321..00000000 --- a/node_modules/apollo-cache/node_modules/apollo-utilities/src/util/warnOnce.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { isProduction, isTest } from './environment'; - -const haveWarned = Object.create({}); - -/** - * Print a warning only once in development. - * In production no warnings are printed. - * In test all warnings are printed. - * - * @param msg The warning message - * @param type warn or error (will call console.warn or console.error) - */ -export function warnOnceInDevelopment(msg: string, type = 'warn') { - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} diff --git a/node_modules/apollo-cache/package.json b/node_modules/apollo-cache/package.json deleted file mode 100644 index 9cb711a2..00000000 --- a/node_modules/apollo-cache/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "_from": "apollo-cache@1.3.5", - "_id": "apollo-cache@1.3.5", - "_inBundle": false, - "_integrity": "sha512-1XoDy8kJnyWY/i/+gLTEbYLnoiVtS8y7ikBr/IfmML4Qb+CM7dEEbIUOjnY716WqmZ/UpXIxTfJsY7rMcqiCXA==", - "_location": "/apollo-cache", - "_phantomChildren": { - "@wry/equality": "0.1.9", - "fast-json-stable-stringify": "2.0.0", - "ts-invariant": "0.4.4", - "tslib": "1.10.0" - }, - "_requested": { - "type": "version", - "registry": true, - "raw": "apollo-cache@1.3.5", - "name": "apollo-cache", - "escapedName": "apollo-cache", - "rawSpec": "1.3.5", - "saveSpec": null, - "fetchSpec": "1.3.5" - }, - "_requiredBy": [ - "/apollo-client" - ], - "_resolved": "https://registry.npmjs.org/apollo-cache/-/apollo-cache-1.3.5.tgz", - "_shasum": "9dbebfc8dbe8fe7f97ba568a224bca2c5d81f461", - "_spec": "apollo-cache@1.3.5", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-client", - "author": { - "name": "James Baxley", - "email": "james@meteor.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "James Burgess", - "email": "jamesmillerburgess@gmail.com" - } - ], - "dependencies": { - "apollo-utilities": "^1.3.4", - "tslib": "^1.10.0" - }, - "deprecated": false, - "description": "Core abstract of Caching layer for Apollo Client", - "gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "license": "MIT", - "main": "./lib/bundle.cjs.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-cache", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "scripts": { - "build": "tsc -b .", - "bundle": "npx rollup -c rollup.config.js", - "clean": "rm -rf coverage/* lib/*", - "coverage": "jest --coverage", - "lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts && tslint -c \"../../config/tslint.json\" -p tsconfig.json tests/*.ts", - "postbuild": "npm run bundle", - "prebuild": "npm run clean", - "prepare": "npm run lint && npm run build", - "prepublishOnly": "npm run clean && npm run build", - "test": "tsc -p tsconfig.json --noEmit && jest", - "watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.3.5" -} diff --git a/node_modules/apollo-cache/src/__tests__/__snapshots__/utils.ts.snap b/node_modules/apollo-cache/src/__tests__/__snapshots__/utils.ts.snap deleted file mode 100644 index 2a167ec7..00000000 --- a/node_modules/apollo-cache/src/__tests__/__snapshots__/utils.ts.snap +++ /dev/null @@ -1,63 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[ - `writing data with no query converts a JavaScript object to a query correctly arrays 1` -] = ` -"query GeneratedClientQuery { - number - bool - nested { - bool2 - undef - nullField - str - } -} -" -`; - -exports[ - `writing data with no query converts a JavaScript object to a query correctly basic 1` -] = ` -"query GeneratedClientQuery { - number - bool - bool2 - undef - nullField - str -} -" -`; - -exports[ - `writing data with no query converts a JavaScript object to a query correctly fragments 1` -] = ` -"fragment GeneratedClientQuery on __FakeType { - number - bool - nested { - bool2 - undef - nullField - str - } -} -" -`; - -exports[ - `writing data with no query converts a JavaScript object to a query correctly nested 1` -] = ` -"query GeneratedClientQuery { - number - bool - nested { - bool2 - undef - nullField - str - } -} -" -`; diff --git a/node_modules/apollo-cache/src/__tests__/cache.ts b/node_modules/apollo-cache/src/__tests__/cache.ts deleted file mode 100644 index 6f10d7c5..00000000 --- a/node_modules/apollo-cache/src/__tests__/cache.ts +++ /dev/null @@ -1,149 +0,0 @@ -import gql from 'graphql-tag'; - -import { ApolloCache as Cache } from '../cache'; - -class TestCache extends Cache {} - -describe('abstract cache', () => { - describe('transformDocument', () => { - it('returns the document', () => { - const test = new TestCache(); - expect(test.transformDocument('a')).toBe('a'); - }); - }); - - describe('transformForLink', () => { - it('returns the document', () => { - const test = new TestCache(); - expect(test.transformForLink('a')).toBe('a'); - }); - }); - - describe('readQuery', () => { - it('runs the read method', () => { - const test = new TestCache(); - test.read = jest.fn(); - - test.readQuery({}); - expect(test.read).toBeCalled(); - }); - - it('defaults optimistic to false', () => { - const test = new TestCache(); - test.read = ({ optimistic }) => optimistic; - - expect(test.readQuery({})).toBe(false); - expect(test.readQuery({}, true)).toBe(true); - }); - }); - - describe('readFragment', () => { - it('runs the read method', () => { - const test = new TestCache(); - test.read = jest.fn(); - const fragment = { - id: 'frag', - fragment: gql` - fragment a on b { - name - } - `, - }; - - test.readFragment(fragment); - expect(test.read).toBeCalled(); - }); - - it('defaults optimistic to false', () => { - const test = new TestCache(); - test.read = ({ optimistic }) => optimistic; - const fragment = { - id: 'frag', - fragment: gql` - fragment a on b { - name - } - `, - }; - - expect(test.readFragment(fragment)).toBe(false); - expect(test.readFragment(fragment, true)).toBe(true); - }); - }); - - describe('writeQuery', () => { - it('runs the write method', () => { - const test = new TestCache(); - test.write = jest.fn(); - - test.writeQuery({}); - expect(test.write).toBeCalled(); - }); - }); - - describe('writeFragment', () => { - it('runs the write method', () => { - const test = new TestCache(); - test.write = jest.fn(); - const fragment = { - id: 'frag', - fragment: gql` - fragment a on b { - name - } - `, - }; - - test.writeFragment(fragment); - expect(test.write).toBeCalled(); - }); - }); - - describe('writeData', () => { - it('either writes a fragment or a query', () => { - const test = new TestCache(); - test.read = jest.fn(); - test.writeFragment = jest.fn(); - test.writeQuery = jest.fn(); - - test.writeData({}); - expect(test.writeQuery).toBeCalled(); - - test.writeData({ id: 1 }); - expect(test.read).toBeCalled(); - expect(test.writeFragment).toBeCalled(); - - // Edge case for falsey id - test.writeData({ id: 0 }); - expect(test.read).toHaveBeenCalledTimes(2); - expect(test.writeFragment).toHaveBeenCalledTimes(2); - }); - - it('suppresses read errors', () => { - const test = new TestCache(); - test.read = () => { - throw new Error(); - }; - test.writeFragment = jest.fn(); - - expect(() => test.writeData({ id: 1 })).not.toThrow(); - expect(test.writeFragment).toBeCalled(); - }); - - it('reads __typename from typenameResult or defaults to __ClientData', () => { - const test = new TestCache(); - test.read = () => ({ __typename: 'a' }); - let res; - test.writeFragment = obj => - (res = obj.fragment.definitions[0].typeCondition.name.value); - - test.writeData({ id: 1 }); - expect(res).toBe('a'); - - test.read = () => ({}); - - test.writeData({ id: 1 }); - expect(res).toBe('__ClientData'); - }); - }); -}); diff --git a/node_modules/apollo-cache/src/__tests__/utils.ts b/node_modules/apollo-cache/src/__tests__/utils.ts deleted file mode 100644 index 953e0e12..00000000 --- a/node_modules/apollo-cache/src/__tests__/utils.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { print } from 'graphql/language/printer'; -import { queryFromPojo, fragmentFromPojo } from '../utils'; - -describe('writing data with no query', () => { - describe('converts a JavaScript object to a query correctly', () => { - it('basic', () => { - expect( - print( - queryFromPojo({ - number: 5, - bool: true, - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }), - ), - ).toMatchSnapshot(); - }); - - it('nested', () => { - expect( - print( - queryFromPojo({ - number: 5, - bool: true, - nested: { - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }, - }), - ), - ).toMatchSnapshot(); - }); - - it('arrays', () => { - expect( - print( - queryFromPojo({ - number: [5], - bool: [[true]], - nested: [ - { - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }, - ], - }), - ), - ).toMatchSnapshot(); - }); - - it('fragments', () => { - expect( - print( - fragmentFromPojo({ - number: [5], - bool: [[true]], - nested: [ - { - bool2: false, - undef: undefined, - nullField: null, - str: 'string', - }, - ], - }), - ), - ).toMatchSnapshot(); - }); - }); -}); diff --git a/node_modules/apollo-cache/src/cache.ts b/node_modules/apollo-cache/src/cache.ts deleted file mode 100644 index ab45b1a2..00000000 --- a/node_modules/apollo-cache/src/cache.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { DocumentNode } from 'graphql'; -import { getFragmentQueryDocument } from 'apollo-utilities'; - -import { DataProxy, Cache } from './types'; -import { justTypenameQuery, queryFromPojo, fragmentFromPojo } from './utils'; - -export type Transaction = (c: ApolloCache) => void; - -export abstract class ApolloCache implements DataProxy { - // required to implement - // core API - public abstract read( - query: Cache.ReadOptions, - ): T | null; - public abstract write( - write: Cache.WriteOptions, - ): void; - public abstract diff(query: Cache.DiffOptions): Cache.DiffResult; - public abstract watch(watch: Cache.WatchOptions): () => void; - public abstract evict( - query: Cache.EvictOptions, - ): Cache.EvictionResult; - public abstract reset(): Promise; - - // intializer / offline / ssr API - /** - * Replaces existing state in the cache (if any) with the values expressed by - * `serializedState`. - * - * Called when hydrating a cache (server side rendering, or offline storage), - * and also (potentially) during hot reloads. - */ - public abstract restore( - serializedState: TSerialized, - ): ApolloCache; - - /** - * Exposes the cache's complete state, in a serializable format for later restoration. - */ - public abstract extract(optimistic?: boolean): TSerialized; - - // optimistic API - public abstract removeOptimistic(id: string): void; - - // transactional API - public abstract performTransaction( - transaction: Transaction, - ): void; - public abstract recordOptimisticTransaction( - transaction: Transaction, - id: string, - ): void; - - // optional API - public transformDocument(document: DocumentNode): DocumentNode { - return document; - } - // experimental - public transformForLink(document: DocumentNode): DocumentNode { - return document; - } - - // DataProxy API - /** - * - * @param options - * @param optimistic - */ - public readQuery( - options: DataProxy.Query, - optimistic: boolean = false, - ): QueryType | null { - return this.read({ - query: options.query, - variables: options.variables, - optimistic, - }); - } - - public readFragment( - options: DataProxy.Fragment, - optimistic: boolean = false, - ): FragmentType | null { - return this.read({ - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - variables: options.variables, - rootId: options.id, - optimistic, - }); - } - - public writeQuery( - options: Cache.WriteQueryOptions, - ): void { - this.write({ - dataId: 'ROOT_QUERY', - result: options.data, - query: options.query, - variables: options.variables, - }); - } - - public writeFragment( - options: Cache.WriteFragmentOptions, - ): void { - this.write({ - dataId: options.id, - result: options.data, - variables: options.variables, - query: getFragmentQueryDocument(options.fragment, options.fragmentName), - }); - } - - public writeData({ - id, - data, - }: Cache.WriteDataOptions): void { - if (typeof id !== 'undefined') { - let typenameResult = null; - // Since we can't use fragments without having a typename in the store, - // we need to make sure we have one. - // To avoid overwriting an existing typename, we need to read it out first - // and generate a fake one if none exists. - try { - typenameResult = this.read({ - rootId: id, - optimistic: false, - query: justTypenameQuery, - }); - } catch (e) { - // Do nothing, since an error just means no typename exists - } - - // tslint:disable-next-line - const __typename = - (typenameResult && typenameResult.__typename) || '__ClientData'; - - // Add a type here to satisfy the inmemory cache - const dataToWrite = Object.assign({ __typename }, data); - - this.writeFragment({ - id, - fragment: fragmentFromPojo(dataToWrite, __typename), - data: dataToWrite, - }); - } else { - this.writeQuery({ query: queryFromPojo(data), data }); - } - } -} diff --git a/node_modules/apollo-cache/src/index.ts b/node_modules/apollo-cache/src/index.ts deleted file mode 100644 index 18273b71..00000000 --- a/node_modules/apollo-cache/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './cache'; -export * from './types'; diff --git a/node_modules/apollo-cache/src/types/Cache.ts b/node_modules/apollo-cache/src/types/Cache.ts deleted file mode 100644 index da6ef0bd..00000000 --- a/node_modules/apollo-cache/src/types/Cache.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { DataProxy } from './DataProxy'; - -export namespace Cache { - export type WatchCallback = (newData: any) => void; - export interface EvictionResult { - success: Boolean; - } - - export interface ReadOptions - extends DataProxy.Query { - rootId?: string; - previousResult?: any; - optimistic: boolean; - } - - export interface WriteOptions - extends DataProxy.Query { - dataId: string; - result: TResult; - } - - export interface DiffOptions extends ReadOptions { - returnPartialData?: boolean; - } - - export interface WatchOptions extends ReadOptions { - callback: WatchCallback; - } - - export interface EvictOptions - extends DataProxy.Query { - rootId?: string; - } - - export import DiffResult = DataProxy.DiffResult; - export import WriteQueryOptions = DataProxy.WriteQueryOptions; - export import WriteFragmentOptions = DataProxy.WriteFragmentOptions; - export import WriteDataOptions = DataProxy.WriteDataOptions; - export import Fragment = DataProxy.Fragment; -} diff --git a/node_modules/apollo-cache/src/types/DataProxy.ts b/node_modules/apollo-cache/src/types/DataProxy.ts deleted file mode 100644 index 8b85709a..00000000 --- a/node_modules/apollo-cache/src/types/DataProxy.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { DocumentNode } from 'graphql'; // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved - -export namespace DataProxy { - export interface Query { - /** - * The GraphQL query shape to be used constructed using the `gql` template - * string tag from `graphql-tag`. The query will be used to determine the - * shape of the data to be read. - */ - query: DocumentNode; - - /** - * Any variables that the GraphQL query may depend on. - */ - variables?: TVariables; - } - - export interface Fragment { - /** - * The root id to be used. This id should take the same form as the - * value returned by your `dataIdFromObject` function. If a value with your - * id does not exist in the store, `null` will be returned. - */ - id: string; - - /** - * A GraphQL document created using the `gql` template string tag from - * `graphql-tag` with one or more fragments which will be used to determine - * the shape of data to read. If you provide more than one fragment in this - * document then you must also specify `fragmentName` to select a single. - */ - fragment: DocumentNode; - - /** - * The name of the fragment in your GraphQL document to be used. If you do - * not provide a `fragmentName` and there is only one fragment in your - * `fragment` document then that fragment will be used. - */ - fragmentName?: string; - - /** - * Any variables that your GraphQL fragments depend on. - */ - variables?: TVariables; - } - - export interface WriteQueryOptions - extends Query { - /** - * The data you will be writing to the store. - */ - data: TData; - } - - export interface WriteFragmentOptions - extends Fragment { - /** - * The data you will be writing to the store. - */ - data: TData; - } - - export interface WriteDataOptions { - /** - * The data you will be writing to the store. - * It also takes an optional id property. - * The id is used to write a fragment to an existing object in the store. - */ - data: TData; - id?: string; - } - - export type DiffResult = { - result?: T; - complete?: boolean; - }; -} - -/** - * A proxy to the normalized data living in our store. This interface allows a - * user to read and write denormalized data which feels natural to the user - * whilst in the background this data is being converted into the normalized - * store format. - */ -export interface DataProxy { - /** - * Reads a GraphQL query from the root query id. - */ - readQuery( - options: DataProxy.Query, - optimistic?: boolean, - ): QueryType | null; - - /** - * Reads a GraphQL fragment from any arbitrary id. If there is more than - * one fragment in the provided document then a `fragmentName` must be - * provided to select the correct fragment. - */ - readFragment( - options: DataProxy.Fragment, - optimistic?: boolean, - ): FragmentType | null; - - /** - * Writes a GraphQL query to the root query id. - */ - writeQuery( - options: DataProxy.WriteQueryOptions, - ): void; - - /** - * Writes a GraphQL fragment to any arbitrary id. If there is more than - * one fragment in the provided document then a `fragmentName` must be - * provided to select the correct fragment. - */ - writeFragment( - options: DataProxy.WriteFragmentOptions, - ): void; - - /** - * Sugar for writeQuery & writeFragment. - * Writes data to the store without passing in a query. - * If you supply an id, the data will be written as a fragment to an existing object. - * Otherwise, the data is written to the root of the store. - */ - writeData(options: DataProxy.WriteDataOptions): void; -} diff --git a/node_modules/apollo-cache/src/types/index.ts b/node_modules/apollo-cache/src/types/index.ts deleted file mode 100644 index c44054d6..00000000 --- a/node_modules/apollo-cache/src/types/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './DataProxy'; -export * from './Cache'; diff --git a/node_modules/apollo-cache/src/utils.ts b/node_modules/apollo-cache/src/utils.ts deleted file mode 100644 index 7d88d0b9..00000000 --- a/node_modules/apollo-cache/src/utils.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { - DocumentNode, - OperationDefinitionNode, - SelectionSetNode, - FieldNode, - FragmentDefinitionNode, -} from 'graphql'; - -export function queryFromPojo(obj: any): DocumentNode { - const op: OperationDefinitionNode = { - kind: 'OperationDefinition', - operation: 'query', - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - - const out: DocumentNode = { - kind: 'Document', - definitions: [op], - }; - - return out; -} - -export function fragmentFromPojo(obj: any, typename?: string): DocumentNode { - const frag: FragmentDefinitionNode = { - kind: 'FragmentDefinition', - typeCondition: { - kind: 'NamedType', - name: { - kind: 'Name', - value: typename || '__FakeType', - }, - }, - name: { - kind: 'Name', - value: 'GeneratedClientQuery', - }, - selectionSet: selectionSetFromObj(obj), - }; - - const out: DocumentNode = { - kind: 'Document', - definitions: [frag], - }; - - return out; -} - -function selectionSetFromObj(obj: any): SelectionSetNode { - if ( - typeof obj === 'number' || - typeof obj === 'boolean' || - typeof obj === 'string' || - typeof obj === 'undefined' || - obj === null - ) { - // No selection set here - return null; - } - - if (Array.isArray(obj)) { - // GraphQL queries don't include arrays - return selectionSetFromObj(obj[0]); - } - - // Now we know it's an object - const selections: FieldNode[] = []; - - Object.keys(obj).forEach(key => { - const nestedSelSet: SelectionSetNode = selectionSetFromObj(obj[key]); - - const field: FieldNode = { - kind: 'Field', - name: { - kind: 'Name', - value: key, - }, - selectionSet: nestedSelSet || undefined, - }; - - selections.push(field); - }); - - const selectionSet: SelectionSetNode = { - kind: 'SelectionSet', - selections, - }; - - return selectionSet; -} - -export const justTypenameQuery: DocumentNode = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: null, - variableDefinitions: null, - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: null, - name: { - kind: 'Name', - value: '__typename', - }, - arguments: [], - directives: [], - selectionSet: null, - }, - ], - }, - }, - ], -}; diff --git a/node_modules/apollo-client/ApolloClient.d.ts b/node_modules/apollo-client/ApolloClient.d.ts deleted file mode 100644 index 3e7d0a03..00000000 --- a/node_modules/apollo-client/ApolloClient.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { ApolloLink, FetchResult, GraphQLRequest } from 'apollo-link'; -import { ExecutionResult, DocumentNode } from 'graphql'; -import { ApolloCache, DataProxy } from 'apollo-cache'; -import { QueryManager } from './core/QueryManager'; -import { ApolloQueryResult, OperationVariables, Resolvers } from './core/types'; -import { ObservableQuery } from './core/ObservableQuery'; -import { FragmentMatcher } from './core/LocalState'; -import { Observable } from './util/Observable'; -import { QueryOptions, WatchQueryOptions, SubscriptionOptions, MutationOptions } from './core/watchQueryOptions'; -import { DataStore } from './data/store'; -export interface DefaultOptions { - watchQuery?: Partial; - query?: Partial; - mutate?: Partial; -} -export declare type ApolloClientOptions = { - link?: ApolloLink; - cache: ApolloCache; - ssrForceFetchDelay?: number; - ssrMode?: boolean; - connectToDevTools?: boolean; - queryDeduplication?: boolean; - defaultOptions?: DefaultOptions; - assumeImmutableResults?: boolean; - resolvers?: Resolvers | Resolvers[]; - typeDefs?: string | string[] | DocumentNode | DocumentNode[]; - fragmentMatcher?: FragmentMatcher; - name?: string; - version?: string; -}; -export default class ApolloClient implements DataProxy { - link: ApolloLink; - store: DataStore; - cache: ApolloCache; - readonly queryManager: QueryManager; - disableNetworkFetches: boolean; - version: string; - queryDeduplication: boolean; - defaultOptions: DefaultOptions; - readonly typeDefs: ApolloClientOptions['typeDefs']; - private devToolsHookCb; - private resetStoreCallbacks; - private clearStoreCallbacks; - private localState; - constructor(options: ApolloClientOptions); - stop(): void; - watchQuery(options: WatchQueryOptions): ObservableQuery; - query(options: QueryOptions): Promise>; - mutate(options: MutationOptions): Promise>; - subscribe(options: SubscriptionOptions): Observable>; - readQuery(options: DataProxy.Query, optimistic?: boolean): T | null; - readFragment(options: DataProxy.Fragment, optimistic?: boolean): T | null; - writeQuery(options: DataProxy.WriteQueryOptions): void; - writeFragment(options: DataProxy.WriteFragmentOptions): void; - writeData(options: DataProxy.WriteDataOptions): void; - __actionHookForDevTools(cb: () => any): void; - __requestRaw(payload: GraphQLRequest): Observable; - initQueryManager(): QueryManager; - resetStore(): Promise[] | null>; - clearStore(): Promise; - onResetStore(cb: () => Promise): () => void; - onClearStore(cb: () => Promise): () => void; - reFetchObservableQueries(includeStandby?: boolean): Promise[]>; - extract(optimistic?: boolean): TCacheShape; - restore(serializedState: TCacheShape): ApolloCache; - addResolvers(resolvers: Resolvers | Resolvers[]): void; - setResolvers(resolvers: Resolvers | Resolvers[]): void; - getResolvers(): Resolvers; - setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher): void; -} -//# sourceMappingURL=ApolloClient.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/ApolloClient.d.ts.map b/node_modules/apollo-client/ApolloClient.d.ts.map deleted file mode 100644 index 37f5b9eb..00000000 --- a/node_modules/apollo-client/ApolloClient.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ApolloClient.d.ts","sourceRoot":"","sources":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I,CAAC;IAWtD,UAAU,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAW5B,YAAY,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI;IAYhD,YAAY,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI;IAmBhD,wBAAwB,CAC7B,cAAc,CAAC,EAAE,OAAO,GACvB,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAO7B,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,WAAW;IAW1C,OAAO,CAAC,eAAe,EAAE,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAO/D,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE;IAO/C,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE;IAO/C,YAAY;IAOZ,4BAA4B,CAAC,eAAe,EAAE,eAAe;CAGrE"} \ No newline at end of file diff --git a/node_modules/apollo-client/ApolloClient.js b/node_modules/apollo-client/ApolloClient.js deleted file mode 100644 index eb86d49a..00000000 --- a/node_modules/apollo-client/ApolloClient.js +++ /dev/null @@ -1,219 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var apollo_link_1 = require("apollo-link"); -var ts_invariant_1 = require("ts-invariant"); -var QueryManager_1 = require("./core/QueryManager"); -var LocalState_1 = require("./core/LocalState"); -var store_1 = require("./data/store"); -var version_1 = require("./version"); -var hasSuggestedDevtools = false; -var ApolloClient = (function () { - function ApolloClient(options) { - var _this = this; - this.defaultOptions = {}; - this.resetStoreCallbacks = []; - this.clearStoreCallbacks = []; - var cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, connectToDevTools = options.connectToDevTools, _c = options.queryDeduplication, queryDeduplication = _c === void 0 ? true : _c, defaultOptions = options.defaultOptions, _d = options.assumeImmutableResults, assumeImmutableResults = _d === void 0 ? false : _d, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; - var link = options.link; - if (!link && resolvers) { - link = apollo_link_1.ApolloLink.empty(); - } - if (!link || !cache) { - throw new ts_invariant_1.InvariantError("In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\n" + - "These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\n" + - "For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup"); - } - this.link = link; - this.cache = cache; - this.store = new store_1.DataStore(cache); - this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; - this.queryDeduplication = queryDeduplication; - this.defaultOptions = defaultOptions || {}; - this.typeDefs = typeDefs; - if (ssrForceFetchDelay) { - setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); - } - this.watchQuery = this.watchQuery.bind(this); - this.query = this.query.bind(this); - this.mutate = this.mutate.bind(this); - this.resetStore = this.resetStore.bind(this); - this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); - var defaultConnectToDevTools = process.env.NODE_ENV !== 'production' && - typeof window !== 'undefined' && - !window.__APOLLO_CLIENT__; - if (typeof connectToDevTools === 'undefined' - ? defaultConnectToDevTools - : connectToDevTools && typeof window !== 'undefined') { - window.__APOLLO_CLIENT__ = this; - } - if (!hasSuggestedDevtools && process.env.NODE_ENV !== 'production') { - hasSuggestedDevtools = true; - if (typeof window !== 'undefined' && - window.document && - window.top === window.self) { - if (typeof window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - if (window.navigator && - window.navigator.userAgent && - window.navigator.userAgent.indexOf('Chrome') > -1) { - console.debug('Download the Apollo DevTools ' + - 'for a better development experience: ' + - 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm'); - } - } - } - } - this.version = version_1.version; - this.localState = new LocalState_1.LocalState({ - cache: cache, - client: this, - resolvers: resolvers, - fragmentMatcher: fragmentMatcher, - }); - this.queryManager = new QueryManager_1.QueryManager({ - link: this.link, - store: this.store, - queryDeduplication: queryDeduplication, - ssrMode: ssrMode, - clientAwareness: { - name: clientAwarenessName, - version: clientAwarenessVersion, - }, - localState: this.localState, - assumeImmutableResults: assumeImmutableResults, - onBroadcast: function () { - if (_this.devToolsHookCb) { - _this.devToolsHookCb({ - action: {}, - state: { - queries: _this.queryManager.queryStore.getStore(), - mutations: _this.queryManager.mutationStore.getStore(), - }, - dataWithOptimisticResults: _this.cache.extract(true), - }); - } - }, - }); - } - ApolloClient.prototype.stop = function () { - this.queryManager.stop(); - }; - ApolloClient.prototype.watchQuery = function (options) { - if (this.defaultOptions.watchQuery) { - options = tslib_1.__assign(tslib_1.__assign({}, this.defaultOptions.watchQuery), options); - } - if (this.disableNetworkFetches && - (options.fetchPolicy === 'network-only' || - options.fetchPolicy === 'cache-and-network')) { - options = tslib_1.__assign(tslib_1.__assign({}, options), { fetchPolicy: 'cache-first' }); - } - return this.queryManager.watchQuery(options); - }; - ApolloClient.prototype.query = function (options) { - if (this.defaultOptions.query) { - options = tslib_1.__assign(tslib_1.__assign({}, this.defaultOptions.query), options); - } - ts_invariant_1.invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + - 'client.query can only return a single result. Please use client.watchQuery ' + - 'to receive multiple results from the cache and the network, or consider ' + - 'using a different fetchPolicy, such as cache-first or network-only.'); - if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { - options = tslib_1.__assign(tslib_1.__assign({}, options), { fetchPolicy: 'cache-first' }); - } - return this.queryManager.query(options); - }; - ApolloClient.prototype.mutate = function (options) { - if (this.defaultOptions.mutate) { - options = tslib_1.__assign(tslib_1.__assign({}, this.defaultOptions.mutate), options); - } - return this.queryManager.mutate(options); - }; - ApolloClient.prototype.subscribe = function (options) { - return this.queryManager.startGraphQLSubscription(options); - }; - ApolloClient.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.cache.readQuery(options, optimistic); - }; - ApolloClient.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.cache.readFragment(options, optimistic); - }; - ApolloClient.prototype.writeQuery = function (options) { - var result = this.cache.writeQuery(options); - this.queryManager.broadcastQueries(); - return result; - }; - ApolloClient.prototype.writeFragment = function (options) { - var result = this.cache.writeFragment(options); - this.queryManager.broadcastQueries(); - return result; - }; - ApolloClient.prototype.writeData = function (options) { - var result = this.cache.writeData(options); - this.queryManager.broadcastQueries(); - return result; - }; - ApolloClient.prototype.__actionHookForDevTools = function (cb) { - this.devToolsHookCb = cb; - }; - ApolloClient.prototype.__requestRaw = function (payload) { - return apollo_link_1.execute(this.link, payload); - }; - ApolloClient.prototype.initQueryManager = function () { - ts_invariant_1.invariant.warn('Calling the initQueryManager method is no longer necessary, ' + - 'and it will be removed from ApolloClient in version 3.0.'); - return this.queryManager; - }; - ApolloClient.prototype.resetStore = function () { - var _this = this; - return Promise.resolve() - .then(function () { return _this.queryManager.clearStore(); }) - .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) - .then(function () { return _this.reFetchObservableQueries(); }); - }; - ApolloClient.prototype.clearStore = function () { - var _this = this; - return Promise.resolve() - .then(function () { return _this.queryManager.clearStore(); }) - .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); - }; - ApolloClient.prototype.onResetStore = function (cb) { - var _this = this; - this.resetStoreCallbacks.push(cb); - return function () { - _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); - }; - }; - ApolloClient.prototype.onClearStore = function (cb) { - var _this = this; - this.clearStoreCallbacks.push(cb); - return function () { - _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); - }; - }; - ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { - return this.queryManager.reFetchObservableQueries(includeStandby); - }; - ApolloClient.prototype.extract = function (optimistic) { - return this.cache.extract(optimistic); - }; - ApolloClient.prototype.restore = function (serializedState) { - return this.cache.restore(serializedState); - }; - ApolloClient.prototype.addResolvers = function (resolvers) { - this.localState.addResolvers(resolvers); - }; - ApolloClient.prototype.setResolvers = function (resolvers) { - this.localState.setResolvers(resolvers); - }; - ApolloClient.prototype.getResolvers = function () { - return this.localState.getResolvers(); - }; - ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { - this.localState.setFragmentMatcher(fragmentMatcher); - }; - return ApolloClient; -}()); -exports.default = ApolloClient; -//# sourceMappingURL=ApolloClient.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/ApolloClient.js.map b/node_modules/apollo-client/ApolloClient.js.map deleted file mode 100644 index 1963b99c..00000000 --- a/node_modules/apollo-client/ApolloClient.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ApolloClient.js","sourceRoot":"","sources":["../src/ApolloClient.ts"],"names":[],"mappings":";;;AAAA,2CAKqB;AAIrB,6CAAyD;AAEzD,oDAAmD;AAOnD,gDAAgE;AAWhE,sCAAyC;AAEzC,qCAAoC;AAQpC,IAAI,oBAAoB,GAAG,KAAK,CAAC;AAwBjC;IAkDE,sBAAY,OAAyC;QAArD,iBAqIC;QA/KM,mBAAc,GAAmB,EAAE,CAAC;QAInC,wBAAmB,GAA8B,EAAE,CAAC;QACpD,wBAAmB,GAA8B,EAAE,CAAC;QAuCxD,IAAA,qBAAK,EACL,oBAAe,EAAf,oCAAe,EACf,+BAAsB,EAAtB,2CAAsB,EACtB,6CAAiB,EACjB,+BAAyB,EAAzB,8CAAyB,EACzB,uCAAc,EACd,mCAA8B,EAA9B,mDAA8B,EAC9B,6BAAS,EACT,2BAAQ,EACR,yCAAe,EACf,kCAAyB,EACzB,wCAA+B,CACrB;QAEN,IAAA,mBAAI,CAAa;QAIvB,IAAI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CAAC;IAC1C,CAAC;IAKM,mCAAY,GAAnB,UAAoB,SAAkC;QACpD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAKM,mCAAY,GAAnB;QACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAKM,mDAA4B,GAAnC,UAAoC,eAAgC;QAClE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACtD,CAAC;IACH,mBAAC;AAAD,CAAC,AA3gBD,IA2gBC"} \ No newline at end of file diff --git a/node_modules/apollo-client/LICENSE b/node_modules/apollo-client/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-client/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-client/README.md b/node_modules/apollo-client/README.md deleted file mode 100644 index e41dca64..00000000 --- a/node_modules/apollo-client/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# [Apollo Client](https://www.apollographql.com/client/) [![npm version](https://badge.fury.io/js/apollo-client.svg)](https://badge.fury.io/js/apollo-client) [![Open Source Helpers](https://www.codetriage.com/apollographql/apollo-client/badges/users.svg)](https://www.codetriage.com/apollographql/apollo-client) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/apollo) - -Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components that fetch data via GraphQL. To get the most value out of `apollo-client`, you should use it with one of its view layer integrations. - -To get started with the React integration, go to our [**React Apollo documentation website**](https://www.apollographql.com/docs/react/). - -Apollo Client also has view layer integrations for [all the popular frontend frameworks](#learn-how-to-use-apollo-client-with-your-favorite-framework). For the best experience, make sure to use the view integration layer for your frontend framework of choice. - -Apollo Client can be used in any JavaScript frontend where you want to use data from a GraphQL server. It's: - -1. **Incrementally adoptable**, so that you can drop it into an existing JavaScript app and start using GraphQL for just part of your UI. -2. **Universally compatible**, so that Apollo works with any build setup, any GraphQL server, and any GraphQL schema. -3. **Simple to get started with**, so you can start loading data right away and learn about advanced features later. -4. **Inspectable and understandable**, so that you can have great developer tools to understand exactly what is happening in your app. -5. **Built for interactive apps**, so your users can make changes and see them reflected in the UI immediately. -6. **Small and flexible**, so you don't get stuff you don't need. The core is under 25kb compressed. -7. **Community driven**, because Apollo is driven by the community and serves a variety of use cases. Everything is planned and developed in the open. - -Get started on the [home page](http://apollographql.com/client), which has great examples for a variety of frameworks. - -## Installation - -```bash -# installing the preset package -npm install apollo-boost graphql-tag graphql --save -# installing each piece independently -npm install apollo-client apollo-cache-inmemory apollo-link-http graphql-tag graphql --save -``` - -To use this client in a web browser or mobile app, you'll need a build system capable of loading NPM packages on the client. Some common choices include Browserify, Webpack, and Meteor 1.3+. - -Install the [Apollo Client Developer tools for Chrome](https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm) for a great GraphQL developer experience! - -## Usage - -You get started by constructing an instance of the core class [`ApolloClient`][]. If you load `ApolloClient` from the [`apollo-boost`][] package, it will be configured with a few reasonable defaults such as our standard in-memory cache and a link to a GraphQL API at `/graphql`. - -```js -import ApolloClient from 'apollo-boost'; - -const client = new ApolloClient(); -``` - - -To point `ApolloClient` at a different URL, add your GraphQL API's URL to the `uri` config property: - -```js -import ApolloClient from 'apollo-boost'; - -const client = new ApolloClient({ - uri: 'https://graphql.example.com' -}); -``` - -Most of the time you'll hook up your client to a frontend integration. But if you'd like to directly execute a query with your client, you may now call the `client.query` method like this: - -```js -import gql from 'graphql-tag'; - -client.query({ - query: gql` - query TodoApp { - todos { - id - text - completed - } - } - `, -}) - .then(data => console.log(data)) - .catch(error => console.error(error)); -``` - -Now your client will be primed with some data in its cache. You can continue to make queries, or you can get your `client` instance to perform all sorts of advanced tasks on your GraphQL data. Such as [reactively watching queries with `watchQuery`][], [changing data on your server with `mutate`][], or [reading a fragment from your local cache with `readFragment`][]. - -To learn more about all of the features available to you through the `apollo-client` package, be sure to read through the [**`apollo-client` API reference**](https://www.apollographql.com/docs/react/api/apollo-client.html). - -[`ApolloClient`]: https://www.apollographql.com/docs/react/api/apollo-client.html -[`apollo-boost`]: https://www.apollographql.com/docs/react/essentials/get-started.html#apollo-boost -[reactively watching queries with `watchQuery`]: https://www.apollographql.com/docs/react/api/apollo-client.html#ApolloClient.watchQuery -[changing data on your server with `mutate`]: https://www.apollographql.com/docs/react/essentials/mutations.html -[reading a fragment from your local cache with `readFragment`]: https://www.apollographql.com/docs/react/advanced/caching.html#direct - -## Learn how to use Apollo Client with your favorite framework - -- [React](http://apollographql.com/docs/react/) -- [Angular](http://apollographql.com/docs/angular/) -- [Vue](https://github.com/Akryum/vue-apollo) -- [Ember](https://github.com/bgentry/ember-apollo-client) -- [Web Components](https://github.com/apollo-elements/apollo-elements) -- [Meteor](http://apollographql.com/docs/react/recipes/meteor.html) -- [Blaze](http://github.com/Swydo/blaze-apollo) -- [Vanilla JS](https://www.apollographql.com/docs/react/api/apollo-client.html) -- [Next.js](https://github.com/zeit/next.js/tree/master/examples/with-apollo) - ---- - -## Contributing - -[![CircleCI](https://circleci.com/gh/apollographql/apollo-client.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-client) -[![codecov](https://codecov.io/gh/apollographql/apollo-client/branch/master/graph/badge.svg)](https://codecov.io/gh/apollographql/apollo-client) - -[Read the Apollo Contributor Guidelines.](CONTRIBUTING.md) - -Running tests locally: - -``` -npm install -npm test -``` - -This project uses TypeScript for static typing and TSLint for linting. You can get both of these built into your editor with no configuration by opening this project in [Visual Studio Code](https://code.visualstudio.com/), an open source IDE which is available for free on all platforms. - -#### Important discussions - -If you're getting booted up as a contributor, here are some discussions you should take a look at: - -1. [Static typing and why we went with TypeScript](https://github.com/apollostack/apollo-client/issues/6) also covered in [the Medium post](https://medium.com/apollo-stack/javascript-code-quality-with-free-tools-9a6d80e29f2d#.k32z401au) -1. [Idea for pagination handling](https://github.com/apollostack/apollo-client/issues/26) -1. [Discussion about interaction with Redux and domain vs. client state](https://github.com/apollostack/apollo-client/issues/98) -1. [Long conversation about different client options, before this repo existed](https://github.com/apollostack/apollo/issues/1) - -## Maintainers - -- [@benjamn](https://github.com/benjamn) (Apollo) -- [@hwillson](https://github.com/hwillson) (Apollo) diff --git a/node_modules/apollo-client/bundle.cjs.js b/node_modules/apollo-client/bundle.cjs.js deleted file mode 100644 index b96ca469..00000000 --- a/node_modules/apollo-client/bundle.cjs.js +++ /dev/null @@ -1,2729 +0,0 @@ -exports.__esModule = true; -exports.isApolloError = isApolloError; -exports.ObservableQuery = exports.NetworkStatus = exports.FetchType = exports.ApolloError = exports.ApolloClient = exports.default = void 0; - -var _tslib = require("tslib"); - -var _apolloUtilities = require("apollo-utilities"); - -var _apolloLink = require("apollo-link"); - -var _symbolObservable = _interopRequireDefault(require("symbol-observable")); - -var _tsInvariant = require("ts-invariant"); - -var _visitor = require("graphql/language/visitor"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var NetworkStatus; -exports.NetworkStatus = NetworkStatus; - -(function (NetworkStatus) { - NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; - NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; - NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; - NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; - NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; - NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; - NetworkStatus[NetworkStatus["error"] = 8] = "error"; -})(NetworkStatus || (exports.NetworkStatus = NetworkStatus = {})); - -function isNetworkRequestInFlight(networkStatus) { - return networkStatus < 7; -} - -var Observable = function (_super) { - (0, _tslib.__extends)(Observable, _super); - - function Observable() { - return _super !== null && _super.apply(this, arguments) || this; - } - - Observable.prototype[_symbolObservable.default] = function () { - return this; - }; - - Observable.prototype['@@observable'] = function () { - return this; - }; - - return Observable; -}(_apolloLink.Observable); - -function isNonEmptyArray(value) { - return Array.isArray(value) && value.length > 0; -} - -function isApolloError(err) { - return err.hasOwnProperty('graphQLErrors'); -} - -var generateErrorMessage = function (err) { - var message = ''; - - if (isNonEmptyArray(err.graphQLErrors)) { - err.graphQLErrors.forEach(function (graphQLError) { - var errorMessage = graphQLError ? graphQLError.message : 'Error message not found.'; - message += "GraphQL error: " + errorMessage + "\n"; - }); - } - - if (err.networkError) { - message += 'Network error: ' + err.networkError.message + '\n'; - } - - message = message.replace(/\n$/, ''); - return message; -}; - -var ApolloError = function (_super) { - (0, _tslib.__extends)(ApolloError, _super); - - function ApolloError(_a) { - var graphQLErrors = _a.graphQLErrors, - networkError = _a.networkError, - errorMessage = _a.errorMessage, - extraInfo = _a.extraInfo; - - var _this = _super.call(this, errorMessage) || this; - - _this.graphQLErrors = graphQLErrors || []; - _this.networkError = networkError || null; - - if (!errorMessage) { - _this.message = generateErrorMessage(_this); - } else { - _this.message = errorMessage; - } - - _this.extraInfo = extraInfo; - _this.__proto__ = ApolloError.prototype; - return _this; - } - - return ApolloError; -}(Error); - -exports.ApolloError = ApolloError; -var FetchType; -exports.FetchType = FetchType; - -(function (FetchType) { - FetchType[FetchType["normal"] = 1] = "normal"; - FetchType[FetchType["refetch"] = 2] = "refetch"; - FetchType[FetchType["poll"] = 3] = "poll"; -})(FetchType || (exports.FetchType = FetchType = {})); - -var hasError = function (storeValue, policy) { - if (policy === void 0) { - policy = 'none'; - } - - return storeValue && (storeValue.networkError || policy === 'none' && isNonEmptyArray(storeValue.graphQLErrors)); -}; - -var ObservableQuery = function (_super) { - (0, _tslib.__extends)(ObservableQuery, _super); - - function ObservableQuery(_a) { - var queryManager = _a.queryManager, - options = _a.options, - _b = _a.shouldSubscribe, - shouldSubscribe = _b === void 0 ? true : _b; - - var _this = _super.call(this, function (observer) { - return _this.onSubscribe(observer); - }) || this; - - _this.observers = new Set(); - _this.subscriptions = new Set(); - _this.isTornDown = false; - _this.options = options; - _this.variables = options.variables || {}; - _this.queryId = queryManager.generateQueryId(); - _this.shouldSubscribe = shouldSubscribe; - var opDef = (0, _apolloUtilities.getOperationDefinition)(options.query); - _this.queryName = opDef && opDef.name && opDef.name.value; - _this.queryManager = queryManager; - return _this; - } - - ObservableQuery.prototype.result = function () { - var _this = this; - - return new Promise(function (resolve, reject) { - var observer = { - next: function (result) { - resolve(result); - - _this.observers.delete(observer); - - if (!_this.observers.size) { - _this.queryManager.removeQuery(_this.queryId); - } - - setTimeout(function () { - subscription.unsubscribe(); - }, 0); - }, - error: reject - }; - - var subscription = _this.subscribe(observer); - }); - }; - - ObservableQuery.prototype.currentResult = function () { - var result = this.getCurrentResult(); - - if (result.data === undefined) { - result.data = {}; - } - - return result; - }; - - ObservableQuery.prototype.getCurrentResult = function () { - if (this.isTornDown) { - var lastResult = this.lastResult; - return { - data: !this.lastError && lastResult && lastResult.data || void 0, - error: this.lastError, - loading: false, - networkStatus: NetworkStatus.error - }; - } - - var _a = this.queryManager.getCurrentQueryResult(this), - data = _a.data, - partial = _a.partial; - - var queryStoreValue = this.queryManager.queryStore.get(this.queryId); - var result; - var fetchPolicy = this.options.fetchPolicy; - var isNetworkFetchPolicy = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; - - if (queryStoreValue) { - var networkStatus = queryStoreValue.networkStatus; - - if (hasError(queryStoreValue, this.options.errorPolicy)) { - return { - data: void 0, - loading: false, - networkStatus: networkStatus, - error: new ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError - }) - }; - } - - if (queryStoreValue.variables) { - this.options.variables = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options.variables), queryStoreValue.variables); - this.variables = this.options.variables; - } - - result = { - data: data, - loading: isNetworkRequestInFlight(networkStatus), - networkStatus: networkStatus - }; - - if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') { - result.errors = queryStoreValue.graphQLErrors; - } - } else { - var loading = isNetworkFetchPolicy || partial && fetchPolicy !== 'cache-only'; - result = { - data: data, - loading: loading, - networkStatus: loading ? NetworkStatus.loading : NetworkStatus.ready - }; - } - - if (!partial) { - this.updateLastResult((0, _tslib.__assign)((0, _tslib.__assign)({}, result), { - stale: false - })); - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, result), { - partial: partial - }); - }; - - ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { - var snapshot = this.lastResultSnapshot; - return !(snapshot && newResult && snapshot.networkStatus === newResult.networkStatus && snapshot.stale === newResult.stale && (0, _apolloUtilities.isEqual)(snapshot.data, newResult.data)); - }; - - ObservableQuery.prototype.getLastResult = function () { - return this.lastResult; - }; - - ObservableQuery.prototype.getLastError = function () { - return this.lastError; - }; - - ObservableQuery.prototype.resetLastResults = function () { - delete this.lastResult; - delete this.lastResultSnapshot; - delete this.lastError; - this.isTornDown = false; - }; - - ObservableQuery.prototype.resetQueryStoreErrors = function () { - var queryStore = this.queryManager.queryStore.get(this.queryId); - - if (queryStore) { - queryStore.networkError = null; - queryStore.graphQLErrors = []; - } - }; - - ObservableQuery.prototype.refetch = function (variables) { - var fetchPolicy = this.options.fetchPolicy; - - if (fetchPolicy === 'cache-only') { - return Promise.reject(process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(1) : new _tsInvariant.InvariantError('cache-only fetchPolicy option should not be used together with query refetch.')); - } - - if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'cache-and-network') { - fetchPolicy = 'network-only'; - } - - if (!(0, _apolloUtilities.isEqual)(this.variables, variables)) { - this.variables = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.variables), variables); - } - - if (!(0, _apolloUtilities.isEqual)(this.options.variables, this.variables)) { - this.options.variables = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options.variables), this.variables); - } - - return this.queryManager.fetchQuery(this.queryId, (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options), { - fetchPolicy: fetchPolicy - }), FetchType.refetch); - }; - - ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { - var _this = this; - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fetchMoreOptions.updateQuery, 2) : (0, _tsInvariant.invariant)(fetchMoreOptions.updateQuery, 'updateQuery option is required. This function defines how to update the query data with the new results.'); - var combinedOptions = (0, _tslib.__assign)((0, _tslib.__assign)({}, fetchMoreOptions.query ? fetchMoreOptions : (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, this.options), fetchMoreOptions), { - variables: (0, _tslib.__assign)((0, _tslib.__assign)({}, this.variables), fetchMoreOptions.variables) - })), { - fetchPolicy: 'network-only' - }); - var qid = this.queryManager.generateQueryId(); - return this.queryManager.fetchQuery(qid, combinedOptions, FetchType.normal, this.queryId).then(function (fetchMoreResult) { - _this.updateQuery(function (previousResult) { - return fetchMoreOptions.updateQuery(previousResult, { - fetchMoreResult: fetchMoreResult.data, - variables: combinedOptions.variables - }); - }); - - _this.queryManager.stopQuery(qid); - - return fetchMoreResult; - }, function (error) { - _this.queryManager.stopQuery(qid); - - throw error; - }); - }; - - ObservableQuery.prototype.subscribeToMore = function (options) { - var _this = this; - - var subscription = this.queryManager.startGraphQLSubscription({ - query: options.document, - variables: options.variables - }).subscribe({ - next: function (subscriptionData) { - var updateQuery = options.updateQuery; - - if (updateQuery) { - _this.updateQuery(function (previous, _a) { - var variables = _a.variables; - return updateQuery(previous, { - subscriptionData: subscriptionData, - variables: variables - }); - }); - } - }, - error: function (err) { - if (options.onError) { - options.onError(err); - return; - } - - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('Unhandled GraphQL subscription error', err); - } - }); - this.subscriptions.add(subscription); - return function () { - if (_this.subscriptions.delete(subscription)) { - subscription.unsubscribe(); - } - }; - }; - - ObservableQuery.prototype.setOptions = function (opts) { - var oldFetchPolicy = this.options.fetchPolicy; - this.options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options), opts); - - if (opts.pollInterval) { - this.startPolling(opts.pollInterval); - } else if (opts.pollInterval === 0) { - this.stopPolling(); - } - - var fetchPolicy = opts.fetchPolicy; - return this.setVariables(this.options.variables, oldFetchPolicy !== fetchPolicy && (oldFetchPolicy === 'cache-only' || oldFetchPolicy === 'standby' || fetchPolicy === 'network-only'), opts.fetchResults); - }; - - ObservableQuery.prototype.setVariables = function (variables, tryFetch, fetchResults) { - if (tryFetch === void 0) { - tryFetch = false; - } - - if (fetchResults === void 0) { - fetchResults = true; - } - - this.isTornDown = false; - variables = variables || this.variables; - - if (!tryFetch && (0, _apolloUtilities.isEqual)(variables, this.variables)) { - return this.observers.size && fetchResults ? this.result() : Promise.resolve(); - } - - this.variables = this.options.variables = variables; - - if (!this.observers.size) { - return Promise.resolve(); - } - - return this.queryManager.fetchQuery(this.queryId, this.options); - }; - - ObservableQuery.prototype.updateQuery = function (mapFn) { - var queryManager = this.queryManager; - - var _a = queryManager.getQueryWithPreviousResult(this.queryId), - previousResult = _a.previousResult, - variables = _a.variables, - document = _a.document; - - var newResult = (0, _apolloUtilities.tryFunctionOrLogError)(function () { - return mapFn(previousResult, { - variables: variables - }); - }); - - if (newResult) { - queryManager.dataStore.markUpdateQueryResult(document, variables, newResult); - queryManager.broadcastQueries(); - } - }; - - ObservableQuery.prototype.stopPolling = function () { - this.queryManager.stopPollingQuery(this.queryId); - this.options.pollInterval = undefined; - }; - - ObservableQuery.prototype.startPolling = function (pollInterval) { - assertNotCacheFirstOrOnly(this); - this.options.pollInterval = pollInterval; - this.queryManager.startPollingQuery(this.options, this.queryId); - }; - - ObservableQuery.prototype.updateLastResult = function (newResult) { - var previousResult = this.lastResult; - this.lastResult = newResult; - this.lastResultSnapshot = this.queryManager.assumeImmutableResults ? newResult : (0, _apolloUtilities.cloneDeep)(newResult); - return previousResult; - }; - - ObservableQuery.prototype.onSubscribe = function (observer) { - var _this = this; - - try { - var subObserver = observer._subscription._observer; - - if (subObserver && !subObserver.error) { - subObserver.error = defaultSubscriptionObserverErrorCallback; - } - } catch (_a) {} - - var first = !this.observers.size; - this.observers.add(observer); - if (observer.next && this.lastResult) observer.next(this.lastResult); - if (observer.error && this.lastError) observer.error(this.lastError); - - if (first) { - this.setUpQuery(); - } - - return function () { - if (_this.observers.delete(observer) && !_this.observers.size) { - _this.tearDownQuery(); - } - }; - }; - - ObservableQuery.prototype.setUpQuery = function () { - var _this = this; - - var _a = this, - queryManager = _a.queryManager, - queryId = _a.queryId; - - if (this.shouldSubscribe) { - queryManager.addObservableQuery(queryId, this); - } - - if (this.options.pollInterval) { - assertNotCacheFirstOrOnly(this); - queryManager.startPollingQuery(this.options, queryId); - } - - var onError = function (error) { - _this.updateLastResult((0, _tslib.__assign)((0, _tslib.__assign)({}, _this.lastResult), { - errors: error.graphQLErrors, - networkStatus: NetworkStatus.error, - loading: false - })); - - iterateObserversSafely(_this.observers, 'error', _this.lastError = error); - }; - - queryManager.observeQuery(queryId, this.options, { - next: function (result) { - if (_this.lastError || _this.isDifferentFromLastResult(result)) { - var previousResult_1 = _this.updateLastResult(result); - - var _a = _this.options, - query_1 = _a.query, - variables = _a.variables, - fetchPolicy_1 = _a.fetchPolicy; - - if (queryManager.transform(query_1).hasClientExports) { - queryManager.getLocalState().addExportedVariables(query_1, variables).then(function (variables) { - var previousVariables = _this.variables; - _this.variables = _this.options.variables = variables; - - if (!result.loading && previousResult_1 && fetchPolicy_1 !== 'cache-only' && queryManager.transform(query_1).serverQuery && !(0, _apolloUtilities.isEqual)(previousVariables, variables)) { - _this.refetch(); - } else { - iterateObserversSafely(_this.observers, 'next', result); - } - }); - } else { - iterateObserversSafely(_this.observers, 'next', result); - } - } - }, - error: onError - }).catch(onError); - }; - - ObservableQuery.prototype.tearDownQuery = function () { - var queryManager = this.queryManager; - this.isTornDown = true; - queryManager.stopPollingQuery(this.queryId); - this.subscriptions.forEach(function (sub) { - return sub.unsubscribe(); - }); - this.subscriptions.clear(); - queryManager.removeObservableQuery(this.queryId); - queryManager.stopQuery(this.queryId); - this.observers.clear(); - }; - - return ObservableQuery; -}(Observable); - -exports.ObservableQuery = ObservableQuery; - -function defaultSubscriptionObserverErrorCallback(error) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('Unhandled error', error.message, error.stack); -} - -function iterateObserversSafely(observers, method, argument) { - var observersWithMethod = []; - observers.forEach(function (obs) { - return obs[method] && observersWithMethod.push(obs); - }); - observersWithMethod.forEach(function (obs) { - return obs[method](argument); - }); -} - -function assertNotCacheFirstOrOnly(obsQuery) { - var fetchPolicy = obsQuery.options.fetchPolicy; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 3) : (0, _tsInvariant.invariant)(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.'); -} - -var MutationStore = function () { - function MutationStore() { - this.store = {}; - } - - MutationStore.prototype.getStore = function () { - return this.store; - }; - - MutationStore.prototype.get = function (mutationId) { - return this.store[mutationId]; - }; - - MutationStore.prototype.initMutation = function (mutationId, mutation, variables) { - this.store[mutationId] = { - mutation: mutation, - variables: variables || {}, - loading: true, - error: null - }; - }; - - MutationStore.prototype.markMutationError = function (mutationId, error) { - var mutation = this.store[mutationId]; - - if (mutation) { - mutation.loading = false; - mutation.error = error; - } - }; - - MutationStore.prototype.markMutationResult = function (mutationId) { - var mutation = this.store[mutationId]; - - if (mutation) { - mutation.loading = false; - mutation.error = null; - } - }; - - MutationStore.prototype.reset = function () { - this.store = {}; - }; - - return MutationStore; -}(); - -var QueryStore = function () { - function QueryStore() { - this.store = {}; - } - - QueryStore.prototype.getStore = function () { - return this.store; - }; - - QueryStore.prototype.get = function (queryId) { - return this.store[queryId]; - }; - - QueryStore.prototype.initQuery = function (query) { - var previousQuery = this.store[query.queryId]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!previousQuery || previousQuery.document === query.document || (0, _apolloUtilities.isEqual)(previousQuery.document, query.document), 19) : (0, _tsInvariant.invariant)(!previousQuery || previousQuery.document === query.document || (0, _apolloUtilities.isEqual)(previousQuery.document, query.document), 'Internal Error: may not update existing query string in store'); - var isSetVariables = false; - var previousVariables = null; - - if (query.storePreviousVariables && previousQuery && previousQuery.networkStatus !== NetworkStatus.loading) { - if (!(0, _apolloUtilities.isEqual)(previousQuery.variables, query.variables)) { - isSetVariables = true; - previousVariables = previousQuery.variables; - } - } - - var networkStatus; - - if (isSetVariables) { - networkStatus = NetworkStatus.setVariables; - } else if (query.isPoll) { - networkStatus = NetworkStatus.poll; - } else if (query.isRefetch) { - networkStatus = NetworkStatus.refetch; - } else { - networkStatus = NetworkStatus.loading; - } - - var graphQLErrors = []; - - if (previousQuery && previousQuery.graphQLErrors) { - graphQLErrors = previousQuery.graphQLErrors; - } - - this.store[query.queryId] = { - document: query.document, - variables: query.variables, - previousVariables: previousVariables, - networkError: null, - graphQLErrors: graphQLErrors, - networkStatus: networkStatus, - metadata: query.metadata - }; - - if (typeof query.fetchMoreForQueryId === 'string' && this.store[query.fetchMoreForQueryId]) { - this.store[query.fetchMoreForQueryId].networkStatus = NetworkStatus.fetchMore; - } - }; - - QueryStore.prototype.markQueryResult = function (queryId, result, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) return; - this.store[queryId].networkError = null; - this.store[queryId].graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : []; - this.store[queryId].previousVariables = null; - this.store[queryId].networkStatus = NetworkStatus.ready; - - if (typeof fetchMoreForQueryId === 'string' && this.store[fetchMoreForQueryId]) { - this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready; - } - }; - - QueryStore.prototype.markQueryError = function (queryId, error, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) return; - this.store[queryId].networkError = error; - this.store[queryId].networkStatus = NetworkStatus.error; - - if (typeof fetchMoreForQueryId === 'string') { - this.markQueryResultClient(fetchMoreForQueryId, true); - } - }; - - QueryStore.prototype.markQueryResultClient = function (queryId, complete) { - var storeValue = this.store && this.store[queryId]; - - if (storeValue) { - storeValue.networkError = null; - storeValue.previousVariables = null; - - if (complete) { - storeValue.networkStatus = NetworkStatus.ready; - } - } - }; - - QueryStore.prototype.stopQuery = function (queryId) { - delete this.store[queryId]; - }; - - QueryStore.prototype.reset = function (observableQueryIds) { - var _this = this; - - Object.keys(this.store).forEach(function (queryId) { - if (observableQueryIds.indexOf(queryId) < 0) { - _this.stopQuery(queryId); - } else { - _this.store[queryId].networkStatus = NetworkStatus.loading; - } - }); - }; - - return QueryStore; -}(); - -function capitalizeFirstLetter(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - -var LocalState = function () { - function LocalState(_a) { - var cache = _a.cache, - client = _a.client, - resolvers = _a.resolvers, - fragmentMatcher = _a.fragmentMatcher; - this.cache = cache; - - if (client) { - this.client = client; - } - - if (resolvers) { - this.addResolvers(resolvers); - } - - if (fragmentMatcher) { - this.setFragmentMatcher(fragmentMatcher); - } - } - - LocalState.prototype.addResolvers = function (resolvers) { - var _this = this; - - this.resolvers = this.resolvers || {}; - - if (Array.isArray(resolvers)) { - resolvers.forEach(function (resolverGroup) { - _this.resolvers = (0, _apolloUtilities.mergeDeep)(_this.resolvers, resolverGroup); - }); - } else { - this.resolvers = (0, _apolloUtilities.mergeDeep)(this.resolvers, resolvers); - } - }; - - LocalState.prototype.setResolvers = function (resolvers) { - this.resolvers = {}; - this.addResolvers(resolvers); - }; - - LocalState.prototype.getResolvers = function () { - return this.resolvers || {}; - }; - - LocalState.prototype.runResolvers = function (_a) { - var document = _a.document, - remoteResult = _a.remoteResult, - context = _a.context, - variables = _a.variables, - _b = _a.onlyRunForcedResolvers, - onlyRunForcedResolvers = _b === void 0 ? false : _b; - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - return (0, _tslib.__generator)(this, function (_c) { - if (document) { - return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, remoteResult), { - data: localResult.result - }); - })]; - } - - return [2, remoteResult]; - }); - }); - }; - - LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { - this.fragmentMatcher = fragmentMatcher; - }; - - LocalState.prototype.getFragmentMatcher = function () { - return this.fragmentMatcher; - }; - - LocalState.prototype.clientQuery = function (document) { - if ((0, _apolloUtilities.hasDirectives)(['client'], document)) { - if (this.resolvers) { - return document; - } - - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Found @client directives in a query but no ApolloClient resolvers ' + 'were specified. This means ApolloClient local resolver handling ' + 'has been disabled, and @client directives will be passed through ' + 'to your link chain.'); - } - - return null; - }; - - LocalState.prototype.serverQuery = function (document) { - return this.resolvers ? (0, _apolloUtilities.removeClientSetsFromDocument)(document) : document; - }; - - LocalState.prototype.prepareContext = function (context) { - if (context === void 0) { - context = {}; - } - - var cache = this.cache; - var newContext = (0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - cache: cache, - getCacheKey: function (obj) { - if (cache.config) { - return cache.config.dataIdFromObject(obj); - } else { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(false, 6) : (0, _tsInvariant.invariant)(false, 'To use context.getCacheKey, you need to use a cache that has ' + 'a configurable dataIdFromObject, like apollo-cache-inmemory.'); - } - } - }); - return newContext; - }; - - LocalState.prototype.addExportedVariables = function (document, variables, context) { - if (variables === void 0) { - variables = {}; - } - - if (context === void 0) { - context = {}; - } - - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - return (0, _tslib.__generator)(this, function (_a) { - if (document) { - return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, variables), data.exportedVariables); - })]; - } - - return [2, (0, _tslib.__assign)({}, variables)]; - }); - }); - }; - - LocalState.prototype.shouldForceResolvers = function (document) { - var forceResolvers = false; - (0, _visitor.visit)(document, { - Directive: { - enter: function (node) { - if (node.name.value === 'client' && node.arguments) { - forceResolvers = node.arguments.some(function (arg) { - return arg.name.value === 'always' && arg.value.kind === 'BooleanValue' && arg.value.value === true; - }); - - if (forceResolvers) { - return _visitor.BREAK; - } - } - } - } - }); - return forceResolvers; - }; - - LocalState.prototype.buildRootValueFromCache = function (document, variables) { - return this.cache.diff({ - query: (0, _apolloUtilities.buildQueryFromSelectionSet)(document), - variables: variables, - returnPartialData: true, - optimistic: false - }).result; - }; - - LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { - if (context === void 0) { - context = {}; - } - - if (variables === void 0) { - variables = {}; - } - - if (fragmentMatcher === void 0) { - fragmentMatcher = function () { - return true; - }; - } - - if (onlyRunForcedResolvers === void 0) { - onlyRunForcedResolvers = false; - } - - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; - - return (0, _tslib.__generator)(this, function (_b) { - mainDefinition = (0, _apolloUtilities.getMainDefinition)(document); - fragments = (0, _apolloUtilities.getFragmentDefinitions)(document); - fragmentMap = (0, _apolloUtilities.createFragmentMap)(fragments); - definitionOperation = mainDefinition.operation; - defaultOperationType = definitionOperation ? capitalizeFirstLetter(definitionOperation) : 'Query'; - _a = this, cache = _a.cache, client = _a.client; - execContext = { - fragmentMap: fragmentMap, - context: (0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - cache: cache, - client: client - }), - variables: variables, - fragmentMatcher: fragmentMatcher, - defaultOperationType: defaultOperationType, - exportedVariables: {}, - onlyRunForcedResolvers: onlyRunForcedResolvers - }; - return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { - return { - result: result, - exportedVariables: execContext.exportedVariables - }; - })]; - }); - }); - }; - - LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var fragmentMap, context, variables, resultsToMerge, execute; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_a) { - fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; - resultsToMerge = [rootValue]; - - execute = function (selection) { - return (0, _tslib.__awaiter)(_this, void 0, void 0, function () { - var fragment, typeCondition; - return (0, _tslib.__generator)(this, function (_a) { - if (!(0, _apolloUtilities.shouldInclude)(selection, variables)) { - return [2]; - } - - if ((0, _apolloUtilities.isField)(selection)) { - return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { - var _a; - - if (typeof fieldResult !== 'undefined') { - resultsToMerge.push((_a = {}, _a[(0, _apolloUtilities.resultKeyNameFromField)(selection)] = fieldResult, _a)); - } - })]; - } - - if ((0, _apolloUtilities.isInlineFragment)(selection)) { - fragment = selection; - } else { - fragment = fragmentMap[selection.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 7) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value); - } - - if (fragment && fragment.typeCondition) { - typeCondition = fragment.typeCondition.name.value; - - if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { - return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { - resultsToMerge.push(fragmentResult); - })]; - } - } - - return [2]; - }); - }); - }; - - return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { - return (0, _apolloUtilities.mergeDeepArray)(resultsToMerge); - })]; - }); - }); - }; - - LocalState.prototype.resolveField = function (field, rootValue, execContext) { - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_a) { - variables = execContext.variables; - fieldName = field.name.value; - aliasedFieldName = (0, _apolloUtilities.resultKeyNameFromField)(field); - aliasUsed = fieldName !== aliasedFieldName; - defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; - resultPromise = Promise.resolve(defaultResult); - - if (!execContext.onlyRunForcedResolvers || this.shouldForceResolvers(field)) { - resolverType = rootValue.__typename || execContext.defaultOperationType; - resolverMap = this.resolvers && this.resolvers[resolverType]; - - if (resolverMap) { - resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; - - if (resolve) { - resultPromise = Promise.resolve(resolve(rootValue, (0, _apolloUtilities.argumentsObjectFromField)(field, variables), execContext.context, { - field: field, - fragmentMap: execContext.fragmentMap - })); - } - } - } - - return [2, resultPromise.then(function (result) { - if (result === void 0) { - result = defaultResult; - } - - if (field.directives) { - field.directives.forEach(function (directive) { - if (directive.name.value === 'export' && directive.arguments) { - directive.arguments.forEach(function (arg) { - if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { - execContext.exportedVariables[arg.value.value] = result; - } - }); - } - }); - } - - if (!field.selectionSet) { - return result; - } - - if (result == null) { - return result; - } - - if (Array.isArray(result)) { - return _this.resolveSubSelectedArray(field, result, execContext); - } - - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, result, execContext); - } - })]; - }); - }); - }; - - LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { - var _this = this; - - return Promise.all(result.map(function (item) { - if (item === null) { - return null; - } - - if (Array.isArray(item)) { - return _this.resolveSubSelectedArray(field, item, execContext); - } - - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, item, execContext); - } - })); - }; - - return LocalState; -}(); - -function multiplex(inner) { - var observers = new Set(); - var sub = null; - return new Observable(function (observer) { - observers.add(observer); - sub = sub || inner.subscribe({ - next: function (value) { - observers.forEach(function (obs) { - return obs.next && obs.next(value); - }); - }, - error: function (error) { - observers.forEach(function (obs) { - return obs.error && obs.error(error); - }); - }, - complete: function () { - observers.forEach(function (obs) { - return obs.complete && obs.complete(); - }); - } - }); - return function () { - if (observers.delete(observer) && !observers.size && sub) { - sub.unsubscribe(); - sub = null; - } - }; - }); -} - -function asyncMap(observable, mapFn) { - return new Observable(function (observer) { - var next = observer.next, - error = observer.error, - complete = observer.complete; - var activeNextCount = 0; - var completed = false; - var handler = { - next: function (value) { - ++activeNextCount; - new Promise(function (resolve) { - resolve(mapFn(value)); - }).then(function (result) { - --activeNextCount; - next && next.call(observer, result); - completed && handler.complete(); - }, function (e) { - --activeNextCount; - error && error.call(observer, e); - }); - }, - error: function (e) { - error && error.call(observer, e); - }, - complete: function () { - completed = true; - - if (!activeNextCount) { - complete && complete.call(observer); - } - } - }; - var sub = observable.subscribe(handler); - return function () { - return sub.unsubscribe(); - }; - }); -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -var QueryManager = function () { - function QueryManager(_a) { - var link = _a.link, - _b = _a.queryDeduplication, - queryDeduplication = _b === void 0 ? false : _b, - store = _a.store, - _c = _a.onBroadcast, - onBroadcast = _c === void 0 ? function () { - return undefined; - } : _c, - _d = _a.ssrMode, - ssrMode = _d === void 0 ? false : _d, - _e = _a.clientAwareness, - clientAwareness = _e === void 0 ? {} : _e, - localState = _a.localState, - assumeImmutableResults = _a.assumeImmutableResults; - this.mutationStore = new MutationStore(); - this.queryStore = new QueryStore(); - this.clientAwareness = {}; - this.idCounter = 1; - this.queries = new Map(); - this.fetchQueryRejectFns = new Map(); - this.transformCache = new (_apolloUtilities.canUseWeakMap ? WeakMap : Map)(); - this.inFlightLinkObservables = new Map(); - this.pollingInfoByQueryId = new Map(); - this.link = link; - this.queryDeduplication = queryDeduplication; - this.dataStore = store; - this.onBroadcast = onBroadcast; - this.clientAwareness = clientAwareness; - this.localState = localState || new LocalState({ - cache: store.getCache() - }); - this.ssrMode = ssrMode; - this.assumeImmutableResults = !!assumeImmutableResults; - } - - QueryManager.prototype.stop = function () { - var _this = this; - - this.queries.forEach(function (_info, queryId) { - _this.stopQueryNoBroadcast(queryId); - }); - this.fetchQueryRejectFns.forEach(function (reject) { - reject(process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(8) : new _tsInvariant.InvariantError('QueryManager stopped while query was in flight')); - }); - }; - - QueryManager.prototype.mutate = function (_a) { - var mutation = _a.mutation, - variables = _a.variables, - optimisticResponse = _a.optimisticResponse, - updateQueriesByName = _a.updateQueries, - _b = _a.refetchQueries, - refetchQueries = _b === void 0 ? [] : _b, - _c = _a.awaitRefetchQueries, - awaitRefetchQueries = _c === void 0 ? false : _c, - updateWithProxyFn = _a.update, - _d = _a.errorPolicy, - errorPolicy = _d === void 0 ? 'none' : _d, - fetchPolicy = _a.fetchPolicy, - _e = _a.context, - context = _e === void 0 ? {} : _e; - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var mutationId, generateUpdateQueriesInfo, self; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_f) { - switch (_f.label) { - case 0: - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutation, 9) : (0, _tsInvariant.invariant)(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!fetchPolicy || fetchPolicy === 'no-cache', 10) : (0, _tsInvariant.invariant)(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); - mutationId = this.generateQueryId(); - mutation = this.transform(mutation).document; - this.setQuery(mutationId, function () { - return { - document: mutation - }; - }); - variables = this.getVariables(mutation, variables); - if (!this.transform(mutation).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(mutation, variables, context)]; - - case 1: - variables = _f.sent(); - _f.label = 2; - - case 2: - generateUpdateQueriesInfo = function () { - var ret = {}; - - if (updateQueriesByName) { - _this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - - if (observableQuery) { - var queryName = observableQuery.queryName; - - if (queryName && hasOwnProperty.call(updateQueriesByName, queryName)) { - ret[queryId] = { - updater: updateQueriesByName[queryName], - query: _this.queryStore.get(queryId) - }; - } - } - }); - } - - return ret; - }; - - this.mutationStore.initMutation(mutationId, mutation, variables); - this.dataStore.markMutationInit({ - mutationId: mutationId, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn, - optimisticResponse: optimisticResponse - }); - this.broadcastQueries(); - self = this; - return [2, new Promise(function (resolve, reject) { - var storeResult; - var error; - self.getObservableFromLink(mutation, (0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - optimisticResponse: optimisticResponse - }), variables, false).subscribe({ - next: function (result) { - if ((0, _apolloUtilities.graphQLResultHasError)(result) && errorPolicy === 'none') { - error = new ApolloError({ - graphQLErrors: result.errors - }); - return; - } - - self.mutationStore.markMutationResult(mutationId); - - if (fetchPolicy !== 'no-cache') { - self.dataStore.markMutationResult({ - mutationId: mutationId, - result: result, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn - }); - } - - storeResult = result; - }, - error: function (err) { - self.mutationStore.markMutationError(mutationId, err); - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse - }); - self.broadcastQueries(); - self.setQuery(mutationId, function () { - return { - document: null - }; - }); - reject(new ApolloError({ - networkError: err - })); - }, - complete: function () { - if (error) { - self.mutationStore.markMutationError(mutationId, error); - } - - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse - }); - self.broadcastQueries(); - - if (error) { - reject(error); - return; - } - - if (typeof refetchQueries === 'function') { - refetchQueries = refetchQueries(storeResult); - } - - var refetchQueryPromises = []; - - if (isNonEmptyArray(refetchQueries)) { - refetchQueries.forEach(function (refetchQuery) { - if (typeof refetchQuery === 'string') { - self.queries.forEach(function (_a) { - var observableQuery = _a.observableQuery; - - if (observableQuery && observableQuery.queryName === refetchQuery) { - refetchQueryPromises.push(observableQuery.refetch()); - } - }); - } else { - var queryOptions = { - query: refetchQuery.query, - variables: refetchQuery.variables, - fetchPolicy: 'network-only' - }; - - if (refetchQuery.context) { - queryOptions.context = refetchQuery.context; - } - - refetchQueryPromises.push(self.query(queryOptions)); - } - }); - } - - Promise.all(awaitRefetchQueries ? refetchQueryPromises : []).then(function () { - self.setQuery(mutationId, function () { - return { - document: null - }; - }); - - if (errorPolicy === 'ignore' && storeResult && (0, _apolloUtilities.graphQLResultHasError)(storeResult)) { - delete storeResult.errors; - } - - resolve(storeResult); - }); - } - }); - })]; - } - }); - }); - }; - - QueryManager.prototype.fetchQuery = function (queryId, options, fetchType, fetchMoreForQueryId) { - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var _a, metadata, _b, fetchPolicy, _c, context, query, variables, storeResult, isNetworkOnly, needToFetch, _d, complete, result, shouldFetch, requestId, cancel, networkResult; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_e) { - switch (_e.label) { - case 0: - _a = options.metadata, metadata = _a === void 0 ? null : _a, _b = options.fetchPolicy, fetchPolicy = _b === void 0 ? 'cache-first' : _b, _c = options.context, context = _c === void 0 ? {} : _c; - query = this.transform(options.query).document; - variables = this.getVariables(query, options.variables); - if (!this.transform(query).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(query, variables, context)]; - - case 1: - variables = _e.sent(); - _e.label = 2; - - case 2: - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - variables: variables - }); - isNetworkOnly = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; - needToFetch = isNetworkOnly; - - if (!isNetworkOnly) { - _d = this.dataStore.getCache().diff({ - query: query, - variables: variables, - returnPartialData: true, - optimistic: false - }), complete = _d.complete, result = _d.result; - needToFetch = !complete || fetchPolicy === 'cache-and-network'; - storeResult = result; - } - - shouldFetch = needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby'; - if ((0, _apolloUtilities.hasDirectives)(['live'], query)) shouldFetch = true; - requestId = this.idCounter++; - cancel = fetchPolicy !== 'no-cache' ? this.updateQueryWatch(queryId, query, options) : undefined; - this.setQuery(queryId, function () { - return { - document: query, - lastRequestId: requestId, - invalidated: true, - cancel: cancel - }; - }); - this.invalidate(fetchMoreForQueryId); - this.queryStore.initQuery({ - queryId: queryId, - document: query, - storePreviousVariables: shouldFetch, - variables: variables, - isPoll: fetchType === FetchType.poll, - isRefetch: fetchType === FetchType.refetch, - metadata: metadata, - fetchMoreForQueryId: fetchMoreForQueryId - }); - this.broadcastQueries(); - - if (shouldFetch) { - networkResult = this.fetchRequest({ - requestId: requestId, - queryId: queryId, - document: query, - options: options, - fetchMoreForQueryId: fetchMoreForQueryId - }).catch(function (error) { - if (isApolloError(error)) { - throw error; - } else { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId); - - _this.invalidate(queryId); - - _this.invalidate(fetchMoreForQueryId); - - _this.broadcastQueries(); - } - - throw new ApolloError({ - networkError: error - }); - } - }); - - if (fetchPolicy !== 'cache-and-network') { - return [2, networkResult]; - } - - networkResult.catch(function () {}); - } - - this.queryStore.markQueryResultClient(queryId, !shouldFetch); - this.invalidate(queryId); - this.invalidate(fetchMoreForQueryId); - - if (this.transform(query).hasForcedResolvers) { - return [2, this.localState.runResolvers({ - document: query, - remoteResult: { - data: storeResult - }, - context: context, - variables: variables, - onlyRunForcedResolvers: true - }).then(function (result) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - - _this.broadcastQueries(); - - return result; - })]; - } - - this.broadcastQueries(); - return [2, { - data: storeResult - }]; - } - }); - }); - }; - - QueryManager.prototype.markQueryResult = function (queryId, result, _a, fetchMoreForQueryId) { - var fetchPolicy = _a.fetchPolicy, - variables = _a.variables, - errorPolicy = _a.errorPolicy; - - if (fetchPolicy === 'no-cache') { - this.setQuery(queryId, function () { - return { - newData: { - result: result.data, - complete: true - } - }; - }); - } else { - this.dataStore.markQueryResult(result, this.getQuery(queryId).document, variables, fetchMoreForQueryId, errorPolicy === 'ignore' || errorPolicy === 'all'); - } - }; - - QueryManager.prototype.queryListenerForObserver = function (queryId, options, observer) { - var _this = this; - - function invoke(method, argument) { - if (observer[method]) { - try { - observer[method](argument); - } catch (e) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error(e); - } - } else if (method === 'error') { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error(argument); - } - } - - return function (queryStoreValue, newData) { - _this.invalidate(queryId, false); - - if (!queryStoreValue) return; - - var _a = _this.getQuery(queryId), - observableQuery = _a.observableQuery, - document = _a.document; - - var fetchPolicy = observableQuery ? observableQuery.options.fetchPolicy : options.fetchPolicy; - if (fetchPolicy === 'standby') return; - var loading = isNetworkRequestInFlight(queryStoreValue.networkStatus); - var lastResult = observableQuery && observableQuery.getLastResult(); - var networkStatusChanged = !!(lastResult && lastResult.networkStatus !== queryStoreValue.networkStatus); - var shouldNotifyIfLoading = options.returnPartialData || !newData && queryStoreValue.previousVariables || networkStatusChanged && options.notifyOnNetworkStatusChange || fetchPolicy === 'cache-only' || fetchPolicy === 'cache-and-network'; - - if (loading && !shouldNotifyIfLoading) { - return; - } - - var hasGraphQLErrors = isNonEmptyArray(queryStoreValue.graphQLErrors); - var errorPolicy = observableQuery && observableQuery.options.errorPolicy || options.errorPolicy || 'none'; - - if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) { - return invoke('error', new ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError - })); - } - - try { - var data = void 0; - var isMissing = void 0; - - if (newData) { - if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') { - _this.setQuery(queryId, function () { - return { - newData: null - }; - }); - } - - data = newData.result; - isMissing = !newData.complete; - } else { - var lastError = observableQuery && observableQuery.getLastError(); - var errorStatusChanged = errorPolicy !== 'none' && (lastError && lastError.graphQLErrors) !== queryStoreValue.graphQLErrors; - - if (lastResult && lastResult.data && !errorStatusChanged) { - data = lastResult.data; - isMissing = false; - } else { - var diffResult = _this.dataStore.getCache().diff({ - query: document, - variables: queryStoreValue.previousVariables || queryStoreValue.variables, - returnPartialData: true, - optimistic: true - }); - - data = diffResult.result; - isMissing = !diffResult.complete; - } - } - - var stale = isMissing && !(options.returnPartialData || fetchPolicy === 'cache-only'); - var resultFromStore = { - data: stale ? lastResult && lastResult.data : data, - loading: loading, - networkStatus: queryStoreValue.networkStatus, - stale: stale - }; - - if (errorPolicy === 'all' && hasGraphQLErrors) { - resultFromStore.errors = queryStoreValue.graphQLErrors; - } - - invoke('next', resultFromStore); - } catch (networkError) { - invoke('error', new ApolloError({ - networkError: networkError - })); - } - }; - }; - - QueryManager.prototype.transform = function (document) { - var transformCache = this.transformCache; - - if (!transformCache.has(document)) { - var cache = this.dataStore.getCache(); - var transformed = cache.transformDocument(document); - var forLink = (0, _apolloUtilities.removeConnectionDirectiveFromDocument)(cache.transformForLink(transformed)); - var clientQuery = this.localState.clientQuery(transformed); - var serverQuery = this.localState.serverQuery(forLink); - var cacheEntry_1 = { - document: transformed, - hasClientExports: (0, _apolloUtilities.hasClientExports)(transformed), - hasForcedResolvers: this.localState.shouldForceResolvers(transformed), - clientQuery: clientQuery, - serverQuery: serverQuery, - defaultVars: (0, _apolloUtilities.getDefaultValues)((0, _apolloUtilities.getOperationDefinition)(transformed)) - }; - - var add = function (doc) { - if (doc && !transformCache.has(doc)) { - transformCache.set(doc, cacheEntry_1); - } - }; - - add(document); - add(transformed); - add(clientQuery); - add(serverQuery); - } - - return transformCache.get(document); - }; - - QueryManager.prototype.getVariables = function (document, variables) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, this.transform(document).defaultVars), variables); - }; - - QueryManager.prototype.watchQuery = function (options, shouldSubscribe) { - if (shouldSubscribe === void 0) { - shouldSubscribe = true; - } - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.fetchPolicy !== 'standby', 11) : (0, _tsInvariant.invariant)(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); - options.variables = this.getVariables(options.query, options.variables); - - if (typeof options.notifyOnNetworkStatusChange === 'undefined') { - options.notifyOnNetworkStatusChange = false; - } - - var transformedOptions = (0, _tslib.__assign)({}, options); - return new ObservableQuery({ - queryManager: this, - options: transformedOptions, - shouldSubscribe: shouldSubscribe - }); - }; - - QueryManager.prototype.query = function (options) { - var _this = this; - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.query, 12) : (0, _tsInvariant.invariant)(options.query, 'query option is required. You must specify your GraphQL document ' + 'in the query option.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.query.kind === 'Document', 13) : (0, _tsInvariant.invariant)(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!options.returnPartialData, 14) : (0, _tsInvariant.invariant)(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!options.pollInterval, 15) : (0, _tsInvariant.invariant)(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); - return new Promise(function (resolve, reject) { - var watchedQuery = _this.watchQuery(options, false); - - _this.fetchQueryRejectFns.set("query:" + watchedQuery.queryId, reject); - - watchedQuery.result().then(resolve, reject).then(function () { - return _this.fetchQueryRejectFns.delete("query:" + watchedQuery.queryId); - }); - }); - }; - - QueryManager.prototype.generateQueryId = function () { - return String(this.idCounter++); - }; - - QueryManager.prototype.stopQueryInStore = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.broadcastQueries(); - }; - - QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { - this.stopPollingQuery(queryId); - this.queryStore.stopQuery(queryId); - this.invalidate(queryId); - }; - - QueryManager.prototype.addQueryListener = function (queryId, listener) { - this.setQuery(queryId, function (_a) { - var listeners = _a.listeners; - listeners.add(listener); - return { - invalidated: false - }; - }); - }; - - QueryManager.prototype.updateQueryWatch = function (queryId, document, options) { - var _this = this; - - var cancel = this.getQuery(queryId).cancel; - if (cancel) cancel(); - - var previousResult = function () { - var previousResult = null; - - var observableQuery = _this.getQuery(queryId).observableQuery; - - if (observableQuery) { - var lastResult = observableQuery.getLastResult(); - - if (lastResult) { - previousResult = lastResult.data; - } - } - - return previousResult; - }; - - return this.dataStore.getCache().watch({ - query: document, - variables: options.variables, - optimistic: true, - previousResult: previousResult, - callback: function (newData) { - _this.setQuery(queryId, function () { - return { - invalidated: true, - newData: newData - }; - }); - } - }); - }; - - QueryManager.prototype.addObservableQuery = function (queryId, observableQuery) { - this.setQuery(queryId, function () { - return { - observableQuery: observableQuery - }; - }); - }; - - QueryManager.prototype.removeObservableQuery = function (queryId) { - var cancel = this.getQuery(queryId).cancel; - this.setQuery(queryId, function () { - return { - observableQuery: null - }; - }); - if (cancel) cancel(); - }; - - QueryManager.prototype.clearStore = function () { - this.fetchQueryRejectFns.forEach(function (reject) { - reject(process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(16) : new _tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)')); - }); - var resetIds = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) resetIds.push(queryId); - }); - this.queryStore.reset(resetIds); - this.mutationStore.reset(); - return this.dataStore.reset(); - }; - - QueryManager.prototype.resetStore = function () { - var _this = this; - - return this.clearStore().then(function () { - return _this.reFetchObservableQueries(); - }); - }; - - QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { - var _this = this; - - if (includeStandby === void 0) { - includeStandby = false; - } - - var observableQueryPromises = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - - if (observableQuery) { - var fetchPolicy = observableQuery.options.fetchPolicy; - observableQuery.resetLastResults(); - - if (fetchPolicy !== 'cache-only' && (includeStandby || fetchPolicy !== 'standby')) { - observableQueryPromises.push(observableQuery.refetch()); - } - - _this.setQuery(queryId, function () { - return { - newData: null - }; - }); - - _this.invalidate(queryId); - } - }); - this.broadcastQueries(); - return Promise.all(observableQueryPromises); - }; - - QueryManager.prototype.observeQuery = function (queryId, options, observer) { - this.addQueryListener(queryId, this.queryListenerForObserver(queryId, options, observer)); - return this.fetchQuery(queryId, options); - }; - - QueryManager.prototype.startQuery = function (queryId, options, listener) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("The QueryManager.startQuery method has been deprecated"); - this.addQueryListener(queryId, listener); - this.fetchQuery(queryId, options).catch(function () { - return undefined; - }); - return queryId; - }; - - QueryManager.prototype.startGraphQLSubscription = function (_a) { - var _this = this; - - var query = _a.query, - fetchPolicy = _a.fetchPolicy, - variables = _a.variables; - query = this.transform(query).document; - variables = this.getVariables(query, variables); - - var makeObservable = function (variables) { - return _this.getObservableFromLink(query, {}, variables, false).map(function (result) { - if (!fetchPolicy || fetchPolicy !== 'no-cache') { - _this.dataStore.markSubscriptionResult(result, query, variables); - - _this.broadcastQueries(); - } - - if ((0, _apolloUtilities.graphQLResultHasError)(result)) { - throw new ApolloError({ - graphQLErrors: result.errors - }); - } - - return result; - }); - }; - - if (this.transform(query).hasClientExports) { - var observablePromise_1 = this.localState.addExportedVariables(query, variables).then(makeObservable); - return new Observable(function (observer) { - var sub = null; - observablePromise_1.then(function (observable) { - return sub = observable.subscribe(observer); - }, observer.error); - return function () { - return sub && sub.unsubscribe(); - }; - }); - } - - return makeObservable(variables); - }; - - QueryManager.prototype.stopQuery = function (queryId) { - this.stopQueryNoBroadcast(queryId); - this.broadcastQueries(); - }; - - QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.removeQuery(queryId); - }; - - QueryManager.prototype.removeQuery = function (queryId) { - this.fetchQueryRejectFns.delete("query:" + queryId); - this.fetchQueryRejectFns.delete("fetchRequest:" + queryId); - this.getQuery(queryId).subscriptions.forEach(function (x) { - return x.unsubscribe(); - }); - this.queries.delete(queryId); - }; - - QueryManager.prototype.getCurrentQueryResult = function (observableQuery, optimistic) { - if (optimistic === void 0) { - optimistic = true; - } - - var _a = observableQuery.options, - variables = _a.variables, - query = _a.query, - fetchPolicy = _a.fetchPolicy, - returnPartialData = _a.returnPartialData; - var lastResult = observableQuery.getLastResult(); - var newData = this.getQuery(observableQuery.queryId).newData; - - if (newData && newData.complete) { - return { - data: newData.result, - partial: false - }; - } - - if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') { - return { - data: undefined, - partial: false - }; - } - - var _b = this.dataStore.getCache().diff({ - query: query, - variables: variables, - previousResult: lastResult ? lastResult.data : undefined, - returnPartialData: true, - optimistic: optimistic - }), - result = _b.result, - complete = _b.complete; - - return { - data: complete || returnPartialData ? result : void 0, - partial: !complete - }; - }; - - QueryManager.prototype.getQueryWithPreviousResult = function (queryIdOrObservable) { - var observableQuery; - - if (typeof queryIdOrObservable === 'string') { - var foundObserveableQuery = this.getQuery(queryIdOrObservable).observableQuery; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(foundObserveableQuery, 17) : (0, _tsInvariant.invariant)(foundObserveableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); - observableQuery = foundObserveableQuery; - } else { - observableQuery = queryIdOrObservable; - } - - var _a = observableQuery.options, - variables = _a.variables, - query = _a.query; - return { - previousResult: this.getCurrentQueryResult(observableQuery, false).data, - variables: variables, - document: query - }; - }; - - QueryManager.prototype.broadcastQueries = function () { - var _this = this; - - this.onBroadcast(); - this.queries.forEach(function (info, id) { - if (info.invalidated) { - info.listeners.forEach(function (listener) { - if (listener) { - listener(_this.queryStore.get(id), info.newData); - } - }); - } - }); - }; - - QueryManager.prototype.getLocalState = function () { - return this.localState; - }; - - QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { - var _this = this; - - if (deduplication === void 0) { - deduplication = this.queryDeduplication; - } - - var observable; - var serverQuery = this.transform(query).serverQuery; - - if (serverQuery) { - var _a = this, - inFlightLinkObservables_1 = _a.inFlightLinkObservables, - link = _a.link; - - var operation = { - query: serverQuery, - variables: variables, - operationName: (0, _apolloUtilities.getOperationName)(serverQuery) || void 0, - context: this.prepareContext((0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - forceFetch: !deduplication - })) - }; - context = operation.context; - - if (deduplication) { - var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); - inFlightLinkObservables_1.set(serverQuery, byVariables_1); - var varJson_1 = JSON.stringify(variables); - observable = byVariables_1.get(varJson_1); - - if (!observable) { - byVariables_1.set(varJson_1, observable = multiplex((0, _apolloLink.execute)(link, operation))); - - var cleanup = function () { - byVariables_1.delete(varJson_1); - if (!byVariables_1.size) inFlightLinkObservables_1.delete(serverQuery); - cleanupSub_1.unsubscribe(); - }; - - var cleanupSub_1 = observable.subscribe({ - next: cleanup, - error: cleanup, - complete: cleanup - }); - } - } else { - observable = multiplex((0, _apolloLink.execute)(link, operation)); - } - } else { - observable = Observable.of({ - data: {} - }); - context = this.prepareContext(context); - } - - var clientQuery = this.transform(query).clientQuery; - - if (clientQuery) { - observable = asyncMap(observable, function (result) { - return _this.localState.runResolvers({ - document: clientQuery, - remoteResult: result, - context: context, - variables: variables - }); - }); - } - - return observable; - }; - - QueryManager.prototype.fetchRequest = function (_a) { - var _this = this; - - var requestId = _a.requestId, - queryId = _a.queryId, - document = _a.document, - options = _a.options, - fetchMoreForQueryId = _a.fetchMoreForQueryId; - var variables = options.variables, - _b = options.errorPolicy, - errorPolicy = _b === void 0 ? 'none' : _b, - fetchPolicy = options.fetchPolicy; - var resultFromStore; - var errorsFromStore; - return new Promise(function (resolve, reject) { - var observable = _this.getObservableFromLink(document, options.context, variables); - - var fqrfId = "fetchRequest:" + queryId; - - _this.fetchQueryRejectFns.set(fqrfId, reject); - - var cleanup = function () { - _this.fetchQueryRejectFns.delete(fqrfId); - - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.delete(subscription); - }); - }; - - var subscription = observable.map(function (result) { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - - _this.queryStore.markQueryResult(queryId, result, fetchMoreForQueryId); - - _this.invalidate(queryId); - - _this.invalidate(fetchMoreForQueryId); - - _this.broadcastQueries(); - } - - if (errorPolicy === 'none' && isNonEmptyArray(result.errors)) { - return reject(new ApolloError({ - graphQLErrors: result.errors - })); - } - - if (errorPolicy === 'all') { - errorsFromStore = result.errors; - } - - if (fetchMoreForQueryId || fetchPolicy === 'no-cache') { - resultFromStore = result.data; - } else { - var _a = _this.dataStore.getCache().diff({ - variables: variables, - query: document, - optimistic: false, - returnPartialData: true - }), - result_1 = _a.result, - complete = _a.complete; - - if (complete || options.returnPartialData) { - resultFromStore = result_1; - } - } - }).subscribe({ - error: function (error) { - cleanup(); - reject(error); - }, - complete: function () { - cleanup(); - resolve({ - data: resultFromStore, - errors: errorsFromStore, - loading: false, - networkStatus: NetworkStatus.ready, - stale: false - }); - } - }); - - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.add(subscription); - }); - }); - }; - - QueryManager.prototype.getQuery = function (queryId) { - return this.queries.get(queryId) || { - listeners: new Set(), - invalidated: false, - document: null, - newData: null, - lastRequestId: 1, - observableQuery: null, - subscriptions: new Set() - }; - }; - - QueryManager.prototype.setQuery = function (queryId, updater) { - var prev = this.getQuery(queryId); - var newInfo = (0, _tslib.__assign)((0, _tslib.__assign)({}, prev), updater(prev)); - this.queries.set(queryId, newInfo); - }; - - QueryManager.prototype.invalidate = function (queryId, invalidated) { - if (invalidated === void 0) { - invalidated = true; - } - - if (queryId) { - this.setQuery(queryId, function () { - return { - invalidated: invalidated - }; - }); - } - }; - - QueryManager.prototype.prepareContext = function (context) { - if (context === void 0) { - context = {}; - } - - var newContext = this.localState.prepareContext(context); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, newContext), { - clientAwareness: this.clientAwareness - }); - }; - - QueryManager.prototype.checkInFlight = function (queryId) { - var query = this.queryStore.get(queryId); - return query && query.networkStatus !== NetworkStatus.ready && query.networkStatus !== NetworkStatus.error; - }; - - QueryManager.prototype.startPollingQuery = function (options, queryId, listener) { - var _this = this; - - var pollInterval = options.pollInterval; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(pollInterval, 18) : (0, _tsInvariant.invariant)(pollInterval, 'Attempted to start a polling query without a polling interval.'); - - if (!this.ssrMode) { - var info = this.pollingInfoByQueryId.get(queryId); - - if (!info) { - this.pollingInfoByQueryId.set(queryId, info = {}); - } - - info.interval = pollInterval; - info.options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - fetchPolicy: 'network-only' - }); - - var maybeFetch_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - - if (info) { - if (_this.checkInFlight(queryId)) { - poll_1(); - } else { - _this.fetchQuery(queryId, info.options, FetchType.poll).then(poll_1, poll_1); - } - } - }; - - var poll_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - - if (info) { - clearTimeout(info.timeout); - info.timeout = setTimeout(maybeFetch_1, info.interval); - } - }; - - if (listener) { - this.addQueryListener(queryId, listener); - } - - poll_1(); - } - - return queryId; - }; - - QueryManager.prototype.stopPollingQuery = function (queryId) { - this.pollingInfoByQueryId.delete(queryId); - }; - - return QueryManager; -}(); - -var DataStore = function () { - function DataStore(initialCache) { - this.cache = initialCache; - } - - DataStore.prototype.getCache = function () { - return this.cache; - }; - - DataStore.prototype.markQueryResult = function (result, document, variables, fetchMoreForQueryId, ignoreErrors) { - if (ignoreErrors === void 0) { - ignoreErrors = false; - } - - var writeWithErrors = !(0, _apolloUtilities.graphQLResultHasError)(result); - - if (ignoreErrors && (0, _apolloUtilities.graphQLResultHasError)(result) && result.data) { - writeWithErrors = true; - } - - if (!fetchMoreForQueryId && writeWithErrors) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_QUERY', - query: document, - variables: variables - }); - } - }; - - DataStore.prototype.markSubscriptionResult = function (result, document, variables) { - if (!(0, _apolloUtilities.graphQLResultHasError)(result)) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_SUBSCRIPTION', - query: document, - variables: variables - }); - } - }; - - DataStore.prototype.markMutationInit = function (mutation) { - var _this = this; - - if (mutation.optimisticResponse) { - var optimistic_1; - - if (typeof mutation.optimisticResponse === 'function') { - optimistic_1 = mutation.optimisticResponse(mutation.variables); - } else { - optimistic_1 = mutation.optimisticResponse; - } - - this.cache.recordOptimisticTransaction(function (c) { - var orig = _this.cache; - _this.cache = c; - - try { - _this.markMutationResult({ - mutationId: mutation.mutationId, - result: { - data: optimistic_1 - }, - document: mutation.document, - variables: mutation.variables, - updateQueries: mutation.updateQueries, - update: mutation.update - }); - } finally { - _this.cache = orig; - } - }, mutation.mutationId); - } - }; - - DataStore.prototype.markMutationResult = function (mutation) { - var _this = this; - - if (!(0, _apolloUtilities.graphQLResultHasError)(mutation.result)) { - var cacheWrites_1 = [{ - result: mutation.result.data, - dataId: 'ROOT_MUTATION', - query: mutation.document, - variables: mutation.variables - }]; - var updateQueries_1 = mutation.updateQueries; - - if (updateQueries_1) { - Object.keys(updateQueries_1).forEach(function (id) { - var _a = updateQueries_1[id], - query = _a.query, - updater = _a.updater; - - var _b = _this.cache.diff({ - query: query.document, - variables: query.variables, - returnPartialData: true, - optimistic: false - }), - currentQueryResult = _b.result, - complete = _b.complete; - - if (complete) { - var nextQueryResult = (0, _apolloUtilities.tryFunctionOrLogError)(function () { - return updater(currentQueryResult, { - mutationResult: mutation.result, - queryName: (0, _apolloUtilities.getOperationName)(query.document) || undefined, - queryVariables: query.variables - }); - }); - - if (nextQueryResult) { - cacheWrites_1.push({ - result: nextQueryResult, - dataId: 'ROOT_QUERY', - query: query.document, - variables: query.variables - }); - } - } - }); - } - - this.cache.performTransaction(function (c) { - cacheWrites_1.forEach(function (write) { - return c.write(write); - }); - var update = mutation.update; - - if (update) { - (0, _apolloUtilities.tryFunctionOrLogError)(function () { - return update(c, mutation.result); - }); - } - }); - } - }; - - DataStore.prototype.markMutationComplete = function (_a) { - var mutationId = _a.mutationId, - optimisticResponse = _a.optimisticResponse; - - if (optimisticResponse) { - this.cache.removeOptimistic(mutationId); - } - }; - - DataStore.prototype.markUpdateQueryResult = function (document, variables, newResult) { - this.cache.write({ - result: newResult, - dataId: 'ROOT_QUERY', - variables: variables, - query: document - }); - }; - - DataStore.prototype.reset = function () { - return this.cache.reset(); - }; - - return DataStore; -}(); - -var version = "2.6.10"; -var hasSuggestedDevtools = false; - -var ApolloClient = function () { - function ApolloClient(options) { - var _this = this; - - this.defaultOptions = {}; - this.resetStoreCallbacks = []; - this.clearStoreCallbacks = []; - var cache = options.cache, - _a = options.ssrMode, - ssrMode = _a === void 0 ? false : _a, - _b = options.ssrForceFetchDelay, - ssrForceFetchDelay = _b === void 0 ? 0 : _b, - connectToDevTools = options.connectToDevTools, - _c = options.queryDeduplication, - queryDeduplication = _c === void 0 ? true : _c, - defaultOptions = options.defaultOptions, - _d = options.assumeImmutableResults, - assumeImmutableResults = _d === void 0 ? false : _d, - resolvers = options.resolvers, - typeDefs = options.typeDefs, - fragmentMatcher = options.fragmentMatcher, - clientAwarenessName = options.name, - clientAwarenessVersion = options.version; - var link = options.link; - - if (!link && resolvers) { - link = _apolloLink.ApolloLink.empty(); - } - - if (!link || !cache) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(4) : new _tsInvariant.InvariantError("In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\n" + "These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\n" + "For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup"); - } - - this.link = link; - this.cache = cache; - this.store = new DataStore(cache); - this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; - this.queryDeduplication = queryDeduplication; - this.defaultOptions = defaultOptions || {}; - this.typeDefs = typeDefs; - - if (ssrForceFetchDelay) { - setTimeout(function () { - return _this.disableNetworkFetches = false; - }, ssrForceFetchDelay); - } - - this.watchQuery = this.watchQuery.bind(this); - this.query = this.query.bind(this); - this.mutate = this.mutate.bind(this); - this.resetStore = this.resetStore.bind(this); - this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); - var defaultConnectToDevTools = process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && !window.__APOLLO_CLIENT__; - - if (typeof connectToDevTools === 'undefined' ? defaultConnectToDevTools : connectToDevTools && typeof window !== 'undefined') { - window.__APOLLO_CLIENT__ = this; - } - - if (!hasSuggestedDevtools && process.env.NODE_ENV !== 'production') { - hasSuggestedDevtools = true; - - if (typeof window !== 'undefined' && window.document && window.top === window.self) { - if (typeof window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - if (window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf('Chrome') > -1) { - console.debug('Download the Apollo DevTools ' + 'for a better development experience: ' + 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm'); - } - } - } - } - - this.version = version; - this.localState = new LocalState({ - cache: cache, - client: this, - resolvers: resolvers, - fragmentMatcher: fragmentMatcher - }); - this.queryManager = new QueryManager({ - link: this.link, - store: this.store, - queryDeduplication: queryDeduplication, - ssrMode: ssrMode, - clientAwareness: { - name: clientAwarenessName, - version: clientAwarenessVersion - }, - localState: this.localState, - assumeImmutableResults: assumeImmutableResults, - onBroadcast: function () { - if (_this.devToolsHookCb) { - _this.devToolsHookCb({ - action: {}, - state: { - queries: _this.queryManager.queryStore.getStore(), - mutations: _this.queryManager.mutationStore.getStore() - }, - dataWithOptimisticResults: _this.cache.extract(true) - }); - } - } - }); - } - - ApolloClient.prototype.stop = function () { - this.queryManager.stop(); - }; - - ApolloClient.prototype.watchQuery = function (options) { - if (this.defaultOptions.watchQuery) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.defaultOptions.watchQuery), options); - } - - if (this.disableNetworkFetches && (options.fetchPolicy === 'network-only' || options.fetchPolicy === 'cache-and-network')) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - fetchPolicy: 'cache-first' - }); - } - - return this.queryManager.watchQuery(options); - }; - - ApolloClient.prototype.query = function (options) { - if (this.defaultOptions.query) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.defaultOptions.query), options); - } - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.fetchPolicy !== 'cache-and-network', 5) : (0, _tsInvariant.invariant)(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + 'client.query can only return a single result. Please use client.watchQuery ' + 'to receive multiple results from the cache and the network, or consider ' + 'using a different fetchPolicy, such as cache-first or network-only.'); - - if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - fetchPolicy: 'cache-first' - }); - } - - return this.queryManager.query(options); - }; - - ApolloClient.prototype.mutate = function (options) { - if (this.defaultOptions.mutate) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.defaultOptions.mutate), options); - } - - return this.queryManager.mutate(options); - }; - - ApolloClient.prototype.subscribe = function (options) { - return this.queryManager.startGraphQLSubscription(options); - }; - - ApolloClient.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.cache.readQuery(options, optimistic); - }; - - ApolloClient.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.cache.readFragment(options, optimistic); - }; - - ApolloClient.prototype.writeQuery = function (options) { - var result = this.cache.writeQuery(options); - this.queryManager.broadcastQueries(); - return result; - }; - - ApolloClient.prototype.writeFragment = function (options) { - var result = this.cache.writeFragment(options); - this.queryManager.broadcastQueries(); - return result; - }; - - ApolloClient.prototype.writeData = function (options) { - var result = this.cache.writeData(options); - this.queryManager.broadcastQueries(); - return result; - }; - - ApolloClient.prototype.__actionHookForDevTools = function (cb) { - this.devToolsHookCb = cb; - }; - - ApolloClient.prototype.__requestRaw = function (payload) { - return (0, _apolloLink.execute)(this.link, payload); - }; - - ApolloClient.prototype.initQueryManager = function () { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Calling the initQueryManager method is no longer necessary, ' + 'and it will be removed from ApolloClient in version 3.0.'); - return this.queryManager; - }; - - ApolloClient.prototype.resetStore = function () { - var _this = this; - - return Promise.resolve().then(function () { - return _this.queryManager.clearStore(); - }).then(function () { - return Promise.all(_this.resetStoreCallbacks.map(function (fn) { - return fn(); - })); - }).then(function () { - return _this.reFetchObservableQueries(); - }); - }; - - ApolloClient.prototype.clearStore = function () { - var _this = this; - - return Promise.resolve().then(function () { - return _this.queryManager.clearStore(); - }).then(function () { - return Promise.all(_this.clearStoreCallbacks.map(function (fn) { - return fn(); - })); - }); - }; - - ApolloClient.prototype.onResetStore = function (cb) { - var _this = this; - - this.resetStoreCallbacks.push(cb); - return function () { - _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { - return c !== cb; - }); - }; - }; - - ApolloClient.prototype.onClearStore = function (cb) { - var _this = this; - - this.clearStoreCallbacks.push(cb); - return function () { - _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { - return c !== cb; - }); - }; - }; - - ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { - return this.queryManager.reFetchObservableQueries(includeStandby); - }; - - ApolloClient.prototype.extract = function (optimistic) { - return this.cache.extract(optimistic); - }; - - ApolloClient.prototype.restore = function (serializedState) { - return this.cache.restore(serializedState); - }; - - ApolloClient.prototype.addResolvers = function (resolvers) { - this.localState.addResolvers(resolvers); - }; - - ApolloClient.prototype.setResolvers = function (resolvers) { - this.localState.setResolvers(resolvers); - }; - - ApolloClient.prototype.getResolvers = function () { - return this.localState.getResolvers(); - }; - - ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { - this.localState.setFragmentMatcher(fragmentMatcher); - }; - - return ApolloClient; -}(); - -exports.ApolloClient = ApolloClient; -var _default = ApolloClient; - -exports.default = _default; diff --git a/node_modules/apollo-client/bundle.cjs.js.map b/node_modules/apollo-client/bundle.cjs.js.map deleted file mode 100644 index bc74e9ef..00000000 --- a/node_modules/apollo-client/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/core/networkStatus.ts","../src/util/Observable.ts","../src/util/arrays.ts","../src/errors/ApolloError.ts","../src/core/types.ts","../src/core/ObservableQuery.ts","../src/data/mutations.ts","../src/data/queries.ts","../src/util/capitalizeFirstLetter.ts","../src/core/LocalState.ts","../src/util/observables.ts","../src/core/QueryManager.ts","../src/data/store.ts","../src/version.ts","../src/ApolloClient.ts"],"names":["LinkObservable"],"mappings":";;;;;;;;;;;;;;;;;;;;IAGY,a;;;AAAZ,CAAA,UAAY,aAAZ,EAAyB;AAMvB,EAAA,aAAA,CAAA,aAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AAMA,EAAA,aAAA,CAAA,aAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA;AAMA,EAAA,aAAA,CAAA,aAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAA;AAMA,EAAA,aAAA,CAAA,aAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AAOA,EAAA,aAAA,CAAA,aAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA;AAKA,EAAA,aAAA,CAAA,aAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA;AAK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K,EAAN;AAAQ,OAA7C,CAA3B;AACD,KAFD;AAGD,GALM;;AAmBA,EAAA,YAAA,CAAA,SAAA,CAAA,wBAAA,GAAP,UACE,cADF,EAC0B;AAExB,WAAO,KAAK,YAAL,CAAkB,wBAAlB,CAA2C,cAA3C,CAAP;AACD,GAJM;;AASA,EAAA,YAAA,CAAA,SAAA,CAAA,OAAA,GAAP,UAAe,UAAf,EAAmC;AACjC,WAAO,KAAK,KAAL,CAAW,OAAX,CAAmB,UAAnB,CAAP;AACD,GAFM;;AAWA,EAAA,YAAA,CAAA,SAAA,CAAA,OAAA,GAAP,UAAe,eAAf,EAA2C;AACzC,WAAO,KAAK,KAAL,CAAW,OAAX,CAAmB,eAAnB,CAAP;AACD,GAFM;;AAOA,EAAA,YAAA,CAAA,SAAA,CAAA,YAAA,GAAP,UAAoB,SAApB,EAAsD;AACpD,SAAK,UAAL,CAAgB,YAAhB,CAA6B,SAA7B;AACD,GAFM;;AAOA,EAAA,YAAA,CAAA,SAAA,CAAA,YAAA,GAAP,UAAoB,SAApB,EAAsD;AACpD,SAAK,UAAL,CAAgB,YAAhB,CAA6B,SAA7B;AACD,GAFM;;AAOA,EAAA,YAAA,CAAA,SAAA,CAAA,YAAA,GAAP,YAAA;AACE,WAAO,KAAK,UAAL,CAAgB,YAAhB,EAAP;AACD,GAFM;;AAOA,EAAA,YAAA,CAAA,SAAA,CAAA,4BAAA,GAAP,UAAoC,eAApC,EAAoE;AAClE,SAAK,UAAL,CAAgB,kBAAhB,CAAmC,eAAnC;AACD,GAFM;;AAGT,SAAA,YAAA;AAAC,CA3gBD,EAAA","sourcesContent":["/**\n * The current status of a query’s execution in our system.\n */\nexport enum NetworkStatus {\n /**\n * The query has never been run before and the query is now currently running. A query will still\n * have this network status even if a partial data result was returned from the cache, but a\n * query was dispatched anyway.\n */\n loading = 1,\n\n /**\n * If `setVariables` was called and a query was fired because of that then the network status\n * will be `setVariables` until the result of that query comes back.\n */\n setVariables = 2,\n\n /**\n * Indicates that `fetchMore` was called on this query and that the query created is currently in\n * flight.\n */\n fetchMore = 3,\n\n /**\n * Similar to the `setVariables` network status. It means that `refetch` was called on a query\n * and the refetch request is currently in flight.\n */\n refetch = 4,\n\n /**\n * Indicates that a polling query is currently in flight. So for example if you are polling a\n * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever\n * a poll request has been sent but not resolved.\n */\n poll = 6,\n\n /**\n * No request is in flight for this query, and no errors happened. Everything is OK.\n */\n ready = 7,\n\n /**\n * No request is in flight for this query, but one or more errors were detected.\n */\n error = 8,\n}\n\n/**\n * Returns true if there is currently a network request in flight according to a given network\n * status.\n */\nexport function isNetworkRequestInFlight(\n networkStatus: NetworkStatus,\n): boolean {\n return networkStatus < 7;\n}\n","// This simplified polyfill attempts to follow the ECMAScript Observable proposal.\n// See https://github.com/zenparsing/es-observable\nimport { Observable as LinkObservable } from 'apollo-link';\n\nexport type Subscription = ZenObservable.Subscription;\nexport type Observer = ZenObservable.Observer;\n\nimport $$observable from 'symbol-observable';\n\n// rxjs interopt\nexport class Observable extends LinkObservable {\n public [$$observable]() {\n return this;\n }\n\n public ['@@observable' as any]() {\n return this;\n }\n}\n","export function isNonEmptyArray(value?: ArrayLike): value is Array {\n return Array.isArray(value) && value.length > 0;\n}\n","import { GraphQLError } from 'graphql';\nimport { isNonEmptyArray } from '../util/arrays';\n\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty('graphQLErrors');\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n let message = '';\n // If we have GraphQL errors present, add that to the error message.\n if (isNonEmptyArray(err.graphQLErrors)) {\n err.graphQLErrors.forEach((graphQLError: GraphQLError) => {\n const errorMessage = graphQLError\n ? graphQLError.message\n : 'Error message not found.';\n message += `GraphQL error: ${errorMessage}\\n`;\n });\n }\n\n if (err.networkError) {\n message += 'Network error: ' + err.networkError.message + '\\n';\n }\n\n // strip newline from the end of the message\n message = message.replace(/\\n$/, '');\n return message;\n};\n\nexport class ApolloError extends Error {\n public message: string;\n public graphQLErrors: ReadonlyArray;\n public networkError: Error | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: {\n graphQLErrors?: ReadonlyArray;\n networkError?: Error | null;\n errorMessage?: string;\n extraInfo?: any;\n }) {\n super(errorMessage);\n this.graphQLErrors = graphQLErrors || [];\n this.networkError = networkError || null;\n\n if (!errorMessage) {\n this.message = generateErrorMessage(this);\n } else {\n this.message = errorMessage;\n }\n\n this.extraInfo = extraInfo;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n","import { FetchResult } from 'apollo-link';\nimport { DocumentNode, GraphQLError } from 'graphql';\n\nimport { QueryStoreValue } from '../data/queries';\nimport { NetworkStatus } from './networkStatus';\nimport { Resolver } from './LocalState';\n\nexport type QueryListener = (\n queryStoreValue: QueryStoreValue,\n newData?: any,\n forceResolvers?: boolean,\n) => void;\n\nexport type OperationVariables = { [key: string]: any };\n\nexport type PureQueryOptions = {\n query: DocumentNode;\n variables?: { [key: string]: any };\n context?: any;\n};\n\nexport type ApolloQueryResult = {\n data: T;\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n stale: boolean;\n};\n\nexport enum FetchType {\n normal = 1,\n refetch = 2,\n poll = 3,\n}\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer = (\n previousResult: Record,\n options: {\n mutationResult: FetchResult;\n queryName: string | undefined;\n queryVariables: Record;\n },\n) => Record;\n\nexport type MutationQueryReducersMap = {\n [queryName: string]: MutationQueryReducer;\n};\n\nexport interface Resolvers {\n [key: string]: {\n [ field: string ]: Resolver;\n };\n}\n","import {\n isEqual,\n tryFunctionOrLogError,\n cloneDeep,\n getOperationDefinition,\n} from 'apollo-utilities';\nimport { GraphQLError } from 'graphql';\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport { Observable, Observer, Subscription } from '../util/Observable';\nimport { ApolloError } from '../errors/ApolloError';\nimport { QueryManager } from './QueryManager';\nimport { ApolloQueryResult, FetchType, OperationVariables } from './types';\nimport {\n WatchQueryOptions,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n ErrorPolicy,\n} from './watchQueryOptions';\n\nimport { QueryStoreValue } from '../data/queries';\n\nimport { invariant, InvariantError } from 'ts-invariant';\nimport { isNonEmptyArray } from '../util/arrays';\n\n// XXX remove in the next breaking semver change (3.0)\n// Deprecated, use ApolloCurrentQueryResult\nexport type ApolloCurrentResult = {\n data: T | {};\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n error?: ApolloError;\n partial?: boolean;\n};\n\nexport type ApolloCurrentQueryResult = {\n data: T | undefined;\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n error?: ApolloError;\n partial?: boolean;\n stale?: boolean;\n};\n\nexport interface FetchMoreOptions<\n TData = any,\n TVariables = OperationVariables\n> {\n updateQuery: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult?: TData;\n variables?: TVariables;\n },\n ) => TData;\n}\n\nexport interface UpdateQueryOptions {\n variables?: TVariables;\n}\n\nexport const hasError = (\n storeValue: QueryStoreValue,\n policy: ErrorPolicy = 'none',\n) => storeValue && (\n storeValue.networkError ||\n (policy === 'none' && isNonEmptyArray(storeValue.graphQLErrors))\n);\n\nexport class ObservableQuery<\n TData = any,\n TVariables = OperationVariables\n> extends Observable> {\n public options: WatchQueryOptions;\n public readonly queryId: string;\n public readonly queryName?: string;\n /**\n *\n * The current value of the variables for this query. Can change.\n */\n public variables: TVariables;\n\n private shouldSubscribe: boolean;\n private isTornDown: boolean;\n private queryManager: QueryManager;\n private observers = new Set>>();\n private subscriptions = new Set();\n\n private lastResult: ApolloQueryResult;\n private lastResultSnapshot: ApolloQueryResult;\n private lastError: ApolloError;\n\n constructor({\n queryManager,\n options,\n shouldSubscribe = true,\n }: {\n queryManager: QueryManager;\n options: WatchQueryOptions;\n shouldSubscribe?: boolean;\n }) {\n super((observer: Observer>) =>\n this.onSubscribe(observer),\n );\n\n // active state\n this.isTornDown = false;\n\n // query information\n this.options = options;\n this.variables = options.variables || ({} as TVariables);\n this.queryId = queryManager.generateQueryId();\n this.shouldSubscribe = shouldSubscribe;\n\n const opDef = getOperationDefinition(options.query);\n this.queryName = opDef && opDef.name && opDef.name.value;\n\n // related classes\n this.queryManager = queryManager;\n }\n\n public result(): Promise> {\n return new Promise((resolve, reject) => {\n const observer: Observer> = {\n next: (result: ApolloQueryResult) => {\n resolve(result);\n\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n this.observers.delete(observer);\n if (!this.observers.size) {\n this.queryManager.removeQuery(this.queryId);\n }\n\n setTimeout(() => {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n const subscription = this.subscribe(observer);\n });\n }\n\n // XXX remove in the next breaking semver change (3.0)\n // Deprecated, use getCurrentResult()\n public currentResult(): ApolloCurrentResult {\n const result = this.getCurrentResult() as ApolloCurrentResult;\n if (result.data === undefined) {\n result.data = {};\n }\n return result;\n }\n\n /**\n * Return the result of the query from the local cache as well as some fetching status\n * `loading` and `networkStatus` allow to know if a request is in flight\n * `partial` lets you know if the result from the local cache is complete or partial\n * @return {data: Object, error: ApolloError, loading: boolean, networkStatus: number, partial: boolean}\n */\n public getCurrentResult(): ApolloCurrentQueryResult {\n if (this.isTornDown) {\n const { lastResult } = this;\n return {\n data: !this.lastError && lastResult && lastResult.data || void 0,\n error: this.lastError,\n loading: false,\n networkStatus: NetworkStatus.error,\n };\n }\n\n const { data, partial } = this.queryManager.getCurrentQueryResult(this);\n const queryStoreValue = this.queryManager.queryStore.get(this.queryId);\n let result: ApolloQueryResult;\n\n const { fetchPolicy } = this.options;\n\n const isNetworkFetchPolicy =\n fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache';\n\n if (queryStoreValue) {\n const { networkStatus } = queryStoreValue;\n\n if (hasError(queryStoreValue, this.options.errorPolicy)) {\n return {\n data: void 0,\n loading: false,\n networkStatus,\n error: new ApolloError({\n graphQLErrors: queryStoreValue.graphQLErrors,\n networkError: queryStoreValue.networkError,\n }),\n };\n }\n\n // Variables might have been added dynamically at query time, when\n // using `@client @export(as: \"varname\")` for example. When this happens,\n // the variables have been updated in the query store, but not updated on\n // the original `ObservableQuery`. We'll update the observable query\n // variables here to match, so retrieving from the cache doesn't fail.\n if (queryStoreValue.variables) {\n this.options.variables = {\n ...this.options.variables,\n ...(queryStoreValue.variables as TVariables),\n };\n this.variables = this.options.variables;\n }\n\n result = {\n data,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n } as ApolloQueryResult;\n\n if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') {\n result.errors = queryStoreValue.graphQLErrors;\n }\n\n } else {\n // We need to be careful about the loading state we show to the user, to try\n // and be vaguely in line with what the user would have seen from .subscribe()\n // but to still provide useful information synchronously when the query\n // will not end up hitting the server.\n // See more: https://github.com/apollostack/apollo-client/issues/707\n // Basically: is there a query in flight right now (modolo the next tick)?\n const loading = isNetworkFetchPolicy ||\n (partial && fetchPolicy !== 'cache-only');\n\n result = {\n data,\n loading,\n networkStatus: loading ? NetworkStatus.loading : NetworkStatus.ready,\n } as ApolloQueryResult;\n }\n\n if (!partial) {\n this.updateLastResult({ ...result, stale: false });\n }\n\n return { ...result, partial };\n }\n\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n public isDifferentFromLastResult(newResult: ApolloQueryResult) {\n const { lastResultSnapshot: snapshot } = this;\n return !(\n snapshot &&\n newResult &&\n snapshot.networkStatus === newResult.networkStatus &&\n snapshot.stale === newResult.stale &&\n isEqual(snapshot.data, newResult.data)\n );\n }\n\n // Returns the last result that observer.next was called with. This is not the same as\n // getCurrentResult! If you're not sure which you need, then you probably need getCurrentResult.\n public getLastResult(): ApolloQueryResult {\n return this.lastResult;\n }\n\n public getLastError(): ApolloError {\n return this.lastError;\n }\n\n public resetLastResults(): void {\n delete this.lastResult;\n delete this.lastResultSnapshot;\n delete this.lastError;\n this.isTornDown = false;\n }\n\n public resetQueryStoreErrors() {\n const queryStore = this.queryManager.queryStore.get(this.queryId);\n if (queryStore) {\n queryStore.networkError = null;\n queryStore.graphQLErrors = [];\n }\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public refetch(variables?: TVariables): Promise> {\n let { fetchPolicy } = this.options;\n // early return if trying to read from cache during refetch\n if (fetchPolicy === 'cache-only') {\n return Promise.reject(new InvariantError(\n 'cache-only fetchPolicy option should not be used together with query refetch.',\n ));\n }\n\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n if (fetchPolicy !== 'no-cache' &&\n fetchPolicy !== 'cache-and-network') {\n fetchPolicy = 'network-only';\n }\n\n if (!isEqual(this.variables, variables)) {\n // update observable variables\n this.variables = {\n ...this.variables,\n ...variables,\n };\n }\n\n if (!isEqual(this.options.variables, this.variables)) {\n // Update the existing options with new variables\n this.options.variables = {\n ...this.options.variables,\n ...this.variables,\n };\n }\n\n return this.queryManager.fetchQuery(\n this.queryId,\n { ...this.options, fetchPolicy },\n FetchType.refetch,\n ) as Promise>;\n }\n\n public fetchMore(\n fetchMoreOptions: FetchMoreQueryOptions &\n FetchMoreOptions,\n ): Promise> {\n // early return if no update Query\n invariant(\n fetchMoreOptions.updateQuery,\n 'updateQuery option is required. This function defines how to update the query data with the new results.',\n );\n\n const combinedOptions = {\n ...(fetchMoreOptions.query ? fetchMoreOptions : {\n ...this.options,\n ...fetchMoreOptions,\n variables: {\n ...this.variables,\n ...fetchMoreOptions.variables,\n },\n }),\n fetchPolicy: 'network-only',\n } as WatchQueryOptions;\n\n const qid = this.queryManager.generateQueryId();\n\n return this.queryManager\n .fetchQuery(\n qid,\n combinedOptions,\n FetchType.normal,\n this.queryId,\n )\n .then(\n fetchMoreResult => {\n this.updateQuery((previousResult: any) =>\n fetchMoreOptions.updateQuery(previousResult, {\n fetchMoreResult: fetchMoreResult.data as TData,\n variables: combinedOptions.variables as TVariables,\n }),\n );\n this.queryManager.stopQuery(qid);\n return fetchMoreResult as ApolloQueryResult;\n },\n error => {\n this.queryManager.stopQuery(qid);\n throw error;\n },\n );\n }\n\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n public subscribeToMore<\n TSubscriptionData = TData,\n TSubscriptionVariables = TVariables\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >,\n ) {\n const subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n })\n .subscribe({\n next: (subscriptionData: { data: TSubscriptionData }) => {\n const { updateQuery } = options;\n if (updateQuery) {\n this.updateQuery(\n (previous, { variables }) =>\n updateQuery(previous, {\n subscriptionData,\n variables,\n }),\n );\n }\n },\n error: (err: any) => {\n if (options.onError) {\n options.onError(err);\n return;\n }\n invariant.error('Unhandled GraphQL subscription error', err);\n },\n });\n\n this.subscriptions.add(subscription);\n\n return () => {\n if (this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n }\n\n // Note: if the query is not active (there are no subscribers), the promise\n // will return null immediately.\n public setOptions(\n opts: WatchQueryOptions,\n ): Promise | void> {\n const { fetchPolicy: oldFetchPolicy } = this.options;\n this.options = {\n ...this.options,\n ...opts,\n } as WatchQueryOptions;\n\n if (opts.pollInterval) {\n this.startPolling(opts.pollInterval);\n } else if (opts.pollInterval === 0) {\n this.stopPolling();\n }\n\n const { fetchPolicy } = opts;\n\n return this.setVariables(\n this.options.variables as TVariables,\n // Try to fetch the query if fetchPolicy changed from either cache-only\n // or standby to something else, or changed to network-only.\n oldFetchPolicy !== fetchPolicy && (\n oldFetchPolicy === 'cache-only' ||\n oldFetchPolicy === 'standby' ||\n fetchPolicy === 'network-only'\n ),\n opts.fetchResults,\n );\n }\n\n /**\n * This is for *internal* use only. Most users should instead use `refetch`\n * in order to be properly notified of results even when they come from cache.\n *\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. If you want to force new results, use `refetch`.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @private\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n *\n * @param tryFetch: Try and fetch new results even if the variables haven't\n * changed (we may still just hit the store, but if there's nothing in there\n * this will refetch)\n *\n * @param fetchResults: Option to ignore fetching results when updating variables\n */\n public setVariables(\n variables: TVariables,\n tryFetch: boolean = false,\n fetchResults = true,\n ): Promise | void> {\n // since setVariables restarts the subscription, we reset the tornDown status\n this.isTornDown = false;\n\n variables = variables || this.variables;\n\n if (!tryFetch && isEqual(variables, this.variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size && fetchResults\n ? this.result()\n : Promise.resolve();\n }\n\n this.variables = this.options.variables = variables;\n\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n\n // Use the same options as before, but with new variables\n return this.queryManager.fetchQuery(\n this.queryId,\n this.options,\n ) as Promise>;\n }\n\n public updateQuery(\n mapFn: (\n previousQueryResult: TData,\n options: UpdateQueryOptions,\n ) => TData,\n ): void {\n const { queryManager } = this;\n const {\n previousResult,\n variables,\n document,\n } = queryManager.getQueryWithPreviousResult(\n this.queryId,\n );\n\n const newResult = tryFunctionOrLogError(() =>\n mapFn(previousResult, { variables }),\n );\n\n if (newResult) {\n queryManager.dataStore.markUpdateQueryResult(\n document,\n variables,\n newResult,\n );\n queryManager.broadcastQueries();\n }\n }\n\n public stopPolling() {\n this.queryManager.stopPollingQuery(this.queryId);\n this.options.pollInterval = undefined;\n }\n\n public startPolling(pollInterval: number) {\n assertNotCacheFirstOrOnly(this);\n this.options.pollInterval = pollInterval;\n this.queryManager.startPollingQuery(this.options, this.queryId);\n }\n\n private updateLastResult(newResult: ApolloQueryResult) {\n const previousResult = this.lastResult;\n this.lastResult = newResult;\n this.lastResultSnapshot = this.queryManager.assumeImmutableResults\n ? newResult\n : cloneDeep(newResult);\n return previousResult;\n }\n\n private onSubscribe(observer: Observer>) {\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = (observer as any)._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n } catch {}\n\n const first = !this.observers.size;\n this.observers.add(observer);\n\n // Deliver initial result\n if (observer.next && this.lastResult) observer.next(this.lastResult);\n if (observer.error && this.lastError) observer.error(this.lastError);\n\n // setup the query if it hasn't been done before\n if (first) {\n this.setUpQuery();\n }\n\n return () => {\n if (this.observers.delete(observer) && !this.observers.size) {\n this.tearDownQuery();\n }\n };\n }\n\n private setUpQuery() {\n const { queryManager, queryId } = this;\n\n if (this.shouldSubscribe) {\n queryManager.addObservableQuery(queryId, this);\n }\n\n if (this.options.pollInterval) {\n assertNotCacheFirstOrOnly(this);\n queryManager.startPollingQuery(this.options, queryId);\n }\n\n const onError = (error: ApolloError) => {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n this.updateLastResult({\n ...this.lastResult,\n errors: error.graphQLErrors,\n networkStatus: NetworkStatus.error,\n loading: false,\n });\n iterateObserversSafely(this.observers, 'error', this.lastError = error);\n };\n\n queryManager.observeQuery(queryId, this.options, {\n next: (result: ApolloQueryResult) => {\n if (this.lastError || this.isDifferentFromLastResult(result)) {\n const previousResult = this.updateLastResult(result);\n const { query, variables, fetchPolicy } = this.options;\n\n // Before calling `next` on each observer, we need to first see if\n // the query is using `@client @export` directives, and update\n // any variables that might have changed. If `@export` variables have\n // changed, and the query is calling against both local and remote\n // data, a refetch is needed to pull in new data, using the\n // updated `@export` variables.\n if (queryManager.transform(query).hasClientExports) {\n queryManager.getLocalState().addExportedVariables(\n query,\n variables,\n ).then((variables: TVariables) => {\n const previousVariables = this.variables;\n this.variables = this.options.variables = variables;\n if (\n !result.loading &&\n previousResult &&\n fetchPolicy !== 'cache-only' &&\n queryManager.transform(query).serverQuery &&\n !isEqual(previousVariables, variables)\n ) {\n this.refetch();\n } else {\n iterateObserversSafely(this.observers, 'next', result);\n }\n });\n } else {\n iterateObserversSafely(this.observers, 'next', result);\n }\n }\n },\n error: onError,\n }).catch(onError);\n }\n\n private tearDownQuery() {\n const { queryManager } = this;\n\n this.isTornDown = true;\n queryManager.stopPollingQuery(this.queryId);\n\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(sub => sub.unsubscribe());\n this.subscriptions.clear();\n\n queryManager.removeObservableQuery(this.queryId);\n queryManager.stopQuery(this.queryId);\n\n this.observers.clear();\n }\n}\n\nfunction defaultSubscriptionObserverErrorCallback(error: ApolloError) {\n invariant.error('Unhandled error', error.message, error.stack);\n}\n\nfunction iterateObserversSafely(\n observers: Set>,\n method: keyof Observer,\n argument?: A,\n) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n const observersWithMethod: Observer[] = [];\n observers.forEach(obs => obs[method] && observersWithMethod.push(obs));\n observersWithMethod.forEach(obs => (obs as any)[method](argument));\n}\n\nfunction assertNotCacheFirstOrOnly(\n obsQuery: ObservableQuery,\n) {\n const { fetchPolicy } = obsQuery.options;\n invariant(\n fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only',\n 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.',\n );\n}\n","import { DocumentNode } from 'graphql';\n\nexport class MutationStore {\n private store: { [mutationId: string]: MutationStoreValue } = {};\n\n public getStore(): { [mutationId: string]: MutationStoreValue } {\n return this.store;\n }\n\n public get(mutationId: string): MutationStoreValue {\n return this.store[mutationId];\n }\n\n public initMutation(\n mutationId: string,\n mutation: DocumentNode,\n variables: Object | undefined,\n ) {\n this.store[mutationId] = {\n mutation,\n variables: variables || {},\n loading: true,\n error: null,\n };\n }\n\n public markMutationError(mutationId: string, error: Error) {\n const mutation = this.store[mutationId];\n if (mutation) {\n mutation.loading = false;\n mutation.error = error;\n }\n }\n\n public markMutationResult(mutationId: string) {\n const mutation = this.store[mutationId];\n if (mutation) {\n mutation.loading = false;\n mutation.error = null;\n }\n }\n\n public reset() {\n this.store = {};\n }\n}\n\nexport interface MutationStoreValue {\n mutation: DocumentNode;\n variables: Object;\n loading: boolean;\n error: Error | null;\n}\n","import { DocumentNode, GraphQLError, ExecutionResult } from 'graphql';\nimport { isEqual } from 'apollo-utilities';\nimport { invariant } from 'ts-invariant';\nimport { NetworkStatus } from '../core/networkStatus';\nimport { isNonEmptyArray } from '../util/arrays';\n\nexport type QueryStoreValue = {\n document: DocumentNode;\n variables: Object;\n previousVariables?: Object | null;\n networkStatus: NetworkStatus;\n networkError?: Error | null;\n graphQLErrors?: ReadonlyArray;\n metadata: any;\n};\n\nexport class QueryStore {\n private store: { [queryId: string]: QueryStoreValue } = {};\n\n public getStore(): { [queryId: string]: QueryStoreValue } {\n return this.store;\n }\n\n public get(queryId: string): QueryStoreValue {\n return this.store[queryId];\n }\n\n public initQuery(query: {\n queryId: string;\n document: DocumentNode;\n storePreviousVariables: boolean;\n variables: Object;\n isPoll: boolean;\n isRefetch: boolean;\n metadata: any;\n fetchMoreForQueryId: string | undefined;\n }) {\n const previousQuery = this.store[query.queryId];\n\n // XXX we're throwing an error here to catch bugs where a query gets overwritten by a new one.\n // we should implement a separate action for refetching so that QUERY_INIT may never overwrite\n // an existing query (see also: https://github.com/apollostack/apollo-client/issues/732)\n invariant(\n !previousQuery ||\n previousQuery.document === query.document ||\n isEqual(previousQuery.document, query.document),\n 'Internal Error: may not update existing query string in store',\n );\n\n let isSetVariables = false;\n\n let previousVariables: Object | null = null;\n if (\n query.storePreviousVariables &&\n previousQuery &&\n previousQuery.networkStatus !== NetworkStatus.loading\n // if the previous query was still loading, we don't want to remember it at all.\n ) {\n if (!isEqual(previousQuery.variables, query.variables)) {\n isSetVariables = true;\n previousVariables = previousQuery.variables;\n }\n }\n\n // TODO break this out into a separate function\n let networkStatus;\n if (isSetVariables) {\n networkStatus = NetworkStatus.setVariables;\n } else if (query.isPoll) {\n networkStatus = NetworkStatus.poll;\n } else if (query.isRefetch) {\n networkStatus = NetworkStatus.refetch;\n // TODO: can we determine setVariables here if it's a refetch and the variables have changed?\n } else {\n networkStatus = NetworkStatus.loading;\n }\n\n let graphQLErrors: ReadonlyArray = [];\n if (previousQuery && previousQuery.graphQLErrors) {\n graphQLErrors = previousQuery.graphQLErrors;\n }\n\n // XXX right now if QUERY_INIT is fired twice, like in a refetch situation, we just overwrite\n // the store. We probably want a refetch action instead, because I suspect that if you refetch\n // before the initial fetch is done, you'll get an error.\n this.store[query.queryId] = {\n document: query.document,\n variables: query.variables,\n previousVariables,\n networkError: null,\n graphQLErrors: graphQLErrors,\n networkStatus,\n metadata: query.metadata,\n };\n\n // If the action had a `moreForQueryId` property then we need to set the\n // network status on that query as well to `fetchMore`.\n //\n // We have a complement to this if statement in the query result and query\n // error action branch, but importantly *not* in the client result branch.\n // This is because the implementation of `fetchMore` *always* sets\n // `fetchPolicy` to `network-only` so we would never have a client result.\n if (\n typeof query.fetchMoreForQueryId === 'string' &&\n this.store[query.fetchMoreForQueryId]\n ) {\n this.store[query.fetchMoreForQueryId].networkStatus =\n NetworkStatus.fetchMore;\n }\n }\n\n public markQueryResult(\n queryId: string,\n result: ExecutionResult,\n fetchMoreForQueryId: string | undefined,\n ) {\n if (!this.store || !this.store[queryId]) return;\n\n this.store[queryId].networkError = null;\n this.store[queryId].graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : [];\n this.store[queryId].previousVariables = null;\n this.store[queryId].networkStatus = NetworkStatus.ready;\n\n // If we have a `fetchMoreForQueryId` then we need to update the network\n // status for that query. See the branch for query initialization for more\n // explanation about this process.\n if (\n typeof fetchMoreForQueryId === 'string' &&\n this.store[fetchMoreForQueryId]\n ) {\n this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready;\n }\n }\n\n public markQueryError(\n queryId: string,\n error: Error,\n fetchMoreForQueryId: string | undefined,\n ) {\n if (!this.store || !this.store[queryId]) return;\n\n this.store[queryId].networkError = error;\n this.store[queryId].networkStatus = NetworkStatus.error;\n\n // If we have a `fetchMoreForQueryId` then we need to update the network\n // status for that query. See the branch for query initialization for more\n // explanation about this process.\n if (typeof fetchMoreForQueryId === 'string') {\n this.markQueryResultClient(fetchMoreForQueryId, true);\n }\n }\n\n public markQueryResultClient(queryId: string, complete: boolean) {\n const storeValue = this.store && this.store[queryId];\n if (storeValue) {\n storeValue.networkError = null;\n storeValue.previousVariables = null;\n if (complete) {\n storeValue.networkStatus = NetworkStatus.ready;\n }\n }\n }\n\n public stopQuery(queryId: string) {\n delete this.store[queryId];\n }\n\n public reset(observableQueryIds: string[]) {\n Object.keys(this.store).forEach(queryId => {\n if (observableQueryIds.indexOf(queryId) < 0) {\n this.stopQuery(queryId);\n } else {\n // XXX set loading to true so listeners don't trigger unless they want results with partial data\n this.store[queryId].networkStatus = NetworkStatus.loading;\n }\n });\n }\n}\n","export function capitalizeFirstLetter(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n SelectionNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n FieldNode,\n ASTNode,\n} from 'graphql';\nimport { visit, BREAK } from 'graphql/language/visitor';\n\nimport { ApolloCache } from 'apollo-cache';\nimport {\n getMainDefinition,\n buildQueryFromSelectionSet,\n hasDirectives,\n removeClientSetsFromDocument,\n mergeDeep,\n mergeDeepArray,\n FragmentMap,\n argumentsObjectFromField,\n resultKeyNameFromField,\n getFragmentDefinitions,\n createFragmentMap,\n shouldInclude,\n isField,\n isInlineFragment,\n} from 'apollo-utilities';\nimport { FetchResult } from 'apollo-link';\n\nimport { invariant } from 'ts-invariant';\n\nimport ApolloClient from '../ApolloClient';\nimport { Resolvers, OperationVariables } from './types';\nimport { capitalizeFirstLetter } from '../util/capitalizeFirstLetter';\n\nexport type Resolver = (\n rootValue?: any,\n args?: any,\n context?: any,\n info?: {\n field: FieldNode;\n fragmentMap: FragmentMap;\n },\n) => any;\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: any,\n) => boolean;\n\nexport type ExecContext = {\n fragmentMap: FragmentMap;\n context: any;\n variables: VariableMap;\n fragmentMatcher: FragmentMatcher;\n defaultOperationType: string;\n exportedVariables: Record;\n onlyRunForcedResolvers: boolean;\n};\n\nexport type LocalStateOptions = {\n cache: ApolloCache;\n client?: ApolloClient;\n resolvers?: Resolvers | Resolvers[];\n fragmentMatcher?: FragmentMatcher;\n};\n\nexport class LocalState {\n private cache: ApolloCache;\n private client: ApolloClient;\n private resolvers?: Resolvers;\n private fragmentMatcher: FragmentMatcher;\n\n constructor({\n cache,\n client,\n resolvers,\n fragmentMatcher,\n }: LocalStateOptions) {\n this.cache = cache;\n\n if (client) {\n this.client = client;\n }\n\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach(resolverGroup => {\n this.resolvers = mergeDeep(this.resolvers, resolverGroup);\n });\n } else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n }\n\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n }\n\n public getResolvers() {\n return this.resolvers || {};\n }\n\n // Run local client resolvers against the incoming query and remote data.\n // Locally resolved field values are merged with the incoming remote data,\n // and returned. Note that locally resolved fields will overwrite\n // remote data using the same field name.\n public async runResolvers({\n document,\n remoteResult,\n context,\n variables,\n onlyRunForcedResolvers = false,\n }: {\n document: DocumentNode | null;\n remoteResult: FetchResult;\n context?: Record;\n variables?: Record;\n onlyRunForcedResolvers?: boolean;\n }): Promise> {\n if (document) {\n return this.resolveDocument(\n document,\n remoteResult.data,\n context,\n variables,\n this.fragmentMatcher,\n onlyRunForcedResolvers,\n ).then(localResult => ({\n ...remoteResult,\n data: localResult.result,\n }));\n }\n\n return remoteResult;\n }\n\n public setFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n }\n\n public getFragmentMatcher(): FragmentMatcher {\n return this.fragmentMatcher;\n }\n\n // Client queries contain everything in the incoming document (if a @client\n // directive is found).\n public clientQuery(document: DocumentNode) {\n if (hasDirectives(['client'], document)) {\n if (this.resolvers) {\n return document;\n }\n invariant.warn(\n 'Found @client directives in a query but no ApolloClient resolvers ' +\n 'were specified. This means ApolloClient local resolver handling ' +\n 'has been disabled, and @client directives will be passed through ' +\n 'to your link chain.',\n );\n }\n return null;\n }\n\n // Server queries are stripped of all @client based selection sets.\n public serverQuery(document: DocumentNode) {\n return this.resolvers ? removeClientSetsFromDocument(document) : document;\n }\n\n public prepareContext(context = {}) {\n const { cache } = this;\n\n const newContext = {\n ...context,\n cache,\n // Getting an entry's cache key is useful for local state resolvers.\n getCacheKey: (obj: { __typename: string; id: string | number }) => {\n if ((cache as any).config) {\n return (cache as any).config.dataIdFromObject(obj);\n } else {\n invariant(false,\n 'To use context.getCacheKey, you need to use a cache that has ' +\n 'a configurable dataIdFromObject, like apollo-cache-inmemory.',\n );\n }\n },\n };\n\n return newContext;\n }\n\n // To support `@client @export(as: \"someVar\")` syntax, we'll first resolve\n // @client @export fields locally, then pass the resolved values back to be\n // used alongside the original operation variables.\n public async addExportedVariables(\n document: DocumentNode,\n variables: OperationVariables = {},\n context = {},\n ) {\n if (document) {\n return this.resolveDocument(\n document,\n this.buildRootValueFromCache(document, variables) || {},\n this.prepareContext(context),\n variables,\n ).then(data => ({\n ...variables,\n ...data.exportedVariables,\n }));\n }\n\n return {\n ...variables,\n };\n }\n\n public shouldForceResolvers(document: ASTNode) {\n let forceResolvers = false;\n visit(document, {\n Directive: {\n enter(node) {\n if (node.name.value === 'client' && node.arguments) {\n forceResolvers = node.arguments.some(\n arg =>\n arg.name.value === 'always' &&\n arg.value.kind === 'BooleanValue' &&\n arg.value.value === true,\n );\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n }\n\n // Query the cache and return matching data.\n private buildRootValueFromCache(\n document: DocumentNode,\n variables?: Record,\n ) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n }\n\n private async resolveDocument(\n document: DocumentNode,\n rootValue: TData,\n context: any = {},\n variables: VariableMap = {},\n fragmentMatcher: FragmentMatcher = () => true,\n onlyRunForcedResolvers: boolean = false,\n ) {\n const mainDefinition = getMainDefinition(document);\n const fragments = getFragmentDefinitions(document);\n const fragmentMap = createFragmentMap(fragments);\n\n const definitionOperation = (mainDefinition as OperationDefinitionNode)\n .operation;\n\n const defaultOperationType = definitionOperation\n ? capitalizeFirstLetter(definitionOperation)\n : 'Query';\n\n const { cache, client } = this;\n const execContext: ExecContext = {\n fragmentMap,\n context: {\n ...context,\n cache,\n client,\n },\n variables,\n fragmentMatcher,\n defaultOperationType,\n exportedVariables: {},\n onlyRunForcedResolvers,\n };\n\n return this.resolveSelectionSet(\n mainDefinition.selectionSet,\n rootValue,\n execContext,\n ).then(result => ({\n result,\n exportedVariables: execContext.exportedVariables,\n }));\n }\n\n private async resolveSelectionSet(\n selectionSet: SelectionSetNode,\n rootValue: TData,\n execContext: ExecContext,\n ) {\n const { fragmentMap, context, variables } = execContext;\n const resultsToMerge: TData[] = [rootValue];\n\n const execute = async (selection: SelectionNode): Promise => {\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely.\n return;\n }\n\n if (isField(selection)) {\n return this.resolveField(selection, rootValue, execContext).then(\n fieldResult => {\n if (typeof fieldResult !== 'undefined') {\n resultsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n } as TData);\n }\n },\n );\n }\n\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment.\n fragment = fragmentMap[selection.name.value];\n invariant(fragment, `No fragment named ${selection.name.value}`);\n }\n\n if (fragment && fragment.typeCondition) {\n const typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return this.resolveSelectionSet(\n fragment.selectionSet,\n rootValue,\n execContext,\n ).then(fragmentResult => {\n resultsToMerge.push(fragmentResult);\n });\n }\n }\n };\n\n return Promise.all(selectionSet.selections.map(execute)).then(function() {\n return mergeDeepArray(resultsToMerge);\n });\n }\n\n private async resolveField(\n field: FieldNode,\n rootValue: any,\n execContext: ExecContext,\n ): Promise {\n const { variables } = execContext;\n const fieldName = field.name.value;\n const aliasedFieldName = resultKeyNameFromField(field);\n const aliasUsed = fieldName !== aliasedFieldName;\n const defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n let resultPromise = Promise.resolve(defaultResult);\n\n // Usually all local resolvers are run when passing through here, but\n // if we've specifically identified that we only want to run forced\n // resolvers (that is, resolvers for fields marked with\n // `@client(always: true)`), then we'll skip running non-forced resolvers.\n if (\n !execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)\n ) {\n const resolverType =\n rootValue.__typename || execContext.defaultOperationType;\n const resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n const resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(resolve(\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field, fragmentMap: execContext.fragmentMap },\n ));\n }\n }\n }\n\n return resultPromise.then((result = defaultResult) => {\n // If an @export directive is associated with the current field, store\n // the `as` export variable name and current result for later use.\n if (field.directives) {\n field.directives.forEach(directive => {\n if (directive.name.value === 'export' && directive.arguments) {\n directive.arguments.forEach(arg => {\n if (arg.name.value === 'as' && arg.value.kind === 'StringValue') {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n\n // Handle all scalar types here.\n if (!field.selectionSet) {\n return result;\n }\n\n // From here down, the field has a selection set, which means it's trying\n // to query a GraphQLObjectType.\n if (result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return result;\n }\n\n if (Array.isArray(result)) {\n return this.resolveSubSelectedArray(field, result, execContext);\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n if (field.selectionSet) {\n return this.resolveSelectionSet(\n field.selectionSet,\n result,\n execContext,\n );\n }\n });\n }\n\n private resolveSubSelectedArray(\n field: FieldNode,\n result: any[],\n execContext: ExecContext,\n ): any {\n return Promise.all(\n result.map(item => {\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse.\n if (Array.isArray(item)) {\n return this.resolveSubSelectedArray(field, item, execContext);\n }\n\n // This is an object, run the selection set on it.\n if (field.selectionSet) {\n return this.resolveSelectionSet(field.selectionSet, item, execContext);\n }\n }),\n );\n }\n}\n","import { Observable, Observer, Subscription } from './Observable';\n\n// Returns a normal Observable that can have any number of subscribers,\n// while ensuring the original Observable gets subscribed to at most once.\nexport function multiplex(inner: Observable): Observable {\n const observers = new Set>();\n let sub: Subscription | null = null;\n return new Observable(observer => {\n observers.add(observer);\n sub = sub || inner.subscribe({\n next(value) {\n observers.forEach(obs => obs.next && obs.next(value));\n },\n error(error) {\n observers.forEach(obs => obs.error && obs.error(error));\n },\n complete() {\n observers.forEach(obs => obs.complete && obs.complete());\n },\n });\n return () => {\n if (observers.delete(observer) && !observers.size && sub) {\n sub.unsubscribe();\n sub = null;\n }\n };\n });\n}\n\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap(\n observable: Observable,\n mapFn: (value: V) => R | Promise,\n): Observable {\n return new Observable(observer => {\n const { next, error, complete } = observer;\n let activeNextCount = 0;\n let completed = false;\n\n const handler: Observer = {\n next(value) {\n ++activeNextCount;\n new Promise(resolve => {\n resolve(mapFn(value));\n }).then(\n result => {\n --activeNextCount;\n next && next.call(observer, result);\n completed && handler.complete!();\n },\n e => {\n --activeNextCount;\n error && error.call(observer, e);\n },\n );\n },\n error(e) {\n error && error.call(observer, e);\n },\n complete() {\n completed = true;\n if (!activeNextCount) {\n complete && complete.call(observer);\n }\n },\n };\n\n const sub = observable.subscribe(handler);\n return () => sub.unsubscribe();\n });\n}\n","import { execute, ApolloLink, FetchResult } from 'apollo-link';\nimport { DocumentNode } from 'graphql';\nimport { Cache } from 'apollo-cache';\nimport {\n getDefaultValues,\n getOperationDefinition,\n getOperationName,\n hasDirectives,\n graphQLResultHasError,\n hasClientExports,\n removeConnectionDirectiveFromDocument,\n canUseWeakMap,\n} from 'apollo-utilities';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { isApolloError, ApolloError } from '../errors/ApolloError';\nimport { Observer, Subscription, Observable } from '../util/Observable';\nimport { QueryWithUpdater, DataStore } from '../data/store';\nimport { MutationStore } from '../data/mutations';\nimport { QueryStore, QueryStoreValue } from '../data/queries';\n\nimport {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n ErrorPolicy,\n} from './watchQueryOptions';\nimport { ObservableQuery } from './ObservableQuery';\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport {\n QueryListener,\n ApolloQueryResult,\n FetchType,\n OperationVariables,\n} from './types';\nimport { LocalState } from './LocalState';\nimport { asyncMap, multiplex } from '../util/observables';\nimport { isNonEmptyArray } from '../util/arrays';\n\nconst { hasOwnProperty } = Object.prototype;\n\nexport interface QueryInfo {\n listeners: Set;\n invalidated: boolean;\n newData: Cache.DiffResult | null;\n document: DocumentNode | null;\n lastRequestId: number;\n // A map going from queryId to an observer for a query issued by watchQuery. We use\n // these to keep track of queries that are inflight and error on the observers associated\n // with them in case of some destabalizing action (e.g. reset of the Apollo store).\n observableQuery: ObservableQuery | null;\n subscriptions: Set;\n cancel?: () => void;\n}\n\nexport class QueryManager {\n public link: ApolloLink;\n public mutationStore: MutationStore = new MutationStore();\n public queryStore: QueryStore = new QueryStore();\n public dataStore: DataStore;\n public readonly assumeImmutableResults: boolean;\n\n private queryDeduplication: boolean;\n private clientAwareness: Record = {};\n private localState: LocalState;\n\n private onBroadcast: () => void;\n\n private ssrMode: boolean;\n\n // let's not start at zero to avoid pain with bad checks\n private idCounter = 1;\n\n // XXX merge with ObservableQuery but that needs to be expanded to support mutations and\n // subscriptions as well\n private queries: Map = new Map();\n\n // A map of Promise reject functions for fetchQuery promises that have not\n // yet been resolved, used to keep track of in-flight queries so that we can\n // reject them in case a destabilizing event occurs (e.g. Apollo store reset).\n // The key is in the format of `query:${queryId}` or `fetchRequest:${queryId}`,\n // depending on where the promise's rejection function was created from.\n private fetchQueryRejectFns = new Map();\n\n constructor({\n link,\n queryDeduplication = false,\n store,\n onBroadcast = () => undefined,\n ssrMode = false,\n clientAwareness = {},\n localState,\n assumeImmutableResults,\n }: {\n link: ApolloLink;\n queryDeduplication?: boolean;\n store: DataStore;\n onBroadcast?: () => void;\n ssrMode?: boolean;\n clientAwareness?: Record;\n localState?: LocalState;\n assumeImmutableResults?: boolean;\n }) {\n this.link = link;\n this.queryDeduplication = queryDeduplication;\n this.dataStore = store;\n this.onBroadcast = onBroadcast;\n this.clientAwareness = clientAwareness;\n this.localState = localState || new LocalState({ cache: store.getCache() });\n this.ssrMode = ssrMode;\n this.assumeImmutableResults = !!assumeImmutableResults;\n }\n\n /**\n * Call this method to terminate any active query processes, making it safe\n * to dispose of this QueryManager instance.\n */\n public stop() {\n this.queries.forEach((_info, queryId) => {\n this.stopQueryNoBroadcast(queryId);\n });\n\n this.fetchQueryRejectFns.forEach(reject => {\n reject(\n new InvariantError('QueryManager stopped while query was in flight'),\n );\n });\n }\n\n public async mutate({\n mutation,\n variables,\n optimisticResponse,\n updateQueries: updateQueriesByName,\n refetchQueries = [],\n awaitRefetchQueries = false,\n update: updateWithProxyFn,\n errorPolicy = 'none',\n fetchPolicy,\n context = {},\n }: MutationOptions): Promise> {\n invariant(\n mutation,\n 'mutation option is required. You must specify your GraphQL document in the mutation option.',\n );\n\n invariant(\n !fetchPolicy || fetchPolicy === 'no-cache',\n \"Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior.\"\n );\n\n const mutationId = this.generateQueryId();\n mutation = this.transform(mutation).document;\n\n this.setQuery(mutationId, () => ({ document: mutation }));\n\n variables = this.getVariables(mutation, variables);\n\n if (this.transform(mutation).hasClientExports) {\n variables = await this.localState.addExportedVariables(mutation, variables, context);\n }\n\n // Create a map of update queries by id to the query instead of by name.\n const generateUpdateQueriesInfo: () => {\n [queryId: string]: QueryWithUpdater;\n } = () => {\n const ret: { [queryId: string]: QueryWithUpdater } = {};\n\n if (updateQueriesByName) {\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) {\n const { queryName } = observableQuery;\n if (\n queryName &&\n hasOwnProperty.call(updateQueriesByName, queryName)\n ) {\n ret[queryId] = {\n updater: updateQueriesByName[queryName],\n query: this.queryStore.get(queryId),\n };\n }\n }\n });\n }\n\n return ret;\n };\n\n this.mutationStore.initMutation(\n mutationId,\n mutation,\n variables,\n );\n\n this.dataStore.markMutationInit({\n mutationId,\n document: mutation,\n variables,\n updateQueries: generateUpdateQueriesInfo(),\n update: updateWithProxyFn,\n optimisticResponse,\n });\n\n this.broadcastQueries();\n\n const self = this;\n\n return new Promise((resolve, reject) => {\n let storeResult: FetchResult | null;\n let error: ApolloError;\n\n self.getObservableFromLink(\n mutation,\n {\n ...context,\n optimisticResponse,\n },\n variables,\n false,\n ).subscribe({\n next(result: FetchResult) {\n if (graphQLResultHasError(result) && errorPolicy === 'none') {\n error = new ApolloError({\n graphQLErrors: result.errors,\n });\n return;\n }\n\n self.mutationStore.markMutationResult(mutationId);\n\n if (fetchPolicy !== 'no-cache') {\n self.dataStore.markMutationResult({\n mutationId,\n result,\n document: mutation,\n variables,\n updateQueries: generateUpdateQueriesInfo(),\n update: updateWithProxyFn,\n });\n }\n\n storeResult = result;\n },\n\n error(err: Error) {\n self.mutationStore.markMutationError(mutationId, err);\n self.dataStore.markMutationComplete({\n mutationId,\n optimisticResponse,\n });\n self.broadcastQueries();\n self.setQuery(mutationId, () => ({ document: null }));\n reject(\n new ApolloError({\n networkError: err,\n }),\n );\n },\n\n complete() {\n if (error) {\n self.mutationStore.markMutationError(mutationId, error);\n }\n\n self.dataStore.markMutationComplete({\n mutationId,\n optimisticResponse,\n });\n\n self.broadcastQueries();\n\n if (error) {\n reject(error);\n return;\n }\n\n // allow for conditional refetches\n // XXX do we want to make this the only API one day?\n if (typeof refetchQueries === 'function') {\n refetchQueries = refetchQueries(storeResult!);\n }\n\n const refetchQueryPromises: Promise<\n ApolloQueryResult[] | ApolloQueryResult<{}>\n >[] = [];\n\n if (isNonEmptyArray(refetchQueries)) {\n refetchQueries.forEach(refetchQuery => {\n if (typeof refetchQuery === 'string') {\n self.queries.forEach(({ observableQuery }) => {\n if (\n observableQuery &&\n observableQuery.queryName === refetchQuery\n ) {\n refetchQueryPromises.push(observableQuery.refetch());\n }\n });\n } else {\n const queryOptions: QueryOptions = {\n query: refetchQuery.query,\n variables: refetchQuery.variables,\n fetchPolicy: 'network-only',\n };\n\n if (refetchQuery.context) {\n queryOptions.context = refetchQuery.context;\n }\n\n refetchQueryPromises.push(self.query(queryOptions));\n }\n });\n }\n\n Promise.all(\n awaitRefetchQueries ? refetchQueryPromises : [],\n ).then(() => {\n self.setQuery(mutationId, () => ({ document: null }));\n\n if (\n errorPolicy === 'ignore' &&\n storeResult &&\n graphQLResultHasError(storeResult)\n ) {\n delete storeResult.errors;\n }\n\n resolve(storeResult!);\n });\n },\n });\n });\n }\n\n public async fetchQuery(\n queryId: string,\n options: WatchQueryOptions,\n fetchType?: FetchType,\n // This allows us to track if this is a query spawned by a `fetchMore`\n // call for another query. We need this data to compute the `fetchMore`\n // network status for the query this is fetching for.\n fetchMoreForQueryId?: string,\n ): Promise> {\n const {\n metadata = null,\n fetchPolicy = 'cache-first', // cache-first is the default fetch policy.\n context = {},\n } = options;\n\n const query = this.transform(options.query).document;\n\n let variables = this.getVariables(query, options.variables);\n\n if (this.transform(query).hasClientExports) {\n variables = await this.localState.addExportedVariables(query, variables, context);\n }\n\n options = { ...options, variables };\n\n let storeResult: any;\n const isNetworkOnly =\n fetchPolicy === 'network-only' || fetchPolicy === 'no-cache';\n let needToFetch = isNetworkOnly;\n\n // Unless we are completely skipping the cache, we want to diff the query\n // against the cache before we fetch it from the network interface.\n if (!isNetworkOnly) {\n const { complete, result } = this.dataStore.getCache().diff({\n query,\n variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n // If we're in here, only fetch if we have missing fields\n needToFetch = !complete || fetchPolicy === 'cache-and-network';\n storeResult = result;\n }\n\n let shouldFetch =\n needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby';\n\n // we need to check to see if this is an operation that uses the @live directive\n if (hasDirectives(['live'], query)) shouldFetch = true;\n\n const requestId = this.idCounter++;\n\n // set up a watcher to listen to cache updates\n const cancel = fetchPolicy !== 'no-cache'\n ? this.updateQueryWatch(queryId, query, options)\n : undefined;\n\n // Initialize query in store with unique requestId\n this.setQuery(queryId, () => ({\n document: query,\n lastRequestId: requestId,\n invalidated: true,\n cancel,\n }));\n\n this.invalidate(fetchMoreForQueryId);\n\n this.queryStore.initQuery({\n queryId,\n document: query,\n storePreviousVariables: shouldFetch,\n variables,\n isPoll: fetchType === FetchType.poll,\n isRefetch: fetchType === FetchType.refetch,\n metadata,\n fetchMoreForQueryId,\n });\n\n this.broadcastQueries();\n\n if (shouldFetch) {\n const networkResult = this.fetchRequest({\n requestId,\n queryId,\n document: query,\n options,\n fetchMoreForQueryId,\n }).catch(error => {\n // This is for the benefit of `refetch` promises, which currently don't get their errors\n // through the store like watchQuery observers do\n if (isApolloError(error)) {\n throw error;\n } else {\n if (requestId >= this.getQuery(queryId).lastRequestId) {\n this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId);\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n this.broadcastQueries();\n }\n throw new ApolloError({ networkError: error });\n }\n });\n\n // we don't return the promise for cache-and-network since it is already\n // returned below from the cache\n if (fetchPolicy !== 'cache-and-network') {\n return networkResult;\n }\n\n // however we need to catch the error so it isn't unhandled in case of\n // network error\n networkResult.catch(() => {});\n }\n\n // If there is no part of the query we need to fetch from the server (or,\n // fetchPolicy is cache-only), we just write the store result as the final result.\n this.queryStore.markQueryResultClient(queryId, !shouldFetch);\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n\n if (this.transform(query).hasForcedResolvers) {\n return this.localState.runResolvers({\n document: query,\n remoteResult: { data: storeResult },\n context,\n variables,\n onlyRunForcedResolvers: true,\n }).then((result: FetchResult) => {\n this.markQueryResult(\n queryId,\n result,\n options,\n fetchMoreForQueryId,\n );\n this.broadcastQueries();\n return result;\n });\n }\n\n this.broadcastQueries();\n\n // If we have no query to send to the server, we should return the result\n // found within the store.\n return { data: storeResult };\n }\n\n private markQueryResult(\n queryId: string,\n result: FetchResult,\n {\n fetchPolicy,\n variables,\n errorPolicy,\n }: WatchQueryOptions,\n fetchMoreForQueryId?: string,\n ) {\n if (fetchPolicy === 'no-cache') {\n this.setQuery(queryId, () => ({\n newData: { result: result.data, complete: true },\n }));\n } else {\n this.dataStore.markQueryResult(\n result,\n this.getQuery(queryId).document!,\n variables,\n fetchMoreForQueryId,\n errorPolicy === 'ignore' || errorPolicy === 'all',\n );\n }\n }\n\n // Returns a query listener that will update the given observer based on the\n // results (or lack thereof) for a particular query.\n public queryListenerForObserver(\n queryId: string,\n options: WatchQueryOptions,\n observer: Observer>,\n ): QueryListener {\n function invoke(method: 'next' | 'error', argument: any) {\n if (observer[method]) {\n try {\n observer[method]!(argument);\n } catch (e) {\n invariant.error(e);\n }\n } else if (method === 'error') {\n invariant.error(argument);\n }\n }\n\n return (\n queryStoreValue: QueryStoreValue,\n newData?: Cache.DiffResult,\n ) => {\n // we're going to take a look at the data, so the query is no longer invalidated\n this.invalidate(queryId, false);\n\n // The query store value can be undefined in the event of a store\n // reset.\n if (!queryStoreValue) return;\n\n const { observableQuery, document } = this.getQuery(queryId);\n\n const fetchPolicy = observableQuery\n ? observableQuery.options.fetchPolicy\n : options.fetchPolicy;\n\n // don't watch the store for queries on standby\n if (fetchPolicy === 'standby') return;\n\n const loading = isNetworkRequestInFlight(queryStoreValue.networkStatus);\n const lastResult = observableQuery && observableQuery.getLastResult();\n\n const networkStatusChanged = !!(\n lastResult &&\n lastResult.networkStatus !== queryStoreValue.networkStatus\n );\n\n const shouldNotifyIfLoading =\n options.returnPartialData ||\n (!newData && queryStoreValue.previousVariables) ||\n (networkStatusChanged && options.notifyOnNetworkStatusChange) ||\n fetchPolicy === 'cache-only' ||\n fetchPolicy === 'cache-and-network';\n\n if (loading && !shouldNotifyIfLoading) {\n return;\n }\n\n const hasGraphQLErrors = isNonEmptyArray(queryStoreValue.graphQLErrors);\n\n const errorPolicy: ErrorPolicy = observableQuery\n && observableQuery.options.errorPolicy\n || options.errorPolicy\n || 'none';\n\n // If we have either a GraphQL error or a network error, we create\n // an error and tell the observer about it.\n if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) {\n return invoke('error', new ApolloError({\n graphQLErrors: queryStoreValue.graphQLErrors,\n networkError: queryStoreValue.networkError,\n }));\n }\n\n try {\n let data: any;\n let isMissing: boolean;\n\n if (newData) {\n // As long as we're using the cache, clear out the latest\n // `newData`, since it will now become the current data. We need\n // to keep the `newData` stored with the query when using\n // `no-cache` since `getCurrentQueryResult` attemps to pull from\n // `newData` first, following by trying the cache (which won't\n // find a hit for `no-cache`).\n if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') {\n this.setQuery(queryId, () => ({ newData: null }));\n }\n\n data = newData.result;\n isMissing = !newData.complete;\n } else {\n const lastError = observableQuery && observableQuery.getLastError();\n const errorStatusChanged =\n errorPolicy !== 'none' &&\n (lastError && lastError.graphQLErrors) !==\n queryStoreValue.graphQLErrors;\n\n if (lastResult && lastResult.data && !errorStatusChanged) {\n data = lastResult.data;\n isMissing = false;\n } else {\n const diffResult = this.dataStore.getCache().diff({\n query: document as DocumentNode,\n variables:\n queryStoreValue.previousVariables ||\n queryStoreValue.variables,\n returnPartialData: true,\n optimistic: true,\n });\n\n data = diffResult.result;\n isMissing = !diffResult.complete;\n }\n }\n\n // If there is some data missing and the user has told us that they\n // do not tolerate partial data then we want to return the previous\n // result and mark it as stale.\n const stale = isMissing && !(\n options.returnPartialData ||\n fetchPolicy === 'cache-only'\n );\n\n const resultFromStore: ApolloQueryResult = {\n data: stale ? lastResult && lastResult.data : data,\n loading,\n networkStatus: queryStoreValue.networkStatus,\n stale,\n };\n\n // if the query wants updates on errors we need to add it to the result\n if (errorPolicy === 'all' && hasGraphQLErrors) {\n resultFromStore.errors = queryStoreValue.graphQLErrors;\n }\n\n invoke('next', resultFromStore);\n\n } catch (networkError) {\n invoke('error', new ApolloError({ networkError }));\n }\n };\n }\n\n private transformCache = new (canUseWeakMap ? WeakMap : Map)<\n DocumentNode,\n Readonly<{\n document: Readonly;\n hasClientExports: boolean;\n hasForcedResolvers: boolean;\n clientQuery: Readonly | null;\n serverQuery: Readonly | null;\n defaultVars: Readonly;\n }>\n >();\n\n public transform(document: DocumentNode) {\n const { transformCache } = this;\n\n if (!transformCache.has(document)) {\n const cache = this.dataStore.getCache();\n const transformed = cache.transformDocument(document);\n const forLink = removeConnectionDirectiveFromDocument(\n cache.transformForLink(transformed));\n\n const clientQuery = this.localState.clientQuery(transformed);\n const serverQuery = this.localState.serverQuery(forLink);\n\n const cacheEntry = {\n document: transformed,\n // TODO These two calls (hasClientExports and shouldForceResolvers)\n // could probably be merged into a single traversal.\n hasClientExports: hasClientExports(transformed),\n hasForcedResolvers: this.localState.shouldForceResolvers(transformed),\n clientQuery,\n serverQuery,\n defaultVars: getDefaultValues(\n getOperationDefinition(transformed)\n ) as OperationVariables,\n };\n\n const add = (doc: DocumentNode | null) => {\n if (doc && !transformCache.has(doc)) {\n transformCache.set(doc, cacheEntry);\n }\n }\n // Add cacheEntry to the transformCache using several different keys,\n // since any one of these documents could end up getting passed to the\n // transform method again in the future.\n add(document);\n add(transformed);\n add(clientQuery);\n add(serverQuery);\n }\n\n return transformCache.get(document)!;\n }\n\n private getVariables(\n document: DocumentNode,\n variables?: OperationVariables,\n ): OperationVariables {\n return {\n ...this.transform(document).defaultVars,\n ...variables,\n };\n }\n\n // The shouldSubscribe option is a temporary fix that tells us whether watchQuery was called\n // directly (i.e. through ApolloClient) or through the query method within QueryManager.\n // Currently, the query method uses watchQuery in order to handle non-network errors correctly\n // but we don't want to keep track observables issued for the query method since those aren't\n // supposed to be refetched in the event of a store reset. Once we unify error handling for\n // network errors and non-network errors, the shouldSubscribe option will go away.\n\n public watchQuery(\n options: WatchQueryOptions,\n shouldSubscribe = true,\n ): ObservableQuery {\n invariant(\n options.fetchPolicy !== 'standby',\n 'client.watchQuery cannot be called with fetchPolicy set to \"standby\"',\n );\n\n // assign variable default values if supplied\n options.variables = this.getVariables(options.query, options.variables);\n\n if (typeof options.notifyOnNetworkStatusChange === 'undefined') {\n options.notifyOnNetworkStatusChange = false;\n }\n\n let transformedOptions = { ...options } as WatchQueryOptions;\n\n return new ObservableQuery({\n queryManager: this,\n options: transformedOptions,\n shouldSubscribe: shouldSubscribe,\n });\n }\n\n public query(options: QueryOptions): Promise> {\n invariant(\n options.query,\n 'query option is required. You must specify your GraphQL document ' +\n 'in the query option.',\n );\n\n invariant(\n options.query.kind === 'Document',\n 'You must wrap the query string in a \"gql\" tag.',\n );\n\n invariant(\n !(options as any).returnPartialData,\n 'returnPartialData option only supported on watchQuery.',\n );\n\n invariant(\n !(options as any).pollInterval,\n 'pollInterval option only supported on watchQuery.',\n );\n\n return new Promise>((resolve, reject) => {\n const watchedQuery = this.watchQuery(options, false);\n this.fetchQueryRejectFns.set(`query:${watchedQuery.queryId}`, reject);\n watchedQuery\n .result()\n .then(resolve, reject)\n // Since neither resolve nor reject throw or return a value, this .then\n // handler is guaranteed to execute. Note that it doesn't really matter\n // when we remove the reject function from this.fetchQueryRejectFns,\n // since resolve and reject are mutually idempotent. In fact, it would\n // not be incorrect to let reject functions accumulate over time; it's\n // just a waste of memory.\n .then(() =>\n this.fetchQueryRejectFns.delete(`query:${watchedQuery.queryId}`),\n );\n });\n }\n\n public generateQueryId() {\n return String(this.idCounter++);\n }\n\n public stopQueryInStore(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryInStoreNoBroadcast(queryId: string) {\n this.stopPollingQuery(queryId);\n this.queryStore.stopQuery(queryId);\n this.invalidate(queryId);\n }\n\n public addQueryListener(queryId: string, listener: QueryListener) {\n this.setQuery(queryId, ({ listeners }) => {\n listeners.add(listener);\n return { invalidated: false };\n });\n }\n\n public updateQueryWatch(\n queryId: string,\n document: DocumentNode,\n options: WatchQueryOptions,\n ) {\n const { cancel } = this.getQuery(queryId);\n if (cancel) cancel();\n const previousResult = () => {\n let previousResult = null;\n const { observableQuery } = this.getQuery(queryId);\n if (observableQuery) {\n const lastResult = observableQuery.getLastResult();\n if (lastResult) {\n previousResult = lastResult.data;\n }\n }\n\n return previousResult;\n };\n return this.dataStore.getCache().watch({\n query: document as DocumentNode,\n variables: options.variables,\n optimistic: true,\n previousResult,\n callback: newData => {\n this.setQuery(queryId, () => ({ invalidated: true, newData }));\n },\n });\n }\n\n // Adds an ObservableQuery to this.observableQueries and to this.observableQueriesByName.\n public addObservableQuery(\n queryId: string,\n observableQuery: ObservableQuery,\n ) {\n this.setQuery(queryId, () => ({ observableQuery }));\n }\n\n public removeObservableQuery(queryId: string) {\n const { cancel } = this.getQuery(queryId);\n this.setQuery(queryId, () => ({ observableQuery: null }));\n if (cancel) cancel();\n }\n\n public clearStore(): Promise {\n // Before we have sent the reset action to the store,\n // we can no longer rely on the results returned by in-flight\n // requests since these may depend on values that previously existed\n // in the data portion of the store. So, we cancel the promises and observers\n // that we have issued so far and not yet resolved (in the case of\n // queries).\n this.fetchQueryRejectFns.forEach(reject => {\n reject(new InvariantError(\n 'Store reset while query was in flight (not completed in link chain)',\n ));\n });\n\n const resetIds: string[] = [];\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) resetIds.push(queryId);\n });\n\n this.queryStore.reset(resetIds);\n this.mutationStore.reset();\n\n // begin removing data from the store\n return this.dataStore.reset();\n }\n\n public resetStore(): Promise[]> {\n // Similarly, we have to have to refetch each of the queries currently being\n // observed. We refetch instead of error'ing on these since the assumption is that\n // resetting the store doesn't eliminate the need for the queries currently being\n // watched. If there is an existing query in flight when the store is reset,\n // the promise for it will be rejected and its results will not be written to the\n // store.\n return this.clearStore().then(() => {\n return this.reFetchObservableQueries();\n });\n }\n\n public reFetchObservableQueries(\n includeStandby: boolean = false,\n ): Promise[]> {\n const observableQueryPromises: Promise>[] = [];\n\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) {\n const fetchPolicy = observableQuery.options.fetchPolicy;\n\n observableQuery.resetLastResults();\n if (\n fetchPolicy !== 'cache-only' &&\n (includeStandby || fetchPolicy !== 'standby')\n ) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n\n this.setQuery(queryId, () => ({ newData: null }));\n this.invalidate(queryId);\n }\n });\n\n this.broadcastQueries();\n\n return Promise.all(observableQueryPromises);\n }\n\n public observeQuery(\n queryId: string,\n options: WatchQueryOptions,\n observer: Observer>,\n ) {\n this.addQueryListener(\n queryId,\n this.queryListenerForObserver(queryId, options, observer),\n );\n return this.fetchQuery(queryId, options);\n }\n\n public startQuery(\n queryId: string,\n options: WatchQueryOptions,\n listener: QueryListener,\n ) {\n invariant.warn(\"The QueryManager.startQuery method has been deprecated\");\n\n this.addQueryListener(queryId, listener);\n\n this.fetchQuery(queryId, options)\n // `fetchQuery` returns a Promise. In case of a failure it should be caucht or else the\n // console will show an `Uncaught (in promise)` message. Ignore the error for now.\n .catch(() => undefined);\n\n return queryId;\n }\n\n public startGraphQLSubscription({\n query,\n fetchPolicy,\n variables,\n }: SubscriptionOptions): Observable> {\n query = this.transform(query).document;\n variables = this.getVariables(query, variables);\n\n const makeObservable = (variables: OperationVariables) =>\n this.getObservableFromLink(\n query,\n {},\n variables,\n false,\n ).map(result => {\n if (!fetchPolicy || fetchPolicy !== 'no-cache') {\n this.dataStore.markSubscriptionResult(\n result,\n query,\n variables,\n );\n this.broadcastQueries();\n }\n\n if (graphQLResultHasError(result)) {\n throw new ApolloError({\n graphQLErrors: result.errors,\n });\n }\n\n return result;\n });\n\n if (this.transform(query).hasClientExports) {\n const observablePromise = this.localState.addExportedVariables(\n query,\n variables,\n ).then(makeObservable);\n\n return new Observable>(observer => {\n let sub: Subscription | null = null;\n observablePromise.then(\n observable => sub = observable.subscribe(observer),\n observer.error,\n );\n return () => sub && sub.unsubscribe();\n });\n }\n\n return makeObservable(variables);\n }\n\n public stopQuery(queryId: string) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryNoBroadcast(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n }\n\n public removeQuery(queryId: string) {\n // teardown all links\n // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises\n // that each add their reject functions to fetchQueryRejectFns.\n // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.\n // The same queryId could have two rejection fns for two promises\n this.fetchQueryRejectFns.delete(`query:${queryId}`);\n this.fetchQueryRejectFns.delete(`fetchRequest:${queryId}`);\n this.getQuery(queryId).subscriptions.forEach(x => x.unsubscribe());\n this.queries.delete(queryId);\n }\n\n public getCurrentQueryResult(\n observableQuery: ObservableQuery,\n optimistic: boolean = true,\n ): {\n data: T | undefined;\n partial: boolean;\n } {\n const { variables, query, fetchPolicy, returnPartialData } = observableQuery.options;\n const lastResult = observableQuery.getLastResult();\n const { newData } = this.getQuery(observableQuery.queryId);\n\n if (newData && newData.complete) {\n return { data: newData.result, partial: false };\n }\n\n if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') {\n return { data: undefined, partial: false };\n }\n\n const { result, complete } = this.dataStore.getCache().diff({\n query,\n variables,\n previousResult: lastResult ? lastResult.data : undefined,\n returnPartialData: true,\n optimistic,\n });\n\n return {\n data: (complete || returnPartialData) ? result : void 0,\n partial: !complete,\n };\n }\n\n public getQueryWithPreviousResult(\n queryIdOrObservable: string | ObservableQuery,\n ): {\n previousResult: any;\n variables: TVariables | undefined;\n document: DocumentNode;\n } {\n let observableQuery: ObservableQuery;\n if (typeof queryIdOrObservable === 'string') {\n const { observableQuery: foundObserveableQuery } = this.getQuery(\n queryIdOrObservable,\n );\n invariant(\n foundObserveableQuery,\n `ObservableQuery with this id doesn't exist: ${queryIdOrObservable}`\n );\n observableQuery = foundObserveableQuery!;\n } else {\n observableQuery = queryIdOrObservable;\n }\n\n const { variables, query } = observableQuery.options;\n return {\n previousResult: this.getCurrentQueryResult(observableQuery, false).data,\n variables,\n document: query,\n };\n }\n\n public broadcastQueries() {\n this.onBroadcast();\n this.queries.forEach((info, id) => {\n if (info.invalidated) {\n info.listeners.forEach(listener => {\n // it's possible for the listener to be undefined if the query is being stopped\n // See here for more detail: https://github.com/apollostack/apollo-client/issues/231\n if (listener) {\n listener(this.queryStore.get(id), info.newData);\n }\n });\n }\n });\n }\n\n public getLocalState(): LocalState {\n return this.localState;\n }\n\n private inFlightLinkObservables = new Map<\n DocumentNode,\n Map>\n >();\n\n private getObservableFromLink(\n query: DocumentNode,\n context: any,\n variables?: OperationVariables,\n deduplication: boolean = this.queryDeduplication,\n ): Observable> {\n let observable: Observable>;\n\n const { serverQuery } = this.transform(query);\n if (serverQuery) {\n const { inFlightLinkObservables, link } = this;\n\n const operation = {\n query: serverQuery,\n variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext({\n ...context,\n forceFetch: !deduplication\n }),\n };\n\n context = operation.context;\n\n if (deduplication) {\n const byVariables = inFlightLinkObservables.get(serverQuery) || new Map();\n inFlightLinkObservables.set(serverQuery, byVariables);\n\n const varJson = JSON.stringify(variables);\n observable = byVariables.get(varJson);\n\n if (!observable) {\n byVariables.set(\n varJson,\n observable = multiplex(\n execute(link, operation) as Observable>\n )\n );\n\n const cleanup = () => {\n byVariables.delete(varJson);\n if (!byVariables.size) inFlightLinkObservables.delete(serverQuery);\n cleanupSub.unsubscribe();\n };\n\n const cleanupSub = observable.subscribe({\n next: cleanup,\n error: cleanup,\n complete: cleanup,\n });\n }\n\n } else {\n observable = multiplex(execute(link, operation) as Observable>);\n }\n } else {\n observable = Observable.of({ data: {} } as FetchResult);\n context = this.prepareContext(context);\n }\n\n const { clientQuery } = this.transform(query);\n if (clientQuery) {\n observable = asyncMap(observable, result => {\n return this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context,\n variables,\n });\n });\n }\n\n return observable;\n }\n\n // Takes a request id, query id, a query document and information associated with the query\n // and send it to the network interface. Returns\n // a promise for the result associated with that request.\n private fetchRequest({\n requestId,\n queryId,\n document,\n options,\n fetchMoreForQueryId,\n }: {\n requestId: number;\n queryId: string;\n document: DocumentNode;\n options: WatchQueryOptions;\n fetchMoreForQueryId?: string;\n }): Promise> {\n const { variables, errorPolicy = 'none', fetchPolicy } = options;\n let resultFromStore: any;\n let errorsFromStore: any;\n\n return new Promise>((resolve, reject) => {\n const observable = this.getObservableFromLink(\n document,\n options.context,\n variables,\n );\n\n const fqrfId = `fetchRequest:${queryId}`;\n this.fetchQueryRejectFns.set(fqrfId, reject);\n\n const cleanup = () => {\n this.fetchQueryRejectFns.delete(fqrfId);\n this.setQuery(queryId, ({ subscriptions }) => {\n subscriptions.delete(subscription);\n });\n };\n\n const subscription = observable.map((result: FetchResult) => {\n if (requestId >= this.getQuery(queryId).lastRequestId) {\n this.markQueryResult(\n queryId,\n result,\n options,\n fetchMoreForQueryId,\n );\n\n this.queryStore.markQueryResult(\n queryId,\n result,\n fetchMoreForQueryId,\n );\n\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n\n this.broadcastQueries();\n }\n\n if (errorPolicy === 'none' && isNonEmptyArray(result.errors)) {\n return reject(new ApolloError({\n graphQLErrors: result.errors,\n }));\n }\n\n if (errorPolicy === 'all') {\n errorsFromStore = result.errors;\n }\n\n if (fetchMoreForQueryId || fetchPolicy === 'no-cache') {\n // We don't write fetchMore results to the store because this would overwrite\n // the original result in case an @connection directive is used.\n resultFromStore = result.data;\n } else {\n // ensure result is combined with data already in store\n const { result, complete } = this.dataStore.getCache().diff({\n variables,\n query: document,\n optimistic: false,\n returnPartialData: true,\n });\n\n if (complete || options.returnPartialData) {\n resultFromStore = result;\n }\n }\n }).subscribe({\n error(error: ApolloError) {\n cleanup();\n reject(error);\n },\n\n complete() {\n cleanup();\n resolve({\n data: resultFromStore,\n errors: errorsFromStore,\n loading: false,\n networkStatus: NetworkStatus.ready,\n stale: false,\n });\n },\n });\n\n this.setQuery(queryId, ({ subscriptions }) => {\n subscriptions.add(subscription);\n });\n });\n }\n\n private getQuery(queryId: string) {\n return (\n this.queries.get(queryId) || {\n listeners: new Set(),\n invalidated: false,\n document: null,\n newData: null,\n lastRequestId: 1,\n observableQuery: null,\n subscriptions: new Set(),\n }\n );\n }\n\n private setQuery(\n queryId: string,\n updater: (prev: QueryInfo) => Pick | void,\n ) {\n const prev = this.getQuery(queryId);\n const newInfo = { ...prev, ...updater(prev) };\n this.queries.set(queryId, newInfo);\n }\n\n private invalidate(\n queryId: string | undefined,\n invalidated = true,\n ) {\n if (queryId) {\n this.setQuery(queryId, () => ({ invalidated }));\n }\n }\n\n private prepareContext(context = {}) {\n const newContext = this.localState.prepareContext(context);\n return {\n ...newContext,\n clientAwareness: this.clientAwareness,\n };\n }\n\n public checkInFlight(queryId: string) {\n const query = this.queryStore.get(queryId);\n\n return (\n query &&\n query.networkStatus !== NetworkStatus.ready &&\n query.networkStatus !== NetworkStatus.error\n );\n }\n\n // Map from client ID to { interval, options }.\n private pollingInfoByQueryId = new Map();\n\n public startPollingQuery(\n options: WatchQueryOptions,\n queryId: string,\n listener?: QueryListener,\n ): string {\n const { pollInterval } = options;\n\n invariant(\n pollInterval,\n 'Attempted to start a polling query without a polling interval.',\n );\n\n // Do not poll in SSR mode\n if (!this.ssrMode) {\n let info = this.pollingInfoByQueryId.get(queryId)!;\n if (!info) {\n this.pollingInfoByQueryId.set(queryId, (info = {} as any));\n }\n\n info.interval = pollInterval!;\n info.options = {\n ...options,\n fetchPolicy: 'network-only',\n };\n\n const maybeFetch = () => {\n const info = this.pollingInfoByQueryId.get(queryId);\n if (info) {\n if (this.checkInFlight(queryId)) {\n poll();\n } else {\n this.fetchQuery(queryId, info.options, FetchType.poll).then(\n poll,\n poll,\n );\n }\n }\n };\n\n const poll = () => {\n const info = this.pollingInfoByQueryId.get(queryId);\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n\n if (listener) {\n this.addQueryListener(queryId, listener);\n }\n\n poll();\n }\n\n return queryId;\n }\n\n public stopPollingQuery(queryId: string) {\n this.pollingInfoByQueryId.delete(queryId);\n }\n}\n","import { ExecutionResult, DocumentNode } from 'graphql';\nimport { ApolloCache, Cache, DataProxy } from 'apollo-cache';\n\nimport { QueryStoreValue } from '../data/queries';\nimport {\n getOperationName,\n tryFunctionOrLogError,\n graphQLResultHasError,\n} from 'apollo-utilities';\nimport { MutationQueryReducer } from '../core/types';\n\nexport type QueryWithUpdater = {\n updater: MutationQueryReducer;\n query: QueryStoreValue;\n};\n\nexport interface DataWrite {\n rootId: string;\n result: any;\n document: DocumentNode;\n operationName: string | null;\n variables: Object;\n}\n\nexport class DataStore {\n private cache: ApolloCache;\n\n constructor(initialCache: ApolloCache) {\n this.cache = initialCache;\n }\n\n public getCache(): ApolloCache {\n return this.cache;\n }\n\n public markQueryResult(\n result: ExecutionResult,\n document: DocumentNode,\n variables: any,\n fetchMoreForQueryId: string | undefined,\n ignoreErrors: boolean = false,\n ) {\n let writeWithErrors = !graphQLResultHasError(result);\n if (ignoreErrors && graphQLResultHasError(result) && result.data) {\n writeWithErrors = true;\n }\n if (!fetchMoreForQueryId && writeWithErrors) {\n this.cache.write({\n result: result.data,\n dataId: 'ROOT_QUERY',\n query: document,\n variables: variables,\n });\n }\n }\n\n public markSubscriptionResult(\n result: ExecutionResult,\n document: DocumentNode,\n variables: any,\n ) {\n // the subscription interface should handle not sending us results we no longer subscribe to.\n // XXX I don't think we ever send in an object with errors, but we might in the future...\n if (!graphQLResultHasError(result)) {\n this.cache.write({\n result: result.data,\n dataId: 'ROOT_SUBSCRIPTION',\n query: document,\n variables: variables,\n });\n }\n }\n\n public markMutationInit(mutation: {\n mutationId: string;\n document: DocumentNode;\n variables: any;\n updateQueries: { [queryId: string]: QueryWithUpdater };\n update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined;\n optimisticResponse: Object | Function | undefined;\n }) {\n if (mutation.optimisticResponse) {\n let optimistic: Object;\n if (typeof mutation.optimisticResponse === 'function') {\n optimistic = mutation.optimisticResponse(mutation.variables);\n } else {\n optimistic = mutation.optimisticResponse;\n }\n\n this.cache.recordOptimisticTransaction(c => {\n const orig = this.cache;\n this.cache = c;\n\n try {\n this.markMutationResult({\n mutationId: mutation.mutationId,\n result: { data: optimistic },\n document: mutation.document,\n variables: mutation.variables,\n updateQueries: mutation.updateQueries,\n update: mutation.update,\n });\n } finally {\n this.cache = orig;\n }\n }, mutation.mutationId);\n }\n }\n\n public markMutationResult(mutation: {\n mutationId: string;\n result: ExecutionResult;\n document: DocumentNode;\n variables: any;\n updateQueries: { [queryId: string]: QueryWithUpdater };\n update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined;\n }) {\n // Incorporate the result from this mutation into the store\n if (!graphQLResultHasError(mutation.result)) {\n const cacheWrites: Cache.WriteOptions[] = [{\n result: mutation.result.data,\n dataId: 'ROOT_MUTATION',\n query: mutation.document,\n variables: mutation.variables,\n }];\n\n const { updateQueries } = mutation;\n if (updateQueries) {\n Object.keys(updateQueries).forEach(id => {\n const { query, updater } = updateQueries[id];\n\n // Read the current query result from the store.\n const { result: currentQueryResult, complete } = this.cache.diff({\n query: query.document,\n variables: query.variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n if (complete) {\n // Run our reducer using the current query result and the mutation result.\n const nextQueryResult = tryFunctionOrLogError(() =>\n updater(currentQueryResult, {\n mutationResult: mutation.result,\n queryName: getOperationName(query.document) || undefined,\n queryVariables: query.variables,\n }),\n );\n\n // Write the modified result back into the store if we got a new result.\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: 'ROOT_QUERY',\n query: query.document,\n variables: query.variables,\n });\n }\n }\n });\n }\n\n this.cache.performTransaction(c => {\n cacheWrites.forEach(write => c.write(write));\n\n // If the mutation has some writes associated with it then we need to\n // apply those writes to the store by running this reducer again with a\n // write action.\n const { update } = mutation;\n if (update) {\n tryFunctionOrLogError(() => update(c, mutation.result));\n }\n });\n }\n }\n\n public markMutationComplete({\n mutationId,\n optimisticResponse,\n }: {\n mutationId: string;\n optimisticResponse?: any;\n }) {\n if (optimisticResponse) {\n this.cache.removeOptimistic(mutationId);\n }\n }\n\n public markUpdateQueryResult(\n document: DocumentNode,\n variables: any,\n newResult: any,\n ) {\n this.cache.write({\n result: newResult,\n dataId: 'ROOT_QUERY',\n variables,\n query: document,\n });\n }\n\n public reset(): Promise {\n return this.cache.reset();\n }\n}\n","export const version = \"2.6.10\"","import {\n ApolloLink,\n FetchResult,\n GraphQLRequest,\n execute,\n} from 'apollo-link';\nimport { ExecutionResult, DocumentNode } from 'graphql';\nimport { ApolloCache, DataProxy } from 'apollo-cache';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { QueryManager } from './core/QueryManager';\nimport {\n ApolloQueryResult,\n OperationVariables,\n Resolvers,\n} from './core/types';\nimport { ObservableQuery } from './core/ObservableQuery';\nimport { LocalState, FragmentMatcher } from './core/LocalState';\nimport { Observable } from './util/Observable';\n\nimport {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n WatchQueryFetchPolicy,\n} from './core/watchQueryOptions';\n\nimport { DataStore } from './data/store';\n\nimport { version } from './version';\n\nexport interface DefaultOptions {\n watchQuery?: Partial;\n query?: Partial;\n mutate?: Partial;\n}\n\nlet hasSuggestedDevtools = false;\n\nexport type ApolloClientOptions = {\n link?: ApolloLink;\n cache: ApolloCache;\n ssrForceFetchDelay?: number;\n ssrMode?: boolean;\n connectToDevTools?: boolean;\n queryDeduplication?: boolean;\n defaultOptions?: DefaultOptions;\n assumeImmutableResults?: boolean;\n resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n fragmentMatcher?: FragmentMatcher;\n name?: string;\n version?: string;\n};\n\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over a {@link NetworkInterface} instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through {@link Observable} instances.\n */\nexport default class ApolloClient implements DataProxy {\n public link: ApolloLink;\n public store: DataStore;\n public cache: ApolloCache;\n public readonly queryManager: QueryManager;\n public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions = {};\n public readonly typeDefs: ApolloClientOptions['typeDefs'];\n\n private devToolsHookCb: Function;\n private resetStoreCallbacks: Array<() => Promise> = [];\n private clearStoreCallbacks: Array<() => Promise> = [];\n private localState: LocalState;\n\n /**\n * Constructs an instance of {@link ApolloClient}.\n *\n * @param link The {@link ApolloLink} over which GraphQL documents will be resolved into a response.\n *\n * @param cache The initial cache to use in the data store.\n *\n * @param ssrMode Determines whether this is being run in Server Side Rendering (SSR) mode.\n *\n * @param ssrForceFetchDelay Determines the time interval before we force fetch queries for a\n * server side render.\n *\n * @param queryDeduplication If set to false, a query will still be sent to the server even if a query\n * with identical parameters (query, variables, operationName) is already in flight.\n *\n * @param defaultOptions Used to set application wide defaults for the\n * options supplied to `watchQuery`, `query`, or\n * `mutate`.\n *\n * @param assumeImmutableResults When this option is true, the client will assume results\n * read from the cache are never mutated by application code,\n * which enables substantial performance optimizations. Passing\n * `{ freezeResults: true }` to the `InMemoryCache` constructor\n * can help enforce this immutability.\n *\n * @param name A custom name that can be used to identify this client, when\n * using Apollo client awareness features. E.g. \"iOS\".\n *\n * @param version A custom version that can be used to identify this client,\n * when using Apollo client awareness features. This is the\n * version of your client, which you may want to increment on\n * new builds. This is NOT the version of Apollo Client that\n * you are using.\n */\n constructor(options: ApolloClientOptions) {\n const {\n cache,\n ssrMode = false,\n ssrForceFetchDelay = 0,\n connectToDevTools,\n queryDeduplication = true,\n defaultOptions,\n assumeImmutableResults = false,\n resolvers,\n typeDefs,\n fragmentMatcher,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n } = options;\n\n let { link } = options;\n\n // If a link hasn't been defined, but local state resolvers have been set,\n // setup a default empty link.\n if (!link && resolvers) {\n link = ApolloLink.empty();\n }\n\n if (!link || !cache) {\n throw new InvariantError(\n \"In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\\n\" +\n \"These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\\n\" +\n \"For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup\"\n );\n }\n\n // remove apollo-client supported directives\n this.link = link;\n this.cache = cache;\n this.store = new DataStore(cache);\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || {};\n this.typeDefs = typeDefs;\n\n if (ssrForceFetchDelay) {\n setTimeout(\n () => (this.disableNetworkFetches = false),\n ssrForceFetchDelay,\n );\n }\n\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n\n // Attach the client instance to window to let us be found by chrome devtools, but only in\n // development mode\n const defaultConnectToDevTools =\n process.env.NODE_ENV !== 'production' &&\n typeof window !== 'undefined' &&\n !(window as any).__APOLLO_CLIENT__;\n\n if (\n typeof connectToDevTools === 'undefined'\n ? defaultConnectToDevTools\n : connectToDevTools && typeof window !== 'undefined'\n ) {\n (window as any).__APOLLO_CLIENT__ = this;\n }\n\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && process.env.NODE_ENV !== 'production') {\n hasSuggestedDevtools = true;\n if (\n typeof window !== 'undefined' &&\n window.document &&\n window.top === window.self\n ) {\n // First check if devtools is not installed\n if (\n typeof (window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined'\n ) {\n // Only for Chrome\n if (\n window.navigator &&\n window.navigator.userAgent &&\n window.navigator.userAgent.indexOf('Chrome') > -1\n ) {\n // tslint:disable-next-line\n console.debug(\n 'Download the Apollo DevTools ' +\n 'for a better development experience: ' +\n 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm',\n );\n }\n }\n }\n }\n\n this.version = version;\n\n this.localState = new LocalState({\n cache,\n client: this,\n resolvers,\n fragmentMatcher,\n });\n\n this.queryManager = new QueryManager({\n link: this.link,\n store: this.store,\n queryDeduplication,\n ssrMode,\n clientAwareness: {\n name: clientAwarenessName!,\n version: clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast: () => {\n if (this.devToolsHookCb) {\n this.devToolsHookCb({\n action: {},\n state: {\n queries: this.queryManager.queryStore.getStore(),\n mutations: this.queryManager.mutationStore.getStore(),\n },\n dataWithOptimisticResults: this.cache.extract(true),\n });\n }\n },\n });\n }\n\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n public stop() {\n this.queryManager.stop();\n }\n\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and\n * receive updated results through a GraphQL observer when the cache store changes.\n *

\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *

\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifer, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *

\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *

\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n public watchQuery(\n options: WatchQueryOptions,\n ): ObservableQuery {\n if (this.defaultOptions.watchQuery) {\n options = {\n ...this.defaultOptions.watchQuery,\n ...options,\n } as WatchQueryOptions;\n }\n\n // XXX Overwriting options is probably not the best way to do this long term...\n if (\n this.disableNetworkFetches &&\n (options.fetchPolicy === 'network-only' ||\n options.fetchPolicy === 'cache-and-network')\n ) {\n options = { ...options, fetchPolicy: 'cache-first' };\n }\n\n return this.queryManager.watchQuery(options);\n }\n\n /**\n * This resolves a single query according to the options specified and\n * returns a {@link Promise} which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options An object of type {@link QueryOptions} that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n public query(\n options: QueryOptions,\n ): Promise> {\n if (this.defaultOptions.query) {\n options = { ...this.defaultOptions.query, ...options } as QueryOptions<\n TVariables\n >;\n }\n\n invariant(\n (options.fetchPolicy as WatchQueryFetchPolicy) !== 'cache-and-network',\n 'The cache-and-network fetchPolicy does not work with client.query, because ' +\n 'client.query can only return a single result. Please use client.watchQuery ' +\n 'to receive multiple results from the cache and the network, or consider ' +\n 'using a different fetchPolicy, such as cache-first or network-only.'\n );\n\n if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {\n options = { ...options, fetchPolicy: 'cache-first' };\n }\n\n return this.queryManager.query(options);\n }\n\n /**\n * This resolves a single mutation according to the options specified and returns a\n * {@link Promise} which is either resolved with the resulting data or rejected with an\n * error.\n *\n * It takes options as an object with the following keys and values:\n */\n public mutate(\n options: MutationOptions,\n ): Promise> {\n if (this.defaultOptions.mutate) {\n options = {\n ...this.defaultOptions.mutate,\n ...options,\n } as MutationOptions;\n }\n\n return this.queryManager.mutate(options);\n }\n\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * {@link Observable} which either emits received data or an error.\n */\n public subscribe(\n options: SubscriptionOptions,\n ): Observable> {\n return this.queryManager.startGraphQLSubscription(options);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): T | null {\n return this.cache.readQuery(options, optimistic);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): T | null {\n return this.cache.readFragment(options, optimistic);\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n public writeQuery(\n options: DataProxy.WriteQueryOptions,\n ): void {\n const result = this.cache.writeQuery(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n public writeFragment(\n options: DataProxy.WriteFragmentOptions,\n ): void {\n const result = this.cache.writeFragment(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n /**\n * Sugar for writeQuery & writeFragment\n * This method will construct a query from the data object passed in.\n * If no id is supplied, writeData will write the data to the root.\n * If an id is supplied, writeData will write a fragment to the object\n * specified by the id in the store.\n *\n * Since you aren't passing in a query to check the shape of the data,\n * you must pass in an object that conforms to the shape of valid GraphQL data.\n */\n public writeData(\n options: DataProxy.WriteDataOptions,\n ): void {\n const result = this.cache.writeData(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n public __actionHookForDevTools(cb: () => any) {\n this.devToolsHookCb = cb;\n }\n\n public __requestRaw(payload: GraphQLRequest): Observable {\n return execute(this.link, payload);\n }\n\n /**\n * This initializes the query manager that tracks queries and the cache\n */\n public initQueryManager(): QueryManager {\n invariant.warn(\n 'Calling the initQueryManager method is no longer necessary, ' +\n 'and it will be removed from ApolloClient in version 3.0.',\n );\n return this.queryManager;\n }\n\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public resetStore(): Promise[] | null> {\n return Promise.resolve()\n .then(() => this.queryManager.clearStore())\n .then(() => Promise.all(this.resetStoreCallbacks.map(fn => fn())))\n .then(() => this.reFetchObservableQueries());\n }\n\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n public clearStore(): Promise {\n return Promise.resolve()\n .then(() => this.queryManager.clearStore())\n .then(() => Promise.all(this.clearStoreCallbacks.map(fn => fn())));\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onResetStore(cb: () => Promise): () => void {\n this.resetStoreCallbacks.push(cb);\n return () => {\n this.resetStoreCallbacks = this.resetStoreCallbacks.filter(c => c !== cb);\n };\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onClearStore(cb: () => Promise): () => void {\n this.clearStoreCallbacks.push(cb);\n return () => {\n this.clearStoreCallbacks = this.clearStoreCallbacks.filter(c => c !== cb);\n };\n }\n\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n public reFetchObservableQueries(\n includeStandby?: boolean,\n ): Promise[]> {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n }\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public extract(optimistic?: boolean): TCacheShape {\n return this.cache.extract(optimistic);\n }\n\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public restore(serializedState: TCacheShape): ApolloCache {\n return this.cache.restore(serializedState);\n }\n\n /**\n * Add additional local resolvers.\n */\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\n */\n public setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-client/bundle.cjs.min.js b/node_modules/apollo-client/bundle.cjs.min.js deleted file mode 100644 index 0448cd83..00000000 --- a/node_modules/apollo-client/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.isApolloError=h,exports.ObservableQuery=exports.NetworkStatus=exports.FetchType=exports.ApolloError=exports.ApolloClient=exports.default=void 0;var e,t,r=require("tslib"),o=require("apollo-utilities"),n=require("apollo-link"),s=(e=require("symbol-observable"))&&e.__esModule?e:{default:e},i=require("ts-invariant"),a=require("graphql/language/visitor");function u(e){return e<7}exports.NetworkStatus=t,function(e){e[e.loading=1]="loading",e[e.setVariables=2]="setVariables",e[e.fetchMore=3]="fetchMore",e[e.refetch=4]="refetch",e[e.poll=6]="poll",e[e.ready=7]="ready",e[e.error=8]="error"}(t||(exports.NetworkStatus=t={}));var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype[s.default]=function(){return this},t.prototype["@@observable"]=function(){return this},t}(n.Observable);function l(e){return Array.isArray(e)&&e.length>0}function h(e){return e.hasOwnProperty("graphQLErrors")}var p,y=function(e){var t="";return l(e.graphQLErrors)&&e.graphQLErrors.forEach(function(e){var r=e?e.message:"Error message not found.";t+="GraphQL error: "+r+"\n"}),e.networkError&&(t+="Network error: "+e.networkError.message+"\n"),t=t.replace(/\n$/,"")},f=function(e){function t(r){var o=r.graphQLErrors,n=r.networkError,s=r.errorMessage,i=r.extraInfo,a=e.call(this,s)||this;return a.graphQLErrors=o||[],a.networkError=n||null,a.message=s||y(a),a.extraInfo=i,a.__proto__=t.prototype,a}return(0,r.__extends)(t,e),t}(Error);exports.ApolloError=f,exports.FetchType=p,function(e){e[e.normal=1]="normal",e[e.refetch=2]="refetch",e[e.poll=3]="poll"}(p||(exports.FetchType=p={}));var v=function(e){function n(t){var r=t.queryManager,n=t.options,s=t.shouldSubscribe,i=void 0===s||s,a=e.call(this,function(e){return a.onSubscribe(e)})||this;a.observers=new Set,a.subscriptions=new Set,a.isTornDown=!1,a.options=n,a.variables=n.variables||{},a.queryId=r.generateQueryId(),a.shouldSubscribe=i;var u=(0,o.getOperationDefinition)(n.query);return a.queryName=u&&u.name&&u.name.value,a.queryManager=r,a}return(0,r.__extends)(n,e),n.prototype.result=function(){var e=this;return new Promise(function(t,r){var o={next:function(r){t(r),e.observers.delete(o),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout(function(){n.unsubscribe()},0)},error:r},n=e.subscribe(o)})},n.prototype.currentResult=function(){var e=this.getCurrentResult();return void 0===e.data&&(e.data={}),e},n.prototype.getCurrentResult=function(){if(this.isTornDown){var e=this.lastResult;return{data:!this.lastError&&e&&e.data||void 0,error:this.lastError,loading:!1,networkStatus:t.error}}var o,n,s,i=this.queryManager.getCurrentQueryResult(this),a=i.data,c=i.partial,h=this.queryManager.queryStore.get(this.queryId),p=this.options.fetchPolicy,y="network-only"===p||"no-cache"===p;if(h){var v=h.networkStatus;if(n=h,void 0===(s=this.options.errorPolicy)&&(s="none"),n&&(n.networkError||"none"===s&&l(n.graphQLErrors)))return{data:void 0,loading:!1,networkStatus:v,error:new f({graphQLErrors:h.graphQLErrors,networkError:h.networkError})};h.variables&&(this.options.variables=(0,r.__assign)((0,r.__assign)({},this.options.variables),h.variables),this.variables=this.options.variables),o={data:a,loading:u(v),networkStatus:v},h.graphQLErrors&&"all"===this.options.errorPolicy&&(o.errors=h.graphQLErrors)}else{var d=y||c&&"cache-only"!==p;o={data:a,loading:d,networkStatus:d?t.loading:t.ready}}return c||this.updateLastResult((0,r.__assign)((0,r.__assign)({},o),{stale:!1})),(0,r.__assign)((0,r.__assign)({},o),{partial:c})},n.prototype.isDifferentFromLastResult=function(e){var t=this.lastResultSnapshot;return!(t&&e&&t.networkStatus===e.networkStatus&&t.stale===e.stale&&(0,o.isEqual)(t.data,e.data))},n.prototype.getLastResult=function(){return this.lastResult},n.prototype.getLastError=function(){return this.lastError},n.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},n.prototype.resetQueryStoreErrors=function(){var e=this.queryManager.queryStore.get(this.queryId);e&&(e.networkError=null,e.graphQLErrors=[])},n.prototype.refetch=function(e){var t=this.options.fetchPolicy;return"cache-only"===t?Promise.reject(new i.InvariantError(1)):("no-cache"!==t&&"cache-and-network"!==t&&(t="network-only"),(0,o.isEqual)(this.variables,e)||(this.variables=(0,r.__assign)((0,r.__assign)({},this.variables),e)),(0,o.isEqual)(this.options.variables,this.variables)||(this.options.variables=(0,r.__assign)((0,r.__assign)({},this.options.variables),this.variables)),this.queryManager.fetchQuery(this.queryId,(0,r.__assign)((0,r.__assign)({},this.options),{fetchPolicy:t}),p.refetch))},n.prototype.fetchMore=function(e){var t=this;(0,i.invariant)(e.updateQuery,2);var o=(0,r.__assign)((0,r.__assign)({},e.query?e:(0,r.__assign)((0,r.__assign)((0,r.__assign)({},this.options),e),{variables:(0,r.__assign)((0,r.__assign)({},this.variables),e.variables)})),{fetchPolicy:"network-only"}),n=this.queryManager.generateQueryId();return this.queryManager.fetchQuery(n,o,p.normal,this.queryId).then(function(r){return t.updateQuery(function(t){return e.updateQuery(t,{fetchMoreResult:r.data,variables:o.variables})}),t.queryManager.stopQuery(n),r},function(e){throw t.queryManager.stopQuery(n),e})},n.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables}).subscribe({next:function(r){var o=e.updateQuery;o&&t.updateQuery(function(e,t){var n=t.variables;return o(e,{subscriptionData:r,variables:n})})},error:function(t){e.onError&&e.onError(t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},n.prototype.setOptions=function(e){var t=this.options.fetchPolicy;this.options=(0,r.__assign)((0,r.__assign)({},this.options),e),e.pollInterval?this.startPolling(e.pollInterval):0===e.pollInterval&&this.stopPolling();var o=e.fetchPolicy;return this.setVariables(this.options.variables,t!==o&&("cache-only"===t||"standby"===t||"network-only"===o),e.fetchResults)},n.prototype.setVariables=function(e,t,r){return void 0===t&&(t=!1),void 0===r&&(r=!0),this.isTornDown=!1,e=e||this.variables,!t&&(0,o.isEqual)(e,this.variables)?this.observers.size&&r?this.result():Promise.resolve():(this.variables=this.options.variables=e,this.observers.size?this.queryManager.fetchQuery(this.queryId,this.options):Promise.resolve())},n.prototype.updateQuery=function(e){var t=this.queryManager,r=t.getQueryWithPreviousResult(this.queryId),n=r.previousResult,s=r.variables,i=r.document,a=(0,o.tryFunctionOrLogError)(function(){return e(n,{variables:s})});a&&(t.dataStore.markUpdateQueryResult(i,s,a),t.broadcastQueries())},n.prototype.stopPolling=function(){this.queryManager.stopPollingQuery(this.queryId),this.options.pollInterval=void 0},n.prototype.startPolling=function(e){g(this),this.options.pollInterval=e,this.queryManager.startPollingQuery(this.options,this.queryId)},n.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:(0,o.cloneDeep)(e),t},n.prototype.onSubscribe=function(e){var t=this;try{var r=e._subscription._observer;r&&!r.error&&(r.error=d)}catch(e){}var o=!this.observers.size;return this.observers.add(e),e.next&&this.lastResult&&e.next(this.lastResult),e.error&&this.lastError&&e.error(this.lastError),o&&this.setUpQuery(),function(){t.observers.delete(e)&&!t.observers.size&&t.tearDownQuery()}},n.prototype.setUpQuery=function(){var e=this,n=this.queryManager,s=this.queryId;this.shouldSubscribe&&n.addObservableQuery(s,this),this.options.pollInterval&&(g(this),n.startPollingQuery(this.options,s));var i=function(o){e.updateLastResult((0,r.__assign)((0,r.__assign)({},e.lastResult),{errors:o.graphQLErrors,networkStatus:t.error,loading:!1})),b(e.observers,"error",e.lastError=o)};n.observeQuery(s,this.options,{next:function(t){if(e.lastError||e.isDifferentFromLastResult(t)){var r=e.updateLastResult(t),s=e.options,i=s.query,a=s.variables,u=s.fetchPolicy;n.transform(i).hasClientExports?n.getLocalState().addExportedVariables(i,a).then(function(s){var a=e.variables;e.variables=e.options.variables=s,!t.loading&&r&&"cache-only"!==u&&n.transform(i).serverQuery&&!(0,o.isEqual)(a,s)?e.refetch():b(e.observers,"next",t)}):b(e.observers,"next",t)}},error:i}).catch(i)},n.prototype.tearDownQuery=function(){var e=this.queryManager;this.isTornDown=!0,e.stopPollingQuery(this.queryId),this.subscriptions.forEach(function(e){return e.unsubscribe()}),this.subscriptions.clear(),e.removeObservableQuery(this.queryId),e.stopQuery(this.queryId),this.observers.clear()},n}(c);function d(e){}function b(e,t,r){var o=[];e.forEach(function(e){return e[t]&&o.push(e)}),o.forEach(function(e){return e[t](r)})}function g(e){var t=e.options.fetchPolicy;(0,i.invariant)("cache-first"!==t&&"cache-only"!==t,3)}exports.ObservableQuery=v;var m=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initMutation=function(e,t,r){this.store[e]={mutation:t,variables:r||{},loading:!0,error:null}},e.prototype.markMutationError=function(e,t){var r=this.store[e];r&&(r.loading=!1,r.error=t)},e.prototype.markMutationResult=function(e){var t=this.store[e];t&&(t.loading=!1,t.error=null)},e.prototype.reset=function(){this.store={}},e}(),Q=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initQuery=function(e){var r=this.store[e.queryId];(0,i.invariant)(!r||r.document===e.document||(0,o.isEqual)(r.document,e.document),19);var n,s=!1,a=null;e.storePreviousVariables&&r&&r.networkStatus!==t.loading&&((0,o.isEqual)(r.variables,e.variables)||(s=!0,a=r.variables)),n=s?t.setVariables:e.isPoll?t.poll:e.isRefetch?t.refetch:t.loading;var u=[];r&&r.graphQLErrors&&(u=r.graphQLErrors),this.store[e.queryId]={document:e.document,variables:e.variables,previousVariables:a,networkError:null,graphQLErrors:u,networkStatus:n,metadata:e.metadata},"string"==typeof e.fetchMoreForQueryId&&this.store[e.fetchMoreForQueryId]&&(this.store[e.fetchMoreForQueryId].networkStatus=t.fetchMore)},e.prototype.markQueryResult=function(e,r,o){this.store&&this.store[e]&&(this.store[e].networkError=null,this.store[e].graphQLErrors=l(r.errors)?r.errors:[],this.store[e].previousVariables=null,this.store[e].networkStatus=t.ready,"string"==typeof o&&this.store[o]&&(this.store[o].networkStatus=t.ready))},e.prototype.markQueryError=function(e,r,o){this.store&&this.store[e]&&(this.store[e].networkError=r,this.store[e].networkStatus=t.error,"string"==typeof o&&this.markQueryResultClient(o,!0))},e.prototype.markQueryResultClient=function(e,r){var o=this.store&&this.store[e];o&&(o.networkError=null,o.previousVariables=null,r&&(o.networkStatus=t.ready))},e.prototype.stopQuery=function(e){delete this.store[e]},e.prototype.reset=function(e){var r=this;Object.keys(this.store).forEach(function(o){e.indexOf(o)<0?r.stopQuery(o):r.store[o].networkStatus=t.loading})},e}();var _=function(){function e(e){var t=e.cache,r=e.client,o=e.resolvers,n=e.fragmentMatcher;this.cache=t,r&&(this.client=r),o&&this.addResolvers(o),n&&this.setFragmentMatcher(n)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(e){t.resolvers=(0,o.mergeDeep)(t.resolvers,e)}):this.resolvers=(0,o.mergeDeep)(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var t=e.document,o=e.remoteResult,n=e.context,s=e.variables,i=e.onlyRunForcedResolvers,a=void 0!==i&&i;return(0,r.__awaiter)(this,void 0,void 0,function(){return(0,r.__generator)(this,function(e){return t?[2,this.resolveDocument(t,o.data,n,s,this.fragmentMatcher,a).then(function(e){return(0,r.__assign)((0,r.__assign)({},o),{data:e.result})})]:[2,o]})})},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return(0,o.hasDirectives)(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return this.resolvers?(0,o.removeClientSetsFromDocument)(e):e},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.cache;return(0,r.__assign)((0,r.__assign)({},e),{cache:t,getCacheKey:function(e){if(t.config)return t.config.dataIdFromObject(e);(0,i.invariant)(!1,6)}})},e.prototype.addExportedVariables=function(e,t,o){return void 0===t&&(t={}),void 0===o&&(o={}),(0,r.__awaiter)(this,void 0,void 0,function(){return(0,r.__generator)(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(o),t).then(function(e){return(0,r.__assign)((0,r.__assign)({},t),e.exportedVariables)})]:[2,(0,r.__assign)({},t)]})})},e.prototype.shouldForceResolvers=function(e){var t=!1;return(0,a.visit)(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some(function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value})))return a.BREAK}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:(0,o.buildQueryFromSelectionSet)(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,t,n,s,i,a){return void 0===n&&(n={}),void 0===s&&(s={}),void 0===i&&(i=function(){return!0}),void 0===a&&(a=!1),(0,r.__awaiter)(this,void 0,void 0,function(){var u,c,l,h,p,y,f,v,d;return(0,r.__generator)(this,function(b){var g;return u=(0,o.getMainDefinition)(e),c=(0,o.getFragmentDefinitions)(e),l=(0,o.createFragmentMap)(c),h=u.operation,p=h?(g=h).charAt(0).toUpperCase()+g.slice(1):"Query",f=(y=this).cache,v=y.client,d={fragmentMap:l,context:(0,r.__assign)((0,r.__assign)({},n),{cache:f,client:v}),variables:s,fragmentMatcher:i,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(u.selectionSet,t,d).then(function(e){return{result:e,exportedVariables:d.exportedVariables}})]})})},e.prototype.resolveSelectionSet=function(e,t,n){return(0,r.__awaiter)(this,void 0,void 0,function(){var s,a,u,c,l,h=this;return(0,r.__generator)(this,function(p){return s=n.fragmentMap,a=n.context,u=n.variables,c=[t],l=function(e){return(0,r.__awaiter)(h,void 0,void 0,function(){var l,h;return(0,r.__generator)(this,function(r){return(0,o.shouldInclude)(e,u)?(0,o.isField)(e)?[2,this.resolveField(e,t,n).then(function(t){var r;void 0!==t&&c.push(((r={})[(0,o.resultKeyNameFromField)(e)]=t,r))})]:((0,o.isInlineFragment)(e)?l=e:(l=s[e.name.value],(0,i.invariant)(l,7)),l&&l.typeCondition&&(h=l.typeCondition.name.value,n.fragmentMatcher(t,h,a))?[2,this.resolveSelectionSet(l.selectionSet,t,n).then(function(e){c.push(e)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(l)).then(function(){return(0,o.mergeDeepArray)(c)})]})})},e.prototype.resolveField=function(e,t,n){return(0,r.__awaiter)(this,void 0,void 0,function(){var s,i,a,u,c,l,h,p,y,f=this;return(0,r.__generator)(this,function(r){return s=n.variables,i=e.name.value,a=(0,o.resultKeyNameFromField)(e),u=i!==a,c=t[a]||t[i],l=Promise.resolve(c),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(h=t.__typename||n.defaultOperationType,(p=this.resolvers&&this.resolvers[h])&&(y=p[u?i:a])&&(l=Promise.resolve(y(t,(0,o.argumentsObjectFromField)(e,s),n.context,{field:e,fragmentMap:n.fragmentMap})))),[2,l.then(function(t){return void 0===t&&(t=c),e.directives&&e.directives.forEach(function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach(function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=t)})}),e.selectionSet?null==t?t:Array.isArray(t)?f.resolveSubSelectedArray(e,t,n):e.selectionSet?f.resolveSelectionSet(e.selectionSet,t,n):void 0:t})]})})},e.prototype.resolveSubSelectedArray=function(e,t,r){var o=this;return Promise.all(t.map(function(t){return null===t?null:Array.isArray(t)?o.resolveSubSelectedArray(e,t,r):e.selectionSet?o.resolveSelectionSet(e.selectionSet,t,r):void 0}))},e}();function w(e){var t=new Set,r=null;return new c(function(o){return t.add(o),r=r||e.subscribe({next:function(e){t.forEach(function(t){return t.next&&t.next(e)})},error:function(e){t.forEach(function(t){return t.error&&t.error(e)})},complete:function(){t.forEach(function(e){return e.complete&&e.complete()})}}),function(){t.delete(o)&&!t.size&&r&&(r.unsubscribe(),r=null)}})}var S=Object.prototype.hasOwnProperty,q=function(){function e(e){var t=e.link,r=e.queryDeduplication,n=void 0!==r&&r,s=e.store,i=e.onBroadcast,a=void 0===i?function(){}:i,u=e.ssrMode,c=void 0!==u&&u,l=e.clientAwareness,h=void 0===l?{}:l,p=e.localState,y=e.assumeImmutableResults;this.mutationStore=new m,this.queryStore=new Q,this.clientAwareness={},this.idCounter=1,this.queries=new Map,this.fetchQueryRejectFns=new Map,this.transformCache=new(o.canUseWeakMap?WeakMap:Map),this.inFlightLinkObservables=new Map,this.pollingInfoByQueryId=new Map,this.link=t,this.queryDeduplication=n,this.dataStore=s,this.onBroadcast=a,this.clientAwareness=h,this.localState=p||new _({cache:s.getCache()}),this.ssrMode=c,this.assumeImmutableResults=!!y}return e.prototype.stop=function(){var e=this;this.queries.forEach(function(t,r){e.stopQueryNoBroadcast(r)}),this.fetchQueryRejectFns.forEach(function(e){e(new i.InvariantError(8))})},e.prototype.mutate=function(e){var t=e.mutation,n=e.variables,s=e.optimisticResponse,a=e.updateQueries,u=e.refetchQueries,c=void 0===u?[]:u,h=e.awaitRefetchQueries,p=void 0!==h&&h,y=e.update,v=e.errorPolicy,d=void 0===v?"none":v,b=e.fetchPolicy,g=e.context,m=void 0===g?{}:g;return(0,r.__awaiter)(this,void 0,void 0,function(){var e,u,h,v=this;return(0,r.__generator)(this,function(g){switch(g.label){case 0:return(0,i.invariant)(t,9),(0,i.invariant)(!b||"no-cache"===b,10),e=this.generateQueryId(),t=this.transform(t).document,this.setQuery(e,function(){return{document:t}}),n=this.getVariables(t,n),this.transform(t).hasClientExports?[4,this.localState.addExportedVariables(t,n,m)]:[3,2];case 1:n=g.sent(),g.label=2;case 2:return u=function(){var e={};return a&&v.queries.forEach(function(t,r){var o=t.observableQuery;if(o){var n=o.queryName;n&&S.call(a,n)&&(e[r]={updater:a[n],query:v.queryStore.get(r)})}}),e},this.mutationStore.initMutation(e,t,n),this.dataStore.markMutationInit({mutationId:e,document:t,variables:n,updateQueries:u(),update:y,optimisticResponse:s}),this.broadcastQueries(),h=this,[2,new Promise(function(i,a){var v,g;h.getObservableFromLink(t,(0,r.__assign)((0,r.__assign)({},m),{optimisticResponse:s}),n,!1).subscribe({next:function(r){(0,o.graphQLResultHasError)(r)&&"none"===d?g=new f({graphQLErrors:r.errors}):(h.mutationStore.markMutationResult(e),"no-cache"!==b&&h.dataStore.markMutationResult({mutationId:e,result:r,document:t,variables:n,updateQueries:u(),update:y}),v=r)},error:function(t){h.mutationStore.markMutationError(e,t),h.dataStore.markMutationComplete({mutationId:e,optimisticResponse:s}),h.broadcastQueries(),h.setQuery(e,function(){return{document:null}}),a(new f({networkError:t}))},complete:function(){if(g&&h.mutationStore.markMutationError(e,g),h.dataStore.markMutationComplete({mutationId:e,optimisticResponse:s}),h.broadcastQueries(),g)a(g);else{"function"==typeof c&&(c=c(v));var t=[];l(c)&&c.forEach(function(e){if("string"==typeof e)h.queries.forEach(function(r){var o=r.observableQuery;o&&o.queryName===e&&t.push(o.refetch())});else{var r={query:e.query,variables:e.variables,fetchPolicy:"network-only"};e.context&&(r.context=e.context),t.push(h.query(r))}}),Promise.all(p?t:[]).then(function(){h.setQuery(e,function(){return{document:null}}),"ignore"===d&&v&&(0,o.graphQLResultHasError)(v)&&delete v.errors,i(v)})}}})})]}})})},e.prototype.fetchQuery=function(e,t,n,s){return(0,r.__awaiter)(this,void 0,void 0,function(){var i,a,u,c,l,y,v,d,b,g,m,Q,_,w,S,q,R,k,E=this;return(0,r.__generator)(this,function(M){switch(M.label){case 0:return i=t.metadata,a=void 0===i?null:i,u=t.fetchPolicy,c=void 0===u?"cache-first":u,l=t.context,y=void 0===l?{}:l,v=this.transform(t.query).document,d=this.getVariables(v,t.variables),this.transform(v).hasClientExports?[4,this.localState.addExportedVariables(v,d,y)]:[3,2];case 1:d=M.sent(),M.label=2;case 2:if(t=(0,r.__assign)((0,r.__assign)({},t),{variables:d}),m=g="network-only"===c||"no-cache"===c,g||(Q=this.dataStore.getCache().diff({query:v,variables:d,returnPartialData:!0,optimistic:!1}),_=Q.complete,w=Q.result,m=!_||"cache-and-network"===c,b=w),S=m&&"cache-only"!==c&&"standby"!==c,(0,o.hasDirectives)(["live"],v)&&(S=!0),q=this.idCounter++,R="no-cache"!==c?this.updateQueryWatch(e,v,t):void 0,this.setQuery(e,function(){return{document:v,lastRequestId:q,invalidated:!0,cancel:R}}),this.invalidate(s),this.queryStore.initQuery({queryId:e,document:v,storePreviousVariables:S,variables:d,isPoll:n===p.poll,isRefetch:n===p.refetch,metadata:a,fetchMoreForQueryId:s}),this.broadcastQueries(),S){if(k=this.fetchRequest({requestId:q,queryId:e,document:v,options:t,fetchMoreForQueryId:s}).catch(function(t){throw h(t)?t:(q>=E.getQuery(e).lastRequestId&&(E.queryStore.markQueryError(e,t,s),E.invalidate(e),E.invalidate(s),E.broadcastQueries()),new f({networkError:t}))}),"cache-and-network"!==c)return[2,k];k.catch(function(){})}return this.queryStore.markQueryResultClient(e,!S),this.invalidate(e),this.invalidate(s),this.transform(v).hasForcedResolvers?[2,this.localState.runResolvers({document:v,remoteResult:{data:b},context:y,variables:d,onlyRunForcedResolvers:!0}).then(function(r){return E.markQueryResult(e,r,t,s),E.broadcastQueries(),r})]:(this.broadcastQueries(),[2,{data:b}])}})})},e.prototype.markQueryResult=function(e,t,r,o){var n=r.fetchPolicy,s=r.variables,i=r.errorPolicy;"no-cache"===n?this.setQuery(e,function(){return{newData:{result:t.data,complete:!0}}}):this.dataStore.markQueryResult(t,this.getQuery(e).document,s,o,"ignore"===i||"all"===i)},e.prototype.queryListenerForObserver=function(e,t,r){var o=this;function n(e,t){if(r[e])try{r[e](t)}catch(e){}}return function(r,s){if(o.invalidate(e,!1),r){var i=o.getQuery(e),a=i.observableQuery,c=i.document,h=a?a.options.fetchPolicy:t.fetchPolicy;if("standby"!==h){var p=u(r.networkStatus),y=a&&a.getLastResult(),v=!(!y||y.networkStatus===r.networkStatus),d=t.returnPartialData||!s&&r.previousVariables||v&&t.notifyOnNetworkStatusChange||"cache-only"===h||"cache-and-network"===h;if(!p||d){var b=l(r.graphQLErrors),g=a&&a.options.errorPolicy||t.errorPolicy||"none";if("none"===g&&b||r.networkError)return n("error",new f({graphQLErrors:r.graphQLErrors,networkError:r.networkError}));try{var m=void 0,Q=void 0;if(s)"no-cache"!==h&&"network-only"!==h&&o.setQuery(e,function(){return{newData:null}}),m=s.result,Q=!s.complete;else{var _=a&&a.getLastError(),w="none"!==g&&(_&&_.graphQLErrors)!==r.graphQLErrors;if(y&&y.data&&!w)m=y.data,Q=!1;else{var S=o.dataStore.getCache().diff({query:c,variables:r.previousVariables||r.variables,returnPartialData:!0,optimistic:!0});m=S.result,Q=!S.complete}}var q=Q&&!(t.returnPartialData||"cache-only"===h),R={data:q?y&&y.data:m,loading:p,networkStatus:r.networkStatus,stale:q};"all"===g&&b&&(R.errors=r.graphQLErrors),n("next",R)}catch(e){n("error",new f({networkError:e}))}}}}}},e.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var r=this.dataStore.getCache(),n=r.transformDocument(e),s=(0,o.removeConnectionDirectiveFromDocument)(r.transformForLink(n)),i=this.localState.clientQuery(n),a=this.localState.serverQuery(s),u={document:n,hasClientExports:(0,o.hasClientExports)(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:i,serverQuery:a,defaultVars:(0,o.getDefaultValues)((0,o.getOperationDefinition)(n))},c=function(e){e&&!t.has(e)&&t.set(e,u)};c(e),c(n),c(i),c(a)}return t.get(e)},e.prototype.getVariables=function(e,t){return(0,r.__assign)((0,r.__assign)({},this.transform(e).defaultVars),t)},e.prototype.watchQuery=function(e,t){void 0===t&&(t=!0),(0,i.invariant)("standby"!==e.fetchPolicy,11),e.variables=this.getVariables(e.query,e.variables),void 0===e.notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var o=(0,r.__assign)({},e);return new v({queryManager:this,options:o,shouldSubscribe:t})},e.prototype.query=function(e){var t=this;return(0,i.invariant)(e.query,12),(0,i.invariant)("Document"===e.query.kind,13),(0,i.invariant)(!e.returnPartialData,14),(0,i.invariant)(!e.pollInterval,15),new Promise(function(r,o){var n=t.watchQuery(e,!1);t.fetchQueryRejectFns.set("query:"+n.queryId,o),n.result().then(r,o).then(function(){return t.fetchQueryRejectFns.delete("query:"+n.queryId)})})},e.prototype.generateQueryId=function(){return String(this.idCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){this.stopPollingQuery(e),this.queryStore.stopQuery(e),this.invalidate(e)},e.prototype.addQueryListener=function(e,t){this.setQuery(e,function(e){return e.listeners.add(t),{invalidated:!1}})},e.prototype.updateQueryWatch=function(e,t,r){var o=this,n=this.getQuery(e).cancel;n&&n();return this.dataStore.getCache().watch({query:t,variables:r.variables,optimistic:!0,previousResult:function(){var t=null,r=o.getQuery(e).observableQuery;if(r){var n=r.getLastResult();n&&(t=n.data)}return t},callback:function(t){o.setQuery(e,function(){return{invalidated:!0,newData:t}})}})},e.prototype.addObservableQuery=function(e,t){this.setQuery(e,function(){return{observableQuery:t}})},e.prototype.removeObservableQuery=function(e){var t=this.getQuery(e).cancel;this.setQuery(e,function(){return{observableQuery:null}}),t&&t()},e.prototype.clearStore=function(){this.fetchQueryRejectFns.forEach(function(e){e(new i.InvariantError(16))});var e=[];return this.queries.forEach(function(t,r){t.observableQuery&&e.push(r)}),this.queryStore.reset(e),this.mutationStore.reset(),this.dataStore.reset()},e.prototype.resetStore=function(){var e=this;return this.clearStore().then(function(){return e.reFetchObservableQueries()})},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.queries.forEach(function(o,n){var s=o.observableQuery;if(s){var i=s.options.fetchPolicy;s.resetLastResults(),"cache-only"===i||!e&&"standby"===i||r.push(s.refetch()),t.setQuery(n,function(){return{newData:null}}),t.invalidate(n)}}),this.broadcastQueries(),Promise.all(r)},e.prototype.observeQuery=function(e,t,r){return this.addQueryListener(e,this.queryListenerForObserver(e,t,r)),this.fetchQuery(e,t)},e.prototype.startQuery=function(e,t,r){return this.addQueryListener(e,r),this.fetchQuery(e,t).catch(function(){}),e},e.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,s=e.variables;r=this.transform(r).document,s=this.getVariables(r,s);var i=function(e){return t.getObservableFromLink(r,{},e,!1).map(function(s){if(n&&"no-cache"===n||(t.dataStore.markSubscriptionResult(s,r,e),t.broadcastQueries()),(0,o.graphQLResultHasError)(s))throw new f({graphQLErrors:s.errors});return s})};if(this.transform(r).hasClientExports){var a=this.localState.addExportedVariables(r,s).then(i);return new c(function(e){var t=null;return a.then(function(r){return t=r.subscribe(e)},e.error),function(){return t&&t.unsubscribe()}})}return i(s)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchQueryRejectFns.delete("query:"+e),this.fetchQueryRejectFns.delete("fetchRequest:"+e),this.getQuery(e).subscriptions.forEach(function(e){return e.unsubscribe()}),this.queries.delete(e)},e.prototype.getCurrentQueryResult=function(e,t){void 0===t&&(t=!0);var r=e.options,o=r.variables,n=r.query,s=r.fetchPolicy,i=r.returnPartialData,a=e.getLastResult(),u=this.getQuery(e.queryId).newData;if(u&&u.complete)return{data:u.result,partial:!1};if("no-cache"===s||"network-only"===s)return{data:void 0,partial:!1};var c=this.dataStore.getCache().diff({query:n,variables:o,previousResult:a?a.data:void 0,returnPartialData:!0,optimistic:t}),l=c.result,h=c.complete;return{data:h||i?l:void 0,partial:!h}},e.prototype.getQueryWithPreviousResult=function(e){var t;if("string"==typeof e){var r=this.getQuery(e).observableQuery;(0,i.invariant)(r,17),t=r}else t=e;var o=t.options,n=o.variables,s=o.query;return{previousResult:this.getCurrentQueryResult(t,!1).data,variables:n,document:s}},e.prototype.broadcastQueries=function(){var e=this;this.onBroadcast(),this.queries.forEach(function(t,r){t.invalidated&&t.listeners.forEach(function(o){o&&o(e.queryStore.get(r),t.newData)})})},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,t,s,i){var a,u=this;void 0===i&&(i=this.queryDeduplication);var l=this.transform(e).serverQuery;if(l){var h=this.inFlightLinkObservables,p=this.link,y={query:l,variables:s,operationName:(0,o.getOperationName)(l)||void 0,context:this.prepareContext((0,r.__assign)((0,r.__assign)({},t),{forceFetch:!i}))};if(t=y.context,i){var f=h.get(l)||new Map;h.set(l,f);var v=JSON.stringify(s);if(!(a=f.get(v))){f.set(v,a=w((0,n.execute)(p,y)));var d=function(){f.delete(v),f.size||h.delete(l),b.unsubscribe()},b=a.subscribe({next:d,error:d,complete:d})}}else a=w((0,n.execute)(p,y))}else a=c.of({data:{}}),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(a=function(e,t){return new c(function(r){var o=r.next,n=r.error,s=r.complete,i=0,a=!1,u={next:function(e){++i,new Promise(function(r){r(t(e))}).then(function(e){--i,o&&o.call(r,e),a&&u.complete()},function(e){--i,n&&n.call(r,e)})},error:function(e){n&&n.call(r,e)},complete:function(){a=!0,i||s&&s.call(r)}},c=e.subscribe(u);return function(){return c.unsubscribe()}})}(a,function(e){return u.localState.runResolvers({document:g,remoteResult:e,context:t,variables:s})})),a},e.prototype.fetchRequest=function(e){var r,o,n=this,s=e.requestId,i=e.queryId,a=e.document,u=e.options,c=e.fetchMoreForQueryId,h=u.variables,p=u.errorPolicy,y=void 0===p?"none":p,v=u.fetchPolicy;return new Promise(function(e,p){var d=n.getObservableFromLink(a,u.context,h),b="fetchRequest:"+i;n.fetchQueryRejectFns.set(b,p);var g=function(){n.fetchQueryRejectFns.delete(b),n.setQuery(i,function(e){e.subscriptions.delete(m)})},m=d.map(function(e){if(s>=n.getQuery(i).lastRequestId&&(n.markQueryResult(i,e,u,c),n.queryStore.markQueryResult(i,e,c),n.invalidate(i),n.invalidate(c),n.broadcastQueries()),"none"===y&&l(e.errors))return p(new f({graphQLErrors:e.errors}));if("all"===y&&(o=e.errors),c||"no-cache"===v)r=e.data;else{var t=n.dataStore.getCache().diff({variables:h,query:a,optimistic:!1,returnPartialData:!0}),d=t.result;(t.complete||u.returnPartialData)&&(r=d)}}).subscribe({error:function(e){g(),p(e)},complete:function(){g(),e({data:r,errors:o,loading:!1,networkStatus:t.ready,stale:!1})}});n.setQuery(i,function(e){e.subscriptions.add(m)})})},e.prototype.getQuery=function(e){return this.queries.get(e)||{listeners:new Set,invalidated:!1,document:null,newData:null,lastRequestId:1,observableQuery:null,subscriptions:new Set}},e.prototype.setQuery=function(e,t){var o=this.getQuery(e),n=(0,r.__assign)((0,r.__assign)({},o),t(o));this.queries.set(e,n)},e.prototype.invalidate=function(e,t){void 0===t&&(t=!0),e&&this.setQuery(e,function(){return{invalidated:t}})},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return(0,r.__assign)((0,r.__assign)({},t),{clientAwareness:this.clientAwareness})},e.prototype.checkInFlight=function(e){var r=this.queryStore.get(e);return r&&r.networkStatus!==t.ready&&r.networkStatus!==t.error},e.prototype.startPollingQuery=function(e,t,o){var n=this,s=e.pollInterval;if((0,i.invariant)(s,18),!this.ssrMode){var a=this.pollingInfoByQueryId.get(t);a||this.pollingInfoByQueryId.set(t,a={}),a.interval=s,a.options=(0,r.__assign)((0,r.__assign)({},e),{fetchPolicy:"network-only"});var u=function(){var e=n.pollingInfoByQueryId.get(t);e&&(n.checkInFlight(t)?c():n.fetchQuery(t,e.options,p.poll).then(c,c))},c=function(){var e=n.pollingInfoByQueryId.get(t);e&&(clearTimeout(e.timeout),e.timeout=setTimeout(u,e.interval))};o&&this.addQueryListener(t,o),c()}return t},e.prototype.stopPollingQuery=function(e){this.pollingInfoByQueryId.delete(e)},e}(),R=function(){function e(e){this.cache=e}return e.prototype.getCache=function(){return this.cache},e.prototype.markQueryResult=function(e,t,r,n,s){void 0===s&&(s=!1);var i=!(0,o.graphQLResultHasError)(e);s&&(0,o.graphQLResultHasError)(e)&&e.data&&(i=!0),!n&&i&&this.cache.write({result:e.data,dataId:"ROOT_QUERY",query:t,variables:r})},e.prototype.markSubscriptionResult=function(e,t,r){(0,o.graphQLResultHasError)(e)||this.cache.write({result:e.data,dataId:"ROOT_SUBSCRIPTION",query:t,variables:r})},e.prototype.markMutationInit=function(e){var t,r=this;e.optimisticResponse&&(t="function"==typeof e.optimisticResponse?e.optimisticResponse(e.variables):e.optimisticResponse,this.cache.recordOptimisticTransaction(function(o){var n=r.cache;r.cache=o;try{r.markMutationResult({mutationId:e.mutationId,result:{data:t},document:e.document,variables:e.variables,updateQueries:e.updateQueries,update:e.update})}finally{r.cache=n}},e.mutationId))},e.prototype.markMutationResult=function(e){var t=this;if(!(0,o.graphQLResultHasError)(e.result)){var r=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],n=e.updateQueries;n&&Object.keys(n).forEach(function(s){var i=n[s],a=i.query,u=i.updater,c=t.cache.diff({query:a.document,variables:a.variables,returnPartialData:!0,optimistic:!1}),l=c.result;if(c.complete){var h=(0,o.tryFunctionOrLogError)(function(){return u(l,{mutationResult:e.result,queryName:(0,o.getOperationName)(a.document)||void 0,queryVariables:a.variables})});h&&r.push({result:h,dataId:"ROOT_QUERY",query:a.document,variables:a.variables})}}),this.cache.performTransaction(function(t){r.forEach(function(e){return t.write(e)});var n=e.update;n&&(0,o.tryFunctionOrLogError)(function(){return n(t,e.result)})})}},e.prototype.markMutationComplete=function(e){var t=e.mutationId;e.optimisticResponse&&this.cache.removeOptimistic(t)},e.prototype.markUpdateQueryResult=function(e,t,r){this.cache.write({result:r,dataId:"ROOT_QUERY",variables:t,query:e})},e.prototype.reset=function(){return this.cache.reset()},e}(),k="2.6.10",E=function(){function e(e){var t=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var r=e.cache,o=e.ssrMode,s=void 0!==o&&o,a=e.ssrForceFetchDelay,u=void 0===a?0:a,c=e.connectToDevTools,l=e.queryDeduplication,h=void 0===l||l,p=e.defaultOptions,y=e.assumeImmutableResults,f=void 0!==y&&y,v=e.resolvers,d=e.typeDefs,b=e.fragmentMatcher,g=e.name,m=e.version,Q=e.link;if(!Q&&v&&(Q=n.ApolloLink.empty()),!Q||!r)throw new i.InvariantError(4);this.link=Q,this.cache=r,this.store=new R(r),this.disableNetworkFetches=s||u>0,this.queryDeduplication=h,this.defaultOptions=p||{},this.typeDefs=d,u&&setTimeout(function(){return t.disableNetworkFetches=!1},u),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this);void 0!==c&&(c&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),this.version=k,this.localState=new _({cache:r,client:this,resolvers:v,fragmentMatcher:b}),this.queryManager=new q({link:this.link,store:this.store,queryDeduplication:h,ssrMode:s,clientAwareness:{name:g,version:m},localState:this.localState,assumeImmutableResults:f,onBroadcast:function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.queryStore.getStore(),mutations:t.queryManager.mutationStore.getStore()},dataWithOptimisticResults:t.cache.extract(!0)})}})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=(0,r.__assign)((0,r.__assign)({},this.defaultOptions.watchQuery),e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=(0,r.__assign)((0,r.__assign)({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=(0,r.__assign)((0,r.__assign)({},this.defaultOptions.query),e)),(0,i.invariant)("cache-and-network"!==e.fetchPolicy,5),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=(0,r.__assign)((0,r.__assign)({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=(0,r.__assign)((0,r.__assign)({},this.defaultOptions.mutate),e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return this.queryManager.broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return this.queryManager.broadcastQueries(),t},e.prototype.writeData=function(e){var t=this.cache.writeData(e);return this.queryManager.broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return(0,n.execute)(this.link,e)},e.prototype.initQueryManager=function(){return this.queryManager},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore()}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(e){return e()}))}).then(function(){return e.reFetchObservableQueries()})},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore()}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(e){return e()}))})},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(t){return t!==e})}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(t){return t!==e})}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e}();exports.ApolloClient=E;var M=E;exports.default=M; diff --git a/node_modules/apollo-client/bundle.esm.js b/node_modules/apollo-client/bundle.esm.js deleted file mode 100644 index 450ae219..00000000 --- a/node_modules/apollo-client/bundle.esm.js +++ /dev/null @@ -1,2108 +0,0 @@ -import { __extends, __assign, __awaiter, __generator } from 'tslib'; -import { getOperationDefinition, isEqual, tryFunctionOrLogError, cloneDeep, mergeDeep, hasDirectives, removeClientSetsFromDocument, buildQueryFromSelectionSet, getMainDefinition, getFragmentDefinitions, createFragmentMap, mergeDeepArray, resultKeyNameFromField, argumentsObjectFromField, shouldInclude, isField, isInlineFragment, canUseWeakMap, graphQLResultHasError, removeConnectionDirectiveFromDocument, hasClientExports, getDefaultValues, getOperationName } from 'apollo-utilities'; -import { Observable as Observable$1, execute, ApolloLink } from 'apollo-link'; -import $$observable from 'symbol-observable'; -import { InvariantError, invariant } from 'ts-invariant'; -import { visit, BREAK } from 'graphql/language/visitor'; - -var NetworkStatus; -(function (NetworkStatus) { - NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; - NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; - NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; - NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; - NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; - NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; - NetworkStatus[NetworkStatus["error"] = 8] = "error"; -})(NetworkStatus || (NetworkStatus = {})); -function isNetworkRequestInFlight(networkStatus) { - return networkStatus < 7; -} - -var Observable = (function (_super) { - __extends(Observable, _super); - function Observable() { - return _super !== null && _super.apply(this, arguments) || this; - } - Observable.prototype[$$observable] = function () { - return this; - }; - Observable.prototype['@@observable'] = function () { - return this; - }; - return Observable; -}(Observable$1)); - -function isNonEmptyArray(value) { - return Array.isArray(value) && value.length > 0; -} - -function isApolloError(err) { - return err.hasOwnProperty('graphQLErrors'); -} -var generateErrorMessage = function (err) { - var message = ''; - if (isNonEmptyArray(err.graphQLErrors)) { - err.graphQLErrors.forEach(function (graphQLError) { - var errorMessage = graphQLError - ? graphQLError.message - : 'Error message not found.'; - message += "GraphQL error: " + errorMessage + "\n"; - }); - } - if (err.networkError) { - message += 'Network error: ' + err.networkError.message + '\n'; - } - message = message.replace(/\n$/, ''); - return message; -}; -var ApolloError = (function (_super) { - __extends(ApolloError, _super); - function ApolloError(_a) { - var graphQLErrors = _a.graphQLErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; - var _this = _super.call(this, errorMessage) || this; - _this.graphQLErrors = graphQLErrors || []; - _this.networkError = networkError || null; - if (!errorMessage) { - _this.message = generateErrorMessage(_this); - } - else { - _this.message = errorMessage; - } - _this.extraInfo = extraInfo; - _this.__proto__ = ApolloError.prototype; - return _this; - } - return ApolloError; -}(Error)); - -var FetchType; -(function (FetchType) { - FetchType[FetchType["normal"] = 1] = "normal"; - FetchType[FetchType["refetch"] = 2] = "refetch"; - FetchType[FetchType["poll"] = 3] = "poll"; -})(FetchType || (FetchType = {})); - -var hasError = function (storeValue, policy) { - if (policy === void 0) { policy = 'none'; } - return storeValue && (storeValue.networkError || - (policy === 'none' && isNonEmptyArray(storeValue.graphQLErrors))); -}; -var ObservableQuery = (function (_super) { - __extends(ObservableQuery, _super); - function ObservableQuery(_a) { - var queryManager = _a.queryManager, options = _a.options, _b = _a.shouldSubscribe, shouldSubscribe = _b === void 0 ? true : _b; - var _this = _super.call(this, function (observer) { - return _this.onSubscribe(observer); - }) || this; - _this.observers = new Set(); - _this.subscriptions = new Set(); - _this.isTornDown = false; - _this.options = options; - _this.variables = options.variables || {}; - _this.queryId = queryManager.generateQueryId(); - _this.shouldSubscribe = shouldSubscribe; - var opDef = getOperationDefinition(options.query); - _this.queryName = opDef && opDef.name && opDef.name.value; - _this.queryManager = queryManager; - return _this; - } - ObservableQuery.prototype.result = function () { - var _this = this; - return new Promise(function (resolve, reject) { - var observer = { - next: function (result) { - resolve(result); - _this.observers.delete(observer); - if (!_this.observers.size) { - _this.queryManager.removeQuery(_this.queryId); - } - setTimeout(function () { - subscription.unsubscribe(); - }, 0); - }, - error: reject, - }; - var subscription = _this.subscribe(observer); - }); - }; - ObservableQuery.prototype.currentResult = function () { - var result = this.getCurrentResult(); - if (result.data === undefined) { - result.data = {}; - } - return result; - }; - ObservableQuery.prototype.getCurrentResult = function () { - if (this.isTornDown) { - var lastResult = this.lastResult; - return { - data: !this.lastError && lastResult && lastResult.data || void 0, - error: this.lastError, - loading: false, - networkStatus: NetworkStatus.error, - }; - } - var _a = this.queryManager.getCurrentQueryResult(this), data = _a.data, partial = _a.partial; - var queryStoreValue = this.queryManager.queryStore.get(this.queryId); - var result; - var fetchPolicy = this.options.fetchPolicy; - var isNetworkFetchPolicy = fetchPolicy === 'network-only' || - fetchPolicy === 'no-cache'; - if (queryStoreValue) { - var networkStatus = queryStoreValue.networkStatus; - if (hasError(queryStoreValue, this.options.errorPolicy)) { - return { - data: void 0, - loading: false, - networkStatus: networkStatus, - error: new ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError, - }), - }; - } - if (queryStoreValue.variables) { - this.options.variables = __assign(__assign({}, this.options.variables), queryStoreValue.variables); - this.variables = this.options.variables; - } - result = { - data: data, - loading: isNetworkRequestInFlight(networkStatus), - networkStatus: networkStatus, - }; - if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') { - result.errors = queryStoreValue.graphQLErrors; - } - } - else { - var loading = isNetworkFetchPolicy || - (partial && fetchPolicy !== 'cache-only'); - result = { - data: data, - loading: loading, - networkStatus: loading ? NetworkStatus.loading : NetworkStatus.ready, - }; - } - if (!partial) { - this.updateLastResult(__assign(__assign({}, result), { stale: false })); - } - return __assign(__assign({}, result), { partial: partial }); - }; - ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { - var snapshot = this.lastResultSnapshot; - return !(snapshot && - newResult && - snapshot.networkStatus === newResult.networkStatus && - snapshot.stale === newResult.stale && - isEqual(snapshot.data, newResult.data)); - }; - ObservableQuery.prototype.getLastResult = function () { - return this.lastResult; - }; - ObservableQuery.prototype.getLastError = function () { - return this.lastError; - }; - ObservableQuery.prototype.resetLastResults = function () { - delete this.lastResult; - delete this.lastResultSnapshot; - delete this.lastError; - this.isTornDown = false; - }; - ObservableQuery.prototype.resetQueryStoreErrors = function () { - var queryStore = this.queryManager.queryStore.get(this.queryId); - if (queryStore) { - queryStore.networkError = null; - queryStore.graphQLErrors = []; - } - }; - ObservableQuery.prototype.refetch = function (variables) { - var fetchPolicy = this.options.fetchPolicy; - if (fetchPolicy === 'cache-only') { - return Promise.reject(process.env.NODE_ENV === "production" ? new InvariantError(1) : new InvariantError('cache-only fetchPolicy option should not be used together with query refetch.')); - } - if (fetchPolicy !== 'no-cache' && - fetchPolicy !== 'cache-and-network') { - fetchPolicy = 'network-only'; - } - if (!isEqual(this.variables, variables)) { - this.variables = __assign(__assign({}, this.variables), variables); - } - if (!isEqual(this.options.variables, this.variables)) { - this.options.variables = __assign(__assign({}, this.options.variables), this.variables); - } - return this.queryManager.fetchQuery(this.queryId, __assign(__assign({}, this.options), { fetchPolicy: fetchPolicy }), FetchType.refetch); - }; - ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { - var _this = this; - process.env.NODE_ENV === "production" ? invariant(fetchMoreOptions.updateQuery, 2) : invariant(fetchMoreOptions.updateQuery, 'updateQuery option is required. This function defines how to update the query data with the new results.'); - var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : __assign(__assign(__assign({}, this.options), fetchMoreOptions), { variables: __assign(__assign({}, this.variables), fetchMoreOptions.variables) }))), { fetchPolicy: 'network-only' }); - var qid = this.queryManager.generateQueryId(); - return this.queryManager - .fetchQuery(qid, combinedOptions, FetchType.normal, this.queryId) - .then(function (fetchMoreResult) { - _this.updateQuery(function (previousResult) { - return fetchMoreOptions.updateQuery(previousResult, { - fetchMoreResult: fetchMoreResult.data, - variables: combinedOptions.variables, - }); - }); - _this.queryManager.stopQuery(qid); - return fetchMoreResult; - }, function (error) { - _this.queryManager.stopQuery(qid); - throw error; - }); - }; - ObservableQuery.prototype.subscribeToMore = function (options) { - var _this = this; - var subscription = this.queryManager - .startGraphQLSubscription({ - query: options.document, - variables: options.variables, - }) - .subscribe({ - next: function (subscriptionData) { - var updateQuery = options.updateQuery; - if (updateQuery) { - _this.updateQuery(function (previous, _a) { - var variables = _a.variables; - return updateQuery(previous, { - subscriptionData: subscriptionData, - variables: variables, - }); - }); - } - }, - error: function (err) { - if (options.onError) { - options.onError(err); - return; - } - process.env.NODE_ENV === "production" || invariant.error('Unhandled GraphQL subscription error', err); - }, - }); - this.subscriptions.add(subscription); - return function () { - if (_this.subscriptions.delete(subscription)) { - subscription.unsubscribe(); - } - }; - }; - ObservableQuery.prototype.setOptions = function (opts) { - var oldFetchPolicy = this.options.fetchPolicy; - this.options = __assign(__assign({}, this.options), opts); - if (opts.pollInterval) { - this.startPolling(opts.pollInterval); - } - else if (opts.pollInterval === 0) { - this.stopPolling(); - } - var fetchPolicy = opts.fetchPolicy; - return this.setVariables(this.options.variables, oldFetchPolicy !== fetchPolicy && (oldFetchPolicy === 'cache-only' || - oldFetchPolicy === 'standby' || - fetchPolicy === 'network-only'), opts.fetchResults); - }; - ObservableQuery.prototype.setVariables = function (variables, tryFetch, fetchResults) { - if (tryFetch === void 0) { tryFetch = false; } - if (fetchResults === void 0) { fetchResults = true; } - this.isTornDown = false; - variables = variables || this.variables; - if (!tryFetch && isEqual(variables, this.variables)) { - return this.observers.size && fetchResults - ? this.result() - : Promise.resolve(); - } - this.variables = this.options.variables = variables; - if (!this.observers.size) { - return Promise.resolve(); - } - return this.queryManager.fetchQuery(this.queryId, this.options); - }; - ObservableQuery.prototype.updateQuery = function (mapFn) { - var queryManager = this.queryManager; - var _a = queryManager.getQueryWithPreviousResult(this.queryId), previousResult = _a.previousResult, variables = _a.variables, document = _a.document; - var newResult = tryFunctionOrLogError(function () { - return mapFn(previousResult, { variables: variables }); - }); - if (newResult) { - queryManager.dataStore.markUpdateQueryResult(document, variables, newResult); - queryManager.broadcastQueries(); - } - }; - ObservableQuery.prototype.stopPolling = function () { - this.queryManager.stopPollingQuery(this.queryId); - this.options.pollInterval = undefined; - }; - ObservableQuery.prototype.startPolling = function (pollInterval) { - assertNotCacheFirstOrOnly(this); - this.options.pollInterval = pollInterval; - this.queryManager.startPollingQuery(this.options, this.queryId); - }; - ObservableQuery.prototype.updateLastResult = function (newResult) { - var previousResult = this.lastResult; - this.lastResult = newResult; - this.lastResultSnapshot = this.queryManager.assumeImmutableResults - ? newResult - : cloneDeep(newResult); - return previousResult; - }; - ObservableQuery.prototype.onSubscribe = function (observer) { - var _this = this; - try { - var subObserver = observer._subscription._observer; - if (subObserver && !subObserver.error) { - subObserver.error = defaultSubscriptionObserverErrorCallback; - } - } - catch (_a) { } - var first = !this.observers.size; - this.observers.add(observer); - if (observer.next && this.lastResult) - observer.next(this.lastResult); - if (observer.error && this.lastError) - observer.error(this.lastError); - if (first) { - this.setUpQuery(); - } - return function () { - if (_this.observers.delete(observer) && !_this.observers.size) { - _this.tearDownQuery(); - } - }; - }; - ObservableQuery.prototype.setUpQuery = function () { - var _this = this; - var _a = this, queryManager = _a.queryManager, queryId = _a.queryId; - if (this.shouldSubscribe) { - queryManager.addObservableQuery(queryId, this); - } - if (this.options.pollInterval) { - assertNotCacheFirstOrOnly(this); - queryManager.startPollingQuery(this.options, queryId); - } - var onError = function (error) { - _this.updateLastResult(__assign(__assign({}, _this.lastResult), { errors: error.graphQLErrors, networkStatus: NetworkStatus.error, loading: false })); - iterateObserversSafely(_this.observers, 'error', _this.lastError = error); - }; - queryManager.observeQuery(queryId, this.options, { - next: function (result) { - if (_this.lastError || _this.isDifferentFromLastResult(result)) { - var previousResult_1 = _this.updateLastResult(result); - var _a = _this.options, query_1 = _a.query, variables = _a.variables, fetchPolicy_1 = _a.fetchPolicy; - if (queryManager.transform(query_1).hasClientExports) { - queryManager.getLocalState().addExportedVariables(query_1, variables).then(function (variables) { - var previousVariables = _this.variables; - _this.variables = _this.options.variables = variables; - if (!result.loading && - previousResult_1 && - fetchPolicy_1 !== 'cache-only' && - queryManager.transform(query_1).serverQuery && - !isEqual(previousVariables, variables)) { - _this.refetch(); - } - else { - iterateObserversSafely(_this.observers, 'next', result); - } - }); - } - else { - iterateObserversSafely(_this.observers, 'next', result); - } - } - }, - error: onError, - }).catch(onError); - }; - ObservableQuery.prototype.tearDownQuery = function () { - var queryManager = this.queryManager; - this.isTornDown = true; - queryManager.stopPollingQuery(this.queryId); - this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); - this.subscriptions.clear(); - queryManager.removeObservableQuery(this.queryId); - queryManager.stopQuery(this.queryId); - this.observers.clear(); - }; - return ObservableQuery; -}(Observable)); -function defaultSubscriptionObserverErrorCallback(error) { - process.env.NODE_ENV === "production" || invariant.error('Unhandled error', error.message, error.stack); -} -function iterateObserversSafely(observers, method, argument) { - var observersWithMethod = []; - observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); - observersWithMethod.forEach(function (obs) { return obs[method](argument); }); -} -function assertNotCacheFirstOrOnly(obsQuery) { - var fetchPolicy = obsQuery.options.fetchPolicy; - process.env.NODE_ENV === "production" ? invariant(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 3) : invariant(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.'); -} - -var MutationStore = (function () { - function MutationStore() { - this.store = {}; - } - MutationStore.prototype.getStore = function () { - return this.store; - }; - MutationStore.prototype.get = function (mutationId) { - return this.store[mutationId]; - }; - MutationStore.prototype.initMutation = function (mutationId, mutation, variables) { - this.store[mutationId] = { - mutation: mutation, - variables: variables || {}, - loading: true, - error: null, - }; - }; - MutationStore.prototype.markMutationError = function (mutationId, error) { - var mutation = this.store[mutationId]; - if (mutation) { - mutation.loading = false; - mutation.error = error; - } - }; - MutationStore.prototype.markMutationResult = function (mutationId) { - var mutation = this.store[mutationId]; - if (mutation) { - mutation.loading = false; - mutation.error = null; - } - }; - MutationStore.prototype.reset = function () { - this.store = {}; - }; - return MutationStore; -}()); - -var QueryStore = (function () { - function QueryStore() { - this.store = {}; - } - QueryStore.prototype.getStore = function () { - return this.store; - }; - QueryStore.prototype.get = function (queryId) { - return this.store[queryId]; - }; - QueryStore.prototype.initQuery = function (query) { - var previousQuery = this.store[query.queryId]; - process.env.NODE_ENV === "production" ? invariant(!previousQuery || - previousQuery.document === query.document || - isEqual(previousQuery.document, query.document), 19) : invariant(!previousQuery || - previousQuery.document === query.document || - isEqual(previousQuery.document, query.document), 'Internal Error: may not update existing query string in store'); - var isSetVariables = false; - var previousVariables = null; - if (query.storePreviousVariables && - previousQuery && - previousQuery.networkStatus !== NetworkStatus.loading) { - if (!isEqual(previousQuery.variables, query.variables)) { - isSetVariables = true; - previousVariables = previousQuery.variables; - } - } - var networkStatus; - if (isSetVariables) { - networkStatus = NetworkStatus.setVariables; - } - else if (query.isPoll) { - networkStatus = NetworkStatus.poll; - } - else if (query.isRefetch) { - networkStatus = NetworkStatus.refetch; - } - else { - networkStatus = NetworkStatus.loading; - } - var graphQLErrors = []; - if (previousQuery && previousQuery.graphQLErrors) { - graphQLErrors = previousQuery.graphQLErrors; - } - this.store[query.queryId] = { - document: query.document, - variables: query.variables, - previousVariables: previousVariables, - networkError: null, - graphQLErrors: graphQLErrors, - networkStatus: networkStatus, - metadata: query.metadata, - }; - if (typeof query.fetchMoreForQueryId === 'string' && - this.store[query.fetchMoreForQueryId]) { - this.store[query.fetchMoreForQueryId].networkStatus = - NetworkStatus.fetchMore; - } - }; - QueryStore.prototype.markQueryResult = function (queryId, result, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) - return; - this.store[queryId].networkError = null; - this.store[queryId].graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : []; - this.store[queryId].previousVariables = null; - this.store[queryId].networkStatus = NetworkStatus.ready; - if (typeof fetchMoreForQueryId === 'string' && - this.store[fetchMoreForQueryId]) { - this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready; - } - }; - QueryStore.prototype.markQueryError = function (queryId, error, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) - return; - this.store[queryId].networkError = error; - this.store[queryId].networkStatus = NetworkStatus.error; - if (typeof fetchMoreForQueryId === 'string') { - this.markQueryResultClient(fetchMoreForQueryId, true); - } - }; - QueryStore.prototype.markQueryResultClient = function (queryId, complete) { - var storeValue = this.store && this.store[queryId]; - if (storeValue) { - storeValue.networkError = null; - storeValue.previousVariables = null; - if (complete) { - storeValue.networkStatus = NetworkStatus.ready; - } - } - }; - QueryStore.prototype.stopQuery = function (queryId) { - delete this.store[queryId]; - }; - QueryStore.prototype.reset = function (observableQueryIds) { - var _this = this; - Object.keys(this.store).forEach(function (queryId) { - if (observableQueryIds.indexOf(queryId) < 0) { - _this.stopQuery(queryId); - } - else { - _this.store[queryId].networkStatus = NetworkStatus.loading; - } - }); - }; - return QueryStore; -}()); - -function capitalizeFirstLetter(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - -var LocalState = (function () { - function LocalState(_a) { - var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; - this.cache = cache; - if (client) { - this.client = client; - } - if (resolvers) { - this.addResolvers(resolvers); - } - if (fragmentMatcher) { - this.setFragmentMatcher(fragmentMatcher); - } - } - LocalState.prototype.addResolvers = function (resolvers) { - var _this = this; - this.resolvers = this.resolvers || {}; - if (Array.isArray(resolvers)) { - resolvers.forEach(function (resolverGroup) { - _this.resolvers = mergeDeep(_this.resolvers, resolverGroup); - }); - } - else { - this.resolvers = mergeDeep(this.resolvers, resolvers); - } - }; - LocalState.prototype.setResolvers = function (resolvers) { - this.resolvers = {}; - this.addResolvers(resolvers); - }; - LocalState.prototype.getResolvers = function () { - return this.resolvers || {}; - }; - LocalState.prototype.runResolvers = function (_a) { - var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_c) { - if (document) { - return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (__assign(__assign({}, remoteResult), { data: localResult.result })); })]; - } - return [2, remoteResult]; - }); - }); - }; - LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { - this.fragmentMatcher = fragmentMatcher; - }; - LocalState.prototype.getFragmentMatcher = function () { - return this.fragmentMatcher; - }; - LocalState.prototype.clientQuery = function (document) { - if (hasDirectives(['client'], document)) { - if (this.resolvers) { - return document; - } - process.env.NODE_ENV === "production" || invariant.warn('Found @client directives in a query but no ApolloClient resolvers ' + - 'were specified. This means ApolloClient local resolver handling ' + - 'has been disabled, and @client directives will be passed through ' + - 'to your link chain.'); - } - return null; - }; - LocalState.prototype.serverQuery = function (document) { - return this.resolvers ? removeClientSetsFromDocument(document) : document; - }; - LocalState.prototype.prepareContext = function (context) { - if (context === void 0) { context = {}; } - var cache = this.cache; - var newContext = __assign(__assign({}, context), { cache: cache, getCacheKey: function (obj) { - if (cache.config) { - return cache.config.dataIdFromObject(obj); - } - else { - process.env.NODE_ENV === "production" ? invariant(false, 6) : invariant(false, 'To use context.getCacheKey, you need to use a cache that has ' + - 'a configurable dataIdFromObject, like apollo-cache-inmemory.'); - } - } }); - return newContext; - }; - LocalState.prototype.addExportedVariables = function (document, variables, context) { - if (variables === void 0) { variables = {}; } - if (context === void 0) { context = {}; } - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - if (document) { - return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (__assign(__assign({}, variables), data.exportedVariables)); })]; - } - return [2, __assign({}, variables)]; - }); - }); - }; - LocalState.prototype.shouldForceResolvers = function (document) { - var forceResolvers = false; - visit(document, { - Directive: { - enter: function (node) { - if (node.name.value === 'client' && node.arguments) { - forceResolvers = node.arguments.some(function (arg) { - return arg.name.value === 'always' && - arg.value.kind === 'BooleanValue' && - arg.value.value === true; - }); - if (forceResolvers) { - return BREAK; - } - } - }, - }, - }); - return forceResolvers; - }; - LocalState.prototype.buildRootValueFromCache = function (document, variables) { - return this.cache.diff({ - query: buildQueryFromSelectionSet(document), - variables: variables, - returnPartialData: true, - optimistic: false, - }).result; - }; - LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { - if (context === void 0) { context = {}; } - if (variables === void 0) { variables = {}; } - if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } - if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } - return __awaiter(this, void 0, void 0, function () { - var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; - return __generator(this, function (_b) { - mainDefinition = getMainDefinition(document); - fragments = getFragmentDefinitions(document); - fragmentMap = createFragmentMap(fragments); - definitionOperation = mainDefinition - .operation; - defaultOperationType = definitionOperation - ? capitalizeFirstLetter(definitionOperation) - : 'Query'; - _a = this, cache = _a.cache, client = _a.client; - execContext = { - fragmentMap: fragmentMap, - context: __assign(__assign({}, context), { cache: cache, - client: client }), - variables: variables, - fragmentMatcher: fragmentMatcher, - defaultOperationType: defaultOperationType, - exportedVariables: {}, - onlyRunForcedResolvers: onlyRunForcedResolvers, - }; - return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({ - result: result, - exportedVariables: execContext.exportedVariables, - }); })]; - }); - }); - }; - LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { - return __awaiter(this, void 0, void 0, function () { - var fragmentMap, context, variables, resultsToMerge, execute; - var _this = this; - return __generator(this, function (_a) { - fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; - resultsToMerge = [rootValue]; - execute = function (selection) { return __awaiter(_this, void 0, void 0, function () { - var fragment, typeCondition; - return __generator(this, function (_a) { - if (!shouldInclude(selection, variables)) { - return [2]; - } - if (isField(selection)) { - return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { - var _a; - if (typeof fieldResult !== 'undefined') { - resultsToMerge.push((_a = {}, - _a[resultKeyNameFromField(selection)] = fieldResult, - _a)); - } - })]; - } - if (isInlineFragment(selection)) { - fragment = selection; - } - else { - fragment = fragmentMap[selection.name.value]; - process.env.NODE_ENV === "production" ? invariant(fragment, 7) : invariant(fragment, "No fragment named " + selection.name.value); - } - if (fragment && fragment.typeCondition) { - typeCondition = fragment.typeCondition.name.value; - if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { - return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { - resultsToMerge.push(fragmentResult); - })]; - } - } - return [2]; - }); - }); }; - return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { - return mergeDeepArray(resultsToMerge); - })]; - }); - }); - }; - LocalState.prototype.resolveField = function (field, rootValue, execContext) { - return __awaiter(this, void 0, void 0, function () { - var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; - var _this = this; - return __generator(this, function (_a) { - variables = execContext.variables; - fieldName = field.name.value; - aliasedFieldName = resultKeyNameFromField(field); - aliasUsed = fieldName !== aliasedFieldName; - defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; - resultPromise = Promise.resolve(defaultResult); - if (!execContext.onlyRunForcedResolvers || - this.shouldForceResolvers(field)) { - resolverType = rootValue.__typename || execContext.defaultOperationType; - resolverMap = this.resolvers && this.resolvers[resolverType]; - if (resolverMap) { - resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; - if (resolve) { - resultPromise = Promise.resolve(resolve(rootValue, argumentsObjectFromField(field, variables), execContext.context, { field: field, fragmentMap: execContext.fragmentMap })); - } - } - } - return [2, resultPromise.then(function (result) { - if (result === void 0) { result = defaultResult; } - if (field.directives) { - field.directives.forEach(function (directive) { - if (directive.name.value === 'export' && directive.arguments) { - directive.arguments.forEach(function (arg) { - if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { - execContext.exportedVariables[arg.value.value] = result; - } - }); - } - }); - } - if (!field.selectionSet) { - return result; - } - if (result == null) { - return result; - } - if (Array.isArray(result)) { - return _this.resolveSubSelectedArray(field, result, execContext); - } - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, result, execContext); - } - })]; - }); - }); - }; - LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { - var _this = this; - return Promise.all(result.map(function (item) { - if (item === null) { - return null; - } - if (Array.isArray(item)) { - return _this.resolveSubSelectedArray(field, item, execContext); - } - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, item, execContext); - } - })); - }; - return LocalState; -}()); - -function multiplex(inner) { - var observers = new Set(); - var sub = null; - return new Observable(function (observer) { - observers.add(observer); - sub = sub || inner.subscribe({ - next: function (value) { - observers.forEach(function (obs) { return obs.next && obs.next(value); }); - }, - error: function (error) { - observers.forEach(function (obs) { return obs.error && obs.error(error); }); - }, - complete: function () { - observers.forEach(function (obs) { return obs.complete && obs.complete(); }); - }, - }); - return function () { - if (observers.delete(observer) && !observers.size && sub) { - sub.unsubscribe(); - sub = null; - } - }; - }); -} -function asyncMap(observable, mapFn) { - return new Observable(function (observer) { - var next = observer.next, error = observer.error, complete = observer.complete; - var activeNextCount = 0; - var completed = false; - var handler = { - next: function (value) { - ++activeNextCount; - new Promise(function (resolve) { - resolve(mapFn(value)); - }).then(function (result) { - --activeNextCount; - next && next.call(observer, result); - completed && handler.complete(); - }, function (e) { - --activeNextCount; - error && error.call(observer, e); - }); - }, - error: function (e) { - error && error.call(observer, e); - }, - complete: function () { - completed = true; - if (!activeNextCount) { - complete && complete.call(observer); - } - }, - }; - var sub = observable.subscribe(handler); - return function () { return sub.unsubscribe(); }; - }); -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; -var QueryManager = (function () { - function QueryManager(_a) { - var link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, store = _a.store, _c = _a.onBroadcast, onBroadcast = _c === void 0 ? function () { return undefined; } : _c, _d = _a.ssrMode, ssrMode = _d === void 0 ? false : _d, _e = _a.clientAwareness, clientAwareness = _e === void 0 ? {} : _e, localState = _a.localState, assumeImmutableResults = _a.assumeImmutableResults; - this.mutationStore = new MutationStore(); - this.queryStore = new QueryStore(); - this.clientAwareness = {}; - this.idCounter = 1; - this.queries = new Map(); - this.fetchQueryRejectFns = new Map(); - this.transformCache = new (canUseWeakMap ? WeakMap : Map)(); - this.inFlightLinkObservables = new Map(); - this.pollingInfoByQueryId = new Map(); - this.link = link; - this.queryDeduplication = queryDeduplication; - this.dataStore = store; - this.onBroadcast = onBroadcast; - this.clientAwareness = clientAwareness; - this.localState = localState || new LocalState({ cache: store.getCache() }); - this.ssrMode = ssrMode; - this.assumeImmutableResults = !!assumeImmutableResults; - } - QueryManager.prototype.stop = function () { - var _this = this; - this.queries.forEach(function (_info, queryId) { - _this.stopQueryNoBroadcast(queryId); - }); - this.fetchQueryRejectFns.forEach(function (reject) { - reject(process.env.NODE_ENV === "production" ? new InvariantError(8) : new InvariantError('QueryManager stopped while query was in flight')); - }); - }; - QueryManager.prototype.mutate = function (_a) { - var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueriesByName = _a.updateQueries, _b = _a.refetchQueries, refetchQueries = _b === void 0 ? [] : _b, _c = _a.awaitRefetchQueries, awaitRefetchQueries = _c === void 0 ? false : _c, updateWithProxyFn = _a.update, _d = _a.errorPolicy, errorPolicy = _d === void 0 ? 'none' : _d, fetchPolicy = _a.fetchPolicy, _e = _a.context, context = _e === void 0 ? {} : _e; - return __awaiter(this, void 0, void 0, function () { - var mutationId, generateUpdateQueriesInfo, self; - var _this = this; - return __generator(this, function (_f) { - switch (_f.label) { - case 0: - process.env.NODE_ENV === "production" ? invariant(mutation, 9) : invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); - process.env.NODE_ENV === "production" ? invariant(!fetchPolicy || fetchPolicy === 'no-cache', 10) : invariant(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); - mutationId = this.generateQueryId(); - mutation = this.transform(mutation).document; - this.setQuery(mutationId, function () { return ({ document: mutation }); }); - variables = this.getVariables(mutation, variables); - if (!this.transform(mutation).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(mutation, variables, context)]; - case 1: - variables = _f.sent(); - _f.label = 2; - case 2: - generateUpdateQueriesInfo = function () { - var ret = {}; - if (updateQueriesByName) { - _this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) { - var queryName = observableQuery.queryName; - if (queryName && - hasOwnProperty.call(updateQueriesByName, queryName)) { - ret[queryId] = { - updater: updateQueriesByName[queryName], - query: _this.queryStore.get(queryId), - }; - } - } - }); - } - return ret; - }; - this.mutationStore.initMutation(mutationId, mutation, variables); - this.dataStore.markMutationInit({ - mutationId: mutationId, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn, - optimisticResponse: optimisticResponse, - }); - this.broadcastQueries(); - self = this; - return [2, new Promise(function (resolve, reject) { - var storeResult; - var error; - self.getObservableFromLink(mutation, __assign(__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false).subscribe({ - next: function (result) { - if (graphQLResultHasError(result) && errorPolicy === 'none') { - error = new ApolloError({ - graphQLErrors: result.errors, - }); - return; - } - self.mutationStore.markMutationResult(mutationId); - if (fetchPolicy !== 'no-cache') { - self.dataStore.markMutationResult({ - mutationId: mutationId, - result: result, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn, - }); - } - storeResult = result; - }, - error: function (err) { - self.mutationStore.markMutationError(mutationId, err); - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse, - }); - self.broadcastQueries(); - self.setQuery(mutationId, function () { return ({ document: null }); }); - reject(new ApolloError({ - networkError: err, - })); - }, - complete: function () { - if (error) { - self.mutationStore.markMutationError(mutationId, error); - } - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse, - }); - self.broadcastQueries(); - if (error) { - reject(error); - return; - } - if (typeof refetchQueries === 'function') { - refetchQueries = refetchQueries(storeResult); - } - var refetchQueryPromises = []; - if (isNonEmptyArray(refetchQueries)) { - refetchQueries.forEach(function (refetchQuery) { - if (typeof refetchQuery === 'string') { - self.queries.forEach(function (_a) { - var observableQuery = _a.observableQuery; - if (observableQuery && - observableQuery.queryName === refetchQuery) { - refetchQueryPromises.push(observableQuery.refetch()); - } - }); - } - else { - var queryOptions = { - query: refetchQuery.query, - variables: refetchQuery.variables, - fetchPolicy: 'network-only', - }; - if (refetchQuery.context) { - queryOptions.context = refetchQuery.context; - } - refetchQueryPromises.push(self.query(queryOptions)); - } - }); - } - Promise.all(awaitRefetchQueries ? refetchQueryPromises : []).then(function () { - self.setQuery(mutationId, function () { return ({ document: null }); }); - if (errorPolicy === 'ignore' && - storeResult && - graphQLResultHasError(storeResult)) { - delete storeResult.errors; - } - resolve(storeResult); - }); - }, - }); - })]; - } - }); - }); - }; - QueryManager.prototype.fetchQuery = function (queryId, options, fetchType, fetchMoreForQueryId) { - return __awaiter(this, void 0, void 0, function () { - var _a, metadata, _b, fetchPolicy, _c, context, query, variables, storeResult, isNetworkOnly, needToFetch, _d, complete, result, shouldFetch, requestId, cancel, networkResult; - var _this = this; - return __generator(this, function (_e) { - switch (_e.label) { - case 0: - _a = options.metadata, metadata = _a === void 0 ? null : _a, _b = options.fetchPolicy, fetchPolicy = _b === void 0 ? 'cache-first' : _b, _c = options.context, context = _c === void 0 ? {} : _c; - query = this.transform(options.query).document; - variables = this.getVariables(query, options.variables); - if (!this.transform(query).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(query, variables, context)]; - case 1: - variables = _e.sent(); - _e.label = 2; - case 2: - options = __assign(__assign({}, options), { variables: variables }); - isNetworkOnly = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; - needToFetch = isNetworkOnly; - if (!isNetworkOnly) { - _d = this.dataStore.getCache().diff({ - query: query, - variables: variables, - returnPartialData: true, - optimistic: false, - }), complete = _d.complete, result = _d.result; - needToFetch = !complete || fetchPolicy === 'cache-and-network'; - storeResult = result; - } - shouldFetch = needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby'; - if (hasDirectives(['live'], query)) - shouldFetch = true; - requestId = this.idCounter++; - cancel = fetchPolicy !== 'no-cache' - ? this.updateQueryWatch(queryId, query, options) - : undefined; - this.setQuery(queryId, function () { return ({ - document: query, - lastRequestId: requestId, - invalidated: true, - cancel: cancel, - }); }); - this.invalidate(fetchMoreForQueryId); - this.queryStore.initQuery({ - queryId: queryId, - document: query, - storePreviousVariables: shouldFetch, - variables: variables, - isPoll: fetchType === FetchType.poll, - isRefetch: fetchType === FetchType.refetch, - metadata: metadata, - fetchMoreForQueryId: fetchMoreForQueryId, - }); - this.broadcastQueries(); - if (shouldFetch) { - networkResult = this.fetchRequest({ - requestId: requestId, - queryId: queryId, - document: query, - options: options, - fetchMoreForQueryId: fetchMoreForQueryId, - }).catch(function (error) { - if (isApolloError(error)) { - throw error; - } - else { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId); - _this.invalidate(queryId); - _this.invalidate(fetchMoreForQueryId); - _this.broadcastQueries(); - } - throw new ApolloError({ networkError: error }); - } - }); - if (fetchPolicy !== 'cache-and-network') { - return [2, networkResult]; - } - networkResult.catch(function () { }); - } - this.queryStore.markQueryResultClient(queryId, !shouldFetch); - this.invalidate(queryId); - this.invalidate(fetchMoreForQueryId); - if (this.transform(query).hasForcedResolvers) { - return [2, this.localState.runResolvers({ - document: query, - remoteResult: { data: storeResult }, - context: context, - variables: variables, - onlyRunForcedResolvers: true, - }).then(function (result) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - _this.broadcastQueries(); - return result; - })]; - } - this.broadcastQueries(); - return [2, { data: storeResult }]; - } - }); - }); - }; - QueryManager.prototype.markQueryResult = function (queryId, result, _a, fetchMoreForQueryId) { - var fetchPolicy = _a.fetchPolicy, variables = _a.variables, errorPolicy = _a.errorPolicy; - if (fetchPolicy === 'no-cache') { - this.setQuery(queryId, function () { return ({ - newData: { result: result.data, complete: true }, - }); }); - } - else { - this.dataStore.markQueryResult(result, this.getQuery(queryId).document, variables, fetchMoreForQueryId, errorPolicy === 'ignore' || errorPolicy === 'all'); - } - }; - QueryManager.prototype.queryListenerForObserver = function (queryId, options, observer) { - var _this = this; - function invoke(method, argument) { - if (observer[method]) { - try { - observer[method](argument); - } - catch (e) { - process.env.NODE_ENV === "production" || invariant.error(e); - } - } - else if (method === 'error') { - process.env.NODE_ENV === "production" || invariant.error(argument); - } - } - return function (queryStoreValue, newData) { - _this.invalidate(queryId, false); - if (!queryStoreValue) - return; - var _a = _this.getQuery(queryId), observableQuery = _a.observableQuery, document = _a.document; - var fetchPolicy = observableQuery - ? observableQuery.options.fetchPolicy - : options.fetchPolicy; - if (fetchPolicy === 'standby') - return; - var loading = isNetworkRequestInFlight(queryStoreValue.networkStatus); - var lastResult = observableQuery && observableQuery.getLastResult(); - var networkStatusChanged = !!(lastResult && - lastResult.networkStatus !== queryStoreValue.networkStatus); - var shouldNotifyIfLoading = options.returnPartialData || - (!newData && queryStoreValue.previousVariables) || - (networkStatusChanged && options.notifyOnNetworkStatusChange) || - fetchPolicy === 'cache-only' || - fetchPolicy === 'cache-and-network'; - if (loading && !shouldNotifyIfLoading) { - return; - } - var hasGraphQLErrors = isNonEmptyArray(queryStoreValue.graphQLErrors); - var errorPolicy = observableQuery - && observableQuery.options.errorPolicy - || options.errorPolicy - || 'none'; - if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) { - return invoke('error', new ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError, - })); - } - try { - var data = void 0; - var isMissing = void 0; - if (newData) { - if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') { - _this.setQuery(queryId, function () { return ({ newData: null }); }); - } - data = newData.result; - isMissing = !newData.complete; - } - else { - var lastError = observableQuery && observableQuery.getLastError(); - var errorStatusChanged = errorPolicy !== 'none' && - (lastError && lastError.graphQLErrors) !== - queryStoreValue.graphQLErrors; - if (lastResult && lastResult.data && !errorStatusChanged) { - data = lastResult.data; - isMissing = false; - } - else { - var diffResult = _this.dataStore.getCache().diff({ - query: document, - variables: queryStoreValue.previousVariables || - queryStoreValue.variables, - returnPartialData: true, - optimistic: true, - }); - data = diffResult.result; - isMissing = !diffResult.complete; - } - } - var stale = isMissing && !(options.returnPartialData || - fetchPolicy === 'cache-only'); - var resultFromStore = { - data: stale ? lastResult && lastResult.data : data, - loading: loading, - networkStatus: queryStoreValue.networkStatus, - stale: stale, - }; - if (errorPolicy === 'all' && hasGraphQLErrors) { - resultFromStore.errors = queryStoreValue.graphQLErrors; - } - invoke('next', resultFromStore); - } - catch (networkError) { - invoke('error', new ApolloError({ networkError: networkError })); - } - }; - }; - QueryManager.prototype.transform = function (document) { - var transformCache = this.transformCache; - if (!transformCache.has(document)) { - var cache = this.dataStore.getCache(); - var transformed = cache.transformDocument(document); - var forLink = removeConnectionDirectiveFromDocument(cache.transformForLink(transformed)); - var clientQuery = this.localState.clientQuery(transformed); - var serverQuery = this.localState.serverQuery(forLink); - var cacheEntry_1 = { - document: transformed, - hasClientExports: hasClientExports(transformed), - hasForcedResolvers: this.localState.shouldForceResolvers(transformed), - clientQuery: clientQuery, - serverQuery: serverQuery, - defaultVars: getDefaultValues(getOperationDefinition(transformed)), - }; - var add = function (doc) { - if (doc && !transformCache.has(doc)) { - transformCache.set(doc, cacheEntry_1); - } - }; - add(document); - add(transformed); - add(clientQuery); - add(serverQuery); - } - return transformCache.get(document); - }; - QueryManager.prototype.getVariables = function (document, variables) { - return __assign(__assign({}, this.transform(document).defaultVars), variables); - }; - QueryManager.prototype.watchQuery = function (options, shouldSubscribe) { - if (shouldSubscribe === void 0) { shouldSubscribe = true; } - process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'standby', 11) : invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); - options.variables = this.getVariables(options.query, options.variables); - if (typeof options.notifyOnNetworkStatusChange === 'undefined') { - options.notifyOnNetworkStatusChange = false; - } - var transformedOptions = __assign({}, options); - return new ObservableQuery({ - queryManager: this, - options: transformedOptions, - shouldSubscribe: shouldSubscribe, - }); - }; - QueryManager.prototype.query = function (options) { - var _this = this; - process.env.NODE_ENV === "production" ? invariant(options.query, 12) : invariant(options.query, 'query option is required. You must specify your GraphQL document ' + - 'in the query option.'); - process.env.NODE_ENV === "production" ? invariant(options.query.kind === 'Document', 13) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); - process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 14) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); - process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 15) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); - return new Promise(function (resolve, reject) { - var watchedQuery = _this.watchQuery(options, false); - _this.fetchQueryRejectFns.set("query:" + watchedQuery.queryId, reject); - watchedQuery - .result() - .then(resolve, reject) - .then(function () { - return _this.fetchQueryRejectFns.delete("query:" + watchedQuery.queryId); - }); - }); - }; - QueryManager.prototype.generateQueryId = function () { - return String(this.idCounter++); - }; - QueryManager.prototype.stopQueryInStore = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.broadcastQueries(); - }; - QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { - this.stopPollingQuery(queryId); - this.queryStore.stopQuery(queryId); - this.invalidate(queryId); - }; - QueryManager.prototype.addQueryListener = function (queryId, listener) { - this.setQuery(queryId, function (_a) { - var listeners = _a.listeners; - listeners.add(listener); - return { invalidated: false }; - }); - }; - QueryManager.prototype.updateQueryWatch = function (queryId, document, options) { - var _this = this; - var cancel = this.getQuery(queryId).cancel; - if (cancel) - cancel(); - var previousResult = function () { - var previousResult = null; - var observableQuery = _this.getQuery(queryId).observableQuery; - if (observableQuery) { - var lastResult = observableQuery.getLastResult(); - if (lastResult) { - previousResult = lastResult.data; - } - } - return previousResult; - }; - return this.dataStore.getCache().watch({ - query: document, - variables: options.variables, - optimistic: true, - previousResult: previousResult, - callback: function (newData) { - _this.setQuery(queryId, function () { return ({ invalidated: true, newData: newData }); }); - }, - }); - }; - QueryManager.prototype.addObservableQuery = function (queryId, observableQuery) { - this.setQuery(queryId, function () { return ({ observableQuery: observableQuery }); }); - }; - QueryManager.prototype.removeObservableQuery = function (queryId) { - var cancel = this.getQuery(queryId).cancel; - this.setQuery(queryId, function () { return ({ observableQuery: null }); }); - if (cancel) - cancel(); - }; - QueryManager.prototype.clearStore = function () { - this.fetchQueryRejectFns.forEach(function (reject) { - reject(process.env.NODE_ENV === "production" ? new InvariantError(16) : new InvariantError('Store reset while query was in flight (not completed in link chain)')); - }); - var resetIds = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) - resetIds.push(queryId); - }); - this.queryStore.reset(resetIds); - this.mutationStore.reset(); - return this.dataStore.reset(); - }; - QueryManager.prototype.resetStore = function () { - var _this = this; - return this.clearStore().then(function () { - return _this.reFetchObservableQueries(); - }); - }; - QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { - var _this = this; - if (includeStandby === void 0) { includeStandby = false; } - var observableQueryPromises = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) { - var fetchPolicy = observableQuery.options.fetchPolicy; - observableQuery.resetLastResults(); - if (fetchPolicy !== 'cache-only' && - (includeStandby || fetchPolicy !== 'standby')) { - observableQueryPromises.push(observableQuery.refetch()); - } - _this.setQuery(queryId, function () { return ({ newData: null }); }); - _this.invalidate(queryId); - } - }); - this.broadcastQueries(); - return Promise.all(observableQueryPromises); - }; - QueryManager.prototype.observeQuery = function (queryId, options, observer) { - this.addQueryListener(queryId, this.queryListenerForObserver(queryId, options, observer)); - return this.fetchQuery(queryId, options); - }; - QueryManager.prototype.startQuery = function (queryId, options, listener) { - process.env.NODE_ENV === "production" || invariant.warn("The QueryManager.startQuery method has been deprecated"); - this.addQueryListener(queryId, listener); - this.fetchQuery(queryId, options) - .catch(function () { return undefined; }); - return queryId; - }; - QueryManager.prototype.startGraphQLSubscription = function (_a) { - var _this = this; - var query = _a.query, fetchPolicy = _a.fetchPolicy, variables = _a.variables; - query = this.transform(query).document; - variables = this.getVariables(query, variables); - var makeObservable = function (variables) { - return _this.getObservableFromLink(query, {}, variables, false).map(function (result) { - if (!fetchPolicy || fetchPolicy !== 'no-cache') { - _this.dataStore.markSubscriptionResult(result, query, variables); - _this.broadcastQueries(); - } - if (graphQLResultHasError(result)) { - throw new ApolloError({ - graphQLErrors: result.errors, - }); - } - return result; - }); - }; - if (this.transform(query).hasClientExports) { - var observablePromise_1 = this.localState.addExportedVariables(query, variables).then(makeObservable); - return new Observable(function (observer) { - var sub = null; - observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error); - return function () { return sub && sub.unsubscribe(); }; - }); - } - return makeObservable(variables); - }; - QueryManager.prototype.stopQuery = function (queryId) { - this.stopQueryNoBroadcast(queryId); - this.broadcastQueries(); - }; - QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.removeQuery(queryId); - }; - QueryManager.prototype.removeQuery = function (queryId) { - this.fetchQueryRejectFns.delete("query:" + queryId); - this.fetchQueryRejectFns.delete("fetchRequest:" + queryId); - this.getQuery(queryId).subscriptions.forEach(function (x) { return x.unsubscribe(); }); - this.queries.delete(queryId); - }; - QueryManager.prototype.getCurrentQueryResult = function (observableQuery, optimistic) { - if (optimistic === void 0) { optimistic = true; } - var _a = observableQuery.options, variables = _a.variables, query = _a.query, fetchPolicy = _a.fetchPolicy, returnPartialData = _a.returnPartialData; - var lastResult = observableQuery.getLastResult(); - var newData = this.getQuery(observableQuery.queryId).newData; - if (newData && newData.complete) { - return { data: newData.result, partial: false }; - } - if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') { - return { data: undefined, partial: false }; - } - var _b = this.dataStore.getCache().diff({ - query: query, - variables: variables, - previousResult: lastResult ? lastResult.data : undefined, - returnPartialData: true, - optimistic: optimistic, - }), result = _b.result, complete = _b.complete; - return { - data: (complete || returnPartialData) ? result : void 0, - partial: !complete, - }; - }; - QueryManager.prototype.getQueryWithPreviousResult = function (queryIdOrObservable) { - var observableQuery; - if (typeof queryIdOrObservable === 'string') { - var foundObserveableQuery = this.getQuery(queryIdOrObservable).observableQuery; - process.env.NODE_ENV === "production" ? invariant(foundObserveableQuery, 17) : invariant(foundObserveableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); - observableQuery = foundObserveableQuery; - } - else { - observableQuery = queryIdOrObservable; - } - var _a = observableQuery.options, variables = _a.variables, query = _a.query; - return { - previousResult: this.getCurrentQueryResult(observableQuery, false).data, - variables: variables, - document: query, - }; - }; - QueryManager.prototype.broadcastQueries = function () { - var _this = this; - this.onBroadcast(); - this.queries.forEach(function (info, id) { - if (info.invalidated) { - info.listeners.forEach(function (listener) { - if (listener) { - listener(_this.queryStore.get(id), info.newData); - } - }); - } - }); - }; - QueryManager.prototype.getLocalState = function () { - return this.localState; - }; - QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { - var _this = this; - if (deduplication === void 0) { deduplication = this.queryDeduplication; } - var observable; - var serverQuery = this.transform(query).serverQuery; - if (serverQuery) { - var _a = this, inFlightLinkObservables_1 = _a.inFlightLinkObservables, link = _a.link; - var operation = { - query: serverQuery, - variables: variables, - operationName: getOperationName(serverQuery) || void 0, - context: this.prepareContext(__assign(__assign({}, context), { forceFetch: !deduplication })), - }; - context = operation.context; - if (deduplication) { - var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); - inFlightLinkObservables_1.set(serverQuery, byVariables_1); - var varJson_1 = JSON.stringify(variables); - observable = byVariables_1.get(varJson_1); - if (!observable) { - byVariables_1.set(varJson_1, observable = multiplex(execute(link, operation))); - var cleanup = function () { - byVariables_1.delete(varJson_1); - if (!byVariables_1.size) - inFlightLinkObservables_1.delete(serverQuery); - cleanupSub_1.unsubscribe(); - }; - var cleanupSub_1 = observable.subscribe({ - next: cleanup, - error: cleanup, - complete: cleanup, - }); - } - } - else { - observable = multiplex(execute(link, operation)); - } - } - else { - observable = Observable.of({ data: {} }); - context = this.prepareContext(context); - } - var clientQuery = this.transform(query).clientQuery; - if (clientQuery) { - observable = asyncMap(observable, function (result) { - return _this.localState.runResolvers({ - document: clientQuery, - remoteResult: result, - context: context, - variables: variables, - }); - }); - } - return observable; - }; - QueryManager.prototype.fetchRequest = function (_a) { - var _this = this; - var requestId = _a.requestId, queryId = _a.queryId, document = _a.document, options = _a.options, fetchMoreForQueryId = _a.fetchMoreForQueryId; - var variables = options.variables, _b = options.errorPolicy, errorPolicy = _b === void 0 ? 'none' : _b, fetchPolicy = options.fetchPolicy; - var resultFromStore; - var errorsFromStore; - return new Promise(function (resolve, reject) { - var observable = _this.getObservableFromLink(document, options.context, variables); - var fqrfId = "fetchRequest:" + queryId; - _this.fetchQueryRejectFns.set(fqrfId, reject); - var cleanup = function () { - _this.fetchQueryRejectFns.delete(fqrfId); - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.delete(subscription); - }); - }; - var subscription = observable.map(function (result) { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - _this.queryStore.markQueryResult(queryId, result, fetchMoreForQueryId); - _this.invalidate(queryId); - _this.invalidate(fetchMoreForQueryId); - _this.broadcastQueries(); - } - if (errorPolicy === 'none' && isNonEmptyArray(result.errors)) { - return reject(new ApolloError({ - graphQLErrors: result.errors, - })); - } - if (errorPolicy === 'all') { - errorsFromStore = result.errors; - } - if (fetchMoreForQueryId || fetchPolicy === 'no-cache') { - resultFromStore = result.data; - } - else { - var _a = _this.dataStore.getCache().diff({ - variables: variables, - query: document, - optimistic: false, - returnPartialData: true, - }), result_1 = _a.result, complete = _a.complete; - if (complete || options.returnPartialData) { - resultFromStore = result_1; - } - } - }).subscribe({ - error: function (error) { - cleanup(); - reject(error); - }, - complete: function () { - cleanup(); - resolve({ - data: resultFromStore, - errors: errorsFromStore, - loading: false, - networkStatus: NetworkStatus.ready, - stale: false, - }); - }, - }); - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.add(subscription); - }); - }); - }; - QueryManager.prototype.getQuery = function (queryId) { - return (this.queries.get(queryId) || { - listeners: new Set(), - invalidated: false, - document: null, - newData: null, - lastRequestId: 1, - observableQuery: null, - subscriptions: new Set(), - }); - }; - QueryManager.prototype.setQuery = function (queryId, updater) { - var prev = this.getQuery(queryId); - var newInfo = __assign(__assign({}, prev), updater(prev)); - this.queries.set(queryId, newInfo); - }; - QueryManager.prototype.invalidate = function (queryId, invalidated) { - if (invalidated === void 0) { invalidated = true; } - if (queryId) { - this.setQuery(queryId, function () { return ({ invalidated: invalidated }); }); - } - }; - QueryManager.prototype.prepareContext = function (context) { - if (context === void 0) { context = {}; } - var newContext = this.localState.prepareContext(context); - return __assign(__assign({}, newContext), { clientAwareness: this.clientAwareness }); - }; - QueryManager.prototype.checkInFlight = function (queryId) { - var query = this.queryStore.get(queryId); - return (query && - query.networkStatus !== NetworkStatus.ready && - query.networkStatus !== NetworkStatus.error); - }; - QueryManager.prototype.startPollingQuery = function (options, queryId, listener) { - var _this = this; - var pollInterval = options.pollInterval; - process.env.NODE_ENV === "production" ? invariant(pollInterval, 18) : invariant(pollInterval, 'Attempted to start a polling query without a polling interval.'); - if (!this.ssrMode) { - var info = this.pollingInfoByQueryId.get(queryId); - if (!info) { - this.pollingInfoByQueryId.set(queryId, (info = {})); - } - info.interval = pollInterval; - info.options = __assign(__assign({}, options), { fetchPolicy: 'network-only' }); - var maybeFetch_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - if (info) { - if (_this.checkInFlight(queryId)) { - poll_1(); - } - else { - _this.fetchQuery(queryId, info.options, FetchType.poll).then(poll_1, poll_1); - } - } - }; - var poll_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - if (info) { - clearTimeout(info.timeout); - info.timeout = setTimeout(maybeFetch_1, info.interval); - } - }; - if (listener) { - this.addQueryListener(queryId, listener); - } - poll_1(); - } - return queryId; - }; - QueryManager.prototype.stopPollingQuery = function (queryId) { - this.pollingInfoByQueryId.delete(queryId); - }; - return QueryManager; -}()); - -var DataStore = (function () { - function DataStore(initialCache) { - this.cache = initialCache; - } - DataStore.prototype.getCache = function () { - return this.cache; - }; - DataStore.prototype.markQueryResult = function (result, document, variables, fetchMoreForQueryId, ignoreErrors) { - if (ignoreErrors === void 0) { ignoreErrors = false; } - var writeWithErrors = !graphQLResultHasError(result); - if (ignoreErrors && graphQLResultHasError(result) && result.data) { - writeWithErrors = true; - } - if (!fetchMoreForQueryId && writeWithErrors) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_QUERY', - query: document, - variables: variables, - }); - } - }; - DataStore.prototype.markSubscriptionResult = function (result, document, variables) { - if (!graphQLResultHasError(result)) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_SUBSCRIPTION', - query: document, - variables: variables, - }); - } - }; - DataStore.prototype.markMutationInit = function (mutation) { - var _this = this; - if (mutation.optimisticResponse) { - var optimistic_1; - if (typeof mutation.optimisticResponse === 'function') { - optimistic_1 = mutation.optimisticResponse(mutation.variables); - } - else { - optimistic_1 = mutation.optimisticResponse; - } - this.cache.recordOptimisticTransaction(function (c) { - var orig = _this.cache; - _this.cache = c; - try { - _this.markMutationResult({ - mutationId: mutation.mutationId, - result: { data: optimistic_1 }, - document: mutation.document, - variables: mutation.variables, - updateQueries: mutation.updateQueries, - update: mutation.update, - }); - } - finally { - _this.cache = orig; - } - }, mutation.mutationId); - } - }; - DataStore.prototype.markMutationResult = function (mutation) { - var _this = this; - if (!graphQLResultHasError(mutation.result)) { - var cacheWrites_1 = [{ - result: mutation.result.data, - dataId: 'ROOT_MUTATION', - query: mutation.document, - variables: mutation.variables, - }]; - var updateQueries_1 = mutation.updateQueries; - if (updateQueries_1) { - Object.keys(updateQueries_1).forEach(function (id) { - var _a = updateQueries_1[id], query = _a.query, updater = _a.updater; - var _b = _this.cache.diff({ - query: query.document, - variables: query.variables, - returnPartialData: true, - optimistic: false, - }), currentQueryResult = _b.result, complete = _b.complete; - if (complete) { - var nextQueryResult = tryFunctionOrLogError(function () { - return updater(currentQueryResult, { - mutationResult: mutation.result, - queryName: getOperationName(query.document) || undefined, - queryVariables: query.variables, - }); - }); - if (nextQueryResult) { - cacheWrites_1.push({ - result: nextQueryResult, - dataId: 'ROOT_QUERY', - query: query.document, - variables: query.variables, - }); - } - } - }); - } - this.cache.performTransaction(function (c) { - cacheWrites_1.forEach(function (write) { return c.write(write); }); - var update = mutation.update; - if (update) { - tryFunctionOrLogError(function () { return update(c, mutation.result); }); - } - }); - } - }; - DataStore.prototype.markMutationComplete = function (_a) { - var mutationId = _a.mutationId, optimisticResponse = _a.optimisticResponse; - if (optimisticResponse) { - this.cache.removeOptimistic(mutationId); - } - }; - DataStore.prototype.markUpdateQueryResult = function (document, variables, newResult) { - this.cache.write({ - result: newResult, - dataId: 'ROOT_QUERY', - variables: variables, - query: document, - }); - }; - DataStore.prototype.reset = function () { - return this.cache.reset(); - }; - return DataStore; -}()); - -var version = "2.6.10"; - -var hasSuggestedDevtools = false; -var ApolloClient = (function () { - function ApolloClient(options) { - var _this = this; - this.defaultOptions = {}; - this.resetStoreCallbacks = []; - this.clearStoreCallbacks = []; - var cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, connectToDevTools = options.connectToDevTools, _c = options.queryDeduplication, queryDeduplication = _c === void 0 ? true : _c, defaultOptions = options.defaultOptions, _d = options.assumeImmutableResults, assumeImmutableResults = _d === void 0 ? false : _d, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; - var link = options.link; - if (!link && resolvers) { - link = ApolloLink.empty(); - } - if (!link || !cache) { - throw process.env.NODE_ENV === "production" ? new InvariantError(4) : new InvariantError("In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\n" + - "These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\n" + - "For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup"); - } - this.link = link; - this.cache = cache; - this.store = new DataStore(cache); - this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; - this.queryDeduplication = queryDeduplication; - this.defaultOptions = defaultOptions || {}; - this.typeDefs = typeDefs; - if (ssrForceFetchDelay) { - setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); - } - this.watchQuery = this.watchQuery.bind(this); - this.query = this.query.bind(this); - this.mutate = this.mutate.bind(this); - this.resetStore = this.resetStore.bind(this); - this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); - var defaultConnectToDevTools = process.env.NODE_ENV !== 'production' && - typeof window !== 'undefined' && - !window.__APOLLO_CLIENT__; - if (typeof connectToDevTools === 'undefined' - ? defaultConnectToDevTools - : connectToDevTools && typeof window !== 'undefined') { - window.__APOLLO_CLIENT__ = this; - } - if (!hasSuggestedDevtools && process.env.NODE_ENV !== 'production') { - hasSuggestedDevtools = true; - if (typeof window !== 'undefined' && - window.document && - window.top === window.self) { - if (typeof window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - if (window.navigator && - window.navigator.userAgent && - window.navigator.userAgent.indexOf('Chrome') > -1) { - console.debug('Download the Apollo DevTools ' + - 'for a better development experience: ' + - 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm'); - } - } - } - } - this.version = version; - this.localState = new LocalState({ - cache: cache, - client: this, - resolvers: resolvers, - fragmentMatcher: fragmentMatcher, - }); - this.queryManager = new QueryManager({ - link: this.link, - store: this.store, - queryDeduplication: queryDeduplication, - ssrMode: ssrMode, - clientAwareness: { - name: clientAwarenessName, - version: clientAwarenessVersion, - }, - localState: this.localState, - assumeImmutableResults: assumeImmutableResults, - onBroadcast: function () { - if (_this.devToolsHookCb) { - _this.devToolsHookCb({ - action: {}, - state: { - queries: _this.queryManager.queryStore.getStore(), - mutations: _this.queryManager.mutationStore.getStore(), - }, - dataWithOptimisticResults: _this.cache.extract(true), - }); - } - }, - }); - } - ApolloClient.prototype.stop = function () { - this.queryManager.stop(); - }; - ApolloClient.prototype.watchQuery = function (options) { - if (this.defaultOptions.watchQuery) { - options = __assign(__assign({}, this.defaultOptions.watchQuery), options); - } - if (this.disableNetworkFetches && - (options.fetchPolicy === 'network-only' || - options.fetchPolicy === 'cache-and-network')) { - options = __assign(__assign({}, options), { fetchPolicy: 'cache-first' }); - } - return this.queryManager.watchQuery(options); - }; - ApolloClient.prototype.query = function (options) { - if (this.defaultOptions.query) { - options = __assign(__assign({}, this.defaultOptions.query), options); - } - process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'cache-and-network', 5) : invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + - 'client.query can only return a single result. Please use client.watchQuery ' + - 'to receive multiple results from the cache and the network, or consider ' + - 'using a different fetchPolicy, such as cache-first or network-only.'); - if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { - options = __assign(__assign({}, options), { fetchPolicy: 'cache-first' }); - } - return this.queryManager.query(options); - }; - ApolloClient.prototype.mutate = function (options) { - if (this.defaultOptions.mutate) { - options = __assign(__assign({}, this.defaultOptions.mutate), options); - } - return this.queryManager.mutate(options); - }; - ApolloClient.prototype.subscribe = function (options) { - return this.queryManager.startGraphQLSubscription(options); - }; - ApolloClient.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.cache.readQuery(options, optimistic); - }; - ApolloClient.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.cache.readFragment(options, optimistic); - }; - ApolloClient.prototype.writeQuery = function (options) { - var result = this.cache.writeQuery(options); - this.queryManager.broadcastQueries(); - return result; - }; - ApolloClient.prototype.writeFragment = function (options) { - var result = this.cache.writeFragment(options); - this.queryManager.broadcastQueries(); - return result; - }; - ApolloClient.prototype.writeData = function (options) { - var result = this.cache.writeData(options); - this.queryManager.broadcastQueries(); - return result; - }; - ApolloClient.prototype.__actionHookForDevTools = function (cb) { - this.devToolsHookCb = cb; - }; - ApolloClient.prototype.__requestRaw = function (payload) { - return execute(this.link, payload); - }; - ApolloClient.prototype.initQueryManager = function () { - process.env.NODE_ENV === "production" || invariant.warn('Calling the initQueryManager method is no longer necessary, ' + - 'and it will be removed from ApolloClient in version 3.0.'); - return this.queryManager; - }; - ApolloClient.prototype.resetStore = function () { - var _this = this; - return Promise.resolve() - .then(function () { return _this.queryManager.clearStore(); }) - .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) - .then(function () { return _this.reFetchObservableQueries(); }); - }; - ApolloClient.prototype.clearStore = function () { - var _this = this; - return Promise.resolve() - .then(function () { return _this.queryManager.clearStore(); }) - .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); - }; - ApolloClient.prototype.onResetStore = function (cb) { - var _this = this; - this.resetStoreCallbacks.push(cb); - return function () { - _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); - }; - }; - ApolloClient.prototype.onClearStore = function (cb) { - var _this = this; - this.clearStoreCallbacks.push(cb); - return function () { - _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); - }; - }; - ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { - return this.queryManager.reFetchObservableQueries(includeStandby); - }; - ApolloClient.prototype.extract = function (optimistic) { - return this.cache.extract(optimistic); - }; - ApolloClient.prototype.restore = function (serializedState) { - return this.cache.restore(serializedState); - }; - ApolloClient.prototype.addResolvers = function (resolvers) { - this.localState.addResolvers(resolvers); - }; - ApolloClient.prototype.setResolvers = function (resolvers) { - this.localState.setResolvers(resolvers); - }; - ApolloClient.prototype.getResolvers = function () { - return this.localState.getResolvers(); - }; - ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { - this.localState.setFragmentMatcher(fragmentMatcher); - }; - return ApolloClient; -}()); - -export default ApolloClient; -export { ApolloClient, ApolloError, FetchType, NetworkStatus, ObservableQuery, isApolloError }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-client/bundle.esm.js.map b/node_modules/apollo-client/bundle.esm.js.map deleted file mode 100644 index e1b9a1fd..00000000 --- a/node_modules/apollo-client/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/core/networkStatus.ts","../src/util/Observable.ts","../src/util/arrays.ts","../src/errors/ApolloError.ts","../src/core/types.ts","../src/core/ObservableQuery.ts","../src/data/mutations.ts","../src/data/queries.ts","../src/util/capitalizeFirstLetter.ts","../src/core/LocalState.ts","../src/util/observables.ts","../src/core/QueryManager.ts","../src/data/store.ts","../src/version.ts","../src/ApolloClient.ts"],"sourcesContent":["/**\n * The current status of a query’s execution in our system.\n */\nexport enum NetworkStatus {\n /**\n * The query has never been run before and the query is now currently running. A query will still\n * have this network status even if a partial data result was returned from the cache, but a\n * query was dispatched anyway.\n */\n loading = 1,\n\n /**\n * If `setVariables` was called and a query was fired because of that then the network status\n * will be `setVariables` until the result of that query comes back.\n */\n setVariables = 2,\n\n /**\n * Indicates that `fetchMore` was called on this query and that the query created is currently in\n * flight.\n */\n fetchMore = 3,\n\n /**\n * Similar to the `setVariables` network status. It means that `refetch` was called on a query\n * and the refetch request is currently in flight.\n */\n refetch = 4,\n\n /**\n * Indicates that a polling query is currently in flight. So for example if you are polling a\n * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever\n * a poll request has been sent but not resolved.\n */\n poll = 6,\n\n /**\n * No request is in flight for this query, and no errors happened. Everything is OK.\n */\n ready = 7,\n\n /**\n * No request is in flight for this query, but one or more errors were detected.\n */\n error = 8,\n}\n\n/**\n * Returns true if there is currently a network request in flight according to a given network\n * status.\n */\nexport function isNetworkRequestInFlight(\n networkStatus: NetworkStatus,\n): boolean {\n return networkStatus < 7;\n}\n","// This simplified polyfill attempts to follow the ECMAScript Observable proposal.\n// See https://github.com/zenparsing/es-observable\nimport { Observable as LinkObservable } from 'apollo-link';\n\nexport type Subscription = ZenObservable.Subscription;\nexport type Observer = ZenObservable.Observer;\n\nimport $$observable from 'symbol-observable';\n\n// rxjs interopt\nexport class Observable extends LinkObservable {\n public [$$observable]() {\n return this;\n }\n\n public ['@@observable' as any]() {\n return this;\n }\n}\n","export function isNonEmptyArray(value?: ArrayLike): value is Array {\n return Array.isArray(value) && value.length > 0;\n}\n","import { GraphQLError } from 'graphql';\nimport { isNonEmptyArray } from '../util/arrays';\n\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty('graphQLErrors');\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n let message = '';\n // If we have GraphQL errors present, add that to the error message.\n if (isNonEmptyArray(err.graphQLErrors)) {\n err.graphQLErrors.forEach((graphQLError: GraphQLError) => {\n const errorMessage = graphQLError\n ? graphQLError.message\n : 'Error message not found.';\n message += `GraphQL error: ${errorMessage}\\n`;\n });\n }\n\n if (err.networkError) {\n message += 'Network error: ' + err.networkError.message + '\\n';\n }\n\n // strip newline from the end of the message\n message = message.replace(/\\n$/, '');\n return message;\n};\n\nexport class ApolloError extends Error {\n public message: string;\n public graphQLErrors: ReadonlyArray;\n public networkError: Error | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: {\n graphQLErrors?: ReadonlyArray;\n networkError?: Error | null;\n errorMessage?: string;\n extraInfo?: any;\n }) {\n super(errorMessage);\n this.graphQLErrors = graphQLErrors || [];\n this.networkError = networkError || null;\n\n if (!errorMessage) {\n this.message = generateErrorMessage(this);\n } else {\n this.message = errorMessage;\n }\n\n this.extraInfo = extraInfo;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n","import { FetchResult } from 'apollo-link';\nimport { DocumentNode, GraphQLError } from 'graphql';\n\nimport { QueryStoreValue } from '../data/queries';\nimport { NetworkStatus } from './networkStatus';\nimport { Resolver } from './LocalState';\n\nexport type QueryListener = (\n queryStoreValue: QueryStoreValue,\n newData?: any,\n forceResolvers?: boolean,\n) => void;\n\nexport type OperationVariables = { [key: string]: any };\n\nexport type PureQueryOptions = {\n query: DocumentNode;\n variables?: { [key: string]: any };\n context?: any;\n};\n\nexport type ApolloQueryResult = {\n data: T;\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n stale: boolean;\n};\n\nexport enum FetchType {\n normal = 1,\n refetch = 2,\n poll = 3,\n}\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer = (\n previousResult: Record,\n options: {\n mutationResult: FetchResult;\n queryName: string | undefined;\n queryVariables: Record;\n },\n) => Record;\n\nexport type MutationQueryReducersMap = {\n [queryName: string]: MutationQueryReducer;\n};\n\nexport interface Resolvers {\n [key: string]: {\n [ field: string ]: Resolver;\n };\n}\n","import {\n isEqual,\n tryFunctionOrLogError,\n cloneDeep,\n getOperationDefinition,\n} from 'apollo-utilities';\nimport { GraphQLError } from 'graphql';\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport { Observable, Observer, Subscription } from '../util/Observable';\nimport { ApolloError } from '../errors/ApolloError';\nimport { QueryManager } from './QueryManager';\nimport { ApolloQueryResult, FetchType, OperationVariables } from './types';\nimport {\n WatchQueryOptions,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n ErrorPolicy,\n} from './watchQueryOptions';\n\nimport { QueryStoreValue } from '../data/queries';\n\nimport { invariant, InvariantError } from 'ts-invariant';\nimport { isNonEmptyArray } from '../util/arrays';\n\n// XXX remove in the next breaking semver change (3.0)\n// Deprecated, use ApolloCurrentQueryResult\nexport type ApolloCurrentResult = {\n data: T | {};\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n error?: ApolloError;\n partial?: boolean;\n};\n\nexport type ApolloCurrentQueryResult = {\n data: T | undefined;\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n error?: ApolloError;\n partial?: boolean;\n stale?: boolean;\n};\n\nexport interface FetchMoreOptions<\n TData = any,\n TVariables = OperationVariables\n> {\n updateQuery: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult?: TData;\n variables?: TVariables;\n },\n ) => TData;\n}\n\nexport interface UpdateQueryOptions {\n variables?: TVariables;\n}\n\nexport const hasError = (\n storeValue: QueryStoreValue,\n policy: ErrorPolicy = 'none',\n) => storeValue && (\n storeValue.networkError ||\n (policy === 'none' && isNonEmptyArray(storeValue.graphQLErrors))\n);\n\nexport class ObservableQuery<\n TData = any,\n TVariables = OperationVariables\n> extends Observable> {\n public options: WatchQueryOptions;\n public readonly queryId: string;\n public readonly queryName?: string;\n /**\n *\n * The current value of the variables for this query. Can change.\n */\n public variables: TVariables;\n\n private shouldSubscribe: boolean;\n private isTornDown: boolean;\n private queryManager: QueryManager;\n private observers = new Set>>();\n private subscriptions = new Set();\n\n private lastResult: ApolloQueryResult;\n private lastResultSnapshot: ApolloQueryResult;\n private lastError: ApolloError;\n\n constructor({\n queryManager,\n options,\n shouldSubscribe = true,\n }: {\n queryManager: QueryManager;\n options: WatchQueryOptions;\n shouldSubscribe?: boolean;\n }) {\n super((observer: Observer>) =>\n this.onSubscribe(observer),\n );\n\n // active state\n this.isTornDown = false;\n\n // query information\n this.options = options;\n this.variables = options.variables || ({} as TVariables);\n this.queryId = queryManager.generateQueryId();\n this.shouldSubscribe = shouldSubscribe;\n\n const opDef = getOperationDefinition(options.query);\n this.queryName = opDef && opDef.name && opDef.name.value;\n\n // related classes\n this.queryManager = queryManager;\n }\n\n public result(): Promise> {\n return new Promise((resolve, reject) => {\n const observer: Observer> = {\n next: (result: ApolloQueryResult) => {\n resolve(result);\n\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n this.observers.delete(observer);\n if (!this.observers.size) {\n this.queryManager.removeQuery(this.queryId);\n }\n\n setTimeout(() => {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n const subscription = this.subscribe(observer);\n });\n }\n\n // XXX remove in the next breaking semver change (3.0)\n // Deprecated, use getCurrentResult()\n public currentResult(): ApolloCurrentResult {\n const result = this.getCurrentResult() as ApolloCurrentResult;\n if (result.data === undefined) {\n result.data = {};\n }\n return result;\n }\n\n /**\n * Return the result of the query from the local cache as well as some fetching status\n * `loading` and `networkStatus` allow to know if a request is in flight\n * `partial` lets you know if the result from the local cache is complete or partial\n * @return {data: Object, error: ApolloError, loading: boolean, networkStatus: number, partial: boolean}\n */\n public getCurrentResult(): ApolloCurrentQueryResult {\n if (this.isTornDown) {\n const { lastResult } = this;\n return {\n data: !this.lastError && lastResult && lastResult.data || void 0,\n error: this.lastError,\n loading: false,\n networkStatus: NetworkStatus.error,\n };\n }\n\n const { data, partial } = this.queryManager.getCurrentQueryResult(this);\n const queryStoreValue = this.queryManager.queryStore.get(this.queryId);\n let result: ApolloQueryResult;\n\n const { fetchPolicy } = this.options;\n\n const isNetworkFetchPolicy =\n fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache';\n\n if (queryStoreValue) {\n const { networkStatus } = queryStoreValue;\n\n if (hasError(queryStoreValue, this.options.errorPolicy)) {\n return {\n data: void 0,\n loading: false,\n networkStatus,\n error: new ApolloError({\n graphQLErrors: queryStoreValue.graphQLErrors,\n networkError: queryStoreValue.networkError,\n }),\n };\n }\n\n // Variables might have been added dynamically at query time, when\n // using `@client @export(as: \"varname\")` for example. When this happens,\n // the variables have been updated in the query store, but not updated on\n // the original `ObservableQuery`. We'll update the observable query\n // variables here to match, so retrieving from the cache doesn't fail.\n if (queryStoreValue.variables) {\n this.options.variables = {\n ...this.options.variables,\n ...(queryStoreValue.variables as TVariables),\n };\n this.variables = this.options.variables;\n }\n\n result = {\n data,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n } as ApolloQueryResult;\n\n if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') {\n result.errors = queryStoreValue.graphQLErrors;\n }\n\n } else {\n // We need to be careful about the loading state we show to the user, to try\n // and be vaguely in line with what the user would have seen from .subscribe()\n // but to still provide useful information synchronously when the query\n // will not end up hitting the server.\n // See more: https://github.com/apollostack/apollo-client/issues/707\n // Basically: is there a query in flight right now (modolo the next tick)?\n const loading = isNetworkFetchPolicy ||\n (partial && fetchPolicy !== 'cache-only');\n\n result = {\n data,\n loading,\n networkStatus: loading ? NetworkStatus.loading : NetworkStatus.ready,\n } as ApolloQueryResult;\n }\n\n if (!partial) {\n this.updateLastResult({ ...result, stale: false });\n }\n\n return { ...result, partial };\n }\n\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n public isDifferentFromLastResult(newResult: ApolloQueryResult) {\n const { lastResultSnapshot: snapshot } = this;\n return !(\n snapshot &&\n newResult &&\n snapshot.networkStatus === newResult.networkStatus &&\n snapshot.stale === newResult.stale &&\n isEqual(snapshot.data, newResult.data)\n );\n }\n\n // Returns the last result that observer.next was called with. This is not the same as\n // getCurrentResult! If you're not sure which you need, then you probably need getCurrentResult.\n public getLastResult(): ApolloQueryResult {\n return this.lastResult;\n }\n\n public getLastError(): ApolloError {\n return this.lastError;\n }\n\n public resetLastResults(): void {\n delete this.lastResult;\n delete this.lastResultSnapshot;\n delete this.lastError;\n this.isTornDown = false;\n }\n\n public resetQueryStoreErrors() {\n const queryStore = this.queryManager.queryStore.get(this.queryId);\n if (queryStore) {\n queryStore.networkError = null;\n queryStore.graphQLErrors = [];\n }\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public refetch(variables?: TVariables): Promise> {\n let { fetchPolicy } = this.options;\n // early return if trying to read from cache during refetch\n if (fetchPolicy === 'cache-only') {\n return Promise.reject(new InvariantError(\n 'cache-only fetchPolicy option should not be used together with query refetch.',\n ));\n }\n\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n if (fetchPolicy !== 'no-cache' &&\n fetchPolicy !== 'cache-and-network') {\n fetchPolicy = 'network-only';\n }\n\n if (!isEqual(this.variables, variables)) {\n // update observable variables\n this.variables = {\n ...this.variables,\n ...variables,\n };\n }\n\n if (!isEqual(this.options.variables, this.variables)) {\n // Update the existing options with new variables\n this.options.variables = {\n ...this.options.variables,\n ...this.variables,\n };\n }\n\n return this.queryManager.fetchQuery(\n this.queryId,\n { ...this.options, fetchPolicy },\n FetchType.refetch,\n ) as Promise>;\n }\n\n public fetchMore(\n fetchMoreOptions: FetchMoreQueryOptions &\n FetchMoreOptions,\n ): Promise> {\n // early return if no update Query\n invariant(\n fetchMoreOptions.updateQuery,\n 'updateQuery option is required. This function defines how to update the query data with the new results.',\n );\n\n const combinedOptions = {\n ...(fetchMoreOptions.query ? fetchMoreOptions : {\n ...this.options,\n ...fetchMoreOptions,\n variables: {\n ...this.variables,\n ...fetchMoreOptions.variables,\n },\n }),\n fetchPolicy: 'network-only',\n } as WatchQueryOptions;\n\n const qid = this.queryManager.generateQueryId();\n\n return this.queryManager\n .fetchQuery(\n qid,\n combinedOptions,\n FetchType.normal,\n this.queryId,\n )\n .then(\n fetchMoreResult => {\n this.updateQuery((previousResult: any) =>\n fetchMoreOptions.updateQuery(previousResult, {\n fetchMoreResult: fetchMoreResult.data as TData,\n variables: combinedOptions.variables as TVariables,\n }),\n );\n this.queryManager.stopQuery(qid);\n return fetchMoreResult as ApolloQueryResult;\n },\n error => {\n this.queryManager.stopQuery(qid);\n throw error;\n },\n );\n }\n\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n public subscribeToMore<\n TSubscriptionData = TData,\n TSubscriptionVariables = TVariables\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >,\n ) {\n const subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n })\n .subscribe({\n next: (subscriptionData: { data: TSubscriptionData }) => {\n const { updateQuery } = options;\n if (updateQuery) {\n this.updateQuery(\n (previous, { variables }) =>\n updateQuery(previous, {\n subscriptionData,\n variables,\n }),\n );\n }\n },\n error: (err: any) => {\n if (options.onError) {\n options.onError(err);\n return;\n }\n invariant.error('Unhandled GraphQL subscription error', err);\n },\n });\n\n this.subscriptions.add(subscription);\n\n return () => {\n if (this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n }\n\n // Note: if the query is not active (there are no subscribers), the promise\n // will return null immediately.\n public setOptions(\n opts: WatchQueryOptions,\n ): Promise | void> {\n const { fetchPolicy: oldFetchPolicy } = this.options;\n this.options = {\n ...this.options,\n ...opts,\n } as WatchQueryOptions;\n\n if (opts.pollInterval) {\n this.startPolling(opts.pollInterval);\n } else if (opts.pollInterval === 0) {\n this.stopPolling();\n }\n\n const { fetchPolicy } = opts;\n\n return this.setVariables(\n this.options.variables as TVariables,\n // Try to fetch the query if fetchPolicy changed from either cache-only\n // or standby to something else, or changed to network-only.\n oldFetchPolicy !== fetchPolicy && (\n oldFetchPolicy === 'cache-only' ||\n oldFetchPolicy === 'standby' ||\n fetchPolicy === 'network-only'\n ),\n opts.fetchResults,\n );\n }\n\n /**\n * This is for *internal* use only. Most users should instead use `refetch`\n * in order to be properly notified of results even when they come from cache.\n *\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. If you want to force new results, use `refetch`.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @private\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n *\n * @param tryFetch: Try and fetch new results even if the variables haven't\n * changed (we may still just hit the store, but if there's nothing in there\n * this will refetch)\n *\n * @param fetchResults: Option to ignore fetching results when updating variables\n */\n public setVariables(\n variables: TVariables,\n tryFetch: boolean = false,\n fetchResults = true,\n ): Promise | void> {\n // since setVariables restarts the subscription, we reset the tornDown status\n this.isTornDown = false;\n\n variables = variables || this.variables;\n\n if (!tryFetch && isEqual(variables, this.variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size && fetchResults\n ? this.result()\n : Promise.resolve();\n }\n\n this.variables = this.options.variables = variables;\n\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n\n // Use the same options as before, but with new variables\n return this.queryManager.fetchQuery(\n this.queryId,\n this.options,\n ) as Promise>;\n }\n\n public updateQuery(\n mapFn: (\n previousQueryResult: TData,\n options: UpdateQueryOptions,\n ) => TData,\n ): void {\n const { queryManager } = this;\n const {\n previousResult,\n variables,\n document,\n } = queryManager.getQueryWithPreviousResult(\n this.queryId,\n );\n\n const newResult = tryFunctionOrLogError(() =>\n mapFn(previousResult, { variables }),\n );\n\n if (newResult) {\n queryManager.dataStore.markUpdateQueryResult(\n document,\n variables,\n newResult,\n );\n queryManager.broadcastQueries();\n }\n }\n\n public stopPolling() {\n this.queryManager.stopPollingQuery(this.queryId);\n this.options.pollInterval = undefined;\n }\n\n public startPolling(pollInterval: number) {\n assertNotCacheFirstOrOnly(this);\n this.options.pollInterval = pollInterval;\n this.queryManager.startPollingQuery(this.options, this.queryId);\n }\n\n private updateLastResult(newResult: ApolloQueryResult) {\n const previousResult = this.lastResult;\n this.lastResult = newResult;\n this.lastResultSnapshot = this.queryManager.assumeImmutableResults\n ? newResult\n : cloneDeep(newResult);\n return previousResult;\n }\n\n private onSubscribe(observer: Observer>) {\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = (observer as any)._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n } catch {}\n\n const first = !this.observers.size;\n this.observers.add(observer);\n\n // Deliver initial result\n if (observer.next && this.lastResult) observer.next(this.lastResult);\n if (observer.error && this.lastError) observer.error(this.lastError);\n\n // setup the query if it hasn't been done before\n if (first) {\n this.setUpQuery();\n }\n\n return () => {\n if (this.observers.delete(observer) && !this.observers.size) {\n this.tearDownQuery();\n }\n };\n }\n\n private setUpQuery() {\n const { queryManager, queryId } = this;\n\n if (this.shouldSubscribe) {\n queryManager.addObservableQuery(queryId, this);\n }\n\n if (this.options.pollInterval) {\n assertNotCacheFirstOrOnly(this);\n queryManager.startPollingQuery(this.options, queryId);\n }\n\n const onError = (error: ApolloError) => {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n this.updateLastResult({\n ...this.lastResult,\n errors: error.graphQLErrors,\n networkStatus: NetworkStatus.error,\n loading: false,\n });\n iterateObserversSafely(this.observers, 'error', this.lastError = error);\n };\n\n queryManager.observeQuery(queryId, this.options, {\n next: (result: ApolloQueryResult) => {\n if (this.lastError || this.isDifferentFromLastResult(result)) {\n const previousResult = this.updateLastResult(result);\n const { query, variables, fetchPolicy } = this.options;\n\n // Before calling `next` on each observer, we need to first see if\n // the query is using `@client @export` directives, and update\n // any variables that might have changed. If `@export` variables have\n // changed, and the query is calling against both local and remote\n // data, a refetch is needed to pull in new data, using the\n // updated `@export` variables.\n if (queryManager.transform(query).hasClientExports) {\n queryManager.getLocalState().addExportedVariables(\n query,\n variables,\n ).then((variables: TVariables) => {\n const previousVariables = this.variables;\n this.variables = this.options.variables = variables;\n if (\n !result.loading &&\n previousResult &&\n fetchPolicy !== 'cache-only' &&\n queryManager.transform(query).serverQuery &&\n !isEqual(previousVariables, variables)\n ) {\n this.refetch();\n } else {\n iterateObserversSafely(this.observers, 'next', result);\n }\n });\n } else {\n iterateObserversSafely(this.observers, 'next', result);\n }\n }\n },\n error: onError,\n }).catch(onError);\n }\n\n private tearDownQuery() {\n const { queryManager } = this;\n\n this.isTornDown = true;\n queryManager.stopPollingQuery(this.queryId);\n\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(sub => sub.unsubscribe());\n this.subscriptions.clear();\n\n queryManager.removeObservableQuery(this.queryId);\n queryManager.stopQuery(this.queryId);\n\n this.observers.clear();\n }\n}\n\nfunction defaultSubscriptionObserverErrorCallback(error: ApolloError) {\n invariant.error('Unhandled error', error.message, error.stack);\n}\n\nfunction iterateObserversSafely(\n observers: Set>,\n method: keyof Observer,\n argument?: A,\n) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n const observersWithMethod: Observer[] = [];\n observers.forEach(obs => obs[method] && observersWithMethod.push(obs));\n observersWithMethod.forEach(obs => (obs as any)[method](argument));\n}\n\nfunction assertNotCacheFirstOrOnly(\n obsQuery: ObservableQuery,\n) {\n const { fetchPolicy } = obsQuery.options;\n invariant(\n fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only',\n 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.',\n );\n}\n","import { DocumentNode } from 'graphql';\n\nexport class MutationStore {\n private store: { [mutationId: string]: MutationStoreValue } = {};\n\n public getStore(): { [mutationId: string]: MutationStoreValue } {\n return this.store;\n }\n\n public get(mutationId: string): MutationStoreValue {\n return this.store[mutationId];\n }\n\n public initMutation(\n mutationId: string,\n mutation: DocumentNode,\n variables: Object | undefined,\n ) {\n this.store[mutationId] = {\n mutation,\n variables: variables || {},\n loading: true,\n error: null,\n };\n }\n\n public markMutationError(mutationId: string, error: Error) {\n const mutation = this.store[mutationId];\n if (mutation) {\n mutation.loading = false;\n mutation.error = error;\n }\n }\n\n public markMutationResult(mutationId: string) {\n const mutation = this.store[mutationId];\n if (mutation) {\n mutation.loading = false;\n mutation.error = null;\n }\n }\n\n public reset() {\n this.store = {};\n }\n}\n\nexport interface MutationStoreValue {\n mutation: DocumentNode;\n variables: Object;\n loading: boolean;\n error: Error | null;\n}\n","import { DocumentNode, GraphQLError, ExecutionResult } from 'graphql';\nimport { isEqual } from 'apollo-utilities';\nimport { invariant } from 'ts-invariant';\nimport { NetworkStatus } from '../core/networkStatus';\nimport { isNonEmptyArray } from '../util/arrays';\n\nexport type QueryStoreValue = {\n document: DocumentNode;\n variables: Object;\n previousVariables?: Object | null;\n networkStatus: NetworkStatus;\n networkError?: Error | null;\n graphQLErrors?: ReadonlyArray;\n metadata: any;\n};\n\nexport class QueryStore {\n private store: { [queryId: string]: QueryStoreValue } = {};\n\n public getStore(): { [queryId: string]: QueryStoreValue } {\n return this.store;\n }\n\n public get(queryId: string): QueryStoreValue {\n return this.store[queryId];\n }\n\n public initQuery(query: {\n queryId: string;\n document: DocumentNode;\n storePreviousVariables: boolean;\n variables: Object;\n isPoll: boolean;\n isRefetch: boolean;\n metadata: any;\n fetchMoreForQueryId: string | undefined;\n }) {\n const previousQuery = this.store[query.queryId];\n\n // XXX we're throwing an error here to catch bugs where a query gets overwritten by a new one.\n // we should implement a separate action for refetching so that QUERY_INIT may never overwrite\n // an existing query (see also: https://github.com/apollostack/apollo-client/issues/732)\n invariant(\n !previousQuery ||\n previousQuery.document === query.document ||\n isEqual(previousQuery.document, query.document),\n 'Internal Error: may not update existing query string in store',\n );\n\n let isSetVariables = false;\n\n let previousVariables: Object | null = null;\n if (\n query.storePreviousVariables &&\n previousQuery &&\n previousQuery.networkStatus !== NetworkStatus.loading\n // if the previous query was still loading, we don't want to remember it at all.\n ) {\n if (!isEqual(previousQuery.variables, query.variables)) {\n isSetVariables = true;\n previousVariables = previousQuery.variables;\n }\n }\n\n // TODO break this out into a separate function\n let networkStatus;\n if (isSetVariables) {\n networkStatus = NetworkStatus.setVariables;\n } else if (query.isPoll) {\n networkStatus = NetworkStatus.poll;\n } else if (query.isRefetch) {\n networkStatus = NetworkStatus.refetch;\n // TODO: can we determine setVariables here if it's a refetch and the variables have changed?\n } else {\n networkStatus = NetworkStatus.loading;\n }\n\n let graphQLErrors: ReadonlyArray = [];\n if (previousQuery && previousQuery.graphQLErrors) {\n graphQLErrors = previousQuery.graphQLErrors;\n }\n\n // XXX right now if QUERY_INIT is fired twice, like in a refetch situation, we just overwrite\n // the store. We probably want a refetch action instead, because I suspect that if you refetch\n // before the initial fetch is done, you'll get an error.\n this.store[query.queryId] = {\n document: query.document,\n variables: query.variables,\n previousVariables,\n networkError: null,\n graphQLErrors: graphQLErrors,\n networkStatus,\n metadata: query.metadata,\n };\n\n // If the action had a `moreForQueryId` property then we need to set the\n // network status on that query as well to `fetchMore`.\n //\n // We have a complement to this if statement in the query result and query\n // error action branch, but importantly *not* in the client result branch.\n // This is because the implementation of `fetchMore` *always* sets\n // `fetchPolicy` to `network-only` so we would never have a client result.\n if (\n typeof query.fetchMoreForQueryId === 'string' &&\n this.store[query.fetchMoreForQueryId]\n ) {\n this.store[query.fetchMoreForQueryId].networkStatus =\n NetworkStatus.fetchMore;\n }\n }\n\n public markQueryResult(\n queryId: string,\n result: ExecutionResult,\n fetchMoreForQueryId: string | undefined,\n ) {\n if (!this.store || !this.store[queryId]) return;\n\n this.store[queryId].networkError = null;\n this.store[queryId].graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : [];\n this.store[queryId].previousVariables = null;\n this.store[queryId].networkStatus = NetworkStatus.ready;\n\n // If we have a `fetchMoreForQueryId` then we need to update the network\n // status for that query. See the branch for query initialization for more\n // explanation about this process.\n if (\n typeof fetchMoreForQueryId === 'string' &&\n this.store[fetchMoreForQueryId]\n ) {\n this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready;\n }\n }\n\n public markQueryError(\n queryId: string,\n error: Error,\n fetchMoreForQueryId: string | undefined,\n ) {\n if (!this.store || !this.store[queryId]) return;\n\n this.store[queryId].networkError = error;\n this.store[queryId].networkStatus = NetworkStatus.error;\n\n // If we have a `fetchMoreForQueryId` then we need to update the network\n // status for that query. See the branch for query initialization for more\n // explanation about this process.\n if (typeof fetchMoreForQueryId === 'string') {\n this.markQueryResultClient(fetchMoreForQueryId, true);\n }\n }\n\n public markQueryResultClient(queryId: string, complete: boolean) {\n const storeValue = this.store && this.store[queryId];\n if (storeValue) {\n storeValue.networkError = null;\n storeValue.previousVariables = null;\n if (complete) {\n storeValue.networkStatus = NetworkStatus.ready;\n }\n }\n }\n\n public stopQuery(queryId: string) {\n delete this.store[queryId];\n }\n\n public reset(observableQueryIds: string[]) {\n Object.keys(this.store).forEach(queryId => {\n if (observableQueryIds.indexOf(queryId) < 0) {\n this.stopQuery(queryId);\n } else {\n // XXX set loading to true so listeners don't trigger unless they want results with partial data\n this.store[queryId].networkStatus = NetworkStatus.loading;\n }\n });\n }\n}\n","export function capitalizeFirstLetter(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n SelectionNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n FieldNode,\n ASTNode,\n} from 'graphql';\nimport { visit, BREAK } from 'graphql/language/visitor';\n\nimport { ApolloCache } from 'apollo-cache';\nimport {\n getMainDefinition,\n buildQueryFromSelectionSet,\n hasDirectives,\n removeClientSetsFromDocument,\n mergeDeep,\n mergeDeepArray,\n FragmentMap,\n argumentsObjectFromField,\n resultKeyNameFromField,\n getFragmentDefinitions,\n createFragmentMap,\n shouldInclude,\n isField,\n isInlineFragment,\n} from 'apollo-utilities';\nimport { FetchResult } from 'apollo-link';\n\nimport { invariant } from 'ts-invariant';\n\nimport ApolloClient from '../ApolloClient';\nimport { Resolvers, OperationVariables } from './types';\nimport { capitalizeFirstLetter } from '../util/capitalizeFirstLetter';\n\nexport type Resolver = (\n rootValue?: any,\n args?: any,\n context?: any,\n info?: {\n field: FieldNode;\n fragmentMap: FragmentMap;\n },\n) => any;\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: any,\n) => boolean;\n\nexport type ExecContext = {\n fragmentMap: FragmentMap;\n context: any;\n variables: VariableMap;\n fragmentMatcher: FragmentMatcher;\n defaultOperationType: string;\n exportedVariables: Record;\n onlyRunForcedResolvers: boolean;\n};\n\nexport type LocalStateOptions = {\n cache: ApolloCache;\n client?: ApolloClient;\n resolvers?: Resolvers | Resolvers[];\n fragmentMatcher?: FragmentMatcher;\n};\n\nexport class LocalState {\n private cache: ApolloCache;\n private client: ApolloClient;\n private resolvers?: Resolvers;\n private fragmentMatcher: FragmentMatcher;\n\n constructor({\n cache,\n client,\n resolvers,\n fragmentMatcher,\n }: LocalStateOptions) {\n this.cache = cache;\n\n if (client) {\n this.client = client;\n }\n\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach(resolverGroup => {\n this.resolvers = mergeDeep(this.resolvers, resolverGroup);\n });\n } else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n }\n\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n }\n\n public getResolvers() {\n return this.resolvers || {};\n }\n\n // Run local client resolvers against the incoming query and remote data.\n // Locally resolved field values are merged with the incoming remote data,\n // and returned. Note that locally resolved fields will overwrite\n // remote data using the same field name.\n public async runResolvers({\n document,\n remoteResult,\n context,\n variables,\n onlyRunForcedResolvers = false,\n }: {\n document: DocumentNode | null;\n remoteResult: FetchResult;\n context?: Record;\n variables?: Record;\n onlyRunForcedResolvers?: boolean;\n }): Promise> {\n if (document) {\n return this.resolveDocument(\n document,\n remoteResult.data,\n context,\n variables,\n this.fragmentMatcher,\n onlyRunForcedResolvers,\n ).then(localResult => ({\n ...remoteResult,\n data: localResult.result,\n }));\n }\n\n return remoteResult;\n }\n\n public setFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n }\n\n public getFragmentMatcher(): FragmentMatcher {\n return this.fragmentMatcher;\n }\n\n // Client queries contain everything in the incoming document (if a @client\n // directive is found).\n public clientQuery(document: DocumentNode) {\n if (hasDirectives(['client'], document)) {\n if (this.resolvers) {\n return document;\n }\n invariant.warn(\n 'Found @client directives in a query but no ApolloClient resolvers ' +\n 'were specified. This means ApolloClient local resolver handling ' +\n 'has been disabled, and @client directives will be passed through ' +\n 'to your link chain.',\n );\n }\n return null;\n }\n\n // Server queries are stripped of all @client based selection sets.\n public serverQuery(document: DocumentNode) {\n return this.resolvers ? removeClientSetsFromDocument(document) : document;\n }\n\n public prepareContext(context = {}) {\n const { cache } = this;\n\n const newContext = {\n ...context,\n cache,\n // Getting an entry's cache key is useful for local state resolvers.\n getCacheKey: (obj: { __typename: string; id: string | number }) => {\n if ((cache as any).config) {\n return (cache as any).config.dataIdFromObject(obj);\n } else {\n invariant(false,\n 'To use context.getCacheKey, you need to use a cache that has ' +\n 'a configurable dataIdFromObject, like apollo-cache-inmemory.',\n );\n }\n },\n };\n\n return newContext;\n }\n\n // To support `@client @export(as: \"someVar\")` syntax, we'll first resolve\n // @client @export fields locally, then pass the resolved values back to be\n // used alongside the original operation variables.\n public async addExportedVariables(\n document: DocumentNode,\n variables: OperationVariables = {},\n context = {},\n ) {\n if (document) {\n return this.resolveDocument(\n document,\n this.buildRootValueFromCache(document, variables) || {},\n this.prepareContext(context),\n variables,\n ).then(data => ({\n ...variables,\n ...data.exportedVariables,\n }));\n }\n\n return {\n ...variables,\n };\n }\n\n public shouldForceResolvers(document: ASTNode) {\n let forceResolvers = false;\n visit(document, {\n Directive: {\n enter(node) {\n if (node.name.value === 'client' && node.arguments) {\n forceResolvers = node.arguments.some(\n arg =>\n arg.name.value === 'always' &&\n arg.value.kind === 'BooleanValue' &&\n arg.value.value === true,\n );\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n }\n\n // Query the cache and return matching data.\n private buildRootValueFromCache(\n document: DocumentNode,\n variables?: Record,\n ) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n }\n\n private async resolveDocument(\n document: DocumentNode,\n rootValue: TData,\n context: any = {},\n variables: VariableMap = {},\n fragmentMatcher: FragmentMatcher = () => true,\n onlyRunForcedResolvers: boolean = false,\n ) {\n const mainDefinition = getMainDefinition(document);\n const fragments = getFragmentDefinitions(document);\n const fragmentMap = createFragmentMap(fragments);\n\n const definitionOperation = (mainDefinition as OperationDefinitionNode)\n .operation;\n\n const defaultOperationType = definitionOperation\n ? capitalizeFirstLetter(definitionOperation)\n : 'Query';\n\n const { cache, client } = this;\n const execContext: ExecContext = {\n fragmentMap,\n context: {\n ...context,\n cache,\n client,\n },\n variables,\n fragmentMatcher,\n defaultOperationType,\n exportedVariables: {},\n onlyRunForcedResolvers,\n };\n\n return this.resolveSelectionSet(\n mainDefinition.selectionSet,\n rootValue,\n execContext,\n ).then(result => ({\n result,\n exportedVariables: execContext.exportedVariables,\n }));\n }\n\n private async resolveSelectionSet(\n selectionSet: SelectionSetNode,\n rootValue: TData,\n execContext: ExecContext,\n ) {\n const { fragmentMap, context, variables } = execContext;\n const resultsToMerge: TData[] = [rootValue];\n\n const execute = async (selection: SelectionNode): Promise => {\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely.\n return;\n }\n\n if (isField(selection)) {\n return this.resolveField(selection, rootValue, execContext).then(\n fieldResult => {\n if (typeof fieldResult !== 'undefined') {\n resultsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n } as TData);\n }\n },\n );\n }\n\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment.\n fragment = fragmentMap[selection.name.value];\n invariant(fragment, `No fragment named ${selection.name.value}`);\n }\n\n if (fragment && fragment.typeCondition) {\n const typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return this.resolveSelectionSet(\n fragment.selectionSet,\n rootValue,\n execContext,\n ).then(fragmentResult => {\n resultsToMerge.push(fragmentResult);\n });\n }\n }\n };\n\n return Promise.all(selectionSet.selections.map(execute)).then(function() {\n return mergeDeepArray(resultsToMerge);\n });\n }\n\n private async resolveField(\n field: FieldNode,\n rootValue: any,\n execContext: ExecContext,\n ): Promise {\n const { variables } = execContext;\n const fieldName = field.name.value;\n const aliasedFieldName = resultKeyNameFromField(field);\n const aliasUsed = fieldName !== aliasedFieldName;\n const defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n let resultPromise = Promise.resolve(defaultResult);\n\n // Usually all local resolvers are run when passing through here, but\n // if we've specifically identified that we only want to run forced\n // resolvers (that is, resolvers for fields marked with\n // `@client(always: true)`), then we'll skip running non-forced resolvers.\n if (\n !execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)\n ) {\n const resolverType =\n rootValue.__typename || execContext.defaultOperationType;\n const resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n const resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(resolve(\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field, fragmentMap: execContext.fragmentMap },\n ));\n }\n }\n }\n\n return resultPromise.then((result = defaultResult) => {\n // If an @export directive is associated with the current field, store\n // the `as` export variable name and current result for later use.\n if (field.directives) {\n field.directives.forEach(directive => {\n if (directive.name.value === 'export' && directive.arguments) {\n directive.arguments.forEach(arg => {\n if (arg.name.value === 'as' && arg.value.kind === 'StringValue') {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n\n // Handle all scalar types here.\n if (!field.selectionSet) {\n return result;\n }\n\n // From here down, the field has a selection set, which means it's trying\n // to query a GraphQLObjectType.\n if (result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return result;\n }\n\n if (Array.isArray(result)) {\n return this.resolveSubSelectedArray(field, result, execContext);\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n if (field.selectionSet) {\n return this.resolveSelectionSet(\n field.selectionSet,\n result,\n execContext,\n );\n }\n });\n }\n\n private resolveSubSelectedArray(\n field: FieldNode,\n result: any[],\n execContext: ExecContext,\n ): any {\n return Promise.all(\n result.map(item => {\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse.\n if (Array.isArray(item)) {\n return this.resolveSubSelectedArray(field, item, execContext);\n }\n\n // This is an object, run the selection set on it.\n if (field.selectionSet) {\n return this.resolveSelectionSet(field.selectionSet, item, execContext);\n }\n }),\n );\n }\n}\n","import { Observable, Observer, Subscription } from './Observable';\n\n// Returns a normal Observable that can have any number of subscribers,\n// while ensuring the original Observable gets subscribed to at most once.\nexport function multiplex(inner: Observable): Observable {\n const observers = new Set>();\n let sub: Subscription | null = null;\n return new Observable(observer => {\n observers.add(observer);\n sub = sub || inner.subscribe({\n next(value) {\n observers.forEach(obs => obs.next && obs.next(value));\n },\n error(error) {\n observers.forEach(obs => obs.error && obs.error(error));\n },\n complete() {\n observers.forEach(obs => obs.complete && obs.complete());\n },\n });\n return () => {\n if (observers.delete(observer) && !observers.size && sub) {\n sub.unsubscribe();\n sub = null;\n }\n };\n });\n}\n\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap(\n observable: Observable,\n mapFn: (value: V) => R | Promise,\n): Observable {\n return new Observable(observer => {\n const { next, error, complete } = observer;\n let activeNextCount = 0;\n let completed = false;\n\n const handler: Observer = {\n next(value) {\n ++activeNextCount;\n new Promise(resolve => {\n resolve(mapFn(value));\n }).then(\n result => {\n --activeNextCount;\n next && next.call(observer, result);\n completed && handler.complete!();\n },\n e => {\n --activeNextCount;\n error && error.call(observer, e);\n },\n );\n },\n error(e) {\n error && error.call(observer, e);\n },\n complete() {\n completed = true;\n if (!activeNextCount) {\n complete && complete.call(observer);\n }\n },\n };\n\n const sub = observable.subscribe(handler);\n return () => sub.unsubscribe();\n });\n}\n","import { execute, ApolloLink, FetchResult } from 'apollo-link';\nimport { DocumentNode } from 'graphql';\nimport { Cache } from 'apollo-cache';\nimport {\n getDefaultValues,\n getOperationDefinition,\n getOperationName,\n hasDirectives,\n graphQLResultHasError,\n hasClientExports,\n removeConnectionDirectiveFromDocument,\n canUseWeakMap,\n} from 'apollo-utilities';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { isApolloError, ApolloError } from '../errors/ApolloError';\nimport { Observer, Subscription, Observable } from '../util/Observable';\nimport { QueryWithUpdater, DataStore } from '../data/store';\nimport { MutationStore } from '../data/mutations';\nimport { QueryStore, QueryStoreValue } from '../data/queries';\n\nimport {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n ErrorPolicy,\n} from './watchQueryOptions';\nimport { ObservableQuery } from './ObservableQuery';\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport {\n QueryListener,\n ApolloQueryResult,\n FetchType,\n OperationVariables,\n} from './types';\nimport { LocalState } from './LocalState';\nimport { asyncMap, multiplex } from '../util/observables';\nimport { isNonEmptyArray } from '../util/arrays';\n\nconst { hasOwnProperty } = Object.prototype;\n\nexport interface QueryInfo {\n listeners: Set;\n invalidated: boolean;\n newData: Cache.DiffResult | null;\n document: DocumentNode | null;\n lastRequestId: number;\n // A map going from queryId to an observer for a query issued by watchQuery. We use\n // these to keep track of queries that are inflight and error on the observers associated\n // with them in case of some destabalizing action (e.g. reset of the Apollo store).\n observableQuery: ObservableQuery | null;\n subscriptions: Set;\n cancel?: () => void;\n}\n\nexport class QueryManager {\n public link: ApolloLink;\n public mutationStore: MutationStore = new MutationStore();\n public queryStore: QueryStore = new QueryStore();\n public dataStore: DataStore;\n public readonly assumeImmutableResults: boolean;\n\n private queryDeduplication: boolean;\n private clientAwareness: Record = {};\n private localState: LocalState;\n\n private onBroadcast: () => void;\n\n private ssrMode: boolean;\n\n // let's not start at zero to avoid pain with bad checks\n private idCounter = 1;\n\n // XXX merge with ObservableQuery but that needs to be expanded to support mutations and\n // subscriptions as well\n private queries: Map = new Map();\n\n // A map of Promise reject functions for fetchQuery promises that have not\n // yet been resolved, used to keep track of in-flight queries so that we can\n // reject them in case a destabilizing event occurs (e.g. Apollo store reset).\n // The key is in the format of `query:${queryId}` or `fetchRequest:${queryId}`,\n // depending on where the promise's rejection function was created from.\n private fetchQueryRejectFns = new Map();\n\n constructor({\n link,\n queryDeduplication = false,\n store,\n onBroadcast = () => undefined,\n ssrMode = false,\n clientAwareness = {},\n localState,\n assumeImmutableResults,\n }: {\n link: ApolloLink;\n queryDeduplication?: boolean;\n store: DataStore;\n onBroadcast?: () => void;\n ssrMode?: boolean;\n clientAwareness?: Record;\n localState?: LocalState;\n assumeImmutableResults?: boolean;\n }) {\n this.link = link;\n this.queryDeduplication = queryDeduplication;\n this.dataStore = store;\n this.onBroadcast = onBroadcast;\n this.clientAwareness = clientAwareness;\n this.localState = localState || new LocalState({ cache: store.getCache() });\n this.ssrMode = ssrMode;\n this.assumeImmutableResults = !!assumeImmutableResults;\n }\n\n /**\n * Call this method to terminate any active query processes, making it safe\n * to dispose of this QueryManager instance.\n */\n public stop() {\n this.queries.forEach((_info, queryId) => {\n this.stopQueryNoBroadcast(queryId);\n });\n\n this.fetchQueryRejectFns.forEach(reject => {\n reject(\n new InvariantError('QueryManager stopped while query was in flight'),\n );\n });\n }\n\n public async mutate({\n mutation,\n variables,\n optimisticResponse,\n updateQueries: updateQueriesByName,\n refetchQueries = [],\n awaitRefetchQueries = false,\n update: updateWithProxyFn,\n errorPolicy = 'none',\n fetchPolicy,\n context = {},\n }: MutationOptions): Promise> {\n invariant(\n mutation,\n 'mutation option is required. You must specify your GraphQL document in the mutation option.',\n );\n\n invariant(\n !fetchPolicy || fetchPolicy === 'no-cache',\n \"Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior.\"\n );\n\n const mutationId = this.generateQueryId();\n mutation = this.transform(mutation).document;\n\n this.setQuery(mutationId, () => ({ document: mutation }));\n\n variables = this.getVariables(mutation, variables);\n\n if (this.transform(mutation).hasClientExports) {\n variables = await this.localState.addExportedVariables(mutation, variables, context);\n }\n\n // Create a map of update queries by id to the query instead of by name.\n const generateUpdateQueriesInfo: () => {\n [queryId: string]: QueryWithUpdater;\n } = () => {\n const ret: { [queryId: string]: QueryWithUpdater } = {};\n\n if (updateQueriesByName) {\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) {\n const { queryName } = observableQuery;\n if (\n queryName &&\n hasOwnProperty.call(updateQueriesByName, queryName)\n ) {\n ret[queryId] = {\n updater: updateQueriesByName[queryName],\n query: this.queryStore.get(queryId),\n };\n }\n }\n });\n }\n\n return ret;\n };\n\n this.mutationStore.initMutation(\n mutationId,\n mutation,\n variables,\n );\n\n this.dataStore.markMutationInit({\n mutationId,\n document: mutation,\n variables,\n updateQueries: generateUpdateQueriesInfo(),\n update: updateWithProxyFn,\n optimisticResponse,\n });\n\n this.broadcastQueries();\n\n const self = this;\n\n return new Promise((resolve, reject) => {\n let storeResult: FetchResult | null;\n let error: ApolloError;\n\n self.getObservableFromLink(\n mutation,\n {\n ...context,\n optimisticResponse,\n },\n variables,\n false,\n ).subscribe({\n next(result: FetchResult) {\n if (graphQLResultHasError(result) && errorPolicy === 'none') {\n error = new ApolloError({\n graphQLErrors: result.errors,\n });\n return;\n }\n\n self.mutationStore.markMutationResult(mutationId);\n\n if (fetchPolicy !== 'no-cache') {\n self.dataStore.markMutationResult({\n mutationId,\n result,\n document: mutation,\n variables,\n updateQueries: generateUpdateQueriesInfo(),\n update: updateWithProxyFn,\n });\n }\n\n storeResult = result;\n },\n\n error(err: Error) {\n self.mutationStore.markMutationError(mutationId, err);\n self.dataStore.markMutationComplete({\n mutationId,\n optimisticResponse,\n });\n self.broadcastQueries();\n self.setQuery(mutationId, () => ({ document: null }));\n reject(\n new ApolloError({\n networkError: err,\n }),\n );\n },\n\n complete() {\n if (error) {\n self.mutationStore.markMutationError(mutationId, error);\n }\n\n self.dataStore.markMutationComplete({\n mutationId,\n optimisticResponse,\n });\n\n self.broadcastQueries();\n\n if (error) {\n reject(error);\n return;\n }\n\n // allow for conditional refetches\n // XXX do we want to make this the only API one day?\n if (typeof refetchQueries === 'function') {\n refetchQueries = refetchQueries(storeResult!);\n }\n\n const refetchQueryPromises: Promise<\n ApolloQueryResult[] | ApolloQueryResult<{}>\n >[] = [];\n\n if (isNonEmptyArray(refetchQueries)) {\n refetchQueries.forEach(refetchQuery => {\n if (typeof refetchQuery === 'string') {\n self.queries.forEach(({ observableQuery }) => {\n if (\n observableQuery &&\n observableQuery.queryName === refetchQuery\n ) {\n refetchQueryPromises.push(observableQuery.refetch());\n }\n });\n } else {\n const queryOptions: QueryOptions = {\n query: refetchQuery.query,\n variables: refetchQuery.variables,\n fetchPolicy: 'network-only',\n };\n\n if (refetchQuery.context) {\n queryOptions.context = refetchQuery.context;\n }\n\n refetchQueryPromises.push(self.query(queryOptions));\n }\n });\n }\n\n Promise.all(\n awaitRefetchQueries ? refetchQueryPromises : [],\n ).then(() => {\n self.setQuery(mutationId, () => ({ document: null }));\n\n if (\n errorPolicy === 'ignore' &&\n storeResult &&\n graphQLResultHasError(storeResult)\n ) {\n delete storeResult.errors;\n }\n\n resolve(storeResult!);\n });\n },\n });\n });\n }\n\n public async fetchQuery(\n queryId: string,\n options: WatchQueryOptions,\n fetchType?: FetchType,\n // This allows us to track if this is a query spawned by a `fetchMore`\n // call for another query. We need this data to compute the `fetchMore`\n // network status for the query this is fetching for.\n fetchMoreForQueryId?: string,\n ): Promise> {\n const {\n metadata = null,\n fetchPolicy = 'cache-first', // cache-first is the default fetch policy.\n context = {},\n } = options;\n\n const query = this.transform(options.query).document;\n\n let variables = this.getVariables(query, options.variables);\n\n if (this.transform(query).hasClientExports) {\n variables = await this.localState.addExportedVariables(query, variables, context);\n }\n\n options = { ...options, variables };\n\n let storeResult: any;\n const isNetworkOnly =\n fetchPolicy === 'network-only' || fetchPolicy === 'no-cache';\n let needToFetch = isNetworkOnly;\n\n // Unless we are completely skipping the cache, we want to diff the query\n // against the cache before we fetch it from the network interface.\n if (!isNetworkOnly) {\n const { complete, result } = this.dataStore.getCache().diff({\n query,\n variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n // If we're in here, only fetch if we have missing fields\n needToFetch = !complete || fetchPolicy === 'cache-and-network';\n storeResult = result;\n }\n\n let shouldFetch =\n needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby';\n\n // we need to check to see if this is an operation that uses the @live directive\n if (hasDirectives(['live'], query)) shouldFetch = true;\n\n const requestId = this.idCounter++;\n\n // set up a watcher to listen to cache updates\n const cancel = fetchPolicy !== 'no-cache'\n ? this.updateQueryWatch(queryId, query, options)\n : undefined;\n\n // Initialize query in store with unique requestId\n this.setQuery(queryId, () => ({\n document: query,\n lastRequestId: requestId,\n invalidated: true,\n cancel,\n }));\n\n this.invalidate(fetchMoreForQueryId);\n\n this.queryStore.initQuery({\n queryId,\n document: query,\n storePreviousVariables: shouldFetch,\n variables,\n isPoll: fetchType === FetchType.poll,\n isRefetch: fetchType === FetchType.refetch,\n metadata,\n fetchMoreForQueryId,\n });\n\n this.broadcastQueries();\n\n if (shouldFetch) {\n const networkResult = this.fetchRequest({\n requestId,\n queryId,\n document: query,\n options,\n fetchMoreForQueryId,\n }).catch(error => {\n // This is for the benefit of `refetch` promises, which currently don't get their errors\n // through the store like watchQuery observers do\n if (isApolloError(error)) {\n throw error;\n } else {\n if (requestId >= this.getQuery(queryId).lastRequestId) {\n this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId);\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n this.broadcastQueries();\n }\n throw new ApolloError({ networkError: error });\n }\n });\n\n // we don't return the promise for cache-and-network since it is already\n // returned below from the cache\n if (fetchPolicy !== 'cache-and-network') {\n return networkResult;\n }\n\n // however we need to catch the error so it isn't unhandled in case of\n // network error\n networkResult.catch(() => {});\n }\n\n // If there is no part of the query we need to fetch from the server (or,\n // fetchPolicy is cache-only), we just write the store result as the final result.\n this.queryStore.markQueryResultClient(queryId, !shouldFetch);\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n\n if (this.transform(query).hasForcedResolvers) {\n return this.localState.runResolvers({\n document: query,\n remoteResult: { data: storeResult },\n context,\n variables,\n onlyRunForcedResolvers: true,\n }).then((result: FetchResult) => {\n this.markQueryResult(\n queryId,\n result,\n options,\n fetchMoreForQueryId,\n );\n this.broadcastQueries();\n return result;\n });\n }\n\n this.broadcastQueries();\n\n // If we have no query to send to the server, we should return the result\n // found within the store.\n return { data: storeResult };\n }\n\n private markQueryResult(\n queryId: string,\n result: FetchResult,\n {\n fetchPolicy,\n variables,\n errorPolicy,\n }: WatchQueryOptions,\n fetchMoreForQueryId?: string,\n ) {\n if (fetchPolicy === 'no-cache') {\n this.setQuery(queryId, () => ({\n newData: { result: result.data, complete: true },\n }));\n } else {\n this.dataStore.markQueryResult(\n result,\n this.getQuery(queryId).document!,\n variables,\n fetchMoreForQueryId,\n errorPolicy === 'ignore' || errorPolicy === 'all',\n );\n }\n }\n\n // Returns a query listener that will update the given observer based on the\n // results (or lack thereof) for a particular query.\n public queryListenerForObserver(\n queryId: string,\n options: WatchQueryOptions,\n observer: Observer>,\n ): QueryListener {\n function invoke(method: 'next' | 'error', argument: any) {\n if (observer[method]) {\n try {\n observer[method]!(argument);\n } catch (e) {\n invariant.error(e);\n }\n } else if (method === 'error') {\n invariant.error(argument);\n }\n }\n\n return (\n queryStoreValue: QueryStoreValue,\n newData?: Cache.DiffResult,\n ) => {\n // we're going to take a look at the data, so the query is no longer invalidated\n this.invalidate(queryId, false);\n\n // The query store value can be undefined in the event of a store\n // reset.\n if (!queryStoreValue) return;\n\n const { observableQuery, document } = this.getQuery(queryId);\n\n const fetchPolicy = observableQuery\n ? observableQuery.options.fetchPolicy\n : options.fetchPolicy;\n\n // don't watch the store for queries on standby\n if (fetchPolicy === 'standby') return;\n\n const loading = isNetworkRequestInFlight(queryStoreValue.networkStatus);\n const lastResult = observableQuery && observableQuery.getLastResult();\n\n const networkStatusChanged = !!(\n lastResult &&\n lastResult.networkStatus !== queryStoreValue.networkStatus\n );\n\n const shouldNotifyIfLoading =\n options.returnPartialData ||\n (!newData && queryStoreValue.previousVariables) ||\n (networkStatusChanged && options.notifyOnNetworkStatusChange) ||\n fetchPolicy === 'cache-only' ||\n fetchPolicy === 'cache-and-network';\n\n if (loading && !shouldNotifyIfLoading) {\n return;\n }\n\n const hasGraphQLErrors = isNonEmptyArray(queryStoreValue.graphQLErrors);\n\n const errorPolicy: ErrorPolicy = observableQuery\n && observableQuery.options.errorPolicy\n || options.errorPolicy\n || 'none';\n\n // If we have either a GraphQL error or a network error, we create\n // an error and tell the observer about it.\n if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) {\n return invoke('error', new ApolloError({\n graphQLErrors: queryStoreValue.graphQLErrors,\n networkError: queryStoreValue.networkError,\n }));\n }\n\n try {\n let data: any;\n let isMissing: boolean;\n\n if (newData) {\n // As long as we're using the cache, clear out the latest\n // `newData`, since it will now become the current data. We need\n // to keep the `newData` stored with the query when using\n // `no-cache` since `getCurrentQueryResult` attemps to pull from\n // `newData` first, following by trying the cache (which won't\n // find a hit for `no-cache`).\n if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') {\n this.setQuery(queryId, () => ({ newData: null }));\n }\n\n data = newData.result;\n isMissing = !newData.complete;\n } else {\n const lastError = observableQuery && observableQuery.getLastError();\n const errorStatusChanged =\n errorPolicy !== 'none' &&\n (lastError && lastError.graphQLErrors) !==\n queryStoreValue.graphQLErrors;\n\n if (lastResult && lastResult.data && !errorStatusChanged) {\n data = lastResult.data;\n isMissing = false;\n } else {\n const diffResult = this.dataStore.getCache().diff({\n query: document as DocumentNode,\n variables:\n queryStoreValue.previousVariables ||\n queryStoreValue.variables,\n returnPartialData: true,\n optimistic: true,\n });\n\n data = diffResult.result;\n isMissing = !diffResult.complete;\n }\n }\n\n // If there is some data missing and the user has told us that they\n // do not tolerate partial data then we want to return the previous\n // result and mark it as stale.\n const stale = isMissing && !(\n options.returnPartialData ||\n fetchPolicy === 'cache-only'\n );\n\n const resultFromStore: ApolloQueryResult = {\n data: stale ? lastResult && lastResult.data : data,\n loading,\n networkStatus: queryStoreValue.networkStatus,\n stale,\n };\n\n // if the query wants updates on errors we need to add it to the result\n if (errorPolicy === 'all' && hasGraphQLErrors) {\n resultFromStore.errors = queryStoreValue.graphQLErrors;\n }\n\n invoke('next', resultFromStore);\n\n } catch (networkError) {\n invoke('error', new ApolloError({ networkError }));\n }\n };\n }\n\n private transformCache = new (canUseWeakMap ? WeakMap : Map)<\n DocumentNode,\n Readonly<{\n document: Readonly;\n hasClientExports: boolean;\n hasForcedResolvers: boolean;\n clientQuery: Readonly | null;\n serverQuery: Readonly | null;\n defaultVars: Readonly;\n }>\n >();\n\n public transform(document: DocumentNode) {\n const { transformCache } = this;\n\n if (!transformCache.has(document)) {\n const cache = this.dataStore.getCache();\n const transformed = cache.transformDocument(document);\n const forLink = removeConnectionDirectiveFromDocument(\n cache.transformForLink(transformed));\n\n const clientQuery = this.localState.clientQuery(transformed);\n const serverQuery = this.localState.serverQuery(forLink);\n\n const cacheEntry = {\n document: transformed,\n // TODO These two calls (hasClientExports and shouldForceResolvers)\n // could probably be merged into a single traversal.\n hasClientExports: hasClientExports(transformed),\n hasForcedResolvers: this.localState.shouldForceResolvers(transformed),\n clientQuery,\n serverQuery,\n defaultVars: getDefaultValues(\n getOperationDefinition(transformed)\n ) as OperationVariables,\n };\n\n const add = (doc: DocumentNode | null) => {\n if (doc && !transformCache.has(doc)) {\n transformCache.set(doc, cacheEntry);\n }\n }\n // Add cacheEntry to the transformCache using several different keys,\n // since any one of these documents could end up getting passed to the\n // transform method again in the future.\n add(document);\n add(transformed);\n add(clientQuery);\n add(serverQuery);\n }\n\n return transformCache.get(document)!;\n }\n\n private getVariables(\n document: DocumentNode,\n variables?: OperationVariables,\n ): OperationVariables {\n return {\n ...this.transform(document).defaultVars,\n ...variables,\n };\n }\n\n // The shouldSubscribe option is a temporary fix that tells us whether watchQuery was called\n // directly (i.e. through ApolloClient) or through the query method within QueryManager.\n // Currently, the query method uses watchQuery in order to handle non-network errors correctly\n // but we don't want to keep track observables issued for the query method since those aren't\n // supposed to be refetched in the event of a store reset. Once we unify error handling for\n // network errors and non-network errors, the shouldSubscribe option will go away.\n\n public watchQuery(\n options: WatchQueryOptions,\n shouldSubscribe = true,\n ): ObservableQuery {\n invariant(\n options.fetchPolicy !== 'standby',\n 'client.watchQuery cannot be called with fetchPolicy set to \"standby\"',\n );\n\n // assign variable default values if supplied\n options.variables = this.getVariables(options.query, options.variables);\n\n if (typeof options.notifyOnNetworkStatusChange === 'undefined') {\n options.notifyOnNetworkStatusChange = false;\n }\n\n let transformedOptions = { ...options } as WatchQueryOptions;\n\n return new ObservableQuery({\n queryManager: this,\n options: transformedOptions,\n shouldSubscribe: shouldSubscribe,\n });\n }\n\n public query(options: QueryOptions): Promise> {\n invariant(\n options.query,\n 'query option is required. You must specify your GraphQL document ' +\n 'in the query option.',\n );\n\n invariant(\n options.query.kind === 'Document',\n 'You must wrap the query string in a \"gql\" tag.',\n );\n\n invariant(\n !(options as any).returnPartialData,\n 'returnPartialData option only supported on watchQuery.',\n );\n\n invariant(\n !(options as any).pollInterval,\n 'pollInterval option only supported on watchQuery.',\n );\n\n return new Promise>((resolve, reject) => {\n const watchedQuery = this.watchQuery(options, false);\n this.fetchQueryRejectFns.set(`query:${watchedQuery.queryId}`, reject);\n watchedQuery\n .result()\n .then(resolve, reject)\n // Since neither resolve nor reject throw or return a value, this .then\n // handler is guaranteed to execute. Note that it doesn't really matter\n // when we remove the reject function from this.fetchQueryRejectFns,\n // since resolve and reject are mutually idempotent. In fact, it would\n // not be incorrect to let reject functions accumulate over time; it's\n // just a waste of memory.\n .then(() =>\n this.fetchQueryRejectFns.delete(`query:${watchedQuery.queryId}`),\n );\n });\n }\n\n public generateQueryId() {\n return String(this.idCounter++);\n }\n\n public stopQueryInStore(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryInStoreNoBroadcast(queryId: string) {\n this.stopPollingQuery(queryId);\n this.queryStore.stopQuery(queryId);\n this.invalidate(queryId);\n }\n\n public addQueryListener(queryId: string, listener: QueryListener) {\n this.setQuery(queryId, ({ listeners }) => {\n listeners.add(listener);\n return { invalidated: false };\n });\n }\n\n public updateQueryWatch(\n queryId: string,\n document: DocumentNode,\n options: WatchQueryOptions,\n ) {\n const { cancel } = this.getQuery(queryId);\n if (cancel) cancel();\n const previousResult = () => {\n let previousResult = null;\n const { observableQuery } = this.getQuery(queryId);\n if (observableQuery) {\n const lastResult = observableQuery.getLastResult();\n if (lastResult) {\n previousResult = lastResult.data;\n }\n }\n\n return previousResult;\n };\n return this.dataStore.getCache().watch({\n query: document as DocumentNode,\n variables: options.variables,\n optimistic: true,\n previousResult,\n callback: newData => {\n this.setQuery(queryId, () => ({ invalidated: true, newData }));\n },\n });\n }\n\n // Adds an ObservableQuery to this.observableQueries and to this.observableQueriesByName.\n public addObservableQuery(\n queryId: string,\n observableQuery: ObservableQuery,\n ) {\n this.setQuery(queryId, () => ({ observableQuery }));\n }\n\n public removeObservableQuery(queryId: string) {\n const { cancel } = this.getQuery(queryId);\n this.setQuery(queryId, () => ({ observableQuery: null }));\n if (cancel) cancel();\n }\n\n public clearStore(): Promise {\n // Before we have sent the reset action to the store,\n // we can no longer rely on the results returned by in-flight\n // requests since these may depend on values that previously existed\n // in the data portion of the store. So, we cancel the promises and observers\n // that we have issued so far and not yet resolved (in the case of\n // queries).\n this.fetchQueryRejectFns.forEach(reject => {\n reject(new InvariantError(\n 'Store reset while query was in flight (not completed in link chain)',\n ));\n });\n\n const resetIds: string[] = [];\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) resetIds.push(queryId);\n });\n\n this.queryStore.reset(resetIds);\n this.mutationStore.reset();\n\n // begin removing data from the store\n return this.dataStore.reset();\n }\n\n public resetStore(): Promise[]> {\n // Similarly, we have to have to refetch each of the queries currently being\n // observed. We refetch instead of error'ing on these since the assumption is that\n // resetting the store doesn't eliminate the need for the queries currently being\n // watched. If there is an existing query in flight when the store is reset,\n // the promise for it will be rejected and its results will not be written to the\n // store.\n return this.clearStore().then(() => {\n return this.reFetchObservableQueries();\n });\n }\n\n public reFetchObservableQueries(\n includeStandby: boolean = false,\n ): Promise[]> {\n const observableQueryPromises: Promise>[] = [];\n\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) {\n const fetchPolicy = observableQuery.options.fetchPolicy;\n\n observableQuery.resetLastResults();\n if (\n fetchPolicy !== 'cache-only' &&\n (includeStandby || fetchPolicy !== 'standby')\n ) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n\n this.setQuery(queryId, () => ({ newData: null }));\n this.invalidate(queryId);\n }\n });\n\n this.broadcastQueries();\n\n return Promise.all(observableQueryPromises);\n }\n\n public observeQuery(\n queryId: string,\n options: WatchQueryOptions,\n observer: Observer>,\n ) {\n this.addQueryListener(\n queryId,\n this.queryListenerForObserver(queryId, options, observer),\n );\n return this.fetchQuery(queryId, options);\n }\n\n public startQuery(\n queryId: string,\n options: WatchQueryOptions,\n listener: QueryListener,\n ) {\n invariant.warn(\"The QueryManager.startQuery method has been deprecated\");\n\n this.addQueryListener(queryId, listener);\n\n this.fetchQuery(queryId, options)\n // `fetchQuery` returns a Promise. In case of a failure it should be caucht or else the\n // console will show an `Uncaught (in promise)` message. Ignore the error for now.\n .catch(() => undefined);\n\n return queryId;\n }\n\n public startGraphQLSubscription({\n query,\n fetchPolicy,\n variables,\n }: SubscriptionOptions): Observable> {\n query = this.transform(query).document;\n variables = this.getVariables(query, variables);\n\n const makeObservable = (variables: OperationVariables) =>\n this.getObservableFromLink(\n query,\n {},\n variables,\n false,\n ).map(result => {\n if (!fetchPolicy || fetchPolicy !== 'no-cache') {\n this.dataStore.markSubscriptionResult(\n result,\n query,\n variables,\n );\n this.broadcastQueries();\n }\n\n if (graphQLResultHasError(result)) {\n throw new ApolloError({\n graphQLErrors: result.errors,\n });\n }\n\n return result;\n });\n\n if (this.transform(query).hasClientExports) {\n const observablePromise = this.localState.addExportedVariables(\n query,\n variables,\n ).then(makeObservable);\n\n return new Observable>(observer => {\n let sub: Subscription | null = null;\n observablePromise.then(\n observable => sub = observable.subscribe(observer),\n observer.error,\n );\n return () => sub && sub.unsubscribe();\n });\n }\n\n return makeObservable(variables);\n }\n\n public stopQuery(queryId: string) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryNoBroadcast(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n }\n\n public removeQuery(queryId: string) {\n // teardown all links\n // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises\n // that each add their reject functions to fetchQueryRejectFns.\n // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.\n // The same queryId could have two rejection fns for two promises\n this.fetchQueryRejectFns.delete(`query:${queryId}`);\n this.fetchQueryRejectFns.delete(`fetchRequest:${queryId}`);\n this.getQuery(queryId).subscriptions.forEach(x => x.unsubscribe());\n this.queries.delete(queryId);\n }\n\n public getCurrentQueryResult(\n observableQuery: ObservableQuery,\n optimistic: boolean = true,\n ): {\n data: T | undefined;\n partial: boolean;\n } {\n const { variables, query, fetchPolicy, returnPartialData } = observableQuery.options;\n const lastResult = observableQuery.getLastResult();\n const { newData } = this.getQuery(observableQuery.queryId);\n\n if (newData && newData.complete) {\n return { data: newData.result, partial: false };\n }\n\n if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') {\n return { data: undefined, partial: false };\n }\n\n const { result, complete } = this.dataStore.getCache().diff({\n query,\n variables,\n previousResult: lastResult ? lastResult.data : undefined,\n returnPartialData: true,\n optimistic,\n });\n\n return {\n data: (complete || returnPartialData) ? result : void 0,\n partial: !complete,\n };\n }\n\n public getQueryWithPreviousResult(\n queryIdOrObservable: string | ObservableQuery,\n ): {\n previousResult: any;\n variables: TVariables | undefined;\n document: DocumentNode;\n } {\n let observableQuery: ObservableQuery;\n if (typeof queryIdOrObservable === 'string') {\n const { observableQuery: foundObserveableQuery } = this.getQuery(\n queryIdOrObservable,\n );\n invariant(\n foundObserveableQuery,\n `ObservableQuery with this id doesn't exist: ${queryIdOrObservable}`\n );\n observableQuery = foundObserveableQuery!;\n } else {\n observableQuery = queryIdOrObservable;\n }\n\n const { variables, query } = observableQuery.options;\n return {\n previousResult: this.getCurrentQueryResult(observableQuery, false).data,\n variables,\n document: query,\n };\n }\n\n public broadcastQueries() {\n this.onBroadcast();\n this.queries.forEach((info, id) => {\n if (info.invalidated) {\n info.listeners.forEach(listener => {\n // it's possible for the listener to be undefined if the query is being stopped\n // See here for more detail: https://github.com/apollostack/apollo-client/issues/231\n if (listener) {\n listener(this.queryStore.get(id), info.newData);\n }\n });\n }\n });\n }\n\n public getLocalState(): LocalState {\n return this.localState;\n }\n\n private inFlightLinkObservables = new Map<\n DocumentNode,\n Map>\n >();\n\n private getObservableFromLink(\n query: DocumentNode,\n context: any,\n variables?: OperationVariables,\n deduplication: boolean = this.queryDeduplication,\n ): Observable> {\n let observable: Observable>;\n\n const { serverQuery } = this.transform(query);\n if (serverQuery) {\n const { inFlightLinkObservables, link } = this;\n\n const operation = {\n query: serverQuery,\n variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext({\n ...context,\n forceFetch: !deduplication\n }),\n };\n\n context = operation.context;\n\n if (deduplication) {\n const byVariables = inFlightLinkObservables.get(serverQuery) || new Map();\n inFlightLinkObservables.set(serverQuery, byVariables);\n\n const varJson = JSON.stringify(variables);\n observable = byVariables.get(varJson);\n\n if (!observable) {\n byVariables.set(\n varJson,\n observable = multiplex(\n execute(link, operation) as Observable>\n )\n );\n\n const cleanup = () => {\n byVariables.delete(varJson);\n if (!byVariables.size) inFlightLinkObservables.delete(serverQuery);\n cleanupSub.unsubscribe();\n };\n\n const cleanupSub = observable.subscribe({\n next: cleanup,\n error: cleanup,\n complete: cleanup,\n });\n }\n\n } else {\n observable = multiplex(execute(link, operation) as Observable>);\n }\n } else {\n observable = Observable.of({ data: {} } as FetchResult);\n context = this.prepareContext(context);\n }\n\n const { clientQuery } = this.transform(query);\n if (clientQuery) {\n observable = asyncMap(observable, result => {\n return this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context,\n variables,\n });\n });\n }\n\n return observable;\n }\n\n // Takes a request id, query id, a query document and information associated with the query\n // and send it to the network interface. Returns\n // a promise for the result associated with that request.\n private fetchRequest({\n requestId,\n queryId,\n document,\n options,\n fetchMoreForQueryId,\n }: {\n requestId: number;\n queryId: string;\n document: DocumentNode;\n options: WatchQueryOptions;\n fetchMoreForQueryId?: string;\n }): Promise> {\n const { variables, errorPolicy = 'none', fetchPolicy } = options;\n let resultFromStore: any;\n let errorsFromStore: any;\n\n return new Promise>((resolve, reject) => {\n const observable = this.getObservableFromLink(\n document,\n options.context,\n variables,\n );\n\n const fqrfId = `fetchRequest:${queryId}`;\n this.fetchQueryRejectFns.set(fqrfId, reject);\n\n const cleanup = () => {\n this.fetchQueryRejectFns.delete(fqrfId);\n this.setQuery(queryId, ({ subscriptions }) => {\n subscriptions.delete(subscription);\n });\n };\n\n const subscription = observable.map((result: FetchResult) => {\n if (requestId >= this.getQuery(queryId).lastRequestId) {\n this.markQueryResult(\n queryId,\n result,\n options,\n fetchMoreForQueryId,\n );\n\n this.queryStore.markQueryResult(\n queryId,\n result,\n fetchMoreForQueryId,\n );\n\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n\n this.broadcastQueries();\n }\n\n if (errorPolicy === 'none' && isNonEmptyArray(result.errors)) {\n return reject(new ApolloError({\n graphQLErrors: result.errors,\n }));\n }\n\n if (errorPolicy === 'all') {\n errorsFromStore = result.errors;\n }\n\n if (fetchMoreForQueryId || fetchPolicy === 'no-cache') {\n // We don't write fetchMore results to the store because this would overwrite\n // the original result in case an @connection directive is used.\n resultFromStore = result.data;\n } else {\n // ensure result is combined with data already in store\n const { result, complete } = this.dataStore.getCache().diff({\n variables,\n query: document,\n optimistic: false,\n returnPartialData: true,\n });\n\n if (complete || options.returnPartialData) {\n resultFromStore = result;\n }\n }\n }).subscribe({\n error(error: ApolloError) {\n cleanup();\n reject(error);\n },\n\n complete() {\n cleanup();\n resolve({\n data: resultFromStore,\n errors: errorsFromStore,\n loading: false,\n networkStatus: NetworkStatus.ready,\n stale: false,\n });\n },\n });\n\n this.setQuery(queryId, ({ subscriptions }) => {\n subscriptions.add(subscription);\n });\n });\n }\n\n private getQuery(queryId: string) {\n return (\n this.queries.get(queryId) || {\n listeners: new Set(),\n invalidated: false,\n document: null,\n newData: null,\n lastRequestId: 1,\n observableQuery: null,\n subscriptions: new Set(),\n }\n );\n }\n\n private setQuery(\n queryId: string,\n updater: (prev: QueryInfo) => Pick | void,\n ) {\n const prev = this.getQuery(queryId);\n const newInfo = { ...prev, ...updater(prev) };\n this.queries.set(queryId, newInfo);\n }\n\n private invalidate(\n queryId: string | undefined,\n invalidated = true,\n ) {\n if (queryId) {\n this.setQuery(queryId, () => ({ invalidated }));\n }\n }\n\n private prepareContext(context = {}) {\n const newContext = this.localState.prepareContext(context);\n return {\n ...newContext,\n clientAwareness: this.clientAwareness,\n };\n }\n\n public checkInFlight(queryId: string) {\n const query = this.queryStore.get(queryId);\n\n return (\n query &&\n query.networkStatus !== NetworkStatus.ready &&\n query.networkStatus !== NetworkStatus.error\n );\n }\n\n // Map from client ID to { interval, options }.\n private pollingInfoByQueryId = new Map();\n\n public startPollingQuery(\n options: WatchQueryOptions,\n queryId: string,\n listener?: QueryListener,\n ): string {\n const { pollInterval } = options;\n\n invariant(\n pollInterval,\n 'Attempted to start a polling query without a polling interval.',\n );\n\n // Do not poll in SSR mode\n if (!this.ssrMode) {\n let info = this.pollingInfoByQueryId.get(queryId)!;\n if (!info) {\n this.pollingInfoByQueryId.set(queryId, (info = {} as any));\n }\n\n info.interval = pollInterval!;\n info.options = {\n ...options,\n fetchPolicy: 'network-only',\n };\n\n const maybeFetch = () => {\n const info = this.pollingInfoByQueryId.get(queryId);\n if (info) {\n if (this.checkInFlight(queryId)) {\n poll();\n } else {\n this.fetchQuery(queryId, info.options, FetchType.poll).then(\n poll,\n poll,\n );\n }\n }\n };\n\n const poll = () => {\n const info = this.pollingInfoByQueryId.get(queryId);\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n\n if (listener) {\n this.addQueryListener(queryId, listener);\n }\n\n poll();\n }\n\n return queryId;\n }\n\n public stopPollingQuery(queryId: string) {\n this.pollingInfoByQueryId.delete(queryId);\n }\n}\n","import { ExecutionResult, DocumentNode } from 'graphql';\nimport { ApolloCache, Cache, DataProxy } from 'apollo-cache';\n\nimport { QueryStoreValue } from '../data/queries';\nimport {\n getOperationName,\n tryFunctionOrLogError,\n graphQLResultHasError,\n} from 'apollo-utilities';\nimport { MutationQueryReducer } from '../core/types';\n\nexport type QueryWithUpdater = {\n updater: MutationQueryReducer;\n query: QueryStoreValue;\n};\n\nexport interface DataWrite {\n rootId: string;\n result: any;\n document: DocumentNode;\n operationName: string | null;\n variables: Object;\n}\n\nexport class DataStore {\n private cache: ApolloCache;\n\n constructor(initialCache: ApolloCache) {\n this.cache = initialCache;\n }\n\n public getCache(): ApolloCache {\n return this.cache;\n }\n\n public markQueryResult(\n result: ExecutionResult,\n document: DocumentNode,\n variables: any,\n fetchMoreForQueryId: string | undefined,\n ignoreErrors: boolean = false,\n ) {\n let writeWithErrors = !graphQLResultHasError(result);\n if (ignoreErrors && graphQLResultHasError(result) && result.data) {\n writeWithErrors = true;\n }\n if (!fetchMoreForQueryId && writeWithErrors) {\n this.cache.write({\n result: result.data,\n dataId: 'ROOT_QUERY',\n query: document,\n variables: variables,\n });\n }\n }\n\n public markSubscriptionResult(\n result: ExecutionResult,\n document: DocumentNode,\n variables: any,\n ) {\n // the subscription interface should handle not sending us results we no longer subscribe to.\n // XXX I don't think we ever send in an object with errors, but we might in the future...\n if (!graphQLResultHasError(result)) {\n this.cache.write({\n result: result.data,\n dataId: 'ROOT_SUBSCRIPTION',\n query: document,\n variables: variables,\n });\n }\n }\n\n public markMutationInit(mutation: {\n mutationId: string;\n document: DocumentNode;\n variables: any;\n updateQueries: { [queryId: string]: QueryWithUpdater };\n update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined;\n optimisticResponse: Object | Function | undefined;\n }) {\n if (mutation.optimisticResponse) {\n let optimistic: Object;\n if (typeof mutation.optimisticResponse === 'function') {\n optimistic = mutation.optimisticResponse(mutation.variables);\n } else {\n optimistic = mutation.optimisticResponse;\n }\n\n this.cache.recordOptimisticTransaction(c => {\n const orig = this.cache;\n this.cache = c;\n\n try {\n this.markMutationResult({\n mutationId: mutation.mutationId,\n result: { data: optimistic },\n document: mutation.document,\n variables: mutation.variables,\n updateQueries: mutation.updateQueries,\n update: mutation.update,\n });\n } finally {\n this.cache = orig;\n }\n }, mutation.mutationId);\n }\n }\n\n public markMutationResult(mutation: {\n mutationId: string;\n result: ExecutionResult;\n document: DocumentNode;\n variables: any;\n updateQueries: { [queryId: string]: QueryWithUpdater };\n update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined;\n }) {\n // Incorporate the result from this mutation into the store\n if (!graphQLResultHasError(mutation.result)) {\n const cacheWrites: Cache.WriteOptions[] = [{\n result: mutation.result.data,\n dataId: 'ROOT_MUTATION',\n query: mutation.document,\n variables: mutation.variables,\n }];\n\n const { updateQueries } = mutation;\n if (updateQueries) {\n Object.keys(updateQueries).forEach(id => {\n const { query, updater } = updateQueries[id];\n\n // Read the current query result from the store.\n const { result: currentQueryResult, complete } = this.cache.diff({\n query: query.document,\n variables: query.variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n if (complete) {\n // Run our reducer using the current query result and the mutation result.\n const nextQueryResult = tryFunctionOrLogError(() =>\n updater(currentQueryResult, {\n mutationResult: mutation.result,\n queryName: getOperationName(query.document) || undefined,\n queryVariables: query.variables,\n }),\n );\n\n // Write the modified result back into the store if we got a new result.\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: 'ROOT_QUERY',\n query: query.document,\n variables: query.variables,\n });\n }\n }\n });\n }\n\n this.cache.performTransaction(c => {\n cacheWrites.forEach(write => c.write(write));\n\n // If the mutation has some writes associated with it then we need to\n // apply those writes to the store by running this reducer again with a\n // write action.\n const { update } = mutation;\n if (update) {\n tryFunctionOrLogError(() => update(c, mutation.result));\n }\n });\n }\n }\n\n public markMutationComplete({\n mutationId,\n optimisticResponse,\n }: {\n mutationId: string;\n optimisticResponse?: any;\n }) {\n if (optimisticResponse) {\n this.cache.removeOptimistic(mutationId);\n }\n }\n\n public markUpdateQueryResult(\n document: DocumentNode,\n variables: any,\n newResult: any,\n ) {\n this.cache.write({\n result: newResult,\n dataId: 'ROOT_QUERY',\n variables,\n query: document,\n });\n }\n\n public reset(): Promise {\n return this.cache.reset();\n }\n}\n","export const version = \"2.6.10\"","import {\n ApolloLink,\n FetchResult,\n GraphQLRequest,\n execute,\n} from 'apollo-link';\nimport { ExecutionResult, DocumentNode } from 'graphql';\nimport { ApolloCache, DataProxy } from 'apollo-cache';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { QueryManager } from './core/QueryManager';\nimport {\n ApolloQueryResult,\n OperationVariables,\n Resolvers,\n} from './core/types';\nimport { ObservableQuery } from './core/ObservableQuery';\nimport { LocalState, FragmentMatcher } from './core/LocalState';\nimport { Observable } from './util/Observable';\n\nimport {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n WatchQueryFetchPolicy,\n} from './core/watchQueryOptions';\n\nimport { DataStore } from './data/store';\n\nimport { version } from './version';\n\nexport interface DefaultOptions {\n watchQuery?: Partial;\n query?: Partial;\n mutate?: Partial;\n}\n\nlet hasSuggestedDevtools = false;\n\nexport type ApolloClientOptions = {\n link?: ApolloLink;\n cache: ApolloCache;\n ssrForceFetchDelay?: number;\n ssrMode?: boolean;\n connectToDevTools?: boolean;\n queryDeduplication?: boolean;\n defaultOptions?: DefaultOptions;\n assumeImmutableResults?: boolean;\n resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n fragmentMatcher?: FragmentMatcher;\n name?: string;\n version?: string;\n};\n\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over a {@link NetworkInterface} instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through {@link Observable} instances.\n */\nexport default class ApolloClient implements DataProxy {\n public link: ApolloLink;\n public store: DataStore;\n public cache: ApolloCache;\n public readonly queryManager: QueryManager;\n public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions = {};\n public readonly typeDefs: ApolloClientOptions['typeDefs'];\n\n private devToolsHookCb: Function;\n private resetStoreCallbacks: Array<() => Promise> = [];\n private clearStoreCallbacks: Array<() => Promise> = [];\n private localState: LocalState;\n\n /**\n * Constructs an instance of {@link ApolloClient}.\n *\n * @param link The {@link ApolloLink} over which GraphQL documents will be resolved into a response.\n *\n * @param cache The initial cache to use in the data store.\n *\n * @param ssrMode Determines whether this is being run in Server Side Rendering (SSR) mode.\n *\n * @param ssrForceFetchDelay Determines the time interval before we force fetch queries for a\n * server side render.\n *\n * @param queryDeduplication If set to false, a query will still be sent to the server even if a query\n * with identical parameters (query, variables, operationName) is already in flight.\n *\n * @param defaultOptions Used to set application wide defaults for the\n * options supplied to `watchQuery`, `query`, or\n * `mutate`.\n *\n * @param assumeImmutableResults When this option is true, the client will assume results\n * read from the cache are never mutated by application code,\n * which enables substantial performance optimizations. Passing\n * `{ freezeResults: true }` to the `InMemoryCache` constructor\n * can help enforce this immutability.\n *\n * @param name A custom name that can be used to identify this client, when\n * using Apollo client awareness features. E.g. \"iOS\".\n *\n * @param version A custom version that can be used to identify this client,\n * when using Apollo client awareness features. This is the\n * version of your client, which you may want to increment on\n * new builds. This is NOT the version of Apollo Client that\n * you are using.\n */\n constructor(options: ApolloClientOptions) {\n const {\n cache,\n ssrMode = false,\n ssrForceFetchDelay = 0,\n connectToDevTools,\n queryDeduplication = true,\n defaultOptions,\n assumeImmutableResults = false,\n resolvers,\n typeDefs,\n fragmentMatcher,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n } = options;\n\n let { link } = options;\n\n // If a link hasn't been defined, but local state resolvers have been set,\n // setup a default empty link.\n if (!link && resolvers) {\n link = ApolloLink.empty();\n }\n\n if (!link || !cache) {\n throw new InvariantError(\n \"In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\\n\" +\n \"These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\\n\" +\n \"For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup\"\n );\n }\n\n // remove apollo-client supported directives\n this.link = link;\n this.cache = cache;\n this.store = new DataStore(cache);\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || {};\n this.typeDefs = typeDefs;\n\n if (ssrForceFetchDelay) {\n setTimeout(\n () => (this.disableNetworkFetches = false),\n ssrForceFetchDelay,\n );\n }\n\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n\n // Attach the client instance to window to let us be found by chrome devtools, but only in\n // development mode\n const defaultConnectToDevTools =\n process.env.NODE_ENV !== 'production' &&\n typeof window !== 'undefined' &&\n !(window as any).__APOLLO_CLIENT__;\n\n if (\n typeof connectToDevTools === 'undefined'\n ? defaultConnectToDevTools\n : connectToDevTools && typeof window !== 'undefined'\n ) {\n (window as any).__APOLLO_CLIENT__ = this;\n }\n\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && process.env.NODE_ENV !== 'production') {\n hasSuggestedDevtools = true;\n if (\n typeof window !== 'undefined' &&\n window.document &&\n window.top === window.self\n ) {\n // First check if devtools is not installed\n if (\n typeof (window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined'\n ) {\n // Only for Chrome\n if (\n window.navigator &&\n window.navigator.userAgent &&\n window.navigator.userAgent.indexOf('Chrome') > -1\n ) {\n // tslint:disable-next-line\n console.debug(\n 'Download the Apollo DevTools ' +\n 'for a better development experience: ' +\n 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm',\n );\n }\n }\n }\n }\n\n this.version = version;\n\n this.localState = new LocalState({\n cache,\n client: this,\n resolvers,\n fragmentMatcher,\n });\n\n this.queryManager = new QueryManager({\n link: this.link,\n store: this.store,\n queryDeduplication,\n ssrMode,\n clientAwareness: {\n name: clientAwarenessName!,\n version: clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast: () => {\n if (this.devToolsHookCb) {\n this.devToolsHookCb({\n action: {},\n state: {\n queries: this.queryManager.queryStore.getStore(),\n mutations: this.queryManager.mutationStore.getStore(),\n },\n dataWithOptimisticResults: this.cache.extract(true),\n });\n }\n },\n });\n }\n\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n public stop() {\n this.queryManager.stop();\n }\n\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and\n * receive updated results through a GraphQL observer when the cache store changes.\n *

\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *

\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifer, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *

\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *

\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n public watchQuery(\n options: WatchQueryOptions,\n ): ObservableQuery {\n if (this.defaultOptions.watchQuery) {\n options = {\n ...this.defaultOptions.watchQuery,\n ...options,\n } as WatchQueryOptions;\n }\n\n // XXX Overwriting options is probably not the best way to do this long term...\n if (\n this.disableNetworkFetches &&\n (options.fetchPolicy === 'network-only' ||\n options.fetchPolicy === 'cache-and-network')\n ) {\n options = { ...options, fetchPolicy: 'cache-first' };\n }\n\n return this.queryManager.watchQuery(options);\n }\n\n /**\n * This resolves a single query according to the options specified and\n * returns a {@link Promise} which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options An object of type {@link QueryOptions} that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n public query(\n options: QueryOptions,\n ): Promise> {\n if (this.defaultOptions.query) {\n options = { ...this.defaultOptions.query, ...options } as QueryOptions<\n TVariables\n >;\n }\n\n invariant(\n (options.fetchPolicy as WatchQueryFetchPolicy) !== 'cache-and-network',\n 'The cache-and-network fetchPolicy does not work with client.query, because ' +\n 'client.query can only return a single result. Please use client.watchQuery ' +\n 'to receive multiple results from the cache and the network, or consider ' +\n 'using a different fetchPolicy, such as cache-first or network-only.'\n );\n\n if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {\n options = { ...options, fetchPolicy: 'cache-first' };\n }\n\n return this.queryManager.query(options);\n }\n\n /**\n * This resolves a single mutation according to the options specified and returns a\n * {@link Promise} which is either resolved with the resulting data or rejected with an\n * error.\n *\n * It takes options as an object with the following keys and values:\n */\n public mutate(\n options: MutationOptions,\n ): Promise> {\n if (this.defaultOptions.mutate) {\n options = {\n ...this.defaultOptions.mutate,\n ...options,\n } as MutationOptions;\n }\n\n return this.queryManager.mutate(options);\n }\n\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * {@link Observable} which either emits received data or an error.\n */\n public subscribe(\n options: SubscriptionOptions,\n ): Observable> {\n return this.queryManager.startGraphQLSubscription(options);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): T | null {\n return this.cache.readQuery(options, optimistic);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): T | null {\n return this.cache.readFragment(options, optimistic);\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n public writeQuery(\n options: DataProxy.WriteQueryOptions,\n ): void {\n const result = this.cache.writeQuery(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n public writeFragment(\n options: DataProxy.WriteFragmentOptions,\n ): void {\n const result = this.cache.writeFragment(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n /**\n * Sugar for writeQuery & writeFragment\n * This method will construct a query from the data object passed in.\n * If no id is supplied, writeData will write the data to the root.\n * If an id is supplied, writeData will write a fragment to the object\n * specified by the id in the store.\n *\n * Since you aren't passing in a query to check the shape of the data,\n * you must pass in an object that conforms to the shape of valid GraphQL data.\n */\n public writeData(\n options: DataProxy.WriteDataOptions,\n ): void {\n const result = this.cache.writeData(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n public __actionHookForDevTools(cb: () => any) {\n this.devToolsHookCb = cb;\n }\n\n public __requestRaw(payload: GraphQLRequest): Observable {\n return execute(this.link, payload);\n }\n\n /**\n * This initializes the query manager that tracks queries and the cache\n */\n public initQueryManager(): QueryManager {\n invariant.warn(\n 'Calling the initQueryManager method is no longer necessary, ' +\n 'and it will be removed from ApolloClient in version 3.0.',\n );\n return this.queryManager;\n }\n\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public resetStore(): Promise[] | null> {\n return Promise.resolve()\n .then(() => this.queryManager.clearStore())\n .then(() => Promise.all(this.resetStoreCallbacks.map(fn => fn())))\n .then(() => this.reFetchObservableQueries());\n }\n\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n public clearStore(): Promise {\n return Promise.resolve()\n .then(() => this.queryManager.clearStore())\n .then(() => Promise.all(this.clearStoreCallbacks.map(fn => fn())));\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onResetStore(cb: () => Promise): () => void {\n this.resetStoreCallbacks.push(cb);\n return () => {\n this.resetStoreCallbacks = this.resetStoreCallbacks.filter(c => c !== cb);\n };\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onClearStore(cb: () => Promise): () => void {\n this.clearStoreCallbacks.push(cb);\n return () => {\n this.clearStoreCallbacks = this.clearStoreCallbacks.filter(c => c !== cb);\n };\n }\n\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n public reFetchObservableQueries(\n includeStandby?: boolean,\n ): Promise[]> {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n }\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public extract(optimistic?: boolean): TCacheShape {\n return this.cache.extract(optimistic);\n }\n\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public restore(serializedState: TCacheShape): ApolloCache {\n return this.cache.restore(serializedState);\n }\n\n /**\n * Add additional local resolvers.\n */\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\n */\n public setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n }\n}\n"],"names":["LinkObservable"],"mappings":";;;;;;;IAGY,aA0CX;AA1CD,WAAY,aAAa;IAMvB,uDAAW,CAAA;IAMX,iEAAgB,CAAA;IAMhB,2DAAa,CAAA;IAMb,uDAAW,CAAA;IAOX,iDAAQ,CAAA;IAKR,mDAAS,CAAA;IAKT,mDAAS,CAAA;CACV,EA1CW,aAAa,KAAb,aAAa,QA0CxB;AAMD,SAAgB,wBAAwB,CACtC,aAA4B;IAE5B,OAAO,aAAa,GAAG,CAAC,CAAC;CAC1B;;AC7CD;IAAmC,8BAAiB;IAApD;;KAQC;IAPQ,qBAAC,YAAY,CAAC,GAArB;QACE,OAAO,IAAI,CAAC;KACb;IAEM,qBAAC,cAAqB,CAAC,GAA9B;QACE,OAAO,IAAI,CAAC;KACb;IACH,iBAAC;CARD,CAAmCA,YAAc,GAQhD;;SClBe,eAAe,CAAI,KAAoB;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;CACjD;;SCCe,aAAa,CAAC,GAAU;IACtC,OAAO,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;C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C;CAAA,IAAA;;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-client/bundle.umd.js b/node_modules/apollo-client/bundle.umd.js deleted file mode 100644 index f3c5420f..00000000 --- a/node_modules/apollo-client/bundle.umd.js +++ /dev/null @@ -1,2733 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "tslib", "apollo-utilities", "apollo-link", "symbol-observable", "ts-invariant", "graphql/language/visitor"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("tslib"), require("apollo-utilities"), require("apollo-link"), require("symbol-observable"), require("ts-invariant"), require("graphql/language/visitor")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.tslib, global.apolloUtilities, global.apolloLink, global.symbolObservable, global.tsInvariant, global.visitor); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _tslib, _apolloUtilities, _apolloLink, _symbolObservable, _tsInvariant, _visitor) { - - _exports.__esModule = true; - _exports.isApolloError = isApolloError; - _exports.ObservableQuery = _exports.NetworkStatus = _exports.FetchType = _exports.ApolloError = _exports.ApolloClient = _exports.default = void 0; - _symbolObservable = _interopRequireDefault(_symbolObservable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var NetworkStatus; - _exports.NetworkStatus = NetworkStatus; - - (function (NetworkStatus) { - NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; - NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; - NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; - NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; - NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; - NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; - NetworkStatus[NetworkStatus["error"] = 8] = "error"; - })(NetworkStatus || (_exports.NetworkStatus = NetworkStatus = {})); - - function isNetworkRequestInFlight(networkStatus) { - return networkStatus < 7; - } - - var Observable = function (_super) { - (0, _tslib.__extends)(Observable, _super); - - function Observable() { - return _super !== null && _super.apply(this, arguments) || this; - } - - Observable.prototype[_symbolObservable.default] = function () { - return this; - }; - - Observable.prototype['@@observable'] = function () { - return this; - }; - - return Observable; - }(_apolloLink.Observable); - - function isNonEmptyArray(value) { - return Array.isArray(value) && value.length > 0; - } - - function isApolloError(err) { - return err.hasOwnProperty('graphQLErrors'); - } - - var generateErrorMessage = function (err) { - var message = ''; - - if (isNonEmptyArray(err.graphQLErrors)) { - err.graphQLErrors.forEach(function (graphQLError) { - var errorMessage = graphQLError ? graphQLError.message : 'Error message not found.'; - message += "GraphQL error: " + errorMessage + "\n"; - }); - } - - if (err.networkError) { - message += 'Network error: ' + err.networkError.message + '\n'; - } - - message = message.replace(/\n$/, ''); - return message; - }; - - var ApolloError = function (_super) { - (0, _tslib.__extends)(ApolloError, _super); - - function ApolloError(_a) { - var graphQLErrors = _a.graphQLErrors, - networkError = _a.networkError, - errorMessage = _a.errorMessage, - extraInfo = _a.extraInfo; - - var _this = _super.call(this, errorMessage) || this; - - _this.graphQLErrors = graphQLErrors || []; - _this.networkError = networkError || null; - - if (!errorMessage) { - _this.message = generateErrorMessage(_this); - } else { - _this.message = errorMessage; - } - - _this.extraInfo = extraInfo; - _this.__proto__ = ApolloError.prototype; - return _this; - } - - return ApolloError; - }(Error); - - _exports.ApolloError = ApolloError; - var FetchType; - _exports.FetchType = FetchType; - - (function (FetchType) { - FetchType[FetchType["normal"] = 1] = "normal"; - FetchType[FetchType["refetch"] = 2] = "refetch"; - FetchType[FetchType["poll"] = 3] = "poll"; - })(FetchType || (_exports.FetchType = FetchType = {})); - - var hasError = function (storeValue, policy) { - if (policy === void 0) { - policy = 'none'; - } - - return storeValue && (storeValue.networkError || policy === 'none' && isNonEmptyArray(storeValue.graphQLErrors)); - }; - - var ObservableQuery = function (_super) { - (0, _tslib.__extends)(ObservableQuery, _super); - - function ObservableQuery(_a) { - var queryManager = _a.queryManager, - options = _a.options, - _b = _a.shouldSubscribe, - shouldSubscribe = _b === void 0 ? true : _b; - - var _this = _super.call(this, function (observer) { - return _this.onSubscribe(observer); - }) || this; - - _this.observers = new Set(); - _this.subscriptions = new Set(); - _this.isTornDown = false; - _this.options = options; - _this.variables = options.variables || {}; - _this.queryId = queryManager.generateQueryId(); - _this.shouldSubscribe = shouldSubscribe; - var opDef = (0, _apolloUtilities.getOperationDefinition)(options.query); - _this.queryName = opDef && opDef.name && opDef.name.value; - _this.queryManager = queryManager; - return _this; - } - - ObservableQuery.prototype.result = function () { - var _this = this; - - return new Promise(function (resolve, reject) { - var observer = { - next: function (result) { - resolve(result); - - _this.observers.delete(observer); - - if (!_this.observers.size) { - _this.queryManager.removeQuery(_this.queryId); - } - - setTimeout(function () { - subscription.unsubscribe(); - }, 0); - }, - error: reject - }; - - var subscription = _this.subscribe(observer); - }); - }; - - ObservableQuery.prototype.currentResult = function () { - var result = this.getCurrentResult(); - - if (result.data === undefined) { - result.data = {}; - } - - return result; - }; - - ObservableQuery.prototype.getCurrentResult = function () { - if (this.isTornDown) { - var lastResult = this.lastResult; - return { - data: !this.lastError && lastResult && lastResult.data || void 0, - error: this.lastError, - loading: false, - networkStatus: NetworkStatus.error - }; - } - - var _a = this.queryManager.getCurrentQueryResult(this), - data = _a.data, - partial = _a.partial; - - var queryStoreValue = this.queryManager.queryStore.get(this.queryId); - var result; - var fetchPolicy = this.options.fetchPolicy; - var isNetworkFetchPolicy = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; - - if (queryStoreValue) { - var networkStatus = queryStoreValue.networkStatus; - - if (hasError(queryStoreValue, this.options.errorPolicy)) { - return { - data: void 0, - loading: false, - networkStatus: networkStatus, - error: new ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError - }) - }; - } - - if (queryStoreValue.variables) { - this.options.variables = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options.variables), queryStoreValue.variables); - this.variables = this.options.variables; - } - - result = { - data: data, - loading: isNetworkRequestInFlight(networkStatus), - networkStatus: networkStatus - }; - - if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') { - result.errors = queryStoreValue.graphQLErrors; - } - } else { - var loading = isNetworkFetchPolicy || partial && fetchPolicy !== 'cache-only'; - result = { - data: data, - loading: loading, - networkStatus: loading ? NetworkStatus.loading : NetworkStatus.ready - }; - } - - if (!partial) { - this.updateLastResult((0, _tslib.__assign)((0, _tslib.__assign)({}, result), { - stale: false - })); - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, result), { - partial: partial - }); - }; - - ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { - var snapshot = this.lastResultSnapshot; - return !(snapshot && newResult && snapshot.networkStatus === newResult.networkStatus && snapshot.stale === newResult.stale && (0, _apolloUtilities.isEqual)(snapshot.data, newResult.data)); - }; - - ObservableQuery.prototype.getLastResult = function () { - return this.lastResult; - }; - - ObservableQuery.prototype.getLastError = function () { - return this.lastError; - }; - - ObservableQuery.prototype.resetLastResults = function () { - delete this.lastResult; - delete this.lastResultSnapshot; - delete this.lastError; - this.isTornDown = false; - }; - - ObservableQuery.prototype.resetQueryStoreErrors = function () { - var queryStore = this.queryManager.queryStore.get(this.queryId); - - if (queryStore) { - queryStore.networkError = null; - queryStore.graphQLErrors = []; - } - }; - - ObservableQuery.prototype.refetch = function (variables) { - var fetchPolicy = this.options.fetchPolicy; - - if (fetchPolicy === 'cache-only') { - return Promise.reject(process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(1) : new _tsInvariant.InvariantError('cache-only fetchPolicy option should not be used together with query refetch.')); - } - - if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'cache-and-network') { - fetchPolicy = 'network-only'; - } - - if (!(0, _apolloUtilities.isEqual)(this.variables, variables)) { - this.variables = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.variables), variables); - } - - if (!(0, _apolloUtilities.isEqual)(this.options.variables, this.variables)) { - this.options.variables = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options.variables), this.variables); - } - - return this.queryManager.fetchQuery(this.queryId, (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options), { - fetchPolicy: fetchPolicy - }), FetchType.refetch); - }; - - ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { - var _this = this; - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fetchMoreOptions.updateQuery, 2) : (0, _tsInvariant.invariant)(fetchMoreOptions.updateQuery, 'updateQuery option is required. This function defines how to update the query data with the new results.'); - var combinedOptions = (0, _tslib.__assign)((0, _tslib.__assign)({}, fetchMoreOptions.query ? fetchMoreOptions : (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, this.options), fetchMoreOptions), { - variables: (0, _tslib.__assign)((0, _tslib.__assign)({}, this.variables), fetchMoreOptions.variables) - })), { - fetchPolicy: 'network-only' - }); - var qid = this.queryManager.generateQueryId(); - return this.queryManager.fetchQuery(qid, combinedOptions, FetchType.normal, this.queryId).then(function (fetchMoreResult) { - _this.updateQuery(function (previousResult) { - return fetchMoreOptions.updateQuery(previousResult, { - fetchMoreResult: fetchMoreResult.data, - variables: combinedOptions.variables - }); - }); - - _this.queryManager.stopQuery(qid); - - return fetchMoreResult; - }, function (error) { - _this.queryManager.stopQuery(qid); - - throw error; - }); - }; - - ObservableQuery.prototype.subscribeToMore = function (options) { - var _this = this; - - var subscription = this.queryManager.startGraphQLSubscription({ - query: options.document, - variables: options.variables - }).subscribe({ - next: function (subscriptionData) { - var updateQuery = options.updateQuery; - - if (updateQuery) { - _this.updateQuery(function (previous, _a) { - var variables = _a.variables; - return updateQuery(previous, { - subscriptionData: subscriptionData, - variables: variables - }); - }); - } - }, - error: function (err) { - if (options.onError) { - options.onError(err); - return; - } - - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('Unhandled GraphQL subscription error', err); - } - }); - this.subscriptions.add(subscription); - return function () { - if (_this.subscriptions.delete(subscription)) { - subscription.unsubscribe(); - } - }; - }; - - ObservableQuery.prototype.setOptions = function (opts) { - var oldFetchPolicy = this.options.fetchPolicy; - this.options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.options), opts); - - if (opts.pollInterval) { - this.startPolling(opts.pollInterval); - } else if (opts.pollInterval === 0) { - this.stopPolling(); - } - - var fetchPolicy = opts.fetchPolicy; - return this.setVariables(this.options.variables, oldFetchPolicy !== fetchPolicy && (oldFetchPolicy === 'cache-only' || oldFetchPolicy === 'standby' || fetchPolicy === 'network-only'), opts.fetchResults); - }; - - ObservableQuery.prototype.setVariables = function (variables, tryFetch, fetchResults) { - if (tryFetch === void 0) { - tryFetch = false; - } - - if (fetchResults === void 0) { - fetchResults = true; - } - - this.isTornDown = false; - variables = variables || this.variables; - - if (!tryFetch && (0, _apolloUtilities.isEqual)(variables, this.variables)) { - return this.observers.size && fetchResults ? this.result() : Promise.resolve(); - } - - this.variables = this.options.variables = variables; - - if (!this.observers.size) { - return Promise.resolve(); - } - - return this.queryManager.fetchQuery(this.queryId, this.options); - }; - - ObservableQuery.prototype.updateQuery = function (mapFn) { - var queryManager = this.queryManager; - - var _a = queryManager.getQueryWithPreviousResult(this.queryId), - previousResult = _a.previousResult, - variables = _a.variables, - document = _a.document; - - var newResult = (0, _apolloUtilities.tryFunctionOrLogError)(function () { - return mapFn(previousResult, { - variables: variables - }); - }); - - if (newResult) { - queryManager.dataStore.markUpdateQueryResult(document, variables, newResult); - queryManager.broadcastQueries(); - } - }; - - ObservableQuery.prototype.stopPolling = function () { - this.queryManager.stopPollingQuery(this.queryId); - this.options.pollInterval = undefined; - }; - - ObservableQuery.prototype.startPolling = function (pollInterval) { - assertNotCacheFirstOrOnly(this); - this.options.pollInterval = pollInterval; - this.queryManager.startPollingQuery(this.options, this.queryId); - }; - - ObservableQuery.prototype.updateLastResult = function (newResult) { - var previousResult = this.lastResult; - this.lastResult = newResult; - this.lastResultSnapshot = this.queryManager.assumeImmutableResults ? newResult : (0, _apolloUtilities.cloneDeep)(newResult); - return previousResult; - }; - - ObservableQuery.prototype.onSubscribe = function (observer) { - var _this = this; - - try { - var subObserver = observer._subscription._observer; - - if (subObserver && !subObserver.error) { - subObserver.error = defaultSubscriptionObserverErrorCallback; - } - } catch (_a) {} - - var first = !this.observers.size; - this.observers.add(observer); - if (observer.next && this.lastResult) observer.next(this.lastResult); - if (observer.error && this.lastError) observer.error(this.lastError); - - if (first) { - this.setUpQuery(); - } - - return function () { - if (_this.observers.delete(observer) && !_this.observers.size) { - _this.tearDownQuery(); - } - }; - }; - - ObservableQuery.prototype.setUpQuery = function () { - var _this = this; - - var _a = this, - queryManager = _a.queryManager, - queryId = _a.queryId; - - if (this.shouldSubscribe) { - queryManager.addObservableQuery(queryId, this); - } - - if (this.options.pollInterval) { - assertNotCacheFirstOrOnly(this); - queryManager.startPollingQuery(this.options, queryId); - } - - var onError = function (error) { - _this.updateLastResult((0, _tslib.__assign)((0, _tslib.__assign)({}, _this.lastResult), { - errors: error.graphQLErrors, - networkStatus: NetworkStatus.error, - loading: false - })); - - iterateObserversSafely(_this.observers, 'error', _this.lastError = error); - }; - - queryManager.observeQuery(queryId, this.options, { - next: function (result) { - if (_this.lastError || _this.isDifferentFromLastResult(result)) { - var previousResult_1 = _this.updateLastResult(result); - - var _a = _this.options, - query_1 = _a.query, - variables = _a.variables, - fetchPolicy_1 = _a.fetchPolicy; - - if (queryManager.transform(query_1).hasClientExports) { - queryManager.getLocalState().addExportedVariables(query_1, variables).then(function (variables) { - var previousVariables = _this.variables; - _this.variables = _this.options.variables = variables; - - if (!result.loading && previousResult_1 && fetchPolicy_1 !== 'cache-only' && queryManager.transform(query_1).serverQuery && !(0, _apolloUtilities.isEqual)(previousVariables, variables)) { - _this.refetch(); - } else { - iterateObserversSafely(_this.observers, 'next', result); - } - }); - } else { - iterateObserversSafely(_this.observers, 'next', result); - } - } - }, - error: onError - }).catch(onError); - }; - - ObservableQuery.prototype.tearDownQuery = function () { - var queryManager = this.queryManager; - this.isTornDown = true; - queryManager.stopPollingQuery(this.queryId); - this.subscriptions.forEach(function (sub) { - return sub.unsubscribe(); - }); - this.subscriptions.clear(); - queryManager.removeObservableQuery(this.queryId); - queryManager.stopQuery(this.queryId); - this.observers.clear(); - }; - - return ObservableQuery; - }(Observable); - - _exports.ObservableQuery = ObservableQuery; - - function defaultSubscriptionObserverErrorCallback(error) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error('Unhandled error', error.message, error.stack); - } - - function iterateObserversSafely(observers, method, argument) { - var observersWithMethod = []; - observers.forEach(function (obs) { - return obs[method] && observersWithMethod.push(obs); - }); - observersWithMethod.forEach(function (obs) { - return obs[method](argument); - }); - } - - function assertNotCacheFirstOrOnly(obsQuery) { - var fetchPolicy = obsQuery.options.fetchPolicy; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 3) : (0, _tsInvariant.invariant)(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.'); - } - - var MutationStore = function () { - function MutationStore() { - this.store = {}; - } - - MutationStore.prototype.getStore = function () { - return this.store; - }; - - MutationStore.prototype.get = function (mutationId) { - return this.store[mutationId]; - }; - - MutationStore.prototype.initMutation = function (mutationId, mutation, variables) { - this.store[mutationId] = { - mutation: mutation, - variables: variables || {}, - loading: true, - error: null - }; - }; - - MutationStore.prototype.markMutationError = function (mutationId, error) { - var mutation = this.store[mutationId]; - - if (mutation) { - mutation.loading = false; - mutation.error = error; - } - }; - - MutationStore.prototype.markMutationResult = function (mutationId) { - var mutation = this.store[mutationId]; - - if (mutation) { - mutation.loading = false; - mutation.error = null; - } - }; - - MutationStore.prototype.reset = function () { - this.store = {}; - }; - - return MutationStore; - }(); - - var QueryStore = function () { - function QueryStore() { - this.store = {}; - } - - QueryStore.prototype.getStore = function () { - return this.store; - }; - - QueryStore.prototype.get = function (queryId) { - return this.store[queryId]; - }; - - QueryStore.prototype.initQuery = function (query) { - var previousQuery = this.store[query.queryId]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!previousQuery || previousQuery.document === query.document || (0, _apolloUtilities.isEqual)(previousQuery.document, query.document), 19) : (0, _tsInvariant.invariant)(!previousQuery || previousQuery.document === query.document || (0, _apolloUtilities.isEqual)(previousQuery.document, query.document), 'Internal Error: may not update existing query string in store'); - var isSetVariables = false; - var previousVariables = null; - - if (query.storePreviousVariables && previousQuery && previousQuery.networkStatus !== NetworkStatus.loading) { - if (!(0, _apolloUtilities.isEqual)(previousQuery.variables, query.variables)) { - isSetVariables = true; - previousVariables = previousQuery.variables; - } - } - - var networkStatus; - - if (isSetVariables) { - networkStatus = NetworkStatus.setVariables; - } else if (query.isPoll) { - networkStatus = NetworkStatus.poll; - } else if (query.isRefetch) { - networkStatus = NetworkStatus.refetch; - } else { - networkStatus = NetworkStatus.loading; - } - - var graphQLErrors = []; - - if (previousQuery && previousQuery.graphQLErrors) { - graphQLErrors = previousQuery.graphQLErrors; - } - - this.store[query.queryId] = { - document: query.document, - variables: query.variables, - previousVariables: previousVariables, - networkError: null, - graphQLErrors: graphQLErrors, - networkStatus: networkStatus, - metadata: query.metadata - }; - - if (typeof query.fetchMoreForQueryId === 'string' && this.store[query.fetchMoreForQueryId]) { - this.store[query.fetchMoreForQueryId].networkStatus = NetworkStatus.fetchMore; - } - }; - - QueryStore.prototype.markQueryResult = function (queryId, result, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) return; - this.store[queryId].networkError = null; - this.store[queryId].graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : []; - this.store[queryId].previousVariables = null; - this.store[queryId].networkStatus = NetworkStatus.ready; - - if (typeof fetchMoreForQueryId === 'string' && this.store[fetchMoreForQueryId]) { - this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready; - } - }; - - QueryStore.prototype.markQueryError = function (queryId, error, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) return; - this.store[queryId].networkError = error; - this.store[queryId].networkStatus = NetworkStatus.error; - - if (typeof fetchMoreForQueryId === 'string') { - this.markQueryResultClient(fetchMoreForQueryId, true); - } - }; - - QueryStore.prototype.markQueryResultClient = function (queryId, complete) { - var storeValue = this.store && this.store[queryId]; - - if (storeValue) { - storeValue.networkError = null; - storeValue.previousVariables = null; - - if (complete) { - storeValue.networkStatus = NetworkStatus.ready; - } - } - }; - - QueryStore.prototype.stopQuery = function (queryId) { - delete this.store[queryId]; - }; - - QueryStore.prototype.reset = function (observableQueryIds) { - var _this = this; - - Object.keys(this.store).forEach(function (queryId) { - if (observableQueryIds.indexOf(queryId) < 0) { - _this.stopQuery(queryId); - } else { - _this.store[queryId].networkStatus = NetworkStatus.loading; - } - }); - }; - - return QueryStore; - }(); - - function capitalizeFirstLetter(str) { - return str.charAt(0).toUpperCase() + str.slice(1); - } - - var LocalState = function () { - function LocalState(_a) { - var cache = _a.cache, - client = _a.client, - resolvers = _a.resolvers, - fragmentMatcher = _a.fragmentMatcher; - this.cache = cache; - - if (client) { - this.client = client; - } - - if (resolvers) { - this.addResolvers(resolvers); - } - - if (fragmentMatcher) { - this.setFragmentMatcher(fragmentMatcher); - } - } - - LocalState.prototype.addResolvers = function (resolvers) { - var _this = this; - - this.resolvers = this.resolvers || {}; - - if (Array.isArray(resolvers)) { - resolvers.forEach(function (resolverGroup) { - _this.resolvers = (0, _apolloUtilities.mergeDeep)(_this.resolvers, resolverGroup); - }); - } else { - this.resolvers = (0, _apolloUtilities.mergeDeep)(this.resolvers, resolvers); - } - }; - - LocalState.prototype.setResolvers = function (resolvers) { - this.resolvers = {}; - this.addResolvers(resolvers); - }; - - LocalState.prototype.getResolvers = function () { - return this.resolvers || {}; - }; - - LocalState.prototype.runResolvers = function (_a) { - var document = _a.document, - remoteResult = _a.remoteResult, - context = _a.context, - variables = _a.variables, - _b = _a.onlyRunForcedResolvers, - onlyRunForcedResolvers = _b === void 0 ? false : _b; - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - return (0, _tslib.__generator)(this, function (_c) { - if (document) { - return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, remoteResult), { - data: localResult.result - }); - })]; - } - - return [2, remoteResult]; - }); - }); - }; - - LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { - this.fragmentMatcher = fragmentMatcher; - }; - - LocalState.prototype.getFragmentMatcher = function () { - return this.fragmentMatcher; - }; - - LocalState.prototype.clientQuery = function (document) { - if ((0, _apolloUtilities.hasDirectives)(['client'], document)) { - if (this.resolvers) { - return document; - } - - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Found @client directives in a query but no ApolloClient resolvers ' + 'were specified. This means ApolloClient local resolver handling ' + 'has been disabled, and @client directives will be passed through ' + 'to your link chain.'); - } - - return null; - }; - - LocalState.prototype.serverQuery = function (document) { - return this.resolvers ? (0, _apolloUtilities.removeClientSetsFromDocument)(document) : document; - }; - - LocalState.prototype.prepareContext = function (context) { - if (context === void 0) { - context = {}; - } - - var cache = this.cache; - var newContext = (0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - cache: cache, - getCacheKey: function (obj) { - if (cache.config) { - return cache.config.dataIdFromObject(obj); - } else { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(false, 6) : (0, _tsInvariant.invariant)(false, 'To use context.getCacheKey, you need to use a cache that has ' + 'a configurable dataIdFromObject, like apollo-cache-inmemory.'); - } - } - }); - return newContext; - }; - - LocalState.prototype.addExportedVariables = function (document, variables, context) { - if (variables === void 0) { - variables = {}; - } - - if (context === void 0) { - context = {}; - } - - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - return (0, _tslib.__generator)(this, function (_a) { - if (document) { - return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, variables), data.exportedVariables); - })]; - } - - return [2, (0, _tslib.__assign)({}, variables)]; - }); - }); - }; - - LocalState.prototype.shouldForceResolvers = function (document) { - var forceResolvers = false; - (0, _visitor.visit)(document, { - Directive: { - enter: function (node) { - if (node.name.value === 'client' && node.arguments) { - forceResolvers = node.arguments.some(function (arg) { - return arg.name.value === 'always' && arg.value.kind === 'BooleanValue' && arg.value.value === true; - }); - - if (forceResolvers) { - return _visitor.BREAK; - } - } - } - } - }); - return forceResolvers; - }; - - LocalState.prototype.buildRootValueFromCache = function (document, variables) { - return this.cache.diff({ - query: (0, _apolloUtilities.buildQueryFromSelectionSet)(document), - variables: variables, - returnPartialData: true, - optimistic: false - }).result; - }; - - LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { - if (context === void 0) { - context = {}; - } - - if (variables === void 0) { - variables = {}; - } - - if (fragmentMatcher === void 0) { - fragmentMatcher = function () { - return true; - }; - } - - if (onlyRunForcedResolvers === void 0) { - onlyRunForcedResolvers = false; - } - - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; - - return (0, _tslib.__generator)(this, function (_b) { - mainDefinition = (0, _apolloUtilities.getMainDefinition)(document); - fragments = (0, _apolloUtilities.getFragmentDefinitions)(document); - fragmentMap = (0, _apolloUtilities.createFragmentMap)(fragments); - definitionOperation = mainDefinition.operation; - defaultOperationType = definitionOperation ? capitalizeFirstLetter(definitionOperation) : 'Query'; - _a = this, cache = _a.cache, client = _a.client; - execContext = { - fragmentMap: fragmentMap, - context: (0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - cache: cache, - client: client - }), - variables: variables, - fragmentMatcher: fragmentMatcher, - defaultOperationType: defaultOperationType, - exportedVariables: {}, - onlyRunForcedResolvers: onlyRunForcedResolvers - }; - return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { - return { - result: result, - exportedVariables: execContext.exportedVariables - }; - })]; - }); - }); - }; - - LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var fragmentMap, context, variables, resultsToMerge, execute; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_a) { - fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; - resultsToMerge = [rootValue]; - - execute = function (selection) { - return (0, _tslib.__awaiter)(_this, void 0, void 0, function () { - var fragment, typeCondition; - return (0, _tslib.__generator)(this, function (_a) { - if (!(0, _apolloUtilities.shouldInclude)(selection, variables)) { - return [2]; - } - - if ((0, _apolloUtilities.isField)(selection)) { - return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { - var _a; - - if (typeof fieldResult !== 'undefined') { - resultsToMerge.push((_a = {}, _a[(0, _apolloUtilities.resultKeyNameFromField)(selection)] = fieldResult, _a)); - } - })]; - } - - if ((0, _apolloUtilities.isInlineFragment)(selection)) { - fragment = selection; - } else { - fragment = fragmentMap[selection.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragment, 7) : (0, _tsInvariant.invariant)(fragment, "No fragment named " + selection.name.value); - } - - if (fragment && fragment.typeCondition) { - typeCondition = fragment.typeCondition.name.value; - - if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { - return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { - resultsToMerge.push(fragmentResult); - })]; - } - } - - return [2]; - }); - }); - }; - - return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { - return (0, _apolloUtilities.mergeDeepArray)(resultsToMerge); - })]; - }); - }); - }; - - LocalState.prototype.resolveField = function (field, rootValue, execContext) { - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_a) { - variables = execContext.variables; - fieldName = field.name.value; - aliasedFieldName = (0, _apolloUtilities.resultKeyNameFromField)(field); - aliasUsed = fieldName !== aliasedFieldName; - defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; - resultPromise = Promise.resolve(defaultResult); - - if (!execContext.onlyRunForcedResolvers || this.shouldForceResolvers(field)) { - resolverType = rootValue.__typename || execContext.defaultOperationType; - resolverMap = this.resolvers && this.resolvers[resolverType]; - - if (resolverMap) { - resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; - - if (resolve) { - resultPromise = Promise.resolve(resolve(rootValue, (0, _apolloUtilities.argumentsObjectFromField)(field, variables), execContext.context, { - field: field, - fragmentMap: execContext.fragmentMap - })); - } - } - } - - return [2, resultPromise.then(function (result) { - if (result === void 0) { - result = defaultResult; - } - - if (field.directives) { - field.directives.forEach(function (directive) { - if (directive.name.value === 'export' && directive.arguments) { - directive.arguments.forEach(function (arg) { - if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { - execContext.exportedVariables[arg.value.value] = result; - } - }); - } - }); - } - - if (!field.selectionSet) { - return result; - } - - if (result == null) { - return result; - } - - if (Array.isArray(result)) { - return _this.resolveSubSelectedArray(field, result, execContext); - } - - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, result, execContext); - } - })]; - }); - }); - }; - - LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { - var _this = this; - - return Promise.all(result.map(function (item) { - if (item === null) { - return null; - } - - if (Array.isArray(item)) { - return _this.resolveSubSelectedArray(field, item, execContext); - } - - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, item, execContext); - } - })); - }; - - return LocalState; - }(); - - function multiplex(inner) { - var observers = new Set(); - var sub = null; - return new Observable(function (observer) { - observers.add(observer); - sub = sub || inner.subscribe({ - next: function (value) { - observers.forEach(function (obs) { - return obs.next && obs.next(value); - }); - }, - error: function (error) { - observers.forEach(function (obs) { - return obs.error && obs.error(error); - }); - }, - complete: function () { - observers.forEach(function (obs) { - return obs.complete && obs.complete(); - }); - } - }); - return function () { - if (observers.delete(observer) && !observers.size && sub) { - sub.unsubscribe(); - sub = null; - } - }; - }); - } - - function asyncMap(observable, mapFn) { - return new Observable(function (observer) { - var next = observer.next, - error = observer.error, - complete = observer.complete; - var activeNextCount = 0; - var completed = false; - var handler = { - next: function (value) { - ++activeNextCount; - new Promise(function (resolve) { - resolve(mapFn(value)); - }).then(function (result) { - --activeNextCount; - next && next.call(observer, result); - completed && handler.complete(); - }, function (e) { - --activeNextCount; - error && error.call(observer, e); - }); - }, - error: function (e) { - error && error.call(observer, e); - }, - complete: function () { - completed = true; - - if (!activeNextCount) { - complete && complete.call(observer); - } - } - }; - var sub = observable.subscribe(handler); - return function () { - return sub.unsubscribe(); - }; - }); - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - var QueryManager = function () { - function QueryManager(_a) { - var link = _a.link, - _b = _a.queryDeduplication, - queryDeduplication = _b === void 0 ? false : _b, - store = _a.store, - _c = _a.onBroadcast, - onBroadcast = _c === void 0 ? function () { - return undefined; - } : _c, - _d = _a.ssrMode, - ssrMode = _d === void 0 ? false : _d, - _e = _a.clientAwareness, - clientAwareness = _e === void 0 ? {} : _e, - localState = _a.localState, - assumeImmutableResults = _a.assumeImmutableResults; - this.mutationStore = new MutationStore(); - this.queryStore = new QueryStore(); - this.clientAwareness = {}; - this.idCounter = 1; - this.queries = new Map(); - this.fetchQueryRejectFns = new Map(); - this.transformCache = new (_apolloUtilities.canUseWeakMap ? WeakMap : Map)(); - this.inFlightLinkObservables = new Map(); - this.pollingInfoByQueryId = new Map(); - this.link = link; - this.queryDeduplication = queryDeduplication; - this.dataStore = store; - this.onBroadcast = onBroadcast; - this.clientAwareness = clientAwareness; - this.localState = localState || new LocalState({ - cache: store.getCache() - }); - this.ssrMode = ssrMode; - this.assumeImmutableResults = !!assumeImmutableResults; - } - - QueryManager.prototype.stop = function () { - var _this = this; - - this.queries.forEach(function (_info, queryId) { - _this.stopQueryNoBroadcast(queryId); - }); - this.fetchQueryRejectFns.forEach(function (reject) { - reject(process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(8) : new _tsInvariant.InvariantError('QueryManager stopped while query was in flight')); - }); - }; - - QueryManager.prototype.mutate = function (_a) { - var mutation = _a.mutation, - variables = _a.variables, - optimisticResponse = _a.optimisticResponse, - updateQueriesByName = _a.updateQueries, - _b = _a.refetchQueries, - refetchQueries = _b === void 0 ? [] : _b, - _c = _a.awaitRefetchQueries, - awaitRefetchQueries = _c === void 0 ? false : _c, - updateWithProxyFn = _a.update, - _d = _a.errorPolicy, - errorPolicy = _d === void 0 ? 'none' : _d, - fetchPolicy = _a.fetchPolicy, - _e = _a.context, - context = _e === void 0 ? {} : _e; - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var mutationId, generateUpdateQueriesInfo, self; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_f) { - switch (_f.label) { - case 0: - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutation, 9) : (0, _tsInvariant.invariant)(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!fetchPolicy || fetchPolicy === 'no-cache', 10) : (0, _tsInvariant.invariant)(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); - mutationId = this.generateQueryId(); - mutation = this.transform(mutation).document; - this.setQuery(mutationId, function () { - return { - document: mutation - }; - }); - variables = this.getVariables(mutation, variables); - if (!this.transform(mutation).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(mutation, variables, context)]; - - case 1: - variables = _f.sent(); - _f.label = 2; - - case 2: - generateUpdateQueriesInfo = function () { - var ret = {}; - - if (updateQueriesByName) { - _this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - - if (observableQuery) { - var queryName = observableQuery.queryName; - - if (queryName && hasOwnProperty.call(updateQueriesByName, queryName)) { - ret[queryId] = { - updater: updateQueriesByName[queryName], - query: _this.queryStore.get(queryId) - }; - } - } - }); - } - - return ret; - }; - - this.mutationStore.initMutation(mutationId, mutation, variables); - this.dataStore.markMutationInit({ - mutationId: mutationId, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn, - optimisticResponse: optimisticResponse - }); - this.broadcastQueries(); - self = this; - return [2, new Promise(function (resolve, reject) { - var storeResult; - var error; - self.getObservableFromLink(mutation, (0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - optimisticResponse: optimisticResponse - }), variables, false).subscribe({ - next: function (result) { - if ((0, _apolloUtilities.graphQLResultHasError)(result) && errorPolicy === 'none') { - error = new ApolloError({ - graphQLErrors: result.errors - }); - return; - } - - self.mutationStore.markMutationResult(mutationId); - - if (fetchPolicy !== 'no-cache') { - self.dataStore.markMutationResult({ - mutationId: mutationId, - result: result, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn - }); - } - - storeResult = result; - }, - error: function (err) { - self.mutationStore.markMutationError(mutationId, err); - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse - }); - self.broadcastQueries(); - self.setQuery(mutationId, function () { - return { - document: null - }; - }); - reject(new ApolloError({ - networkError: err - })); - }, - complete: function () { - if (error) { - self.mutationStore.markMutationError(mutationId, error); - } - - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse - }); - self.broadcastQueries(); - - if (error) { - reject(error); - return; - } - - if (typeof refetchQueries === 'function') { - refetchQueries = refetchQueries(storeResult); - } - - var refetchQueryPromises = []; - - if (isNonEmptyArray(refetchQueries)) { - refetchQueries.forEach(function (refetchQuery) { - if (typeof refetchQuery === 'string') { - self.queries.forEach(function (_a) { - var observableQuery = _a.observableQuery; - - if (observableQuery && observableQuery.queryName === refetchQuery) { - refetchQueryPromises.push(observableQuery.refetch()); - } - }); - } else { - var queryOptions = { - query: refetchQuery.query, - variables: refetchQuery.variables, - fetchPolicy: 'network-only' - }; - - if (refetchQuery.context) { - queryOptions.context = refetchQuery.context; - } - - refetchQueryPromises.push(self.query(queryOptions)); - } - }); - } - - Promise.all(awaitRefetchQueries ? refetchQueryPromises : []).then(function () { - self.setQuery(mutationId, function () { - return { - document: null - }; - }); - - if (errorPolicy === 'ignore' && storeResult && (0, _apolloUtilities.graphQLResultHasError)(storeResult)) { - delete storeResult.errors; - } - - resolve(storeResult); - }); - } - }); - })]; - } - }); - }); - }; - - QueryManager.prototype.fetchQuery = function (queryId, options, fetchType, fetchMoreForQueryId) { - return (0, _tslib.__awaiter)(this, void 0, void 0, function () { - var _a, metadata, _b, fetchPolicy, _c, context, query, variables, storeResult, isNetworkOnly, needToFetch, _d, complete, result, shouldFetch, requestId, cancel, networkResult; - - var _this = this; - - return (0, _tslib.__generator)(this, function (_e) { - switch (_e.label) { - case 0: - _a = options.metadata, metadata = _a === void 0 ? null : _a, _b = options.fetchPolicy, fetchPolicy = _b === void 0 ? 'cache-first' : _b, _c = options.context, context = _c === void 0 ? {} : _c; - query = this.transform(options.query).document; - variables = this.getVariables(query, options.variables); - if (!this.transform(query).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(query, variables, context)]; - - case 1: - variables = _e.sent(); - _e.label = 2; - - case 2: - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - variables: variables - }); - isNetworkOnly = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; - needToFetch = isNetworkOnly; - - if (!isNetworkOnly) { - _d = this.dataStore.getCache().diff({ - query: query, - variables: variables, - returnPartialData: true, - optimistic: false - }), complete = _d.complete, result = _d.result; - needToFetch = !complete || fetchPolicy === 'cache-and-network'; - storeResult = result; - } - - shouldFetch = needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby'; - if ((0, _apolloUtilities.hasDirectives)(['live'], query)) shouldFetch = true; - requestId = this.idCounter++; - cancel = fetchPolicy !== 'no-cache' ? this.updateQueryWatch(queryId, query, options) : undefined; - this.setQuery(queryId, function () { - return { - document: query, - lastRequestId: requestId, - invalidated: true, - cancel: cancel - }; - }); - this.invalidate(fetchMoreForQueryId); - this.queryStore.initQuery({ - queryId: queryId, - document: query, - storePreviousVariables: shouldFetch, - variables: variables, - isPoll: fetchType === FetchType.poll, - isRefetch: fetchType === FetchType.refetch, - metadata: metadata, - fetchMoreForQueryId: fetchMoreForQueryId - }); - this.broadcastQueries(); - - if (shouldFetch) { - networkResult = this.fetchRequest({ - requestId: requestId, - queryId: queryId, - document: query, - options: options, - fetchMoreForQueryId: fetchMoreForQueryId - }).catch(function (error) { - if (isApolloError(error)) { - throw error; - } else { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId); - - _this.invalidate(queryId); - - _this.invalidate(fetchMoreForQueryId); - - _this.broadcastQueries(); - } - - throw new ApolloError({ - networkError: error - }); - } - }); - - if (fetchPolicy !== 'cache-and-network') { - return [2, networkResult]; - } - - networkResult.catch(function () {}); - } - - this.queryStore.markQueryResultClient(queryId, !shouldFetch); - this.invalidate(queryId); - this.invalidate(fetchMoreForQueryId); - - if (this.transform(query).hasForcedResolvers) { - return [2, this.localState.runResolvers({ - document: query, - remoteResult: { - data: storeResult - }, - context: context, - variables: variables, - onlyRunForcedResolvers: true - }).then(function (result) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - - _this.broadcastQueries(); - - return result; - })]; - } - - this.broadcastQueries(); - return [2, { - data: storeResult - }]; - } - }); - }); - }; - - QueryManager.prototype.markQueryResult = function (queryId, result, _a, fetchMoreForQueryId) { - var fetchPolicy = _a.fetchPolicy, - variables = _a.variables, - errorPolicy = _a.errorPolicy; - - if (fetchPolicy === 'no-cache') { - this.setQuery(queryId, function () { - return { - newData: { - result: result.data, - complete: true - } - }; - }); - } else { - this.dataStore.markQueryResult(result, this.getQuery(queryId).document, variables, fetchMoreForQueryId, errorPolicy === 'ignore' || errorPolicy === 'all'); - } - }; - - QueryManager.prototype.queryListenerForObserver = function (queryId, options, observer) { - var _this = this; - - function invoke(method, argument) { - if (observer[method]) { - try { - observer[method](argument); - } catch (e) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error(e); - } - } else if (method === 'error') { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.error(argument); - } - } - - return function (queryStoreValue, newData) { - _this.invalidate(queryId, false); - - if (!queryStoreValue) return; - - var _a = _this.getQuery(queryId), - observableQuery = _a.observableQuery, - document = _a.document; - - var fetchPolicy = observableQuery ? observableQuery.options.fetchPolicy : options.fetchPolicy; - if (fetchPolicy === 'standby') return; - var loading = isNetworkRequestInFlight(queryStoreValue.networkStatus); - var lastResult = observableQuery && observableQuery.getLastResult(); - var networkStatusChanged = !!(lastResult && lastResult.networkStatus !== queryStoreValue.networkStatus); - var shouldNotifyIfLoading = options.returnPartialData || !newData && queryStoreValue.previousVariables || networkStatusChanged && options.notifyOnNetworkStatusChange || fetchPolicy === 'cache-only' || fetchPolicy === 'cache-and-network'; - - if (loading && !shouldNotifyIfLoading) { - return; - } - - var hasGraphQLErrors = isNonEmptyArray(queryStoreValue.graphQLErrors); - var errorPolicy = observableQuery && observableQuery.options.errorPolicy || options.errorPolicy || 'none'; - - if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) { - return invoke('error', new ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError - })); - } - - try { - var data = void 0; - var isMissing = void 0; - - if (newData) { - if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') { - _this.setQuery(queryId, function () { - return { - newData: null - }; - }); - } - - data = newData.result; - isMissing = !newData.complete; - } else { - var lastError = observableQuery && observableQuery.getLastError(); - var errorStatusChanged = errorPolicy !== 'none' && (lastError && lastError.graphQLErrors) !== queryStoreValue.graphQLErrors; - - if (lastResult && lastResult.data && !errorStatusChanged) { - data = lastResult.data; - isMissing = false; - } else { - var diffResult = _this.dataStore.getCache().diff({ - query: document, - variables: queryStoreValue.previousVariables || queryStoreValue.variables, - returnPartialData: true, - optimistic: true - }); - - data = diffResult.result; - isMissing = !diffResult.complete; - } - } - - var stale = isMissing && !(options.returnPartialData || fetchPolicy === 'cache-only'); - var resultFromStore = { - data: stale ? lastResult && lastResult.data : data, - loading: loading, - networkStatus: queryStoreValue.networkStatus, - stale: stale - }; - - if (errorPolicy === 'all' && hasGraphQLErrors) { - resultFromStore.errors = queryStoreValue.graphQLErrors; - } - - invoke('next', resultFromStore); - } catch (networkError) { - invoke('error', new ApolloError({ - networkError: networkError - })); - } - }; - }; - - QueryManager.prototype.transform = function (document) { - var transformCache = this.transformCache; - - if (!transformCache.has(document)) { - var cache = this.dataStore.getCache(); - var transformed = cache.transformDocument(document); - var forLink = (0, _apolloUtilities.removeConnectionDirectiveFromDocument)(cache.transformForLink(transformed)); - var clientQuery = this.localState.clientQuery(transformed); - var serverQuery = this.localState.serverQuery(forLink); - var cacheEntry_1 = { - document: transformed, - hasClientExports: (0, _apolloUtilities.hasClientExports)(transformed), - hasForcedResolvers: this.localState.shouldForceResolvers(transformed), - clientQuery: clientQuery, - serverQuery: serverQuery, - defaultVars: (0, _apolloUtilities.getDefaultValues)((0, _apolloUtilities.getOperationDefinition)(transformed)) - }; - - var add = function (doc) { - if (doc && !transformCache.has(doc)) { - transformCache.set(doc, cacheEntry_1); - } - }; - - add(document); - add(transformed); - add(clientQuery); - add(serverQuery); - } - - return transformCache.get(document); - }; - - QueryManager.prototype.getVariables = function (document, variables) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, this.transform(document).defaultVars), variables); - }; - - QueryManager.prototype.watchQuery = function (options, shouldSubscribe) { - if (shouldSubscribe === void 0) { - shouldSubscribe = true; - } - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.fetchPolicy !== 'standby', 11) : (0, _tsInvariant.invariant)(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); - options.variables = this.getVariables(options.query, options.variables); - - if (typeof options.notifyOnNetworkStatusChange === 'undefined') { - options.notifyOnNetworkStatusChange = false; - } - - var transformedOptions = (0, _tslib.__assign)({}, options); - return new ObservableQuery({ - queryManager: this, - options: transformedOptions, - shouldSubscribe: shouldSubscribe - }); - }; - - QueryManager.prototype.query = function (options) { - var _this = this; - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.query, 12) : (0, _tsInvariant.invariant)(options.query, 'query option is required. You must specify your GraphQL document ' + 'in the query option.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.query.kind === 'Document', 13) : (0, _tsInvariant.invariant)(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!options.returnPartialData, 14) : (0, _tsInvariant.invariant)(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!options.pollInterval, 15) : (0, _tsInvariant.invariant)(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); - return new Promise(function (resolve, reject) { - var watchedQuery = _this.watchQuery(options, false); - - _this.fetchQueryRejectFns.set("query:" + watchedQuery.queryId, reject); - - watchedQuery.result().then(resolve, reject).then(function () { - return _this.fetchQueryRejectFns.delete("query:" + watchedQuery.queryId); - }); - }); - }; - - QueryManager.prototype.generateQueryId = function () { - return String(this.idCounter++); - }; - - QueryManager.prototype.stopQueryInStore = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.broadcastQueries(); - }; - - QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { - this.stopPollingQuery(queryId); - this.queryStore.stopQuery(queryId); - this.invalidate(queryId); - }; - - QueryManager.prototype.addQueryListener = function (queryId, listener) { - this.setQuery(queryId, function (_a) { - var listeners = _a.listeners; - listeners.add(listener); - return { - invalidated: false - }; - }); - }; - - QueryManager.prototype.updateQueryWatch = function (queryId, document, options) { - var _this = this; - - var cancel = this.getQuery(queryId).cancel; - if (cancel) cancel(); - - var previousResult = function () { - var previousResult = null; - - var observableQuery = _this.getQuery(queryId).observableQuery; - - if (observableQuery) { - var lastResult = observableQuery.getLastResult(); - - if (lastResult) { - previousResult = lastResult.data; - } - } - - return previousResult; - }; - - return this.dataStore.getCache().watch({ - query: document, - variables: options.variables, - optimistic: true, - previousResult: previousResult, - callback: function (newData) { - _this.setQuery(queryId, function () { - return { - invalidated: true, - newData: newData - }; - }); - } - }); - }; - - QueryManager.prototype.addObservableQuery = function (queryId, observableQuery) { - this.setQuery(queryId, function () { - return { - observableQuery: observableQuery - }; - }); - }; - - QueryManager.prototype.removeObservableQuery = function (queryId) { - var cancel = this.getQuery(queryId).cancel; - this.setQuery(queryId, function () { - return { - observableQuery: null - }; - }); - if (cancel) cancel(); - }; - - QueryManager.prototype.clearStore = function () { - this.fetchQueryRejectFns.forEach(function (reject) { - reject(process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(16) : new _tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)')); - }); - var resetIds = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) resetIds.push(queryId); - }); - this.queryStore.reset(resetIds); - this.mutationStore.reset(); - return this.dataStore.reset(); - }; - - QueryManager.prototype.resetStore = function () { - var _this = this; - - return this.clearStore().then(function () { - return _this.reFetchObservableQueries(); - }); - }; - - QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { - var _this = this; - - if (includeStandby === void 0) { - includeStandby = false; - } - - var observableQueryPromises = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - - if (observableQuery) { - var fetchPolicy = observableQuery.options.fetchPolicy; - observableQuery.resetLastResults(); - - if (fetchPolicy !== 'cache-only' && (includeStandby || fetchPolicy !== 'standby')) { - observableQueryPromises.push(observableQuery.refetch()); - } - - _this.setQuery(queryId, function () { - return { - newData: null - }; - }); - - _this.invalidate(queryId); - } - }); - this.broadcastQueries(); - return Promise.all(observableQueryPromises); - }; - - QueryManager.prototype.observeQuery = function (queryId, options, observer) { - this.addQueryListener(queryId, this.queryListenerForObserver(queryId, options, observer)); - return this.fetchQuery(queryId, options); - }; - - QueryManager.prototype.startQuery = function (queryId, options, listener) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn("The QueryManager.startQuery method has been deprecated"); - this.addQueryListener(queryId, listener); - this.fetchQuery(queryId, options).catch(function () { - return undefined; - }); - return queryId; - }; - - QueryManager.prototype.startGraphQLSubscription = function (_a) { - var _this = this; - - var query = _a.query, - fetchPolicy = _a.fetchPolicy, - variables = _a.variables; - query = this.transform(query).document; - variables = this.getVariables(query, variables); - - var makeObservable = function (variables) { - return _this.getObservableFromLink(query, {}, variables, false).map(function (result) { - if (!fetchPolicy || fetchPolicy !== 'no-cache') { - _this.dataStore.markSubscriptionResult(result, query, variables); - - _this.broadcastQueries(); - } - - if ((0, _apolloUtilities.graphQLResultHasError)(result)) { - throw new ApolloError({ - graphQLErrors: result.errors - }); - } - - return result; - }); - }; - - if (this.transform(query).hasClientExports) { - var observablePromise_1 = this.localState.addExportedVariables(query, variables).then(makeObservable); - return new Observable(function (observer) { - var sub = null; - observablePromise_1.then(function (observable) { - return sub = observable.subscribe(observer); - }, observer.error); - return function () { - return sub && sub.unsubscribe(); - }; - }); - } - - return makeObservable(variables); - }; - - QueryManager.prototype.stopQuery = function (queryId) { - this.stopQueryNoBroadcast(queryId); - this.broadcastQueries(); - }; - - QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.removeQuery(queryId); - }; - - QueryManager.prototype.removeQuery = function (queryId) { - this.fetchQueryRejectFns.delete("query:" + queryId); - this.fetchQueryRejectFns.delete("fetchRequest:" + queryId); - this.getQuery(queryId).subscriptions.forEach(function (x) { - return x.unsubscribe(); - }); - this.queries.delete(queryId); - }; - - QueryManager.prototype.getCurrentQueryResult = function (observableQuery, optimistic) { - if (optimistic === void 0) { - optimistic = true; - } - - var _a = observableQuery.options, - variables = _a.variables, - query = _a.query, - fetchPolicy = _a.fetchPolicy, - returnPartialData = _a.returnPartialData; - var lastResult = observableQuery.getLastResult(); - var newData = this.getQuery(observableQuery.queryId).newData; - - if (newData && newData.complete) { - return { - data: newData.result, - partial: false - }; - } - - if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') { - return { - data: undefined, - partial: false - }; - } - - var _b = this.dataStore.getCache().diff({ - query: query, - variables: variables, - previousResult: lastResult ? lastResult.data : undefined, - returnPartialData: true, - optimistic: optimistic - }), - result = _b.result, - complete = _b.complete; - - return { - data: complete || returnPartialData ? result : void 0, - partial: !complete - }; - }; - - QueryManager.prototype.getQueryWithPreviousResult = function (queryIdOrObservable) { - var observableQuery; - - if (typeof queryIdOrObservable === 'string') { - var foundObserveableQuery = this.getQuery(queryIdOrObservable).observableQuery; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(foundObserveableQuery, 17) : (0, _tsInvariant.invariant)(foundObserveableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); - observableQuery = foundObserveableQuery; - } else { - observableQuery = queryIdOrObservable; - } - - var _a = observableQuery.options, - variables = _a.variables, - query = _a.query; - return { - previousResult: this.getCurrentQueryResult(observableQuery, false).data, - variables: variables, - document: query - }; - }; - - QueryManager.prototype.broadcastQueries = function () { - var _this = this; - - this.onBroadcast(); - this.queries.forEach(function (info, id) { - if (info.invalidated) { - info.listeners.forEach(function (listener) { - if (listener) { - listener(_this.queryStore.get(id), info.newData); - } - }); - } - }); - }; - - QueryManager.prototype.getLocalState = function () { - return this.localState; - }; - - QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { - var _this = this; - - if (deduplication === void 0) { - deduplication = this.queryDeduplication; - } - - var observable; - var serverQuery = this.transform(query).serverQuery; - - if (serverQuery) { - var _a = this, - inFlightLinkObservables_1 = _a.inFlightLinkObservables, - link = _a.link; - - var operation = { - query: serverQuery, - variables: variables, - operationName: (0, _apolloUtilities.getOperationName)(serverQuery) || void 0, - context: this.prepareContext((0, _tslib.__assign)((0, _tslib.__assign)({}, context), { - forceFetch: !deduplication - })) - }; - context = operation.context; - - if (deduplication) { - var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); - inFlightLinkObservables_1.set(serverQuery, byVariables_1); - var varJson_1 = JSON.stringify(variables); - observable = byVariables_1.get(varJson_1); - - if (!observable) { - byVariables_1.set(varJson_1, observable = multiplex((0, _apolloLink.execute)(link, operation))); - - var cleanup = function () { - byVariables_1.delete(varJson_1); - if (!byVariables_1.size) inFlightLinkObservables_1.delete(serverQuery); - cleanupSub_1.unsubscribe(); - }; - - var cleanupSub_1 = observable.subscribe({ - next: cleanup, - error: cleanup, - complete: cleanup - }); - } - } else { - observable = multiplex((0, _apolloLink.execute)(link, operation)); - } - } else { - observable = Observable.of({ - data: {} - }); - context = this.prepareContext(context); - } - - var clientQuery = this.transform(query).clientQuery; - - if (clientQuery) { - observable = asyncMap(observable, function (result) { - return _this.localState.runResolvers({ - document: clientQuery, - remoteResult: result, - context: context, - variables: variables - }); - }); - } - - return observable; - }; - - QueryManager.prototype.fetchRequest = function (_a) { - var _this = this; - - var requestId = _a.requestId, - queryId = _a.queryId, - document = _a.document, - options = _a.options, - fetchMoreForQueryId = _a.fetchMoreForQueryId; - var variables = options.variables, - _b = options.errorPolicy, - errorPolicy = _b === void 0 ? 'none' : _b, - fetchPolicy = options.fetchPolicy; - var resultFromStore; - var errorsFromStore; - return new Promise(function (resolve, reject) { - var observable = _this.getObservableFromLink(document, options.context, variables); - - var fqrfId = "fetchRequest:" + queryId; - - _this.fetchQueryRejectFns.set(fqrfId, reject); - - var cleanup = function () { - _this.fetchQueryRejectFns.delete(fqrfId); - - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.delete(subscription); - }); - }; - - var subscription = observable.map(function (result) { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - - _this.queryStore.markQueryResult(queryId, result, fetchMoreForQueryId); - - _this.invalidate(queryId); - - _this.invalidate(fetchMoreForQueryId); - - _this.broadcastQueries(); - } - - if (errorPolicy === 'none' && isNonEmptyArray(result.errors)) { - return reject(new ApolloError({ - graphQLErrors: result.errors - })); - } - - if (errorPolicy === 'all') { - errorsFromStore = result.errors; - } - - if (fetchMoreForQueryId || fetchPolicy === 'no-cache') { - resultFromStore = result.data; - } else { - var _a = _this.dataStore.getCache().diff({ - variables: variables, - query: document, - optimistic: false, - returnPartialData: true - }), - result_1 = _a.result, - complete = _a.complete; - - if (complete || options.returnPartialData) { - resultFromStore = result_1; - } - } - }).subscribe({ - error: function (error) { - cleanup(); - reject(error); - }, - complete: function () { - cleanup(); - resolve({ - data: resultFromStore, - errors: errorsFromStore, - loading: false, - networkStatus: NetworkStatus.ready, - stale: false - }); - } - }); - - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.add(subscription); - }); - }); - }; - - QueryManager.prototype.getQuery = function (queryId) { - return this.queries.get(queryId) || { - listeners: new Set(), - invalidated: false, - document: null, - newData: null, - lastRequestId: 1, - observableQuery: null, - subscriptions: new Set() - }; - }; - - QueryManager.prototype.setQuery = function (queryId, updater) { - var prev = this.getQuery(queryId); - var newInfo = (0, _tslib.__assign)((0, _tslib.__assign)({}, prev), updater(prev)); - this.queries.set(queryId, newInfo); - }; - - QueryManager.prototype.invalidate = function (queryId, invalidated) { - if (invalidated === void 0) { - invalidated = true; - } - - if (queryId) { - this.setQuery(queryId, function () { - return { - invalidated: invalidated - }; - }); - } - }; - - QueryManager.prototype.prepareContext = function (context) { - if (context === void 0) { - context = {}; - } - - var newContext = this.localState.prepareContext(context); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, newContext), { - clientAwareness: this.clientAwareness - }); - }; - - QueryManager.prototype.checkInFlight = function (queryId) { - var query = this.queryStore.get(queryId); - return query && query.networkStatus !== NetworkStatus.ready && query.networkStatus !== NetworkStatus.error; - }; - - QueryManager.prototype.startPollingQuery = function (options, queryId, listener) { - var _this = this; - - var pollInterval = options.pollInterval; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(pollInterval, 18) : (0, _tsInvariant.invariant)(pollInterval, 'Attempted to start a polling query without a polling interval.'); - - if (!this.ssrMode) { - var info = this.pollingInfoByQueryId.get(queryId); - - if (!info) { - this.pollingInfoByQueryId.set(queryId, info = {}); - } - - info.interval = pollInterval; - info.options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - fetchPolicy: 'network-only' - }); - - var maybeFetch_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - - if (info) { - if (_this.checkInFlight(queryId)) { - poll_1(); - } else { - _this.fetchQuery(queryId, info.options, FetchType.poll).then(poll_1, poll_1); - } - } - }; - - var poll_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - - if (info) { - clearTimeout(info.timeout); - info.timeout = setTimeout(maybeFetch_1, info.interval); - } - }; - - if (listener) { - this.addQueryListener(queryId, listener); - } - - poll_1(); - } - - return queryId; - }; - - QueryManager.prototype.stopPollingQuery = function (queryId) { - this.pollingInfoByQueryId.delete(queryId); - }; - - return QueryManager; - }(); - - var DataStore = function () { - function DataStore(initialCache) { - this.cache = initialCache; - } - - DataStore.prototype.getCache = function () { - return this.cache; - }; - - DataStore.prototype.markQueryResult = function (result, document, variables, fetchMoreForQueryId, ignoreErrors) { - if (ignoreErrors === void 0) { - ignoreErrors = false; - } - - var writeWithErrors = !(0, _apolloUtilities.graphQLResultHasError)(result); - - if (ignoreErrors && (0, _apolloUtilities.graphQLResultHasError)(result) && result.data) { - writeWithErrors = true; - } - - if (!fetchMoreForQueryId && writeWithErrors) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_QUERY', - query: document, - variables: variables - }); - } - }; - - DataStore.prototype.markSubscriptionResult = function (result, document, variables) { - if (!(0, _apolloUtilities.graphQLResultHasError)(result)) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_SUBSCRIPTION', - query: document, - variables: variables - }); - } - }; - - DataStore.prototype.markMutationInit = function (mutation) { - var _this = this; - - if (mutation.optimisticResponse) { - var optimistic_1; - - if (typeof mutation.optimisticResponse === 'function') { - optimistic_1 = mutation.optimisticResponse(mutation.variables); - } else { - optimistic_1 = mutation.optimisticResponse; - } - - this.cache.recordOptimisticTransaction(function (c) { - var orig = _this.cache; - _this.cache = c; - - try { - _this.markMutationResult({ - mutationId: mutation.mutationId, - result: { - data: optimistic_1 - }, - document: mutation.document, - variables: mutation.variables, - updateQueries: mutation.updateQueries, - update: mutation.update - }); - } finally { - _this.cache = orig; - } - }, mutation.mutationId); - } - }; - - DataStore.prototype.markMutationResult = function (mutation) { - var _this = this; - - if (!(0, _apolloUtilities.graphQLResultHasError)(mutation.result)) { - var cacheWrites_1 = [{ - result: mutation.result.data, - dataId: 'ROOT_MUTATION', - query: mutation.document, - variables: mutation.variables - }]; - var updateQueries_1 = mutation.updateQueries; - - if (updateQueries_1) { - Object.keys(updateQueries_1).forEach(function (id) { - var _a = updateQueries_1[id], - query = _a.query, - updater = _a.updater; - - var _b = _this.cache.diff({ - query: query.document, - variables: query.variables, - returnPartialData: true, - optimistic: false - }), - currentQueryResult = _b.result, - complete = _b.complete; - - if (complete) { - var nextQueryResult = (0, _apolloUtilities.tryFunctionOrLogError)(function () { - return updater(currentQueryResult, { - mutationResult: mutation.result, - queryName: (0, _apolloUtilities.getOperationName)(query.document) || undefined, - queryVariables: query.variables - }); - }); - - if (nextQueryResult) { - cacheWrites_1.push({ - result: nextQueryResult, - dataId: 'ROOT_QUERY', - query: query.document, - variables: query.variables - }); - } - } - }); - } - - this.cache.performTransaction(function (c) { - cacheWrites_1.forEach(function (write) { - return c.write(write); - }); - var update = mutation.update; - - if (update) { - (0, _apolloUtilities.tryFunctionOrLogError)(function () { - return update(c, mutation.result); - }); - } - }); - } - }; - - DataStore.prototype.markMutationComplete = function (_a) { - var mutationId = _a.mutationId, - optimisticResponse = _a.optimisticResponse; - - if (optimisticResponse) { - this.cache.removeOptimistic(mutationId); - } - }; - - DataStore.prototype.markUpdateQueryResult = function (document, variables, newResult) { - this.cache.write({ - result: newResult, - dataId: 'ROOT_QUERY', - variables: variables, - query: document - }); - }; - - DataStore.prototype.reset = function () { - return this.cache.reset(); - }; - - return DataStore; - }(); - - var version = "2.6.10"; - var hasSuggestedDevtools = false; - - var ApolloClient = function () { - function ApolloClient(options) { - var _this = this; - - this.defaultOptions = {}; - this.resetStoreCallbacks = []; - this.clearStoreCallbacks = []; - var cache = options.cache, - _a = options.ssrMode, - ssrMode = _a === void 0 ? false : _a, - _b = options.ssrForceFetchDelay, - ssrForceFetchDelay = _b === void 0 ? 0 : _b, - connectToDevTools = options.connectToDevTools, - _c = options.queryDeduplication, - queryDeduplication = _c === void 0 ? true : _c, - defaultOptions = options.defaultOptions, - _d = options.assumeImmutableResults, - assumeImmutableResults = _d === void 0 ? false : _d, - resolvers = options.resolvers, - typeDefs = options.typeDefs, - fragmentMatcher = options.fragmentMatcher, - clientAwarenessName = options.name, - clientAwarenessVersion = options.version; - var link = options.link; - - if (!link && resolvers) { - link = _apolloLink.ApolloLink.empty(); - } - - if (!link || !cache) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(4) : new _tsInvariant.InvariantError("In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\n" + "These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\n" + "For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup"); - } - - this.link = link; - this.cache = cache; - this.store = new DataStore(cache); - this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; - this.queryDeduplication = queryDeduplication; - this.defaultOptions = defaultOptions || {}; - this.typeDefs = typeDefs; - - if (ssrForceFetchDelay) { - setTimeout(function () { - return _this.disableNetworkFetches = false; - }, ssrForceFetchDelay); - } - - this.watchQuery = this.watchQuery.bind(this); - this.query = this.query.bind(this); - this.mutate = this.mutate.bind(this); - this.resetStore = this.resetStore.bind(this); - this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); - var defaultConnectToDevTools = process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && !window.__APOLLO_CLIENT__; - - if (typeof connectToDevTools === 'undefined' ? defaultConnectToDevTools : connectToDevTools && typeof window !== 'undefined') { - window.__APOLLO_CLIENT__ = this; - } - - if (!hasSuggestedDevtools && process.env.NODE_ENV !== 'production') { - hasSuggestedDevtools = true; - - if (typeof window !== 'undefined' && window.document && window.top === window.self) { - if (typeof window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - if (window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf('Chrome') > -1) { - console.debug('Download the Apollo DevTools ' + 'for a better development experience: ' + 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm'); - } - } - } - } - - this.version = version; - this.localState = new LocalState({ - cache: cache, - client: this, - resolvers: resolvers, - fragmentMatcher: fragmentMatcher - }); - this.queryManager = new QueryManager({ - link: this.link, - store: this.store, - queryDeduplication: queryDeduplication, - ssrMode: ssrMode, - clientAwareness: { - name: clientAwarenessName, - version: clientAwarenessVersion - }, - localState: this.localState, - assumeImmutableResults: assumeImmutableResults, - onBroadcast: function () { - if (_this.devToolsHookCb) { - _this.devToolsHookCb({ - action: {}, - state: { - queries: _this.queryManager.queryStore.getStore(), - mutations: _this.queryManager.mutationStore.getStore() - }, - dataWithOptimisticResults: _this.cache.extract(true) - }); - } - } - }); - } - - ApolloClient.prototype.stop = function () { - this.queryManager.stop(); - }; - - ApolloClient.prototype.watchQuery = function (options) { - if (this.defaultOptions.watchQuery) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.defaultOptions.watchQuery), options); - } - - if (this.disableNetworkFetches && (options.fetchPolicy === 'network-only' || options.fetchPolicy === 'cache-and-network')) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - fetchPolicy: 'cache-first' - }); - } - - return this.queryManager.watchQuery(options); - }; - - ApolloClient.prototype.query = function (options) { - if (this.defaultOptions.query) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.defaultOptions.query), options); - } - - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(options.fetchPolicy !== 'cache-and-network', 5) : (0, _tsInvariant.invariant)(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + 'client.query can only return a single result. Please use client.watchQuery ' + 'to receive multiple results from the cache and the network, or consider ' + 'using a different fetchPolicy, such as cache-first or network-only.'); - - if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - fetchPolicy: 'cache-first' - }); - } - - return this.queryManager.query(options); - }; - - ApolloClient.prototype.mutate = function (options) { - if (this.defaultOptions.mutate) { - options = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.defaultOptions.mutate), options); - } - - return this.queryManager.mutate(options); - }; - - ApolloClient.prototype.subscribe = function (options) { - return this.queryManager.startGraphQLSubscription(options); - }; - - ApolloClient.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.cache.readQuery(options, optimistic); - }; - - ApolloClient.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { - optimistic = false; - } - - return this.cache.readFragment(options, optimistic); - }; - - ApolloClient.prototype.writeQuery = function (options) { - var result = this.cache.writeQuery(options); - this.queryManager.broadcastQueries(); - return result; - }; - - ApolloClient.prototype.writeFragment = function (options) { - var result = this.cache.writeFragment(options); - this.queryManager.broadcastQueries(); - return result; - }; - - ApolloClient.prototype.writeData = function (options) { - var result = this.cache.writeData(options); - this.queryManager.broadcastQueries(); - return result; - }; - - ApolloClient.prototype.__actionHookForDevTools = function (cb) { - this.devToolsHookCb = cb; - }; - - ApolloClient.prototype.__requestRaw = function (payload) { - return (0, _apolloLink.execute)(this.link, payload); - }; - - ApolloClient.prototype.initQueryManager = function () { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Calling the initQueryManager method is no longer necessary, ' + 'and it will be removed from ApolloClient in version 3.0.'); - return this.queryManager; - }; - - ApolloClient.prototype.resetStore = function () { - var _this = this; - - return Promise.resolve().then(function () { - return _this.queryManager.clearStore(); - }).then(function () { - return Promise.all(_this.resetStoreCallbacks.map(function (fn) { - return fn(); - })); - }).then(function () { - return _this.reFetchObservableQueries(); - }); - }; - - ApolloClient.prototype.clearStore = function () { - var _this = this; - - return Promise.resolve().then(function () { - return _this.queryManager.clearStore(); - }).then(function () { - return Promise.all(_this.clearStoreCallbacks.map(function (fn) { - return fn(); - })); - }); - }; - - ApolloClient.prototype.onResetStore = function (cb) { - var _this = this; - - this.resetStoreCallbacks.push(cb); - return function () { - _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { - return c !== cb; - }); - }; - }; - - ApolloClient.prototype.onClearStore = function (cb) { - var _this = this; - - this.clearStoreCallbacks.push(cb); - return function () { - _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { - return c !== cb; - }); - }; - }; - - ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { - return this.queryManager.reFetchObservableQueries(includeStandby); - }; - - ApolloClient.prototype.extract = function (optimistic) { - return this.cache.extract(optimistic); - }; - - ApolloClient.prototype.restore = function (serializedState) { - return this.cache.restore(serializedState); - }; - - ApolloClient.prototype.addResolvers = function (resolvers) { - this.localState.addResolvers(resolvers); - }; - - ApolloClient.prototype.setResolvers = function (resolvers) { - this.localState.setResolvers(resolvers); - }; - - ApolloClient.prototype.getResolvers = function () { - return this.localState.getResolvers(); - }; - - ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { - this.localState.setFragmentMatcher(fragmentMatcher); - }; - - return ApolloClient; - }(); - - _exports.ApolloClient = ApolloClient; - var _default = ApolloClient; - - _exports.default = _default; -}); diff --git a/node_modules/apollo-client/bundle.umd.js.map b/node_modules/apollo-client/bundle.umd.js.map deleted file mode 100644 index f4c2971b..00000000 --- a/node_modules/apollo-client/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/core/networkStatus.ts","../src/util/Observable.ts","../src/util/arrays.ts","../src/errors/ApolloError.ts","../src/core/types.ts","../src/core/ObservableQuery.ts","../src/data/mutations.ts","../src/data/queries.ts","../src/util/capitalizeFirstLetter.ts","../src/core/LocalState.ts","../src/util/observables.ts","../src/core/QueryManager.ts","../src/data/store.ts","../src/version.ts","../src/ApolloClient.ts"],"names":["LinkObservable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;MAGY,a;;;AAAZ,GAAA,UAAY,aAAZ,EAAyB;AAMvB,IAAA,aAAA,CAAA,aAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AAMA,IAAA,aAAA,CAAA,aAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA;AAMA,IAAA,aAAA,CAAA,aAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAA;AAMA,IAAA,aAAA,CAAA,aAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AAOA,IAAA,aAAA,CAAA,aAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA;AAKA,IAAA,aAAA,CAAA,aAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA;AAKA,IAAA,aAAA,CAAA,aAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA;AACD,GA1CD,EAAY,aAAa,8BAAb,aAAa,GAAA,EAAA,CAAzB;;AAgDA,WAAgB,wBAAhB,CACE,aADF,EAC8B;AAE5B,WAAO,aAAa,GAAG,CAAvB;AACD;;AC7CD,MAAA,UAAA,GAAA,UAAA,MAAA,EAAA;AAAmCA,0BAAAA,UAAAA,EAAAA,MAAAA;;AAAnC,aAAA,UAAA,GAAA;;AAQC;;AAPQ,IAAA,UAAA,CAAA,SAAA,CAAC,yBAAD,IAAP,YAAA;AACE,aAAO,IAAP;AACD,KAFM;;AAIA,IAAA,UAAA,CAAA,SAAA,CAAC,c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D,KAFM;;AAWA,IAAA,YAAA,CAAA,SAAA,CAAA,OAAA,GAAP,UAAe,eAAf,EAA2C;AACzC,aAAO,KAAK,KAAL,CAAW,OAAX,CAAmB,eAAnB,CAAP;AACD,KAFM;;AAOA,IAAA,YAAA,CAAA,SAAA,CAAA,YAAA,GAAP,UAAoB,SAApB,EAAsD;AACpD,WAAK,UAAL,CAAgB,YAAhB,CAA6B,SAA7B;AACD,KAFM;;AAOA,IAAA,YAAA,CAAA,SAAA,CAAA,YAAA,GAAP,UAAoB,SAApB,EAAsD;AACpD,WAAK,UAAL,CAAgB,YAAhB,CAA6B,SAA7B;AACD,KAFM;;AAOA,IAAA,YAAA,CAAA,SAAA,CAAA,YAAA,GAAP,YAAA;AACE,aAAO,KAAK,UAAL,CAAgB,YAAhB,EAAP;AACD,KAFM;;AAOA,IAAA,YAAA,CAAA,SAAA,CAAA,4BAAA,GAAP,UAAoC,eAApC,EAAoE;AAClE,WAAK,UAAL,CAAgB,kBAAhB,CAAmC,eAAnC;AACD,KAFM;;AAGT,WAAA,YAAA;AAAC,GA3gBD,EAAA","sourcesContent":["/**\n * The current status of a query’s execution in our system.\n */\nexport enum NetworkStatus {\n /**\n * The query has never been run before and the query is now currently running. A query will still\n * have this network status even if a partial data result was returned from the cache, but a\n * query was dispatched anyway.\n */\n loading = 1,\n\n /**\n * If `setVariables` was called and a query was fired because of that then the network status\n * will be `setVariables` until the result of that query comes back.\n */\n setVariables = 2,\n\n /**\n * Indicates that `fetchMore` was called on this query and that the query created is currently in\n * flight.\n */\n fetchMore = 3,\n\n /**\n * Similar to the `setVariables` network status. It means that `refetch` was called on a query\n * and the refetch request is currently in flight.\n */\n refetch = 4,\n\n /**\n * Indicates that a polling query is currently in flight. So for example if you are polling a\n * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever\n * a poll request has been sent but not resolved.\n */\n poll = 6,\n\n /**\n * No request is in flight for this query, and no errors happened. Everything is OK.\n */\n ready = 7,\n\n /**\n * No request is in flight for this query, but one or more errors were detected.\n */\n error = 8,\n}\n\n/**\n * Returns true if there is currently a network request in flight according to a given network\n * status.\n */\nexport function isNetworkRequestInFlight(\n networkStatus: NetworkStatus,\n): boolean {\n return networkStatus < 7;\n}\n","// This simplified polyfill attempts to follow the ECMAScript Observable proposal.\n// See https://github.com/zenparsing/es-observable\nimport { Observable as LinkObservable } from 'apollo-link';\n\nexport type Subscription = ZenObservable.Subscription;\nexport type Observer = ZenObservable.Observer;\n\nimport $$observable from 'symbol-observable';\n\n// rxjs interopt\nexport class Observable extends LinkObservable {\n public [$$observable]() {\n return this;\n }\n\n public ['@@observable' as any]() {\n return this;\n }\n}\n","export function isNonEmptyArray(value?: ArrayLike): value is Array {\n return Array.isArray(value) && value.length > 0;\n}\n","import { GraphQLError } from 'graphql';\nimport { isNonEmptyArray } from '../util/arrays';\n\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty('graphQLErrors');\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n let message = '';\n // If we have GraphQL errors present, add that to the error message.\n if (isNonEmptyArray(err.graphQLErrors)) {\n err.graphQLErrors.forEach((graphQLError: GraphQLError) => {\n const errorMessage = graphQLError\n ? graphQLError.message\n : 'Error message not found.';\n message += `GraphQL error: ${errorMessage}\\n`;\n });\n }\n\n if (err.networkError) {\n message += 'Network error: ' + err.networkError.message + '\\n';\n }\n\n // strip newline from the end of the message\n message = message.replace(/\\n$/, '');\n return message;\n};\n\nexport class ApolloError extends Error {\n public message: string;\n public graphQLErrors: ReadonlyArray;\n public networkError: Error | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: {\n graphQLErrors?: ReadonlyArray;\n networkError?: Error | null;\n errorMessage?: string;\n extraInfo?: any;\n }) {\n super(errorMessage);\n this.graphQLErrors = graphQLErrors || [];\n this.networkError = networkError || null;\n\n if (!errorMessage) {\n this.message = generateErrorMessage(this);\n } else {\n this.message = errorMessage;\n }\n\n this.extraInfo = extraInfo;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n","import { FetchResult } from 'apollo-link';\nimport { DocumentNode, GraphQLError } from 'graphql';\n\nimport { QueryStoreValue } from '../data/queries';\nimport { NetworkStatus } from './networkStatus';\nimport { Resolver } from './LocalState';\n\nexport type QueryListener = (\n queryStoreValue: QueryStoreValue,\n newData?: any,\n forceResolvers?: boolean,\n) => void;\n\nexport type OperationVariables = { [key: string]: any };\n\nexport type PureQueryOptions = {\n query: DocumentNode;\n variables?: { [key: string]: any };\n context?: any;\n};\n\nexport type ApolloQueryResult = {\n data: T;\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n stale: boolean;\n};\n\nexport enum FetchType {\n normal = 1,\n refetch = 2,\n poll = 3,\n}\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer = (\n previousResult: Record,\n options: {\n mutationResult: FetchResult;\n queryName: string | undefined;\n queryVariables: Record;\n },\n) => Record;\n\nexport type MutationQueryReducersMap = {\n [queryName: string]: MutationQueryReducer;\n};\n\nexport interface Resolvers {\n [key: string]: {\n [ field: string ]: Resolver;\n };\n}\n","import {\n isEqual,\n tryFunctionOrLogError,\n cloneDeep,\n getOperationDefinition,\n} from 'apollo-utilities';\nimport { GraphQLError } from 'graphql';\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport { Observable, Observer, Subscription } from '../util/Observable';\nimport { ApolloError } from '../errors/ApolloError';\nimport { QueryManager } from './QueryManager';\nimport { ApolloQueryResult, FetchType, OperationVariables } from './types';\nimport {\n WatchQueryOptions,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n ErrorPolicy,\n} from './watchQueryOptions';\n\nimport { QueryStoreValue } from '../data/queries';\n\nimport { invariant, InvariantError } from 'ts-invariant';\nimport { isNonEmptyArray } from '../util/arrays';\n\n// XXX remove in the next breaking semver change (3.0)\n// Deprecated, use ApolloCurrentQueryResult\nexport type ApolloCurrentResult = {\n data: T | {};\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n error?: ApolloError;\n partial?: boolean;\n};\n\nexport type ApolloCurrentQueryResult = {\n data: T | undefined;\n errors?: ReadonlyArray;\n loading: boolean;\n networkStatus: NetworkStatus;\n error?: ApolloError;\n partial?: boolean;\n stale?: boolean;\n};\n\nexport interface FetchMoreOptions<\n TData = any,\n TVariables = OperationVariables\n> {\n updateQuery: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult?: TData;\n variables?: TVariables;\n },\n ) => TData;\n}\n\nexport interface UpdateQueryOptions {\n variables?: TVariables;\n}\n\nexport const hasError = (\n storeValue: QueryStoreValue,\n policy: ErrorPolicy = 'none',\n) => storeValue && (\n storeValue.networkError ||\n (policy === 'none' && isNonEmptyArray(storeValue.graphQLErrors))\n);\n\nexport class ObservableQuery<\n TData = any,\n TVariables = OperationVariables\n> extends Observable> {\n public options: WatchQueryOptions;\n public readonly queryId: string;\n public readonly queryName?: string;\n /**\n *\n * The current value of the variables for this query. Can change.\n */\n public variables: TVariables;\n\n private shouldSubscribe: boolean;\n private isTornDown: boolean;\n private queryManager: QueryManager;\n private observers = new Set>>();\n private subscriptions = new Set();\n\n private lastResult: ApolloQueryResult;\n private lastResultSnapshot: ApolloQueryResult;\n private lastError: ApolloError;\n\n constructor({\n queryManager,\n options,\n shouldSubscribe = true,\n }: {\n queryManager: QueryManager;\n options: WatchQueryOptions;\n shouldSubscribe?: boolean;\n }) {\n super((observer: Observer>) =>\n this.onSubscribe(observer),\n );\n\n // active state\n this.isTornDown = false;\n\n // query information\n this.options = options;\n this.variables = options.variables || ({} as TVariables);\n this.queryId = queryManager.generateQueryId();\n this.shouldSubscribe = shouldSubscribe;\n\n const opDef = getOperationDefinition(options.query);\n this.queryName = opDef && opDef.name && opDef.name.value;\n\n // related classes\n this.queryManager = queryManager;\n }\n\n public result(): Promise> {\n return new Promise((resolve, reject) => {\n const observer: Observer> = {\n next: (result: ApolloQueryResult) => {\n resolve(result);\n\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n this.observers.delete(observer);\n if (!this.observers.size) {\n this.queryManager.removeQuery(this.queryId);\n }\n\n setTimeout(() => {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n const subscription = this.subscribe(observer);\n });\n }\n\n // XXX remove in the next breaking semver change (3.0)\n // Deprecated, use getCurrentResult()\n public currentResult(): ApolloCurrentResult {\n const result = this.getCurrentResult() as ApolloCurrentResult;\n if (result.data === undefined) {\n result.data = {};\n }\n return result;\n }\n\n /**\n * Return the result of the query from the local cache as well as some fetching status\n * `loading` and `networkStatus` allow to know if a request is in flight\n * `partial` lets you know if the result from the local cache is complete or partial\n * @return {data: Object, error: ApolloError, loading: boolean, networkStatus: number, partial: boolean}\n */\n public getCurrentResult(): ApolloCurrentQueryResult {\n if (this.isTornDown) {\n const { lastResult } = this;\n return {\n data: !this.lastError && lastResult && lastResult.data || void 0,\n error: this.lastError,\n loading: false,\n networkStatus: NetworkStatus.error,\n };\n }\n\n const { data, partial } = this.queryManager.getCurrentQueryResult(this);\n const queryStoreValue = this.queryManager.queryStore.get(this.queryId);\n let result: ApolloQueryResult;\n\n const { fetchPolicy } = this.options;\n\n const isNetworkFetchPolicy =\n fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache';\n\n if (queryStoreValue) {\n const { networkStatus } = queryStoreValue;\n\n if (hasError(queryStoreValue, this.options.errorPolicy)) {\n return {\n data: void 0,\n loading: false,\n networkStatus,\n error: new ApolloError({\n graphQLErrors: queryStoreValue.graphQLErrors,\n networkError: queryStoreValue.networkError,\n }),\n };\n }\n\n // Variables might have been added dynamically at query time, when\n // using `@client @export(as: \"varname\")` for example. When this happens,\n // the variables have been updated in the query store, but not updated on\n // the original `ObservableQuery`. We'll update the observable query\n // variables here to match, so retrieving from the cache doesn't fail.\n if (queryStoreValue.variables) {\n this.options.variables = {\n ...this.options.variables,\n ...(queryStoreValue.variables as TVariables),\n };\n this.variables = this.options.variables;\n }\n\n result = {\n data,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n } as ApolloQueryResult;\n\n if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') {\n result.errors = queryStoreValue.graphQLErrors;\n }\n\n } else {\n // We need to be careful about the loading state we show to the user, to try\n // and be vaguely in line with what the user would have seen from .subscribe()\n // but to still provide useful information synchronously when the query\n // will not end up hitting the server.\n // See more: https://github.com/apollostack/apollo-client/issues/707\n // Basically: is there a query in flight right now (modolo the next tick)?\n const loading = isNetworkFetchPolicy ||\n (partial && fetchPolicy !== 'cache-only');\n\n result = {\n data,\n loading,\n networkStatus: loading ? NetworkStatus.loading : NetworkStatus.ready,\n } as ApolloQueryResult;\n }\n\n if (!partial) {\n this.updateLastResult({ ...result, stale: false });\n }\n\n return { ...result, partial };\n }\n\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n public isDifferentFromLastResult(newResult: ApolloQueryResult) {\n const { lastResultSnapshot: snapshot } = this;\n return !(\n snapshot &&\n newResult &&\n snapshot.networkStatus === newResult.networkStatus &&\n snapshot.stale === newResult.stale &&\n isEqual(snapshot.data, newResult.data)\n );\n }\n\n // Returns the last result that observer.next was called with. This is not the same as\n // getCurrentResult! If you're not sure which you need, then you probably need getCurrentResult.\n public getLastResult(): ApolloQueryResult {\n return this.lastResult;\n }\n\n public getLastError(): ApolloError {\n return this.lastError;\n }\n\n public resetLastResults(): void {\n delete this.lastResult;\n delete this.lastResultSnapshot;\n delete this.lastError;\n this.isTornDown = false;\n }\n\n public resetQueryStoreErrors() {\n const queryStore = this.queryManager.queryStore.get(this.queryId);\n if (queryStore) {\n queryStore.networkError = null;\n queryStore.graphQLErrors = [];\n }\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public refetch(variables?: TVariables): Promise> {\n let { fetchPolicy } = this.options;\n // early return if trying to read from cache during refetch\n if (fetchPolicy === 'cache-only') {\n return Promise.reject(new InvariantError(\n 'cache-only fetchPolicy option should not be used together with query refetch.',\n ));\n }\n\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n if (fetchPolicy !== 'no-cache' &&\n fetchPolicy !== 'cache-and-network') {\n fetchPolicy = 'network-only';\n }\n\n if (!isEqual(this.variables, variables)) {\n // update observable variables\n this.variables = {\n ...this.variables,\n ...variables,\n };\n }\n\n if (!isEqual(this.options.variables, this.variables)) {\n // Update the existing options with new variables\n this.options.variables = {\n ...this.options.variables,\n ...this.variables,\n };\n }\n\n return this.queryManager.fetchQuery(\n this.queryId,\n { ...this.options, fetchPolicy },\n FetchType.refetch,\n ) as Promise>;\n }\n\n public fetchMore(\n fetchMoreOptions: FetchMoreQueryOptions &\n FetchMoreOptions,\n ): Promise> {\n // early return if no update Query\n invariant(\n fetchMoreOptions.updateQuery,\n 'updateQuery option is required. This function defines how to update the query data with the new results.',\n );\n\n const combinedOptions = {\n ...(fetchMoreOptions.query ? fetchMoreOptions : {\n ...this.options,\n ...fetchMoreOptions,\n variables: {\n ...this.variables,\n ...fetchMoreOptions.variables,\n },\n }),\n fetchPolicy: 'network-only',\n } as WatchQueryOptions;\n\n const qid = this.queryManager.generateQueryId();\n\n return this.queryManager\n .fetchQuery(\n qid,\n combinedOptions,\n FetchType.normal,\n this.queryId,\n )\n .then(\n fetchMoreResult => {\n this.updateQuery((previousResult: any) =>\n fetchMoreOptions.updateQuery(previousResult, {\n fetchMoreResult: fetchMoreResult.data as TData,\n variables: combinedOptions.variables as TVariables,\n }),\n );\n this.queryManager.stopQuery(qid);\n return fetchMoreResult as ApolloQueryResult;\n },\n error => {\n this.queryManager.stopQuery(qid);\n throw error;\n },\n );\n }\n\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n public subscribeToMore<\n TSubscriptionData = TData,\n TSubscriptionVariables = TVariables\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >,\n ) {\n const subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n })\n .subscribe({\n next: (subscriptionData: { data: TSubscriptionData }) => {\n const { updateQuery } = options;\n if (updateQuery) {\n this.updateQuery(\n (previous, { variables }) =>\n updateQuery(previous, {\n subscriptionData,\n variables,\n }),\n );\n }\n },\n error: (err: any) => {\n if (options.onError) {\n options.onError(err);\n return;\n }\n invariant.error('Unhandled GraphQL subscription error', err);\n },\n });\n\n this.subscriptions.add(subscription);\n\n return () => {\n if (this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n }\n\n // Note: if the query is not active (there are no subscribers), the promise\n // will return null immediately.\n public setOptions(\n opts: WatchQueryOptions,\n ): Promise | void> {\n const { fetchPolicy: oldFetchPolicy } = this.options;\n this.options = {\n ...this.options,\n ...opts,\n } as WatchQueryOptions;\n\n if (opts.pollInterval) {\n this.startPolling(opts.pollInterval);\n } else if (opts.pollInterval === 0) {\n this.stopPolling();\n }\n\n const { fetchPolicy } = opts;\n\n return this.setVariables(\n this.options.variables as TVariables,\n // Try to fetch the query if fetchPolicy changed from either cache-only\n // or standby to something else, or changed to network-only.\n oldFetchPolicy !== fetchPolicy && (\n oldFetchPolicy === 'cache-only' ||\n oldFetchPolicy === 'standby' ||\n fetchPolicy === 'network-only'\n ),\n opts.fetchResults,\n );\n }\n\n /**\n * This is for *internal* use only. Most users should instead use `refetch`\n * in order to be properly notified of results even when they come from cache.\n *\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. If you want to force new results, use `refetch`.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @private\n *\n * @param variables: The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n *\n * @param tryFetch: Try and fetch new results even if the variables haven't\n * changed (we may still just hit the store, but if there's nothing in there\n * this will refetch)\n *\n * @param fetchResults: Option to ignore fetching results when updating variables\n */\n public setVariables(\n variables: TVariables,\n tryFetch: boolean = false,\n fetchResults = true,\n ): Promise | void> {\n // since setVariables restarts the subscription, we reset the tornDown status\n this.isTornDown = false;\n\n variables = variables || this.variables;\n\n if (!tryFetch && isEqual(variables, this.variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size && fetchResults\n ? this.result()\n : Promise.resolve();\n }\n\n this.variables = this.options.variables = variables;\n\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n\n // Use the same options as before, but with new variables\n return this.queryManager.fetchQuery(\n this.queryId,\n this.options,\n ) as Promise>;\n }\n\n public updateQuery(\n mapFn: (\n previousQueryResult: TData,\n options: UpdateQueryOptions,\n ) => TData,\n ): void {\n const { queryManager } = this;\n const {\n previousResult,\n variables,\n document,\n } = queryManager.getQueryWithPreviousResult(\n this.queryId,\n );\n\n const newResult = tryFunctionOrLogError(() =>\n mapFn(previousResult, { variables }),\n );\n\n if (newResult) {\n queryManager.dataStore.markUpdateQueryResult(\n document,\n variables,\n newResult,\n );\n queryManager.broadcastQueries();\n }\n }\n\n public stopPolling() {\n this.queryManager.stopPollingQuery(this.queryId);\n this.options.pollInterval = undefined;\n }\n\n public startPolling(pollInterval: number) {\n assertNotCacheFirstOrOnly(this);\n this.options.pollInterval = pollInterval;\n this.queryManager.startPollingQuery(this.options, this.queryId);\n }\n\n private updateLastResult(newResult: ApolloQueryResult) {\n const previousResult = this.lastResult;\n this.lastResult = newResult;\n this.lastResultSnapshot = this.queryManager.assumeImmutableResults\n ? newResult\n : cloneDeep(newResult);\n return previousResult;\n }\n\n private onSubscribe(observer: Observer>) {\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = (observer as any)._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n } catch {}\n\n const first = !this.observers.size;\n this.observers.add(observer);\n\n // Deliver initial result\n if (observer.next && this.lastResult) observer.next(this.lastResult);\n if (observer.error && this.lastError) observer.error(this.lastError);\n\n // setup the query if it hasn't been done before\n if (first) {\n this.setUpQuery();\n }\n\n return () => {\n if (this.observers.delete(observer) && !this.observers.size) {\n this.tearDownQuery();\n }\n };\n }\n\n private setUpQuery() {\n const { queryManager, queryId } = this;\n\n if (this.shouldSubscribe) {\n queryManager.addObservableQuery(queryId, this);\n }\n\n if (this.options.pollInterval) {\n assertNotCacheFirstOrOnly(this);\n queryManager.startPollingQuery(this.options, queryId);\n }\n\n const onError = (error: ApolloError) => {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n this.updateLastResult({\n ...this.lastResult,\n errors: error.graphQLErrors,\n networkStatus: NetworkStatus.error,\n loading: false,\n });\n iterateObserversSafely(this.observers, 'error', this.lastError = error);\n };\n\n queryManager.observeQuery(queryId, this.options, {\n next: (result: ApolloQueryResult) => {\n if (this.lastError || this.isDifferentFromLastResult(result)) {\n const previousResult = this.updateLastResult(result);\n const { query, variables, fetchPolicy } = this.options;\n\n // Before calling `next` on each observer, we need to first see if\n // the query is using `@client @export` directives, and update\n // any variables that might have changed. If `@export` variables have\n // changed, and the query is calling against both local and remote\n // data, a refetch is needed to pull in new data, using the\n // updated `@export` variables.\n if (queryManager.transform(query).hasClientExports) {\n queryManager.getLocalState().addExportedVariables(\n query,\n variables,\n ).then((variables: TVariables) => {\n const previousVariables = this.variables;\n this.variables = this.options.variables = variables;\n if (\n !result.loading &&\n previousResult &&\n fetchPolicy !== 'cache-only' &&\n queryManager.transform(query).serverQuery &&\n !isEqual(previousVariables, variables)\n ) {\n this.refetch();\n } else {\n iterateObserversSafely(this.observers, 'next', result);\n }\n });\n } else {\n iterateObserversSafely(this.observers, 'next', result);\n }\n }\n },\n error: onError,\n }).catch(onError);\n }\n\n private tearDownQuery() {\n const { queryManager } = this;\n\n this.isTornDown = true;\n queryManager.stopPollingQuery(this.queryId);\n\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(sub => sub.unsubscribe());\n this.subscriptions.clear();\n\n queryManager.removeObservableQuery(this.queryId);\n queryManager.stopQuery(this.queryId);\n\n this.observers.clear();\n }\n}\n\nfunction defaultSubscriptionObserverErrorCallback(error: ApolloError) {\n invariant.error('Unhandled error', error.message, error.stack);\n}\n\nfunction iterateObserversSafely(\n observers: Set>,\n method: keyof Observer,\n argument?: A,\n) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n const observersWithMethod: Observer[] = [];\n observers.forEach(obs => obs[method] && observersWithMethod.push(obs));\n observersWithMethod.forEach(obs => (obs as any)[method](argument));\n}\n\nfunction assertNotCacheFirstOrOnly(\n obsQuery: ObservableQuery,\n) {\n const { fetchPolicy } = obsQuery.options;\n invariant(\n fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only',\n 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.',\n );\n}\n","import { DocumentNode } from 'graphql';\n\nexport class MutationStore {\n private store: { [mutationId: string]: MutationStoreValue } = {};\n\n public getStore(): { [mutationId: string]: MutationStoreValue } {\n return this.store;\n }\n\n public get(mutationId: string): MutationStoreValue {\n return this.store[mutationId];\n }\n\n public initMutation(\n mutationId: string,\n mutation: DocumentNode,\n variables: Object | undefined,\n ) {\n this.store[mutationId] = {\n mutation,\n variables: variables || {},\n loading: true,\n error: null,\n };\n }\n\n public markMutationError(mutationId: string, error: Error) {\n const mutation = this.store[mutationId];\n if (mutation) {\n mutation.loading = false;\n mutation.error = error;\n }\n }\n\n public markMutationResult(mutationId: string) {\n const mutation = this.store[mutationId];\n if (mutation) {\n mutation.loading = false;\n mutation.error = null;\n }\n }\n\n public reset() {\n this.store = {};\n }\n}\n\nexport interface MutationStoreValue {\n mutation: DocumentNode;\n variables: Object;\n loading: boolean;\n error: Error | null;\n}\n","import { DocumentNode, GraphQLError, ExecutionResult } from 'graphql';\nimport { isEqual } from 'apollo-utilities';\nimport { invariant } from 'ts-invariant';\nimport { NetworkStatus } from '../core/networkStatus';\nimport { isNonEmptyArray } from '../util/arrays';\n\nexport type QueryStoreValue = {\n document: DocumentNode;\n variables: Object;\n previousVariables?: Object | null;\n networkStatus: NetworkStatus;\n networkError?: Error | null;\n graphQLErrors?: ReadonlyArray;\n metadata: any;\n};\n\nexport class QueryStore {\n private store: { [queryId: string]: QueryStoreValue } = {};\n\n public getStore(): { [queryId: string]: QueryStoreValue } {\n return this.store;\n }\n\n public get(queryId: string): QueryStoreValue {\n return this.store[queryId];\n }\n\n public initQuery(query: {\n queryId: string;\n document: DocumentNode;\n storePreviousVariables: boolean;\n variables: Object;\n isPoll: boolean;\n isRefetch: boolean;\n metadata: any;\n fetchMoreForQueryId: string | undefined;\n }) {\n const previousQuery = this.store[query.queryId];\n\n // XXX we're throwing an error here to catch bugs where a query gets overwritten by a new one.\n // we should implement a separate action for refetching so that QUERY_INIT may never overwrite\n // an existing query (see also: https://github.com/apollostack/apollo-client/issues/732)\n invariant(\n !previousQuery ||\n previousQuery.document === query.document ||\n isEqual(previousQuery.document, query.document),\n 'Internal Error: may not update existing query string in store',\n );\n\n let isSetVariables = false;\n\n let previousVariables: Object | null = null;\n if (\n query.storePreviousVariables &&\n previousQuery &&\n previousQuery.networkStatus !== NetworkStatus.loading\n // if the previous query was still loading, we don't want to remember it at all.\n ) {\n if (!isEqual(previousQuery.variables, query.variables)) {\n isSetVariables = true;\n previousVariables = previousQuery.variables;\n }\n }\n\n // TODO break this out into a separate function\n let networkStatus;\n if (isSetVariables) {\n networkStatus = NetworkStatus.setVariables;\n } else if (query.isPoll) {\n networkStatus = NetworkStatus.poll;\n } else if (query.isRefetch) {\n networkStatus = NetworkStatus.refetch;\n // TODO: can we determine setVariables here if it's a refetch and the variables have changed?\n } else {\n networkStatus = NetworkStatus.loading;\n }\n\n let graphQLErrors: ReadonlyArray = [];\n if (previousQuery && previousQuery.graphQLErrors) {\n graphQLErrors = previousQuery.graphQLErrors;\n }\n\n // XXX right now if QUERY_INIT is fired twice, like in a refetch situation, we just overwrite\n // the store. We probably want a refetch action instead, because I suspect that if you refetch\n // before the initial fetch is done, you'll get an error.\n this.store[query.queryId] = {\n document: query.document,\n variables: query.variables,\n previousVariables,\n networkError: null,\n graphQLErrors: graphQLErrors,\n networkStatus,\n metadata: query.metadata,\n };\n\n // If the action had a `moreForQueryId` property then we need to set the\n // network status on that query as well to `fetchMore`.\n //\n // We have a complement to this if statement in the query result and query\n // error action branch, but importantly *not* in the client result branch.\n // This is because the implementation of `fetchMore` *always* sets\n // `fetchPolicy` to `network-only` so we would never have a client result.\n if (\n typeof query.fetchMoreForQueryId === 'string' &&\n this.store[query.fetchMoreForQueryId]\n ) {\n this.store[query.fetchMoreForQueryId].networkStatus =\n NetworkStatus.fetchMore;\n }\n }\n\n public markQueryResult(\n queryId: string,\n result: ExecutionResult,\n fetchMoreForQueryId: string | undefined,\n ) {\n if (!this.store || !this.store[queryId]) return;\n\n this.store[queryId].networkError = null;\n this.store[queryId].graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : [];\n this.store[queryId].previousVariables = null;\n this.store[queryId].networkStatus = NetworkStatus.ready;\n\n // If we have a `fetchMoreForQueryId` then we need to update the network\n // status for that query. See the branch for query initialization for more\n // explanation about this process.\n if (\n typeof fetchMoreForQueryId === 'string' &&\n this.store[fetchMoreForQueryId]\n ) {\n this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready;\n }\n }\n\n public markQueryError(\n queryId: string,\n error: Error,\n fetchMoreForQueryId: string | undefined,\n ) {\n if (!this.store || !this.store[queryId]) return;\n\n this.store[queryId].networkError = error;\n this.store[queryId].networkStatus = NetworkStatus.error;\n\n // If we have a `fetchMoreForQueryId` then we need to update the network\n // status for that query. See the branch for query initialization for more\n // explanation about this process.\n if (typeof fetchMoreForQueryId === 'string') {\n this.markQueryResultClient(fetchMoreForQueryId, true);\n }\n }\n\n public markQueryResultClient(queryId: string, complete: boolean) {\n const storeValue = this.store && this.store[queryId];\n if (storeValue) {\n storeValue.networkError = null;\n storeValue.previousVariables = null;\n if (complete) {\n storeValue.networkStatus = NetworkStatus.ready;\n }\n }\n }\n\n public stopQuery(queryId: string) {\n delete this.store[queryId];\n }\n\n public reset(observableQueryIds: string[]) {\n Object.keys(this.store).forEach(queryId => {\n if (observableQueryIds.indexOf(queryId) < 0) {\n this.stopQuery(queryId);\n } else {\n // XXX set loading to true so listeners don't trigger unless they want results with partial data\n this.store[queryId].networkStatus = NetworkStatus.loading;\n }\n });\n }\n}\n","export function capitalizeFirstLetter(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n SelectionNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n FieldNode,\n ASTNode,\n} from 'graphql';\nimport { visit, BREAK } from 'graphql/language/visitor';\n\nimport { ApolloCache } from 'apollo-cache';\nimport {\n getMainDefinition,\n buildQueryFromSelectionSet,\n hasDirectives,\n removeClientSetsFromDocument,\n mergeDeep,\n mergeDeepArray,\n FragmentMap,\n argumentsObjectFromField,\n resultKeyNameFromField,\n getFragmentDefinitions,\n createFragmentMap,\n shouldInclude,\n isField,\n isInlineFragment,\n} from 'apollo-utilities';\nimport { FetchResult } from 'apollo-link';\n\nimport { invariant } from 'ts-invariant';\n\nimport ApolloClient from '../ApolloClient';\nimport { Resolvers, OperationVariables } from './types';\nimport { capitalizeFirstLetter } from '../util/capitalizeFirstLetter';\n\nexport type Resolver = (\n rootValue?: any,\n args?: any,\n context?: any,\n info?: {\n field: FieldNode;\n fragmentMap: FragmentMap;\n },\n) => any;\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: any,\n) => boolean;\n\nexport type ExecContext = {\n fragmentMap: FragmentMap;\n context: any;\n variables: VariableMap;\n fragmentMatcher: FragmentMatcher;\n defaultOperationType: string;\n exportedVariables: Record;\n onlyRunForcedResolvers: boolean;\n};\n\nexport type LocalStateOptions = {\n cache: ApolloCache;\n client?: ApolloClient;\n resolvers?: Resolvers | Resolvers[];\n fragmentMatcher?: FragmentMatcher;\n};\n\nexport class LocalState {\n private cache: ApolloCache;\n private client: ApolloClient;\n private resolvers?: Resolvers;\n private fragmentMatcher: FragmentMatcher;\n\n constructor({\n cache,\n client,\n resolvers,\n fragmentMatcher,\n }: LocalStateOptions) {\n this.cache = cache;\n\n if (client) {\n this.client = client;\n }\n\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach(resolverGroup => {\n this.resolvers = mergeDeep(this.resolvers, resolverGroup);\n });\n } else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n }\n\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n }\n\n public getResolvers() {\n return this.resolvers || {};\n }\n\n // Run local client resolvers against the incoming query and remote data.\n // Locally resolved field values are merged with the incoming remote data,\n // and returned. Note that locally resolved fields will overwrite\n // remote data using the same field name.\n public async runResolvers({\n document,\n remoteResult,\n context,\n variables,\n onlyRunForcedResolvers = false,\n }: {\n document: DocumentNode | null;\n remoteResult: FetchResult;\n context?: Record;\n variables?: Record;\n onlyRunForcedResolvers?: boolean;\n }): Promise> {\n if (document) {\n return this.resolveDocument(\n document,\n remoteResult.data,\n context,\n variables,\n this.fragmentMatcher,\n onlyRunForcedResolvers,\n ).then(localResult => ({\n ...remoteResult,\n data: localResult.result,\n }));\n }\n\n return remoteResult;\n }\n\n public setFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n }\n\n public getFragmentMatcher(): FragmentMatcher {\n return this.fragmentMatcher;\n }\n\n // Client queries contain everything in the incoming document (if a @client\n // directive is found).\n public clientQuery(document: DocumentNode) {\n if (hasDirectives(['client'], document)) {\n if (this.resolvers) {\n return document;\n }\n invariant.warn(\n 'Found @client directives in a query but no ApolloClient resolvers ' +\n 'were specified. This means ApolloClient local resolver handling ' +\n 'has been disabled, and @client directives will be passed through ' +\n 'to your link chain.',\n );\n }\n return null;\n }\n\n // Server queries are stripped of all @client based selection sets.\n public serverQuery(document: DocumentNode) {\n return this.resolvers ? removeClientSetsFromDocument(document) : document;\n }\n\n public prepareContext(context = {}) {\n const { cache } = this;\n\n const newContext = {\n ...context,\n cache,\n // Getting an entry's cache key is useful for local state resolvers.\n getCacheKey: (obj: { __typename: string; id: string | number }) => {\n if ((cache as any).config) {\n return (cache as any).config.dataIdFromObject(obj);\n } else {\n invariant(false,\n 'To use context.getCacheKey, you need to use a cache that has ' +\n 'a configurable dataIdFromObject, like apollo-cache-inmemory.',\n );\n }\n },\n };\n\n return newContext;\n }\n\n // To support `@client @export(as: \"someVar\")` syntax, we'll first resolve\n // @client @export fields locally, then pass the resolved values back to be\n // used alongside the original operation variables.\n public async addExportedVariables(\n document: DocumentNode,\n variables: OperationVariables = {},\n context = {},\n ) {\n if (document) {\n return this.resolveDocument(\n document,\n this.buildRootValueFromCache(document, variables) || {},\n this.prepareContext(context),\n variables,\n ).then(data => ({\n ...variables,\n ...data.exportedVariables,\n }));\n }\n\n return {\n ...variables,\n };\n }\n\n public shouldForceResolvers(document: ASTNode) {\n let forceResolvers = false;\n visit(document, {\n Directive: {\n enter(node) {\n if (node.name.value === 'client' && node.arguments) {\n forceResolvers = node.arguments.some(\n arg =>\n arg.name.value === 'always' &&\n arg.value.kind === 'BooleanValue' &&\n arg.value.value === true,\n );\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n }\n\n // Query the cache and return matching data.\n private buildRootValueFromCache(\n document: DocumentNode,\n variables?: Record,\n ) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n }\n\n private async resolveDocument(\n document: DocumentNode,\n rootValue: TData,\n context: any = {},\n variables: VariableMap = {},\n fragmentMatcher: FragmentMatcher = () => true,\n onlyRunForcedResolvers: boolean = false,\n ) {\n const mainDefinition = getMainDefinition(document);\n const fragments = getFragmentDefinitions(document);\n const fragmentMap = createFragmentMap(fragments);\n\n const definitionOperation = (mainDefinition as OperationDefinitionNode)\n .operation;\n\n const defaultOperationType = definitionOperation\n ? capitalizeFirstLetter(definitionOperation)\n : 'Query';\n\n const { cache, client } = this;\n const execContext: ExecContext = {\n fragmentMap,\n context: {\n ...context,\n cache,\n client,\n },\n variables,\n fragmentMatcher,\n defaultOperationType,\n exportedVariables: {},\n onlyRunForcedResolvers,\n };\n\n return this.resolveSelectionSet(\n mainDefinition.selectionSet,\n rootValue,\n execContext,\n ).then(result => ({\n result,\n exportedVariables: execContext.exportedVariables,\n }));\n }\n\n private async resolveSelectionSet(\n selectionSet: SelectionSetNode,\n rootValue: TData,\n execContext: ExecContext,\n ) {\n const { fragmentMap, context, variables } = execContext;\n const resultsToMerge: TData[] = [rootValue];\n\n const execute = async (selection: SelectionNode): Promise => {\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely.\n return;\n }\n\n if (isField(selection)) {\n return this.resolveField(selection, rootValue, execContext).then(\n fieldResult => {\n if (typeof fieldResult !== 'undefined') {\n resultsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n } as TData);\n }\n },\n );\n }\n\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment.\n fragment = fragmentMap[selection.name.value];\n invariant(fragment, `No fragment named ${selection.name.value}`);\n }\n\n if (fragment && fragment.typeCondition) {\n const typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return this.resolveSelectionSet(\n fragment.selectionSet,\n rootValue,\n execContext,\n ).then(fragmentResult => {\n resultsToMerge.push(fragmentResult);\n });\n }\n }\n };\n\n return Promise.all(selectionSet.selections.map(execute)).then(function() {\n return mergeDeepArray(resultsToMerge);\n });\n }\n\n private async resolveField(\n field: FieldNode,\n rootValue: any,\n execContext: ExecContext,\n ): Promise {\n const { variables } = execContext;\n const fieldName = field.name.value;\n const aliasedFieldName = resultKeyNameFromField(field);\n const aliasUsed = fieldName !== aliasedFieldName;\n const defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n let resultPromise = Promise.resolve(defaultResult);\n\n // Usually all local resolvers are run when passing through here, but\n // if we've specifically identified that we only want to run forced\n // resolvers (that is, resolvers for fields marked with\n // `@client(always: true)`), then we'll skip running non-forced resolvers.\n if (\n !execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)\n ) {\n const resolverType =\n rootValue.__typename || execContext.defaultOperationType;\n const resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n const resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(resolve(\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field, fragmentMap: execContext.fragmentMap },\n ));\n }\n }\n }\n\n return resultPromise.then((result = defaultResult) => {\n // If an @export directive is associated with the current field, store\n // the `as` export variable name and current result for later use.\n if (field.directives) {\n field.directives.forEach(directive => {\n if (directive.name.value === 'export' && directive.arguments) {\n directive.arguments.forEach(arg => {\n if (arg.name.value === 'as' && arg.value.kind === 'StringValue') {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n\n // Handle all scalar types here.\n if (!field.selectionSet) {\n return result;\n }\n\n // From here down, the field has a selection set, which means it's trying\n // to query a GraphQLObjectType.\n if (result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return result;\n }\n\n if (Array.isArray(result)) {\n return this.resolveSubSelectedArray(field, result, execContext);\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n if (field.selectionSet) {\n return this.resolveSelectionSet(\n field.selectionSet,\n result,\n execContext,\n );\n }\n });\n }\n\n private resolveSubSelectedArray(\n field: FieldNode,\n result: any[],\n execContext: ExecContext,\n ): any {\n return Promise.all(\n result.map(item => {\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse.\n if (Array.isArray(item)) {\n return this.resolveSubSelectedArray(field, item, execContext);\n }\n\n // This is an object, run the selection set on it.\n if (field.selectionSet) {\n return this.resolveSelectionSet(field.selectionSet, item, execContext);\n }\n }),\n );\n }\n}\n","import { Observable, Observer, Subscription } from './Observable';\n\n// Returns a normal Observable that can have any number of subscribers,\n// while ensuring the original Observable gets subscribed to at most once.\nexport function multiplex(inner: Observable): Observable {\n const observers = new Set>();\n let sub: Subscription | null = null;\n return new Observable(observer => {\n observers.add(observer);\n sub = sub || inner.subscribe({\n next(value) {\n observers.forEach(obs => obs.next && obs.next(value));\n },\n error(error) {\n observers.forEach(obs => obs.error && obs.error(error));\n },\n complete() {\n observers.forEach(obs => obs.complete && obs.complete());\n },\n });\n return () => {\n if (observers.delete(observer) && !observers.size && sub) {\n sub.unsubscribe();\n sub = null;\n }\n };\n });\n}\n\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap(\n observable: Observable,\n mapFn: (value: V) => R | Promise,\n): Observable {\n return new Observable(observer => {\n const { next, error, complete } = observer;\n let activeNextCount = 0;\n let completed = false;\n\n const handler: Observer = {\n next(value) {\n ++activeNextCount;\n new Promise(resolve => {\n resolve(mapFn(value));\n }).then(\n result => {\n --activeNextCount;\n next && next.call(observer, result);\n completed && handler.complete!();\n },\n e => {\n --activeNextCount;\n error && error.call(observer, e);\n },\n );\n },\n error(e) {\n error && error.call(observer, e);\n },\n complete() {\n completed = true;\n if (!activeNextCount) {\n complete && complete.call(observer);\n }\n },\n };\n\n const sub = observable.subscribe(handler);\n return () => sub.unsubscribe();\n });\n}\n","import { execute, ApolloLink, FetchResult } from 'apollo-link';\nimport { DocumentNode } from 'graphql';\nimport { Cache } from 'apollo-cache';\nimport {\n getDefaultValues,\n getOperationDefinition,\n getOperationName,\n hasDirectives,\n graphQLResultHasError,\n hasClientExports,\n removeConnectionDirectiveFromDocument,\n canUseWeakMap,\n} from 'apollo-utilities';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { isApolloError, ApolloError } from '../errors/ApolloError';\nimport { Observer, Subscription, Observable } from '../util/Observable';\nimport { QueryWithUpdater, DataStore } from '../data/store';\nimport { MutationStore } from '../data/mutations';\nimport { QueryStore, QueryStoreValue } from '../data/queries';\n\nimport {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n ErrorPolicy,\n} from './watchQueryOptions';\nimport { ObservableQuery } from './ObservableQuery';\nimport { NetworkStatus, isNetworkRequestInFlight } from './networkStatus';\nimport {\n QueryListener,\n ApolloQueryResult,\n FetchType,\n OperationVariables,\n} from './types';\nimport { LocalState } from './LocalState';\nimport { asyncMap, multiplex } from '../util/observables';\nimport { isNonEmptyArray } from '../util/arrays';\n\nconst { hasOwnProperty } = Object.prototype;\n\nexport interface QueryInfo {\n listeners: Set;\n invalidated: boolean;\n newData: Cache.DiffResult | null;\n document: DocumentNode | null;\n lastRequestId: number;\n // A map going from queryId to an observer for a query issued by watchQuery. We use\n // these to keep track of queries that are inflight and error on the observers associated\n // with them in case of some destabalizing action (e.g. reset of the Apollo store).\n observableQuery: ObservableQuery | null;\n subscriptions: Set;\n cancel?: () => void;\n}\n\nexport class QueryManager {\n public link: ApolloLink;\n public mutationStore: MutationStore = new MutationStore();\n public queryStore: QueryStore = new QueryStore();\n public dataStore: DataStore;\n public readonly assumeImmutableResults: boolean;\n\n private queryDeduplication: boolean;\n private clientAwareness: Record = {};\n private localState: LocalState;\n\n private onBroadcast: () => void;\n\n private ssrMode: boolean;\n\n // let's not start at zero to avoid pain with bad checks\n private idCounter = 1;\n\n // XXX merge with ObservableQuery but that needs to be expanded to support mutations and\n // subscriptions as well\n private queries: Map = new Map();\n\n // A map of Promise reject functions for fetchQuery promises that have not\n // yet been resolved, used to keep track of in-flight queries so that we can\n // reject them in case a destabilizing event occurs (e.g. Apollo store reset).\n // The key is in the format of `query:${queryId}` or `fetchRequest:${queryId}`,\n // depending on where the promise's rejection function was created from.\n private fetchQueryRejectFns = new Map();\n\n constructor({\n link,\n queryDeduplication = false,\n store,\n onBroadcast = () => undefined,\n ssrMode = false,\n clientAwareness = {},\n localState,\n assumeImmutableResults,\n }: {\n link: ApolloLink;\n queryDeduplication?: boolean;\n store: DataStore;\n onBroadcast?: () => void;\n ssrMode?: boolean;\n clientAwareness?: Record;\n localState?: LocalState;\n assumeImmutableResults?: boolean;\n }) {\n this.link = link;\n this.queryDeduplication = queryDeduplication;\n this.dataStore = store;\n this.onBroadcast = onBroadcast;\n this.clientAwareness = clientAwareness;\n this.localState = localState || new LocalState({ cache: store.getCache() });\n this.ssrMode = ssrMode;\n this.assumeImmutableResults = !!assumeImmutableResults;\n }\n\n /**\n * Call this method to terminate any active query processes, making it safe\n * to dispose of this QueryManager instance.\n */\n public stop() {\n this.queries.forEach((_info, queryId) => {\n this.stopQueryNoBroadcast(queryId);\n });\n\n this.fetchQueryRejectFns.forEach(reject => {\n reject(\n new InvariantError('QueryManager stopped while query was in flight'),\n );\n });\n }\n\n public async mutate({\n mutation,\n variables,\n optimisticResponse,\n updateQueries: updateQueriesByName,\n refetchQueries = [],\n awaitRefetchQueries = false,\n update: updateWithProxyFn,\n errorPolicy = 'none',\n fetchPolicy,\n context = {},\n }: MutationOptions): Promise> {\n invariant(\n mutation,\n 'mutation option is required. You must specify your GraphQL document in the mutation option.',\n );\n\n invariant(\n !fetchPolicy || fetchPolicy === 'no-cache',\n \"Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior.\"\n );\n\n const mutationId = this.generateQueryId();\n mutation = this.transform(mutation).document;\n\n this.setQuery(mutationId, () => ({ document: mutation }));\n\n variables = this.getVariables(mutation, variables);\n\n if (this.transform(mutation).hasClientExports) {\n variables = await this.localState.addExportedVariables(mutation, variables, context);\n }\n\n // Create a map of update queries by id to the query instead of by name.\n const generateUpdateQueriesInfo: () => {\n [queryId: string]: QueryWithUpdater;\n } = () => {\n const ret: { [queryId: string]: QueryWithUpdater } = {};\n\n if (updateQueriesByName) {\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) {\n const { queryName } = observableQuery;\n if (\n queryName &&\n hasOwnProperty.call(updateQueriesByName, queryName)\n ) {\n ret[queryId] = {\n updater: updateQueriesByName[queryName],\n query: this.queryStore.get(queryId),\n };\n }\n }\n });\n }\n\n return ret;\n };\n\n this.mutationStore.initMutation(\n mutationId,\n mutation,\n variables,\n );\n\n this.dataStore.markMutationInit({\n mutationId,\n document: mutation,\n variables,\n updateQueries: generateUpdateQueriesInfo(),\n update: updateWithProxyFn,\n optimisticResponse,\n });\n\n this.broadcastQueries();\n\n const self = this;\n\n return new Promise((resolve, reject) => {\n let storeResult: FetchResult | null;\n let error: ApolloError;\n\n self.getObservableFromLink(\n mutation,\n {\n ...context,\n optimisticResponse,\n },\n variables,\n false,\n ).subscribe({\n next(result: FetchResult) {\n if (graphQLResultHasError(result) && errorPolicy === 'none') {\n error = new ApolloError({\n graphQLErrors: result.errors,\n });\n return;\n }\n\n self.mutationStore.markMutationResult(mutationId);\n\n if (fetchPolicy !== 'no-cache') {\n self.dataStore.markMutationResult({\n mutationId,\n result,\n document: mutation,\n variables,\n updateQueries: generateUpdateQueriesInfo(),\n update: updateWithProxyFn,\n });\n }\n\n storeResult = result;\n },\n\n error(err: Error) {\n self.mutationStore.markMutationError(mutationId, err);\n self.dataStore.markMutationComplete({\n mutationId,\n optimisticResponse,\n });\n self.broadcastQueries();\n self.setQuery(mutationId, () => ({ document: null }));\n reject(\n new ApolloError({\n networkError: err,\n }),\n );\n },\n\n complete() {\n if (error) {\n self.mutationStore.markMutationError(mutationId, error);\n }\n\n self.dataStore.markMutationComplete({\n mutationId,\n optimisticResponse,\n });\n\n self.broadcastQueries();\n\n if (error) {\n reject(error);\n return;\n }\n\n // allow for conditional refetches\n // XXX do we want to make this the only API one day?\n if (typeof refetchQueries === 'function') {\n refetchQueries = refetchQueries(storeResult!);\n }\n\n const refetchQueryPromises: Promise<\n ApolloQueryResult[] | ApolloQueryResult<{}>\n >[] = [];\n\n if (isNonEmptyArray(refetchQueries)) {\n refetchQueries.forEach(refetchQuery => {\n if (typeof refetchQuery === 'string') {\n self.queries.forEach(({ observableQuery }) => {\n if (\n observableQuery &&\n observableQuery.queryName === refetchQuery\n ) {\n refetchQueryPromises.push(observableQuery.refetch());\n }\n });\n } else {\n const queryOptions: QueryOptions = {\n query: refetchQuery.query,\n variables: refetchQuery.variables,\n fetchPolicy: 'network-only',\n };\n\n if (refetchQuery.context) {\n queryOptions.context = refetchQuery.context;\n }\n\n refetchQueryPromises.push(self.query(queryOptions));\n }\n });\n }\n\n Promise.all(\n awaitRefetchQueries ? refetchQueryPromises : [],\n ).then(() => {\n self.setQuery(mutationId, () => ({ document: null }));\n\n if (\n errorPolicy === 'ignore' &&\n storeResult &&\n graphQLResultHasError(storeResult)\n ) {\n delete storeResult.errors;\n }\n\n resolve(storeResult!);\n });\n },\n });\n });\n }\n\n public async fetchQuery(\n queryId: string,\n options: WatchQueryOptions,\n fetchType?: FetchType,\n // This allows us to track if this is a query spawned by a `fetchMore`\n // call for another query. We need this data to compute the `fetchMore`\n // network status for the query this is fetching for.\n fetchMoreForQueryId?: string,\n ): Promise> {\n const {\n metadata = null,\n fetchPolicy = 'cache-first', // cache-first is the default fetch policy.\n context = {},\n } = options;\n\n const query = this.transform(options.query).document;\n\n let variables = this.getVariables(query, options.variables);\n\n if (this.transform(query).hasClientExports) {\n variables = await this.localState.addExportedVariables(query, variables, context);\n }\n\n options = { ...options, variables };\n\n let storeResult: any;\n const isNetworkOnly =\n fetchPolicy === 'network-only' || fetchPolicy === 'no-cache';\n let needToFetch = isNetworkOnly;\n\n // Unless we are completely skipping the cache, we want to diff the query\n // against the cache before we fetch it from the network interface.\n if (!isNetworkOnly) {\n const { complete, result } = this.dataStore.getCache().diff({\n query,\n variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n // If we're in here, only fetch if we have missing fields\n needToFetch = !complete || fetchPolicy === 'cache-and-network';\n storeResult = result;\n }\n\n let shouldFetch =\n needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby';\n\n // we need to check to see if this is an operation that uses the @live directive\n if (hasDirectives(['live'], query)) shouldFetch = true;\n\n const requestId = this.idCounter++;\n\n // set up a watcher to listen to cache updates\n const cancel = fetchPolicy !== 'no-cache'\n ? this.updateQueryWatch(queryId, query, options)\n : undefined;\n\n // Initialize query in store with unique requestId\n this.setQuery(queryId, () => ({\n document: query,\n lastRequestId: requestId,\n invalidated: true,\n cancel,\n }));\n\n this.invalidate(fetchMoreForQueryId);\n\n this.queryStore.initQuery({\n queryId,\n document: query,\n storePreviousVariables: shouldFetch,\n variables,\n isPoll: fetchType === FetchType.poll,\n isRefetch: fetchType === FetchType.refetch,\n metadata,\n fetchMoreForQueryId,\n });\n\n this.broadcastQueries();\n\n if (shouldFetch) {\n const networkResult = this.fetchRequest({\n requestId,\n queryId,\n document: query,\n options,\n fetchMoreForQueryId,\n }).catch(error => {\n // This is for the benefit of `refetch` promises, which currently don't get their errors\n // through the store like watchQuery observers do\n if (isApolloError(error)) {\n throw error;\n } else {\n if (requestId >= this.getQuery(queryId).lastRequestId) {\n this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId);\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n this.broadcastQueries();\n }\n throw new ApolloError({ networkError: error });\n }\n });\n\n // we don't return the promise for cache-and-network since it is already\n // returned below from the cache\n if (fetchPolicy !== 'cache-and-network') {\n return networkResult;\n }\n\n // however we need to catch the error so it isn't unhandled in case of\n // network error\n networkResult.catch(() => {});\n }\n\n // If there is no part of the query we need to fetch from the server (or,\n // fetchPolicy is cache-only), we just write the store result as the final result.\n this.queryStore.markQueryResultClient(queryId, !shouldFetch);\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n\n if (this.transform(query).hasForcedResolvers) {\n return this.localState.runResolvers({\n document: query,\n remoteResult: { data: storeResult },\n context,\n variables,\n onlyRunForcedResolvers: true,\n }).then((result: FetchResult) => {\n this.markQueryResult(\n queryId,\n result,\n options,\n fetchMoreForQueryId,\n );\n this.broadcastQueries();\n return result;\n });\n }\n\n this.broadcastQueries();\n\n // If we have no query to send to the server, we should return the result\n // found within the store.\n return { data: storeResult };\n }\n\n private markQueryResult(\n queryId: string,\n result: FetchResult,\n {\n fetchPolicy,\n variables,\n errorPolicy,\n }: WatchQueryOptions,\n fetchMoreForQueryId?: string,\n ) {\n if (fetchPolicy === 'no-cache') {\n this.setQuery(queryId, () => ({\n newData: { result: result.data, complete: true },\n }));\n } else {\n this.dataStore.markQueryResult(\n result,\n this.getQuery(queryId).document!,\n variables,\n fetchMoreForQueryId,\n errorPolicy === 'ignore' || errorPolicy === 'all',\n );\n }\n }\n\n // Returns a query listener that will update the given observer based on the\n // results (or lack thereof) for a particular query.\n public queryListenerForObserver(\n queryId: string,\n options: WatchQueryOptions,\n observer: Observer>,\n ): QueryListener {\n function invoke(method: 'next' | 'error', argument: any) {\n if (observer[method]) {\n try {\n observer[method]!(argument);\n } catch (e) {\n invariant.error(e);\n }\n } else if (method === 'error') {\n invariant.error(argument);\n }\n }\n\n return (\n queryStoreValue: QueryStoreValue,\n newData?: Cache.DiffResult,\n ) => {\n // we're going to take a look at the data, so the query is no longer invalidated\n this.invalidate(queryId, false);\n\n // The query store value can be undefined in the event of a store\n // reset.\n if (!queryStoreValue) return;\n\n const { observableQuery, document } = this.getQuery(queryId);\n\n const fetchPolicy = observableQuery\n ? observableQuery.options.fetchPolicy\n : options.fetchPolicy;\n\n // don't watch the store for queries on standby\n if (fetchPolicy === 'standby') return;\n\n const loading = isNetworkRequestInFlight(queryStoreValue.networkStatus);\n const lastResult = observableQuery && observableQuery.getLastResult();\n\n const networkStatusChanged = !!(\n lastResult &&\n lastResult.networkStatus !== queryStoreValue.networkStatus\n );\n\n const shouldNotifyIfLoading =\n options.returnPartialData ||\n (!newData && queryStoreValue.previousVariables) ||\n (networkStatusChanged && options.notifyOnNetworkStatusChange) ||\n fetchPolicy === 'cache-only' ||\n fetchPolicy === 'cache-and-network';\n\n if (loading && !shouldNotifyIfLoading) {\n return;\n }\n\n const hasGraphQLErrors = isNonEmptyArray(queryStoreValue.graphQLErrors);\n\n const errorPolicy: ErrorPolicy = observableQuery\n && observableQuery.options.errorPolicy\n || options.errorPolicy\n || 'none';\n\n // If we have either a GraphQL error or a network error, we create\n // an error and tell the observer about it.\n if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) {\n return invoke('error', new ApolloError({\n graphQLErrors: queryStoreValue.graphQLErrors,\n networkError: queryStoreValue.networkError,\n }));\n }\n\n try {\n let data: any;\n let isMissing: boolean;\n\n if (newData) {\n // As long as we're using the cache, clear out the latest\n // `newData`, since it will now become the current data. We need\n // to keep the `newData` stored with the query when using\n // `no-cache` since `getCurrentQueryResult` attemps to pull from\n // `newData` first, following by trying the cache (which won't\n // find a hit for `no-cache`).\n if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') {\n this.setQuery(queryId, () => ({ newData: null }));\n }\n\n data = newData.result;\n isMissing = !newData.complete;\n } else {\n const lastError = observableQuery && observableQuery.getLastError();\n const errorStatusChanged =\n errorPolicy !== 'none' &&\n (lastError && lastError.graphQLErrors) !==\n queryStoreValue.graphQLErrors;\n\n if (lastResult && lastResult.data && !errorStatusChanged) {\n data = lastResult.data;\n isMissing = false;\n } else {\n const diffResult = this.dataStore.getCache().diff({\n query: document as DocumentNode,\n variables:\n queryStoreValue.previousVariables ||\n queryStoreValue.variables,\n returnPartialData: true,\n optimistic: true,\n });\n\n data = diffResult.result;\n isMissing = !diffResult.complete;\n }\n }\n\n // If there is some data missing and the user has told us that they\n // do not tolerate partial data then we want to return the previous\n // result and mark it as stale.\n const stale = isMissing && !(\n options.returnPartialData ||\n fetchPolicy === 'cache-only'\n );\n\n const resultFromStore: ApolloQueryResult = {\n data: stale ? lastResult && lastResult.data : data,\n loading,\n networkStatus: queryStoreValue.networkStatus,\n stale,\n };\n\n // if the query wants updates on errors we need to add it to the result\n if (errorPolicy === 'all' && hasGraphQLErrors) {\n resultFromStore.errors = queryStoreValue.graphQLErrors;\n }\n\n invoke('next', resultFromStore);\n\n } catch (networkError) {\n invoke('error', new ApolloError({ networkError }));\n }\n };\n }\n\n private transformCache = new (canUseWeakMap ? WeakMap : Map)<\n DocumentNode,\n Readonly<{\n document: Readonly;\n hasClientExports: boolean;\n hasForcedResolvers: boolean;\n clientQuery: Readonly | null;\n serverQuery: Readonly | null;\n defaultVars: Readonly;\n }>\n >();\n\n public transform(document: DocumentNode) {\n const { transformCache } = this;\n\n if (!transformCache.has(document)) {\n const cache = this.dataStore.getCache();\n const transformed = cache.transformDocument(document);\n const forLink = removeConnectionDirectiveFromDocument(\n cache.transformForLink(transformed));\n\n const clientQuery = this.localState.clientQuery(transformed);\n const serverQuery = this.localState.serverQuery(forLink);\n\n const cacheEntry = {\n document: transformed,\n // TODO These two calls (hasClientExports and shouldForceResolvers)\n // could probably be merged into a single traversal.\n hasClientExports: hasClientExports(transformed),\n hasForcedResolvers: this.localState.shouldForceResolvers(transformed),\n clientQuery,\n serverQuery,\n defaultVars: getDefaultValues(\n getOperationDefinition(transformed)\n ) as OperationVariables,\n };\n\n const add = (doc: DocumentNode | null) => {\n if (doc && !transformCache.has(doc)) {\n transformCache.set(doc, cacheEntry);\n }\n }\n // Add cacheEntry to the transformCache using several different keys,\n // since any one of these documents could end up getting passed to the\n // transform method again in the future.\n add(document);\n add(transformed);\n add(clientQuery);\n add(serverQuery);\n }\n\n return transformCache.get(document)!;\n }\n\n private getVariables(\n document: DocumentNode,\n variables?: OperationVariables,\n ): OperationVariables {\n return {\n ...this.transform(document).defaultVars,\n ...variables,\n };\n }\n\n // The shouldSubscribe option is a temporary fix that tells us whether watchQuery was called\n // directly (i.e. through ApolloClient) or through the query method within QueryManager.\n // Currently, the query method uses watchQuery in order to handle non-network errors correctly\n // but we don't want to keep track observables issued for the query method since those aren't\n // supposed to be refetched in the event of a store reset. Once we unify error handling for\n // network errors and non-network errors, the shouldSubscribe option will go away.\n\n public watchQuery(\n options: WatchQueryOptions,\n shouldSubscribe = true,\n ): ObservableQuery {\n invariant(\n options.fetchPolicy !== 'standby',\n 'client.watchQuery cannot be called with fetchPolicy set to \"standby\"',\n );\n\n // assign variable default values if supplied\n options.variables = this.getVariables(options.query, options.variables);\n\n if (typeof options.notifyOnNetworkStatusChange === 'undefined') {\n options.notifyOnNetworkStatusChange = false;\n }\n\n let transformedOptions = { ...options } as WatchQueryOptions;\n\n return new ObservableQuery({\n queryManager: this,\n options: transformedOptions,\n shouldSubscribe: shouldSubscribe,\n });\n }\n\n public query(options: QueryOptions): Promise> {\n invariant(\n options.query,\n 'query option is required. You must specify your GraphQL document ' +\n 'in the query option.',\n );\n\n invariant(\n options.query.kind === 'Document',\n 'You must wrap the query string in a \"gql\" tag.',\n );\n\n invariant(\n !(options as any).returnPartialData,\n 'returnPartialData option only supported on watchQuery.',\n );\n\n invariant(\n !(options as any).pollInterval,\n 'pollInterval option only supported on watchQuery.',\n );\n\n return new Promise>((resolve, reject) => {\n const watchedQuery = this.watchQuery(options, false);\n this.fetchQueryRejectFns.set(`query:${watchedQuery.queryId}`, reject);\n watchedQuery\n .result()\n .then(resolve, reject)\n // Since neither resolve nor reject throw or return a value, this .then\n // handler is guaranteed to execute. Note that it doesn't really matter\n // when we remove the reject function from this.fetchQueryRejectFns,\n // since resolve and reject are mutually idempotent. In fact, it would\n // not be incorrect to let reject functions accumulate over time; it's\n // just a waste of memory.\n .then(() =>\n this.fetchQueryRejectFns.delete(`query:${watchedQuery.queryId}`),\n );\n });\n }\n\n public generateQueryId() {\n return String(this.idCounter++);\n }\n\n public stopQueryInStore(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryInStoreNoBroadcast(queryId: string) {\n this.stopPollingQuery(queryId);\n this.queryStore.stopQuery(queryId);\n this.invalidate(queryId);\n }\n\n public addQueryListener(queryId: string, listener: QueryListener) {\n this.setQuery(queryId, ({ listeners }) => {\n listeners.add(listener);\n return { invalidated: false };\n });\n }\n\n public updateQueryWatch(\n queryId: string,\n document: DocumentNode,\n options: WatchQueryOptions,\n ) {\n const { cancel } = this.getQuery(queryId);\n if (cancel) cancel();\n const previousResult = () => {\n let previousResult = null;\n const { observableQuery } = this.getQuery(queryId);\n if (observableQuery) {\n const lastResult = observableQuery.getLastResult();\n if (lastResult) {\n previousResult = lastResult.data;\n }\n }\n\n return previousResult;\n };\n return this.dataStore.getCache().watch({\n query: document as DocumentNode,\n variables: options.variables,\n optimistic: true,\n previousResult,\n callback: newData => {\n this.setQuery(queryId, () => ({ invalidated: true, newData }));\n },\n });\n }\n\n // Adds an ObservableQuery to this.observableQueries and to this.observableQueriesByName.\n public addObservableQuery(\n queryId: string,\n observableQuery: ObservableQuery,\n ) {\n this.setQuery(queryId, () => ({ observableQuery }));\n }\n\n public removeObservableQuery(queryId: string) {\n const { cancel } = this.getQuery(queryId);\n this.setQuery(queryId, () => ({ observableQuery: null }));\n if (cancel) cancel();\n }\n\n public clearStore(): Promise {\n // Before we have sent the reset action to the store,\n // we can no longer rely on the results returned by in-flight\n // requests since these may depend on values that previously existed\n // in the data portion of the store. So, we cancel the promises and observers\n // that we have issued so far and not yet resolved (in the case of\n // queries).\n this.fetchQueryRejectFns.forEach(reject => {\n reject(new InvariantError(\n 'Store reset while query was in flight (not completed in link chain)',\n ));\n });\n\n const resetIds: string[] = [];\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) resetIds.push(queryId);\n });\n\n this.queryStore.reset(resetIds);\n this.mutationStore.reset();\n\n // begin removing data from the store\n return this.dataStore.reset();\n }\n\n public resetStore(): Promise[]> {\n // Similarly, we have to have to refetch each of the queries currently being\n // observed. We refetch instead of error'ing on these since the assumption is that\n // resetting the store doesn't eliminate the need for the queries currently being\n // watched. If there is an existing query in flight when the store is reset,\n // the promise for it will be rejected and its results will not be written to the\n // store.\n return this.clearStore().then(() => {\n return this.reFetchObservableQueries();\n });\n }\n\n public reFetchObservableQueries(\n includeStandby: boolean = false,\n ): Promise[]> {\n const observableQueryPromises: Promise>[] = [];\n\n this.queries.forEach(({ observableQuery }, queryId) => {\n if (observableQuery) {\n const fetchPolicy = observableQuery.options.fetchPolicy;\n\n observableQuery.resetLastResults();\n if (\n fetchPolicy !== 'cache-only' &&\n (includeStandby || fetchPolicy !== 'standby')\n ) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n\n this.setQuery(queryId, () => ({ newData: null }));\n this.invalidate(queryId);\n }\n });\n\n this.broadcastQueries();\n\n return Promise.all(observableQueryPromises);\n }\n\n public observeQuery(\n queryId: string,\n options: WatchQueryOptions,\n observer: Observer>,\n ) {\n this.addQueryListener(\n queryId,\n this.queryListenerForObserver(queryId, options, observer),\n );\n return this.fetchQuery(queryId, options);\n }\n\n public startQuery(\n queryId: string,\n options: WatchQueryOptions,\n listener: QueryListener,\n ) {\n invariant.warn(\"The QueryManager.startQuery method has been deprecated\");\n\n this.addQueryListener(queryId, listener);\n\n this.fetchQuery(queryId, options)\n // `fetchQuery` returns a Promise. In case of a failure it should be caucht or else the\n // console will show an `Uncaught (in promise)` message. Ignore the error for now.\n .catch(() => undefined);\n\n return queryId;\n }\n\n public startGraphQLSubscription({\n query,\n fetchPolicy,\n variables,\n }: SubscriptionOptions): Observable> {\n query = this.transform(query).document;\n variables = this.getVariables(query, variables);\n\n const makeObservable = (variables: OperationVariables) =>\n this.getObservableFromLink(\n query,\n {},\n variables,\n false,\n ).map(result => {\n if (!fetchPolicy || fetchPolicy !== 'no-cache') {\n this.dataStore.markSubscriptionResult(\n result,\n query,\n variables,\n );\n this.broadcastQueries();\n }\n\n if (graphQLResultHasError(result)) {\n throw new ApolloError({\n graphQLErrors: result.errors,\n });\n }\n\n return result;\n });\n\n if (this.transform(query).hasClientExports) {\n const observablePromise = this.localState.addExportedVariables(\n query,\n variables,\n ).then(makeObservable);\n\n return new Observable>(observer => {\n let sub: Subscription | null = null;\n observablePromise.then(\n observable => sub = observable.subscribe(observer),\n observer.error,\n );\n return () => sub && sub.unsubscribe();\n });\n }\n\n return makeObservable(variables);\n }\n\n public stopQuery(queryId: string) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryNoBroadcast(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n }\n\n public removeQuery(queryId: string) {\n // teardown all links\n // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises\n // that each add their reject functions to fetchQueryRejectFns.\n // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.\n // The same queryId could have two rejection fns for two promises\n this.fetchQueryRejectFns.delete(`query:${queryId}`);\n this.fetchQueryRejectFns.delete(`fetchRequest:${queryId}`);\n this.getQuery(queryId).subscriptions.forEach(x => x.unsubscribe());\n this.queries.delete(queryId);\n }\n\n public getCurrentQueryResult(\n observableQuery: ObservableQuery,\n optimistic: boolean = true,\n ): {\n data: T | undefined;\n partial: boolean;\n } {\n const { variables, query, fetchPolicy, returnPartialData } = observableQuery.options;\n const lastResult = observableQuery.getLastResult();\n const { newData } = this.getQuery(observableQuery.queryId);\n\n if (newData && newData.complete) {\n return { data: newData.result, partial: false };\n }\n\n if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') {\n return { data: undefined, partial: false };\n }\n\n const { result, complete } = this.dataStore.getCache().diff({\n query,\n variables,\n previousResult: lastResult ? lastResult.data : undefined,\n returnPartialData: true,\n optimistic,\n });\n\n return {\n data: (complete || returnPartialData) ? result : void 0,\n partial: !complete,\n };\n }\n\n public getQueryWithPreviousResult(\n queryIdOrObservable: string | ObservableQuery,\n ): {\n previousResult: any;\n variables: TVariables | undefined;\n document: DocumentNode;\n } {\n let observableQuery: ObservableQuery;\n if (typeof queryIdOrObservable === 'string') {\n const { observableQuery: foundObserveableQuery } = this.getQuery(\n queryIdOrObservable,\n );\n invariant(\n foundObserveableQuery,\n `ObservableQuery with this id doesn't exist: ${queryIdOrObservable}`\n );\n observableQuery = foundObserveableQuery!;\n } else {\n observableQuery = queryIdOrObservable;\n }\n\n const { variables, query } = observableQuery.options;\n return {\n previousResult: this.getCurrentQueryResult(observableQuery, false).data,\n variables,\n document: query,\n };\n }\n\n public broadcastQueries() {\n this.onBroadcast();\n this.queries.forEach((info, id) => {\n if (info.invalidated) {\n info.listeners.forEach(listener => {\n // it's possible for the listener to be undefined if the query is being stopped\n // See here for more detail: https://github.com/apollostack/apollo-client/issues/231\n if (listener) {\n listener(this.queryStore.get(id), info.newData);\n }\n });\n }\n });\n }\n\n public getLocalState(): LocalState {\n return this.localState;\n }\n\n private inFlightLinkObservables = new Map<\n DocumentNode,\n Map>\n >();\n\n private getObservableFromLink(\n query: DocumentNode,\n context: any,\n variables?: OperationVariables,\n deduplication: boolean = this.queryDeduplication,\n ): Observable> {\n let observable: Observable>;\n\n const { serverQuery } = this.transform(query);\n if (serverQuery) {\n const { inFlightLinkObservables, link } = this;\n\n const operation = {\n query: serverQuery,\n variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext({\n ...context,\n forceFetch: !deduplication\n }),\n };\n\n context = operation.context;\n\n if (deduplication) {\n const byVariables = inFlightLinkObservables.get(serverQuery) || new Map();\n inFlightLinkObservables.set(serverQuery, byVariables);\n\n const varJson = JSON.stringify(variables);\n observable = byVariables.get(varJson);\n\n if (!observable) {\n byVariables.set(\n varJson,\n observable = multiplex(\n execute(link, operation) as Observable>\n )\n );\n\n const cleanup = () => {\n byVariables.delete(varJson);\n if (!byVariables.size) inFlightLinkObservables.delete(serverQuery);\n cleanupSub.unsubscribe();\n };\n\n const cleanupSub = observable.subscribe({\n next: cleanup,\n error: cleanup,\n complete: cleanup,\n });\n }\n\n } else {\n observable = multiplex(execute(link, operation) as Observable>);\n }\n } else {\n observable = Observable.of({ data: {} } as FetchResult);\n context = this.prepareContext(context);\n }\n\n const { clientQuery } = this.transform(query);\n if (clientQuery) {\n observable = asyncMap(observable, result => {\n return this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context,\n variables,\n });\n });\n }\n\n return observable;\n }\n\n // Takes a request id, query id, a query document and information associated with the query\n // and send it to the network interface. Returns\n // a promise for the result associated with that request.\n private fetchRequest({\n requestId,\n queryId,\n document,\n options,\n fetchMoreForQueryId,\n }: {\n requestId: number;\n queryId: string;\n document: DocumentNode;\n options: WatchQueryOptions;\n fetchMoreForQueryId?: string;\n }): Promise> {\n const { variables, errorPolicy = 'none', fetchPolicy } = options;\n let resultFromStore: any;\n let errorsFromStore: any;\n\n return new Promise>((resolve, reject) => {\n const observable = this.getObservableFromLink(\n document,\n options.context,\n variables,\n );\n\n const fqrfId = `fetchRequest:${queryId}`;\n this.fetchQueryRejectFns.set(fqrfId, reject);\n\n const cleanup = () => {\n this.fetchQueryRejectFns.delete(fqrfId);\n this.setQuery(queryId, ({ subscriptions }) => {\n subscriptions.delete(subscription);\n });\n };\n\n const subscription = observable.map((result: FetchResult) => {\n if (requestId >= this.getQuery(queryId).lastRequestId) {\n this.markQueryResult(\n queryId,\n result,\n options,\n fetchMoreForQueryId,\n );\n\n this.queryStore.markQueryResult(\n queryId,\n result,\n fetchMoreForQueryId,\n );\n\n this.invalidate(queryId);\n this.invalidate(fetchMoreForQueryId);\n\n this.broadcastQueries();\n }\n\n if (errorPolicy === 'none' && isNonEmptyArray(result.errors)) {\n return reject(new ApolloError({\n graphQLErrors: result.errors,\n }));\n }\n\n if (errorPolicy === 'all') {\n errorsFromStore = result.errors;\n }\n\n if (fetchMoreForQueryId || fetchPolicy === 'no-cache') {\n // We don't write fetchMore results to the store because this would overwrite\n // the original result in case an @connection directive is used.\n resultFromStore = result.data;\n } else {\n // ensure result is combined with data already in store\n const { result, complete } = this.dataStore.getCache().diff({\n variables,\n query: document,\n optimistic: false,\n returnPartialData: true,\n });\n\n if (complete || options.returnPartialData) {\n resultFromStore = result;\n }\n }\n }).subscribe({\n error(error: ApolloError) {\n cleanup();\n reject(error);\n },\n\n complete() {\n cleanup();\n resolve({\n data: resultFromStore,\n errors: errorsFromStore,\n loading: false,\n networkStatus: NetworkStatus.ready,\n stale: false,\n });\n },\n });\n\n this.setQuery(queryId, ({ subscriptions }) => {\n subscriptions.add(subscription);\n });\n });\n }\n\n private getQuery(queryId: string) {\n return (\n this.queries.get(queryId) || {\n listeners: new Set(),\n invalidated: false,\n document: null,\n newData: null,\n lastRequestId: 1,\n observableQuery: null,\n subscriptions: new Set(),\n }\n );\n }\n\n private setQuery(\n queryId: string,\n updater: (prev: QueryInfo) => Pick | void,\n ) {\n const prev = this.getQuery(queryId);\n const newInfo = { ...prev, ...updater(prev) };\n this.queries.set(queryId, newInfo);\n }\n\n private invalidate(\n queryId: string | undefined,\n invalidated = true,\n ) {\n if (queryId) {\n this.setQuery(queryId, () => ({ invalidated }));\n }\n }\n\n private prepareContext(context = {}) {\n const newContext = this.localState.prepareContext(context);\n return {\n ...newContext,\n clientAwareness: this.clientAwareness,\n };\n }\n\n public checkInFlight(queryId: string) {\n const query = this.queryStore.get(queryId);\n\n return (\n query &&\n query.networkStatus !== NetworkStatus.ready &&\n query.networkStatus !== NetworkStatus.error\n );\n }\n\n // Map from client ID to { interval, options }.\n private pollingInfoByQueryId = new Map();\n\n public startPollingQuery(\n options: WatchQueryOptions,\n queryId: string,\n listener?: QueryListener,\n ): string {\n const { pollInterval } = options;\n\n invariant(\n pollInterval,\n 'Attempted to start a polling query without a polling interval.',\n );\n\n // Do not poll in SSR mode\n if (!this.ssrMode) {\n let info = this.pollingInfoByQueryId.get(queryId)!;\n if (!info) {\n this.pollingInfoByQueryId.set(queryId, (info = {} as any));\n }\n\n info.interval = pollInterval!;\n info.options = {\n ...options,\n fetchPolicy: 'network-only',\n };\n\n const maybeFetch = () => {\n const info = this.pollingInfoByQueryId.get(queryId);\n if (info) {\n if (this.checkInFlight(queryId)) {\n poll();\n } else {\n this.fetchQuery(queryId, info.options, FetchType.poll).then(\n poll,\n poll,\n );\n }\n }\n };\n\n const poll = () => {\n const info = this.pollingInfoByQueryId.get(queryId);\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n\n if (listener) {\n this.addQueryListener(queryId, listener);\n }\n\n poll();\n }\n\n return queryId;\n }\n\n public stopPollingQuery(queryId: string) {\n this.pollingInfoByQueryId.delete(queryId);\n }\n}\n","import { ExecutionResult, DocumentNode } from 'graphql';\nimport { ApolloCache, Cache, DataProxy } from 'apollo-cache';\n\nimport { QueryStoreValue } from '../data/queries';\nimport {\n getOperationName,\n tryFunctionOrLogError,\n graphQLResultHasError,\n} from 'apollo-utilities';\nimport { MutationQueryReducer } from '../core/types';\n\nexport type QueryWithUpdater = {\n updater: MutationQueryReducer;\n query: QueryStoreValue;\n};\n\nexport interface DataWrite {\n rootId: string;\n result: any;\n document: DocumentNode;\n operationName: string | null;\n variables: Object;\n}\n\nexport class DataStore {\n private cache: ApolloCache;\n\n constructor(initialCache: ApolloCache) {\n this.cache = initialCache;\n }\n\n public getCache(): ApolloCache {\n return this.cache;\n }\n\n public markQueryResult(\n result: ExecutionResult,\n document: DocumentNode,\n variables: any,\n fetchMoreForQueryId: string | undefined,\n ignoreErrors: boolean = false,\n ) {\n let writeWithErrors = !graphQLResultHasError(result);\n if (ignoreErrors && graphQLResultHasError(result) && result.data) {\n writeWithErrors = true;\n }\n if (!fetchMoreForQueryId && writeWithErrors) {\n this.cache.write({\n result: result.data,\n dataId: 'ROOT_QUERY',\n query: document,\n variables: variables,\n });\n }\n }\n\n public markSubscriptionResult(\n result: ExecutionResult,\n document: DocumentNode,\n variables: any,\n ) {\n // the subscription interface should handle not sending us results we no longer subscribe to.\n // XXX I don't think we ever send in an object with errors, but we might in the future...\n if (!graphQLResultHasError(result)) {\n this.cache.write({\n result: result.data,\n dataId: 'ROOT_SUBSCRIPTION',\n query: document,\n variables: variables,\n });\n }\n }\n\n public markMutationInit(mutation: {\n mutationId: string;\n document: DocumentNode;\n variables: any;\n updateQueries: { [queryId: string]: QueryWithUpdater };\n update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined;\n optimisticResponse: Object | Function | undefined;\n }) {\n if (mutation.optimisticResponse) {\n let optimistic: Object;\n if (typeof mutation.optimisticResponse === 'function') {\n optimistic = mutation.optimisticResponse(mutation.variables);\n } else {\n optimistic = mutation.optimisticResponse;\n }\n\n this.cache.recordOptimisticTransaction(c => {\n const orig = this.cache;\n this.cache = c;\n\n try {\n this.markMutationResult({\n mutationId: mutation.mutationId,\n result: { data: optimistic },\n document: mutation.document,\n variables: mutation.variables,\n updateQueries: mutation.updateQueries,\n update: mutation.update,\n });\n } finally {\n this.cache = orig;\n }\n }, mutation.mutationId);\n }\n }\n\n public markMutationResult(mutation: {\n mutationId: string;\n result: ExecutionResult;\n document: DocumentNode;\n variables: any;\n updateQueries: { [queryId: string]: QueryWithUpdater };\n update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined;\n }) {\n // Incorporate the result from this mutation into the store\n if (!graphQLResultHasError(mutation.result)) {\n const cacheWrites: Cache.WriteOptions[] = [{\n result: mutation.result.data,\n dataId: 'ROOT_MUTATION',\n query: mutation.document,\n variables: mutation.variables,\n }];\n\n const { updateQueries } = mutation;\n if (updateQueries) {\n Object.keys(updateQueries).forEach(id => {\n const { query, updater } = updateQueries[id];\n\n // Read the current query result from the store.\n const { result: currentQueryResult, complete } = this.cache.diff({\n query: query.document,\n variables: query.variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n if (complete) {\n // Run our reducer using the current query result and the mutation result.\n const nextQueryResult = tryFunctionOrLogError(() =>\n updater(currentQueryResult, {\n mutationResult: mutation.result,\n queryName: getOperationName(query.document) || undefined,\n queryVariables: query.variables,\n }),\n );\n\n // Write the modified result back into the store if we got a new result.\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: 'ROOT_QUERY',\n query: query.document,\n variables: query.variables,\n });\n }\n }\n });\n }\n\n this.cache.performTransaction(c => {\n cacheWrites.forEach(write => c.write(write));\n\n // If the mutation has some writes associated with it then we need to\n // apply those writes to the store by running this reducer again with a\n // write action.\n const { update } = mutation;\n if (update) {\n tryFunctionOrLogError(() => update(c, mutation.result));\n }\n });\n }\n }\n\n public markMutationComplete({\n mutationId,\n optimisticResponse,\n }: {\n mutationId: string;\n optimisticResponse?: any;\n }) {\n if (optimisticResponse) {\n this.cache.removeOptimistic(mutationId);\n }\n }\n\n public markUpdateQueryResult(\n document: DocumentNode,\n variables: any,\n newResult: any,\n ) {\n this.cache.write({\n result: newResult,\n dataId: 'ROOT_QUERY',\n variables,\n query: document,\n });\n }\n\n public reset(): Promise {\n return this.cache.reset();\n }\n}\n","export const version = \"2.6.10\"","import {\n ApolloLink,\n FetchResult,\n GraphQLRequest,\n execute,\n} from 'apollo-link';\nimport { ExecutionResult, DocumentNode } from 'graphql';\nimport { ApolloCache, DataProxy } from 'apollo-cache';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { QueryManager } from './core/QueryManager';\nimport {\n ApolloQueryResult,\n OperationVariables,\n Resolvers,\n} from './core/types';\nimport { ObservableQuery } from './core/ObservableQuery';\nimport { LocalState, FragmentMatcher } from './core/LocalState';\nimport { Observable } from './util/Observable';\n\nimport {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n WatchQueryFetchPolicy,\n} from './core/watchQueryOptions';\n\nimport { DataStore } from './data/store';\n\nimport { version } from './version';\n\nexport interface DefaultOptions {\n watchQuery?: Partial;\n query?: Partial;\n mutate?: Partial;\n}\n\nlet hasSuggestedDevtools = false;\n\nexport type ApolloClientOptions = {\n link?: ApolloLink;\n cache: ApolloCache;\n ssrForceFetchDelay?: number;\n ssrMode?: boolean;\n connectToDevTools?: boolean;\n queryDeduplication?: boolean;\n defaultOptions?: DefaultOptions;\n assumeImmutableResults?: boolean;\n resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n fragmentMatcher?: FragmentMatcher;\n name?: string;\n version?: string;\n};\n\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over a {@link NetworkInterface} instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through {@link Observable} instances.\n */\nexport default class ApolloClient implements DataProxy {\n public link: ApolloLink;\n public store: DataStore;\n public cache: ApolloCache;\n public readonly queryManager: QueryManager;\n public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions = {};\n public readonly typeDefs: ApolloClientOptions['typeDefs'];\n\n private devToolsHookCb: Function;\n private resetStoreCallbacks: Array<() => Promise> = [];\n private clearStoreCallbacks: Array<() => Promise> = [];\n private localState: LocalState;\n\n /**\n * Constructs an instance of {@link ApolloClient}.\n *\n * @param link The {@link ApolloLink} over which GraphQL documents will be resolved into a response.\n *\n * @param cache The initial cache to use in the data store.\n *\n * @param ssrMode Determines whether this is being run in Server Side Rendering (SSR) mode.\n *\n * @param ssrForceFetchDelay Determines the time interval before we force fetch queries for a\n * server side render.\n *\n * @param queryDeduplication If set to false, a query will still be sent to the server even if a query\n * with identical parameters (query, variables, operationName) is already in flight.\n *\n * @param defaultOptions Used to set application wide defaults for the\n * options supplied to `watchQuery`, `query`, or\n * `mutate`.\n *\n * @param assumeImmutableResults When this option is true, the client will assume results\n * read from the cache are never mutated by application code,\n * which enables substantial performance optimizations. Passing\n * `{ freezeResults: true }` to the `InMemoryCache` constructor\n * can help enforce this immutability.\n *\n * @param name A custom name that can be used to identify this client, when\n * using Apollo client awareness features. E.g. \"iOS\".\n *\n * @param version A custom version that can be used to identify this client,\n * when using Apollo client awareness features. This is the\n * version of your client, which you may want to increment on\n * new builds. This is NOT the version of Apollo Client that\n * you are using.\n */\n constructor(options: ApolloClientOptions) {\n const {\n cache,\n ssrMode = false,\n ssrForceFetchDelay = 0,\n connectToDevTools,\n queryDeduplication = true,\n defaultOptions,\n assumeImmutableResults = false,\n resolvers,\n typeDefs,\n fragmentMatcher,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n } = options;\n\n let { link } = options;\n\n // If a link hasn't been defined, but local state resolvers have been set,\n // setup a default empty link.\n if (!link && resolvers) {\n link = ApolloLink.empty();\n }\n\n if (!link || !cache) {\n throw new InvariantError(\n \"In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\\n\" +\n \"These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\\n\" +\n \"For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup\"\n );\n }\n\n // remove apollo-client supported directives\n this.link = link;\n this.cache = cache;\n this.store = new DataStore(cache);\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || {};\n this.typeDefs = typeDefs;\n\n if (ssrForceFetchDelay) {\n setTimeout(\n () => (this.disableNetworkFetches = false),\n ssrForceFetchDelay,\n );\n }\n\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n\n // Attach the client instance to window to let us be found by chrome devtools, but only in\n // development mode\n const defaultConnectToDevTools =\n process.env.NODE_ENV !== 'production' &&\n typeof window !== 'undefined' &&\n !(window as any).__APOLLO_CLIENT__;\n\n if (\n typeof connectToDevTools === 'undefined'\n ? defaultConnectToDevTools\n : connectToDevTools && typeof window !== 'undefined'\n ) {\n (window as any).__APOLLO_CLIENT__ = this;\n }\n\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && process.env.NODE_ENV !== 'production') {\n hasSuggestedDevtools = true;\n if (\n typeof window !== 'undefined' &&\n window.document &&\n window.top === window.self\n ) {\n // First check if devtools is not installed\n if (\n typeof (window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined'\n ) {\n // Only for Chrome\n if (\n window.navigator &&\n window.navigator.userAgent &&\n window.navigator.userAgent.indexOf('Chrome') > -1\n ) {\n // tslint:disable-next-line\n console.debug(\n 'Download the Apollo DevTools ' +\n 'for a better development experience: ' +\n 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm',\n );\n }\n }\n }\n }\n\n this.version = version;\n\n this.localState = new LocalState({\n cache,\n client: this,\n resolvers,\n fragmentMatcher,\n });\n\n this.queryManager = new QueryManager({\n link: this.link,\n store: this.store,\n queryDeduplication,\n ssrMode,\n clientAwareness: {\n name: clientAwarenessName!,\n version: clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast: () => {\n if (this.devToolsHookCb) {\n this.devToolsHookCb({\n action: {},\n state: {\n queries: this.queryManager.queryStore.getStore(),\n mutations: this.queryManager.mutationStore.getStore(),\n },\n dataWithOptimisticResults: this.cache.extract(true),\n });\n }\n },\n });\n }\n\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n public stop() {\n this.queryManager.stop();\n }\n\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and\n * receive updated results through a GraphQL observer when the cache store changes.\n *

\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *

\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifer, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *

\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *

\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n public watchQuery(\n options: WatchQueryOptions,\n ): ObservableQuery {\n if (this.defaultOptions.watchQuery) {\n options = {\n ...this.defaultOptions.watchQuery,\n ...options,\n } as WatchQueryOptions;\n }\n\n // XXX Overwriting options is probably not the best way to do this long term...\n if (\n this.disableNetworkFetches &&\n (options.fetchPolicy === 'network-only' ||\n options.fetchPolicy === 'cache-and-network')\n ) {\n options = { ...options, fetchPolicy: 'cache-first' };\n }\n\n return this.queryManager.watchQuery(options);\n }\n\n /**\n * This resolves a single query according to the options specified and\n * returns a {@link Promise} which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options An object of type {@link QueryOptions} that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n public query(\n options: QueryOptions,\n ): Promise> {\n if (this.defaultOptions.query) {\n options = { ...this.defaultOptions.query, ...options } as QueryOptions<\n TVariables\n >;\n }\n\n invariant(\n (options.fetchPolicy as WatchQueryFetchPolicy) !== 'cache-and-network',\n 'The cache-and-network fetchPolicy does not work with client.query, because ' +\n 'client.query can only return a single result. Please use client.watchQuery ' +\n 'to receive multiple results from the cache and the network, or consider ' +\n 'using a different fetchPolicy, such as cache-first or network-only.'\n );\n\n if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {\n options = { ...options, fetchPolicy: 'cache-first' };\n }\n\n return this.queryManager.query(options);\n }\n\n /**\n * This resolves a single mutation according to the options specified and returns a\n * {@link Promise} which is either resolved with the resulting data or rejected with an\n * error.\n *\n * It takes options as an object with the following keys and values:\n */\n public mutate(\n options: MutationOptions,\n ): Promise> {\n if (this.defaultOptions.mutate) {\n options = {\n ...this.defaultOptions.mutate,\n ...options,\n } as MutationOptions;\n }\n\n return this.queryManager.mutate(options);\n }\n\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * {@link Observable} which either emits received data or an error.\n */\n public subscribe(\n options: SubscriptionOptions,\n ): Observable> {\n return this.queryManager.startGraphQLSubscription(options);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false,\n ): T | null {\n return this.cache.readQuery(options, optimistic);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false,\n ): T | null {\n return this.cache.readFragment(options, optimistic);\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n public writeQuery(\n options: DataProxy.WriteQueryOptions,\n ): void {\n const result = this.cache.writeQuery(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n public writeFragment(\n options: DataProxy.WriteFragmentOptions,\n ): void {\n const result = this.cache.writeFragment(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n /**\n * Sugar for writeQuery & writeFragment\n * This method will construct a query from the data object passed in.\n * If no id is supplied, writeData will write the data to the root.\n * If an id is supplied, writeData will write a fragment to the object\n * specified by the id in the store.\n *\n * Since you aren't passing in a query to check the shape of the data,\n * you must pass in an object that conforms to the shape of valid GraphQL data.\n */\n public writeData(\n options: DataProxy.WriteDataOptions,\n ): void {\n const result = this.cache.writeData(options);\n this.queryManager.broadcastQueries();\n return result;\n }\n\n public __actionHookForDevTools(cb: () => any) {\n this.devToolsHookCb = cb;\n }\n\n public __requestRaw(payload: GraphQLRequest): Observable {\n return execute(this.link, payload);\n }\n\n /**\n * This initializes the query manager that tracks queries and the cache\n */\n public initQueryManager(): QueryManager {\n invariant.warn(\n 'Calling the initQueryManager method is no longer necessary, ' +\n 'and it will be removed from ApolloClient in version 3.0.',\n );\n return this.queryManager;\n }\n\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public resetStore(): Promise[] | null> {\n return Promise.resolve()\n .then(() => this.queryManager.clearStore())\n .then(() => Promise.all(this.resetStoreCallbacks.map(fn => fn())))\n .then(() => this.reFetchObservableQueries());\n }\n\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n public clearStore(): Promise {\n return Promise.resolve()\n .then(() => this.queryManager.clearStore())\n .then(() => Promise.all(this.clearStoreCallbacks.map(fn => fn())));\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onResetStore(cb: () => Promise): () => void {\n this.resetStoreCallbacks.push(cb);\n return () => {\n this.resetStoreCallbacks = this.resetStoreCallbacks.filter(c => c !== cb);\n };\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onClearStore(cb: () => Promise): () => void {\n this.clearStoreCallbacks.push(cb);\n return () => {\n this.clearStoreCallbacks = this.clearStoreCallbacks.filter(c => c !== cb);\n };\n }\n\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n public reFetchObservableQueries(\n includeStandby?: boolean,\n ): Promise[]> {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n }\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public extract(optimistic?: boolean): TCacheShape {\n return this.cache.extract(optimistic);\n }\n\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public restore(serializedState: TCacheShape): ApolloCache {\n return this.cache.restore(serializedState);\n }\n\n /**\n * Add additional local resolvers.\n */\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\n */\n public setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-client/config/jest/setup.d.ts b/node_modules/apollo-client/config/jest/setup.d.ts deleted file mode 100644 index 34f15b40..00000000 --- a/node_modules/apollo-client/config/jest/setup.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=setup.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/config/jest/setup.d.ts.map b/node_modules/apollo-client/config/jest/setup.d.ts.map deleted file mode 100644 index 62b670a2..00000000 --- a/node_modules/apollo-client/config/jest/setup.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/config/jest/setup.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-client/config/jest/setup.js b/node_modules/apollo-client/config/jest/setup.js deleted file mode 100644 index e45f1b02..00000000 --- a/node_modules/apollo-client/config/jest/setup.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var graphql_tag_1 = require("graphql-tag"); -graphql_tag_1.disableFragmentWarnings(); -process.on('unhandledRejection', function () { }); -//# sourceMappingURL=setup.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/config/jest/setup.js.map b/node_modules/apollo-client/config/jest/setup.js.map deleted file mode 100644 index 56b7a5d6..00000000 --- a/node_modules/apollo-client/config/jest/setup.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/config/jest/setup.ts"],"names":[],"mappings":";;AAAA,2CAAsD;AAGtD,qCAAuB,EAAE,CAAC;AAE1B,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,cAAO,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/LocalState.d.ts b/node_modules/apollo-client/core/LocalState.d.ts deleted file mode 100644 index f78cf6fa..00000000 --- a/node_modules/apollo-client/core/LocalState.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { DocumentNode, FieldNode, ASTNode } from 'graphql'; -import { ApolloCache } from 'apollo-cache'; -import { FragmentMap } from 'apollo-utilities'; -import { FetchResult } from 'apollo-link'; -import ApolloClient from '../ApolloClient'; -import { Resolvers, OperationVariables } from './types'; -export declare type Resolver = (rootValue?: any, args?: any, context?: any, info?: { - field: FieldNode; - fragmentMap: FragmentMap; -}) => any; -export declare type VariableMap = { - [name: string]: any; -}; -export declare type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean; -export declare type ExecContext = { - fragmentMap: FragmentMap; - context: any; - variables: VariableMap; - fragmentMatcher: FragmentMatcher; - defaultOperationType: string; - exportedVariables: Record; - onlyRunForcedResolvers: boolean; -}; -export declare type LocalStateOptions = { - cache: ApolloCache; - client?: ApolloClient; - resolvers?: Resolvers | Resolvers[]; - fragmentMatcher?: FragmentMatcher; -}; -export declare class LocalState { - private cache; - private client; - private resolvers?; - private fragmentMatcher; - constructor({ cache, client, resolvers, fragmentMatcher, }: LocalStateOptions); - addResolvers(resolvers: Resolvers | Resolvers[]): void; - setResolvers(resolvers: Resolvers | Resolvers[]): void; - getResolvers(): Resolvers; - runResolvers({ document, remoteResult, context, variables, onlyRunForcedResolvers, }: { - document: DocumentNode | null; - remoteResult: FetchResult; - context?: Record; - variables?: Record; - onlyRunForcedResolvers?: boolean; - }): Promise>; - setFragmentMatcher(fragmentMatcher: FragmentMatcher): void; - getFragmentMatcher(): FragmentMatcher; - clientQuery(document: DocumentNode): DocumentNode | null; - serverQuery(document: DocumentNode): DocumentNode | null; - prepareContext(context?: {}): { - cache: ApolloCache; - getCacheKey: (obj: { - __typename: string; - id: string | number; - }) => any; - }; - addExportedVariables(document: DocumentNode, variables?: OperationVariables, context?: {}): Promise<{ - [x: string]: any; - }>; - shouldForceResolvers(document: ASTNode): boolean; - private buildRootValueFromCache; - private resolveDocument; - private resolveSelectionSet; - private resolveField; - private resolveSubSelectedArray; -} -//# sourceMappingURL=LocalState.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/LocalState.d.ts.map b/node_modules/apollo-client/core/LocalState.d.ts.map deleted file mode 100644 index 30d146f8..00000000 --- a/node_modules/apollo-client/core/LocalState.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"LocalState.d.ts","sourceRoot":"","sources":["../src/core/LocalState.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAMZ,SAAS,EACT,OAAO,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAOL,WAAW,EAQZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGxD,oBAAY,QAAQ,GAAG,CACrB,SAAS,CAAC,EAAE,GAAG,EACf,IAAI,CAAC,EAAE,GAAG,EACV,OAAO,CAAC,EAAE,GAAG,EACb,IAAI,CAAC,EAAE;IACL,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;CAC1B,KACE,GAAG,CAAC;AAET,oBAAY,WAAW,GAAG;IAAE,CAAC,IAAI,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WAAW,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAClC,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAkBxB,kBAAkB,CAAC,eAAe,EAAE,eAAe;IAInD,kBAAkB,IAAI,eAAe;IAMrC,WAAW,CAAC,QAAQ,EAAE,YAAY;IAgBlC,WAAW,CAAC,QAAQ,EAAE,YAAY;IAIlC,cAAc,CAAC,OAAO,KAAK;;;;;;;IAyBrB,oBAAoB,CAC/B,QAAQ,EAAE,YAAY,EACtB,SAAS,GAAE,kBAAuB,EAClC,OAAO,KAAK;;;IAmBP,oBAAoB,CAAC,QAAQ,EAAE,OAAO;IAuB7C,OAAO,CAAC,uBAAuB;YAYjB,eAAe;YA4Cf,mBAAmB;YAuDnB,YAAY;IA8E1B,OAAO,CAAC,uBAAuB;CAuBhC"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/LocalState.js b/node_modules/apollo-client/core/LocalState.js deleted file mode 100644 index 934f3e26..00000000 --- a/node_modules/apollo-client/core/LocalState.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var visitor_1 = require("graphql/language/visitor"); -var apollo_utilities_1 = require("apollo-utilities"); -var ts_invariant_1 = require("ts-invariant"); -var capitalizeFirstLetter_1 = require("../util/capitalizeFirstLetter"); -var LocalState = (function () { - function LocalState(_a) { - var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; - this.cache = cache; - if (client) { - this.client = client; - } - if (resolvers) { - this.addResolvers(resolvers); - } - if (fragmentMatcher) { - this.setFragmentMatcher(fragmentMatcher); - } - } - LocalState.prototype.addResolvers = function (resolvers) { - var _this = this; - this.resolvers = this.resolvers || {}; - if (Array.isArray(resolvers)) { - resolvers.forEach(function (resolverGroup) { - _this.resolvers = apollo_utilities_1.mergeDeep(_this.resolvers, resolverGroup); - }); - } - else { - this.resolvers = apollo_utilities_1.mergeDeep(this.resolvers, resolvers); - } - }; - LocalState.prototype.setResolvers = function (resolvers) { - this.resolvers = {}; - this.addResolvers(resolvers); - }; - LocalState.prototype.getResolvers = function () { - return this.resolvers || {}; - }; - LocalState.prototype.runResolvers = function (_a) { - var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; - return tslib_1.__awaiter(this, void 0, void 0, function () { - return tslib_1.__generator(this, function (_c) { - if (document) { - return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib_1.__assign(tslib_1.__assign({}, remoteResult), { data: localResult.result })); })]; - } - return [2, remoteResult]; - }); - }); - }; - LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { - this.fragmentMatcher = fragmentMatcher; - }; - LocalState.prototype.getFragmentMatcher = function () { - return this.fragmentMatcher; - }; - LocalState.prototype.clientQuery = function (document) { - if (apollo_utilities_1.hasDirectives(['client'], document)) { - if (this.resolvers) { - return document; - } - ts_invariant_1.invariant.warn('Found @client directives in a query but no ApolloClient resolvers ' + - 'were specified. This means ApolloClient local resolver handling ' + - 'has been disabled, and @client directives will be passed through ' + - 'to your link chain.'); - } - return null; - }; - LocalState.prototype.serverQuery = function (document) { - return this.resolvers ? apollo_utilities_1.removeClientSetsFromDocument(document) : document; - }; - LocalState.prototype.prepareContext = function (context) { - if (context === void 0) { context = {}; } - var cache = this.cache; - var newContext = tslib_1.__assign(tslib_1.__assign({}, context), { cache: cache, getCacheKey: function (obj) { - if (cache.config) { - return cache.config.dataIdFromObject(obj); - } - else { - ts_invariant_1.invariant(false, 'To use context.getCacheKey, you need to use a cache that has ' + - 'a configurable dataIdFromObject, like apollo-cache-inmemory.'); - } - } }); - return newContext; - }; - LocalState.prototype.addExportedVariables = function (document, variables, context) { - if (variables === void 0) { variables = {}; } - if (context === void 0) { context = {}; } - return tslib_1.__awaiter(this, void 0, void 0, function () { - return tslib_1.__generator(this, function (_a) { - if (document) { - return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib_1.__assign(tslib_1.__assign({}, variables), data.exportedVariables)); })]; - } - return [2, tslib_1.__assign({}, variables)]; - }); - }); - }; - LocalState.prototype.shouldForceResolvers = function (document) { - var forceResolvers = false; - visitor_1.visit(document, { - Directive: { - enter: function (node) { - if (node.name.value === 'client' && node.arguments) { - forceResolvers = node.arguments.some(function (arg) { - return arg.name.value === 'always' && - arg.value.kind === 'BooleanValue' && - arg.value.value === true; - }); - if (forceResolvers) { - return visitor_1.BREAK; - } - } - }, - }, - }); - return forceResolvers; - }; - LocalState.prototype.buildRootValueFromCache = function (document, variables) { - return this.cache.diff({ - query: apollo_utilities_1.buildQueryFromSelectionSet(document), - variables: variables, - returnPartialData: true, - optimistic: false, - }).result; - }; - LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { - if (context === void 0) { context = {}; } - if (variables === void 0) { variables = {}; } - if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } - if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } - return tslib_1.__awaiter(this, void 0, void 0, function () { - var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; - return tslib_1.__generator(this, function (_b) { - mainDefinition = apollo_utilities_1.getMainDefinition(document); - fragments = apollo_utilities_1.getFragmentDefinitions(document); - fragmentMap = apollo_utilities_1.createFragmentMap(fragments); - definitionOperation = mainDefinition - .operation; - defaultOperationType = definitionOperation - ? capitalizeFirstLetter_1.capitalizeFirstLetter(definitionOperation) - : 'Query'; - _a = this, cache = _a.cache, client = _a.client; - execContext = { - fragmentMap: fragmentMap, - context: tslib_1.__assign(tslib_1.__assign({}, context), { cache: cache, - client: client }), - variables: variables, - fragmentMatcher: fragmentMatcher, - defaultOperationType: defaultOperationType, - exportedVariables: {}, - onlyRunForcedResolvers: onlyRunForcedResolvers, - }; - return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({ - result: result, - exportedVariables: execContext.exportedVariables, - }); })]; - }); - }); - }; - LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { - return tslib_1.__awaiter(this, void 0, void 0, function () { - var fragmentMap, context, variables, resultsToMerge, execute; - var _this = this; - return tslib_1.__generator(this, function (_a) { - fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; - resultsToMerge = [rootValue]; - execute = function (selection) { return tslib_1.__awaiter(_this, void 0, void 0, function () { - var fragment, typeCondition; - return tslib_1.__generator(this, function (_a) { - if (!apollo_utilities_1.shouldInclude(selection, variables)) { - return [2]; - } - if (apollo_utilities_1.isField(selection)) { - return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { - var _a; - if (typeof fieldResult !== 'undefined') { - resultsToMerge.push((_a = {}, - _a[apollo_utilities_1.resultKeyNameFromField(selection)] = fieldResult, - _a)); - } - })]; - } - if (apollo_utilities_1.isInlineFragment(selection)) { - fragment = selection; - } - else { - fragment = fragmentMap[selection.name.value]; - ts_invariant_1.invariant(fragment, "No fragment named " + selection.name.value); - } - if (fragment && fragment.typeCondition) { - typeCondition = fragment.typeCondition.name.value; - if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { - return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { - resultsToMerge.push(fragmentResult); - })]; - } - } - return [2]; - }); - }); }; - return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { - return apollo_utilities_1.mergeDeepArray(resultsToMerge); - })]; - }); - }); - }; - LocalState.prototype.resolveField = function (field, rootValue, execContext) { - return tslib_1.__awaiter(this, void 0, void 0, function () { - var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; - var _this = this; - return tslib_1.__generator(this, function (_a) { - variables = execContext.variables; - fieldName = field.name.value; - aliasedFieldName = apollo_utilities_1.resultKeyNameFromField(field); - aliasUsed = fieldName !== aliasedFieldName; - defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; - resultPromise = Promise.resolve(defaultResult); - if (!execContext.onlyRunForcedResolvers || - this.shouldForceResolvers(field)) { - resolverType = rootValue.__typename || execContext.defaultOperationType; - resolverMap = this.resolvers && this.resolvers[resolverType]; - if (resolverMap) { - resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; - if (resolve) { - resultPromise = Promise.resolve(resolve(rootValue, apollo_utilities_1.argumentsObjectFromField(field, variables), execContext.context, { field: field, fragmentMap: execContext.fragmentMap })); - } - } - } - return [2, resultPromise.then(function (result) { - if (result === void 0) { result = defaultResult; } - if (field.directives) { - field.directives.forEach(function (directive) { - if (directive.name.value === 'export' && directive.arguments) { - directive.arguments.forEach(function (arg) { - if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { - execContext.exportedVariables[arg.value.value] = result; - } - }); - } - }); - } - if (!field.selectionSet) { - return result; - } - if (result == null) { - return result; - } - if (Array.isArray(result)) { - return _this.resolveSubSelectedArray(field, result, execContext); - } - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, result, execContext); - } - })]; - }); - }); - }; - LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { - var _this = this; - return Promise.all(result.map(function (item) { - if (item === null) { - return null; - } - if (Array.isArray(item)) { - return _this.resolveSubSelectedArray(field, item, execContext); - } - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, item, execContext); - } - })); - }; - return LocalState; -}()); -exports.LocalState = LocalState; -//# sourceMappingURL=LocalState.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/LocalState.js.map b/node_modules/apollo-client/core/LocalState.js.map deleted file mode 100644 index c2282fea..00000000 --- a/node_modules/apollo-client/core/LocalState.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"LocalState.js","sourceRoot":"","sources":["../../src/core/LocalState.ts"],"names":[],"mappings":";;;AAUA,oDAAwD;AAGxD,qDAe0B;AAG1B,6CAAyC;AAIzC,uEAAsE;AAqCtE;IAME,oBAAY,EAKqB;YAJ/B,gBAAK,EACL,kBAAM,EACN,wBAAS,EACT,oCAAe;QAEf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;QAED,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;SAC9B;QAED,IAAI,eAAe,EAAE;YACnB,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;SAC1C;IACH,CAAC;IAEM,iCAAY,GAAnB,UAAoB,SAAkC;QAAtD,iBASC;QARC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;QACtC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC5B,SAAS,CAAC,OAAO,CAAC,UAAA,aAAa;gBAC7B,KAAI,CAAC,SAAS,GAAG,4BAAS,CAAC,KAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,4BAAS,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SACvD;IACH,CAAC;IAEM,iCAAY,GAAnB,UAAoB,SAAkC;QACpD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAEM,iCAAY,GAAnB;QACE,OAAO,IAAI,CAAC,SAAS,IAAI,EAA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AK,CAAC,YAAY,EAAE;4BACtB,OAAO,KAAI,CAAC,mBAAmB,CAC7B,KAAK,CAAC,YAAY,EAClB,MAAM,EACN,WAAW,CACZ,CAAC;yBACH;oBACH,CAAC,CAAC,EAAC;;;KACJ;IAEO,4CAAuB,GAA/B,UACE,KAAgB,EAChB,MAAa,EACb,WAAwB;QAH1B,iBAsBC;QAjBC,OAAO,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,GAAG,CAAC,UAAA,IAAI;YACb,IAAI,IAAI,KAAK,IAAI,EAAE;gBACjB,OAAO,IAAI,CAAC;aACb;YAGD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACvB,OAAO,KAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;aAC/D;YAGD,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,OAAO,KAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;aACxE;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IACH,iBAAC;AAAD,CAAC,AAzYD,IAyYC;AAzYY,gCAAU"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/ObservableQuery.d.ts b/node_modules/apollo-client/core/ObservableQuery.d.ts deleted file mode 100644 index 1b1194b5..00000000 --- a/node_modules/apollo-client/core/ObservableQuery.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { GraphQLError } from 'graphql'; -import { NetworkStatus } from './networkStatus'; -import { Observable } from '../util/Observable'; -import { ApolloError } from '../errors/ApolloError'; -import { QueryManager } from './QueryManager'; -import { ApolloQueryResult, OperationVariables } from './types'; -import { WatchQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions, ErrorPolicy } from './watchQueryOptions'; -import { QueryStoreValue } from '../data/queries'; -export declare type ApolloCurrentResult = { - data: T | {}; - errors?: ReadonlyArray; - loading: boolean; - networkStatus: NetworkStatus; - error?: ApolloError; - partial?: boolean; -}; -export declare type ApolloCurrentQueryResult = { - data: T | undefined; - errors?: ReadonlyArray; - loading: boolean; - networkStatus: NetworkStatus; - error?: ApolloError; - partial?: boolean; - stale?: boolean; -}; -export interface FetchMoreOptions { - updateQuery: (previousQueryResult: TData, options: { - fetchMoreResult?: TData; - variables?: TVariables; - }) => TData; -} -export interface UpdateQueryOptions { - variables?: TVariables; -} -export declare const hasError: (storeValue: QueryStoreValue, policy?: ErrorPolicy) => boolean | Error; -export declare class ObservableQuery extends Observable> { - options: WatchQueryOptions; - readonly queryId: string; - readonly queryName?: string; - variables: TVariables; - private shouldSubscribe; - private isTornDown; - private queryManager; - private observers; - private subscriptions; - private lastResult; - private lastResultSnapshot; - private lastError; - constructor({ queryManager, options, shouldSubscribe, }: { - queryManager: QueryManager; - options: WatchQueryOptions; - shouldSubscribe?: boolean; - }); - result(): Promise>; - currentResult(): ApolloCurrentResult; - getCurrentResult(): ApolloCurrentQueryResult; - isDifferentFromLastResult(newResult: ApolloQueryResult): boolean; - getLastResult(): ApolloQueryResult; - getLastError(): ApolloError; - resetLastResults(): void; - resetQueryStoreErrors(): void; - refetch(variables?: TVariables): Promise>; - fetchMore(fetchMoreOptions: FetchMoreQueryOptions & FetchMoreOptions): Promise>; - subscribeToMore(options: SubscribeToMoreOptions): () => void; - setOptions(opts: WatchQueryOptions): Promise | void>; - setVariables(variables: TVariables, tryFetch?: boolean, fetchResults?: boolean): Promise | void>; - updateQuery(mapFn: (previousQueryResult: TData, options: UpdateQueryOptions) => TData): void; - stopPolling(): void; - startPolling(pollInterval: number): void; - private updateLastResult; - private onSubscribe; - private setUpQuery; - private tearDownQuery; -} -//# sourceMappingURL=ObservableQuery.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/ObservableQuery.d.ts.map b/node_modules/apollo-client/core/ObservableQuery.d.ts.map deleted file mode 100644 index 88e84586..00000000 --- a/node_modules/apollo-client/core/ObservableQuery.d.ts.map +++ /dev/null @@ -1 +0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K,CAAC;IAa7D,aAAa,IAAI,iBAAiB,CAAC,KAAK,CAAC;IAIzC,YAAY,IAAI,WAAW;IAI3B,gBAAgB,IAAI,IAAI;IAOxB,qBAAqB;IAerB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAwClE,SAAS,CAAC,CAAC,SAAS,MAAM,UAAU,EACzC,gBAAgB,EAAE,qBAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,GACpD,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,GACpC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAiD7B,eAAe,CACpB,iBAAiB,GAAG,KAAK,EACzB,sBAAsB,GAAG,UAAU,EAEnC,OAAO,EAAE,sBAAsB,CAC7B,KAAK,EACL,sBAAsB,EACtB,iBAAiB,CAClB;IAwCI,UAAU,CACf,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAuDpC,YAAY,CACjB,SAAS,EAAE,UAAU,EACrB,QAAQ,GAAE,OAAe,EACzB,YAAY,UAAO,GAClB,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IA6BpC,WAAW,CAAC,KAAK,GAAG,UAAU,EACnC,KAAK,EAAE,CACL,mBAAmB,EAAE,KAAK,EAC1B,OAAO,EAAE,kBAAkB,CAAC,KAAK,CAAC,KAC/B,KAAK,GACT,IAAI;IAwBA,WAAW;IAKX,YAAY,CAAC,YAAY,EAAE,MAAM;IAMxC,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,WAAW;IA6BnB,OAAO,CAAC,UAAU;IAgElB,OAAO,CAAC,aAAa;CAetB"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/ObservableQuery.js b/node_modules/apollo-client/core/ObservableQuery.js deleted file mode 100644 index cf6160a8..00000000 --- a/node_modules/apollo-client/core/ObservableQuery.js +++ /dev/null @@ -1,367 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var apollo_utilities_1 = require("apollo-utilities"); -var networkStatus_1 = require("./networkStatus"); -var Observable_1 = require("../util/Observable"); -var ApolloError_1 = require("../errors/ApolloError"); -var types_1 = require("./types"); -var ts_invariant_1 = require("ts-invariant"); -var arrays_1 = require("../util/arrays"); -exports.hasError = function (storeValue, policy) { - if (policy === void 0) { policy = 'none'; } - return storeValue && (storeValue.networkError || - (policy === 'none' && arrays_1.isNonEmptyArray(storeValue.graphQLErrors))); -}; -var ObservableQuery = (function (_super) { - tslib_1.__extends(ObservableQuery, _super); - function ObservableQuery(_a) { - var queryManager = _a.queryManager, options = _a.options, _b = _a.shouldSubscribe, shouldSubscribe = _b === void 0 ? true : _b; - var _this = _super.call(this, function (observer) { - return _this.onSubscribe(observer); - }) || this; - _this.observers = new Set(); - _this.subscriptions = new Set(); - _this.isTornDown = false; - _this.options = options; - _this.variables = options.variables || {}; - _this.queryId = queryManager.generateQueryId(); - _this.shouldSubscribe = shouldSubscribe; - var opDef = apollo_utilities_1.getOperationDefinition(options.query); - _this.queryName = opDef && opDef.name && opDef.name.value; - _this.queryManager = queryManager; - return _this; - } - ObservableQuery.prototype.result = function () { - var _this = this; - return new Promise(function (resolve, reject) { - var observer = { - next: function (result) { - resolve(result); - _this.observers.delete(observer); - if (!_this.observers.size) { - _this.queryManager.removeQuery(_this.queryId); - } - setTimeout(function () { - subscription.unsubscribe(); - }, 0); - }, - error: reject, - }; - var subscription = _this.subscribe(observer); - }); - }; - ObservableQuery.prototype.currentResult = function () { - var result = this.getCurrentResult(); - if (result.data === undefined) { - result.data = {}; - } - return result; - }; - ObservableQuery.prototype.getCurrentResult = function () { - if (this.isTornDown) { - var lastResult = this.lastResult; - return { - data: !this.lastError && lastResult && lastResult.data || void 0, - error: this.lastError, - loading: false, - networkStatus: networkStatus_1.NetworkStatus.error, - }; - } - var _a = this.queryManager.getCurrentQueryResult(this), data = _a.data, partial = _a.partial; - var queryStoreValue = this.queryManager.queryStore.get(this.queryId); - var result; - var fetchPolicy = this.options.fetchPolicy; - var isNetworkFetchPolicy = fetchPolicy === 'network-only' || - fetchPolicy === 'no-cache'; - if (queryStoreValue) { - var networkStatus = queryStoreValue.networkStatus; - if (exports.hasError(queryStoreValue, this.options.errorPolicy)) { - return { - data: void 0, - loading: false, - networkStatus: networkStatus, - error: new ApolloError_1.ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError, - }), - }; - } - if (queryStoreValue.variables) { - this.options.variables = tslib_1.__assign(tslib_1.__assign({}, this.options.variables), queryStoreValue.variables); - this.variables = this.options.variables; - } - result = { - data: data, - loading: networkStatus_1.isNetworkRequestInFlight(networkStatus), - networkStatus: networkStatus, - }; - if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') { - result.errors = queryStoreValue.graphQLErrors; - } - } - else { - var loading = isNetworkFetchPolicy || - (partial && fetchPolicy !== 'cache-only'); - result = { - data: data, - loading: loading, - networkStatus: loading ? networkStatus_1.NetworkStatus.loading : networkStatus_1.NetworkStatus.ready, - }; - } - if (!partial) { - this.updateLastResult(tslib_1.__assign(tslib_1.__assign({}, result), { stale: false })); - } - return tslib_1.__assign(tslib_1.__assign({}, result), { partial: partial }); - }; - ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { - var snapshot = this.lastResultSnapshot; - return !(snapshot && - newResult && - snapshot.networkStatus === newResult.networkStatus && - snapshot.stale === newResult.stale && - apollo_utilities_1.isEqual(snapshot.data, newResult.data)); - }; - ObservableQuery.prototype.getLastResult = function () { - return this.lastResult; - }; - ObservableQuery.prototype.getLastError = function () { - return this.lastError; - }; - ObservableQuery.prototype.resetLastResults = function () { - delete this.lastResult; - delete this.lastResultSnapshot; - delete this.lastError; - this.isTornDown = false; - }; - ObservableQuery.prototype.resetQueryStoreErrors = function () { - var queryStore = this.queryManager.queryStore.get(this.queryId); - if (queryStore) { - queryStore.networkError = null; - queryStore.graphQLErrors = []; - } - }; - ObservableQuery.prototype.refetch = function (variables) { - var fetchPolicy = this.options.fetchPolicy; - if (fetchPolicy === 'cache-only') { - return Promise.reject(new ts_invariant_1.InvariantError('cache-only fetchPolicy option should not be used together with query refetch.')); - } - if (fetchPolicy !== 'no-cache' && - fetchPolicy !== 'cache-and-network') { - fetchPolicy = 'network-only'; - } - if (!apollo_utilities_1.isEqual(this.variables, variables)) { - this.variables = tslib_1.__assign(tslib_1.__assign({}, this.variables), variables); - } - if (!apollo_utilities_1.isEqual(this.options.variables, this.variables)) { - this.options.variables = tslib_1.__assign(tslib_1.__assign({}, this.options.variables), this.variables); - } - return this.queryManager.fetchQuery(this.queryId, tslib_1.__assign(tslib_1.__assign({}, this.options), { fetchPolicy: fetchPolicy }), types_1.FetchType.refetch); - }; - ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { - var _this = this; - ts_invariant_1.invariant(fetchMoreOptions.updateQuery, 'updateQuery option is required. This function defines how to update the query data with the new results.'); - var combinedOptions = tslib_1.__assign(tslib_1.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, this.options), fetchMoreOptions), { variables: tslib_1.__assign(tslib_1.__assign({}, this.variables), fetchMoreOptions.variables) }))), { fetchPolicy: 'network-only' }); - var qid = this.queryManager.generateQueryId(); - return this.queryManager - .fetchQuery(qid, combinedOptions, types_1.FetchType.normal, this.queryId) - .then(function (fetchMoreResult) { - _this.updateQuery(function (previousResult) { - return fetchMoreOptions.updateQuery(previousResult, { - fetchMoreResult: fetchMoreResult.data, - variables: combinedOptions.variables, - }); - }); - _this.queryManager.stopQuery(qid); - return fetchMoreResult; - }, function (error) { - _this.queryManager.stopQuery(qid); - throw error; - }); - }; - ObservableQuery.prototype.subscribeToMore = function (options) { - var _this = this; - var subscription = this.queryManager - .startGraphQLSubscription({ - query: options.document, - variables: options.variables, - }) - .subscribe({ - next: function (subscriptionData) { - var updateQuery = options.updateQuery; - if (updateQuery) { - _this.updateQuery(function (previous, _a) { - var variables = _a.variables; - return updateQuery(previous, { - subscriptionData: subscriptionData, - variables: variables, - }); - }); - } - }, - error: function (err) { - if (options.onError) { - options.onError(err); - return; - } - ts_invariant_1.invariant.error('Unhandled GraphQL subscription error', err); - }, - }); - this.subscriptions.add(subscription); - return function () { - if (_this.subscriptions.delete(subscription)) { - subscription.unsubscribe(); - } - }; - }; - ObservableQuery.prototype.setOptions = function (opts) { - var oldFetchPolicy = this.options.fetchPolicy; - this.options = tslib_1.__assign(tslib_1.__assign({}, this.options), opts); - if (opts.pollInterval) { - this.startPolling(opts.pollInterval); - } - else if (opts.pollInterval === 0) { - this.stopPolling(); - } - var fetchPolicy = opts.fetchPolicy; - return this.setVariables(this.options.variables, oldFetchPolicy !== fetchPolicy && (oldFetchPolicy === 'cache-only' || - oldFetchPolicy === 'standby' || - fetchPolicy === 'network-only'), opts.fetchResults); - }; - ObservableQuery.prototype.setVariables = function (variables, tryFetch, fetchResults) { - if (tryFetch === void 0) { tryFetch = false; } - if (fetchResults === void 0) { fetchResults = true; } - this.isTornDown = false; - variables = variables || this.variables; - if (!tryFetch && apollo_utilities_1.isEqual(variables, this.variables)) { - return this.observers.size && fetchResults - ? this.result() - : Promise.resolve(); - } - this.variables = this.options.variables = variables; - if (!this.observers.size) { - return Promise.resolve(); - } - return this.queryManager.fetchQuery(this.queryId, this.options); - }; - ObservableQuery.prototype.updateQuery = function (mapFn) { - var queryManager = this.queryManager; - var _a = queryManager.getQueryWithPreviousResult(this.queryId), previousResult = _a.previousResult, variables = _a.variables, document = _a.document; - var newResult = apollo_utilities_1.tryFunctionOrLogError(function () { - return mapFn(previousResult, { variables: variables }); - }); - if (newResult) { - queryManager.dataStore.markUpdateQueryResult(document, variables, newResult); - queryManager.broadcastQueries(); - } - }; - ObservableQuery.prototype.stopPolling = function () { - this.queryManager.stopPollingQuery(this.queryId); - this.options.pollInterval = undefined; - }; - ObservableQuery.prototype.startPolling = function (pollInterval) { - assertNotCacheFirstOrOnly(this); - this.options.pollInterval = pollInterval; - this.queryManager.startPollingQuery(this.options, this.queryId); - }; - ObservableQuery.prototype.updateLastResult = function (newResult) { - var previousResult = this.lastResult; - this.lastResult = newResult; - this.lastResultSnapshot = this.queryManager.assumeImmutableResults - ? newResult - : apollo_utilities_1.cloneDeep(newResult); - return previousResult; - }; - ObservableQuery.prototype.onSubscribe = function (observer) { - var _this = this; - try { - var subObserver = observer._subscription._observer; - if (subObserver && !subObserver.error) { - subObserver.error = defaultSubscriptionObserverErrorCallback; - } - } - catch (_a) { } - var first = !this.observers.size; - this.observers.add(observer); - if (observer.next && this.lastResult) - observer.next(this.lastResult); - if (observer.error && this.lastError) - observer.error(this.lastError); - if (first) { - this.setUpQuery(); - } - return function () { - if (_this.observers.delete(observer) && !_this.observers.size) { - _this.tearDownQuery(); - } - }; - }; - ObservableQuery.prototype.setUpQuery = function () { - var _this = this; - var _a = this, queryManager = _a.queryManager, queryId = _a.queryId; - if (this.shouldSubscribe) { - queryManager.addObservableQuery(queryId, this); - } - if (this.options.pollInterval) { - assertNotCacheFirstOrOnly(this); - queryManager.startPollingQuery(this.options, queryId); - } - var onError = function (error) { - _this.updateLastResult(tslib_1.__assign(tslib_1.__assign({}, _this.lastResult), { errors: error.graphQLErrors, networkStatus: networkStatus_1.NetworkStatus.error, loading: false })); - iterateObserversSafely(_this.observers, 'error', _this.lastError = error); - }; - queryManager.observeQuery(queryId, this.options, { - next: function (result) { - if (_this.lastError || _this.isDifferentFromLastResult(result)) { - var previousResult_1 = _this.updateLastResult(result); - var _a = _this.options, query_1 = _a.query, variables = _a.variables, fetchPolicy_1 = _a.fetchPolicy; - if (queryManager.transform(query_1).hasClientExports) { - queryManager.getLocalState().addExportedVariables(query_1, variables).then(function (variables) { - var previousVariables = _this.variables; - _this.variables = _this.options.variables = variables; - if (!result.loading && - previousResult_1 && - fetchPolicy_1 !== 'cache-only' && - queryManager.transform(query_1).serverQuery && - !apollo_utilities_1.isEqual(previousVariables, variables)) { - _this.refetch(); - } - else { - iterateObserversSafely(_this.observers, 'next', result); - } - }); - } - else { - iterateObserversSafely(_this.observers, 'next', result); - } - } - }, - error: onError, - }).catch(onError); - }; - ObservableQuery.prototype.tearDownQuery = function () { - var queryManager = this.queryManager; - this.isTornDown = true; - queryManager.stopPollingQuery(this.queryId); - this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); - this.subscriptions.clear(); - queryManager.removeObservableQuery(this.queryId); - queryManager.stopQuery(this.queryId); - this.observers.clear(); - }; - return ObservableQuery; -}(Observable_1.Observable)); -exports.ObservableQuery = ObservableQuery; -function defaultSubscriptionObserverErrorCallback(error) { - ts_invariant_1.invariant.error('Unhandled error', error.message, error.stack); -} -function iterateObserversSafely(observers, method, argument) { - var observersWithMethod = []; - observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); - observersWithMethod.forEach(function (obs) { return obs[method](argument); }); -} -function assertNotCacheFirstOrOnly(obsQuery) { - var fetchPolicy = obsQuery.options.fetchPolicy; - ts_invariant_1.invariant(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.'); -} -//# sourceMappingURL=ObservableQuery.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/ObservableQuery.js.map b/node_modules/apollo-client/core/ObservableQuery.js.map deleted file mode 100644 index 2983a91d..00000000 --- a/node_modules/apollo-client/core/ObservableQuery.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ObservableQuery.js","sourceRoot":"","sources":["../../src/core/ObservableQuery.ts"],"names":[],"mappings":";;;AAAA,qDAK0B;AAE1B,iDAA0E;AAC1E,iDAAwE;AACxE,qDAAoD;AAEpD,iCAA2E;AAU3E,6CAAyD;AACzD,yCAAiD;AAwCpC,QAAA,QAAQ,GAAG,UACtB,UAA2B,EAC3B,MAA4B;IAA5B,uBAAA,EAAA,eAA4B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AAED,SAAS,yBAAyB,CAChC,QAA4C;IAEpC,IAAA,0CAAW,CAAsB;IACzC,wBAAS,CACP,WAAW,KAAK,aAAa,IAAI,WAAW,KAAK,YAAY,EAC7D,mGAAmG,CACpG,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/QueryManager.d.ts b/node_modules/apollo-client/core/QueryManager.d.ts deleted file mode 100644 index 6a4a36d5..00000000 --- a/node_modules/apollo-client/core/QueryManager.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { ApolloLink, FetchResult } from 'apollo-link'; -import { DocumentNode } from 'graphql'; -import { Cache } from 'apollo-cache'; -import { Observer, Subscription, Observable } from '../util/Observable'; -import { DataStore } from '../data/store'; -import { MutationStore } from '../data/mutations'; -import { QueryStore } from '../data/queries'; -import { QueryOptions, WatchQueryOptions, SubscriptionOptions, MutationOptions } from './watchQueryOptions'; -import { ObservableQuery } from './ObservableQuery'; -import { QueryListener, ApolloQueryResult, FetchType, OperationVariables } from './types'; -import { LocalState } from './LocalState'; -export interface QueryInfo { - listeners: Set; - invalidated: boolean; - newData: Cache.DiffResult | null; - document: DocumentNode | null; - lastRequestId: number; - observableQuery: ObservableQuery | null; - subscriptions: Set; - cancel?: () => void; -} -export declare class QueryManager { - link: ApolloLink; - mutationStore: MutationStore; - queryStore: QueryStore; - dataStore: DataStore; - readonly assumeImmutableResults: boolean; - private queryDeduplication; - private clientAwareness; - private localState; - private onBroadcast; - private ssrMode; - private idCounter; - private queries; - private fetchQueryRejectFns; - constructor({ link, queryDeduplication, store, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, }: { - link: ApolloLink; - queryDeduplication?: boolean; - store: DataStore; - onBroadcast?: () => void; - ssrMode?: boolean; - clientAwareness?: Record; - localState?: LocalState; - assumeImmutableResults?: boolean; - }); - stop(): void; - mutate({ mutation, variables, optimisticResponse, updateQueries: updateQueriesByName, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, errorPolicy, fetchPolicy, context, }: MutationOptions): Promise>; - fetchQuery(queryId: string, options: WatchQueryOptions, fetchType?: FetchType, fetchMoreForQueryId?: string): Promise>; - private markQueryResult; - queryListenerForObserver(queryId: string, options: WatchQueryOptions, observer: Observer>): QueryListener; - private transformCache; - transform(document: DocumentNode): Readonly<{ - document: Readonly; - hasClientExports: boolean; - hasForcedResolvers: boolean; - clientQuery: Readonly | null; - serverQuery: Readonly | null; - defaultVars: Readonly; - }>; - private getVariables; - watchQuery(options: WatchQueryOptions, shouldSubscribe?: boolean): ObservableQuery; - query(options: QueryOptions): Promise>; - generateQueryId(): string; - stopQueryInStore(queryId: string): void; - private stopQueryInStoreNoBroadcast; - addQueryListener(queryId: string, listener: QueryListener): void; - updateQueryWatch(queryId: string, document: DocumentNode, options: WatchQueryOptions): () => void; - addObservableQuery(queryId: string, observableQuery: ObservableQuery): void; - removeObservableQuery(queryId: string): void; - clearStore(): Promise; - resetStore(): Promise[]>; - reFetchObservableQueries(includeStandby?: boolean): Promise[]>; - observeQuery(queryId: string, options: WatchQueryOptions, observer: Observer>): Promise, Record>>; - startQuery(queryId: string, options: WatchQueryOptions, listener: QueryListener): string; - startGraphQLSubscription({ query, fetchPolicy, variables, }: SubscriptionOptions): Observable>; - stopQuery(queryId: string): void; - private stopQueryNoBroadcast; - removeQuery(queryId: string): void; - getCurrentQueryResult(observableQuery: ObservableQuery, optimistic?: boolean): { - data: T | undefined; - partial: boolean; - }; - getQueryWithPreviousResult(queryIdOrObservable: string | ObservableQuery): { - previousResult: any; - variables: TVariables | undefined; - document: DocumentNode; - }; - broadcastQueries(): void; - getLocalState(): LocalState; - private inFlightLinkObservables; - private getObservableFromLink; - private fetchRequest; - private getQuery; - private setQuery; - private invalidate; - private prepareContext; - checkInFlight(queryId: string): boolean; - private pollingInfoByQueryId; - startPollingQuery(options: WatchQueryOptions, queryId: string, listener?: QueryListener): string; - stopPollingQuery(queryId: string): void; -} -//# sourceMappingURL=QueryManager.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/QueryManager.d.ts.map b/node_modules/apollo-client/core/QueryManager.d.ts.map deleted file mode 100644 index c31bab23..00000000 --- a/node_modules/apollo-client/core/QueryManager.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"QueryManager.d.ts","sourceRoot":"","sources":["../src/core/QueryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAerC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAoB,SAAS,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACtC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IAItB,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC7C,aAAa,EAAE,GAAG,CAAC,YAA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CAAC,UAAU;IASlB,OAAO,CAAC,cAAc;IAQf,aAAa,CAAC,OAAO,EAAE,MAAM;IAWpC,OAAO,CAAC,oBAAoB,CAIvB;IAEE,iBAAiB,CACtB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,aAAa,GACvB,MAAM;IAqDF,gBAAgB,CAAC,OAAO,EAAE,MAAM;CAGxC"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/QueryManager.js b/node_modules/apollo-client/core/QueryManager.js deleted file mode 100644 index ad590884..00000000 --- a/node_modules/apollo-client/core/QueryManager.js +++ /dev/null @@ -1,867 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var apollo_link_1 = require("apollo-link"); -var apollo_utilities_1 = require("apollo-utilities"); -var ts_invariant_1 = require("ts-invariant"); -var ApolloError_1 = require("../errors/ApolloError"); -var Observable_1 = require("../util/Observable"); -var mutations_1 = require("../data/mutations"); -var queries_1 = require("../data/queries"); -var ObservableQuery_1 = require("./ObservableQuery"); -var networkStatus_1 = require("./networkStatus"); -var types_1 = require("./types"); -var LocalState_1 = require("./LocalState"); -var observables_1 = require("../util/observables"); -var arrays_1 = require("../util/arrays"); -var hasOwnProperty = Object.prototype.hasOwnProperty; -var QueryManager = (function () { - function QueryManager(_a) { - var link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, store = _a.store, _c = _a.onBroadcast, onBroadcast = _c === void 0 ? function () { return undefined; } : _c, _d = _a.ssrMode, ssrMode = _d === void 0 ? false : _d, _e = _a.clientAwareness, clientAwareness = _e === void 0 ? {} : _e, localState = _a.localState, assumeImmutableResults = _a.assumeImmutableResults; - this.mutationStore = new mutations_1.MutationStore(); - this.queryStore = new queries_1.QueryStore(); - this.clientAwareness = {}; - this.idCounter = 1; - this.queries = new Map(); - this.fetchQueryRejectFns = new Map(); - this.transformCache = new (apollo_utilities_1.canUseWeakMap ? WeakMap : Map)(); - this.inFlightLinkObservables = new Map(); - this.pollingInfoByQueryId = new Map(); - this.link = link; - this.queryDeduplication = queryDeduplication; - this.dataStore = store; - this.onBroadcast = onBroadcast; - this.clientAwareness = clientAwareness; - this.localState = localState || new LocalState_1.LocalState({ cache: store.getCache() }); - this.ssrMode = ssrMode; - this.assumeImmutableResults = !!assumeImmutableResults; - } - QueryManager.prototype.stop = function () { - var _this = this; - this.queries.forEach(function (_info, queryId) { - _this.stopQueryNoBroadcast(queryId); - }); - this.fetchQueryRejectFns.forEach(function (reject) { - reject(new ts_invariant_1.InvariantError('QueryManager stopped while query was in flight')); - }); - }; - QueryManager.prototype.mutate = function (_a) { - var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueriesByName = _a.updateQueries, _b = _a.refetchQueries, refetchQueries = _b === void 0 ? [] : _b, _c = _a.awaitRefetchQueries, awaitRefetchQueries = _c === void 0 ? false : _c, updateWithProxyFn = _a.update, _d = _a.errorPolicy, errorPolicy = _d === void 0 ? 'none' : _d, fetchPolicy = _a.fetchPolicy, _e = _a.context, context = _e === void 0 ? {} : _e; - return tslib_1.__awaiter(this, void 0, void 0, function () { - var mutationId, generateUpdateQueriesInfo, self; - var _this = this; - return tslib_1.__generator(this, function (_f) { - switch (_f.label) { - case 0: - ts_invariant_1.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); - ts_invariant_1.invariant(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); - mutationId = this.generateQueryId(); - mutation = this.transform(mutation).document; - this.setQuery(mutationId, function () { return ({ document: mutation }); }); - variables = this.getVariables(mutation, variables); - if (!this.transform(mutation).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(mutation, variables, context)]; - case 1: - variables = _f.sent(); - _f.label = 2; - case 2: - generateUpdateQueriesInfo = function () { - var ret = {}; - if (updateQueriesByName) { - _this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) { - var queryName = observableQuery.queryName; - if (queryName && - hasOwnProperty.call(updateQueriesByName, queryName)) { - ret[queryId] = { - updater: updateQueriesByName[queryName], - query: _this.queryStore.get(queryId), - }; - } - } - }); - } - return ret; - }; - this.mutationStore.initMutation(mutationId, mutation, variables); - this.dataStore.markMutationInit({ - mutationId: mutationId, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn, - optimisticResponse: optimisticResponse, - }); - this.broadcastQueries(); - self = this; - return [2, new Promise(function (resolve, reject) { - var storeResult; - var error; - self.getObservableFromLink(mutation, tslib_1.__assign(tslib_1.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false).subscribe({ - next: function (result) { - if (apollo_utilities_1.graphQLResultHasError(result) && errorPolicy === 'none') { - error = new ApolloError_1.ApolloError({ - graphQLErrors: result.errors, - }); - return; - } - self.mutationStore.markMutationResult(mutationId); - if (fetchPolicy !== 'no-cache') { - self.dataStore.markMutationResult({ - mutationId: mutationId, - result: result, - document: mutation, - variables: variables, - updateQueries: generateUpdateQueriesInfo(), - update: updateWithProxyFn, - }); - } - storeResult = result; - }, - error: function (err) { - self.mutationStore.markMutationError(mutationId, err); - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse, - }); - self.broadcastQueries(); - self.setQuery(mutationId, function () { return ({ document: null }); }); - reject(new ApolloError_1.ApolloError({ - networkError: err, - })); - }, - complete: function () { - if (error) { - self.mutationStore.markMutationError(mutationId, error); - } - self.dataStore.markMutationComplete({ - mutationId: mutationId, - optimisticResponse: optimisticResponse, - }); - self.broadcastQueries(); - if (error) { - reject(error); - return; - } - if (typeof refetchQueries === 'function') { - refetchQueries = refetchQueries(storeResult); - } - var refetchQueryPromises = []; - if (arrays_1.isNonEmptyArray(refetchQueries)) { - refetchQueries.forEach(function (refetchQuery) { - if (typeof refetchQuery === 'string') { - self.queries.forEach(function (_a) { - var observableQuery = _a.observableQuery; - if (observableQuery && - observableQuery.queryName === refetchQuery) { - refetchQueryPromises.push(observableQuery.refetch()); - } - }); - } - else { - var queryOptions = { - query: refetchQuery.query, - variables: refetchQuery.variables, - fetchPolicy: 'network-only', - }; - if (refetchQuery.context) { - queryOptions.context = refetchQuery.context; - } - refetchQueryPromises.push(self.query(queryOptions)); - } - }); - } - Promise.all(awaitRefetchQueries ? refetchQueryPromises : []).then(function () { - self.setQuery(mutationId, function () { return ({ document: null }); }); - if (errorPolicy === 'ignore' && - storeResult && - apollo_utilities_1.graphQLResultHasError(storeResult)) { - delete storeResult.errors; - } - resolve(storeResult); - }); - }, - }); - })]; - } - }); - }); - }; - QueryManager.prototype.fetchQuery = function (queryId, options, fetchType, fetchMoreForQueryId) { - return tslib_1.__awaiter(this, void 0, void 0, function () { - var _a, metadata, _b, fetchPolicy, _c, context, query, variables, storeResult, isNetworkOnly, needToFetch, _d, complete, result, shouldFetch, requestId, cancel, networkResult; - var _this = this; - return tslib_1.__generator(this, function (_e) { - switch (_e.label) { - case 0: - _a = options.metadata, metadata = _a === void 0 ? null : _a, _b = options.fetchPolicy, fetchPolicy = _b === void 0 ? 'cache-first' : _b, _c = options.context, context = _c === void 0 ? {} : _c; - query = this.transform(options.query).document; - variables = this.getVariables(query, options.variables); - if (!this.transform(query).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(query, variables, context)]; - case 1: - variables = _e.sent(); - _e.label = 2; - case 2: - options = tslib_1.__assign(tslib_1.__assign({}, options), { variables: variables }); - isNetworkOnly = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; - needToFetch = isNetworkOnly; - if (!isNetworkOnly) { - _d = this.dataStore.getCache().diff({ - query: query, - variables: variables, - returnPartialData: true, - optimistic: false, - }), complete = _d.complete, result = _d.result; - needToFetch = !complete || fetchPolicy === 'cache-and-network'; - storeResult = result; - } - shouldFetch = needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby'; - if (apollo_utilities_1.hasDirectives(['live'], query)) - shouldFetch = true; - requestId = this.idCounter++; - cancel = fetchPolicy !== 'no-cache' - ? this.updateQueryWatch(queryId, query, options) - : undefined; - this.setQuery(queryId, function () { return ({ - document: query, - lastRequestId: requestId, - invalidated: true, - cancel: cancel, - }); }); - this.invalidate(fetchMoreForQueryId); - this.queryStore.initQuery({ - queryId: queryId, - document: query, - storePreviousVariables: shouldFetch, - variables: variables, - isPoll: fetchType === types_1.FetchType.poll, - isRefetch: fetchType === types_1.FetchType.refetch, - metadata: metadata, - fetchMoreForQueryId: fetchMoreForQueryId, - }); - this.broadcastQueries(); - if (shouldFetch) { - networkResult = this.fetchRequest({ - requestId: requestId, - queryId: queryId, - document: query, - options: options, - fetchMoreForQueryId: fetchMoreForQueryId, - }).catch(function (error) { - if (ApolloError_1.isApolloError(error)) { - throw error; - } - else { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId); - _this.invalidate(queryId); - _this.invalidate(fetchMoreForQueryId); - _this.broadcastQueries(); - } - throw new ApolloError_1.ApolloError({ networkError: error }); - } - }); - if (fetchPolicy !== 'cache-and-network') { - return [2, networkResult]; - } - networkResult.catch(function () { }); - } - this.queryStore.markQueryResultClient(queryId, !shouldFetch); - this.invalidate(queryId); - this.invalidate(fetchMoreForQueryId); - if (this.transform(query).hasForcedResolvers) { - return [2, this.localState.runResolvers({ - document: query, - remoteResult: { data: storeResult }, - context: context, - variables: variables, - onlyRunForcedResolvers: true, - }).then(function (result) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - _this.broadcastQueries(); - return result; - })]; - } - this.broadcastQueries(); - return [2, { data: storeResult }]; - } - }); - }); - }; - QueryManager.prototype.markQueryResult = function (queryId, result, _a, fetchMoreForQueryId) { - var fetchPolicy = _a.fetchPolicy, variables = _a.variables, errorPolicy = _a.errorPolicy; - if (fetchPolicy === 'no-cache') { - this.setQuery(queryId, function () { return ({ - newData: { result: result.data, complete: true }, - }); }); - } - else { - this.dataStore.markQueryResult(result, this.getQuery(queryId).document, variables, fetchMoreForQueryId, errorPolicy === 'ignore' || errorPolicy === 'all'); - } - }; - QueryManager.prototype.queryListenerForObserver = function (queryId, options, observer) { - var _this = this; - function invoke(method, argument) { - if (observer[method]) { - try { - observer[method](argument); - } - catch (e) { - ts_invariant_1.invariant.error(e); - } - } - else if (method === 'error') { - ts_invariant_1.invariant.error(argument); - } - } - return function (queryStoreValue, newData) { - _this.invalidate(queryId, false); - if (!queryStoreValue) - return; - var _a = _this.getQuery(queryId), observableQuery = _a.observableQuery, document = _a.document; - var fetchPolicy = observableQuery - ? observableQuery.options.fetchPolicy - : options.fetchPolicy; - if (fetchPolicy === 'standby') - return; - var loading = networkStatus_1.isNetworkRequestInFlight(queryStoreValue.networkStatus); - var lastResult = observableQuery && observableQuery.getLastResult(); - var networkStatusChanged = !!(lastResult && - lastResult.networkStatus !== queryStoreValue.networkStatus); - var shouldNotifyIfLoading = options.returnPartialData || - (!newData && queryStoreValue.previousVariables) || - (networkStatusChanged && options.notifyOnNetworkStatusChange) || - fetchPolicy === 'cache-only' || - fetchPolicy === 'cache-and-network'; - if (loading && !shouldNotifyIfLoading) { - return; - } - var hasGraphQLErrors = arrays_1.isNonEmptyArray(queryStoreValue.graphQLErrors); - var errorPolicy = observableQuery - && observableQuery.options.errorPolicy - || options.errorPolicy - || 'none'; - if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) { - return invoke('error', new ApolloError_1.ApolloError({ - graphQLErrors: queryStoreValue.graphQLErrors, - networkError: queryStoreValue.networkError, - })); - } - try { - var data = void 0; - var isMissing = void 0; - if (newData) { - if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') { - _this.setQuery(queryId, function () { return ({ newData: null }); }); - } - data = newData.result; - isMissing = !newData.complete; - } - else { - var lastError = observableQuery && observableQuery.getLastError(); - var errorStatusChanged = errorPolicy !== 'none' && - (lastError && lastError.graphQLErrors) !== - queryStoreValue.graphQLErrors; - if (lastResult && lastResult.data && !errorStatusChanged) { - data = lastResult.data; - isMissing = false; - } - else { - var diffResult = _this.dataStore.getCache().diff({ - query: document, - variables: queryStoreValue.previousVariables || - queryStoreValue.variables, - returnPartialData: true, - optimistic: true, - }); - data = diffResult.result; - isMissing = !diffResult.complete; - } - } - var stale = isMissing && !(options.returnPartialData || - fetchPolicy === 'cache-only'); - var resultFromStore = { - data: stale ? lastResult && lastResult.data : data, - loading: loading, - networkStatus: queryStoreValue.networkStatus, - stale: stale, - }; - if (errorPolicy === 'all' && hasGraphQLErrors) { - resultFromStore.errors = queryStoreValue.graphQLErrors; - } - invoke('next', resultFromStore); - } - catch (networkError) { - invoke('error', new ApolloError_1.ApolloError({ networkError: networkError })); - } - }; - }; - QueryManager.prototype.transform = function (document) { - var transformCache = this.transformCache; - if (!transformCache.has(document)) { - var cache = this.dataStore.getCache(); - var transformed = cache.transformDocument(document); - var forLink = apollo_utilities_1.removeConnectionDirectiveFromDocument(cache.transformForLink(transformed)); - var clientQuery = this.localState.clientQuery(transformed); - var serverQuery = this.localState.serverQuery(forLink); - var cacheEntry_1 = { - document: transformed, - hasClientExports: apollo_utilities_1.hasClientExports(transformed), - hasForcedResolvers: this.localState.shouldForceResolvers(transformed), - clientQuery: clientQuery, - serverQuery: serverQuery, - defaultVars: apollo_utilities_1.getDefaultValues(apollo_utilities_1.getOperationDefinition(transformed)), - }; - var add = function (doc) { - if (doc && !transformCache.has(doc)) { - transformCache.set(doc, cacheEntry_1); - } - }; - add(document); - add(transformed); - add(clientQuery); - add(serverQuery); - } - return transformCache.get(document); - }; - QueryManager.prototype.getVariables = function (document, variables) { - return tslib_1.__assign(tslib_1.__assign({}, this.transform(document).defaultVars), variables); - }; - QueryManager.prototype.watchQuery = function (options, shouldSubscribe) { - if (shouldSubscribe === void 0) { shouldSubscribe = true; } - ts_invariant_1.invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); - options.variables = this.getVariables(options.query, options.variables); - if (typeof options.notifyOnNetworkStatusChange === 'undefined') { - options.notifyOnNetworkStatusChange = false; - } - var transformedOptions = tslib_1.__assign({}, options); - return new ObservableQuery_1.ObservableQuery({ - queryManager: this, - options: transformedOptions, - shouldSubscribe: shouldSubscribe, - }); - }; - QueryManager.prototype.query = function (options) { - var _this = this; - ts_invariant_1.invariant(options.query, 'query option is required. You must specify your GraphQL document ' + - 'in the query option.'); - ts_invariant_1.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); - ts_invariant_1.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); - ts_invariant_1.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); - return new Promise(function (resolve, reject) { - var watchedQuery = _this.watchQuery(options, false); - _this.fetchQueryRejectFns.set("query:" + watchedQuery.queryId, reject); - watchedQuery - .result() - .then(resolve, reject) - .then(function () { - return _this.fetchQueryRejectFns.delete("query:" + watchedQuery.queryId); - }); - }); - }; - QueryManager.prototype.generateQueryId = function () { - return String(this.idCounter++); - }; - QueryManager.prototype.stopQueryInStore = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.broadcastQueries(); - }; - QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { - this.stopPollingQuery(queryId); - this.queryStore.stopQuery(queryId); - this.invalidate(queryId); - }; - QueryManager.prototype.addQueryListener = function (queryId, listener) { - this.setQuery(queryId, function (_a) { - var listeners = _a.listeners; - listeners.add(listener); - return { invalidated: false }; - }); - }; - QueryManager.prototype.updateQueryWatch = function (queryId, document, options) { - var _this = this; - var cancel = this.getQuery(queryId).cancel; - if (cancel) - cancel(); - var previousResult = function () { - var previousResult = null; - var observableQuery = _this.getQuery(queryId).observableQuery; - if (observableQuery) { - var lastResult = observableQuery.getLastResult(); - if (lastResult) { - previousResult = lastResult.data; - } - } - return previousResult; - }; - return this.dataStore.getCache().watch({ - query: document, - variables: options.variables, - optimistic: true, - previousResult: previousResult, - callback: function (newData) { - _this.setQuery(queryId, function () { return ({ invalidated: true, newData: newData }); }); - }, - }); - }; - QueryManager.prototype.addObservableQuery = function (queryId, observableQuery) { - this.setQuery(queryId, function () { return ({ observableQuery: observableQuery }); }); - }; - QueryManager.prototype.removeObservableQuery = function (queryId) { - var cancel = this.getQuery(queryId).cancel; - this.setQuery(queryId, function () { return ({ observableQuery: null }); }); - if (cancel) - cancel(); - }; - QueryManager.prototype.clearStore = function () { - this.fetchQueryRejectFns.forEach(function (reject) { - reject(new ts_invariant_1.InvariantError('Store reset while query was in flight (not completed in link chain)')); - }); - var resetIds = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) - resetIds.push(queryId); - }); - this.queryStore.reset(resetIds); - this.mutationStore.reset(); - return this.dataStore.reset(); - }; - QueryManager.prototype.resetStore = function () { - var _this = this; - return this.clearStore().then(function () { - return _this.reFetchObservableQueries(); - }); - }; - QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { - var _this = this; - if (includeStandby === void 0) { includeStandby = false; } - var observableQueryPromises = []; - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - if (observableQuery) { - var fetchPolicy = observableQuery.options.fetchPolicy; - observableQuery.resetLastResults(); - if (fetchPolicy !== 'cache-only' && - (includeStandby || fetchPolicy !== 'standby')) { - observableQueryPromises.push(observableQuery.refetch()); - } - _this.setQuery(queryId, function () { return ({ newData: null }); }); - _this.invalidate(queryId); - } - }); - this.broadcastQueries(); - return Promise.all(observableQueryPromises); - }; - QueryManager.prototype.observeQuery = function (queryId, options, observer) { - this.addQueryListener(queryId, this.queryListenerForObserver(queryId, options, observer)); - return this.fetchQuery(queryId, options); - }; - QueryManager.prototype.startQuery = function (queryId, options, listener) { - ts_invariant_1.invariant.warn("The QueryManager.startQuery method has been deprecated"); - this.addQueryListener(queryId, listener); - this.fetchQuery(queryId, options) - .catch(function () { return undefined; }); - return queryId; - }; - QueryManager.prototype.startGraphQLSubscription = function (_a) { - var _this = this; - var query = _a.query, fetchPolicy = _a.fetchPolicy, variables = _a.variables; - query = this.transform(query).document; - variables = this.getVariables(query, variables); - var makeObservable = function (variables) { - return _this.getObservableFromLink(query, {}, variables, false).map(function (result) { - if (!fetchPolicy || fetchPolicy !== 'no-cache') { - _this.dataStore.markSubscriptionResult(result, query, variables); - _this.broadcastQueries(); - } - if (apollo_utilities_1.graphQLResultHasError(result)) { - throw new ApolloError_1.ApolloError({ - graphQLErrors: result.errors, - }); - } - return result; - }); - }; - if (this.transform(query).hasClientExports) { - var observablePromise_1 = this.localState.addExportedVariables(query, variables).then(makeObservable); - return new Observable_1.Observable(function (observer) { - var sub = null; - observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error); - return function () { return sub && sub.unsubscribe(); }; - }); - } - return makeObservable(variables); - }; - QueryManager.prototype.stopQuery = function (queryId) { - this.stopQueryNoBroadcast(queryId); - this.broadcastQueries(); - }; - QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.removeQuery(queryId); - }; - QueryManager.prototype.removeQuery = function (queryId) { - this.fetchQueryRejectFns.delete("query:" + queryId); - this.fetchQueryRejectFns.delete("fetchRequest:" + queryId); - this.getQuery(queryId).subscriptions.forEach(function (x) { return x.unsubscribe(); }); - this.queries.delete(queryId); - }; - QueryManager.prototype.getCurrentQueryResult = function (observableQuery, optimistic) { - if (optimistic === void 0) { optimistic = true; } - var _a = observableQuery.options, variables = _a.variables, query = _a.query, fetchPolicy = _a.fetchPolicy, returnPartialData = _a.returnPartialData; - var lastResult = observableQuery.getLastResult(); - var newData = this.getQuery(observableQuery.queryId).newData; - if (newData && newData.complete) { - return { data: newData.result, partial: false }; - } - if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') { - return { data: undefined, partial: false }; - } - var _b = this.dataStore.getCache().diff({ - query: query, - variables: variables, - previousResult: lastResult ? lastResult.data : undefined, - returnPartialData: true, - optimistic: optimistic, - }), result = _b.result, complete = _b.complete; - return { - data: (complete || returnPartialData) ? result : void 0, - partial: !complete, - }; - }; - QueryManager.prototype.getQueryWithPreviousResult = function (queryIdOrObservable) { - var observableQuery; - if (typeof queryIdOrObservable === 'string') { - var foundObserveableQuery = this.getQuery(queryIdOrObservable).observableQuery; - ts_invariant_1.invariant(foundObserveableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); - observableQuery = foundObserveableQuery; - } - else { - observableQuery = queryIdOrObservable; - } - var _a = observableQuery.options, variables = _a.variables, query = _a.query; - return { - previousResult: this.getCurrentQueryResult(observableQuery, false).data, - variables: variables, - document: query, - }; - }; - QueryManager.prototype.broadcastQueries = function () { - var _this = this; - this.onBroadcast(); - this.queries.forEach(function (info, id) { - if (info.invalidated) { - info.listeners.forEach(function (listener) { - if (listener) { - listener(_this.queryStore.get(id), info.newData); - } - }); - } - }); - }; - QueryManager.prototype.getLocalState = function () { - return this.localState; - }; - QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { - var _this = this; - if (deduplication === void 0) { deduplication = this.queryDeduplication; } - var observable; - var serverQuery = this.transform(query).serverQuery; - if (serverQuery) { - var _a = this, inFlightLinkObservables_1 = _a.inFlightLinkObservables, link = _a.link; - var operation = { - query: serverQuery, - variables: variables, - operationName: apollo_utilities_1.getOperationName(serverQuery) || void 0, - context: this.prepareContext(tslib_1.__assign(tslib_1.__assign({}, context), { forceFetch: !deduplication })), - }; - context = operation.context; - if (deduplication) { - var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); - inFlightLinkObservables_1.set(serverQuery, byVariables_1); - var varJson_1 = JSON.stringify(variables); - observable = byVariables_1.get(varJson_1); - if (!observable) { - byVariables_1.set(varJson_1, observable = observables_1.multiplex(apollo_link_1.execute(link, operation))); - var cleanup = function () { - byVariables_1.delete(varJson_1); - if (!byVariables_1.size) - inFlightLinkObservables_1.delete(serverQuery); - cleanupSub_1.unsubscribe(); - }; - var cleanupSub_1 = observable.subscribe({ - next: cleanup, - error: cleanup, - complete: cleanup, - }); - } - } - else { - observable = observables_1.multiplex(apollo_link_1.execute(link, operation)); - } - } - else { - observable = Observable_1.Observable.of({ data: {} }); - context = this.prepareContext(context); - } - var clientQuery = this.transform(query).clientQuery; - if (clientQuery) { - observable = observables_1.asyncMap(observable, function (result) { - return _this.localState.runResolvers({ - document: clientQuery, - remoteResult: result, - context: context, - variables: variables, - }); - }); - } - return observable; - }; - QueryManager.prototype.fetchRequest = function (_a) { - var _this = this; - var requestId = _a.requestId, queryId = _a.queryId, document = _a.document, options = _a.options, fetchMoreForQueryId = _a.fetchMoreForQueryId; - var variables = options.variables, _b = options.errorPolicy, errorPolicy = _b === void 0 ? 'none' : _b, fetchPolicy = options.fetchPolicy; - var resultFromStore; - var errorsFromStore; - return new Promise(function (resolve, reject) { - var observable = _this.getObservableFromLink(document, options.context, variables); - var fqrfId = "fetchRequest:" + queryId; - _this.fetchQueryRejectFns.set(fqrfId, reject); - var cleanup = function () { - _this.fetchQueryRejectFns.delete(fqrfId); - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.delete(subscription); - }); - }; - var subscription = observable.map(function (result) { - if (requestId >= _this.getQuery(queryId).lastRequestId) { - _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); - _this.queryStore.markQueryResult(queryId, result, fetchMoreForQueryId); - _this.invalidate(queryId); - _this.invalidate(fetchMoreForQueryId); - _this.broadcastQueries(); - } - if (errorPolicy === 'none' && arrays_1.isNonEmptyArray(result.errors)) { - return reject(new ApolloError_1.ApolloError({ - graphQLErrors: result.errors, - })); - } - if (errorPolicy === 'all') { - errorsFromStore = result.errors; - } - if (fetchMoreForQueryId || fetchPolicy === 'no-cache') { - resultFromStore = result.data; - } - else { - var _a = _this.dataStore.getCache().diff({ - variables: variables, - query: document, - optimistic: false, - returnPartialData: true, - }), result_1 = _a.result, complete = _a.complete; - if (complete || options.returnPartialData) { - resultFromStore = result_1; - } - } - }).subscribe({ - error: function (error) { - cleanup(); - reject(error); - }, - complete: function () { - cleanup(); - resolve({ - data: resultFromStore, - errors: errorsFromStore, - loading: false, - networkStatus: networkStatus_1.NetworkStatus.ready, - stale: false, - }); - }, - }); - _this.setQuery(queryId, function (_a) { - var subscriptions = _a.subscriptions; - subscriptions.add(subscription); - }); - }); - }; - QueryManager.prototype.getQuery = function (queryId) { - return (this.queries.get(queryId) || { - listeners: new Set(), - invalidated: false, - document: null, - newData: null, - lastRequestId: 1, - observableQuery: null, - subscriptions: new Set(), - }); - }; - QueryManager.prototype.setQuery = function (queryId, updater) { - var prev = this.getQuery(queryId); - var newInfo = tslib_1.__assign(tslib_1.__assign({}, prev), updater(prev)); - this.queries.set(queryId, newInfo); - }; - QueryManager.prototype.invalidate = function (queryId, invalidated) { - if (invalidated === void 0) { invalidated = true; } - if (queryId) { - this.setQuery(queryId, function () { return ({ invalidated: invalidated }); }); - } - }; - QueryManager.prototype.prepareContext = function (context) { - if (context === void 0) { context = {}; } - var newContext = this.localState.prepareContext(context); - return tslib_1.__assign(tslib_1.__assign({}, newContext), { clientAwareness: this.clientAwareness }); - }; - QueryManager.prototype.checkInFlight = function (queryId) { - var query = this.queryStore.get(queryId); - return (query && - query.networkStatus !== networkStatus_1.NetworkStatus.ready && - query.networkStatus !== networkStatus_1.NetworkStatus.error); - }; - QueryManager.prototype.startPollingQuery = function (options, queryId, listener) { - var _this = this; - var pollInterval = options.pollInterval; - ts_invariant_1.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.'); - if (!this.ssrMode) { - var info = this.pollingInfoByQueryId.get(queryId); - if (!info) { - this.pollingInfoByQueryId.set(queryId, (info = {})); - } - info.interval = pollInterval; - info.options = tslib_1.__assign(tslib_1.__assign({}, options), { fetchPolicy: 'network-only' }); - var maybeFetch_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - if (info) { - if (_this.checkInFlight(queryId)) { - poll_1(); - } - else { - _this.fetchQuery(queryId, info.options, types_1.FetchType.poll).then(poll_1, poll_1); - } - } - }; - var poll_1 = function () { - var info = _this.pollingInfoByQueryId.get(queryId); - if (info) { - clearTimeout(info.timeout); - info.timeout = setTimeout(maybeFetch_1, info.interval); - } - }; - if (listener) { - this.addQueryListener(queryId, listener); - } - poll_1(); - } - return queryId; - }; - QueryManager.prototype.stopPollingQuery = function (queryId) { - this.pollingInfoByQueryId.delete(queryId); - }; - return QueryManager; -}()); -exports.QueryManager = QueryManager; -//# sourceMappingURL=QueryManager.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/QueryManager.js.map b/node_modules/apollo-client/core/QueryManager.js.map deleted file mode 100644 index c85ceb34..00000000 --- a/node_modules/apollo-client/core/QueryManager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"QueryManager.js","sourceRoot":"","sources":["../../src/core/QueryManager.ts"],"names":[],"mappings":";;;AAAA,2CAA+D;AAG/D,qDAS0B;AAE1B,6CAAyD;AAEzD,qDAAmE;AACnE,iDAAwE;AAExE,+CAAkD;AAClD,2CAA8D;AAS9D,qDAAoD;AACpD,iDAA0E;AAC1E,iCAKiB;AACjB,2CAA0C;AAC1C,mDAA0D;AAC1D,yCAAiD;AAEzC,IAAA,gDAAc,CAAsB;AAgB5C;IA6BE,sBAAY,EAkBX;YAjBC,cAAI,EACJ,0BAA0B,EAA1B,+CAA0B,EAC1B,gBAAK,EACL,mBAA6B,EAA7B,oEAA6B,EAC7B,eAAe,EAAf,oCAAe,EACf,uBAAoB,EAApB,yCAAoB,EACpB,0BAAU,EACV,kDAAsB;QAnCjB,kBAAa,GAAkB,IAAI,yBAAa,EAAE,CAAC;QACnD,eAAU,GAAe,IAAI,oBAAU,EAAE,CAAC;QAKzC,oBAAe,GAA2B,EAAE,CAAC;QAQ7C,cAAS,GAAG,CAAC,CAAC;QAId,YAAO,GAA2B,IAAI,GAAG,EAAE,CAAC;QAO5C,wBAAmB,GAAG,IAAI,GAAG,EAAoB,CAAC;QAujBlD,mBAAc,GAAG,IAAI,CAAC,gCAAa,CAAC,CAAC,CA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C,CAAC;oBAC3B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,YAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACtD;YACH,CAAC,CAAC;YAEF,IAAI,QAAQ,EAAE;gBACZ,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;aAC1C;YAED,MAAI,EAAE,CAAC;SACR;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEM,uCAAgB,GAAvB,UAAwB,OAAe;QACrC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IACH,mBAAC;AAAD,CAAC,AAt0CD,IAs0CC;AAt0CY,oCAAY"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/networkStatus.d.ts b/node_modules/apollo-client/core/networkStatus.d.ts deleted file mode 100644 index 630a906b..00000000 --- a/node_modules/apollo-client/core/networkStatus.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export declare enum NetworkStatus { - loading = 1, - setVariables = 2, - fetchMore = 3, - refetch = 4, - poll = 6, - ready = 7, - error = 8 -} -export declare function isNetworkRequestInFlight(networkStatus: NetworkStatus): boolean; -//# sourceMappingURL=networkStatus.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/networkStatus.d.ts.map b/node_modules/apollo-client/core/networkStatus.d.ts.map deleted file mode 100644 index 96239647..00000000 --- a/node_modules/apollo-client/core/networkStatus.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"networkStatus.d.ts","sourceRoot":"","sources":["../src/core/networkStatus.ts"],"names":[],"mappings":"AAGA,oBAAY,aAAa;IAMvB,OAAO,IAAI;IAMX,YAAY,IAAI;IAMhB,SAAS,IAAI;IAMb,OAAO,IAAI;IAOX,IAAI,IAAI;IAKR,KAAK,IAAI;IAKT,KAAK,IAAI;CACV;AAMD,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,aAAa,GAC3B,OAAO,CAET"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/networkStatus.js b/node_modules/apollo-client/core/networkStatus.js deleted file mode 100644 index 262f964c..00000000 --- a/node_modules/apollo-client/core/networkStatus.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var NetworkStatus; -(function (NetworkStatus) { - NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; - NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; - NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; - NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; - NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; - NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; - NetworkStatus[NetworkStatus["error"] = 8] = "error"; -})(NetworkStatus = exports.NetworkStatus || (exports.NetworkStatus = {})); -function isNetworkRequestInFlight(networkStatus) { - return networkStatus < 7; -} -exports.isNetworkRequestInFlight = isNetworkRequestInFlight; -//# sourceMappingURL=networkStatus.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/networkStatus.js.map b/node_modules/apollo-client/core/networkStatus.js.map deleted file mode 100644 index ebe2effc..00000000 --- a/node_modules/apollo-client/core/networkStatus.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"networkStatus.js","sourceRoot":"","sources":["../../src/core/networkStatus.ts"],"names":[],"mappings":";;AAGA,IAAY,aA0CX;AA1CD,WAAY,aAAa;IAMvB,uDAAW,CAAA;IAMX,iEAAgB,CAAA;IAMhB,2DAAa,CAAA;IAMb,uDAAW,CAAA;IAOX,iDAAQ,CAAA;IAKR,mDAAS,CAAA;IAKT,mDAAS,CAAA;AACX,CAAC,EA1CW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA0CxB;AAMD,SAAgB,wBAAwB,CACtC,aAA4B;IAE5B,OAAO,aAAa,GAAG,CAAC,CAAC;AAC3B,CAAC;AAJD,4DAIC"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/types.d.ts b/node_modules/apollo-client/core/types.d.ts deleted file mode 100644 index 714360ee..00000000 --- a/node_modules/apollo-client/core/types.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { FetchResult } from 'apollo-link'; -import { DocumentNode, GraphQLError } from 'graphql'; -import { QueryStoreValue } from '../data/queries'; -import { NetworkStatus } from './networkStatus'; -import { Resolver } from './LocalState'; -export declare type QueryListener = (queryStoreValue: QueryStoreValue, newData?: any, forceResolvers?: boolean) => void; -export declare type OperationVariables = { - [key: string]: any; -}; -export declare type PureQueryOptions = { - query: DocumentNode; - variables?: { - [key: string]: any; - }; - context?: any; -}; -export declare type ApolloQueryResult = { - data: T; - errors?: ReadonlyArray; - loading: boolean; - networkStatus: NetworkStatus; - stale: boolean; -}; -export declare enum FetchType { - normal = 1, - refetch = 2, - poll = 3 -} -export declare type MutationQueryReducer = (previousResult: Record, options: { - mutationResult: FetchResult; - queryName: string | undefined; - queryVariables: Record; -}) => Record; -export declare type MutationQueryReducersMap = { - [queryName: string]: MutationQueryReducer; -}; -export interface Resolvers { - [key: string]: { - [field: string]: Resolver; - }; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/types.d.ts.map b/node_modules/apollo-client/core/types.d.ts.map deleted file mode 100644 index 04c69fbf..00000000 --- a/node_modules/apollo-client/core/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,oBAAY,aAAa,GAAG,CAC1B,eAAe,EAA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AE,KAAK,EAAE,MAAM,GAAI,QAAQ,CAAC;KAC7B,CAAC;CACH"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/types.js b/node_modules/apollo-client/core/types.js deleted file mode 100644 index a0437d7f..00000000 --- a/node_modules/apollo-client/core/types.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var FetchType; -(function (FetchType) { - FetchType[FetchType["normal"] = 1] = "normal"; - FetchType[FetchType["refetch"] = 2] = "refetch"; - FetchType[FetchType["poll"] = 3] = "poll"; -})(FetchType = exports.FetchType || (exports.FetchType = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/types.js.map b/node_modules/apollo-client/core/types.js.map deleted file mode 100644 index 18778068..00000000 --- a/node_modules/apollo-client/core/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":";;AA6BA,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,6CAAU,CAAA;IACV,+CAAW,CAAA;IACX,yCAAQ,CAAA;AACV,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/watchQueryOptions.d.ts b/node_modules/apollo-client/core/watchQueryOptions.d.ts deleted file mode 100644 index d8f8bf78..00000000 --- a/node_modules/apollo-client/core/watchQueryOptions.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { DocumentNode } from 'graphql'; -import { FetchResult } from 'apollo-link'; -import { DataProxy } from 'apollo-cache'; -import { MutationQueryReducersMap } from './types'; -import { PureQueryOptions, OperationVariables } from './types'; -export declare type FetchPolicy = 'cache-first' | 'network-only' | 'cache-only' | 'no-cache' | 'standby'; -export declare type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network'; -export declare type ErrorPolicy = 'none' | 'ignore' | 'all'; -export interface QueryBaseOptions { - query: DocumentNode; - variables?: TVariables; - errorPolicy?: ErrorPolicy; - fetchResults?: boolean; - metadata?: any; - context?: any; -} -export interface QueryOptions extends QueryBaseOptions { - fetchPolicy?: FetchPolicy; -} -export interface ModifiableWatchQueryOptions extends QueryBaseOptions { - pollInterval?: number; - notifyOnNetworkStatusChange?: boolean; - returnPartialData?: boolean; -} -export interface WatchQueryOptions extends QueryBaseOptions, ModifiableWatchQueryOptions { - fetchPolicy?: WatchQueryFetchPolicy; -} -export interface FetchMoreQueryOptions { - query?: DocumentNode; - variables?: Pick; - context?: any; -} -export declare type UpdateQueryFn = (previousQueryResult: TData, options: { - subscriptionData: { - data: TSubscriptionData; - }; - variables?: TSubscriptionVariables; -}) => TData; -export declare type SubscribeToMoreOptions = { - document: DocumentNode; - variables?: TSubscriptionVariables; - updateQuery?: UpdateQueryFn; - onError?: (error: Error) => void; -}; -export interface SubscriptionOptions { - query: DocumentNode; - variables?: TVariables; - fetchPolicy?: FetchPolicy; -} -export declare type RefetchQueryDescription = Array; -export interface MutationBaseOptions { - optimisticResponse?: T | ((vars: TVariables) => T); - updateQueries?: MutationQueryReducersMap; - refetchQueries?: ((result: FetchResult) => RefetchQueryDescription) | RefetchQueryDescription; - awaitRefetchQueries?: boolean; - update?: MutationUpdaterFn; - errorPolicy?: ErrorPolicy; - variables?: TVariables; -} -export interface MutationOptions extends MutationBaseOptions { - mutation: DocumentNode; - context?: any; - fetchPolicy?: FetchPolicy; -} -export declare type MutationUpdaterFn = (proxy: DataProxy, mutationResult: FetchResult) => void; -//# sourceMappingURL=watchQueryOptions.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/watchQueryOptions.d.ts.map b/node_modules/apollo-client/core/watchQueryOptions.d.ts.map deleted file mode 100644 index afbd092b..00000000 --- a/node_modules/apollo-client/core/watchQueryOptions.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"watchQueryOptions.d.ts","sourceRoot":"","sources":["../src/core/watchQueryOptions.ts"],"names":[],"mappings":"AAAA,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CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,CAAC,CAAC;IAQnD,aAAa,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;IAU5C,cAAc,CAAC,EACX,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,uBAAuB,CAAC,GACrD,uBAAuB,CAAC;IAU5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAyB9B,MAAM,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAK9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAM1B,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,eAAe,CAC9B,CAAC,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC1B,UAAU,GAAG,kBAAkB,CAC/B,SAAQ,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC;IAK1C,QAAQ,EAAE,YAAY,CAAC;IAYvB,OAAO,CAAC,EAAE,GAAG,CAAC;IAKd,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAGD,oBAAY,iBAAiB,CAAC,CAAC,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAAI,CAC1D,KAAK,EAAE,SAAS,EAChB,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,KAC3B,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/core/watchQueryOptions.js b/node_modules/apollo-client/core/watchQueryOptions.js deleted file mode 100644 index 7a61e2ed..00000000 --- a/node_modules/apollo-client/core/watchQueryOptions.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=watchQueryOptions.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/core/watchQueryOptions.js.map b/node_modules/apollo-client/core/watchQueryOptions.js.map deleted file mode 100644 index 9ad66e30..00000000 --- a/node_modules/apollo-client/core/watchQueryOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-client/data/mutations.d.ts b/node_modules/apollo-client/data/mutations.d.ts deleted file mode 100644 index 1c6770c0..00000000 --- a/node_modules/apollo-client/data/mutations.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare class MutationStore { - private store; - getStore(): { - [mutationId: string]: MutationStoreValue; - }; - get(mutationId: string): MutationStoreValue; - initMutation(mutationId: string, mutation: DocumentNode, variables: Object | undefined): void; - markMutationError(mutationId: string, error: Error): void; - markMutationResult(mutationId: string): void; - reset(): void; -} -export interface MutationStoreValue { - mutation: DocumentNode; - variables: Object; - loading: boolean; - error: Error | null; -} -//# sourceMappingURL=mutations.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/data/mutations.d.ts.map b/node_modules/apollo-client/data/mutations.d.ts.map deleted file mode 100644 index cd6b5726..00000000 --- a/node_modules/apollo-client/data/mutations.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../src/data/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAoD;IAE1D,QAAQ,IAAI;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAAA;KAAE;IAIxD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB;IAI3C,YAAY,CACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,MAAM,GAAG,SAAS;IAUxB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;IAQlD,kBAAkB,CAAC,UAAU,EAAE,MAAM;IAQrC,KAAK;CAGb;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB"} \ No newline at end of file diff --git a/node_modules/apollo-client/data/mutations.js b/node_modules/apollo-client/data/mutations.js deleted file mode 100644 index 8779300b..00000000 --- a/node_modules/apollo-client/data/mutations.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var MutationStore = (function () { - function MutationStore() { - this.store = {}; - } - MutationStore.prototype.getStore = function () { - return this.store; - }; - MutationStore.prototype.get = function (mutationId) { - return this.store[mutationId]; - }; - MutationStore.prototype.initMutation = function (mutationId, mutation, variables) { - this.store[mutationId] = { - mutation: mutation, - variables: variables || {}, - loading: true, - error: null, - }; - }; - MutationStore.prototype.markMutationError = function (mutationId, error) { - var mutation = this.store[mutationId]; - if (mutation) { - mutation.loading = false; - mutation.error = error; - } - }; - MutationStore.prototype.markMutationResult = function (mutationId) { - var mutation = this.store[mutationId]; - if (mutation) { - mutation.loading = false; - mutation.error = null; - } - }; - MutationStore.prototype.reset = function () { - this.store = {}; - }; - return MutationStore; -}()); -exports.MutationStore = MutationStore; -//# sourceMappingURL=mutations.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/data/mutations.js.map b/node_modules/apollo-client/data/mutations.js.map deleted file mode 100644 index 1f5364f1..00000000 --- a/node_modules/apollo-client/data/mutations.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/data/mutations.ts"],"names":[],"mappings":";;AAEA;IAAA;QACU,UAAK,GAAiD,EAAE,CAAC;IA0CnE,CAAC;IAxCQ,gCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,2BAAG,GAAV,UAAW,UAAkB;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAEM,oCAAY,GAAnB,UACE,UAAkB,EAClB,QAAsB,EACtB,SAA6B;QAE7B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG;YACvB,QAAQ,UAAA;YACR,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;SACZ,CAAC;IACJ,CAAC;IAEM,yCAAiB,GAAxB,UAAyB,UAAkB,EAAE,KAAY;QACvD,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;YACzB,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;SACxB;IACH,CAAC;IAEM,0CAAkB,GAAzB,UAA0B,UAAkB;QAC1C,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;YACzB,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC;SACvB;IACH,CAAC;IAEM,6BAAK,GAAZ;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IACH,oBAAC;AAAD,CAAC,AA3CD,IA2CC;AA3CY,sCAAa"} \ No newline at end of file diff --git a/node_modules/apollo-client/data/queries.d.ts b/node_modules/apollo-client/data/queries.d.ts deleted file mode 100644 index 6b51294b..00000000 --- a/node_modules/apollo-client/data/queries.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { DocumentNode, GraphQLError, ExecutionResult } from 'graphql'; -import { NetworkStatus } from '../core/networkStatus'; -export declare type QueryStoreValue = { - document: DocumentNode; - variables: Object; - previousVariables?: Object | null; - networkStatus: NetworkStatus; - networkError?: Error | null; - graphQLErrors?: ReadonlyArray; - metadata: any; -}; -export declare class QueryStore { - private store; - getStore(): { - [queryId: string]: QueryStoreValue; - }; - get(queryId: string): QueryStoreValue; - initQuery(query: { - queryId: string; - document: DocumentNode; - storePreviousVariables: boolean; - variables: Object; - isPoll: boolean; - isRefetch: boolean; - metadata: any; - fetchMoreForQueryId: string | undefined; - }): void; - markQueryResult(queryId: string, result: ExecutionResult, fetchMoreForQueryId: string | undefined): void; - markQueryError(queryId: string, error: Error, fetchMoreForQueryId: string | undefined): void; - markQueryResultClient(queryId: string, complete: boolean): void; - stopQuery(queryId: string): void; - reset(observableQueryIds: string[]): void; -} -//# sourceMappingURL=queries.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/data/queries.d.ts.map b/node_modules/apollo-client/data/queries.d.ts.map deleted file mode 100644 index 70c3b714..00000000 --- a/node_modules/apollo-client/data/queries.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/data/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,oBAAY,eAAe,GAAG;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC5C,QAAQ,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAA8C;IAEpD,QAAQ,IAAI;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE;IAIlD,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;IAIrC,SAAS,CAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,YAAY,CAAC;QACvB,sBAAsB,EAAE,OAAO,CAAC;QAChC,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,EAAE,GAAG,CAAC;QACd,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;KACzC;IA2EM,eAAe,CACpB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,eAAe,EACvB,mBAAmB,EAAE,MAAM,GAAG,SAAS;IAoBlC,cAAc,CACnB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,mBAAmB,EAAE,MAAM,GAAG,SAAS;IAelC,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO;IAWxD,SAAS,CAAC,OAAO,EAAE,MAAM;IAIzB,KAAK,CAAC,kBAAkB,EAAE,MAAM,EAAE;CAU1C"} \ No newline at end of file diff --git a/node_modules/apollo-client/data/queries.js b/node_modules/apollo-client/data/queries.js deleted file mode 100644 index 22eadfff..00000000 --- a/node_modules/apollo-client/data/queries.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var apollo_utilities_1 = require("apollo-utilities"); -var ts_invariant_1 = require("ts-invariant"); -var networkStatus_1 = require("../core/networkStatus"); -var arrays_1 = require("../util/arrays"); -var QueryStore = (function () { - function QueryStore() { - this.store = {}; - } - QueryStore.prototype.getStore = function () { - return this.store; - }; - QueryStore.prototype.get = function (queryId) { - return this.store[queryId]; - }; - QueryStore.prototype.initQuery = function (query) { - var previousQuery = this.store[query.queryId]; - ts_invariant_1.invariant(!previousQuery || - previousQuery.document === query.document || - apollo_utilities_1.isEqual(previousQuery.document, query.document), 'Internal Error: may not update existing query string in store'); - var isSetVariables = false; - var previousVariables = null; - if (query.storePreviousVariables && - previousQuery && - previousQuery.networkStatus !== networkStatus_1.NetworkStatus.loading) { - if (!apollo_utilities_1.isEqual(previousQuery.variables, query.variables)) { - isSetVariables = true; - previousVariables = previousQuery.variables; - } - } - var networkStatus; - if (isSetVariables) { - networkStatus = networkStatus_1.NetworkStatus.setVariables; - } - else if (query.isPoll) { - networkStatus = networkStatus_1.NetworkStatus.poll; - } - else if (query.isRefetch) { - networkStatus = networkStatus_1.NetworkStatus.refetch; - } - else { - networkStatus = networkStatus_1.NetworkStatus.loading; - } - var graphQLErrors = []; - if (previousQuery && previousQuery.graphQLErrors) { - graphQLErrors = previousQuery.graphQLErrors; - } - this.store[query.queryId] = { - document: query.document, - variables: query.variables, - previousVariables: previousVariables, - networkError: null, - graphQLErrors: graphQLErrors, - networkStatus: networkStatus, - metadata: query.metadata, - }; - if (typeof query.fetchMoreForQueryId === 'string' && - this.store[query.fetchMoreForQueryId]) { - this.store[query.fetchMoreForQueryId].networkStatus = - networkStatus_1.NetworkStatus.fetchMore; - } - }; - QueryStore.prototype.markQueryResult = function (queryId, result, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) - return; - this.store[queryId].networkError = null; - this.store[queryId].graphQLErrors = arrays_1.isNonEmptyArray(result.errors) ? result.errors : []; - this.store[queryId].previousVariables = null; - this.store[queryId].networkStatus = networkStatus_1.NetworkStatus.ready; - if (typeof fetchMoreForQueryId === 'string' && - this.store[fetchMoreForQueryId]) { - this.store[fetchMoreForQueryId].networkStatus = networkStatus_1.NetworkStatus.ready; - } - }; - QueryStore.prototype.markQueryError = function (queryId, error, fetchMoreForQueryId) { - if (!this.store || !this.store[queryId]) - return; - this.store[queryId].networkError = error; - this.store[queryId].networkStatus = networkStatus_1.NetworkStatus.error; - if (typeof fetchMoreForQueryId === 'string') { - this.markQueryResultClient(fetchMoreForQueryId, true); - } - }; - QueryStore.prototype.markQueryResultClient = function (queryId, complete) { - var storeValue = this.store && this.store[queryId]; - if (storeValue) { - storeValue.networkError = null; - storeValue.previousVariables = null; - if (complete) { - storeValue.networkStatus = networkStatus_1.NetworkStatus.ready; - } - } - }; - QueryStore.prototype.stopQuery = function (queryId) { - delete this.store[queryId]; - }; - QueryStore.prototype.reset = function (observableQueryIds) { - var _this = this; - Object.keys(this.store).forEach(function (queryId) { - if (observableQueryIds.indexOf(queryId) < 0) { - _this.stopQuery(queryId); - } - else { - _this.store[queryId].networkStatus = networkStatus_1.NetworkStatus.loading; - } - }); - }; - return QueryStore; -}()); -exports.QueryStore = QueryStore; -//# sourceMappingURL=queries.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/data/queries.js.map b/node_modules/apollo-client/data/queries.js.map deleted file mode 100644 index 8e0c7519..00000000 --- a/node_modules/apollo-client/data/queries.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/data/queries.ts"],"names":[],"mappings":";;AACA,qDAA2C;AAC3C,6CAAyC;AACzC,uDAAsD;AACtD,yCAAiD;AAYjD;IAAA;QACU,UAAK,GAA2C,EAAE,CAAC;IAgK7D,CAAC;IA9JQ,6BAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,wBAAG,GAAV,UAAW,OAAe;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAEM,8BAAS,GAAhB,UAAiB,KAShB;QACC,IAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAKhD,wBAAS,CACP,CAAC,aAAa;YACd,aAAa,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;YACzC,0BAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,EAC/C,+DAA+D,CAChE,CAAC;QAEF,IAAI,cAAc,GAAG,KAAK,CAAC;QAE3B,IAAI,iBAAiB,GAAkB,IAAI,CAAC;QAC5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,QAAiB;QAC7D,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;YAC/B,UAAU,CAAC,iBAAiB,GAAG,IAAI,CAAC;YACpC,IAAI,QAAQ,EAAE;gBACZ,UAAU,CAAC,aAAa,GAAG,6BAAa,CAAC,KAAK,CAAC;aAChD;SACF;IACH,CAAC;IAEM,8BAAS,GAAhB,UAAiB,OAAe;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAEM,0BAAK,GAAZ,UAAa,kBAA4B;QAAzC,iBASC;QARC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAA,OAAO;YACrC,IAAI,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBAC3C,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACzB;iBAAM;gBAEL,KAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,aAAa,GAAG,6BAAa,CAAC,OAAO,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AAjKD,IAiKC;AAjKY,gCAAU"} \ No newline at end of file diff --git a/node_modules/apollo-client/data/store.d.ts b/node_modules/apollo-client/data/store.d.ts deleted file mode 100644 index 63613944..00000000 --- a/node_modules/apollo-client/data/store.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ExecutionResult, DocumentNode } from 'graphql'; -import { ApolloCache, DataProxy } from 'apollo-cache'; -import { QueryStoreValue } from '../data/queries'; -import { MutationQueryReducer } from '../core/types'; -export declare type QueryWithUpdater = { - updater: MutationQueryReducer; - query: QueryStoreValue; -}; -export interface DataWrite { - rootId: string; - result: any; - document: DocumentNode; - operationName: string | null; - variables: Object; -} -export declare class DataStore { - private cache; - constructor(initialCache: ApolloCache); - getCache(): ApolloCache; - markQueryResult(result: ExecutionResult, document: DocumentNode, variables: any, fetchMoreForQueryId: string | undefined, ignoreErrors?: boolean): void; - markSubscriptionResult(result: ExecutionResult, document: DocumentNode, variables: any): void; - markMutationInit(mutation: { - mutationId: string; - document: DocumentNode; - variables: any; - updateQueries: { - [queryId: string]: QueryWithUpdater; - }; - update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined; - optimisticResponse: Object | Function | undefined; - }): void; - markMutationResult(mutation: { - mutationId: string; - result: ExecutionResult; - document: DocumentNode; - variables: any; - updateQueries: { - [queryId: string]: QueryWithUpdater; - }; - update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined; - }): void; - markMutationComplete({ mutationId, optimisticResponse, }: { - mutationId: string; - optimisticResponse?: any; - }): void; - markUpdateQueryResult(document: DocumentNode, variables: any, newResult: any): void; - reset(): Promise; -} -//# sourceMappingURL=store.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/data/store.d.ts.map b/node_modules/apollo-client/data/store.d.ts.map deleted file mode 100644 index 7f0e559a..00000000 --- a/node_modules/apollo-client/data/store.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/data/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,WAAW,EAAS,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACtC,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,M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SAAS,CAAC;KAC1E;IA4DM,oBAAoB,CAAC,EAC1B,UAAU,EACV,kBAAkB,GACnB,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,kBAAkB,CAAC,EAAE,GAAG,CAAC;KAC1B;IAMM,qBAAqB,CAC1B,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,GAAG;IAUT,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"} \ No newline at end of file diff --git a/node_modules/apollo-client/data/store.js b/node_modules/apollo-client/data/store.js deleted file mode 100644 index aecfa79f..00000000 --- a/node_modules/apollo-client/data/store.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var apollo_utilities_1 = require("apollo-utilities"); -var DataStore = (function () { - function DataStore(initialCache) { - this.cache = initialCache; - } - DataStore.prototype.getCache = function () { - return this.cache; - }; - DataStore.prototype.markQueryResult = function (result, document, variables, fetchMoreForQueryId, ignoreErrors) { - if (ignoreErrors === void 0) { ignoreErrors = false; } - var writeWithErrors = !apollo_utilities_1.graphQLResultHasError(result); - if (ignoreErrors && apollo_utilities_1.graphQLResultHasError(result) && result.data) { - writeWithErrors = true; - } - if (!fetchMoreForQueryId && writeWithErrors) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_QUERY', - query: document, - variables: variables, - }); - } - }; - DataStore.prototype.markSubscriptionResult = function (result, document, variables) { - if (!apollo_utilities_1.graphQLResultHasError(result)) { - this.cache.write({ - result: result.data, - dataId: 'ROOT_SUBSCRIPTION', - query: document, - variables: variables, - }); - } - }; - DataStore.prototype.markMutationInit = function (mutation) { - var _this = this; - if (mutation.optimisticResponse) { - var optimistic_1; - if (typeof mutation.optimisticResponse === 'function') { - optimistic_1 = mutation.optimisticResponse(mutation.variables); - } - else { - optimistic_1 = mutation.optimisticResponse; - } - this.cache.recordOptimisticTransaction(function (c) { - var orig = _this.cache; - _this.cache = c; - try { - _this.markMutationResult({ - mutationId: mutation.mutationId, - result: { data: optimistic_1 }, - document: mutation.document, - variables: mutation.variables, - updateQueries: mutation.updateQueries, - update: mutation.update, - }); - } - finally { - _this.cache = orig; - } - }, mutation.mutationId); - } - }; - DataStore.prototype.markMutationResult = function (mutation) { - var _this = this; - if (!apollo_utilities_1.graphQLResultHasError(mutation.result)) { - var cacheWrites_1 = [{ - result: mutation.result.data, - dataId: 'ROOT_MUTATION', - query: mutation.document, - variables: mutation.variables, - }]; - var updateQueries_1 = mutation.updateQueries; - if (updateQueries_1) { - Object.keys(updateQueries_1).forEach(function (id) { - var _a = updateQueries_1[id], query = _a.query, updater = _a.updater; - var _b = _this.cache.diff({ - query: query.document, - variables: query.variables, - returnPartialData: true, - optimistic: false, - }), currentQueryResult = _b.result, complete = _b.complete; - if (complete) { - var nextQueryResult = apollo_utilities_1.tryFunctionOrLogError(function () { - return updater(currentQueryResult, { - mutationResult: mutation.result, - queryName: apollo_utilities_1.getOperationName(query.document) || undefined, - queryVariables: query.variables, - }); - }); - if (nextQueryResult) { - cacheWrites_1.push({ - result: nextQueryResult, - dataId: 'ROOT_QUERY', - query: query.document, - variables: query.variables, - }); - } - } - }); - } - this.cache.performTransaction(function (c) { - cacheWrites_1.forEach(function (write) { return c.write(write); }); - var update = mutation.update; - if (update) { - apollo_utilities_1.tryFunctionOrLogError(function () { return update(c, mutation.result); }); - } - }); - } - }; - DataStore.prototype.markMutationComplete = function (_a) { - var mutationId = _a.mutationId, optimisticResponse = _a.optimisticResponse; - if (optimisticResponse) { - this.cache.removeOptimistic(mutationId); - } - }; - DataStore.prototype.markUpdateQueryResult = function (document, variables, newResult) { - this.cache.write({ - result: newResult, - dataId: 'ROOT_QUERY', - variables: variables, - query: document, - }); - }; - DataStore.prototype.reset = function () { - return this.cache.reset(); - }; - return DataStore; -}()); -exports.DataStore = DataStore; -//# sourceMappingURL=store.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/data/store.js.map b/node_modules/apollo-client/data/store.js.map deleted file mode 100644 index 66905e96..00000000 --- a/node_modules/apollo-client/data/store.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/data/store.ts"],"names":[],"mappings":";;AAIA,qDAI0B;AAgB1B;IAGE,mBAAY,YAAsC;QAChD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;IAC5B,CAAC;IAEM,4BAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,mCAAe,GAAtB,UACE,MAAuB,EACvB,QAAsB,EACtB,SAAc,EACd,mBAAuC,EACvC,YAA6B;QAA7B,6BAAA,EAAA,oBAA6B;QAE7B,IAAI,eAAe,GAAG,CAAC,wCAAqB,CAAC,MAAM,CAAC,CAAC;QACrD,IAAI,YAAY,IAAI,wCAAqB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE;YAChE,eAAe,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,CAAC,mBAAmB,IAAI,eAAe,EAAE;YAC3C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;gBACf,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,MAAM,EAAE,YAAY;gBACpB,KAAK,EAAE,QAAQ;gBACf,SAAS,EAAE,SAAS;aACrB,CAAC,CAAC;SACJ;IACH,CAAC;IAEM,0CAAsB,GAA7B,UACE,MAAuB,EACvB,QAAsB,EACtB,SAAc;QAId,IAAI,CAAC,wCAAqB,CAAC,MAAM,CAAC,EAAE;YAClC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;gBACf,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,MAAM,EAAE,mBAAmB;gBAC3B,KAAK,EAAE,QAAQ;gBACf,SAAS,EAAE,SAAS;aACrB,CAAC,CAAC;SACJ;IACH,CAAC;IAEM,oCAAgB,GAAvB,UAAwB,QAOvB;QAPD,iBAkCC;QA1BC,IAAI,QAAQ,CAAC,kBAAkB,EAAE;YAC/B,IAAI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AEM,yCAAqB,GAA5B,UACE,QAAsB,EACtB,SAAc,EACd,SAAc;QAEd,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YACf,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,YAAY;YACpB,SAAS,WAAA;YACT,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IAEM,yBAAK,GAAZ;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IACH,gBAAC;AAAD,CAAC,AApLD,IAoLC;AApLY,8BAAS"} \ No newline at end of file diff --git a/node_modules/apollo-client/errors/ApolloError.d.ts b/node_modules/apollo-client/errors/ApolloError.d.ts deleted file mode 100644 index 7e848879..00000000 --- a/node_modules/apollo-client/errors/ApolloError.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { GraphQLError } from 'graphql'; -export declare function isApolloError(err: Error): err is ApolloError; -export declare class ApolloError extends Error { - message: string; - graphQLErrors: ReadonlyArray; - networkError: Error | null; - extraInfo: any; - constructor({ graphQLErrors, networkError, errorMessage, extraInfo, }: { - graphQLErrors?: ReadonlyArray; - networkError?: Error | null; - errorMessage?: string; - extraInfo?: any; - }); -} -//# sourceMappingURL=ApolloError.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/errors/ApolloError.d.ts.map b/node_modules/apollo-client/errors/ApolloError.d.ts.map deleted file mode 100644 index 7881e677..00000000 --- a/node_modules/apollo-client/errors/ApolloError.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ApolloError.d.ts","sourceRoot":"","sources":["../src/errors/ApolloError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,wBAAgB,aAAa,CAAC,GAAG,EAAE,KAAK,GAAG,GAAG,IAAI,WAAW,CAE5D;AA2BD,qBAAa,WAAY,SAAQ,KAAK;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC3C,YAAY,EAAE,KAAK,GAAG,IAAI,CAAC;IAK3B,SAAS,EAAE,GAAG,CAAC;gBAKV,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,SAAS,GACV,EAAE;QACD,aAAa,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;QAC5C,YAAY,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;QAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,GAAG,CAAC;KACjB;CAiBF"} \ No newline at end of file diff --git a/node_modules/apollo-client/errors/ApolloError.js b/node_modules/apollo-client/errors/ApolloError.js deleted file mode 100644 index e0eda4a4..00000000 --- a/node_modules/apollo-client/errors/ApolloError.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var arrays_1 = require("../util/arrays"); -function isApolloError(err) { - return err.hasOwnProperty('graphQLErrors'); -} -exports.isApolloError = isApolloError; -var generateErrorMessage = function (err) { - var message = ''; - if (arrays_1.isNonEmptyArray(err.graphQLErrors)) { - err.graphQLErrors.forEach(function (graphQLError) { - var errorMessage = graphQLError - ? graphQLError.message - : 'Error message not found.'; - message += "GraphQL error: " + errorMessage + "\n"; - }); - } - if (err.networkError) { - message += 'Network error: ' + err.networkError.message + '\n'; - } - message = message.replace(/\n$/, ''); - return message; -}; -var ApolloError = (function (_super) { - tslib_1.__extends(ApolloError, _super); - function ApolloError(_a) { - var graphQLErrors = _a.graphQLErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; - var _this = _super.call(this, errorMessage) || this; - _this.graphQLErrors = graphQLErrors || []; - _this.networkError = networkError || null; - if (!errorMessage) { - _this.message = generateErrorMessage(_this); - } - else { - _this.message = errorMessage; - } - _this.extraInfo = extraInfo; - _this.__proto__ = ApolloError.prototype; - return _this; - } - return ApolloError; -}(Error)); -exports.ApolloError = ApolloError; -//# sourceMappingURL=ApolloError.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/errors/ApolloError.js.map b/node_modules/apollo-client/errors/ApolloError.js.map deleted file mode 100644 index e10bf825..00000000 --- a/node_modules/apollo-client/errors/ApolloError.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ApolloError.js","sourceRoot":"","sources":["../../src/errors/ApolloError.ts"],"names":[],"mappings":";;;AACA,yCAAiD;AAEjD,SAAgB,aAAa,CAAC,GAAU;IACtC,OAAO,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAC7C,CAAC;AAFD,sCAEC;AAMD,IAAM,oBAAoB,GAAG,UAAC,GAAgB;IAC5C,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,IAAI,wBAAe,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;QACtC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,UAAC,YAA0B;YACnD,IAAM,YAAY,GAAG,YAAY;gBAC/B,CAAC,CAAC,YAAY,CAAC,OAAO;gBACtB,CAAC,CAAC,0BAA0B,CAAC;YAC/B,OAAO,IAAI,oBAAkB,YAAY,OAAI,CAAC;QAChD,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,GAAG,CAAC,YAAY,EAAE;QACpB,OAAO,IAAI,iBAAiB,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;KAChE;IAGD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;IAAiC,uCAAK;IAapC,qBAAY,EAUX;YATC,gCAAa,EACb,8BAAY,EACZ,8BAAY,EACZ,wBAAS;QAJX,YAWE,kBAAM,YAAY,CAAC,SAepB;QAdC,KAAI,CAAC,aAAa,GAAG,aAAa,IAAI,EAAE,CAAC;QACzC,KAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC;QAEzC,IAAI,CAAC,YAAY,EAAE;YACjB,KAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,KAAI,CAAC,CAAC;SAC3C;aAAM;YACL,KAAI,CAAC,OAAO,GAAG,YAAY,CAAC;SAC7B;QAED,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAI1B,KAAY,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;;IAClD,CAAC;IACH,kBAAC;AAAD,CAAC,AAxCD,CAAiC,KAAK,GAwCrC;AAxCY,kCAAW"} \ No newline at end of file diff --git a/node_modules/apollo-client/index.d.ts b/node_modules/apollo-client/index.d.ts deleted file mode 100644 index 141964a3..00000000 --- a/node_modules/apollo-client/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export { ObservableQuery, FetchMoreOptions, UpdateQueryOptions, ApolloCurrentResult, ApolloCurrentQueryResult, } from './core/ObservableQuery'; -export { QueryBaseOptions, QueryOptions, WatchQueryOptions, MutationOptions, SubscriptionOptions, FetchPolicy, WatchQueryFetchPolicy, ErrorPolicy, FetchMoreQueryOptions, SubscribeToMoreOptions, MutationUpdaterFn, } from './core/watchQueryOptions'; -export { NetworkStatus } from './core/networkStatus'; -export * from './core/types'; -export { Resolver, FragmentMatcher as LocalStateFragmentMatcher, } from './core/LocalState'; -export { isApolloError, ApolloError } from './errors/ApolloError'; -import ApolloClient, { ApolloClientOptions, DefaultOptions } from './ApolloClient'; -export { ApolloClientOptions, DefaultOptions }; -export { ApolloClient }; -export default ApolloClient; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/index.d.ts.map b/node_modules/apollo-client/index.d.ts.map deleted file mode 100644 index 6ca55e7e..00000000 --- a/node_modules/apollo-client/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,eAAe,IAAI,yBAAyB,GAC7C,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,YAAY,EAAE,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/index.js b/node_modules/apollo-client/index.js deleted file mode 100644 index a259ed10..00000000 --- a/node_modules/apollo-client/index.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ObservableQuery_1 = require("./core/ObservableQuery"); -exports.ObservableQuery = ObservableQuery_1.ObservableQuery; -var networkStatus_1 = require("./core/networkStatus"); -exports.NetworkStatus = networkStatus_1.NetworkStatus; -tslib_1.__exportStar(require("./core/types"), exports); -var ApolloError_1 = require("./errors/ApolloError"); -exports.isApolloError = ApolloError_1.isApolloError; -exports.ApolloError = ApolloError_1.ApolloError; -var ApolloClient_1 = tslib_1.__importDefault(require("./ApolloClient")); -exports.ApolloClient = ApolloClient_1.default; -exports.default = ApolloClient_1.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/index.js.map b/node_modules/apollo-client/index.js.map deleted file mode 100644 index 68b67287..00000000 --- a/node_modules/apollo-client/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0DAMgC;AAL9B,4CAAA,eAAe,CAAA;AAmBjB,sDAAqD;AAA5C,wCAAA,aAAa,CAAA;AACtB,uDAA6B;AAM7B,oDAAkE;AAAzD,sCAAA,aAAa,CAAA;AAAE,oCAAA,WAAW,CAAA;AAEnC,wEAGwB;AAIf,uBAPF,sBAAY,CAOE;AACrB,kBAAe,sBAAY,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/.flowconfig b/node_modules/apollo-client/node_modules/apollo-utilities/.flowconfig deleted file mode 100644 index ffa2101c..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/.flowconfig +++ /dev/null @@ -1,8 +0,0 @@ -[ignore] - -[include] - -[libs] - -[options] -suppress_comment= \\(.\\|\n\\)*\\$ExpectError diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/CHANGELOG.md b/node_modules/apollo-client/node_modules/apollo-utilities/CHANGELOG.md deleted file mode 100644 index 2cabb608..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/CHANGELOG.md +++ /dev/null @@ -1,106 +0,0 @@ -# CHANGELOG - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md). - ----- - -### 1.0.16 - -- Removed unnecessary whitespace from error message - [Issue #3398](https://github.com/apollographql/apollo-client/issues/3398) - [PR #3593](https://github.com/apollographql/apollo-client/pull/3593) - -### 1.0.15 - -- No changes - -### 1.0.14 - -- Store key names generated by `getStoreKeyName` now leverage a more - deterministic approach to handling JSON based strings. This prevents store - key names from differing when using `args` like - `{ prop1: 'value1', prop2: 'value2' }` and - `{ prop2: 'value2', prop1: 'value1' }`. - [PR #2869](https://github.com/apollographql/apollo-client/pull/2869) -- Avoid needless `hasOwnProperty` check in `deepFreeze`. - [PR #3545](https://github.com/apollographql/apollo-client/pull/3545) - -### 1.0.13 - -- Make `maybeDeepFreeze` a little more defensive, by always using - `Object.prototype.hasOwnProperty` (to avoid cases where the object being - frozen doesn't have its own `hasOwnProperty`). - [Issue #3426](https://github.com/apollographql/apollo-client/issues/3426) - [PR #3418](https://github.com/apollographql/apollo-client/pull/3418) -- Remove certain small internal caches to prevent memory leaks when using SSR. - [PR #3444](https://github.com/apollographql/apollo-client/pull/3444) - -### 1.0.12 - -- Not documented - -### 1.0.11 - -- `toIdValue` helper now takes an object with `id` and `typename` properties - as the preferred interface - [PR #3159](https://github.com/apollographql/apollo-client/pull/3159) -- Map coverage to original source -- Don't `deepFreeze` in development/test environments if ES6 symbols are - polyfilled - [PR #3082](https://github.com/apollographql/apollo-client/pull/3082) -- Added ability to include or ignore fragments in `getDirectivesFromDocument` - [PR #3010](https://github.com/apollographql/apollo-client/pull/3010) - -### 1.0.9 - -- Dependency updates -- Added getDirectivesFromDocument utility function - [PR #2974](https://github.com/apollographql/apollo-client/pull/2974) - -### 1.0.8 - -- Add client, rest, and export directives to list of known directives - [PR #2949](https://github.com/apollographql/apollo-client/pull/2949) - -### 1.0.7 - -- Fix typo in error message for invalid argument being passed to @skip or - @include directives - [PR #2867](https://github.com/apollographql/apollo-client/pull/2867) - -### 1.0.6 - -- Update `getStoreKeyName` to support custom directives - -### 1.0.5 - -- Package dependency updates - -### 1.0.4 - -- Package dependency updates - -### 1.0.3 - -- Package dependency updates - -### 1.0.2 - -- Improved rollup builds - -### 1.0.1 - -- Added config to remove selection set of directive matches test - -### 1.0.0 - -- Added utilities from hermes cache -- Added removeDirectivesFromDocument to allow cleaning of client only - directives -- Added hasDirectives to recurse the AST and return a boolean for an array of - directive names -- Improved performance of common store actions by memoizing addTypename and - removeConnectionDirective diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/LICENSE b/node_modules/apollo-client/node_modules/apollo-utilities/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/jest.config.js b/node_modules/apollo-client/node_modules/apollo-utilities/jest.config.js deleted file mode 100644 index 48f0a891..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require('../../config/jest.config.settings'), -}; diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.js deleted file mode 100644 index 49d9f007..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.js +++ /dev/null @@ -1,1125 +0,0 @@ -exports.__esModule = true; -exports.addTypenameToDocument = addTypenameToDocument; -exports.argumentsObjectFromField = argumentsObjectFromField; -exports.assign = assign; -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -exports.checkDocument = checkDocument; -exports.cloneDeep = cloneDeep; -exports.createFragmentMap = createFragmentMap; -exports.getDefaultValues = getDefaultValues; -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -exports.getDirectiveNames = getDirectiveNames; -exports.getDirectivesFromDocument = getDirectivesFromDocument; -exports.getEnv = getEnv; -exports.getFragmentDefinition = getFragmentDefinition; -exports.getFragmentDefinitions = getFragmentDefinitions; -exports.getFragmentQueryDocument = getFragmentQueryDocument; -exports.getInclusionDirectives = getInclusionDirectives; -exports.getMainDefinition = getMainDefinition; -exports.getMutationDefinition = getMutationDefinition; -exports.getOperationDefinition = getOperationDefinition; -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -exports.getOperationName = getOperationName; -exports.getQueryDefinition = getQueryDefinition; -exports.getStoreKeyName = getStoreKeyName; -exports.graphQLResultHasError = graphQLResultHasError; -exports.hasClientExports = hasClientExports; -exports.hasDirectives = hasDirectives; -exports.isDevelopment = isDevelopment; -exports.isEnv = isEnv; -exports.isField = isField; -exports.isIdValue = isIdValue; -exports.isInlineFragment = isInlineFragment; -exports.isJsonValue = isJsonValue; -exports.isNumberValue = isNumberValue; -exports.isProduction = isProduction; -exports.isScalarValue = isScalarValue; -exports.isTest = isTest; -exports.maybeDeepFreeze = maybeDeepFreeze; -exports.mergeDeep = mergeDeep; -exports.mergeDeepArray = mergeDeepArray; -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -exports.resultKeyNameFromField = resultKeyNameFromField; -exports.shouldInclude = shouldInclude; -exports.storeKeyNameFromField = storeKeyNameFromField; -exports.stripSymbols = stripSymbols; -exports.toIdValue = toIdValue; -exports.tryFunctionOrLogError = tryFunctionOrLogError; -exports.valueFromNode = valueFromNode; -exports.valueToObjectRepresentation = valueToObjectRepresentation; -exports.variablesInOperation = variablesInOperation; -exports.warnOnceInDevelopment = warnOnceInDevelopment; -exports.canUseWeakMap = exports.isEqual = void 0; - -var _visitor = require("graphql/language/visitor"); - -var _tsInvariant = require("ts-invariant"); - -var _tslib = require("tslib"); - -var _fastJsonStableStringify = _interopRequireDefault(require("fast-json-stable-stringify")); - -var _equality = require("@wry/equality"); - -exports.isEqual = _equality.equal; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value) { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value) { - return value.kind === 'IntValue'; -} - -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} - -function isVariable(value) { - return value.kind === 'Variable'; -} - -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} - -function isListValue(value) { - return value.kind === 'ListValue'; -} - -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} - -function isNullValue(value) { - return value.kind === 'NullValue'; -} - -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } -} - -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - -function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; -} - -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; -} - -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} - -function isField(selection) { - return selection.kind === 'Field'; -} - -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} - -function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; -} - -function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); -} - -function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; -} - -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); -} - -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; -} - -function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; -} - -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); -} - -function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); -} - -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} - -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; -} - -function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} - -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} - -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; -} - -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; -} - -function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; -} - -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); -} - -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} - -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} - -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} - -function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} - -function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; -} - -function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } -}; - -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); -} - -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; -} - -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; -} - -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; -} - -function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); -} - -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } -}; - -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} - -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); -} - -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); -} - -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); -} - -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; -} - -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); -} - -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); -} - -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} - -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; -} - -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); -exports.canUseWeakMap = canUseWeakMap; -var toString = Object.prototype.toString; - -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; -} - -function isEnv(env) { - return getEnv() === env; -} - -function isProduction() { - return isEnv('production') === true; -} - -function isDevelopment() { - return isEnv('development') === true; -} - -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} - -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); -} - -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; -} - -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; -} - -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; -} - -var haveWarned = Object.create({}); - -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.js.map deleted file mode 100644 index a445ea6f..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAiDgB,a,CAAc,K,EAAgB;AAC5C,SAAO,CAAC,aAAD,EAAgB,cAAhB,EAAgC,WAAhC,EAA6C,OAA7C,CAAqD,KAAK,CAAC,IAA3D,IAAmE,CAAC,CAA3E;AACD;;AAID,SAAgB,aAAhB,CAA8B,KAA9B,EAA8C;AAC5C,SAAO,CAAC,UAAD,EAAa,YAAb,EAA2B,OAA3B,CAAmC,KAAK,CAAC,IAAzC,IAAiD,CAAC,CAAzD;AACD;;AAED,SAAS,aAAT,CAAuB,KAAvB,EAAuC;AACrC,SAAO,K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KAAP,KAAiB,QADjB,IAEA,UAAU,CAAC,OAAX,CAAmB,KAAnB,IAA4B,CAH9B,EAIE;AACA,QAAI,KAAK,CAAC,OAAN,CAAc,KAAd,CAAJ,EAA0B;AACxB,MAAA,KAAK,GAAI,KAAa,CAAC,KAAd,CAAoB,CAApB,CAAT;AACD,KAFD,MAEO;AACL,MAAA,KAAK,GAAA,qBAAA;AACH,QAAA,SAAS,EAAE,MAAM,CAAC,cAAP,CAAsB,KAAtB;AADR,OAAA,EAEA,KAFA,CAAL;AAID;;AACD,IAAA,UAAU,CAAC,IAAX,CAAgB,KAAhB;AACD;;AACD,SAAO,KAAP;AACD;;AChHD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAP,CAAc,EAAd,CAAnB;;AAUA,SAAgB,qBAAhB,CAAsC,GAAtC,EAAmD,IAAnD,EAAgE;AAAb,MAAA,IAAA,KAAA,KAAA,CAAA,EAAA;AAAA,IAAA,IAAA,GAAA,MAAA;AAAa;;AAC9D,MAAI,CAAC,YAAY,EAAb,IAAmB,CAAC,UAAU,CAAC,GAAD,CAAlC,EAAyC;AACvC,QAAI,CAAC,MAAM,EAAX,EAAe;AACb,MAAA,UAAU,CAAC,GAAD,CAAV,GAAkB,IAAlB;AACD;;AACD,QAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,MAAA,OAAO,CAAC,KAAR,CAAc,GAAd;AACD,KAFD,MAEO;AACL,MAAA,OAAO,CAAC,IAAR,CAAa,GAAb;AACD;AACF;AACF;;SCZe,Y,CAAgB,I,EAAO;AACrC,SAAO,IAAI,CAAC,KAAL,CAAW,IAAI,CAAC,SAAL,CAAe,IAAf,CAAX,CAAP;AACD,C","sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.min.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.min.js deleted file mode 100644 index a7ed4e22..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.addTypenameToDocument=function(e){return(0,n.visit)(y(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var i=e.selections;if(i){var o=i.some(function(e){return f(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))});if(!o){var a=t;if(!(f(a)&&a.directives&&a.directives.some(function(e){return"export"===e.name.value})))return(0,r.__assign)((0,r.__assign)({},e),{selections:(0,r.__spreadArrays)(i,[_])})}}}}}})},exports.argumentsObjectFromField=s,exports.assign=x,exports.buildQueryFromSelectionSet=function(e){if("query"===k(e).operation)return e;return(0,n.visit)(e,{OperationDefinition:{enter:function(e){return(0,r.__assign)((0,r.__assign)({},e),{operation:"query"})}}})},exports.checkDocument=y,exports.cloneDeep=function(e){return function e(n,t){switch(M.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach(function(n,i){r[i]=e(n,t)}),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach(function(r){i[r]=e(n[r],t)}),i;default:return n}}(e,new Map)},exports.createFragmentMap=O,exports.getDefaultValues=function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){var n=e.defaultValue;return n}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return a(r,n.name,t),r});return x.apply(void 0,(0,r.__spreadArrays)([{}],n))}return{}},exports.getDirectiveInfoFromField=function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=s(e,n)}),t}return null},exports.getDirectiveNames=m,exports.getDirectivesFromDocument=function(e,t){var i;return y(t),E((0,n.visit)(t,{SelectionSet:{enter:function(n,t,o,a){var u=a.join("-");if(!i||u===i||!u.startsWith(i)){if(n.selections){var c=n.selections.filter(function(n){return I(e,n)});return w(e,n,!1)&&(i=u),(0,r.__assign)((0,r.__assign)({},n),{selections:c})}return null}}}}))},exports.getEnv=J,exports.getFragmentDefinition=D,exports.getFragmentDefinitions=b,exports.getFragmentQueryDocument=function(e,n){var i=n,o=[];e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(11);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&((0,t.invariant)(1===o.length,12),i=o[0].name.value);return(0,r.__assign)((0,r.__assign)({},e),{definitions:(0,r.__spreadArrays)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],e.definitions)})},exports.getInclusionDirectives=g,exports.getMainDefinition=k,exports.getMutationDefinition=function(e){y(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return(0,t.invariant)(n,1),n},exports.getOperationDefinition=h,exports.getOperationDefinitionOrDie=function(e){var n=h(e);return(0,t.invariant)(n,5),n},exports.getOperationName=function(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null},exports.getQueryDefinition=function(e){var n=h(e);return(0,t.invariant)(n&&"query"===n.operation,6),n},exports.getStoreKeyName=c,exports.graphQLResultHasError=function(e){return e.errors&&e.errors.length},exports.hasClientExports=function(e){return e&&p(["client"],e)&&p(["export"],e)},exports.hasDirectives=p,exports.isDevelopment=Q,exports.isEnv=P,exports.isField=f,exports.isIdValue=function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},exports.isInlineFragment=l,exports.isJsonValue=function(e){return null!=e&&"object"==typeof e&&"json"===e.type},exports.isNumberValue=function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},exports.isProduction=L,exports.isScalarValue=function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},exports.isTest=T,exports.maybeDeepFreeze=function(e){if(Q()||T()){var n="function"==typeof Symbol&&"string"==typeof Symbol("");if(!n)return function e(n){Object.freeze(n);Object.getOwnPropertyNames(n).forEach(function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])});return n}(e)}return e},exports.mergeDeep=function(){for(var e=[],n=0;n0){var r=t.connection.filter?t.connection.filter:[];r.sort();var o=n,a={};return r.forEach(function(e){a[e]=o[e]}),t.connection.key+"("+JSON.stringify(a)+")"}return t.connection.key}var c=e;if(n){var s=(0,i.default)(n);c+="("+s+")"}return t&&Object.keys(t).forEach(function(e){-1===u.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?c+="@"+e+"("+JSON.stringify(t[e])+")":c+="@"+e)}),c}function s(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return a(t,r,i,n)}),t}return null}function f(e){return"Field"===e.kind}function l(e){return"InlineFragment"===e.kind}function v(e){throw new t.InvariantError(18)}function m(e){var t=[];return(0,n.visit)(e,{Directive:function(e){t.push(e.name.value)}}),t}function p(e,n){return m(n).some(function(n){return e.indexOf(n)>-1})}function d(e){var n=e.name.value;return"skip"===n||"include"===n}function g(e){return e?e.filter(d).map(function(e){var n=e.arguments;e.name.value;(0,t.invariant)(n&&1===n.length,14);var r=n[0];(0,t.invariant)(r.name&&"if"===r.name.value,15);var i=r.value;return(0,t.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),16),{directive:e,ifArgument:r}}):[]}function x(e){for(var n=[],t=1;t1){var r=[];n=K(n,r);for(var i=1;i -1; -} -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw process.env.NODE_ENV === "production" ? new InvariantError(17) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = stringify(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -function isField(selection) { - return selection.kind === 'Field'; -} -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return __assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new InvariantError(18) : new InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 13) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -function getDirectiveNames(doc) { - var names = []; - visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 14) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 15) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(11) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 12) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = __assign(__assign({}, document), { definitions: __spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} - -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? invariant(mutationDef, 1) : invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? invariant(doc && doc.kind === 'Document', 2) : invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(3) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 4) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? invariant(def, 5) : invariant(def, "GraphQL document is missing an operation"); - return def; -} -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 6) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 7) : invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? invariant(doc.definitions.length <= 1, 8) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 9) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw process.env.NODE_ENV === "production" ? new InvariantError(10) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, __spreadArrays([{}], defaultValues)); - } - return {}; -} -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -function addTypenameToDocument(doc) { - return visit(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return __assign(__assign({}, node), { selections: __spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - process.env.NODE_ENV === "production" || invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return __assign(__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visit(doc, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visit(document, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); - -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -function isEnv(env) { - return getEnv() === env; -} -function isProduction() { - return isEnv('production') === true; -} -function isDevelopment() { - return isEnv('development') === true; -} -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = __assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} - -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} - -export { addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getInclusionDirectives, getMainDefinition, getMutationDefinition, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getQueryDefinition, getStoreKeyName, graphQLResultHasError, hasClientExports, hasDirectives, isDevelopment, isEnv, isField, isIdValue, isInlineFragment, isJsonValue, isNumberValue, isProduction, isScalarValue, isTest, maybeDeepFreeze, mergeDeep, mergeDeepArray, removeArgumentsFromDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, removeDirectivesFromDocument, removeFragmentSpreadFromDocument, resultKeyNameFromField, shouldInclude, storeKeyNameFromField, stripSymbols, toIdValue, tryFunctionOrLogError, valueFromNode, valueToObjectRepresentation, variablesInOperation, warnOnceInDevelopment }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.esm.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.esm.js.map deleted file mode 100644 index 20578090..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"],"names":[],"mappings":";;;;;;SAiDgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,KAAK,C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ACpC,KAAK,CACT,CAAC;SACH;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;CACd;;AChHD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAUrC,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAa;IAAb,qBAAA,EAAA,aAAa;IAC9D,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,CAAC,MAAM,EAAE,EAAE;YACb,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;CACF;;SCZe,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;CACzC;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.umd.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.umd.js deleted file mode 100644 index 4c8a17bb..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.umd.js +++ /dev/null @@ -1,1131 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "graphql/language/visitor", "ts-invariant", "tslib", "fast-json-stable-stringify", "@wry/equality"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("graphql/language/visitor"), require("ts-invariant"), require("tslib"), require("fast-json-stable-stringify"), require("@wry/equality")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.visitor, global.tsInvariant, global.tslib, global.fastJsonStableStringify, global.equality); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _visitor, _tsInvariant, _tslib, _fastJsonStableStringify, _equality) { - - _exports.__esModule = true; - _exports.addTypenameToDocument = addTypenameToDocument; - _exports.argumentsObjectFromField = argumentsObjectFromField; - _exports.assign = assign; - _exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; - _exports.checkDocument = checkDocument; - _exports.cloneDeep = cloneDeep; - _exports.createFragmentMap = createFragmentMap; - _exports.getDefaultValues = getDefaultValues; - _exports.getDirectiveInfoFromField = getDirectiveInfoFromField; - _exports.getDirectiveNames = getDirectiveNames; - _exports.getDirectivesFromDocument = getDirectivesFromDocument; - _exports.getEnv = getEnv; - _exports.getFragmentDefinition = getFragmentDefinition; - _exports.getFragmentDefinitions = getFragmentDefinitions; - _exports.getFragmentQueryDocument = getFragmentQueryDocument; - _exports.getInclusionDirectives = getInclusionDirectives; - _exports.getMainDefinition = getMainDefinition; - _exports.getMutationDefinition = getMutationDefinition; - _exports.getOperationDefinition = getOperationDefinition; - _exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; - _exports.getOperationName = getOperationName; - _exports.getQueryDefinition = getQueryDefinition; - _exports.getStoreKeyName = getStoreKeyName; - _exports.graphQLResultHasError = graphQLResultHasError; - _exports.hasClientExports = hasClientExports; - _exports.hasDirectives = hasDirectives; - _exports.isDevelopment = isDevelopment; - _exports.isEnv = isEnv; - _exports.isField = isField; - _exports.isIdValue = isIdValue; - _exports.isInlineFragment = isInlineFragment; - _exports.isJsonValue = isJsonValue; - _exports.isNumberValue = isNumberValue; - _exports.isProduction = isProduction; - _exports.isScalarValue = isScalarValue; - _exports.isTest = isTest; - _exports.maybeDeepFreeze = maybeDeepFreeze; - _exports.mergeDeep = mergeDeep; - _exports.mergeDeepArray = mergeDeepArray; - _exports.removeArgumentsFromDocument = removeArgumentsFromDocument; - _exports.removeClientSetsFromDocument = removeClientSetsFromDocument; - _exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; - _exports.removeDirectivesFromDocument = removeDirectivesFromDocument; - _exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; - _exports.resultKeyNameFromField = resultKeyNameFromField; - _exports.shouldInclude = shouldInclude; - _exports.storeKeyNameFromField = storeKeyNameFromField; - _exports.stripSymbols = stripSymbols; - _exports.toIdValue = toIdValue; - _exports.tryFunctionOrLogError = tryFunctionOrLogError; - _exports.valueFromNode = valueFromNode; - _exports.valueToObjectRepresentation = valueToObjectRepresentation; - _exports.variablesInOperation = variablesInOperation; - _exports.warnOnceInDevelopment = warnOnceInDevelopment; - _exports.canUseWeakMap = _exports.isEqual = void 0; - _fastJsonStableStringify = _interopRequireDefault(_fastJsonStableStringify); - _exports.isEqual = _equality.equal; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; - } - - function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; - } - - function isStringValue(value) { - return value.kind === 'StringValue'; - } - - function isBooleanValue(value) { - return value.kind === 'BooleanValue'; - } - - function isIntValue(value) { - return value.kind === 'IntValue'; - } - - function isFloatValue(value) { - return value.kind === 'FloatValue'; - } - - function isVariable(value) { - return value.kind === 'Variable'; - } - - function isObjectValue(value) { - return value.kind === 'ObjectValue'; - } - - function isListValue(value) { - return value.kind === 'ListValue'; - } - - function isEnumValue(value) { - return value.kind === 'EnumValue'; - } - - function isNullValue(value) { - return value.kind === 'NullValue'; - } - - function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } - } - - function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); - } - - var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - - function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; - } - - function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; - } - - function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; - } - - function isField(selection) { - return selection.kind === 'Field'; - } - - function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; - } - - function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; - } - - function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); - } - - function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; - } - - function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); - } - - function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } - } - - function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; - } - - function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); - } - - function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; - } - - function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); - } - - function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); - } - - function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; - } - - function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; - } - - function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; - } - - function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; - } - - function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; - } - - function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; - } - - function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; - } - - function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; - } - - function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; - } - - function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); - } - - function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; - } - - function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; - } - - function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); - } - - function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; - } - - function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; - } - - function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; - } - - function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; - } - - var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } - }; - - function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); - } - - function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; - } - - function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; - } - - function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; - } - - function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); - } - - var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } - }; - - function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); - } - - function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); - } - - function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); - } - - function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); - } - - function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; - } - - function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); - } - - function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); - } - - function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; - } - - function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; - } - - function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; - } - - var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); - _exports.canUseWeakMap = canUseWeakMap; - var toString = Object.prototype.toString; - - function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); - } - - function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } - } - - function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; - } - - function isEnv(env) { - return getEnv() === env; - } - - function isProduction() { - return isEnv('production') === true; - } - - function isDevelopment() { - return isEnv('development') === true; - } - - function isTest() { - return isEnv('test') === true; - } - - function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } - } - - function graphQLResultHasError(result) { - return result.errors && result.errors.length; - } - - function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; - } - - function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); - } - - function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; - } - - function isObject(obj) { - return obj !== null && typeof obj === 'object'; - } - - function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; - } - - function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; - } - - var haveWarned = Object.create({}); - - function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } - } - - function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); - } - -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.umd.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.umd.js.map deleted file mode 100644 index e69270f6..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiDgB,a,CAAc,K,EAAgB;AAC5C,WAAO,CAAC,aAAD,EAAgB,cAAhB,EAAgC,WAAhC,EAA6C,OAA7C,CAAqD,KAAK,CAAC,IAA3D,IAAmE,CAAC,CAA3E;AACD;;AAID,WAAgB,aAAhB,CAA8B,KAA9B,EAA8C;AAC5C,WAAO,CAAC,UAAD,EA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ntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.d.ts deleted file mode 100644 index ea10f218..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { FieldNode, SelectionNode, DirectiveNode, DocumentNode, ArgumentNode } from 'graphql'; -export declare type DirectiveInfo = { - [fieldName: string]: { - [argName: string]: any; - }; -}; -export declare function getDirectiveInfoFromField(field: FieldNode, variables: Object): DirectiveInfo; -export declare function shouldInclude(selection: SelectionNode, variables?: { - [name: string]: any; -}): boolean; -export declare function getDirectiveNames(doc: DocumentNode): string[]; -export declare function hasDirectives(names: string[], doc: DocumentNode): boolean; -export declare function hasClientExports(document: DocumentNode): boolean; -export declare type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; -export declare function getInclusionDirectives(directives: ReadonlyArray): InclusionDirectives; -//# sourceMappingURL=directives.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.d.ts.map deleted file mode 100644 index 4da04b61..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["src/directives.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,aAAa,EAGb,aAAa,EACb,YAAY,EACZ,YAAY,EAEb,MAAM,SAAS,CAAC;AAQjB,oBAAY,aAAa,GAAG;IAC1B,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,GAChB,aAAa,CAYf;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,aAAa,EACxB,SAAS,GAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAO,GACtC,OAAO,CAgBT;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,YAUlD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,YAAY,WAI/D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,WAMtD;AAED,oBAAY,mBAAmB,GAAG,KAAK,CAAC;IACtC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B,CAAC,CAAC;AAMH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,GACvC,mBAAmB,CA2BrB"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.js deleted file mode 100644 index 41a8a9d4..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var visitor_1 = require("graphql/language/visitor"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = storeUtils_1.argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - ts_invariant_1.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -exports.shouldInclude = shouldInclude; -function getDirectiveNames(doc) { - var names = []; - visitor_1.visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -exports.getDirectiveNames = getDirectiveNames; -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -exports.hasDirectives = hasDirectives; -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -exports.hasClientExports = hasClientExports; -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - ts_invariant_1.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - ts_invariant_1.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - ts_invariant_1.invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} -exports.getInclusionDirectives = getInclusionDirectives; -//# sourceMappingURL=directives.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.js.map deleted file mode 100644 index 915e07f2..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/directives.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;AAaA,oDAAiD;AAEjD,6CAAyC;AAEzC,2CAAwD;AAMxD,SAA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aAAa,gBAAa,CACxD,CAAC;QAEF,IAAM,OAAO,GAAc,UAAU,CAAC,KAAK,CAAC;QAG5C,wBAAS,CACP,OAAO;YACL,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,EAClE,uBAAqB,aAAa,sDAAmD,CACtF,CAAC;QAEF,OAAO,EAAE,SAAS,WAAA,EAAE,UAAU,YAAA,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACV,CAAC;AA7BD,wDA6BC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.d.ts deleted file mode 100644 index 8b1f2312..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode; -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.d.ts.map deleted file mode 100644 index cbff38a8..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["src/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,SAAS,CAAC;AAyB/D,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,YAAY,CA+Dd"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.js deleted file mode 100644 index 5b6e8f87..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - ts_invariant_1.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = tslib_1.__assign(tslib_1.__assign({}, document), { definitions: tslib_1.__spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} -exports.getFragmentQueryDocument = getFragmentQueryDocument; -//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.js.map deleted file mode 100644 index ece1e375..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/fragments.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../src/fragments.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAwBzD,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAKtC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,UAAU;QAGrC,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,IAAI,6BAAc,CACtB,aAAW,UAAU,CAAC,SAAS,mBAC7B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,aAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,QACxD;gBACF,yFAAyF,CAC5F,CAAC;SACH;QAGD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC5C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC5B;IACH,CAAC,CAAC,CAAC;IAIH,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;QAC7C,wBAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,WACE,SAAS,CAAC,MAAM,sFACmE,CACtF,CAAC;QACF,kBAAkB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9C;IAID,IAAM,KAAK,yCACN,QAAQ,KACX,WAAW;YACT;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,SAAS,EAAE,OAAO;gBAClB,YAAY,EAAE;oBACZ,IAAI,EAAE,cAAc;oBACpB,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,gBAAgB;4BACtB,IAAI,EAAE;gCACJ,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,kBAAkB;6BAC1B;yBACF;qBACF;iBACF;aACF;WACE,QAAQ,CAAC,WAAW,IAE1B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAlED,4DAkEC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.d.ts deleted file mode 100644 index 57050319..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from 'graphql'; -import { JsonValue } from './storeUtils'; -export declare function getMutationDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function checkDocument(doc: DocumentNode): DocumentNode; -export declare function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined; -export declare function getOperationDefinitionOrDie(document: DocumentNode): OperationDefinitionNode; -export declare function getOperationName(doc: DocumentNode): string | null; -export declare function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[]; -export declare function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode; -export declare function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode; -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} -export declare function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap; -export declare function getDefaultValues(definition: OperationDefinitionNode | undefined): { - [key: string]: JsonValue; -}; -export declare function variablesInOperation(operation: OperationDefinitionNode): Set; -//# sourceMappingURL=getFromAST.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.d.ts.map deleted file mode 100644 index ef2f9946..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"getFromAST.d.ts","sourceRoot":"","sources":["src/getFromAST.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,uBAAuB,CAYzB;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,gBA0B9C;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,uBAAuB,GAAG,SAAS,CAKrC;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,YAAY,GACrB,uBAAuB,CAIzB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CASjE;AAGD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,GAChB,sBAAsB,EAAE,CAI1B;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,uBAAuB,CAS7E;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,YAAY,GAChB,sBAAsB,CAoBxB;AAOD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,YAAY,GACrB,uBAAuB,GAAG,sBAAsB,CA8BlD;AAKD,MAAM,WAAW,WAAW;IAC1B,CAAC,YAAY,EAAE,MAAM,GAAG,sBAAsB,CAAC;CAChD;AAID,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,sBAAsB,EAAO,GACvC,WAAW,CAOb;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,uBAAuB,GAAG,SAAS,GAC9C;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAyB9B;AAKD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,uBAAuB,GACjC,GAAG,CAAC,MAAM,CAAC,CASb"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.js deleted file mode 100644 index 39f4e5aa..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -var assign_1 = require("./util/assign"); -var storeUtils_1 = require("./storeUtils"); -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - ts_invariant_1.invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -exports.getMutationDefinition = getMutationDefinition; -function checkDocument(doc) { - ts_invariant_1.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - ts_invariant_1.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -exports.checkDocument = checkDocument; -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -exports.getOperationDefinition = getOperationDefinition; -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - ts_invariant_1.invariant(def, "GraphQL document is missing an operation"); - return def; -} -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -exports.getOperationName = getOperationName; -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -exports.getFragmentDefinitions = getFragmentDefinitions; -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - ts_invariant_1.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -exports.getQueryDefinition = getQueryDefinition; -function getFragmentDefinition(doc) { - ts_invariant_1.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - ts_invariant_1.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - ts_invariant_1.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -exports.getFragmentDefinition = getFragmentDefinition; -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw new ts_invariant_1.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -exports.getMainDefinition = getMainDefinition; -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -exports.createFragmentMap = createFragmentMap; -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - storeUtils_1.valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign_1.assign.apply(void 0, tslib_1.__spreadArrays([{}], defaultValues)); - } - return {}; -} -exports.getDefaultValues = getDefaultValues; -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} -exports.variablesInOperation = variablesInOperation; -//# sourceMappingURL=getFromAST.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.js.map deleted file mode 100644 index 88d74a5f..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/getFromAST.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"getFromAST.js","sourceRoot":"","sources":["../src/getFromAST.ts"],"names":[],"mappings":";;;AAOA,6CAAyD;AAEzD,wCAAuC;AAEvC,2CAAsE;AAEtE,SAAgB,qBAAqB,CACnC,GAAiB;IAEjB,aAAa,CAAC,GAAG,CAAC,CAAC;IAEnB,IAAI,WAAW,GAAmC,GAAG,CAAC,WAAW,CAAC,MAAM,CACtE,UAAA,UAAU;QACR,OAAA,UAAU,CAAC,IAAI,KAAK,qBAAqB;YACzC,UAAU,CAAC,SAAS,KAAK,UAAU;IADnC,CACmC,CACtC,CAAC,CAAC,CAA4B,CAAC;IAEhC,wBAAS,CAAC,WAAW,EAAE,qCAAqC,CAAC,CAAC;IAE9D,OAAO,WAAW,CAAC;AACrB,CAAC;AAdD,sDAcC;AAGD,SAAgB,aAAa,CAAC,GAAiB;IAC7C,wBAAS,CACP,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAC9B,0JAC2E,CAC5E,CAAC;IAEF,IAAM,UAAU,GAAG,GAAG,CAAC,WAAW;SAC/B,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,oBAAoB,EAA/B,CAA+B,CAAC;SAC5C,GAAG,CAAC,UAAA,UAAU;QACb,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,IAAI,6BAAc,CACtB,8DACE,UAAU,CAAC,IAAI,OACd,CACJ,CAAC;SACH;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC,CAAC;IAEL,wBAAS,CACP,UAAU,CAAC,MAAM,IAAI,CAAC,EACtB,0CAAwC,UAAU,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node_modules/apollo-client/node_modules/apollo-utilities/lib/index.d.ts deleted file mode 100644 index 6e84d9df..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.d.ts.map deleted file mode 100644 index 65614a63..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.js deleted file mode 100644 index 0693303c..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./directives"), exports); -tslib_1.__exportStar(require("./fragments"), exports); -tslib_1.__exportStar(require("./getFromAST"), exports); -tslib_1.__exportStar(require("./transform"), exports); -tslib_1.__exportStar(require("./storeUtils"), exports); -tslib_1.__exportStar(require("./util/assign"), exports); -tslib_1.__exportStar(require("./util/canUse"), exports); -tslib_1.__exportStar(require("./util/cloneDeep"), exports); -tslib_1.__exportStar(require("./util/environment"), exports); -tslib_1.__exportStar(require("./util/errorHandling"), exports); -tslib_1.__exportStar(require("./util/isEqual"), exports); -tslib_1.__exportStar(require("./util/maybeDeepFreeze"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -tslib_1.__exportStar(require("./util/warnOnce"), exports); -tslib_1.__exportStar(require("./util/stripSymbols"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.js.map deleted file mode 100644 index 3c41b701..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,wDAA8B;AAC9B,2DAAiC;AACjC,6DAAmC;AACnC,+DAAqC;AACrC,yDAA+B;AAC/B,iEAAuC;AACvC,2DAAiC;AACjC,0DAAgC;AAChC,8DAAoC;AACpC,2DAAiC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.d.ts deleted file mode 100644 index 4ac253c6..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { DirectiveNode, FieldNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, EnumValueNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode } from 'graphql'; -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} -export interface JsonValue { - type: 'json'; - json: any; -} -export declare type ListValue = Array; -export declare type StoreValue = number | string | string[] | IdValue | ListValue | JsonValue | null | undefined | void | Object; -export declare type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; -export declare function isScalarValue(value: ValueNode): value is ScalarValue; -export declare type NumberValue = IntValueNode | FloatValueNode; -export declare function isNumberValue(value: ValueNode): value is NumberValue; -export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void; -export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string; -export declare type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; -export declare function getStoreKeyName(fieldName: string, args?: Object, directives?: Directives): string; -export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables: Object): Object; -export declare function resultKeyNameFromField(field: FieldNode): string; -export declare function isField(selection: SelectionNode): selection is FieldNode; -export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode; -export declare function isIdValue(idObject: StoreValue): idObject is IdValue; -export declare type IdConfig = { - id: string; - typename: string | undefined; -}; -export declare function toIdValue(idConfig: string | IdConfig, generated?: boolean): IdValue; -export declare function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue; -export declare type VariableValue = (node: VariableNode) => any; -export declare function valueFromNode(node: ValueNode, onVariable?: VariableValue): any; -//# sourceMappingURL=storeUtils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.d.ts.map deleted file mode 100644 index 531a9645..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["src/storeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAGhB,aAAa,EAEb,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;CACX;AAED,oBAAY,SAAS,GAAG,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;AAE9C,oBAAY,UAAU,GAClB,MAAM,GACN,MAAM,GACN,MAAM,EAAE,GACR,OAAO,GACP,SAAS,GACT,SAAS,GACT,IAAI,GACJ,SAAS,GACT,IAAI,GACJ,MAAM,CAAC;AAEX,oBAAY,WAAW,GAAG,eAAe,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,WAAW,CAEpE;AAED,oBAAY,WAAW,GAAG,YAAY,GAAG,cAAc,CAAC;AAExD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,WAAW,CAEpE;AAsCD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,EAChB,SAAS,CAAC,EAAE,MAAM,QAqCnB;AAED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/storeUtils.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.js deleted file mode 100644 index bf04bfb1..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.js +++ /dev/null @@ -1,225 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var fast_json_stable_stringify_1 = tslib_1.__importDefault(require("fast-json-stable-stringify")); -var ts_invariant_1 = require("ts-invariant"); -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} -exports.isScalarValue = isScalarValue; -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -exports.isNumberValue = isNumberValue; -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw new ts_invariant_1.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -exports.valueToObjectRepresentation = valueToObjectRepresentation; -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -exports.storeKeyNameFromField = storeKeyNameFromField; -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = fast_json_stable_stringify_1.default(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -exports.getStoreKeyName = getStoreKeyName; -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -exports.argumentsObjectFromField = argumentsObjectFromField; -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -exports.resultKeyNameFromField = resultKeyNameFromField; -function isField(selection) { - return selection.kind === 'Field'; -} -exports.isField = isField; -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -exports.isInlineFragment = isInlineFragment; -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -exports.isIdValue = isIdValue; -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return tslib_1.__assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -exports.toIdValue = toIdValue; -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -exports.isJsonValue = isJsonValue; -function defaultValueFromVariable(node) { - throw new ts_invariant_1.InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} -exports.valueFromNode = valueFromNode; -//# sourceMappingURL=storeUtils.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.js.map deleted file mode 100644 index bb07be7f..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/storeUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.js","sourceRoot":"","sources":["../src/storeUtils.ts"],"names":[],"mappings":";;;AAkBA,kGAAmD;AACnD,6CAA8C;AA8B9C,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/E,CAAC;AAFD,sCAEC;AAID,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,CAAC;AAFD,sCAEC;AAED,SAAS,aAAa,CAAC,KAAgB;IACrC,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;AACvC,CAAC;AAED,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB;IACpC,OAAO,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;AACrC,CAAC;AAED,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED,SAAS,aAAa,CAAC,KAAgB;IACrC,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACnC,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;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AAe,EACf,UAAoD;IAApD,2BAAA,EAAA,qCAAoD;IAEpD,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,KAAK,WAAW;YACd,OAAO,IAAI,CAAC;QACd,KAAK,UAAU;YACb,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,KAAK,YAAY;YACf,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,KAAK,WAAW;YACd,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,aAAa,CAAC,CAAC,EAAE,UAAU,CAAC,EAA5B,CAA4B,CAAC,CAAC;QAC5D,KAAK,aAAa,CAAC,CAAC;YAClB,IAAM,KAAK,GAA2B,EAAE,CAAC;YACzC,KAAoB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;gBAA5B,IAAM,KAAK,SAAA;gBACd,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aAClE;YACD,OAAO,KAAK,CAAC;SACd;QACD;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;AACH,CAAC;AAzBD,sCAyBC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.d.ts deleted file mode 100644 index f359faf5..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { DocumentNode, DirectiveNode, FragmentDefinitionNode, ArgumentNode, FragmentSpreadNode, VariableDefinitionNode } from 'graphql'; -export declare type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; -export declare type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; -export declare type RemoveDirectiveConfig = RemoveNodeConfig; -export declare type GetDirectiveConfig = GetNodeConfig; -export declare type RemoveArgumentsConfig = RemoveNodeConfig; -export declare type GetFragmentSpreadConfig = GetNodeConfig; -export declare type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export declare type RemoveFragmentDefinitionConfig = RemoveNodeConfig; -export declare type RemoveVariableDefinitionConfig = RemoveNodeConfig; -export declare function removeDirectivesFromDocument(directives: RemoveDirectiveConfig[], doc: DocumentNode): DocumentNode | null; -export declare function addTypenameToDocument(doc: DocumentNode): DocumentNode; -export declare function removeConnectionDirectiveFromDocument(doc: DocumentNode): DocumentNode; -export declare function getDirectivesFromDocument(directives: GetDirectiveConfig[], doc: DocumentNode): DocumentNode; -export declare function removeArgumentsFromDocument(config: RemoveArgumentsConfig[], doc: DocumentNode): DocumentNode; -export declare function removeFragmentSpreadFromDocument(config: RemoveFragmentSpreadConfig[], doc: DocumentNode): DocumentNode; -export declare function buildQueryFromSelectionSet(document: DocumentNode): DocumentNode; -export declare function removeClientSetsFromDocument(document: DocumentNode): DocumentNode | null; -//# sourceMappingURL=transform.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.d.ts.map deleted file mode 100644 index 5d6140be..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAgBjB,oBAAY,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CA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C,QAAQ,EAAE,YAAY,GACrB,YAAY,CAqBd;AAGD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,YAAY,GACrB,YAAY,GAAG,IAAI,CAoCrB"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.js deleted file mode 100644 index b85155c5..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.js +++ /dev/null @@ -1,311 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var visitor_1 = require("graphql/language/visitor"); -var getFromAST_1 = require("./getFromAST"); -var filterInPlace_1 = require("./util/filterInPlace"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getFromAST_1.getOperationDefinition(doc) || getFromAST_1.getFragmentDefinition(doc), getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visitor_1.visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace_1.filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace_1.filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -function addTypenameToDocument(doc) { - return visitor_1.visit(getFromAST_1.checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (storeUtils_1.isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (storeUtils_1.isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: tslib_1.__spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -exports.addTypenameToDocument = addTypenameToDocument; -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - ts_invariant_1.invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], getFromAST_1.checkDocument(doc)); -} -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!storeUtils_1.isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - getFromAST_1.checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visitor_1.visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -exports.getDirectivesFromDocument = getDirectivesFromDocument; -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visitor_1.visit(doc, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visitor_1.visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((storeUtils_1.isField(selection) || storeUtils_1.isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getFromAST_1.getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visitor_1.visit(document, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -function removeClientSetsFromDocument(document) { - getFromAST_1.checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visitor_1.visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return storeUtils_1.isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.js.map deleted file mode 100644 index 4ea09818..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/transform.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";;;AAaA,oDAAiD;AAEjD,2CAQsB;AACtB,sDAAqD;AACrD,6CAAyC;AACzC,2CAAyD;AAyBzD,IAAM,cAAc,GAAc;IAChC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,YAAY;KACpB;CACF,CAAC;AAEF,SAAS,OAAO,CACd,EAAoD,EACpD,SAAsB;IAEtB,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CACrC,UAAA,SAAS;QACP,OAAA,SAAS,CAAC,IAAI,KAAK,gBAAgB;YACnC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IADnD,CACmD,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAiB;IACzC,OAAO,OAAO,CACZ,mCAAsB,CAAC,GAAG,CAAC,IAAI,kCAAqB,CAAC,GAAG,CAAC,EACzD,8BAAiB,CAAC,mCAAsB,CAAC,GAAG,CAAC,CAAC,CAC/C;QAC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/lib/util/assign.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.d.ts deleted file mode 100644 index 306bddf7..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function assign(a: A, b: B): A & B; -export declare function assign(a: A, b: B, c: C): A & B & C; -export declare function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export declare function assign(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E; -export declare function assign(target: any, ...sources: Array): any; -//# sourceMappingURL=assign.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.d.ts.map deleted file mode 100644 index 20e9dbff..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/util/assign.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChD,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1E,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAClC,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACrB,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.js deleted file mode 100644 index 78e39015..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} -exports.assign = assign; -//# sourceMappingURL=assign.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.js.map deleted file mode 100644 index 6a697cc9..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/assign.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.js","sourceRoot":"","sources":["../../src/util/assign.ts"],"names":[],"mappings":";;AAiBA,SAAgB,MAAM,CACpB,MAA8B;IAC9B,iBAAyC;SAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;QAAzC,gCAAyC;;IAEzC,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM;QACpB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,IAAI,EAAE;YACpD,OAAO;SACR;QACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.d.ts deleted file mode 100644 index 53d76ab7..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const canUseWeakMap: boolean; -//# sourceMappingURL=canUse.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.d.ts.map deleted file mode 100644 index 74a2206a..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.d.ts","sourceRoot":"","sources":["../src/util/canUse.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAGzB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.js deleted file mode 100644 index c8caab97..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); -//# sourceMappingURL=canUse.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.js.map deleted file mode 100644 index e0e5e566..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/canUse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../src/util/canUse.ts"],"names":[],"mappings":";;AAAa,QAAA,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,IAAI,CAAC,CAC7D,OAAO,SAAS,KAAK,QAAQ;IAC7B,SAAS,CAAC,OAAO,KAAK,aAAa,CACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts deleted file mode 100644 index 61525aad..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function cloneDeep(value: T): T; -//# sourceMappingURL=cloneDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map deleted file mode 100644 index a871948f..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cloneDeep.d.ts","sourceRoot":"","sources":["../src/util/cloneDeep.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAExC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.js deleted file mode 100644 index 8fbfb3fe..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -exports.cloneDeep = cloneDeep; -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} -//# sourceMappingURL=cloneDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.js.map deleted file mode 100644 index 36015d2d..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/cloneDeep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../src/util/cloneDeep.ts"],"names":[],"mappings":";;AAAQ,IAAA,oCAAQ,CAAsB;AAKtC,SAAgB,SAAS,CAAI,KAAQ;IACnC,OAAO,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAFD,8BAEC;AAED,SAAS,eAAe,CAAI,GAAM,EAAE,IAAmB;IACrD,QAAQ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC5B,KAAK,gBAAgB,CAAC,CAAC;YACrB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAM,MAAI,GAAe,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAI,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;gBAC7B,MAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED,KAAK,iBAAiB,CAAC,CAAC;YACtB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAGxC,IAAM,MAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;gBAC1B,MAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED;YACE,OAAO,GAAG,CAAC;KACZ;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.d.ts deleted file mode 100644 index 3dac4c1b..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function getEnv(): string | undefined; -export declare function isEnv(env: string): boolean; -export declare function isProduction(): boolean; -export declare function isDevelopment(): boolean; -export declare function isTest(): boolean; -//# sourceMappingURL=environment.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.d.ts.map deleted file mode 100644 index ac39af26..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/util/environment.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAO3C;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1C;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,wBAAgB,MAAM,IAAI,OAAO,CAEhC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.js deleted file mode 100644 index 13f120ef..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -exports.getEnv = getEnv; -function isEnv(env) { - return getEnv() === env; -} -exports.isEnv = isEnv; -function isProduction() { - return isEnv('production') === true; -} -exports.isProduction = isProduction; -function isDevelopment() { - return isEnv('development') === true; -} -exports.isDevelopment = isDevelopment; -function isTest() { - return isEnv('test') === true; -} -exports.isTest = isTest; -//# sourceMappingURL=environment.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.js.map deleted file mode 100644 index d7b9e1ae..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/environment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/util/environment.ts"],"names":[],"mappings":";;AAAA,SAAgB,MAAM;IACpB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;QAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC7B;IAGD,OAAO,aAAa,CAAC;AACvB,CAAC;AAPD,wBAOC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,MAAM,EAAE,KAAK,GAAG,CAAC;AAC1B,CAAC;AAFD,sBAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AACtC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAFD,sCAEC;AAED,SAAgB,MAAM;IACpB,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAChC,CAAC;AAFD,wBAEC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.d.ts deleted file mode 100644 index d1d25c33..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ExecutionResult } from 'graphql'; -export declare function tryFunctionOrLogError(f: Function): any; -export declare function graphQLResultHasError(result: ExecutionResult): number; -//# sourceMappingURL=errorHandling.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map deleted file mode 100644 index 6955d016..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../src/util/errorHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,OAQhD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,UAE5D"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.js deleted file mode 100644 index a9955e19..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -exports.tryFunctionOrLogError = tryFunctionOrLogError; -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} -exports.graphQLResultHasError = graphQLResultHasError; -//# sourceMappingURL=errorHandling.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.js.map deleted file mode 100644 index 52b9fb6b..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/errorHandling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../src/util/errorHandling.ts"],"names":[],"mappings":";;AAEA,SAAgB,qBAAqB,CAAC,CAAW;IAC/C,IAAI;QACF,OAAO,CAAC,EAAE,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;KACF;AACH,CAAC;AARD,sDAQC;AAED,SAAgB,qBAAqB,CAAC,MAAuB;IAC3D,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC/C,CAAC;AAFD,sDAEC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts deleted file mode 100644 index 429feb86..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function filterInPlace(array: T[], test: (elem: T) => boolean, context?: any): T[]; -//# sourceMappingURL=filterInPlace.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map deleted file mode 100644 index c45757b7..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.d.ts","sourceRoot":"","sources":["../src/util/filterInPlace.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAC1B,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,EAAE,CASL"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.js deleted file mode 100644 index 66b9dd6e..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} -exports.filterInPlace = filterInPlace; -//# sourceMappingURL=filterInPlace.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.js.map deleted file mode 100644 index d0e2a7dc..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/filterInPlace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.js","sourceRoot":"","sources":["../../src/util/filterInPlace.ts"],"names":[],"mappings":";;AAAA,SAAgB,aAAa,CAC3B,KAAU,EACV,IAA0B,EAC1B,OAAa;IAEb,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE;YACnC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;SACxB;IACH,CAAC,EAAE,OAAO,CAAC,CAAC;IACZ,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,sCAaC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.d.ts deleted file mode 100644 index fe095067..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; -//# sourceMappingURL=isEqual.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map deleted file mode 100644 index d2078c93..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../src/util/isEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.js deleted file mode 100644 index f7d228c8..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var equality_1 = require("@wry/equality"); -exports.isEqual = equality_1.equal; -//# sourceMappingURL=isEqual.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.js.map deleted file mode 100644 index c6fe9ba5..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/isEqual.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.js","sourceRoot":"","sources":["../../src/util/isEqual.ts"],"names":[],"mappings":";;AAAA,0CAAiD;AAAxC,6BAAA,KAAK,CAAW"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts deleted file mode 100644 index e5c569ee..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function maybeDeepFreeze(obj: any): any; -//# sourceMappingURL=maybeDeepFreeze.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map deleted file mode 100644 index 99cb3ef8..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.d.ts","sourceRoot":"","sources":["../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,OAYvC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js deleted file mode 100644 index 2f7b836d..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (environment_1.isDevelopment() || environment_1.isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} -exports.maybeDeepFreeze = maybeDeepFreeze; -//# sourceMappingURL=maybeDeepFreeze.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map deleted file mode 100644 index ea62a05d..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AAItD,SAAS,UAAU,CAAC,CAAM;IACxB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEjB,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;QACjD,IACE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI;YAChB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;YAC9D,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EACzB;YACA,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,eAAe,CAAC,GAAQ;IACtC,IAAI,2BAAa,EAAE,IAAI,oBAAM,EAAE,EAAE;QAG/B,IAAM,kBAAkB,GACtB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC;QAEjE,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;SACxB;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAZD,0CAYC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts deleted file mode 100644 index d3c18919..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare type TupleToIntersection = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any; -export declare function mergeDeep(...sources: T): TupleToIntersection; -export declare function mergeDeepArray(sources: T[]): T; -//# sourceMappingURL=mergeDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map deleted file mode 100644 index d95732fc..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.d.ts","sourceRoot":"","sources":["../src/util/mergeDeep.ts"],"names":[],"mappings":"AAgBA,oBAAY,mBAAmB,CAAC,CAAC,SAAS,GAAG,EAAE,IAC7C,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GACvB,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GACpC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACjD,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC9D,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC3E,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;AAElC,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EACvC,GAAG,OAAO,EAAE,CAAC,GACZ,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAQD,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAWjD"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.js deleted file mode 100644 index e4100a26..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -exports.mergeDeep = mergeDeep; -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -exports.mergeDeepArray = mergeDeepArray; -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = tslib_1.__assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} -//# sourceMappingURL=mergeDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.js.map deleted file mode 100644 index 20393f8f..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/mergeDeep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.js","sourceRoot":"","sources":["../../src/util/mergeDeep.ts"],"names":[],"mappings":";;;AAAQ,IAAA,gDAAc,CAAsB;AAwB5C,SAAgB,SAAS;IACvB,iBAAa;SAAb,UAAa,EAAb,qBAAa,EAAb,IAAa;QAAb,4BAAa;;IAEb,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAJD,8BAIC;AAQD,SAAgB,cAAc,CAAI,OAAY;IAC5C,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAO,CAAC;IACnC,IAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7B,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,IAAM,UAAU,GAAU,EAAE,CAAC;QAC7B,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE;YAC9B,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;SACtD;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,wCAWC;AAED,SAAS,QAAQ,CAAC,GAAQ;IACxB,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAClB,MAAW,EACX,MAAW,EACX,UAAiB;IAEjB,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QAGxC,IAAI,MAAM,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YACvD,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SAClD;QAED,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,SAAS;YACnC,IAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE;gBAC1C,IAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;gBACtC,IAAI,WAAW,KAAK,WAAW,EAAE;oBAQ/B,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAC7B,mBAAmB,CAAC,WAAW,EAAE,UAAU,CAAC,EAC5C,WAAW,EACX,UAAU,CACX,CAAC;iBACH;aACF;iBAAM;gBAGL,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;KACf;IAGD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAI,KAAQ,EAAE,UAAiB;IACzD,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAC7B;QACA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,GAAI,KAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjC;aAAM;YACL,KAAK,sBACH,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IACpC,KAAK,CACT,CAAC;SACH;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts deleted file mode 100644 index 48d2b7cb..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function stripSymbols(data: T): T; -//# sourceMappingURL=stripSymbols.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map deleted file mode 100644 index 9e0384d8..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.d.ts","sourceRoot":"","sources":["../src/util/stripSymbols.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAE1C"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.js deleted file mode 100644 index bc978e58..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} -exports.stripSymbols = stripSymbols; -//# sourceMappingURL=stripSymbols.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.js.map deleted file mode 100644 index 3bbcc9c5..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/stripSymbols.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.js","sourceRoot":"","sources":["../../src/util/stripSymbols.ts"],"names":[],"mappings":";;AAWA,SAAgB,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.d.ts deleted file mode 100644 index 0b7c1897..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function warnOnceInDevelopment(msg: string, type?: string): void; -//# sourceMappingURL=warnOnce.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map deleted file mode 100644 index 1b652a3c..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.d.ts","sourceRoot":"","sources":["../src/util/warnOnce.ts"],"names":[],"mappings":"AAYA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAS,QAW/D"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.js b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.js deleted file mode 100644 index 167ba8f0..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!environment_1.isProduction() && !haveWarned[msg]) { - if (!environment_1.isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} -exports.warnOnceInDevelopment = warnOnceInDevelopment; -//# sourceMappingURL=warnOnce.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.js.map b/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.js.map deleted file mode 100644 index 63d8e3d1..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/lib/util/warnOnce.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.js","sourceRoot":"","sources":["../../src/util/warnOnce.ts"],"names":[],"mappings":";;AAAA,6CAAqD;AAErD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAUrC,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAa;IAAb,qBAAA,EAAA,aAAa;IAC9D,IAAI,CAAC,0BAAY,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,CAAC,oBAAM,EAAE,EAAE;YACb,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;AACH,CAAC;AAXD,sDAWC"} \ No newline at end of file diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/package.json b/node_modules/apollo-client/node_modules/apollo-utilities/package.json deleted file mode 100644 index 6430bc72..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "apollo-utilities@1.3.4", - "_id": "apollo-utilities@1.3.4", - "_inBundle": false, - "_integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "_location": "/apollo-client/apollo-utilities", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "apollo-utilities@1.3.4", - "name": "apollo-utilities", - "escapedName": "apollo-utilities", - "rawSpec": "1.3.4", - "saveSpec": null, - "fetchSpec": "1.3.4" - }, - "_requiredBy": [ - "/apollo-client" - ], - "_resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "_shasum": "6129e438e8be201b6c55b0f13ce49d2c7175c9cf", - "_spec": "apollo-utilities@1.3.4", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-client", - "author": { - "name": "James Baxley", - "email": "james@meteor.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "James Burgess", - "email": "jamesmillerburgess@gmail.com" - } - ], - "dependencies": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - }, - "deprecated": false, - "description": "Utilities for working with GraphQL ASTs", - "gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "license": "MIT", - "main": "./lib/bundle.cjs.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-utilities", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "scripts": { - "build": "tsc -b .", - "bundle": "npx rollup -c rollup.config.js", - "clean": "rm -rf coverage/* lib/*", - "coverage": "jest --coverage", - "lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts", - "postbuild": "npm run bundle", - "prebuild": "npm run clean", - "prepare": "npm run lint && npm run build", - "prepublishOnly": "npm run clean && npm run build", - "test": "tsc -p tsconfig.json --noEmit && jest", - "watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.3.4" -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/directives.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/directives.ts deleted file mode 100644 index eea3500a..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/directives.ts +++ /dev/null @@ -1,274 +0,0 @@ -import gql from 'graphql-tag'; -import { cloneDeep } from 'lodash'; - -import { shouldInclude, hasDirectives } from '../directives'; -import { getQueryDefinition } from '../getFromAST'; - -describe('hasDirective', () => { - it('should allow searching the ast for a directive', () => { - const query = gql` - query Simple { - field @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for all operation types', () => { - const query = gql` - { - field @live { - subField { - hello @live - } - } - } - `; - - const mutation = gql` - mutation Directive { - mutate { - field { - subField { - hello @live - } - } - } - } - `; - - const subscription = gql` - subscription LiveDirective { - sub { - field { - subField { - hello @live - } - } - } - } - `; - - [query, mutation, subscription].forEach(x => { - expect(hasDirectives(['live'], x)).toBe(true); - expect(hasDirectives(['defer'], x)).toBe(false); - }); - }); - it('works for simple fragments', () => { - const query = gql` - query Simple { - ...fieldFragment - } - - fragment fieldFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for nested fragments', () => { - const query = gql` - query Simple { - ...fieldFragment1 - } - - fragment fieldFragment1 on Field { - bar { - baz { - ...nestedFragment - } - } - } - - fragment nestedFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); -}); - -describe('shouldInclude', () => { - it('should should not include a skipped field', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include an included field', () => { - const query = gql` - query { - fortuneCookie @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a not include: false field', () => { - const query = gql` - query { - fortuneCookie @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a skip: false field', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a field if skip: false and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: false and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should leave the original query unmodified', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const queryClone = cloneDeep(query); - const field = getQueryDefinition(query).selectionSet.selections[0]; - shouldInclude(field, {}); - expect(query).toEqual(queryClone); - }); - - it('does not throw an error on an unsupported directive', () => { - const query = gql` - query { - fortuneCookie @dosomething(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).not.toThrow(); - }); - - it('throws an error on an invalid argument for the skip directive', () => { - const query = gql` - query { - fortuneCookie @skip(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid argument for the include directive', () => { - const query = gql` - query { - fortuneCookie @include(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid variable name within a directive argument', () => { - const query = gql` - query { - fortuneCookie @include(if: $neverDefined) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('evaluates variables on skip fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @skip(if: $shouldSkip) - } - `; - const variables = { - shouldSkip: true, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('evaluates variables on include fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @include(if: $shouldInclude) - } - `; - const variables = { - shouldInclude: false, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('throws an error if the value of the argument is not a variable or boolean', () => { - const query = gql` - query { - fortuneCookie @include(if: "string") - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/fragments.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/fragments.ts deleted file mode 100644 index 1c6cfa16..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/fragments.ts +++ /dev/null @@ -1,327 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { getFragmentQueryDocument } from '../fragments'; - -describe('getFragmentQueryDocument', () => { - it('will throw an error if there is an operation', () => { - expect(() => - getFragmentQueryDocument( - gql` - { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a query operation named 'Named'. No operations are allowed when using a fragment as a query. Only fragments are allowed.", - ); - expect(() => - getFragmentQueryDocument( - gql` - mutation Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a mutation operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - subscription Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a subscription operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - }); - - it('will throw an error if there is not exactly one fragment but no `fragmentName`', () => { - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - `); - }).toThrowError( - 'Found 2 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - - fragment baz on Baz { - g - h - i - } - `); - }).toThrowError( - 'Found 3 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - scalar Foo - `); - }).toThrowError( - 'Found 0 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - }); - - it('will create a query document where the single fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - `), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - `), - ); - }); - - it('will create a query document where the named fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'foo', - ), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'bar', - ), - ), - ).toEqual( - print(gql` - { - ...bar - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'baz', - ), - ), - ).toEqual( - print(gql` - { - ...baz - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/getFromAST.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/getFromAST.ts deleted file mode 100644 index a81a5f3c..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/getFromAST.ts +++ /dev/null @@ -1,316 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { FragmentDefinitionNode, OperationDefinitionNode } from 'graphql'; - -import { - checkDocument, - getFragmentDefinitions, - getQueryDefinition, - getMutationDefinition, - createFragmentMap, - FragmentMap, - getDefaultValues, - getOperationName, -} from '../getFromAST'; - -describe('AST utility functions', () => { - it('should correctly check a document for correctness', () => { - const multipleQueries = gql` - query { - author { - firstName - lastName - } - } - - query { - author { - address - } - } - `; - expect(() => { - checkDocument(multipleQueries); - }).toThrow(); - - const namedFragment = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - expect(() => { - checkDocument(namedFragment); - }).not.toThrow(); - }); - - it('should get fragment definitions from a document containing a single fragment', () => { - const singleFragmentDefinition = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(singleFragmentDefinition); - expect(actualResult.length).toEqual(expectedResult.length); - expect(print(actualResult[0])).toBe(print(expectedResult[0])); - }); - - it('should get fragment definitions from a document containing a multiple fragments', () => { - const multipleFragmentDefinitions = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - expectedDoc.definitions[1] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(multipleFragmentDefinitions); - expect(actualResult.map(print)).toEqual(expectedResult.map(print)); - }); - - it('should get the correct query definition out of a query containing multiple fragments', () => { - const queryWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedDoc = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getQueryDefinition(queryWithFragments); - - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should throw if we try to get the query definition of a document with no query', () => { - const mutationWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - expect(() => { - getQueryDefinition(mutationWithFragments); - }).toThrow(); - }); - - it('should get the correct mutation definition out of a mutation with multiple fragments', () => { - const mutationWithFragments = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getMutationDefinition(mutationWithFragments); - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should create the fragment map correctly', () => { - const fragments = getFragmentDefinitions(gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `); - const fragmentMap = createFragmentMap(fragments); - const expectedTable: FragmentMap = { - authorDetails: fragments[0], - moreAuthorDetails: fragments[1], - }; - expect(fragmentMap).toEqual(expectedTable); - }); - - it('should return an empty fragment map if passed undefined argument', () => { - expect(createFragmentMap(undefined)).toEqual({}); - }); - - it('should get the operation name out of a query', () => { - const query = gql` - query nameOfQuery { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfQuery'); - }); - - it('should get the operation name out of a mutation', () => { - const query = gql` - mutation nameOfMutation { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfMutation'); - }); - - it('should return null if the query does not have an operation name', () => { - const query = gql` - { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual(null); - }); - - it('should throw if type definitions found in document', () => { - const queryWithTypeDefination = gql` - fragment authorDetails on Author { - firstName - lastName - } - - query($search: AuthorSearchInputType) { - author(search: $search) { - ...authorDetails - } - } - - input AuthorSearchInputType { - firstName: String - } - `; - expect(() => { - getQueryDefinition(queryWithTypeDefination); - }).toThrowError( - 'Schema type definitions not allowed in queries. Found: "InputObjectTypeDefinition"', - ); - }); - - describe('getDefaultValues', () => { - it('will create an empty variable object if no default values are provided', () => { - const basicQuery = gql` - query people($first: Int, $second: String) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({}); - }); - - it('will create a variable object based on the definition node with default values', () => { - const basicQuery = gql` - query people($first: Int = 1, $second: String!) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - const complexMutation = gql` - mutation complexStuff( - $test: Input = { key1: ["value", "value2"], key2: { key3: 4 } } - ) { - complexStuff(test: $test) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({ - first: 1, - }); - expect(getDefaultValues(getMutationDefinition(complexMutation))).toEqual({ - test: { key1: ['value', 'value2'], key2: { key3: 4 } }, - }); - }); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/storeUtils.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/storeUtils.ts deleted file mode 100644 index ba459432..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/storeUtils.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { getStoreKeyName } from '../storeUtils'; - -describe('getStoreKeyName', () => { - it( - 'should return a deterministic version of the store key name no matter ' + - 'which order the args object properties are in', - () => { - const validStoreKeyName = - 'someField({"prop1":"value1","prop2":"value2"})'; - let generatedStoreKeyName = getStoreKeyName('someField', { - prop1: 'value1', - prop2: 'value2', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - - generatedStoreKeyName = getStoreKeyName('someField', { - prop2: 'value2', - prop1: 'value1', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - }, - ); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/transform.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/transform.ts deleted file mode 100644 index 26835f4c..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/__tests__/transform.ts +++ /dev/null @@ -1,1242 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { - addTypenameToDocument, - removeDirectivesFromDocument, - getDirectivesFromDocument, - removeConnectionDirectiveFromDocument, - removeArgumentsFromDocument, - removeFragmentSpreadFromDocument, - removeClientSetsFromDocument, -} from '../transform'; -import { getQueryDefinition } from '../getFromAST'; - -describe('removeArgumentsFromDocument', () => { - it('should remove a single variable', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - field { - child - foo - } - network - } - `; - const doc = removeArgumentsFromDocument([{ name: 'variable' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a single variable and the field from the query', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - network - } - `; - const doc = removeArgumentsFromDocument( - [{ name: 'variable', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeFragmentSpreadFromDocument', () => { - it('should remove a named fragment spread', () => { - const query = gql` - query Simple { - ...FragmentSpread - property - ...ValidSpread - } - - fragment FragmentSpread on Thing { - foo - bar - baz - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const expected = gql` - query Simple { - property - ...ValidSpread - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const doc = removeFragmentSpreadFromDocument( - [{ name: 'FragmentSpread', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeDirectivesFromDocument', () => { - it('should not remove unused variable definitions unless the field is removed', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) - networkField - } - `; - - const doc = removeDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove unused variable definitions associated with the removed directive', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove used variable definitions', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField(usingVariable: $variable) - } - `; - - const expected = gql` - query Simple($variable: String!) { - networkField(usingVariable: $variable) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove fragment spreads and definitions associated with the removed directive', () => { - const query = gql` - query Simple { - networkField - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove fragment spreads and definitions used without the removed directive', () => { - const query = gql` - query Simple { - networkField { - ...ClientFragment - } - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive [test function]', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives in the query', () => { - const query = gql` - query Simple { - field @storage(if: true) - other: field @storage - } - `; - - const expected = gql` - query Simple { - field - other: field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives of different kinds in the query', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other: field @client - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - other: field - } - `; - const removed = [ - { name: 'storage' }, - { - test: (directive: any) => directive.name.value === 'client', - }, - ]; - const doc = removeDirectivesFromDocument(removed, query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive and its field if needed', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should return null if the query is no longer valid [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(doc).toBe(null); - }); - - it('should return null only if the query is not valid', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(query)); - }); - - it('should return null only if the query is not valid through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should only remove values asked through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - bar - } - `; - - const expectedQuery = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - bar - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(expectedQuery)); - }); - - it('should return null even through fragments if needed', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should not throw in combination with addTypenameToDocument', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - expect(() => { - removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - addTypenameToDocument(query), - ); - }).not.toThrow(); - }); -}); - -describe('query transforms', () => { - it('should correctly add typenames', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not add duplicates', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not screw up on a FragmentSpread within the query AST', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should modify all definitions in a document', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - - fragment friendFields on User { - firstName - lastName - } - `; - - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - - fragment friendFields on User { - firstName - lastName - __typename - } - `; - - expect(print(expectedQuery)).toBe(print(newQueryDoc)); - }); - - it('should be able to apply a QueryTransformer correctly', () => { - const testQuery = gql` - query { - author { - firstName - lastName - } - } - `; - - const expectedQuery = getQueryDefinition(gql` - query { - author { - firstName - lastName - __typename - } - } - `); - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should be able to apply a MutationTransformer correctly', () => { - const testQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - } - } - `; - const expectedQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - __typename - } - } - `; - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(modifiedQuery)); - }); - - it('should add typename fields correctly on this one query', () => { - const testQuery = gql` - query Feed($type: FeedType!) { - # Eventually move this into a no fetch query right on the entry - # since we literally just need this info to determine whether to - # show upvote/downvote buttons - currentUser { - login - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - } - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query Feed($type: FeedType!) { - currentUser { - login - __typename - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - __typename - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - __typename - } - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should correctly remove connections', () => { - let testQuery = gql` - query { - author { - name @connection(key: "foo") { - firstName - lastName - } - } - } - `; - const newQueryDoc = removeConnectionDirectiveFromDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(expectedQueryStr).toBe(print(newQueryDoc)); - }); -}); - -describe('getDirectivesFromDocument', () => { - it('should get query with fields of storage directive ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of storage directive [test function] ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = getDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with multiple fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other @storage - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - other @storage - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of both storage and client directives ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [{ name: 'storage' }, { name: 'client' }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with different types of directive matchers ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [ - { name: 'storage' }, - { test: directive => directive.name.value === 'client' }, - ], - query, - ); - - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with nested fields ', () => { - const query = gql` - query Simple { - user { - firstName @client - email - } - } - `; - - const expected = gql` - query Simple { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should include all the nested fields of field that has client directive ', () => { - const query = gql` - query Simple { - user @client { - firstName - email - } - } - `; - - const expected = gql` - query Simple { - user @client { - firstName - email - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(null); - }); - - it('should get query with client fields in fragment', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in fragment with nested fields', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - lastName - } - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in multiple fragments', function() { - const query = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - product - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it("should return null if fragment didn't have client fields", function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(null)); - }); - - it('should get query with client fields when both fields and fragements are mixed', function() { - const query = gql` - query Simple { - user @client - product @storage - order - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - user @client - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation with client fields', () => { - const query = gql` - mutation { - login @client - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation fields of client only', () => { - const query = gql` - mutation { - login @client - updateUser - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - describe('includeAllFragments', () => { - it('= false: should remove the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, false); - expect(print(doc)).toBe(print(expected)); - }); - - it('= true: should include the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, true); - expect(print(doc)).toBe(print(expected)); - }); - }); -}); - -describe('removeClientSetsFromDocument', () => { - it('should remove @client fields from document', () => { - const query = gql` - query Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - query Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove @client fields from fragments', () => { - const query = gql` - fragment authorInfo on Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - fragment authorInfo on Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/declarations.d.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/declarations.d.ts deleted file mode 100644 index 69546655..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/declarations.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'fast-json-stable-stringify'; diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/directives.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/directives.ts deleted file mode 100644 index 84c14aba..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/directives.ts +++ /dev/null @@ -1,127 +0,0 @@ -// Provides the methods that allow QueryManager to handle the `skip` and -// `include` directives within GraphQL. -import { - FieldNode, - SelectionNode, - VariableNode, - BooleanValueNode, - DirectiveNode, - DocumentNode, - ArgumentNode, - ValueNode, -} from 'graphql'; - -import { visit } from 'graphql/language/visitor'; - -import { invariant } from 'ts-invariant'; - -import { argumentsObjectFromField } from './storeUtils'; - -export type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }; -}; - -export function getDirectiveInfoFromField( - field: FieldNode, - variables: Object, -): DirectiveInfo { - if (field.directives && field.directives.length) { - const directiveObj: DirectiveInfo = {}; - field.directives.forEach((directive: DirectiveNode) => { - directiveObj[directive.name.value] = argumentsObjectFromField( - directive, - variables, - ); - }); - return directiveObj; - } - return null; -} - -export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any } = {}, -): boolean { - return getInclusionDirectives( - selection.directives, - ).every(({ directive, ifArgument }) => { - let evaledValue: boolean = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[(ifArgument.value as VariableNode).name.value]; - invariant( - evaledValue !== void 0, - `Invalid variable referenced in @${directive.name.value} directive.`, - ); - } else { - evaledValue = (ifArgument.value as BooleanValueNode).value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -export function getDirectiveNames(doc: DocumentNode) { - const names: string[] = []; - - visit(doc, { - Directive(node) { - names.push(node.name.value); - }, - }); - - return names; -} - -export function hasDirectives(names: string[], doc: DocumentNode) { - return getDirectiveNames(doc).some( - (name: string) => names.indexOf(name) > -1, - ); -} - -export function hasClientExports(document: DocumentNode) { - return ( - document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document) - ); -} - -export type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; - -function isInclusionDirective({ name: { value } }: DirectiveNode): boolean { - return value === 'skip' || value === 'include'; -} - -export function getInclusionDirectives( - directives: ReadonlyArray, -): InclusionDirectives { - return directives ? directives.filter(isInclusionDirective).map(directive => { - const directiveArguments = directive.arguments; - const directiveName = directive.name.value; - - invariant( - directiveArguments && directiveArguments.length === 1, - `Incorrect number of arguments for the @${directiveName} directive.`, - ); - - const ifArgument = directiveArguments[0]; - invariant( - ifArgument.name && ifArgument.name.value === 'if', - `Invalid argument for the @${directiveName} directive.`, - ); - - const ifValue: ValueNode = ifArgument.value; - - // means it has to be a variable value if this is a valid @skip or @include directive - invariant( - ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), - `Argument for the @${directiveName} directive must be a variable or a boolean value.`, - ); - - return { directive, ifArgument }; - }) : []; -} - diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/fragments.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/fragments.ts deleted file mode 100644 index f60c86a6..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/fragments.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { DocumentNode, FragmentDefinitionNode } from 'graphql'; -import { invariant, InvariantError } from 'ts-invariant'; - -/** - * Returns a query document which adds a single query operation that only - * spreads the target fragment inside of it. - * - * So for example a document of: - * - * ```graphql - * fragment foo on Foo { a b c } - * ``` - * - * Turns into: - * - * ```graphql - * { ...foo } - * - * fragment foo on Foo { a b c } - * ``` - * - * The target fragment will either be the only fragment in the document, or a - * fragment specified by the provided `fragmentName`. If there is more than one - * fragment, but a `fragmentName` was not defined then an error will be thrown. - */ -export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, -): DocumentNode { - let actualFragmentName = fragmentName; - - // Build an array of all our fragment definitions that will be used for - // validations. We also do some validations on the other definitions in the - // document while building this list. - const fragments: Array = []; - document.definitions.forEach(definition => { - // Throw an error if we encounter an operation definition because we will - // define our own operation definition later on. - if (definition.kind === 'OperationDefinition') { - throw new InvariantError( - `Found a ${definition.operation} operation${ - definition.name ? ` named '${definition.name.value}'` : '' - }. ` + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - } - // Add our definition to the fragments array if it is a fragment - // definition. - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - // If the user did not give us a fragment name then let us try to get a - // name from a single fragment in the definition. - if (typeof actualFragmentName === 'undefined') { - invariant( - fragments.length === 1, - `Found ${ - fragments.length - } fragments. \`fragmentName\` must be provided when there is not exactly 1 fragment.`, - ); - actualFragmentName = fragments[0].name.value; - } - - // Generate a query document with an operation that simply spreads the - // fragment inside of it. - const query: DocumentNode = { - ...document, - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - }, - ...document.definitions, - ], - }; - - return query; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/getFromAST.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/getFromAST.ts deleted file mode 100644 index febe5260..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/getFromAST.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { - DocumentNode, - OperationDefinitionNode, - FragmentDefinitionNode, - ValueNode, -} from 'graphql'; - -import { invariant, InvariantError } from 'ts-invariant'; - -import { assign } from './util/assign'; - -import { valueToObjectRepresentation, JsonValue } from './storeUtils'; - -export function getMutationDefinition( - doc: DocumentNode, -): OperationDefinitionNode { - checkDocument(doc); - - let mutationDef: OperationDefinitionNode | null = doc.definitions.filter( - definition => - definition.kind === 'OperationDefinition' && - definition.operation === 'mutation', - )[0] as OperationDefinitionNode; - - invariant(mutationDef, 'Must contain a mutation definition.'); - - return mutationDef; -} - -// Checks the document for errors and throws an exception if there is an error. -export function checkDocument(doc: DocumentNode) { - invariant( - doc && doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - const operations = doc.definitions - .filter(d => d.kind !== 'FragmentDefinition') - .map(definition => { - if (definition.kind !== 'OperationDefinition') { - throw new InvariantError( - `Schema type definitions not allowed in queries. Found: "${ - definition.kind - }"`, - ); - } - return definition; - }); - - invariant( - operations.length <= 1, - `Ambiguous GraphQL document: contains ${operations.length} operations`, - ); - - return doc; -} - -export function getOperationDefinition( - doc: DocumentNode, -): OperationDefinitionNode | undefined { - checkDocument(doc); - return doc.definitions.filter( - definition => definition.kind === 'OperationDefinition', - )[0] as OperationDefinitionNode; -} - -export function getOperationDefinitionOrDie( - document: DocumentNode, -): OperationDefinitionNode { - const def = getOperationDefinition(document); - invariant(def, `GraphQL document is missing an operation`); - return def; -} - -export function getOperationName(doc: DocumentNode): string | null { - return ( - doc.definitions - .filter( - definition => - definition.kind === 'OperationDefinition' && definition.name, - ) - .map((x: OperationDefinitionNode) => x.name.value)[0] || null - ); -} - -// Returns the FragmentDefinitions from a particular document as an array -export function getFragmentDefinitions( - doc: DocumentNode, -): FragmentDefinitionNode[] { - return doc.definitions.filter( - definition => definition.kind === 'FragmentDefinition', - ) as FragmentDefinitionNode[]; -} - -export function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode { - const queryDef = getOperationDefinition(doc) as OperationDefinitionNode; - - invariant( - queryDef && queryDef.operation === 'query', - 'Must contain a query definition.', - ); - - return queryDef; -} - -export function getFragmentDefinition( - doc: DocumentNode, -): FragmentDefinitionNode { - invariant( - doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - invariant( - doc.definitions.length <= 1, - 'Fragment must have exactly one definition.', - ); - - const fragmentDef = doc.definitions[0] as FragmentDefinitionNode; - - invariant( - fragmentDef.kind === 'FragmentDefinition', - 'Must be a fragment definition.', - ); - - return fragmentDef as FragmentDefinitionNode; -} - -/** - * Returns the first operation definition found in this document. - * If no operation definition is found, the first fragment definition will be returned. - * If no definitions are found, an error will be thrown. - */ -export function getMainDefinition( - queryDoc: DocumentNode, -): OperationDefinitionNode | FragmentDefinitionNode { - checkDocument(queryDoc); - - let fragmentDefinition; - - for (let definition of queryDoc.definitions) { - if (definition.kind === 'OperationDefinition') { - const operation = (definition as OperationDefinitionNode).operation; - if ( - operation === 'query' || - operation === 'mutation' || - operation === 'subscription' - ) { - return definition as OperationDefinitionNode; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - // we do this because we want to allow multiple fragment definitions - // to precede an operation definition. - fragmentDefinition = definition as FragmentDefinitionNode; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw new InvariantError( - 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.', - ); -} - -/** - * This is an interface that describes a map from fragment names to fragment definitions. - */ -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} - -// Utility function that takes a list of fragment definitions and makes a hash out of them -// that maps the name of the fragment to the fragment definition. -export function createFragmentMap( - fragments: FragmentDefinitionNode[] = [], -): FragmentMap { - const symTable: FragmentMap = {}; - fragments.forEach(fragment => { - symTable[fragment.name.value] = fragment; - }); - - return symTable; -} - -export function getDefaultValues( - definition: OperationDefinitionNode | undefined, -): { [key: string]: JsonValue } { - if ( - definition && - definition.variableDefinitions && - definition.variableDefinitions.length - ) { - const defaultValues = definition.variableDefinitions - .filter(({ defaultValue }) => defaultValue) - .map( - ({ variable, defaultValue }): { [key: string]: JsonValue } => { - const defaultValueObj: { [key: string]: JsonValue } = {}; - valueToObjectRepresentation( - defaultValueObj, - variable.name, - defaultValue as ValueNode, - ); - - return defaultValueObj; - }, - ); - - return assign({}, ...defaultValues); - } - - return {}; -} - -/** - * Returns the names of all variables declared by the operation. - */ -export function variablesInOperation( - operation: OperationDefinitionNode, -): Set { - const names = new Set(); - if (operation.variableDefinitions) { - for (const definition of operation.variableDefinitions) { - names.add(definition.variable.name.value); - } - } - - return names; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/index.js.flow b/node_modules/apollo-client/node_modules/apollo-utilities/src/index.js.flow deleted file mode 100644 index a7fc594d..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/index.js.flow +++ /dev/null @@ -1,220 +0,0 @@ -// @flow -import type { - DirectiveNode, - StringValueNode, - BooleanValueNode, - IntValueNode, - FloatValueNode, - EnumValueNode, - VariableNode, - FieldNode, - FragmentDefinitionNode, - OperationDefinitionNode, - SelectionNode, - DocumentNode, - DefinitionNode, - ValueNode, - NameNode, -} from 'graphql'; - -declare module 'apollo-utilities' { - // storeUtils - declare export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | void; - } - - declare export interface JsonValue { - type: 'json'; - json: any; - } - - declare export type ListValue = Array; - - declare export type StoreValue = - | number - | string - | Array - | IdValue - | ListValue - | JsonValue - | null - | void - | Object; - - declare export type ScalarValue = - | StringValueNode - | BooleanValueNode - | EnumValueNode; - - declare export type NumberValue = IntValueNode | FloatValueNode; - - declare type isValueFn = (value: ValueNode) => boolean; - - declare export type isScalarValue = isValueFn; - declare export type isNumberValue = isValueFn; - declare export type isStringValue = isValueFn; - declare export type isBooleanValue = isValueFn; - declare export type isIntValue = isValueFn; - declare export type isFloatValue = isValueFn; - declare export type isVariable = isValueFn; - declare export type isObjectValue = isValueFn; - declare export type isListValue = isValueFn; - declare export type isEnumValue = isValueFn; - - declare export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, - ): any; - - declare export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, - ): string; - - declare export type Directives = { - [directiveName: string]: { - [argName: string]: any, - }, - }; - - declare export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, - ): string; - - declare export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, - ): ?Object; - - declare export function resultKeyNameFromField(field: FieldNode): string; - - declare export function isField(selection: SelectionNode): boolean; - - declare export function isInlineFragment(selection: SelectionNode): boolean; - - declare export function isIdValue(idObject: StoreValue): boolean; - - declare export type IdConfig = { - id: string, - typename: string | void, - }; - - declare export function toIdValue( - id: string | IdConfig, - generated?: boolean, - ): IdValue; - - declare export function isJsonValue(jsonObject: StoreValue): boolean; - - declare export type VariableValue = (node: VariableNode) => any; - - declare export function valueFromNode( - node: ValueNode, - onVariable: VariableValue, - ): any; - - // getFromAST - declare export function getMutationDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function checkDocument(doc: DocumentNode): void; - - declare export function getOperationDefinition( - doc: DocumentNode, - ): ?OperationDefinitionNode; - - declare export function getOperationDefinitionOrDie( - document: DocumentNode, - ): OperationDefinitionNode; - - declare export function getOperationName(doc: DocumentNode): ?string; - - declare export function getFragmentDefinitions( - doc: DocumentNode, - ): Array; - - declare export function getQueryDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function getFragmentDefinition( - doc: DocumentNode, - ): FragmentDefinitionNode; - - declare export function getMainDefinition( - queryDoc: DocumentNode, - ): OperationDefinitionNode | FragmentDefinitionNode; - - declare export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; - } - - declare export function createFragmentMap( - fragments: Array, - ): FragmentMap; - - declare export function getDefaultValues( - definition: ?OperationDefinitionNode, - ): { [key: string]: JsonValue }; - - // fragments - declare export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, - ): DocumentNode; - - declare export function variablesInOperation( - operation: OperationDefinitionNode, - ): Set; - - // directives - declare type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }, - }; - - declare export function getDirectiveInfoFromField( - field: FieldNode, - object: Object, - ): ?DirectiveInfo; - - declare export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any }, - ): boolean; - - declare export function flattenSelections( - selection: SelectionNode, - ): Array; - - declare export function getDirectiveNames(doc: DocumentNode): Array; - - declare export function hasDirectives( - names: Array, - doc: DocumentNode, - ): boolean; - - // transform - declare export type RemoveDirectiveConfig = { - name?: string, - test?: (directive: DirectiveNode) => boolean, - }; - - declare export function removeDirectivesFromDocument( - directives: Array, - doc: DocumentNode, - ): DocumentNode; - - declare export function addTypenameToDocument(doc: DocumentNode): void; - - declare export function removeConnectionDirectiveFromDocument( - doc: DocumentNode, - ): DocumentNode; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/index.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/index.ts deleted file mode 100644 index 18b0a815..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/storeUtils.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/storeUtils.ts deleted file mode 100644 index 2bd1e53a..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/storeUtils.ts +++ /dev/null @@ -1,340 +0,0 @@ -import { - DirectiveNode, - FieldNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - ObjectValueNode, - ListValueNode, - EnumValueNode, - NullValueNode, - VariableNode, - InlineFragmentNode, - ValueNode, - SelectionNode, - NameNode, -} from 'graphql'; - -import stringify from 'fast-json-stable-stringify'; -import { InvariantError } from 'ts-invariant'; - -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} - -export interface JsonValue { - type: 'json'; - json: any; -} - -export type ListValue = Array; - -export type StoreValue = - | number - | string - | string[] - | IdValue - | ListValue - | JsonValue - | null - | undefined - | void - | Object; - -export type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; - -export function isScalarValue(value: ValueNode): value is ScalarValue { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -export type NumberValue = IntValueNode | FloatValueNode; - -export function isNumberValue(value: ValueNode): value is NumberValue { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value: ValueNode): value is StringValueNode { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value: ValueNode): value is BooleanValueNode { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value: ValueNode): value is IntValueNode { - return value.kind === 'IntValue'; -} - -function isFloatValue(value: ValueNode): value is FloatValueNode { - return value.kind === 'FloatValue'; -} - -function isVariable(value: ValueNode): value is VariableNode { - return value.kind === 'Variable'; -} - -function isObjectValue(value: ValueNode): value is ObjectValueNode { - return value.kind === 'ObjectValue'; -} - -function isListValue(value: ValueNode): value is ListValueNode { - return value.kind === 'ListValue'; -} - -function isEnumValue(value: ValueNode): value is EnumValueNode { - return value.kind === 'EnumValue'; -} - -function isNullValue(value: ValueNode): value is NullValueNode { - return value.kind === 'NullValue'; -} - -export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, -) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - const nestedArgObj = {}; - value.fields.map(obj => - valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables), - ); - argObj[name.value] = nestedArgObj; - } else if (isVariable(value)) { - const variableValue = (variables || ({} as any))[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(listValue => { - const nestedArgArrayObj = {}; - valueToObjectRepresentation( - nestedArgArrayObj, - name, - listValue, - variables, - ); - return (nestedArgArrayObj as any)[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = (value as EnumValueNode).value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw new InvariantError( - `The inline argument "${name.value}" of kind "${(value as any).kind}"` + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.', - ); - } -} - -export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, -): string { - let directivesObj: any = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(directive => { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(({ name, value }) => - valueToObjectRepresentation( - directivesObj[directive.name.value], - name, - value, - variables, - ), - ); - } - }); - } - - let argObj: any = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -export type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; - -const KNOWN_DIRECTIVES: string[] = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; - -export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, -): string { - if ( - directives && - directives['connection'] && - directives['connection']['key'] - ) { - if ( - directives['connection']['filter'] && - (directives['connection']['filter'] as string[]).length > 0 - ) { - const filterKeys = directives['connection']['filter'] - ? (directives['connection']['filter'] as string[]) - : []; - filterKeys.sort(); - - const queryArgs = args as { [key: string]: any }; - const filteredArgs = {} as { [key: string]: any }; - filterKeys.forEach(key => { - filteredArgs[key] = queryArgs[key]; - }); - - return `${directives['connection']['key']}(${JSON.stringify( - filteredArgs, - )})`; - } else { - return directives['connection']['key']; - } - } - - let completeFieldName: string = fieldName; - - if (args) { - // We can't use `JSON.stringify` here since it's non-deterministic, - // and can lead to different store key names being created even though - // the `args` object used during creation has the same properties/values. - const stringifiedArgs: string = stringify(args); - completeFieldName += `(${stringifiedArgs})`; - } - - if (directives) { - Object.keys(directives).forEach(key => { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += `@${key}(${JSON.stringify(directives[key])})`; - } else { - completeFieldName += `@${key}`; - } - }); - } - - return completeFieldName; -} - -export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, -): Object { - if (field.arguments && field.arguments.length) { - const argObj: Object = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - return argObj; - } - - return null; -} - -export function resultKeyNameFromField(field: FieldNode): string { - return field.alias ? field.alias.value : field.name.value; -} - -export function isField(selection: SelectionNode): selection is FieldNode { - return selection.kind === 'Field'; -} - -export function isInlineFragment( - selection: SelectionNode, -): selection is InlineFragmentNode { - return selection.kind === 'InlineFragment'; -} - -export function isIdValue(idObject: StoreValue): idObject is IdValue { - return idObject && - (idObject as IdValue | JsonValue).type === 'id' && - typeof (idObject as IdValue).generated === 'boolean'; -} - -export type IdConfig = { - id: string; - typename: string | undefined; -}; - -export function toIdValue( - idConfig: string | IdConfig, - generated = false, -): IdValue { - return { - type: 'id', - generated, - ...(typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig), - }; -} - -export function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue { - return ( - jsonObject != null && - typeof jsonObject === 'object' && - (jsonObject as IdValue | JsonValue).type === 'json' - ); -} - -function defaultValueFromVariable(node: VariableNode) { - throw new InvariantError(`Variable nodes are not supported by valueFromNode`); -} - -export type VariableValue = (node: VariableNode) => any; - -/** - * Evaluate a ValueNode and yield its value in its natural JS form. - */ -export function valueFromNode( - node: ValueNode, - onVariable: VariableValue = defaultValueFromVariable, -): any { - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(v => valueFromNode(v, onVariable)); - case 'ObjectValue': { - const value: { [key: string]: any } = {}; - for (const field of node.fields) { - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/transform.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/transform.ts deleted file mode 100644 index d77b8e54..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/transform.ts +++ /dev/null @@ -1,542 +0,0 @@ -import { - DocumentNode, - SelectionNode, - SelectionSetNode, - OperationDefinitionNode, - FieldNode, - DirectiveNode, - FragmentDefinitionNode, - ArgumentNode, - FragmentSpreadNode, - VariableDefinitionNode, - VariableNode, -} from 'graphql'; -import { visit } from 'graphql/language/visitor'; - -import { - checkDocument, - getOperationDefinition, - getFragmentDefinition, - getFragmentDefinitions, - createFragmentMap, - FragmentMap, - getMainDefinition, -} from './getFromAST'; -import { filterInPlace } from './util/filterInPlace'; -import { invariant } from 'ts-invariant'; -import { isField, isInlineFragment } from './storeUtils'; - -export type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; - -export type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; - -export type RemoveDirectiveConfig = RemoveNodeConfig; -export type GetDirectiveConfig = GetNodeConfig; -export type RemoveArgumentsConfig = RemoveNodeConfig; -export type GetFragmentSpreadConfig = GetNodeConfig; -export type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export type RemoveFragmentDefinitionConfig = RemoveNodeConfig< - FragmentDefinitionNode ->; -export type RemoveVariableDefinitionConfig = RemoveNodeConfig< - VariableDefinitionNode ->; - -const TYPENAME_FIELD: FieldNode = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; - -function isEmpty( - op: OperationDefinitionNode | FragmentDefinitionNode, - fragments: FragmentMap, -): boolean { - return op.selectionSet.selections.every( - selection => - selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments), - ); -} - -function nullIfDocIsEmpty(doc: DocumentNode) { - return isEmpty( - getOperationDefinition(doc) || getFragmentDefinition(doc), - createFragmentMap(getFragmentDefinitions(doc)), - ) - ? null - : doc; -} - -function getDirectiveMatcher( - directives: (RemoveDirectiveConfig | GetDirectiveConfig)[], -) { - return function directiveMatcher(directive: DirectiveNode) { - return directives.some( - dir => - (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)), - ); - }; -} - -export function removeDirectivesFromDocument( - directives: RemoveDirectiveConfig[], - doc: DocumentNode, -): DocumentNode | null { - const variablesInUse: Record = Object.create(null); - let variablesToRemove: RemoveArgumentsConfig[] = []; - - const fragmentSpreadsInUse: Record = Object.create(null); - let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = []; - - let modifiedDoc = nullIfDocIsEmpty( - visit(doc, { - Variable: { - enter(node, _key, parent) { - // Store each variable that's referenced as part of an argument - // (excluding operation definition variables), so we know which - // variables are being used. If we later want to remove a variable - // we'll fist check to see if it's being used, before continuing with - // the removal. - if ( - (parent as VariableDefinitionNode).kind !== 'VariableDefinition' - ) { - variablesInUse[node.name.value] = true; - } - }, - }, - - Field: { - enter(node) { - if (directives && node.directives) { - // If `remove` is set to true for a directive, and a directive match - // is found for a field, remove the field as well. - const shouldRemoveField = directives.some( - directive => directive.remove, - ); - - if ( - shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives)) - ) { - if (node.arguments) { - // Store field argument variables so they can be removed - // from the operation definition. - node.arguments.forEach(arg => { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: (arg.value as VariableNode).name.value, - }); - } - }); - } - - if (node.selectionSet) { - // Store fragment spread names so they can be removed from the - // docuemnt. - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach( - frag => { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }, - ); - } - - // Remove the field. - return null; - } - } - }, - }, - - FragmentSpread: { - enter(node) { - // Keep track of referenced fragment spreads. This is used to - // determine if top level fragment definitions should be removed. - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - - Directive: { - enter(node) { - // If a matching directive is found, remove it. - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - }), - ); - - // If we've removed fields with arguments, make sure the associated - // variables are also removed from the rest of the document, as long as they - // aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length - ) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - // If we've removed selection sets with fragment spreads, make sure the - // associated fragment definitions are also removed from the rest of the - // document, as long as they aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name]) - .length - ) { - modifiedDoc = removeFragmentSpreadFromDocument( - fragmentSpreadsToRemove, - modifiedDoc, - ); - } - - return modifiedDoc; -} - -export function addTypenameToDocument(doc: DocumentNode): DocumentNode { - return visit(checkDocument(doc), { - SelectionSet: { - enter(node, _key, parent) { - // Don't add __typename to OperationDefinitions. - if ( - parent && - (parent as OperationDefinitionNode).kind === 'OperationDefinition' - ) { - return; - } - - // No changes if no selections. - const { selections } = node; - if (!selections) { - return; - } - - // If selections already have a __typename, or are part of an - // introspection query, do nothing. - const skip = selections.some(selection => { - return ( - isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0) - ); - }); - if (skip) { - return; - } - - // If this SelectionSet is @export-ed as an input variable, it should - // not have a __typename field (see issue #4691). - const field = parent as FieldNode; - if ( - isField(field) && - field.directives && - field.directives.some(d => d.name.value === 'export') - ) { - return; - } - - // Create and return a new SelectionSet with a __typename Field. - return { - ...node, - selections: [...selections, TYPENAME_FIELD], - }; - }, - }, - }); -} - -const connectionRemoveConfig = { - test: (directive: DirectiveNode) => { - const willRemove = directive.name.value === 'connection'; - if (willRemove) { - if ( - !directive.arguments || - !directive.arguments.some(arg => arg.name.value === 'key') - ) { - invariant.warn( - 'Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.', - ); - } - } - - return willRemove; - }, -}; - -export function removeConnectionDirectiveFromDocument(doc: DocumentNode) { - return removeDirectivesFromDocument( - [connectionRemoveConfig], - checkDocument(doc), - ); -} - -function hasDirectivesInSelectionSet( - directives: GetDirectiveConfig[], - selectionSet: SelectionSetNode, - nestedCheck = true, -): boolean { - return ( - selectionSet && - selectionSet.selections && - selectionSet.selections.some(selection => - hasDirectivesInSelection(directives, selection, nestedCheck), - ) - ); -} - -function hasDirectivesInSelection( - directives: GetDirectiveConfig[], - selection: SelectionNode, - nestedCheck = true, -): boolean { - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return ( - selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet( - directives, - selection.selectionSet, - nestedCheck, - )) - ); -} - -export function getDirectivesFromDocument( - directives: GetDirectiveConfig[], - doc: DocumentNode, -): DocumentNode { - checkDocument(doc); - - let parentPath: string; - - return nullIfDocIsEmpty( - visit(doc, { - SelectionSet: { - enter(node, _key, _parent, path) { - const currentPath = path.join('-'); - - if ( - !parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath) - ) { - if (node.selections) { - const selectionsWithDirectives = node.selections.filter( - selection => hasDirectivesInSelection(directives, selection), - ); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return { - ...node, - selections: selectionsWithDirectives, - }; - } else { - return null; - } - } - }, - }, - }), - ); -} - -function getArgumentMatcher(config: RemoveArgumentsConfig[]) { - return function argumentMatcher(argument: ArgumentNode) { - return config.some( - (aConfig: RemoveArgumentsConfig) => - argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))), - ); - }; -} - -export function removeArgumentsFromDocument( - config: RemoveArgumentsConfig[], - doc: DocumentNode, -): DocumentNode { - const argMatcher = getArgumentMatcher(config); - - return nullIfDocIsEmpty( - visit(doc, { - OperationDefinition: { - enter(node) { - return { - ...node, - // Remove matching top level variables definitions. - variableDefinitions: node.variableDefinitions.filter( - varDef => - !config.some(arg => arg.name === varDef.variable.name.value), - ), - }; - }, - }, - - Field: { - enter(node) { - // If `remove` is set to true for an argument, and an argument match - // is found for a field, remove the field as well. - const shouldRemoveField = config.some(argConfig => argConfig.remove); - - if (shouldRemoveField) { - let argMatchCount = 0; - node.arguments.forEach(arg => { - if (argMatcher(arg)) { - argMatchCount += 1; - } - }); - if (argMatchCount === 1) { - return null; - } - } - }, - }, - - Argument: { - enter(node) { - // Remove all matching arguments. - if (argMatcher(node)) { - return null; - } - }, - }, - }), - ); -} - -export function removeFragmentSpreadFromDocument( - config: RemoveFragmentSpreadConfig[], - doc: DocumentNode, -): DocumentNode { - function enter( - node: FragmentSpreadNode | FragmentDefinitionNode, - ): null | void { - if (config.some(def => def.name === node.name.value)) { - return null; - } - } - - return nullIfDocIsEmpty( - visit(doc, { - FragmentSpread: { enter }, - FragmentDefinition: { enter }, - }), - ); -} - -function getAllFragmentSpreadsFromSelectionSet( - selectionSet: SelectionSetNode, -): FragmentSpreadNode[] { - const allFragments: FragmentSpreadNode[] = []; - - selectionSet.selections.forEach(selection => { - if ( - (isField(selection) || isInlineFragment(selection)) && - selection.selectionSet - ) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach( - frag => allFragments.push(frag), - ); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - - return allFragments; -} - -// If the incoming document is a query, return it as is. Otherwise, build a -// new document containing a query operation based on the selection set -// of the previous main operation. -export function buildQueryFromSelectionSet( - document: DocumentNode, -): DocumentNode { - const definition = getMainDefinition(document); - const definitionOperation = (definition).operation; - - if (definitionOperation === 'query') { - // Already a query, so return the existing document. - return document; - } - - // Build a new query using the selection set of the main operation. - const modifiedDoc = visit(document, { - OperationDefinition: { - enter(node) { - return { - ...node, - operation: 'query', - }; - }, - }, - }); - return modifiedDoc; -} - -// Remove fields / selection sets that include an @client directive. -export function removeClientSetsFromDocument( - document: DocumentNode, -): DocumentNode | null { - checkDocument(document); - - let modifiedDoc = removeDirectivesFromDocument( - [ - { - test: (directive: DirectiveNode) => directive.name.value === 'client', - remove: true, - }, - ], - document, - ); - - // After a fragment definition has had its @client related document - // sets removed, if the only field it has left is a __typename field, - // remove the entire fragment operation to prevent it from being fired - // on the server. - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter(node) { - if (node.selectionSet) { - const isTypenameOnly = node.selectionSet.selections.every( - selection => - isField(selection) && selection.name.value === '__typename', - ); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - - return modifiedDoc; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/assign.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/assign.ts deleted file mode 100644 index 6d3ef045..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/assign.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { assign } from '../assign'; - -describe('assign', () => { - it('will merge many objects together', () => { - expect(assign({ a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 })).toEqual({ - a: 1, - b: 2, - c: 3, - }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 })).toEqual({ - a: 1, - b: 2, - c: 3, - d: 4, - }); - }); - - it('will merge many objects together shallowly', () => { - expect(assign({ x: { a: 1 } }, { x: { b: 2 } })).toEqual({ x: { b: 2 } }); - expect(assign({ x: { a: 1 } }, { x: { b: 2 } }, { x: { c: 3 } })).toEqual({ - x: { c: 3 }, - }); - expect( - assign( - { x: { a: 1 } }, - { x: { b: 2 } }, - { x: { c: 3 } }, - { x: { d: 4 } }, - ), - ).toEqual({ x: { d: 4 } }); - }); - - it('will mutate and return the source objects', () => { - const source1 = { a: 1 }; - const source2 = { a: 1 }; - const source3 = { a: 1 }; - - expect(assign(source1, { b: 2 })).toEqual(source1); - expect(assign(source2, { b: 2 }, { c: 3 })).toEqual(source2); - expect(assign(source3, { b: 2 }, { c: 3 }, { d: 4 })).toEqual(source3); - - expect(source1).toEqual({ a: 1, b: 2 }); - expect(source2).toEqual({ a: 1, b: 2, c: 3 }); - expect(source3).toEqual({ a: 1, b: 2, c: 3, d: 4 }); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts deleted file mode 100644 index 52b491b5..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { cloneDeep } from '../cloneDeep'; - -describe('cloneDeep', () => { - it('will clone primitive values', () => { - expect(cloneDeep(undefined)).toEqual(undefined); - expect(cloneDeep(null)).toEqual(null); - expect(cloneDeep(true)).toEqual(true); - expect(cloneDeep(false)).toEqual(false); - expect(cloneDeep(-1)).toEqual(-1); - expect(cloneDeep(+1)).toEqual(+1); - expect(cloneDeep(0.5)).toEqual(0.5); - expect(cloneDeep('hello')).toEqual('hello'); - expect(cloneDeep('world')).toEqual('world'); - }); - - it('will clone objects', () => { - const value1 = {}; - const value2 = { a: 1, b: 2, c: 3 }; - const value3 = { x: { a: 1, b: 2, c: 3 }, y: { a: 1, b: 2, c: 3 } }; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3.x).toEqual(value3.x); - expect(clonedValue3.y).toEqual(value3.y); - }); - - it('will clone arrays', () => { - const value1: Array = []; - const value2 = [1, 2, 3]; - const value3 = [[1, 2, 3], [1, 2, 3]]; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3[0]).toEqual(value3[0]); - expect(clonedValue3[1]).toEqual(value3[1]); - }); - - it('should not attempt to follow circular references', () => { - const someObject = { - prop1: 'value1', - anotherObject: null, - }; - const anotherObject = { - someObject, - }; - someObject.anotherObject = anotherObject; - let chk; - expect(() => { - chk = cloneDeep(someObject); - }).not.toThrow(); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/environment.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/environment.ts deleted file mode 100644 index dcb71538..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/environment.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { isEnv, isProduction, isDevelopment, isTest } from '../environment'; - -describe('environment', () => { - let keepEnv: string | undefined; - - beforeEach(() => { - // save the NODE_ENV - keepEnv = process.env.NODE_ENV; - }); - - afterEach(() => { - // restore the NODE_ENV - process.env.NODE_ENV = keepEnv; - }); - - describe('isEnv', () => { - it(`should match when there's a value`, () => { - ['production', 'development', 'test'].forEach(env => { - process.env.NODE_ENV = env; - expect(isEnv(env)).toBe(true); - }); - }); - - it(`should treat no proces.env.NODE_ENV as it'd be in development`, () => { - delete process.env.NODE_ENV; - expect(isEnv('development')).toBe(true); - }); - }); - - describe('isProduction', () => { - it('should return true if in production', () => { - process.env.NODE_ENV = 'production'; - expect(isProduction()).toBe(true); - }); - - it('should return false if not in production', () => { - process.env.NODE_ENV = 'test'; - expect(!isProduction()).toBe(true); - }); - }); - - describe('isTest', () => { - it('should return true if in test', () => { - process.env.NODE_ENV = 'test'; - expect(isTest()).toBe(true); - }); - - it('should return true if not in test', () => { - process.env.NODE_ENV = 'development'; - expect(!isTest()).toBe(true); - }); - }); - - describe('isDevelopment', () => { - it('should return true if in development', () => { - process.env.NODE_ENV = 'development'; - expect(isDevelopment()).toBe(true); - }); - - it('should return true if not in development and environment is defined', () => { - process.env.NODE_ENV = 'test'; - expect(!isDevelopment()).toBe(true); - }); - - it('should make development as the default environment', () => { - delete process.env.NODE_ENV; - expect(isDevelopment()).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts deleted file mode 100644 index e621a837..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { isEqual } from '../isEqual'; - -describe('isEqual', () => { - it('should return true for equal primitive values', () => { - expect(isEqual(undefined, undefined)).toBe(true); - expect(isEqual(null, null)).toBe(true); - expect(isEqual(true, true)).toBe(true); - expect(isEqual(false, false)).toBe(true); - expect(isEqual(-1, -1)).toBe(true); - expect(isEqual(+1, +1)).toBe(true); - expect(isEqual(42, 42)).toBe(true); - expect(isEqual(0, 0)).toBe(true); - expect(isEqual(0.5, 0.5)).toBe(true); - expect(isEqual('hello', 'hello')).toBe(true); - expect(isEqual('world', 'world')).toBe(true); - }); - - it('should return false for not equal primitive values', () => { - expect(!isEqual(undefined, null)).toBe(true); - expect(!isEqual(null, undefined)).toBe(true); - expect(!isEqual(true, false)).toBe(true); - expect(!isEqual(false, true)).toBe(true); - expect(!isEqual(-1, +1)).toBe(true); - expect(!isEqual(+1, -1)).toBe(true); - expect(!isEqual(42, 42.00000000000001)).toBe(true); - expect(!isEqual(0, 0.5)).toBe(true); - expect(!isEqual('hello', 'world')).toBe(true); - expect(!isEqual('world', 'hello')).toBe(true); - }); - - it('should return false when comparing primitives with objects', () => { - expect(!isEqual({}, null)).toBe(true); - expect(!isEqual(null, {})).toBe(true); - expect(!isEqual({}, true)).toBe(true); - expect(!isEqual(true, {})).toBe(true); - expect(!isEqual({}, 42)).toBe(true); - expect(!isEqual(42, {})).toBe(true); - expect(!isEqual({}, 'hello')).toBe(true); - expect(!isEqual('hello', {})).toBe(true); - }); - - it('should correctly compare shallow objects', () => { - expect(isEqual({}, {})).toBe(true); - expect(isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 3, b: 2, c: 1 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toBe(true); - expect(!isEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toBe(true); - }); - - it('should correctly compare deep objects', () => { - expect(isEqual({ x: {} }, { x: {} })).toBe(true); - expect( - isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2, c: 3 } }), - ).toBe(true); - expect( - !isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 3, b: 2, c: 1 } }), - ).toBe(true); - expect(!isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2 } })).toBe( - true, - ); - expect(!isEqual({ x: { a: 1, b: 2 } }, { x: { a: 1, b: 2, c: 3 } })).toBe( - true, - ); - }); - - it('should correctly compare deep objects without object prototype ', () => { - // Solves https://github.com/apollographql/apollo-client/issues/2132 - const objNoProto = Object.create(null); - objNoProto.a = { b: 2, c: [3, 4] }; - objNoProto.e = Object.create(null); - objNoProto.e.f = 5; - expect(isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 6 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: null })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, null)).toBe(true); - }); - - it('should correctly handle modified prototypes', () => { - Array.prototype.foo = null; - expect(isEqual([1, 2, 3], [1, 2, 3])).toBe(true); - expect(!isEqual([1, 2, 3], [1, 2, 4])).toBe(true); - delete Array.prototype.foo; - }); - - describe('comparing objects with circular refs', () => { - // copied with slight modification from lodash test suite - it('should compare objects with circular references', () => { - const object1 = {}, - object2 = {}; - - object1.a = object1; - object2.a = object2; - - expect(isEqual(object1, object2)).toBe(true); - - object1.b = 0; - object2.b = Object(0); - - expect(isEqual(object1, object2)).toBe(true); - - object1.c = Object(1); - object2.c = Object(2); - - expect(isEqual(object1, object2)).toBe(false); - - object1 = { a: 1, b: 2, c: 3 }; - object1.b = object1; - object2 = { a: 1, b: { a: 1, b: 2, c: 3 }, c: 3 }; - - expect(isEqual(object1, object2)).toBe(false); - }); - - it('should have transitive equivalence for circular references of objects', () => { - const object1 = {}, - object2 = { a: object1 }, - object3 = { a: object2 }; - - object1.a = object1; - - expect(isEqual(object1, object2)).toBe(true); - expect(isEqual(object2, object3)).toBe(true); - expect(isEqual(object1, object3)).toBe(true); - }); - - it('should compare objects with multiple circular references', () => { - const array1 = [{}], - array2 = [{}]; - - (array1[0].a = array1).push(array1); - (array2[0].a = array2).push(array2); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].b = 0; - array2[0].b = Object(0); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].c = Object(1); - array2[0].c = Object(2); - - expect(isEqual(array1, array2)).toBe(false); - }); - - it('should compare objects with complex circular references', () => { - const object1 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - const object2 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - object1.foo.b.c.d = object1; - object1.bar.b = object1.foo.b; - - object2.foo.b.c.d = object2; - object2.bar.b = object2.foo.b; - - expect(isEqual(object1, object2)).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts deleted file mode 100644 index c33cc60c..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { maybeDeepFreeze } from '../maybeDeepFreeze'; - -describe('maybeDeepFreeze', () => { - it('should deep freeze', () => { - const foo: any = { bar: undefined }; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - expect(foo.bar).toBeUndefined(); - }); - - it('should properly freeze objects without hasOwnProperty', () => { - const foo = Object.create(null); - foo.bar = undefined; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts deleted file mode 100644 index 13778069..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { mergeDeep, mergeDeepArray } from '../mergeDeep'; - -describe('mergeDeep', function() { - it('should return an object if first argument falsy', function() { - expect(mergeDeep()).toEqual({}); - expect(mergeDeep(null)).toEqual({}); - expect(mergeDeep(null, { foo: 42 })).toEqual({ foo: 42 }); - }); - - it('should preserve identity for single arguments', function() { - const arg = Object.create(null); - expect(mergeDeep(arg)).toBe(arg); - }); - - it('should preserve identity when merging non-conflicting objects', function() { - const a = { a: { name: 'ay' } }; - const b = { b: { name: 'bee' } }; - const c = mergeDeep(a, b); - expect(c.a).toBe(a.a); - expect(c.b).toBe(b.b); - expect(c).toEqual({ - a: { name: 'ay' }, - b: { name: 'bee' }, - }); - }); - - it('should shallow-copy conflicting fields', function() { - const a = { conflict: { fromA: [1, 2, 3] } }; - const b = { conflict: { fromB: [4, 5] } }; - const c = mergeDeep(a, b); - expect(c.conflict).not.toBe(a.conflict); - expect(c.conflict).not.toBe(b.conflict); - expect(c.conflict.fromA).toBe(a.conflict.fromA); - expect(c.conflict.fromB).toBe(b.conflict.fromB); - expect(c).toEqual({ - conflict: { - fromA: [1, 2, 3], - fromB: [4, 5], - }, - }); - }); - - it('should resolve conflicts among more than two objects', function() { - const sources = []; - - for (let i = 0; i < 100; ++i) { - sources.push({ - ['unique' + i]: { value: i }, - conflict: { - ['from' + i]: { value: i }, - nested: { - ['nested' + i]: { value: i }, - }, - }, - }); - } - - const merged = mergeDeep(...sources); - - sources.forEach((source, i) => { - expect(merged['unique' + i].value).toBe(i); - expect(source['unique' + i]).toBe(merged['unique' + i]); - - expect(merged.conflict).not.toBe(source.conflict); - expect(merged.conflict['from' + i].value).toBe(i); - expect(merged.conflict['from' + i]).toBe(source.conflict['from' + i]); - - expect(merged.conflict.nested).not.toBe(source.conflict.nested); - expect(merged.conflict.nested['nested' + i].value).toBe(i); - expect(merged.conflict.nested['nested' + i]).toBe( - source.conflict.nested['nested' + i], - ); - }); - }); - - it('can merge array elements', function() { - const a = [{ a: 1 }, { a: 'ay' }, 'a']; - const b = [{ b: 2 }, { b: 'bee' }, 'b']; - const c = [{ c: 3 }, { c: 'cee' }, 'c']; - const d = { 1: { d: 'dee' } }; - - expect(mergeDeep(a, b, c, d)).toEqual([ - { a: 1, b: 2, c: 3 }, - { a: 'ay', b: 'bee', c: 'cee', d: 'dee' }, - 'c', - ]); - }); - - it('lets the last conflicting value win', function() { - expect(mergeDeep('a', 'b', 'c')).toBe('c'); - - expect( - mergeDeep( - { a: 'a', conflict: 1 }, - { b: 'b', conflict: 2 }, - { c: 'c', conflict: 3 }, - ), - ).toEqual({ - a: 'a', - b: 'b', - c: 'c', - conflict: 3, - }); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - [/*empty*/, ['B'], 'D'], - )).toEqual( - ['a', ['B', 'c'], 'D'], - ); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - ['A', [/*empty*/, 'C']], - )).toEqual( - ['A', ['b', 'C'], 'd'], - ); - }); - - it('mergeDeep returns the intersection of its argument types', function() { - const abc = mergeDeep({ str: "hi", a: 1 }, { a: 3, b: 2 }, { b: 1, c: 2 }); - // The point of this test is that the following lines type-check without - // resorting to any `any` loopholes: - expect(abc.str.slice(0)).toBe("hi"); - expect(abc.a * 2).toBe(6); - expect(abc.b - 0).toBe(1); - expect(abc.c / 2).toBe(1); - }); - - it('mergeDeepArray returns the supertype of its argument types', function() { - class F { - check() { return "ok" }; - } - const fs: F[] = [new F, new F, new F]; - // Although mergeDeepArray doesn't have the same tuple type awareness as - // mergeDeep, it does infer that F should be the return type here: - expect(mergeDeepArray(fs).check()).toBe("ok"); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts deleted file mode 100644 index fd5594b8..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { stripSymbols } from '../stripSymbols'; - -interface SymbolConstructor { - (description?: string | number): symbol; -} - -declare const Symbol: SymbolConstructor; - -describe('stripSymbols', () => { - it('should strip symbols (only)', () => { - const sym = Symbol('id'); - const data = { foo: 'bar', [sym]: 'ROOT_QUERY' }; - expect(stripSymbols(data)).toEqual({ foo: 'bar' }); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts deleted file mode 100644 index 35c87534..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { warnOnceInDevelopment } from '../warnOnce'; - -let lastWarning: string | null; -let keepEnv: string | undefined; -let numCalls = 0; -let oldConsoleWarn: any; - -describe('warnOnce', () => { - beforeEach(() => { - keepEnv = process.env.NODE_ENV; - numCalls = 0; - lastWarning = null; - oldConsoleWarn = console.warn; - console.warn = (msg: any) => { - numCalls++; - lastWarning = msg; - }; - }); - afterEach(() => { - process.env.NODE_ENV = keepEnv; - console.warn = oldConsoleWarn; - }); - it('actually warns', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('hi'); - expect(lastWarning).toBe('hi'); - expect(numCalls).toEqual(1); - }); - - it('does not warn twice', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('ho'); - warnOnceInDevelopment('ho'); - expect(lastWarning).toEqual('ho'); - expect(numCalls).toEqual(1); - }); - - it('warns two different things once each', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('slow'); - expect(lastWarning).toEqual('slow'); - warnOnceInDevelopment('mo'); - expect(lastWarning).toEqual('mo'); - expect(numCalls).toEqual(2); - }); - - it('does not warn in production', () => { - process.env.NODE_ENV = 'production'; - warnOnceInDevelopment('lo'); - warnOnceInDevelopment('lo'); - expect(numCalls).toEqual(0); - }); - - it('warns many times in test', () => { - process.env.NODE_ENV = 'test'; - warnOnceInDevelopment('yo'); - warnOnceInDevelopment('yo'); - expect(lastWarning).toEqual('yo'); - expect(numCalls).toEqual(2); - }); -}); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/assign.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/assign.ts deleted file mode 100644 index 3a224329..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/assign.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Adds the properties of one or more source objects to a target object. Works exactly like - * `Object.assign`, but as a utility to maintain support for IE 11. - * - * @see https://github.com/apollostack/apollo-client/pull/1009 - */ -export function assign(a: A, b: B): A & B; -export function assign(a: A, b: B, c: C): A & B & C; -export function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export function assign( - a: A, - b: B, - c: C, - d: D, - e: E, -): A & B & C & D & E; -export function assign(target: any, ...sources: Array): any; -export function assign( - target: { [key: string]: any }, - ...sources: Array<{ [key: string]: any }> -): { [key: string]: any } { - sources.forEach(source => { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(key => { - target[key] = source[key]; - }); - }); - return target; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/canUse.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/canUse.ts deleted file mode 100644 index d9858679..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/canUse.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const canUseWeakMap = typeof WeakMap === 'function' && !( - typeof navigator === 'object' && - navigator.product === 'ReactNative' -); diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/cloneDeep.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/cloneDeep.ts deleted file mode 100644 index 961b4a82..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/cloneDeep.ts +++ /dev/null @@ -1,37 +0,0 @@ -const { toString } = Object.prototype; - -/** - * Deeply clones a value to create a new instance. - */ -export function cloneDeep(value: T): T { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val: T, seen: Map): T { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) return seen.get(val); - const copy: T & any[] = (val as any).slice(0); - seen.set(val, copy); - copy.forEach(function (child, i) { - copy[i] = cloneDeepHelper(child, seen); - }); - return copy; - } - - case "[object Object]": { - if (seen.has(val)) return seen.get(val); - // High fidelity polyfills of Object.create and Object.getPrototypeOf are - // possible in all JS environments, so we will assume they exist/work. - const copy = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy); - Object.keys(val).forEach(key => { - copy[key] = cloneDeepHelper((val as any)[key], seen); - }); - return copy; - } - - default: - return val; - } -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/environment.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/environment.ts deleted file mode 100644 index f4ad04e1..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/environment.ts +++ /dev/null @@ -1,24 +0,0 @@ -export function getEnv(): string | undefined { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - // default environment - return 'development'; -} - -export function isEnv(env: string): boolean { - return getEnv() === env; -} - -export function isProduction(): boolean { - return isEnv('production') === true; -} - -export function isDevelopment(): boolean { - return isEnv('development') === true; -} - -export function isTest(): boolean { - return isEnv('test') === true; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/errorHandling.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/errorHandling.ts deleted file mode 100644 index 25a16ca0..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/errorHandling.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ExecutionResult } from 'graphql'; - -export function tryFunctionOrLogError(f: Function) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -export function graphQLResultHasError(result: ExecutionResult) { - return result.errors && result.errors.length; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/filterInPlace.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/filterInPlace.ts deleted file mode 100644 index d5787cab..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/filterInPlace.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function filterInPlace( - array: T[], - test: (elem: T) => boolean, - context?: any, -): T[] { - let target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/isEqual.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/isEqual.ts deleted file mode 100644 index debf7429..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/isEqual.ts +++ /dev/null @@ -1 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts deleted file mode 100644 index d966d336..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { isDevelopment, isTest } from './environment'; - -// Taken (mostly) from https://github.com/substack/deep-freeze to avoid -// import hassles with rollup. -function deepFreeze(o: any) { - Object.freeze(o); - - Object.getOwnPropertyNames(o).forEach(function(prop) { - if ( - o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop]) - ) { - deepFreeze(o[prop]); - } - }); - - return o; -} - -export function maybeDeepFreeze(obj: any) { - if (isDevelopment() || isTest()) { - // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing - // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043). - const symbolIsPolyfilled = - typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/mergeDeep.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/mergeDeep.ts deleted file mode 100644 index d83a33fe..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/mergeDeep.ts +++ /dev/null @@ -1,115 +0,0 @@ -const { hasOwnProperty } = Object.prototype; - -// These mergeDeep and mergeDeepArray utilities merge any number of objects -// together, sharing as much memory as possible with the source objects, while -// remaining careful to avoid modifying any source objects. - -// Logically, the return type of mergeDeep should be the intersection of -// all the argument types. The binary call signature is by far the most -// common, but we support 0- through 5-ary as well. After that, the -// resulting type is just the inferred array element type. Note to nerds: -// there is a more clever way of doing this that converts the tuple type -// first to a union type (easy enough: T[number]) and then converts the -// union to an intersection type using distributive conditional type -// inference, but that approach has several fatal flaws (boolean becomes -// true & false, and the inferred type ends up as unknown in many cases), -// in addition to being nearly impossible to explain/understand. -export type TupleToIntersection = - T extends [infer A] ? A : - T extends [infer A, infer B] ? A & B : - T extends [infer A, infer B, infer C] ? A & B & C : - T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : - T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : - T extends (infer U)[] ? U : any; - -export function mergeDeep( - ...sources: T -): TupleToIntersection { - return mergeDeepArray(sources); -} - -// In almost any situation where you could succeed in getting the -// TypeScript compiler to infer a tuple type for the sources array, you -// could just use mergeDeep instead of mergeDeepArray, so instead of -// trying to convert T[] to an intersection type we just infer the array -// element type, which works perfectly when the sources array has a -// consistent element type. -export function mergeDeepArray(sources: T[]): T { - let target = sources[0] || {} as T; - const count = sources.length; - if (count > 1) { - const pastCopies: any[] = []; - target = shallowCopyForMerge(target, pastCopies); - for (let i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} - -function isObject(obj: any): obj is Record { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper( - target: any, - source: any, - pastCopies: any[], -) { - if (isObject(source) && isObject(target)) { - // In case the target has been frozen, make an extensible copy so that - // we can merge properties into the copy. - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(sourceKey => { - const sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - const targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - // When there is a key collision, we need to make a shallow copy of - // target[sourceKey] so the merge does not modify any source objects. - // To avoid making unnecessary copies, we use a simple array to track - // past copies, since it's safe to modify copies created earlier in - // the merge. We use an array for pastCopies instead of a Map or Set, - // since the number of copies should be relatively small, and some - // Map/Set polyfills modify their keys. - target[sourceKey] = mergeHelper( - shallowCopyForMerge(targetValue, pastCopies), - sourceValue, - pastCopies, - ); - } - } else { - // If there is no collision, the target can safely share memory with - // the source, and the recursion can terminate here. - target[sourceKey] = sourceValue; - } - }); - - return target; - } - - // If source (or target) is not an object, let source replace target. - return source; -} - -function shallowCopyForMerge(value: T, pastCopies: any[]): T { - if ( - value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0 - ) { - if (Array.isArray(value)) { - value = (value as any).slice(0); - } else { - value = { - __proto__: Object.getPrototypeOf(value), - ...value, - }; - } - pastCopies.push(value); - } - return value; -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/stripSymbols.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/stripSymbols.ts deleted file mode 100644 index 41cabae7..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/stripSymbols.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * In order to make assertions easier, this function strips `symbol`'s from - * the incoming data. - * - * This can be handy when running tests against `apollo-client` for example, - * since it adds `symbol`'s to the data in the store. Jest's `toEqual` - * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437), - * which means all test data used in a `toEqual` comparison would also have to - * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data - * we can compare against more simplified test data. - */ -export function stripSymbols(data: T): T { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/warnOnce.ts b/node_modules/apollo-client/node_modules/apollo-utilities/src/util/warnOnce.ts deleted file mode 100644 index 90f32321..00000000 --- a/node_modules/apollo-client/node_modules/apollo-utilities/src/util/warnOnce.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { isProduction, isTest } from './environment'; - -const haveWarned = Object.create({}); - -/** - * Print a warning only once in development. - * In production no warnings are printed. - * In test all warnings are printed. - * - * @param msg The warning message - * @param type warn or error (will call console.warn or console.error) - */ -export function warnOnceInDevelopment(msg: string, type = 'warn') { - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} diff --git a/node_modules/apollo-client/package.json b/node_modules/apollo-client/package.json deleted file mode 100644 index f3fa3a83..00000000 --- a/node_modules/apollo-client/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "_from": "apollo-client@latest", - "_id": "apollo-client@2.6.10", - "_inBundle": false, - "_integrity": "sha512-jiPlMTN6/5CjZpJOkGeUV0mb4zxx33uXWdj/xQCfAMkuNAC3HN7CvYDyMHHEzmcQ5GV12LszWoQ/VlxET24CtA==", - "_location": "/apollo-client", - "_phantomChildren": { - "@wry/equality": "0.1.9", - "fast-json-stable-stringify": "2.0.0", - "ts-invariant": "0.4.4", - "tslib": "1.10.0" - }, - "_requested": { - "type": "tag", - "registry": true, - "raw": "apollo-client@latest", - "name": "apollo-client", - "escapedName": "apollo-client", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/apollo-client/-/apollo-client-2.6.10.tgz", - "_shasum": "86637047b51d940c8eaa771a4ce1b02df16bea6a", - "_spec": "apollo-client@latest", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@types/zen-observable": "^0.8.0", - "apollo-cache": "1.3.5", - "apollo-link": "^1.0.0", - "apollo-utilities": "1.3.4", - "symbol-observable": "^1.0.2", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0", - "zen-observable": "^0.8.0" - }, - "deprecated": false, - "description": "A simple yet functional GraphQL client.", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "keywords": [ - "ecmascript", - "es2015", - "jsnext", - "javascript", - "relay", - "npm", - "react" - ], - "license": "MIT", - "main": "bundle.umd.js", - "module": "bundle.esm.js", - "name": "apollo-client", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "pre-commit": "lint-staged", - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "sideEffects": false, - "typings": "index.d.ts", - "version": "2.6.10" -} diff --git a/node_modules/apollo-client/util/Observable.d.ts b/node_modules/apollo-client/util/Observable.d.ts deleted file mode 100644 index 585e146c..00000000 --- a/node_modules/apollo-client/util/Observable.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -import { Observable as LinkObservable } from 'apollo-link'; -export declare type Subscription = ZenObservable.Subscription; -export declare type Observer = ZenObservable.Observer; -export declare class Observable extends LinkObservable { -} -//# sourceMappingURL=Observable.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/Observable.d.ts.map b/node_modules/apollo-client/util/Observable.d.ts.map deleted file mode 100644 index 2f8454b8..00000000 --- a/node_modules/apollo-client/util/Observable.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Observable.d.ts","sourceRoot":"","sources":["../src/util/Observable.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3D,oBAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC;AACtD,oBAAY,QAAQ,CAAC,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAKpD,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;CAQnD"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/Observable.js b/node_modules/apollo-client/util/Observable.js deleted file mode 100644 index 59ead531..00000000 --- a/node_modules/apollo-client/util/Observable.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var apollo_link_1 = require("apollo-link"); -var symbol_observable_1 = tslib_1.__importDefault(require("symbol-observable")); -var Observable = (function (_super) { - tslib_1.__extends(Observable, _super); - function Observable() { - return _super !== null && _super.apply(this, arguments) || this; - } - Observable.prototype[symbol_observable_1.default] = function () { - return this; - }; - Observable.prototype['@@observable'] = function () { - return this; - }; - return Observable; -}(apollo_link_1.Observable)); -exports.Observable = Observable; -//# sourceMappingURL=Observable.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/Observable.js.map b/node_modules/apollo-client/util/Observable.js.map deleted file mode 100644 index 1222b5f8..00000000 --- a/node_modules/apollo-client/util/Observable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../src/util/Observable.ts"],"names":[],"mappings":";;;AAEA,2CAA2D;AAK3D,gFAA6C;AAG7C;IAAmC,sCAAiB;IAApD;;IAQA,CAAC;IAPQ,qBAAC,2BAAY,CAAC,GAArB;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,qBAAC,cAAqB,CAAC,GAA9B;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IACH,iBAAC;AAAD,CAAC,AARD,CAAmC,wBAAc,GAQhD;AARY,gCAAU"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/arrays.d.ts b/node_modules/apollo-client/util/arrays.d.ts deleted file mode 100644 index 8a46dc6f..00000000 --- a/node_modules/apollo-client/util/arrays.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function isNonEmptyArray(value?: ArrayLike): value is Array; -//# sourceMappingURL=arrays.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/arrays.d.ts.map b/node_modules/apollo-client/util/arrays.d.ts.map deleted file mode 100644 index 2db55b35..00000000 --- a/node_modules/apollo-client/util/arrays.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../src/util/arrays.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAE1E"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/arrays.js b/node_modules/apollo-client/util/arrays.js deleted file mode 100644 index e388142e..00000000 --- a/node_modules/apollo-client/util/arrays.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function isNonEmptyArray(value) { - return Array.isArray(value) && value.length > 0; -} -exports.isNonEmptyArray = isNonEmptyArray; -//# sourceMappingURL=arrays.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/arrays.js.map b/node_modules/apollo-client/util/arrays.js.map deleted file mode 100644 index 9302fd1f..00000000 --- a/node_modules/apollo-client/util/arrays.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../src/util/arrays.ts"],"names":[],"mappings":";;AAAA,SAAgB,eAAe,CAAI,KAAoB;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC;AAFD,0CAEC"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/capitalizeFirstLetter.d.ts b/node_modules/apollo-client/util/capitalizeFirstLetter.d.ts deleted file mode 100644 index 178652dc..00000000 --- a/node_modules/apollo-client/util/capitalizeFirstLetter.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function capitalizeFirstLetter(str: string): string; -//# sourceMappingURL=capitalizeFirstLetter.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/capitalizeFirstLetter.d.ts.map b/node_modules/apollo-client/util/capitalizeFirstLetter.d.ts.map deleted file mode 100644 index ceb2059b..00000000 --- a/node_modules/apollo-client/util/capitalizeFirstLetter.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"capitalizeFirstLetter.d.ts","sourceRoot":"","sources":["../src/util/capitalizeFirstLetter.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,UAEhD"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/capitalizeFirstLetter.js b/node_modules/apollo-client/util/capitalizeFirstLetter.js deleted file mode 100644 index 1ee854f0..00000000 --- a/node_modules/apollo-client/util/capitalizeFirstLetter.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function capitalizeFirstLetter(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} -exports.capitalizeFirstLetter = capitalizeFirstLetter; -//# sourceMappingURL=capitalizeFirstLetter.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/capitalizeFirstLetter.js.map b/node_modules/apollo-client/util/capitalizeFirstLetter.js.map deleted file mode 100644 index 639769e3..00000000 --- a/node_modules/apollo-client/util/capitalizeFirstLetter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"capitalizeFirstLetter.js","sourceRoot":"","sources":["../../src/util/capitalizeFirstLetter.ts"],"names":[],"mappings":";;AAAA,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,sDAEC"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/observableToPromise.d.ts b/node_modules/apollo-client/util/observableToPromise.d.ts deleted file mode 100644 index 099a9063..00000000 --- a/node_modules/apollo-client/util/observableToPromise.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ObservableQuery } from '../core/ObservableQuery'; -import { ApolloQueryResult } from '../core/types'; -import { Subscription } from '../util/Observable'; -export declare type Options = { - observable: ObservableQuery; - shouldResolve?: boolean; - wait?: number; - errorCallbacks?: ((error: Error) => any)[]; -}; -export declare type ResultCallback = ((result: ApolloQueryResult) => any); -export declare function observableToPromiseAndSubscription({ observable, shouldResolve, wait, errorCallbacks }: Options, ...cbs: ResultCallback[]): { - promise: Promise; - subscription: Subscription; -}; -export default function (options: Options, ...cbs: ResultCallback[]): Promise; -//# sourceMappingURL=observableToPromise.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/observableToPromise.d.ts.map b/node_modules/apollo-client/util/observableToPromise.d.ts.map deleted file mode 100644 index 7935d2b3..00000000 --- a/node_modules/apollo-client/util/observableToPromise.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observableToPromise.d.ts","sourceRoot":"","sources":["../src/util/observableToPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWlD,oBAAY,OAAO,GAAG;IACpB,UAAU,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,GAAG,CAAC,EAAE,CAAC;CAC5C,CAAC;AAEF,oBAAY,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;AAMvE,wBAAgB,kCAAkC,CAChD,EAAE,UAAU,EAAE,aAAoB,EAAE,IAAS,EAAE,cAAmB,EAAE,EAAE,OAAO,EAC7E,GAAG,GAAG,EAAE,cAAc,EAAE,GACvB;IAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAE,CA8DzD;AAED,MAAM,CAAC,OAAO,WACZ,OAAO,EAAE,OAAO,EAChB,GAAG,GAAG,EAAE,cAAc,EAAE,GACvB,OAAO,CAAC,GAAG,EAAE,CAAC,CAEhB"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/observableToPromise.js b/node_modules/apollo-client/util/observableToPromise.js deleted file mode 100644 index 395647de..00000000 --- a/node_modules/apollo-client/util/observableToPromise.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -function observableToPromiseAndSubscription(_a) { - var observable = _a.observable, _b = _a.shouldResolve, shouldResolve = _b === void 0 ? true : _b, _c = _a.wait, wait = _c === void 0 ? -1 : _c, _d = _a.errorCallbacks, errorCallbacks = _d === void 0 ? [] : _d; - var cbs = []; - for (var _i = 1; _i < arguments.length; _i++) { - cbs[_i - 1] = arguments[_i]; - } - var subscription = null; - var promise = new Promise(function (resolve, reject) { - var errorIndex = 0; - var cbIndex = 0; - var results = []; - var tryToResolve = function () { - if (!shouldResolve) { - return; - } - var done = function () { - subscription.unsubscribe(); - resolve(results); - }; - if (cbIndex === cbs.length && errorIndex === errorCallbacks.length) { - if (wait === -1) { - done(); - } - else { - setTimeout(done, wait); - } - } - }; - subscription = observable.subscribe({ - next: function (result) { - var cb = cbs[cbIndex++]; - if (cb) { - try { - results.push(cb(result)); - } - catch (e) { - return reject(e); - } - tryToResolve(); - } - else { - reject(new Error("Observable called more than " + cbs.length + " times")); - } - }, - error: function (error) { - var errorCb = errorCallbacks[errorIndex++]; - if (errorCb) { - try { - errorCb(error); - } - catch (e) { - return reject(e); - } - tryToResolve(); - } - else { - reject(error); - } - }, - }); - }); - return { - promise: promise, - subscription: subscription, - }; -} -exports.observableToPromiseAndSubscription = observableToPromiseAndSubscription; -function default_1(options) { - var cbs = []; - for (var _i = 1; _i < arguments.length; _i++) { - cbs[_i - 1] = arguments[_i]; - } - return observableToPromiseAndSubscription.apply(void 0, tslib_1.__spreadArrays([options], cbs)).promise; -} -exports.default = default_1; -//# sourceMappingURL=observableToPromise.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/observableToPromise.js.map b/node_modules/apollo-client/util/observableToPromise.js.map deleted file mode 100644 index 5bcb3df2..00000000 --- a/node_modules/apollo-client/util/observableToPromise.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observableToPromise.js","sourceRoot":"","sources":["../../src/util/observableToPromise.ts"],"names":[],"mappings":";;;AA0BA,SAAgB,kCAAkC,CAChD,EAA6E;QAA3E,0BAAU,EAAE,qBAAoB,EAApB,yCAAoB,EAAE,YAAS,EAAT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AAK,EAAL,UAAM,KAAY;gBAChB,IAAM,OAAO,GAAG,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC7C,IAAI,OAAO,EAAE;oBACX,IAAI;wBAEF,OAAO,CAAC,KAAK,CAAC,CAAC;qBAChB;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;qBAClB;oBACD,YAAY,EAAE,CAAC;iBAChB;qBAAM;oBACL,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,SAAA;QACP,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AAjED,gFAiEC;AAED,mBACE,OAAgB;IAChB,aAAwB;SAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;QAAxB,4BAAwB;;IAExB,OAAO,kCAAkC,uCAAC,OAAO,GAAK,GAAG,GAAE,OAAO,CAAC;AACrE,CAAC;AALD,4BAKC"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/observables.d.ts b/node_modules/apollo-client/util/observables.d.ts deleted file mode 100644 index c485b436..00000000 --- a/node_modules/apollo-client/util/observables.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Observable } from './Observable'; -export declare function multiplex(inner: Observable): Observable; -export declare function asyncMap(observable: Observable, mapFn: (value: V) => R | Promise): Observable; -//# sourceMappingURL=observables.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/observables.d.ts.map b/node_modules/apollo-client/util/observables.d.ts.map deleted file mode 100644 index 01993d3a..00000000 --- a/node_modules/apollo-client/util/observables.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observables.d.ts","sourceRoot":"","sources":["../src/util/observables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,cAAc,CAAC;AAIlE,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAuBhE;AAID,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAClC,UAAU,CAAC,CAAC,CAAC,CAqCf"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/observables.js b/node_modules/apollo-client/util/observables.js deleted file mode 100644 index 33847087..00000000 --- a/node_modules/apollo-client/util/observables.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Observable_1 = require("./Observable"); -function multiplex(inner) { - var observers = new Set(); - var sub = null; - return new Observable_1.Observable(function (observer) { - observers.add(observer); - sub = sub || inner.subscribe({ - next: function (value) { - observers.forEach(function (obs) { return obs.next && obs.next(value); }); - }, - error: function (error) { - observers.forEach(function (obs) { return obs.error && obs.error(error); }); - }, - complete: function () { - observers.forEach(function (obs) { return obs.complete && obs.complete(); }); - }, - }); - return function () { - if (observers.delete(observer) && !observers.size && sub) { - sub.unsubscribe(); - sub = null; - } - }; - }); -} -exports.multiplex = multiplex; -function asyncMap(observable, mapFn) { - return new Observable_1.Observable(function (observer) { - var next = observer.next, error = observer.error, complete = observer.complete; - var activeNextCount = 0; - var completed = false; - var handler = { - next: function (value) { - ++activeNextCount; - new Promise(function (resolve) { - resolve(mapFn(value)); - }).then(function (result) { - --activeNextCount; - next && next.call(observer, result); - completed && handler.complete(); - }, function (e) { - --activeNextCount; - error && error.call(observer, e); - }); - }, - error: function (e) { - error && error.call(observer, e); - }, - complete: function () { - completed = true; - if (!activeNextCount) { - complete && complete.call(observer); - } - }, - }; - var sub = observable.subscribe(handler); - return function () { return sub.unsubscribe(); }; - }); -} -exports.asyncMap = asyncMap; -//# sourceMappingURL=observables.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/observables.js.map b/node_modules/apollo-client/util/observables.js.map deleted file mode 100644 index e75fe71a..00000000 --- a/node_modules/apollo-client/util/observables.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observables.js","sourceRoot":"","sources":["../../src/util/observables.ts"],"names":[],"mappings":";;AAAA,2CAAkE;AAIlE,SAAgB,SAAS,CAAI,KAAoB;IAC/C,IAAM,SAAS,GAAG,IAAI,GAAG,EAAe,CAAC;IACzC,IAAI,GAAG,GAAwB,IAAI,CAAC;IACpC,OAAO,IAAI,uBAAU,CAAI,UAAA,QAAQ;QAC/B,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC;YAC3B,IAAI,YAAC,KAAK;gBACR,SAAS,CAAC,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAA3B,CAA2B,CAAC,CAAC;YACxD,CAAC;YACD,KAAK,YAAC,KAAK;gBACT,SAAS,CAAC,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAA7B,CAA6B,CAAC,CAAC;YAC1D,CAAC;YACD,QAAQ;gBACN,SAAS,CAAC,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,EAAE,EAA9B,CAA8B,CAAC,CAAC;YAC3D,CAAC;SACF,CAAC,CAAC;QACH,OAAO;YACL,IAAI,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE;gBACxD,GAAG,CAAC,WAAW,EAAE,CAAC;gBAClB,GAAG,GAAG,IAAI,CAAC;aACZ;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;A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} \ No newline at end of file diff --git a/node_modules/apollo-client/util/subscribeAndCount.d.ts b/node_modules/apollo-client/util/subscribeAndCount.d.ts deleted file mode 100644 index 170fbba3..00000000 --- a/node_modules/apollo-client/util/subscribeAndCount.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -import { ObservableQuery } from '../core/ObservableQuery'; -import { ApolloQueryResult } from '../core/types'; -import { Subscription } from '../util/Observable'; -export default function subscribeAndCount(done: jest.DoneCallback, observable: ObservableQuery, cb: (handleCount: number, result: ApolloQueryResult) => any): Subscription; -//# sourceMappingURL=subscribeAndCount.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/subscribeAndCount.d.ts.map b/node_modules/apollo-client/util/subscribeAndCount.d.ts.map deleted file mode 100644 index 6d367b1f..00000000 --- a/node_modules/apollo-client/util/subscribeAndCount.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscribeAndCount.d.ts","sourceRoot":"","sources":["../src/util/subscribeAndCount.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAI,EAAE,IAAI,CAAC,YAAY,EACvB,UAAU,EAAE,eAAe,CAAC,GAAG,CAAC,EAChC,EAAE,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,CAAC,GAAG,CAAC,KAAK,GAAG,GAC/D,YAAY,CAqBd"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/subscribeAndCount.js b/node_modules/apollo-client/util/subscribeAndCount.js deleted file mode 100644 index e809971b..00000000 --- a/node_modules/apollo-client/util/subscribeAndCount.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var observables_1 = require("./observables"); -function subscribeAndCount(done, observable, cb) { - var handleCount = 0; - var subscription = observables_1.asyncMap(observable, function (result) { - try { - return cb(++handleCount, result); - } - catch (e) { - setImmediate(function () { - subscription.unsubscribe(); - done.fail(e); - }); - } - }).subscribe({ - error: done.fail, - }); - return subscription; -} -exports.default = subscribeAndCount; -//# sourceMappingURL=subscribeAndCount.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/subscribeAndCount.js.map b/node_modules/apollo-client/util/subscribeAndCount.js.map deleted file mode 100644 index 8d939c41..00000000 --- a/node_modules/apollo-client/util/subscribeAndCount.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscribeAndCount.js","sourceRoot":"","sources":["../../src/util/subscribeAndCount.ts"],"names":[],"mappings":";;AAGA,6CAAyC;AAEzC,SAAwB,iBAAiB,CACvC,IAAuB,EACvB,UAAgC,EAChC,EAAgE;IAEhE,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAM,YAAY,GAAG,sBAAQ,CAC3B,UAAU,EACV,UAAC,MAA8B;QAC7B,IAAI;YACF,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;SAClC;QAAC,OAAO,CAAC,EAAE;YAIV,YAAY,CAAC;gBACX,YAAY,CAAC,WAAW,EAAE,CAAC;gBAC3B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACf,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CACF,CAAC,SAAS,CAAC;QACV,KAAK,EAAE,IAAI,CAAC,IAAI;KACjB,CAAC,CAAC;IACH,OAAO,YAAY,CAAC;AACtB,CAAC;AAzBD,oCAyBC"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/wrap.d.ts b/node_modules/apollo-client/util/wrap.d.ts deleted file mode 100644 index 29775d99..00000000 --- a/node_modules/apollo-client/util/wrap.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -declare const _default: (done: jest.DoneCallback, cb: (...args: any[]) => any) => (...args: any[]) => any; -export default _default; -export declare function withWarning(func: Function, regex: RegExp): Promise; -export declare function withError(func: Function, regex: RegExp): any; -//# sourceMappingURL=wrap.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/wrap.d.ts.map b/node_modules/apollo-client/util/wrap.d.ts.map deleted file mode 100644 index ba22fd9e..00000000 --- a/node_modules/apollo-client/util/wrap.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../src/util/wrap.ts"],"names":[],"mappings":";;AAEA,wBAQE;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAWxD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,OAatD"} \ No newline at end of file diff --git a/node_modules/apollo-client/util/wrap.js b/node_modules/apollo-client/util/wrap.js deleted file mode 100644 index 9447e550..00000000 --- a/node_modules/apollo-client/util/wrap.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = (function (done, cb) { return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - try { - return cb.apply(void 0, args); - } - catch (e) { - done.fail(e); - } -}; }); -function withWarning(func, regex) { - var message = null; - var oldWarn = console.warn; - console.warn = function (m) { return (message = m); }; - return Promise.resolve(func()).then(function (val) { - expect(message).toMatch(regex); - console.warn = oldWarn; - return val; - }); -} -exports.withWarning = withWarning; -function withError(func, regex) { - var message = null; - var oldError = console.error; - console.error = function (m) { return (message = m); }; - try { - var result = func(); - expect(message).toMatch(regex); - return result; - } - finally { - console.error = oldError; - } -} -exports.withError = withError; -//# sourceMappingURL=wrap.js.map \ No newline at end of file diff --git a/node_modules/apollo-client/util/wrap.js.map b/node_modules/apollo-client/util/wrap.js.map deleted file mode 100644 index becadbf9..00000000 --- a/node_modules/apollo-client/util/wrap.js.map +++ /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AAC;KACf;YAAS;QACR,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;KAC1B;AACH,CAAC;AAbD,8BAaC"} \ No newline at end of file diff --git a/node_modules/apollo-client/version.d.ts b/node_modules/apollo-client/version.d.ts deleted file mode 100644 index 1edab329..00000000 --- a/node_modules/apollo-client/version.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const version = "2.6.10"; -//# sourceMappingURL=version.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-client/version.d.ts.map b/node_modules/apollo-client/version.d.ts.map deleted file mode 100644 index 674cd41d..00000000 --- a/node_modules/apollo-client/version.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/apollo-client/version.js b/node_modules/apollo-client/version.js deleted file mode 100644 index c40c18bd..00000000 --- a/node_modules/apollo-client/version.js +++ /dev/null @@ -1 +0,0 @@ -exports.version = "2.6.10" \ No newline at end of file diff --git a/node_modules/apollo-client/version.js.map b/node_modules/apollo-client/version.js.map deleted file mode 100644 index 4e080c97..00000000 --- a/node_modules/apollo-client/version.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAA"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/CHANGELOG.md b/node_modules/apollo-link-ws/CHANGELOG.md deleted file mode 100644 index 4a1100d6..00000000 --- a/node_modules/apollo-link-ws/CHANGELOG.md +++ /dev/null @@ -1,43 +0,0 @@ -# Change log - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md). - ----- - -### 1.0.10 - -- No changes - -### 1.0.9 -- Added `graphql` 14 to peer and dev deps; Updated `@types/graphql` to 14
- [@hwillson](http://github.com/hwillson) in [#789](https://github.com/apollographql/apollo-link/pull/789) - -### 1.0.8 -- Update apollo-link [#559](https://github.com/apollographql/apollo-link/pull/559) - -### 1.0.7 -- update apollo link with zen-observable-ts [PR#515](https://github.com/apollographql/apollo-link/pull/515) - -### 1.0.6 -- ApolloLink upgrade - -### 1.0.5 -- ApolloLink upgrade - -### 1.0.4 -- ApolloLink upgrade - -### 1.0.3 -- export options as named interface [TypeScript] - -### 1.0.2 -- changed peer-dependency of apollo-link to actual dependency - -### 1.0.1 -- moved to better rollup build - -### 1.0.0 -- moved from default export to named to be consistent with rest of link ecosystem diff --git a/node_modules/apollo-link-ws/LICENSE b/node_modules/apollo-link-ws/LICENSE deleted file mode 100644 index 07ea6625..00000000 --- a/node_modules/apollo-link-ws/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 - 2017 Meteor Development Group, Inc. - -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. diff --git a/node_modules/apollo-link-ws/README.md b/node_modules/apollo-link-ws/README.md deleted file mode 100644 index 6e71aa12..00000000 --- a/node_modules/apollo-link-ws/README.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: apollo-link-ws -description: Send GraphQL operations over a WebSocket. Works with GraphQL Subscriptions. ---- - -This link is particularly useful to use GraphQL Subscriptions, but it will also allow you to send GraphQL queries and mutations over WebSockets as well. - -```js -import { WebSocketLink } from "apollo-link-ws"; -import { SubscriptionClient } from "subscriptions-transport-ws"; - -const GRAPHQL_ENDPOINT = "ws://localhost:3000/graphql"; - -const client = new SubscriptionClient(GRAPHQL_ENDPOINT, { - reconnect: true -}); - -const link = new WebSocketLink(client); -``` - -## Options - -WS Link takes either a subscription client or an object with three options on it to customize the behavior of the link. Takes the following possible keys in the configuration object: - -* `uri`: a string endpoint to connect to -* `options`: a set of options to pass to a new Subscription Client -* `webSocketImpl`: a custom WebSocket implementation - -By default, this link uses the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) library for the transport. diff --git a/node_modules/apollo-link-ws/lib/bundle.cjs.js b/node_modules/apollo-link-ws/lib/bundle.cjs.js deleted file mode 100644 index a7ca69d1..00000000 --- a/node_modules/apollo-link-ws/lib/bundle.cjs.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var tslib = require('tslib'); -var apolloLink = require('apollo-link'); -var subscriptionsTransportWs = require('subscriptions-transport-ws'); - -var WebSocketLink = (function (_super) { - tslib.__extends(WebSocketLink, _super); - function WebSocketLink(paramsOrClient) { - var _this = _super.call(this) || this; - if (paramsOrClient instanceof subscriptionsTransportWs.SubscriptionClient) { - _this.subscriptionClient = paramsOrClient; - } - else { - _this.subscriptionClient = new subscriptionsTransportWs.SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl); - } - return _this; - } - WebSocketLink.prototype.request = function (operation) { - return this.subscriptionClient.request(operation); - }; - return WebSocketLink; -}(apolloLink.ApolloLink)); - -exports.WebSocketLink = WebSocketLink; -//# sourceMappingURL=bundle.cjs.js.map diff --git a/node_modules/apollo-link-ws/lib/bundle.cjs.js.map b/node_modules/apollo-link-ws/lib/bundle.cjs.js.map deleted file mode 100644 index 5efc1ba1..00000000 --- a/node_modules/apollo-link-ws/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.cjs.js","sources":["bundle.esm.js"],"sourcesContent":["import { __extends } from 'tslib';\nimport { ApolloLink } from 'apollo-link';\nimport { SubscriptionClient } from 'subscriptions-transport-ws';\n\nvar WebSocketLink = (function (_super) {\n __extends(WebSocketLink, _super);\n function WebSocketLink(paramsOrClient) {\n var _this = _super.call(this) || this;\n if (paramsOrClient instanceof SubscriptionClient) {\n _this.subscriptionClient = paramsOrClient;\n }\n else {\n _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);\n }\n return _this;\n }\n WebSocketLink.prototype.request = function (operation) {\n return this.subscriptionClient.request(operation);\n };\n return WebSocketLink;\n}(ApolloLink));\n\nexport { WebSocketLink };\n//# sourceMappingURL=bundle.esm.js.map\n"],"names":["__extends","SubscriptionClient","ApolloLink"],"mappings":";;;;;;;;AAIG,IAAC,aAAa,IAAI,UAAU,MAAM,EAAE;IACnCA,eAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,aAAa,CAAC,cAAc,EAAE;QACnC,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;QACtC,IAAI,cAAc,YAAYC,2CAAkB,EAAE;YAC9C,KAAK,CAAC,kBAAkB,GAAG,cAAc,CAAC;SAC7C;aACI;YACD,KAAK,CAAC,kBAAkB,GAAG,IAAIA,2CAAkB,CAAC,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;SAC/H;QACD,OAAO,KAAK,CAAC;KAChB;IACD,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE;QACnD,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;KACrD,CAAC;IACF,OAAO,aAAa,CAAC;CACxB,CAACC,qBAAU,CAAC,CAAC;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/bundle.esm.js b/node_modules/apollo-link-ws/lib/bundle.esm.js deleted file mode 100644 index e48d1ad3..00000000 --- a/node_modules/apollo-link-ws/lib/bundle.esm.js +++ /dev/null @@ -1,24 +0,0 @@ -import { __extends } from 'tslib'; -import { ApolloLink } from 'apollo-link'; -import { SubscriptionClient } from 'subscriptions-transport-ws'; - -var WebSocketLink = (function (_super) { - __extends(WebSocketLink, _super); - function WebSocketLink(paramsOrClient) { - var _this = _super.call(this) || this; - if (paramsOrClient instanceof SubscriptionClient) { - _this.subscriptionClient = paramsOrClient; - } - else { - _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl); - } - return _this; - } - WebSocketLink.prototype.request = function (operation) { - return this.subscriptionClient.request(operation); - }; - return WebSocketLink; -}(ApolloLink)); - -export { WebSocketLink }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-link-ws/lib/bundle.esm.js.map b/node_modules/apollo-link-ws/lib/bundle.esm.js.map deleted file mode 100644 index a7048075..00000000 --- a/node_modules/apollo-link-ws/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/webSocketLink.ts"],"sourcesContent":["import { ApolloLink, Operation, FetchResult, Observable } from 'apollo-link';\n\nimport { SubscriptionClient, ClientOptions } from 'subscriptions-transport-ws';\n\nexport namespace WebSocketLink {\n /**\n * Configuration to use when constructing the subscription client (subscriptions-transport-ws).\n */\n export interface Configuration {\n /**\n * The endpoint to connect to.\n */\n uri: string;\n\n /**\n * Options to pass when constructing the subscription client.\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use.\n */\n webSocketImpl?: any;\n }\n}\n\n// For backwards compatibility.\nexport import WebSocketParams = WebSocketLink.Configuration;\n\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient,\n ) {\n super();\n\n if (paramsOrClient instanceof SubscriptionClient) {\n this.subscriptionClient = paramsOrClient;\n } else {\n this.subscriptionClient = new SubscriptionClient(\n paramsOrClient.uri,\n paramsOrClient.options,\n paramsOrClient.webSocketImpl,\n );\n }\n }\n\n public request(operation: Operation): Observable | null {\n return this.subscriptionClient.request(operation) as Observable<\n FetchResult\n >;\n }\n}\n"],"names":["tslib_1.__extends"],"mappings":";;;;;IA6BmCA,iCAAU;IAG3C,uBACE,cAAgE;QADlE,YAGE,iBAAO,SAWR;QATC,IAAI,cAAc,YAAY,kBAAkB,EAAE;YAChD,KAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;SAC1C;aAAM;YACL,KAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAC9C,cAAc,CAAC,GAAG,EAClB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,aAAa,CAC7B,CAAC;SACH;;KACF;IAEM,+BAAO,GAAd,UAAe,SAAoB;QACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAE/C,CAAC;KACH;IACH,oBAAC;CAxBD,CAAmC,UAAU;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/bundle.umd.js b/node_modules/apollo-link-ws/lib/bundle.umd.js deleted file mode 100644 index dbb4f1d4..00000000 --- a/node_modules/apollo-link-ws/lib/bundle.umd.js +++ /dev/null @@ -1,30 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('apollo-link'), require('subscriptions-transport-ws')) : - typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'apollo-link', 'subscriptions-transport-ws'], factory) : - (global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.ws = {}), global.tslib, global.apolloLink.core, global['subscriptions-transport-ws'])); -}(this, function (exports, tslib_1, apolloLink, subscriptionsTransportWs) { 'use strict'; - - var WebSocketLink = (function (_super) { - tslib_1.__extends(WebSocketLink, _super); - function WebSocketLink(paramsOrClient) { - var _this = _super.call(this) || this; - if (paramsOrClient instanceof subscriptionsTransportWs.SubscriptionClient) { - _this.subscriptionClient = paramsOrClient; - } - else { - _this.subscriptionClient = new subscriptionsTransportWs.SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl); - } - return _this; - } - WebSocketLink.prototype.request = function (operation) { - return this.subscriptionClient.request(operation); - }; - return WebSocketLink; - }(apolloLink.ApolloLink)); - - exports.WebSocketLink = WebSocketLink; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); -//# sourceMappingURL=bundle.umd.js.map diff --git a/node_modules/apollo-link-ws/lib/bundle.umd.js.map b/node_modules/apollo-link-ws/lib/bundle.umd.js.map deleted file mode 100644 index fc8e4f2b..00000000 --- a/node_modules/apollo-link-ws/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.umd.js","sources":["../src/webSocketLink.ts"],"sourcesContent":["import { ApolloLink, Operation, FetchResult, Observable } from 'apollo-link';\n\nimport { SubscriptionClient, ClientOptions } from 'subscriptions-transport-ws';\n\nexport namespace WebSocketLink {\n /**\n * Configuration to use when constructing the subscription client (subscriptions-transport-ws).\n */\n export interface Configuration {\n /**\n * The endpoint to connect to.\n */\n uri: string;\n\n /**\n * Options to pass when constructing the subscription client.\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use.\n */\n webSocketImpl?: any;\n }\n}\n\n// For backwards compatibility.\nexport import WebSocketParams = WebSocketLink.Configuration;\n\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient,\n ) {\n super();\n\n if (paramsOrClient instanceof SubscriptionClient) {\n this.subscriptionClient = paramsOrClient;\n } else {\n this.subscriptionClient = new SubscriptionClient(\n paramsOrClient.uri,\n paramsOrClient.options,\n paramsOrClient.webSocketImpl,\n );\n }\n }\n\n public request(operation: Operation): Observable | null {\n return this.subscriptionClient.request(operation) as Observable<\n FetchResult\n >;\n }\n}\n"],"names":["tslib_1.__extends","SubscriptionClient","ApolloLink"],"mappings":";;;;;;;MA6BmCA,yCAAU;MAG3C,uBACE,cAAgE;UADlE,YAGE,iBAAO,SAWR;UATC,IAAI,cAAc,YAAYC,2CAAkB,EAAE;cAChD,KAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;WAC1C;eAAM;cACL,KAAI,CAAC,kBAAkB,GAAG,IAAIA,2CAAkB,CAC9C,cAAc,CAAC,GAAG,EAClB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,aAAa,CAC7B,CAAC;WACH;;OACF;MAEM,+BAAO,GAAd,UAAe,SAAoB;UACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAE/C,CAAC;OACH;MACH,oBAAC;EAAD,CAxBA,CAAmCC,qBAAU;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/index.d.ts b/node_modules/apollo-link-ws/lib/index.d.ts deleted file mode 100644 index 972227bb..00000000 --- a/node_modules/apollo-link-ws/lib/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './webSocketLink'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/index.d.ts.map b/node_modules/apollo-link-ws/lib/index.d.ts.map deleted file mode 100644 index f2782685..00000000 --- a/node_modules/apollo-link-ws/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/index.js b/node_modules/apollo-link-ws/lib/index.js deleted file mode 100644 index bd2d36db..00000000 --- a/node_modules/apollo-link-ws/lib/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./webSocketLink"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/index.js.map b/node_modules/apollo-link-ws/lib/index.js.map deleted file mode 100644 index e2c838d5..00000000 --- a/node_modules/apollo-link-ws/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/webSocketLink.d.ts b/node_modules/apollo-link-ws/lib/webSocketLink.d.ts deleted file mode 100644 index f2c349ec..00000000 --- a/node_modules/apollo-link-ws/lib/webSocketLink.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ApolloLink, Operation, FetchResult, Observable } from 'apollo-link'; -import { SubscriptionClient, ClientOptions } from 'subscriptions-transport-ws'; -export declare namespace WebSocketLink { - interface Configuration { - uri: string; - options?: ClientOptions; - webSocketImpl?: any; - } -} -export import WebSocketParams = WebSocketLink.Configuration; -export declare class WebSocketLink extends ApolloLink { - private subscriptionClient; - constructor(paramsOrClient: WebSocketLink.Configuration | SubscriptionClient); - request(operation: Operation): Observable | null; -} -//# sourceMappingURL=webSocketLink.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/webSocketLink.d.ts.map b/node_modules/apollo-link-ws/lib/webSocketLink.d.ts.map deleted file mode 100644 index 89789b90..00000000 --- a/node_modules/apollo-link-ws/lib/webSocketLink.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webSocketLink.d.ts","sourceRoot":"","sources":["src/webSocketLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE/E,yBAAiB,aAAa,CAAC;IAI7B,UAAiB,aAAa;QAI5B,GAAG,EAAE,MAAM,CAAC;QAKZ,OAAO,CAAC,EAAE,aAAa,CAAC;QAKxB,aAAa,CAAC,EAAE,GAAG,CAAC;KACrB;CACF;AAGD,MAAM,QAAQ,eAAe,GAAG,aAAa,CAAC,aAAa,CAAC;AAE5D,qBAAa,aAAc,SAAQ,UAAU;IAC3C,OAAO,CAAC,kBAAkB,CAAqB;gBAG7C,cAAc,EAAE,aAAa,CAAC,aAAa,GAAG,kBAAkB;IAe3D,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI;CAKrE"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/webSocketLink.js b/node_modules/apollo-link-ws/lib/webSocketLink.js deleted file mode 100644 index f9ce4889..00000000 --- a/node_modules/apollo-link-ws/lib/webSocketLink.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var apollo_link_1 = require("apollo-link"); -var subscriptions_transport_ws_1 = require("subscriptions-transport-ws"); -var WebSocketLink = (function (_super) { - tslib_1.__extends(WebSocketLink, _super); - function WebSocketLink(paramsOrClient) { - var _this = _super.call(this) || this; - if (paramsOrClient instanceof subscriptions_transport_ws_1.SubscriptionClient) { - _this.subscriptionClient = paramsOrClient; - } - else { - _this.subscriptionClient = new subscriptions_transport_ws_1.SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl); - } - return _this; - } - WebSocketLink.prototype.request = function (operation) { - return this.subscriptionClient.request(operation); - }; - return WebSocketLink; -}(apollo_link_1.ApolloLink)); -exports.WebSocketLink = WebSocketLink; -//# sourceMappingURL=webSocketLink.js.map \ No newline at end of file diff --git a/node_modules/apollo-link-ws/lib/webSocketLink.js.map b/node_modules/apollo-link-ws/lib/webSocketLink.js.map deleted file mode 100644 index bef74080..00000000 --- a/node_modules/apollo-link-ws/lib/webSocketLink.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webSocketLink.js","sourceRoot":"","sources":["../src/webSocketLink.ts"],"names":[],"mappings":";;;AAAA,2CAA6E;AAE7E,yEAA+E;AA2B/E;IAAmC,yCAAU;IAG3C,uBACE,cAAgE;QADlE,YAGE,iBAAO,SAWR;QATC,IAAI,cAAc,YAAY,+CAAkB,EAAE;YAChD,KAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;SAC1C;aAAM;YACL,KAAI,CAAC,kBAAkB,GAAG,IAAI,+CAAkB,CAC9C,cAAc,CAAC,GAAG,EAClB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,aAAa,CAC7B,CAAC;SACH;;IACH,CAAC;IAEM,+BAAO,GAAd,UAAe,SAAoB;QACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAE/C,CAAC;IACJ,CAAC;IACH,oBAAC;AAAD,CAAC,AAxBD,CAAmC,wBAAU,GAwB5C;AAxBY,sCAAa"} \ No newline at end of file diff --git a/node_modules/apollo-link-ws/package.json b/node_modules/apollo-link-ws/package.json deleted file mode 100644 index d6d18896..00000000 --- a/node_modules/apollo-link-ws/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "_args": [ - [ - "apollo-link-ws@1.0.19", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "apollo-link-ws@1.0.19", - "_id": "apollo-link-ws@1.0.19", - "_inBundle": false, - "_integrity": "sha512-mRXmeUkc55ixOdYRtfq5rq3o9sboKghKABKroDVhJnkdS56zthBEWMAD+phajujOUbqByxjok0te8ABqByBdeQ==", - "_location": "/apollo-link-ws", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "apollo-link-ws@1.0.19", - "name": "apollo-link-ws", - "escapedName": "apollo-link-ws", - "rawSpec": "1.0.19", - "saveSpec": null, - "fetchSpec": "1.0.19" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/apollo-link-ws/-/apollo-link-ws-1.0.19.tgz", - "_spec": "1.0.19", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Evans Hauser", - "email": "evanshauser@gmail.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-link/issues" - }, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "jon wong", - "email": "j@jnwng.com" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - } - ], - "dependencies": { - "apollo-link": "^1.2.13", - "tslib": "^1.9.3" - }, - "description": "WebSocket transport layer for GraphQL", - "devDependencies": { - "@types/graphql": "14.2.3", - "@types/jest": "24.0.18", - "graphql": "14.5.4", - "graphql-tag": "2.10.1", - "jest": "24.9.0", - "rimraf": "2.7.1", - "rollup": "1.20.3", - "subscriptions-transport-ws": "0.9.16", - "ts-jest": "22.4.6", - "tslint": "5.17.0", - "typescript": "3.0.3" - }, - "gitHead": "74d412528dd474fc41ee0bf504e36e01d7e05e2b", - "homepage": "https://github.com/apollographql/apollo-link#readme", - "jest": { - "transform": { - ".(ts|tsx)": "ts-jest" - }, - "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ], - "testURL": "http://localhost" - }, - "license": "MIT", - "main": "./lib/index.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-link-ws", - "peerDependencies": { - "subscriptions-transport-ws": "^0.9.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-link.git" - }, - "scripts": { - "build": "tsc && rollup -c", - "clean": "rimraf lib/* && rimraf coverage/*", - "coverage": "jest --coverage", - "filesize": "../../scripts/minify", - "lint": "tslint -c \"../../tslint.json\" -p tsconfig.json -c ../../tslint.json src/*.ts", - "prebuild": "npm run clean", - "prepare": "npm run build", - "test": "npm run lint && jest", - "watch": "tsc -w -p . & rollup -c -w" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.0.19" -} diff --git a/node_modules/apollo-link/CHANGELOG.md b/node_modules/apollo-link/CHANGELOG.md deleted file mode 100644 index a97f0583..00000000 --- a/node_modules/apollo-link/CHANGELOG.md +++ /dev/null @@ -1,57 +0,0 @@ -# Change log - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md). - ----- - -### 1.2.4 - -- No changes - -### 1.2.3 -- Added `graphql` 14 to peer and dev deps; Updated `@types/graphql` to 14
- [@hwillson](http://github.com/hwillson) in [#789](https://github.com/apollographql/apollo-link/pull/789) - -### 1.2.2 -- Update apollo-link [#559](https://github.com/apollographql/apollo-link/pull/559) -- export graphql types and add @types/graphql as a regular dependency [PR#576](https://github.com/apollographql/apollo-link/pull/576) -- moved @types/node to dev dependencies in package.josn to avoid collisions with other projects. [PR#540](https://github.com/apollographql/apollo-link/pull/540) - -### 1.2.1 -- update apollo link with zen-observable-ts to remove import issues [PR#515](https://github.com/apollographql/apollo-link/pull/515) - -### 1.2.0 -- Add `fromError` Observable helper -- change import method of zen-observable for rollup compat - -### 1.1.0 -- Expose `#execute` on ApolloLink as static - -### 1.0.7 -- Update to graphql@0.12 - -### 1.0.6 -- update rollup - -### 1.0.5 -- fix bug where context wasn't merged when setting it - -### 1.0.4 -- export link util helpers - -### 1.0.3 -- removed requiring query on initial execution check -- moved to move efficent rollup build - -### 1.0.1, 1.0.2 - -- preleases for dev tool integation - -### 0.8.0 -- added support for `extensions` on an operation - -### 0.7.0 -- new operation API and start of changelog diff --git a/node_modules/apollo-link/LICENSE b/node_modules/apollo-link/LICENSE deleted file mode 100644 index 07ea6625..00000000 --- a/node_modules/apollo-link/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 - 2017 Meteor Development Group, Inc. - -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. diff --git a/node_modules/apollo-link/README.md b/node_modules/apollo-link/README.md deleted file mode 100644 index 0ca807f5..00000000 --- a/node_modules/apollo-link/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# apollo-link - -## Purpose - -`apollo-link` is a standard interface for modifying control flow of GraphQL requests and fetching GraphQL results, designed to provide a simple GraphQL client that is capable of extensions. -The targeted use cases of `apollo-link` are highlighted below: - -* fetch queries directly without normalized cache -* network interface for Apollo Client -* network interface for Relay Modern -* fetcher for - -Apollo Link is the interface for creating new links in your application. - -The client sends a request as a method call to a link and can recieve one or more (in the case of subscriptions) responses from the server. The responses are returned using the Observer pattern. - -![Apollo Link Chain](https://cdn-images-1.medium.com/max/1600/1*62VLGUaU-9ULCoBCGvgdkQ.png) - -Results from the server can be provided by calling `next(result)` on the observer. In the case of a network/transport error (not a GraphQL Error) the `error(err)` method can be used to indicate a response will not be recieved. If multiple responses are not supported by the link, `complete()` should be called to inform the client no further data will be provided. - -In the case of an intermediate link, a second argument to `request(operation, forward)` is the link to `forward(operation)` to. `forward` returns an observable and it can be returned directly or subscribed to. - -```js -forward(operation).subscribe({ - next: result => { - handleTheResult(result) - }, - error: error => { - handleTheNetworkError(error) - }, -}); -``` - -## Implementing a basic custom transport - -```js -import { ApolloLink, Observable } from 'apollo-link'; - -export class CustomApolloLink extends ApolloLink { - request(operation /*, forward*/) { - //Whether no one is listening anymore - let unsubscribed = false; - - return new Observable(observer => { - somehowGetOperationToServer(operation, (error, result) => { - if (unsubscribed) return; - if (error) { - //Network error - observer.error(error); - } else { - observer.next(result); - observer.complete(); //If subscriptions not supported - } - }); - - function unsubscribe() { - unsubscribed = true; - } - - return unsubscribe; - }); - } -} -``` - -## Installation - -`npm install apollo-link --save` - diff --git a/node_modules/apollo-link/lib/bundle.cjs.js b/node_modules/apollo-link/lib/bundle.cjs.js deleted file mode 100644 index 67ed9289..00000000 --- a/node_modules/apollo-link/lib/bundle.cjs.js +++ /dev/null @@ -1,212 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var Observable = _interopDefault(require('zen-observable-ts')); -var tsInvariant = require('ts-invariant'); -var tslib = require('tslib'); -var apolloUtilities = require('apollo-utilities'); - -function validateOperation(operation) { - var OPERATION_FIELDS = [ - 'query', - 'operationName', - 'variables', - 'extensions', - 'context', - ]; - for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { - var key = _a[_i]; - if (OPERATION_FIELDS.indexOf(key) < 0) { - throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(2) : new tsInvariant.InvariantError("illegal argument: " + key); - } - } - return operation; -} -var LinkError = (function (_super) { - tslib.__extends(LinkError, _super); - function LinkError(message, link) { - var _this = _super.call(this, message) || this; - _this.link = link; - return _this; - } - return LinkError; -}(Error)); -function isTerminating(link) { - return link.request.length <= 1; -} -function toPromise(observable) { - var completed = false; - return new Promise(function (resolve, reject) { - observable.subscribe({ - next: function (data) { - if (completed) { - process.env.NODE_ENV === "production" || tsInvariant.invariant.warn("Promise Wrapper does not support multiple results from Observable"); - } - else { - completed = true; - resolve(data); - } - }, - error: reject, - }); - }); -} -var makePromise = toPromise; -function fromPromise(promise) { - return new Observable(function (observer) { - promise - .then(function (value) { - observer.next(value); - observer.complete(); - }) - .catch(observer.error.bind(observer)); - }); -} -function fromError(errorValue) { - return new Observable(function (observer) { - observer.error(errorValue); - }); -} -function transformOperation(operation) { - var transformedOperation = { - variables: operation.variables || {}, - extensions: operation.extensions || {}, - operationName: operation.operationName, - query: operation.query, - }; - if (!transformedOperation.operationName) { - transformedOperation.operationName = - typeof transformedOperation.query !== 'string' - ? apolloUtilities.getOperationName(transformedOperation.query) - : ''; - } - return transformedOperation; -} -function createOperation(starting, operation) { - var context = tslib.__assign({}, starting); - var setContext = function (next) { - if (typeof next === 'function') { - context = tslib.__assign({}, context, next(context)); - } - else { - context = tslib.__assign({}, context, next); - } - }; - var getContext = function () { return (tslib.__assign({}, context)); }; - Object.defineProperty(operation, 'setContext', { - enumerable: false, - value: setContext, - }); - Object.defineProperty(operation, 'getContext', { - enumerable: false, - value: getContext, - }); - Object.defineProperty(operation, 'toKey', { - enumerable: false, - value: function () { return getKey(operation); }, - }); - return operation; -} -function getKey(operation) { - var query = operation.query, variables = operation.variables, operationName = operation.operationName; - return JSON.stringify([operationName, query, variables]); -} - -function passthrough(op, forward) { - return forward ? forward(op) : Observable.of(); -} -function toLink(handler) { - return typeof handler === 'function' ? new ApolloLink(handler) : handler; -} -function empty() { - return new ApolloLink(function () { return Observable.of(); }); -} -function from(links) { - if (links.length === 0) - return empty(); - return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); -} -function split(test, left, right) { - var leftLink = toLink(left); - var rightLink = toLink(right || new ApolloLink(passthrough)); - if (isTerminating(leftLink) && isTerminating(rightLink)) { - return new ApolloLink(function (operation) { - return test(operation) - ? leftLink.request(operation) || Observable.of() - : rightLink.request(operation) || Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return test(operation) - ? leftLink.request(operation, forward) || Observable.of() - : rightLink.request(operation, forward) || Observable.of(); - }); - } -} -var concat = function (first, second) { - var firstLink = toLink(first); - if (isTerminating(firstLink)) { - process.env.NODE_ENV === "production" || tsInvariant.invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); - return firstLink; - } - var nextLink = toLink(second); - if (isTerminating(nextLink)) { - return new ApolloLink(function (operation) { - return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return (firstLink.request(operation, function (op) { - return nextLink.request(op, forward) || Observable.of(); - }) || Observable.of()); - }); - } -}; -var ApolloLink = (function () { - function ApolloLink(request) { - if (request) - this.request = request; - } - ApolloLink.prototype.split = function (test, left, right) { - return this.concat(split(test, left, right || new ApolloLink(passthrough))); - }; - ApolloLink.prototype.concat = function (next) { - return concat(this, next); - }; - ApolloLink.prototype.request = function (operation, forward) { - throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(1) : new tsInvariant.InvariantError('request is not implemented'); - }; - ApolloLink.empty = empty; - ApolloLink.from = from; - ApolloLink.split = split; - ApolloLink.execute = execute; - return ApolloLink; -}()); -function execute(link, operation) { - return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of()); -} - -exports.Observable = Observable; -Object.defineProperty(exports, 'getOperationName', { - enumerable: true, - get: function () { - return apolloUtilities.getOperationName; - } -}); -exports.ApolloLink = ApolloLink; -exports.concat = concat; -exports.createOperation = createOperation; -exports.empty = empty; -exports.execute = execute; -exports.from = from; -exports.fromError = fromError; -exports.fromPromise = fromPromise; -exports.makePromise = makePromise; -exports.split = split; -exports.toPromise = toPromise; -//# sourceMappingURL=bundle.cjs.js.map diff --git a/node_modules/apollo-link/lib/bundle.cjs.js.map b/node_modules/apollo-link/lib/bundle.cjs.js.map deleted file mode 100644 index 45e1e8eb..00000000 --- a/node_modules/apollo-link/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.cjs.js","sources":["bundle.esm.js"],"sourcesContent":["import Observable from 'zen-observable-ts';\nexport { default as Observable } from 'zen-observable-ts';\nimport { invariant, InvariantError } from 'ts-invariant';\nimport { __extends, __assign } from 'tslib';\nimport { getOperationName } from 'apollo-utilities';\nexport { getOperationName } from 'apollo-utilities';\n\nfunction validateOperation(operation) {\n var OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw process.env.NODE_ENV === \"production\" ? new InvariantError(2) : new InvariantError(\"illegal argument: \" + key);\n }\n }\n return operation;\n}\nvar LinkError = (function (_super) {\n __extends(LinkError, _super);\n function LinkError(message, link) {\n var _this = _super.call(this, message) || this;\n _this.link = link;\n return _this;\n }\n return LinkError;\n}(Error));\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nfunction toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n process.env.NODE_ENV === \"production\" || invariant.warn(\"Promise Wrapper does not support multiple results from Observable\");\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\nvar makePromise = toPromise;\nfunction fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\nfunction fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\nfunction transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== 'string'\n ? getOperationName(transformedOperation.query)\n : '';\n }\n return transformedOperation;\n}\nfunction createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === 'function') {\n context = __assign({}, context, next(context));\n }\n else {\n context = __assign({}, context, next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, 'setContext', {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, 'getContext', {\n enumerable: false,\n value: getContext,\n });\n Object.defineProperty(operation, 'toKey', {\n enumerable: false,\n value: function () { return getKey(operation); },\n });\n return operation;\n}\nfunction getKey(operation) {\n var query = operation.query, variables = operation.variables, operationName = operation.operationName;\n return JSON.stringify([operationName, query, variables]);\n}\n\nfunction passthrough(op, forward) {\n return forward ? forward(op) : Observable.of();\n}\nfunction toLink(handler) {\n return typeof handler === 'function' ? new ApolloLink(handler) : handler;\n}\nfunction empty() {\n return new ApolloLink(function () { return Observable.of(); });\n}\nfunction from(links) {\n if (links.length === 0)\n return empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n}\nfunction split(test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n return new ApolloLink(function (operation) {\n return test(operation)\n ? leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return test(operation)\n ? leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n}\nvar concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n process.env.NODE_ENV === \"production\" || invariant.warn(new LinkError(\"You are calling concat on a terminating link, which will have no effect\", firstLink));\n return firstLink;\n }\n var nextLink = toLink(second);\n if (isTerminating(nextLink)) {\n return new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n};\nvar ApolloLink = (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw process.env.NODE_ENV === \"production\" ? new InvariantError(1) : new InvariantError('request is not implemented');\n };\n ApolloLink.empty = empty;\n ApolloLink.from = from;\n ApolloLink.split = split;\n ApolloLink.execute = execute;\n return ApolloLink;\n}());\nfunction execute(link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n}\n\nexport { ApolloLink, concat, createOperation, empty, execute, from, fromError, fromPromise, makePromise, split, toPromise };\n//# sourceMappingURL=bundle.esm.js.map\n"],"names":["InvariantError","__extends","invariant","getOperationName","__assign"],"mappings":";;;;;;;;;;;AAOA,SAAS,iBAAiB,CAAC,SAAS,EAAE;AACtC,IAAI,IAAI,gBAAgB,GAAG;AAC3B,QAAQ,OAAO;AACf,QAAQ,eAAe;AACvB,QAAQ,WAAW;AACnB,QAAQ,YAAY;AACpB,QAAQ,SAAS;AACjB,KAAK,CAAC;AACN,IAAI,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE;AACxE,QAAQ,IAAI,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AACzB,QAAQ,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC/C,YAAY,MA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CAAC,CAAC,CAAC,GAAG,IAAIA,0BAAc,CAAC,4BAA4B,CAAC,CAAC;AAC/H,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;AAC7B,IAAI,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;AAC3B,IAAI,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;AAC7B,IAAI,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;AACjC,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,EAAE,EAAE;AACL,SAAS,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE;AAClC,IAAI,QAAQ,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,EAAE,EAAE,EAAE;AACnI;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/bundle.esm.js b/node_modules/apollo-link/lib/bundle.esm.js deleted file mode 100644 index c73d7705..00000000 --- a/node_modules/apollo-link/lib/bundle.esm.js +++ /dev/null @@ -1,191 +0,0 @@ -import Observable from 'zen-observable-ts'; -export { default as Observable } from 'zen-observable-ts'; -import { invariant, InvariantError } from 'ts-invariant'; -import { __extends, __assign } from 'tslib'; -import { getOperationName } from 'apollo-utilities'; -export { getOperationName } from 'apollo-utilities'; - -function validateOperation(operation) { - var OPERATION_FIELDS = [ - 'query', - 'operationName', - 'variables', - 'extensions', - 'context', - ]; - for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { - var key = _a[_i]; - if (OPERATION_FIELDS.indexOf(key) < 0) { - throw process.env.NODE_ENV === "production" ? new InvariantError(2) : new InvariantError("illegal argument: " + key); - } - } - return operation; -} -var LinkError = (function (_super) { - __extends(LinkError, _super); - function LinkError(message, link) { - var _this = _super.call(this, message) || this; - _this.link = link; - return _this; - } - return LinkError; -}(Error)); -function isTerminating(link) { - return link.request.length <= 1; -} -function toPromise(observable) { - var completed = false; - return new Promise(function (resolve, reject) { - observable.subscribe({ - next: function (data) { - if (completed) { - process.env.NODE_ENV === "production" || invariant.warn("Promise Wrapper does not support multiple results from Observable"); - } - else { - completed = true; - resolve(data); - } - }, - error: reject, - }); - }); -} -var makePromise = toPromise; -function fromPromise(promise) { - return new Observable(function (observer) { - promise - .then(function (value) { - observer.next(value); - observer.complete(); - }) - .catch(observer.error.bind(observer)); - }); -} -function fromError(errorValue) { - return new Observable(function (observer) { - observer.error(errorValue); - }); -} -function transformOperation(operation) { - var transformedOperation = { - variables: operation.variables || {}, - extensions: operation.extensions || {}, - operationName: operation.operationName, - query: operation.query, - }; - if (!transformedOperation.operationName) { - transformedOperation.operationName = - typeof transformedOperation.query !== 'string' - ? getOperationName(transformedOperation.query) - : ''; - } - return transformedOperation; -} -function createOperation(starting, operation) { - var context = __assign({}, starting); - var setContext = function (next) { - if (typeof next === 'function') { - context = __assign({}, context, next(context)); - } - else { - context = __assign({}, context, next); - } - }; - var getContext = function () { return (__assign({}, context)); }; - Object.defineProperty(operation, 'setContext', { - enumerable: false, - value: setContext, - }); - Object.defineProperty(operation, 'getContext', { - enumerable: false, - value: getContext, - }); - Object.defineProperty(operation, 'toKey', { - enumerable: false, - value: function () { return getKey(operation); }, - }); - return operation; -} -function getKey(operation) { - var query = operation.query, variables = operation.variables, operationName = operation.operationName; - return JSON.stringify([operationName, query, variables]); -} - -function passthrough(op, forward) { - return forward ? forward(op) : Observable.of(); -} -function toLink(handler) { - return typeof handler === 'function' ? new ApolloLink(handler) : handler; -} -function empty() { - return new ApolloLink(function () { return Observable.of(); }); -} -function from(links) { - if (links.length === 0) - return empty(); - return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); -} -function split(test, left, right) { - var leftLink = toLink(left); - var rightLink = toLink(right || new ApolloLink(passthrough)); - if (isTerminating(leftLink) && isTerminating(rightLink)) { - return new ApolloLink(function (operation) { - return test(operation) - ? leftLink.request(operation) || Observable.of() - : rightLink.request(operation) || Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return test(operation) - ? leftLink.request(operation, forward) || Observable.of() - : rightLink.request(operation, forward) || Observable.of(); - }); - } -} -var concat = function (first, second) { - var firstLink = toLink(first); - if (isTerminating(firstLink)) { - process.env.NODE_ENV === "production" || invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); - return firstLink; - } - var nextLink = toLink(second); - if (isTerminating(nextLink)) { - return new ApolloLink(function (operation) { - return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return (firstLink.request(operation, function (op) { - return nextLink.request(op, forward) || Observable.of(); - }) || Observable.of()); - }); - } -}; -var ApolloLink = (function () { - function ApolloLink(request) { - if (request) - this.request = request; - } - ApolloLink.prototype.split = function (test, left, right) { - return this.concat(split(test, left, right || new ApolloLink(passthrough))); - }; - ApolloLink.prototype.concat = function (next) { - return concat(this, next); - }; - ApolloLink.prototype.request = function (operation, forward) { - throw process.env.NODE_ENV === "production" ? new InvariantError(1) : new InvariantError('request is not implemented'); - }; - ApolloLink.empty = empty; - ApolloLink.from = from; - ApolloLink.split = split; - ApolloLink.execute = execute; - return ApolloLink; -}()); -function execute(link, operation) { - return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of()); -} - -export { ApolloLink, concat, createOperation, empty, execute, from, fromError, fromPromise, makePromise, split, toPromise }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-link/lib/bundle.esm.js.map b/node_modules/apollo-link/lib/bundle.esm.js.map deleted file mode 100644 index 6612c810..00000000 --- a/node_modules/apollo-link/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/linkUtils.ts","../src/link.ts"],"sourcesContent":["import Observable from 'zen-observable-ts';\n\nimport { GraphQLRequest, Operation } from './types';\nimport { ApolloLink } from './link';\n\nimport { getOperationName } from 'apollo-utilities';\nimport { invariant, InvariantError } from 'ts-invariant';\nexport { getOperationName };\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw new InvariantError(`illegal argument: ${key}`);\n }\n }\n\n return operation;\n}\n\nexport class LinkError extends Error {\n public link: ApolloLink;\n constructor(message?: string, link?: ApolloLink) {\n super(message);\n this.link = link;\n }\n}\n\nexport function isTerminating(link: ApolloLink): boolean {\n return link.request.length <= 1;\n}\n\nexport function toPromise(observable: Observable): Promise {\n let completed = false;\n return new Promise((resolve, reject) => {\n observable.subscribe({\n next: data => {\n if (completed) {\n invariant.warn(\n `Promise Wrapper does not support multiple results from Observable`,\n );\n } else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n\n// backwards compat\nexport const makePromise = toPromise;\n\nexport function fromPromise(promise: Promise): Observable {\n return new Observable(observer => {\n promise\n .then((value: T) => {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n\nexport function fromError(errorValue: any): Observable {\n return new Observable(observer => {\n observer.error(errorValue);\n });\n}\n\nexport function transformOperation(operation: GraphQLRequest): GraphQLRequest {\n const transformedOperation: GraphQLRequest = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n\n // best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== 'string'\n ? getOperationName(transformedOperation.query)\n : '';\n }\n\n return transformedOperation as Operation;\n}\n\nexport function createOperation(\n starting: any,\n operation: GraphQLRequest,\n): Operation {\n let context = { ...starting };\n const setContext = next => {\n if (typeof next === 'function') {\n context = { ...context, ...next(context) };\n } else {\n context = { ...context, ...next };\n }\n };\n const getContext = () => ({ ...context });\n\n Object.defineProperty(operation, 'setContext', {\n enumerable: false,\n value: setContext,\n });\n\n Object.defineProperty(operation, 'getContext', {\n enumerable: false,\n value: getContext,\n });\n\n Object.defineProperty(operation, 'toKey', {\n enumerable: false,\n value: () => getKey(operation),\n });\n\n return operation as Operation;\n}\n\nexport function getKey(operation: GraphQLRequest) {\n // XXX We're assuming here that query and variables will be serialized in\n // the same order, which might not always be true.\n const { query, variables, operationName } = operation;\n return JSON.stringify([operationName, query, variables]);\n}\n","import Observable from 'zen-observable-ts';\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport {\n GraphQLRequest,\n NextLink,\n Operation,\n RequestHandler,\n FetchResult,\n} from './types';\n\nimport {\n validateOperation,\n isTerminating,\n LinkError,\n transformOperation,\n createOperation,\n} from './linkUtils';\n\nfunction passthrough(op, forward) {\n return forward ? forward(op) : Observable.of();\n}\n\nfunction toLink(handler: RequestHandler | ApolloLink) {\n return typeof handler === 'function' ? new ApolloLink(handler) : handler;\n}\n\nexport function empty(): ApolloLink {\n return new ApolloLink(() => Observable.of());\n}\n\nexport function from(links: ApolloLink[]): ApolloLink {\n if (links.length === 0) return empty();\n return links.map(toLink).reduce((x, y) => x.concat(y));\n}\n\nexport function split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler,\n): ApolloLink {\n const leftLink = toLink(left);\n const rightLink = toLink(right || new ApolloLink(passthrough));\n\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n return new ApolloLink(operation => {\n return test(operation)\n ? leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n } else {\n return new ApolloLink((operation, forward) => {\n return test(operation)\n ? leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n}\n\n// join two Links together\nexport const concat = (\n first: ApolloLink | RequestHandler,\n second: ApolloLink | RequestHandler,\n) => {\n const firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n invariant.warn(\n new LinkError(\n `You are calling concat on a terminating link, which will have no effect`,\n firstLink,\n ),\n );\n return firstLink;\n }\n const nextLink = toLink(second);\n\n if (isTerminating(nextLink)) {\n return new ApolloLink(\n operation =>\n firstLink.request(\n operation,\n op => nextLink.request(op) || Observable.of(),\n ) || Observable.of(),\n );\n } else {\n return new ApolloLink((operation, forward) => {\n return (\n firstLink.request(operation, op => {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of()\n );\n });\n }\n};\n\nexport class ApolloLink {\n public static empty = empty;\n public static from = from;\n public static split = split;\n public static execute = execute;\n\n constructor(request?: RequestHandler) {\n if (request) this.request = request;\n }\n\n public split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler,\n ): ApolloLink {\n return this.concat(split(test, left, right || new ApolloLink(passthrough)));\n }\n\n public concat(next: ApolloLink | RequestHandler): ApolloLink {\n return concat(this, next);\n }\n\n public request(\n operation: Operation,\n forward?: NextLink,\n ): Observable | null {\n throw new InvariantError('request is not implemented');\n }\n}\n\nexport function execute(\n link: ApolloLink,\n operation: GraphQLRequest,\n): Observable {\n return (\n link.request(\n createOperation(\n operation.context,\n transformOperation(validateOperation(operation)),\n ),\n ) || Observable.of()\n );\n}\n"],"names":["tslib_1.__extends"],"mappings":";;;;;;;SASgB,iBAAiB,CAAC,SAAyB;IACzD,IAAM,gBAAgB,GAAG;QACvB,OAAO;QACP,eAAe;QACf,WAAW;QACX,YAAY;QACZ,SAAS;KACV,CAAC;IACF,KAAgB,UAAsB,EAAtB,KAAA,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAtB,cAAsB,EAAtB,IAAsB,EAAE;QAAnC,IAAI,GAAG,SAAA;QACV,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACrC,MAAM;SACP;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;IAA+BA,6BAAK;IAElC,mBAAY,OAAgB,EAAE,IAAiB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AAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;KACrC;IAEM,0BAAK,GAAZ,UACE,IAAgC,EAChC,IAAiC,EACjC,KAAmC;QAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;KAC7E;IAEM,2BAAM,GAAb,UAAc,IAAiC;QAC7C,OAAO,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;KAC3B;IAEM,4BAAO,GAAd,UACE,SAAoB,EACpB,OAAkB;QAElB,MAAM;KACP;IA1Ba,gBAAK,GAAG,KAAK,CAAC;IACd,eAAI,GAAG,IAAI,CAAC;IACZ,gBAAK,GAAG,KAAK,CAAC;IACd,kBAAO,GAAG,OAAO,CAAC;IAwBlC,iBAAC;CA5BD,IA4BC;SAEe,OAAO,CACrB,IAAgB,EAChB,SAAyB;IAEzB,QACE,IAAI,CAAC,OAAO,CACV,eAAe,CACb,SAAS,CAAC,OAAO,EACjB,kBAAkB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CACjD,CACF,IAAI,UAAU,CAAC,EAAE,EAAE,EACpB;AACJ,CAAC;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/bundle.umd.js b/node_modules/apollo-link/lib/bundle.umd.js deleted file mode 100644 index 5e978ca5..00000000 --- a/node_modules/apollo-link/lib/bundle.umd.js +++ /dev/null @@ -1,213 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('zen-observable-ts'), require('ts-invariant'), require('tslib'), require('apollo-utilities')) : - typeof define === 'function' && define.amd ? define(['exports', 'zen-observable-ts', 'ts-invariant', 'tslib', 'apollo-utilities'], factory) : - (global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.core = {}), global.apolloLink.zenObservable, global.invariant, global.tslib, global.apolloUtilities)); -}(this, (function (exports, Observable, tsInvariant, tslib_1, apolloUtilities) { 'use strict'; - - Observable = Observable && Observable.hasOwnProperty('default') ? Observable['default'] : Observable; - - function validateOperation(operation) { - var OPERATION_FIELDS = [ - 'query', - 'operationName', - 'variables', - 'extensions', - 'context', - ]; - for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { - var key = _a[_i]; - if (OPERATION_FIELDS.indexOf(key) < 0) { - throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(2) : new tsInvariant.InvariantError("illegal argument: " + key); - } - } - return operation; - } - var LinkError = (function (_super) { - tslib_1.__extends(LinkError, _super); - function LinkError(message, link) { - var _this = _super.call(this, message) || this; - _this.link = link; - return _this; - } - return LinkError; - }(Error)); - function isTerminating(link) { - return link.request.length <= 1; - } - function toPromise(observable) { - var completed = false; - return new Promise(function (resolve, reject) { - observable.subscribe({ - next: function (data) { - if (completed) { - process.env.NODE_ENV === "production" || tsInvariant.invariant.warn("Promise Wrapper does not support multiple results from Observable"); - } - else { - completed = true; - resolve(data); - } - }, - error: reject, - }); - }); - } - var makePromise = toPromise; - function fromPromise(promise) { - return new Observable(function (observer) { - promise - .then(function (value) { - observer.next(value); - observer.complete(); - }) - .catch(observer.error.bind(observer)); - }); - } - function fromError(errorValue) { - return new Observable(function (observer) { - observer.error(errorValue); - }); - } - function transformOperation(operation) { - var transformedOperation = { - variables: operation.variables || {}, - extensions: operation.extensions || {}, - operationName: operation.operationName, - query: operation.query, - }; - if (!transformedOperation.operationName) { - transformedOperation.operationName = - typeof transformedOperation.query !== 'string' - ? apolloUtilities.getOperationName(transformedOperation.query) - : ''; - } - return transformedOperation; - } - function createOperation(starting, operation) { - var context = tslib_1.__assign({}, starting); - var setContext = function (next) { - if (typeof next === 'function') { - context = tslib_1.__assign({}, context, next(context)); - } - else { - context = tslib_1.__assign({}, context, next); - } - }; - var getContext = function () { return (tslib_1.__assign({}, context)); }; - Object.defineProperty(operation, 'setContext', { - enumerable: false, - value: setContext, - }); - Object.defineProperty(operation, 'getContext', { - enumerable: false, - value: getContext, - }); - Object.defineProperty(operation, 'toKey', { - enumerable: false, - value: function () { return getKey(operation); }, - }); - return operation; - } - function getKey(operation) { - var query = operation.query, variables = operation.variables, operationName = operation.operationName; - return JSON.stringify([operationName, query, variables]); - } - - function passthrough(op, forward) { - return forward ? forward(op) : Observable.of(); - } - function toLink(handler) { - return typeof handler === 'function' ? new ApolloLink(handler) : handler; - } - function empty() { - return new ApolloLink(function () { return Observable.of(); }); - } - function from(links) { - if (links.length === 0) - return empty(); - return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); - } - function split(test, left, right) { - var leftLink = toLink(left); - var rightLink = toLink(right || new ApolloLink(passthrough)); - if (isTerminating(leftLink) && isTerminating(rightLink)) { - return new ApolloLink(function (operation) { - return test(operation) - ? leftLink.request(operation) || Observable.of() - : rightLink.request(operation) || Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return test(operation) - ? leftLink.request(operation, forward) || Observable.of() - : rightLink.request(operation, forward) || Observable.of(); - }); - } - } - var concat = function (first, second) { - var firstLink = toLink(first); - if (isTerminating(firstLink)) { - process.env.NODE_ENV === "production" || tsInvariant.invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); - return firstLink; - } - var nextLink = toLink(second); - if (isTerminating(nextLink)) { - return new ApolloLink(function (operation) { - return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return (firstLink.request(operation, function (op) { - return nextLink.request(op, forward) || Observable.of(); - }) || Observable.of()); - }); - } - }; - var ApolloLink = (function () { - function ApolloLink(request) { - if (request) - this.request = request; - } - ApolloLink.prototype.split = function (test, left, right) { - return this.concat(split(test, left, right || new ApolloLink(passthrough))); - }; - ApolloLink.prototype.concat = function (next) { - return concat(this, next); - }; - ApolloLink.prototype.request = function (operation, forward) { - throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(1) : new tsInvariant.InvariantError('request is not implemented'); - }; - ApolloLink.empty = empty; - ApolloLink.from = from; - ApolloLink.split = split; - ApolloLink.execute = execute; - return ApolloLink; - }()); - function execute(link, operation) { - return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of()); - } - - exports.Observable = Observable; - Object.defineProperty(exports, 'getOperationName', { - enumerable: true, - get: function () { - return apolloUtilities.getOperationName; - } - }); - exports.ApolloLink = ApolloLink; - exports.concat = concat; - exports.createOperation = createOperation; - exports.empty = empty; - exports.execute = execute; - exports.from = from; - exports.fromError = fromError; - exports.fromPromise = fromPromise; - exports.makePromise = makePromise; - exports.split = split; - exports.toPromise = toPromise; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=bundle.umd.js.map diff --git a/node_modules/apollo-link/lib/bundle.umd.js.map b/node_modules/apollo-link/lib/bundle.umd.js.map deleted file mode 100644 index ca934c47..00000000 --- a/node_modules/apollo-link/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.umd.js","sources":["../src/linkUtils.ts","../src/link.ts"],"sourcesContent":["import Observable from 'zen-observable-ts';\n\nimport { GraphQLRequest, Operation } from './types';\nimport { ApolloLink } from './link';\n\nimport { getOperationName } from 'apollo-utilities';\nimport { invariant, InvariantError } from 'ts-invariant';\nexport { getOperationName };\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw new InvariantError(`illegal argument: ${key}`);\n }\n }\n\n return operation;\n}\n\nexport class LinkError extends Error {\n public link: ApolloLink;\n constructor(message?: string, link?: ApolloLink) {\n super(message);\n this.link = link;\n }\n}\n\nexport function isTerminating(link: ApolloLink): boolean {\n return link.request.length <= 1;\n}\n\nexport function toPromise(observable: Observable): Promise {\n let completed = false;\n return new Promise((resolve, reject) => {\n observable.subscribe({\n next: data => {\n if (completed) {\n invariant.warn(\n `Promise Wrapper does not support multiple results from Observable`,\n );\n } else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n\n// backwards compat\nexport const makePromise = toPromise;\n\nexport function fromPromise(promise: Promise): Observable {\n return new Observable(observer => {\n promise\n .then((value: T) => {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n\nexport function fromError(errorValue: any): Observable {\n return new Observable(observer => {\n observer.error(errorValue);\n });\n}\n\nexport function transformOperation(operation: GraphQLRequest): GraphQLRequest {\n const transformedOperation: GraphQLRequest = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n\n // best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== 'string'\n ? getOperationName(transformedOperation.query)\n : '';\n }\n\n return transformedOperation as Operation;\n}\n\nexport function createOperation(\n starting: any,\n operation: GraphQLRequest,\n): Operation {\n let context = { ...starting };\n const setContext = next => {\n if (typeof next === 'function') {\n context = { ...context, ...next(context) };\n } else {\n context = { ...context, ...next };\n }\n };\n const getContext = () => ({ ...context });\n\n Object.defineProperty(operation, 'setContext', {\n enumerable: false,\n value: setContext,\n });\n\n Object.defineProperty(operation, 'getContext', {\n enumerable: false,\n value: getContext,\n });\n\n Object.defineProperty(operation, 'toKey', {\n enumerable: false,\n value: () => getKey(operation),\n });\n\n return operation as Operation;\n}\n\nexport function getKey(operation: GraphQLRequest) {\n // XXX We're assuming here that query and variables will be serialized in\n // the same order, which might not always be true.\n const { query, variables, operationName } = operation;\n return JSON.stringify([operationName, query, variables]);\n}\n","import Observable from 'zen-observable-ts';\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport {\n GraphQLRequest,\n NextLink,\n Operation,\n RequestHandler,\n FetchResult,\n} from './types';\n\nimport {\n validateOperation,\n isTerminating,\n LinkError,\n transformOperation,\n createOperation,\n} from './linkUtils';\n\nfunction passthrough(op, forward) {\n return forward ? forward(op) : Observable.of();\n}\n\nfunction toLink(handler: RequestHandler | ApolloLink) {\n return typeof handler === 'function' ? new ApolloLink(handler) : handler;\n}\n\nexport function empty(): ApolloLink {\n return new ApolloLink(() => Observable.of());\n}\n\nexport function from(links: ApolloLink[]): ApolloLink {\n if (links.length === 0) return empty();\n return links.map(toLink).reduce((x, y) => x.concat(y));\n}\n\nexport function split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler,\n): ApolloLink {\n const leftLink = toLink(left);\n const rightLink = toLink(right || new ApolloLink(passthrough));\n\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n return new ApolloLink(operation => {\n return test(operation)\n ? leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n } else {\n return new ApolloLink((operation, forward) => {\n return test(operation)\n ? leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n}\n\n// join two Links together\nexport const concat = (\n first: ApolloLink | RequestHandler,\n second: ApolloLink | RequestHandler,\n) => {\n const firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n invariant.warn(\n new LinkError(\n `You are calling concat on a terminating link, which will have no effect`,\n firstLink,\n ),\n );\n return firstLink;\n }\n const nextLink = toLink(second);\n\n if (isTerminating(nextLink)) {\n return new ApolloLink(\n operation =>\n firstLink.request(\n operation,\n op => nextLink.request(op) || Observable.of(),\n ) || Observable.of(),\n );\n } else {\n return new ApolloLink((operation, forward) => {\n return (\n firstLink.request(operation, op => {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of()\n );\n });\n }\n};\n\nexport class ApolloLink {\n public static empty = empty;\n public static from = from;\n public static split = split;\n public static execute = execute;\n\n constructor(request?: RequestHandler) {\n if (request) this.request = request;\n }\n\n public split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler,\n ): ApolloLink {\n return this.concat(split(test, left, right || new ApolloLink(passthrough)));\n }\n\n public concat(next: ApolloLink | RequestHandler): ApolloLink {\n return concat(this, next);\n }\n\n public request(\n operation: Operation,\n forward?: NextLink,\n ): Observable | null {\n throw new InvariantError('request is not implemented');\n }\n}\n\nexport function execute(\n link: ApolloLink,\n operation: GraphQLRequest,\n): Observable {\n return (\n link.request(\n createOperation(\n operation.context,\n transformOperation(validateOperation(operation)),\n ),\n ) || Observable.of()\n );\n}\n"],"names":["tslib_1.__extends","getOperationName"],"mappings":";;;;;;;;WASgB,iBAAiB,CAAC,SAAyB;MACzD,IAAM,gBAAgB,GAAG;UACvB,OAAO;UACP,eAAe;UACf,WAAW;UACX,YAAY;UACZ,SAAS;OACV,CAAC;MACF,KAAgB,UAAsB,EAAtB,KAAA,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAtB,cAAsB,EAAtB,IAAsB,EAAE;UAAnC,IAAI,GAAG,SAAA;UACV,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;cACrC,MAAM;WACP;OACF;MAED,OAAO,SAAS,CAAC;EACnB,CAAC;EAED;MAA+BA,qCAAK;MAElC,mBAAY,OAAgB,EAAE,IAAiB;UAA/C,YACE,kBAAM,OAAO,CAAC,SAEf;UADC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;OAClB;MACH,gBAAC;EAAD,CANA,CAA+B,KAAK,GAMnC;WAEe,aAAa,CAAC,IAAgB;MAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;EAClC,CAAC;WAEe,SAAS,CAAI,UAAyB;MACpD,IAAI,SAAS,GAAG,KAAK,CAAC;MACtB,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;UACpC,UAAU,CAAC,SAAS,CAAC;cACnB,IAAI,EAAE,UAAA,IAAI;kBACR,IAAI,SAAS,EAAE;sBACb;mBAGD;uBAAM;sBACL,SAAS,GAAG,IAAI,CAAC;sBACjB,OAA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K,CAAC;MACd,kBAAO,GAAG,OAAO,CAAC;MAwBlC,iBAAC;GA5BD,IA4BC;WAEe,OAAO,CACrB,IAAgB,EAChB,SAAyB;MAEzB,QACE,IAAI,CAAC,OAAO,CACV,eAAe,CACb,SAAS,CAAC,OAAO,EACjB,kBAAkB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CACjD,CACF,IAAI,UAAU,CAAC,EAAE,EAAE,EACpB;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/index.d.ts b/node_modules/apollo-link/lib/index.d.ts deleted file mode 100644 index b0381ae2..00000000 --- a/node_modules/apollo-link/lib/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './link'; -export { createOperation, makePromise, toPromise, fromPromise, fromError, getOperationName, } from './linkUtils'; -export * from './types'; -import Observable from 'zen-observable-ts'; -export { Observable }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/index.d.ts.map b/node_modules/apollo-link/lib/index.d.ts.map deleted file mode 100644 index ae8e854e..00000000 --- a/node_modules/apollo-link/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,EACL,eAAe,EACf,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,cAAc,SAAS,CAAC;AAExB,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/index.js b/node_modules/apollo-link/lib/index.js deleted file mode 100644 index 7a4f2ae2..00000000 --- a/node_modules/apollo-link/lib/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./link"), exports); -var linkUtils_1 = require("./linkUtils"); -exports.createOperation = linkUtils_1.createOperation; -exports.makePromise = linkUtils_1.makePromise; -exports.toPromise = linkUtils_1.toPromise; -exports.fromPromise = linkUtils_1.fromPromise; -exports.fromError = linkUtils_1.fromError; -exports.getOperationName = linkUtils_1.getOperationName; -var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts")); -exports.Observable = zen_observable_ts_1.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/index.js.map b/node_modules/apollo-link/lib/index.js.map deleted file mode 100644 index 2a40f7d7..00000000 --- a/node_modules/apollo-link/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,yCAOqB;AANnB,sCAAA,eAAe,CAAA;AACf,kCAAA,WAAW,CAAA;AACX,gCAAA,SAAS,CAAA;AACT,kCAAA,WAAW,CAAA;AACX,gCAAA,SAAS,CAAA;AACT,uCAAA,gBAAgB,CAAA;AAIlB,gFAA2C;AAClC,qBADF,2BAAU,CACE"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/link.d.ts b/node_modules/apollo-link/lib/link.d.ts deleted file mode 100644 index 1ae24c3f..00000000 --- a/node_modules/apollo-link/lib/link.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Observable from 'zen-observable-ts'; -import { GraphQLRequest, NextLink, Operation, RequestHandler, FetchResult } from './types'; -export declare function empty(): ApolloLink; -export declare function from(links: ApolloLink[]): ApolloLink; -export declare function split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; -export declare const concat: (first: RequestHandler | ApolloLink, second: RequestHandler | ApolloLink) => ApolloLink; -export declare class ApolloLink { - static empty: typeof empty; - static from: typeof from; - static split: typeof split; - static execute: typeof execute; - constructor(request?: RequestHandler); - split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; - concat(next: ApolloLink | RequestHandler): ApolloLink; - request(operation: Operation, forward?: NextLink): Observable | null; -} -export declare function execute(link: ApolloLink, operation: GraphQLRequest): Observable; -//# sourceMappingURL=link.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/link.d.ts.map b/node_modules/apollo-link/lib/link.d.ts.map deleted file mode 100644 index 47cf776f..00000000 --- a/node_modules/apollo-link/lib/link.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["src/link.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EACL,cAAc,EACd,QAAQ,EACR,SAAS,EACT,cAAc,EACd,WAAW,EACZ,MAAM,SAAS,CAAC;AAkBjB,wBAAgB,KAAK,IAAI,UAAU,CAElC;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU,CAGpD;AAED,wBAAgB,KAAK,CACnB,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,EAChC,IAAI,EAAE,UAAU,GAAG,cAAc,EACjC,KAAK,CAAC,EAAE,UAAU,GAAG,cAAc,GAClC,UAAU,CAiBZ;AAGD,eAAO,MAAM,MAAM,yFAiClB,CAAC;AAEF,qBAAa,UAAU;IACrB,OAAc,KAAK,eAAS;IAC5B,OAAc,IAAI,cAAQ;IAC1B,OAAc,KAAK,eAAS;IAC5B,OAAc,OAAO,iBAAW;gBAEpB,OAAO,CAAC,EAAE,cAAc;IAI7B,KAAK,CACV,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,EAChC,IAAI,EAAE,UAAU,GAAG,cAAc,EACjC,KAAK,CAAC,EAAE,UAAU,GAAG,cAAc,GAClC,UAAU;IAIN,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,UAAU;IAIrD,OAAO,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,QAAQ,GACjB,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI;CAGlC;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,cAAc,GACxB,UAAU,CAAC,WAAW,CAAC,CASzB"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/link.js b/node_modules/apollo-link/lib/link.js deleted file mode 100644 index 561886f1..00000000 --- a/node_modules/apollo-link/lib/link.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts")); -var ts_invariant_1 = require("ts-invariant"); -var linkUtils_1 = require("./linkUtils"); -function passthrough(op, forward) { - return forward ? forward(op) : zen_observable_ts_1.default.of(); -} -function toLink(handler) { - return typeof handler === 'function' ? new ApolloLink(handler) : handler; -} -function empty() { - return new ApolloLink(function () { return zen_observable_ts_1.default.of(); }); -} -exports.empty = empty; -function from(links) { - if (links.length === 0) - return empty(); - return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); -} -exports.from = from; -function split(test, left, right) { - var leftLink = toLink(left); - var rightLink = toLink(right || new ApolloLink(passthrough)); - if (linkUtils_1.isTerminating(leftLink) && linkUtils_1.isTerminating(rightLink)) { - return new ApolloLink(function (operation) { - return test(operation) - ? leftLink.request(operation) || zen_observable_ts_1.default.of() - : rightLink.request(operation) || zen_observable_ts_1.default.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return test(operation) - ? leftLink.request(operation, forward) || zen_observable_ts_1.default.of() - : rightLink.request(operation, forward) || zen_observable_ts_1.default.of(); - }); - } -} -exports.split = split; -exports.concat = function (first, second) { - var firstLink = toLink(first); - if (linkUtils_1.isTerminating(firstLink)) { - ts_invariant_1.invariant.warn(new linkUtils_1.LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); - return firstLink; - } - var nextLink = toLink(second); - if (linkUtils_1.isTerminating(nextLink)) { - return new ApolloLink(function (operation) { - return firstLink.request(operation, function (op) { return nextLink.request(op) || zen_observable_ts_1.default.of(); }) || zen_observable_ts_1.default.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return (firstLink.request(operation, function (op) { - return nextLink.request(op, forward) || zen_observable_ts_1.default.of(); - }) || zen_observable_ts_1.default.of()); - }); - } -}; -var ApolloLink = (function () { - function ApolloLink(request) { - if (request) - this.request = request; - } - ApolloLink.prototype.split = function (test, left, right) { - return this.concat(split(test, left, right || new ApolloLink(passthrough))); - }; - ApolloLink.prototype.concat = function (next) { - return exports.concat(this, next); - }; - ApolloLink.prototype.request = function (operation, forward) { - throw new ts_invariant_1.InvariantError('request is not implemented'); - }; - ApolloLink.empty = empty; - ApolloLink.from = from; - ApolloLink.split = split; - ApolloLink.execute = execute; - return ApolloLink; -}()); -exports.ApolloLink = ApolloLink; -function execute(link, operation) { - return (link.request(linkUtils_1.createOperation(operation.context, linkUtils_1.transformOperation(linkUtils_1.validateOperation(operation)))) || zen_observable_ts_1.default.of()); -} -exports.execute = execute; -//# sourceMappingURL=link.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/link.js.map b/node_modules/apollo-link/lib/link.js.map deleted file mode 100644 index 7e94f976..00000000 --- a/node_modules/apollo-link/lib/link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link.js","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":";;;AAAA,gFAA2C;AAC3C,6CAAyD;AAUzD,yCAMqB;AAErB,SAAS,WAAW,CAAC,EAAE,EAAE,OAAO;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,2BAAU,CAAC,EAAE,EAAE,CAAC;AACjD,CAAC;AAED,SAAS,MAAM,CAAC,OAAoC;IAClD,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC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AC,OAAO,GAAG,OAAO,CAAC;IACtC,CAAC;IAEM,0BAAK,GAAZ,UACE,IAAgC,EAChC,IAAiC,EACjC,KAAmC;QAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;IAEM,2BAAM,GAAb,UAAc,IAAiC;QAC7C,OAAO,cAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEM,4BAAO,GAAd,UACE,SAAoB,EACpB,OAAkB;QAElB,MAAM,IAAI,6BAAc,CAAC,4BAA4B,CAAC,CAAC;IACzD,CAAC;IA1Ba,gBAAK,GAAG,KAAK,CAAC;IACd,eAAI,GAAG,IAAI,CAAC;IACZ,gBAAK,GAAG,KAAK,CAAC;IACd,kBAAO,GAAG,OAAO,CAAC;IAwBlC,iBAAC;CAAA,AA5BD,IA4BC;AA5BY,gCAAU;AA8BvB,SAAgB,OAAO,CACrB,IAAgB,EAChB,SAAyB;IAEzB,OAAO,CACL,IAAI,CAAC,OAAO,CACV,2BAAe,CACb,SAAS,CAAC,OAAO,EACjB,8BAAkB,CAAC,6BAAiB,CAAC,SAAS,CAAC,CAAC,CACjD,CACF,IAAI,2BAAU,CAAC,EAAE,EAAE,CACrB,CAAC;AACJ,CAAC;AAZD,0BAYC"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/linkUtils.d.ts b/node_modules/apollo-link/lib/linkUtils.d.ts deleted file mode 100644 index 1e6a36a1..00000000 --- a/node_modules/apollo-link/lib/linkUtils.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import Observable from 'zen-observable-ts'; -import { GraphQLRequest, Operation } from './types'; -import { ApolloLink } from './link'; -import { getOperationName } from 'apollo-utilities'; -export { getOperationName }; -export declare function validateOperation(operation: GraphQLRequest): GraphQLRequest; -export declare class LinkError extends Error { - link: ApolloLink; - constructor(message?: string, link?: ApolloLink); -} -export declare function isTerminating(link: ApolloLink): boolean; -export declare function toPromise(observable: Observable): Promise; -export declare const makePromise: typeof toPromise; -export declare function fromPromise(promise: Promise): Observable; -export declare function fromError(errorValue: any): Observable; -export declare function transformOperation(operation: GraphQLRequest): GraphQLRequest; -export declare function createOperation(starting: any, operation: GraphQLRequest): Operation; -export declare function getKey(operation: GraphQLRequest): string; -//# sourceMappingURL=linkUtils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/linkUtils.d.ts.map b/node_modules/apollo-link/lib/linkUtils.d.ts.map deleted file mode 100644 index 39109a3b..00000000 --- a/node_modules/apollo-link/lib/linkUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"linkUtils.d.ts","sourceRoot":"","sources":["src/linkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAe3E;AAED,qBAAa,SAAU,SAAQ,KAAK;IAC3B,IAAI,EAAE,UAAU,CAAC;gBACZ,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU;CAIhD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEvD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBlE;AAGD,eAAO,MAAM,WAAW,kBAAY,CAAC;AAErC,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CASjE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAI3D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAiB5E;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,GAAG,EACb,SAAS,EAAE,cAAc,GACxB,SAAS,CA2BX;AAED,wBAAgB,MAAM,CAAC,SAAS,EAAE,cAAc,UAK/C"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/linkUtils.js b/node_modules/apollo-link/lib/linkUtils.js deleted file mode 100644 index be68bd30..00000000 --- a/node_modules/apollo-link/lib/linkUtils.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts")); -var apollo_utilities_1 = require("apollo-utilities"); -exports.getOperationName = apollo_utilities_1.getOperationName; -var ts_invariant_1 = require("ts-invariant"); -function validateOperation(operation) { - var OPERATION_FIELDS = [ - 'query', - 'operationName', - 'variables', - 'extensions', - 'context', - ]; - for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { - var key = _a[_i]; - if (OPERATION_FIELDS.indexOf(key) < 0) { - throw new ts_invariant_1.InvariantError("illegal argument: " + key); - } - } - return operation; -} -exports.validateOperation = validateOperation; -var LinkError = (function (_super) { - tslib_1.__extends(LinkError, _super); - function LinkError(message, link) { - var _this = _super.call(this, message) || this; - _this.link = link; - return _this; - } - return LinkError; -}(Error)); -exports.LinkError = LinkError; -function isTerminating(link) { - return link.request.length <= 1; -} -exports.isTerminating = isTerminating; -function toPromise(observable) { - var completed = false; - return new Promise(function (resolve, reject) { - observable.subscribe({ - next: function (data) { - if (completed) { - ts_invariant_1.invariant.warn("Promise Wrapper does not support multiple results from Observable"); - } - else { - completed = true; - resolve(data); - } - }, - error: reject, - }); - }); -} -exports.toPromise = toPromise; -exports.makePromise = toPromise; -function fromPromise(promise) { - return new zen_observable_ts_1.default(function (observer) { - promise - .then(function (value) { - observer.next(value); - observer.complete(); - }) - .catch(observer.error.bind(observer)); - }); -} -exports.fromPromise = fromPromise; -function fromError(errorValue) { - return new zen_observable_ts_1.default(function (observer) { - observer.error(errorValue); - }); -} -exports.fromError = fromError; -function transformOperation(operation) { - var transformedOperation = { - variables: operation.variables || {}, - extensions: operation.extensions || {}, - operationName: operation.operationName, - query: operation.query, - }; - if (!transformedOperation.operationName) { - transformedOperation.operationName = - typeof transformedOperation.query !== 'string' - ? apollo_utilities_1.getOperationName(transformedOperation.query) - : ''; - } - return transformedOperation; -} -exports.transformOperation = transformOperation; -function createOperation(starting, operation) { - var context = tslib_1.__assign({}, starting); - var setContext = function (next) { - if (typeof next === 'function') { - context = tslib_1.__assign({}, context, next(context)); - } - else { - context = tslib_1.__assign({}, context, next); - } - }; - var getContext = function () { return (tslib_1.__assign({}, context)); }; - Object.defineProperty(operation, 'setContext', { - enumerable: false, - value: setContext, - }); - Object.defineProperty(operation, 'getContext', { - enumerable: false, - value: getContext, - }); - Object.defineProperty(operation, 'toKey', { - enumerable: false, - value: function () { return getKey(operation); }, - }); - return operation; -} -exports.createOperation = createOperation; -function getKey(operation) { - var query = operation.query, variables = operation.variables, operationName = operation.operationName; - return JSON.stringify([operationName, query, variables]); -} -exports.getKey = getKey; -//# sourceMappingURL=linkUtils.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/linkUtils.js.map b/node_modules/apollo-link/lib/linkUtils.js.map deleted file mode 100644 index aabc1507..00000000 --- a/node_modules/apollo-link/lib/linkUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"linkUtils.js","sourceRoot":"","sources":["../src/linkUtils.ts"],"names":[],"mappings":";;;AAAA,gFAA2C;AAK3C,qDAAoD;AAE3C,2BAFA,mCAAgB,CAEA;AADzB,6CAAyD;A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B,OAAO,wBAAQ,OAAO,EAAK,IAAI,CAAC,OAAO,CAAC,CAAE,CAAC;SAC5C;aAAM;YACL,OAAO,wBAAQ,OAAO,EAAK,IAAI,CAAE,CAAC;SACnC;IACH,CAAC,CAAC;IACF,IAAM,UAAU,GAAG,cAAM,OAAA,sBAAM,OAAO,EAAG,EAAhB,CAAgB,CAAC;IAE1C,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE;QAC7C,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE;QAC7C,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE;QACxC,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,cAAM,OAAA,MAAM,CAAC,SAAS,CAAC,EAAjB,CAAiB;KAC/B,CAAC,CAAC;IAEH,OAAO,SAAsB,CAAC;AAChC,CAAC;AA9BD,0CA8BC;AAED,SAAgB,MAAM,CAAC,SAAyB;IAGtC,IAAA,uBAAK,EAAE,+BAAS,EAAE,uCAAa,CAAe;IACtD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAC3D,CAAC;AALD,wBAKC"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils.d.ts b/node_modules/apollo-link/lib/test-utils.d.ts deleted file mode 100644 index 22bdc7aa..00000000 --- a/node_modules/apollo-link/lib/test-utils.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import MockLink from './test-utils/mockLink'; -import SetContextLink from './test-utils/setContext'; -export * from './test-utils/testingUtils'; -export { MockLink, SetContextLink }; -//# sourceMappingURL=test-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils.d.ts.map b/node_modules/apollo-link/lib/test-utils.d.ts.map deleted file mode 100644 index f337f9d2..00000000 --- a/node_modules/apollo-link/lib/test-utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["src/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils.js b/node_modules/apollo-link/lib/test-utils.js deleted file mode 100644 index feecc92e..00000000 --- a/node_modules/apollo-link/lib/test-utils.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var mockLink_1 = tslib_1.__importDefault(require("./test-utils/mockLink")); -exports.MockLink = mockLink_1.default; -var setContext_1 = tslib_1.__importDefault(require("./test-utils/setContext")); -exports.SetContextLink = setContext_1.default; -tslib_1.__exportStar(require("./test-utils/testingUtils"), exports); -//# sourceMappingURL=test-utils.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils.js.map b/node_modules/apollo-link/lib/test-utils.js.map deleted file mode 100644 index ea03f9fc..00000000 --- a/node_modules/apollo-link/lib/test-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":";;;AAAA,2EAA6C;AAIpC,mBAJF,kBAAQ,CAIE;AAHjB,+EAAqD;AAGlC,yBAHZ,oBAAc,CAGY;AAFjC,oEAA0C"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/mockLink.d.ts b/node_modules/apollo-link/lib/test-utils/mockLink.d.ts deleted file mode 100644 index 6fce8ea5..00000000 --- a/node_modules/apollo-link/lib/test-utils/mockLink.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Operation, RequestHandler, NextLink, FetchResult } from '../types'; -import Observable from 'zen-observable-ts'; -import { ApolloLink } from '../link'; -export default class MockLink extends ApolloLink { - constructor(handleRequest?: RequestHandler); - request(operation: Operation, forward?: NextLink): Observable | null; -} -//# sourceMappingURL=mockLink.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/mockLink.d.ts.map b/node_modules/apollo-link/lib/test-utils/mockLink.d.ts.map deleted file mode 100644 index 91d303fc..00000000 --- a/node_modules/apollo-link/lib/test-utils/mockLink.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mockLink.d.ts","sourceRoot":"","sources":["../src/test-utils/mockLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;gBAClC,aAAa,GAAE,cAA2B;IAK/C,OAAO,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,QAAQ,GACjB,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI;CAGlC"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/mockLink.js b/node_modules/apollo-link/lib/test-utils/mockLink.js deleted file mode 100644 index 166c100d..00000000 --- a/node_modules/apollo-link/lib/test-utils/mockLink.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var link_1 = require("../link"); -var MockLink = (function (_super) { - tslib_1.__extends(MockLink, _super); - function MockLink(handleRequest) { - if (handleRequest === void 0) { handleRequest = function () { return null; }; } - var _this = _super.call(this) || this; - _this.request = handleRequest; - return _this; - } - MockLink.prototype.request = function (operation, forward) { - throw Error('should be overridden'); - }; - return MockLink; -}(link_1.ApolloLink)); -exports.default = MockLink; -//# sourceMappingURL=mockLink.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/mockLink.js.map b/node_modules/apollo-link/lib/test-utils/mockLink.js.map deleted file mode 100644 index 24bed603..00000000 --- a/node_modules/apollo-link/lib/test-utils/mockLink.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mockLink.js","sourceRoot":"","sources":["../../src/test-utils/mockLink.ts"],"names":[],"mappings":";;;AAIA,gCAAqC;AAErC;IAAsC,oCAAU;IAC9C,kBAAY,aAA0C;QAA1C,8BAAA,EAAA,8BAAsC,OAAA,IAAI,EAAJ,CAAI;QAAtD,YACE,iBAAO,SAER;QADC,KAAI,CAAC,OAAO,GAAG,aAAa,CAAC;;IAC/B,CAAC;IAEM,0BAAO,GAAd,UACE,SAAoB,EACpB,OAAkB;QAElB,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;IACH,eAAC;AAAD,CAAC,AAZD,CAAsC,iBAAU,GAY/C"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/setContext.d.ts b/node_modules/apollo-link/lib/test-utils/setContext.d.ts deleted file mode 100644 index 0d0d0185..00000000 --- a/node_modules/apollo-link/lib/test-utils/setContext.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Operation, NextLink, FetchResult } from '../types'; -import Observable from 'zen-observable-ts'; -import { ApolloLink } from '../link'; -export default class SetContextLink extends ApolloLink { - private setContext; - constructor(setContext?: (context: Record) => Record); - request(operation: Operation, forward: NextLink): Observable; -} -//# sourceMappingURL=setContext.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/setContext.d.ts.map b/node_modules/apollo-link/lib/test-utils/setContext.d.ts.map deleted file mode 100644 index 5ead8791..00000000 --- a/node_modules/apollo-link/lib/test-utils/setContext.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"setContext.d.ts","sourceRoot":"","sources":["../src/test-utils/setContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5D,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU;IAElD,OAAO,CAAC,UAAU;gBAAV,UAAU,GAAE,CAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KACzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAU;IAK5B,OAAO,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,QAAQ,GAChB,UAAU,CAAC,WAAW,CAAC;CAI3B"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/setContext.js b/node_modules/apollo-link/lib/test-utils/setContext.js deleted file mode 100644 index 0f382ecc..00000000 --- a/node_modules/apollo-link/lib/test-utils/setContext.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var link_1 = require("../link"); -var SetContextLink = (function (_super) { - tslib_1.__extends(SetContextLink, _super); - function SetContextLink(setContext) { - if (setContext === void 0) { setContext = function (c) { return c; }; } - var _this = _super.call(this) || this; - _this.setContext = setContext; - return _this; - } - SetContextLink.prototype.request = function (operation, forward) { - operation.setContext(this.setContext(operation.getContext())); - return forward(operation); - }; - return SetContextLink; -}(link_1.ApolloLink)); -exports.default = SetContextLink; -//# sourceMappingURL=setContext.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/setContext.js.map b/node_modules/apollo-link/lib/test-utils/setContext.js.map deleted file mode 100644 index 29d313a2..00000000 --- a/node_modules/apollo-link/lib/test-utils/setContext.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"setContext.js","sourceRoot":"","sources":["../../src/test-utils/setContext.ts"],"names":[],"mappings":";;;AAIA,gCAAqC;AAErC;IAA4C,0CAAU;IACpD,wBACU,UAEyB;QAFzB,2BAAA,EAAA,uBAEmB,CAAC,IAAI,OAAA,CAAC,EAAD,CAAC;QAHnC,YAKE,iBAAO,SACR;QALS,gBAAU,GAAV,UAAU,CAEe;;IAGnC,CAAC;IAEM,gCAAO,GAAd,UACE,SAAoB,EACpB,OAAiB;QAEjB,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QAC9D,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IACH,qBAAC;AAAD,CAAC,AAhBD,CAA4C,iBAAU,GAgBrD"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/testingUtils.d.ts b/node_modules/apollo-link/lib/test-utils/testingUtils.d.ts deleted file mode 100644 index 79542b66..00000000 --- a/node_modules/apollo-link/lib/test-utils/testingUtils.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApolloLink } from '../link'; -export declare function checkCalls(calls: any[], results: Array): void; -export interface TestResultType { - link: ApolloLink; - results?: any[]; - query?: string; - done?: () => void; - context?: any; - variables?: any; -} -export declare function testLinkResults(params: TestResultType): void; -//# sourceMappingURL=testingUtils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/testingUtils.d.ts.map b/node_modules/apollo-link/lib/test-utils/testingUtils.d.ts.map deleted file mode 100644 index 0e0cfa64..00000000 --- a/node_modules/apollo-link/lib/test-utils/testingUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testingUtils.d.ts","sourceRoot":"","sources":["../src/test-utils/testingUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,UAAU,EAAE,MAAM,SAAS,CAAC;AAU9C,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,QAGjE;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,QAuBrD"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/testingUtils.js b/node_modules/apollo-link/lib/test-utils/testingUtils.js deleted file mode 100644 index 694489be..00000000 --- a/node_modules/apollo-link/lib/test-utils/testingUtils.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag")); -var link_1 = require("../link"); -var sampleQuery = graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n query SampleQuery {\n stub {\n id\n }\n }\n"], ["\n query SampleQuery {\n stub {\n id\n }\n }\n"]))); -function checkCalls(calls, results) { - if (calls === void 0) { calls = []; } - expect(calls.length).toBe(results.length); - calls.map(function (call, i) { return expect(call.data).toEqual(results[i]); }); -} -exports.checkCalls = checkCalls; -function testLinkResults(params) { - var link = params.link, context = params.context, variables = params.variables; - var results = params.results || []; - var query = params.query || sampleQuery; - var done = params.done || (function () { return void 0; }); - var spy = jest.fn(); - link_1.execute(link, { query: query, context: context, variables: variables }).subscribe({ - next: spy, - error: function (error) { - expect(error).toEqual(results.pop()); - checkCalls(spy.mock.calls[0], results); - if (done) { - done(); - } - }, - complete: function () { - checkCalls(spy.mock.calls[0], results); - if (done) { - done(); - } - }, - }); -} -exports.testLinkResults = testLinkResults; -var templateObject_1; -//# sourceMappingURL=testingUtils.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/test-utils/testingUtils.js.map b/node_modules/apollo-link/lib/test-utils/testingUtils.js.map deleted file mode 100644 index 94130d9f..00000000 --- a/node_modules/apollo-link/lib/test-utils/testingUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testingUtils.js","sourceRoot":"","sources":["../../src/test-utils/testingUtils.ts"],"names":[],"mappings":";;;AAAA,oEAA8B;AAC9B,gCAA8C;AAE9C,IAAM,WAAW,GAAG,qBAAG,wIAAA,6DAMtB,IAAA,CAAC;AAEF,SAAgB,UAAU,CAAI,KAAiB,EAAE,OAAiB;IAApC,sBAAA,EAAA,UAAiB;IAC7C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,CAAC,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAArC,CAAqC,CAAC,CAAC;AAChE,CAAC;AAHD,gCAGC;AAWD,SAAgB,eAAe,CAAC,MAAsB;IAC5C,IAAA,kBAAI,EAAE,wBAAO,EAAE,4BAAS,CAAY;IAC5C,IAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,WAAW,CAAC;IAC1C,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,cAAM,OAAA,KAAK,CAAC,EAAN,CAAM,CAAC,CAAC;IAE3C,IAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IACtB,cAAO,CAAC,IAAI,EAAE,EAAE,KAAK,OAAA,EAAE,OAAO,SAAA,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC,SAAS,CAAC;QACrD,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,UAAA,KAAK;YACV,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACrC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACvC,IAAI,IAAI,EAAE;gBACR,IAAI,EAAE,CAAC;aACR;QACH,CAAC;QACD,QAAQ,EAAE;YACR,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACvC,IAAI,IAAI,EAAE;gBACR,IAAI,EAAE,CAAC;aACR;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAvBD,0CAuBC"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/types.d.ts b/node_modules/apollo-link/lib/types.d.ts deleted file mode 100644 index 723ae971..00000000 --- a/node_modules/apollo-link/lib/types.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import Observable from 'zen-observable-ts'; -import { DocumentNode } from 'graphql/language/ast'; -import { ExecutionResult as GraphQLExecutionResult } from 'graphql'; -export { DocumentNode }; -export interface ExecutionResult extends GraphQLExecutionResult { - data?: TData | null; -} -export interface GraphQLRequest { - query: DocumentNode; - variables?: Record; - operationName?: string; - context?: Record; - extensions?: Record; -} -export interface Operation { - query: DocumentNode; - variables: Record; - operationName: string; - extensions: Record; - setContext: (context: Record) => Record; - getContext: () => Record; - toKey: () => string; -} -export declare type FetchResult, E = Record> = ExecutionResult & { - extensions?: E; - context?: C; -}; -export declare type NextLink = (operation: Operation) => Observable; -export declare type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/types.d.ts.map b/node_modules/apollo-link/lib/types.d.ts.map deleted file mode 100644 index 64b6a642..00000000 --- a/node_modules/apollo-link/lib/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"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M,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACrB,eAAe,CAAC,KAAK,CAAC,GAAG;IAC3B,UAAU,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,CAAC;CACb,CAAC;AAEF,oBAAY,QAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,KAAK,UAAU,CAAC,WAAW,CAAC,CAAC;AACzE,oBAAY,cAAc,GAAG,CAC3B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,QAAQ,KACd,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-link/lib/types.js b/node_modules/apollo-link/lib/types.js deleted file mode 100644 index 11e638d1..00000000 --- a/node_modules/apollo-link/lib/types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/apollo-link/lib/types.js.map b/node_modules/apollo-link/lib/types.js.map deleted file mode 100644 index c768b790..00000000 --- a/node_modules/apollo-link/lib/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/apollo-link/package.json b/node_modules/apollo-link/package.json deleted file mode 100644 index 08527b92..00000000 --- a/node_modules/apollo-link/package.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "_from": "apollo-link@latest", - "_id": "apollo-link@1.2.14", - "_inBundle": false, - "_integrity": "sha512-p67CMEFP7kOG1JZ0ZkYZwRDa369w5PIjtMjvrQd/HnIV8FRsHRqLqK+oAZQnFa1DDdZtOtHTi+aMIW6EatC2jg==", - "_location": "/apollo-link", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "apollo-link@latest", - "name": "apollo-link", - "escapedName": "apollo-link", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/", - "/apollo-client", - "/apollo-link-ws" - ], - "_resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.14.tgz", - "_shasum": "3feda4b47f9ebba7f4160bef8b977ba725b684d9", - "_spec": "apollo-link@latest", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Evans Hauser", - "email": "evanshauser@gmail.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-link/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "jon wong", - "email": "j@jnwng.com" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - } - ], - "dependencies": { - "apollo-utilities": "^1.3.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.9.3", - "zen-observable-ts": "^0.8.21" - }, - "deprecated": false, - "description": "Flexible, lightweight transport layer for GraphQL", - "devDependencies": { - "@types/graphql": "14.2.3", - "@types/jest": "24.9.0", - "@types/node": "9.6.55", - "graphql": "15.0.0", - "graphql-tag": "2.10.1", - "jest": "24.9.0", - "rimraf": "2.7.1", - "rollup": "1.29.1", - "ts-jest": "22.4.6", - "tslint": "5.20.1", - "typescript": "3.0.3" - }, - "gitHead": "1012934b4fd9ab436c4fdcd5e9b1bb1e4c1b0d98", - "homepage": "https://github.com/apollographql/apollo-link#readme", - "jest": { - "transform": { - ".(ts|tsx)": "ts-jest" - }, - "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ], - "testURL": "http://localhost" - }, - "license": "MIT", - "main": "./lib/index.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-link", - "peerDependencies": { - "graphql": "^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-link.git" - }, - "scripts": { - "build": "tsc && rollup -c", - "clean": "rimraf lib/* && rimraf coverage/*", - "coverage": "jest --coverage", - "filesize": "../../scripts/minify", - "lint": "tslint -c \"../../tslint.json\" -p tsconfig.json -c ../../tslint.json src/*.ts", - "prebuild": "npm run clean", - "prepare": "npm run build", - "test": "npm run lint && jest", - "watch": "tsc -w -p . & rollup -c -w" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.2.14" -} diff --git a/node_modules/apollo-utilities/.flowconfig b/node_modules/apollo-utilities/.flowconfig deleted file mode 100644 index ffa2101c..00000000 --- a/node_modules/apollo-utilities/.flowconfig +++ /dev/null @@ -1,8 +0,0 @@ -[ignore] - -[include] - -[libs] - -[options] -suppress_comment= \\(.\\|\n\\)*\\$ExpectError diff --git a/node_modules/apollo-utilities/CHANGELOG.md b/node_modules/apollo-utilities/CHANGELOG.md deleted file mode 100644 index 2cabb608..00000000 --- a/node_modules/apollo-utilities/CHANGELOG.md +++ /dev/null @@ -1,106 +0,0 @@ -# CHANGELOG - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md). - ----- - -### 1.0.16 - -- Removed unnecessary whitespace from error message - [Issue #3398](https://github.com/apollographql/apollo-client/issues/3398) - [PR #3593](https://github.com/apollographql/apollo-client/pull/3593) - -### 1.0.15 - -- No changes - -### 1.0.14 - -- Store key names generated by `getStoreKeyName` now leverage a more - deterministic approach to handling JSON based strings. This prevents store - key names from differing when using `args` like - `{ prop1: 'value1', prop2: 'value2' }` and - `{ prop2: 'value2', prop1: 'value1' }`. - [PR #2869](https://github.com/apollographql/apollo-client/pull/2869) -- Avoid needless `hasOwnProperty` check in `deepFreeze`. - [PR #3545](https://github.com/apollographql/apollo-client/pull/3545) - -### 1.0.13 - -- Make `maybeDeepFreeze` a little more defensive, by always using - `Object.prototype.hasOwnProperty` (to avoid cases where the object being - frozen doesn't have its own `hasOwnProperty`). - [Issue #3426](https://github.com/apollographql/apollo-client/issues/3426) - [PR #3418](https://github.com/apollographql/apollo-client/pull/3418) -- Remove certain small internal caches to prevent memory leaks when using SSR. - [PR #3444](https://github.com/apollographql/apollo-client/pull/3444) - -### 1.0.12 - -- Not documented - -### 1.0.11 - -- `toIdValue` helper now takes an object with `id` and `typename` properties - as the preferred interface - [PR #3159](https://github.com/apollographql/apollo-client/pull/3159) -- Map coverage to original source -- Don't `deepFreeze` in development/test environments if ES6 symbols are - polyfilled - [PR #3082](https://github.com/apollographql/apollo-client/pull/3082) -- Added ability to include or ignore fragments in `getDirectivesFromDocument` - [PR #3010](https://github.com/apollographql/apollo-client/pull/3010) - -### 1.0.9 - -- Dependency updates -- Added getDirectivesFromDocument utility function - [PR #2974](https://github.com/apollographql/apollo-client/pull/2974) - -### 1.0.8 - -- Add client, rest, and export directives to list of known directives - [PR #2949](https://github.com/apollographql/apollo-client/pull/2949) - -### 1.0.7 - -- Fix typo in error message for invalid argument being passed to @skip or - @include directives - [PR #2867](https://github.com/apollographql/apollo-client/pull/2867) - -### 1.0.6 - -- Update `getStoreKeyName` to support custom directives - -### 1.0.5 - -- Package dependency updates - -### 1.0.4 - -- Package dependency updates - -### 1.0.3 - -- Package dependency updates - -### 1.0.2 - -- Improved rollup builds - -### 1.0.1 - -- Added config to remove selection set of directive matches test - -### 1.0.0 - -- Added utilities from hermes cache -- Added removeDirectivesFromDocument to allow cleaning of client only - directives -- Added hasDirectives to recurse the AST and return a boolean for an array of - directive names -- Improved performance of common store actions by memoizing addTypename and - removeConnectionDirective diff --git a/node_modules/apollo-utilities/LICENSE b/node_modules/apollo-utilities/LICENSE deleted file mode 100644 index 278ee9d8..00000000 --- a/node_modules/apollo-utilities/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/apollo-utilities/jest.config.js b/node_modules/apollo-utilities/jest.config.js deleted file mode 100644 index 48f0a891..00000000 --- a/node_modules/apollo-utilities/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require('../../config/jest.config.settings'), -}; diff --git a/node_modules/apollo-utilities/lib/bundle.cjs.js b/node_modules/apollo-utilities/lib/bundle.cjs.js deleted file mode 100644 index 49d9f007..00000000 --- a/node_modules/apollo-utilities/lib/bundle.cjs.js +++ /dev/null @@ -1,1125 +0,0 @@ -exports.__esModule = true; -exports.addTypenameToDocument = addTypenameToDocument; -exports.argumentsObjectFromField = argumentsObjectFromField; -exports.assign = assign; -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -exports.checkDocument = checkDocument; -exports.cloneDeep = cloneDeep; -exports.createFragmentMap = createFragmentMap; -exports.getDefaultValues = getDefaultValues; -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -exports.getDirectiveNames = getDirectiveNames; -exports.getDirectivesFromDocument = getDirectivesFromDocument; -exports.getEnv = getEnv; -exports.getFragmentDefinition = getFragmentDefinition; -exports.getFragmentDefinitions = getFragmentDefinitions; -exports.getFragmentQueryDocument = getFragmentQueryDocument; -exports.getInclusionDirectives = getInclusionDirectives; -exports.getMainDefinition = getMainDefinition; -exports.getMutationDefinition = getMutationDefinition; -exports.getOperationDefinition = getOperationDefinition; -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -exports.getOperationName = getOperationName; -exports.getQueryDefinition = getQueryDefinition; -exports.getStoreKeyName = getStoreKeyName; -exports.graphQLResultHasError = graphQLResultHasError; -exports.hasClientExports = hasClientExports; -exports.hasDirectives = hasDirectives; -exports.isDevelopment = isDevelopment; -exports.isEnv = isEnv; -exports.isField = isField; -exports.isIdValue = isIdValue; -exports.isInlineFragment = isInlineFragment; -exports.isJsonValue = isJsonValue; -exports.isNumberValue = isNumberValue; -exports.isProduction = isProduction; -exports.isScalarValue = isScalarValue; -exports.isTest = isTest; -exports.maybeDeepFreeze = maybeDeepFreeze; -exports.mergeDeep = mergeDeep; -exports.mergeDeepArray = mergeDeepArray; -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -exports.resultKeyNameFromField = resultKeyNameFromField; -exports.shouldInclude = shouldInclude; -exports.storeKeyNameFromField = storeKeyNameFromField; -exports.stripSymbols = stripSymbols; -exports.toIdValue = toIdValue; -exports.tryFunctionOrLogError = tryFunctionOrLogError; -exports.valueFromNode = valueFromNode; -exports.valueToObjectRepresentation = valueToObjectRepresentation; -exports.variablesInOperation = variablesInOperation; -exports.warnOnceInDevelopment = warnOnceInDevelopment; -exports.canUseWeakMap = exports.isEqual = void 0; - -var _visitor = require("graphql/language/visitor"); - -var _tsInvariant = require("ts-invariant"); - -var _tslib = require("tslib"); - -var _fastJsonStableStringify = _interopRequireDefault(require("fast-json-stable-stringify")); - -var _equality = require("@wry/equality"); - -exports.isEqual = _equality.equal; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value) { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value) { - return value.kind === 'IntValue'; -} - -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} - -function isVariable(value) { - return value.kind === 'Variable'; -} - -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} - -function isListValue(value) { - return value.kind === 'ListValue'; -} - -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} - -function isNullValue(value) { - return value.kind === 'NullValue'; -} - -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } -} - -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - -function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; -} - -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; -} - -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} - -function isField(selection) { - return selection.kind === 'Field'; -} - -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} - -function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; -} - -function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); -} - -function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; -} - -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); -} - -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; -} - -function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; -} - -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); -} - -function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); -} - -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} - -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; -} - -function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} - -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} - -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; -} - -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; -} - -function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; -} - -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); -} - -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} - -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} - -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} - -function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} - -function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; -} - -function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } -}; - -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); -} - -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; -} - -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; -} - -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; -} - -function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); -} - -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } -}; - -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} - -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); -} - -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); -} - -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); -} - -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; -} - -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); -} - -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); -} - -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} - -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; -} - -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); -exports.canUseWeakMap = canUseWeakMap; -var toString = Object.prototype.toString; - -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; -} - -function isEnv(env) { - return getEnv() === env; -} - -function isProduction() { - return isEnv('production') === true; -} - -function isDevelopment() { - return isEnv('development') === true; -} - -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} - -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); -} - -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; -} - -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; -} - -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; -} - -var haveWarned = Object.create({}); - -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-utilities/lib/bundle.cjs.js.map b/node_modules/apollo-utilities/lib/bundle.cjs.js.map deleted file mode 100644 index a445ea6f..00000000 --- a/node_modules/apollo-utilities/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAiDgB,a,CAAc,K,EAAgB;AAC5C,SAAO,CAAC,aAAD,EAAgB,cAAhB,EAAgC,WAAhC,EAA6C,OAA7C,CAAqD,KAAK,CAAC,IAA3D,IAAmE,CAAC,CAA3E;AACD;;AAID,SAAgB,aAAhB,CAA8B,KAA9B,EAA8C;AAC5C,SAAO,CAAC,UAAD,EAAa,YAAb,EAA2B,OAA3B,CAAmC,KAAK,CAAC,IAAzC,IAAiD,CAAC,CAAzD;AACD;;AAED,SAAS,aAAT,CAAuB,KAAvB,EAAuC;AACrC,SAAO,KAAK,CAAC,IAAN,KAAe,aAAtB;AACD;;AAED,SAAS,cAAT,CAAwB,KAAxB,EAAwC;AACtC,SAAO,KAAK,CAAC,IAAN,KAAe,cAAtB;AACD;;AAED,SAAS,UAAT,CAAoB,KAApB,EAAoC;AAClC,SAAO,KAAK,CAAC,IAAN,KAAe,UAAtB;AACD;;AAED,SAAS,YAAT,CAAsB,KAAtB,EAAsC;AACpC,SAAO,KAAK,CAAC,IAAN,KAAe,YAAtB;AAC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B;AADR,OAAA,EAEA,KAFA,CAAL;AAID;;AACD,IAAA,UAAU,CAAC,IAAX,CAAgB,KAAhB;AACD;;AACD,SAAO,KAAP;AACD;;AChHD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAP,CAAc,EAAd,CAAnB;;AAUA,SAAgB,qBAAhB,CAAsC,GAAtC,EAAmD,IAAnD,EAAgE;AAAb,MAAA,IAAA,KAAA,KAAA,CAAA,EAAA;AAAA,IAAA,IAAA,GAAA,MAAA;AAAa;;AAC9D,MAAI,CAAC,YAAY,EAAb,IAAmB,CAAC,UAAU,CAAC,GAAD,CAAlC,EAAyC;AACvC,QAAI,CAAC,MAAM,EAAX,EAAe;AACb,MAAA,UAAU,CAAC,GAAD,CAAV,GAAkB,IAAlB;AACD;;AACD,QAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,MAAA,OAAO,CAAC,KAAR,CAAc,GAAd;AACD,KAFD,MAEO;AACL,MAAA,OAAO,CAAC,IAAR,CAAa,GAAb;AACD;AACF;AACF;;SCZe,Y,CAAgB,I,EAAO;AACrC,SAAO,IAAI,CAAC,KAAL,CAAW,IAAI,CAAC,SAAL,CAAe,IAAf,CAAX,CAAP;AACD,C","sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/bundle.cjs.min.js b/node_modules/apollo-utilities/lib/bundle.cjs.min.js deleted file mode 100644 index a7ed4e22..00000000 --- a/node_modules/apollo-utilities/lib/bundle.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -exports.__esModule=!0,exports.addTypenameToDocument=function(e){return(0,n.visit)(y(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var i=e.selections;if(i){var o=i.some(function(e){return f(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))});if(!o){var a=t;if(!(f(a)&&a.directives&&a.directives.some(function(e){return"export"===e.name.value})))return(0,r.__assign)((0,r.__assign)({},e),{selections:(0,r.__spreadArrays)(i,[_])})}}}}}})},exports.argumentsObjectFromField=s,exports.assign=x,exports.buildQueryFromSelectionSet=function(e){if("query"===k(e).operation)return e;return(0,n.visit)(e,{OperationDefinition:{enter:function(e){return(0,r.__assign)((0,r.__assign)({},e),{operation:"query"})}}})},exports.checkDocument=y,exports.cloneDeep=function(e){return function e(n,t){switch(M.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach(function(n,i){r[i]=e(n,t)}),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach(function(r){i[r]=e(n[r],t)}),i;default:return n}}(e,new Map)},exports.createFragmentMap=O,exports.getDefaultValues=function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){var n=e.defaultValue;return n}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return a(r,n.name,t),r});return x.apply(void 0,(0,r.__spreadArrays)([{}],n))}return{}},exports.getDirectiveInfoFromField=function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=s(e,n)}),t}return null},exports.getDirectiveNames=m,exports.getDirectivesFromDocument=function(e,t){var i;return y(t),E((0,n.visit)(t,{SelectionSet:{enter:function(n,t,o,a){var u=a.join("-");if(!i||u===i||!u.startsWith(i)){if(n.selections){var c=n.selections.filter(function(n){return I(e,n)});return w(e,n,!1)&&(i=u),(0,r.__assign)((0,r.__assign)({},n),{selections:c})}return null}}}}))},exports.getEnv=J,exports.getFragmentDefinition=D,exports.getFragmentDefinitions=b,exports.getFragmentQueryDocument=function(e,n){var i=n,o=[];e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(11);"FragmentDefinition"===e.kind&&o.push(e)}),void 0===i&&((0,t.invariant)(1===o.length,12),i=o[0].name.value);return(0,r.__assign)((0,r.__assign)({},e),{definitions:(0,r.__spreadArrays)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],e.definitions)})},exports.getInclusionDirectives=g,exports.getMainDefinition=k,exports.getMutationDefinition=function(e){y(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return(0,t.invariant)(n,1),n},exports.getOperationDefinition=h,exports.getOperationDefinitionOrDie=function(e){var n=h(e);return(0,t.invariant)(n,5),n},exports.getOperationName=function(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null},exports.getQueryDefinition=function(e){var n=h(e);return(0,t.invariant)(n&&"query"===n.operation,6),n},exports.getStoreKeyName=c,exports.graphQLResultHasError=function(e){return e.errors&&e.errors.length},exports.hasClientExports=function(e){return e&&p(["client"],e)&&p(["export"],e)},exports.hasDirectives=p,exports.isDevelopment=Q,exports.isEnv=P,exports.isField=f,exports.isIdValue=function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},exports.isInlineFragment=l,exports.isJsonValue=function(e){return null!=e&&"object"==typeof e&&"json"===e.type},exports.isNumberValue=function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},exports.isProduction=L,exports.isScalarValue=function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},exports.isTest=T,exports.maybeDeepFreeze=function(e){if(Q()||T()){var n="function"==typeof Symbol&&"string"==typeof Symbol("");if(!n)return function e(n){Object.freeze(n);Object.getOwnPropertyNames(n).forEach(function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])});return n}(e)}return e},exports.mergeDeep=function(){for(var e=[],n=0;n0){var r=t.connection.filter?t.connection.filter:[];r.sort();var o=n,a={};return r.forEach(function(e){a[e]=o[e]}),t.connection.key+"("+JSON.stringify(a)+")"}return t.connection.key}var c=e;if(n){var s=(0,i.default)(n);c+="("+s+")"}return t&&Object.keys(t).forEach(function(e){-1===u.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?c+="@"+e+"("+JSON.stringify(t[e])+")":c+="@"+e)}),c}function s(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return a(t,r,i,n)}),t}return null}function f(e){return"Field"===e.kind}function l(e){return"InlineFragment"===e.kind}function v(e){throw new t.InvariantError(18)}function m(e){var t=[];return(0,n.visit)(e,{Directive:function(e){t.push(e.name.value)}}),t}function p(e,n){return m(n).some(function(n){return e.indexOf(n)>-1})}function d(e){var n=e.name.value;return"skip"===n||"include"===n}function g(e){return e?e.filter(d).map(function(e){var n=e.arguments;e.name.value;(0,t.invariant)(n&&1===n.length,14);var r=n[0];(0,t.invariant)(r.name&&"if"===r.name.value,15);var i=r.value;return(0,t.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),16),{directive:e,ifArgument:r}}):[]}function x(e){for(var n=[],t=1;t1){var r=[];n=K(n,r);for(var i=1;i -1; -} -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw process.env.NODE_ENV === "production" ? new InvariantError(17) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = stringify(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -function isField(selection) { - return selection.kind === 'Field'; -} -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return __assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new InvariantError(18) : new InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} - -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 13) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -function getDirectiveNames(doc) { - var names = []; - visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 14) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 15) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(11) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 12) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = __assign(__assign({}, document), { definitions: __spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} - -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} - -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? invariant(mutationDef, 1) : invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -function checkDocument(doc) { - process.env.NODE_ENV === "production" ? invariant(doc && doc.kind === 'Document', 2) : invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new InvariantError(3) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 4) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? invariant(def, 5) : invariant(def, "GraphQL document is missing an operation"); - return def; -} -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 6) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 7) : invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? invariant(doc.definitions.length <= 1, 8) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 9) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw process.env.NODE_ENV === "production" ? new InvariantError(10) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, __spreadArrays([{}], defaultValues)); - } - return {}; -} -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} - -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -function addTypenameToDocument(doc) { - return visit(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return __assign(__assign({}, node), { selections: __spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - process.env.NODE_ENV === "production" || invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); -} -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return __assign(__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visit(doc, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visit(document, { - OperationDefinition: { - enter: function (node) { - return __assign(__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} - -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); - -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} - -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -function isEnv(env) { - return getEnv() === env; -} -function isProduction() { - return isEnv('production') === true; -} -function isDevelopment() { - return isEnv('development') === true; -} -function isTest() { - return isEnv('test') === true; -} - -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} - -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = __assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} - -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} - -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} - -export { addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getInclusionDirectives, getMainDefinition, getMutationDefinition, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getQueryDefinition, getStoreKeyName, graphQLResultHasError, hasClientExports, hasDirectives, isDevelopment, isEnv, isField, isIdValue, isInlineFragment, isJsonValue, isNumberValue, isProduction, isScalarValue, isTest, maybeDeepFreeze, mergeDeep, mergeDeepArray, removeArgumentsFromDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, removeDirectivesFromDocument, removeFragmentSpreadFromDocument, resultKeyNameFromField, shouldInclude, storeKeyNameFromField, stripSymbols, toIdValue, tryFunctionOrLogError, valueFromNode, valueToObjectRepresentation, variablesInOperation, warnOnceInDevelopment }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/apollo-utilities/lib/bundle.esm.js.map b/node_modules/apollo-utilities/lib/bundle.esm.js.map deleted file mode 100644 index 20578090..00000000 --- a/node_modules/apollo-utilities/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"],"names":[],"mappings":";;;;;;SAiDgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9E;AAID,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5D;AAED,SAAS,aAAa,CAAC,KAAgB;IACrC,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;CACrC;AAED,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;CACtC;AAED,SAAS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AAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;CACF;;SCZe,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;CACzC;;;;"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/bundle.umd.js b/node_modules/apollo-utilities/lib/bundle.umd.js deleted file mode 100644 index 4c8a17bb..00000000 --- a/node_modules/apollo-utilities/lib/bundle.umd.js +++ /dev/null @@ -1,1131 +0,0 @@ -(function (global, factory) { - if (typeof define === "function" && define.amd) { - define(["exports", "graphql/language/visitor", "ts-invariant", "tslib", "fast-json-stable-stringify", "@wry/equality"], factory); - } else if (typeof exports !== "undefined") { - factory(exports, require("graphql/language/visitor"), require("ts-invariant"), require("tslib"), require("fast-json-stable-stringify"), require("@wry/equality")); - } else { - var mod = { - exports: {} - }; - factory(mod.exports, global.visitor, global.tsInvariant, global.tslib, global.fastJsonStableStringify, global.equality); - global.unknown = mod.exports; - } -})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _visitor, _tsInvariant, _tslib, _fastJsonStableStringify, _equality) { - - _exports.__esModule = true; - _exports.addTypenameToDocument = addTypenameToDocument; - _exports.argumentsObjectFromField = argumentsObjectFromField; - _exports.assign = assign; - _exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; - _exports.checkDocument = checkDocument; - _exports.cloneDeep = cloneDeep; - _exports.createFragmentMap = createFragmentMap; - _exports.getDefaultValues = getDefaultValues; - _exports.getDirectiveInfoFromField = getDirectiveInfoFromField; - _exports.getDirectiveNames = getDirectiveNames; - _exports.getDirectivesFromDocument = getDirectivesFromDocument; - _exports.getEnv = getEnv; - _exports.getFragmentDefinition = getFragmentDefinition; - _exports.getFragmentDefinitions = getFragmentDefinitions; - _exports.getFragmentQueryDocument = getFragmentQueryDocument; - _exports.getInclusionDirectives = getInclusionDirectives; - _exports.getMainDefinition = getMainDefinition; - _exports.getMutationDefinition = getMutationDefinition; - _exports.getOperationDefinition = getOperationDefinition; - _exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; - _exports.getOperationName = getOperationName; - _exports.getQueryDefinition = getQueryDefinition; - _exports.getStoreKeyName = getStoreKeyName; - _exports.graphQLResultHasError = graphQLResultHasError; - _exports.hasClientExports = hasClientExports; - _exports.hasDirectives = hasDirectives; - _exports.isDevelopment = isDevelopment; - _exports.isEnv = isEnv; - _exports.isField = isField; - _exports.isIdValue = isIdValue; - _exports.isInlineFragment = isInlineFragment; - _exports.isJsonValue = isJsonValue; - _exports.isNumberValue = isNumberValue; - _exports.isProduction = isProduction; - _exports.isScalarValue = isScalarValue; - _exports.isTest = isTest; - _exports.maybeDeepFreeze = maybeDeepFreeze; - _exports.mergeDeep = mergeDeep; - _exports.mergeDeepArray = mergeDeepArray; - _exports.removeArgumentsFromDocument = removeArgumentsFromDocument; - _exports.removeClientSetsFromDocument = removeClientSetsFromDocument; - _exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; - _exports.removeDirectivesFromDocument = removeDirectivesFromDocument; - _exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; - _exports.resultKeyNameFromField = resultKeyNameFromField; - _exports.shouldInclude = shouldInclude; - _exports.storeKeyNameFromField = storeKeyNameFromField; - _exports.stripSymbols = stripSymbols; - _exports.toIdValue = toIdValue; - _exports.tryFunctionOrLogError = tryFunctionOrLogError; - _exports.valueFromNode = valueFromNode; - _exports.valueToObjectRepresentation = valueToObjectRepresentation; - _exports.variablesInOperation = variablesInOperation; - _exports.warnOnceInDevelopment = warnOnceInDevelopment; - _exports.canUseWeakMap = _exports.isEqual = void 0; - _fastJsonStableStringify = _interopRequireDefault(_fastJsonStableStringify); - _exports.isEqual = _equality.equal; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; - } - - function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; - } - - function isStringValue(value) { - return value.kind === 'StringValue'; - } - - function isBooleanValue(value) { - return value.kind === 'BooleanValue'; - } - - function isIntValue(value) { - return value.kind === 'IntValue'; - } - - function isFloatValue(value) { - return value.kind === 'FloatValue'; - } - - function isVariable(value) { - return value.kind === 'Variable'; - } - - function isObjectValue(value) { - return value.kind === 'ObjectValue'; - } - - function isListValue(value) { - return value.kind === 'ListValue'; - } - - function isEnumValue(value) { - return value.kind === 'EnumValue'; - } - - function isNullValue(value) { - return value.kind === 'NullValue'; - } - - function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(17) : new _tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); - } - } - - function storeKeyNameFromField(field, variables) { - var directivesObj = null; - - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - - var argObj = null; - - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); - } - - var KNOWN_DIRECTIVES = ['connection', 'include', 'skip', 'client', 'rest', 'export']; - - function getStoreKeyName(fieldName, args, directives) { - if (directives && directives['connection'] && directives['connection']['key']) { - if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } else { - return directives['connection']['key']; - } - } - - var completeFieldName = fieldName; - - if (args) { - var stringifiedArgs = (0, _fastJsonStableStringify.default)(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } else { - completeFieldName += "@" + key; - } - }); - } - - return completeFieldName; - } - - function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, - value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - - return null; - } - - function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; - } - - function isField(selection) { - return selection.kind === 'Field'; - } - - function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; - } - - function isIdValue(idObject) { - return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; - } - - function toIdValue(idConfig, generated) { - if (generated === void 0) { - generated = false; - } - - return (0, _tslib.__assign)({ - type: 'id', - generated: generated - }, typeof idConfig === 'string' ? { - id: idConfig, - typename: undefined - } : idConfig); - } - - function isJsonValue(jsonObject) { - return jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'; - } - - function defaultValueFromVariable(node) { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(18) : new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode"); - } - - function valueFromNode(node, onVariable) { - if (onVariable === void 0) { - onVariable = defaultValueFromVariable; - } - - switch (node.kind) { - case 'Variable': - return onVariable(node); - - case 'NullValue': - return null; - - case 'IntValue': - return parseInt(node.value, 10); - - case 'FloatValue': - return parseFloat(node.value); - - case 'ListValue': - return node.values.map(function (v) { - return valueFromNode(v, onVariable); - }); - - case 'ObjectValue': - { - var value = {}; - - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - - return value; - } - - default: - return node.value; - } - } - - function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - - return null; - } - - function shouldInclude(selection, variables) { - if (variables === void 0) { - variables = {}; - } - - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, - ifArgument = _a.ifArgument; - var evaledValue = false; - - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(evaledValue !== void 0, 13) : (0, _tsInvariant.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } else { - evaledValue = ifArgument.value.value; - } - - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); - } - - function getDirectiveNames(doc) { - var names = []; - (0, _visitor.visit)(doc, { - Directive: function (node) { - names.push(node.name.value); - } - }); - return names; - } - - function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { - return names.indexOf(name) > -1; - }); - } - - function hasClientExports(document) { - return document && hasDirectives(['client'], document) && hasDirectives(['export'], document); - } - - function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; - } - - function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, 14) : (0, _tsInvariant.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', 15) : (0, _tsInvariant.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 16) : (0, _tsInvariant.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { - directive: directive, - ifArgument: ifArgument - }; - }) : []; - } - - function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(11) : new _tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - if (typeof actualFragmentName === 'undefined') { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragments.length === 1, 12) : (0, _tsInvariant.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - - var query = (0, _tslib.__assign)((0, _tslib.__assign)({}, document), { - definitions: (0, _tslib.__spreadArrays)([{ - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [{ - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName - } - }] - } - }], document.definitions) - }); - return query; - } - - function assign(target) { - var sources = []; - - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; - } - - function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; - })[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(mutationDef, 1) : (0, _tsInvariant.invariant)(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; - } - - function checkDocument(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', 2) : (0, _tsInvariant.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions.filter(function (d) { - return d.kind !== 'FragmentDefinition'; - }).map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(3) : new _tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - - return definition; - }); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(operations.length <= 1, 4) : (0, _tsInvariant.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; - } - - function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition'; - })[0]; - } - - function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(def, 5) : (0, _tsInvariant.invariant)(def, "GraphQL document is missing an operation"); - return def; - } - - function getOperationName(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }).map(function (x) { - return x.name.value; - })[0] || null; - } - - function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { - return definition.kind === 'FragmentDefinition'; - }); - } - - function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 6) : (0, _tsInvariant.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; - } - - function getFragmentDefinition(doc) { - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.kind === 'Document', 7) : (0, _tsInvariant.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 8) : (0, _tsInvariant.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 9) : (0, _tsInvariant.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; - } - - function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - - if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { - return definition; - } - } - - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw process.env.NODE_ENV === "production" ? new _tsInvariant.InvariantError(10) : new _tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); - } - - function createFragmentMap(fragments) { - if (fragments === void 0) { - fragments = []; - } - - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; - } - - function getDefaultValues(definition) { - if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions.filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }).map(function (_a) { - var variable = _a.variable, - defaultValue = _a.defaultValue; - var defaultValueObj = {}; - valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign.apply(void 0, (0, _tslib.__spreadArrays)([{}], defaultValues)); - } - - return {}; - } - - function variablesInOperation(operation) { - var names = new Set(); - - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - - return names; - } - - function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; - } - - var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename' - } - }; - - function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); - }); - } - - function nullIfDocIsEmpty(doc) { - return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; - } - - function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return dir.name && dir.name === directive.name.value || dir.test && dir.test(directive); - }); - }; - } - - function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0, _visitor.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - } - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { - return directive.remove; - }); - - if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value - }); - } - }); - } - - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value - }); - }); - } - - return null; - } - } - } - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - } - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - } - } - })); - - if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { - return !variablesInUse[v.name]; - }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { - return !fragmentSpreadsInUse[fs.name]; - }).length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - - return modifiedDoc; - } - - function addTypenameToDocument(doc) { - return (0, _visitor.visit)(checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && parent.kind === 'OperationDefinition') { - return; - } - - var selections = node.selections; - - if (!selections) { - return; - } - - var skip = selections.some(function (selection) { - return isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0); - }); - - if (skip) { - return; - } - - var field = parent; - - if (isField(field) && field.directives && field.directives.some(function (d) { - return d.name.value === 'export'; - })) { - return; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: (0, _tslib.__spreadArrays)(selections, [TYPENAME_FIELD]) - }); - } - } - }); - } - - var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - - if (willRemove) { - if (!directive.arguments || !directive.arguments.some(function (arg) { - return arg.name.value === 'key'; - })) { - process.env.NODE_ENV === "production" || _tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); - } - } - - return willRemove; - } - }; - - function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); - } - - function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - return selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - }); - } - - function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { - nestedCheck = true; - } - - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return selection.directives.some(getDirectiveMatcher(directives)) || nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck); - } - - function getDirectivesFromDocument(directives, doc) { - checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - - if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { - return hasDirectivesInSelection(directives, selection); - }); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - selections: selectionsWithDirectives - }); - } else { - return null; - } - } - } - } - })); - } - - function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || aConfig.test && aConfig.test(argument)); - }); - }; - } - - function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { - return arg.name === varDef.variable.name.value; - }); - }) - }); - } - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { - return argConfig.remove; - }); - - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - - if (argMatchCount_1 === 1) { - return null; - } - } - } - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - } - } - })); - } - - function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { - return def.name === node.name.value; - })) { - return null; - } - } - - return nullIfDocIsEmpty((0, _visitor.visit)(doc, { - FragmentSpread: { - enter: enter - }, - FragmentDefinition: { - enter: enter - } - })); - } - - function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { - return allFragments.push(frag); - }); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; - } - - function buildQueryFromSelectionSet(document) { - var definition = getMainDefinition(document); - var definitionOperation = definition.operation; - - if (definitionOperation === 'query') { - return document; - } - - var modifiedDoc = (0, _visitor.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, node), { - operation: 'query' - }); - } - } - }); - return modifiedDoc; - } - - function removeClientSetsFromDocument(document) { - checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([{ - test: function (directive) { - return directive.name.value === 'client'; - }, - remove: true - }], document); - - if (modifiedDoc) { - modifiedDoc = (0, _visitor.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return isField(selection) && selection.name.value === '__typename'; - }); - - if (isTypenameOnly) { - return null; - } - } - } - } - }); - } - - return modifiedDoc; - } - - var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); - _exports.canUseWeakMap = canUseWeakMap; - var toString = Object.prototype.toString; - - function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); - } - - function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": - { - if (seen.has(val)) return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - - case "[object Object]": - { - if (seen.has(val)) return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - - default: - return val; - } - } - - function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - return 'development'; - } - - function isEnv(env) { - return getEnv() === env; - } - - function isProduction() { - return isEnv('production') === true; - } - - function isDevelopment() { - return isEnv('development') === true; - } - - function isTest() { - return isEnv('test') === true; - } - - function tryFunctionOrLogError(f) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } - } - - function graphQLResultHasError(result) { - return result.errors && result.errors.length; - } - - function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; - } - - function maybeDeepFreeze(obj) { - if (isDevelopment() || isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - - return obj; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function mergeDeep() { - var sources = []; - - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - - return mergeDeepArray(sources); - } - - function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - - return target; - } - - function isObject(obj) { - return obj !== null && typeof obj === 'object'; - } - - function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - - return source; - } - - function shallowCopyForMerge(value, pastCopies) { - if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } else { - value = (0, _tslib.__assign)({ - __proto__: Object.getPrototypeOf(value) - }, value); - } - - pastCopies.push(value); - } - - return value; - } - - var haveWarned = Object.create({}); - - function warnOnceInDevelopment(msg, type) { - if (type === void 0) { - type = 'warn'; - } - - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } - } - - function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); - } - -}); diff --git a/node_modules/apollo-utilities/lib/bundle.umd.js.map b/node_modules/apollo-utilities/lib/bundle.umd.js.map deleted file mode 100644 index e69270f6..00000000 --- a/node_modules/apollo-utilities/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/storeUtils.ts","../src/directives.ts","../src/fragments.ts","../src/util/assign.ts","../src/getFromAST.ts","../src/util/filterInPlace.ts","../src/transform.ts","../src/util/canUse.ts","../src/util/cloneDeep.ts","../src/util/environment.ts","../src/util/errorHandling.ts","../src/util/maybeDeepFreeze.ts","../src/util/mergeDeep.ts","../src/util/warnOnce.ts","../src/util/stripSymbols.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiDgB,a,CAAc,K,EAAgB;AAC5C,WAAO,CAAC,aAAD,EAAgB,cAAhB,EAAgC,WAAhC,EAA6C,OAA7C,CAAqD,KAAK,CAAC,IAA3D,IAAmE,CAAC,CAA3E;AACD;;AAID,WAAgB,aAAhB,CAA8B,KAA9B,EAA8C;AAC5C,WAAO,CAAC,UAAD,EAAa,YAAb,EAA2B,OAA3B,CAAmC,KAAK,CAAC,IAAzC,IAAiD,CAAC,CAAzD;AACD;;AAED,WAAS,aAAT,CAAuB,KAAvB,EAAuC;AACrC,WAAO,KAAK,CAAC,IAAN,KAAe,aAAtB;AACD;;AAED,WAAS,cAAT,CAAwB,KAAxB,EAAwC;AACtC,WAAO,KAAK,CAAC,IAAN,KAAe,cAAtB;AACD;;AAED,WAAS,UAAT,CAAoB,KAApB,EAAoC;AAClC,WAAO,KAAK,CAAC,IAAN,KAAe,UAAtB;AACD;;AAED,WAAS,YAAT,CAAsB,KAAtB,EAAsC;AACpC,WAAO,KAAK,CAAC,IAAN,KAAe,YAAtB;AACD;;AAED,WAAS,UAAT,CAAoB,KA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tB;AADR,SAAA,EAEA,KAFA,CAAL;AAID;;AACD,MAAA,UAAU,CAAC,IAAX,CAAgB,KAAhB;AACD;;AACD,WAAO,KAAP;AACD;;AChHD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAP,CAAc,EAAd,CAAnB;;AAUA,WAAgB,qBAAhB,CAAsC,GAAtC,EAAmD,IAAnD,EAAgE;AAAb,QAAA,IAAA,KAAA,KAAA,CAAA,EAAA;AAAA,MAAA,IAAA,GAAA,MAAA;AAAa;;AAC9D,QAAI,CAAC,YAAY,EAAb,IAAmB,CAAC,UAAU,CAAC,GAAD,CAAlC,EAAyC;AACvC,UAAI,CAAC,MAAM,EAAX,EAAe;AACb,QAAA,UAAU,CAAC,GAAD,CAAV,GAAkB,IAAlB;AACD;;AACD,UAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,QAAA,OAAO,CAAC,KAAR,CAAc,GAAd;AACD,OAFD,MAEO;AACL,QAAA,OAAO,CAAC,IAAR,CAAa,GAAb;AACD;AACF;AACF;;WCZe,Y,CAAgB,I,EAAO;AACrC,WAAO,IAAI,CAAC,KAAL,CAAW,IAAI,CAAC,SAAL,CAAe,IAAf,CAAX,CAAP;AACD,G","sourcesContent":["import {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n} from 'graphql';\n\nimport stringify from 'fast-json-stable-stringify';\nimport { InvariantError } from 'ts-invariant';\n\nexport interface IdValue {\n type: 'id';\n id: string;\n generated: boolean;\n typename: string | undefined;\n}\n\nexport interface JsonValue {\n type: 'json';\n json: any;\n}\n\nexport type ListValue = Array;\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | IdValue\n | ListValue\n | JsonValue\n | null\n | undefined\n | void\n | Object;\n\nexport type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;\n\nexport function isScalarValue(value: ValueNode): value is ScalarValue {\n return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1;\n}\n\nexport type NumberValue = IntValueNode | FloatValueNode;\n\nexport function isNumberValue(value: ValueNode): value is NumberValue {\n return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1;\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === 'StringValue';\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === 'BooleanValue';\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === 'IntValue';\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === 'FloatValue';\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === 'Variable';\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === 'ObjectValue';\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === 'ListValue';\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === 'EnumValue';\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === 'NullValue';\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object,\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map(obj =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables),\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map(listValue => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables,\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw new InvariantError(\n `The inline argument \"${name.value}\" of kind \"${(value as any).kind}\"` +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.',\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object,\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(directive => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables,\n ),\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\n\nexport function getStoreKeyName(\n fieldName: string,\n args?: Object,\n directives?: Directives,\n): string {\n if (\n directives &&\n directives['connection'] &&\n directives['connection']['key']\n ) {\n if (\n directives['connection']['filter'] &&\n (directives['connection']['filter'] as string[]).length > 0\n ) {\n const filterKeys = directives['connection']['filter']\n ? (directives['connection']['filter'] as string[])\n : [];\n filterKeys.sort();\n\n const queryArgs = args as { [key: string]: any };\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach(key => {\n filteredArgs[key] = queryArgs[key];\n });\n\n return `${directives['connection']['key']}(${JSON.stringify(\n filteredArgs,\n )})`;\n } else {\n return directives['connection']['key'];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = stringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach(key => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${JSON.stringify(directives[key])})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n}\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables: Object,\n): Object {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables),\n );\n return argObj;\n }\n\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === 'Field';\n}\n\nexport function isInlineFragment(\n selection: SelectionNode,\n): selection is InlineFragmentNode {\n return selection.kind === 'InlineFragment';\n}\n\nexport function isIdValue(idObject: StoreValue): idObject is IdValue {\n return idObject &&\n (idObject as IdValue | JsonValue).type === 'id' &&\n typeof (idObject as IdValue).generated === 'boolean';\n}\n\nexport type IdConfig = {\n id: string;\n typename: string | undefined;\n};\n\nexport function toIdValue(\n idConfig: string | IdConfig,\n generated = false,\n): IdValue {\n return {\n type: 'id',\n generated,\n ...(typeof idConfig === 'string'\n ? { id: idConfig, typename: undefined }\n : idConfig),\n };\n}\n\nexport function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue {\n return (\n jsonObject != null &&\n typeof jsonObject === 'object' &&\n (jsonObject as IdValue | JsonValue).type === 'json'\n );\n}\n\nfunction defaultValueFromVariable(node: VariableNode) {\n throw new InvariantError(`Variable nodes are not supported by valueFromNode`);\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n\n/**\n * Evaluate a ValueNode and yield its value in its natural JS form.\n */\nexport function valueFromNode(\n node: ValueNode,\n onVariable: VariableValue = defaultValueFromVariable,\n): any {\n switch (node.kind) {\n case 'Variable':\n return onVariable(node);\n case 'NullValue':\n return null;\n case 'IntValue':\n return parseInt(node.value, 10);\n case 'FloatValue':\n return parseFloat(node.value);\n case 'ListValue':\n return node.values.map(v => valueFromNode(v, onVariable));\n case 'ObjectValue': {\n const value: { [key: string]: any } = {};\n for (const field of node.fields) {\n value[field.name.value] = valueFromNode(field.value, onVariable);\n }\n return value;\n }\n default:\n return node.value;\n }\n}\n","// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport {\n FieldNode,\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n} from 'graphql';\n\nimport { visit } from 'graphql/language/visitor';\n\nimport { invariant } from 'ts-invariant';\n\nimport { argumentsObjectFromField } from './storeUtils';\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function getDirectiveInfoFromField(\n field: FieldNode,\n variables: Object,\n): DirectiveInfo {\n if (field.directives && field.directives.length) {\n const directiveObj: DirectiveInfo = {};\n field.directives.forEach((directive: DirectiveNode) => {\n directiveObj[directive.name.value] = argumentsObjectFromField(\n directive,\n variables,\n );\n });\n return directiveObj;\n }\n return null;\n}\n\nexport function shouldInclude(\n selection: SelectionNode,\n variables: { [name: string]: any } = {},\n): boolean {\n return getInclusionDirectives(\n selection.directives,\n ).every(({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @${directive.name.value} directive.`,\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\n\nexport function getDirectiveNames(doc: DocumentNode) {\n const names: string[] = [];\n\n visit(doc, {\n Directive(node) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport function hasDirectives(names: string[], doc: DocumentNode) {\n return getDirectiveNames(doc).some(\n (name: string) => names.indexOf(name) > -1,\n );\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return (\n document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document)\n );\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === 'skip' || value === 'include';\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray,\n): InclusionDirectives {\n return directives ? directives.filter(isInclusionDirective).map(directive => {\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @${directiveName} directive.`,\n );\n\n const ifArgument = directiveArguments[0];\n invariant(\n ifArgument.name && ifArgument.name.value === 'if',\n `Invalid argument for the @${directiveName} directive.`,\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),\n `Argument for the @${directiveName} directive must be a variable or a boolean value.`,\n );\n\n return { directive, ifArgument };\n }) : [];\n}\n\n","import { DocumentNode, FragmentDefinitionNode } from 'graphql';\nimport { invariant, InvariantError } from 'ts-invariant';\n\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string,\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach(definition => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === 'OperationDefinition') {\n throw new InvariantError(\n `Found a ${definition.operation} operation${\n definition.name ? ` named '${definition.name.value}'` : ''\n }. ` +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.',\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === 'undefined') {\n invariant(\n fragments.length === 1,\n `Found ${\n fragments.length\n } fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n","/**\n * Adds the properties of one or more source objects to a target object. Works exactly like\n * `Object.assign`, but as a utility to maintain support for IE 11.\n *\n * @see https://github.com/apollostack/apollo-client/pull/1009\n */\nexport function assign(a: A, b: B): A & B;\nexport function assign(a: A, b: B, c: C): A & B & C;\nexport function assign(a: A, b: B, c: C, d: D): A & B & C & D;\nexport function assign(\n a: A,\n b: B,\n c: C,\n d: D,\n e: E,\n): A & B & C & D & E;\nexport function assign(target: any, ...sources: Array): any;\nexport function assign(\n target: { [key: string]: any },\n ...sources: Array<{ [key: string]: any }>\n): { [key: string]: any } {\n sources.forEach(source => {\n if (typeof source === 'undefined' || source === null) {\n return;\n }\n Object.keys(source).forEach(key => {\n target[key] = source[key];\n });\n });\n return target;\n}\n","import {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from 'graphql';\n\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport { assign } from './util/assign';\n\nimport { valueToObjectRepresentation, JsonValue } from './storeUtils';\n\nexport function getMutationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode {\n checkDocument(doc);\n\n let mutationDef: OperationDefinitionNode | null = doc.definitions.filter(\n definition =>\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'mutation',\n )[0] as OperationDefinitionNode;\n\n invariant(mutationDef, 'Must contain a mutation definition.');\n\n return mutationDef;\n}\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n const operations = doc.definitions\n .filter(d => d.kind !== 'FragmentDefinition')\n .map(definition => {\n if (definition.kind !== 'OperationDefinition') {\n throw new InvariantError(\n `Schema type definitions not allowed in queries. Found: \"${\n definition.kind\n }\"`,\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains ${operations.length} operations`,\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode,\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n definition => definition.kind === 'OperationDefinition',\n )[0] as OperationDefinitionNode;\n}\n\nexport function getOperationDefinitionOrDie(\n document: DocumentNode,\n): OperationDefinitionNode {\n const def = getOperationDefinition(document);\n invariant(def, `GraphQL document is missing an operation`);\n return def;\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n definition =>\n definition.kind === 'OperationDefinition' && definition.name,\n )\n .map((x: OperationDefinitionNode) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode,\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n definition => definition.kind === 'FragmentDefinition',\n ) as FragmentDefinitionNode[];\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc) as OperationDefinitionNode;\n\n invariant(\n queryDef && queryDef.operation === 'query',\n 'Must contain a query definition.',\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode,\n): FragmentDefinitionNode {\n invariant(\n doc.kind === 'Document',\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`,\n );\n\n invariant(\n doc.definitions.length <= 1,\n 'Fragment must have exactly one definition.',\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === 'FragmentDefinition',\n 'Must be a fragment definition.',\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode,\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === 'OperationDefinition') {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription'\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw new InvariantError(\n 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.',\n );\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = [],\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach(fragment => {\n symTable[fragment.name.value] = fragment;\n });\n\n return symTable;\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined,\n): { [key: string]: JsonValue } {\n if (\n definition &&\n definition.variableDefinitions &&\n definition.variableDefinitions.length\n ) {\n const defaultValues = definition.variableDefinitions\n .filter(({ defaultValue }) => defaultValue)\n .map(\n ({ variable, defaultValue }): { [key: string]: JsonValue } => {\n const defaultValueObj: { [key: string]: JsonValue } = {};\n valueToObjectRepresentation(\n defaultValueObj,\n variable.name,\n defaultValue as ValueNode,\n );\n\n return defaultValueObj;\n },\n );\n\n return assign({}, ...defaultValues);\n }\n\n return {};\n}\n\n/**\n * Returns the names of all variables declared by the operation.\n */\nexport function variablesInOperation(\n operation: OperationDefinitionNode,\n): Set {\n const names = new Set();\n if (operation.variableDefinitions) {\n for (const definition of operation.variableDefinitions) {\n names.add(definition.variable.name.value);\n }\n }\n\n return names;\n}\n","export function filterInPlace(\n array: T[],\n test: (elem: T) => boolean,\n context?: any,\n): T[] {\n let target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n","import {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n VariableNode,\n} from 'graphql';\nimport { visit } from 'graphql/language/visitor';\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n createFragmentMap,\n FragmentMap,\n getMainDefinition,\n} from './getFromAST';\nimport { filterInPlace } from './util/filterInPlace';\nimport { invariant } from 'ts-invariant';\nimport { isField, isInlineFragment } from './storeUtils';\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig = RemoveNodeConfig<\n FragmentDefinitionNode\n>;\nexport type RemoveVariableDefinitionConfig = RemoveNodeConfig<\n VariableDefinitionNode\n>;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragments: FragmentMap,\n): boolean {\n return op.selectionSet.selections.every(\n selection =>\n selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments),\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc)),\n )\n ? null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],\n) {\n return function directiveMatcher(directive: DirectiveNode) {\n return directives.some(\n dir =>\n (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive)),\n );\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode | null {\n const variablesInUse: Record = Object.create(null);\n let variablesToRemove: RemoveArgumentsConfig[] = [];\n\n const fragmentSpreadsInUse: Record = Object.create(null);\n let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = [];\n\n let modifiedDoc = nullIfDocIsEmpty(\n visit(doc, {\n Variable: {\n enter(node, _key, parent) {\n // Store each variable that's referenced as part of an argument\n // (excluding operation definition variables), so we know which\n // variables are being used. If we later want to remove a variable\n // we'll fist check to see if it's being used, before continuing with\n // the removal.\n if (\n (parent as VariableDefinitionNode).kind !== 'VariableDefinition'\n ) {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n\n Field: {\n enter(node) {\n if (directives && node.directives) {\n // If `remove` is set to true for a directive, and a directive match\n // is found for a field, remove the field as well.\n const shouldRemoveField = directives.some(\n directive => directive.remove,\n );\n\n if (\n shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))\n ) {\n if (node.arguments) {\n // Store field argument variables so they can be removed\n // from the operation definition.\n node.arguments.forEach(arg => {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: (arg.value as VariableNode).name.value,\n });\n }\n });\n }\n\n if (node.selectionSet) {\n // Store fragment spread names so they can be removed from the\n // docuemnt.\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(\n frag => {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n },\n );\n }\n\n // Remove the field.\n return null;\n }\n }\n },\n },\n\n FragmentSpread: {\n enter(node) {\n // Keep track of referenced fragment spreads. This is used to\n // determine if top level fragment definitions should be removed.\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n\n Directive: {\n enter(node) {\n // If a matching directive is found, remove it.\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }),\n );\n\n // If we've removed fields with arguments, make sure the associated\n // variables are also removed from the rest of the document, as long as they\n // aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length\n ) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n\n // If we've removed selection sets with fragment spreads, make sure the\n // associated fragment definitions are also removed from the rest of the\n // document, as long as they aren't being used elsewhere.\n if (\n modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name])\n .length\n ) {\n modifiedDoc = removeFragmentSpreadFromDocument(\n fragmentSpreadsToRemove,\n modifiedDoc,\n );\n }\n\n return modifiedDoc;\n}\n\nexport function addTypenameToDocument(doc: DocumentNode): DocumentNode {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind === 'OperationDefinition'\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some(selection => {\n return (\n isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some(d => d.name.value === 'export')\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n}\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some(arg => arg.name.value === 'key')\n ) {\n invariant.warn(\n 'Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.',\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc),\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode,\n nestedCheck = true,\n): boolean {\n return (\n selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(selection =>\n hasDirectivesInSelection(directives, selection, nestedCheck),\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true,\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck,\n ))\n );\n}\n\nexport function getDirectivesFromDocument(\n directives: GetDirectiveConfig[],\n doc: DocumentNode,\n): DocumentNode {\n checkDocument(doc);\n\n let parentPath: string;\n\n return nullIfDocIsEmpty(\n visit(doc, {\n SelectionSet: {\n enter(node, _key, _parent, path) {\n const currentPath = path.join('-');\n\n if (\n !parentPath ||\n currentPath === parentPath ||\n !currentPath.startsWith(parentPath)\n ) {\n if (node.selections) {\n const selectionsWithDirectives = node.selections.filter(\n selection => hasDirectivesInSelection(directives, selection),\n );\n\n if (hasDirectivesInSelectionSet(directives, node, false)) {\n parentPath = currentPath;\n }\n\n return {\n ...node,\n selections: selectionsWithDirectives,\n };\n } else {\n return null;\n }\n }\n },\n },\n }),\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument))),\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode,\n): DocumentNode {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions.filter(\n varDef =>\n !config.some(arg => arg.name === varDef.variable.name.value),\n ),\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(argConfig => argConfig.remove);\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n node.arguments.forEach(arg => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }),\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode,\n): DocumentNode {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode,\n ): null | void {\n if (config.some(def => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n }),\n );\n}\n\nfunction getAllFragmentSpreadsFromSelectionSet(\n selectionSet: SelectionSetNode,\n): FragmentSpreadNode[] {\n const allFragments: FragmentSpreadNode[] = [];\n\n selectionSet.selections.forEach(selection => {\n if (\n (isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet\n ) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(\n frag => allFragments.push(frag),\n );\n } else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n\n return allFragments;\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode,\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === 'query') {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: 'query',\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode,\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === 'client',\n remove: true,\n },\n ],\n document,\n );\n\n // After a fragment definition has had its @client related document\n // sets removed, if the only field it has left is a __typename field,\n // remove the entire fragment operation to prevent it from being fired\n // on the server.\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter(node) {\n if (node.selectionSet) {\n const isTypenameOnly = node.selectionSet.selections.every(\n selection =>\n isField(selection) && selection.name.value === '__typename',\n );\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n\n return modifiedDoc;\n}\n","export const canUseWeakMap = typeof WeakMap === 'function' && !(\n typeof navigator === 'object' &&\n navigator.product === 'ReactNative'\n);\n","const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value, new Map());\n}\n\nfunction cloneDeepHelper(val: T, seen: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val).forEach(key => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n","export function getEnv(): string | undefined {\n if (typeof process !== 'undefined' && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n // default environment\n return 'development';\n}\n\nexport function isEnv(env: string): boolean {\n return getEnv() === env;\n}\n\nexport function isProduction(): boolean {\n return isEnv('production') === true;\n}\n\nexport function isDevelopment(): boolean {\n return isEnv('development') === true;\n}\n\nexport function isTest(): boolean {\n return isEnv('test') === true;\n}\n","import { ExecutionResult } from 'graphql';\n\nexport function tryFunctionOrLogError(f: Function) {\n try {\n return f();\n } catch (e) {\n if (console.error) {\n console.error(e);\n }\n }\n}\n\nexport function graphQLResultHasError(result: ExecutionResult) {\n return result.errors && result.errors.length;\n}\n","import { isDevelopment, isTest } from './environment';\n\n// Taken (mostly) from https://github.com/substack/deep-freeze to avoid\n// import hassles with rollup.\nfunction deepFreeze(o: any) {\n Object.freeze(o);\n\n Object.getOwnPropertyNames(o).forEach(function(prop) {\n if (\n o[prop] !== null &&\n (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&\n !Object.isFrozen(o[prop])\n ) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n}\n\nexport function maybeDeepFreeze(obj: any) {\n if (isDevelopment() || isTest()) {\n // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing\n // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043).\n const symbolIsPolyfilled =\n typeof Symbol === 'function' && typeof Symbol('') === 'string';\n\n if (!symbolIsPolyfilled) {\n return deepFreeze(obj);\n }\n }\n return obj;\n}\n","const { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A :\n T extends [infer A, infer B] ? A & B :\n T extends [infer A, infer B, infer C] ? A & B & C :\n T extends [infer A, infer B, infer C, infer D] ? A & B & C & D :\n T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E :\n T extends (infer U)[] ? U : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || {} as T;\n const count = sources.length;\n if (count > 1) {\n const pastCopies: any[] = [];\n target = shallowCopyForMerge(target, pastCopies);\n for (let i = 1; i < count; ++i) {\n target = mergeHelper(target, sources[i], pastCopies);\n }\n }\n return target;\n}\n\nfunction isObject(obj: any): obj is Record {\n return obj !== null && typeof obj === 'object';\n}\n\nfunction mergeHelper(\n target: any,\n source: any,\n pastCopies: any[],\n) {\n if (isObject(source) && isObject(target)) {\n // In case the target has been frozen, make an extensible copy so that\n // we can merge properties into the copy.\n if (Object.isExtensible && !Object.isExtensible(target)) {\n target = shallowCopyForMerge(target, pastCopies);\n }\n\n Object.keys(source).forEach(sourceKey => {\n const sourceValue = source[sourceKey];\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (sourceValue !== targetValue) {\n // When there is a key collision, we need to make a shallow copy of\n // target[sourceKey] so the merge does not modify any source objects.\n // To avoid making unnecessary copies, we use a simple array to track\n // past copies, since it's safe to modify copies created earlier in\n // the merge. We use an array for pastCopies instead of a Map or Set,\n // since the number of copies should be relatively small, and some\n // Map/Set polyfills modify their keys.\n target[sourceKey] = mergeHelper(\n shallowCopyForMerge(targetValue, pastCopies),\n sourceValue,\n pastCopies,\n );\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target[sourceKey] = sourceValue;\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n}\n\nfunction shallowCopyForMerge(value: T, pastCopies: any[]): T {\n if (\n value !== null &&\n typeof value === 'object' &&\n pastCopies.indexOf(value) < 0\n ) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n pastCopies.push(value);\n }\n return value;\n}\n","import { isProduction, isTest } from './environment';\n\nconst haveWarned = Object.create({});\n\n/**\n * Print a warning only once in development.\n * In production no warnings are printed.\n * In test all warnings are printed.\n *\n * @param msg The warning message\n * @param type warn or error (will call console.warn or console.error)\n */\nexport function warnOnceInDevelopment(msg: string, type = 'warn') {\n if (!isProduction() && !haveWarned[msg]) {\n if (!isTest()) {\n haveWarned[msg] = true;\n }\n if (type === 'error') {\n console.error(msg);\n } else {\n console.warn(msg);\n }\n }\n}\n","/**\n * In order to make assertions easier, this function strips `symbol`'s from\n * the incoming data.\n *\n * This can be handy when running tests against `apollo-client` for example,\n * since it adds `symbol`'s to the data in the store. Jest's `toEqual`\n * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437),\n * which means all test data used in a `toEqual` comparison would also have to\n * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data\n * we can compare against more simplified test data.\n */\nexport function stripSymbols(data: T): T {\n return JSON.parse(JSON.stringify(data));\n}\n"]} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/directives.d.ts b/node_modules/apollo-utilities/lib/directives.d.ts deleted file mode 100644 index ea10f218..00000000 --- a/node_modules/apollo-utilities/lib/directives.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { FieldNode, SelectionNode, DirectiveNode, DocumentNode, ArgumentNode } from 'graphql'; -export declare type DirectiveInfo = { - [fieldName: string]: { - [argName: string]: any; - }; -}; -export declare function getDirectiveInfoFromField(field: FieldNode, variables: Object): DirectiveInfo; -export declare function shouldInclude(selection: SelectionNode, variables?: { - [name: string]: any; -}): boolean; -export declare function getDirectiveNames(doc: DocumentNode): string[]; -export declare function hasDirectives(names: string[], doc: DocumentNode): boolean; -export declare function hasClientExports(document: DocumentNode): boolean; -export declare type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; -export declare function getInclusionDirectives(directives: ReadonlyArray): InclusionDirectives; -//# sourceMappingURL=directives.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/directives.d.ts.map b/node_modules/apollo-utilities/lib/directives.d.ts.map deleted file mode 100644 index 4da04b61..00000000 --- a/node_modules/apollo-utilities/lib/directives.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["src/directives.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,aAAa,EAGb,aAAa,EACb,YAAY,EACZ,YAAY,EAEb,MAAM,SAAS,CAAC;AAQjB,oBAAY,aAAa,GAAG;IAC1B,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,GAChB,aAAa,CAYf;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,aAAa,EACxB,SAAS,GAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAO,GACtC,OAAO,CAgBT;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,YAUlD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,YAAY,WAI/D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,WAMtD;AAED,oBAAY,mBAAmB,GAAG,KAAK,CAAC;IACtC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B,CAAC,CAAC;AAMH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,GACvC,mBAAmB,CA2BrB"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/directives.js b/node_modules/apollo-utilities/lib/directives.js deleted file mode 100644 index 41a8a9d4..00000000 --- a/node_modules/apollo-utilities/lib/directives.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var visitor_1 = require("graphql/language/visitor"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -function getDirectiveInfoFromField(field, variables) { - if (field.directives && field.directives.length) { - var directiveObj_1 = {}; - field.directives.forEach(function (directive) { - directiveObj_1[directive.name.value] = storeUtils_1.argumentsObjectFromField(directive, variables); - }); - return directiveObj_1; - } - return null; -} -exports.getDirectiveInfoFromField = getDirectiveInfoFromField; -function shouldInclude(selection, variables) { - if (variables === void 0) { variables = {}; } - return getInclusionDirectives(selection.directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[ifArgument.value.name.value]; - ts_invariant_1.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -exports.shouldInclude = shouldInclude; -function getDirectiveNames(doc) { - var names = []; - visitor_1.visit(doc, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -exports.getDirectiveNames = getDirectiveNames; -function hasDirectives(names, doc) { - return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); -} -exports.hasDirectives = hasDirectives; -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -exports.hasClientExports = hasClientExports; -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - return directives ? directives.filter(isInclusionDirective).map(function (directive) { - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - ts_invariant_1.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); - var ifArgument = directiveArguments[0]; - ts_invariant_1.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); - var ifValue = ifArgument.value; - ts_invariant_1.invariant(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); - return { directive: directive, ifArgument: ifArgument }; - }) : []; -} -exports.getInclusionDirectives = getInclusionDirectives; -//# sourceMappingURL=directives.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/directives.js.map b/node_modules/apollo-utilities/lib/directives.js.map deleted file mode 100644 index 915e07f2..00000000 --- a/node_modules/apollo-utilities/lib/directives.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;AAaA,oDAAiD;AAEjD,6CAAyC;AAEzC,2CAAwD;AAMxD,SAAgB,yBAAyB,CACvC,KAAgB,EAChB,SAAiB;IAEjB,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE;QAC/C,IAAM,cAAY,GAAkB,EAAE,CAAC;QACvC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAwB;YAChD,cAAY,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,qCAAwB,CAC3D,SAAS,EACT,SAAS,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,cAAY,CAAC;KACrB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAfD,8DAeC;AAED,SAAgB,aAAa,CAC3B,SAAwB,EACxB,SAAuC;IAAvC,0BAAA,EAAA,cAAuC;IAEvC,OAAO,sBAAsB,CAC3B,SAAS,CAAC,UAAU,CACrB,CAAC,KAAK,CAAC,UAAC,EAAyB;YAAvB,wBAAS,EAAE,0BAAU;QAC9B,IAAI,WAAW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BAAoB,CAAC,EAAkC;QAAxB,qBAAK;IAC3C,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,SAAgB,sBAAsB,CACpC,UAAwC;IAExC,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,UAAA,SAAS;QACvE,IAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS,CAAC;QAC/C,IAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;QAE3C,wBAAS,CACP,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EACrD,4CAA0C,aAAa,gBAAa,CACrE,CAAC;QAEF,IAAM,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACzC,wBAAS,CACP,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,EACjD,+BAA6B,aAAa,gBAAa,CACxD,CAAC;QAEF,IAAM,OAAO,GAAc,UAAU,CAAC,KAAK,CAAC;QAG5C,wBAAS,CACP,OAAO;YACL,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,EAClE,uBAAqB,aAAa,sDAAmD,CACtF,CAAC;QAEF,OAAO,EAAE,SAAS,WAAA,EAAE,UAAU,YAAA,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACV,CAAC;AA7BD,wDA6BC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/fragments.d.ts b/node_modules/apollo-utilities/lib/fragments.d.ts deleted file mode 100644 index 8b1f2312..00000000 --- a/node_modules/apollo-utilities/lib/fragments.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode; -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/fragments.d.ts.map b/node_modules/apollo-utilities/lib/fragments.d.ts.map deleted file mode 100644 index cbff38a8..00000000 --- a/node_modules/apollo-utilities/lib/fragments.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["src/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,SAAS,CAAC;AAyB/D,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,YAAY,CA+Dd"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/fragments.js b/node_modules/apollo-utilities/lib/fragments.js deleted file mode 100644 index 5b6e8f87..00000000 --- a/node_modules/apollo-utilities/lib/fragments.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - ts_invariant_1.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); - actualFragmentName = fragments[0].name.value; - } - var query = tslib_1.__assign(tslib_1.__assign({}, document), { definitions: tslib_1.__spreadArrays([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions) }); - return query; -} -exports.getFragmentQueryDocument = getFragmentQueryDocument; -//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/fragments.js.map b/node_modules/apollo-utilities/lib/fragments.js.map deleted file mode 100644 index ece1e375..00000000 --- a/node_modules/apollo-utilities/lib/fragments.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../src/fragments.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAwBzD,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAKtC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,UAAU;QAGrC,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,IAAI,6BAAc,CACtB,aAAW,UAAU,CAAC,SAAS,mBAC7B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,aAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,QACxD;gBACF,yFAAyF,CAC5F,CAAC;SACH;QAGD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC5C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC5B;IACH,CAAC,CAAC,CAAC;IAIH,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;QAC7C,wBAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,WACE,SAAS,CAAC,MAAM,sFACmE,CACtF,CAAC;QACF,kBAAkB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9C;IAID,IAAM,KAAK,yCACN,QAAQ,KACX,WAAW;YACT;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,SAAS,EAAE,OAAO;gBAClB,YAAY,EAAE;oBACZ,IAAI,EAAE,cAAc;oBACpB,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,gBAAgB;4BACtB,IAAI,EAAE;gCACJ,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,kBAAkB;6BAC1B;yBACF;qBACF;iBACF;aACF;WACE,QAAQ,CAAC,WAAW,IAE1B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAlED,4DAkEC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/getFromAST.d.ts b/node_modules/apollo-utilities/lib/getFromAST.d.ts deleted file mode 100644 index 57050319..00000000 --- a/node_modules/apollo-utilities/lib/getFromAST.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from 'graphql'; -import { JsonValue } from './storeUtils'; -export declare function getMutationDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function checkDocument(doc: DocumentNode): DocumentNode; -export declare function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined; -export declare function getOperationDefinitionOrDie(document: DocumentNode): OperationDefinitionNode; -export declare function getOperationName(doc: DocumentNode): string | null; -export declare function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[]; -export declare function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode; -export declare function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode; -export declare function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode; -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} -export declare function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap; -export declare function getDefaultValues(definition: OperationDefinitionNode | undefined): { - [key: string]: JsonValue; -}; -export declare function variablesInOperation(operation: OperationDefinitionNode): Set; -//# sourceMappingURL=getFromAST.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/getFromAST.d.ts.map b/node_modules/apollo-utilities/lib/getFromAST.d.ts.map deleted file mode 100644 index ef2f9946..00000000 --- a/node_modules/apollo-ut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GAAG,CAAC,MAAM,CAAC,CASb"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/getFromAST.js b/node_modules/apollo-utilities/lib/getFromAST.js deleted file mode 100644 index 39f4e5aa..00000000 --- a/node_modules/apollo-utilities/lib/getFromAST.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var ts_invariant_1 = require("ts-invariant"); -var assign_1 = require("./util/assign"); -var storeUtils_1 = require("./storeUtils"); -function getMutationDefinition(doc) { - checkDocument(doc); - var mutationDef = doc.definitions.filter(function (definition) { - return definition.kind === 'OperationDefinition' && - definition.operation === 'mutation'; - })[0]; - ts_invariant_1.invariant(mutationDef, 'Must contain a mutation definition.'); - return mutationDef; -} -exports.getMutationDefinition = getMutationDefinition; -function checkDocument(doc) { - ts_invariant_1.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw new ts_invariant_1.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); - } - return definition; - }); - ts_invariant_1.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); - return doc; -} -exports.checkDocument = checkDocument; -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -exports.getOperationDefinition = getOperationDefinition; -function getOperationDefinitionOrDie(document) { - var def = getOperationDefinition(document); - ts_invariant_1.invariant(def, "GraphQL document is missing an operation"); - return def; -} -exports.getOperationDefinitionOrDie = getOperationDefinitionOrDie; -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -exports.getOperationName = getOperationName; -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -exports.getFragmentDefinitions = getFragmentDefinitions; -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - ts_invariant_1.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); - return queryDef; -} -exports.getQueryDefinition = getQueryDefinition; -function getFragmentDefinition(doc) { - ts_invariant_1.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); - ts_invariant_1.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); - var fragmentDef = doc.definitions[0]; - ts_invariant_1.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); - return fragmentDef; -} -exports.getFragmentDefinition = getFragmentDefinition; -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw new ts_invariant_1.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); -} -exports.getMainDefinition = getMainDefinition; -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -exports.createFragmentMap = createFragmentMap; -function getDefaultValues(definition) { - if (definition && - definition.variableDefinitions && - definition.variableDefinitions.length) { - var defaultValues = definition.variableDefinitions - .filter(function (_a) { - var defaultValue = _a.defaultValue; - return defaultValue; - }) - .map(function (_a) { - var variable = _a.variable, defaultValue = _a.defaultValue; - var defaultValueObj = {}; - storeUtils_1.valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); - return defaultValueObj; - }); - return assign_1.assign.apply(void 0, tslib_1.__spreadArrays([{}], defaultValues)); - } - return {}; -} -exports.getDefaultValues = getDefaultValues; -function variablesInOperation(operation) { - var names = new Set(); - if (operation.variableDefinitions) { - for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { - var definition = _a[_i]; - names.add(definition.variable.name.value); - } - } - return names; -} -exports.variablesInOperation = variablesInOperation; -//# sourceMappingURL=getFromAST.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/getFromAST.js.map b/node_modules/apollo-utilities/lib/getFromAST.js.map deleted file mode 100644 index 88d74a5f..00000000 --- a/node_modules/apollo-utilities/lib/getFromAST.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"getFromAST.js","sourceRoot":"","sources":["../src/getFromAST.ts"],"names":[],"mappings":";;;AAOA,6CAAyD;AAEzD,wCAAuC;AAEvC,2CAAsE;AAEtE,SAAgB,qBAAqB,CACnC,GAAiB;IAEjB,aAAa,CAAC,GAAG,CAAC,CAAC;IAEnB,IAAI,WAAW,GAAmC,GAAG,CAAC,WAAW,CAAC,MAAM,CACtE,UAAA,UAAU;QACR,OAAA,UAAU,CAAC,IAAI,KAAK,qBAAqB;YACzC,UAAU,CAAC,SAAS,KAAK,UAAU;IADnC,CACmC,CACtC,CAAC,CAAC,CAA4B,CAAC;IAEhC,wBAAS,CAAC,WAAW,EAAE,qCAAqC,CAAC,CAAC;IAE9D,OAAO,WAAW,CAAC;AACrB,CAAC;AAdD,sDAcC;AAGD,SAAgB,aAAa,CAAC,GAAiB;IAC7C,wBAAS,CACP,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAC9B,0JAC2E,CAC5E,CAAC;IAEF,IAAM,UAAU,GAAG,GAAG,CAAC,WAAW;SAC/B,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,o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B,EAA7B,KAAA,SAAS,CAAC,mBAAmB,EAA7B,cAA6B,EAA7B,IAA6B,EAAE;YAAnD,IAAM,UAAU,SAAA;YACnB,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC3C;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAXD,oDAWC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/index.d.ts b/node_modules/apollo-utilities/lib/index.d.ts deleted file mode 100644 index 6e84d9df..00000000 --- a/node_modules/apollo-utilities/lib/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/index.d.ts.map b/node_modules/apollo-utilities/lib/index.d.ts.map deleted file mode 100644 index 65614a63..00000000 --- a/node_modules/apollo-utilities/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/index.js b/node_modules/apollo-utilities/lib/index.js deleted file mode 100644 index 0693303c..00000000 --- a/node_modules/apollo-utilities/lib/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./directives"), exports); -tslib_1.__exportStar(require("./fragments"), exports); -tslib_1.__exportStar(require("./getFromAST"), exports); -tslib_1.__exportStar(require("./transform"), exports); -tslib_1.__exportStar(require("./storeUtils"), exports); -tslib_1.__exportStar(require("./util/assign"), exports); -tslib_1.__exportStar(require("./util/canUse"), exports); -tslib_1.__exportStar(require("./util/cloneDeep"), exports); -tslib_1.__exportStar(require("./util/environment"), exports); -tslib_1.__exportStar(require("./util/errorHandling"), exports); -tslib_1.__exportStar(require("./util/isEqual"), exports); -tslib_1.__exportStar(require("./util/maybeDeepFreeze"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -tslib_1.__exportStar(require("./util/warnOnce"), exports); -tslib_1.__exportStar(require("./util/stripSymbols"), exports); -tslib_1.__exportStar(require("./util/mergeDeep"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/index.js.map b/node_modules/apollo-utilities/lib/index.js.map deleted file mode 100644 index 3c41b701..00000000 --- a/node_modules/apollo-utilities/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,uDAA6B;AAC7B,wDAA8B;AAC9B,wDAA8B;AAC9B,2DAAiC;AACjC,6DAAmC;AACnC,+DAAqC;AACrC,yDAA+B;AAC/B,iEAAuC;AACvC,2DAAiC;AACjC,0DAAgC;AAChC,8DAAoC;AACpC,2DAAiC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/storeUtils.d.ts b/node_modules/apollo-utilities/lib/storeUtils.d.ts deleted file mode 100644 index 4ac253c6..00000000 --- a/node_modules/apollo-utilities/lib/storeUtils.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { DirectiveNode, FieldNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, EnumValueNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode } from 'graphql'; -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} -export interface JsonValue { - type: 'json'; - json: any; -} -export declare type ListValue = Array; -export declare type StoreValue = number | string | string[] | IdValue | ListValue | JsonValue | null | undefined | void | Object; -export declare type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; -export declare function isScalarValue(value: ValueNode): value is ScalarValue; -export declare type NumberValue = IntValueNode | FloatValueNode; -export declare function isNumberValue(value: ValueNode): value is NumberValue; -export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void; -export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string; -export declare type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; -export declare function getStoreKeyName(fieldName: string, args?: Object, directives?: Directives): string; -export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables: Object): Object; -export declare function resultKeyNameFromField(field: FieldNode): string; -export declare function isField(selection: SelectionNode): selection is FieldNode; -export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode; -export declare function isIdValue(idObject: StoreValue): idObject is IdValue; -export declare type IdConfig = { - id: string; - typename: string | undefined; -}; -export declare function toIdValue(idConfig: string | IdConfig, generated?: boolean): IdValue; -export declare function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue; -export declare type VariableValue = (node: VariableNode) => any; -export declare function valueFromNode(node: ValueNode, onVariable?: VariableValue): any; -//# sourceMappingURL=storeUtils.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/storeUtils.d.ts.map b/node_modules/apollo-utilities/lib/storeUtils.d.ts.map deleted file mode 100644 index 531a9645..00000000 --- a/node_modules/apollo-utilities/lib/storeUtils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["src/storeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAGhB,aAAa,EAEb,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;CACX;AAED,oBAAY,SAAS,GAAG,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;AAE9C,oBAAY,UAAU,GAClB,MAAM,GACN,MAAM,GACN,MAAM,EAAE,GACR,OAAO,GACP,SAAS,GACT,SAAS,GACT,IAAI,GACJ,SAAS,GACT,IAAI,GACJ,MAAM,CAAC;AAEX,oBAAY,WAAW,GAAG,eAAe,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,WAAW,CAEpE;AAED,oBAAY,WAAW,GAAG,YAAY,GAAG,cAAc,CAAC;AAExD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,WAAW,CAEpE;AAsCD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,QAAQ,E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GAAG,CAsBL"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/storeUtils.js b/node_modules/apollo-utilities/lib/storeUtils.js deleted file mode 100644 index bf04bfb1..00000000 --- a/node_modules/apollo-utilities/lib/storeUtils.js +++ /dev/null @@ -1,225 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var fast_json_stable_stringify_1 = tslib_1.__importDefault(require("fast-json-stable-stringify")); -var ts_invariant_1 = require("ts-invariant"); -function isScalarValue(value) { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} -exports.isScalarValue = isScalarValue; -function isNumberValue(value) { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} -exports.isNumberValue = isNumberValue; -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw new ts_invariant_1.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.'); - } -} -exports.valueToObjectRepresentation = valueToObjectRepresentation; -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -exports.storeKeyNameFromField = storeKeyNameFromField; -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -function getStoreKeyName(fieldName, args, directives) { - if (directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var queryArgs_1 = args; - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = queryArgs_1[key]; - }); - return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = fast_json_stable_stringify_1.default(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -} -exports.getStoreKeyName = getStoreKeyName; -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -exports.argumentsObjectFromField = argumentsObjectFromField; -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -exports.resultKeyNameFromField = resultKeyNameFromField; -function isField(selection) { - return selection.kind === 'Field'; -} -exports.isField = isField; -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -exports.isInlineFragment = isInlineFragment; -function isIdValue(idObject) { - return idObject && - idObject.type === 'id' && - typeof idObject.generated === 'boolean'; -} -exports.isIdValue = isIdValue; -function toIdValue(idConfig, generated) { - if (generated === void 0) { generated = false; } - return tslib_1.__assign({ type: 'id', generated: generated }, (typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig)); -} -exports.toIdValue = toIdValue; -function isJsonValue(jsonObject) { - return (jsonObject != null && - typeof jsonObject === 'object' && - jsonObject.type === 'json'); -} -exports.isJsonValue = isJsonValue; -function defaultValueFromVariable(node) { - throw new ts_invariant_1.InvariantError("Variable nodes are not supported by valueFromNode"); -} -function valueFromNode(node, onVariable) { - if (onVariable === void 0) { onVariable = defaultValueFromVariable; } - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(function (v) { return valueFromNode(v, onVariable); }); - case 'ObjectValue': { - var value = {}; - for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { - var field = _a[_i]; - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} -exports.valueFromNode = valueFromNode; -//# sourceMappingURL=storeUtils.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/storeUtils.js.map b/node_modules/apollo-utilities/lib/storeUtils.js.map deleted file mode 100644 index bb07be7f..00000000 --- a/node_modules/apollo-utilities/lib/storeUtils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"storeUtils.js","sourceRoot":"","sources":["../src/storeUtils.ts"],"names":[],"mappings":";;;AAkBA,kGAAmD;AACnD,6CAA8C;AA8B9C,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/E,CAAC;AAFD,sCAEC;AAID,SAAgB,aAAa,CAAC,KAAgB;IAC5C,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,CAAC;AAFD,sCAEC;AAED,SAAS,aAAa,CAAC,KAAgB;IACrC,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;AACvC,CAAC;AAED,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB;IACpC,OAAO,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;AACrC,CAAC;AAED,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED,SAAS,aAAa,CAAC,KAAgB;IACrC,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACnC,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;AACpC,CAAC;AAED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;IAApD,2BAAA,EAAA,qCAAoD;IAEpD,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,KAAK,WAAW;YACd,OAAO,IAAI,CAAC;QACd,KAAK,UAAU;YACb,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,KAAK,YAAY;YACf,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,KAAK,WAAW;YACd,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,aAAa,CAAC,CAAC,EAAE,UAAU,CAAC,EAA5B,CAA4B,CAAC,CAAC;QAC5D,KAAK,aAAa,CAAC,CAAC;YAClB,IAAM,KAAK,GAA2B,EAAE,CAAC;YACzC,KAAoB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;gBAA5B,IAAM,KAAK,SAAA;gBACd,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aAClE;YACD,OAAO,KAAK,CAAC;SACd;QACD;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;AACH,CAAC;AAzBD,sCAyBC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/transform.d.ts b/node_modules/apollo-utilities/lib/transform.d.ts deleted file mode 100644 index f359faf5..00000000 --- a/node_modules/apollo-utilities/lib/transform.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { DocumentNode, DirectiveNode, FragmentDefinitionNode, ArgumentNode, FragmentSpreadNode, VariableDefinitionNode } from 'graphql'; -export declare type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; -export declare type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; -export declare type RemoveDirectiveConfig = RemoveNodeConfig; -export declare type GetDirectiveConfig = GetNodeConfig; -export declare type RemoveArgumentsConfig = RemoveNodeConfig; -export declare type GetFragmentSpreadConfig = GetNodeConfig; -export declare type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export declare type RemoveFragmentDefinitionConfig = RemoveNodeConfig; -export declare type RemoveVariableDefinitionConfig = RemoveNodeConfig; -export declare function removeDirectivesFromDocument(directives: RemoveDirectiveConfig[], doc: DocumentNode): DocumentNode | null; -export declare function addTypenameToDocument(doc: DocumentNode): DocumentNode; -export declare function removeConnectionDirectiveFromDocument(doc: DocumentNode): DocumentNode; -export declare function getDirectivesFromDocument(directives: GetDirectiveConfig[], doc: DocumentNode): DocumentNode; -export declare function removeArgumentsFromDocument(config: RemoveArgumentsConfig[], doc: DocumentNode): DocumentNode; -export declare function removeFragmentSpreadFromDocument(config: RemoveFragmentSpreadConfig[], doc: DocumentNode): DocumentNode; -export declare function buildQueryFromSelectionSet(document: DocumentNode): DocumentNode; -export declare function removeClientSetsFromDocument(document: DocumentNode): DocumentNode | null; -//# sourceMappingURL=transform.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/transform.d.ts.map b/node_modules/apollo-utilities/lib/transform.d.ts.map deleted file mode 100644 index 5d6140be..00000000 --- a/node_modules/apollo-utilities/lib/transform.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAgBjB,oBAAY,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,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,YAAY,GAAG,IAAI,CAoCrB"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/transform.js b/node_modules/apollo-utilities/lib/transform.js deleted file mode 100644 index b85155c5..00000000 --- a/node_modules/apollo-utilities/lib/transform.js +++ /dev/null @@ -1,311 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var visitor_1 = require("graphql/language/visitor"); -var getFromAST_1 = require("./getFromAST"); -var filterInPlace_1 = require("./util/filterInPlace"); -var ts_invariant_1 = require("ts-invariant"); -var storeUtils_1 = require("./storeUtils"); -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty(getFromAST_1.getOperationDefinition(doc) || getFromAST_1.getFragmentDefinition(doc), getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty(visitor_1.visit(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - filterInPlace_1.filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - filterInPlace_1.filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -exports.removeDirectivesFromDocument = removeDirectivesFromDocument; -function addTypenameToDocument(doc) { - return visitor_1.visit(getFromAST_1.checkDocument(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return (storeUtils_1.isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if (storeUtils_1.isField(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: tslib_1.__spreadArrays(selections, [TYPENAME_FIELD]) }); - }, - }, - }); -} -exports.addTypenameToDocument = addTypenameToDocument; -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - ts_invariant_1.invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], getFromAST_1.checkDocument(doc)); -} -exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!storeUtils_1.isField(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getDirectivesFromDocument(directives, doc) { - getFromAST_1.checkDocument(doc); - var parentPath; - return nullIfDocIsEmpty(visitor_1.visit(doc, { - SelectionSet: { - enter: function (node, _key, _parent, path) { - var currentPath = path.join('-'); - if (!parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath)) { - if (node.selections) { - var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - return tslib_1.__assign(tslib_1.__assign({}, node), { selections: selectionsWithDirectives }); - } - else { - return null; - } - } - }, - }, - })); -} -exports.getDirectivesFromDocument = getDirectivesFromDocument; -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty(visitor_1.visit(doc, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -exports.removeArgumentsFromDocument = removeArgumentsFromDocument; -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty(visitor_1.visit(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if ((storeUtils_1.isField(selection) || storeUtils_1.isInlineFragment(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = getFromAST_1.getMainDefinition(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = visitor_1.visit(document, { - OperationDefinition: { - enter: function (node) { - return tslib_1.__assign(tslib_1.__assign({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; -function removeClientSetsFromDocument(document) { - getFromAST_1.checkDocument(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = visitor_1.visit(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return storeUtils_1.isField(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} -exports.removeClientSetsFromDocument = removeClientSetsFromDocument; -//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/transform.js.map b/node_modules/apollo-utilities/lib/transform.js.map deleted file mode 100644 index 4ea09818..00000000 --- a/node_modules/apollo-utilities/lib/transform.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";;;AAaA,oDAAiD;AAEjD,2CAQsB;AACtB,sDAAqD;AACrD,6CAAyC;AACzC,2CAAyD;AAyBzD,IAAM,cAAc,GAAc;IAChC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,YAAY;KACpB;CACF,CAAC;AAEF,SAAS,OAAO,CACd,EAAoD,EACpD,SAAsB;IAEtB,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CACrC,UAAA,SAAS;QACP,OAAA,SAAS,CAAC,IAAI,KAAK,gBAAgB;YACnC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IADnD,CACmD,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAiB;IACzC,OAAO,OAAO,CACZ,mCAAsB,CAAC,GAAG,CAAC,IAAI,kCAAqB,CAAC,GAAG,CAAC,EACzD,8BAAiB,CAAC,mCAAsB,CAAC,GAAG,CAAC,CAAC,CAC/C;QACC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAED,SAAS,mBAAmB,CAC1B,UAA0D;IAE1D,OAAO,SAAS,gBAAgB,CAAC,SAAwB;QACvD,OAAO,UAAU,CAAC,IAAI,CACpB,UAA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AC;KACjB;IAGD,IAAM,WAAW,GAAG,eAAK,CAAC,QAAQ,EAAE;QAClC,mBAAmB,EAAE;YACnB,KAAK,YAAC,IAAI;gBACR,6CACK,IAAI,KACP,SAAS,EAAE,OAAO,IAClB;YACJ,CAAC;SACF;KACF,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC;AAvBD,gEAuBC;AAGD,SAAgB,4BAA4B,CAC1C,QAAsB;IAEtB,0BAAa,CAAC,QAAQ,CAAC,CAAC;IAExB,IAAI,WAAW,GAAG,4BAA4B,CAC5C;QACE;YACE,IAAI,EAAE,UAAC,SAAwB,IAAK,OAAA,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAjC,CAAiC;YACrE,MAAM,EAAE,IAAI;SACb;KACF,EACD,QAAQ,CACT,CAAC;IAMF,IAAI,WAAW,EAAE;QACf,WAAW,GAAG,eAAK,CAAC,WAAW,EAAE;YAC/B,kBAAkB,EAAE;gBAClB,KAAK,YAAC,IAAI;oBACR,IAAI,IAAI,CAAC,YAAY,EAAE;wBACrB,IAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CACvD,UAAA,SAAS;4BACP,OAAA,oBAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY;wBAA3D,CAA2D,CAC9D,CAAC;wBACF,IAAI,cAAc,EAAE;4BAClB,OAAO,IAAI,CAAC;yBACb;qBACF;gBACH,CAAC;aACF;SACF,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAtCD,oEAsCC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/assign.d.ts b/node_modules/apollo-utilities/lib/util/assign.d.ts deleted file mode 100644 index 306bddf7..00000000 --- a/node_modules/apollo-utilities/lib/util/assign.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function assign(a: A, b: B): A & B; -export declare function assign(a: A, b: B, c: C): A & B & C; -export declare function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export declare function assign(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E; -export declare function assign(target: any, ...sources: Array): any; -//# sourceMappingURL=assign.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/assign.d.ts.map b/node_modules/apollo-utilities/lib/util/assign.d.ts.map deleted file mode 100644 index 20e9dbff..00000000 --- a/node_modules/apollo-utilities/lib/util/assign.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/util/assign.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChD,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1E,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAClC,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACrB,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/assign.js b/node_modules/apollo-utilities/lib/util/assign.js deleted file mode 100644 index 78e39015..00000000 --- a/node_modules/apollo-utilities/lib/util/assign.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(function (key) { - target[key] = source[key]; - }); - }); - return target; -} -exports.assign = assign; -//# sourceMappingURL=assign.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/assign.js.map b/node_modules/apollo-utilities/lib/util/assign.js.map deleted file mode 100644 index 6a697cc9..00000000 --- a/node_modules/apollo-utilities/lib/util/assign.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assign.js","sourceRoot":"","sources":["../../src/util/assign.ts"],"names":[],"mappings":";;AAiBA,SAAgB,MAAM,CACpB,MAA8B;IAC9B,iBAAyC;SAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;QAAzC,gCAAyC;;IAEzC,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM;QACpB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,IAAI,EAAE;YACpD,OAAO;SACR;QACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/canUse.d.ts b/node_modules/apollo-utilities/lib/util/canUse.d.ts deleted file mode 100644 index 53d76ab7..00000000 --- a/node_modules/apollo-utilities/lib/util/canUse.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const canUseWeakMap: boolean; -//# sourceMappingURL=canUse.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/canUse.d.ts.map b/node_modules/apollo-utilities/lib/util/canUse.d.ts.map deleted file mode 100644 index 74a2206a..00000000 --- a/node_modules/apollo-utilities/lib/util/canUse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.d.ts","sourceRoot":"","sources":["../src/util/canUse.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAGzB,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/canUse.js b/node_modules/apollo-utilities/lib/util/canUse.js deleted file mode 100644 index c8caab97..00000000 --- a/node_modules/apollo-utilities/lib/util/canUse.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); -//# sourceMappingURL=canUse.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/canUse.js.map b/node_modules/apollo-utilities/lib/util/canUse.js.map deleted file mode 100644 index e0e5e566..00000000 --- a/node_modules/apollo-utilities/lib/util/canUse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../src/util/canUse.ts"],"names":[],"mappings":";;AAAa,QAAA,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,IAAI,CAAC,CAC7D,OAAO,SAAS,KAAK,QAAQ;IAC7B,SAAS,CAAC,OAAO,KAAK,aAAa,CACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts b/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts deleted file mode 100644 index 61525aad..00000000 --- a/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function cloneDeep(value: T): T; -//# sourceMappingURL=cloneDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map b/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map deleted file mode 100644 index a871948f..00000000 --- a/node_modules/apollo-utilities/lib/util/cloneDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cloneDeep.d.ts","sourceRoot":"","sources":["../src/util/cloneDeep.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAExC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/cloneDeep.js b/node_modules/apollo-utilities/lib/util/cloneDeep.js deleted file mode 100644 index 8fbfb3fe..00000000 --- a/node_modules/apollo-utilities/lib/util/cloneDeep.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value, new Map()); -} -exports.cloneDeep = cloneDeep; -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} -//# sourceMappingURL=cloneDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/cloneDeep.js.map b/node_modules/apollo-utilities/lib/util/cloneDeep.js.map deleted file mode 100644 index 36015d2d..00000000 --- a/node_modules/apollo-util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Ae,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED;YACE,OAAO,GAAG,CAAC;KACZ;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/environment.d.ts b/node_modules/apollo-utilities/lib/util/environment.d.ts deleted file mode 100644 index 3dac4c1b..00000000 --- a/node_modules/apollo-utilities/lib/util/environment.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function getEnv(): string | undefined; -export declare function isEnv(env: string): boolean; -export declare function isProduction(): boolean; -export declare function isDevelopment(): boolean; -export declare function isTest(): boolean; -//# sourceMappingURL=environment.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/environment.d.ts.map b/node_modules/apollo-utilities/lib/util/environment.d.ts.map deleted file mode 100644 index ac39af26..00000000 --- a/node_modules/apollo-utilities/lib/util/environment.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/util/environment.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAO3C;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1C;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,wBAAgB,MAAM,IAAI,OAAO,CAEhC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/environment.js b/node_modules/apollo-utilities/lib/util/environment.js deleted file mode 100644 index 13f120ef..00000000 --- a/node_modules/apollo-utilities/lib/util/environment.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getEnv() { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - return 'development'; -} -exports.getEnv = getEnv; -function isEnv(env) { - return getEnv() === env; -} -exports.isEnv = isEnv; -function isProduction() { - return isEnv('production') === true; -} -exports.isProduction = isProduction; -function isDevelopment() { - return isEnv('development') === true; -} -exports.isDevelopment = isDevelopment; -function isTest() { - return isEnv('test') === true; -} -exports.isTest = isTest; -//# sourceMappingURL=environment.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/environment.js.map b/node_modules/apollo-utilities/lib/util/environment.js.map deleted file mode 100644 index d7b9e1ae..00000000 --- a/node_modules/apollo-utilities/lib/util/environment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/util/environment.ts"],"names":[],"mappings":";;AAAA,SAAgB,MAAM;IACpB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;QAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC7B;IAGD,OAAO,aAAa,CAAC;AACvB,CAAC;AAPD,wBAOC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,MAAM,EAAE,KAAK,GAAG,CAAC;AAC1B,CAAC;AAFD,sBAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AACtC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa;IAC3B,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAFD,sCAEC;AAED,SAAgB,MAAM;IACpB,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAChC,CAAC;AAFD,wBAEC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/errorHandling.d.ts b/node_modules/apollo-utilities/lib/util/errorHandling.d.ts deleted file mode 100644 index d1d25c33..00000000 --- a/node_modules/apollo-utilities/lib/util/errorHandling.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ExecutionResult } from 'graphql'; -export declare function tryFunctionOrLogError(f: Function): any; -export declare function graphQLResultHasError(result: ExecutionResult): number; -//# sourceMappingURL=errorHandling.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map b/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map deleted file mode 100644 index 6955d016..00000000 --- a/node_modules/apollo-utilities/lib/util/errorHandling.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../src/util/errorHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,OAQhD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,UAE5D"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/errorHandling.js b/node_modules/apollo-utilities/lib/util/errorHandling.js deleted file mode 100644 index a9955e19..00000000 --- a/node_modules/apollo-utilities/lib/util/errorHandling.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function tryFunctionOrLogError(f) { - try { - return f(); - } - catch (e) { - if (console.error) { - console.error(e); - } - } -} -exports.tryFunctionOrLogError = tryFunctionOrLogError; -function graphQLResultHasError(result) { - return result.errors && result.errors.length; -} -exports.graphQLResultHasError = graphQLResultHasError; -//# sourceMappingURL=errorHandling.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/errorHandling.js.map b/node_modules/apollo-utilities/lib/util/errorHandling.js.map deleted file mode 100644 index 52b9fb6b..00000000 --- a/node_modules/apollo-utilities/lib/util/errorHandling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../src/util/errorHandling.ts"],"names":[],"mappings":";;AAEA,SAAgB,qBAAqB,CAAC,CAAW;IAC/C,IAAI;QACF,OAAO,CAAC,EAAE,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;KACF;AACH,CAAC;AARD,sDAQC;AAED,SAAgB,qBAAqB,CAAC,MAAuB;IAC3D,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;AAC/C,CAAC;AAFD,sDAEC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts b/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts deleted file mode 100644 index 429feb86..00000000 --- a/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function filterInPlace(array: T[], test: (elem: T) => boolean, context?: any): T[]; -//# sourceMappingURL=filterInPlace.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map b/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map deleted file mode 100644 index c45757b7..00000000 --- a/node_modules/apollo-utilities/lib/util/filterInPlace.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.d.ts","sourceRoot":"","sources":["../src/util/filterInPlace.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAC1B,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,EAAE,CASL"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/filterInPlace.js b/node_modules/apollo-utilities/lib/util/filterInPlace.js deleted file mode 100644 index 66b9dd6e..00000000 --- a/node_modules/apollo-utilities/lib/util/filterInPlace.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} -exports.filterInPlace = filterInPlace; -//# sourceMappingURL=filterInPlace.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/filterInPlace.js.map b/node_modules/apollo-utilities/lib/util/filterInPlace.js.map deleted file mode 100644 index d0e2a7dc..00000000 --- a/node_modules/apollo-utilities/lib/util/filterInPlace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filterInPlace.js","sourceRoot":"","sources":["../../src/util/filterInPlace.ts"],"names":[],"mappings":";;AAAA,SAAgB,aAAa,CAC3B,KAAU,EACV,IAA0B,EAC1B,OAAa;IAEb,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE;YACnC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;SACxB;IACH,CAAC,EAAE,OAAO,CAAC,CAAC;IACZ,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,sCAaC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/isEqual.d.ts b/node_modules/apollo-utilities/lib/util/isEqual.d.ts deleted file mode 100644 index fe095067..00000000 --- a/node_modules/apollo-utilities/lib/util/isEqual.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; -//# sourceMappingURL=isEqual.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map b/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map deleted file mode 100644 index d2078c93..00000000 --- a/node_modules/apollo-utilities/lib/util/isEqual.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../src/util/isEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/isEqual.js b/node_modules/apollo-utilities/lib/util/isEqual.js deleted file mode 100644 index f7d228c8..00000000 --- a/node_modules/apollo-utilities/lib/util/isEqual.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var equality_1 = require("@wry/equality"); -exports.isEqual = equality_1.equal; -//# sourceMappingURL=isEqual.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/isEqual.js.map b/node_modules/apollo-utilities/lib/util/isEqual.js.map deleted file mode 100644 index c6fe9ba5..00000000 --- a/node_modules/apollo-utilities/lib/util/isEqual.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isEqual.js","sourceRoot":"","sources":["../../src/util/isEqual.ts"],"names":[],"mappings":";;AAAA,0CAAiD;AAAxC,6BAAA,KAAK,CAAW"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts b/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts deleted file mode 100644 index e5c569ee..00000000 --- a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function maybeDeepFreeze(obj: any): any; -//# sourceMappingURL=maybeDeepFreeze.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map b/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map deleted file mode 100644 index 99cb3ef8..00000000 --- a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.d.ts","sourceRoot":"","sources":["../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,OAYvC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js b/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js deleted file mode 100644 index 2f7b836d..00000000 --- a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -function deepFreeze(o) { - Object.freeze(o); - Object.getOwnPropertyNames(o).forEach(function (prop) { - if (o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop])) { - deepFreeze(o[prop]); - } - }); - return o; -} -function maybeDeepFreeze(obj) { - if (environment_1.isDevelopment() || environment_1.isTest()) { - var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} -exports.maybeDeepFreeze = maybeDeepFreeze; -//# sourceMappingURL=maybeDeepFreeze.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map b/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map deleted file mode 100644 index ea62a05d..00000000 --- a/node_modules/apollo-utilities/lib/util/maybeDeepFreeze.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../src/util/maybeDeepFreeze.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AAItD,SAAS,UAAU,CAAC,CAAM;IACxB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEjB,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;QACjD,IACE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI;YAChB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;YAC9D,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EACzB;YACA,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,eAAe,CAAC,GAAQ;IACtC,IAAI,2BAAa,EAAE,IAAI,oBAAM,EAAE,EAAE;QAG/B,IAAM,kBAAkB,GACtB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC;QAEjE,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;SACxB;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAZD,0CAYC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts b/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts deleted file mode 100644 index d3c18919..00000000 --- a/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare type TupleToIntersection = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any; -export declare function mergeDeep(...sources: T): TupleToIntersection; -export declare function mergeDeepArray(sources: T[]): T; -//# sourceMappingURL=mergeDeep.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map b/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map deleted file mode 100644 index d95732fc..00000000 --- a/node_modules/apollo-utilities/lib/util/mergeDeep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.d.ts","sourceRoot":"","sources":["../src/util/mergeDeep.ts"],"names":[],"mappings":"AAgBA,oBAAY,mBAAmB,CAAC,CAAC,SAAS,GAAG,EAAE,IAC7C,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GACvB,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GACpC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACjD,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC9D,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAC3E,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;AAElC,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EACvC,GAAG,OAAO,EAAE,CAAC,GACZ,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAQD,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAWjD"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/mergeDeep.js b/node_modules/apollo-utilities/lib/util/mergeDeep.js deleted file mode 100644 index e4100a26..00000000 --- a/node_modules/apollo-utilities/lib/util/mergeDeep.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -exports.mergeDeep = mergeDeep; -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var pastCopies = []; - target = shallowCopyForMerge(target, pastCopies); - for (var i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} -exports.mergeDeepArray = mergeDeepArray; -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -function mergeHelper(target, source, pastCopies) { - if (isObject(source) && isObject(target)) { - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - Object.keys(source).forEach(function (sourceKey) { - var sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); - } - } - else { - target[sourceKey] = sourceValue; - } - }); - return target; - } - return source; -} -function shallowCopyForMerge(value, pastCopies) { - if (value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = tslib_1.__assign({ __proto__: Object.getPrototypeOf(value) }, value); - } - pastCopies.push(value); - } - return value; -} -//# sourceMappingURL=mergeDeep.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/mergeDeep.js.map b/node_modules/apollo-utilities/lib/util/mergeDeep.js.map deleted file mode 100644 index 20393f8f..00000000 --- a/node_modules/apollo-utilities/lib/util/mergeDeep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mergeDeep.js","sourceRoot":"","sources":["../../src/util/mergeDeep.ts"],"names":[],"mappings":";;;AAAQ,IAAA,gDAAc,CAAsB;AAwB5C,SAAgB,SAAS;IACvB,iBAAa;SAAb,UAAa,EAAb,qBAAa,EAAb,IAAa;QAAb,4BAAa;;IAEb,OAAO,cAAc,CAAC,OAAO,CAAC,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/B,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAC7B,mBAAmB,CAAC,WAAW,EAAE,UAAU,CAAC,EAC5C,WAAW,EACX,UAAU,CACX,CAAC;iBACH;aACF;iBAAM;gBAGL,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;KACf;IAGD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAI,KAAQ,EAAE,UAAiB;IACzD,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAC7B;QACA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,GAAI,KAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjC;aAAM;YACL,KAAK,sBACH,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IACpC,KAAK,CACT,CAAC;SACH;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts b/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts deleted file mode 100644 index 48d2b7cb..00000000 --- a/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function stripSymbols(data: T): T; -//# sourceMappingURL=stripSymbols.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map b/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map deleted file mode 100644 index 9e0384d8..00000000 --- a/node_modules/apollo-utilities/lib/util/stripSymbols.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.d.ts","sourceRoot":"","sources":["../src/util/stripSymbols.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAE1C"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/stripSymbols.js b/node_modules/apollo-utilities/lib/util/stripSymbols.js deleted file mode 100644 index bc978e58..00000000 --- a/node_modules/apollo-utilities/lib/util/stripSymbols.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function stripSymbols(data) { - return JSON.parse(JSON.stringify(data)); -} -exports.stripSymbols = stripSymbols; -//# sourceMappingURL=stripSymbols.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/stripSymbols.js.map b/node_modules/apollo-utilities/lib/util/stripSymbols.js.map deleted file mode 100644 index 3bbcc9c5..00000000 --- a/node_modules/apollo-utilities/lib/util/stripSymbols.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stripSymbols.js","sourceRoot":"","sources":["../../src/util/stripSymbols.ts"],"names":[],"mappings":";;AAWA,SAAgB,YAAY,CAAI,IAAO;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/warnOnce.d.ts b/node_modules/apollo-utilities/lib/util/warnOnce.d.ts deleted file mode 100644 index 0b7c1897..00000000 --- a/node_modules/apollo-utilities/lib/util/warnOnce.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function warnOnceInDevelopment(msg: string, type?: string): void; -//# sourceMappingURL=warnOnce.d.ts.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map b/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map deleted file mode 100644 index 1b652a3c..00000000 --- a/node_modules/apollo-utilities/lib/util/warnOnce.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.d.ts","sourceRoot":"","sources":["../src/util/warnOnce.ts"],"names":[],"mappings":"AAYA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAS,QAW/D"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/warnOnce.js b/node_modules/apollo-utilities/lib/util/warnOnce.js deleted file mode 100644 index 167ba8f0..00000000 --- a/node_modules/apollo-utilities/lib/util/warnOnce.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = require("./environment"); -var haveWarned = Object.create({}); -function warnOnceInDevelopment(msg, type) { - if (type === void 0) { type = 'warn'; } - if (!environment_1.isProduction() && !haveWarned[msg]) { - if (!environment_1.isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } - else { - console.warn(msg); - } - } -} -exports.warnOnceInDevelopment = warnOnceInDevelopment; -//# sourceMappingURL=warnOnce.js.map \ No newline at end of file diff --git a/node_modules/apollo-utilities/lib/util/warnOnce.js.map b/node_modules/apollo-utilities/lib/util/warnOnce.js.map deleted file mode 100644 index 63d8e3d1..00000000 --- a/node_modules/apollo-utilities/lib/util/warnOnce.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warnOnce.js","sourceRoot":"","sources":["../../src/util/warnOnce.ts"],"names":[],"mappings":";;AAAA,6CAAqD;AAErD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAUrC,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAa;IAAb,qBAAA,EAAA,aAAa;IAC9D,IAAI,CAAC,0BAAY,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,CAAC,oBAAM,EAAE,EAAE;YACb,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;AACH,CAAC;AAXD,sDAWC"} \ No newline at end of file diff --git a/node_modules/apollo-utilities/package.json b/node_modules/apollo-utilities/package.json deleted file mode 100644 index b384220c..00000000 --- a/node_modules/apollo-utilities/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "apollo-utilities@^1.3.0", - "_id": "apollo-utilities@1.3.4", - "_inBundle": false, - "_integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "_location": "/apollo-utilities", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "apollo-utilities@^1.3.0", - "name": "apollo-utilities", - "escapedName": "apollo-utilities", - "rawSpec": "^1.3.0", - "saveSpec": null, - "fetchSpec": "^1.3.0" - }, - "_requiredBy": [ - "/apollo-link" - ], - "_resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "_shasum": "6129e438e8be201b6c55b0f13ce49d2c7175c9cf", - "_spec": "apollo-utilities@^1.3.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-link", - "author": { - "name": "James Baxley", - "email": "james@meteor.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-client/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "James Baxley", - "email": "james@meteor.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "James Burgess", - "email": "jamesmillerburgess@gmail.com" - } - ], - "dependencies": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - }, - "deprecated": false, - "description": "Utilities for working with GraphQL ASTs", - "gitHead": "d22394c419ff7d678afb5e7d4cd1df16ed803ead", - "homepage": "https://github.com/apollographql/apollo-client#readme", - "license": "MIT", - "main": "./lib/bundle.cjs.js", - "module": "./lib/bundle.esm.js", - "name": "apollo-utilities", - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-client.git" - }, - "scripts": { - "build": "tsc -b .", - "bundle": "npx rollup -c rollup.config.js", - "clean": "rm -rf coverage/* lib/*", - "coverage": "jest --coverage", - "lint": "tslint -c \"../../config/tslint.json\" -p tsconfig.json src/*.ts", - "postbuild": "npm run bundle", - "prebuild": "npm run clean", - "prepare": "npm run lint && npm run build", - "prepublishOnly": "npm run clean && npm run build", - "test": "tsc -p tsconfig.json --noEmit && jest", - "watch": "../../node_modules/tsc-watch/index.js --onSuccess \"npm run postbuild\"" - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "1.3.4" -} diff --git a/node_modules/apollo-utilities/src/__tests__/directives.ts b/node_modules/apollo-utilities/src/__tests__/directives.ts deleted file mode 100644 index eea3500a..00000000 --- a/node_modules/apollo-utilities/src/__tests__/directives.ts +++ /dev/null @@ -1,274 +0,0 @@ -import gql from 'graphql-tag'; -import { cloneDeep } from 'lodash'; - -import { shouldInclude, hasDirectives } from '../directives'; -import { getQueryDefinition } from '../getFromAST'; - -describe('hasDirective', () => { - it('should allow searching the ast for a directive', () => { - const query = gql` - query Simple { - field @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for all operation types', () => { - const query = gql` - { - field @live { - subField { - hello @live - } - } - } - `; - - const mutation = gql` - mutation Directive { - mutate { - field { - subField { - hello @live - } - } - } - } - `; - - const subscription = gql` - subscription LiveDirective { - sub { - field { - subField { - hello @live - } - } - } - } - `; - - [query, mutation, subscription].forEach(x => { - expect(hasDirectives(['live'], x)).toBe(true); - expect(hasDirectives(['defer'], x)).toBe(false); - }); - }); - it('works for simple fragments', () => { - const query = gql` - query Simple { - ...fieldFragment - } - - fragment fieldFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); - it('works for nested fragments', () => { - const query = gql` - query Simple { - ...fieldFragment1 - } - - fragment fieldFragment1 on Field { - bar { - baz { - ...nestedFragment - } - } - } - - fragment nestedFragment on Field { - foo @live - } - `; - expect(hasDirectives(['live'], query)).toBe(true); - expect(hasDirectives(['defer'], query)).toBe(false); - }); -}); - -describe('shouldInclude', () => { - it('should should not include a skipped field', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include an included field', () => { - const query = gql` - query { - fortuneCookie @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a not include: false field', () => { - const query = gql` - query { - fortuneCookie @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a skip: false field', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: true and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: true) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should include a field if skip: false and include: true', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(shouldInclude(field, {})).toBe(true); - }); - - it('should not include a field if skip: false and include: false', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, {})).toBe(true); - }); - - it('should leave the original query unmodified', () => { - const query = gql` - query { - fortuneCookie @skip(if: false) @include(if: false) - } - `; - const queryClone = cloneDeep(query); - const field = getQueryDefinition(query).selectionSet.selections[0]; - shouldInclude(field, {}); - expect(query).toEqual(queryClone); - }); - - it('does not throw an error on an unsupported directive', () => { - const query = gql` - query { - fortuneCookie @dosomething(if: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).not.toThrow(); - }); - - it('throws an error on an invalid argument for the skip directive', () => { - const query = gql` - query { - fortuneCookie @skip(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid argument for the include directive', () => { - const query = gql` - query { - fortuneCookie @include(nothing: true) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('throws an error on an invalid variable name within a directive argument', () => { - const query = gql` - query { - fortuneCookie @include(if: $neverDefined) - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); - - it('evaluates variables on skip fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @skip(if: $shouldSkip) - } - `; - const variables = { - shouldSkip: true, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('evaluates variables on include fields', () => { - const query = gql` - query($shouldSkip: Boolean) { - fortuneCookie @include(if: $shouldInclude) - } - `; - const variables = { - shouldInclude: false, - }; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(!shouldInclude(field, variables)).toBe(true); - }); - - it('throws an error if the value of the argument is not a variable or boolean', () => { - const query = gql` - query { - fortuneCookie @include(if: "string") - } - `; - const field = getQueryDefinition(query).selectionSet.selections[0]; - expect(() => { - shouldInclude(field, {}); - }).toThrow(); - }); -}); diff --git a/node_modules/apollo-utilities/src/__tests__/fragments.ts b/node_modules/apollo-utilities/src/__tests__/fragments.ts deleted file mode 100644 index 1c6cfa16..00000000 --- a/node_modules/apollo-utilities/src/__tests__/fragments.ts +++ /dev/null @@ -1,327 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { getFragmentQueryDocument } from '../fragments'; - -describe('getFragmentQueryDocument', () => { - it('will throw an error if there is an operation', () => { - expect(() => - getFragmentQueryDocument( - gql` - { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query { - a - b - c - } - `, - ), - ).toThrowError( - 'Found a query operation. No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - query Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a query operation named 'Named'. No operations are allowed when using a fragment as a query. Only fragments are allowed.", - ); - expect(() => - getFragmentQueryDocument( - gql` - mutation Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a mutation operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - expect(() => - getFragmentQueryDocument( - gql` - subscription Named { - a - b - c - } - `, - ), - ).toThrowError( - "Found a subscription operation named 'Named'. No operations are allowed when using a fragment as a query. " + - 'Only fragments are allowed.', - ); - }); - - it('will throw an error if there is not exactly one fragment but no `fragmentName`', () => { - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - `); - }).toThrowError( - 'Found 2 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - } - - fragment baz on Baz { - g - h - i - } - `); - }).toThrowError( - 'Found 3 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - expect(() => { - getFragmentQueryDocument(gql` - scalar Foo - `); - }).toThrowError( - 'Found 0 fragments. `fragmentName` must be provided when there is not exactly 1 fragment.', - ); - }); - - it('will create a query document where the single fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument(gql` - fragment foo on Foo { - a - b - c - } - `), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - `), - ); - }); - - it('will create a query document where the named fragment is spread in the root query', () => { - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'foo', - ), - ), - ).toEqual( - print(gql` - { - ...foo - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'bar', - ), - ), - ).toEqual( - print(gql` - { - ...bar - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - expect( - print( - getFragmentQueryDocument( - gql` - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `, - 'baz', - ), - ), - ).toEqual( - print(gql` - { - ...baz - } - - fragment foo on Foo { - a - b - c - } - - fragment bar on Bar { - d - e - f - ...foo - } - - fragment baz on Baz { - g - h - i - ...foo - ...bar - } - `), - ); - }); -}); diff --git a/node_modules/apollo-utilities/src/__tests__/getFromAST.ts b/node_modules/apollo-utilities/src/__tests__/getFromAST.ts deleted file mode 100644 index a81a5f3c..00000000 --- a/node_modules/apollo-utilities/src/__tests__/getFromAST.ts +++ /dev/null @@ -1,316 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { FragmentDefinitionNode, OperationDefinitionNode } from 'graphql'; - -import { - checkDocument, - getFragmentDefinitions, - getQueryDefinition, - getMutationDefinition, - createFragmentMap, - FragmentMap, - getDefaultValues, - getOperationName, -} from '../getFromAST'; - -describe('AST utility functions', () => { - it('should correctly check a document for correctness', () => { - const multipleQueries = gql` - query { - author { - firstName - lastName - } - } - - query { - author { - address - } - } - `; - expect(() => { - checkDocument(multipleQueries); - }).toThrow(); - - const namedFragment = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - expect(() => { - checkDocument(namedFragment); - }).not.toThrow(); - }); - - it('should get fragment definitions from a document containing a single fragment', () => { - const singleFragmentDefinition = gql` - query { - author { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(singleFragmentDefinition); - expect(actualResult.length).toEqual(expectedResult.length); - expect(print(actualResult[0])).toBe(print(expectedResult[0])); - }); - - it('should get fragment definitions from a document containing a multiple fragments', () => { - const multipleFragmentDefinitions = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedDoc = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `; - const expectedResult: FragmentDefinitionNode[] = [ - expectedDoc.definitions[0] as FragmentDefinitionNode, - expectedDoc.definitions[1] as FragmentDefinitionNode, - ]; - const actualResult = getFragmentDefinitions(multipleFragmentDefinitions); - expect(actualResult.map(print)).toEqual(expectedResult.map(print)); - }); - - it('should get the correct query definition out of a query containing multiple fragments', () => { - const queryWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedDoc = gql` - query { - author { - ...authorDetails - ...moreAuthorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getQueryDefinition(queryWithFragments); - - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should throw if we try to get the query definition of a document with no query', () => { - const mutationWithFragments = gql` - fragment authorDetails on Author { - firstName - lastName - } - - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - expect(() => { - getQueryDefinition(mutationWithFragments); - }).toThrow(); - }); - - it('should get the correct mutation definition out of a mutation with multiple fragments', () => { - const mutationWithFragments = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - - fragment authorDetails on Author { - firstName - lastName - } - `; - const expectedDoc = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - ...authorDetails - } - } - `; - const expectedResult: OperationDefinitionNode = expectedDoc - .definitions[0] as OperationDefinitionNode; - const actualResult = getMutationDefinition(mutationWithFragments); - expect(print(actualResult)).toEqual(print(expectedResult)); - }); - - it('should create the fragment map correctly', () => { - const fragments = getFragmentDefinitions(gql` - fragment authorDetails on Author { - firstName - lastName - } - - fragment moreAuthorDetails on Author { - address - } - `); - const fragmentMap = createFragmentMap(fragments); - const expectedTable: FragmentMap = { - authorDetails: fragments[0], - moreAuthorDetails: fragments[1], - }; - expect(fragmentMap).toEqual(expectedTable); - }); - - it('should return an empty fragment map if passed undefined argument', () => { - expect(createFragmentMap(undefined)).toEqual({}); - }); - - it('should get the operation name out of a query', () => { - const query = gql` - query nameOfQuery { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfQuery'); - }); - - it('should get the operation name out of a mutation', () => { - const query = gql` - mutation nameOfMutation { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual('nameOfMutation'); - }); - - it('should return null if the query does not have an operation name', () => { - const query = gql` - { - fortuneCookie - } - `; - const operationName = getOperationName(query); - expect(operationName).toEqual(null); - }); - - it('should throw if type definitions found in document', () => { - const queryWithTypeDefination = gql` - fragment authorDetails on Author { - firstName - lastName - } - - query($search: AuthorSearchInputType) { - author(search: $search) { - ...authorDetails - } - } - - input AuthorSearchInputType { - firstName: String - } - `; - expect(() => { - getQueryDefinition(queryWithTypeDefination); - }).toThrowError( - 'Schema type definitions not allowed in queries. Found: "InputObjectTypeDefinition"', - ); - }); - - describe('getDefaultValues', () => { - it('will create an empty variable object if no default values are provided', () => { - const basicQuery = gql` - query people($first: Int, $second: String) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({}); - }); - - it('will create a variable object based on the definition node with default values', () => { - const basicQuery = gql` - query people($first: Int = 1, $second: String!) { - allPeople(first: $first) { - people { - name - } - } - } - `; - - const complexMutation = gql` - mutation complexStuff( - $test: Input = { key1: ["value", "value2"], key2: { key3: 4 } } - ) { - complexStuff(test: $test) { - people { - name - } - } - } - `; - - expect(getDefaultValues(getQueryDefinition(basicQuery))).toEqual({ - first: 1, - }); - expect(getDefaultValues(getMutationDefinition(complexMutation))).toEqual({ - test: { key1: ['value', 'value2'], key2: { key3: 4 } }, - }); - }); - }); -}); diff --git a/node_modules/apollo-utilities/src/__tests__/storeUtils.ts b/node_modules/apollo-utilities/src/__tests__/storeUtils.ts deleted file mode 100644 index ba459432..00000000 --- a/node_modules/apollo-utilities/src/__tests__/storeUtils.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { getStoreKeyName } from '../storeUtils'; - -describe('getStoreKeyName', () => { - it( - 'should return a deterministic version of the store key name no matter ' + - 'which order the args object properties are in', - () => { - const validStoreKeyName = - 'someField({"prop1":"value1","prop2":"value2"})'; - let generatedStoreKeyName = getStoreKeyName('someField', { - prop1: 'value1', - prop2: 'value2', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - - generatedStoreKeyName = getStoreKeyName('someField', { - prop2: 'value2', - prop1: 'value1', - }); - expect(generatedStoreKeyName).toEqual(validStoreKeyName); - }, - ); -}); diff --git a/node_modules/apollo-utilities/src/__tests__/transform.ts b/node_modules/apollo-utilities/src/__tests__/transform.ts deleted file mode 100644 index 26835f4c..00000000 --- a/node_modules/apollo-utilities/src/__tests__/transform.ts +++ /dev/null @@ -1,1242 +0,0 @@ -import { print } from 'graphql/language/printer'; -import gql from 'graphql-tag'; -import { disableFragmentWarnings } from 'graphql-tag'; - -// Turn off warnings for repeated fragment names -disableFragmentWarnings(); - -import { - addTypenameToDocument, - removeDirectivesFromDocument, - getDirectivesFromDocument, - removeConnectionDirectiveFromDocument, - removeArgumentsFromDocument, - removeFragmentSpreadFromDocument, - removeClientSetsFromDocument, -} from '../transform'; -import { getQueryDefinition } from '../getFromAST'; - -describe('removeArgumentsFromDocument', () => { - it('should remove a single variable', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - field { - child - foo - } - network - } - `; - const doc = removeArgumentsFromDocument([{ name: 'variable' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a single variable and the field from the query', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) { - child - foo - } - network - } - `; - const expected = gql` - query Simple { - network - } - `; - const doc = removeArgumentsFromDocument( - [{ name: 'variable', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeFragmentSpreadFromDocument', () => { - it('should remove a named fragment spread', () => { - const query = gql` - query Simple { - ...FragmentSpread - property - ...ValidSpread - } - - fragment FragmentSpread on Thing { - foo - bar - baz - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const expected = gql` - query Simple { - property - ...ValidSpread - } - - fragment ValidSpread on Thing { - oof - rab - zab - } - `; - const doc = removeFragmentSpreadFromDocument( - [{ name: 'FragmentSpread', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); -}); -describe('removeDirectivesFromDocument', () => { - it('should not remove unused variable definitions unless the field is removed', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) - networkField - } - `; - - const doc = removeDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove unused variable definitions associated with the removed directive', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove used variable definitions', () => { - const query = gql` - query Simple($variable: String!) { - field(usingVariable: $variable) @client - networkField(usingVariable: $variable) - } - `; - - const expected = gql` - query Simple($variable: String!) { - networkField(usingVariable: $variable) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove fragment spreads and definitions associated with the removed directive', () => { - const query = gql` - query Simple { - networkField - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should not remove fragment spreads and definitions used without the removed directive', () => { - const query = gql` - query Simple { - networkField { - ...ClientFragment - } - field @client { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const expected = gql` - query Simple { - networkField { - ...ClientFragment - } - } - - fragment ClientFragment on Thing { - otherField - bar - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'client', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove only the wanted directive [test function]', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives in the query', () => { - const query = gql` - query Simple { - field @storage(if: true) - other: field @storage - } - `; - - const expected = gql` - query Simple { - field - other: field - } - `; - const doc = removeDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove multiple directives of different kinds in the query', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other: field @client - } - `; - - const expected = gql` - query Simple { - maybe @skip(if: false) - field - other: field - } - `; - const removed = [ - { name: 'storage' }, - { - test: (directive: any) => directive.name.value === 'client', - }, - ]; - const doc = removeDirectivesFromDocument(removed, query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive and its field if needed', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove a simple directive [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - keep - } - `; - - const expected = gql` - query Simple { - keep - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should return null if the query is no longer valid [test function]', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = removeDirectivesFromDocument([{ test, remove: true }], query); - expect(doc).toBe(null); - }); - - it('should return null only if the query is not valid', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(query)); - }); - - it('should return null only if the query is not valid through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should only remove values asked through nested fragments', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - bar - } - `; - - const expectedQuery = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - bar - } - `; - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(print(doc)).toBe(print(expectedQuery)); - }); - - it('should return null even through fragments if needed', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @storage - } - `; - - const doc = removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - query, - ); - - expect(doc).toBe(null); - }); - - it('should not throw in combination with addTypenameToDocument', () => { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - ...inDirection - } - - fragment inDirection on Thing { - field @storage - } - `; - - expect(() => { - removeDirectivesFromDocument( - [{ name: 'storage', remove: true }], - addTypenameToDocument(query), - ); - }).not.toThrow(); - }); -}); - -describe('query transforms', () => { - it('should correctly add typenames', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not add duplicates', () => { - let testQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - } - } - `; - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - __typename - } - __typename - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(print(newQueryDoc)).toBe(expectedQueryStr); - }); - - it('should not screw up on a FragmentSpread within the query AST', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should modify all definitions in a document', () => { - const testQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - } - } - } - - fragment friendFields on User { - firstName - lastName - } - `; - - const newQueryDoc = addTypenameToDocument(testQuery); - - const expectedQuery = gql` - query withFragments { - user(id: 4) { - friends(first: 10) { - ...friendFields - __typename - } - __typename - } - } - - fragment friendFields on User { - firstName - lastName - __typename - } - `; - - expect(print(expectedQuery)).toBe(print(newQueryDoc)); - }); - - it('should be able to apply a QueryTransformer correctly', () => { - const testQuery = gql` - query { - author { - firstName - lastName - } - } - `; - - const expectedQuery = getQueryDefinition(gql` - query { - author { - firstName - lastName - __typename - } - } - `); - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should be able to apply a MutationTransformer correctly', () => { - const testQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - } - } - `; - const expectedQuery = gql` - mutation { - createAuthor(firstName: "John", lastName: "Smith") { - firstName - lastName - __typename - } - } - `; - - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(modifiedQuery)); - }); - - it('should add typename fields correctly on this one query', () => { - const testQuery = gql` - query Feed($type: FeedType!) { - # Eventually move this into a no fetch query right on the entry - # since we literally just need this info to determine whether to - # show upvote/downvote buttons - currentUser { - login - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - } - } - } - } - `; - const expectedQuery = getQueryDefinition(gql` - query Feed($type: FeedType!) { - currentUser { - login - __typename - } - feed(type: $type) { - createdAt - score - commentCount - id - postedBy { - login - html_url - __typename - } - repository { - name - full_name - description - html_url - stargazers_count - open_issues_count - created_at - owner { - avatar_url - __typename - } - __typename - } - __typename - } - } - `); - const modifiedQuery = addTypenameToDocument(testQuery); - expect(print(expectedQuery)).toBe(print(getQueryDefinition(modifiedQuery))); - }); - - it('should correctly remove connections', () => { - let testQuery = gql` - query { - author { - name @connection(key: "foo") { - firstName - lastName - } - } - } - `; - const newQueryDoc = removeConnectionDirectiveFromDocument(testQuery); - - const expectedQuery = gql` - query { - author { - name { - firstName - lastName - } - } - } - `; - const expectedQueryStr = print(expectedQuery); - - expect(expectedQueryStr).toBe(print(newQueryDoc)); - }); -}); - -describe('getDirectivesFromDocument', () => { - it('should get query with fields of storage directive ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of storage directive [test function] ', () => { - const query = gql` - query Simple { - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const test = ({ name: { value } }: { name: any }) => value === 'storage'; - const doc = getDirectivesFromDocument([{ test }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should only get query with multiple fields of storage directive ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - other @storage - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - other @storage - } - `; - const doc = getDirectivesFromDocument([{ name: 'storage' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with fields of both storage and client directives ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [{ name: 'storage' }, { name: 'client' }], - query, - ); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with different types of directive matchers ', () => { - const query = gql` - query Simple { - maybe @skip(if: false) - field @storage(if: true) - user @client - } - `; - - const expected = gql` - query Simple { - field @storage(if: true) - user @client - } - `; - const doc = getDirectivesFromDocument( - [ - { name: 'storage' }, - { test: directive => directive.name.value === 'client' }, - ], - query, - ); - - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with nested fields ', () => { - const query = gql` - query Simple { - user { - firstName @client - email - } - } - `; - - const expected = gql` - query Simple { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should include all the nested fields of field that has client directive ', () => { - const query = gql` - query Simple { - user @client { - firstName - email - } - } - `; - - const expected = gql` - query Simple { - user @client { - firstName - email - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should return null if the query is no longer valid', () => { - const query = gql` - query Simple { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(null); - }); - - it('should get query with client fields in fragment', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in fragment with nested fields', function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - lastName - } - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - user { - firstName @client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get query with client fields in multiple fragments', function() { - const query = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - product - } - `; - const expected = gql` - query Simple { - ...fragmentSpread - ...anotherFragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - - fragment anotherFragmentSpread on AnotherThing { - user @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it("should return null if fragment didn't have client fields", function() { - const query = gql` - query Simple { - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(null)); - }); - - it('should get query with client fields when both fields and fragements are mixed', function() { - const query = gql` - query Simple { - user @client - product @storage - order - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - other - } - `; - const expected = gql` - query Simple { - user @client - ...fragmentSpread - } - - fragment fragmentSpread on Thing { - field @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation with client fields', () => { - const query = gql` - mutation { - login @client - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should get mutation fields of client only', () => { - const query = gql` - mutation { - login @client - updateUser - } - `; - - const expected = gql` - mutation { - login @client - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query); - expect(print(doc)).toBe(print(expected)); - }); - - describe('includeAllFragments', () => { - it('= false: should remove the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, false); - expect(print(doc)).toBe(print(expected)); - }); - - it('= true: should include the values without a client in fragment', () => { - const query = gql` - fragment client on ClientData { - hi @client - bye @storage - bar - } - - query Mixed { - foo @client { - ...client - } - bar { - baz - } - } - `; - - const expected = gql` - fragment client on ClientData { - hi @client - } - - query Mixed { - foo @client { - ...client - } - } - `; - const doc = getDirectivesFromDocument([{ name: 'client' }], query, true); - expect(print(doc)).toBe(print(expected)); - }); - }); -}); - -describe('removeClientSetsFromDocument', () => { - it('should remove @client fields from document', () => { - const query = gql` - query Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - query Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); - - it('should remove @client fields from fragments', () => { - const query = gql` - fragment authorInfo on Author { - name - isLoggedIn @client - } - `; - - const expected = gql` - fragment authorInfo on Author { - name - } - `; - const doc = removeClientSetsFromDocument(query); - expect(print(doc)).toBe(print(expected)); - }); -}); diff --git a/node_modules/apollo-utilities/src/declarations.d.ts b/node_modules/apollo-utilities/src/declarations.d.ts deleted file mode 100644 index 69546655..00000000 --- a/node_modules/apollo-utilities/src/declarations.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'fast-json-stable-stringify'; diff --git a/node_modules/apollo-utilities/src/directives.ts b/node_modules/apollo-utilities/src/directives.ts deleted file mode 100644 index 84c14aba..00000000 --- a/node_modules/apollo-utilities/src/directives.ts +++ /dev/null @@ -1,127 +0,0 @@ -// Provides the methods that allow QueryManager to handle the `skip` and -// `include` directives within GraphQL. -import { - FieldNode, - SelectionNode, - VariableNode, - BooleanValueNode, - DirectiveNode, - DocumentNode, - ArgumentNode, - ValueNode, -} from 'graphql'; - -import { visit } from 'graphql/language/visitor'; - -import { invariant } from 'ts-invariant'; - -import { argumentsObjectFromField } from './storeUtils'; - -export type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }; -}; - -export function getDirectiveInfoFromField( - field: FieldNode, - variables: Object, -): DirectiveInfo { - if (field.directives && field.directives.length) { - const directiveObj: DirectiveInfo = {}; - field.directives.forEach((directive: DirectiveNode) => { - directiveObj[directive.name.value] = argumentsObjectFromField( - directive, - variables, - ); - }); - return directiveObj; - } - return null; -} - -export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any } = {}, -): boolean { - return getInclusionDirectives( - selection.directives, - ).every(({ directive, ifArgument }) => { - let evaledValue: boolean = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables[(ifArgument.value as VariableNode).name.value]; - invariant( - evaledValue !== void 0, - `Invalid variable referenced in @${directive.name.value} directive.`, - ); - } else { - evaledValue = (ifArgument.value as BooleanValueNode).value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} - -export function getDirectiveNames(doc: DocumentNode) { - const names: string[] = []; - - visit(doc, { - Directive(node) { - names.push(node.name.value); - }, - }); - - return names; -} - -export function hasDirectives(names: string[], doc: DocumentNode) { - return getDirectiveNames(doc).some( - (name: string) => names.indexOf(name) > -1, - ); -} - -export function hasClientExports(document: DocumentNode) { - return ( - document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document) - ); -} - -export type InclusionDirectives = Array<{ - directive: DirectiveNode; - ifArgument: ArgumentNode; -}>; - -function isInclusionDirective({ name: { value } }: DirectiveNode): boolean { - return value === 'skip' || value === 'include'; -} - -export function getInclusionDirectives( - directives: ReadonlyArray, -): InclusionDirectives { - return directives ? directives.filter(isInclusionDirective).map(directive => { - const directiveArguments = directive.arguments; - const directiveName = directive.name.value; - - invariant( - directiveArguments && directiveArguments.length === 1, - `Incorrect number of arguments for the @${directiveName} directive.`, - ); - - const ifArgument = directiveArguments[0]; - invariant( - ifArgument.name && ifArgument.name.value === 'if', - `Invalid argument for the @${directiveName} directive.`, - ); - - const ifValue: ValueNode = ifArgument.value; - - // means it has to be a variable value if this is a valid @skip or @include directive - invariant( - ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), - `Argument for the @${directiveName} directive must be a variable or a boolean value.`, - ); - - return { directive, ifArgument }; - }) : []; -} - diff --git a/node_modules/apollo-utilities/src/fragments.ts b/node_modules/apollo-utilities/src/fragments.ts deleted file mode 100644 index f60c86a6..00000000 --- a/node_modules/apollo-utilities/src/fragments.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { DocumentNode, FragmentDefinitionNode } from 'graphql'; -import { invariant, InvariantError } from 'ts-invariant'; - -/** - * Returns a query document which adds a single query operation that only - * spreads the target fragment inside of it. - * - * So for example a document of: - * - * ```graphql - * fragment foo on Foo { a b c } - * ``` - * - * Turns into: - * - * ```graphql - * { ...foo } - * - * fragment foo on Foo { a b c } - * ``` - * - * The target fragment will either be the only fragment in the document, or a - * fragment specified by the provided `fragmentName`. If there is more than one - * fragment, but a `fragmentName` was not defined then an error will be thrown. - */ -export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, -): DocumentNode { - let actualFragmentName = fragmentName; - - // Build an array of all our fragment definitions that will be used for - // validations. We also do some validations on the other definitions in the - // document while building this list. - const fragments: Array = []; - document.definitions.forEach(definition => { - // Throw an error if we encounter an operation definition because we will - // define our own operation definition later on. - if (definition.kind === 'OperationDefinition') { - throw new InvariantError( - `Found a ${definition.operation} operation${ - definition.name ? ` named '${definition.name.value}'` : '' - }. ` + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.', - ); - } - // Add our definition to the fragments array if it is a fragment - // definition. - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - - // If the user did not give us a fragment name then let us try to get a - // name from a single fragment in the definition. - if (typeof actualFragmentName === 'undefined') { - invariant( - fragments.length === 1, - `Found ${ - fragments.length - } fragments. \`fragmentName\` must be provided when there is not exactly 1 fragment.`, - ); - actualFragmentName = fragments[0].name.value; - } - - // Generate a query document with an operation that simply spreads the - // fragment inside of it. - const query: DocumentNode = { - ...document, - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - }, - ...document.definitions, - ], - }; - - return query; -} diff --git a/node_modules/apollo-utilities/src/getFromAST.ts b/node_modules/apollo-utilities/src/getFromAST.ts deleted file mode 100644 index febe5260..00000000 --- a/node_modules/apollo-utilities/src/getFromAST.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { - DocumentNode, - OperationDefinitionNode, - FragmentDefinitionNode, - ValueNode, -} from 'graphql'; - -import { invariant, InvariantError } from 'ts-invariant'; - -import { assign } from './util/assign'; - -import { valueToObjectRepresentation, JsonValue } from './storeUtils'; - -export function getMutationDefinition( - doc: DocumentNode, -): OperationDefinitionNode { - checkDocument(doc); - - let mutationDef: OperationDefinitionNode | null = doc.definitions.filter( - definition => - definition.kind === 'OperationDefinition' && - definition.operation === 'mutation', - )[0] as OperationDefinitionNode; - - invariant(mutationDef, 'Must contain a mutation definition.'); - - return mutationDef; -} - -// Checks the document for errors and throws an exception if there is an error. -export function checkDocument(doc: DocumentNode) { - invariant( - doc && doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - const operations = doc.definitions - .filter(d => d.kind !== 'FragmentDefinition') - .map(definition => { - if (definition.kind !== 'OperationDefinition') { - throw new InvariantError( - `Schema type definitions not allowed in queries. Found: "${ - definition.kind - }"`, - ); - } - return definition; - }); - - invariant( - operations.length <= 1, - `Ambiguous GraphQL document: contains ${operations.length} operations`, - ); - - return doc; -} - -export function getOperationDefinition( - doc: DocumentNode, -): OperationDefinitionNode | undefined { - checkDocument(doc); - return doc.definitions.filter( - definition => definition.kind === 'OperationDefinition', - )[0] as OperationDefinitionNode; -} - -export function getOperationDefinitionOrDie( - document: DocumentNode, -): OperationDefinitionNode { - const def = getOperationDefinition(document); - invariant(def, `GraphQL document is missing an operation`); - return def; -} - -export function getOperationName(doc: DocumentNode): string | null { - return ( - doc.definitions - .filter( - definition => - definition.kind === 'OperationDefinition' && definition.name, - ) - .map((x: OperationDefinitionNode) => x.name.value)[0] || null - ); -} - -// Returns the FragmentDefinitions from a particular document as an array -export function getFragmentDefinitions( - doc: DocumentNode, -): FragmentDefinitionNode[] { - return doc.definitions.filter( - definition => definition.kind === 'FragmentDefinition', - ) as FragmentDefinitionNode[]; -} - -export function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode { - const queryDef = getOperationDefinition(doc) as OperationDefinitionNode; - - invariant( - queryDef && queryDef.operation === 'query', - 'Must contain a query definition.', - ); - - return queryDef; -} - -export function getFragmentDefinition( - doc: DocumentNode, -): FragmentDefinitionNode { - invariant( - doc.kind === 'Document', - `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \ -string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`, - ); - - invariant( - doc.definitions.length <= 1, - 'Fragment must have exactly one definition.', - ); - - const fragmentDef = doc.definitions[0] as FragmentDefinitionNode; - - invariant( - fragmentDef.kind === 'FragmentDefinition', - 'Must be a fragment definition.', - ); - - return fragmentDef as FragmentDefinitionNode; -} - -/** - * Returns the first operation definition found in this document. - * If no operation definition is found, the first fragment definition will be returned. - * If no definitions are found, an error will be thrown. - */ -export function getMainDefinition( - queryDoc: DocumentNode, -): OperationDefinitionNode | FragmentDefinitionNode { - checkDocument(queryDoc); - - let fragmentDefinition; - - for (let definition of queryDoc.definitions) { - if (definition.kind === 'OperationDefinition') { - const operation = (definition as OperationDefinitionNode).operation; - if ( - operation === 'query' || - operation === 'mutation' || - operation === 'subscription' - ) { - return definition as OperationDefinitionNode; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - // we do this because we want to allow multiple fragment definitions - // to precede an operation definition. - fragmentDefinition = definition as FragmentDefinitionNode; - } - } - - if (fragmentDefinition) { - return fragmentDefinition; - } - - throw new InvariantError( - 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.', - ); -} - -/** - * This is an interface that describes a map from fragment names to fragment definitions. - */ -export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; -} - -// Utility function that takes a list of fragment definitions and makes a hash out of them -// that maps the name of the fragment to the fragment definition. -export function createFragmentMap( - fragments: FragmentDefinitionNode[] = [], -): FragmentMap { - const symTable: FragmentMap = {}; - fragments.forEach(fragment => { - symTable[fragment.name.value] = fragment; - }); - - return symTable; -} - -export function getDefaultValues( - definition: OperationDefinitionNode | undefined, -): { [key: string]: JsonValue } { - if ( - definition && - definition.variableDefinitions && - definition.variableDefinitions.length - ) { - const defaultValues = definition.variableDefinitions - .filter(({ defaultValue }) => defaultValue) - .map( - ({ variable, defaultValue }): { [key: string]: JsonValue } => { - const defaultValueObj: { [key: string]: JsonValue } = {}; - valueToObjectRepresentation( - defaultValueObj, - variable.name, - defaultValue as ValueNode, - ); - - return defaultValueObj; - }, - ); - - return assign({}, ...defaultValues); - } - - return {}; -} - -/** - * Returns the names of all variables declared by the operation. - */ -export function variablesInOperation( - operation: OperationDefinitionNode, -): Set { - const names = new Set(); - if (operation.variableDefinitions) { - for (const definition of operation.variableDefinitions) { - names.add(definition.variable.name.value); - } - } - - return names; -} diff --git a/node_modules/apollo-utilities/src/index.js.flow b/node_modules/apollo-utilities/src/index.js.flow deleted file mode 100644 index a7fc594d..00000000 --- a/node_modules/apollo-utilities/src/index.js.flow +++ /dev/null @@ -1,220 +0,0 @@ -// @flow -import type { - DirectiveNode, - StringValueNode, - BooleanValueNode, - IntValueNode, - FloatValueNode, - EnumValueNode, - VariableNode, - FieldNode, - FragmentDefinitionNode, - OperationDefinitionNode, - SelectionNode, - DocumentNode, - DefinitionNode, - ValueNode, - NameNode, -} from 'graphql'; - -declare module 'apollo-utilities' { - // storeUtils - declare export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | void; - } - - declare export interface JsonValue { - type: 'json'; - json: any; - } - - declare export type ListValue = Array; - - declare export type StoreValue = - | number - | string - | Array - | IdValue - | ListValue - | JsonValue - | null - | void - | Object; - - declare export type ScalarValue = - | StringValueNode - | BooleanValueNode - | EnumValueNode; - - declare export type NumberValue = IntValueNode | FloatValueNode; - - declare type isValueFn = (value: ValueNode) => boolean; - - declare export type isScalarValue = isValueFn; - declare export type isNumberValue = isValueFn; - declare export type isStringValue = isValueFn; - declare export type isBooleanValue = isValueFn; - declare export type isIntValue = isValueFn; - declare export type isFloatValue = isValueFn; - declare export type isVariable = isValueFn; - declare export type isObjectValue = isValueFn; - declare export type isListValue = isValueFn; - declare export type isEnumValue = isValueFn; - - declare export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, - ): any; - - declare export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, - ): string; - - declare export type Directives = { - [directiveName: string]: { - [argName: string]: any, - }, - }; - - declare export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, - ): string; - - declare export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, - ): ?Object; - - declare export function resultKeyNameFromField(field: FieldNode): string; - - declare export function isField(selection: SelectionNode): boolean; - - declare export function isInlineFragment(selection: SelectionNode): boolean; - - declare export function isIdValue(idObject: StoreValue): boolean; - - declare export type IdConfig = { - id: string, - typename: string | void, - }; - - declare export function toIdValue( - id: string | IdConfig, - generated?: boolean, - ): IdValue; - - declare export function isJsonValue(jsonObject: StoreValue): boolean; - - declare export type VariableValue = (node: VariableNode) => any; - - declare export function valueFromNode( - node: ValueNode, - onVariable: VariableValue, - ): any; - - // getFromAST - declare export function getMutationDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function checkDocument(doc: DocumentNode): void; - - declare export function getOperationDefinition( - doc: DocumentNode, - ): ?OperationDefinitionNode; - - declare export function getOperationDefinitionOrDie( - document: DocumentNode, - ): OperationDefinitionNode; - - declare export function getOperationName(doc: DocumentNode): ?string; - - declare export function getFragmentDefinitions( - doc: DocumentNode, - ): Array; - - declare export function getQueryDefinition( - doc: DocumentNode, - ): OperationDefinitionNode; - - declare export function getFragmentDefinition( - doc: DocumentNode, - ): FragmentDefinitionNode; - - declare export function getMainDefinition( - queryDoc: DocumentNode, - ): OperationDefinitionNode | FragmentDefinitionNode; - - declare export interface FragmentMap { - [fragmentName: string]: FragmentDefinitionNode; - } - - declare export function createFragmentMap( - fragments: Array, - ): FragmentMap; - - declare export function getDefaultValues( - definition: ?OperationDefinitionNode, - ): { [key: string]: JsonValue }; - - // fragments - declare export function getFragmentQueryDocument( - document: DocumentNode, - fragmentName?: string, - ): DocumentNode; - - declare export function variablesInOperation( - operation: OperationDefinitionNode, - ): Set; - - // directives - declare type DirectiveInfo = { - [fieldName: string]: { [argName: string]: any }, - }; - - declare export function getDirectiveInfoFromField( - field: FieldNode, - object: Object, - ): ?DirectiveInfo; - - declare export function shouldInclude( - selection: SelectionNode, - variables: { [name: string]: any }, - ): boolean; - - declare export function flattenSelections( - selection: SelectionNode, - ): Array; - - declare export function getDirectiveNames(doc: DocumentNode): Array; - - declare export function hasDirectives( - names: Array, - doc: DocumentNode, - ): boolean; - - // transform - declare export type RemoveDirectiveConfig = { - name?: string, - test?: (directive: DirectiveNode) => boolean, - }; - - declare export function removeDirectivesFromDocument( - directives: Array, - doc: DocumentNode, - ): DocumentNode; - - declare export function addTypenameToDocument(doc: DocumentNode): void; - - declare export function removeConnectionDirectiveFromDocument( - doc: DocumentNode, - ): DocumentNode; -} diff --git a/node_modules/apollo-utilities/src/index.ts b/node_modules/apollo-utilities/src/index.ts deleted file mode 100644 index 18b0a815..00000000 --- a/node_modules/apollo-utilities/src/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -export * from './directives'; -export * from './fragments'; -export * from './getFromAST'; -export * from './transform'; -export * from './storeUtils'; -export * from './util/assign'; -export * from './util/canUse'; -export * from './util/cloneDeep'; -export * from './util/environment'; -export * from './util/errorHandling'; -export * from './util/isEqual'; -export * from './util/maybeDeepFreeze'; -export * from './util/mergeDeep'; -export * from './util/warnOnce'; -export * from './util/stripSymbols'; -export * from './util/mergeDeep'; diff --git a/node_modules/apollo-utilities/src/storeUtils.ts b/node_modules/apollo-utilities/src/storeUtils.ts deleted file mode 100644 index 2bd1e53a..00000000 --- a/node_modules/apollo-utilities/src/storeUtils.ts +++ /dev/null @@ -1,340 +0,0 @@ -import { - DirectiveNode, - FieldNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - ObjectValueNode, - ListValueNode, - EnumValueNode, - NullValueNode, - VariableNode, - InlineFragmentNode, - ValueNode, - SelectionNode, - NameNode, -} from 'graphql'; - -import stringify from 'fast-json-stable-stringify'; -import { InvariantError } from 'ts-invariant'; - -export interface IdValue { - type: 'id'; - id: string; - generated: boolean; - typename: string | undefined; -} - -export interface JsonValue { - type: 'json'; - json: any; -} - -export type ListValue = Array; - -export type StoreValue = - | number - | string - | string[] - | IdValue - | ListValue - | JsonValue - | null - | undefined - | void - | Object; - -export type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode; - -export function isScalarValue(value: ValueNode): value is ScalarValue { - return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; -} - -export type NumberValue = IntValueNode | FloatValueNode; - -export function isNumberValue(value: ValueNode): value is NumberValue { - return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; -} - -function isStringValue(value: ValueNode): value is StringValueNode { - return value.kind === 'StringValue'; -} - -function isBooleanValue(value: ValueNode): value is BooleanValueNode { - return value.kind === 'BooleanValue'; -} - -function isIntValue(value: ValueNode): value is IntValueNode { - return value.kind === 'IntValue'; -} - -function isFloatValue(value: ValueNode): value is FloatValueNode { - return value.kind === 'FloatValue'; -} - -function isVariable(value: ValueNode): value is VariableNode { - return value.kind === 'Variable'; -} - -function isObjectValue(value: ValueNode): value is ObjectValueNode { - return value.kind === 'ObjectValue'; -} - -function isListValue(value: ValueNode): value is ListValueNode { - return value.kind === 'ListValue'; -} - -function isEnumValue(value: ValueNode): value is EnumValueNode { - return value.kind === 'EnumValue'; -} - -function isNullValue(value: ValueNode): value is NullValueNode { - return value.kind === 'NullValue'; -} - -export function valueToObjectRepresentation( - argObj: any, - name: NameNode, - value: ValueNode, - variables?: Object, -) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } else if (isObjectValue(value)) { - const nestedArgObj = {}; - value.fields.map(obj => - valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables), - ); - argObj[name.value] = nestedArgObj; - } else if (isVariable(value)) { - const variableValue = (variables || ({} as any))[value.name.value]; - argObj[name.value] = variableValue; - } else if (isListValue(value)) { - argObj[name.value] = value.values.map(listValue => { - const nestedArgArrayObj = {}; - valueToObjectRepresentation( - nestedArgArrayObj, - name, - listValue, - variables, - ); - return (nestedArgArrayObj as any)[name.value]; - }); - } else if (isEnumValue(value)) { - argObj[name.value] = (value as EnumValueNode).value; - } else if (isNullValue(value)) { - argObj[name.value] = null; - } else { - throw new InvariantError( - `The inline argument "${name.value}" of kind "${(value as any).kind}"` + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.', - ); - } -} - -export function storeKeyNameFromField( - field: FieldNode, - variables?: Object, -): string { - let directivesObj: any = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(directive => { - directivesObj[directive.name.value] = {}; - - if (directive.arguments) { - directive.arguments.forEach(({ name, value }) => - valueToObjectRepresentation( - directivesObj[directive.name.value], - name, - value, - variables, - ), - ); - } - }); - } - - let argObj: any = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - } - - return getStoreKeyName(field.name.value, argObj, directivesObj); -} - -export type Directives = { - [directiveName: string]: { - [argName: string]: any; - }; -}; - -const KNOWN_DIRECTIVES: string[] = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; - -export function getStoreKeyName( - fieldName: string, - args?: Object, - directives?: Directives, -): string { - if ( - directives && - directives['connection'] && - directives['connection']['key'] - ) { - if ( - directives['connection']['filter'] && - (directives['connection']['filter'] as string[]).length > 0 - ) { - const filterKeys = directives['connection']['filter'] - ? (directives['connection']['filter'] as string[]) - : []; - filterKeys.sort(); - - const queryArgs = args as { [key: string]: any }; - const filteredArgs = {} as { [key: string]: any }; - filterKeys.forEach(key => { - filteredArgs[key] = queryArgs[key]; - }); - - return `${directives['connection']['key']}(${JSON.stringify( - filteredArgs, - )})`; - } else { - return directives['connection']['key']; - } - } - - let completeFieldName: string = fieldName; - - if (args) { - // We can't use `JSON.stringify` here since it's non-deterministic, - // and can lead to different store key names being created even though - // the `args` object used during creation has the same properties/values. - const stringifiedArgs: string = stringify(args); - completeFieldName += `(${stringifiedArgs})`; - } - - if (directives) { - Object.keys(directives).forEach(key => { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += `@${key}(${JSON.stringify(directives[key])})`; - } else { - completeFieldName += `@${key}`; - } - }); - } - - return completeFieldName; -} - -export function argumentsObjectFromField( - field: FieldNode | DirectiveNode, - variables: Object, -): Object { - if (field.arguments && field.arguments.length) { - const argObj: Object = {}; - field.arguments.forEach(({ name, value }) => - valueToObjectRepresentation(argObj, name, value, variables), - ); - return argObj; - } - - return null; -} - -export function resultKeyNameFromField(field: FieldNode): string { - return field.alias ? field.alias.value : field.name.value; -} - -export function isField(selection: SelectionNode): selection is FieldNode { - return selection.kind === 'Field'; -} - -export function isInlineFragment( - selection: SelectionNode, -): selection is InlineFragmentNode { - return selection.kind === 'InlineFragment'; -} - -export function isIdValue(idObject: StoreValue): idObject is IdValue { - return idObject && - (idObject as IdValue | JsonValue).type === 'id' && - typeof (idObject as IdValue).generated === 'boolean'; -} - -export type IdConfig = { - id: string; - typename: string | undefined; -}; - -export function toIdValue( - idConfig: string | IdConfig, - generated = false, -): IdValue { - return { - type: 'id', - generated, - ...(typeof idConfig === 'string' - ? { id: idConfig, typename: undefined } - : idConfig), - }; -} - -export function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue { - return ( - jsonObject != null && - typeof jsonObject === 'object' && - (jsonObject as IdValue | JsonValue).type === 'json' - ); -} - -function defaultValueFromVariable(node: VariableNode) { - throw new InvariantError(`Variable nodes are not supported by valueFromNode`); -} - -export type VariableValue = (node: VariableNode) => any; - -/** - * Evaluate a ValueNode and yield its value in its natural JS form. - */ -export function valueFromNode( - node: ValueNode, - onVariable: VariableValue = defaultValueFromVariable, -): any { - switch (node.kind) { - case 'Variable': - return onVariable(node); - case 'NullValue': - return null; - case 'IntValue': - return parseInt(node.value, 10); - case 'FloatValue': - return parseFloat(node.value); - case 'ListValue': - return node.values.map(v => valueFromNode(v, onVariable)); - case 'ObjectValue': { - const value: { [key: string]: any } = {}; - for (const field of node.fields) { - value[field.name.value] = valueFromNode(field.value, onVariable); - } - return value; - } - default: - return node.value; - } -} diff --git a/node_modules/apollo-utilities/src/transform.ts b/node_modules/apollo-utilities/src/transform.ts deleted file mode 100644 index d77b8e54..00000000 --- a/node_modules/apollo-utilities/src/transform.ts +++ /dev/null @@ -1,542 +0,0 @@ -import { - DocumentNode, - SelectionNode, - SelectionSetNode, - OperationDefinitionNode, - FieldNode, - DirectiveNode, - FragmentDefinitionNode, - ArgumentNode, - FragmentSpreadNode, - VariableDefinitionNode, - VariableNode, -} from 'graphql'; -import { visit } from 'graphql/language/visitor'; - -import { - checkDocument, - getOperationDefinition, - getFragmentDefinition, - getFragmentDefinitions, - createFragmentMap, - FragmentMap, - getMainDefinition, -} from './getFromAST'; -import { filterInPlace } from './util/filterInPlace'; -import { invariant } from 'ts-invariant'; -import { isField, isInlineFragment } from './storeUtils'; - -export type RemoveNodeConfig = { - name?: string; - test?: (node: N) => boolean; - remove?: boolean; -}; - -export type GetNodeConfig = { - name?: string; - test?: (node: N) => boolean; -}; - -export type RemoveDirectiveConfig = RemoveNodeConfig; -export type GetDirectiveConfig = GetNodeConfig; -export type RemoveArgumentsConfig = RemoveNodeConfig; -export type GetFragmentSpreadConfig = GetNodeConfig; -export type RemoveFragmentSpreadConfig = RemoveNodeConfig; -export type RemoveFragmentDefinitionConfig = RemoveNodeConfig< - FragmentDefinitionNode ->; -export type RemoveVariableDefinitionConfig = RemoveNodeConfig< - VariableDefinitionNode ->; - -const TYPENAME_FIELD: FieldNode = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; - -function isEmpty( - op: OperationDefinitionNode | FragmentDefinitionNode, - fragments: FragmentMap, -): boolean { - return op.selectionSet.selections.every( - selection => - selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments), - ); -} - -function nullIfDocIsEmpty(doc: DocumentNode) { - return isEmpty( - getOperationDefinition(doc) || getFragmentDefinition(doc), - createFragmentMap(getFragmentDefinitions(doc)), - ) - ? null - : doc; -} - -function getDirectiveMatcher( - directives: (RemoveDirectiveConfig | GetDirectiveConfig)[], -) { - return function directiveMatcher(directive: DirectiveNode) { - return directives.some( - dir => - (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)), - ); - }; -} - -export function removeDirectivesFromDocument( - directives: RemoveDirectiveConfig[], - doc: DocumentNode, -): DocumentNode | null { - const variablesInUse: Record = Object.create(null); - let variablesToRemove: RemoveArgumentsConfig[] = []; - - const fragmentSpreadsInUse: Record = Object.create(null); - let fragmentSpreadsToRemove: RemoveFragmentSpreadConfig[] = []; - - let modifiedDoc = nullIfDocIsEmpty( - visit(doc, { - Variable: { - enter(node, _key, parent) { - // Store each variable that's referenced as part of an argument - // (excluding operation definition variables), so we know which - // variables are being used. If we later want to remove a variable - // we'll fist check to see if it's being used, before continuing with - // the removal. - if ( - (parent as VariableDefinitionNode).kind !== 'VariableDefinition' - ) { - variablesInUse[node.name.value] = true; - } - }, - }, - - Field: { - enter(node) { - if (directives && node.directives) { - // If `remove` is set to true for a directive, and a directive match - // is found for a field, remove the field as well. - const shouldRemoveField = directives.some( - directive => directive.remove, - ); - - if ( - shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives)) - ) { - if (node.arguments) { - // Store field argument variables so they can be removed - // from the operation definition. - node.arguments.forEach(arg => { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: (arg.value as VariableNode).name.value, - }); - } - }); - } - - if (node.selectionSet) { - // Store fragment spread names so they can be removed from the - // docuemnt. - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach( - frag => { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }, - ); - } - - // Remove the field. - return null; - } - } - }, - }, - - FragmentSpread: { - enter(node) { - // Keep track of referenced fragment spreads. This is used to - // determine if top level fragment definitions should be removed. - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - - Directive: { - enter(node) { - // If a matching directive is found, remove it. - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - }), - ); - - // If we've removed fields with arguments, make sure the associated - // variables are also removed from the rest of the document, as long as they - // aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(variablesToRemove, v => !variablesInUse[v.name]).length - ) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - - // If we've removed selection sets with fragment spreads, make sure the - // associated fragment definitions are also removed from the rest of the - // document, as long as they aren't being used elsewhere. - if ( - modifiedDoc && - filterInPlace(fragmentSpreadsToRemove, fs => !fragmentSpreadsInUse[fs.name]) - .length - ) { - modifiedDoc = removeFragmentSpreadFromDocument( - fragmentSpreadsToRemove, - modifiedDoc, - ); - } - - return modifiedDoc; -} - -export function addTypenameToDocument(doc: DocumentNode): DocumentNode { - return visit(checkDocument(doc), { - SelectionSet: { - enter(node, _key, parent) { - // Don't add __typename to OperationDefinitions. - if ( - parent && - (parent as OperationDefinitionNode).kind === 'OperationDefinition' - ) { - return; - } - - // No changes if no selections. - const { selections } = node; - if (!selections) { - return; - } - - // If selections already have a __typename, or are part of an - // introspection query, do nothing. - const skip = selections.some(selection => { - return ( - isField(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0) - ); - }); - if (skip) { - return; - } - - // If this SelectionSet is @export-ed as an input variable, it should - // not have a __typename field (see issue #4691). - const field = parent as FieldNode; - if ( - isField(field) && - field.directives && - field.directives.some(d => d.name.value === 'export') - ) { - return; - } - - // Create and return a new SelectionSet with a __typename Field. - return { - ...node, - selections: [...selections, TYPENAME_FIELD], - }; - }, - }, - }); -} - -const connectionRemoveConfig = { - test: (directive: DirectiveNode) => { - const willRemove = directive.name.value === 'connection'; - if (willRemove) { - if ( - !directive.arguments || - !directive.arguments.some(arg => arg.name.value === 'key') - ) { - invariant.warn( - 'Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.', - ); - } - } - - return willRemove; - }, -}; - -export function removeConnectionDirectiveFromDocument(doc: DocumentNode) { - return removeDirectivesFromDocument( - [connectionRemoveConfig], - checkDocument(doc), - ); -} - -function hasDirectivesInSelectionSet( - directives: GetDirectiveConfig[], - selectionSet: SelectionSetNode, - nestedCheck = true, -): boolean { - return ( - selectionSet && - selectionSet.selections && - selectionSet.selections.some(selection => - hasDirectivesInSelection(directives, selection, nestedCheck), - ) - ); -} - -function hasDirectivesInSelection( - directives: GetDirectiveConfig[], - selection: SelectionNode, - nestedCheck = true, -): boolean { - if (!isField(selection)) { - return true; - } - - if (!selection.directives) { - return false; - } - - return ( - selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet( - directives, - selection.selectionSet, - nestedCheck, - )) - ); -} - -export function getDirectivesFromDocument( - directives: GetDirectiveConfig[], - doc: DocumentNode, -): DocumentNode { - checkDocument(doc); - - let parentPath: string; - - return nullIfDocIsEmpty( - visit(doc, { - SelectionSet: { - enter(node, _key, _parent, path) { - const currentPath = path.join('-'); - - if ( - !parentPath || - currentPath === parentPath || - !currentPath.startsWith(parentPath) - ) { - if (node.selections) { - const selectionsWithDirectives = node.selections.filter( - selection => hasDirectivesInSelection(directives, selection), - ); - - if (hasDirectivesInSelectionSet(directives, node, false)) { - parentPath = currentPath; - } - - return { - ...node, - selections: selectionsWithDirectives, - }; - } else { - return null; - } - } - }, - }, - }), - ); -} - -function getArgumentMatcher(config: RemoveArgumentsConfig[]) { - return function argumentMatcher(argument: ArgumentNode) { - return config.some( - (aConfig: RemoveArgumentsConfig) => - argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))), - ); - }; -} - -export function removeArgumentsFromDocument( - config: RemoveArgumentsConfig[], - doc: DocumentNode, -): DocumentNode { - const argMatcher = getArgumentMatcher(config); - - return nullIfDocIsEmpty( - visit(doc, { - OperationDefinition: { - enter(node) { - return { - ...node, - // Remove matching top level variables definitions. - variableDefinitions: node.variableDefinitions.filter( - varDef => - !config.some(arg => arg.name === varDef.variable.name.value), - ), - }; - }, - }, - - Field: { - enter(node) { - // If `remove` is set to true for an argument, and an argument match - // is found for a field, remove the field as well. - const shouldRemoveField = config.some(argConfig => argConfig.remove); - - if (shouldRemoveField) { - let argMatchCount = 0; - node.arguments.forEach(arg => { - if (argMatcher(arg)) { - argMatchCount += 1; - } - }); - if (argMatchCount === 1) { - return null; - } - } - }, - }, - - Argument: { - enter(node) { - // Remove all matching arguments. - if (argMatcher(node)) { - return null; - } - }, - }, - }), - ); -} - -export function removeFragmentSpreadFromDocument( - config: RemoveFragmentSpreadConfig[], - doc: DocumentNode, -): DocumentNode { - function enter( - node: FragmentSpreadNode | FragmentDefinitionNode, - ): null | void { - if (config.some(def => def.name === node.name.value)) { - return null; - } - } - - return nullIfDocIsEmpty( - visit(doc, { - FragmentSpread: { enter }, - FragmentDefinition: { enter }, - }), - ); -} - -function getAllFragmentSpreadsFromSelectionSet( - selectionSet: SelectionSetNode, -): FragmentSpreadNode[] { - const allFragments: FragmentSpreadNode[] = []; - - selectionSet.selections.forEach(selection => { - if ( - (isField(selection) || isInlineFragment(selection)) && - selection.selectionSet - ) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach( - frag => allFragments.push(frag), - ); - } else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - - return allFragments; -} - -// If the incoming document is a query, return it as is. Otherwise, build a -// new document containing a query operation based on the selection set -// of the previous main operation. -export function buildQueryFromSelectionSet( - document: DocumentNode, -): DocumentNode { - const definition = getMainDefinition(document); - const definitionOperation = (definition).operation; - - if (definitionOperation === 'query') { - // Already a query, so return the existing document. - return document; - } - - // Build a new query using the selection set of the main operation. - const modifiedDoc = visit(document, { - OperationDefinition: { - enter(node) { - return { - ...node, - operation: 'query', - }; - }, - }, - }); - return modifiedDoc; -} - -// Remove fields / selection sets that include an @client directive. -export function removeClientSetsFromDocument( - document: DocumentNode, -): DocumentNode | null { - checkDocument(document); - - let modifiedDoc = removeDirectivesFromDocument( - [ - { - test: (directive: DirectiveNode) => directive.name.value === 'client', - remove: true, - }, - ], - document, - ); - - // After a fragment definition has had its @client related document - // sets removed, if the only field it has left is a __typename field, - // remove the entire fragment operation to prevent it from being fired - // on the server. - if (modifiedDoc) { - modifiedDoc = visit(modifiedDoc, { - FragmentDefinition: { - enter(node) { - if (node.selectionSet) { - const isTypenameOnly = node.selectionSet.selections.every( - selection => - isField(selection) && selection.name.value === '__typename', - ); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - - return modifiedDoc; -} diff --git a/node_modules/apollo-utilities/src/util/__tests__/assign.ts b/node_modules/apollo-utilities/src/util/__tests__/assign.ts deleted file mode 100644 index 6d3ef045..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/assign.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { assign } from '../assign'; - -describe('assign', () => { - it('will merge many objects together', () => { - expect(assign({ a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 })).toEqual({ - a: 1, - b: 2, - c: 3, - }); - expect(assign({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 })).toEqual({ - a: 1, - b: 2, - c: 3, - d: 4, - }); - }); - - it('will merge many objects together shallowly', () => { - expect(assign({ x: { a: 1 } }, { x: { b: 2 } })).toEqual({ x: { b: 2 } }); - expect(assign({ x: { a: 1 } }, { x: { b: 2 } }, { x: { c: 3 } })).toEqual({ - x: { c: 3 }, - }); - expect( - assign( - { x: { a: 1 } }, - { x: { b: 2 } }, - { x: { c: 3 } }, - { x: { d: 4 } }, - ), - ).toEqual({ x: { d: 4 } }); - }); - - it('will mutate and return the source objects', () => { - const source1 = { a: 1 }; - const source2 = { a: 1 }; - const source3 = { a: 1 }; - - expect(assign(source1, { b: 2 })).toEqual(source1); - expect(assign(source2, { b: 2 }, { c: 3 })).toEqual(source2); - expect(assign(source3, { b: 2 }, { c: 3 }, { d: 4 })).toEqual(source3); - - expect(source1).toEqual({ a: 1, b: 2 }); - expect(source2).toEqual({ a: 1, b: 2, c: 3 }); - expect(source3).toEqual({ a: 1, b: 2, c: 3, d: 4 }); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts b/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts deleted file mode 100644 index 52b491b5..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/cloneDeep.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { cloneDeep } from '../cloneDeep'; - -describe('cloneDeep', () => { - it('will clone primitive values', () => { - expect(cloneDeep(undefined)).toEqual(undefined); - expect(cloneDeep(null)).toEqual(null); - expect(cloneDeep(true)).toEqual(true); - expect(cloneDeep(false)).toEqual(false); - expect(cloneDeep(-1)).toEqual(-1); - expect(cloneDeep(+1)).toEqual(+1); - expect(cloneDeep(0.5)).toEqual(0.5); - expect(cloneDeep('hello')).toEqual('hello'); - expect(cloneDeep('world')).toEqual('world'); - }); - - it('will clone objects', () => { - const value1 = {}; - const value2 = { a: 1, b: 2, c: 3 }; - const value3 = { x: { a: 1, b: 2, c: 3 }, y: { a: 1, b: 2, c: 3 } }; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3.x).toEqual(value3.x); - expect(clonedValue3.y).toEqual(value3.y); - }); - - it('will clone arrays', () => { - const value1: Array = []; - const value2 = [1, 2, 3]; - const value3 = [[1, 2, 3], [1, 2, 3]]; - - const clonedValue1 = cloneDeep(value1); - const clonedValue2 = cloneDeep(value2); - const clonedValue3 = cloneDeep(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - - expect(clonedValue1).toEqual(value1); - expect(clonedValue2).toEqual(value2); - expect(clonedValue3).toEqual(value3); - expect(clonedValue3[0]).toEqual(value3[0]); - expect(clonedValue3[1]).toEqual(value3[1]); - }); - - it('should not attempt to follow circular references', () => { - const someObject = { - prop1: 'value1', - anotherObject: null, - }; - const anotherObject = { - someObject, - }; - someObject.anotherObject = anotherObject; - let chk; - expect(() => { - chk = cloneDeep(someObject); - }).not.toThrow(); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/__tests__/environment.ts b/node_modules/apollo-utilities/src/util/__tests__/environment.ts deleted file mode 100644 index dcb71538..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/environment.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { isEnv, isProduction, isDevelopment, isTest } from '../environment'; - -describe('environment', () => { - let keepEnv: string | undefined; - - beforeEach(() => { - // save the NODE_ENV - keepEnv = process.env.NODE_ENV; - }); - - afterEach(() => { - // restore the NODE_ENV - process.env.NODE_ENV = keepEnv; - }); - - describe('isEnv', () => { - it(`should match when there's a value`, () => { - ['production', 'development', 'test'].forEach(env => { - process.env.NODE_ENV = env; - expect(isEnv(env)).toBe(true); - }); - }); - - it(`should treat no proces.env.NODE_ENV as it'd be in development`, () => { - delete process.env.NODE_ENV; - expect(isEnv('development')).toBe(true); - }); - }); - - describe('isProduction', () => { - it('should return true if in production', () => { - process.env.NODE_ENV = 'production'; - expect(isProduction()).toBe(true); - }); - - it('should return false if not in production', () => { - process.env.NODE_ENV = 'test'; - expect(!isProduction()).toBe(true); - }); - }); - - describe('isTest', () => { - it('should return true if in test', () => { - process.env.NODE_ENV = 'test'; - expect(isTest()).toBe(true); - }); - - it('should return true if not in test', () => { - process.env.NODE_ENV = 'development'; - expect(!isTest()).toBe(true); - }); - }); - - describe('isDevelopment', () => { - it('should return true if in development', () => { - process.env.NODE_ENV = 'development'; - expect(isDevelopment()).toBe(true); - }); - - it('should return true if not in development and environment is defined', () => { - process.env.NODE_ENV = 'test'; - expect(!isDevelopment()).toBe(true); - }); - - it('should make development as the default environment', () => { - delete process.env.NODE_ENV; - expect(isDevelopment()).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts b/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts deleted file mode 100644 index e621a837..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/isEqual.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { isEqual } from '../isEqual'; - -describe('isEqual', () => { - it('should return true for equal primitive values', () => { - expect(isEqual(undefined, undefined)).toBe(true); - expect(isEqual(null, null)).toBe(true); - expect(isEqual(true, true)).toBe(true); - expect(isEqual(false, false)).toBe(true); - expect(isEqual(-1, -1)).toBe(true); - expect(isEqual(+1, +1)).toBe(true); - expect(isEqual(42, 42)).toBe(true); - expect(isEqual(0, 0)).toBe(true); - expect(isEqual(0.5, 0.5)).toBe(true); - expect(isEqual('hello', 'hello')).toBe(true); - expect(isEqual('world', 'world')).toBe(true); - }); - - it('should return false for not equal primitive values', () => { - expect(!isEqual(undefined, null)).toBe(true); - expect(!isEqual(null, undefined)).toBe(true); - expect(!isEqual(true, false)).toBe(true); - expect(!isEqual(false, true)).toBe(true); - expect(!isEqual(-1, +1)).toBe(true); - expect(!isEqual(+1, -1)).toBe(true); - expect(!isEqual(42, 42.00000000000001)).toBe(true); - expect(!isEqual(0, 0.5)).toBe(true); - expect(!isEqual('hello', 'world')).toBe(true); - expect(!isEqual('world', 'hello')).toBe(true); - }); - - it('should return false when comparing primitives with objects', () => { - expect(!isEqual({}, null)).toBe(true); - expect(!isEqual(null, {})).toBe(true); - expect(!isEqual({}, true)).toBe(true); - expect(!isEqual(true, {})).toBe(true); - expect(!isEqual({}, 42)).toBe(true); - expect(!isEqual(42, {})).toBe(true); - expect(!isEqual({}, 'hello')).toBe(true); - expect(!isEqual('hello', {})).toBe(true); - }); - - it('should correctly compare shallow objects', () => { - expect(isEqual({}, {})).toBe(true); - expect(isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 3, b: 2, c: 1 })).toBe(true); - expect(!isEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toBe(true); - expect(!isEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toBe(true); - }); - - it('should correctly compare deep objects', () => { - expect(isEqual({ x: {} }, { x: {} })).toBe(true); - expect( - isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2, c: 3 } }), - ).toBe(true); - expect( - !isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 3, b: 2, c: 1 } }), - ).toBe(true); - expect(!isEqual({ x: { a: 1, b: 2, c: 3 } }, { x: { a: 1, b: 2 } })).toBe( - true, - ); - expect(!isEqual({ x: { a: 1, b: 2 } }, { x: { a: 1, b: 2, c: 3 } })).toBe( - true, - ); - }); - - it('should correctly compare deep objects without object prototype ', () => { - // Solves https://github.com/apollographql/apollo-client/issues/2132 - const objNoProto = Object.create(null); - objNoProto.a = { b: 2, c: [3, 4] }; - objNoProto.e = Object.create(null); - objNoProto.e.f = 5; - expect(isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: { f: 6 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3, 4] }, e: null })).toBe( - true, - ); - expect(!isEqual(objNoProto, { a: { b: 2, c: [3] }, e: { f: 5 } })).toBe( - true, - ); - expect(!isEqual(objNoProto, null)).toBe(true); - }); - - it('should correctly handle modified prototypes', () => { - Array.prototype.foo = null; - expect(isEqual([1, 2, 3], [1, 2, 3])).toBe(true); - expect(!isEqual([1, 2, 3], [1, 2, 4])).toBe(true); - delete Array.prototype.foo; - }); - - describe('comparing objects with circular refs', () => { - // copied with slight modification from lodash test suite - it('should compare objects with circular references', () => { - const object1 = {}, - object2 = {}; - - object1.a = object1; - object2.a = object2; - - expect(isEqual(object1, object2)).toBe(true); - - object1.b = 0; - object2.b = Object(0); - - expect(isEqual(object1, object2)).toBe(true); - - object1.c = Object(1); - object2.c = Object(2); - - expect(isEqual(object1, object2)).toBe(false); - - object1 = { a: 1, b: 2, c: 3 }; - object1.b = object1; - object2 = { a: 1, b: { a: 1, b: 2, c: 3 }, c: 3 }; - - expect(isEqual(object1, object2)).toBe(false); - }); - - it('should have transitive equivalence for circular references of objects', () => { - const object1 = {}, - object2 = { a: object1 }, - object3 = { a: object2 }; - - object1.a = object1; - - expect(isEqual(object1, object2)).toBe(true); - expect(isEqual(object2, object3)).toBe(true); - expect(isEqual(object1, object3)).toBe(true); - }); - - it('should compare objects with multiple circular references', () => { - const array1 = [{}], - array2 = [{}]; - - (array1[0].a = array1).push(array1); - (array2[0].a = array2).push(array2); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].b = 0; - array2[0].b = Object(0); - - expect(isEqual(array1, array2)).toBe(true); - - array1[0].c = Object(1); - array2[0].c = Object(2); - - expect(isEqual(array1, array2)).toBe(false); - }); - - it('should compare objects with complex circular references', () => { - const object1 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - const object2 = { - foo: { b: { c: { d: {} } } }, - bar: { a: 2 }, - }; - - object1.foo.b.c.d = object1; - object1.bar.b = object1.foo.b; - - object2.foo.b.c.d = object2; - object2.bar.b = object2.foo.b; - - expect(isEqual(object1, object2)).toBe(true); - }); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts b/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts deleted file mode 100644 index c33cc60c..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/maybeDeepFeeze.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { maybeDeepFreeze } from '../maybeDeepFreeze'; - -describe('maybeDeepFreeze', () => { - it('should deep freeze', () => { - const foo: any = { bar: undefined }; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - expect(foo.bar).toBeUndefined(); - }); - - it('should properly freeze objects without hasOwnProperty', () => { - const foo = Object.create(null); - foo.bar = undefined; - maybeDeepFreeze(foo); - expect(() => (foo.bar = 1)).toThrow(); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts b/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts deleted file mode 100644 index 13778069..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/mergeDeep.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { mergeDeep, mergeDeepArray } from '../mergeDeep'; - -describe('mergeDeep', function() { - it('should return an object if first argument falsy', function() { - expect(mergeDeep()).toEqual({}); - expect(mergeDeep(null)).toEqual({}); - expect(mergeDeep(null, { foo: 42 })).toEqual({ foo: 42 }); - }); - - it('should preserve identity for single arguments', function() { - const arg = Object.create(null); - expect(mergeDeep(arg)).toBe(arg); - }); - - it('should preserve identity when merging non-conflicting objects', function() { - const a = { a: { name: 'ay' } }; - const b = { b: { name: 'bee' } }; - const c = mergeDeep(a, b); - expect(c.a).toBe(a.a); - expect(c.b).toBe(b.b); - expect(c).toEqual({ - a: { name: 'ay' }, - b: { name: 'bee' }, - }); - }); - - it('should shallow-copy conflicting fields', function() { - const a = { conflict: { fromA: [1, 2, 3] } }; - const b = { conflict: { fromB: [4, 5] } }; - const c = mergeDeep(a, b); - expect(c.conflict).not.toBe(a.conflict); - expect(c.conflict).not.toBe(b.conflict); - expect(c.conflict.fromA).toBe(a.conflict.fromA); - expect(c.conflict.fromB).toBe(b.conflict.fromB); - expect(c).toEqual({ - conflict: { - fromA: [1, 2, 3], - fromB: [4, 5], - }, - }); - }); - - it('should resolve conflicts among more than two objects', function() { - const sources = []; - - for (let i = 0; i < 100; ++i) { - sources.push({ - ['unique' + i]: { value: i }, - conflict: { - ['from' + i]: { value: i }, - nested: { - ['nested' + i]: { value: i }, - }, - }, - }); - } - - const merged = mergeDeep(...sources); - - sources.forEach((source, i) => { - expect(merged['unique' + i].value).toBe(i); - expect(source['unique' + i]).toBe(merged['unique' + i]); - - expect(merged.conflict).not.toBe(source.conflict); - expect(merged.conflict['from' + i].value).toBe(i); - expect(merged.conflict['from' + i]).toBe(source.conflict['from' + i]); - - expect(merged.conflict.nested).not.toBe(source.conflict.nested); - expect(merged.conflict.nested['nested' + i].value).toBe(i); - expect(merged.conflict.nested['nested' + i]).toBe( - source.conflict.nested['nested' + i], - ); - }); - }); - - it('can merge array elements', function() { - const a = [{ a: 1 }, { a: 'ay' }, 'a']; - const b = [{ b: 2 }, { b: 'bee' }, 'b']; - const c = [{ c: 3 }, { c: 'cee' }, 'c']; - const d = { 1: { d: 'dee' } }; - - expect(mergeDeep(a, b, c, d)).toEqual([ - { a: 1, b: 2, c: 3 }, - { a: 'ay', b: 'bee', c: 'cee', d: 'dee' }, - 'c', - ]); - }); - - it('lets the last conflicting value win', function() { - expect(mergeDeep('a', 'b', 'c')).toBe('c'); - - expect( - mergeDeep( - { a: 'a', conflict: 1 }, - { b: 'b', conflict: 2 }, - { c: 'c', conflict: 3 }, - ), - ).toEqual({ - a: 'a', - b: 'b', - c: 'c', - conflict: 3, - }); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - [/*empty*/, ['B'], 'D'], - )).toEqual( - ['a', ['B', 'c'], 'D'], - ); - - expect(mergeDeep( - ['a', ['b', 'c'], 'd'], - ['A', [/*empty*/, 'C']], - )).toEqual( - ['A', ['b', 'C'], 'd'], - ); - }); - - it('mergeDeep returns the intersection of its argument types', function() { - const abc = mergeDeep({ str: "hi", a: 1 }, { a: 3, b: 2 }, { b: 1, c: 2 }); - // The point of this test is that the following lines type-check without - // resorting to any `any` loopholes: - expect(abc.str.slice(0)).toBe("hi"); - expect(abc.a * 2).toBe(6); - expect(abc.b - 0).toBe(1); - expect(abc.c / 2).toBe(1); - }); - - it('mergeDeepArray returns the supertype of its argument types', function() { - class F { - check() { return "ok" }; - } - const fs: F[] = [new F, new F, new F]; - // Although mergeDeepArray doesn't have the same tuple type awareness as - // mergeDeep, it does infer that F should be the return type here: - expect(mergeDeepArray(fs).check()).toBe("ok"); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts b/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts deleted file mode 100644 index fd5594b8..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/stripSymbols.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { stripSymbols } from '../stripSymbols'; - -interface SymbolConstructor { - (description?: string | number): symbol; -} - -declare const Symbol: SymbolConstructor; - -describe('stripSymbols', () => { - it('should strip symbols (only)', () => { - const sym = Symbol('id'); - const data = { foo: 'bar', [sym]: 'ROOT_QUERY' }; - expect(stripSymbols(data)).toEqual({ foo: 'bar' }); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts b/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts deleted file mode 100644 index 35c87534..00000000 --- a/node_modules/apollo-utilities/src/util/__tests__/warnOnce.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { warnOnceInDevelopment } from '../warnOnce'; - -let lastWarning: string | null; -let keepEnv: string | undefined; -let numCalls = 0; -let oldConsoleWarn: any; - -describe('warnOnce', () => { - beforeEach(() => { - keepEnv = process.env.NODE_ENV; - numCalls = 0; - lastWarning = null; - oldConsoleWarn = console.warn; - console.warn = (msg: any) => { - numCalls++; - lastWarning = msg; - }; - }); - afterEach(() => { - process.env.NODE_ENV = keepEnv; - console.warn = oldConsoleWarn; - }); - it('actually warns', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('hi'); - expect(lastWarning).toBe('hi'); - expect(numCalls).toEqual(1); - }); - - it('does not warn twice', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('ho'); - warnOnceInDevelopment('ho'); - expect(lastWarning).toEqual('ho'); - expect(numCalls).toEqual(1); - }); - - it('warns two different things once each', () => { - process.env.NODE_ENV = 'development'; - warnOnceInDevelopment('slow'); - expect(lastWarning).toEqual('slow'); - warnOnceInDevelopment('mo'); - expect(lastWarning).toEqual('mo'); - expect(numCalls).toEqual(2); - }); - - it('does not warn in production', () => { - process.env.NODE_ENV = 'production'; - warnOnceInDevelopment('lo'); - warnOnceInDevelopment('lo'); - expect(numCalls).toEqual(0); - }); - - it('warns many times in test', () => { - process.env.NODE_ENV = 'test'; - warnOnceInDevelopment('yo'); - warnOnceInDevelopment('yo'); - expect(lastWarning).toEqual('yo'); - expect(numCalls).toEqual(2); - }); -}); diff --git a/node_modules/apollo-utilities/src/util/assign.ts b/node_modules/apollo-utilities/src/util/assign.ts deleted file mode 100644 index 3a224329..00000000 --- a/node_modules/apollo-utilities/src/util/assign.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Adds the properties of one or more source objects to a target object. Works exactly like - * `Object.assign`, but as a utility to maintain support for IE 11. - * - * @see https://github.com/apollostack/apollo-client/pull/1009 - */ -export function assign(a: A, b: B): A & B; -export function assign(a: A, b: B, c: C): A & B & C; -export function assign(a: A, b: B, c: C, d: D): A & B & C & D; -export function assign( - a: A, - b: B, - c: C, - d: D, - e: E, -): A & B & C & D & E; -export function assign(target: any, ...sources: Array): any; -export function assign( - target: { [key: string]: any }, - ...sources: Array<{ [key: string]: any }> -): { [key: string]: any } { - sources.forEach(source => { - if (typeof source === 'undefined' || source === null) { - return; - } - Object.keys(source).forEach(key => { - target[key] = source[key]; - }); - }); - return target; -} diff --git a/node_modules/apollo-utilities/src/util/canUse.ts b/node_modules/apollo-utilities/src/util/canUse.ts deleted file mode 100644 index d9858679..00000000 --- a/node_modules/apollo-utilities/src/util/canUse.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const canUseWeakMap = typeof WeakMap === 'function' && !( - typeof navigator === 'object' && - navigator.product === 'ReactNative' -); diff --git a/node_modules/apollo-utilities/src/util/cloneDeep.ts b/node_modules/apollo-utilities/src/util/cloneDeep.ts deleted file mode 100644 index 961b4a82..00000000 --- a/node_modules/apollo-utilities/src/util/cloneDeep.ts +++ /dev/null @@ -1,37 +0,0 @@ -const { toString } = Object.prototype; - -/** - * Deeply clones a value to create a new instance. - */ -export function cloneDeep(value: T): T { - return cloneDeepHelper(value, new Map()); -} - -function cloneDeepHelper(val: T, seen: Map): T { - switch (toString.call(val)) { - case "[object Array]": { - if (seen.has(val)) return seen.get(val); - const copy: T & any[] = (val as any).slice(0); - seen.set(val, copy); - copy.forEach(function (child, i) { - copy[i] = cloneDeepHelper(child, seen); - }); - return copy; - } - - case "[object Object]": { - if (seen.has(val)) return seen.get(val); - // High fidelity polyfills of Object.create and Object.getPrototypeOf are - // possible in all JS environments, so we will assume they exist/work. - const copy = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy); - Object.keys(val).forEach(key => { - copy[key] = cloneDeepHelper((val as any)[key], seen); - }); - return copy; - } - - default: - return val; - } -} diff --git a/node_modules/apollo-utilities/src/util/environment.ts b/node_modules/apollo-utilities/src/util/environment.ts deleted file mode 100644 index f4ad04e1..00000000 --- a/node_modules/apollo-utilities/src/util/environment.ts +++ /dev/null @@ -1,24 +0,0 @@ -export function getEnv(): string | undefined { - if (typeof process !== 'undefined' && process.env.NODE_ENV) { - return process.env.NODE_ENV; - } - - // default environment - return 'development'; -} - -export function isEnv(env: string): boolean { - return getEnv() === env; -} - -export function isProduction(): boolean { - return isEnv('production') === true; -} - -export function isDevelopment(): boolean { - return isEnv('development') === true; -} - -export function isTest(): boolean { - return isEnv('test') === true; -} diff --git a/node_modules/apollo-utilities/src/util/errorHandling.ts b/node_modules/apollo-utilities/src/util/errorHandling.ts deleted file mode 100644 index 25a16ca0..00000000 --- a/node_modules/apollo-utilities/src/util/errorHandling.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ExecutionResult } from 'graphql'; - -export function tryFunctionOrLogError(f: Function) { - try { - return f(); - } catch (e) { - if (console.error) { - console.error(e); - } - } -} - -export function graphQLResultHasError(result: ExecutionResult) { - return result.errors && result.errors.length; -} diff --git a/node_modules/apollo-utilities/src/util/filterInPlace.ts b/node_modules/apollo-utilities/src/util/filterInPlace.ts deleted file mode 100644 index d5787cab..00000000 --- a/node_modules/apollo-utilities/src/util/filterInPlace.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function filterInPlace( - array: T[], - test: (elem: T) => boolean, - context?: any, -): T[] { - let target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} diff --git a/node_modules/apollo-utilities/src/util/isEqual.ts b/node_modules/apollo-utilities/src/util/isEqual.ts deleted file mode 100644 index debf7429..00000000 --- a/node_modules/apollo-utilities/src/util/isEqual.ts +++ /dev/null @@ -1 +0,0 @@ -export { equal as isEqual } from '@wry/equality'; diff --git a/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts b/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts deleted file mode 100644 index d966d336..00000000 --- a/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { isDevelopment, isTest } from './environment'; - -// Taken (mostly) from https://github.com/substack/deep-freeze to avoid -// import hassles with rollup. -function deepFreeze(o: any) { - Object.freeze(o); - - Object.getOwnPropertyNames(o).forEach(function(prop) { - if ( - o[prop] !== null && - (typeof o[prop] === 'object' || typeof o[prop] === 'function') && - !Object.isFrozen(o[prop]) - ) { - deepFreeze(o[prop]); - } - }); - - return o; -} - -export function maybeDeepFreeze(obj: any) { - if (isDevelopment() || isTest()) { - // Polyfilled Symbols potentially cause infinite / very deep recursion while deep freezing - // which is known to crash IE11 (https://github.com/apollographql/apollo-client/issues/3043). - const symbolIsPolyfilled = - typeof Symbol === 'function' && typeof Symbol('') === 'string'; - - if (!symbolIsPolyfilled) { - return deepFreeze(obj); - } - } - return obj; -} diff --git a/node_modules/apollo-utilities/src/util/mergeDeep.ts b/node_modules/apollo-utilities/src/util/mergeDeep.ts deleted file mode 100644 index d83a33fe..00000000 --- a/node_modules/apollo-utilities/src/util/mergeDeep.ts +++ /dev/null @@ -1,115 +0,0 @@ -const { hasOwnProperty } = Object.prototype; - -// These mergeDeep and mergeDeepArray utilities merge any number of objects -// together, sharing as much memory as possible with the source objects, while -// remaining careful to avoid modifying any source objects. - -// Logically, the return type of mergeDeep should be the intersection of -// all the argument types. The binary call signature is by far the most -// common, but we support 0- through 5-ary as well. After that, the -// resulting type is just the inferred array element type. Note to nerds: -// there is a more clever way of doing this that converts the tuple type -// first to a union type (easy enough: T[number]) and then converts the -// union to an intersection type using distributive conditional type -// inference, but that approach has several fatal flaws (boolean becomes -// true & false, and the inferred type ends up as unknown in many cases), -// in addition to being nearly impossible to explain/understand. -export type TupleToIntersection = - T extends [infer A] ? A : - T extends [infer A, infer B] ? A & B : - T extends [infer A, infer B, infer C] ? A & B & C : - T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : - T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : - T extends (infer U)[] ? U : any; - -export function mergeDeep( - ...sources: T -): TupleToIntersection { - return mergeDeepArray(sources); -} - -// In almost any situation where you could succeed in getting the -// TypeScript compiler to infer a tuple type for the sources array, you -// could just use mergeDeep instead of mergeDeepArray, so instead of -// trying to convert T[] to an intersection type we just infer the array -// element type, which works perfectly when the sources array has a -// consistent element type. -export function mergeDeepArray(sources: T[]): T { - let target = sources[0] || {} as T; - const count = sources.length; - if (count > 1) { - const pastCopies: any[] = []; - target = shallowCopyForMerge(target, pastCopies); - for (let i = 1; i < count; ++i) { - target = mergeHelper(target, sources[i], pastCopies); - } - } - return target; -} - -function isObject(obj: any): obj is Record { - return obj !== null && typeof obj === 'object'; -} - -function mergeHelper( - target: any, - source: any, - pastCopies: any[], -) { - if (isObject(source) && isObject(target)) { - // In case the target has been frozen, make an extensible copy so that - // we can merge properties into the copy. - if (Object.isExtensible && !Object.isExtensible(target)) { - target = shallowCopyForMerge(target, pastCopies); - } - - Object.keys(source).forEach(sourceKey => { - const sourceValue = source[sourceKey]; - if (hasOwnProperty.call(target, sourceKey)) { - const targetValue = target[sourceKey]; - if (sourceValue !== targetValue) { - // When there is a key collision, we need to make a shallow copy of - // target[sourceKey] so the merge does not modify any source objects. - // To avoid making unnecessary copies, we use a simple array to track - // past copies, since it's safe to modify copies created earlier in - // the merge. We use an array for pastCopies instead of a Map or Set, - // since the number of copies should be relatively small, and some - // Map/Set polyfills modify their keys. - target[sourceKey] = mergeHelper( - shallowCopyForMerge(targetValue, pastCopies), - sourceValue, - pastCopies, - ); - } - } else { - // If there is no collision, the target can safely share memory with - // the source, and the recursion can terminate here. - target[sourceKey] = sourceValue; - } - }); - - return target; - } - - // If source (or target) is not an object, let source replace target. - return source; -} - -function shallowCopyForMerge(value: T, pastCopies: any[]): T { - if ( - value !== null && - typeof value === 'object' && - pastCopies.indexOf(value) < 0 - ) { - if (Array.isArray(value)) { - value = (value as any).slice(0); - } else { - value = { - __proto__: Object.getPrototypeOf(value), - ...value, - }; - } - pastCopies.push(value); - } - return value; -} diff --git a/node_modules/apollo-utilities/src/util/stripSymbols.ts b/node_modules/apollo-utilities/src/util/stripSymbols.ts deleted file mode 100644 index 41cabae7..00000000 --- a/node_modules/apollo-utilities/src/util/stripSymbols.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * In order to make assertions easier, this function strips `symbol`'s from - * the incoming data. - * - * This can be handy when running tests against `apollo-client` for example, - * since it adds `symbol`'s to the data in the store. Jest's `toEqual` - * function now covers `symbol`'s (https://github.com/facebook/jest/pull/3437), - * which means all test data used in a `toEqual` comparison would also have to - * include `symbol`'s, to pass. By stripping `symbol`'s from the cache data - * we can compare against more simplified test data. - */ -export function stripSymbols(data: T): T { - return JSON.parse(JSON.stringify(data)); -} diff --git a/node_modules/apollo-utilities/src/util/warnOnce.ts b/node_modules/apollo-utilities/src/util/warnOnce.ts deleted file mode 100644 index 90f32321..00000000 --- a/node_modules/apollo-utilities/src/util/warnOnce.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { isProduction, isTest } from './environment'; - -const haveWarned = Object.create({}); - -/** - * Print a warning only once in development. - * In production no warnings are printed. - * In test all warnings are printed. - * - * @param msg The warning message - * @param type warn or error (will call console.warn or console.error) - */ -export function warnOnceInDevelopment(msg: string, type = 'warn') { - if (!isProduction() && !haveWarned[msg]) { - if (!isTest()) { - haveWarned[msg] = true; - } - if (type === 'error') { - console.error(msg); - } else { - console.warn(msg); - } - } -} diff --git a/node_modules/arrify/index.d.ts b/node_modules/arrify/index.d.ts deleted file mode 100644 index bfd0cf5e..00000000 --- a/node_modules/arrify/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** -Convert a value to an array. - -_Supplying `null` or `undefined` results in an empty array._ - -@example -``` -import arrify = require('arrify'); - -arrify('🦄'); -//=> ['🦄'] - -arrify(['🦄']); -//=> ['🦄'] - -arrify(new Set(['🦄'])); -//=> ['🦄'] - -arrify(null); -//=> [] - -arrify(undefined); -//=> [] -``` -*/ -declare function arrify( - value: ValueType -): ValueType extends (null | undefined) - ? [] - : ValueType extends string - ? [string] - : ValueType extends ReadonlyArray // TODO: Use 'readonly unknown[]' in the next major version - ? ValueType - : ValueType extends Iterable - ? T[] - : [ValueType]; - -export = arrify; diff --git a/node_modules/arrify/index.js b/node_modules/arrify/index.js deleted file mode 100644 index 49a5c9ad..00000000 --- a/node_modules/arrify/index.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -const arrify = value => { - if (value === null || value === undefined) { - return []; - } - - if (Array.isArray(value)) { - return value; - } - - if (typeof value === 'string') { - return [value]; - } - - if (typeof value[Symbol.iterator] === 'function') { - return [...value]; - } - - return [value]; -}; - -module.exports = arrify; diff --git a/node_modules/arrify/license b/node_modules/arrify/license deleted file mode 100644 index e7af2f77..00000000 --- a/node_modules/arrify/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/arrify/package.json b/node_modules/arrify/package.json deleted file mode 100644 index ee35c51a..00000000 --- a/node_modules/arrify/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_from": "arrify@^2.0.0", - "_id": "arrify@2.0.1", - "_inBundle": false, - "_integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "_location": "/arrify", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "arrify@^2.0.0", - "name": "arrify", - "escapedName": "arrify", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/google-auth-library" - ], - "_resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "_shasum": "c9655e9331e0abcd588d2a7cad7e9956f66701fa", - "_spec": "arrify@^2.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/arrify/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Convert a value to an array", - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/arrify#readme", - "keywords": [ - "array", - "arrify", - "arrayify", - "convert", - "value", - "ensure" - ], - "license": "MIT", - "name": "arrify", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/arrify.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "2.0.1" -} diff --git a/node_modules/arrify/readme.md b/node_modules/arrify/readme.md deleted file mode 100644 index b3dfc837..00000000 --- a/node_modules/arrify/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# arrify [![Build Status](https://travis-ci.org/sindresorhus/arrify.svg?branch=master)](https://travis-ci.org/sindresorhus/arrify) - -> Convert a value to an array - - -## Install - -``` -$ npm install arrify -``` - - -## Usage - -```js -const arrify = require('arrify'); - -arrify('🦄'); -//=> ['🦄'] - -arrify(['🦄']); -//=> ['🦄'] - -arrify(new Set(['🦄'])); -//=> ['🦄'] - -arrify(null); -//=> [] - -arrify(undefined); -//=> [] -``` - -*Supplying `null` or `undefined` results in an empty array.* - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/async-limiter/.travis.yml b/node_modules/async-limiter/.travis.yml deleted file mode 100644 index 6cf4a7ad..00000000 --- a/node_modules/async-limiter/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "6" - - "node" -script: npm run travis -cache: - yarn: true diff --git a/node_modules/async-limiter/LICENSE b/node_modules/async-limiter/LICENSE deleted file mode 100644 index 9c91fb26..00000000 --- a/node_modules/async-limiter/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2017 Samuel Reed - -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. diff --git a/node_modules/async-limiter/coverage/coverage.json b/node_modules/async-limiter/coverage/coverage.json deleted file mode 100644 index 5b4a3584..00000000 --- a/node_modules/async-limiter/coverage/coverage.json +++ /dev/null @@ -1 +0,0 @@ -{"/Users/samuelreed/git/forks/async-throttle/index.js":{"path":"/Users/samuelreed/git/forks/async-throttle/index.js","s":{"1":1,"2":7,"3":1,"4":6,"5":6,"6":6,"7":6,"8":6,"9":6,"10":1,"11":1,"12":3,"13":13,"14":13,"15":13,"16":1,"17":19,"18":1,"19":45,"20":6,"21":39,"22":13,"23":13,"24":13,"25":13,"26":39,"27":18,"28":6,"29":6,"30":1,"31":6,"32":6,"33":6,"34":1,"35":13,"36":13,"37":1},"b":{"1":[1,6],"2":[6,5],"3":[6,5],"4":[6,39],"5":[13,26],"6":[18,21],"7":[6,0]},"f":{"1":7,"2":3,"3":13,"4":19,"5":45,"6":6,"7":13},"fnMap":{"1":{"name":"Queue","line":3,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}},"2":{"name":"(anonymous_2)","line":22,"loc":{"start":{"line":22,"column":24},"end":{"line":22,"column":41}}},"3":{"name":"(anonymous_3)","line":23,"loc":{"start":{"line":23,"column":28},"end":{"line":23,"column":39}}},"4":{"name":"(anonymous_4)","line":31,"loc":{"start":{"line":31,"column":7},"end":{"line":31,"column":18}}},"5":{"name":"(anonymous_5)","line":36,"loc":{"start":{"line":36,"column":23},"end":{"line":36,"column":34}}},"6":{"name":"(anonymous_6)","line":55,"loc":{"start":{"line":55,"column":25},"end":{"line":55,"column":38}}},"7":{"name":"done","line":62,"loc":{"start":{"line":62,"column":0},"end":{"line":62,"column":16}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":14,"column":1}},"2":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}},"3":{"start":{"line":5,"column":4},"end":{"line":5,"column":30}},"4":{"start":{"line":8,"column":2},"end":{"line":8,"column":26}},"5":{"start":{"line":9,"column":2},"end":{"line":9,"column":53}},"6":{"start":{"line":10,"column":2},"end":{"line":10,"column":19}},"7":{"start":{"line":11,"column":2},"end":{"line":11,"column":17}},"8":{"start":{"line":12,"column":2},"end":{"line":12,"column":16}},"9":{"start":{"line":13,"column":2},"end":{"line":13,"column":31}},"10":{"start":{"line":16,"column":0},"end":{"line":20,"column":2}},"11":{"start":{"line":22,"column":0},"end":{"line":28,"column":3}},"12":{"start":{"line":23,"column":2},"end":{"line":27,"column":4}},"13":{"start":{"line":24,"column":4},"end":{"line":24,"column":75}},"14":{"start":{"line":25,"column":4},"end":{"line":25,"column":16}},"15":{"start":{"line":26,"column":4},"end":{"line":26,"column":24}},"16":{"start":{"line":30,"column":0},"end":{"line":34,"column":3}},"17":{"start":{"line":32,"column":4},"end":{"line":32,"column":43}},"18":{"start":{"line":36,"column":0},"end":{"line":53,"column":2}},"19":{"start":{"line":37,"column":2},"end":{"line":39,"column":3}},"20":{"start":{"line":38,"column":4},"end":{"line":38,"column":11}},"21":{"start":{"line":40,"column":2},"end":{"line":45,"column":3}},"22":{"start":{"line":41,"column":4},"end":{"line":41,"column":32}},"23":{"start":{"line":42,"column":4},"end":{"line":42,"column":19}},"24":{"start":{"line":43,"column":4},"end":{"line":43,"column":20}},"25":{"start":{"line":44,"column":4},"end":{"line":44,"column":16}},"26":{"start":{"line":47,"column":2},"end":{"line":52,"column":3}},"27":{"start":{"line":48,"column":4},"end":{"line":51,"column":5}},"28":{"start":{"line":49,"column":6},"end":{"line":49,"column":30}},"29":{"start":{"line":50,"column":6},"end":{"line":50,"column":27}},"30":{"start":{"line":55,"column":0},"end":{"line":60,"column":2}},"31":{"start":{"line":56,"column":2},"end":{"line":59,"column":3}},"32":{"start":{"line":57,"column":4},"end":{"line":57,"column":22}},"33":{"start":{"line":58,"column":4},"end":{"line":58,"column":16}},"34":{"start":{"line":62,"column":0},"end":{"line":65,"column":1}},"35":{"start":{"line":63,"column":2},"end":{"line":63,"column":17}},"36":{"start":{"line":64,"column":2},"end":{"line":64,"column":14}},"37":{"start":{"line":67,"column":0},"end":{"line":67,"column":23}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":2},"end":{"line":4,"column":2}},{"start":{"line":4,"column":2},"end":{"line":4,"column":2}}]},"2":{"line":8,"type":"binary-expr","locations":[{"start":{"line":8,"column":12},"end":{"line":8,"column":19}},{"start":{"line":8,"column":23},"end":{"line":8,"column":25}}]},"3":{"line":9,"type":"binary-expr","locations":[{"start":{"line":9,"column":21},"end":{"line":9,"column":40}},{"start":{"line":9,"column":44},"end":{"line":9,"column":52}}]},"4":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":2},"end":{"line":37,"column":2}},{"start":{"line":37,"column":2},"end":{"line":37,"column":2}}]},"5":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":40,"column":2}},{"start":{"line":40,"column":2},"end":{"line":40,"column":2}}]},"6":{"line":47,"type":"if","locations":[{"start":{"line":47,"column":2},"end":{"line":47,"column":2}},{"start":{"line":47,"column":2},"end":{"line":47,"column":2}}]},"7":{"line":56,"type":"if","locations":[{"start":{"line":56,"column":2},"end":{"line":56,"column":2}},{"start":{"line":56,"column":2},"end":{"line":56,"column":2}}]}}}} \ No newline at end of file diff --git a/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html b/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html deleted file mode 100644 index 198882b4..00000000 --- a/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Code coverage report for async-throttle/ - - - - - - -
-

Code coverage report for async-throttle/

-

- Statements: 100% (37 / 37)      - Branches: 92.86% (13 / 14)      - Functions: 100% (7 / 7)      - Lines: 100% (37 / 37)      - Ignored: none      -

-
All files » async-throttle/
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
index.js100%(37 / 37)92.86%(13 / 14)100%(7 / 7)100%(37 / 37)
-
-
- - - - - - diff --git a/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html b/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html deleted file mode 100644 index adc030fd..00000000 --- a/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - Code coverage report for async-throttle/index.js - - - - - - -
-

Code coverage report for async-throttle/index.js

-

- Statements: 100% (37 / 37)      - Branches: 92.86% (13 / 14)      - Functions: 100% (7 / 7)      - Lines: 100% (37 / 37)      - Ignored: none      -

-
All files » async-throttle/ » index.js
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68  -  -1 -7 -1 -  -  -6 -6 -6 -6 -6 -6 -  -  -1 -  -  -  -  -  -1 -3 -13 -13 -13 -  -  -  -1 -  -19 -  -  -  -1 -45 -6 -  -39 -13 -13 -13 -13 -  -  -39 -18 -6 -6 -  -  -  -  -1 -6 -6 -6 -  -  -  -1 -13 -13 -  -  -1 - 
'use strict';
- 
-function Queue(options) {
-  if (!(this instanceof Queue)) {
-    return new Queue(options);
-  }
- 
-  options = options || {};
-  this.concurrency = options.concurrency || Infinity;
-  this.pending = 0;
-  this.jobs = [];
-  this.cbs = [];
-  this._done = done.bind(this);
-}
- 
-var arrayAddMethods = [
-  'push',
-  'unshift',
-  'splice'
-];
- 
-arrayAddMethods.forEach(function(method) {
-  Queue.prototype[method] = function() {
-    var methodResult = Array.prototype[method].apply(this.jobs, arguments);
-    this._run();
-    return methodResult;
-  };
-});
- 
-Object.defineProperty(Queue.prototype, 'length', {
-  get: function() {
-    return this.pending + this.jobs.length;
-  }
-});
- 
-Queue.prototype._run = function() {
-  if (this.pending === this.concurrency) {
-    return;
-  }
-  if (this.jobs.length) {
-    var job = this.jobs.shift();
-    this.pending++;
-    job(this._done);
-    this._run();
-  }
- 
-  if (this.pending === 0) {
-    while (this.cbs.length !== 0) {
-      var cb = this.cbs.pop();
-      process.nextTick(cb);
-    }
-  }
-};
- 
-Queue.prototype.onDone = function(cb) {
-  Eif (typeof cb === 'function') {
-    this.cbs.push(cb);
-    this._run();
-  }
-};
- 
-function done() {
-  this.pending--;
-  this._run();
-}
- 
-module.exports = Queue;
- 
- -
- - - - - - diff --git a/node_modules/async-limiter/coverage/lcov-report/base.css b/node_modules/async-limiter/coverage/lcov-report/base.css deleted file mode 100644 index a6a2f328..00000000 --- a/node_modules/async-limiter/coverage/lcov-report/base.css +++ /dev/null @@ -1,182 +0,0 @@ -body, html { - margin:0; padding: 0; -} -body { - font-family: Helvetica Neue, Helvetica,Arial; - font-size: 10pt; -} -div.header, div.footer { - background: #eee; - padding: 1em; -} -div.header { - z-index: 100; - position: fixed; - top: 0; - border-bottom: 1px solid #666; - width: 100%; -} -div.footer { - border-top: 1px solid #666; -} -div.body { - margin-top: 10em; -} -div.meta { - font-size: 90%; - text-align: center; -} -h1, h2, h3 { - font-weight: normal; -} -h1 { - font-size: 12pt; -} -h2 { - font-size: 10pt; -} -pre { - font-family: Consolas, Menlo, Monaco, monospace; - margin: 0; - padding: 0; - line-height: 1.3; - font-size: 14px; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} - -div.path { font-size: 110%; } -div.path a:link, div.path a:visited { color: #000; } -table.coverage { border-collapse: collapse; margin:0; padding: 0 } - -table.coverage td { - margin: 0; - padding: 0; - color: #111; - vertical-align: top; -} -table.coverage td.line-count { - width: 50px; - text-align: right; - padding-right: 5px; -} -table.coverage td.line-coverage { - color: #777 !important; - text-align: right; - border-left: 1px solid #666; - border-right: 1px solid #666; -} - -table.coverage td.text { -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 40px; -} -table.coverage td span.cline-neutral { - background: #eee; -} -table.coverage td span.cline-yes { - background: #b5d592; - color: #999; -} -table.coverage td span.cline-no { - background: #fc8c84; -} - -.cstat-yes { color: #111; } -.cstat-no { background: #fc8c84; color: #111; } -.fstat-no { background: #ffc520; color: #111 !important; } -.cbranch-no { background: yellow !important; color: #111; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -.missing-if-branch { - display: inline-block; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: black; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} - -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} - -.entity, .metric { font-weight: bold; } -.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } -.metric small { font-size: 80%; font-weight: normal; color: #666; } - -div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } -div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } -div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } -div.coverage-summary th.file { border-right: none !important; } -div.coverage-summary th.pic { border-left: none !important; text-align: right; } -div.coverage-summary th.pct { border-right: none !important; } -div.coverage-summary th.abs { border-left: none !important; text-align: right; } -div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } -div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } -div.coverage-summary td.file { border-left: 1px solid #666; white-space: nowrap; } -div.coverage-summary td.pic { min-width: 120px !important; } -div.coverage-summary a:link { text-decoration: none; color: #000; } -div.coverage-summary a:visited { text-decoration: none; color: #777; } -div.coverage-summary a:hover { text-decoration: underline; } -div.coverage-summary tfoot td { border-top: 1px solid #666; } - -div.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -div.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -div.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} - -.high { background: #b5d592 !important; } -.medium { background: #ffe87c !important; } -.low { background: #fc8c84 !important; } - -span.cover-fill, span.cover-empty { - display:inline-block; - border:1px solid #444; - background: white; - height: 12px; -} -span.cover-fill { - background: #ccc; - border-right: 1px solid #444; -} -span.cover-empty { - background: white; - border-left: none; -} -span.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } diff --git a/node_modules/async-limiter/coverage/lcov-report/index.html b/node_modules/async-limiter/coverage/lcov-report/index.html deleted file mode 100644 index 782a1cff..00000000 --- a/node_modules/async-limiter/coverage/lcov-report/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Code coverage report for All files - - - - - - -
-

Code coverage report for All files

-

- Statements: 100% (37 / 37)      - Branches: 92.86% (13 / 14)      - Functions: 100% (7 / 7)      - Lines: 100% (37 / 37)      - Ignored: none      -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
async-throttle/100%(37 / 37)92.86%(13 / 14)100%(7 / 7)100%(37 / 37)
-
-
- - - - - - diff --git a/node_modules/async-limiter/coverage/lcov-report/prettify.css b/node_modules/async-limiter/coverage/lcov-report/prettify.css deleted file mode 100644 index b317a7cd..00000000 --- a/node_modules/async-limiter/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/async-limiter/coverage/lcov-report/prettify.js b/node_modules/async-limiter/coverage/lcov-report/prettify.js deleted file mode 100644 index ef51e038..00000000 --- a/node_modules/async-limiter/coverage/lcov-report/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png b/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png deleted file mode 100644 index 03f704a6..00000000 Binary files a/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png and /dev/null differ diff --git a/node_modules/async-limiter/coverage/lcov-report/sorter.js b/node_modules/async-limiter/coverage/lcov-report/sorter.js deleted file mode 100644 index 6afb736c..00000000 --- a/node_modules/async-limiter/coverage/lcov-report/sorter.js +++ /dev/null @@ -1,156 +0,0 @@ -var addSorting = (function () { - "use strict"; - var cols, - currentSort = { - index: 0, - desc: false - }; - - // returns the summary table element - function getTable() { return document.querySelector('.coverage-summary table'); } - // returns the thead element of the summary table - function getTableHeader() { return getTable().querySelector('thead tr'); } - // returns the tbody element of the summary table - function getTableBody() { return getTable().querySelector('tbody'); } - // returns the th element for nth column - function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } - - // loads all columns - function loadColumns() { - var colNodes = getTableHeader().querySelectorAll('th'), - colNode, - cols = [], - col, - i; - - for (i = 0; i < colNodes.length; i += 1) { - colNode = colNodes[i]; - col = { - key: colNode.getAttribute('data-col'), - sortable: !colNode.getAttribute('data-nosort'), - type: colNode.getAttribute('data-type') || 'string' - }; - cols.push(col); - if (col.sortable) { - col.defaultDescSort = col.type === 'number'; - colNode.innerHTML = colNode.innerHTML + ''; - } - } - return cols; - } - // attaches a data attribute to every tr element with an object - // of data values keyed by column name - function loadRowData(tableRow) { - var tableCols = tableRow.querySelectorAll('td'), - colNode, - col, - data = {}, - i, - val; - for (i = 0; i < tableCols.length; i += 1) { - colNode = tableCols[i]; - col = cols[i]; - val = colNode.getAttribute('data-value'); - if (col.type === 'number') { - val = Number(val); - } - data[col.key] = val; - } - return data; - } - // loads all row data - function loadData() { - var rows = getTableBody().querySelectorAll('tr'), - i; - - for (i = 0; i < rows.length; i += 1) { - rows[i].data = loadRowData(rows[i]); - } - } - // sorts the table using the data for the ith column - function sortByIndex(index, desc) { - var key = cols[index].key, - sorter = function (a, b) { - a = a.data[key]; - b = b.data[key]; - return a < b ? -1 : a > b ? 1 : 0; - }, - finalSorter = sorter, - tableBody = document.querySelector('.coverage-summary tbody'), - rowNodes = tableBody.querySelectorAll('tr'), - rows = [], - i; - - if (desc) { - finalSorter = function (a, b) { - return -1 * sorter(a, b); - }; - } - - for (i = 0; i < rowNodes.length; i += 1) { - rows.push(rowNodes[i]); - tableBody.removeChild(rowNodes[i]); - } - - rows.sort(finalSorter); - - for (i = 0; i < rows.length; i += 1) { - tableBody.appendChild(rows[i]); - } - } - // removes sort indicators for current column being sorted - function removeSortIndicators() { - var col = getNthColumn(currentSort.index), - cls = col.className; - - cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); - col.className = cls; - } - // adds sort indicators for current column being sorted - function addSortIndicators() { - getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; - } - // adds event listeners for all sorter widgets - function enableUI() { - var i, - el, - ithSorter = function ithSorter(i) { - var col = cols[i]; - - return function () { - var desc = col.defaultDescSort; - - if (currentSort.index === i) { - desc = !currentSort.desc; - } - sortByIndex(i, desc); - removeSortIndicators(); - currentSort.index = i; - currentSort.desc = desc; - addSortIndicators(); - }; - }; - for (i =0 ; i < cols.length; i += 1) { - if (cols[i].sortable) { - el = getNthColumn(i).querySelector('.sorter'); - if (el.addEventListener) { - el.addEventListener('click', ithSorter(i)); - } else { - el.attachEvent('onclick', ithSorter(i)); - } - } - } - } - // adds sorting functionality to the UI - return function () { - if (!getTable()) { - return; - } - cols = loadColumns(); - loadData(cols); - addSortIndicators(); - enableUI(); - }; -})(); - -window.addEventListener('load', addSorting); diff --git a/node_modules/async-limiter/coverage/lcov.info b/node_modules/async-limiter/coverage/lcov.info deleted file mode 100644 index fbf36aab..00000000 --- a/node_modules/async-limiter/coverage/lcov.info +++ /dev/null @@ -1,74 +0,0 @@ -TN: -SF:/Users/samuelreed/git/forks/async-throttle/index.js -FN:3,Queue -FN:22,(anonymous_2) -FN:23,(anonymous_3) -FN:31,(anonymous_4) -FN:36,(anonymous_5) -FN:55,(anonymous_6) -FN:62,done -FNF:7 -FNH:7 -FNDA:7,Queue -FNDA:3,(anonymous_2) -FNDA:13,(anonymous_3) -FNDA:19,(anonymous_4) -FNDA:45,(anonymous_5) -FNDA:6,(anonymous_6) -FNDA:13,done -DA:3,1 -DA:4,7 -DA:5,1 -DA:8,6 -DA:9,6 -DA:10,6 -DA:11,6 -DA:12,6 -DA:13,6 -DA:16,1 -DA:22,1 -DA:23,3 -DA:24,13 -DA:25,13 -DA:26,13 -DA:30,1 -DA:32,19 -DA:36,1 -DA:37,45 -DA:38,6 -DA:40,39 -DA:41,13 -DA:42,13 -DA:43,13 -DA:44,13 -DA:47,39 -DA:48,18 -DA:49,6 -DA:50,6 -DA:55,1 -DA:56,6 -DA:57,6 -DA:58,6 -DA:62,1 -DA:63,13 -DA:64,13 -DA:67,1 -LF:37 -LH:37 -BRDA:4,1,0,1 -BRDA:4,1,1,6 -BRDA:8,2,0,6 -BRDA:8,2,1,5 -BRDA:9,3,0,6 -BRDA:9,3,1,5 -BRDA:37,4,0,6 -BRDA:37,4,1,39 -BRDA:40,5,0,13 -BRDA:40,5,1,26 -BRDA:47,6,0,18 -BRDA:47,6,1,21 -BRDA:56,7,0,6 -BRDA:56,7,1,0 -BRF:14 -BRH:13 -end_of_record diff --git a/node_modules/async-limiter/index.js b/node_modules/async-limiter/index.js deleted file mode 100644 index c9bd2f97..00000000 --- a/node_modules/async-limiter/index.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -function Queue(options) { - if (!(this instanceof Queue)) { - return new Queue(options); - } - - options = options || {}; - this.concurrency = options.concurrency || Infinity; - this.pending = 0; - this.jobs = []; - this.cbs = []; - this._done = done.bind(this); -} - -var arrayAddMethods = [ - 'push', - 'unshift', - 'splice' -]; - -arrayAddMethods.forEach(function(method) { - Queue.prototype[method] = function() { - var methodResult = Array.prototype[method].apply(this.jobs, arguments); - this._run(); - return methodResult; - }; -}); - -Object.defineProperty(Queue.prototype, 'length', { - get: function() { - return this.pending + this.jobs.length; - } -}); - -Queue.prototype._run = function() { - if (this.pending === this.concurrency) { - return; - } - if (this.jobs.length) { - var job = this.jobs.shift(); - this.pending++; - job(this._done); - this._run(); - } - - if (this.pending === 0) { - while (this.cbs.length !== 0) { - var cb = this.cbs.pop(); - process.nextTick(cb); - } - } -}; - -Queue.prototype.onDone = function(cb) { - if (typeof cb === 'function') { - this.cbs.push(cb); - this._run(); - } -}; - -function done() { - this.pending--; - this._run(); -} - -module.exports = Queue; diff --git a/node_modules/async-limiter/package.json b/node_modules/async-limiter/package.json deleted file mode 100644 index 22a28a66..00000000 --- a/node_modules/async-limiter/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_args": [ - [ - "async-limiter@1.0.0", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "async-limiter@1.0.0", - "_id": "async-limiter@1.0.0", - "_inBundle": false, - "_integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", - "_location": "/async-limiter", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "async-limiter@1.0.0", - "name": "async-limiter", - "escapedName": "async-limiter", - "rawSpec": "1.0.0", - "saveSpec": null, - "fetchSpec": "1.0.0" - }, - "_requiredBy": [ - "/subscriptions-transport-ws/ws", - "/ws" - ], - "_resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "_spec": "1.0.0", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Samuel Reed" - }, - "bugs": { - "url": "https://github.com/strml/async-limiter/issues" - }, - "dependencies": {}, - "description": "asynchronous function queue with adjustable concurrency", - "devDependencies": { - "coveralls": "^2.11.2", - "eslint": "^4.6.1", - "eslint-plugin-mocha": "^4.11.0", - "intelli-espower-loader": "^1.0.1", - "istanbul": "^0.3.2", - "mocha": "^3.5.2", - "power-assert": "^1.4.4" - }, - "homepage": "https://github.com/strml/async-limiter#readme", - "keywords": [ - "throttle", - "async", - "limiter", - "asynchronous", - "job", - "task", - "concurrency", - "concurrent" - ], - "license": "MIT", - "name": "async-limiter", - "repository": { - "type": "git", - "url": "git+https://github.com/strml/async-limiter.git" - }, - "scripts": { - "coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls", - "example": "node example", - "lint": "eslint .", - "test": "mocha --R intelli-espower-loader test/", - "travis": "npm run lint && npm run coverage" - }, - "version": "1.0.0" -} diff --git a/node_modules/async-limiter/readme.md b/node_modules/async-limiter/readme.md deleted file mode 100644 index dcf4932f..00000000 --- a/node_modules/async-limiter/readme.md +++ /dev/null @@ -1,132 +0,0 @@ -# Async-Limiter - -A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue). - -[![npm](http://img.shields.io/npm/v/async-limiter.svg?style=flat-square)](http://www.npmjs.org/async-limiter) -[![tests](https://img.shields.io/travis/STRML/async-limiter.svg?style=flat-square&branch=master)](https://travis-ci.org/STRML/async-limiter) -[![coverage](https://img.shields.io/coveralls/STRML/async-limiter.svg?style=flat-square&branch=master)](https://coveralls.io/r/STRML/async-limiter) - -This module exports a class `Limiter` that implements some of the `Array` API. -Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods. - -## Motivation - -Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when -run at infinite concurrency. - -In this case, it is actually faster, and takes far less memory, to limit concurrency. - -This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would -make this module faster or lighter, but new functionality is not desired. - -Style should confirm to nodejs/node style. - -## Example - -``` javascript -var Limiter = require('async-limiter') - -var t = new Limiter({concurrency: 2}); -var results = [] - -// add jobs using the familiar Array API -t.push(function (cb) { - results.push('two') - cb() -}) - -t.push( - function (cb) { - results.push('four') - cb() - }, - function (cb) { - results.push('five') - cb() - } -) - -t.unshift(function (cb) { - results.push('one') - cb() -}) - -t.splice(2, 0, function (cb) { - results.push('three') - cb() -}) - -// Jobs run automatically. If you want a callback when all are done, -// call 'onDone()'. -t.onDone(function () { - console.log('all done:', results) -}) -``` - -## Zlib Example - -```js -const zlib = require('zlib'); -const Limiter = require('async-limiter'); - -const message = {some: "data"}; -const payload = new Buffer(JSON.stringify(message)); - -// Try with different concurrency values to see how this actually -// slows significantly with higher concurrency! -// -// 5: 1398.607ms -// 10: 1375.668ms -// Infinity: 4423.300ms -// -const t = new Limiter({concurrency: 5}); -function deflate(payload, cb) { - t.push(function(done) { - zlib.deflate(payload, function(err, buffer) { - done(); - cb(err, buffer); - }); - }); -} - -console.time('deflate'); -for(let i = 0; i < 30000; ++i) { - deflate(payload, function (err, buffer) {}); -} -q.onDone(function() { - console.timeEnd('deflate'); -}); -``` - -## Install - -`npm install async-limiter` - -## Test - -`npm test` - -## API - -### `var t = new Limiter([opts])` -Constructor. `opts` may contain inital values for: -* `q.concurrency` - -## Instance methods - -### `q.onDone(fn)` -`fn` will be called once and only once, when the queue is empty. - -## Instance methods mixed in from `Array` -Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). -### `q.push(element1, ..., elementN)` -### `q.unshift(element1, ..., elementN)` -### `q.splice(index , howMany[, element1[, ...[, elementN]]])` - -## Properties -### `q.concurrency` -Max number of jobs the queue should process concurrently, defaults to `Infinity`. - -### `q.length` -Jobs pending + jobs to process (readonly). - diff --git a/node_modules/async/CHANGELOG.md b/node_modules/async/CHANGELOG.md deleted file mode 100644 index 32dca5ce..00000000 --- a/node_modules/async/CHANGELOG.md +++ /dev/null @@ -1,331 +0,0 @@ -# v3.2.0 -- Fix a bug in Safari related to overwriting `func.name` -- Remove built-in browserify configuration (#1653) -- Varios doc fixes (#1688, #1703, #1704) - -# v3.1.1 -- Allow redefining `name` property on wrapped functions. - -# v3.1.0 - -- Added `q.pushAsync` and `q.unshiftAsync`, analagous to `q.push` and `q.unshift`, except they always do not accept a callback, and reject if processing the task errors. (#1659) -- Promises returned from `q.push` and `q.unshift` when a callback is not passed now resolve even if an error ocurred. (#1659) -- Fixed a parsing bug in `autoInject` with complicated function bodies (#1663) -- Added ES6+ configuration for Browserify bundlers (#1653) -- Various doc fixes (#1664, #1658, #1665, #1652) - -# v3.0.1 - -## Bug fixes -- Fixed a regression where arrays passed to `queue` and `cargo` would be completely flattened. (#1645) -- Clarified Async's browser support (#1643) - - -# v3.0.0 - -The `async`/`await` release! - -There are a lot of new features and subtle breaking changes in this major version, but the biggest feature is that most Async methods return a Promise if you omit the callback, meaning you can `await` them from within an `async` function. - -```js -const results = await async.mapLimit(urls, 5, async url => { - const resp = await fetch(url) - return resp.body -}) -``` - -## Breaking Changes -- Most Async methods return a Promise when the final callback is omitted, making them `await`-able! (#1572) -- We are now making heavy use of ES2015 features, this means we have dropped out-of-the-box support for Node 4 and earlier, and many old versions of browsers. (#1541, #1553) -- In `queue`, `priorityQueue`, `cargo` and `cargoQueue`, the "event"-style methods, like `q.drain` and `q.saturated` are now methods that register a callback, rather than properties you assign a callback to. They are now of the form `q.drain(callback)`. If you do not pass a callback a Promise will be returned for the next occurrence of the event, making them `await`-able, e.g. `await q.drain()`. (#1586, #1641) -- Calling `callback(false)` will cancel an async method, preventing further iteration and callback calls. This is useful for preventing memory leaks when you break out of an async flow by calling an outer callback. (#1064, #1542) -- `during` and `doDuring` have been removed, and instead `whilst`, `doWhilst`, `until` and `doUntil` now have asynchronous `test` functions. (#850, #1557) -- `limits` of less than 1 now cause an error to be thrown in queues and collection methods. (#1249, #1552) -- `memoize` no longer memoizes errors (#1465, #1466) -- `applyEach`/`applyEachSeries` have a simpler interface, to make them more easily type-able. It always returns a function that takes in a single callback argument. If that callback is omitted, a promise is returned, making it awaitable. (#1228, #1640) - -## New Features -- Async generators are now supported in all the Collection methods. (#1560) -- Added `cargoQueue`, a queue with both `concurrency` and `payload` size parameters. (#1567) -- Queue objects returned from `queue` now have a `Symbol.iterator` method, meaning they can be iterated over to inspect the current list of items in the queue. (#1459, #1556) -- A ESM-flavored `async.mjs` is included in the `async` package. This is described in the `package.json` `"module"` field, meaning it should be automatically used by Webpack and other compatible bundlers. - -## Bug fixes -- Better handle arbitrary error objects in `asyncify` (#1568, #1569) - -## Other -- Removed Lodash as a dependency (#1283, #1528) -- Miscellaneous docs fixes (#1393, #1501, #1540, #1543, #1558, #1563, #1564, #1579, #1581) -- Miscellaneous test fixes (#1538) - -------- - -# v2.6.1 -- Updated lodash to prevent `npm audit` warnings. (#1532, #1533) -- Made `async-es` more optimized for webpack users (#1517) -- Fixed a stack overflow with large collections and a synchronous iterator (#1514) -- Various small fixes/chores (#1505, #1511, #1527, #1530) - -# v2.6.0 -- Added missing aliases for many methods. Previously, you could not (e.g.) `require('async/find')` or use `async.anyLimit`. (#1483) -- Improved `queue` performance. (#1448, #1454) -- Add missing sourcemap (#1452, #1453) -- Various doc updates (#1448, #1471, #1483) - -# v2.5.0 -- Added `concatLimit`, the `Limit` equivalent of [`concat`](https://caolan.github.io/async/docs.html#concat) ([#1426](https://github.com/caolan/async/issues/1426), [#1430](https://github.com/caolan/async/pull/1430)) -- `concat` improvements: it now preserves order, handles falsy values and the `iteratee` callback takes a variable number of arguments ([#1437](https://github.com/caolan/async/issues/1437), [#1436](https://github.com/caolan/async/pull/1436)) -- Fixed an issue in `queue` where there was a size discrepancy between `workersList().length` and `running()` ([#1428](https://github.com/caolan/async/issues/1428), [#1429](https://github.com/caolan/async/pull/1429)) -- Various doc fixes ([#1422](https://github.com/caolan/async/issues/1422), [#1424](https://github.com/caolan/async/pull/1424)) - -# v2.4.1 -- Fixed a bug preventing functions wrapped with `timeout()` from being re-used. ([#1418](https://github.com/caolan/async/issues/1418), [#1419](https://github.com/caolan/async/issues/1419)) - -# v2.4.0 -- Added `tryEach`, for running async functions in parallel, where you only expect one to succeed. ([#1365](https://github.com/caolan/async/issues/1365), [#687](https://github.com/caolan/async/issues/687)) -- Improved performance, most notably in `parallel` and `waterfall` ([#1395](https://github.com/caolan/async/issues/1395)) -- Added `queue.remove()`, for removing items in a `queue` ([#1397](https://github.com/caolan/async/issues/1397), [#1391](https://github.com/caolan/async/issues/1391)) -- Fixed using `eval`, preventing Async from running in pages with Content Security Policy ([#1404](https://github.com/caolan/async/issues/1404), [#1403](https://github.com/caolan/async/issues/1403)) -- Fixed errors thrown in an `asyncify`ed function's callback being caught by the underlying Promise ([#1408](https://github.com/caolan/async/issues/1408)) -- Fixed timing of `queue.empty()` ([#1367](https://github.com/caolan/async/issues/1367)) -- Various doc fixes ([#1314](https://github.com/caolan/async/issues/1314), [#1394](https://github.com/caolan/async/issues/1394), [#1412](https://github.com/caolan/async/issues/1412)) - -# v2.3.0 -- Added support for ES2017 `async` functions. Wherever you can pass a Node-style/CPS function that uses a callback, you can also pass an `async` function. Previously, you had to wrap `async` functions with `asyncify`. The caveat is that it will only work if `async` functions are supported natively in your environment, transpiled implementations can't be detected. ([#1386](https://github.com/caolan/async/issues/1386), [#1390](https://github.com/caolan/async/issues/1390)) -- Small doc fix ([#1392](https://github.com/caolan/async/issues/1392)) - -# v2.2.0 -- Added `groupBy`, and the `Series`/`Limit` equivalents, analogous to [`_.groupBy`](http://lodash.com/docs#groupBy) ([#1364](https://github.com/caolan/async/issues/1364)) -- Fixed `transform` bug when `callback` was not passed ([#1381](https://github.com/caolan/async/issues/1381)) -- Added note about `reflect` to `parallel` docs ([#1385](https://github.com/caolan/async/issues/1385)) - -# v2.1.5 -- Fix `auto` bug when function names collided with Array.prototype ([#1358](https://github.com/caolan/async/issues/1358)) -- Improve some error messages ([#1349](https://github.com/caolan/async/issues/1349)) -- Avoid stack overflow case in queue -- Fixed an issue in `some`, `every` and `find` where processing would continue after the result was determined. -- Cleanup implementations of `some`, `every` and `find` - -# v2.1.3 -- Make bundle size smaller -- Create optimized hotpath for `filter` in array case. - -# v2.1.2 -- Fixed a stackoverflow bug with `detect`, `some`, `every` on large inputs ([#1293](https://github.com/caolan/async/issues/1293)). - -# v2.1.0 - -- `retry` and `retryable` now support an optional `errorFilter` function that determines if the `task` should retry on the error ([#1256](https://github.com/caolan/async/issues/1256), [#1261](https://github.com/caolan/async/issues/1261)) -- Optimized array iteration in `race`, `cargo`, `queue`, and `priorityQueue` ([#1253](https://github.com/caolan/async/issues/1253)) -- Added alias documentation to doc site ([#1251](https://github.com/caolan/async/issues/1251), [#1254](https://github.com/caolan/async/issues/1254)) -- Added [BootStrap scrollspy](http://getbootstrap.com/javascript/#scrollspy) to docs to highlight in the sidebar the current method being viewed ([#1289](https://github.com/caolan/async/issues/1289), [#1300](https://github.com/caolan/async/issues/1300)) -- Various minor doc fixes ([#1263](https://github.com/caolan/async/issues/1263), [#1264](https://github.com/caolan/async/issues/1264), [#1271](https://github.com/caolan/async/issues/1271), [#1278](https://github.com/caolan/async/issues/1278), [#1280](https://github.com/caolan/async/issues/1280), [#1282](https://github.com/caolan/async/issues/1282), [#1302](https://github.com/caolan/async/issues/1302)) - -# v2.0.1 - -- Significantly optimized all iteration based collection methods such as `each`, `map`, `filter`, etc ([#1245](https://github.com/caolan/async/issues/1245), [#1246](https://github.com/caolan/async/issues/1246), [#1247](https://github.com/caolan/async/issues/1247)). - -# v2.0.0 - -Lots of changes here! - -First and foremost, we have a slick new [site for docs](https://caolan.github.io/async/). Special thanks to [**@hargasinski**](https://github.com/hargasinski) for his work converting our old docs to `jsdoc` format and implementing the new website. Also huge ups to [**@ivanseidel**](https://github.com/ivanseidel) for designing our new logo. It was a long process for both of these tasks, but I think these changes turned out extraordinary well. - -The biggest feature is modularization. You can now `require("async/series")` to only require the `series` function. Every Async library function is available this way. You still can `require("async")` to require the entire library, like you could do before. - -We also provide Async as a collection of ES2015 modules. You can now `import {each} from 'async-es'` or `import waterfall from 'async-es/waterfall'`. If you are using only a few Async functions, and are using a ES bundler such as Rollup, this can significantly lower your build size. - -Major thanks to [**@Kikobeats**](github.com/Kikobeats), [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for doing the majority of the modularization work, as well as [**@jdalton**](github.com/jdalton) and [**@Rich-Harris**](github.com/Rich-Harris) for advisory work on the general modularization strategy. - -Another one of the general themes of the 2.0 release is standardization of what an "async" function is. We are now more strictly following the node-style continuation passing style. That is, an async function is a function that: - -1. Takes a variable number of arguments -2. The last argument is always a callback -3. The callback can accept any number of arguments -4. The first argument passed to the callback will be treated as an error result, if the argument is truthy -5. Any number of result arguments can be passed after the "error" argument -6. The callback is called once and exactly once, either on the same tick or later tick of the JavaScript event loop. - -There were several cases where Async accepted some functions that did not strictly have these properties, most notably `auto`, `every`, `some`, `filter`, `reject` and `detect`. - -Another theme is performance. We have eliminated internal deferrals in all cases where they make sense. For example, in `waterfall` and `auto`, there was a `setImmediate` between each task -- these deferrals have been removed. A `setImmediate` call can add up to 1ms of delay. This might not seem like a lot, but it can add up if you are using many Async functions in the course of processing a HTTP request, for example. Nearly all asynchronous functions that do I/O already have some sort of deferral built in, so the extra deferral is unnecessary. The trade-off of this change is removing our built-in stack-overflow defense. Many synchronous callback calls in series can quickly overflow the JS call stack. If you do have a function that is sometimes synchronous (calling its callback on the same tick), and are running into stack overflows, wrap it with `async.ensureAsync()`. - -Another big performance win has been re-implementing `queue`, `cargo`, and `priorityQueue` with [doubly linked lists](https://en.wikipedia.org/wiki/Doubly_linked_list) instead of arrays. This has lead to queues being an order of [magnitude faster on large sets of tasks](https://github.com/caolan/async/pull/1205). - -## New Features - -- Async is now modularized. Individual functions can be `require()`d from the main package. (`require('async/auto')`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996)) -- Async is also available as a collection of ES2015 modules in the new `async-es` package. (`import {forEachSeries} from 'async-es'`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996)) -- Added `race`, analogous to `Promise.race()`. It will run an array of async tasks in parallel and will call its callback with the result of the first task to respond. ([#568](https://github.com/caolan/async/issues/568), [#1038](https://github.com/caolan/async/issues/1038)) -- Collection methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. ([#579](https://github.com/caolan/async/issues/579), [#839](https://github.com/caolan/async/issues/839), [#1074](https://github.com/caolan/async/issues/1074)) -- Added `mapValues`, for mapping over the properties of an object and returning an object with the same keys. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177)) -- Added `timeout`, a wrapper for an async function that will make the task time-out after the specified time. ([#1007](https://github.com/caolan/async/issues/1007), [#1027](https://github.com/caolan/async/issues/1027)) -- Added `reflect` and `reflectAll`, analagous to [`Promise.reflect()`](http://bluebirdjs.com/docs/api/reflect.html), a wrapper for async tasks that always succeeds, by gathering results and errors into an object. ([#942](https://github.com/caolan/async/issues/942), [#1012](https://github.com/caolan/async/issues/1012), [#1095](https://github.com/caolan/async/issues/1095)) -- `constant` supports dynamic arguments -- it will now always use its last argument as the callback. ([#1016](https://github.com/caolan/async/issues/1016), [#1052](https://github.com/caolan/async/issues/1052)) -- `setImmediate` and `nextTick` now support arguments to partially apply to the deferred function, like the node-native versions do. ([#940](https://github.com/caolan/async/issues/940), [#1053](https://github.com/caolan/async/issues/1053)) -- `auto` now supports resolving cyclic dependencies using [Kahn's algorithm](https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm) ([#1140](https://github.com/caolan/async/issues/1140)). -- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. ([#608](https://github.com/caolan/async/issues/608), [#1055](https://github.com/caolan/async/issues/1055), [#1099](https://github.com/caolan/async/issues/1099), [#1100](https://github.com/caolan/async/issues/1100)) -- You can now limit the concurrency of `auto` tasks. ([#635](https://github.com/caolan/async/issues/635), [#637](https://github.com/caolan/async/issues/637)) -- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. ([#1058](https://github.com/caolan/async/issues/1058)) -- `retry` now supports specifying a function that determines the next time interval, useful for exponential backoff, logging and other retry strategies. ([#1161](https://github.com/caolan/async/issues/1161)) -- `retry` will now pass all of the arguments the task function was resolved with to the callback ([#1231](https://github.com/caolan/async/issues/1231)). -- Added `q.unsaturated` -- callback called when a `queue`'s number of running workers falls below a threshold. ([#868](https://github.com/caolan/async/issues/868), [#1030](https://github.com/caolan/async/issues/1030), [#1033](https://github.com/caolan/async/issues/1033), [#1034](https://github.com/caolan/async/issues/1034)) -- Added `q.error` -- a callback called whenever a `queue` task calls its callback with an error. ([#1170](https://github.com/caolan/async/issues/1170)) -- `applyEach` and `applyEachSeries` now pass results to the final callback. ([#1088](https://github.com/caolan/async/issues/1088)) - -## Breaking changes - -- Calling a callback more than once is considered an error, and an error will be thrown. This had an explicit breaking change in `waterfall`. If you were relying on this behavior, you should more accurately represent your control flow as an event emitter or stream. ([#814](https://github.com/caolan/async/issues/814), [#815](https://github.com/caolan/async/issues/815), [#1048](https://github.com/caolan/async/issues/1048), [#1050](https://github.com/caolan/async/issues/1050)) -- `auto` task functions now always take the callback as the last argument. If a task has dependencies, the `results` object will be passed as the first argument. To migrate old task functions, wrap them with [`_.flip`](https://lodash.com/docs#flip) ([#1036](https://github.com/caolan/async/issues/1036), [#1042](https://github.com/caolan/async/issues/1042)) -- Internal `setImmediate` calls have been refactored away. This may make existing flows vulnerable to stack overflows if you use many synchronous functions in series. Use `ensureAsync` to work around this. ([#696](https://github.com/caolan/async/issues/696), [#704](https://github.com/caolan/async/issues/704), [#1049](https://github.com/caolan/async/issues/1049), [#1050](https://github.com/caolan/async/issues/1050)) -- `map` used to return an object when iterating over an object. `map` now always returns an array, like in other libraries. The previous object behavior has been split out into `mapValues`. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177)) -- `filter`, `reject`, `some`, `every`, `detect` and their families like `{METHOD}Series` and `{METHOD}Limit` now expect an error as the first callback argument, rather than just a simple boolean. Pass `null` as the first argument, or use `fs.access` instead of `fs.exists`. ([#118](https://github.com/caolan/async/issues/118), [#774](https://github.com/caolan/async/issues/774), [#1028](https://github.com/caolan/async/issues/1028), [#1041](https://github.com/caolan/async/issues/1041)) -- `{METHOD}` and `{METHOD}Series` are now implemented in terms of `{METHOD}Limit`. This is a major internal simplification, and is not expected to cause many problems, but it does subtly affect how functions execute internally. ([#778](https://github.com/caolan/async/issues/778), [#847](https://github.com/caolan/async/issues/847)) -- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. ([#1054](https://github.com/caolan/async/issues/1054), [#1058](https://github.com/caolan/async/issues/1058)) -- The test function for `whilst`, `until`, and `during` used to be passed non-error args from the iteratee function's callback, but this led to weirdness where the first call of the test function would be passed no args. We have made it so the test function is never passed extra arguments, and only the `doWhilst`, `doUntil`, and `doDuring` functions pass iteratee callback arguments to the test function ([#1217](https://github.com/caolan/async/issues/1217), [#1224](https://github.com/caolan/async/issues/1224)) -- The `q.tasks` array has been renamed `q._tasks` and is now implemented as a doubly linked list (DLL). Any code that used to interact with this array will need to be updated to either use the provided helpers or support DLLs ([#1205](https://github.com/caolan/async/issues/1205)). -- The timing of the `q.saturated()` callback in a `queue` has been modified to better reflect when tasks pushed to the queue will start queueing. ([#724](https://github.com/caolan/async/issues/724), [#1078](https://github.com/caolan/async/issues/1078)) -- Removed `iterator` method in favour of [ES2015 iterator protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators ) which natively supports arrays ([#1237](https://github.com/caolan/async/issues/1237)) -- Dropped support for Component, Jam, SPM, and Volo ([#1175](https://github.com/caolan/async/issues/1175), #[#176](https://github.com/caolan/async/issues/176)) - -## Bug Fixes - -- Improved handling of no dependency cases in `auto` & `autoInject` ([#1147](https://github.com/caolan/async/issues/1147)). -- Fixed a bug where the callback generated by `asyncify` with `Promises` could resolve twice ([#1197](https://github.com/caolan/async/issues/1197)). -- Fixed several documented optional callbacks not actually being optional ([#1223](https://github.com/caolan/async/issues/1223)). - -## Other - -- Added `someSeries` and `everySeries` for symmetry, as well as a complete set of `any`/`anyLimit`/`anySeries` and `all`/`/allLmit`/`allSeries` aliases. -- Added `find` as an alias for `detect. (as well as `findLimit` and `findSeries`). -- Various doc fixes ([#1005](https://github.com/caolan/async/issues/1005), [#1008](https://github.com/caolan/async/issues/1008), [#1010](https://github.com/caolan/async/issues/1010), [#1015](https://github.com/caolan/async/issues/1015), [#1021](https://github.com/caolan/async/issues/1021), [#1037](https://github.com/caolan/async/issues/1037), [#1039](https://github.com/caolan/async/issues/1039), [#1051](https://github.com/caolan/async/issues/1051), [#1102](https://github.com/caolan/async/issues/1102), [#1107](https://github.com/caolan/async/issues/1107), [#1121](https://github.com/caolan/async/issues/1121), [#1123](https://github.com/caolan/async/issues/1123), [#1129](https://github.com/caolan/async/issues/1129), [#1135](https://github.com/caolan/async/issues/1135), [#1138](https://github.com/caolan/async/issues/1138), [#1141](https://github.com/caolan/async/issues/1141), [#1153](https://github.com/caolan/async/issues/1153), [#1216](https://github.com/caolan/async/issues/1216), [#1217](https://github.com/caolan/async/issues/1217), [#1232](https://github.com/caolan/async/issues/1232), [#1233](https://github.com/caolan/async/issues/1233), [#1236](https://github.com/caolan/async/issues/1236), [#1238](https://github.com/caolan/async/issues/1238)) - -Thank you [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for taking the lead on version 2 of async. - ------------------------------------------- - -# v1.5.2 -- Allow using `"constructor"` as an argument in `memoize` ([#998](https://github.com/caolan/async/issues/998)) -- Give a better error messsage when `auto` dependency checking fails ([#994](https://github.com/caolan/async/issues/994)) -- Various doc updates ([#936](https://github.com/caolan/async/issues/936), [#956](https://github.com/caolan/async/issues/956), [#979](https://github.com/caolan/async/issues/979), [#1002](https://github.com/caolan/async/issues/1002)) - -# v1.5.1 -- Fix issue with `pause` in `queue` with concurrency enabled ([#946](https://github.com/caolan/async/issues/946)) -- `while` and `until` now pass the final result to callback ([#963](https://github.com/caolan/async/issues/963)) -- `auto` will properly handle concurrency when there is no callback ([#966](https://github.com/caolan/async/issues/966)) -- `auto` will no. properly stop execution when an error occurs ([#988](https://github.com/caolan/async/issues/988), [#993](https://github.com/caolan/async/issues/993)) -- Various doc fixes ([#971](https://github.com/caolan/async/issues/971), [#980](https://github.com/caolan/async/issues/980)) - -# v1.5.0 - -- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) ([#892](https://github.com/caolan/async/issues/892)) -- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. ([#873](https://github.com/caolan/async/issues/873)) -- `auto` now accepts an optional `concurrency` argument to limit the number o. running tasks ([#637](https://github.com/caolan/async/issues/637)) -- Added `queue#workersList()`, to retrieve the lis. of currently running tasks. ([#891](https://github.com/caolan/async/issues/891)) -- Various code simplifications ([#896](https://github.com/caolan/async/issues/896), [#904](https://github.com/caolan/async/issues/904)) -- Various doc fixes :scroll: ([#890](https://github.com/caolan/async/issues/890), [#894](https://github.com/caolan/async/issues/894), [#903](https://github.com/caolan/async/issues/903), [#905](https://github.com/caolan/async/issues/905), [#912](https://github.com/caolan/async/issues/912)) - -# v1.4.2 - -- Ensure coverage files don't get published on npm ([#879](https://github.com/caolan/async/issues/879)) - -# v1.4.1 - -- Add in overlooked `detectLimit` method ([#866](https://github.com/caolan/async/issues/866)) -- Removed unnecessary files from npm releases ([#861](https://github.com/caolan/async/issues/861)) -- Removed usage of a reserved word to prevent :boom: in older environments ([#870](https://github.com/caolan/async/issues/870)) - -# v1.4.0 - -- `asyncify` now supports promises ([#840](https://github.com/caolan/async/issues/840)) -- Added `Limit` versions of `filter` and `reject` ([#836](https://github.com/caolan/async/issues/836)) -- Add `Limit` versions of `detect`, `some` and `every` ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829)) -- `some`, `every` and `detect` now short circuit early ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829)) -- Improve detection of the global object ([#804](https://github.com/caolan/async/issues/804)), enabling use in WebWorkers -- `whilst` now called with arguments from iterator ([#823](https://github.com/caolan/async/issues/823)) -- `during` now gets called with arguments from iterator ([#824](https://github.com/caolan/async/issues/824)) -- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0)) - - -# v1.3.0 - -New Features: -- Added `constant` -- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. ([#671](https://github.com/caolan/async/issues/671), [#806](https://github.com/caolan/async/issues/806)) -- Added `during` and `doDuring`, which are like `whilst` with an async truth test. ([#800](https://github.com/caolan/async/issues/800)) -- `retry` now accepts an `interval` parameter to specify a delay between retries. ([#793](https://github.com/caolan/async/issues/793)) -- `async` should work better in Web Workers due to better `root` detection ([#804](https://github.com/caolan/async/issues/804)) -- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` ([#642](https://github.com/caolan/async/issues/642)) -- Various internal updates ([#786](https://github.com/caolan/async/issues/786), [#801](https://github.com/caolan/async/issues/801), [#802](https://github.com/caolan/async/issues/802), [#803](https://github.com/caolan/async/issues/803)) -- Various doc fixes ([#790](https://github.com/caolan/async/issues/790), [#794](https://github.com/caolan/async/issues/794)) - -Bug Fixes: -- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. ([#740](https://github.com/caolan/async/issues/740), [#744](https://github.com/caolan/async/issues/744), [#783](https://github.com/caolan/async/issues/783)) - - -# v1.2.1 - -Bug Fix: - -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782)) - - -# v1.2.0 - -New Features: - -- Added `timesLimit` ([#743](https://github.com/caolan/async/issues/743)) -- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. ([#747](https://github.com/caolan/async/issues/747), [#772](https://github.com/caolan/async/issues/772)) - -Bug Fixes: - -- Fixed a regression in `each` and family with empty arrays that have additional properties. ([#775](https://github.com/caolan/async/issues/775), [#777](https://github.com/caolan/async/issues/777)) - - -# v1.1.1 - -Bug Fix: - -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782)) - - -# v1.1.0 - -New Features: - -- `cargo` now supports all of the same methods and event callbacks as `queue`. -- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. ([#769](https://github.com/caolan/async/issues/769)) -- Optimized `map`, `eachOf`, and `waterfall` families of functions -- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array ([#667](https://github.com/caolan/async/issues/667)). -- The callback is now optional for the composed results of `compose` and `seq`. ([#618](https://github.com/caolan/async/issues/618)) -- Reduced file size by 4kb, (minified version by 1kb) -- Added code coverage through `nyc` and `coveralls` ([#768](https://github.com/caolan/async/issues/768)) - -Bug Fixes: - -- `forever` will no longer stack overflow with a synchronous iterator ([#622](https://github.com/caolan/async/issues/622)) -- `eachLimit` and other limit functions will stop iterating once an error occurs ([#754](https://github.com/caolan/async/issues/754)) -- Always pass `null` in callbacks when there is no error ([#439](https://github.com/caolan/async/issues/439)) -- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue ([#668](https://github.com/caolan/async/issues/668)) -- `each` and family will properly handle an empty array ([#578](https://github.com/caolan/async/issues/578)) -- `eachSeries` and family will finish if the underlying array is modified during execution ([#557](https://github.com/caolan/async/issues/557)) -- `queue` will throw if a non-function is passed to `q.push()` ([#593](https://github.com/caolan/async/issues/593)) -- Doc fixes ([#629](https://github.com/caolan/async/issues/629), [#766](https://github.com/caolan/async/issues/766)) - - -# v1.0.0 - -No known breaking changes, we are simply complying with semver from here on out. - -Changes: - -- Start using a changelog! -- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) ([#168](https://github.com/caolan/async/issues/168) [#704](https://github.com/caolan/async/issues/704) [#321](https://github.com/caolan/async/issues/321)) -- Detect deadlocks in `auto` ([#663](https://github.com/caolan/async/issues/663)) -- Better support for require.js ([#527](https://github.com/caolan/async/issues/527)) -- Throw if queue created with concurrency `0` ([#714](https://github.com/caolan/async/issues/714)) -- Fix unneeded iteration in `queue.resume()` ([#758](https://github.com/caolan/async/issues/758)) -- Guard against timer mocking overriding `setImmediate` ([#609](https://github.com/caolan/async/issues/609) [#611](https://github.com/caolan/async/issues/611)) -- Miscellaneous doc fixes ([#542](https://github.com/caolan/async/issues/542) [#596](https://github.com/caolan/async/issues/596) [#615](https://github.com/caolan/async/issues/615) [#628](https://github.com/caolan/async/issues/628) [#631](https://github.com/caolan/async/issues/631) [#690](https://github.com/caolan/async/issues/690) [#729](https://github.com/caolan/async/issues/729)) -- Use single noop function internally ([#546](https://github.com/caolan/async/issues/546)) -- Optimize internal `_each`, `_map` and `_keys` functions. diff --git a/node_modules/async/LICENSE b/node_modules/async/LICENSE deleted file mode 100644 index b18aed69..00000000 --- a/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010-2018 Caolan McMahon - -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. diff --git a/node_modules/async/README.md b/node_modules/async/README.md deleted file mode 100644 index c679263b..00000000 --- a/node_modules/async/README.md +++ /dev/null @@ -1,60 +0,0 @@ -![Async Logo](https://raw.githubusercontent.com/caolan/async/master/logo/async-logo_readme.jpg) - -[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) -[![Build Status via Azure Pipelines](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) -[![NPM version](https://img.shields.io/npm/v/async.svg)](https://www.npmjs.com/package/async) -[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master) -[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/async/badge?style=rounded)](https://www.jsdelivr.com/package/npm/async) - - - -Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/v3/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm i async`, it can also be used directly in the browser. A ESM/MJS version is included in the main `async` package that should automatically be used with compatible bundlers such as Webpack and Rollup. - -A pure ESM version of Async is available as [`async-es`](https://www.npmjs.com/package/async-es). - -For Documentation, visit - -*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)* - - -```javascript -// for use with Node-style callbacks... -var async = require("async"); - -var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; -var configs = {}; - -async.forEachOf(obj, (value, key, callback) => { - fs.readFile(__dirname + value, "utf8", (err, data) => { - if (err) return callback(err); - try { - configs[key] = JSON.parse(data); - } catch (e) { - return callback(e); - } - callback(); - }); -}, err => { - if (err) console.error(err.message); - // configs is now a map of JSON data - doSomethingWith(configs); -}); -``` - -```javascript -var async = require("async"); - -// ...or ES2017 async functions -async.mapLimit(urls, 5, async function(url) { - const response = await fetch(url) - return response.body -}, (err, results) => { - if (err) throw err - // results is now an array of the response bodies - console.log(results) -}) -``` diff --git a/node_modules/async/all.js b/node_modules/async/all.js deleted file mode 100644 index 1c2e5360..00000000 --- a/node_modules/async/all.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns `true` if every element in `coll` satisfies an async test. If any - * iteratee call returns `false`, the main `callback` is immediately called. - * - * @name every - * @static - * @memberOf module:Collections - * @method - * @alias all - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.every(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then every file exists - * }); - */ -function every(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(every, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/allLimit.js b/node_modules/async/allLimit.js deleted file mode 100644 index bb78378d..00000000 --- a/node_modules/async/allLimit.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. - * - * @name everyLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function everyLimit(coll, limit, iteratee, callback) { - return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(everyLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/allSeries.js b/node_modules/async/allSeries.js deleted file mode 100644 index 76eeaf7e..00000000 --- a/node_modules/async/allSeries.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. - * - * @name everySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in series. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function everySeries(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(everySeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/any.js b/node_modules/async/any.js deleted file mode 100644 index 0e987a16..00000000 --- a/node_modules/async/any.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns `true` if at least one element in the `coll` satisfies an async test. - * If any iteratee call returns `true`, the main `callback` is immediately - * called. - * - * @name some - * @static - * @memberOf module:Collections - * @method - * @alias any - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.some(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then at least one of the files exists - * }); - */ -function some(coll, iteratee, callback) { - return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(some, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/anyLimit.js b/node_modules/async/anyLimit.js deleted file mode 100644 index 22b60dbb..00000000 --- a/node_modules/async/anyLimit.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. - * - * @name someLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anyLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function someLimit(coll, limit, iteratee, callback) { - return (0, _createTester2.default)(Boolean, res => res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(someLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/anySeries.js b/node_modules/async/anySeries.js deleted file mode 100644 index 7f7f801f..00000000 --- a/node_modules/async/anySeries.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. - * - * @name someSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anySeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in series. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function someSeries(coll, iteratee, callback) { - return (0, _createTester2.default)(Boolean, res => res)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(someSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/apply.js b/node_modules/async/apply.js deleted file mode 100644 index 5246833a..00000000 --- a/node_modules/async/apply.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (fn, ...args) { - return (...callArgs) => fn(...args, ...callArgs); -}; - -module.exports = exports["default"]; /** - * Creates a continuation function with some arguments already applied. - * - * Useful as a shorthand when combined with other control flow functions. Any - * arguments passed to the returned function are added to the arguments - * originally passed to apply. - * - * @name apply - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {Function} fn - The function you want to eventually apply all - * arguments to. Invokes with (arguments...). - * @param {...*} arguments... - Any number of arguments to automatically apply - * when the continuation is called. - * @returns {Function} the partially-applied function - * @example - * - * // using apply - * async.parallel([ - * async.apply(fs.writeFile, 'testfile1', 'test1'), - * async.apply(fs.writeFile, 'testfile2', 'test2') - * ]); - * - * - * // the same process without using apply - * async.parallel([ - * function(callback) { - * fs.writeFile('testfile1', 'test1', callback); - * }, - * function(callback) { - * fs.writeFile('testfile2', 'test2', callback); - * } - * ]); - * - * // It's possible to pass any number of additional arguments when calling the - * // continuation: - * - * node> var fn = async.apply(sys.puts, 'one'); - * node> fn('two', 'three'); - * one - * two - * three - */ \ No newline at end of file diff --git a/node_modules/async/applyEach.js b/node_modules/async/applyEach.js deleted file mode 100644 index 2ecefc18..00000000 --- a/node_modules/async/applyEach.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _applyEach = require('./internal/applyEach'); - -var _applyEach2 = _interopRequireDefault(_applyEach); - -var _map = require('./map'); - -var _map2 = _interopRequireDefault(_map); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Applies the provided arguments to each function in the array, calling - * `callback` after all functions have completed. If you only provide the first - * argument, `fns`, then it will return a function which lets you pass in the - * arguments as if it were a single function call. If more arguments are - * provided, `callback` is required while `args` is still optional. The results - * for each of the applied async functions are passed to the final callback - * as an array. - * - * @name applyEach - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s - * to all call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {AsyncFunction} - Returns a function that takes no args other than - * an optional callback, that is the result of applying the `args` to each - * of the functions. - * @example - * - * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket') - * - * appliedFn((err, results) => { - * // results[0] is the results for `enableSearch` - * // results[1] is the results for `updateSchema` - * }); - * - * // partial application example: - * async.each( - * buckets, - * async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(), - * callback - * ); - */ -exports.default = (0, _applyEach2.default)(_map2.default); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/applyEachSeries.js b/node_modules/async/applyEachSeries.js deleted file mode 100644 index c9d56464..00000000 --- a/node_modules/async/applyEachSeries.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _applyEach = require('./internal/applyEach'); - -var _applyEach2 = _interopRequireDefault(_applyEach); - -var _mapSeries = require('./mapSeries'); - -var _mapSeries2 = _interopRequireDefault(_mapSeries); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. - * - * @name applyEachSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.applyEach]{@link module:ControlFlow.applyEach} - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all - * call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {AsyncFunction} - A function, that when called, is the result of - * appling the `args` to the list of functions. It takes no args, other than - * a callback. - */ -exports.default = (0, _applyEach2.default)(_mapSeries2.default); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/asyncify.js b/node_modules/async/asyncify.js deleted file mode 100644 index 23623175..00000000 --- a/node_modules/async/asyncify.js +++ /dev/null @@ -1,118 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = asyncify; - -var _initialParams = require('./internal/initialParams'); - -var _initialParams2 = _interopRequireDefault(_initialParams); - -var _setImmediate = require('./internal/setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -var _wrapAsync = require('./internal/wrapAsync'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Take a sync function and make it async, passing its return value to a - * callback. This is useful for plugging sync functions into a waterfall, - * series, or other async functions. Any arguments passed to the generated - * function will be passed to the wrapped function (except for the final - * callback argument). Errors thrown will be passed to the callback. - * - * If the function passed to `asyncify` returns a Promise, that promises's - * resolved/rejected state will be used to call the callback, rather than simply - * the synchronous return value. - * - * This also means you can asyncify ES2017 `async` functions. - * - * @name asyncify - * @static - * @memberOf module:Utils - * @method - * @alias wrapSync - * @category Util - * @param {Function} func - The synchronous function, or Promise-returning - * function to convert to an {@link AsyncFunction}. - * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be - * invoked with `(args..., callback)`. - * @example - * - * // passing a regular synchronous function - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(JSON.parse), - * function (data, next) { - * // data is the result of parsing the text. - * // If there was a parsing error, it would have been caught. - * } - * ], callback); - * - * // passing a function returning a promise - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(function (contents) { - * return db.model.create(contents); - * }), - * function (model, next) { - * // `model` is the instantiated model object. - * // If there was an error, this function would be skipped. - * } - * ], callback); - * - * // es2017 example, though `asyncify` is not needed if your JS environment - * // supports async functions out of the box - * var q = async.queue(async.asyncify(async function(file) { - * var intermediateStep = await processFile(file); - * return await somePromise(intermediateStep) - * })); - * - * q.push(files); - */ -function asyncify(func) { - if ((0, _wrapAsync.isAsync)(func)) { - return function (...args /*, callback*/) { - const callback = args.pop(); - const promise = func.apply(this, args); - return handlePromise(promise, callback); - }; - } - - return (0, _initialParams2.default)(function (args, callback) { - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (result && typeof result.then === 'function') { - return handlePromise(result, callback); - } else { - callback(null, result); - } - }); -} - -function handlePromise(promise, callback) { - return promise.then(value => { - invokeCallback(callback, null, value); - }, err => { - invokeCallback(callback, err && err.message ? err : new Error(err)); - }); -} - -function invokeCallback(callback, error, value) { - try { - callback(error, value); - } catch (err) { - (0, _setImmediate2.default)(e => { - throw e; - }, err); - } -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/auto.js b/node_modules/async/auto.js deleted file mode 100644 index f15f0bdf..00000000 --- a/node_modules/async/auto.js +++ /dev/null @@ -1,267 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = auto; - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _promiseCallback = require('./internal/promiseCallback'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on - * their requirements. Each function can optionally depend on other functions - * being completed first, and each function is run as soon as its requirements - * are satisfied. - * - * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence - * will stop. Further tasks will not execute (so any other functions depending - * on it will not run), and the main `callback` is immediately called with the - * error. - * - * {@link AsyncFunction}s also receive an object containing the results of functions which - * have completed so far as the first argument, if they have dependencies. If a - * task function has no dependencies, it will only be passed a callback. - * - * @name auto - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Object} tasks - An object. Each of its properties is either a - * function or an array of requirements, with the {@link AsyncFunction} itself the last item - * in the array. The object's key of a property serves as the name of the task - * defined by that property, i.e. can be used when specifying requirements for - * other tasks. The function receives one or two arguments: - * * a `results` object, containing the results of the previously executed - * functions, only passed if the task has any dependencies, - * * a `callback(err, result)` function, which must be called when finished, - * passing an `error` (which can be `null`) and the result of the function's - * execution. - * @param {number} [concurrency=Infinity] - An optional `integer` for - * determining the maximum number of tasks that can be run in parallel. By - * default, as many as possible. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback. Results are always returned; however, if an - * error occurs, no further `tasks` will be performed, and the results object - * will only contain partial results. Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - * @example - * - * async.auto({ - * // this function will just be passed a callback - * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), - * showData: ['readData', function(results, cb) { - * // results.readData is the file's contents - * // ... - * }] - * }, callback); - * - * async.auto({ - * get_data: function(callback) { - * console.log('in get_data'); - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * console.log('in make_folder'); - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: ['get_data', 'make_folder', function(results, callback) { - * console.log('in write_file', JSON.stringify(results)); - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(results, callback) { - * console.log('in email_link', JSON.stringify(results)); - * // once the file is written let's email a link to it... - * // results.write_file contains the filename returned by write_file. - * callback(null, {'file':results.write_file, 'email':'user@example.com'}); - * }] - * }, function(err, results) { - * console.log('err = ', err); - * console.log('results = ', results); - * }); - */ -function auto(tasks, concurrency, callback) { - if (typeof concurrency !== 'number') { - // concurrency is optional, shift the args. - callback = concurrency; - concurrency = null; - } - callback = (0, _once2.default)(callback || (0, _promiseCallback.promiseCallback)()); - var numTasks = Object.keys(tasks).length; - if (!numTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = numTasks; - } - - var results = {}; - var runningTasks = 0; - var canceled = false; - var hasError = false; - - var listeners = Object.create(null); - - var readyTasks = []; - - // for cycle detection: - var readyToCheck = []; // tasks that have been identified as reachable - // without the possibility of returning to an ancestor task - var uncheckedDependencies = {}; - - Object.keys(tasks).forEach(key => { - var task = tasks[key]; - if (!Array.isArray(task)) { - // no dependencies - enqueueTask(key, [task]); - readyToCheck.push(key); - return; - } - - var dependencies = task.slice(0, task.length - 1); - var remainingDependencies = dependencies.length; - if (remainingDependencies === 0) { - enqueueTask(key, task); - readyToCheck.push(key); - return; - } - uncheckedDependencies[key] = remainingDependencies; - - dependencies.forEach(dependencyName => { - if (!tasks[dependencyName]) { - throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + dependencyName + '` in ' + dependencies.join(', ')); - } - addListener(dependencyName, () => { - remainingDependencies--; - if (remainingDependencies === 0) { - enqueueTask(key, task); - } - }); - }); - }); - - checkForDeadlocks(); - processQueue(); - - function enqueueTask(key, task) { - readyTasks.push(() => runTask(key, task)); - } - - function processQueue() { - if (canceled) return; - if (readyTasks.length === 0 && runningTasks === 0) { - return callback(null, results); - } - while (readyTasks.length && runningTasks < concurrency) { - var run = readyTasks.shift(); - run(); - } - } - - function addListener(taskName, fn) { - var taskListeners = listeners[taskName]; - if (!taskListeners) { - taskListeners = listeners[taskName] = []; - } - - taskListeners.push(fn); - } - - function taskComplete(taskName) { - var taskListeners = listeners[taskName] || []; - taskListeners.forEach(fn => fn()); - processQueue(); - } - - function runTask(key, task) { - if (hasError) return; - - var taskCallback = (0, _onlyOnce2.default)((err, ...result) => { - runningTasks--; - if (err === false) { - canceled = true; - return; - } - if (result.length < 2) { - [result] = result; - } - if (err) { - var safeResults = {}; - Object.keys(results).forEach(rkey => { - safeResults[rkey] = results[rkey]; - }); - safeResults[key] = result; - hasError = true; - listeners = Object.create(null); - if (canceled) return; - callback(err, safeResults); - } else { - results[key] = result; - taskComplete(key); - } - }); - - runningTasks++; - var taskFn = (0, _wrapAsync2.default)(task[task.length - 1]); - if (task.length > 1) { - taskFn(results, taskCallback); - } else { - taskFn(taskCallback); - } - } - - function checkForDeadlocks() { - // Kahn's algorithm - // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm - // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html - var currentTask; - var counter = 0; - while (readyToCheck.length) { - currentTask = readyToCheck.pop(); - counter++; - getDependents(currentTask).forEach(dependent => { - if (--uncheckedDependencies[dependent] === 0) { - readyToCheck.push(dependent); - } - }); - } - - if (counter !== numTasks) { - throw new Error('async.auto cannot execute tasks due to a recursive dependency'); - } - } - - function getDependents(taskName) { - var result = []; - Object.keys(tasks).forEach(key => { - const task = tasks[key]; - if (Array.isArray(task) && task.indexOf(taskName) >= 0) { - result.push(key); - } - }); - return result; - } - - return callback[_promiseCallback.PROMISE_SYMBOL]; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/autoInject.js b/node_modules/async/autoInject.js deleted file mode 100644 index 80125ab8..00000000 --- a/node_modules/async/autoInject.js +++ /dev/null @@ -1,156 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = autoInject; - -var _auto = require('./auto'); - -var _auto2 = _interopRequireDefault(_auto); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/; -var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/; -var FN_ARG_SPLIT = /,/; -var FN_ARG = /(=.+)?(\s*)$/; -var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; - -function parseParams(func) { - const src = func.toString().replace(STRIP_COMMENTS, ''); - let match = src.match(FN_ARGS); - if (!match) { - match = src.match(ARROW_FN_ARGS); - } - if (!match) throw new Error('could not parse args in autoInject\nSource:\n' + src); - let [, args] = match; - return args.replace(/\s/g, '').split(FN_ARG_SPLIT).map(arg => arg.replace(FN_ARG, '').trim()); -} - -/** - * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent - * tasks are specified as parameters to the function, after the usual callback - * parameter, with the parameter names matching the names of the tasks it - * depends on. This can provide even more readable task graphs which can be - * easier to maintain. - * - * If a final callback is specified, the task results are similarly injected, - * specified as named parameters after the initial error parameter. - * - * The autoInject function is purely syntactic sugar and its semantics are - * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. - * - * @name autoInject - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.auto]{@link module:ControlFlow.auto} - * @category Control Flow - * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of - * the form 'func([dependencies...], callback). The object's key of a property - * serves as the name of the task defined by that property, i.e. can be used - * when specifying requirements for other tasks. - * * The `callback` parameter is a `callback(err, result)` which must be called - * when finished, passing an `error` (which can be `null`) and the result of - * the function's execution. The remaining parameters name other tasks on - * which the task is dependent, and the results from those tasks are the - * arguments of those parameters. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback, and a `results` object with any completed - * task results, similar to `auto`. - * @returns {Promise} a promise, if no callback is passed - * @example - * - * // The example from `auto` can be rewritten as follows: - * async.autoInject({ - * get_data: function(callback) { - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: function(get_data, make_folder, callback) { - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }, - * email_link: function(write_file, callback) { - * // once the file is written let's email a link to it... - * // write_file contains the filename returned by write_file. - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * } - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - * - * // If you are using a JS minifier that mangles parameter names, `autoInject` - * // will not work with plain functions, since the parameter names will be - * // collapsed to a single letter identifier. To work around this, you can - * // explicitly specify the names of the parameters your task function needs - * // in an array, similar to Angular.js dependency injection. - * - * // This still has an advantage over plain `auto`, since the results a task - * // depends on are still spread into arguments. - * async.autoInject({ - * //... - * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(write_file, callback) { - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * }] - * //... - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - */ -function autoInject(tasks, callback) { - var newTasks = {}; - - Object.keys(tasks).forEach(key => { - var taskFn = tasks[key]; - var params; - var fnIsAsync = (0, _wrapAsync.isAsync)(taskFn); - var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0; - - if (Array.isArray(taskFn)) { - params = [...taskFn]; - taskFn = params.pop(); - - newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); - } else if (hasNoDeps) { - // no dependencies, use the function as-is - newTasks[key] = taskFn; - } else { - params = parseParams(taskFn); - if (taskFn.length === 0 && !fnIsAsync && params.length === 0) { - throw new Error("autoInject task functions require explicit parameters."); - } - - // remove callback param - if (!fnIsAsync) params.pop(); - - newTasks[key] = params.concat(newTask); - } - - function newTask(results, taskCb) { - var newArgs = params.map(name => results[name]); - newArgs.push(taskCb); - (0, _wrapAsync2.default)(taskFn)(...newArgs); - } - }); - - return (0, _auto2.default)(newTasks, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/bower.json b/node_modules/async/bower.json deleted file mode 100644 index 390c6502..00000000 --- a/node_modules/async/bower.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "async", - "main": "dist/async.js", - "ignore": [ - "bower_components", - "lib", - "test", - "node_modules", - "perf", - "support", - "**/.*", - "*.config.js", - "*.json", - "index.js", - "Makefile" - ] -} diff --git a/node_modules/async/cargo.js b/node_modules/async/cargo.js deleted file mode 100644 index bfb17579..00000000 --- a/node_modules/async/cargo.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = cargo; - -var _queue = require('./internal/queue'); - -var _queue2 = _interopRequireDefault(_queue); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Creates a `cargo` object with the specified payload. Tasks added to the - * cargo will be processed altogether (up to the `payload` limit). If the - * `worker` is in progress, the task is queued until it becomes available. Once - * the `worker` has completed some tasks, each callback of those tasks is - * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) - * for how `cargo` and `queue` work. - * - * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers - * at a time, cargo passes an array of tasks to a single worker, repeating - * when the worker is finished. - * - * @name cargo - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An asynchronous function for processing an array - * of queued tasks. Invoked with `(tasks, callback)`. - * @param {number} [payload=Infinity] - An optional `integer` for determining - * how many tasks should be processed per round; if omitted, the default is - * unlimited. - * @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can - * attached as certain properties to listen for specific events during the - * lifecycle of the cargo and inner queue. - * @example - * - * // create a cargo object with payload 2 - * var cargo = async.cargo(function(tasks, callback) { - * for (var i=0; i { - _iteratee(val, (err, ...args) => { - if (err) return iterCb(err); - return iterCb(err, args); - }); - }, (err, mapResults) => { - var result = []; - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - result = result.concat(...mapResults[i]); - } - } - - return callback(err, result); - }); -} -exports.default = (0, _awaitify2.default)(concatLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/concatSeries.js b/node_modules/async/concatSeries.js deleted file mode 100644 index fbc105b9..00000000 --- a/node_modules/async/concatSeries.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _concatLimit = require('./concatLimit'); - -var _concatLimit2 = _interopRequireDefault(_concatLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. - * - * @name concatSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @alias flatMapSeries - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. - * The iteratee should complete with an array an array of results. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - */ -function concatSeries(coll, iteratee, callback) { - return (0, _concatLimit2.default)(coll, 1, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(concatSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/constant.js b/node_modules/async/constant.js deleted file mode 100644 index 07596538..00000000 --- a/node_modules/async/constant.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (...args) { - return function (...ignoredArgs /*, callback*/) { - var callback = ignoredArgs.pop(); - return callback(null, ...args); - }; -}; - -module.exports = exports["default"]; /** - * Returns a function that when called, calls-back with the values provided. - * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to - * [`auto`]{@link module:ControlFlow.auto}. - * - * @name constant - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {...*} arguments... - Any number of arguments to automatically invoke - * callback with. - * @returns {AsyncFunction} Returns a function that when invoked, automatically - * invokes the callback with the previous given arguments. - * @example - * - * async.waterfall([ - * async.constant(42), - * function (value, next) { - * // value === 42 - * }, - * //... - * ], callback); - * - * async.waterfall([ - * async.constant(filename, "utf8"), - * fs.readFile, - * function (fileData, next) { - * //... - * } - * //... - * ], callback); - * - * async.auto({ - * hostname: async.constant("https://server.net/"), - * port: findFreePort, - * launchServer: ["hostname", "port", function (options, cb) { - * startServer(options, cb); - * }], - * //... - * }, callback); - */ \ No newline at end of file diff --git a/node_modules/async/detect.js b/node_modules/async/detect.js deleted file mode 100644 index 1066b9e8..00000000 --- a/node_modules/async/detect.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns the first value in `coll` that passes an async truth test. The - * `iteratee` is applied in parallel, meaning the first iteratee to return - * `true` will fire the detect `callback` with that result. That means the - * result might not be the first item in the original `coll` (in terms of order) - * that passes the test. - - * If order within the original `coll` is important, then look at - * [`detectSeries`]{@link module:Collections.detectSeries}. - * - * @name detect - * @static - * @memberOf module:Collections - * @method - * @alias find - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns A Promise, if no callback is passed - * @example - * - * async.detect(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // result now equals the first file in the list that exists - * }); - */ -function detect(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(detect, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/detectLimit.js b/node_modules/async/detectLimit.js deleted file mode 100644 index 9e2d3a0d..00000000 --- a/node_modules/async/detectLimit.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a - * time. - * - * @name detectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findLimit - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ -function detectLimit(coll, limit, iteratee, callback) { - return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(detectLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/detectSeries.js b/node_modules/async/detectSeries.js deleted file mode 100644 index cdf38b1d..00000000 --- a/node_modules/async/detectSeries.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. - * - * @name detectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findSeries - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ -function detectSeries(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback); -} - -exports.default = (0, _awaitify2.default)(detectSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/dir.js b/node_modules/async/dir.js deleted file mode 100644 index 85fbcced..00000000 --- a/node_modules/async/dir.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _consoleFunc = require('./internal/consoleFunc'); - -var _consoleFunc2 = _interopRequireDefault(_consoleFunc); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Logs the result of an [`async` function]{@link AsyncFunction} to the - * `console` using `console.dir` to display the properties of the resulting object. - * Only works in Node.js or in browsers that support `console.dir` and - * `console.error` (such as FF and Chrome). - * If multiple arguments are returned from the async function, - * `console.dir` is called on each argument in order. - * - * @name dir - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. - * @example - * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, {hello: name}); - * }, 1000); - * }; - * - * // in the node repl - * node> async.dir(hello, 'world'); - * {hello: 'world'} - */ -exports.default = (0, _consoleFunc2.default)('dir'); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/dist/async.js b/node_modules/async/dist/async.js deleted file mode 100644 index 57e9478f..00000000 --- a/node_modules/async/dist/async.js +++ /dev/null @@ -1,4846 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.async = {}))); -}(this, (function (exports) { 'use strict'; - - /** - * Creates a continuation function with some arguments already applied. - * - * Useful as a shorthand when combined with other control flow functions. Any - * arguments passed to the returned function are added to the arguments - * originally passed to apply. - * - * @name apply - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {Function} fn - The function you want to eventually apply all - * arguments to. Invokes with (arguments...). - * @param {...*} arguments... - Any number of arguments to automatically apply - * when the continuation is called. - * @returns {Function} the partially-applied function - * @example - * - * // using apply - * async.parallel([ - * async.apply(fs.writeFile, 'testfile1', 'test1'), - * async.apply(fs.writeFile, 'testfile2', 'test2') - * ]); - * - * - * // the same process without using apply - * async.parallel([ - * function(callback) { - * fs.writeFile('testfile1', 'test1', callback); - * }, - * function(callback) { - * fs.writeFile('testfile2', 'test2', callback); - * } - * ]); - * - * // It's possible to pass any number of additional arguments when calling the - * // continuation: - * - * node> var fn = async.apply(sys.puts, 'one'); - * node> fn('two', 'three'); - * one - * two - * three - */ - function apply(fn, ...args) { - return (...callArgs) => fn(...args,...callArgs); - } - - function initialParams (fn) { - return function (...args/*, callback*/) { - var callback = args.pop(); - return fn.call(this, args, callback); - }; - } - - /* istanbul ignore file */ - - var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; - var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; - - function fallback(fn) { - setTimeout(fn, 0); - } - - function wrap(defer) { - return (fn, ...args) => defer(() => fn(...args)); - } - - var _defer; - - if (hasSetImmediate) { - _defer = setImmediate; - } else if (hasNextTick) { - _defer = process.nextTick; - } else { - _defer = fallback; - } - - var setImmediate$1 = wrap(_defer); - - /** - * Take a sync function and make it async, passing its return value to a - * callback. This is useful for plugging sync functions into a waterfall, - * series, or other async functions. Any arguments passed to the generated - * function will be passed to the wrapped function (except for the final - * callback argument). Errors thrown will be passed to the callback. - * - * If the function passed to `asyncify` returns a Promise, that promises's - * resolved/rejected state will be used to call the callback, rather than simply - * the synchronous return value. - * - * This also means you can asyncify ES2017 `async` functions. - * - * @name asyncify - * @static - * @memberOf module:Utils - * @method - * @alias wrapSync - * @category Util - * @param {Function} func - The synchronous function, or Promise-returning - * function to convert to an {@link AsyncFunction}. - * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be - * invoked with `(args..., callback)`. - * @example - * - * // passing a regular synchronous function - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(JSON.parse), - * function (data, next) { - * // data is the result of parsing the text. - * // If there was a parsing error, it would have been caught. - * } - * ], callback); - * - * // passing a function returning a promise - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(function (contents) { - * return db.model.create(contents); - * }), - * function (model, next) { - * // `model` is the instantiated model object. - * // If there was an error, this function would be skipped. - * } - * ], callback); - * - * // es2017 example, though `asyncify` is not needed if your JS environment - * // supports async functions out of the box - * var q = async.queue(async.asyncify(async function(file) { - * var intermediateStep = await processFile(file); - * return await somePromise(intermediateStep) - * })); - * - * q.push(files); - */ - function asyncify(func) { - if (isAsync(func)) { - return function (...args/*, callback*/) { - const callback = args.pop(); - const promise = func.apply(this, args); - return handlePromise(promise, callback) - } - } - - return initialParams(function (args, callback) { - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (result && typeof result.then === 'function') { - return handlePromise(result, callback) - } else { - callback(null, result); - } - }); - } - - function handlePromise(promise, callback) { - return promise.then(value => { - invokeCallback(callback, null, value); - }, err => { - invokeCallback(callback, err && err.message ? err : new Error(err)); - }); - } - - function invokeCallback(callback, error, value) { - try { - callback(error, value); - } catch (err) { - setImmediate$1(e => { throw e }, err); - } - } - - function isAsync(fn) { - return fn[Symbol.toStringTag] === 'AsyncFunction'; - } - - function isAsyncGenerator(fn) { - return fn[Symbol.toStringTag] === 'AsyncGenerator'; - } - - function isAsyncIterable(obj) { - return typeof obj[Symbol.asyncIterator] === 'function'; - } - - function wrapAsync(asyncFn) { - if (typeof asyncFn !== 'function') throw new Error('expected a function') - return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; - } - - // conditionally promisify a function. - // only return a promise if a callback is omitted - function awaitify (asyncFn, arity = asyncFn.length) { - if (!arity) throw new Error('arity is undefined') - function awaitable (...args) { - if (typeof args[arity - 1] === 'function') { - return asyncFn.apply(this, args) - } - - return new Promise((resolve, reject) => { - args[arity - 1] = (err, ...cbArgs) => { - if (err) return reject(err) - resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]); - }; - asyncFn.apply(this, args); - }) - } - - return awaitable - } - - function applyEach (eachfn) { - return function applyEach(fns, ...callArgs) { - const go = awaitify(function (callback) { - var that = this; - return eachfn(fns, (fn, cb) => { - wrapAsync(fn).apply(that, callArgs.concat(cb)); - }, callback); - }); - return go; - }; - } - - function _asyncMap(eachfn, arr, iteratee, callback) { - arr = arr || []; - var results = []; - var counter = 0; - var _iteratee = wrapAsync(iteratee); - - return eachfn(arr, (value, _, iterCb) => { - var index = counter++; - _iteratee(value, (err, v) => { - results[index] = v; - iterCb(err); - }); - }, err => { - callback(err, results); - }); - } - - function isArrayLike(value) { - return value && - typeof value.length === 'number' && - value.length >= 0 && - value.length % 1 === 0; - } - - // A temporary value used to identify if the loop should be broken. - // See #1064, #1293 - const breakLoop = {}; - - function once(fn) { - function wrapper (...args) { - if (fn === null) return; - var callFn = fn; - fn = null; - callFn.apply(this, args); - } - Object.assign(wrapper, fn); - return wrapper - } - - function getIterator (coll) { - return coll[Symbol.iterator] && coll[Symbol.iterator](); - } - - function createArrayIterator(coll) { - var i = -1; - var len = coll.length; - return function next() { - return ++i < len ? {value: coll[i], key: i} : null; - } - } - - function createES2015Iterator(iterator) { - var i = -1; - return function next() { - var item = iterator.next(); - if (item.done) - return null; - i++; - return {value: item.value, key: i}; - } - } - - function createObjectIterator(obj) { - var okeys = obj ? Object.keys(obj) : []; - var i = -1; - var len = okeys.length; - return function next() { - var key = okeys[++i]; - return i < len ? {value: obj[key], key} : null; - }; - } - - function createIterator(coll) { - if (isArrayLike(coll)) { - return createArrayIterator(coll); - } - - var iterator = getIterator(coll); - return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); - } - - function onlyOnce(fn) { - return function (...args) { - if (fn === null) throw new Error("Callback was already called."); - var callFn = fn; - fn = null; - callFn.apply(this, args); - }; - } - - // for async generators - function asyncEachOfLimit(generator, limit, iteratee, callback) { - let done = false; - let canceled = false; - let awaiting = false; - let running = 0; - let idx = 0; - - function replenish() { - //console.log('replenish') - if (running >= limit || awaiting || done) return - //console.log('replenish awaiting') - awaiting = true; - generator.next().then(({value, done: iterDone}) => { - //console.log('got value', value) - if (canceled || done) return - awaiting = false; - if (iterDone) { - done = true; - if (running <= 0) { - //console.log('done nextCb') - callback(null); - } - return; - } - running++; - iteratee(value, idx, iterateeCallback); - idx++; - replenish(); - }).catch(handleError); - } - - function iterateeCallback(err, result) { - //console.log('iterateeCallback') - running -= 1; - if (canceled) return - if (err) return handleError(err) - - if (err === false) { - done = true; - canceled = true; - return - } - - if (result === breakLoop || (done && running <= 0)) { - done = true; - //console.log('done iterCb') - return callback(null); - } - replenish(); - } - - function handleError(err) { - if (canceled) return - awaiting = false; - done = true; - callback(err); - } - - replenish(); - } - - var eachOfLimit = (limit) => { - return (obj, iteratee, callback) => { - callback = once(callback); - if (limit <= 0) { - throw new RangeError('concurrency limit cannot be less than 1') - } - if (!obj) { - return callback(null); - } - if (isAsyncGenerator(obj)) { - return asyncEachOfLimit(obj, limit, iteratee, callback) - } - if (isAsyncIterable(obj)) { - return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback) - } - var nextElem = createIterator(obj); - var done = false; - var canceled = false; - var running = 0; - var looping = false; - - function iterateeCallback(err, value) { - if (canceled) return - running -= 1; - if (err) { - done = true; - callback(err); - } - else if (err === false) { - done = true; - canceled = true; - } - else if (value === breakLoop || (done && running <= 0)) { - done = true; - return callback(null); - } - else if (!looping) { - replenish(); - } - } - - function replenish () { - looping = true; - while (running < limit && !done) { - var elem = nextElem(); - if (elem === null) { - done = true; - if (running <= 0) { - callback(null); - } - return; - } - running += 1; - iteratee(elem.value, elem.key, onlyOnce(iterateeCallback)); - } - looping = false; - } - - replenish(); - }; - }; - - /** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a - * time. - * - * @name eachOfLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. The `key` is the item's key, or index in the case of an - * array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ - function eachOfLimit$1(coll, limit, iteratee, callback) { - return eachOfLimit(limit)(coll, wrapAsync(iteratee), callback); - } - - var eachOfLimit$2 = awaitify(eachOfLimit$1, 4); - - // eachOf implementation optimized for array-likes - function eachOfArrayLike(coll, iteratee, callback) { - callback = once(callback); - var index = 0, - completed = 0, - {length} = coll, - canceled = false; - if (length === 0) { - callback(null); - } - - function iteratorCallback(err, value) { - if (err === false) { - canceled = true; - } - if (canceled === true) return - if (err) { - callback(err); - } else if ((++completed === length) || value === breakLoop) { - callback(null); - } - } - - for (; index < length; index++) { - iteratee(coll[index], index, onlyOnce(iteratorCallback)); - } - } - - // a generic version of eachOf which can handle array, object, and iterator cases. - function eachOfGeneric (coll, iteratee, callback) { - return eachOfLimit$2(coll, Infinity, iteratee, callback); - } - - /** - * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument - * to the iteratee. - * - * @name eachOf - * @static - * @memberOf module:Collections - * @method - * @alias forEachOf - * @category Collection - * @see [async.each]{@link module:Collections.each} - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each - * item in `coll`. - * The `key` is the item's key, or index in the case of an array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; - * var configs = {}; - * - * async.forEachOf(obj, function (value, key, callback) { - * fs.readFile(__dirname + value, "utf8", function (err, data) { - * if (err) return callback(err); - * try { - * configs[key] = JSON.parse(data); - * } catch (e) { - * return callback(e); - * } - * callback(); - * }); - * }, function (err) { - * if (err) console.error(err.message); - * // configs is now a map of JSON data - * doSomethingWith(configs); - * }); - */ - function eachOf(coll, iteratee, callback) { - var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric; - return eachOfImplementation(coll, wrapAsync(iteratee), callback); - } - - var eachOf$1 = awaitify(eachOf, 3); - - /** - * Produces a new collection of values by mapping each value in `coll` through - * the `iteratee` function. The `iteratee` is called with an item from `coll` - * and a callback for when it has finished processing. Each of these callback - * takes 2 arguments: an `error`, and the transformed item from `coll`. If - * `iteratee` passes an error to its callback, the main `callback` (for the - * `map` function) is immediately called with the error. - * - * Note, that since this function applies the `iteratee` to each item in - * parallel, there is no guarantee that the `iteratee` functions will complete - * in order. However, the results array will be in the same order as the - * original `coll`. - * - * If `map` is passed an Object, the results will be an Array. The results - * will roughly be in the order of the original Objects' keys (but this can - * vary across JavaScript engines). - * - * @name map - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an Array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.map(['file1','file2','file3'], fs.stat, function(err, results) { - * // results is now an array of stats for each file - * }); - */ - function map (coll, iteratee, callback) { - return _asyncMap(eachOf$1, coll, iteratee, callback) - } - var map$1 = awaitify(map, 3); - - /** - * Applies the provided arguments to each function in the array, calling - * `callback` after all functions have completed. If you only provide the first - * argument, `fns`, then it will return a function which lets you pass in the - * arguments as if it were a single function call. If more arguments are - * provided, `callback` is required while `args` is still optional. The results - * for each of the applied async functions are passed to the final callback - * as an array. - * - * @name applyEach - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s - * to all call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {AsyncFunction} - Returns a function that takes no args other than - * an optional callback, that is the result of applying the `args` to each - * of the functions. - * @example - * - * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket') - * - * appliedFn((err, results) => { - * // results[0] is the results for `enableSearch` - * // results[1] is the results for `updateSchema` - * }); - * - * // partial application example: - * async.each( - * buckets, - * async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(), - * callback - * ); - */ - var applyEach$1 = applyEach(map$1); - - /** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. - * - * @name eachOfSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ - function eachOfSeries(coll, iteratee, callback) { - return eachOfLimit$2(coll, 1, iteratee, callback) - } - var eachOfSeries$1 = awaitify(eachOfSeries, 3); - - /** - * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. - * - * @name mapSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ - function mapSeries (coll, iteratee, callback) { - return _asyncMap(eachOfSeries$1, coll, iteratee, callback) - } - var mapSeries$1 = awaitify(mapSeries, 3); - - /** - * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. - * - * @name applyEachSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.applyEach]{@link module:ControlFlow.applyEach} - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all - * call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {AsyncFunction} - A function, that when called, is the result of - * appling the `args` to the list of functions. It takes no args, other than - * a callback. - */ - var applyEachSeries = applyEach(mapSeries$1); - - const PROMISE_SYMBOL = Symbol('promiseCallback'); - - function promiseCallback () { - let resolve, reject; - function callback (err, ...args) { - if (err) return reject(err) - resolve(args.length > 1 ? args : args[0]); - } - - callback[PROMISE_SYMBOL] = new Promise((res, rej) => { - resolve = res, - reject = rej; - }); - - return callback - } - - /** - * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on - * their requirements. Each function can optionally depend on other functions - * being completed first, and each function is run as soon as its requirements - * are satisfied. - * - * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence - * will stop. Further tasks will not execute (so any other functions depending - * on it will not run), and the main `callback` is immediately called with the - * error. - * - * {@link AsyncFunction}s also receive an object containing the results of functions which - * have completed so far as the first argument, if they have dependencies. If a - * task function has no dependencies, it will only be passed a callback. - * - * @name auto - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Object} tasks - An object. Each of its properties is either a - * function or an array of requirements, with the {@link AsyncFunction} itself the last item - * in the array. The object's key of a property serves as the name of the task - * defined by that property, i.e. can be used when specifying requirements for - * other tasks. The function receives one or two arguments: - * * a `results` object, containing the results of the previously executed - * functions, only passed if the task has any dependencies, - * * a `callback(err, result)` function, which must be called when finished, - * passing an `error` (which can be `null`) and the result of the function's - * execution. - * @param {number} [concurrency=Infinity] - An optional `integer` for - * determining the maximum number of tasks that can be run in parallel. By - * default, as many as possible. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback. Results are always returned; however, if an - * error occurs, no further `tasks` will be performed, and the results object - * will only contain partial results. Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - * @example - * - * async.auto({ - * // this function will just be passed a callback - * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), - * showData: ['readData', function(results, cb) { - * // results.readData is the file's contents - * // ... - * }] - * }, callback); - * - * async.auto({ - * get_data: function(callback) { - * console.log('in get_data'); - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * console.log('in make_folder'); - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: ['get_data', 'make_folder', function(results, callback) { - * console.log('in write_file', JSON.stringify(results)); - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(results, callback) { - * console.log('in email_link', JSON.stringify(results)); - * // once the file is written let's email a link to it... - * // results.write_file contains the filename returned by write_file. - * callback(null, {'file':results.write_file, 'email':'user@example.com'}); - * }] - * }, function(err, results) { - * console.log('err = ', err); - * console.log('results = ', results); - * }); - */ - function auto(tasks, concurrency, callback) { - if (typeof concurrency !== 'number') { - // concurrency is optional, shift the args. - callback = concurrency; - concurrency = null; - } - callback = once(callback || promiseCallback()); - var numTasks = Object.keys(tasks).length; - if (!numTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = numTasks; - } - - var results = {}; - var runningTasks = 0; - var canceled = false; - var hasError = false; - - var listeners = Object.create(null); - - var readyTasks = []; - - // for cycle detection: - var readyToCheck = []; // tasks that have been identified as reachable - // without the possibility of returning to an ancestor task - var uncheckedDependencies = {}; - - Object.keys(tasks).forEach(key => { - var task = tasks[key]; - if (!Array.isArray(task)) { - // no dependencies - enqueueTask(key, [task]); - readyToCheck.push(key); - return; - } - - var dependencies = task.slice(0, task.length - 1); - var remainingDependencies = dependencies.length; - if (remainingDependencies === 0) { - enqueueTask(key, task); - readyToCheck.push(key); - return; - } - uncheckedDependencies[key] = remainingDependencies; - - dependencies.forEach(dependencyName => { - if (!tasks[dependencyName]) { - throw new Error('async.auto task `' + key + - '` has a non-existent dependency `' + - dependencyName + '` in ' + - dependencies.join(', ')); - } - addListener(dependencyName, () => { - remainingDependencies--; - if (remainingDependencies === 0) { - enqueueTask(key, task); - } - }); - }); - }); - - checkForDeadlocks(); - processQueue(); - - function enqueueTask(key, task) { - readyTasks.push(() => runTask(key, task)); - } - - function processQueue() { - if (canceled) return - if (readyTasks.length === 0 && runningTasks === 0) { - return callback(null, results); - } - while(readyTasks.length && runningTasks < concurrency) { - var run = readyTasks.shift(); - run(); - } - - } - - function addListener(taskName, fn) { - var taskListeners = listeners[taskName]; - if (!taskListeners) { - taskListeners = listeners[taskName] = []; - } - - taskListeners.push(fn); - } - - function taskComplete(taskName) { - var taskListeners = listeners[taskName] || []; - taskListeners.forEach(fn => fn()); - processQueue(); - } - - - function runTask(key, task) { - if (hasError) return; - - var taskCallback = onlyOnce((err, ...result) => { - runningTasks--; - if (err === false) { - canceled = true; - return - } - if (result.length < 2) { - [result] = result; - } - if (err) { - var safeResults = {}; - Object.keys(results).forEach(rkey => { - safeResults[rkey] = results[rkey]; - }); - safeResults[key] = result; - hasError = true; - listeners = Object.create(null); - if (canceled) return - callback(err, safeResults); - } else { - results[key] = result; - taskComplete(key); - } - }); - - runningTasks++; - var taskFn = wrapAsync(task[task.length - 1]); - if (task.length > 1) { - taskFn(results, taskCallback); - } else { - taskFn(taskCallback); - } - } - - function checkForDeadlocks() { - // Kahn's algorithm - // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm - // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html - var currentTask; - var counter = 0; - while (readyToCheck.length) { - currentTask = readyToCheck.pop(); - counter++; - getDependents(currentTask).forEach(dependent => { - if (--uncheckedDependencies[dependent] === 0) { - readyToCheck.push(dependent); - } - }); - } - - if (counter !== numTasks) { - throw new Error( - 'async.auto cannot execute tasks due to a recursive dependency' - ); - } - } - - function getDependents(taskName) { - var result = []; - Object.keys(tasks).forEach(key => { - const task = tasks[key]; - if (Array.isArray(task) && task.indexOf(taskName) >= 0) { - result.push(key); - } - }); - return result; - } - - return callback[PROMISE_SYMBOL] - } - - var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/; - var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/; - var FN_ARG_SPLIT = /,/; - var FN_ARG = /(=.+)?(\s*)$/; - var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; - - function parseParams(func) { - const src = func.toString().replace(STRIP_COMMENTS, ''); - let match = src.match(FN_ARGS); - if (!match) { - match = src.match(ARROW_FN_ARGS); - } - if (!match) throw new Error('could not parse args in autoInject\nSource:\n' + src) - let [, args] = match; - return args - .replace(/\s/g, '') - .split(FN_ARG_SPLIT) - .map((arg) => arg.replace(FN_ARG, '').trim()); - } - - /** - * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent - * tasks are specified as parameters to the function, after the usual callback - * parameter, with the parameter names matching the names of the tasks it - * depends on. This can provide even more readable task graphs which can be - * easier to maintain. - * - * If a final callback is specified, the task results are similarly injected, - * specified as named parameters after the initial error parameter. - * - * The autoInject function is purely syntactic sugar and its semantics are - * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. - * - * @name autoInject - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.auto]{@link module:ControlFlow.auto} - * @category Control Flow - * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of - * the form 'func([dependencies...], callback). The object's key of a property - * serves as the name of the task defined by that property, i.e. can be used - * when specifying requirements for other tasks. - * * The `callback` parameter is a `callback(err, result)` which must be called - * when finished, passing an `error` (which can be `null`) and the result of - * the function's execution. The remaining parameters name other tasks on - * which the task is dependent, and the results from those tasks are the - * arguments of those parameters. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback, and a `results` object with any completed - * task results, similar to `auto`. - * @returns {Promise} a promise, if no callback is passed - * @example - * - * // The example from `auto` can be rewritten as follows: - * async.autoInject({ - * get_data: function(callback) { - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: function(get_data, make_folder, callback) { - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }, - * email_link: function(write_file, callback) { - * // once the file is written let's email a link to it... - * // write_file contains the filename returned by write_file. - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * } - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - * - * // If you are using a JS minifier that mangles parameter names, `autoInject` - * // will not work with plain functions, since the parameter names will be - * // collapsed to a single letter identifier. To work around this, you can - * // explicitly specify the names of the parameters your task function needs - * // in an array, similar to Angular.js dependency injection. - * - * // This still has an advantage over plain `auto`, since the results a task - * // depends on are still spread into arguments. - * async.autoInject({ - * //... - * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(write_file, callback) { - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * }] - * //... - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - */ - function autoInject(tasks, callback) { - var newTasks = {}; - - Object.keys(tasks).forEach(key => { - var taskFn = tasks[key]; - var params; - var fnIsAsync = isAsync(taskFn); - var hasNoDeps = - (!fnIsAsync && taskFn.length === 1) || - (fnIsAsync && taskFn.length === 0); - - if (Array.isArray(taskFn)) { - params = [...taskFn]; - taskFn = params.pop(); - - newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); - } else if (hasNoDeps) { - // no dependencies, use the function as-is - newTasks[key] = taskFn; - } else { - params = parseParams(taskFn); - if ((taskFn.length === 0 && !fnIsAsync) && params.length === 0) { - throw new Error("autoInject task functions require explicit parameters."); - } - - // remove callback param - if (!fnIsAsync) params.pop(); - - newTasks[key] = params.concat(newTask); - } - - function newTask(results, taskCb) { - var newArgs = params.map(name => results[name]); - newArgs.push(taskCb); - wrapAsync(taskFn)(...newArgs); - } - }); - - return auto(newTasks, callback); - } - - // Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation - // used for queues. This implementation assumes that the node provided by the user can be modified - // to adjust the next and last properties. We implement only the minimal functionality - // for queue support. - class DLL { - constructor() { - this.head = this.tail = null; - this.length = 0; - } - - removeLink(node) { - if (node.prev) node.prev.next = node.next; - else this.head = node.next; - if (node.next) node.next.prev = node.prev; - else this.tail = node.prev; - - node.prev = node.next = null; - this.length -= 1; - return node; - } - - empty () { - while(this.head) this.shift(); - return this; - } - - insertAfter(node, newNode) { - newNode.prev = node; - newNode.next = node.next; - if (node.next) node.next.prev = newNode; - else this.tail = newNode; - node.next = newNode; - this.length += 1; - } - - insertBefore(node, newNode) { - newNode.prev = node.prev; - newNode.next = node; - if (node.prev) node.prev.next = newNode; - else this.head = newNode; - node.prev = newNode; - this.length += 1; - } - - unshift(node) { - if (this.head) this.insertBefore(this.head, node); - else setInitial(this, node); - } - - push(node) { - if (this.tail) this.insertAfter(this.tail, node); - else setInitial(this, node); - } - - shift() { - return this.head && this.removeLink(this.head); - } - - pop() { - return this.tail && this.removeLink(this.tail); - } - - toArray() { - return [...this] - } - - *[Symbol.iterator] () { - var cur = this.head; - while (cur) { - yield cur.data; - cur = cur.next; - } - } - - remove (testFn) { - var curr = this.head; - while(curr) { - var {next} = curr; - if (testFn(curr)) { - this.removeLink(curr); - } - curr = next; - } - return this; - } - } - - function setInitial(dll, node) { - dll.length = 1; - dll.head = dll.tail = node; - } - - function queue(worker, concurrency, payload) { - if (concurrency == null) { - concurrency = 1; - } - else if(concurrency === 0) { - throw new RangeError('Concurrency must not be zero'); - } - - var _worker = wrapAsync(worker); - var numRunning = 0; - var workersList = []; - const events = { - error: [], - drain: [], - saturated: [], - unsaturated: [], - empty: [] - }; - - function on (event, handler) { - events[event].push(handler); - } - - function once (event, handler) { - const handleAndRemove = (...args) => { - off(event, handleAndRemove); - handler(...args); - }; - events[event].push(handleAndRemove); - } - - function off (event, handler) { - if (!event) return Object.keys(events).forEach(ev => events[ev] = []) - if (!handler) return events[event] = [] - events[event] = events[event].filter(ev => ev !== handler); - } - - function trigger (event, ...args) { - events[event].forEach(handler => handler(...args)); - } - - var processingScheduled = false; - function _insert(data, insertAtFront, rejectOnError, callback) { - if (callback != null && typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - - var res, rej; - function promiseCallback (err, ...args) { - // we don't care about the error, let the global error handler - // deal with it - if (err) return rejectOnError ? rej(err) : res() - if (args.length <= 1) return res(args[0]) - res(args); - } - - var item = { - data, - callback: rejectOnError ? - promiseCallback : - (callback || promiseCallback) - }; - - if (insertAtFront) { - q._tasks.unshift(item); - } else { - q._tasks.push(item); - } - - if (!processingScheduled) { - processingScheduled = true; - setImmediate$1(() => { - processingScheduled = false; - q.process(); - }); - } - - if (rejectOnError || !callback) { - return new Promise((resolve, reject) => { - res = resolve; - rej = reject; - }) - } - } - - function _createCB(tasks) { - return function (err, ...args) { - numRunning -= 1; - - for (var i = 0, l = tasks.length; i < l; i++) { - var task = tasks[i]; - - var index = workersList.indexOf(task); - if (index === 0) { - workersList.shift(); - } else if (index > 0) { - workersList.splice(index, 1); - } - - task.callback(err, ...args); - - if (err != null) { - trigger('error', err, task.data); - } - } - - if (numRunning <= (q.concurrency - q.buffer) ) { - trigger('unsaturated'); - } - - if (q.idle()) { - trigger('drain'); - } - q.process(); - }; - } - - function _maybeDrain(data) { - if (data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - setImmediate$1(() => trigger('drain')); - return true - } - return false - } - - const eventMethod = (name) => (handler) => { - if (!handler) { - return new Promise((resolve, reject) => { - once(name, (err, data) => { - if (err) return reject(err) - resolve(data); - }); - }) - } - off(name); - on(name, handler); - - }; - - var isProcessing = false; - var q = { - _tasks: new DLL(), - *[Symbol.iterator] () { - yield* q._tasks[Symbol.iterator](); - }, - concurrency, - payload, - buffer: concurrency / 4, - started: false, - paused: false, - push (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, false, false, callback)) - } - return _insert(data, false, false, callback); - }, - pushAsync (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, false, true, callback)) - } - return _insert(data, false, true, callback); - }, - kill () { - off(); - q._tasks.empty(); - }, - unshift (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, true, false, callback)) - } - return _insert(data, true, false, callback); - }, - unshiftAsync (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, true, true, callback)) - } - return _insert(data, true, true, callback); - }, - remove (testFn) { - q._tasks.remove(testFn); - }, - process () { - // Avoid trying to start too many processing operations. This can occur - // when callbacks resolve synchronously (#1267). - if (isProcessing) { - return; - } - isProcessing = true; - while(!q.paused && numRunning < q.concurrency && q._tasks.length){ - var tasks = [], data = []; - var l = q._tasks.length; - if (q.payload) l = Math.min(l, q.payload); - for (var i = 0; i < l; i++) { - var node = q._tasks.shift(); - tasks.push(node); - workersList.push(node); - data.push(node.data); - } - - numRunning += 1; - - if (q._tasks.length === 0) { - trigger('empty'); - } - - if (numRunning === q.concurrency) { - trigger('saturated'); - } - - var cb = onlyOnce(_createCB(tasks)); - _worker(data, cb); - } - isProcessing = false; - }, - length () { - return q._tasks.length; - }, - running () { - return numRunning; - }, - workersList () { - return workersList; - }, - idle() { - return q._tasks.length + numRunning === 0; - }, - pause () { - q.paused = true; - }, - resume () { - if (q.paused === false) { return; } - q.paused = false; - setImmediate$1(q.process); - } - }; - // define these as fixed properties, so people get useful errors when updating - Object.defineProperties(q, { - saturated: { - writable: false, - value: eventMethod('saturated') - }, - unsaturated: { - writable: false, - value: eventMethod('unsaturated') - }, - empty: { - writable: false, - value: eventMethod('empty') - }, - drain: { - writable: false, - value: eventMethod('drain') - }, - error: { - writable: false, - value: eventMethod('error') - }, - }); - return q; - } - - /** - * Creates a `cargo` object with the specified payload. Tasks added to the - * cargo will be processed altogether (up to the `payload` limit). If the - * `worker` is in progress, the task is queued until it becomes available. Once - * the `worker` has completed some tasks, each callback of those tasks is - * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) - * for how `cargo` and `queue` work. - * - * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers - * at a time, cargo passes an array of tasks to a single worker, repeating - * when the worker is finished. - * - * @name cargo - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An asynchronous function for processing an array - * of queued tasks. Invoked with `(tasks, callback)`. - * @param {number} [payload=Infinity] - An optional `integer` for determining - * how many tasks should be processed per round; if omitted, the default is - * unlimited. - * @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can - * attached as certain properties to listen for specific events during the - * lifecycle of the cargo and inner queue. - * @example - * - * // create a cargo object with payload 2 - * var cargo = async.cargo(function(tasks, callback) { - * for (var i=0; i { - _iteratee(memo, x, (err, v) => { - memo = v; - iterCb(err); - }); - }, err => callback(err, memo)); - } - var reduce$1 = awaitify(reduce, 4); - - /** - * Version of the compose function that is more natural to read. Each function - * consumes the return value of the previous function. It is the equivalent of - * [compose]{@link module:ControlFlow.compose} with the arguments reversed. - * - * Each function is executed with the `this` binding of the composed function. - * - * @name seq - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.compose]{@link module:ControlFlow.compose} - * @category Control Flow - * @param {...AsyncFunction} functions - the asynchronous functions to compose - * @returns {Function} a function that composes the `functions` in order - * @example - * - * // Requires lodash (or underscore), express3 and dresende's orm2. - * // Part of an app, that fetches cats of the logged user. - * // This example uses `seq` function to avoid overnesting and error - * // handling clutter. - * app.get('/cats', function(request, response) { - * var User = request.models.User; - * async.seq( - * _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - * function(user, fn) { - * user.getCats(fn); // 'getCats' has signature (callback(err, data)) - * } - * )(req.session.user_id, function (err, cats) { - * if (err) { - * console.error(err); - * response.json({ status: 'error', message: err.message }); - * } else { - * response.json({ status: 'ok', message: 'Cats found', data: cats }); - * } - * }); - * }); - */ - function seq(...functions) { - var _functions = functions.map(wrapAsync); - return function (...args) { - var that = this; - - var cb = args[args.length - 1]; - if (typeof cb == 'function') { - args.pop(); - } else { - cb = promiseCallback(); - } - - reduce$1(_functions, args, (newargs, fn, iterCb) => { - fn.apply(that, newargs.concat((err, ...nextargs) => { - iterCb(err, nextargs); - })); - }, - (err, results) => cb(err, ...results)); - - return cb[PROMISE_SYMBOL] - }; - } - - /** - * Creates a function which is a composition of the passed asynchronous - * functions. Each function consumes the return value of the function that - * follows. Composing functions `f()`, `g()`, and `h()` would produce the result - * of `f(g(h()))`, only this version uses callbacks to obtain the return values. - * - * If the last argument to the composed function is not a function, a promise - * is returned when you call it. - * - * Each function is executed with the `this` binding of the composed function. - * - * @name compose - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {...AsyncFunction} functions - the asynchronous functions to compose - * @returns {Function} an asynchronous function that is the composed - * asynchronous `functions` - * @example - * - * function add1(n, callback) { - * setTimeout(function () { - * callback(null, n + 1); - * }, 10); - * } - * - * function mul3(n, callback) { - * setTimeout(function () { - * callback(null, n * 3); - * }, 10); - * } - * - * var add1mul3 = async.compose(mul3, add1); - * add1mul3(4, function (err, result) { - * // result now equals 15 - * }); - */ - function compose(...args) { - return seq(...args.reverse()); - } - - /** - * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. - * - * @name mapLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ - function mapLimit (coll, limit, iteratee, callback) { - return _asyncMap(eachOfLimit(limit), coll, iteratee, callback) - } - var mapLimit$1 = awaitify(mapLimit, 4); - - /** - * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time. - * - * @name concatLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @alias flatMapLimit - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - */ - function concatLimit(coll, limit, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return mapLimit$1(coll, limit, (val, iterCb) => { - _iteratee(val, (err, ...args) => { - if (err) return iterCb(err); - return iterCb(err, args); - }); - }, (err, mapResults) => { - var result = []; - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - result = result.concat(...mapResults[i]); - } - } - - return callback(err, result); - }); - } - var concatLimit$1 = awaitify(concatLimit, 4); - - /** - * Applies `iteratee` to each item in `coll`, concatenating the results. Returns - * the concatenated list. The `iteratee`s are called in parallel, and the - * results are concatenated as they return. The results array will be returned in - * the original order of `coll` passed to the `iteratee` function. - * - * @name concat - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @alias flatMap - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - * @example - * - * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) { - * // files is now a list of filenames that exist in the 3 directories - * }); - */ - function concat(coll, iteratee, callback) { - return concatLimit$1(coll, Infinity, iteratee, callback) - } - var concat$1 = awaitify(concat, 3); - - /** - * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. - * - * @name concatSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @alias flatMapSeries - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. - * The iteratee should complete with an array an array of results. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - */ - function concatSeries(coll, iteratee, callback) { - return concatLimit$1(coll, 1, iteratee, callback) - } - var concatSeries$1 = awaitify(concatSeries, 3); - - /** - * Returns a function that when called, calls-back with the values provided. - * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to - * [`auto`]{@link module:ControlFlow.auto}. - * - * @name constant - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {...*} arguments... - Any number of arguments to automatically invoke - * callback with. - * @returns {AsyncFunction} Returns a function that when invoked, automatically - * invokes the callback with the previous given arguments. - * @example - * - * async.waterfall([ - * async.constant(42), - * function (value, next) { - * // value === 42 - * }, - * //... - * ], callback); - * - * async.waterfall([ - * async.constant(filename, "utf8"), - * fs.readFile, - * function (fileData, next) { - * //... - * } - * //... - * ], callback); - * - * async.auto({ - * hostname: async.constant("https://server.net/"), - * port: findFreePort, - * launchServer: ["hostname", "port", function (options, cb) { - * startServer(options, cb); - * }], - * //... - * }, callback); - */ - function constant(...args) { - return function (...ignoredArgs/*, callback*/) { - var callback = ignoredArgs.pop(); - return callback(null, ...args); - }; - } - - function _createTester(check, getResult) { - return (eachfn, arr, _iteratee, cb) => { - var testPassed = false; - var testResult; - const iteratee = wrapAsync(_iteratee); - eachfn(arr, (value, _, callback) => { - iteratee(value, (err, result) => { - if (err || err === false) return callback(err); - - if (check(result) && !testResult) { - testPassed = true; - testResult = getResult(true, value); - return callback(null, breakLoop); - } - callback(); - }); - }, err => { - if (err) return cb(err); - cb(null, testPassed ? testResult : getResult(false)); - }); - }; - } - - /** - * Returns the first value in `coll` that passes an async truth test. The - * `iteratee` is applied in parallel, meaning the first iteratee to return - * `true` will fire the detect `callback` with that result. That means the - * result might not be the first item in the original `coll` (in terms of order) - * that passes the test. - - * If order within the original `coll` is important, then look at - * [`detectSeries`]{@link module:Collections.detectSeries}. - * - * @name detect - * @static - * @memberOf module:Collections - * @method - * @alias find - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns A Promise, if no callback is passed - * @example - * - * async.detect(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // result now equals the first file in the list that exists - * }); - */ - function detect(coll, iteratee, callback) { - return _createTester(bool => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback) - } - var detect$1 = awaitify(detect, 3); - - /** - * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a - * time. - * - * @name detectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findLimit - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ - function detectLimit(coll, limit, iteratee, callback) { - return _createTester(bool => bool, (res, item) => item)(eachOfLimit(limit), coll, iteratee, callback) - } - var detectLimit$1 = awaitify(detectLimit, 4); - - /** - * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. - * - * @name detectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findSeries - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ - function detectSeries(coll, iteratee, callback) { - return _createTester(bool => bool, (res, item) => item)(eachOfLimit(1), coll, iteratee, callback) - } - - var detectSeries$1 = awaitify(detectSeries, 3); - - function consoleFunc(name) { - return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => { - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } else if (console[name]) { - resultArgs.forEach(x => console[name](x)); - } - } - }) - } - - /** - * Logs the result of an [`async` function]{@link AsyncFunction} to the - * `console` using `console.dir` to display the properties of the resulting object. - * Only works in Node.js or in browsers that support `console.dir` and - * `console.error` (such as FF and Chrome). - * If multiple arguments are returned from the async function, - * `console.dir` is called on each argument in order. - * - * @name dir - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. - * @example - * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, {hello: name}); - * }, 1000); - * }; - * - * // in the node repl - * node> async.dir(hello, 'world'); - * {hello: 'world'} - */ - var dir = consoleFunc('dir'); - - /** - * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in - * the order of operations, the arguments `test` and `iteratee` are switched. - * - * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - * - * @name doWhilst - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - A function which is called each time `test` - * passes. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform after each - * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `iteratee`. - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. - * `callback` will be passed an error and any arguments passed to the final - * `iteratee`'s callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - */ - function doWhilst(iteratee, test, callback) { - callback = onlyOnce(callback); - var _fn = wrapAsync(iteratee); - var _test = wrapAsync(test); - var results; - - function next(err, ...args) { - if (err) return callback(err); - if (err === false) return; - results = args; - _test(...args, check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return check(null, true); - } - - var doWhilst$1 = awaitify(doWhilst, 3); - - /** - * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the - * argument ordering differs from `until`. - * - * @name doUntil - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.doWhilst]{@link module:ControlFlow.doWhilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` fails. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform after each - * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `iteratee` - * @param {Function} [callback] - A callback which is called after the test - * function has passed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - */ - function doUntil(iteratee, test, callback) { - const _test = wrapAsync(test); - return doWhilst$1(iteratee, (...args) => { - const cb = args.pop(); - _test(...args, (err, truth) => cb (err, !truth)); - }, callback); - } - - function _withoutIndex(iteratee) { - return (value, index, callback) => iteratee(value, callback); - } - - /** - * Applies the function `iteratee` to each item in `coll`, in parallel. - * The `iteratee` is called with an item from the list, and a callback for when - * it has finished. If the `iteratee` passes an error to its `callback`, the - * main `callback` (for the `each` function) is immediately called with the - * error. - * - * Note, that since this function applies `iteratee` to each item in parallel, - * there is no guarantee that the iteratee functions will complete in order. - * - * @name each - * @static - * @memberOf module:Collections - * @method - * @alias forEach - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to - * each item in `coll`. Invoked with (item, callback). - * The array index is not passed to the iteratee. - * If you need the index, use `eachOf`. - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * // assuming openFiles is an array of file names and saveFile is a function - * // to save the modified contents of that file: - * - * async.each(openFiles, saveFile, function(err){ - * // if any of the saves produced an error, err would equal that error - * }); - * - * // assuming openFiles is an array of file names - * async.each(openFiles, function(file, callback) { - * - * // Perform operation on file here. - * console.log('Processing file ' + file); - * - * if( file.length > 32 ) { - * console.log('This file name is too long'); - * callback('File name too long'); - * } else { - * // Do work to process file here - * console.log('File processed'); - * callback(); - * } - * }, function(err) { - * // if any of the file processing produced an error, err would equal that error - * if( err ) { - * // One of the iterations produced an error. - * // All processing will now stop. - * console.log('A file failed to process'); - * } else { - * console.log('All files have been processed successfully'); - * } - * }); - */ - function eachLimit(coll, iteratee, callback) { - return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback); - } - - var each = awaitify(eachLimit, 3); - - /** - * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. - * - * @name eachLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfLimit`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ - function eachLimit$1(coll, limit, iteratee, callback) { - return eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback); - } - var eachLimit$2 = awaitify(eachLimit$1, 4); - - /** - * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. - * - * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item - * in series and therefore the iteratee functions will complete in order. - - * @name eachSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfSeries`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ - function eachSeries(coll, iteratee, callback) { - return eachLimit$2(coll, 1, iteratee, callback) - } - var eachSeries$1 = awaitify(eachSeries, 3); - - /** - * Wrap an async function and ensure it calls its callback on a later tick of - * the event loop. If the function already calls its callback on a next tick, - * no extra deferral is added. This is useful for preventing stack overflows - * (`RangeError: Maximum call stack size exceeded`) and generally keeping - * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) - * contained. ES2017 `async` functions are returned as-is -- they are immune - * to Zalgo's corrupting influences, as they always resolve on a later tick. - * - * @name ensureAsync - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - an async function, one that expects a node-style - * callback as its last argument. - * @returns {AsyncFunction} Returns a wrapped function with the exact same call - * signature as the function passed in. - * @example - * - * function sometimesAsync(arg, callback) { - * if (cache[arg]) { - * return callback(null, cache[arg]); // this would be synchronous!! - * } else { - * doSomeIO(arg, callback); // this IO would be asynchronous - * } - * } - * - * // this has a risk of stack overflows if many results are cached in a row - * async.mapSeries(args, sometimesAsync, done); - * - * // this will defer sometimesAsync's callback if necessary, - * // preventing stack overflows - * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); - */ - function ensureAsync(fn) { - if (isAsync(fn)) return fn; - return function (...args/*, callback*/) { - var callback = args.pop(); - var sync = true; - args.push((...innerArgs) => { - if (sync) { - setImmediate$1(() => callback(...innerArgs)); - } else { - callback(...innerArgs); - } - }); - fn.apply(this, args); - sync = false; - }; - } - - /** - * Returns `true` if every element in `coll` satisfies an async test. If any - * iteratee call returns `false`, the main `callback` is immediately called. - * - * @name every - * @static - * @memberOf module:Collections - * @method - * @alias all - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.every(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then every file exists - * }); - */ - function every(coll, iteratee, callback) { - return _createTester(bool => !bool, res => !res)(eachOf$1, coll, iteratee, callback) - } - var every$1 = awaitify(every, 3); - - /** - * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. - * - * @name everyLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ - function everyLimit(coll, limit, iteratee, callback) { - return _createTester(bool => !bool, res => !res)(eachOfLimit(limit), coll, iteratee, callback) - } - var everyLimit$1 = awaitify(everyLimit, 4); - - /** - * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. - * - * @name everySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in series. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ - function everySeries(coll, iteratee, callback) { - return _createTester(bool => !bool, res => !res)(eachOfSeries$1, coll, iteratee, callback) - } - var everySeries$1 = awaitify(everySeries, 3); - - function filterArray(eachfn, arr, iteratee, callback) { - var truthValues = new Array(arr.length); - eachfn(arr, (x, index, iterCb) => { - iteratee(x, (err, v) => { - truthValues[index] = !!v; - iterCb(err); - }); - }, err => { - if (err) return callback(err); - var results = []; - for (var i = 0; i < arr.length; i++) { - if (truthValues[i]) results.push(arr[i]); - } - callback(null, results); - }); - } - - function filterGeneric(eachfn, coll, iteratee, callback) { - var results = []; - eachfn(coll, (x, index, iterCb) => { - iteratee(x, (err, v) => { - if (err) return iterCb(err); - if (v) { - results.push({index, value: x}); - } - iterCb(err); - }); - }, err => { - if (err) return callback(err); - callback(null, results - .sort((a, b) => a.index - b.index) - .map(v => v.value)); - }); - } - - function _filter(eachfn, coll, iteratee, callback) { - var filter = isArrayLike(coll) ? filterArray : filterGeneric; - return filter(eachfn, coll, wrapAsync(iteratee), callback); - } - - /** - * Returns a new array of all the values in `coll` which pass an async truth - * test. This operation is performed in parallel, but the results array will be - * in the same order as the original. - * - * @name filter - * @static - * @memberOf module:Collections - * @method - * @alias select - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.filter(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of the existing files - * }); - */ - function filter (coll, iteratee, callback) { - return _filter(eachOf$1, coll, iteratee, callback) - } - var filter$1 = awaitify(filter, 3); - - /** - * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a - * time. - * - * @name filterLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - */ - function filterLimit (coll, limit, iteratee, callback) { - return _filter(eachOfLimit(limit), coll, iteratee, callback) - } - var filterLimit$1 = awaitify(filterLimit, 4); - - /** - * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. - * - * @name filterSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results) - * @returns {Promise} a promise, if no callback provided - */ - function filterSeries (coll, iteratee, callback) { - return _filter(eachOfSeries$1, coll, iteratee, callback) - } - var filterSeries$1 = awaitify(filterSeries, 3); - - /** - * Calls the asynchronous function `fn` with a callback parameter that allows it - * to call itself again, in series, indefinitely. - - * If an error is passed to the callback then `errback` is called with the - * error, and execution stops, otherwise it will never be called. - * - * @name forever - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} fn - an async function to call repeatedly. - * Invoked with (next). - * @param {Function} [errback] - when `fn` passes an error to it's callback, - * this function will be called, and execution stops. Invoked with (err). - * @returns {Promise} a promise that rejects if an error occurs and an errback - * is not passed - * @example - * - * async.forever( - * function(next) { - * // next is suitable for passing to things that need a callback(err [, whatever]); - * // it will result in this function being called again. - * }, - * function(err) { - * // if next is called with a value in its first parameter, it will appear - * // in here as 'err', and execution will stop. - * } - * ); - */ - function forever(fn, errback) { - var done = onlyOnce(errback); - var task = wrapAsync(ensureAsync(fn)); - - function next(err) { - if (err) return done(err); - if (err === false) return; - task(next); - } - return next(); - } - var forever$1 = awaitify(forever, 2); - - /** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. - * - * @name groupByLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - */ - function groupByLimit(coll, limit, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return mapLimit$1(coll, limit, (val, iterCb) => { - _iteratee(val, (err, key) => { - if (err) return iterCb(err); - return iterCb(err, {key, val}); - }); - }, (err, mapResults) => { - var result = {}; - // from MDN, handle object having an `hasOwnProperty` prop - var {hasOwnProperty} = Object.prototype; - - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - var {key} = mapResults[i]; - var {val} = mapResults[i]; - - if (hasOwnProperty.call(result, key)) { - result[key].push(val); - } else { - result[key] = [val]; - } - } - } - - return callback(err, result); - }); - } - - var groupByLimit$1 = awaitify(groupByLimit, 4); - - /** - * Returns a new object, where each value corresponds to an array of items, from - * `coll`, that returned the corresponding key. That is, the keys of the object - * correspond to the values passed to the `iteratee` callback. - * - * Note: Since this function applies the `iteratee` to each item in parallel, - * there is no guarantee that the `iteratee` functions will complete in order. - * However, the values for each key in the `result` will be in the same order as - * the original `coll`. For Objects, the values will roughly be in the order of - * the original Objects' keys (but this can vary across JavaScript engines). - * - * @name groupBy - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { - * db.findById(userId, function(err, user) { - * if (err) return callback(err); - * return callback(null, user.age); - * }); - * }, function(err, result) { - * // result is object containing the userIds grouped by age - * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; - * }); - */ - function groupBy (coll, iteratee, callback) { - return groupByLimit$1(coll, Infinity, iteratee, callback) - } - - /** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. - * - * @name groupBySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - */ - function groupBySeries (coll, iteratee, callback) { - return groupByLimit$1(coll, 1, iteratee, callback) - } - - /** - * Logs the result of an `async` function to the `console`. Only works in - * Node.js or in browsers that support `console.log` and `console.error` (such - * as FF and Chrome). If multiple arguments are returned from the async - * function, `console.log` is called on each argument in order. - * - * @name log - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. - * @example - * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, 'hello ' + name); - * }, 1000); - * }; - * - * // in the node repl - * node> async.log(hello, 'world'); - * 'hello world' - */ - var log = consoleFunc('log'); - - /** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a - * time. - * - * @name mapValuesLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - */ - function mapValuesLimit(obj, limit, iteratee, callback) { - callback = once(callback); - var newObj = {}; - var _iteratee = wrapAsync(iteratee); - return eachOfLimit(limit)(obj, (val, key, next) => { - _iteratee(val, key, (err, result) => { - if (err) return next(err); - newObj[key] = result; - next(err); - }); - }, err => callback(err, newObj)); - } - - var mapValuesLimit$1 = awaitify(mapValuesLimit, 4); - - /** - * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. - * - * Produces a new Object by mapping each value of `obj` through the `iteratee` - * function. The `iteratee` is called each `value` and `key` from `obj` and a - * callback for when it has finished processing. Each of these callbacks takes - * two arguments: an `error`, and the transformed item from `obj`. If `iteratee` - * passes an error to its callback, the main `callback` (for the `mapValues` - * function) is immediately called with the error. - * - * Note, the order of the keys in the result is not guaranteed. The keys will - * be roughly in the order they complete, (but this is very engine-specific) - * - * @name mapValues - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.mapValues({ - * f1: 'file1', - * f2: 'file2', - * f3: 'file3' - * }, function (file, key, callback) { - * fs.stat(file, callback); - * }, function(err, result) { - * // result is now a map of stats for each file, e.g. - * // { - * // f1: [stats for file1], - * // f2: [stats for file2], - * // f3: [stats for file3] - * // } - * }); - */ - function mapValues(obj, iteratee, callback) { - return mapValuesLimit$1(obj, Infinity, iteratee, callback) - } - - /** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. - * - * @name mapValuesSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - */ - function mapValuesSeries(obj, iteratee, callback) { - return mapValuesLimit$1(obj, 1, iteratee, callback) - } - - /** - * Caches the results of an async function. When creating a hash to store - * function results against, the callback is omitted from the hash and an - * optional hash function can be used. - * - * **Note: if the async function errs, the result will not be cached and - * subsequent calls will call the wrapped function.** - * - * If no hash function is specified, the first argument is used as a hash key, - * which may work reasonably if it is a string or a data type that converts to a - * distinct string. Note that objects and arrays will not behave reasonably. - * Neither will cases where the other arguments are significant. In such cases, - * specify your own hash function. - * - * The cache of results is exposed as the `memo` property of the function - * returned by `memoize`. - * - * @name memoize - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - The async function to proxy and cache results from. - * @param {Function} hasher - An optional function for generating a custom hash - * for storing results. It has all the arguments applied to it apart from the - * callback, and must be synchronous. - * @returns {AsyncFunction} a memoized version of `fn` - * @example - * - * var slow_fn = function(name, callback) { - * // do something - * callback(null, result); - * }; - * var fn = async.memoize(slow_fn); - * - * // fn can now be used as if it were slow_fn - * fn('some name', function() { - * // callback - * }); - */ - function memoize(fn, hasher = v => v) { - var memo = Object.create(null); - var queues = Object.create(null); - var _fn = wrapAsync(fn); - var memoized = initialParams((args, callback) => { - var key = hasher(...args); - if (key in memo) { - setImmediate$1(() => callback(null, ...memo[key])); - } else if (key in queues) { - queues[key].push(callback); - } else { - queues[key] = [callback]; - _fn(...args, (err, ...resultArgs) => { - // #1465 don't memoize if an error occurred - if (!err) { - memo[key] = resultArgs; - } - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i](err, ...resultArgs); - } - }); - } - }); - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - } - - /** - * Calls `callback` on a later loop around the event loop. In Node.js this just - * calls `process.nextTick`. In the browser it will use `setImmediate` if - * available, otherwise `setTimeout(callback, 0)`, which means other higher - * priority events may precede the execution of `callback`. - * - * This is used internally for browser-compatibility purposes. - * - * @name nextTick - * @static - * @memberOf module:Utils - * @method - * @see [async.setImmediate]{@link module:Utils.setImmediate} - * @category Util - * @param {Function} callback - The function to call on a later loop around - * the event loop. Invoked with (args...). - * @param {...*} args... - any number of additional arguments to pass to the - * callback on the next tick. - * @example - * - * var call_order = []; - * async.nextTick(function() { - * call_order.push('two'); - * // call_order now equals ['one','two'] - * }); - * call_order.push('one'); - * - * async.setImmediate(function (a, b, c) { - * // a, b, and c equal 1, 2, and 3 - * }, 1, 2, 3); - */ - var _defer$1; - - if (hasNextTick) { - _defer$1 = process.nextTick; - } else if (hasSetImmediate) { - _defer$1 = setImmediate; - } else { - _defer$1 = fallback; - } - - var nextTick = wrap(_defer$1); - - var parallel = awaitify((eachfn, tasks, callback) => { - var results = isArrayLike(tasks) ? [] : {}; - - eachfn(tasks, (task, key, taskCb) => { - wrapAsync(task)((err, ...result) => { - if (result.length < 2) { - [result] = result; - } - results[key] = result; - taskCb(err); - }); - }, err => callback(err, results)); - }, 3); - - /** - * Run the `tasks` collection of functions in parallel, without waiting until - * the previous function has completed. If any of the functions pass an error to - * its callback, the main `callback` is immediately called with the value of the - * error. Once the `tasks` have completed, the results are passed to the final - * `callback` as an array. - * - * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about - * parallel execution of code. If your tasks do not use any timers or perform - * any I/O, they will actually be executed in series. Any synchronous setup - * sections for each task will happen one after the other. JavaScript remains - * single-threaded. - * - * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the - * execution of other tasks when a task fails. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.parallel}. - * - * @name parallel - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - * - * @example - * async.parallel([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // optional callback - * function(err, results) { - * // the results array will equal ['one','two'] even though - * // the second function had a shorter timeout. - * }); - * - * // an example using an object instead of an array - * async.parallel({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback) { - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equals to: {one: 1, two: 2} - * }); - */ - function parallel$1(tasks, callback) { - return parallel(eachOf$1, tasks, callback); - } - - /** - * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a - * time. - * - * @name parallelLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.parallel]{@link module:ControlFlow.parallel} - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - */ - function parallelLimit(tasks, limit, callback) { - return parallel(eachOfLimit(limit), tasks, callback); - } - - /** - * A queue of tasks for the worker function to complete. - * @typedef {Iterable} QueueObject - * @memberOf module:ControlFlow - * @property {Function} length - a function returning the number of items - * waiting to be processed. Invoke with `queue.length()`. - * @property {boolean} started - a boolean indicating whether or not any - * items have been pushed and processed by the queue. - * @property {Function} running - a function returning the number of items - * currently being processed. Invoke with `queue.running()`. - * @property {Function} workersList - a function returning the array of items - * currently being processed. Invoke with `queue.workersList()`. - * @property {Function} idle - a function returning false if there are items - * waiting or being processed, or true if not. Invoke with `queue.idle()`. - * @property {number} concurrency - an integer for determining how many `worker` - * functions should be run in parallel. This property can be changed after a - * `queue` is created to alter the concurrency on-the-fly. - * @property {number} payload - an integer that specifies how many items are - * passed to the worker function at a time. only applies if this is a - * [cargo]{@link module:ControlFlow.cargo} object - * @property {AsyncFunction} push - add a new task to the `queue`. Calls `callback` - * once the `worker` has finished processing the task. Instead of a single task, - * a `tasks` array can be submitted. The respective callback is used for every - * task in the list. Invoke with `queue.push(task, [callback])`, - * @property {AsyncFunction} unshift - add a new task to the front of the `queue`. - * Invoke with `queue.unshift(task, [callback])`. - * @property {AsyncFunction} pushAsync - the same as `q.push`, except this returns - * a promise that rejects if an error occurs. - * @property {AsyncFunction} unshirtAsync - the same as `q.unshift`, except this returns - * a promise that rejects if an error occurs. - * @property {Function} remove - remove items from the queue that match a test - * function. The test function will be passed an object with a `data` property, - * and a `priority` property, if this is a - * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. - * Invoked with `queue.remove(testFn)`, where `testFn` is of the form - * `function ({data, priority}) {}` and returns a Boolean. - * @property {Function} saturated - a function that sets a callback that is - * called when the number of running workers hits the `concurrency` limit, and - * further tasks will be queued. If the callback is omitted, `q.saturated()` - * returns a promise for the next occurrence. - * @property {Function} unsaturated - a function that sets a callback that is - * called when the number of running workers is less than the `concurrency` & - * `buffer` limits, and further tasks will not be queued. If the callback is - * omitted, `q.unsaturated()` returns a promise for the next occurrence. - * @property {number} buffer - A minimum threshold buffer in order to say that - * the `queue` is `unsaturated`. - * @property {Function} empty - a function that sets a callback that is called - * when the last item from the `queue` is given to a `worker`. If the callback - * is omitted, `q.empty()` returns a promise for the next occurrence. - * @property {Function} drain - a function that sets a callback that is called - * when the last item from the `queue` has returned from the `worker`. If the - * callback is omitted, `q.drain()` returns a promise for the next occurrence. - * @property {Function} error - a function that sets a callback that is called - * when a task errors. Has the signature `function(error, task)`. If the - * callback is omitted, `error()` returns a promise that rejects on the next - * error. - * @property {boolean} paused - a boolean for determining whether the queue is - * in a paused state. - * @property {Function} pause - a function that pauses the processing of tasks - * until `resume()` is called. Invoke with `queue.pause()`. - * @property {Function} resume - a function that resumes the processing of - * queued tasks when the queue is paused. Invoke with `queue.resume()`. - * @property {Function} kill - a function that removes the `drain` callback and - * empties remaining tasks from the queue forcing it to go idle. No more tasks - * should be pushed to the queue after calling this function. Invoke with `queue.kill()`. - * - * @example - * const q = aync.queue(worker, 2) - * q.push(item1) - * q.push(item2) - * q.push(item3) - * // queues are iterable, spread into an array to inspect - * const items = [...q] // [item1, item2, item3] - * // or use for of - * for (let item of q) { - * console.log(item) - * } - * - * q.drain(() => { - * console.log('all done') - * }) - * // or - * await q.drain() - */ - - /** - * Creates a `queue` object with the specified `concurrency`. Tasks added to the - * `queue` are processed in parallel (up to the `concurrency` limit). If all - * `worker`s are in progress, the task is queued until one becomes available. - * Once a `worker` completes a `task`, that `task`'s callback is called. - * - * @name queue - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. Invoked with (task, callback). - * @param {number} [concurrency=1] - An `integer` for determining how many - * `worker` functions should be run in parallel. If omitted, the concurrency - * defaults to `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can be - * attached as certain properties to listen for specific events during the - * lifecycle of the queue. - * @example - * - * // create a queue object with concurrency 2 - * var q = async.queue(function(task, callback) { - * console.log('hello ' + task.name); - * callback(); - * }, 2); - * - * // assign a callback - * q.drain(function() { - * console.log('all items have been processed'); - * }); - * // or await the end - * await q.drain() - * - * // assign an error callback - * q.error(function(err, task) { - * console.error('task experienced an error'); - * }); - * - * // add some items to the queue - * q.push({name: 'foo'}, function(err) { - * console.log('finished processing foo'); - * }); - * // callback is optional - * q.push({name: 'bar'}); - * - * // add some items to the queue (batch-wise) - * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { - * console.log('finished processing item'); - * }); - * - * // add some items to the front of the queue - * q.unshift({name: 'bar'}, function (err) { - * console.log('finished processing bar'); - * }); - */ - function queue$1 (worker, concurrency) { - var _worker = wrapAsync(worker); - return queue((items, cb) => { - _worker(items[0], cb); - }, concurrency, 1); - } - - // Binary min-heap implementation used for priority queue. - // Implementation is stable, i.e. push time is considered for equal priorities - class Heap { - constructor() { - this.heap = []; - this.pushCount = Number.MIN_SAFE_INTEGER; - } - - get length() { - return this.heap.length; - } - - empty () { - this.heap = []; - return this; - } - - percUp(index) { - let p; - - while (index > 0 && smaller(this.heap[index], this.heap[p=parent(index)])) { - let t = this.heap[index]; - this.heap[index] = this.heap[p]; - this.heap[p] = t; - - index = p; - } - } - - percDown(index) { - let l; - - while ((l=leftChi(index)) < this.heap.length) { - if (l+1 < this.heap.length && smaller(this.heap[l+1], this.heap[l])) { - l = l+1; - } - - if (smaller(this.heap[index], this.heap[l])) { - break; - } - - let t = this.heap[index]; - this.heap[index] = this.heap[l]; - this.heap[l] = t; - - index = l; - } - } - - push(node) { - node.pushCount = ++this.pushCount; - this.heap.push(node); - this.percUp(this.heap.length-1); - } - - unshift(node) { - return this.heap.push(node); - } - - shift() { - let [top] = this.heap; - - this.heap[0] = this.heap[this.heap.length-1]; - this.heap.pop(); - this.percDown(0); - - return top; - } - - toArray() { - return [...this]; - } - - *[Symbol.iterator] () { - for (let i = 0; i < this.heap.length; i++) { - yield this.heap[i].data; - } - } - - remove (testFn) { - let j = 0; - for (let i = 0; i < this.heap.length; i++) { - if (!testFn(this.heap[i])) { - this.heap[j] = this.heap[i]; - j++; - } - } - - this.heap.splice(j); - - for (let i = parent(this.heap.length-1); i >= 0; i--) { - this.percDown(i); - } - - return this; - } - } - - function leftChi(i) { - return (i<<1)+1; - } - - function parent(i) { - return ((i+1)>>1)-1; - } - - function smaller(x, y) { - if (x.priority !== y.priority) { - return x.priority < y.priority; - } - else { - return x.pushCount < y.pushCount; - } - } - - /** - * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and - * completed in ascending priority order. - * - * @name priorityQueue - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. - * Invoked with (task, callback). - * @param {number} concurrency - An `integer` for determining how many `worker` - * functions should be run in parallel. If omitted, the concurrency defaults to - * `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two - * differences between `queue` and `priorityQueue` objects: - * * `push(task, priority, [callback])` - `priority` should be a number. If an - * array of `tasks` is given, all tasks will be assigned the same priority. - * * The `unshift` method was removed. - */ - function priorityQueue(worker, concurrency) { - // Start with a normal queue - var q = queue$1(worker, concurrency); - - q._tasks = new Heap(); - - // Override push to accept second parameter representing priority - q.push = function(data, priority = 0, callback = () => {}) { - if (typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - if (!Array.isArray(data)) { - data = [data]; - } - if (data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - return setImmediate$1(() => q.drain()); - } - - for (var i = 0, l = data.length; i < l; i++) { - var item = { - data: data[i], - priority, - callback - }; - - q._tasks.push(item); - } - - setImmediate$1(q.process); - }; - - // Remove unshift function - delete q.unshift; - - return q; - } - - /** - * Runs the `tasks` array of functions in parallel, without waiting until the - * previous function has completed. Once any of the `tasks` complete or pass an - * error to its callback, the main `callback` is immediately called. It's - * equivalent to `Promise.race()`. - * - * @name race - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction} - * to run. Each function can complete with an optional `result` value. - * @param {Function} callback - A callback to run once any of the functions have - * completed. This function gets an error or result from the first function that - * completed. Invoked with (err, result). - * @returns undefined - * @example - * - * async.race([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // main callback - * function(err, result) { - * // the result will be equal to 'two' as it finishes earlier - * }); - */ - function race(tasks, callback) { - callback = once(callback); - if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); - if (!tasks.length) return callback(); - for (var i = 0, l = tasks.length; i < l; i++) { - wrapAsync(tasks[i])(callback); - } - } - - var race$1 = awaitify(race, 2); - - /** - * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. - * - * @name reduceRight - * @static - * @memberOf module:Collections - * @method - * @see [async.reduce]{@link module:Collections.reduce} - * @alias foldr - * @category Collection - * @param {Array} array - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @returns {Promise} a promise, if no callback is passed - */ - function reduceRight (array, memo, iteratee, callback) { - var reversed = [...array].reverse(); - return reduce$1(reversed, memo, iteratee, callback); - } - - /** - * Wraps the async function in another function that always completes with a - * result object, even when it errors. - * - * The result object has either the property `error` or `value`. - * - * @name reflect - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - The async function you want to wrap - * @returns {Function} - A function that always passes null to it's callback as - * the error. The second argument to the callback will be an `object` with - * either an `error` or a `value` property. - * @example - * - * async.parallel([ - * async.reflect(function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }), - * async.reflect(function(callback) { - * // do some more stuff but error ... - * callback('bad stuff happened'); - * }), - * async.reflect(function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * }) - * ], - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = 'bad stuff happened' - * // results[2].value = 'two' - * }); - */ - function reflect(fn) { - var _fn = wrapAsync(fn); - return initialParams(function reflectOn(args, reflectCallback) { - args.push((error, ...cbArgs) => { - let retVal = {}; - if (error) { - retVal.error = error; - } - if (cbArgs.length > 0){ - var value = cbArgs; - if (cbArgs.length <= 1) { - [value] = cbArgs; - } - retVal.value = value; - } - reflectCallback(null, retVal); - }); - - return _fn.apply(this, args); - }); - } - - /** - * A helper function that wraps an array or an object of functions with `reflect`. - * - * @name reflectAll - * @static - * @memberOf module:Utils - * @method - * @see [async.reflect]{@link module:Utils.reflect} - * @category Util - * @param {Array|Object|Iterable} tasks - The collection of - * [async functions]{@link AsyncFunction} to wrap in `async.reflect`. - * @returns {Array} Returns an array of async functions, each wrapped in - * `async.reflect` - * @example - * - * let tasks = [ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * // do some more stuff but error ... - * callback(new Error('bad stuff happened')); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ]; - * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = Error('bad stuff happened') - * // results[2].value = 'two' - * }); - * - * // an example using an object instead of an array - * let tasks = { - * one: function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * two: function(callback) { - * callback('two'); - * }, - * three: function(callback) { - * setTimeout(function() { - * callback(null, 'three'); - * }, 100); - * } - * }; - * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results.one.value = 'one' - * // results.two.error = 'two' - * // results.three.value = 'three' - * }); - */ - function reflectAll(tasks) { - var results; - if (Array.isArray(tasks)) { - results = tasks.map(reflect); - } else { - results = {}; - Object.keys(tasks).forEach(key => { - results[key] = reflect.call(this, tasks[key]); - }); - } - return results; - } - - function reject(eachfn, arr, _iteratee, callback) { - const iteratee = wrapAsync(_iteratee); - return _filter(eachfn, arr, (value, cb) => { - iteratee(value, (err, v) => { - cb(err, !v); - }); - }, callback); - } - - /** - * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. - * - * @name reject - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.reject(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of missing files - * createFiles(results); - * }); - */ - function reject$1 (coll, iteratee, callback) { - return reject(eachOf$1, coll, iteratee, callback) - } - var reject$2 = awaitify(reject$1, 3); - - /** - * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a - * time. - * - * @name rejectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.reject]{@link module:Collections.reject} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ - function rejectLimit (coll, limit, iteratee, callback) { - return reject(eachOfLimit(limit), coll, iteratee, callback) - } - var rejectLimit$1 = awaitify(rejectLimit, 4); - - /** - * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. - * - * @name rejectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.reject]{@link module:Collections.reject} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ - function rejectSeries (coll, iteratee, callback) { - return reject(eachOfSeries$1, coll, iteratee, callback) - } - var rejectSeries$1 = awaitify(rejectSeries, 3); - - function constant$1(value) { - return function () { - return value; - } - } - - /** - * Attempts to get a successful response from `task` no more than `times` times - * before returning an error. If the task is successful, the `callback` will be - * passed the result of the successful task. If all attempts fail, the callback - * will be passed the error and result (if any) of the final attempt. - * - * @name retry - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @see [async.retryable]{@link module:ControlFlow.retryable} - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an - * object with `times` and `interval` or a number. - * * `times` - The number of attempts to make before giving up. The default - * is `5`. - * * `interval` - The time to wait between retries, in milliseconds. The - * default is `0`. The interval may also be specified as a function of the - * retry count (see example). - * * `errorFilter` - An optional synchronous function that is invoked on - * erroneous result. If it returns `true` the retry attempts will continue; - * if the function returns `false` the retry flow is aborted with the current - * attempt's error and result being returned to the final callback. - * Invoked with (err). - * * If `opts` is a number, the number specifies the number of times to retry, - * with the default interval of `0`. - * @param {AsyncFunction} task - An async function to retry. - * Invoked with (callback). - * @param {Function} [callback] - An optional callback which is called when the - * task has succeeded, or after the final failed attempt. It receives the `err` - * and `result` arguments of the last attempt at completing the `task`. Invoked - * with (err, results). - * @returns {Promise} a promise if no callback provided - * - * @example - * - * // The `retry` function can be used as a stand-alone control flow by passing - * // a callback, as shown below: - * - * // try calling apiMethod 3 times - * async.retry(3, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod 3 times, waiting 200 ms between each retry - * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod 10 times with exponential backoff - * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) - * async.retry({ - * times: 10, - * interval: function(retryCount) { - * return 50 * Math.pow(2, retryCount); - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod the default 5 times no delay between each retry - * async.retry(apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod only when error condition satisfies, all other - * // errors will abort the retry control flow and return to final callback - * async.retry({ - * errorFilter: function(err) { - * return err.message === 'Temporary error'; // only retry on a specific error - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // to retry individual methods that are not as reliable within other - * // control flow functions, use the `retryable` wrapper: - * async.auto({ - * users: api.getUsers.bind(api), - * payments: async.retryable(3, api.getPayments.bind(api)) - * }, function(err, results) { - * // do something with the results - * }); - * - */ - const DEFAULT_TIMES = 5; - const DEFAULT_INTERVAL = 0; - - function retry(opts, task, callback) { - var options = { - times: DEFAULT_TIMES, - intervalFunc: constant$1(DEFAULT_INTERVAL) - }; - - if (arguments.length < 3 && typeof opts === 'function') { - callback = task || promiseCallback(); - task = opts; - } else { - parseTimes(options, opts); - callback = callback || promiseCallback(); - } - - if (typeof task !== 'function') { - throw new Error("Invalid arguments for async.retry"); - } - - var _task = wrapAsync(task); - - var attempt = 1; - function retryAttempt() { - _task((err, ...args) => { - if (err === false) return - if (err && attempt++ < options.times && - (typeof options.errorFilter != 'function' || - options.errorFilter(err))) { - setTimeout(retryAttempt, options.intervalFunc(attempt - 1)); - } else { - callback(err, ...args); - } - }); - } - - retryAttempt(); - return callback[PROMISE_SYMBOL] - } - - function parseTimes(acc, t) { - if (typeof t === 'object') { - acc.times = +t.times || DEFAULT_TIMES; - - acc.intervalFunc = typeof t.interval === 'function' ? - t.interval : - constant$1(+t.interval || DEFAULT_INTERVAL); - - acc.errorFilter = t.errorFilter; - } else if (typeof t === 'number' || typeof t === 'string') { - acc.times = +t || DEFAULT_TIMES; - } else { - throw new Error("Invalid arguments for async.retry"); - } - } - - /** - * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method - * wraps a task and makes it retryable, rather than immediately calling it - * with retries. - * - * @name retryable - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.retry]{@link module:ControlFlow.retry} - * @category Control Flow - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional - * options, exactly the same as from `retry`, except for a `opts.arity` that - * is the arity of the `task` function, defaulting to `task.length` - * @param {AsyncFunction} task - the asynchronous function to wrap. - * This function will be passed any arguments passed to the returned wrapper. - * Invoked with (...args, callback). - * @returns {AsyncFunction} The wrapped function, which when invoked, will - * retry on an error, based on the parameters specified in `opts`. - * This function will accept the same parameters as `task`. - * @example - * - * async.auto({ - * dep1: async.retryable(3, getFromFlakyService), - * process: ["dep1", async.retryable(3, function (results, cb) { - * maybeProcessData(results.dep1, cb); - * })] - * }, callback); - */ - function retryable (opts, task) { - if (!task) { - task = opts; - opts = null; - } - let arity = (opts && opts.arity) || task.length; - if (isAsync(task)) { - arity += 1; - } - var _task = wrapAsync(task); - return initialParams((args, callback) => { - if (args.length < arity - 1 || callback == null) { - args.push(callback); - callback = promiseCallback(); - } - function taskFn(cb) { - _task(...args, cb); - } - - if (opts) retry(opts, taskFn, callback); - else retry(taskFn, callback); - - return callback[PROMISE_SYMBOL] - }); - } - - /** - * Run the functions in the `tasks` collection in series, each one running once - * the previous function has completed. If any functions in the series pass an - * error to its callback, no more functions are run, and `callback` is - * immediately called with the value of the error. Otherwise, `callback` - * receives an array of results when `tasks` have completed. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function, and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.series}. - * - * **Note** that while many implementations preserve the order of object - * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) - * explicitly states that - * - * > The mechanics and order of enumerating the properties is not specified. - * - * So if you rely on the order in which your series of functions are executed, - * and want this to work on all platforms, consider using an array. - * - * @name series - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing - * [async functions]{@link AsyncFunction} to run in series. - * Each function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed. This function gets a results array (or object) - * containing all the result arguments passed to the `task` callbacks. Invoked - * with (err, result). - * @return {Promise} a promise, if no callback is passed - * @example - * async.series([ - * function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }, - * function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * } - * ], - * // optional callback - * function(err, results) { - * // results is now equal to ['one', 'two'] - * }); - * - * async.series({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback){ - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equal to: {one: 1, two: 2} - * }); - */ - function series(tasks, callback) { - return parallel(eachOfSeries$1, tasks, callback); - } - - /** - * Returns `true` if at least one element in the `coll` satisfies an async test. - * If any iteratee call returns `true`, the main `callback` is immediately - * called. - * - * @name some - * @static - * @memberOf module:Collections - * @method - * @alias any - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.some(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then at least one of the files exists - * }); - */ - function some(coll, iteratee, callback) { - return _createTester(Boolean, res => res)(eachOf$1, coll, iteratee, callback) - } - var some$1 = awaitify(some, 3); - - /** - * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. - * - * @name someLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anyLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ - function someLimit(coll, limit, iteratee, callback) { - return _createTester(Boolean, res => res)(eachOfLimit(limit), coll, iteratee, callback) - } - var someLimit$1 = awaitify(someLimit, 4); - - /** - * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. - * - * @name someSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anySeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in series. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ - function someSeries(coll, iteratee, callback) { - return _createTester(Boolean, res => res)(eachOfSeries$1, coll, iteratee, callback) - } - var someSeries$1 = awaitify(someSeries, 3); - - /** - * Sorts a list by the results of running each `coll` value through an async - * `iteratee`. - * - * @name sortBy - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a value to use as the sort criteria as - * its `result`. - * Invoked with (item, callback). - * @param {Function} callback - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is the items - * from the original `coll` sorted by the values returned by the `iteratee` - * calls. Invoked with (err, results). - * @returns {Promise} a promise, if no callback passed - * @example - * - * async.sortBy(['file1','file2','file3'], function(file, callback) { - * fs.stat(file, function(err, stats) { - * callback(err, stats.mtime); - * }); - * }, function(err, results) { - * // results is now the original array of files sorted by - * // modified date - * }); - * - * // By modifying the callback parameter the - * // sorting order can be influenced: - * - * // ascending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x); - * }, function(err,result) { - * // result callback - * }); - * - * // descending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x*-1); //<- x*-1 instead of x, turns the order around - * }, function(err,result) { - * // result callback - * }); - */ - function sortBy (coll, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return map$1(coll, (x, iterCb) => { - _iteratee(x, (err, criteria) => { - if (err) return iterCb(err); - iterCb(err, {value: x, criteria}); - }); - }, (err, results) => { - if (err) return callback(err); - callback(null, results.sort(comparator).map(v => v.value)); - }); - - function comparator(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } - } - var sortBy$1 = awaitify(sortBy, 3); - - /** - * Sets a time limit on an asynchronous function. If the function does not call - * its callback within the specified milliseconds, it will be called with a - * timeout error. The code property for the error object will be `'ETIMEDOUT'`. - * - * @name timeout - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} asyncFn - The async function to limit in time. - * @param {number} milliseconds - The specified time limit. - * @param {*} [info] - Any variable you want attached (`string`, `object`, etc) - * to timeout Error for more information.. - * @returns {AsyncFunction} Returns a wrapped function that can be used with any - * of the control flow functions. - * Invoke this function with the same parameters as you would `asyncFunc`. - * @example - * - * function myFunction(foo, callback) { - * doAsyncTask(foo, function(err, data) { - * // handle errors - * if (err) return callback(err); - * - * // do some stuff ... - * - * // return processed data - * return callback(null, data); - * }); - * } - * - * var wrapped = async.timeout(myFunction, 1000); - * - * // call `wrapped` as you would `myFunction` - * wrapped({ bar: 'bar' }, function(err, data) { - * // if `myFunction` takes < 1000 ms to execute, `err` - * // and `data` will have their expected values - * - * // else `err` will be an Error with the code 'ETIMEDOUT' - * }); - */ - function timeout(asyncFn, milliseconds, info) { - var fn = wrapAsync(asyncFn); - - return initialParams((args, callback) => { - var timedOut = false; - var timer; - - function timeoutCallback() { - var name = asyncFn.name || 'anonymous'; - var error = new Error('Callback function "' + name + '" timed out.'); - error.code = 'ETIMEDOUT'; - if (info) { - error.info = info; - } - timedOut = true; - callback(error); - } - - args.push((...cbArgs) => { - if (!timedOut) { - callback(...cbArgs); - clearTimeout(timer); - } - }); - - // setup timer and call original function - timer = setTimeout(timeoutCallback, milliseconds); - fn(...args); - }); - } - - function range(size) { - var result = Array(size); - while (size--) { - result[size] = size; - } - return result; - } - - /** - * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a - * time. - * - * @name timesLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} count - The number of times to run the function. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see [async.map]{@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - */ - function timesLimit(count, limit, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return mapLimit$1(range(count), limit, _iteratee, callback); - } - - /** - * Calls the `iteratee` function `n` times, and accumulates results in the same - * manner you would use with [map]{@link module:Collections.map}. - * - * @name times - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.map]{@link module:Collections.map} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - * @example - * - * // Pretend this is some complicated async factory - * var createUser = function(id, callback) { - * callback(null, { - * id: 'user' + id - * }); - * }; - * - * // generate 5 users - * async.times(5, function(n, next) { - * createUser(n, function(err, user) { - * next(err, user); - * }); - * }, function(err, users) { - * // we should now have 5 users - * }); - */ - function times (n, iteratee, callback) { - return timesLimit(n, Infinity, iteratee, callback) - } - - /** - * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. - * - * @name timesSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - */ - function timesSeries (n, iteratee, callback) { - return timesLimit(n, 1, iteratee, callback) - } - - /** - * A relative of `reduce`. Takes an Object or Array, and iterates over each - * element in parallel, each step potentially mutating an `accumulator` value. - * The type of the accumulator defaults to the type of collection passed in. - * - * @name transform - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {*} [accumulator] - The initial state of the transform. If omitted, - * it will default to an empty Object or Array, depending on the type of `coll` - * @param {AsyncFunction} iteratee - A function applied to each item in the - * collection that potentially modifies the accumulator. - * Invoked with (accumulator, item, key, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the transformed accumulator. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.transform([1,2,3], function(acc, item, index, callback) { - * // pointless async: - * process.nextTick(function() { - * acc[index] = item * 2 - * callback(null) - * }); - * }, function(err, result) { - * // result is now equal to [2, 4, 6] - * }); - * - * @example - * - * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { - * setImmediate(function () { - * obj[key] = val * 2; - * callback(); - * }) - * }, function (err, result) { - * // result is equal to {a: 2, b: 4, c: 6} - * }) - */ - function transform (coll, accumulator, iteratee, callback) { - if (arguments.length <= 3 && typeof accumulator === 'function') { - callback = iteratee; - iteratee = accumulator; - accumulator = Array.isArray(coll) ? [] : {}; - } - callback = once(callback || promiseCallback()); - var _iteratee = wrapAsync(iteratee); - - eachOf$1(coll, (v, k, cb) => { - _iteratee(accumulator, v, k, cb); - }, err => callback(err, accumulator)); - return callback[PROMISE_SYMBOL] - } - - /** - * It runs each task in series but stops whenever any of the functions were - * successful. If one of the tasks were successful, the `callback` will be - * passed the result of the successful task. If all tasks fail, the callback - * will be passed the error and result (if any) of the final attempt. - * - * @name tryEach - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to - * run, each function is passed a `callback(err, result)` it must call on - * completion with an error `err` (which can be `null`) and an optional `result` - * value. - * @param {Function} [callback] - An optional callback which is called when one - * of the tasks has succeeded, or all have failed. It receives the `err` and - * `result` arguments of the last attempt at completing the `task`. Invoked with - * (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * async.tryEach([ - * function getDataFromFirstWebsite(callback) { - * // Try getting the data from the first website - * callback(err, data); - * }, - * function getDataFromSecondWebsite(callback) { - * // First website failed, - * // Try getting the data from the backup website - * callback(err, data); - * } - * ], - * // optional callback - * function(err, results) { - * Now do something with the data. - * }); - * - */ - function tryEach(tasks, callback) { - var error = null; - var result; - return eachSeries$1(tasks, (task, taskCb) => { - wrapAsync(task)((err, ...args) => { - if (err === false) return taskCb(err); - - if (args.length < 2) { - [result] = args; - } else { - result = args; - } - error = err; - taskCb(err ? null : {}); - }); - }, () => callback(error, result)); - } - - var tryEach$1 = awaitify(tryEach); - - /** - * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original, - * unmemoized form. Handy for testing. - * - * @name unmemoize - * @static - * @memberOf module:Utils - * @method - * @see [async.memoize]{@link module:Utils.memoize} - * @category Util - * @param {AsyncFunction} fn - the memoized function - * @returns {AsyncFunction} a function that calls the original unmemoized function - */ - function unmemoize(fn) { - return (...args) => { - return (fn.unmemoized || fn)(...args); - }; - } - - /** - * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. - * - * @name whilst - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `iteratee`. Invoked with (). - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` passes. Invoked with (callback). - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - * @example - * - * var count = 0; - * async.whilst( - * function test(cb) { cb(null, count < 5); }, - * function iter(callback) { - * count++; - * setTimeout(function() { - * callback(null, count); - * }, 1000); - * }, - * function (err, n) { - * // 5 seconds have passed, n = 5 - * } - * ); - */ - function whilst(test, iteratee, callback) { - callback = onlyOnce(callback); - var _fn = wrapAsync(iteratee); - var _test = wrapAsync(test); - var results = []; - - function next(err, ...rest) { - if (err) return callback(err); - results = rest; - if (err === false) return; - _test(check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return _test(check); - } - var whilst$1 = awaitify(whilst, 3); - - /** - * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. `callback` will be passed an error and any - * arguments passed to the final `iteratee`'s callback. - * - * The inverse of [whilst]{@link module:ControlFlow.whilst}. - * - * @name until - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `iteratee`. Invoked with (callback). - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` fails. Invoked with (callback). - * @param {Function} [callback] - A callback which is called after the test - * function has passed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if a callback is not passed - * - * @example - * const results = [] - * let finished = false - * async.until(function test(page, cb) { - * cb(null, finished) - * }, function iter(next) { - * fetchPage(url, (err, body) => { - * if (err) return next(err) - * results = results.concat(body.objects) - * finished = !!body.next - * next(err) - * }) - * }, function done (err) { - * // all pages have been fetched - * }) - */ - function until(test, iteratee, callback) { - const _test = wrapAsync(test); - return whilst$1((cb) => _test((err, truth) => cb (err, !truth)), iteratee, callback); - } - - /** - * Runs the `tasks` array of functions in series, each passing their results to - * the next in the array. However, if any of the `tasks` pass an error to their - * own callback, the next function is not executed, and the main `callback` is - * immediately called with the error. - * - * @name waterfall - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array} tasks - An array of [async functions]{@link AsyncFunction} - * to run. - * Each function should complete with any number of `result` values. - * The `result` values will be passed as arguments, in order, to the next task. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed. This will be passed the results of the last task's - * callback. Invoked with (err, [results]). - * @returns undefined - * @example - * - * async.waterfall([ - * function(callback) { - * callback(null, 'one', 'two'); - * }, - * function(arg1, arg2, callback) { - * // arg1 now equals 'one' and arg2 now equals 'two' - * callback(null, 'three'); - * }, - * function(arg1, callback) { - * // arg1 now equals 'three' - * callback(null, 'done'); - * } - * ], function (err, result) { - * // result now equals 'done' - * }); - * - * // Or, with named functions: - * async.waterfall([ - * myFirstFunction, - * mySecondFunction, - * myLastFunction, - * ], function (err, result) { - * // result now equals 'done' - * }); - * function myFirstFunction(callback) { - * callback(null, 'one', 'two'); - * } - * function mySecondFunction(arg1, arg2, callback) { - * // arg1 now equals 'one' and arg2 now equals 'two' - * callback(null, 'three'); - * } - * function myLastFunction(arg1, callback) { - * // arg1 now equals 'three' - * callback(null, 'done'); - * } - */ - function waterfall (tasks, callback) { - callback = once(callback); - if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); - if (!tasks.length) return callback(); - var taskIndex = 0; - - function nextTask(args) { - var task = wrapAsync(tasks[taskIndex++]); - task(...args, onlyOnce(next)); - } - - function next(err, ...args) { - if (err === false) return - if (err || taskIndex === tasks.length) { - return callback(err, ...args); - } - nextTask(args); - } - - nextTask([]); - } - - var waterfall$1 = awaitify(waterfall); - - /** - * An "async function" in the context of Async is an asynchronous function with - * a variable number of parameters, with the final parameter being a callback. - * (`function (arg1, arg2, ..., callback) {}`) - * The final callback is of the form `callback(err, results...)`, which must be - * called once the function is completed. The callback should be called with a - * Error as its first argument to signal that an error occurred. - * Otherwise, if no error occurred, it should be called with `null` as the first - * argument, and any additional `result` arguments that may apply, to signal - * successful completion. - * The callback must be called exactly once, ideally on a later tick of the - * JavaScript event loop. - * - * This type of function is also referred to as a "Node-style async function", - * or a "continuation passing-style function" (CPS). Most of the methods of this - * library are themselves CPS/Node-style async functions, or functions that - * return CPS/Node-style async functions. - * - * Wherever we accept a Node-style async function, we also directly accept an - * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}. - * In this case, the `async` function will not be passed a final callback - * argument, and any thrown error will be used as the `err` argument of the - * implicit callback, and the return value will be used as the `result` value. - * (i.e. a `rejected` of the returned Promise becomes the `err` callback - * argument, and a `resolved` value becomes the `result`.) - * - * Note, due to JavaScript limitations, we can only detect native `async` - * functions and not transpilied implementations. - * Your environment must have `async`/`await` support for this to work. - * (e.g. Node > v7.6, or a recent version of a modern browser). - * If you are using `async` functions through a transpiler (e.g. Babel), you - * must still wrap the function with [asyncify]{@link module:Utils.asyncify}, - * because the `async function` will be compiled to an ordinary function that - * returns a promise. - * - * @typedef {Function} AsyncFunction - * @static - */ - - var index = { - apply, - applyEach: applyEach$1, - applyEachSeries, - asyncify, - auto, - autoInject, - cargo, - cargoQueue: cargo$1, - compose, - concat: concat$1, - concatLimit: concatLimit$1, - concatSeries: concatSeries$1, - constant, - detect: detect$1, - detectLimit: detectLimit$1, - detectSeries: detectSeries$1, - dir, - doUntil, - doWhilst: doWhilst$1, - each, - eachLimit: eachLimit$2, - eachOf: eachOf$1, - eachOfLimit: eachOfLimit$2, - eachOfSeries: eachOfSeries$1, - eachSeries: eachSeries$1, - ensureAsync, - every: every$1, - everyLimit: everyLimit$1, - everySeries: everySeries$1, - filter: filter$1, - filterLimit: filterLimit$1, - filterSeries: filterSeries$1, - forever: forever$1, - groupBy, - groupByLimit: groupByLimit$1, - groupBySeries, - log, - map: map$1, - mapLimit: mapLimit$1, - mapSeries: mapSeries$1, - mapValues, - mapValuesLimit: mapValuesLimit$1, - mapValuesSeries, - memoize, - nextTick, - parallel: parallel$1, - parallelLimit, - priorityQueue, - queue: queue$1, - race: race$1, - reduce: reduce$1, - reduceRight, - reflect, - reflectAll, - reject: reject$2, - rejectLimit: rejectLimit$1, - rejectSeries: rejectSeries$1, - retry, - retryable, - seq, - series, - setImmediate: setImmediate$1, - some: some$1, - someLimit: someLimit$1, - someSeries: someSeries$1, - sortBy: sortBy$1, - timeout, - times, - timesLimit, - timesSeries, - transform, - tryEach: tryEach$1, - unmemoize, - until, - waterfall: waterfall$1, - whilst: whilst$1, - - // aliases - all: every$1, - allLimit: everyLimit$1, - allSeries: everySeries$1, - any: some$1, - anyLimit: someLimit$1, - anySeries: someSeries$1, - find: detect$1, - findLimit: detectLimit$1, - findSeries: detectSeries$1, - flatMap: concat$1, - flatMapLimit: concatLimit$1, - flatMapSeries: concatSeries$1, - forEach: each, - forEachSeries: eachSeries$1, - forEachLimit: eachLimit$2, - forEachOf: eachOf$1, - forEachOfSeries: eachOfSeries$1, - forEachOfLimit: eachOfLimit$2, - inject: reduce$1, - foldl: reduce$1, - foldr: reduceRight, - select: filter$1, - selectLimit: filterLimit$1, - selectSeries: filterSeries$1, - wrapSync: asyncify, - during: whilst$1, - doDuring: doWhilst$1 - }; - - exports.default = index; - exports.apply = apply; - exports.applyEach = applyEach$1; - exports.applyEachSeries = applyEachSeries; - exports.asyncify = asyncify; - exports.auto = auto; - exports.autoInject = autoInject; - exports.cargo = cargo; - exports.cargoQueue = cargo$1; - exports.compose = compose; - exports.concat = concat$1; - exports.concatLimit = concatLimit$1; - exports.concatSeries = concatSeries$1; - exports.constant = constant; - exports.detect = detect$1; - exports.detectLimit = detectLimit$1; - exports.detectSeries = detectSeries$1; - exports.dir = dir; - exports.doUntil = doUntil; - exports.doWhilst = doWhilst$1; - exports.each = each; - exports.eachLimit = eachLimit$2; - exports.eachOf = eachOf$1; - exports.eachOfLimit = eachOfLimit$2; - exports.eachOfSeries = eachOfSeries$1; - exports.eachSeries = eachSeries$1; - exports.ensureAsync = ensureAsync; - exports.every = every$1; - exports.everyLimit = everyLimit$1; - exports.everySeries = everySeries$1; - exports.filter = filter$1; - exports.filterLimit = filterLimit$1; - exports.filterSeries = filterSeries$1; - exports.forever = forever$1; - exports.groupBy = groupBy; - exports.groupByLimit = groupByLimit$1; - exports.groupBySeries = groupBySeries; - exports.log = log; - exports.map = map$1; - exports.mapLimit = mapLimit$1; - exports.mapSeries = mapSeries$1; - exports.mapValues = mapValues; - exports.mapValuesLimit = mapValuesLimit$1; - exports.mapValuesSeries = mapValuesSeries; - exports.memoize = memoize; - exports.nextTick = nextTick; - exports.parallel = parallel$1; - exports.parallelLimit = parallelLimit; - exports.priorityQueue = priorityQueue; - exports.queue = queue$1; - exports.race = race$1; - exports.reduce = reduce$1; - exports.reduceRight = reduceRight; - exports.reflect = reflect; - exports.reflectAll = reflectAll; - exports.reject = reject$2; - exports.rejectLimit = rejectLimit$1; - exports.rejectSeries = rejectSeries$1; - exports.retry = retry; - exports.retryable = retryable; - exports.seq = seq; - exports.series = series; - exports.setImmediate = setImmediate$1; - exports.some = some$1; - exports.someLimit = someLimit$1; - exports.someSeries = someSeries$1; - exports.sortBy = sortBy$1; - exports.timeout = timeout; - exports.times = times; - exports.timesLimit = timesLimit; - exports.timesSeries = timesSeries; - exports.transform = transform; - exports.tryEach = tryEach$1; - exports.unmemoize = unmemoize; - exports.until = until; - exports.waterfall = waterfall$1; - exports.whilst = whilst$1; - exports.all = every$1; - exports.allLimit = everyLimit$1; - exports.allSeries = everySeries$1; - exports.any = some$1; - exports.anyLimit = someLimit$1; - exports.anySeries = someSeries$1; - exports.find = detect$1; - exports.findLimit = detectLimit$1; - exports.findSeries = detectSeries$1; - exports.flatMap = concat$1; - exports.flatMapLimit = concatLimit$1; - exports.flatMapSeries = concatSeries$1; - exports.forEach = each; - exports.forEachSeries = eachSeries$1; - exports.forEachLimit = eachLimit$2; - exports.forEachOf = eachOf$1; - exports.forEachOfSeries = eachOfSeries$1; - exports.forEachOfLimit = eachOfLimit$2; - exports.inject = reduce$1; - exports.foldl = reduce$1; - exports.foldr = reduceRight; - exports.select = filter$1; - exports.selectLimit = filterLimit$1; - exports.selectSeries = filterSeries$1; - exports.wrapSync = asyncify; - exports.during = whilst$1; - exports.doDuring = doWhilst$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/node_modules/async/dist/async.min.js b/node_modules/async/dist/async.min.js deleted file mode 100644 index b247c3e5..00000000 --- a/node_modules/async/dist/async.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.async={})})(this,function(e){'use strict';function t(e,...t){return(...a)=>e(...t,...a)}function a(e){return function(...t){var a=t.pop();return e.call(this,t,a)}}function n(e){setTimeout(e,0)}function i(e){return(t,...a)=>e(()=>t(...a))}function r(e){return u(e)?function(...t){const a=t.pop(),n=e.apply(this,t);return s(n,a)}:a(function(t,a){var n;try{n=e.apply(this,t)}catch(t){return a(t)}return n&&"function"==typeof n.then?s(n,a):void a(null,n)})}function s(e,t){return e.then(e=>{l(t,null,e)},e=>{l(t,e&&e.message?e:new Error(e))})}function l(e,t,a){try{e(t,a)}catch(e){Ee(t=>{throw t},e)}}function u(e){return"AsyncFunction"===e[Symbol.toStringTag]}function c(e){return"AsyncGenerator"===e[Symbol.toStringTag]}function p(e){return"function"==typeof e[Symbol.asyncIterator]}function d(e){if("function"!=typeof e)throw new Error("expected a function");return u(e)?r(e):e}function o(e,t=e.length){if(!t)throw new Error("arity is undefined");return function(...a){return"function"==typeof a[t-1]?e.apply(this,a):new Promise((n,i)=>{a[t-1]=(e,...t)=>e?i(e):void n(1{d(e).apply(i,a.concat(t))},n)});return n}}function f(e,t,a,n){t=t||[];var i=[],r=0,s=d(a);return e(t,(e,t,a)=>{var n=r++;s(e,(e,t)=>{i[n]=t,a(e)})},e=>{n(e,i)})}function y(e){return e&&"number"==typeof e.length&&0<=e.length&&0==e.length%1}function m(e){function t(...t){if(null!==e){var a=e;e=null,a.apply(this,t)}}return Object.assign(t,e),t}function g(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}function k(e){var t=-1,a=e.length;return function(){return++t=t||c||l||(c=!0,e.next().then(({value:e,done:t})=>{if(!(u||l))return c=!1,t?(l=!0,void(0>=p&&n(null))):void(p++,a(e,d,r),d++,i())}).catch(s))}function r(e,t){return p-=1,u?void 0:e?s(e):!1===e?(l=!0,void(u=!0)):t===be||l&&0>=p?(l=!0,n(null)):void i()}function s(e){u||(c=!1,l=!0,n(e))}let l=!1,u=!1,c=!1,p=0,d=0;i()}function b(e,t,a){function n(e,t){!1===e&&(l=!0);!0===l||(e?a(e):(++r===s||t===be)&&a(null))}a=m(a);var i=0,r=0,{length:s}=e,l=!1;for(0===s&&a(null);i{t=e,a=n}),e}function M(e,t,a){function n(e,t){g.push(()=>l(e,t))}function i(){if(!h){if(0===g.length&&0===o)return a(null,p);for(;g.length&&oe()),i()}function l(e,t){if(!f){var n=x((t,...n)=>{if(o--,!1===t)return void(h=!0);if(2>n.length&&([n]=n),t){var i={};if(Object.keys(p).forEach(e=>{i[e]=p[e]}),i[e]=n,f=!0,y=Object.create(null),h)return;a(t,i)}else p[e]=n,s(e)});o++;var i=d(t[t.length-1]);1{const i=e[n];Array.isArray(i)&&0<=i.indexOf(t)&&a.push(n)}),a}"number"!=typeof t&&(a=t,t=null),a=m(a||_());var c=Object.keys(e).length;if(!c)return a(null);t||(t=c);var p={},o=0,h=!1,f=!1,y=Object.create(null),g=[],k=[],v={};return Object.keys(e).forEach(t=>{var a=e[t];if(!Array.isArray(a))return n(t,[a]),void k.push(t);var i=a.slice(0,a.length-1),s=i.length;return 0===s?(n(t,a),void k.push(t)):void(v[t]=s,i.forEach(l=>{if(!e[l])throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+l+"` in "+i.join(", "));r(l,()=>{s--,0===s&&n(t,a)})}))}),function(){for(var e,t=0;k.length;)e=k.pop(),t++,u(e).forEach(e=>{0==--v[e]&&k.push(e)});if(t!==c)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),i(),a[Fe]}function A(e){const t=e.toString().replace(ze,"");let a=t.match(Te);if(a||(a=t.match(Ce)),!a)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,n]=a;return n.replace(/\s/g,"").split(Pe).map(e=>e.replace(Re,"").trim())}function I(e,t){var a={};return Object.keys(e).forEach(t=>{function n(e,t){var a=i.map(t=>e[t]);a.push(t),d(r)(...a)}var i,r=e[t],s=u(r),l=!s&&1===r.length||s&&0===r.length;if(Array.isArray(r))i=[...r],r=i.pop(),a[t]=i.concat(0{r(e,a),t(...n)};f[e].push(a)}function r(e,t){return e?t?void(f[e]=f[e].filter(e=>e!==t)):f[e]=[]:Object.keys(f).forEach(e=>f[e]=[])}function s(e,...t){f[e].forEach(e=>e(...t))}function l(e,t,a,n){function i(e,...t){return e?a?s(e):r():1>=t.length?r(t[0]):void r(t)}if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");k.started=!0;var r,s,l={data:e,callback:a?i:n||i};if(t?k._tasks.unshift(l):k._tasks.push(l),y||(y=!0,Ee(()=>{y=!1,k.process()})),a||!n)return new Promise((e,t)=>{r=e,s=t})}function u(e){return function(t,...a){o-=1;for(var n=0,r=e.length;ns("drain")),!0)}if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var p=d(e),o=0,h=[];const f={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};var y=!1;const m=e=>t=>t?void(r(e),n(e,t)):new Promise((t,a)=>{i(e,(e,n)=>e?a(e):void t(n))});var g=!1,k={_tasks:new Ne,*[Symbol.iterator](){yield*k._tasks[Symbol.iterator]()},concurrency:t,payload:a,buffer:t/4,started:!1,paused:!1,push(e,t){return Array.isArray(e)?c(e)?void 0:e.map(e=>l(e,!1,!1,t)):l(e,!1,!1,t)},pushAsync(e,t){return Array.isArray(e)?c(e)?void 0:e.map(e=>l(e,!1,!0,t)):l(e,!1,!0,t)},kill(){r(),k._tasks.empty()},unshift(e,t){return Array.isArray(e)?c(e)?void 0:e.map(e=>l(e,!0,!1,t)):l(e,!0,!1,t)},unshiftAsync(e,t){return Array.isArray(e)?c(e)?void 0:e.map(e=>l(e,!0,!0,t)):l(e,!0,!0,t)},remove(e){k._tasks.remove(e)},process(){var e=Math.min;if(!g){for(g=!0;!k.paused&&o{t.apply(a,e.concat((e,...t)=>{n(e,t)}))},(e,t)=>n(e,...t)),n[Fe]}}function C(...e){return T(...e.reverse())}function P(...e){return function(...t){var a=t.pop();return a(null,...e)}}function R(e,t){return(a,n,i,r)=>{var s,l=!1;const u=d(i);a(n,(a,n,i)=>{u(a,(n,r)=>n||!1===n?i(n):e(r)&&!s?(l=!0,s=t(!0,a),i(null,be)):void i())},e=>e?r(e):void r(null,l?s:t(!1)))}}function z(e){return(t,...a)=>d(t)(...a,(t,...a)=>{"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&a.forEach(t=>console[e](t)))})}function N(e,t,a){const n=d(t);return Ke(e,(...e)=>{const t=e.pop();n(...e,(e,a)=>t(e,!a))},a)}function V(e){return(t,a,n)=>e(t,n)}function Y(e){return u(e)?e:function(...t){var a=t.pop(),n=!0;t.push((...e)=>{n?Ee(()=>a(...e)):a(...e)}),e.apply(this,t),n=!1}}function q(e,t,a,n){var r=Array(t.length);e(t,(e,t,n)=>{a(e,(e,a)=>{r[t]=!!a,n(e)})},e=>{if(e)return n(e);for(var a=[],s=0;s{a(e,(a,r)=>a?n(a):void(r&&i.push({index:t,value:e}),n(a)))},e=>e?n(e):void n(null,i.sort((e,t)=>e.index-t.index).map(e=>e.value)))}function Q(e,t,a,n){var i=y(t)?q:D;return i(e,t,d(a),n)}function U(e,t,a){return lt(e,1/0,t,a)}function G(e,t,a){return lt(e,1,t,a)}function W(e,t,a){return ct(e,1/0,t,a)}function H(e,t,a){return ct(e,1,t,a)}function J(e,t=e=>e){var n=Object.create(null),r=Object.create(null),s=d(e),l=a((e,a)=>{var u=t(...e);u in n?Ee(()=>a(null,...n[u])):u in r?r[u].push(a):(r[u]=[a],s(...e,(e,...t)=>{e||(n[u]=t);var a=r[u];delete r[u];for(var s=0,c=a.length;s{a(e[0],t)},t,1)}function $(e){return(e<<1)+1}function ee(e){return(e+1>>1)-1}function te(e,t){return e.priority===t.priority?e.pushCount{}){if("function"!=typeof n)throw new Error("task callback must be a function");if(a.started=!0,Array.isArray(e)||(e=[e]),0===e.length&&a.idle())return Ee(()=>a.drain());for(var r,s=0,u=e.length;s{let n={};if(e&&(n.error=e),0=t.length&&([i]=t),n.value=i}a(null,n)}),t.apply(this,e)})}function re(e){var t;return Array.isArray(e)?t=e.map(ie):(t={},Object.keys(e).forEach(a=>{t[a]=ie.call(this,e[a])})),t}function se(e,t,a,n){const i=d(a);return Q(e,t,(e,t)=>{i(e,(e,a)=>{t(e,!a)})},n)}function le(e){return function(){return e}}function ue(e,t,a){function n(){r((e,...t)=>{!1===e||(e&&s++arguments.length&&"function"==typeof e?(a=t||_(),t=e):(ce(i,e),a=a||_()),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var r=d(t),s=1;return n(),a[Fe]}function ce(e,a){if("object"==typeof a)e.times=+a.times||gt,e.intervalFunc="function"==typeof a.interval?a.interval:le(+a.interval||kt),e.errorFilter=a.errorFilter;else if("number"==typeof a||"string"==typeof a)e.times=+a||gt;else throw new Error("Invalid arguments for async.retry")}function pe(e,t){t||(t=e,e=null);let n=e&&e.arity||t.length;u(t)&&(n+=1);var i=d(t);return a((t,a)=>{function r(e){i(...t,e)}return(t.length{var s,l=!1;a.push((...e)=>{l||(r(...e),clearTimeout(s))}),s=setTimeout(function(){var t=e.name||"anonymous",a=new Error("Callback function \""+t+"\" timed out.");a.code="ETIMEDOUT",n&&(a.info=n),l=!0,r(a)},t),i(...a)})}function he(e){for(var t=Array(e);e--;)t[e]=e;return t}function fe(e,t,a,n){var i=d(a);return qe(he(e),t,i,n)}function ye(e,t,a){return fe(e,1/0,t,a)}function me(e,t,a){return fe(e,1,t,a)}function ge(e,t,a,n){3>=arguments.length&&"function"==typeof t&&(n=a,a=t,t=Array.isArray(e)?[]:{}),n=m(n||_());var i=d(a);return Me(e,(e,a,n)=>{i(t,e,a,n)},e=>n(e,t)),n[Fe]}function ke(e){return(...t)=>(e.unmemoized||e)(...t)}function ve(e,t,a){const n=d(e);return bt(e=>n((t,a)=>e(t,!a)),t,a)}var Se,Le="function"==typeof setImmediate&&setImmediate,xe="object"==typeof process&&"function"==typeof process.nextTick;Se=Le?setImmediate:xe?process.nextTick:n;var Ee=i(Se);const be={};var Oe=e=>(t,a,n)=>{function i(e,t){if(!u)if(d-=1,e)l=!0,n(e);else if(!1===e)l=!0,u=!0;else{if(t===be||l&&0>=d)return l=!0,n(null);o||r()}}function r(){for(o=!0;d=d&&n(null));d+=1,a(t.value,t.key,x(i))}o=!1}if(n=m(n),0>=e)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return n(null);if(c(t))return E(t,e,a,n);if(p(t))return E(t[Symbol.asyncIterator](),e,a,n);var s=L(t),l=!1,u=!1,d=0,o=!1;r()},_e=o(function(e,t,a,n){return Oe(t)(e,d(a),n)},4),Me=o(function(e,t,a){var n=y(e)?b:O;return n(e,d(t),a)},3),Ae=o(function(e,t,a){return f(Me,e,t,a)},3),Ie=h(Ae),je=o(function(e,t,a){return _e(e,1,t,a)},3),we=o(function(e,t,a){return f(je,e,t,a)},3),Be=h(we);const Fe=Symbol("promiseCallback");var Te=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,Ce=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,Pe=/,/,Re=/(=.+)?(\s*)$/,ze=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;class Ne{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):j(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):j(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:a}=t;e(t)&&this.removeLink(t),t=a}return this}}var Ve,Ye=o(function(e,t,a,n){n=m(n);var r=d(a);return je(e,(e,a,n)=>{r(t,e,(e,a)=>{t=a,n(e)})},e=>n(e,t))},4),qe=o(function(e,t,a,n){return f(Oe(t),e,a,n)},4),De=o(function(e,t,a,n){var i=d(a);return qe(e,t,(e,t)=>{i(e,(e,...a)=>e?t(e):t(e,a))},(e,t)=>{for(var a=[],r=0;re,(e,t)=>t)(Me,e,t,a)},3),We=o(function(e,t,a,n){return R(e=>e,(e,t)=>t)(Oe(t),e,a,n)},4),He=o(function(e,t,a){return R(e=>e,(e,t)=>t)(Oe(1),e,t,a)},3),Je=z("dir"),Ke=o(function(e,t,a){function n(e,...t){return e?a(e):void(!1===e||(r=t,l(...t,i)))}function i(e,t){return e?a(e):!1===e?void 0:t?void s(n):a(null,...r)}a=x(a);var r,s=d(e),l=d(t);return i(null,!0)},3),Xe=o(function(e,t,a){return Me(e,V(d(t)),a)},3),Ze=o(function(e,t,a,n){return Oe(t)(e,V(d(a)),n)},4),$e=o(function(e,t,a){return Ze(e,1,t,a)},3),et=o(function(e,t,a){return R(e=>!e,e=>!e)(Me,e,t,a)},3),tt=o(function(e,t,a,n){return R(e=>!e,e=>!e)(Oe(t),e,a,n)},4),at=o(function(e,t,a){return R(e=>!e,e=>!e)(je,e,t,a)},3),nt=o(function(e,t,a){return Q(Me,e,t,a)},3),it=o(function(e,t,a,n){return Q(Oe(t),e,a,n)},4),rt=o(function(e,t,a){return Q(je,e,t,a)},3),st=o(function(e,t){function a(e){return e?n(e):void(!1===e||i(a))}var n=x(t),i=d(Y(e));return a()},2),lt=o(function(e,t,a,n){var i=d(a);return qe(e,t,(e,t)=>{i(e,(a,n)=>a?t(a):t(a,{key:n,val:e}))},(e,t)=>{for(var a={},{hasOwnProperty:r}=Object.prototype,s=0;s{r(e,t,(e,n)=>e?a(e):void(i[t]=n,a(e)))},e=>n(e,i))},4);Ve=xe?process.nextTick:Le?setImmediate:n;var pt=i(Ve),dt=o((e,t,a)=>{var n=y(t)?[]:{};e(t,(e,t,a)=>{d(e)((e,...i)=>{2>i.length&&([i]=i),n[t]=i,a(e)})},e=>a(e,n))},3);class ot{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){for(let a;0e)(Me,e,t,a)},3),St=o(function(e,t,a,n){return R(Boolean,e=>e)(Oe(t),e,a,n)},4),Lt=o(function(e,t,a){return R(Boolean,e=>e)(je,e,t,a)},3),xt=o(function(e,t,a){function n(e,t){var n=e.criteria,a=t.criteria;return na?1:0}var i=d(t);return Ae(e,(e,t)=>{i(e,(a,n)=>a?t(a):void t(a,{value:e,criteria:n}))},(e,t)=>e?a(e):void a(null,t.sort(n).map(e=>e.value)))},3),Et=o(function(e,t){var a,n=null;return $e(e,(e,t)=>{d(e)((e,...i)=>!1===e?t(e):void(2>i.length?[a]=i:a=i,n=e,t(e?null:{})))},()=>t(n,a))}),bt=o(function(e,t,a){function n(e,...t){if(e)return a(e);l=t;!1===e||s(i)}function i(e,t){return e?a(e):!1===e?void 0:t?void r(n):a(null,...l)}a=x(a);var r=d(t),s=d(e),l=[];return s(i)},3),Ot=o(function(e,t){function a(t){var a=d(e[i++]);a(...t,x(n))}function n(n,...r){return!1===n?void 0:n||i===e.length?t(n,...r):void a(r)}if(t=m(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var i=0;a([])});e.default={apply:t,applyEach:Ie,applyEachSeries:Be,asyncify:r,auto:M,autoInject:I,cargo:B,cargoQueue:F,compose:C,concat:Qe,concatLimit:De,concatSeries:Ue,constant:P,detect:Ge,detectLimit:We,detectSeries:He,dir:Je,doUntil:N,doWhilst:Ke,each:Xe,eachLimit:Ze,eachOf:Me,eachOfLimit:_e,eachOfSeries:je,eachSeries:$e,ensureAsync:Y,every:et,everyLimit:tt,everySeries:at,filter:nt,filterLimit:it,filterSeries:rt,forever:st,groupBy:U,groupByLimit:lt,groupBySeries:G,log:ut,map:Ae,mapLimit:qe,mapSeries:we,mapValues:W,mapValuesLimit:ct,mapValuesSeries:H,memoize:J,nextTick:pt,parallel:K,parallelLimit:X,priorityQueue:ae,queue:Z,race:ht,reduce:Ye,reduceRight:ne,reflect:ie,reflectAll:re,reject:ft,rejectLimit:yt,rejectSeries:mt,retry:ue,retryable:pe,seq:T,series:de,setImmediate:Ee,some:vt,someLimit:St,someSeries:Lt,sortBy:xt,timeout:oe,times:ye,timesLimit:fe,timesSeries:me,transform:ge,tryEach:Et,unmemoize:ke,until:ve,waterfall:Ot,whilst:bt,all:et,allLimit:tt,allSeries:at,any:vt,anyLimit:St,anySeries:Lt,find:Ge,findLimit:We,findSeries:He,flatMap:Qe,flatMapLimit:De,flatMapSeries:Ue,forEach:Xe,forEachSeries:$e,forEachLimit:Ze,forEachOf:Me,forEachOfSeries:je,forEachOfLimit:_e,inject:Ye,foldl:Ye,foldr:ne,select:nt,selectLimit:it,selectSeries:rt,wrapSync:r,during:bt,doDuring:Ke},e.apply=t,e.applyEach=Ie,e.applyEachSeries=Be,e.asyncify=r,e.auto=M,e.autoInject=I,e.cargo=B,e.cargoQueue=F,e.compose=C,e.concat=Qe,e.concatLimit=De,e.concatSeries=Ue,e.constant=P,e.detect=Ge,e.detectLimit=We,e.detectSeries=He,e.dir=Je,e.doUntil=N,e.doWhilst=Ke,e.each=Xe,e.eachLimit=Ze,e.eachOf=Me,e.eachOfLimit=_e,e.eachOfSeries=je,e.eachSeries=$e,e.ensureAsync=Y,e.every=et,e.everyLimit=tt,e.everySeries=at,e.filter=nt,e.filterLimit=it,e.filterSeries=rt,e.forever=st,e.groupBy=U,e.groupByLimit=lt,e.groupBySeries=G,e.log=ut,e.map=Ae,e.mapLimit=qe,e.mapSeries=we,e.mapValues=W,e.mapValuesLimit=ct,e.mapValuesSeries=H,e.memoize=J,e.nextTick=pt,e.parallel=K,e.parallelLimit=X,e.priorityQueue=ae,e.queue=Z,e.race=ht,e.reduce=Ye,e.reduceRight=ne,e.reflect=ie,e.reflectAll=re,e.reject=ft,e.rejectLimit=yt,e.rejectSeries=mt,e.retry=ue,e.retryable=pe,e.seq=T,e.series=de,e.setImmediate=Ee,e.some=vt,e.someLimit=St,e.someSeries=Lt,e.sortBy=xt,e.timeout=oe,e.times=ye,e.timesLimit=fe,e.timesSeries=me,e.transform=ge,e.tryEach=Et,e.unmemoize=ke,e.until=ve,e.waterfall=Ot,e.whilst=bt,e.all=et,e.allLimit=tt,e.allSeries=at,e.any=vt,e.anyLimit=St,e.anySeries=Lt,e.find=Ge,e.findLimit=We,e.findSeries=He,e.flatMap=Qe,e.flatMapLimit=De,e.flatMapSeries=Ue,e.forEach=Xe,e.forEachSeries=$e,e.forEachLimit=Ze,e.forEachOf=Me,e.forEachOfSeries=je,e.forEachOfLimit=_e,e.inject=Ye,e.foldl=Ye,e.foldr=ne,e.select=nt,e.selectLimit=it,e.selectSeries=rt,e.wrapSync=r,e.during=bt,e.doDuring=Ke,Object.defineProperty(e,"__esModule",{value:!0})}); \ No newline at end of file diff --git a/node_modules/async/dist/async.mjs b/node_modules/async/dist/async.mjs deleted file mode 100644 index 2bd479de..00000000 --- a/node_modules/async/dist/async.mjs +++ /dev/null @@ -1,4734 +0,0 @@ -/** - * Creates a continuation function with some arguments already applied. - * - * Useful as a shorthand when combined with other control flow functions. Any - * arguments passed to the returned function are added to the arguments - * originally passed to apply. - * - * @name apply - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {Function} fn - The function you want to eventually apply all - * arguments to. Invokes with (arguments...). - * @param {...*} arguments... - Any number of arguments to automatically apply - * when the continuation is called. - * @returns {Function} the partially-applied function - * @example - * - * // using apply - * async.parallel([ - * async.apply(fs.writeFile, 'testfile1', 'test1'), - * async.apply(fs.writeFile, 'testfile2', 'test2') - * ]); - * - * - * // the same process without using apply - * async.parallel([ - * function(callback) { - * fs.writeFile('testfile1', 'test1', callback); - * }, - * function(callback) { - * fs.writeFile('testfile2', 'test2', callback); - * } - * ]); - * - * // It's possible to pass any number of additional arguments when calling the - * // continuation: - * - * node> var fn = async.apply(sys.puts, 'one'); - * node> fn('two', 'three'); - * one - * two - * three - */ -function apply(fn, ...args) { - return (...callArgs) => fn(...args,...callArgs); -} - -function initialParams (fn) { - return function (...args/*, callback*/) { - var callback = args.pop(); - return fn.call(this, args, callback); - }; -} - -/* istanbul ignore file */ - -var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; -var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; - -function fallback(fn) { - setTimeout(fn, 0); -} - -function wrap(defer) { - return (fn, ...args) => defer(() => fn(...args)); -} - -var _defer; - -if (hasSetImmediate) { - _defer = setImmediate; -} else if (hasNextTick) { - _defer = process.nextTick; -} else { - _defer = fallback; -} - -var setImmediate$1 = wrap(_defer); - -/** - * Take a sync function and make it async, passing its return value to a - * callback. This is useful for plugging sync functions into a waterfall, - * series, or other async functions. Any arguments passed to the generated - * function will be passed to the wrapped function (except for the final - * callback argument). Errors thrown will be passed to the callback. - * - * If the function passed to `asyncify` returns a Promise, that promises's - * resolved/rejected state will be used to call the callback, rather than simply - * the synchronous return value. - * - * This also means you can asyncify ES2017 `async` functions. - * - * @name asyncify - * @static - * @memberOf module:Utils - * @method - * @alias wrapSync - * @category Util - * @param {Function} func - The synchronous function, or Promise-returning - * function to convert to an {@link AsyncFunction}. - * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be - * invoked with `(args..., callback)`. - * @example - * - * // passing a regular synchronous function - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(JSON.parse), - * function (data, next) { - * // data is the result of parsing the text. - * // If there was a parsing error, it would have been caught. - * } - * ], callback); - * - * // passing a function returning a promise - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(function (contents) { - * return db.model.create(contents); - * }), - * function (model, next) { - * // `model` is the instantiated model object. - * // If there was an error, this function would be skipped. - * } - * ], callback); - * - * // es2017 example, though `asyncify` is not needed if your JS environment - * // supports async functions out of the box - * var q = async.queue(async.asyncify(async function(file) { - * var intermediateStep = await processFile(file); - * return await somePromise(intermediateStep) - * })); - * - * q.push(files); - */ -function asyncify(func) { - if (isAsync(func)) { - return function (...args/*, callback*/) { - const callback = args.pop(); - const promise = func.apply(this, args); - return handlePromise(promise, callback) - } - } - - return initialParams(function (args, callback) { - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (result && typeof result.then === 'function') { - return handlePromise(result, callback) - } else { - callback(null, result); - } - }); -} - -function handlePromise(promise, callback) { - return promise.then(value => { - invokeCallback(callback, null, value); - }, err => { - invokeCallback(callback, err && err.message ? err : new Error(err)); - }); -} - -function invokeCallback(callback, error, value) { - try { - callback(error, value); - } catch (err) { - setImmediate$1(e => { throw e }, err); - } -} - -function isAsync(fn) { - return fn[Symbol.toStringTag] === 'AsyncFunction'; -} - -function isAsyncGenerator(fn) { - return fn[Symbol.toStringTag] === 'AsyncGenerator'; -} - -function isAsyncIterable(obj) { - return typeof obj[Symbol.asyncIterator] === 'function'; -} - -function wrapAsync(asyncFn) { - if (typeof asyncFn !== 'function') throw new Error('expected a function') - return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; -} - -// conditionally promisify a function. -// only return a promise if a callback is omitted -function awaitify (asyncFn, arity = asyncFn.length) { - if (!arity) throw new Error('arity is undefined') - function awaitable (...args) { - if (typeof args[arity - 1] === 'function') { - return asyncFn.apply(this, args) - } - - return new Promise((resolve, reject) => { - args[arity - 1] = (err, ...cbArgs) => { - if (err) return reject(err) - resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]); - }; - asyncFn.apply(this, args); - }) - } - - return awaitable -} - -function applyEach (eachfn) { - return function applyEach(fns, ...callArgs) { - const go = awaitify(function (callback) { - var that = this; - return eachfn(fns, (fn, cb) => { - wrapAsync(fn).apply(that, callArgs.concat(cb)); - }, callback); - }); - return go; - }; -} - -function _asyncMap(eachfn, arr, iteratee, callback) { - arr = arr || []; - var results = []; - var counter = 0; - var _iteratee = wrapAsync(iteratee); - - return eachfn(arr, (value, _, iterCb) => { - var index = counter++; - _iteratee(value, (err, v) => { - results[index] = v; - iterCb(err); - }); - }, err => { - callback(err, results); - }); -} - -function isArrayLike(value) { - return value && - typeof value.length === 'number' && - value.length >= 0 && - value.length % 1 === 0; -} - -// A temporary value used to identify if the loop should be broken. -// See #1064, #1293 -const breakLoop = {}; - -function once(fn) { - function wrapper (...args) { - if (fn === null) return; - var callFn = fn; - fn = null; - callFn.apply(this, args); - } - Object.assign(wrapper, fn); - return wrapper -} - -function getIterator (coll) { - return coll[Symbol.iterator] && coll[Symbol.iterator](); -} - -function createArrayIterator(coll) { - var i = -1; - var len = coll.length; - return function next() { - return ++i < len ? {value: coll[i], key: i} : null; - } -} - -function createES2015Iterator(iterator) { - var i = -1; - return function next() { - var item = iterator.next(); - if (item.done) - return null; - i++; - return {value: item.value, key: i}; - } -} - -function createObjectIterator(obj) { - var okeys = obj ? Object.keys(obj) : []; - var i = -1; - var len = okeys.length; - return function next() { - var key = okeys[++i]; - return i < len ? {value: obj[key], key} : null; - }; -} - -function createIterator(coll) { - if (isArrayLike(coll)) { - return createArrayIterator(coll); - } - - var iterator = getIterator(coll); - return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); -} - -function onlyOnce(fn) { - return function (...args) { - if (fn === null) throw new Error("Callback was already called."); - var callFn = fn; - fn = null; - callFn.apply(this, args); - }; -} - -// for async generators -function asyncEachOfLimit(generator, limit, iteratee, callback) { - let done = false; - let canceled = false; - let awaiting = false; - let running = 0; - let idx = 0; - - function replenish() { - //console.log('replenish') - if (running >= limit || awaiting || done) return - //console.log('replenish awaiting') - awaiting = true; - generator.next().then(({value, done: iterDone}) => { - //console.log('got value', value) - if (canceled || done) return - awaiting = false; - if (iterDone) { - done = true; - if (running <= 0) { - //console.log('done nextCb') - callback(null); - } - return; - } - running++; - iteratee(value, idx, iterateeCallback); - idx++; - replenish(); - }).catch(handleError); - } - - function iterateeCallback(err, result) { - //console.log('iterateeCallback') - running -= 1; - if (canceled) return - if (err) return handleError(err) - - if (err === false) { - done = true; - canceled = true; - return - } - - if (result === breakLoop || (done && running <= 0)) { - done = true; - //console.log('done iterCb') - return callback(null); - } - replenish(); - } - - function handleError(err) { - if (canceled) return - awaiting = false; - done = true; - callback(err); - } - - replenish(); -} - -var eachOfLimit = (limit) => { - return (obj, iteratee, callback) => { - callback = once(callback); - if (limit <= 0) { - throw new RangeError('concurrency limit cannot be less than 1') - } - if (!obj) { - return callback(null); - } - if (isAsyncGenerator(obj)) { - return asyncEachOfLimit(obj, limit, iteratee, callback) - } - if (isAsyncIterable(obj)) { - return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback) - } - var nextElem = createIterator(obj); - var done = false; - var canceled = false; - var running = 0; - var looping = false; - - function iterateeCallback(err, value) { - if (canceled) return - running -= 1; - if (err) { - done = true; - callback(err); - } - else if (err === false) { - done = true; - canceled = true; - } - else if (value === breakLoop || (done && running <= 0)) { - done = true; - return callback(null); - } - else if (!looping) { - replenish(); - } - } - - function replenish () { - looping = true; - while (running < limit && !done) { - var elem = nextElem(); - if (elem === null) { - done = true; - if (running <= 0) { - callback(null); - } - return; - } - running += 1; - iteratee(elem.value, elem.key, onlyOnce(iterateeCallback)); - } - looping = false; - } - - replenish(); - }; -}; - -/** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a - * time. - * - * @name eachOfLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. The `key` is the item's key, or index in the case of an - * array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachOfLimit$1(coll, limit, iteratee, callback) { - return eachOfLimit(limit)(coll, wrapAsync(iteratee), callback); -} - -var eachOfLimit$2 = awaitify(eachOfLimit$1, 4); - -// eachOf implementation optimized for array-likes -function eachOfArrayLike(coll, iteratee, callback) { - callback = once(callback); - var index = 0, - completed = 0, - {length} = coll, - canceled = false; - if (length === 0) { - callback(null); - } - - function iteratorCallback(err, value) { - if (err === false) { - canceled = true; - } - if (canceled === true) return - if (err) { - callback(err); - } else if ((++completed === length) || value === breakLoop) { - callback(null); - } - } - - for (; index < length; index++) { - iteratee(coll[index], index, onlyOnce(iteratorCallback)); - } -} - -// a generic version of eachOf which can handle array, object, and iterator cases. -function eachOfGeneric (coll, iteratee, callback) { - return eachOfLimit$2(coll, Infinity, iteratee, callback); -} - -/** - * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument - * to the iteratee. - * - * @name eachOf - * @static - * @memberOf module:Collections - * @method - * @alias forEachOf - * @category Collection - * @see [async.each]{@link module:Collections.each} - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each - * item in `coll`. - * The `key` is the item's key, or index in the case of an array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; - * var configs = {}; - * - * async.forEachOf(obj, function (value, key, callback) { - * fs.readFile(__dirname + value, "utf8", function (err, data) { - * if (err) return callback(err); - * try { - * configs[key] = JSON.parse(data); - * } catch (e) { - * return callback(e); - * } - * callback(); - * }); - * }, function (err) { - * if (err) console.error(err.message); - * // configs is now a map of JSON data - * doSomethingWith(configs); - * }); - */ -function eachOf(coll, iteratee, callback) { - var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric; - return eachOfImplementation(coll, wrapAsync(iteratee), callback); -} - -var eachOf$1 = awaitify(eachOf, 3); - -/** - * Produces a new collection of values by mapping each value in `coll` through - * the `iteratee` function. The `iteratee` is called with an item from `coll` - * and a callback for when it has finished processing. Each of these callback - * takes 2 arguments: an `error`, and the transformed item from `coll`. If - * `iteratee` passes an error to its callback, the main `callback` (for the - * `map` function) is immediately called with the error. - * - * Note, that since this function applies the `iteratee` to each item in - * parallel, there is no guarantee that the `iteratee` functions will complete - * in order. However, the results array will be in the same order as the - * original `coll`. - * - * If `map` is passed an Object, the results will be an Array. The results - * will roughly be in the order of the original Objects' keys (but this can - * vary across JavaScript engines). - * - * @name map - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an Array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.map(['file1','file2','file3'], fs.stat, function(err, results) { - * // results is now an array of stats for each file - * }); - */ -function map (coll, iteratee, callback) { - return _asyncMap(eachOf$1, coll, iteratee, callback) -} -var map$1 = awaitify(map, 3); - -/** - * Applies the provided arguments to each function in the array, calling - * `callback` after all functions have completed. If you only provide the first - * argument, `fns`, then it will return a function which lets you pass in the - * arguments as if it were a single function call. If more arguments are - * provided, `callback` is required while `args` is still optional. The results - * for each of the applied async functions are passed to the final callback - * as an array. - * - * @name applyEach - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s - * to all call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {AsyncFunction} - Returns a function that takes no args other than - * an optional callback, that is the result of applying the `args` to each - * of the functions. - * @example - * - * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket') - * - * appliedFn((err, results) => { - * // results[0] is the results for `enableSearch` - * // results[1] is the results for `updateSchema` - * }); - * - * // partial application example: - * async.each( - * buckets, - * async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(), - * callback - * ); - */ -var applyEach$1 = applyEach(map$1); - -/** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. - * - * @name eachOfSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachOfSeries(coll, iteratee, callback) { - return eachOfLimit$2(coll, 1, iteratee, callback) -} -var eachOfSeries$1 = awaitify(eachOfSeries, 3); - -/** - * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. - * - * @name mapSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function mapSeries (coll, iteratee, callback) { - return _asyncMap(eachOfSeries$1, coll, iteratee, callback) -} -var mapSeries$1 = awaitify(mapSeries, 3); - -/** - * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. - * - * @name applyEachSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.applyEach]{@link module:ControlFlow.applyEach} - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all - * call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {AsyncFunction} - A function, that when called, is the result of - * appling the `args` to the list of functions. It takes no args, other than - * a callback. - */ -var applyEachSeries = applyEach(mapSeries$1); - -const PROMISE_SYMBOL = Symbol('promiseCallback'); - -function promiseCallback () { - let resolve, reject; - function callback (err, ...args) { - if (err) return reject(err) - resolve(args.length > 1 ? args : args[0]); - } - - callback[PROMISE_SYMBOL] = new Promise((res, rej) => { - resolve = res, - reject = rej; - }); - - return callback -} - -/** - * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on - * their requirements. Each function can optionally depend on other functions - * being completed first, and each function is run as soon as its requirements - * are satisfied. - * - * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence - * will stop. Further tasks will not execute (so any other functions depending - * on it will not run), and the main `callback` is immediately called with the - * error. - * - * {@link AsyncFunction}s also receive an object containing the results of functions which - * have completed so far as the first argument, if they have dependencies. If a - * task function has no dependencies, it will only be passed a callback. - * - * @name auto - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Object} tasks - An object. Each of its properties is either a - * function or an array of requirements, with the {@link AsyncFunction} itself the last item - * in the array. The object's key of a property serves as the name of the task - * defined by that property, i.e. can be used when specifying requirements for - * other tasks. The function receives one or two arguments: - * * a `results` object, containing the results of the previously executed - * functions, only passed if the task has any dependencies, - * * a `callback(err, result)` function, which must be called when finished, - * passing an `error` (which can be `null`) and the result of the function's - * execution. - * @param {number} [concurrency=Infinity] - An optional `integer` for - * determining the maximum number of tasks that can be run in parallel. By - * default, as many as possible. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback. Results are always returned; however, if an - * error occurs, no further `tasks` will be performed, and the results object - * will only contain partial results. Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - * @example - * - * async.auto({ - * // this function will just be passed a callback - * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), - * showData: ['readData', function(results, cb) { - * // results.readData is the file's contents - * // ... - * }] - * }, callback); - * - * async.auto({ - * get_data: function(callback) { - * console.log('in get_data'); - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * console.log('in make_folder'); - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: ['get_data', 'make_folder', function(results, callback) { - * console.log('in write_file', JSON.stringify(results)); - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(results, callback) { - * console.log('in email_link', JSON.stringify(results)); - * // once the file is written let's email a link to it... - * // results.write_file contains the filename returned by write_file. - * callback(null, {'file':results.write_file, 'email':'user@example.com'}); - * }] - * }, function(err, results) { - * console.log('err = ', err); - * console.log('results = ', results); - * }); - */ -function auto(tasks, concurrency, callback) { - if (typeof concurrency !== 'number') { - // concurrency is optional, shift the args. - callback = concurrency; - concurrency = null; - } - callback = once(callback || promiseCallback()); - var numTasks = Object.keys(tasks).length; - if (!numTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = numTasks; - } - - var results = {}; - var runningTasks = 0; - var canceled = false; - var hasError = false; - - var listeners = Object.create(null); - - var readyTasks = []; - - // for cycle detection: - var readyToCheck = []; // tasks that have been identified as reachable - // without the possibility of returning to an ancestor task - var uncheckedDependencies = {}; - - Object.keys(tasks).forEach(key => { - var task = tasks[key]; - if (!Array.isArray(task)) { - // no dependencies - enqueueTask(key, [task]); - readyToCheck.push(key); - return; - } - - var dependencies = task.slice(0, task.length - 1); - var remainingDependencies = dependencies.length; - if (remainingDependencies === 0) { - enqueueTask(key, task); - readyToCheck.push(key); - return; - } - uncheckedDependencies[key] = remainingDependencies; - - dependencies.forEach(dependencyName => { - if (!tasks[dependencyName]) { - throw new Error('async.auto task `' + key + - '` has a non-existent dependency `' + - dependencyName + '` in ' + - dependencies.join(', ')); - } - addListener(dependencyName, () => { - remainingDependencies--; - if (remainingDependencies === 0) { - enqueueTask(key, task); - } - }); - }); - }); - - checkForDeadlocks(); - processQueue(); - - function enqueueTask(key, task) { - readyTasks.push(() => runTask(key, task)); - } - - function processQueue() { - if (canceled) return - if (readyTasks.length === 0 && runningTasks === 0) { - return callback(null, results); - } - while(readyTasks.length && runningTasks < concurrency) { - var run = readyTasks.shift(); - run(); - } - - } - - function addListener(taskName, fn) { - var taskListeners = listeners[taskName]; - if (!taskListeners) { - taskListeners = listeners[taskName] = []; - } - - taskListeners.push(fn); - } - - function taskComplete(taskName) { - var taskListeners = listeners[taskName] || []; - taskListeners.forEach(fn => fn()); - processQueue(); - } - - - function runTask(key, task) { - if (hasError) return; - - var taskCallback = onlyOnce((err, ...result) => { - runningTasks--; - if (err === false) { - canceled = true; - return - } - if (result.length < 2) { - [result] = result; - } - if (err) { - var safeResults = {}; - Object.keys(results).forEach(rkey => { - safeResults[rkey] = results[rkey]; - }); - safeResults[key] = result; - hasError = true; - listeners = Object.create(null); - if (canceled) return - callback(err, safeResults); - } else { - results[key] = result; - taskComplete(key); - } - }); - - runningTasks++; - var taskFn = wrapAsync(task[task.length - 1]); - if (task.length > 1) { - taskFn(results, taskCallback); - } else { - taskFn(taskCallback); - } - } - - function checkForDeadlocks() { - // Kahn's algorithm - // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm - // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html - var currentTask; - var counter = 0; - while (readyToCheck.length) { - currentTask = readyToCheck.pop(); - counter++; - getDependents(currentTask).forEach(dependent => { - if (--uncheckedDependencies[dependent] === 0) { - readyToCheck.push(dependent); - } - }); - } - - if (counter !== numTasks) { - throw new Error( - 'async.auto cannot execute tasks due to a recursive dependency' - ); - } - } - - function getDependents(taskName) { - var result = []; - Object.keys(tasks).forEach(key => { - const task = tasks[key]; - if (Array.isArray(task) && task.indexOf(taskName) >= 0) { - result.push(key); - } - }); - return result; - } - - return callback[PROMISE_SYMBOL] -} - -var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/; -var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/; -var FN_ARG_SPLIT = /,/; -var FN_ARG = /(=.+)?(\s*)$/; -var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; - -function parseParams(func) { - const src = func.toString().replace(STRIP_COMMENTS, ''); - let match = src.match(FN_ARGS); - if (!match) { - match = src.match(ARROW_FN_ARGS); - } - if (!match) throw new Error('could not parse args in autoInject\nSource:\n' + src) - let [, args] = match; - return args - .replace(/\s/g, '') - .split(FN_ARG_SPLIT) - .map((arg) => arg.replace(FN_ARG, '').trim()); -} - -/** - * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent - * tasks are specified as parameters to the function, after the usual callback - * parameter, with the parameter names matching the names of the tasks it - * depends on. This can provide even more readable task graphs which can be - * easier to maintain. - * - * If a final callback is specified, the task results are similarly injected, - * specified as named parameters after the initial error parameter. - * - * The autoInject function is purely syntactic sugar and its semantics are - * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. - * - * @name autoInject - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.auto]{@link module:ControlFlow.auto} - * @category Control Flow - * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of - * the form 'func([dependencies...], callback). The object's key of a property - * serves as the name of the task defined by that property, i.e. can be used - * when specifying requirements for other tasks. - * * The `callback` parameter is a `callback(err, result)` which must be called - * when finished, passing an `error` (which can be `null`) and the result of - * the function's execution. The remaining parameters name other tasks on - * which the task is dependent, and the results from those tasks are the - * arguments of those parameters. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback, and a `results` object with any completed - * task results, similar to `auto`. - * @returns {Promise} a promise, if no callback is passed - * @example - * - * // The example from `auto` can be rewritten as follows: - * async.autoInject({ - * get_data: function(callback) { - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: function(get_data, make_folder, callback) { - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }, - * email_link: function(write_file, callback) { - * // once the file is written let's email a link to it... - * // write_file contains the filename returned by write_file. - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * } - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - * - * // If you are using a JS minifier that mangles parameter names, `autoInject` - * // will not work with plain functions, since the parameter names will be - * // collapsed to a single letter identifier. To work around this, you can - * // explicitly specify the names of the parameters your task function needs - * // in an array, similar to Angular.js dependency injection. - * - * // This still has an advantage over plain `auto`, since the results a task - * // depends on are still spread into arguments. - * async.autoInject({ - * //... - * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(write_file, callback) { - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * }] - * //... - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - */ -function autoInject(tasks, callback) { - var newTasks = {}; - - Object.keys(tasks).forEach(key => { - var taskFn = tasks[key]; - var params; - var fnIsAsync = isAsync(taskFn); - var hasNoDeps = - (!fnIsAsync && taskFn.length === 1) || - (fnIsAsync && taskFn.length === 0); - - if (Array.isArray(taskFn)) { - params = [...taskFn]; - taskFn = params.pop(); - - newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); - } else if (hasNoDeps) { - // no dependencies, use the function as-is - newTasks[key] = taskFn; - } else { - params = parseParams(taskFn); - if ((taskFn.length === 0 && !fnIsAsync) && params.length === 0) { - throw new Error("autoInject task functions require explicit parameters."); - } - - // remove callback param - if (!fnIsAsync) params.pop(); - - newTasks[key] = params.concat(newTask); - } - - function newTask(results, taskCb) { - var newArgs = params.map(name => results[name]); - newArgs.push(taskCb); - wrapAsync(taskFn)(...newArgs); - } - }); - - return auto(newTasks, callback); -} - -// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation -// used for queues. This implementation assumes that the node provided by the user can be modified -// to adjust the next and last properties. We implement only the minimal functionality -// for queue support. -class DLL { - constructor() { - this.head = this.tail = null; - this.length = 0; - } - - removeLink(node) { - if (node.prev) node.prev.next = node.next; - else this.head = node.next; - if (node.next) node.next.prev = node.prev; - else this.tail = node.prev; - - node.prev = node.next = null; - this.length -= 1; - return node; - } - - empty () { - while(this.head) this.shift(); - return this; - } - - insertAfter(node, newNode) { - newNode.prev = node; - newNode.next = node.next; - if (node.next) node.next.prev = newNode; - else this.tail = newNode; - node.next = newNode; - this.length += 1; - } - - insertBefore(node, newNode) { - newNode.prev = node.prev; - newNode.next = node; - if (node.prev) node.prev.next = newNode; - else this.head = newNode; - node.prev = newNode; - this.length += 1; - } - - unshift(node) { - if (this.head) this.insertBefore(this.head, node); - else setInitial(this, node); - } - - push(node) { - if (this.tail) this.insertAfter(this.tail, node); - else setInitial(this, node); - } - - shift() { - return this.head && this.removeLink(this.head); - } - - pop() { - return this.tail && this.removeLink(this.tail); - } - - toArray() { - return [...this] - } - - *[Symbol.iterator] () { - var cur = this.head; - while (cur) { - yield cur.data; - cur = cur.next; - } - } - - remove (testFn) { - var curr = this.head; - while(curr) { - var {next} = curr; - if (testFn(curr)) { - this.removeLink(curr); - } - curr = next; - } - return this; - } -} - -function setInitial(dll, node) { - dll.length = 1; - dll.head = dll.tail = node; -} - -function queue(worker, concurrency, payload) { - if (concurrency == null) { - concurrency = 1; - } - else if(concurrency === 0) { - throw new RangeError('Concurrency must not be zero'); - } - - var _worker = wrapAsync(worker); - var numRunning = 0; - var workersList = []; - const events = { - error: [], - drain: [], - saturated: [], - unsaturated: [], - empty: [] - }; - - function on (event, handler) { - events[event].push(handler); - } - - function once (event, handler) { - const handleAndRemove = (...args) => { - off(event, handleAndRemove); - handler(...args); - }; - events[event].push(handleAndRemove); - } - - function off (event, handler) { - if (!event) return Object.keys(events).forEach(ev => events[ev] = []) - if (!handler) return events[event] = [] - events[event] = events[event].filter(ev => ev !== handler); - } - - function trigger (event, ...args) { - events[event].forEach(handler => handler(...args)); - } - - var processingScheduled = false; - function _insert(data, insertAtFront, rejectOnError, callback) { - if (callback != null && typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - - var res, rej; - function promiseCallback (err, ...args) { - // we don't care about the error, let the global error handler - // deal with it - if (err) return rejectOnError ? rej(err) : res() - if (args.length <= 1) return res(args[0]) - res(args); - } - - var item = { - data, - callback: rejectOnError ? - promiseCallback : - (callback || promiseCallback) - }; - - if (insertAtFront) { - q._tasks.unshift(item); - } else { - q._tasks.push(item); - } - - if (!processingScheduled) { - processingScheduled = true; - setImmediate$1(() => { - processingScheduled = false; - q.process(); - }); - } - - if (rejectOnError || !callback) { - return new Promise((resolve, reject) => { - res = resolve; - rej = reject; - }) - } - } - - function _createCB(tasks) { - return function (err, ...args) { - numRunning -= 1; - - for (var i = 0, l = tasks.length; i < l; i++) { - var task = tasks[i]; - - var index = workersList.indexOf(task); - if (index === 0) { - workersList.shift(); - } else if (index > 0) { - workersList.splice(index, 1); - } - - task.callback(err, ...args); - - if (err != null) { - trigger('error', err, task.data); - } - } - - if (numRunning <= (q.concurrency - q.buffer) ) { - trigger('unsaturated'); - } - - if (q.idle()) { - trigger('drain'); - } - q.process(); - }; - } - - function _maybeDrain(data) { - if (data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - setImmediate$1(() => trigger('drain')); - return true - } - return false - } - - const eventMethod = (name) => (handler) => { - if (!handler) { - return new Promise((resolve, reject) => { - once(name, (err, data) => { - if (err) return reject(err) - resolve(data); - }); - }) - } - off(name); - on(name, handler); - - }; - - var isProcessing = false; - var q = { - _tasks: new DLL(), - *[Symbol.iterator] () { - yield* q._tasks[Symbol.iterator](); - }, - concurrency, - payload, - buffer: concurrency / 4, - started: false, - paused: false, - push (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, false, false, callback)) - } - return _insert(data, false, false, callback); - }, - pushAsync (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, false, true, callback)) - } - return _insert(data, false, true, callback); - }, - kill () { - off(); - q._tasks.empty(); - }, - unshift (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, true, false, callback)) - } - return _insert(data, true, false, callback); - }, - unshiftAsync (data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return - return data.map(datum => _insert(datum, true, true, callback)) - } - return _insert(data, true, true, callback); - }, - remove (testFn) { - q._tasks.remove(testFn); - }, - process () { - // Avoid trying to start too many processing operations. This can occur - // when callbacks resolve synchronously (#1267). - if (isProcessing) { - return; - } - isProcessing = true; - while(!q.paused && numRunning < q.concurrency && q._tasks.length){ - var tasks = [], data = []; - var l = q._tasks.length; - if (q.payload) l = Math.min(l, q.payload); - for (var i = 0; i < l; i++) { - var node = q._tasks.shift(); - tasks.push(node); - workersList.push(node); - data.push(node.data); - } - - numRunning += 1; - - if (q._tasks.length === 0) { - trigger('empty'); - } - - if (numRunning === q.concurrency) { - trigger('saturated'); - } - - var cb = onlyOnce(_createCB(tasks)); - _worker(data, cb); - } - isProcessing = false; - }, - length () { - return q._tasks.length; - }, - running () { - return numRunning; - }, - workersList () { - return workersList; - }, - idle() { - return q._tasks.length + numRunning === 0; - }, - pause () { - q.paused = true; - }, - resume () { - if (q.paused === false) { return; } - q.paused = false; - setImmediate$1(q.process); - } - }; - // define these as fixed properties, so people get useful errors when updating - Object.defineProperties(q, { - saturated: { - writable: false, - value: eventMethod('saturated') - }, - unsaturated: { - writable: false, - value: eventMethod('unsaturated') - }, - empty: { - writable: false, - value: eventMethod('empty') - }, - drain: { - writable: false, - value: eventMethod('drain') - }, - error: { - writable: false, - value: eventMethod('error') - }, - }); - return q; -} - -/** - * Creates a `cargo` object with the specified payload. Tasks added to the - * cargo will be processed altogether (up to the `payload` limit). If the - * `worker` is in progress, the task is queued until it becomes available. Once - * the `worker` has completed some tasks, each callback of those tasks is - * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) - * for how `cargo` and `queue` work. - * - * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers - * at a time, cargo passes an array of tasks to a single worker, repeating - * when the worker is finished. - * - * @name cargo - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An asynchronous function for processing an array - * of queued tasks. Invoked with `(tasks, callback)`. - * @param {number} [payload=Infinity] - An optional `integer` for determining - * how many tasks should be processed per round; if omitted, the default is - * unlimited. - * @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can - * attached as certain properties to listen for specific events during the - * lifecycle of the cargo and inner queue. - * @example - * - * // create a cargo object with payload 2 - * var cargo = async.cargo(function(tasks, callback) { - * for (var i=0; i { - _iteratee(memo, x, (err, v) => { - memo = v; - iterCb(err); - }); - }, err => callback(err, memo)); -} -var reduce$1 = awaitify(reduce, 4); - -/** - * Version of the compose function that is more natural to read. Each function - * consumes the return value of the previous function. It is the equivalent of - * [compose]{@link module:ControlFlow.compose} with the arguments reversed. - * - * Each function is executed with the `this` binding of the composed function. - * - * @name seq - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.compose]{@link module:ControlFlow.compose} - * @category Control Flow - * @param {...AsyncFunction} functions - the asynchronous functions to compose - * @returns {Function} a function that composes the `functions` in order - * @example - * - * // Requires lodash (or underscore), express3 and dresende's orm2. - * // Part of an app, that fetches cats of the logged user. - * // This example uses `seq` function to avoid overnesting and error - * // handling clutter. - * app.get('/cats', function(request, response) { - * var User = request.models.User; - * async.seq( - * _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - * function(user, fn) { - * user.getCats(fn); // 'getCats' has signature (callback(err, data)) - * } - * )(req.session.user_id, function (err, cats) { - * if (err) { - * console.error(err); - * response.json({ status: 'error', message: err.message }); - * } else { - * response.json({ status: 'ok', message: 'Cats found', data: cats }); - * } - * }); - * }); - */ -function seq(...functions) { - var _functions = functions.map(wrapAsync); - return function (...args) { - var that = this; - - var cb = args[args.length - 1]; - if (typeof cb == 'function') { - args.pop(); - } else { - cb = promiseCallback(); - } - - reduce$1(_functions, args, (newargs, fn, iterCb) => { - fn.apply(that, newargs.concat((err, ...nextargs) => { - iterCb(err, nextargs); - })); - }, - (err, results) => cb(err, ...results)); - - return cb[PROMISE_SYMBOL] - }; -} - -/** - * Creates a function which is a composition of the passed asynchronous - * functions. Each function consumes the return value of the function that - * follows. Composing functions `f()`, `g()`, and `h()` would produce the result - * of `f(g(h()))`, only this version uses callbacks to obtain the return values. - * - * If the last argument to the composed function is not a function, a promise - * is returned when you call it. - * - * Each function is executed with the `this` binding of the composed function. - * - * @name compose - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {...AsyncFunction} functions - the asynchronous functions to compose - * @returns {Function} an asynchronous function that is the composed - * asynchronous `functions` - * @example - * - * function add1(n, callback) { - * setTimeout(function () { - * callback(null, n + 1); - * }, 10); - * } - * - * function mul3(n, callback) { - * setTimeout(function () { - * callback(null, n * 3); - * }, 10); - * } - * - * var add1mul3 = async.compose(mul3, add1); - * add1mul3(4, function (err, result) { - * // result now equals 15 - * }); - */ -function compose(...args) { - return seq(...args.reverse()); -} - -/** - * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. - * - * @name mapLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function mapLimit (coll, limit, iteratee, callback) { - return _asyncMap(eachOfLimit(limit), coll, iteratee, callback) -} -var mapLimit$1 = awaitify(mapLimit, 4); - -/** - * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time. - * - * @name concatLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @alias flatMapLimit - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - */ -function concatLimit(coll, limit, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return mapLimit$1(coll, limit, (val, iterCb) => { - _iteratee(val, (err, ...args) => { - if (err) return iterCb(err); - return iterCb(err, args); - }); - }, (err, mapResults) => { - var result = []; - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - result = result.concat(...mapResults[i]); - } - } - - return callback(err, result); - }); -} -var concatLimit$1 = awaitify(concatLimit, 4); - -/** - * Applies `iteratee` to each item in `coll`, concatenating the results. Returns - * the concatenated list. The `iteratee`s are called in parallel, and the - * results are concatenated as they return. The results array will be returned in - * the original order of `coll` passed to the `iteratee` function. - * - * @name concat - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @alias flatMap - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - * @example - * - * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) { - * // files is now a list of filenames that exist in the 3 directories - * }); - */ -function concat(coll, iteratee, callback) { - return concatLimit$1(coll, Infinity, iteratee, callback) -} -var concat$1 = awaitify(concat, 3); - -/** - * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. - * - * @name concatSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @alias flatMapSeries - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. - * The iteratee should complete with an array an array of results. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - */ -function concatSeries(coll, iteratee, callback) { - return concatLimit$1(coll, 1, iteratee, callback) -} -var concatSeries$1 = awaitify(concatSeries, 3); - -/** - * Returns a function that when called, calls-back with the values provided. - * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to - * [`auto`]{@link module:ControlFlow.auto}. - * - * @name constant - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {...*} arguments... - Any number of arguments to automatically invoke - * callback with. - * @returns {AsyncFunction} Returns a function that when invoked, automatically - * invokes the callback with the previous given arguments. - * @example - * - * async.waterfall([ - * async.constant(42), - * function (value, next) { - * // value === 42 - * }, - * //... - * ], callback); - * - * async.waterfall([ - * async.constant(filename, "utf8"), - * fs.readFile, - * function (fileData, next) { - * //... - * } - * //... - * ], callback); - * - * async.auto({ - * hostname: async.constant("https://server.net/"), - * port: findFreePort, - * launchServer: ["hostname", "port", function (options, cb) { - * startServer(options, cb); - * }], - * //... - * }, callback); - */ -function constant(...args) { - return function (...ignoredArgs/*, callback*/) { - var callback = ignoredArgs.pop(); - return callback(null, ...args); - }; -} - -function _createTester(check, getResult) { - return (eachfn, arr, _iteratee, cb) => { - var testPassed = false; - var testResult; - const iteratee = wrapAsync(_iteratee); - eachfn(arr, (value, _, callback) => { - iteratee(value, (err, result) => { - if (err || err === false) return callback(err); - - if (check(result) && !testResult) { - testPassed = true; - testResult = getResult(true, value); - return callback(null, breakLoop); - } - callback(); - }); - }, err => { - if (err) return cb(err); - cb(null, testPassed ? testResult : getResult(false)); - }); - }; -} - -/** - * Returns the first value in `coll` that passes an async truth test. The - * `iteratee` is applied in parallel, meaning the first iteratee to return - * `true` will fire the detect `callback` with that result. That means the - * result might not be the first item in the original `coll` (in terms of order) - * that passes the test. - - * If order within the original `coll` is important, then look at - * [`detectSeries`]{@link module:Collections.detectSeries}. - * - * @name detect - * @static - * @memberOf module:Collections - * @method - * @alias find - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns A Promise, if no callback is passed - * @example - * - * async.detect(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // result now equals the first file in the list that exists - * }); - */ -function detect(coll, iteratee, callback) { - return _createTester(bool => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback) -} -var detect$1 = awaitify(detect, 3); - -/** - * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a - * time. - * - * @name detectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findLimit - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ -function detectLimit(coll, limit, iteratee, callback) { - return _createTester(bool => bool, (res, item) => item)(eachOfLimit(limit), coll, iteratee, callback) -} -var detectLimit$1 = awaitify(detectLimit, 4); - -/** - * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. - * - * @name detectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findSeries - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ -function detectSeries(coll, iteratee, callback) { - return _createTester(bool => bool, (res, item) => item)(eachOfLimit(1), coll, iteratee, callback) -} - -var detectSeries$1 = awaitify(detectSeries, 3); - -function consoleFunc(name) { - return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => { - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } else if (console[name]) { - resultArgs.forEach(x => console[name](x)); - } - } - }) -} - -/** - * Logs the result of an [`async` function]{@link AsyncFunction} to the - * `console` using `console.dir` to display the properties of the resulting object. - * Only works in Node.js or in browsers that support `console.dir` and - * `console.error` (such as FF and Chrome). - * If multiple arguments are returned from the async function, - * `console.dir` is called on each argument in order. - * - * @name dir - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. - * @example - * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, {hello: name}); - * }, 1000); - * }; - * - * // in the node repl - * node> async.dir(hello, 'world'); - * {hello: 'world'} - */ -var dir = consoleFunc('dir'); - -/** - * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in - * the order of operations, the arguments `test` and `iteratee` are switched. - * - * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - * - * @name doWhilst - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - A function which is called each time `test` - * passes. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform after each - * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `iteratee`. - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. - * `callback` will be passed an error and any arguments passed to the final - * `iteratee`'s callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - */ -function doWhilst(iteratee, test, callback) { - callback = onlyOnce(callback); - var _fn = wrapAsync(iteratee); - var _test = wrapAsync(test); - var results; - - function next(err, ...args) { - if (err) return callback(err); - if (err === false) return; - results = args; - _test(...args, check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return check(null, true); -} - -var doWhilst$1 = awaitify(doWhilst, 3); - -/** - * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the - * argument ordering differs from `until`. - * - * @name doUntil - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.doWhilst]{@link module:ControlFlow.doWhilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` fails. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform after each - * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `iteratee` - * @param {Function} [callback] - A callback which is called after the test - * function has passed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - */ -function doUntil(iteratee, test, callback) { - const _test = wrapAsync(test); - return doWhilst$1(iteratee, (...args) => { - const cb = args.pop(); - _test(...args, (err, truth) => cb (err, !truth)); - }, callback); -} - -function _withoutIndex(iteratee) { - return (value, index, callback) => iteratee(value, callback); -} - -/** - * Applies the function `iteratee` to each item in `coll`, in parallel. - * The `iteratee` is called with an item from the list, and a callback for when - * it has finished. If the `iteratee` passes an error to its `callback`, the - * main `callback` (for the `each` function) is immediately called with the - * error. - * - * Note, that since this function applies `iteratee` to each item in parallel, - * there is no guarantee that the iteratee functions will complete in order. - * - * @name each - * @static - * @memberOf module:Collections - * @method - * @alias forEach - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to - * each item in `coll`. Invoked with (item, callback). - * The array index is not passed to the iteratee. - * If you need the index, use `eachOf`. - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * // assuming openFiles is an array of file names and saveFile is a function - * // to save the modified contents of that file: - * - * async.each(openFiles, saveFile, function(err){ - * // if any of the saves produced an error, err would equal that error - * }); - * - * // assuming openFiles is an array of file names - * async.each(openFiles, function(file, callback) { - * - * // Perform operation on file here. - * console.log('Processing file ' + file); - * - * if( file.length > 32 ) { - * console.log('This file name is too long'); - * callback('File name too long'); - * } else { - * // Do work to process file here - * console.log('File processed'); - * callback(); - * } - * }, function(err) { - * // if any of the file processing produced an error, err would equal that error - * if( err ) { - * // One of the iterations produced an error. - * // All processing will now stop. - * console.log('A file failed to process'); - * } else { - * console.log('All files have been processed successfully'); - * } - * }); - */ -function eachLimit(coll, iteratee, callback) { - return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback); -} - -var each = awaitify(eachLimit, 3); - -/** - * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. - * - * @name eachLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfLimit`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachLimit$1(coll, limit, iteratee, callback) { - return eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback); -} -var eachLimit$2 = awaitify(eachLimit$1, 4); - -/** - * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. - * - * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item - * in series and therefore the iteratee functions will complete in order. - - * @name eachSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfSeries`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachSeries(coll, iteratee, callback) { - return eachLimit$2(coll, 1, iteratee, callback) -} -var eachSeries$1 = awaitify(eachSeries, 3); - -/** - * Wrap an async function and ensure it calls its callback on a later tick of - * the event loop. If the function already calls its callback on a next tick, - * no extra deferral is added. This is useful for preventing stack overflows - * (`RangeError: Maximum call stack size exceeded`) and generally keeping - * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) - * contained. ES2017 `async` functions are returned as-is -- they are immune - * to Zalgo's corrupting influences, as they always resolve on a later tick. - * - * @name ensureAsync - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - an async function, one that expects a node-style - * callback as its last argument. - * @returns {AsyncFunction} Returns a wrapped function with the exact same call - * signature as the function passed in. - * @example - * - * function sometimesAsync(arg, callback) { - * if (cache[arg]) { - * return callback(null, cache[arg]); // this would be synchronous!! - * } else { - * doSomeIO(arg, callback); // this IO would be asynchronous - * } - * } - * - * // this has a risk of stack overflows if many results are cached in a row - * async.mapSeries(args, sometimesAsync, done); - * - * // this will defer sometimesAsync's callback if necessary, - * // preventing stack overflows - * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); - */ -function ensureAsync(fn) { - if (isAsync(fn)) return fn; - return function (...args/*, callback*/) { - var callback = args.pop(); - var sync = true; - args.push((...innerArgs) => { - if (sync) { - setImmediate$1(() => callback(...innerArgs)); - } else { - callback(...innerArgs); - } - }); - fn.apply(this, args); - sync = false; - }; -} - -/** - * Returns `true` if every element in `coll` satisfies an async test. If any - * iteratee call returns `false`, the main `callback` is immediately called. - * - * @name every - * @static - * @memberOf module:Collections - * @method - * @alias all - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.every(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then every file exists - * }); - */ -function every(coll, iteratee, callback) { - return _createTester(bool => !bool, res => !res)(eachOf$1, coll, iteratee, callback) -} -var every$1 = awaitify(every, 3); - -/** - * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. - * - * @name everyLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function everyLimit(coll, limit, iteratee, callback) { - return _createTester(bool => !bool, res => !res)(eachOfLimit(limit), coll, iteratee, callback) -} -var everyLimit$1 = awaitify(everyLimit, 4); - -/** - * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. - * - * @name everySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in series. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function everySeries(coll, iteratee, callback) { - return _createTester(bool => !bool, res => !res)(eachOfSeries$1, coll, iteratee, callback) -} -var everySeries$1 = awaitify(everySeries, 3); - -function filterArray(eachfn, arr, iteratee, callback) { - var truthValues = new Array(arr.length); - eachfn(arr, (x, index, iterCb) => { - iteratee(x, (err, v) => { - truthValues[index] = !!v; - iterCb(err); - }); - }, err => { - if (err) return callback(err); - var results = []; - for (var i = 0; i < arr.length; i++) { - if (truthValues[i]) results.push(arr[i]); - } - callback(null, results); - }); -} - -function filterGeneric(eachfn, coll, iteratee, callback) { - var results = []; - eachfn(coll, (x, index, iterCb) => { - iteratee(x, (err, v) => { - if (err) return iterCb(err); - if (v) { - results.push({index, value: x}); - } - iterCb(err); - }); - }, err => { - if (err) return callback(err); - callback(null, results - .sort((a, b) => a.index - b.index) - .map(v => v.value)); - }); -} - -function _filter(eachfn, coll, iteratee, callback) { - var filter = isArrayLike(coll) ? filterArray : filterGeneric; - return filter(eachfn, coll, wrapAsync(iteratee), callback); -} - -/** - * Returns a new array of all the values in `coll` which pass an async truth - * test. This operation is performed in parallel, but the results array will be - * in the same order as the original. - * - * @name filter - * @static - * @memberOf module:Collections - * @method - * @alias select - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.filter(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of the existing files - * }); - */ -function filter (coll, iteratee, callback) { - return _filter(eachOf$1, coll, iteratee, callback) -} -var filter$1 = awaitify(filter, 3); - -/** - * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a - * time. - * - * @name filterLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - */ -function filterLimit (coll, limit, iteratee, callback) { - return _filter(eachOfLimit(limit), coll, iteratee, callback) -} -var filterLimit$1 = awaitify(filterLimit, 4); - -/** - * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. - * - * @name filterSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results) - * @returns {Promise} a promise, if no callback provided - */ -function filterSeries (coll, iteratee, callback) { - return _filter(eachOfSeries$1, coll, iteratee, callback) -} -var filterSeries$1 = awaitify(filterSeries, 3); - -/** - * Calls the asynchronous function `fn` with a callback parameter that allows it - * to call itself again, in series, indefinitely. - - * If an error is passed to the callback then `errback` is called with the - * error, and execution stops, otherwise it will never be called. - * - * @name forever - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} fn - an async function to call repeatedly. - * Invoked with (next). - * @param {Function} [errback] - when `fn` passes an error to it's callback, - * this function will be called, and execution stops. Invoked with (err). - * @returns {Promise} a promise that rejects if an error occurs and an errback - * is not passed - * @example - * - * async.forever( - * function(next) { - * // next is suitable for passing to things that need a callback(err [, whatever]); - * // it will result in this function being called again. - * }, - * function(err) { - * // if next is called with a value in its first parameter, it will appear - * // in here as 'err', and execution will stop. - * } - * ); - */ -function forever(fn, errback) { - var done = onlyOnce(errback); - var task = wrapAsync(ensureAsync(fn)); - - function next(err) { - if (err) return done(err); - if (err === false) return; - task(next); - } - return next(); -} -var forever$1 = awaitify(forever, 2); - -/** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. - * - * @name groupByLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - */ -function groupByLimit(coll, limit, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return mapLimit$1(coll, limit, (val, iterCb) => { - _iteratee(val, (err, key) => { - if (err) return iterCb(err); - return iterCb(err, {key, val}); - }); - }, (err, mapResults) => { - var result = {}; - // from MDN, handle object having an `hasOwnProperty` prop - var {hasOwnProperty} = Object.prototype; - - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - var {key} = mapResults[i]; - var {val} = mapResults[i]; - - if (hasOwnProperty.call(result, key)) { - result[key].push(val); - } else { - result[key] = [val]; - } - } - } - - return callback(err, result); - }); -} - -var groupByLimit$1 = awaitify(groupByLimit, 4); - -/** - * Returns a new object, where each value corresponds to an array of items, from - * `coll`, that returned the corresponding key. That is, the keys of the object - * correspond to the values passed to the `iteratee` callback. - * - * Note: Since this function applies the `iteratee` to each item in parallel, - * there is no guarantee that the `iteratee` functions will complete in order. - * However, the values for each key in the `result` will be in the same order as - * the original `coll`. For Objects, the values will roughly be in the order of - * the original Objects' keys (but this can vary across JavaScript engines). - * - * @name groupBy - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { - * db.findById(userId, function(err, user) { - * if (err) return callback(err); - * return callback(null, user.age); - * }); - * }, function(err, result) { - * // result is object containing the userIds grouped by age - * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; - * }); - */ -function groupBy (coll, iteratee, callback) { - return groupByLimit$1(coll, Infinity, iteratee, callback) -} - -/** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. - * - * @name groupBySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - */ -function groupBySeries (coll, iteratee, callback) { - return groupByLimit$1(coll, 1, iteratee, callback) -} - -/** - * Logs the result of an `async` function to the `console`. Only works in - * Node.js or in browsers that support `console.log` and `console.error` (such - * as FF and Chrome). If multiple arguments are returned from the async - * function, `console.log` is called on each argument in order. - * - * @name log - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. - * @example - * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, 'hello ' + name); - * }, 1000); - * }; - * - * // in the node repl - * node> async.log(hello, 'world'); - * 'hello world' - */ -var log = consoleFunc('log'); - -/** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a - * time. - * - * @name mapValuesLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - */ -function mapValuesLimit(obj, limit, iteratee, callback) { - callback = once(callback); - var newObj = {}; - var _iteratee = wrapAsync(iteratee); - return eachOfLimit(limit)(obj, (val, key, next) => { - _iteratee(val, key, (err, result) => { - if (err) return next(err); - newObj[key] = result; - next(err); - }); - }, err => callback(err, newObj)); -} - -var mapValuesLimit$1 = awaitify(mapValuesLimit, 4); - -/** - * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. - * - * Produces a new Object by mapping each value of `obj` through the `iteratee` - * function. The `iteratee` is called each `value` and `key` from `obj` and a - * callback for when it has finished processing. Each of these callbacks takes - * two arguments: an `error`, and the transformed item from `obj`. If `iteratee` - * passes an error to its callback, the main `callback` (for the `mapValues` - * function) is immediately called with the error. - * - * Note, the order of the keys in the result is not guaranteed. The keys will - * be roughly in the order they complete, (but this is very engine-specific) - * - * @name mapValues - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.mapValues({ - * f1: 'file1', - * f2: 'file2', - * f3: 'file3' - * }, function (file, key, callback) { - * fs.stat(file, callback); - * }, function(err, result) { - * // result is now a map of stats for each file, e.g. - * // { - * // f1: [stats for file1], - * // f2: [stats for file2], - * // f3: [stats for file3] - * // } - * }); - */ -function mapValues(obj, iteratee, callback) { - return mapValuesLimit$1(obj, Infinity, iteratee, callback) -} - -/** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. - * - * @name mapValuesSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - */ -function mapValuesSeries(obj, iteratee, callback) { - return mapValuesLimit$1(obj, 1, iteratee, callback) -} - -/** - * Caches the results of an async function. When creating a hash to store - * function results against, the callback is omitted from the hash and an - * optional hash function can be used. - * - * **Note: if the async function errs, the result will not be cached and - * subsequent calls will call the wrapped function.** - * - * If no hash function is specified, the first argument is used as a hash key, - * which may work reasonably if it is a string or a data type that converts to a - * distinct string. Note that objects and arrays will not behave reasonably. - * Neither will cases where the other arguments are significant. In such cases, - * specify your own hash function. - * - * The cache of results is exposed as the `memo` property of the function - * returned by `memoize`. - * - * @name memoize - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - The async function to proxy and cache results from. - * @param {Function} hasher - An optional function for generating a custom hash - * for storing results. It has all the arguments applied to it apart from the - * callback, and must be synchronous. - * @returns {AsyncFunction} a memoized version of `fn` - * @example - * - * var slow_fn = function(name, callback) { - * // do something - * callback(null, result); - * }; - * var fn = async.memoize(slow_fn); - * - * // fn can now be used as if it were slow_fn - * fn('some name', function() { - * // callback - * }); - */ -function memoize(fn, hasher = v => v) { - var memo = Object.create(null); - var queues = Object.create(null); - var _fn = wrapAsync(fn); - var memoized = initialParams((args, callback) => { - var key = hasher(...args); - if (key in memo) { - setImmediate$1(() => callback(null, ...memo[key])); - } else if (key in queues) { - queues[key].push(callback); - } else { - queues[key] = [callback]; - _fn(...args, (err, ...resultArgs) => { - // #1465 don't memoize if an error occurred - if (!err) { - memo[key] = resultArgs; - } - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i](err, ...resultArgs); - } - }); - } - }); - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; -} - -/** - * Calls `callback` on a later loop around the event loop. In Node.js this just - * calls `process.nextTick`. In the browser it will use `setImmediate` if - * available, otherwise `setTimeout(callback, 0)`, which means other higher - * priority events may precede the execution of `callback`. - * - * This is used internally for browser-compatibility purposes. - * - * @name nextTick - * @static - * @memberOf module:Utils - * @method - * @see [async.setImmediate]{@link module:Utils.setImmediate} - * @category Util - * @param {Function} callback - The function to call on a later loop around - * the event loop. Invoked with (args...). - * @param {...*} args... - any number of additional arguments to pass to the - * callback on the next tick. - * @example - * - * var call_order = []; - * async.nextTick(function() { - * call_order.push('two'); - * // call_order now equals ['one','two'] - * }); - * call_order.push('one'); - * - * async.setImmediate(function (a, b, c) { - * // a, b, and c equal 1, 2, and 3 - * }, 1, 2, 3); - */ -var _defer$1; - -if (hasNextTick) { - _defer$1 = process.nextTick; -} else if (hasSetImmediate) { - _defer$1 = setImmediate; -} else { - _defer$1 = fallback; -} - -var nextTick = wrap(_defer$1); - -var _parallel = awaitify((eachfn, tasks, callback) => { - var results = isArrayLike(tasks) ? [] : {}; - - eachfn(tasks, (task, key, taskCb) => { - wrapAsync(task)((err, ...result) => { - if (result.length < 2) { - [result] = result; - } - results[key] = result; - taskCb(err); - }); - }, err => callback(err, results)); -}, 3); - -/** - * Run the `tasks` collection of functions in parallel, without waiting until - * the previous function has completed. If any of the functions pass an error to - * its callback, the main `callback` is immediately called with the value of the - * error. Once the `tasks` have completed, the results are passed to the final - * `callback` as an array. - * - * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about - * parallel execution of code. If your tasks do not use any timers or perform - * any I/O, they will actually be executed in series. Any synchronous setup - * sections for each task will happen one after the other. JavaScript remains - * single-threaded. - * - * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the - * execution of other tasks when a task fails. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.parallel}. - * - * @name parallel - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - * - * @example - * async.parallel([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // optional callback - * function(err, results) { - * // the results array will equal ['one','two'] even though - * // the second function had a shorter timeout. - * }); - * - * // an example using an object instead of an array - * async.parallel({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback) { - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equals to: {one: 1, two: 2} - * }); - */ -function parallel(tasks, callback) { - return _parallel(eachOf$1, tasks, callback); -} - -/** - * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a - * time. - * - * @name parallelLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.parallel]{@link module:ControlFlow.parallel} - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - */ -function parallelLimit(tasks, limit, callback) { - return _parallel(eachOfLimit(limit), tasks, callback); -} - -/** - * A queue of tasks for the worker function to complete. - * @typedef {Iterable} QueueObject - * @memberOf module:ControlFlow - * @property {Function} length - a function returning the number of items - * waiting to be processed. Invoke with `queue.length()`. - * @property {boolean} started - a boolean indicating whether or not any - * items have been pushed and processed by the queue. - * @property {Function} running - a function returning the number of items - * currently being processed. Invoke with `queue.running()`. - * @property {Function} workersList - a function returning the array of items - * currently being processed. Invoke with `queue.workersList()`. - * @property {Function} idle - a function returning false if there are items - * waiting or being processed, or true if not. Invoke with `queue.idle()`. - * @property {number} concurrency - an integer for determining how many `worker` - * functions should be run in parallel. This property can be changed after a - * `queue` is created to alter the concurrency on-the-fly. - * @property {number} payload - an integer that specifies how many items are - * passed to the worker function at a time. only applies if this is a - * [cargo]{@link module:ControlFlow.cargo} object - * @property {AsyncFunction} push - add a new task to the `queue`. Calls `callback` - * once the `worker` has finished processing the task. Instead of a single task, - * a `tasks` array can be submitted. The respective callback is used for every - * task in the list. Invoke with `queue.push(task, [callback])`, - * @property {AsyncFunction} unshift - add a new task to the front of the `queue`. - * Invoke with `queue.unshift(task, [callback])`. - * @property {AsyncFunction} pushAsync - the same as `q.push`, except this returns - * a promise that rejects if an error occurs. - * @property {AsyncFunction} unshirtAsync - the same as `q.unshift`, except this returns - * a promise that rejects if an error occurs. - * @property {Function} remove - remove items from the queue that match a test - * function. The test function will be passed an object with a `data` property, - * and a `priority` property, if this is a - * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. - * Invoked with `queue.remove(testFn)`, where `testFn` is of the form - * `function ({data, priority}) {}` and returns a Boolean. - * @property {Function} saturated - a function that sets a callback that is - * called when the number of running workers hits the `concurrency` limit, and - * further tasks will be queued. If the callback is omitted, `q.saturated()` - * returns a promise for the next occurrence. - * @property {Function} unsaturated - a function that sets a callback that is - * called when the number of running workers is less than the `concurrency` & - * `buffer` limits, and further tasks will not be queued. If the callback is - * omitted, `q.unsaturated()` returns a promise for the next occurrence. - * @property {number} buffer - A minimum threshold buffer in order to say that - * the `queue` is `unsaturated`. - * @property {Function} empty - a function that sets a callback that is called - * when the last item from the `queue` is given to a `worker`. If the callback - * is omitted, `q.empty()` returns a promise for the next occurrence. - * @property {Function} drain - a function that sets a callback that is called - * when the last item from the `queue` has returned from the `worker`. If the - * callback is omitted, `q.drain()` returns a promise for the next occurrence. - * @property {Function} error - a function that sets a callback that is called - * when a task errors. Has the signature `function(error, task)`. If the - * callback is omitted, `error()` returns a promise that rejects on the next - * error. - * @property {boolean} paused - a boolean for determining whether the queue is - * in a paused state. - * @property {Function} pause - a function that pauses the processing of tasks - * until `resume()` is called. Invoke with `queue.pause()`. - * @property {Function} resume - a function that resumes the processing of - * queued tasks when the queue is paused. Invoke with `queue.resume()`. - * @property {Function} kill - a function that removes the `drain` callback and - * empties remaining tasks from the queue forcing it to go idle. No more tasks - * should be pushed to the queue after calling this function. Invoke with `queue.kill()`. - * - * @example - * const q = aync.queue(worker, 2) - * q.push(item1) - * q.push(item2) - * q.push(item3) - * // queues are iterable, spread into an array to inspect - * const items = [...q] // [item1, item2, item3] - * // or use for of - * for (let item of q) { - * console.log(item) - * } - * - * q.drain(() => { - * console.log('all done') - * }) - * // or - * await q.drain() - */ - -/** - * Creates a `queue` object with the specified `concurrency`. Tasks added to the - * `queue` are processed in parallel (up to the `concurrency` limit). If all - * `worker`s are in progress, the task is queued until one becomes available. - * Once a `worker` completes a `task`, that `task`'s callback is called. - * - * @name queue - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. Invoked with (task, callback). - * @param {number} [concurrency=1] - An `integer` for determining how many - * `worker` functions should be run in parallel. If omitted, the concurrency - * defaults to `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can be - * attached as certain properties to listen for specific events during the - * lifecycle of the queue. - * @example - * - * // create a queue object with concurrency 2 - * var q = async.queue(function(task, callback) { - * console.log('hello ' + task.name); - * callback(); - * }, 2); - * - * // assign a callback - * q.drain(function() { - * console.log('all items have been processed'); - * }); - * // or await the end - * await q.drain() - * - * // assign an error callback - * q.error(function(err, task) { - * console.error('task experienced an error'); - * }); - * - * // add some items to the queue - * q.push({name: 'foo'}, function(err) { - * console.log('finished processing foo'); - * }); - * // callback is optional - * q.push({name: 'bar'}); - * - * // add some items to the queue (batch-wise) - * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { - * console.log('finished processing item'); - * }); - * - * // add some items to the front of the queue - * q.unshift({name: 'bar'}, function (err) { - * console.log('finished processing bar'); - * }); - */ -function queue$1 (worker, concurrency) { - var _worker = wrapAsync(worker); - return queue((items, cb) => { - _worker(items[0], cb); - }, concurrency, 1); -} - -// Binary min-heap implementation used for priority queue. -// Implementation is stable, i.e. push time is considered for equal priorities -class Heap { - constructor() { - this.heap = []; - this.pushCount = Number.MIN_SAFE_INTEGER; - } - - get length() { - return this.heap.length; - } - - empty () { - this.heap = []; - return this; - } - - percUp(index) { - let p; - - while (index > 0 && smaller(this.heap[index], this.heap[p=parent(index)])) { - let t = this.heap[index]; - this.heap[index] = this.heap[p]; - this.heap[p] = t; - - index = p; - } - } - - percDown(index) { - let l; - - while ((l=leftChi(index)) < this.heap.length) { - if (l+1 < this.heap.length && smaller(this.heap[l+1], this.heap[l])) { - l = l+1; - } - - if (smaller(this.heap[index], this.heap[l])) { - break; - } - - let t = this.heap[index]; - this.heap[index] = this.heap[l]; - this.heap[l] = t; - - index = l; - } - } - - push(node) { - node.pushCount = ++this.pushCount; - this.heap.push(node); - this.percUp(this.heap.length-1); - } - - unshift(node) { - return this.heap.push(node); - } - - shift() { - let [top] = this.heap; - - this.heap[0] = this.heap[this.heap.length-1]; - this.heap.pop(); - this.percDown(0); - - return top; - } - - toArray() { - return [...this]; - } - - *[Symbol.iterator] () { - for (let i = 0; i < this.heap.length; i++) { - yield this.heap[i].data; - } - } - - remove (testFn) { - let j = 0; - for (let i = 0; i < this.heap.length; i++) { - if (!testFn(this.heap[i])) { - this.heap[j] = this.heap[i]; - j++; - } - } - - this.heap.splice(j); - - for (let i = parent(this.heap.length-1); i >= 0; i--) { - this.percDown(i); - } - - return this; - } -} - -function leftChi(i) { - return (i<<1)+1; -} - -function parent(i) { - return ((i+1)>>1)-1; -} - -function smaller(x, y) { - if (x.priority !== y.priority) { - return x.priority < y.priority; - } - else { - return x.pushCount < y.pushCount; - } -} - -/** - * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and - * completed in ascending priority order. - * - * @name priorityQueue - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. - * Invoked with (task, callback). - * @param {number} concurrency - An `integer` for determining how many `worker` - * functions should be run in parallel. If omitted, the concurrency defaults to - * `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two - * differences between `queue` and `priorityQueue` objects: - * * `push(task, priority, [callback])` - `priority` should be a number. If an - * array of `tasks` is given, all tasks will be assigned the same priority. - * * The `unshift` method was removed. - */ -function priorityQueue(worker, concurrency) { - // Start with a normal queue - var q = queue$1(worker, concurrency); - - q._tasks = new Heap(); - - // Override push to accept second parameter representing priority - q.push = function(data, priority = 0, callback = () => {}) { - if (typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - if (!Array.isArray(data)) { - data = [data]; - } - if (data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - return setImmediate$1(() => q.drain()); - } - - for (var i = 0, l = data.length; i < l; i++) { - var item = { - data: data[i], - priority, - callback - }; - - q._tasks.push(item); - } - - setImmediate$1(q.process); - }; - - // Remove unshift function - delete q.unshift; - - return q; -} - -/** - * Runs the `tasks` array of functions in parallel, without waiting until the - * previous function has completed. Once any of the `tasks` complete or pass an - * error to its callback, the main `callback` is immediately called. It's - * equivalent to `Promise.race()`. - * - * @name race - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction} - * to run. Each function can complete with an optional `result` value. - * @param {Function} callback - A callback to run once any of the functions have - * completed. This function gets an error or result from the first function that - * completed. Invoked with (err, result). - * @returns undefined - * @example - * - * async.race([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // main callback - * function(err, result) { - * // the result will be equal to 'two' as it finishes earlier - * }); - */ -function race(tasks, callback) { - callback = once(callback); - if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); - if (!tasks.length) return callback(); - for (var i = 0, l = tasks.length; i < l; i++) { - wrapAsync(tasks[i])(callback); - } -} - -var race$1 = awaitify(race, 2); - -/** - * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. - * - * @name reduceRight - * @static - * @memberOf module:Collections - * @method - * @see [async.reduce]{@link module:Collections.reduce} - * @alias foldr - * @category Collection - * @param {Array} array - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @returns {Promise} a promise, if no callback is passed - */ -function reduceRight (array, memo, iteratee, callback) { - var reversed = [...array].reverse(); - return reduce$1(reversed, memo, iteratee, callback); -} - -/** - * Wraps the async function in another function that always completes with a - * result object, even when it errors. - * - * The result object has either the property `error` or `value`. - * - * @name reflect - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - The async function you want to wrap - * @returns {Function} - A function that always passes null to it's callback as - * the error. The second argument to the callback will be an `object` with - * either an `error` or a `value` property. - * @example - * - * async.parallel([ - * async.reflect(function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }), - * async.reflect(function(callback) { - * // do some more stuff but error ... - * callback('bad stuff happened'); - * }), - * async.reflect(function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * }) - * ], - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = 'bad stuff happened' - * // results[2].value = 'two' - * }); - */ -function reflect(fn) { - var _fn = wrapAsync(fn); - return initialParams(function reflectOn(args, reflectCallback) { - args.push((error, ...cbArgs) => { - let retVal = {}; - if (error) { - retVal.error = error; - } - if (cbArgs.length > 0){ - var value = cbArgs; - if (cbArgs.length <= 1) { - [value] = cbArgs; - } - retVal.value = value; - } - reflectCallback(null, retVal); - }); - - return _fn.apply(this, args); - }); -} - -/** - * A helper function that wraps an array or an object of functions with `reflect`. - * - * @name reflectAll - * @static - * @memberOf module:Utils - * @method - * @see [async.reflect]{@link module:Utils.reflect} - * @category Util - * @param {Array|Object|Iterable} tasks - The collection of - * [async functions]{@link AsyncFunction} to wrap in `async.reflect`. - * @returns {Array} Returns an array of async functions, each wrapped in - * `async.reflect` - * @example - * - * let tasks = [ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * // do some more stuff but error ... - * callback(new Error('bad stuff happened')); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ]; - * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = Error('bad stuff happened') - * // results[2].value = 'two' - * }); - * - * // an example using an object instead of an array - * let tasks = { - * one: function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * two: function(callback) { - * callback('two'); - * }, - * three: function(callback) { - * setTimeout(function() { - * callback(null, 'three'); - * }, 100); - * } - * }; - * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results.one.value = 'one' - * // results.two.error = 'two' - * // results.three.value = 'three' - * }); - */ -function reflectAll(tasks) { - var results; - if (Array.isArray(tasks)) { - results = tasks.map(reflect); - } else { - results = {}; - Object.keys(tasks).forEach(key => { - results[key] = reflect.call(this, tasks[key]); - }); - } - return results; -} - -function reject(eachfn, arr, _iteratee, callback) { - const iteratee = wrapAsync(_iteratee); - return _filter(eachfn, arr, (value, cb) => { - iteratee(value, (err, v) => { - cb(err, !v); - }); - }, callback); -} - -/** - * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. - * - * @name reject - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.reject(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of missing files - * createFiles(results); - * }); - */ -function reject$1 (coll, iteratee, callback) { - return reject(eachOf$1, coll, iteratee, callback) -} -var reject$2 = awaitify(reject$1, 3); - -/** - * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a - * time. - * - * @name rejectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.reject]{@link module:Collections.reject} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function rejectLimit (coll, limit, iteratee, callback) { - return reject(eachOfLimit(limit), coll, iteratee, callback) -} -var rejectLimit$1 = awaitify(rejectLimit, 4); - -/** - * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. - * - * @name rejectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.reject]{@link module:Collections.reject} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function rejectSeries (coll, iteratee, callback) { - return reject(eachOfSeries$1, coll, iteratee, callback) -} -var rejectSeries$1 = awaitify(rejectSeries, 3); - -function constant$1(value) { - return function () { - return value; - } -} - -/** - * Attempts to get a successful response from `task` no more than `times` times - * before returning an error. If the task is successful, the `callback` will be - * passed the result of the successful task. If all attempts fail, the callback - * will be passed the error and result (if any) of the final attempt. - * - * @name retry - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @see [async.retryable]{@link module:ControlFlow.retryable} - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an - * object with `times` and `interval` or a number. - * * `times` - The number of attempts to make before giving up. The default - * is `5`. - * * `interval` - The time to wait between retries, in milliseconds. The - * default is `0`. The interval may also be specified as a function of the - * retry count (see example). - * * `errorFilter` - An optional synchronous function that is invoked on - * erroneous result. If it returns `true` the retry attempts will continue; - * if the function returns `false` the retry flow is aborted with the current - * attempt's error and result being returned to the final callback. - * Invoked with (err). - * * If `opts` is a number, the number specifies the number of times to retry, - * with the default interval of `0`. - * @param {AsyncFunction} task - An async function to retry. - * Invoked with (callback). - * @param {Function} [callback] - An optional callback which is called when the - * task has succeeded, or after the final failed attempt. It receives the `err` - * and `result` arguments of the last attempt at completing the `task`. Invoked - * with (err, results). - * @returns {Promise} a promise if no callback provided - * - * @example - * - * // The `retry` function can be used as a stand-alone control flow by passing - * // a callback, as shown below: - * - * // try calling apiMethod 3 times - * async.retry(3, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod 3 times, waiting 200 ms between each retry - * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod 10 times with exponential backoff - * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) - * async.retry({ - * times: 10, - * interval: function(retryCount) { - * return 50 * Math.pow(2, retryCount); - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod the default 5 times no delay between each retry - * async.retry(apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod only when error condition satisfies, all other - * // errors will abort the retry control flow and return to final callback - * async.retry({ - * errorFilter: function(err) { - * return err.message === 'Temporary error'; // only retry on a specific error - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // to retry individual methods that are not as reliable within other - * // control flow functions, use the `retryable` wrapper: - * async.auto({ - * users: api.getUsers.bind(api), - * payments: async.retryable(3, api.getPayments.bind(api)) - * }, function(err, results) { - * // do something with the results - * }); - * - */ -const DEFAULT_TIMES = 5; -const DEFAULT_INTERVAL = 0; - -function retry(opts, task, callback) { - var options = { - times: DEFAULT_TIMES, - intervalFunc: constant$1(DEFAULT_INTERVAL) - }; - - if (arguments.length < 3 && typeof opts === 'function') { - callback = task || promiseCallback(); - task = opts; - } else { - parseTimes(options, opts); - callback = callback || promiseCallback(); - } - - if (typeof task !== 'function') { - throw new Error("Invalid arguments for async.retry"); - } - - var _task = wrapAsync(task); - - var attempt = 1; - function retryAttempt() { - _task((err, ...args) => { - if (err === false) return - if (err && attempt++ < options.times && - (typeof options.errorFilter != 'function' || - options.errorFilter(err))) { - setTimeout(retryAttempt, options.intervalFunc(attempt - 1)); - } else { - callback(err, ...args); - } - }); - } - - retryAttempt(); - return callback[PROMISE_SYMBOL] -} - -function parseTimes(acc, t) { - if (typeof t === 'object') { - acc.times = +t.times || DEFAULT_TIMES; - - acc.intervalFunc = typeof t.interval === 'function' ? - t.interval : - constant$1(+t.interval || DEFAULT_INTERVAL); - - acc.errorFilter = t.errorFilter; - } else if (typeof t === 'number' || typeof t === 'string') { - acc.times = +t || DEFAULT_TIMES; - } else { - throw new Error("Invalid arguments for async.retry"); - } -} - -/** - * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method - * wraps a task and makes it retryable, rather than immediately calling it - * with retries. - * - * @name retryable - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.retry]{@link module:ControlFlow.retry} - * @category Control Flow - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional - * options, exactly the same as from `retry`, except for a `opts.arity` that - * is the arity of the `task` function, defaulting to `task.length` - * @param {AsyncFunction} task - the asynchronous function to wrap. - * This function will be passed any arguments passed to the returned wrapper. - * Invoked with (...args, callback). - * @returns {AsyncFunction} The wrapped function, which when invoked, will - * retry on an error, based on the parameters specified in `opts`. - * This function will accept the same parameters as `task`. - * @example - * - * async.auto({ - * dep1: async.retryable(3, getFromFlakyService), - * process: ["dep1", async.retryable(3, function (results, cb) { - * maybeProcessData(results.dep1, cb); - * })] - * }, callback); - */ -function retryable (opts, task) { - if (!task) { - task = opts; - opts = null; - } - let arity = (opts && opts.arity) || task.length; - if (isAsync(task)) { - arity += 1; - } - var _task = wrapAsync(task); - return initialParams((args, callback) => { - if (args.length < arity - 1 || callback == null) { - args.push(callback); - callback = promiseCallback(); - } - function taskFn(cb) { - _task(...args, cb); - } - - if (opts) retry(opts, taskFn, callback); - else retry(taskFn, callback); - - return callback[PROMISE_SYMBOL] - }); -} - -/** - * Run the functions in the `tasks` collection in series, each one running once - * the previous function has completed. If any functions in the series pass an - * error to its callback, no more functions are run, and `callback` is - * immediately called with the value of the error. Otherwise, `callback` - * receives an array of results when `tasks` have completed. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function, and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.series}. - * - * **Note** that while many implementations preserve the order of object - * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) - * explicitly states that - * - * > The mechanics and order of enumerating the properties is not specified. - * - * So if you rely on the order in which your series of functions are executed, - * and want this to work on all platforms, consider using an array. - * - * @name series - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing - * [async functions]{@link AsyncFunction} to run in series. - * Each function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed. This function gets a results array (or object) - * containing all the result arguments passed to the `task` callbacks. Invoked - * with (err, result). - * @return {Promise} a promise, if no callback is passed - * @example - * async.series([ - * function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }, - * function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * } - * ], - * // optional callback - * function(err, results) { - * // results is now equal to ['one', 'two'] - * }); - * - * async.series({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback){ - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equal to: {one: 1, two: 2} - * }); - */ -function series(tasks, callback) { - return _parallel(eachOfSeries$1, tasks, callback); -} - -/** - * Returns `true` if at least one element in the `coll` satisfies an async test. - * If any iteratee call returns `true`, the main `callback` is immediately - * called. - * - * @name some - * @static - * @memberOf module:Collections - * @method - * @alias any - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.some(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then at least one of the files exists - * }); - */ -function some(coll, iteratee, callback) { - return _createTester(Boolean, res => res)(eachOf$1, coll, iteratee, callback) -} -var some$1 = awaitify(some, 3); - -/** - * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. - * - * @name someLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anyLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function someLimit(coll, limit, iteratee, callback) { - return _createTester(Boolean, res => res)(eachOfLimit(limit), coll, iteratee, callback) -} -var someLimit$1 = awaitify(someLimit, 4); - -/** - * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. - * - * @name someSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anySeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in series. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function someSeries(coll, iteratee, callback) { - return _createTester(Boolean, res => res)(eachOfSeries$1, coll, iteratee, callback) -} -var someSeries$1 = awaitify(someSeries, 3); - -/** - * Sorts a list by the results of running each `coll` value through an async - * `iteratee`. - * - * @name sortBy - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a value to use as the sort criteria as - * its `result`. - * Invoked with (item, callback). - * @param {Function} callback - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is the items - * from the original `coll` sorted by the values returned by the `iteratee` - * calls. Invoked with (err, results). - * @returns {Promise} a promise, if no callback passed - * @example - * - * async.sortBy(['file1','file2','file3'], function(file, callback) { - * fs.stat(file, function(err, stats) { - * callback(err, stats.mtime); - * }); - * }, function(err, results) { - * // results is now the original array of files sorted by - * // modified date - * }); - * - * // By modifying the callback parameter the - * // sorting order can be influenced: - * - * // ascending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x); - * }, function(err,result) { - * // result callback - * }); - * - * // descending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x*-1); //<- x*-1 instead of x, turns the order around - * }, function(err,result) { - * // result callback - * }); - */ -function sortBy (coll, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return map$1(coll, (x, iterCb) => { - _iteratee(x, (err, criteria) => { - if (err) return iterCb(err); - iterCb(err, {value: x, criteria}); - }); - }, (err, results) => { - if (err) return callback(err); - callback(null, results.sort(comparator).map(v => v.value)); - }); - - function comparator(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } -} -var sortBy$1 = awaitify(sortBy, 3); - -/** - * Sets a time limit on an asynchronous function. If the function does not call - * its callback within the specified milliseconds, it will be called with a - * timeout error. The code property for the error object will be `'ETIMEDOUT'`. - * - * @name timeout - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} asyncFn - The async function to limit in time. - * @param {number} milliseconds - The specified time limit. - * @param {*} [info] - Any variable you want attached (`string`, `object`, etc) - * to timeout Error for more information.. - * @returns {AsyncFunction} Returns a wrapped function that can be used with any - * of the control flow functions. - * Invoke this function with the same parameters as you would `asyncFunc`. - * @example - * - * function myFunction(foo, callback) { - * doAsyncTask(foo, function(err, data) { - * // handle errors - * if (err) return callback(err); - * - * // do some stuff ... - * - * // return processed data - * return callback(null, data); - * }); - * } - * - * var wrapped = async.timeout(myFunction, 1000); - * - * // call `wrapped` as you would `myFunction` - * wrapped({ bar: 'bar' }, function(err, data) { - * // if `myFunction` takes < 1000 ms to execute, `err` - * // and `data` will have their expected values - * - * // else `err` will be an Error with the code 'ETIMEDOUT' - * }); - */ -function timeout(asyncFn, milliseconds, info) { - var fn = wrapAsync(asyncFn); - - return initialParams((args, callback) => { - var timedOut = false; - var timer; - - function timeoutCallback() { - var name = asyncFn.name || 'anonymous'; - var error = new Error('Callback function "' + name + '" timed out.'); - error.code = 'ETIMEDOUT'; - if (info) { - error.info = info; - } - timedOut = true; - callback(error); - } - - args.push((...cbArgs) => { - if (!timedOut) { - callback(...cbArgs); - clearTimeout(timer); - } - }); - - // setup timer and call original function - timer = setTimeout(timeoutCallback, milliseconds); - fn(...args); - }); -} - -function range(size) { - var result = Array(size); - while (size--) { - result[size] = size; - } - return result; -} - -/** - * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a - * time. - * - * @name timesLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} count - The number of times to run the function. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see [async.map]{@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - */ -function timesLimit(count, limit, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - return mapLimit$1(range(count), limit, _iteratee, callback); -} - -/** - * Calls the `iteratee` function `n` times, and accumulates results in the same - * manner you would use with [map]{@link module:Collections.map}. - * - * @name times - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.map]{@link module:Collections.map} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - * @example - * - * // Pretend this is some complicated async factory - * var createUser = function(id, callback) { - * callback(null, { - * id: 'user' + id - * }); - * }; - * - * // generate 5 users - * async.times(5, function(n, next) { - * createUser(n, function(err, user) { - * next(err, user); - * }); - * }, function(err, users) { - * // we should now have 5 users - * }); - */ -function times (n, iteratee, callback) { - return timesLimit(n, Infinity, iteratee, callback) -} - -/** - * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. - * - * @name timesSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - */ -function timesSeries (n, iteratee, callback) { - return timesLimit(n, 1, iteratee, callback) -} - -/** - * A relative of `reduce`. Takes an Object or Array, and iterates over each - * element in parallel, each step potentially mutating an `accumulator` value. - * The type of the accumulator defaults to the type of collection passed in. - * - * @name transform - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {*} [accumulator] - The initial state of the transform. If omitted, - * it will default to an empty Object or Array, depending on the type of `coll` - * @param {AsyncFunction} iteratee - A function applied to each item in the - * collection that potentially modifies the accumulator. - * Invoked with (accumulator, item, key, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the transformed accumulator. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.transform([1,2,3], function(acc, item, index, callback) { - * // pointless async: - * process.nextTick(function() { - * acc[index] = item * 2 - * callback(null) - * }); - * }, function(err, result) { - * // result is now equal to [2, 4, 6] - * }); - * - * @example - * - * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { - * setImmediate(function () { - * obj[key] = val * 2; - * callback(); - * }) - * }, function (err, result) { - * // result is equal to {a: 2, b: 4, c: 6} - * }) - */ -function transform (coll, accumulator, iteratee, callback) { - if (arguments.length <= 3 && typeof accumulator === 'function') { - callback = iteratee; - iteratee = accumulator; - accumulator = Array.isArray(coll) ? [] : {}; - } - callback = once(callback || promiseCallback()); - var _iteratee = wrapAsync(iteratee); - - eachOf$1(coll, (v, k, cb) => { - _iteratee(accumulator, v, k, cb); - }, err => callback(err, accumulator)); - return callback[PROMISE_SYMBOL] -} - -/** - * It runs each task in series but stops whenever any of the functions were - * successful. If one of the tasks were successful, the `callback` will be - * passed the result of the successful task. If all tasks fail, the callback - * will be passed the error and result (if any) of the final attempt. - * - * @name tryEach - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to - * run, each function is passed a `callback(err, result)` it must call on - * completion with an error `err` (which can be `null`) and an optional `result` - * value. - * @param {Function} [callback] - An optional callback which is called when one - * of the tasks has succeeded, or all have failed. It receives the `err` and - * `result` arguments of the last attempt at completing the `task`. Invoked with - * (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * async.tryEach([ - * function getDataFromFirstWebsite(callback) { - * // Try getting the data from the first website - * callback(err, data); - * }, - * function getDataFromSecondWebsite(callback) { - * // First website failed, - * // Try getting the data from the backup website - * callback(err, data); - * } - * ], - * // optional callback - * function(err, results) { - * Now do something with the data. - * }); - * - */ -function tryEach(tasks, callback) { - var error = null; - var result; - return eachSeries$1(tasks, (task, taskCb) => { - wrapAsync(task)((err, ...args) => { - if (err === false) return taskCb(err); - - if (args.length < 2) { - [result] = args; - } else { - result = args; - } - error = err; - taskCb(err ? null : {}); - }); - }, () => callback(error, result)); -} - -var tryEach$1 = awaitify(tryEach); - -/** - * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original, - * unmemoized form. Handy for testing. - * - * @name unmemoize - * @static - * @memberOf module:Utils - * @method - * @see [async.memoize]{@link module:Utils.memoize} - * @category Util - * @param {AsyncFunction} fn - the memoized function - * @returns {AsyncFunction} a function that calls the original unmemoized function - */ -function unmemoize(fn) { - return (...args) => { - return (fn.unmemoized || fn)(...args); - }; -} - -/** - * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. - * - * @name whilst - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `iteratee`. Invoked with (). - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` passes. Invoked with (callback). - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - * @example - * - * var count = 0; - * async.whilst( - * function test(cb) { cb(null, count < 5); }, - * function iter(callback) { - * count++; - * setTimeout(function() { - * callback(null, count); - * }, 1000); - * }, - * function (err, n) { - * // 5 seconds have passed, n = 5 - * } - * ); - */ -function whilst(test, iteratee, callback) { - callback = onlyOnce(callback); - var _fn = wrapAsync(iteratee); - var _test = wrapAsync(test); - var results = []; - - function next(err, ...rest) { - if (err) return callback(err); - results = rest; - if (err === false) return; - _test(check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return _test(check); -} -var whilst$1 = awaitify(whilst, 3); - -/** - * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. `callback` will be passed an error and any - * arguments passed to the final `iteratee`'s callback. - * - * The inverse of [whilst]{@link module:ControlFlow.whilst}. - * - * @name until - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `iteratee`. Invoked with (callback). - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` fails. Invoked with (callback). - * @param {Function} [callback] - A callback which is called after the test - * function has passed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if a callback is not passed - * - * @example - * const results = [] - * let finished = false - * async.until(function test(page, cb) { - * cb(null, finished) - * }, function iter(next) { - * fetchPage(url, (err, body) => { - * if (err) return next(err) - * results = results.concat(body.objects) - * finished = !!body.next - * next(err) - * }) - * }, function done (err) { - * // all pages have been fetched - * }) - */ -function until(test, iteratee, callback) { - const _test = wrapAsync(test); - return whilst$1((cb) => _test((err, truth) => cb (err, !truth)), iteratee, callback); -} - -/** - * Runs the `tasks` array of functions in series, each passing their results to - * the next in the array. However, if any of the `tasks` pass an error to their - * own callback, the next function is not executed, and the main `callback` is - * immediately called with the error. - * - * @name waterfall - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array} tasks - An array of [async functions]{@link AsyncFunction} - * to run. - * Each function should complete with any number of `result` values. - * The `result` values will be passed as arguments, in order, to the next task. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed. This will be passed the results of the last task's - * callback. Invoked with (err, [results]). - * @returns undefined - * @example - * - * async.waterfall([ - * function(callback) { - * callback(null, 'one', 'two'); - * }, - * function(arg1, arg2, callback) { - * // arg1 now equals 'one' and arg2 now equals 'two' - * callback(null, 'three'); - * }, - * function(arg1, callback) { - * // arg1 now equals 'three' - * callback(null, 'done'); - * } - * ], function (err, result) { - * // result now equals 'done' - * }); - * - * // Or, with named functions: - * async.waterfall([ - * myFirstFunction, - * mySecondFunction, - * myLastFunction, - * ], function (err, result) { - * // result now equals 'done' - * }); - * function myFirstFunction(callback) { - * callback(null, 'one', 'two'); - * } - * function mySecondFunction(arg1, arg2, callback) { - * // arg1 now equals 'one' and arg2 now equals 'two' - * callback(null, 'three'); - * } - * function myLastFunction(arg1, callback) { - * // arg1 now equals 'three' - * callback(null, 'done'); - * } - */ -function waterfall (tasks, callback) { - callback = once(callback); - if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); - if (!tasks.length) return callback(); - var taskIndex = 0; - - function nextTask(args) { - var task = wrapAsync(tasks[taskIndex++]); - task(...args, onlyOnce(next)); - } - - function next(err, ...args) { - if (err === false) return - if (err || taskIndex === tasks.length) { - return callback(err, ...args); - } - nextTask(args); - } - - nextTask([]); -} - -var waterfall$1 = awaitify(waterfall); - -/** - * An "async function" in the context of Async is an asynchronous function with - * a variable number of parameters, with the final parameter being a callback. - * (`function (arg1, arg2, ..., callback) {}`) - * The final callback is of the form `callback(err, results...)`, which must be - * called once the function is completed. The callback should be called with a - * Error as its first argument to signal that an error occurred. - * Otherwise, if no error occurred, it should be called with `null` as the first - * argument, and any additional `result` arguments that may apply, to signal - * successful completion. - * The callback must be called exactly once, ideally on a later tick of the - * JavaScript event loop. - * - * This type of function is also referred to as a "Node-style async function", - * or a "continuation passing-style function" (CPS). Most of the methods of this - * library are themselves CPS/Node-style async functions, or functions that - * return CPS/Node-style async functions. - * - * Wherever we accept a Node-style async function, we also directly accept an - * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}. - * In this case, the `async` function will not be passed a final callback - * argument, and any thrown error will be used as the `err` argument of the - * implicit callback, and the return value will be used as the `result` value. - * (i.e. a `rejected` of the returned Promise becomes the `err` callback - * argument, and a `resolved` value becomes the `result`.) - * - * Note, due to JavaScript limitations, we can only detect native `async` - * functions and not transpilied implementations. - * Your environment must have `async`/`await` support for this to work. - * (e.g. Node > v7.6, or a recent version of a modern browser). - * If you are using `async` functions through a transpiler (e.g. Babel), you - * must still wrap the function with [asyncify]{@link module:Utils.asyncify}, - * because the `async function` will be compiled to an ordinary function that - * returns a promise. - * - * @typedef {Function} AsyncFunction - * @static - */ - -var index = { - apply, - applyEach: applyEach$1, - applyEachSeries, - asyncify, - auto, - autoInject, - cargo, - cargoQueue: cargo$1, - compose, - concat: concat$1, - concatLimit: concatLimit$1, - concatSeries: concatSeries$1, - constant, - detect: detect$1, - detectLimit: detectLimit$1, - detectSeries: detectSeries$1, - dir, - doUntil, - doWhilst: doWhilst$1, - each, - eachLimit: eachLimit$2, - eachOf: eachOf$1, - eachOfLimit: eachOfLimit$2, - eachOfSeries: eachOfSeries$1, - eachSeries: eachSeries$1, - ensureAsync, - every: every$1, - everyLimit: everyLimit$1, - everySeries: everySeries$1, - filter: filter$1, - filterLimit: filterLimit$1, - filterSeries: filterSeries$1, - forever: forever$1, - groupBy, - groupByLimit: groupByLimit$1, - groupBySeries, - log, - map: map$1, - mapLimit: mapLimit$1, - mapSeries: mapSeries$1, - mapValues, - mapValuesLimit: mapValuesLimit$1, - mapValuesSeries, - memoize, - nextTick, - parallel, - parallelLimit, - priorityQueue, - queue: queue$1, - race: race$1, - reduce: reduce$1, - reduceRight, - reflect, - reflectAll, - reject: reject$2, - rejectLimit: rejectLimit$1, - rejectSeries: rejectSeries$1, - retry, - retryable, - seq, - series, - setImmediate: setImmediate$1, - some: some$1, - someLimit: someLimit$1, - someSeries: someSeries$1, - sortBy: sortBy$1, - timeout, - times, - timesLimit, - timesSeries, - transform, - tryEach: tryEach$1, - unmemoize, - until, - waterfall: waterfall$1, - whilst: whilst$1, - - // aliases - all: every$1, - allLimit: everyLimit$1, - allSeries: everySeries$1, - any: some$1, - anyLimit: someLimit$1, - anySeries: someSeries$1, - find: detect$1, - findLimit: detectLimit$1, - findSeries: detectSeries$1, - flatMap: concat$1, - flatMapLimit: concatLimit$1, - flatMapSeries: concatSeries$1, - forEach: each, - forEachSeries: eachSeries$1, - forEachLimit: eachLimit$2, - forEachOf: eachOf$1, - forEachOfSeries: eachOfSeries$1, - forEachOfLimit: eachOfLimit$2, - inject: reduce$1, - foldl: reduce$1, - foldr: reduceRight, - select: filter$1, - selectLimit: filterLimit$1, - selectSeries: filterSeries$1, - wrapSync: asyncify, - during: whilst$1, - doDuring: doWhilst$1 -}; - -export default index; -export { apply, applyEach$1 as applyEach, applyEachSeries, asyncify, auto, autoInject, cargo, cargo$1 as cargoQueue, compose, concat$1 as concat, concatLimit$1 as concatLimit, concatSeries$1 as concatSeries, constant, detect$1 as detect, detectLimit$1 as detectLimit, detectSeries$1 as detectSeries, dir, doUntil, doWhilst$1 as doWhilst, each, eachLimit$2 as eachLimit, eachOf$1 as eachOf, eachOfLimit$2 as eachOfLimit, eachOfSeries$1 as eachOfSeries, eachSeries$1 as eachSeries, ensureAsync, every$1 as every, everyLimit$1 as everyLimit, everySeries$1 as everySeries, filter$1 as filter, filterLimit$1 as filterLimit, filterSeries$1 as filterSeries, forever$1 as forever, groupBy, groupByLimit$1 as groupByLimit, groupBySeries, log, map$1 as map, mapLimit$1 as mapLimit, mapSeries$1 as mapSeries, mapValues, mapValuesLimit$1 as mapValuesLimit, mapValuesSeries, memoize, nextTick, parallel, parallelLimit, priorityQueue, queue$1 as queue, race$1 as race, reduce$1 as reduce, reduceRight, reflect, reflectAll, reject$2 as reject, rejectLimit$1 as rejectLimit, rejectSeries$1 as rejectSeries, retry, retryable, seq, series, setImmediate$1 as setImmediate, some$1 as some, someLimit$1 as someLimit, someSeries$1 as someSeries, sortBy$1 as sortBy, timeout, times, timesLimit, timesSeries, transform, tryEach$1 as tryEach, unmemoize, until, waterfall$1 as waterfall, whilst$1 as whilst, every$1 as all, everyLimit$1 as allLimit, everySeries$1 as allSeries, some$1 as any, someLimit$1 as anyLimit, someSeries$1 as anySeries, detect$1 as find, detectLimit$1 as findLimit, detectSeries$1 as findSeries, concat$1 as flatMap, concatLimit$1 as flatMapLimit, concatSeries$1 as flatMapSeries, each as forEach, eachSeries$1 as forEachSeries, eachLimit$2 as forEachLimit, eachOf$1 as forEachOf, eachOfSeries$1 as forEachOfSeries, eachOfLimit$2 as forEachOfLimit, reduce$1 as inject, reduce$1 as foldl, reduceRight as foldr, filter$1 as select, filterLimit$1 as selectLimit, filterSeries$1 as selectSeries, asyncify as wrapSync, whilst$1 as during, doWhilst$1 as doDuring }; diff --git a/node_modules/async/doDuring.js b/node_modules/async/doDuring.js deleted file mode 100644 index c0def6f1..00000000 --- a/node_modules/async/doDuring.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in - * the order of operations, the arguments `test` and `iteratee` are switched. - * - * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - * - * @name doWhilst - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - A function which is called each time `test` - * passes. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform after each - * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `iteratee`. - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. - * `callback` will be passed an error and any arguments passed to the final - * `iteratee`'s callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - */ -function doWhilst(iteratee, test, callback) { - callback = (0, _onlyOnce2.default)(callback); - var _fn = (0, _wrapAsync2.default)(iteratee); - var _test = (0, _wrapAsync2.default)(test); - var results; - - function next(err, ...args) { - if (err) return callback(err); - if (err === false) return; - results = args; - _test(...args, check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return check(null, true); -} - -exports.default = (0, _awaitify2.default)(doWhilst, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/doUntil.js b/node_modules/async/doUntil.js deleted file mode 100644 index 644cb372..00000000 --- a/node_modules/async/doUntil.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = doUntil; - -var _doWhilst = require('./doWhilst'); - -var _doWhilst2 = _interopRequireDefault(_doWhilst); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the - * argument ordering differs from `until`. - * - * @name doUntil - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.doWhilst]{@link module:ControlFlow.doWhilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` fails. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform after each - * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `iteratee` - * @param {Function} [callback] - A callback which is called after the test - * function has passed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - */ -function doUntil(iteratee, test, callback) { - const _test = (0, _wrapAsync2.default)(test); - return (0, _doWhilst2.default)(iteratee, (...args) => { - const cb = args.pop(); - _test(...args, (err, truth) => cb(err, !truth)); - }, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/doWhilst.js b/node_modules/async/doWhilst.js deleted file mode 100644 index c0def6f1..00000000 --- a/node_modules/async/doWhilst.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in - * the order of operations, the arguments `test` and `iteratee` are switched. - * - * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - * - * @name doWhilst - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - A function which is called each time `test` - * passes. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform after each - * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `iteratee`. - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. - * `callback` will be passed an error and any arguments passed to the final - * `iteratee`'s callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - */ -function doWhilst(iteratee, test, callback) { - callback = (0, _onlyOnce2.default)(callback); - var _fn = (0, _wrapAsync2.default)(iteratee); - var _test = (0, _wrapAsync2.default)(test); - var results; - - function next(err, ...args) { - if (err) return callback(err); - if (err === false) return; - results = args; - _test(...args, check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return check(null, true); -} - -exports.default = (0, _awaitify2.default)(doWhilst, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/during.js b/node_modules/async/during.js deleted file mode 100644 index 4f4a39b4..00000000 --- a/node_modules/async/during.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. - * - * @name whilst - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `iteratee`. Invoked with (). - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` passes. Invoked with (callback). - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - * @example - * - * var count = 0; - * async.whilst( - * function test(cb) { cb(null, count < 5); }, - * function iter(callback) { - * count++; - * setTimeout(function() { - * callback(null, count); - * }, 1000); - * }, - * function (err, n) { - * // 5 seconds have passed, n = 5 - * } - * ); - */ -function whilst(test, iteratee, callback) { - callback = (0, _onlyOnce2.default)(callback); - var _fn = (0, _wrapAsync2.default)(iteratee); - var _test = (0, _wrapAsync2.default)(test); - var results = []; - - function next(err, ...rest) { - if (err) return callback(err); - results = rest; - if (err === false) return; - _test(check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return _test(check); -} -exports.default = (0, _awaitify2.default)(whilst, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/each.js b/node_modules/async/each.js deleted file mode 100644 index 39e15d91..00000000 --- a/node_modules/async/each.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _withoutIndex = require('./internal/withoutIndex'); - -var _withoutIndex2 = _interopRequireDefault(_withoutIndex); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Applies the function `iteratee` to each item in `coll`, in parallel. - * The `iteratee` is called with an item from the list, and a callback for when - * it has finished. If the `iteratee` passes an error to its `callback`, the - * main `callback` (for the `each` function) is immediately called with the - * error. - * - * Note, that since this function applies `iteratee` to each item in parallel, - * there is no guarantee that the iteratee functions will complete in order. - * - * @name each - * @static - * @memberOf module:Collections - * @method - * @alias forEach - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to - * each item in `coll`. Invoked with (item, callback). - * The array index is not passed to the iteratee. - * If you need the index, use `eachOf`. - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * // assuming openFiles is an array of file names and saveFile is a function - * // to save the modified contents of that file: - * - * async.each(openFiles, saveFile, function(err){ - * // if any of the saves produced an error, err would equal that error - * }); - * - * // assuming openFiles is an array of file names - * async.each(openFiles, function(file, callback) { - * - * // Perform operation on file here. - * console.log('Processing file ' + file); - * - * if( file.length > 32 ) { - * console.log('This file name is too long'); - * callback('File name too long'); - * } else { - * // Do work to process file here - * console.log('File processed'); - * callback(); - * } - * }, function(err) { - * // if any of the file processing produced an error, err would equal that error - * if( err ) { - * // One of the iterations produced an error. - * // All processing will now stop. - * console.log('A file failed to process'); - * } else { - * console.log('All files have been processed successfully'); - * } - * }); - */ -function eachLimit(coll, iteratee, callback) { - return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); -} - -exports.default = (0, _awaitify2.default)(eachLimit, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/eachLimit.js b/node_modules/async/eachLimit.js deleted file mode 100644 index 7e9f9ae4..00000000 --- a/node_modules/async/eachLimit.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _withoutIndex = require('./internal/withoutIndex'); - -var _withoutIndex2 = _interopRequireDefault(_withoutIndex); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. - * - * @name eachLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfLimit`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachLimit(coll, limit, iteratee, callback) { - return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); -} -exports.default = (0, _awaitify2.default)(eachLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/eachOf.js b/node_modules/async/eachOf.js deleted file mode 100644 index 4123ef57..00000000 --- a/node_modules/async/eachOf.js +++ /dev/null @@ -1,116 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _isArrayLike = require('./internal/isArrayLike'); - -var _isArrayLike2 = _interopRequireDefault(_isArrayLike); - -var _breakLoop = require('./internal/breakLoop'); - -var _breakLoop2 = _interopRequireDefault(_breakLoop); - -var _eachOfLimit = require('./eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// eachOf implementation optimized for array-likes -function eachOfArrayLike(coll, iteratee, callback) { - callback = (0, _once2.default)(callback); - var index = 0, - completed = 0, - { length } = coll, - canceled = false; - if (length === 0) { - callback(null); - } - - function iteratorCallback(err, value) { - if (err === false) { - canceled = true; - } - if (canceled === true) return; - if (err) { - callback(err); - } else if (++completed === length || value === _breakLoop2.default) { - callback(null); - } - } - - for (; index < length; index++) { - iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback)); - } -} - -// a generic version of eachOf which can handle array, object, and iterator cases. -function eachOfGeneric(coll, iteratee, callback) { - return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback); -} - -/** - * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument - * to the iteratee. - * - * @name eachOf - * @static - * @memberOf module:Collections - * @method - * @alias forEachOf - * @category Collection - * @see [async.each]{@link module:Collections.each} - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each - * item in `coll`. - * The `key` is the item's key, or index in the case of an array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; - * var configs = {}; - * - * async.forEachOf(obj, function (value, key, callback) { - * fs.readFile(__dirname + value, "utf8", function (err, data) { - * if (err) return callback(err); - * try { - * configs[key] = JSON.parse(data); - * } catch (e) { - * return callback(e); - * } - * callback(); - * }); - * }, function (err) { - * if (err) console.error(err.message); - * // configs is now a map of JSON data - * doSomethingWith(configs); - * }); - */ -function eachOf(coll, iteratee, callback) { - var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric; - return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback); -} - -exports.default = (0, _awaitify2.default)(eachOf, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/eachOfLimit.js b/node_modules/async/eachOfLimit.js deleted file mode 100644 index 48dc3e56..00000000 --- a/node_modules/async/eachOfLimit.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfLimit2 = require('./internal/eachOfLimit'); - -var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a - * time. - * - * @name eachOfLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. The `key` is the item's key, or index in the case of an - * array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachOfLimit(coll, limit, iteratee, callback) { - return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback); -} - -exports.default = (0, _awaitify2.default)(eachOfLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/eachOfSeries.js b/node_modules/async/eachOfSeries.js deleted file mode 100644 index 75de61fe..00000000 --- a/node_modules/async/eachOfSeries.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfLimit = require('./eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. - * - * @name eachOfSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachOfSeries(coll, iteratee, callback) { - return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(eachOfSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/eachSeries.js b/node_modules/async/eachSeries.js deleted file mode 100644 index ec18a777..00000000 --- a/node_modules/async/eachSeries.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachLimit = require('./eachLimit'); - -var _eachLimit2 = _interopRequireDefault(_eachLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. - * - * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item - * in series and therefore the iteratee functions will complete in order. - - * @name eachSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfSeries`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachSeries(coll, iteratee, callback) { - return (0, _eachLimit2.default)(coll, 1, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(eachSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/ensureAsync.js b/node_modules/async/ensureAsync.js deleted file mode 100644 index dee0a55f..00000000 --- a/node_modules/async/ensureAsync.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = ensureAsync; - -var _setImmediate = require('./internal/setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -var _wrapAsync = require('./internal/wrapAsync'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Wrap an async function and ensure it calls its callback on a later tick of - * the event loop. If the function already calls its callback on a next tick, - * no extra deferral is added. This is useful for preventing stack overflows - * (`RangeError: Maximum call stack size exceeded`) and generally keeping - * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) - * contained. ES2017 `async` functions are returned as-is -- they are immune - * to Zalgo's corrupting influences, as they always resolve on a later tick. - * - * @name ensureAsync - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - an async function, one that expects a node-style - * callback as its last argument. - * @returns {AsyncFunction} Returns a wrapped function with the exact same call - * signature as the function passed in. - * @example - * - * function sometimesAsync(arg, callback) { - * if (cache[arg]) { - * return callback(null, cache[arg]); // this would be synchronous!! - * } else { - * doSomeIO(arg, callback); // this IO would be asynchronous - * } - * } - * - * // this has a risk of stack overflows if many results are cached in a row - * async.mapSeries(args, sometimesAsync, done); - * - * // this will defer sometimesAsync's callback if necessary, - * // preventing stack overflows - * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); - */ -function ensureAsync(fn) { - if ((0, _wrapAsync.isAsync)(fn)) return fn; - return function (...args /*, callback*/) { - var callback = args.pop(); - var sync = true; - args.push((...innerArgs) => { - if (sync) { - (0, _setImmediate2.default)(() => callback(...innerArgs)); - } else { - callback(...innerArgs); - } - }); - fn.apply(this, args); - sync = false; - }; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/every.js b/node_modules/async/every.js deleted file mode 100644 index 1c2e5360..00000000 --- a/node_modules/async/every.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns `true` if every element in `coll` satisfies an async test. If any - * iteratee call returns `false`, the main `callback` is immediately called. - * - * @name every - * @static - * @memberOf module:Collections - * @method - * @alias all - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.every(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then every file exists - * }); - */ -function every(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(every, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/everyLimit.js b/node_modules/async/everyLimit.js deleted file mode 100644 index bb78378d..00000000 --- a/node_modules/async/everyLimit.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. - * - * @name everyLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function everyLimit(coll, limit, iteratee, callback) { - return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(everyLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/everySeries.js b/node_modules/async/everySeries.js deleted file mode 100644 index 76eeaf7e..00000000 --- a/node_modules/async/everySeries.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. - * - * @name everySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in series. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function everySeries(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(everySeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/filter.js b/node_modules/async/filter.js deleted file mode 100644 index fadd16a7..00000000 --- a/node_modules/async/filter.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _filter2 = require('./internal/filter'); - -var _filter3 = _interopRequireDefault(_filter2); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns a new array of all the values in `coll` which pass an async truth - * test. This operation is performed in parallel, but the results array will be - * in the same order as the original. - * - * @name filter - * @static - * @memberOf module:Collections - * @method - * @alias select - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.filter(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of the existing files - * }); - */ -function filter(coll, iteratee, callback) { - return (0, _filter3.default)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(filter, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/filterLimit.js b/node_modules/async/filterLimit.js deleted file mode 100644 index 7fdee119..00000000 --- a/node_modules/async/filterLimit.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _filter2 = require('./internal/filter'); - -var _filter3 = _interopRequireDefault(_filter2); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a - * time. - * - * @name filterLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - */ -function filterLimit(coll, limit, iteratee, callback) { - return (0, _filter3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(filterLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/filterSeries.js b/node_modules/async/filterSeries.js deleted file mode 100644 index ee8bde9d..00000000 --- a/node_modules/async/filterSeries.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _filter2 = require('./internal/filter'); - -var _filter3 = _interopRequireDefault(_filter2); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. - * - * @name filterSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results) - * @returns {Promise} a promise, if no callback provided - */ -function filterSeries(coll, iteratee, callback) { - return (0, _filter3.default)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(filterSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/find.js b/node_modules/async/find.js deleted file mode 100644 index 1066b9e8..00000000 --- a/node_modules/async/find.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns the first value in `coll` that passes an async truth test. The - * `iteratee` is applied in parallel, meaning the first iteratee to return - * `true` will fire the detect `callback` with that result. That means the - * result might not be the first item in the original `coll` (in terms of order) - * that passes the test. - - * If order within the original `coll` is important, then look at - * [`detectSeries`]{@link module:Collections.detectSeries}. - * - * @name detect - * @static - * @memberOf module:Collections - * @method - * @alias find - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns A Promise, if no callback is passed - * @example - * - * async.detect(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // result now equals the first file in the list that exists - * }); - */ -function detect(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(detect, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/findLimit.js b/node_modules/async/findLimit.js deleted file mode 100644 index 9e2d3a0d..00000000 --- a/node_modules/async/findLimit.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a - * time. - * - * @name detectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findLimit - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ -function detectLimit(coll, limit, iteratee, callback) { - return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(detectLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/findSeries.js b/node_modules/async/findSeries.js deleted file mode 100644 index cdf38b1d..00000000 --- a/node_modules/async/findSeries.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. - * - * @name detectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findSeries - * @category Collections - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @returns a Promise if no callback is passed - */ -function detectSeries(coll, iteratee, callback) { - return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback); -} - -exports.default = (0, _awaitify2.default)(detectSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/flatMap.js b/node_modules/async/flatMap.js deleted file mode 100644 index 39555c8f..00000000 --- a/node_modules/async/flatMap.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _concatLimit = require('./concatLimit'); - -var _concatLimit2 = _interopRequireDefault(_concatLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Applies `iteratee` to each item in `coll`, concatenating the results. Returns - * the concatenated list. The `iteratee`s are called in parallel, and the - * results are concatenated as they return. The results array will be returned in - * the original order of `coll` passed to the `iteratee` function. - * - * @name concat - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @alias flatMap - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - * @example - * - * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) { - * // files is now a list of filenames that exist in the 3 directories - * }); - */ -function concat(coll, iteratee, callback) { - return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(concat, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/flatMapLimit.js b/node_modules/async/flatMapLimit.js deleted file mode 100644 index 3ef4b5fd..00000000 --- a/node_modules/async/flatMapLimit.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _mapLimit = require('./mapLimit'); - -var _mapLimit2 = _interopRequireDefault(_mapLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time. - * - * @name concatLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @alias flatMapLimit - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - */ -function concatLimit(coll, limit, iteratee, callback) { - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => { - _iteratee(val, (err, ...args) => { - if (err) return iterCb(err); - return iterCb(err, args); - }); - }, (err, mapResults) => { - var result = []; - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - result = result.concat(...mapResults[i]); - } - } - - return callback(err, result); - }); -} -exports.default = (0, _awaitify2.default)(concatLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/flatMapSeries.js b/node_modules/async/flatMapSeries.js deleted file mode 100644 index fbc105b9..00000000 --- a/node_modules/async/flatMapSeries.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _concatLimit = require('./concatLimit'); - -var _concatLimit2 = _interopRequireDefault(_concatLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. - * - * @name concatSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @alias flatMapSeries - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. - * The iteratee should complete with an array an array of results. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @returns A Promise, if no callback is passed - */ -function concatSeries(coll, iteratee, callback) { - return (0, _concatLimit2.default)(coll, 1, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(concatSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/foldl.js b/node_modules/async/foldl.js deleted file mode 100644 index e7816830..00000000 --- a/node_modules/async/foldl.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Reduces `coll` into a single value using an async `iteratee` to return each - * successive step. `memo` is the initial state of the reduction. This function - * only operates in series. - * - * For performance reasons, it may make sense to split a call to this function - * into a parallel map, and then use the normal `Array.prototype.reduce` on the - * results. This function is for situations where each step in the reduction - * needs to be async; if you can get the data before reducing it, then it's - * probably a good idea to do so. - * - * @name reduce - * @static - * @memberOf module:Collections - * @method - * @alias inject - * @alias foldl - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.reduce([1,2,3], 0, function(memo, item, callback) { - * // pointless async: - * process.nextTick(function() { - * callback(null, memo + item) - * }); - * }, function(err, result) { - * // result is now equal to the last value of memo, which is 6 - * }); - */ -function reduce(coll, memo, iteratee, callback) { - callback = (0, _once2.default)(callback); - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _eachOfSeries2.default)(coll, (x, i, iterCb) => { - _iteratee(memo, x, (err, v) => { - memo = v; - iterCb(err); - }); - }, err => callback(err, memo)); -} -exports.default = (0, _awaitify2.default)(reduce, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/foldr.js b/node_modules/async/foldr.js deleted file mode 100644 index e3da2a4d..00000000 --- a/node_modules/async/foldr.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = reduceRight; - -var _reduce = require('./reduce'); - -var _reduce2 = _interopRequireDefault(_reduce); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. - * - * @name reduceRight - * @static - * @memberOf module:Collections - * @method - * @see [async.reduce]{@link module:Collections.reduce} - * @alias foldr - * @category Collection - * @param {Array} array - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @returns {Promise} a promise, if no callback is passed - */ -function reduceRight(array, memo, iteratee, callback) { - var reversed = [...array].reverse(); - return (0, _reduce2.default)(reversed, memo, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/forEach.js b/node_modules/async/forEach.js deleted file mode 100644 index 39e15d91..00000000 --- a/node_modules/async/forEach.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _withoutIndex = require('./internal/withoutIndex'); - -var _withoutIndex2 = _interopRequireDefault(_withoutIndex); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Applies the function `iteratee` to each item in `coll`, in parallel. - * The `iteratee` is called with an item from the list, and a callback for when - * it has finished. If the `iteratee` passes an error to its `callback`, the - * main `callback` (for the `each` function) is immediately called with the - * error. - * - * Note, that since this function applies `iteratee` to each item in parallel, - * there is no guarantee that the iteratee functions will complete in order. - * - * @name each - * @static - * @memberOf module:Collections - * @method - * @alias forEach - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to - * each item in `coll`. Invoked with (item, callback). - * The array index is not passed to the iteratee. - * If you need the index, use `eachOf`. - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * // assuming openFiles is an array of file names and saveFile is a function - * // to save the modified contents of that file: - * - * async.each(openFiles, saveFile, function(err){ - * // if any of the saves produced an error, err would equal that error - * }); - * - * // assuming openFiles is an array of file names - * async.each(openFiles, function(file, callback) { - * - * // Perform operation on file here. - * console.log('Processing file ' + file); - * - * if( file.length > 32 ) { - * console.log('This file name is too long'); - * callback('File name too long'); - * } else { - * // Do work to process file here - * console.log('File processed'); - * callback(); - * } - * }, function(err) { - * // if any of the file processing produced an error, err would equal that error - * if( err ) { - * // One of the iterations produced an error. - * // All processing will now stop. - * console.log('A file failed to process'); - * } else { - * console.log('All files have been processed successfully'); - * } - * }); - */ -function eachLimit(coll, iteratee, callback) { - return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); -} - -exports.default = (0, _awaitify2.default)(eachLimit, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/forEachLimit.js b/node_modules/async/forEachLimit.js deleted file mode 100644 index 7e9f9ae4..00000000 --- a/node_modules/async/forEachLimit.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _withoutIndex = require('./internal/withoutIndex'); - -var _withoutIndex2 = _interopRequireDefault(_withoutIndex); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. - * - * @name eachLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfLimit`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachLimit(coll, limit, iteratee, callback) { - return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); -} -exports.default = (0, _awaitify2.default)(eachLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/forEachOf.js b/node_modules/async/forEachOf.js deleted file mode 100644 index 4123ef57..00000000 --- a/node_modules/async/forEachOf.js +++ /dev/null @@ -1,116 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _isArrayLike = require('./internal/isArrayLike'); - -var _isArrayLike2 = _interopRequireDefault(_isArrayLike); - -var _breakLoop = require('./internal/breakLoop'); - -var _breakLoop2 = _interopRequireDefault(_breakLoop); - -var _eachOfLimit = require('./eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// eachOf implementation optimized for array-likes -function eachOfArrayLike(coll, iteratee, callback) { - callback = (0, _once2.default)(callback); - var index = 0, - completed = 0, - { length } = coll, - canceled = false; - if (length === 0) { - callback(null); - } - - function iteratorCallback(err, value) { - if (err === false) { - canceled = true; - } - if (canceled === true) return; - if (err) { - callback(err); - } else if (++completed === length || value === _breakLoop2.default) { - callback(null); - } - } - - for (; index < length; index++) { - iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback)); - } -} - -// a generic version of eachOf which can handle array, object, and iterator cases. -function eachOfGeneric(coll, iteratee, callback) { - return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback); -} - -/** - * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument - * to the iteratee. - * - * @name eachOf - * @static - * @memberOf module:Collections - * @method - * @alias forEachOf - * @category Collection - * @see [async.each]{@link module:Collections.each} - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each - * item in `coll`. - * The `key` is the item's key, or index in the case of an array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - * @example - * - * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; - * var configs = {}; - * - * async.forEachOf(obj, function (value, key, callback) { - * fs.readFile(__dirname + value, "utf8", function (err, data) { - * if (err) return callback(err); - * try { - * configs[key] = JSON.parse(data); - * } catch (e) { - * return callback(e); - * } - * callback(); - * }); - * }, function (err) { - * if (err) console.error(err.message); - * // configs is now a map of JSON data - * doSomethingWith(configs); - * }); - */ -function eachOf(coll, iteratee, callback) { - var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric; - return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback); -} - -exports.default = (0, _awaitify2.default)(eachOf, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/forEachOfLimit.js b/node_modules/async/forEachOfLimit.js deleted file mode 100644 index 48dc3e56..00000000 --- a/node_modules/async/forEachOfLimit.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfLimit2 = require('./internal/eachOfLimit'); - -var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a - * time. - * - * @name eachOfLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. The `key` is the item's key, or index in the case of an - * array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachOfLimit(coll, limit, iteratee, callback) { - return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback); -} - -exports.default = (0, _awaitify2.default)(eachOfLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/forEachOfSeries.js b/node_modules/async/forEachOfSeries.js deleted file mode 100644 index 75de61fe..00000000 --- a/node_modules/async/forEachOfSeries.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfLimit = require('./eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. - * - * @name eachOfSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachOfSeries(coll, iteratee, callback) { - return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(eachOfSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/forEachSeries.js b/node_modules/async/forEachSeries.js deleted file mode 100644 index ec18a777..00000000 --- a/node_modules/async/forEachSeries.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachLimit = require('./eachLimit'); - -var _eachLimit2 = _interopRequireDefault(_eachLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. - * - * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item - * in series and therefore the iteratee functions will complete in order. - - * @name eachSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfSeries`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @returns {Promise} a promise, if a callback is omitted - */ -function eachSeries(coll, iteratee, callback) { - return (0, _eachLimit2.default)(coll, 1, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(eachSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/forever.js b/node_modules/async/forever.js deleted file mode 100644 index 0d9a5c71..00000000 --- a/node_modules/async/forever.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _ensureAsync = require('./ensureAsync'); - -var _ensureAsync2 = _interopRequireDefault(_ensureAsync); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Calls the asynchronous function `fn` with a callback parameter that allows it - * to call itself again, in series, indefinitely. - - * If an error is passed to the callback then `errback` is called with the - * error, and execution stops, otherwise it will never be called. - * - * @name forever - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} fn - an async function to call repeatedly. - * Invoked with (next). - * @param {Function} [errback] - when `fn` passes an error to it's callback, - * this function will be called, and execution stops. Invoked with (err). - * @returns {Promise} a promise that rejects if an error occurs and an errback - * is not passed - * @example - * - * async.forever( - * function(next) { - * // next is suitable for passing to things that need a callback(err [, whatever]); - * // it will result in this function being called again. - * }, - * function(err) { - * // if next is called with a value in its first parameter, it will appear - * // in here as 'err', and execution will stop. - * } - * ); - */ -function forever(fn, errback) { - var done = (0, _onlyOnce2.default)(errback); - var task = (0, _wrapAsync2.default)((0, _ensureAsync2.default)(fn)); - - function next(err) { - if (err) return done(err); - if (err === false) return; - task(next); - } - return next(); -} -exports.default = (0, _awaitify2.default)(forever, 2); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/groupBy.js b/node_modules/async/groupBy.js deleted file mode 100644 index a7e4304d..00000000 --- a/node_modules/async/groupBy.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = groupBy; - -var _groupByLimit = require('./groupByLimit'); - -var _groupByLimit2 = _interopRequireDefault(_groupByLimit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns a new object, where each value corresponds to an array of items, from - * `coll`, that returned the corresponding key. That is, the keys of the object - * correspond to the values passed to the `iteratee` callback. - * - * Note: Since this function applies the `iteratee` to each item in parallel, - * there is no guarantee that the `iteratee` functions will complete in order. - * However, the values for each key in the `result` will be in the same order as - * the original `coll`. For Objects, the values will roughly be in the order of - * the original Objects' keys (but this can vary across JavaScript engines). - * - * @name groupBy - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { - * db.findById(userId, function(err, user) { - * if (err) return callback(err); - * return callback(null, user.age); - * }); - * }, function(err, result) { - * // result is object containing the userIds grouped by age - * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; - * }); - */ -function groupBy(coll, iteratee, callback) { - return (0, _groupByLimit2.default)(coll, Infinity, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/groupByLimit.js b/node_modules/async/groupByLimit.js deleted file mode 100644 index f7da249a..00000000 --- a/node_modules/async/groupByLimit.js +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _mapLimit = require('./mapLimit'); - -var _mapLimit2 = _interopRequireDefault(_mapLimit); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. - * - * @name groupByLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - */ -function groupByLimit(coll, limit, iteratee, callback) { - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => { - _iteratee(val, (err, key) => { - if (err) return iterCb(err); - return iterCb(err, { key, val }); - }); - }, (err, mapResults) => { - var result = {}; - // from MDN, handle object having an `hasOwnProperty` prop - var { hasOwnProperty } = Object.prototype; - - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - var { key } = mapResults[i]; - var { val } = mapResults[i]; - - if (hasOwnProperty.call(result, key)) { - result[key].push(val); - } else { - result[key] = [val]; - } - } - } - - return callback(err, result); - }); -} - -exports.default = (0, _awaitify2.default)(groupByLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/groupBySeries.js b/node_modules/async/groupBySeries.js deleted file mode 100644 index b3a945aa..00000000 --- a/node_modules/async/groupBySeries.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = groupBySeries; - -var _groupByLimit = require('./groupByLimit'); - -var _groupByLimit2 = _interopRequireDefault(_groupByLimit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. - * - * @name groupBySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. - * @returns {Promise} a promise, if no callback is passed - */ -function groupBySeries(coll, iteratee, callback) { - return (0, _groupByLimit2.default)(coll, 1, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/index.js b/node_modules/async/index.js deleted file mode 100644 index ce647d59..00000000 --- a/node_modules/async/index.js +++ /dev/null @@ -1,588 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.doDuring = exports.during = exports.wrapSync = undefined; -exports.selectSeries = exports.selectLimit = exports.select = exports.foldr = exports.foldl = exports.inject = exports.forEachOfLimit = exports.forEachOfSeries = exports.forEachOf = exports.forEachLimit = exports.forEachSeries = exports.forEach = exports.flatMapSeries = exports.flatMapLimit = exports.flatMap = exports.findSeries = exports.findLimit = exports.find = exports.anySeries = exports.anyLimit = exports.any = exports.allSeries = exports.allLimit = exports.all = exports.whilst = exports.waterfall = exports.until = exports.unmemoize = exports.tryEach = exports.transform = exports.timesSeries = exports.timesLimit = exports.times = exports.timeout = exports.sortBy = exports.someSeries = exports.someLimit = exports.some = exports.setImmediate = exports.series = exports.seq = exports.retryable = exports.retry = exports.rejectSeries = exports.rejectLimit = exports.reject = exports.reflectAll = exports.reflect = exports.reduceRight = exports.reduce = exports.race = exports.queue = exports.priorityQueue = exports.parallelLimit = exports.parallel = exports.nextTick = exports.memoize = exports.mapValuesSeries = exports.mapValuesLimit = exports.mapValues = exports.mapSeries = exports.mapLimit = exports.map = exports.log = exports.groupBySeries = exports.groupByLimit = exports.groupBy = exports.forever = exports.filterSeries = exports.filterLimit = exports.filter = exports.everySeries = exports.everyLimit = exports.every = exports.ensureAsync = exports.eachSeries = exports.eachOfSeries = exports.eachOfLimit = exports.eachOf = exports.eachLimit = exports.each = exports.doWhilst = exports.doUntil = exports.dir = exports.detectSeries = exports.detectLimit = exports.detect = exports.constant = exports.concatSeries = exports.concatLimit = exports.concat = exports.compose = exports.cargoQueue = exports.cargo = exports.autoInject = exports.auto = exports.asyncify = exports.applyEachSeries = exports.applyEach = exports.apply = undefined; - -var _apply = require('./apply'); - -var _apply2 = _interopRequireDefault(_apply); - -var _applyEach = require('./applyEach'); - -var _applyEach2 = _interopRequireDefault(_applyEach); - -var _applyEachSeries = require('./applyEachSeries'); - -var _applyEachSeries2 = _interopRequireDefault(_applyEachSeries); - -var _asyncify = require('./asyncify'); - -var _asyncify2 = _interopRequireDefault(_asyncify); - -var _auto = require('./auto'); - -var _auto2 = _interopRequireDefault(_auto); - -var _autoInject = require('./autoInject'); - -var _autoInject2 = _interopRequireDefault(_autoInject); - -var _cargo = require('./cargo'); - -var _cargo2 = _interopRequireDefault(_cargo); - -var _cargoQueue = require('./cargoQueue'); - -var _cargoQueue2 = _interopRequireDefault(_cargoQueue); - -var _compose = require('./compose'); - -var _compose2 = _interopRequireDefault(_compose); - -var _concat = require('./concat'); - -var _concat2 = _interopRequireDefault(_concat); - -var _concatLimit = require('./concatLimit'); - -var _concatLimit2 = _interopRequireDefault(_concatLimit); - -var _concatSeries = require('./concatSeries'); - -var _concatSeries2 = _interopRequireDefault(_concatSeries); - -var _constant = require('./constant'); - -var _constant2 = _interopRequireDefault(_constant); - -var _detect = require('./detect'); - -var _detect2 = _interopRequireDefault(_detect); - -var _detectLimit = require('./detectLimit'); - -var _detectLimit2 = _interopRequireDefault(_detectLimit); - -var _detectSeries = require('./detectSeries'); - -var _detectSeries2 = _interopRequireDefault(_detectSeries); - -var _dir = require('./dir'); - -var _dir2 = _interopRequireDefault(_dir); - -var _doUntil = require('./doUntil'); - -var _doUntil2 = _interopRequireDefault(_doUntil); - -var _doWhilst = require('./doWhilst'); - -var _doWhilst2 = _interopRequireDefault(_doWhilst); - -var _each = require('./each'); - -var _each2 = _interopRequireDefault(_each); - -var _eachLimit = require('./eachLimit'); - -var _eachLimit2 = _interopRequireDefault(_eachLimit); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _eachOfLimit = require('./eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _eachSeries = require('./eachSeries'); - -var _eachSeries2 = _interopRequireDefault(_eachSeries); - -var _ensureAsync = require('./ensureAsync'); - -var _ensureAsync2 = _interopRequireDefault(_ensureAsync); - -var _every = require('./every'); - -var _every2 = _interopRequireDefault(_every); - -var _everyLimit = require('./everyLimit'); - -var _everyLimit2 = _interopRequireDefault(_everyLimit); - -var _everySeries = require('./everySeries'); - -var _everySeries2 = _interopRequireDefault(_everySeries); - -var _filter = require('./filter'); - -var _filter2 = _interopRequireDefault(_filter); - -var _filterLimit = require('./filterLimit'); - -var _filterLimit2 = _interopRequireDefault(_filterLimit); - -var _filterSeries = require('./filterSeries'); - -var _filterSeries2 = _interopRequireDefault(_filterSeries); - -var _forever = require('./forever'); - -var _forever2 = _interopRequireDefault(_forever); - -var _groupBy = require('./groupBy'); - -var _groupBy2 = _interopRequireDefault(_groupBy); - -var _groupByLimit = require('./groupByLimit'); - -var _groupByLimit2 = _interopRequireDefault(_groupByLimit); - -var _groupBySeries = require('./groupBySeries'); - -var _groupBySeries2 = _interopRequireDefault(_groupBySeries); - -var _log = require('./log'); - -var _log2 = _interopRequireDefault(_log); - -var _map = require('./map'); - -var _map2 = _interopRequireDefault(_map); - -var _mapLimit = require('./mapLimit'); - -var _mapLimit2 = _interopRequireDefault(_mapLimit); - -var _mapSeries = require('./mapSeries'); - -var _mapSeries2 = _interopRequireDefault(_mapSeries); - -var _mapValues = require('./mapValues'); - -var _mapValues2 = _interopRequireDefault(_mapValues); - -var _mapValuesLimit = require('./mapValuesLimit'); - -var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit); - -var _mapValuesSeries = require('./mapValuesSeries'); - -var _mapValuesSeries2 = _interopRequireDefault(_mapValuesSeries); - -var _memoize = require('./memoize'); - -var _memoize2 = _interopRequireDefault(_memoize); - -var _nextTick = require('./nextTick'); - -var _nextTick2 = _interopRequireDefault(_nextTick); - -var _parallel = require('./parallel'); - -var _parallel2 = _interopRequireDefault(_parallel); - -var _parallelLimit = require('./parallelLimit'); - -var _parallelLimit2 = _interopRequireDefault(_parallelLimit); - -var _priorityQueue = require('./priorityQueue'); - -var _priorityQueue2 = _interopRequireDefault(_priorityQueue); - -var _queue = require('./queue'); - -var _queue2 = _interopRequireDefault(_queue); - -var _race = require('./race'); - -var _race2 = _interopRequireDefault(_race); - -var _reduce = require('./reduce'); - -var _reduce2 = _interopRequireDefault(_reduce); - -var _reduceRight = require('./reduceRight'); - -var _reduceRight2 = _interopRequireDefault(_reduceRight); - -var _reflect = require('./reflect'); - -var _reflect2 = _interopRequireDefault(_reflect); - -var _reflectAll = require('./reflectAll'); - -var _reflectAll2 = _interopRequireDefault(_reflectAll); - -var _reject = require('./reject'); - -var _reject2 = _interopRequireDefault(_reject); - -var _rejectLimit = require('./rejectLimit'); - -var _rejectLimit2 = _interopRequireDefault(_rejectLimit); - -var _rejectSeries = require('./rejectSeries'); - -var _rejectSeries2 = _interopRequireDefault(_rejectSeries); - -var _retry = require('./retry'); - -var _retry2 = _interopRequireDefault(_retry); - -var _retryable = require('./retryable'); - -var _retryable2 = _interopRequireDefault(_retryable); - -var _seq = require('./seq'); - -var _seq2 = _interopRequireDefault(_seq); - -var _series = require('./series'); - -var _series2 = _interopRequireDefault(_series); - -var _setImmediate = require('./setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -var _some = require('./some'); - -var _some2 = _interopRequireDefault(_some); - -var _someLimit = require('./someLimit'); - -var _someLimit2 = _interopRequireDefault(_someLimit); - -var _someSeries = require('./someSeries'); - -var _someSeries2 = _interopRequireDefault(_someSeries); - -var _sortBy = require('./sortBy'); - -var _sortBy2 = _interopRequireDefault(_sortBy); - -var _timeout = require('./timeout'); - -var _timeout2 = _interopRequireDefault(_timeout); - -var _times = require('./times'); - -var _times2 = _interopRequireDefault(_times); - -var _timesLimit = require('./timesLimit'); - -var _timesLimit2 = _interopRequireDefault(_timesLimit); - -var _timesSeries = require('./timesSeries'); - -var _timesSeries2 = _interopRequireDefault(_timesSeries); - -var _transform = require('./transform'); - -var _transform2 = _interopRequireDefault(_transform); - -var _tryEach = require('./tryEach'); - -var _tryEach2 = _interopRequireDefault(_tryEach); - -var _unmemoize = require('./unmemoize'); - -var _unmemoize2 = _interopRequireDefault(_unmemoize); - -var _until = require('./until'); - -var _until2 = _interopRequireDefault(_until); - -var _waterfall = require('./waterfall'); - -var _waterfall2 = _interopRequireDefault(_waterfall); - -var _whilst = require('./whilst'); - -var _whilst2 = _interopRequireDefault(_whilst); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * An "async function" in the context of Async is an asynchronous function with - * a variable number of parameters, with the final parameter being a callback. - * (`function (arg1, arg2, ..., callback) {}`) - * The final callback is of the form `callback(err, results...)`, which must be - * called once the function is completed. The callback should be called with a - * Error as its first argument to signal that an error occurred. - * Otherwise, if no error occurred, it should be called with `null` as the first - * argument, and any additional `result` arguments that may apply, to signal - * successful completion. - * The callback must be called exactly once, ideally on a later tick of the - * JavaScript event loop. - * - * This type of function is also referred to as a "Node-style async function", - * or a "continuation passing-style function" (CPS). Most of the methods of this - * library are themselves CPS/Node-style async functions, or functions that - * return CPS/Node-style async functions. - * - * Wherever we accept a Node-style async function, we also directly accept an - * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}. - * In this case, the `async` function will not be passed a final callback - * argument, and any thrown error will be used as the `err` argument of the - * implicit callback, and the return value will be used as the `result` value. - * (i.e. a `rejected` of the returned Promise becomes the `err` callback - * argument, and a `resolved` value becomes the `result`.) - * - * Note, due to JavaScript limitations, we can only detect native `async` - * functions and not transpilied implementations. - * Your environment must have `async`/`await` support for this to work. - * (e.g. Node > v7.6, or a recent version of a modern browser). - * If you are using `async` functions through a transpiler (e.g. Babel), you - * must still wrap the function with [asyncify]{@link module:Utils.asyncify}, - * because the `async function` will be compiled to an ordinary function that - * returns a promise. - * - * @typedef {Function} AsyncFunction - * @static - */ - -/** - * Async is a utility module which provides straight-forward, powerful functions - * for working with asynchronous JavaScript. Although originally designed for - * use with [Node.js](http://nodejs.org) and installable via - * `npm install --save async`, it can also be used directly in the browser. - * @module async - * @see AsyncFunction - */ - -/** - * A collection of `async` functions for manipulating collections, such as - * arrays and objects. - * @module Collections - */ - -/** - * A collection of `async` functions for controlling the flow through a script. - * @module ControlFlow - */ - -/** - * A collection of `async` utility functions. - * @module Utils - */ - -exports.default = { - apply: _apply2.default, - applyEach: _applyEach2.default, - applyEachSeries: _applyEachSeries2.default, - asyncify: _asyncify2.default, - auto: _auto2.default, - autoInject: _autoInject2.default, - cargo: _cargo2.default, - cargoQueue: _cargoQueue2.default, - compose: _compose2.default, - concat: _concat2.default, - concatLimit: _concatLimit2.default, - concatSeries: _concatSeries2.default, - constant: _constant2.default, - detect: _detect2.default, - detectLimit: _detectLimit2.default, - detectSeries: _detectSeries2.default, - dir: _dir2.default, - doUntil: _doUntil2.default, - doWhilst: _doWhilst2.default, - each: _each2.default, - eachLimit: _eachLimit2.default, - eachOf: _eachOf2.default, - eachOfLimit: _eachOfLimit2.default, - eachOfSeries: _eachOfSeries2.default, - eachSeries: _eachSeries2.default, - ensureAsync: _ensureAsync2.default, - every: _every2.default, - everyLimit: _everyLimit2.default, - everySeries: _everySeries2.default, - filter: _filter2.default, - filterLimit: _filterLimit2.default, - filterSeries: _filterSeries2.default, - forever: _forever2.default, - groupBy: _groupBy2.default, - groupByLimit: _groupByLimit2.default, - groupBySeries: _groupBySeries2.default, - log: _log2.default, - map: _map2.default, - mapLimit: _mapLimit2.default, - mapSeries: _mapSeries2.default, - mapValues: _mapValues2.default, - mapValuesLimit: _mapValuesLimit2.default, - mapValuesSeries: _mapValuesSeries2.default, - memoize: _memoize2.default, - nextTick: _nextTick2.default, - parallel: _parallel2.default, - parallelLimit: _parallelLimit2.default, - priorityQueue: _priorityQueue2.default, - queue: _queue2.default, - race: _race2.default, - reduce: _reduce2.default, - reduceRight: _reduceRight2.default, - reflect: _reflect2.default, - reflectAll: _reflectAll2.default, - reject: _reject2.default, - rejectLimit: _rejectLimit2.default, - rejectSeries: _rejectSeries2.default, - retry: _retry2.default, - retryable: _retryable2.default, - seq: _seq2.default, - series: _series2.default, - setImmediate: _setImmediate2.default, - some: _some2.default, - someLimit: _someLimit2.default, - someSeries: _someSeries2.default, - sortBy: _sortBy2.default, - timeout: _timeout2.default, - times: _times2.default, - timesLimit: _timesLimit2.default, - timesSeries: _timesSeries2.default, - transform: _transform2.default, - tryEach: _tryEach2.default, - unmemoize: _unmemoize2.default, - until: _until2.default, - waterfall: _waterfall2.default, - whilst: _whilst2.default, - - // aliases - all: _every2.default, - allLimit: _everyLimit2.default, - allSeries: _everySeries2.default, - any: _some2.default, - anyLimit: _someLimit2.default, - anySeries: _someSeries2.default, - find: _detect2.default, - findLimit: _detectLimit2.default, - findSeries: _detectSeries2.default, - flatMap: _concat2.default, - flatMapLimit: _concatLimit2.default, - flatMapSeries: _concatSeries2.default, - forEach: _each2.default, - forEachSeries: _eachSeries2.default, - forEachLimit: _eachLimit2.default, - forEachOf: _eachOf2.default, - forEachOfSeries: _eachOfSeries2.default, - forEachOfLimit: _eachOfLimit2.default, - inject: _reduce2.default, - foldl: _reduce2.default, - foldr: _reduceRight2.default, - select: _filter2.default, - selectLimit: _filterLimit2.default, - selectSeries: _filterSeries2.default, - wrapSync: _asyncify2.default, - during: _whilst2.default, - doDuring: _doWhilst2.default -}; -exports.apply = _apply2.default; -exports.applyEach = _applyEach2.default; -exports.applyEachSeries = _applyEachSeries2.default; -exports.asyncify = _asyncify2.default; -exports.auto = _auto2.default; -exports.autoInject = _autoInject2.default; -exports.cargo = _cargo2.default; -exports.cargoQueue = _cargoQueue2.default; -exports.compose = _compose2.default; -exports.concat = _concat2.default; -exports.concatLimit = _concatLimit2.default; -exports.concatSeries = _concatSeries2.default; -exports.constant = _constant2.default; -exports.detect = _detect2.default; -exports.detectLimit = _detectLimit2.default; -exports.detectSeries = _detectSeries2.default; -exports.dir = _dir2.default; -exports.doUntil = _doUntil2.default; -exports.doWhilst = _doWhilst2.default; -exports.each = _each2.default; -exports.eachLimit = _eachLimit2.default; -exports.eachOf = _eachOf2.default; -exports.eachOfLimit = _eachOfLimit2.default; -exports.eachOfSeries = _eachOfSeries2.default; -exports.eachSeries = _eachSeries2.default; -exports.ensureAsync = _ensureAsync2.default; -exports.every = _every2.default; -exports.everyLimit = _everyLimit2.default; -exports.everySeries = _everySeries2.default; -exports.filter = _filter2.default; -exports.filterLimit = _filterLimit2.default; -exports.filterSeries = _filterSeries2.default; -exports.forever = _forever2.default; -exports.groupBy = _groupBy2.default; -exports.groupByLimit = _groupByLimit2.default; -exports.groupBySeries = _groupBySeries2.default; -exports.log = _log2.default; -exports.map = _map2.default; -exports.mapLimit = _mapLimit2.default; -exports.mapSeries = _mapSeries2.default; -exports.mapValues = _mapValues2.default; -exports.mapValuesLimit = _mapValuesLimit2.default; -exports.mapValuesSeries = _mapValuesSeries2.default; -exports.memoize = _memoize2.default; -exports.nextTick = _nextTick2.default; -exports.parallel = _parallel2.default; -exports.parallelLimit = _parallelLimit2.default; -exports.priorityQueue = _priorityQueue2.default; -exports.queue = _queue2.default; -exports.race = _race2.default; -exports.reduce = _reduce2.default; -exports.reduceRight = _reduceRight2.default; -exports.reflect = _reflect2.default; -exports.reflectAll = _reflectAll2.default; -exports.reject = _reject2.default; -exports.rejectLimit = _rejectLimit2.default; -exports.rejectSeries = _rejectSeries2.default; -exports.retry = _retry2.default; -exports.retryable = _retryable2.default; -exports.seq = _seq2.default; -exports.series = _series2.default; -exports.setImmediate = _setImmediate2.default; -exports.some = _some2.default; -exports.someLimit = _someLimit2.default; -exports.someSeries = _someSeries2.default; -exports.sortBy = _sortBy2.default; -exports.timeout = _timeout2.default; -exports.times = _times2.default; -exports.timesLimit = _timesLimit2.default; -exports.timesSeries = _timesSeries2.default; -exports.transform = _transform2.default; -exports.tryEach = _tryEach2.default; -exports.unmemoize = _unmemoize2.default; -exports.until = _until2.default; -exports.waterfall = _waterfall2.default; -exports.whilst = _whilst2.default; -exports.all = _every2.default; -exports.allLimit = _everyLimit2.default; -exports.allSeries = _everySeries2.default; -exports.any = _some2.default; -exports.anyLimit = _someLimit2.default; -exports.anySeries = _someSeries2.default; -exports.find = _detect2.default; -exports.findLimit = _detectLimit2.default; -exports.findSeries = _detectSeries2.default; -exports.flatMap = _concat2.default; -exports.flatMapLimit = _concatLimit2.default; -exports.flatMapSeries = _concatSeries2.default; -exports.forEach = _each2.default; -exports.forEachSeries = _eachSeries2.default; -exports.forEachLimit = _eachLimit2.default; -exports.forEachOf = _eachOf2.default; -exports.forEachOfSeries = _eachOfSeries2.default; -exports.forEachOfLimit = _eachOfLimit2.default; -exports.inject = _reduce2.default; -exports.foldl = _reduce2.default; -exports.foldr = _reduceRight2.default; -exports.select = _filter2.default; -exports.selectLimit = _filterLimit2.default; -exports.selectSeries = _filterSeries2.default; -exports.wrapSync = _asyncify2.default; -exports.during = _whilst2.default; -exports.doDuring = _doWhilst2.default; \ No newline at end of file diff --git a/node_modules/async/inject.js b/node_modules/async/inject.js deleted file mode 100644 index e7816830..00000000 --- a/node_modules/async/inject.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Reduces `coll` into a single value using an async `iteratee` to return each - * successive step. `memo` is the initial state of the reduction. This function - * only operates in series. - * - * For performance reasons, it may make sense to split a call to this function - * into a parallel map, and then use the normal `Array.prototype.reduce` on the - * results. This function is for situations where each step in the reduction - * needs to be async; if you can get the data before reducing it, then it's - * probably a good idea to do so. - * - * @name reduce - * @static - * @memberOf module:Collections - * @method - * @alias inject - * @alias foldl - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.reduce([1,2,3], 0, function(memo, item, callback) { - * // pointless async: - * process.nextTick(function() { - * callback(null, memo + item) - * }); - * }, function(err, result) { - * // result is now equal to the last value of memo, which is 6 - * }); - */ -function reduce(coll, memo, iteratee, callback) { - callback = (0, _once2.default)(callback); - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _eachOfSeries2.default)(coll, (x, i, iterCb) => { - _iteratee(memo, x, (err, v) => { - memo = v; - iterCb(err); - }); - }, err => callback(err, memo)); -} -exports.default = (0, _awaitify2.default)(reduce, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/DoublyLinkedList.js b/node_modules/async/internal/DoublyLinkedList.js deleted file mode 100644 index cd11c3b3..00000000 --- a/node_modules/async/internal/DoublyLinkedList.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation -// used for queues. This implementation assumes that the node provided by the user can be modified -// to adjust the next and last properties. We implement only the minimal functionality -// for queue support. -class DLL { - constructor() { - this.head = this.tail = null; - this.length = 0; - } - - removeLink(node) { - if (node.prev) node.prev.next = node.next;else this.head = node.next; - if (node.next) node.next.prev = node.prev;else this.tail = node.prev; - - node.prev = node.next = null; - this.length -= 1; - return node; - } - - empty() { - while (this.head) this.shift(); - return this; - } - - insertAfter(node, newNode) { - newNode.prev = node; - newNode.next = node.next; - if (node.next) node.next.prev = newNode;else this.tail = newNode; - node.next = newNode; - this.length += 1; - } - - insertBefore(node, newNode) { - newNode.prev = node.prev; - newNode.next = node; - if (node.prev) node.prev.next = newNode;else this.head = newNode; - node.prev = newNode; - this.length += 1; - } - - unshift(node) { - if (this.head) this.insertBefore(this.head, node);else setInitial(this, node); - } - - push(node) { - if (this.tail) this.insertAfter(this.tail, node);else setInitial(this, node); - } - - shift() { - return this.head && this.removeLink(this.head); - } - - pop() { - return this.tail && this.removeLink(this.tail); - } - - toArray() { - return [...this]; - } - - *[Symbol.iterator]() { - var cur = this.head; - while (cur) { - yield cur.data; - cur = cur.next; - } - } - - remove(testFn) { - var curr = this.head; - while (curr) { - var { next } = curr; - if (testFn(curr)) { - this.removeLink(curr); - } - curr = next; - } - return this; - } -} - -exports.default = DLL; -function setInitial(dll, node) { - dll.length = 1; - dll.head = dll.tail = node; -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/Heap.js b/node_modules/async/internal/Heap.js deleted file mode 100644 index 80762fe0..00000000 --- a/node_modules/async/internal/Heap.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -// Binary min-heap implementation used for priority queue. -// Implementation is stable, i.e. push time is considered for equal priorities -class Heap { - constructor() { - this.heap = []; - this.pushCount = Number.MIN_SAFE_INTEGER; - } - - get length() { - return this.heap.length; - } - - empty() { - this.heap = []; - return this; - } - - percUp(index) { - let p; - - while (index > 0 && smaller(this.heap[index], this.heap[p = parent(index)])) { - let t = this.heap[index]; - this.heap[index] = this.heap[p]; - this.heap[p] = t; - - index = p; - } - } - - percDown(index) { - let l; - - while ((l = leftChi(index)) < this.heap.length) { - if (l + 1 < this.heap.length && smaller(this.heap[l + 1], this.heap[l])) { - l = l + 1; - } - - if (smaller(this.heap[index], this.heap[l])) { - break; - } - - let t = this.heap[index]; - this.heap[index] = this.heap[l]; - this.heap[l] = t; - - index = l; - } - } - - push(node) { - node.pushCount = ++this.pushCount; - this.heap.push(node); - this.percUp(this.heap.length - 1); - } - - unshift(node) { - return this.heap.push(node); - } - - shift() { - let [top] = this.heap; - - this.heap[0] = this.heap[this.heap.length - 1]; - this.heap.pop(); - this.percDown(0); - - return top; - } - - toArray() { - return [...this]; - } - - *[Symbol.iterator]() { - for (let i = 0; i < this.heap.length; i++) { - yield this.heap[i].data; - } - } - - remove(testFn) { - let j = 0; - for (let i = 0; i < this.heap.length; i++) { - if (!testFn(this.heap[i])) { - this.heap[j] = this.heap[i]; - j++; - } - } - - this.heap.splice(j); - - for (let i = parent(this.heap.length - 1); i >= 0; i--) { - this.percDown(i); - } - - return this; - } -} - -exports.default = Heap; -function leftChi(i) { - return (i << 1) + 1; -} - -function parent(i) { - return (i + 1 >> 1) - 1; -} - -function smaller(x, y) { - if (x.priority !== y.priority) { - return x.priority < y.priority; - } else { - return x.pushCount < y.pushCount; - } -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/applyEach.js b/node_modules/async/internal/applyEach.js deleted file mode 100644 index 3c3c6f66..00000000 --- a/node_modules/async/internal/applyEach.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (eachfn) { - return function applyEach(fns, ...callArgs) { - const go = (0, _awaitify2.default)(function (callback) { - var that = this; - return eachfn(fns, (fn, cb) => { - (0, _wrapAsync2.default)(fn).apply(that, callArgs.concat(cb)); - }, callback); - }); - return go; - }; -}; - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/asyncEachOfLimit.js b/node_modules/async/internal/asyncEachOfLimit.js deleted file mode 100644 index df228c73..00000000 --- a/node_modules/async/internal/asyncEachOfLimit.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = asyncEachOfLimit; - -var _breakLoop = require('./breakLoop'); - -var _breakLoop2 = _interopRequireDefault(_breakLoop); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// for async generators -function asyncEachOfLimit(generator, limit, iteratee, callback) { - let done = false; - let canceled = false; - let awaiting = false; - let running = 0; - let idx = 0; - - function replenish() { - //console.log('replenish') - if (running >= limit || awaiting || done) return; - //console.log('replenish awaiting') - awaiting = true; - generator.next().then(({ value, done: iterDone }) => { - //console.log('got value', value) - if (canceled || done) return; - awaiting = false; - if (iterDone) { - done = true; - if (running <= 0) { - //console.log('done nextCb') - callback(null); - } - return; - } - running++; - iteratee(value, idx, iterateeCallback); - idx++; - replenish(); - }).catch(handleError); - } - - function iterateeCallback(err, result) { - //console.log('iterateeCallback') - running -= 1; - if (canceled) return; - if (err) return handleError(err); - - if (err === false) { - done = true; - canceled = true; - return; - } - - if (result === _breakLoop2.default || done && running <= 0) { - done = true; - //console.log('done iterCb') - return callback(null); - } - replenish(); - } - - function handleError(err) { - if (canceled) return; - awaiting = false; - done = true; - callback(err); - } - - replenish(); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/awaitify.js b/node_modules/async/internal/awaitify.js deleted file mode 100644 index 7b36f1ac..00000000 --- a/node_modules/async/internal/awaitify.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = awaitify; -// conditionally promisify a function. -// only return a promise if a callback is omitted -function awaitify(asyncFn, arity = asyncFn.length) { - if (!arity) throw new Error('arity is undefined'); - function awaitable(...args) { - if (typeof args[arity - 1] === 'function') { - return asyncFn.apply(this, args); - } - - return new Promise((resolve, reject) => { - args[arity - 1] = (err, ...cbArgs) => { - if (err) return reject(err); - resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]); - }; - asyncFn.apply(this, args); - }); - } - - return awaitable; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/breakLoop.js b/node_modules/async/internal/breakLoop.js deleted file mode 100644 index 8245e553..00000000 --- a/node_modules/async/internal/breakLoop.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -// A temporary value used to identify if the loop should be broken. -// See #1064, #1293 -const breakLoop = {}; -exports.default = breakLoop; -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/consoleFunc.js b/node_modules/async/internal/consoleFunc.js deleted file mode 100644 index 1e592734..00000000 --- a/node_modules/async/internal/consoleFunc.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = consoleFunc; - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function consoleFunc(name) { - return (fn, ...args) => (0, _wrapAsync2.default)(fn)(...args, (err, ...resultArgs) => { - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } else if (console[name]) { - resultArgs.forEach(x => console[name](x)); - } - } - }); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/createTester.js b/node_modules/async/internal/createTester.js deleted file mode 100644 index 7df34987..00000000 --- a/node_modules/async/internal/createTester.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _createTester; - -var _breakLoop = require('./breakLoop'); - -var _breakLoop2 = _interopRequireDefault(_breakLoop); - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _createTester(check, getResult) { - return (eachfn, arr, _iteratee, cb) => { - var testPassed = false; - var testResult; - const iteratee = (0, _wrapAsync2.default)(_iteratee); - eachfn(arr, (value, _, callback) => { - iteratee(value, (err, result) => { - if (err || err === false) return callback(err); - - if (check(result) && !testResult) { - testPassed = true; - testResult = getResult(true, value); - return callback(null, _breakLoop2.default); - } - callback(); - }); - }, err => { - if (err) return cb(err); - cb(null, testPassed ? testResult : getResult(false)); - }); - }; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/eachOfLimit.js b/node_modules/async/internal/eachOfLimit.js deleted file mode 100644 index 69e22a29..00000000 --- a/node_modules/async/internal/eachOfLimit.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _once = require('./once'); - -var _once2 = _interopRequireDefault(_once); - -var _iterator = require('./iterator'); - -var _iterator2 = _interopRequireDefault(_iterator); - -var _onlyOnce = require('./onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./wrapAsync'); - -var _asyncEachOfLimit = require('./asyncEachOfLimit'); - -var _asyncEachOfLimit2 = _interopRequireDefault(_asyncEachOfLimit); - -var _breakLoop = require('./breakLoop'); - -var _breakLoop2 = _interopRequireDefault(_breakLoop); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = limit => { - return (obj, iteratee, callback) => { - callback = (0, _once2.default)(callback); - if (limit <= 0) { - throw new RangeError('concurrency limit cannot be less than 1'); - } - if (!obj) { - return callback(null); - } - if ((0, _wrapAsync.isAsyncGenerator)(obj)) { - return (0, _asyncEachOfLimit2.default)(obj, limit, iteratee, callback); - } - if ((0, _wrapAsync.isAsyncIterable)(obj)) { - return (0, _asyncEachOfLimit2.default)(obj[Symbol.asyncIterator](), limit, iteratee, callback); - } - var nextElem = (0, _iterator2.default)(obj); - var done = false; - var canceled = false; - var running = 0; - var looping = false; - - function iterateeCallback(err, value) { - if (canceled) return; - running -= 1; - if (err) { - done = true; - callback(err); - } else if (err === false) { - done = true; - canceled = true; - } else if (value === _breakLoop2.default || done && running <= 0) { - done = true; - return callback(null); - } else if (!looping) { - replenish(); - } - } - - function replenish() { - looping = true; - while (running < limit && !done) { - var elem = nextElem(); - if (elem === null) { - done = true; - if (running <= 0) { - callback(null); - } - return; - } - running += 1; - iteratee(elem.value, elem.key, (0, _onlyOnce2.default)(iterateeCallback)); - } - looping = false; - } - - replenish(); - }; -}; - -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/filter.js b/node_modules/async/internal/filter.js deleted file mode 100644 index df68185e..00000000 --- a/node_modules/async/internal/filter.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _filter; - -var _isArrayLike = require('./isArrayLike'); - -var _isArrayLike2 = _interopRequireDefault(_isArrayLike); - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function filterArray(eachfn, arr, iteratee, callback) { - var truthValues = new Array(arr.length); - eachfn(arr, (x, index, iterCb) => { - iteratee(x, (err, v) => { - truthValues[index] = !!v; - iterCb(err); - }); - }, err => { - if (err) return callback(err); - var results = []; - for (var i = 0; i < arr.length; i++) { - if (truthValues[i]) results.push(arr[i]); - } - callback(null, results); - }); -} - -function filterGeneric(eachfn, coll, iteratee, callback) { - var results = []; - eachfn(coll, (x, index, iterCb) => { - iteratee(x, (err, v) => { - if (err) return iterCb(err); - if (v) { - results.push({ index, value: x }); - } - iterCb(err); - }); - }, err => { - if (err) return callback(err); - callback(null, results.sort((a, b) => a.index - b.index).map(v => v.value)); - }); -} - -function _filter(eachfn, coll, iteratee, callback) { - var filter = (0, _isArrayLike2.default)(coll) ? filterArray : filterGeneric; - return filter(eachfn, coll, (0, _wrapAsync2.default)(iteratee), callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/getIterator.js b/node_modules/async/internal/getIterator.js deleted file mode 100644 index 830a5452..00000000 --- a/node_modules/async/internal/getIterator.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (coll) { - return coll[Symbol.iterator] && coll[Symbol.iterator](); -}; - -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/initialParams.js b/node_modules/async/internal/initialParams.js deleted file mode 100644 index 245378cf..00000000 --- a/node_modules/async/internal/initialParams.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (fn) { - return function (...args /*, callback*/) { - var callback = args.pop(); - return fn.call(this, args, callback); - }; -}; - -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/isArrayLike.js b/node_modules/async/internal/isArrayLike.js deleted file mode 100644 index ce076704..00000000 --- a/node_modules/async/internal/isArrayLike.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isArrayLike; -function isArrayLike(value) { - return value && typeof value.length === 'number' && value.length >= 0 && value.length % 1 === 0; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/iterator.js b/node_modules/async/internal/iterator.js deleted file mode 100644 index a49b8bbc..00000000 --- a/node_modules/async/internal/iterator.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = createIterator; - -var _isArrayLike = require('./isArrayLike'); - -var _isArrayLike2 = _interopRequireDefault(_isArrayLike); - -var _getIterator = require('./getIterator'); - -var _getIterator2 = _interopRequireDefault(_getIterator); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function createArrayIterator(coll) { - var i = -1; - var len = coll.length; - return function next() { - return ++i < len ? { value: coll[i], key: i } : null; - }; -} - -function createES2015Iterator(iterator) { - var i = -1; - return function next() { - var item = iterator.next(); - if (item.done) return null; - i++; - return { value: item.value, key: i }; - }; -} - -function createObjectIterator(obj) { - var okeys = obj ? Object.keys(obj) : []; - var i = -1; - var len = okeys.length; - return function next() { - var key = okeys[++i]; - return i < len ? { value: obj[key], key } : null; - }; -} - -function createIterator(coll) { - if ((0, _isArrayLike2.default)(coll)) { - return createArrayIterator(coll); - } - - var iterator = (0, _getIterator2.default)(coll); - return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/map.js b/node_modules/async/internal/map.js deleted file mode 100644 index 27a6481e..00000000 --- a/node_modules/async/internal/map.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _asyncMap; - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _asyncMap(eachfn, arr, iteratee, callback) { - arr = arr || []; - var results = []; - var counter = 0; - var _iteratee = (0, _wrapAsync2.default)(iteratee); - - return eachfn(arr, (value, _, iterCb) => { - var index = counter++; - _iteratee(value, (err, v) => { - results[index] = v; - iterCb(err); - }); - }, err => { - callback(err, results); - }); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/once.js b/node_modules/async/internal/once.js deleted file mode 100644 index 49f37270..00000000 --- a/node_modules/async/internal/once.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = once; -function once(fn) { - function wrapper(...args) { - if (fn === null) return; - var callFn = fn; - fn = null; - callFn.apply(this, args); - } - Object.assign(wrapper, fn); - return wrapper; -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/onlyOnce.js b/node_modules/async/internal/onlyOnce.js deleted file mode 100644 index 6ad721bd..00000000 --- a/node_modules/async/internal/onlyOnce.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = onlyOnce; -function onlyOnce(fn) { - return function (...args) { - if (fn === null) throw new Error("Callback was already called."); - var callFn = fn; - fn = null; - callFn.apply(this, args); - }; -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/parallel.js b/node_modules/async/internal/parallel.js deleted file mode 100644 index 183c6678..00000000 --- a/node_modules/async/internal/parallel.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _isArrayLike = require('./isArrayLike'); - -var _isArrayLike2 = _interopRequireDefault(_isArrayLike); - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = (0, _awaitify2.default)((eachfn, tasks, callback) => { - var results = (0, _isArrayLike2.default)(tasks) ? [] : {}; - - eachfn(tasks, (task, key, taskCb) => { - (0, _wrapAsync2.default)(task)((err, ...result) => { - if (result.length < 2) { - [result] = result; - } - results[key] = result; - taskCb(err); - }); - }, err => callback(err, results)); -}, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/promiseCallback.js b/node_modules/async/internal/promiseCallback.js deleted file mode 100644 index 17a83016..00000000 --- a/node_modules/async/internal/promiseCallback.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -const PROMISE_SYMBOL = Symbol('promiseCallback'); - -function promiseCallback() { - let resolve, reject; - function callback(err, ...args) { - if (err) return reject(err); - resolve(args.length > 1 ? args : args[0]); - } - - callback[PROMISE_SYMBOL] = new Promise((res, rej) => { - resolve = res, reject = rej; - }); - - return callback; -} - -exports.promiseCallback = promiseCallback; -exports.PROMISE_SYMBOL = PROMISE_SYMBOL; \ No newline at end of file diff --git a/node_modules/async/internal/queue.js b/node_modules/async/internal/queue.js deleted file mode 100644 index 8973d98d..00000000 --- a/node_modules/async/internal/queue.js +++ /dev/null @@ -1,291 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = queue; - -var _onlyOnce = require('./onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _setImmediate = require('./setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -var _DoublyLinkedList = require('./DoublyLinkedList'); - -var _DoublyLinkedList2 = _interopRequireDefault(_DoublyLinkedList); - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function queue(worker, concurrency, payload) { - if (concurrency == null) { - concurrency = 1; - } else if (concurrency === 0) { - throw new RangeError('Concurrency must not be zero'); - } - - var _worker = (0, _wrapAsync2.default)(worker); - var numRunning = 0; - var workersList = []; - const events = { - error: [], - drain: [], - saturated: [], - unsaturated: [], - empty: [] - }; - - function on(event, handler) { - events[event].push(handler); - } - - function once(event, handler) { - const handleAndRemove = (...args) => { - off(event, handleAndRemove); - handler(...args); - }; - events[event].push(handleAndRemove); - } - - function off(event, handler) { - if (!event) return Object.keys(events).forEach(ev => events[ev] = []); - if (!handler) return events[event] = []; - events[event] = events[event].filter(ev => ev !== handler); - } - - function trigger(event, ...args) { - events[event].forEach(handler => handler(...args)); - } - - var processingScheduled = false; - function _insert(data, insertAtFront, rejectOnError, callback) { - if (callback != null && typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - - var res, rej; - function promiseCallback(err, ...args) { - // we don't care about the error, let the global error handler - // deal with it - if (err) return rejectOnError ? rej(err) : res(); - if (args.length <= 1) return res(args[0]); - res(args); - } - - var item = { - data, - callback: rejectOnError ? promiseCallback : callback || promiseCallback - }; - - if (insertAtFront) { - q._tasks.unshift(item); - } else { - q._tasks.push(item); - } - - if (!processingScheduled) { - processingScheduled = true; - (0, _setImmediate2.default)(() => { - processingScheduled = false; - q.process(); - }); - } - - if (rejectOnError || !callback) { - return new Promise((resolve, reject) => { - res = resolve; - rej = reject; - }); - } - } - - function _createCB(tasks) { - return function (err, ...args) { - numRunning -= 1; - - for (var i = 0, l = tasks.length; i < l; i++) { - var task = tasks[i]; - - var index = workersList.indexOf(task); - if (index === 0) { - workersList.shift(); - } else if (index > 0) { - workersList.splice(index, 1); - } - - task.callback(err, ...args); - - if (err != null) { - trigger('error', err, task.data); - } - } - - if (numRunning <= q.concurrency - q.buffer) { - trigger('unsaturated'); - } - - if (q.idle()) { - trigger('drain'); - } - q.process(); - }; - } - - function _maybeDrain(data) { - if (data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - (0, _setImmediate2.default)(() => trigger('drain')); - return true; - } - return false; - } - - const eventMethod = name => handler => { - if (!handler) { - return new Promise((resolve, reject) => { - once(name, (err, data) => { - if (err) return reject(err); - resolve(data); - }); - }); - } - off(name); - on(name, handler); - }; - - var isProcessing = false; - var q = { - _tasks: new _DoublyLinkedList2.default(), - *[Symbol.iterator]() { - yield* q._tasks[Symbol.iterator](); - }, - concurrency, - payload, - buffer: concurrency / 4, - started: false, - paused: false, - push(data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return; - return data.map(datum => _insert(datum, false, false, callback)); - } - return _insert(data, false, false, callback); - }, - pushAsync(data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return; - return data.map(datum => _insert(datum, false, true, callback)); - } - return _insert(data, false, true, callback); - }, - kill() { - off(); - q._tasks.empty(); - }, - unshift(data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return; - return data.map(datum => _insert(datum, true, false, callback)); - } - return _insert(data, true, false, callback); - }, - unshiftAsync(data, callback) { - if (Array.isArray(data)) { - if (_maybeDrain(data)) return; - return data.map(datum => _insert(datum, true, true, callback)); - } - return _insert(data, true, true, callback); - }, - remove(testFn) { - q._tasks.remove(testFn); - }, - process() { - // Avoid trying to start too many processing operations. This can occur - // when callbacks resolve synchronously (#1267). - if (isProcessing) { - return; - } - isProcessing = true; - while (!q.paused && numRunning < q.concurrency && q._tasks.length) { - var tasks = [], - data = []; - var l = q._tasks.length; - if (q.payload) l = Math.min(l, q.payload); - for (var i = 0; i < l; i++) { - var node = q._tasks.shift(); - tasks.push(node); - workersList.push(node); - data.push(node.data); - } - - numRunning += 1; - - if (q._tasks.length === 0) { - trigger('empty'); - } - - if (numRunning === q.concurrency) { - trigger('saturated'); - } - - var cb = (0, _onlyOnce2.default)(_createCB(tasks)); - _worker(data, cb); - } - isProcessing = false; - }, - length() { - return q._tasks.length; - }, - running() { - return numRunning; - }, - workersList() { - return workersList; - }, - idle() { - return q._tasks.length + numRunning === 0; - }, - pause() { - q.paused = true; - }, - resume() { - if (q.paused === false) { - return; - } - q.paused = false; - (0, _setImmediate2.default)(q.process); - } - }; - // define these as fixed properties, so people get useful errors when updating - Object.defineProperties(q, { - saturated: { - writable: false, - value: eventMethod('saturated') - }, - unsaturated: { - writable: false, - value: eventMethod('unsaturated') - }, - empty: { - writable: false, - value: eventMethod('empty') - }, - drain: { - writable: false, - value: eventMethod('drain') - }, - error: { - writable: false, - value: eventMethod('error') - } - }); - return q; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/range.js b/node_modules/async/internal/range.js deleted file mode 100644 index 6680e642..00000000 --- a/node_modules/async/internal/range.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = range; -function range(size) { - var result = Array(size); - while (size--) { - result[size] = size; - } - return result; -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/reject.js b/node_modules/async/internal/reject.js deleted file mode 100644 index ba6cddac..00000000 --- a/node_modules/async/internal/reject.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = reject; - -var _filter = require('./filter'); - -var _filter2 = _interopRequireDefault(_filter); - -var _wrapAsync = require('./wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function reject(eachfn, arr, _iteratee, callback) { - const iteratee = (0, _wrapAsync2.default)(_iteratee); - return (0, _filter2.default)(eachfn, arr, (value, cb) => { - iteratee(value, (err, v) => { - cb(err, !v); - }); - }, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/internal/setImmediate.js b/node_modules/async/internal/setImmediate.js deleted file mode 100644 index d0505c7d..00000000 --- a/node_modules/async/internal/setImmediate.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -/* istanbul ignore file */ - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.fallback = fallback; -exports.wrap = wrap; -var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate; -var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; - -function fallback(fn) { - setTimeout(fn, 0); -} - -function wrap(defer) { - return (fn, ...args) => defer(() => fn(...args)); -} - -var _defer; - -if (hasSetImmediate) { - _defer = setImmediate; -} else if (hasNextTick) { - _defer = process.nextTick; -} else { - _defer = fallback; -} - -exports.default = wrap(_defer); \ No newline at end of file diff --git a/node_modules/async/internal/withoutIndex.js b/node_modules/async/internal/withoutIndex.js deleted file mode 100644 index ec45fa35..00000000 --- a/node_modules/async/internal/withoutIndex.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _withoutIndex; -function _withoutIndex(iteratee) { - return (value, index, callback) => iteratee(value, callback); -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/internal/wrapAsync.js b/node_modules/async/internal/wrapAsync.js deleted file mode 100644 index 5719450a..00000000 --- a/node_modules/async/internal/wrapAsync.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isAsyncIterable = exports.isAsyncGenerator = exports.isAsync = undefined; - -var _asyncify = require('../asyncify'); - -var _asyncify2 = _interopRequireDefault(_asyncify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isAsync(fn) { - return fn[Symbol.toStringTag] === 'AsyncFunction'; -} - -function isAsyncGenerator(fn) { - return fn[Symbol.toStringTag] === 'AsyncGenerator'; -} - -function isAsyncIterable(obj) { - return typeof obj[Symbol.asyncIterator] === 'function'; -} - -function wrapAsync(asyncFn) { - if (typeof asyncFn !== 'function') throw new Error('expected a function'); - return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn; -} - -exports.default = wrapAsync; -exports.isAsync = isAsync; -exports.isAsyncGenerator = isAsyncGenerator; -exports.isAsyncIterable = isAsyncIterable; \ No newline at end of file diff --git a/node_modules/async/log.js b/node_modules/async/log.js deleted file mode 100644 index c643867b..00000000 --- a/node_modules/async/log.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _consoleFunc = require('./internal/consoleFunc'); - -var _consoleFunc2 = _interopRequireDefault(_consoleFunc); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Logs the result of an `async` function to the `console`. Only works in - * Node.js or in browsers that support `console.log` and `console.error` (such - * as FF and Chrome). If multiple arguments are returned from the async - * function, `console.log` is called on each argument in order. - * - * @name log - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. - * @example - * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, 'hello ' + name); - * }, 1000); - * }; - * - * // in the node repl - * node> async.log(hello, 'world'); - * 'hello world' - */ -exports.default = (0, _consoleFunc2.default)('log'); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/map.js b/node_modules/async/map.js deleted file mode 100644 index 2d85f2e2..00000000 --- a/node_modules/async/map.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _map2 = require('./internal/map'); - -var _map3 = _interopRequireDefault(_map2); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Produces a new collection of values by mapping each value in `coll` through - * the `iteratee` function. The `iteratee` is called with an item from `coll` - * and a callback for when it has finished processing. Each of these callback - * takes 2 arguments: an `error`, and the transformed item from `coll`. If - * `iteratee` passes an error to its callback, the main `callback` (for the - * `map` function) is immediately called with the error. - * - * Note, that since this function applies the `iteratee` to each item in - * parallel, there is no guarantee that the `iteratee` functions will complete - * in order. However, the results array will be in the same order as the - * original `coll`. - * - * If `map` is passed an Object, the results will be an Array. The results - * will roughly be in the order of the original Objects' keys (but this can - * vary across JavaScript engines). - * - * @name map - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an Array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.map(['file1','file2','file3'], fs.stat, function(err, results) { - * // results is now an array of stats for each file - * }); - */ -function map(coll, iteratee, callback) { - return (0, _map3.default)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(map, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/mapLimit.js b/node_modules/async/mapLimit.js deleted file mode 100644 index 0f390ab6..00000000 --- a/node_modules/async/mapLimit.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _map2 = require('./internal/map'); - -var _map3 = _interopRequireDefault(_map2); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. - * - * @name mapLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function mapLimit(coll, limit, iteratee, callback) { - return (0, _map3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(mapLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/mapSeries.js b/node_modules/async/mapSeries.js deleted file mode 100644 index 973033a0..00000000 --- a/node_modules/async/mapSeries.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _map2 = require('./internal/map'); - -var _map3 = _interopRequireDefault(_map2); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. - * - * @name mapSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function mapSeries(coll, iteratee, callback) { - return (0, _map3.default)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(mapSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/mapValues.js b/node_modules/async/mapValues.js deleted file mode 100644 index 7eab584e..00000000 --- a/node_modules/async/mapValues.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = mapValues; - -var _mapValuesLimit = require('./mapValuesLimit'); - -var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. - * - * Produces a new Object by mapping each value of `obj` through the `iteratee` - * function. The `iteratee` is called each `value` and `key` from `obj` and a - * callback for when it has finished processing. Each of these callbacks takes - * two arguments: an `error`, and the transformed item from `obj`. If `iteratee` - * passes an error to its callback, the main `callback` (for the `mapValues` - * function) is immediately called with the error. - * - * Note, the order of the keys in the result is not guaranteed. The keys will - * be roughly in the order they complete, (but this is very engine-specific) - * - * @name mapValues - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.mapValues({ - * f1: 'file1', - * f2: 'file2', - * f3: 'file3' - * }, function (file, key, callback) { - * fs.stat(file, callback); - * }, function(err, result) { - * // result is now a map of stats for each file, e.g. - * // { - * // f1: [stats for file1], - * // f2: [stats for file2], - * // f3: [stats for file3] - * // } - * }); - */ -function mapValues(obj, iteratee, callback) { - return (0, _mapValuesLimit2.default)(obj, Infinity, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/mapValuesLimit.js b/node_modules/async/mapValuesLimit.js deleted file mode 100644 index 15cda346..00000000 --- a/node_modules/async/mapValuesLimit.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a - * time. - * - * @name mapValuesLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - */ -function mapValuesLimit(obj, limit, iteratee, callback) { - callback = (0, _once2.default)(callback); - var newObj = {}; - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _eachOfLimit2.default)(limit)(obj, (val, key, next) => { - _iteratee(val, key, (err, result) => { - if (err) return next(err); - newObj[key] = result; - next(err); - }); - }, err => callback(err, newObj)); -} - -exports.default = (0, _awaitify2.default)(mapValuesLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/mapValuesSeries.js b/node_modules/async/mapValuesSeries.js deleted file mode 100644 index f0dda6b9..00000000 --- a/node_modules/async/mapValuesSeries.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = mapValuesSeries; - -var _mapValuesLimit = require('./mapValuesLimit'); - -var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. - * - * @name mapValuesSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback is passed - */ -function mapValuesSeries(obj, iteratee, callback) { - return (0, _mapValuesLimit2.default)(obj, 1, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/memoize.js b/node_modules/async/memoize.js deleted file mode 100644 index 425f93b9..00000000 --- a/node_modules/async/memoize.js +++ /dev/null @@ -1,91 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = memoize; - -var _setImmediate = require('./internal/setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -var _initialParams = require('./internal/initialParams'); - -var _initialParams2 = _interopRequireDefault(_initialParams); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Caches the results of an async function. When creating a hash to store - * function results against, the callback is omitted from the hash and an - * optional hash function can be used. - * - * **Note: if the async function errs, the result will not be cached and - * subsequent calls will call the wrapped function.** - * - * If no hash function is specified, the first argument is used as a hash key, - * which may work reasonably if it is a string or a data type that converts to a - * distinct string. Note that objects and arrays will not behave reasonably. - * Neither will cases where the other arguments are significant. In such cases, - * specify your own hash function. - * - * The cache of results is exposed as the `memo` property of the function - * returned by `memoize`. - * - * @name memoize - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - The async function to proxy and cache results from. - * @param {Function} hasher - An optional function for generating a custom hash - * for storing results. It has all the arguments applied to it apart from the - * callback, and must be synchronous. - * @returns {AsyncFunction} a memoized version of `fn` - * @example - * - * var slow_fn = function(name, callback) { - * // do something - * callback(null, result); - * }; - * var fn = async.memoize(slow_fn); - * - * // fn can now be used as if it were slow_fn - * fn('some name', function() { - * // callback - * }); - */ -function memoize(fn, hasher = v => v) { - var memo = Object.create(null); - var queues = Object.create(null); - var _fn = (0, _wrapAsync2.default)(fn); - var memoized = (0, _initialParams2.default)((args, callback) => { - var key = hasher(...args); - if (key in memo) { - (0, _setImmediate2.default)(() => callback(null, ...memo[key])); - } else if (key in queues) { - queues[key].push(callback); - } else { - queues[key] = [callback]; - _fn(...args, (err, ...resultArgs) => { - // #1465 don't memoize if an error occurred - if (!err) { - memo[key] = resultArgs; - } - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i](err, ...resultArgs); - } - }); - } - }); - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/nextTick.js b/node_modules/async/nextTick.js deleted file mode 100644 index a55b6921..00000000 --- a/node_modules/async/nextTick.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; -/* istanbul ignore file */ - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _setImmediate = require('./internal/setImmediate'); - -/** - * Calls `callback` on a later loop around the event loop. In Node.js this just - * calls `process.nextTick`. In the browser it will use `setImmediate` if - * available, otherwise `setTimeout(callback, 0)`, which means other higher - * priority events may precede the execution of `callback`. - * - * This is used internally for browser-compatibility purposes. - * - * @name nextTick - * @static - * @memberOf module:Utils - * @method - * @see [async.setImmediate]{@link module:Utils.setImmediate} - * @category Util - * @param {Function} callback - The function to call on a later loop around - * the event loop. Invoked with (args...). - * @param {...*} args... - any number of additional arguments to pass to the - * callback on the next tick. - * @example - * - * var call_order = []; - * async.nextTick(function() { - * call_order.push('two'); - * // call_order now equals ['one','two'] - * }); - * call_order.push('one'); - * - * async.setImmediate(function (a, b, c) { - * // a, b, and c equal 1, 2, and 3 - * }, 1, 2, 3); - */ -var _defer; - -if (_setImmediate.hasNextTick) { - _defer = process.nextTick; -} else if (_setImmediate.hasSetImmediate) { - _defer = setImmediate; -} else { - _defer = _setImmediate.fallback; -} - -exports.default = (0, _setImmediate.wrap)(_defer); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/package.json b/node_modules/async/package.json deleted file mode 100644 index fcfab2d0..00000000 --- a/node_modules/async/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "_from": "async@^3.2.0", - "_id": "async@3.2.0", - "_inBundle": false, - "_integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==", - "_location": "/async", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "async@^3.2.0", - "name": "async", - "escapedName": "async", - "rawSpec": "^3.2.0", - "saveSpec": null, - "fetchSpec": "^3.2.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "_shasum": "b3a2685c5ebb641d3de02d161002c60fc9f85720", - "_spec": "async@^3.2.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "Caolan McMahon" - }, - "bugs": { - "url": "https://github.com/caolan/async/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Higher-order functions and common patterns for asynchronous code", - "devDependencies": { - "babel-core": "^6.26.3", - "babel-eslint": "^8.2.6", - "babel-minify": "^0.5.0", - "babel-plugin-add-module-exports": "^0.2.1", - "babel-plugin-istanbul": "^5.1.4", - "babel-plugin-syntax-async-generators": "^6.13.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", - "babel-preset-es2015": "^6.3.13", - "babel-preset-es2017": "^6.22.0", - "babel-register": "^6.26.0", - "babelify": "^8.0.0", - "benchmark": "^2.1.1", - "bluebird": "^3.4.6", - "browserify": "^16.2.3", - "chai": "^4.2.0", - "cheerio": "^0.22.0", - "coveralls": "^3.0.4", - "es6-promise": "^2.3.0", - "eslint": "^6.0.1", - "eslint-plugin-prefer-arrow": "^1.1.5", - "fs-extra": "^0.26.7", - "jsdoc": "^3.6.2", - "karma": "^4.1.0", - "karma-browserify": "^5.3.0", - "karma-edge-launcher": "^0.4.2", - "karma-firefox-launcher": "^1.1.0", - "karma-junit-reporter": "^1.2.0", - "karma-mocha": "^1.2.0", - "karma-mocha-reporter": "^2.2.0", - "karma-safari-launcher": "^1.0.0", - "mocha": "^6.1.4", - "mocha-junit-reporter": "^1.18.0", - "native-promise-only": "^0.8.0-a", - "nyc": "^14.1.1", - "rimraf": "^2.5.0", - "rollup": "^0.63.4", - "rollup-plugin-node-resolve": "^2.0.0", - "rollup-plugin-npm": "^2.0.0", - "rsvp": "^3.0.18", - "semver": "^5.5.0", - "yargs": "^11.0.0" - }, - "homepage": "https://caolan.github.io/async/", - "keywords": [ - "async", - "callback", - "module", - "utility" - ], - "license": "MIT", - "main": "dist/async.js", - "module": "dist/async.mjs", - "name": "async", - "nyc": { - "exclude": [ - "test" - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/caolan/async.git" - }, - "scripts": { - "coverage": "nyc npm run mocha-node-test -- --grep @nycinvalid --invert", - "coveralls": "npm run coverage && nyc report --reporter=text-lcov | coveralls", - "jsdoc": "jsdoc -c ./support/jsdoc/jsdoc.json && node support/jsdoc/jsdoc-fix-html.js", - "lint": "eslint --fix lib/ test/ perf/memory.js perf/suites.js perf/benchmark.js support/build/ support/*.js karma.conf.js", - "mocha-browser-test": "karma start", - "mocha-node-test": "mocha", - "mocha-test": "npm run mocha-node-test && npm run mocha-browser-test", - "test": "npm run lint && npm run mocha-node-test" - }, - "version": "3.2.0" -} diff --git a/node_modules/async/parallel.js b/node_modules/async/parallel.js deleted file mode 100644 index a36b0458..00000000 --- a/node_modules/async/parallel.js +++ /dev/null @@ -1,91 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = parallel; - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _parallel2 = require('./internal/parallel'); - -var _parallel3 = _interopRequireDefault(_parallel2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Run the `tasks` collection of functions in parallel, without waiting until - * the previous function has completed. If any of the functions pass an error to - * its callback, the main `callback` is immediately called with the value of the - * error. Once the `tasks` have completed, the results are passed to the final - * `callback` as an array. - * - * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about - * parallel execution of code. If your tasks do not use any timers or perform - * any I/O, they will actually be executed in series. Any synchronous setup - * sections for each task will happen one after the other. JavaScript remains - * single-threaded. - * - * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the - * execution of other tasks when a task fails. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.parallel}. - * - * @name parallel - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - * - * @example - * async.parallel([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // optional callback - * function(err, results) { - * // the results array will equal ['one','two'] even though - * // the second function had a shorter timeout. - * }); - * - * // an example using an object instead of an array - * async.parallel({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback) { - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equals to: {one: 1, two: 2} - * }); - */ -function parallel(tasks, callback) { - return (0, _parallel3.default)(_eachOf2.default, tasks, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/parallelLimit.js b/node_modules/async/parallelLimit.js deleted file mode 100644 index f01a6188..00000000 --- a/node_modules/async/parallelLimit.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = parallelLimit; - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _parallel = require('./internal/parallel'); - -var _parallel2 = _interopRequireDefault(_parallel); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a - * time. - * - * @name parallelLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.parallel]{@link module:ControlFlow.parallel} - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). - * @returns {Promise} a promise, if a callback is not passed - */ -function parallelLimit(tasks, limit, callback) { - return (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/priorityQueue.js b/node_modules/async/priorityQueue.js deleted file mode 100644 index ed0e6b6b..00000000 --- a/node_modules/async/priorityQueue.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (worker, concurrency) { - // Start with a normal queue - var q = (0, _queue2.default)(worker, concurrency); - - q._tasks = new _Heap2.default(); - - // Override push to accept second parameter representing priority - q.push = function (data, priority = 0, callback = () => {}) { - if (typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - if (!Array.isArray(data)) { - data = [data]; - } - if (data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - return (0, _setImmediate2.default)(() => q.drain()); - } - - for (var i = 0, l = data.length; i < l; i++) { - var item = { - data: data[i], - priority, - callback - }; - - q._tasks.push(item); - } - - (0, _setImmediate2.default)(q.process); - }; - - // Remove unshift function - delete q.unshift; - - return q; -}; - -var _setImmediate = require('./setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -var _queue = require('./queue'); - -var _queue2 = _interopRequireDefault(_queue); - -var _Heap = require('./internal/Heap'); - -var _Heap2 = _interopRequireDefault(_Heap); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -module.exports = exports['default']; - -/** - * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and - * completed in ascending priority order. - * - * @name priorityQueue - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. - * Invoked with (task, callback). - * @param {number} concurrency - An `integer` for determining how many `worker` - * functions should be run in parallel. If omitted, the concurrency defaults to - * `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two - * differences between `queue` and `priorityQueue` objects: - * * `push(task, priority, [callback])` - `priority` should be a number. If an - * array of `tasks` is given, all tasks will be assigned the same priority. - * * The `unshift` method was removed. - */ \ No newline at end of file diff --git a/node_modules/async/queue.js b/node_modules/async/queue.js deleted file mode 100644 index 3550a0e2..00000000 --- a/node_modules/async/queue.js +++ /dev/null @@ -1,167 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (worker, concurrency) { - var _worker = (0, _wrapAsync2.default)(worker); - return (0, _queue2.default)((items, cb) => { - _worker(items[0], cb); - }, concurrency, 1); -}; - -var _queue = require('./internal/queue'); - -var _queue2 = _interopRequireDefault(_queue); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -module.exports = exports['default']; - -/** - * A queue of tasks for the worker function to complete. - * @typedef {Iterable} QueueObject - * @memberOf module:ControlFlow - * @property {Function} length - a function returning the number of items - * waiting to be processed. Invoke with `queue.length()`. - * @property {boolean} started - a boolean indicating whether or not any - * items have been pushed and processed by the queue. - * @property {Function} running - a function returning the number of items - * currently being processed. Invoke with `queue.running()`. - * @property {Function} workersList - a function returning the array of items - * currently being processed. Invoke with `queue.workersList()`. - * @property {Function} idle - a function returning false if there are items - * waiting or being processed, or true if not. Invoke with `queue.idle()`. - * @property {number} concurrency - an integer for determining how many `worker` - * functions should be run in parallel. This property can be changed after a - * `queue` is created to alter the concurrency on-the-fly. - * @property {number} payload - an integer that specifies how many items are - * passed to the worker function at a time. only applies if this is a - * [cargo]{@link module:ControlFlow.cargo} object - * @property {AsyncFunction} push - add a new task to the `queue`. Calls `callback` - * once the `worker` has finished processing the task. Instead of a single task, - * a `tasks` array can be submitted. The respective callback is used for every - * task in the list. Invoke with `queue.push(task, [callback])`, - * @property {AsyncFunction} unshift - add a new task to the front of the `queue`. - * Invoke with `queue.unshift(task, [callback])`. - * @property {AsyncFunction} pushAsync - the same as `q.push`, except this returns - * a promise that rejects if an error occurs. - * @property {AsyncFunction} unshirtAsync - the same as `q.unshift`, except this returns - * a promise that rejects if an error occurs. - * @property {Function} remove - remove items from the queue that match a test - * function. The test function will be passed an object with a `data` property, - * and a `priority` property, if this is a - * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. - * Invoked with `queue.remove(testFn)`, where `testFn` is of the form - * `function ({data, priority}) {}` and returns a Boolean. - * @property {Function} saturated - a function that sets a callback that is - * called when the number of running workers hits the `concurrency` limit, and - * further tasks will be queued. If the callback is omitted, `q.saturated()` - * returns a promise for the next occurrence. - * @property {Function} unsaturated - a function that sets a callback that is - * called when the number of running workers is less than the `concurrency` & - * `buffer` limits, and further tasks will not be queued. If the callback is - * omitted, `q.unsaturated()` returns a promise for the next occurrence. - * @property {number} buffer - A minimum threshold buffer in order to say that - * the `queue` is `unsaturated`. - * @property {Function} empty - a function that sets a callback that is called - * when the last item from the `queue` is given to a `worker`. If the callback - * is omitted, `q.empty()` returns a promise for the next occurrence. - * @property {Function} drain - a function that sets a callback that is called - * when the last item from the `queue` has returned from the `worker`. If the - * callback is omitted, `q.drain()` returns a promise for the next occurrence. - * @property {Function} error - a function that sets a callback that is called - * when a task errors. Has the signature `function(error, task)`. If the - * callback is omitted, `error()` returns a promise that rejects on the next - * error. - * @property {boolean} paused - a boolean for determining whether the queue is - * in a paused state. - * @property {Function} pause - a function that pauses the processing of tasks - * until `resume()` is called. Invoke with `queue.pause()`. - * @property {Function} resume - a function that resumes the processing of - * queued tasks when the queue is paused. Invoke with `queue.resume()`. - * @property {Function} kill - a function that removes the `drain` callback and - * empties remaining tasks from the queue forcing it to go idle. No more tasks - * should be pushed to the queue after calling this function. Invoke with `queue.kill()`. - * - * @example - * const q = aync.queue(worker, 2) - * q.push(item1) - * q.push(item2) - * q.push(item3) - * // queues are iterable, spread into an array to inspect - * const items = [...q] // [item1, item2, item3] - * // or use for of - * for (let item of q) { - * console.log(item) - * } - * - * q.drain(() => { - * console.log('all done') - * }) - * // or - * await q.drain() - */ - -/** - * Creates a `queue` object with the specified `concurrency`. Tasks added to the - * `queue` are processed in parallel (up to the `concurrency` limit). If all - * `worker`s are in progress, the task is queued until one becomes available. - * Once a `worker` completes a `task`, that `task`'s callback is called. - * - * @name queue - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. Invoked with (task, callback). - * @param {number} [concurrency=1] - An `integer` for determining how many - * `worker` functions should be run in parallel. If omitted, the concurrency - * defaults to `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can be - * attached as certain properties to listen for specific events during the - * lifecycle of the queue. - * @example - * - * // create a queue object with concurrency 2 - * var q = async.queue(function(task, callback) { - * console.log('hello ' + task.name); - * callback(); - * }, 2); - * - * // assign a callback - * q.drain(function() { - * console.log('all items have been processed'); - * }); - * // or await the end - * await q.drain() - * - * // assign an error callback - * q.error(function(err, task) { - * console.error('task experienced an error'); - * }); - * - * // add some items to the queue - * q.push({name: 'foo'}, function(err) { - * console.log('finished processing foo'); - * }); - * // callback is optional - * q.push({name: 'bar'}); - * - * // add some items to the queue (batch-wise) - * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { - * console.log('finished processing item'); - * }); - * - * // add some items to the front of the queue - * q.unshift({name: 'bar'}, function (err) { - * console.log('finished processing bar'); - * }); - */ \ No newline at end of file diff --git a/node_modules/async/race.js b/node_modules/async/race.js deleted file mode 100644 index 3003064c..00000000 --- a/node_modules/async/race.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Runs the `tasks` array of functions in parallel, without waiting until the - * previous function has completed. Once any of the `tasks` complete or pass an - * error to its callback, the main `callback` is immediately called. It's - * equivalent to `Promise.race()`. - * - * @name race - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction} - * to run. Each function can complete with an optional `result` value. - * @param {Function} callback - A callback to run once any of the functions have - * completed. This function gets an error or result from the first function that - * completed. Invoked with (err, result). - * @returns undefined - * @example - * - * async.race([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // main callback - * function(err, result) { - * // the result will be equal to 'two' as it finishes earlier - * }); - */ -function race(tasks, callback) { - callback = (0, _once2.default)(callback); - if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); - if (!tasks.length) return callback(); - for (var i = 0, l = tasks.length; i < l; i++) { - (0, _wrapAsync2.default)(tasks[i])(callback); - } -} - -exports.default = (0, _awaitify2.default)(race, 2); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/reduce.js b/node_modules/async/reduce.js deleted file mode 100644 index e7816830..00000000 --- a/node_modules/async/reduce.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Reduces `coll` into a single value using an async `iteratee` to return each - * successive step. `memo` is the initial state of the reduction. This function - * only operates in series. - * - * For performance reasons, it may make sense to split a call to this function - * into a parallel map, and then use the normal `Array.prototype.reduce` on the - * results. This function is for situations where each step in the reduction - * needs to be async; if you can get the data before reducing it, then it's - * probably a good idea to do so. - * - * @name reduce - * @static - * @memberOf module:Collections - * @method - * @alias inject - * @alias foldl - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.reduce([1,2,3], 0, function(memo, item, callback) { - * // pointless async: - * process.nextTick(function() { - * callback(null, memo + item) - * }); - * }, function(err, result) { - * // result is now equal to the last value of memo, which is 6 - * }); - */ -function reduce(coll, memo, iteratee, callback) { - callback = (0, _once2.default)(callback); - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _eachOfSeries2.default)(coll, (x, i, iterCb) => { - _iteratee(memo, x, (err, v) => { - memo = v; - iterCb(err); - }); - }, err => callback(err, memo)); -} -exports.default = (0, _awaitify2.default)(reduce, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/reduceRight.js b/node_modules/async/reduceRight.js deleted file mode 100644 index e3da2a4d..00000000 --- a/node_modules/async/reduceRight.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = reduceRight; - -var _reduce = require('./reduce'); - -var _reduce2 = _interopRequireDefault(_reduce); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. - * - * @name reduceRight - * @static - * @memberOf module:Collections - * @method - * @see [async.reduce]{@link module:Collections.reduce} - * @alias foldr - * @category Collection - * @param {Array} array - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @returns {Promise} a promise, if no callback is passed - */ -function reduceRight(array, memo, iteratee, callback) { - var reversed = [...array].reverse(); - return (0, _reduce2.default)(reversed, memo, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/reflect.js b/node_modules/async/reflect.js deleted file mode 100644 index 937937c8..00000000 --- a/node_modules/async/reflect.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = reflect; - -var _initialParams = require('./internal/initialParams'); - -var _initialParams2 = _interopRequireDefault(_initialParams); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Wraps the async function in another function that always completes with a - * result object, even when it errors. - * - * The result object has either the property `error` or `value`. - * - * @name reflect - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - The async function you want to wrap - * @returns {Function} - A function that always passes null to it's callback as - * the error. The second argument to the callback will be an `object` with - * either an `error` or a `value` property. - * @example - * - * async.parallel([ - * async.reflect(function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }), - * async.reflect(function(callback) { - * // do some more stuff but error ... - * callback('bad stuff happened'); - * }), - * async.reflect(function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * }) - * ], - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = 'bad stuff happened' - * // results[2].value = 'two' - * }); - */ -function reflect(fn) { - var _fn = (0, _wrapAsync2.default)(fn); - return (0, _initialParams2.default)(function reflectOn(args, reflectCallback) { - args.push((error, ...cbArgs) => { - let retVal = {}; - if (error) { - retVal.error = error; - } - if (cbArgs.length > 0) { - var value = cbArgs; - if (cbArgs.length <= 1) { - [value] = cbArgs; - } - retVal.value = value; - } - reflectCallback(null, retVal); - }); - - return _fn.apply(this, args); - }); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/reflectAll.js b/node_modules/async/reflectAll.js deleted file mode 100644 index 112a307c..00000000 --- a/node_modules/async/reflectAll.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = reflectAll; - -var _reflect = require('./reflect'); - -var _reflect2 = _interopRequireDefault(_reflect); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * A helper function that wraps an array or an object of functions with `reflect`. - * - * @name reflectAll - * @static - * @memberOf module:Utils - * @method - * @see [async.reflect]{@link module:Utils.reflect} - * @category Util - * @param {Array|Object|Iterable} tasks - The collection of - * [async functions]{@link AsyncFunction} to wrap in `async.reflect`. - * @returns {Array} Returns an array of async functions, each wrapped in - * `async.reflect` - * @example - * - * let tasks = [ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * // do some more stuff but error ... - * callback(new Error('bad stuff happened')); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ]; - * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = Error('bad stuff happened') - * // results[2].value = 'two' - * }); - * - * // an example using an object instead of an array - * let tasks = { - * one: function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * two: function(callback) { - * callback('two'); - * }, - * three: function(callback) { - * setTimeout(function() { - * callback(null, 'three'); - * }, 100); - * } - * }; - * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results.one.value = 'one' - * // results.two.error = 'two' - * // results.three.value = 'three' - * }); - */ -function reflectAll(tasks) { - var results; - if (Array.isArray(tasks)) { - results = tasks.map(_reflect2.default); - } else { - results = {}; - Object.keys(tasks).forEach(key => { - results[key] = _reflect2.default.call(this, tasks[key]); - }); - } - return results; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/reject.js b/node_modules/async/reject.js deleted file mode 100644 index 12f175a0..00000000 --- a/node_modules/async/reject.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _reject2 = require('./internal/reject'); - -var _reject3 = _interopRequireDefault(_reject2); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. - * - * @name reject - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * - * async.reject(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of missing files - * createFiles(results); - * }); - */ -function reject(coll, iteratee, callback) { - return (0, _reject3.default)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(reject, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/rejectLimit.js b/node_modules/async/rejectLimit.js deleted file mode 100644 index 9f0bb3fb..00000000 --- a/node_modules/async/rejectLimit.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _reject2 = require('./internal/reject'); - -var _reject3 = _interopRequireDefault(_reject2); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a - * time. - * - * @name rejectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.reject]{@link module:Collections.reject} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function rejectLimit(coll, limit, iteratee, callback) { - return (0, _reject3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(rejectLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/rejectSeries.js b/node_modules/async/rejectSeries.js deleted file mode 100644 index 7803a14b..00000000 --- a/node_modules/async/rejectSeries.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _reject2 = require('./internal/reject'); - -var _reject3 = _interopRequireDefault(_reject2); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. - * - * @name rejectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.reject]{@link module:Collections.reject} - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback is passed - */ -function rejectSeries(coll, iteratee, callback) { - return (0, _reject3.default)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(rejectSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/retry.js b/node_modules/async/retry.js deleted file mode 100644 index a8f67eea..00000000 --- a/node_modules/async/retry.js +++ /dev/null @@ -1,159 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = retry; - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _promiseCallback = require('./internal/promiseCallback'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function constant(value) { - return function () { - return value; - }; -} - -/** - * Attempts to get a successful response from `task` no more than `times` times - * before returning an error. If the task is successful, the `callback` will be - * passed the result of the successful task. If all attempts fail, the callback - * will be passed the error and result (if any) of the final attempt. - * - * @name retry - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @see [async.retryable]{@link module:ControlFlow.retryable} - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an - * object with `times` and `interval` or a number. - * * `times` - The number of attempts to make before giving up. The default - * is `5`. - * * `interval` - The time to wait between retries, in milliseconds. The - * default is `0`. The interval may also be specified as a function of the - * retry count (see example). - * * `errorFilter` - An optional synchronous function that is invoked on - * erroneous result. If it returns `true` the retry attempts will continue; - * if the function returns `false` the retry flow is aborted with the current - * attempt's error and result being returned to the final callback. - * Invoked with (err). - * * If `opts` is a number, the number specifies the number of times to retry, - * with the default interval of `0`. - * @param {AsyncFunction} task - An async function to retry. - * Invoked with (callback). - * @param {Function} [callback] - An optional callback which is called when the - * task has succeeded, or after the final failed attempt. It receives the `err` - * and `result` arguments of the last attempt at completing the `task`. Invoked - * with (err, results). - * @returns {Promise} a promise if no callback provided - * - * @example - * - * // The `retry` function can be used as a stand-alone control flow by passing - * // a callback, as shown below: - * - * // try calling apiMethod 3 times - * async.retry(3, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod 3 times, waiting 200 ms between each retry - * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod 10 times with exponential backoff - * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) - * async.retry({ - * times: 10, - * interval: function(retryCount) { - * return 50 * Math.pow(2, retryCount); - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod the default 5 times no delay between each retry - * async.retry(apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // try calling apiMethod only when error condition satisfies, all other - * // errors will abort the retry control flow and return to final callback - * async.retry({ - * errorFilter: function(err) { - * return err.message === 'Temporary error'; // only retry on a specific error - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); - * - * // to retry individual methods that are not as reliable within other - * // control flow functions, use the `retryable` wrapper: - * async.auto({ - * users: api.getUsers.bind(api), - * payments: async.retryable(3, api.getPayments.bind(api)) - * }, function(err, results) { - * // do something with the results - * }); - * - */ -const DEFAULT_TIMES = 5; -const DEFAULT_INTERVAL = 0; - -function retry(opts, task, callback) { - var options = { - times: DEFAULT_TIMES, - intervalFunc: constant(DEFAULT_INTERVAL) - }; - - if (arguments.length < 3 && typeof opts === 'function') { - callback = task || (0, _promiseCallback.promiseCallback)(); - task = opts; - } else { - parseTimes(options, opts); - callback = callback || (0, _promiseCallback.promiseCallback)(); - } - - if (typeof task !== 'function') { - throw new Error("Invalid arguments for async.retry"); - } - - var _task = (0, _wrapAsync2.default)(task); - - var attempt = 1; - function retryAttempt() { - _task((err, ...args) => { - if (err === false) return; - if (err && attempt++ < options.times && (typeof options.errorFilter != 'function' || options.errorFilter(err))) { - setTimeout(retryAttempt, options.intervalFunc(attempt - 1)); - } else { - callback(err, ...args); - } - }); - } - - retryAttempt(); - return callback[_promiseCallback.PROMISE_SYMBOL]; -} - -function parseTimes(acc, t) { - if (typeof t === 'object') { - acc.times = +t.times || DEFAULT_TIMES; - - acc.intervalFunc = typeof t.interval === 'function' ? t.interval : constant(+t.interval || DEFAULT_INTERVAL); - - acc.errorFilter = t.errorFilter; - } else if (typeof t === 'number' || typeof t === 'string') { - acc.times = +t || DEFAULT_TIMES; - } else { - throw new Error("Invalid arguments for async.retry"); - } -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/retryable.js b/node_modules/async/retryable.js deleted file mode 100644 index cdfa866d..00000000 --- a/node_modules/async/retryable.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = retryable; - -var _retry = require('./retry'); - -var _retry2 = _interopRequireDefault(_retry); - -var _initialParams = require('./internal/initialParams'); - -var _initialParams2 = _interopRequireDefault(_initialParams); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _promiseCallback = require('./internal/promiseCallback'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method - * wraps a task and makes it retryable, rather than immediately calling it - * with retries. - * - * @name retryable - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.retry]{@link module:ControlFlow.retry} - * @category Control Flow - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional - * options, exactly the same as from `retry`, except for a `opts.arity` that - * is the arity of the `task` function, defaulting to `task.length` - * @param {AsyncFunction} task - the asynchronous function to wrap. - * This function will be passed any arguments passed to the returned wrapper. - * Invoked with (...args, callback). - * @returns {AsyncFunction} The wrapped function, which when invoked, will - * retry on an error, based on the parameters specified in `opts`. - * This function will accept the same parameters as `task`. - * @example - * - * async.auto({ - * dep1: async.retryable(3, getFromFlakyService), - * process: ["dep1", async.retryable(3, function (results, cb) { - * maybeProcessData(results.dep1, cb); - * })] - * }, callback); - */ -function retryable(opts, task) { - if (!task) { - task = opts; - opts = null; - } - let arity = opts && opts.arity || task.length; - if ((0, _wrapAsync.isAsync)(task)) { - arity += 1; - } - var _task = (0, _wrapAsync2.default)(task); - return (0, _initialParams2.default)((args, callback) => { - if (args.length < arity - 1 || callback == null) { - args.push(callback); - callback = (0, _promiseCallback.promiseCallback)(); - } - function taskFn(cb) { - _task(...args, cb); - } - - if (opts) (0, _retry2.default)(opts, taskFn, callback);else (0, _retry2.default)(taskFn, callback); - - return callback[_promiseCallback.PROMISE_SYMBOL]; - }); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/select.js b/node_modules/async/select.js deleted file mode 100644 index fadd16a7..00000000 --- a/node_modules/async/select.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _filter2 = require('./internal/filter'); - -var _filter3 = _interopRequireDefault(_filter2); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns a new array of all the values in `coll` which pass an async truth - * test. This operation is performed in parallel, but the results array will be - * in the same order as the original. - * - * @name filter - * @static - * @memberOf module:Collections - * @method - * @alias select - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.filter(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of the existing files - * }); - */ -function filter(coll, iteratee, callback) { - return (0, _filter3.default)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(filter, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/selectLimit.js b/node_modules/async/selectLimit.js deleted file mode 100644 index 7fdee119..00000000 --- a/node_modules/async/selectLimit.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _filter2 = require('./internal/filter'); - -var _filter3 = _interopRequireDefault(_filter2); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a - * time. - * - * @name filterLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @returns {Promise} a promise, if no callback provided - */ -function filterLimit(coll, limit, iteratee, callback) { - return (0, _filter3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(filterLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/selectSeries.js b/node_modules/async/selectSeries.js deleted file mode 100644 index ee8bde9d..00000000 --- a/node_modules/async/selectSeries.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _filter2 = require('./internal/filter'); - -var _filter3 = _interopRequireDefault(_filter2); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. - * - * @name filterSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectSeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results) - * @returns {Promise} a promise, if no callback provided - */ -function filterSeries(coll, iteratee, callback) { - return (0, _filter3.default)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(filterSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/seq.js b/node_modules/async/seq.js deleted file mode 100644 index cd0a0b5d..00000000 --- a/node_modules/async/seq.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = seq; - -var _reduce = require('./reduce'); - -var _reduce2 = _interopRequireDefault(_reduce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _promiseCallback = require('./internal/promiseCallback'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Version of the compose function that is more natural to read. Each function - * consumes the return value of the previous function. It is the equivalent of - * [compose]{@link module:ControlFlow.compose} with the arguments reversed. - * - * Each function is executed with the `this` binding of the composed function. - * - * @name seq - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.compose]{@link module:ControlFlow.compose} - * @category Control Flow - * @param {...AsyncFunction} functions - the asynchronous functions to compose - * @returns {Function} a function that composes the `functions` in order - * @example - * - * // Requires lodash (or underscore), express3 and dresende's orm2. - * // Part of an app, that fetches cats of the logged user. - * // This example uses `seq` function to avoid overnesting and error - * // handling clutter. - * app.get('/cats', function(request, response) { - * var User = request.models.User; - * async.seq( - * _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - * function(user, fn) { - * user.getCats(fn); // 'getCats' has signature (callback(err, data)) - * } - * )(req.session.user_id, function (err, cats) { - * if (err) { - * console.error(err); - * response.json({ status: 'error', message: err.message }); - * } else { - * response.json({ status: 'ok', message: 'Cats found', data: cats }); - * } - * }); - * }); - */ -function seq(...functions) { - var _functions = functions.map(_wrapAsync2.default); - return function (...args) { - var that = this; - - var cb = args[args.length - 1]; - if (typeof cb == 'function') { - args.pop(); - } else { - cb = (0, _promiseCallback.promiseCallback)(); - } - - (0, _reduce2.default)(_functions, args, (newargs, fn, iterCb) => { - fn.apply(that, newargs.concat((err, ...nextargs) => { - iterCb(err, nextargs); - })); - }, (err, results) => cb(err, ...results)); - - return cb[_promiseCallback.PROMISE_SYMBOL]; - }; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/series.js b/node_modules/async/series.js deleted file mode 100644 index e3c29545..00000000 --- a/node_modules/async/series.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = series; - -var _parallel2 = require('./internal/parallel'); - -var _parallel3 = _interopRequireDefault(_parallel2); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Run the functions in the `tasks` collection in series, each one running once - * the previous function has completed. If any functions in the series pass an - * error to its callback, no more functions are run, and `callback` is - * immediately called with the value of the error. Otherwise, `callback` - * receives an array of results when `tasks` have completed. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function, and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.series}. - * - * **Note** that while many implementations preserve the order of object - * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) - * explicitly states that - * - * > The mechanics and order of enumerating the properties is not specified. - * - * So if you rely on the order in which your series of functions are executed, - * and want this to work on all platforms, consider using an array. - * - * @name series - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing - * [async functions]{@link AsyncFunction} to run in series. - * Each function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed. This function gets a results array (or object) - * containing all the result arguments passed to the `task` callbacks. Invoked - * with (err, result). - * @return {Promise} a promise, if no callback is passed - * @example - * async.series([ - * function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }, - * function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * } - * ], - * // optional callback - * function(err, results) { - * // results is now equal to ['one', 'two'] - * }); - * - * async.series({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback){ - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equal to: {one: 1, two: 2} - * }); - */ -function series(tasks, callback) { - return (0, _parallel3.default)(_eachOfSeries2.default, tasks, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/setImmediate.js b/node_modules/async/setImmediate.js deleted file mode 100644 index e52f7c54..00000000 --- a/node_modules/async/setImmediate.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _setImmediate = require('./internal/setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Calls `callback` on a later loop around the event loop. In Node.js this just - * calls `setImmediate`. In the browser it will use `setImmediate` if - * available, otherwise `setTimeout(callback, 0)`, which means other higher - * priority events may precede the execution of `callback`. - * - * This is used internally for browser-compatibility purposes. - * - * @name setImmediate - * @static - * @memberOf module:Utils - * @method - * @see [async.nextTick]{@link module:Utils.nextTick} - * @category Util - * @param {Function} callback - The function to call on a later loop around - * the event loop. Invoked with (args...). - * @param {...*} args... - any number of additional arguments to pass to the - * callback on the next tick. - * @example - * - * var call_order = []; - * async.nextTick(function() { - * call_order.push('two'); - * // call_order now equals ['one','two'] - * }); - * call_order.push('one'); - * - * async.setImmediate(function (a, b, c) { - * // a, b, and c equal 1, 2, and 3 - * }, 1, 2, 3); - */ -exports.default = _setImmediate2.default; -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/some.js b/node_modules/async/some.js deleted file mode 100644 index 0e987a16..00000000 --- a/node_modules/async/some.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Returns `true` if at least one element in the `coll` satisfies an async test. - * If any iteratee call returns `true`, the main `callback` is immediately - * called. - * - * @name some - * @static - * @memberOf module:Collections - * @method - * @alias any - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.some(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then at least one of the files exists - * }); - */ -function some(coll, iteratee, callback) { - return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(some, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/someLimit.js b/node_modules/async/someLimit.js deleted file mode 100644 index 22b60dbb..00000000 --- a/node_modules/async/someLimit.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfLimit = require('./internal/eachOfLimit'); - -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. - * - * @name someLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anyLimit - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function someLimit(coll, limit, iteratee, callback) { - return (0, _createTester2.default)(Boolean, res => res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(someLimit, 4); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/someSeries.js b/node_modules/async/someSeries.js deleted file mode 100644 index 7f7f801f..00000000 --- a/node_modules/async/someSeries.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createTester = require('./internal/createTester'); - -var _createTester2 = _interopRequireDefault(_createTester); - -var _eachOfSeries = require('./eachOfSeries'); - -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. - * - * @name someSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anySeries - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in series. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - */ -function someSeries(coll, iteratee, callback) { - return (0, _createTester2.default)(Boolean, res => res)(_eachOfSeries2.default, coll, iteratee, callback); -} -exports.default = (0, _awaitify2.default)(someSeries, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/sortBy.js b/node_modules/async/sortBy.js deleted file mode 100644 index da0075e6..00000000 --- a/node_modules/async/sortBy.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _map = require('./map'); - -var _map2 = _interopRequireDefault(_map); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Sorts a list by the results of running each `coll` value through an async - * `iteratee`. - * - * @name sortBy - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a value to use as the sort criteria as - * its `result`. - * Invoked with (item, callback). - * @param {Function} callback - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is the items - * from the original `coll` sorted by the values returned by the `iteratee` - * calls. Invoked with (err, results). - * @returns {Promise} a promise, if no callback passed - * @example - * - * async.sortBy(['file1','file2','file3'], function(file, callback) { - * fs.stat(file, function(err, stats) { - * callback(err, stats.mtime); - * }); - * }, function(err, results) { - * // results is now the original array of files sorted by - * // modified date - * }); - * - * // By modifying the callback parameter the - * // sorting order can be influenced: - * - * // ascending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x); - * }, function(err,result) { - * // result callback - * }); - * - * // descending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x*-1); //<- x*-1 instead of x, turns the order around - * }, function(err,result) { - * // result callback - * }); - */ -function sortBy(coll, iteratee, callback) { - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _map2.default)(coll, (x, iterCb) => { - _iteratee(x, (err, criteria) => { - if (err) return iterCb(err); - iterCb(err, { value: x, criteria }); - }); - }, (err, results) => { - if (err) return callback(err); - callback(null, results.sort(comparator).map(v => v.value)); - }); - - function comparator(left, right) { - var a = left.criteria, - b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } -} -exports.default = (0, _awaitify2.default)(sortBy, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/timeout.js b/node_modules/async/timeout.js deleted file mode 100644 index 8bbfc3a8..00000000 --- a/node_modules/async/timeout.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = timeout; - -var _initialParams = require('./internal/initialParams'); - -var _initialParams2 = _interopRequireDefault(_initialParams); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Sets a time limit on an asynchronous function. If the function does not call - * its callback within the specified milliseconds, it will be called with a - * timeout error. The code property for the error object will be `'ETIMEDOUT'`. - * - * @name timeout - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} asyncFn - The async function to limit in time. - * @param {number} milliseconds - The specified time limit. - * @param {*} [info] - Any variable you want attached (`string`, `object`, etc) - * to timeout Error for more information.. - * @returns {AsyncFunction} Returns a wrapped function that can be used with any - * of the control flow functions. - * Invoke this function with the same parameters as you would `asyncFunc`. - * @example - * - * function myFunction(foo, callback) { - * doAsyncTask(foo, function(err, data) { - * // handle errors - * if (err) return callback(err); - * - * // do some stuff ... - * - * // return processed data - * return callback(null, data); - * }); - * } - * - * var wrapped = async.timeout(myFunction, 1000); - * - * // call `wrapped` as you would `myFunction` - * wrapped({ bar: 'bar' }, function(err, data) { - * // if `myFunction` takes < 1000 ms to execute, `err` - * // and `data` will have their expected values - * - * // else `err` will be an Error with the code 'ETIMEDOUT' - * }); - */ -function timeout(asyncFn, milliseconds, info) { - var fn = (0, _wrapAsync2.default)(asyncFn); - - return (0, _initialParams2.default)((args, callback) => { - var timedOut = false; - var timer; - - function timeoutCallback() { - var name = asyncFn.name || 'anonymous'; - var error = new Error('Callback function "' + name + '" timed out.'); - error.code = 'ETIMEDOUT'; - if (info) { - error.info = info; - } - timedOut = true; - callback(error); - } - - args.push((...cbArgs) => { - if (!timedOut) { - callback(...cbArgs); - clearTimeout(timer); - } - }); - - // setup timer and call original function - timer = setTimeout(timeoutCallback, milliseconds); - fn(...args); - }); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/times.js b/node_modules/async/times.js deleted file mode 100644 index f294d025..00000000 --- a/node_modules/async/times.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = times; - -var _timesLimit = require('./timesLimit'); - -var _timesLimit2 = _interopRequireDefault(_timesLimit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Calls the `iteratee` function `n` times, and accumulates results in the same - * manner you would use with [map]{@link module:Collections.map}. - * - * @name times - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.map]{@link module:Collections.map} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - * @example - * - * // Pretend this is some complicated async factory - * var createUser = function(id, callback) { - * callback(null, { - * id: 'user' + id - * }); - * }; - * - * // generate 5 users - * async.times(5, function(n, next) { - * createUser(n, function(err, user) { - * next(err, user); - * }); - * }, function(err, users) { - * // we should now have 5 users - * }); - */ -function times(n, iteratee, callback) { - return (0, _timesLimit2.default)(n, Infinity, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/timesLimit.js b/node_modules/async/timesLimit.js deleted file mode 100644 index 38d776a3..00000000 --- a/node_modules/async/timesLimit.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = timesLimit; - -var _mapLimit = require('./mapLimit'); - -var _mapLimit2 = _interopRequireDefault(_mapLimit); - -var _range = require('./internal/range'); - -var _range2 = _interopRequireDefault(_range); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a - * time. - * - * @name timesLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} count - The number of times to run the function. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see [async.map]{@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - */ -function timesLimit(count, limit, iteratee, callback) { - var _iteratee = (0, _wrapAsync2.default)(iteratee); - return (0, _mapLimit2.default)((0, _range2.default)(count), limit, _iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/timesSeries.js b/node_modules/async/timesSeries.js deleted file mode 100644 index 267a6389..00000000 --- a/node_modules/async/timesSeries.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = timesSeries; - -var _timesLimit = require('./timesLimit'); - -var _timesLimit2 = _interopRequireDefault(_timesLimit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. - * - * @name timesSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. - * @returns {Promise} a promise, if no callback is provided - */ -function timesSeries(n, iteratee, callback) { - return (0, _timesLimit2.default)(n, 1, iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/transform.js b/node_modules/async/transform.js deleted file mode 100644 index 9483c2bd..00000000 --- a/node_modules/async/transform.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = transform; - -var _eachOf = require('./eachOf'); - -var _eachOf2 = _interopRequireDefault(_eachOf); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _promiseCallback = require('./internal/promiseCallback'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * A relative of `reduce`. Takes an Object or Array, and iterates over each - * element in parallel, each step potentially mutating an `accumulator` value. - * The type of the accumulator defaults to the type of collection passed in. - * - * @name transform - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. - * @param {*} [accumulator] - The initial state of the transform. If omitted, - * it will default to an empty Object or Array, depending on the type of `coll` - * @param {AsyncFunction} iteratee - A function applied to each item in the - * collection that potentially modifies the accumulator. - * Invoked with (accumulator, item, key, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the transformed accumulator. - * Invoked with (err, result). - * @returns {Promise} a promise, if no callback provided - * @example - * - * async.transform([1,2,3], function(acc, item, index, callback) { - * // pointless async: - * process.nextTick(function() { - * acc[index] = item * 2 - * callback(null) - * }); - * }, function(err, result) { - * // result is now equal to [2, 4, 6] - * }); - * - * @example - * - * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { - * setImmediate(function () { - * obj[key] = val * 2; - * callback(); - * }) - * }, function (err, result) { - * // result is equal to {a: 2, b: 4, c: 6} - * }) - */ -function transform(coll, accumulator, iteratee, callback) { - if (arguments.length <= 3 && typeof accumulator === 'function') { - callback = iteratee; - iteratee = accumulator; - accumulator = Array.isArray(coll) ? [] : {}; - } - callback = (0, _once2.default)(callback || (0, _promiseCallback.promiseCallback)()); - var _iteratee = (0, _wrapAsync2.default)(iteratee); - - (0, _eachOf2.default)(coll, (v, k, cb) => { - _iteratee(accumulator, v, k, cb); - }, err => callback(err, accumulator)); - return callback[_promiseCallback.PROMISE_SYMBOL]; -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/tryEach.js b/node_modules/async/tryEach.js deleted file mode 100644 index 7544d64b..00000000 --- a/node_modules/async/tryEach.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _eachSeries = require('./eachSeries'); - -var _eachSeries2 = _interopRequireDefault(_eachSeries); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * It runs each task in series but stops whenever any of the functions were - * successful. If one of the tasks were successful, the `callback` will be - * passed the result of the successful task. If all tasks fail, the callback - * will be passed the error and result (if any) of the final attempt. - * - * @name tryEach - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to - * run, each function is passed a `callback(err, result)` it must call on - * completion with an error `err` (which can be `null`) and an optional `result` - * value. - * @param {Function} [callback] - An optional callback which is called when one - * of the tasks has succeeded, or all have failed. It receives the `err` and - * `result` arguments of the last attempt at completing the `task`. Invoked with - * (err, results). - * @returns {Promise} a promise, if no callback is passed - * @example - * async.tryEach([ - * function getDataFromFirstWebsite(callback) { - * // Try getting the data from the first website - * callback(err, data); - * }, - * function getDataFromSecondWebsite(callback) { - * // First website failed, - * // Try getting the data from the backup website - * callback(err, data); - * } - * ], - * // optional callback - * function(err, results) { - * Now do something with the data. - * }); - * - */ -function tryEach(tasks, callback) { - var error = null; - var result; - return (0, _eachSeries2.default)(tasks, (task, taskCb) => { - (0, _wrapAsync2.default)(task)((err, ...args) => { - if (err === false) return taskCb(err); - - if (args.length < 2) { - [result] = args; - } else { - result = args; - } - error = err; - taskCb(err ? null : {}); - }); - }, () => callback(error, result)); -} - -exports.default = (0, _awaitify2.default)(tryEach); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/unmemoize.js b/node_modules/async/unmemoize.js deleted file mode 100644 index 47a92b42..00000000 --- a/node_modules/async/unmemoize.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = unmemoize; -/** - * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original, - * unmemoized form. Handy for testing. - * - * @name unmemoize - * @static - * @memberOf module:Utils - * @method - * @see [async.memoize]{@link module:Utils.memoize} - * @category Util - * @param {AsyncFunction} fn - the memoized function - * @returns {AsyncFunction} a function that calls the original unmemoized function - */ -function unmemoize(fn) { - return (...args) => { - return (fn.unmemoized || fn)(...args); - }; -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/async/until.js b/node_modules/async/until.js deleted file mode 100644 index 67ff1dea..00000000 --- a/node_modules/async/until.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = until; - -var _whilst = require('./whilst'); - -var _whilst2 = _interopRequireDefault(_whilst); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. `callback` will be passed an error and any - * arguments passed to the final `iteratee`'s callback. - * - * The inverse of [whilst]{@link module:ControlFlow.whilst}. - * - * @name until - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `iteratee`. Invoked with (callback). - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` fails. Invoked with (callback). - * @param {Function} [callback] - A callback which is called after the test - * function has passed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if a callback is not passed - * - * @example - * const results = [] - * let finished = false - * async.until(function test(page, cb) { - * cb(null, finished) - * }, function iter(next) { - * fetchPage(url, (err, body) => { - * if (err) return next(err) - * results = results.concat(body.objects) - * finished = !!body.next - * next(err) - * }) - * }, function done (err) { - * // all pages have been fetched - * }) - */ -function until(test, iteratee, callback) { - const _test = (0, _wrapAsync2.default)(test); - return (0, _whilst2.default)(cb => _test((err, truth) => cb(err, !truth)), iteratee, callback); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/waterfall.js b/node_modules/async/waterfall.js deleted file mode 100644 index 9aeb915a..00000000 --- a/node_modules/async/waterfall.js +++ /dev/null @@ -1,105 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _once = require('./internal/once'); - -var _once2 = _interopRequireDefault(_once); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Runs the `tasks` array of functions in series, each passing their results to - * the next in the array. However, if any of the `tasks` pass an error to their - * own callback, the next function is not executed, and the main `callback` is - * immediately called with the error. - * - * @name waterfall - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array} tasks - An array of [async functions]{@link AsyncFunction} - * to run. - * Each function should complete with any number of `result` values. - * The `result` values will be passed as arguments, in order, to the next task. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed. This will be passed the results of the last task's - * callback. Invoked with (err, [results]). - * @returns undefined - * @example - * - * async.waterfall([ - * function(callback) { - * callback(null, 'one', 'two'); - * }, - * function(arg1, arg2, callback) { - * // arg1 now equals 'one' and arg2 now equals 'two' - * callback(null, 'three'); - * }, - * function(arg1, callback) { - * // arg1 now equals 'three' - * callback(null, 'done'); - * } - * ], function (err, result) { - * // result now equals 'done' - * }); - * - * // Or, with named functions: - * async.waterfall([ - * myFirstFunction, - * mySecondFunction, - * myLastFunction, - * ], function (err, result) { - * // result now equals 'done' - * }); - * function myFirstFunction(callback) { - * callback(null, 'one', 'two'); - * } - * function mySecondFunction(arg1, arg2, callback) { - * // arg1 now equals 'one' and arg2 now equals 'two' - * callback(null, 'three'); - * } - * function myLastFunction(arg1, callback) { - * // arg1 now equals 'three' - * callback(null, 'done'); - * } - */ -function waterfall(tasks, callback) { - callback = (0, _once2.default)(callback); - if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); - if (!tasks.length) return callback(); - var taskIndex = 0; - - function nextTask(args) { - var task = (0, _wrapAsync2.default)(tasks[taskIndex++]); - task(...args, (0, _onlyOnce2.default)(next)); - } - - function next(err, ...args) { - if (err === false) return; - if (err || taskIndex === tasks.length) { - return callback(err, ...args); - } - nextTask(args); - } - - nextTask([]); -} - -exports.default = (0, _awaitify2.default)(waterfall); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/whilst.js b/node_modules/async/whilst.js deleted file mode 100644 index 4f4a39b4..00000000 --- a/node_modules/async/whilst.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _onlyOnce = require('./internal/onlyOnce'); - -var _onlyOnce2 = _interopRequireDefault(_onlyOnce); - -var _wrapAsync = require('./internal/wrapAsync'); - -var _wrapAsync2 = _interopRequireDefault(_wrapAsync); - -var _awaitify = require('./internal/awaitify'); - -var _awaitify2 = _interopRequireDefault(_awaitify); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. - * - * @name whilst - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `iteratee`. Invoked with (). - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` passes. Invoked with (callback). - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `iteratee` has stopped. `callback` - * will be passed an error and any arguments passed to the final `iteratee`'s - * callback. Invoked with (err, [results]); - * @returns {Promise} a promise, if no callback is passed - * @example - * - * var count = 0; - * async.whilst( - * function test(cb) { cb(null, count < 5); }, - * function iter(callback) { - * count++; - * setTimeout(function() { - * callback(null, count); - * }, 1000); - * }, - * function (err, n) { - * // 5 seconds have passed, n = 5 - * } - * ); - */ -function whilst(test, iteratee, callback) { - callback = (0, _onlyOnce2.default)(callback); - var _fn = (0, _wrapAsync2.default)(iteratee); - var _test = (0, _wrapAsync2.default)(test); - var results = []; - - function next(err, ...rest) { - if (err) return callback(err); - results = rest; - if (err === false) return; - _test(check); - } - - function check(err, truth) { - if (err) return callback(err); - if (err === false) return; - if (!truth) return callback(null, ...results); - _fn(next); - } - - return _test(check); -} -exports.default = (0, _awaitify2.default)(whilst, 3); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/async/wrapSync.js b/node_modules/async/wrapSync.js deleted file mode 100644 index 23623175..00000000 --- a/node_modules/async/wrapSync.js +++ /dev/null @@ -1,118 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = asyncify; - -var _initialParams = require('./internal/initialParams'); - -var _initialParams2 = _interopRequireDefault(_initialParams); - -var _setImmediate = require('./internal/setImmediate'); - -var _setImmediate2 = _interopRequireDefault(_setImmediate); - -var _wrapAsync = require('./internal/wrapAsync'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Take a sync function and make it async, passing its return value to a - * callback. This is useful for plugging sync functions into a waterfall, - * series, or other async functions. Any arguments passed to the generated - * function will be passed to the wrapped function (except for the final - * callback argument). Errors thrown will be passed to the callback. - * - * If the function passed to `asyncify` returns a Promise, that promises's - * resolved/rejected state will be used to call the callback, rather than simply - * the synchronous return value. - * - * This also means you can asyncify ES2017 `async` functions. - * - * @name asyncify - * @static - * @memberOf module:Utils - * @method - * @alias wrapSync - * @category Util - * @param {Function} func - The synchronous function, or Promise-returning - * function to convert to an {@link AsyncFunction}. - * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be - * invoked with `(args..., callback)`. - * @example - * - * // passing a regular synchronous function - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(JSON.parse), - * function (data, next) { - * // data is the result of parsing the text. - * // If there was a parsing error, it would have been caught. - * } - * ], callback); - * - * // passing a function returning a promise - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(function (contents) { - * return db.model.create(contents); - * }), - * function (model, next) { - * // `model` is the instantiated model object. - * // If there was an error, this function would be skipped. - * } - * ], callback); - * - * // es2017 example, though `asyncify` is not needed if your JS environment - * // supports async functions out of the box - * var q = async.queue(async.asyncify(async function(file) { - * var intermediateStep = await processFile(file); - * return await somePromise(intermediateStep) - * })); - * - * q.push(files); - */ -function asyncify(func) { - if ((0, _wrapAsync.isAsync)(func)) { - return function (...args /*, callback*/) { - const callback = args.pop(); - const promise = func.apply(this, args); - return handlePromise(promise, callback); - }; - } - - return (0, _initialParams2.default)(function (args, callback) { - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (result && typeof result.then === 'function') { - return handlePromise(result, callback); - } else { - callback(null, result); - } - }); -} - -function handlePromise(promise, callback) { - return promise.then(value => { - invokeCallback(callback, null, value); - }, err => { - invokeCallback(callback, err && err.message ? err : new Error(err)); - }); -} - -function invokeCallback(callback, error, value) { - try { - callback(error, value); - } catch (err) { - (0, _setImmediate2.default)(e => { - throw e; - }, err); - } -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/asynckit/LICENSE b/node_modules/asynckit/LICENSE deleted file mode 100644 index c9eca5dd..00000000 --- a/node_modules/asynckit/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Alex Indigo - -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. diff --git a/node_modules/asynckit/README.md b/node_modules/asynckit/README.md deleted file mode 100644 index ddcc7e6b..00000000 --- a/node_modules/asynckit/README.md +++ /dev/null @@ -1,233 +0,0 @@ -# asynckit [![NPM Module](https://img.shields.io/npm/v/asynckit.svg?style=flat)](https://www.npmjs.com/package/asynckit) - -Minimal async jobs utility library, with streams support. - -[![PhantomJS Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=browser&style=flat)](https://travis-ci.org/alexindigo/asynckit) -[![Linux Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=linux:0.12-6.x&style=flat)](https://travis-ci.org/alexindigo/asynckit) -[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/asynckit/v0.4.0.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/asynckit) - -[![Coverage Status](https://img.shields.io/coveralls/alexindigo/asynckit/v0.4.0.svg?label=code+coverage&style=flat)](https://coveralls.io/github/alexindigo/asynckit?branch=master) -[![Dependency Status](https://img.shields.io/david/alexindigo/asynckit/v0.4.0.svg?style=flat)](https://david-dm.org/alexindigo/asynckit) -[![bitHound Overall Score](https://www.bithound.io/github/alexindigo/asynckit/badges/score.svg)](https://www.bithound.io/github/alexindigo/asynckit) - - - -AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects. -Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method. - -It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators. - -| compression | size | -| :----------------- | -------: | -| asynckit.js | 12.34 kB | -| asynckit.min.js | 4.11 kB | -| asynckit.min.js.gz | 1.47 kB | - - -## Install - -```sh -$ npm install --save asynckit -``` - -## Examples - -### Parallel Jobs - -Runs iterator over provided array in parallel. Stores output in the `result` array, -on the matching positions. In unlikely event of an error from one of the jobs, -will terminate rest of the active jobs (if abort function is provided) -and return error along with salvaged data to the main callback function. - -#### Input Array - -```javascript -var parallel = require('asynckit').parallel - , assert = require('assert') - ; - -var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] - , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] - , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] - , target = [] - ; - -parallel(source, asyncJob, function(err, result) -{ - assert.deepEqual(result, expectedResult); - assert.deepEqual(target, expectedTarget); -}); - -// async job accepts one element from the array -// and a callback function -function asyncJob(item, cb) -{ - // different delays (in ms) per item - var delay = item * 25; - - // pretend different jobs take different time to finish - // and not in consequential order - var timeoutId = setTimeout(function() { - target.push(item); - cb(null, item * 2); - }, delay); - - // allow to cancel "leftover" jobs upon error - // return function, invoking of which will abort this job - return clearTimeout.bind(null, timeoutId); -} -``` - -More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js). - -#### Input Object - -Also it supports named jobs, listed via object. - -```javascript -var parallel = require('asynckit/parallel') - , assert = require('assert') - ; - -var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } - , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } - , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] - , expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ] - , target = [] - , keys = [] - ; - -parallel(source, asyncJob, function(err, result) -{ - assert.deepEqual(result, expectedResult); - assert.deepEqual(target, expectedTarget); - assert.deepEqual(keys, expectedKeys); -}); - -// supports full value, key, callback (shortcut) interface -function asyncJob(item, key, cb) -{ - // different delays (in ms) per item - var delay = item * 25; - - // pretend different jobs take different time to finish - // and not in consequential order - var timeoutId = setTimeout(function() { - keys.push(key); - target.push(item); - cb(null, item * 2); - }, delay); - - // allow to cancel "leftover" jobs upon error - // return function, invoking of which will abort this job - return clearTimeout.bind(null, timeoutId); -} -``` - -More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js). - -### Serial Jobs - -Runs iterator over provided array sequentially. Stores output in the `result` array, -on the matching positions. In unlikely event of an error from one of the jobs, -will not proceed to the rest of the items in the list -and return error along with salvaged data to the main callback function. - -#### Input Array - -```javascript -var serial = require('asynckit/serial') - , assert = require('assert') - ; - -var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] - , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] - , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] - , target = [] - ; - -serial(source, asyncJob, function(err, result) -{ - assert.deepEqual(result, expectedResult); - assert.deepEqual(target, expectedTarget); -}); - -// extended interface (item, key, callback) -// also supported for arrays -function asyncJob(item, key, cb) -{ - target.push(key); - - // it will be automatically made async - // even it iterator "returns" in the same event loop - cb(null, item * 2); -} -``` - -More examples could be found in [test/test-serial-array.js](test/test-serial-array.js). - -#### Input Object - -Also it supports named jobs, listed via object. - -```javascript -var serial = require('asynckit').serial - , assert = require('assert') - ; - -var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] - , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] - , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] - , target = [] - ; - -var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } - , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } - , expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ] - , target = [] - ; - - -serial(source, asyncJob, function(err, result) -{ - assert.deepEqual(result, expectedResult); - assert.deepEqual(target, expectedTarget); -}); - -// shortcut interface (item, callback) -// works for object as well as for the arrays -function asyncJob(item, cb) -{ - target.push(item); - - // it will be automatically made async - // even it iterator "returns" in the same event loop - cb(null, item * 2); -} -``` - -More examples could be found in [test/test-serial-object.js](test/test-serial-object.js). - -_Note: Since _object_ is an _unordered_ collection of properties, -it may produce unexpected results with sequential iterations. -Whenever order of the jobs' execution is important please use `serialOrdered` method._ - -### Ordered Serial Iterations - -TBD - -For example [compare-property](compare-property) package. - -### Streaming interface - -TBD - -## Want to Know More? - -More examples can be found in [test folder](test/). - -Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions. - -## License - -AsyncKit is licensed under the MIT license. diff --git a/node_modules/asynckit/bench.js b/node_modules/asynckit/bench.js deleted file mode 100644 index c612f1a5..00000000 --- a/node_modules/asynckit/bench.js +++ /dev/null @@ -1,76 +0,0 @@ -/* eslint no-console: "off" */ - -var asynckit = require('./') - , async = require('async') - , assert = require('assert') - , expected = 0 - ; - -var Benchmark = require('benchmark'); -var suite = new Benchmark.Suite; - -var source = []; -for (var z = 1; z < 100; z++) -{ - source.push(z); - expected += z; -} - -suite -// add tests - -.add('async.map', function(deferred) -{ - var total = 0; - - async.map(source, - function(i, cb) - { - setImmediate(function() - { - total += i; - cb(null, total); - }); - }, - function(err, result) - { - assert.ifError(err); - assert.equal(result[result.length - 1], expected); - deferred.resolve(); - }); -}, {'defer': true}) - - -.add('asynckit.parallel', function(deferred) -{ - var total = 0; - - asynckit.parallel(source, - function(i, cb) - { - setImmediate(function() - { - total += i; - cb(null, total); - }); - }, - function(err, result) - { - assert.ifError(err); - assert.equal(result[result.length - 1], expected); - deferred.resolve(); - }); -}, {'defer': true}) - - -// add listeners -.on('cycle', function(ev) -{ - console.log(String(ev.target)); -}) -.on('complete', function() -{ - console.log('Fastest is ' + this.filter('fastest').map('name')); -}) -// run async -.run({ 'async': true }); diff --git a/node_modules/asynckit/index.js b/node_modules/asynckit/index.js deleted file mode 100644 index 455f9454..00000000 --- a/node_modules/asynckit/index.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = -{ - parallel : require('./parallel.js'), - serial : require('./serial.js'), - serialOrdered : require('./serialOrdered.js') -}; diff --git a/node_modules/asynckit/lib/abort.js b/node_modules/asynckit/lib/abort.js deleted file mode 100644 index 114367e5..00000000 --- a/node_modules/asynckit/lib/abort.js +++ /dev/null @@ -1,29 +0,0 @@ -// API -module.exports = abort; - -/** - * Aborts leftover active jobs - * - * @param {object} state - current state object - */ -function abort(state) -{ - Object.keys(state.jobs).forEach(clean.bind(state)); - - // reset leftover jobs - state.jobs = {}; -} - -/** - * Cleans up leftover job by invoking abort function for the provided job id - * - * @this state - * @param {string|number} key - job id to abort - */ -function clean(key) -{ - if (typeof this.jobs[key] == 'function') - { - this.jobs[key](); - } -} diff --git a/node_modules/asynckit/lib/async.js b/node_modules/asynckit/lib/async.js deleted file mode 100644 index 7f1288a4..00000000 --- a/node_modules/asynckit/lib/async.js +++ /dev/null @@ -1,34 +0,0 @@ -var defer = require('./defer.js'); - -// API -module.exports = async; - -/** - * Runs provided callback asynchronously - * even if callback itself is not - * - * @param {function} callback - callback to invoke - * @returns {function} - augmented callback - */ -function async(callback) -{ - var isAsync = false; - - // check if async happened - defer(function() { isAsync = true; }); - - return function async_callback(err, result) - { - if (isAsync) - { - callback(err, result); - } - else - { - defer(function nextTick_callback() - { - callback(err, result); - }); - } - }; -} diff --git a/node_modules/asynckit/lib/defer.js b/node_modules/asynckit/lib/defer.js deleted file mode 100644 index b67110c7..00000000 --- a/node_modules/asynckit/lib/defer.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = defer; - -/** - * Runs provided function on next iteration of the event loop - * - * @param {function} fn - function to run - */ -function defer(fn) -{ - var nextTick = typeof setImmediate == 'function' - ? setImmediate - : ( - typeof process == 'object' && typeof process.nextTick == 'function' - ? process.nextTick - : null - ); - - if (nextTick) - { - nextTick(fn); - } - else - { - setTimeout(fn, 0); - } -} diff --git a/node_modules/asynckit/lib/iterate.js b/node_modules/asynckit/lib/iterate.js deleted file mode 100644 index 5d2839a5..00000000 --- a/node_modules/asynckit/lib/iterate.js +++ /dev/null @@ -1,75 +0,0 @@ -var async = require('./async.js') - , abort = require('./abort.js') - ; - -// API -module.exports = iterate; - -/** - * Iterates over each job object - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {object} state - current job status - * @param {function} callback - invoked when all elements processed - */ -function iterate(list, iterator, state, callback) -{ - // store current index - var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; - - state.jobs[key] = runJob(iterator, key, list[key], function(error, output) - { - // don't repeat yourself - // skip secondary callbacks - if (!(key in state.jobs)) - { - return; - } - - // clean up jobs - delete state.jobs[key]; - - if (error) - { - // don't process rest of the results - // stop still active jobs - // and reset the list - abort(state); - } - else - { - state.results[key] = output; - } - - // return salvaged results - callback(error, state.results); - }); -} - -/** - * Runs iterator over provided job element - * - * @param {function} iterator - iterator to invoke - * @param {string|number} key - key/index of the element in the list of jobs - * @param {mixed} item - job description - * @param {function} callback - invoked after iterator is done with the job - * @returns {function|mixed} - job abort function or something else - */ -function runJob(iterator, key, item, callback) -{ - var aborter; - - // allow shortcut if iterator expects only two arguments - if (iterator.length == 2) - { - aborter = iterator(item, async(callback)); - } - // otherwise go with full three arguments - else - { - aborter = iterator(item, key, async(callback)); - } - - return aborter; -} diff --git a/node_modules/asynckit/lib/readable_asynckit.js b/node_modules/asynckit/lib/readable_asynckit.js deleted file mode 100644 index 78ad240f..00000000 --- a/node_modules/asynckit/lib/readable_asynckit.js +++ /dev/null @@ -1,91 +0,0 @@ -var streamify = require('./streamify.js') - , defer = require('./defer.js') - ; - -// API -module.exports = ReadableAsyncKit; - -/** - * Base constructor for all streams - * used to hold properties/methods - */ -function ReadableAsyncKit() -{ - ReadableAsyncKit.super_.apply(this, arguments); - - // list of active jobs - this.jobs = {}; - - // add stream methods - this.destroy = destroy; - this._start = _start; - this._read = _read; -} - -/** - * Destroys readable stream, - * by aborting outstanding jobs - * - * @returns {void} - */ -function destroy() -{ - if (this.destroyed) - { - return; - } - - this.destroyed = true; - - if (typeof this.terminator == 'function') - { - this.terminator(); - } -} - -/** - * Starts provided jobs in async manner - * - * @private - */ -function _start() -{ - // first argument – runner function - var runner = arguments[0] - // take away first argument - , args = Array.prototype.slice.call(arguments, 1) - // second argument - input data - , input = args[0] - // last argument - result callback - , endCb = streamify.callback.call(this, args[args.length - 1]) - ; - - args[args.length - 1] = endCb; - // third argument - iterator - args[1] = streamify.iterator.call(this, args[1]); - - // allow time for proper setup - defer(function() - { - if (!this.destroyed) - { - this.terminator = runner.apply(null, args); - } - else - { - endCb(null, Array.isArray(input) ? [] : {}); - } - }.bind(this)); -} - - -/** - * Implement _read to comply with Readable streams - * Doesn't really make sense for flowing object mode - * - * @private - */ -function _read() -{ - -} diff --git a/node_modules/asynckit/lib/readable_parallel.js b/node_modules/asynckit/lib/readable_parallel.js deleted file mode 100644 index 5d2929f7..00000000 --- a/node_modules/asynckit/lib/readable_parallel.js +++ /dev/null @@ -1,25 +0,0 @@ -var parallel = require('../parallel.js'); - -// API -module.exports = ReadableParallel; - -/** - * Streaming wrapper to `asynckit.parallel` - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {stream.Readable#} - */ -function ReadableParallel(list, iterator, callback) -{ - if (!(this instanceof ReadableParallel)) - { - return new ReadableParallel(list, iterator, callback); - } - - // turn on object mode - ReadableParallel.super_.call(this, {objectMode: true}); - - this._start(parallel, list, iterator, callback); -} diff --git a/node_modules/asynckit/lib/readable_serial.js b/node_modules/asynckit/lib/readable_serial.js deleted file mode 100644 index 78226982..00000000 --- a/node_modules/asynckit/lib/readable_serial.js +++ /dev/null @@ -1,25 +0,0 @@ -var serial = require('../serial.js'); - -// API -module.exports = ReadableSerial; - -/** - * Streaming wrapper to `asynckit.serial` - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {stream.Readable#} - */ -function ReadableSerial(list, iterator, callback) -{ - if (!(this instanceof ReadableSerial)) - { - return new ReadableSerial(list, iterator, callback); - } - - // turn on object mode - ReadableSerial.super_.call(this, {objectMode: true}); - - this._start(serial, list, iterator, callback); -} diff --git a/node_modules/asynckit/lib/readable_serial_ordered.js b/node_modules/asynckit/lib/readable_serial_ordered.js deleted file mode 100644 index 3de89c47..00000000 --- a/node_modules/asynckit/lib/readable_serial_ordered.js +++ /dev/null @@ -1,29 +0,0 @@ -var serialOrdered = require('../serialOrdered.js'); - -// API -module.exports = ReadableSerialOrdered; -// expose sort helpers -module.exports.ascending = serialOrdered.ascending; -module.exports.descending = serialOrdered.descending; - -/** - * Streaming wrapper to `asynckit.serialOrdered` - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} sortMethod - custom sort function - * @param {function} callback - invoked when all elements processed - * @returns {stream.Readable#} - */ -function ReadableSerialOrdered(list, iterator, sortMethod, callback) -{ - if (!(this instanceof ReadableSerialOrdered)) - { - return new ReadableSerialOrdered(list, iterator, sortMethod, callback); - } - - // turn on object mode - ReadableSerialOrdered.super_.call(this, {objectMode: true}); - - this._start(serialOrdered, list, iterator, sortMethod, callback); -} diff --git a/node_modules/asynckit/lib/state.js b/node_modules/asynckit/lib/state.js deleted file mode 100644 index cbea7ad8..00000000 --- a/node_modules/asynckit/lib/state.js +++ /dev/null @@ -1,37 +0,0 @@ -// API -module.exports = state; - -/** - * Creates initial state object - * for iteration over list - * - * @param {array|object} list - list to iterate over - * @param {function|null} sortMethod - function to use for keys sort, - * or `null` to keep them as is - * @returns {object} - initial state object - */ -function state(list, sortMethod) -{ - var isNamedList = !Array.isArray(list) - , initState = - { - index : 0, - keyedList: isNamedList || sortMethod ? Object.keys(list) : null, - jobs : {}, - results : isNamedList ? {} : [], - size : isNamedList ? Object.keys(list).length : list.length - } - ; - - if (sortMethod) - { - // sort array keys based on it's values - // sort object's keys just on own merit - initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) - { - return sortMethod(list[a], list[b]); - }); - } - - return initState; -} diff --git a/node_modules/asynckit/lib/streamify.js b/node_modules/asynckit/lib/streamify.js deleted file mode 100644 index f56a1c92..00000000 --- a/node_modules/asynckit/lib/streamify.js +++ /dev/null @@ -1,141 +0,0 @@ -var async = require('./async.js'); - -// API -module.exports = { - iterator: wrapIterator, - callback: wrapCallback -}; - -/** - * Wraps iterators with long signature - * - * @this ReadableAsyncKit# - * @param {function} iterator - function to wrap - * @returns {function} - wrapped function - */ -function wrapIterator(iterator) -{ - var stream = this; - - return function(item, key, cb) - { - var aborter - , wrappedCb = async(wrapIteratorCallback.call(stream, cb, key)) - ; - - stream.jobs[key] = wrappedCb; - - // it's either shortcut (item, cb) - if (iterator.length == 2) - { - aborter = iterator(item, wrappedCb); - } - // or long format (item, key, cb) - else - { - aborter = iterator(item, key, wrappedCb); - } - - return aborter; - }; -} - -/** - * Wraps provided callback function - * allowing to execute snitch function before - * real callback - * - * @this ReadableAsyncKit# - * @param {function} callback - function to wrap - * @returns {function} - wrapped function - */ -function wrapCallback(callback) -{ - var stream = this; - - var wrapped = function(error, result) - { - return finisher.call(stream, error, result, callback); - }; - - return wrapped; -} - -/** - * Wraps provided iterator callback function - * makes sure snitch only called once, - * but passes secondary calls to the original callback - * - * @this ReadableAsyncKit# - * @param {function} callback - callback to wrap - * @param {number|string} key - iteration key - * @returns {function} wrapped callback - */ -function wrapIteratorCallback(callback, key) -{ - var stream = this; - - return function(error, output) - { - // don't repeat yourself - if (!(key in stream.jobs)) - { - callback(error, output); - return; - } - - // clean up jobs - delete stream.jobs[key]; - - return streamer.call(stream, error, {key: key, value: output}, callback); - }; -} - -/** - * Stream wrapper for iterator callback - * - * @this ReadableAsyncKit# - * @param {mixed} error - error response - * @param {mixed} output - iterator output - * @param {function} callback - callback that expects iterator results - */ -function streamer(error, output, callback) -{ - if (error && !this.error) - { - this.error = error; - this.pause(); - this.emit('error', error); - // send back value only, as expected - callback(error, output && output.value); - return; - } - - // stream stuff - this.push(output); - - // back to original track - // send back value only, as expected - callback(error, output && output.value); -} - -/** - * Stream wrapper for finishing callback - * - * @this ReadableAsyncKit# - * @param {mixed} error - error response - * @param {mixed} output - iterator output - * @param {function} callback - callback that expects final results - */ -function finisher(error, output, callback) -{ - // signal end of the stream - // only for successfully finished streams - if (!error) - { - this.push(null); - } - - // back to original track - callback(error, output); -} diff --git a/node_modules/asynckit/lib/terminator.js b/node_modules/asynckit/lib/terminator.js deleted file mode 100644 index d6eb9921..00000000 --- a/node_modules/asynckit/lib/terminator.js +++ /dev/null @@ -1,29 +0,0 @@ -var abort = require('./abort.js') - , async = require('./async.js') - ; - -// API -module.exports = terminator; - -/** - * Terminates jobs in the attached state context - * - * @this AsyncKitState# - * @param {function} callback - final callback to invoke after termination - */ -function terminator(callback) -{ - if (!Object.keys(this.jobs).length) - { - return; - } - - // fast forward iteration index - this.index = this.size; - - // abort jobs - abort(this); - - // send back results we have so far - async(callback)(null, this.results); -} diff --git a/node_modules/asynckit/package.json b/node_modules/asynckit/package.json deleted file mode 100644 index 2d564a69..00000000 --- a/node_modules/asynckit/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "_from": "asynckit@^0.4.0", - "_id": "asynckit@0.4.0", - "_inBundle": false, - "_integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "_location": "/asynckit", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "asynckit@^0.4.0", - "name": "asynckit", - "escapedName": "asynckit", - "rawSpec": "^0.4.0", - "saveSpec": null, - "fetchSpec": "^0.4.0" - }, - "_requiredBy": [ - "/form-data" - ], - "_resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "_shasum": "c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79", - "_spec": "asynckit@^0.4.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/form-data", - "author": { - "name": "Alex Indigo", - "email": "iam@alexindigo.com" - }, - "bugs": { - "url": "https://github.com/alexindigo/asynckit/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Minimal async jobs utility library, with streams support", - "devDependencies": { - "browserify": "^13.0.0", - "browserify-istanbul": "^2.0.0", - "coveralls": "^2.11.9", - "eslint": "^2.9.0", - "istanbul": "^0.4.3", - "obake": "^0.1.2", - "phantomjs-prebuilt": "^2.1.7", - "pre-commit": "^1.1.3", - "reamde": "^1.1.0", - "rimraf": "^2.5.2", - "size-table": "^0.2.0", - "tap-spec": "^4.1.1", - "tape": "^4.5.1" - }, - "homepage": "https://github.com/alexindigo/asynckit#readme", - "keywords": [ - "async", - "jobs", - "parallel", - "serial", - "iterator", - "array", - "object", - "stream", - "destroy", - "terminate", - "abort" - ], - "license": "MIT", - "main": "index.js", - "name": "asynckit", - "pre-commit": [ - "clean", - "lint", - "test", - "browser", - "report", - "size" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/alexindigo/asynckit.git" - }, - "scripts": { - "browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec", - "clean": "rimraf coverage", - "debug": "tape test/test-*.js", - "lint": "eslint *.js lib/*.js test/*.js", - "report": "istanbul report", - "size": "browserify index.js | size-table asynckit", - "test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec", - "win-test": "tape test/test-*.js" - }, - "version": "0.4.0" -} diff --git a/node_modules/asynckit/parallel.js b/node_modules/asynckit/parallel.js deleted file mode 100644 index 3c50344d..00000000 --- a/node_modules/asynckit/parallel.js +++ /dev/null @@ -1,43 +0,0 @@ -var iterate = require('./lib/iterate.js') - , initState = require('./lib/state.js') - , terminator = require('./lib/terminator.js') - ; - -// Public API -module.exports = parallel; - -/** - * Runs iterator over provided array elements in parallel - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function parallel(list, iterator, callback) -{ - var state = initState(list); - - while (state.index < (state['keyedList'] || list).length) - { - iterate(list, iterator, state, function(error, result) - { - if (error) - { - callback(error, result); - return; - } - - // looks like it's the last one - if (Object.keys(state.jobs).length === 0) - { - callback(null, state.results); - return; - } - }); - - state.index++; - } - - return terminator.bind(state, callback); -} diff --git a/node_modules/asynckit/serial.js b/node_modules/asynckit/serial.js deleted file mode 100644 index 6cd949a6..00000000 --- a/node_modules/asynckit/serial.js +++ /dev/null @@ -1,17 +0,0 @@ -var serialOrdered = require('./serialOrdered.js'); - -// Public API -module.exports = serial; - -/** - * Runs iterator over provided array elements in series - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function serial(list, iterator, callback) -{ - return serialOrdered(list, iterator, null, callback); -} diff --git a/node_modules/asynckit/serialOrdered.js b/node_modules/asynckit/serialOrdered.js deleted file mode 100644 index 607eafea..00000000 --- a/node_modules/asynckit/serialOrdered.js +++ /dev/null @@ -1,75 +0,0 @@ -var iterate = require('./lib/iterate.js') - , initState = require('./lib/state.js') - , terminator = require('./lib/terminator.js') - ; - -// Public API -module.exports = serialOrdered; -// sorting helpers -module.exports.ascending = ascending; -module.exports.descending = descending; - -/** - * Runs iterator over provided sorted array elements in series - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} sortMethod - custom sort function - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function serialOrdered(list, iterator, sortMethod, callback) -{ - var state = initState(list, sortMethod); - - iterate(list, iterator, state, function iteratorHandler(error, result) - { - if (error) - { - callback(error, result); - return; - } - - state.index++; - - // are we there yet? - if (state.index < (state['keyedList'] || list).length) - { - iterate(list, iterator, state, iteratorHandler); - return; - } - - // done here - callback(null, state.results); - }); - - return terminator.bind(state, callback); -} - -/* - * -- Sort methods - */ - -/** - * sort helper to sort array elements in ascending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function ascending(a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} - -/** - * sort helper to sort array elements in descending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function descending(a, b) -{ - return -1 * ascending(a, b); -} diff --git a/node_modules/asynckit/stream.js b/node_modules/asynckit/stream.js deleted file mode 100644 index d43465f9..00000000 --- a/node_modules/asynckit/stream.js +++ /dev/null @@ -1,21 +0,0 @@ -var inherits = require('util').inherits - , Readable = require('stream').Readable - , ReadableAsyncKit = require('./lib/readable_asynckit.js') - , ReadableParallel = require('./lib/readable_parallel.js') - , ReadableSerial = require('./lib/readable_serial.js') - , ReadableSerialOrdered = require('./lib/readable_serial_ordered.js') - ; - -// API -module.exports = -{ - parallel : ReadableParallel, - serial : ReadableSerial, - serialOrdered : ReadableSerialOrdered, -}; - -inherits(ReadableAsyncKit, Readable); - -inherits(ReadableParallel, ReadableAsyncKit); -inherits(ReadableSerial, ReadableAsyncKit); -inherits(ReadableSerialOrdered, ReadableAsyncKit); diff --git a/node_modules/backo2/.npmignore b/node_modules/backo2/.npmignore deleted file mode 100644 index c2658d7d..00000000 --- a/node_modules/backo2/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/node_modules/backo2/History.md b/node_modules/backo2/History.md deleted file mode 100644 index 8eb28b8e..00000000 --- a/node_modules/backo2/History.md +++ /dev/null @@ -1,12 +0,0 @@ - -1.0.1 / 2014-02-17 -================== - - * go away decimal point - * history - -1.0.0 / 2014-02-17 -================== - - * add jitter option - * Initial commit diff --git a/node_modules/backo2/Makefile b/node_modules/backo2/Makefile deleted file mode 100644 index 9987df81..00000000 --- a/node_modules/backo2/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter dot \ - --bail - -.PHONY: test \ No newline at end of file diff --git a/node_modules/backo2/Readme.md b/node_modules/backo2/Readme.md deleted file mode 100644 index 0df2a399..00000000 --- a/node_modules/backo2/Readme.md +++ /dev/null @@ -1,34 +0,0 @@ -# backo - - Simple exponential backoff because the others seem to have weird abstractions. - -## Installation - -``` -$ npm install backo -``` - -## Options - - - `min` initial timeout in milliseconds [100] - - `max` max timeout [10000] - - `jitter` [0] - - `factor` [2] - -## Example - -```js -var Backoff = require('backo'); -var backoff = new Backoff({ min: 100, max: 20000 }); - -setTimeout(function(){ - something.reconnect(); -}, backoff.duration()); - -// later when something works -backoff.reset() -``` - -# License - - MIT diff --git a/node_modules/backo2/component.json b/node_modules/backo2/component.json deleted file mode 100644 index 994845ac..00000000 --- a/node_modules/backo2/component.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "backo", - "repo": "segmentio/backo", - "dependencies": {}, - "version": "1.0.1", - "description": "simple backoff without the weird abstractions", - "keywords": ["backoff"], - "license": "MIT", - "scripts": ["index.js"], - "main": "index.js" -} diff --git a/node_modules/backo2/index.js b/node_modules/backo2/index.js deleted file mode 100644 index fac4429b..00000000 --- a/node_modules/backo2/index.js +++ /dev/null @@ -1,85 +0,0 @@ - -/** - * Expose `Backoff`. - */ - -module.exports = Backoff; - -/** - * Initialize backoff timer with `opts`. - * - * - `min` initial timeout in milliseconds [100] - * - `max` max timeout [10000] - * - `jitter` [0] - * - `factor` [2] - * - * @param {Object} opts - * @api public - */ - -function Backoff(opts) { - opts = opts || {}; - this.ms = opts.min || 100; - this.max = opts.max || 10000; - this.factor = opts.factor || 2; - this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; - this.attempts = 0; -} - -/** - * Return the backoff duration. - * - * @return {Number} - * @api public - */ - -Backoff.prototype.duration = function(){ - var ms = this.ms * Math.pow(this.factor, this.attempts++); - if (this.jitter) { - var rand = Math.random(); - var deviation = Math.floor(rand * this.jitter * ms); - ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; - } - return Math.min(ms, this.max) | 0; -}; - -/** - * Reset the number of attempts. - * - * @api public - */ - -Backoff.prototype.reset = function(){ - this.attempts = 0; -}; - -/** - * Set the minimum duration - * - * @api public - */ - -Backoff.prototype.setMin = function(min){ - this.ms = min; -}; - -/** - * Set the maximum duration - * - * @api public - */ - -Backoff.prototype.setMax = function(max){ - this.max = max; -}; - -/** - * Set the jitter - * - * @api public - */ - -Backoff.prototype.setJitter = function(jitter){ - this.jitter = jitter; -}; - diff --git a/node_modules/backo2/package.json b/node_modules/backo2/package.json deleted file mode 100644 index 26d47c82..00000000 --- a/node_modules/backo2/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "_args": [ - [ - "backo2@1.0.2", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "backo2@1.0.2", - "_id": "backo2@1.0.2", - "_inBundle": false, - "_integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", - "_location": "/backo2", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "backo2@1.0.2", - "name": "backo2", - "escapedName": "backo2", - "rawSpec": "1.0.2", - "saveSpec": null, - "fetchSpec": "1.0.2" - }, - "_requiredBy": [ - "/subscriptions-transport-ws" - ], - "_resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "_spec": "1.0.2", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "bugs": { - "url": "https://github.com/mokesmokes/backo/issues" - }, - "dependencies": {}, - "description": "simple backoff based on segmentio/backo", - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "homepage": "https://github.com/mokesmokes/backo#readme", - "keywords": [ - "backoff" - ], - "license": "MIT", - "name": "backo2", - "repository": { - "type": "git", - "url": "git+https://github.com/mokesmokes/backo.git" - }, - "version": "1.0.2" -} diff --git a/node_modules/backo2/test/index.js b/node_modules/backo2/test/index.js deleted file mode 100644 index ea1f6de1..00000000 --- a/node_modules/backo2/test/index.js +++ /dev/null @@ -1,18 +0,0 @@ - -var Backoff = require('..'); -var assert = require('assert'); - -describe('.duration()', function(){ - it('should increase the backoff', function(){ - var b = new Backoff; - - assert(100 == b.duration()); - assert(200 == b.duration()); - assert(400 == b.duration()); - assert(800 == b.duration()); - - b.reset(); - assert(100 == b.duration()); - assert(200 == b.duration()); - }) -}) \ No newline at end of file diff --git a/node_modules/base64-js/LICENSE b/node_modules/base64-js/LICENSE deleted file mode 100644 index 6d52b8ac..00000000 --- a/node_modules/base64-js/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Jameson Little - -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. diff --git a/node_modules/base64-js/README.md b/node_modules/base64-js/README.md deleted file mode 100644 index 0395c331..00000000 --- a/node_modules/base64-js/README.md +++ /dev/null @@ -1,32 +0,0 @@ -base64-js -========= - -`base64-js` does basic base64 encoding/decoding in pure JS. - -[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js) - -Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data. - -Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does. - -## install - -With [npm](https://npmjs.org) do: - -`npm install base64-js` and `var base64js = require('base64-js')` - -For use in web browsers do: - -`` - -## methods - -`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument. - -* `byteLength` - Takes a base64 string and returns length of byte array -* `toByteArray` - Takes a base64 string and returns a byte array -* `fromByteArray` - Takes a byte array and returns a base64 string - -## license - -MIT diff --git a/node_modules/base64-js/base64js.min.js b/node_modules/base64-js/base64js.min.js deleted file mode 100644 index b0279c06..00000000 --- a/node_modules/base64-js/base64js.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function d(a,f,i){function u(n,r){if(!f[n]){if(!a[n]){var e="function"==typeof require&&require;if(!r&&e)return e(n,!0);if(v)return v(n,!0);var t=new Error("Cannot find module '"+n+"'");throw t.code="MODULE_NOT_FOUND",t}var o=f[n]={exports:{}};a[n][0].call(o.exports,function(r){var e=a[n][1][r];return u(e||r)},o,o.exports,d,a,f,i)}return f[n].exports}for(var v="function"==typeof require&&require,r=0;r0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function f(r){var e=c(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function h(r,e,n){return(e+n)*3/4-n}function i(r){var e;var n=c(r);var t=n[0];var o=n[1];var a=new d(h(r,t,o));var f=0;var i=o>0?t-4:t;var u;for(u=0;u>16&255;a[f++]=e>>8&255;a[f++]=e&255}if(o===2){e=v[r.charCodeAt(u)]<<2|v[r.charCodeAt(u+1)]>>4;a[f++]=e&255}if(o===1){e=v[r.charCodeAt(u)]<<10|v[r.charCodeAt(u+1)]<<4|v[r.charCodeAt(u+2)]>>2;a[f++]=e>>8&255;a[f++]=e&255}return a}function s(r){return u[r>>18&63]+u[r>>12&63]+u[r>>6&63]+u[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;ai?i:f+a))}if(t===1){e=r[n-1];o.push(u[e>>2]+u[e<<4&63]+"==")}else if(t===2){e=(r[n-2]<<8)+r[n-1];o.push(u[e>>10]+u[e>>4&63]+u[e<<2&63]+"=")}return o.join("")}},{}]},{},[])("/")}); diff --git a/node_modules/base64-js/index.js b/node_modules/base64-js/index.js deleted file mode 100644 index f087f5bd..00000000 --- a/node_modules/base64-js/index.js +++ /dev/null @@ -1,152 +0,0 @@ -'use strict' - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} diff --git a/node_modules/base64-js/package.json b/node_modules/base64-js/package.json deleted file mode 100644 index 96b96947..00000000 --- a/node_modules/base64-js/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "_from": "base64-js@^1.3.0", - "_id": "base64-js@1.3.1", - "_inBundle": false, - "_integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", - "_location": "/base64-js", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "base64-js@^1.3.0", - "name": "base64-js", - "escapedName": "base64-js", - "rawSpec": "^1.3.0", - "saveSpec": null, - "fetchSpec": "^1.3.0" - }, - "_requiredBy": [ - "/google-auth-library" - ], - "_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "_shasum": "58ece8cb75dd07e71ed08c736abc5fac4dbf8df1", - "_spec": "base64-js@^1.3.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "T. Jameson Little", - "email": "t.jameson.little@gmail.com" - }, - "bugs": { - "url": "https://github.com/beatgammit/base64-js/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Base64 encoding/decoding in pure JS", - "devDependencies": { - "benchmark": "^2.1.4", - "browserify": "^16.3.0", - "standard": "*", - "tape": "4.x", - "uglify-js": "^3.6.0" - }, - "homepage": "https://github.com/beatgammit/base64-js", - "keywords": [ - "base64" - ], - "license": "MIT", - "main": "index.js", - "name": "base64-js", - "repository": { - "type": "git", - "url": "git://github.com/beatgammit/base64-js.git" - }, - "scripts": { - "build": "browserify -s base64js -r ./ | uglifyjs -m > base64js.min.js", - "lint": "standard", - "test": "npm run lint && npm run unit", - "unit": "tape test/*.js" - }, - "version": "1.3.1" -} diff --git a/node_modules/bignumber.js/CHANGELOG.md b/node_modules/bignumber.js/CHANGELOG.md deleted file mode 100644 index 33058e0f..00000000 --- a/node_modules/bignumber.js/CHANGELOG.md +++ /dev/null @@ -1,271 +0,0 @@ -#### 9.0.1 -* 28/09/20 -* [BUGFIX] #276 Correct `sqrt` initial estimate. -* Update *.travis.yml*, *LICENCE.md* and *README.md*. - -#### 9.0.0 -* 27/05/2019 -* For compatibility with legacy browsers, remove `Symbol` references. - -#### 8.1.1 -* 24/02/2019 -* [BUGFIX] #222 Restore missing `var` to `export BigNumber`. -* Allow any key in BigNumber.Instance in *bignumber.d.ts*. - -#### 8.1.0 -* 23/02/2019 -* [NEW FEATURE] #220 Create a BigNumber using `{s, e, c}`. -* [NEW FEATURE] `isBigNumber`: if `BigNumber.DEBUG` is `true`, also check that the BigNumber instance is well-formed. -* Remove `instanceof` checks; just use `_isBigNumber` to identify a BigNumber instance. -* Add `_isBigNumber` to prototype in *bignumber.mjs*. -* Add tests for BigNumber creation from object. -* Update *API.html*. - -#### 8.0.2 -* 13/01/2019 -* #209 `toPrecision` without argument should follow `toString`. -* Improve *Use* section of *README*. -* Optimise `toString(10)`. -* Add verson number to API doc. - -#### 8.0.1 -* 01/11/2018 -* Rest parameter must be array type in *bignumber.d.ts*. - -#### 8.0.0 -* 01/11/2018 -* [NEW FEATURE] Add `BigNumber.sum` method. -* [NEW FEATURE]`toFormat`: add `prefix` and `suffix` options. -* [NEW FEATURE] #178 Pass custom formatting to `toFormat`. -* [BREAKING CHANGE] #184 `toFraction`: return array of BigNumbers not strings. -* [NEW FEATURE] #185 Enable overwrite of `valueOf` to prevent accidental addition to string. -* #183 Add Node.js `crypto` requirement to documentation. -* [BREAKING CHANGE] #198 Disallow signs and whitespace in custom alphabet. -* [NEW FEATURE] #188 Implement `util.inspect.custom` for Node.js REPL. -* #170 Make `isBigNumber` a type guard in *bignumber.d.ts*. -* [BREAKING CHANGE] `BigNumber.min` and `BigNumber.max`: don't accept an array. -* Update *.travis.yml*. -* Remove *bower.json*. - -#### 7.2.1 -* 24/05/2018 -* Add `browser` field to *package.json*. - -#### 7.2.0 -* 22/05/2018 -* #166 Correct *.mjs* file. Remove extension from `main` field in *package.json*. - -#### 7.1.0 -* 18/05/2018 -* Add `module` field to *package.json* for *bignumber.mjs*. - -#### 7.0.2 -* 17/05/2018 -* #165 Bugfix: upper-case letters for bases 11-36 in a custom alphabet. -* Add note to *README* regarding creating BigNumbers from Number values. - -#### 7.0.1 -* 26/04/2018 -* #158 Fix global object variable name typo. - -#### 7.0.0 -* 26/04/2018 -* #143 Remove global BigNumber from typings. -* #144 Enable compatibility with `Object.freeze(Object.prototype)`. -* #148 #123 #11 Only throw on a number primitive with more than 15 significant digits if `BigNumber.DEBUG` is `true`. -* Only throw on an invalid BigNumber value if `BigNumber.DEBUG` is `true`. Return BigNumber `NaN` instead. -* #154 `exponentiatedBy`: allow BigNumber exponent. -* #156 Prevent Content Security Policy *unsafe-eval* issue. -* `toFraction`: allow `Infinity` maximum denominator. -* Comment-out some excess tests to reduce test time. -* Amend indentation and other spacing. - -#### 6.0.0 -* 26/01/2018 -* #137 Implement `APLHABET` configuration option. -* Remove `ERRORS` configuration option. -* Remove `toDigits` method; extend `precision` method accordingly. -* Remove s`round` method; extend `decimalPlaces` method accordingly. -* Remove methods: `ceil`, `floor`, and `truncated`. -* Remove method aliases: `add`, `cmp`, `isInt`, `isNeg`, `trunc`, `mul`, `neg` and `sub`. -* Rename methods: `shift` to `shiftedBy`, `another` to `clone`, `toPower` to `exponentiatedBy`, and `equals` to `isEqualTo`. -* Rename methods: add `is` prefix to `greaterThan`, `greaterThanOrEqualTo`, `lessThan` and `lessThanOrEqualTo`. -* Add methods: `multipliedBy`, `isBigNumber`, `isPositive`, `integerValue`, `maximum` and `minimum`. -* Refactor test suite. -* Add *CHANGELOG.md*. -* Rewrite *bignumber.d.ts*. -* Redo API image. - -#### 5.0.0 -* 27/11/2017 -* #81 Don't throw on constructor call without `new`. - -#### 4.1.0 -* 26/09/2017 -* Remove node 0.6 from *.travis.yml*. -* Add *bignumber.mjs*. - -#### 4.0.4 -* 03/09/2017 -* Add missing aliases to *bignumber.d.ts*. - -#### 4.0.3 -* 30/08/2017 -* Add types: *bignumber.d.ts*. - -#### 4.0.2 -* 03/05/2017 -* #120 Workaround Safari/Webkit bug. - -#### 4.0.1 -* 05/04/2017 -* #121 BigNumber.default to BigNumber['default']. - -#### 4.0.0 -* 09/01/2017 -* Replace BigNumber.isBigNumber method with isBigNumber prototype property. - -#### 3.1.2 -* 08/01/2017 -* Minor documentation edit. - -#### 3.1.1 -* 08/01/2017 -* Uncomment `isBigNumber` tests. -* Ignore dot files. - -#### 3.1.0 -* 08/01/2017 -* Add `isBigNumber` method. - -#### 3.0.2 -* 08/01/2017 -* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope). - -#### 3.0.1 -* 23/11/2016 -* Apply fix for old ipads with `%` issue, see #57 and #102. -* Correct error message. - -#### 3.0.0 -* 09/11/2016 -* Remove `require('crypto')` - leave it to the user. -* Add `BigNumber.set` as `BigNumber.config` alias. -* Default `POW_PRECISION` to `0`. - -#### 2.4.0 -* 14/07/2016 -* #97 Add exports to support ES6 imports. - -#### 2.3.0 -* 07/03/2016 -* #86 Add modulus parameter to `toPower`. - -#### 2.2.0 -* 03/03/2016 -* #91 Permit larger JS integers. - -#### 2.1.4 -* 15/12/2015 -* Correct UMD. - -#### 2.1.3 -* 13/12/2015 -* Refactor re global object and crypto availability when bundling. - -#### 2.1.2 -* 10/12/2015 -* Bugfix: `window.crypto` not assigned to `crypto`. - -#### 2.1.1 -* 09/12/2015 -* Prevent code bundler from adding `crypto` shim. - -#### 2.1.0 -* 26/10/2015 -* For `valueOf` and `toJSON`, include the minus sign with negative zero. - -#### 2.0.8 -* 2/10/2015 -* Internal round function bugfix. - -#### 2.0.6 -* 31/03/2015 -* Add bower.json. Tweak division after in-depth review. - -#### 2.0.5 -* 25/03/2015 -* Amend README. Remove bitcoin address. - -#### 2.0.4 -* 25/03/2015 -* Critical bugfix #58: division. - -#### 2.0.3 -* 18/02/2015 -* Amend README. Add source map. - -#### 2.0.2 -* 18/02/2015 -* Correct links. - -#### 2.0.1 -* 18/02/2015 -* Add `max`, `min`, `precision`, `random`, `shiftedBy`, `toDigits` and `truncated` methods. -* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`. -* Add an `another` method to enable multiple independent constructors to be created. -* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`. -* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`. -* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified. -* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified. -* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited. -* Improve code quality. -* Improve documentation. - -#### 2.0.0 -* 29/12/2014 -* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods. -* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`. -* Store a BigNumber's coefficient in base 1e14, rather than base 10. -* Add fast path for integers to BigNumber constructor. -* Incorporate the library into the online documentation. - -#### 1.5.0 -* 13/11/2014 -* Add `toJSON` and `decimalPlaces` methods. - -#### 1.4.1 -* 08/06/2014 -* Amend README. - -#### 1.4.0 -* 08/05/2014 -* Add `toNumber`. - -#### 1.3.0 -* 08/11/2013 -* Ensure correct rounding of `sqrt` in all, rather than almost all, cases. -* Maximum radix to 64. - -#### 1.2.1 -* 17/10/2013 -* Sign of zero when x < 0 and x + (-x) = 0. - -#### 1.2.0 -* 19/9/2013 -* Throw Error objects for stack. - -#### 1.1.1 -* 22/8/2013 -* Show original value in constructor error message. - -#### 1.1.0 -* 1/8/2013 -* Allow numbers with trailing radix point. - -#### 1.0.1 -* Bugfix: error messages with incorrect method name - -#### 1.0.0 -* 8/11/2012 -* Initial release diff --git a/node_modules/bignumber.js/LICENCE.md b/node_modules/bignumber.js/LICENCE.md deleted file mode 100644 index 4c3244dc..00000000 --- a/node_modules/bignumber.js/LICENCE.md +++ /dev/null @@ -1,26 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright © `<2020>` `Michael Mclaughlin` - -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. - diff --git a/node_modules/bignumber.js/README.md b/node_modules/bignumber.js/README.md deleted file mode 100644 index 3b5ac261..00000000 --- a/node_modules/bignumber.js/README.md +++ /dev/null @@ -1,273 +0,0 @@ -![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png) - -A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic. - -[![npm version](https://img.shields.io/npm/v/bignumber.js.svg)](https://www.npmjs.com/package/bignumber.js) -[![npm downloads](https://img.shields.io/npm/dw/bignumber.js)](https://www.npmjs.com/package/bignumber.js) -[![build status](https://travis-ci.org/MikeMcl/bignumber.js.svg)](https://travis-ci.org/MikeMcl/bignumber.js) - -
- -## Features - -- Integers and decimals -- Simple API but full-featured -- Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal -- 8 KB minified and gzipped -- Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type -- Includes a `toFraction` and a correctly-rounded `squareRoot` method -- Supports cryptographically-secure pseudo-random number generation -- No dependencies -- Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only -- Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set - -![API](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/API.png) - -If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/). -It's less than half the size but only works with decimal numbers and only has half the methods. -It also does not allow `NaN` or `Infinity`, or have the configuration options of this library. - -See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits. - -## Load - -The library is the single JavaScript file *bignumber.js* or ES module *bignumber.mjs*. - -### Browser: - -```html - -``` - -> ES module - -```html - -``` - -### [Node.js](http://nodejs.org): - -```bash -$ npm install bignumber.js -``` - -```javascript -const BigNumber = require('bignumber.js'); -``` - -> ES module - -```javascript -import BigNumber from "bignumber.js"; -// or -import { BigNumber } from "bignumber.js"; -``` - -## Use - -The library exports a single constructor function, [`BigNumber`](http://mikemcl.github.io/bignumber.js/#bignumber), which accepts a value of type Number, String or BigNumber, - -```javascript -let x = new BigNumber(123.4567); -let y = BigNumber('123456.7e-3'); -let z = new BigNumber(x); -x.isEqualTo(y) && y.isEqualTo(z) && x.isEqualTo(z); // true -``` - -To get the string value of a BigNumber use [`toString()`](http://mikemcl.github.io/bignumber.js/#toS) or [`toFixed()`](http://mikemcl.github.io/bignumber.js/#toFix). Using `toFixed()` prevents exponential notation being returned, no matter how large or small the value. - -```javascript -let x = new BigNumber('1111222233334444555566'); -x.toString(); // "1.111222233334444555566e+21" -x.toFixed(); // "1111222233334444555566" -``` - -If the limited precision of Number values is not well understood, it is recommended to create BigNumbers from String values rather than Number values to avoid a potential loss of precision. - -*In all further examples below, `let`, semicolons and `toString` calls are not shown. If a commented-out value is in quotes it means `toString` has been called on the preceding expression.* - -```javascript -// Precision loss from using numeric literals with more than 15 significant digits. -new BigNumber(1.0000000000000001) // '1' -new BigNumber(88259496234518.57) // '88259496234518.56' -new BigNumber(99999999999999999999) // '100000000000000000000' - -// Precision loss from using numeric literals outside the range of Number values. -new BigNumber(2e+308) // 'Infinity' -new BigNumber(1e-324) // '0' - -// Precision loss from the unexpected result of arithmetic with Number values. -new BigNumber(0.7 + 0.1) // '0.7999999999999999' -``` - -When creating a BigNumber from a Number, note that a BigNumber is created from a Number's decimal `toString()` value not from its underlying binary value. If the latter is required, then pass the Number's `toString(2)` value and specify base 2. - -```javascript -new BigNumber(Number.MAX_VALUE.toString(2), 2) -``` - -BigNumbers can be created from values in bases from 2 to 36. See [`ALPHABET`](http://mikemcl.github.io/bignumber.js/#alphabet) to extend this range. - -```javascript -a = new BigNumber(1011, 2) // "11" -b = new BigNumber('zz.9', 36) // "1295.25" -c = a.plus(b) // "1306.25" -``` - -*Performance is better if base 10 is NOT specified for decimal values. Only specify base 10 when it is desired that the number of decimal places of the input value be limited to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.* - -A BigNumber is immutable in the sense that it is not changed by its methods. - -```javascript -0.3 - 0.1 // 0.19999999999999998 -x = new BigNumber(0.3) -x.minus(0.1) // "0.2" -x // "0.3" -``` - -The methods that return a BigNumber can be chained. - -```javascript -x.dividedBy(y).plus(z).times(9) -x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').integerValue() -``` - -Some of the longer method names have a shorter alias. - -```javascript -x.squareRoot().dividedBy(y).exponentiatedBy(3).isEqualTo(x.sqrt().div(y).pow(3)) // true -x.modulo(y).multipliedBy(z).eq(x.mod(y).times(z)) // true -``` - -As with JavaScript's Number type, there are [`toExponential`](http://mikemcl.github.io/bignumber.js/#toE), [`toFixed`](http://mikemcl.github.io/bignumber.js/#toFix) and [`toPrecision`](http://mikemcl.github.io/bignumber.js/#toP) methods. - -```javascript -x = new BigNumber(255.5) -x.toExponential(5) // "2.55500e+2" -x.toFixed(5) // "255.50000" -x.toPrecision(5) // "255.50" -x.toNumber() // 255.5 -``` - - A base can be specified for [`toString`](http://mikemcl.github.io/bignumber.js/#toS). - -*Performance is better if base 10 is NOT specified, i.e. use `toString()` not `toString(10)`. Only specify base 10 when it is desired that the number of decimal places be limited to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.* - - ```javascript - x.toString(16) // "ff.8" - ``` - -There is a [`toFormat`](http://mikemcl.github.io/bignumber.js/#toFor) method which may be useful for internationalisation. - -```javascript -y = new BigNumber('1234567.898765') -y.toFormat(2) // "1,234,567.90" -``` - -The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `set` or `config` method of the `BigNumber` constructor. - -The other arithmetic operations always give the exact result. - -```javascript -BigNumber.set({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 }) - -x = new BigNumber(2) -y = new BigNumber(3) -z = x.dividedBy(y) // "0.6666666667" -z.squareRoot() // "0.8164965809" -z.exponentiatedBy(-3) // "3.3749999995" -z.toString(2) // "0.1010101011" -z.multipliedBy(z) // "0.44444444448888888889" -z.multipliedBy(z).decimalPlaces(10) // "0.4444444445" -``` - -There is a [`toFraction`](http://mikemcl.github.io/bignumber.js/#toFr) method with an optional *maximum denominator* argument - -```javascript -y = new BigNumber(355) -pi = y.dividedBy(113) // "3.1415929204" -pi.toFraction() // [ "7853982301", "2500000000" ] -pi.toFraction(1000) // [ "355", "113" ] -``` - -and [`isNaN`](http://mikemcl.github.io/bignumber.js/#isNaN) and [`isFinite`](http://mikemcl.github.io/bignumber.js/#isF) methods, as `NaN` and `Infinity` are valid `BigNumber` values. - -```javascript -x = new BigNumber(NaN) // "NaN" -y = new BigNumber(Infinity) // "Infinity" -x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true -``` - -The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign. - -```javascript -x = new BigNumber(-123.456); -x.c // [ 123, 45600000000000 ] coefficient (i.e. significand) -x.e // 2 exponent -x.s // -1 sign -``` - -For advanced usage, multiple BigNumber constructors can be created, each with their own independent configuration. - -```javascript -// Set DECIMAL_PLACES for the original BigNumber constructor -BigNumber.set({ DECIMAL_PLACES: 10 }) - -// Create another BigNumber constructor, optionally passing in a configuration object -BN = BigNumber.clone({ DECIMAL_PLACES: 5 }) - -x = new BigNumber(1) -y = new BN(1) - -x.div(3) // '0.3333333333' -y.div(3) // '0.33333' -``` - -To avoid having to call `toString` or `valueOf` on a BigNumber to get its value in the Node.js REPL or when using `console.log` use - -```javascript -BigNumber.prototype[require('util').inspect.custom] = BigNumber.prototype.valueOf; -``` - -For further information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory. - -## Test - -The *test/modules* directory contains the test scripts for each method. - -The tests can be run with Node.js or a browser. For Node.js use - - $ npm test - -or - - $ node test/test - -To test a single method, use, for example - - $ node test/methods/toFraction - -For the browser, open *test/test.html*. - -## Build - -For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed - - npm install uglify-js -g - -then - - npm run build - -will create *bignumber.min.js*. - -A source map will also be created in the root directory. - -## Licence - -The MIT Licence. - -See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE). diff --git a/node_modules/bignumber.js/bignumber.d.ts b/node_modules/bignumber.js/bignumber.d.ts deleted file mode 100644 index aaf93220..00000000 --- a/node_modules/bignumber.js/bignumber.d.ts +++ /dev/null @@ -1,1829 +0,0 @@ -// Type definitions for bignumber.js >=8.1.0 -// Project: https://github.com/MikeMcl/bignumber.js -// Definitions by: Michael Mclaughlin -// Definitions: https://github.com/MikeMcl/bignumber.js - -// Documentation: http://mikemcl.github.io/bignumber.js/ -// -// Exports: -// -// class BigNumber (default export) -// type BigNumber.Constructor -// type BigNumber.ModuloMode -// type BigNumber.RoundingMOde -// type BigNumber.Value -// interface BigNumber.Config -// interface BigNumber.Format -// interface BigNumber.Instance -// -// Example: -// -// import {BigNumber} from "bignumber.js" -// //import BigNumber from "bignumber.js" -// -// let rm: BigNumber.RoundingMode = BigNumber.ROUND_UP; -// let f: BigNumber.Format = { decimalSeparator: ',' }; -// let c: BigNumber.Config = { DECIMAL_PLACES: 4, ROUNDING_MODE: rm, FORMAT: f }; -// BigNumber.config(c); -// -// let v: BigNumber.Value = '12345.6789'; -// let b: BigNumber = new BigNumber(v); -// -// The use of compiler option `--strictNullChecks` is recommended. - -export default BigNumber; - -export namespace BigNumber { - - /** See `BigNumber.config` (alias `BigNumber.set`) and `BigNumber.clone`. */ - interface Config { - - /** - * An integer, 0 to 1e+9. Default value: 20. - * - * The maximum number of decimal places of the result of operations involving division, i.e. - * division, square root and base conversion operations, and exponentiation when the exponent is - * negative. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 5 }) - * BigNumber.set({ DECIMAL_PLACES: 5 }) - * ``` - */ - DECIMAL_PLACES?: number; - - /** - * An integer, 0 to 8. Default value: `BigNumber.ROUND_HALF_UP` (4). - * - * The rounding mode used in operations that involve division (see `DECIMAL_PLACES`) and the - * default rounding mode of the `decimalPlaces`, `precision`, `toExponential`, `toFixed`, - * `toFormat` and `toPrecision` methods. - * - * The modes are available as enumerated properties of the BigNumber constructor. - * - * ```ts - * BigNumber.config({ ROUNDING_MODE: 0 }) - * BigNumber.set({ ROUNDING_MODE: BigNumber.ROUND_UP }) - * ``` - */ - ROUNDING_MODE?: BigNumber.RoundingMode; - - /** - * An integer, 0 to 1e+9, or an array, [-1e+9 to 0, 0 to 1e+9]. - * Default value: `[-7, 20]`. - * - * The exponent value(s) at which `toString` returns exponential notation. - * - * If a single number is assigned, the value is the exponent magnitude. - * - * If an array of two numbers is assigned then the first number is the negative exponent value at - * and beneath which exponential notation is used, and the second number is the positive exponent - * value at and above which exponential notation is used. - * - * For example, to emulate JavaScript numbers in terms of the exponent values at which they begin - * to use exponential notation, use `[-7, 20]`. - * - * ```ts - * BigNumber.config({ EXPONENTIAL_AT: 2 }) - * new BigNumber(12.3) // '12.3' e is only 1 - * new BigNumber(123) // '1.23e+2' - * new BigNumber(0.123) // '0.123' e is only -1 - * new BigNumber(0.0123) // '1.23e-2' - * - * BigNumber.config({ EXPONENTIAL_AT: [-7, 20] }) - * new BigNumber(123456789) // '123456789' e is only 8 - * new BigNumber(0.000000123) // '1.23e-7' - * - * // Almost never return exponential notation: - * BigNumber.config({ EXPONENTIAL_AT: 1e+9 }) - * - * // Always return exponential notation: - * BigNumber.config({ EXPONENTIAL_AT: 0 }) - * ``` - * - * Regardless of the value of `EXPONENTIAL_AT`, the `toFixed` method will always return a value in - * normal notation and the `toExponential` method will always return a value in exponential form. - * Calling `toString` with a base argument, e.g. `toString(10)`, will also always return normal - * notation. - */ - EXPONENTIAL_AT?: number | [number, number]; - - /** - * An integer, magnitude 1 to 1e+9, or an array, [-1e+9 to -1, 1 to 1e+9]. - * Default value: `[-1e+9, 1e+9]`. - * - * The exponent value(s) beyond which overflow to Infinity and underflow to zero occurs. - * - * If a single number is assigned, it is the maximum exponent magnitude: values wth a positive - * exponent of greater magnitude become Infinity and those with a negative exponent of greater - * magnitude become zero. - * - * If an array of two numbers is assigned then the first number is the negative exponent limit and - * the second number is the positive exponent limit. - * - * For example, to emulate JavaScript numbers in terms of the exponent values at which they - * become zero and Infinity, use [-324, 308]. - * - * ```ts - * BigNumber.config({ RANGE: 500 }) - * BigNumber.config().RANGE // [ -500, 500 ] - * new BigNumber('9.999e499') // '9.999e+499' - * new BigNumber('1e500') // 'Infinity' - * new BigNumber('1e-499') // '1e-499' - * new BigNumber('1e-500') // '0' - * - * BigNumber.config({ RANGE: [-3, 4] }) - * new BigNumber(99999) // '99999' e is only 4 - * new BigNumber(100000) // 'Infinity' e is 5 - * new BigNumber(0.001) // '0.01' e is only -3 - * new BigNumber(0.0001) // '0' e is -4 - * ``` - * The largest possible magnitude of a finite BigNumber is 9.999...e+1000000000. - * The smallest possible magnitude of a non-zero BigNumber is 1e-1000000000. - */ - RANGE?: number | [number, number]; - - /** - * A boolean: `true` or `false`. Default value: `false`. - * - * The value that determines whether cryptographically-secure pseudo-random number generation is - * used. If `CRYPTO` is set to true then the random method will generate random digits using - * `crypto.getRandomValues` in browsers that support it, or `crypto.randomBytes` if using a - * version of Node.js that supports it. - * - * If neither function is supported by the host environment then attempting to set `CRYPTO` to - * `true` will fail and an exception will be thrown. - * - * If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is - * assumed to generate at least 30 bits of randomness). - * - * See `BigNumber.random`. - * - * ```ts - * // Node.js - * global.crypto = require('crypto') - * - * BigNumber.config({ CRYPTO: true }) - * BigNumber.config().CRYPTO // true - * BigNumber.random() // 0.54340758610486147524 - * ``` - */ - CRYPTO?: boolean; - - /** - * An integer, 0, 1, 3, 6 or 9. Default value: `BigNumber.ROUND_DOWN` (1). - * - * The modulo mode used when calculating the modulus: `a mod n`. - * The quotient, `q = a / n`, is calculated according to the `ROUNDING_MODE` that corresponds to - * the chosen `MODULO_MODE`. - * The remainder, `r`, is calculated as: `r = a - n * q`. - * - * The modes that are most commonly used for the modulus/remainder operation are shown in the - * following table. Although the other rounding modes can be used, they may not give useful - * results. - * - * Property | Value | Description - * :------------------|:------|:------------------------------------------------------------------ - * `ROUND_UP` | 0 | The remainder is positive if the dividend is negative. - * `ROUND_DOWN` | 1 | The remainder has the same sign as the dividend. - * | | Uses 'truncating division' and matches JavaScript's `%` operator . - * `ROUND_FLOOR` | 3 | The remainder has the same sign as the divisor. - * | | This matches Python's `%` operator. - * `ROUND_HALF_EVEN` | 6 | The IEEE 754 remainder function. - * `EUCLID` | 9 | The remainder is always positive. - * | | Euclidian division: `q = sign(n) * floor(a / abs(n))` - * - * The rounding/modulo modes are available as enumerated properties of the BigNumber constructor. - * - * See `modulo`. - * - * ```ts - * BigNumber.config({ MODULO_MODE: BigNumber.EUCLID }) - * BigNumber.set({ MODULO_MODE: 9 }) // equivalent - * ``` - */ - MODULO_MODE?: BigNumber.ModuloMode; - - /** - * An integer, 0 to 1e+9. Default value: 0. - * - * The maximum precision, i.e. number of significant digits, of the result of the power operation - * - unless a modulus is specified. - * - * If set to 0, the number of significant digits will not be limited. - * - * See `exponentiatedBy`. - * - * ```ts - * BigNumber.config({ POW_PRECISION: 100 }) - * ``` - */ - POW_PRECISION?: number; - - /** - * An object including any number of the properties shown below. - * - * The object configures the format of the string returned by the `toFormat` method. - * The example below shows the properties of the object that are recognised, and - * their default values. - * - * Unlike the other configuration properties, the values of the properties of the `FORMAT` object - * will not be checked for validity - the existing object will simply be replaced by the object - * that is passed in. - * - * See `toFormat`. - * - * ```ts - * BigNumber.config({ - * FORMAT: { - * // string to prepend - * prefix: '', - * // the decimal separator - * decimalSeparator: '.', - * // the grouping separator of the integer part - * groupSeparator: ',', - * // the primary grouping size of the integer part - * groupSize: 3, - * // the secondary grouping size of the integer part - * secondaryGroupSize: 0, - * // the grouping separator of the fraction part - * fractionGroupSeparator: ' ', - * // the grouping size of the fraction part - * fractionGroupSize: 0, - * // string to append - * suffix: '' - * } - * }) - * ``` - */ - FORMAT?: BigNumber.Format; - - /** - * The alphabet used for base conversion. The length of the alphabet corresponds to the maximum - * value of the base argument that can be passed to the BigNumber constructor or `toString`. - * - * Default value: `'0123456789abcdefghijklmnopqrstuvwxyz'`. - * - * There is no maximum length for the alphabet, but it must be at least 2 characters long, - * and it must not contain whitespace or a repeated character, or the sign indicators '+' and - * '-', or the decimal separator '.'. - * - * ```ts - * // duodecimal (base 12) - * BigNumber.config({ ALPHABET: '0123456789TE' }) - * x = new BigNumber('T', 12) - * x.toString() // '10' - * x.toString(12) // 'T' - * ``` - */ - ALPHABET?: string; - } - - /** See `FORMAT` and `toFormat`. */ - interface Format { - - /** The string to prepend. */ - prefix?: string; - - /** The decimal separator. */ - decimalSeparator?: string; - - /** The grouping separator of the integer part. */ - groupSeparator?: string; - - /** The primary grouping size of the integer part. */ - groupSize?: number; - - /** The secondary grouping size of the integer part. */ - secondaryGroupSize?: number; - - /** The grouping separator of the fraction part. */ - fractionGroupSeparator?: string; - - /** The grouping size of the fraction part. */ - fractionGroupSize?: number; - - /** The string to append. */ - suffix?: string; - } - - interface Instance { - - /** The coefficient of the value of this BigNumber, an array of base 1e14 integer numbers, or null. */ - readonly c: number[] | null; - - /** The exponent of the value of this BigNumber, an integer number, -1000000000 to 1000000000, or null. */ - readonly e: number | null; - - /** The sign of the value of this BigNumber, -1, 1, or null. */ - readonly s: number | null; - - [key: string]: any; - } - - type Constructor = typeof BigNumber; - type ModuloMode = 0 | 1 | 3 | 6 | 9; - type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; - type Value = string | number | Instance; -} - -export declare class BigNumber implements BigNumber.Instance { - - /** Used internally to identify a BigNumber instance. */ - private readonly _isBigNumber: true; - - /** The coefficient of the value of this BigNumber, an array of base 1e14 integer numbers, or null. */ - readonly c: number[] | null; - - /** The exponent of the value of this BigNumber, an integer number, -1000000000 to 1000000000, or null. */ - readonly e: number | null; - - /** The sign of the value of this BigNumber, -1, 1, or null. */ - readonly s: number | null; - - /** - * Returns a new instance of a BigNumber object with value `n`, where `n` is a numeric value in - * the specified `base`, or base 10 if `base` is omitted or is `null` or `undefined`. - * - * ```ts - * x = new BigNumber(123.4567) // '123.4567' - * // 'new' is optional - * y = BigNumber(x) // '123.4567' - * ``` - * - * If `n` is a base 10 value it can be in normal (fixed-point) or exponential notation. - * Values in other bases must be in normal notation. Values in any base can have fraction digits, - * i.e. digits after the decimal point. - * - * ```ts - * new BigNumber(43210) // '43210' - * new BigNumber('4.321e+4') // '43210' - * new BigNumber('-735.0918e-430') // '-7.350918e-428' - * new BigNumber('123412421.234324', 5) // '607236.557696' - * ``` - * - * Signed `0`, signed `Infinity` and `NaN` are supported. - * - * ```ts - * new BigNumber('-Infinity') // '-Infinity' - * new BigNumber(NaN) // 'NaN' - * new BigNumber(-0) // '0' - * new BigNumber('.5') // '0.5' - * new BigNumber('+2') // '2' - * ``` - * - * String values in hexadecimal literal form, e.g. `'0xff'`, are valid, as are string values with - * the octal and binary prefixs `'0o'` and `'0b'`. String values in octal literal form without the - * prefix will be interpreted as decimals, e.g. `'011'` is interpreted as 11, not 9. - * - * ```ts - * new BigNumber(-10110100.1, 2) // '-180.5' - * new BigNumber('-0b10110100.1') // '-180.5' - * new BigNumber('ff.8', 16) // '255.5' - * new BigNumber('0xff.8') // '255.5' - * ``` - * - * If a base is specified, `n` is rounded according to the current `DECIMAL_PLACES` and - * `ROUNDING_MODE` settings. This includes base 10, so don't include a `base` parameter for decimal - * values unless this behaviour is desired. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 5 }) - * new BigNumber(1.23456789) // '1.23456789' - * new BigNumber(1.23456789, 10) // '1.23457' - * ``` - * - * An error is thrown if `base` is invalid. - * - * There is no limit to the number of digits of a value of type string (other than that of - * JavaScript's maximum array size). See `RANGE` to set the maximum and minimum possible exponent - * value of a BigNumber. - * - * ```ts - * new BigNumber('5032485723458348569331745.33434346346912144534543') - * new BigNumber('4.321e10000000') - * ``` - * - * BigNumber `NaN` is returned if `n` is invalid (unless `BigNumber.DEBUG` is `true`, see below). - * - * ```ts - * new BigNumber('.1*') // 'NaN' - * new BigNumber('blurgh') // 'NaN' - * new BigNumber(9, 2) // 'NaN' - * ``` - * - * To aid in debugging, if `BigNumber.DEBUG` is `true` then an error will be thrown on an - * invalid `n`. An error will also be thrown if `n` is of type number with more than 15 - * significant digits, as calling `toString` or `valueOf` on these numbers may not result in the - * intended value. - * - * ```ts - * console.log(823456789123456.3) // 823456789123456.2 - * new BigNumber(823456789123456.3) // '823456789123456.2' - * BigNumber.DEBUG = true - * // 'Error: Number has more than 15 significant digits' - * new BigNumber(823456789123456.3) - * // 'Error: Not a base 2 number' - * new BigNumber(9, 2) - * ``` - * - * A BigNumber can also be created from an object literal. - * Use `isBigNumber` to check that it is well-formed. - * - * ```ts - * new BigNumber({ s: 1, e: 2, c: [ 777, 12300000000000 ], _isBigNumber: true }) // '777.123' - * ``` - * - * @param n A numeric value. - * @param base The base of `n`, integer, 2 to 36 (or `ALPHABET.length`, see `ALPHABET`). - */ - constructor(n: BigNumber.Value, base?: number); - - /** - * Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this - * BigNumber. - * - * The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber(-0.8) - * x.absoluteValue() // '0.8' - * ``` - */ - absoluteValue(): BigNumber; - - /** - * Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this - * BigNumber. - * - * The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber(-0.8) - * x.abs() // '0.8' - * ``` - */ - abs(): BigNumber; - - /** - * Returns | | - * :-------:|:--------------------------------------------------------------| - * 1 | If the value of this BigNumber is greater than the value of `n` - * -1 | If the value of this BigNumber is less than the value of `n` - * 0 | If this BigNumber and `n` have the same value - * `null` | If the value of either this BigNumber or `n` is `NaN` - * - * ```ts - * - * x = new BigNumber(Infinity) - * y = new BigNumber(5) - * x.comparedTo(y) // 1 - * x.comparedTo(x.minus(1)) // 0 - * y.comparedTo(NaN) // null - * y.comparedTo('110', 2) // -1 - * ``` - * @param n A numeric value. - * @param [base] The base of n. - */ - comparedTo(n: BigNumber.Value, base?: number): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode - * `roundingMode` to a maximum of `decimalPlaces` decimal places. - * - * If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of - * decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is - * ±`Infinity` or `NaN`. - * - * If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * Throws if `decimalPlaces` or `roundingMode` is invalid. - * - * ```ts - * x = new BigNumber(1234.56) - * x.decimalPlaces() // 2 - * x.decimalPlaces(1) // '1234.6' - * x.decimalPlaces(2) // '1234.56' - * x.decimalPlaces(10) // '1234.56' - * x.decimalPlaces(0, 1) // '1234' - * x.decimalPlaces(0, 6) // '1235' - * x.decimalPlaces(1, 1) // '1234.5' - * x.decimalPlaces(1, BigNumber.ROUND_HALF_EVEN) // '1234.6' - * x // '1234.56' - * y = new BigNumber('9.9e-101') - * y.decimalPlaces() // 102 - * ``` - * - * @param [decimalPlaces] Decimal places, integer, 0 to 1e+9. - * @param [roundingMode] Rounding mode, integer, 0 to 8. - */ - decimalPlaces(): number; - decimalPlaces(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode - * `roundingMode` to a maximum of `decimalPlaces` decimal places. - * - * If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of - * decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is - * ±`Infinity` or `NaN`. - * - * If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * Throws if `decimalPlaces` or `roundingMode` is invalid. - * - * ```ts - * x = new BigNumber(1234.56) - * x.dp() // 2 - * x.dp(1) // '1234.6' - * x.dp(2) // '1234.56' - * x.dp(10) // '1234.56' - * x.dp(0, 1) // '1234' - * x.dp(0, 6) // '1235' - * x.dp(1, 1) // '1234.5' - * x.dp(1, BigNumber.ROUND_HALF_EVEN) // '1234.6' - * x // '1234.56' - * y = new BigNumber('9.9e-101') - * y.dp() // 102 - * ``` - * - * @param [decimalPlaces] Decimal places, integer, 0 to 1e+9. - * @param [roundingMode] Rounding mode, integer, 0 to 8. - */ - dp(): number; - dp(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded - * according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings. - * - * ```ts - * x = new BigNumber(355) - * y = new BigNumber(113) - * x.dividedBy(y) // '3.14159292035398230088' - * x.dividedBy(5) // '71' - * x.dividedBy(47, 16) // '5' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - dividedBy(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded - * according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings. - * - * ```ts - * x = new BigNumber(355) - * y = new BigNumber(113) - * x.div(y) // '3.14159292035398230088' - * x.div(5) // '71' - * x.div(47, 16) // '5' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - div(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by - * `n`. - * - * ```ts - * x = new BigNumber(5) - * y = new BigNumber(3) - * x.dividedToIntegerBy(y) // '1' - * x.dividedToIntegerBy(0.7) // '7' - * x.dividedToIntegerBy('0.f', 16) // '5' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - dividedToIntegerBy(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by - * `n`. - * - * ```ts - * x = new BigNumber(5) - * y = new BigNumber(3) - * x.idiv(y) // '1' - * x.idiv(0.7) // '7' - * x.idiv('0.f', 16) // '5' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - idiv(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber exponentiated by `n`, i.e. - * raised to the power `n`, and optionally modulo a modulus `m`. - * - * If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and - * `ROUNDING_MODE` settings. - * - * As the number of digits of the result of the power operation can grow so large so quickly, - * e.g. 123.456**10000 has over 50000 digits, the number of significant digits calculated is - * limited to the value of the `POW_PRECISION` setting (unless a modulus `m` is specified). - * - * By default `POW_PRECISION` is set to 0. This means that an unlimited number of significant - * digits will be calculated, and that the method's performance will decrease dramatically for - * larger exponents. - * - * If `m` is specified and the value of `m`, `n` and this BigNumber are integers and `n` is - * positive, then a fast modular exponentiation algorithm is used, otherwise the operation will - * be performed as `x.exponentiatedBy(n).modulo(m)` with a `POW_PRECISION` of 0. - * - * Throws if `n` is not an integer. - * - * ```ts - * Math.pow(0.7, 2) // 0.48999999999999994 - * x = new BigNumber(0.7) - * x.exponentiatedBy(2) // '0.49' - * BigNumber(3).exponentiatedBy(-2) // '0.11111111111111111111' - * ``` - * - * @param n The exponent, an integer. - * @param [m] The modulus. - */ - exponentiatedBy(n: BigNumber.Value, m?: BigNumber.Value): BigNumber; - exponentiatedBy(n: number, m?: BigNumber.Value): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber exponentiated by `n`, i.e. - * raised to the power `n`, and optionally modulo a modulus `m`. - * - * If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and - * `ROUNDING_MODE` settings. - * - * As the number of digits of the result of the power operation can grow so large so quickly, - * e.g. 123.456**10000 has over 50000 digits, the number of significant digits calculated is - * limited to the value of the `POW_PRECISION` setting (unless a modulus `m` is specified). - * - * By default `POW_PRECISION` is set to 0. This means that an unlimited number of significant - * digits will be calculated, and that the method's performance will decrease dramatically for - * larger exponents. - * - * If `m` is specified and the value of `m`, `n` and this BigNumber are integers and `n` is - * positive, then a fast modular exponentiation algorithm is used, otherwise the operation will - * be performed as `x.pow(n).modulo(m)` with a `POW_PRECISION` of 0. - * - * Throws if `n` is not an integer. - * - * ```ts - * Math.pow(0.7, 2) // 0.48999999999999994 - * x = new BigNumber(0.7) - * x.pow(2) // '0.49' - * BigNumber(3).pow(-2) // '0.11111111111111111111' - * ``` - * - * @param n The exponent, an integer. - * @param [m] The modulus. - */ - pow(n: BigNumber.Value, m?: BigNumber.Value): BigNumber; - pow(n: number, m?: BigNumber.Value): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using - * rounding mode `rm`. - * - * If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * Throws if `rm` is invalid. - * - * ```ts - * x = new BigNumber(123.456) - * x.integerValue() // '123' - * x.integerValue(BigNumber.ROUND_CEIL) // '124' - * y = new BigNumber(-12.7) - * y.integerValue() // '-13' - * x.integerValue(BigNumber.ROUND_DOWN) // '-12' - * ``` - * - * @param {BigNumber.RoundingMode} [rm] The roundng mode, an integer, 0 to 8. - */ - integerValue(rm?: BigNumber.RoundingMode): BigNumber; - - /** - * Returns `true` if the value of this BigNumber is equal to the value of `n`, otherwise returns - * `false`. - * - * As with JavaScript, `NaN` does not equal `NaN`. - * - * ```ts - * 0 === 1e-324 // true - * x = new BigNumber(0) - * x.isEqualTo('1e-324') // false - * BigNumber(-0).isEqualTo(x) // true ( -0 === 0 ) - * BigNumber(255).isEqualTo('ff', 16) // true - * - * y = new BigNumber(NaN) - * y.isEqualTo(NaN) // false - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - isEqualTo(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is equal to the value of `n`, otherwise returns - * `false`. - * - * As with JavaScript, `NaN` does not equal `NaN`. - * - * ```ts - * 0 === 1e-324 // true - * x = new BigNumber(0) - * x.eq('1e-324') // false - * BigNumber(-0).eq(x) // true ( -0 === 0 ) - * BigNumber(255).eq('ff', 16) // true - * - * y = new BigNumber(NaN) - * y.eq(NaN) // false - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - eq(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is a finite number, otherwise returns `false`. - * - * The only possible non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`. - * - * ```ts - * x = new BigNumber(1) - * x.isFinite() // true - * y = new BigNumber(Infinity) - * y.isFinite() // false - * ``` - */ - isFinite(): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise - * returns `false`. - * - * ```ts - * 0.1 > (0.3 - 0.2) // true - * x = new BigNumber(0.1) - * x.isGreaterThan(BigNumber(0.3).minus(0.2)) // false - * BigNumber(0).isGreaterThan(x) // false - * BigNumber(11, 3).isGreaterThan(11.1, 2) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - isGreaterThan(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise - * returns `false`. - * - * ```ts - * 0.1 > (0.3 - 0 // true - * x = new BigNumber(0.1) - * x.gt(BigNumber(0.3).minus(0.2)) // false - * BigNumber(0).gt(x) // false - * BigNumber(11, 3).gt(11.1, 2) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - gt(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, - * otherwise returns `false`. - * - * ```ts - * (0.3 - 0.2) >= 0.1 // false - * x = new BigNumber(0.3).minus(0.2) - * x.isGreaterThanOrEqualTo(0.1) // true - * BigNumber(1).isGreaterThanOrEqualTo(x) // true - * BigNumber(10, 18).isGreaterThanOrEqualTo('i', 36) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - isGreaterThanOrEqualTo(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, - * otherwise returns `false`. - * - * ```ts - * (0.3 - 0.2) >= 0.1 // false - * x = new BigNumber(0.3).minus(0.2) - * x.gte(0.1) // true - * BigNumber(1).gte(x) // true - * BigNumber(10, 18).gte('i', 36) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - gte(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is an integer, otherwise returns `false`. - * - * ```ts - * x = new BigNumber(1) - * x.isInteger() // true - * y = new BigNumber(123.456) - * y.isInteger() // false - * ``` - */ - isInteger(): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns - * `false`. - * - * ```ts - * (0.3 - 0.2) < 0.1 // true - * x = new BigNumber(0.3).minus(0.2) - * x.isLessThan(0.1) // false - * BigNumber(0).isLessThan(x) // true - * BigNumber(11.1, 2).isLessThan(11, 3) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - isLessThan(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns - * `false`. - * - * ```ts - * (0.3 - 0.2) < 0.1 // true - * x = new BigNumber(0.3).minus(0.2) - * x.lt(0.1) // false - * BigNumber(0).lt(x) // true - * BigNumber(11.1, 2).lt(11, 3) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - lt(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, - * otherwise returns `false`. - * - * ```ts - * 0.1 <= (0.3 - 0.2) // false - * x = new BigNumber(0.1) - * x.isLessThanOrEqualTo(BigNumber(0.3).minus(0.2)) // true - * BigNumber(-1).isLessThanOrEqualTo(x) // true - * BigNumber(10, 18).isLessThanOrEqualTo('i', 36) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - isLessThanOrEqualTo(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, - * otherwise returns `false`. - * - * ```ts - * 0.1 <= (0.3 - 0.2) // false - * x = new BigNumber(0.1) - * x.lte(BigNumber(0.3).minus(0.2)) // true - * BigNumber(-1).lte(x) // true - * BigNumber(10, 18).lte('i', 36) // true - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - lte(n: BigNumber.Value, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is `NaN`, otherwise returns `false`. - * - * ```ts - * x = new BigNumber(NaN) - * x.isNaN() // true - * y = new BigNumber('Infinity') - * y.isNaN() // false - * ``` - */ - isNaN(): boolean; - - /** - * Returns `true` if the value of this BigNumber is negative, otherwise returns `false`. - * - * ```ts - * x = new BigNumber(-0) - * x.isNegative() // true - * y = new BigNumber(2) - * y.isNegative() // false - * ``` - */ - isNegative(): boolean; - - /** - * Returns `true` if the value of this BigNumber is positive, otherwise returns `false`. - * - * ```ts - * x = new BigNumber(-0) - * x.isPositive() // false - * y = new BigNumber(2) - * y.isPositive() // true - * ``` - */ - isPositive(): boolean; - - /** - * Returns `true` if the value of this BigNumber is zero or minus zero, otherwise returns `false`. - * - * ```ts - * x = new BigNumber(-0) - * x.isZero() // true - * ``` - */ - isZero(): boolean; - - /** - * Returns a BigNumber whose value is the value of this BigNumber minus `n`. - * - * The return value is always exact and unrounded. - * - * ```ts - * 0.3 - 0.1 // 0.19999999999999998 - * x = new BigNumber(0.3) - * x.minus(0.1) // '0.2' - * x.minus(0.6, 20) // '0' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - minus(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer - * remainder of dividing this BigNumber by `n`. - * - * The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` - * setting of this BigNumber constructor. If it is 1 (default value), the result will have the - * same sign as this BigNumber, and it will match that of Javascript's `%` operator (within the - * limits of double precision) and BigDecimal's `remainder` method. - * - * The return value is always exact and unrounded. - * - * See `MODULO_MODE` for a description of the other modulo modes. - * - * ```ts - * 1 % 0.9 // 0.09999999999999998 - * x = new BigNumber(1) - * x.modulo(0.9) // '0.1' - * y = new BigNumber(33) - * y.modulo('a', 33) // '3' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - modulo(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer - * remainder of dividing this BigNumber by `n`. - * - * The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` - * setting of this BigNumber constructor. If it is 1 (default value), the result will have the - * same sign as this BigNumber, and it will match that of Javascript's `%` operator (within the - * limits of double precision) and BigDecimal's `remainder` method. - * - * The return value is always exact and unrounded. - * - * See `MODULO_MODE` for a description of the other modulo modes. - * - * ```ts - * 1 % 0.9 // 0.09999999999999998 - * x = new BigNumber(1) - * x.mod(0.9) // '0.1' - * y = new BigNumber(33) - * y.mod('a', 33) // '3' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - mod(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber multiplied by `n`. - * - * The return value is always exact and unrounded. - * - * ```ts - * 0.6 * 3 // 1.7999999999999998 - * x = new BigNumber(0.6) - * y = x.multipliedBy(3) // '1.8' - * BigNumber('7e+500').multipliedBy(y) // '1.26e+501' - * x.multipliedBy('-a', 16) // '-6' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - multipliedBy(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber multiplied by `n`. - * - * The return value is always exact and unrounded. - * - * ```ts - * 0.6 * 3 // 1.7999999999999998 - * x = new BigNumber(0.6) - * y = x.times(3) // '1.8' - * BigNumber('7e+500').times(y) // '1.26e+501' - * x.times('-a', 16) // '-6' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - times(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by -1. - * - * ```ts - * x = new BigNumber(1.8) - * x.negated() // '-1.8' - * y = new BigNumber(-1.3) - * y.negated() // '1.3' - * ``` - */ - negated(): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber plus `n`. - * - * The return value is always exact and unrounded. - * - * ```ts - * 0.1 + 0.2 // 0.30000000000000004 - * x = new BigNumber(0.1) - * y = x.plus(0.2) // '0.3' - * BigNumber(0.7).plus(x).plus(y) // '1.1' - * x.plus('0.1', 8) // '0.225' - * ``` - * - * @param n A numeric value. - * @param [base] The base of n. - */ - plus(n: BigNumber.Value, base?: number): BigNumber; - - /** - * Returns the number of significant digits of the value of this BigNumber, or `null` if the value - * of this BigNumber is ±`Infinity` or `NaN`. - * - * If `includeZeros` is true then any trailing zeros of the integer part of the value of this - * BigNumber are counted as significant digits, otherwise they are not. - * - * Throws if `includeZeros` is invalid. - * - * ```ts - * x = new BigNumber(9876.54321) - * x.precision() // 9 - * y = new BigNumber(987000) - * y.precision(false) // 3 - * y.precision(true) // 6 - * ``` - * - * @param [includeZeros] Whether to include integer trailing zeros in the significant digit count. - */ - precision(includeZeros?: boolean): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of - * `significantDigits` significant digits using rounding mode `roundingMode`. - * - * If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used. - * - * Throws if `significantDigits` or `roundingMode` is invalid. - * - * ```ts - * x = new BigNumber(9876.54321) - * x.precision(6) // '9876.54' - * x.precision(6, BigNumber.ROUND_UP) // '9876.55' - * x.precision(2) // '9900' - * x.precision(2, 1) // '9800' - * x // '9876.54321' - * ``` - * - * @param significantDigits Significant digits, integer, 1 to 1e+9. - * @param [roundingMode] Rounding mode, integer, 0 to 8. - */ - precision(significantDigits: number, roundingMode?: BigNumber.RoundingMode): BigNumber; - - /** - * Returns the number of significant digits of the value of this BigNumber, - * or `null` if the value of this BigNumber is ±`Infinity` or `NaN`. - * - * If `includeZeros` is true then any trailing zeros of the integer part of - * the value of this BigNumber are counted as significant digits, otherwise - * they are not. - * - * Throws if `includeZeros` is invalid. - * - * ```ts - * x = new BigNumber(9876.54321) - * x.sd() // 9 - * y = new BigNumber(987000) - * y.sd(false) // 3 - * y.sd(true) // 6 - * ``` - * - * @param [includeZeros] Whether to include integer trailing zeros in the significant digit count. - */ - sd(includeZeros?: boolean): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of - * `significantDigits` significant digits using rounding mode `roundingMode`. - * - * If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used. - * - * Throws if `significantDigits` or `roundingMode` is invalid. - * - * ```ts - * x = new BigNumber(9876.54321) - * x.sd(6) // '9876.54' - * x.sd(6, BigNumber.ROUND_UP) // '9876.55' - * x.sd(2) // '9900' - * x.sd(2, 1) // '9800' - * x // '9876.54321' - * ``` - * - * @param significantDigits Significant digits, integer, 1 to 1e+9. - * @param [roundingMode] Rounding mode, integer, 0 to 8. - */ - sd(significantDigits: number, roundingMode?: BigNumber.RoundingMode): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber shifted by `n` places. - * - * The shift is of the decimal point, i.e. of powers of ten, and is to the left if `n` is negative - * or to the right if `n` is positive. - * - * The return value is always exact and unrounded. - * - * Throws if `n` is invalid. - * - * ```ts - * x = new BigNumber(1.23) - * x.shiftedBy(3) // '1230' - * x.shiftedBy(-3) // '0.00123' - * ``` - * - * @param n The shift value, integer, -9007199254740991 to 9007199254740991. - */ - shiftedBy(n: number): BigNumber; - - /** - * Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded - * according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings. - * - * The return value will be correctly rounded, i.e. rounded as if the result was first calculated - * to an infinite number of correct digits before rounding. - * - * ```ts - * x = new BigNumber(16) - * x.squareRoot() // '4' - * y = new BigNumber(3) - * y.squareRoot() // '1.73205080756887729353' - * ``` - */ - squareRoot(): BigNumber; - - /** - * Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded - * according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings. - * - * The return value will be correctly rounded, i.e. rounded as if the result was first calculated - * to an infinite number of correct digits before rounding. - * - * ```ts - * x = new BigNumber(16) - * x.sqrt() // '4' - * y = new BigNumber(3) - * y.sqrt() // '1.73205080756887729353' - * ``` - */ - sqrt(): BigNumber; - - /** - * Returns a string representing the value of this BigNumber in exponential notation rounded using - * rounding mode `roundingMode` to `decimalPlaces` decimal places, i.e with one digit before the - * decimal point and `decimalPlaces` digits after it. - * - * If the value of this BigNumber in exponential notation has fewer than `decimalPlaces` fraction - * digits, the return value will be appended with zeros accordingly. - * - * If `decimalPlaces` is omitted, or is `null` or `undefined`, the number of digits after the - * decimal point defaults to the minimum number of digits necessary to represent the value - * exactly. - * - * If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * Throws if `decimalPlaces` or `roundingMode` is invalid. - * - * ```ts - * x = 45.6 - * y = new BigNumber(x) - * x.toExponential() // '4.56e+1' - * y.toExponential() // '4.56e+1' - * x.toExponential(0) // '5e+1' - * y.toExponential(0) // '5e+1' - * x.toExponential(1) // '4.6e+1' - * y.toExponential(1) // '4.6e+1' - * y.toExponential(1, 1) // '4.5e+1' (ROUND_DOWN) - * x.toExponential(3) // '4.560e+1' - * y.toExponential(3) // '4.560e+1' - * ``` - * - * @param [decimalPlaces] Decimal places, integer, 0 to 1e+9. - * @param [roundingMode] Rounding mode, integer, 0 to 8. - */ - toExponential(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): string; - toExponential(): string; - - /** - * Returns a string representing the value of this BigNumber in normal (fixed-point) notation - * rounded to `decimalPlaces` decimal places using rounding mode `roundingMode`. - * - * If the value of this BigNumber in normal notation has fewer than `decimalPlaces` fraction - * digits, the return value will be appended with zeros accordingly. - * - * Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or - * equal to 10**21, this method will always return normal notation. - * - * If `decimalPlaces` is omitted or is `null` or `undefined`, the return value will be unrounded - * and in normal notation. This is also unlike `Number.prototype.toFixed`, which returns the value - * to zero decimal places. It is useful when normal notation is required and the current - * `EXPONENTIAL_AT` setting causes `toString` to return exponential notation. - * - * If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * Throws if `decimalPlaces` or `roundingMode` is invalid. - * - * ```ts - * x = 3.456 - * y = new BigNumber(x) - * x.toFixed() // '3' - * y.toFixed() // '3.456' - * y.toFixed(0) // '3' - * x.toFixed(2) // '3.46' - * y.toFixed(2) // '3.46' - * y.toFixed(2, 1) // '3.45' (ROUND_DOWN) - * x.toFixed(5) // '3.45600' - * y.toFixed(5) // '3.45600' - * ``` - * - * @param [decimalPlaces] Decimal places, integer, 0 to 1e+9. - * @param [roundingMode] Rounding mode, integer, 0 to 8. - */ - toFixed(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): string; - toFixed(): string; - - /** - * Returns a string representing the value of this BigNumber in normal (fixed-point) notation - * rounded to `decimalPlaces` decimal places using rounding mode `roundingMode`, and formatted - * according to the properties of the `format` or `FORMAT` object. - * - * The formatting object may contain some or all of the properties shown in the examples below. - * - * If `decimalPlaces` is omitted or is `null` or `undefined`, then the return value is not - * rounded to a fixed number of decimal places. - * - * If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * If `format` is omitted or is `null` or `undefined`, `FORMAT` is used. - * - * Throws if `decimalPlaces`, `roundingMode`, or `format` is invalid. - * - * ```ts - * fmt = { - * decimalSeparator: '.', - * groupSeparator: ',', - * groupSize: 3, - * secondaryGroupSize: 0, - * fractionGroupSeparator: ' ', - * fractionGroupSize: 0 - * } - * - * x = new BigNumber('123456789.123456789') - * - * // Set the global formatting options - * BigNumber.config({ FORMAT: fmt }) - * - * x.toFormat() // '123,456,789.123456789' - * x.toFormat(3) // '123,456,789.123' - * - * // If a reference to the object assigned to FORMAT has been retained, - * // the format properties can be changed directly - * fmt.groupSeparator = ' ' - * fmt.fractionGroupSize = 5 - * x.toFormat() // '123 456 789.12345 6789' - * - * // Alternatively, pass the formatting options as an argument - * fmt = { - * decimalSeparator: ',', - * groupSeparator: '.', - * groupSize: 3, - * secondaryGroupSize: 2 - * } - * - * x.toFormat() // '123 456 789.12345 6789' - * x.toFormat(fmt) // '12.34.56.789,123456789' - * x.toFormat(2, fmt) // '12.34.56.789,12' - * x.toFormat(3, BigNumber.ROUND_UP, fmt) // '12.34.56.789,124' - * ``` - * - * @param [decimalPlaces] Decimal places, integer, 0 to 1e+9. - * @param [roundingMode] Rounding mode, integer, 0 to 8. - * @param [format] Formatting options object. See `BigNumber.Format`. - */ - toFormat(decimalPlaces: number, roundingMode: BigNumber.RoundingMode, format?: BigNumber.Format): string; - toFormat(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): string; - toFormat(decimalPlaces?: number): string; - toFormat(decimalPlaces: number, format: BigNumber.Format): string; - toFormat(format: BigNumber.Format): string; - - /** - * Returns an array of two BigNumbers representing the value of this BigNumber as a simple - * fraction with an integer numerator and an integer denominator. - * The denominator will be a positive non-zero value less than or equal to `max_denominator`. - * If a maximum denominator, `max_denominator`, is not specified, or is `null` or `undefined`, the - * denominator will be the lowest value necessary to represent the number exactly. - * - * Throws if `max_denominator` is invalid. - * - * ```ts - * x = new BigNumber(1.75) - * x.toFraction() // '7, 4' - * - * pi = new BigNumber('3.14159265358') - * pi.toFraction() // '157079632679,50000000000' - * pi.toFraction(100000) // '312689, 99532' - * pi.toFraction(10000) // '355, 113' - * pi.toFraction(100) // '311, 99' - * pi.toFraction(10) // '22, 7' - * pi.toFraction(1) // '3, 1' - * ``` - * - * @param [max_denominator] The maximum denominator, integer > 0, or Infinity. - */ - toFraction(max_denominator?: BigNumber.Value): [BigNumber, BigNumber]; - - /** As `valueOf`. */ - toJSON(): string; - - /** - * Returns the value of this BigNumber as a JavaScript primitive number. - * - * Using the unary plus operator gives the same result. - * - * ```ts - * x = new BigNumber(456.789) - * x.toNumber() // 456.789 - * +x // 456.789 - * - * y = new BigNumber('45987349857634085409857349856430985') - * y.toNumber() // 4.598734985763409e+34 - * - * z = new BigNumber(-0) - * 1 / z.toNumber() // -Infinity - * 1 / +z // -Infinity - * ``` - */ - toNumber(): number; - - /** - * Returns a string representing the value of this BigNumber rounded to `significantDigits` - * significant digits using rounding mode `roundingMode`. - * - * If `significantDigits` is less than the number of digits necessary to represent the integer - * part of the value in normal (fixed-point) notation, then exponential notation is used. - * - * If `significantDigits` is omitted, or is `null` or `undefined`, then the return value is the - * same as `n.toString()`. - * - * If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * Throws if `significantDigits` or `roundingMode` is invalid. - * - * ```ts - * x = 45.6 - * y = new BigNumber(x) - * x.toPrecision() // '45.6' - * y.toPrecision() // '45.6' - * x.toPrecision(1) // '5e+1' - * y.toPrecision(1) // '5e+1' - * y.toPrecision(2, 0) // '4.6e+1' (ROUND_UP) - * y.toPrecision(2, 1) // '4.5e+1' (ROUND_DOWN) - * x.toPrecision(5) // '45.600' - * y.toPrecision(5) // '45.600' - * ``` - * - * @param [significantDigits] Significant digits, integer, 1 to 1e+9. - * @param [roundingMode] Rounding mode, integer 0 to 8. - */ - toPrecision(significantDigits: number, roundingMode?: BigNumber.RoundingMode): string; - toPrecision(): string; - - /** - * Returns a string representing the value of this BigNumber in base `base`, or base 10 if `base` - * is omitted or is `null` or `undefined`. - * - * For bases above 10, and using the default base conversion alphabet (see `ALPHABET`), values - * from 10 to 35 are represented by a-z (the same as `Number.prototype.toString`). - * - * If a base is specified the value is rounded according to the current `DECIMAL_PLACES` and - * `ROUNDING_MODE` settings, otherwise it is not. - * - * If a base is not specified, and this BigNumber has a positive exponent that is equal to or - * greater than the positive component of the current `EXPONENTIAL_AT` setting, or a negative - * exponent equal to or less than the negative component of the setting, then exponential notation - * is returned. - * - * If `base` is `null` or `undefined` it is ignored. - * - * Throws if `base` is invalid. - * - * ```ts - * x = new BigNumber(750000) - * x.toString() // '750000' - * BigNumber.config({ EXPONENTIAL_AT: 5 }) - * x.toString() // '7.5e+5' - * - * y = new BigNumber(362.875) - * y.toString(2) // '101101010.111' - * y.toString(9) // '442.77777777777777777778' - * y.toString(32) // 'ba.s' - * - * BigNumber.config({ DECIMAL_PLACES: 4 }); - * z = new BigNumber('1.23456789') - * z.toString() // '1.23456789' - * z.toString(10) // '1.2346' - * ``` - * - * @param [base] The base, integer, 2 to 36 (or `ALPHABET.length`, see `ALPHABET`). - */ - toString(base?: number): string; - - /** - * As `toString`, but does not accept a base argument and includes the minus sign for negative - * zero. - * - * ``ts - * x = new BigNumber('-0') - * x.toString() // '0' - * x.valueOf() // '-0' - * y = new BigNumber('1.777e+457') - * y.valueOf() // '1.777e+457' - * ``` - */ - valueOf(): string; - - /** Helps ES6 import. */ - private static readonly default?: BigNumber.Constructor; - - /** Helps ES6 import. */ - private static readonly BigNumber?: BigNumber.Constructor; - - /** Rounds away from zero. */ - static readonly ROUND_UP: 0; - - /** Rounds towards zero. */ - static readonly ROUND_DOWN: 1; - - /** Rounds towards Infinity. */ - static readonly ROUND_CEIL: 2; - - /** Rounds towards -Infinity. */ - static readonly ROUND_FLOOR: 3; - - /** Rounds towards nearest neighbour. If equidistant, rounds away from zero . */ - static readonly ROUND_HALF_UP: 4; - - /** Rounds towards nearest neighbour. If equidistant, rounds towards zero. */ - static readonly ROUND_HALF_DOWN: 5; - - /** Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour. */ - static readonly ROUND_HALF_EVEN: 6; - - /** Rounds towards nearest neighbour. If equidistant, rounds towards Infinity. */ - static readonly ROUND_HALF_CEIL: 7; - - /** Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity. */ - static readonly ROUND_HALF_FLOOR: 8; - - /** See `MODULO_MODE`. */ - static readonly EUCLID: 9; - - /** - * To aid in debugging, if a `BigNumber.DEBUG` property is `true` then an error will be thrown - * if the BigNumber constructor receives an invalid `BigNumber.Value`, or if `BigNumber.isBigNumber` - * receives a BigNumber instance that is malformed. - * - * ```ts - * // No error, and BigNumber NaN is returned. - * new BigNumber('blurgh') // 'NaN' - * new BigNumber(9, 2) // 'NaN' - * BigNumber.DEBUG = true - * new BigNumber('blurgh') // '[BigNumber Error] Not a number' - * new BigNumber(9, 2) // '[BigNumber Error] Not a base 2 number' - * ``` - * - * An error will also be thrown if a `BigNumber.Value` is of type number with more than 15 - * significant digits, as calling `toString` or `valueOf` on such numbers may not result - * in the intended value. - * - * ```ts - * console.log(823456789123456.3) // 823456789123456.2 - * // No error, and the returned BigNumber does not have the same value as the number literal. - * new BigNumber(823456789123456.3) // '823456789123456.2' - * BigNumber.DEBUG = true - * new BigNumber(823456789123456.3) - * // '[BigNumber Error] Number primitive has more than 15 significant digits' - * ``` - * - * Check that a BigNumber instance is well-formed: - * - * ```ts - * x = new BigNumber(10) - * - * BigNumber.DEBUG = false - * // Change x.c to an illegitimate value. - * x.c = NaN - * // No error, as BigNumber.DEBUG is false. - * BigNumber.isBigNumber(x) // true - * - * BigNumber.DEBUG = true - * BigNumber.isBigNumber(x) // '[BigNumber Error] Invalid BigNumber' - * ``` - */ - static DEBUG?: boolean; - - /** - * Returns a new independent BigNumber constructor with configuration as described by `object`, or - * with the default configuration if object is `null` or `undefined`. - * - * Throws if `object` is not an object. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 5 }) - * BN = BigNumber.clone({ DECIMAL_PLACES: 9 }) - * - * x = new BigNumber(1) - * y = new BN(1) - * - * x.div(3) // 0.33333 - * y.div(3) // 0.333333333 - * - * // BN = BigNumber.clone({ DECIMAL_PLACES: 9 }) is equivalent to: - * BN = BigNumber.clone() - * BN.config({ DECIMAL_PLACES: 9 }) - * ``` - * - * @param [object] The configuration object. - */ - static clone(object?: BigNumber.Config): BigNumber.Constructor; - - /** - * Configures the settings that apply to this BigNumber constructor. - * - * The configuration object, `object`, contains any number of the properties shown in the example - * below. - * - * Returns an object with the above properties and their current values. - * - * Throws if `object` is not an object, or if an invalid value is assigned to one or more of the - * properties. - * - * ```ts - * BigNumber.config({ - * DECIMAL_PLACES: 40, - * ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL, - * EXPONENTIAL_AT: [-10, 20], - * RANGE: [-500, 500], - * CRYPTO: true, - * MODULO_MODE: BigNumber.ROUND_FLOOR, - * POW_PRECISION: 80, - * FORMAT: { - * groupSize: 3, - * groupSeparator: ' ', - * decimalSeparator: ',' - * }, - * ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' - * }); - * - * BigNumber.config().DECIMAL_PLACES // 40 - * ``` - * - * @param object The configuration object. - */ - static config(object: BigNumber.Config): BigNumber.Config; - - /** - * Returns `true` if `value` is a BigNumber instance, otherwise returns `false`. - * - * If `BigNumber.DEBUG` is `true`, throws if a BigNumber instance is not well-formed. - * - * ```ts - * x = 42 - * y = new BigNumber(x) - * - * BigNumber.isBigNumber(x) // false - * y instanceof BigNumber // true - * BigNumber.isBigNumber(y) // true - * - * BN = BigNumber.clone(); - * z = new BN(x) - * z instanceof BigNumber // false - * BigNumber.isBigNumber(z) // true - * ``` - * - * @param value The value to test. - */ - static isBigNumber(value: any): value is BigNumber; - - /** - * Returns a BigNumber whose value is the maximum of the arguments. - * - * The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber('3257869345.0378653') - * BigNumber.maximum(4e9, x, '123456789.9') // '4000000000' - * - * arr = [12, '13', new BigNumber(14)] - * BigNumber.maximum.apply(null, arr) // '14' - * ``` - * - * @param n A numeric value. - */ - static maximum(...n: BigNumber.Value[]): BigNumber; - - /** - * Returns a BigNumber whose value is the maximum of the arguments. - * - * The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber('3257869345.0378653') - * BigNumber.max(4e9, x, '123456789.9') // '4000000000' - * - * arr = [12, '13', new BigNumber(14)] - * BigNumber.max.apply(null, arr) // '14' - * ``` - * - * @param n A numeric value. - */ - static max(...n: BigNumber.Value[]): BigNumber; - - /** - * Returns a BigNumber whose value is the minimum of the arguments. - * - * The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber('3257869345.0378653') - * BigNumber.minimum(4e9, x, '123456789.9') // '123456789.9' - * - * arr = [2, new BigNumber(-14), '-15.9999', -12] - * BigNumber.minimum.apply(null, arr) // '-15.9999' - * ``` - * - * @param n A numeric value. - */ - static minimum(...n: BigNumber.Value[]): BigNumber; - - /** - * Returns a BigNumber whose value is the minimum of the arguments. - * - * The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber('3257869345.0378653') - * BigNumber.min(4e9, x, '123456789.9') // '123456789.9' - * - * arr = [2, new BigNumber(-14), '-15.9999', -12] - * BigNumber.min.apply(null, arr) // '-15.9999' - * ``` - * - * @param n A numeric value. - */ - static min(...n: BigNumber.Value[]): BigNumber; - - /** - * Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and less than 1. - * - * The return value will have `decimalPlaces` decimal places, or less if trailing zeros are - * produced. If `decimalPlaces` is omitted, the current `DECIMAL_PLACES` setting will be used. - * - * Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the - * `crypto` object in the host environment, the random digits of the return value are generated by - * either `Math.random` (fastest), `crypto.getRandomValues` (Web Cryptography API in recent - * browsers) or `crypto.randomBytes` (Node.js). - * - * To be able to set `CRYPTO` to true when using Node.js, the `crypto` object must be available - * globally: - * - * ```ts - * global.crypto = require('crypto') - * ``` - * - * If `CRYPTO` is true, i.e. one of the `crypto` methods is to be used, the value of a returned - * BigNumber should be cryptographically secure and statistically indistinguishable from a random - * value. - * - * Throws if `decimalPlaces` is invalid. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 10 }) - * BigNumber.random() // '0.4117936847' - * BigNumber.random(20) // '0.78193327636914089009' - * ``` - * - * @param [decimalPlaces] Decimal places, integer, 0 to 1e+9. - */ - static random(decimalPlaces?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the sum of the arguments. - * - * The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber('3257869345.0378653') - * BigNumber.sum(4e9, x, '123456789.9') // '7381326134.9378653' - * - * arr = [2, new BigNumber(14), '15.9999', 12] - * BigNumber.sum.apply(null, arr) // '43.9999' - * ``` - * - * @param n A numeric value. - */ - static sum(...n: BigNumber.Value[]): BigNumber; - - /** - * Configures the settings that apply to this BigNumber constructor. - * - * The configuration object, `object`, contains any number of the properties shown in the example - * below. - * - * Returns an object with the above properties and their current values. - * - * Throws if `object` is not an object, or if an invalid value is assigned to one or more of the - * properties. - * - * ```ts - * BigNumber.set({ - * DECIMAL_PLACES: 40, - * ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL, - * EXPONENTIAL_AT: [-10, 20], - * RANGE: [-500, 500], - * CRYPTO: true, - * MODULO_MODE: BigNumber.ROUND_FLOOR, - * POW_PRECISION: 80, - * FORMAT: { - * groupSize: 3, - * groupSeparator: ' ', - * decimalSeparator: ',' - * }, - * ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' - * }); - * - * BigNumber.set().DECIMAL_PLACES // 40 - * ``` - * - * @param object The configuration object. - */ - static set(object: BigNumber.Config): BigNumber.Config; -} diff --git a/node_modules/bignumber.js/bignumber.js b/node_modules/bignumber.js/bignumber.js deleted file mode 100644 index 691d527a..00000000 --- a/node_modules/bignumber.js/bignumber.js +++ /dev/null @@ -1,2902 +0,0 @@ -;(function (globalObject) { - 'use strict'; - -/* - * bignumber.js v9.0.1 - * A JavaScript library for arbitrary-precision arithmetic. - * https://github.com/MikeMcl/bignumber.js - * Copyright (c) 2020 Michael Mclaughlin - * MIT Licensed. - * - * BigNumber.prototype methods | BigNumber methods - * | - * absoluteValue abs | clone - * comparedTo | config set - * decimalPlaces dp | DECIMAL_PLACES - * dividedBy div | ROUNDING_MODE - * dividedToIntegerBy idiv | EXPONENTIAL_AT - * exponentiatedBy pow | RANGE - * integerValue | CRYPTO - * isEqualTo eq | MODULO_MODE - * isFinite | POW_PRECISION - * isGreaterThan gt | FORMAT - * isGreaterThanOrEqualTo gte | ALPHABET - * isInteger | isBigNumber - * isLessThan lt | maximum max - * isLessThanOrEqualTo lte | minimum min - * isNaN | random - * isNegative | sum - * isPositive | - * isZero | - * minus | - * modulo mod | - * multipliedBy times | - * negated | - * plus | - * precision sd | - * shiftedBy | - * squareRoot sqrt | - * toExponential | - * toFixed | - * toFormat | - * toFraction | - * toJSON | - * toNumber | - * toPrecision | - * toString | - * valueOf | - * - */ - - - var BigNumber, - isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, - mathceil = Math.ceil, - mathfloor = Math.floor, - - bignumberError = '[BigNumber Error] ', - tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ', - - BASE = 1e14, - LOG_BASE = 14, - MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 - // MAX_INT32 = 0x7fffffff, // 2^31 - 1 - POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], - SQRT_BASE = 1e7, - - // EDITABLE - // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and - // the arguments to toExponential, toFixed, toFormat, and toPrecision. - MAX = 1E9; // 0 to MAX_INT32 - - - /* - * Create and return a BigNumber constructor. - */ - function clone(configObject) { - var div, convertBase, parseNumeric, - P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null }, - ONE = new BigNumber(1), - - - //----------------------------- EDITABLE CONFIG DEFAULTS ------------------------------- - - - // The default values below must be integers within the inclusive ranges stated. - // The values can also be changed at run-time using BigNumber.set. - - // The maximum number of decimal places for operations involving division. - DECIMAL_PLACES = 20, // 0 to MAX - - // The rounding mode used when rounding to the above decimal places, and when using - // toExponential, toFixed, toFormat and toPrecision, and round (default value). - // UP 0 Away from zero. - // DOWN 1 Towards zero. - // CEIL 2 Towards +Infinity. - // FLOOR 3 Towards -Infinity. - // HALF_UP 4 Towards nearest neighbour. If equidistant, up. - // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. - // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. - // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. - // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. - ROUNDING_MODE = 4, // 0 to 8 - - // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] - - // The exponent value at and beneath which toString returns exponential notation. - // Number type: -7 - TO_EXP_NEG = -7, // 0 to -MAX - - // The exponent value at and above which toString returns exponential notation. - // Number type: 21 - TO_EXP_POS = 21, // 0 to MAX - - // RANGE : [MIN_EXP, MAX_EXP] - - // The minimum exponent value, beneath which underflow to zero occurs. - // Number type: -324 (5e-324) - MIN_EXP = -1e7, // -1 to -MAX - - // The maximum exponent value, above which overflow to Infinity occurs. - // Number type: 308 (1.7976931348623157e+308) - // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. - MAX_EXP = 1e7, // 1 to MAX - - // Whether to use cryptographically-secure random number generation, if available. - CRYPTO = false, // true or false - - // The modulo mode used when calculating the modulus: a mod n. - // The quotient (q = a / n) is calculated according to the corresponding rounding mode. - // The remainder (r) is calculated as: r = a - n * q. - // - // UP 0 The remainder is positive if the dividend is negative, else is negative. - // DOWN 1 The remainder has the same sign as the dividend. - // This modulo mode is commonly known as 'truncated division' and is - // equivalent to (a % n) in JavaScript. - // FLOOR 3 The remainder has the same sign as the divisor (Python %). - // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. - // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). - // The remainder is always positive. - // - // The truncated division, floored division, Euclidian division and IEEE 754 remainder - // modes are commonly used for the modulus operation. - // Although the other rounding modes can also be used, they may not give useful results. - MODULO_MODE = 1, // 0 to 9 - - // The maximum number of significant digits of the result of the exponentiatedBy operation. - // If POW_PRECISION is 0, there will be unlimited significant digits. - POW_PRECISION = 0, // 0 to MAX - - // The format specification used by the BigNumber.prototype.toFormat method. - FORMAT = { - prefix: '', - groupSize: 3, - secondaryGroupSize: 0, - groupSeparator: ',', - decimalSeparator: '.', - fractionGroupSize: 0, - fractionGroupSeparator: '\xA0', // non-breaking space - suffix: '' - }, - - // The alphabet used for base conversion. It must be at least 2 characters long, with no '+', - // '-', '.', whitespace, or repeated character. - // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' - ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'; - - - //------------------------------------------------------------------------------------------ - - - // CONSTRUCTOR - - - /* - * The BigNumber constructor and exported function. - * Create and return a new instance of a BigNumber object. - * - * v {number|string|BigNumber} A numeric value. - * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive. - */ - function BigNumber(v, b) { - var alphabet, c, caseChanged, e, i, isNum, len, str, - x = this; - - // Enable constructor call without `new`. - if (!(x instanceof BigNumber)) return new BigNumber(v, b); - - if (b == null) { - - if (v && v._isBigNumber === true) { - x.s = v.s; - - if (!v.c || v.e > MAX_EXP) { - x.c = x.e = null; - } else if (v.e < MIN_EXP) { - x.c = [x.e = 0]; - } else { - x.e = v.e; - x.c = v.c.slice(); - } - - return; - } - - if ((isNum = typeof v == 'number') && v * 0 == 0) { - - // Use `1 / n` to handle minus zero also. - x.s = 1 / v < 0 ? (v = -v, -1) : 1; - - // Fast path for integers, where n < 2147483648 (2**31). - if (v === ~~v) { - for (e = 0, i = v; i >= 10; i /= 10, e++); - - if (e > MAX_EXP) { - x.c = x.e = null; - } else { - x.e = e; - x.c = [v]; - } - - return; - } - - str = String(v); - } else { - - if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum); - - x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; - } - - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - - // Exponential form? - if ((i = str.search(/e/i)) > 0) { - - // Determine exponent. - if (e < 0) e = i; - e += +str.slice(i + 1); - str = str.substring(0, i); - } else if (e < 0) { - - // Integer. - e = str.length; - } - - } else { - - // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' - intCheck(b, 2, ALPHABET.length, 'Base'); - - // Allow exponential notation to be used with base 10 argument, while - // also rounding to DECIMAL_PLACES as with other bases. - if (b == 10) { - x = new BigNumber(v); - return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); - } - - str = String(v); - - if (isNum = typeof v == 'number') { - - // Avoid potential interpretation of Infinity and NaN as base 44+ values. - if (v * 0 != 0) return parseNumeric(x, str, isNum, b); - - x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; - - // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' - if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) { - throw Error - (tooManyDigits + v); - } - } else { - x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; - } - - alphabet = ALPHABET.slice(0, b); - e = i = 0; - - // Check that str is a valid base b number. - // Don't use RegExp, so alphabet can contain special characters. - for (len = str.length; i < len; i++) { - if (alphabet.indexOf(c = str.charAt(i)) < 0) { - if (c == '.') { - - // If '.' is not the first character and it has not be found before. - if (i > e) { - e = len; - continue; - } - } else if (!caseChanged) { - - // Allow e.g. hexadecimal 'FF' as well as 'ff'. - if (str == str.toUpperCase() && (str = str.toLowerCase()) || - str == str.toLowerCase() && (str = str.toUpperCase())) { - caseChanged = true; - i = -1; - e = 0; - continue; - } - } - - return parseNumeric(x, String(v), isNum, b); - } - } - - // Prevent later check for length on converted number. - isNum = false; - str = convertBase(str, b, 10, x.s); - - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - else e = str.length; - } - - // Determine leading zeros. - for (i = 0; str.charCodeAt(i) === 48; i++); - - // Determine trailing zeros. - for (len = str.length; str.charCodeAt(--len) === 48;); - - if (str = str.slice(i, ++len)) { - len -= i; - - // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' - if (isNum && BigNumber.DEBUG && - len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { - throw Error - (tooManyDigits + (x.s * v)); - } - - // Overflow? - if ((e = e - i - 1) > MAX_EXP) { - - // Infinity. - x.c = x.e = null; - - // Underflow? - } else if (e < MIN_EXP) { - - // Zero. - x.c = [x.e = 0]; - } else { - x.e = e; - x.c = []; - - // Transform base - - // e is the base 10 exponent. - // i is where to slice str to get the first element of the coefficient array. - i = (e + 1) % LOG_BASE; - if (e < 0) i += LOG_BASE; // i < 1 - - if (i < len) { - if (i) x.c.push(+str.slice(0, i)); - - for (len -= LOG_BASE; i < len;) { - x.c.push(+str.slice(i, i += LOG_BASE)); - } - - i = LOG_BASE - (str = str.slice(i)).length; - } else { - i -= len; - } - - for (; i--; str += '0'); - x.c.push(+str); - } - } else { - - // Zero. - x.c = [x.e = 0]; - } - } - - - // CONSTRUCTOR PROPERTIES - - - BigNumber.clone = clone; - - BigNumber.ROUND_UP = 0; - BigNumber.ROUND_DOWN = 1; - BigNumber.ROUND_CEIL = 2; - BigNumber.ROUND_FLOOR = 3; - BigNumber.ROUND_HALF_UP = 4; - BigNumber.ROUND_HALF_DOWN = 5; - BigNumber.ROUND_HALF_EVEN = 6; - BigNumber.ROUND_HALF_CEIL = 7; - BigNumber.ROUND_HALF_FLOOR = 8; - BigNumber.EUCLID = 9; - - - /* - * Configure infrequently-changing library-wide settings. - * - * Accept an object with the following optional properties (if the value of a property is - * a number, it must be an integer within the inclusive range stated): - * - * DECIMAL_PLACES {number} 0 to MAX - * ROUNDING_MODE {number} 0 to 8 - * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX] - * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX] - * CRYPTO {boolean} true or false - * MODULO_MODE {number} 0 to 9 - * POW_PRECISION {number} 0 to MAX - * ALPHABET {string} A string of two or more unique characters which does - * not contain '.'. - * FORMAT {object} An object with some of the following properties: - * prefix {string} - * groupSize {number} - * secondaryGroupSize {number} - * groupSeparator {string} - * decimalSeparator {string} - * fractionGroupSize {number} - * fractionGroupSeparator {string} - * suffix {string} - * - * (The values assigned to the above FORMAT object properties are not checked for validity.) - * - * E.g. - * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) - * - * Ignore properties/parameters set to null or undefined, except for ALPHABET. - * - * Return an object with the properties current values. - */ - BigNumber.config = BigNumber.set = function (obj) { - var p, v; - - if (obj != null) { - - if (typeof obj == 'object') { - - // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. - // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) { - v = obj[p]; - intCheck(v, 0, MAX, p); - DECIMAL_PLACES = v; - } - - // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. - // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) { - v = obj[p]; - intCheck(v, 0, 8, p); - ROUNDING_MODE = v; - } - - // EXPONENTIAL_AT {number|number[]} - // Integer, -MAX to MAX inclusive or - // [integer -MAX to 0 inclusive, 0 to MAX inclusive]. - // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, 0, p); - intCheck(v[1], 0, MAX, p); - TO_EXP_NEG = v[0]; - TO_EXP_POS = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); - } - } - - // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or - // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. - // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}' - if (obj.hasOwnProperty(p = 'RANGE')) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, -1, p); - intCheck(v[1], 1, MAX, p); - MIN_EXP = v[0]; - MAX_EXP = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - if (v) { - MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); - } else { - throw Error - (bignumberError + p + ' cannot be zero: ' + v); - } - } - } - - // CRYPTO {boolean} true or false. - // '[BigNumber Error] CRYPTO not true or false: {v}' - // '[BigNumber Error] crypto unavailable' - if (obj.hasOwnProperty(p = 'CRYPTO')) { - v = obj[p]; - if (v === !!v) { - if (v) { - if (typeof crypto != 'undefined' && crypto && - (crypto.getRandomValues || crypto.randomBytes)) { - CRYPTO = v; - } else { - CRYPTO = !v; - throw Error - (bignumberError + 'crypto unavailable'); - } - } else { - CRYPTO = v; - } - } else { - throw Error - (bignumberError + p + ' not true or false: ' + v); - } - } - - // MODULO_MODE {number} Integer, 0 to 9 inclusive. - // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'MODULO_MODE')) { - v = obj[p]; - intCheck(v, 0, 9, p); - MODULO_MODE = v; - } - - // POW_PRECISION {number} Integer, 0 to MAX inclusive. - // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'POW_PRECISION')) { - v = obj[p]; - intCheck(v, 0, MAX, p); - POW_PRECISION = v; - } - - // FORMAT {object} - // '[BigNumber Error] FORMAT not an object: {v}' - if (obj.hasOwnProperty(p = 'FORMAT')) { - v = obj[p]; - if (typeof v == 'object') FORMAT = v; - else throw Error - (bignumberError + p + ' not an object: ' + v); - } - - // ALPHABET {string} - // '[BigNumber Error] ALPHABET invalid: {v}' - if (obj.hasOwnProperty(p = 'ALPHABET')) { - v = obj[p]; - - // Disallow if less than two characters, - // or if it contains '+', '-', '.', whitespace, or a repeated character. - if (typeof v == 'string' && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) { - ALPHABET = v; - } else { - throw Error - (bignumberError + p + ' invalid: ' + v); - } - } - - } else { - - // '[BigNumber Error] Object expected: {v}' - throw Error - (bignumberError + 'Object expected: ' + obj); - } - } - - return { - DECIMAL_PLACES: DECIMAL_PLACES, - ROUNDING_MODE: ROUNDING_MODE, - EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], - RANGE: [MIN_EXP, MAX_EXP], - CRYPTO: CRYPTO, - MODULO_MODE: MODULO_MODE, - POW_PRECISION: POW_PRECISION, - FORMAT: FORMAT, - ALPHABET: ALPHABET - }; - }; - - - /* - * Return true if v is a BigNumber instance, otherwise return false. - * - * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed. - * - * v {any} - * - * '[BigNumber Error] Invalid BigNumber: {v}' - */ - BigNumber.isBigNumber = function (v) { - if (!v || v._isBigNumber !== true) return false; - if (!BigNumber.DEBUG) return true; - - var i, n, - c = v.c, - e = v.e, - s = v.s; - - out: if ({}.toString.call(c) == '[object Array]') { - - if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { - - // If the first element is zero, the BigNumber value must be zero. - if (c[0] === 0) { - if (e === 0 && c.length === 1) return true; - break out; - } - - // Calculate number of digits that c[0] should have, based on the exponent. - i = (e + 1) % LOG_BASE; - if (i < 1) i += LOG_BASE; - - // Calculate number of digits of c[0]. - //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) { - if (String(c[0]).length == i) { - - for (i = 0; i < c.length; i++) { - n = c[i]; - if (n < 0 || n >= BASE || n !== mathfloor(n)) break out; - } - - // Last element cannot be zero, unless it is the only element. - if (n !== 0) return true; - } - } - - // Infinity/NaN - } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { - return true; - } - - throw Error - (bignumberError + 'Invalid BigNumber: ' + v); - }; - - - /* - * Return a new BigNumber whose value is the maximum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.maximum = BigNumber.max = function () { - return maxOrMin(arguments, P.lt); - }; - - - /* - * Return a new BigNumber whose value is the minimum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.minimum = BigNumber.min = function () { - return maxOrMin(arguments, P.gt); - }; - - - /* - * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, - * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing - * zeros are produced). - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}' - * '[BigNumber Error] crypto unavailable' - */ - BigNumber.random = (function () { - var pow2_53 = 0x20000000000000; - - // Return a 53 bit integer n, where 0 <= n < 9007199254740992. - // Check if Math.random() produces more than 32 bits of randomness. - // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. - // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. - var random53bitInt = (Math.random() * pow2_53) & 0x1fffff - ? function () { return mathfloor(Math.random() * pow2_53); } - : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + - (Math.random() * 0x800000 | 0); }; - - return function (dp) { - var a, b, e, k, v, - i = 0, - c = [], - rand = new BigNumber(ONE); - - if (dp == null) dp = DECIMAL_PLACES; - else intCheck(dp, 0, MAX); - - k = mathceil(dp / LOG_BASE); - - if (CRYPTO) { - - // Browsers supporting crypto.getRandomValues. - if (crypto.getRandomValues) { - - a = crypto.getRandomValues(new Uint32Array(k *= 2)); - - for (; i < k;) { - - // 53 bits: - // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) - // 11111 11111111 11111111 11111111 11100000 00000000 00000000 - // ((Math.pow(2, 32) - 1) >>> 11).toString(2) - // 11111 11111111 11111111 - // 0x20000 is 2^21. - v = a[i] * 0x20000 + (a[i + 1] >>> 11); - - // Rejection sampling: - // 0 <= v < 9007199254740992 - // Probability that v >= 9e15, is - // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 - if (v >= 9e15) { - b = crypto.getRandomValues(new Uint32Array(2)); - a[i] = b[0]; - a[i + 1] = b[1]; - } else { - - // 0 <= v <= 8999999999999999 - // 0 <= (v % 1e14) <= 99999999999999 - c.push(v % 1e14); - i += 2; - } - } - i = k / 2; - - // Node.js supporting crypto.randomBytes. - } else if (crypto.randomBytes) { - - // buffer - a = crypto.randomBytes(k *= 7); - - for (; i < k;) { - - // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 - // 0x100000000 is 2^32, 0x1000000 is 2^24 - // 11111 11111111 11111111 11111111 11111111 11111111 11111111 - // 0 <= v < 9007199254740992 - v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) + - (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) + - (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; - - if (v >= 9e15) { - crypto.randomBytes(7).copy(a, i); - } else { - - // 0 <= (v % 1e14) <= 99999999999999 - c.push(v % 1e14); - i += 7; - } - } - i = k / 7; - } else { - CRYPTO = false; - throw Error - (bignumberError + 'crypto unavailable'); - } - } - - // Use Math.random. - if (!CRYPTO) { - - for (; i < k;) { - v = random53bitInt(); - if (v < 9e15) c[i++] = v % 1e14; - } - } - - k = c[--i]; - dp %= LOG_BASE; - - // Convert trailing digits to zeros according to dp. - if (k && dp) { - v = POWS_TEN[LOG_BASE - dp]; - c[i] = mathfloor(k / v) * v; - } - - // Remove trailing elements which are zero. - for (; c[i] === 0; c.pop(), i--); - - // Zero? - if (i < 0) { - c = [e = 0]; - } else { - - // Remove leading elements which are zero and adjust exponent accordingly. - for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); - - // Count the digits of the first element of c to determine leading zeros, and... - for (i = 1, v = c[0]; v >= 10; v /= 10, i++); - - // adjust the exponent accordingly. - if (i < LOG_BASE) e -= LOG_BASE - i; - } - - rand.e = e; - rand.c = c; - return rand; - }; - })(); - - - /* - * Return a BigNumber whose value is the sum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.sum = function () { - var i = 1, - args = arguments, - sum = new BigNumber(args[0]); - for (; i < args.length;) sum = sum.plus(args[i++]); - return sum; - }; - - - // PRIVATE FUNCTIONS - - - // Called by BigNumber and BigNumber.prototype.toString. - convertBase = (function () { - var decimal = '0123456789'; - - /* - * Convert string of baseIn to an array of numbers of baseOut. - * Eg. toBaseOut('255', 10, 16) returns [15, 15]. - * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5]. - */ - function toBaseOut(str, baseIn, baseOut, alphabet) { - var j, - arr = [0], - arrL, - i = 0, - len = str.length; - - for (; i < len;) { - for (arrL = arr.length; arrL--; arr[arrL] *= baseIn); - - arr[0] += alphabet.indexOf(str.charAt(i++)); - - for (j = 0; j < arr.length; j++) { - - if (arr[j] > baseOut - 1) { - if (arr[j + 1] == null) arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - - return arr.reverse(); - } - - // Convert a numeric string of baseIn to a numeric string of baseOut. - // If the caller is toString, we are converting from base 10 to baseOut. - // If the caller is BigNumber, we are converting from baseIn to base 10. - return function (str, baseIn, baseOut, sign, callerIsToString) { - var alphabet, d, e, k, r, x, xc, y, - i = str.indexOf('.'), - dp = DECIMAL_PLACES, - rm = ROUNDING_MODE; - - // Non-integer. - if (i >= 0) { - k = POW_PRECISION; - - // Unlimited precision. - POW_PRECISION = 0; - str = str.replace('.', ''); - y = new BigNumber(baseIn); - x = y.pow(str.length - i); - POW_PRECISION = k; - - // Convert str as if an integer, then restore the fraction part by dividing the - // result by its base raised to a power. - - y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), - 10, baseOut, decimal); - y.e = y.c.length; - } - - // Convert the number as integer. - - xc = toBaseOut(str, baseIn, baseOut, callerIsToString - ? (alphabet = ALPHABET, decimal) - : (alphabet = decimal, ALPHABET)); - - // xc now represents str as an integer and converted to baseOut. e is the exponent. - e = k = xc.length; - - // Remove trailing zeros. - for (; xc[--k] == 0; xc.pop()); - - // Zero? - if (!xc[0]) return alphabet.charAt(0); - - // Does str represent an integer? If so, no need for the division. - if (i < 0) { - --e; - } else { - x.c = xc; - x.e = e; - - // The sign is needed for correct rounding. - x.s = sign; - x = div(x, y, dp, rm, baseOut); - xc = x.c; - r = x.r; - e = x.e; - } - - // xc now represents str converted to baseOut. - - // THe index of the rounding digit. - d = e + dp + 1; - - // The rounding digit: the digit to the right of the digit that may be rounded up. - i = xc[d]; - - // Look at the rounding digits and mode to determine whether to round up. - - k = baseOut / 2; - r = r || d < 0 || xc[d + 1] != null; - - r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 || - rm == (x.s < 0 ? 8 : 7)); - - // If the index of the rounding digit is not greater than zero, or xc represents - // zero, then the result of the base conversion is zero or, if rounding up, a value - // such as 0.00001. - if (d < 1 || !xc[0]) { - - // 1^-dp or 0 - str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); - } else { - - // Truncate xc to the required number of decimal places. - xc.length = d; - - // Round up? - if (r) { - - // Rounding up may mean the previous digit has to be rounded up and so on. - for (--baseOut; ++xc[--d] > baseOut;) { - xc[d] = 0; - - if (!d) { - ++e; - xc = [1].concat(xc); - } - } - } - - // Determine trailing zeros. - for (k = xc.length; !xc[--k];); - - // E.g. [4, 11, 15] becomes 4bf. - for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])); - - // Add leading zeros, decimal point and trailing zeros as required. - str = toFixedPoint(str, e, alphabet.charAt(0)); - } - - // The caller will add the sign. - return str; - }; - })(); - - - // Perform division in the specified base. Called by div and convertBase. - div = (function () { - - // Assume non-zero x and k. - function multiply(x, k, base) { - var m, temp, xlo, xhi, - carry = 0, - i = x.length, - klo = k % SQRT_BASE, - khi = k / SQRT_BASE | 0; - - for (x = x.slice(); i--;) { - xlo = x[i] % SQRT_BASE; - xhi = x[i] / SQRT_BASE | 0; - m = khi * xlo + xhi * klo; - temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry; - carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; - x[i] = temp % base; - } - - if (carry) x = [carry].concat(x); - - return x; - } - - function compare(a, b, aL, bL) { - var i, cmp; - - if (aL != bL) { - cmp = aL > bL ? 1 : -1; - } else { - - for (i = cmp = 0; i < aL; i++) { - - if (a[i] != b[i]) { - cmp = a[i] > b[i] ? 1 : -1; - break; - } - } - } - - return cmp; - } - - function subtract(a, b, aL, base) { - var i = 0; - - // Subtract b from a. - for (; aL--;) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - - // Remove leading zeros. - for (; !a[0] && a.length > 1; a.splice(0, 1)); - } - - // x: dividend, y: divisor. - return function (x, y, dp, rm, base) { - var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, - yL, yz, - s = x.s == y.s ? 1 : -1, - xc = x.c, - yc = y.c; - - // Either NaN, Infinity or 0? - if (!xc || !xc[0] || !yc || !yc[0]) { - - return new BigNumber( - - // Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : - - // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. - xc && xc[0] == 0 || !yc ? s * 0 : s / 0 - ); - } - - q = new BigNumber(s); - qc = q.c = []; - e = x.e - y.e; - s = dp + e + 1; - - if (!base) { - base = BASE; - e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); - s = s / LOG_BASE | 0; - } - - // Result exponent may be one less then the current value of e. - // The coefficients of the BigNumbers from convertBase may have trailing zeros. - for (i = 0; yc[i] == (xc[i] || 0); i++); - - if (yc[i] > (xc[i] || 0)) e--; - - if (s < 0) { - qc.push(1); - more = true; - } else { - xL = xc.length; - yL = yc.length; - i = 0; - s += 2; - - // Normalise xc and yc so highest order digit of yc is >= base / 2. - - n = mathfloor(base / (yc[0] + 1)); - - // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1. - // if (n > 1 || n++ == 1 && yc[0] < base / 2) { - if (n > 1) { - yc = multiply(yc, n, base); - xc = multiply(xc, n, base); - yL = yc.length; - xL = xc.length; - } - - xi = yL; - rem = xc.slice(0, yL); - remL = rem.length; - - // Add zeros to make remainder as long as divisor. - for (; remL < yL; rem[remL++] = 0); - yz = yc.slice(); - yz = [0].concat(yz); - yc0 = yc[0]; - if (yc[1] >= base / 2) yc0++; - // Not necessary, but to prevent trial digit n > base, when using base 3. - // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15; - - do { - n = 0; - - // Compare divisor and remainder. - cmp = compare(yc, rem, yL, remL); - - // If divisor < remainder. - if (cmp < 0) { - - // Calculate trial digit, n. - - rem0 = rem[0]; - if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); - - // n is how many times the divisor goes into the current remainder. - n = mathfloor(rem0 / yc0); - - // Algorithm: - // product = divisor multiplied by trial digit (n). - // Compare product and remainder. - // If product is greater than remainder: - // Subtract divisor from product, decrement trial digit. - // Subtract product from remainder. - // If product was less than remainder at the last compare: - // Compare new remainder and divisor. - // If remainder is greater than divisor: - // Subtract divisor from remainder, increment trial digit. - - if (n > 1) { - - // n may be > base only when base is 3. - if (n >= base) n = base - 1; - - // product = divisor * trial digit. - prod = multiply(yc, n, base); - prodL = prod.length; - remL = rem.length; - - // Compare product and remainder. - // If product > remainder then trial digit n too high. - // n is 1 too high about 5% of the time, and is not known to have - // ever been more than 1 too high. - while (compare(prod, rem, prodL, remL) == 1) { - n--; - - // Subtract divisor from product. - subtract(prod, yL < prodL ? yz : yc, prodL, base); - prodL = prod.length; - cmp = 1; - } - } else { - - // n is 0 or 1, cmp is -1. - // If n is 0, there is no need to compare yc and rem again below, - // so change cmp to 1 to avoid it. - // If n is 1, leave cmp as -1, so yc and rem are compared again. - if (n == 0) { - - // divisor < remainder, so n must be at least 1. - cmp = n = 1; - } - - // product = divisor - prod = yc.slice(); - prodL = prod.length; - } - - if (prodL < remL) prod = [0].concat(prod); - - // Subtract product from remainder. - subtract(rem, prod, remL, base); - remL = rem.length; - - // If product was < remainder. - if (cmp == -1) { - - // Compare divisor and new remainder. - // If divisor < new remainder, subtract divisor from remainder. - // Trial digit n too low. - // n is 1 too low about 5% of the time, and very rarely 2 too low. - while (compare(yc, rem, yL, remL) < 1) { - n++; - - // Subtract divisor from remainder. - subtract(rem, yL < remL ? yz : yc, remL, base); - remL = rem.length; - } - } - } else if (cmp === 0) { - n++; - rem = [0]; - } // else cmp === 1 and n will be 0 - - // Add the next digit, n, to the result array. - qc[i++] = n; - - // Update the remainder. - if (rem[0]) { - rem[remL++] = xc[xi] || 0; - } else { - rem = [xc[xi]]; - remL = 1; - } - } while ((xi++ < xL || rem[0] != null) && s--); - - more = rem[0] != null; - - // Leading zero? - if (!qc[0]) qc.splice(0, 1); - } - - if (base == BASE) { - - // To calculate q.e, first get the number of digits of qc[0]. - for (i = 1, s = qc[0]; s >= 10; s /= 10, i++); - - round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); - - // Caller is convertBase. - } else { - q.e = e; - q.r = +more; - } - - return q; - }; - })(); - - - /* - * Return a string representing the value of BigNumber n in fixed-point or exponential - * notation rounded to the specified decimal places or significant digits. - * - * n: a BigNumber. - * i: the index of the last digit required (i.e. the digit that may be rounded up). - * rm: the rounding mode. - * id: 1 (toExponential) or 2 (toPrecision). - */ - function format(n, i, rm, id) { - var c0, e, ne, len, str; - - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - if (!n.c) return n.toString(); - - c0 = n.c[0]; - ne = n.e; - - if (i == null) { - str = coeffToString(n.c); - str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) - ? toExponential(str, ne) - : toFixedPoint(str, ne, '0'); - } else { - n = round(new BigNumber(n), i, rm); - - // n.e may have changed if the value was rounded up. - e = n.e; - - str = coeffToString(n.c); - len = str.length; - - // toPrecision returns exponential notation if the number of significant digits - // specified is less than the number of digits necessary to represent the integer - // part of the value in fixed-point notation. - - // Exponential notation. - if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { - - // Append zeros? - for (; len < i; str += '0', len++); - str = toExponential(str, e); - - // Fixed-point notation. - } else { - i -= ne; - str = toFixedPoint(str, e, '0'); - - // Append zeros? - if (e + 1 > len) { - if (--i > 0) for (str += '.'; i--; str += '0'); - } else { - i += e - len; - if (i > 0) { - if (e + 1 == len) str += '.'; - for (; i--; str += '0'); - } - } - } - } - - return n.s < 0 && c0 ? '-' + str : str; - } - - - // Handle BigNumber.max and BigNumber.min. - function maxOrMin(args, method) { - var n, - i = 1, - m = new BigNumber(args[0]); - - for (; i < args.length; i++) { - n = new BigNumber(args[i]); - - // If any number is NaN, return NaN. - if (!n.s) { - m = n; - break; - } else if (method.call(m, n)) { - m = n; - } - } - - return m; - } - - - /* - * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. - * Called by minus, plus and times. - */ - function normalise(n, c, e) { - var i = 1, - j = c.length; - - // Remove trailing zeros. - for (; !c[--j]; c.pop()); - - // Calculate the base 10 exponent. First get the number of digits of c[0]. - for (j = c[0]; j >= 10; j /= 10, i++); - - // Overflow? - if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { - - // Infinity. - n.c = n.e = null; - - // Underflow? - } else if (e < MIN_EXP) { - - // Zero. - n.c = [n.e = 0]; - } else { - n.e = e; - n.c = c; - } - - return n; - } - - - // Handle values that fail the validity test in BigNumber. - parseNumeric = (function () { - var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, - dotAfter = /^([^.]+)\.$/, - dotBefore = /^\.([^.]+)$/, - isInfinityOrNaN = /^-?(Infinity|NaN)$/, - whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; - - return function (x, str, isNum, b) { - var base, - s = isNum ? str : str.replace(whitespaceOrPlus, ''); - - // No exception on ±Infinity or NaN. - if (isInfinityOrNaN.test(s)) { - x.s = isNaN(s) ? null : s < 0 ? -1 : 1; - } else { - if (!isNum) { - - // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i - s = s.replace(basePrefix, function (m, p1, p2) { - base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8; - return !b || b == base ? p1 : m; - }); - - if (b) { - base = b; - - // E.g. '1.' to '1', '.1' to '0.1' - s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1'); - } - - if (str != s) return new BigNumber(s, base); - } - - // '[BigNumber Error] Not a number: {n}' - // '[BigNumber Error] Not a base {b} number: {n}' - if (BigNumber.DEBUG) { - throw Error - (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str); - } - - // NaN - x.s = null; - } - - x.c = x.e = null; - } - })(); - - - /* - * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. - * If r is truthy, it is known that there are more digits after the rounding digit. - */ - function round(x, sd, rm, r) { - var d, i, j, k, n, ni, rd, - xc = x.c, - pows10 = POWS_TEN; - - // if x is not Infinity or NaN... - if (xc) { - - // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. - // n is a base 1e14 number, the value of the element of array x.c containing rd. - // ni is the index of n within x.c. - // d is the number of digits of n. - // i is the index of rd within n including leading zeros. - // j is the actual index of rd within n (if < 0, rd is a leading zero). - out: { - - // Get the number of digits of the first element of xc. - for (d = 1, k = xc[0]; k >= 10; k /= 10, d++); - i = sd - d; - - // If the rounding digit is in the first element of xc... - if (i < 0) { - i += LOG_BASE; - j = sd; - n = xc[ni = 0]; - - // Get the rounding digit at index j of n. - rd = n / pows10[d - j - 1] % 10 | 0; - } else { - ni = mathceil((i + 1) / LOG_BASE); - - if (ni >= xc.length) { - - if (r) { - - // Needed by sqrt. - for (; xc.length <= ni; xc.push(0)); - n = rd = 0; - d = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - n = k = xc[ni]; - - // Get the number of digits of n. - for (d = 1; k >= 10; k /= 10, d++); - - // Get the index of rd within n. - i %= LOG_BASE; - - // Get the index of rd within n, adjusted for leading zeros. - // The number of leading zeros of n is given by LOG_BASE - d. - j = i - LOG_BASE + d; - - // Get the rounding digit at index j of n. - rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0; - } - } - - r = r || sd < 0 || - - // Are there any non-zero digits after the rounding digit? - // The expression n % pows10[d - j - 1] returns all digits of n to the right - // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. - xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); - - r = rm < 4 - ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && - - // Check whether the digit to the left of the rounding digit is odd. - ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 || - rm == (x.s < 0 ? 8 : 7)); - - if (sd < 1 || !xc[0]) { - xc.length = 0; - - if (r) { - - // Convert sd to decimal places. - sd -= x.e + 1; - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; - x.e = -sd || 0; - } else { - - // Zero. - xc[0] = x.e = 0; - } - - return x; - } - - // Remove excess digits. - if (i == 0) { - xc.length = ni; - k = 1; - ni--; - } else { - xc.length = ni + 1; - k = pows10[LOG_BASE - i]; - - // E.g. 56700 becomes 56000 if 7 is the rounding digit. - // j > 0 means i > number of leading zeros of n. - xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; - } - - // Round up? - if (r) { - - for (; ;) { - - // If the digit to be rounded up is in the first element of xc... - if (ni == 0) { - - // i will be the length of xc[0] before k is added. - for (i = 1, j = xc[0]; j >= 10; j /= 10, i++); - j = xc[0] += k; - for (k = 1; j >= 10; j /= 10, k++); - - // if i != k the length has increased. - if (i != k) { - x.e++; - if (xc[0] == BASE) xc[0] = 1; - } - - break; - } else { - xc[ni] += k; - if (xc[ni] != BASE) break; - xc[ni--] = 0; - k = 1; - } - } - } - - // Remove trailing zeros. - for (i = xc.length; xc[--i] === 0; xc.pop()); - } - - // Overflow? Infinity. - if (x.e > MAX_EXP) { - x.c = x.e = null; - - // Underflow? Zero. - } else if (x.e < MIN_EXP) { - x.c = [x.e = 0]; - } - } - - return x; - } - - - function valueOf(n) { - var str, - e = n.e; - - if (e === null) return n.toString(); - - str = coeffToString(n.c); - - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential(str, e) - : toFixedPoint(str, e, '0'); - - return n.s < 0 ? '-' + str : str; - } - - - // PROTOTYPE/INSTANCE METHODS - - - /* - * Return a new BigNumber whose value is the absolute value of this BigNumber. - */ - P.absoluteValue = P.abs = function () { - var x = new BigNumber(this); - if (x.s < 0) x.s = 1; - return x; - }; - - - /* - * Return - * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), - * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), - * 0 if they have the same value, - * or null if the value of either is NaN. - */ - P.comparedTo = function (y, b) { - return compare(this, new BigNumber(y, b)); - }; - - - /* - * If dp is undefined or null or true or false, return the number of decimal places of the - * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. - * - * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this - * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or - * ROUNDING_MODE if rm is omitted. - * - * [dp] {number} Decimal places: integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.decimalPlaces = P.dp = function (dp, rm) { - var c, n, v, - x = this; - - if (dp != null) { - intCheck(dp, 0, MAX); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - return round(new BigNumber(x), dp + x.e + 1, rm); - } - - if (!(c = x.c)) return null; - n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; - - // Subtract the number of trailing zeros of the last number. - if (v = c[v]) for (; v % 10 == 0; v /= 10, n--); - if (n < 0) n = 0; - - return n; - }; - - - /* - * n / 0 = I - * n / N = N - * n / I = 0 - * 0 / n = 0 - * 0 / 0 = N - * 0 / N = N - * 0 / I = 0 - * N / n = N - * N / 0 = N - * N / N = N - * N / I = N - * I / n = I - * I / 0 = I - * I / N = N - * I / I = N - * - * Return a new BigNumber whose value is the value of this BigNumber divided by the value of - * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.dividedBy = P.div = function (y, b) { - return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE); - }; - - - /* - * Return a new BigNumber whose value is the integer part of dividing the value of this - * BigNumber by the value of BigNumber(y, b). - */ - P.dividedToIntegerBy = P.idiv = function (y, b) { - return div(this, new BigNumber(y, b), 0, 1); - }; - - - /* - * Return a BigNumber whose value is the value of this BigNumber exponentiated by n. - * - * If m is present, return the result modulo m. - * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. - * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE. - * - * The modular power operation works efficiently when x, n, and m are integers, otherwise it - * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0. - * - * n {number|string|BigNumber} The exponent. An integer. - * [m] {number|string|BigNumber} The modulus. - * - * '[BigNumber Error] Exponent not an integer: {n}' - */ - P.exponentiatedBy = P.pow = function (n, m) { - var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, - x = this; - - n = new BigNumber(n); - - // Allow NaN and ±Infinity, but not other non-integers. - if (n.c && !n.isInteger()) { - throw Error - (bignumberError + 'Exponent not an integer: ' + valueOf(n)); - } - - if (m != null) m = new BigNumber(m); - - // Exponent of MAX_SAFE_INTEGER is 15. - nIsBig = n.e > 14; - - // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0. - if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { - - // The sign of the result of pow when x is negative depends on the evenness of n. - // If +n overflows to ±Infinity, the evenness of n would be not be known. - y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n))); - return m ? y.mod(m) : y; - } - - nIsNeg = n.s < 0; - - if (m) { - - // x % m returns NaN if abs(m) is zero, or m is NaN. - if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN); - - isModExp = !nIsNeg && x.isInteger() && m.isInteger(); - - if (isModExp) x = x.mod(m); - - // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15. - // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15. - } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 - // [1, 240000000] - ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 - // [80000000000000] [99999750000000] - : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { - - // If x is negative and n is odd, k = -0, else k = 0. - k = x.s < 0 && isOdd(n) ? -0 : 0; - - // If x >= 1, k = ±Infinity. - if (x.e > -1) k = 1 / k; - - // If n is negative return ±0, else return ±Infinity. - return new BigNumber(nIsNeg ? 1 / k : k); - - } else if (POW_PRECISION) { - - // Truncating each coefficient array to a length of k after each multiplication - // equates to truncating significant digits to POW_PRECISION + [28, 41], - // i.e. there will be a minimum of 28 guard digits retained. - k = mathceil(POW_PRECISION / LOG_BASE + 2); - } - - if (nIsBig) { - half = new BigNumber(0.5); - if (nIsNeg) n.s = 1; - nIsOdd = isOdd(n); - } else { - i = Math.abs(+valueOf(n)); - nIsOdd = i % 2; - } - - y = new BigNumber(ONE); - - // Performs 54 loop iterations for n of 9007199254740991. - for (; ;) { - - if (nIsOdd) { - y = y.times(x); - if (!y.c) break; - - if (k) { - if (y.c.length > k) y.c.length = k; - } else if (isModExp) { - y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m)); - } - } - - if (i) { - i = mathfloor(i / 2); - if (i === 0) break; - nIsOdd = i % 2; - } else { - n = n.times(half); - round(n, n.e + 1, 1); - - if (n.e > 14) { - nIsOdd = isOdd(n); - } else { - i = +valueOf(n); - if (i === 0) break; - nIsOdd = i % 2; - } - } - - x = x.times(x); - - if (k) { - if (x.c && x.c.length > k) x.c.length = k; - } else if (isModExp) { - x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m)); - } - } - - if (isModExp) return y; - if (nIsNeg) y = ONE.div(y); - - return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer - * using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}' - */ - P.integerValue = function (rm) { - var n = new BigNumber(this); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - return round(n, n.e + 1, rm); - }; - - - /* - * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), - * otherwise return false. - */ - P.isEqualTo = P.eq = function (y, b) { - return compare(this, new BigNumber(y, b)) === 0; - }; - - - /* - * Return true if the value of this BigNumber is a finite number, otherwise return false. - */ - P.isFinite = function () { - return !!this.c; - }; - - - /* - * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), - * otherwise return false. - */ - P.isGreaterThan = P.gt = function (y, b) { - return compare(this, new BigNumber(y, b)) > 0; - }; - - - /* - * Return true if the value of this BigNumber is greater than or equal to the value of - * BigNumber(y, b), otherwise return false. - */ - P.isGreaterThanOrEqualTo = P.gte = function (y, b) { - return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0; - - }; - - - /* - * Return true if the value of this BigNumber is an integer, otherwise return false. - */ - P.isInteger = function () { - return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; - }; - - - /* - * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), - * otherwise return false. - */ - P.isLessThan = P.lt = function (y, b) { - return compare(this, new BigNumber(y, b)) < 0; - }; - - - /* - * Return true if the value of this BigNumber is less than or equal to the value of - * BigNumber(y, b), otherwise return false. - */ - P.isLessThanOrEqualTo = P.lte = function (y, b) { - return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0; - }; - - - /* - * Return true if the value of this BigNumber is NaN, otherwise return false. - */ - P.isNaN = function () { - return !this.s; - }; - - - /* - * Return true if the value of this BigNumber is negative, otherwise return false. - */ - P.isNegative = function () { - return this.s < 0; - }; - - - /* - * Return true if the value of this BigNumber is positive, otherwise return false. - */ - P.isPositive = function () { - return this.s > 0; - }; - - - /* - * Return true if the value of this BigNumber is 0 or -0, otherwise return false. - */ - P.isZero = function () { - return !!this.c && this.c[0] == 0; - }; - - - /* - * n - 0 = n - * n - N = N - * n - I = -I - * 0 - n = -n - * 0 - 0 = 0 - * 0 - N = N - * 0 - I = -I - * N - n = N - * N - 0 = N - * N - N = N - * N - I = N - * I - n = I - * I - 0 = I - * I - N = N - * I - I = N - * - * Return a new BigNumber whose value is the value of this BigNumber minus the value of - * BigNumber(y, b). - */ - P.minus = function (y, b) { - var i, j, t, xLTy, - x = this, - a = x.s; - - y = new BigNumber(y, b); - b = y.s; - - // Either NaN? - if (!a || !b) return new BigNumber(NaN); - - // Signs differ? - if (a != b) { - y.s = -b; - return x.plus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if (!xe || !ye) { - - // Either Infinity? - if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); - - // Either zero? - if (!xc[0] || !yc[0]) { - - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : - - // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity - ROUNDING_MODE == 3 ? -0 : 0); - } - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Determine which is the bigger number. - if (a = xe - ye) { - - if (xLTy = a < 0) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - - t.reverse(); - - // Prepend zeros to equalise exponents. - for (b = a; b--; t.push(0)); - t.reverse(); - } else { - - // Exponents equal. Check digit by digit. - j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; - - for (a = b = 0; b < j; b++) { - - if (xc[b] != yc[b]) { - xLTy = xc[b] < yc[b]; - break; - } - } - } - - // x < y? Point xc to the array of the bigger number. - if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s; - - b = (j = yc.length) - (i = xc.length); - - // Append zeros to xc if shorter. - // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. - if (b > 0) for (; b--; xc[i++] = 0); - b = BASE - 1; - - // Subtract yc from xc. - for (; j > a;) { - - if (xc[--j] < yc[j]) { - for (i = j; i && !xc[--i]; xc[i] = b); - --xc[i]; - xc[j] += BASE; - } - - xc[j] -= yc[j]; - } - - // Remove leading zeros and adjust exponent accordingly. - for (; xc[0] == 0; xc.splice(0, 1), --ye); - - // Zero? - if (!xc[0]) { - - // Following IEEE 754 (2008) 6.3, - // n - n = +0 but n - n = -0 when rounding towards -Infinity. - y.s = ROUNDING_MODE == 3 ? -1 : 1; - y.c = [y.e = 0]; - return y; - } - - // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity - // for finite x and y. - return normalise(y, xc, ye); - }; - - - /* - * n % 0 = N - * n % N = N - * n % I = n - * 0 % n = 0 - * -0 % n = -0 - * 0 % 0 = N - * 0 % N = N - * 0 % I = 0 - * N % n = N - * N % 0 = N - * N % N = N - * N % I = N - * I % n = N - * I % 0 = N - * I % N = N - * I % I = N - * - * Return a new BigNumber whose value is the value of this BigNumber modulo the value of - * BigNumber(y, b). The result depends on the value of MODULO_MODE. - */ - P.modulo = P.mod = function (y, b) { - var q, s, - x = this; - - y = new BigNumber(y, b); - - // Return NaN if x is Infinity or NaN, or y is NaN or zero. - if (!x.c || !y.s || y.c && !y.c[0]) { - return new BigNumber(NaN); - - // Return x if y is Infinity or x is zero. - } else if (!y.c || x.c && !x.c[0]) { - return new BigNumber(x); - } - - if (MODULO_MODE == 9) { - - // Euclidian division: q = sign(y) * floor(x / abs(y)) - // r = x - qy where 0 <= r < abs(y) - s = y.s; - y.s = 1; - q = div(x, y, 0, 3); - y.s = s; - q.s *= s; - } else { - q = div(x, y, 0, MODULO_MODE); - } - - y = x.minus(q.times(y)); - - // To match JavaScript %, ensure sign of zero is sign of dividend. - if (!y.c[0] && MODULO_MODE == 1) y.s = x.s; - - return y; - }; - - - /* - * n * 0 = 0 - * n * N = N - * n * I = I - * 0 * n = 0 - * 0 * 0 = 0 - * 0 * N = N - * 0 * I = N - * N * n = N - * N * 0 = N - * N * N = N - * N * I = N - * I * n = I - * I * 0 = N - * I * N = N - * I * I = I - * - * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value - * of BigNumber(y, b). - */ - P.multipliedBy = P.times = function (y, b) { - var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, - base, sqrtBase, - x = this, - xc = x.c, - yc = (y = new BigNumber(y, b)).c; - - // Either NaN, ±Infinity or ±0? - if (!xc || !yc || !xc[0] || !yc[0]) { - - // Return NaN if either is NaN, or one is 0 and the other is Infinity. - if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { - y.c = y.e = y.s = null; - } else { - y.s *= x.s; - - // Return ±Infinity if either is ±Infinity. - if (!xc || !yc) { - y.c = y.e = null; - - // Return ±0 if either is ±0. - } else { - y.c = [0]; - y.e = 0; - } - } - - return y; - } - - e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); - y.s *= x.s; - xcL = xc.length; - ycL = yc.length; - - // Ensure xc points to longer array and xcL to its length. - if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; - - // Initialise the result array with zeros. - for (i = xcL + ycL, zc = []; i--; zc.push(0)); - - base = BASE; - sqrtBase = SQRT_BASE; - - for (i = ycL; --i >= 0;) { - c = 0; - ylo = yc[i] % sqrtBase; - yhi = yc[i] / sqrtBase | 0; - - for (k = xcL, j = i + k; j > i;) { - xlo = xc[--k] % sqrtBase; - xhi = xc[k] / sqrtBase | 0; - m = yhi * xlo + xhi * ylo; - xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c; - c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; - zc[j--] = xlo % base; - } - - zc[j] = c; - } - - if (c) { - ++e; - } else { - zc.splice(0, 1); - } - - return normalise(y, zc, e); - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber negated, - * i.e. multiplied by -1. - */ - P.negated = function () { - var x = new BigNumber(this); - x.s = -x.s || null; - return x; - }; - - - /* - * n + 0 = n - * n + N = N - * n + I = I - * 0 + n = n - * 0 + 0 = 0 - * 0 + N = N - * 0 + I = I - * N + n = N - * N + 0 = N - * N + N = N - * N + I = N - * I + n = I - * I + 0 = I - * I + N = N - * I + I = I - * - * Return a new BigNumber whose value is the value of this BigNumber plus the value of - * BigNumber(y, b). - */ - P.plus = function (y, b) { - var t, - x = this, - a = x.s; - - y = new BigNumber(y, b); - b = y.s; - - // Either NaN? - if (!a || !b) return new BigNumber(NaN); - - // Signs differ? - if (a != b) { - y.s = -b; - return x.minus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if (!xe || !ye) { - - // Return ±Infinity if either ±Infinity. - if (!xc || !yc) return new BigNumber(a / 0); - - // Either zero? - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0); - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. - if (a = xe - ye) { - if (a > 0) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - - t.reverse(); - for (; a--; t.push(0)); - t.reverse(); - } - - a = xc.length; - b = yc.length; - - // Point xc to the longer array, and b to the shorter length. - if (a - b < 0) t = yc, yc = xc, xc = t, b = a; - - // Only start adding at yc.length - 1 as the further digits of xc can be ignored. - for (a = 0; b;) { - a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; - xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; - } - - if (a) { - xc = [a].concat(xc); - ++ye; - } - - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - // ye = MAX_EXP + 1 possible - return normalise(y, xc, ye); - }; - - - /* - * If sd is undefined or null or true or false, return the number of significant digits of - * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. - * If sd is true include integer-part trailing zeros in the count. - * - * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this - * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or - * ROUNDING_MODE if rm is omitted. - * - * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive. - * boolean: whether to count integer-part trailing zeros: true or false. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' - */ - P.precision = P.sd = function (sd, rm) { - var c, n, v, - x = this; - - if (sd != null && sd !== !!sd) { - intCheck(sd, 1, MAX); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - return round(new BigNumber(x), sd, rm); - } - - if (!(c = x.c)) return null; - v = c.length - 1; - n = v * LOG_BASE + 1; - - if (v = c[v]) { - - // Subtract the number of trailing zeros of the last element. - for (; v % 10 == 0; v /= 10, n--); - - // Add the number of digits of the first element. - for (v = c[0]; v >= 10; v /= 10, n++); - } - - if (sd && x.e + 1 > n) n = x.e + 1; - - return n; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber shifted by k places - * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. - * - * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}' - */ - P.shiftedBy = function (k) { - intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); - return this.times('1e' + k); - }; - - - /* - * sqrt(-n) = N - * sqrt(N) = N - * sqrt(-I) = N - * sqrt(I) = I - * sqrt(0) = 0 - * sqrt(-0) = -0 - * - * Return a new BigNumber whose value is the square root of the value of this BigNumber, - * rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.squareRoot = P.sqrt = function () { - var m, n, r, rep, t, - x = this, - c = x.c, - s = x.s, - e = x.e, - dp = DECIMAL_PLACES + 4, - half = new BigNumber('0.5'); - - // Negative/NaN/Infinity/zero? - if (s !== 1 || !c || !c[0]) { - return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); - } - - // Initial estimate. - s = Math.sqrt(+valueOf(x)); - - // Math.sqrt underflow/overflow? - // Pass x to Math.sqrt as integer, then adjust the exponent of the result. - if (s == 0 || s == 1 / 0) { - n = coeffToString(c); - if ((n.length + e) % 2 == 0) n += '0'; - s = Math.sqrt(+n); - e = bitFloor((e + 1) / 2) - (e < 0 || e % 2); - - if (s == 1 / 0) { - n = '5e' + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf('e') + 1) + e; - } - - r = new BigNumber(n); - } else { - r = new BigNumber(s + ''); - } - - // Check for zero. - // r could be zero if MIN_EXP is changed after the this value was created. - // This would cause a division by zero (x/t) and hence Infinity below, which would cause - // coeffToString to throw. - if (r.c[0]) { - e = r.e; - s = e + dp; - if (s < 3) s = 0; - - // Newton-Raphson iteration. - for (; ;) { - t = r; - r = half.times(t.plus(div(x, t, dp, 1))); - - if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { - - // The exponent of r may here be one less than the final result exponent, - // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits - // are indexed correctly. - if (r.e < e) --s; - n = n.slice(s - 3, s + 1); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits - // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the - // iteration. - if (n == '9999' || !rep && n == '4999') { - - // On the first iteration only, check to see if rounding up gives the - // exact result as the nines may infinitely repeat. - if (!rep) { - round(t, t.e + DECIMAL_PLACES + 2, 0); - - if (t.times(t).eq(x)) { - r = t; - break; - } - } - - dp += 4; - s += 4; - rep = 1; - } else { - - // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact - // result. If not, then there are further digits and m will be truthy. - if (!+n || !+n.slice(1) && n.charAt(0) == '5') { - - // Truncate to the first rounding digit. - round(r, r.e + DECIMAL_PLACES + 2, 1); - m = !r.times(r).eq(x); - } - - break; - } - } - } - } - - return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); - }; - - - /* - * Return a string representing the value of this BigNumber in exponential notation and - * rounded using ROUNDING_MODE to dp fixed decimal places. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.toExponential = function (dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp++; - } - return format(this, dp, rm, 1); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounding - * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', - * but e.g. (-0.00001).toFixed(0) is '-0'. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.toFixed = function (dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp = dp + this.e + 1; - } - return format(this, dp, rm); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounded - * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties - * of the format or FORMAT object (see BigNumber.set). - * - * The formatting object may contain some or all of the properties shown below. - * - * FORMAT = { - * prefix: '', - * groupSize: 3, - * secondaryGroupSize: 0, - * groupSeparator: ',', - * decimalSeparator: '.', - * fractionGroupSize: 0, - * fractionGroupSeparator: '\xA0', // non-breaking space - * suffix: '' - * }; - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * [format] {object} Formatting options. See FORMAT pbject above. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - * '[BigNumber Error] Argument not an object: {format}' - */ - P.toFormat = function (dp, rm, format) { - var str, - x = this; - - if (format == null) { - if (dp != null && rm && typeof rm == 'object') { - format = rm; - rm = null; - } else if (dp && typeof dp == 'object') { - format = dp; - dp = rm = null; - } else { - format = FORMAT; - } - } else if (typeof format != 'object') { - throw Error - (bignumberError + 'Argument not an object: ' + format); - } - - str = x.toFixed(dp, rm); - - if (x.c) { - var i, - arr = str.split('.'), - g1 = +format.groupSize, - g2 = +format.secondaryGroupSize, - groupSeparator = format.groupSeparator || '', - intPart = arr[0], - fractionPart = arr[1], - isNeg = x.s < 0, - intDigits = isNeg ? intPart.slice(1) : intPart, - len = intDigits.length; - - if (g2) i = g1, g1 = g2, g2 = i, len -= i; - - if (g1 > 0 && len > 0) { - i = len % g1 || g1; - intPart = intDigits.substr(0, i); - for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1); - if (g2 > 0) intPart += groupSeparator + intDigits.slice(i); - if (isNeg) intPart = '-' + intPart; - } - - str = fractionPart - ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) - ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'), - '$&' + (format.fractionGroupSeparator || '')) - : fractionPart) - : intPart; - } - - return (format.prefix || '') + str + (format.suffix || ''); - }; - - - /* - * Return an array of two BigNumbers representing the value of this BigNumber as a simple - * fraction with an integer numerator and an integer denominator. - * The denominator will be a positive non-zero value less than or equal to the specified - * maximum denominator. If a maximum denominator is not specified, the denominator will be - * the lowest value necessary to represent the number exactly. - * - * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator. - * - * '[BigNumber Error] Argument {not an integer|out of range} : {md}' - */ - P.toFraction = function (md) { - var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, - x = this, - xc = x.c; - - if (md != null) { - n = new BigNumber(md); - - // Throw if md is less than one or is not an integer, unless it is Infinity. - if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { - throw Error - (bignumberError + 'Argument ' + - (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n)); - } - } - - if (!xc) return new BigNumber(x); - - d = new BigNumber(ONE); - n1 = d0 = new BigNumber(ONE); - d1 = n0 = new BigNumber(ONE); - s = coeffToString(xc); - - // Determine initial denominator. - // d is a power of 10 and the minimum max denominator that specifies the value exactly. - e = d.e = s.length - x.e - 1; - d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; - md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n; - - exp = MAX_EXP; - MAX_EXP = 1 / 0; - n = new BigNumber(s); - - // n0 = d1 = 0 - n0.c[0] = 0; - - for (; ;) { - q = div(n, d, 0, 1); - d2 = d0.plus(q.times(d1)); - if (d2.comparedTo(md) == 1) break; - d0 = d1; - d1 = d2; - n1 = n0.plus(q.times(d2 = n1)); - n0 = d2; - d = n.minus(q.times(d2 = d)); - n = d2; - } - - d2 = div(md.minus(d0), d1, 0, 1); - n0 = n0.plus(d2.times(n1)); - d0 = d0.plus(d2.times(d1)); - n0.s = n1.s = x.s; - e = e * 2; - - // Determine which fraction is closer to x, n0/d0 or n1/d1 - r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( - div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; - - MAX_EXP = exp; - - return r; - }; - - - /* - * Return the value of this BigNumber converted to a number primitive. - */ - P.toNumber = function () { - return +valueOf(this); - }; - - - /* - * Return a string representing the value of this BigNumber rounded to sd significant digits - * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits - * necessary to represent the integer part of the value in fixed-point notation, then use - * exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' - */ - P.toPrecision = function (sd, rm) { - if (sd != null) intCheck(sd, 1, MAX); - return format(this, sd, rm, 2); - }; - - - /* - * Return a string representing the value of this BigNumber in base b, or base 10 if b is - * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and - * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent - * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than - * TO_EXP_NEG, return exponential notation. - * - * [b] {number} Integer, 2 to ALPHABET.length inclusive. - * - * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' - */ - P.toString = function (b) { - var str, - n = this, - s = n.s, - e = n.e; - - // Infinity or NaN? - if (e === null) { - if (s) { - str = 'Infinity'; - if (s < 0) str = '-' + str; - } else { - str = 'NaN'; - } - } else { - if (b == null) { - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential(coeffToString(n.c), e) - : toFixedPoint(coeffToString(n.c), e, '0'); - } else if (b === 10) { - n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); - str = toFixedPoint(coeffToString(n.c), n.e, '0'); - } else { - intCheck(b, 2, ALPHABET.length, 'Base'); - str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true); - } - - if (s < 0 && n.c[0]) str = '-' + str; - } - - return str; - }; - - - /* - * Return as toString, but do not accept a base argument, and include the minus sign for - * negative zero. - */ - P.valueOf = P.toJSON = function () { - return valueOf(this); - }; - - - P._isBigNumber = true; - - if (configObject != null) BigNumber.set(configObject); - - return BigNumber; - } - - - // PRIVATE HELPER FUNCTIONS - - // These functions don't need access to variables, - // e.g. DECIMAL_PLACES, in the scope of the `clone` function above. - - - function bitFloor(n) { - var i = n | 0; - return n > 0 || n === i ? i : i - 1; - } - - - // Return a coefficient array as a string of base 10 digits. - function coeffToString(a) { - var s, z, - i = 1, - j = a.length, - r = a[0] + ''; - - for (; i < j;) { - s = a[i++] + ''; - z = LOG_BASE - s.length; - for (; z--; s = '0' + s); - r += s; - } - - // Determine trailing zeros. - for (j = r.length; r.charCodeAt(--j) === 48;); - - return r.slice(0, j + 1 || 1); - } - - - // Compare the value of BigNumbers x and y. - function compare(x, y) { - var a, b, - xc = x.c, - yc = y.c, - i = x.s, - j = y.s, - k = x.e, - l = y.e; - - // Either NaN? - if (!i || !j) return null; - - a = xc && !xc[0]; - b = yc && !yc[0]; - - // Either zero? - if (a || b) return a ? b ? 0 : -j : i; - - // Signs differ? - if (i != j) return i; - - a = i < 0; - b = k == l; - - // Either Infinity? - if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1; - - // Compare exponents. - if (!b) return k > l ^ a ? 1 : -1; - - j = (k = xc.length) < (l = yc.length) ? k : l; - - // Compare digit by digit. - for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1; - - // Compare lengths. - return k == l ? 0 : k > l ^ a ? 1 : -1; - } - - - /* - * Check that n is a primitive number, an integer, and in range, otherwise throw. - */ - function intCheck(n, min, max, name) { - if (n < min || n > max || n !== mathfloor(n)) { - throw Error - (bignumberError + (name || 'Argument') + (typeof n == 'number' - ? n < min || n > max ? ' out of range: ' : ' not an integer: ' - : ' not a primitive number: ') + String(n)); - } - } - - - // Assumes finite n. - function isOdd(n) { - var k = n.c.length - 1; - return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; - } - - - function toExponential(str, e) { - return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) + - (e < 0 ? 'e' : 'e+') + e; - } - - - function toFixedPoint(str, e, z) { - var len, zs; - - // Negative exponent? - if (e < 0) { - - // Prepend zeros. - for (zs = z + '.'; ++e; zs += z); - str = zs + str; - - // Positive exponent - } else { - len = str.length; - - // Append zeros. - if (++e > len) { - for (zs = z, e -= len; --e; zs += z); - str += zs; - } else if (e < len) { - str = str.slice(0, e) + '.' + str.slice(e); - } - } - - return str; - } - - - // EXPORT - - - BigNumber = clone(); - BigNumber['default'] = BigNumber.BigNumber = BigNumber; - - // AMD. - if (typeof define == 'function' && define.amd) { - define(function () { return BigNumber; }); - - // Node.js and other environments that support module.exports. - } else if (typeof module != 'undefined' && module.exports) { - module.exports = BigNumber; - - // Browser. - } else { - if (!globalObject) { - globalObject = typeof self != 'undefined' && self ? self : window; - } - - globalObject.BigNumber = BigNumber; - } -})(this); diff --git a/node_modules/bignumber.js/bignumber.min.js b/node_modules/bignumber.js/bignumber.min.js deleted file mode 100644 index b9f05942..00000000 --- a/node_modules/bignumber.js/bignumber.min.js +++ /dev/null @@ -1 +0,0 @@ -/* bignumber.js v9.0.1 https://github.com/MikeMcl/bignumber.js/LICENCE.md */!function(e){"use strict";var r,C=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,M=Math.ceil,G=Math.floor,k="[BigNumber Error] ",F=k+"Number primitive has more than 15 significant digits: ",q=1e14,j=14,$=9007199254740991,z=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],H=1e7,V=1e9;function W(e){var r=0|e;return 0o[s]^n?1:-1;return u==l?0:l(t=e.length)){for(i=n,r-=t;--r;i+=n);e+=i}else rb?c.c=c.e=null:e.eb)c.c=c.e=null;else if(on-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}function D(e,r,n){var t,i,o,s,f=0,u=e.length,l=r%H,c=r/H|0;for(e=e.slice();u--;)f=((i=l*(o=e[u]%H)+(t=c*o+(s=e[u]/H|0)*l)%H*H+f)/n|0)+(t/H|0)+c*s,e[u]=i%n;return f&&(e=[f].concat(e)),e}function P(e,r,n,t){var i,o;if(n!=t)o=tr[i]?1:-1;break}return o}function x(e,r,n,t){for(var i=0;n--;)e[n]-=i,i=e[n]b?e.c=e.e=null:n=a.length){if(!t)break e;for(;a.length<=l;a.push(0));u=c=0,s=(o%=j)-j+(i=1)}else{for(u=f=a[l],i=1;10<=f;f/=10,i++);c=(s=(o%=j)-j+i)<0?0:u/h[i-s-1]%10|0}if(t=t||r<0||null!=a[l+1]||(s<0?u:u%h[i-s-1]),t=n<4?(c||t)&&(0==n||n==(e.s<0?3:2)):5b?e.c=e.e=null:e.e>>11))?(n=crypto.getRandomValues(new Uint32Array(2)),r[s]=n[0],r[s+1]=n[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw E=!1,Error(k+"crypto unavailable");for(r=crypto.randomBytes(i*=7);sn;)a[s]=0,s||(++f,a=[1].concat(a));for(u=a.length;!a[--u];);for(g=0,e="";g<=u;e+=o.charAt(a[g++]));e=Q(e,f,o.charAt(0))}return e},d=function(e,r,n,t,i){var o,s,f,u,l,c,a,h,g,p,w,d,m,v,N,O,y,b=e.s==r.s?1:-1,E=e.c,A=r.c;if(!(E&&E[0]&&A&&A[0]))return new _(e.s&&r.s&&(E?!A||E[0]!=A[0]:A)?E&&0==E[0]||!A?0*b:b/0:NaN);for(g=(h=new _(b)).c=[],b=n+(s=e.e-r.e)+1,i||(i=q,s=W(e.e/j)-W(r.e/j),b=b/j|0),f=0;A[f]==(E[f]||0);f++);if(A[f]>(E[f]||0)&&s--,b<0)g.push(1),u=!0;else{for(v=E.length,O=A.length,b+=2,1<(l=G(i/(A[f=0]+1)))&&(A=D(A,l,i),E=D(E,l,i),O=A.length,v=E.length),m=O,w=(p=E.slice(0,O)).length;w=i/2&&N++;do{if(l=0,(o=P(A,p,O,w))<0){if(d=p[0],O!=w&&(d=d*i+(p[1]||0)),1<(l=G(d/N)))for(i<=l&&(l=i-1),a=(c=D(A,l,i)).length,w=p.length;1==P(c,p,a,w);)l--,x(c,Oo&&(l.c.length=o):t&&(l=l.mod(r))}if(i){if(0===(i=G(i/2)))break;u=i%2}else if(I(e=e.times(n),e.e+1,1),14o&&(c.c.length=o):t&&(c=c.mod(r))}return t?l:(f&&(l=w.div(l)),r?l.mod(r):o?I(l,A,N,void 0):l)},t.integerValue=function(e){var r=new _(this);return null==e?e=N:J(e,0,8),I(r,r.e+1,e)},t.isEqualTo=t.eq=function(e,r){return 0===Y(this,new _(e,r))},t.isFinite=function(){return!!this.c},t.isGreaterThan=t.gt=function(e,r){return 0this.c.length-2},t.isLessThan=t.lt=function(e,r){return Y(this,new _(e,r))<0},t.isLessThanOrEqualTo=t.lte=function(e,r){return-1===(r=Y(this,new _(e,r)))||0===r},t.isNaN=function(){return!this.s},t.isNegative=function(){return this.s<0},t.isPositive=function(){return 0t&&(t=this.e+1),t},t.shiftedBy=function(e){return J(e,-$,$),this.times("1e"+e)},t.squareRoot=t.sqrt=function(){var e,r,n,t,i,o=this,s=o.c,f=o.s,u=o.e,l=v+4,c=new _("0.5");if(1!==f||!s||!s[0])return new _(!f||f<0&&(!s||s[0])?NaN:s?o:1/0);if((n=0==(f=Math.sqrt(+T(o)))||f==1/0?(((r=X(s)).length+u)%2==0&&(r+="0"),f=Math.sqrt(+r),u=W((u+1)/2)-(u<0||u%2),new _(r=f==1/0?"5e"+u:(r=f.toExponential()).slice(0,r.indexOf("e")+1)+u)):new _(f+"")).c[0])for((f=(u=n.e)+l)<3&&(f=0);;)if(i=n,n=c.times(i.plus(d(o,i,l,1))),X(i.c).slice(0,f)===(r=X(n.c)).slice(0,f)){if(n.e - * MIT Licensed. - * - * BigNumber.prototype methods | BigNumber methods - * | - * absoluteValue abs | clone - * comparedTo | config set - * decimalPlaces dp | DECIMAL_PLACES - * dividedBy div | ROUNDING_MODE - * dividedToIntegerBy idiv | EXPONENTIAL_AT - * exponentiatedBy pow | RANGE - * integerValue | CRYPTO - * isEqualTo eq | MODULO_MODE - * isFinite | POW_PRECISION - * isGreaterThan gt | FORMAT - * isGreaterThanOrEqualTo gte | ALPHABET - * isInteger | isBigNumber - * isLessThan lt | maximum max - * isLessThanOrEqualTo lte | minimum min - * isNaN | random - * isNegative | sum - * isPositive | - * isZero | - * minus | - * modulo mod | - * multipliedBy times | - * negated | - * plus | - * precision sd | - * shiftedBy | - * squareRoot sqrt | - * toExponential | - * toFixed | - * toFormat | - * toFraction | - * toJSON | - * toNumber | - * toPrecision | - * toString | - * valueOf | - * - */ - - -var - isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, - - mathceil = Math.ceil, - mathfloor = Math.floor, - - bignumberError = '[BigNumber Error] ', - tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ', - - BASE = 1e14, - LOG_BASE = 14, - MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 - // MAX_INT32 = 0x7fffffff, // 2^31 - 1 - POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], - SQRT_BASE = 1e7, - - // EDITABLE - // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and - // the arguments to toExponential, toFixed, toFormat, and toPrecision. - MAX = 1E9; // 0 to MAX_INT32 - - -/* - * Create and return a BigNumber constructor. - */ -function clone(configObject) { - var div, convertBase, parseNumeric, - P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null }, - ONE = new BigNumber(1), - - - //----------------------------- EDITABLE CONFIG DEFAULTS ------------------------------- - - - // The default values below must be integers within the inclusive ranges stated. - // The values can also be changed at run-time using BigNumber.set. - - // The maximum number of decimal places for operations involving division. - DECIMAL_PLACES = 20, // 0 to MAX - - // The rounding mode used when rounding to the above decimal places, and when using - // toExponential, toFixed, toFormat and toPrecision, and round (default value). - // UP 0 Away from zero. - // DOWN 1 Towards zero. - // CEIL 2 Towards +Infinity. - // FLOOR 3 Towards -Infinity. - // HALF_UP 4 Towards nearest neighbour. If equidistant, up. - // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. - // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. - // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. - // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. - ROUNDING_MODE = 4, // 0 to 8 - - // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] - - // The exponent value at and beneath which toString returns exponential notation. - // Number type: -7 - TO_EXP_NEG = -7, // 0 to -MAX - - // The exponent value at and above which toString returns exponential notation. - // Number type: 21 - TO_EXP_POS = 21, // 0 to MAX - - // RANGE : [MIN_EXP, MAX_EXP] - - // The minimum exponent value, beneath which underflow to zero occurs. - // Number type: -324 (5e-324) - MIN_EXP = -1e7, // -1 to -MAX - - // The maximum exponent value, above which overflow to Infinity occurs. - // Number type: 308 (1.7976931348623157e+308) - // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. - MAX_EXP = 1e7, // 1 to MAX - - // Whether to use cryptographically-secure random number generation, if available. - CRYPTO = false, // true or false - - // The modulo mode used when calculating the modulus: a mod n. - // The quotient (q = a / n) is calculated according to the corresponding rounding mode. - // The remainder (r) is calculated as: r = a - n * q. - // - // UP 0 The remainder is positive if the dividend is negative, else is negative. - // DOWN 1 The remainder has the same sign as the dividend. - // This modulo mode is commonly known as 'truncated division' and is - // equivalent to (a % n) in JavaScript. - // FLOOR 3 The remainder has the same sign as the divisor (Python %). - // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. - // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). - // The remainder is always positive. - // - // The truncated division, floored division, Euclidian division and IEEE 754 remainder - // modes are commonly used for the modulus operation. - // Although the other rounding modes can also be used, they may not give useful results. - MODULO_MODE = 1, // 0 to 9 - - // The maximum number of significant digits of the result of the exponentiatedBy operation. - // If POW_PRECISION is 0, there will be unlimited significant digits. - POW_PRECISION = 0, // 0 to MAX - - // The format specification used by the BigNumber.prototype.toFormat method. - FORMAT = { - prefix: '', - groupSize: 3, - secondaryGroupSize: 0, - groupSeparator: ',', - decimalSeparator: '.', - fractionGroupSize: 0, - fractionGroupSeparator: '\xA0', // non-breaking space - suffix: '' - }, - - // The alphabet used for base conversion. It must be at least 2 characters long, with no '+', - // '-', '.', whitespace, or repeated character. - // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' - ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'; - - - //------------------------------------------------------------------------------------------ - - - // CONSTRUCTOR - - - /* - * The BigNumber constructor and exported function. - * Create and return a new instance of a BigNumber object. - * - * v {number|string|BigNumber} A numeric value. - * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive. - */ - function BigNumber(v, b) { - var alphabet, c, caseChanged, e, i, isNum, len, str, - x = this; - - // Enable constructor call without `new`. - if (!(x instanceof BigNumber)) return new BigNumber(v, b); - - if (b == null) { - - if (v && v._isBigNumber === true) { - x.s = v.s; - - if (!v.c || v.e > MAX_EXP) { - x.c = x.e = null; - } else if (v.e < MIN_EXP) { - x.c = [x.e = 0]; - } else { - x.e = v.e; - x.c = v.c.slice(); - } - - return; - } - - if ((isNum = typeof v == 'number') && v * 0 == 0) { - - // Use `1 / n` to handle minus zero also. - x.s = 1 / v < 0 ? (v = -v, -1) : 1; - - // Fast path for integers, where n < 2147483648 (2**31). - if (v === ~~v) { - for (e = 0, i = v; i >= 10; i /= 10, e++); - - if (e > MAX_EXP) { - x.c = x.e = null; - } else { - x.e = e; - x.c = [v]; - } - - return; - } - - str = String(v); - } else { - - if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum); - - x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; - } - - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - - // Exponential form? - if ((i = str.search(/e/i)) > 0) { - - // Determine exponent. - if (e < 0) e = i; - e += +str.slice(i + 1); - str = str.substring(0, i); - } else if (e < 0) { - - // Integer. - e = str.length; - } - - } else { - - // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' - intCheck(b, 2, ALPHABET.length, 'Base'); - - // Allow exponential notation to be used with base 10 argument, while - // also rounding to DECIMAL_PLACES as with other bases. - if (b == 10) { - x = new BigNumber(v); - return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); - } - - str = String(v); - - if (isNum = typeof v == 'number') { - - // Avoid potential interpretation of Infinity and NaN as base 44+ values. - if (v * 0 != 0) return parseNumeric(x, str, isNum, b); - - x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; - - // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' - if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) { - throw Error - (tooManyDigits + v); - } - } else { - x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; - } - - alphabet = ALPHABET.slice(0, b); - e = i = 0; - - // Check that str is a valid base b number. - // Don't use RegExp, so alphabet can contain special characters. - for (len = str.length; i < len; i++) { - if (alphabet.indexOf(c = str.charAt(i)) < 0) { - if (c == '.') { - - // If '.' is not the first character and it has not be found before. - if (i > e) { - e = len; - continue; - } - } else if (!caseChanged) { - - // Allow e.g. hexadecimal 'FF' as well as 'ff'. - if (str == str.toUpperCase() && (str = str.toLowerCase()) || - str == str.toLowerCase() && (str = str.toUpperCase())) { - caseChanged = true; - i = -1; - e = 0; - continue; - } - } - - return parseNumeric(x, String(v), isNum, b); - } - } - - // Prevent later check for length on converted number. - isNum = false; - str = convertBase(str, b, 10, x.s); - - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - else e = str.length; - } - - // Determine leading zeros. - for (i = 0; str.charCodeAt(i) === 48; i++); - - // Determine trailing zeros. - for (len = str.length; str.charCodeAt(--len) === 48;); - - if (str = str.slice(i, ++len)) { - len -= i; - - // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' - if (isNum && BigNumber.DEBUG && - len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { - throw Error - (tooManyDigits + (x.s * v)); - } - - // Overflow? - if ((e = e - i - 1) > MAX_EXP) { - - // Infinity. - x.c = x.e = null; - - // Underflow? - } else if (e < MIN_EXP) { - - // Zero. - x.c = [x.e = 0]; - } else { - x.e = e; - x.c = []; - - // Transform base - - // e is the base 10 exponent. - // i is where to slice str to get the first element of the coefficient array. - i = (e + 1) % LOG_BASE; - if (e < 0) i += LOG_BASE; // i < 1 - - if (i < len) { - if (i) x.c.push(+str.slice(0, i)); - - for (len -= LOG_BASE; i < len;) { - x.c.push(+str.slice(i, i += LOG_BASE)); - } - - i = LOG_BASE - (str = str.slice(i)).length; - } else { - i -= len; - } - - for (; i--; str += '0'); - x.c.push(+str); - } - } else { - - // Zero. - x.c = [x.e = 0]; - } - } - - - // CONSTRUCTOR PROPERTIES - - - BigNumber.clone = clone; - - BigNumber.ROUND_UP = 0; - BigNumber.ROUND_DOWN = 1; - BigNumber.ROUND_CEIL = 2; - BigNumber.ROUND_FLOOR = 3; - BigNumber.ROUND_HALF_UP = 4; - BigNumber.ROUND_HALF_DOWN = 5; - BigNumber.ROUND_HALF_EVEN = 6; - BigNumber.ROUND_HALF_CEIL = 7; - BigNumber.ROUND_HALF_FLOOR = 8; - BigNumber.EUCLID = 9; - - - /* - * Configure infrequently-changing library-wide settings. - * - * Accept an object with the following optional properties (if the value of a property is - * a number, it must be an integer within the inclusive range stated): - * - * DECIMAL_PLACES {number} 0 to MAX - * ROUNDING_MODE {number} 0 to 8 - * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX] - * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX] - * CRYPTO {boolean} true or false - * MODULO_MODE {number} 0 to 9 - * POW_PRECISION {number} 0 to MAX - * ALPHABET {string} A string of two or more unique characters which does - * not contain '.'. - * FORMAT {object} An object with some of the following properties: - * prefix {string} - * groupSize {number} - * secondaryGroupSize {number} - * groupSeparator {string} - * decimalSeparator {string} - * fractionGroupSize {number} - * fractionGroupSeparator {string} - * suffix {string} - * - * (The values assigned to the above FORMAT object properties are not checked for validity.) - * - * E.g. - * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) - * - * Ignore properties/parameters set to null or undefined, except for ALPHABET. - * - * Return an object with the properties current values. - */ - BigNumber.config = BigNumber.set = function (obj) { - var p, v; - - if (obj != null) { - - if (typeof obj == 'object') { - - // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. - // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) { - v = obj[p]; - intCheck(v, 0, MAX, p); - DECIMAL_PLACES = v; - } - - // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. - // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) { - v = obj[p]; - intCheck(v, 0, 8, p); - ROUNDING_MODE = v; - } - - // EXPONENTIAL_AT {number|number[]} - // Integer, -MAX to MAX inclusive or - // [integer -MAX to 0 inclusive, 0 to MAX inclusive]. - // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, 0, p); - intCheck(v[1], 0, MAX, p); - TO_EXP_NEG = v[0]; - TO_EXP_POS = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); - } - } - - // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or - // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. - // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}' - if (obj.hasOwnProperty(p = 'RANGE')) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, -1, p); - intCheck(v[1], 1, MAX, p); - MIN_EXP = v[0]; - MAX_EXP = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - if (v) { - MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); - } else { - throw Error - (bignumberError + p + ' cannot be zero: ' + v); - } - } - } - - // CRYPTO {boolean} true or false. - // '[BigNumber Error] CRYPTO not true or false: {v}' - // '[BigNumber Error] crypto unavailable' - if (obj.hasOwnProperty(p = 'CRYPTO')) { - v = obj[p]; - if (v === !!v) { - if (v) { - if (typeof crypto != 'undefined' && crypto && - (crypto.getRandomValues || crypto.randomBytes)) { - CRYPTO = v; - } else { - CRYPTO = !v; - throw Error - (bignumberError + 'crypto unavailable'); - } - } else { - CRYPTO = v; - } - } else { - throw Error - (bignumberError + p + ' not true or false: ' + v); - } - } - - // MODULO_MODE {number} Integer, 0 to 9 inclusive. - // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'MODULO_MODE')) { - v = obj[p]; - intCheck(v, 0, 9, p); - MODULO_MODE = v; - } - - // POW_PRECISION {number} Integer, 0 to MAX inclusive. - // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'POW_PRECISION')) { - v = obj[p]; - intCheck(v, 0, MAX, p); - POW_PRECISION = v; - } - - // FORMAT {object} - // '[BigNumber Error] FORMAT not an object: {v}' - if (obj.hasOwnProperty(p = 'FORMAT')) { - v = obj[p]; - if (typeof v == 'object') FORMAT = v; - else throw Error - (bignumberError + p + ' not an object: ' + v); - } - - // ALPHABET {string} - // '[BigNumber Error] ALPHABET invalid: {v}' - if (obj.hasOwnProperty(p = 'ALPHABET')) { - v = obj[p]; - - // Disallow if only one character, - // or if it contains '+', '-', '.', whitespace, or a repeated character. - if (typeof v == 'string' && !/^.$|[+-.\s]|(.).*\1/.test(v)) { - ALPHABET = v; - } else { - throw Error - (bignumberError + p + ' invalid: ' + v); - } - } - - } else { - - // '[BigNumber Error] Object expected: {v}' - throw Error - (bignumberError + 'Object expected: ' + obj); - } - } - - return { - DECIMAL_PLACES: DECIMAL_PLACES, - ROUNDING_MODE: ROUNDING_MODE, - EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], - RANGE: [MIN_EXP, MAX_EXP], - CRYPTO: CRYPTO, - MODULO_MODE: MODULO_MODE, - POW_PRECISION: POW_PRECISION, - FORMAT: FORMAT, - ALPHABET: ALPHABET - }; - }; - - - /* - * Return true if v is a BigNumber instance, otherwise return false. - * - * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed. - * - * v {any} - * - * '[BigNumber Error] Invalid BigNumber: {v}' - */ - BigNumber.isBigNumber = function (v) { - if (!v || v._isBigNumber !== true) return false; - if (!BigNumber.DEBUG) return true; - - var i, n, - c = v.c, - e = v.e, - s = v.s; - - out: if ({}.toString.call(c) == '[object Array]') { - - if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { - - // If the first element is zero, the BigNumber value must be zero. - if (c[0] === 0) { - if (e === 0 && c.length === 1) return true; - break out; - } - - // Calculate number of digits that c[0] should have, based on the exponent. - i = (e + 1) % LOG_BASE; - if (i < 1) i += LOG_BASE; - - // Calculate number of digits of c[0]. - //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) { - if (String(c[0]).length == i) { - - for (i = 0; i < c.length; i++) { - n = c[i]; - if (n < 0 || n >= BASE || n !== mathfloor(n)) break out; - } - - // Last element cannot be zero, unless it is the only element. - if (n !== 0) return true; - } - } - - // Infinity/NaN - } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { - return true; - } - - throw Error - (bignumberError + 'Invalid BigNumber: ' + v); - }; - - - /* - * Return a new BigNumber whose value is the maximum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.maximum = BigNumber.max = function () { - return maxOrMin(arguments, P.lt); - }; - - - /* - * Return a new BigNumber whose value is the minimum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.minimum = BigNumber.min = function () { - return maxOrMin(arguments, P.gt); - }; - - - /* - * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, - * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing - * zeros are produced). - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}' - * '[BigNumber Error] crypto unavailable' - */ - BigNumber.random = (function () { - var pow2_53 = 0x20000000000000; - - // Return a 53 bit integer n, where 0 <= n < 9007199254740992. - // Check if Math.random() produces more than 32 bits of randomness. - // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. - // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. - var random53bitInt = (Math.random() * pow2_53) & 0x1fffff - ? function () { return mathfloor(Math.random() * pow2_53); } - : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + - (Math.random() * 0x800000 | 0); }; - - return function (dp) { - var a, b, e, k, v, - i = 0, - c = [], - rand = new BigNumber(ONE); - - if (dp == null) dp = DECIMAL_PLACES; - else intCheck(dp, 0, MAX); - - k = mathceil(dp / LOG_BASE); - - if (CRYPTO) { - - // Browsers supporting crypto.getRandomValues. - if (crypto.getRandomValues) { - - a = crypto.getRandomValues(new Uint32Array(k *= 2)); - - for (; i < k;) { - - // 53 bits: - // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) - // 11111 11111111 11111111 11111111 11100000 00000000 00000000 - // ((Math.pow(2, 32) - 1) >>> 11).toString(2) - // 11111 11111111 11111111 - // 0x20000 is 2^21. - v = a[i] * 0x20000 + (a[i + 1] >>> 11); - - // Rejection sampling: - // 0 <= v < 9007199254740992 - // Probability that v >= 9e15, is - // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 - if (v >= 9e15) { - b = crypto.getRandomValues(new Uint32Array(2)); - a[i] = b[0]; - a[i + 1] = b[1]; - } else { - - // 0 <= v <= 8999999999999999 - // 0 <= (v % 1e14) <= 99999999999999 - c.push(v % 1e14); - i += 2; - } - } - i = k / 2; - - // Node.js supporting crypto.randomBytes. - } else if (crypto.randomBytes) { - - // buffer - a = crypto.randomBytes(k *= 7); - - for (; i < k;) { - - // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 - // 0x100000000 is 2^32, 0x1000000 is 2^24 - // 11111 11111111 11111111 11111111 11111111 11111111 11111111 - // 0 <= v < 9007199254740992 - v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) + - (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) + - (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; - - if (v >= 9e15) { - crypto.randomBytes(7).copy(a, i); - } else { - - // 0 <= (v % 1e14) <= 99999999999999 - c.push(v % 1e14); - i += 7; - } - } - i = k / 7; - } else { - CRYPTO = false; - throw Error - (bignumberError + 'crypto unavailable'); - } - } - - // Use Math.random. - if (!CRYPTO) { - - for (; i < k;) { - v = random53bitInt(); - if (v < 9e15) c[i++] = v % 1e14; - } - } - - k = c[--i]; - dp %= LOG_BASE; - - // Convert trailing digits to zeros according to dp. - if (k && dp) { - v = POWS_TEN[LOG_BASE - dp]; - c[i] = mathfloor(k / v) * v; - } - - // Remove trailing elements which are zero. - for (; c[i] === 0; c.pop(), i--); - - // Zero? - if (i < 0) { - c = [e = 0]; - } else { - - // Remove leading elements which are zero and adjust exponent accordingly. - for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); - - // Count the digits of the first element of c to determine leading zeros, and... - for (i = 1, v = c[0]; v >= 10; v /= 10, i++); - - // adjust the exponent accordingly. - if (i < LOG_BASE) e -= LOG_BASE - i; - } - - rand.e = e; - rand.c = c; - return rand; - }; - })(); - - - /* - * Return a BigNumber whose value is the sum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.sum = function () { - var i = 1, - args = arguments, - sum = new BigNumber(args[0]); - for (; i < args.length;) sum = sum.plus(args[i++]); - return sum; - }; - - - // PRIVATE FUNCTIONS - - - // Called by BigNumber and BigNumber.prototype.toString. - convertBase = (function () { - var decimal = '0123456789'; - - /* - * Convert string of baseIn to an array of numbers of baseOut. - * Eg. toBaseOut('255', 10, 16) returns [15, 15]. - * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5]. - */ - function toBaseOut(str, baseIn, baseOut, alphabet) { - var j, - arr = [0], - arrL, - i = 0, - len = str.length; - - for (; i < len;) { - for (arrL = arr.length; arrL--; arr[arrL] *= baseIn); - - arr[0] += alphabet.indexOf(str.charAt(i++)); - - for (j = 0; j < arr.length; j++) { - - if (arr[j] > baseOut - 1) { - if (arr[j + 1] == null) arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - - return arr.reverse(); - } - - // Convert a numeric string of baseIn to a numeric string of baseOut. - // If the caller is toString, we are converting from base 10 to baseOut. - // If the caller is BigNumber, we are converting from baseIn to base 10. - return function (str, baseIn, baseOut, sign, callerIsToString) { - var alphabet, d, e, k, r, x, xc, y, - i = str.indexOf('.'), - dp = DECIMAL_PLACES, - rm = ROUNDING_MODE; - - // Non-integer. - if (i >= 0) { - k = POW_PRECISION; - - // Unlimited precision. - POW_PRECISION = 0; - str = str.replace('.', ''); - y = new BigNumber(baseIn); - x = y.pow(str.length - i); - POW_PRECISION = k; - - // Convert str as if an integer, then restore the fraction part by dividing the - // result by its base raised to a power. - - y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), - 10, baseOut, decimal); - y.e = y.c.length; - } - - // Convert the number as integer. - - xc = toBaseOut(str, baseIn, baseOut, callerIsToString - ? (alphabet = ALPHABET, decimal) - : (alphabet = decimal, ALPHABET)); - - // xc now represents str as an integer and converted to baseOut. e is the exponent. - e = k = xc.length; - - // Remove trailing zeros. - for (; xc[--k] == 0; xc.pop()); - - // Zero? - if (!xc[0]) return alphabet.charAt(0); - - // Does str represent an integer? If so, no need for the division. - if (i < 0) { - --e; - } else { - x.c = xc; - x.e = e; - - // The sign is needed for correct rounding. - x.s = sign; - x = div(x, y, dp, rm, baseOut); - xc = x.c; - r = x.r; - e = x.e; - } - - // xc now represents str converted to baseOut. - - // THe index of the rounding digit. - d = e + dp + 1; - - // The rounding digit: the digit to the right of the digit that may be rounded up. - i = xc[d]; - - // Look at the rounding digits and mode to determine whether to round up. - - k = baseOut / 2; - r = r || d < 0 || xc[d + 1] != null; - - r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 || - rm == (x.s < 0 ? 8 : 7)); - - // If the index of the rounding digit is not greater than zero, or xc represents - // zero, then the result of the base conversion is zero or, if rounding up, a value - // such as 0.00001. - if (d < 1 || !xc[0]) { - - // 1^-dp or 0 - str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); - } else { - - // Truncate xc to the required number of decimal places. - xc.length = d; - - // Round up? - if (r) { - - // Rounding up may mean the previous digit has to be rounded up and so on. - for (--baseOut; ++xc[--d] > baseOut;) { - xc[d] = 0; - - if (!d) { - ++e; - xc = [1].concat(xc); - } - } - } - - // Determine trailing zeros. - for (k = xc.length; !xc[--k];); - - // E.g. [4, 11, 15] becomes 4bf. - for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])); - - // Add leading zeros, decimal point and trailing zeros as required. - str = toFixedPoint(str, e, alphabet.charAt(0)); - } - - // The caller will add the sign. - return str; - }; - })(); - - - // Perform division in the specified base. Called by div and convertBase. - div = (function () { - - // Assume non-zero x and k. - function multiply(x, k, base) { - var m, temp, xlo, xhi, - carry = 0, - i = x.length, - klo = k % SQRT_BASE, - khi = k / SQRT_BASE | 0; - - for (x = x.slice(); i--;) { - xlo = x[i] % SQRT_BASE; - xhi = x[i] / SQRT_BASE | 0; - m = khi * xlo + xhi * klo; - temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry; - carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; - x[i] = temp % base; - } - - if (carry) x = [carry].concat(x); - - return x; - } - - function compare(a, b, aL, bL) { - var i, cmp; - - if (aL != bL) { - cmp = aL > bL ? 1 : -1; - } else { - - for (i = cmp = 0; i < aL; i++) { - - if (a[i] != b[i]) { - cmp = a[i] > b[i] ? 1 : -1; - break; - } - } - } - - return cmp; - } - - function subtract(a, b, aL, base) { - var i = 0; - - // Subtract b from a. - for (; aL--;) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - - // Remove leading zeros. - for (; !a[0] && a.length > 1; a.splice(0, 1)); - } - - // x: dividend, y: divisor. - return function (x, y, dp, rm, base) { - var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, - yL, yz, - s = x.s == y.s ? 1 : -1, - xc = x.c, - yc = y.c; - - // Either NaN, Infinity or 0? - if (!xc || !xc[0] || !yc || !yc[0]) { - - return new BigNumber( - - // Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : - - // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. - xc && xc[0] == 0 || !yc ? s * 0 : s / 0 - ); - } - - q = new BigNumber(s); - qc = q.c = []; - e = x.e - y.e; - s = dp + e + 1; - - if (!base) { - base = BASE; - e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); - s = s / LOG_BASE | 0; - } - - // Result exponent may be one less then the current value of e. - // The coefficients of the BigNumbers from convertBase may have trailing zeros. - for (i = 0; yc[i] == (xc[i] || 0); i++); - - if (yc[i] > (xc[i] || 0)) e--; - - if (s < 0) { - qc.push(1); - more = true; - } else { - xL = xc.length; - yL = yc.length; - i = 0; - s += 2; - - // Normalise xc and yc so highest order digit of yc is >= base / 2. - - n = mathfloor(base / (yc[0] + 1)); - - // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1. - // if (n > 1 || n++ == 1 && yc[0] < base / 2) { - if (n > 1) { - yc = multiply(yc, n, base); - xc = multiply(xc, n, base); - yL = yc.length; - xL = xc.length; - } - - xi = yL; - rem = xc.slice(0, yL); - remL = rem.length; - - // Add zeros to make remainder as long as divisor. - for (; remL < yL; rem[remL++] = 0); - yz = yc.slice(); - yz = [0].concat(yz); - yc0 = yc[0]; - if (yc[1] >= base / 2) yc0++; - // Not necessary, but to prevent trial digit n > base, when using base 3. - // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15; - - do { - n = 0; - - // Compare divisor and remainder. - cmp = compare(yc, rem, yL, remL); - - // If divisor < remainder. - if (cmp < 0) { - - // Calculate trial digit, n. - - rem0 = rem[0]; - if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); - - // n is how many times the divisor goes into the current remainder. - n = mathfloor(rem0 / yc0); - - // Algorithm: - // product = divisor multiplied by trial digit (n). - // Compare product and remainder. - // If product is greater than remainder: - // Subtract divisor from product, decrement trial digit. - // Subtract product from remainder. - // If product was less than remainder at the last compare: - // Compare new remainder and divisor. - // If remainder is greater than divisor: - // Subtract divisor from remainder, increment trial digit. - - if (n > 1) { - - // n may be > base only when base is 3. - if (n >= base) n = base - 1; - - // product = divisor * trial digit. - prod = multiply(yc, n, base); - prodL = prod.length; - remL = rem.length; - - // Compare product and remainder. - // If product > remainder then trial digit n too high. - // n is 1 too high about 5% of the time, and is not known to have - // ever been more than 1 too high. - while (compare(prod, rem, prodL, remL) == 1) { - n--; - - // Subtract divisor from product. - subtract(prod, yL < prodL ? yz : yc, prodL, base); - prodL = prod.length; - cmp = 1; - } - } else { - - // n is 0 or 1, cmp is -1. - // If n is 0, there is no need to compare yc and rem again below, - // so change cmp to 1 to avoid it. - // If n is 1, leave cmp as -1, so yc and rem are compared again. - if (n == 0) { - - // divisor < remainder, so n must be at least 1. - cmp = n = 1; - } - - // product = divisor - prod = yc.slice(); - prodL = prod.length; - } - - if (prodL < remL) prod = [0].concat(prod); - - // Subtract product from remainder. - subtract(rem, prod, remL, base); - remL = rem.length; - - // If product was < remainder. - if (cmp == -1) { - - // Compare divisor and new remainder. - // If divisor < new remainder, subtract divisor from remainder. - // Trial digit n too low. - // n is 1 too low about 5% of the time, and very rarely 2 too low. - while (compare(yc, rem, yL, remL) < 1) { - n++; - - // Subtract divisor from remainder. - subtract(rem, yL < remL ? yz : yc, remL, base); - remL = rem.length; - } - } - } else if (cmp === 0) { - n++; - rem = [0]; - } // else cmp === 1 and n will be 0 - - // Add the next digit, n, to the result array. - qc[i++] = n; - - // Update the remainder. - if (rem[0]) { - rem[remL++] = xc[xi] || 0; - } else { - rem = [xc[xi]]; - remL = 1; - } - } while ((xi++ < xL || rem[0] != null) && s--); - - more = rem[0] != null; - - // Leading zero? - if (!qc[0]) qc.splice(0, 1); - } - - if (base == BASE) { - - // To calculate q.e, first get the number of digits of qc[0]. - for (i = 1, s = qc[0]; s >= 10; s /= 10, i++); - - round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); - - // Caller is convertBase. - } else { - q.e = e; - q.r = +more; - } - - return q; - }; - })(); - - - /* - * Return a string representing the value of BigNumber n in fixed-point or exponential - * notation rounded to the specified decimal places or significant digits. - * - * n: a BigNumber. - * i: the index of the last digit required (i.e. the digit that may be rounded up). - * rm: the rounding mode. - * id: 1 (toExponential) or 2 (toPrecision). - */ - function format(n, i, rm, id) { - var c0, e, ne, len, str; - - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - if (!n.c) return n.toString(); - - c0 = n.c[0]; - ne = n.e; - - if (i == null) { - str = coeffToString(n.c); - str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) - ? toExponential(str, ne) - : toFixedPoint(str, ne, '0'); - } else { - n = round(new BigNumber(n), i, rm); - - // n.e may have changed if the value was rounded up. - e = n.e; - - str = coeffToString(n.c); - len = str.length; - - // toPrecision returns exponential notation if the number of significant digits - // specified is less than the number of digits necessary to represent the integer - // part of the value in fixed-point notation. - - // Exponential notation. - if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { - - // Append zeros? - for (; len < i; str += '0', len++); - str = toExponential(str, e); - - // Fixed-point notation. - } else { - i -= ne; - str = toFixedPoint(str, e, '0'); - - // Append zeros? - if (e + 1 > len) { - if (--i > 0) for (str += '.'; i--; str += '0'); - } else { - i += e - len; - if (i > 0) { - if (e + 1 == len) str += '.'; - for (; i--; str += '0'); - } - } - } - } - - return n.s < 0 && c0 ? '-' + str : str; - } - - - // Handle BigNumber.max and BigNumber.min. - function maxOrMin(args, method) { - var n, - i = 1, - m = new BigNumber(args[0]); - - for (; i < args.length; i++) { - n = new BigNumber(args[i]); - - // If any number is NaN, return NaN. - if (!n.s) { - m = n; - break; - } else if (method.call(m, n)) { - m = n; - } - } - - return m; - } - - - /* - * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. - * Called by minus, plus and times. - */ - function normalise(n, c, e) { - var i = 1, - j = c.length; - - // Remove trailing zeros. - for (; !c[--j]; c.pop()); - - // Calculate the base 10 exponent. First get the number of digits of c[0]. - for (j = c[0]; j >= 10; j /= 10, i++); - - // Overflow? - if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { - - // Infinity. - n.c = n.e = null; - - // Underflow? - } else if (e < MIN_EXP) { - - // Zero. - n.c = [n.e = 0]; - } else { - n.e = e; - n.c = c; - } - - return n; - } - - - // Handle values that fail the validity test in BigNumber. - parseNumeric = (function () { - var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, - dotAfter = /^([^.]+)\.$/, - dotBefore = /^\.([^.]+)$/, - isInfinityOrNaN = /^-?(Infinity|NaN)$/, - whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; - - return function (x, str, isNum, b) { - var base, - s = isNum ? str : str.replace(whitespaceOrPlus, ''); - - // No exception on ±Infinity or NaN. - if (isInfinityOrNaN.test(s)) { - x.s = isNaN(s) ? null : s < 0 ? -1 : 1; - } else { - if (!isNum) { - - // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i - s = s.replace(basePrefix, function (m, p1, p2) { - base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8; - return !b || b == base ? p1 : m; - }); - - if (b) { - base = b; - - // E.g. '1.' to '1', '.1' to '0.1' - s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1'); - } - - if (str != s) return new BigNumber(s, base); - } - - // '[BigNumber Error] Not a number: {n}' - // '[BigNumber Error] Not a base {b} number: {n}' - if (BigNumber.DEBUG) { - throw Error - (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str); - } - - // NaN - x.s = null; - } - - x.c = x.e = null; - } - })(); - - - /* - * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. - * If r is truthy, it is known that there are more digits after the rounding digit. - */ - function round(x, sd, rm, r) { - var d, i, j, k, n, ni, rd, - xc = x.c, - pows10 = POWS_TEN; - - // if x is not Infinity or NaN... - if (xc) { - - // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. - // n is a base 1e14 number, the value of the element of array x.c containing rd. - // ni is the index of n within x.c. - // d is the number of digits of n. - // i is the index of rd within n including leading zeros. - // j is the actual index of rd within n (if < 0, rd is a leading zero). - out: { - - // Get the number of digits of the first element of xc. - for (d = 1, k = xc[0]; k >= 10; k /= 10, d++); - i = sd - d; - - // If the rounding digit is in the first element of xc... - if (i < 0) { - i += LOG_BASE; - j = sd; - n = xc[ni = 0]; - - // Get the rounding digit at index j of n. - rd = n / pows10[d - j - 1] % 10 | 0; - } else { - ni = mathceil((i + 1) / LOG_BASE); - - if (ni >= xc.length) { - - if (r) { - - // Needed by sqrt. - for (; xc.length <= ni; xc.push(0)); - n = rd = 0; - d = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - n = k = xc[ni]; - - // Get the number of digits of n. - for (d = 1; k >= 10; k /= 10, d++); - - // Get the index of rd within n. - i %= LOG_BASE; - - // Get the index of rd within n, adjusted for leading zeros. - // The number of leading zeros of n is given by LOG_BASE - d. - j = i - LOG_BASE + d; - - // Get the rounding digit at index j of n. - rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0; - } - } - - r = r || sd < 0 || - - // Are there any non-zero digits after the rounding digit? - // The expression n % pows10[d - j - 1] returns all digits of n to the right - // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. - xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); - - r = rm < 4 - ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && - - // Check whether the digit to the left of the rounding digit is odd. - ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 || - rm == (x.s < 0 ? 8 : 7)); - - if (sd < 1 || !xc[0]) { - xc.length = 0; - - if (r) { - - // Convert sd to decimal places. - sd -= x.e + 1; - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; - x.e = -sd || 0; - } else { - - // Zero. - xc[0] = x.e = 0; - } - - return x; - } - - // Remove excess digits. - if (i == 0) { - xc.length = ni; - k = 1; - ni--; - } else { - xc.length = ni + 1; - k = pows10[LOG_BASE - i]; - - // E.g. 56700 becomes 56000 if 7 is the rounding digit. - // j > 0 means i > number of leading zeros of n. - xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; - } - - // Round up? - if (r) { - - for (; ;) { - - // If the digit to be rounded up is in the first element of xc... - if (ni == 0) { - - // i will be the length of xc[0] before k is added. - for (i = 1, j = xc[0]; j >= 10; j /= 10, i++); - j = xc[0] += k; - for (k = 1; j >= 10; j /= 10, k++); - - // if i != k the length has increased. - if (i != k) { - x.e++; - if (xc[0] == BASE) xc[0] = 1; - } - - break; - } else { - xc[ni] += k; - if (xc[ni] != BASE) break; - xc[ni--] = 0; - k = 1; - } - } - } - - // Remove trailing zeros. - for (i = xc.length; xc[--i] === 0; xc.pop()); - } - - // Overflow? Infinity. - if (x.e > MAX_EXP) { - x.c = x.e = null; - - // Underflow? Zero. - } else if (x.e < MIN_EXP) { - x.c = [x.e = 0]; - } - } - - return x; - } - - - function valueOf(n) { - var str, - e = n.e; - - if (e === null) return n.toString(); - - str = coeffToString(n.c); - - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential(str, e) - : toFixedPoint(str, e, '0'); - - return n.s < 0 ? '-' + str : str; - } - - - // PROTOTYPE/INSTANCE METHODS - - - /* - * Return a new BigNumber whose value is the absolute value of this BigNumber. - */ - P.absoluteValue = P.abs = function () { - var x = new BigNumber(this); - if (x.s < 0) x.s = 1; - return x; - }; - - - /* - * Return - * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), - * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), - * 0 if they have the same value, - * or null if the value of either is NaN. - */ - P.comparedTo = function (y, b) { - return compare(this, new BigNumber(y, b)); - }; - - - /* - * If dp is undefined or null or true or false, return the number of decimal places of the - * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. - * - * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this - * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or - * ROUNDING_MODE if rm is omitted. - * - * [dp] {number} Decimal places: integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.decimalPlaces = P.dp = function (dp, rm) { - var c, n, v, - x = this; - - if (dp != null) { - intCheck(dp, 0, MAX); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - return round(new BigNumber(x), dp + x.e + 1, rm); - } - - if (!(c = x.c)) return null; - n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; - - // Subtract the number of trailing zeros of the last number. - if (v = c[v]) for (; v % 10 == 0; v /= 10, n--); - if (n < 0) n = 0; - - return n; - }; - - - /* - * n / 0 = I - * n / N = N - * n / I = 0 - * 0 / n = 0 - * 0 / 0 = N - * 0 / N = N - * 0 / I = 0 - * N / n = N - * N / 0 = N - * N / N = N - * N / I = N - * I / n = I - * I / 0 = I - * I / N = N - * I / I = N - * - * Return a new BigNumber whose value is the value of this BigNumber divided by the value of - * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.dividedBy = P.div = function (y, b) { - return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE); - }; - - - /* - * Return a new BigNumber whose value is the integer part of dividing the value of this - * BigNumber by the value of BigNumber(y, b). - */ - P.dividedToIntegerBy = P.idiv = function (y, b) { - return div(this, new BigNumber(y, b), 0, 1); - }; - - - /* - * Return a BigNumber whose value is the value of this BigNumber exponentiated by n. - * - * If m is present, return the result modulo m. - * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. - * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE. - * - * The modular power operation works efficiently when x, n, and m are integers, otherwise it - * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0. - * - * n {number|string|BigNumber} The exponent. An integer. - * [m] {number|string|BigNumber} The modulus. - * - * '[BigNumber Error] Exponent not an integer: {n}' - */ - P.exponentiatedBy = P.pow = function (n, m) { - var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, - x = this; - - n = new BigNumber(n); - - // Allow NaN and ±Infinity, but not other non-integers. - if (n.c && !n.isInteger()) { - throw Error - (bignumberError + 'Exponent not an integer: ' + valueOf(n)); - } - - if (m != null) m = new BigNumber(m); - - // Exponent of MAX_SAFE_INTEGER is 15. - nIsBig = n.e > 14; - - // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0. - if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { - - // The sign of the result of pow when x is negative depends on the evenness of n. - // If +n overflows to ±Infinity, the evenness of n would be not be known. - y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n))); - return m ? y.mod(m) : y; - } - - nIsNeg = n.s < 0; - - if (m) { - - // x % m returns NaN if abs(m) is zero, or m is NaN. - if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN); - - isModExp = !nIsNeg && x.isInteger() && m.isInteger(); - - if (isModExp) x = x.mod(m); - - // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15. - // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15. - } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 - // [1, 240000000] - ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 - // [80000000000000] [99999750000000] - : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { - - // If x is negative and n is odd, k = -0, else k = 0. - k = x.s < 0 && isOdd(n) ? -0 : 0; - - // If x >= 1, k = ±Infinity. - if (x.e > -1) k = 1 / k; - - // If n is negative return ±0, else return ±Infinity. - return new BigNumber(nIsNeg ? 1 / k : k); - - } else if (POW_PRECISION) { - - // Truncating each coefficient array to a length of k after each multiplication - // equates to truncating significant digits to POW_PRECISION + [28, 41], - // i.e. there will be a minimum of 28 guard digits retained. - k = mathceil(POW_PRECISION / LOG_BASE + 2); - } - - if (nIsBig) { - half = new BigNumber(0.5); - if (nIsNeg) n.s = 1; - nIsOdd = isOdd(n); - } else { - i = Math.abs(+valueOf(n)); - nIsOdd = i % 2; - } - - y = new BigNumber(ONE); - - // Performs 54 loop iterations for n of 9007199254740991. - for (; ;) { - - if (nIsOdd) { - y = y.times(x); - if (!y.c) break; - - if (k) { - if (y.c.length > k) y.c.length = k; - } else if (isModExp) { - y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m)); - } - } - - if (i) { - i = mathfloor(i / 2); - if (i === 0) break; - nIsOdd = i % 2; - } else { - n = n.times(half); - round(n, n.e + 1, 1); - - if (n.e > 14) { - nIsOdd = isOdd(n); - } else { - i = +valueOf(n); - if (i === 0) break; - nIsOdd = i % 2; - } - } - - x = x.times(x); - - if (k) { - if (x.c && x.c.length > k) x.c.length = k; - } else if (isModExp) { - x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m)); - } - } - - if (isModExp) return y; - if (nIsNeg) y = ONE.div(y); - - return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer - * using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}' - */ - P.integerValue = function (rm) { - var n = new BigNumber(this); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - return round(n, n.e + 1, rm); - }; - - - /* - * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), - * otherwise return false. - */ - P.isEqualTo = P.eq = function (y, b) { - return compare(this, new BigNumber(y, b)) === 0; - }; - - - /* - * Return true if the value of this BigNumber is a finite number, otherwise return false. - */ - P.isFinite = function () { - return !!this.c; - }; - - - /* - * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), - * otherwise return false. - */ - P.isGreaterThan = P.gt = function (y, b) { - return compare(this, new BigNumber(y, b)) > 0; - }; - - - /* - * Return true if the value of this BigNumber is greater than or equal to the value of - * BigNumber(y, b), otherwise return false. - */ - P.isGreaterThanOrEqualTo = P.gte = function (y, b) { - return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0; - - }; - - - /* - * Return true if the value of this BigNumber is an integer, otherwise return false. - */ - P.isInteger = function () { - return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; - }; - - - /* - * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), - * otherwise return false. - */ - P.isLessThan = P.lt = function (y, b) { - return compare(this, new BigNumber(y, b)) < 0; - }; - - - /* - * Return true if the value of this BigNumber is less than or equal to the value of - * BigNumber(y, b), otherwise return false. - */ - P.isLessThanOrEqualTo = P.lte = function (y, b) { - return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0; - }; - - - /* - * Return true if the value of this BigNumber is NaN, otherwise return false. - */ - P.isNaN = function () { - return !this.s; - }; - - - /* - * Return true if the value of this BigNumber is negative, otherwise return false. - */ - P.isNegative = function () { - return this.s < 0; - }; - - - /* - * Return true if the value of this BigNumber is positive, otherwise return false. - */ - P.isPositive = function () { - return this.s > 0; - }; - - - /* - * Return true if the value of this BigNumber is 0 or -0, otherwise return false. - */ - P.isZero = function () { - return !!this.c && this.c[0] == 0; - }; - - - /* - * n - 0 = n - * n - N = N - * n - I = -I - * 0 - n = -n - * 0 - 0 = 0 - * 0 - N = N - * 0 - I = -I - * N - n = N - * N - 0 = N - * N - N = N - * N - I = N - * I - n = I - * I - 0 = I - * I - N = N - * I - I = N - * - * Return a new BigNumber whose value is the value of this BigNumber minus the value of - * BigNumber(y, b). - */ - P.minus = function (y, b) { - var i, j, t, xLTy, - x = this, - a = x.s; - - y = new BigNumber(y, b); - b = y.s; - - // Either NaN? - if (!a || !b) return new BigNumber(NaN); - - // Signs differ? - if (a != b) { - y.s = -b; - return x.plus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if (!xe || !ye) { - - // Either Infinity? - if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); - - // Either zero? - if (!xc[0] || !yc[0]) { - - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : - - // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity - ROUNDING_MODE == 3 ? -0 : 0); - } - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Determine which is the bigger number. - if (a = xe - ye) { - - if (xLTy = a < 0) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - - t.reverse(); - - // Prepend zeros to equalise exponents. - for (b = a; b--; t.push(0)); - t.reverse(); - } else { - - // Exponents equal. Check digit by digit. - j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; - - for (a = b = 0; b < j; b++) { - - if (xc[b] != yc[b]) { - xLTy = xc[b] < yc[b]; - break; - } - } - } - - // x < y? Point xc to the array of the bigger number. - if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s; - - b = (j = yc.length) - (i = xc.length); - - // Append zeros to xc if shorter. - // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. - if (b > 0) for (; b--; xc[i++] = 0); - b = BASE - 1; - - // Subtract yc from xc. - for (; j > a;) { - - if (xc[--j] < yc[j]) { - for (i = j; i && !xc[--i]; xc[i] = b); - --xc[i]; - xc[j] += BASE; - } - - xc[j] -= yc[j]; - } - - // Remove leading zeros and adjust exponent accordingly. - for (; xc[0] == 0; xc.splice(0, 1), --ye); - - // Zero? - if (!xc[0]) { - - // Following IEEE 754 (2008) 6.3, - // n - n = +0 but n - n = -0 when rounding towards -Infinity. - y.s = ROUNDING_MODE == 3 ? -1 : 1; - y.c = [y.e = 0]; - return y; - } - - // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity - // for finite x and y. - return normalise(y, xc, ye); - }; - - - /* - * n % 0 = N - * n % N = N - * n % I = n - * 0 % n = 0 - * -0 % n = -0 - * 0 % 0 = N - * 0 % N = N - * 0 % I = 0 - * N % n = N - * N % 0 = N - * N % N = N - * N % I = N - * I % n = N - * I % 0 = N - * I % N = N - * I % I = N - * - * Return a new BigNumber whose value is the value of this BigNumber modulo the value of - * BigNumber(y, b). The result depends on the value of MODULO_MODE. - */ - P.modulo = P.mod = function (y, b) { - var q, s, - x = this; - - y = new BigNumber(y, b); - - // Return NaN if x is Infinity or NaN, or y is NaN or zero. - if (!x.c || !y.s || y.c && !y.c[0]) { - return new BigNumber(NaN); - - // Return x if y is Infinity or x is zero. - } else if (!y.c || x.c && !x.c[0]) { - return new BigNumber(x); - } - - if (MODULO_MODE == 9) { - - // Euclidian division: q = sign(y) * floor(x / abs(y)) - // r = x - qy where 0 <= r < abs(y) - s = y.s; - y.s = 1; - q = div(x, y, 0, 3); - y.s = s; - q.s *= s; - } else { - q = div(x, y, 0, MODULO_MODE); - } - - y = x.minus(q.times(y)); - - // To match JavaScript %, ensure sign of zero is sign of dividend. - if (!y.c[0] && MODULO_MODE == 1) y.s = x.s; - - return y; - }; - - - /* - * n * 0 = 0 - * n * N = N - * n * I = I - * 0 * n = 0 - * 0 * 0 = 0 - * 0 * N = N - * 0 * I = N - * N * n = N - * N * 0 = N - * N * N = N - * N * I = N - * I * n = I - * I * 0 = N - * I * N = N - * I * I = I - * - * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value - * of BigNumber(y, b). - */ - P.multipliedBy = P.times = function (y, b) { - var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, - base, sqrtBase, - x = this, - xc = x.c, - yc = (y = new BigNumber(y, b)).c; - - // Either NaN, ±Infinity or ±0? - if (!xc || !yc || !xc[0] || !yc[0]) { - - // Return NaN if either is NaN, or one is 0 and the other is Infinity. - if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { - y.c = y.e = y.s = null; - } else { - y.s *= x.s; - - // Return ±Infinity if either is ±Infinity. - if (!xc || !yc) { - y.c = y.e = null; - - // Return ±0 if either is ±0. - } else { - y.c = [0]; - y.e = 0; - } - } - - return y; - } - - e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); - y.s *= x.s; - xcL = xc.length; - ycL = yc.length; - - // Ensure xc points to longer array and xcL to its length. - if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; - - // Initialise the result array with zeros. - for (i = xcL + ycL, zc = []; i--; zc.push(0)); - - base = BASE; - sqrtBase = SQRT_BASE; - - for (i = ycL; --i >= 0;) { - c = 0; - ylo = yc[i] % sqrtBase; - yhi = yc[i] / sqrtBase | 0; - - for (k = xcL, j = i + k; j > i;) { - xlo = xc[--k] % sqrtBase; - xhi = xc[k] / sqrtBase | 0; - m = yhi * xlo + xhi * ylo; - xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c; - c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; - zc[j--] = xlo % base; - } - - zc[j] = c; - } - - if (c) { - ++e; - } else { - zc.splice(0, 1); - } - - return normalise(y, zc, e); - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber negated, - * i.e. multiplied by -1. - */ - P.negated = function () { - var x = new BigNumber(this); - x.s = -x.s || null; - return x; - }; - - - /* - * n + 0 = n - * n + N = N - * n + I = I - * 0 + n = n - * 0 + 0 = 0 - * 0 + N = N - * 0 + I = I - * N + n = N - * N + 0 = N - * N + N = N - * N + I = N - * I + n = I - * I + 0 = I - * I + N = N - * I + I = I - * - * Return a new BigNumber whose value is the value of this BigNumber plus the value of - * BigNumber(y, b). - */ - P.plus = function (y, b) { - var t, - x = this, - a = x.s; - - y = new BigNumber(y, b); - b = y.s; - - // Either NaN? - if (!a || !b) return new BigNumber(NaN); - - // Signs differ? - if (a != b) { - y.s = -b; - return x.minus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if (!xe || !ye) { - - // Return ±Infinity if either ±Infinity. - if (!xc || !yc) return new BigNumber(a / 0); - - // Either zero? - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0); - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. - if (a = xe - ye) { - if (a > 0) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - - t.reverse(); - for (; a--; t.push(0)); - t.reverse(); - } - - a = xc.length; - b = yc.length; - - // Point xc to the longer array, and b to the shorter length. - if (a - b < 0) t = yc, yc = xc, xc = t, b = a; - - // Only start adding at yc.length - 1 as the further digits of xc can be ignored. - for (a = 0; b;) { - a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; - xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; - } - - if (a) { - xc = [a].concat(xc); - ++ye; - } - - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - // ye = MAX_EXP + 1 possible - return normalise(y, xc, ye); - }; - - - /* - * If sd is undefined or null or true or false, return the number of significant digits of - * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. - * If sd is true include integer-part trailing zeros in the count. - * - * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this - * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or - * ROUNDING_MODE if rm is omitted. - * - * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive. - * boolean: whether to count integer-part trailing zeros: true or false. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' - */ - P.precision = P.sd = function (sd, rm) { - var c, n, v, - x = this; - - if (sd != null && sd !== !!sd) { - intCheck(sd, 1, MAX); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - return round(new BigNumber(x), sd, rm); - } - - if (!(c = x.c)) return null; - v = c.length - 1; - n = v * LOG_BASE + 1; - - if (v = c[v]) { - - // Subtract the number of trailing zeros of the last element. - for (; v % 10 == 0; v /= 10, n--); - - // Add the number of digits of the first element. - for (v = c[0]; v >= 10; v /= 10, n++); - } - - if (sd && x.e + 1 > n) n = x.e + 1; - - return n; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber shifted by k places - * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. - * - * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}' - */ - P.shiftedBy = function (k) { - intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); - return this.times('1e' + k); - }; - - - /* - * sqrt(-n) = N - * sqrt(N) = N - * sqrt(-I) = N - * sqrt(I) = I - * sqrt(0) = 0 - * sqrt(-0) = -0 - * - * Return a new BigNumber whose value is the square root of the value of this BigNumber, - * rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.squareRoot = P.sqrt = function () { - var m, n, r, rep, t, - x = this, - c = x.c, - s = x.s, - e = x.e, - dp = DECIMAL_PLACES + 4, - half = new BigNumber('0.5'); - - // Negative/NaN/Infinity/zero? - if (s !== 1 || !c || !c[0]) { - return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); - } - - // Initial estimate. - s = Math.sqrt(+valueOf(x)); - - // Math.sqrt underflow/overflow? - // Pass x to Math.sqrt as integer, then adjust the exponent of the result. - if (s == 0 || s == 1 / 0) { - n = coeffToString(c); - if ((n.length + e) % 2 == 0) n += '0'; - s = Math.sqrt(+n); - e = bitFloor((e + 1) / 2) - (e < 0 || e % 2); - - if (s == 1 / 0) { - n = '5e' + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf('e') + 1) + e; - } - - r = new BigNumber(n); - } else { - r = new BigNumber(s + ''); - } - - // Check for zero. - // r could be zero if MIN_EXP is changed after the this value was created. - // This would cause a division by zero (x/t) and hence Infinity below, which would cause - // coeffToString to throw. - if (r.c[0]) { - e = r.e; - s = e + dp; - if (s < 3) s = 0; - - // Newton-Raphson iteration. - for (; ;) { - t = r; - r = half.times(t.plus(div(x, t, dp, 1))); - - if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { - - // The exponent of r may here be one less than the final result exponent, - // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits - // are indexed correctly. - if (r.e < e) --s; - n = n.slice(s - 3, s + 1); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits - // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the - // iteration. - if (n == '9999' || !rep && n == '4999') { - - // On the first iteration only, check to see if rounding up gives the - // exact result as the nines may infinitely repeat. - if (!rep) { - round(t, t.e + DECIMAL_PLACES + 2, 0); - - if (t.times(t).eq(x)) { - r = t; - break; - } - } - - dp += 4; - s += 4; - rep = 1; - } else { - - // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact - // result. If not, then there are further digits and m will be truthy. - if (!+n || !+n.slice(1) && n.charAt(0) == '5') { - - // Truncate to the first rounding digit. - round(r, r.e + DECIMAL_PLACES + 2, 1); - m = !r.times(r).eq(x); - } - - break; - } - } - } - } - - return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); - }; - - - /* - * Return a string representing the value of this BigNumber in exponential notation and - * rounded using ROUNDING_MODE to dp fixed decimal places. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.toExponential = function (dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp++; - } - return format(this, dp, rm, 1); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounding - * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', - * but e.g. (-0.00001).toFixed(0) is '-0'. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.toFixed = function (dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp = dp + this.e + 1; - } - return format(this, dp, rm); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounded - * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties - * of the format or FORMAT object (see BigNumber.set). - * - * The formatting object may contain some or all of the properties shown below. - * - * FORMAT = { - * prefix: '', - * groupSize: 3, - * secondaryGroupSize: 0, - * groupSeparator: ',', - * decimalSeparator: '.', - * fractionGroupSize: 0, - * fractionGroupSeparator: '\xA0', // non-breaking space - * suffix: '' - * }; - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * [format] {object} Formatting options. See FORMAT pbject above. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - * '[BigNumber Error] Argument not an object: {format}' - */ - P.toFormat = function (dp, rm, format) { - var str, - x = this; - - if (format == null) { - if (dp != null && rm && typeof rm == 'object') { - format = rm; - rm = null; - } else if (dp && typeof dp == 'object') { - format = dp; - dp = rm = null; - } else { - format = FORMAT; - } - } else if (typeof format != 'object') { - throw Error - (bignumberError + 'Argument not an object: ' + format); - } - - str = x.toFixed(dp, rm); - - if (x.c) { - var i, - arr = str.split('.'), - g1 = +format.groupSize, - g2 = +format.secondaryGroupSize, - groupSeparator = format.groupSeparator || '', - intPart = arr[0], - fractionPart = arr[1], - isNeg = x.s < 0, - intDigits = isNeg ? intPart.slice(1) : intPart, - len = intDigits.length; - - if (g2) i = g1, g1 = g2, g2 = i, len -= i; - - if (g1 > 0 && len > 0) { - i = len % g1 || g1; - intPart = intDigits.substr(0, i); - for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1); - if (g2 > 0) intPart += groupSeparator + intDigits.slice(i); - if (isNeg) intPart = '-' + intPart; - } - - str = fractionPart - ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) - ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'), - '$&' + (format.fractionGroupSeparator || '')) - : fractionPart) - : intPart; - } - - return (format.prefix || '') + str + (format.suffix || ''); - }; - - - /* - * Return an array of two BigNumbers representing the value of this BigNumber as a simple - * fraction with an integer numerator and an integer denominator. - * The denominator will be a positive non-zero value less than or equal to the specified - * maximum denominator. If a maximum denominator is not specified, the denominator will be - * the lowest value necessary to represent the number exactly. - * - * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator. - * - * '[BigNumber Error] Argument {not an integer|out of range} : {md}' - */ - P.toFraction = function (md) { - var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, - x = this, - xc = x.c; - - if (md != null) { - n = new BigNumber(md); - - // Throw if md is less than one or is not an integer, unless it is Infinity. - if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { - throw Error - (bignumberError + 'Argument ' + - (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n)); - } - } - - if (!xc) return new BigNumber(x); - - d = new BigNumber(ONE); - n1 = d0 = new BigNumber(ONE); - d1 = n0 = new BigNumber(ONE); - s = coeffToString(xc); - - // Determine initial denominator. - // d is a power of 10 and the minimum max denominator that specifies the value exactly. - e = d.e = s.length - x.e - 1; - d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; - md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n; - - exp = MAX_EXP; - MAX_EXP = 1 / 0; - n = new BigNumber(s); - - // n0 = d1 = 0 - n0.c[0] = 0; - - for (; ;) { - q = div(n, d, 0, 1); - d2 = d0.plus(q.times(d1)); - if (d2.comparedTo(md) == 1) break; - d0 = d1; - d1 = d2; - n1 = n0.plus(q.times(d2 = n1)); - n0 = d2; - d = n.minus(q.times(d2 = d)); - n = d2; - } - - d2 = div(md.minus(d0), d1, 0, 1); - n0 = n0.plus(d2.times(n1)); - d0 = d0.plus(d2.times(d1)); - n0.s = n1.s = x.s; - e = e * 2; - - // Determine which fraction is closer to x, n0/d0 or n1/d1 - r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( - div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; - - MAX_EXP = exp; - - return r; - }; - - - /* - * Return the value of this BigNumber converted to a number primitive. - */ - P.toNumber = function () { - return +valueOf(this); - }; - - - /* - * Return a string representing the value of this BigNumber rounded to sd significant digits - * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits - * necessary to represent the integer part of the value in fixed-point notation, then use - * exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' - */ - P.toPrecision = function (sd, rm) { - if (sd != null) intCheck(sd, 1, MAX); - return format(this, sd, rm, 2); - }; - - - /* - * Return a string representing the value of this BigNumber in base b, or base 10 if b is - * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and - * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent - * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than - * TO_EXP_NEG, return exponential notation. - * - * [b] {number} Integer, 2 to ALPHABET.length inclusive. - * - * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' - */ - P.toString = function (b) { - var str, - n = this, - s = n.s, - e = n.e; - - // Infinity or NaN? - if (e === null) { - if (s) { - str = 'Infinity'; - if (s < 0) str = '-' + str; - } else { - str = 'NaN'; - } - } else { - if (b == null) { - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential(coeffToString(n.c), e) - : toFixedPoint(coeffToString(n.c), e, '0'); - } else if (b === 10) { - n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); - str = toFixedPoint(coeffToString(n.c), n.e, '0'); - } else { - intCheck(b, 2, ALPHABET.length, 'Base'); - str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true); - } - - if (s < 0 && n.c[0]) str = '-' + str; - } - - return str; - }; - - - /* - * Return as toString, but do not accept a base argument, and include the minus sign for - * negative zero. - */ - P.valueOf = P.toJSON = function () { - return valueOf(this); - }; - - - P._isBigNumber = true; - - P[Symbol.toStringTag] = 'BigNumber'; - - // Node.js v10.12.0+ - P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf; - - if (configObject != null) BigNumber.set(configObject); - - return BigNumber; -} - - -// PRIVATE HELPER FUNCTIONS - -// These functions don't need access to variables, -// e.g. DECIMAL_PLACES, in the scope of the `clone` function above. - - -function bitFloor(n) { - var i = n | 0; - return n > 0 || n === i ? i : i - 1; -} - - -// Return a coefficient array as a string of base 10 digits. -function coeffToString(a) { - var s, z, - i = 1, - j = a.length, - r = a[0] + ''; - - for (; i < j;) { - s = a[i++] + ''; - z = LOG_BASE - s.length; - for (; z--; s = '0' + s); - r += s; - } - - // Determine trailing zeros. - for (j = r.length; r.charCodeAt(--j) === 48;); - - return r.slice(0, j + 1 || 1); -} - - -// Compare the value of BigNumbers x and y. -function compare(x, y) { - var a, b, - xc = x.c, - yc = y.c, - i = x.s, - j = y.s, - k = x.e, - l = y.e; - - // Either NaN? - if (!i || !j) return null; - - a = xc && !xc[0]; - b = yc && !yc[0]; - - // Either zero? - if (a || b) return a ? b ? 0 : -j : i; - - // Signs differ? - if (i != j) return i; - - a = i < 0; - b = k == l; - - // Either Infinity? - if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1; - - // Compare exponents. - if (!b) return k > l ^ a ? 1 : -1; - - j = (k = xc.length) < (l = yc.length) ? k : l; - - // Compare digit by digit. - for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1; - - // Compare lengths. - return k == l ? 0 : k > l ^ a ? 1 : -1; -} - - -/* - * Check that n is a primitive number, an integer, and in range, otherwise throw. - */ -function intCheck(n, min, max, name) { - if (n < min || n > max || n !== mathfloor(n)) { - throw Error - (bignumberError + (name || 'Argument') + (typeof n == 'number' - ? n < min || n > max ? ' out of range: ' : ' not an integer: ' - : ' not a primitive number: ') + String(n)); - } -} - - -// Assumes finite n. -function isOdd(n) { - var k = n.c.length - 1; - return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; -} - - -function toExponential(str, e) { - return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) + - (e < 0 ? 'e' : 'e+') + e; -} - - -function toFixedPoint(str, e, z) { - var len, zs; - - // Negative exponent? - if (e < 0) { - - // Prepend zeros. - for (zs = z + '.'; ++e; zs += z); - str = zs + str; - - // Positive exponent - } else { - len = str.length; - - // Append zeros. - if (++e > len) { - for (zs = z, e -= len; --e; zs += z); - str += zs; - } else if (e < len) { - str = str.slice(0, e) + '.' + str.slice(e); - } - } - - return str; -} - - -// EXPORT - - -export var BigNumber = clone(); - -export default BigNumber; diff --git a/node_modules/bignumber.js/doc/API.html b/node_modules/bignumber.js/doc/API.html deleted file mode 100644 index 845826ed..00000000 --- a/node_modules/bignumber.js/doc/API.html +++ /dev/null @@ -1,2237 +0,0 @@ - - - - - - -bignumber.js API - - - - - - -
- -

bignumber.js

- -

A JavaScript library for arbitrary-precision arithmetic.

-

Hosted on GitHub.

- -

API

- -

- See the README on GitHub for a - quick-start introduction. -

-

- In all examples below, var and semicolons are not shown, and if a commented-out - value is in quotes it means toString has been called on the preceding expression. -

- - -

CONSTRUCTOR

- - -
- BigNumberBigNumber(n [, base]) ⇒ BigNumber -
-

- n: number|string|BigNumber
- base: number: integer, 2 to 36 inclusive. (See - ALPHABET to extend this range). -

-

- Returns a new instance of a BigNumber object with value n, where n - is a numeric value in the specified base, or base 10 if - base is omitted or is null or undefined. -

-
-x = new BigNumber(123.4567)                // '123.4567'
-// 'new' is optional
-y = BigNumber(x)                           // '123.4567'
-

- If n is a base 10 value it can be in normal (fixed-point) or - exponential notation. Values in other bases must be in normal notation. Values in any base can - have fraction digits, i.e. digits after the decimal point. -

-
-new BigNumber(43210)                       // '43210'
-new BigNumber('4.321e+4')                  // '43210'
-new BigNumber('-735.0918e-430')            // '-7.350918e-428'
-new BigNumber('123412421.234324', 5)       // '607236.557696'
-

- Signed 0, signed Infinity and NaN are supported. -

-
-new BigNumber('-Infinity')                 // '-Infinity'
-new BigNumber(NaN)                         // 'NaN'
-new BigNumber(-0)                          // '0'
-new BigNumber('.5')                        // '0.5'
-new BigNumber('+2')                        // '2'
-

- String values in hexadecimal literal form, e.g. '0xff', are valid, as are - string values with the octal and binary prefixs '0o' and '0b'. - String values in octal literal form without the prefix will be interpreted as - decimals, e.g. '011' is interpreted as 11, not 9. -

-
-new BigNumber(-10110100.1, 2)              // '-180.5'
-new BigNumber('-0b10110100.1')             // '-180.5'
-new BigNumber('ff.8', 16)                  // '255.5'
-new BigNumber('0xff.8')                    // '255.5'
-

- If a base is specified, n is rounded according to the current - DECIMAL_PLACES and - ROUNDING_MODE settings. This includes base - 10 so don't include a base parameter for decimal values unless - this behaviour is wanted. -

-
BigNumber.config({ DECIMAL_PLACES: 5 })
-new BigNumber(1.23456789)                  // '1.23456789'
-new BigNumber(1.23456789, 10)              // '1.23457'
-

An error is thrown if base is invalid. See Errors.

-

- There is no limit to the number of digits of a value of type string (other than - that of JavaScript's maximum array size). See RANGE to set - the maximum and minimum possible exponent value of a BigNumber. -

-
-new BigNumber('5032485723458348569331745.33434346346912144534543')
-new BigNumber('4.321e10000000')
-

BigNumber NaN is returned if n is invalid - (unless BigNumber.DEBUG is true, see below).

-
-new BigNumber('.1*')                       // 'NaN'
-new BigNumber('blurgh')                    // 'NaN'
-new BigNumber(9, 2)                        // 'NaN'
-

- To aid in debugging, if BigNumber.DEBUG is true then an error will - be thrown on an invalid n. An error will also be thrown if n is of - type number with more than 15 significant digits, as calling - toString or valueOf on - these numbers may not result in the intended value. -

-
-console.log(823456789123456.3)            //  823456789123456.2
-new BigNumber(823456789123456.3)          // '823456789123456.2'
-BigNumber.DEBUG = true
-// '[BigNumber Error] Number primitive has more than 15 significant digits'
-new BigNumber(823456789123456.3)
-// '[BigNumber Error] Not a base 2 number'
-new BigNumber(9, 2)
-

- A BigNumber can also be created from an object literal. - Use isBigNumber to check that it is well-formed. -

-
new BigNumber({ s: 1, e: 2, c: [ 777, 12300000000000 ], _isBigNumber: true })    // '777.123'
- - - - -

Methods

-

The static methods of a BigNumber constructor.

- - - - -
clone - .clone([object]) ⇒ BigNumber constructor -
-

object: object

-

- Returns a new independent BigNumber constructor with configuration as described by - object (see config), or with the default - configuration if object is null or undefined. -

-

- Throws if object is not an object. See Errors. -

-
BigNumber.config({ DECIMAL_PLACES: 5 })
-BN = BigNumber.clone({ DECIMAL_PLACES: 9 })
-
-x = new BigNumber(1)
-y = new BN(1)
-
-x.div(3)                        // 0.33333
-y.div(3)                        // 0.333333333
-
-// BN = BigNumber.clone({ DECIMAL_PLACES: 9 }) is equivalent to:
-BN = BigNumber.clone()
-BN.config({ DECIMAL_PLACES: 9 })
- - - -
configset([object]) ⇒ object
-

- object: object: an object that contains some or all of the following - properties. -

-

Configures the settings for this particular BigNumber constructor.

- -
-
DECIMAL_PLACES
-
- number: integer, 0 to 1e+9 inclusive
- Default value: 20 -
-
- The maximum number of decimal places of the results of operations involving - division, i.e. division, square root and base conversion operations, and power - operations with negative exponents.
-
-
-
BigNumber.config({ DECIMAL_PLACES: 5 })
-BigNumber.set({ DECIMAL_PLACES: 5 })    // equivalent
-
- - - -
ROUNDING_MODE
-
- number: integer, 0 to 8 inclusive
- Default value: 4 (ROUND_HALF_UP) -
-
- The rounding mode used in the above operations and the default rounding mode of - decimalPlaces, - precision, - toExponential, - toFixed, - toFormat and - toPrecision. -
-
The modes are available as enumerated properties of the BigNumber constructor.
-
-
BigNumber.config({ ROUNDING_MODE: 0 })
-BigNumber.set({ ROUNDING_MODE: BigNumber.ROUND_UP })    // equivalent
-
- - - -
EXPONENTIAL_AT
-
- number: integer, magnitude 0 to 1e+9 inclusive, or -
- number[]: [ integer -1e+9 to 0 inclusive, integer - 0 to 1e+9 inclusive ]
- Default value: [-7, 20] -
-
- The exponent value(s) at which toString returns exponential notation. -
-
- If a single number is assigned, the value is the exponent magnitude.
- If an array of two numbers is assigned then the first number is the negative exponent - value at and beneath which exponential notation is used, and the second number is the - positive exponent value at and above which the same. -
-
- For example, to emulate JavaScript numbers in terms of the exponent values at which they - begin to use exponential notation, use [-7, 20]. -
-
-
BigNumber.config({ EXPONENTIAL_AT: 2 })
-new BigNumber(12.3)         // '12.3'        e is only 1
-new BigNumber(123)          // '1.23e+2'
-new BigNumber(0.123)        // '0.123'       e is only -1
-new BigNumber(0.0123)       // '1.23e-2'
-
-BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
-new BigNumber(123456789)    // '123456789'   e is only 8
-new BigNumber(0.000000123)  // '1.23e-7'
-
-// Almost never return exponential notation:
-BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
-
-// Always return exponential notation:
-BigNumber.config({ EXPONENTIAL_AT: 0 })
-
-
- Regardless of the value of EXPONENTIAL_AT, the toFixed method - will always return a value in normal notation and the toExponential method - will always return a value in exponential form. -
-
- Calling toString with a base argument, e.g. toString(10), will - also always return normal notation. -
- - - -
RANGE
-
- number: integer, magnitude 1 to 1e+9 inclusive, or -
- number[]: [ integer -1e+9 to -1 inclusive, integer - 1 to 1e+9 inclusive ]
- Default value: [-1e+9, 1e+9] -
-
- The exponent value(s) beyond which overflow to Infinity and underflow to - zero occurs. -
-
- If a single number is assigned, it is the maximum exponent magnitude: values wth a - positive exponent of greater magnitude become Infinity and those with a - negative exponent of greater magnitude become zero. -
- If an array of two numbers is assigned then the first number is the negative exponent - limit and the second number is the positive exponent limit. -
-
- For example, to emulate JavaScript numbers in terms of the exponent values at which they - become zero and Infinity, use [-324, 308]. -
-
-
BigNumber.config({ RANGE: 500 })
-BigNumber.config().RANGE     // [ -500, 500 ]
-new BigNumber('9.999e499')   // '9.999e+499'
-new BigNumber('1e500')       // 'Infinity'
-new BigNumber('1e-499')      // '1e-499'
-new BigNumber('1e-500')      // '0'
-
-BigNumber.config({ RANGE: [-3, 4] })
-new BigNumber(99999)         // '99999'      e is only 4
-new BigNumber(100000)        // 'Infinity'   e is 5
-new BigNumber(0.001)         // '0.01'       e is only -3
-new BigNumber(0.0001)        // '0'          e is -4
-
-
- The largest possible magnitude of a finite BigNumber is - 9.999...e+1000000000.
- The smallest possible magnitude of a non-zero BigNumber is 1e-1000000000. -
- - - -
CRYPTO
-
- boolean: true or false.
- Default value: false -
-
- The value that determines whether cryptographically-secure pseudo-random number - generation is used. -
-
- If CRYPTO is set to true then the - random method will generate random digits using - crypto.getRandomValues in browsers that support it, or - crypto.randomBytes if using Node.js. -
-
- If neither function is supported by the host environment then attempting to set - CRYPTO to true will fail and an exception will be thrown. -
-
- If CRYPTO is false then the source of randomness used will be - Math.random (which is assumed to generate at least 30 bits of - randomness). -
-
See random.
-
-
-// Node.js
-global.crypto = require('crypto')
-
-BigNumber.config({ CRYPTO: true })
-BigNumber.config().CRYPTO       // true
-BigNumber.random()              // 0.54340758610486147524
-
- - - -
MODULO_MODE
-
- number: integer, 0 to 9 inclusive
- Default value: 1 (ROUND_DOWN) -
-
The modulo mode used when calculating the modulus: a mod n.
-
- The quotient, q = a / n, is calculated according to the - ROUNDING_MODE that corresponds to the chosen - MODULO_MODE. -
-
The remainder, r, is calculated as: r = a - n * q.
-
- The modes that are most commonly used for the modulus/remainder operation are shown in - the following table. Although the other rounding modes can be used, they may not give - useful results. -
-
- - - - - - - - - - - - - - - - - - - - - - -
PropertyValueDescription
ROUND_UP0 - The remainder is positive if the dividend is negative, otherwise it is negative. -
ROUND_DOWN1 - The remainder has the same sign as the dividend.
- This uses 'truncating division' and matches the behaviour of JavaScript's - remainder operator %. -
ROUND_FLOOR3 - The remainder has the same sign as the divisor.
- This matches Python's % operator. -
ROUND_HALF_EVEN6The IEEE 754 remainder function.
EUCLID9 - The remainder is always positive. Euclidian division:
- q = sign(n) * floor(a / abs(n)) -
-
-
- The rounding/modulo modes are available as enumerated properties of the BigNumber - constructor. -
-
See modulo.
-
-
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
-BigNumber.config({ MODULO_MODE: 9 })          // equivalent
-
- - - -
POW_PRECISION
-
- number: integer, 0 to 1e+9 inclusive.
- Default value: 0 -
-
- The maximum precision, i.e. number of significant digits, of the result of the power - operation (unless a modulus is specified). -
-
If set to 0, the number of significant digits will not be limited.
-
See exponentiatedBy.
-
BigNumber.config({ POW_PRECISION: 100 })
- - - -
FORMAT
-
object
-
- The FORMAT object configures the format of the string returned by the - toFormat method. -
-
- The example below shows the properties of the FORMAT object that are - recognised, and their default values. -
-
- Unlike the other configuration properties, the values of the properties of the - FORMAT object will not be checked for validity. The existing - FORMAT object will simply be replaced by the object that is passed in. - The object can include any number of the properties shown below. -
-
See toFormat for examples of usage.
-
-
-BigNumber.config({
-  FORMAT: {
-    // string to prepend
-    prefix: '',
-    // decimal separator
-    decimalSeparator: '.',
-    // grouping separator of the integer part
-    groupSeparator: ',',
-    // primary grouping size of the integer part
-    groupSize: 3,
-    // secondary grouping size of the integer part
-    secondaryGroupSize: 0,
-    // grouping separator of the fraction part
-    fractionGroupSeparator: ' ',
-    // grouping size of the fraction part
-    fractionGroupSize: 0,
-    // string to append
-    suffix: ''
-  }
-});
-
- - - -
ALPHABET
-
- string
- Default value: '0123456789abcdefghijklmnopqrstuvwxyz' -
-
- The alphabet used for base conversion. The length of the alphabet corresponds to the - maximum value of the base argument that can be passed to the - BigNumber constructor or - toString. -
-
- There is no maximum length for the alphabet, but it must be at least 2 characters long, and - it must not contain whitespace or a repeated character, or the sign indicators - '+' and '-', or the decimal separator '.'. -
-
-
// duodecimal (base 12)
-BigNumber.config({ ALPHABET: '0123456789TE' })
-x = new BigNumber('T', 12)
-x.toString()                // '10'
-x.toString(12)              // 'T'
-
- - - -
-

-

Returns an object with the above properties and their current values.

-

- Throws if object is not an object, or if an invalid value is assigned to - one or more of the above properties. See Errors. -

-
-BigNumber.config({
-  DECIMAL_PLACES: 40,
-  ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
-  EXPONENTIAL_AT: [-10, 20],
-  RANGE: [-500, 500],
-  CRYPTO: true,
-  MODULO_MODE: BigNumber.ROUND_FLOOR,
-  POW_PRECISION: 80,
-  FORMAT: {
-    groupSize: 3,
-    groupSeparator: ' ',
-    decimalSeparator: ','
-  },
-  ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
-});
-
-obj = BigNumber.config();
-obj.DECIMAL_PLACES        // 40
-obj.RANGE                 // [-500, 500]
- - - -
- isBigNumber.isBigNumber(value) ⇒ boolean -
-

value: any

-

- Returns true if value is a BigNumber instance, otherwise returns - false. -

-
x = 42
-y = new BigNumber(x)
-
-BigNumber.isBigNumber(x)             // false
-y instanceof BigNumber               // true
-BigNumber.isBigNumber(y)             // true
-
-BN = BigNumber.clone();
-z = new BN(x)
-z instanceof BigNumber               // false
-BigNumber.isBigNumber(z)             // true
-

- If value is a BigNumber instance and BigNumber.DEBUG is true, - then this method will also check if value is well-formed, and throw if it is not. - See Errors. -

-

- The check can be useful if creating a BigNumber from an object literal. - See BigNumber. -

-
-x = new BigNumber(10)
-
-// Change x.c to an illegitimate value.
-x.c = NaN
-
-BigNumber.DEBUG = false
-
-// No error.
-BigNumber.isBigNumber(x)    // true
-
-BigNumber.DEBUG = true
-
-// Error.
-BigNumber.isBigNumber(x)    // '[BigNumber Error] Invalid BigNumber'
- - - -
maximum.max(n...) ⇒ BigNumber
-

- n: number|string|BigNumber
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the maximum of the arguments. -

-

The return value is always exact and unrounded.

-
x = new BigNumber('3257869345.0378653')
-BigNumber.maximum(4e9, x, '123456789.9')      // '4000000000'
-
-arr = [12, '13', new BigNumber(14)]
-BigNumber.max.apply(null, arr)                // '14'
- - - -
minimum.min(n...) ⇒ BigNumber
-

- n: number|string|BigNumber
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the minimum of the arguments. -

-

The return value is always exact and unrounded.

-
x = new BigNumber('3257869345.0378653')
-BigNumber.minimum(4e9, x, '123456789.9')      // '123456789.9'
-
-arr = [2, new BigNumber(-14), '-15.9999', -12]
-BigNumber.min.apply(null, arr)                // '-15.9999'
- - - -
- random.random([dp]) ⇒ BigNumber -
-

dp: number: integer, 0 to 1e+9 inclusive

-

- Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and - less than 1. -

-

- The return value will have dp decimal places (or less if trailing zeros are - produced).
- If dp is omitted then the number of decimal places will default to the current - DECIMAL_PLACES setting. -

-

- Depending on the value of this BigNumber constructor's - CRYPTO setting and the support for the - crypto object in the host environment, the random digits of the return value are - generated by either Math.random (fastest), crypto.getRandomValues - (Web Cryptography API in recent browsers) or crypto.randomBytes (Node.js). -

-

- To be able to set CRYPTO to true when using - Node.js, the crypto object must be available globally: -

-
global.crypto = require('crypto')
-

- If CRYPTO is true, i.e. one of the - crypto methods is to be used, the value of a returned BigNumber should be - cryptographically-secure and statistically indistinguishable from a random value. -

-

- Throws if dp is invalid. See Errors. -

-
BigNumber.config({ DECIMAL_PLACES: 10 })
-BigNumber.random()              // '0.4117936847'
-BigNumber.random(20)            // '0.78193327636914089009'
- - - -
sum.sum(n...) ⇒ BigNumber
-

- n: number|string|BigNumber
- See BigNumber for further parameter details. -

-

Returns a BigNumber whose value is the sum of the arguments.

-

The return value is always exact and unrounded.

-
x = new BigNumber('3257869345.0378653')
-BigNumber.sum(4e9, x, '123456789.9')      // '7381326134.9378653'
-
-arr = [2, new BigNumber(14), '15.9999', 12]
-BigNumber.sum.apply(null, arr)            // '43.9999'
- - - -

Properties

-

- The library's enumerated rounding modes are stored as properties of the constructor.
- (They are not referenced internally by the library itself.) -

-

- Rounding modes 0 to 6 (inclusive) are the same as those of Java's - BigDecimal class. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyValueDescription
ROUND_UP0Rounds away from zero
ROUND_DOWN1Rounds towards zero
ROUND_CEIL2Rounds towards Infinity
ROUND_FLOOR3Rounds towards -Infinity
ROUND_HALF_UP4 - Rounds towards nearest neighbour.
- If equidistant, rounds away from zero -
ROUND_HALF_DOWN5 - Rounds towards nearest neighbour.
- If equidistant, rounds towards zero -
ROUND_HALF_EVEN6 - Rounds towards nearest neighbour.
- If equidistant, rounds towards even neighbour -
ROUND_HALF_CEIL7 - Rounds towards nearest neighbour.
- If equidistant, rounds towards Infinity -
ROUND_HALF_FLOOR8 - Rounds towards nearest neighbour.
- If equidistant, rounds towards -Infinity -
-
-BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL })
-BigNumber.config({ ROUNDING_MODE: 2 })     // equivalent
- -
DEBUG
-

undefined|false|true

-

- If BigNumber.DEBUG is set true then an error will be thrown - if this BigNumber constructor receives an invalid value, such as - a value of type number with more than 15 significant digits. - See BigNumber. -

-

- An error will also be thrown if the isBigNumber - method receives a BigNumber that is not well-formed. - See isBigNumber. -

-
BigNumber.DEBUG = true
- - -

INSTANCE

- - -

Methods

-

The methods inherited by a BigNumber instance from its constructor's prototype object.

-

A BigNumber is immutable in the sense that it is not changed by its methods.

-

- The treatment of ±0, ±Infinity and NaN is - consistent with how JavaScript treats these values. -

-

Many method names have a shorter alias.

- - - -
absoluteValue.abs() ⇒ BigNumber
-

- Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of - this BigNumber. -

-

The return value is always exact and unrounded.

-
-x = new BigNumber(-0.8)
-y = x.absoluteValue()           // '0.8'
-z = y.abs()                     // '0.8'
- - - -
- comparedTo.comparedTo(n [, base]) ⇒ number -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

- - - - - - - - - - - - - - - - - - -
Returns 
1If the value of this BigNumber is greater than the value of n
-1If the value of this BigNumber is less than the value of n
0If this BigNumber and n have the same value
nullIf the value of either this BigNumber or n is NaN
-
-x = new BigNumber(Infinity)
-y = new BigNumber(5)
-x.comparedTo(y)                 // 1
-x.comparedTo(x.minus(1))        // 0
-y.comparedTo(NaN)               // null
-y.comparedTo('110', 2)          // -1
- - - -
- decimalPlaces.dp([dp [, rm]]) ⇒ BigNumber|number -
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- If dp is a number, returns a BigNumber whose value is the value of this BigNumber - rounded by rounding mode rm to a maximum of dp decimal places. -

-

- If dp is omitted, or is null or undefined, the return - value is the number of decimal places of the value of this BigNumber, or null if - the value of this BigNumber is ±Infinity or NaN. -

-

- If rm is omitted, or is null or undefined, - ROUNDING_MODE is used. -

-

- Throws if dp or rm is invalid. See Errors. -

-
-x = new BigNumber(1234.56)
-x.decimalPlaces(1)                     // '1234.6'
-x.dp()                                 // 2
-x.decimalPlaces(2)                     // '1234.56'
-x.dp(10)                               // '1234.56'
-x.decimalPlaces(0, 1)                  // '1234'
-x.dp(0, 6)                             // '1235'
-x.decimalPlaces(1, 1)                  // '1234.5'
-x.dp(1, BigNumber.ROUND_HALF_EVEN)     // '1234.6'
-x                                      // '1234.56'
-y = new BigNumber('9.9e-101')
-y.dp()                                 // 102
- - - -
dividedBy.div(n [, base]) ⇒ BigNumber -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the value of this BigNumber divided by - n, rounded according to the current - DECIMAL_PLACES and - ROUNDING_MODE settings. -

-
-x = new BigNumber(355)
-y = new BigNumber(113)
-x.dividedBy(y)                  // '3.14159292035398230088'
-x.div(5)                        // '71'
-x.div(47, 16)                   // '5'
- - - -
- dividedToIntegerBy.idiv(n [, base]) ⇒ - BigNumber -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by - n. -

-
-x = new BigNumber(5)
-y = new BigNumber(3)
-x.dividedToIntegerBy(y)         // '1'
-x.idiv(0.7)                     // '7'
-x.idiv('0.f', 16)               // '5'
- - - -
- exponentiatedBy.pow(n [, m]) ⇒ BigNumber -
-

- n: number|string|BigNumber: integer
- m: number|string|BigNumber -

-

- Returns a BigNumber whose value is the value of this BigNumber exponentiated by - n, i.e. raised to the power n, and optionally modulo a modulus - m. -

-

- Throws if n is not an integer. See Errors. -

-

- If n is negative the result is rounded according to the current - DECIMAL_PLACES and - ROUNDING_MODE settings. -

-

- As the number of digits of the result of the power operation can grow so large so quickly, - e.g. 123.45610000 has over 50000 digits, the number of significant - digits calculated is limited to the value of the - POW_PRECISION setting (unless a modulus - m is specified). -

-

- By default POW_PRECISION is set to 0. - This means that an unlimited number of significant digits will be calculated, and that the - method's performance will decrease dramatically for larger exponents. -

-

- If m is specified and the value of m, n and this - BigNumber are integers, and n is positive, then a fast modular exponentiation - algorithm is used, otherwise the operation will be performed as - x.exponentiatedBy(n).modulo(m) with a - POW_PRECISION of 0. -

-
-Math.pow(0.7, 2)                // 0.48999999999999994
-x = new BigNumber(0.7)
-x.exponentiatedBy(2)            // '0.49'
-BigNumber(3).pow(-2)            // '0.11111111111111111111'
- - - -
- integerValue.integerValue([rm]) ⇒ BigNumber -
-

- rm: number: integer, 0 to 8 inclusive -

-

- Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using - rounding mode rm. -

-

- If rm is omitted, or is null or undefined, - ROUNDING_MODE is used. -

-

- Throws if rm is invalid. See Errors. -

-
-x = new BigNumber(123.456)
-x.integerValue()                        // '123'
-x.integerValue(BigNumber.ROUND_CEIL)    // '124'
-y = new BigNumber(-12.7)
-y.integerValue()                        // '-13'
-y.integerValue(BigNumber.ROUND_DOWN)    // '-12'
-

- The following is an example of how to add a prototype method that emulates JavaScript's - Math.round function. Math.ceil, Math.floor and - Math.trunc can be emulated in the same way with - BigNumber.ROUND_CEIL, BigNumber.ROUND_FLOOR and - BigNumber.ROUND_DOWN respectively. -

-
-BigNumber.prototype.round = function (n) {
-  return n.integerValue(BigNumber.ROUND_HALF_CEIL);
-};
-x.round()                               // '123'
- - - -
isEqualTo.eq(n [, base]) ⇒ boolean
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is equal to the value of - n, otherwise returns false.
- As with JavaScript, NaN does not equal NaN. -

-

Note: This method uses the comparedTo method internally.

-
-0 === 1e-324                    // true
-x = new BigNumber(0)
-x.isEqualTo('1e-324')           // false
-BigNumber(-0).eq(x)             // true  ( -0 === 0 )
-BigNumber(255).eq('ff', 16)     // true
-
-y = new BigNumber(NaN)
-y.isEqualTo(NaN)                // false
- - - -
isFinite.isFinite() ⇒ boolean
-

- Returns true if the value of this BigNumber is a finite number, otherwise - returns false. -

-

- The only possible non-finite values of a BigNumber are NaN, Infinity - and -Infinity. -

-
-x = new BigNumber(1)
-x.isFinite()                    // true
-y = new BigNumber(Infinity)
-y.isFinite()                    // false
-

- Note: The native method isFinite() can be used if - n <= Number.MAX_VALUE. -

- - - -
isGreaterThan.gt(n [, base]) ⇒ boolean
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is greater than the value of - n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-0.1 > (0.3 - 0.2)                             // true
-x = new BigNumber(0.1)
-x.isGreaterThan(BigNumber(0.3).minus(0.2))    // false
-BigNumber(0).gt(x)                            // false
-BigNumber(11, 3).gt(11.1, 2)                  // true
- - - -
- isGreaterThanOrEqualTo.gte(n [, base]) ⇒ boolean -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is greater than or equal to the value - of n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-(0.3 - 0.2) >= 0.1                     // false
-x = new BigNumber(0.3).minus(0.2)
-x.isGreaterThanOrEqualTo(0.1)          // true
-BigNumber(1).gte(x)                    // true
-BigNumber(10, 18).gte('i', 36)         // true
- - - -
isInteger.isInteger() ⇒ boolean
-

- Returns true if the value of this BigNumber is an integer, otherwise returns - false. -

-
-x = new BigNumber(1)
-x.isInteger()                   // true
-y = new BigNumber(123.456)
-y.isInteger()                   // false
- - - -
isLessThan.lt(n [, base]) ⇒ boolean
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is less than the value of - n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-(0.3 - 0.2) < 0.1                       // true
-x = new BigNumber(0.3).minus(0.2)
-x.isLessThan(0.1)                       // false
-BigNumber(0).lt(x)                      // true
-BigNumber(11.1, 2).lt(11, 3)            // true
- - - -
- isLessThanOrEqualTo.lte(n [, base]) ⇒ boolean -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is less than or equal to the value of - n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-0.1 <= (0.3 - 0.2)                                // false
-x = new BigNumber(0.1)
-x.isLessThanOrEqualTo(BigNumber(0.3).minus(0.2))  // true
-BigNumber(-1).lte(x)                              // true
-BigNumber(10, 18).lte('i', 36)                    // true
- - - -
isNaN.isNaN() ⇒ boolean
-

- Returns true if the value of this BigNumber is NaN, otherwise - returns false. -

-
-x = new BigNumber(NaN)
-x.isNaN()                       // true
-y = new BigNumber('Infinity')
-y.isNaN()                       // false
-

Note: The native method isNaN() can also be used.

- - - -
isNegative.isNegative() ⇒ boolean
-

- Returns true if the sign of this BigNumber is negative, otherwise returns - false. -

-
-x = new BigNumber(-0)
-x.isNegative()                  // true
-y = new BigNumber(2)
-y.isNegative()                  // false
-

Note: n < 0 can be used if n <= -Number.MIN_VALUE.

- - - -
isPositive.isPositive() ⇒ boolean
-

- Returns true if the sign of this BigNumber is positive, otherwise returns - false. -

-
-x = new BigNumber(-0)
-x.isPositive()                  // false
-y = new BigNumber(2)
-y.isPositive()                  // true
- - - -
isZero.isZero() ⇒ boolean
-

- Returns true if the value of this BigNumber is zero or minus zero, otherwise - returns false. -

-
-x = new BigNumber(-0)
-x.isZero() && x.isNegative()         // true
-y = new BigNumber(Infinity)
-y.isZero()                      // false
-

Note: n == 0 can be used if n >= Number.MIN_VALUE.

- - - -
- minus.minus(n [, base]) ⇒ BigNumber -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

Returns a BigNumber whose value is the value of this BigNumber minus n.

-

The return value is always exact and unrounded.

-
-0.3 - 0.1                       // 0.19999999999999998
-x = new BigNumber(0.3)
-x.minus(0.1)                    // '0.2'
-x.minus(0.6, 20)                // '0'
- - - -
modulo.mod(n [, base]) ⇒ BigNumber
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the value of this BigNumber modulo n, i.e. - the integer remainder of dividing this BigNumber by n. -

-

- The value returned, and in particular its sign, is dependent on the value of the - MODULO_MODE setting of this BigNumber constructor. - If it is 1 (default value), the result will have the same sign as this BigNumber, - and it will match that of Javascript's % operator (within the limits of double - precision) and BigDecimal's remainder method. -

-

The return value is always exact and unrounded.

-

- See MODULO_MODE for a description of the other - modulo modes. -

-
-1 % 0.9                         // 0.09999999999999998
-x = new BigNumber(1)
-x.modulo(0.9)                   // '0.1'
-y = new BigNumber(33)
-y.mod('a', 33)                  // '3'
- - - -
- multipliedBy.times(n [, base]) ⇒ BigNumber -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the value of this BigNumber multiplied by n. -

-

The return value is always exact and unrounded.

-
-0.6 * 3                         // 1.7999999999999998
-x = new BigNumber(0.6)
-y = x.multipliedBy(3)           // '1.8'
-BigNumber('7e+500').times(y)    // '1.26e+501'
-x.multipliedBy('-a', 16)        // '-6'
- - - -
negated.negated() ⇒ BigNumber
-

- Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by - -1. -

-
-x = new BigNumber(1.8)
-x.negated()                     // '-1.8'
-y = new BigNumber(-1.3)
-y.negated()                     // '1.3'
- - - -
plus.plus(n [, base]) ⇒ BigNumber
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

Returns a BigNumber whose value is the value of this BigNumber plus n.

-

The return value is always exact and unrounded.

-
-0.1 + 0.2                       // 0.30000000000000004
-x = new BigNumber(0.1)
-y = x.plus(0.2)                 // '0.3'
-BigNumber(0.7).plus(x).plus(y)  // '1.1'
-x.plus('0.1', 8)                // '0.225'
- - - -
- precision.sd([d [, rm]]) ⇒ BigNumber|number -
-

- d: number|boolean: integer, 1 to 1e+9 - inclusive, or true or false
- rm: number: integer, 0 to 8 inclusive. -

-

- If d is a number, returns a BigNumber whose value is the value of this BigNumber - rounded to a precision of d significant digits using rounding mode - rm. -

-

- If d is omitted or is null or undefined, the return - value is the number of significant digits of the value of this BigNumber, or null - if the value of this BigNumber is ±Infinity or NaN.

-

-

- If d is true then any trailing zeros of the integer - part of a number are counted as significant digits, otherwise they are not. -

-

- If rm is omitted or is null or undefined, - ROUNDING_MODE will be used. -

-

- Throws if d or rm is invalid. See Errors. -

-
-x = new BigNumber(9876.54321)
-x.precision(6)                         // '9876.54'
-x.sd()                                 // 9
-x.precision(6, BigNumber.ROUND_UP)     // '9876.55'
-x.sd(2)                                // '9900'
-x.precision(2, 1)                      // '9800'
-x                                      // '9876.54321'
-y = new BigNumber(987000)
-y.precision()                          // 3
-y.sd(true)                             // 6
- - - -
shiftedBy.shiftedBy(n) ⇒ BigNumber
-

- n: number: integer, - -9007199254740991 to 9007199254740991 inclusive -

-

- Returns a BigNumber whose value is the value of this BigNumber shifted by n - places. -

- The shift is of the decimal point, i.e. of powers of ten, and is to the left if n - is negative or to the right if n is positive. -

-

The return value is always exact and unrounded.

-

- Throws if n is invalid. See Errors. -

-
-x = new BigNumber(1.23)
-x.shiftedBy(3)                      // '1230'
-x.shiftedBy(-3)                     // '0.00123'
- - - -
squareRoot.sqrt() ⇒ BigNumber
-

- Returns a BigNumber whose value is the square root of the value of this BigNumber, - rounded according to the current - DECIMAL_PLACES and - ROUNDING_MODE settings. -

-

- The return value will be correctly rounded, i.e. rounded as if the result was first calculated - to an infinite number of correct digits before rounding. -

-
-x = new BigNumber(16)
-x.squareRoot()                  // '4'
-y = new BigNumber(3)
-y.sqrt()                        // '1.73205080756887729353'
- - - -
- toExponential.toExponential([dp [, rm]]) ⇒ string -
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- Returns a string representing the value of this BigNumber in exponential notation rounded - using rounding mode rm to dp decimal places, i.e with one digit - before the decimal point and dp digits after it. -

-

- If the value of this BigNumber in exponential notation has fewer than dp fraction - digits, the return value will be appended with zeros accordingly. -

-

- If dp is omitted, or is null or undefined, the number - of digits after the decimal point defaults to the minimum number of digits necessary to - represent the value exactly.
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used. -

-

- Throws if dp or rm is invalid. See Errors. -

-
-x = 45.6
-y = new BigNumber(x)
-x.toExponential()               // '4.56e+1'
-y.toExponential()               // '4.56e+1'
-x.toExponential(0)              // '5e+1'
-y.toExponential(0)              // '5e+1'
-x.toExponential(1)              // '4.6e+1'
-y.toExponential(1)              // '4.6e+1'
-y.toExponential(1, 1)           // '4.5e+1'  (ROUND_DOWN)
-x.toExponential(3)              // '4.560e+1'
-y.toExponential(3)              // '4.560e+1'
- - - -
- toFixed.toFixed([dp [, rm]]) ⇒ string -
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- Returns a string representing the value of this BigNumber in normal (fixed-point) notation - rounded to dp decimal places using rounding mode rm. -

-

- If the value of this BigNumber in normal notation has fewer than dp fraction - digits, the return value will be appended with zeros accordingly. -

-

- Unlike Number.prototype.toFixed, which returns exponential notation if a number - is greater or equal to 1021, this method will always return normal - notation. -

-

- If dp is omitted or is null or undefined, the return - value will be unrounded and in normal notation. This is also unlike - Number.prototype.toFixed, which returns the value to zero decimal places.
- It is useful when fixed-point notation is required and the current - EXPONENTIAL_AT setting causes - toString to return exponential notation.
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used. -

-

- Throws if dp or rm is invalid. See Errors. -

-
-x = 3.456
-y = new BigNumber(x)
-x.toFixed()                     // '3'
-y.toFixed()                     // '3.456'
-y.toFixed(0)                    // '3'
-x.toFixed(2)                    // '3.46'
-y.toFixed(2)                    // '3.46'
-y.toFixed(2, 1)                 // '3.45'  (ROUND_DOWN)
-x.toFixed(5)                    // '3.45600'
-y.toFixed(5)                    // '3.45600'
- - - -
- toFormat.toFormat([dp [, rm[, format]]]) ⇒ string -
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive
- format: object: see FORMAT -

-

-

- Returns a string representing the value of this BigNumber in normal (fixed-point) notation - rounded to dp decimal places using rounding mode rm, and formatted - according to the properties of the format object. -

-

- See FORMAT and the examples below for the properties of the - format object, their types, and their usage. A formatting object may contain - some or all of the recognised properties. -

-

- If dp is omitted or is null or undefined, then the - return value is not rounded to a fixed number of decimal places.
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used.
- If format is omitted or is null or undefined, the - FORMAT object is used. -

-

- Throws if dp, rm or format is invalid. See - Errors. -

-
-fmt = {
-  prefix: '',
-  decimalSeparator: '.',
-  groupSeparator: ',',
-  groupSize: 3,
-  secondaryGroupSize: 0,
-  fractionGroupSeparator: ' ',
-  fractionGroupSize: 0,
-  suffix: ''
-}
-
-x = new BigNumber('123456789.123456789')
-
-// Set the global formatting options
-BigNumber.config({ FORMAT: fmt })
-
-x.toFormat()                              // '123,456,789.123456789'
-x.toFormat(3)                             // '123,456,789.123'
-
-// If a reference to the object assigned to FORMAT has been retained,
-// the format properties can be changed directly
-fmt.groupSeparator = ' '
-fmt.fractionGroupSize = 5
-x.toFormat()                              // '123 456 789.12345 6789'
-
-// Alternatively, pass the formatting options as an argument
-fmt = {
-  prefix: '=> ',
-  decimalSeparator: ',',
-  groupSeparator: '.',
-  groupSize: 3,
-  secondaryGroupSize: 2
-}
-
-x.toFormat()                              // '123 456 789.12345 6789'
-x.toFormat(fmt)                           // '=> 12.34.56.789,123456789'
-x.toFormat(2, fmt)                        // '=> 12.34.56.789,12'
-x.toFormat(3, BigNumber.ROUND_UP, fmt)    // '=> 12.34.56.789,124'
- - - -
- toFraction.toFraction([maximum_denominator]) - ⇒ [BigNumber, BigNumber] -
-

- maximum_denominator: - number|string|BigNumber: integer >= 1 and <= - Infinity -

-

- Returns an array of two BigNumbers representing the value of this BigNumber as a simple - fraction with an integer numerator and an integer denominator. The denominator will be a - positive non-zero value less than or equal to maximum_denominator. -

-

- If a maximum_denominator is not specified, or is null or - undefined, the denominator will be the lowest value necessary to represent the - number exactly. -

-

- Throws if maximum_denominator is invalid. See Errors. -

-
-x = new BigNumber(1.75)
-x.toFraction()                  // '7, 4'
-
-pi = new BigNumber('3.14159265358')
-pi.toFraction()                 // '157079632679,50000000000'
-pi.toFraction(100000)           // '312689, 99532'
-pi.toFraction(10000)            // '355, 113'
-pi.toFraction(100)              // '311, 99'
-pi.toFraction(10)               // '22, 7'
-pi.toFraction(1)                // '3, 1'
- - - -
toJSON.toJSON() ⇒ string
-

As valueOf.

-
-x = new BigNumber('177.7e+457')
-y = new BigNumber(235.4325)
-z = new BigNumber('0.0098074')
-
-// Serialize an array of three BigNumbers
-str = JSON.stringify( [x, y, z] )
-// "["1.777e+459","235.4325","0.0098074"]"
-
-// Return an array of three BigNumbers
-JSON.parse(str, function (key, val) {
-    return key === '' ? val : new BigNumber(val)
-})
- - - -
toNumber.toNumber() ⇒ number
-

Returns the value of this BigNumber as a JavaScript number primitive.

-

- This method is identical to using type coercion with the unary plus operator. -

-
-x = new BigNumber(456.789)
-x.toNumber()                    // 456.789
-+x                              // 456.789
-
-y = new BigNumber('45987349857634085409857349856430985')
-y.toNumber()                    // 4.598734985763409e+34
-
-z = new BigNumber(-0)
-1 / z.toNumber()                // -Infinity
-1 / +z                          // -Infinity
- - - -
- toPrecision.toPrecision([sd [, rm]]) ⇒ string -
-

- sd: number: integer, 1 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- Returns a string representing the value of this BigNumber rounded to sd - significant digits using rounding mode rm. -

-

- If sd is less than the number of digits necessary to represent the integer part - of the value in normal (fixed-point) notation, then exponential notation is used. -

-

- If sd is omitted, or is null or undefined, then the - return value is the same as n.toString().
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used. -

-

- Throws if sd or rm is invalid. See Errors. -

-
-x = 45.6
-y = new BigNumber(x)
-x.toPrecision()                 // '45.6'
-y.toPrecision()                 // '45.6'
-x.toPrecision(1)                // '5e+1'
-y.toPrecision(1)                // '5e+1'
-y.toPrecision(2, 0)             // '4.6e+1'  (ROUND_UP)
-y.toPrecision(2, 1)             // '4.5e+1'  (ROUND_DOWN)
-x.toPrecision(5)                // '45.600'
-y.toPrecision(5)                // '45.600'
- - - -
toString.toString([base]) ⇒ string
-

- base: number: integer, 2 to ALPHABET.length - inclusive (see ALPHABET). -

-

- Returns a string representing the value of this BigNumber in the specified base, or base - 10 if base is omitted or is null or - undefined. -

-

- For bases above 10, and using the default base conversion alphabet - (see ALPHABET), values from 10 to - 35 are represented by a-z - (as with Number.prototype.toString). -

-

- If a base is specified the value is rounded according to the current - DECIMAL_PLACES - and ROUNDING_MODE settings. -

-

- If a base is not specified, and this BigNumber has a positive - exponent that is equal to or greater than the positive component of the - current EXPONENTIAL_AT setting, - or a negative exponent equal to or less than the negative component of the - setting, then exponential notation is returned. -

-

If base is null or undefined it is ignored.

-

- Throws if base is invalid. See Errors. -

-
-x = new BigNumber(750000)
-x.toString()                    // '750000'
-BigNumber.config({ EXPONENTIAL_AT: 5 })
-x.toString()                    // '7.5e+5'
-
-y = new BigNumber(362.875)
-y.toString(2)                   // '101101010.111'
-y.toString(9)                   // '442.77777777777777777778'
-y.toString(32)                  // 'ba.s'
-
-BigNumber.config({ DECIMAL_PLACES: 4 });
-z = new BigNumber('1.23456789')
-z.toString()                    // '1.23456789'
-z.toString(10)                  // '1.2346'
- - - -
valueOf.valueOf() ⇒ string
-

- As toString, but does not accept a base argument and includes - the minus sign for negative zero. -

-
-x = new BigNumber('-0')
-x.toString()                    // '0'
-x.valueOf()                     // '-0'
-y = new BigNumber('1.777e+457')
-y.valueOf()                     // '1.777e+457'
- - - -

Properties

-

The properties of a BigNumber instance:

- - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionTypeValue
ccoefficient*number[] Array of base 1e14 numbers
eexponentnumberInteger, -1000000000 to 1000000000 inclusive
ssignnumber-1 or 1
-

*significand

-

- The value of any of the c, e and s properties may also - be null. -

-

- The above properties are best considered to be read-only. In early versions of this library it - was okay to change the exponent of a BigNumber by writing to its exponent property directly, - but this is no longer reliable as the value of the first element of the coefficient array is - now dependent on the exponent. -

-

- Note that, as with JavaScript numbers, the original exponent and fractional trailing zeros are - not necessarily preserved. -

-
x = new BigNumber(0.123)              // '0.123'
-x.toExponential()                     // '1.23e-1'
-x.c                                   // '1,2,3'
-x.e                                   // -1
-x.s                                   // 1
-
-y = new Number(-123.4567000e+2)       // '-12345.67'
-y.toExponential()                     // '-1.234567e+4'
-z = new BigNumber('-123.4567000e+2')  // '-12345.67'
-z.toExponential()                     // '-1.234567e+4'
-z.c                                   // '1,2,3,4,5,6,7'
-z.e                                   // 4
-z.s                                   // -1
- - - -

Zero, NaN and Infinity

-

- The table below shows how ±0, NaN and - ±Infinity are stored. -

- - - - - - - - - - - - - - - - - - - - - - - - - -
ces
±0[0]0±1
NaNnullnullnull
±Infinitynullnull±1
-
-x = new Number(-0)              // 0
-1 / x == -Infinity              // true
-
-y = new BigNumber(-0)           // '0'
-y.c                             // '0' ( [0].toString() )
-y.e                             // 0
-y.s                             // -1
- - - -

Errors

-

The table below shows the errors that are thrown.

-

- The errors are generic Error objects whose message begins - '[BigNumber Error]'. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodThrows
- BigNumber
- comparedTo
- dividedBy
- dividedToIntegerBy
- isEqualTo
- isGreaterThan
- isGreaterThanOrEqualTo
- isLessThan
- isLessThanOrEqualTo
- minus
- modulo
- plus
- multipliedBy -
Base not a primitive number
Base not an integer
Base out of range
Number primitive has more than 15 significant digits*
Not a base... number*
Not a number*
cloneObject expected
configObject expected
DECIMAL_PLACES not a primitive number
DECIMAL_PLACES not an integer
DECIMAL_PLACES out of range
ROUNDING_MODE not a primitive number
ROUNDING_MODE not an integer
ROUNDING_MODE out of range
EXPONENTIAL_AT not a primitive number
EXPONENTIAL_AT not an integer
EXPONENTIAL_AT out of range
RANGE not a primitive number
RANGE not an integer
RANGE cannot be zero
RANGE cannot be zero
CRYPTO not true or false
crypto unavailable
MODULO_MODE not a primitive number
MODULO_MODE not an integer
MODULO_MODE out of range
POW_PRECISION not a primitive number
POW_PRECISION not an integer
POW_PRECISION out of range
FORMAT not an object
ALPHABET invalid
- decimalPlaces
- precision
- random
- shiftedBy
- toExponential
- toFixed
- toFormat
- toPrecision -
Argument not a primitive number
Argument not an integer
Argument out of range
- decimalPlaces
- precision -
Argument not true or false
exponentiatedByArgument not an integer
isBigNumberInvalid BigNumber*
- minimum
- maximum -
Not a number*
- random - crypto unavailable
- toFormat - Argument not an object
toFractionArgument not an integer
Argument out of range
toStringBase not a primitive number
Base not an integer
Base out of range
-

*Only thrown if BigNumber.DEBUG is true.

-

To determine if an exception is a BigNumber Error:

-
-try {
-  // ...
-} catch (e) {
-  if (e instanceof Error && e.message.indexOf('[BigNumber Error]') === 0) {
-      // ...
-  }
-}
- - - -

Type coercion

-

- To prevent the accidental use of a BigNumber in primitive number operations, or the - accidental addition of a BigNumber to a string, the valueOf method can be safely - overwritten as shown below. -

-

- The valueOf method is the same as the - toJSON method, and both are the same as the - toString method except they do not take a base - argument and they include the minus sign for negative zero. -

-
-BigNumber.prototype.valueOf = function () {
-  throw Error('valueOf called!')
-}
-
-x = new BigNumber(1)
-x / 2                    // '[BigNumber Error] valueOf called!'
-x + 'abc'                // '[BigNumber Error] valueOf called!'
-
- - - -

FAQ

- -
Why are trailing fractional zeros removed from BigNumbers?
-

- Some arbitrary-precision libraries retain trailing fractional zeros as they can indicate the - precision of a value. This can be useful but the results of arithmetic operations can be - misleading. -

-
-x = new BigDecimal("1.0")
-y = new BigDecimal("1.1000")
-z = x.add(y)                      // 2.1000
-
-x = new BigDecimal("1.20")
-y = new BigDecimal("3.45000")
-z = x.multiply(y)                 // 4.1400000
-

- To specify the precision of a value is to specify that the value lies - within a certain range. -

-

- In the first example, x has a value of 1.0. The trailing zero shows - the precision of the value, implying that it is in the range 0.95 to - 1.05. Similarly, the precision indicated by the trailing zeros of y - indicates that the value is in the range 1.09995 to 1.10005. -

-

- If we add the two lowest values in the ranges we have, 0.95 + 1.09995 = 2.04995, - and if we add the two highest values we have, 1.05 + 1.10005 = 2.15005, so the - range of the result of the addition implied by the precision of its operands is - 2.04995 to 2.15005. -

-

- The result given by BigDecimal of 2.1000 however, indicates that the value is in - the range 2.09995 to 2.10005 and therefore the precision implied by - its trailing zeros may be misleading. -

-

- In the second example, the true range is 4.122744 to 4.157256 yet - the BigDecimal answer of 4.1400000 indicates a range of 4.13999995 - to 4.14000005. Again, the precision implied by the trailing zeros may be - misleading. -

-

- This library, like binary floating point and most calculators, does not retain trailing - fractional zeros. Instead, the toExponential, toFixed and - toPrecision methods enable trailing zeros to be added if and when required.
-

-
- - - diff --git a/node_modules/bignumber.js/package.json b/node_modules/bignumber.js/package.json deleted file mode 100644 index d23168d8..00000000 --- a/node_modules/bignumber.js/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "bignumber.js@^9.0.0", - "_id": "bignumber.js@9.0.1", - "_inBundle": false, - "_integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", - "_location": "/bignumber.js", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "bignumber.js@^9.0.0", - "name": "bignumber.js", - "escapedName": "bignumber.js", - "rawSpec": "^9.0.0", - "saveSpec": null, - "fetchSpec": "^9.0.0" - }, - "_requiredBy": [ - "/json-bigint" - ], - "_resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", - "_shasum": "8d7ba124c882bfd8e43260c67475518d0689e4e5", - "_spec": "bignumber.js@^9.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/json-bigint", - "author": { - "name": "Michael Mclaughlin", - "email": "M8ch88l@gmail.com" - }, - "browser": "bignumber.js", - "bugs": { - "url": "https://github.com/MikeMcl/bignumber.js/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", - "engines": { - "node": "*" - }, - "homepage": "https://github.com/MikeMcl/bignumber.js#readme", - "keywords": [ - "arbitrary", - "precision", - "arithmetic", - "big", - "number", - "decimal", - "float", - "biginteger", - "bigdecimal", - "bignumber", - "bigint", - "bignum" - ], - "license": "MIT", - "main": "bignumber", - "module": "bignumber.mjs", - "name": "bignumber.js", - "repository": { - "type": "git", - "url": "git+https://github.com/MikeMcl/bignumber.js.git" - }, - "scripts": { - "build": "uglifyjs bignumber.js --source-map -c -m -o bignumber.min.js", - "test": "node test/test" - }, - "types": "bignumber.d.ts", - "version": "9.0.1" -} diff --git a/node_modules/bluebird/LICENSE b/node_modules/bluebird/LICENSE deleted file mode 100644 index b24e6350..00000000 --- a/node_modules/bluebird/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2018 Petka Antonov - -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. diff --git a/node_modules/bluebird/README.md b/node_modules/bluebird/README.md deleted file mode 100644 index 7c1dd661..00000000 --- a/node_modules/bluebird/README.md +++ /dev/null @@ -1,57 +0,0 @@ - - Promises/A+ logo - - - -[![Build Status](https://travis-ci.org/petkaantonov/bluebird.svg?branch=master)](https://travis-ci.org/petkaantonov/bluebird) -[![coverage-98%](https://img.shields.io/badge/coverage-98%25-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html) - -**Got a question?** Join us on [stackoverflow](http://stackoverflow.com/questions/tagged/bluebird), the [mailing list](https://groups.google.com/forum/#!forum/bluebird-js) or chat on [IRC](https://webchat.freenode.net/?channels=#promises) - -# Introduction - -Bluebird is a fully featured promise library with focus on innovative features and performance - -See the [**bluebird website**](http://bluebirdjs.com/docs/getting-started.html) for further documentation, references and instructions. See the [**API reference**](http://bluebirdjs.com/docs/api-reference.html) here. - -For bluebird 2.x documentation and files, see the [2.x tree](https://github.com/petkaantonov/bluebird/tree/2.x). - -### Note - -Promises in Node.js 10 are significantly faster than before. Bluebird still includes a lot of features like cancellation, iteration methods and warnings that native promises don't. If you are using Bluebird for performance rather than for those - please consider giving native promises a shot and running the benchmarks yourself. - -# Questions and issues - -The [github issue tracker](https://github.com/petkaantonov/bluebird/issues) is **_only_** for bug reports and feature requests. Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`. - - - -## Thanks - -Thanks to BrowserStack for providing us with a free account which lets us support old browsers like IE8. - -# License - -The MIT License (MIT) - -Copyright (c) 2013-2019 Petka Antonov - -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. - diff --git a/node_modules/bluebird/changelog.md b/node_modules/bluebird/changelog.md deleted file mode 100644 index 73b2eb6c..00000000 --- a/node_modules/bluebird/changelog.md +++ /dev/null @@ -1 +0,0 @@ -[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html) diff --git a/node_modules/bluebird/js/browser/bluebird.core.js b/node_modules/bluebird/js/browser/bluebird.core.js deleted file mode 100644 index 5b59d6ca..00000000 --- a/node_modules/bluebird/js/browser/bluebird.core.js +++ /dev/null @@ -1,3941 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 3.7.1 - * Features enabled: core - * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each -*/ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0) { - _drainQueueStep(queue); - } -} - -function _drainQueueStep(queue) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - } else { - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -} - -Async.prototype._drainQueues = function () { - _drainQueue(this._normalQueue); - this._reset(); - this._haveDrainedQueues = true; - _drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = Async; -module.exports.firstLineError = firstLineError; - -},{"./queue":17,"./schedule":18}],2:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { -var calledBind = false; -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - if (((this._bitField & 50397184) === 0)) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - if (!calledBind) { - calledBind = true; - Promise.prototype._propagateFrom = debug.propagateFromFunction(); - Promise.prototype._boundValue = debug.boundValueFunction(); - } - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - ret._setBoundTo(maybePromise); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, undefined, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, undefined, ret, context); - ret._setOnCancel(maybePromise); - } else { - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 2097152; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~2097152); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 2097152) === 2097152; -}; - -Promise.bind = function (thisArg, value) { - return Promise.resolve(value).bind(thisArg); -}; -}; - -},{}],3:[function(_dereq_,module,exports){ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = _dereq_("./promise")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; - -},{"./promise":15}],4:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, PromiseArray, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -Promise.prototype["break"] = Promise.prototype.cancel = function() { - if (!debug.cancellation()) return this._warn("cancellation is disabled"); - - var promise = this; - var child = promise; - while (promise._isCancellable()) { - if (!promise._cancelBy(child)) { - if (child._isFollowing()) { - child._followee().cancel(); - } else { - child._cancelBranched(); - } - break; - } - - var parent = promise._cancellationParent; - if (parent == null || !parent._isCancellable()) { - if (promise._isFollowing()) { - promise._followee().cancel(); - } else { - promise._cancelBranched(); - } - break; - } else { - if (promise._isFollowing()) promise._followee().cancel(); - promise._setWillBeCancelled(); - child = promise; - promise = parent; - } - } -}; - -Promise.prototype._branchHasCancelled = function() { - this._branchesRemainingToCancel--; -}; - -Promise.prototype._enoughBranchesHaveCancelled = function() { - return this._branchesRemainingToCancel === undefined || - this._branchesRemainingToCancel <= 0; -}; - -Promise.prototype._cancelBy = function(canceller) { - if (canceller === this) { - this._branchesRemainingToCancel = 0; - this._invokeOnCancel(); - return true; - } else { - this._branchHasCancelled(); - if (this._enoughBranchesHaveCancelled()) { - this._invokeOnCancel(); - return true; - } - } - return false; -}; - -Promise.prototype._cancelBranched = function() { - if (this._enoughBranchesHaveCancelled()) { - this._cancel(); - } -}; - -Promise.prototype._cancel = function() { - if (!this._isCancellable()) return; - this._setCancelled(); - async.invoke(this._cancelPromises, this, undefined); -}; - -Promise.prototype._cancelPromises = function() { - if (this._length() > 0) this._settlePromises(); -}; - -Promise.prototype._unsetOnCancel = function() { - this._onCancelField = undefined; -}; - -Promise.prototype._isCancellable = function() { - return this.isPending() && !this._isCancelled(); -}; - -Promise.prototype.isCancellable = function() { - return this.isPending() && !this.isCancelled(); -}; - -Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { - if (util.isArray(onCancelCallback)) { - for (var i = 0; i < onCancelCallback.length; ++i) { - this._doInvokeOnCancel(onCancelCallback[i], internalOnly); - } - } else if (onCancelCallback !== undefined) { - if (typeof onCancelCallback === "function") { - if (!internalOnly) { - var e = tryCatch(onCancelCallback).call(this._boundValue()); - if (e === errorObj) { - this._attachExtraTrace(e.e); - async.throwLater(e.e); - } - } - } else { - onCancelCallback._resultCancelled(this); - } - } -}; - -Promise.prototype._invokeOnCancel = function() { - var onCancelCallback = this._onCancel(); - this._unsetOnCancel(); - async.invoke(this._doInvokeOnCancel, this, onCancelCallback); -}; - -Promise.prototype._invokeInternalOnCancel = function() { - if (this._isCancellable()) { - this._doInvokeOnCancel(this._onCancel(), true); - this._unsetOnCancel(); - } -}; - -Promise.prototype._resultCancelled = function() { - this.cancel(); -}; - -}; - -},{"./util":21}],5:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = _dereq_("./util"); -var getKeys = _dereq_("./es5").keys; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function catchFilter(instances, cb, promise) { - return function(e) { - var boundTo = promise._boundValue(); - predicateLoop: for (var i = 0; i < instances.length; ++i) { - var item = instances[i]; - - if (item === Error || - (item != null && item.prototype instanceof Error)) { - if (e instanceof item) { - return tryCatch(cb).call(boundTo, e); - } - } else if (typeof item === "function") { - var matchesPredicate = tryCatch(item).call(boundTo, e); - if (matchesPredicate === errorObj) { - return matchesPredicate; - } else if (matchesPredicate) { - return tryCatch(cb).call(boundTo, e); - } - } else if (util.isObject(e)) { - var keys = getKeys(item); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - if (item[key] != e[key]) { - continue predicateLoop; - } - } - return tryCatch(cb).call(boundTo, e); - } - } - return NEXT_FILTER; - }; -} - -return catchFilter; -}; - -},{"./es5":10,"./util":21}],6:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var longStackTraces = false; -var contextStack = []; - -Promise.prototype._promiseCreated = function() {}; -Promise.prototype._pushContext = function() {}; -Promise.prototype._popContext = function() {return null;}; -Promise._peekContext = Promise.prototype._peekContext = function() {}; - -function Context() { - this._trace = new Context.CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (this._trace !== undefined) { - this._trace._promiseCreated = null; - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (this._trace !== undefined) { - var trace = contextStack.pop(); - var ret = trace._promiseCreated; - trace._promiseCreated = null; - return ret; - } - return null; -}; - -function createContext() { - if (longStackTraces) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} -Context.CapturedTrace = null; -Context.create = createContext; -Context.deactivateLongStackTraces = function() {}; -Context.activateLongStackTraces = function() { - var Promise_pushContext = Promise.prototype._pushContext; - var Promise_popContext = Promise.prototype._popContext; - var Promise_PeekContext = Promise._peekContext; - var Promise_peekContext = Promise.prototype._peekContext; - var Promise_promiseCreated = Promise.prototype._promiseCreated; - Context.deactivateLongStackTraces = function() { - Promise.prototype._pushContext = Promise_pushContext; - Promise.prototype._popContext = Promise_popContext; - Promise._peekContext = Promise_PeekContext; - Promise.prototype._peekContext = Promise_peekContext; - Promise.prototype._promiseCreated = Promise_promiseCreated; - longStackTraces = false; - }; - longStackTraces = true; - Promise.prototype._pushContext = Context.prototype._pushContext; - Promise.prototype._popContext = Context.prototype._popContext; - Promise._peekContext = Promise.prototype._peekContext = peekContext; - Promise.prototype._promiseCreated = function() { - var ctx = this._peekContext(); - if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; - }; -}; -return Context; -}; - -},{}],7:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, Context, - enableAsyncHooks, disableAsyncHooks) { -var async = Promise._async; -var Warning = _dereq_("./errors").Warning; -var util = _dereq_("./util"); -var es5 = _dereq_("./es5"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; -var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; -var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var printWarning; -var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && - (true || - util.env("BLUEBIRD_DEBUG") || - util.env("NODE_ENV") === "development")); - -var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && - (debugging || util.env("BLUEBIRD_WARNINGS"))); - -var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && - (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); - -var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && - (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); - -var deferUnhandledRejectionCheck; -(function() { - var promises = []; - - function unhandledRejectionCheck() { - for (var i = 0; i < promises.length; ++i) { - promises[i]._notifyUnhandledRejection(); - } - unhandledRejectionClear(); - } - - function unhandledRejectionClear() { - promises.length = 0; - } - - if (typeof document === "object" && document.createElement) { - deferUnhandledRejectionCheck = (function() { - var iframeSetTimeout; - - function checkIframe() { - if (document.body) { - var iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - if (iframe.contentWindow && - iframe.contentWindow.setTimeout) { - iframeSetTimeout = iframe.contentWindow.setTimeout; - } - document.body.removeChild(iframe); - } - } - checkIframe(); - return function(promise) { - promises.push(promise); - if (iframeSetTimeout) { - iframeSetTimeout(unhandledRejectionCheck, 1); - } else { - checkIframe(); - } - }; - })(); - } else { - deferUnhandledRejectionCheck = function(promise) { - promises.push(promise); - setTimeout(unhandledRejectionCheck, 1); - }; - } - - es5.defineProperty(Promise, "_unhandledRejectionCheck", { - value: unhandledRejectionCheck - }); - es5.defineProperty(Promise, "_unhandledRejectionClear", { - value: unhandledRejectionClear - }); -})(); - -Promise.prototype.suppressUnhandledRejections = function() { - var target = this._target(); - target._bitField = ((target._bitField & (~1048576)) | - 524288); -}; - -Promise.prototype._ensurePossibleRejectionHandled = function () { - if ((this._bitField & 524288) !== 0) return; - this._setRejectionIsUnhandled(); - deferUnhandledRejectionCheck(this); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._setReturnedNonUndefined = function() { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._returnedNonUndefined = function() { - return (this._bitField & 268435456) !== 0; -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._settledValue(); - this._setUnhandledRejectionIsNotified(); - fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 262144; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~262144); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 262144) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 1048576; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~1048576); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { - return warn(message, shouldUseOwnTrace, promise || this); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - var context = Promise._getContext(); - possiblyUnhandledRejection = util.contextBind(context, fn); -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - var context = Promise._getContext(); - unhandledRejectionHandled = util.contextBind(context, fn); -}; - -var disableLongStackTraces = function() {}; -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (!config.longStackTraces && longStackTracesIsSupported()) { - var Promise_captureStackTrace = Promise.prototype._captureStackTrace; - var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; - var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace; - config.longStackTraces = true; - disableLongStackTraces = function() { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - Promise.prototype._captureStackTrace = Promise_captureStackTrace; - Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; - Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; - Context.deactivateLongStackTraces(); - config.longStackTraces = false; - }; - Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; - Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; - Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; - Context.activateLongStackTraces(); - } -}; - -Promise.hasLongStackTraces = function () { - return config.longStackTraces && longStackTracesIsSupported(); -}; - - -var legacyHandlers = { - unhandledrejection: { - before: function() { - var ret = util.global.onunhandledrejection; - util.global.onunhandledrejection = null; - return ret; - }, - after: function(fn) { - util.global.onunhandledrejection = fn; - } - }, - rejectionhandled: { - before: function() { - var ret = util.global.onrejectionhandled; - util.global.onrejectionhandled = null; - return ret; - }, - after: function(fn) { - util.global.onrejectionhandled = fn; - } - } -}; - -var fireDomEvent = (function() { - var dispatch = function(legacy, e) { - if (legacy) { - var fn; - try { - fn = legacy.before(); - return !util.global.dispatchEvent(e); - } finally { - legacy.after(fn); - } - } else { - return !util.global.dispatchEvent(e); - } - }; - try { - if (typeof CustomEvent === "function") { - var event = new CustomEvent("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var eventData = { - detail: event, - cancelable: true - }; - var domEvent = new CustomEvent(name, eventData); - es5.defineProperty( - domEvent, "promise", {value: event.promise}); - es5.defineProperty( - domEvent, "reason", {value: event.reason}); - - return dispatch(legacyHandlers[name], domEvent); - }; - } else if (typeof Event === "function") { - var event = new Event("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = new Event(name, { - cancelable: true - }); - domEvent.detail = event; - es5.defineProperty(domEvent, "promise", {value: event.promise}); - es5.defineProperty(domEvent, "reason", {value: event.reason}); - return dispatch(legacyHandlers[name], domEvent); - }; - } else { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = document.createEvent("CustomEvent"); - domEvent.initCustomEvent(name, false, true, - event); - return dispatch(legacyHandlers[name], domEvent); - }; - } - } catch (e) {} - return function() { - return false; - }; -})(); - -var fireGlobalEvent = (function() { - if (util.isNode) { - return function() { - return process.emit.apply(process, arguments); - }; - } else { - if (!util.global) { - return function() { - return false; - }; - } - return function(name) { - var methodName = "on" + name.toLowerCase(); - var method = util.global[methodName]; - if (!method) return false; - method.apply(util.global, [].slice.call(arguments, 1)); - return true; - }; - } -})(); - -function generatePromiseLifecycleEventObject(name, promise) { - return {promise: promise}; -} - -var eventToObjectGenerator = { - promiseCreated: generatePromiseLifecycleEventObject, - promiseFulfilled: generatePromiseLifecycleEventObject, - promiseRejected: generatePromiseLifecycleEventObject, - promiseResolved: generatePromiseLifecycleEventObject, - promiseCancelled: generatePromiseLifecycleEventObject, - promiseChained: function(name, promise, child) { - return {promise: promise, child: child}; - }, - warning: function(name, warning) { - return {warning: warning}; - }, - unhandledRejection: function (name, reason, promise) { - return {reason: reason, promise: promise}; - }, - rejectionHandled: generatePromiseLifecycleEventObject -}; - -var activeFireEvent = function (name) { - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent.apply(null, arguments); - } catch (e) { - async.throwLater(e); - globalEventFired = true; - } - - var domEventFired = false; - try { - domEventFired = fireDomEvent(name, - eventToObjectGenerator[name].apply(null, arguments)); - } catch (e) { - async.throwLater(e); - domEventFired = true; - } - - return domEventFired || globalEventFired; -}; - -Promise.config = function(opts) { - opts = Object(opts); - if ("longStackTraces" in opts) { - if (opts.longStackTraces) { - Promise.longStackTraces(); - } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { - disableLongStackTraces(); - } - } - if ("warnings" in opts) { - var warningsOption = opts.warnings; - config.warnings = !!warningsOption; - wForgottenReturn = config.warnings; - - if (util.isObject(warningsOption)) { - if ("wForgottenReturn" in warningsOption) { - wForgottenReturn = !!warningsOption.wForgottenReturn; - } - } - } - if ("cancellation" in opts && opts.cancellation && !config.cancellation) { - if (async.haveItemsQueued()) { - throw new Error( - "cannot enable cancellation after promises are in use"); - } - Promise.prototype._clearCancellationData = - cancellationClearCancellationData; - Promise.prototype._propagateFrom = cancellationPropagateFrom; - Promise.prototype._onCancel = cancellationOnCancel; - Promise.prototype._setOnCancel = cancellationSetOnCancel; - Promise.prototype._attachCancellationCallback = - cancellationAttachCancellationCallback; - Promise.prototype._execute = cancellationExecute; - propagateFromFunction = cancellationPropagateFrom; - config.cancellation = true; - } - if ("monitoring" in opts) { - if (opts.monitoring && !config.monitoring) { - config.monitoring = true; - Promise.prototype._fireEvent = activeFireEvent; - } else if (!opts.monitoring && config.monitoring) { - config.monitoring = false; - Promise.prototype._fireEvent = defaultFireEvent; - } - } - if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) { - var prev = config.asyncHooks; - var cur = !!opts.asyncHooks; - if (prev !== cur) { - config.asyncHooks = cur; - if (cur) { - enableAsyncHooks(); - } else { - disableAsyncHooks(); - } - } - } - return Promise; -}; - -function defaultFireEvent() { return false; } - -Promise.prototype._fireEvent = defaultFireEvent; -Promise.prototype._execute = function(executor, resolve, reject) { - try { - executor(resolve, reject); - } catch (e) { - return e; - } -}; -Promise.prototype._onCancel = function () {}; -Promise.prototype._setOnCancel = function (handler) { ; }; -Promise.prototype._attachCancellationCallback = function(onCancel) { - ; -}; -Promise.prototype._captureStackTrace = function () {}; -Promise.prototype._attachExtraTrace = function () {}; -Promise.prototype._dereferenceTrace = function () {}; -Promise.prototype._clearCancellationData = function() {}; -Promise.prototype._propagateFrom = function (parent, flags) { - ; - ; -}; - -function cancellationExecute(executor, resolve, reject) { - var promise = this; - try { - executor(resolve, reject, function(onCancel) { - if (typeof onCancel !== "function") { - throw new TypeError("onCancel must be a function, got: " + - util.toString(onCancel)); - } - promise._attachCancellationCallback(onCancel); - }); - } catch (e) { - return e; - } -} - -function cancellationAttachCancellationCallback(onCancel) { - if (!this._isCancellable()) return this; - - var previousOnCancel = this._onCancel(); - if (previousOnCancel !== undefined) { - if (util.isArray(previousOnCancel)) { - previousOnCancel.push(onCancel); - } else { - this._setOnCancel([previousOnCancel, onCancel]); - } - } else { - this._setOnCancel(onCancel); - } -} - -function cancellationOnCancel() { - return this._onCancelField; -} - -function cancellationSetOnCancel(onCancel) { - this._onCancelField = onCancel; -} - -function cancellationClearCancellationData() { - this._cancellationParent = undefined; - this._onCancelField = undefined; -} - -function cancellationPropagateFrom(parent, flags) { - if ((flags & 1) !== 0) { - this._cancellationParent = parent; - var branchesRemainingToCancel = parent._branchesRemainingToCancel; - if (branchesRemainingToCancel === undefined) { - branchesRemainingToCancel = 0; - } - parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; - } - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} - -function bindingPropagateFrom(parent, flags) { - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} -var propagateFromFunction = bindingPropagateFrom; - -function boundValueFunction() { - var ret = this._boundTo; - if (ret !== undefined) { - if (ret instanceof Promise) { - if (ret.isFulfilled()) { - return ret.value(); - } else { - return undefined; - } - } - } - return ret; -} - -function longStackTracesCaptureStackTrace() { - this._trace = new CapturedTrace(this._peekContext()); -} - -function longStackTracesAttachExtraTrace(error, ignoreSelf) { - if (canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -} - -function longStackTracesDereferenceTrace() { - this._trace = undefined; -} - -function checkForgottenReturns(returnValue, promiseCreated, name, promise, - parent) { - if (returnValue === undefined && promiseCreated !== null && - wForgottenReturn) { - if (parent !== undefined && parent._returnedNonUndefined()) return; - if ((promise._bitField & 65535) === 0) return; - - if (name) name = name + " "; - var handlerLine = ""; - var creatorLine = ""; - if (promiseCreated._trace) { - var traceLines = promiseCreated._trace.stack.split("\n"); - var stack = cleanStack(traceLines); - for (var i = stack.length - 1; i >= 0; --i) { - var line = stack[i]; - if (!nodeFramePattern.test(line)) { - var lineMatches = line.match(parseLinePattern); - if (lineMatches) { - handlerLine = "at " + lineMatches[1] + - ":" + lineMatches[2] + ":" + lineMatches[3] + " "; - } - break; - } - } - - if (stack.length > 0) { - var firstUserLine = stack[0]; - for (var i = 0; i < traceLines.length; ++i) { - - if (traceLines[i] === firstUserLine) { - if (i > 0) { - creatorLine = "\n" + traceLines[i - 1]; - } - break; - } - } - - } - } - var msg = "a promise was created in a " + name + - "handler " + handlerLine + "but was not returned from it, " + - "see http://goo.gl/rRqMUw" + - creatorLine; - promise._warn(msg, true, promiseCreated); - } -} - -function deprecated(name, replacement) { - var message = name + - " is deprecated and will be removed in a future version."; - if (replacement) message += " Use " + replacement + " instead."; - return warn(message); -} - -function warn(message, shouldUseOwnTrace, promise) { - if (!config.warnings) return; - var warning = new Warning(message); - var ctx; - if (shouldUseOwnTrace) { - promise._attachExtraTrace(warning); - } else if (config.longStackTraces && (ctx = Promise._peekContext())) { - ctx.attachExtraTrace(warning); - } else { - var parsed = parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - - if (!activeFireEvent("warning", warning)) { - formatAndLogError(warning, "", true); - } -} - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = " (No stack trace)" === line || - stackFramePattern.test(line); - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0 && error.name != "SyntaxError") { - stack = stack.slice(i); - } - return stack; -} - -function parseStackAndMessage(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: error.name == "SyntaxError" ? stack : cleanStack(stack) - }; -} - -function formatAndLogError(error, title, isSoft) { - if (typeof console !== "undefined") { - var message; - if (util.isObject(error)) { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof printWarning === "function") { - printWarning(message, isSoft); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -} - -function fireRejectionEvent(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - if (name === "unhandledRejection") { - if (!activeFireEvent(name, reason, promise) && !localEventFired) { - formatAndLogError(reason, "Unhandled rejection "); - } - } else { - activeFireEvent(name, promise); - } -} - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj && typeof obj.toString === "function" - ? obj.toString() : util.toString(obj); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -function longStackTracesIsSupported() { - return typeof captureStackTrace === "function"; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} - -function setBounds(firstLineError, lastLineError) { - if (!longStackTracesIsSupported()) return; - var firstStackLines = (firstLineError.stack || "").split("\n"); - var lastStackLines = (lastLineError.stack || "").split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -} - -function CapturedTrace(parent) { - this._parent = parent; - this._promisesCreated = 0; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); -Context.CapturedTrace = CapturedTrace; - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit += 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit += 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit -= 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow && - typeof Error.stackTraceLimit === "number") { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit += 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit -= 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - printWarning = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - printWarning = function(message, isSoft) { - var color = isSoft ? "\u001b[33m" : "\u001b[31m"; - console.warn(color + message + "\u001b[0m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - printWarning = function(message, isSoft) { - console.warn("%c" + message, - isSoft ? "color: darkorange" : "color: red"); - }; - } -} - -var config = { - warnings: warnings, - longStackTraces: false, - cancellation: false, - monitoring: false, - asyncHooks: false -}; - -if (longStackTraces) Promise.longStackTraces(); - -return { - asyncHooks: function() { - return config.asyncHooks; - }, - longStackTraces: function() { - return config.longStackTraces; - }, - warnings: function() { - return config.warnings; - }, - cancellation: function() { - return config.cancellation; - }, - monitoring: function() { - return config.monitoring; - }, - propagateFromFunction: function() { - return propagateFromFunction; - }, - boundValueFunction: function() { - return boundValueFunction; - }, - checkForgottenReturns: checkForgottenReturns, - setBounds: setBounds, - warn: warn, - deprecated: deprecated, - CapturedTrace: CapturedTrace, - fireDomEvent: fireDomEvent, - fireGlobalEvent: fireGlobalEvent -}; -}; - -},{"./errors":9,"./es5":10,"./util":21}],8:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function returner() { - return this.value; -} -function thrower() { - throw this.reason; -} - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - returner, undefined, undefined, {value: value}, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - return this._then( - thrower, undefined, undefined, {reason: reason}, undefined); -}; - -Promise.prototype.catchThrow = function (reason) { - if (arguments.length <= 1) { - return this._then( - undefined, thrower, undefined, {reason: reason}, undefined); - } else { - var _reason = arguments[1]; - var handler = function() {throw _reason;}; - return this.caught(reason, handler); - } -}; - -Promise.prototype.catchReturn = function (value) { - if (arguments.length <= 1) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - undefined, returner, undefined, {value: value}, undefined); - } else { - var _value = arguments[1]; - if (_value instanceof Promise) _value.suppressUnhandledRejections(); - var handler = function() {return _value;}; - return this.caught(value, handler); - } -}; -}; - -},{}],9:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var Objectfreeze = es5.freeze; -var util = _dereq_("./util"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - es5.defineProperty(Error, "__BluebirdErrorTypes__", { - value: errorTypes, - writable: false, - enumerable: false, - configurable: false - }); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; - -},{"./es5":10,"./util":21}],10:[function(_dereq_,module,exports){ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} - -},{}],11:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { -var util = _dereq_("./util"); -var CancellationError = Promise.CancellationError; -var errorObj = util.errorObj; -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); - -function PassThroughHandlerContext(promise, type, handler) { - this.promise = promise; - this.type = type; - this.handler = handler; - this.called = false; - this.cancelPromise = null; -} - -PassThroughHandlerContext.prototype.isFinallyHandler = function() { - return this.type === 0; -}; - -function FinallyHandlerCancelReaction(finallyHandler) { - this.finallyHandler = finallyHandler; -} - -FinallyHandlerCancelReaction.prototype._resultCancelled = function() { - checkCancel(this.finallyHandler); -}; - -function checkCancel(ctx, reason) { - if (ctx.cancelPromise != null) { - if (arguments.length > 1) { - ctx.cancelPromise._reject(reason); - } else { - ctx.cancelPromise._cancel(); - } - ctx.cancelPromise = null; - return true; - } - return false; -} - -function succeed() { - return finallyHandler.call(this, this.promise._target()._settledValue()); -} -function fail(reason) { - if (checkCancel(this, reason)) return; - errorObj.e = reason; - return errorObj; -} -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - if (!this.called) { - this.called = true; - var ret = this.isFinallyHandler() - ? handler.call(promise._boundValue()) - : handler.call(promise._boundValue(), reasonOrValue); - if (ret === NEXT_FILTER) { - return ret; - } else if (ret !== undefined) { - promise._setReturnedNonUndefined(); - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - if (this.cancelPromise != null) { - if (maybePromise._isCancelled()) { - var reason = - new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - errorObj.e = reason; - return errorObj; - } else if (maybePromise.isPending()) { - maybePromise._attachCancellationCallback( - new FinallyHandlerCancelReaction(this)); - } - } - return maybePromise._then( - succeed, fail, undefined, this, undefined); - } - } - } - - if (promise.isRejected()) { - checkCancel(this); - errorObj.e = reasonOrValue; - return errorObj; - } else { - checkCancel(this); - return reasonOrValue; - } -} - -Promise.prototype._passThrough = function(handler, type, success, fail) { - if (typeof handler !== "function") return this.then(); - return this._then(success, - fail, - undefined, - new PassThroughHandlerContext(this, type, handler), - undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThrough(handler, - 0, - finallyHandler, - finallyHandler); -}; - - -Promise.prototype.tap = function (handler) { - return this._passThrough(handler, 1, finallyHandler); -}; - -Promise.prototype.tapCatch = function (handlerOrPredicate) { - var len = arguments.length; - if(len === 1) { - return this._passThrough(handlerOrPredicate, - 1, - undefined, - finallyHandler); - } else { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return Promise.reject(new TypeError( - "tapCatch statement predicate: " - + "expecting an object but got " + util.classString(item) - )); - } - } - catchInstances.length = j; - var handler = arguments[i]; - return this._passThrough(catchFilter(catchInstances, handler, this), - 1, - undefined, - finallyHandler); - } - -}; - -return PassThroughHandlerContext; -}; - -},{"./catch_filter":5,"./util":21}],12:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) { -var util = _dereq_("./util"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!true) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var promiseSetter = function(i) { - return new Function("promise", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = promise; \n\ - ".replace(/Index/g, i)); - }; - - var generateHolderClass = function(total) { - var props = new Array(total); - for (var i = 0; i < props.length; ++i) { - props[i] = "this.p" + (i+1); - } - var assignment = props.join(" = ") + " = null;"; - var cancellationCode= "var promise;\n" + props.map(function(prop) { - return " \n\ - promise = " + prop + "; \n\ - if (promise instanceof Promise) { \n\ - promise.cancel(); \n\ - } \n\ - "; - }).join("\n"); - var passedArguments = props.join(", "); - var name = "Holder$" + total; - - - var code = "return function(tryCatch, errorObj, Promise, async) { \n\ - 'use strict'; \n\ - function [TheName](fn) { \n\ - [TheProperties] \n\ - this.fn = fn; \n\ - this.asyncNeeded = true; \n\ - this.now = 0; \n\ - } \n\ - \n\ - [TheName].prototype._callFunction = function(promise) { \n\ - promise._pushContext(); \n\ - var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ - promise._popContext(); \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(ret.e, false); \n\ - } else { \n\ - promise._resolveCallback(ret); \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype.checkFulfillment = function(promise) { \n\ - var now = ++this.now; \n\ - if (now === [TheTotal]) { \n\ - if (this.asyncNeeded) { \n\ - async.invoke(this._callFunction, this, promise); \n\ - } else { \n\ - this._callFunction(promise); \n\ - } \n\ - \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype._resultCancelled = function() { \n\ - [CancellationCode] \n\ - }; \n\ - \n\ - return [TheName]; \n\ - }(tryCatch, errorObj, Promise, async); \n\ - "; - - code = code.replace(/\[TheName\]/g, name) - .replace(/\[TheTotal\]/g, total) - .replace(/\[ThePassedArguments\]/g, passedArguments) - .replace(/\[TheProperties\]/g, assignment) - .replace(/\[CancellationCode\]/g, cancellationCode); - - return new Function("tryCatch", "errorObj", "Promise", "async", code) - (tryCatch, errorObj, Promise, async); - }; - - var holderClasses = []; - var thenCallbacks = []; - var promiseSetters = []; - - for (var i = 0; i < 8; ++i) { - holderClasses.push(generateHolderClass(i + 1)); - thenCallbacks.push(thenCallback(i + 1)); - promiseSetters.push(promiseSetter(i + 1)); - } - - reject = function (reason) { - this._reject(reason); - }; -}} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!true) { - if (last <= 8 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var HolderClass = holderClasses[last - 1]; - var holder = new HolderClass(fn); - var callbacks = thenCallbacks; - - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - promiseSetters[i](maybePromise, holder); - holder.asyncNeeded = false; - } else if (((bitField & 33554432) !== 0)) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else if (((bitField & 16777216) !== 0)) { - ret._reject(maybePromise._reason()); - } else { - ret._cancel(); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - - if (!ret._isFateSealed()) { - if (holder.asyncNeeded) { - var context = Promise._getContext(); - holder.fn = util.contextBind(context, holder.fn); - } - ret._setAsyncGuaranteed(); - ret._setOnCancel(holder); - } - return ret; - } - } - } - var args = [].slice.call(arguments);; - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; - -},{"./util":21}],13:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.method", ret); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value; - if (arguments.length > 1) { - debug.deprecated("calling Promise.try with more than 1 argument"); - var arg = arguments[1]; - var ctx = arguments[2]; - value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) - : tryCatch(fn).call(ctx, arg); - } else { - value = tryCatch(fn)(); - } - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.try", ret); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false); - } else { - this._resolveCallback(value, true); - } -}; -}; - -},{"./util":21}],14:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = _dereq_("./errors"); -var OperationalError = errors.OperationalError; -var es5 = _dereq_("./es5"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise, multiArgs) { - return function(err, value) { - if (promise === null) return; - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (!multiArgs) { - promise._fulfill(value); - } else { - var args = [].slice.call(arguments, 1);; - promise._fulfill(args); - } - promise = null; - }; -} - -module.exports = nodebackForPromise; - -},{"./errors":9,"./es5":10,"./util":21}],15:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var reflectHandler = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -function Proxyable() {} -var UNDEFINED_BINDING = {}; -var util = _dereq_("./util"); -util.setReflectHandler(reflectHandler); - -var getDomain = function() { - var domain = process.domain; - if (domain === undefined) { - return null; - } - return domain; -}; -var getContextDefault = function() { - return null; -}; -var getContextDomain = function() { - return { - domain: getDomain(), - async: null - }; -}; -var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ? - _dereq_("async_hooks").AsyncResource : null; -var getContextAsyncHooks = function() { - return { - domain: getDomain(), - async: new AsyncResource("Bluebird::Promise") - }; -}; -var getContext = util.isNode ? getContextDomain : getContextDefault; -util.notEnumerableProp(Promise, "_getContext", getContext); -var enableAsyncHooks = function() { - getContext = getContextAsyncHooks; - util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks); -}; -var disableAsyncHooks = function() { - getContext = getContextDomain; - util.notEnumerableProp(Promise, "_getContext", getContextDomain); -}; - -var es5 = _dereq_("./es5"); -var Async = _dereq_("./async"); -var async = new Async(); -es5.defineProperty(Promise, "_async", {value: async}); -var errors = _dereq_("./errors"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -var CancellationError = Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {}; -var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL); -var PromiseArray = - _dereq_("./promise_array")(Promise, INTERNAL, - tryConvertToPromise, apiRejection, Proxyable); -var Context = _dereq_("./context")(Promise); - /*jshint unused:false*/ -var createContext = Context.create; - -var debug = _dereq_("./debuggability")(Promise, Context, - enableAsyncHooks, disableAsyncHooks); -var CapturedTrace = debug.CapturedTrace; -var PassThroughHandlerContext = - _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); -var nodebackForPromise = _dereq_("./nodeback"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function check(self, executor) { - if (self == null || self.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (typeof executor !== "function") { - throw new TypeError("expecting a function but got " + util.classString(executor)); - } - -} - -function Promise(executor) { - if (executor !== INTERNAL) { - check(this, executor); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._resolveFromExecutor(executor); - this._promiseCreated(); - this._fireEvent("promiseCreated", this); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return apiRejection("Catch statement predicate: " + - "expecting an object but got " + util.classString(item)); - } - } - catchInstances.length = j; - fn = arguments[i]; - - if (typeof fn !== "function") { - throw new TypeError("The last argument to .catch() " + - "must be a function, got " + util.toString(fn)); - } - return this.then(undefined, catchFilter(catchInstances, fn, this)); - } - return this.then(undefined, fn); -}; - -Promise.prototype.reflect = function () { - return this._then(reflectHandler, - reflectHandler, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject) { - if (debug.warnings() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, undefined, undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject) { - var promise = - this._then(didFulfill, didReject, undefined, undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - return this.all()._then(fn, undefined, undefined, APPLY, undefined); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - if (arguments.length > 0) { - this._warn(".all() was passed arguments but it does not take any"); - } - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.getNewLibraryCopy = module.exports; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = Promise.fromCallback = function(fn) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs - : false; - var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); - if (result === errorObj) { - ret._rejectCallback(result.e, true); - } - if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._setFulfilled(); - ret._rejectionHandler0 = obj; - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - return async.setScheduler(fn); -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - _, receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var promise = haveInternalData ? internalData : new Promise(INTERNAL); - var target = this._target(); - var bitField = target._bitField; - - if (!haveInternalData) { - promise._propagateFrom(this, 3); - promise._captureStackTrace(); - if (receiver === undefined && - ((this._bitField & 2097152) !== 0)) { - if (!((bitField & 50397184) === 0)) { - receiver = this._boundValue(); - } else { - receiver = target === this ? undefined : this._boundTo; - } - } - this._fireEvent("promiseChained", this, promise); - } - - var context = getContext(); - if (!((bitField & 50397184) === 0)) { - var handler, value, settler = target._settlePromiseCtx; - if (((bitField & 33554432) !== 0)) { - value = target._rejectionHandler0; - handler = didFulfill; - } else if (((bitField & 16777216) !== 0)) { - value = target._fulfillmentHandler0; - handler = didReject; - target._unsetRejectionIsUnhandled(); - } else { - settler = target._settlePromiseLateCancellationObserver; - value = new CancellationError("late cancellation observer"); - target._attachExtraTrace(value); - handler = didReject; - } - - async.invoke(settler, target, { - handler: util.contextBind(context, handler), - promise: promise, - receiver: receiver, - value: value - }); - } else { - target._addCallbacks(didFulfill, didReject, promise, - receiver, context); - } - - return promise; -}; - -Promise.prototype._length = function () { - return this._bitField & 65535; -}; - -Promise.prototype._isFateSealed = function () { - return (this._bitField & 117506048) !== 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 67108864) === 67108864; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -65536) | - (len & 65535); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 33554432; - this._fireEvent("promiseFulfilled", this); -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 16777216; - this._fireEvent("promiseRejected", this); -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 67108864; - this._fireEvent("promiseResolved", this); -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._unsetCancelled = function() { - this._bitField = this._bitField & (~65536); -}; - -Promise.prototype._setCancelled = function() { - this._bitField = this._bitField | 65536; - this._fireEvent("promiseCancelled", this); -}; - -Promise.prototype._setWillBeCancelled = function() { - this._bitField = this._bitField | 8388608; -}; - -Promise.prototype._setAsyncGuaranteed = function() { - if (async.hasCustomScheduler()) return; - var bitField = this._bitField; - this._bitField = bitField | - (((bitField & 536870912) >> 2) ^ - 134217728); -}; - -Promise.prototype._setNoAsyncGuarantee = function() { - this._bitField = (this._bitField | 536870912) & - (~134217728); -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 ? this._receiver0 : this[ - index * 4 - 4 + 3]; - if (ret === UNDEFINED_BINDING) { - return undefined; - } else if (ret === undefined && this._isBound()) { - return this._boundValue(); - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return this[ - index * 4 - 4 + 2]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return this[ - index * 4 - 4 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return this[ - index * 4 - 4 + 1]; -}; - -Promise.prototype._boundValue = function() {}; - -Promise.prototype._migrateCallback0 = function (follower) { - var bitField = follower._bitField; - var fulfill = follower._fulfillmentHandler0; - var reject = follower._rejectionHandler0; - var promise = follower._promise0; - var receiver = follower._receiverAt(0); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._migrateCallbackAt = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - promise, - receiver, - context -) { - var index = this._length(); - - if (index >= 65535 - 4) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - this._receiver0 = receiver; - if (typeof fulfill === "function") { - this._fulfillmentHandler0 = util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this._rejectionHandler0 = util.contextBind(context, reject); - } - } else { - var base = index * 4 - 4; - this[base + 2] = promise; - this[base + 3] = receiver; - if (typeof fulfill === "function") { - this[base + 0] = - util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this[base + 1] = - util.contextBind(context, reject); - } - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._proxy = function (proxyable, arg) { - this._addCallbacks(undefined, undefined, arg, proxyable, null); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (((this._bitField & 117506048) !== 0)) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - if (shouldBind) this._propagateFrom(maybePromise, 2); - - - var promise = maybePromise._target(); - - if (promise === this) { - this._reject(makeSelfResolutionError()); - return; - } - - var bitField = promise._bitField; - if (((bitField & 50397184) === 0)) { - var len = this._length(); - if (len > 0) promise._migrateCallback0(this); - for (var i = 1; i < len; ++i) { - promise._migrateCallbackAt(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(maybePromise); - } else if (((bitField & 33554432) !== 0)) { - this._fulfill(promise._value()); - } else if (((bitField & 16777216) !== 0)) { - this._reject(promise._reason()); - } else { - var reason = new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - this._reject(reason); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, ignoreNonErrorWarnings) { - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { - var message = "a promise was rejected with a non-error: " + - util.classString(reason); - this._warn(message, true); - } - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason); -}; - -Promise.prototype._resolveFromExecutor = function (executor) { - if (executor === INTERNAL) return; - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = this._execute(executor, function(value) { - promise._resolveCallback(value); - }, function (reason) { - promise._rejectCallback(reason, synchronous); - }); - synchronous = false; - this._popContext(); - - if (r !== undefined) { - promise._rejectCallback(r, true); - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - var bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - promise._pushContext(); - var x; - if (receiver === APPLY) { - if (!value || typeof value.length !== "number") { - x = errorObj; - x.e = new TypeError("cannot .spread() a non-array: " + - util.classString(value)); - } else { - x = tryCatch(handler).apply(this._boundValue(), value); - } - } else { - x = tryCatch(handler).call(receiver, value); - } - var promiseCreated = promise._popContext(); - bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - - if (x === NEXT_FILTER) { - promise._reject(value); - } else if (x === errorObj) { - promise._rejectCallback(x.e, false); - } else { - debug.checkForgottenReturns(x, promiseCreated, "", promise, this); - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._settlePromise = function(promise, handler, receiver, value) { - var isPromise = promise instanceof Promise; - var bitField = this._bitField; - var asyncGuaranteed = ((bitField & 134217728) !== 0); - if (((bitField & 65536) !== 0)) { - if (isPromise) promise._invokeInternalOnCancel(); - - if (receiver instanceof PassThroughHandlerContext && - receiver.isFinallyHandler()) { - receiver.cancelPromise = promise; - if (tryCatch(handler).call(receiver, value) === errorObj) { - promise._reject(errorObj.e); - } - } else if (handler === reflectHandler) { - promise._fulfill(reflectHandler.call(receiver)); - } else if (receiver instanceof Proxyable) { - receiver._promiseCancelled(promise); - } else if (isPromise || promise instanceof PromiseArray) { - promise._cancel(); - } else { - receiver.cancel(); - } - } else if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof Proxyable) { - if (!receiver._isResolved()) { - if (((bitField & 33554432) !== 0)) { - receiver._promiseFulfilled(value, promise); - } else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - if (((bitField & 33554432) !== 0)) { - promise._fulfill(value); - } else { - promise._reject(value); - } - } -}; - -Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { - var handler = ctx.handler; - var promise = ctx.promise; - var receiver = ctx.receiver; - var value = ctx.value; - if (typeof handler === "function") { - if (!(promise instanceof Promise)) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (promise instanceof Promise) { - promise._reject(value); - } -}; - -Promise.prototype._settlePromiseCtx = function(ctx) { - this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); -}; - -Promise.prototype._settlePromise0 = function(handler, value, bitField) { - var promise = this._promise0; - var receiver = this._receiverAt(0); - this._promise0 = undefined; - this._receiver0 = undefined; - this._settlePromise(promise, handler, receiver, value); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - var base = index * 4 - 4; - this[base + 2] = - this[base + 3] = - this[base + 0] = - this[base + 1] = undefined; -}; - -Promise.prototype._fulfill = function (value) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._reject(err); - } - this._setFulfilled(); - this._rejectionHandler0 = value; - - if ((bitField & 65535) > 0) { - if (((bitField & 134217728) !== 0)) { - this._settlePromises(); - } else { - async.settlePromises(this); - } - this._dereferenceTrace(); - } -}; - -Promise.prototype._reject = function (reason) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - this._setRejected(); - this._fulfillmentHandler0 = reason; - - if (this._isFinal()) { - return async.fatalError(reason, util.isNode); - } - - if ((bitField & 65535) > 0) { - async.settlePromises(this); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._fulfillPromises = function (len, value) { - for (var i = 1; i < len; i++) { - var handler = this._fulfillmentHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, value); - } -}; - -Promise.prototype._rejectPromises = function (len, reason) { - for (var i = 1; i < len; i++) { - var handler = this._rejectionHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, reason); - } -}; - -Promise.prototype._settlePromises = function () { - var bitField = this._bitField; - var len = (bitField & 65535); - - if (len > 0) { - if (((bitField & 16842752) !== 0)) { - var reason = this._fulfillmentHandler0; - this._settlePromise0(this._rejectionHandler0, reason, bitField); - this._rejectPromises(len, reason); - } else { - var value = this._rejectionHandler0; - this._settlePromise0(this._fulfillmentHandler0, value, bitField); - this._fulfillPromises(len, value); - } - this._setLength(0); - } - this._clearCancellationData(); -}; - -Promise.prototype._settledValue = function() { - var bitField = this._bitField; - if (((bitField & 33554432) !== 0)) { - return this._rejectionHandler0; - } else if (((bitField & 16777216) !== 0)) { - return this._fulfillmentHandler0; - } -}; - -if (typeof Symbol !== "undefined" && Symbol.toStringTag) { - es5.defineProperty(Promise.prototype, Symbol.toStringTag, { - get: function () { - return "Object"; - } - }); -} - -function deferResolve(v) {this.promise._resolveCallback(v);} -function deferReject(v) {this.promise._rejectCallback(v, false);} - -Promise.defer = Promise.pending = function() { - debug.deprecated("Promise.defer", "new Promise"); - var promise = new Promise(INTERNAL); - return { - promise: promise, - resolve: deferResolve, - reject: deferReject - }; -}; - -util.notEnumerableProp(Promise, - "_makeSelfResolutionError", - makeSelfResolutionError); - -_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, - debug); -_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); -_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); -_dereq_("./direct_resolve")(Promise); -_dereq_("./synchronous_inspection")(Promise); -_dereq_("./join")( - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async); -Promise.Promise = Promise; -Promise.version = "3.7.1"; - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - debug.setBounds(Async.firstLineError, util.lastLineError); - return Promise; - -}; - -},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21,"async_hooks":undefined}],16:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection, Proxyable) { -var util = _dereq_("./util"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - case -6: return new Map(); - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - if (values instanceof Promise) { - promise._propagateFrom(values, 3); - values.suppressUnhandledRejections(); - } - promise._setOnCancel(this); - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -util.inherits(PromiseArray, Proxyable); - -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - var bitField = values._bitField; - ; - this._values = values; - - if (((bitField & 50397184) === 0)) { - this._promise._setAsyncGuaranteed(); - return values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - } else if (((bitField & 33554432) !== 0)) { - values = values._value(); - } else if (((bitField & 16777216) !== 0)) { - return this._reject(values._reason()); - } else { - return this._cancel(); - } - } - values = util.asArray(values); - if (values === null) { - var err = apiRejection( - "expecting an array or an iterable object but got " + util.classString(values)).reason(); - this._promise._rejectCallback(err, false); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - this._iterate(values); -}; - -PromiseArray.prototype._iterate = function(values) { - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var result = this._promise; - var isResolved = false; - var bitField = null; - for (var i = 0; i < len; ++i) { - var maybePromise = tryConvertToPromise(values[i], result); - - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - bitField = maybePromise._bitField; - } else { - bitField = null; - } - - if (isResolved) { - if (bitField !== null) { - maybePromise.suppressUnhandledRejections(); - } - } else if (bitField !== null) { - if (((bitField & 50397184) === 0)) { - maybePromise._proxy(this, i); - this._values[i] = maybePromise; - } else if (((bitField & 33554432) !== 0)) { - isResolved = this._promiseFulfilled(maybePromise._value(), i); - } else if (((bitField & 16777216) !== 0)) { - isResolved = this._promiseRejected(maybePromise._reason(), i); - } else { - isResolved = this._promiseCancelled(i); - } - } else { - isResolved = this._promiseFulfilled(maybePromise, i); - } - } - if (!isResolved) result._setAsyncGuaranteed(); -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype._cancel = function() { - if (this._isResolved() || !this._promise._isCancellable()) return; - this._values = null; - this._promise._cancel(); -}; - -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false); -}; - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; - -PromiseArray.prototype._promiseCancelled = function() { - this._cancel(); - return true; -}; - -PromiseArray.prototype._promiseRejected = function (reason) { - this._totalResolved++; - this._reject(reason); - return true; -}; - -PromiseArray.prototype._resultCancelled = function() { - if (this._isResolved()) return; - var values = this._values; - this._cancel(); - if (values instanceof Promise) { - values.cancel(); - } else { - for (var i = 0; i < values.length; ++i) { - if (values[i] instanceof Promise) { - values[i].cancel(); - } - } - } -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; - -},{"./util":21}],17:[function(_dereq_,module,exports){ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; - -},{}],18:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var schedule; -var noAsyncScheduler = function() { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var NativePromise = util.getNativePromise(); -if (util.isNode && typeof MutationObserver === "undefined") { - var GlobalSetImmediate = global.setImmediate; - var ProcessNextTick = process.nextTick; - schedule = util.isRecentNode - ? function(fn) { GlobalSetImmediate.call(global, fn); } - : function(fn) { ProcessNextTick.call(process, fn); }; -} else if (typeof NativePromise === "function" && - typeof NativePromise.resolve === "function") { - var nativePromise = NativePromise.resolve(); - schedule = function(fn) { - nativePromise.then(fn); - }; -} else if ((typeof MutationObserver !== "undefined") && - !(typeof window !== "undefined" && - window.navigator && - (window.navigator.standalone || window.cordova)) && - ("classList" in document.documentElement)) { - schedule = (function() { - var div = document.createElement("div"); - var opts = {attributes: true}; - var toggleScheduled = false; - var div2 = document.createElement("div"); - var o2 = new MutationObserver(function() { - div.classList.toggle("foo"); - toggleScheduled = false; - }); - o2.observe(div2, opts); - - var scheduleToggle = function() { - if (toggleScheduled) return; - toggleScheduled = true; - div2.classList.toggle("foo"); - }; - - return function schedule(fn) { - var o = new MutationObserver(function() { - o.disconnect(); - fn(); - }); - o.observe(div, opts); - scheduleToggle(); - }; - })(); -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; - -},{"./util":21}],19:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValueField = promise._isFateSealed() - ? promise._settledValue() : undefined; - } - else { - this._bitField = 0; - this._settledValueField = undefined; - } -} - -PromiseInspection.prototype._settledValue = function() { - return this._settledValueField; -}; - -var value = PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var reason = PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { - return (this._bitField & 33554432) !== 0; -}; - -var isRejected = PromiseInspection.prototype.isRejected = function () { - return (this._bitField & 16777216) !== 0; -}; - -var isPending = PromiseInspection.prototype.isPending = function () { - return (this._bitField & 50397184) === 0; -}; - -var isResolved = PromiseInspection.prototype.isResolved = function () { - return (this._bitField & 50331648) !== 0; -}; - -PromiseInspection.prototype.isCancelled = function() { - return (this._bitField & 8454144) !== 0; -}; - -Promise.prototype.__isCancelled = function() { - return (this._bitField & 65536) === 65536; -}; - -Promise.prototype._isCancelled = function() { - return this._target().__isCancelled(); -}; - -Promise.prototype.isCancelled = function() { - return (this._target()._bitField & 8454144) !== 0; -}; - -Promise.prototype.isPending = function() { - return isPending.call(this._target()); -}; - -Promise.prototype.isRejected = function() { - return isRejected.call(this._target()); -}; - -Promise.prototype.isFulfilled = function() { - return isFulfilled.call(this._target()); -}; - -Promise.prototype.isResolved = function() { - return isResolved.call(this._target()); -}; - -Promise.prototype.value = function() { - return value.call(this._target()); -}; - -Promise.prototype.reason = function() { - var target = this._target(); - target._unsetRejectionIsUnhandled(); - return reason.call(target); -}; - -Promise.prototype._value = function() { - return this._settledValue(); -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue(); -}; - -Promise.PromiseInspection = PromiseInspection; -}; - -},{}],20:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) return obj; - var then = getThen(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfill, - ret._reject, - undefined, - ret, - null - ); - return ret; - } - return doThenable(obj, then, context); - } - } - return obj; -} - -function doGetThen(obj) { - return obj.then; -} - -function getThen(obj) { - try { - return doGetThen(obj); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - try { - return hasProp.call(obj, "_promise0"); - } catch (e) { - return false; - } -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, resolve, reject); - synchronous = false; - - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolve(value) { - if (!promise) return; - promise._resolveCallback(value); - promise = null; - } - - function reject(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - return ret; -} - -return tryConvertToPromise; -}; - -},{"./util":21}],21:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var canEvaluate = typeof navigator == "undefined"; - -var errorObj = {e: {}}; -var tryCatchTarget; -var globalObject = typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - typeof global !== "undefined" ? global : - this !== undefined ? this : null; - -function tryCatcher() { - try { - var target = tryCatchTarget; - tryCatchTarget = null; - return target.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return typeof value === "function" || - typeof value === "object" && value !== null; -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - var excludedPrototypes = [ - Array.prototype, - Object.prototype, - Function.prototype - ]; - - var isExcludedProto = function(val) { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (excludedPrototypes[i] === val) { - return true; - } - } - return false; - }; - - if (es5.isES5) { - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && !isExcludedProto(obj)) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - var hasProp = {}.hasOwnProperty; - return function(obj) { - if (isExcludedProto(obj)) return []; - var ret = []; - - /*jshint forin:false */ - enumeration: for (var key in obj) { - if (hasProp.call(obj, key)) { - ret.push(key); - } else { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (hasProp.call(excludedPrototypes[i], key)) { - continue enumeration; - } - } - ret.push(key); - } - } - return ret; - }; - } - -})(); - -var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - - var hasMethods = es5.isES5 && keys.length > 1; - var hasMethodsOtherThanConstructor = keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - var hasThisAssignmentAndStaticMethods = - thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; - - if (hasMethods || hasMethodsOtherThanConstructor || - hasThisAssignmentAndStaticMethods) { - return true; - } - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function FakeConstructor() {} - FakeConstructor.prototype = obj; - var receiver = new FakeConstructor(); - function ic() { - return typeof receiver.foo; - } - ic(); - ic(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function isError(obj) { - return obj instanceof Error || - (obj !== null && - typeof obj === "object" && - typeof obj.message === "string" && - typeof obj.name === "string"); -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return isError(obj) && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - try { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } catch (ignore) {} - } - } -} - -var asArray = function(v) { - if (es5.isArray(v)) { - return v; - } - return null; -}; - -if (typeof Symbol !== "undefined" && Symbol.iterator) { - var ArrayFrom = typeof Array.from === "function" ? function(v) { - return Array.from(v); - } : function(v) { - var ret = []; - var it = v[Symbol.iterator](); - var itResult; - while (!((itResult = it.next()).done)) { - ret.push(itResult.value); - } - return ret; - }; - - asArray = function(v) { - if (es5.isArray(v)) { - return v; - } else if (v != null && typeof v[Symbol.iterator] === "function") { - return ArrayFrom(v); - } - return null; - }; -} - -var isNode = typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]"; - -var hasEnvVariables = typeof process !== "undefined" && - typeof process.env !== "undefined"; - -function env(key) { - return hasEnvVariables ? process.env[key] : undefined; -} - -function getNativePromise() { - if (typeof Promise === "function") { - try { - var promise = new Promise(function(){}); - if (classString(promise) === "[object Promise]") { - return Promise; - } - } catch (e) {} - } -} - -var reflectHandler; -function contextBind(ctx, cb) { - if (ctx === null || - typeof cb !== "function" || - cb === reflectHandler) { - return cb; - } - - if (ctx.domain !== null) { - cb = ctx.domain.bind(cb); - } - - var async = ctx.async; - if (async !== null) { - var old = cb; - cb = function() { - var args = (new Array(2)).concat([].slice.call(arguments));; - args[0] = old; - args[1] = this; - return async.runInAsyncScope.apply(async, args); - }; - } - return cb; -} - -var ret = { - setReflectHandler: function(fn) { - reflectHandler = fn; - }, - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - asArray: asArray, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - isError: isError, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - isNode: isNode, - hasEnvVariables: hasEnvVariables, - env: env, - global: globalObject, - getNativePromise: getNativePromise, - contextBind: contextBind -}; -ret.isRecentNode = ret.isNode && (function() { - var version; - if (process.versions && process.versions.node) { - version = process.versions.node.split(".").map(Number); - } else if (process.version) { - version = process.version.split(".").map(Number); - } - return (version[0] === 0 && version[1] > 10) || (version[0] > 0); -})(); -ret.nodeSupportsAsyncResource = ret.isNode && (function() { - var supportsAsync = false; - try { - var res = _dereq_("async_hooks").AsyncResource; - supportsAsync = typeof res.prototype.runInAsyncScope === "function"; - } catch (e) { - supportsAsync = false; - } - return supportsAsync; -})(); - -if (ret.isNode) ret.toFastProperties(process); - -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; - -},{"./es5":10,"async_hooks":undefined}]},{},[3])(3) -}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } \ No newline at end of file diff --git a/node_modules/bluebird/js/browser/bluebird.core.min.js b/node_modules/bluebird/js/browser/bluebird.core.min.js deleted file mode 100644 index 79831ee9..00000000 --- a/node_modules/bluebird/js/browser/bluebird.core.min.js +++ /dev/null @@ -1,31 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 3.7.1 - * Features enabled: core - * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each -*/ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function o(a,s){if(!e[a]){if(!t[a]){var c="function"==typeof _dereq_&&_dereq_;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return o(n?n:e)},u,u.exports,r,t,e,n)}return e[a].exports}for(var i="function"==typeof _dereq_&&_dereq_,a=0;a0;)c(t)}function c(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),r=t.shift();e.call(n,r)}}var l;try{throw new Error}catch(u){l=u}var f=t("./schedule"),p=t("./queue");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},r.prototype.invokeLater=o,r.prototype.invoke=i,r.prototype.settlePromises=a,r.prototype._drainQueues=function(){s(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,s(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=l},{"./queue":17,"./schedule":18}],2:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var o=!1,i=function(t,e){this._reject(e)},a=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(i,i,null,this,t)},s=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(i){o||(o=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(i),u=new t(e);u._propagateFrom(this,1);var f=this._target();if(u._setBoundTo(l),l instanceof t){var p={promiseRejectionQueued:!1,promise:u,target:f,bindingPromise:l};f._then(e,a,void 0,u,p),l._then(s,c,void 0,u,p),u._setOnCancel(l)}else u._resolveCallback(f);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],3:[function(t,e,n){"use strict";function r(){try{Promise===i&&(Promise=o)}catch(t){}return i}var o;"undefined"!=typeof Promise&&(o=Promise);var i=t("./promise")();i.noConflict=r,e.exports=i},{"./promise":15}],4:[function(t,e,n){"use strict";e.exports=function(e,n,r,o){var i=t("./util"),a=i.tryCatch,s=i.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(i.isArray(t))for(var n=0;n=0?i[t]:void 0}var o=!1,i=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,i=t.prototype._popContext,a=t._peekContext,s=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=i,t._peekContext=a,t.prototype._peekContext=s,t.prototype._promiseCreated=c,o=!1},o=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],7:[function(t,e,n){"use strict";e.exports=function(e,n,r,o){function i(t,e){return{promise:e}}function a(){return!1}function s(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+V.toString(t));r._attachCancellationCallback(t)})}catch(o){return o}}function c(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?V.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function l(){return this._onCancelField}function u(t){this._onCancelField=t}function f(){this._cancellationParent=void 0,this._onCancelField=void 0}function p(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function d(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function _(){this._trace=new H(this._peekContext())}function v(t,e){if(q(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=F(t);V.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),V.notEnumerableProp(t,"__stackCleaned__",!0)}}}function y(){this._trace=void 0}function g(t,e,n,r,o){if(void 0===t&&null!==e&&Z){if(void 0!==o&&o._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var i="",a="";if(e._trace){for(var s=e._trace.stack.split("\n"),c=E(s),l=c.length-1;l>=0;--l){var u=c[l];if(!G.test(u)){var f=u.match(M);f&&(i="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(c.length>0)for(var p=c[0],l=0;l0&&(a="\n"+s[l-1]);break}}var h="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(h,!0,e)}}function m(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),b(n)}function b(t,n,r){if(ut.warnings){var o,i=new D(t);if(n)r._attachExtraTrace(i);else if(ut.longStackTraces&&(o=e._peekContext()))o.attachExtraTrace(i);else{var a=F(i);i.stack=a.message+"\n"+a.stack.join("\n")}it("warning",i)||T(i,"",!0)}}function C(t,e){for(var n=0;n=0;--s)if(r[s]===i){a=s;break}for(var s=a;s>=0;--s){var c=r[s];if(e[o]!==c)break;e.pop(),o--}e=r}}function E(t){for(var e=[],n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function F(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?j(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:E(e)}}function T(t,e,n){if("undefined"!=typeof console){var r;if(V.isObject(t)){var o=t.stack;r=e+z(o,t)}else r=e+String(t);"function"==typeof B?B(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function x(t,e,n,r){var o=!1;try{"function"==typeof e&&(o=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(i){I.throwLater(i)}"unhandledRejection"===t?it(t,n,r)||o||T(n,"Unhandled rejection "):it(t,r)}function R(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():V.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(o){}0===e.length&&(e="(empty array)")}return"(<"+S(e)+">, no stack trace)"}function S(t){var e=41;return t.lengtha||0>s||!n||!r||n!==r||a>=s||(st=function(t){if(W.test(t))return!0;var e=O(t);return e&&e.fileName===n&&a<=e.line&&e.line<=s?!0:!1})}}function H(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);lt(this,H),e>32&&this.uncycle()}var N,L,B,U,I=e._async,D=t("./errors").Warning,V=t("./util"),Q=t("./es5"),q=V.canAttachTrace,W=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,G=/\((?:timers\.js):\d+:\d+\)/,M=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,$=null,z=null,X=!1,K=!(0==V.env("BLUEBIRD_DEBUG")||!V.env("BLUEBIRD_DEBUG")&&"development"!==V.env("NODE_ENV")),J=!(0==V.env("BLUEBIRD_WARNINGS")||!K&&!V.env("BLUEBIRD_WARNINGS")),Y=!(0==V.env("BLUEBIRD_LONG_STACK_TRACES")||!K&&!V.env("BLUEBIRD_LONG_STACK_TRACES")),Z=0!=V.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(J||!!V.env("BLUEBIRD_W_FORGOTTEN_RETURN"));!function(){function t(){for(var t=0;t0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return b(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var n=e._getContext();L=V.contextBind(n,t)},e.onUnhandledRejectionHandled=function(t){var n=e._getContext();N=V.contextBind(n,t)};var tt=function(){};e.longStackTraces=function(){if(I.haveItemsQueued()&&!ut.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ut.longStackTraces&&P()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace,o=e.prototype._dereferenceTrace;ut.longStackTraces=!0,tt=function(){if(I.haveItemsQueued()&&!ut.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,e.prototype._dereferenceTrace=o,n.deactivateLongStackTraces(),ut.longStackTraces=!1},e.prototype._captureStackTrace=_,e.prototype._attachExtraTrace=v,e.prototype._dereferenceTrace=y,n.activateLongStackTraces()}},e.hasLongStackTraces=function(){return ut.longStackTraces&&P()};var et={unhandledrejection:{before:function(){var t=V.global.onunhandledrejection;return V.global.onunhandledrejection=null,t},after:function(t){V.global.onunhandledrejection=t}},rejectionhandled:{before:function(){var t=V.global.onrejectionhandled;return V.global.onrejectionhandled=null,t},after:function(t){V.global.onrejectionhandled=t}}},nt=function(){var t=function(t,e){if(!t)return!V.global.dispatchEvent(e);var n;try{return n=t.before(),!V.global.dispatchEvent(e)}finally{t.after(n)}};try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return V.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r={detail:n,cancelable:!0},o=new CustomEvent(e,r);return Q.defineProperty(o,"promise",{value:n.promise}),Q.defineProperty(o,"reason",{value:n.reason}),t(et[e],o)}}if("function"==typeof Event){var e=new Event("CustomEvent");return V.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=new Event(e,{cancelable:!0});return r.detail=n,Q.defineProperty(r,"promise",{value:n.promise}),Q.defineProperty(r,"reason",{value:n.reason}),t(et[e],r)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),V.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,!1,!0,n),t(et[e],r)}}catch(n){}return function(){return!1}}(),rt=function(){return V.isNode?function(){return process.emit.apply(process,arguments)}:V.global?function(t){var e="on"+t.toLowerCase(),n=V.global[e];return n?(n.apply(V.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),ot={promiseCreated:i,promiseFulfilled:i,promiseRejected:i,promiseResolved:i,promiseCancelled:i,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:i},it=function(t){var e=!1;try{e=rt.apply(null,arguments)}catch(n){I.throwLater(n),e=!0}var r=!1;try{r=nt(t,ot[t].apply(null,arguments))}catch(n){I.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&tt()),"warnings"in t){var n=t.warnings;ut.warnings=!!n,Z=ut.warnings,V.isObject(n)&&"wForgottenReturn"in n&&(Z=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ut.cancellation){if(I.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=f,e.prototype._propagateFrom=p,e.prototype._onCancel=l,e.prototype._setOnCancel=u,e.prototype._attachCancellationCallback=c,e.prototype._execute=s,at=p,ut.cancellation=!0}if("monitoring"in t&&(t.monitoring&&!ut.monitoring?(ut.monitoring=!0,e.prototype._fireEvent=it):!t.monitoring&&ut.monitoring&&(ut.monitoring=!1,e.prototype._fireEvent=a)),"asyncHooks"in t&&V.nodeSupportsAsyncResource){var i=ut.asyncHooks,h=!!t.asyncHooks;i!==h&&(ut.asyncHooks=h,h?r():o())}return e},e.prototype._fireEvent=a,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._dereferenceTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var at=h,st=function(){return!1},ct=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;V.inherits(H,Error),n.CapturedTrace=H,H.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,o=this;void 0!==o;++r)e.push(o),o=o._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var i=e[r].stack;void 0===n[i]&&(n[i]=r)}for(var r=0;t>r;++r){var a=e[r].stack,s=n[a];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>s?(c._parent=e[s+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},H.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=F(t),n=e.message,r=[e.stack],o=this;void 0!==o;)r.push(E(o.stack.split("\n"))),o=o._parent;k(r),w(r),V.notEnumerableProp(t,"stack",C(n,r)),V.notEnumerableProp(t,"__stackCleaned__",!0)}};var lt=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():R(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,$=t,z=e;var n=Error.captureStackTrace;return st=function(t){return W.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return $=/@/,z=e,X=!0,function(t){t.stack=(new Error).stack};var o;try{throw new Error}catch(i){o="stack"in i}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(z=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?R(e):e.toString()},null):($=t,z=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(B=function(t){console.warn(t)},V.isNode&&process.stderr.isTTY?B=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:V.isNode||"string"!=typeof(new Error).stack||(B=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ut={warnings:J,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return Y&&e.longStackTraces(),{asyncHooks:function(){return ut.asyncHooks},longStackTraces:function(){return ut.longStackTraces},warnings:function(){return ut.warnings},cancellation:function(){return ut.cancellation},monitoring:function(){return ut.monitoring},propagateFromFunction:function(){return at},boundValueFunction:function(){return d},checkForgottenReturns:g,setBounds:A,warn:b,deprecated:m,CapturedTrace:H,fireDomEvent:nt,fireGlobalEvent:rt}}},{"./errors":9,"./es5":10,"./util":21}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var o=function(){return r};return this.caught(n,o)}}},{}],9:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(f(this,"message","string"==typeof r?r:e),f(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function o(t){return this instanceof o?(f(this,"name","OperationalError"),f(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(f(this,"message",t.message),f(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new o(t)}var i,a,s=t("./es5"),c=s.freeze,l=t("./util"),u=l.inherits,f=l.notEnumerableProp,p=r("Warning","warning"),h=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{i=TypeError,a=RangeError}catch(v){i=r("TypeError","type error"),a=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function s(){return l.call(this,this.promise._target()._settledValue())}function c(t){return a(this,t)?void 0:(p.e=t,p)}function l(t){var o=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(o._boundValue()):l.call(o._boundValue(),t);if(u===r)return u;if(void 0!==u){o._setReturnedNonUndefined();var h=n(u,o);if(h instanceof e){if(null!=this.cancelPromise){if(h._isCancelled()){var d=new f("late cancellation observer");return o._attachExtraTrace(d),p.e=d,p}h.isPending()&&h._attachCancellationCallback(new i(this))}return h._then(s,c,void 0,this,void 0)}}}return o.isRejected()?(a(this),p.e=t,p):(a(this),t)}var u=t("./util"),f=e.CancellationError,p=u.errorObj,h=t("./catch_filter")(r);return o.prototype.isFinallyHandler=function(){return 0===this.type},i.prototype._resultCancelled=function(){a(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new o(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,o=new Array(n-1),i=0;for(r=0;n-1>r;++r){var a=arguments[r];if(!u.isObject(a))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(a)));o[i++]=a}o.length=i;var s=arguments[r];return this._passThrough(h(o,s,this),1,void 0,l)},o}},{"./catch_filter":5,"./util":21}],12:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i){var a=t("./util");a.canEvaluate,a.tryCatch,a.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var o=[].slice.call(arguments);t&&o.pop();var r=new n(o).promise();return void 0!==t?r.spread(t):r}}},{"./util":21}],13:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i){var a=t("./util"),s=a.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+a.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var o=s(t).apply(this,arguments),a=r._popContext();return i.checkForgottenReturns(o,a,"Promise.method",r),r._resolveFromSyncValue(o),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return o("expecting a function but got "+a.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){i.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=a.isArray(l)?s(t).apply(u,l):s(t).call(u,l)}else c=s(t)();var f=r._popContext();return i.checkForgottenReturns(c,f,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===a.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":21}],14:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function o(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),o=0;o1){var n,r=new Array(e-1),o=0;for(n=0;e-1>n;++n){var i=arguments[n];if(!p.isObject(i))return u("Catch statement predicate: expecting an object but got "+p.classString(i));r[o++]=i}if(r.length=o,t=arguments[n],"function"!=typeof t)throw new j("The last argument to .catch() must be a function, got "+p.toString(t));return this.then(void 0,N(r,t,this))}return this.then(void 0,t)},o.prototype.reflect=function(){return this._then(l,l,void 0,this,void 0)},o.prototype.then=function(t,e){if(A.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+p.classString(t);arguments.length>1&&(n+=", "+p.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},o.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},o.prototype.spread=function(t){return"function"!=typeof t?u("expecting a function but got "+p.classString(t)):this.all()._then(t,void 0,void 0,x,void 0)},o.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},o.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new P(this).promise()},o.prototype.error=function(t){return this.caught(p.originatesFromRejection,t)},o.getNewLibraryCopy=e.exports,o.is=function(t){return t instanceof o},o.fromNode=o.fromCallback=function(t){var e=new o(T);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=U(t)(L(e,n));return r===B&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},o.all=function(t){return new P(t).promise()},o.cast=function(t){var e=S(t);return e instanceof o||(e=new o(T),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},o.resolve=o.fulfilled=o.cast,o.reject=o.rejected=function(t){var e=new o(T);return e._captureStackTrace(),e._rejectCallback(t,!0),e},o.setScheduler=function(t){if("function"!=typeof t)throw new j("expecting a function but got "+p.classString(t));return k.setScheduler(t)},o.prototype._then=function(t,e,n,r,i){var a=void 0!==i,s=a?i:new o(T),c=this._target(),l=c._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&l)?this._boundValue():c===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var u=g();if(0!==(50397184&l)){var f,h,d=c._settlePromiseCtx;0!==(33554432&l)?(h=c._rejectionHandler0,f=t):0!==(16777216&l)?(h=c._fulfillmentHandler0,f=e,c._unsetRejectionIsUnhandled()):(d=c._settlePromiseLateCancellationObserver,h=new F("late cancellation observer"),c._attachExtraTrace(h),f=e),k.invoke(d,c,{handler:p.contextBind(u,f),promise:s,receiver:r,value:h})}else c._addCallbacks(t,e,s,r,u);return s},o.prototype._length=function(){return 65535&this._bitField},o.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},o.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},o.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},o.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},o.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},o.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},o.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},o.prototype._isFinal=function(){return(4194304&this._bitField)>0},o.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},o.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},o.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},o.prototype._setAsyncGuaranteed=function(){if(!k.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},o.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&(536870912|this._bitField)},o.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===f?void 0:void 0===e&&this._isBound()?this._boundValue():e},o.prototype._promiseAt=function(t){return this[4*t-4+2]},o.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},o.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},o.prototype._boundValue=function(){},o.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,o=t._receiverAt(0);void 0===o&&(o=f),this._addCallbacks(e,n,r,o,null)},o.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),o=t._promiseAt(e),i=t._receiverAt(e);void 0===i&&(i=f),this._addCallbacks(n,r,o,i,null)},o.prototype._addCallbacks=function(t,e,n,r,o){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=p.contextBind(o,t)),"function"==typeof e&&(this._rejectionHandler0=p.contextBind(o,e));else{var a=4*i-4;this[a+2]=n,this[a+3]=r,"function"==typeof t&&(this[a+0]=p.contextBind(o,t)),"function"==typeof e&&(this[a+1]=p.contextBind(o,e))}return this._setLength(i+1),i},o.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},o.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=S(t,this);if(!(n instanceof o))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(c());var i=r._bitField;if(0===(50397184&i)){var a=this._length();a>0&&r._migrateCallback0(this);for(var s=1;a>s;++s)r._migrateCallbackAt(this,s);this._setFollowing(),this._setLength(0),this._setFollowee(n)}else if(0!==(33554432&i))this._fulfill(r._value());else if(0!==(16777216&i))this._reject(r._reason());else{var l=new F("late cancellation observer");r._attachExtraTrace(l),this._reject(l)}}},o.prototype._rejectCallback=function(t,e,n){var r=p.ensureErrorObject(t),o=r===t;if(!o&&!n&&A.warnings()){var i="a promise was rejected with a non-error: "+p.classString(t);this._warn(i,!0)}this._attachExtraTrace(r,e?o:!1),this._reject(t)},o.prototype._resolveFromExecutor=function(t){if(t!==T){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},o.prototype._settlePromiseFromHandler=function(t,e,n,r){var o=r._bitField;if(0===(65536&o)){r._pushContext();var i;e===x?n&&"number"==typeof n.length?i=U(t).apply(this._boundValue(),n):(i=B,i.e=new j("cannot .spread() a non-array: "+p.classString(n))):i=U(t).call(e,n);var a=r._popContext();o=r._bitField,0===(65536&o)&&(i===R?r._reject(n):i===B?r._rejectCallback(i.e,!1):(A.checkForgottenReturns(i,a,"",r,this),r._resolveCallback(i)))}},o.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},o.prototype._followee=function(){return this._rejectionHandler0},o.prototype._setFollowee=function(t){this._rejectionHandler0=t},o.prototype._settlePromise=function(t,e,r,i){var a=t instanceof o,s=this._bitField,c=0!==(134217728&s);0!==(65536&s)?(a&&t._invokeInternalOnCancel(),r instanceof H&&r.isFinallyHandler()?(r.cancelPromise=t,U(e).call(r,i)===B&&t._reject(B.e)):e===l?t._fulfill(l.call(r)):r instanceof n?r._promiseCancelled(t):a||t instanceof P?t._cancel():r.cancel()):"function"==typeof e?a?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,i,t)):e.call(r,i,t):r instanceof n?r._isResolved()||(0!==(33554432&s)?r._promiseFulfilled(i,t):r._promiseRejected(i,t)):a&&(c&&t._setAsyncGuaranteed(),0!==(33554432&s)?t._fulfill(i):t._reject(i))},o.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,i=t.value;"function"==typeof e?n instanceof o?this._settlePromiseFromHandler(e,r,i,n):e.call(r,i,n):n instanceof o&&n._reject(i)},o.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},o.prototype._settlePromise0=function(t,e,n){var r=this._promise0,o=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,o,e)},o.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},o.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():k.settlePromises(this),this._dereferenceTrace())}},o.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?k.fatalError(t,p.isNode):void((65535&e)>0?k.settlePromises(this):this._ensurePossibleRejectionHandled())},o.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),o=this._promiseAt(n),i=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(o,r,i,e)}},o.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),o=this._promiseAt(n),i=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(o,r,i,e)}},o.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},o.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},"undefined"!=typeof Symbol&&Symbol.toStringTag&&C.defineProperty(o.prototype,Symbol.toStringTag,{get:function(){return"Object"}}),o.defer=o.pending=function(){A.deprecated("Promise.defer","new Promise");var t=new o(T);return{promise:t,resolve:i,reject:a}},p.notEnumerableProp(o,"_makeSelfResolutionError",c),t("./method")(o,T,S,u,A),t("./bind")(o,T,S,A),t("./cancel")(o,P,u,A),t("./direct_resolve")(o),t("./synchronous_inspection")(o),t("./join")(o,P,S,T,k),o.Promise=o,o.version="3.7.1",p.toFastProperties(o),p.toFastProperties(o.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new o(T)),A.setBounds(w.firstLineError,p.lastLineError),o}},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21,async_hooks:void 0}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i){function a(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function s(t){var r=this._promise=new e(n);t instanceof e&&(r._propagateFrom(t,3),t.suppressUnhandledRejections()),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(s,i),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function l(t,n){var i=r(this._values,this._promise);if(i instanceof e){i=i._target();var s=i._bitField;if(this._values=i,0===(50397184&s))return this._promise._setAsyncGuaranteed(),i._then(l,this._reject,void 0,this,n);if(0===(33554432&s))return 0!==(16777216&s)?this._reject(i._reason()):this._cancel();i=i._value()}if(i=c.asArray(i),null===i){var u=o("expecting an array or an iterable object but got "+c.classString(i)).reason();return void this._promise._rejectCallback(u,!1)}return 0===i.length?void(-5===n?this._resolveEmptyArray():this._resolve(a(n))):void this._iterate(i)},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var o=this._promise,i=!1,a=null,s=0;n>s;++s){var c=r(t[s],o);c instanceof e?(c=c._target(),a=c._bitField):a=null,i?null!==a&&c.suppressUnhandledRejections():null!==a?0===(50397184&a)?(c._proxy(this,s),this._values[s]=c):i=0!==(33554432&a)?this._promiseFulfilled(c._value(),s):0!==(16777216&a)?this._promiseRejected(c._reason(),s):this._promiseCancelled(s):i=this._promiseFulfilled(c,s)}i||o._setAsyncGuaranteed()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;ni;++i)n[i+r]=t[i+e],t[i+e]=void 0}function o(t){this._capacity=t,this._length=0,this._front=0}o.prototype._willBeOverCapacity=function(t){return this._capacityn;++n)o[n]=t[n];return o[n]=e,o}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(i(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function f(t){throw t}function p(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),o=A.test(t+"")&&F.names(t).length>0;if(n||r||o)return!0}return!1}catch(i){return!1}}function h(t){function e(){}function n(){return typeof r.foo}e.prototype=t;var r=new e;return n(),n(),t}function d(t){return H.test(t)}function _(t,e,n){for(var r=new Array(t),o=0;t>o;++o)r[o]=e+o+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{u(t,"isOperational",!0)}catch(e){}}function m(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function C(t){return{}.toString.call(t)}function w(t,e,n){for(var r=F.names(t),o=0;o10||t[0]>0}(),V.nodeSupportsAsyncResource=V.isNode&&function(){var e=!1;try{var n=t("async_hooks").AsyncResource;e="function"==typeof n.prototype.runInAsyncScope}catch(r){e=!1}return e}(),V.isNode&&V.toFastProperties(process);try{throw new Error}catch(Q){V.lastLineError=Q}e.exports=V},{"./es5":10,async_hooks:void 0}]},{},[3])(3)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); \ No newline at end of file diff --git a/node_modules/bluebird/js/browser/bluebird.js b/node_modules/bluebird/js/browser/bluebird.js deleted file mode 100644 index 15db150a..00000000 --- a/node_modules/bluebird/js/browser/bluebird.js +++ /dev/null @@ -1,5805 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 3.7.1 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each -*/ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0) { - _drainQueueStep(queue); - } -} - -function _drainQueueStep(queue) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - } else { - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -} - -Async.prototype._drainQueues = function () { - _drainQueue(this._normalQueue); - this._reset(); - this._haveDrainedQueues = true; - _drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = Async; -module.exports.firstLineError = firstLineError; - -},{"./queue":26,"./schedule":29}],3:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { -var calledBind = false; -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - if (((this._bitField & 50397184) === 0)) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - if (!calledBind) { - calledBind = true; - Promise.prototype._propagateFrom = debug.propagateFromFunction(); - Promise.prototype._boundValue = debug.boundValueFunction(); - } - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - ret._setBoundTo(maybePromise); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, undefined, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, undefined, ret, context); - ret._setOnCancel(maybePromise); - } else { - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 2097152; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~2097152); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 2097152) === 2097152; -}; - -Promise.bind = function (thisArg, value) { - return Promise.resolve(value).bind(thisArg); -}; -}; - -},{}],4:[function(_dereq_,module,exports){ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = _dereq_("./promise")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; - -},{"./promise":22}],5:[function(_dereq_,module,exports){ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} - -module.exports = function(Promise) { -var util = _dereq_("./util"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; - -var getMethodCaller; -var getGetter; -if (!true) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; - -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; - -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; - } - } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; - -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); - } - return fn; -} - -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var args = [].slice.call(arguments, 1);; - if (!true) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); - } - } - } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; - -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; - } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; - -},{"./util":36}],6:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, PromiseArray, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -Promise.prototype["break"] = Promise.prototype.cancel = function() { - if (!debug.cancellation()) return this._warn("cancellation is disabled"); - - var promise = this; - var child = promise; - while (promise._isCancellable()) { - if (!promise._cancelBy(child)) { - if (child._isFollowing()) { - child._followee().cancel(); - } else { - child._cancelBranched(); - } - break; - } - - var parent = promise._cancellationParent; - if (parent == null || !parent._isCancellable()) { - if (promise._isFollowing()) { - promise._followee().cancel(); - } else { - promise._cancelBranched(); - } - break; - } else { - if (promise._isFollowing()) promise._followee().cancel(); - promise._setWillBeCancelled(); - child = promise; - promise = parent; - } - } -}; - -Promise.prototype._branchHasCancelled = function() { - this._branchesRemainingToCancel--; -}; - -Promise.prototype._enoughBranchesHaveCancelled = function() { - return this._branchesRemainingToCancel === undefined || - this._branchesRemainingToCancel <= 0; -}; - -Promise.prototype._cancelBy = function(canceller) { - if (canceller === this) { - this._branchesRemainingToCancel = 0; - this._invokeOnCancel(); - return true; - } else { - this._branchHasCancelled(); - if (this._enoughBranchesHaveCancelled()) { - this._invokeOnCancel(); - return true; - } - } - return false; -}; - -Promise.prototype._cancelBranched = function() { - if (this._enoughBranchesHaveCancelled()) { - this._cancel(); - } -}; - -Promise.prototype._cancel = function() { - if (!this._isCancellable()) return; - this._setCancelled(); - async.invoke(this._cancelPromises, this, undefined); -}; - -Promise.prototype._cancelPromises = function() { - if (this._length() > 0) this._settlePromises(); -}; - -Promise.prototype._unsetOnCancel = function() { - this._onCancelField = undefined; -}; - -Promise.prototype._isCancellable = function() { - return this.isPending() && !this._isCancelled(); -}; - -Promise.prototype.isCancellable = function() { - return this.isPending() && !this.isCancelled(); -}; - -Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { - if (util.isArray(onCancelCallback)) { - for (var i = 0; i < onCancelCallback.length; ++i) { - this._doInvokeOnCancel(onCancelCallback[i], internalOnly); - } - } else if (onCancelCallback !== undefined) { - if (typeof onCancelCallback === "function") { - if (!internalOnly) { - var e = tryCatch(onCancelCallback).call(this._boundValue()); - if (e === errorObj) { - this._attachExtraTrace(e.e); - async.throwLater(e.e); - } - } - } else { - onCancelCallback._resultCancelled(this); - } - } -}; - -Promise.prototype._invokeOnCancel = function() { - var onCancelCallback = this._onCancel(); - this._unsetOnCancel(); - async.invoke(this._doInvokeOnCancel, this, onCancelCallback); -}; - -Promise.prototype._invokeInternalOnCancel = function() { - if (this._isCancellable()) { - this._doInvokeOnCancel(this._onCancel(), true); - this._unsetOnCancel(); - } -}; - -Promise.prototype._resultCancelled = function() { - this.cancel(); -}; - -}; - -},{"./util":36}],7:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = _dereq_("./util"); -var getKeys = _dereq_("./es5").keys; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function catchFilter(instances, cb, promise) { - return function(e) { - var boundTo = promise._boundValue(); - predicateLoop: for (var i = 0; i < instances.length; ++i) { - var item = instances[i]; - - if (item === Error || - (item != null && item.prototype instanceof Error)) { - if (e instanceof item) { - return tryCatch(cb).call(boundTo, e); - } - } else if (typeof item === "function") { - var matchesPredicate = tryCatch(item).call(boundTo, e); - if (matchesPredicate === errorObj) { - return matchesPredicate; - } else if (matchesPredicate) { - return tryCatch(cb).call(boundTo, e); - } - } else if (util.isObject(e)) { - var keys = getKeys(item); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - if (item[key] != e[key]) { - continue predicateLoop; - } - } - return tryCatch(cb).call(boundTo, e); - } - } - return NEXT_FILTER; - }; -} - -return catchFilter; -}; - -},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var longStackTraces = false; -var contextStack = []; - -Promise.prototype._promiseCreated = function() {}; -Promise.prototype._pushContext = function() {}; -Promise.prototype._popContext = function() {return null;}; -Promise._peekContext = Promise.prototype._peekContext = function() {}; - -function Context() { - this._trace = new Context.CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (this._trace !== undefined) { - this._trace._promiseCreated = null; - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (this._trace !== undefined) { - var trace = contextStack.pop(); - var ret = trace._promiseCreated; - trace._promiseCreated = null; - return ret; - } - return null; -}; - -function createContext() { - if (longStackTraces) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} -Context.CapturedTrace = null; -Context.create = createContext; -Context.deactivateLongStackTraces = function() {}; -Context.activateLongStackTraces = function() { - var Promise_pushContext = Promise.prototype._pushContext; - var Promise_popContext = Promise.prototype._popContext; - var Promise_PeekContext = Promise._peekContext; - var Promise_peekContext = Promise.prototype._peekContext; - var Promise_promiseCreated = Promise.prototype._promiseCreated; - Context.deactivateLongStackTraces = function() { - Promise.prototype._pushContext = Promise_pushContext; - Promise.prototype._popContext = Promise_popContext; - Promise._peekContext = Promise_PeekContext; - Promise.prototype._peekContext = Promise_peekContext; - Promise.prototype._promiseCreated = Promise_promiseCreated; - longStackTraces = false; - }; - longStackTraces = true; - Promise.prototype._pushContext = Context.prototype._pushContext; - Promise.prototype._popContext = Context.prototype._popContext; - Promise._peekContext = Promise.prototype._peekContext = peekContext; - Promise.prototype._promiseCreated = function() { - var ctx = this._peekContext(); - if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; - }; -}; -return Context; -}; - -},{}],9:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, Context, - enableAsyncHooks, disableAsyncHooks) { -var async = Promise._async; -var Warning = _dereq_("./errors").Warning; -var util = _dereq_("./util"); -var es5 = _dereq_("./es5"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; -var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; -var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var printWarning; -var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && - (true || - util.env("BLUEBIRD_DEBUG") || - util.env("NODE_ENV") === "development")); - -var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && - (debugging || util.env("BLUEBIRD_WARNINGS"))); - -var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && - (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); - -var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && - (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); - -var deferUnhandledRejectionCheck; -(function() { - var promises = []; - - function unhandledRejectionCheck() { - for (var i = 0; i < promises.length; ++i) { - promises[i]._notifyUnhandledRejection(); - } - unhandledRejectionClear(); - } - - function unhandledRejectionClear() { - promises.length = 0; - } - - if (typeof document === "object" && document.createElement) { - deferUnhandledRejectionCheck = (function() { - var iframeSetTimeout; - - function checkIframe() { - if (document.body) { - var iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - if (iframe.contentWindow && - iframe.contentWindow.setTimeout) { - iframeSetTimeout = iframe.contentWindow.setTimeout; - } - document.body.removeChild(iframe); - } - } - checkIframe(); - return function(promise) { - promises.push(promise); - if (iframeSetTimeout) { - iframeSetTimeout(unhandledRejectionCheck, 1); - } else { - checkIframe(); - } - }; - })(); - } else { - deferUnhandledRejectionCheck = function(promise) { - promises.push(promise); - setTimeout(unhandledRejectionCheck, 1); - }; - } - - es5.defineProperty(Promise, "_unhandledRejectionCheck", { - value: unhandledRejectionCheck - }); - es5.defineProperty(Promise, "_unhandledRejectionClear", { - value: unhandledRejectionClear - }); -})(); - -Promise.prototype.suppressUnhandledRejections = function() { - var target = this._target(); - target._bitField = ((target._bitField & (~1048576)) | - 524288); -}; - -Promise.prototype._ensurePossibleRejectionHandled = function () { - if ((this._bitField & 524288) !== 0) return; - this._setRejectionIsUnhandled(); - deferUnhandledRejectionCheck(this); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._setReturnedNonUndefined = function() { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._returnedNonUndefined = function() { - return (this._bitField & 268435456) !== 0; -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._settledValue(); - this._setUnhandledRejectionIsNotified(); - fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 262144; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~262144); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 262144) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 1048576; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~1048576); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { - return warn(message, shouldUseOwnTrace, promise || this); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - var context = Promise._getContext(); - possiblyUnhandledRejection = util.contextBind(context, fn); -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - var context = Promise._getContext(); - unhandledRejectionHandled = util.contextBind(context, fn); -}; - -var disableLongStackTraces = function() {}; -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (!config.longStackTraces && longStackTracesIsSupported()) { - var Promise_captureStackTrace = Promise.prototype._captureStackTrace; - var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; - var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace; - config.longStackTraces = true; - disableLongStackTraces = function() { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - Promise.prototype._captureStackTrace = Promise_captureStackTrace; - Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; - Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; - Context.deactivateLongStackTraces(); - config.longStackTraces = false; - }; - Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; - Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; - Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; - Context.activateLongStackTraces(); - } -}; - -Promise.hasLongStackTraces = function () { - return config.longStackTraces && longStackTracesIsSupported(); -}; - - -var legacyHandlers = { - unhandledrejection: { - before: function() { - var ret = util.global.onunhandledrejection; - util.global.onunhandledrejection = null; - return ret; - }, - after: function(fn) { - util.global.onunhandledrejection = fn; - } - }, - rejectionhandled: { - before: function() { - var ret = util.global.onrejectionhandled; - util.global.onrejectionhandled = null; - return ret; - }, - after: function(fn) { - util.global.onrejectionhandled = fn; - } - } -}; - -var fireDomEvent = (function() { - var dispatch = function(legacy, e) { - if (legacy) { - var fn; - try { - fn = legacy.before(); - return !util.global.dispatchEvent(e); - } finally { - legacy.after(fn); - } - } else { - return !util.global.dispatchEvent(e); - } - }; - try { - if (typeof CustomEvent === "function") { - var event = new CustomEvent("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var eventData = { - detail: event, - cancelable: true - }; - var domEvent = new CustomEvent(name, eventData); - es5.defineProperty( - domEvent, "promise", {value: event.promise}); - es5.defineProperty( - domEvent, "reason", {value: event.reason}); - - return dispatch(legacyHandlers[name], domEvent); - }; - } else if (typeof Event === "function") { - var event = new Event("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = new Event(name, { - cancelable: true - }); - domEvent.detail = event; - es5.defineProperty(domEvent, "promise", {value: event.promise}); - es5.defineProperty(domEvent, "reason", {value: event.reason}); - return dispatch(legacyHandlers[name], domEvent); - }; - } else { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = document.createEvent("CustomEvent"); - domEvent.initCustomEvent(name, false, true, - event); - return dispatch(legacyHandlers[name], domEvent); - }; - } - } catch (e) {} - return function() { - return false; - }; -})(); - -var fireGlobalEvent = (function() { - if (util.isNode) { - return function() { - return process.emit.apply(process, arguments); - }; - } else { - if (!util.global) { - return function() { - return false; - }; - } - return function(name) { - var methodName = "on" + name.toLowerCase(); - var method = util.global[methodName]; - if (!method) return false; - method.apply(util.global, [].slice.call(arguments, 1)); - return true; - }; - } -})(); - -function generatePromiseLifecycleEventObject(name, promise) { - return {promise: promise}; -} - -var eventToObjectGenerator = { - promiseCreated: generatePromiseLifecycleEventObject, - promiseFulfilled: generatePromiseLifecycleEventObject, - promiseRejected: generatePromiseLifecycleEventObject, - promiseResolved: generatePromiseLifecycleEventObject, - promiseCancelled: generatePromiseLifecycleEventObject, - promiseChained: function(name, promise, child) { - return {promise: promise, child: child}; - }, - warning: function(name, warning) { - return {warning: warning}; - }, - unhandledRejection: function (name, reason, promise) { - return {reason: reason, promise: promise}; - }, - rejectionHandled: generatePromiseLifecycleEventObject -}; - -var activeFireEvent = function (name) { - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent.apply(null, arguments); - } catch (e) { - async.throwLater(e); - globalEventFired = true; - } - - var domEventFired = false; - try { - domEventFired = fireDomEvent(name, - eventToObjectGenerator[name].apply(null, arguments)); - } catch (e) { - async.throwLater(e); - domEventFired = true; - } - - return domEventFired || globalEventFired; -}; - -Promise.config = function(opts) { - opts = Object(opts); - if ("longStackTraces" in opts) { - if (opts.longStackTraces) { - Promise.longStackTraces(); - } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { - disableLongStackTraces(); - } - } - if ("warnings" in opts) { - var warningsOption = opts.warnings; - config.warnings = !!warningsOption; - wForgottenReturn = config.warnings; - - if (util.isObject(warningsOption)) { - if ("wForgottenReturn" in warningsOption) { - wForgottenReturn = !!warningsOption.wForgottenReturn; - } - } - } - if ("cancellation" in opts && opts.cancellation && !config.cancellation) { - if (async.haveItemsQueued()) { - throw new Error( - "cannot enable cancellation after promises are in use"); - } - Promise.prototype._clearCancellationData = - cancellationClearCancellationData; - Promise.prototype._propagateFrom = cancellationPropagateFrom; - Promise.prototype._onCancel = cancellationOnCancel; - Promise.prototype._setOnCancel = cancellationSetOnCancel; - Promise.prototype._attachCancellationCallback = - cancellationAttachCancellationCallback; - Promise.prototype._execute = cancellationExecute; - propagateFromFunction = cancellationPropagateFrom; - config.cancellation = true; - } - if ("monitoring" in opts) { - if (opts.monitoring && !config.monitoring) { - config.monitoring = true; - Promise.prototype._fireEvent = activeFireEvent; - } else if (!opts.monitoring && config.monitoring) { - config.monitoring = false; - Promise.prototype._fireEvent = defaultFireEvent; - } - } - if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) { - var prev = config.asyncHooks; - var cur = !!opts.asyncHooks; - if (prev !== cur) { - config.asyncHooks = cur; - if (cur) { - enableAsyncHooks(); - } else { - disableAsyncHooks(); - } - } - } - return Promise; -}; - -function defaultFireEvent() { return false; } - -Promise.prototype._fireEvent = defaultFireEvent; -Promise.prototype._execute = function(executor, resolve, reject) { - try { - executor(resolve, reject); - } catch (e) { - return e; - } -}; -Promise.prototype._onCancel = function () {}; -Promise.prototype._setOnCancel = function (handler) { ; }; -Promise.prototype._attachCancellationCallback = function(onCancel) { - ; -}; -Promise.prototype._captureStackTrace = function () {}; -Promise.prototype._attachExtraTrace = function () {}; -Promise.prototype._dereferenceTrace = function () {}; -Promise.prototype._clearCancellationData = function() {}; -Promise.prototype._propagateFrom = function (parent, flags) { - ; - ; -}; - -function cancellationExecute(executor, resolve, reject) { - var promise = this; - try { - executor(resolve, reject, function(onCancel) { - if (typeof onCancel !== "function") { - throw new TypeError("onCancel must be a function, got: " + - util.toString(onCancel)); - } - promise._attachCancellationCallback(onCancel); - }); - } catch (e) { - return e; - } -} - -function cancellationAttachCancellationCallback(onCancel) { - if (!this._isCancellable()) return this; - - var previousOnCancel = this._onCancel(); - if (previousOnCancel !== undefined) { - if (util.isArray(previousOnCancel)) { - previousOnCancel.push(onCancel); - } else { - this._setOnCancel([previousOnCancel, onCancel]); - } - } else { - this._setOnCancel(onCancel); - } -} - -function cancellationOnCancel() { - return this._onCancelField; -} - -function cancellationSetOnCancel(onCancel) { - this._onCancelField = onCancel; -} - -function cancellationClearCancellationData() { - this._cancellationParent = undefined; - this._onCancelField = undefined; -} - -function cancellationPropagateFrom(parent, flags) { - if ((flags & 1) !== 0) { - this._cancellationParent = parent; - var branchesRemainingToCancel = parent._branchesRemainingToCancel; - if (branchesRemainingToCancel === undefined) { - branchesRemainingToCancel = 0; - } - parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; - } - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} - -function bindingPropagateFrom(parent, flags) { - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} -var propagateFromFunction = bindingPropagateFrom; - -function boundValueFunction() { - var ret = this._boundTo; - if (ret !== undefined) { - if (ret instanceof Promise) { - if (ret.isFulfilled()) { - return ret.value(); - } else { - return undefined; - } - } - } - return ret; -} - -function longStackTracesCaptureStackTrace() { - this._trace = new CapturedTrace(this._peekContext()); -} - -function longStackTracesAttachExtraTrace(error, ignoreSelf) { - if (canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -} - -function longStackTracesDereferenceTrace() { - this._trace = undefined; -} - -function checkForgottenReturns(returnValue, promiseCreated, name, promise, - parent) { - if (returnValue === undefined && promiseCreated !== null && - wForgottenReturn) { - if (parent !== undefined && parent._returnedNonUndefined()) return; - if ((promise._bitField & 65535) === 0) return; - - if (name) name = name + " "; - var handlerLine = ""; - var creatorLine = ""; - if (promiseCreated._trace) { - var traceLines = promiseCreated._trace.stack.split("\n"); - var stack = cleanStack(traceLines); - for (var i = stack.length - 1; i >= 0; --i) { - var line = stack[i]; - if (!nodeFramePattern.test(line)) { - var lineMatches = line.match(parseLinePattern); - if (lineMatches) { - handlerLine = "at " + lineMatches[1] + - ":" + lineMatches[2] + ":" + lineMatches[3] + " "; - } - break; - } - } - - if (stack.length > 0) { - var firstUserLine = stack[0]; - for (var i = 0; i < traceLines.length; ++i) { - - if (traceLines[i] === firstUserLine) { - if (i > 0) { - creatorLine = "\n" + traceLines[i - 1]; - } - break; - } - } - - } - } - var msg = "a promise was created in a " + name + - "handler " + handlerLine + "but was not returned from it, " + - "see http://goo.gl/rRqMUw" + - creatorLine; - promise._warn(msg, true, promiseCreated); - } -} - -function deprecated(name, replacement) { - var message = name + - " is deprecated and will be removed in a future version."; - if (replacement) message += " Use " + replacement + " instead."; - return warn(message); -} - -function warn(message, shouldUseOwnTrace, promise) { - if (!config.warnings) return; - var warning = new Warning(message); - var ctx; - if (shouldUseOwnTrace) { - promise._attachExtraTrace(warning); - } else if (config.longStackTraces && (ctx = Promise._peekContext())) { - ctx.attachExtraTrace(warning); - } else { - var parsed = parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - - if (!activeFireEvent("warning", warning)) { - formatAndLogError(warning, "", true); - } -} - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = " (No stack trace)" === line || - stackFramePattern.test(line); - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0 && error.name != "SyntaxError") { - stack = stack.slice(i); - } - return stack; -} - -function parseStackAndMessage(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: error.name == "SyntaxError" ? stack : cleanStack(stack) - }; -} - -function formatAndLogError(error, title, isSoft) { - if (typeof console !== "undefined") { - var message; - if (util.isObject(error)) { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof printWarning === "function") { - printWarning(message, isSoft); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -} - -function fireRejectionEvent(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - if (name === "unhandledRejection") { - if (!activeFireEvent(name, reason, promise) && !localEventFired) { - formatAndLogError(reason, "Unhandled rejection "); - } - } else { - activeFireEvent(name, promise); - } -} - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj && typeof obj.toString === "function" - ? obj.toString() : util.toString(obj); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -function longStackTracesIsSupported() { - return typeof captureStackTrace === "function"; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} - -function setBounds(firstLineError, lastLineError) { - if (!longStackTracesIsSupported()) return; - var firstStackLines = (firstLineError.stack || "").split("\n"); - var lastStackLines = (lastLineError.stack || "").split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -} - -function CapturedTrace(parent) { - this._parent = parent; - this._promisesCreated = 0; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); -Context.CapturedTrace = CapturedTrace; - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit += 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit += 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit -= 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow && - typeof Error.stackTraceLimit === "number") { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit += 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit -= 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - printWarning = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - printWarning = function(message, isSoft) { - var color = isSoft ? "\u001b[33m" : "\u001b[31m"; - console.warn(color + message + "\u001b[0m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - printWarning = function(message, isSoft) { - console.warn("%c" + message, - isSoft ? "color: darkorange" : "color: red"); - }; - } -} - -var config = { - warnings: warnings, - longStackTraces: false, - cancellation: false, - monitoring: false, - asyncHooks: false -}; - -if (longStackTraces) Promise.longStackTraces(); - -return { - asyncHooks: function() { - return config.asyncHooks; - }, - longStackTraces: function() { - return config.longStackTraces; - }, - warnings: function() { - return config.warnings; - }, - cancellation: function() { - return config.cancellation; - }, - monitoring: function() { - return config.monitoring; - }, - propagateFromFunction: function() { - return propagateFromFunction; - }, - boundValueFunction: function() { - return boundValueFunction; - }, - checkForgottenReturns: checkForgottenReturns, - setBounds: setBounds, - warn: warn, - deprecated: deprecated, - CapturedTrace: CapturedTrace, - fireDomEvent: fireDomEvent, - fireGlobalEvent: fireGlobalEvent -}; -}; - -},{"./errors":12,"./es5":13,"./util":36}],10:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function returner() { - return this.value; -} -function thrower() { - throw this.reason; -} - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - returner, undefined, undefined, {value: value}, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - return this._then( - thrower, undefined, undefined, {reason: reason}, undefined); -}; - -Promise.prototype.catchThrow = function (reason) { - if (arguments.length <= 1) { - return this._then( - undefined, thrower, undefined, {reason: reason}, undefined); - } else { - var _reason = arguments[1]; - var handler = function() {throw _reason;}; - return this.caught(reason, handler); - } -}; - -Promise.prototype.catchReturn = function (value) { - if (arguments.length <= 1) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - undefined, returner, undefined, {value: value}, undefined); - } else { - var _value = arguments[1]; - if (_value instanceof Promise) _value.suppressUnhandledRejections(); - var handler = function() {return _value;}; - return this.caught(value, handler); - } -}; -}; - -},{}],11:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; -var PromiseAll = Promise.all; - -function promiseAllThis() { - return PromiseAll(this); -} - -function PromiseMapSeries(promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, INTERNAL); -} - -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, this, undefined); -}; - -Promise.prototype.mapSeries = function (fn) { - return PromiseReduce(this, fn, INTERNAL, INTERNAL); -}; - -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, promises, undefined); -}; - -Promise.mapSeries = PromiseMapSeries; -}; - - -},{}],12:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var Objectfreeze = es5.freeze; -var util = _dereq_("./util"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - es5.defineProperty(Error, "__BluebirdErrorTypes__", { - value: errorTypes, - writable: false, - enumerable: false, - configurable: false - }); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; - -},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} - -},{}],14:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; - -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; - -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; - -},{}],15:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { -var util = _dereq_("./util"); -var CancellationError = Promise.CancellationError; -var errorObj = util.errorObj; -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); - -function PassThroughHandlerContext(promise, type, handler) { - this.promise = promise; - this.type = type; - this.handler = handler; - this.called = false; - this.cancelPromise = null; -} - -PassThroughHandlerContext.prototype.isFinallyHandler = function() { - return this.type === 0; -}; - -function FinallyHandlerCancelReaction(finallyHandler) { - this.finallyHandler = finallyHandler; -} - -FinallyHandlerCancelReaction.prototype._resultCancelled = function() { - checkCancel(this.finallyHandler); -}; - -function checkCancel(ctx, reason) { - if (ctx.cancelPromise != null) { - if (arguments.length > 1) { - ctx.cancelPromise._reject(reason); - } else { - ctx.cancelPromise._cancel(); - } - ctx.cancelPromise = null; - return true; - } - return false; -} - -function succeed() { - return finallyHandler.call(this, this.promise._target()._settledValue()); -} -function fail(reason) { - if (checkCancel(this, reason)) return; - errorObj.e = reason; - return errorObj; -} -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - if (!this.called) { - this.called = true; - var ret = this.isFinallyHandler() - ? handler.call(promise._boundValue()) - : handler.call(promise._boundValue(), reasonOrValue); - if (ret === NEXT_FILTER) { - return ret; - } else if (ret !== undefined) { - promise._setReturnedNonUndefined(); - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - if (this.cancelPromise != null) { - if (maybePromise._isCancelled()) { - var reason = - new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - errorObj.e = reason; - return errorObj; - } else if (maybePromise.isPending()) { - maybePromise._attachCancellationCallback( - new FinallyHandlerCancelReaction(this)); - } - } - return maybePromise._then( - succeed, fail, undefined, this, undefined); - } - } - } - - if (promise.isRejected()) { - checkCancel(this); - errorObj.e = reasonOrValue; - return errorObj; - } else { - checkCancel(this); - return reasonOrValue; - } -} - -Promise.prototype._passThrough = function(handler, type, success, fail) { - if (typeof handler !== "function") return this.then(); - return this._then(success, - fail, - undefined, - new PassThroughHandlerContext(this, type, handler), - undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThrough(handler, - 0, - finallyHandler, - finallyHandler); -}; - - -Promise.prototype.tap = function (handler) { - return this._passThrough(handler, 1, finallyHandler); -}; - -Promise.prototype.tapCatch = function (handlerOrPredicate) { - var len = arguments.length; - if(len === 1) { - return this._passThrough(handlerOrPredicate, - 1, - undefined, - finallyHandler); - } else { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return Promise.reject(new TypeError( - "tapCatch statement predicate: " - + "expecting an object but got " + util.classString(item) - )); - } - } - catchInstances.length = j; - var handler = arguments[i]; - return this._passThrough(catchFilter(catchInstances, handler, this), - 1, - undefined, - finallyHandler); - } - -}; - -return PassThroughHandlerContext; -}; - -},{"./catch_filter":7,"./util":36}],16:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise, - Proxyable, - debug) { -var errors = _dereq_("./errors"); -var TypeError = errors.TypeError; -var util = _dereq_("./util"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; - -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; - } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} - -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - if (debug.cancellation()) { - var internal = new Promise(INTERNAL); - var _finallyPromise = this._finallyPromise = new Promise(INTERNAL); - this._promise = internal.lastly(function() { - return _finallyPromise; - }); - internal._captureStackTrace(); - internal._setOnCancel(this); - } else { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); - } - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; - this._yieldedPromise = null; - this._cancellationPhase = false; -} -util.inherits(PromiseSpawn, Proxyable); - -PromiseSpawn.prototype._isResolved = function() { - return this._promise === null; -}; - -PromiseSpawn.prototype._cleanup = function() { - this._promise = this._generator = null; - if (debug.cancellation() && this._finallyPromise !== null) { - this._finallyPromise._fulfill(); - this._finallyPromise = null; - } -}; - -PromiseSpawn.prototype._promiseCancelled = function() { - if (this._isResolved()) return; - var implementsReturn = typeof this._generator["return"] !== "undefined"; - - var result; - if (!implementsReturn) { - var reason = new Promise.CancellationError( - "generator .return() sentinel"); - Promise.coroutine.returnSentinel = reason; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - result = tryCatch(this._generator["throw"]).call(this._generator, - reason); - this._promise._popContext(); - } else { - this._promise._pushContext(); - result = tryCatch(this._generator["return"]).call(this._generator, - undefined); - this._promise._popContext(); - } - this._cancellationPhase = true; - this._yieldedPromise = null; - this._continue(result); -}; - -PromiseSpawn.prototype._promiseFulfilled = function(value) { - this._yieldedPromise = null; - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._promiseRejected = function(reason) { - this._yieldedPromise = null; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._resultCancelled = function() { - if (this._yieldedPromise instanceof Promise) { - var promise = this._yieldedPromise; - this._yieldedPromise = null; - promise.cancel(); - } -}; - -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; - -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._promiseFulfilled(undefined); -}; - -PromiseSpawn.prototype._continue = function (result) { - var promise = this._promise; - if (result === errorObj) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); - } else { - return promise._rejectCallback(result.e, false); - } - } - - var value = result.value; - if (result.done === true) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); - } else { - return promise._resolveCallback(value); - } - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._promiseRejected( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } - } - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - this._yieldedPromise = maybePromise; - maybePromise._proxy(this, null); - } else if (((bitField & 33554432) !== 0)) { - Promise._async.invoke( - this._promiseFulfilled, this, maybePromise._value() - ); - } else if (((bitField & 16777216) !== 0)) { - Promise._async.invoke( - this._promiseRejected, this, maybePromise._reason() - ); - } else { - this._promiseCancelled(); - } - } -}; - -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - var ret = spawn.promise(); - spawn._generator = generator; - spawn._promiseFulfilled(undefined); - return ret; - }; -}; - -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - yieldHandlers.push(fn); -}; - -Promise.spawn = function (generatorFunction) { - debug.deprecated("Promise.spawn()", "Promise.coroutine()"); - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; - -},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) { -var util = _dereq_("./util"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!true) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var promiseSetter = function(i) { - return new Function("promise", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = promise; \n\ - ".replace(/Index/g, i)); - }; - - var generateHolderClass = function(total) { - var props = new Array(total); - for (var i = 0; i < props.length; ++i) { - props[i] = "this.p" + (i+1); - } - var assignment = props.join(" = ") + " = null;"; - var cancellationCode= "var promise;\n" + props.map(function(prop) { - return " \n\ - promise = " + prop + "; \n\ - if (promise instanceof Promise) { \n\ - promise.cancel(); \n\ - } \n\ - "; - }).join("\n"); - var passedArguments = props.join(", "); - var name = "Holder$" + total; - - - var code = "return function(tryCatch, errorObj, Promise, async) { \n\ - 'use strict'; \n\ - function [TheName](fn) { \n\ - [TheProperties] \n\ - this.fn = fn; \n\ - this.asyncNeeded = true; \n\ - this.now = 0; \n\ - } \n\ - \n\ - [TheName].prototype._callFunction = function(promise) { \n\ - promise._pushContext(); \n\ - var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ - promise._popContext(); \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(ret.e, false); \n\ - } else { \n\ - promise._resolveCallback(ret); \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype.checkFulfillment = function(promise) { \n\ - var now = ++this.now; \n\ - if (now === [TheTotal]) { \n\ - if (this.asyncNeeded) { \n\ - async.invoke(this._callFunction, this, promise); \n\ - } else { \n\ - this._callFunction(promise); \n\ - } \n\ - \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype._resultCancelled = function() { \n\ - [CancellationCode] \n\ - }; \n\ - \n\ - return [TheName]; \n\ - }(tryCatch, errorObj, Promise, async); \n\ - "; - - code = code.replace(/\[TheName\]/g, name) - .replace(/\[TheTotal\]/g, total) - .replace(/\[ThePassedArguments\]/g, passedArguments) - .replace(/\[TheProperties\]/g, assignment) - .replace(/\[CancellationCode\]/g, cancellationCode); - - return new Function("tryCatch", "errorObj", "Promise", "async", code) - (tryCatch, errorObj, Promise, async); - }; - - var holderClasses = []; - var thenCallbacks = []; - var promiseSetters = []; - - for (var i = 0; i < 8; ++i) { - holderClasses.push(generateHolderClass(i + 1)); - thenCallbacks.push(thenCallback(i + 1)); - promiseSetters.push(promiseSetter(i + 1)); - } - - reject = function (reason) { - this._reject(reason); - }; -}} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!true) { - if (last <= 8 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var HolderClass = holderClasses[last - 1]; - var holder = new HolderClass(fn); - var callbacks = thenCallbacks; - - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - promiseSetters[i](maybePromise, holder); - holder.asyncNeeded = false; - } else if (((bitField & 33554432) !== 0)) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else if (((bitField & 16777216) !== 0)) { - ret._reject(maybePromise._reason()); - } else { - ret._cancel(); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - - if (!ret._isFateSealed()) { - if (holder.asyncNeeded) { - var context = Promise._getContext(); - holder.fn = util.contextBind(context, holder.fn); - } - ret._setAsyncGuaranteed(); - ret._setOnCancel(holder); - } - return ret; - } - } - } - var args = [].slice.call(arguments);; - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; - -},{"./util":36}],18:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - var context = Promise._getContext(); - this._callback = util.contextBind(context, fn); - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = []; - async.invoke(this._asyncInit, this, undefined); - if (util.isArray(promises)) { - for (var i = 0; i < promises.length; ++i) { - var maybePromise = promises[i]; - if (maybePromise instanceof Promise) { - maybePromise.suppressUnhandledRejections(); - } - } - } -} -util.inherits(MappingPromiseArray, PromiseArray); - -MappingPromiseArray.prototype._asyncInit = function() { - this._init$(undefined, -2); -}; - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - - if (index < 0) { - index = (index * -1) - 1; - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return true; - } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return false; - } - if (preservedValues !== null) preservedValues[index] = value; - - var promise = this._promise; - var callback = this._callback; - var receiver = promise._boundValue(); - promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - preservedValues !== null ? "Promise.filter" : "Promise.map", - promise - ); - if (ret === errorObj) { - this._reject(ret.e); - return true; - } - - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - if (limit >= 1) this._inFlight++; - values[index] = maybePromise; - maybePromise._proxy(this, (index + 1) * -1); - return false; - } else if (((bitField & 33554432) !== 0)) { - ret = maybePromise._value(); - } else if (((bitField & 16777216) !== 0)) { - this._reject(maybePromise._reason()); - return true; - } else { - this._cancel(); - return true; - } - } - values[index] = ret; - } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); - } else { - this._resolve(values); - } - return true; - } - return false; -}; - -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); - } -}; - -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; - } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; - -function map(promises, fn, options, _filter) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - - var limit = 0; - if (options !== undefined) { - if (typeof options === "object" && options !== null) { - if (typeof options.concurrency !== "number") { - return Promise.reject( - new TypeError("'concurrency' must be a number but it is " + - util.classString(options.concurrency))); - } - limit = options.concurrency; - } else { - return Promise.reject(new TypeError( - "options argument must be an object but it is " + - util.classString(options))); - } - } - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter).promise(); -} - -Promise.prototype.map = function (fn, options) { - return map(this, fn, options, null); -}; - -Promise.map = function (promises, fn, options, _filter) { - return map(promises, fn, options, _filter); -}; - - -}; - -},{"./util":36}],19:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.method", ret); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value; - if (arguments.length > 1) { - debug.deprecated("calling Promise.try with more than 1 argument"); - var arg = arguments[1]; - var ctx = arguments[2]; - value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) - : tryCatch(fn).call(ctx, arg); - } else { - value = tryCatch(fn)(); - } - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.try", ret); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false); - } else { - this._resolveCallback(value, true); - } -}; -}; - -},{"./util":36}],20:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = _dereq_("./errors"); -var OperationalError = errors.OperationalError; -var es5 = _dereq_("./es5"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise, multiArgs) { - return function(err, value) { - if (promise === null) return; - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (!multiArgs) { - promise._fulfill(value); - } else { - var args = [].slice.call(arguments, 1);; - promise._fulfill(args); - } - promise = null; - }; -} - -module.exports = nodebackForPromise; - -},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var util = _dereq_("./util"); -var async = Promise._async; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = - tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundValue(); - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var newReason = new Error(reason + ""); - newReason.cause = reason; - reason = newReason; - } - var ret = tryCatch(nodeback).call(promise._boundValue(), reason); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, - options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); - } - return this; -}; -}; - -},{"./util":36}],22:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var reflectHandler = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -function Proxyable() {} -var UNDEFINED_BINDING = {}; -var util = _dereq_("./util"); -util.setReflectHandler(reflectHandler); - -var getDomain = function() { - var domain = process.domain; - if (domain === undefined) { - return null; - } - return domain; -}; -var getContextDefault = function() { - return null; -}; -var getContextDomain = function() { - return { - domain: getDomain(), - async: null - }; -}; -var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ? - _dereq_("async_hooks").AsyncResource : null; -var getContextAsyncHooks = function() { - return { - domain: getDomain(), - async: new AsyncResource("Bluebird::Promise") - }; -}; -var getContext = util.isNode ? getContextDomain : getContextDefault; -util.notEnumerableProp(Promise, "_getContext", getContext); -var enableAsyncHooks = function() { - getContext = getContextAsyncHooks; - util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks); -}; -var disableAsyncHooks = function() { - getContext = getContextDomain; - util.notEnumerableProp(Promise, "_getContext", getContextDomain); -}; - -var es5 = _dereq_("./es5"); -var Async = _dereq_("./async"); -var async = new Async(); -es5.defineProperty(Promise, "_async", {value: async}); -var errors = _dereq_("./errors"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -var CancellationError = Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {}; -var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL); -var PromiseArray = - _dereq_("./promise_array")(Promise, INTERNAL, - tryConvertToPromise, apiRejection, Proxyable); -var Context = _dereq_("./context")(Promise); - /*jshint unused:false*/ -var createContext = Context.create; - -var debug = _dereq_("./debuggability")(Promise, Context, - enableAsyncHooks, disableAsyncHooks); -var CapturedTrace = debug.CapturedTrace; -var PassThroughHandlerContext = - _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); -var nodebackForPromise = _dereq_("./nodeback"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function check(self, executor) { - if (self == null || self.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (typeof executor !== "function") { - throw new TypeError("expecting a function but got " + util.classString(executor)); - } - -} - -function Promise(executor) { - if (executor !== INTERNAL) { - check(this, executor); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._resolveFromExecutor(executor); - this._promiseCreated(); - this._fireEvent("promiseCreated", this); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return apiRejection("Catch statement predicate: " + - "expecting an object but got " + util.classString(item)); - } - } - catchInstances.length = j; - fn = arguments[i]; - - if (typeof fn !== "function") { - throw new TypeError("The last argument to .catch() " + - "must be a function, got " + util.toString(fn)); - } - return this.then(undefined, catchFilter(catchInstances, fn, this)); - } - return this.then(undefined, fn); -}; - -Promise.prototype.reflect = function () { - return this._then(reflectHandler, - reflectHandler, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject) { - if (debug.warnings() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, undefined, undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject) { - var promise = - this._then(didFulfill, didReject, undefined, undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - return this.all()._then(fn, undefined, undefined, APPLY, undefined); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - if (arguments.length > 0) { - this._warn(".all() was passed arguments but it does not take any"); - } - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.getNewLibraryCopy = module.exports; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = Promise.fromCallback = function(fn) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs - : false; - var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); - if (result === errorObj) { - ret._rejectCallback(result.e, true); - } - if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._setFulfilled(); - ret._rejectionHandler0 = obj; - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - return async.setScheduler(fn); -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - _, receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var promise = haveInternalData ? internalData : new Promise(INTERNAL); - var target = this._target(); - var bitField = target._bitField; - - if (!haveInternalData) { - promise._propagateFrom(this, 3); - promise._captureStackTrace(); - if (receiver === undefined && - ((this._bitField & 2097152) !== 0)) { - if (!((bitField & 50397184) === 0)) { - receiver = this._boundValue(); - } else { - receiver = target === this ? undefined : this._boundTo; - } - } - this._fireEvent("promiseChained", this, promise); - } - - var context = getContext(); - if (!((bitField & 50397184) === 0)) { - var handler, value, settler = target._settlePromiseCtx; - if (((bitField & 33554432) !== 0)) { - value = target._rejectionHandler0; - handler = didFulfill; - } else if (((bitField & 16777216) !== 0)) { - value = target._fulfillmentHandler0; - handler = didReject; - target._unsetRejectionIsUnhandled(); - } else { - settler = target._settlePromiseLateCancellationObserver; - value = new CancellationError("late cancellation observer"); - target._attachExtraTrace(value); - handler = didReject; - } - - async.invoke(settler, target, { - handler: util.contextBind(context, handler), - promise: promise, - receiver: receiver, - value: value - }); - } else { - target._addCallbacks(didFulfill, didReject, promise, - receiver, context); - } - - return promise; -}; - -Promise.prototype._length = function () { - return this._bitField & 65535; -}; - -Promise.prototype._isFateSealed = function () { - return (this._bitField & 117506048) !== 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 67108864) === 67108864; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -65536) | - (len & 65535); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 33554432; - this._fireEvent("promiseFulfilled", this); -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 16777216; - this._fireEvent("promiseRejected", this); -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 67108864; - this._fireEvent("promiseResolved", this); -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._unsetCancelled = function() { - this._bitField = this._bitField & (~65536); -}; - -Promise.prototype._setCancelled = function() { - this._bitField = this._bitField | 65536; - this._fireEvent("promiseCancelled", this); -}; - -Promise.prototype._setWillBeCancelled = function() { - this._bitField = this._bitField | 8388608; -}; - -Promise.prototype._setAsyncGuaranteed = function() { - if (async.hasCustomScheduler()) return; - var bitField = this._bitField; - this._bitField = bitField | - (((bitField & 536870912) >> 2) ^ - 134217728); -}; - -Promise.prototype._setNoAsyncGuarantee = function() { - this._bitField = (this._bitField | 536870912) & - (~134217728); -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 ? this._receiver0 : this[ - index * 4 - 4 + 3]; - if (ret === UNDEFINED_BINDING) { - return undefined; - } else if (ret === undefined && this._isBound()) { - return this._boundValue(); - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return this[ - index * 4 - 4 + 2]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return this[ - index * 4 - 4 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return this[ - index * 4 - 4 + 1]; -}; - -Promise.prototype._boundValue = function() {}; - -Promise.prototype._migrateCallback0 = function (follower) { - var bitField = follower._bitField; - var fulfill = follower._fulfillmentHandler0; - var reject = follower._rejectionHandler0; - var promise = follower._promise0; - var receiver = follower._receiverAt(0); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._migrateCallbackAt = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - promise, - receiver, - context -) { - var index = this._length(); - - if (index >= 65535 - 4) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - this._receiver0 = receiver; - if (typeof fulfill === "function") { - this._fulfillmentHandler0 = util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this._rejectionHandler0 = util.contextBind(context, reject); - } - } else { - var base = index * 4 - 4; - this[base + 2] = promise; - this[base + 3] = receiver; - if (typeof fulfill === "function") { - this[base + 0] = - util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this[base + 1] = - util.contextBind(context, reject); - } - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._proxy = function (proxyable, arg) { - this._addCallbacks(undefined, undefined, arg, proxyable, null); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (((this._bitField & 117506048) !== 0)) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - if (shouldBind) this._propagateFrom(maybePromise, 2); - - - var promise = maybePromise._target(); - - if (promise === this) { - this._reject(makeSelfResolutionError()); - return; - } - - var bitField = promise._bitField; - if (((bitField & 50397184) === 0)) { - var len = this._length(); - if (len > 0) promise._migrateCallback0(this); - for (var i = 1; i < len; ++i) { - promise._migrateCallbackAt(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(maybePromise); - } else if (((bitField & 33554432) !== 0)) { - this._fulfill(promise._value()); - } else if (((bitField & 16777216) !== 0)) { - this._reject(promise._reason()); - } else { - var reason = new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - this._reject(reason); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, ignoreNonErrorWarnings) { - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { - var message = "a promise was rejected with a non-error: " + - util.classString(reason); - this._warn(message, true); - } - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason); -}; - -Promise.prototype._resolveFromExecutor = function (executor) { - if (executor === INTERNAL) return; - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = this._execute(executor, function(value) { - promise._resolveCallback(value); - }, function (reason) { - promise._rejectCallback(reason, synchronous); - }); - synchronous = false; - this._popContext(); - - if (r !== undefined) { - promise._rejectCallback(r, true); - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - var bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - promise._pushContext(); - var x; - if (receiver === APPLY) { - if (!value || typeof value.length !== "number") { - x = errorObj; - x.e = new TypeError("cannot .spread() a non-array: " + - util.classString(value)); - } else { - x = tryCatch(handler).apply(this._boundValue(), value); - } - } else { - x = tryCatch(handler).call(receiver, value); - } - var promiseCreated = promise._popContext(); - bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - - if (x === NEXT_FILTER) { - promise._reject(value); - } else if (x === errorObj) { - promise._rejectCallback(x.e, false); - } else { - debug.checkForgottenReturns(x, promiseCreated, "", promise, this); - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._settlePromise = function(promise, handler, receiver, value) { - var isPromise = promise instanceof Promise; - var bitField = this._bitField; - var asyncGuaranteed = ((bitField & 134217728) !== 0); - if (((bitField & 65536) !== 0)) { - if (isPromise) promise._invokeInternalOnCancel(); - - if (receiver instanceof PassThroughHandlerContext && - receiver.isFinallyHandler()) { - receiver.cancelPromise = promise; - if (tryCatch(handler).call(receiver, value) === errorObj) { - promise._reject(errorObj.e); - } - } else if (handler === reflectHandler) { - promise._fulfill(reflectHandler.call(receiver)); - } else if (receiver instanceof Proxyable) { - receiver._promiseCancelled(promise); - } else if (isPromise || promise instanceof PromiseArray) { - promise._cancel(); - } else { - receiver.cancel(); - } - } else if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof Proxyable) { - if (!receiver._isResolved()) { - if (((bitField & 33554432) !== 0)) { - receiver._promiseFulfilled(value, promise); - } else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - if (((bitField & 33554432) !== 0)) { - promise._fulfill(value); - } else { - promise._reject(value); - } - } -}; - -Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { - var handler = ctx.handler; - var promise = ctx.promise; - var receiver = ctx.receiver; - var value = ctx.value; - if (typeof handler === "function") { - if (!(promise instanceof Promise)) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (promise instanceof Promise) { - promise._reject(value); - } -}; - -Promise.prototype._settlePromiseCtx = function(ctx) { - this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); -}; - -Promise.prototype._settlePromise0 = function(handler, value, bitField) { - var promise = this._promise0; - var receiver = this._receiverAt(0); - this._promise0 = undefined; - this._receiver0 = undefined; - this._settlePromise(promise, handler, receiver, value); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - var base = index * 4 - 4; - this[base + 2] = - this[base + 3] = - this[base + 0] = - this[base + 1] = undefined; -}; - -Promise.prototype._fulfill = function (value) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._reject(err); - } - this._setFulfilled(); - this._rejectionHandler0 = value; - - if ((bitField & 65535) > 0) { - if (((bitField & 134217728) !== 0)) { - this._settlePromises(); - } else { - async.settlePromises(this); - } - this._dereferenceTrace(); - } -}; - -Promise.prototype._reject = function (reason) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - this._setRejected(); - this._fulfillmentHandler0 = reason; - - if (this._isFinal()) { - return async.fatalError(reason, util.isNode); - } - - if ((bitField & 65535) > 0) { - async.settlePromises(this); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._fulfillPromises = function (len, value) { - for (var i = 1; i < len; i++) { - var handler = this._fulfillmentHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, value); - } -}; - -Promise.prototype._rejectPromises = function (len, reason) { - for (var i = 1; i < len; i++) { - var handler = this._rejectionHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, reason); - } -}; - -Promise.prototype._settlePromises = function () { - var bitField = this._bitField; - var len = (bitField & 65535); - - if (len > 0) { - if (((bitField & 16842752) !== 0)) { - var reason = this._fulfillmentHandler0; - this._settlePromise0(this._rejectionHandler0, reason, bitField); - this._rejectPromises(len, reason); - } else { - var value = this._rejectionHandler0; - this._settlePromise0(this._fulfillmentHandler0, value, bitField); - this._fulfillPromises(len, value); - } - this._setLength(0); - } - this._clearCancellationData(); -}; - -Promise.prototype._settledValue = function() { - var bitField = this._bitField; - if (((bitField & 33554432) !== 0)) { - return this._rejectionHandler0; - } else if (((bitField & 16777216) !== 0)) { - return this._fulfillmentHandler0; - } -}; - -if (typeof Symbol !== "undefined" && Symbol.toStringTag) { - es5.defineProperty(Promise.prototype, Symbol.toStringTag, { - get: function () { - return "Object"; - } - }); -} - -function deferResolve(v) {this.promise._resolveCallback(v);} -function deferReject(v) {this.promise._rejectCallback(v, false);} - -Promise.defer = Promise.pending = function() { - debug.deprecated("Promise.defer", "new Promise"); - var promise = new Promise(INTERNAL); - return { - promise: promise, - resolve: deferResolve, - reject: deferReject - }; -}; - -util.notEnumerableProp(Promise, - "_makeSelfResolutionError", - makeSelfResolutionError); - -_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, - debug); -_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); -_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); -_dereq_("./direct_resolve")(Promise); -_dereq_("./synchronous_inspection")(Promise); -_dereq_("./join")( - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async); -Promise.Promise = Promise; -Promise.version = "3.7.1"; -_dereq_('./call_get.js')(Promise); -_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); -_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -_dereq_('./nodeify.js')(Promise); -_dereq_('./promisify.js')(Promise, INTERNAL); -_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -_dereq_('./settle.js')(Promise, PromiseArray, debug); -_dereq_('./some.js')(Promise, PromiseArray, apiRejection); -_dereq_('./timers.js')(Promise, INTERNAL, debug); -_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); -_dereq_('./any.js')(Promise); -_dereq_('./each.js')(Promise, INTERNAL); -_dereq_('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - debug.setBounds(Async.firstLineError, util.lastLineError); - return Promise; - -}; - -},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36,"async_hooks":undefined}],23:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection, Proxyable) { -var util = _dereq_("./util"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - case -6: return new Map(); - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - if (values instanceof Promise) { - promise._propagateFrom(values, 3); - values.suppressUnhandledRejections(); - } - promise._setOnCancel(this); - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -util.inherits(PromiseArray, Proxyable); - -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - var bitField = values._bitField; - ; - this._values = values; - - if (((bitField & 50397184) === 0)) { - this._promise._setAsyncGuaranteed(); - return values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - } else if (((bitField & 33554432) !== 0)) { - values = values._value(); - } else if (((bitField & 16777216) !== 0)) { - return this._reject(values._reason()); - } else { - return this._cancel(); - } - } - values = util.asArray(values); - if (values === null) { - var err = apiRejection( - "expecting an array or an iterable object but got " + util.classString(values)).reason(); - this._promise._rejectCallback(err, false); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - this._iterate(values); -}; - -PromiseArray.prototype._iterate = function(values) { - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var result = this._promise; - var isResolved = false; - var bitField = null; - for (var i = 0; i < len; ++i) { - var maybePromise = tryConvertToPromise(values[i], result); - - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - bitField = maybePromise._bitField; - } else { - bitField = null; - } - - if (isResolved) { - if (bitField !== null) { - maybePromise.suppressUnhandledRejections(); - } - } else if (bitField !== null) { - if (((bitField & 50397184) === 0)) { - maybePromise._proxy(this, i); - this._values[i] = maybePromise; - } else if (((bitField & 33554432) !== 0)) { - isResolved = this._promiseFulfilled(maybePromise._value(), i); - } else if (((bitField & 16777216) !== 0)) { - isResolved = this._promiseRejected(maybePromise._reason(), i); - } else { - isResolved = this._promiseCancelled(i); - } - } else { - isResolved = this._promiseFulfilled(maybePromise, i); - } - } - if (!isResolved) result._setAsyncGuaranteed(); -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype._cancel = function() { - if (this._isResolved() || !this._promise._isCancellable()) return; - this._values = null; - this._promise._cancel(); -}; - -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false); -}; - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; - -PromiseArray.prototype._promiseCancelled = function() { - this._cancel(); - return true; -}; - -PromiseArray.prototype._promiseRejected = function (reason) { - this._totalResolved++; - this._reject(reason); - return true; -}; - -PromiseArray.prototype._resultCancelled = function() { - if (this._isResolved()) return; - var values = this._values; - this._cancel(); - if (values instanceof Promise) { - values.cancel(); - } else { - for (var i = 0; i < values.length; ++i) { - if (values[i] instanceof Promise) { - values[i].cancel(); - } - } - } -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; - -},{"./util":36}],24:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = _dereq_("./util"); -var nodebackForPromise = _dereq_("./nodeback"); -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = _dereq_("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyProps = [ - "arity", "length", - "name", - "arguments", - "caller", - "callee", - "prototype", - "__isPromisified__" -]; -var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); - -var defaultFilter = function(name) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - name !== "constructor"; -}; - -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} - -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} - -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a" - .replace("%s", suffix)); - } - } - } - } -} - -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} - -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; - -var makeNodePromisifiedEval; -if (!true) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; - -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; - -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; - -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; - -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn, _, multiArgs) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; - - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); - } - - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } - - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; - } - - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - var body = "'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\ - return promise; \n\ - }; \n\ - notEnumerableProp(ret, '__isPromisified__', true); \n\ - return ret; \n\ - ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode); - body = body.replace("Parameters", parameterDeclaration(newParameterCount)); - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "notEnumerableProp", - "INTERNAL", - body)( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - util.notEnumerableProp, - INTERNAL); -}; -} - -function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; - } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise, multiArgs); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); - return promise; - } - util.notEnumerableProp(promisified, "__isPromisified__", true); - return promisified; -} - -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; - -function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); - - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - if (promisifier === makeNodePromisified) { - obj[promisifiedKey] = - makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); - } else { - var promisified = promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, - fn, suffix, multiArgs); - }); - util.notEnumerableProp(promisified, "__isPromisified__", true); - obj[promisifiedKey] = promisified; - } - } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver, multiArgs) { - return makeNodePromisified(callback, receiver, undefined, - callback, null, multiArgs); -} - -Promise.promisify = function (fn, options) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - if (isPromisified(fn)) { - return fn; - } - options = Object(options); - var receiver = options.context === undefined ? THIS : options.context; - var multiArgs = !!options.multiArgs; - var ret = promisify(fn, receiver, multiArgs); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - options = Object(options); - var multiArgs = !!options.multiArgs; - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; - - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier, - multiArgs); - promisifyAll(value, suffix, filter, promisifier, multiArgs); - } - } - - return promisifyAll(target, suffix, filter, promisifier, multiArgs); -}; -}; - - -},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util"); -var isObject = util.isObject; -var es5 = _dereq_("./es5"); -var Es6Map; -if (typeof Map === "function") Es6Map = Map; - -var mapToEntries = (function() { - var index = 0; - var size = 0; - - function extractEntry(value, key) { - this[index] = value; - this[index + size] = key; - index++; - } - - return function mapToEntries(map) { - size = map.size; - index = 0; - var ret = new Array(map.size * 2); - map.forEach(extractEntry, ret); - return ret; - }; -})(); - -var entriesToMap = function(entries) { - var ret = new Es6Map(); - var length = entries.length / 2 | 0; - for (var i = 0; i < length; ++i) { - var key = entries[length + i]; - var value = entries[i]; - ret.set(key, value); - } - return ret; -}; - -function PropertiesPromiseArray(obj) { - var isMap = false; - var entries; - if (Es6Map !== undefined && obj instanceof Es6Map) { - entries = mapToEntries(obj); - isMap = true; - } else { - var keys = es5.keys(obj); - var len = keys.length; - entries = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - entries[i] = obj[key]; - entries[i + len] = key; - } - } - this.constructor$(entries); - this._isMap = isMap; - this._init$(undefined, isMap ? -6 : -3); -} -util.inherits(PropertiesPromiseArray, PromiseArray); - -PropertiesPromiseArray.prototype._init = function () {}; - -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val; - if (this._isMap) { - val = entriesToMap(this._values); - } else { - val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - } - this._resolve(val); - return true; - } - return false; -}; - -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; - -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); - - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } - - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 2); - } - return ret; -} - -Promise.prototype.props = function () { - return props(this); -}; - -Promise.props = function (promises) { - return props(promises); -}; -}; - -},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; - -},{}],27:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util"); - -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; - -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); - - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else { - promises = util.asArray(promises); - if (promises === null) - return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); - } - - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 3); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; - - if (val === undefined && !(i in promises)) { - continue; - } - - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} - -Promise.race = function (promises) { - return race(promises, undefined); -}; - -Promise.prototype.race = function () { - return race(this, undefined); -}; - -}; - -},{"./util":36}],28:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; - -function ReductionPromiseArray(promises, fn, initialValue, _each) { - this.constructor$(promises); - var context = Promise._getContext(); - this._fn = util.contextBind(context, fn); - if (initialValue !== undefined) { - initialValue = Promise.resolve(initialValue); - initialValue._attachCancellationCallback(this); - } - this._initialValue = initialValue; - this._currentCancellable = null; - if(_each === INTERNAL) { - this._eachValues = Array(this._length); - } else if (_each === 0) { - this._eachValues = null; - } else { - this._eachValues = undefined; - } - this._promise._captureStackTrace(); - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); - -ReductionPromiseArray.prototype._gotAccum = function(accum) { - if (this._eachValues !== undefined && - this._eachValues !== null && - accum !== INTERNAL) { - this._eachValues.push(accum); - } -}; - -ReductionPromiseArray.prototype._eachComplete = function(value) { - if (this._eachValues !== null) { - this._eachValues.push(value); - } - return this._eachValues; -}; - -ReductionPromiseArray.prototype._init = function() {}; - -ReductionPromiseArray.prototype._resolveEmptyArray = function() { - this._resolve(this._eachValues !== undefined ? this._eachValues - : this._initialValue); -}; - -ReductionPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -ReductionPromiseArray.prototype._resolve = function(value) { - this._promise._resolveCallback(value); - this._values = null; -}; - -ReductionPromiseArray.prototype._resultCancelled = function(sender) { - if (sender === this._initialValue) return this._cancel(); - if (this._isResolved()) return; - this._resultCancelled$(); - if (this._currentCancellable instanceof Promise) { - this._currentCancellable.cancel(); - } - if (this._initialValue instanceof Promise) { - this._initialValue.cancel(); - } -}; - -ReductionPromiseArray.prototype._iterate = function (values) { - this._values = values; - var value; - var i; - var length = values.length; - if (this._initialValue !== undefined) { - value = this._initialValue; - i = 0; - } else { - value = Promise.resolve(values[0]); - i = 1; - } - - this._currentCancellable = value; - - for (var j = i; j < length; ++j) { - var maybePromise = values[j]; - if (maybePromise instanceof Promise) { - maybePromise.suppressUnhandledRejections(); - } - } - - if (!value.isRejected()) { - for (; i < length; ++i) { - var ctx = { - accum: null, - value: values[i], - index: i, - length: length, - array: this - }; - - value = value._then(gotAccum, undefined, undefined, ctx, undefined); - - if ((i & 127) === 0) { - value._setNoAsyncGuarantee(); - } - } - } - - if (this._eachValues !== undefined) { - value = value - ._then(this._eachComplete, undefined, undefined, this, undefined); - } - value._then(completed, completed, undefined, value, this); -}; - -Promise.prototype.reduce = function (fn, initialValue) { - return reduce(this, fn, initialValue, null); -}; - -Promise.reduce = function (promises, fn, initialValue, _each) { - return reduce(promises, fn, initialValue, _each); -}; - -function completed(valueOrReason, array) { - if (this.isFulfilled()) { - array._resolve(valueOrReason); - } else { - array._reject(valueOrReason); - } -} - -function reduce(promises, fn, initialValue, _each) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var array = new ReductionPromiseArray(promises, fn, initialValue, _each); - return array.promise(); -} - -function gotAccum(accum) { - this.accum = accum; - this.array._gotAccum(accum); - var value = tryConvertToPromise(this.value, this.array._promise); - if (value instanceof Promise) { - this.array._currentCancellable = value; - return value._then(gotValue, undefined, undefined, this, undefined); - } else { - return gotValue.call(this, value); - } -} - -function gotValue(value) { - var array = this.array; - var promise = array._promise; - var fn = tryCatch(array._fn); - promise._pushContext(); - var ret; - if (array._eachValues !== undefined) { - ret = fn.call(promise._boundValue(), value, this.index, this.length); - } else { - ret = fn.call(promise._boundValue(), - this.accum, value, this.index, this.length); - } - if (ret instanceof Promise) { - array._currentCancellable = ret; - } - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", - promise - ); - return ret; -} -}; - -},{"./util":36}],29:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var schedule; -var noAsyncScheduler = function() { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var NativePromise = util.getNativePromise(); -if (util.isNode && typeof MutationObserver === "undefined") { - var GlobalSetImmediate = global.setImmediate; - var ProcessNextTick = process.nextTick; - schedule = util.isRecentNode - ? function(fn) { GlobalSetImmediate.call(global, fn); } - : function(fn) { ProcessNextTick.call(process, fn); }; -} else if (typeof NativePromise === "function" && - typeof NativePromise.resolve === "function") { - var nativePromise = NativePromise.resolve(); - schedule = function(fn) { - nativePromise.then(fn); - }; -} else if ((typeof MutationObserver !== "undefined") && - !(typeof window !== "undefined" && - window.navigator && - (window.navigator.standalone || window.cordova)) && - ("classList" in document.documentElement)) { - schedule = (function() { - var div = document.createElement("div"); - var opts = {attributes: true}; - var toggleScheduled = false; - var div2 = document.createElement("div"); - var o2 = new MutationObserver(function() { - div.classList.toggle("foo"); - toggleScheduled = false; - }); - o2.observe(div2, opts); - - var scheduleToggle = function() { - if (toggleScheduled) return; - toggleScheduled = true; - div2.classList.toggle("foo"); - }; - - return function schedule(fn) { - var o = new MutationObserver(function() { - o.disconnect(); - fn(); - }); - o.observe(div, opts); - scheduleToggle(); - }; - })(); -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; - -},{"./util":36}],30:[function(_dereq_,module,exports){ -"use strict"; -module.exports = - function(Promise, PromiseArray, debug) { -var PromiseInspection = Promise.PromiseInspection; -var util = _dereq_("./util"); - -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); - -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; - -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 33554432; - ret._settledValueField = value; - return this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 16777216; - ret._settledValueField = reason; - return this._promiseResolved(index, ret); -}; - -Promise.settle = function (promises) { - debug.deprecated(".settle()", ".reflect()"); - return new SettledPromiseArray(promises).promise(); -}; - -Promise.allSettled = function (promises) { - return new SettledPromiseArray(promises).promise(); -}; - -Promise.prototype.settle = function () { - return Promise.settle(this); -}; -}; - -},{"./util":36}],31:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = _dereq_("./util"); -var RangeError = _dereq_("./errors").RangeError; -var AggregateError = _dereq_("./errors").AggregateError; -var isArray = util.isArray; -var CANCELLATION = {}; - - -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); - -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; - -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; - -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; - -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; - -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; - -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - return true; - } - return false; - -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - return this._checkOutcome(); -}; - -SomePromiseArray.prototype._promiseCancelled = function () { - if (this._values instanceof Promise || this._values == null) { - return this._cancel(); - } - this._addRejected(CANCELLATION); - return this._checkOutcome(); -}; - -SomePromiseArray.prototype._checkOutcome = function() { - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - if (this._values[i] !== CANCELLATION) { - e.push(this._values[i]); - } - } - if (e.length > 0) { - this._reject(e); - } else { - this._cancel(); - } - return true; - } - return false; -}; - -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; - -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; - -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; - -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; - -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; - -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; - -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; - -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} - -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; - -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; - -Promise._SomePromiseArray = SomePromiseArray; -}; - -},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValueField = promise._isFateSealed() - ? promise._settledValue() : undefined; - } - else { - this._bitField = 0; - this._settledValueField = undefined; - } -} - -PromiseInspection.prototype._settledValue = function() { - return this._settledValueField; -}; - -var value = PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var reason = PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { - return (this._bitField & 33554432) !== 0; -}; - -var isRejected = PromiseInspection.prototype.isRejected = function () { - return (this._bitField & 16777216) !== 0; -}; - -var isPending = PromiseInspection.prototype.isPending = function () { - return (this._bitField & 50397184) === 0; -}; - -var isResolved = PromiseInspection.prototype.isResolved = function () { - return (this._bitField & 50331648) !== 0; -}; - -PromiseInspection.prototype.isCancelled = function() { - return (this._bitField & 8454144) !== 0; -}; - -Promise.prototype.__isCancelled = function() { - return (this._bitField & 65536) === 65536; -}; - -Promise.prototype._isCancelled = function() { - return this._target().__isCancelled(); -}; - -Promise.prototype.isCancelled = function() { - return (this._target()._bitField & 8454144) !== 0; -}; - -Promise.prototype.isPending = function() { - return isPending.call(this._target()); -}; - -Promise.prototype.isRejected = function() { - return isRejected.call(this._target()); -}; - -Promise.prototype.isFulfilled = function() { - return isFulfilled.call(this._target()); -}; - -Promise.prototype.isResolved = function() { - return isResolved.call(this._target()); -}; - -Promise.prototype.value = function() { - return value.call(this._target()); -}; - -Promise.prototype.reason = function() { - var target = this._target(); - target._unsetRejectionIsUnhandled(); - return reason.call(target); -}; - -Promise.prototype._value = function() { - return this._settledValue(); -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue(); -}; - -Promise.PromiseInspection = PromiseInspection; -}; - -},{}],33:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) return obj; - var then = getThen(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfill, - ret._reject, - undefined, - ret, - null - ); - return ret; - } - return doThenable(obj, then, context); - } - } - return obj; -} - -function doGetThen(obj) { - return obj.then; -} - -function getThen(obj) { - try { - return doGetThen(obj); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - try { - return hasProp.call(obj, "_promise0"); - } catch (e) { - return false; - } -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, resolve, reject); - synchronous = false; - - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolve(value) { - if (!promise) return; - promise._resolveCallback(value); - promise = null; - } - - function reject(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - return ret; -} - -return tryConvertToPromise; -}; - -},{"./util":36}],34:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, debug) { -var util = _dereq_("./util"); -var TimeoutError = Promise.TimeoutError; - -function HandleWrapper(handle) { - this.handle = handle; -} - -HandleWrapper.prototype._resultCancelled = function() { - clearTimeout(this.handle); -}; - -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (ms, value) { - var ret; - var handle; - if (value !== undefined) { - ret = Promise.resolve(value) - ._then(afterValue, null, null, ms, undefined); - if (debug.cancellation() && value instanceof Promise) { - ret._setOnCancel(value); - } - } else { - ret = new Promise(INTERNAL); - handle = setTimeout(function() { ret._fulfill(); }, +ms); - if (debug.cancellation()) { - ret._setOnCancel(new HandleWrapper(handle)); - } - ret._captureStackTrace(); - } - ret._setAsyncGuaranteed(); - return ret; -}; - -Promise.prototype.delay = function (ms) { - return delay(ms, this); -}; - -var afterTimeout = function (promise, message, parent) { - var err; - if (typeof message !== "string") { - if (message instanceof Error) { - err = message; - } else { - err = new TimeoutError("operation timed out"); - } - } else { - err = new TimeoutError(message); - } - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._reject(err); - - if (parent != null) { - parent.cancel(); - } -}; - -function successClear(value) { - clearTimeout(this.handle); - return value; -} - -function failureClear(reason) { - clearTimeout(this.handle); - throw reason; -} - -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret, parent; - - var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { - if (ret.isPending()) { - afterTimeout(ret, message, parent); - } - }, ms)); - - if (debug.cancellation()) { - parent = this.then(); - ret = parent._then(successClear, failureClear, - undefined, handleWrapper, undefined); - ret._setOnCancel(handleWrapper); - } else { - ret = this._then(successClear, failureClear, - undefined, handleWrapper, undefined); - } - - return ret; -}; - -}; - -},{"./util":36}],35:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext, INTERNAL, debug) { - var util = _dereq_("./util"); - var TypeError = _dereq_("./errors").TypeError; - var inherits = _dereq_("./util").inherits; - var errorObj = util.errorObj; - var tryCatch = util.tryCatch; - var NULL = {}; - - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } - - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = new Promise(INTERNAL); - function iterator() { - if (i >= len) return ret._fulfill(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); - } - } - iterator(); - } - iterator(); - return ret; - } - - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } - - Disposer.prototype.data = function () { - return this._data; - }; - - Disposer.prototype.promise = function () { - return this._promise; - }; - - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return NULL; - }; - - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== NULL - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; - - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; - - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); - - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; - - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } - - function ResourceList(length) { - this.length = length; - this.promise = null; - this[length-1] = null; - } - - ResourceList.prototype._resultCancelled = function() { - var len = this.length; - for (var i = 0; i < len; ++i) { - var item = this[i]; - if (item instanceof Promise) { - item.cancel(); - } - } - }; - - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var input; - var spreadArgs = true; - if (len === 2 && Array.isArray(arguments[0])) { - input = arguments[0]; - len = input.length; - spreadArgs = false; - } else { - input = arguments; - len--; - } - var resources = new ResourceList(len); - for (var i = 0; i < len; ++i) { - var resource = input[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } - - var reflectedResources = new Array(resources.length); - for (var i = 0; i < reflectedResources.length; ++i) { - reflectedResources[i] = Promise.resolve(resources[i]).reflect(); - } - - var resultPromise = Promise.all(reflectedResources) - .then(function(inspections) { - for (var i = 0; i < inspections.length; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - errorObj.e = inspection.error(); - return errorObj; - } else if (!inspection.isFulfilled()) { - resultPromise.cancel(); - return; - } - inspections[i] = inspection.value(); - } - promise._pushContext(); - - fn = tryCatch(fn); - var ret = spreadArgs - ? fn.apply(undefined, inspections) : fn(inspections); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, promiseCreated, "Promise.using", promise); - return ret; - }); - - var promise = resultPromise.lastly(function() { - var inspection = new Promise.PromiseInspection(resultPromise); - return dispose(resources, inspection); - }); - resources.promise = promise; - promise._setOnCancel(resources); - return promise; - }; - - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 131072; - this._disposer = disposer; - }; - - Promise.prototype._isDisposable = function () { - return (this._bitField & 131072) > 0; - }; - - Promise.prototype._getDisposer = function () { - return this._disposer; - }; - - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~131072); - this._disposer = undefined; - }; - - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; - -}; - -},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var canEvaluate = typeof navigator == "undefined"; - -var errorObj = {e: {}}; -var tryCatchTarget; -var globalObject = typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - typeof global !== "undefined" ? global : - this !== undefined ? this : null; - -function tryCatcher() { - try { - var target = tryCatchTarget; - tryCatchTarget = null; - return target.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return typeof value === "function" || - typeof value === "object" && value !== null; -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - var excludedPrototypes = [ - Array.prototype, - Object.prototype, - Function.prototype - ]; - - var isExcludedProto = function(val) { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (excludedPrototypes[i] === val) { - return true; - } - } - return false; - }; - - if (es5.isES5) { - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && !isExcludedProto(obj)) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - var hasProp = {}.hasOwnProperty; - return function(obj) { - if (isExcludedProto(obj)) return []; - var ret = []; - - /*jshint forin:false */ - enumeration: for (var key in obj) { - if (hasProp.call(obj, key)) { - ret.push(key); - } else { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (hasProp.call(excludedPrototypes[i], key)) { - continue enumeration; - } - } - ret.push(key); - } - } - return ret; - }; - } - -})(); - -var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - - var hasMethods = es5.isES5 && keys.length > 1; - var hasMethodsOtherThanConstructor = keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - var hasThisAssignmentAndStaticMethods = - thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; - - if (hasMethods || hasMethodsOtherThanConstructor || - hasThisAssignmentAndStaticMethods) { - return true; - } - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function FakeConstructor() {} - FakeConstructor.prototype = obj; - var receiver = new FakeConstructor(); - function ic() { - return typeof receiver.foo; - } - ic(); - ic(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function isError(obj) { - return obj instanceof Error || - (obj !== null && - typeof obj === "object" && - typeof obj.message === "string" && - typeof obj.name === "string"); -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return isError(obj) && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - try { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } catch (ignore) {} - } - } -} - -var asArray = function(v) { - if (es5.isArray(v)) { - return v; - } - return null; -}; - -if (typeof Symbol !== "undefined" && Symbol.iterator) { - var ArrayFrom = typeof Array.from === "function" ? function(v) { - return Array.from(v); - } : function(v) { - var ret = []; - var it = v[Symbol.iterator](); - var itResult; - while (!((itResult = it.next()).done)) { - ret.push(itResult.value); - } - return ret; - }; - - asArray = function(v) { - if (es5.isArray(v)) { - return v; - } else if (v != null && typeof v[Symbol.iterator] === "function") { - return ArrayFrom(v); - } - return null; - }; -} - -var isNode = typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]"; - -var hasEnvVariables = typeof process !== "undefined" && - typeof process.env !== "undefined"; - -function env(key) { - return hasEnvVariables ? process.env[key] : undefined; -} - -function getNativePromise() { - if (typeof Promise === "function") { - try { - var promise = new Promise(function(){}); - if (classString(promise) === "[object Promise]") { - return Promise; - } - } catch (e) {} - } -} - -var reflectHandler; -function contextBind(ctx, cb) { - if (ctx === null || - typeof cb !== "function" || - cb === reflectHandler) { - return cb; - } - - if (ctx.domain !== null) { - cb = ctx.domain.bind(cb); - } - - var async = ctx.async; - if (async !== null) { - var old = cb; - cb = function() { - var args = (new Array(2)).concat([].slice.call(arguments));; - args[0] = old; - args[1] = this; - return async.runInAsyncScope.apply(async, args); - }; - } - return cb; -} - -var ret = { - setReflectHandler: function(fn) { - reflectHandler = fn; - }, - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - asArray: asArray, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - isError: isError, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - isNode: isNode, - hasEnvVariables: hasEnvVariables, - env: env, - global: globalObject, - getNativePromise: getNativePromise, - contextBind: contextBind -}; -ret.isRecentNode = ret.isNode && (function() { - var version; - if (process.versions && process.versions.node) { - version = process.versions.node.split(".").map(Number); - } else if (process.version) { - version = process.version.split(".").map(Number); - } - return (version[0] === 0 && version[1] > 10) || (version[0] > 0); -})(); -ret.nodeSupportsAsyncResource = ret.isNode && (function() { - var supportsAsync = false; - try { - var res = _dereq_("async_hooks").AsyncResource; - supportsAsync = typeof res.prototype.runInAsyncScope === "function"; - } catch (e) { - supportsAsync = false; - } - return supportsAsync; -})(); - -if (ret.isNode) ret.toFastProperties(process); - -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; - -},{"./es5":13,"async_hooks":undefined}]},{},[4])(4) -}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } \ No newline at end of file diff --git a/node_modules/bluebird/js/browser/bluebird.min.js b/node_modules/bluebird/js/browser/bluebird.min.js deleted file mode 100644 index 31ac1631..00000000 --- a/node_modules/bluebird/js/browser/bluebird.min.js +++ /dev/null @@ -1,31 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 3.7.1 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each -*/ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0;)c(t)}function c(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),r=t.shift();e.call(n,r)}}var u;try{throw new Error}catch(l){u=l}var p=t("./schedule"),f=t("./queue");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},r.prototype.invokeLater=i,r.prototype.invoke=o,r.prototype.settlePromises=s,r.prototype._drainQueues=function(){a(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,a(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=u},{"./queue":26,"./schedule":29}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var u=n(o),l=new t(e);l._propagateFrom(this,1);var p=this._target();if(l._setBoundTo(u),u instanceof t){var f={promiseRejectionQueued:!1,promise:l,target:p,bindingPromise:u};p._then(e,s,void 0,l,f),u._then(a,c,void 0,l,f),l._setOnCancel(u)}else l._resolveCallback(p);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,e){return{promise:e}}function s(){return!1}function a(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+B.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function c(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?B.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function u(){return this._onCancelField}function l(t){this._onCancelField=t}function p(){this._cancellationParent=void 0,this._onCancelField=void 0}function f(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function _(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function d(){this._trace=new V(this._peekContext())}function v(t,e){if(q(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=F(t);B.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),B.notEnumerableProp(t,"__stackCleaned__",!0)}}}function y(){this._trace=void 0}function g(t,e,n,r,i){if(void 0===t&&null!==e&&Z){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=k(a),u=c.length-1;u>=0;--u){var l=c[u];if(!Q.test(l)){var p=l.match(G);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var f=c[0],u=0;u0&&(s="\n"+a[u-1]);break}}var h="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(h,!0,e)}}function m(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),b(n)}function b(t,n,r){if(lt.warnings){var i,o=new U(t);if(n)r._attachExtraTrace(o);else if(lt.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=F(o);o.stack=s.message+"\n"+s.stack.join("\n")}ot("warning",o)||x(o,"",!0)}}function w(t,e){for(var n=0;n=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function k(t){for(var e=[],n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function F(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?E(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:k(e)}}function x(t,e,n){if("undefined"!=typeof console){var r;if(B.isObject(t)){var i=t.stack;r=e+z(i,t)}else r=e+String(t);"function"==typeof I?I(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function T(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){N.throwLater(o)}"unhandledRejection"===t?ot(t,n,r)||i||x(n,"Unhandled rejection "):ot(t,r)}function P(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():B.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+R(e)+">, no stack trace)"}function R(t){var e=41;return t.lengths||0>a||!n||!r||n!==r||s>=a||(at=function(t){if($.test(t))return!0;var e=O(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function V(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);ut(this,V),e>32&&this.uncycle()}var H,D,I,L,N=e._async,U=t("./errors").Warning,B=t("./util"),M=t("./es5"),q=B.canAttachTrace,$=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,Q=/\((?:timers\.js):\d+:\d+\)/,G=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,W=null,z=null,X=!1,K=!(0==B.env("BLUEBIRD_DEBUG")||!B.env("BLUEBIRD_DEBUG")&&"development"!==B.env("NODE_ENV")),J=!(0==B.env("BLUEBIRD_WARNINGS")||!K&&!B.env("BLUEBIRD_WARNINGS")),Y=!(0==B.env("BLUEBIRD_LONG_STACK_TRACES")||!K&&!B.env("BLUEBIRD_LONG_STACK_TRACES")),Z=0!=B.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(J||!!B.env("BLUEBIRD_W_FORGOTTEN_RETURN"));!function(){function t(){for(var t=0;t0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return b(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var n=e._getContext();D=B.contextBind(n,t)},e.onUnhandledRejectionHandled=function(t){var n=e._getContext();H=B.contextBind(n,t)};var tt=function(){};e.longStackTraces=function(){if(N.haveItemsQueued()&&!lt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!lt.longStackTraces&&S()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace,i=e.prototype._dereferenceTrace;lt.longStackTraces=!0,tt=function(){if(N.haveItemsQueued()&&!lt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,e.prototype._dereferenceTrace=i,n.deactivateLongStackTraces(),lt.longStackTraces=!1},e.prototype._captureStackTrace=d,e.prototype._attachExtraTrace=v,e.prototype._dereferenceTrace=y,n.activateLongStackTraces()}},e.hasLongStackTraces=function(){return lt.longStackTraces&&S()};var et={unhandledrejection:{before:function(){var t=B.global.onunhandledrejection;return B.global.onunhandledrejection=null,t},after:function(t){B.global.onunhandledrejection=t}},rejectionhandled:{before:function(){var t=B.global.onrejectionhandled;return B.global.onrejectionhandled=null,t},after:function(t){B.global.onrejectionhandled=t}}},nt=function(){var t=function(t,e){if(!t)return!B.global.dispatchEvent(e);var n;try{return n=t.before(),!B.global.dispatchEvent(e)}finally{t.after(n)}};try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r={detail:n,cancelable:!0},i=new CustomEvent(e,r);return M.defineProperty(i,"promise",{value:n.promise}),M.defineProperty(i,"reason",{value:n.reason}),t(et[e],i)}}if("function"==typeof Event){var e=new Event("CustomEvent");return B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=new Event(e,{cancelable:!0});return r.detail=n,M.defineProperty(r,"promise",{value:n.promise}),M.defineProperty(r,"reason",{value:n.reason}),t(et[e],r)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,!1,!0,n),t(et[e],r)}}catch(n){}return function(){return!1}}(),rt=function(){return B.isNode?function(){return process.emit.apply(process,arguments)}:B.global?function(t){var e="on"+t.toLowerCase(),n=B.global[e];return n?(n.apply(B.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),it={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:o},ot=function(t){var e=!1;try{e=rt.apply(null,arguments)}catch(n){N.throwLater(n),e=!0}var r=!1;try{r=nt(t,it[t].apply(null,arguments))}catch(n){N.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&tt()),"warnings"in t){var n=t.warnings;lt.warnings=!!n,Z=lt.warnings,B.isObject(n)&&"wForgottenReturn"in n&&(Z=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!lt.cancellation){if(N.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=p,e.prototype._propagateFrom=f,e.prototype._onCancel=u,e.prototype._setOnCancel=l,e.prototype._attachCancellationCallback=c,e.prototype._execute=a,st=f,lt.cancellation=!0}if("monitoring"in t&&(t.monitoring&&!lt.monitoring?(lt.monitoring=!0,e.prototype._fireEvent=ot):!t.monitoring&<.monitoring&&(lt.monitoring=!1,e.prototype._fireEvent=s)),"asyncHooks"in t&&B.nodeSupportsAsyncResource){var o=lt.asyncHooks,h=!!t.asyncHooks;o!==h&&(lt.asyncHooks=h,h?r():i())}return e},e.prototype._fireEvent=s,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._dereferenceTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var st=h,at=function(){return!1},ct=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;B.inherits(V,Error),n.CapturedTrace=V,V.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var u=c._length+1,l=r-2;l>=0;--l)e[l]._length=u,u++;return}}}},V.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=F(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(k(i.stack.split("\n"))),i=i._parent;j(r),C(r),B.notEnumerableProp(t,"stack",w(n,r)),B.notEnumerableProp(t,"__stackCleaned__",!0)}};var ut=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():P(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,W=t,z=e;var n=Error.captureStackTrace;return at=function(t){return $.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return W=/@/,z=e,X=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(z=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?P(e):e.toString()},null):(W=t,z=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(I=function(t){console.warn(t)},B.isNode&&process.stderr.isTTY?I=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:B.isNode||"string"!=typeof(new Error).stack||(I=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var lt={warnings:J,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return Y&&e.longStackTraces(),{asyncHooks:function(){return lt.asyncHooks},longStackTraces:function(){return lt.longStackTraces},warnings:function(){return lt.warnings},cancellation:function(){return lt.cancellation},monitoring:function(){return lt.monitoring},propagateFromFunction:function(){return st},boundValueFunction:function(){return _},checkForgottenReturns:g,setBounds:A,warn:b,deprecated:m,CapturedTrace:V,fireDomEvent:nt,fireGlobalEvent:rt}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return l(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,u=t("./util"),l=u.inherits,p=u.notEnumerableProp,f=r("Warning","warning"),h=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(v){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function a(){return u.call(this,this.promise._target()._settledValue())}function c(t){return s(this,t)?void 0:(f.e=t,f)}function u(t){var i=this.promise,u=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?u.call(i._boundValue()):u.call(i._boundValue(),t);if(l===r)return l;if(void 0!==l){i._setReturnedNonUndefined();var h=n(l,i);if(h instanceof e){if(null!=this.cancelPromise){if(h._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),f.e=_,f}h.isPending()&&h._attachCancellationCallback(new o(this))}return h._then(a,c,void 0,this,void 0)}}}return i.isRejected()?(s(this),f.e=t,f):(s(this),t)}var l=t("./util"),p=e.CancellationError,f=l.errorObj,h=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){s(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,u,u)},e.prototype.tap=function(t){return this._passThrough(t,1,u)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,u);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!l.isObject(s))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+l.classString(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passThrough(h(i,a,this),1,void 0,u)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t),this._promise._captureStackTrace();var s=e._getContext();if(this._callback=u.contextBind(s,n),this._preservedValues=i===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0),u.isArray(t))for(var a=0;a=1?s:0,new a(t,n,s,o).promise()}var u=t("./util"),l=u.tryCatch,p=u.errorObj,f=e._async;u.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedValues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var u=this._promise,f=this._callback,h=u._boundValue();u._pushContext();var _=l(f).call(h,t,n,o),d=u._popContext();if(s.checkForgottenReturns(_,d,null!==a?"Promise.filter":"Promise.map",u),_===p)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var g=++this._totalResolved;return g>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlighto;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+s.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=a(t).apply(this,arguments),s=r._popContext();return o.checkForgottenReturns(i,s,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],l=arguments[2];c=s.isArray(u)?a(t).apply(l,u):a(t).call(l,u)}else c=a(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&l.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new u(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=l.keys(t),i=0;i1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isObject(o))return l("Catch statement predicate: expecting an object but got "+f.classString(o));r[i++]=o}if(r.length=i,t=arguments[n],"function"!=typeof t)throw new E("The last argument to .catch() must be a function, got "+f.toString(t));return this.then(void 0,D(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(V.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classString(t);arguments.length>1&&(n+=", "+f.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?l("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,T,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new S(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(x);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=N(t)(I(e,n));return r===L&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new S(t).promise()},i.cast=function(t){var e=R(t);return e instanceof i||(e=new i(x),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(x);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new E("expecting a function but got "+f.classString(t));return j.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(x),c=this._target(),u=c._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():c===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var l=g();if(0!==(50397184&u)){var p,h,_=c._settlePromiseCtx;0!==(33554432&u)?(h=c._rejectionHandler0,p=t):0!==(16777216&u)?(h=c._fulfillmentHandler0,p=e,c._unsetRejectionIsUnhandled()):(_=c._settlePromiseLateCancellationObserver,h=new F("late cancellation observer"),c._attachExtraTrace(h),p=e),j.invoke(_,c,{handler:f.contextBind(l,p),promise:a,receiver:r,value:h})}else c._addCallbacks(t,e,a,r,l);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){if(!j.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},i.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&(536870912|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===p?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=p),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=p),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=f.contextBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=f.contextBind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=f.contextBind(i,t)),"function"==typeof e&&(this[s+1]=f.contextBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=R(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(c());var o=r._bitField;if(0===(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;s>a;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(n)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var u=new F("late cancellation observer");r._attachExtraTrace(u),this._reject(u)}}},i.prototype._rejectCallback=function(t,e,n){var r=f.ensureErrorObject(t),i=r===t;if(!i&&!n&&V.warnings()){var o="a promise was rejected with a non-error: "+f.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==x){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===T?n&&"number"==typeof n.length?o=N(t).apply(this._boundValue(),n):(o=L,o.e=new E("cannot .spread() a non-array: "+f.classString(n))):o=N(t).call(e,n);var s=r._popContext();i=r._bitField,0===(65536&i)&&(o===P?r._reject(n):o===L?r._rejectCallback(o.e,!1):(V.checkForgottenReturns(o,s,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var s=t instanceof i,a=this._bitField,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof H&&r.isFinallyHandler()?(r.cancelPromise=t,N(e).call(r,o)===L&&t._reject(L.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof S?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():j.settlePromises(this),this._dereferenceTrace())}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?j.fatalError(t,f.isNode):void((65535&e)>0?j.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},"undefined"!=typeof Symbol&&Symbol.toStringTag&&w.defineProperty(i.prototype,Symbol.toStringTag,{get:function(){return"Object"}}),i.defer=i.pending=function(){V.deprecated("Promise.defer","new Promise");var t=new i(x);return{promise:t,resolve:o,reject:s}},f.notEnumerableProp(i,"_makeSelfResolutionError",c),t("./method")(i,x,R,l,V),t("./bind")(i,x,R,V),t("./cancel")(i,S,l,V),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,S,R,x,j),i.Promise=i,i.version="3.7.1",t("./call_get.js")(i),t("./generators.js")(i,l,x,R,n,V),t("./map.js")(i,S,l,R,x,V),t("./nodeify.js")(i),t("./promisify.js")(i,x),t("./props.js")(i,S,R,l),t("./race.js")(i,x,R,l),t("./reduce.js")(i,S,l,R,x,V),t("./settle.js")(i,S,V),t("./some.js")(i,S,l),t("./timers.js")(i,x,V),t("./using.js")(i,l,R,A,x,V),t("./any.js")(i),t("./each.js")(i,x),t("./filter.js")(i,x),f.toFastProperties(i),f.toFastProperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(x)),V.setBounds(C.firstLineError,f.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36,async_hooks:void 0}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(t){var r=this._promise=new e(n);t instanceof e&&(r._propagateFrom(t,3),t.suppressUnhandledRejections()),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function u(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitField;if(this._values=o,0===(50397184&a))return this._promise._setAsyncGuaranteed(),o._then(u,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var l=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(l,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitField):s=null,o?null!==s&&c.suppressUnhandledRejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promiseFulfilled(c._value(),a):0!==(16777216&s)?this._promiseRejected(c._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(c,a)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},a.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nc;c+=2){var l=s[c],p=s[c+1],_=l+e;if(r===E)t[_]=E(l,f,l,p,e,i);else{var d=r(p,function(){return E(l,f,l,p,e,i)});h.notEnumerableProp(d,"__isPromisified__",!0),t[_]=d}}return h.toFastProperties(t),t}function l(t,e,n){return E(t,e,void 0,t,null,n)}var p,f={},h=t("./util"),_=t("./nodeback"),d=h.withAppended,v=h.maybeWrapAsError,y=h.canEvaluate,g=t("./errors").TypeError,m="Async",b={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],C=new RegExp("^(?:"+w.join("|")+")$"),j=function(t){return h.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},k=function(t){return t.replace(/([$])/,"\\$")},E=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new g("expecting a function but got "+h.classString(t));if(i(t))return t;e=Object(e);var n=void 0===e.context?f:e.context,o=!!e.multiArgs,s=l(t,n,o);return h.copyDescriptors(t,s,r),s},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new g("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");e=Object(e);var n=!!e.multiArgs,r=e.suffix;"string"!=typeof r&&(r=m);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=E),!h.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=h.inheritedDataKeys(t),a=0;ao;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return u(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagateFrom(s,2),n):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var a,c=t("./util"),u=c.isObject,l=t("./es5");"function"==typeof Map&&(a=Map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new Array(2*r.size);return r.forEach(t,i),i}}(),f=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=f(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacityf;++f){var _=t[f];(void 0!==_||f in t)&&e.cast(_)._then(l,p,void 0,u,null)}return u}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=e._getContext();this._fn=f.contextBind(s,n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function u(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classString(e));var o=new a(t,e,n,i);return o.promise()}function l(t){this.accum=t,this.array._gotAccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=h(n._fn);r._pushContext();var o;o=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentCancellable=o);var a=r._popContext();return s.checkForgottenReturns(o,a,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}var f=t("./util"),h=f.tryCatch;f.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n;for(var o=r;i>o;++o){var s=t[o];s instanceof e&&s.suppressUnhandledRejections()}if(!n.isRejected())for(;i>r;++r){var a={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(l,void 0,void 0,a,void 0),0===(127&r)&&n._setNoAsyncGuarantee()}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return u(this,t,e,null)},e.reduce=function(t,e,n,r){return u(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){ -throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var a=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){var u=s.resolve();r=function(t){u.then(t)}}else r="undefined"!=typeof MutationObserver&&("undefined"==typeof window||!window.navigator||!window.navigator.standalone&&!window.cordova)&&"classList"in document.documentElement?function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}():"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o;e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.PromiseInspection,s=t("./util");s.inherits(i,n),i.prototype._promiseResolved=function(t,e){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(t,e){var n=new o;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new o;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.allSettled=function(t){return new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new i(t),o=n.promise();return n.setHowMany(e),n.init(),o}var s=t("./util"),a=t("./errors").RangeError,c=t("./errors").AggregateError,u=s.isArray,l={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=u(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new c,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(t){this._values.push(t)},i.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(l(t)){if(t instanceof e)return t;var i=o(t);if(i===u){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return u.e=e,u}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,p,!0),a=null)}var a=new e(n),l=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var p=!0,f=c.tryCatch(r).call(t,o,s);return p=!1,a&&f===u&&(a._rejectCallback(f.e,!0,!0),a=null),l}var c=t("./util"),u=c.errorObj,l=c.isObject,p={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return clearTimeout(this.handle),t}function s(t){throw clearTimeout(this.handle),t}var a=t("./util"),c=e.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var u=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(u,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setOnCancel(o)):(s=new e(n),a=setTimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setOnCancel(new i(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};e.prototype.delay=function(t){return l(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new c("operation timed out"):new c(e),a.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(setTimeout(function(){n.isPending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setOnCancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){setTimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function u(t,n){function i(){if(s>=u)return l._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isDisposable()){try{o=r(o._getDisposer().tryDispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,u=t.length,l=new e(o);return i(),l}function l(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function f(t){return l.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function h(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").TypeError,v=t("./util").inherits,y=_.errorObj,g=_.tryCatch,m={};l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():m},l.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==m?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},l.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},v(p,l),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},h.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new h(t),p=0;t>p;++p){var d=o[p];if(l.isDisposer(d)){var v=d;d=d.promise(),d._setDisposable(v)}else{var m=r(d);m instanceof e&&(d=m._then(f,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new Array(c.length),p=0;p0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=P;return P=null,t.apply(this,arguments)}catch(e){return T.e=e,T}}function i(t){return P=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function u(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function l(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function f(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function h(t){function e(){}function n(){return typeof r.foo}e.prototype=t;var r=new e;return n(),n(),t}function _(t){return V.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{l(t,"isOperational",!0)}catch(e){}}function m(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function w(t){return{}.toString.call(t)}function C(t,e,n){for(var r=F.names(t),i=0;i10||t[0]>0}(),B.nodeSupportsAsyncResource=B.isNode&&function(){var e=!1;try{var n=t("async_hooks").AsyncResource;e="function"==typeof n.prototype.runInAsyncScope}catch(r){e=!1}return e}(),B.isNode&&B.toFastProperties(process);try{throw new Error}catch(M){B.lastLineError=M}e.exports=B},{"./es5":13,async_hooks:void 0}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); \ No newline at end of file diff --git a/node_modules/bluebird/js/release/any.js b/node_modules/bluebird/js/release/any.js deleted file mode 100644 index 05a6228e..00000000 --- a/node_modules/bluebird/js/release/any.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var SomePromiseArray = Promise._SomePromiseArray; -function any(promises) { - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(1); - ret.setUnwrap(); - ret.init(); - return promise; -} - -Promise.any = function (promises) { - return any(promises); -}; - -Promise.prototype.any = function () { - return any(this); -}; - -}; diff --git a/node_modules/bluebird/js/release/assert.js b/node_modules/bluebird/js/release/assert.js deleted file mode 100644 index 4518231a..00000000 --- a/node_modules/bluebird/js/release/assert.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -module.exports = (function(){ -var AssertionError = (function() { - function AssertionError(a) { - this.constructor$(a); - this.message = a; - this.name = "AssertionError"; - } - AssertionError.prototype = new Error(); - AssertionError.prototype.constructor = AssertionError; - AssertionError.prototype.constructor$ = Error; - return AssertionError; -})(); - -function getParams(args) { - var params = []; - for (var i = 0; i < args.length; ++i) params.push("arg" + i); - return params; -} - -function nativeAssert(callName, args, expect) { - try { - var params = getParams(args); - var constructorArgs = params; - constructorArgs.push("return " + - callName + "("+ params.join(",") + ");"); - var fn = Function.apply(null, constructorArgs); - return fn.apply(null, args); - } catch (e) { - if (!(e instanceof SyntaxError)) { - throw e; - } else { - return expect; - } - } -} - -return function assert(boolExpr, message) { - if (boolExpr === true) return; - - if (typeof boolExpr === "string" && - boolExpr.charAt(0) === "%") { - var nativeCallName = boolExpr; - var $_len = arguments.length;var args = new Array(Math.max($_len - 2, 0)); for(var $_i = 2; $_i < $_len; ++$_i) {args[$_i - 2] = arguments[$_i];}; - if (nativeAssert(nativeCallName, args, message) === message) return; - message = (nativeCallName + " !== " + message); - } - - var ret = new AssertionError(message); - if (Error.captureStackTrace) { - Error.captureStackTrace(ret, assert); - } - throw ret; -}; -})(); diff --git a/node_modules/bluebird/js/release/async.js b/node_modules/bluebird/js/release/async.js deleted file mode 100644 index 8eab6f88..00000000 --- a/node_modules/bluebird/js/release/async.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -var firstLineError; -try {throw new Error(); } catch (e) {firstLineError = e;} -var schedule = require("./schedule"); -var Queue = require("./queue"); - -function Async() { - this._customScheduler = false; - this._isTickUsed = false; - this._lateQueue = new Queue(16); - this._normalQueue = new Queue(16); - this._haveDrainedQueues = false; - var self = this; - this.drainQueues = function () { - self._drainQueues(); - }; - this._schedule = schedule; -} - -Async.prototype.setScheduler = function(fn) { - var prev = this._schedule; - this._schedule = fn; - this._customScheduler = true; - return prev; -}; - -Async.prototype.hasCustomScheduler = function() { - return this._customScheduler; -}; - -Async.prototype.haveItemsQueued = function () { - return this._isTickUsed || this._haveDrainedQueues; -}; - - -Async.prototype.fatalError = function(e, isNode) { - if (isNode) { - process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) + - "\n"); - process.exit(2); - } else { - this.throwLater(e); - } -}; - -Async.prototype.throwLater = function(fn, arg) { - if (arguments.length === 1) { - arg = fn; - fn = function () { throw arg; }; - } - if (typeof setTimeout !== "undefined") { - setTimeout(function() { - fn(arg); - }, 0); - } else try { - this._schedule(function() { - fn(arg); - }); - } catch (e) { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } -}; - -function AsyncInvokeLater(fn, receiver, arg) { - this._lateQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncInvoke(fn, receiver, arg) { - this._normalQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncSettlePromises(promise) { - this._normalQueue._pushOne(promise); - this._queueTick(); -} - -Async.prototype.invokeLater = AsyncInvokeLater; -Async.prototype.invoke = AsyncInvoke; -Async.prototype.settlePromises = AsyncSettlePromises; - - -function _drainQueue(queue) { - while (queue.length() > 0) { - _drainQueueStep(queue); - } -} - -function _drainQueueStep(queue) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - } else { - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -} - -Async.prototype._drainQueues = function () { - _drainQueue(this._normalQueue); - this._reset(); - this._haveDrainedQueues = true; - _drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = Async; -module.exports.firstLineError = firstLineError; diff --git a/node_modules/bluebird/js/release/bind.js b/node_modules/bluebird/js/release/bind.js deleted file mode 100644 index fc3379db..00000000 --- a/node_modules/bluebird/js/release/bind.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { -var calledBind = false; -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - if (((this._bitField & 50397184) === 0)) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - if (!calledBind) { - calledBind = true; - Promise.prototype._propagateFrom = debug.propagateFromFunction(); - Promise.prototype._boundValue = debug.boundValueFunction(); - } - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - ret._setBoundTo(maybePromise); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, undefined, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, undefined, ret, context); - ret._setOnCancel(maybePromise); - } else { - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 2097152; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~2097152); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 2097152) === 2097152; -}; - -Promise.bind = function (thisArg, value) { - return Promise.resolve(value).bind(thisArg); -}; -}; diff --git a/node_modules/bluebird/js/release/bluebird.js b/node_modules/bluebird/js/release/bluebird.js deleted file mode 100644 index 1c36cf36..00000000 --- a/node_modules/bluebird/js/release/bluebird.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = require("./promise")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; diff --git a/node_modules/bluebird/js/release/call_get.js b/node_modules/bluebird/js/release/call_get.js deleted file mode 100644 index 0ed7714a..00000000 --- a/node_modules/bluebird/js/release/call_get.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} - -module.exports = function(Promise) { -var util = require("./util"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; - -var getMethodCaller; -var getGetter; -if (!false) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; - -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; - -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; - } - } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; - -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); - } - return fn; -} - -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}; - if (!false) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); - } - } - } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; - -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; - } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; diff --git a/node_modules/bluebird/js/release/cancel.js b/node_modules/bluebird/js/release/cancel.js deleted file mode 100644 index 7a12415e..00000000 --- a/node_modules/bluebird/js/release/cancel.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; -module.exports = function(Promise, PromiseArray, apiRejection, debug) { -var util = require("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -Promise.prototype["break"] = Promise.prototype.cancel = function() { - if (!debug.cancellation()) return this._warn("cancellation is disabled"); - - var promise = this; - var child = promise; - while (promise._isCancellable()) { - if (!promise._cancelBy(child)) { - if (child._isFollowing()) { - child._followee().cancel(); - } else { - child._cancelBranched(); - } - break; - } - - var parent = promise._cancellationParent; - if (parent == null || !parent._isCancellable()) { - if (promise._isFollowing()) { - promise._followee().cancel(); - } else { - promise._cancelBranched(); - } - break; - } else { - if (promise._isFollowing()) promise._followee().cancel(); - promise._setWillBeCancelled(); - child = promise; - promise = parent; - } - } -}; - -Promise.prototype._branchHasCancelled = function() { - this._branchesRemainingToCancel--; -}; - -Promise.prototype._enoughBranchesHaveCancelled = function() { - return this._branchesRemainingToCancel === undefined || - this._branchesRemainingToCancel <= 0; -}; - -Promise.prototype._cancelBy = function(canceller) { - if (canceller === this) { - this._branchesRemainingToCancel = 0; - this._invokeOnCancel(); - return true; - } else { - this._branchHasCancelled(); - if (this._enoughBranchesHaveCancelled()) { - this._invokeOnCancel(); - return true; - } - } - return false; -}; - -Promise.prototype._cancelBranched = function() { - if (this._enoughBranchesHaveCancelled()) { - this._cancel(); - } -}; - -Promise.prototype._cancel = function() { - if (!this._isCancellable()) return; - this._setCancelled(); - async.invoke(this._cancelPromises, this, undefined); -}; - -Promise.prototype._cancelPromises = function() { - if (this._length() > 0) this._settlePromises(); -}; - -Promise.prototype._unsetOnCancel = function() { - this._onCancelField = undefined; -}; - -Promise.prototype._isCancellable = function() { - return this.isPending() && !this._isCancelled(); -}; - -Promise.prototype.isCancellable = function() { - return this.isPending() && !this.isCancelled(); -}; - -Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { - if (util.isArray(onCancelCallback)) { - for (var i = 0; i < onCancelCallback.length; ++i) { - this._doInvokeOnCancel(onCancelCallback[i], internalOnly); - } - } else if (onCancelCallback !== undefined) { - if (typeof onCancelCallback === "function") { - if (!internalOnly) { - var e = tryCatch(onCancelCallback).call(this._boundValue()); - if (e === errorObj) { - this._attachExtraTrace(e.e); - async.throwLater(e.e); - } - } - } else { - onCancelCallback._resultCancelled(this); - } - } -}; - -Promise.prototype._invokeOnCancel = function() { - var onCancelCallback = this._onCancel(); - this._unsetOnCancel(); - async.invoke(this._doInvokeOnCancel, this, onCancelCallback); -}; - -Promise.prototype._invokeInternalOnCancel = function() { - if (this._isCancellable()) { - this._doInvokeOnCancel(this._onCancel(), true); - this._unsetOnCancel(); - } -}; - -Promise.prototype._resultCancelled = function() { - this.cancel(); -}; - -}; diff --git a/node_modules/bluebird/js/release/catch_filter.js b/node_modules/bluebird/js/release/catch_filter.js deleted file mode 100644 index 0f24ce23..00000000 --- a/node_modules/bluebird/js/release/catch_filter.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = require("./util"); -var getKeys = require("./es5").keys; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function catchFilter(instances, cb, promise) { - return function(e) { - var boundTo = promise._boundValue(); - predicateLoop: for (var i = 0; i < instances.length; ++i) { - var item = instances[i]; - - if (item === Error || - (item != null && item.prototype instanceof Error)) { - if (e instanceof item) { - return tryCatch(cb).call(boundTo, e); - } - } else if (typeof item === "function") { - var matchesPredicate = tryCatch(item).call(boundTo, e); - if (matchesPredicate === errorObj) { - return matchesPredicate; - } else if (matchesPredicate) { - return tryCatch(cb).call(boundTo, e); - } - } else if (util.isObject(e)) { - var keys = getKeys(item); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - if (item[key] != e[key]) { - continue predicateLoop; - } - } - return tryCatch(cb).call(boundTo, e); - } - } - return NEXT_FILTER; - }; -} - -return catchFilter; -}; diff --git a/node_modules/bluebird/js/release/context.js b/node_modules/bluebird/js/release/context.js deleted file mode 100644 index c307414f..00000000 --- a/node_modules/bluebird/js/release/context.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var longStackTraces = false; -var contextStack = []; - -Promise.prototype._promiseCreated = function() {}; -Promise.prototype._pushContext = function() {}; -Promise.prototype._popContext = function() {return null;}; -Promise._peekContext = Promise.prototype._peekContext = function() {}; - -function Context() { - this._trace = new Context.CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (this._trace !== undefined) { - this._trace._promiseCreated = null; - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (this._trace !== undefined) { - var trace = contextStack.pop(); - var ret = trace._promiseCreated; - trace._promiseCreated = null; - return ret; - } - return null; -}; - -function createContext() { - if (longStackTraces) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} -Context.CapturedTrace = null; -Context.create = createContext; -Context.deactivateLongStackTraces = function() {}; -Context.activateLongStackTraces = function() { - var Promise_pushContext = Promise.prototype._pushContext; - var Promise_popContext = Promise.prototype._popContext; - var Promise_PeekContext = Promise._peekContext; - var Promise_peekContext = Promise.prototype._peekContext; - var Promise_promiseCreated = Promise.prototype._promiseCreated; - Context.deactivateLongStackTraces = function() { - Promise.prototype._pushContext = Promise_pushContext; - Promise.prototype._popContext = Promise_popContext; - Promise._peekContext = Promise_PeekContext; - Promise.prototype._peekContext = Promise_peekContext; - Promise.prototype._promiseCreated = Promise_promiseCreated; - longStackTraces = false; - }; - longStackTraces = true; - Promise.prototype._pushContext = Context.prototype._pushContext; - Promise.prototype._popContext = Context.prototype._popContext; - Promise._peekContext = Promise.prototype._peekContext = peekContext; - Promise.prototype._promiseCreated = function() { - var ctx = this._peekContext(); - if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; - }; -}; -return Context; -}; diff --git a/node_modules/bluebird/js/release/debuggability.js b/node_modules/bluebird/js/release/debuggability.js deleted file mode 100644 index c3a76c7a..00000000 --- a/node_modules/bluebird/js/release/debuggability.js +++ /dev/null @@ -1,1036 +0,0 @@ -"use strict"; -module.exports = function(Promise, Context, - enableAsyncHooks, disableAsyncHooks) { -var async = Promise._async; -var Warning = require("./errors").Warning; -var util = require("./util"); -var es5 = require("./es5"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; -var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; -var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var printWarning; -var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && - (false || - util.env("BLUEBIRD_DEBUG") || - util.env("NODE_ENV") === "development")); - -var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && - (debugging || util.env("BLUEBIRD_WARNINGS"))); - -var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && - (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); - -var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && - (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); - -var deferUnhandledRejectionCheck; -(function() { - var promises = []; - - function unhandledRejectionCheck() { - for (var i = 0; i < promises.length; ++i) { - promises[i]._notifyUnhandledRejection(); - } - unhandledRejectionClear(); - } - - function unhandledRejectionClear() { - promises.length = 0; - } - - if (typeof document === "object" && document.createElement) { - deferUnhandledRejectionCheck = (function() { - var iframeSetTimeout; - - function checkIframe() { - if (document.body) { - var iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - if (iframe.contentWindow && - iframe.contentWindow.setTimeout) { - iframeSetTimeout = iframe.contentWindow.setTimeout; - } - document.body.removeChild(iframe); - } - } - checkIframe(); - return function(promise) { - promises.push(promise); - if (iframeSetTimeout) { - iframeSetTimeout(unhandledRejectionCheck, 1); - } else { - checkIframe(); - } - }; - })(); - } else { - deferUnhandledRejectionCheck = function(promise) { - promises.push(promise); - setTimeout(unhandledRejectionCheck, 1); - }; - } - - es5.defineProperty(Promise, "_unhandledRejectionCheck", { - value: unhandledRejectionCheck - }); - es5.defineProperty(Promise, "_unhandledRejectionClear", { - value: unhandledRejectionClear - }); -})(); - -Promise.prototype.suppressUnhandledRejections = function() { - var target = this._target(); - target._bitField = ((target._bitField & (~1048576)) | - 524288); -}; - -Promise.prototype._ensurePossibleRejectionHandled = function () { - if ((this._bitField & 524288) !== 0) return; - this._setRejectionIsUnhandled(); - deferUnhandledRejectionCheck(this); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._setReturnedNonUndefined = function() { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._returnedNonUndefined = function() { - return (this._bitField & 268435456) !== 0; -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._settledValue(); - this._setUnhandledRejectionIsNotified(); - fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 262144; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~262144); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 262144) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 1048576; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~1048576); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { - return warn(message, shouldUseOwnTrace, promise || this); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - var context = Promise._getContext(); - possiblyUnhandledRejection = util.contextBind(context, fn); -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - var context = Promise._getContext(); - unhandledRejectionHandled = util.contextBind(context, fn); -}; - -var disableLongStackTraces = function() {}; -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (!config.longStackTraces && longStackTracesIsSupported()) { - var Promise_captureStackTrace = Promise.prototype._captureStackTrace; - var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; - var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace; - config.longStackTraces = true; - disableLongStackTraces = function() { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - Promise.prototype._captureStackTrace = Promise_captureStackTrace; - Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; - Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; - Context.deactivateLongStackTraces(); - config.longStackTraces = false; - }; - Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; - Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; - Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; - Context.activateLongStackTraces(); - } -}; - -Promise.hasLongStackTraces = function () { - return config.longStackTraces && longStackTracesIsSupported(); -}; - - -var legacyHandlers = { - unhandledrejection: { - before: function() { - var ret = util.global.onunhandledrejection; - util.global.onunhandledrejection = null; - return ret; - }, - after: function(fn) { - util.global.onunhandledrejection = fn; - } - }, - rejectionhandled: { - before: function() { - var ret = util.global.onrejectionhandled; - util.global.onrejectionhandled = null; - return ret; - }, - after: function(fn) { - util.global.onrejectionhandled = fn; - } - } -}; - -var fireDomEvent = (function() { - var dispatch = function(legacy, e) { - if (legacy) { - var fn; - try { - fn = legacy.before(); - return !util.global.dispatchEvent(e); - } finally { - legacy.after(fn); - } - } else { - return !util.global.dispatchEvent(e); - } - }; - try { - if (typeof CustomEvent === "function") { - var event = new CustomEvent("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var eventData = { - detail: event, - cancelable: true - }; - var domEvent = new CustomEvent(name, eventData); - es5.defineProperty( - domEvent, "promise", {value: event.promise}); - es5.defineProperty( - domEvent, "reason", {value: event.reason}); - - return dispatch(legacyHandlers[name], domEvent); - }; - } else if (typeof Event === "function") { - var event = new Event("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = new Event(name, { - cancelable: true - }); - domEvent.detail = event; - es5.defineProperty(domEvent, "promise", {value: event.promise}); - es5.defineProperty(domEvent, "reason", {value: event.reason}); - return dispatch(legacyHandlers[name], domEvent); - }; - } else { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = document.createEvent("CustomEvent"); - domEvent.initCustomEvent(name, false, true, - event); - return dispatch(legacyHandlers[name], domEvent); - }; - } - } catch (e) {} - return function() { - return false; - }; -})(); - -var fireGlobalEvent = (function() { - if (util.isNode) { - return function() { - return process.emit.apply(process, arguments); - }; - } else { - if (!util.global) { - return function() { - return false; - }; - } - return function(name) { - var methodName = "on" + name.toLowerCase(); - var method = util.global[methodName]; - if (!method) return false; - method.apply(util.global, [].slice.call(arguments, 1)); - return true; - }; - } -})(); - -function generatePromiseLifecycleEventObject(name, promise) { - return {promise: promise}; -} - -var eventToObjectGenerator = { - promiseCreated: generatePromiseLifecycleEventObject, - promiseFulfilled: generatePromiseLifecycleEventObject, - promiseRejected: generatePromiseLifecycleEventObject, - promiseResolved: generatePromiseLifecycleEventObject, - promiseCancelled: generatePromiseLifecycleEventObject, - promiseChained: function(name, promise, child) { - return {promise: promise, child: child}; - }, - warning: function(name, warning) { - return {warning: warning}; - }, - unhandledRejection: function (name, reason, promise) { - return {reason: reason, promise: promise}; - }, - rejectionHandled: generatePromiseLifecycleEventObject -}; - -var activeFireEvent = function (name) { - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent.apply(null, arguments); - } catch (e) { - async.throwLater(e); - globalEventFired = true; - } - - var domEventFired = false; - try { - domEventFired = fireDomEvent(name, - eventToObjectGenerator[name].apply(null, arguments)); - } catch (e) { - async.throwLater(e); - domEventFired = true; - } - - return domEventFired || globalEventFired; -}; - -Promise.config = function(opts) { - opts = Object(opts); - if ("longStackTraces" in opts) { - if (opts.longStackTraces) { - Promise.longStackTraces(); - } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { - disableLongStackTraces(); - } - } - if ("warnings" in opts) { - var warningsOption = opts.warnings; - config.warnings = !!warningsOption; - wForgottenReturn = config.warnings; - - if (util.isObject(warningsOption)) { - if ("wForgottenReturn" in warningsOption) { - wForgottenReturn = !!warningsOption.wForgottenReturn; - } - } - } - if ("cancellation" in opts && opts.cancellation && !config.cancellation) { - if (async.haveItemsQueued()) { - throw new Error( - "cannot enable cancellation after promises are in use"); - } - Promise.prototype._clearCancellationData = - cancellationClearCancellationData; - Promise.prototype._propagateFrom = cancellationPropagateFrom; - Promise.prototype._onCancel = cancellationOnCancel; - Promise.prototype._setOnCancel = cancellationSetOnCancel; - Promise.prototype._attachCancellationCallback = - cancellationAttachCancellationCallback; - Promise.prototype._execute = cancellationExecute; - propagateFromFunction = cancellationPropagateFrom; - config.cancellation = true; - } - if ("monitoring" in opts) { - if (opts.monitoring && !config.monitoring) { - config.monitoring = true; - Promise.prototype._fireEvent = activeFireEvent; - } else if (!opts.monitoring && config.monitoring) { - config.monitoring = false; - Promise.prototype._fireEvent = defaultFireEvent; - } - } - if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) { - var prev = config.asyncHooks; - var cur = !!opts.asyncHooks; - if (prev !== cur) { - config.asyncHooks = cur; - if (cur) { - enableAsyncHooks(); - } else { - disableAsyncHooks(); - } - } - } - return Promise; -}; - -function defaultFireEvent() { return false; } - -Promise.prototype._fireEvent = defaultFireEvent; -Promise.prototype._execute = function(executor, resolve, reject) { - try { - executor(resolve, reject); - } catch (e) { - return e; - } -}; -Promise.prototype._onCancel = function () {}; -Promise.prototype._setOnCancel = function (handler) { ; }; -Promise.prototype._attachCancellationCallback = function(onCancel) { - ; -}; -Promise.prototype._captureStackTrace = function () {}; -Promise.prototype._attachExtraTrace = function () {}; -Promise.prototype._dereferenceTrace = function () {}; -Promise.prototype._clearCancellationData = function() {}; -Promise.prototype._propagateFrom = function (parent, flags) { - ; - ; -}; - -function cancellationExecute(executor, resolve, reject) { - var promise = this; - try { - executor(resolve, reject, function(onCancel) { - if (typeof onCancel !== "function") { - throw new TypeError("onCancel must be a function, got: " + - util.toString(onCancel)); - } - promise._attachCancellationCallback(onCancel); - }); - } catch (e) { - return e; - } -} - -function cancellationAttachCancellationCallback(onCancel) { - if (!this._isCancellable()) return this; - - var previousOnCancel = this._onCancel(); - if (previousOnCancel !== undefined) { - if (util.isArray(previousOnCancel)) { - previousOnCancel.push(onCancel); - } else { - this._setOnCancel([previousOnCancel, onCancel]); - } - } else { - this._setOnCancel(onCancel); - } -} - -function cancellationOnCancel() { - return this._onCancelField; -} - -function cancellationSetOnCancel(onCancel) { - this._onCancelField = onCancel; -} - -function cancellationClearCancellationData() { - this._cancellationParent = undefined; - this._onCancelField = undefined; -} - -function cancellationPropagateFrom(parent, flags) { - if ((flags & 1) !== 0) { - this._cancellationParent = parent; - var branchesRemainingToCancel = parent._branchesRemainingToCancel; - if (branchesRemainingToCancel === undefined) { - branchesRemainingToCancel = 0; - } - parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; - } - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} - -function bindingPropagateFrom(parent, flags) { - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} -var propagateFromFunction = bindingPropagateFrom; - -function boundValueFunction() { - var ret = this._boundTo; - if (ret !== undefined) { - if (ret instanceof Promise) { - if (ret.isFulfilled()) { - return ret.value(); - } else { - return undefined; - } - } - } - return ret; -} - -function longStackTracesCaptureStackTrace() { - this._trace = new CapturedTrace(this._peekContext()); -} - -function longStackTracesAttachExtraTrace(error, ignoreSelf) { - if (canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -} - -function longStackTracesDereferenceTrace() { - this._trace = undefined; -} - -function checkForgottenReturns(returnValue, promiseCreated, name, promise, - parent) { - if (returnValue === undefined && promiseCreated !== null && - wForgottenReturn) { - if (parent !== undefined && parent._returnedNonUndefined()) return; - if ((promise._bitField & 65535) === 0) return; - - if (name) name = name + " "; - var handlerLine = ""; - var creatorLine = ""; - if (promiseCreated._trace) { - var traceLines = promiseCreated._trace.stack.split("\n"); - var stack = cleanStack(traceLines); - for (var i = stack.length - 1; i >= 0; --i) { - var line = stack[i]; - if (!nodeFramePattern.test(line)) { - var lineMatches = line.match(parseLinePattern); - if (lineMatches) { - handlerLine = "at " + lineMatches[1] + - ":" + lineMatches[2] + ":" + lineMatches[3] + " "; - } - break; - } - } - - if (stack.length > 0) { - var firstUserLine = stack[0]; - for (var i = 0; i < traceLines.length; ++i) { - - if (traceLines[i] === firstUserLine) { - if (i > 0) { - creatorLine = "\n" + traceLines[i - 1]; - } - break; - } - } - - } - } - var msg = "a promise was created in a " + name + - "handler " + handlerLine + "but was not returned from it, " + - "see http://goo.gl/rRqMUw" + - creatorLine; - promise._warn(msg, true, promiseCreated); - } -} - -function deprecated(name, replacement) { - var message = name + - " is deprecated and will be removed in a future version."; - if (replacement) message += " Use " + replacement + " instead."; - return warn(message); -} - -function warn(message, shouldUseOwnTrace, promise) { - if (!config.warnings) return; - var warning = new Warning(message); - var ctx; - if (shouldUseOwnTrace) { - promise._attachExtraTrace(warning); - } else if (config.longStackTraces && (ctx = Promise._peekContext())) { - ctx.attachExtraTrace(warning); - } else { - var parsed = parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - - if (!activeFireEvent("warning", warning)) { - formatAndLogError(warning, "", true); - } -} - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = " (No stack trace)" === line || - stackFramePattern.test(line); - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0 && error.name != "SyntaxError") { - stack = stack.slice(i); - } - return stack; -} - -function parseStackAndMessage(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: error.name == "SyntaxError" ? stack : cleanStack(stack) - }; -} - -function formatAndLogError(error, title, isSoft) { - if (typeof console !== "undefined") { - var message; - if (util.isObject(error)) { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof printWarning === "function") { - printWarning(message, isSoft); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -} - -function fireRejectionEvent(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - if (name === "unhandledRejection") { - if (!activeFireEvent(name, reason, promise) && !localEventFired) { - formatAndLogError(reason, "Unhandled rejection "); - } - } else { - activeFireEvent(name, promise); - } -} - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj && typeof obj.toString === "function" - ? obj.toString() : util.toString(obj); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -function longStackTracesIsSupported() { - return typeof captureStackTrace === "function"; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} - -function setBounds(firstLineError, lastLineError) { - if (!longStackTracesIsSupported()) return; - var firstStackLines = (firstLineError.stack || "").split("\n"); - var lastStackLines = (lastLineError.stack || "").split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -} - -function CapturedTrace(parent) { - this._parent = parent; - this._promisesCreated = 0; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); -Context.CapturedTrace = CapturedTrace; - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit += 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit += 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit -= 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow && - typeof Error.stackTraceLimit === "number") { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit += 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit -= 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - printWarning = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - printWarning = function(message, isSoft) { - var color = isSoft ? "\u001b[33m" : "\u001b[31m"; - console.warn(color + message + "\u001b[0m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - printWarning = function(message, isSoft) { - console.warn("%c" + message, - isSoft ? "color: darkorange" : "color: red"); - }; - } -} - -var config = { - warnings: warnings, - longStackTraces: false, - cancellation: false, - monitoring: false, - asyncHooks: false -}; - -if (longStackTraces) Promise.longStackTraces(); - -return { - asyncHooks: function() { - return config.asyncHooks; - }, - longStackTraces: function() { - return config.longStackTraces; - }, - warnings: function() { - return config.warnings; - }, - cancellation: function() { - return config.cancellation; - }, - monitoring: function() { - return config.monitoring; - }, - propagateFromFunction: function() { - return propagateFromFunction; - }, - boundValueFunction: function() { - return boundValueFunction; - }, - checkForgottenReturns: checkForgottenReturns, - setBounds: setBounds, - warn: warn, - deprecated: deprecated, - CapturedTrace: CapturedTrace, - fireDomEvent: fireDomEvent, - fireGlobalEvent: fireGlobalEvent -}; -}; diff --git a/node_modules/bluebird/js/release/direct_resolve.js b/node_modules/bluebird/js/release/direct_resolve.js deleted file mode 100644 index a8902982..00000000 --- a/node_modules/bluebird/js/release/direct_resolve.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -function returner() { - return this.value; -} -function thrower() { - throw this.reason; -} - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - returner, undefined, undefined, {value: value}, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - return this._then( - thrower, undefined, undefined, {reason: reason}, undefined); -}; - -Promise.prototype.catchThrow = function (reason) { - if (arguments.length <= 1) { - return this._then( - undefined, thrower, undefined, {reason: reason}, undefined); - } else { - var _reason = arguments[1]; - var handler = function() {throw _reason;}; - return this.caught(reason, handler); - } -}; - -Promise.prototype.catchReturn = function (value) { - if (arguments.length <= 1) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - undefined, returner, undefined, {value: value}, undefined); - } else { - var _value = arguments[1]; - if (_value instanceof Promise) _value.suppressUnhandledRejections(); - var handler = function() {return _value;}; - return this.caught(value, handler); - } -}; -}; diff --git a/node_modules/bluebird/js/release/each.js b/node_modules/bluebird/js/release/each.js deleted file mode 100644 index e4f3d05b..00000000 --- a/node_modules/bluebird/js/release/each.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; -var PromiseAll = Promise.all; - -function promiseAllThis() { - return PromiseAll(this); -} - -function PromiseMapSeries(promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, INTERNAL); -} - -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, this, undefined); -}; - -Promise.prototype.mapSeries = function (fn) { - return PromiseReduce(this, fn, INTERNAL, INTERNAL); -}; - -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, promises, undefined); -}; - -Promise.mapSeries = PromiseMapSeries; -}; - diff --git a/node_modules/bluebird/js/release/errors.js b/node_modules/bluebird/js/release/errors.js deleted file mode 100644 index f62f323e..00000000 --- a/node_modules/bluebird/js/release/errors.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; -var es5 = require("./es5"); -var Objectfreeze = es5.freeze; -var util = require("./util"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - es5.defineProperty(Error, "__BluebirdErrorTypes__", { - value: errorTypes, - writable: false, - enumerable: false, - configurable: false - }); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; diff --git a/node_modules/bluebird/js/release/es5.js b/node_modules/bluebird/js/release/es5.js deleted file mode 100644 index ea41d5a5..00000000 --- a/node_modules/bluebird/js/release/es5.js +++ /dev/null @@ -1,80 +0,0 @@ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} diff --git a/node_modules/bluebird/js/release/filter.js b/node_modules/bluebird/js/release/filter.js deleted file mode 100644 index ed57bf01..00000000 --- a/node_modules/bluebird/js/release/filter.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; - -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; - -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; diff --git a/node_modules/bluebird/js/release/finally.js b/node_modules/bluebird/js/release/finally.js deleted file mode 100644 index d57444be..00000000 --- a/node_modules/bluebird/js/release/finally.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; -module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { -var util = require("./util"); -var CancellationError = Promise.CancellationError; -var errorObj = util.errorObj; -var catchFilter = require("./catch_filter")(NEXT_FILTER); - -function PassThroughHandlerContext(promise, type, handler) { - this.promise = promise; - this.type = type; - this.handler = handler; - this.called = false; - this.cancelPromise = null; -} - -PassThroughHandlerContext.prototype.isFinallyHandler = function() { - return this.type === 0; -}; - -function FinallyHandlerCancelReaction(finallyHandler) { - this.finallyHandler = finallyHandler; -} - -FinallyHandlerCancelReaction.prototype._resultCancelled = function() { - checkCancel(this.finallyHandler); -}; - -function checkCancel(ctx, reason) { - if (ctx.cancelPromise != null) { - if (arguments.length > 1) { - ctx.cancelPromise._reject(reason); - } else { - ctx.cancelPromise._cancel(); - } - ctx.cancelPromise = null; - return true; - } - return false; -} - -function succeed() { - return finallyHandler.call(this, this.promise._target()._settledValue()); -} -function fail(reason) { - if (checkCancel(this, reason)) return; - errorObj.e = reason; - return errorObj; -} -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - if (!this.called) { - this.called = true; - var ret = this.isFinallyHandler() - ? handler.call(promise._boundValue()) - : handler.call(promise._boundValue(), reasonOrValue); - if (ret === NEXT_FILTER) { - return ret; - } else if (ret !== undefined) { - promise._setReturnedNonUndefined(); - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - if (this.cancelPromise != null) { - if (maybePromise._isCancelled()) { - var reason = - new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - errorObj.e = reason; - return errorObj; - } else if (maybePromise.isPending()) { - maybePromise._attachCancellationCallback( - new FinallyHandlerCancelReaction(this)); - } - } - return maybePromise._then( - succeed, fail, undefined, this, undefined); - } - } - } - - if (promise.isRejected()) { - checkCancel(this); - errorObj.e = reasonOrValue; - return errorObj; - } else { - checkCancel(this); - return reasonOrValue; - } -} - -Promise.prototype._passThrough = function(handler, type, success, fail) { - if (typeof handler !== "function") return this.then(); - return this._then(success, - fail, - undefined, - new PassThroughHandlerContext(this, type, handler), - undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThrough(handler, - 0, - finallyHandler, - finallyHandler); -}; - - -Promise.prototype.tap = function (handler) { - return this._passThrough(handler, 1, finallyHandler); -}; - -Promise.prototype.tapCatch = function (handlerOrPredicate) { - var len = arguments.length; - if(len === 1) { - return this._passThrough(handlerOrPredicate, - 1, - undefined, - finallyHandler); - } else { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return Promise.reject(new TypeError( - "tapCatch statement predicate: " - + "expecting an object but got " + util.classString(item) - )); - } - } - catchInstances.length = j; - var handler = arguments[i]; - return this._passThrough(catchFilter(catchInstances, handler, this), - 1, - undefined, - finallyHandler); - } - -}; - -return PassThroughHandlerContext; -}; diff --git a/node_modules/bluebird/js/release/generators.js b/node_modules/bluebird/js/release/generators.js deleted file mode 100644 index 500c280c..00000000 --- a/node_modules/bluebird/js/release/generators.js +++ /dev/null @@ -1,223 +0,0 @@ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise, - Proxyable, - debug) { -var errors = require("./errors"); -var TypeError = errors.TypeError; -var util = require("./util"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; - -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; - } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} - -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - if (debug.cancellation()) { - var internal = new Promise(INTERNAL); - var _finallyPromise = this._finallyPromise = new Promise(INTERNAL); - this._promise = internal.lastly(function() { - return _finallyPromise; - }); - internal._captureStackTrace(); - internal._setOnCancel(this); - } else { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); - } - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; - this._yieldedPromise = null; - this._cancellationPhase = false; -} -util.inherits(PromiseSpawn, Proxyable); - -PromiseSpawn.prototype._isResolved = function() { - return this._promise === null; -}; - -PromiseSpawn.prototype._cleanup = function() { - this._promise = this._generator = null; - if (debug.cancellation() && this._finallyPromise !== null) { - this._finallyPromise._fulfill(); - this._finallyPromise = null; - } -}; - -PromiseSpawn.prototype._promiseCancelled = function() { - if (this._isResolved()) return; - var implementsReturn = typeof this._generator["return"] !== "undefined"; - - var result; - if (!implementsReturn) { - var reason = new Promise.CancellationError( - "generator .return() sentinel"); - Promise.coroutine.returnSentinel = reason; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - result = tryCatch(this._generator["throw"]).call(this._generator, - reason); - this._promise._popContext(); - } else { - this._promise._pushContext(); - result = tryCatch(this._generator["return"]).call(this._generator, - undefined); - this._promise._popContext(); - } - this._cancellationPhase = true; - this._yieldedPromise = null; - this._continue(result); -}; - -PromiseSpawn.prototype._promiseFulfilled = function(value) { - this._yieldedPromise = null; - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._promiseRejected = function(reason) { - this._yieldedPromise = null; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._resultCancelled = function() { - if (this._yieldedPromise instanceof Promise) { - var promise = this._yieldedPromise; - this._yieldedPromise = null; - promise.cancel(); - } -}; - -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; - -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._promiseFulfilled(undefined); -}; - -PromiseSpawn.prototype._continue = function (result) { - var promise = this._promise; - if (result === errorObj) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); - } else { - return promise._rejectCallback(result.e, false); - } - } - - var value = result.value; - if (result.done === true) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); - } else { - return promise._resolveCallback(value); - } - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._promiseRejected( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } - } - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - this._yieldedPromise = maybePromise; - maybePromise._proxy(this, null); - } else if (((bitField & 33554432) !== 0)) { - Promise._async.invoke( - this._promiseFulfilled, this, maybePromise._value() - ); - } else if (((bitField & 16777216) !== 0)) { - Promise._async.invoke( - this._promiseRejected, this, maybePromise._reason() - ); - } else { - this._promiseCancelled(); - } - } -}; - -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - var ret = spawn.promise(); - spawn._generator = generator; - spawn._promiseFulfilled(undefined); - return ret; - }; -}; - -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - yieldHandlers.push(fn); -}; - -Promise.spawn = function (generatorFunction) { - debug.deprecated("Promise.spawn()", "Promise.coroutine()"); - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; diff --git a/node_modules/bluebird/js/release/join.js b/node_modules/bluebird/js/release/join.js deleted file mode 100644 index e7e19f06..00000000 --- a/node_modules/bluebird/js/release/join.js +++ /dev/null @@ -1,165 +0,0 @@ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) { -var util = require("./util"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!false) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var promiseSetter = function(i) { - return new Function("promise", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = promise; \n\ - ".replace(/Index/g, i)); - }; - - var generateHolderClass = function(total) { - var props = new Array(total); - for (var i = 0; i < props.length; ++i) { - props[i] = "this.p" + (i+1); - } - var assignment = props.join(" = ") + " = null;"; - var cancellationCode= "var promise;\n" + props.map(function(prop) { - return " \n\ - promise = " + prop + "; \n\ - if (promise instanceof Promise) { \n\ - promise.cancel(); \n\ - } \n\ - "; - }).join("\n"); - var passedArguments = props.join(", "); - var name = "Holder$" + total; - - - var code = "return function(tryCatch, errorObj, Promise, async) { \n\ - 'use strict'; \n\ - function [TheName](fn) { \n\ - [TheProperties] \n\ - this.fn = fn; \n\ - this.asyncNeeded = true; \n\ - this.now = 0; \n\ - } \n\ - \n\ - [TheName].prototype._callFunction = function(promise) { \n\ - promise._pushContext(); \n\ - var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ - promise._popContext(); \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(ret.e, false); \n\ - } else { \n\ - promise._resolveCallback(ret); \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype.checkFulfillment = function(promise) { \n\ - var now = ++this.now; \n\ - if (now === [TheTotal]) { \n\ - if (this.asyncNeeded) { \n\ - async.invoke(this._callFunction, this, promise); \n\ - } else { \n\ - this._callFunction(promise); \n\ - } \n\ - \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype._resultCancelled = function() { \n\ - [CancellationCode] \n\ - }; \n\ - \n\ - return [TheName]; \n\ - }(tryCatch, errorObj, Promise, async); \n\ - "; - - code = code.replace(/\[TheName\]/g, name) - .replace(/\[TheTotal\]/g, total) - .replace(/\[ThePassedArguments\]/g, passedArguments) - .replace(/\[TheProperties\]/g, assignment) - .replace(/\[CancellationCode\]/g, cancellationCode); - - return new Function("tryCatch", "errorObj", "Promise", "async", code) - (tryCatch, errorObj, Promise, async); - }; - - var holderClasses = []; - var thenCallbacks = []; - var promiseSetters = []; - - for (var i = 0; i < 8; ++i) { - holderClasses.push(generateHolderClass(i + 1)); - thenCallbacks.push(thenCallback(i + 1)); - promiseSetters.push(promiseSetter(i + 1)); - } - - reject = function (reason) { - this._reject(reason); - }; -}} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!false) { - if (last <= 8 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var HolderClass = holderClasses[last - 1]; - var holder = new HolderClass(fn); - var callbacks = thenCallbacks; - - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - promiseSetters[i](maybePromise, holder); - holder.asyncNeeded = false; - } else if (((bitField & 33554432) !== 0)) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else if (((bitField & 16777216) !== 0)) { - ret._reject(maybePromise._reason()); - } else { - ret._cancel(); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - - if (!ret._isFateSealed()) { - if (holder.asyncNeeded) { - var context = Promise._getContext(); - holder.fn = util.contextBind(context, holder.fn); - } - ret._setAsyncGuaranteed(); - ret._setOnCancel(holder); - } - return ret; - } - } - } - var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i ];}; - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; diff --git a/node_modules/bluebird/js/release/map.js b/node_modules/bluebird/js/release/map.js deleted file mode 100644 index 91d5a826..00000000 --- a/node_modules/bluebird/js/release/map.js +++ /dev/null @@ -1,175 +0,0 @@ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var util = require("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - var context = Promise._getContext(); - this._callback = util.contextBind(context, fn); - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = []; - async.invoke(this._asyncInit, this, undefined); - if (util.isArray(promises)) { - for (var i = 0; i < promises.length; ++i) { - var maybePromise = promises[i]; - if (maybePromise instanceof Promise) { - maybePromise.suppressUnhandledRejections(); - } - } - } -} -util.inherits(MappingPromiseArray, PromiseArray); - -MappingPromiseArray.prototype._asyncInit = function() { - this._init$(undefined, -2); -}; - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - - if (index < 0) { - index = (index * -1) - 1; - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return true; - } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return false; - } - if (preservedValues !== null) preservedValues[index] = value; - - var promise = this._promise; - var callback = this._callback; - var receiver = promise._boundValue(); - promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - preservedValues !== null ? "Promise.filter" : "Promise.map", - promise - ); - if (ret === errorObj) { - this._reject(ret.e); - return true; - } - - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - if (limit >= 1) this._inFlight++; - values[index] = maybePromise; - maybePromise._proxy(this, (index + 1) * -1); - return false; - } else if (((bitField & 33554432) !== 0)) { - ret = maybePromise._value(); - } else if (((bitField & 16777216) !== 0)) { - this._reject(maybePromise._reason()); - return true; - } else { - this._cancel(); - return true; - } - } - values[index] = ret; - } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); - } else { - this._resolve(values); - } - return true; - } - return false; -}; - -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); - } -}; - -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; - } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; - -function map(promises, fn, options, _filter) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - - var limit = 0; - if (options !== undefined) { - if (typeof options === "object" && options !== null) { - if (typeof options.concurrency !== "number") { - return Promise.reject( - new TypeError("'concurrency' must be a number but it is " + - util.classString(options.concurrency))); - } - limit = options.concurrency; - } else { - return Promise.reject(new TypeError( - "options argument must be an object but it is " + - util.classString(options))); - } - } - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter).promise(); -} - -Promise.prototype.map = function (fn, options) { - return map(this, fn, options, null); -}; - -Promise.map = function (promises, fn, options, _filter) { - return map(promises, fn, options, _filter); -}; - - -}; diff --git a/node_modules/bluebird/js/release/method.js b/node_modules/bluebird/js/release/method.js deleted file mode 100644 index ce9e4db7..00000000 --- a/node_modules/bluebird/js/release/method.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { -var util = require("./util"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.method", ret); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value; - if (arguments.length > 1) { - debug.deprecated("calling Promise.try with more than 1 argument"); - var arg = arguments[1]; - var ctx = arguments[2]; - value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) - : tryCatch(fn).call(ctx, arg); - } else { - value = tryCatch(fn)(); - } - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.try", ret); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false); - } else { - this._resolveCallback(value, true); - } -}; -}; diff --git a/node_modules/bluebird/js/release/nodeback.js b/node_modules/bluebird/js/release/nodeback.js deleted file mode 100644 index 71e69ebd..00000000 --- a/node_modules/bluebird/js/release/nodeback.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -var util = require("./util"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = require("./errors"); -var OperationalError = errors.OperationalError; -var es5 = require("./es5"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise, multiArgs) { - return function(err, value) { - if (promise === null) return; - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (!multiArgs) { - promise._fulfill(value); - } else { - var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}; - promise._fulfill(args); - } - promise = null; - }; -} - -module.exports = nodebackForPromise; diff --git a/node_modules/bluebird/js/release/nodeify.js b/node_modules/bluebird/js/release/nodeify.js deleted file mode 100644 index ce2b1900..00000000 --- a/node_modules/bluebird/js/release/nodeify.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var util = require("./util"); -var async = Promise._async; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = - tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundValue(); - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var newReason = new Error(reason + ""); - newReason.cause = reason; - reason = newReason; - } - var ret = tryCatch(nodeback).call(promise._boundValue(), reason); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, - options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); - } - return this; -}; -}; diff --git a/node_modules/bluebird/js/release/promise.js b/node_modules/bluebird/js/release/promise.js deleted file mode 100644 index 03df7ac0..00000000 --- a/node_modules/bluebird/js/release/promise.js +++ /dev/null @@ -1,819 +0,0 @@ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var reflectHandler = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -function Proxyable() {} -var UNDEFINED_BINDING = {}; -var util = require("./util"); -util.setReflectHandler(reflectHandler); - -var getDomain = function() { - var domain = process.domain; - if (domain === undefined) { - return null; - } - return domain; -}; -var getContextDefault = function() { - return null; -}; -var getContextDomain = function() { - return { - domain: getDomain(), - async: null - }; -}; -var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ? - require("async_hooks").AsyncResource : null; -var getContextAsyncHooks = function() { - return { - domain: getDomain(), - async: new AsyncResource("Bluebird::Promise") - }; -}; -var getContext = util.isNode ? getContextDomain : getContextDefault; -util.notEnumerableProp(Promise, "_getContext", getContext); -var enableAsyncHooks = function() { - getContext = getContextAsyncHooks; - util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks); -}; -var disableAsyncHooks = function() { - getContext = getContextDomain; - util.notEnumerableProp(Promise, "_getContext", getContextDomain); -}; - -var es5 = require("./es5"); -var Async = require("./async"); -var async = new Async(); -es5.defineProperty(Promise, "_async", {value: async}); -var errors = require("./errors"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -var CancellationError = Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {}; -var tryConvertToPromise = require("./thenables")(Promise, INTERNAL); -var PromiseArray = - require("./promise_array")(Promise, INTERNAL, - tryConvertToPromise, apiRejection, Proxyable); -var Context = require("./context")(Promise); - /*jshint unused:false*/ -var createContext = Context.create; - -var debug = require("./debuggability")(Promise, Context, - enableAsyncHooks, disableAsyncHooks); -var CapturedTrace = debug.CapturedTrace; -var PassThroughHandlerContext = - require("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); -var catchFilter = require("./catch_filter")(NEXT_FILTER); -var nodebackForPromise = require("./nodeback"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function check(self, executor) { - if (self == null || self.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (typeof executor !== "function") { - throw new TypeError("expecting a function but got " + util.classString(executor)); - } - -} - -function Promise(executor) { - if (executor !== INTERNAL) { - check(this, executor); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._resolveFromExecutor(executor); - this._promiseCreated(); - this._fireEvent("promiseCreated", this); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return apiRejection("Catch statement predicate: " + - "expecting an object but got " + util.classString(item)); - } - } - catchInstances.length = j; - fn = arguments[i]; - - if (typeof fn !== "function") { - throw new TypeError("The last argument to .catch() " + - "must be a function, got " + util.toString(fn)); - } - return this.then(undefined, catchFilter(catchInstances, fn, this)); - } - return this.then(undefined, fn); -}; - -Promise.prototype.reflect = function () { - return this._then(reflectHandler, - reflectHandler, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject) { - if (debug.warnings() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, undefined, undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject) { - var promise = - this._then(didFulfill, didReject, undefined, undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - return this.all()._then(fn, undefined, undefined, APPLY, undefined); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - if (arguments.length > 0) { - this._warn(".all() was passed arguments but it does not take any"); - } - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.getNewLibraryCopy = module.exports; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = Promise.fromCallback = function(fn) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs - : false; - var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); - if (result === errorObj) { - ret._rejectCallback(result.e, true); - } - if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._setFulfilled(); - ret._rejectionHandler0 = obj; - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - return async.setScheduler(fn); -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - _, receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var promise = haveInternalData ? internalData : new Promise(INTERNAL); - var target = this._target(); - var bitField = target._bitField; - - if (!haveInternalData) { - promise._propagateFrom(this, 3); - promise._captureStackTrace(); - if (receiver === undefined && - ((this._bitField & 2097152) !== 0)) { - if (!((bitField & 50397184) === 0)) { - receiver = this._boundValue(); - } else { - receiver = target === this ? undefined : this._boundTo; - } - } - this._fireEvent("promiseChained", this, promise); - } - - var context = getContext(); - if (!((bitField & 50397184) === 0)) { - var handler, value, settler = target._settlePromiseCtx; - if (((bitField & 33554432) !== 0)) { - value = target._rejectionHandler0; - handler = didFulfill; - } else if (((bitField & 16777216) !== 0)) { - value = target._fulfillmentHandler0; - handler = didReject; - target._unsetRejectionIsUnhandled(); - } else { - settler = target._settlePromiseLateCancellationObserver; - value = new CancellationError("late cancellation observer"); - target._attachExtraTrace(value); - handler = didReject; - } - - async.invoke(settler, target, { - handler: util.contextBind(context, handler), - promise: promise, - receiver: receiver, - value: value - }); - } else { - target._addCallbacks(didFulfill, didReject, promise, - receiver, context); - } - - return promise; -}; - -Promise.prototype._length = function () { - return this._bitField & 65535; -}; - -Promise.prototype._isFateSealed = function () { - return (this._bitField & 117506048) !== 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 67108864) === 67108864; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -65536) | - (len & 65535); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 33554432; - this._fireEvent("promiseFulfilled", this); -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 16777216; - this._fireEvent("promiseRejected", this); -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 67108864; - this._fireEvent("promiseResolved", this); -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._unsetCancelled = function() { - this._bitField = this._bitField & (~65536); -}; - -Promise.prototype._setCancelled = function() { - this._bitField = this._bitField | 65536; - this._fireEvent("promiseCancelled", this); -}; - -Promise.prototype._setWillBeCancelled = function() { - this._bitField = this._bitField | 8388608; -}; - -Promise.prototype._setAsyncGuaranteed = function() { - if (async.hasCustomScheduler()) return; - var bitField = this._bitField; - this._bitField = bitField | - (((bitField & 536870912) >> 2) ^ - 134217728); -}; - -Promise.prototype._setNoAsyncGuarantee = function() { - this._bitField = (this._bitField | 536870912) & - (~134217728); -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 ? this._receiver0 : this[ - index * 4 - 4 + 3]; - if (ret === UNDEFINED_BINDING) { - return undefined; - } else if (ret === undefined && this._isBound()) { - return this._boundValue(); - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return this[ - index * 4 - 4 + 2]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return this[ - index * 4 - 4 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return this[ - index * 4 - 4 + 1]; -}; - -Promise.prototype._boundValue = function() {}; - -Promise.prototype._migrateCallback0 = function (follower) { - var bitField = follower._bitField; - var fulfill = follower._fulfillmentHandler0; - var reject = follower._rejectionHandler0; - var promise = follower._promise0; - var receiver = follower._receiverAt(0); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._migrateCallbackAt = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - promise, - receiver, - context -) { - var index = this._length(); - - if (index >= 65535 - 4) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - this._receiver0 = receiver; - if (typeof fulfill === "function") { - this._fulfillmentHandler0 = util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this._rejectionHandler0 = util.contextBind(context, reject); - } - } else { - var base = index * 4 - 4; - this[base + 2] = promise; - this[base + 3] = receiver; - if (typeof fulfill === "function") { - this[base + 0] = - util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this[base + 1] = - util.contextBind(context, reject); - } - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._proxy = function (proxyable, arg) { - this._addCallbacks(undefined, undefined, arg, proxyable, null); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (((this._bitField & 117506048) !== 0)) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - if (shouldBind) this._propagateFrom(maybePromise, 2); - - - var promise = maybePromise._target(); - - if (promise === this) { - this._reject(makeSelfResolutionError()); - return; - } - - var bitField = promise._bitField; - if (((bitField & 50397184) === 0)) { - var len = this._length(); - if (len > 0) promise._migrateCallback0(this); - for (var i = 1; i < len; ++i) { - promise._migrateCallbackAt(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(maybePromise); - } else if (((bitField & 33554432) !== 0)) { - this._fulfill(promise._value()); - } else if (((bitField & 16777216) !== 0)) { - this._reject(promise._reason()); - } else { - var reason = new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - this._reject(reason); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, ignoreNonErrorWarnings) { - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { - var message = "a promise was rejected with a non-error: " + - util.classString(reason); - this._warn(message, true); - } - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason); -}; - -Promise.prototype._resolveFromExecutor = function (executor) { - if (executor === INTERNAL) return; - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = this._execute(executor, function(value) { - promise._resolveCallback(value); - }, function (reason) { - promise._rejectCallback(reason, synchronous); - }); - synchronous = false; - this._popContext(); - - if (r !== undefined) { - promise._rejectCallback(r, true); - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - var bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - promise._pushContext(); - var x; - if (receiver === APPLY) { - if (!value || typeof value.length !== "number") { - x = errorObj; - x.e = new TypeError("cannot .spread() a non-array: " + - util.classString(value)); - } else { - x = tryCatch(handler).apply(this._boundValue(), value); - } - } else { - x = tryCatch(handler).call(receiver, value); - } - var promiseCreated = promise._popContext(); - bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - - if (x === NEXT_FILTER) { - promise._reject(value); - } else if (x === errorObj) { - promise._rejectCallback(x.e, false); - } else { - debug.checkForgottenReturns(x, promiseCreated, "", promise, this); - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._settlePromise = function(promise, handler, receiver, value) { - var isPromise = promise instanceof Promise; - var bitField = this._bitField; - var asyncGuaranteed = ((bitField & 134217728) !== 0); - if (((bitField & 65536) !== 0)) { - if (isPromise) promise._invokeInternalOnCancel(); - - if (receiver instanceof PassThroughHandlerContext && - receiver.isFinallyHandler()) { - receiver.cancelPromise = promise; - if (tryCatch(handler).call(receiver, value) === errorObj) { - promise._reject(errorObj.e); - } - } else if (handler === reflectHandler) { - promise._fulfill(reflectHandler.call(receiver)); - } else if (receiver instanceof Proxyable) { - receiver._promiseCancelled(promise); - } else if (isPromise || promise instanceof PromiseArray) { - promise._cancel(); - } else { - receiver.cancel(); - } - } else if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof Proxyable) { - if (!receiver._isResolved()) { - if (((bitField & 33554432) !== 0)) { - receiver._promiseFulfilled(value, promise); - } else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - if (((bitField & 33554432) !== 0)) { - promise._fulfill(value); - } else { - promise._reject(value); - } - } -}; - -Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { - var handler = ctx.handler; - var promise = ctx.promise; - var receiver = ctx.receiver; - var value = ctx.value; - if (typeof handler === "function") { - if (!(promise instanceof Promise)) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (promise instanceof Promise) { - promise._reject(value); - } -}; - -Promise.prototype._settlePromiseCtx = function(ctx) { - this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); -}; - -Promise.prototype._settlePromise0 = function(handler, value, bitField) { - var promise = this._promise0; - var receiver = this._receiverAt(0); - this._promise0 = undefined; - this._receiver0 = undefined; - this._settlePromise(promise, handler, receiver, value); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - var base = index * 4 - 4; - this[base + 2] = - this[base + 3] = - this[base + 0] = - this[base + 1] = undefined; -}; - -Promise.prototype._fulfill = function (value) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._reject(err); - } - this._setFulfilled(); - this._rejectionHandler0 = value; - - if ((bitField & 65535) > 0) { - if (((bitField & 134217728) !== 0)) { - this._settlePromises(); - } else { - async.settlePromises(this); - } - this._dereferenceTrace(); - } -}; - -Promise.prototype._reject = function (reason) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - this._setRejected(); - this._fulfillmentHandler0 = reason; - - if (this._isFinal()) { - return async.fatalError(reason, util.isNode); - } - - if ((bitField & 65535) > 0) { - async.settlePromises(this); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._fulfillPromises = function (len, value) { - for (var i = 1; i < len; i++) { - var handler = this._fulfillmentHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, value); - } -}; - -Promise.prototype._rejectPromises = function (len, reason) { - for (var i = 1; i < len; i++) { - var handler = this._rejectionHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, reason); - } -}; - -Promise.prototype._settlePromises = function () { - var bitField = this._bitField; - var len = (bitField & 65535); - - if (len > 0) { - if (((bitField & 16842752) !== 0)) { - var reason = this._fulfillmentHandler0; - this._settlePromise0(this._rejectionHandler0, reason, bitField); - this._rejectPromises(len, reason); - } else { - var value = this._rejectionHandler0; - this._settlePromise0(this._fulfillmentHandler0, value, bitField); - this._fulfillPromises(len, value); - } - this._setLength(0); - } - this._clearCancellationData(); -}; - -Promise.prototype._settledValue = function() { - var bitField = this._bitField; - if (((bitField & 33554432) !== 0)) { - return this._rejectionHandler0; - } else if (((bitField & 16777216) !== 0)) { - return this._fulfillmentHandler0; - } -}; - -if (typeof Symbol !== "undefined" && Symbol.toStringTag) { - es5.defineProperty(Promise.prototype, Symbol.toStringTag, { - get: function () { - return "Object"; - } - }); -} - -function deferResolve(v) {this.promise._resolveCallback(v);} -function deferReject(v) {this.promise._rejectCallback(v, false);} - -Promise.defer = Promise.pending = function() { - debug.deprecated("Promise.defer", "new Promise"); - var promise = new Promise(INTERNAL); - return { - promise: promise, - resolve: deferResolve, - reject: deferReject - }; -}; - -util.notEnumerableProp(Promise, - "_makeSelfResolutionError", - makeSelfResolutionError); - -require("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, - debug); -require("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); -require("./cancel")(Promise, PromiseArray, apiRejection, debug); -require("./direct_resolve")(Promise); -require("./synchronous_inspection")(Promise); -require("./join")( - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async); -Promise.Promise = Promise; -Promise.version = "3.7.1"; -require('./call_get.js')(Promise); -require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); -require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -require('./nodeify.js')(Promise); -require('./promisify.js')(Promise, INTERNAL); -require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -require('./settle.js')(Promise, PromiseArray, debug); -require('./some.js')(Promise, PromiseArray, apiRejection); -require('./timers.js')(Promise, INTERNAL, debug); -require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); -require('./any.js')(Promise); -require('./each.js')(Promise, INTERNAL); -require('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - debug.setBounds(Async.firstLineError, util.lastLineError); - return Promise; - -}; diff --git a/node_modules/bluebird/js/release/promise_array.js b/node_modules/bluebird/js/release/promise_array.js deleted file mode 100644 index 8fc665a4..00000000 --- a/node_modules/bluebird/js/release/promise_array.js +++ /dev/null @@ -1,186 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection, Proxyable) { -var util = require("./util"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - case -6: return new Map(); - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - if (values instanceof Promise) { - promise._propagateFrom(values, 3); - values.suppressUnhandledRejections(); - } - promise._setOnCancel(this); - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -util.inherits(PromiseArray, Proxyable); - -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - var bitField = values._bitField; - ; - this._values = values; - - if (((bitField & 50397184) === 0)) { - this._promise._setAsyncGuaranteed(); - return values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - } else if (((bitField & 33554432) !== 0)) { - values = values._value(); - } else if (((bitField & 16777216) !== 0)) { - return this._reject(values._reason()); - } else { - return this._cancel(); - } - } - values = util.asArray(values); - if (values === null) { - var err = apiRejection( - "expecting an array or an iterable object but got " + util.classString(values)).reason(); - this._promise._rejectCallback(err, false); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - this._iterate(values); -}; - -PromiseArray.prototype._iterate = function(values) { - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var result = this._promise; - var isResolved = false; - var bitField = null; - for (var i = 0; i < len; ++i) { - var maybePromise = tryConvertToPromise(values[i], result); - - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - bitField = maybePromise._bitField; - } else { - bitField = null; - } - - if (isResolved) { - if (bitField !== null) { - maybePromise.suppressUnhandledRejections(); - } - } else if (bitField !== null) { - if (((bitField & 50397184) === 0)) { - maybePromise._proxy(this, i); - this._values[i] = maybePromise; - } else if (((bitField & 33554432) !== 0)) { - isResolved = this._promiseFulfilled(maybePromise._value(), i); - } else if (((bitField & 16777216) !== 0)) { - isResolved = this._promiseRejected(maybePromise._reason(), i); - } else { - isResolved = this._promiseCancelled(i); - } - } else { - isResolved = this._promiseFulfilled(maybePromise, i); - } - } - if (!isResolved) result._setAsyncGuaranteed(); -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype._cancel = function() { - if (this._isResolved() || !this._promise._isCancellable()) return; - this._values = null; - this._promise._cancel(); -}; - -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false); -}; - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; - -PromiseArray.prototype._promiseCancelled = function() { - this._cancel(); - return true; -}; - -PromiseArray.prototype._promiseRejected = function (reason) { - this._totalResolved++; - this._reject(reason); - return true; -}; - -PromiseArray.prototype._resultCancelled = function() { - if (this._isResolved()) return; - var values = this._values; - this._cancel(); - if (values instanceof Promise) { - values.cancel(); - } else { - for (var i = 0; i < values.length; ++i) { - if (values[i] instanceof Promise) { - values[i].cancel(); - } - } - } -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; diff --git a/node_modules/bluebird/js/release/promisify.js b/node_modules/bluebird/js/release/promisify.js deleted file mode 100644 index aa98e5bd..00000000 --- a/node_modules/bluebird/js/release/promisify.js +++ /dev/null @@ -1,314 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = require("./util"); -var nodebackForPromise = require("./nodeback"); -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = require("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyProps = [ - "arity", "length", - "name", - "arguments", - "caller", - "callee", - "prototype", - "__isPromisified__" -]; -var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); - -var defaultFilter = function(name) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - name !== "constructor"; -}; - -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} - -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} - -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a" - .replace("%s", suffix)); - } - } - } - } -} - -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} - -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; - -var makeNodePromisifiedEval; -if (!false) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; - -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; - -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; - -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; - -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn, _, multiArgs) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; - - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); - } - - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } - - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; - } - - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - var body = "'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\ - return promise; \n\ - }; \n\ - notEnumerableProp(ret, '__isPromisified__', true); \n\ - return ret; \n\ - ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode); - body = body.replace("Parameters", parameterDeclaration(newParameterCount)); - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "notEnumerableProp", - "INTERNAL", - body)( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - util.notEnumerableProp, - INTERNAL); -}; -} - -function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; - } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise, multiArgs); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); - return promise; - } - util.notEnumerableProp(promisified, "__isPromisified__", true); - return promisified; -} - -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; - -function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); - - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - if (promisifier === makeNodePromisified) { - obj[promisifiedKey] = - makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); - } else { - var promisified = promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, - fn, suffix, multiArgs); - }); - util.notEnumerableProp(promisified, "__isPromisified__", true); - obj[promisifiedKey] = promisified; - } - } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver, multiArgs) { - return makeNodePromisified(callback, receiver, undefined, - callback, null, multiArgs); -} - -Promise.promisify = function (fn, options) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - if (isPromisified(fn)) { - return fn; - } - options = Object(options); - var receiver = options.context === undefined ? THIS : options.context; - var multiArgs = !!options.multiArgs; - var ret = promisify(fn, receiver, multiArgs); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - options = Object(options); - var multiArgs = !!options.multiArgs; - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; - - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier, - multiArgs); - promisifyAll(value, suffix, filter, promisifier, multiArgs); - } - } - - return promisifyAll(target, suffix, filter, promisifier, multiArgs); -}; -}; - diff --git a/node_modules/bluebird/js/release/props.js b/node_modules/bluebird/js/release/props.js deleted file mode 100644 index 6a34aaf5..00000000 --- a/node_modules/bluebird/js/release/props.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = require("./util"); -var isObject = util.isObject; -var es5 = require("./es5"); -var Es6Map; -if (typeof Map === "function") Es6Map = Map; - -var mapToEntries = (function() { - var index = 0; - var size = 0; - - function extractEntry(value, key) { - this[index] = value; - this[index + size] = key; - index++; - } - - return function mapToEntries(map) { - size = map.size; - index = 0; - var ret = new Array(map.size * 2); - map.forEach(extractEntry, ret); - return ret; - }; -})(); - -var entriesToMap = function(entries) { - var ret = new Es6Map(); - var length = entries.length / 2 | 0; - for (var i = 0; i < length; ++i) { - var key = entries[length + i]; - var value = entries[i]; - ret.set(key, value); - } - return ret; -}; - -function PropertiesPromiseArray(obj) { - var isMap = false; - var entries; - if (Es6Map !== undefined && obj instanceof Es6Map) { - entries = mapToEntries(obj); - isMap = true; - } else { - var keys = es5.keys(obj); - var len = keys.length; - entries = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - entries[i] = obj[key]; - entries[i + len] = key; - } - } - this.constructor$(entries); - this._isMap = isMap; - this._init$(undefined, isMap ? -6 : -3); -} -util.inherits(PropertiesPromiseArray, PromiseArray); - -PropertiesPromiseArray.prototype._init = function () {}; - -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val; - if (this._isMap) { - val = entriesToMap(this._values); - } else { - val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - } - this._resolve(val); - return true; - } - return false; -}; - -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; - -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); - - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } - - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 2); - } - return ret; -} - -Promise.prototype.props = function () { - return props(this); -}; - -Promise.props = function (promises) { - return props(promises); -}; -}; diff --git a/node_modules/bluebird/js/release/queue.js b/node_modules/bluebird/js/release/queue.js deleted file mode 100644 index ffd36fda..00000000 --- a/node_modules/bluebird/js/release/queue.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; diff --git a/node_modules/bluebird/js/release/race.js b/node_modules/bluebird/js/release/race.js deleted file mode 100644 index b862f46d..00000000 --- a/node_modules/bluebird/js/release/race.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = require("./util"); - -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; - -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); - - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else { - promises = util.asArray(promises); - if (promises === null) - return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); - } - - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 3); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; - - if (val === undefined && !(i in promises)) { - continue; - } - - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} - -Promise.race = function (promises) { - return race(promises, undefined); -}; - -Promise.prototype.race = function () { - return race(this, undefined); -}; - -}; diff --git a/node_modules/bluebird/js/release/reduce.js b/node_modules/bluebird/js/release/reduce.js deleted file mode 100644 index 101ac226..00000000 --- a/node_modules/bluebird/js/release/reduce.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var util = require("./util"); -var tryCatch = util.tryCatch; - -function ReductionPromiseArray(promises, fn, initialValue, _each) { - this.constructor$(promises); - var context = Promise._getContext(); - this._fn = util.contextBind(context, fn); - if (initialValue !== undefined) { - initialValue = Promise.resolve(initialValue); - initialValue._attachCancellationCallback(this); - } - this._initialValue = initialValue; - this._currentCancellable = null; - if(_each === INTERNAL) { - this._eachValues = Array(this._length); - } else if (_each === 0) { - this._eachValues = null; - } else { - this._eachValues = undefined; - } - this._promise._captureStackTrace(); - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); - -ReductionPromiseArray.prototype._gotAccum = function(accum) { - if (this._eachValues !== undefined && - this._eachValues !== null && - accum !== INTERNAL) { - this._eachValues.push(accum); - } -}; - -ReductionPromiseArray.prototype._eachComplete = function(value) { - if (this._eachValues !== null) { - this._eachValues.push(value); - } - return this._eachValues; -}; - -ReductionPromiseArray.prototype._init = function() {}; - -ReductionPromiseArray.prototype._resolveEmptyArray = function() { - this._resolve(this._eachValues !== undefined ? this._eachValues - : this._initialValue); -}; - -ReductionPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -ReductionPromiseArray.prototype._resolve = function(value) { - this._promise._resolveCallback(value); - this._values = null; -}; - -ReductionPromiseArray.prototype._resultCancelled = function(sender) { - if (sender === this._initialValue) return this._cancel(); - if (this._isResolved()) return; - this._resultCancelled$(); - if (this._currentCancellable instanceof Promise) { - this._currentCancellable.cancel(); - } - if (this._initialValue instanceof Promise) { - this._initialValue.cancel(); - } -}; - -ReductionPromiseArray.prototype._iterate = function (values) { - this._values = values; - var value; - var i; - var length = values.length; - if (this._initialValue !== undefined) { - value = this._initialValue; - i = 0; - } else { - value = Promise.resolve(values[0]); - i = 1; - } - - this._currentCancellable = value; - - for (var j = i; j < length; ++j) { - var maybePromise = values[j]; - if (maybePromise instanceof Promise) { - maybePromise.suppressUnhandledRejections(); - } - } - - if (!value.isRejected()) { - for (; i < length; ++i) { - var ctx = { - accum: null, - value: values[i], - index: i, - length: length, - array: this - }; - - value = value._then(gotAccum, undefined, undefined, ctx, undefined); - - if ((i & 127) === 0) { - value._setNoAsyncGuarantee(); - } - } - } - - if (this._eachValues !== undefined) { - value = value - ._then(this._eachComplete, undefined, undefined, this, undefined); - } - value._then(completed, completed, undefined, value, this); -}; - -Promise.prototype.reduce = function (fn, initialValue) { - return reduce(this, fn, initialValue, null); -}; - -Promise.reduce = function (promises, fn, initialValue, _each) { - return reduce(promises, fn, initialValue, _each); -}; - -function completed(valueOrReason, array) { - if (this.isFulfilled()) { - array._resolve(valueOrReason); - } else { - array._reject(valueOrReason); - } -} - -function reduce(promises, fn, initialValue, _each) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var array = new ReductionPromiseArray(promises, fn, initialValue, _each); - return array.promise(); -} - -function gotAccum(accum) { - this.accum = accum; - this.array._gotAccum(accum); - var value = tryConvertToPromise(this.value, this.array._promise); - if (value instanceof Promise) { - this.array._currentCancellable = value; - return value._then(gotValue, undefined, undefined, this, undefined); - } else { - return gotValue.call(this, value); - } -} - -function gotValue(value) { - var array = this.array; - var promise = array._promise; - var fn = tryCatch(array._fn); - promise._pushContext(); - var ret; - if (array._eachValues !== undefined) { - ret = fn.call(promise._boundValue(), value, this.index, this.length); - } else { - ret = fn.call(promise._boundValue(), - this.accum, value, this.index, this.length); - } - if (ret instanceof Promise) { - array._currentCancellable = ret; - } - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", - promise - ); - return ret; -} -}; diff --git a/node_modules/bluebird/js/release/schedule.js b/node_modules/bluebird/js/release/schedule.js deleted file mode 100644 index 15197d14..00000000 --- a/node_modules/bluebird/js/release/schedule.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -var util = require("./util"); -var schedule; -var noAsyncScheduler = function() { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var NativePromise = util.getNativePromise(); -if (util.isNode && typeof MutationObserver === "undefined") { - var GlobalSetImmediate = global.setImmediate; - var ProcessNextTick = process.nextTick; - schedule = util.isRecentNode - ? function(fn) { GlobalSetImmediate.call(global, fn); } - : function(fn) { ProcessNextTick.call(process, fn); }; -} else if (typeof NativePromise === "function" && - typeof NativePromise.resolve === "function") { - var nativePromise = NativePromise.resolve(); - schedule = function(fn) { - nativePromise.then(fn); - }; -} else if ((typeof MutationObserver !== "undefined") && - !(typeof window !== "undefined" && - window.navigator && - (window.navigator.standalone || window.cordova)) && - ("classList" in document.documentElement)) { - schedule = (function() { - var div = document.createElement("div"); - var opts = {attributes: true}; - var toggleScheduled = false; - var div2 = document.createElement("div"); - var o2 = new MutationObserver(function() { - div.classList.toggle("foo"); - toggleScheduled = false; - }); - o2.observe(div2, opts); - - var scheduleToggle = function() { - if (toggleScheduled) return; - toggleScheduled = true; - div2.classList.toggle("foo"); - }; - - return function schedule(fn) { - var o = new MutationObserver(function() { - o.disconnect(); - fn(); - }); - o.observe(div, opts); - scheduleToggle(); - }; - })(); -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; diff --git a/node_modules/bluebird/js/release/settle.js b/node_modules/bluebird/js/release/settle.js deleted file mode 100644 index e24b2047..00000000 --- a/node_modules/bluebird/js/release/settle.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -module.exports = - function(Promise, PromiseArray, debug) { -var PromiseInspection = Promise.PromiseInspection; -var util = require("./util"); - -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); - -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; - -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 33554432; - ret._settledValueField = value; - return this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 16777216; - ret._settledValueField = reason; - return this._promiseResolved(index, ret); -}; - -Promise.settle = function (promises) { - debug.deprecated(".settle()", ".reflect()"); - return new SettledPromiseArray(promises).promise(); -}; - -Promise.allSettled = function (promises) { - return new SettledPromiseArray(promises).promise(); -}; - -Promise.prototype.settle = function () { - return Promise.settle(this); -}; -}; diff --git a/node_modules/bluebird/js/release/some.js b/node_modules/bluebird/js/release/some.js deleted file mode 100644 index 400d8520..00000000 --- a/node_modules/bluebird/js/release/some.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = require("./util"); -var RangeError = require("./errors").RangeError; -var AggregateError = require("./errors").AggregateError; -var isArray = util.isArray; -var CANCELLATION = {}; - - -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); - -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; - -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; - -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; - -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; - -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; - -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - return true; - } - return false; - -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - return this._checkOutcome(); -}; - -SomePromiseArray.prototype._promiseCancelled = function () { - if (this._values instanceof Promise || this._values == null) { - return this._cancel(); - } - this._addRejected(CANCELLATION); - return this._checkOutcome(); -}; - -SomePromiseArray.prototype._checkOutcome = function() { - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - if (this._values[i] !== CANCELLATION) { - e.push(this._values[i]); - } - } - if (e.length > 0) { - this._reject(e); - } else { - this._cancel(); - } - return true; - } - return false; -}; - -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; - -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; - -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; - -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; - -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; - -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; - -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; - -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} - -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; - -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; - -Promise._SomePromiseArray = SomePromiseArray; -}; diff --git a/node_modules/bluebird/js/release/synchronous_inspection.js b/node_modules/bluebird/js/release/synchronous_inspection.js deleted file mode 100644 index 9c49d2e6..00000000 --- a/node_modules/bluebird/js/release/synchronous_inspection.js +++ /dev/null @@ -1,103 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValueField = promise._isFateSealed() - ? promise._settledValue() : undefined; - } - else { - this._bitField = 0; - this._settledValueField = undefined; - } -} - -PromiseInspection.prototype._settledValue = function() { - return this._settledValueField; -}; - -var value = PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var reason = PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { - return (this._bitField & 33554432) !== 0; -}; - -var isRejected = PromiseInspection.prototype.isRejected = function () { - return (this._bitField & 16777216) !== 0; -}; - -var isPending = PromiseInspection.prototype.isPending = function () { - return (this._bitField & 50397184) === 0; -}; - -var isResolved = PromiseInspection.prototype.isResolved = function () { - return (this._bitField & 50331648) !== 0; -}; - -PromiseInspection.prototype.isCancelled = function() { - return (this._bitField & 8454144) !== 0; -}; - -Promise.prototype.__isCancelled = function() { - return (this._bitField & 65536) === 65536; -}; - -Promise.prototype._isCancelled = function() { - return this._target().__isCancelled(); -}; - -Promise.prototype.isCancelled = function() { - return (this._target()._bitField & 8454144) !== 0; -}; - -Promise.prototype.isPending = function() { - return isPending.call(this._target()); -}; - -Promise.prototype.isRejected = function() { - return isRejected.call(this._target()); -}; - -Promise.prototype.isFulfilled = function() { - return isFulfilled.call(this._target()); -}; - -Promise.prototype.isResolved = function() { - return isResolved.call(this._target()); -}; - -Promise.prototype.value = function() { - return value.call(this._target()); -}; - -Promise.prototype.reason = function() { - var target = this._target(); - target._unsetRejectionIsUnhandled(); - return reason.call(target); -}; - -Promise.prototype._value = function() { - return this._settledValue(); -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue(); -}; - -Promise.PromiseInspection = PromiseInspection; -}; diff --git a/node_modules/bluebird/js/release/thenables.js b/node_modules/bluebird/js/release/thenables.js deleted file mode 100644 index d6ab9aa2..00000000 --- a/node_modules/bluebird/js/release/thenables.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = require("./util"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) return obj; - var then = getThen(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfill, - ret._reject, - undefined, - ret, - null - ); - return ret; - } - return doThenable(obj, then, context); - } - } - return obj; -} - -function doGetThen(obj) { - return obj.then; -} - -function getThen(obj) { - try { - return doGetThen(obj); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - try { - return hasProp.call(obj, "_promise0"); - } catch (e) { - return false; - } -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, resolve, reject); - synchronous = false; - - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolve(value) { - if (!promise) return; - promise._resolveCallback(value); - promise = null; - } - - function reject(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - return ret; -} - -return tryConvertToPromise; -}; diff --git a/node_modules/bluebird/js/release/timers.js b/node_modules/bluebird/js/release/timers.js deleted file mode 100644 index cb8f1f42..00000000 --- a/node_modules/bluebird/js/release/timers.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL, debug) { -var util = require("./util"); -var TimeoutError = Promise.TimeoutError; - -function HandleWrapper(handle) { - this.handle = handle; -} - -HandleWrapper.prototype._resultCancelled = function() { - clearTimeout(this.handle); -}; - -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (ms, value) { - var ret; - var handle; - if (value !== undefined) { - ret = Promise.resolve(value) - ._then(afterValue, null, null, ms, undefined); - if (debug.cancellation() && value instanceof Promise) { - ret._setOnCancel(value); - } - } else { - ret = new Promise(INTERNAL); - handle = setTimeout(function() { ret._fulfill(); }, +ms); - if (debug.cancellation()) { - ret._setOnCancel(new HandleWrapper(handle)); - } - ret._captureStackTrace(); - } - ret._setAsyncGuaranteed(); - return ret; -}; - -Promise.prototype.delay = function (ms) { - return delay(ms, this); -}; - -var afterTimeout = function (promise, message, parent) { - var err; - if (typeof message !== "string") { - if (message instanceof Error) { - err = message; - } else { - err = new TimeoutError("operation timed out"); - } - } else { - err = new TimeoutError(message); - } - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._reject(err); - - if (parent != null) { - parent.cancel(); - } -}; - -function successClear(value) { - clearTimeout(this.handle); - return value; -} - -function failureClear(reason) { - clearTimeout(this.handle); - throw reason; -} - -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret, parent; - - var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { - if (ret.isPending()) { - afterTimeout(ret, message, parent); - } - }, ms)); - - if (debug.cancellation()) { - parent = this.then(); - ret = parent._then(successClear, failureClear, - undefined, handleWrapper, undefined); - ret._setOnCancel(handleWrapper); - } else { - ret = this._then(successClear, failureClear, - undefined, handleWrapper, undefined); - } - - return ret; -}; - -}; diff --git a/node_modules/bluebird/js/release/using.js b/node_modules/bluebird/js/release/using.js deleted file mode 100644 index 65de531c..00000000 --- a/node_modules/bluebird/js/release/using.js +++ /dev/null @@ -1,226 +0,0 @@ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext, INTERNAL, debug) { - var util = require("./util"); - var TypeError = require("./errors").TypeError; - var inherits = require("./util").inherits; - var errorObj = util.errorObj; - var tryCatch = util.tryCatch; - var NULL = {}; - - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } - - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = new Promise(INTERNAL); - function iterator() { - if (i >= len) return ret._fulfill(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); - } - } - iterator(); - } - iterator(); - return ret; - } - - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } - - Disposer.prototype.data = function () { - return this._data; - }; - - Disposer.prototype.promise = function () { - return this._promise; - }; - - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return NULL; - }; - - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== NULL - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; - - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; - - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); - - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; - - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } - - function ResourceList(length) { - this.length = length; - this.promise = null; - this[length-1] = null; - } - - ResourceList.prototype._resultCancelled = function() { - var len = this.length; - for (var i = 0; i < len; ++i) { - var item = this[i]; - if (item instanceof Promise) { - item.cancel(); - } - } - }; - - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var input; - var spreadArgs = true; - if (len === 2 && Array.isArray(arguments[0])) { - input = arguments[0]; - len = input.length; - spreadArgs = false; - } else { - input = arguments; - len--; - } - var resources = new ResourceList(len); - for (var i = 0; i < len; ++i) { - var resource = input[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } - - var reflectedResources = new Array(resources.length); - for (var i = 0; i < reflectedResources.length; ++i) { - reflectedResources[i] = Promise.resolve(resources[i]).reflect(); - } - - var resultPromise = Promise.all(reflectedResources) - .then(function(inspections) { - for (var i = 0; i < inspections.length; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - errorObj.e = inspection.error(); - return errorObj; - } else if (!inspection.isFulfilled()) { - resultPromise.cancel(); - return; - } - inspections[i] = inspection.value(); - } - promise._pushContext(); - - fn = tryCatch(fn); - var ret = spreadArgs - ? fn.apply(undefined, inspections) : fn(inspections); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, promiseCreated, "Promise.using", promise); - return ret; - }); - - var promise = resultPromise.lastly(function() { - var inspection = new Promise.PromiseInspection(resultPromise); - return dispose(resources, inspection); - }); - resources.promise = promise; - promise._setOnCancel(resources); - return promise; - }; - - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 131072; - this._disposer = disposer; - }; - - Promise.prototype._isDisposable = function () { - return (this._bitField & 131072) > 0; - }; - - Promise.prototype._getDisposer = function () { - return this._disposer; - }; - - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~131072); - this._disposer = undefined; - }; - - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; - -}; diff --git a/node_modules/bluebird/js/release/util.js b/node_modules/bluebird/js/release/util.js deleted file mode 100644 index 8ca4d91b..00000000 --- a/node_modules/bluebird/js/release/util.js +++ /dev/null @@ -1,421 +0,0 @@ -"use strict"; -var es5 = require("./es5"); -var canEvaluate = typeof navigator == "undefined"; - -var errorObj = {e: {}}; -var tryCatchTarget; -var globalObject = typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - typeof global !== "undefined" ? global : - this !== undefined ? this : null; - -function tryCatcher() { - try { - var target = tryCatchTarget; - tryCatchTarget = null; - return target.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return typeof value === "function" || - typeof value === "object" && value !== null; -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - var excludedPrototypes = [ - Array.prototype, - Object.prototype, - Function.prototype - ]; - - var isExcludedProto = function(val) { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (excludedPrototypes[i] === val) { - return true; - } - } - return false; - }; - - if (es5.isES5) { - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && !isExcludedProto(obj)) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - var hasProp = {}.hasOwnProperty; - return function(obj) { - if (isExcludedProto(obj)) return []; - var ret = []; - - /*jshint forin:false */ - enumeration: for (var key in obj) { - if (hasProp.call(obj, key)) { - ret.push(key); - } else { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (hasProp.call(excludedPrototypes[i], key)) { - continue enumeration; - } - } - ret.push(key); - } - } - return ret; - }; - } - -})(); - -var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - - var hasMethods = es5.isES5 && keys.length > 1; - var hasMethodsOtherThanConstructor = keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - var hasThisAssignmentAndStaticMethods = - thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; - - if (hasMethods || hasMethodsOtherThanConstructor || - hasThisAssignmentAndStaticMethods) { - return true; - } - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function FakeConstructor() {} - FakeConstructor.prototype = obj; - var receiver = new FakeConstructor(); - function ic() { - return typeof receiver.foo; - } - ic(); - ic(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function isError(obj) { - return obj instanceof Error || - (obj !== null && - typeof obj === "object" && - typeof obj.message === "string" && - typeof obj.name === "string"); -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return isError(obj) && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - try { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } catch (ignore) {} - } - } -} - -var asArray = function(v) { - if (es5.isArray(v)) { - return v; - } - return null; -}; - -if (typeof Symbol !== "undefined" && Symbol.iterator) { - var ArrayFrom = typeof Array.from === "function" ? function(v) { - return Array.from(v); - } : function(v) { - var ret = []; - var it = v[Symbol.iterator](); - var itResult; - while (!((itResult = it.next()).done)) { - ret.push(itResult.value); - } - return ret; - }; - - asArray = function(v) { - if (es5.isArray(v)) { - return v; - } else if (v != null && typeof v[Symbol.iterator] === "function") { - return ArrayFrom(v); - } - return null; - }; -} - -var isNode = typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]"; - -var hasEnvVariables = typeof process !== "undefined" && - typeof process.env !== "undefined"; - -function env(key) { - return hasEnvVariables ? process.env[key] : undefined; -} - -function getNativePromise() { - if (typeof Promise === "function") { - try { - var promise = new Promise(function(){}); - if (classString(promise) === "[object Promise]") { - return Promise; - } - } catch (e) {} - } -} - -var reflectHandler; -function contextBind(ctx, cb) { - if (ctx === null || - typeof cb !== "function" || - cb === reflectHandler) { - return cb; - } - - if (ctx.domain !== null) { - cb = ctx.domain.bind(cb); - } - - var async = ctx.async; - if (async !== null) { - var old = cb; - cb = function() { - var $_len = arguments.length + 2;var args = new Array($_len); for(var $_i = 2; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i - 2];}; - args[0] = old; - args[1] = this; - return async.runInAsyncScope.apply(async, args); - }; - } - return cb; -} - -var ret = { - setReflectHandler: function(fn) { - reflectHandler = fn; - }, - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - asArray: asArray, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - isError: isError, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - isNode: isNode, - hasEnvVariables: hasEnvVariables, - env: env, - global: globalObject, - getNativePromise: getNativePromise, - contextBind: contextBind -}; -ret.isRecentNode = ret.isNode && (function() { - var version; - if (process.versions && process.versions.node) { - version = process.versions.node.split(".").map(Number); - } else if (process.version) { - version = process.version.split(".").map(Number); - } - return (version[0] === 0 && version[1] > 10) || (version[0] > 0); -})(); -ret.nodeSupportsAsyncResource = ret.isNode && (function() { - var supportsAsync = false; - try { - var res = require("async_hooks").AsyncResource; - supportsAsync = typeof res.prototype.runInAsyncScope === "function"; - } catch (e) { - supportsAsync = false; - } - return supportsAsync; -})(); - -if (ret.isNode) ret.toFastProperties(process); - -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; diff --git a/node_modules/bluebird/package.json b/node_modules/bluebird/package.json deleted file mode 100644 index b61a420f..00000000 --- a/node_modules/bluebird/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "_args": [ - [ - "bluebird@3.7.1", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "bluebird@3.7.1", - "_id": "bluebird@3.7.1", - "_inBundle": false, - "_integrity": "sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==", - "_location": "/bluebird", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "bluebird@3.7.1", - "name": "bluebird", - "escapedName": "bluebird", - "rawSpec": "3.7.1", - "saveSpec": null, - "fetchSpec": "3.7.1" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.1.tgz", - "_spec": "3.7.1", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Petka Antonov", - "email": "petka_antonov@hotmail.com", - "url": "http://github.com/petkaantonov/" - }, - "browser": "./js/browser/bluebird.js", - "bugs": { - "url": "http://github.com/petkaantonov/bluebird/issues" - }, - "description": "Full featured Promises/A+ implementation with exceptionally good performance", - "devDependencies": { - "acorn": "^6.0.2", - "acorn-walk": "^6.1.0", - "baconjs": "^0.7.43", - "bluebird": "^2.9.2", - "body-parser": "^1.10.2", - "browserify": "^8.1.1", - "cli-table": "~0.3.1", - "co": "^4.2.0", - "cross-spawn": "^0.2.3", - "glob": "^4.3.2", - "grunt-saucelabs": "~8.4.1", - "highland": "^2.3.0", - "istanbul": "^0.3.5", - "jshint": "^2.6.0", - "jshint-stylish": "~0.2.0", - "kefir": "^2.4.1", - "mkdirp": "~0.5.0", - "mocha": "~2.1", - "open": "~0.0.5", - "optimist": "~0.6.1", - "rimraf": "~2.2.6", - "rx": "^2.3.25", - "serve-static": "^1.7.1", - "sinon": "~1.7.3", - "uglify-js": "~2.4.16" - }, - "files": [ - "js/browser", - "js/release", - "LICENSE" - ], - "homepage": "https://github.com/petkaantonov/bluebird", - "keywords": [ - "promise", - "performance", - "promises", - "promises-a", - "promises-aplus", - "async", - "await", - "deferred", - "deferreds", - "future", - "flow control", - "dsl", - "fluent interface" - ], - "license": "MIT", - "main": "./js/release/bluebird.js", - "name": "bluebird", - "repository": { - "type": "git", - "url": "git://github.com/petkaantonov/bluebird.git" - }, - "scripts": { - "generate-browser-core": "node tools/build.js --features=core --no-debug --release --zalgo --browser --minify && mv js/browser/bluebird.js js/browser/bluebird.core.js && mv js/browser/bluebird.min.js js/browser/bluebird.core.min.js", - "generate-browser-full": "node tools/build.js --no-clean --no-debug --release --browser --minify", - "istanbul": "istanbul", - "lint": "node scripts/jshint.js", - "prepublish": "npm run generate-browser-core && npm run generate-browser-full", - "test": "node --expose-gc tools/test.js" - }, - "version": "3.7.1", - "webpack": "./js/release/bluebird.js" -} diff --git a/node_modules/buffer-equal-constant-time/.npmignore b/node_modules/buffer-equal-constant-time/.npmignore deleted file mode 100644 index 34e4f5c2..00000000 --- a/node_modules/buffer-equal-constant-time/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.*.sw[mnop] -node_modules/ diff --git a/node_modules/buffer-equal-constant-time/.travis.yml b/node_modules/buffer-equal-constant-time/.travis.yml deleted file mode 100644 index 78e1c014..00000000 --- a/node_modules/buffer-equal-constant-time/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: -- "0.11" -- "0.10" diff --git a/node_modules/buffer-equal-constant-time/LICENSE.txt b/node_modules/buffer-equal-constant-time/LICENSE.txt deleted file mode 100644 index 9a064f3f..00000000 --- a/node_modules/buffer-equal-constant-time/LICENSE.txt +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) 2013, GoInstant Inc., a salesforce.com company -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -* Neither the name of salesforce.com, nor GoInstant, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/buffer-equal-constant-time/README.md b/node_modules/buffer-equal-constant-time/README.md deleted file mode 100644 index 4f227f58..00000000 --- a/node_modules/buffer-equal-constant-time/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# buffer-equal-constant-time - -Constant-time `Buffer` comparison for node.js. Should work with browserify too. - -[![Build Status](https://travis-ci.org/goinstant/buffer-equal-constant-time.png?branch=master)](https://travis-ci.org/goinstant/buffer-equal-constant-time) - -```sh - npm install buffer-equal-constant-time -``` - -# Usage - -```js - var bufferEq = require('buffer-equal-constant-time'); - - var a = new Buffer('asdf'); - var b = new Buffer('asdf'); - if (bufferEq(a,b)) { - // the same! - } else { - // different in at least one byte! - } -``` - -If you'd like to install an `.equal()` method onto the node.js `Buffer` and -`SlowBuffer` prototypes: - -```js - require('buffer-equal-constant-time').install(); - - var a = new Buffer('asdf'); - var b = new Buffer('asdf'); - if (a.equal(b)) { - // the same! - } else { - // different in at least one byte! - } -``` - -To get rid of the installed `.equal()` method, call `.restore()`: - -```js - require('buffer-equal-constant-time').restore(); -``` - -# Legal - -© 2013 GoInstant Inc., a salesforce.com company - -Licensed under the BSD 3-clause license. diff --git a/node_modules/buffer-equal-constant-time/index.js b/node_modules/buffer-equal-constant-time/index.js deleted file mode 100644 index 5462c1f8..00000000 --- a/node_modules/buffer-equal-constant-time/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/*jshint node:true */ -'use strict'; -var Buffer = require('buffer').Buffer; // browserify -var SlowBuffer = require('buffer').SlowBuffer; - -module.exports = bufferEq; - -function bufferEq(a, b) { - - // shortcutting on type is necessary for correctness - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - return false; - } - - // buffer sizes should be well-known information, so despite this - // shortcutting, it doesn't leak any information about the *contents* of the - // buffers. - if (a.length !== b.length) { - return false; - } - - var c = 0; - for (var i = 0; i < a.length; i++) { - /*jshint bitwise:false */ - c |= a[i] ^ b[i]; // XOR - } - return c === 0; -} - -bufferEq.install = function() { - Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) { - return bufferEq(this, that); - }; -}; - -var origBufEqual = Buffer.prototype.equal; -var origSlowBufEqual = SlowBuffer.prototype.equal; -bufferEq.restore = function() { - Buffer.prototype.equal = origBufEqual; - SlowBuffer.prototype.equal = origSlowBufEqual; -}; diff --git a/node_modules/buffer-equal-constant-time/package.json b/node_modules/buffer-equal-constant-time/package.json deleted file mode 100644 index 1e6917dc..00000000 --- a/node_modules/buffer-equal-constant-time/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "_from": "buffer-equal-constant-time@1.0.1", - "_id": "buffer-equal-constant-time@1.0.1", - "_inBundle": false, - "_integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=", - "_location": "/buffer-equal-constant-time", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "buffer-equal-constant-time@1.0.1", - "name": "buffer-equal-constant-time", - "escapedName": "buffer-equal-constant-time", - "rawSpec": "1.0.1", - "saveSpec": null, - "fetchSpec": "1.0.1" - }, - "_requiredBy": [ - "/jwa" - ], - "_resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "_shasum": "f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819", - "_spec": "buffer-equal-constant-time@1.0.1", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/jwa", - "author": { - "name": "GoInstant Inc., a salesforce.com company" - }, - "bugs": { - "url": "https://github.com/goinstant/buffer-equal-constant-time/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Constant-time comparison of Buffers", - "devDependencies": { - "mocha": "~1.15.1" - }, - "homepage": "https://github.com/goinstant/buffer-equal-constant-time#readme", - "keywords": [ - "buffer", - "equal", - "constant-time", - "crypto" - ], - "license": "BSD-3-Clause", - "main": "index.js", - "name": "buffer-equal-constant-time", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/goinstant/buffer-equal-constant-time.git" - }, - "scripts": { - "test": "mocha test.js" - }, - "version": "1.0.1" -} diff --git a/node_modules/buffer-equal-constant-time/test.js b/node_modules/buffer-equal-constant-time/test.js deleted file mode 100644 index 0bc972d8..00000000 --- a/node_modules/buffer-equal-constant-time/test.js +++ /dev/null @@ -1,42 +0,0 @@ -/*jshint node:true */ -'use strict'; - -var bufferEq = require('./index'); -var assert = require('assert'); - -describe('buffer-equal-constant-time', function() { - var a = new Buffer('asdfasdf123456'); - var b = new Buffer('asdfasdf123456'); - var c = new Buffer('asdfasdf'); - - describe('bufferEq', function() { - it('says a == b', function() { - assert.strictEqual(bufferEq(a, b), true); - }); - - it('says a != c', function() { - assert.strictEqual(bufferEq(a, c), false); - }); - }); - - describe('install/restore', function() { - before(function() { - bufferEq.install(); - }); - after(function() { - bufferEq.restore(); - }); - - it('installed an .equal method', function() { - var SlowBuffer = require('buffer').SlowBuffer; - assert.ok(Buffer.prototype.equal); - assert.ok(SlowBuffer.prototype.equal); - }); - - it('infected existing Buffers', function() { - assert.strictEqual(a.equal(b), true); - assert.strictEqual(a.equal(c), false); - }); - }); - -}); diff --git a/node_modules/buffer-from/LICENSE b/node_modules/buffer-from/LICENSE deleted file mode 100644 index e4bf1d69..00000000 --- a/node_modules/buffer-from/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016, 2018 Linus Unnebäck - -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. diff --git a/node_modules/buffer-from/index.js b/node_modules/buffer-from/index.js deleted file mode 100644 index d92a83d0..00000000 --- a/node_modules/buffer-from/index.js +++ /dev/null @@ -1,69 +0,0 @@ -var toString = Object.prototype.toString - -var isModern = ( - typeof Buffer.alloc === 'function' && - typeof Buffer.allocUnsafe === 'function' && - typeof Buffer.from === 'function' -) - -function isArrayBuffer (input) { - return toString.call(input).slice(8, -1) === 'ArrayBuffer' -} - -function fromArrayBuffer (obj, byteOffset, length) { - byteOffset >>>= 0 - - var maxLength = obj.byteLength - byteOffset - - if (maxLength < 0) { - throw new RangeError("'offset' is out of bounds") - } - - if (length === undefined) { - length = maxLength - } else { - length >>>= 0 - - if (length > maxLength) { - throw new RangeError("'length' is out of bounds") - } - } - - return isModern - ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) - : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length))) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - return isModern - ? Buffer.from(string, encoding) - : new Buffer(string, encoding) -} - -function bufferFrom (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (isArrayBuffer(value)) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - return isModern - ? Buffer.from(value) - : new Buffer(value) -} - -module.exports = bufferFrom diff --git a/node_modules/buffer-from/package.json b/node_modules/buffer-from/package.json deleted file mode 100644 index 3f0a4c00..00000000 --- a/node_modules/buffer-from/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_from": "buffer-from@^1.0.0", - "_id": "buffer-from@1.1.1", - "_inBundle": false, - "_integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "_location": "/buffer-from", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "buffer-from@^1.0.0", - "name": "buffer-from", - "escapedName": "buffer-from", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/concat-stream" - ], - "_resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "_shasum": "32713bc028f75c02fdb710d7c7bcec1f2c6070ef", - "_spec": "buffer-from@^1.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/concat-stream", - "bugs": { - "url": "https://github.com/LinusU/buffer-from/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available.", - "devDependencies": { - "standard": "^7.1.2" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/LinusU/buffer-from#readme", - "keywords": [ - "buffer", - "buffer from" - ], - "license": "MIT", - "name": "buffer-from", - "repository": { - "type": "git", - "url": "git+https://github.com/LinusU/buffer-from.git" - }, - "scripts": { - "test": "standard && node test" - }, - "version": "1.1.1" -} diff --git a/node_modules/buffer-from/readme.md b/node_modules/buffer-from/readme.md deleted file mode 100644 index 9880a558..00000000 --- a/node_modules/buffer-from/readme.md +++ /dev/null @@ -1,69 +0,0 @@ -# Buffer From - -A [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available. - -## Installation - -```sh -npm install --save buffer-from -``` - -## Usage - -```js -const bufferFrom = require('buffer-from') - -console.log(bufferFrom([1, 2, 3, 4])) -//=> - -const arr = new Uint8Array([1, 2, 3, 4]) -console.log(bufferFrom(arr.buffer, 1, 2)) -//=> - -console.log(bufferFrom('test', 'utf8')) -//=> - -const buf = bufferFrom('test') -console.log(bufferFrom(buf)) -//=> -``` - -## API - -### bufferFrom(array) - -- `array` <Array> - -Allocates a new `Buffer` using an `array` of octets. - -### bufferFrom(arrayBuffer[, byteOffset[, length]]) - -- `arrayBuffer` <ArrayBuffer> The `.buffer` property of a TypedArray or ArrayBuffer -- `byteOffset` <Integer> Where to start copying from `arrayBuffer`. **Default:** `0` -- `length` <Integer> How many bytes to copy from `arrayBuffer`. **Default:** `arrayBuffer.length - byteOffset` - -When passed a reference to the `.buffer` property of a TypedArray instance, the -newly created `Buffer` will share the same allocated memory as the TypedArray. - -The optional `byteOffset` and `length` arguments specify a memory range within -the `arrayBuffer` that will be shared by the `Buffer`. - -### bufferFrom(buffer) - -- `buffer` <Buffer> An existing `Buffer` to copy data from - -Copies the passed `buffer` data onto a new `Buffer` instance. - -### bufferFrom(string[, encoding]) - -- `string` <String> A string to encode. -- `encoding` <String> The encoding of `string`. **Default:** `'utf8'` - -Creates a new `Buffer` containing the given JavaScript string `string`. If -provided, the `encoding` parameter identifies the character encoding of -`string`. - -## See also - -- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc` -- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe` diff --git a/node_modules/combined-stream/License b/node_modules/combined-stream/License deleted file mode 100644 index 4804b7ab..00000000 --- a/node_modules/combined-stream/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Debuggable Limited - -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. diff --git a/node_modules/combined-stream/Readme.md b/node_modules/combined-stream/Readme.md deleted file mode 100644 index 9e367b5b..00000000 --- a/node_modules/combined-stream/Readme.md +++ /dev/null @@ -1,138 +0,0 @@ -# combined-stream - -A stream that emits multiple other streams one after another. - -**NB** Currently `combined-stream` works with streams version 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatibility with `combined-stream`. - -- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. - -- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. - -## Installation - -``` bash -npm install combined-stream -``` - -## Usage - -Here is a simple example that shows how you can use combined-stream to combine -two files into one: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create(); -combinedStream.append(fs.createReadStream('file1.txt')); -combinedStream.append(fs.createReadStream('file2.txt')); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -While the example above works great, it will pause all source streams until -they are needed. If you don't want that to happen, you can set `pauseStreams` -to `false`: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create({pauseStreams: false}); -combinedStream.append(fs.createReadStream('file1.txt')); -combinedStream.append(fs.createReadStream('file2.txt')); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -However, what if you don't have all the source streams yet, or you don't want -to allocate the resources (file descriptors, memory, etc.) for them right away? -Well, in that case you can simply provide a callback that supplies the stream -by calling a `next()` function: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create(); -combinedStream.append(function(next) { - next(fs.createReadStream('file1.txt')); -}); -combinedStream.append(function(next) { - next(fs.createReadStream('file2.txt')); -}); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -## API - -### CombinedStream.create([options]) - -Returns a new combined stream object. Available options are: - -* `maxDataSize` -* `pauseStreams` - -The effect of those options is described below. - -### combinedStream.pauseStreams = `true` - -Whether to apply back pressure to the underlaying streams. If set to `false`, -the underlaying streams will never be paused. If set to `true`, the -underlaying streams will be paused right after being appended, as well as when -`delayedStream.pipe()` wants to throttle. - -### combinedStream.maxDataSize = `2 * 1024 * 1024` - -The maximum amount of bytes (or characters) to buffer for all source streams. -If this value is exceeded, `combinedStream` emits an `'error'` event. - -### combinedStream.dataSize = `0` - -The amount of bytes (or characters) currently buffered by `combinedStream`. - -### combinedStream.append(stream) - -Appends the given `stream` to the combinedStream object. If `pauseStreams` is -set to `true, this stream will also be paused right away. - -`streams` can also be a function that takes one parameter called `next`. `next` -is a function that must be invoked in order to provide the `next` stream, see -example above. - -Regardless of how the `stream` is appended, combined-stream always attaches an -`'error'` listener to it, so you don't have to do that manually. - -Special case: `stream` can also be a String or Buffer. - -### combinedStream.write(data) - -You should not call this, `combinedStream` takes care of piping the appended -streams into itself for you. - -### combinedStream.resume() - -Causes `combinedStream` to start drain the streams it manages. The function is -idempotent, and also emits a `'resume'` event each time which usually goes to -the stream that is currently being drained. - -### combinedStream.pause(); - -If `combinedStream.pauseStreams` is set to `false`, this does nothing. -Otherwise a `'pause'` event is emitted, this goes to the stream that is -currently being drained, so you can use it to apply back pressure. - -### combinedStream.end(); - -Sets `combinedStream.writable` to false, emits an `'end'` event, and removes -all streams from the queue. - -### combinedStream.destroy(); - -Same as `combinedStream.end()`, except it emits a `'close'` event instead of -`'end'`. - -## License - -combined-stream is licensed under the MIT license. diff --git a/node_modules/combined-stream/lib/combined_stream.js b/node_modules/combined-stream/lib/combined_stream.js deleted file mode 100644 index 125f097f..00000000 --- a/node_modules/combined-stream/lib/combined_stream.js +++ /dev/null @@ -1,208 +0,0 @@ -var util = require('util'); -var Stream = require('stream').Stream; -var DelayedStream = require('delayed-stream'); - -module.exports = CombinedStream; -function CombinedStream() { - this.writable = false; - this.readable = true; - this.dataSize = 0; - this.maxDataSize = 2 * 1024 * 1024; - this.pauseStreams = true; - - this._released = false; - this._streams = []; - this._currentStream = null; - this._insideLoop = false; - this._pendingNext = false; -} -util.inherits(CombinedStream, Stream); - -CombinedStream.create = function(options) { - var combinedStream = new this(); - - options = options || {}; - for (var option in options) { - combinedStream[option] = options[option]; - } - - return combinedStream; -}; - -CombinedStream.isStreamLike = function(stream) { - return (typeof stream !== 'function') - && (typeof stream !== 'string') - && (typeof stream !== 'boolean') - && (typeof stream !== 'number') - && (!Buffer.isBuffer(stream)); -}; - -CombinedStream.prototype.append = function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); - - if (isStreamLike) { - if (!(stream instanceof DelayedStream)) { - var newStream = DelayedStream.create(stream, { - maxDataSize: Infinity, - pauseStream: this.pauseStreams, - }); - stream.on('data', this._checkDataSize.bind(this)); - stream = newStream; - } - - this._handleErrors(stream); - - if (this.pauseStreams) { - stream.pause(); - } - } - - this._streams.push(stream); - return this; -}; - -CombinedStream.prototype.pipe = function(dest, options) { - Stream.prototype.pipe.call(this, dest, options); - this.resume(); - return dest; -}; - -CombinedStream.prototype._getNext = function() { - this._currentStream = null; - - if (this._insideLoop) { - this._pendingNext = true; - return; // defer call - } - - this._insideLoop = true; - try { - do { - this._pendingNext = false; - this._realGetNext(); - } while (this._pendingNext); - } finally { - this._insideLoop = false; - } -}; - -CombinedStream.prototype._realGetNext = function() { - var stream = this._streams.shift(); - - - if (typeof stream == 'undefined') { - this.end(); - return; - } - - if (typeof stream !== 'function') { - this._pipeNext(stream); - return; - } - - var getStream = stream; - getStream(function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('data', this._checkDataSize.bind(this)); - this._handleErrors(stream); - } - - this._pipeNext(stream); - }.bind(this)); -}; - -CombinedStream.prototype._pipeNext = function(stream) { - this._currentStream = stream; - - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('end', this._getNext.bind(this)); - stream.pipe(this, {end: false}); - return; - } - - var value = stream; - this.write(value); - this._getNext(); -}; - -CombinedStream.prototype._handleErrors = function(stream) { - var self = this; - stream.on('error', function(err) { - self._emitError(err); - }); -}; - -CombinedStream.prototype.write = function(data) { - this.emit('data', data); -}; - -CombinedStream.prototype.pause = function() { - if (!this.pauseStreams) { - return; - } - - if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); - this.emit('pause'); -}; - -CombinedStream.prototype.resume = function() { - if (!this._released) { - this._released = true; - this.writable = true; - this._getNext(); - } - - if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); - this.emit('resume'); -}; - -CombinedStream.prototype.end = function() { - this._reset(); - this.emit('end'); -}; - -CombinedStream.prototype.destroy = function() { - this._reset(); - this.emit('close'); -}; - -CombinedStream.prototype._reset = function() { - this.writable = false; - this._streams = []; - this._currentStream = null; -}; - -CombinedStream.prototype._checkDataSize = function() { - this._updateDataSize(); - if (this.dataSize <= this.maxDataSize) { - return; - } - - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; - this._emitError(new Error(message)); -}; - -CombinedStream.prototype._updateDataSize = function() { - this.dataSize = 0; - - var self = this; - this._streams.forEach(function(stream) { - if (!stream.dataSize) { - return; - } - - self.dataSize += stream.dataSize; - }); - - if (this._currentStream && this._currentStream.dataSize) { - this.dataSize += this._currentStream.dataSize; - } -}; - -CombinedStream.prototype._emitError = function(err) { - this._reset(); - this.emit('error', err); -}; diff --git a/node_modules/combined-stream/package.json b/node_modules/combined-stream/package.json deleted file mode 100644 index 8e84eda1..00000000 --- a/node_modules/combined-stream/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "_from": "combined-stream@^1.0.8", - "_id": "combined-stream@1.0.8", - "_inBundle": false, - "_integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "_location": "/combined-stream", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "combined-stream@^1.0.8", - "name": "combined-stream", - "escapedName": "combined-stream", - "rawSpec": "^1.0.8", - "saveSpec": null, - "fetchSpec": "^1.0.8" - }, - "_requiredBy": [ - "/form-data" - ], - "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "_shasum": "c3d45a8b34fd730631a110a8a2520682b31d5a7f", - "_spec": "combined-stream@^1.0.8", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/form-data", - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "bugs": { - "url": "https://github.com/felixge/node-combined-stream/issues" - }, - "bundleDependencies": false, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "deprecated": false, - "description": "A stream that emits multiple other streams one after another.", - "devDependencies": { - "far": "~0.0.7" - }, - "engines": { - "node": ">= 0.8" - }, - "homepage": "https://github.com/felixge/node-combined-stream", - "license": "MIT", - "main": "./lib/combined_stream", - "name": "combined-stream", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-combined-stream.git" - }, - "scripts": { - "test": "node test/run.js" - }, - "version": "1.0.8" -} diff --git a/node_modules/combined-stream/yarn.lock b/node_modules/combined-stream/yarn.lock deleted file mode 100644 index 7edf4184..00000000 --- a/node_modules/combined-stream/yarn.lock +++ /dev/null @@ -1,17 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - -far@~0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/far/-/far-0.0.7.tgz#01c1fd362bcd26ce9cf161af3938aa34619f79a7" - dependencies: - oop "0.0.3" - -oop@0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/oop/-/oop-0.0.3.tgz#70fa405a5650891a194fdc82ca68dad6dabf4401" diff --git a/node_modules/concat-stream/LICENSE b/node_modules/concat-stream/LICENSE deleted file mode 100644 index 99c130e1..00000000 --- a/node_modules/concat-stream/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2013 Max Ogden - -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. \ No newline at end of file diff --git a/node_modules/concat-stream/index.js b/node_modules/concat-stream/index.js deleted file mode 100644 index dd672a76..00000000 --- a/node_modules/concat-stream/index.js +++ /dev/null @@ -1,144 +0,0 @@ -var Writable = require('readable-stream').Writable -var inherits = require('inherits') -var bufferFrom = require('buffer-from') - -if (typeof Uint8Array === 'undefined') { - var U8 = require('typedarray').Uint8Array -} else { - var U8 = Uint8Array -} - -function ConcatStream(opts, cb) { - if (!(this instanceof ConcatStream)) return new ConcatStream(opts, cb) - - if (typeof opts === 'function') { - cb = opts - opts = {} - } - if (!opts) opts = {} - - var encoding = opts.encoding - var shouldInferEncoding = false - - if (!encoding) { - shouldInferEncoding = true - } else { - encoding = String(encoding).toLowerCase() - if (encoding === 'u8' || encoding === 'uint8') { - encoding = 'uint8array' - } - } - - Writable.call(this, { objectMode: true }) - - this.encoding = encoding - this.shouldInferEncoding = shouldInferEncoding - - if (cb) this.on('finish', function () { cb(this.getBody()) }) - this.body = [] -} - -module.exports = ConcatStream -inherits(ConcatStream, Writable) - -ConcatStream.prototype._write = function(chunk, enc, next) { - this.body.push(chunk) - next() -} - -ConcatStream.prototype.inferEncoding = function (buff) { - var firstBuffer = buff === undefined ? this.body[0] : buff; - if (Buffer.isBuffer(firstBuffer)) return 'buffer' - if (typeof Uint8Array !== 'undefined' && firstBuffer instanceof Uint8Array) return 'uint8array' - if (Array.isArray(firstBuffer)) return 'array' - if (typeof firstBuffer === 'string') return 'string' - if (Object.prototype.toString.call(firstBuffer) === "[object Object]") return 'object' - return 'buffer' -} - -ConcatStream.prototype.getBody = function () { - if (!this.encoding && this.body.length === 0) return [] - if (this.shouldInferEncoding) this.encoding = this.inferEncoding() - if (this.encoding === 'array') return arrayConcat(this.body) - if (this.encoding === 'string') return stringConcat(this.body) - if (this.encoding === 'buffer') return bufferConcat(this.body) - if (this.encoding === 'uint8array') return u8Concat(this.body) - return this.body -} - -var isArray = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]' -} - -function isArrayish (arr) { - return /Array\]$/.test(Object.prototype.toString.call(arr)) -} - -function isBufferish (p) { - return typeof p === 'string' || isArrayish(p) || (p && typeof p.subarray === 'function') -} - -function stringConcat (parts) { - var strings = [] - var needsToString = false - for (var i = 0; i < parts.length; i++) { - var p = parts[i] - if (typeof p === 'string') { - strings.push(p) - } else if (Buffer.isBuffer(p)) { - strings.push(p) - } else if (isBufferish(p)) { - strings.push(bufferFrom(p)) - } else { - strings.push(bufferFrom(String(p))) - } - } - if (Buffer.isBuffer(parts[0])) { - strings = Buffer.concat(strings) - strings = strings.toString('utf8') - } else { - strings = strings.join('') - } - return strings -} - -function bufferConcat (parts) { - var bufs = [] - for (var i = 0; i < parts.length; i++) { - var p = parts[i] - if (Buffer.isBuffer(p)) { - bufs.push(p) - } else if (isBufferish(p)) { - bufs.push(bufferFrom(p)) - } else { - bufs.push(bufferFrom(String(p))) - } - } - return Buffer.concat(bufs) -} - -function arrayConcat (parts) { - var res = [] - for (var i = 0; i < parts.length; i++) { - res.push.apply(res, parts[i]) - } - return res -} - -function u8Concat (parts) { - var len = 0 - for (var i = 0; i < parts.length; i++) { - if (typeof parts[i] === 'string') { - parts[i] = bufferFrom(parts[i]) - } - len += parts[i].length - } - var u8 = new U8(len) - for (var i = 0, offset = 0; i < parts.length; i++) { - var part = parts[i] - for (var j = 0; j < part.length; j++) { - u8[offset++] = part[j] - } - } - return u8 -} diff --git a/node_modules/concat-stream/package.json b/node_modules/concat-stream/package.json deleted file mode 100644 index 82bb7bb8..00000000 --- a/node_modules/concat-stream/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "_from": "concat-stream@^2.0.0", - "_id": "concat-stream@2.0.0", - "_inBundle": false, - "_integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", - "_location": "/concat-stream", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "concat-stream@^2.0.0", - "name": "concat-stream", - "escapedName": "concat-stream", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", - "_shasum": "414cf5af790a48c60ab9be4527d56d5e41133cb1", - "_spec": "concat-stream@^2.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "Max Ogden", - "email": "max@maxogden.com" - }, - "bugs": { - "url": "http://github.com/maxogden/concat-stream/issues" - }, - "bundleDependencies": false, - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - }, - "deprecated": false, - "description": "writable stream that concatenates strings or binary data and calls a callback with the result", - "devDependencies": { - "tape": "^4.6.3" - }, - "engines": [ - "node >= 6.0" - ], - "files": [ - "index.js" - ], - "homepage": "https://github.com/maxogden/concat-stream#readme", - "license": "MIT", - "main": "index.js", - "name": "concat-stream", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/maxogden/concat-stream.git" - }, - "scripts": { - "test": "tape test/*.js test/server/*.js" - }, - "tags": [ - "stream", - "simple", - "util", - "utility" - ], - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/17..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "2.0.0" -} diff --git a/node_modules/concat-stream/readme.md b/node_modules/concat-stream/readme.md deleted file mode 100644 index 7aa19c4f..00000000 --- a/node_modules/concat-stream/readme.md +++ /dev/null @@ -1,102 +0,0 @@ -# concat-stream - -Writable stream that concatenates all the data from a stream and calls a callback with the result. Use this when you want to collect all the data from a stream into a single buffer. - -[![Build Status](https://travis-ci.org/maxogden/concat-stream.svg?branch=master)](https://travis-ci.org/maxogden/concat-stream) - -[![NPM](https://nodei.co/npm/concat-stream.png)](https://nodei.co/npm/concat-stream/) - -### description - -Streams emit many buffers. If you want to collect all of the buffers, and when the stream ends concatenate all of the buffers together and receive a single buffer then this is the module for you. - -Only use this if you know you can fit all of the output of your stream into a single Buffer (e.g. in RAM). - -There are also `objectMode` streams that emit things other than Buffers, and you can concatenate these too. See below for details. - -## Related - -`concat-stream` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one. - -### examples - -#### Buffers - -```js -var fs = require('fs') -var concat = require('concat-stream') - -var readStream = fs.createReadStream('cat.png') -var concatStream = concat(gotPicture) - -readStream.on('error', handleError) -readStream.pipe(concatStream) - -function gotPicture(imageBuffer) { - // imageBuffer is all of `cat.png` as a node.js Buffer -} - -function handleError(err) { - // handle your error appropriately here, e.g.: - console.error(err) // print the error to STDERR - process.exit(1) // exit program with non-zero exit code -} - -``` - -#### Arrays - -```js -var write = concat(function(data) {}) -write.write([1,2,3]) -write.write([4,5,6]) -write.end() -// data will be [1,2,3,4,5,6] in the above callback -``` - -#### Uint8Arrays - -```js -var write = concat(function(data) {}) -var a = new Uint8Array(3) -a[0] = 97; a[1] = 98; a[2] = 99 -write.write(a) -write.write('!') -write.end(Buffer.from('!!1')) -``` - -See `test/` for more examples - -# methods - -```js -var concat = require('concat-stream') -``` - -## var writable = concat(opts={}, cb) - -Return a `writable` stream that will fire `cb(data)` with all of the data that -was written to the stream. Data can be written to `writable` as strings, -Buffers, arrays of byte integers, and Uint8Arrays. - -By default `concat-stream` will give you back the same data type as the type of the first buffer written to the stream. Use `opts.encoding` to set what format `data` should be returned as, e.g. if you if you don't want to rely on the built-in type checking or for some other reason. - -* `string` - get a string -* `buffer` - get back a Buffer -* `array` - get an array of byte integers -* `uint8array`, `u8`, `uint8` - get back a Uint8Array -* `object`, get back an array of Objects - -If you don't specify an encoding, and the types can't be inferred (e.g. you write things that aren't in the list above), it will try to convert concat them into a `Buffer`. - -If nothing is written to `writable` then `data` will be an empty array `[]`. - -# error handling - -`concat-stream` does not handle errors for you, so you must handle errors on whatever streams you pipe into `concat-stream`. This is a general rule when programming with node.js streams: always handle errors on each and every stream. Since `concat-stream` is not itself a stream it does not emit errors. - -We recommend using [`end-of-stream`](https://npmjs.org/end-of-stream) or [`pump`](https://npmjs.org/pump) for writing error tolerant stream code. - -# license - -MIT LICENSE diff --git a/node_modules/cross-fetch/LICENSE b/node_modules/cross-fetch/LICENSE deleted file mode 100644 index 9198b86f..00000000 --- a/node_modules/cross-fetch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Leonardo Quixadá - -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. diff --git a/node_modules/cross-fetch/README.md b/node_modules/cross-fetch/README.md deleted file mode 100644 index eed3f993..00000000 --- a/node_modules/cross-fetch/README.md +++ /dev/null @@ -1,183 +0,0 @@ -cross-fetch
-[![NPM Version](https://img.shields.io/npm/v/cross-fetch.svg?branch=master)](https://www.npmjs.com/package/cross-fetch) -[![Downloads Per Week](https://img.shields.io/npm/dw/cross-fetch.svg?color=blue)](https://www.npmjs.com/package/cross-fetch) -[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) -[![dependencies Status](https://david-dm.org/lquixada/cross-fetch/status.svg)](https://david-dm.org/lquixada/cross-fetch) -[![Build Status](https://circleci.com/gh/lquixada/cross-fetch.svg?style=shield)](https://circleci.com/gh/lquixada/cross-fetch) -[![codecov](https://codecov.io/gh/lquixada/cross-fetch/branch/master/graph/badge.svg)](https://codecov.io/gh/lquixada/cross-fetch) -================ - -Universal WHATWG Fetch API for Node, Browsers and React Native. The scenario that cross-fetch really shines is when the same JavaScript codebase needs to run on different platforms. - -- **Platform agnostic**: browsers, Node or React Native -- **Optional polyfill**: it's up to you if something is going to be added to the global object or not -- **Simple interface**: no instantiation, no configuration and no extra dependency -- **WHATWG compliant**: it works the same way wherever your code runs -- **Updated**: latest version of [whatwg-fetch](https://github.com/github/fetch/) and [node-fetch](https://github.com/bitinn/node-fetch/) used - - -* * * - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Demo & API](#demo--api) -- [FAQ](#faq) -- [Supported environments](#supported-environments) -- [Thanks](#thanks) -- [License](#license) -- [Author](#author) - -* * * - -## Install - -```sh -npm install --save cross-fetch -``` - -As a [ponyfill](https://github.com/sindresorhus/ponyfill): - -```javascript -// Using ES6 modules with Babel or TypeScript -import fetch from 'cross-fetch'; - -// Using CommonJS modules -const fetch = require('cross-fetch'); -``` - -As a polyfill: - -```javascript -// Using ES6 modules -import 'cross-fetch/polyfill'; - -// Using CommonJS modules -require('cross-fetch/polyfill'); -``` - - -The CDN build is also available on unpkg: - -```html - -``` - -This adds the fetch function to the window object. Note that this is not UMD compatible. - - -* * * - -## Usage - -With [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise): - -```javascript -import fetch from 'cross-fetch'; -// Or just: import 'cross-fetch/polyfill'; - -fetch('//api.github.com/users/lquixada') - .then(res => { - if (res.status >= 400) { - throw new Error("Bad response from server"); - } - return res.json(); - }) - .then(user => { - console.log(user); - }) - .catch(err => { - console.error(err); - }); -``` - -With [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function): - -```javascript -import fetch from 'cross-fetch'; -// Or just: import 'cross-fetch/polyfill'; - -(async () => { - try { - const res = await fetch('//api.github.com/users/lquixada'); - - if (res.status >= 400) { - throw new Error("Bad response from server"); - } - - const user = await res.json(); - - console.log(user); - } catch (err) { - console.error(err); - } -})(); -``` - -> ⚠️ **Warning**: If you're in an environment that doesn't support Promises such as Internet Explorer, you must install an ES6 Promise compatible polyfill. [es6-promise](https://github.com/jakearchibald/es6-promise) is suggested. - - -## Demo & API - -You can find a comprehensive doc at [Github's fetch](https://github.github.io/fetch/) page. If you want to play with cross-fetch, these resources can be useful: - -* [**JSFiddle playground**](https://jsfiddle.net/lquixada/3ypqgacp/) ➡️ -* [**Public test suite**](https://lquixada.github.io/cross-fetch/test/browser/saucelabs/) ➡️ - -> **Tip**: Run theses resources on various browsers and with different settings (for instance: cross-domain requests, wrong urls or text requests). Don't forget to open the console in the test suite page and play around. - - -## FAQ - -#### Yet another fetch library? - -I did a lot of research in order to find a fetch library that could be simple, cross-platform and provide polyfill as an option. There's a plethora of libs out there but none could match those requirements. - - -#### Why not isomorphic-fetch? - -My preferred library used to be [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) but it has this [bug](https://github.com/matthew-andrews/isomorphic-fetch/issues/125) that prevents it from running in a react native environment. It seems unlikely to be fixed since there haven't been any new commits to it since 2016. That means dependencies are outdated as well. - - -#### Why polyfill might not be a good idea? - -In a word? Risk. If the spec changes in the future, it might be problematic to debug. Read more about it on [sindresorhus's ponyfill](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills) page. It's up to you if you're fine with it or not. - - -#### How does cross-fetch work? - -Just like isomorphic-fetch, it is just a proxy. If you're in node, it delivers you the [node-fetch](https://github.com/bitinn/node-fetch/) library, if you're in a browser or React Native, it delivers you the github's [whatwg-fetch](https://github.com/github/fetch/). The same strategy applies whether you're using polyfill or ponyfill. - - -## Who's Using It? - -|[![The New York Times](./docs/images/logo-nytimes.png)](https://www.nytimes.com/)|[![Swagger](./docs/images/logo-swagger.png)](https://swagger.io/)|[![VulcanJS](./docs/images/logo-vulcanjs.png)](http://vulcanjs.org)|[![graphql-request](./docs/images/logo-graphql-request.png)](https://github.com/prisma/graphql-request)| -|:---:|:---:|:---:|:---:| -|The New York Times|Swagger|VulcanJS|graphql-request| - - -## Supported environments - -* Node 10+ -* React-Native -* Browsers: - -[![Build Status](https://saucelabs.com/browser-matrix/cross-fetch.svg)](https://saucelabs.com/u/cross-fetch) - - -## Thanks - -Heavily inspired by the works of [matthew-andrews](https://github.com/matthew-andrews). Kudos to him! - - -## License - -cross-fetch is licensed under the [MIT license](https://github.com/lquixada/cross-fetch/blob/master/LICENSE) © [Leonardo Quixadá](https://twitter.com/lquixada/) - - -## Author - -|[![@lquixada](https://avatars0.githubusercontent.com/u/195494?v=4&s=96)](https://github.com/lquixada)| -|:---:| -|[@lquixada](http://www.github.com/lquixada)| diff --git a/node_modules/cross-fetch/dist/browser-polyfill.js b/node_modules/cross-fetch/dist/browser-polyfill.js deleted file mode 100644 index b73e83ae..00000000 --- a/node_modules/cross-fetch/dist/browser-polyfill.js +++ /dev/null @@ -1,530 +0,0 @@ -(function(self) { - -var irrelevant = (function (exports) { - - var support = { - searchParams: 'URLSearchParams' in self, - iterable: 'Symbol' in self && 'iterator' in Symbol, - blob: - 'FileReader' in self && - 'Blob' in self && - (function() { - try { - new Blob(); - return true - } catch (e) { - return false - } - })(), - formData: 'FormData' in self, - arrayBuffer: 'ArrayBuffer' in self - }; - - function isDataView(obj) { - return obj && DataView.prototype.isPrototypeOf(obj) - } - - if (support.arrayBuffer) { - var viewClasses = [ - '[object Int8Array]', - '[object Uint8Array]', - '[object Uint8ClampedArray]', - '[object Int16Array]', - '[object Uint16Array]', - '[object Int32Array]', - '[object Uint32Array]', - '[object Float32Array]', - '[object Float64Array]' - ]; - - var isArrayBufferView = - ArrayBuffer.isView || - function(obj) { - return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 - }; - } - - function normalizeName(name) { - if (typeof name !== 'string') { - name = String(name); - } - if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { - throw new TypeError('Invalid character in header field name') - } - return name.toLowerCase() - } - - function normalizeValue(value) { - if (typeof value !== 'string') { - value = String(value); - } - return value - } - - // Build a destructive iterator for the value list - function iteratorFor(items) { - var iterator = { - next: function() { - var value = items.shift(); - return {done: value === undefined, value: value} - } - }; - - if (support.iterable) { - iterator[Symbol.iterator] = function() { - return iterator - }; - } - - return iterator - } - - function Headers(headers) { - this.map = {}; - - if (headers instanceof Headers) { - headers.forEach(function(value, name) { - this.append(name, value); - }, this); - } else if (Array.isArray(headers)) { - headers.forEach(function(header) { - this.append(header[0], header[1]); - }, this); - } else if (headers) { - Object.getOwnPropertyNames(headers).forEach(function(name) { - this.append(name, headers[name]); - }, this); - } - } - - Headers.prototype.append = function(name, value) { - name = normalizeName(name); - value = normalizeValue(value); - var oldValue = this.map[name]; - this.map[name] = oldValue ? oldValue + ', ' + value : value; - }; - - Headers.prototype['delete'] = function(name) { - delete this.map[normalizeName(name)]; - }; - - Headers.prototype.get = function(name) { - name = normalizeName(name); - return this.has(name) ? this.map[name] : null - }; - - Headers.prototype.has = function(name) { - return this.map.hasOwnProperty(normalizeName(name)) - }; - - Headers.prototype.set = function(name, value) { - this.map[normalizeName(name)] = normalizeValue(value); - }; - - Headers.prototype.forEach = function(callback, thisArg) { - for (var name in this.map) { - if (this.map.hasOwnProperty(name)) { - callback.call(thisArg, this.map[name], name, this); - } - } - }; - - Headers.prototype.keys = function() { - var items = []; - this.forEach(function(value, name) { - items.push(name); - }); - return iteratorFor(items) - }; - - Headers.prototype.values = function() { - var items = []; - this.forEach(function(value) { - items.push(value); - }); - return iteratorFor(items) - }; - - Headers.prototype.entries = function() { - var items = []; - this.forEach(function(value, name) { - items.push([name, value]); - }); - return iteratorFor(items) - }; - - if (support.iterable) { - Headers.prototype[Symbol.iterator] = Headers.prototype.entries; - } - - function consumed(body) { - if (body.bodyUsed) { - return Promise.reject(new TypeError('Already read')) - } - body.bodyUsed = true; - } - - function fileReaderReady(reader) { - return new Promise(function(resolve, reject) { - reader.onload = function() { - resolve(reader.result); - }; - reader.onerror = function() { - reject(reader.error); - }; - }) - } - - function readBlobAsArrayBuffer(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsArrayBuffer(blob); - return promise - } - - function readBlobAsText(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsText(blob); - return promise - } - - function readArrayBufferAsText(buf) { - var view = new Uint8Array(buf); - var chars = new Array(view.length); - - for (var i = 0; i < view.length; i++) { - chars[i] = String.fromCharCode(view[i]); - } - return chars.join('') - } - - function bufferClone(buf) { - if (buf.slice) { - return buf.slice(0) - } else { - var view = new Uint8Array(buf.byteLength); - view.set(new Uint8Array(buf)); - return view.buffer - } - } - - function Body() { - this.bodyUsed = false; - - this._initBody = function(body) { - this._bodyInit = body; - if (!body) { - this._bodyText = ''; - } else if (typeof body === 'string') { - this._bodyText = body; - } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { - this._bodyBlob = body; - } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { - this._bodyFormData = body; - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this._bodyText = body.toString(); - } else if (support.arrayBuffer && support.blob && isDataView(body)) { - this._bodyArrayBuffer = bufferClone(body.buffer); - // IE 10-11 can't handle a DataView body. - this._bodyInit = new Blob([this._bodyArrayBuffer]); - } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { - this._bodyArrayBuffer = bufferClone(body); - } else { - this._bodyText = body = Object.prototype.toString.call(body); - } - - if (!this.headers.get('content-type')) { - if (typeof body === 'string') { - this.headers.set('content-type', 'text/plain;charset=UTF-8'); - } else if (this._bodyBlob && this._bodyBlob.type) { - this.headers.set('content-type', this._bodyBlob.type); - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); - } - } - }; - - if (support.blob) { - this.blob = function() { - var rejected = consumed(this); - if (rejected) { - return rejected - } - - if (this._bodyBlob) { - return Promise.resolve(this._bodyBlob) - } else if (this._bodyArrayBuffer) { - return Promise.resolve(new Blob([this._bodyArrayBuffer])) - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as blob') - } else { - return Promise.resolve(new Blob([this._bodyText])) - } - }; - - this.arrayBuffer = function() { - if (this._bodyArrayBuffer) { - return consumed(this) || Promise.resolve(this._bodyArrayBuffer) - } else { - return this.blob().then(readBlobAsArrayBuffer) - } - }; - } - - this.text = function() { - var rejected = consumed(this); - if (rejected) { - return rejected - } - - if (this._bodyBlob) { - return readBlobAsText(this._bodyBlob) - } else if (this._bodyArrayBuffer) { - return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as text') - } else { - return Promise.resolve(this._bodyText) - } - }; - - if (support.formData) { - this.formData = function() { - return this.text().then(decode) - }; - } - - this.json = function() { - return this.text().then(JSON.parse) - }; - - return this - } - - // HTTP methods whose capitalization should be normalized - var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; - - function normalizeMethod(method) { - var upcased = method.toUpperCase(); - return methods.indexOf(upcased) > -1 ? upcased : method - } - - function Request(input, options) { - options = options || {}; - var body = options.body; - - if (input instanceof Request) { - if (input.bodyUsed) { - throw new TypeError('Already read') - } - this.url = input.url; - this.credentials = input.credentials; - if (!options.headers) { - this.headers = new Headers(input.headers); - } - this.method = input.method; - this.mode = input.mode; - this.signal = input.signal; - if (!body && input._bodyInit != null) { - body = input._bodyInit; - input.bodyUsed = true; - } - } else { - this.url = String(input); - } - - this.credentials = options.credentials || this.credentials || 'same-origin'; - if (options.headers || !this.headers) { - this.headers = new Headers(options.headers); - } - this.method = normalizeMethod(options.method || this.method || 'GET'); - this.mode = options.mode || this.mode || null; - this.signal = options.signal || this.signal; - this.referrer = null; - - if ((this.method === 'GET' || this.method === 'HEAD') && body) { - throw new TypeError('Body not allowed for GET or HEAD requests') - } - this._initBody(body); - } - - Request.prototype.clone = function() { - return new Request(this, {body: this._bodyInit}) - }; - - function decode(body) { - var form = new FormData(); - body - .trim() - .split('&') - .forEach(function(bytes) { - if (bytes) { - var split = bytes.split('='); - var name = split.shift().replace(/\+/g, ' '); - var value = split.join('=').replace(/\+/g, ' '); - form.append(decodeURIComponent(name), decodeURIComponent(value)); - } - }); - return form - } - - function parseHeaders(rawHeaders) { - var headers = new Headers(); - // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space - // https://tools.ietf.org/html/rfc7230#section-3.2 - var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); - preProcessedHeaders.split(/\r?\n/).forEach(function(line) { - var parts = line.split(':'); - var key = parts.shift().trim(); - if (key) { - var value = parts.join(':').trim(); - headers.append(key, value); - } - }); - return headers - } - - Body.call(Request.prototype); - - function Response(bodyInit, options) { - if (!options) { - options = {}; - } - - this.type = 'default'; - this.status = options.status === undefined ? 200 : options.status; - this.ok = this.status >= 200 && this.status < 300; - this.statusText = 'statusText' in options ? options.statusText : 'OK'; - this.headers = new Headers(options.headers); - this.url = options.url || ''; - this._initBody(bodyInit); - } - - Body.call(Response.prototype); - - Response.prototype.clone = function() { - return new Response(this._bodyInit, { - status: this.status, - statusText: this.statusText, - headers: new Headers(this.headers), - url: this.url - }) - }; - - Response.error = function() { - var response = new Response(null, {status: 0, statusText: ''}); - response.type = 'error'; - return response - }; - - var redirectStatuses = [301, 302, 303, 307, 308]; - - Response.redirect = function(url, status) { - if (redirectStatuses.indexOf(status) === -1) { - throw new RangeError('Invalid status code') - } - - return new Response(null, {status: status, headers: {location: url}}) - }; - - exports.DOMException = self.DOMException; - try { - new exports.DOMException(); - } catch (err) { - exports.DOMException = function(message, name) { - this.message = message; - this.name = name; - var error = Error(message); - this.stack = error.stack; - }; - exports.DOMException.prototype = Object.create(Error.prototype); - exports.DOMException.prototype.constructor = exports.DOMException; - } - - function fetch(input, init) { - return new Promise(function(resolve, reject) { - var request = new Request(input, init); - - if (request.signal && request.signal.aborted) { - return reject(new exports.DOMException('Aborted', 'AbortError')) - } - - var xhr = new XMLHttpRequest(); - - function abortXhr() { - xhr.abort(); - } - - xhr.onload = function() { - var options = { - status: xhr.status, - statusText: xhr.statusText, - headers: parseHeaders(xhr.getAllResponseHeaders() || '') - }; - options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); - var body = 'response' in xhr ? xhr.response : xhr.responseText; - resolve(new Response(body, options)); - }; - - xhr.onerror = function() { - reject(new TypeError('Network request failed')); - }; - - xhr.ontimeout = function() { - reject(new TypeError('Network request failed')); - }; - - xhr.onabort = function() { - reject(new exports.DOMException('Aborted', 'AbortError')); - }; - - xhr.open(request.method, request.url, true); - - if (request.credentials === 'include') { - xhr.withCredentials = true; - } else if (request.credentials === 'omit') { - xhr.withCredentials = false; - } - - if ('responseType' in xhr && support.blob) { - xhr.responseType = 'blob'; - } - - request.headers.forEach(function(value, name) { - xhr.setRequestHeader(name, value); - }); - - if (request.signal) { - request.signal.addEventListener('abort', abortXhr); - - xhr.onreadystatechange = function() { - // DONE (success or failure) - if (xhr.readyState === 4) { - request.signal.removeEventListener('abort', abortXhr); - } - }; - } - - xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); - }) - } - - fetch.polyfill = true; - - if (!self.fetch) { - self.fetch = fetch; - self.Headers = Headers; - self.Request = Request; - self.Response = Response; - } - - exports.Headers = Headers; - exports.Request = Request; - exports.Response = Response; - exports.fetch = fetch; - - return exports; - -}({})); -})(typeof self !== 'undefined' ? self : this); diff --git a/node_modules/cross-fetch/dist/browser-ponyfill.js b/node_modules/cross-fetch/dist/browser-ponyfill.js deleted file mode 100644 index 7a795ac9..00000000 --- a/node_modules/cross-fetch/dist/browser-ponyfill.js +++ /dev/null @@ -1,546 +0,0 @@ -var __self__ = (function (root) { -function F() { -this.fetch = false; -this.DOMException = root.DOMException -} -F.prototype = root; -return new F(); -})(typeof self !== 'undefined' ? self : this); -(function(self) { - -var irrelevant = (function (exports) { - - var support = { - searchParams: 'URLSearchParams' in self, - iterable: 'Symbol' in self && 'iterator' in Symbol, - blob: - 'FileReader' in self && - 'Blob' in self && - (function() { - try { - new Blob(); - return true - } catch (e) { - return false - } - })(), - formData: 'FormData' in self, - arrayBuffer: 'ArrayBuffer' in self - }; - - function isDataView(obj) { - return obj && DataView.prototype.isPrototypeOf(obj) - } - - if (support.arrayBuffer) { - var viewClasses = [ - '[object Int8Array]', - '[object Uint8Array]', - '[object Uint8ClampedArray]', - '[object Int16Array]', - '[object Uint16Array]', - '[object Int32Array]', - '[object Uint32Array]', - '[object Float32Array]', - '[object Float64Array]' - ]; - - var isArrayBufferView = - ArrayBuffer.isView || - function(obj) { - return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 - }; - } - - function normalizeName(name) { - if (typeof name !== 'string') { - name = String(name); - } - if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { - throw new TypeError('Invalid character in header field name') - } - return name.toLowerCase() - } - - function normalizeValue(value) { - if (typeof value !== 'string') { - value = String(value); - } - return value - } - - // Build a destructive iterator for the value list - function iteratorFor(items) { - var iterator = { - next: function() { - var value = items.shift(); - return {done: value === undefined, value: value} - } - }; - - if (support.iterable) { - iterator[Symbol.iterator] = function() { - return iterator - }; - } - - return iterator - } - - function Headers(headers) { - this.map = {}; - - if (headers instanceof Headers) { - headers.forEach(function(value, name) { - this.append(name, value); - }, this); - } else if (Array.isArray(headers)) { - headers.forEach(function(header) { - this.append(header[0], header[1]); - }, this); - } else if (headers) { - Object.getOwnPropertyNames(headers).forEach(function(name) { - this.append(name, headers[name]); - }, this); - } - } - - Headers.prototype.append = function(name, value) { - name = normalizeName(name); - value = normalizeValue(value); - var oldValue = this.map[name]; - this.map[name] = oldValue ? oldValue + ', ' + value : value; - }; - - Headers.prototype['delete'] = function(name) { - delete this.map[normalizeName(name)]; - }; - - Headers.prototype.get = function(name) { - name = normalizeName(name); - return this.has(name) ? this.map[name] : null - }; - - Headers.prototype.has = function(name) { - return this.map.hasOwnProperty(normalizeName(name)) - }; - - Headers.prototype.set = function(name, value) { - this.map[normalizeName(name)] = normalizeValue(value); - }; - - Headers.prototype.forEach = function(callback, thisArg) { - for (var name in this.map) { - if (this.map.hasOwnProperty(name)) { - callback.call(thisArg, this.map[name], name, this); - } - } - }; - - Headers.prototype.keys = function() { - var items = []; - this.forEach(function(value, name) { - items.push(name); - }); - return iteratorFor(items) - }; - - Headers.prototype.values = function() { - var items = []; - this.forEach(function(value) { - items.push(value); - }); - return iteratorFor(items) - }; - - Headers.prototype.entries = function() { - var items = []; - this.forEach(function(value, name) { - items.push([name, value]); - }); - return iteratorFor(items) - }; - - if (support.iterable) { - Headers.prototype[Symbol.iterator] = Headers.prototype.entries; - } - - function consumed(body) { - if (body.bodyUsed) { - return Promise.reject(new TypeError('Already read')) - } - body.bodyUsed = true; - } - - function fileReaderReady(reader) { - return new Promise(function(resolve, reject) { - reader.onload = function() { - resolve(reader.result); - }; - reader.onerror = function() { - reject(reader.error); - }; - }) - } - - function readBlobAsArrayBuffer(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsArrayBuffer(blob); - return promise - } - - function readBlobAsText(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsText(blob); - return promise - } - - function readArrayBufferAsText(buf) { - var view = new Uint8Array(buf); - var chars = new Array(view.length); - - for (var i = 0; i < view.length; i++) { - chars[i] = String.fromCharCode(view[i]); - } - return chars.join('') - } - - function bufferClone(buf) { - if (buf.slice) { - return buf.slice(0) - } else { - var view = new Uint8Array(buf.byteLength); - view.set(new Uint8Array(buf)); - return view.buffer - } - } - - function Body() { - this.bodyUsed = false; - - this._initBody = function(body) { - this._bodyInit = body; - if (!body) { - this._bodyText = ''; - } else if (typeof body === 'string') { - this._bodyText = body; - } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { - this._bodyBlob = body; - } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { - this._bodyFormData = body; - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this._bodyText = body.toString(); - } else if (support.arrayBuffer && support.blob && isDataView(body)) { - this._bodyArrayBuffer = bufferClone(body.buffer); - // IE 10-11 can't handle a DataView body. - this._bodyInit = new Blob([this._bodyArrayBuffer]); - } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { - this._bodyArrayBuffer = bufferClone(body); - } else { - this._bodyText = body = Object.prototype.toString.call(body); - } - - if (!this.headers.get('content-type')) { - if (typeof body === 'string') { - this.headers.set('content-type', 'text/plain;charset=UTF-8'); - } else if (this._bodyBlob && this._bodyBlob.type) { - this.headers.set('content-type', this._bodyBlob.type); - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); - } - } - }; - - if (support.blob) { - this.blob = function() { - var rejected = consumed(this); - if (rejected) { - return rejected - } - - if (this._bodyBlob) { - return Promise.resolve(this._bodyBlob) - } else if (this._bodyArrayBuffer) { - return Promise.resolve(new Blob([this._bodyArrayBuffer])) - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as blob') - } else { - return Promise.resolve(new Blob([this._bodyText])) - } - }; - - this.arrayBuffer = function() { - if (this._bodyArrayBuffer) { - return consumed(this) || Promise.resolve(this._bodyArrayBuffer) - } else { - return this.blob().then(readBlobAsArrayBuffer) - } - }; - } - - this.text = function() { - var rejected = consumed(this); - if (rejected) { - return rejected - } - - if (this._bodyBlob) { - return readBlobAsText(this._bodyBlob) - } else if (this._bodyArrayBuffer) { - return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as text') - } else { - return Promise.resolve(this._bodyText) - } - }; - - if (support.formData) { - this.formData = function() { - return this.text().then(decode) - }; - } - - this.json = function() { - return this.text().then(JSON.parse) - }; - - return this - } - - // HTTP methods whose capitalization should be normalized - var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; - - function normalizeMethod(method) { - var upcased = method.toUpperCase(); - return methods.indexOf(upcased) > -1 ? upcased : method - } - - function Request(input, options) { - options = options || {}; - var body = options.body; - - if (input instanceof Request) { - if (input.bodyUsed) { - throw new TypeError('Already read') - } - this.url = input.url; - this.credentials = input.credentials; - if (!options.headers) { - this.headers = new Headers(input.headers); - } - this.method = input.method; - this.mode = input.mode; - this.signal = input.signal; - if (!body && input._bodyInit != null) { - body = input._bodyInit; - input.bodyUsed = true; - } - } else { - this.url = String(input); - } - - this.credentials = options.credentials || this.credentials || 'same-origin'; - if (options.headers || !this.headers) { - this.headers = new Headers(options.headers); - } - this.method = normalizeMethod(options.method || this.method || 'GET'); - this.mode = options.mode || this.mode || null; - this.signal = options.signal || this.signal; - this.referrer = null; - - if ((this.method === 'GET' || this.method === 'HEAD') && body) { - throw new TypeError('Body not allowed for GET or HEAD requests') - } - this._initBody(body); - } - - Request.prototype.clone = function() { - return new Request(this, {body: this._bodyInit}) - }; - - function decode(body) { - var form = new FormData(); - body - .trim() - .split('&') - .forEach(function(bytes) { - if (bytes) { - var split = bytes.split('='); - var name = split.shift().replace(/\+/g, ' '); - var value = split.join('=').replace(/\+/g, ' '); - form.append(decodeURIComponent(name), decodeURIComponent(value)); - } - }); - return form - } - - function parseHeaders(rawHeaders) { - var headers = new Headers(); - // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space - // https://tools.ietf.org/html/rfc7230#section-3.2 - var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); - preProcessedHeaders.split(/\r?\n/).forEach(function(line) { - var parts = line.split(':'); - var key = parts.shift().trim(); - if (key) { - var value = parts.join(':').trim(); - headers.append(key, value); - } - }); - return headers - } - - Body.call(Request.prototype); - - function Response(bodyInit, options) { - if (!options) { - options = {}; - } - - this.type = 'default'; - this.status = options.status === undefined ? 200 : options.status; - this.ok = this.status >= 200 && this.status < 300; - this.statusText = 'statusText' in options ? options.statusText : 'OK'; - this.headers = new Headers(options.headers); - this.url = options.url || ''; - this._initBody(bodyInit); - } - - Body.call(Response.prototype); - - Response.prototype.clone = function() { - return new Response(this._bodyInit, { - status: this.status, - statusText: this.statusText, - headers: new Headers(this.headers), - url: this.url - }) - }; - - Response.error = function() { - var response = new Response(null, {status: 0, statusText: ''}); - response.type = 'error'; - return response - }; - - var redirectStatuses = [301, 302, 303, 307, 308]; - - Response.redirect = function(url, status) { - if (redirectStatuses.indexOf(status) === -1) { - throw new RangeError('Invalid status code') - } - - return new Response(null, {status: status, headers: {location: url}}) - }; - - exports.DOMException = self.DOMException; - try { - new exports.DOMException(); - } catch (err) { - exports.DOMException = function(message, name) { - this.message = message; - this.name = name; - var error = Error(message); - this.stack = error.stack; - }; - exports.DOMException.prototype = Object.create(Error.prototype); - exports.DOMException.prototype.constructor = exports.DOMException; - } - - function fetch(input, init) { - return new Promise(function(resolve, reject) { - var request = new Request(input, init); - - if (request.signal && request.signal.aborted) { - return reject(new exports.DOMException('Aborted', 'AbortError')) - } - - var xhr = new XMLHttpRequest(); - - function abortXhr() { - xhr.abort(); - } - - xhr.onload = function() { - var options = { - status: xhr.status, - statusText: xhr.statusText, - headers: parseHeaders(xhr.getAllResponseHeaders() || '') - }; - options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); - var body = 'response' in xhr ? xhr.response : xhr.responseText; - resolve(new Response(body, options)); - }; - - xhr.onerror = function() { - reject(new TypeError('Network request failed')); - }; - - xhr.ontimeout = function() { - reject(new TypeError('Network request failed')); - }; - - xhr.onabort = function() { - reject(new exports.DOMException('Aborted', 'AbortError')); - }; - - xhr.open(request.method, request.url, true); - - if (request.credentials === 'include') { - xhr.withCredentials = true; - } else if (request.credentials === 'omit') { - xhr.withCredentials = false; - } - - if ('responseType' in xhr && support.blob) { - xhr.responseType = 'blob'; - } - - request.headers.forEach(function(value, name) { - xhr.setRequestHeader(name, value); - }); - - if (request.signal) { - request.signal.addEventListener('abort', abortXhr); - - xhr.onreadystatechange = function() { - // DONE (success or failure) - if (xhr.readyState === 4) { - request.signal.removeEventListener('abort', abortXhr); - } - }; - } - - xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); - }) - } - - fetch.polyfill = true; - - if (!self.fetch) { - self.fetch = fetch; - self.Headers = Headers; - self.Request = Request; - self.Response = Response; - } - - exports.Headers = Headers; - exports.Request = Request; - exports.Response = Response; - exports.fetch = fetch; - - return exports; - -}({})); -})(__self__); -delete __self__.fetch.polyfill -exports = __self__.fetch // To enable: import fetch from 'cross-fetch' -exports.default = __self__.fetch // For TypeScript consumers without esModuleInterop. -exports.fetch = __self__.fetch // To enable: import {fetch} from 'cross-fetch' -exports.Headers = __self__.Headers -exports.Request = __self__.Request -exports.Response = __self__.Response -module.exports = exports diff --git a/node_modules/cross-fetch/dist/cross-fetch.js b/node_modules/cross-fetch/dist/cross-fetch.js deleted file mode 100644 index d4a63109..00000000 --- a/node_modules/cross-fetch/dist/cross-fetch.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(g){!function(a){var e,r,o="URLSearchParams"in g,n="Symbol"in g&&"iterator"in Symbol,h="FileReader"in g&&"Blob"in g&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in g,s="ArrayBuffer"in g;function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function t(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach(function(t,e){this.append(e,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(r){return new Promise(function(t,e){r.onload=function(){t(r.result)},r.onerror=function(){e(r.error)}})}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function l(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;(this._bodyInit=t)?"string"==typeof t?this._bodyText=t:h&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&h&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=l(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=l(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},h&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,o=c(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),o=0;o -1\n }\n}\n\nfunction normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n}\n\nfunction normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n}\n\n// Build a destructive iterator for the value list\nfunction iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n}\n\nexport function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n}\n\nHeaders.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue + ', ' + value : value\n}\n\nHeaders.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n}\n\nHeaders.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n}\n\nHeaders.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n}\n\nHeaders.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n}\n\nHeaders.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n}\n\nHeaders.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) {\n items.push(name)\n })\n return iteratorFor(items)\n}\n\nHeaders.prototype.values = function() {\n var items = []\n this.forEach(function(value) {\n items.push(value)\n })\n return iteratorFor(items)\n}\n\nHeaders.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) {\n items.push([name, value])\n })\n return iteratorFor(items)\n}\n\nif (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n}\n\nfunction consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n}\n\nfunction fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n}\n\nfunction readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n}\n\nfunction readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n}\n\nfunction readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n}\n\nfunction bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n}\n\nfunction Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n this._bodyText = body = Object.prototype.toString.call(body)\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n}\n\n// HTTP methods whose capitalization should be normalized\nvar methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\nfunction normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return methods.indexOf(upcased) > -1 ? upcased : method\n}\n\nexport function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n this.signal = input.signal\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.signal = options.signal || this.signal\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n}\n\nRequest.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n}\n\nfunction decode(body) {\n var form = new FormData()\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n}\n\nfunction parseHeaders(rawHeaders) {\n var headers = new Headers()\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ')\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n}\n\nBody.call(Request.prototype)\n\nexport function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = options.status === undefined ? 200 : options.status\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n}\n\nBody.call(Response.prototype)\n\nResponse.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n}\n\nResponse.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n}\n\nvar redirectStatuses = [301, 302, 303, 307, 308]\n\nResponse.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n}\n\nexport var DOMException = self.DOMException\ntry {\n new DOMException()\n} catch (err) {\n DOMException = function(message, name) {\n this.message = message\n this.name = name\n var error = Error(message)\n this.stack = error.stack\n }\n DOMException.prototype = Object.create(Error.prototype)\n DOMException.prototype.constructor = DOMException\n}\n\nexport function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n\n if (request.signal && request.signal.aborted) {\n return reject(new DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest()\n\n function abortXhr() {\n xhr.abort()\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.onabort = function() {\n reject(new DOMException('Aborted', 'AbortError'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr)\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr)\n }\n }\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n}\n\nfetch.polyfill = true\n\nif (!self.fetch) {\n self.fetch = fetch\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n}\n"],"names":["viewClasses","isArrayBufferView","support","self","Symbol","Blob","e","normalizeName","name","String","test","TypeError","toLowerCase","normalizeValue","value","iteratorFor","items","iterator","next","shift","done","undefined","Headers","headers","this","map","forEach","append","Array","isArray","header","Object","getOwnPropertyNames","consumed","body","bodyUsed","Promise","reject","fileReaderReady","reader","resolve","onload","result","onerror","error","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","slice","view","Uint8Array","byteLength","set","buffer","Body","_initBody","obj","_bodyInit","_bodyText","prototype","isPrototypeOf","_bodyBlob","FormData","_bodyFormData","URLSearchParams","toString","DataView","_bodyArrayBuffer","ArrayBuffer","call","get","type","rejected","Error","arrayBuffer","then","text","readAsText","chars","length","i","fromCharCode","join","readArrayBufferAsText","formData","decode","json","JSON","parse","isView","indexOf","oldValue","has","hasOwnProperty","callback","thisArg","keys","push","values","entries","methods","Request","input","options","method","upcased","url","credentials","mode","signal","toUpperCase","referrer","form","trim","split","bytes","replace","decodeURIComponent","Response","bodyInit","status","ok","statusText","clone","response","redirectStatuses","redirect","RangeError","location","DOMException","err","message","stack","create","constructor","fetch","init","request","aborted","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","line","parts","key","responseURL","responseText","ontimeout","onabort","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","removeEventListener","send","polyfill"],"mappings":"0BAAA,IAuBMA,EAYAC,E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WACZN,EAAO,IAAI1B,UAAU,4BAGvBoI,EAAIW,UAAY,WACdrH,EAAO,IAAI1B,UAAU,4BAGvBoI,EAAIY,QAAU,WACZtH,EAAO,IAAIgG,eAAa,UAAW,gBAGrCU,EAAIa,KAAKf,EAAQjC,OAAQiC,EAAQ/B,KAAK,GAEV,YAAxB+B,EAAQ9B,YACVgC,EAAIc,iBAAkB,EACW,SAAxBhB,EAAQ9B,cACjBgC,EAAIc,iBAAkB,GAGpB,iBAAkBd,GAAO7I,IAC3B6I,EAAIe,aAAe,QAGrBjB,EAAQtH,QAAQG,QAAQ,SAASZ,EAAON,GACtCuI,EAAIgB,iBAAiBvJ,EAAMM,KAGzB+H,EAAQ5B,SACV4B,EAAQ5B,OAAO+C,iBAAiB,QAASf,GAEzCF,EAAIkB,mBAAqB,WAEA,IAAnBlB,EAAImB,YACNrB,EAAQ5B,OAAOkD,oBAAoB,QAASlB,KAKlDF,EAAIqB,UAAkC,IAAtBvB,EAAQhF,UAA4B,KAAOgF,EAAQhF,aAIvE8E,EAAM0B,UAAW,EAEZlK,EAAKwI,QACRxI,EAAKwI,MAAQA,EACbxI,EAAKmB,QAAUA,EACfnB,EAAKsG,QAAUA,EACftG,EAAKuH,SAAWA"} \ No newline at end of file diff --git a/node_modules/cross-fetch/dist/node-polyfill.js b/node_modules/cross-fetch/dist/node-polyfill.js deleted file mode 100644 index 43ec50fb..00000000 --- a/node_modules/cross-fetch/dist/node-polyfill.js +++ /dev/null @@ -1,11 +0,0 @@ -var fetchNode = require('./node-ponyfill') -var fetch = fetchNode.fetch.bind({}) - -fetch.polyfill = true - -if (!global.fetch) { - global.fetch = fetch - global.Response = fetchNode.Response - global.Headers = fetchNode.Headers - global.Request = fetchNode.Request -} diff --git a/node_modules/cross-fetch/dist/node-ponyfill.js b/node_modules/cross-fetch/dist/node-ponyfill.js deleted file mode 100644 index e79aa92d..00000000 --- a/node_modules/cross-fetch/dist/node-ponyfill.js +++ /dev/null @@ -1,20 +0,0 @@ -var nodeFetch = require('node-fetch') -var realFetch = nodeFetch.default || nodeFetch - -var fetch = function (url, options) { - // Support schemaless URIs on the server for parity with the browser. - // Ex: //github.com/ -> https://github.com/ - if (/^\/\//.test(url)) { - url = 'https:' + url - } - return realFetch.call(this, url, options) -} - -module.exports = exports = fetch -exports.fetch = fetch -exports.Headers = nodeFetch.Headers -exports.Request = nodeFetch.Request -exports.Response = nodeFetch.Response - -// Needed for TypeScript consumers without esModuleInterop. -exports.default = fetch diff --git a/node_modules/cross-fetch/dist/react-native-polyfill.js b/node_modules/cross-fetch/dist/react-native-polyfill.js deleted file mode 100644 index 57ad2566..00000000 --- a/node_modules/cross-fetch/dist/react-native-polyfill.js +++ /dev/null @@ -1,12 +0,0 @@ -/*! - * VaporJS JavaScript Library v1.4.5 - * https://github.com/madrobby/vapor.js - * - * Copyright (c) 2010 Thomas Fuchs (http://script.aculo.us/thomas) - * Released under the MIT license - * https://github.com/madrobby/vapor.js/blob/master/MIT-LICENSE - * - * Date: 2019-05-25T03:04Z - */ - -// React Native already polyfills `fetch` so this code is intentionally handled to VaporJS. diff --git a/node_modules/cross-fetch/dist/react-native-ponyfill.js b/node_modules/cross-fetch/dist/react-native-ponyfill.js deleted file mode 100644 index 673e0970..00000000 --- a/node_modules/cross-fetch/dist/react-native-ponyfill.js +++ /dev/null @@ -1,8 +0,0 @@ -exports = global.fetch // To enable: import fetch from 'cross-fetch' -exports.default = global.fetch // For TypeScript consumers without esModuleInterop. -exports.fetch = global.fetch // To enable: import {fetch} from 'cross-fetch' -exports.Headers = global.Headers -exports.Request = global.Request -exports.Response = global.Response - -module.exports = exports diff --git a/node_modules/cross-fetch/index.d.ts b/node_modules/cross-fetch/index.d.ts deleted file mode 100644 index 3c030c06..00000000 --- a/node_modules/cross-fetch/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -declare const _fetch: typeof fetch; -declare const _Request: typeof Request; -declare const _Response: typeof Response; -declare const _Headers: typeof Headers; - -declare module "cross-fetch" { - export const fetch: typeof _fetch; - export const Request: typeof _Request; - export const Response: typeof _Response; - export const Headers: typeof _Headers; - export default fetch; -} diff --git a/node_modules/cross-fetch/package.json b/node_modules/cross-fetch/package.json deleted file mode 100644 index 1fa80152..00000000 --- a/node_modules/cross-fetch/package.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "_from": "cross-fetch@^3.0.6", - "_id": "cross-fetch@3.0.6", - "_inBundle": false, - "_integrity": "sha512-KBPUbqgFjzWlVcURG+Svp9TlhA5uliYtiNx/0r8nv0pdypeQCRJ9IaSIc3q/x3q8t3F75cHuwxVql1HFGHCNJQ==", - "_location": "/cross-fetch", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "cross-fetch@^3.0.6", - "name": "cross-fetch", - "escapedName": "cross-fetch", - "rawSpec": "^3.0.6", - "saveSpec": null, - "fetchSpec": "^3.0.6" - }, - "_requiredBy": [ - "/graphql-request" - ], - "_resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.0.6.tgz", - "_shasum": "3a4040bc8941e653e0e9cf17f29ebcd177d3365c", - "_spec": "cross-fetch@^3.0.6", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/graphql-request", - "author": { - "name": "Leonardo Quixada", - "email": "lquixada@gmail.com" - }, - "browser": "dist/browser-ponyfill.js", - "bugs": { - "url": "https://github.com/lquixada/cross-fetch/issues" - }, - "bundleDependencies": false, - "dependencies": { - "node-fetch": "2.6.1" - }, - "deprecated": false, - "description": "Universal WHATWG Fetch API for Node, Browsers and React Native", - "devDependencies": { - "chai": "4.2.0", - "codecov": "3.7.2", - "husky": "4.3.0", - "lint-staged": "10.3.0", - "mocha": "8.1.3", - "mocha-headless-chrome": "2.0.1", - "nock": "13.0.4", - "nyc": "15.1.0", - "ora": "5.1.0", - "rollup": "2.26.11", - "rollup-plugin-copy": "3.3.0", - "rollup-plugin-uglify": "6.0.4", - "semver": "7.3.2", - "sinon": "9.0.3", - "standard": "14.3.4", - "webpack": "4.44.1", - "webpack-cli": "3.3.12", - "whatwg-fetch": "3.0.0" - }, - "files": [ - "dist", - "polyfill", - "index.d.ts" - ], - "homepage": "https://github.com/lquixada/cross-fetch", - "husky": { - "hooks": { - "pre-commit": "make build && make check-dependencies && lint-staged" - } - }, - "keywords": [ - "fetch", - "http", - "url", - "promise", - "async", - "await", - "isomorphic", - "universal", - "node", - "react", - "native", - "browser", - "ponyfill", - "whatwg", - "xhr", - "ajax" - ], - "license": "MIT", - "lint-staged": { - "*.js": [ - "standard --fix" - ] - }, - "main": "dist/node-ponyfill.js", - "mocha": { - "require": [ - "chai/register-expect", - "chai/register-assert" - ], - "check-leaks": true - }, - "name": "cross-fetch", - "nyc": { - "temp-dir": ".reports/.coverage" - }, - "react-native": "dist/react-native-ponyfill.js", - "repository": { - "type": "git", - "url": "git+https://github.com/lquixada/cross-fetch.git" - }, - "standard": { - "env": [ - "mocha", - "browser" - ], - "globals": [ - "expect", - "assert", - "chai", - "sinon" - ], - "ignore": [ - "/dist/", - "bundle.js", - "bundle.*.js" - ] - }, - "typings": "index.d.ts", - "version": "3.0.6" -} diff --git a/node_modules/cross-fetch/polyfill/package.json b/node_modules/cross-fetch/polyfill/package.json deleted file mode 100644 index 3e2f9c2c..00000000 --- a/node_modules/cross-fetch/polyfill/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "cross-fetch-polyfill", - "version": "0.0.0", - "main": "../dist/node-polyfill.js", - "browser": "../dist/browser-polyfill.js", - "react-native": "../dist/react-native-polyfill.js" -} diff --git a/node_modules/debug/LICENSE b/node_modules/debug/LICENSE deleted file mode 100644 index 658c933d..00000000 --- a/node_modules/debug/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk - -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. - diff --git a/node_modules/debug/README.md b/node_modules/debug/README.md deleted file mode 100644 index 88dae35d..00000000 --- a/node_modules/debug/README.md +++ /dev/null @@ -1,455 +0,0 @@ -# debug -[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) -[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) - - - -A tiny JavaScript debugging utility modelled after Node.js core's debugging -technique. Works in Node.js and web browsers. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - -`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. - -Example [_app.js_](./examples/node/app.js): - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %o', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example [_worker.js_](./examples/node/worker.js): - -```js -var a = require('debug')('worker:a') - , b = require('debug')('worker:b'); - -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); -``` - -The `DEBUG` environment variable is then used to enable these based on space or -comma-delimited names. - -Here are some examples: - -screen shot 2017-08-08 at 12 53 04 pm -screen shot 2017-08-08 at 12 53 38 pm -screen shot 2017-08-08 at 12 53 25 pm - -#### Windows command prompt notes - -##### CMD - -On Windows the environment variable is set using the `set` command. - -```cmd -set DEBUG=*,-not_this -``` - -Example: - -```cmd -set DEBUG=* & node app.js -``` - -##### PowerShell (VS Code default) - -PowerShell uses different syntax to set environment variables. - -```cmd -$env:DEBUG = "*,-not_this" -``` - -Example: - -```cmd -$env:DEBUG='app';node app.js -``` - -Then, run the program to be debugged as usual. - -npm script example: -```js - "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", -``` - -## Namespace Colors - -Every debug instance has a color generated for it based on its namespace name. -This helps when visually parsing the debug output to identify which debug instance -a debug line belongs to. - -#### Node.js - -In Node.js, colors are enabled when stderr is a TTY. You also _should_ install -the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, -otherwise debug will only use a small handful of basic colors. - - - -#### Web Browser - -Colors are also enabled on "Web Inspectors" that understand the `%c` formatting -option. These are WebKit web inspectors, Firefox ([since version -31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) -and the Firebug plugin for Firefox (any version). - - - - -## Millisecond diff - -When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - - -When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: - - - - -## Conventions - -If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. - -## Wildcards - -The `*` character may be used as a wildcard. Suppose for example your library has -debuggers named "connect:bodyParser", "connect:compress", "connect:session", -instead of listing all three with -`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do -`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - -You can also exclude specific debuggers by prefixing them with a "-" character. -For example, `DEBUG=*,-connect:*` would include all debuggers except those -starting with "connect:". - -## Environment Variables - -When running through Node.js, you can set a few environment variables that will -change the behavior of the debug logging: - -| Name | Purpose | -|-----------|-------------------------------------------------| -| `DEBUG` | Enables/disables specific debugging namespaces. | -| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | -| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | -| `DEBUG_DEPTH` | Object inspection depth. | -| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | - - -__Note:__ The environment variables beginning with `DEBUG_` end up being -converted into an Options object that gets used with `%o`/`%O` formatters. -See the Node.js documentation for -[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) -for the complete list. - -## Formatters - -Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. -Below are the officially supported formatters: - -| Formatter | Representation | -|-----------|----------------| -| `%O` | Pretty-print an Object on multiple lines. | -| `%o` | Pretty-print an Object all on a single line. | -| `%s` | String. | -| `%d` | Number (both integer and float). | -| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | -| `%%` | Single percent sign ('%'). This does not consume an argument. | - - -### Custom formatters - -You can add custom formatters by extending the `debug.formatters` object. -For example, if you wanted to add support for rendering a Buffer as hex with -`%h`, you could do something like: - -```js -const createDebug = require('debug') -createDebug.formatters.h = (v) => { - return v.toString('hex') -} - -// …elsewhere -const debug = createDebug('foo') -debug('this is hex: %h', new Buffer('hello world')) -// foo this is hex: 68656c6c6f20776f726c6421 +0ms -``` - - -## Browser Support - -You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), -or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), -if you don't want to build it yourself. - -Debug's enable state is currently persisted by `localStorage`. -Consider the situation shown below where you have `worker:a` and `worker:b`, -and wish to debug both. You can enable this using `localStorage.debug`: - -```js -localStorage.debug = 'worker:*' -``` - -And then refresh the page. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - - -## Output streams - - By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: - -Example [_stdout.js_](./examples/node/stdout.js): - -```js -var debug = require('debug'); -var error = debug('app:error'); - -// by default stderr is used -error('goes to stderr!'); - -var log = debug('app:log'); -// set this namespace to log via console.log -log.log = console.log.bind(console); // don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); -``` - -## Extend -You can simply extend debugger -```js -const log = require('debug')('auth'); - -//creates new debug instance with extended namespace -const logSign = log.extend('sign'); -const logLogin = log.extend('login'); - -log('hello'); // auth hello -logSign('hello'); //auth:sign hello -logLogin('hello'); //auth:login hello -``` - -## Set dynamically - -You can also enable debug dynamically by calling the `enable()` method : - -```js -let debug = require('debug'); - -console.log(1, debug.enabled('test')); - -debug.enable('test'); -console.log(2, debug.enabled('test')); - -debug.disable(); -console.log(3, debug.enabled('test')); - -``` - -print : -``` -1 false -2 true -3 false -``` - -Usage : -`enable(namespaces)` -`namespaces` can include modes separated by a colon and wildcards. - -Note that calling `enable()` completely overrides previously set DEBUG variable : - -``` -$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' -=> false -``` - -`disable()` - -Will disable all namespaces. The functions returns the namespaces currently -enabled (and skipped). This can be useful if you want to disable debugging -temporarily without knowing what was enabled to begin with. - -For example: - -```js -let debug = require('debug'); -debug.enable('foo:*,-foo:bar'); -let namespaces = debug.disable(); -debug.enable(namespaces); -``` - -Note: There is no guarantee that the string will be identical to the initial -enable string, but semantically they will be identical. - -## Checking whether a debug target is enabled - -After you've created a debug instance, you can determine whether or not it is -enabled by checking the `enabled` property: - -```javascript -const debug = require('debug')('http'); - -if (debug.enabled) { - // do stuff... -} -``` - -You can also manually toggle this property to force the debug instance to be -enabled or disabled. - - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - - Andrew Rhyne - -## Backers - -Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## Sponsors - -Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## License - -(The MIT License) - -Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> - -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. diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json deleted file mode 100644 index 21d6e2c6..00000000 --- a/node_modules/debug/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_from": "debug@4", - "_id": "debug@4.2.0", - "_inBundle": false, - "_integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "_location": "/debug", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "debug@4", - "name": "debug", - "escapedName": "debug", - "rawSpec": "4", - "saveSpec": null, - "fetchSpec": "4" - }, - "_requiredBy": [ - "/https-proxy-agent" - ], - "_resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "_shasum": "7f150f93920e94c58f5574c2fd01a3110effe7f1", - "_spec": "debug@4", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/https-proxy-agent", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "browser": "./src/browser.js", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - }, - { - "name": "Andrew Rhyne", - "email": "rhyneandrew@gmail.com" - }, - { - "name": "Josh Junon", - "email": "josh@junon.me" - } - ], - "dependencies": { - "ms": "2.1.2" - }, - "deprecated": false, - "description": "small debugging utility", - "devDependencies": { - "brfs": "^2.0.1", - "browserify": "^16.2.3", - "coveralls": "^3.0.2", - "istanbul": "^0.4.5", - "karma": "^3.1.4", - "karma-browserify": "^6.0.0", - "karma-chrome-launcher": "^2.2.0", - "karma-mocha": "^1.3.0", - "mocha": "^5.2.0", - "mocha-lcov-reporter": "^1.2.0", - "xo": "^0.23.0" - }, - "engines": { - "node": ">=6.0" - }, - "files": [ - "src", - "LICENSE", - "README.md" - ], - "homepage": "https://github.com/visionmedia/debug#readme", - "keywords": [ - "debug", - "log", - "debugger" - ], - "license": "MIT", - "main": "./src/index.js", - "name": "debug", - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - }, - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "scripts": { - "lint": "xo", - "test": "npm run test:node && npm run test:browser && npm run lint", - "test:browser": "karma start --single-run", - "test:coverage": "cat ./coverage/lcov.info | coveralls", - "test:node": "istanbul cover _mocha -- test.js" - }, - "version": "4.2.0" -} diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js deleted file mode 100644 index ac3f7e13..00000000 --- a/node_modules/debug/src/browser.js +++ /dev/null @@ -1,259 +0,0 @@ -/* eslint-env browser */ - -/** - * This is the web browser implementation of `debug()`. - */ - -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - '#0000CC', - '#0000FF', - '#0033CC', - '#0033FF', - '#0066CC', - '#0066FF', - '#0099CC', - '#0099FF', - '#00CC00', - '#00CC33', - '#00CC66', - '#00CC99', - '#00CCCC', - '#00CCFF', - '#3300CC', - '#3300FF', - '#3333CC', - '#3333FF', - '#3366CC', - '#3366FF', - '#3399CC', - '#3399FF', - '#33CC00', - '#33CC33', - '#33CC66', - '#33CC99', - '#33CCCC', - '#33CCFF', - '#6600CC', - '#6600FF', - '#6633CC', - '#6633FF', - '#66CC00', - '#66CC33', - '#9900CC', - '#9900FF', - '#9933CC', - '#9933FF', - '#99CC00', - '#99CC33', - '#CC0000', - '#CC0033', - '#CC0066', - '#CC0099', - '#CC00CC', - '#CC00FF', - '#CC3300', - '#CC3333', - '#CC3366', - '#CC3399', - '#CC33CC', - '#CC33FF', - '#CC6600', - '#CC6633', - '#CC9900', - '#CC9933', - '#CCCC00', - '#CCCC33', - '#FF0000', - '#FF0033', - '#FF0066', - '#FF0099', - '#FF00CC', - '#FF00FF', - '#FF3300', - '#FF3333', - '#FF3366', - '#FF3399', - '#FF33CC', - '#FF33FF', - '#FF6600', - '#FF6633', - '#FF9900', - '#FF9933', - '#FFCC00', - '#FFCC33' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -// eslint-disable-next-line complexity -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } - - // Internet Explorer and Edge do not support colors. - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - - // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || - // Is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || - // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || - // Double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); -} - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + - this.namespace + - (this.useColors ? ' %c' : ' ') + - args[0] + - (this.useColors ? '%c ' : ' ') + - '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - const c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); - - // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - let index = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, match => { - if (match === '%%') { - return; - } - index++; - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); -} - -/** - * Invokes `console.debug()` when available. - * No-op when `console.debug` is not a "function". - * If `console.debug` is not available, falls back - * to `console.log`. - * - * @api public - */ -exports.log = console.debug || console.log || (() => {}); - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ -function load() { - let r; - try { - r = exports.storage.getItem('debug'); - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } - - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; -} - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} - -module.exports = require('./common')(exports); - -const {formatters} = module.exports; - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } -}; diff --git a/node_modules/debug/src/common.js b/node_modules/debug/src/common.js deleted file mode 100644 index da7eada6..00000000 --- a/node_modules/debug/src/common.js +++ /dev/null @@ -1,264 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ - -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - - Object.keys(env).forEach(key => { - createDebug[key] = env[key]; - }); - - /** - * Active `debug` instances. - */ - createDebug.instances = []; - - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - createDebug.formatters = {}; - - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - function selectColor(namespace) { - let hash = 0; - - for (let i = 0; i < namespace.length; i++) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; - - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - function createDebug(namespace) { - let prevTime; - - function debug(...args) { - // Disabled? - if (!debug.enabled) { - return; - } - - const self = debug; - - // Set `diff` timestamp - const curr = Number(new Date()); - const ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } - - // Apply any `formatters` transformations - let index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } - index++; - const formatter = createDebug.formatters[format]; - if (typeof formatter === 'function') { - const val = args[index]; - match = formatter.call(self, val); - - // Now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - // Apply env-specific formatting (colors, etc.) - createDebug.formatArgs.call(self, args); - - const logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = createDebug.selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; - - // Env-specific initialization logic for debug instances - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - createDebug.instances.push(debug); - - return debug; - } - - function destroy() { - const index = createDebug.instances.indexOf(this); - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - return false; - } - - function extend(namespace, delimiter) { - const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - function enable(namespaces) { - createDebug.save(namespaces); - - createDebug.names = []; - createDebug.skips = []; - - let i; - const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - const len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < createDebug.instances.length; i++) { - const instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } - } - - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - function disable() { - const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) - ].join(','); - createDebug.enable(''); - return namespaces; - } - - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - let i; - let len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - function toNamespace(regexp) { - return regexp.toString() - .substring(2, regexp.toString().length - 2) - .replace(/\.\*\?$/, '*'); - } - - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } - - createDebug.enable(createDebug.load()); - - return createDebug; -} - -module.exports = setup; diff --git a/node_modules/debug/src/index.js b/node_modules/debug/src/index.js deleted file mode 100644 index bf4c57f2..00000000 --- a/node_modules/debug/src/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Detect Electron renderer / nwjs process, which is node, but we should - * treat as a browser. - */ - -if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = require('./browser.js'); -} else { - module.exports = require('./node.js'); -} diff --git a/node_modules/debug/src/node.js b/node_modules/debug/src/node.js deleted file mode 100644 index 5e1f1541..00000000 --- a/node_modules/debug/src/node.js +++ /dev/null @@ -1,257 +0,0 @@ -/** - * Module dependencies. - */ - -const tty = require('tty'); -const util = require('util'); - -/** - * This is the Node.js implementation of `debug()`. - */ - -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - const supportsColor = require('supports-color'); - - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.colors = [ - 20, - 21, - 26, - 27, - 32, - 33, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 56, - 57, - 62, - 63, - 68, - 69, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 92, - 93, - 98, - 99, - 112, - 113, - 128, - 129, - 134, - 135, - 148, - 149, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 178, - 179, - 184, - 185, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 214, - 215, - 220, - 221 - ]; - } -} catch (error) { - // Swallow - we only care if `supports-color` is available; it doesn't have to be. -} - -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ - -exports.inspectOpts = Object.keys(process.env).filter(key => { - return /^debug_/i.test(key); -}).reduce((obj, key) => { - // Camel-case - const prop = key - .substring(6) - .toLowerCase() - .replace(/_([a-z])/g, (_, k) => { - return k.toUpperCase(); - }); - - // Coerce string value into JS value - let val = process.env[key]; - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); - } - - obj[prop] = val; - return obj; -}, {}); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - return 'colors' in exports.inspectOpts ? - Boolean(exports.inspectOpts.colors) : - tty.isatty(process.stderr.fd); -} - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs(args) { - const {namespace: name, useColors} = this; - - if (useColors) { - const c = this.color; - const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); - const prefix = ` ${colorCode};1m${name} \u001B[0m`; - - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} - -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } - return new Date().toISOString() + ' '; -} - -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ - -function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ - -function init(debug) { - debug.inspectOpts = {}; - - const keys = Object.keys(exports.inspectOpts); - for (let i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } -} - -module.exports = require('./common')(exports); - -const {formatters} = module.exports; - -/** - * Map %o to `util.inspect()`, all on a single line. - */ - -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ - -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; diff --git a/node_modules/delayed-stream/.npmignore b/node_modules/delayed-stream/.npmignore deleted file mode 100644 index 9daeafb9..00000000 --- a/node_modules/delayed-stream/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/node_modules/delayed-stream/License b/node_modules/delayed-stream/License deleted file mode 100644 index 4804b7ab..00000000 --- a/node_modules/delayed-stream/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Debuggable Limited - -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. diff --git a/node_modules/delayed-stream/Makefile b/node_modules/delayed-stream/Makefile deleted file mode 100644 index b4ff85a3..00000000 --- a/node_modules/delayed-stream/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -.PHONY: test - diff --git a/node_modules/delayed-stream/Readme.md b/node_modules/delayed-stream/Readme.md deleted file mode 100644 index aca36f9f..00000000 --- a/node_modules/delayed-stream/Readme.md +++ /dev/null @@ -1,141 +0,0 @@ -# delayed-stream - -Buffers events from a stream until you are ready to handle them. - -## Installation - -``` bash -npm install delayed-stream -``` - -## Usage - -The following example shows how to write a http echo server that delays its -response by 1000 ms. - -``` javascript -var DelayedStream = require('delayed-stream'); -var http = require('http'); - -http.createServer(function(req, res) { - var delayed = DelayedStream.create(req); - - setTimeout(function() { - res.writeHead(200); - delayed.pipe(res); - }, 1000); -}); -``` - -If you are not using `Stream#pipe`, you can also manually release the buffered -events by calling `delayedStream.resume()`: - -``` javascript -var delayed = DelayedStream.create(req); - -setTimeout(function() { - // Emit all buffered events and resume underlaying source - delayed.resume(); -}, 1000); -``` - -## Implementation - -In order to use this meta stream properly, here are a few things you should -know about the implementation. - -### Event Buffering / Proxying - -All events of the `source` stream are hijacked by overwriting the `source.emit` -method. Until node implements a catch-all event listener, this is the only way. - -However, delayed-stream still continues to emit all events it captures on the -`source`, regardless of whether you have released the delayed stream yet or -not. - -Upon creation, delayed-stream captures all `source` events and stores them in -an internal event buffer. Once `delayedStream.release()` is called, all -buffered events are emitted on the `delayedStream`, and the event buffer is -cleared. After that, delayed-stream merely acts as a proxy for the underlaying -source. - -### Error handling - -Error events on `source` are buffered / proxied just like any other events. -However, `delayedStream.create` attaches a no-op `'error'` listener to the -`source`. This way you only have to handle errors on the `delayedStream` -object, rather than in two places. - -### Buffer limits - -delayed-stream provides a `maxDataSize` property that can be used to limit -the amount of data being buffered. In order to protect you from bad `source` -streams that don't react to `source.pause()`, this feature is enabled by -default. - -## API - -### DelayedStream.create(source, [options]) - -Returns a new `delayedStream`. Available options are: - -* `pauseStream` -* `maxDataSize` - -The description for those properties can be found below. - -### delayedStream.source - -The `source` stream managed by this object. This is useful if you are -passing your `delayedStream` around, and you still want to access properties -on the `source` object. - -### delayedStream.pauseStream = true - -Whether to pause the underlaying `source` when calling -`DelayedStream.create()`. Modifying this property afterwards has no effect. - -### delayedStream.maxDataSize = 1024 * 1024 - -The amount of data to buffer before emitting an `error`. - -If the underlaying source is emitting `Buffer` objects, the `maxDataSize` -refers to bytes. - -If the underlaying source is emitting JavaScript strings, the size refers to -characters. - -If you know what you are doing, you can set this property to `Infinity` to -disable this feature. You can also modify this property during runtime. - -### delayedStream.dataSize = 0 - -The amount of data buffered so far. - -### delayedStream.readable - -An ECMA5 getter that returns the value of `source.readable`. - -### delayedStream.resume() - -If the `delayedStream` has not been released so far, `delayedStream.release()` -is called. - -In either case, `source.resume()` is called. - -### delayedStream.pause() - -Calls `source.pause()`. - -### delayedStream.pipe(dest) - -Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. - -### delayedStream.release() - -Emits and clears all events that have been buffered up so far. This does not -resume the underlaying source, use `delayedStream.resume()` instead. - -## License - -delayed-stream is licensed under the MIT license. diff --git a/node_modules/delayed-stream/lib/delayed_stream.js b/node_modules/delayed-stream/lib/delayed_stream.js deleted file mode 100644 index b38fc85f..00000000 --- a/node_modules/delayed-stream/lib/delayed_stream.js +++ /dev/null @@ -1,107 +0,0 @@ -var Stream = require('stream').Stream; -var util = require('util'); - -module.exports = DelayedStream; -function DelayedStream() { - this.source = null; - this.dataSize = 0; - this.maxDataSize = 1024 * 1024; - this.pauseStream = true; - - this._maxDataSizeExceeded = false; - this._released = false; - this._bufferedEvents = []; -} -util.inherits(DelayedStream, Stream); - -DelayedStream.create = function(source, options) { - var delayedStream = new this(); - - options = options || {}; - for (var option in options) { - delayedStream[option] = options[option]; - } - - delayedStream.source = source; - - var realEmit = source.emit; - source.emit = function() { - delayedStream._handleEmit(arguments); - return realEmit.apply(source, arguments); - }; - - source.on('error', function() {}); - if (delayedStream.pauseStream) { - source.pause(); - } - - return delayedStream; -}; - -Object.defineProperty(DelayedStream.prototype, 'readable', { - configurable: true, - enumerable: true, - get: function() { - return this.source.readable; - } -}); - -DelayedStream.prototype.setEncoding = function() { - return this.source.setEncoding.apply(this.source, arguments); -}; - -DelayedStream.prototype.resume = function() { - if (!this._released) { - this.release(); - } - - this.source.resume(); -}; - -DelayedStream.prototype.pause = function() { - this.source.pause(); -}; - -DelayedStream.prototype.release = function() { - this._released = true; - - this._bufferedEvents.forEach(function(args) { - this.emit.apply(this, args); - }.bind(this)); - this._bufferedEvents = []; -}; - -DelayedStream.prototype.pipe = function() { - var r = Stream.prototype.pipe.apply(this, arguments); - this.resume(); - return r; -}; - -DelayedStream.prototype._handleEmit = function(args) { - if (this._released) { - this.emit.apply(this, args); - return; - } - - if (args[0] === 'data') { - this.dataSize += args[1].length; - this._checkIfMaxDataSizeExceeded(); - } - - this._bufferedEvents.push(args); -}; - -DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { - if (this._maxDataSizeExceeded) { - return; - } - - if (this.dataSize <= this.maxDataSize) { - return; - } - - this._maxDataSizeExceeded = true; - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' - this.emit('error', new Error(message)); -}; diff --git a/node_modules/delayed-stream/package.json b/node_modules/delayed-stream/package.json deleted file mode 100644 index a3cb5151..00000000 --- a/node_modules/delayed-stream/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "delayed-stream@~1.0.0", - "_id": "delayed-stream@1.0.0", - "_inBundle": false, - "_integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "_location": "/delayed-stream", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "delayed-stream@~1.0.0", - "name": "delayed-stream", - "escapedName": "delayed-stream", - "rawSpec": "~1.0.0", - "saveSpec": null, - "fetchSpec": "~1.0.0" - }, - "_requiredBy": [ - "/combined-stream" - ], - "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "_shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", - "_spec": "delayed-stream@~1.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/combined-stream", - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "bugs": { - "url": "https://github.com/felixge/node-delayed-stream/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Mike Atkins", - "email": "apeherder@gmail.com" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "Buffers events from a stream until you are ready to handle them.", - "devDependencies": { - "fake": "0.2.0", - "far": "0.0.1" - }, - "engines": { - "node": ">=0.4.0" - }, - "homepage": "https://github.com/felixge/node-delayed-stream", - "license": "MIT", - "main": "./lib/delayed_stream", - "name": "delayed-stream", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-delayed-stream.git" - }, - "scripts": { - "test": "make test" - }, - "version": "1.0.0" -} diff --git a/node_modules/ecdsa-sig-formatter/CODEOWNERS b/node_modules/ecdsa-sig-formatter/CODEOWNERS deleted file mode 100644 index 4451d3d8..00000000 --- a/node_modules/ecdsa-sig-formatter/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @omsmith diff --git a/node_modules/ecdsa-sig-formatter/LICENSE b/node_modules/ecdsa-sig-formatter/LICENSE deleted file mode 100644 index 8754ed63..00000000 --- a/node_modules/ecdsa-sig-formatter/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2015 D2L Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/ecdsa-sig-formatter/README.md b/node_modules/ecdsa-sig-formatter/README.md deleted file mode 100644 index daa95d6e..00000000 --- a/node_modules/ecdsa-sig-formatter/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# ecdsa-sig-formatter - -[![Build Status](https://travis-ci.org/Brightspace/node-ecdsa-sig-formatter.svg?branch=master)](https://travis-ci.org/Brightspace/node-ecdsa-sig-formatter) [![Coverage Status](https://coveralls.io/repos/Brightspace/node-ecdsa-sig-formatter/badge.svg)](https://coveralls.io/r/Brightspace/node-ecdsa-sig-formatter) - -Translate between JOSE and ASN.1/DER encodings for ECDSA signatures - -## Install -```sh -npm install ecdsa-sig-formatter --save -``` - -## Usage -```js -var format = require('ecdsa-sig-formatter'); - -var derSignature = '..'; // asn.1/DER encoded ecdsa signature - -var joseSignature = format.derToJose(derSignature); - -``` - -### API - ---- - -#### `.derToJose(Buffer|String signature, String alg)` -> `String` - -Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. -Returns a _base64 url_ encoded `String`. - -* If _signature_ is a `String`, it should be _base64_ encoded -* _alg_ must be one of _ES256_, _ES384_ or _ES512_ - ---- - -#### `.joseToDer(Buffer|String signature, String alg)` -> `Buffer` - -Convert the JOSE-style concatenated signature to an ASN.1/DER encoded -signature. Returns a `Buffer` - -* If _signature_ is a `String`, it should be _base64 url_ encoded -* _alg_ must be one of _ES256_, _ES384_ or _ES512_ - -## Contributing - -1. **Fork** the repository. Committing directly against this repository is - highly discouraged. - -2. Make your modifications in a branch, updating and writing new unit tests - as necessary in the `spec` directory. - -3. Ensure that all tests pass with `npm test` - -4. `rebase` your changes against master. *Do not merge*. - -5. Submit a pull request to this repository. Wait for tests to run and someone - to chime in. - -### Code Style - -This repository is configured with [EditorConfig][EditorConfig] and -[ESLint][ESLint] rules. - -[EditorConfig]: http://editorconfig.org/ -[ESLint]: http://eslint.org diff --git a/node_modules/ecdsa-sig-formatter/package.json b/node_modules/ecdsa-sig-formatter/package.json deleted file mode 100644 index 388c245f..00000000 --- a/node_modules/ecdsa-sig-formatter/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_from": "ecdsa-sig-formatter@^1.0.11", - "_id": "ecdsa-sig-formatter@1.0.11", - "_inBundle": false, - "_integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "_location": "/ecdsa-sig-formatter", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ecdsa-sig-formatter@^1.0.11", - "name": "ecdsa-sig-formatter", - "escapedName": "ecdsa-sig-formatter", - "rawSpec": "^1.0.11", - "saveSpec": null, - "fetchSpec": "^1.0.11" - }, - "_requiredBy": [ - "/google-auth-library", - "/jwa" - ], - "_resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "_shasum": "ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf", - "_spec": "ecdsa-sig-formatter@^1.0.11", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "D2L Corporation" - }, - "bugs": { - "url": "https://github.com/Brightspace/node-ecdsa-sig-formatter/issues" - }, - "bundleDependencies": false, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "deprecated": false, - "description": "Translate ECDSA signatures between ASN.1/DER and JOSE-style concatenation", - "devDependencies": { - "bench": "^0.3.6", - "chai": "^3.5.0", - "coveralls": "^2.11.9", - "eslint": "^2.12.0", - "eslint-config-brightspace": "^0.2.1", - "istanbul": "^0.4.3", - "jwk-to-pem": "^1.2.5", - "mocha": "^2.5.3", - "native-crypto": "^1.7.0" - }, - "homepage": "https://github.com/Brightspace/node-ecdsa-sig-formatter#readme", - "keywords": [ - "ecdsa", - "der", - "asn.1", - "jwt", - "jwa", - "jsonwebtoken", - "jose" - ], - "license": "Apache-2.0", - "main": "src/ecdsa-sig-formatter.js", - "name": "ecdsa-sig-formatter", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/Brightspace/node-ecdsa-sig-formatter.git" - }, - "scripts": { - "check-style": "eslint .", - "pretest": "npm run check-style", - "report-cov": "cat ./coverage/lcov.info | coveralls", - "test": "istanbul cover --root src _mocha -- spec" - }, - "typings": "./src/ecdsa-sig-formatter.d.ts", - "version": "1.0.11" -} diff --git a/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts b/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts deleted file mode 100644 index 9693aa03..00000000 --- a/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -declare module "ecdsa-sig-formatter" { - /** - * Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. Returns a base64 url encoded String. - * If signature is a String, it should be base64 encoded - * alg must be one of ES256, ES384 or ES512 - */ - export function derToJose(signature: Buffer | string, alg: string): string; - - /** - * Convert the JOSE-style concatenated signature to an ASN.1/DER encoded signature. Returns a Buffer - * If signature is a String, it should be base64 url encoded - * alg must be one of ES256, ES384 or ES512 - */ - export function joseToDer(signature: Buffer | string, alg: string): Buffer -} diff --git a/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js b/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js deleted file mode 100644 index 38eeb9b9..00000000 --- a/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js +++ /dev/null @@ -1,187 +0,0 @@ -'use strict'; - -var Buffer = require('safe-buffer').Buffer; - -var getParamBytesForAlg = require('./param-bytes-for-alg'); - -var MAX_OCTET = 0x80, - CLASS_UNIVERSAL = 0, - PRIMITIVE_BIT = 0x20, - TAG_SEQ = 0x10, - TAG_INT = 0x02, - ENCODED_TAG_SEQ = (TAG_SEQ | PRIMITIVE_BIT) | (CLASS_UNIVERSAL << 6), - ENCODED_TAG_INT = TAG_INT | (CLASS_UNIVERSAL << 6); - -function base64Url(base64) { - return base64 - .replace(/=/g, '') - .replace(/\+/g, '-') - .replace(/\//g, '_'); -} - -function signatureAsBuffer(signature) { - if (Buffer.isBuffer(signature)) { - return signature; - } else if ('string' === typeof signature) { - return Buffer.from(signature, 'base64'); - } - - throw new TypeError('ECDSA signature must be a Base64 string or a Buffer'); -} - -function derToJose(signature, alg) { - signature = signatureAsBuffer(signature); - var paramBytes = getParamBytesForAlg(alg); - - // the DER encoded param should at most be the param size, plus a padding - // zero, since due to being a signed integer - var maxEncodedParamLength = paramBytes + 1; - - var inputLength = signature.length; - - var offset = 0; - if (signature[offset++] !== ENCODED_TAG_SEQ) { - throw new Error('Could not find expected "seq"'); - } - - var seqLength = signature[offset++]; - if (seqLength === (MAX_OCTET | 1)) { - seqLength = signature[offset++]; - } - - if (inputLength - offset < seqLength) { - throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining'); - } - - if (signature[offset++] !== ENCODED_TAG_INT) { - throw new Error('Could not find expected "int" for "r"'); - } - - var rLength = signature[offset++]; - - if (inputLength - offset - 2 < rLength) { - throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available'); - } - - if (maxEncodedParamLength < rLength) { - throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable'); - } - - var rOffset = offset; - offset += rLength; - - if (signature[offset++] !== ENCODED_TAG_INT) { - throw new Error('Could not find expected "int" for "s"'); - } - - var sLength = signature[offset++]; - - if (inputLength - offset !== sLength) { - throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"'); - } - - if (maxEncodedParamLength < sLength) { - throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable'); - } - - var sOffset = offset; - offset += sLength; - - if (offset !== inputLength) { - throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain'); - } - - var rPadding = paramBytes - rLength, - sPadding = paramBytes - sLength; - - var dst = Buffer.allocUnsafe(rPadding + rLength + sPadding + sLength); - - for (offset = 0; offset < rPadding; ++offset) { - dst[offset] = 0; - } - signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength); - - offset = paramBytes; - - for (var o = offset; offset < o + sPadding; ++offset) { - dst[offset] = 0; - } - signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength); - - dst = dst.toString('base64'); - dst = base64Url(dst); - - return dst; -} - -function countPadding(buf, start, stop) { - var padding = 0; - while (start + padding < stop && buf[start + padding] === 0) { - ++padding; - } - - var needsSign = buf[start + padding] >= MAX_OCTET; - if (needsSign) { - --padding; - } - - return padding; -} - -function joseToDer(signature, alg) { - signature = signatureAsBuffer(signature); - var paramBytes = getParamBytesForAlg(alg); - - var signatureBytes = signature.length; - if (signatureBytes !== paramBytes * 2) { - throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"'); - } - - var rPadding = countPadding(signature, 0, paramBytes); - var sPadding = countPadding(signature, paramBytes, signature.length); - var rLength = paramBytes - rPadding; - var sLength = paramBytes - sPadding; - - var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength; - - var shortLength = rsBytes < MAX_OCTET; - - var dst = Buffer.allocUnsafe((shortLength ? 2 : 3) + rsBytes); - - var offset = 0; - dst[offset++] = ENCODED_TAG_SEQ; - if (shortLength) { - // Bit 8 has value "0" - // bits 7-1 give the length. - dst[offset++] = rsBytes; - } else { - // Bit 8 of first octet has value "1" - // bits 7-1 give the number of additional length octets. - dst[offset++] = MAX_OCTET | 1; - // length, base 256 - dst[offset++] = rsBytes & 0xff; - } - dst[offset++] = ENCODED_TAG_INT; - dst[offset++] = rLength; - if (rPadding < 0) { - dst[offset++] = 0; - offset += signature.copy(dst, offset, 0, paramBytes); - } else { - offset += signature.copy(dst, offset, rPadding, paramBytes); - } - dst[offset++] = ENCODED_TAG_INT; - dst[offset++] = sLength; - if (sPadding < 0) { - dst[offset++] = 0; - signature.copy(dst, offset, paramBytes); - } else { - signature.copy(dst, offset, paramBytes + sPadding); - } - - return dst; -} - -module.exports = { - derToJose: derToJose, - joseToDer: joseToDer -}; diff --git a/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js b/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js deleted file mode 100644 index 9fe67acc..00000000 --- a/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -function getParamSize(keySize) { - var result = ((keySize / 8) | 0) + (keySize % 8 === 0 ? 0 : 1); - return result; -} - -var paramBytesForAlg = { - ES256: getParamSize(256), - ES384: getParamSize(384), - ES512: getParamSize(521) -}; - -function getParamBytesForAlg(alg) { - var paramBytes = paramBytesForAlg[alg]; - if (paramBytes) { - return paramBytes; - } - - throw new Error('Unknown algorithm "' + alg + '"'); -} - -module.exports = getParamBytesForAlg; diff --git a/node_modules/event-target-shim/LICENSE b/node_modules/event-target-shim/LICENSE deleted file mode 100644 index c39e6949..00000000 --- a/node_modules/event-target-shim/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Toru Nagashima - -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. - diff --git a/node_modules/event-target-shim/README.md b/node_modules/event-target-shim/README.md deleted file mode 100644 index a4f9c1b7..00000000 --- a/node_modules/event-target-shim/README.md +++ /dev/null @@ -1,293 +0,0 @@ -# event-target-shim - -[![npm version](https://img.shields.io/npm/v/event-target-shim.svg)](https://www.npmjs.com/package/event-target-shim) -[![Downloads/month](https://img.shields.io/npm/dm/event-target-shim.svg)](http://www.npmtrends.com/event-target-shim) -[![Build Status](https://travis-ci.org/mysticatea/event-target-shim.svg?branch=master)](https://travis-ci.org/mysticatea/event-target-shim) -[![Coverage Status](https://codecov.io/gh/mysticatea/event-target-shim/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/event-target-shim) -[![Dependency Status](https://david-dm.org/mysticatea/event-target-shim.svg)](https://david-dm.org/mysticatea/event-target-shim) - -An implementation of [WHATWG EventTarget interface](https://dom.spec.whatwg.org/#interface-eventtarget), plus few extensions. - -- This provides `EventTarget` constructor that can inherit for your custom object. -- This provides an utility that defines properties of attribute listeners (e.g. `obj.onclick`). - -```js -import {EventTarget, defineEventAttribute} from "event-target-shim" - -class Foo extends EventTarget { - // ... -} - -// Define `foo.onhello` property. -defineEventAttribute(Foo.prototype, "hello") - -// Use -const foo = new Foo() -foo.addEventListener("hello", e => console.log("hello", e)) -foo.onhello = e => console.log("onhello:", e) -foo.dispatchEvent(new CustomEvent("hello")) -``` - -## 💿 Installation - -Use [npm](https://www.npmjs.com/) to install then use a bundler. - -``` -npm install event-target-shim -``` - -Or download from [`dist` directory](./dist). - -- [dist/event-target-shim.mjs](dist/event-target-shim.mjs) ... ES modules version. -- [dist/event-target-shim.js](dist/event-target-shim.js) ... Common JS version. -- [dist/event-target-shim.umd.js](dist/event-target-shim.umd.js) ... UMD (Universal Module Definition) version. This is transpiled by [Babel](https://babeljs.io/) for IE 11. - -## 📖 Usage - -```js -import {EventTarget, defineEventAttribute} from "event-target-shim" -// or -const {EventTarget, defineEventAttribute} = require("event-target-shim") - -// or UMD version defines a global variable: -const {EventTarget, defineEventAttribute} = window.EventTargetShim -``` - -### EventTarget - -> https://dom.spec.whatwg.org/#interface-eventtarget - -#### eventTarget.addEventListener(type, callback, options) - -Register an event listener. - -- `type` is a string. This is the event name to register. -- `callback` is a function. This is the event listener to register. -- `options` is a boolean or an object `{ capture?: boolean, passive?: boolean, once?: boolean }`. If this is a boolean, it's same meaning as `{ capture: options }`. - - `capture` is the flag to register the event listener for capture phase. - - `passive` is the flag to ignore `event.preventDefault()` method in the event listener. - - `once` is the flag to remove the event listener automatically after the first call. - -#### eventTarget.removeEventListener(type, callback, options) - -Unregister an event listener. - -- `type` is a string. This is the event name to unregister. -- `callback` is a function. This is the event listener to unregister. -- `options` is a boolean or an object `{ capture?: boolean }`. If this is a boolean, it's same meaning as `{ capture: options }`. - - `capture` is the flag to register the event listener for capture phase. - -#### eventTarget.dispatchEvent(event) - -Dispatch an event. - -- `event` is a [Event](https://dom.spec.whatwg.org/#event) object or an object `{ type: string, [key: string]: any }`. The latter is non-standard but useful. In both cases, listeners receive the event as implementing [Event](https://dom.spec.whatwg.org/#event) interface. - -### defineEventAttribute(proto, type) - -Define an event attribute (e.g. `onclick`) to `proto`. This is non-standard. - -- `proto` is an object (assuming it's a prototype object). This function defines a getter/setter pair for the event attribute. -- `type` is a string. This is the event name to define. - -For example: - -```js -class AbortSignal extends EventTarget { - constructor() { - this.aborted = false - } -} -// Define `onabort` property. -defineEventAttribute(AbortSignal.prototype, "abort") -``` - -### EventTarget(types) - -Define a custom `EventTarget` class with event attributes. This is non-standard. - -- `types` is a string or an array of strings. This is the event name to define. - -For example: - -```js -// This has `onabort` property. -class AbortSignal extends EventTarget("abort") { - constructor() { - this.aborted = false - } -} -``` - -## 📚 Examples - -### ES2015 and later - -> https://jsfiddle.net/636vea92/ - -```js -const {EventTarget, defineEventAttribute} = EventTargetShim - -// Define a derived class. -class Foo extends EventTarget { - // ... -} - -// Define `foo.onhello` property. -defineEventAttribute(Foo.prototype, "hello") - -// Register event listeners. -const foo = new Foo() -foo.addEventListener("hello", (e) => { - console.log("hello", e) -}) -foo.onhello = (e) => { - console.log("onhello", e) -} - -// Dispatching events -foo.dispatchEvent(new CustomEvent("hello", { detail: "detail" })) -``` - -### Typescript - -```ts -import { EventTarget, defineEventAttribute } from "event-target-shim"; - -// Define events -type FooEvents = { - hello: CustomEvent -} -type FooEventAttributes = { - onhello: CustomEvent -} - -// Define a derived class. -class Foo extends EventTarget { - // ... -} -// Define `foo.onhello` property's implementation. -defineEventAttribute(Foo.prototype, "hello") - -// Register event listeners. -const foo = new Foo() -foo.addEventListener("hello", (e) => { - console.log("hello", e.detail) -}) -foo.onhello = (e) => { - console.log("onhello", e.detail) -} - -// Dispatching events -foo.dispatchEvent(new CustomEvent("hello", { detail: "detail" })) -``` - -Unfortunately, both `FooEvents` and `FooEventAttributes` are needed because TypeScript doesn't allow the mutation of string literal types. If TypeScript allowed us to compute `"onhello"` from `"hello"` in types, `FooEventAttributes` will be optional. - -This `EventTarget` type is compatible with `EventTarget` interface of `lib.dom.d.ts`. - -#### To disallow unknown events - -By default, methods such as `addEventListener` accept unknown events. You can disallow unknown events by the third type parameter `"strict"`. - -```ts -type FooEvents = { - hello: CustomEvent -} -class Foo extends EventTarget { - // ... -} - -// OK because `hello` is defined in FooEvents. -foo.addEventListener("hello", (e) => { -}) -// Error because `unknown` is not defined in FooEvents. -foo.addEventListener("unknown", (e) => { -}) -``` - -However, if you use `"strict"` parameter, it loses compatibility with `EventTarget` interface of `lib.dom.d.ts`. - -#### To infer the type of `dispatchEvent()` method - -TypeScript cannot infer the event type of `dispatchEvent()` method properly from the argument in most cases. You can improve this behavior with the following steps: - -1. Use the third type parameter `"strict"`. This prevents inferring to `dispatchEvent()`. -2. Make the `type` property of event definitions stricter. - -```ts -type FooEvents = { - hello: CustomEvent & { type: "hello" } - hey: Event & { type: "hey" } -} -class Foo extends EventTarget { - // ... -} - -// Error because `detail` property is lacking. -foo.dispatchEvent({ type: "hello" }) -``` - -### ES5 - -> https://jsfiddle.net/522zc9de/ - -```js -// Define a derived class. -function Foo() { - EventTarget.call(this) -} -Foo.prototype = Object.create(EventTarget.prototype, { - constructor: { value: Foo, configurable: true, writable: true } - // ... -}) - -// Define `foo.onhello` property. -defineEventAttribute(Foo.prototype, "hello") - -// Register event listeners. -var foo = new Foo() -foo.addEventListener("hello", function(e) { - console.log("hello", e) -}) -foo.onhello = function(e) { - console.log("onhello", e) -} - -// Dispatching events -function isSupportEventConstrucor() { // IE does not support. - try { - new CusomEvent("hello") - return true - } catch (_err) { - return false - } -} -if (isSupportEventConstrucor()) { - foo.dispatchEvent(new CustomEvent("hello", { detail: "detail" })) -} else { - var e = document.createEvent("CustomEvent") - e.initCustomEvent("hello", false, false, "detail") - foo.dispatchEvent(e) -} -``` - -## 📰 Changelog - -- See [GitHub releases](https://github.com/mysticatea/event-target-shim/releases). - -## 🍻 Contributing - -Contributing is welcome ❤️ - -Please use GitHub issues/PRs. - -### Development tools - -- `npm install` installs dependencies for development. -- `npm test` runs tests and measures code coverage. -- `npm run clean` removes temporary files of tests. -- `npm run coverage` opens code coverage of the previous test with your default browser. -- `npm run lint` runs ESLint. -- `npm run build` generates `dist` codes. -- `npm run watch` runs tests on each file change. diff --git a/node_modules/event-target-shim/dist/event-target-shim.js b/node_modules/event-target-shim/dist/event-target-shim.js deleted file mode 100644 index 53ce2203..00000000 --- a/node_modules/event-target-shim/dist/event-target-shim.js +++ /dev/null @@ -1,871 +0,0 @@ -/** - * @author Toru Nagashima - * @copyright 2015 Toru Nagashima. All rights reserved. - * See LICENSE file in root directory for full license. - */ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/** - * @typedef {object} PrivateData - * @property {EventTarget} eventTarget The event target. - * @property {{type:string}} event The original event object. - * @property {number} eventPhase The current event phase. - * @property {EventTarget|null} currentTarget The current event target. - * @property {boolean} canceled The flag to prevent default. - * @property {boolean} stopped The flag to stop propagation. - * @property {boolean} immediateStopped The flag to stop propagation immediately. - * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null. - * @property {number} timeStamp The unix time. - * @private - */ - -/** - * Private data for event wrappers. - * @type {WeakMap} - * @private - */ -const privateData = new WeakMap(); - -/** - * Cache for wrapper classes. - * @type {WeakMap} - * @private - */ -const wrappers = new WeakMap(); - -/** - * Get private data. - * @param {Event} event The event object to get private data. - * @returns {PrivateData} The private data of the event. - * @private - */ -function pd(event) { - const retv = privateData.get(event); - console.assert( - retv != null, - "'this' is expected an Event object, but got", - event - ); - return retv -} - -/** - * https://dom.spec.whatwg.org/#set-the-canceled-flag - * @param data {PrivateData} private data. - */ -function setCancelFlag(data) { - if (data.passiveListener != null) { - if ( - typeof console !== "undefined" && - typeof console.error === "function" - ) { - console.error( - "Unable to preventDefault inside passive event listener invocation.", - data.passiveListener - ); - } - return - } - if (!data.event.cancelable) { - return - } - - data.canceled = true; - if (typeof data.event.preventDefault === "function") { - data.event.preventDefault(); - } -} - -/** - * @see https://dom.spec.whatwg.org/#interface-event - * @private - */ -/** - * The event wrapper. - * @constructor - * @param {EventTarget} eventTarget The event target of this dispatching. - * @param {Event|{type:string}} event The original event to wrap. - */ -function Event(eventTarget, event) { - privateData.set(this, { - eventTarget, - event, - eventPhase: 2, - currentTarget: eventTarget, - canceled: false, - stopped: false, - immediateStopped: false, - passiveListener: null, - timeStamp: event.timeStamp || Date.now(), - }); - - // https://heycam.github.io/webidl/#Unforgeable - Object.defineProperty(this, "isTrusted", { value: false, enumerable: true }); - - // Define accessors - const keys = Object.keys(event); - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - if (!(key in this)) { - Object.defineProperty(this, key, defineRedirectDescriptor(key)); - } - } -} - -// Should be enumerable, but class methods are not enumerable. -Event.prototype = { - /** - * The type of this event. - * @type {string} - */ - get type() { - return pd(this).event.type - }, - - /** - * The target of this event. - * @type {EventTarget} - */ - get target() { - return pd(this).eventTarget - }, - - /** - * The target of this event. - * @type {EventTarget} - */ - get currentTarget() { - return pd(this).currentTarget - }, - - /** - * @returns {EventTarget[]} The composed path of this event. - */ - composedPath() { - const currentTarget = pd(this).currentTarget; - if (currentTarget == null) { - return [] - } - return [currentTarget] - }, - - /** - * Constant of NONE. - * @type {number} - */ - get NONE() { - return 0 - }, - - /** - * Constant of CAPTURING_PHASE. - * @type {number} - */ - get CAPTURING_PHASE() { - return 1 - }, - - /** - * Constant of AT_TARGET. - * @type {number} - */ - get AT_TARGET() { - return 2 - }, - - /** - * Constant of BUBBLING_PHASE. - * @type {number} - */ - get BUBBLING_PHASE() { - return 3 - }, - - /** - * The target of this event. - * @type {number} - */ - get eventPhase() { - return pd(this).eventPhase - }, - - /** - * Stop event bubbling. - * @returns {void} - */ - stopPropagation() { - const data = pd(this); - - data.stopped = true; - if (typeof data.event.stopPropagation === "function") { - data.event.stopPropagation(); - } - }, - - /** - * Stop event bubbling. - * @returns {void} - */ - stopImmediatePropagation() { - const data = pd(this); - - data.stopped = true; - data.immediateStopped = true; - if (typeof data.event.stopImmediatePropagation === "function") { - data.event.stopImmediatePropagation(); - } - }, - - /** - * The flag to be bubbling. - * @type {boolean} - */ - get bubbles() { - return Boolean(pd(this).event.bubbles) - }, - - /** - * The flag to be cancelable. - * @type {boolean} - */ - get cancelable() { - return Boolean(pd(this).event.cancelable) - }, - - /** - * Cancel this event. - * @returns {void} - */ - preventDefault() { - setCancelFlag(pd(this)); - }, - - /** - * The flag to indicate cancellation state. - * @type {boolean} - */ - get defaultPrevented() { - return pd(this).canceled - }, - - /** - * The flag to be composed. - * @type {boolean} - */ - get composed() { - return Boolean(pd(this).event.composed) - }, - - /** - * The unix time of this event. - * @type {number} - */ - get timeStamp() { - return pd(this).timeStamp - }, - - /** - * The target of this event. - * @type {EventTarget} - * @deprecated - */ - get srcElement() { - return pd(this).eventTarget - }, - - /** - * The flag to stop event bubbling. - * @type {boolean} - * @deprecated - */ - get cancelBubble() { - return pd(this).stopped - }, - set cancelBubble(value) { - if (!value) { - return - } - const data = pd(this); - - data.stopped = true; - if (typeof data.event.cancelBubble === "boolean") { - data.event.cancelBubble = true; - } - }, - - /** - * The flag to indicate cancellation state. - * @type {boolean} - * @deprecated - */ - get returnValue() { - return !pd(this).canceled - }, - set returnValue(value) { - if (!value) { - setCancelFlag(pd(this)); - } - }, - - /** - * Initialize this event object. But do nothing under event dispatching. - * @param {string} type The event type. - * @param {boolean} [bubbles=false] The flag to be possible to bubble up. - * @param {boolean} [cancelable=false] The flag to be possible to cancel. - * @deprecated - */ - initEvent() { - // Do nothing. - }, -}; - -// `constructor` is not enumerable. -Object.defineProperty(Event.prototype, "constructor", { - value: Event, - configurable: true, - writable: true, -}); - -// Ensure `event instanceof window.Event` is `true`. -if (typeof window !== "undefined" && typeof window.Event !== "undefined") { - Object.setPrototypeOf(Event.prototype, window.Event.prototype); - - // Make association for wrappers. - wrappers.set(window.Event.prototype, Event); -} - -/** - * Get the property descriptor to redirect a given property. - * @param {string} key Property name to define property descriptor. - * @returns {PropertyDescriptor} The property descriptor to redirect the property. - * @private - */ -function defineRedirectDescriptor(key) { - return { - get() { - return pd(this).event[key] - }, - set(value) { - pd(this).event[key] = value; - }, - configurable: true, - enumerable: true, - } -} - -/** - * Get the property descriptor to call a given method property. - * @param {string} key Property name to define property descriptor. - * @returns {PropertyDescriptor} The property descriptor to call the method property. - * @private - */ -function defineCallDescriptor(key) { - return { - value() { - const event = pd(this).event; - return event[key].apply(event, arguments) - }, - configurable: true, - enumerable: true, - } -} - -/** - * Define new wrapper class. - * @param {Function} BaseEvent The base wrapper class. - * @param {Object} proto The prototype of the original event. - * @returns {Function} The defined wrapper class. - * @private - */ -function defineWrapper(BaseEvent, proto) { - const keys = Object.keys(proto); - if (keys.length === 0) { - return BaseEvent - } - - /** CustomEvent */ - function CustomEvent(eventTarget, event) { - BaseEvent.call(this, eventTarget, event); - } - - CustomEvent.prototype = Object.create(BaseEvent.prototype, { - constructor: { value: CustomEvent, configurable: true, writable: true }, - }); - - // Define accessors. - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - if (!(key in BaseEvent.prototype)) { - const descriptor = Object.getOwnPropertyDescriptor(proto, key); - const isFunc = typeof descriptor.value === "function"; - Object.defineProperty( - CustomEvent.prototype, - key, - isFunc - ? defineCallDescriptor(key) - : defineRedirectDescriptor(key) - ); - } - } - - return CustomEvent -} - -/** - * Get the wrapper class of a given prototype. - * @param {Object} proto The prototype of the original event to get its wrapper. - * @returns {Function} The wrapper class. - * @private - */ -function getWrapper(proto) { - if (proto == null || proto === Object.prototype) { - return Event - } - - let wrapper = wrappers.get(proto); - if (wrapper == null) { - wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto); - wrappers.set(proto, wrapper); - } - return wrapper -} - -/** - * Wrap a given event to management a dispatching. - * @param {EventTarget} eventTarget The event target of this dispatching. - * @param {Object} event The event to wrap. - * @returns {Event} The wrapper instance. - * @private - */ -function wrapEvent(eventTarget, event) { - const Wrapper = getWrapper(Object.getPrototypeOf(event)); - return new Wrapper(eventTarget, event) -} - -/** - * Get the immediateStopped flag of a given event. - * @param {Event} event The event to get. - * @returns {boolean} The flag to stop propagation immediately. - * @private - */ -function isStopped(event) { - return pd(event).immediateStopped -} - -/** - * Set the current event phase of a given event. - * @param {Event} event The event to set current target. - * @param {number} eventPhase New event phase. - * @returns {void} - * @private - */ -function setEventPhase(event, eventPhase) { - pd(event).eventPhase = eventPhase; -} - -/** - * Set the current target of a given event. - * @param {Event} event The event to set current target. - * @param {EventTarget|null} currentTarget New current target. - * @returns {void} - * @private - */ -function setCurrentTarget(event, currentTarget) { - pd(event).currentTarget = currentTarget; -} - -/** - * Set a passive listener of a given event. - * @param {Event} event The event to set current target. - * @param {Function|null} passiveListener New passive listener. - * @returns {void} - * @private - */ -function setPassiveListener(event, passiveListener) { - pd(event).passiveListener = passiveListener; -} - -/** - * @typedef {object} ListenerNode - * @property {Function} listener - * @property {1|2|3} listenerType - * @property {boolean} passive - * @property {boolean} once - * @property {ListenerNode|null} next - * @private - */ - -/** - * @type {WeakMap>} - * @private - */ -const listenersMap = new WeakMap(); - -// Listener types -const CAPTURE = 1; -const BUBBLE = 2; -const ATTRIBUTE = 3; - -/** - * Check whether a given value is an object or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if the value is an object. - */ -function isObject(x) { - return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax -} - -/** - * Get listeners. - * @param {EventTarget} eventTarget The event target to get. - * @returns {Map} The listeners. - * @private - */ -function getListeners(eventTarget) { - const listeners = listenersMap.get(eventTarget); - if (listeners == null) { - throw new TypeError( - "'this' is expected an EventTarget object, but got another value." - ) - } - return listeners -} - -/** - * Get the property descriptor for the event attribute of a given event. - * @param {string} eventName The event name to get property descriptor. - * @returns {PropertyDescriptor} The property descriptor. - * @private - */ -function defineEventAttributeDescriptor(eventName) { - return { - get() { - const listeners = getListeners(this); - let node = listeners.get(eventName); - while (node != null) { - if (node.listenerType === ATTRIBUTE) { - return node.listener - } - node = node.next; - } - return null - }, - - set(listener) { - if (typeof listener !== "function" && !isObject(listener)) { - listener = null; // eslint-disable-line no-param-reassign - } - const listeners = getListeners(this); - - // Traverse to the tail while removing old value. - let prev = null; - let node = listeners.get(eventName); - while (node != null) { - if (node.listenerType === ATTRIBUTE) { - // Remove old value. - if (prev !== null) { - prev.next = node.next; - } else if (node.next !== null) { - listeners.set(eventName, node.next); - } else { - listeners.delete(eventName); - } - } else { - prev = node; - } - - node = node.next; - } - - // Add new value. - if (listener !== null) { - const newNode = { - listener, - listenerType: ATTRIBUTE, - passive: false, - once: false, - next: null, - }; - if (prev === null) { - listeners.set(eventName, newNode); - } else { - prev.next = newNode; - } - } - }, - configurable: true, - enumerable: true, - } -} - -/** - * Define an event attribute (e.g. `eventTarget.onclick`). - * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite. - * @param {string} eventName The event name to define. - * @returns {void} - */ -function defineEventAttribute(eventTargetPrototype, eventName) { - Object.defineProperty( - eventTargetPrototype, - `on${eventName}`, - defineEventAttributeDescriptor(eventName) - ); -} - -/** - * Define a custom EventTarget with event attributes. - * @param {string[]} eventNames Event names for event attributes. - * @returns {EventTarget} The custom EventTarget. - * @private - */ -function defineCustomEventTarget(eventNames) { - /** CustomEventTarget */ - function CustomEventTarget() { - EventTarget.call(this); - } - - CustomEventTarget.prototype = Object.create(EventTarget.prototype, { - constructor: { - value: CustomEventTarget, - configurable: true, - writable: true, - }, - }); - - for (let i = 0; i < eventNames.length; ++i) { - defineEventAttribute(CustomEventTarget.prototype, eventNames[i]); - } - - return CustomEventTarget -} - -/** - * EventTarget. - * - * - This is constructor if no arguments. - * - This is a function which returns a CustomEventTarget constructor if there are arguments. - * - * For example: - * - * class A extends EventTarget {} - * class B extends EventTarget("message") {} - * class C extends EventTarget("message", "error") {} - * class D extends EventTarget(["message", "error"]) {} - */ -function EventTarget() { - /*eslint-disable consistent-return */ - if (this instanceof EventTarget) { - listenersMap.set(this, new Map()); - return - } - if (arguments.length === 1 && Array.isArray(arguments[0])) { - return defineCustomEventTarget(arguments[0]) - } - if (arguments.length > 0) { - const types = new Array(arguments.length); - for (let i = 0; i < arguments.length; ++i) { - types[i] = arguments[i]; - } - return defineCustomEventTarget(types) - } - throw new TypeError("Cannot call a class as a function") - /*eslint-enable consistent-return */ -} - -// Should be enumerable, but class methods are not enumerable. -EventTarget.prototype = { - /** - * Add a given listener to this event target. - * @param {string} eventName The event name to add. - * @param {Function} listener The listener to add. - * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. - * @returns {void} - */ - addEventListener(eventName, listener, options) { - if (listener == null) { - return - } - if (typeof listener !== "function" && !isObject(listener)) { - throw new TypeError("'listener' should be a function or an object.") - } - - const listeners = getListeners(this); - const optionsIsObj = isObject(options); - const capture = optionsIsObj - ? Boolean(options.capture) - : Boolean(options); - const listenerType = capture ? CAPTURE : BUBBLE; - const newNode = { - listener, - listenerType, - passive: optionsIsObj && Boolean(options.passive), - once: optionsIsObj && Boolean(options.once), - next: null, - }; - - // Set it as the first node if the first node is null. - let node = listeners.get(eventName); - if (node === undefined) { - listeners.set(eventName, newNode); - return - } - - // Traverse to the tail while checking duplication.. - let prev = null; - while (node != null) { - if ( - node.listener === listener && - node.listenerType === listenerType - ) { - // Should ignore duplication. - return - } - prev = node; - node = node.next; - } - - // Add it. - prev.next = newNode; - }, - - /** - * Remove a given listener from this event target. - * @param {string} eventName The event name to remove. - * @param {Function} listener The listener to remove. - * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. - * @returns {void} - */ - removeEventListener(eventName, listener, options) { - if (listener == null) { - return - } - - const listeners = getListeners(this); - const capture = isObject(options) - ? Boolean(options.capture) - : Boolean(options); - const listenerType = capture ? CAPTURE : BUBBLE; - - let prev = null; - let node = listeners.get(eventName); - while (node != null) { - if ( - node.listener === listener && - node.listenerType === listenerType - ) { - if (prev !== null) { - prev.next = node.next; - } else if (node.next !== null) { - listeners.set(eventName, node.next); - } else { - listeners.delete(eventName); - } - return - } - - prev = node; - node = node.next; - } - }, - - /** - * Dispatch a given event. - * @param {Event|{type:string}} event The event to dispatch. - * @returns {boolean} `false` if canceled. - */ - dispatchEvent(event) { - if (event == null || typeof event.type !== "string") { - throw new TypeError('"event.type" should be a string.') - } - - // If listeners aren't registered, terminate. - const listeners = getListeners(this); - const eventName = event.type; - let node = listeners.get(eventName); - if (node == null) { - return true - } - - // Since we cannot rewrite several properties, so wrap object. - const wrappedEvent = wrapEvent(this, event); - - // This doesn't process capturing phase and bubbling phase. - // This isn't participating in a tree. - let prev = null; - while (node != null) { - // Remove this listener if it's once - if (node.once) { - if (prev !== null) { - prev.next = node.next; - } else if (node.next !== null) { - listeners.set(eventName, node.next); - } else { - listeners.delete(eventName); - } - } else { - prev = node; - } - - // Call this listener - setPassiveListener( - wrappedEvent, - node.passive ? node.listener : null - ); - if (typeof node.listener === "function") { - try { - node.listener.call(this, wrappedEvent); - } catch (err) { - if ( - typeof console !== "undefined" && - typeof console.error === "function" - ) { - console.error(err); - } - } - } else if ( - node.listenerType !== ATTRIBUTE && - typeof node.listener.handleEvent === "function" - ) { - node.listener.handleEvent(wrappedEvent); - } - - // Break if `event.stopImmediatePropagation` was called. - if (isStopped(wrappedEvent)) { - break - } - - node = node.next; - } - setPassiveListener(wrappedEvent, null); - setEventPhase(wrappedEvent, 0); - setCurrentTarget(wrappedEvent, null); - - return !wrappedEvent.defaultPrevented - }, -}; - -// `constructor` is not enumerable. -Object.defineProperty(EventTarget.prototype, "constructor", { - value: EventTarget, - configurable: true, - writable: true, -}); - -// Ensure `eventTarget instanceof window.EventTarget` is `true`. -if ( - typeof window !== "undefined" && - typeof window.EventTarget !== "undefined" -) { - Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype); -} - -exports.defineEventAttribute = defineEventAttribute; -exports.EventTarget = EventTarget; -exports.default = EventTarget; - -module.exports = EventTarget -module.exports.EventTarget = module.exports["default"] = EventTarget -module.exports.defineEventAttribute = defineEventAttribute -//# sourceMappingURL=event-target-shim.js.map diff --git a/node_modules/event-target-shim/dist/event-target-shim.js.map b/node_modules/event-target-shim/dist/event-target-shim.js.map deleted file mode 100644 index 83c5f626..00000000 --- a/node_modules/event-target-shim/dist/event-target-shim.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"event-target-shim.js","sources":["../src/event.mjs","../src/event-target.mjs"],"sourcesContent":["/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap}\n * @private\n */\nconst privateData = new WeakMap()\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap}\n * @private\n */\nconst wrappers = new WeakMap()\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event)\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n )\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n )\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault()\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n })\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true })\n\n // Define accessors\n const keys = Object.keys(event)\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key))\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation()\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this)\n\n data.stopped = true\n data.immediateStopped = true\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation()\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this))\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this))\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n})\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype)\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event)\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto)\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event)\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n })\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key)\n const isFunc = typeof descriptor.value === \"function\"\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n )\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto)\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto)\n wrappers.set(proto, wrapper)\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nexport function wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event))\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nexport function isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nexport function setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nexport function setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nexport function setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener\n}\n","import {\n isStopped,\n setCurrentTarget,\n setEventPhase,\n setPassiveListener,\n wrapEvent,\n} from \"./event.mjs\"\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap>}\n * @private\n */\nconst listenersMap = new WeakMap()\n\n// Listener types\nconst CAPTURE = 1\nconst BUBBLE = 2\nconst ATTRIBUTE = 3\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget)\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this)\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this)\n\n // Traverse to the tail while removing old value.\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n node = node.next\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n }\n if (prev === null) {\n listeners.set(eventName, newNode)\n } else {\n prev.next = newNode\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n )\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this)\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n })\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i])\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map())\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length)\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i]\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this)\n const optionsIsObj = isObject(options)\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n }\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName)\n if (node === undefined) {\n listeners.set(eventName, newNode)\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node\n node = node.next\n }\n\n // Add it.\n prev.next = newNode\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this)\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n return\n }\n\n prev = node\n node = node.next\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this)\n const eventName = event.type\n let node = listeners.get(eventName)\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event)\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n )\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent)\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err)\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent)\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next\n }\n setPassiveListener(wrappedEvent, null)\n setEventPhase(wrappedEvent, 0)\n setCurrentTarget(wrappedEvent, null)\n\n return !wrappedEvent.defaultPrevented\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n})\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype)\n}\n\nexport { defineEventAttribute, EventTarget }\nexport default EventTarget\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAW,GAAG,IAAI,OAAO,GAAE;;;;;;;AAOjC,MAAM,QAAQ,GAAG,IAAI,OAAO,GAAE;;;;;;;;AAQ9B,SAAS,EAAE,CAAC,KAAK,EAAE;IACf,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,EAAC;IACnC,OAAO,CAAC,MAAM;QACV,IAAI,IAAI,IAAI;QACZ,6CAA6C;QAC7C,KAAK;MACR;IACD,OAAO,IAAI;CACd;;;;;;AAMD,SAAS,aAAa,CAAC,IAAI,EAAE;IACzB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,EAAE;QAC9B;YACI,OAAO,OAAO,KAAK,WAAW;YAC9B,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU;UACrC;YACE,OAAO,CAAC,KAAK;gBACT,oEAAoE;gBACpE,IAA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AAK,WAAW;wBAC9B,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU;sBACrC;wBACE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAC;qBACrB;iBACJ;aACJ,MAAM;gBACH,IAAI,CAAC,YAAY,KAAK,SAAS;gBAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,KAAK,UAAU;cACjD;gBACE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,EAAC;aAC1C;;;YAGD,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE;gBACzB,KAAK;aACR;;YAED,IAAI,GAAG,IAAI,CAAC,KAAI;SACnB;QACD,kBAAkB,CAAC,YAAY,EAAE,IAAI,EAAC;QACtC,aAAa,CAAC,YAAY,EAAE,CAAC,EAAC;QAC9B,gBAAgB,CAAC,YAAY,EAAE,IAAI,EAAC;;QAEpC,OAAO,CAAC,YAAY,CAAC,gBAAgB;KACxC;EACJ;;;AAGD,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE;IACxD,KAAK,EAAE,WAAW;IAClB,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,IAAI;CACjB,EAAC;;;AAGF;IACI,OAAO,MAAM,KAAK,WAAW;IAC7B,OAAO,MAAM,CAAC,WAAW,KAAK,WAAW;EAC3C;IACE,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EAAC;CAC7E;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/event-target-shim/dist/event-target-shim.mjs b/node_modules/event-target-shim/dist/event-target-shim.mjs deleted file mode 100644 index 114f3a17..00000000 --- a/node_modules/event-target-shim/dist/event-target-shim.mjs +++ /dev/null @@ -1,862 +0,0 @@ -/** - * @author Toru Nagashima - * @copyright 2015 Toru Nagashima. All rights reserved. - * See LICENSE file in root directory for full license. - */ -/** - * @typedef {object} PrivateData - * @property {EventTarget} eventTarget The event target. - * @property {{type:string}} event The original event object. - * @property {number} eventPhase The current event phase. - * @property {EventTarget|null} currentTarget The current event target. - * @property {boolean} canceled The flag to prevent default. - * @property {boolean} stopped The flag to stop propagation. - * @property {boolean} immediateStopped The flag to stop propagation immediately. - * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null. - * @property {number} timeStamp The unix time. - * @private - */ - -/** - * Private data for event wrappers. - * @type {WeakMap} - * @private - */ -const privateData = new WeakMap(); - -/** - * Cache for wrapper classes. - * @type {WeakMap} - * @private - */ -const wrappers = new WeakMap(); - -/** - * Get private data. - * @param {Event} event The event object to get private data. - * @returns {PrivateData} The private data of the event. - * @private - */ -function pd(event) { - const retv = privateData.get(event); - console.assert( - retv != null, - "'this' is expected an Event object, but got", - event - ); - return retv -} - -/** - * https://dom.spec.whatwg.org/#set-the-canceled-flag - * @param data {PrivateData} private data. - */ -function setCancelFlag(data) { - if (data.passiveListener != null) { - if ( - typeof console !== "undefined" && - typeof console.error === "function" - ) { - console.error( - "Unable to preventDefault inside passive event listener invocation.", - data.passiveListener - ); - } - return - } - if (!data.event.cancelable) { - return - } - - data.canceled = true; - if (typeof data.event.preventDefault === "function") { - data.event.preventDefault(); - } -} - -/** - * @see https://dom.spec.whatwg.org/#interface-event - * @private - */ -/** - * The event wrapper. - * @constructor - * @param {EventTarget} eventTarget The event target of this dispatching. - * @param {Event|{type:string}} event The original event to wrap. - */ -function Event(eventTarget, event) { - privateData.set(this, { - eventTarget, - event, - eventPhase: 2, - currentTarget: eventTarget, - canceled: false, - stopped: false, - immediateStopped: false, - passiveListener: null, - timeStamp: event.timeStamp || Date.now(), - }); - - // https://heycam.github.io/webidl/#Unforgeable - Object.defineProperty(this, "isTrusted", { value: false, enumerable: true }); - - // Define accessors - const keys = Object.keys(event); - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - if (!(key in this)) { - Object.defineProperty(this, key, defineRedirectDescriptor(key)); - } - } -} - -// Should be enumerable, but class methods are not enumerable. -Event.prototype = { - /** - * The type of this event. - * @type {string} - */ - get type() { - return pd(this).event.type - }, - - /** - * The target of this event. - * @type {EventTarget} - */ - get target() { - return pd(this).eventTarget - }, - - /** - * The target of this event. - * @type {EventTarget} - */ - get currentTarget() { - return pd(this).currentTarget - }, - - /** - * @returns {EventTarget[]} The composed path of this event. - */ - composedPath() { - const currentTarget = pd(this).currentTarget; - if (currentTarget == null) { - return [] - } - return [currentTarget] - }, - - /** - * Constant of NONE. - * @type {number} - */ - get NONE() { - return 0 - }, - - /** - * Constant of CAPTURING_PHASE. - * @type {number} - */ - get CAPTURING_PHASE() { - return 1 - }, - - /** - * Constant of AT_TARGET. - * @type {number} - */ - get AT_TARGET() { - return 2 - }, - - /** - * Constant of BUBBLING_PHASE. - * @type {number} - */ - get BUBBLING_PHASE() { - return 3 - }, - - /** - * The target of this event. - * @type {number} - */ - get eventPhase() { - return pd(this).eventPhase - }, - - /** - * Stop event bubbling. - * @returns {void} - */ - stopPropagation() { - const data = pd(this); - - data.stopped = true; - if (typeof data.event.stopPropagation === "function") { - data.event.stopPropagation(); - } - }, - - /** - * Stop event bubbling. - * @returns {void} - */ - stopImmediatePropagation() { - const data = pd(this); - - data.stopped = true; - data.immediateStopped = true; - if (typeof data.event.stopImmediatePropagation === "function") { - data.event.stopImmediatePropagation(); - } - }, - - /** - * The flag to be bubbling. - * @type {boolean} - */ - get bubbles() { - return Boolean(pd(this).event.bubbles) - }, - - /** - * The flag to be cancelable. - * @type {boolean} - */ - get cancelable() { - return Boolean(pd(this).event.cancelable) - }, - - /** - * Cancel this event. - * @returns {void} - */ - preventDefault() { - setCancelFlag(pd(this)); - }, - - /** - * The flag to indicate cancellation state. - * @type {boolean} - */ - get defaultPrevented() { - return pd(this).canceled - }, - - /** - * The flag to be composed. - * @type {boolean} - */ - get composed() { - return Boolean(pd(this).event.composed) - }, - - /** - * The unix time of this event. - * @type {number} - */ - get timeStamp() { - return pd(this).timeStamp - }, - - /** - * The target of this event. - * @type {EventTarget} - * @deprecated - */ - get srcElement() { - return pd(this).eventTarget - }, - - /** - * The flag to stop event bubbling. - * @type {boolean} - * @deprecated - */ - get cancelBubble() { - return pd(this).stopped - }, - set cancelBubble(value) { - if (!value) { - return - } - const data = pd(this); - - data.stopped = true; - if (typeof data.event.cancelBubble === "boolean") { - data.event.cancelBubble = true; - } - }, - - /** - * The flag to indicate cancellation state. - * @type {boolean} - * @deprecated - */ - get returnValue() { - return !pd(this).canceled - }, - set returnValue(value) { - if (!value) { - setCancelFlag(pd(this)); - } - }, - - /** - * Initialize this event object. But do nothing under event dispatching. - * @param {string} type The event type. - * @param {boolean} [bubbles=false] The flag to be possible to bubble up. - * @param {boolean} [cancelable=false] The flag to be possible to cancel. - * @deprecated - */ - initEvent() { - // Do nothing. - }, -}; - -// `constructor` is not enumerable. -Object.defineProperty(Event.prototype, "constructor", { - value: Event, - configurable: true, - writable: true, -}); - -// Ensure `event instanceof window.Event` is `true`. -if (typeof window !== "undefined" && typeof window.Event !== "undefined") { - Object.setPrototypeOf(Event.prototype, window.Event.prototype); - - // Make association for wrappers. - wrappers.set(window.Event.prototype, Event); -} - -/** - * Get the property descriptor to redirect a given property. - * @param {string} key Property name to define property descriptor. - * @returns {PropertyDescriptor} The property descriptor to redirect the property. - * @private - */ -function defineRedirectDescriptor(key) { - return { - get() { - return pd(this).event[key] - }, - set(value) { - pd(this).event[key] = value; - }, - configurable: true, - enumerable: true, - } -} - -/** - * Get the property descriptor to call a given method property. - * @param {string} key Property name to define property descriptor. - * @returns {PropertyDescriptor} The property descriptor to call the method property. - * @private - */ -function defineCallDescriptor(key) { - return { - value() { - const event = pd(this).event; - return event[key].apply(event, arguments) - }, - configurable: true, - enumerable: true, - } -} - -/** - * Define new wrapper class. - * @param {Function} BaseEvent The base wrapper class. - * @param {Object} proto The prototype of the original event. - * @returns {Function} The defined wrapper class. - * @private - */ -function defineWrapper(BaseEvent, proto) { - const keys = Object.keys(proto); - if (keys.length === 0) { - return BaseEvent - } - - /** CustomEvent */ - function CustomEvent(eventTarget, event) { - BaseEvent.call(this, eventTarget, event); - } - - CustomEvent.prototype = Object.create(BaseEvent.prototype, { - constructor: { value: CustomEvent, configurable: true, writable: true }, - }); - - // Define accessors. - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - if (!(key in BaseEvent.prototype)) { - const descriptor = Object.getOwnPropertyDescriptor(proto, key); - const isFunc = typeof descriptor.value === "function"; - Object.defineProperty( - CustomEvent.prototype, - key, - isFunc - ? defineCallDescriptor(key) - : defineRedirectDescriptor(key) - ); - } - } - - return CustomEvent -} - -/** - * Get the wrapper class of a given prototype. - * @param {Object} proto The prototype of the original event to get its wrapper. - * @returns {Function} The wrapper class. - * @private - */ -function getWrapper(proto) { - if (proto == null || proto === Object.prototype) { - return Event - } - - let wrapper = wrappers.get(proto); - if (wrapper == null) { - wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto); - wrappers.set(proto, wrapper); - } - return wrapper -} - -/** - * Wrap a given event to management a dispatching. - * @param {EventTarget} eventTarget The event target of this dispatching. - * @param {Object} event The event to wrap. - * @returns {Event} The wrapper instance. - * @private - */ -function wrapEvent(eventTarget, event) { - const Wrapper = getWrapper(Object.getPrototypeOf(event)); - return new Wrapper(eventTarget, event) -} - -/** - * Get the immediateStopped flag of a given event. - * @param {Event} event The event to get. - * @returns {boolean} The flag to stop propagation immediately. - * @private - */ -function isStopped(event) { - return pd(event).immediateStopped -} - -/** - * Set the current event phase of a given event. - * @param {Event} event The event to set current target. - * @param {number} eventPhase New event phase. - * @returns {void} - * @private - */ -function setEventPhase(event, eventPhase) { - pd(event).eventPhase = eventPhase; -} - -/** - * Set the current target of a given event. - * @param {Event} event The event to set current target. - * @param {EventTarget|null} currentTarget New current target. - * @returns {void} - * @private - */ -function setCurrentTarget(event, currentTarget) { - pd(event).currentTarget = currentTarget; -} - -/** - * Set a passive listener of a given event. - * @param {Event} event The event to set current target. - * @param {Function|null} passiveListener New passive listener. - * @returns {void} - * @private - */ -function setPassiveListener(event, passiveListener) { - pd(event).passiveListener = passiveListener; -} - -/** - * @typedef {object} ListenerNode - * @property {Function} listener - * @property {1|2|3} listenerType - * @property {boolean} passive - * @property {boolean} once - * @property {ListenerNode|null} next - * @private - */ - -/** - * @type {WeakMap>} - * @private - */ -const listenersMap = new WeakMap(); - -// Listener types -const CAPTURE = 1; -const BUBBLE = 2; -const ATTRIBUTE = 3; - -/** - * Check whether a given value is an object or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if the value is an object. - */ -function isObject(x) { - return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax -} - -/** - * Get listeners. - * @param {EventTarget} eventTarget The event target to get. - * @returns {Map} The listeners. - * @private - */ -function getListeners(eventTarget) { - const listeners = listenersMap.get(eventTarget); - if (listeners == null) { - throw new TypeError( - "'this' is expected an EventTarget object, but got another value." - ) - } - return listeners -} - -/** - * Get the property descriptor for the event attribute of a given event. - * @param {string} eventName The event name to get property descriptor. - * @returns {PropertyDescriptor} The property descriptor. - * @private - */ -function defineEventAttributeDescriptor(eventName) { - return { - get() { - const listeners = getListeners(this); - let node = listeners.get(eventName); - while (node != null) { - if (node.listenerType === ATTRIBUTE) { - return node.listener - } - node = node.next; - } - return null - }, - - set(listener) { - if (typeof listener !== "function" && !isObject(listener)) { - listener = null; // eslint-disable-line no-param-reassign - } - const listeners = getListeners(this); - - // Traverse to the tail while removing old value. - let prev = null; - let node = listeners.get(eventName); - while (node != null) { - if (node.listenerType === ATTRIBUTE) { - // Remove old value. - if (prev !== null) { - prev.next = node.next; - } else if (node.next !== null) { - listeners.set(eventName, node.next); - } else { - listeners.delete(eventName); - } - } else { - prev = node; - } - - node = node.next; - } - - // Add new value. - if (listener !== null) { - const newNode = { - listener, - listenerType: ATTRIBUTE, - passive: false, - once: false, - next: null, - }; - if (prev === null) { - listeners.set(eventName, newNode); - } else { - prev.next = newNode; - } - } - }, - configurable: true, - enumerable: true, - } -} - -/** - * Define an event attribute (e.g. `eventTarget.onclick`). - * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite. - * @param {string} eventName The event name to define. - * @returns {void} - */ -function defineEventAttribute(eventTargetPrototype, eventName) { - Object.defineProperty( - eventTargetPrototype, - `on${eventName}`, - defineEventAttributeDescriptor(eventName) - ); -} - -/** - * Define a custom EventTarget with event attributes. - * @param {string[]} eventNames Event names for event attributes. - * @returns {EventTarget} The custom EventTarget. - * @private - */ -function defineCustomEventTarget(eventNames) { - /** CustomEventTarget */ - function CustomEventTarget() { - EventTarget.call(this); - } - - CustomEventTarget.prototype = Object.create(EventTarget.prototype, { - constructor: { - value: CustomEventTarget, - configurable: true, - writable: true, - }, - }); - - for (let i = 0; i < eventNames.length; ++i) { - defineEventAttribute(CustomEventTarget.prototype, eventNames[i]); - } - - return CustomEventTarget -} - -/** - * EventTarget. - * - * - This is constructor if no arguments. - * - This is a function which returns a CustomEventTarget constructor if there are arguments. - * - * For example: - * - * class A extends EventTarget {} - * class B extends EventTarget("message") {} - * class C extends EventTarget("message", "error") {} - * class D extends EventTarget(["message", "error"]) {} - */ -function EventTarget() { - /*eslint-disable consistent-return */ - if (this instanceof EventTarget) { - listenersMap.set(this, new Map()); - return - } - if (arguments.length === 1 && Array.isArray(arguments[0])) { - return defineCustomEventTarget(arguments[0]) - } - if (arguments.length > 0) { - const types = new Array(arguments.length); - for (let i = 0; i < arguments.length; ++i) { - types[i] = arguments[i]; - } - return defineCustomEventTarget(types) - } - throw new TypeError("Cannot call a class as a function") - /*eslint-enable consistent-return */ -} - -// Should be enumerable, but class methods are not enumerable. -EventTarget.prototype = { - /** - * Add a given listener to this event target. - * @param {string} eventName The event name to add. - * @param {Function} listener The listener to add. - * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. - * @returns {void} - */ - addEventListener(eventName, listener, options) { - if (listener == null) { - return - } - if (typeof listener !== "function" && !isObject(listener)) { - throw new TypeError("'listener' should be a function or an object.") - } - - const listeners = getListeners(this); - const optionsIsObj = isObject(options); - const capture = optionsIsObj - ? Boolean(options.capture) - : Boolean(options); - const listenerType = capture ? CAPTURE : BUBBLE; - const newNode = { - listener, - listenerType, - passive: optionsIsObj && Boolean(options.passive), - once: optionsIsObj && Boolean(options.once), - next: null, - }; - - // Set it as the first node if the first node is null. - let node = listeners.get(eventName); - if (node === undefined) { - listeners.set(eventName, newNode); - return - } - - // Traverse to the tail while checking duplication.. - let prev = null; - while (node != null) { - if ( - node.listener === listener && - node.listenerType === listenerType - ) { - // Should ignore duplication. - return - } - prev = node; - node = node.next; - } - - // Add it. - prev.next = newNode; - }, - - /** - * Remove a given listener from this event target. - * @param {string} eventName The event name to remove. - * @param {Function} listener The listener to remove. - * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. - * @returns {void} - */ - removeEventListener(eventName, listener, options) { - if (listener == null) { - return - } - - const listeners = getListeners(this); - const capture = isObject(options) - ? Boolean(options.capture) - : Boolean(options); - const listenerType = capture ? CAPTURE : BUBBLE; - - let prev = null; - let node = listeners.get(eventName); - while (node != null) { - if ( - node.listener === listener && - node.listenerType === listenerType - ) { - if (prev !== null) { - prev.next = node.next; - } else if (node.next !== null) { - listeners.set(eventName, node.next); - } else { - listeners.delete(eventName); - } - return - } - - prev = node; - node = node.next; - } - }, - - /** - * Dispatch a given event. - * @param {Event|{type:string}} event The event to dispatch. - * @returns {boolean} `false` if canceled. - */ - dispatchEvent(event) { - if (event == null || typeof event.type !== "string") { - throw new TypeError('"event.type" should be a string.') - } - - // If listeners aren't registered, terminate. - const listeners = getListeners(this); - const eventName = event.type; - let node = listeners.get(eventName); - if (node == null) { - return true - } - - // Since we cannot rewrite several properties, so wrap object. - const wrappedEvent = wrapEvent(this, event); - - // This doesn't process capturing phase and bubbling phase. - // This isn't participating in a tree. - let prev = null; - while (node != null) { - // Remove this listener if it's once - if (node.once) { - if (prev !== null) { - prev.next = node.next; - } else if (node.next !== null) { - listeners.set(eventName, node.next); - } else { - listeners.delete(eventName); - } - } else { - prev = node; - } - - // Call this listener - setPassiveListener( - wrappedEvent, - node.passive ? node.listener : null - ); - if (typeof node.listener === "function") { - try { - node.listener.call(this, wrappedEvent); - } catch (err) { - if ( - typeof console !== "undefined" && - typeof console.error === "function" - ) { - console.error(err); - } - } - } else if ( - node.listenerType !== ATTRIBUTE && - typeof node.listener.handleEvent === "function" - ) { - node.listener.handleEvent(wrappedEvent); - } - - // Break if `event.stopImmediatePropagation` was called. - if (isStopped(wrappedEvent)) { - break - } - - node = node.next; - } - setPassiveListener(wrappedEvent, null); - setEventPhase(wrappedEvent, 0); - setCurrentTarget(wrappedEvent, null); - - return !wrappedEvent.defaultPrevented - }, -}; - -// `constructor` is not enumerable. -Object.defineProperty(EventTarget.prototype, "constructor", { - value: EventTarget, - configurable: true, - writable: true, -}); - -// Ensure `eventTarget instanceof window.EventTarget` is `true`. -if ( - typeof window !== "undefined" && - typeof window.EventTarget !== "undefined" -) { - Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype); -} - -export default EventTarget; -export { defineEventAttribute, EventTarget }; -//# sourceMappingURL=event-target-shim.mjs.map diff --git a/node_modules/event-target-shim/dist/event-target-shim.mjs.map b/node_modules/event-target-shim/dist/event-target-shim.mjs.map deleted file mode 100644 index 57b3e8f7..00000000 --- a/node_modules/event-target-shim/dist/event-target-shim.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"event-target-shim.mjs","sources":["../src/event.mjs","../src/event-target.mjs"],"sourcesContent":["/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap}\n * @private\n */\nconst privateData = new WeakMap()\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap}\n * @private\n */\nconst wrappers = new WeakMap()\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event)\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n )\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n )\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault()\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n })\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true })\n\n // Define accessors\n const keys = Object.keys(event)\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key))\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation()\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this)\n\n data.stopped = true\n data.immediateStopped = true\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation()\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this))\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this))\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n})\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype)\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event)\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto)\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event)\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n })\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key)\n const isFunc = typeof descriptor.value === \"function\"\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n )\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto)\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto)\n wrappers.set(proto, wrapper)\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nexport function wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event))\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nexport function isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nexport function setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nexport function setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nexport function setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener\n}\n","import {\n isStopped,\n setCurrentTarget,\n setEventPhase,\n setPassiveListener,\n wrapEvent,\n} from \"./event.mjs\"\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap>}\n * @private\n */\nconst listenersMap = new WeakMap()\n\n// Listener types\nconst CAPTURE = 1\nconst BUBBLE = 2\nconst ATTRIBUTE = 3\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget)\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this)\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this)\n\n // Traverse to the tail while removing old value.\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n node = node.next\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n }\n if (prev === null) {\n listeners.set(eventName, newNode)\n } else {\n prev.next = newNode\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n )\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this)\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n })\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i])\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map())\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length)\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i]\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this)\n const optionsIsObj = isObject(options)\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n }\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName)\n if (node === undefined) {\n listeners.set(eventName, newNode)\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node\n node = node.next\n }\n\n // Add it.\n prev.next = newNode\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this)\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n return\n }\n\n prev = node\n node = node.next\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this)\n const eventName = event.type\n let node = listeners.get(eventName)\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event)\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n )\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent)\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err)\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent)\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next\n }\n setPassiveListener(wrappedEvent, null)\n setEventPhase(wrappedEvent, 0)\n setCurrentTarget(wrappedEvent, null)\n\n return !wrappedEvent.defaultPrevented\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n})\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype)\n}\n\nexport { defineEventAttribute, EventTarget }\nexport default EventTarget\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAW,GAAG,IAAI,OAAO,GAAE;;;;;;;AAOjC,MAAM,QAAQ,GAAG,IAAI,OAAO,GAAE;;;;;;;;AAQ9B,SAAS,EAAE,CAAC,KAAK,EAAE;IACf,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,EAAC;IACnC,OAAO,CAAC,MAAM;QACV,IAAI,IAAI,IAAI;QACZ,6CAA6C;QAC7C,KAAK;MACR;IACD,OAAO,IAAI;CACd;;;;;;AAMD,SAAS,aAAa,CAAC,IAAI,EAAE;IACzB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,EAAE;QAC9B;YACI,OAAO,OAAO,KAAK,WAAW;YAC9B,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU;UACrC;YACE,OAAO,CAAC,KAAK;gBACT,oEAAoE;gBACpE,IAAI,CAAC,eAAe;cACvB;SACJ;QACD,MAAM;KACT;IACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;QACxB,MAAM;KACT;;IAED,IAAI,CAAC,QAAQ,GAAG,KAAI;IACpB,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,UAAU,EAAE;QACjD,IAAI,CAAC,KAAK,CAAC,cAAc,GAAE;KAC9B;CACJ;;;;;;;;;;;;AAYD,SAAS,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE;IAC/B,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE;QAClB,WAAW;QACX,KAAK;QACL,UAAU,EAAE,CAAC;QACb,aAAa,EAAE,WAAW;QAC1B,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,gBAAgB,EAA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,EAAE,IAAI,EAAC;;QAEpC,OAAO,CAAC,YAAY,CAAC,gBAAgB;KACxC;EACJ;;;AAGD,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE;IACxD,KAAK,EAAE,WAAW;IAClB,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,IAAI;CACjB,EAAC;;;AAGF;IACI,OAAO,MAAM,KAAK,WAAW;IAC7B,OAAO,MAAM,CAAC,WAAW,KAAK,WAAW;EAC3C;IACE,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EAAC;CAC7E;;;;;"} \ No newline at end of file diff --git a/node_modules/event-target-shim/dist/event-target-shim.umd.js b/node_modules/event-target-shim/dist/event-target-shim.umd.js deleted file mode 100644 index e7cf5d4d..00000000 --- a/node_modules/event-target-shim/dist/event-target-shim.umd.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @author Toru Nagashima - * @copyright 2015 Toru Nagashima. All rights reserved. - * See LICENSE file in root directory for full license. - */(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.EventTargetShim={}))})(this,function(a){"use strict";function b(a){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},b(a)}function c(a){var b=u.get(a);return console.assert(null!=b,"'this' is expected an Event object, but got",a),b}function d(a){return null==a.passiveListener?void(!a.event.cancelable||(a.canceled=!0,"function"==typeof a.event.preventDefault&&a.event.preventDefault())):void("undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",a.passiveListener))}function e(a,b){u.set(this,{eventTarget:a,event:b,eventPhase:2,currentTarget:a,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:b.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});for(var c,d=Object.keys(b),e=0;e}\n * @private\n */\nconst privateData = new WeakMap()\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap}\n * @private\n */\nconst wrappers = new WeakMap()\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event)\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n )\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n )\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault()\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n })\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true })\n\n // Define accessors\n const keys = Object.keys(event)\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key))\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation()\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this)\n\n data.stopped = true\n data.immediateStopped = true\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation()\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this))\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this))\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n})\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype)\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event)\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto)\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event)\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n })\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key)\n const isFunc = typeof descriptor.value === \"function\"\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n )\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto)\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto)\n wrappers.set(proto, wrapper)\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nexport function wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event))\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nexport function isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nexport function setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nexport function setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nexport function setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener\n}\n","import {\n isStopped,\n setCurrentTarget,\n setEventPhase,\n setPassiveListener,\n wrapEvent,\n} from \"./event.mjs\"\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap>}\n * @private\n */\nconst listenersMap = new WeakMap()\n\n// Listener types\nconst CAPTURE = 1\nconst BUBBLE = 2\nconst ATTRIBUTE = 3\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget)\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this)\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this)\n\n // Traverse to the tail while removing old value.\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n node = node.next\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n }\n if (prev === null) {\n listeners.set(eventName, newNode)\n } else {\n prev.next = newNode\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n )\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this)\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n })\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i])\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map())\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length)\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i]\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this)\n const optionsIsObj = isObject(options)\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n }\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName)\n if (node === undefined) {\n listeners.set(eventName, newNode)\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node\n node = node.next\n }\n\n // Add it.\n prev.next = newNode\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this)\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n return\n }\n\n prev = node\n node = node.next\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this)\n const eventName = event.type\n let node = listeners.get(eventName)\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event)\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n )\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent)\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err)\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent)\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next\n }\n setPassiveListener(wrappedEvent, null)\n setEventPhase(wrappedEvent, 0)\n setCurrentTarget(wrappedEvent, null)\n\n return !wrappedEvent.defaultPrevented\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n})\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype)\n}\n\nexport { defineEventAttribute, EventTarget }\nexport default EventTarget\n"],"names":["pd","event","retv","privateData","get","console","assert","setCancelFlag","data","passiveListener","cancelable","canceled","preventDefault","error","Event","eventTarget","set","eventPhase","currentTarget","stopped","immediateStopped","timeStamp","Date","now","Object","defineProperty","value","enumerable","key","keys","i","length","defineRedirectDescriptor","configurable","defineCallDescriptor","apply","arguments","defineWrapper","BaseEvent","proto","CustomEvent","call","prototype","create","constructor","writable","descriptor","getOwnPropertyDescriptor","isFunc","getWrapper","wrapper","wrappers","getPrototypeOf","wrapEvent","Wrapper","isStopped","setEventPhase","setCurrentTarget","setPassiveListener","isObject","x","_typeof","getListeners","listeners","listenersMap","TypeError","defineEventAttributeDescriptor","eventName","node","listenerType","listener","next","prev","delete","newNode","passive","once","defineEventAttribute","eventTargetPrototype","defineCustomEventTarget","eventNames","CustomEventTarget","EventTarget","Map","Array","isArray","types","WeakMap","type","target","composedPath","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","stopPropagation","stopImmediatePropagation","bubbles","defaultPrevented","composed","srcElement","cancelBubble","returnValue","initEvent","window","setPrototypeOf","CAPTURE","BUBBLE","addEventListener","options","optionsIsObj","capture","removeEventListener","dispatchEvent","wrappedEvent","err","handleEvent"],"mappings":";;;;wbAkCA,QAASA,CAAAA,CAAT,CAAYC,CAAZ,CAAmB,IACTC,CAAAA,CAAI,CAAGC,CAAW,CAACC,GAAZD,CAAgBF,CAAhBE,QACbE,CAAAA,OAAO,CAACC,MAARD,CACY,IAARH,EAAAA,CADJG,CAEI,6CAFJA,CAGIJ,CAHJI,EAKOH,EAOX,QAASK,CAAAA,CAAT,CAAuBC,CAAvB,CAA6B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CAAzB9C,CADJ,CAEE,MAAO+C,CAAP,CAAY,CAEa,WAAnB,QAAO9G,CAAAA,OAAP,EACyB,UAAzB,QAAOA,CAAAA,OAAO,CAACQ,KAHT,EAKNR,OAAO,CAACQ,KAARR,CAAc8G,CAAd9G,MAIR+D,CAAAA,CAAI,CAACC,YAALD,GA/TE,CA+TFA,EACqC,UAArC,QAAOA,CAAAA,CAAI,CAACE,QAALF,CAAcgD,aAErBhD,CAAI,CAACE,QAALF,CAAcgD,WAAdhD,CAA0B8C,CAA1B9C,KAIAb,CAAS,CAAC2D,CAAD,QAIb9C,CAAI,CAAGA,CAAI,CAACG,WAEhBb,CAAAA,CAAkB,CAACwD,CAAD,CAAe,IAAf,EAClB1D,CAAa,CAAC0D,CAAD,CAAe,CAAf,EACbzD,CAAgB,CAACyD,CAAD,CAAe,IAAf,EAET,CAACA,CAAY,CAAChB,iBAvKL,EA4KxB1E,MAAM,CAACC,cAAPD,CAAsB0D,CAAW,CAACxC,SAAlClB,CAA6C,aAA7CA,CAA4D,CACxDE,KAAK,CAAEwD,CADiD,CAExDjD,YAAY,GAF4C,CAGxDY,QAAQ,GAHgD,CAA5DrB,EAQsB,WAAlB,QAAOgF,CAAAA,MAAP,EAC8B,WAA9B,QAAOA,CAAAA,MAAM,CAACtB,aAEd1D,MAAM,CAACiF,cAAPjF,CAAsB0D,CAAW,CAACxC,SAAlClB,CAA6CgF,MAAM,CAACtB,WAAPsB,CAAmB9D,SAAhElB"} \ No newline at end of file diff --git a/node_modules/event-target-shim/index.d.ts b/node_modules/event-target-shim/index.d.ts deleted file mode 100644 index a3030978..00000000 --- a/node_modules/event-target-shim/index.d.ts +++ /dev/null @@ -1,399 +0,0 @@ -export as namespace EventTargetShim - -/** - * `Event` interface. - * @see https://dom.spec.whatwg.org/#event - */ -export interface Event { - /** - * The type of this event. - */ - readonly type: string - - /** - * The target of this event. - */ - readonly target: EventTarget<{}, {}, "standard"> | null - - /** - * The current target of this event. - */ - readonly currentTarget: EventTarget<{}, {}, "standard"> | null - - /** - * The target of this event. - * @deprecated - */ - readonly srcElement: any | null - - /** - * The composed path of this event. - */ - composedPath(): EventTarget<{}, {}, "standard">[] - - /** - * Constant of NONE. - */ - readonly NONE: number - - /** - * Constant of CAPTURING_PHASE. - */ - readonly CAPTURING_PHASE: number - - /** - * Constant of BUBBLING_PHASE. - */ - readonly BUBBLING_PHASE: number - - /** - * Constant of AT_TARGET. - */ - readonly AT_TARGET: number - - /** - * Indicates which phase of the event flow is currently being evaluated. - */ - readonly eventPhase: number - - /** - * Stop event bubbling. - */ - stopPropagation(): void - - /** - * Stop event bubbling. - */ - stopImmediatePropagation(): void - - /** - * Initialize event. - * @deprecated - */ - initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void - - /** - * The flag indicating bubbling. - */ - readonly bubbles: boolean - - /** - * Stop event bubbling. - * @deprecated - */ - cancelBubble: boolean - - /** - * Set or get cancellation flag. - * @deprecated - */ - returnValue: boolean - - /** - * The flag indicating whether the event can be canceled. - */ - readonly cancelable: boolean - - /** - * Cancel this event. - */ - preventDefault(): void - - /** - * The flag to indicating whether the event was canceled. - */ - readonly defaultPrevented: boolean - - /** - * The flag to indicating if event is composed. - */ - readonly composed: boolean - - /** - * Indicates whether the event was dispatched by the user agent. - */ - readonly isTrusted: boolean - - /** - * The unix time of this event. - */ - readonly timeStamp: number -} - -/** - * The constructor of `EventTarget` interface. - */ -export type EventTargetConstructor< - TEvents extends EventTarget.EventDefinition = {}, - TEventAttributes extends EventTarget.EventDefinition = {}, - TMode extends EventTarget.Mode = "loose" -> = { - prototype: EventTarget - new(): EventTarget -} - -/** - * `EventTarget` interface. - * @see https://dom.spec.whatwg.org/#interface-eventtarget - */ -export type EventTarget< - TEvents extends EventTarget.EventDefinition = {}, - TEventAttributes extends EventTarget.EventDefinition = {}, - TMode extends EventTarget.Mode = "loose" -> = EventTarget.EventAttributes & { - /** - * Add a given listener to this event target. - * @param eventName The event name to add. - * @param listener The listener to add. - * @param options The options for this listener. - */ - addEventListener>( - type: TEventType, - listener: - | EventTarget.Listener> - | null, - options?: boolean | EventTarget.AddOptions - ): void - - /** - * Remove a given listener from this event target. - * @param eventName The event name to remove. - * @param listener The listener to remove. - * @param options The options for this listener. - */ - removeEventListener>( - type: TEventType, - listener: - | EventTarget.Listener> - | null, - options?: boolean | EventTarget.RemoveOptions - ): void - - /** - * Dispatch a given event. - * @param event The event to dispatch. - * @returns `false` if canceled. - */ - dispatchEvent>( - event: EventTarget.EventData - ): boolean -} - -export const EventTarget: EventTargetConstructor & { - /** - * Create an `EventTarget` instance with detailed event definition. - * - * The detailed event definition requires to use `defineEventAttribute()` - * function later. - * - * Unfortunately, the second type parameter `TEventAttributes` was needed - * because we cannot compute string literal types. - * - * @example - * const signal = new EventTarget<{ abort: Event }, { onabort: Event }>() - * defineEventAttribute(signal, "abort") - */ - new < - TEvents extends EventTarget.EventDefinition, - TEventAttributes extends EventTarget.EventDefinition, - TMode extends EventTarget.Mode = "loose" - >(): EventTarget - - /** - * Define an `EventTarget` constructor with attribute events and detailed event definition. - * - * Unfortunately, the second type parameter `TEventAttributes` was needed - * because we cannot compute string literal types. - * - * @example - * class AbortSignal extends EventTarget<{ abort: Event }, { onabort: Event }>("abort") { - * abort(): void {} - * } - * - * @param events Optional event attributes (e.g. passing in `"click"` adds `onclick` to prototype). - */ - < - TEvents extends EventTarget.EventDefinition = {}, - TEventAttributes extends EventTarget.EventDefinition = {}, - TMode extends EventTarget.Mode = "loose" - >(events: string[]): EventTargetConstructor< - TEvents, - TEventAttributes, - TMode - > - - /** - * Define an `EventTarget` constructor with attribute events and detailed event definition. - * - * Unfortunately, the second type parameter `TEventAttributes` was needed - * because we cannot compute string literal types. - * - * @example - * class AbortSignal extends EventTarget<{ abort: Event }, { onabort: Event }>("abort") { - * abort(): void {} - * } - * - * @param events Optional event attributes (e.g. passing in `"click"` adds `onclick` to prototype). - */ - < - TEvents extends EventTarget.EventDefinition = {}, - TEventAttributes extends EventTarget.EventDefinition = {}, - TMode extends EventTarget.Mode = "loose" - >(event0: string, ...events: string[]): EventTargetConstructor< - TEvents, - TEventAttributes, - TMode - > -} - -export namespace EventTarget { - /** - * Options of `removeEventListener()` method. - */ - export interface RemoveOptions { - /** - * The flag to indicate that the listener is for the capturing phase. - */ - capture?: boolean - } - - /** - * Options of `addEventListener()` method. - */ - export interface AddOptions extends RemoveOptions { - /** - * The flag to indicate that the listener doesn't support - * `event.preventDefault()` operation. - */ - passive?: boolean - /** - * The flag to indicate that the listener will be removed on the first - * event. - */ - once?: boolean - } - - /** - * The type of regular listeners. - */ - export interface FunctionListener { - (event: TEvent): void - } - - /** - * The type of object listeners. - */ - export interface ObjectListener { - handleEvent(event: TEvent): void - } - - /** - * The type of listeners. - */ - export type Listener = - | FunctionListener - | ObjectListener - - /** - * Event definition. - */ - export type EventDefinition = { - readonly [key: string]: Event - } - - /** - * Mapped type for event attributes. - */ - export type EventAttributes = { - [P in keyof TEventAttributes]: - | FunctionListener - | null - } - - /** - * The type of event data for `dispatchEvent()` method. - */ - export type EventData< - TEvents extends EventDefinition, - TEventType extends keyof TEvents | string, - TMode extends Mode - > = - TEventType extends keyof TEvents - ? ( - // Require properties which are not generated automatically. - & Pick< - TEvents[TEventType], - Exclude - > - // Properties which are generated automatically are optional. - & Partial> - ) - : ( - TMode extends "standard" - ? Event - : Event | NonStandardEvent - ) - - /** - * The string literal types of the properties which are generated - * automatically in `dispatchEvent()` method. - */ - export type OmittableEventKeys = Exclude - - /** - * The type of event data. - */ - export type NonStandardEvent = { - [key: string]: any - type: string - } - - /** - * The type of listeners. - */ - export type PickEvent< - TEvents extends EventDefinition, - TEventType extends keyof TEvents | string, - > = - TEventType extends keyof TEvents - ? TEvents[TEventType] - : Event - - /** - * Event type candidates. - */ - export type EventType< - TEvents extends EventDefinition, - TMode extends Mode - > = - TMode extends "strict" - ? keyof TEvents - : keyof TEvents | string - - /** - * - `"strict"` ..... Methods don't accept unknown events. - * `dispatchEvent()` accepts partial objects. - * - `"loose"` ...... Methods accept unknown events. - * `dispatchEvent()` accepts partial objects. - * - `"standard"` ... Methods accept unknown events. - * `dispatchEvent()` doesn't accept partial objects. - */ - export type Mode = "strict" | "standard" | "loose" -} - -/** - * Specialized `type` property. - */ -export type Type = { type: T } - -/** - * Define an event attribute (e.g. `eventTarget.onclick`). - * @param prototype The event target prototype to define an event attribute. - * @param eventName The event name to define. - */ -export function defineEventAttribute( - prototype: EventTarget, - eventName: string -): void - -export default EventTarget diff --git a/node_modules/event-target-shim/package.json b/node_modules/event-target-shim/package.json deleted file mode 100644 index ea5505b3..00000000 --- a/node_modules/event-target-shim/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "_from": "event-target-shim@^5.0.0", - "_id": "event-target-shim@5.0.1", - "_inBundle": false, - "_integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "_location": "/event-target-shim", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "event-target-shim@^5.0.0", - "name": "event-target-shim", - "escapedName": "event-target-shim", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/abort-controller" - ], - "_resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "_shasum": "5d4d3ebdf9583d63a5333ce2deb7480ab2b05789", - "_spec": "event-target-shim@^5.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/abort-controller", - "author": { - "name": "Toru Nagashima" - }, - "bugs": { - "url": "https://github.com/mysticatea/event-target-shim/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "An implementation of WHATWG EventTarget interface.", - "devDependencies": { - "@babel/core": "^7.2.2", - "@babel/plugin-transform-modules-commonjs": "^7.2.0", - "@babel/preset-env": "^7.2.3", - "@babel/register": "^7.0.0", - "@mysticatea/eslint-plugin": "^8.0.1", - "@mysticatea/spy": "^0.1.2", - "assert": "^1.4.1", - "codecov": "^3.1.0", - "eslint": "^5.12.1", - "karma": "^3.1.4", - "karma-chrome-launcher": "^2.2.0", - "karma-coverage": "^1.1.2", - "karma-firefox-launcher": "^1.0.0", - "karma-growl-reporter": "^1.0.0", - "karma-ie-launcher": "^1.0.0", - "karma-mocha": "^1.3.0", - "karma-rollup-preprocessor": "^7.0.0-rc.2", - "mocha": "^5.2.0", - "npm-run-all": "^4.1.5", - "nyc": "^13.1.0", - "opener": "^1.5.1", - "rimraf": "^2.6.3", - "rollup": "^1.1.1", - "rollup-plugin-babel": "^4.3.2", - "rollup-plugin-babel-minify": "^7.0.0", - "rollup-plugin-commonjs": "^9.2.0", - "rollup-plugin-json": "^3.1.0", - "rollup-plugin-node-resolve": "^4.0.0", - "rollup-watch": "^4.3.1", - "type-tester": "^1.0.0", - "typescript": "^3.2.4" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "dist", - "index.d.ts" - ], - "homepage": "https://github.com/mysticatea/event-target-shim", - "keywords": [ - "w3c", - "whatwg", - "eventtarget", - "event", - "events", - "shim" - ], - "license": "MIT", - "main": "dist/event-target-shim", - "name": "event-target-shim", - "repository": { - "type": "git", - "url": "git+https://github.com/mysticatea/event-target-shim.git" - }, - "scripts": { - "build": "rollup -c scripts/rollup.config.js", - "clean": "rimraf .nyc_output coverage", - "codecov": "codecov", - "coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html", - "lint": "eslint src test scripts --ext .js,.mjs", - "postversion": "git push && git push --tags", - "pretest": "npm run lint", - "preversion": "npm test", - "test": "run-s test:*", - "test:karma": "karma start scripts/karma.conf.js --single-run", - "test:mocha": "nyc --require ./scripts/babel-register mocha test/*.mjs", - "version": "npm run build && git add dist/*", - "watch": "run-p watch:*", - "watch:karma": "karma start scripts/karma.conf.js --watch", - "watch:mocha": "mocha test/*.mjs --require ./scripts/babel-register --watch --watch-extensions js,mjs --growl" - }, - "types": "index.d.ts", - "version": "5.0.1" -} diff --git a/node_modules/eventemitter3/LICENSE b/node_modules/eventemitter3/LICENSE deleted file mode 100644 index abcbd54e..00000000 --- a/node_modules/eventemitter3/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Arnout Kazemier - -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. diff --git a/node_modules/eventemitter3/README.md b/node_modules/eventemitter3/README.md deleted file mode 100644 index 6ce142da..00000000 --- a/node_modules/eventemitter3/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# EventEmitter3 - -[![Version npm](https://img.shields.io/npm/v/eventemitter3.svg?style=flat-square)](https://www.npmjs.com/package/eventemitter3)[![Build Status](https://img.shields.io/travis/primus/eventemitter3/master.svg?style=flat-square)](https://travis-ci.org/primus/eventemitter3)[![Dependencies](https://img.shields.io/david/primus/eventemitter3.svg?style=flat-square)](https://david-dm.org/primus/eventemitter3)[![Coverage Status](https://img.shields.io/coveralls/primus/eventemitter3/master.svg?style=flat-square)](https://coveralls.io/r/primus/eventemitter3?branch=master)[![IRC channel](https://img.shields.io/badge/IRC-irc.freenode.net%23primus-00a8ff.svg?style=flat-square)](https://webchat.freenode.net/?channels=primus) - -[![Sauce Test Status](https://saucelabs.com/browser-matrix/eventemitter3.svg)](https://saucelabs.com/u/eventemitter3) - -EventEmitter3 is a high performance EventEmitter. It has been micro-optimized -for various of code paths making this, one of, if not the fastest EventEmitter -available for Node.js and browsers. The module is API compatible with the -EventEmitter that ships by default with Node.js but there are some slight -differences: - -- Domain support has been removed. -- We do not `throw` an error when you emit an `error` event and nobody is - listening. -- The `newListener` and `removeListener` events have been removed as they - are useful only in some uncommon use-cases. -- The `setMaxListeners`, `getMaxListeners`, `prependListener` and - `prependOnceListener` methods are not available. -- Support for custom context for events so there is no need to use `fn.bind`. -- The `removeListener` method removes all matching listeners, not only the - first. - -It's a drop in replacement for existing EventEmitters, but just faster. Free -performance, who wouldn't want that? The EventEmitter is written in EcmaScript 3 -so it will work in the oldest browsers and node versions that you need to -support. - -## Installation - -```bash -$ npm install --save eventemitter3 -``` - -## CDN - -Recommended CDN: - -```text -https://unpkg.com/eventemitter3@latest/umd/eventemitter3.min.js -``` - -## Usage - -After installation the only thing you need to do is require the module: - -```js -var EventEmitter = require('eventemitter3'); -``` - -And you're ready to create your own EventEmitter instances. For the API -documentation, please follow the official Node.js documentation: - -http://nodejs.org/api/events.html - -### Contextual emits - -We've upgraded the API of the `EventEmitter.on`, `EventEmitter.once` and -`EventEmitter.removeListener` to accept an extra argument which is the `context` -or `this` value that should be set for the emitted events. This means you no -longer have the overhead of an event that required `fn.bind` in order to get a -custom `this` value. - -```js -var EE = new EventEmitter() - , context = { foo: 'bar' }; - -function emitted() { - console.log(this === context); // true -} - -EE.once('event-name', emitted, context); -EE.on('another-event', emitted, context); -EE.removeListener('another-event', emitted, context); -``` - -### Tests and benchmarks - -This module is well tested. You can run: - -- `npm test` to run the tests under Node.js. -- `npm run test-browser` to run the tests in real browsers via Sauce Labs. - -We also have a set of benchmarks to compare EventEmitter3 with some available -alternatives. To run the benchmarks run `npm run benchmark`. - -Tests and benchmarks are not included in the npm package. If you want to play -with them you have to clone the GitHub repository. - -## License - -[MIT](LICENSE) diff --git a/node_modules/eventemitter3/index.d.ts b/node_modules/eventemitter3/index.d.ts deleted file mode 100644 index 2f86f20f..00000000 --- a/node_modules/eventemitter3/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - */ -declare class EventEmitter { - static prefixed: string | boolean; - - /** - * Return an array listing the events for which the emitter has registered - * listeners. - */ - eventNames(): Array; - - /** - * Return the listeners registered for a given event. - */ - listeners(event: EventTypes): Array; - - /** - * Return the number of listeners listening to a given event. - */ - listenerCount(event: EventTypes): number; - - /** - * Calls each of the listeners registered for a given event. - */ - emit(event: EventTypes, ...args: Array): boolean; - - /** - * Add a listener for a given event. - */ - on(event: EventTypes, fn: EventEmitter.ListenerFn, context?: any): this; - addListener(event: EventTypes, fn: EventEmitter.ListenerFn, context?: any): this; - - /** - * Add a one-time listener for a given event. - */ - once(event: EventTypes, fn: EventEmitter.ListenerFn, context?: any): this; - - /** - * Remove the listeners of a given event. - */ - removeListener(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: boolean): this; - off(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: boolean): this; - - /** - * Remove all listeners, or those of the specified event. - */ - removeAllListeners(event?: EventTypes): this; -} - -declare namespace EventEmitter { - export interface ListenerFn { - (...args: Array): void; - } - - export interface EventEmitterStatic { - new(): EventEmitter; - } - - export const EventEmitter: EventEmitterStatic; -} - -export = EventEmitter; diff --git a/node_modules/eventemitter3/index.js b/node_modules/eventemitter3/index.js deleted file mode 100644 index 6ea485c4..00000000 --- a/node_modules/eventemitter3/index.js +++ /dev/null @@ -1,336 +0,0 @@ -'use strict'; - -var has = Object.prototype.hasOwnProperty - , prefix = '~'; - -/** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ -function Events() {} - -// -// We try to not inherit from `Object.prototype`. In some engines creating an -// instance in this way is faster than calling `Object.create(null)` directly. -// If `Object.create(null)` is not supported we prefix the event names with a -// character to make sure that the built-in object properties are not -// overridden or used as an attack vector. -// -if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; -} - -/** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ -function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; -} - -/** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ -function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; -} - -/** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ -function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; -} - -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ -function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; -} - -/** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ -EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; -}; - -/** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ -EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; -}; - -/** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ -EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; -}; - -/** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ -EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; -}; - -/** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); -}; - -/** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); -}; - -/** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; -}; - -/** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; -}; - -// -// Alias methods names because people roll like that. -// -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -// -// Expose the prefix. -// -EventEmitter.prefixed = prefix; - -// -// Allow `EventEmitter` to be imported as module namespace. -// -EventEmitter.EventEmitter = EventEmitter; - -// -// Expose the module. -// -if ('undefined' !== typeof module) { - module.exports = EventEmitter; -} diff --git a/node_modules/eventemitter3/package.json b/node_modules/eventemitter3/package.json deleted file mode 100644 index 260cf5a3..00000000 --- a/node_modules/eventemitter3/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_args": [ - [ - "eventemitter3@3.1.2", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "eventemitter3@3.1.2", - "_id": "eventemitter3@3.1.2", - "_inBundle": false, - "_integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==", - "_location": "/eventemitter3", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "eventemitter3@3.1.2", - "name": "eventemitter3", - "escapedName": "eventemitter3", - "rawSpec": "3.1.2", - "saveSpec": null, - "fetchSpec": "3.1.2" - }, - "_requiredBy": [ - "/subscriptions-transport-ws" - ], - "_resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "_spec": "3.1.2", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Arnout Kazemier" - }, - "bugs": { - "url": "https://github.com/primus/eventemitter3/issues" - }, - "description": "EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.", - "devDependencies": { - "assume": "~2.2.0", - "browserify": "~16.2.0", - "mocha": "~6.1.0", - "nyc": "~14.0.0", - "pre-commit": "~1.2.0", - "sauce-browsers": "~2.0.0", - "sauce-test": "~1.3.3", - "uglify-js": "~3.5.0" - }, - "files": [ - "index.js", - "index.d.ts", - "umd" - ], - "homepage": "https://github.com/primus/eventemitter3#readme", - "keywords": [ - "EventEmitter", - "EventEmitter2", - "EventEmitter3", - "Events", - "addEventListener", - "addListener", - "emit", - "emits", - "emitter", - "event", - "once", - "pub/sub", - "publish", - "reactor", - "subscribe" - ], - "license": "MIT", - "main": "index.js", - "name": "eventemitter3", - "repository": { - "type": "git", - "url": "git://github.com/primus/eventemitter3.git" - }, - "scripts": { - "benchmark": "find benchmarks/run -name '*.js' -exec benchmarks/start.sh {} \\;", - "browserify": "rm -rf umd && mkdir umd && browserify index.js -s EventEmitter3 -o umd/eventemitter3.js", - "minify": "uglifyjs umd/eventemitter3.js --source-map -cm -o umd/eventemitter3.min.js", - "prepublishOnly": "npm run browserify && npm run minify", - "test": "nyc --reporter=html --reporter=text mocha test/test.js", - "test-browser": "node test/browser.js" - }, - "typings": "index.d.ts", - "version": "3.1.2" -} diff --git a/node_modules/eventemitter3/umd/eventemitter3.js b/node_modules/eventemitter3/umd/eventemitter3.js deleted file mode 100644 index 888fcb8f..00000000 --- a/node_modules/eventemitter3/umd/eventemitter3.js +++ /dev/null @@ -1,340 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.EventEmitter3 = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i[![Version Badge][npm-version-png]][npm-url] - -`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. - -Notes: - -* Since Node.js >= 4, - [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) - now offers the same functionality natively (but without the "deep copy" option). - See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6). -* Some native implementations of `Object.assign` in both Node.js and many - browsers (since NPM modules are for the browser too) may not be fully - spec-compliant. - Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for - a compliant candidate. - -## Installation - -This package is available on [npm][npm-url] as: `extend` - -``` sh -npm install extend -``` - -## Usage - -**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** - -*Extend one object with one or more others, returning the modified object.* - -**Example:** - -``` js -var extend = require('extend'); -extend(targetObject, object1, object2); -``` - -Keep in mind that the target object will be modified, and will be returned from extend(). - -If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). -Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. -Warning: passing `false` as the first argument is not supported. - -### Arguments - -* `deep` *Boolean* (optional) -If set, the merge becomes recursive (i.e. deep copy). -* `target` *Object* -The object to extend. -* `object1` *Object* -The object that will be merged into the first. -* `objectN` *Object* (Optional) -More objects to merge into the first. - -## License - -`node-extend` is licensed under the [MIT License][mit-license-url]. - -## Acknowledgements - -All credit to the jQuery authors for perfecting this amazing utility. - -Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb]. - -[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg -[travis-url]: https://travis-ci.org/justmoon/node-extend -[npm-url]: https://npmjs.org/package/extend -[mit-license-url]: http://opensource.org/licenses/MIT -[github-justmoon]: https://github.com/justmoon -[github-insin]: https://github.com/insin -[github-ljharb]: https://github.com/ljharb -[npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg -[deps-svg]: https://david-dm.org/justmoon/node-extend.svg -[deps-url]: https://david-dm.org/justmoon/node-extend -[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg -[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies - diff --git a/node_modules/extend/component.json b/node_modules/extend/component.json deleted file mode 100644 index 1500a2f3..00000000 --- a/node_modules/extend/component.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "extend", - "author": "Stefan Thomas (http://www.justmoon.net)", - "version": "3.0.0", - "description": "Port of jQuery.extend for node.js and the browser.", - "scripts": [ - "index.js" - ], - "contributors": [ - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "keywords": [ - "extend", - "clone", - "merge" - ], - "repository" : { - "type": "git", - "url": "https://github.com/justmoon/node-extend.git" - }, - "dependencies": { - }, - "devDependencies": { - "tape" : "~3.0.0", - "covert": "~0.4.0", - "jscs": "~1.6.2" - } -} - diff --git a/node_modules/extend/index.js b/node_modules/extend/index.js deleted file mode 100644 index 2aa3faae..00000000 --- a/node_modules/extend/index.js +++ /dev/null @@ -1,117 +0,0 @@ -'use strict'; - -var hasOwn = Object.prototype.hasOwnProperty; -var toStr = Object.prototype.toString; -var defineProperty = Object.defineProperty; -var gOPD = Object.getOwnPropertyDescriptor; - -var isArray = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } - - return toStr.call(arr) === '[object Array]'; -}; - -var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } - - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - // Not own constructor property must be Object - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - var key; - for (key in obj) { /**/ } - - return typeof key === 'undefined' || hasOwn.call(obj, key); -}; - -// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target -var setProperty = function setProperty(target, options) { - if (defineProperty && options.name === '__proto__') { - defineProperty(target, options.name, { - enumerable: true, - configurable: true, - value: options.newValue, - writable: true - }); - } else { - target[options.name] = options.newValue; - } -}; - -// Return undefined instead of __proto__ if '__proto__' is not an own property -var getProperty = function getProperty(obj, name) { - if (name === '__proto__') { - if (!hasOwn.call(obj, name)) { - return void 0; - } else if (gOPD) { - // In early versions of node, obj['__proto__'] is buggy when obj has - // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. - return gOPD(obj, name).value; - } - } - - return obj[name]; -}; - -module.exports = function extend() { - var options, name, src, copy, copyIsArray, clone; - var target = arguments[0]; - var i = 1; - var length = arguments.length; - var deep = false; - - // Handle a deep copy situation - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { - target = {}; - } - - for (; i < length; ++i) { - options = arguments[i]; - // Only deal with non-null/undefined values - if (options != null) { - // Extend the base object - for (name in options) { - src = getProperty(target, name); - copy = getProperty(options, name); - - // Prevent never-ending loop - if (target !== copy) { - // Recurse if we're merging plain objects or arrays - if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); - - // Don't bring in undefined values - } else if (typeof copy !== 'undefined') { - setProperty(target, { name: name, newValue: copy }); - } - } - } - } - } - - // Return the modified object - return target; -}; diff --git a/node_modules/extend/package.json b/node_modules/extend/package.json deleted file mode 100644 index 9fd89a97..00000000 --- a/node_modules/extend/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_from": "extend@^3.0.2", - "_id": "extend@3.0.2", - "_inBundle": false, - "_integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "_location": "/extend", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "extend@^3.0.2", - "name": "extend", - "escapedName": "extend", - "rawSpec": "^3.0.2", - "saveSpec": null, - "fetchSpec": "^3.0.2" - }, - "_requiredBy": [ - "/gaxios" - ], - "_resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "_shasum": "f8b1136b4071fbd8eb140aff858b1019ec2915fa", - "_spec": "extend@^3.0.2", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gaxios", - "author": { - "name": "Stefan Thomas", - "email": "justmoon@members.fsf.org", - "url": "http://www.justmoon.net" - }, - "bugs": { - "url": "https://github.com/justmoon/node-extend/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "Port of jQuery.extend for node.js and the browser", - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "covert": "^1.1.0", - "eslint": "^4.19.1", - "jscs": "^3.0.7", - "tape": "^4.9.1" - }, - "homepage": "https://github.com/justmoon/node-extend#readme", - "keywords": [ - "extend", - "clone", - "merge" - ], - "license": "MIT", - "main": "index", - "name": "extend", - "repository": { - "type": "git", - "url": "git+https://github.com/justmoon/node-extend.git" - }, - "scripts": { - "coverage": "covert test/index.js", - "coverage-quiet": "covert test/index.js --quiet", - "eslint": "eslint *.js */*.js", - "jscs": "jscs *.js */*.js", - "lint": "npm run jscs && npm run eslint", - "posttest": "npm run coverage-quiet", - "pretest": "npm run lint", - "test": "npm run tests-only", - "tests-only": "node test" - }, - "version": "3.0.2" -} diff --git a/node_modules/extract-files/changelog.md b/node_modules/extract-files/changelog.md deleted file mode 100644 index 3baf5184..00000000 --- a/node_modules/extract-files/changelog.md +++ /dev/null @@ -1,292 +0,0 @@ -# extract-files changelog - -## 9.0.0 - -### Major - -- Updated Node.js support to `^10.17.0 || ^12.0.0 || >= 13.7.0`. -- Updated dev dependencies, some of which require newer Node.js versions than previously supported. -- Renamed the `lib` directory to `public`; existing deep import or require paths must be updated. -- Removed the package `module` field. - -### Patch - -- Removed Node.js v13 and added v14 to the versions tested in GitHub Actions. -- Simplified the GitHub Actions CI config with the [`npm install-test`](https://docs.npmjs.com/cli/install-test.html) command. -- Improved JSDoc code examples. -- Updated EditorConfig. -- No longer transpile tests with Babel, or test ESM. -- Simplified the Babel config and scripts, ensuring `.js` files are parsed as scripts. -- Removed unnecessary `.js` file extensions from `require` paths. -- Documented all the ways to `import` and `require` the public API. -- Tweaked the readme setup instructions. - -## 8.1.0 - -### Minor - -- Updated the package `exports` field: - - - Deep imports to specific files are now allowed, e.g. - - ```js - import extractFiles from 'extract-files/lib/extractFiles.js'; - ``` - - ```js - const extractFiles = require('extract-files/lib/extractFiles'); - ``` - - - The `package.json` can now be required, e.g. - - ```js - const pkg = require('extract-files/package.json'); - ``` - - ```js - // With Node.js --experimental-json-modules flag. - import pkg from 'extract-files/package.json'; - ``` - -### Patch - -- Updated dev dependencies. -- Updated the package `engines.node` field to `10 - 12 || >= 13.7` to reflect the package `exports` related breaking changes in `extract-files@8.0.0`. -- Improved the package `prepare:prettier` and `test:prettier` scripts. -- Reordered the package `test:eslint` script args for consistency with `test:prettier`. -- Configured Prettier option `semi` to the default, `true`. -- Restructured the `src` directory so `lib` and `test` files are separate with their own `.babelrc.js` files. - -## 8.0.0 - -### Major - -- Added a [package `exports` field](https://nodejs.org/api/esm.html#esm_package_exports) to support native ESM in Node.js. -- Some source and published files are now `.js` (CJS) instead of `.mjs` (ESM), so undocumented deep imports may no longer work. [This approach avoids the dual package hazard](https://nodejs.org/api/esm.html#esm_approach_1_use_an_es_module_wrapper). - -### Patch - -- Updated dependencies. -- Removed [`@babel/plugin-proposal-class-properties`](https://npm.im/@babel/plugin-proposal-class-properties) from dev dependencies and the Babel config. -- Lint fixes for [`prettier`](https://npm.im/prettier) v2. -- Ensure GitHub Actions run on pull request. -- Improved the `ExtractableFileMatcher` JSDoc typedef. -- Size limit test the published CJS files as well as the ESM. - -## 7.0.0 - -### Major - -- Updated Node.js support from v8.10+ to v10+. -- Replaced [`tap`](https://npm.im/tap) and [`nyc`](https://npm.im/nyc) with [`test-director`](https://npm.im/test-director), [`coverage-node`](https://npm.im/coverage-node) and [`hard-rejection`](https://npm.im/hard-rejection) to improve the dev experience, test ESM natively with Node.js, and reduce the dev install size by ~78.8 MB. These new dev dependencies require Node.js v10+. - -### Patch - -- Updated dev dependencies. -- Removed the now redundant [`eslint-plugin-import-order-alphabetical`](https://npm.im/eslint-plugin-import-order-alphabetical) dev dependency. -- Stop using [`husky`](https://npm.im/husky) and [`lint-staged`](https://npm.im/lint-staged). -- More thorough tests. -- Use strict mode for scripts. -- Renamed some package scripts. - -## 6.0.0 - -### Major - -- Updated Node.js support from v6+ to v8.10+. - -### Minor - -- Added the ability to customize what are extractable files, fixing [#10](https://github.com/jaydenseric/extract-files/issues/10) via [#11](https://github.com/jaydenseric/extract-files/pull/11): - - Added a new third parameter to the `extractFiles` function, for specifying a custom extractable file matcher. - - Export a new `isExtractableFile` function that is used as the default extractable file matcher for the `extractFiles` function. This can be used in a custom extractable file matcher implementation to match the default extractable files, along with additional custom files. -- Setup [GitHub Sponsors funding](https://github.com/sponsors/jaydenseric): - - Added `.github/funding.yml` to display a sponsor button in GitHub. - - Added a `package.json` `funding` field to enable npm CLI funding features. - -### Patch - -- Updated dev dependencies. -- Replaced the [`size-limit`](https://npm.im/size-limit) dev dependency with [`@size-limit/preset-small-lib`](https://npm.im/@size-limit/preset-small-lib). -- Added a new [`babel-plugin-transform-require-extensions`](https://npm.im/babel-plugin-transform-require-extensions) dev dependency and ensured ESM import specifiers in both source and published `.mjs` files contain file names with extensions, which [are mandatory in the final Node.js ESM implementation](https://nodejs.org/api/esm.html#esm_mandatory_file_extensions). Published CJS `.js` files now also have file extensions in `require` paths. -- Added a package `module` field. -- Removed now redundant ESLint disable `require-jsdoc` comments. -- Use GitHub Actions instead of Travis for CI. -- Redid the test scripts and enforced 100% code coverage. -- Run size limit tests last in the package `test` script as they are the slowest. -- Only size limit test the ESM build. -- Updated the package `test:tap` script to workaround a [`tap` bug](https://github.com/tapjs/node-tap/issues/624). -- Simplified the `prepublishOnly` script. -- Ordered `plugins` before `presets` in Babel config as they run first. -- Reduced the size of the published `package.json` by moving dev tool config to files. -- Only target the root `lib` directory in `.gitignore` and `.eslintignore`. -- Removed `package-lock.json` from `.gitignore` and `.prettierignore` as it’s disabled in `.npmrc` anyway. -- Prevented ESLint from ignoring dotfiles. -- Clarified that Opera Mini isn’t supported in the Browserslist queries and readme “Support” section. - -## 5.0.1 - -### Patch - -- Updated dev dependencies. -- Instance (e.g. [`new Date()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)) references are copied to the clone instead of recursed as objects; fixing [jaydenseric/apollo-upload-client#138](https://github.com/jaydenseric/apollo-upload-client/issues/138) via [#9](https://github.com/jaydenseric/extract-files/pull/9). -- Test more types of input. - -## 5.0.0 - -### Major - -- `extractFiles` has a new return signature and no longer mutates the original input, fixing [#8](https://github.com/jaydenseric/extract-files/issues/8). It returns an object with `clone`, a clone of the original input value with files recursively replaced with `null`, and `files`, a `Map` instance keying each extracted file to an array of object paths. - -### Minor - -- Files can now be used as the root value passed to `extractFiles`. - -### Patch - -- Updated dev dependencies. -- Updated package description. -- Moved JSDoc type definitions into the index file. -- Manually composed package exports instead of relying on `*`. -- Improved tests. -- Added a paragraph explaining the GraphQL use case to the readme. - -## 4.1.0 - -### Minor - -- Support more browsers by changing the [Browserslist](https://github.com/browserslist/browserslist) query from [`> 1%`](https://browserl.ist/?q=%3E+1%25) to [`> 0.5%, not dead`](https://browserl.ist/?q=%3E+0.5%25%2C+not+dead). - -### Patch - -- Updated dev dependencies. -- Ensure Babel reads from the package `browserslist` field due to [a sneaky `@babel/preset-env` breaking change](https://github.com/babel/babel/pull/8509). -- Updated package scripts and config for the new [`husky`](https://npm.im/husky) version. -- Removed the package `module` field. Webpack by default resolves extensionless paths the same way Node.js in `--experimental-modules` mode does; `.mjs` files are preferred. Tools misconfigured or unable to resolve `.mjs` can get confused when `module` points to an `.mjs` ESM file and they attempt to resolve named imports from `.js` CJS files. -- Added a `ReactNativeFileSubstitute` type example. -- Move JSDoc typedefs to the end of files to make it quicker to find the code. -- Regenerated the readme API docs using the latest [`jsdoc-md`](https://npm.im/jsdoc-md) version. -- Tests now log if the environment is CJS or ESM (`--experimental-modules`) and the `NODE_ENV`. - -## 4.0.0 - -### Major - -- `extractFiles` is a named export again, and there is no longer a default export; mixed named and default exports causes native ESM and CJS interoperability issues. -- `isObject` is no longer exported. It was not a documented API anyway. -- Removed the `ReactNativeFile` static function `list`. It added surface area to the API and bundles and is simple to do manually. - -### Minor - -- Updated Babel, removing the `@babel/runtime` dependency. -- Refactored package scripts to use `prepare` to support installation via Git (e.g. `npm install jaydenseric/extract-files`). -- Package [marked side-effect free](https://webpack.js.org/guides/tree-shaking#mark-the-file-as-side-effect-free) for bundlers and tree-shaking. - -### Patch - -- Use [`jsdoc-md`](https://npm.im/jsdoc-md) to generate readme API docs from source JSDoc, which has been much improved. -- Use [`tap`](https://npm.im/tap) instead of [`ava`](https://npm.im/ava). Tests no longer transpile on the fly, are faster and AVA no longer dictates the Babel version. -- Tests run against the actual dist `.mjs` and `.js` files in both native ESM (`--experimental-modules`) and CJS environments. -- Added a package `test:size` script, using [`size-limit`](https://npm.im/size-limit) to guarantee < 500 byte ESM and CJS bundle sizes. -- Removed the package clean script `rimraf` dev dependency in favour of native `rm -rf`. -- Removed the package `fix` script. -- Renamed the `MODULE` environment variable to `BABEL_ESM` to be more specific for the package `prepare:mjs` script. -- Lint `.json`, `.yml` and `.md` files. -- Use `.prettierignore` to leave `package.json` formatting to npm. -- Use [`eslint-config-env`](https://npm.im/eslint-config-env). -- Compact package `repository` field. -- Updated package description. -- HTTPS package author URL. -- Added package keywords. -- Replaced [shields.io](https://shields.io) readme badges with: - - A [Badgen](https://badgen.net) npm version badge. - - An official Travis badge that only tracks `master` branch. -- Changelog version entries now have “Major”, “Minor” and “Patch” subheadings. - -## 3.1.0 - -### Minor - -- Added support for [`Blob`](https://developer.mozilla.org/en/docs/Web/API/Blob) types, via [#5](https://github.com/jaydenseric/extract-files/pull/5). - -### Patch - -- Updated dependencies. - -## 3.0.0 - -### Major - -- The `extractFiles` function is now the default export. -- Replace extracted files with `null` instead of deletion, fixing [#4](https://github.com/jaydenseric/extract-files/issues/4). - -### Patch - -- Updated dev dependencies. -- Simplified npm scripts. - -## 2.1.1 - -### Patch - -- Setup Travis to test using the latest stable Node.js version and the oldest supported in `package.json` `engines` (v6.10). -- Added a Travis readme badge. - -## 2.1.0 - -### Minor - -- Support [browsers with >1% global usage](http://browserl.ist/?q=%3E1%25) (was >2%). -- Target Node.js v6.10+ for transpilation and polyfills via `package.json` `engines`. -- Support Node.js native ESM via `--experimental-modules`: - - Module files now have `.mjs` extension. - - Modular project structure that works better for native ESM. -- Reduced bundle size, fixing [#3](https://github.com/jaydenseric/extract-files/issues/3): - - Using `babel-preset-env` to handle polyfills so only required ones are included for supported environments. - - Using `Array.prototype.slice.call` to convert `FileList` instances to arrays instead of `Array.from` which requires a lot of polyfills. - -### Patch - -- Updated dependencies. -- Updated Prettier and ESLint config. -- Prettier formats distribution code as well as source code, along with the readme and changelog. -- No more source maps; Prettier does not support them. -- Added a clean step to builds. -- Renamed `dist` directory to `lib`. -- Using Babel directly instead of Rollup. -- Smarter Babel config with `.babelrc.js`. -- Added links to readme badges. -- Updated the readme support section. - -## 2.0.1 - -### Patch - -- Updated dependencies. -- Fixed incorrect usage example code for `ReactNativeFile.list`, via [#1](https://github.com/jaydenseric/extract-files/pull/1). - -## 2.0.0 - -### Major - -- Extracted file paths no longer begin with `.` when no tree path is passed to `extractFiles`. - -### Patch - -- Updated dev dependencies. - -## 1.1.0 - -### Minor - -- Added tests. - -### Patch - -- Updated dev dependencies. -- Removed `lint-staged`, linting and tests now run on commit. -- Fixed `extractFiles` bugs by using logic that worked in [`apollo-upload-client@5`](https://github.com/jaydenseric/apollo-upload-client/tree/v5.0.0). - -## 1.0.0 - -Initial release. diff --git a/node_modules/extract-files/package.json b/node_modules/extract-files/package.json deleted file mode 100644 index 1eb4696d..00000000 --- a/node_modules/extract-files/package.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "_from": "extract-files@^9.0.0", - "_id": "extract-files@9.0.0", - "_inBundle": false, - "_integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==", - "_location": "/extract-files", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "extract-files@^9.0.0", - "name": "extract-files", - "escapedName": "extract-files", - "rawSpec": "^9.0.0", - "saveSpec": null, - "fetchSpec": "^9.0.0" - }, - "_requiredBy": [ - "/graphql-request" - ], - "_resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", - "_shasum": "8a7744f2437f81f5ed3250ed9f1550de902fe54a", - "_spec": "extract-files@^9.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/graphql-request", - "author": { - "name": "Jayden Seric", - "email": "me@jaydenseric.com", - "url": "https://jaydenseric.com" - }, - "browserslist": "Node 10.17 - 11 and Node < 11, Node 12 - 13 and Node < 13, Node >= 13.7, > 0.5%, not OperaMini all, not dead", - "bugs": { - "url": "https://github.com/jaydenseric/extract-files/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Clones a value, recursively extracting File, Blob and ReactNativeFile instances with their object paths, replacing them with null. FileList instances are treated as File instance arrays.", - "devDependencies": { - "@babel/cli": "^7.10.5", - "@babel/core": "^7.10.5", - "@babel/preset-env": "^7.10.4", - "@size-limit/preset-small-lib": "^4.5.5", - "babel-eslint": "^10.1.0", - "coverage-node": "^3.0.0", - "eslint": "^7.5.0", - "eslint-config-env": "^15.0.1", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-import": "^2.22.0", - "eslint-plugin-jsdoc": "^30.0.3", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^3.1.4", - "hard-rejection": "^2.1.0", - "jsdoc-md": "^7.0.0", - "prettier": "^2.0.5", - "size-limit": "^4.5.5", - "test-director": "^4.0.1" - }, - "engines": { - "node": "^10.17.0 || ^12.0.0 || >= 13.7.0" - }, - "exports": { - ".": { - "import": "./public/index.mjs", - "require": "./public/index.js" - }, - "./public/": "./public/", - "./package": "./package.json", - "./package.json": "./package.json" - }, - "files": [ - "public" - ], - "funding": "https://github.com/sponsors/jaydenseric", - "homepage": "https://github.com/jaydenseric/extract-files#readme", - "keywords": [ - "extract", - "file", - "files", - "File", - "FileList", - "Blob", - "react", - "native", - "esm", - "mjs" - ], - "license": "MIT", - "main": "public", - "name": "extract-files", - "repository": { - "type": "git", - "url": "git+https://github.com/jaydenseric/extract-files.git" - }, - "scripts": { - "prepare": "npm run prepare:clean && npm run prepare:babel && npm run prepare:jsdoc && npm run prepare:prettier", - "prepare:babel": "babel src -d . --keep-file-extension", - "prepare:clean": "rm -rf public", - "prepare:jsdoc": "jsdoc-md", - "prepare:prettier": "prettier --write public readme.md", - "prepublishOnly": "npm test", - "test": "npm run test:eslint && npm run test:prettier && npm run test:api && npm run test:size", - "test:api": "coverage-node -r hard-rejection/register test", - "test:eslint": "eslint --ext mjs,js .", - "test:prettier": "prettier -c .", - "test:size": "size-limit" - }, - "sideEffects": false, - "version": "9.0.0" -} diff --git a/node_modules/extract-files/public/ReactNativeFile.js b/node_modules/extract-files/public/ReactNativeFile.js deleted file mode 100644 index 62e72b99..00000000 --- a/node_modules/extract-files/public/ReactNativeFile.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = function ReactNativeFile(_ref) { - var uri = _ref.uri, - name = _ref.name, - type = _ref.type; - this.uri = uri; - this.name = name; - this.type = type; -}; diff --git a/node_modules/extract-files/public/extractFiles.js b/node_modules/extract-files/public/extractFiles.js deleted file mode 100644 index 212c1ac8..00000000 --- a/node_modules/extract-files/public/extractFiles.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -var defaultIsExtractableFile = require('./isExtractableFile'); - -module.exports = function extractFiles(value, path, isExtractableFile) { - if (path === void 0) { - path = ''; - } - - if (isExtractableFile === void 0) { - isExtractableFile = defaultIsExtractableFile; - } - - var clone; - var files = new Map(); - - function addFile(paths, file) { - var storedPaths = files.get(file); - if (storedPaths) storedPaths.push.apply(storedPaths, paths); - else files.set(file, paths); - } - - if (isExtractableFile(value)) { - clone = null; - addFile([path], value); - } else { - var prefix = path ? path + '.' : ''; - if (typeof FileList !== 'undefined' && value instanceof FileList) - clone = Array.prototype.map.call(value, function (file, i) { - addFile(['' + prefix + i], file); - return null; - }); - else if (Array.isArray(value)) - clone = value.map(function (child, i) { - var result = extractFiles(child, '' + prefix + i, isExtractableFile); - result.files.forEach(addFile); - return result.clone; - }); - else if (value && value.constructor === Object) { - clone = {}; - - for (var i in value) { - var result = extractFiles(value[i], '' + prefix + i, isExtractableFile); - result.files.forEach(addFile); - clone[i] = result.clone; - } - } else clone = value; - } - - return { - clone: clone, - files: files, - }; -}; diff --git a/node_modules/extract-files/public/index.js b/node_modules/extract-files/public/index.js deleted file mode 100644 index 5292da27..00000000 --- a/node_modules/extract-files/public/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -exports.ReactNativeFile = require('./ReactNativeFile'); -exports.extractFiles = require('./extractFiles'); -exports.isExtractableFile = require('./isExtractableFile'); diff --git a/node_modules/extract-files/public/index.mjs b/node_modules/extract-files/public/index.mjs deleted file mode 100644 index b806be7a..00000000 --- a/node_modules/extract-files/public/index.mjs +++ /dev/null @@ -1,3 +0,0 @@ -export { default as ReactNativeFile } from './ReactNativeFile.js'; -export { default as extractFiles } from './extractFiles.js'; -export { default as isExtractableFile } from './isExtractableFile.js'; diff --git a/node_modules/extract-files/public/isExtractableFile.js b/node_modules/extract-files/public/isExtractableFile.js deleted file mode 100644 index f6190b4c..00000000 --- a/node_modules/extract-files/public/isExtractableFile.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -var ReactNativeFile = require('./ReactNativeFile'); - -module.exports = function isExtractableFile(value) { - return ( - (typeof File !== 'undefined' && value instanceof File) || - (typeof Blob !== 'undefined' && value instanceof Blob) || - value instanceof ReactNativeFile - ); -}; diff --git a/node_modules/extract-files/readme.md b/node_modules/extract-files/readme.md deleted file mode 100644 index 9e92b565..00000000 --- a/node_modules/extract-files/readme.md +++ /dev/null @@ -1,284 +0,0 @@ -# extract-files - -[![npm version](https://badgen.net/npm/v/extract-files)](https://npm.im/extract-files) [![CI status](https://github.com/jaydenseric/extract-files/workflows/CI/badge.svg)](https://github.com/jaydenseric/extract-files/actions) - -Clones a value, recursively extracting [`File`](https://developer.mozilla.org/docs/web/api/file), [`Blob`](https://developer.mozilla.org/docs/web/api/blob) and [`ReactNativeFile`](#class-reactnativefile) instances with their [object paths](#type-objectpath), replacing them with `null`. [`FileList`](https://developer.mozilla.org/docs/web/api/filelist) instances are treated as [`File`](https://developer.mozilla.org/docs/web/api/file) instance arrays. - -Used by [GraphQL multipart request spec client implementations](https://github.com/jaydenseric/graphql-multipart-request-spec#implementations) such as [`graphql-react`](https://npm.im/graphql-react) and [`apollo-upload-client`](https://npm.im/apollo-upload-client). - -## Setup - -Install with [npm](https://npmjs.com/get-npm): - -```shell -npm install extract-files -``` - -See the [`extractFiles`](#function-extractfiles) documentation to get started. - -## Support - -- Node.js `^10.17.0 || ^12.0.0 || >= 13.7.0` -- Browsers [`> 0.5%, not OperaMini all, not dead`](https://browserl.ist/?q=%3E+0.5%25%2C+not+OperaMini+all%2C+not+dead) -- React Native - -## API - -### Table of contents - -- [class ReactNativeFile](#class-reactnativefile) -- [function extractFiles](#function-extractfiles) -- [function isExtractableFile](#function-isextractablefile) -- [type ExtractableFile](#type-extractablefile) -- [type ExtractableFileMatcher](#type-extractablefilematcher) -- [type ExtractFilesResult](#type-extractfilesresult) -- [type ObjectPath](#type-objectpath) -- [type ReactNativeFileSubstitute](#type-reactnativefilesubstitute) - -### class ReactNativeFile - -Used to mark a [React Native `File` substitute](#type-reactnativefilesubstitute) in an object tree for [`extractFiles`](#function-extractfiles). It’s too risky to assume all objects with `uri`, `type` and `name` properties are files to extract. - -| Parameter | Type | Description | -| :-- | :-- | :-- | -| `file` | [ReactNativeFileSubstitute](#type-reactnativefilesubstitute) | A React Native [`File`](https://developer.mozilla.org/docs/web/api/file) substitute. | - -#### Examples - -_Ways to `import`._ - -> ```js -> import { ReactNativeFile } from 'extract-files'; -> ``` -> -> ```js -> import ReactNativeFile from 'extract-files/public/ReactNativeFile.js'; -> ``` - -_Ways to `require`._ - -> ```js -> const { ReactNativeFile } = require('extract-files'); -> ``` -> -> ```js -> const ReactNativeFile = require('extract-files/public/ReactNativeFile'); -> ``` - -_An extractable file in React Native._ - -> ```js -> import { ReactNativeFile } from 'extract-files'; -> -> const file = new ReactNativeFile({ -> uri: uriFromCameraRoll, -> name: 'a.jpg', -> type: 'image/jpeg', -> }); -> ``` - ---- - -### function extractFiles - -Clones a value, recursively extracting [`File`](https://developer.mozilla.org/docs/web/api/file), [`Blob`](https://developer.mozilla.org/docs/web/api/blob) and [`ReactNativeFile`](#class-reactnativefile) instances with their [object paths](#type-objectpath), replacing them with `null`. [`FileList`](https://developer.mozilla.org/docs/web/api/filelist) instances are treated as [`File`](https://developer.mozilla.org/docs/web/api/file) instance arrays. - -| Parameter | Type | Description | -| :-- | :-- | :-- | -| `value` | \* | Value (typically an object tree) to extract files from. | -| `path` | [ObjectPath](#type-objectpath)? = `''` | Prefix for object paths for extracted files. | -| `isExtractableFile` | [ExtractableFileMatcher](#type-extractablefilematcher)? = [isExtractableFile](#function-isextractablefile) | The function used to identify extractable files. | - -**Returns:** [ExtractFilesResult](#type-extractfilesresult) — Result. - -#### Examples - -_Ways to `import`._ - -> ```js -> import { extractFiles } from 'extract-files'; -> ``` -> -> ```js -> import extractFiles from 'extract-files/public/extractFiles.js'; -> ``` - -_Ways to `require`._ - -> ```js -> const { extractFiles } = require('extract-files'); -> ``` -> -> ```js -> const extractFiles = require('extract-files/public/extractFiles'); -> ``` - -_Extract files from an object._ - -> For the following: -> -> ```js -> import { extractFiles } from 'extract-files'; -> -> const file1 = new File(['1'], '1.txt', { type: 'text/plain' }); -> const file2 = new File(['2'], '2.txt', { type: 'text/plain' }); -> const value = { -> a: file1, -> b: [file1, file2], -> }; -> -> const { clone, files } = extractFiles(value, 'prefix'); -> ``` -> -> `value` remains the same. -> -> `clone` is: -> -> ```json -> { -> "a": null, -> "b": [null, null] -> } -> ``` -> -> `files` is a [`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) instance containing: -> -> | Key | Value | -> | :------ | :--------------------------- | -> | `file1` | `['prefix.a', 'prefix.b.0']` | -> | `file2` | `['prefix.b.1']` | - ---- - -### function isExtractableFile - -Checks if a value is an [extractable file](#type-extractablefile). - -**Type:** [ExtractableFileMatcher](#type-extractablefilematcher) - -| Parameter | Type | Description | -| :-------- | :--- | :-------------- | -| `value` | \* | Value to check. | - -**Returns:** boolean — Is the value an [extractable file](#type-extractablefile). - -#### Examples - -_Ways to `import`._ - -> ```js -> import { isExtractableFile } from 'extract-files'; -> ``` -> -> ```js -> import isExtractableFile from 'extract-files/public/isExtractableFile.js'; -> ``` - -_Ways to `require`._ - -> ```js -> const { isExtractableFile } = require('extract-files'); -> ``` -> -> ```js -> const isExtractableFile = require('extract-files/public/isExtractableFile'); -> ``` - ---- - -### type ExtractableFile - -An extractable file. - -**Type:** File | Blob | [ReactNativeFile](#class-reactnativefile) - ---- - -### type ExtractableFileMatcher - -A function that checks if a value is an [extractable file](#type-extractablefile). - -**Type:** Function - -| Parameter | Type | Description | -| :-------- | :--- | :-------------- | -| `value` | \* | Value to check. | - -**Returns:** boolean — Is the value an [extractable file](#type-extractablefile). - -#### See - -- [`isExtractableFile`](#function-isextractablefile) is the default extractable file matcher. - -#### Examples - -_How to check for the default exactable files, as well as a custom type of file._ - -> ```js -> import { isExtractableFile } from 'extract-files'; -> -> const isExtractableFileEnhanced = (value) => -> isExtractableFile(value) || -> (typeof CustomFile !== 'undefined' && value instanceof CustomFile); -> ``` - ---- - -### type ExtractFilesResult - -What [`extractFiles`](#function-extractfiles) returns. - -**Type:** object - -| Property | Type | Description | -| :-- | :-- | :-- | -| `clone` | \* | Clone of the original input value with files recursively replaced with `null`. | -| `files` | Map<[ExtractableFile](#type-extractablefile), Array<[ObjectPath](#type-objectpath)>> | Extracted files and their locations within the original value. | - ---- - -### type ObjectPath - -String notation for the path to a node in an object tree. - -**Type:** string - -#### See - -- [`object-path` on npm](https://npm.im/object-path). - -#### Examples - -_Object path is property `a`, array index `0`, object property `b`._ - -> a.0.b - ---- - -### type ReactNativeFileSubstitute - -A React Native [`File`](https://developer.mozilla.org/docs/web/api/file) substitute for when using [`FormData`](https://developer.mozilla.org/docs/web/api/formdata). - -**Type:** object - -| Property | Type | Description | -| :------- | :------ | :----------------- | -| `uri` | string | Filesystem path. | -| `name` | string? | File name. | -| `type` | string? | File content type. | - -#### See - -- [React Native `FormData` polyfill source](https://github.com/facebook/react-native/blob/v0.45.1/Libraries/Network/FormData.js#L34). - -#### Examples - -_A camera roll file._ - -> ```js -> const fileSubstitute = { -> uri: uriFromCameraRoll, -> name: 'a.jpg', -> type: 'image/jpeg', -> }; -> ``` diff --git a/node_modules/fast-json-stable-stringify/.eslintrc.yml b/node_modules/fast-json-stable-stringify/.eslintrc.yml deleted file mode 100644 index 1c77b0d4..00000000 --- a/node_modules/fast-json-stable-stringify/.eslintrc.yml +++ /dev/null @@ -1,26 +0,0 @@ -extends: eslint:recommended -env: - node: true - browser: true -rules: - block-scoped-var: 2 - callback-return: 2 - dot-notation: 2 - indent: 2 - linebreak-style: [2, unix] - new-cap: 2 - no-console: [2, allow: [warn, error]] - no-else-return: 2 - no-eq-null: 2 - no-fallthrough: 2 - no-invalid-this: 2 - no-return-assign: 2 - no-shadow: 1 - no-trailing-spaces: 2 - no-use-before-define: [2, nofunc] - quotes: [2, single, avoid-escape] - semi: [2, always] - strict: [2, global] - valid-jsdoc: [2, requireReturn: false] - no-control-regex: 0 - no-useless-escape: 2 diff --git a/node_modules/fast-json-stable-stringify/.npmignore b/node_modules/fast-json-stable-stringify/.npmignore deleted file mode 100644 index 899d7360..00000000 --- a/node_modules/fast-json-stable-stringify/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -.nyc_output/ -coverage/ -.DS_Store diff --git a/node_modules/fast-json-stable-stringify/.travis.yml b/node_modules/fast-json-stable-stringify/.travis.yml deleted file mode 100644 index 7ddce74b..00000000 --- a/node_modules/fast-json-stable-stringify/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "4" - - "6" - - "7" - - "8" -after_script: - - coveralls < coverage/lcov.info diff --git a/node_modules/fast-json-stable-stringify/LICENSE b/node_modules/fast-json-stable-stringify/LICENSE deleted file mode 100644 index ee27ba4b..00000000 --- a/node_modules/fast-json-stable-stringify/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -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. diff --git a/node_modules/fast-json-stable-stringify/README.md b/node_modules/fast-json-stable-stringify/README.md deleted file mode 100644 index 0f43b4a7..00000000 --- a/node_modules/fast-json-stable-stringify/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# fast-json-stable-stringify - -Deterministic `JSON.stringify()` - a faster version of [@substack](https://github.com/substack)'s json-stable-strigify without [jsonify](https://github.com/substack/jsonify). - -You can also pass in a custom comparison function. - -[![Build Status](https://travis-ci.org/epoberezkin/fast-json-stable-stringify.svg?branch=master)](https://travis-ci.org/epoberezkin/fast-json-stable-stringify) -[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/fast-json-stable-stringify/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/fast-json-stable-stringify?branch=master) - -# example - -``` js -var stringify = require('fast-json-stable-stringify'); -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -console.log(stringify(obj)); -``` - -output: - -``` -{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8} -``` - - -# methods - -``` js -var stringify = require('fast-json-stable-stringify') -``` - -## var str = stringify(obj, opts) - -Return a deterministic stringified string `str` from the object `obj`. - - -## options - -### cmp - -If `opts` is given, you can supply an `opts.cmp` to have a custom comparison -function for object keys. Your function `opts.cmp` is called with these -parameters: - -``` js -opts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue }) -``` - -For example, to sort on the object key names in reverse order you could write: - -``` js -var stringify = require('fast-json-stable-stringify'); - -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; -}); -console.log(s); -``` - -which results in the output string: - -``` -{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3} -``` - -Or if you wanted to sort on the object values in reverse order, you could write: - -``` -var stringify = require('fast-json-stable-stringify'); - -var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; -var s = stringify(obj, function (a, b) { - return a.value < b.value ? 1 : -1; -}); -console.log(s); -``` - -which outputs: - -``` -{"d":6,"c":5,"b":[{"z":3,"y":2,"x":1},9],"a":10} -``` - -### cycles - -Pass `true` in `opts.cycles` to stringify circular property as `__cycle__` - the result will not be a valid JSON string in this case. - -TypeError will be thrown in case of circular object without this option. - - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install fast-json-stable-stringify -``` - - -# benchmark - -To run benchmark (requires Node.js 6+): -``` -node benchmark -``` - -Results: -``` -fast-json-stable-stringify x 17,189 ops/sec ±1.43% (83 runs sampled) -json-stable-stringify x 13,634 ops/sec ±1.39% (85 runs sampled) -fast-stable-stringify x 20,212 ops/sec ±1.20% (84 runs sampled) -faster-stable-stringify x 15,549 ops/sec ±1.12% (84 runs sampled) -The fastest is fast-stable-stringify -``` - - -# license - -[MIT](https://github.com/epoberezkin/fast-json-stable-stringify/blob/master/LICENSE) diff --git a/node_modules/fast-json-stable-stringify/benchmark/index.js b/node_modules/fast-json-stable-stringify/benchmark/index.js deleted file mode 100644 index e725f9fc..00000000 --- a/node_modules/fast-json-stable-stringify/benchmark/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -const Benchmark = require('benchmark'); -const suite = new Benchmark.Suite; -const testData = require('./test.json'); - - -const stringifyPackages = { - // 'JSON.stringify': JSON.stringify, - 'fast-json-stable-stringify': require('../index'), - 'json-stable-stringify': true, - 'fast-stable-stringify': true, - 'faster-stable-stringify': true -}; - - -for (const name in stringifyPackages) { - let func = stringifyPackages[name]; - if (func === true) func = require(name); - - suite.add(name, function() { - func(testData); - }); -} - -suite - .on('cycle', (event) => console.log(String(event.target))) - .on('complete', function () { - console.log('The fastest is ' + this.filter('fastest').map('name')); - }) - .run({async: true}); diff --git a/node_modules/fast-json-stable-stringify/benchmark/test.json b/node_modules/fast-json-stable-stringify/benchmark/test.json deleted file mode 100644 index c9118c11..00000000 --- a/node_modules/fast-json-stable-stringify/benchmark/test.json +++ /dev/null @@ -1,137 +0,0 @@ -[ - { - "_id": "59ef4a83ee8364808d761beb", - "index": 0, - "guid": "e50ffae9-7128-4148-9ee5-40c3fc523c5d", - "isActive": false, - "balance": "$2,341.81", - "picture": "http://placehold.it/32x32", - "age": 28, - "eyeColor": "brown", - "name": "Carey Savage", - "gender": "female", - "company": "VERAQ", - "email": "careysavage@veraq.com", - "phone": "+1 (897) 574-3014", - "address": "458 Willow Street, Henrietta, California, 7234", - "about": "Nisi reprehenderit nulla ad officia pariatur non dolore laboris irure cupidatat laborum. Minim eu ex Lorem adipisicing exercitation irure minim sunt est enim mollit incididunt voluptate nulla. Ut mollit anim reprehenderit et aliqua ex esse aliquip. Aute sit duis deserunt do incididunt consequat minim qui dolor commodo deserunt et voluptate.\r\n", - "registered": "2014-05-21T01:56:51 -01:00", - "latitude": 63.89502, - "longitude": 62.369807, - "tags": [ - "nostrud", - "nisi", - "consectetur", - "ullamco", - "cupidatat", - "culpa", - "commodo" - ], - "friends": [ - { - "id": 0, - "name": "Henry Walls" - }, - { - "id": 1, - "name": "Janice Baker" - }, - { - "id": 2, - "name": "Russell Bush" - } - ], - "greeting": "Hello, Carey Savage! You have 4 unread messages.", - "favoriteFruit": "banana" - }, - { - "_id": "59ef4a83ff5774a691454e89", - "index": 1, - "guid": "2bee9efc-4095-4c2e-87ef-d08c8054c89d", - "isActive": true, - "balance": "$1,618.15", - "picture": "http://placehold.it/32x32", - "age": 35, - "eyeColor": "blue", - "name": "Elinor Pearson", - "gender": "female", - "company": "FLEXIGEN", - "email": "elinorpearson@flexigen.com", - "phone": "+1 (923) 548-3751", - "address": "600 Bayview Avenue, Draper, Montana, 3088", - "about": "Mollit commodo ea sit Lorem velit. Irure anim esse Lorem sint quis officia ut. Aliqua nisi dolore in aute deserunt mollit ex ea in mollit.\r\n", - "registered": "2017-04-22T07:58:41 -01:00", - "latitude": -87.824919, - "longitude": 69.538927, - "tags": [ - "fugiat", - "labore", - "proident", - "quis", - "eiusmod", - "qui", - "est" - ], - "friends": [ - { - "id": 0, - "name": "Massey Wagner" - }, - { - "id": 1, - "name": "Marcella Ferrell" - }, - { - "id": 2, - "name": "Evans Mckee" - } - ], - "greeting": "Hello, Elinor Pearson! You have 3 unread messages.", - "favoriteFruit": "strawberry" - }, - { - "_id": "59ef4a839ec8a4be4430b36b", - "index": 2, - "guid": "ddd6e8c0-95bd-416d-8b46-a768d6363809", - "isActive": false, - "balance": "$2,046.95", - "picture": "http://placehold.it/32x32", - "age": 40, - "eyeColor": "green", - "name": "Irwin Davidson", - "gender": "male", - "company": "DANJA", - "email": "irwindavidson@danja.com", - "phone": "+1 (883) 537-2041", - "address": "439 Cook Street, Chapin, Kentucky, 7398", - "about": "Irure velit non commodo aliqua exercitation ut nostrud minim magna. Dolor ad ad ut irure eu. Non pariatur dolor eiusmod ipsum do et exercitation cillum. Et amet laboris minim eiusmod ullamco magna ea reprehenderit proident sunt.\r\n", - "registered": "2016-09-01T07:49:08 -01:00", - "latitude": -49.803812, - "longitude": 104.93279, - "tags": [ - "consequat", - "enim", - "quis", - "magna", - "est", - "culpa", - "tempor" - ], - "friends": [ - { - "id": 0, - "name": "Ruth Hansen" - }, - { - "id": 1, - "name": "Kathrine Austin" - }, - { - "id": 2, - "name": "Rivera Munoz" - } - ], - "greeting": "Hello, Irwin Davidson! You have 2 unread messages.", - "favoriteFruit": "banana" - } -] diff --git a/node_modules/fast-json-stable-stringify/example/key_cmp.js b/node_modules/fast-json-stable-stringify/example/key_cmp.js deleted file mode 100644 index d5f66752..00000000 --- a/node_modules/fast-json-stable-stringify/example/key_cmp.js +++ /dev/null @@ -1,7 +0,0 @@ -var stringify = require('../'); - -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; -}); -console.log(s); diff --git a/node_modules/fast-json-stable-stringify/example/nested.js b/node_modules/fast-json-stable-stringify/example/nested.js deleted file mode 100644 index 9a672fc6..00000000 --- a/node_modules/fast-json-stable-stringify/example/nested.js +++ /dev/null @@ -1,3 +0,0 @@ -var stringify = require('../'); -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -console.log(stringify(obj)); diff --git a/node_modules/fast-json-stable-stringify/example/str.js b/node_modules/fast-json-stable-stringify/example/str.js deleted file mode 100644 index 9b4b3cd2..00000000 --- a/node_modules/fast-json-stable-stringify/example/str.js +++ /dev/null @@ -1,3 +0,0 @@ -var stringify = require('../'); -var obj = { c: 6, b: [4,5], a: 3 }; -console.log(stringify(obj)); diff --git a/node_modules/fast-json-stable-stringify/example/value_cmp.js b/node_modules/fast-json-stable-stringify/example/value_cmp.js deleted file mode 100644 index 09f1c5f7..00000000 --- a/node_modules/fast-json-stable-stringify/example/value_cmp.js +++ /dev/null @@ -1,7 +0,0 @@ -var stringify = require('../'); - -var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; -var s = stringify(obj, function (a, b) { - return a.value < b.value ? 1 : -1; -}); -console.log(s); diff --git a/node_modules/fast-json-stable-stringify/index.js b/node_modules/fast-json-stable-stringify/index.js deleted file mode 100644 index c44e6a41..00000000 --- a/node_modules/fast-json-stable-stringify/index.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -module.exports = function (data, opts) { - if (!opts) opts = {}; - if (typeof opts === 'function') opts = { cmp: opts }; - var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; - - var cmp = opts.cmp && (function (f) { - return function (node) { - return function (a, b) { - var aobj = { key: a, value: node[a] }; - var bobj = { key: b, value: node[b] }; - return f(aobj, bobj); - }; - }; - })(opts.cmp); - - var seen = []; - return (function stringify (node) { - if (node && node.toJSON && typeof node.toJSON === 'function') { - node = node.toJSON(); - } - - if (node === undefined) return; - if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; - if (typeof node !== 'object') return JSON.stringify(node); - - var i, out; - if (Array.isArray(node)) { - out = '['; - for (i = 0; i < node.length; i++) { - if (i) out += ','; - out += stringify(node[i]) || 'null'; - } - return out + ']'; - } - - if (node === null) return 'null'; - - if (seen.indexOf(node) !== -1) { - if (cycles) return JSON.stringify('__cycle__'); - throw new TypeError('Converting circular structure to JSON'); - } - - var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); - out = ''; - for (i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify(node[key]); - - if (!value) continue; - if (out) out += ','; - out += JSON.stringify(key) + ':' + value; - } - seen.splice(seenIndex, 1); - return '{' + out + '}'; - })(data); -}; diff --git a/node_modules/fast-json-stable-stringify/package.json b/node_modules/fast-json-stable-stringify/package.json deleted file mode 100644 index ab15fe5f..00000000 --- a/node_modules/fast-json-stable-stringify/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "_args": [ - [ - "fast-json-stable-stringify@2.0.0", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "fast-json-stable-stringify@2.0.0", - "_id": "fast-json-stable-stringify@2.0.0", - "_inBundle": false, - "_integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "_location": "/fast-json-stable-stringify", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "fast-json-stable-stringify@2.0.0", - "name": "fast-json-stable-stringify", - "escapedName": "fast-json-stable-stringify", - "rawSpec": "2.0.0", - "saveSpec": null, - "fetchSpec": "2.0.0" - }, - "_requiredBy": [ - "/apollo-utilities" - ], - "_resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "_spec": "2.0.0", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/epoberezkin/fast-json-stable-stringify/issues" - }, - "description": "deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify", - "devDependencies": { - "benchmark": "^2.1.4", - "coveralls": "^3.0.0", - "eslint": "^4.9.0", - "fast-stable-stringify": "latest", - "faster-stable-stringify": "latest", - "json-stable-stringify": "latest", - "nyc": "^11.2.1", - "pre-commit": "^1.2.2", - "tape": "~1.0.4" - }, - "homepage": "https://github.com/epoberezkin/fast-json-stable-stringify", - "keywords": [ - "json", - "stringify", - "deterministic", - "hash", - "stable" - ], - "license": "MIT", - "main": "index.js", - "name": "fast-json-stable-stringify", - "nyc": { - "exclude": [ - "test", - "node_modules" - ], - "reporter": [ - "lcov", - "text-summary" - ] - }, - "repository": { - "type": "git", - "url": "git://github.com/epoberezkin/fast-json-stable-stringify.git" - }, - "scripts": { - "eslint": "eslint index.js test", - "test": "npm run eslint && nyc npm run test-spec", - "test-spec": "tape test/*.js" - }, - "version": "2.0.0" -} diff --git a/node_modules/fast-json-stable-stringify/test/cmp.js b/node_modules/fast-json-stable-stringify/test/cmp.js deleted file mode 100644 index 4efd6b59..00000000 --- a/node_modules/fast-json-stable-stringify/test/cmp.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('custom comparison function', function (t) { - t.plan(1); - var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; - var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; - }); - t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}'); -}); diff --git a/node_modules/fast-json-stable-stringify/test/nested.js b/node_modules/fast-json-stable-stringify/test/nested.js deleted file mode 100644 index 167a358e..00000000 --- a/node_modules/fast-json-stable-stringify/test/nested.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('nested', function (t) { - t.plan(1); - var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; - t.equal(stringify(obj), '{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}'); -}); - -test('cyclic (default)', function (t) { - t.plan(1); - var one = { a: 1 }; - var two = { a: 2, one: one }; - one.two = two; - try { - stringify(one); - } catch (ex) { - t.equal(ex.toString(), 'TypeError: Converting circular structure to JSON'); - } -}); - -test('cyclic (specifically allowed)', function (t) { - t.plan(1); - var one = { a: 1 }; - var two = { a: 2, one: one }; - one.two = two; - t.equal(stringify(one, {cycles:true}), '{"a":1,"two":{"a":2,"one":"__cycle__"}}'); -}); - -test('repeated non-cyclic value', function(t) { - t.plan(1); - var one = { x: 1 }; - var two = { a: one, b: one }; - t.equal(stringify(two), '{"a":{"x":1},"b":{"x":1}}'); -}); - -test('acyclic but with reused obj-property pointers', function (t) { - t.plan(1); - var x = { a: 1 }; - var y = { b: x, c: x }; - t.equal(stringify(y), '{"b":{"a":1},"c":{"a":1}}'); -}); diff --git a/node_modules/fast-json-stable-stringify/test/str.js b/node_modules/fast-json-stable-stringify/test/str.js deleted file mode 100644 index 99a9ade1..00000000 --- a/node_modules/fast-json-stable-stringify/test/str.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('simple object', function (t) { - t.plan(1); - var obj = { c: 6, b: [4,5], a: 3, z: null }; - t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}'); -}); - -test('object with undefined', function (t) { - t.plan(1); - var obj = { a: 3, z: undefined }; - t.equal(stringify(obj), '{"a":3}'); -}); - -test('object with null', function (t) { - t.plan(1); - var obj = { a: 3, z: null }; - t.equal(stringify(obj), '{"a":3,"z":null}'); -}); - -test('object with NaN and Infinity', function (t) { - t.plan(1); - var obj = { a: 3, b: NaN, c: Infinity }; - t.equal(stringify(obj), '{"a":3,"b":null,"c":null}'); -}); - -test('array with undefined', function (t) { - t.plan(1); - var obj = [4, undefined, 6]; - t.equal(stringify(obj), '[4,null,6]'); -}); - -test('object with empty string', function (t) { - t.plan(1); - var obj = { a: 3, z: '' }; - t.equal(stringify(obj), '{"a":3,"z":""}'); -}); - -test('array with empty string', function (t) { - t.plan(1); - var obj = [4, '', 6]; - t.equal(stringify(obj), '[4,"",6]'); -}); diff --git a/node_modules/fast-json-stable-stringify/test/to-json.js b/node_modules/fast-json-stable-stringify/test/to-json.js deleted file mode 100644 index 2fb2cfa3..00000000 --- a/node_modules/fast-json-stable-stringify/test/to-json.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -var test = require('tape'); -var stringify = require('../'); - -test('toJSON function', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } }; - t.equal(stringify(obj), '{"one":1}' ); -}); - -test('toJSON returns string', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } }; - t.equal(stringify(obj), '"one"'); -}); - -test('toJSON returns array', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } }; - t.equal(stringify(obj), '["one"]'); -}); diff --git a/node_modules/fast-text-encoding/.travis.yml b/node_modules/fast-text-encoding/.travis.yml deleted file mode 100644 index 2f36afd9..00000000 --- a/node_modules/fast-text-encoding/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js - -node_js: - - stable diff --git a/node_modules/fast-text-encoding/LICENSE b/node_modules/fast-text-encoding/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/node_modules/fast-text-encoding/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/fast-text-encoding/README.md b/node_modules/fast-text-encoding/README.md deleted file mode 100644 index 84f0ffc3..00000000 --- a/node_modules/fast-text-encoding/README.md +++ /dev/null @@ -1,58 +0,0 @@ -[![Build](https://api.travis-ci.org/samthor/fast-text-encoding.svg?branch=master)](https://travis-ci.org/samthor/fast-text-encoding) - -This is a fast polyfill for [`TextEncoder`][1] and [`TextDecoder`][2], which let you encode and decode JavaScript strings into UTF-8 bytes. - -It is fast partially as it does not support any encodings aside UTF-8 (and note that natively, only `TextDecoder` supports alternative encodings anyway). -See [some benchmarks](https://github.com/samthor/fast-text-encoding/tree/master/bench). - -[1]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder -[2]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder - -# Usage - -Install as "fast-text-encoding" via your favourite package manager. - -You only need this polyfill if you're supporting older browsers like IE, legacy Edge, ancient Chrome and Firefox, or Node before v11. - -## Browser - -Include the minified code inside a `script` tag or as an ES6 Module for its side effects. -It will create `TextEncoder` and `TextDecoder` if the symbols are missing on `window` or `global.` - -```html - - -``` - -⚠️ You'll probably want to depend on `text.min.js`, as it's compiled to ES5 for older environments. - -## Node - -You only need this polyfill in Node before v11. -However, you can use `Buffer` to provide the same functionality (but not conforming to any spec) in versions even older than that. - -```js -require('fast-text-encoding'); // just require me before use - -const buffer = new TextEncoder().encode('Turn me into UTF-8!'); -// buffer is now a Uint8Array of [84, 117, 114, 110, ...] -``` - -In Node v5.1 and above, this polyfill uses `Buffer` to implement `TextDecoder`. - -# Release - -Compile code with [Closure Compiler](https://closure-compiler.appspot.com/home). - -``` -// ==ClosureCompiler== -// @compilation_level ADVANCED_OPTIMIZATIONS -// @output_file_name text.min.js -// ==/ClosureCompiler== - -// code here -``` diff --git a/node_modules/fast-text-encoding/compile.sh b/node_modules/fast-text-encoding/compile.sh deleted file mode 100644 index b8d83efb..00000000 --- a/node_modules/fast-text-encoding/compile.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env sh - -google-closure-compiler \ - --compilation_level ADVANCED \ - --js_output_file text.min.js \ - --language_out ECMASCRIPT5 \ - --warning_level VERBOSE \ - --create_source_map %outname%.map \ - --externs externs.js \ - text.js diff --git a/node_modules/fast-text-encoding/externs.js b/node_modules/fast-text-encoding/externs.js deleted file mode 100644 index acf27c56..00000000 --- a/node_modules/fast-text-encoding/externs.js +++ /dev/null @@ -1,20 +0,0 @@ - -/** - * @constructor - */ -var Buffer; - -/** - * @param {!ArrayBuffer} raw - * @param {number} byteOffset - * @param {number} byteLength - * @return {!Buffer} - */ -Buffer.from = function(raw, byteOffset, byteLength) {}; - -/** - * @this {*} - * @param {string} encoding - * @return {string} - */ -Buffer.prototype.toString = function(encoding) {}; diff --git a/node_modules/fast-text-encoding/package.json b/node_modules/fast-text-encoding/package.json deleted file mode 100644 index 7707e134..00000000 --- a/node_modules/fast-text-encoding/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "_from": "fast-text-encoding@^1.0.0", - "_id": "fast-text-encoding@1.0.3", - "_inBundle": false, - "_integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==", - "_location": "/fast-text-encoding", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "fast-text-encoding@^1.0.0", - "name": "fast-text-encoding", - "escapedName": "fast-text-encoding", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/google-auth-library" - ], - "_resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", - "_shasum": "ec02ac8e01ab8a319af182dae2681213cfe9ce53", - "_spec": "fast-text-encoding@^1.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "Sam Thorogood", - "email": "sam.thorogood@gmail.com" - }, - "bugs": { - "url": "https://github.com/samthor/fast-text-encoding/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Fast polyfill for TextEncoder and TextDecoder, only supports utf-8", - "devDependencies": { - "chai": "^4.2.0", - "google-closure-compiler": "^20200406.0.0", - "mocha": "^7.1.0" - }, - "homepage": "https://github.com/samthor/fast-text-encoding#readme", - "license": "Apache-2.0", - "main": "text.min.js", - "name": "fast-text-encoding", - "repository": { - "type": "git", - "url": "git+https://github.com/samthor/fast-text-encoding.git" - }, - "scripts": { - "compile": "./compile.sh", - "test": "mocha" - }, - "version": "1.0.3" -} diff --git a/node_modules/fast-text-encoding/text.js b/node_modules/fast-text-encoding/text.js deleted file mode 100644 index 96b866ef..00000000 --- a/node_modules/fast-text-encoding/text.js +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright 2017 Sam Thorogood. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -/** - * @fileoverview Polyfill for TextEncoder and TextDecoder. - * - * You probably want `text.min.js`, and not this file directly. - */ - -(function(scope) { -'use strict'; - -// fail early -if (scope['TextEncoder'] && scope['TextDecoder']) { - return false; -} - -// used for FastTextDecoder -const validUtfLabels = ['utf-8', 'utf8', 'unicode-1-1-utf-8']; - -/** - * @constructor - */ -function FastTextEncoder() { - // This does not accept an encoding, and always uses UTF-8: - // https://www.w3.org/TR/encoding/#dom-textencoder -} - -Object.defineProperty(FastTextEncoder.prototype, 'encoding', {value: 'utf-8'}); - -/** - * @param {string} string - * @param {{stream: boolean}=} options - * @return {!Uint8Array} - */ -FastTextEncoder.prototype['encode'] = function(string, options={stream: false}) { - if (options.stream) { - throw new Error(`Failed to encode: the 'stream' option is unsupported.`); - } - - let pos = 0; - const len = string.length; - - let at = 0; // output position - let tlen = Math.max(32, len + (len >>> 1) + 7); // 1.5x size - let target = new Uint8Array((tlen >>> 3) << 3); // ... but at 8 byte offset - - while (pos < len) { - let value = string.charCodeAt(pos++); - if (value >= 0xd800 && value <= 0xdbff) { - // high surrogate - if (pos < len) { - const extra = string.charCodeAt(pos); - if ((extra & 0xfc00) === 0xdc00) { - ++pos; - value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000; - } - } - if (value >= 0xd800 && value <= 0xdbff) { - continue; // drop lone surrogate - } - } - - // expand the buffer if we couldn't write 4 bytes - if (at + 4 > target.length) { - tlen += 8; // minimum extra - tlen *= (1.0 + (pos / string.length) * 2); // take 2x the remaining - tlen = (tlen >>> 3) << 3; // 8 byte offset - - const update = new Uint8Array(tlen); - update.set(target); - target = update; - } - - if ((value & 0xffffff80) === 0) { // 1-byte - target[at++] = value; // ASCII - continue; - } else if ((value & 0xfffff800) === 0) { // 2-byte - target[at++] = ((value >>> 6) & 0x1f) | 0xc0; - } else if ((value & 0xffff0000) === 0) { // 3-byte - target[at++] = ((value >>> 12) & 0x0f) | 0xe0; - target[at++] = ((value >>> 6) & 0x3f) | 0x80; - } else if ((value & 0xffe00000) === 0) { // 4-byte - target[at++] = ((value >>> 18) & 0x07) | 0xf0; - target[at++] = ((value >>> 12) & 0x3f) | 0x80; - target[at++] = ((value >>> 6) & 0x3f) | 0x80; - } else { - continue; // out of range - } - - target[at++] = (value & 0x3f) | 0x80; - } - - // Use subarray if slice isn't supported (IE11). This will use more memory - // because the original array still exists. - return target.slice ? target.slice(0, at) : target.subarray(0, at); -} - -/** - * @constructor - * @param {string=} utfLabel - * @param {{fatal: boolean}=} options - */ -function FastTextDecoder(utfLabel='utf-8', options={fatal: false}) { - if (validUtfLabels.indexOf(utfLabel.toLowerCase()) === -1) { - throw new RangeError( - `Failed to construct 'TextDecoder': The encoding label provided ('${utfLabel}') is invalid.`); - } - if (options.fatal) { - throw new Error(`Failed to construct 'TextDecoder': the 'fatal' option is unsupported.`); - } -} - -Object.defineProperty(FastTextDecoder.prototype, 'encoding', {value: 'utf-8'}); - -Object.defineProperty(FastTextDecoder.prototype, 'fatal', {value: false}); - -Object.defineProperty(FastTextDecoder.prototype, 'ignoreBOM', {value: false}); - -/** - * @param {!Uint8Array} bytes - * @return {string} - */ -function decodeBuffer(bytes) { - return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('utf-8'); -} - -/** - * @param {!Uint8Array} bytes - * @return {string} - */ -function decodeSyncXHR(bytes) { - const b = new Blob([bytes], {type: 'text/plain;charset=UTF-8'}); - const u = URL.createObjectURL(b); - - // This hack will fail in non-Edgium Edge because sync XHRs are disabled (and - // possibly in other places), so ensure there's a fallback call. - try { - const x = new XMLHttpRequest(); - x.open('GET', u, false); - x.send(); - return x.responseText; - } catch (e) { - return decodeFallback(bytes); - } finally { - URL.revokeObjectURL(u); - } -} - -/** - * @param {!Uint8Array} bytes - * @return {string} - */ -function decodeFallback(bytes) { - let inputIndex = 0; - - // Create a working buffer for UTF-16 code points, but don't generate one - // which is too large for small input sizes. UTF-8 to UCS-16 conversion is - // going to be at most 1:1, if all code points are ASCII. The other extreme - // is 4-byte UTF-8, which results in two UCS-16 points, but this is still 50% - // fewer entries in the output. - const pendingSize = Math.min(256 * 256, bytes.length + 1); - const pending = new Uint16Array(pendingSize); - const chunks = []; - let pendingIndex = 0; - - for (;;) { - const more = inputIndex < bytes.length; - - // If there's no more data or there'd be no room for two UTF-16 values, - // create a chunk. This isn't done at the end by simply slicing the data - // into equal sized chunks as we might hit a surrogate pair. - if (!more || (pendingIndex >= pendingSize - 1)) { - // nb. .apply and friends are *really slow*. Low-hanging fruit is to - // expand this to literally pass pending[0], pending[1], ... etc, but - // the output code expands pretty fast in this case. - chunks.push(String.fromCharCode.apply(null, pending.subarray(0, pendingIndex))); - - if (!more) { - return chunks.join(''); - } - - // Move the buffer forward and create another chunk. - bytes = bytes.subarray(inputIndex); - inputIndex = 0; - pendingIndex = 0; - } - - // The native TextDecoder will generate "REPLACEMENT CHARACTER" where the - // input data is invalid. Here, we blindly parse the data even if it's - // wrong: e.g., if a 3-byte sequence doesn't have two valid continuations. - - const byte1 = bytes[inputIndex++]; - if ((byte1 & 0x80) === 0) { // 1-byte or null - pending[pendingIndex++] = byte1; - } else if ((byte1 & 0xe0) === 0xc0) { // 2-byte - const byte2 = bytes[inputIndex++] & 0x3f; - pending[pendingIndex++] = ((byte1 & 0x1f) << 6) | byte2; - } else if ((byte1 & 0xf0) === 0xe0) { // 3-byte - const byte2 = bytes[inputIndex++] & 0x3f; - const byte3 = bytes[inputIndex++] & 0x3f; - pending[pendingIndex++] = ((byte1 & 0x1f) << 12) | (byte2 << 6) | byte3; - } else if ((byte1 & 0xf8) === 0xf0) { // 4-byte - const byte2 = bytes[inputIndex++] & 0x3f; - const byte3 = bytes[inputIndex++] & 0x3f; - const byte4 = bytes[inputIndex++] & 0x3f; - - // this can be > 0xffff, so possibly generate surrogates - let codepoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4; - if (codepoint > 0xffff) { - // codepoint &= ~0x10000; - codepoint -= 0x10000; - pending[pendingIndex++] = (codepoint >>> 10) & 0x3ff | 0xd800; - codepoint = 0xdc00 | codepoint & 0x3ff; - } - pending[pendingIndex++] = codepoint; - } else { - // invalid initial byte - } - } -} - -// Decoding a string is pretty slow, but use alternative options where possible. -let decodeImpl = decodeFallback; -if (typeof Buffer === 'function' && Buffer.from) { - // Buffer.from was added in Node v5.10.0 (2015-11-17). - decodeImpl = decodeBuffer; -} else if (typeof Blob === 'function' && typeof URL === 'function' && typeof URL.createObjectURL === 'function') { - // Blob and URL.createObjectURL are available from IE10, Safari 6, Chrome 19 - // (all released in 2012), Firefox 19 (2013), ... - decodeImpl = decodeSyncXHR; -} - -/** - * @param {(!ArrayBuffer|!ArrayBufferView)} buffer - * @param {{stream: boolean}=} options - * @return {string} - */ -FastTextDecoder.prototype['decode'] = function(buffer, options={stream: false}) { - if (options['stream']) { - throw new Error(`Failed to decode: the 'stream' option is unsupported.`); - } - - let bytes; - - if (buffer instanceof Uint8Array) { - // Accept Uint8Array instances as-is. - bytes = buffer; - } else if (buffer.buffer instanceof ArrayBuffer) { - // Look for ArrayBufferView, which isn't a real type, but basically - // represents all the valid TypedArray types plus DataView. They all have - // ".buffer" as an instance of ArrayBuffer. - bytes = new Uint8Array(buffer.buffer); - } else { - // The only other valid argument here is that "buffer" is an ArrayBuffer. - // We also try to convert anything else passed to a Uint8Array, as this - // catches anything that's array-like. Native code would throw here. - bytes = new Uint8Array(buffer); - } - - return decodeImpl(/** @type {!Uint8Array} */ (bytes)); -} - -scope['TextEncoder'] = FastTextEncoder; -scope['TextDecoder'] = FastTextDecoder; - -}(typeof window !== 'undefined' ? window : (typeof global !== 'undefined' ? global : this))); diff --git a/node_modules/fast-text-encoding/text.min.js b/node_modules/fast-text-encoding/text.min.js deleted file mode 100644 index 62457f76..00000000 --- a/node_modules/fast-text-encoding/text.min.js +++ /dev/null @@ -1,6 +0,0 @@ -(function(l){function m(){}function k(a,c){a=void 0===a?"utf-8":a;c=void 0===c?{fatal:!1}:c;if(-1===r.indexOf(a.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+a+"') is invalid.");if(c.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");}function t(a){return Buffer.from(a.buffer,a.byteOffset,a.byteLength).toString("utf-8")}function u(a){var c=URL.createObjectURL(new Blob([a],{type:"text/plain;charset=UTF-8"})); -try{var f=new XMLHttpRequest;f.open("GET",c,!1);f.send();return f.responseText}catch(e){return q(a)}finally{URL.revokeObjectURL(c)}}function q(a){for(var c=0,f=Math.min(65536,a.length+1),e=new Uint16Array(f),h=[],d=0;;){var b=c=f-1){h.push(String.fromCharCode.apply(null,e.subarray(0,d)));if(!b)return h.join("");a=a.subarray(c);d=c=0}b=a[c++];if(0===(b&128))e[d++]=b;else if(192===(b&224)){var g=a[c++]&63;e[d++]=(b&31)<<6|g}else if(224===(b&240)){g=a[c++]&63;var n=a[c++]&63;e[d++]= -(b&31)<<12|g<<6|n}else if(240===(b&248)){g=a[c++]&63;n=a[c++]&63;var v=a[c++]&63;b=(b&7)<<18|g<<12|n<<6|v;65535>>10&1023|55296,b=56320|b&1023);e[d++]=b}}}if(l.TextEncoder&&l.TextDecoder)return!1;var r=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(m.prototype,"encoding",{value:"utf-8"});m.prototype.encode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to encode: the 'stream' option is unsupported.");c=0;for(var f=a.length,e=0,h=Math.max(32, -f+(f>>>1)+7),d=new Uint8Array(h>>>3<<3);c=b){if(c=b)continue}e+4>d.length&&(h+=8,h*=1+c/a.length*2,h=h>>>3<<3,g=new Uint8Array(h),g.set(d),d=g);if(0===(b&4294967168))d[e++]=b;else{if(0===(b&4294965248))d[e++]=b>>>6&31|192;else if(0===(b&4294901760))d[e++]=b>>>12&15|224,d[e++]=b>>>6&63|128;else if(0===(b&4292870144))d[e++]=b>>>18&7|240,d[e++]=b>>>12& -63|128,d[e++]=b>>>6&63|128;else continue;d[e++]=b&63|128}}return d.slice?d.slice(0,e):d.subarray(0,e)};Object.defineProperty(k.prototype,"encoding",{value:"utf-8"});Object.defineProperty(k.prototype,"fatal",{value:!1});Object.defineProperty(k.prototype,"ignoreBOM",{value:!1});var p=q;"function"===typeof Buffer&&Buffer.from?p=t:"function"===typeof Blob&&"function"===typeof URL&&"function"===typeof URL.createObjectURL&&(p=u);k.prototype.decode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to decode: the 'stream' option is unsupported."); -a=a instanceof Uint8Array?a:a.buffer instanceof ArrayBuffer?new Uint8Array(a.buffer):new Uint8Array(a);return p(a)};l.TextEncoder=m;l.TextDecoder=k})("undefined"!==typeof window?window:"undefined"!==typeof global?global:this); diff --git a/node_modules/fast-text-encoding/text.min.js.map b/node_modules/fast-text-encoding/text.min.js.map deleted file mode 100644 index 747307d9..00000000 --- a/node_modules/fast-text-encoding/text.min.js.map +++ /dev/null @@ -1,8 +0,0 @@ -{ -"version":3, -"file":"text.min.js", -"lineCount":6, -"mappings":"AAsBC,SAAQ,CAACA,CAAD,CAAQ,CAcjBC,QAASA,EAAe,EAAG,EAgF3BC,QAASA,EAAe,CAACC,CAAD,CAAmBC,CAAnB,CAA2C,CAA1CD,CAAA,CAAA,IAAA,EAAA,GAAAA,CAAA,CAAS,OAAT,CAAAA,CAAkBC,EAAA,CAAA,IAAA,EAAA,GAAAA,CAAA,CAAQ,CAACC,MAAO,CAAA,CAAR,CAAR,CAAAD,CACzC,IAAuD,EAAvD,GAAIE,CAAAC,QAAA,CAAuBJ,CAAAK,YAAA,EAAvB,CAAJ,CACE,KAAM,KAAIC,UAAJ,CACJ,mEADI,CACgEN,CADhE,CACJ,gBADI,CAAN,CAGF,GAAIC,CAAAC,MAAJ,CACE,KAAUK,MAAJ,CAAU,uEAAV,CAAN,CAN+D,CAoBnEC,QAASA,EAAY,CAACC,CAAD,CAAQ,CAC3B,MAAOC,OAAAC,KAAA,CAAYF,CAAAG,OAAZ,CAA0BH,CAAAI,WAA1B,CAA4CJ,CAAAK,WAA5C,CAAAC,SAAA,CAAuE,OAAvE,CADoB,CAQ7BC,QAASA,EAAa,CAACP,CAAD,CAAQ,CAE5B,IAAMQ,EAAIC,GAAAC,gBAAA,CADAC,IAAIC,IAAJD,CAAS,CAACX,CAAD,CAATW,CAAkB,CAACE,KAAM,0BAAP,CAAlBF,CACA,CAIV;GAAI,CACF,IAAMG,EAAI,IAAIC,cACdD,EAAAE,KAAA,CAAO,KAAP,CAAcR,CAAd,CAAiB,CAAA,CAAjB,CACAM,EAAAG,KA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1D,CAEAH,OAAAC,eAAA,CAAsBtD,CAAAuD,UAAtB,CAAiD,WAAjD,CAA8D,CAACC,MAAO,CAAA,CAAR,CAA9D,CA0GA,KAAIe,EAAazC,CACK,WAAtB,GAAI,MAAOnB,OAAX,EAAoCA,MAAAC,KAApC,CAEE2D,CAFF,CAEe9D,CAFf,CAG2B,UAH3B,GAGW,MAAOa,KAHlB,EAGwD,UAHxD,GAGyC,MAAOH,IAHhD,EAGqG,UAHrG,GAGsE,MAAOA,IAAAC,gBAH7E,GAMEmD,CANF,CAMetD,CANf,CAcAjB,EAAAuD,UAAA,OAAA,CAAsC,QAAQ,CAAC1C,CAAD,CAASX,CAAT,CAAkC,CAAzBA,CAAA,CAAA,IAAA,EAAA,GAAAA,CAAA,CAAQ,CAACwD,OAAQ,CAAA,CAAT,CAAR,CAAAxD,CACrD,IAAIA,CAAA,OAAJ,CACE,KAAUM,MAAJ,CAAU,uDAAV,CAAN;AAOAE,CAAA,CAFEG,CAAJ,WAAsBoD,WAAtB,CAEUpD,CAFV,CAGWA,CAAAA,OAAJ,WAA6B2D,YAA7B,CAIG,IAAIP,UAAJ,CAAepD,CAAAA,OAAf,CAJH,CASG,IAAIoD,UAAJ,CAAepD,CAAf,CAGV,OAAO0D,EAAA,CAAuC7D,CAAvC,CAtBuE,CAyBhFZ,EAAA,YAAA,CAAuBC,CACvBD,EAAA,YAAA,CAAuBE,CA/PN,CAAhB,CAAA,CAiQmB,WAAlB,GAAA,MAAOyE,OAAP,CAAgCA,MAAhC,CAA4D,WAAlB,GAAA,MAAOC,OAAP,CAAgCA,MAAhC,CAAyC,IAjQpF;", -"sources":["text.js"], -"names":["scope","FastTextEncoder","FastTextDecoder","utfLabel","options","fatal","validUtfLabels","indexOf","toLowerCase","RangeError","Error","decodeBuffer","bytes","Buffer","from","buffer","byteOffset","byteLength","toString","decodeSyncXHR","u","URL","createObjectURL","b","Blob","type","x","XMLHttpRequest","open","send","responseText","e","decodeFallback","revokeObjectURL","inputIndex","pendingSize","Math","min","length","pending","Uint16Array","chunks","pendingIndex","more","push","String","fromCharCode","apply","subarray","join","byte1","byte2","byte3","byte4","codepoint","Object","defineProperty","prototype","value","string","stream","pos","len","at","tlen","max","target","Uint8Array","charCodeAt","extra","update","set","slice","decodeImpl","ArrayBuffer","window","global"] -} diff --git a/node_modules/form-data/License b/node_modules/form-data/License deleted file mode 100644 index c7ff12a2..00000000 --- a/node_modules/form-data/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors - - 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. diff --git a/node_modules/form-data/README.md b/node_modules/form-data/README.md deleted file mode 100644 index 42f630f2..00000000 --- a/node_modules/form-data/README.md +++ /dev/null @@ -1,351 +0,0 @@ -# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) - -A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. - -The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. - -[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface - -[![Linux Build](https://img.shields.io/travis/form-data/form-data/v3.0.0.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data) -[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v3.0.0.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data) -[![Windows Build](https://img.shields.io/travis/form-data/form-data/v3.0.0.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data) - -[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v3.0.0.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) -[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) - -## Install - -``` -npm install --save form-data -``` - -## Usage - -In this example we are constructing a form with 3 fields that contain a string, -a buffer and a file stream. - -``` javascript -var FormData = require('form-data'); -var fs = require('fs'); - -var form = new FormData(); -form.append('my_field', 'my value'); -form.append('my_buffer', new Buffer(10)); -form.append('my_file', fs.createReadStream('/foo/bar.jpg')); -``` - -Also you can use http-response stream: - -``` javascript -var FormData = require('form-data'); -var http = require('http'); - -var form = new FormData(); - -http.request('http://nodejs.org/images/logo.png', function(response) { - form.append('my_field', 'my value'); - form.append('my_buffer', new Buffer(10)); - form.append('my_logo', response); -}); -``` - -Or @mikeal's [request](https://github.com/request/request) stream: - -``` javascript -var FormData = require('form-data'); -var request = require('request'); - -var form = new FormData(); - -form.append('my_field', 'my value'); -form.append('my_buffer', new Buffer(10)); -form.append('my_logo', request('http://nodejs.org/images/logo.png')); -``` - -In order to submit this form to a web application, call ```submit(url, [callback])``` method: - -``` javascript -form.submit('http://example.org/', function(err, res) { - // res – response object (http.IncomingMessage) // - res.resume(); -}); - -``` - -For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. - -### Custom options - -You can provide custom options, such as `maxDataSize`: - -``` javascript -var FormData = require('form-data'); - -var form = new FormData({ maxDataSize: 20971520 }); -form.append('my_field', 'my value'); -form.append('my_buffer', /* something big */); -``` - -List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) - -### Alternative submission methods - -You can use node's http client interface: - -``` javascript -var http = require('http'); - -var request = http.request({ - method: 'post', - host: 'example.org', - path: '/upload', - headers: form.getHeaders() -}); - -form.pipe(request); - -request.on('response', function(res) { - console.log(res.statusCode); -}); -``` - -Or if you would prefer the `'Content-Length'` header to be set for you: - -``` javascript -form.submit('example.org/upload', function(err, res) { - console.log(res.statusCode); -}); -``` - -To use custom headers and pre-known length in parts: - -``` javascript -var CRLF = '\r\n'; -var form = new FormData(); - -var options = { - header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, - knownLength: 1 -}; - -form.append('my_buffer', buffer, options); - -form.submit('http://example.com/', function(err, res) { - if (err) throw err; - console.log('Done'); -}); -``` - -Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: - -``` javascript -someModule.stream(function(err, stdout, stderr) { - if (err) throw err; - - var form = new FormData(); - - form.append('file', stdout, { - filename: 'unicycle.jpg', // ... or: - filepath: 'photos/toys/unicycle.jpg', - contentType: 'image/jpeg', - knownLength: 19806 - }); - - form.submit('http://example.com/', function(err, res) { - if (err) throw err; - console.log('Done'); - }); -}); -``` - -The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). - -For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: - -``` javascript -form.submit({ - host: 'example.com', - path: '/probably.php?extra=params', - auth: 'username:password' -}, function(err, res) { - console.log(res.statusCode); -}); -``` - -In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: - -``` javascript -form.submit({ - host: 'example.com', - path: '/surelynot.php', - headers: {'x-test-header': 'test-header-value'} -}, function(err, res) { - console.log(res.statusCode); -}); -``` - -### Methods - -- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-). -- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-) -- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary) -- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer) -- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync) -- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-) -- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength) -- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-) -- [_String_ toString()](https://github.com/form-data/form-data#string-tostring) - -#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] ) -Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user. -```javascript -var form = new FormData(); -form.append( 'my_string', 'my value' ); -form.append( 'my_integer', 1 ); -form.append( 'my_boolean', true ); -form.append( 'my_buffer', new Buffer(10) ); -form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) ) -``` - -You may provide a string for options, or an object. -```javascript -// Set filename by providing a string for options -form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' ); - -// provide an object. -form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} ); -``` - -#### _Headers_ getHeaders( [**Headers** _userHeaders_] ) -This method ads the correct `content-type` header to the provided array of `userHeaders`. - -#### _String_ getBoundary() -Return the boundary of the formData. A boundary consists of 26 `-` followed by 24 numbers -for example: -```javascript ---------------------------515890814546601021194782 -``` -_Note: The boundary must be unique and may not appear in the data._ - -#### _Buffer_ getBuffer() -Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data. -```javascript -var form = new FormData(); -form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) ); -form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') ); - -axios.post( 'https://example.com/path/to/api', - form.getBuffer(), - form.getHeaders() - ) -``` -**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error. - -#### _Integer_ getLengthSync() -Same as `getLength` but synchronous. - -_Note: getLengthSync __doesn't__ calculate streams length._ - -#### _Integer_ getLength( **function** _callback_ ) -Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated -```javascript -this.getLength(function(err, length) { - if (err) { - this._error(err); - return; - } - - // add content length - request.setHeader('Content-Length', length); - - ... -}.bind(this)); -``` - -#### _Boolean_ hasKnownLength() -Checks if the length of added values is known. - -#### _Request_ submit( _params_, **function** _callback_ ) -Submit the form to a web application. -```javascript -var form = new FormData(); -form.append( 'my_string', 'Hello World' ); - -form.submit( 'http://example.com/', function(err, res) { - // res – response object (http.IncomingMessage) // - res.resume(); -} ); -``` - -#### _String_ toString() -Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead. - -### Integration with other libraries - -#### Request - -Form submission using [request](https://github.com/request/request): - -```javascript -var formData = { - my_field: 'my_value', - my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), -}; - -request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { - if (err) { - return console.error('upload failed:', err); - } - console.log('Upload successful! Server responded with:', body); -}); -``` - -For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). - -#### node-fetch - -You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): - -```javascript -var form = new FormData(); - -form.append('a', 1); - -fetch('http://example.com', { method: 'POST', body: form }) - .then(function(res) { - return res.json(); - }).then(function(json) { - console.log(json); - }); -``` - -#### axios - -In Node.js you can post a file using [axios](https://github.com/axios/axios): -```javascript -const form = new FormData(); -const stream = fs.createReadStream(PATH_TO_FILE); - -form.append('image', stream); - -// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders` -const formHeaders = form.getHeaders(); - -axios.post('http://example.com', form, { - headers: { - ...formHeaders, - }, -}) -.then(response => response) -.catch(error => error) -``` - -## Notes - -- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. -- Starting version `2.x` FormData has dropped support for `node@0.10.x`. -- Starting version `3.x` FormData has dropped support for `node@4.x`. - -## License - -Form-Data is released under the [MIT](License) license. diff --git a/node_modules/form-data/README.md.bak b/node_modules/form-data/README.md.bak deleted file mode 100644 index e9195bdb..00000000 --- a/node_modules/form-data/README.md.bak +++ /dev/null @@ -1,351 +0,0 @@ -# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) - -A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. - -The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. - -[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface - -[![Linux Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data) -[![MacOS Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data) -[![Windows Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data) - -[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/master.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) -[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) - -## Install - -``` -npm install --save form-data -``` - -## Usage - -In this example we are constructing a form with 3 fields that contain a string, -a buffer and a file stream. - -``` javascript -var FormData = require('form-data'); -var fs = require('fs'); - -var form = new FormData(); -form.append('my_field', 'my value'); -form.append('my_buffer', new Buffer(10)); -form.append('my_file', fs.createReadStream('/foo/bar.jpg')); -``` - -Also you can use http-response stream: - -``` javascript -var FormData = require('form-data'); -var http = require('http'); - -var form = new FormData(); - -http.request('http://nodejs.org/images/logo.png', function(response) { - form.append('my_field', 'my value'); - form.append('my_buffer', new Buffer(10)); - form.append('my_logo', response); -}); -``` - -Or @mikeal's [request](https://github.com/request/request) stream: - -``` javascript -var FormData = require('form-data'); -var request = require('request'); - -var form = new FormData(); - -form.append('my_field', 'my value'); -form.append('my_buffer', new Buffer(10)); -form.append('my_logo', request('http://nodejs.org/images/logo.png')); -``` - -In order to submit this form to a web application, call ```submit(url, [callback])``` method: - -``` javascript -form.submit('http://example.org/', function(err, res) { - // res – response object (http.IncomingMessage) // - res.resume(); -}); - -``` - -For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. - -### Custom options - -You can provide custom options, such as `maxDataSize`: - -``` javascript -var FormData = require('form-data'); - -var form = new FormData({ maxDataSize: 20971520 }); -form.append('my_field', 'my value'); -form.append('my_buffer', /* something big */); -``` - -List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) - -### Alternative submission methods - -You can use node's http client interface: - -``` javascript -var http = require('http'); - -var request = http.request({ - method: 'post', - host: 'example.org', - path: '/upload', - headers: form.getHeaders() -}); - -form.pipe(request); - -request.on('response', function(res) { - console.log(res.statusCode); -}); -``` - -Or if you would prefer the `'Content-Length'` header to be set for you: - -``` javascript -form.submit('example.org/upload', function(err, res) { - console.log(res.statusCode); -}); -``` - -To use custom headers and pre-known length in parts: - -``` javascript -var CRLF = '\r\n'; -var form = new FormData(); - -var options = { - header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, - knownLength: 1 -}; - -form.append('my_buffer', buffer, options); - -form.submit('http://example.com/', function(err, res) { - if (err) throw err; - console.log('Done'); -}); -``` - -Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: - -``` javascript -someModule.stream(function(err, stdout, stderr) { - if (err) throw err; - - var form = new FormData(); - - form.append('file', stdout, { - filename: 'unicycle.jpg', // ... or: - filepath: 'photos/toys/unicycle.jpg', - contentType: 'image/jpeg', - knownLength: 19806 - }); - - form.submit('http://example.com/', function(err, res) { - if (err) throw err; - console.log('Done'); - }); -}); -``` - -The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). - -For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: - -``` javascript -form.submit({ - host: 'example.com', - path: '/probably.php?extra=params', - auth: 'username:password' -}, function(err, res) { - console.log(res.statusCode); -}); -``` - -In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: - -``` javascript -form.submit({ - host: 'example.com', - path: '/surelynot.php', - headers: {'x-test-header': 'test-header-value'} -}, function(err, res) { - console.log(res.statusCode); -}); -``` - -### Methods - -- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-). -- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-) -- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary) -- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer) -- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync) -- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-) -- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength) -- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-) -- [_String_ toString()](https://github.com/form-data/form-data#string-tostring) - -#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] ) -Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user. -```javascript -var form = new FormData(); -form.append( 'my_string', 'my value' ); -form.append( 'my_integer', 1 ); -form.append( 'my_boolean', true ); -form.append( 'my_buffer', new Buffer(10) ); -form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) ) -``` - -You may provide a string for options, or an object. -```javascript -// Set filename by providing a string for options -form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' ); - -// provide an object. -form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} ); -``` - -#### _Headers_ getHeaders( [**Headers** _userHeaders_] ) -This method ads the correct `content-type` header to the provided array of `userHeaders`. - -#### _String_ getBoundary() -Return the boundary of the formData. A boundary consists of 26 `-` followed by 24 numbers -for example: -```javascript ---------------------------515890814546601021194782 -``` -_Note: The boundary must be unique and may not appear in the data._ - -#### _Buffer_ getBuffer() -Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data. -```javascript -var form = new FormData(); -form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) ); -form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') ); - -axios.post( 'https://example.com/path/to/api', - form.getBuffer(), - form.getHeaders() - ) -``` -**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error. - -#### _Integer_ getLengthSync() -Same as `getLength` but synchronous. - -_Note: getLengthSync __doesn't__ calculate streams length._ - -#### _Integer_ getLength( **function** _callback_ ) -Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated -```javascript -this.getLength(function(err, length) { - if (err) { - this._error(err); - return; - } - - // add content length - request.setHeader('Content-Length', length); - - ... -}.bind(this)); -``` - -#### _Boolean_ hasKnownLength() -Checks if the length of added values is known. - -#### _Request_ submit( _params_, **function** _callback_ ) -Submit the form to a web application. -```javascript -var form = new FormData(); -form.append( 'my_string', 'Hello World' ); - -form.submit( 'http://example.com/', function(err, res) { - // res – response object (http.IncomingMessage) // - res.resume(); -} ); -``` - -#### _String_ toString() -Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead. - -### Integration with other libraries - -#### Request - -Form submission using [request](https://github.com/request/request): - -```javascript -var formData = { - my_field: 'my_value', - my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), -}; - -request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { - if (err) { - return console.error('upload failed:', err); - } - console.log('Upload successful! Server responded with:', body); -}); -``` - -For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). - -#### node-fetch - -You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): - -```javascript -var form = new FormData(); - -form.append('a', 1); - -fetch('http://example.com', { method: 'POST', body: form }) - .then(function(res) { - return res.json(); - }).then(function(json) { - console.log(json); - }); -``` - -#### axios - -In Node.js you can post a file using [axios](https://github.com/axios/axios): -```javascript -const form = new FormData(); -const stream = fs.createReadStream(PATH_TO_FILE); - -form.append('image', stream); - -// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders` -const formHeaders = form.getHeaders(); - -axios.post('http://example.com', form, { - headers: { - ...formHeaders, - }, -}) -.then(response => response) -.catch(error => error) -``` - -## Notes - -- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. -- Starting version `2.x` FormData has dropped support for `node@0.10.x`. -- Starting version `3.x` FormData has dropped support for `node@4.x`. - -## License - -Form-Data is released under the [MIT](License) license. diff --git a/node_modules/form-data/index.d.ts b/node_modules/form-data/index.d.ts deleted file mode 100644 index 6e520454..00000000 --- a/node_modules/form-data/index.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -// Definitions by: Carlos Ballesteros Velasco -// Leon Yu -// BendingBender -// Maple Miao - -/// -import * as stream from 'stream'; -import * as http from 'http'; - -export = FormData; - -// Extracted because @types/node doesn't export interfaces. -interface ReadableOptions { - highWaterMark?: number; - encoding?: string; - objectMode?: boolean; - read?(this: stream.Readable, size: number): void; - destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void; - autoDestroy?: boolean; -} - -interface Options extends ReadableOptions { - writable?: boolean; - readable?: boolean; - dataSize?: number; - maxDataSize?: number; - pauseStreams?: boolean; -} - -declare class FormData extends stream.Readable { - constructor(options?: Options); - append(key: string, value: any, options?: FormData.AppendOptions | string): void; - getHeaders(userHeaders?: FormData.Headers): FormData.Headers; - submit( - params: string | FormData.SubmitOptions, - callback?: (error: Error | null, response: http.IncomingMessage) => void - ): http.ClientRequest; - getBuffer(): Buffer; - getBoundary(): string; - getLength(callback: (err: Error | null, length: number) => void): void; - getLengthSync(): number; - hasKnownLength(): boolean; -} - -declare namespace FormData { - interface Headers { - [key: string]: any; - } - - interface AppendOptions { - header?: string | Headers; - knownLength?: number; - filename?: string; - filepath?: string; - contentType?: string; - } - - interface SubmitOptions extends http.RequestOptions { - protocol?: 'https:' | 'http:'; - } -} diff --git a/node_modules/form-data/lib/browser.js b/node_modules/form-data/lib/browser.js deleted file mode 100644 index 09e7c70e..00000000 --- a/node_modules/form-data/lib/browser.js +++ /dev/null @@ -1,2 +0,0 @@ -/* eslint-env browser */ -module.exports = typeof self == 'object' ? self.FormData : window.FormData; diff --git a/node_modules/form-data/lib/form_data.js b/node_modules/form-data/lib/form_data.js deleted file mode 100644 index ddfae2e3..00000000 --- a/node_modules/form-data/lib/form_data.js +++ /dev/null @@ -1,494 +0,0 @@ -var CombinedStream = require('combined-stream'); -var util = require('util'); -var path = require('path'); -var http = require('http'); -var https = require('https'); -var parseUrl = require('url').parse; -var fs = require('fs'); -var mime = require('mime-types'); -var asynckit = require('asynckit'); -var populate = require('./populate.js'); - -// Public API -module.exports = FormData; - -// make it a Stream -util.inherits(FormData, CombinedStream); - -/** - * Create readable "multipart/form-data" streams. - * Can be used to submit forms - * and file uploads to other web applications. - * - * @constructor - * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream - */ -function FormData(options) { - if (!(this instanceof FormData)) { - return new FormData(options); - } - - this._overheadLength = 0; - this._valueLength = 0; - this._valuesToMeasure = []; - - CombinedStream.call(this); - - options = options || {}; - for (var option in options) { - this[option] = options[option]; - } -} - -FormData.LINE_BREAK = '\r\n'; -FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; - -FormData.prototype.append = function(field, value, options) { - - options = options || {}; - - // allow filename as single option - if (typeof options == 'string') { - options = {filename: options}; - } - - var append = CombinedStream.prototype.append.bind(this); - - // all that streamy business can't handle numbers - if (typeof value == 'number') { - value = '' + value; - } - - // https://github.com/felixge/node-form-data/issues/38 - if (util.isArray(value)) { - // Please convert your array into string - // the way web server expects it - this._error(new Error('Arrays are not supported.')); - return; - } - - var header = this._multiPartHeader(field, value, options); - var footer = this._multiPartFooter(); - - append(header); - append(value); - append(footer); - - // pass along options.knownLength - this._trackLength(header, value, options); -}; - -FormData.prototype._trackLength = function(header, value, options) { - var valueLength = 0; - - // used w/ getLengthSync(), when length is known. - // e.g. for streaming directly from a remote server, - // w/ a known file a size, and not wanting to wait for - // incoming file to finish to get its size. - if (options.knownLength != null) { - valueLength += +options.knownLength; - } else if (Buffer.isBuffer(value)) { - valueLength = value.length; - } else if (typeof value === 'string') { - valueLength = Buffer.byteLength(value); - } - - this._valueLength += valueLength; - - // @check why add CRLF? does this account for custom/multiple CRLFs? - this._overheadLength += - Buffer.byteLength(header) + - FormData.LINE_BREAK.length; - - // empty or either doesn't have path or not an http response - if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) { - return; - } - - // no need to bother with the length - if (!options.knownLength) { - this._valuesToMeasure.push(value); - } -}; - -FormData.prototype._lengthRetriever = function(value, callback) { - - if (value.hasOwnProperty('fd')) { - - // take read range into a account - // `end` = Infinity –> read file till the end - // - // TODO: Looks like there is bug in Node fs.createReadStream - // it doesn't respect `end` options without `start` options - // Fix it when node fixes it. - // https://github.com/joyent/node/issues/7819 - if (value.end != undefined && value.end != Infinity && value.start != undefined) { - - // when end specified - // no need to calculate range - // inclusive, starts with 0 - callback(null, value.end + 1 - (value.start ? value.start : 0)); - - // not that fast snoopy - } else { - // still need to fetch file size from fs - fs.stat(value.path, function(err, stat) { - - var fileSize; - - if (err) { - callback(err); - return; - } - - // update final size based on the range options - fileSize = stat.size - (value.start ? value.start : 0); - callback(null, fileSize); - }); - } - - // or http response - } else if (value.hasOwnProperty('httpVersion')) { - callback(null, +value.headers['content-length']); - - // or request stream http://github.com/mikeal/request - } else if (value.hasOwnProperty('httpModule')) { - // wait till response come back - value.on('response', function(response) { - value.pause(); - callback(null, +response.headers['content-length']); - }); - value.resume(); - - // something else - } else { - callback('Unknown stream'); - } -}; - -FormData.prototype._multiPartHeader = function(field, value, options) { - // custom header specified (as string)? - // it becomes responsible for boundary - // (e.g. to handle extra CRLFs on .NET servers) - if (typeof options.header == 'string') { - return options.header; - } - - var contentDisposition = this._getContentDisposition(value, options); - var contentType = this._getContentType(value, options); - - var contents = ''; - var headers = { - // add custom disposition as third element or keep it two elements if not - 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), - // if no content type. allow it to be empty array - 'Content-Type': [].concat(contentType || []) - }; - - // allow custom headers. - if (typeof options.header == 'object') { - populate(headers, options.header); - } - - var header; - for (var prop in headers) { - if (!headers.hasOwnProperty(prop)) continue; - header = headers[prop]; - - // skip nullish headers. - if (header == null) { - continue; - } - - // convert all headers to arrays. - if (!Array.isArray(header)) { - header = [header]; - } - - // add non-empty headers. - if (header.length) { - contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK; - } - } - - return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; -}; - -FormData.prototype._getContentDisposition = function(value, options) { - - var filename - , contentDisposition - ; - - if (typeof options.filepath === 'string') { - // custom filepath for relative paths - filename = path.normalize(options.filepath).replace(/\\/g, '/'); - } else if (options.filename || value.name || value.path) { - // custom filename take precedence - // formidable and the browser add a name property - // fs- and request- streams have path property - filename = path.basename(options.filename || value.name || value.path); - } else if (value.readable && value.hasOwnProperty('httpVersion')) { - // or try http response - filename = path.basename(value.client._httpMessage.path || ''); - } - - if (filename) { - contentDisposition = 'filename="' + filename + '"'; - } - - return contentDisposition; -}; - -FormData.prototype._getContentType = function(value, options) { - - // use custom content-type above all - var contentType = options.contentType; - - // or try `name` from formidable, browser - if (!contentType && value.name) { - contentType = mime.lookup(value.name); - } - - // or try `path` from fs-, request- streams - if (!contentType && value.path) { - contentType = mime.lookup(value.path); - } - - // or if it's http-reponse - if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { - contentType = value.headers['content-type']; - } - - // or guess it from the filepath or filename - if (!contentType && (options.filepath || options.filename)) { - contentType = mime.lookup(options.filepath || options.filename); - } - - // fallback to the default content type if `value` is not simple value - if (!contentType && typeof value == 'object') { - contentType = FormData.DEFAULT_CONTENT_TYPE; - } - - return contentType; -}; - -FormData.prototype._multiPartFooter = function() { - return function(next) { - var footer = FormData.LINE_BREAK; - - var lastPart = (this._streams.length === 0); - if (lastPart) { - footer += this._lastBoundary(); - } - - next(footer); - }.bind(this); -}; - -FormData.prototype._lastBoundary = function() { - return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; -}; - -FormData.prototype.getHeaders = function(userHeaders) { - var header; - var formHeaders = { - 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() - }; - - for (header in userHeaders) { - if (userHeaders.hasOwnProperty(header)) { - formHeaders[header.toLowerCase()] = userHeaders[header]; - } - } - - return formHeaders; -}; - -FormData.prototype.getBoundary = function() { - if (!this._boundary) { - this._generateBoundary(); - } - - return this._boundary; -}; - -FormData.prototype.getBuffer = function() { - var dataBuffer = new Buffer.alloc( 0 ); - var boundary = this.getBoundary(); - - // Create the form content. Add Line breaks to the end of data. - for (var i = 0, len = this._streams.length; i < len; i++) { - if (typeof this._streams[i] !== 'function') { - - // Add content to the buffer. - if(Buffer.isBuffer(this._streams[i])) { - dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]); - }else { - dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]); - } - - // Add break after content. - if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) { - dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] ); - } - } - } - - // Add the footer and return the Buffer object. - return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] ); -}; - -FormData.prototype._generateBoundary = function() { - // This generates a 50 character boundary similar to those used by Firefox. - // They are optimized for boyer-moore parsing. - var boundary = '--------------------------'; - for (var i = 0; i < 24; i++) { - boundary += Math.floor(Math.random() * 10).toString(16); - } - - this._boundary = boundary; -}; - -// Note: getLengthSync DOESN'T calculate streams length -// As workaround one can calculate file size manually -// and add it as knownLength option -FormData.prototype.getLengthSync = function() { - var knownLength = this._overheadLength + this._valueLength; - - // Don't get confused, there are 3 "internal" streams for each keyval pair - // so it basically checks if there is any value added to the form - if (this._streams.length) { - knownLength += this._lastBoundary().length; - } - - // https://github.com/form-data/form-data/issues/40 - if (!this.hasKnownLength()) { - // Some async length retrievers are present - // therefore synchronous length calculation is false. - // Please use getLength(callback) to get proper length - this._error(new Error('Cannot calculate proper length in synchronous way.')); - } - - return knownLength; -}; - -// Public API to check if length of added values is known -// https://github.com/form-data/form-data/issues/196 -// https://github.com/form-data/form-data/issues/262 -FormData.prototype.hasKnownLength = function() { - var hasKnownLength = true; - - if (this._valuesToMeasure.length) { - hasKnownLength = false; - } - - return hasKnownLength; -}; - -FormData.prototype.getLength = function(cb) { - var knownLength = this._overheadLength + this._valueLength; - - if (this._streams.length) { - knownLength += this._lastBoundary().length; - } - - if (!this._valuesToMeasure.length) { - process.nextTick(cb.bind(this, null, knownLength)); - return; - } - - asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { - if (err) { - cb(err); - return; - } - - values.forEach(function(length) { - knownLength += length; - }); - - cb(null, knownLength); - }); -}; - -FormData.prototype.submit = function(params, cb) { - var request - , options - , defaults = {method: 'post'} - ; - - // parse provided url if it's string - // or treat it as options object - if (typeof params == 'string') { - - params = parseUrl(params); - options = populate({ - port: params.port, - path: params.pathname, - host: params.hostname, - protocol: params.protocol - }, defaults); - - // use custom params - } else { - - options = populate(params, defaults); - // if no port provided use default one - if (!options.port) { - options.port = options.protocol == 'https:' ? 443 : 80; - } - } - - // put that good code in getHeaders to some use - options.headers = this.getHeaders(params.headers); - - // https if specified, fallback to http in any other case - if (options.protocol == 'https:') { - request = https.request(options); - } else { - request = http.request(options); - } - - // get content length and fire away - this.getLength(function(err, length) { - if (err) { - this._error(err); - return; - } - - // add content length - request.setHeader('Content-Length', length); - - this.pipe(request); - if (cb) { - var onResponse; - - var callback = function (error, responce) { - request.removeListener('error', callback); - request.removeListener('response', onResponse); - - return cb.call(this, error, responce); - }; - - onResponse = callback.bind(this, null); - - request.on('error', callback); - request.on('response', onResponse); - } - }.bind(this)); - - return request; -}; - -FormData.prototype._error = function(err) { - if (!this.error) { - this.error = err; - this.pause(); - this.emit('error', err); - } -}; - -FormData.prototype.toString = function () { - return '[object FormData]'; -}; diff --git a/node_modules/form-data/lib/populate.js b/node_modules/form-data/lib/populate.js deleted file mode 100644 index 4d35738d..00000000 --- a/node_modules/form-data/lib/populate.js +++ /dev/null @@ -1,10 +0,0 @@ -// populates missing values -module.exports = function(dst, src) { - - Object.keys(src).forEach(function(prop) - { - dst[prop] = dst[prop] || src[prop]; - }); - - return dst; -}; diff --git a/node_modules/form-data/package.json b/node_modules/form-data/package.json deleted file mode 100644 index 5c09d5c5..00000000 --- a/node_modules/form-data/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_from": "form-data@^3.0.0", - "_id": "form-data@3.0.0", - "_inBundle": false, - "_integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", - "_location": "/form-data", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "form-data@^3.0.0", - "name": "form-data", - "escapedName": "form-data", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/graphql-request" - ], - "_resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "_shasum": "31b7e39c85f1355b7139ee0c647cf0de7f83c682", - "_spec": "form-data@^3.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/graphql-request", - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "browser": "./lib/browser", - "bugs": { - "url": "https://github.com/form-data/form-data/issues" - }, - "bundleDependencies": false, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "deprecated": false, - "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.", - "devDependencies": { - "@types/node": "^12.0.10", - "browserify": "^13.1.1", - "browserify-istanbul": "^2.0.0", - "coveralls": "^3.0.4", - "cross-spawn": "^6.0.5", - "eslint": "^6.0.1", - "fake": "^0.2.2", - "far": "^0.0.7", - "formidable": "^1.0.17", - "in-publish": "^2.0.0", - "is-node-modern": "^1.0.0", - "istanbul": "^0.4.5", - "obake": "^0.1.2", - "pkgfiles": "^2.3.0", - "pre-commit": "^1.1.3", - "puppeteer": "^1.19.0", - "request": "^2.88.0", - "rimraf": "^2.7.1", - "tape": "^4.6.2", - "typescript": "^3.5.2" - }, - "engines": { - "node": ">= 6" - }, - "homepage": "https://github.com/form-data/form-data#readme", - "license": "MIT", - "main": "./lib/form_data", - "name": "form-data", - "pre-commit": [ - "lint", - "ci-test", - "check" - ], - "repository": { - "type": "git", - "url": "git://github.com/form-data/form-data.git" - }, - "scripts": { - "browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage", - "check": "istanbul check-coverage coverage/coverage*.json", - "ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8", - "ci-test": "npm run test && npm run browser && npm run report", - "debug": "verbose=1 ./test/run.js", - "files": "pkgfiles --sort=name", - "get-version": "node -e \"console.log(require('./package.json').version)\"", - "lint": "eslint lib/*.js test/*.js test/integration/*.js", - "postpublish": "npm run restore-readme", - "posttest": "istanbul report lcov text", - "predebug": "rimraf coverage test/tmp", - "prepublish": "in-publish && npm run update-readme || not-in-publish", - "pretest": "rimraf coverage test/tmp", - "report": "istanbul report lcov text", - "restore-readme": "mv README.md.bak README.md", - "test": "istanbul cover test/run.js", - "update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md" - }, - "typings": "./index.d.ts", - "version": "3.0.0" -} diff --git a/node_modules/gaxios/CHANGELOG.md b/node_modules/gaxios/CHANGELOG.md deleted file mode 100644 index a0729409..00000000 --- a/node_modules/gaxios/CHANGELOG.md +++ /dev/null @@ -1,142 +0,0 @@ -# Changelog - -## [3.2.0](https://www.github.com/googleapis/gaxios/compare/v3.1.0...v3.2.0) (2020-09-14) - - -### Features - -* add initial retry delay, and set default to 100ms ([#336](https://www.github.com/googleapis/gaxios/issues/336)) ([870326b](https://www.github.com/googleapis/gaxios/commit/870326b8245f16fafde0b0c32cfd2f277946e3a1)) - -## [3.1.0](https://www.github.com/googleapis/gaxios/compare/v3.0.4...v3.1.0) (2020-07-30) - - -### Features - -* pass default adapter to adapter option ([#319](https://www.github.com/googleapis/gaxios/issues/319)) ([cf06bd9](https://www.github.com/googleapis/gaxios/commit/cf06bd9f51cbe707ed5973e390d31a091d4537c1)) - -### [3.0.4](https://www.github.com/googleapis/gaxios/compare/v3.0.3...v3.0.4) (2020-07-09) - - -### Bug Fixes - -* typeo in nodejs .gitattribute ([#306](https://www.github.com/googleapis/gaxios/issues/306)) ([8514672](https://www.github.com/googleapis/gaxios/commit/8514672f9d56bc6f077dcbab050b3342d4e343c6)) - -### [3.0.3](https://www.github.com/googleapis/gaxios/compare/v3.0.2...v3.0.3) (2020-04-20) - - -### Bug Fixes - -* apache license URL ([#468](https://www.github.com/googleapis/gaxios/issues/468)) ([#272](https://www.github.com/googleapis/gaxios/issues/272)) ([cf1b7cb](https://www.github.com/googleapis/gaxios/commit/cf1b7cb66e4c98405236834e63349931b4f35b90)) - -### [3.0.2](https://www.github.com/googleapis/gaxios/compare/v3.0.1...v3.0.2) (2020-03-24) - - -### Bug Fixes - -* continue replacing application/x-www-form-urlencoded with application/json ([#263](https://www.github.com/googleapis/gaxios/issues/263)) ([dca176d](https://www.github.com/googleapis/gaxios/commit/dca176df0990f2c22255f9764405c496ea07ada2)) - -### [3.0.1](https://www.github.com/googleapis/gaxios/compare/v3.0.0...v3.0.1) (2020-03-23) - - -### Bug Fixes - -* allow an alternate JSON content-type to be set ([#257](https://www.github.com/googleapis/gaxios/issues/257)) ([698a29f](https://www.github.com/googleapis/gaxios/commit/698a29ff3b22f30ea99ad190c4592940bef88f1f)) - -## [3.0.0](https://www.github.com/googleapis/gaxios/compare/v2.3.2...v3.0.0) (2020-03-19) - - -### ⚠ BREAKING CHANGES - -* **deps:** TypeScript introduced breaking changes in generated code in 3.7.x -* drop Node 8 from engines field (#254) - -### Features - -* drop Node 8 from engines field ([#254](https://www.github.com/googleapis/gaxios/issues/254)) ([8c9fff7](https://www.github.com/googleapis/gaxios/commit/8c9fff7f92f70f029292c906c62d194c1d58827d)) -* **deps:** updates to latest TypeScript ([#253](https://www.github.com/googleapis/gaxios/issues/253)) ([054267b](https://www.github.com/googleapis/gaxios/commit/054267bf12e1801c134e3b5cae92dcc5ea041fab)) - -### [2.3.2](https://www.github.com/googleapis/gaxios/compare/v2.3.1...v2.3.2) (2020-02-28) - - -### Bug Fixes - -* update github repo in package ([#239](https://www.github.com/googleapis/gaxios/issues/239)) ([7e750cb](https://www.github.com/googleapis/gaxios/commit/7e750cbaaa59812817d725c74fb9d364c4b71096)) - -### [2.3.1](https://www.github.com/googleapis/gaxios/compare/v2.3.0...v2.3.1) (2020-02-13) - - -### Bug Fixes - -* **deps:** update dependency https-proxy-agent to v5 ([#233](https://www.github.com/googleapis/gaxios/issues/233)) ([56de0a8](https://www.github.com/googleapis/gaxios/commit/56de0a824a2f9622e3e4d4bdd41adccd812a30b4)) - -## [2.3.0](https://www.github.com/googleapis/gaxios/compare/v2.2.2...v2.3.0) (2020-01-31) - - -### Features - -* add promise support for onRetryAttempt and shouldRetry ([#223](https://www.github.com/googleapis/gaxios/issues/223)) ([061afa3](https://www.github.com/googleapis/gaxios/commit/061afa381a51d39823e63accf3dacd16e191f3b9)) - -### [2.2.2](https://www.github.com/googleapis/gaxios/compare/v2.2.1...v2.2.2) (2020-01-08) - - -### Bug Fixes - -* **build:** add publication configuration ([#218](https://www.github.com/googleapis/gaxios/issues/218)) ([43e581f](https://www.github.com/googleapis/gaxios/commit/43e581ff4ed5e79d72f6f29748a5eebb6bff1229)) - -### [2.2.1](https://www.github.com/googleapis/gaxios/compare/v2.2.0...v2.2.1) (2020-01-04) - - -### Bug Fixes - -* **deps:** update dependency https-proxy-agent to v4 ([#201](https://www.github.com/googleapis/gaxios/issues/201)) ([5cdeef2](https://www.github.com/googleapis/gaxios/commit/5cdeef288a0c5c544c0dc2659aafbb2215d06c4b)) -* remove retryDelay option ([#203](https://www.github.com/googleapis/gaxios/issues/203)) ([d21e08d](https://www.github.com/googleapis/gaxios/commit/d21e08d2aada980d39bc5ca7093d54452be2d646)) - -## [2.2.0](https://www.github.com/googleapis/gaxios/compare/v2.1.1...v2.2.0) (2019-12-05) - - -### Features - -* populate GaxiosResponse with raw response information (res.url) ([#189](https://www.github.com/googleapis/gaxios/issues/189)) ([53a7f54](https://www.github.com/googleapis/gaxios/commit/53a7f54cc0f20320d7a6a21a9a9f36050cec2eec)) - - -### Bug Fixes - -* don't retry a request that is aborted intentionally ([#190](https://www.github.com/googleapis/gaxios/issues/190)) ([ba9777b](https://www.github.com/googleapis/gaxios/commit/ba9777b15b5262f8288a8bb3cca49a1de8427d8e)) -* **deps:** pin TypeScript below 3.7.0 ([5373f07](https://www.github.com/googleapis/gaxios/commit/5373f0793a765965a8221ecad2f99257ed1b7444)) - -### [2.1.1](https://www.github.com/googleapis/gaxios/compare/v2.1.0...v2.1.1) (2019-11-15) - - -### Bug Fixes - -* **docs:** snippets are now replaced in jsdoc comments ([#183](https://www.github.com/googleapis/gaxios/issues/183)) ([8dd1324](https://www.github.com/googleapis/gaxios/commit/8dd1324256590bd2f2e9015c813950e1cd8cb330)) - -## [2.1.0](https://www.github.com/googleapis/gaxios/compare/v2.0.3...v2.1.0) (2019-10-09) - - -### Bug Fixes - -* **deps:** update dependency https-proxy-agent to v3 ([#172](https://www.github.com/googleapis/gaxios/issues/172)) ([4a38f35](https://www.github.com/googleapis/gaxios/commit/4a38f35)) - - -### Features - -* **TypeScript:** agent can now be passed as builder method, rather than agent instance ([c84ddd6](https://www.github.com/googleapis/gaxios/commit/c84ddd6)) - -### [2.0.3](https://www.github.com/googleapis/gaxios/compare/v2.0.2...v2.0.3) (2019-09-11) - - -### Bug Fixes - -* do not override content-type if its given ([#158](https://www.github.com/googleapis/gaxios/issues/158)) ([f49e0e6](https://www.github.com/googleapis/gaxios/commit/f49e0e6)) -* improve stream detection logic ([6c41537](https://www.github.com/googleapis/gaxios/commit/6c41537)) -* revert header change ([#161](https://www.github.com/googleapis/gaxios/issues/161)) ([b0f6a8b](https://www.github.com/googleapis/gaxios/commit/b0f6a8b)) - -### [2.0.2](https://www.github.com/googleapis/gaxios/compare/v2.0.1...v2.0.2) (2019-07-23) - - -### Bug Fixes - -* check for existence of fetch before using it ([#138](https://www.github.com/googleapis/gaxios/issues/138)) ([79eb58d](https://www.github.com/googleapis/gaxios/commit/79eb58d)) -* **docs:** make anchors work in jsdoc ([#139](https://www.github.com/googleapis/gaxios/issues/139)) ([85103bb](https://www.github.com/googleapis/gaxios/commit/85103bb)) -* prevent double option processing ([#142](https://www.github.com/googleapis/gaxios/issues/142)) ([19b4b3c](https://www.github.com/googleapis/gaxios/commit/19b4b3c)) diff --git a/node_modules/gaxios/LICENSE b/node_modules/gaxios/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/node_modules/gaxios/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/gaxios/README.md b/node_modules/gaxios/README.md deleted file mode 100644 index b43e620e..00000000 --- a/node_modules/gaxios/README.md +++ /dev/null @@ -1,144 +0,0 @@ -# gaxios - -[![npm version](https://img.shields.io/npm/v/gaxios.svg)](https://www.npmjs.org/package/gaxios) -[![codecov](https://codecov.io/gh/googleapis/gaxios/branch/master/graph/badge.svg)](https://codecov.io/gh/googleapis/gaxios) -[![Code Style: Google](https://img.shields.io/badge/code%20style-google-blueviolet.svg)](https://github.com/google/gts) - -> An HTTP request client that provides an `axios` like interface over top of `node-fetch`. - -## Install -```sh -$ npm install gaxios -``` - -## Example - -```js -const {request} = require('gaxios'); -const res = await request({ - url: 'https://www.googleapis.com/discovery/v1/apis/' -}); -``` - -## Setting Defaults -Gaxios supports setting default properties both on the default instance, and on additional instances. This is often useful when making many requests to the same domain with the same base settings. For example: - -```js -const gaxios = require('gaxios'); -gaxios.instance.defaults = { - baseURL: 'https://example.com' - headers: { - Authorization: 'SOME_TOKEN' - } -} -gaxios.request({url: '/data'}).then(...); -``` - -## Request Options - -```js -{ - // The url to which the request should be sent. Required. - url: string, - - // The HTTP method to use for the request. Defaults to `GET`. - method: 'GET', - - // The base Url to use for the request. Prepended to the `url` property above. - baseURL: 'https://example.com'; - - // The HTTP methods to be sent with the request. - headers: { 'some': 'header' }, - - // The data to send in the body of the request. Data objects will be serialized as JSON. - data: { - some: 'data' - }, - - // The max size of the http response content in bytes allowed. - // Defaults to `0`, which is the same as unset. - maxContentLength: 2000, - - // The max number of HTTP redirects to follow. - // Defaults to 100. - maxRedirects: 100, - - // The querystring parameters that will be encoded using `qs` and - // appended to the url - params: { - querystring: 'parameters' - }, - - // By default, we use the `querystring` package in node core to serialize - // querystring parameters. You can override that and provide your - // own implementation. - paramsSerializer: (params) => { - return qs.stringify(params); - }, - - // The timeout for the HTTP request. Defaults to 0. - timeout: 1000, - - // Optional method to override making the actual HTTP request. Useful - // for writing tests and instrumentation - adapter?: async (options, defaultAdapter) => { - const res = await defaultAdapter(options); - res.data = { - ...res.data, - extraProperty: 'your extra property', - }; - return res; - }; - - // The expected return type of the request. Options are: - // json | stream | blob | arraybuffer | text - // Defaults to `json`. - responseType: 'json', - - // The node.js http agent to use for the request. - agent: someHttpsAgent, - - // Custom function to determine if the response is valid based on the - // status code. Defaults to (>= 200 && < 300) - validateStatus: (status: number) => true, - - // Configuration for retrying of requests. - retryConfig: { - // The number of times to retry the request. Defaults to 3. - retry?: number; - - // The number of retries already attempted. - currentRetryAttempt?: number; - - // The HTTP Methods that will be automatically retried. - // Defaults to ['GET','PUT','HEAD','OPTIONS','DELETE'] - httpMethodsToRetry?: string[]; - - // The HTTP response status codes that will automatically be retried. - // Defaults to: [[100, 199], [429, 429], [500, 599]] - statusCodesToRetry?: number[][]; - - // Function to invoke when a retry attempt is made. - onRetryAttempt?: (err: GaxiosError) => Promise | void; - - // Function to invoke which determines if you should retry - shouldRetry?: (err: GaxiosError) => Promise | boolean; - - // When there is no response, the number of retries to attempt. Defaults to 2. - noResponseRetries?: number; - - // The amount of time to initially delay the retry, in ms. Defaults to 100ms. - retryDelay?: number; - }, - - // Enables default configuration for retries. - retry: boolean, - - // Cancelling a request requires the `abort-controller` library. - // See https://github.com/bitinn/node-fetch#request-cancellation-with-abortsignal - signal?: AbortSignal -} -``` - -## License -[Apache-2.0](https://github.com/googleapis/gaxios/blob/master/LICENSE) diff --git a/node_modules/gaxios/build/src/common.d.ts b/node_modules/gaxios/build/src/common.d.ts deleted file mode 100644 index 74a6e704..00000000 --- a/node_modules/gaxios/build/src/common.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/// -import { AbortSignal } from 'abort-controller'; -import { Agent } from 'http'; -import { URL } from 'url'; -export declare class GaxiosError extends Error { - code?: string; - response?: GaxiosResponse; - config: GaxiosOptions; - constructor(message: string, options: GaxiosOptions, response: GaxiosResponse); -} -export interface Headers { - [index: string]: any; -} -export declare type GaxiosPromise = Promise>; -export interface GaxiosXMLHttpRequest { - responseURL: string; -} -export interface GaxiosResponse { - config: GaxiosOptions; - data: T; - status: number; - statusText: string; - headers: Headers; - request: GaxiosXMLHttpRequest; -} -/** - * Request options that are used to form the request. - */ -export interface GaxiosOptions { - /** - * Optional method to override making the actual HTTP request. Useful - * for writing tests. - */ - adapter?: (options: GaxiosOptions, defaultAdapter: (options: GaxiosOptions) => GaxiosPromise) => GaxiosPromise; - url?: string; - baseUrl?: string; - baseURL?: string; - method?: 'GET' | 'HEAD' | 'POST' | 'DELETE' | 'PUT' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; - headers?: Headers; - data?: any; - body?: any; - /** - * The maximum size of the http response content in bytes allowed. - */ - maxContentLength?: number; - /** - * The maximum number of redirects to follow. Defaults to 20. - */ - maxRedirects?: number; - follow?: number; - params?: any; - paramsSerializer?: (params: { - [index: string]: string | number; - }) => string; - timeout?: number; - onUploadProgress?: (progressEvent: any) => void; - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'stream'; - agent?: Agent | ((parsedUrl: URL) => Agent); - validateStatus?: (status: number) => boolean; - retryConfig?: RetryConfig; - retry?: boolean; - signal?: AbortSignal; - size?: number; -} -/** - * Configuration for the Gaxios `request` method. - */ -export interface RetryConfig { - /** - * The number of times to retry the request. Defaults to 3. - */ - retry?: number; - /** - * The number of retries already attempted. - */ - currentRetryAttempt?: number; - /** - * The amount of time to initially delay the retry, in ms. Defaults to 100ms. - */ - retryDelay?: number; - /** - * The HTTP Methods that will be automatically retried. - * Defaults to ['GET','PUT','HEAD','OPTIONS','DELETE'] - */ - httpMethodsToRetry?: string[]; - /** - * The HTTP response status codes that will automatically be retried. - * Defaults to: [[100, 199], [429, 429], [500, 599]] - */ - statusCodesToRetry?: number[][]; - /** - * Function to invoke when a retry attempt is made. - */ - onRetryAttempt?: (err: GaxiosError) => Promise | void; - /** - * Function to invoke which determines if you should retry - */ - shouldRetry?: (err: GaxiosError) => Promise | boolean; - /** - * When there is no response, the number of retries to attempt. Defaults to 2. - */ - noResponseRetries?: number; -} diff --git a/node_modules/gaxios/build/src/common.js b/node_modules/gaxios/build/src/common.js deleted file mode 100644 index 38bc9202..00000000 --- a/node_modules/gaxios/build/src/common.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -// Copyright 2018 Google LLC -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GaxiosError = void 0; -/* eslint-disable @typescript-eslint/no-explicit-any */ -class GaxiosError extends Error { - constructor(message, options, response) { - super(message); - this.response = response; - this.config = options; - this.code = response.status.toString(); - } -} -exports.GaxiosError = GaxiosError; -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/node_modules/gaxios/build/src/common.js.map b/node_modules/gaxios/build/src/common.js.map deleted file mode 100644 index 05acedf5..00000000 --- a/node_modules/gaxios/build/src/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAMjC,uDAAuD;AAEvD,MAAa,WAAqB,SAAQ,KAAK;IAI7C,YACE,OAAe,EACf,OAAsB,EACtB,QAA2B;QAE3B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IACzC,CAAC;CACF;AAdD,kCAcC"} \ No newline at end of file diff --git a/node_modules/gaxios/build/src/gaxios.d.ts b/node_modules/gaxios/build/src/gaxios.d.ts deleted file mode 100644 index b3208882..00000000 --- a/node_modules/gaxios/build/src/gaxios.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { GaxiosOptions, GaxiosPromise } from './common'; -export declare class Gaxios { - private agentCache; - /** - * Default HTTP options that will be used for every HTTP request. - */ - defaults: GaxiosOptions; - /** - * The Gaxios class is responsible for making HTTP requests. - * @param defaults The default set of options to be used for this instance. - */ - constructor(defaults?: GaxiosOptions); - /** - * Perform an HTTP request with the given options. - * @param opts Set of HTTP options that will be used for this HTTP request. - */ - request(opts?: GaxiosOptions): GaxiosPromise; - private _defaultAdapter; - /** - * Internal, retryable version of the `request` method. - * @param opts Set of HTTP options that will be used for this HTTP request. - */ - private _request; - private getResponseData; - /** - * Validates the options, and merges them with defaults. - * @param opts The original options passed from the client. - */ - private validateOpts; - /** - * By default, throw for any non-2xx status code - * @param status status code from the HTTP response - */ - private validateStatus; - /** - * Encode a set of key/value pars into a querystring format (?foo=bar&baz=boo) - * @param params key value pars to encode - */ - private paramsSerializer; - private translateResponse; -} diff --git a/node_modules/gaxios/build/src/gaxios.js b/node_modules/gaxios/build/src/gaxios.js deleted file mode 100644 index 3f473ef1..00000000 --- a/node_modules/gaxios/build/src/gaxios.js +++ /dev/null @@ -1,231 +0,0 @@ -"use strict"; -// Copyright 2018 Google LLC -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Gaxios = void 0; -const extend_1 = __importDefault(require("extend")); -const node_fetch_1 = __importDefault(require("node-fetch")); -const querystring_1 = __importDefault(require("querystring")); -const is_stream_1 = __importDefault(require("is-stream")); -const url_1 = __importDefault(require("url")); -const common_1 = require("./common"); -const retry_1 = require("./retry"); -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable node/no-unsupported-features/node-builtins */ -const URL = hasURL() ? window.URL : url_1.default.URL; -const fetch = hasFetch() ? window.fetch : node_fetch_1.default; -function hasWindow() { - return typeof window !== 'undefined' && !!window; -} -function hasURL() { - return hasWindow() && !!window.URL; -} -function hasFetch() { - return hasWindow() && !!window.fetch; -} -let HttpsProxyAgent; -// Figure out if we should be using a proxy. Only if it's required, load -// the https-proxy-agent module as it adds startup cost. -function loadProxy() { - const proxy = process.env.HTTPS_PROXY || - process.env.https_proxy || - process.env.HTTP_PROXY || - process.env.http_proxy; - if (proxy) { - HttpsProxyAgent = require('https-proxy-agent'); - } - return proxy; -} -loadProxy(); -class Gaxios { - /** - * The Gaxios class is responsible for making HTTP requests. - * @param defaults The default set of options to be used for this instance. - */ - constructor(defaults) { - this.agentCache = new Map(); - this.defaults = defaults || {}; - } - /** - * Perform an HTTP request with the given options. - * @param opts Set of HTTP options that will be used for this HTTP request. - */ - async request(opts = {}) { - opts = this.validateOpts(opts); - return this._request(opts); - } - async _defaultAdapter(opts) { - const res = await fetch(opts.url, opts); - const data = await this.getResponseData(opts, res); - return this.translateResponse(opts, res, data); - } - /** - * Internal, retryable version of the `request` method. - * @param opts Set of HTTP options that will be used for this HTTP request. - */ - async _request(opts = {}) { - try { - let translatedResponse; - if (opts.adapter) { - translatedResponse = await opts.adapter(opts, this._defaultAdapter.bind(this)); - } - else { - translatedResponse = await this._defaultAdapter(opts); - } - if (!opts.validateStatus(translatedResponse.status)) { - throw new common_1.GaxiosError(`Request failed with status code ${translatedResponse.status}`, opts, translatedResponse); - } - return translatedResponse; - } - catch (e) { - const err = e; - err.config = opts; - const { shouldRetry, config } = await retry_1.getRetryConfig(e); - if (shouldRetry && config) { - err.config.retryConfig.currentRetryAttempt = config.retryConfig.currentRetryAttempt; - return this._request(err.config); - } - throw err; - } - } - async getResponseData(opts, res) { - switch (opts.responseType) { - case 'stream': - return res.body; - case 'json': { - let data = await res.text(); - try { - data = JSON.parse(data); - } - catch (_a) { - // continue - } - return data; - } - case 'arraybuffer': - return res.arrayBuffer(); - case 'blob': - return res.blob(); - default: - return res.text(); - } - } - /** - * Validates the options, and merges them with defaults. - * @param opts The original options passed from the client. - */ - validateOpts(options) { - const opts = extend_1.default(true, {}, this.defaults, options); - if (!opts.url) { - throw new Error('URL is required.'); - } - // baseUrl has been deprecated, remove in 2.0 - const baseUrl = opts.baseUrl || opts.baseURL; - if (baseUrl) { - opts.url = baseUrl + opts.url; - } - const parsedUrl = new URL(opts.url); - opts.url = `${parsedUrl.origin}${parsedUrl.pathname}`; - opts.params = extend_1.default(querystring_1.default.parse(parsedUrl.search.substr(1)), // removes leading ? - opts.params); - opts.paramsSerializer = opts.paramsSerializer || this.paramsSerializer; - if (opts.params) { - parsedUrl.search = opts.paramsSerializer(opts.params); - } - opts.url = parsedUrl.href; - if (typeof options.maxContentLength === 'number') { - opts.size = options.maxContentLength; - } - if (typeof options.maxRedirects === 'number') { - opts.follow = options.maxRedirects; - } - opts.headers = opts.headers || {}; - if (opts.data) { - if (is_stream_1.default.readable(opts.data)) { - opts.body = opts.data; - } - else if (typeof opts.data === 'object') { - opts.body = JSON.stringify(opts.data); - // Allow the user to specifiy their own content type, - // such as application/json-patch+json; for historical reasons this - // content type must currently be a json type, as we are relying on - // application/x-www-form-urlencoded (which is incompatible with - // upstream GCP APIs) being rewritten to application/json. - // - // TODO: refactor upstream dependencies to stop relying on this - // side-effect. - if (!opts.headers['Content-Type'] || - !opts.headers['Content-Type'].includes('json')) { - opts.headers['Content-Type'] = 'application/json'; - } - } - else { - opts.body = opts.data; - } - } - opts.validateStatus = opts.validateStatus || this.validateStatus; - opts.responseType = opts.responseType || 'json'; - if (!opts.headers['Accept'] && opts.responseType === 'json') { - opts.headers['Accept'] = 'application/json'; - } - opts.method = opts.method || 'GET'; - const proxy = loadProxy(); - if (proxy) { - if (this.agentCache.has(proxy)) { - opts.agent = this.agentCache.get(proxy); - } - else { - opts.agent = new HttpsProxyAgent(proxy); - this.agentCache.set(proxy, opts.agent); - } - } - return opts; - } - /** - * By default, throw for any non-2xx status code - * @param status status code from the HTTP response - */ - validateStatus(status) { - return status >= 200 && status < 300; - } - /** - * Encode a set of key/value pars into a querystring format (?foo=bar&baz=boo) - * @param params key value pars to encode - */ - paramsSerializer(params) { - return querystring_1.default.stringify(params); - } - translateResponse(opts, res, data) { - // headers need to be converted from a map to an obj - const headers = {}; - res.headers.forEach((value, key) => { - headers[key] = value; - }); - return { - config: opts, - data: data, - headers, - status: res.status, - statusText: res.statusText, - // XMLHttpRequestLike - request: { - responseURL: res.url, - }, - }; - } -} -exports.Gaxios = Gaxios; -//# sourceMappingURL=gaxios.js.map \ No newline at end of file diff --git a/node_modules/gaxios/build/src/gaxios.js.map b/node_modules/gaxios/build/src/gaxios.js.map deleted file mode 100644 index ff00749c..00000000 --- a/node_modules/gaxios/build/src/gaxios.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gaxios.js","sourceRoot":"","sources":["../../src/gaxios.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;AAEjC,oDAA4B;AAE5B,4DAAoE;AACpE,8DAA6B;AAC7B,0DAAiC;AACjC,8CAAsB;AAEtB,qCAMkB;AAClB,mCAAuC;AAEvC,uDAAuD;AACvD,+DAA+D;AAE/D,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,aAAG,CAAC,GAAG,CAAC;AAC5C,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAS,CAAC;AAEpD,SAAS,SAAS;IAChB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC;AAED,SAAS,MAAM;IACb,OAAO,SAAS,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AACrC,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,SAA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AW,EAAE,GAAG,CAAC,GAAG;aACrB;SACF,CAAC;IACJ,CAAC;CACF;AA3ND,wBA2NC"} \ No newline at end of file diff --git a/node_modules/gaxios/build/src/index.d.ts b/node_modules/gaxios/build/src/index.d.ts deleted file mode 100644 index 033aff5e..00000000 --- a/node_modules/gaxios/build/src/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { GaxiosOptions } from './common'; -import { Gaxios } from './gaxios'; -export { GaxiosError, GaxiosPromise, GaxiosResponse, Headers, RetryConfig, } from './common'; -export { Gaxios, GaxiosOptions }; -/** - * The default instance used when the `request` method is directly - * invoked. - */ -export declare const instance: Gaxios; -/** - * Make an HTTP request using the given options. - * @param opts Options for the request - */ -export declare function request(opts: GaxiosOptions): Promise>; diff --git a/node_modules/gaxios/build/src/index.js b/node_modules/gaxios/build/src/index.js deleted file mode 100644 index 37714fa1..00000000 --- a/node_modules/gaxios/build/src/index.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// Copyright 2018 Google LLC -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.request = exports.instance = exports.Gaxios = void 0; -const gaxios_1 = require("./gaxios"); -Object.defineProperty(exports, "Gaxios", { enumerable: true, get: function () { return gaxios_1.Gaxios; } }); -var common_1 = require("./common"); -Object.defineProperty(exports, "GaxiosError", { enumerable: true, get: function () { return common_1.GaxiosError; } }); -/** - * The default instance used when the `request` method is directly - * invoked. - */ -exports.instance = new gaxios_1.Gaxios(); -/** - * Make an HTTP request using the given options. - * @param opts Options for the request - */ -async function request(opts) { - return exports.instance.request(opts); -} -exports.request = request; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/gaxios/build/src/index.js.map b/node_modules/gaxios/build/src/index.js.map deleted file mode 100644 index 609c0bc1..00000000 --- a/node_modules/gaxios/build/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAGjC,qCAAgC;AASxB,uFATA,eAAM,OASA;AAPd,mCAMkB;AALhB,qGAAA,WAAW,OAAA;AAQb;;;GAGG;AACU,QAAA,QAAQ,GAAG,IAAI,eAAM,EAAE,CAAC;AAErC;;;GAGG;AACI,KAAK,UAAU,OAAO,CAAI,IAAmB;IAClD,OAAO,gBAAQ,CAAC,OAAO,CAAI,IAAI,CAAC,CAAC;AACnC,CAAC;AAFD,0BAEC"} \ No newline at end of file diff --git a/node_modules/gaxios/build/src/retry.d.ts b/node_modules/gaxios/build/src/retry.d.ts deleted file mode 100644 index cfc5ee28..00000000 --- a/node_modules/gaxios/build/src/retry.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { GaxiosError } from './common'; -export declare function getRetryConfig(err: GaxiosError): Promise<{ - shouldRetry: boolean; - config?: undefined; -} | { - shouldRetry: boolean; - config: import("./common").GaxiosOptions; -}>; diff --git a/node_modules/gaxios/build/src/retry.js b/node_modules/gaxios/build/src/retry.js deleted file mode 100644 index 9cf94e9e..00000000 --- a/node_modules/gaxios/build/src/retry.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -// Copyright 2018 Google LLC -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getRetryConfig = void 0; -async function getRetryConfig(err) { - var _a; - let config = getConfig(err); - if (!err || !err.config || (!config && !err.config.retry)) { - return { shouldRetry: false }; - } - config = config || {}; - config.currentRetryAttempt = config.currentRetryAttempt || 0; - config.retry = - config.retry === undefined || config.retry === null ? 3 : config.retry; - config.httpMethodsToRetry = config.httpMethodsToRetry || [ - 'GET', - 'HEAD', - 'PUT', - 'OPTIONS', - 'DELETE', - ]; - config.noResponseRetries = - config.noResponseRetries === undefined || config.noResponseRetries === null - ? 2 - : config.noResponseRetries; - // If this wasn't in the list of status codes where we want - // to automatically retry, return. - const retryRanges = [ - // https://en.wikipedia.org/wiki/List_of_HTTP_status_codes - // 1xx - Retry (Informational, request still processing) - // 2xx - Do not retry (Success) - // 3xx - Do not retry (Redirect) - // 4xx - Do not retry (Client errors) - // 429 - Retry ("Too Many Requests") - // 5xx - Retry (Server errors) - [100, 199], - [429, 429], - [500, 599], - ]; - config.statusCodesToRetry = config.statusCodesToRetry || retryRanges; - // Put the config back into the err - err.config.retryConfig = config; - // Determine if we should retry the request - const shouldRetryFn = config.shouldRetry || shouldRetryRequest; - if (!(await shouldRetryFn(err))) { - return { shouldRetry: false, config: err.config }; - } - // Calculate time to wait with exponential backoff. - // If this is the first retry, look for a configured retryDelay. - const retryDelay = config.currentRetryAttempt ? 0 : (_a = config.retryDelay) !== null && _a !== void 0 ? _a : 100; - // Formula: retryDelay + ((2^c - 1 / 2) * 1000) - const delay = retryDelay + ((Math.pow(2, config.currentRetryAttempt) - 1) / 2) * 1000; - // We're going to retry! Incremenent the counter. - err.config.retryConfig.currentRetryAttempt += 1; - // Create a promise that invokes the retry after the backOffDelay - const backoff = new Promise(resolve => { - setTimeout(resolve, delay); - }); - // Notify the user if they added an `onRetryAttempt` handler - if (config.onRetryAttempt) { - config.onRetryAttempt(err); - } - // Return the promise in which recalls Gaxios to retry the request - await backoff; - return { shouldRetry: true, config: err.config }; -} -exports.getRetryConfig = getRetryConfig; -/** - * Determine based on config if we should retry the request. - * @param err The GaxiosError passed to the interceptor. - */ -function shouldRetryRequest(err) { - const config = getConfig(err); - // node-fetch raises an AbortError if signaled: - // https://github.com/bitinn/node-fetch#request-cancellation-with-abortsignal - if (err.name === 'AbortError') { - return false; - } - // If there's no config, or retries are disabled, return. - if (!config || config.retry === 0) { - return false; - } - // Check if this error has no response (ETIMEDOUT, ENOTFOUND, etc) - if (!err.response && - (config.currentRetryAttempt || 0) >= config.noResponseRetries) { - return false; - } - // Only retry with configured HttpMethods. - if (!err.config.method || - config.httpMethodsToRetry.indexOf(err.config.method.toUpperCase()) < 0) { - return false; - } - // If this wasn't in the list of status codes where we want - // to automatically retry, return. - if (err.response && err.response.status) { - let isInRange = false; - for (const [min, max] of config.statusCodesToRetry) { - const status = err.response.status; - if (status >= min && status <= max) { - isInRange = true; - break; - } - } - if (!isInRange) { - return false; - } - } - // If we are out of retry attempts, return - config.currentRetryAttempt = config.currentRetryAttempt || 0; - if (config.currentRetryAttempt >= config.retry) { - return false; - } - return true; -} -/** - * Acquire the raxConfig object from an GaxiosError if available. - * @param err The Gaxios error with a config object. - */ -function getConfig(err) { - if (err && err.config && err.config.retryConfig) { - return err.config.retryConfig; - } - return; -} -//# sourceMappingURL=retry.js.map \ No newline at end of file diff --git a/node_modules/gaxios/build/src/retry.js.map b/node_modules/gaxios/build/src/retry.js.map deleted file mode 100644 index da3f0e88..00000000 --- a/node_modules/gaxios/build/src/retry.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/retry.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEA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;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAC,GAAgB;IACjC,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE;QAC/C,OAAO,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;KAC/B;IACD,OAAO;AACT,CAAC"} \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/agent-base/README.md b/node_modules/gaxios/node_modules/agent-base/README.md deleted file mode 100644 index d791f000..00000000 --- a/node_modules/gaxios/node_modules/agent-base/README.md +++ /dev/null @@ -1,145 +0,0 @@ -agent-base -========== -### Turn a function into an [`http.Agent`][http.Agent] instance -[![Build Status](https://github.com/TooTallNate/node-agent-base/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI) - -This module provides an `http.Agent` generator. That is, you pass it an async -callback function, and it returns a new `http.Agent` instance that will invoke the -given callback function when sending outbound HTTP requests. - -#### Some subclasses: - -Here's some more interesting uses of `agent-base`. -Send a pull request to list yours! - - * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints - * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints - * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS - * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS (v4a) proxy `http.Agent` implementation for HTTP and HTTPS - - -Installation ------------- - -Install with `npm`: - -``` bash -$ npm install agent-base -``` - - -Example -------- - -Here's a minimal example that creates a new `net.Socket` connection to the server -for every HTTP request (i.e. the equivalent of `agent: false` option): - -```js -var net = require('net'); -var tls = require('tls'); -var url = require('url'); -var http = require('http'); -var agent = require('agent-base'); - -var endpoint = 'http://nodejs.org/api/'; -var parsed = url.parse(endpoint); - -// This is the important part! -parsed.agent = agent(function (req, opts) { - var socket; - // `secureEndpoint` is true when using the https module - if (opts.secureEndpoint) { - socket = tls.connect(opts); - } else { - socket = net.connect(opts); - } - return socket; -}); - -// Everything else works just like normal... -http.get(parsed, function (res) { - console.log('"response" event!', res.headers); - res.pipe(process.stdout); -}); -``` - -Returning a Promise or using an `async` function is also supported: - -```js -agent(async function (req, opts) { - await sleep(1000); - // etc… -}); -``` - -Return another `http.Agent` instance to "pass through" the responsibility -for that HTTP request to that agent: - -```js -agent(function (req, opts) { - return opts.secureEndpoint ? https.globalAgent : http.globalAgent; -}); -``` - - -API ---- - -## Agent(Function callback[, Object options]) → [http.Agent][] - -Creates a base `http.Agent` that will execute the callback function `callback` -for every HTTP request that it is used as the `agent` for. The callback function -is responsible for creating a `stream.Duplex` instance of some kind that will be -used as the underlying socket in the HTTP request. - -The `options` object accepts the following properties: - - * `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional). - -The callback function should have the following signature: - -### callback(http.ClientRequest req, Object options, Function cb) → undefined - -The ClientRequest `req` can be accessed to read request headers and -and the path, etc. The `options` object contains the options passed -to the `http.request()`/`https.request()` function call, and is formatted -to be directly passed to `net.connect()`/`tls.connect()`, or however -else you want a Socket to be created. Pass the created socket to -the callback function `cb` once created, and the HTTP request will -continue to proceed. - -If the `https` module is used to invoke the HTTP request, then the -`secureEndpoint` property on `options` _will be set to `true`_. - - -License -------- - -(The MIT License) - -Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> - -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. - -[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent -[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent -[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent -[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent -[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent diff --git a/node_modules/gaxios/node_modules/agent-base/dist/src/index.d.ts b/node_modules/gaxios/node_modules/agent-base/dist/src/index.d.ts deleted file mode 100644 index 8c8ea4eb..00000000 --- a/node_modules/gaxios/node_modules/agent-base/dist/src/index.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/// -import net from 'net'; -import http from 'http'; -import https from 'https'; -import { Duplex } from 'stream'; -import { EventEmitter } from 'events'; -declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent; -declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent; -declare namespace createAgent { - interface ClientRequest extends http.ClientRequest { - _last?: boolean; - _hadError?: boolean; - method: string; - } - interface AgentRequestOptions { - host?: string; - path?: string; - port: number; - } - interface HttpRequestOptions extends AgentRequestOptions, Omit { - secureEndpoint: false; - } - interface HttpsRequestOptions extends AgentRequestOptions, Omit { - secureEndpoint: true; - } - type RequestOptions = HttpRequestOptions | HttpsRequestOptions; - type AgentLike = Pick | http.Agent; - type AgentCallbackReturn = Duplex | AgentLike; - type AgentCallbackCallback = (err?: Error | null, socket?: createAgent.AgentCallbackReturn) => void; - type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise; - type AgentCallback = typeof Agent.prototype.callback; - type AgentOptions = { - timeout?: number; - }; - /** - * Base `http.Agent` implementation. - * No pooling/keep-alive is implemented by default. - * - * @param {Function} callback - * @api public - */ - class Agent extends EventEmitter { - timeout: number | null; - maxFreeSockets: number; - maxSockets: number; - sockets: { - [key: string]: net.Socket[]; - }; - requests: { - [key: string]: http.IncomingMessage[]; - }; - options: https.AgentOptions; - private promisifiedCallback?; - private explicitDefaultPort?; - private explicitProtocol?; - constructor(callback?: createAgent.AgentCallback | createAgent.AgentOptions, _opts?: createAgent.AgentOptions); - get defaultPort(): number; - set defaultPort(v: number); - get protocol(): string; - set protocol(v: string); - callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions, fn: createAgent.AgentCallbackCallback): void; - callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions): createAgent.AgentCallbackReturn | Promise; - /** - * Called by node-core's "_http_client.js" module when creating - * a new HTTP request with this Agent instance. - * - * @api public - */ - addRequest(req: ClientRequest, _opts: RequestOptions): void; - freeSocket(socket: net.Socket, opts: AgentOptions): void; - destroy(): void; - } -} -export = createAgent; diff --git a/node_modules/gaxios/node_modules/agent-base/dist/src/index.js b/node_modules/gaxios/node_modules/agent-base/dist/src/index.js deleted file mode 100644 index 0467bf0b..00000000 --- a/node_modules/gaxios/node_modules/agent-base/dist/src/index.js +++ /dev/null @@ -1,201 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const events_1 = require("events"); -const debug_1 = __importDefault(require("debug")); -const promisify_1 = __importDefault(require("./promisify")); -const debug = debug_1.default('agent-base'); -function isAgent(v) { - return Boolean(v) && typeof v.addRequest === 'function'; -} -function isSecureEndpoint() { - const { stack } = new Error(); - if (typeof stack !== 'string') - return false; - return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1); -} -function createAgent(callback, opts) { - return new createAgent.Agent(callback, opts); -} -(function (createAgent) { - /** - * Base `http.Agent` implementation. - * No pooling/keep-alive is implemented by default. - * - * @param {Function} callback - * @api public - */ - class Agent extends events_1.EventEmitter { - constructor(callback, _opts) { - super(); - let opts = _opts; - if (typeof callback === 'function') { - this.callback = callback; - } - else if (callback) { - opts = callback; - } - // Timeout for the socket to be returned from the callback - this.timeout = null; - if (opts && typeof opts.timeout === 'number') { - this.timeout = opts.timeout; - } - // These aren't actually used by `agent-base`, but are required - // for the TypeScript definition files in `@types/node` :/ - this.maxFreeSockets = 1; - this.maxSockets = 1; - this.sockets = {}; - this.requests = {}; - this.options = {}; - } - get defaultPort() { - if (typeof this.explicitDefaultPort === 'number') { - return this.explicitDefaultPort; - } - return isSecureEndpoint() ? 443 : 80; - } - set defaultPort(v) { - this.explicitDefaultPort = v; - } - get protocol() { - if (typeof this.explicitProtocol === 'string') { - return this.explicitProtocol; - } - return isSecureEndpoint() ? 'https:' : 'http:'; - } - set protocol(v) { - this.explicitProtocol = v; - } - callback(req, opts, fn) { - throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`'); - } - /** - * Called by node-core's "_http_client.js" module when creating - * a new HTTP request with this Agent instance. - * - * @api public - */ - addRequest(req, _opts) { - const opts = Object.assign({}, _opts); - if (typeof opts.secureEndpoint !== 'boolean') { - opts.secureEndpoint = isSecureEndpoint(); - } - if (opts.host == null) { - opts.host = 'localhost'; - } - if (opts.port == null) { - opts.port = opts.secureEndpoint ? 443 : 80; - } - if (opts.protocol == null) { - opts.protocol = opts.secureEndpoint ? 'https:' : 'http:'; - } - if (opts.host && opts.path) { - // If both a `host` and `path` are specified then it's most - // likely the result of a `url.parse()` call... we need to - // remove the `path` portion so that `net.connect()` doesn't - // attempt to open that as a unix socket file. - delete opts.path; - } - delete opts.agent; - delete opts.hostname; - delete opts._defaultAgent; - delete opts.defaultPort; - delete opts.createConnection; - // Hint to use "Connection: close" - // XXX: non-documented `http` module API :( - req._last = true; - req.shouldKeepAlive = false; - let timedOut = false; - let timeoutId = null; - const timeoutMs = opts.timeout || this.timeout; - const onerror = (err) => { - if (req._hadError) - return; - req.emit('error', err); - // For Safety. Some additional errors might fire later on - // and we need to make sure we don't double-fire the error event. - req._hadError = true; - }; - const ontimeout = () => { - timeoutId = null; - timedOut = true; - const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`); - err.code = 'ETIMEOUT'; - onerror(err); - }; - const callbackError = (err) => { - if (timedOut) - return; - if (timeoutId !== null) { - clearTimeout(timeoutId); - timeoutId = null; - } - onerror(err); - }; - const onsocket = (socket) => { - if (timedOut) - return; - if (timeoutId != null) { - clearTimeout(timeoutId); - timeoutId = null; - } - if (isAgent(socket)) { - // `socket` is actually an `http.Agent` instance, so - // relinquish responsibility for this `req` to the Agent - // from here on - debug('Callback returned another Agent instance %o', socket.constructor.name); - socket.addRequest(req, opts); - return; - } - if (socket) { - socket.once('free', () => { - this.freeSocket(socket, opts); - }); - req.onSocket(socket); - return; - } - const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``); - onerror(err); - }; - if (typeof this.callback !== 'function') { - onerror(new Error('`callback` is not defined')); - return; - } - if (!this.promisifiedCallback) { - if (this.callback.length >= 3) { - debug('Converting legacy callback function to promise'); - this.promisifiedCallback = promisify_1.default(this.callback); - } - else { - this.promisifiedCallback = this.callback; - } - } - if (typeof timeoutMs === 'number' && timeoutMs > 0) { - timeoutId = setTimeout(ontimeout, timeoutMs); - } - if ('port' in opts && typeof opts.port !== 'number') { - opts.port = Number(opts.port); - } - try { - debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`); - Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError); - } - catch (err) { - Promise.reject(err).catch(callbackError); - } - } - freeSocket(socket, opts) { - debug('Freeing socket %o %o', socket.constructor.name, opts); - socket.destroy(); - } - destroy() { - debug('Destroying agent %o', this.constructor.name); - } - } - createAgent.Agent = Agent; - // So that `instanceof` works correctly - createAgent.prototype = createAgent.Agent.prototype; -})(createAgent || (createAgent = {})); -module.exports = createAgent; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/agent-base/dist/src/index.js.map b/node_modules/gaxios/node_modules/agent-base/dist/src/index.js.map deleted file mode 100644 index dfc8c5cc..00000000 --- a/node_modules/gaxios/node_modules/agent-base/dist/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAIA,mCAAsC;AACtC,kDAAgC;AAChC,4DAAoC;AAEpC,MAAM,KAAK,GAAG,eAAW,CAAC,YAAY,CAAC,CAAC;AAExC,SAAS,OAAO,CAAC,CAAM;IACtB,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAOD,SAAS,WAAW,CACnB,QAA+D,EAC/D,IAA+B;IAE/B,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,WAAU,WAAW;IAmDpB;;;;;;OAMG;IACH,MAAa,KAAM,SAAQ,qBAAY;QAetC,YACC,QAA+D,EAC/D,KAAgC;YAEhC,KAAK,EAAE,CAAC;YAER,IAAI,IAAI,GAAG,KAAK,CAAC;YACjB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;gBACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;aACzB;iBAAM,IAAI,QAAQ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E,CAC3B,CAAC;gBACF,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CACxD,QAAQ,EACR,aAAa,CACb,CAAC;aACF;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;aACzC;QACF,CAAC;QAED,UAAU,CAAC,MAAkB,EAAE,IAAkB;YAChD,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC7D,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;QAED,OAAO;YACN,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;KACD;IAlPY,iBAAK,QAkPjB,CAAA;IAED,uCAAuC;IACvC,WAAW,CAAC,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;AACrD,CAAC,EAhTS,WAAW,KAAX,WAAW,QAgTpB;AAED,iBAAS,WAAW,CAAC"} \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.d.ts b/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.d.ts deleted file mode 100644 index 02688696..00000000 --- a/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ClientRequest, RequestOptions, AgentCallbackCallback, AgentCallbackPromise } from './index'; -declare type LegacyCallback = (req: ClientRequest, opts: RequestOptions, fn: AgentCallbackCallback) => void; -export default function promisify(fn: LegacyCallback): AgentCallbackPromise; -export {}; diff --git a/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.js b/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.js deleted file mode 100644 index b2f6132a..00000000 --- a/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function promisify(fn) { - return function (req, opts) { - return new Promise((resolve, reject) => { - fn.call(this, req, opts, (err, rtn) => { - if (err) { - reject(err); - } - else { - resolve(rtn); - } - }); - }); - }; -} -exports.default = promisify; -//# sourceMappingURL=promisify.js.map \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.js.map b/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.js.map deleted file mode 100644 index 4bff9bfc..00000000 --- a/node_modules/gaxios/node_modules/agent-base/dist/src/promisify.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAyB,EAAE,EAAE;gBAC5D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"} \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/agent-base/package.json b/node_modules/gaxios/node_modules/agent-base/package.json deleted file mode 100644 index a7779e79..00000000 --- a/node_modules/gaxios/node_modules/agent-base/package.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "_from": "agent-base@6", - "_id": "agent-base@6.0.1", - "_inBundle": false, - "_integrity": "sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg==", - "_location": "/gaxios/agent-base", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "agent-base@6", - "name": "agent-base", - "escapedName": "agent-base", - "rawSpec": "6", - "saveSpec": null, - "fetchSpec": "6" - }, - "_requiredBy": [ - "/gaxios/https-proxy-agent" - ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.1.tgz", - "_shasum": "808007e4e5867decb0ab6ab2f928fbdb5a596db4", - "_spec": "agent-base@6", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gaxios/node_modules/https-proxy-agent", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "bugs": { - "url": "https://github.com/TooTallNate/node-agent-base/issues" - }, - "bundleDependencies": false, - "dependencies": { - "debug": "4" - }, - "deprecated": false, - "description": "Turn a function into an `http.Agent` instance", - "devDependencies": { - "@types/debug": "4", - "@types/mocha": "^5.2.7", - "@types/node": "^12.12.17", - "@types/semver": "^7.1.0", - "@types/ws": "^6.0.3", - "@typescript-eslint/eslint-plugin": "1.6.0", - "@typescript-eslint/parser": "1.1.0", - "async-listen": "^1.2.0", - "cpy-cli": "^2.0.0", - "eslint": "5.16.0", - "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "4.1.0", - "eslint-import-resolver-typescript": "1.1.1", - "eslint-plugin-import": "2.16.0", - "eslint-plugin-jsx-a11y": "6.2.1", - "eslint-plugin-react": "7.12.4", - "mocha": "^6.2.0", - "rimraf": "^3.0.0", - "semver": "^7.1.2", - "typescript": "^3.5.3", - "ws": "^3.0.0" - }, - "engines": { - "node": ">= 6.0.0" - }, - "files": [ - "dist/src", - "src" - ], - "homepage": "https://github.com/TooTallNate/node-agent-base#readme", - "keywords": [ - "http", - "agent", - "base", - "barebones", - "https" - ], - "license": "MIT", - "main": "dist/src/index", - "name": "agent-base", - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-agent-base.git" - }, - "scripts": { - "build": "tsc", - "postbuild": "cpy --parents src test '!**/*.ts' dist", - "prebuild": "rimraf dist", - "prepublishOnly": "npm run build", - "test": "mocha --reporter spec dist/test/*.js", - "test-lint": "eslint src --ext .js,.ts" - }, - "typings": "dist/src/index", - "version": "6.0.1" -} diff --git a/node_modules/gaxios/node_modules/agent-base/src/index.ts b/node_modules/gaxios/node_modules/agent-base/src/index.ts deleted file mode 100644 index 870e3be2..00000000 --- a/node_modules/gaxios/node_modules/agent-base/src/index.ts +++ /dev/null @@ -1,339 +0,0 @@ -import net from 'net'; -import http from 'http'; -import https from 'https'; -import { Duplex } from 'stream'; -import { EventEmitter } from 'events'; -import createDebug from 'debug'; -import promisify from './promisify'; - -const debug = createDebug('agent-base'); - -function isAgent(v: any): v is createAgent.AgentLike { - return Boolean(v) && typeof v.addRequest === 'function'; -} - -function isSecureEndpoint(): boolean { - const { stack } = new Error(); - if (typeof stack !== 'string') return false; - return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1); -} - -function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent; -function createAgent( - callback: createAgent.AgentCallback, - opts?: createAgent.AgentOptions -): createAgent.Agent; -function createAgent( - callback?: createAgent.AgentCallback | createAgent.AgentOptions, - opts?: createAgent.AgentOptions -) { - return new createAgent.Agent(callback, opts); -} - -namespace createAgent { - export interface ClientRequest extends http.ClientRequest { - _last?: boolean; - _hadError?: boolean; - method: string; - } - - export interface AgentRequestOptions { - host?: string; - path?: string; - // `port` on `http.RequestOptions` can be a string or undefined, - // but `net.TcpNetConnectOpts` expects only a number - port: number; - } - - export interface HttpRequestOptions - extends AgentRequestOptions, - Omit { - secureEndpoint: false; - } - - export interface HttpsRequestOptions - extends AgentRequestOptions, - Omit { - secureEndpoint: true; - } - - export type RequestOptions = HttpRequestOptions | HttpsRequestOptions; - - export type AgentLike = Pick | http.Agent; - - export type AgentCallbackReturn = Duplex | AgentLike; - - export type AgentCallbackCallback = ( - err?: Error | null, - socket?: createAgent.AgentCallbackReturn - ) => void; - - export type AgentCallbackPromise = ( - req: createAgent.ClientRequest, - opts: createAgent.RequestOptions - ) => - | createAgent.AgentCallbackReturn - | Promise; - - export type AgentCallback = typeof Agent.prototype.callback; - - export type AgentOptions = { - timeout?: number; - }; - - /** - * Base `http.Agent` implementation. - * No pooling/keep-alive is implemented by default. - * - * @param {Function} callback - * @api public - */ - export class Agent extends EventEmitter { - public timeout: number | null; - public maxFreeSockets: number; - public maxSockets: number; - public sockets: { - [key: string]: net.Socket[]; - }; - public requests: { - [key: string]: http.IncomingMessage[]; - }; - public options: https.AgentOptions; - private promisifiedCallback?: createAgent.AgentCallbackPromise; - private explicitDefaultPort?: number; - private explicitProtocol?: string; - - constructor( - callback?: createAgent.AgentCallback | createAgent.AgentOptions, - _opts?: createAgent.AgentOptions - ) { - super(); - - let opts = _opts; - if (typeof callback === 'function') { - this.callback = callback; - } else if (callback) { - opts = callback; - } - - // Timeout for the socket to be returned from the callback - this.timeout = null; - if (opts && typeof opts.timeout === 'number') { - this.timeout = opts.timeout; - } - - // These aren't actually used by `agent-base`, but are required - // for the TypeScript definition files in `@types/node` :/ - this.maxFreeSockets = 1; - this.maxSockets = 1; - this.sockets = {}; - this.requests = {}; - this.options = {}; - } - - get defaultPort(): number { - if (typeof this.explicitDefaultPort === 'number') { - return this.explicitDefaultPort; - } - return isSecureEndpoint() ? 443 : 80; - } - - set defaultPort(v: number) { - this.explicitDefaultPort = v; - } - - get protocol(): string { - if (typeof this.explicitProtocol === 'string') { - return this.explicitProtocol; - } - return isSecureEndpoint() ? 'https:' : 'http:'; - } - - set protocol(v: string) { - this.explicitProtocol = v; - } - - callback( - req: createAgent.ClientRequest, - opts: createAgent.RequestOptions, - fn: createAgent.AgentCallbackCallback - ): void; - callback( - req: createAgent.ClientRequest, - opts: createAgent.RequestOptions - ): - | createAgent.AgentCallbackReturn - | Promise; - callback( - req: createAgent.ClientRequest, - opts: createAgent.AgentOptions, - fn?: createAgent.AgentCallbackCallback - ): - | createAgent.AgentCallbackReturn - | Promise - | void { - throw new Error( - '"agent-base" has no default implementation, you must subclass and override `callback()`' - ); - } - - /** - * Called by node-core's "_http_client.js" module when creating - * a new HTTP request with this Agent instance. - * - * @api public - */ - addRequest(req: ClientRequest, _opts: RequestOptions): void { - const opts: RequestOptions = { ..._opts }; - - if (typeof opts.secureEndpoint !== 'boolean') { - opts.secureEndpoint = isSecureEndpoint(); - } - - if (opts.host == null) { - opts.host = 'localhost'; - } - - if (opts.port == null) { - opts.port = opts.secureEndpoint ? 443 : 80; - } - - if (opts.protocol == null) { - opts.protocol = opts.secureEndpoint ? 'https:' : 'http:'; - } - - if (opts.host && opts.path) { - // If both a `host` and `path` are specified then it's most - // likely the result of a `url.parse()` call... we need to - // remove the `path` portion so that `net.connect()` doesn't - // attempt to open that as a unix socket file. - delete opts.path; - } - - delete opts.agent; - delete opts.hostname; - delete opts._defaultAgent; - delete opts.defaultPort; - delete opts.createConnection; - - // Hint to use "Connection: close" - // XXX: non-documented `http` module API :( - req._last = true; - req.shouldKeepAlive = false; - - let timedOut = false; - let timeoutId: ReturnType | null = null; - const timeoutMs = opts.timeout || this.timeout; - - const onerror = (err: NodeJS.ErrnoException) => { - if (req._hadError) return; - req.emit('error', err); - // For Safety. Some additional errors might fire later on - // and we need to make sure we don't double-fire the error event. - req._hadError = true; - }; - - const ontimeout = () => { - timeoutId = null; - timedOut = true; - const err: NodeJS.ErrnoException = new Error( - `A "socket" was not created for HTTP request before ${timeoutMs}ms` - ); - err.code = 'ETIMEOUT'; - onerror(err); - }; - - const callbackError = (err: NodeJS.ErrnoException) => { - if (timedOut) return; - if (timeoutId !== null) { - clearTimeout(timeoutId); - timeoutId = null; - } - onerror(err); - }; - - const onsocket = (socket: AgentCallbackReturn) => { - if (timedOut) return; - if (timeoutId != null) { - clearTimeout(timeoutId); - timeoutId = null; - } - - if (isAgent(socket)) { - // `socket` is actually an `http.Agent` instance, so - // relinquish responsibility for this `req` to the Agent - // from here on - debug( - 'Callback returned another Agent instance %o', - socket.constructor.name - ); - (socket as createAgent.Agent).addRequest(req, opts); - return; - } - - if (socket) { - socket.once('free', () => { - this.freeSocket(socket as net.Socket, opts); - }); - req.onSocket(socket as net.Socket); - return; - } - - const err = new Error( - `no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\`` - ); - onerror(err); - }; - - if (typeof this.callback !== 'function') { - onerror(new Error('`callback` is not defined')); - return; - } - - if (!this.promisifiedCallback) { - if (this.callback.length >= 3) { - debug('Converting legacy callback function to promise'); - this.promisifiedCallback = promisify(this.callback); - } else { - this.promisifiedCallback = this.callback; - } - } - - if (typeof timeoutMs === 'number' && timeoutMs > 0) { - timeoutId = setTimeout(ontimeout, timeoutMs); - } - - if ('port' in opts && typeof opts.port !== 'number') { - opts.port = Number(opts.port); - } - - try { - debug( - 'Resolving socket for %o request: %o', - opts.protocol, - `${req.method} ${req.path}` - ); - Promise.resolve(this.promisifiedCallback(req, opts)).then( - onsocket, - callbackError - ); - } catch (err) { - Promise.reject(err).catch(callbackError); - } - } - - freeSocket(socket: net.Socket, opts: AgentOptions) { - debug('Freeing socket %o %o', socket.constructor.name, opts); - socket.destroy(); - } - - destroy() { - debug('Destroying agent %o', this.constructor.name); - } - } - - // So that `instanceof` works correctly - createAgent.prototype = createAgent.Agent.prototype; -} - -export = createAgent; diff --git a/node_modules/gaxios/node_modules/agent-base/src/promisify.ts b/node_modules/gaxios/node_modules/agent-base/src/promisify.ts deleted file mode 100644 index 60cc6627..00000000 --- a/node_modules/gaxios/node_modules/agent-base/src/promisify.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - Agent, - ClientRequest, - RequestOptions, - AgentCallbackCallback, - AgentCallbackPromise, - AgentCallbackReturn -} from './index'; - -type LegacyCallback = ( - req: ClientRequest, - opts: RequestOptions, - fn: AgentCallbackCallback -) => void; - -export default function promisify(fn: LegacyCallback): AgentCallbackPromise { - return function(this: Agent, req: ClientRequest, opts: RequestOptions) { - return new Promise((resolve, reject) => { - fn.call( - this, - req, - opts, - (err: Error | null | undefined, rtn?: AgentCallbackReturn) => { - if (err) { - reject(err); - } else { - resolve(rtn); - } - } - ); - }); - }; -} diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/README.md b/node_modules/gaxios/node_modules/https-proxy-agent/README.md deleted file mode 100644 index 328656a9..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/README.md +++ /dev/null @@ -1,137 +0,0 @@ -https-proxy-agent -================ -### An HTTP(s) proxy `http.Agent` implementation for HTTPS -[![Build Status](https://github.com/TooTallNate/node-https-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-https-proxy-agent/actions?workflow=Node+CI) - -This module provides an `http.Agent` implementation that connects to a specified -HTTP or HTTPS proxy server, and can be used with the built-in `https` module. - -Specifically, this `Agent` implementation connects to an intermediary "proxy" -server and issues the [CONNECT HTTP method][CONNECT], which tells the proxy to -open a direct TCP connection to the destination server. - -Since this agent implements the CONNECT HTTP method, it also works with other -protocols that use this method when connecting over proxies (i.e. WebSockets). -See the "Examples" section below for more. - - -Installation ------------- - -Install with `npm`: - -``` bash -$ npm install https-proxy-agent -``` - - -Examples --------- - -#### `https` module example - -``` js -var url = require('url'); -var https = require('https'); -var HttpsProxyAgent = require('https-proxy-agent'); - -// HTTP/HTTPS proxy to connect to -var proxy = process.env.http_proxy || 'http://168.63.76.32:3128'; -console.log('using proxy server %j', proxy); - -// HTTPS endpoint for the proxy to connect to -var endpoint = process.argv[2] || 'https://graph.facebook.com/tootallnate'; -console.log('attempting to GET %j', endpoint); -var options = url.parse(endpoint); - -// create an instance of the `HttpsProxyAgent` class with the proxy server information -var agent = new HttpsProxyAgent(proxy); -options.agent = agent; - -https.get(options, function (res) { - console.log('"response" event!', res.headers); - res.pipe(process.stdout); -}); -``` - -#### `ws` WebSocket connection example - -``` js -var url = require('url'); -var WebSocket = require('ws'); -var HttpsProxyAgent = require('https-proxy-agent'); - -// HTTP/HTTPS proxy to connect to -var proxy = process.env.http_proxy || 'http://168.63.76.32:3128'; -console.log('using proxy server %j', proxy); - -// WebSocket endpoint for the proxy to connect to -var endpoint = process.argv[2] || 'ws://echo.websocket.org'; -var parsed = url.parse(endpoint); -console.log('attempting to connect to WebSocket %j', endpoint); - -// create an instance of the `HttpsProxyAgent` class with the proxy server information -var options = url.parse(proxy); - -var agent = new HttpsProxyAgent(options); - -// finally, initiate the WebSocket connection -var socket = new WebSocket(endpoint, { agent: agent }); - -socket.on('open', function () { - console.log('"open" event!'); - socket.send('hello world'); -}); - -socket.on('message', function (data, flags) { - console.log('"message" event! %j %j', data, flags); - socket.close(); -}); -``` - -API ---- - -### new HttpsProxyAgent(Object options) - -The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects -to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket -requests. This is achieved by using the [HTTP `CONNECT` method][CONNECT]. - -The `options` argument may either be a string URI of the proxy server to use, or an -"options" object with more specific properties: - - * `host` - String - Proxy host to connect to (may use `hostname` as well). Required. - * `port` - Number - Proxy port to connect to. Required. - * `protocol` - String - If `https:`, then use TLS to connect to the proxy. - * `headers` - Object - Additional HTTP headers to be sent on the HTTP CONNECT method. - * Any other options given are passed to the `net.connect()`/`tls.connect()` functions. - - -License -------- - -(The MIT License) - -Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> - -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. - -[CONNECT]: http://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_Tunneling diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.d.ts b/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.d.ts deleted file mode 100644 index 4f1c6362..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// -import net from 'net'; -import { Agent, ClientRequest, RequestOptions } from 'agent-base'; -import { HttpsProxyAgentOptions } from '.'; -/** - * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to - * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. - * - * Outgoing HTTP requests are first tunneled through the proxy server using the - * `CONNECT` HTTP request method to establish a connection to the proxy server, - * and then the proxy server connects to the destination target and issues the - * HTTP request from the proxy server. - * - * `https:` requests have their socket connection upgraded to TLS once - * the connection to the proxy server has been established. - * - * @api public - */ -export default class HttpsProxyAgent extends Agent { - private secureProxy; - private proxy; - constructor(_opts: string | HttpsProxyAgentOptions); - /** - * Called when the node-core HTTP client library is creating a - * new HTTP request. - * - * @api protected - */ - callback(req: ClientRequest, opts: RequestOptions): Promise; -} diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.js b/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.js deleted file mode 100644 index d6665259..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.js +++ /dev/null @@ -1,180 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__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()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const net_1 = __importDefault(require("net")); -const tls_1 = __importDefault(require("tls")); -const url_1 = __importDefault(require("url")); -const assert_1 = __importDefault(require("assert")); -const debug_1 = __importDefault(require("debug")); -const agent_base_1 = require("agent-base"); -const parse_proxy_response_1 = __importDefault(require("./parse-proxy-response")); -const debug = debug_1.default('https-proxy-agent:agent'); -/** - * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to - * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. - * - * Outgoing HTTP requests are first tunneled through the proxy server using the - * `CONNECT` HTTP request method to establish a connection to the proxy server, - * and then the proxy server connects to the destination target and issues the - * HTTP request from the proxy server. - * - * `https:` requests have their socket connection upgraded to TLS once - * the connection to the proxy server has been established. - * - * @api public - */ -class HttpsProxyAgent extends agent_base_1.Agent { - constructor(_opts) { - let opts; - if (typeof _opts === 'string') { - opts = url_1.default.parse(_opts); - } - else { - opts = _opts; - } - if (!opts) { - throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); - } - debug('creating new HttpsProxyAgent instance: %o', opts); - super(opts); - const proxy = Object.assign({}, opts); - // If `true`, then connect to the proxy server over TLS. - // Defaults to `false`. - this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); - // Prefer `hostname` over `host`, and set the `port` if needed. - proxy.host = proxy.hostname || proxy.host; - if (typeof proxy.port === 'string') { - proxy.port = parseInt(proxy.port, 10); - } - if (!proxy.port && proxy.host) { - proxy.port = this.secureProxy ? 443 : 80; - } - // ALPN is supported by Node.js >= v5. - // attempt to negotiate http/1.1 for proxy servers that support http/2 - if (this.secureProxy && !('ALPNProtocols' in proxy)) { - proxy.ALPNProtocols = ['http 1.1']; - } - if (proxy.host && proxy.path) { - // If both a `host` and `path` are specified then it's most likely - // the result of a `url.parse()` call... we need to remove the - // `path` portion so that `net.connect()` doesn't attempt to open - // that as a Unix socket file. - delete proxy.path; - delete proxy.pathname; - } - this.proxy = proxy; - } - /** - * Called when the node-core HTTP client library is creating a - * new HTTP request. - * - * @api protected - */ - callback(req, opts) { - return __awaiter(this, void 0, void 0, function* () { - const { proxy, secureProxy } = this; - // Create a socket connection to the proxy server. - let socket; - if (secureProxy) { - debug('Creating `tls.Socket`: %o', proxy); - socket = tls_1.default.connect(proxy); - } - else { - debug('Creating `net.Socket`: %o', proxy); - socket = net_1.default.connect(proxy); - } - const headers = Object.assign({}, proxy.headers); - const hostname = `${opts.host}:${opts.port}`; - let payload = `CONNECT ${hostname} HTTP/1.1\r\n`; - // Inject the `Proxy-Authorization` header if necessary. - if (proxy.auth) { - headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`; - } - // The `Host` header should only include the port - // number when it is not the default port. - let { host, port, secureEndpoint } = opts; - if (!isDefaultPort(port, secureEndpoint)) { - host += `:${port}`; - } - headers.Host = host; - headers.Connection = 'close'; - for (const name of Object.keys(headers)) { - payload += `${name}: ${headers[name]}\r\n`; - } - const proxyResponsePromise = parse_proxy_response_1.default(socket); - socket.write(`${payload}\r\n`); - const { statusCode, buffered } = yield proxyResponsePromise; - if (statusCode === 200) { - req.once('socket', resume); - if (opts.secureEndpoint) { - const servername = opts.servername || opts.host; - if (!servername) { - throw new Error('Could not determine "servername"'); - } - // The proxy is connecting to a TLS server, so upgrade - // this socket connection to a TLS connection. - debug('Upgrading socket connection to TLS'); - return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, - servername })); - } - return socket; - } - // Some other status code that's not 200... need to re-play the HTTP - // header "data" events onto the socket once the HTTP machinery is - // attached so that the node core `http` can parse and handle the - // error status code. - // Close the original socket, and a new "fake" socket is returned - // instead, so that the proxy doesn't get the HTTP request - // written to it (which may contain `Authorization` headers or other - // sensitive data). - // - // See: https://hackerone.com/reports/541502 - socket.destroy(); - const fakeSocket = new net_1.default.Socket(); - fakeSocket.readable = true; - // Need to wait for the "socket" event to re-play the "data" events. - req.once('socket', (s) => { - debug('replaying proxy buffer for failed request'); - assert_1.default(s.listenerCount('data') > 0); - // Replay the "buffered" Buffer onto the fake `socket`, since at - // this point the HTTP module machinery has been hooked up for - // the user. - s.push(buffered); - s.push(null); - }); - return fakeSocket; - }); - } -} -exports.default = HttpsProxyAgent; -function resume(socket) { - socket.resume(); -} -function isDefaultPort(port, secure) { - return Boolean((!secure && port === 80) || (secure && port === 443)); -} -function isHTTPS(protocol) { - return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; -} -function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; -} -//# sourceMappingURL=agent.js.map \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.js.map b/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.js.map deleted file mode 100644 index d1307cdd..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/agent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,8CAAsB;AACtB,8CAAsB;AACtB,oDAA4B;AAC5B,kDAAgC;AAEhC,2CAAkE;AAElE,kFAAwD;AAExD,MAAM,KAAK,GAAG,eAAW,CAAC,yBAAyB,CAAC,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAqB,eAAgB,SAAQ,kBAAK;IAIjD,YAAY,KAAsC;QACjD,IAAI,IAA4B,CAAC;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAA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;gBACnD,gBAAM,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBAEpC,gEAAgE;gBAChE,8DAA8D;gBAC9D,YAAY;gBACZ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACjB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,OAAO,UAAU,CAAC;QACnB,CAAC;KAAA;CACD;AA9JD,kCA8JC;AAED,SAAS,MAAM,CAAC,MAAkC;IACjD,MAAM,CAAC,MAAM,EAAE,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,MAAe;IACnD,OAAO,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,OAAO,CAAC,QAAwB;IACxC,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3E,CAAC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.d.ts b/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.d.ts deleted file mode 100644 index 0d60062e..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// -import net from 'net'; -import tls from 'tls'; -import { Url } from 'url'; -import { AgentOptions } from 'agent-base'; -import { OutgoingHttpHeaders } from 'http'; -import _HttpsProxyAgent from './agent'; -declare function createHttpsProxyAgent(opts: string | createHttpsProxyAgent.HttpsProxyAgentOptions): _HttpsProxyAgent; -declare namespace createHttpsProxyAgent { - interface BaseHttpsProxyAgentOptions { - headers?: OutgoingHttpHeaders; - secureProxy?: boolean; - host?: string | null; - path?: string | null; - port?: string | number | null; - } - export interface HttpsProxyAgentOptions extends AgentOptions, BaseHttpsProxyAgentOptions, Partial> { - } - export type HttpsProxyAgent = _HttpsProxyAgent; - export const HttpsProxyAgent: typeof _HttpsProxyAgent; - export {}; -} -export = createHttpsProxyAgent; diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.js b/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.js deleted file mode 100644 index b03e7631..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const agent_1 = __importDefault(require("./agent")); -function createHttpsProxyAgent(opts) { - return new agent_1.default(opts); -} -(function (createHttpsProxyAgent) { - createHttpsProxyAgent.HttpsProxyAgent = agent_1.default; - createHttpsProxyAgent.prototype = agent_1.default.prototype; -})(createHttpsProxyAgent || (createHttpsProxyAgent = {})); -module.exports = createHttpsProxyAgent; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.js.map b/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.js.map deleted file mode 100644 index f3ce559d..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAKA,oDAAuC;AAEvC,SAAS,qBAAqB,CAC7B,IAA2D;IAE3D,OAAO,IAAI,eAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,WAAU,qBAAqB;IAoBjB,qCAAe,GAAG,eAAgB,CAAC;IAEhD,qBAAqB,CAAC,SAAS,GAAG,eAAgB,CAAC,SAAS,CAAC;AAC9D,CAAC,EAvBS,qBAAqB,KAArB,qBAAqB,QAuB9B;AAED,iBAAS,qBAAqB,CAAC"} \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts b/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts deleted file mode 100644 index 7565674a..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -import { Readable } from 'stream'; -export interface ProxyResponse { - statusCode: number; - buffered: Buffer; -} -export default function parseProxyResponse(socket: Readable): Promise; diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.js b/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.js deleted file mode 100644 index aa5ce3cc..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(require("debug")); -const debug = debug_1.default('https-proxy-agent:parse-proxy-response'); -function parseProxyResponse(socket) { - return new Promise((resolve, reject) => { - // we need to buffer any HTTP traffic that happens with the proxy before we get - // the CONNECT response, so that if the response is anything other than an "200" - // response code, then we can re-play the "data" events on the socket once the - // HTTP parser is hooked up... - let buffersLength = 0; - const buffers = []; - function read() { - const b = socket.read(); - if (b) - ondata(b); - else - socket.once('readable', read); - } - function cleanup() { - socket.removeListener('end', onend); - socket.removeListener('error', onerror); - socket.removeListener('close', onclose); - socket.removeListener('readable', read); - } - function onclose(err) { - debug('onclose had error %o', err); - } - function onend() { - debug('onend'); - } - function onerror(err) { - cleanup(); - debug('onerror %o', err); - reject(err); - } - function ondata(b) { - buffers.push(b); - buffersLength += b.length; - const buffered = Buffer.concat(buffers, buffersLength); - const endOfHeaders = buffered.indexOf('\r\n\r\n'); - if (endOfHeaders === -1) { - // keep buffering - debug('have not received end of HTTP headers yet...'); - read(); - return; - } - const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n')); - const statusCode = +firstLine.split(' ')[1]; - debug('got proxy server response: %o', firstLine); - resolve({ - statusCode, - buffered - }); - } - socket.on('error', onerror); - socket.on('close', onclose); - socket.on('end', onend); - read(); - }); -} -exports.default = parseProxyResponse; -//# sourceMappingURL=parse-proxy-response.js.map \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map b/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map deleted file mode 100644 index bacdb84b..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse-proxy-response.js","sourceRoot":"","sources":["../src/parse-proxy-response.ts"],"names":[],"mappings":";;;;;AAAA,kDAAgC;AAGhC,MAAM,KAAK,GAAG,eAAW,CAAC,wCAAwC,CAAC,CAAC;AAOpE,SAAwB,kBAAkB,CACzC,MAAgB;IAEhB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,+EAA+E;QAC/E,gFAAgF;QAChF,8EAA8E;QAC9E,8BAA8B;QAC9B,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,SAAS,IAAI;YACZ,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC;gBAAE,MAAM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S,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,KAAK,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC;YAClD,OAAO,CAAC;gBACP,UAAU;gBACV,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAExB,IAAI,EAAE,CAAC;IACR,CAAC,CAAC,CAAC;AACJ,CAAC;AAvED,qCAuEC"} \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/https-proxy-agent/package.json b/node_modules/gaxios/node_modules/https-proxy-agent/package.json deleted file mode 100644 index b8a5b318..00000000 --- a/node_modules/gaxios/node_modules/https-proxy-agent/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "_from": "https-proxy-agent@^5.0.0", - "_id": "https-proxy-agent@5.0.0", - "_inBundle": false, - "_integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "_location": "/gaxios/https-proxy-agent", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "https-proxy-agent@^5.0.0", - "name": "https-proxy-agent", - "escapedName": "https-proxy-agent", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/gaxios" - ], - "_resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "_shasum": "e2a90542abb68a762e0a0850f6c9edadfd8506b2", - "_spec": "https-proxy-agent@^5.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gaxios", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "bugs": { - "url": "https://github.com/TooTallNate/node-https-proxy-agent/issues" - }, - "bundleDependencies": false, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "deprecated": false, - "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", - "devDependencies": { - "@types/debug": "4", - "@types/node": "^12.12.11", - "@typescript-eslint/eslint-plugin": "1.6.0", - "@typescript-eslint/parser": "1.1.0", - "eslint": "5.16.0", - "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "4.1.0", - "eslint-import-resolver-typescript": "1.1.1", - "eslint-plugin-import": "2.16.0", - "eslint-plugin-jsx-a11y": "6.2.1", - "eslint-plugin-react": "7.12.4", - "mocha": "^6.2.2", - "proxy": "1", - "rimraf": "^3.0.0", - "typescript": "^3.5.3" - }, - "engines": { - "node": ">= 6" - }, - "files": [ - "dist" - ], - "homepage": "https://github.com/TooTallNate/node-https-proxy-agent#readme", - "keywords": [ - "https", - "proxy", - "endpoint", - "agent" - ], - "license": "MIT", - "main": "dist/index", - "name": "https-proxy-agent", - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-https-proxy-agent.git" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist", - "prepublishOnly": "npm run build", - "test": "mocha --reporter spec", - "test-lint": "eslint src --ext .js,.ts" - }, - "types": "dist/index", - "version": "5.0.0" -} diff --git a/node_modules/gaxios/node_modules/node-fetch/CHANGELOG.md b/node_modules/gaxios/node_modules/node-fetch/CHANGELOG.md deleted file mode 100644 index 543d3d94..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/CHANGELOG.md +++ /dev/null @@ -1,272 +0,0 @@ - -Changelog -========= - - -# 2.x release - -## v2.6.1 - -**This is an important security release. It is strongly recommended to update as soon as possible.** - -- Fix: honor the `size` option after following a redirect. - -## v2.6.0 - -- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information. -- Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body. -- Fix: `Response.url` should return empty string instead of `null` by default. - -## v2.5.0 - -- Enhance: `Response` object now includes `redirected` property. -- Enhance: `fetch()` now accepts third-party `Blob` implementation as body. -- Other: disable `package-lock.json` generation as we never commit them. -- Other: dev dependency update. -- Other: readme update. - -## v2.4.1 - -- Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export. - -## v2.4.0 - -- Enhance: added `Brotli` compression support (using node's zlib). -- Enhance: updated `Blob` implementation per spec. -- Fix: set content type automatically for `URLSearchParams`. -- Fix: `Headers` now reject empty header names. -- Fix: test cases, as node 12+ no longer accepts invalid header response. - -## v2.3.0 - -- Enhance: added `AbortSignal` support, with README example. -- Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`. -- Fix: update `browser.js` to support react-native environment, where `self` isn't available globally. - -## v2.2.1 - -- Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header. -- Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag. -- Other: Better README. - -## v2.2.0 - -- Enhance: Support all `ArrayBuffer` view types -- Enhance: Support Web Workers -- Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file -- Fix: Add `__esModule` property to the exports object -- Other: Better example in README for writing response to a file -- Other: More tests for Agent - -## v2.1.2 - -- Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects -- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size -- Fix: support custom `Host` headers with any casing -- Fix: support importing `fetch()` from TypeScript in `browser.js` -- Fix: handle the redirect response body properly - -## v2.1.1 - -Fix packaging errors in v2.1.0. - -## v2.1.0 - -- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request` -- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner -- Fix: silently ignore invalid HTTP headers -- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses -- Fix: include bodies when following a redirection when appropriate - -## v2.0.0 - -This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2. - -### General changes - -- Major: Node.js 0.10.x and 0.12.x support is dropped -- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports -- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable -- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup) -- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings -- Other: rewrite in ES2015 using Babel -- Other: use Codecov for code coverage tracking -- Other: update package.json script for npm 5 -- Other: `encoding` module is now optional (alpha.7) -- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9) -- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9) - -### HTTP requests - -- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec) -- Fix: errors in a response are caught before the body is accessed -- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+ - -### Response and Request classes - -- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior -- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2) -- Major: internal methods are no longer exposed -- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec) -- Enhance: add `response.arrayBuffer()` (also applies to Requests) -- Enhance: add experimental `response.blob()` (also applies to Requests) -- Enhance: `URLSearchParams` is now accepted as a body -- Enhance: wrap `response.json()` json parsing error as `FetchError` -- Fix: fix Request and Response with `null` body - -### Headers class - -- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec) -- Enhance: make Headers iterable -- Enhance: make Headers constructor accept an array of tuples -- Enhance: make sure header names and values are valid in HTTP -- Fix: coerce Headers prototype function parameters to strings, where applicable - -### Documentation - -- Enhance: more comprehensive API docs -- Enhance: add a list of default headers in README - - -# 1.x release - -## backport releases (v1.7.0 and beyond) - -See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details. - -## v1.6.3 - -- Enhance: error handling document to explain `FetchError` design -- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0) - -## v1.6.2 - -- Enhance: minor document update -- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error - -## v1.6.1 - -- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string -- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance -- Fix: documentation update - -## v1.6.0 - -- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer -- Enhance: better old server support by handling raw deflate response -- Enhance: skip encoding detection for non-HTML/XML response -- Enhance: minor document update -- Fix: HEAD request doesn't need decompression, as body is empty -- Fix: `req.body` now accepts a Node.js buffer - -## v1.5.3 - -- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate -- Fix: allow resolving response and cloned response in any order -- Fix: avoid setting `content-length` when `form-data` body use streams -- Fix: send DELETE request with content-length when body is present -- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch - -## v1.5.2 - -- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent - -## v1.5.1 - -- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection - -## v1.5.0 - -- Enhance: rejected promise now use custom `Error` (thx to @pekeler) -- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) -- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR) - -## v1.4.1 - -- Fix: wrapping Request instance with FormData body again should preserve the body as-is - -## v1.4.0 - -- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR) -- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin) -- Enhance: Body constructor has been refactored out (thx to @kirill-konshin) -- Enhance: Headers now has `forEach` method (thx to @tricoder42) -- Enhance: back to 100% code coverage -- Fix: better form-data support (thx to @item4) -- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR) - -## v1.3.3 - -- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests -- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header -- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec -- Fix: `Request` and `Response` constructors now parse headers input using `Headers` - -## v1.3.2 - -- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature) - -## v1.3.1 - -- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side) - -## v1.3.0 - -- Enhance: now `fetch.Request` is exposed as well - -## v1.2.1 - -- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes - -## v1.2.0 - -- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier - -## v1.1.2 - -- Fix: `Headers` should only support `String` and `Array` properties, and ignore others - -## v1.1.1 - -- Enhance: now req.headers accept both plain object and `Headers` instance - -## v1.1.0 - -- Enhance: timeout now also applies to response body (in case of slow response) -- Fix: timeout is now cleared properly when fetch is done/has failed - -## v1.0.6 - -- Fix: less greedy content-type charset matching - -## v1.0.5 - -- Fix: when `follow = 0`, fetch should not follow redirect -- Enhance: update tests for better coverage -- Enhance: code formatting -- Enhance: clean up doc - -## v1.0.4 - -- Enhance: test iojs support -- Enhance: timeout attached to socket event only fire once per redirect - -## v1.0.3 - -- Fix: response size limit should reject large chunk -- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD) - -## v1.0.2 - -- Fix: added res.ok per spec change - -## v1.0.0 - -- Enhance: better test coverage and doc - - -# 0.x release - -## v0.1 - -- Major: initial public release diff --git a/node_modules/gaxios/node_modules/node-fetch/LICENSE.md b/node_modules/gaxios/node_modules/node-fetch/LICENSE.md deleted file mode 100644 index 660ffecb..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/LICENSE.md +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 David Frank - -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. - diff --git a/node_modules/gaxios/node_modules/node-fetch/README.md b/node_modules/gaxios/node_modules/node-fetch/README.md deleted file mode 100644 index 2dde7428..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/README.md +++ /dev/null @@ -1,590 +0,0 @@ -node-fetch -========== - -[![npm version][npm-image]][npm-url] -[![build status][travis-image]][travis-url] -[![coverage status][codecov-image]][codecov-url] -[![install size][install-size-image]][install-size-url] -[![Discord][discord-image]][discord-url] - -A light-weight module that brings `window.fetch` to Node.js - -(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567)) - -[![Backers][opencollective-image]][opencollective-url] - - - -- [Motivation](#motivation) -- [Features](#features) -- [Difference from client-side fetch](#difference-from-client-side-fetch) -- [Installation](#installation) -- [Loading and configuring the module](#loading-and-configuring-the-module) -- [Common Usage](#common-usage) - - [Plain text or HTML](#plain-text-or-html) - - [JSON](#json) - - [Simple Post](#simple-post) - - [Post with JSON](#post-with-json) - - [Post with form parameters](#post-with-form-parameters) - - [Handling exceptions](#handling-exceptions) - - [Handling client and server errors](#handling-client-and-server-errors) -- [Advanced Usage](#advanced-usage) - - [Streams](#streams) - - [Buffer](#buffer) - - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data) - - [Extract Set-Cookie Header](#extract-set-cookie-header) - - [Post data using a file stream](#post-data-using-a-file-stream) - - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart) - - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal) -- [API](#api) - - [fetch(url[, options])](#fetchurl-options) - - [Options](#options) - - [Class: Request](#class-request) - - [Class: Response](#class-response) - - [Class: Headers](#class-headers) - - [Interface: Body](#interface-body) - - [Class: FetchError](#class-fetcherror) -- [License](#license) -- [Acknowledgement](#acknowledgement) - - - -## Motivation - -Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. - -See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side). - -## Features - -- Stay consistent with `window.fetch` API. -- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences. -- Use native promise but allow substituting it with [insert your favorite promise library]. -- Use native Node streams for body on both request and response. -- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically. -- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting. - -## Difference from client-side fetch - -- See [Known Differences](LIMITS.md) for details. -- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue. -- Pull requests are welcomed too! - -## Installation - -Current stable release (`2.x`) - -```sh -$ npm install node-fetch -``` - -## Loading and configuring the module -We suggest you load the module via `require` until the stabilization of ES modules in node: -```js -const fetch = require('node-fetch'); -``` - -If you are using a Promise library other than native, set it through `fetch.Promise`: -```js -const Bluebird = require('bluebird'); - -fetch.Promise = Bluebird; -``` - -## Common Usage - -NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences. - -#### Plain text or HTML -```js -fetch('https://github.com/') - .then(res => res.text()) - .then(body => console.log(body)); -``` - -#### JSON - -```js - -fetch('https://api.github.com/users/github') - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Simple Post -```js -fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' }) - .then(res => res.json()) // expecting a json response - .then(json => console.log(json)); -``` - -#### Post with JSON - -```js -const body = { a: 1 }; - -fetch('https://httpbin.org/post', { - method: 'post', - body: JSON.stringify(body), - headers: { 'Content-Type': 'application/json' }, - }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Post with form parameters -`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods. - -NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such: - -```js -const { URLSearchParams } = require('url'); - -const params = new URLSearchParams(); -params.append('a', 1); - -fetch('https://httpbin.org/post', { method: 'POST', body: params }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Handling exceptions -NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information. - -Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details. - -```js -fetch('https://domain.invalid/') - .catch(err => console.error(err)); -``` - -#### Handling client and server errors -It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses: - -```js -function checkStatus(res) { - if (res.ok) { // res.status >= 200 && res.status < 300 - return res; - } else { - throw MyCustomError(res.statusText); - } -} - -fetch('https://httpbin.org/status/400') - .then(checkStatus) - .then(res => console.log('will not get here...')) -``` - -## Advanced Usage - -#### Streams -The "Node.js way" is to use streams when possible: - -```js -fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') - .then(res => { - const dest = fs.createWriteStream('./octocat.png'); - res.body.pipe(dest); - }); -``` - -#### Buffer -If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API) - -```js -const fileType = require('file-type'); - -fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') - .then(res => res.buffer()) - .then(buffer => fileType(buffer)) - .then(type => { /* ... */ }); -``` - -#### Accessing Headers and other Meta data -```js -fetch('https://github.com/') - .then(res => { - console.log(res.ok); - console.log(res.status); - console.log(res.statusText); - console.log(res.headers.raw()); - console.log(res.headers.get('content-type')); - }); -``` - -#### Extract Set-Cookie Header - -Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API. - -```js -fetch(url).then(res => { - // returns an array of values, instead of a string of comma-separated values - console.log(res.headers.raw()['set-cookie']); -}); -``` - -#### Post data using a file stream - -```js -const { createReadStream } = require('fs'); - -const stream = createReadStream('input.txt'); - -fetch('https://httpbin.org/post', { method: 'POST', body: stream }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Post with form-data (detect multipart) - -```js -const FormData = require('form-data'); - -const form = new FormData(); -form.append('a', 1); - -fetch('https://httpbin.org/post', { method: 'POST', body: form }) - .then(res => res.json()) - .then(json => console.log(json)); - -// OR, using custom headers -// NOTE: getHeaders() is non-standard API - -const form = new FormData(); -form.append('a', 1); - -const options = { - method: 'POST', - body: form, - headers: form.getHeaders() -} - -fetch('https://httpbin.org/post', options) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Request cancellation with AbortSignal - -> NOTE: You may cancel streamed requests only on Node >= v8.0.0 - -You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller). - -An example of timing out a request after 150ms could be achieved as the following: - -```js -import AbortController from 'abort-controller'; - -const controller = new AbortController(); -const timeout = setTimeout( - () => { controller.abort(); }, - 150, -); - -fetch(url, { signal: controller.signal }) - .then(res => res.json()) - .then( - data => { - useData(data) - }, - err => { - if (err.name === 'AbortError') { - // request was aborted - } - }, - ) - .finally(() => { - clearTimeout(timeout); - }); -``` - -See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples. - - -## API - -### fetch(url[, options]) - -- `url` A string representing the URL for fetching -- `options` [Options](#fetch-options) for the HTTP(S) request -- Returns: Promise<[Response](#class-response)> - -Perform an HTTP(S) fetch. - -`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`. - - -### Options - -The default values are shown after each option key. - -```js -{ - // These properties are part of the Fetch Standard - method: 'GET', - headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below) - body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream - redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect - signal: null, // pass an instance of AbortSignal to optionally abort requests - - // The following properties are node-fetch extensions - follow: 20, // maximum redirect count. 0 to not follow redirect - timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead. - compress: true, // support gzip/deflate content encoding. false to disable - size: 0, // maximum response body size in bytes. 0 to disable - agent: null // http(s).Agent instance or function that returns an instance (see below) -} -``` - -##### Default Headers - -If no values are set, the following request headers will be sent automatically: - -Header | Value -------------------- | -------------------------------------------------------- -`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ -`Accept` | `*/*` -`Connection` | `close` _(when no `options.agent` is present)_ -`Content-Length` | _(automatically calculated, if possible)_ -`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ -`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)` - -Note: when `body` is a `Stream`, `Content-Length` is not set automatically. - -##### Custom Agent - -The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following: - -- Support self-signed certificate -- Use only IPv4 or IPv6 -- Custom DNS Lookup - -See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information. - -In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol. - -```js -const httpAgent = new http.Agent({ - keepAlive: true -}); -const httpsAgent = new https.Agent({ - keepAlive: true -}); - -const options = { - agent: function (_parsedURL) { - if (_parsedURL.protocol == 'http:') { - return httpAgent; - } else { - return httpsAgent; - } - } -} -``` - - -### Class: Request - -An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface. - -Due to the nature of Node.js, the following properties are not implemented at this moment: - -- `type` -- `destination` -- `referrer` -- `referrerPolicy` -- `mode` -- `credentials` -- `cache` -- `integrity` -- `keepalive` - -The following node-fetch extension properties are provided: - -- `follow` -- `compress` -- `counter` -- `agent` - -See [options](#fetch-options) for exact meaning of these extensions. - -#### new Request(input[, options]) - -*(spec-compliant)* - -- `input` A string representing a URL, or another `Request` (which will be cloned) -- `options` [Options][#fetch-options] for the HTTP(S) request - -Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). - -In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object. - - -### Class: Response - -An HTTP(S) response. This class implements the [Body](#iface-body) interface. - -The following properties are not implemented in node-fetch at this moment: - -- `Response.error()` -- `Response.redirect()` -- `type` -- `trailer` - -#### new Response([body[, options]]) - -*(spec-compliant)* - -- `body` A `String` or [`Readable` stream][node-readable] -- `options` A [`ResponseInit`][response-init] options dictionary - -Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response). - -Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly. - -#### response.ok - -*(spec-compliant)* - -Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. - -#### response.redirected - -*(spec-compliant)* - -Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0. - - -### Class: Headers - -This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented. - -#### new Headers([init]) - -*(spec-compliant)* - -- `init` Optional argument to pre-fill the `Headers` object - -Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object. - -```js -// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class - -const meta = { - 'Content-Type': 'text/xml', - 'Breaking-Bad': '<3' -}; -const headers = new Headers(meta); - -// The above is equivalent to -const meta = [ - [ 'Content-Type', 'text/xml' ], - [ 'Breaking-Bad', '<3' ] -]; -const headers = new Headers(meta); - -// You can in fact use any iterable objects, like a Map or even another Headers -const meta = new Map(); -meta.set('Content-Type', 'text/xml'); -meta.set('Breaking-Bad', '<3'); -const headers = new Headers(meta); -const copyOfHeaders = new Headers(headers); -``` - - -### Interface: Body - -`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes. - -The following methods are not yet implemented in node-fetch at this moment: - -- `formData()` - -#### body.body - -*(deviation from spec)* - -* Node.js [`Readable` stream][node-readable] - -Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable]. - -#### body.bodyUsed - -*(spec-compliant)* - -* `Boolean` - -A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again. - -#### body.arrayBuffer() -#### body.blob() -#### body.json() -#### body.text() - -*(spec-compliant)* - -* Returns: Promise - -Consume the body and return a promise that will resolve to one of these formats. - -#### body.buffer() - -*(node-fetch extension)* - -* Returns: Promise<Buffer> - -Consume the body and return a promise that will resolve to a Buffer. - -#### body.textConverted() - -*(node-fetch extension)* - -* Returns: Promise<String> - -Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible. - -(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.) - - -### Class: FetchError - -*(node-fetch extension)* - -An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info. - - -### Class: AbortError - -*(node-fetch extension)* - -An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info. - -## Acknowledgement - -Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference. - -`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr). - -## License - -MIT - -[npm-image]: https://flat.badgen.net/npm/v/node-fetch -[npm-url]: https://www.npmjs.com/package/node-fetch -[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch -[travis-url]: https://travis-ci.org/bitinn/node-fetch -[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master -[codecov-url]: https://codecov.io/gh/bitinn/node-fetch -[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch -[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch -[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square -[discord-url]: https://discord.gg/Zxbndcm -[opencollective-image]: https://opencollective.com/node-fetch/backers.svg -[opencollective-url]: https://opencollective.com/node-fetch -[whatwg-fetch]: https://fetch.spec.whatwg.org/ -[response-init]: https://fetch.spec.whatwg.org/#responseinit -[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams -[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers -[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md -[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md -[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md diff --git a/node_modules/gaxios/node_modules/node-fetch/browser.js b/node_modules/gaxios/node_modules/node-fetch/browser.js deleted file mode 100644 index 83c54c58..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/browser.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -// ref: https://github.com/tc39/proposal-global -var getGlobal = function () { - // the only reliable means to get the global object is - // `Function('return this')()` - // However, this causes CSP violations in Chrome apps. - if (typeof self !== 'undefined') { return self; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - throw new Error('unable to locate global object'); -} - -var global = getGlobal(); - -module.exports = exports = global.fetch; - -// Needed for TypeScript and Webpack. -if (global.fetch) { - exports.default = global.fetch.bind(global); -} - -exports.Headers = global.Headers; -exports.Request = global.Request; -exports.Response = global.Response; \ No newline at end of file diff --git a/node_modules/gaxios/node_modules/node-fetch/lib/index.es.js b/node_modules/gaxios/node_modules/node-fetch/lib/index.es.js deleted file mode 100644 index 61906c95..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/lib/index.es.js +++ /dev/null @@ -1,1640 +0,0 @@ -process.emitWarning("The .es.js file is deprecated. Use .mjs instead."); - -import Stream from 'stream'; -import http from 'http'; -import Url from 'url'; -import https from 'https'; -import zlib from 'zlib'; - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout, - size: request.size - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -export default fetch; -export { Headers, Request, Response, FetchError }; diff --git a/node_modules/gaxios/node_modules/node-fetch/lib/index.js b/node_modules/gaxios/node_modules/node-fetch/lib/index.js deleted file mode 100644 index 4b241bfb..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/lib/index.js +++ /dev/null @@ -1,1649 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var Stream = _interopDefault(require('stream')); -var http = _interopDefault(require('http')); -var Url = _interopDefault(require('url')); -var https = _interopDefault(require('https')); -var zlib = _interopDefault(require('zlib')); - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout, - size: request.size - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -module.exports = exports = fetch; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = exports; -exports.Headers = Headers; -exports.Request = Request; -exports.Response = Response; -exports.FetchError = FetchError; diff --git a/node_modules/gaxios/node_modules/node-fetch/lib/index.mjs b/node_modules/gaxios/node_modules/node-fetch/lib/index.mjs deleted file mode 100644 index ecf59af8..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/lib/index.mjs +++ /dev/null @@ -1,1638 +0,0 @@ -import Stream from 'stream'; -import http from 'http'; -import Url from 'url'; -import https from 'https'; -import zlib from 'zlib'; - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout, - size: request.size - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -export default fetch; -export { Headers, Request, Response, FetchError }; diff --git a/node_modules/gaxios/node_modules/node-fetch/package.json b/node_modules/gaxios/node_modules/node-fetch/package.json deleted file mode 100644 index 92e17b0b..00000000 --- a/node_modules/gaxios/node_modules/node-fetch/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "_from": "node-fetch@^2.3.0", - "_id": "node-fetch@2.6.1", - "_inBundle": false, - "_integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "_location": "/gaxios/node-fetch", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-fetch@^2.3.0", - "name": "node-fetch", - "escapedName": "node-fetch", - "rawSpec": "^2.3.0", - "saveSpec": null, - "fetchSpec": "^2.3.0" - }, - "_requiredBy": [ - "/gaxios" - ], - "_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "_shasum": "045bd323631f76ed2e2b55573394416b639a0052", - "_spec": "node-fetch@^2.3.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gaxios", - "author": { - "name": "David Frank" - }, - "browser": "./browser.js", - "bugs": { - "url": "https://github.com/bitinn/node-fetch/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A light-weight module that brings window.fetch to node.js", - "devDependencies": { - "@ungap/url-search-params": "^0.1.2", - "abort-controller": "^1.1.0", - "abortcontroller-polyfill": "^1.3.0", - "babel-core": "^6.26.3", - "babel-plugin-istanbul": "^4.1.6", - "babel-preset-env": "^1.6.1", - "babel-register": "^6.16.3", - "chai": "^3.5.0", - "chai-as-promised": "^7.1.1", - "chai-iterator": "^1.1.1", - "chai-string": "~1.3.0", - "codecov": "^3.3.0", - "cross-env": "^5.2.0", - "form-data": "^2.3.3", - "is-builtin-module": "^1.0.0", - "mocha": "^5.0.0", - "nyc": "11.9.0", - "parted": "^0.1.1", - "promise": "^8.0.3", - "resumer": "0.0.0", - "rollup": "^0.63.4", - "rollup-plugin-babel": "^3.0.7", - "string-to-arraybuffer": "^1.0.2", - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "files": [ - "lib/index.js", - "lib/index.mjs", - "lib/index.es.js", - "browser.js" - ], - "homepage": "https://github.com/bitinn/node-fetch", - "keywords": [ - "fetch", - "http", - "promise" - ], - "license": "MIT", - "main": "lib/index", - "module": "lib/index.mjs", - "name": "node-fetch", - "repository": { - "type": "git", - "url": "git+https://github.com/bitinn/node-fetch.git" - }, - "scripts": { - "build": "cross-env BABEL_ENV=rollup rollup -c", - "coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json", - "prepare": "npm run build", - "report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js", - "test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js" - }, - "version": "2.6.1" -} diff --git a/node_modules/gaxios/package.json b/node_modules/gaxios/package.json deleted file mode 100644 index e796b4f6..00000000 --- a/node_modules/gaxios/package.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "_from": "gaxios@^3.0.0", - "_id": "gaxios@3.2.0", - "_inBundle": false, - "_integrity": "sha512-+6WPeVzPvOshftpxJwRi2Ozez80tn/hdtOUag7+gajDHRJvAblKxTFSSMPtr2hmnLy7p0mvYz0rMXLBl8pSO7Q==", - "_location": "/gaxios", - "_phantomChildren": { - "debug": "4.2.0" - }, - "_requested": { - "type": "range", - "registry": true, - "raw": "gaxios@^3.0.0", - "name": "gaxios", - "escapedName": "gaxios", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/gcp-metadata", - "/google-auth-library", - "/gtoken" - ], - "_resolved": "https://registry.npmjs.org/gaxios/-/gaxios-3.2.0.tgz", - "_shasum": "11b6f0e8fb08d94a10d4d58b044ad3bec6dd486a", - "_spec": "gaxios@^3.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "Google, LLC" - }, - "bugs": { - "url": "https://github.com/googleapis/gaxios/issues" - }, - "bundleDependencies": false, - "dependencies": { - "abort-controller": "^3.0.0", - "extend": "^3.0.2", - "https-proxy-agent": "^5.0.0", - "is-stream": "^2.0.0", - "node-fetch": "^2.3.0" - }, - "deprecated": false, - "description": "A simple common HTTP client specifically for Google APIs and services.", - "devDependencies": { - "@compodoc/compodoc": "^1.1.9", - "@microsoft/api-documenter": "^7.8.10", - "@microsoft/api-extractor": "^7.8.10", - "@types/cors": "^2.8.6", - "@types/execa": "^0.9.0", - "@types/express": "^4.16.1", - "@types/extend": "^3.0.1", - "@types/mocha": "^8.0.0", - "@types/multiparty": "0.0.32", - "@types/mv": "^2.1.0", - "@types/ncp": "^2.0.1", - "@types/nock": "^10.0.0", - "@types/node": "^11.9.5", - "@types/node-fetch": "^2.1.6", - "@types/sinon": "^9.0.0", - "@types/tmp": "0.2.0", - "@types/uuid": "^8.0.0", - "c8": "^7.0.0", - "chai": "^4.2.0", - "codecov": "^3.2.0", - "cors": "^2.8.5", - "execa": "^4.0.0", - "express": "^4.16.4", - "gts": "^2.0.0", - "is-docker": "^2.0.0", - "karma": "^5.0.0", - "karma-chrome-launcher": "^3.0.0", - "karma-coverage": "^2.0.0", - "karma-firefox-launcher": "^1.1.0", - "karma-mocha": "^2.0.0", - "karma-remap-coverage": "^0.1.5", - "karma-sourcemap-loader": "^0.3.7", - "karma-webpack": "^4.0.0", - "linkinator": "^2.0.0", - "mocha": "^8.0.0", - "multiparty": "^4.2.1", - "mv": "^2.1.1", - "ncp": "^2.0.0", - "nock": "^13.0.0", - "null-loader": "^4.0.0", - "puppeteer": "^5.0.0", - "sinon": "^9.0.0", - "tmp": "0.2.1", - "ts-loader": "^8.0.0", - "typescript": "^3.8.3", - "uuid": "^8.0.0", - "webpack": "^4.29.5", - "webpack-cli": "^3.2.3" - }, - "engines": { - "node": ">=10" - }, - "files": [ - "build/src" - ], - "homepage": "https://github.com/googleapis/gaxios#readme", - "keywords": [ - "google" - ], - "license": "Apache-2.0", - "main": "build/src/index.js", - "name": "gaxios", - "repository": { - "type": "git", - "url": "git+https://github.com/googleapis/gaxios.git" - }, - "scripts": { - "api-documenter": "api-documenter yaml --input-folder=temp", - "api-extractor": "api-extractor run --local", - "browser-test": "node build/browser-test/browser-test-runner.js", - "clean": "gts clean", - "compile": "tsc -p .", - "docs": "compodoc src/", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prebrowser-test": "npm run compile", - "precompile": "gts clean", - "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm install", - "prepare": "npm run compile", - "presystem-test": "npm run compile", - "pretest": "npm run compile", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha build/system-test --timeout 40000", - "test": "c8 mocha build/test", - "webpack": "webpack" - }, - "types": "build/src/index.d.ts", - "version": "3.2.0" -} diff --git a/node_modules/gcp-metadata/CHANGELOG.md b/node_modules/gcp-metadata/CHANGELOG.md deleted file mode 100644 index ed8d5030..00000000 --- a/node_modules/gcp-metadata/CHANGELOG.md +++ /dev/null @@ -1,371 +0,0 @@ -# Changelog - -[npm history][1] - -[1]: https://www.npmjs.com/package/gcp-metadata?activeTab=versions - -## [4.2.0](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.4...v4.2.0) (2020-09-15) - - -### Features - -* add support for GCE_METADATA_HOST environment variable ([#406](https://www.github.com/googleapis/gcp-metadata/issues/406)) ([eaf128a](https://www.github.com/googleapis/gcp-metadata/commit/eaf128ad5afc4357cde72d19b017b9474c070fea)) - -### [4.1.4](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.3...v4.1.4) (2020-07-15) - - -### Bug Fixes - -* **deps:** update dependency json-bigint to v1 ([#382](https://www.github.com/googleapis/gcp-metadata/issues/382)) ([ab4d8c3](https://www.github.com/googleapis/gcp-metadata/commit/ab4d8c3022903206d433bafc47c27815c6f85e36)) - -### [4.1.3](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.2...v4.1.3) (2020-07-13) - - -### Bug Fixes - -* **deps:** update dependency json-bigint to ^0.4.0 ([#378](https://www.github.com/googleapis/gcp-metadata/issues/378)) ([b214280](https://www.github.com/googleapis/gcp-metadata/commit/b2142807928c8c032509277900d35fccd1023f0f)) - -### [4.1.2](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.1...v4.1.2) (2020-07-10) - - -### Bug Fixes - -* **deps:** roll back dependency gcp-metadata to ^4.1.0 ([#373](https://www.github.com/googleapis/gcp-metadata/issues/373)) ([a45adef](https://www.github.com/googleapis/gcp-metadata/commit/a45adefd92418faa08c8a5014cedb844d1eb3ae6)) - -### [4.1.1](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.0...v4.1.1) (2020-07-09) - - -### Bug Fixes - -* typeo in nodejs .gitattribute ([#371](https://www.github.com/googleapis/gcp-metadata/issues/371)) ([5b4bb1c](https://www.github.com/googleapis/gcp-metadata/commit/5b4bb1c85e67e3ef0a6d1ec2ea316d560e03092f)) - -## [4.1.0](https://www.github.com/googleapis/gcp-metadata/compare/v4.0.1...v4.1.0) (2020-05-05) - - -### Features - -* Introduces the GCE_METADATA_IP to allow using a different IP address for the GCE metadata server. ([#346](https://www.github.com/googleapis/gcp-metadata/issues/346)) ([ec0f82d](https://www.github.com/googleapis/gcp-metadata/commit/ec0f82d022b4b3aac95e94ee1d8e53cfac3b14a4)) - - -### Bug Fixes - -* do not check secondary host if GCE_METADATA_IP set ([#352](https://www.github.com/googleapis/gcp-metadata/issues/352)) ([64fa7d6](https://www.github.com/googleapis/gcp-metadata/commit/64fa7d68cbb76f455a3bfdcb27d58e7775eb789a)) -* warn rather than throwing when we fail to connect to metadata server ([#351](https://www.github.com/googleapis/gcp-metadata/issues/351)) ([754a6c0](https://www.github.com/googleapis/gcp-metadata/commit/754a6c07d1a72615cbb5ebf9ee04475a9a12f1c0)) - -### [4.0.1](https://www.github.com/googleapis/gcp-metadata/compare/v4.0.0...v4.0.1) (2020-04-14) - - -### Bug Fixes - -* **deps:** update dependency gaxios to v3 ([#326](https://www.github.com/googleapis/gcp-metadata/issues/326)) ([5667178](https://www.github.com/googleapis/gcp-metadata/commit/5667178429baff71ad5dab2a96f97f27b2106d57)) -* apache license URL ([#468](https://www.github.com/googleapis/gcp-metadata/issues/468)) ([#336](https://www.github.com/googleapis/gcp-metadata/issues/336)) ([195dcd2](https://www.github.com/googleapis/gcp-metadata/commit/195dcd2d227ba496949e7ec0dcd77e5b9269066c)) - -## [4.0.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.5.0...v4.0.0) (2020-03-19) - - -### ⚠ BREAKING CHANGES - -* typescript@3.7.x has breaking changes; compiler now targets es2015 -* drops Node 8 from engines field (#315) - -### Features - -* drops Node 8 from engines field ([#315](https://www.github.com/googleapis/gcp-metadata/issues/315)) ([acb6233](https://www.github.com/googleapis/gcp-metadata/commit/acb62337e8ba7f0b259ae4e553f19c5786207d84)) - - -### Build System - -* switch to latest typescirpt/gts ([#317](https://www.github.com/googleapis/gcp-metadata/issues/317)) ([fbb7158](https://www.github.com/googleapis/gcp-metadata/commit/fbb7158be62c9f1949b69079e35113be1e10495c)) - -## [3.5.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.4.0...v3.5.0) (2020-03-03) - - -### Features - -* add ECONNREFUSED to list of known errors for isAvailable() ([#309](https://www.github.com/googleapis/gcp-metadata/issues/309)) ([17ff6ea](https://www.github.com/googleapis/gcp-metadata/commit/17ff6ea361d02de31463532d4ab4040bf6276e0b)) - -## [3.4.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.3.1...v3.4.0) (2020-02-24) - - -### Features - -* significantly increase timeout if GCF environment detected ([#300](https://www.github.com/googleapis/gcp-metadata/issues/300)) ([8e507c6](https://www.github.com/googleapis/gcp-metadata/commit/8e507c645f69a11f508884b3181dc4414e579fcc)) - -### [3.3.1](https://www.github.com/googleapis/gcp-metadata/compare/v3.3.0...v3.3.1) (2020-01-30) - - -### Bug Fixes - -* **isAvailable:** handle EHOSTDOWN and EHOSTUNREACH error codes ([#291](https://www.github.com/googleapis/gcp-metadata/issues/291)) ([ba8d9f5](https://www.github.com/googleapis/gcp-metadata/commit/ba8d9f50eac6cf8b439c1b66c48ace146c75f6e2)) - -## [3.3.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.2.3...v3.3.0) (2019-12-16) - - -### Features - -* add environment variable for configuring environment detection ([#275](https://www.github.com/googleapis/gcp-metadata/issues/275)) ([580cfa4](https://www.github.com/googleapis/gcp-metadata/commit/580cfa4a5f5d0041aa09ae85cfc5a4575dd3957f)) -* cache response from isAvailable() method ([#274](https://www.github.com/googleapis/gcp-metadata/issues/274)) ([a05e13f](https://www.github.com/googleapis/gcp-metadata/commit/a05e13f1d1d61b1f9b9b1703bc37cdbdc022c93b)) - - -### Bug Fixes - -* fastFailMetadataRequest should not reject, if response already happened ([#273](https://www.github.com/googleapis/gcp-metadata/issues/273)) ([a6590c4](https://www.github.com/googleapis/gcp-metadata/commit/a6590c4fd8bc2dff3995c83d4c9175d5bd9f5e4a)) - -### [3.2.3](https://www.github.com/googleapis/gcp-metadata/compare/v3.2.2...v3.2.3) (2019-12-12) - - -### Bug Fixes - -* **deps:** pin TypeScript below 3.7.0 ([e4bf622](https://www.github.com/googleapis/gcp-metadata/commit/e4bf622e6654a51ddffc0921a15250130591db2f)) - -### [3.2.2](https://www.github.com/googleapis/gcp-metadata/compare/v3.2.1...v3.2.2) (2019-11-13) - - -### Bug Fixes - -* **docs:** add jsdoc-region-tag plugin ([#264](https://www.github.com/googleapis/gcp-metadata/issues/264)) ([af8362b](https://www.github.com/googleapis/gcp-metadata/commit/af8362b5a35d270af00cb3696bbf7344810e9b0c)) - -### [3.2.1](https://www.github.com/googleapis/gcp-metadata/compare/v3.2.0...v3.2.1) (2019-11-08) - - -### Bug Fixes - -* **deps:** update gaxios ([#257](https://www.github.com/googleapis/gcp-metadata/issues/257)) ([ba6e0b6](https://www.github.com/googleapis/gcp-metadata/commit/ba6e0b668635b4aa4ed10535ff021c02b2edf5ea)) - -## [3.2.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.1.0...v3.2.0) (2019-10-10) - - -### Features - -* add DEBUG_AUTH for digging into authentication issues ([#254](https://www.github.com/googleapis/gcp-metadata/issues/254)) ([804156d](https://www.github.com/googleapis/gcp-metadata/commit/804156d)) - -## [3.1.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.0.0...v3.1.0) (2019-10-07) - - -### Features - -* don't throw on ENETUNREACH ([#250](https://www.github.com/googleapis/gcp-metadata/issues/250)) ([88f2101](https://www.github.com/googleapis/gcp-metadata/commit/88f2101)) - -## [3.0.0](https://www.github.com/googleapis/gcp-metadata/compare/v2.0.4...v3.0.0) (2019-09-17) - - -### ⚠ BREAKING CHANGES - -* isAvailable now tries both DNS and IP, choosing whichever responds first (#239) - -### Features - -* isAvailable now tries both DNS and IP, choosing whichever responds first ([#239](https://www.github.com/googleapis/gcp-metadata/issues/239)) ([25bc116](https://www.github.com/googleapis/gcp-metadata/commit/25bc116)) - -### [2.0.4](https://www.github.com/googleapis/gcp-metadata/compare/v2.0.3...v2.0.4) (2019-09-13) - - -### Bug Fixes - -* IP address takes 15 seconds to timeout, vs., metadata returning immediately ([#235](https://www.github.com/googleapis/gcp-metadata/issues/235)) ([d04207b](https://www.github.com/googleapis/gcp-metadata/commit/d04207b)) -* use 3s timeout rather than 15 default ([#237](https://www.github.com/googleapis/gcp-metadata/issues/237)) ([231ca5c](https://www.github.com/googleapis/gcp-metadata/commit/231ca5c)) - -### [2.0.3](https://www.github.com/googleapis/gcp-metadata/compare/v2.0.2...v2.0.3) (2019-09-12) - - -### Bug Fixes - -* use IP for metadata server ([#233](https://www.github.com/googleapis/gcp-metadata/issues/233)) ([20a15cb](https://www.github.com/googleapis/gcp-metadata/commit/20a15cb)) - -### [2.0.2](https://www.github.com/googleapis/gcp-metadata/compare/v2.0.1...v2.0.2) (2019-08-26) - - -### Bug Fixes - -* allow calls with no request, add JSON proto ([#224](https://www.github.com/googleapis/gcp-metadata/issues/224)) ([dc758b1](https://www.github.com/googleapis/gcp-metadata/commit/dc758b1)) - -### [2.0.1](https://www.github.com/googleapis/gcp-metadata/compare/v2.0.0...v2.0.1) (2019-06-26) - - -### Bug Fixes - -* **docs:** make anchors work in jsdoc ([#212](https://www.github.com/googleapis/gcp-metadata/issues/212)) ([9174b43](https://www.github.com/googleapis/gcp-metadata/commit/9174b43)) - -## [2.0.0](https://www.github.com/googleapis/gcp-metadata/compare/v1.0.0...v2.0.0) (2019-05-07) - - -### Bug Fixes - -* **deps:** update dependency gaxios to v2 ([#191](https://www.github.com/googleapis/gcp-metadata/issues/191)) ([ac8c1ef](https://www.github.com/googleapis/gcp-metadata/commit/ac8c1ef)) - - -### Build System - -* upgrade engines field to >=8.10.0 ([#194](https://www.github.com/googleapis/gcp-metadata/issues/194)) ([97c23c8](https://www.github.com/googleapis/gcp-metadata/commit/97c23c8)) - - -### BREAKING CHANGES - -* upgrade engines field to >=8.10.0 (#194) - -## v1.0.0 - -02-14-2019 16:00 PST - -### Bug Fixes -- fix: ask gaxios for text and not json ([#152](https://github.com/googleapis/gcp-metadata/pull/152)) - -### Documentation -- docs: update links in contrib guide ([#168](https://github.com/googleapis/gcp-metadata/pull/168)) -- docs: add lint/fix example to contributing guide ([#160](https://github.com/googleapis/gcp-metadata/pull/160)) - -### Internal / Testing Changes -- build: use linkinator for docs test ([#166](https://github.com/googleapis/gcp-metadata/pull/166)) -- chore(deps): update dependency @types/tmp to v0.0.34 ([#167](https://github.com/googleapis/gcp-metadata/pull/167)) -- build: create docs test npm scripts ([#165](https://github.com/googleapis/gcp-metadata/pull/165)) -- test: run system tests on GCB ([#157](https://github.com/googleapis/gcp-metadata/pull/157)) -- build: test using @grpc/grpc-js in CI ([#164](https://github.com/googleapis/gcp-metadata/pull/164)) -- chore: move CONTRIBUTING.md to root ([#162](https://github.com/googleapis/gcp-metadata/pull/162)) -- chore(deps): update dependency gcx to v0.1.1 ([#159](https://github.com/googleapis/gcp-metadata/pull/159)) -- chore(deps): update dependency gcx to v0.1.0 ([#158](https://github.com/googleapis/gcp-metadata/pull/158)) -- chore(deps): update dependency gcx to v0.0.4 ([#155](https://github.com/googleapis/gcp-metadata/pull/155)) -- chore(deps): update dependency googleapis to v37 ([#156](https://github.com/googleapis/gcp-metadata/pull/156)) -- build: ignore googleapis.com in doc link check ([#153](https://github.com/googleapis/gcp-metadata/pull/153)) -- build: check broken links in generated docs ([#149](https://github.com/googleapis/gcp-metadata/pull/149)) -- chore(build): inject yoshi automation key ([#148](https://github.com/googleapis/gcp-metadata/pull/148)) - -## v0.9.3 - -12-10-2018 16:16 PST - -### Dependencies -- chore(deps): update dependency googleapis to v36 ([#135](https://github.com/googleapis/gcp-metadata/pull/135)) -- chore(deps): use gaxios for http requests ([#121](https://github.com/googleapis/gcp-metadata/pull/121)) -- chore(deps): update dependency gts to ^0.9.0 ([#123](https://github.com/googleapis/gcp-metadata/pull/123)) - -### Internal / Testing Changes -- fix(build): fix Kokoro release script ([#141](https://github.com/googleapis/gcp-metadata/pull/141)) -- Release v0.9.2 ([#140](https://github.com/googleapis/gcp-metadata/pull/140)) -- build: add Kokoro configs for autorelease ([#138](https://github.com/googleapis/gcp-metadata/pull/138)) -- Release gcp-metadata v0.9.1 ([#139](https://github.com/googleapis/gcp-metadata/pull/139)) -- chore: always nyc report before calling codecov ([#134](https://github.com/googleapis/gcp-metadata/pull/134)) -- chore: nyc ignore build/test by default ([#133](https://github.com/googleapis/gcp-metadata/pull/133)) -- Sync repo build files ([#131](https://github.com/googleapis/gcp-metadata/pull/131)) -- fix(build): fix system key decryption ([#128](https://github.com/googleapis/gcp-metadata/pull/128)) -- refactor: use execa, move post install test to system ([#127](https://github.com/googleapis/gcp-metadata/pull/127)) -- chore: add a synth.metadata -- test: add a system test ([#126](https://github.com/googleapis/gcp-metadata/pull/126)) -- chore: update eslintignore config ([#122](https://github.com/googleapis/gcp-metadata/pull/122)) -- chore: use latest npm on Windows ([#120](https://github.com/googleapis/gcp-metadata/pull/120)) -- chore: update CircleCI config ([#119](https://github.com/googleapis/gcp-metadata/pull/119)) -- chore: include build in eslintignore ([#115](https://github.com/googleapis/gcp-metadata/pull/115)) - -## v0.9.2 - -12-10-2018 14:01 PST - -- chore(deps): update dependency googleapis to v36 ([#135](https://github.com/googleapis/gcp-metadata/pull/135)) -- chore: always nyc report before calling codecov ([#134](https://github.com/googleapis/gcp-metadata/pull/134)) -- chore: nyc ignore build/test by default ([#133](https://github.com/googleapis/gcp-metadata/pull/133)) -- chore: Re-generated to pick up changes in the API or client library generator. ([#131](https://github.com/googleapis/gcp-metadata/pull/131)) -- fix(build): fix system key decryption ([#128](https://github.com/googleapis/gcp-metadata/pull/128)) -- chore(deps): use gaxios for http requests ([#121](https://github.com/googleapis/gcp-metadata/pull/121)) -- refactor: use execa, move post install test to system ([#127](https://github.com/googleapis/gcp-metadata/pull/127)) -- chore: add a synth.metadata -- test: add a system test ([#126](https://github.com/googleapis/gcp-metadata/pull/126)) -- chore(deps): update dependency gts to ^0.9.0 ([#123](https://github.com/googleapis/gcp-metadata/pull/123)) -- chore: update eslintignore config ([#122](https://github.com/googleapis/gcp-metadata/pull/122)) -- chore: use latest npm on Windows ([#120](https://github.com/googleapis/gcp-metadata/pull/120)) -- chore: update CircleCI config ([#119](https://github.com/googleapis/gcp-metadata/pull/119)) -- chore: include build in eslintignore ([#115](https://github.com/googleapis/gcp-metadata/pull/115)) -- build: add Kokoro configs for autorelease ([#138](https://github.com/googleapis/gcp-metadata/pull/138)) - -## v0.9.1 - -12-10-2018 11:53 PST - -- chore(deps): update dependency googleapis to v36 ([#135](https://github.com/googleapis/gcp-metadata/pull/135)) -- chore: always nyc report before calling codecov ([#134](https://github.com/googleapis/gcp-metadata/pull/134)) -- chore: nyc ignore build/test by default ([#133](https://github.com/googleapis/gcp-metadata/pull/133)) -- chore: Re-generated to pick up changes in the API or client library generator. ([#131](https://github.com/googleapis/gcp-metadata/pull/131)) -- fix(build): fix system key decryption ([#128](https://github.com/googleapis/gcp-metadata/pull/128)) -- chore(deps): use gaxios for http requests ([#121](https://github.com/googleapis/gcp-metadata/pull/121)) -- refactor: use execa, move post install test to system ([#127](https://github.com/googleapis/gcp-metadata/pull/127)) -- chore: add a synth.metadata -- test: add a system test ([#126](https://github.com/googleapis/gcp-metadata/pull/126)) -- chore(deps): update dependency gts to ^0.9.0 ([#123](https://github.com/googleapis/gcp-metadata/pull/123)) -- chore: update eslintignore config ([#122](https://github.com/googleapis/gcp-metadata/pull/122)) -- chore: use latest npm on Windows ([#120](https://github.com/googleapis/gcp-metadata/pull/120)) -- chore: update CircleCI config ([#119](https://github.com/googleapis/gcp-metadata/pull/119)) -- chore: include build in eslintignore ([#115](https://github.com/googleapis/gcp-metadata/pull/115)) - -## v0.9.0 - -10-26-2018 13:10 PDT - -- feat: allow custom headers ([#109](https://github.com/googleapis/gcp-metadata/pull/109)) -- chore: update issue templates ([#108](https://github.com/googleapis/gcp-metadata/pull/108)) -- chore: remove old issue template ([#106](https://github.com/googleapis/gcp-metadata/pull/106)) -- build: run tests on node11 ([#105](https://github.com/googleapis/gcp-metadata/pull/105)) -- chores(build): do not collect sponge.xml from windows builds ([#104](https://github.com/googleapis/gcp-metadata/pull/104)) -- chores(build): run codecov on continuous builds ([#102](https://github.com/googleapis/gcp-metadata/pull/102)) -- chore(deps): update dependency nock to v10 ([#103](https://github.com/googleapis/gcp-metadata/pull/103)) -- chore: update new issue template ([#101](https://github.com/googleapis/gcp-metadata/pull/101)) -- build: fix codecov uploading on Kokoro ([#97](https://github.com/googleapis/gcp-metadata/pull/97)) -- Update kokoro config ([#95](https://github.com/googleapis/gcp-metadata/pull/95)) -- Update CI config ([#93](https://github.com/googleapis/gcp-metadata/pull/93)) -- Update kokoro config ([#91](https://github.com/googleapis/gcp-metadata/pull/91)) -- Re-generate library using /synth.py ([#90](https://github.com/googleapis/gcp-metadata/pull/90)) -- test: remove appveyor config ([#89](https://github.com/googleapis/gcp-metadata/pull/89)) -- Update kokoro config ([#88](https://github.com/googleapis/gcp-metadata/pull/88)) -- Enable prefer-const in the eslint config ([#87](https://github.com/googleapis/gcp-metadata/pull/87)) -- Enable no-var in eslint ([#86](https://github.com/googleapis/gcp-metadata/pull/86)) - -### New Features - -A new option, `headers`, has been added to allow metadata queries to be sent with custom headers. - -## v0.8.0 - -**This release has breaking changes**. Please take care when upgrading to the latest version. - -#### Dropped support for Node.js 4.x and 9.x -This library is no longer tested against versions 4.x and 9.x of Node.js. Please upgrade to the latest supported LTS version! - -#### Return type of `instance()` and `project()` has changed -The `instance()` and `project()` methods are much more selective about which properties they will accept. - -The only accepted properties are `params` and `properties`. The `instance()` and `project()` methods also now directly return the data instead of a response object. - -#### Changes in how large number valued properties are handled - -Previously large number-valued properties were being silently losing precision when -returned by this library (as a number). In the cases where a number valued property -returned by the metadata service is too large to represent as a JavaScript number, we -will now return the value as a BigNumber (from the bignumber.js) library. Numbers that -do fit into the JavaScript number range will continue to be returned as numbers. -For more details see [#74](https://github.com/googleapis/gcp-metadata/pull/74). - -### Breaking Changes -- chore: drop support for node.js 4 and 9 ([#68](https://github.com/googleapis/gcp-metadata/pull/68)) -- fix: quarantine axios config ([#62](https://github.com/googleapis/gcp-metadata/pull/62)) - -### Implementation Changes -- fix: properly handle large numbers in responses ([#74](https://github.com/googleapis/gcp-metadata/pull/74)) - -### Dependencies -- chore(deps): update dependency pify to v4 ([#73](https://github.com/googleapis/gcp-metadata/pull/73)) - -### Internal / Testing Changes -- Move to the new github org ([#84](https://github.com/googleapis/gcp-metadata/pull/84)) -- Update CI config ([#83](https://github.com/googleapis/gcp-metadata/pull/83)) -- Retry npm install in CI ([#81](https://github.com/googleapis/gcp-metadata/pull/81)) -- Update CI config ([#79](https://github.com/googleapis/gcp-metadata/pull/79)) -- chore(deps): update dependency nyc to v13 ([#77](https://github.com/googleapis/gcp-metadata/pull/77)) -- add key for system tests -- increase kitchen test timeout -- add a lint npm script -- update npm scripts -- add a synth file and run it ([#75](https://github.com/googleapis/gcp-metadata/pull/75)) -- chore(deps): update dependency assert-rejects to v1 ([#72](https://github.com/googleapis/gcp-metadata/pull/72)) -- chore: ignore package-log.json ([#71](https://github.com/googleapis/gcp-metadata/pull/71)) -- chore: update renovate config ([#70](https://github.com/googleapis/gcp-metadata/pull/70)) -- test: throw on deprecation -- chore(deps): update dependency typescript to v3 ([#67](https://github.com/googleapis/gcp-metadata/pull/67)) -- chore: make it OSPO compliant ([#66](https://github.com/googleapis/gcp-metadata/pull/66)) -- chore(deps): update dependency gts to ^0.8.0 ([#65](https://github.com/googleapis/gcp-metadata/pull/65)) diff --git a/node_modules/gcp-metadata/LICENSE b/node_modules/gcp-metadata/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/node_modules/gcp-metadata/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/gcp-metadata/README.md b/node_modules/gcp-metadata/README.md deleted file mode 100644 index dfe721b6..00000000 --- a/node_modules/gcp-metadata/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# gcp-metadata -> Get the metadata from a Google Cloud Platform environment. - -[![NPM Version][npm-image]][npm-url] -[![codecov][codecov-image]][codecov-url] - -```sh -$ npm install --save gcp-metadata -``` -```js -const gcpMetadata = require('gcp-metadata'); -``` - -#### Check to see if the metadata server is available -```js -const isAvailable = await gcpMetadata.isAvailable(); -``` - -#### Access all metadata -```js -const data = await gcpMetadata.instance(); -console.log(data); // ... All metadata properties -``` - -#### Access specific properties -```js -const data = await gcpMetadata.instance('hostname'); -console.log(data); // ...Instance hostname -const projectId = await gcpMetadata.project('project-id'); -console.log(projectId); // ...Project ID of the running instance -``` - -#### Access nested properties with the relative path -```js -const data = await gcpMetadata.instance('service-accounts/default/email'); -console.log(data); // ...Email address of the Compute identity service account -``` - -#### Access specific properties with query parameters -```js -const data = await gcpMetadata.instance({ - property: 'tags', - params: { alt: 'text' } -}); -console.log(data) // ...Tags as newline-delimited list -``` - -#### Access with custom headers -```js -await gcpMetadata.instance({ - headers: { 'no-trace': '1' } -}); // ...Request is untraced -``` - -### Take care with large number valued properties - -In some cases number valued properties returned by the Metadata Service may be -too large to be representable as JavaScript numbers. In such cases we return -those values as `BigNumber` objects (from the [bignumber.js][] library). Numbers -that fit within the JavaScript number range will be returned as normal number -values. - -```js -const id = await gcpMetadata.instance('id'); -console.log(id) // ... BigNumber { s: 1, e: 18, c: [ 45200, 31799277581759 ] } -console.log(id.toString()) // ... 4520031799277581759 -``` - -[bignumber.js]: https://github.com/MikeMcl/bignumber.js -[codecov-image]: https://codecov.io/gh/googleapis/gcp-metadata/branch/master/graph/badge.svg -[codecov-url]: https://codecov.io/gh/googleapis/gcp-metadata -[npm-image]: https://img.shields.io/npm/v/gcp-metadata.svg -[npm-url]: https://www.npmjs.com/package/gcp-metadata - -### Environment variables - -* GCE_METADATA_HOST: provide an alternate host or IP to perform lookup against (useful, for example, you're connecting through a custom proxy server). - -For example: -``` -export GCE_METADATA_HOST = '169.254.169.254' -``` - -* DETECT_GCP_RETRIES: number representing number of retries that should be attempted on metadata lookup. \ No newline at end of file diff --git a/node_modules/gcp-metadata/build/src/index.d.ts b/node_modules/gcp-metadata/build/src/index.d.ts deleted file mode 100644 index b3cbf279..00000000 --- a/node_modules/gcp-metadata/build/src/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -/// -import { OutgoingHttpHeaders } from 'http'; -export declare const BASE_PATH = "/computeMetadata/v1"; -export declare const HOST_ADDRESS = "http://169.254.169.254"; -export declare const SECONDARY_HOST_ADDRESS = "http://metadata.google.internal."; -export declare const HEADER_NAME = "Metadata-Flavor"; -export declare const HEADER_VALUE = "Google"; -export declare const HEADERS: Readonly<{ - "Metadata-Flavor": string; -}>; -export interface Options { - params?: { - [index: string]: string; - }; - property?: string; - headers?: OutgoingHttpHeaders; -} -export declare function instance(options?: string | Options): Promise; -export declare function project(options?: string | Options): Promise; -export declare function isAvailable(): Promise; -/** - * reset the memoized isAvailable() lookup. - */ -export declare function resetIsAvailableCache(): void; -export declare function requestTimeout(): number; diff --git a/node_modules/gcp-metadata/build/src/index.js b/node_modules/gcp-metadata/build/src/index.js deleted file mode 100644 index 65e4d3fc..00000000 --- a/node_modules/gcp-metadata/build/src/index.js +++ /dev/null @@ -1,246 +0,0 @@ -"use strict"; -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.requestTimeout = exports.resetIsAvailableCache = exports.isAvailable = exports.project = exports.instance = exports.HEADERS = exports.HEADER_VALUE = exports.HEADER_NAME = exports.SECONDARY_HOST_ADDRESS = exports.HOST_ADDRESS = exports.BASE_PATH = void 0; -const gaxios_1 = require("gaxios"); -const jsonBigint = require('json-bigint'); // eslint-disable-line -exports.BASE_PATH = '/computeMetadata/v1'; -exports.HOST_ADDRESS = 'http://169.254.169.254'; -exports.SECONDARY_HOST_ADDRESS = 'http://metadata.google.internal.'; -exports.HEADER_NAME = 'Metadata-Flavor'; -exports.HEADER_VALUE = 'Google'; -exports.HEADERS = Object.freeze({ [exports.HEADER_NAME]: exports.HEADER_VALUE }); -/** - * Returns the base URL while taking into account the GCE_METADATA_HOST - * environment variable if it exists. - * - * @returns The base URL, e.g., http://169.254.169.254/computeMetadata/v1. - */ -function getBaseUrl(baseUrl) { - if (!baseUrl) { - baseUrl = - process.env.GCE_METADATA_IP || - process.env.GCE_METADATA_HOST || - exports.HOST_ADDRESS; - } - // If no scheme is provided default to HTTP: - if (!/^https?:\/\//.test(baseUrl)) { - baseUrl = `http://${baseUrl}`; - } - return new URL(exports.BASE_PATH, baseUrl).href; -} -// Accepts an options object passed from the user to the API. In previous -// versions of the API, it referred to a `Request` or an `Axios` request -// options object. Now it refers to an object with very limited property -// names. This is here to help ensure users don't pass invalid options when -// they upgrade from 0.4 to 0.5 to 0.8. -function validate(options) { - Object.keys(options).forEach(key => { - switch (key) { - case 'params': - case 'property': - case 'headers': - break; - case 'qs': - throw new Error("'qs' is not a valid configuration option. Please use 'params' instead."); - default: - throw new Error(`'${key}' is not a valid configuration option.`); - } - }); -} -async function metadataAccessor(type, options, noResponseRetries = 3, fastFail = false) { - options = options || {}; - if (typeof options === 'string') { - options = { property: options }; - } - let property = ''; - if (typeof options === 'object' && options.property) { - property = '/' + options.property; - } - validate(options); - try { - const requestMethod = fastFail ? fastFailMetadataRequest : gaxios_1.request; - const res = await requestMethod({ - url: `${getBaseUrl()}/${type}${property}`, - headers: Object.assign({}, exports.HEADERS, options.headers), - retryConfig: { noResponseRetries }, - params: options.params, - responseType: 'text', - timeout: requestTimeout(), - }); - // NOTE: node.js converts all incoming headers to lower case. - if (res.headers[exports.HEADER_NAME.toLowerCase()] !== exports.HEADER_VALUE) { - throw new Error(`Invalid response from metadata service: incorrect ${exports.HEADER_NAME} header.`); - } - else if (!res.data) { - throw new Error('Invalid response from the metadata service'); - } - if (typeof res.data === 'string') { - try { - return jsonBigint.parse(res.data); - } - catch (_a) { - /* ignore */ - } - } - return res.data; - } - catch (e) { - if (e.response && e.response.status !== 200) { - e.message = `Unsuccessful response status code. ${e.message}`; - } - throw e; - } -} -async function fastFailMetadataRequest(options) { - const secondaryOptions = { - ...options, - url: options.url.replace(getBaseUrl(), getBaseUrl(exports.SECONDARY_HOST_ADDRESS)), - }; - // We race a connection between DNS/IP to metadata server. There are a couple - // reasons for this: - // - // 1. the DNS is slow in some GCP environments; by checking both, we might - // detect the runtime environment signficantly faster. - // 2. we can't just check the IP, which is tarpitted and slow to respond - // on a user's local machine. - // - // Additional logic has been added to make sure that we don't create an - // unhandled rejection in scenarios where a failure happens sometime - // after a success. - // - // Note, however, if a failure happens prior to a success, a rejection should - // occur, this is for folks running locally. - // - let responded = false; - const r1 = gaxios_1.request(options) - .then(res => { - responded = true; - return res; - }) - .catch(err => { - if (responded) { - return r2; - } - else { - responded = true; - throw err; - } - }); - const r2 = gaxios_1.request(secondaryOptions) - .then(res => { - responded = true; - return res; - }) - .catch(err => { - if (responded) { - return r1; - } - else { - responded = true; - throw err; - } - }); - return Promise.race([r1, r2]); -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function instance(options) { - return metadataAccessor('instance', options); -} -exports.instance = instance; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function project(options) { - return metadataAccessor('project', options); -} -exports.project = project; -/* - * How many times should we retry detecting GCP environment. - */ -function detectGCPAvailableRetries() { - return process.env.DETECT_GCP_RETRIES - ? Number(process.env.DETECT_GCP_RETRIES) - : 0; -} -/** - * Determine if the metadata server is currently available. - */ -let cachedIsAvailableResponse; -async function isAvailable() { - try { - // If a user is instantiating several GCP libraries at the same time, - // this may result in multiple calls to isAvailable(), to detect the - // runtime environment. We use the same promise for each of these calls - // to reduce the network load. - if (cachedIsAvailableResponse === undefined) { - cachedIsAvailableResponse = metadataAccessor('instance', undefined, detectGCPAvailableRetries(), - // If the default HOST_ADDRESS has been overridden, we should not - // make an effort to try SECONDARY_HOST_ADDRESS (as we are likely in - // a non-GCP environment): - !(process.env.GCE_METADATA_IP || process.env.GCE_METADATA_HOST)); - } - await cachedIsAvailableResponse; - return true; - } - catch (err) { - if (process.env.DEBUG_AUTH) { - console.info(err); - } - if (err.type === 'request-timeout') { - // If running in a GCP environment, metadata endpoint should return - // within ms. - return false; - } - if (err.response && err.response.status === 404) { - return false; - } - else { - if (!(err.response && err.response.status === 404) && - // A warning is emitted if we see an unexpected err.code, or err.code - // is not populated: - (!err.code || - ![ - 'EHOSTDOWN', - 'EHOSTUNREACH', - 'ENETUNREACH', - 'ENOENT', - 'ENOTFOUND', - 'ECONNREFUSED', - ].includes(err.code))) { - let code = 'UNKNOWN'; - if (err.code) - code = err.code; - process.emitWarning(`received unexpected error = ${err.message} code = ${code}`, 'MetadataLookupWarning'); - } - // Failure to resolve the metadata service means that it is not available. - return false; - } - } -} -exports.isAvailable = isAvailable; -/** - * reset the memoized isAvailable() lookup. - */ -function resetIsAvailableCache() { - cachedIsAvailableResponse = undefined; -} -exports.resetIsAvailableCache = resetIsAvailableCache; -function requestTimeout() { - // In testing, we were able to reproduce behavior similar to - // https://github.com/googleapis/google-auth-library-nodejs/issues/798 - // by making many concurrent network requests. Requests do not actually fail, - // rather they take significantly longer to complete (and we hit our - // default 3000ms timeout). - // - // This logic detects a GCF environment, using the documented environment - // variables K_SERVICE and FUNCTION_NAME: - // https://cloud.google.com/functions/docs/env-var and, in a GCF environment - // eliminates timeouts (by setting the value to 0 to disable). - return process.env.K_SERVICE || process.env.FUNCTION_NAME ? 0 : 3000; -} -exports.requestTimeout = requestTimeout; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/gcp-metadata/build/src/index.js.map b/node_modules/gcp-metadata/build/src/index.js.map deleted file mode 100644 index fe858e86..00000000 --- a/node_modules/gcp-metadata/build/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,mCAA8D;AAE9D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,sBAAsB;AAEpD,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAClC,QAAA,YAAY,GAAG,wBAAwB,CAAC;AACxC,QAAA,sBAAsB,GAAG,kCAAkC,CAAC;AAE5D,QAAA,WAAW,GAAG,iBAAiB,CAAC;AAChC,QAAA,YAAY,GAAG,QAAQ,CAAC;AACxB,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,CAAC,mBAAW,CAAC,EAAE,oBAAY,EAAC,CAAC,CAAC;AAQpE;;;;;GAKG;AACH,SAAS,UAAU,CAAC,OAAgB;IAClC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO;YACL,OAAO,CAAC,GAAG,CAAC,eAAe;gBAC3B,OAAO,CAAC,GAAG,CAAC,iBAAiB;gBAC7B,oBAAY,CAAC;KAChB;IACD,4CAA4C;IAC5C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QACjC,OAAO,GAAG,UAAU,OAAO,EAAE,CAAC;KAC/B;IACD,OAAO,IAAI,GAAG,CAAC,iBAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC;AAED,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,2EAA2E;AAC3E,wCAAwC;AACxC,SAAS,QAAQ,CAAC,OAAgB;IAChC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACjC,QAAQ,GAAG,EAAE;YACX,KAAK,QAAQ,CAAC;YACd,KAAK,UAAU,CAAC;YAChB,KAAK,SAAS;gBACZ,MAAM;YACR,KA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AAgB,cAAc;IAC5B,4DAA4D;IAC5D,sEAAsE;IACtE,6EAA6E;IAC7E,oEAAoE;IACpE,2BAA2B;IAC3B,EAAE;IACF,yEAAyE;IACzE,yCAAyC;IACzC,4EAA4E;IAC5E,8DAA8D;IAC9D,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAZD,wCAYC"} \ No newline at end of file diff --git a/node_modules/gcp-metadata/package.json b/node_modules/gcp-metadata/package.json deleted file mode 100644 index 98e3adf7..00000000 --- a/node_modules/gcp-metadata/package.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "_from": "gcp-metadata@^4.1.0", - "_id": "gcp-metadata@4.2.0", - "_inBundle": false, - "_integrity": "sha512-vQZD57cQkqIA6YPGXM/zc+PIZfNRFdukWGsGZ5+LcJzesi5xp6Gn7a02wRJi4eXPyArNMIYpPET4QMxGqtlk6Q==", - "_location": "/gcp-metadata", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "gcp-metadata@^4.1.0", - "name": "gcp-metadata", - "escapedName": "gcp-metadata", - "rawSpec": "^4.1.0", - "saveSpec": null, - "fetchSpec": "^4.1.0" - }, - "_requiredBy": [ - "/google-auth-library" - ], - "_resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.0.tgz", - "_shasum": "3b424355ccdc240ee07c5791e2fd6a60a283d89a", - "_spec": "gcp-metadata@^4.1.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "Stephen Sawchuk" - }, - "bugs": { - "url": "https://github.com/googleapis/gcp-metadata/issues" - }, - "bundleDependencies": false, - "dependencies": { - "gaxios": "^3.0.0", - "json-bigint": "^1.0.0" - }, - "deprecated": false, - "description": "Get the metadata from a Google Cloud Platform environment", - "devDependencies": { - "@compodoc/compodoc": "^1.1.10", - "@microsoft/api-documenter": "^7.8.10", - "@microsoft/api-extractor": "^7.8.10", - "@types/mocha": "^8.0.0", - "@types/ncp": "^2.0.1", - "@types/nock": "^10.0.3", - "@types/node": "^12.7.2", - "@types/tmp": "0.2.0", - "@types/uuid": "^8.0.0", - "c8": "^7.0.0", - "codecov": "^3.5.0", - "gcbuild": "^1.3.4", - "gcx": "^1.0.0", - "googleapis": "^59.0.0", - "gts": "^2.0.0", - "linkinator": "^2.0.0", - "mocha": "^8.0.0", - "ncp": "^2.0.0", - "nock": "^13.0.0", - "tmp": "^0.2.0", - "typescript": "^3.8.3", - "uuid": "^8.0.0" - }, - "engines": { - "node": ">=10" - }, - "files": [ - "build/src" - ], - "homepage": "https://github.com/googleapis/gcp-metadata#readme", - "keywords": [ - "google cloud platform", - "google cloud", - "google", - "app engine", - "compute engine", - "metadata server", - "metadata" - ], - "license": "Apache-2.0", - "main": "./build/src/index.js", - "name": "gcp-metadata", - "repository": { - "type": "git", - "url": "git+https://github.com/googleapis/gcp-metadata.git" - }, - "scripts": { - "api-documenter": "api-documenter yaml --input-folder=temp", - "api-extractor": "api-extractor run --local", - "clean": "gts clean", - "compile": "tsc -p .", - "docs": "compodoc src/", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "precompile": "gts clean", - "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm install", - "prepare": "npm run compile", - "presystem-test": "npm run compile", - "pretest": "npm run compile", - "samples-test": "npm link && cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha build/system-test --timeout 600000", - "test": "c8 mocha --timeout=5000 build/test" - }, - "types": "./build/src/index.d.ts", - "version": "4.2.0" -} diff --git a/node_modules/google-auth-library/CHANGELOG.md b/node_modules/google-auth-library/CHANGELOG.md deleted file mode 100644 index e1683cf7..00000000 --- a/node_modules/google-auth-library/CHANGELOG.md +++ /dev/null @@ -1,686 +0,0 @@ -# Changelog - -[npm history][1] - -[1]: https://www.npmjs.com/package/google-auth-library-nodejs?activeTab=versions - -### [6.1.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.1.0...v6.1.1) (2020-10-06) - - -### Bug Fixes - -* **deps:** upgrade gtoken ([#1064](https://www.github.com/googleapis/google-auth-library-nodejs/issues/1064)) ([9116f24](https://www.github.com/googleapis/google-auth-library-nodejs/commit/9116f247486d6376feca505bbfa42a91d5e579e2)) - -## [6.1.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.8...v6.1.0) (2020-09-22) - - -### Features - -* default self-signed JWTs ([#1054](https://www.github.com/googleapis/google-auth-library-nodejs/issues/1054)) ([b4d139d](https://www.github.com/googleapis/google-auth-library-nodejs/commit/b4d139d9ee27f886ca8cc5478615c052700fff48)) - -### [6.0.8](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.7...v6.0.8) (2020-08-13) - - -### Bug Fixes - -* **deps:** roll back dependency google-auth-library to ^6.0.6 ([#1033](https://www.github.com/googleapis/google-auth-library-nodejs/issues/1033)) ([eb54ee9](https://www.github.com/googleapis/google-auth-library-nodejs/commit/eb54ee9369d9e5a01d164ccf7f826858d44827fd)) - -### [6.0.7](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.6...v6.0.7) (2020-08-11) - - -### Bug Fixes - -* migrate token info API to not pass token in query string ([#991](https://www.github.com/googleapis/google-auth-library-nodejs/issues/991)) ([a7e5701](https://www.github.com/googleapis/google-auth-library-nodejs/commit/a7e5701a8394d79fe93d28794467747a23cf9ff4)) - -### [6.0.6](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.5...v6.0.6) (2020-07-30) - - -### Bug Fixes - -* **types:** include scope in credentials type ([#1007](https://www.github.com/googleapis/google-auth-library-nodejs/issues/1007)) ([a2b7d23](https://www.github.com/googleapis/google-auth-library-nodejs/commit/a2b7d23caa5bf253c7c0756396f1b58216182089)) - -### [6.0.5](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.4...v6.0.5) (2020-07-13) - - -### Bug Fixes - -* **deps:** update dependency lru-cache to v6 ([#995](https://www.github.com/googleapis/google-auth-library-nodejs/issues/995)) ([3c07566](https://www.github.com/googleapis/google-auth-library-nodejs/commit/3c07566f0384611227030e9b381fc6e6707e526b)) - -### [6.0.4](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.3...v6.0.4) (2020-07-09) - - -### Bug Fixes - -* typeo in nodejs .gitattribute ([#993](https://www.github.com/googleapis/google-auth-library-nodejs/issues/993)) ([ad12ceb](https://www.github.com/googleapis/google-auth-library-nodejs/commit/ad12ceb3309b7db7394fe1fe1d5e7b2e4901141d)) - -### [6.0.3](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.2...v6.0.3) (2020-07-06) - - -### Bug Fixes - -* **deps:** update dependency puppeteer to v5 ([#986](https://www.github.com/googleapis/google-auth-library-nodejs/issues/986)) ([7cfe6f2](https://www.github.com/googleapis/google-auth-library-nodejs/commit/7cfe6f200b9c04fe4805d1b1e3a2e03a9668e551)) - -### [6.0.2](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.1...v6.0.2) (2020-06-16) - - -### Bug Fixes - -* **deps:** update dependency puppeteer to v4 ([#976](https://www.github.com/googleapis/google-auth-library-nodejs/issues/976)) ([9ddfb9b](https://www.github.com/googleapis/google-auth-library-nodejs/commit/9ddfb9befedd10d6c82cbf799c1afea9ba10d444)) -* **tsc:** audience property is not mandatory on verifyIdToken ([#972](https://www.github.com/googleapis/google-auth-library-nodejs/issues/972)) ([17a7e24](https://www.github.com/googleapis/google-auth-library-nodejs/commit/17a7e247cdb798ddf3173cf44ab762665cbce0a1)) -* **types:** add locale property to idtoken ([#974](https://www.github.com/googleapis/google-auth-library-nodejs/issues/974)) ([ebf9bed](https://www.github.com/googleapis/google-auth-library-nodejs/commit/ebf9beda30f251da6adb9ec0bf943019ea0171c5)), closes [#973](https://www.github.com/googleapis/google-auth-library-nodejs/issues/973) - -### [6.0.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v6.0.0...v6.0.1) (2020-05-21) - - -### Bug Fixes - -* **deps:** update dependency google-auth-library to v6 ([#930](https://www.github.com/googleapis/google-auth-library-nodejs/issues/930)) ([81fdabe](https://www.github.com/googleapis/google-auth-library-nodejs/commit/81fdabe6fb7f0b8c5114c0d835680a28def822e2)) -* apache license URL ([#468](https://www.github.com/googleapis/google-auth-library-nodejs/issues/468)) ([#936](https://www.github.com/googleapis/google-auth-library-nodejs/issues/936)) ([53831cf](https://www.github.com/googleapis/google-auth-library-nodejs/commit/53831cf72f6669d13692c5665fef5062dc8f6c1a)) -* **deps:** update dependency puppeteer to v3 ([#944](https://www.github.com/googleapis/google-auth-library-nodejs/issues/944)) ([4d6fba0](https://www.github.com/googleapis/google-auth-library-nodejs/commit/4d6fba034cb0e70092656e9aff1ba419fdfca880)) -* fixing tsc error caused by @types/node update ([#965](https://www.github.com/googleapis/google-auth-library-nodejs/issues/965)) ([b94edb0](https://www.github.com/googleapis/google-auth-library-nodejs/commit/b94edb0716572593e4e9cb8a9b9bbfa567f71625)) -* gcp-metadata now warns rather than throwing ([#956](https://www.github.com/googleapis/google-auth-library-nodejs/issues/956)) ([89e16c2](https://www.github.com/googleapis/google-auth-library-nodejs/commit/89e16c2401101d086a8f9d05b8f0771b5c74157c)) - -## [6.0.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.10.1...v6.0.0) (2020-03-26) - - -### ⚠ BREAKING CHANGES - -* typescript@3.7.x introduced some breaking changes in -generated code. -* require node 10 in engines field (#926) -* remove deprecated methods (#906) - -### Features - -* require node 10 in engines field ([#926](https://www.github.com/googleapis/google-auth-library-nodejs/issues/926)) ([d89c59a](https://www.github.com/googleapis/google-auth-library-nodejs/commit/d89c59a316e9ca5b8c351128ee3e2d91e9729d5c)) - - -### Bug Fixes - -* do not warn for SDK creds ([#905](https://www.github.com/googleapis/google-auth-library-nodejs/issues/905)) ([9536840](https://www.github.com/googleapis/google-auth-library-nodejs/commit/9536840f88e77f747bbbc2c1b5b4289018fc23c9)) -* use iamcredentials API to sign blobs ([#908](https://www.github.com/googleapis/google-auth-library-nodejs/issues/908)) ([7b8e4c5](https://www.github.com/googleapis/google-auth-library-nodejs/commit/7b8e4c52e31bb3d448c3ff8c05002188900eaa04)) -* **deps:** update dependency gaxios to v3 ([#917](https://www.github.com/googleapis/google-auth-library-nodejs/issues/917)) ([1f4bf61](https://www.github.com/googleapis/google-auth-library-nodejs/commit/1f4bf6128a0dcf22cfe1ec492b2192f513836cb2)) -* **deps:** update dependency gcp-metadata to v4 ([#918](https://www.github.com/googleapis/google-auth-library-nodejs/issues/918)) ([d337131](https://www.github.com/googleapis/google-auth-library-nodejs/commit/d337131d009cc1f8182f7a1f8a9034433ee3fbf7)) -* **types:** add additional fields to TokenInfo ([#907](https://www.github.com/googleapis/google-auth-library-nodejs/issues/907)) ([5b48eb8](https://www.github.com/googleapis/google-auth-library-nodejs/commit/5b48eb86c108c47d317a0eb96b47c0cae86f98cb)) - - -### Build System - -* update to latest gts and TypeScript ([#927](https://www.github.com/googleapis/google-auth-library-nodejs/issues/927)) ([e11e18c](https://www.github.com/googleapis/google-auth-library-nodejs/commit/e11e18cb33eb60a666980d061c54bb8891cdd242)) - - -### Miscellaneous Chores - -* remove deprecated methods ([#906](https://www.github.com/googleapis/google-auth-library-nodejs/issues/906)) ([f453fb7](https://www.github.com/googleapis/google-auth-library-nodejs/commit/f453fb7d8355e6dc74800b18d6f43c4e91d4acc9)) - -### [5.10.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.10.0...v5.10.1) (2020-02-25) - - -### Bug Fixes - -* if GCF environment detected, increase library timeout ([#899](https://www.github.com/googleapis/google-auth-library-nodejs/issues/899)) ([2577ff2](https://www.github.com/googleapis/google-auth-library-nodejs/commit/2577ff28bf22dfc58bd09e7365471c16f359f109)) - -## [5.10.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.9.2...v5.10.0) (2020-02-20) - - -### Features - -* support for verifying ES256 and retrieving IAP public keys ([#887](https://www.github.com/googleapis/google-auth-library-nodejs/issues/887)) ([a98e386](https://www.github.com/googleapis/google-auth-library-nodejs/commit/a98e38678dc4a5e963356378c75c658e36dccd01)) - - -### Bug Fixes - -* **docs:** correct links in README ([f6a3194](https://www.github.com/googleapis/google-auth-library-nodejs/commit/f6a3194ff6df97d4fd833ae69ec80c05eab46e7b)), closes [#891](https://www.github.com/googleapis/google-auth-library-nodejs/issues/891) - -### [5.9.2](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.9.1...v5.9.2) (2020-01-28) - - -### Bug Fixes - -* populate credentials.refresh_token if provided ([#881](https://www.github.com/googleapis/google-auth-library-nodejs/issues/881)) ([63c4637](https://www.github.com/googleapis/google-auth-library-nodejs/commit/63c4637c57e4113a7b01bf78933a8bff0356c104)) - -### [5.9.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.9.0...v5.9.1) (2020-01-16) - - -### Bug Fixes - -* ensures GCE metadata sets email field for ID tokens ([#874](https://www.github.com/googleapis/google-auth-library-nodejs/issues/874)) ([e45b73d](https://www.github.com/googleapis/google-auth-library-nodejs/commit/e45b73dbb22e1c2d8115882006a21337c7d9bd63)) - -## [5.9.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.8.0...v5.9.0) (2020-01-14) - - -### Features - -* add methods for fetching and using id tokens ([#867](https://www.github.com/googleapis/google-auth-library-nodejs/issues/867)) ([8036f1a](https://www.github.com/googleapis/google-auth-library-nodejs/commit/8036f1a51d1a103b08daf62c7ce372c9f68cd9d4)) -* export LoginTicket and TokenPayload ([#870](https://www.github.com/googleapis/google-auth-library-nodejs/issues/870)) ([539ea5e](https://www.github.com/googleapis/google-auth-library-nodejs/commit/539ea5e804386b79ecf469838fff19465aeb2ca6)) - -## [5.8.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.7.0...v5.8.0) (2020-01-06) - - -### Features - -* cache results of getEnv() ([#857](https://www.github.com/googleapis/google-auth-library-nodejs/issues/857)) ([d4545a9](https://www.github.com/googleapis/google-auth-library-nodejs/commit/d4545a9001184fac0b67e7073e463e3efd345037)) - - -### Bug Fixes - -* **deps:** update dependency jws to v4 ([#851](https://www.github.com/googleapis/google-auth-library-nodejs/issues/851)) ([71366d4](https://www.github.com/googleapis/google-auth-library-nodejs/commit/71366d43406047ce9e1d818d59a14191fb678e3a)) - -## [5.7.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.6.1...v5.7.0) (2019-12-10) - - -### Features - -* make x-goog-user-project work for additional auth clients ([#848](https://www.github.com/googleapis/google-auth-library-nodejs/issues/848)) ([46af865](https://www.github.com/googleapis/google-auth-library-nodejs/commit/46af865172103c6f28712d78b30c2291487cbe86)) - -### [5.6.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.6.0...v5.6.1) (2019-12-05) - - -### Bug Fixes - -* **deps:** pin TypeScript below 3.7.0 ([#845](https://www.github.com/googleapis/google-auth-library-nodejs/issues/845)) ([a9c6e92](https://www.github.com/googleapis/google-auth-library-nodejs/commit/a9c6e9284efe8102974c57c9824ed6275d743c7a)) -* **docs:** improve types and docs for generateCodeVerifierAsync ([#840](https://www.github.com/googleapis/google-auth-library-nodejs/issues/840)) ([04dae9c](https://www.github.com/googleapis/google-auth-library-nodejs/commit/04dae9c271f0099025188489c61fd245d482832b)) - -## [5.6.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.5.1...v5.6.0) (2019-12-02) - - -### Features - -* populate x-goog-user-project for requestAsync ([#837](https://www.github.com/googleapis/google-auth-library-nodejs/issues/837)) ([5a068fb](https://www.github.com/googleapis/google-auth-library-nodejs/commit/5a068fb8f5a3827ab70404f1d9699a97f962bdad)) -* set x-goog-user-project header, with quota_project from default credentials ([#829](https://www.github.com/googleapis/google-auth-library-nodejs/issues/829)) ([3240d16](https://www.github.com/googleapis/google-auth-library-nodejs/commit/3240d16f05171781fe6d70d64c476bceb25805a5)) - - -### Bug Fixes - -* **deps:** update dependency puppeteer to v2 ([#821](https://www.github.com/googleapis/google-auth-library-nodejs/issues/821)) ([2c04117](https://www.github.com/googleapis/google-auth-library-nodejs/commit/2c0411708761cc7debdda1af1e593d82cb4aed31)) -* **docs:** add jsdoc-region-tag plugin ([#826](https://www.github.com/googleapis/google-auth-library-nodejs/issues/826)) ([558677f](https://www.github.com/googleapis/google-auth-library-nodejs/commit/558677fd90d3451e9ac4bf6d0b98907e3313f287)) -* expand on x-goog-user-project to handle auth.getClient() ([#831](https://www.github.com/googleapis/google-auth-library-nodejs/issues/831)) ([3646b7f](https://www.github.com/googleapis/google-auth-library-nodejs/commit/3646b7f9deb296aaff602dd2168ce93f014ce840)) -* use quota_project_id field instead of quota_project ([#832](https://www.github.com/googleapis/google-auth-library-nodejs/issues/832)) ([8933966](https://www.github.com/googleapis/google-auth-library-nodejs/commit/8933966659f3b07f5454a2756fa52d92fea147d2)) - -### [5.5.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.5.0...v5.5.1) (2019-10-22) - - -### Bug Fixes - -* **deps:** update gaxios dependency ([#817](https://www.github.com/googleapis/google-auth-library-nodejs/issues/817)) ([6730698](https://www.github.com/googleapis/google-auth-library-nodejs/commit/6730698b876eb52889acfead33bc4af52a8a7ba5)) -* don't append x-goog-api-client multiple times ([#820](https://www.github.com/googleapis/google-auth-library-nodejs/issues/820)) ([a46b271](https://www.github.com/googleapis/google-auth-library-nodejs/commit/a46b271947b635377eacbdfcd22ae363ce9260a1)) - -## [5.5.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.4.1...v5.5.0) (2019-10-14) - - -### Features - -* **refresh:** add forceRefreshOnFailure flag for refreshing token on error ([#790](https://www.github.com/googleapis/google-auth-library-nodejs/issues/790)) ([54cf477](https://www.github.com/googleapis/google-auth-library-nodejs/commit/54cf4770f487fd1db48f2444c86109ca97608ed1)) - -### [5.4.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.4.0...v5.4.1) (2019-10-10) - - -### Bug Fixes - -* **deps:** updats to gcp-metadata with debug option ([#811](https://www.github.com/googleapis/google-auth-library-nodejs/issues/811)) ([744e3e8](https://www.github.com/googleapis/google-auth-library-nodejs/commit/744e3e8fea223eb4fb115ef0a4d36ad88fc6921a)) - -## [5.4.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.3.0...v5.4.0) (2019-10-08) - - -### Features - -* do not deprecate refreshAccessToken ([#804](https://www.github.com/googleapis/google-auth-library-nodejs/issues/804)) ([f05de11](https://www.github.com/googleapis/google-auth-library-nodejs/commit/f05de11)) - -## [5.3.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.2.2...v5.3.0) (2019-09-27) - - -### Features - -* if token expires soon, force refresh ([#794](https://www.github.com/googleapis/google-auth-library-nodejs/issues/794)) ([fecd4f4](https://www.github.com/googleapis/google-auth-library-nodejs/commit/fecd4f4)) - -### [5.2.2](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.2.1...v5.2.2) (2019-09-17) - - -### Bug Fixes - -* **deps:** update to gcp-metadata and address envDetect performance issues ([#787](https://www.github.com/googleapis/google-auth-library-nodejs/issues/787)) ([651b5d4](https://www.github.com/googleapis/google-auth-library-nodejs/commit/651b5d4)) - -### [5.2.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.2.0...v5.2.1) (2019-09-06) - - -### Bug Fixes - -* **deps:** nock@next has types that work with our libraries ([#783](https://www.github.com/googleapis/google-auth-library-nodejs/issues/783)) ([a253709](https://www.github.com/googleapis/google-auth-library-nodejs/commit/a253709)) -* **docs:** fix variable name in README.md ([#782](https://www.github.com/googleapis/google-auth-library-nodejs/issues/782)) ([d8c70b9](https://www.github.com/googleapis/google-auth-library-nodejs/commit/d8c70b9)) - -## [5.2.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.1.2...v5.2.0) (2019-08-09) - - -### Features - -* populate x-goog-api-client header for auth ([#772](https://www.github.com/googleapis/google-auth-library-nodejs/issues/772)) ([526dcf6](https://www.github.com/googleapis/google-auth-library-nodejs/commit/526dcf6)) - -### [5.1.2](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.1.1...v5.1.2) (2019-08-05) - - -### Bug Fixes - -* **deps:** upgrade to gtoken 4.x ([#763](https://www.github.com/googleapis/google-auth-library-nodejs/issues/763)) ([a1fcc25](https://www.github.com/googleapis/google-auth-library-nodejs/commit/a1fcc25)) - -### [5.1.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.1.0...v5.1.1) (2019-07-29) - - -### Bug Fixes - -* **deps:** update dependency google-auth-library to v5 ([#759](https://www.github.com/googleapis/google-auth-library-nodejs/issues/759)) ([e32a12b](https://www.github.com/googleapis/google-auth-library-nodejs/commit/e32a12b)) - -## [5.1.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v5.0.0...v5.1.0) (2019-07-24) - - -### Features - -* **types:** expose ProjectIdCallback interface ([#753](https://www.github.com/googleapis/google-auth-library-nodejs/issues/753)) ([5577f0d](https://www.github.com/googleapis/google-auth-library-nodejs/commit/5577f0d)) - -## [5.0.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.2.6...v5.0.0) (2019-07-23) - - -### ⚠ BREAKING CHANGES - -* getOptions() no longer accepts GoogleAuthOptions (#749) - -### Code Refactoring - -* getOptions() no longer accepts GoogleAuthOptions ([#749](https://www.github.com/googleapis/google-auth-library-nodejs/issues/749)) ([ba58e3b](https://www.github.com/googleapis/google-auth-library-nodejs/commit/ba58e3b)) - -### [4.2.6](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.2.5...v4.2.6) (2019-07-23) - - -### Bug Fixes - -* use FUNCTION_TARGET to detect GCF 10 and above ([#748](https://www.github.com/googleapis/google-auth-library-nodejs/issues/748)) ([ca17685](https://www.github.com/googleapis/google-auth-library-nodejs/commit/ca17685)) - -### [4.2.5](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.2.4...v4.2.5) (2019-06-26) - - -### Bug Fixes - -* **docs:** make anchors work in jsdoc ([#742](https://www.github.com/googleapis/google-auth-library-nodejs/issues/742)) ([7901456](https://www.github.com/googleapis/google-auth-library-nodejs/commit/7901456)) - -### [4.2.4](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.2.3...v4.2.4) (2019-06-25) - - -### Bug Fixes - -* only require fast-text-encoding when needed ([#740](https://www.github.com/googleapis/google-auth-library-nodejs/issues/740)) ([04fcd77](https://www.github.com/googleapis/google-auth-library-nodejs/commit/04fcd77)) - -### [4.2.3](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.2.2...v4.2.3) (2019-06-24) - - -### Bug Fixes - -* feature detection to check for browser ([#738](https://www.github.com/googleapis/google-auth-library-nodejs/issues/738)) ([83a5ba5](https://www.github.com/googleapis/google-auth-library-nodejs/commit/83a5ba5)) - -### [4.2.2](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.2.1...v4.2.2) (2019-06-18) - - -### Bug Fixes - -* **compute:** correctly specify scopes when fetching token ([#735](https://www.github.com/googleapis/google-auth-library-nodejs/issues/735)) ([4803e3c](https://www.github.com/googleapis/google-auth-library-nodejs/commit/4803e3c)) - -### [4.2.1](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.2.0...v4.2.1) (2019-06-14) - - -### Bug Fixes - -* **docs:** move to new client docs URL ([#733](https://www.github.com/googleapis/google-auth-library-nodejs/issues/733)) ([cfbbe2a](https://www.github.com/googleapis/google-auth-library-nodejs/commit/cfbbe2a)) - -## [4.2.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.1.0...v4.2.0) (2019-06-05) - - -### Bug Fixes - -* pad base64 strings for base64js ([#722](https://www.github.com/googleapis/google-auth-library-nodejs/issues/722)) ([81e0a23](https://www.github.com/googleapis/google-auth-library-nodejs/commit/81e0a23)) - - -### Features - -* make both crypto implementations support sign ([#727](https://www.github.com/googleapis/google-auth-library-nodejs/issues/727)) ([e445fb3](https://www.github.com/googleapis/google-auth-library-nodejs/commit/e445fb3)) - -## [4.1.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v4.0.0...v4.1.0) (2019-05-29) - - -### Bug Fixes - -* **deps:** update dependency google-auth-library to v4 ([#705](https://www.github.com/googleapis/google-auth-library-nodejs/issues/705)) ([2b13344](https://www.github.com/googleapis/google-auth-library-nodejs/commit/2b13344)) - - -### Features - -* use X-Goog-Api-Key header ([#719](https://www.github.com/googleapis/google-auth-library-nodejs/issues/719)) ([35471d0](https://www.github.com/googleapis/google-auth-library-nodejs/commit/35471d0)) - -## [4.0.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v3.1.2...v4.0.0) (2019-05-08) - - -### Bug Fixes - -* **deps:** update dependency arrify to v2 ([#684](https://www.github.com/googleapis/google-auth-library-nodejs/issues/684)) ([1757ee2](https://www.github.com/googleapis/google-auth-library-nodejs/commit/1757ee2)) -* **deps:** update dependency gaxios to v2 ([#681](https://www.github.com/googleapis/google-auth-library-nodejs/issues/681)) ([770ad2f](https://www.github.com/googleapis/google-auth-library-nodejs/commit/770ad2f)) -* **deps:** update dependency gcp-metadata to v2 ([#701](https://www.github.com/googleapis/google-auth-library-nodejs/issues/701)) ([be20528](https://www.github.com/googleapis/google-auth-library-nodejs/commit/be20528)) -* **deps:** update dependency gtoken to v3 ([#702](https://www.github.com/googleapis/google-auth-library-nodejs/issues/702)) ([2c538e5](https://www.github.com/googleapis/google-auth-library-nodejs/commit/2c538e5)) -* re-throw original exception and preserve message in compute client ([#668](https://www.github.com/googleapis/google-auth-library-nodejs/issues/668)) ([dffd1cc](https://www.github.com/googleapis/google-auth-library-nodejs/commit/dffd1cc)) -* surface original stack trace and message with errors ([#651](https://www.github.com/googleapis/google-auth-library-nodejs/issues/651)) ([8fb65eb](https://www.github.com/googleapis/google-auth-library-nodejs/commit/8fb65eb)) -* throw on missing refresh token in all cases ([#670](https://www.github.com/googleapis/google-auth-library-nodejs/issues/670)) ([0a02946](https://www.github.com/googleapis/google-auth-library-nodejs/commit/0a02946)) -* throw when adc cannot acquire a projectId ([#658](https://www.github.com/googleapis/google-auth-library-nodejs/issues/658)) ([ba48164](https://www.github.com/googleapis/google-auth-library-nodejs/commit/ba48164)) -* **deps:** update dependency semver to v6 ([#655](https://www.github.com/googleapis/google-auth-library-nodejs/issues/655)) ([ec56c88](https://www.github.com/googleapis/google-auth-library-nodejs/commit/ec56c88)) - - -### Build System - -* upgrade engines field to >=8.10.0 ([#686](https://www.github.com/googleapis/google-auth-library-nodejs/issues/686)) ([377d5c6](https://www.github.com/googleapis/google-auth-library-nodejs/commit/377d5c6)) - - -### Features - -* support scopes on compute credentials ([#642](https://www.github.com/googleapis/google-auth-library-nodejs/issues/642)) ([1811b7f](https://www.github.com/googleapis/google-auth-library-nodejs/commit/1811b7f)) - - -### BREAKING CHANGES - -* upgrade engines field to >=8.10.0 (#686) - -## v3.1.2 - -03-22-2019 15:38 PDT - -### Implementation Changes -- fix: getCredential(): load credentials with getClient() ([#648](https://github.com/google/google-auth-library-nodejs/pull/648)) - -### Internal / Testing Changes -- chore: publish to npm using wombat ([#645](https://github.com/google/google-auth-library-nodejs/pull/645)) - -## v3.1.1 - -03-18-2019 08:32 PDT - -### Bug Fixes -- fix: Avoid loading fast-text-encoding if not in browser environment ([#627](https://github.com/google/google-auth-library-nodejs/pull/627)) - -### Dependencies -- fix(deps): update dependency gcp-metadata to v1 ([#632](https://github.com/google/google-auth-library-nodejs/pull/632)) - -### Documentation -- docs: update links in contrib guide ([#630](https://github.com/google/google-auth-library-nodejs/pull/630)) - -### Internal / Testing Changes -- build: use per-repo publish token ([#641](https://github.com/google/google-auth-library-nodejs/pull/641)) -- build: Add docuploader credentials to node publish jobs ([#639](https://github.com/google/google-auth-library-nodejs/pull/639)) -- build: use node10 to run samples-test, system-test etc ([#638](https://github.com/google/google-auth-library-nodejs/pull/638)) -- build: update release configuration -- chore(deps): update dependency @types/lru-cache to v5 ([#635](https://github.com/google/google-auth-library-nodejs/pull/635)) -- chore(deps): update dependency mocha to v6 -- chore: fix lint ([#631](https://github.com/google/google-auth-library-nodejs/pull/631)) -- build: use linkinator for docs test ([#628](https://github.com/google/google-auth-library-nodejs/pull/628)) -- chore(deps): update dependency @types/tmp to ^0.0.34 ([#629](https://github.com/google/google-auth-library-nodejs/pull/629)) -- build: create docs test npm scripts ([#625](https://github.com/google/google-auth-library-nodejs/pull/625)) -- build: test using @grpc/grpc-js in CI ([#624](https://github.com/google/google-auth-library-nodejs/pull/624)) - -## v3.1.0 - -02-08-2019 08:29 PST - -### Bug fixes -- fix: use key file when fetching project id ([#618](https://github.com/googleapis/google-auth-library-nodejs/pull/618)) -- fix: Throw error if there is no refresh token despite the necessity of refreshing ([#605](https://github.com/googleapis/google-auth-library-nodejs/pull/605)) - -### New Features -- feat: allow passing constructor options to getClient ([#611](https://github.com/googleapis/google-auth-library-nodejs/pull/611)) - -### Documentation -- docs: update contributing path in README ([#621](https://github.com/googleapis/google-auth-library-nodejs/pull/621)) -- chore: move CONTRIBUTING.md to root ([#619](https://github.com/googleapis/google-auth-library-nodejs/pull/619)) -- docs: add lint/fix example to contributing guide ([#615](https://github.com/googleapis/google-auth-library-nodejs/pull/615)) -- docs: use the People API for samples ([#609](https://github.com/googleapis/google-auth-library-nodejs/pull/609)) - -### Internal / Testing Changes -- chore(deps): update dependency typescript to ~3.3.0 ([#612](https://github.com/googleapis/google-auth-library-nodejs/pull/612)) -- chore(deps): update dependency eslint-config-prettier to v4 ([#604](https://github.com/googleapis/google-auth-library-nodejs/pull/604)) -- build: ignore googleapis.com in doc link check ([#602](https://github.com/googleapis/google-auth-library-nodejs/pull/602)) -- chore(deps): update dependency karma to v4 ([#603](https://github.com/googleapis/google-auth-library-nodejs/pull/603)) - -## v3.0.1 - -01-16-2019 21:04 PST - -### Bug Fixes -- fix(deps): upgrade to the latest gaxios ([#596](https://github.com/googleapis/google-auth-library-nodejs/pull/596)) - -## v3.0.0 - -01-16-2019 10:00 PST - -Welcome to 3.0 🎉 This release has it all. New features, bug fixes, breaking changes, performance improvements - something for everyone! The biggest addition to this release is support for the browser via Webpack. - -**This release has breaking changes.** This release has a few breaking changes. These changes are unlikely to affect most clients. - -#### BREAKING: Migration from `axios` to `gaxios` -The 2.0 version of this library used the [axios](https://github.com/axios/axios) library for making HTTP requests. In the 3.0 release, this has been replaced by a *mostly* API compatible library [gaxios](https://github.com/JustinBeckwith/gaxios). The new request library natively supports proxies, and comes with a smaller dependency chain. While this is mostly an implementation detail, the `request` method was directly exposed via the `GoogleAuth.request` and `OAuth2Client.request` methods. The gaxios library aims to provide an API compatible implementation of axios, but that can never be 100% promised. If you run into bugs or differences that cause issues - please do let us know. - -#### BREAKING: `generateCodeVerifier` is now `generateCodeVerifierAsync` -The `OAuth2Client.generateCodeVerifier` method has been replaced by the `OAuth2Client.generateCodeVerifierAsync` method. It has changed from a synchronous method to an asynchronous method to support async browser crypto APIs required for Webpack support. - -#### BREAKING: `verifySignedJwtWithCerts` is now `verifySignedJwtWithCertsAsync` -The `OAuth2Client.verifySignedJwtWithCerts` method has been replaced by the `OAuth2Client.verifySignedJwtWithCertsAsync` method. It has changed from a synchronous method to an asynchronous method to support async browser crypto APIs required for Webpack support. - - -### New Features -- feat: make it webpackable ([#371](https://github.com/google/google-auth-library-nodejs/pull/371)) - -### Bug Fixes -- fix: accept lowercase env vars ([#578](https://github.com/google/google-auth-library-nodejs/pull/578)) - -### Dependencies -- chore(deps): update gtoken ([#592](https://github.com/google/google-auth-library-nodejs/pull/592)) -- fix(deps): upgrade to gcp-metadata v0.9.3 ([#586](https://github.com/google/google-auth-library-nodejs/pull/586)) - -### Documentation -- docs: update bug report link ([#585](https://github.com/google/google-auth-library-nodejs/pull/585)) -- docs: clarify access and refresh token docs ([#577](https://github.com/google/google-auth-library-nodejs/pull/577)) - -### Internal / Testing Changes -- refactor(deps): use `gaxios` for HTTP requests instead of `axios` ([#593](https://github.com/google/google-auth-library-nodejs/pull/593)) -- fix: some browser fixes ([#590](https://github.com/google/google-auth-library-nodejs/pull/590)) -- chore(deps): update dependency ts-loader to v5 ([#588](https://github.com/google/google-auth-library-nodejs/pull/588)) -- chore(deps): update dependency karma to v3 ([#587](https://github.com/google/google-auth-library-nodejs/pull/587)) -- build: check broken links in generated docs ([#579](https://github.com/google/google-auth-library-nodejs/pull/579)) -- chore(deps): drop unused dep on typedoc ([#583](https://github.com/google/google-auth-library-nodejs/pull/583)) -- build: add browser test running on Kokoro ([#584](https://github.com/google/google-auth-library-nodejs/pull/584)) -- test: improve samples and add tests ([#576](https://github.com/google/google-auth-library-nodejs/pull/576)) - -## v2.0.2 - -12-16-2018 10:48 PST - -### Fixes -- fix(types): export GCPEnv type ([#569](https://github.com/google/google-auth-library-nodejs/pull/569)) -- fix: use post for token revocation ([#524](https://github.com/google/google-auth-library-nodejs/pull/524)) - -### Dependencies -- fix(deps): update dependency lru-cache to v5 ([#541](https://github.com/google/google-auth-library-nodejs/pull/541)) - -### Documentation -- docs: add ref docs again ([#553](https://github.com/google/google-auth-library-nodejs/pull/553)) -- docs: clean up the readme ([#554](https://github.com/google/google-auth-library-nodejs/pull/554)) - -### Internal / Testing Changes -- chore(deps): update dependency @types/sinon to v7 ([#568](https://github.com/google/google-auth-library-nodejs/pull/568)) -- refactor: use execa for install tests, run eslint on samples ([#559](https://github.com/google/google-auth-library-nodejs/pull/559)) -- chore(build): inject yoshi automation key ([#566](https://github.com/google/google-auth-library-nodejs/pull/566)) -- chore: update nyc and eslint configs ([#565](https://github.com/google/google-auth-library-nodejs/pull/565)) -- chore: fix publish.sh permission +x ([#563](https://github.com/google/google-auth-library-nodejs/pull/563)) -- fix(build): fix Kokoro release script ([#562](https://github.com/google/google-auth-library-nodejs/pull/562)) -- build: add Kokoro configs for autorelease ([#561](https://github.com/google/google-auth-library-nodejs/pull/561)) -- chore: always nyc report before calling codecov ([#557](https://github.com/google/google-auth-library-nodejs/pull/557)) -- chore: nyc ignore build/test by default ([#556](https://github.com/google/google-auth-library-nodejs/pull/556)) -- chore(build): update the prettier and renovate config ([#552](https://github.com/google/google-auth-library-nodejs/pull/552)) -- chore: update license file ([#551](https://github.com/google/google-auth-library-nodejs/pull/551)) -- fix(build): fix system key decryption ([#547](https://github.com/google/google-auth-library-nodejs/pull/547)) -- chore(deps): update dependency typescript to ~3.2.0 ([#546](https://github.com/google/google-auth-library-nodejs/pull/546)) -- chore(deps): unpin sinon ([#544](https://github.com/google/google-auth-library-nodejs/pull/544)) -- refactor: drop non-required modules ([#542](https://github.com/google/google-auth-library-nodejs/pull/542)) -- chore: add synth.metadata ([#537](https://github.com/google/google-auth-library-nodejs/pull/537)) -- fix: Pin @types/sinon to last compatible version ([#538](https://github.com/google/google-auth-library-nodejs/pull/538)) -- chore(deps): update dependency gts to ^0.9.0 ([#531](https://github.com/google/google-auth-library-nodejs/pull/531)) -- chore: update eslintignore config ([#530](https://github.com/google/google-auth-library-nodejs/pull/530)) -- chore: drop contributors from multiple places ([#528](https://github.com/google/google-auth-library-nodejs/pull/528)) -- chore: use latest npm on Windows ([#527](https://github.com/google/google-auth-library-nodejs/pull/527)) -- chore: update CircleCI config ([#523](https://github.com/google/google-auth-library-nodejs/pull/523)) -- chore: include build in eslintignore ([#516](https://github.com/google/google-auth-library-nodejs/pull/516)) - -## v2.0.1 - -### Implementation Changes -- fix: verifyIdToken will never return null ([#488](https://github.com/google/google-auth-library-nodejs/pull/488)) -- Update the url to application default credentials ([#470](https://github.com/google/google-auth-library-nodejs/pull/470)) -- Update omitted parameter 'hd' ([#467](https://github.com/google/google-auth-library-nodejs/pull/467)) - -### Dependencies -- chore(deps): update dependency nock to v10 ([#501](https://github.com/google/google-auth-library-nodejs/pull/501)) -- chore(deps): update dependency sinon to v7 ([#502](https://github.com/google/google-auth-library-nodejs/pull/502)) -- chore(deps): update dependency typescript to v3.1.3 ([#503](https://github.com/google/google-auth-library-nodejs/pull/503)) -- chore(deps): update dependency gh-pages to v2 ([#499](https://github.com/google/google-auth-library-nodejs/pull/499)) -- chore(deps): update dependency typedoc to ^0.13.0 ([#497](https://github.com/google/google-auth-library-nodejs/pull/497)) - -### Documentation -- docs: Remove code format from Application Default Credentials ([#483](https://github.com/google/google-auth-library-nodejs/pull/483)) -- docs: replace google/ with googleapis/ in URIs ([#472](https://github.com/google/google-auth-library-nodejs/pull/472)) -- Fix typo in readme ([#469](https://github.com/google/google-auth-library-nodejs/pull/469)) -- Update samples and docs for 2.0 ([#459](https://github.com/google/google-auth-library-nodejs/pull/459)) - -### Internal / Testing Changes -- chore: update issue templates ([#509](https://github.com/google/google-auth-library-nodejs/pull/509)) -- chore: remove old issue template ([#507](https://github.com/google/google-auth-library-nodejs/pull/507)) -- build: run tests on node11 ([#506](https://github.com/google/google-auth-library-nodejs/pull/506)) -- chore(build): drop hard rejection and update gts in the kitchen test ([#504](https://github.com/google/google-auth-library-nodejs/pull/504)) -- chores(build): do not collect sponge.xml from windows builds ([#500](https://github.com/google/google-auth-library-nodejs/pull/500)) -- chores(build): run codecov on continuous builds ([#495](https://github.com/google/google-auth-library-nodejs/pull/495)) -- chore: update new issue template ([#494](https://github.com/google/google-auth-library-nodejs/pull/494)) -- build: fix codecov uploading on Kokoro ([#490](https://github.com/google/google-auth-library-nodejs/pull/490)) -- test: move kitchen sink tests to system-test ([#489](https://github.com/google/google-auth-library-nodejs/pull/489)) -- Update kokoro config ([#482](https://github.com/google/google-auth-library-nodejs/pull/482)) -- fix: export additional typescript types ([#479](https://github.com/google/google-auth-library-nodejs/pull/479)) -- Don't publish sourcemaps ([#478](https://github.com/google/google-auth-library-nodejs/pull/478)) -- test: remove appveyor config ([#477](https://github.com/google/google-auth-library-nodejs/pull/477)) -- Enable prefer-const in the eslint config ([#473](https://github.com/google/google-auth-library-nodejs/pull/473)) -- Enable no-var in eslint ([#471](https://github.com/google/google-auth-library-nodejs/pull/471)) -- Update CI config ([#468](https://github.com/google/google-auth-library-nodejs/pull/468)) -- Retry npm install in CI ([#465](https://github.com/google/google-auth-library-nodejs/pull/465)) -- Update Kokoro config ([#462](https://github.com/google/google-auth-library-nodejs/pull/462)) - -## v2.0.0 - -Well hello 2.0 🎉 **This release has multiple breaking changes**. It also has a lot of bug fixes. - -### Breaking Changes - -#### Support for node.js 4.x and 9.x has been dropped -These versions of node.js are no longer supported. - -#### The `getRequestMetadata` method has been deprecated -The `getRequestMetadata` method has been deprecated on the `IAM`, `OAuth2`, `JWT`, and `JWTAccess` classes. The `getRequestHeaders` method should be used instead. The methods have a subtle difference: the `getRequestMetadata` method returns an object with a headers property, which contains the authorization header. The `getRequestHeaders` method simply returns the headers. - -##### Old code -```js -const client = await auth.getClient(); -const res = await client.getRequestMetadata(); -const headers = res.headers; -``` - -##### New code -```js -const client = await auth.getClient(); -const headers = await client.getRequestHeaders(); -``` - -#### The `createScopedRequired` method has been deprecated -The `createScopedRequired` method has been deprecated on multiple classes. The `createScopedRequired` and `createScoped` methods on the `JWT` class were largely in place to help inform clients when scopes were required in an application default credential scenario. Instead of checking if scopes are required after creating the client, instead scopes should just be passed either into the `GoogleAuth.getClient` method, or directly into the `JWT` constructor. - -##### Old code -```js -auth.getApplicationDefault(function(err, authClient) { - if (err) { - return callback(err); - } - if (authClient.createScopedRequired && authClient.createScopedRequired()) { - authClient = authClient.createScoped([ - 'https://www.googleapis.com/auth/cloud-platform' - ]); - } - callback(null, authClient); -}); -``` - -##### New code -```js -const client = await auth.getClient({ - scopes: ['https://www.googleapis.com/auth/cloud-platform'] -}); -``` - -#### Deprecate `refreshAccessToken` - -_Note: `refreshAccessToken` is no longer deprecated._ - -`getAccessToken`, `getRequestMetadata`, and `request` methods will all refresh the token if needed automatically. - -You should not need to invoke `refreshAccessToken` directly except in [certain edge-cases](https://github.com/googleapis/google-auth-library-nodejs/issues/575). - -### Features -- Set private_key_id in JWT access token header like other google auth libraries. (#450) - -### Bug Fixes -- fix: support HTTPS proxies (#405) -- fix: export missing interfaces (#437) -- fix: Use new auth URIs (#434) -- docs: Fix broken link (#423) -- fix: surface file read streams (#413) -- fix: prevent unhandled rejections by avoid .catch (#404) -- fix: use gcp-metadata for compute credentials (#409) -- Add Code of Conduct -- fix: Warn when using user credentials from the Cloud SDK (#399) -- fix: use `Buffer.from` instead of `new Buffer` (#400) -- fix: Fix link format in README.md (#385) - -### Breaking changes -- chore: deprecate getRequestMetadata (#414) -- fix: deprecate the `createScopedRequired` methods (#410) -- fix: drop support for node.js 4.x and 9.x (#417) -- fix: deprecate the `refreshAccessToken` methods (#411) -- fix: deprecate the `getDefaultProjectId` method (#402) -- fix: drop support for node.js 4 (#401) - -### Build / Test changes -- Run synth to make build tools consistent (#455) -- Add a package.json for samples and cleanup README (#454) -- chore(deps): update dependency typedoc to ^0.12.0 (#453) -- chore: move examples => samples + synth (#448) -- chore(deps): update dependency nyc to v13 (#452) -- chore(deps): update dependency pify to v4 (#447) -- chore(deps): update dependency assert-rejects to v1 (#446) -- chore: ignore package-lock.json (#445) -- chore: update renovate config (#442) -- chore(deps): lock file maintenance (#443) -- chore: remove greenkeeper badge (#440) -- test: throw on deprecation -- chore: add intelli-espower-loader for running tests (#430) -- chore(deps): update dependency typescript to v3 (#432) -- chore(deps): lock file maintenance (#431) -- test: use strictEqual in tests (#425) -- chore(deps): lock file maintenance (#428) -- chore: Configure Renovate (#424) -- chore: Update gts to the latest version 🚀 (#422) -- chore: update gcp-metadata for isAvailable fix (#420) -- refactor: use assert.reject in the tests (#415) -- refactor: cleanup types for certificates (#412) -- test: run tests with hard-rejection (#397) -- cleanup: straighten nested try-catch (#394) -- test: getDefaultProjectId should prefer config (#388) -- chore(package): Update gts to the latest version 🚀 (#387) -- chore(package): update sinon to version 6.0.0 (#386) - -## Upgrading to 1.x -The `1.x` release includes a variety of bug fixes, new features, and breaking changes. Please take care, and see [the release notes](https://github.com/googleapis/google-auth-library-nodejs/releases/tag/v1.0.0) for a list of breaking changes, and the upgrade guide. diff --git a/node_modules/google-auth-library/LICENSE b/node_modules/google-auth-library/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/node_modules/google-auth-library/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/google-auth-library/README.md b/node_modules/google-auth-library/README.md deleted file mode 100644 index f29c488a..00000000 --- a/node_modules/google-auth-library/README.md +++ /dev/null @@ -1,445 +0,0 @@ -Google Inc. logo - -# Google Auth Library - -[![npm version][npmimg]][npm] -[![codecov][codecov-image]][codecov-url] -[![Dependencies][david-dm-img]][david-dm] -[![Known Vulnerabilities][snyk-image]][snyk-url] - -This is Google's officially supported [node.js][node] client library for using OAuth 2.0 authorization and authentication with Google APIs. - -## Installation -This library is distributed on `npm`. To add it as a dependency, run the following command: - -``` sh -$ npm install google-auth-library -``` - -## Ways to authenticate -This library provides a variety of ways to authenticate to your Google services. -- [Application Default Credentials](#choosing-the-correct-credential-type-automatically) - Use Application Default Credentials when you use a single identity for all users in your application. Especially useful for applications running on Google Cloud. -- [OAuth 2](#oauth2) - Use OAuth2 when you need to perform actions on behalf of the end user. -- [JSON Web Tokens](#json-web-tokens) - Use JWT when you are using a single identity for all users. Especially useful for server->server or server->API communication. -- [Google Compute](#compute) - Directly use a service account on Google Cloud Platform. Useful for server->server or server->API communication. - -## Application Default Credentials -This library provides an implementation of [Application Default Credentials][] for Node.js. The [Application Default Credentials][] provide a simple way to get authorization credentials for use in calling Google APIs. - -They are best suited for cases when the call needs to have the same identity and authorization level for the application independent of the user. This is the recommended approach to authorize calls to Cloud APIs, particularly when you're building an application that uses Google Cloud Platform. - -#### Download your Service Account Credentials JSON file - -To use Application Default Credentials, You first need to download a set of JSON credentials for your project. Go to **APIs & Auth** > **Credentials** in the [Google Developers Console][devconsole] and select **Service account** from the **Add credentials** dropdown. - -> This file is your *only copy* of these credentials. It should never be -> committed with your source code, and should be stored securely. - -Once downloaded, store the path to this file in the `GOOGLE_APPLICATION_CREDENTIALS` environment variable. - -#### Enable the API you want to use - -Before making your API call, you must be sure the API you're calling has been enabled. Go to **APIs & Auth** > **APIs** in the [Google Developers Console][devconsole] and enable the APIs you'd like to call. For the example below, you must enable the `DNS API`. - - -#### Choosing the correct credential type automatically - -Rather than manually creating an OAuth2 client, JWT client, or Compute client, the auth library can create the correct credential type for you, depending upon the environment your code is running under. - -For example, a JWT auth client will be created when your code is running on your local developer machine, and a Compute client will be created when the same code is running on Google Cloud Platform. If you need a specific set of scopes, you can pass those in the form of a string or an array to the `GoogleAuth` constructor. - -The code below shows how to retrieve a default credential type, depending upon the runtime environment. - -```js -const {GoogleAuth} = require('google-auth-library'); - -/** - * Instead of specifying the type of client you'd like to use (JWT, OAuth2, etc) - * this library will automatically choose the right client based on the environment. - */ -async function main() { - const auth = new GoogleAuth({ - scopes: 'https://www.googleapis.com/auth/cloud-platform' - }); - const client = await auth.getClient(); - const projectId = await auth.getProjectId(); - const url = `https://dns.googleapis.com/dns/v1/projects/${projectId}`; - const res = await client.request({ url }); - console.log(res.data); -} - -main().catch(console.error); -``` - -## OAuth2 - -This library comes with an [OAuth2][oauth] client that allows you to retrieve an access token and refreshes the token and retry the request seamlessly if you also provide an `expiry_date` and the token is expired. The basics of Google's OAuth2 implementation is explained on [Google Authorization and Authentication documentation][authdocs]. - -In the following examples, you may need a `CLIENT_ID`, `CLIENT_SECRET` and `REDIRECT_URL`. You can find these pieces of information by going to the [Developer Console][devconsole], clicking your project > APIs & auth > credentials. - -For more information about OAuth2 and how it works, [see here][oauth]. - -#### A complete OAuth2 example - -Let's take a look at a complete example. - -``` js -const {OAuth2Client} = require('google-auth-library'); -const http = require('http'); -const url = require('url'); -const open = require('open'); -const destroyer = require('server-destroy'); - -// Download your OAuth2 configuration from the Google -const keys = require('./oauth2.keys.json'); - -/** - * Start by acquiring a pre-authenticated oAuth2 client. - */ -async function main() { - const oAuth2Client = await getAuthenticatedClient(); - // Make a simple request to the People API using our pre-authenticated client. The `request()` method - // takes an GaxiosOptions object. Visit https://github.com/JustinBeckwith/gaxios. - const url = 'https://people.googleapis.com/v1/people/me?personFields=names'; - const res = await oAuth2Client.request({url}); - console.log(res.data); - - // After acquiring an access_token, you may want to check on the audience, expiration, - // or original scopes requested. You can do that with the `getTokenInfo` method. - const tokenInfo = await oAuth2Client.getTokenInfo( - oAuth2Client.credentials.access_token - ); - console.log(tokenInfo); -} - -/** - * Create a new OAuth2Client, and go through the OAuth2 content - * workflow. Return the full client to the callback. - */ -function getAuthenticatedClient() { - return new Promise((resolve, reject) => { - // create an oAuth client to authorize the API call. Secrets are kept in a `keys.json` file, - // which should be downloaded from the Google Developers Console. - const oAuth2Client = new OAuth2Client( - keys.web.client_id, - keys.web.client_secret, - keys.web.redirect_uris[0] - ); - - // Generate the url that will be used for the consent dialog. - const authorizeUrl = oAuth2Client.generateAuthUrl({ - access_type: 'offline', - scope: 'https://www.googleapis.com/auth/userinfo.profile', - }); - - // Open an http server to accept the oauth callback. In this simple example, the - // only request to our webserver is to /oauth2callback?code= - const server = http - .createServer(async (req, res) => { - try { - if (req.url.indexOf('/oauth2callback') > -1) { - // acquire the code from the querystring, and close the web server. - const qs = new url.URL(req.url, 'http://localhost:3000') - .searchParams; - const code = qs.get('code'); - console.log(`Code is ${code}`); - res.end('Authentication successful! Please return to the console.'); - server.destroy(); - - // Now that we have the code, use that to acquire tokens. - const r = await oAuth2Client.getToken(code); - // Make sure to set the credentials on the OAuth2 client. - oAuth2Client.setCredentials(r.tokens); - console.info('Tokens acquired.'); - resolve(oAuth2Client); - } - } catch (e) { - reject(e); - } - }) - .listen(3000, () => { - // open the browser to the authorize url to start the workflow - open(authorizeUrl, {wait: false}).then(cp => cp.unref()); - }); - destroyer(server); - }); -} - -main().catch(console.error); -``` - -#### Handling token events - -This library will automatically obtain an `access_token`, and automatically refresh the `access_token` if a `refresh_token` is present. The `refresh_token` is only returned on the [first authorization](https://github.com/googleapis/google-api-nodejs-client/issues/750#issuecomment-304521450), so if you want to make sure you store it safely. An easy way to make sure you always store the most recent tokens is to use the `tokens` event: - -```js -const client = await auth.getClient(); - -client.on('tokens', (tokens) => { - if (tokens.refresh_token) { - // store the refresh_token in my database! - console.log(tokens.refresh_token); - } - console.log(tokens.access_token); -}); - -const url = `https://dns.googleapis.com/dns/v1/projects/${projectId}`; -const res = await client.request({ url }); -// The `tokens` event would now be raised if this was the first request -``` - -#### Retrieve access token -With the code returned, you can ask for an access token as shown below: - -``` js -const tokens = await oauth2Client.getToken(code); -// Now tokens contains an access_token and an optional refresh_token. Save them. -oauth2Client.setCredentials(tokens); -``` - -#### Obtaining a new Refresh Token -If you need to obtain a new `refresh_token`, ensure the call to `generateAuthUrl` sets the `access_type` to `offline`. The refresh token will only be returned for the first authorization by the user. To force consent, set the `prompt` property to `consent`: - -```js -// Generate the url that will be used for the consent dialog. -const authorizeUrl = oAuth2Client.generateAuthUrl({ - // To get a refresh token, you MUST set access_type to `offline`. - access_type: 'offline', - // set the appropriate scopes - scope: 'https://www.googleapis.com/auth/userinfo.profile', - // A refresh token is only returned the first time the user - // consents to providing access. For illustration purposes, - // setting the prompt to 'consent' will force this consent - // every time, forcing a refresh_token to be returned. - prompt: 'consent' -}); -``` - -#### Checking `access_token` information -After obtaining and storing an `access_token`, at a later time you may want to go check the expiration date, -original scopes, or audience for the token. To get the token info, you can use the `getTokenInfo` method: - -```js -// after acquiring an oAuth2Client... -const tokenInfo = await oAuth2Client.getTokenInfo('my-access-token'); - -// take a look at the scopes originally provisioned for the access token -console.log(tokenInfo.scopes); -``` - -This method will throw if the token is invalid. - -#### OAuth2 with Installed Apps (Electron) -If you're authenticating with OAuth2 from an installed application (like Electron), you may not want to embed your `client_secret` inside of the application sources. To work around this restriction, you can choose the `iOS` application type when creating your OAuth2 credentials in the [Google Developers console][devconsole]: - -![application type][apptype] - -If using the `iOS` type, when creating the OAuth2 client you won't need to pass a `client_secret` into the constructor: -```js -const oAuth2Client = new OAuth2Client({ - clientId: , - redirectUri: -}); -``` - -## JSON Web Tokens -The Google Developers Console provides a `.json` file that you can use to configure a JWT auth client and authenticate your requests, for example when using a service account. - -``` js -const {JWT} = require('google-auth-library'); -const keys = require('./jwt.keys.json'); - -async function main() { - const client = new JWT({ - email: keys.client_email, - key: keys.private_key, - scopes: ['https://www.googleapis.com/auth/cloud-platform'], - }); - const url = `https://dns.googleapis.com/dns/v1/projects/${keys.project_id}`; - const res = await client.request({url}); - console.log(res.data); -} - -main().catch(console.error); -``` - -The parameters for the JWT auth client including how to use it with a `.pem` file are explained in [samples/jwt.js](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/jwt.js). - -#### Loading credentials from environment variables -Instead of loading credentials from a key file, you can also provide them using an environment variable and the `GoogleAuth.fromJSON()` method. This is particularly convenient for systems that deploy directly from source control (Heroku, App Engine, etc). - -Start by exporting your credentials: - -``` -$ export CREDS='{ - "type": "service_account", - "project_id": "your-project-id", - "private_key_id": "your-private-key-id", - "private_key": "your-private-key", - "client_email": "your-client-email", - "client_id": "your-client-id", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://accounts.google.com/o/oauth2/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "your-cert-url" -}' -``` -Now you can create a new client from the credentials: - -```js -const {auth} = require('google-auth-library'); - -// load the environment variable with our keys -const keysEnvVar = process.env['CREDS']; -if (!keysEnvVar) { - throw new Error('The $CREDS environment variable was not found!'); -} -const keys = JSON.parse(keysEnvVar); - -async function main() { - // load the JWT or UserRefreshClient from the keys - const client = auth.fromJSON(keys); - client.scopes = ['https://www.googleapis.com/auth/cloud-platform']; - const url = `https://dns.googleapis.com/dns/v1/projects/${keys.project_id}`; - const res = await client.request({url}); - console.log(res.data); -} - -main().catch(console.error); -``` - -#### Using a Proxy -You can set the `HTTPS_PROXY` or `https_proxy` environment variables to proxy HTTPS requests. When `HTTPS_PROXY` or `https_proxy` are set, they will be used to proxy SSL requests that do not have an explicit proxy configuration option present. - -## Compute -If your application is running on Google Cloud Platform, you can authenticate using the default service account or by specifying a specific service account. - -**Note**: In most cases, you will want to use [Application Default Credentials](#choosing-the-correct-credential-type-automatically). Direct use of the `Compute` class is for very specific scenarios. - -``` js -const {auth, Compute} = require('google-auth-library'); - -async function main() { - const client = new Compute({ - // Specifying the service account email is optional. - serviceAccountEmail: 'my-service-account@example.com' - }); - const projectId = await auth.getProjectId(); - const url = `https://dns.googleapis.com/dns/v1/projects/${projectId}`; - const res = await client.request({url}); - console.log(res.data); -} - -main().catch(console.error); -``` - -## Working with ID Tokens -### Fetching ID Tokens -If your application is running on Cloud Run or Cloud Functions, or using Cloud Identity-Aware -Proxy (IAP), you will need to fetch an ID token to access your application. For -this, use the method `getIdTokenClient` on the `GoogleAuth` client. - -For invoking Cloud Run services, your service account will need the -[`Cloud Run Invoker`](https://cloud.google.com/run/docs/authenticating/service-to-service) -IAM permission. - -For invoking Cloud Functions, your service account will need the -[`Function Invoker`](https://cloud.google.com/functions/docs/securing/authenticating#function-to-function) -IAM permission. - -``` js -// Make a request to a protected Cloud Run service. -const {GoogleAuth} = require('google-auth-library'); - -async function main() { - const url = 'https://cloud-run-1234-uc.a.run.app'; - const auth = new GoogleAuth(); - const client = await auth.getIdTokenClient(url); - const res = await client.request({url}); - console.log(res.data); -} - -main().catch(console.error); -``` - -A complete example can be found in [`samples/idtokens-serverless.js`](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/idtokens-serverless.js). - -For invoking Cloud Identity-Aware Proxy, you will need to pass the Client ID -used when you set up your protected resource as the target audience. - -``` js -// Make a request to a protected Cloud Identity-Aware Proxy (IAP) resource -const {GoogleAuth} = require('google-auth-library'); - -async function main() - const targetAudience = 'iap-client-id'; - const url = 'https://iap-url.com'; - const auth = new GoogleAuth(); - const client = await auth.getIdTokenClient(targetAudience); - const res = await client.request({url}); - console.log(res.data); -} - -main().catch(console.error); -``` - -A complete example can be found in [`samples/idtokens-iap.js`](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/idtokens-iap.js). - -### Verifying ID Tokens - -If you've [secured your IAP app with signed headers](https://cloud.google.com/iap/docs/signed-headers-howto), -you can use this library to verify the IAP header: - -```js -const {OAuth2Client} = require('google-auth-library'); -// Expected audience for App Engine. -const expectedAudience = `/projects/your-project-number/apps/your-project-id`; -// IAP issuer -const issuers = ['https://cloud.google.com/iap']; -// Verify the token. OAuth2Client throws an Error if verification fails -const oAuth2Client = new OAuth2Client(); -const response = await oAuth2Client.getIapCerts(); -const ticket = await oAuth2Client.verifySignedJwtWithCertsAsync( - idToken, - response.pubkeys, - expectedAudience, - issuers -); - -// Print out the info contained in the IAP ID token -console.log(ticket) -``` - -A complete example can be found in [`samples/verifyIdToken-iap.js`](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/verifyIdToken-iap.js). - -## Questions/problems? - -* Ask your development related questions on [Stack Overflow][stackoverflow]. -* If you've found an bug/issue, please [file it on GitHub][bugs]. - -## Contributing - -See [CONTRIBUTING][contributing]. - -## License - -This library is licensed under Apache 2.0. Full license text is available in [LICENSE][copying]. - -[Application Default Credentials]: https://cloud.google.com/docs/authentication/getting-started -[apptype]: https://user-images.githubusercontent.com/534619/36553844-3f9a863c-17b2-11e8-904a-29f6cd5f807a.png -[authdocs]: https://developers.google.com/accounts/docs/OAuth2Login -[bugs]: https://github.com/googleapis/google-auth-library-nodejs/issues -[codecov-image]: https://codecov.io/gh/googleapis/google-auth-library-nodejs/branch/master/graph/badge.svg -[codecov-url]: https://codecov.io/gh/googleapis/google-auth-library-nodejs -[contributing]: https://github.com/googleapis/google-auth-library-nodejs/blob/master/CONTRIBUTING.md -[copying]: https://github.com/googleapis/google-auth-library-nodejs/tree/master/LICENSE -[david-dm-img]: https://david-dm.org/googleapis/google-auth-library-nodejs/status.svg -[david-dm]: https://david-dm.org/googleapis/google-auth-library-nodejs -[node]: http://nodejs.org/ -[npmimg]: https://img.shields.io/npm/v/google-auth-library.svg -[npm]: https://www.npmjs.org/package/google-auth-library -[oauth]: https://developers.google.com/identity/protocols/OAuth2 -[snyk-image]: https://snyk.io/test/github/googleapis/google-auth-library-nodejs/badge.svg -[snyk-url]: https://snyk.io/test/github/googleapis/google-auth-library-nodejs -[stackoverflow]: http://stackoverflow.com/questions/tagged/google-auth-library-nodejs -[devconsole]: https://console.cloud.google.com/ diff --git a/node_modules/google-auth-library/build/src/auth/authclient.d.ts b/node_modules/google-auth-library/build/src/auth/authclient.d.ts deleted file mode 100644 index 8333fb8f..00000000 --- a/node_modules/google-auth-library/build/src/auth/authclient.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// -import { EventEmitter } from 'events'; -import { GaxiosOptions, GaxiosPromise } from 'gaxios'; -import { DefaultTransporter } from '../transporters'; -import { Credentials } from './credentials'; -import { Headers } from './oauth2client'; -export declare interface AuthClient { - on(event: 'tokens', listener: (tokens: Credentials) => void): this; -} -export declare abstract class AuthClient extends EventEmitter { - protected quotaProjectId?: string; - transporter: DefaultTransporter; - credentials: Credentials; - /** - * Provides an alternative Gaxios request implementation with auth credentials - */ - abstract request(opts: GaxiosOptions): GaxiosPromise; - /** - * Sets the auth credentials. - */ - setCredentials(credentials: Credentials): void; - /** - * Append additional headers, e.g., x-goog-user-project, shared across the - * classes inheriting AuthClient. This method should be used by any method - * that overrides getRequestMetadataAsync(), which is a shared helper for - * setting request information in both gRPC and HTTP API calls. - * - * @param headers objedcdt to append additional headers to. - */ - protected addSharedMetadataHeaders(headers: Headers): Headers; -} diff --git a/node_modules/google-auth-library/build/src/auth/authclient.js b/node_modules/google-auth-library/build/src/auth/authclient.js deleted file mode 100644 index 1a08f2c6..00000000 --- a/node_modules/google-auth-library/build/src/auth/authclient.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -// Copyright 2012 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthClient = void 0; -const events_1 = require("events"); -const transporters_1 = require("../transporters"); -class AuthClient extends events_1.EventEmitter { - constructor() { - super(...arguments); - this.transporter = new transporters_1.DefaultTransporter(); - this.credentials = {}; - } - /** - * Sets the auth credentials. - */ - setCredentials(credentials) { - this.credentials = credentials; - } - /** - * Append additional headers, e.g., x-goog-user-project, shared across the - * classes inheriting AuthClient. This method should be used by any method - * that overrides getRequestMetadataAsync(), which is a shared helper for - * setting request information in both gRPC and HTTP API calls. - * - * @param headers objedcdt to append additional headers to. - */ - addSharedMetadataHeaders(headers) { - // quota_project_id, stored in application_default_credentials.json, is set in - // the x-goog-user-project header, to indicate an alternate account for - // billing and quota: - if (!headers['x-goog-user-project'] && // don't override a value the user sets. - this.quotaProjectId) { - headers['x-goog-user-project'] = this.quotaProjectId; - } - return headers; - } -} -exports.AuthClient = AuthClient; -//# sourceMappingURL=authclient.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/computeclient.d.ts b/node_modules/google-auth-library/build/src/auth/computeclient.d.ts deleted file mode 100644 index c3353ec3..00000000 --- a/node_modules/google-auth-library/build/src/auth/computeclient.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { GaxiosError } from 'gaxios'; -import { GetTokenResponse, OAuth2Client, RefreshOptions } from './oauth2client'; -export interface ComputeOptions extends RefreshOptions { - /** - * The service account email to use, or 'default'. A Compute Engine instance - * may have multiple service accounts. - */ - serviceAccountEmail?: string; - /** - * The scopes that will be requested when acquiring service account - * credentials. Only applicable to modern App Engine and Cloud Function - * runtimes as of March 2019. - */ - scopes?: string | string[]; -} -export declare class Compute extends OAuth2Client { - private serviceAccountEmail; - scopes: string[]; - /** - * Google Compute Engine service account credentials. - * - * Retrieve access token from the metadata server. - * See: https://developers.google.com/compute/docs/authentication - */ - constructor(options?: ComputeOptions); - /** - * Refreshes the access token. - * @param refreshToken Unused parameter - */ - protected refreshTokenNoCache(refreshToken?: string | null): Promise; - /** - * Fetches an ID token. - * @param targetAudience the audience for the fetched ID token. - */ - fetchIdToken(targetAudience: string): Promise; - protected wrapError(e: GaxiosError): void; -} diff --git a/node_modules/google-auth-library/build/src/auth/computeclient.js b/node_modules/google-auth-library/build/src/auth/computeclient.js deleted file mode 100644 index 741bf47f..00000000 --- a/node_modules/google-auth-library/build/src/auth/computeclient.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; -// Copyright 2013 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Compute = void 0; -const arrify = require("arrify"); -const gcpMetadata = require("gcp-metadata"); -const oauth2client_1 = require("./oauth2client"); -class Compute extends oauth2client_1.OAuth2Client { - /** - * Google Compute Engine service account credentials. - * - * Retrieve access token from the metadata server. - * See: https://developers.google.com/compute/docs/authentication - */ - constructor(options = {}) { - super(options); - // Start with an expired refresh token, which will automatically be - // refreshed before the first API call is made. - this.credentials = { expiry_date: 1, refresh_token: 'compute-placeholder' }; - this.serviceAccountEmail = options.serviceAccountEmail || 'default'; - this.scopes = arrify(options.scopes); - } - /** - * Refreshes the access token. - * @param refreshToken Unused parameter - */ - async refreshTokenNoCache( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - refreshToken) { - const tokenPath = `service-accounts/${this.serviceAccountEmail}/token`; - let data; - try { - const instanceOptions = { - property: tokenPath, - }; - if (this.scopes.length > 0) { - instanceOptions.params = { - scopes: this.scopes.join(','), - }; - } - data = await gcpMetadata.instance(instanceOptions); - } - catch (e) { - e.message = `Could not refresh access token: ${e.message}`; - this.wrapError(e); - throw e; - } - const tokens = data; - if (data && data.expires_in) { - tokens.expiry_date = new Date().getTime() + data.expires_in * 1000; - delete tokens.expires_in; - } - this.emit('tokens', tokens); - return { tokens, res: null }; - } - /** - * Fetches an ID token. - * @param targetAudience the audience for the fetched ID token. - */ - async fetchIdToken(targetAudience) { - const idTokenPath = `service-accounts/${this.serviceAccountEmail}/identity` + - `?format=full&audience=${targetAudience}`; - let idToken; - try { - const instanceOptions = { - property: idTokenPath, - }; - idToken = await gcpMetadata.instance(instanceOptions); - } - catch (e) { - e.message = `Could not fetch ID token: ${e.message}`; - throw e; - } - return idToken; - } - wrapError(e) { - const res = e.response; - if (res && res.status) { - e.code = res.status.toString(); - if (res.status === 403) { - e.message = - 'A Forbidden error was returned while attempting to retrieve an access ' + - 'token for the Compute Engine built-in service account. This may be because the Compute ' + - 'Engine instance does not have the correct permission scopes specified: ' + - e.message; - } - else if (res.status === 404) { - e.message = - 'A Not Found error was returned while attempting to retrieve an access' + - 'token for the Compute Engine built-in service account. This may be because the Compute ' + - 'Engine instance does not have any permission scopes specified: ' + - e.message; - } - } - } -} -exports.Compute = Compute; -//# sourceMappingURL=computeclient.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/credentials.d.ts b/node_modules/google-auth-library/build/src/auth/credentials.d.ts deleted file mode 100644 index cb64a139..00000000 --- a/node_modules/google-auth-library/build/src/auth/credentials.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -export interface Credentials { - /** - * This field is only present if the access_type parameter was set to offline in the authentication request. For details, see Refresh tokens. - */ - refresh_token?: string | null; - /** - * The time in ms at which this token is thought to expire. - */ - expiry_date?: number | null; - /** - * A token that can be sent to a Google API. - */ - access_token?: string | null; - /** - * Identifies the type of token returned. At this time, this field always has the value Bearer. - */ - token_type?: string | null; - /** - * A JWT that contains identity information about the user that is digitally signed by Google. - */ - id_token?: string | null; - /** - * The scopes of access granted by the access_token expressed as a list of space-delimited, case-sensitive strings. - */ - scope?: string; -} -export interface CredentialRequest { - /** - * This field is only present if the access_type parameter was set to offline in the authentication request. For details, see Refresh tokens. - */ - refresh_token?: string; - /** - * A token that can be sent to a Google API. - */ - access_token?: string; - /** - * Identifies the type of token returned. At this time, this field always has the value Bearer. - */ - token_type?: string; - /** - * The remaining lifetime of the access token in seconds. - */ - expires_in?: number; - /** - * A JWT that contains identity information about the user that is digitally signed by Google. - */ - id_token?: string; - /** - * The scopes of access granted by the access_token expressed as a list of space-delimited, case-sensitive strings. - */ - scope?: string; -} -export interface JWTInput { - type?: string; - client_email?: string; - private_key?: string; - private_key_id?: string; - project_id?: string; - client_id?: string; - client_secret?: string; - refresh_token?: string; - quota_project_id?: string; -} -export interface CredentialBody { - client_email?: string; - private_key?: string; -} diff --git a/node_modules/google-auth-library/build/src/auth/credentials.js b/node_modules/google-auth-library/build/src/auth/credentials.js deleted file mode 100644 index 5ea0d586..00000000 --- a/node_modules/google-auth-library/build/src/auth/credentials.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -// Copyright 2014 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=credentials.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/envDetect.d.ts b/node_modules/google-auth-library/build/src/auth/envDetect.d.ts deleted file mode 100644 index 8b462cdb..00000000 --- a/node_modules/google-auth-library/build/src/auth/envDetect.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare enum GCPEnv { - APP_ENGINE = "APP_ENGINE", - KUBERNETES_ENGINE = "KUBERNETES_ENGINE", - CLOUD_FUNCTIONS = "CLOUD_FUNCTIONS", - COMPUTE_ENGINE = "COMPUTE_ENGINE", - NONE = "NONE" -} -export declare function clear(): void; -export declare function getEnv(): Promise; diff --git a/node_modules/google-auth-library/build/src/auth/envDetect.js b/node_modules/google-auth-library/build/src/auth/envDetect.js deleted file mode 100644 index a2476856..00000000 --- a/node_modules/google-auth-library/build/src/auth/envDetect.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getEnv = exports.clear = exports.GCPEnv = void 0; -const gcpMetadata = require("gcp-metadata"); -var GCPEnv; -(function (GCPEnv) { - GCPEnv["APP_ENGINE"] = "APP_ENGINE"; - GCPEnv["KUBERNETES_ENGINE"] = "KUBERNETES_ENGINE"; - GCPEnv["CLOUD_FUNCTIONS"] = "CLOUD_FUNCTIONS"; - GCPEnv["COMPUTE_ENGINE"] = "COMPUTE_ENGINE"; - GCPEnv["NONE"] = "NONE"; -})(GCPEnv = exports.GCPEnv || (exports.GCPEnv = {})); -let envPromise; -function clear() { - envPromise = undefined; -} -exports.clear = clear; -async function getEnv() { - if (envPromise) { - return envPromise; - } - envPromise = getEnvMemoized(); - return envPromise; -} -exports.getEnv = getEnv; -async function getEnvMemoized() { - let env = GCPEnv.NONE; - if (isAppEngine()) { - env = GCPEnv.APP_ENGINE; - } - else if (isCloudFunction()) { - env = GCPEnv.CLOUD_FUNCTIONS; - } - else if (await isComputeEngine()) { - if (await isKubernetesEngine()) { - env = GCPEnv.KUBERNETES_ENGINE; - } - else { - env = GCPEnv.COMPUTE_ENGINE; - } - } - else { - env = GCPEnv.NONE; - } - return env; -} -function isAppEngine() { - return !!(process.env.GAE_SERVICE || process.env.GAE_MODULE_NAME); -} -function isCloudFunction() { - return !!(process.env.FUNCTION_NAME || process.env.FUNCTION_TARGET); -} -async function isKubernetesEngine() { - try { - await gcpMetadata.instance('attributes/cluster-name'); - return true; - } - catch (e) { - return false; - } -} -async function isComputeEngine() { - return gcpMetadata.isAvailable(); -} -//# sourceMappingURL=envDetect.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/googleauth.d.ts b/node_modules/google-auth-library/build/src/auth/googleauth.d.ts deleted file mode 100644 index f3e4c0f6..00000000 --- a/node_modules/google-auth-library/build/src/auth/googleauth.d.ts +++ /dev/null @@ -1,248 +0,0 @@ -/// -import { GaxiosOptions, GaxiosResponse } from 'gaxios'; -import * as stream from 'stream'; -import { DefaultTransporter, Transporter } from '../transporters'; -import { Compute } from './computeclient'; -import { CredentialBody, JWTInput } from './credentials'; -import { IdTokenClient } from './idtokenclient'; -import { GCPEnv } from './envDetect'; -import { JWT, JWTOptions } from './jwtclient'; -import { Headers, OAuth2Client, OAuth2ClientOptions, RefreshOptions } from './oauth2client'; -import { UserRefreshClient, UserRefreshClientOptions } from './refreshclient'; -export interface ProjectIdCallback { - (err?: Error | null, projectId?: string | null): void; -} -export interface CredentialCallback { - (err: Error | null, result?: UserRefreshClient | JWT): void; -} -interface DeprecatedGetClientOptions { -} -export interface ADCCallback { - (err: Error | null, credential?: OAuth2Client, projectId?: string | null): void; -} -export interface ADCResponse { - credential: OAuth2Client; - projectId: string | null; -} -export interface GoogleAuthOptions { - /** - * Path to a .json, .pem, or .p12 key file - */ - keyFilename?: string; - /** - * Path to a .json, .pem, or .p12 key file - */ - keyFile?: string; - /** - * Object containing client_email and private_key properties - */ - credentials?: CredentialBody; - /** - * Options object passed to the constructor of the client - */ - clientOptions?: JWTOptions | OAuth2ClientOptions | UserRefreshClientOptions; - /** - * Required scopes for the desired API request - */ - scopes?: string | string[]; - /** - * Your project ID. - */ - projectId?: string; -} -export declare const CLOUD_SDK_CLIENT_ID = "764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com"; -export declare class GoogleAuth { - transporter?: Transporter; - /** - * Caches a value indicating whether the auth layer is running on Google - * Compute Engine. - * @private - */ - private checkIsGCE?; - get isGCE(): boolean | undefined; - private _getDefaultProjectIdPromise?; - private _cachedProjectId?; - jsonContent: JWTInput | null; - cachedCredential: JWT | UserRefreshClient | Compute | null; - /** - * Scopes populated by the client library by default. We differentiate between - * these and user defined scopes when deciding whether to use a self-signed JWT. - */ - defaultScopes?: string | string[]; - private keyFilename?; - private scopes?; - private clientOptions?; - /** - * Export DefaultTransporter as a static property of the class. - */ - static DefaultTransporter: typeof DefaultTransporter; - constructor(opts?: GoogleAuthOptions); - /** - * Obtains the default project ID for the application. - * @param callback Optional callback - * @returns Promise that resolves with project Id (if used without callback) - */ - getProjectId(): Promise; - getProjectId(callback: ProjectIdCallback): void; - private getProjectIdAsync; - /** - * Obtains the default service-level credentials for the application. - * @param callback Optional callback. - * @returns Promise that resolves with the ADCResponse (if no callback was - * passed). - */ - getApplicationDefault(): Promise; - getApplicationDefault(callback: ADCCallback): void; - getApplicationDefault(options: RefreshOptions): Promise; - getApplicationDefault(options: RefreshOptions, callback: ADCCallback): void; - private getApplicationDefaultAsync; - /** - * Determines whether the auth layer is running on Google Compute Engine. - * @returns A promise that resolves with the boolean. - * @api private - */ - _checkIsGCE(): Promise; - /** - * Attempts to load default credentials from the environment variable path.. - * @returns Promise that resolves with the OAuth2Client or null. - * @api private - */ - _tryGetApplicationCredentialsFromEnvironmentVariable(options?: RefreshOptions): Promise; - /** - * Attempts to load default credentials from a well-known file location - * @return Promise that resolves with the OAuth2Client or null. - * @api private - */ - _tryGetApplicationCredentialsFromWellKnownFile(options?: RefreshOptions): Promise; - /** - * Attempts to load default credentials from a file at the given path.. - * @param filePath The path to the file to read. - * @returns Promise that resolves with the OAuth2Client - * @api private - */ - _getApplicationCredentialsFromFilePath(filePath: string, options?: RefreshOptions): Promise; - /** - * Create a credentials instance using the given input options. - * @param json The input object. - * @param options The JWT or UserRefresh options for the client - * @returns JWT or UserRefresh Client with data - */ - fromJSON(json: JWTInput, options?: RefreshOptions): JWT | UserRefreshClient; - /** - * Return a JWT or UserRefreshClient from JavaScript object, caching both the - * object used to instantiate and the client. - * @param json The input object. - * @param options The JWT or UserRefresh options for the client - * @returns JWT or UserRefresh Client with data - */ - private _cacheClientFromJSON; - /** - * Create a credentials instance using the given input stream. - * @param inputStream The input stream. - * @param callback Optional callback. - */ - fromStream(inputStream: stream.Readable): Promise; - fromStream(inputStream: stream.Readable, callback: CredentialCallback): void; - fromStream(inputStream: stream.Readable, options: RefreshOptions): Promise; - fromStream(inputStream: stream.Readable, options: RefreshOptions, callback: CredentialCallback): void; - private fromStreamAsync; - /** - * Create a credentials instance using the given API key string. - * @param apiKey The API key string - * @param options An optional options object. - * @returns A JWT loaded from the key - */ - fromAPIKey(apiKey: string, options?: RefreshOptions): JWT; - /** - * Determines whether the current operating system is Windows. - * @api private - */ - private _isWindows; - /** - * Run the Google Cloud SDK command that prints the default project ID - */ - private getDefaultServiceProjectId; - /** - * Loads the project id from environment variables. - * @api private - */ - private getProductionProjectId; - /** - * Loads the project id from the GOOGLE_APPLICATION_CREDENTIALS json file. - * @api private - */ - private getFileProjectId; - /** - * Gets the Compute Engine project ID if it can be inferred. - */ - private getGCEProjectId; - /** - * The callback function handles a credential object that contains the - * client_email and private_key (if exists). - * getCredentials checks for these values from the user JSON at first. - * If it doesn't exist, and the environment is on GCE, it gets the - * client_email from the cloud metadata server. - * @param callback Callback that handles the credential object that contains - * a client_email and optional private key, or the error. - * returned - */ - getCredentials(): Promise; - getCredentials(callback: (err: Error | null, credentials?: CredentialBody) => void): void; - private getCredentialsAsync; - /** - * Automatically obtain a client based on the provided configuration. If no - * options were passed, use Application Default Credentials. - */ - getClient(options?: DeprecatedGetClientOptions): Promise; - /** - * Creates a client which will fetch an ID token for authorization. - * @param targetAudience the audience for the fetched ID token. - * @returns IdTokenClient for making HTTP calls authenticated with ID tokens. - */ - getIdTokenClient(targetAudience: string): Promise; - /** - * Automatically obtain application default credentials, and return - * an access token for making requests. - */ - getAccessToken(): Promise; - /** - * Obtain the HTTP headers that will provide authorization for a given - * request. - */ - getRequestHeaders(url?: string): Promise; - /** - * Obtain credentials for a request, then attach the appropriate headers to - * the request options. - * @param opts Axios or Request options on which to attach the headers - */ - authorizeRequest(opts: { - url?: string; - uri?: string; - headers?: Headers; - }): Promise<{ - url?: string | undefined; - uri?: string | undefined; - headers?: Headers | undefined; - }>; - /** - * Automatically obtain application default credentials, and make an - * HTTP request using the given options. - * @param opts Axios request options for the HTTP request. - */ - request(opts: GaxiosOptions): Promise>; - /** - * Determine the compute environment in which the code is running. - */ - getEnv(): Promise; - /** - * Sign the given data with the current private key, or go out - * to the IAM API to sign it. - * @param data The data to be signed. - */ - sign(data: string): Promise; -} -export interface SignBlobResponse { - keyId: string; - signedBlob: string; -} -export {}; diff --git a/node_modules/google-auth-library/build/src/auth/googleauth.js b/node_modules/google-auth-library/build/src/auth/googleauth.js deleted file mode 100644 index 3686fff1..00000000 --- a/node_modules/google-auth-library/build/src/auth/googleauth.js +++ /dev/null @@ -1,588 +0,0 @@ -"use strict"; -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GoogleAuth = exports.CLOUD_SDK_CLIENT_ID = void 0; -const child_process_1 = require("child_process"); -const fs = require("fs"); -const gcpMetadata = require("gcp-metadata"); -const os = require("os"); -const path = require("path"); -const crypto_1 = require("../crypto/crypto"); -const transporters_1 = require("../transporters"); -const computeclient_1 = require("./computeclient"); -const idtokenclient_1 = require("./idtokenclient"); -const envDetect_1 = require("./envDetect"); -const jwtclient_1 = require("./jwtclient"); -const refreshclient_1 = require("./refreshclient"); -exports.CLOUD_SDK_CLIENT_ID = '764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com'; -class GoogleAuth { - constructor(opts) { - /** - * Caches a value indicating whether the auth layer is running on Google - * Compute Engine. - * @private - */ - this.checkIsGCE = undefined; - // To save the contents of the JSON credential file - this.jsonContent = null; - this.cachedCredential = null; - opts = opts || {}; - this._cachedProjectId = opts.projectId || null; - this.keyFilename = opts.keyFilename || opts.keyFile; - this.scopes = opts.scopes; - this.jsonContent = opts.credentials || null; - this.clientOptions = opts.clientOptions; - } - // Note: this properly is only public to satisify unit tests. - // https://github.com/Microsoft/TypeScript/issues/5228 - get isGCE() { - return this.checkIsGCE; - } - getProjectId(callback) { - if (callback) { - this.getProjectIdAsync().then(r => callback(null, r), callback); - } - else { - return this.getProjectIdAsync(); - } - } - getProjectIdAsync() { - if (this._cachedProjectId) { - return Promise.resolve(this._cachedProjectId); - } - // In implicit case, supports three environments. In order of precedence, - // the implicit environments are: - // - GCLOUD_PROJECT or GOOGLE_CLOUD_PROJECT environment variable - // - GOOGLE_APPLICATION_CREDENTIALS JSON file - // - Cloud SDK: `gcloud config config-helper --format json` - // - GCE project ID from metadata server) - if (!this._getDefaultProjectIdPromise) { - // TODO: refactor the below code so that it doesn't mix and match - // promises and async/await. - this._getDefaultProjectIdPromise = new Promise( - // eslint-disable-next-line no-async-promise-executor - async (resolve, reject) => { - try { - const projectId = this.getProductionProjectId() || - (await this.getFileProjectId()) || - (await this.getDefaultServiceProjectId()) || - (await this.getGCEProjectId()); - this._cachedProjectId = projectId; - if (!projectId) { - throw new Error('Unable to detect a Project Id in the current environment. \n' + - 'To learn more about authentication and Google APIs, visit: \n' + - 'https://cloud.google.com/docs/authentication/getting-started'); - } - resolve(projectId); - } - catch (e) { - reject(e); - } - }); - } - return this._getDefaultProjectIdPromise; - } - getApplicationDefault(optionsOrCallback = {}, callback) { - let options; - if (typeof optionsOrCallback === 'function') { - callback = optionsOrCallback; - } - else { - options = optionsOrCallback; - } - if (callback) { - this.getApplicationDefaultAsync(options).then(r => callback(null, r.credential, r.projectId), callback); - } - else { - return this.getApplicationDefaultAsync(options); - } - } - async getApplicationDefaultAsync(options = {}) { - // If we've already got a cached credential, just return it. - if (this.cachedCredential) { - return { - credential: this.cachedCredential, - projectId: await this.getProjectIdAsync(), - }; - } - let credential; - let projectId; - // Check for the existence of a local environment variable pointing to the - // location of the credential file. This is typically used in local - // developer scenarios. - credential = await this._tryGetApplicationCredentialsFromEnvironmentVariable(options); - if (credential) { - if (credential instanceof jwtclient_1.JWT) { - credential.defaultScopes = this.defaultScopes; - credential.scopes = this.scopes; - } - this.cachedCredential = credential; - projectId = await this.getProjectId(); - return { credential, projectId }; - } - // Look in the well-known credential file location. - credential = await this._tryGetApplicationCredentialsFromWellKnownFile(options); - if (credential) { - if (credential instanceof jwtclient_1.JWT) { - credential.defaultScopes = this.defaultScopes; - credential.scopes = this.scopes; - } - this.cachedCredential = credential; - projectId = await this.getProjectId(); - return { credential, projectId }; - } - // Determine if we're running on GCE. - let isGCE; - try { - isGCE = await this._checkIsGCE(); - } - catch (e) { - e.message = `Unexpected error determining execution environment: ${e.message}`; - throw e; - } - if (!isGCE) { - // We failed to find the default credentials. Bail out with an error. - throw new Error('Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.'); - } - // For GCE, just return a default ComputeClient. It will take care of - // the rest. - options.scopes = this.scopes || this.defaultScopes; - this.cachedCredential = new computeclient_1.Compute(options); - projectId = await this.getProjectId(); - return { projectId, credential: this.cachedCredential }; - } - /** - * Determines whether the auth layer is running on Google Compute Engine. - * @returns A promise that resolves with the boolean. - * @api private - */ - async _checkIsGCE() { - if (this.checkIsGCE === undefined) { - this.checkIsGCE = await gcpMetadata.isAvailable(); - } - return this.checkIsGCE; - } - /** - * Attempts to load default credentials from the environment variable path.. - * @returns Promise that resolves with the OAuth2Client or null. - * @api private - */ - async _tryGetApplicationCredentialsFromEnvironmentVariable(options) { - const credentialsPath = process.env['GOOGLE_APPLICATION_CREDENTIALS'] || - process.env['google_application_credentials']; - if (!credentialsPath || credentialsPath.length === 0) { - return null; - } - try { - return this._getApplicationCredentialsFromFilePath(credentialsPath, options); - } - catch (e) { - e.message = `Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${e.message}`; - throw e; - } - } - /** - * Attempts to load default credentials from a well-known file location - * @return Promise that resolves with the OAuth2Client or null. - * @api private - */ - async _tryGetApplicationCredentialsFromWellKnownFile(options) { - // First, figure out the location of the file, depending upon the OS type. - let location = null; - if (this._isWindows()) { - // Windows - location = process.env['APPDATA']; - } - else { - // Linux or Mac - const home = process.env['HOME']; - if (home) { - location = path.join(home, '.config'); - } - } - // If we found the root path, expand it. - if (location) { - location = path.join(location, 'gcloud', 'application_default_credentials.json'); - if (!fs.existsSync(location)) { - location = null; - } - } - // The file does not exist. - if (!location) { - return null; - } - // The file seems to exist. Try to use it. - const client = await this._getApplicationCredentialsFromFilePath(location, options); - return client; - } - /** - * Attempts to load default credentials from a file at the given path.. - * @param filePath The path to the file to read. - * @returns Promise that resolves with the OAuth2Client - * @api private - */ - async _getApplicationCredentialsFromFilePath(filePath, options = {}) { - // Make sure the path looks like a string. - if (!filePath || filePath.length === 0) { - throw new Error('The file path is invalid.'); - } - // Make sure there is a file at the path. lstatSync will throw if there is - // nothing there. - try { - // Resolve path to actual file in case of symlink. Expect a thrown error - // if not resolvable. - filePath = fs.realpathSync(filePath); - if (!fs.lstatSync(filePath).isFile()) { - throw new Error(); - } - } - catch (err) { - err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`; - throw err; - } - // Now open a read stream on the file, and parse it. - const readStream = fs.createReadStream(filePath); - return this.fromStream(readStream, options); - } - /** - * Create a credentials instance using the given input options. - * @param json The input object. - * @param options The JWT or UserRefresh options for the client - * @returns JWT or UserRefresh Client with data - */ - fromJSON(json, options) { - let client; - if (!json) { - throw new Error('Must pass in a JSON object containing the Google auth settings.'); - } - options = options || {}; - if (json.type === 'authorized_user') { - client = new refreshclient_1.UserRefreshClient(options); - } - else { - options.scopes = this.scopes; - client = new jwtclient_1.JWT(options); - client.defaultScopes = this.defaultScopes; - } - client.fromJSON(json); - return client; - } - /** - * Return a JWT or UserRefreshClient from JavaScript object, caching both the - * object used to instantiate and the client. - * @param json The input object. - * @param options The JWT or UserRefresh options for the client - * @returns JWT or UserRefresh Client with data - */ - _cacheClientFromJSON(json, options) { - let client; - // create either a UserRefreshClient or JWT client. - options = options || {}; - if (json.type === 'authorized_user') { - client = new refreshclient_1.UserRefreshClient(options); - } - else { - options.scopes = this.scopes; - client = new jwtclient_1.JWT(options); - client.defaultScopes = this.defaultScopes; - } - client.fromJSON(json); - // cache both raw data used to instantiate client and client itself. - this.jsonContent = json; - this.cachedCredential = client; - return this.cachedCredential; - } - fromStream(inputStream, optionsOrCallback = {}, callback) { - let options = {}; - if (typeof optionsOrCallback === 'function') { - callback = optionsOrCallback; - } - else { - options = optionsOrCallback; - } - if (callback) { - this.fromStreamAsync(inputStream, options).then(r => callback(null, r), callback); - } - else { - return this.fromStreamAsync(inputStream, options); - } - } - fromStreamAsync(inputStream, options) { - return new Promise((resolve, reject) => { - if (!inputStream) { - throw new Error('Must pass in a stream containing the Google auth settings.'); - } - let s = ''; - inputStream - .setEncoding('utf8') - .on('error', reject) - .on('data', chunk => (s += chunk)) - .on('end', () => { - try { - const data = JSON.parse(s); - const r = this._cacheClientFromJSON(data, options); - return resolve(r); - } - catch (err) { - return reject(err); - } - }); - }); - } - /** - * Create a credentials instance using the given API key string. - * @param apiKey The API key string - * @param options An optional options object. - * @returns A JWT loaded from the key - */ - fromAPIKey(apiKey, options) { - options = options || {}; - const client = new jwtclient_1.JWT(options); - client.fromAPIKey(apiKey); - return client; - } - /** - * Determines whether the current operating system is Windows. - * @api private - */ - _isWindows() { - const sys = os.platform(); - if (sys && sys.length >= 3) { - if (sys.substring(0, 3).toLowerCase() === 'win') { - return true; - } - } - return false; - } - /** - * Run the Google Cloud SDK command that prints the default project ID - */ - async getDefaultServiceProjectId() { - return new Promise(resolve => { - child_process_1.exec('gcloud config config-helper --format json', (err, stdout) => { - if (!err && stdout) { - try { - const projectId = JSON.parse(stdout).configuration.properties.core - .project; - resolve(projectId); - return; - } - catch (e) { - // ignore errors - } - } - resolve(null); - }); - }); - } - /** - * Loads the project id from environment variables. - * @api private - */ - getProductionProjectId() { - return (process.env['GCLOUD_PROJECT'] || - process.env['GOOGLE_CLOUD_PROJECT'] || - process.env['gcloud_project'] || - process.env['google_cloud_project']); - } - /** - * Loads the project id from the GOOGLE_APPLICATION_CREDENTIALS json file. - * @api private - */ - async getFileProjectId() { - if (this.cachedCredential) { - // Try to read the project ID from the cached credentials file - return this.cachedCredential.projectId; - } - // Ensure the projectId is loaded from the keyFile if available. - if (this.keyFilename) { - const creds = await this.getClient(); - if (creds && creds.projectId) { - return creds.projectId; - } - } - // Try to load a credentials file and read its project ID - const r = await this._tryGetApplicationCredentialsFromEnvironmentVariable(); - if (r) { - return r.projectId; - } - else { - return null; - } - } - /** - * Gets the Compute Engine project ID if it can be inferred. - */ - async getGCEProjectId() { - try { - const r = await gcpMetadata.project('project-id'); - return r; - } - catch (e) { - // Ignore any errors - return null; - } - } - getCredentials(callback) { - if (callback) { - this.getCredentialsAsync().then(r => callback(null, r), callback); - } - else { - return this.getCredentialsAsync(); - } - } - async getCredentialsAsync() { - await this.getClient(); - if (this.jsonContent) { - const credential = { - client_email: this.jsonContent.client_email, - private_key: this.jsonContent.private_key, - }; - return credential; - } - const isGCE = await this._checkIsGCE(); - if (!isGCE) { - throw new Error('Unknown error.'); - } - // For GCE, return the service account details from the metadata server - // NOTE: The trailing '/' at the end of service-accounts/ is very important! - // The GCF metadata server doesn't respect querystring params if this / is - // not included. - const data = await gcpMetadata.instance({ - property: 'service-accounts/', - params: { recursive: 'true' }, - }); - if (!data || !data.default || !data.default.email) { - throw new Error('Failure from metadata server.'); - } - return { client_email: data.default.email }; - } - /** - * Automatically obtain a client based on the provided configuration. If no - * options were passed, use Application Default Credentials. - */ - async getClient(options) { - if (options) { - throw new Error('Passing options to getClient is forbidden in v5.0.0. Use new GoogleAuth(opts) instead.'); - } - if (!this.cachedCredential) { - if (this.jsonContent) { - this._cacheClientFromJSON(this.jsonContent, this.clientOptions); - } - else if (this.keyFilename) { - const filePath = path.resolve(this.keyFilename); - const stream = fs.createReadStream(filePath); - await this.fromStreamAsync(stream, this.clientOptions); - } - else { - await this.getApplicationDefaultAsync(this.clientOptions); - } - } - return this.cachedCredential; - } - /** - * Creates a client which will fetch an ID token for authorization. - * @param targetAudience the audience for the fetched ID token. - * @returns IdTokenClient for making HTTP calls authenticated with ID tokens. - */ - async getIdTokenClient(targetAudience) { - const client = await this.getClient(); - if (!('fetchIdToken' in client)) { - throw new Error('Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.'); - } - return new idtokenclient_1.IdTokenClient({ targetAudience, idTokenProvider: client }); - } - /** - * Automatically obtain application default credentials, and return - * an access token for making requests. - */ - async getAccessToken() { - const client = await this.getClient(); - return (await client.getAccessToken()).token; - } - /** - * Obtain the HTTP headers that will provide authorization for a given - * request. - */ - async getRequestHeaders(url) { - const client = await this.getClient(); - return client.getRequestHeaders(url); - } - /** - * Obtain credentials for a request, then attach the appropriate headers to - * the request options. - * @param opts Axios or Request options on which to attach the headers - */ - async authorizeRequest(opts) { - opts = opts || {}; - const url = opts.url || opts.uri; - const client = await this.getClient(); - const headers = await client.getRequestHeaders(url); - opts.headers = Object.assign(opts.headers || {}, headers); - return opts; - } - /** - * Automatically obtain application default credentials, and make an - * HTTP request using the given options. - * @param opts Axios request options for the HTTP request. - */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - async request(opts) { - const client = await this.getClient(); - return client.request(opts); - } - /** - * Determine the compute environment in which the code is running. - */ - getEnv() { - return envDetect_1.getEnv(); - } - /** - * Sign the given data with the current private key, or go out - * to the IAM API to sign it. - * @param data The data to be signed. - */ - async sign(data) { - const client = await this.getClient(); - const crypto = crypto_1.createCrypto(); - if (client instanceof jwtclient_1.JWT && client.key) { - const sign = await crypto.sign(client.key, data); - return sign; - } - const projectId = await this.getProjectId(); - if (!projectId) { - throw new Error('Cannot sign data without a project ID.'); - } - const creds = await this.getCredentials(); - if (!creds.client_email) { - throw new Error('Cannot sign data without `client_email`.'); - } - const url = `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${creds.client_email}:signBlob`; - const res = await this.request({ - method: 'POST', - url, - data: { - payload: crypto.encodeBase64StringUtf8(data), - }, - }); - return res.data.signedBlob; - } -} -exports.GoogleAuth = GoogleAuth; -/** - * Export DefaultTransporter as a static property of the class. - */ -GoogleAuth.DefaultTransporter = transporters_1.DefaultTransporter; -//# sourceMappingURL=googleauth.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/iam.d.ts b/node_modules/google-auth-library/build/src/auth/iam.d.ts deleted file mode 100644 index 93470a44..00000000 --- a/node_modules/google-auth-library/build/src/auth/iam.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export interface RequestMetadata { - 'x-goog-iam-authority-selector': string; - 'x-goog-iam-authorization-token': string; -} -export declare class IAMAuth { - selector: string; - token: string; - /** - * IAM credentials. - * - * @param selector the iam authority selector - * @param token the token - * @constructor - */ - constructor(selector: string, token: string); - /** - * Acquire the HTTP headers required to make an authenticated request. - */ - getRequestHeaders(): { - 'x-goog-iam-authority-selector': string; - 'x-goog-iam-authorization-token': string; - }; -} diff --git a/node_modules/google-auth-library/build/src/auth/iam.js b/node_modules/google-auth-library/build/src/auth/iam.js deleted file mode 100644 index bc4d0e07..00000000 --- a/node_modules/google-auth-library/build/src/auth/iam.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -// Copyright 2014 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.IAMAuth = void 0; -class IAMAuth { - /** - * IAM credentials. - * - * @param selector the iam authority selector - * @param token the token - * @constructor - */ - constructor(selector, token) { - this.selector = selector; - this.token = token; - this.selector = selector; - this.token = token; - } - /** - * Acquire the HTTP headers required to make an authenticated request. - */ - getRequestHeaders() { - return { - 'x-goog-iam-authority-selector': this.selector, - 'x-goog-iam-authorization-token': this.token, - }; - } -} -exports.IAMAuth = IAMAuth; -//# sourceMappingURL=iam.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/idtokenclient.d.ts b/node_modules/google-auth-library/build/src/auth/idtokenclient.d.ts deleted file mode 100644 index bad975c5..00000000 --- a/node_modules/google-auth-library/build/src/auth/idtokenclient.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { OAuth2Client, RequestMetadataResponse } from './oauth2client'; -export interface IdTokenOptions { - /** - * The client to make the request to fetch an ID token. - */ - idTokenProvider: IdTokenProvider; - /** - * The audience to use when requesting an ID token. - */ - targetAudience: string; -} -export interface IdTokenProvider { - fetchIdToken: (targetAudience: string) => Promise; -} -export declare class IdTokenClient extends OAuth2Client { - targetAudience: string; - idTokenProvider: IdTokenProvider; - /** - * Google ID Token client - * - * Retrieve access token from the metadata server. - * See: https://developers.google.com/compute/docs/authentication - */ - constructor(options: IdTokenOptions); - protected getRequestMetadataAsync(url?: string | null): Promise; - private getIdTokenExpiryDate; -} diff --git a/node_modules/google-auth-library/build/src/auth/idtokenclient.js b/node_modules/google-auth-library/build/src/auth/idtokenclient.js deleted file mode 100644 index 16dfaab6..00000000 --- a/node_modules/google-auth-library/build/src/auth/idtokenclient.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.IdTokenClient = void 0; -const oauth2client_1 = require("./oauth2client"); -class IdTokenClient extends oauth2client_1.OAuth2Client { - /** - * Google ID Token client - * - * Retrieve access token from the metadata server. - * See: https://developers.google.com/compute/docs/authentication - */ - constructor(options) { - super(); - this.targetAudience = options.targetAudience; - this.idTokenProvider = options.idTokenProvider; - } - async getRequestMetadataAsync( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - url) { - if (!this.credentials.id_token || - (this.credentials.expiry_date || 0) < Date.now()) { - const idToken = await this.idTokenProvider.fetchIdToken(this.targetAudience); - this.credentials = { - id_token: idToken, - expiry_date: this.getIdTokenExpiryDate(idToken), - }; - } - const headers = { - Authorization: 'Bearer ' + this.credentials.id_token, - }; - return { headers }; - } - getIdTokenExpiryDate(idToken) { - const payloadB64 = idToken.split('.')[1]; - if (payloadB64) { - const payload = JSON.parse(Buffer.from(payloadB64, 'base64').toString('ascii')); - return payload.exp * 1000; - } - } -} -exports.IdTokenClient = IdTokenClient; -//# sourceMappingURL=idtokenclient.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/jwtaccess.d.ts b/node_modules/google-auth-library/build/src/auth/jwtaccess.d.ts deleted file mode 100644 index 12b522a0..00000000 --- a/node_modules/google-auth-library/build/src/auth/jwtaccess.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/// -import * as stream from 'stream'; -import { JWTInput } from './credentials'; -import { Headers } from './oauth2client'; -export interface Claims { - [index: string]: string; -} -export declare class JWTAccess { - email?: string | null; - key?: string | null; - keyId?: string | null; - projectId?: string; - eagerRefreshThresholdMillis: number; - private cache; - /** - * JWTAccess service account credentials. - * - * Create a new access token by using the credential to create a new JWT token - * that's recognized as the access token. - * - * @param email the service account email address. - * @param key the private key that will be used to sign the token. - * @param keyId the ID of the private key used to sign the token. - */ - constructor(email?: string | null, key?: string | null, keyId?: string | null, eagerRefreshThresholdMillis?: number); - /** - * Get a non-expired access token, after refreshing if necessary. - * - * @param url The URI being authorized. - * @param additionalClaims An object with a set of additional claims to - * include in the payload. - * @returns An object that includes the authorization header. - */ - getRequestHeaders(url: string, additionalClaims?: Claims): Headers; - /** - * Returns an expiration time for the JWT token. - * - * @param iat The issued at time for the JWT. - * @returns An expiration time for the JWT. - */ - private static getExpirationTime; - /** - * Create a JWTAccess credentials instance using the given input options. - * @param json The input object. - */ - fromJSON(json: JWTInput): void; - /** - * Create a JWTAccess credentials instance using the given input stream. - * @param inputStream The input stream. - * @param callback Optional callback. - */ - fromStream(inputStream: stream.Readable): Promise; - fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void; - private fromStreamAsync; -} diff --git a/node_modules/google-auth-library/build/src/auth/jwtaccess.js b/node_modules/google-auth-library/build/src/auth/jwtaccess.js deleted file mode 100644 index 793db810..00000000 --- a/node_modules/google-auth-library/build/src/auth/jwtaccess.js +++ /dev/null @@ -1,157 +0,0 @@ -"use strict"; -// Copyright 2015 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JWTAccess = void 0; -const jws = require("jws"); -const LRU = require("lru-cache"); -const DEFAULT_HEADER = { - alg: 'RS256', - typ: 'JWT', -}; -class JWTAccess { - /** - * JWTAccess service account credentials. - * - * Create a new access token by using the credential to create a new JWT token - * that's recognized as the access token. - * - * @param email the service account email address. - * @param key the private key that will be used to sign the token. - * @param keyId the ID of the private key used to sign the token. - */ - constructor(email, key, keyId, eagerRefreshThresholdMillis) { - this.cache = new LRU({ - max: 500, - maxAge: 60 * 60 * 1000, - }); - this.email = email; - this.key = key; - this.keyId = keyId; - this.eagerRefreshThresholdMillis = eagerRefreshThresholdMillis !== null && eagerRefreshThresholdMillis !== void 0 ? eagerRefreshThresholdMillis : 5 * 60 * 1000; - } - /** - * Get a non-expired access token, after refreshing if necessary. - * - * @param url The URI being authorized. - * @param additionalClaims An object with a set of additional claims to - * include in the payload. - * @returns An object that includes the authorization header. - */ - getRequestHeaders(url, additionalClaims) { - // Return cached authorization headers, unless we are within - // eagerRefreshThresholdMillis ms of them expiring: - const cachedToken = this.cache.get(url); - const now = Date.now(); - if (cachedToken && - cachedToken.expiration - now > this.eagerRefreshThresholdMillis) { - return cachedToken.headers; - } - const iat = Math.floor(Date.now() / 1000); - const exp = JWTAccess.getExpirationTime(iat); - // The payload used for signed JWT headers has: - // iss == sub == - // aud == - const defaultClaims = { - iss: this.email, - sub: this.email, - aud: url, - exp, - iat, - }; - // if additionalClaims are provided, ensure they do not collide with - // other required claims. - if (additionalClaims) { - for (const claim in defaultClaims) { - if (additionalClaims[claim]) { - throw new Error(`The '${claim}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`); - } - } - } - const header = this.keyId - ? { ...DEFAULT_HEADER, kid: this.keyId } - : DEFAULT_HEADER; - const payload = Object.assign(defaultClaims, additionalClaims); - // Sign the jwt and add it to the cache - const signedJWT = jws.sign({ header, payload, secret: this.key }); - const headers = { Authorization: `Bearer ${signedJWT}` }; - this.cache.set(url, { - expiration: exp * 1000, - headers, - }); - return headers; - } - /** - * Returns an expiration time for the JWT token. - * - * @param iat The issued at time for the JWT. - * @returns An expiration time for the JWT. - */ - static getExpirationTime(iat) { - const exp = iat + 3600; // 3600 seconds = 1 hour - return exp; - } - /** - * Create a JWTAccess credentials instance using the given input options. - * @param json The input object. - */ - fromJSON(json) { - if (!json) { - throw new Error('Must pass in a JSON object containing the service account auth settings.'); - } - if (!json.client_email) { - throw new Error('The incoming JSON object does not contain a client_email field'); - } - if (!json.private_key) { - throw new Error('The incoming JSON object does not contain a private_key field'); - } - // Extract the relevant information from the json key file. - this.email = json.client_email; - this.key = json.private_key; - this.keyId = json.private_key_id; - this.projectId = json.project_id; - } - fromStream(inputStream, callback) { - if (callback) { - this.fromStreamAsync(inputStream).then(() => callback(), callback); - } - else { - return this.fromStreamAsync(inputStream); - } - } - fromStreamAsync(inputStream) { - return new Promise((resolve, reject) => { - if (!inputStream) { - reject(new Error('Must pass in a stream containing the service account auth settings.')); - } - let s = ''; - inputStream - .setEncoding('utf8') - .on('data', chunk => (s += chunk)) - .on('error', reject) - .on('end', () => { - try { - const data = JSON.parse(s); - this.fromJSON(data); - resolve(); - } - catch (err) { - reject(err); - } - }); - }); - } -} -exports.JWTAccess = JWTAccess; -//# sourceMappingURL=jwtaccess.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/jwtclient.d.ts b/node_modules/google-auth-library/build/src/auth/jwtclient.d.ts deleted file mode 100644 index e89abab0..00000000 --- a/node_modules/google-auth-library/build/src/auth/jwtclient.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -/// -import { GoogleToken } from 'gtoken'; -import * as stream from 'stream'; -import { CredentialBody, Credentials, JWTInput } from './credentials'; -import { IdTokenProvider } from './idtokenclient'; -import { GetTokenResponse, OAuth2Client, RefreshOptions, RequestMetadataResponse } from './oauth2client'; -export interface JWTOptions extends RefreshOptions { - email?: string; - keyFile?: string; - key?: string; - keyId?: string; - scopes?: string | string[]; - subject?: string; - additionalClaims?: {}; -} -export declare class JWT extends OAuth2Client implements IdTokenProvider { - email?: string; - keyFile?: string; - key?: string; - keyId?: string; - defaultScopes?: string | string[]; - scopes?: string | string[]; - scope?: string; - subject?: string; - gtoken?: GoogleToken; - additionalClaims?: {}; - private access?; - /** - * JWT service account credentials. - * - * Retrieve access token using gtoken. - * - * @param email service account email address. - * @param keyFile path to private key file. - * @param key value of key - * @param scopes list of requested scopes or a single scope. - * @param subject impersonated account's email address. - * @param key_id the ID of the key - */ - constructor(options: JWTOptions); - constructor(email?: string, keyFile?: string, key?: string, scopes?: string | string[], subject?: string, keyId?: string); - /** - * Creates a copy of the credential with the specified scopes. - * @param scopes List of requested scopes or a single scope. - * @return The cloned instance. - */ - createScoped(scopes?: string | string[]): JWT; - /** - * Obtains the metadata to be sent with the request. - * - * @param url the URI being authorized. - */ - protected getRequestMetadataAsync(url?: string | null): Promise; - /** - * Fetches an ID token. - * @param targetAudience the audience for the fetched ID token. - */ - fetchIdToken(targetAudience: string): Promise; - /** - * Determine if there are currently scopes available. - */ - private hasUserScopes; - /** - * Are there any default or user scopes defined. - */ - private hasAnyScopes; - /** - * Get the initial access token using gToken. - * @param callback Optional callback. - * @returns Promise that resolves with credentials - */ - authorize(): Promise; - authorize(callback: (err: Error | null, result?: Credentials) => void): void; - private authorizeAsync; - /** - * Refreshes the access token. - * @param refreshToken ignored - * @private - */ - protected refreshTokenNoCache(refreshToken?: string | null): Promise; - /** - * Create a gToken if it doesn't already exist. - */ - private createGToken; - /** - * Create a JWT credentials instance using the given input options. - * @param json The input object. - */ - fromJSON(json: JWTInput): void; - /** - * Create a JWT credentials instance using the given input stream. - * @param inputStream The input stream. - * @param callback Optional callback. - */ - fromStream(inputStream: stream.Readable): Promise; - fromStream(inputStream: stream.Readable, callback: (err?: Error | null) => void): void; - private fromStreamAsync; - /** - * Creates a JWT credentials instance using an API Key for authentication. - * @param apiKey The API Key in string form. - */ - fromAPIKey(apiKey: string): void; - /** - * Using the key or keyFile on the JWT client, obtain an object that contains - * the key and the client email. - */ - getCredentials(): Promise; -} diff --git a/node_modules/google-auth-library/build/src/auth/jwtclient.js b/node_modules/google-auth-library/build/src/auth/jwtclient.js deleted file mode 100644 index 68c2c9d3..00000000 --- a/node_modules/google-auth-library/build/src/auth/jwtclient.js +++ /dev/null @@ -1,264 +0,0 @@ -"use strict"; -// Copyright 2013 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JWT = void 0; -const gtoken_1 = require("gtoken"); -const jwtaccess_1 = require("./jwtaccess"); -const oauth2client_1 = require("./oauth2client"); -class JWT extends oauth2client_1.OAuth2Client { - constructor(optionsOrEmail, keyFile, key, scopes, subject, keyId) { - const opts = optionsOrEmail && typeof optionsOrEmail === 'object' - ? optionsOrEmail - : { email: optionsOrEmail, keyFile, key, keyId, scopes, subject }; - super({ - eagerRefreshThresholdMillis: opts.eagerRefreshThresholdMillis, - forceRefreshOnFailure: opts.forceRefreshOnFailure, - }); - this.email = opts.email; - this.keyFile = opts.keyFile; - this.key = opts.key; - this.keyId = opts.keyId; - this.scopes = opts.scopes; - this.subject = opts.subject; - this.additionalClaims = opts.additionalClaims; - this.credentials = { refresh_token: 'jwt-placeholder', expiry_date: 1 }; - } - /** - * Creates a copy of the credential with the specified scopes. - * @param scopes List of requested scopes or a single scope. - * @return The cloned instance. - */ - createScoped(scopes) { - return new JWT({ - email: this.email, - keyFile: this.keyFile, - key: this.key, - keyId: this.keyId, - scopes, - subject: this.subject, - additionalClaims: this.additionalClaims, - }); - } - /** - * Obtains the metadata to be sent with the request. - * - * @param url the URI being authorized. - */ - async getRequestMetadataAsync(url) { - if (!this.apiKey && !this.hasUserScopes() && url) { - if (this.additionalClaims && - this.additionalClaims.target_audience) { - const { tokens } = await this.refreshToken(); - return { - headers: this.addSharedMetadataHeaders({ - Authorization: `Bearer ${tokens.id_token}`, - }), - }; - } - else { - // no scopes have been set, but a uri has been provided. Use JWTAccess - // credentials. - if (!this.access) { - this.access = new jwtaccess_1.JWTAccess(this.email, this.key, this.keyId, this.eagerRefreshThresholdMillis); - } - const headers = await this.access.getRequestHeaders(url, this.additionalClaims); - return { headers: this.addSharedMetadataHeaders(headers) }; - } - } - else if (this.hasAnyScopes() || this.apiKey) { - return super.getRequestMetadataAsync(url); - } - else { - // If no audience, apiKey, or scopes are provided, we should not attempt - // to populate any headers: - return { headers: {} }; - } - } - /** - * Fetches an ID token. - * @param targetAudience the audience for the fetched ID token. - */ - async fetchIdToken(targetAudience) { - // Create a new gToken for fetching an ID token - const gtoken = new gtoken_1.GoogleToken({ - iss: this.email, - sub: this.subject, - scope: this.scopes || this.defaultScopes, - keyFile: this.keyFile, - key: this.key, - additionalClaims: { target_audience: targetAudience }, - }); - await gtoken.getToken({ - forceRefresh: true, - }); - if (!gtoken.idToken) { - throw new Error('Unknown error: Failed to fetch ID token'); - } - return gtoken.idToken; - } - /** - * Determine if there are currently scopes available. - */ - hasUserScopes() { - if (!this.scopes) { - return false; - } - return this.scopes.length > 0; - } - /** - * Are there any default or user scopes defined. - */ - hasAnyScopes() { - if (this.scopes && this.scopes.length > 0) - return true; - if (this.defaultScopes && this.defaultScopes.length > 0) - return true; - return false; - } - authorize(callback) { - if (callback) { - this.authorizeAsync().then(r => callback(null, r), callback); - } - else { - return this.authorizeAsync(); - } - } - async authorizeAsync() { - const result = await this.refreshToken(); - if (!result) { - throw new Error('No result returned'); - } - this.credentials = result.tokens; - this.credentials.refresh_token = 'jwt-placeholder'; - this.key = this.gtoken.key; - this.email = this.gtoken.iss; - return result.tokens; - } - /** - * Refreshes the access token. - * @param refreshToken ignored - * @private - */ - async refreshTokenNoCache( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - refreshToken) { - const gtoken = this.createGToken(); - const token = await gtoken.getToken({ - forceRefresh: this.isTokenExpiring(), - }); - const tokens = { - access_token: token.access_token, - token_type: 'Bearer', - expiry_date: gtoken.expiresAt, - id_token: gtoken.idToken, - }; - this.emit('tokens', tokens); - return { res: null, tokens }; - } - /** - * Create a gToken if it doesn't already exist. - */ - createGToken() { - if (!this.gtoken) { - this.gtoken = new gtoken_1.GoogleToken({ - iss: this.email, - sub: this.subject, - scope: this.scopes || this.defaultScopes, - keyFile: this.keyFile, - key: this.key, - additionalClaims: this.additionalClaims, - }); - } - return this.gtoken; - } - /** - * Create a JWT credentials instance using the given input options. - * @param json The input object. - */ - fromJSON(json) { - if (!json) { - throw new Error('Must pass in a JSON object containing the service account auth settings.'); - } - if (!json.client_email) { - throw new Error('The incoming JSON object does not contain a client_email field'); - } - if (!json.private_key) { - throw new Error('The incoming JSON object does not contain a private_key field'); - } - // Extract the relevant information from the json key file. - this.email = json.client_email; - this.key = json.private_key; - this.keyId = json.private_key_id; - this.projectId = json.project_id; - this.quotaProjectId = json.quota_project_id; - } - fromStream(inputStream, callback) { - if (callback) { - this.fromStreamAsync(inputStream).then(() => callback(), callback); - } - else { - return this.fromStreamAsync(inputStream); - } - } - fromStreamAsync(inputStream) { - return new Promise((resolve, reject) => { - if (!inputStream) { - throw new Error('Must pass in a stream containing the service account auth settings.'); - } - let s = ''; - inputStream - .setEncoding('utf8') - .on('error', reject) - .on('data', chunk => (s += chunk)) - .on('end', () => { - try { - const data = JSON.parse(s); - this.fromJSON(data); - resolve(); - } - catch (e) { - reject(e); - } - }); - }); - } - /** - * Creates a JWT credentials instance using an API Key for authentication. - * @param apiKey The API Key in string form. - */ - fromAPIKey(apiKey) { - if (typeof apiKey !== 'string') { - throw new Error('Must provide an API Key string.'); - } - this.apiKey = apiKey; - } - /** - * Using the key or keyFile on the JWT client, obtain an object that contains - * the key and the client email. - */ - async getCredentials() { - if (this.key) { - return { private_key: this.key, client_email: this.email }; - } - else if (this.keyFile) { - const gtoken = this.createGToken(); - const creds = await gtoken.getCredentials(this.keyFile); - return { private_key: creds.privateKey, client_email: creds.clientEmail }; - } - throw new Error('A key or a keyFile must be provided to getCredentials.'); - } -} -exports.JWT = JWT; -//# sourceMappingURL=jwtclient.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/loginticket.d.ts b/node_modules/google-auth-library/build/src/auth/loginticket.d.ts deleted file mode 100644 index 33fd407a..00000000 --- a/node_modules/google-auth-library/build/src/auth/loginticket.d.ts +++ /dev/null @@ -1,140 +0,0 @@ -export declare class LoginTicket { - private envelope?; - private payload?; - /** - * Create a simple class to extract user ID from an ID Token - * - * @param {string} env Envelope of the jwt - * @param {TokenPayload} pay Payload of the jwt - * @constructor - */ - constructor(env?: string, pay?: TokenPayload); - getEnvelope(): string | undefined; - getPayload(): TokenPayload | undefined; - /** - * Create a simple class to extract user ID from an ID Token - * - * @return The user ID - */ - getUserId(): string | null; - /** - * Returns attributes from the login ticket. This can contain - * various information about the user session. - * - * @return The envelope and payload - */ - getAttributes(): { - envelope: string | undefined; - payload: TokenPayload | undefined; - }; -} -export interface TokenPayload { - /** - * The Issuer Identifier for the Issuer of the response. Always - * https://accounts.google.com or accounts.google.com for Google ID tokens. - */ - iss: string; - /** - * Access token hash. Provides validation that the access token is tied to the - * identity token. If the ID token is issued with an access token in the - * server flow, this is always included. This can be used as an alternate - * mechanism to protect against cross-site request forgery attacks, but if you - * follow Step 1 and Step 3 it is not necessary to verify the access token. - */ - at_hash?: string; - /** - * True if the user's e-mail address has been verified; otherwise false. - */ - email_verified?: boolean; - /** - * An identifier for the user, unique among all Google accounts and never - * reused. A Google account can have multiple emails at different points in - * time, but the sub value is never changed. Use sub within your application - * as the unique-identifier key for the user. - */ - sub: string; - /** - * The client_id of the authorized presenter. This claim is only needed when - * the party requesting the ID token is not the same as the audience of the ID - * token. This may be the case at Google for hybrid apps where a web - * application and Android app have a different client_id but share the same - * project. - */ - azp?: string; - /** - * The user's email address. This may not be unique and is not suitable for - * use as a primary key. Provided only if your scope included the string - * "email". - */ - email?: string; - /** - * The URL of the user's profile page. Might be provided when: - * - The request scope included the string "profile" - * - The ID token is returned from a token refresh - * - When profile claims are present, you can use them to update your app's - * user records. Note that this claim is never guaranteed to be present. - */ - profile?: string; - /** - * The URL of the user's profile picture. Might be provided when: - * - The request scope included the string "profile" - * - The ID token is returned from a token refresh - * - When picture claims are present, you can use them to update your app's - * user records. Note that this claim is never guaranteed to be present. - */ - picture?: string; - /** - * The user's full name, in a displayable form. Might be provided when: - * - The request scope included the string "profile" - * - The ID token is returned from a token refresh - * - When name claims are present, you can use them to update your app's user - * records. Note that this claim is never guaranteed to be present. - */ - name?: string; - /** - * The user's given name, in a displayable form. Might be provided when: - * - The request scope included the string "profile" - * - The ID token is returned from a token refresh - * - When name claims are present, you can use them to update your app's user - * records. Note that this claim is never guaranteed to be present. - */ - given_name?: string; - /** - * The user's family name, in a displayable form. Might be provided when: - * - The request scope included the string "profile" - * - The ID token is returned from a token refresh - * - When name claims are present, you can use them to update your app's user - * records. Note that this claim is never guaranteed to be present. - */ - family_name?: string; - /** - * Identifies the audience that this ID token is intended for. It must be one - * of the OAuth 2.0 client IDs of your application. - */ - aud: string; - /** - * The time the ID token was issued, represented in Unix time (integer - * seconds). - */ - iat: number; - /** - * The time the ID token expires, represented in Unix time (integer seconds). - */ - exp: number; - /** - * The value of the nonce supplied by your app in the authentication request. - * You should enforce protection against replay attacks by ensuring it is - * presented only once. - */ - nonce?: string; - /** - * The hosted G Suite domain of the user. Provided only if the user belongs to - * a hosted domain. - */ - hd?: string; - /** - * The user's locale, represented by a BCP 47 language tag. - * Might be provided when a name claim is present. - */ - locale?: string; -} diff --git a/node_modules/google-auth-library/build/src/auth/loginticket.js b/node_modules/google-auth-library/build/src/auth/loginticket.js deleted file mode 100644 index 48ffc2d2..00000000 --- a/node_modules/google-auth-library/build/src/auth/loginticket.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -// Copyright 2014 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LoginTicket = void 0; -class LoginTicket { - /** - * Create a simple class to extract user ID from an ID Token - * - * @param {string} env Envelope of the jwt - * @param {TokenPayload} pay Payload of the jwt - * @constructor - */ - constructor(env, pay) { - this.envelope = env; - this.payload = pay; - } - getEnvelope() { - return this.envelope; - } - getPayload() { - return this.payload; - } - /** - * Create a simple class to extract user ID from an ID Token - * - * @return The user ID - */ - getUserId() { - const payload = this.getPayload(); - if (payload && payload.sub) { - return payload.sub; - } - return null; - } - /** - * Returns attributes from the login ticket. This can contain - * various information about the user session. - * - * @return The envelope and payload - */ - getAttributes() { - return { envelope: this.getEnvelope(), payload: this.getPayload() }; - } -} -exports.LoginTicket = LoginTicket; -//# sourceMappingURL=loginticket.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/oauth2client.d.ts b/node_modules/google-auth-library/build/src/auth/oauth2client.d.ts deleted file mode 100644 index 30ca850e..00000000 --- a/node_modules/google-auth-library/build/src/auth/oauth2client.d.ts +++ /dev/null @@ -1,502 +0,0 @@ -import { GaxiosError, GaxiosOptions, GaxiosPromise, GaxiosResponse } from 'gaxios'; -import { JwkCertificate } from '../crypto/crypto'; -import { BodyResponseCallback } from '../transporters'; -import { AuthClient } from './authclient'; -import { Credentials } from './credentials'; -import { LoginTicket } from './loginticket'; -/** - * The results from the `generateCodeVerifierAsync` method. To learn more, - * See the sample: - * https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/oauth2-codeVerifier.js - */ -export interface CodeVerifierResults { - /** - * The code verifier that will be used when calling `getToken` to obtain a new - * access token. - */ - codeVerifier: string; - /** - * The code_challenge that should be sent with the `generateAuthUrl` call - * to obtain a verifiable authentication url. - */ - codeChallenge?: string; -} -export interface Certificates { - [index: string]: string | JwkCertificate; -} -export interface PublicKeys { - [index: string]: string; -} -export interface Headers { - [index: string]: string; -} -export declare enum CodeChallengeMethod { - Plain = "plain", - S256 = "S256" -} -export declare enum CertificateFormat { - PEM = "PEM", - JWK = "JWK" -} -export interface GetTokenOptions { - code: string; - codeVerifier?: string; - /** - * The client ID for your application. The value passed into the constructor - * will be used if not provided. Must match any client_id option passed to - * a corresponding call to generateAuthUrl. - */ - client_id?: string; - /** - * Determines where the API server redirects the user after the user - * completes the authorization flow. The value passed into the constructor - * will be used if not provided. Must match any redirect_uri option passed to - * a corresponding call to generateAuthUrl. - */ - redirect_uri?: string; -} -export interface TokenInfo { - /** - * The application that is the intended user of the access token. - */ - aud: string; - /** - * This value lets you correlate profile information from multiple Google - * APIs. It is only present in the response if you included the profile scope - * in your request in step 1. The field value is an immutable identifier for - * the logged-in user that can be used to create and manage user sessions in - * your application. The identifier is the same regardless of which client ID - * is used to retrieve it. This enables multiple applications in the same - * organization to correlate profile information. - */ - user_id?: string; - /** - * An array of scopes that the user granted access to. - */ - scopes: string[]; - /** - * The datetime when the token becomes invalid. - */ - expiry_date: number; - /** - * An identifier for the user, unique among all Google accounts and never - * reused. A Google account can have multiple emails at different points in - * time, but the sub value is never changed. Use sub within your application - * as the unique-identifier key for the user. - */ - sub?: string; - /** - * The client_id of the authorized presenter. This claim is only needed when - * the party requesting the ID token is not the same as the audience of the ID - * token. This may be the case at Google for hybrid apps where a web - * application and Android app have a different client_id but share the same - * project. - */ - azp?: string; - /** - * Indicates whether your application can refresh access tokens - * when the user is not present at the browser. Valid parameter values are - * 'online', which is the default value, and 'offline'. Set the value to - * 'offline' if your application needs to refresh access tokens when the user - * is not present at the browser. This value instructs the Google - * authorization server to return a refresh token and an access token the - * first time that your application exchanges an authorization code for - * tokens. - */ - access_type?: string; - /** - * The user's email address. This value may not be unique to this user and - * is not suitable for use as a primary key. Provided only if your scope - * included the email scope value. - */ - email?: string; - /** - * True if the user's e-mail address has been verified; otherwise false. - */ - email_verified?: boolean; -} -export interface GenerateAuthUrlOpts { - /** - * Recommended. Indicates whether your application can refresh access tokens - * when the user is not present at the browser. Valid parameter values are - * 'online', which is the default value, and 'offline'. Set the value to - * 'offline' if your application needs to refresh access tokens when the user - * is not present at the browser. This value instructs the Google - * authorization server to return a refresh token and an access token the - * first time that your application exchanges an authorization code for - * tokens. - */ - access_type?: string; - /** - * The hd (hosted domain) parameter streamlines the login process for G Suite - * hosted accounts. By including the domain of the G Suite user (for example, - * mycollege.edu), you can indicate that the account selection UI should be - * optimized for accounts at that domain. To optimize for G Suite accounts - * generally instead of just one domain, use an asterisk: hd=*. - * Don't rely on this UI optimization to control who can access your app, - * as client-side requests can be modified. Be sure to validate that the - * returned ID token has an hd claim value that matches what you expect - * (e.g. mycolledge.edu). Unlike the request parameter, the ID token claim is - * contained within a security token from Google, so the value can be trusted. - */ - hd?: string; - /** - * The 'response_type' will always be set to 'CODE'. - */ - response_type?: string; - /** - * The client ID for your application. The value passed into the constructor - * will be used if not provided. You can find this value in the API Console. - */ - client_id?: string; - /** - * Determines where the API server redirects the user after the user - * completes the authorization flow. The value must exactly match one of the - * 'redirect_uri' values listed for your project in the API Console. Note that - * the http or https scheme, case, and trailing slash ('/') must all match. - * The value passed into the constructor will be used if not provided. - */ - redirect_uri?: string; - /** - * Required. A space-delimited list of scopes that identify the resources that - * your application could access on the user's behalf. These values inform the - * consent screen that Google displays to the user. Scopes enable your - * application to only request access to the resources that it needs while - * also enabling users to control the amount of access that they grant to your - * application. Thus, there is an inverse relationship between the number of - * scopes requested and the likelihood of obtaining user consent. The - * OAuth 2.0 API Scopes document provides a full list of scopes that you might - * use to access Google APIs. We recommend that your application request - * access to authorization scopes in context whenever possible. By requesting - * access to user data in context, via incremental authorization, you help - * users to more easily understand why your application needs the access it is - * requesting. - */ - scope?: string[] | string; - /** - * Recommended. Specifies any string value that your application uses to - * maintain state between your authorization request and the authorization - * server's response. The server returns the exact value that you send as a - * name=value pair in the hash (#) fragment of the 'redirect_uri' after the - * user consents to or denies your application's access request. You can use - * this parameter for several purposes, such as directing the user to the - * correct resource in your application, sending nonces, and mitigating - * cross-site request forgery. Since your redirect_uri can be guessed, using a - * state value can increase your assurance that an incoming connection is the - * result of an authentication request. If you generate a random string or - * encode the hash of a cookie or another value that captures the client's - * state, you can validate the response to additionally ensure that the - * request and response originated in the same browser, providing protection - * against attacks such as cross-site request forgery. See the OpenID Connect - * documentation for an example of how to create and confirm a state token. - */ - state?: string; - /** - * Optional. Enables applications to use incremental authorization to request - * access to additional scopes in context. If you set this parameter's value - * to true and the authorization request is granted, then the new access token - * will also cover any scopes to which the user previously granted the - * application access. See the incremental authorization section for examples. - */ - include_granted_scopes?: boolean; - /** - * Optional. If your application knows which user is trying to authenticate, - * it can use this parameter to provide a hint to the Google Authentication - * Server. The server uses the hint to simplify the login flow either by - * prefilling the email field in the sign-in form or by selecting the - * appropriate multi-login session. Set the parameter value to an email - * address or sub identifier, which is equivalent to the user's Google ID. - */ - login_hint?: string; - /** - * Optional. A space-delimited, case-sensitive list of prompts to present the - * user. If you don't specify this parameter, the user will be prompted only - * the first time your app requests access. Possible values are: - * - * 'none' - Donot display any authentication or consent screens. Must not be - * specified with other values. - * 'consent' - Prompt the user for consent. - * 'select_account' - Prompt the user to select an account. - */ - prompt?: string; - /** - * Recommended. Specifies what method was used to encode a 'code_verifier' - * that will be used during authorization code exchange. This parameter must - * be used with the 'code_challenge' parameter. The value of the - * 'code_challenge_method' defaults to "plain" if not present in the request - * that includes a 'code_challenge'. The only supported values for this - * parameter are "S256" or "plain". - */ - code_challenge_method?: CodeChallengeMethod; - /** - * Recommended. Specifies an encoded 'code_verifier' that will be used as a - * server-side challenge during authorization code exchange. This parameter - * must be used with the 'code_challenge' parameter described above. - */ - code_challenge?: string; -} -export interface GetTokenCallback { - (err: GaxiosError | null, token?: Credentials | null, res?: GaxiosResponse | null): void; -} -export interface GetTokenResponse { - tokens: Credentials; - res: GaxiosResponse | null; -} -export interface GetAccessTokenCallback { - (err: GaxiosError | null, token?: string | null, res?: GaxiosResponse | null): void; -} -export interface GetAccessTokenResponse { - token?: string | null; - res?: GaxiosResponse | null; -} -export interface RefreshAccessTokenCallback { - (err: GaxiosError | null, credentials?: Credentials | null, res?: GaxiosResponse | null): void; -} -export interface RefreshAccessTokenResponse { - credentials: Credentials; - res: GaxiosResponse | null; -} -export interface RequestMetadataResponse { - headers: Headers; - res?: GaxiosResponse | null; -} -export interface RequestMetadataCallback { - (err: GaxiosError | null, headers?: Headers, res?: GaxiosResponse | null): void; -} -export interface GetFederatedSignonCertsCallback { - (err: GaxiosError | null, certs?: Certificates, response?: GaxiosResponse | null): void; -} -export interface FederatedSignonCertsResponse { - certs: Certificates; - format: CertificateFormat; - res?: GaxiosResponse | null; -} -export interface GetIapPublicKeysCallback { - (err: GaxiosError | null, pubkeys?: PublicKeys, response?: GaxiosResponse | null): void; -} -export interface IapPublicKeysResponse { - pubkeys: PublicKeys; - res?: GaxiosResponse | null; -} -export interface RevokeCredentialsResult { - success: boolean; -} -export interface VerifyIdTokenOptions { - idToken: string; - audience?: string | string[]; - maxExpiry?: number; -} -export interface OAuth2ClientOptions extends RefreshOptions { - clientId?: string; - clientSecret?: string; - redirectUri?: string; -} -export interface RefreshOptions { - eagerRefreshThresholdMillis?: number; - forceRefreshOnFailure?: boolean; -} -export declare class OAuth2Client extends AuthClient { - private redirectUri?; - private certificateCache; - private certificateExpiry; - private certificateCacheFormat; - protected refreshTokenPromises: Map>; - _clientId?: string; - _clientSecret?: string; - apiKey?: string; - projectId?: string; - eagerRefreshThresholdMillis: number; - forceRefreshOnFailure: boolean; - /** - * Handles OAuth2 flow for Google APIs. - * - * @param clientId The authentication client ID. - * @param clientSecret The authentication client secret. - * @param redirectUri The URI to redirect to after completing the auth - * request. - * @param opts optional options for overriding the given parameters. - * @constructor - */ - constructor(options?: OAuth2ClientOptions); - constructor(clientId?: string, clientSecret?: string, redirectUri?: string); - protected static readonly GOOGLE_TOKEN_INFO_URL = "https://oauth2.googleapis.com/tokeninfo"; - /** - * The base URL for auth endpoints. - */ - private static readonly GOOGLE_OAUTH2_AUTH_BASE_URL_; - /** - * The base endpoint for token retrieval. - */ - private static readonly GOOGLE_OAUTH2_TOKEN_URL_; - /** - * The base endpoint to revoke tokens. - */ - private static readonly GOOGLE_OAUTH2_REVOKE_URL_; - /** - * Google Sign on certificates in PEM format. - */ - private static readonly GOOGLE_OAUTH2_FEDERATED_SIGNON_PEM_CERTS_URL_; - /** - * Google Sign on certificates in JWK format. - */ - private static readonly GOOGLE_OAUTH2_FEDERATED_SIGNON_JWK_CERTS_URL_; - /** - * Google Sign on certificates in JWK format. - */ - private static readonly GOOGLE_OAUTH2_IAP_PUBLIC_KEY_URL_; - /** - * Clock skew - five minutes in seconds - */ - private static readonly CLOCK_SKEW_SECS_; - /** - * Max Token Lifetime is one day in seconds - */ - private static readonly MAX_TOKEN_LIFETIME_SECS_; - /** - * The allowed oauth token issuers. - */ - private static readonly ISSUERS_; - /** - * Generates URL for consent page landing. - * @param opts Options. - * @return URL to consent page. - */ - generateAuthUrl(opts?: GenerateAuthUrlOpts): string; - generateCodeVerifier(): void; - /** - * Convenience method to automatically generate a code_verifier, and its - * resulting SHA256. If used, this must be paired with a S256 - * code_challenge_method. - * - * For a full example see: - * https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/oauth2-codeVerifier.js - */ - generateCodeVerifierAsync(): Promise; - /** - * Gets the access token for the given code. - * @param code The authorization code. - * @param callback Optional callback fn. - */ - getToken(code: string): Promise; - getToken(options: GetTokenOptions): Promise; - getToken(code: string, callback: GetTokenCallback): void; - getToken(options: GetTokenOptions, callback: GetTokenCallback): void; - private getTokenAsync; - /** - * Refreshes the access token. - * @param refresh_token Existing refresh token. - * @private - */ - protected refreshToken(refreshToken?: string | null): Promise; - protected refreshTokenNoCache(refreshToken?: string | null): Promise; - /** - * Retrieves the access token using refresh token - * - * @deprecated use getRequestHeaders instead. - * @param callback callback - */ - refreshAccessToken(): Promise; - refreshAccessToken(callback: RefreshAccessTokenCallback): void; - private refreshAccessTokenAsync; - /** - * Get a non-expired access token, after refreshing if necessary - * - * @param callback Callback to call with the access token - */ - getAccessToken(): Promise; - getAccessToken(callback: GetAccessTokenCallback): void; - private getAccessTokenAsync; - /** - * The main authentication interface. It takes an optional url which when - * present is the endpoint being accessed, and returns a Promise which - * resolves with authorization header fields. - * - * In OAuth2Client, the result has the form: - * { Authorization: 'Bearer ' } - * @param url The optional url being authorized - */ - getRequestHeaders(url?: string): Promise; - protected getRequestMetadataAsync(url?: string | null): Promise; - /** - * Generates an URL to revoke the given token. - * @param token The existing token to be revoked. - */ - static getRevokeTokenUrl(token: string): string; - /** - * Revokes the access given to token. - * @param token The existing token to be revoked. - * @param callback Optional callback fn. - */ - revokeToken(token: string): GaxiosPromise; - revokeToken(token: string, callback: BodyResponseCallback): void; - /** - * Revokes access token and clears the credentials object - * @param callback callback - */ - revokeCredentials(): GaxiosPromise; - revokeCredentials(callback: BodyResponseCallback): void; - private revokeCredentialsAsync; - /** - * Provides a request implementation with OAuth 2.0 flow. If credentials have - * a refresh_token, in cases of HTTP 401 and 403 responses, it automatically - * asks for a new access token and replays the unsuccessful request. - * @param opts Request options. - * @param callback callback. - * @return Request object - */ - request(opts: GaxiosOptions): GaxiosPromise; - request(opts: GaxiosOptions, callback: BodyResponseCallback): void; - protected requestAsync(opts: GaxiosOptions, retry?: boolean): Promise>; - /** - * Verify id token is token by checking the certs and audience - * @param options that contains all options. - * @param callback Callback supplying GoogleLogin if successful - */ - verifyIdToken(options: VerifyIdTokenOptions): Promise; - verifyIdToken(options: VerifyIdTokenOptions, callback: (err: Error | null, login?: LoginTicket) => void): void; - private verifyIdTokenAsync; - /** - * Obtains information about the provisioned access token. Especially useful - * if you want to check the scopes that were provisioned to a given token. - * - * @param accessToken Required. The Access Token for which you want to get - * user info. - */ - getTokenInfo(accessToken: string): Promise; - /** - * Gets federated sign-on certificates to use for verifying identity tokens. - * Returns certs as array structure, where keys are key ids, and values - * are certificates in either PEM or JWK format. - * @param callback Callback supplying the certificates - */ - getFederatedSignonCerts(): Promise; - getFederatedSignonCerts(callback: GetFederatedSignonCertsCallback): void; - getFederatedSignonCertsAsync(): Promise; - /** - * Gets federated sign-on certificates to use for verifying identity tokens. - * Returns certs as array structure, where keys are key ids, and values - * are certificates in either PEM or JWK format. - * @param callback Callback supplying the certificates - */ - getIapPublicKeys(): Promise; - getIapPublicKeys(callback: GetIapPublicKeysCallback): void; - getIapPublicKeysAsync(): Promise; - verifySignedJwtWithCerts(): void; - /** - * Verify the id token is signed with the correct certificate - * and is from the correct audience. - * @param jwt The jwt to verify (The ID Token in this case). - * @param certs The array of certs to test the jwt against. - * @param requiredAudience The audience to test the jwt against. - * @param issuers The allowed issuers of the jwt (Optional). - * @param maxExpiry The max expiry the certificate can be (Optional). - * @return Returns a promise resolving to LoginTicket on verification. - */ - verifySignedJwtWithCertsAsync(jwt: string, certs: Certificates | PublicKeys, requiredAudience?: string | string[], issuers?: string[], maxExpiry?: number): Promise; - /** - * Returns true if a token is expired or will expire within - * eagerRefreshThresholdMillismilliseconds. - * If there is no expiry time, assumes the token is not expired or expiring. - */ - protected isTokenExpiring(): boolean; -} diff --git a/node_modules/google-auth-library/build/src/auth/oauth2client.js b/node_modules/google-auth-library/build/src/auth/oauth2client.js deleted file mode 100644 index a845f240..00000000 --- a/node_modules/google-auth-library/build/src/auth/oauth2client.js +++ /dev/null @@ -1,679 +0,0 @@ -"use strict"; -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OAuth2Client = exports.CertificateFormat = exports.CodeChallengeMethod = void 0; -const querystring = require("querystring"); -const stream = require("stream"); -const formatEcdsa = require("ecdsa-sig-formatter"); -const crypto_1 = require("../crypto/crypto"); -const authclient_1 = require("./authclient"); -const loginticket_1 = require("./loginticket"); -var CodeChallengeMethod; -(function (CodeChallengeMethod) { - CodeChallengeMethod["Plain"] = "plain"; - CodeChallengeMethod["S256"] = "S256"; -})(CodeChallengeMethod = exports.CodeChallengeMethod || (exports.CodeChallengeMethod = {})); -var CertificateFormat; -(function (CertificateFormat) { - CertificateFormat["PEM"] = "PEM"; - CertificateFormat["JWK"] = "JWK"; -})(CertificateFormat = exports.CertificateFormat || (exports.CertificateFormat = {})); -class OAuth2Client extends authclient_1.AuthClient { - constructor(optionsOrClientId, clientSecret, redirectUri) { - super(); - this.certificateCache = {}; - this.certificateExpiry = null; - this.certificateCacheFormat = CertificateFormat.PEM; - this.refreshTokenPromises = new Map(); - const opts = optionsOrClientId && typeof optionsOrClientId === 'object' - ? optionsOrClientId - : { clientId: optionsOrClientId, clientSecret, redirectUri }; - this._clientId = opts.clientId; - this._clientSecret = opts.clientSecret; - this.redirectUri = opts.redirectUri; - this.eagerRefreshThresholdMillis = - opts.eagerRefreshThresholdMillis || 5 * 60 * 1000; - this.forceRefreshOnFailure = !!opts.forceRefreshOnFailure; - } - /** - * Generates URL for consent page landing. - * @param opts Options. - * @return URL to consent page. - */ - generateAuthUrl(opts = {}) { - if (opts.code_challenge_method && !opts.code_challenge) { - throw new Error('If a code_challenge_method is provided, code_challenge must be included.'); - } - opts.response_type = opts.response_type || 'code'; - opts.client_id = opts.client_id || this._clientId; - opts.redirect_uri = opts.redirect_uri || this.redirectUri; - // Allow scopes to be passed either as array or a string - if (opts.scope instanceof Array) { - opts.scope = opts.scope.join(' '); - } - const rootUrl = OAuth2Client.GOOGLE_OAUTH2_AUTH_BASE_URL_; - return rootUrl + '?' + querystring.stringify(opts); - } - generateCodeVerifier() { - // To make the code compatible with browser SubtleCrypto we need to make - // this method async. - throw new Error('generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.'); - } - /** - * Convenience method to automatically generate a code_verifier, and its - * resulting SHA256. If used, this must be paired with a S256 - * code_challenge_method. - * - * For a full example see: - * https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/oauth2-codeVerifier.js - */ - async generateCodeVerifierAsync() { - // base64 encoding uses 6 bits per character, and we want to generate128 - // characters. 6*128/8 = 96. - const crypto = crypto_1.createCrypto(); - const randomString = crypto.randomBytesBase64(96); - // The valid characters in the code_verifier are [A-Z]/[a-z]/[0-9]/ - // "-"/"."/"_"/"~". Base64 encoded strings are pretty close, so we're just - // swapping out a few chars. - const codeVerifier = randomString - .replace(/\+/g, '~') - .replace(/=/g, '_') - .replace(/\//g, '-'); - // Generate the base64 encoded SHA256 - const unencodedCodeChallenge = await crypto.sha256DigestBase64(codeVerifier); - // We need to use base64UrlEncoding instead of standard base64 - const codeChallenge = unencodedCodeChallenge - .split('=')[0] - .replace(/\+/g, '-') - .replace(/\//g, '_'); - return { codeVerifier, codeChallenge }; - } - getToken(codeOrOptions, callback) { - const options = typeof codeOrOptions === 'string' ? { code: codeOrOptions } : codeOrOptions; - if (callback) { - this.getTokenAsync(options).then(r => callback(null, r.tokens, r.res), e => callback(e, null, e.response)); - } - else { - return this.getTokenAsync(options); - } - } - async getTokenAsync(options) { - const url = OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_; - const values = { - code: options.code, - client_id: options.client_id || this._clientId, - client_secret: this._clientSecret, - redirect_uri: options.redirect_uri || this.redirectUri, - grant_type: 'authorization_code', - code_verifier: options.codeVerifier, - }; - const res = await this.transporter.request({ - method: 'POST', - url, - data: querystring.stringify(values), - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - }); - const tokens = res.data; - if (res.data && res.data.expires_in) { - tokens.expiry_date = new Date().getTime() + res.data.expires_in * 1000; - delete tokens.expires_in; - } - this.emit('tokens', tokens); - return { tokens, res }; - } - /** - * Refreshes the access token. - * @param refresh_token Existing refresh token. - * @private - */ - async refreshToken(refreshToken) { - if (!refreshToken) { - return this.refreshTokenNoCache(refreshToken); - } - // If a request to refresh using the same token has started, - // return the same promise. - if (this.refreshTokenPromises.has(refreshToken)) { - return this.refreshTokenPromises.get(refreshToken); - } - const p = this.refreshTokenNoCache(refreshToken).then(r => { - this.refreshTokenPromises.delete(refreshToken); - return r; - }, e => { - this.refreshTokenPromises.delete(refreshToken); - throw e; - }); - this.refreshTokenPromises.set(refreshToken, p); - return p; - } - async refreshTokenNoCache(refreshToken) { - if (!refreshToken) { - throw new Error('No refresh token is set.'); - } - const url = OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_; - const data = { - refresh_token: refreshToken, - client_id: this._clientId, - client_secret: this._clientSecret, - grant_type: 'refresh_token', - }; - // request for new token - const res = await this.transporter.request({ - method: 'POST', - url, - data: querystring.stringify(data), - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - }); - const tokens = res.data; - // TODO: de-duplicate this code from a few spots - if (res.data && res.data.expires_in) { - tokens.expiry_date = new Date().getTime() + res.data.expires_in * 1000; - delete tokens.expires_in; - } - this.emit('tokens', tokens); - return { tokens, res }; - } - refreshAccessToken(callback) { - if (callback) { - this.refreshAccessTokenAsync().then(r => callback(null, r.credentials, r.res), callback); - } - else { - return this.refreshAccessTokenAsync(); - } - } - async refreshAccessTokenAsync() { - const r = await this.refreshToken(this.credentials.refresh_token); - const tokens = r.tokens; - tokens.refresh_token = this.credentials.refresh_token; - this.credentials = tokens; - return { credentials: this.credentials, res: r.res }; - } - getAccessToken(callback) { - if (callback) { - this.getAccessTokenAsync().then(r => callback(null, r.token, r.res), callback); - } - else { - return this.getAccessTokenAsync(); - } - } - async getAccessTokenAsync() { - const shouldRefresh = !this.credentials.access_token || this.isTokenExpiring(); - if (shouldRefresh) { - if (!this.credentials.refresh_token) { - throw new Error('No refresh token is set.'); - } - const r = await this.refreshAccessTokenAsync(); - if (!r.credentials || (r.credentials && !r.credentials.access_token)) { - throw new Error('Could not refresh access token.'); - } - return { token: r.credentials.access_token, res: r.res }; - } - else { - return { token: this.credentials.access_token }; - } - } - /** - * The main authentication interface. It takes an optional url which when - * present is the endpoint being accessed, and returns a Promise which - * resolves with authorization header fields. - * - * In OAuth2Client, the result has the form: - * { Authorization: 'Bearer ' } - * @param url The optional url being authorized - */ - async getRequestHeaders(url) { - const headers = (await this.getRequestMetadataAsync(url)).headers; - return headers; - } - async getRequestMetadataAsync( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - url) { - const thisCreds = this.credentials; - if (!thisCreds.access_token && !thisCreds.refresh_token && !this.apiKey) { - throw new Error('No access, refresh token or API key is set.'); - } - if (thisCreds.access_token && !this.isTokenExpiring()) { - thisCreds.token_type = thisCreds.token_type || 'Bearer'; - const headers = { - Authorization: thisCreds.token_type + ' ' + thisCreds.access_token, - }; - return { headers }; - } - if (this.apiKey) { - return { headers: { 'X-Goog-Api-Key': this.apiKey } }; - } - let r = null; - let tokens = null; - try { - r = await this.refreshToken(thisCreds.refresh_token); - tokens = r.tokens; - } - catch (err) { - const e = err; - if (e.response && - (e.response.status === 403 || e.response.status === 404)) { - e.message = `Could not refresh access token: ${e.message}`; - } - throw e; - } - const credentials = this.credentials; - credentials.token_type = credentials.token_type || 'Bearer'; - tokens.refresh_token = credentials.refresh_token; - this.credentials = tokens; - const headers = { - Authorization: credentials.token_type + ' ' + tokens.access_token, - }; - return { headers: this.addSharedMetadataHeaders(headers), res: r.res }; - } - /** - * Generates an URL to revoke the given token. - * @param token The existing token to be revoked. - */ - static getRevokeTokenUrl(token) { - const parameters = querystring.stringify({ token }); - return `${OAuth2Client.GOOGLE_OAUTH2_REVOKE_URL_}?${parameters}`; - } - revokeToken(token, callback) { - const opts = { - url: OAuth2Client.getRevokeTokenUrl(token), - method: 'POST', - }; - if (callback) { - this.transporter - .request(opts) - .then(r => callback(null, r), callback); - } - else { - return this.transporter.request(opts); - } - } - revokeCredentials(callback) { - if (callback) { - this.revokeCredentialsAsync().then(res => callback(null, res), callback); - } - else { - return this.revokeCredentialsAsync(); - } - } - async revokeCredentialsAsync() { - const token = this.credentials.access_token; - this.credentials = {}; - if (token) { - return this.revokeToken(token); - } - else { - throw new Error('No access token to revoke.'); - } - } - request(opts, callback) { - if (callback) { - this.requestAsync(opts).then(r => callback(null, r), e => { - return callback(e, e.response); - }); - } - else { - return this.requestAsync(opts); - } - } - async requestAsync(opts, retry = false) { - let r2; - try { - const r = await this.getRequestMetadataAsync(opts.url); - opts.headers = opts.headers || {}; - if (r.headers && r.headers['x-goog-user-project']) { - opts.headers['x-goog-user-project'] = r.headers['x-goog-user-project']; - } - if (r.headers && r.headers.Authorization) { - opts.headers.Authorization = r.headers.Authorization; - } - if (this.apiKey) { - opts.headers['X-Goog-Api-Key'] = this.apiKey; - } - r2 = await this.transporter.request(opts); - } - catch (e) { - const res = e.response; - if (res) { - const statusCode = res.status; - // Retry the request for metadata if the following criteria are true: - // - We haven't already retried. It only makes sense to retry once. - // - The response was a 401 or a 403 - // - The request didn't send a readableStream - // - An access_token and refresh_token were available, but either no - // expiry_date was available or the forceRefreshOnFailure flag is set. - // The absent expiry_date case can happen when developers stash the - // access_token and refresh_token for later use, but the access_token - // fails on the first try because it's expired. Some developers may - // choose to enable forceRefreshOnFailure to mitigate time-related - // errors. - const mayRequireRefresh = this.credentials && - this.credentials.access_token && - this.credentials.refresh_token && - (!this.credentials.expiry_date || this.forceRefreshOnFailure); - const isReadableStream = res.config.data instanceof stream.Readable; - const isAuthErr = statusCode === 401 || statusCode === 403; - if (!retry && isAuthErr && !isReadableStream && mayRequireRefresh) { - await this.refreshAccessTokenAsync(); - return this.requestAsync(opts, true); - } - } - throw e; - } - return r2; - } - verifyIdToken(options, callback) { - // This function used to accept two arguments instead of an options object. - // Check the types to help users upgrade with less pain. - // This check can be removed after a 2.0 release. - if (callback && typeof callback !== 'function') { - throw new Error('This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.'); - } - if (callback) { - this.verifyIdTokenAsync(options).then(r => callback(null, r), callback); - } - else { - return this.verifyIdTokenAsync(options); - } - } - async verifyIdTokenAsync(options) { - if (!options.idToken) { - throw new Error('The verifyIdToken method requires an ID Token'); - } - const response = await this.getFederatedSignonCertsAsync(); - const login = await this.verifySignedJwtWithCertsAsync(options.idToken, response.certs, options.audience, OAuth2Client.ISSUERS_, options.maxExpiry); - return login; - } - /** - * Obtains information about the provisioned access token. Especially useful - * if you want to check the scopes that were provisioned to a given token. - * - * @param accessToken Required. The Access Token for which you want to get - * user info. - */ - async getTokenInfo(accessToken) { - const { data } = await this.transporter.request({ - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - url: OAuth2Client.GOOGLE_TOKEN_INFO_URL, - data: querystring.stringify({ access_token: accessToken }), - }); - const info = Object.assign({ - expiry_date: new Date().getTime() + data.expires_in * 1000, - scopes: data.scope.split(' '), - }, data); - delete info.expires_in; - delete info.scope; - return info; - } - getFederatedSignonCerts(callback) { - if (callback) { - this.getFederatedSignonCertsAsync().then(r => callback(null, r.certs, r.res), callback); - } - else { - return this.getFederatedSignonCertsAsync(); - } - } - async getFederatedSignonCertsAsync() { - const nowTime = new Date().getTime(); - const format = crypto_1.hasBrowserCrypto() - ? CertificateFormat.JWK - : CertificateFormat.PEM; - if (this.certificateExpiry && - nowTime < this.certificateExpiry.getTime() && - this.certificateCacheFormat === format) { - return { certs: this.certificateCache, format }; - } - let res; - let url; - switch (format) { - case CertificateFormat.PEM: - url = OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_PEM_CERTS_URL_; - break; - case CertificateFormat.JWK: - url = OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_JWK_CERTS_URL_; - break; - default: - throw new Error(`Unsupported certificate format ${format}`); - } - try { - res = await this.transporter.request({ url }); - } - catch (e) { - e.message = `Failed to retrieve verification certificates: ${e.message}`; - throw e; - } - const cacheControl = res ? res.headers['cache-control'] : undefined; - let cacheAge = -1; - if (cacheControl) { - const pattern = new RegExp('max-age=([0-9]*)'); - const regexResult = pattern.exec(cacheControl); - if (regexResult && regexResult.length === 2) { - // Cache results with max-age (in seconds) - cacheAge = Number(regexResult[1]) * 1000; // milliseconds - } - } - let certificates = {}; - switch (format) { - case CertificateFormat.PEM: - certificates = res.data; - break; - case CertificateFormat.JWK: - for (const key of res.data.keys) { - certificates[key.kid] = key; - } - break; - default: - throw new Error(`Unsupported certificate format ${format}`); - } - const now = new Date(); - this.certificateExpiry = - cacheAge === -1 ? null : new Date(now.getTime() + cacheAge); - this.certificateCache = certificates; - this.certificateCacheFormat = format; - return { certs: certificates, format, res }; - } - getIapPublicKeys(callback) { - if (callback) { - this.getIapPublicKeysAsync().then(r => callback(null, r.pubkeys, r.res), callback); - } - else { - return this.getIapPublicKeysAsync(); - } - } - async getIapPublicKeysAsync() { - let res; - const url = OAuth2Client.GOOGLE_OAUTH2_IAP_PUBLIC_KEY_URL_; - try { - res = await this.transporter.request({ url }); - } - catch (e) { - e.message = `Failed to retrieve verification certificates: ${e.message}`; - throw e; - } - return { pubkeys: res.data, res }; - } - verifySignedJwtWithCerts() { - // To make the code compatible with browser SubtleCrypto we need to make - // this method async. - throw new Error('verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.'); - } - /** - * Verify the id token is signed with the correct certificate - * and is from the correct audience. - * @param jwt The jwt to verify (The ID Token in this case). - * @param certs The array of certs to test the jwt against. - * @param requiredAudience The audience to test the jwt against. - * @param issuers The allowed issuers of the jwt (Optional). - * @param maxExpiry The max expiry the certificate can be (Optional). - * @return Returns a promise resolving to LoginTicket on verification. - */ - async verifySignedJwtWithCertsAsync(jwt, certs, requiredAudience, issuers, maxExpiry) { - const crypto = crypto_1.createCrypto(); - if (!maxExpiry) { - maxExpiry = OAuth2Client.MAX_TOKEN_LIFETIME_SECS_; - } - const segments = jwt.split('.'); - if (segments.length !== 3) { - throw new Error('Wrong number of segments in token: ' + jwt); - } - const signed = segments[0] + '.' + segments[1]; - let signature = segments[2]; - let envelope; - let payload; - try { - envelope = JSON.parse(crypto.decodeBase64StringUtf8(segments[0])); - } - catch (err) { - err.message = `Can't parse token envelope: ${segments[0]}': ${err.message}`; - throw err; - } - if (!envelope) { - throw new Error("Can't parse token envelope: " + segments[0]); - } - try { - payload = JSON.parse(crypto.decodeBase64StringUtf8(segments[1])); - } - catch (err) { - err.message = `Can't parse token payload '${segments[0]}`; - throw err; - } - if (!payload) { - throw new Error("Can't parse token payload: " + segments[1]); - } - if (!Object.prototype.hasOwnProperty.call(certs, envelope.kid)) { - // If this is not present, then there's no reason to attempt verification - throw new Error('No pem found for envelope: ' + JSON.stringify(envelope)); - } - const cert = certs[envelope.kid]; - if (envelope.alg === 'ES256') { - signature = formatEcdsa.joseToDer(signature, 'ES256').toString('base64'); - } - const verified = await crypto.verify(cert, signed, signature); - if (!verified) { - throw new Error('Invalid token signature: ' + jwt); - } - if (!payload.iat) { - throw new Error('No issue time in token: ' + JSON.stringify(payload)); - } - if (!payload.exp) { - throw new Error('No expiration time in token: ' + JSON.stringify(payload)); - } - const iat = Number(payload.iat); - if (isNaN(iat)) - throw new Error('iat field using invalid format'); - const exp = Number(payload.exp); - if (isNaN(exp)) - throw new Error('exp field using invalid format'); - const now = new Date().getTime() / 1000; - if (exp >= now + maxExpiry) { - throw new Error('Expiration time too far in future: ' + JSON.stringify(payload)); - } - const earliest = iat - OAuth2Client.CLOCK_SKEW_SECS_; - const latest = exp + OAuth2Client.CLOCK_SKEW_SECS_; - if (now < earliest) { - throw new Error('Token used too early, ' + - now + - ' < ' + - earliest + - ': ' + - JSON.stringify(payload)); - } - if (now > latest) { - throw new Error('Token used too late, ' + - now + - ' > ' + - latest + - ': ' + - JSON.stringify(payload)); - } - if (issuers && issuers.indexOf(payload.iss) < 0) { - throw new Error('Invalid issuer, expected one of [' + - issuers + - '], but got ' + - payload.iss); - } - // Check the audience matches if we have one - if (typeof requiredAudience !== 'undefined' && requiredAudience !== null) { - const aud = payload.aud; - let audVerified = false; - // If the requiredAudience is an array, check if it contains token - // audience - if (requiredAudience.constructor === Array) { - audVerified = requiredAudience.indexOf(aud) > -1; - } - else { - audVerified = aud === requiredAudience; - } - if (!audVerified) { - throw new Error('Wrong recipient, payload audience != requiredAudience'); - } - } - return new loginticket_1.LoginTicket(envelope, payload); - } - /** - * Returns true if a token is expired or will expire within - * eagerRefreshThresholdMillismilliseconds. - * If there is no expiry time, assumes the token is not expired or expiring. - */ - isTokenExpiring() { - const expiryDate = this.credentials.expiry_date; - return expiryDate - ? expiryDate <= new Date().getTime() + this.eagerRefreshThresholdMillis - : false; - } -} -exports.OAuth2Client = OAuth2Client; -OAuth2Client.GOOGLE_TOKEN_INFO_URL = 'https://oauth2.googleapis.com/tokeninfo'; -/** - * The base URL for auth endpoints. - */ -OAuth2Client.GOOGLE_OAUTH2_AUTH_BASE_URL_ = 'https://accounts.google.com/o/oauth2/v2/auth'; -/** - * The base endpoint for token retrieval. - */ -OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_ = 'https://oauth2.googleapis.com/token'; -/** - * The base endpoint to revoke tokens. - */ -OAuth2Client.GOOGLE_OAUTH2_REVOKE_URL_ = 'https://oauth2.googleapis.com/revoke'; -/** - * Google Sign on certificates in PEM format. - */ -OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_PEM_CERTS_URL_ = 'https://www.googleapis.com/oauth2/v1/certs'; -/** - * Google Sign on certificates in JWK format. - */ -OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_JWK_CERTS_URL_ = 'https://www.googleapis.com/oauth2/v3/certs'; -/** - * Google Sign on certificates in JWK format. - */ -OAuth2Client.GOOGLE_OAUTH2_IAP_PUBLIC_KEY_URL_ = 'https://www.gstatic.com/iap/verify/public_key'; -/** - * Clock skew - five minutes in seconds - */ -OAuth2Client.CLOCK_SKEW_SECS_ = 300; -/** - * Max Token Lifetime is one day in seconds - */ -OAuth2Client.MAX_TOKEN_LIFETIME_SECS_ = 86400; -/** - * The allowed oauth token issuers. - */ -OAuth2Client.ISSUERS_ = [ - 'accounts.google.com', - 'https://accounts.google.com', -]; -//# sourceMappingURL=oauth2client.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/auth/refreshclient.d.ts b/node_modules/google-auth-library/build/src/auth/refreshclient.d.ts deleted file mode 100644 index 65a588db..00000000 --- a/node_modules/google-auth-library/build/src/auth/refreshclient.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// -import * as stream from 'stream'; -import { JWTInput } from './credentials'; -import { GetTokenResponse, OAuth2Client, RefreshOptions } from './oauth2client'; -export interface UserRefreshClientOptions extends RefreshOptions { - clientId?: string; - clientSecret?: string; - refreshToken?: string; -} -export declare class UserRefreshClient extends OAuth2Client { - _refreshToken?: string | null; - /** - * User Refresh Token credentials. - * - * @param clientId The authentication client ID. - * @param clientSecret The authentication client secret. - * @param refreshToken The authentication refresh token. - */ - constructor(clientId?: string, clientSecret?: string, refreshToken?: string); - constructor(options: UserRefreshClientOptions); - constructor(clientId?: string, clientSecret?: string, refreshToken?: string); - /** - * Refreshes the access token. - * @param refreshToken An ignored refreshToken.. - * @param callback Optional callback. - */ - protected refreshTokenNoCache(refreshToken?: string | null): Promise; - /** - * Create a UserRefreshClient credentials instance using the given input - * options. - * @param json The input object. - */ - fromJSON(json: JWTInput): void; - /** - * Create a UserRefreshClient credentials instance using the given input - * stream. - * @param inputStream The input stream. - * @param callback Optional callback. - */ - fromStream(inputStream: stream.Readable): Promise; - fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void; - private fromStreamAsync; -} diff --git a/node_modules/google-auth-library/build/src/auth/refreshclient.js b/node_modules/google-auth-library/build/src/auth/refreshclient.js deleted file mode 100644 index 6e6eeae7..00000000 --- a/node_modules/google-auth-library/build/src/auth/refreshclient.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -// Copyright 2015 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.UserRefreshClient = void 0; -const oauth2client_1 = require("./oauth2client"); -class UserRefreshClient extends oauth2client_1.OAuth2Client { - constructor(optionsOrClientId, clientSecret, refreshToken, eagerRefreshThresholdMillis, forceRefreshOnFailure) { - const opts = optionsOrClientId && typeof optionsOrClientId === 'object' - ? optionsOrClientId - : { - clientId: optionsOrClientId, - clientSecret, - refreshToken, - eagerRefreshThresholdMillis, - forceRefreshOnFailure, - }; - super({ - clientId: opts.clientId, - clientSecret: opts.clientSecret, - eagerRefreshThresholdMillis: opts.eagerRefreshThresholdMillis, - forceRefreshOnFailure: opts.forceRefreshOnFailure, - }); - this._refreshToken = opts.refreshToken; - this.credentials.refresh_token = opts.refreshToken; - } - /** - * Refreshes the access token. - * @param refreshToken An ignored refreshToken.. - * @param callback Optional callback. - */ - async refreshTokenNoCache( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - refreshToken) { - return super.refreshTokenNoCache(this._refreshToken); - } - /** - * Create a UserRefreshClient credentials instance using the given input - * options. - * @param json The input object. - */ - fromJSON(json) { - if (!json) { - throw new Error('Must pass in a JSON object containing the user refresh token'); - } - if (json.type !== 'authorized_user') { - throw new Error('The incoming JSON object does not have the "authorized_user" type'); - } - if (!json.client_id) { - throw new Error('The incoming JSON object does not contain a client_id field'); - } - if (!json.client_secret) { - throw new Error('The incoming JSON object does not contain a client_secret field'); - } - if (!json.refresh_token) { - throw new Error('The incoming JSON object does not contain a refresh_token field'); - } - this._clientId = json.client_id; - this._clientSecret = json.client_secret; - this._refreshToken = json.refresh_token; - this.credentials.refresh_token = json.refresh_token; - this.quotaProjectId = json.quota_project_id; - } - fromStream(inputStream, callback) { - if (callback) { - this.fromStreamAsync(inputStream).then(() => callback(), callback); - } - else { - return this.fromStreamAsync(inputStream); - } - } - async fromStreamAsync(inputStream) { - return new Promise((resolve, reject) => { - if (!inputStream) { - return reject(new Error('Must pass in a stream containing the user refresh token.')); - } - let s = ''; - inputStream - .setEncoding('utf8') - .on('error', reject) - .on('data', chunk => (s += chunk)) - .on('end', () => { - try { - const data = JSON.parse(s); - this.fromJSON(data); - return resolve(); - } - catch (err) { - return reject(err); - } - }); - }); - } -} -exports.UserRefreshClient = UserRefreshClient; -//# sourceMappingURL=refreshclient.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/crypto/browser/crypto.d.ts b/node_modules/google-auth-library/build/src/crypto/browser/crypto.d.ts deleted file mode 100644 index f7949a0c..00000000 --- a/node_modules/google-auth-library/build/src/crypto/browser/crypto.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Crypto, JwkCertificate } from '../crypto'; -export declare class BrowserCrypto implements Crypto { - constructor(); - sha256DigestBase64(str: string): Promise; - randomBytesBase64(count: number): string; - private static padBase64; - verify(pubkey: JwkCertificate, data: string, signature: string): Promise; - sign(privateKey: JwkCertificate, data: string): Promise; - decodeBase64StringUtf8(base64: string): string; - encodeBase64StringUtf8(text: string): string; -} diff --git a/node_modules/google-auth-library/build/src/crypto/browser/crypto.js b/node_modules/google-auth-library/build/src/crypto/browser/crypto.js deleted file mode 100644 index 69718413..00000000 --- a/node_modules/google-auth-library/build/src/crypto/browser/crypto.js +++ /dev/null @@ -1,100 +0,0 @@ -"use strict"; -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/* global window */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BrowserCrypto = void 0; -// This file implements crypto functions we need using in-browser -// SubtleCrypto interface `window.crypto.subtle`. -const base64js = require("base64-js"); -// Not all browsers support `TextEncoder`. The following `require` will -// provide a fast UTF8-only replacement for those browsers that don't support -// text encoding natively. -// eslint-disable-next-line node/no-unsupported-features/node-builtins -if (typeof process === 'undefined' && typeof TextEncoder === 'undefined') { - require('fast-text-encoding'); -} -class BrowserCrypto { - constructor() { - if (typeof window === 'undefined' || - window.crypto === undefined || - window.crypto.subtle === undefined) { - throw new Error("SubtleCrypto not found. Make sure it's an https:// website."); - } - } - async sha256DigestBase64(str) { - // SubtleCrypto digest() method is async, so we must make - // this method async as well. - // To calculate SHA256 digest using SubtleCrypto, we first - // need to convert an input string to an ArrayBuffer: - // eslint-disable-next-line node/no-unsupported-features/node-builtins - const inputBuffer = new TextEncoder().encode(str); - // Result is ArrayBuffer as well. - const outputBuffer = await window.crypto.subtle.digest('SHA-256', inputBuffer); - return base64js.fromByteArray(new Uint8Array(outputBuffer)); - } - randomBytesBase64(count) { - const array = new Uint8Array(count); - window.crypto.getRandomValues(array); - return base64js.fromByteArray(array); - } - static padBase64(base64) { - // base64js requires padding, so let's add some '=' - while (base64.length % 4 !== 0) { - base64 += '='; - } - return base64; - } - async verify(pubkey, data, signature) { - const algo = { - name: 'RSASSA-PKCS1-v1_5', - hash: { name: 'SHA-256' }, - }; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - const dataArray = new TextEncoder().encode(data); - const signatureArray = base64js.toByteArray(BrowserCrypto.padBase64(signature)); - const cryptoKey = await window.crypto.subtle.importKey('jwk', pubkey, algo, true, ['verify']); - // SubtleCrypto's verify method is async so we must make - // this method async as well. - const result = await window.crypto.subtle.verify(algo, cryptoKey, signatureArray, dataArray); - return result; - } - async sign(privateKey, data) { - const algo = { - name: 'RSASSA-PKCS1-v1_5', - hash: { name: 'SHA-256' }, - }; - // eslint-disable-next-line node/no-unsupported-features/node-builtins - const dataArray = new TextEncoder().encode(data); - const cryptoKey = await window.crypto.subtle.importKey('jwk', privateKey, algo, true, ['sign']); - // SubtleCrypto's sign method is async so we must make - // this method async as well. - const result = await window.crypto.subtle.sign(algo, cryptoKey, dataArray); - return base64js.fromByteArray(new Uint8Array(result)); - } - decodeBase64StringUtf8(base64) { - const uint8array = base64js.toByteArray(BrowserCrypto.padBase64(base64)); - // eslint-disable-next-line node/no-unsupported-features/node-builtins - const result = new TextDecoder().decode(uint8array); - return result; - } - encodeBase64StringUtf8(text) { - // eslint-disable-next-line node/no-unsupported-features/node-builtins - const uint8array = new TextEncoder().encode(text); - const result = base64js.fromByteArray(uint8array); - return result; - } -} -exports.BrowserCrypto = BrowserCrypto; -//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/crypto/crypto.d.ts b/node_modules/google-auth-library/build/src/crypto/crypto.d.ts deleted file mode 100644 index 84adc068..00000000 --- a/node_modules/google-auth-library/build/src/crypto/crypto.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// -export interface JwkCertificate { - kty: string; - alg: string; - use?: string; - kid: string; - n: string; - e: string; -} -export interface CryptoSigner { - update(data: string): void; - sign(key: string, outputFormat: string): string; -} -export interface Crypto { - sha256DigestBase64(str: string): Promise; - randomBytesBase64(n: number): string; - verify(pubkey: string | JwkCertificate, data: string | Buffer, signature: string): Promise; - sign(privateKey: string | JwkCertificate, data: string | Buffer): Promise; - decodeBase64StringUtf8(base64: string): string; - encodeBase64StringUtf8(text: string): string; -} -export declare function createCrypto(): Crypto; -export declare function hasBrowserCrypto(): boolean; diff --git a/node_modules/google-auth-library/build/src/crypto/crypto.js b/node_modules/google-auth-library/build/src/crypto/crypto.js deleted file mode 100644 index 5f39aa01..00000000 --- a/node_modules/google-auth-library/build/src/crypto/crypto.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/* global window */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.hasBrowserCrypto = exports.createCrypto = void 0; -const crypto_1 = require("./browser/crypto"); -const crypto_2 = require("./node/crypto"); -function createCrypto() { - if (hasBrowserCrypto()) { - return new crypto_1.BrowserCrypto(); - } - return new crypto_2.NodeCrypto(); -} -exports.createCrypto = createCrypto; -function hasBrowserCrypto() { - return (typeof window !== 'undefined' && - typeof window.crypto !== 'undefined' && - typeof window.crypto.subtle !== 'undefined'); -} -exports.hasBrowserCrypto = hasBrowserCrypto; -//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/crypto/node/crypto.d.ts b/node_modules/google-auth-library/build/src/crypto/node/crypto.d.ts deleted file mode 100644 index e04cb207..00000000 --- a/node_modules/google-auth-library/build/src/crypto/node/crypto.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// -import { Crypto } from '../crypto'; -export declare class NodeCrypto implements Crypto { - sha256DigestBase64(str: string): Promise; - randomBytesBase64(count: number): string; - verify(pubkey: string, data: string | Buffer, signature: string): Promise; - sign(privateKey: string, data: string | Buffer): Promise; - decodeBase64StringUtf8(base64: string): string; - encodeBase64StringUtf8(text: string): string; -} diff --git a/node_modules/google-auth-library/build/src/crypto/node/crypto.js b/node_modules/google-auth-library/build/src/crypto/node/crypto.js deleted file mode 100644 index 3710b344..00000000 --- a/node_modules/google-auth-library/build/src/crypto/node/crypto.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NodeCrypto = void 0; -const crypto = require("crypto"); -class NodeCrypto { - async sha256DigestBase64(str) { - return crypto.createHash('sha256').update(str).digest('base64'); - } - randomBytesBase64(count) { - return crypto.randomBytes(count).toString('base64'); - } - async verify(pubkey, data, signature) { - const verifier = crypto.createVerify('sha256'); - verifier.update(data); - verifier.end(); - return verifier.verify(pubkey, signature, 'base64'); - } - async sign(privateKey, data) { - const signer = crypto.createSign('RSA-SHA256'); - signer.update(data); - signer.end(); - return signer.sign(privateKey, 'base64'); - } - decodeBase64StringUtf8(base64) { - return Buffer.from(base64, 'base64').toString('utf-8'); - } - encodeBase64StringUtf8(text) { - return Buffer.from(text, 'utf-8').toString('base64'); - } -} -exports.NodeCrypto = NodeCrypto; -//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/index.d.ts b/node_modules/google-auth-library/build/src/index.d.ts deleted file mode 100644 index 30ea45e9..00000000 --- a/node_modules/google-auth-library/build/src/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { GoogleAuth } from './auth/googleauth'; -export { Compute, ComputeOptions } from './auth/computeclient'; -export { CredentialBody, CredentialRequest, Credentials, JWTInput, } from './auth/credentials'; -export { GCPEnv } from './auth/envDetect'; -export { GoogleAuthOptions, ProjectIdCallback } from './auth/googleauth'; -export { IAMAuth, RequestMetadata } from './auth/iam'; -export { IdTokenClient, IdTokenProvider } from './auth/idtokenclient'; -export { Claims, JWTAccess } from './auth/jwtaccess'; -export { JWT, JWTOptions } from './auth/jwtclient'; -export { Certificates, CodeChallengeMethod, CodeVerifierResults, GenerateAuthUrlOpts, GetTokenOptions, OAuth2Client, OAuth2ClientOptions, RefreshOptions, TokenInfo, VerifyIdTokenOptions, } from './auth/oauth2client'; -export { LoginTicket, TokenPayload } from './auth/loginticket'; -export { UserRefreshClient, UserRefreshClientOptions, } from './auth/refreshclient'; -export { DefaultTransporter } from './transporters'; -declare const auth: GoogleAuth; -export { auth, GoogleAuth }; diff --git a/node_modules/google-auth-library/build/src/index.js b/node_modules/google-auth-library/build/src/index.js deleted file mode 100644 index 05b27038..00000000 --- a/node_modules/google-auth-library/build/src/index.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GoogleAuth = exports.auth = void 0; -// Copyright 2017 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -const googleauth_1 = require("./auth/googleauth"); -Object.defineProperty(exports, "GoogleAuth", { enumerable: true, get: function () { return googleauth_1.GoogleAuth; } }); -var computeclient_1 = require("./auth/computeclient"); -Object.defineProperty(exports, "Compute", { enumerable: true, get: function () { return computeclient_1.Compute; } }); -var envDetect_1 = require("./auth/envDetect"); -Object.defineProperty(exports, "GCPEnv", { enumerable: true, get: function () { return envDetect_1.GCPEnv; } }); -var iam_1 = require("./auth/iam"); -Object.defineProperty(exports, "IAMAuth", { enumerable: true, get: function () { return iam_1.IAMAuth; } }); -var idtokenclient_1 = require("./auth/idtokenclient"); -Object.defineProperty(exports, "IdTokenClient", { enumerable: true, get: function () { return idtokenclient_1.IdTokenClient; } }); -var jwtaccess_1 = require("./auth/jwtaccess"); -Object.defineProperty(exports, "JWTAccess", { enumerable: true, get: function () { return jwtaccess_1.JWTAccess; } }); -var jwtclient_1 = require("./auth/jwtclient"); -Object.defineProperty(exports, "JWT", { enumerable: true, get: function () { return jwtclient_1.JWT; } }); -var oauth2client_1 = require("./auth/oauth2client"); -Object.defineProperty(exports, "CodeChallengeMethod", { enumerable: true, get: function () { return oauth2client_1.CodeChallengeMethod; } }); -Object.defineProperty(exports, "OAuth2Client", { enumerable: true, get: function () { return oauth2client_1.OAuth2Client; } }); -var loginticket_1 = require("./auth/loginticket"); -Object.defineProperty(exports, "LoginTicket", { enumerable: true, get: function () { return loginticket_1.LoginTicket; } }); -var refreshclient_1 = require("./auth/refreshclient"); -Object.defineProperty(exports, "UserRefreshClient", { enumerable: true, get: function () { return refreshclient_1.UserRefreshClient; } }); -var transporters_1 = require("./transporters"); -Object.defineProperty(exports, "DefaultTransporter", { enumerable: true, get: function () { return transporters_1.DefaultTransporter; } }); -const auth = new googleauth_1.GoogleAuth(); -exports.auth = auth; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/messages.d.ts b/node_modules/google-auth-library/build/src/messages.d.ts deleted file mode 100644 index 9de99bc7..00000000 --- a/node_modules/google-auth-library/build/src/messages.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export declare enum WarningTypes { - WARNING = "Warning", - DEPRECATION = "DeprecationWarning" -} -export declare function warn(warning: Warning): void; -export interface Warning { - code: string; - type: WarningTypes; - message: string; - warned?: boolean; -} diff --git a/node_modules/google-auth-library/build/src/messages.js b/node_modules/google-auth-library/build/src/messages.js deleted file mode 100644 index d4320dc0..00000000 --- a/node_modules/google-auth-library/build/src/messages.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.warn = exports.WarningTypes = void 0; -var WarningTypes; -(function (WarningTypes) { - WarningTypes["WARNING"] = "Warning"; - WarningTypes["DEPRECATION"] = "DeprecationWarning"; -})(WarningTypes = exports.WarningTypes || (exports.WarningTypes = {})); -function warn(warning) { - // Only show a given warning once - if (warning.warned) { - return; - } - warning.warned = true; - if (typeof process !== 'undefined' && process.emitWarning) { - // @types/node doesn't recognize the emitWarning syntax which - // accepts a config object, so `as any` it is - // https://nodejs.org/docs/latest-v8.x/api/process.html#process_process_emitwarning_warning_options - // eslint-disable-next-line @typescript-eslint/no-explicit-any - process.emitWarning(warning.message, warning); - } - else { - console.warn(warning.message); - } -} -exports.warn = warn; -//# sourceMappingURL=messages.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/options.d.ts b/node_modules/google-auth-library/build/src/options.d.ts deleted file mode 100644 index ede9689d..00000000 --- a/node_modules/google-auth-library/build/src/options.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function validate(options: any): void; diff --git a/node_modules/google-auth-library/build/src/options.js b/node_modules/google-auth-library/build/src/options.js deleted file mode 100644 index e935c70d..00000000 --- a/node_modules/google-auth-library/build/src/options.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -// Copyright 2017 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validate = void 0; -// Accepts an options object passed from the user to the API. In the -// previous version of the API, it referred to a `Request` options object. -// Now it refers to an Axiox Request Config object. This is here to help -// ensure users don't pass invalid options when they upgrade from 0.x to 1.x. -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function validate(options) { - const vpairs = [ - { invalid: 'uri', expected: 'url' }, - { invalid: 'json', expected: 'data' }, - { invalid: 'qs', expected: 'params' }, - ]; - for (const pair of vpairs) { - if (options[pair.invalid]) { - const e = `'${pair.invalid}' is not a valid configuration option. Please use '${pair.expected}' instead. This library is using Axios for requests. Please see https://github.com/axios/axios to learn more about the valid request options.`; - throw new Error(e); - } - } -} -exports.validate = validate; -//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/build/src/transporters.d.ts b/node_modules/google-auth-library/build/src/transporters.d.ts deleted file mode 100644 index 16b5c5ef..00000000 --- a/node_modules/google-auth-library/build/src/transporters.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { GaxiosError, GaxiosOptions, GaxiosPromise, GaxiosResponse } from 'gaxios'; -export interface Transporter { - request(opts: GaxiosOptions): GaxiosPromise; - request(opts: GaxiosOptions, callback?: BodyResponseCallback): void; - request(opts: GaxiosOptions, callback?: BodyResponseCallback): GaxiosPromise | void; -} -export interface BodyResponseCallback { - (err: Error | null, res?: GaxiosResponse | null): void; -} -export interface RequestError extends GaxiosError { - errors: Error[]; -} -export declare class DefaultTransporter { - /** - * Default user agent. - */ - static readonly USER_AGENT: string; - /** - * Configures request options before making a request. - * @param opts GaxiosOptions options. - * @return Configured options. - */ - configure(opts?: GaxiosOptions): GaxiosOptions; - /** - * Makes a request using Gaxios with given options. - * @param opts GaxiosOptions options. - * @param callback optional callback that contains GaxiosResponse object. - * @return GaxiosPromise, assuming no callback is passed. - */ - request(opts: GaxiosOptions): GaxiosPromise; - request(opts: GaxiosOptions, callback?: BodyResponseCallback): void; - /** - * Changes the error to include details from the body. - */ - private processError; -} diff --git a/node_modules/google-auth-library/build/src/transporters.js b/node_modules/google-auth-library/build/src/transporters.js deleted file mode 100644 index 98dc8387..00000000 --- a/node_modules/google-auth-library/build/src/transporters.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DefaultTransporter = void 0; -const gaxios_1 = require("gaxios"); -const options_1 = require("./options"); -// eslint-disable-next-line @typescript-eslint/no-var-requires -const pkg = require('../../package.json'); -const PRODUCT_NAME = 'google-api-nodejs-client'; -class DefaultTransporter { - /** - * Configures request options before making a request. - * @param opts GaxiosOptions options. - * @return Configured options. - */ - configure(opts = {}) { - opts.headers = opts.headers || {}; - if (typeof window === 'undefined') { - // set transporter user agent if not in browser - const uaValue = opts.headers['User-Agent']; - if (!uaValue) { - opts.headers['User-Agent'] = DefaultTransporter.USER_AGENT; - } - else if (!uaValue.includes(`${PRODUCT_NAME}/`)) { - opts.headers['User-Agent'] = `${uaValue} ${DefaultTransporter.USER_AGENT}`; - } - // track google-auth-library-nodejs version: - const authVersion = `auth/${pkg.version}`; - if (opts.headers['x-goog-api-client'] && - !opts.headers['x-goog-api-client'].includes(authVersion)) { - opts.headers['x-goog-api-client'] = `${opts.headers['x-goog-api-client']} ${authVersion}`; - } - else if (!opts.headers['x-goog-api-client']) { - const nodeVersion = process.version.replace(/^v/, ''); - opts.headers['x-goog-api-client'] = `gl-node/${nodeVersion} ${authVersion}`; - } - } - return opts; - } - request(opts, callback) { - // ensure the user isn't passing in request-style options - opts = this.configure(opts); - try { - options_1.validate(opts); - } - catch (e) { - if (callback) { - return callback(e); - } - else { - throw e; - } - } - if (callback) { - gaxios_1.request(opts).then(r => { - callback(null, r); - }, e => { - callback(this.processError(e)); - }); - } - else { - return gaxios_1.request(opts).catch(e => { - throw this.processError(e); - }); - } - } - /** - * Changes the error to include details from the body. - */ - processError(e) { - const res = e.response; - const err = e; - const body = res ? res.data : null; - if (res && body && body.error && res.status !== 200) { - if (typeof body.error === 'string') { - err.message = body.error; - err.code = res.status.toString(); - } - else if (Array.isArray(body.error.errors)) { - err.message = body.error.errors - .map((err2) => err2.message) - .join('\n'); - err.code = body.error.code; - err.errors = body.error.errors; - } - else { - err.message = body.error.message; - err.code = body.error.code || res.status; - } - } - else if (res && res.status >= 400) { - // Consider all 4xx and 5xx responses errors. - err.message = body; - err.code = res.status.toString(); - } - return err; - } -} -exports.DefaultTransporter = DefaultTransporter; -/** - * Default user agent. - */ -DefaultTransporter.USER_AGENT = `${PRODUCT_NAME}/${pkg.version}`; -//# sourceMappingURL=transporters.js.map \ No newline at end of file diff --git a/node_modules/google-auth-library/package.json b/node_modules/google-auth-library/package.json deleted file mode 100644 index da10f381..00000000 --- a/node_modules/google-auth-library/package.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "_from": "google-auth-library", - "_id": "google-auth-library@6.1.1", - "_inBundle": false, - "_integrity": "sha512-0WfExOx3FrLYnY88RICQxvpaNzdwjz44OsHqHkIoAJfjY6Jck6CZRl1ASWadk+wbJ0LhkQ8rNY4zZebKml4Ghg==", - "_location": "/google-auth-library", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "google-auth-library", - "name": "google-auth-library", - "escapedName": "google-auth-library", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.1.1.tgz", - "_shasum": "e1882ac22e8a073dd7a7296e500d5c0c6dc21933", - "_spec": "google-auth-library", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Google Inc." - }, - "bugs": { - "url": "https://github.com/googleapis/google-auth-library-nodejs/issues" - }, - "bundleDependencies": false, - "dependencies": { - "arrify": "^2.0.0", - "base64-js": "^1.3.0", - "ecdsa-sig-formatter": "^1.0.11", - "fast-text-encoding": "^1.0.0", - "gaxios": "^3.0.0", - "gcp-metadata": "^4.1.0", - "gtoken": "^5.0.4", - "jws": "^4.0.0", - "lru-cache": "^6.0.0" - }, - "deprecated": false, - "description": "Google APIs Authentication Client Library for Node.js", - "devDependencies": { - "@compodoc/compodoc": "^1.1.7", - "@microsoft/api-documenter": "^7.8.10", - "@microsoft/api-extractor": "^7.8.10", - "@types/base64-js": "^1.2.5", - "@types/chai": "^4.1.7", - "@types/jws": "^3.1.0", - "@types/lru-cache": "^5.0.0", - "@types/mocha": "^8.0.0", - "@types/mv": "^2.1.0", - "@types/ncp": "^2.0.1", - "@types/node": "^10.5.1", - "@types/sinon": "^9.0.0", - "@types/tmp": "^0.2.0", - "assert-rejects": "^1.0.0", - "c8": "^7.0.0", - "chai": "^4.2.0", - "codecov": "^3.0.2", - "execa": "^4.0.0", - "gts": "^2.0.0", - "is-docker": "^2.0.0", - "karma": "^5.0.0", - "karma-chrome-launcher": "^3.0.0", - "karma-coverage": "^2.0.0", - "karma-firefox-launcher": "^1.1.0", - "karma-mocha": "^2.0.0", - "karma-remap-coverage": "^0.1.5", - "karma-sourcemap-loader": "^0.3.7", - "karma-webpack": "^4.0.0", - "keypair": "^1.0.1", - "linkinator": "^2.0.0", - "mocha": "^8.0.0", - "mv": "^2.1.1", - "ncp": "^2.0.0", - "nock": "^13.0.0", - "null-loader": "^4.0.0", - "puppeteer": "^5.0.0", - "sinon": "^9.0.0", - "tmp": "^0.2.0", - "ts-loader": "^8.0.0", - "typescript": "^3.8.3", - "webpack": "^4.20.2", - "webpack-cli": "^3.1.1" - }, - "engines": { - "node": ">=10" - }, - "files": [ - "build/src", - "!build/src/**/*.map" - ], - "homepage": "https://github.com/googleapis/google-auth-library-nodejs#readme", - "keywords": [ - "google", - "api", - "google apis", - "client", - "client library" - ], - "license": "Apache-2.0", - "main": "./build/src/index.js", - "name": "google-auth-library", - "repository": { - "type": "git", - "url": "git+https://github.com/googleapis/google-auth-library-nodejs.git" - }, - "scripts": { - "api-documenter": "api-documenter yaml --input-folder=temp", - "api-extractor": "api-extractor run --local", - "browser-test": "karma start", - "clean": "gts clean", - "compile": "tsc -p .", - "docs": "compodoc src/", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "precompile": "gts clean", - "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm install", - "prepare": "npm run compile", - "presystem-test": "npm run compile", - "pretest": "npm run compile", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha build/system-test --timeout 60000", - "test": "c8 mocha build/test", - "webpack": "webpack" - }, - "types": "./build/src/index.d.ts", - "version": "6.1.1" -} diff --git a/node_modules/google-p12-pem/CHANGELOG.md b/node_modules/google-p12-pem/CHANGELOG.md deleted file mode 100644 index 1d14e412..00000000 --- a/node_modules/google-p12-pem/CHANGELOG.md +++ /dev/null @@ -1,187 +0,0 @@ -# Changelog - -[npm history][1] - -[1]: https://www.npmjs.com/package/google-p12-pem?activeTab=versions - -### [3.0.3](https://www.github.com/googleapis/google-p12-pem/compare/v3.0.2...v3.0.3) (2020-09-02) - - -### Bug Fixes - -* **deps:** update dependency node-forge to ^0.10.0 ([#291](https://www.github.com/googleapis/google-p12-pem/issues/291)) ([0694c2e](https://www.github.com/googleapis/google-p12-pem/commit/0694c2ed1f8a0783cdab3b5e7ecb31a0b975bde5)) - -### [3.0.2](https://www.github.com/googleapis/google-p12-pem/compare/v3.0.1...v3.0.2) (2020-07-09) - - -### Bug Fixes - -* typeo in nodejs .gitattribute ([#270](https://www.github.com/googleapis/google-p12-pem/issues/270)) ([046f594](https://www.github.com/googleapis/google-p12-pem/commit/046f5946bc6809481aa04c7ed604bca3dacc21cc)) - -### [3.0.1](https://www.github.com/googleapis/google-p12-pem/compare/v3.0.0...v3.0.1) (2020-04-14) - - -### Bug Fixes - -* apache license URL ([#468](https://www.github.com/googleapis/google-p12-pem/issues/468)) ([#252](https://www.github.com/googleapis/google-p12-pem/issues/252)) ([5469838](https://www.github.com/googleapis/google-p12-pem/commit/5469838c5137f69352aa80f40eb6c1415e887e18)) - -## [3.0.0](https://www.github.com/googleapis/google-p12-pem/compare/v2.0.4...v3.0.0) (2020-03-20) - - -### ⚠ BREAKING CHANGES - -* typescript@3.7.x introduced backwards incompatibilities -* drops Node 8 from engines (#242) - -### Features - -* drops Node 8 from engines ([#242](https://www.github.com/googleapis/google-p12-pem/issues/242)) ([857cc92](https://www.github.com/googleapis/google-p12-pem/commit/857cc92e711a2ffd5bba18179c8d0395f38cc6ef)) - - -### Build System - -* update typescript/gts ([#243](https://www.github.com/googleapis/google-p12-pem/issues/243)) ([f910f07](https://www.github.com/googleapis/google-p12-pem/commit/f910f07374d586241663755ddf66f3a38e394c28)) - -### [2.0.4](https://www.github.com/googleapis/google-p12-pem/compare/v2.0.3...v2.0.4) (2020-01-06) - - -### Bug Fixes - -* **deps:** pin TypeScript below 3.7.0 ([81dd96d](https://www.github.com/googleapis/google-p12-pem/commit/81dd96d4b43100824561f45b51f9126195b41d1d)) - -### [2.0.3](https://www.github.com/googleapis/google-p12-pem/compare/v2.0.2...v2.0.3) (2019-11-13) - - -### Bug Fixes - -* **docs:** add jsdoc-region-tag plugin ([#206](https://www.github.com/googleapis/google-p12-pem/issues/206)) ([b34efde](https://www.github.com/googleapis/google-p12-pem/commit/b34efdebb853dd5129e15ec1ff11a75184fc32d7)) - -### [2.0.2](https://www.github.com/googleapis/google-p12-pem/compare/v2.0.1...v2.0.2) (2019-09-06) - - -### Bug Fixes - -* **deps:** update dependency node-forge to ^0.9.0 ([#193](https://www.github.com/googleapis/google-p12-pem/issues/193)) ([ecac0f4](https://www.github.com/googleapis/google-p12-pem/commit/ecac0f4)) -* **docs:** remove reference-docs anchor ([a6ad735](https://www.github.com/googleapis/google-p12-pem/commit/a6ad735)) - -### [2.0.1](https://www.github.com/googleapis/google-p12-pem/compare/v2.0.0...v2.0.1) (2019-06-26) - - -### Bug Fixes - -* **docs:** link to reference docs section on googleapis.dev ([#184](https://www.github.com/googleapis/google-p12-pem/issues/184)) ([a08353b](https://www.github.com/googleapis/google-p12-pem/commit/a08353b)) - -## [2.0.0](https://www.github.com/google/google-p12-pem/compare/v1.0.4...v2.0.0) (2019-05-02) - - -### Build System - -* upgrade engines field to >=8.10.0 ([#167](https://www.github.com/google/google-p12-pem/issues/167)) ([85da6e6](https://www.github.com/google/google-p12-pem/commit/85da6e6)) - - -### BREAKING CHANGES - -* upgrade engines field to >=8.10.0 (#167) - -## v1.0.4 - -03-12-2019 12:25 PDT - -This release includes a new shiny version of node-forge! - -### Dependencies -- fix(deps): update dependency node-forge to ^0.8.0 ([#137](https://github.com/google/google-p12-pem/pull/137)) - -### Documentation -- docs: update links in contrib guide ([#145](https://github.com/google/google-p12-pem/pull/145)) -- docs: move CONTRIBUTING.md to root ([#140](https://github.com/google/google-p12-pem/pull/140)) -- docs: add lint/fix example to contributing guide ([#138](https://github.com/google/google-p12-pem/pull/138)) - -### Internal / Testing Changes -- build: Add docuploader credentials to node publish jobs ([#149](https://github.com/google/google-p12-pem/pull/149)) -- build: update release config ([#147](https://github.com/google/google-p12-pem/pull/147)) -- build: use node10 to run samples-test, system-test etc ([#148](https://github.com/google/google-p12-pem/pull/148)) -- chore(deps): update dependency mocha to v6 -- build: use linkinator for docs test ([#144](https://github.com/google/google-p12-pem/pull/144)) -- build: create docs test npm scripts ([#143](https://github.com/google/google-p12-pem/pull/143)) -- build: test using @grpc/grpc-js in CI ([#142](https://github.com/google/google-p12-pem/pull/142)) -- chore(deps): update dependency eslint-config-prettier to v4 ([#135](https://github.com/google/google-p12-pem/pull/135)) -- build: ignore googleapis.com in doc link check ([#134](https://github.com/google/google-p12-pem/pull/134)) -- build: check dead links on Kokoro ([#132](https://github.com/google/google-p12-pem/pull/132)) -- test: add system test, samples, and sample test ([#131](https://github.com/google/google-p12-pem/pull/131)) -- chore(build): inject yoshi automation key ([#130](https://github.com/google/google-p12-pem/pull/130)) -- chore: update nyc and eslint configs ([#129](https://github.com/google/google-p12-pem/pull/129)) -- chore: fix publish.sh permission +x ([#127](https://github.com/google/google-p12-pem/pull/127)) -- fix(build): fix Kokoro release script ([#126](https://github.com/google/google-p12-pem/pull/126)) -- build: add Kokoro configs for autorelease ([#125](https://github.com/google/google-p12-pem/pull/125)) - -## v1.0.3 - -12-07-2018 09:50 PST - -This is a service release very few updates. The only interesting change is the removal of support for Node.js 4.x and 9.x, both of which are out of LTS support. - -### Dependencies -- fix(deps): update dependency pify to v4 ([#62](https://github.com/google/google-p12-pem/pull/62)) - -### Documentation -- docs: clean up the readme ([#121](https://github.com/google/google-p12-pem/pull/121)) - -### Internal / Testing Changes -- chore: basic cleanup ([#122](https://github.com/google/google-p12-pem/pull/122)) -- chore: always nyc report before calling codecov ([#120](https://github.com/google/google-p12-pem/pull/120)) -- chore: nyc ignore build/test by default ([#119](https://github.com/google/google-p12-pem/pull/119)) -- chore(build): update templates and synth ([#117](https://github.com/google/google-p12-pem/pull/117)) -- fix(build): fix system key decryption ([#112](https://github.com/google/google-p12-pem/pull/112)) -- chore(deps): update dependency typescript to ~3.2.0 ([#111](https://github.com/google/google-p12-pem/pull/111)) -- chore: add synth.metadata -- chore(deps): update dependency gts to ^0.9.0 ([#106](https://github.com/google/google-p12-pem/pull/106)) -- chore: update eslintignore config ([#105](https://github.com/google/google-p12-pem/pull/105)) -- chore: use latest npm on Windows ([#104](https://github.com/google/google-p12-pem/pull/104)) -- chore: update CircleCI config ([#103](https://github.com/google/google-p12-pem/pull/103)) -- chore: include build in eslintignore ([#100](https://github.com/google/google-p12-pem/pull/100)) -- chore: update issue templates ([#96](https://github.com/google/google-p12-pem/pull/96)) -- chore: remove old issue template ([#94](https://github.com/google/google-p12-pem/pull/94)) -- build: run tests on node11 ([#93](https://github.com/google/google-p12-pem/pull/93)) -- chores(build): run codecov on continuous builds ([#88](https://github.com/google/google-p12-pem/pull/88)) -- chores(build): do not collect sponge.xml from windows builds ([#90](https://github.com/google/google-p12-pem/pull/90)) -- chore(deps): update dependency typescript to ~3.1.0 ([#89](https://github.com/google/google-p12-pem/pull/89)) -- chore: update new issue template ([#87](https://github.com/google/google-p12-pem/pull/87)) -- build: fix codecov uploading on Kokoro ([#84](https://github.com/google/google-p12-pem/pull/84)) -- Update kokoro config ([#81](https://github.com/google/google-p12-pem/pull/81)) -- Run system tests on Kokoro ([#78](https://github.com/google/google-p12-pem/pull/78)) -- Don't publish sourcemaps ([#79](https://github.com/google/google-p12-pem/pull/79)) -- test: remove appveyor config ([#77](https://github.com/google/google-p12-pem/pull/77)) -- Update CI config ([#76](https://github.com/google/google-p12-pem/pull/76)) -- Enable prefer-const in the eslint config ([#75](https://github.com/google/google-p12-pem/pull/75)) -- Enable no-var in eslint ([#74](https://github.com/google/google-p12-pem/pull/74)) -- Update CI config ([#73](https://github.com/google/google-p12-pem/pull/73)) -- Retry npm install in CI ([#71](https://github.com/google/google-p12-pem/pull/71)) -- Update CI config ([#69](https://github.com/google/google-p12-pem/pull/69)) -- Update CI config ([#68](https://github.com/google/google-p12-pem/pull/68)) -- Update github templates and CircleCI config ([#67](https://github.com/google/google-p12-pem/pull/67)) -- chore(deps): update dependency nyc to v13 ([#65](https://github.com/google/google-p12-pem/pull/65)) -- add synth file and standardize config ([#64](https://github.com/google/google-p12-pem/pull/64)) -- chore: ignore package-log.json ([#61](https://github.com/google/google-p12-pem/pull/61)) -- chore: update renovate config ([#59](https://github.com/google/google-p12-pem/pull/59)) -- chore(deps): lock file maintenance ([#60](https://github.com/google/google-p12-pem/pull/60)) -- chore: remove greenkeeper badge ([#58](https://github.com/google/google-p12-pem/pull/58)) -- test: throw on deprecation -- chore: move mocha options to mocha.opts ([#54](https://github.com/google/google-p12-pem/pull/54)) -- chore(deps): update dependency typescript to v3 ([#56](https://github.com/google/google-p12-pem/pull/56)) -- chore(deps): lock file maintenance ([#55](https://github.com/google/google-p12-pem/pull/55)) -- chore(deps): lock file maintenance ([#53](https://github.com/google/google-p12-pem/pull/53)) -- chore(deps): update dependency gts to ^0.8.0 ([#49](https://github.com/google/google-p12-pem/pull/49)) -- test: use strictEqual in tests ([#51](https://github.com/google/google-p12-pem/pull/51)) -- chore(deps): update dependency typescript to ~2.9.0 ([#50](https://github.com/google/google-p12-pem/pull/50)) -- chore: Configure Renovate ([#48](https://github.com/google/google-p12-pem/pull/48)) -- fix: drop support for node.js 4.x and 9.x ([#46](https://github.com/google/google-p12-pem/pull/46)) -- Add Code of Conduct -- chore(package): update gts to the latest version ([#45](https://github.com/google/google-p12-pem/pull/45)) -- chore(package): update nyc to version 12.0.2 ([#42](https://github.com/google/google-p12-pem/pull/42)) -- chore: upgrade to the latest version of all dependencies ([#39](https://github.com/google/google-p12-pem/pull/39)) -- chore(build): run lint as a separate job ([#40](https://github.com/google/google-p12-pem/pull/40)) -- fix: pin gts version with ^ ([#38](https://github.com/google/google-p12-pem/pull/38)) -- chore(package): update @types/node to version 10.0.3 ([#34](https://github.com/google/google-p12-pem/pull/34)) -- chore: start testing on node 10 ([#36](https://github.com/google/google-p12-pem/pull/36)) -- chore(package): update @types/mocha to version 5.0.0 ([#33](https://github.com/google/google-p12-pem/pull/33)) diff --git a/node_modules/google-p12-pem/LICENSE b/node_modules/google-p12-pem/LICENSE deleted file mode 100644 index 8dafa3b9..00000000 --- a/node_modules/google-p12-pem/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Ryan Seys - -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. diff --git a/node_modules/google-p12-pem/README.md b/node_modules/google-p12-pem/README.md deleted file mode 100644 index 0ddd425e..00000000 --- a/node_modules/google-p12-pem/README.md +++ /dev/null @@ -1,151 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "To regenerate it, use `python -m synthtool`." -Google Cloud Platform logo - -# [google-p12-pem: Node.js Client](https://github.com/googleapis/google-p12-pem) - -[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) -[![npm version](https://img.shields.io/npm/v/google-p12-pem.svg)](https://www.npmjs.org/package/google-p12-pem) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/google-p12-pem/master.svg?style=flat)](https://codecov.io/gh/googleapis/google-p12-pem) - - - - -Convert Google .p12 keys to .pem keys. - - -A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/google-p12-pem/blob/master/CHANGELOG.md). - - - -* [github.com/googleapis/google-p12-pem](https://github.com/googleapis/google-p12-pem) - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - - -* [Quickstart](#quickstart) - - * [Installing the client library](#installing-the-client-library) - * [Using the client library](#using-the-client-library) -* [Samples](#samples) -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart - -### Installing the client library - -```bash -npm install google-p12-pem -``` - - -### Using the client library - -```javascript -const {getPem} = require('google-p12-pem'); - -/** - * Given a p12 file, convert it to the PEM format. - * @param {string} pathToCert The relative path to a p12 file. - */ -async function quickstart() { - // TODO(developer): provide the path to your cert - // const pathToCert = 'path/to/cert.p12'; - - const pem = await getPem(pathToCert); - console.log('The converted PEM:'); - console.log(pem); -} - -quickstart(); - -``` -#### CLI style - -``` sh -gp12-pem myfile.p12 > output.pem -``` - - -## Samples - -Samples are in the [`samples/`](https://github.com/googleapis/google-p12-pem/tree/master/samples) directory. The samples' `README.md` -has instructions for running the samples. - -| Sample | Source Code | Try it | -| --------------------------- | --------------------------------- | ------ | -| Quickstart | [source code](https://github.com/googleapis/google-p12-pem/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-p12-pem&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | - - - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. - -Client libraries targetting some end-of-life versions of Node.js are available, and -can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. - -_Legacy Node.js versions are supported as a best effort:_ - -* Legacy versions will not be tested in continuous integration. -* Some security patches may not be able to be backported. -* Dependencies will not be kept up-to-date, and features will not be backported. - -#### Legacy tags available - -* `legacy-8`: install client libraries from this dist-tag for versions - compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - - -This library is considered to be **General Availability (GA)**. This means it -is stable; the code surface will not change in backwards-incompatible ways -unless absolutely necessary (e.g. because of critical security issues) or with -an extensive deprecation period. Issues and requests against **GA** libraries -are addressed with the highest priority. - - - - - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-p12-pem/blob/master/CONTRIBUTING.md). - -Please note that this `README.md`, the `samples/README.md`, -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. To edit one of these files, make an edit -to its template in this -[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-p12-pem/blob/master/LICENSE) - - - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing - -[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/node_modules/google-p12-pem/build/src/bin/gp12-pem.d.ts b/node_modules/google-p12-pem/build/src/bin/gp12-pem.d.ts deleted file mode 100644 index cd3d1cde..00000000 --- a/node_modules/google-p12-pem/build/src/bin/gp12-pem.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -export {}; diff --git a/node_modules/google-p12-pem/build/src/bin/gp12-pem.js b/node_modules/google-p12-pem/build/src/bin/gp12-pem.js deleted file mode 100644 index 95ff73a3..00000000 --- a/node_modules/google-p12-pem/build/src/bin/gp12-pem.js +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env node -"use strict"; -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -Object.defineProperty(exports, "__esModule", { value: true }); -const gp12 = require("../index"); -const argv = process.argv; -const p12Path = argv[2]; -if (!p12Path) { - console.error('Please specify a *.p12 file to convert.'); - process.exitCode = 1; -} -gp12.getPem(p12Path, (err, pem) => { - if (err) { - console.log(err); - process.exitCode = 1; - } - else { - console.log(pem); - } -}); -//# sourceMappingURL=gp12-pem.js.map \ No newline at end of file diff --git a/node_modules/google-p12-pem/build/src/index.d.ts b/node_modules/google-p12-pem/build/src/index.d.ts deleted file mode 100644 index 06e04d3a..00000000 --- a/node_modules/google-p12-pem/build/src/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -/** - * Convert a .p12 file to .pem string - * @param filename The .p12 key filename. - * @param callback The callback function. - * @return A promise that resolves with the .pem private key - * if no callback provided. - */ -export declare function getPem(filename: string): Promise; -export declare function getPem(filename: string, callback: (err: Error | null, pem: string | null) => void): void; diff --git a/node_modules/google-p12-pem/build/src/index.js b/node_modules/google-p12-pem/build/src/index.js deleted file mode 100644 index 73b5d71b..00000000 --- a/node_modules/google-p12-pem/build/src/index.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getPem = void 0; -const fs = require("fs"); -const forge = require("node-forge"); -const util_1 = require("util"); -const readFile = util_1.promisify(fs.readFile); -function getPem(filename, callback) { - if (callback) { - getPemAsync(filename) - .then(pem => callback(null, pem)) - .catch(err => callback(err, null)); - } - else { - return getPemAsync(filename); - } -} -exports.getPem = getPem; -function getPemAsync(filename) { - return readFile(filename, { encoding: 'base64' }).then(keyp12 => { - return convertToPem(keyp12); - }); -} -/** - * Converts a P12 in base64 encoding to a pem. - * @param p12base64 String containing base64 encoded p12. - * @returns a string containing the pem. - */ -function convertToPem(p12base64) { - const p12Der = forge.util.decode64(p12base64); - const p12Asn1 = forge.asn1.fromDer(p12Der); - const p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, 'notasecret'); - const bags = p12.getBags({ friendlyName: 'privatekey' }); - if (bags.friendlyName) { - const privateKey = bags.friendlyName[0].key; - const pem = forge.pki.privateKeyToPem(privateKey); - return pem.replace(/\r\n/g, '\n'); - } - else { - throw new Error('Unable to get friendly name.'); - } -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/google-p12-pem/package.json b/node_modules/google-p12-pem/package.json deleted file mode 100644 index 79535253..00000000 --- a/node_modules/google-p12-pem/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "_from": "google-p12-pem@^3.0.3", - "_id": "google-p12-pem@3.0.3", - "_inBundle": false, - "_integrity": "sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==", - "_location": "/google-p12-pem", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "google-p12-pem@^3.0.3", - "name": "google-p12-pem", - "escapedName": "google-p12-pem", - "rawSpec": "^3.0.3", - "saveSpec": null, - "fetchSpec": "^3.0.3" - }, - "_requiredBy": [ - "/gtoken" - ], - "_resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.3.tgz", - "_shasum": "673ac3a75d3903a87f05878f3c75e06fc151669e", - "_spec": "google-p12-pem@^3.0.3", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gtoken", - "author": { - "name": "Ryan Seys" - }, - "bin": { - "gp12-pem": "build/src/bin/gp12-pem.js" - }, - "bugs": { - "url": "https://github.com/google/google-p12-pem/issues" - }, - "bundleDependencies": false, - "dependencies": { - "node-forge": "^0.10.0" - }, - "deprecated": false, - "description": "Convert Google .p12 keys to .pem keys.", - "devDependencies": { - "@compodoc/compodoc": "^1.1.7", - "@microsoft/api-documenter": "^7.8.10", - "@microsoft/api-extractor": "^7.8.10", - "@types/mocha": "^8.0.0", - "@types/node": "^10.0.9", - "@types/node-forge": "^0.9.0", - "c8": "^7.0.0", - "codecov": "^3.0.2", - "gts": "^2.0.0", - "js-green-licenses": "^2.0.0", - "linkinator": "^2.0.0", - "mocha": "^8.0.0", - "typescript": "^3.8.3" - }, - "engines": { - "node": ">=10" - }, - "files": [ - "build/src", - "!build/src/**/*.map" - ], - "homepage": "https://github.com/google/google-p12-pem#readme", - "license": "MIT", - "main": "./build/src/index.js", - "name": "google-p12-pem", - "repository": { - "type": "git", - "url": "git+https://github.com/google/google-p12-pem.git" - }, - "scripts": { - "api-documenter": "api-documenter yaml --input-folder=temp", - "api-extractor": "api-extractor run --local", - "check": "gts check && npm run license-check", - "clean": "gts clean", - "compile": "tsc -p .", - "docs": "compodoc src/", - "docs-test": "linkinator docs", - "fix": "gts fix", - "license-check": "jsgl --local .", - "lint": "gts check", - "precompile": "gts clean", - "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm install", - "prepare": "npm run compile", - "presystem-test": "npm run compile", - "pretest": "npm run compile", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha build/system-test", - "test": "c8 mocha build/test" - }, - "types": "./build/src/index.d.ts", - "version": "3.0.3" -} diff --git a/node_modules/graphql-request/LICENSE b/node_modules/graphql-request/LICENSE deleted file mode 100644 index 3e74b153..00000000 --- a/node_modules/graphql-request/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Graphcool - -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. diff --git a/node_modules/graphql-request/README.md b/node_modules/graphql-request/README.md deleted file mode 100644 index e0d7ca92..00000000 --- a/node_modules/graphql-request/README.md +++ /dev/null @@ -1,472 +0,0 @@ -# graphql-request - -Minimal GraphQL client supporting Node and browsers for scripts or simple apps - -![GitHub Action](https://github.com/prisma-labs/graphql-request/workflows/trunk/badge.svg) [![npm version](https://badge.fury.io/js/graphql-request.svg)](https://badge.fury.io/js/graphql-request) - - - - - -- [Features](#features) -- [Install](#install) -- [Quickstart](#quickstart) -- [Usage](#usage) -- [Node Version Support](#node-version-support) -- [Community](#community) - - [GraphQL Code Generator's GraphQL-Request TypeScript Plugin](#graphql-code-generators-graphql-request-typescript-plugin) -- [Examples](#examples) - - [Authentication via HTTP header](#authentication-via-http-header) - - [Incrementally setting headers](#incrementally-setting-headers) - - [Passing more options to `fetch`](#passing-more-options-to-fetch) - - [Using GraphQL Document variables](#using-graphql-document-variables) - - [GraphQL Mutations](#graphql-mutations) - - [Error handling](#error-handling) - - [Using `require` instead of `import`](#using-require-instead-of-import) - - [Cookie support for `node`](#cookie-support-for-node) - - [Using a custom `fetch` method](#using-a-custom-fetch-method) - - [Receiving a raw response](#receiving-a-raw-response) - - [File Upload](#file-upload) - - [Browser](#browser) - - [Node](#node) -- [FAQ](#faq) - - [Why do I have to install `graphql`?](#why-do-i-have-to-install-graphql) - - [Do I need to wrap my GraphQL documents inside the `gql` template exported by `graphql-request`?](#do-i-need-to-wrap-my-graphql-documents-inside-the-gql-template-exported-by-graphql-request) - - [What's the difference between `graphql-request`, Apollo and Relay?](#whats-the-difference-between-graphql-request-apollo-and-relay) - - - -## Features - -- Most **simple & lightweight** GraphQL client -- Promise-based API (works with `async` / `await`) -- Typescript support -- Isomorphic (works with Node / browsers) - -## Install - -```sh -npm add graphql-request graphql -``` - -## Quickstart - -Send a GraphQL query with a single line of code. ▶️ [Try it out](https://runkit.com/593130bdfad7120012472003/593130bdfad7120012472004). - -```js -import { request, gql } from 'graphql-request' - -const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - name - } - } - } -` - -request('https://api.graph.cool/simple/v1/movies', query).then((data) => console.log(data)) -``` - -## Usage - -```js -import { request, GraphQLClient } from 'graphql-request' - -// Run GraphQL queries/mutations using a static function -request(endpoint, query, variables).then((data) => console.log(data)) - -// ... or create a GraphQL client instance to send requests -const client = new GraphQLClient(endpoint, { headers: {} }) -client.request(query, variables).then((data) => console.log(data)) -``` - -## Node Version Support - -We only officially support [LTS Node versions](https://github.com/nodejs/Release#release-schedule). We also make an effort to support two additional versions: - -1. The latest even Node version if it is not LTS already. -2. The odd Node version directly following the latest even version. - -You are free to try using other versions of Node (e.g. `13.x`) with `graphql-request` but at your own risk. - -## Community - -#### GraphQL Code Generator's GraphQL-Request TypeScript Plugin - -A [GraphQL-Codegen plugin](https://graphql-code-generator.com/docs/plugins/typescript-graphql-request) that generates a `graphql-request` ready-to-use SDK, which is fully-typed. - -## Examples - -### Authentication via HTTP header - -```js -import { GraphQLClient, gql } from 'graphql-request' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const graphQLClient = new GraphQLClient(endpoint, { - headers: { - authorization: 'Bearer MY_TOKEN', - }, - }) - - const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - name - } - } - } - ` - - const data = await graphQLClient.request(query) - console.log(JSON.stringify(data, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -[TypeScript Source](examples/authentication-via-http-header.ts) - -#### Incrementally setting headers - -If you want to set headers after the GraphQLClient has been initialised, you can use the `setHeader()` or `setHeaders()` functions. - -```js -import { setHeaders, setHeader, GraphQLClient } from 'graphql-request' - -const client = new GraphQLClient(endpoint) - -// Set a single header -client.setHeader('authorization', 'Bearer MY_TOKEN') - -// Override all existing headers -client.setHeaders({ - authorization: 'Bearer MY_TOKEN' - anotherheader: 'header_value' -}) -``` - -### Passing more options to `fetch` - -```js -import { GraphQLClient, gql } from 'graphql-request' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const graphQLClient = new GraphQLClient(endpoint, { - credentials: 'include', - mode: 'cors', - }) - - const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - name - } - } - } - ` - - const data = await graphQLClient.request(query) - console.log(JSON.stringify(data, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -[TypeScript Source](examples/passing-more-options-to-fetch.ts) - -### Using GraphQL Document variables - -```js -import { request, gql } from 'graphql-request' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const query = gql` - query getMovie($title: String!) { - Movie(title: $title) { - releaseDate - actors { - name - } - } - } - ` - - const variables = { - title: 'Inception', - } - - const data = await request(endpoint, query, variables) - console.log(JSON.stringify(data, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -### GraphQL Mutations - -```js -import { GraphQLClient, gql } from 'graphql-request' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const graphQLClient = new GraphQLClient(endpoint, { - headers: { - authorization: 'Bearer MY_TOKEN', - }, - }) - - const mutation = gql` - mutation AddMovie($title: String!, $releaseDate: Int!) { - insert_movies_one(object: { title: $title, releaseDate: $releaseDate }) { - title - releaseDate - } - } - ` - - const variables = { - title: 'Inception', - releaseDate: 2010, - } - const data = await graphQLClient.request(mutation, variables) - - console.log(JSON.stringify(data, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -[TypeScript Source](examples/using-variables.ts) - -### Error handling - -```js -import { request, gql } from 'graphql-request' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - fullname # "Cannot query field 'fullname' on type 'Actor'. Did you mean 'name'?" - } - } - } - ` - - try { - const data = await request(endpoint, query) - console.log(JSON.stringify(data, undefined, 2)) - } catch (error) { - console.error(JSON.stringify(error, undefined, 2)) - process.exit(1) - } -} - -main().catch((error) => console.error(error)) -``` - -[TypeScript Source](examples/error-handling.ts) - -### Using `require` instead of `import` - -```js -const { request, gql } = require('graphql-request') - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - name - } - } - } - ` - - const data = await request(endpoint, query) - console.log(JSON.stringify(data, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -### Cookie support for `node` - -```sh -npm install fetch-cookie -``` - -```js -require('fetch-cookie/node-fetch')(require('node-fetch')) - -import { GraphQLClient, gql } from 'graphql-request' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const graphQLClient = new GraphQLClient(endpoint, { - headers: { - authorization: 'Bearer MY_TOKEN', - }, - }) - - const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - name - } - } - } - ` - - const data = await graphQLClient.rawRequest(query) - console.log(JSON.stringify(data, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -[TypeScript Source](examples/cookie-support-for-node.ts) - -### Using a custom `fetch` method - -```sh -npm install fetch-cookie -``` - -```js -import { GraphQLClient, gql } from 'graphql-request' -import crossFetch from 'cross-fetch' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - // a cookie jar scoped to the client object - const fetch = require('fetch-cookie')(crossFetch) - const graphQLClient = new GraphQLClient(endpoint, { fetch }) - - const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - name - } - } - } - ` - - const data = await graphQLClient.rawRequest(query) - console.log(JSON.stringify(data, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -### Receiving a raw response - -The `request` method will return the `data` or `errors` key from the response. -If you need to access the `extensions` key you can use the `rawRequest` method: - -```js -import { rawRequest, gql } from 'graphql-request' - -async function main() { - const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr' - - const query = gql` - { - Movie(title: "Inception") { - releaseDate - actors { - name - } - } - } - ` - - const { data, errors, extensions, headers, status } = await rawRequest(endpoint, query) - console.log(JSON.stringify({ data, errors, extensions, headers, status }, undefined, 2)) -} - -main().catch((error) => console.error(error)) -``` - -### File Upload - -#### Browser - -```js -import { request } from 'graphql-request' - -const UploadUserAvatar = gql` - mutation uploadUserAvatar($userId: Int!, $file: Upload!) { - updateUser(id: $userId, input: { avatar: $file }) - } -` - -request('/api/graphql', UploadUserAvatar, { - userId: 1, - file: document.querySelector('input#avatar').files[0], -}) -``` - -#### Node - -```js -import { createReadStream } from 'fs' -import { request } from 'graphql-request' - -const UploadUserAvatar = gql` - mutation uploadUserAvatar($userId: Int!, $file: Upload!) { - updateUser(id: $userId, input: { avatar: $file }) - } -` - -request('/api/graphql', UploadUserAvatar, { - userId: 1, - file: createReadStream('./avatar.img'), -}) -``` - -[TypeScript Source](examples/receiving-a-raw-response.ts) - -## FAQ - -#### Why do I have to install `graphql`? - -`graphql-request` uses a TypeScript type from the `graphql` package such that if you are using TypeScript to build your project and you are using `graphql-request` but don't have `graphql` installed TypeScript build will fail. Details [here](https://github.com/prisma-labs/graphql-request/pull/183#discussion_r464453076). If you are a JS user then you do not technically need to install `graphql`. However if you use an IDE that picks up TS types even for JS (like VSCode) then its still in your interest to install `graphql` so that you can benefit from enhanced type safety during development. - -#### Do I need to wrap my GraphQL documents inside the `gql` template exported by `graphql-request`? - -No. It is there for convenience so that you can get the tooling support like prettier formatting and IDE syntax highlighting. You can use `gql` from `graphql-tag` if you need it for some reason too. - -#### What's the difference between `graphql-request`, Apollo and Relay? - -`graphql-request` is the most minimal and simplest to use GraphQL client. It's perfect for small scripts or simple apps. - -Compared to GraphQL clients like Apollo or Relay, `graphql-request` doesn't have a built-in cache and has no integrations for frontend frameworks. The goal is to keep the package and API as minimal as possible. diff --git a/node_modules/graphql-request/dist/createRequestBody.d.ts b/node_modules/graphql-request/dist/createRequestBody.d.ts deleted file mode 100644 index 248b94ac..00000000 --- a/node_modules/graphql-request/dist/createRequestBody.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Variables } from './types'; -/** - * Returns Multipart Form if body contains files - * (https://github.com/jaydenseric/graphql-multipart-request-spec) - * Otherwise returns JSON - */ -export default function createRequestBody(query: string, variables?: Variables): string | FormData; diff --git a/node_modules/graphql-request/dist/createRequestBody.js b/node_modules/graphql-request/dist/createRequestBody.js deleted file mode 100644 index 509f87f4..00000000 --- a/node_modules/graphql-request/dist/createRequestBody.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var extract_files_1 = require("extract-files"); -var form_data_1 = __importDefault(require("form-data")); -/** - * Duck type if NodeJS stream - * https://github.com/sindresorhus/is-stream/blob/3750505b0727f6df54324784fe369365ef78841e/index.js#L3 - */ -var isExtractableFileEnhanced = function (value) { - return extract_files_1.isExtractableFile(value) || - (value !== null && typeof value === 'object' && typeof value.pipe === 'function'); -}; -/** - * Returns Multipart Form if body contains files - * (https://github.com/jaydenseric/graphql-multipart-request-spec) - * Otherwise returns JSON - */ -function createRequestBody(query, variables) { - var _a = extract_files_1.extractFiles({ query: query, variables: variables }, '', isExtractableFileEnhanced), clone = _a.clone, files = _a.files; - if (files.size === 0) { - return JSON.stringify(clone); - } - var Form = typeof FormData === 'undefined' ? form_data_1.default : FormData; - var form = new Form(); - form.append('operations', JSON.stringify(clone)); - var map = {}; - var i = 0; - files.forEach(function (paths) { - map[++i] = paths; - }); - form.append('map', JSON.stringify(map)); - i = 0; - files.forEach(function (paths, file) { - form.append("" + ++i, file); - }); - return form; -} -exports.default = createRequestBody; -//# sourceMappingURL=createRequestBody.js.map \ No newline at end of file diff --git a/node_modules/graphql-request/dist/createRequestBody.js.map b/node_modules/graphql-request/dist/createRequestBody.js.map deleted file mode 100644 index dde7eb8e..00000000 --- a/node_modules/graphql-request/dist/createRequestBody.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"createRequestBody.js","sourceRoot":"","sources":["../src/createRequestBody.ts"],"names":[],"mappings":";;;;;AAAA,+CAAgF;AAChF,wDAAoC;AAIpC;;;GAGG;AACH,IAAM,yBAAyB,GAAG,UAAC,KAAU;IAC3C,OAAA,iCAAiB,CAAC,KAAK,CAAC;QACxB,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AADjF,CACiF,CAAA;AAEnF;;;;GAIG;AACH,SAAwB,iBAAiB,CAAC,KAAa,EAAE,SAAqB;IACtE,IAAA,KAAmB,4BAAY,CAAC,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,EAAE,EAAE,EAAE,yBAAyB,CAAC,EAAlF,KAAK,WAAA,EAAE,KAAK,WAAsE,CAAA;IAE1F,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;KAC7B;IAED,IAAM,IAAI,GAAG,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAY,CAAC,CAAC,CAAC,QAAQ,CAAA;IAEtE,IAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;IAEvB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IAEhD,IAAM,GAAG,GAAgC,EAAE,CAAA;IAC3C,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,KAAK,CAAC,OAAO,CAAC,UAAC,KAAK;QAClB,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAA;IAClB,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IAEvC,CAAC,GAAG,CAAC,CAAA;IACL,KAAK,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,IAAI;QACxB,IAAI,CAAC,MAAM,CAAC,KAAG,EAAE,CAAG,EAAE,IAAW,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,OAAO,IAAgB,CAAA;AACzB,CAAC;AA1BD,oCA0BC"} \ No newline at end of file diff --git a/node_modules/graphql-request/dist/index.d.ts b/node_modules/graphql-request/dist/index.d.ts deleted file mode 100644 index 73d7f618..00000000 --- a/node_modules/graphql-request/dist/index.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { GraphQLError, RequestDocument, Variables } from './types'; -import * as Dom from './types.dom'; -export { ClientError } from './types'; -/** - * todo - */ -export declare class GraphQLClient { - private url; - private options; - constructor(url: string, options?: Dom.RequestInit); - rawRequest(query: string, variables?: V): Promise<{ - data?: T; - extensions?: any; - headers: Dom.Headers; - status: number; - errors?: GraphQLError[]; - }>; - /** - * Send a GraphQL document to the server. - */ - request(document: RequestDocument, variables?: V): Promise; - setHeaders(headers: Dom.RequestInit['headers']): GraphQLClient; - /** - * Attach a header to the client. All subsequent requests will have this header. - */ - setHeader(key: string, value: string): GraphQLClient; -} -/** - * todo - */ -export declare function rawRequest(url: string, query: string, variables?: V): Promise<{ - data?: T; - extensions?: any; - headers: Dom.Headers; - status: number; - errors?: GraphQLError[]; -}>; -/** - * Send a GraphQL Document to the GraphQL server for exectuion. - * - * @example - * - * ```ts - * // You can pass a raw string - * - * await request('https://foo.bar/graphql', ` - * { - * query { - * users - * } - * } - * `) - * - * // You can also pass a GraphQL DocumentNode. Convenient if you - * // are using graphql-tag package. - * - * import gql from 'graphql-tag' - * - * await request('https://foo.bar/graphql', gql`...`) - * - * // If you don't actually care about using DocumentNode but just - * // want the tooling support for gql template tag like IDE syntax - * // coloring and prettier autoformat then note you can use the - * // passthrough gql tag shipped with graphql-request to save a bit - * // of performance and not have to install another dep into your project. - * - * import { gql } from 'graphql-request' - * - * await request('https://foo.bar/graphql', gql`...`) - * ``` - */ -export declare function request(url: string, document: RequestDocument, variables?: V): Promise; -export default request; -/** - * Convenience passthrough template tag to get the benefits of tooling for the gql template tag. This does not actually parse the input into a GraphQL DocumentNode like graphql-tag package does. It just returns the string with any variables given interpolated. Can save you a bit of performance and having to install another package. - * - * @example - * - * import { gql } from 'graphql-request' - * - * await request('https://foo.bar/graphql', gql`...`) - * - * @remarks - * - * Several tools in the Node GraphQL ecosystem are hardcoded to specially treat any template tag named "gql". For example see this prettier issue: https://github.com/prettier/prettier/issues/4360. Using this template tag has no runtime effect beyond variable interpolation. - */ -export declare function gql(chunks: TemplateStringsArray, ...variables: any[]): string; diff --git a/node_modules/graphql-request/dist/index.js b/node_modules/graphql-request/dist/index.js deleted file mode 100644 index ed3ade6c..00000000 --- a/node_modules/graphql-request/dist/index.js +++ /dev/null @@ -1,311 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__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; -}; -var __awaiter = (this && this.__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()); - }); -}; -var __generator = (this && this.__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 }; - } -}; -var __rest = (this && this.__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; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.gql = exports.request = exports.rawRequest = exports.GraphQLClient = exports.ClientError = void 0; -var cross_fetch_1 = __importStar(require("cross-fetch")), CrossFetch = cross_fetch_1; -var printer_1 = require("graphql/language/printer"); -var createRequestBody_1 = __importDefault(require("./createRequestBody")); -var types_1 = require("./types"); -var types_2 = require("./types"); -Object.defineProperty(exports, "ClientError", { enumerable: true, get: function () { return types_2.ClientError; } }); -/** - * Convert the given headers configuration into a plain object. - */ -var resolveHeaders = function (headers) { - var oHeaders = {}; - if (headers) { - if ((typeof Headers !== 'undefined' && headers instanceof Headers) || - headers instanceof CrossFetch.Headers) { - oHeaders = HeadersInstanceToPlainObject(headers); - } - else if (Array.isArray(headers)) { - headers.forEach(function (_a) { - var name = _a[0], value = _a[1]; - oHeaders[name] = value; - }); - } - else { - oHeaders = headers; - } - } - return oHeaders; -}; -/** - * todo - */ -var GraphQLClient = /** @class */ (function () { - function GraphQLClient(url, options) { - this.url = url; - this.options = options || {}; - } - GraphQLClient.prototype.rawRequest = function (query, variables) { - return __awaiter(this, void 0, void 0, function () { - var _a, headers, _b, localFetch, others, body, response, result, headers_1, status_1, errorResult; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: - _a = this.options, headers = _a.headers, _b = _a.fetch, localFetch = _b === void 0 ? cross_fetch_1.default : _b, others = __rest(_a, ["headers", "fetch"]); - body = createRequestBody_1.default(query, variables); - headers = resolveHeaders(headers); - return [4 /*yield*/, localFetch(this.url, __assign({ method: 'POST', headers: __assign(__assign({}, (typeof body === 'string' ? { 'Content-Type': 'application/json' } : {})), headers), body: body }, others))]; - case 1: - response = _c.sent(); - return [4 /*yield*/, getResult(response)]; - case 2: - result = _c.sent(); - if (response.ok && !result.errors && result.data) { - headers_1 = response.headers, status_1 = response.status; - return [2 /*return*/, __assign(__assign({}, result), { headers: headers_1, status: status_1 })]; - } - else { - errorResult = typeof result === 'string' ? { error: result } : result; - throw new types_1.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables }); - } - return [2 /*return*/]; - } - }); - }); - }; - /** - * Send a GraphQL document to the server. - */ - GraphQLClient.prototype.request = function (document, variables) { - return __awaiter(this, void 0, void 0, function () { - var _a, headers, _b, localFetch, others, resolvedDoc, body, response, result, errorResult; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: - _a = this.options, headers = _a.headers, _b = _a.fetch, localFetch = _b === void 0 ? cross_fetch_1.default : _b, others = __rest(_a, ["headers", "fetch"]); - headers = resolveHeaders(headers); - resolvedDoc = resolveRequestDocument(document); - body = createRequestBody_1.default(resolvedDoc, variables); - return [4 /*yield*/, localFetch(this.url, __assign({ method: 'POST', headers: __assign(__assign({}, (typeof body === 'string' ? { 'Content-Type': 'application/json' } : {})), headers), body: body }, others))]; - case 1: - response = _c.sent(); - return [4 /*yield*/, getResult(response)]; - case 2: - result = _c.sent(); - if (response.ok && !result.errors && result.data) { - return [2 /*return*/, result.data]; - } - else { - errorResult = typeof result === 'string' ? { error: result } : result; - throw new types_1.ClientError(__assign(__assign({}, errorResult), { status: response.status }), { query: resolvedDoc, variables: variables }); - } - return [2 /*return*/]; - } - }); - }); - }; - GraphQLClient.prototype.setHeaders = function (headers) { - this.options.headers = headers; - return this; - }; - /** - * Attach a header to the client. All subsequent requests will have this header. - */ - GraphQLClient.prototype.setHeader = function (key, value) { - var _a; - var headers = this.options.headers; - if (headers) { - // todo what if headers is in nested array form... ? - //@ts-ignore - headers[key] = value; - } - else { - this.options.headers = (_a = {}, _a[key] = value, _a); - } - return this; - }; - return GraphQLClient; -}()); -exports.GraphQLClient = GraphQLClient; -/** - * todo - */ -function rawRequest(url, query, variables) { - return __awaiter(this, void 0, void 0, function () { - var client; - return __generator(this, function (_a) { - client = new GraphQLClient(url); - return [2 /*return*/, client.rawRequest(query, variables)]; - }); - }); -} -exports.rawRequest = rawRequest; -/** - * Send a GraphQL Document to the GraphQL server for exectuion. - * - * @example - * - * ```ts - * // You can pass a raw string - * - * await request('https://foo.bar/graphql', ` - * { - * query { - * users - * } - * } - * `) - * - * // You can also pass a GraphQL DocumentNode. Convenient if you - * // are using graphql-tag package. - * - * import gql from 'graphql-tag' - * - * await request('https://foo.bar/graphql', gql`...`) - * - * // If you don't actually care about using DocumentNode but just - * // want the tooling support for gql template tag like IDE syntax - * // coloring and prettier autoformat then note you can use the - * // passthrough gql tag shipped with graphql-request to save a bit - * // of performance and not have to install another dep into your project. - * - * import { gql } from 'graphql-request' - * - * await request('https://foo.bar/graphql', gql`...`) - * ``` - */ -function request(url, document, variables) { - return __awaiter(this, void 0, void 0, function () { - var client; - return __generator(this, function (_a) { - client = new GraphQLClient(url); - return [2 /*return*/, client.request(document, variables)]; - }); - }); -} -exports.request = request; -exports.default = request; -/** - * todo - */ -function getResult(response) { - var contentType = response.headers.get('Content-Type'); - if (contentType && contentType.startsWith('application/json')) { - return response.json(); - } - else { - return response.text(); - } -} -/** - * helpers - */ -function resolveRequestDocument(document) { - if (typeof document === 'string') - return document; - return printer_1.print(document); -} -/** - * Convenience passthrough template tag to get the benefits of tooling for the gql template tag. This does not actually parse the input into a GraphQL DocumentNode like graphql-tag package does. It just returns the string with any variables given interpolated. Can save you a bit of performance and having to install another package. - * - * @example - * - * import { gql } from 'graphql-request' - * - * await request('https://foo.bar/graphql', gql`...`) - * - * @remarks - * - * Several tools in the Node GraphQL ecosystem are hardcoded to specially treat any template tag named "gql". For example see this prettier issue: https://github.com/prettier/prettier/issues/4360. Using this template tag has no runtime effect beyond variable interpolation. - */ -function gql(chunks) { - var variables = []; - for (var _i = 1; _i < arguments.length; _i++) { - variables[_i - 1] = arguments[_i]; - } - return chunks.reduce(function (accumulator, chunk, index) { return "" + accumulator + chunk + (index in variables ? variables[index] : ''); }, ''); -} -exports.gql = gql; -/** - * Convert Headers instance into regular object - */ -function HeadersInstanceToPlainObject(headers) { - var o = {}; - headers.forEach(function (v, k) { - o[k] = v; - }); - return o; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/graphql-request/dist/index.js.map b/node_modules/graphql-request/dist/index.js.map deleted file mode 100644 index 1f100844..00000000 --- a/node_modules/graphql-request/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAqD;AACrD,oDAAgD;AAChD,0EAAmD;AACnD,iCAA+E;AAG/E,iCAAqC;AAA5B,oGAAA,WAAW,OAAA;AAEpB;;GAEG;AACH,IAAM,cAAc,GAAG,UAAC,OAAmC;IACzD,IAAI,QAAQ,GAA2B,EAAE,CAAA;IACzC,IAAI,OAAO,EAAE;QACX,IACE,CAAC,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,YAAY,OAAO,CAAC;YAC9D,OAAO,YAAY,UAAU,CAAC,OAAO,EACrC;YACA,QAAQ,GAAG,4BAA4B,CAAC,OAAO,CAAC,CAAA;SACjD;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACjC,OAAO,CAAC,OAAO,CAAC,UAAC,EAAa;oBAAZ,IAAI,QAAA,EAAE,KAAK,QAAA;g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,SAAS,SAAS,CAAC,QAAsB;IACvC,IAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IACxD,IAAI,WAAW,IAAI,WAAW,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE;QAC7D,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;KACvB;SAAM;QACL,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;KACvB;AACH,CAAC;AAED;;GAEG;AAEH,SAAS,sBAAsB,CAAC,QAAyB;IACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAA;IAEjD,OAAO,eAAK,CAAC,QAAQ,CAAC,CAAA;AACxB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,GAAG,CAAC,MAA4B;IAAE,mBAAmB;SAAnB,UAAmB,EAAnB,qBAAmB,EAAnB,IAAmB;QAAnB,kCAAmB;;IACnE,OAAO,MAAM,CAAC,MAAM,CAClB,UAAC,WAAW,EAAE,KAAK,EAAE,KAAK,IAAK,OAAA,KAAG,WAAW,GAAG,KAAK,IAAG,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAE,EAArE,CAAqE,EACpG,EAAE,CACH,CAAA;AACH,CAAC;AALD,kBAKC;AAED;;GAEG;AACH,SAAS,4BAA4B,CAAC,OAAgC;IACpE,IAAM,CAAC,GAAQ,EAAE,CAAA;IACjB,OAAO,CAAC,OAAO,CAAC,UAAC,CAAC,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IACV,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,CAAA;AACV,CAAC"} \ No newline at end of file diff --git a/node_modules/graphql-request/dist/types.d.ts b/node_modules/graphql-request/dist/types.d.ts deleted file mode 100644 index 16032a34..00000000 --- a/node_modules/graphql-request/dist/types.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { DocumentNode } from 'graphql/language/ast'; -export declare type Variables = { - [key: string]: any; -}; -export interface GraphQLError { - message: string; - locations: { - line: number; - column: number; - }[]; - path: string[]; -} -export interface GraphQLResponse { - data?: T; - errors?: GraphQLError[]; - extensions?: any; - status: number; - [key: string]: any; -} -export interface GraphQLRequestContext { - query: string; - variables?: V; -} -export declare class ClientError extends Error { - response: GraphQLResponse; - request: GraphQLRequestContext; - constructor(response: GraphQLResponse, request: GraphQLRequestContext); - private static extractMessage; -} -export declare type RequestDocument = string | DocumentNode; diff --git a/node_modules/graphql-request/dist/types.dom.d.ts b/node_modules/graphql-request/dist/types.dom.d.ts deleted file mode 100644 index ba7ed784..00000000 --- a/node_modules/graphql-request/dist/types.dom.d.ts +++ /dev/null @@ -1,360 +0,0 @@ -/** - * This module contains types copied from lib.dom.d.ts that are in the type graph of the fetch API. - * - * This module is inlined to avoid consumers needing to add dom lib to their tsconfig. For original motivations see: - * - * - https://github.com/prisma-labs/graphql-request/issues/26 - * - https://github.com/prisma-labs/graphql-request/issues/15 - */ -/** This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */ -export interface Headers { - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - has(name: string): boolean; - set(name: string, value: string): void; - forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void; -} -/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */ -interface Blob { - readonly size: number; - readonly type: string; - arrayBuffer(): Promise; - slice(start?: number, end?: number, contentType?: string): Blob; - stream(): ReadableStream; - text(): Promise; -} -declare type BufferSource = ArrayBufferView | ArrayBuffer; -interface File extends Blob { - readonly lastModified: number; - readonly name: string; -} -declare type FormDataEntryValue = File | string; -interface URLSearchParams { - /** - * Appends a specified key/value pair as a new search parameter. - */ - append(name: string, value: string): void; - /** - * Deletes the given search parameter, and its associated value, from the list of all search parameters. - */ - delete(name: string): void; - /** - * Returns the first value associated to the given search parameter. - */ - get(name: string): string | null; - /** - * Returns all the values association with a given search parameter. - */ - getAll(name: string): string[]; - /** - * Returns a Boolean indicating if such a search parameter exists. - */ - has(name: string): boolean; - /** - * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. - */ - set(name: string, value: string): void; - sort(): void; - forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void; -} -interface FormData { - append(name: string, value: string | Blob, fileName?: string): void; - delete(name: string): void; - get(name: string): FormDataEntryValue | null; - getAll(name: string): FormDataEntryValue[]; - has(name: string): boolean; - set(name: string, value: string | Blob, fileName?: string): void; - forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void; -} -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(options: { - mode: 'byob'; - }): ReadableStreamBYOBReader; - getReader(): ReadableStreamDefaultReader; - pipeThrough({ writable, readable }: { - writable: WritableStream; - readable: ReadableStream; - }, options?: PipeOptions): ReadableStream; - pipeTo(dest: WritableStream, options?: PipeOptions): Promise; - tee(): [ReadableStream, ReadableStream]; -} -interface ReadableStreamBYOBReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(view: T): Promise>; - releaseLock(): void; -} -declare type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; -interface ReadableStreamReadDoneResult { - done: true; - value?: T; -} -interface ReadableStreamReadValueResult { - done: false; - value: T; -} -interface ReadableStreamDefaultReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare type BodyInit = Blob | BufferSource | FormData | URLSearchParams | ReadableStream | string; -declare type RequestCache = 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; -declare type RequestCredentials = 'omit' | 'same-origin' | 'include'; -declare type HeadersInit = Headers | string[][] | Record; -declare type RequestMode = 'navigate' | 'same-origin' | 'no-cors' | 'cors'; -declare type RequestRedirect = 'follow' | 'error' | 'manual'; -declare type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; -/** An event which takes place in the DOM. */ -interface Event { - /** - * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. - */ - readonly bubbles: boolean; - cancelBubble: boolean; - /** - * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. - */ - readonly cancelable: boolean; - /** - * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. - */ - readonly composed: boolean; - /** - * Returns the object whose event listener's callback is currently being invoked. - */ - readonly currentTarget: EventTarget | null; - /** - * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. - */ - readonly defaultPrevented: boolean; - /** - * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. - */ - readonly eventPhase: number; - /** - * Returns true if event was dispatched by the user agent, and false otherwise. - */ - readonly isTrusted: boolean; - returnValue: boolean; - /** @deprecated */ - readonly srcElement: EventTarget | null; - /** - * Returns the object to which event is dispatched (its target). - */ - readonly target: EventTarget | null; - /** - * Returns the event's timestamp as the number of milliseconds measured relative to the time origin. - */ - readonly timeStamp: number; - /** - * Returns the type of event, e.g. "click", "hashchange", or "submit". - */ - readonly type: string; - /** - * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. - */ - composedPath(): EventTarget[]; - initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; - /** - * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. - */ - preventDefault(): void; - /** - * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. - */ - stopImmediatePropagation(): void; - /** - * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. - */ - stopPropagation(): void; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; - readonly NONE: number; -} -interface EventListener { - (evt: Event): void; -} -interface EventListenerObject { - handleEvent(evt: Event): void; -} -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; -interface EventListenerOptions { - capture?: boolean; -} -interface AddEventListenerOptions extends EventListenerOptions { - once?: boolean; - passive?: boolean; -} -interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; -} -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; -} -interface AbortSignalEventMap { - abort: ProgressEvent; -} -/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ -interface AbortSignal extends EventTarget { - /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. - */ - readonly aborted: boolean; - onabort: ((this: AbortSignal, ev: Event) => any) | null; - addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} -export interface RequestInit { - body?: BodyInit | null; - cache?: RequestCache; - credentials?: RequestCredentials; - headers?: HeadersInit; - integrity?: string; - keepalive?: boolean; - method?: string; - mode?: RequestMode; - redirect?: RequestRedirect; - referrer?: string; - referrerPolicy?: ReferrerPolicy; - signal?: AbortSignal | null; - timeout?: number; - window?: any; - fetch?: any; -} -interface Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - blob(): Promise; - formData(): Promise; - json(): Promise; - text(): Promise; -} -declare type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; -export interface Response extends Body { - readonly headers: Headers; - readonly ok: boolean; - readonly redirected: boolean; - readonly status: number; - readonly statusText: string; - readonly trailer: Promise; - readonly type: ResponseType; - readonly url: string; - clone(): Response; -} -declare type RequestDestination = '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt'; -export interface Request extends Body { - /** - * Returns the cache mode associated with request, which is a string indicating - * how the the request will interact with the browser's cache when fetching. - */ - readonly cache: RequestCache; - /** - * Returns the credentials mode associated with request, which is a string - * indicating whether credentials will be sent with the request always, never, or only when sent to a - * same-origin URL. - */ - readonly credentials: RequestCredentials; - /** - * Returns the kind of resource requested by request, e.g., "document" or - * "script". - */ - readonly destination: RequestDestination; - /** - * Returns a Headers object consisting of the headers associated with request. - * Note that headers added in the network layer by the user agent will not be accounted for in this - * object, e.g., the "Host" header. - */ - readonly headers: Headers; - /** - * Returns request's subresource integrity metadata, which is a cryptographic hash of - * the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] - */ - readonly integrity: string; - /** - * Returns a boolean indicating whether or not request is for a history - * navigation (a.k.a. back-foward navigation). - */ - readonly isHistoryNavigation: boolean; - /** - * Returns a boolean indicating whether or not request is for a reload navigation. - */ - readonly isReloadNavigation: boolean; - /** - * Returns a boolean indicating whether or not request can outlive the global in which - * it was created. - */ - readonly keepalive: boolean; - /** - * Returns request's HTTP method, which is "GET" by default. - */ - readonly method: string; - /** - * Returns the mode associated with request, which is a string indicating - * whether the request will use CORS, or will be restricted to same-origin URLs. - */ - readonly mode: RequestMode; - /** - * Returns the redirect mode associated with request, which is a string - * indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. - */ - readonly redirect: RequestRedirect; - /** - * Returns the referrer of request. Its value can be a same-origin URL if - * explicitly set in init, the empty string to indicate no referrer, and - * "about:client" when defaulting to the global's default. This is used during - * fetching to determine the value of the `Referer` header of the request being made. - */ - readonly referrer: string; - /** - * Returns the referrer policy associated with request. This is used during - * fetching to compute the value of the request's referrer. - */ - readonly referrerPolicy: ReferrerPolicy; - /** - * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort - * event handler. - */ - readonly signal: AbortSignal; - /** - * Returns the URL of request as a string. - */ - readonly url: string; - clone(): Request; -} -/** This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */ -interface WritableStream { - readonly locked: boolean; - abort(reason?: any): Promise; - getWriter(): WritableStreamDefaultWriter; -} -/** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */ -interface WritableStreamDefaultWriter { - readonly closed: Promise; - readonly desiredSize: number | null; - readonly ready: Promise; - abort(reason?: any): Promise; - close(): Promise; - releaseLock(): void; - write(chunk: W): Promise; -} -interface PipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - preventClose?: boolean; - signal?: AbortSignal; -} -export {}; diff --git a/node_modules/graphql-request/dist/types.dom.js b/node_modules/graphql-request/dist/types.dom.js deleted file mode 100644 index 5a4b015e..00000000 --- a/node_modules/graphql-request/dist/types.dom.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -/** - * This module contains types copied from lib.dom.d.ts that are in the type graph of the fetch API. - * - * This module is inlined to avoid consumers needing to add dom lib to their tsconfig. For original motivations see: - * - * - https://github.com/prisma-labs/graphql-request/issues/26 - * - https://github.com/prisma-labs/graphql-request/issues/15 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.dom.js.map \ No newline at end of file diff --git a/node_modules/graphql-request/dist/types.dom.js.map b/node_modules/graphql-request/dist/types.dom.js.map deleted file mode 100644 index eb31d29a..00000000 --- a/node_modules/graphql-request/dist/types.dom.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.dom.js","sourceRoot":"","sources":["../src/types.dom.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"} \ No newline at end of file diff --git a/node_modules/graphql-request/dist/types.js b/node_modules/graphql-request/dist/types.js deleted file mode 100644 index 9a6667f2..00000000 --- a/node_modules/graphql-request/dist/types.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientError = void 0; -var ClientError = /** @class */ (function (_super) { - __extends(ClientError, _super); - function ClientError(response, request) { - var _this = this; - var message = ClientError.extractMessage(response) + ": " + JSON.stringify({ - response: response, - request: request, - }); - _this = _super.call(this, message) || this; - Object.setPrototypeOf(_this, ClientError.prototype); - _this.response = response; - _this.request = request; - // this is needed as Safari doesn't support .captureStackTrace - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(_this, ClientError); - } - return _this; - } - ClientError.extractMessage = function (response) { - try { - return response.errors[0].message; - } - catch (e) { - return "GraphQL Error (Code: " + response.status + ")"; - } - }; - return ClientError; -}(Error)); -exports.ClientError = ClientError; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/graphql-request/dist/types.js.map b/node_modules/graphql-request/dist/types.js.map deleted file mode 100644 index 9b63d4d9..00000000 --- a/node_modules/graphql-request/dist/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuBA;IAAiC,+BAAK;IAIpC,qBAAY,QAAyB,EAAE,OAA8B;QAArE,iBAiBC;QAhBC,IAAM,OAAO,GAAM,WAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,UAAK,IAAI,CAAC,SAAS,CAAC;YACzE,QAAQ,UAAA;YACR,OAAO,SAAA;SACR,CAAG,CAAA;QAEJ,QAAA,kBAAM,OAAO,CAAC,SAAA;QAEd,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;QAElD,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,8DAA8D;QAC9D,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,UAAU,EAAE;YACjD,KAAK,CAAC,iBAAiB,CAAC,KAAI,EAAE,WAAW,CAAC,CAAA;SAC3C;;IACH,CAAC;IAEc,0BAAc,GAA7B,UAA8B,QAAyB;QACrD,IAAI;YACF,OAAO,QAAQ,CAAC,MAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;SACnC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,0BAAwB,QAAQ,CAAC,MAAM,MAAG,CAAA;SAClD;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AA9BD,CAAiC,KAAK,GA8BrC;AA9BY,kCAAW"} \ No newline at end of file diff --git a/node_modules/graphql-request/package.json b/node_modules/graphql-request/package.json deleted file mode 100644 index 9287fde7..00000000 --- a/node_modules/graphql-request/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "_from": "graphql-request@latest", - "_id": "graphql-request@3.3.0", - "_inBundle": false, - "_integrity": "sha512-NHj65WSIUh8j7TBYgzWU0fqvLfxrqFDrLG8nZUh+IREZw50ljR6JXlXRkr52/fL/46wpItiQNLDrG+UZI+KmzA==", - "_location": "/graphql-request", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "graphql-request@latest", - "name": "graphql-request", - "escapedName": "graphql-request", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-3.3.0.tgz", - "_shasum": "1b9003f34b73cd40d691803d2d422fde5c713af3", - "_spec": "graphql-request@latest", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Prisma Labs Team" - }, - "bugs": { - "url": "https://github.com/prisma/graphql-request/issues" - }, - "bundleDependencies": false, - "bundlesize": [ - { - "path": "./dist/index.js", - "maxSize": "15 kB" - } - ], - "dependencies": { - "cross-fetch": "^3.0.6", - "extract-files": "^9.0.0", - "form-data": "^3.0.0" - }, - "deprecated": false, - "description": "Minimal GraphQL client supporting Node and browsers for scripts or simple apps", - "devDependencies": { - "@prisma-labs/prettier-config": "^0.1.0", - "@types/body-parser": "^1.19.0", - "@types/express": "^4.17.8", - "@types/extract-files": "^8.1.0", - "@types/jest": "^26.0.14", - "@types/node": "^14.11.8", - "apollo-server-express": "^2.18.2", - "body-parser": "^1.19.0", - "bundlesize": "^0.18.0", - "doctoc": "^1.4.0", - "dripip": "^0.10.0", - "express": "^4.17.1", - "fetch-cookie": "^0.10.1", - "get-port": "^5.1.1", - "graphql": "^15.3.0", - "graphql-tag": "^2.11.0", - "graphql-upload": "^11.0.0", - "jest": "^26.5.3", - "prettier": "^2.1.2", - "ts-jest": "^26.4.1", - "type-fest": "^0.18.0", - "typescript": "^4.0.3" - }, - "files": [ - "dist" - ], - "homepage": "https://github.com/prisma/graphql-request", - "jest": { - "preset": "ts-jest" - }, - "keywords": [ - "graphql", - "request", - "fetch", - "graphql-client", - "apollo" - ], - "license": "MIT", - "main": "dist/index.js", - "name": "graphql-request", - "peerDependencies": { - "graphql": "14.x || 15.x" - }, - "prettier": "@prisma-labs/prettier-config", - "repository": { - "type": "git", - "url": "git+https://github.com/prisma/graphql-request.git" - }, - "scripts": { - "build": "rm -rf dist && tsc -d", - "build:docs": "doctoc README.md --notitle", - "dev": "rm -rf dist && tsc --watch", - "dev:test": "jest --watch", - "format": "prettier --write .", - "prepublishOnly": "yarn build", - "release:pr": "dripip pr", - "release:preview": "dripip preview", - "release:stable": "dripip stable", - "test": "yarn test:node && yarn test:dom", - "test:dom": "jest --testEnvironment jsdom", - "test:node": "jest --testEnvironment node" - }, - "version": "3.3.0" -} diff --git a/node_modules/graphql-tag/CHANGELOG.md b/node_modules/graphql-tag/CHANGELOG.md deleted file mode 100644 index 0a6fa2d0..00000000 --- a/node_modules/graphql-tag/CHANGELOG.md +++ /dev/null @@ -1,201 +0,0 @@ -# Change log - -### v2.11.0 (2020-07-28) - -* `package.json` `sideEffects` changes to clearly identify that `graphql-tag` doesn't have side effects.
- [@hwillson](http://github.com/hwillson) in [#313](https://github.com/apollographql/graphql-tag/pull/313) - -### v2.10.4 (2020-07-08) - -* Bump dev/peer deps to accommodate `graphql` 15.
- [@adriencohen](https://github.com/adriencohen) in [#299](https://github.com/apollographql/graphql-tag/pull/299) - -### v2.10.3 (2020-02-05) - -* Further adjustments to the TS `index.d.ts` declaration file.
- [@Guillaumez](https://github.com/Guillaumez) in [#289](https://github.com/apollographql/graphql-tag/pull/289) - -### v2.10.2 (2020-02-04) - -* Update/fix the existing TS `index.d.ts` declaration file.
- [@hwillson](https://github.com/hwillson) in [#285](https://github.com/apollographql/graphql-tag/pull/285) - -### v2.10.1 - -* Fix failures in IE11 by avoiding unsupported (by IE11) constructor arguments to `Set` by [rocwang](https://github.com/rocwang) in [#190](https://github.com/apollographql/graphql-tag/pull/190) - -### v2.10.0 -* Add support for `graphql@14` by [timsuchanek](https://github.com/timsuchanek) in [#210](https://github.com/apollographql/graphql-tag/pull/210), [#211](https://github.com/apollographql/graphql-tag/pull/211) - -### v2.9.1 -* Fix IE11 support by using a regular for-loop by [vitorbal](https://github.com/vitorbal) in [#176](https://github.com/apollographql/graphql-tag/pull/176) - -### v2.9.0 -* Remove duplicate exports in named exports by [wacii](https://github.com/wacii) in [#170](https://github.com/apollographql/graphql-tag/pull/170) -* Add `experimentalFragmentVariables` compatibility by [lucasconstantino](https://github.com/lucasconstantino) in [#167](https://github.com/apollographql/graphql-tag/pull/167/) - -### v2.8.0 - -* Update `graphql` to ^0.13, support testing all compatible versions [jnwng](https://github.com/jnwng) in - [PR #156](https://github.com/apollographql/graphql-tag/pull/156) -* Export single queries as both default and named [stonexer](https://github.com/stonexer) in - [PR #154](https://github.com/apollographql/graphql-tag/pull/154) - -### v2.7.{0,1,2,3} - -* Merge and then revert [PR #141](https://github.com/apollographql/graphql-tag/pull/141) due to errors being thrown - -### v2.6.1 - -* Accept `graphql@^0.12.0` as peerDependency [jnwng](https://github.com/jnwng) - addressing [#134](https://github.com/apollographql/graphql-tag/issues/134) - -### v2.6.0 - -* Support multiple query definitions when using Webpack loader [jfaust](https://github.com/jfaust) in - [PR #122](https://github.com/apollographql/graphql-tag/pull/122) - -### v2.5.0 - -* Update graphql to ^0.11.0, add graphql@^0.11.0 to peerDependencies [pleunv](https://github.com/pleunv) in - [PR #124](https://github.com/apollographql/graphql-tag/pull/124) - -### v2.4.{1,2} - -* Temporarily reverting [PR #99](https://github.com/apollographql/graphql-tag/pull/99) to investigate issues with - bundling - -### v2.4.0 - -* Add support for descriptors [jamiter](https://github.com/jamiter) in - [PR #99](https://github.com/apollographql/graphql-tag/pull/99) - -### v2.3.0 - -* Add flow support [michalkvasnicak](https://github.com/michalkvasnicak) in - [PR #98](https://github.com/apollographql/graphql-tag/pull/98) - -### v2.2.2 - -* Make parsing line endings kind agnostic [vlasenko](https://github.com/vlasenko) in - [PR #95](https://github.com/apollographql/graphql-tag/pull/95) - -### v2.2.1 - -* Fix #61: split('/n') does not work on Windows [dnalborczyk](https://github.com/dnalborczyk) in - [PR #89](https://github.com/apollographql/graphql-tag/pull/89) - -### v2.2.0 - -* Bumping `graphql` peer dependency to ^0.10.0 [dotansimha](https://github.com/dotansimha) in - [PR #85](https://github.com/apollographql/graphql-tag/pull/85) - -### v2.1.0 - -* Add support for calling `gql` as a function [matthewerwin](https://github.com/matthewerwin) in - [PR #66](https://github.com/apollographql/graphql-tag/pull/66) -* Including yarn.lock file [PowerKiKi](https://github.com/PowerKiKi) in - [PR #72](https://github.com/apollographql/graphql-tag/pull/72) -* Ignore duplicate fragments when using the Webpack loader [czert](https://github.com/czert) in - [PR #52](https://github.com/apollographql/graphql-tag/pull/52) -* Fixing `graphql-tag/loader` by properly stringifying GraphQL Source [jnwng](https://github.com/jnwng) in - [PR #65](https://github.com/apollographql/graphql-tag/pull/65) - -### v2.0.0 - -Restore dependence on `graphql` module [abhiaiyer91](https://github.com/abhiaiyer91) in -[PR #46](https://github.com/apollographql/graphql-tag/pull/46) addressing -[#6](https://github.com/apollographql/graphql-tag/issues/6) - -* Added `graphql` as a - [peerDependency](https://github.com/apollographql/graphql-tag/commit/ac061dd16440e75c166c85b4bff5ba06c79c9356) - -### v1.3.2 - -* Add typescript definitions for the bundledPrinter [PR #63](https://github.com/apollographql/graphql-tag/pull/63) - -### v1.3.1 - -* Making sure not to log deprecation warnings for internal use of deprecated module [jnwng](https://github.com/jnwng) - addressing [#54](https://github.com/apollographql/graphql-tag/issues/54#issuecomment-283301475) - -### v1.3.0 - -* Bump bundled `graphql` packages to v0.9.1 [jnwng](https://github.com/jnwng) in - [PR #55](https://github.com/apollographql/graphql-tag/pull/55). -* Deprecate the `graphql/language/parser` and `graphql/language/printer` exports [jnwng](https://github.com/jnwng) in - [PR #55](https://github.com/apollographql/graphql-tag/pull/55) - -### v1.2.4 - -Restore Node < 6 compatibility. [DragosRotaru](https://github.com/DragosRotaru) in -[PR #41](https://github.com/apollographql/graphql-tag/pull/41) addressing -[#39](https://github.com/apollographql/graphql-tag/issues/39) - -### v1.2.1 - -Fixed an issue with fragment imports. [PR #35](https://github.com/apollostack/graphql-tag/issues/35). - -### v1.2.0 - -Added ability to import other GraphQL documents with fragments using `#import` comments. -[PR #33](https://github.com/apollostack/graphql-tag/pull/33) - -### v1.1.2 - -Fix issue with interpolating undefined values [Issue #19](https://github.com/apollostack/graphql-tag/issues/19) - -### v1.1.1 - -Added typescript definitions for the below. - -### v1.1.0 - -We now emit warnings if you use the same name for two different fragments. - -You can disable this with: - -```js -import { disableFragmentWarnings } from 'graphql-tag'; - -disableFragmentWarnings(); -``` - -### v1.0.0 - -Releasing 0.1.17 as 1.0.0 in order to be explicit about Semantic Versioning. - -### v0.1.17 - -* Allow embedding fragments inside document strings, as in - -```js -import gql from 'graphql-tag'; - -const fragment = gql` - fragment Foo on Bar { - field - } -`; - -const query = gql` -{ - ...Foo -} -${Foo} -`; -``` - -See also http://dev.apollodata.com/react/fragments.html - -### v0.1.16 - -* Add caching to Webpack loader. [PR #16](https://github.com/apollostack/graphql-tag/pull/16) - -### v0.1.15 - -* Add Webpack loader to `graphql-tag/loader`. - -### v0.1.14 - -Changes were not tracked before this version. diff --git a/node_modules/graphql-tag/CONTRIBUTING.md b/node_modules/graphql-tag/CONTRIBUTING.md deleted file mode 100644 index 651c0717..00000000 --- a/node_modules/graphql-tag/CONTRIBUTING.md +++ /dev/null @@ -1,82 +0,0 @@ -# Apollo Contributor Guide - -Excited about Apollo and want to make it better? We’re excited too! - -Apollo is a community of developers just like you, striving to create the best tools and libraries around GraphQL. We welcome anyone who wants to contribute or provide constructive feedback, no matter the age or level of experience. If you want to help but don't know where to start, let us know, and we'll find something for you. - -Oh, and if you haven't already, sign up for the [Apollo Slack](http://www.apollodata.com/#slack). - -Here are some ways to contribute to the project, from easiest to most difficult: - -* [Reporting bugs](#reporting-bugs) -* [Improving the documentation](#improving-the-documentation) -* [Responding to issues](#responding-to-issues) -* [Small bug fixes](#small-bug-fixes) -* [Suggesting features](#suggesting-features) -* [Big pull requests](#big-prs) - -## Issues - -### Reporting bugs - -If you encounter a bug, please file an issue on GitHub via the repository of the sub-project you think contains the bug. If an issue you have is already reported, please add additional information or add a 👍 reaction to indicate your agreement. - -While we will try to be as helpful as we can on any issue reported, please include the following to maximize the chances of a quick fix: - -1. **Intended outcome:** What you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem. -2. **Actual outcome:** A description of what actually happened, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. Please avoid non-specific phrases like “didn’t work” or “broke”. -3. **How to reproduce the issue:** Instructions for how the issue can be reproduced by a maintainer or contributor. Be as specific as possible, and only mention what is necessary to reproduce the bug. If possible, try to isolate the exact circumstances in which the bug occurs and avoid speculation over what the cause might be. - -Creating a good reproduction really helps contributors investigate and resolve your issue quickly. In many cases, the act of creating a minimal reproduction illuminates that the source of the bug was somewhere outside the library in question, saving time and effort for everyone. - -### Improving the documentation - -Improving the documentation, examples, and other open source content can be the easiest way to contribute to the library. If you see a piece of content that can be better, open a PR with an improvement, no matter how small! If you would like to suggest a big change or major rewrite, we’d love to hear your ideas but please open an issue for discussion before writing the PR. - -### Responding to issues - -In addition to reporting issues, a great way to contribute to Apollo is to respond to other peoples' issues and try to identify the problem or help them work around it. If you’re interested in taking a more active role in this process, please go ahead and respond to issues. And don't forget to say "Hi" on Apollo Slack! - -### Small bug fixes - -For a small bug fix change (less than 20 lines of code changed), feel free to open a pull request. We’ll try to merge it as fast as possible and ideally publish a new release on the same day. The only requirement is, make sure you also add a test that verifies the bug you are trying to fix. - -### Suggesting features - -Most of the features in Apollo came from suggestions by you, the community! We welcome any ideas about how to make Apollo better for your use case. Unless there is overwhelming demand for a feature, it might not get implemented immediately, but please include as much information as possible that will help people have a discussion about your proposal: - -1. **Use case:** What are you trying to accomplish, in specific terms? Often, there might already be a good way to do what you need and a new feature is unnecessary, but it’s hard to know without information about the specific use case. -2. **Could this be a plugin?** In many cases, a feature might be too niche to be included in the core of a library, and is better implemented as a companion package. If there isn’t a way to extend the library to do what you want, could we add additional plugin APIs? It’s important to make the case for why a feature should be part of the core functionality of the library. -3. **Is there a workaround?** Is this a more convenient way to do something that is already possible, or is there some blocker that makes a workaround unfeasible? - -Feature requests will be labeled as such, and we encourage using GitHub issues as a place to discuss new features and possible implementation designs. Please refrain from submitting a pull request to implement a proposed feature until there is consensus that it should be included. This way, you can avoid putting in work that can’t be merged in. - -Once there is a consensus on the need for a new feature, proceed as listed below under “Big PRs”. - -## Big PRs - -This includes: - -- Big bug fixes -- New features - -For significant changes to a repository, it’s important to settle on a design before starting on the implementation. This way, we can make sure that major improvements get the care and attention they deserve. Since big changes can be risky and might not always get merged, it’s good to reduce the amount of possible wasted effort by agreeing on an implementation design/plan first. - -1. **Open an issue.** Open an issue about your bug or feature, as described above. -2. **Reach consensus.** Some contributors and community members should reach an agreement that this feature or bug is important, and that someone should work on implementing or fixing it. -3. **Agree on intended behavior.** On the issue, reach an agreement about the desired behavior. In the case of a bug fix, it should be clear what it means for the bug to be fixed, and in the case of a feature, it should be clear what it will be like for developers to use the new feature. -4. **Agree on implementation plan.** Write a plan for how this feature or bug fix should be implemented. What modules need to be added or rewritten? Should this be one pull request or multiple incremental improvements? Who is going to do each part? -5. **Submit PR.** In the case where multiple dependent patches need to be made to implement the change, only submit one at a time. Otherwise, the others might get stale while the first is reviewed and merged. Make sure to avoid “while we’re here” type changes - if something isn’t relevant to the improvement at hand, it should be in a separate PR; this especially includes code style changes of unrelated code. -6. **Review.** At least one core contributor should sign off on the change before it’s merged. Look at the “code review” section below to learn about factors are important in the code review. If you want to expedite the code being merged, try to review your own code first! -7. **Merge and release!** - -### Code review guidelines - -It’s important that every piece of code in Apollo packages is reviewed by at least one core contributor familiar with that codebase. Here are some things we look for: - -1. **Required CI checks pass.** This is a prerequisite for the review, and it is the PR author's responsibility. As long as the tests don’t pass, the PR won't get reviewed. -2. **Simplicity.** Is this the simplest way to achieve the intended goal? If there are too many files, redundant functions, or complex lines of code, suggest a simpler way to do the same thing. In particular, avoid implementing an overly general solution when a simple, small, and pragmatic fix will do. -3. **Testing.** Do the tests ensure this code won’t break when other stuff changes around it? When it does break, will the tests added help us identify which part of the library has the problem? Did we cover an appropriate set of edge cases? Look at the test coverage report if there is one. Are all significant code paths in the new code exercised at least once? -4. **No unnecessary or unrelated changes.** PRs shouldn’t come with random formatting changes, especially in unrelated parts of the code. If there is some refactoring that needs to be done, it should be in a separate PR from a bug fix or feature, if possible. -5. **Code has appropriate comments.** Code should be commented, or written in a clear “self-documenting” way. -6. **Idiomatic use of the language.** In TypeScript, make sure the typings are specific and correct. In ES2015, make sure to use imports rather than require and const instead of var, etc. Ideally a linter enforces a lot of this, but use your common sense and follow the style of the surrounding code. diff --git a/node_modules/graphql-tag/LICENSE b/node_modules/graphql-tag/LICENSE deleted file mode 100644 index 213aab3e..00000000 --- a/node_modules/graphql-tag/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2020 Meteor Development Group, Inc. - -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. diff --git a/node_modules/graphql-tag/README.md b/node_modules/graphql-tag/README.md deleted file mode 100644 index 56eb23bd..00000000 --- a/node_modules/graphql-tag/README.md +++ /dev/null @@ -1,226 +0,0 @@ -# graphql-tag -[![npm version](https://badge.fury.io/js/graphql-tag.svg)](https://badge.fury.io/js/graphql-tag) -[![Build Status](https://travis-ci.org/apollographql/graphql-tag.svg?branch=master)](https://travis-ci.org/apollographql/graphql-tag) -[![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](http://www.apollodata.com/#slack) - -Helpful utilities for parsing GraphQL queries. Includes: - -- `gql` A JavaScript template literal tag that parses GraphQL query strings into the standard GraphQL AST. -- `/loader` A webpack loader to preprocess queries - -`graphql-tag` uses [the reference `graphql` library](https://github.com/graphql/graphql-js) under the hood as a peer dependency, so in addition to installing this module, you'll also have to install `graphql-js`. - -### gql - -The `gql` template literal tag can be used to concisely write a GraphQL query that is parsed into a standard GraphQL AST. It is the recommended method for passing queries to [Apollo Client](https://github.com/apollographql/apollo-client). While it is primarily built for Apollo Client, it generates a generic GraphQL AST which can be used by any GraphQL client. - -```js -import gql from 'graphql-tag'; - -const query = gql` - { - user(id: 5) { - firstName - lastName - } - } -` -``` - -The above query now contains the following syntax tree. - -```js -{ - "kind": "Document", - "definitions": [ - { - "kind": "OperationDefinition", - "operation": "query", - "name": null, - "variableDefinitions": null, - "directives": [], - "selectionSet": { - "kind": "SelectionSet", - "selections": [ - { - "kind": "Field", - "alias": null, - "name": { - "kind": "Name", - "value": "user", - ... - } - } - ] - } - } - ] -} -``` - -#### Fragments - -The `gql` tag can also be used to define reusable fragments, which can easily be added to queries or other fragments. - -```js -import gql from 'graphql-tag'; - -const userFragment = gql` - fragment User_user on User { - firstName - lastName - } -` -``` - -The above `userFragment` document can be embedded in another document using a template literal placeholder. - -```js -const query = gql` - { - user(id: 5) { - ...User_user - } - } - ${userFragment} -` -``` - -**Note:** _While it may seem redundant to have to both embed the `userFragment` variable in the template literal **AND** spread the `...User_user` fragment in the graphQL selection set, this requirement makes static analysis by tools such as `eslint-plugin-graphql` possible._ - -#### Why use this? - -GraphQL strings are the right way to write queries in your code, because they can be statically analyzed using tools like [eslint-plugin-graphql](https://github.com/apollographql/eslint-plugin-graphql). However, strings are inconvenient to manipulate, if you are trying to do things like add extra fields, merge multiple queries together, or other interesting stuff. - -That's where this package comes in - it lets you write your queries with [ES2015 template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) and compile them into an AST with the `gql` tag. - -#### Caching parse results - -This package only has one feature - it caches previous parse results in a simple dictionary. This means that if you call the tag on the same query multiple times, it doesn't waste time parsing it again. It also means you can use `===` to compare queries to check if they are identical. - - -### Importing graphQL files - -_To add support for importing `.graphql`/`.gql` files, see [Webpack loading and preprocessing](#webpack-loading-and-preprocessing) below._ - -Given a file `MyQuery.graphql` - -```graphql -query MyQuery { - ... -} -``` - -If you have configured [the webpack graphql-tag/loader](#webpack-loading-and-preprocessing), you can import modules containing graphQL queries. The imported value will be the pre-built AST. - -```graphql -import MyQuery from 'query.graphql' -``` - -#### Importing queries by name - -You can also import query and fragment documents by name. - -```graphql -query MyQuery1 { - ... -} - -query MyQuery2 { - ... -} -``` - -And in your JavaScript: - -```javascript -import { MyQuery1, MyQuery2 } from 'query.graphql' -``` - -### Preprocessing queries and fragments - -Preprocessing GraphQL queries and fragments into ASTs at build time can greatly improve load times. - -#### Babel preprocessing - -GraphQL queries can be compiled at build time using [babel-plugin-graphql-tag](https://github.com/gajus/babel-plugin-graphql-tag). Pre-compiling queries decreases script initialization time and reduces bundle sizes by potentially removing the need for `graphql-tag` at runtime. - -#### TypeScript preprocessing - -Try this custom transformer to pre-compile your GraphQL queries in TypeScript: [ts-transform-graphql-tag](https://github.com/firede/ts-transform-graphql-tag). - -#### React Native and Next.js preprocessing - -Preprocessing queries via the webpack loader is not always possible. [babel-plugin-import-graphql](https://www.npmjs.com/package/babel-plugin-import-graphql) supports importing graphql files directly into your JavaScript by preprocessing GraphQL queries into ASTs at compile-time. - -E.g.: - -```javascript -import myImportedQuery from './productsQuery.graphql' - -class ProductsPage extends React.Component { - ... -} -``` - -#### Webpack loading and preprocessing - -Using the included `graphql-tag/loader` it is possible to maintain query logic that is separate from the rest of your application logic. With the loader configured, imported graphQL files will be converted to AST during the webpack build process. - -_**Example webpack configuration**_ - -```js -{ - ... - loaders: [ - { - test: /\.(graphql|gql)$/, - exclude: /node_modules/, - loader: 'graphql-tag/loader' - } - ], - ... -} -``` - -#### Create React App - -Preprocessing GraphQL imports is supported in **create-react-app** >= v2 using [evenchange4/graphql.macro](https://github.com/evenchange4/graphql.macro). - -For **create-react-app** < v2, you'll either need to eject or use [react-app-rewire-inline-import-graphql-ast](https://www.npmjs.com/package/react-app-rewire-inline-import-graphql-ast). - -#### Testing - -Testing environments that don't support Webpack require additional configuration. For [Jest](https://facebook.github.io/jest/) use [jest-transform-graphql](https://github.com/remind101/jest-transform-graphql). - -### Warnings - -This package will emit a warning if you have multiple fragments of the same name. You can disable this with: - -```js -import { disableFragmentWarnings } from 'graphql-tag'; - -disableFragmentWarnings() -``` - -### Experimental Fragment Variables - -This package exports an `experimentalFragmentVariables` flag that allows you to use experimental support for [parameterized fragments](https://github.com/facebook/graphql/issues/204). - -You can enable / disable this with: - -```js -import { enableExperimentalFragmentVariables, disableExperimentalFragmentVariables } from 'graphql-tag'; -``` - -Enabling this feature allows you declare documents of the form - -```graphql -fragment SomeFragment ($arg: String!) on SomeType { - someField -} -``` - -### Resources - -You can easily generate and explore a GraphQL AST on [astexplorer.net](https://astexplorer.net/#/drYr8X1rnP/1). diff --git a/node_modules/graphql-tag/index.d.ts b/node_modules/graphql-tag/index.d.ts deleted file mode 100644 index cbd93d3a..00000000 --- a/node_modules/graphql-tag/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare module "graphql-tag" { - function gql( - literals: ReadonlyArray | Readonly, - ...placeholders: any[] - ): import("graphql").DocumentNode; - - namespace gql { - function resetCaches(): void; - function disableFragmentWarnings(): void; - function enableExperimentalFragmentVariables(): void; - function disableExperimentalFragmentVariables(): void; - } - - export default gql; - - export function resetCaches(): void; - export function disableFragmentWarnings(): void; - export function enableExperimentalFragmentVariables(): void; - export function disableExperimentalFragmentVariables(): void; -} diff --git a/node_modules/graphql-tag/lib/graphql-tag.umd.js b/node_modules/graphql-tag/lib/graphql-tag.umd.js deleted file mode 100644 index e05e8fe7..00000000 --- a/node_modules/graphql-tag/lib/graphql-tag.umd.js +++ /dev/null @@ -1,189 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory() : - typeof define === 'function' && define.amd ? define(factory) : - (factory()); -}(this, (function () { 'use strict'; - -var parser = require('graphql/language/parser'); - -var parse = parser.parse; - -// Strip insignificant whitespace -// Note that this could do a lot more, such as reorder fields etc. -function normalize(string) { - return string.replace(/[\s,]+/g, ' ').trim(); -} - -// A map docString -> graphql document -var docCache = {}; - -// A map fragmentName -> [normalized source] -var fragmentSourceMap = {}; - -function cacheKeyFromLoc(loc) { - return normalize(loc.source.body.substring(loc.start, loc.end)); -} - -// For testing. -function resetCaches() { - docCache = {}; - fragmentSourceMap = {}; -} - -// Take a unstripped parsed document (query/mutation or even fragment), and -// check all fragment definitions, checking for name->source uniqueness. -// We also want to make sure only unique fragments exist in the document. -var printFragmentWarnings = true; -function processFragments(ast) { - var astFragmentMap = {}; - var definitions = []; - - for (var i = 0; i < ast.definitions.length; i++) { - var fragmentDefinition = ast.definitions[i]; - - if (fragmentDefinition.kind === 'FragmentDefinition') { - var fragmentName = fragmentDefinition.name.value; - var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); - - // We know something about this fragment - if (fragmentSourceMap.hasOwnProperty(fragmentName) && !fragmentSourceMap[fragmentName][sourceKey]) { - - // this is a problem because the app developer is trying to register another fragment with - // the same name as one previously registered. So, we tell them about it. - if (printFragmentWarnings) { - console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" - + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" - + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); - } - - fragmentSourceMap[fragmentName][sourceKey] = true; - - } else if (!fragmentSourceMap.hasOwnProperty(fragmentName)) { - fragmentSourceMap[fragmentName] = {}; - fragmentSourceMap[fragmentName][sourceKey] = true; - } - - if (!astFragmentMap[sourceKey]) { - astFragmentMap[sourceKey] = true; - definitions.push(fragmentDefinition); - } - } else { - definitions.push(fragmentDefinition); - } - } - - ast.definitions = definitions; - return ast; -} - -function disableFragmentWarnings() { - printFragmentWarnings = false; -} - -function stripLoc(doc, removeLocAtThisLevel) { - var docType = Object.prototype.toString.call(doc); - - if (docType === '[object Array]') { - return doc.map(function (d) { - return stripLoc(d, removeLocAtThisLevel); - }); - } - - if (docType !== '[object Object]') { - throw new Error('Unexpected input.'); - } - - // We don't want to remove the root loc field so we can use it - // for fragment substitution (see below) - if (removeLocAtThisLevel && doc.loc) { - delete doc.loc; - } - - // https://github.com/apollographql/graphql-tag/issues/40 - if (doc.loc) { - delete doc.loc.startToken; - delete doc.loc.endToken; - } - - var keys = Object.keys(doc); - var key; - var value; - var valueType; - - for (key in keys) { - if (keys.hasOwnProperty(key)) { - value = doc[keys[key]]; - valueType = Object.prototype.toString.call(value); - - if (valueType === '[object Object]' || valueType === '[object Array]') { - doc[keys[key]] = stripLoc(value, true); - } - } - } - - return doc; -} - -var experimentalFragmentVariables = false; -function parseDocument(doc) { - var cacheKey = normalize(doc); - - if (docCache[cacheKey]) { - return docCache[cacheKey]; - } - - var parsed = parse(doc, { experimentalFragmentVariables: experimentalFragmentVariables }); - if (!parsed || parsed.kind !== 'Document') { - throw new Error('Not a valid GraphQL document.'); - } - - // check that all "new" fragments inside the documents are consistent with - // existing fragments of the same name - parsed = processFragments(parsed); - parsed = stripLoc(parsed, false); - docCache[cacheKey] = parsed; - - return parsed; -} - -function enableExperimentalFragmentVariables() { - experimentalFragmentVariables = true; -} - -function disableExperimentalFragmentVariables() { - experimentalFragmentVariables = false; -} - -// XXX This should eventually disallow arbitrary string interpolation, like Relay does -function gql(/* arguments */) { - var args = Array.prototype.slice.call(arguments); - - var literals = args[0]; - - // We always get literals[0] and then matching post literals for each arg given - var result = (typeof(literals) === "string") ? literals : literals[0]; - - for (var i = 1; i < args.length; i++) { - if (args[i] && args[i].kind && args[i].kind === 'Document') { - result += args[i].loc.source.body; - } else { - result += args[i]; - } - - result += literals[i]; - } - - return parseDocument(result); -} - -// Support typescript, which isn't as nice as Babel about default exports -gql.default = gql; -gql.resetCaches = resetCaches; -gql.disableFragmentWarnings = disableFragmentWarnings; -gql.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables; -gql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables; - -module.exports = gql; - -}))); -//# sourceMappingURL=graphql-tag.umd.js.map diff --git a/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow b/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow deleted file mode 100644 index 7acb6237..00000000 --- a/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow +++ /dev/null @@ -1,7 +0,0 @@ -// @flow - -import type { DocumentNode } from 'graphql'; - -declare export default function gql(literals: any, ...placeholders: any[]): DocumentNode; -declare export function resetCaches(): void; -declare export function disableFragmentWarnings(): void; diff --git a/node_modules/graphql-tag/lib/graphql-tag.umd.js.map b/node_modules/graphql-tag/lib/graphql-tag.umd.js.map deleted file mode 100644 index f5fe04c0..00000000 --- a/node_modules/graphql-tag/lib/graphql-tag.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"graphql-tag.umd.js","sources":["../src/index.js"],"sourcesContent":["var parser = require('graphql/language/parser');\n\nvar parse = parser.parse;\n\n// Strip insignificant whitespace\n// Note that this could do a lot more, such as reorder fields etc.\nfunction normalize(string) {\n return string.replace(/[\\s,]+/g, ' ').trim();\n}\n\n// A map docString -> graphql document\nvar docCache = {};\n\n// A map fragmentName -> [normalized source]\nvar fragmentSourceMap = {};\n\nfunction cacheKeyFromLoc(loc) {\n return normalize(loc.source.body.substring(loc.start, loc.end));\n}\n\n// For testing.\nfunction resetCaches() {\n docCache = {};\n fragmentSourceMap = {};\n}\n\n// Take a unstripped parsed document (query/mutation or even fragment), and\n// check all fragment definitions, checking for name->source uniqueness.\n// We also want to make sure only unique fragments exist in the document.\nvar printFragmentWarnings = true;\nfunction processFragments(ast) {\n var astFragmentMap = {};\n var definitions = [];\n\n for (var i = 0; i < ast.definitions.length; i++) {\n var fragmentDefinition = ast.definitions[i];\n\n if (fragmentDefinition.kind === 'FragmentDefinition') {\n var fragmentName = fragmentDefinition.name.value;\n var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);\n\n // We know something about this fragment\n if (fragmentSourceMap.hasOwnProperty(fragmentName) && !fragmentSourceMap[fragmentName][sourceKey]) {\n\n // this is a problem because the app developer is trying to register another fragment with\n // the same name as one previously registered. So, we tell them about it.\n if (printFragmentWarnings) {\n console.warn(\"Warning: fragment with name \" + fragmentName + \" already exists.\\n\"\n + \"graphql-tag enforces all fragment names across your application to be unique; read more about\\n\"\n + \"this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names\");\n }\n\n fragmentSourceMap[fragmentName][sourceKey] = true;\n\n } else if (!fragmentSourceMap.hasOwnProperty(fragmentName)) {\n fragmentSourceMap[fragmentName] = {};\n fragmentSourceMap[fragmentName][sourceKey] = true;\n }\n\n if (!astFragmentMap[sourceKey]) {\n astFragmentMap[sourceKey] = true;\n definitions.push(fragmentDefinition);\n }\n } else {\n definitions.push(fragmentDefinition);\n }\n }\n\n ast.definitions = definitions;\n return ast;\n}\n\nfunction disableFragmentWarnings() {\n printFragmentWarnings = false;\n}\n\nfunction stripLoc(doc, removeLocAtThisLevel) {\n var docType = Object.prototype.toString.call(doc);\n\n if (docType === '[object Array]') {\n return doc.map(function (d) {\n return stripLoc(d, removeLocAtThisLevel);\n });\n }\n\n if (docType !== '[object Object]') {\n throw new Error('Unexpected input.');\n }\n\n // We don't want to remove the root loc field so we can use it\n // for fragment substitution (see below)\n if (removeLocAtThisLevel && doc.loc) {\n delete doc.loc;\n }\n\n // https://github.com/apollographql/graphql-tag/issues/40\n if (doc.loc) {\n delete doc.loc.startToken;\n delete doc.loc.endToken;\n }\n\n var keys = Object.keys(doc);\n var key;\n var value;\n var valueType;\n\n for (key in keys) {\n if (keys.hasOwnProperty(key)) {\n value = doc[keys[key]];\n valueType = Object.prototype.toString.call(value);\n\n if (valueType === '[object Object]' || valueType === '[object Array]') {\n doc[keys[key]] = stripLoc(value, true);\n }\n }\n }\n\n return doc;\n}\n\nvar experimentalFragmentVariables = false;\nfunction parseDocument(doc) {\n var cacheKey = normalize(doc);\n\n if (docCache[cacheKey]) {\n return docCache[cacheKey];\n }\n\n var parsed = parse(doc, { experimentalFragmentVariables: experimentalFragmentVariables });\n if (!parsed || parsed.kind !== 'Document') {\n throw new Error('Not a valid GraphQL document.');\n }\n\n // check that all \"new\" fragments inside the documents are consistent with\n // existing fragments of the same name\n parsed = processFragments(parsed);\n parsed = stripLoc(parsed, false);\n docCache[cacheKey] = parsed;\n\n return parsed;\n}\n\nfunction enableExperimentalFragmentVariables() {\n experimentalFragmentVariables = true;\n}\n\nfunction disableExperimentalFragmentVariables() {\n experimentalFragmentVariables = false;\n}\n\n// XXX This should eventually disallow arbitrary string interpolation, like Relay does\nfunction gql(/* arguments */) {\n var args = Array.prototype.slice.call(arguments);\n\n var literals = args[0];\n\n // We always get literals[0] and then matching post literals for each arg given\n var result = (typeof(literals) === \"string\") ? literals : literals[0];\n\n for (var i = 1; i < args.length; i++) {\n if (args[i] && args[i].kind && args[i].kind === 'Document') {\n result += args[i].loc.source.body;\n } else {\n result += args[i];\n }\n\n result += literals[i];\n }\n\n return parseDocument(result);\n}\n\n// Support typescript, which isn't as nice as Babel about default exports\ngql.default = gql;\ngql.resetCaches = resetCaches;\ngql.disableFragmentWarnings = disableFragmentWarnings;\ngql.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables;\ngql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables;\n\nmodule.exports = gql;\n"],"names":[],"mappings":";;;;;;AAAA,IAAI,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;;AAEhD,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;;;;AAIzB,SAAS,SAAS,CAAC,MAAM,EAAE;EACzB,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;CAC9C;;;AAGD,IAAI,QAAQ,GAAG,EAAE,CAAC;;;AAGlB,IAAI,iBAAiB,GAAG,EAAE,CAAC;;AAE3B,SAAS,eAAe,CAAC,GAAG,EAAE;EAC5B,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;CACjE;;;AAGD,SAAS,WAAW,GAAG;EACrB,QAAQ,GAAG,EAAE,CAAC;EACd,iBAAiB,GAAG,EAAE,CAAC;CACxB;;;;;AAKD,IAAI,qBAAqB,GAAG,IAAI,CAAC;AACjC,SAAS,gBAAgB,CAAC,GAAG,EAAE;EAC7B,IAAI,cAAc,GAAG,EAAE,CAAC;EACxB,IAAI,WAAW,GAAG,EAAE,CAAC;;EAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IAC/C,IAAI,kBAAkB,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;;IAE5C,IAAI,kBAAkB,CAAC,IAAI,KAAK,oBAAoB,EAAE;MACpD,IAAI,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;MACjD,IAAI,SAAS,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC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CAC9B;;;AAGD,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC;AAClB,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC;AAC9B,GAAG,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;AACtD,GAAG,CAAC,mCAAmC,GAAG,mCAAmC,CAAC;AAC9E,GAAG,CAAC,oCAAoC,GAAG,oCAAoC,CAAC;;AAEhF,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;;;;"} \ No newline at end of file diff --git a/node_modules/graphql-tag/loader.js b/node_modules/graphql-tag/loader.js deleted file mode 100644 index 4ceac4d3..00000000 --- a/node_modules/graphql-tag/loader.js +++ /dev/null @@ -1,190 +0,0 @@ -"use strict"; - -const os = require('os'); -const gql = require('./src'); - -// Takes `source` (the source GraphQL query string) -// and `doc` (the parsed GraphQL document) and tacks on -// the imported definitions. -function expandImports(source, doc) { - const lines = source.split(/\r\n|\r|\n/); - let outputCode = ` - var names = {}; - function unique(defs) { - return defs.filter( - function(def) { - if (def.kind !== 'FragmentDefinition') return true; - var name = def.name.value - if (names[name]) { - return false; - } else { - names[name] = true; - return true; - } - } - ) - } - `; - - lines.some((line) => { - if (line[0] === '#' && line.slice(1).split(' ')[0] === 'import') { - const importFile = line.slice(1).split(' ')[1]; - const parseDocument = `require(${importFile})`; - const appendDef = `doc.definitions = doc.definitions.concat(unique(${parseDocument}.definitions));`; - outputCode += appendDef + os.EOL; - } - return (line.length !== 0 && line[0] !== '#'); - }); - - return outputCode; -} - -module.exports = function(source) { - this.cacheable(); - const doc = gql`${source}`; - let headerCode = ` - var doc = ${JSON.stringify(doc)}; - doc.loc.source = ${JSON.stringify(doc.loc.source)}; - `; - - let outputCode = ""; - - // Allow multiple query/mutation definitions in a file. This parses out dependencies - // at compile time, and then uses those at load time to create minimal query documents - // We cannot do the latter at compile time due to how the #import code works. - let operationCount = doc.definitions.reduce(function(accum, op) { - if (op.kind === "OperationDefinition") { - return accum + 1; - } - - return accum; - }, 0); - - if (operationCount < 1) { - outputCode += ` - module.exports = doc; - ` - } else { - outputCode += ` - // Collect any fragment/type references from a node, adding them to the refs Set - function collectFragmentReferences(node, refs) { - if (node.kind === "FragmentSpread") { - refs.add(node.name.value); - } else if (node.kind === "VariableDefinition") { - var type = node.type; - if (type.kind === "NamedType") { - refs.add(type.name.value); - } - } - - if (node.selectionSet) { - node.selectionSet.selections.forEach(function(selection) { - collectFragmentReferences(selection, refs); - }); - } - - if (node.variableDefinitions) { - node.variableDefinitions.forEach(function(def) { - collectFragmentReferences(def, refs); - }); - } - - if (node.definitions) { - node.definitions.forEach(function(def) { - collectFragmentReferences(def, refs); - }); - } - } - - var definitionRefs = {}; - (function extractReferences() { - doc.definitions.forEach(function(def) { - if (def.name) { - var refs = new Set(); - collectFragmentReferences(def, refs); - definitionRefs[def.name.value] = refs; - } - }); - })(); - - function findOperation(doc, name) { - for (var i = 0; i < doc.definitions.length; i++) { - var element = doc.definitions[i]; - if (element.name && element.name.value == name) { - return element; - } - } - } - - function oneQuery(doc, operationName) { - // Copy the DocumentNode, but clear out the definitions - var newDoc = { - kind: doc.kind, - definitions: [findOperation(doc, operationName)] - }; - if (doc.hasOwnProperty("loc")) { - newDoc.loc = doc.loc; - } - - // Now, for the operation we're running, find any fragments referenced by - // it or the fragments it references - var opRefs = definitionRefs[operationName] || new Set(); - var allRefs = new Set(); - var newRefs = new Set(); - - // IE 11 doesn't support "new Set(iterable)", so we add the members of opRefs to newRefs one by one - opRefs.forEach(function(refName) { - newRefs.add(refName); - }); - - while (newRefs.size > 0) { - var prevRefs = newRefs; - newRefs = new Set(); - - prevRefs.forEach(function(refName) { - if (!allRefs.has(refName)) { - allRefs.add(refName); - var childRefs = definitionRefs[refName] || new Set(); - childRefs.forEach(function(childRef) { - newRefs.add(childRef); - }); - } - }); - } - - allRefs.forEach(function(refName) { - var op = findOperation(doc, refName); - if (op) { - newDoc.definitions.push(op); - } - }); - - return newDoc; - } - - module.exports = doc; - ` - - for (const op of doc.definitions) { - if (op.kind === "OperationDefinition") { - if (!op.name) { - if (operationCount > 1) { - throw "Query/mutation names are required for a document with multiple definitions"; - } else { - continue; - } - } - - const opName = op.name.value; - outputCode += ` - module.exports["${opName}"] = oneQuery(doc, "${opName}"); - ` - } - } - } - - const importOutputCode = expandImports(source, doc); - const allCode = headerCode + os.EOL + importOutputCode + os.EOL + outputCode + os.EOL; - - return allCode; -}; diff --git a/node_modules/graphql-tag/package.json b/node_modules/graphql-tag/package.json deleted file mode 100644 index 5a2cd996..00000000 --- a/node_modules/graphql-tag/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "_from": "graphql-tag@latest", - "_id": "graphql-tag@2.11.0", - "_inBundle": false, - "_integrity": "sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA==", - "_location": "/graphql-tag", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "graphql-tag@latest", - "name": "graphql-tag", - "escapedName": "graphql-tag", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.11.0.tgz", - "_shasum": "1deb53a01c46a7eb401d6cb59dec86fa1cccbffd", - "_spec": "graphql-tag@latest", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": "", - "bugs": { - "url": "https://github.com/apollographql/graphql-tag/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A JavaScript template literal tag that parses GraphQL queries", - "devDependencies": { - "babel-preset-es2015": "^6.9.0", - "babel-register": "^6.9.0", - "chai": "^4.0.2", - "graphql": "^15.0.0", - "mocha": "^3.4.1", - "rollup": "^0.45.0", - "test-all-versions": "^3.3.2" - }, - "homepage": "https://github.com/apollographql/graphql-tag#readme", - "jsnext:main": "./src/index.js", - "license": "MIT", - "main": "./lib/graphql-tag.umd.js", - "module": "./src/index.js", - "name": "graphql-tag", - "peerDependencies": { - "graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/graphql-tag.git" - }, - "scripts": { - "bundle": "rollup -c && cp src/index.js.flow lib/graphql-tag.umd.js.flow", - "prepublish": "npm run bundle", - "test": "mocha test/graphql.js" - }, - "sideEffects": false, - "version": "2.11.0" -} diff --git a/node_modules/graphql-tag/src/index.js b/node_modules/graphql-tag/src/index.js deleted file mode 100644 index f52711e4..00000000 --- a/node_modules/graphql-tag/src/index.js +++ /dev/null @@ -1,180 +0,0 @@ -var parser = require('graphql/language/parser'); - -var parse = parser.parse; - -// Strip insignificant whitespace -// Note that this could do a lot more, such as reorder fields etc. -function normalize(string) { - return string.replace(/[\s,]+/g, ' ').trim(); -} - -// A map docString -> graphql document -var docCache = {}; - -// A map fragmentName -> [normalized source] -var fragmentSourceMap = {}; - -function cacheKeyFromLoc(loc) { - return normalize(loc.source.body.substring(loc.start, loc.end)); -} - -// For testing. -function resetCaches() { - docCache = {}; - fragmentSourceMap = {}; -} - -// Take a unstripped parsed document (query/mutation or even fragment), and -// check all fragment definitions, checking for name->source uniqueness. -// We also want to make sure only unique fragments exist in the document. -var printFragmentWarnings = true; -function processFragments(ast) { - var astFragmentMap = {}; - var definitions = []; - - for (var i = 0; i < ast.definitions.length; i++) { - var fragmentDefinition = ast.definitions[i]; - - if (fragmentDefinition.kind === 'FragmentDefinition') { - var fragmentName = fragmentDefinition.name.value; - var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); - - // We know something about this fragment - if (fragmentSourceMap.hasOwnProperty(fragmentName) && !fragmentSourceMap[fragmentName][sourceKey]) { - - // this is a problem because the app developer is trying to register another fragment with - // the same name as one previously registered. So, we tell them about it. - if (printFragmentWarnings) { - console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" - + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" - + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); - } - - fragmentSourceMap[fragmentName][sourceKey] = true; - - } else if (!fragmentSourceMap.hasOwnProperty(fragmentName)) { - fragmentSourceMap[fragmentName] = {}; - fragmentSourceMap[fragmentName][sourceKey] = true; - } - - if (!astFragmentMap[sourceKey]) { - astFragmentMap[sourceKey] = true; - definitions.push(fragmentDefinition); - } - } else { - definitions.push(fragmentDefinition); - } - } - - ast.definitions = definitions; - return ast; -} - -function disableFragmentWarnings() { - printFragmentWarnings = false; -} - -function stripLoc(doc, removeLocAtThisLevel) { - var docType = Object.prototype.toString.call(doc); - - if (docType === '[object Array]') { - return doc.map(function (d) { - return stripLoc(d, removeLocAtThisLevel); - }); - } - - if (docType !== '[object Object]') { - throw new Error('Unexpected input.'); - } - - // We don't want to remove the root loc field so we can use it - // for fragment substitution (see below) - if (removeLocAtThisLevel && doc.loc) { - delete doc.loc; - } - - // https://github.com/apollographql/graphql-tag/issues/40 - if (doc.loc) { - delete doc.loc.startToken; - delete doc.loc.endToken; - } - - var keys = Object.keys(doc); - var key; - var value; - var valueType; - - for (key in keys) { - if (keys.hasOwnProperty(key)) { - value = doc[keys[key]]; - valueType = Object.prototype.toString.call(value); - - if (valueType === '[object Object]' || valueType === '[object Array]') { - doc[keys[key]] = stripLoc(value, true); - } - } - } - - return doc; -} - -var experimentalFragmentVariables = false; -function parseDocument(doc) { - var cacheKey = normalize(doc); - - if (docCache[cacheKey]) { - return docCache[cacheKey]; - } - - var parsed = parse(doc, { experimentalFragmentVariables: experimentalFragmentVariables }); - if (!parsed || parsed.kind !== 'Document') { - throw new Error('Not a valid GraphQL document.'); - } - - // check that all "new" fragments inside the documents are consistent with - // existing fragments of the same name - parsed = processFragments(parsed); - parsed = stripLoc(parsed, false); - docCache[cacheKey] = parsed; - - return parsed; -} - -function enableExperimentalFragmentVariables() { - experimentalFragmentVariables = true; -} - -function disableExperimentalFragmentVariables() { - experimentalFragmentVariables = false; -} - -// XXX This should eventually disallow arbitrary string interpolation, like Relay does -function gql(/* arguments */) { - var args = Array.prototype.slice.call(arguments); - - var literals = args[0]; - - // We always get literals[0] and then matching post literals for each arg given - var result = (typeof(literals) === "string") ? literals : literals[0]; - - for (var i = 1; i < args.length; i++) { - if (args[i] && args[i].kind && args[i].kind === 'Document') { - result += args[i].loc.source.body; - } else { - result += args[i]; - } - - result += literals[i]; - } - - return parseDocument(result); -} - -// Support typescript, which isn't as nice as Babel about default exports -gql.default = gql; -gql.resetCaches = resetCaches; -gql.disableFragmentWarnings = disableFragmentWarnings; -gql.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables; -gql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables; - -module.exports = gql; diff --git a/node_modules/graphql-tag/src/index.js.flow b/node_modules/graphql-tag/src/index.js.flow deleted file mode 100644 index 7acb6237..00000000 --- a/node_modules/graphql-tag/src/index.js.flow +++ /dev/null @@ -1,7 +0,0 @@ -// @flow - -import type { DocumentNode } from 'graphql'; - -declare export default function gql(literals: any, ...placeholders: any[]): DocumentNode; -declare export function resetCaches(): void; -declare export function disableFragmentWarnings(): void; diff --git a/node_modules/graphql-tag/test/graphql.js b/node_modules/graphql-tag/test/graphql.js deleted file mode 100644 index e77af238..00000000 --- a/node_modules/graphql-tag/test/graphql.js +++ /dev/null @@ -1,461 +0,0 @@ -const gql = require('../src'); -const loader = require('../loader'); -const assert = require('chai').assert; - -describe('gql', () => { - it('parses queries', () => { - assert.equal(gql`{ testQuery }`.kind, 'Document'); - }); - - it('parses queries when called as a function', () => { - assert.equal(gql('{ testQuery }').kind, 'Document'); - }); - - it('parses queries with weird substitutions', () => { - const obj = {}; - assert.equal(gql`{ field(input: "${obj.missing}") }`.kind, 'Document'); - assert.equal(gql`{ field(input: "${null}") }`.kind, 'Document'); - assert.equal(gql`{ field(input: "${0}") }`.kind, 'Document'); - }); - - it('allows interpolation of documents generated by the webpack loader', () => { - const sameFragment = "fragment SomeFragmentName on SomeType { someField }"; - - const jsSource = loader.call( - { cacheable() {} }, - "fragment SomeFragmentName on SomeType { someField }" - ); - const module = { exports: undefined }; - eval(jsSource); - - const document = gql`query { ...SomeFragmentName } ${module.exports}`; - assert.equal(document.kind, 'Document'); - assert.equal(document.definitions.length, 2); - assert.equal(document.definitions[0].kind, 'OperationDefinition'); - assert.equal(document.definitions[1].kind, 'FragmentDefinition'); - }); - - it('parses queries through webpack loader', () => { - const jsSource = loader.call({ cacheable() {} }, '{ testQuery }'); - const module = { exports: undefined }; - eval(jsSource); - assert.equal(module.exports.kind, 'Document'); - }); - - it('parses single query through webpack loader', () => { - const jsSource = loader.call({ cacheable() {} }, ` - query Q1 { testQuery } - `); - const module = { exports: undefined }; - eval(jsSource); - - assert.equal(module.exports.kind, 'Document'); - assert.exists(module.exports.Q1); - assert.equal(module.exports.Q1.kind, 'Document'); - assert.equal(module.exports.Q1.definitions.length, 1); - }); - - it('parses single query and exports as default', () => { - const jsSource = loader.call({ cacheable() {} }, ` - query Q1 { testQuery } - `); - const module = { exports: undefined }; - eval(jsSource); - - assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions); - }); - - it('parses multiple queries through webpack loader', () => { - const jsSource = loader.call({ cacheable() {} }, ` - query Q1 { testQuery } - query Q2 { testQuery2 } - `); - const module = { exports: undefined }; - eval(jsSource); - - assert.exists(module.exports.Q1); - assert.exists(module.exports.Q2); - assert.equal(module.exports.Q1.kind, 'Document'); - assert.equal(module.exports.Q2.kind, 'Document'); - assert.equal(module.exports.Q1.definitions.length, 1); - assert.equal(module.exports.Q2.definitions.length, 1); - }); - - it('parses fragments with variable definitions', () => { - gql.enableExperimentalFragmentVariables(); - - const parsed = gql`fragment A ($arg: String!) on Type { testQuery }`; - assert.equal(parsed.kind, 'Document'); - assert.exists(parsed.definitions[0].variableDefinitions); - - gql.disableExperimentalFragmentVariables() - }); - - // see https://github.com/apollographql/graphql-tag/issues/168 - it('does not nest queries needlessly in named exports', () => { - const jsSource = loader.call({ cacheable() {} }, ` - query Q1 { testQuery } - query Q2 { testQuery2 } - query Q3 { test Query3 } - `); - const module = { exports: undefined }; - eval(jsSource); - - assert.notExists(module.exports.Q2.Q1); - assert.notExists(module.exports.Q3.Q1); - assert.notExists(module.exports.Q3.Q2); - }); - - it('tracks fragment dependencies from multiple queries through webpack loader', () => { - const jsSource = loader.call({ cacheable() {} }, ` - fragment F1 on F { testQuery } - fragment F2 on F { testQuery2 } - fragment F3 on F { testQuery3 } - query Q1 { ...F1 } - query Q2 { ...F2 } - query Q3 { - ...F1 - ...F2 - } - `); - const module = { exports: undefined }; - eval(jsSource); - - assert.exists(module.exports.Q1); - assert.exists(module.exports.Q2); - assert.exists(module.exports.Q3); - const Q1 = module.exports.Q1.definitions; - const Q2 = module.exports.Q2.definitions; - const Q3 = module.exports.Q3.definitions; - - assert.equal(Q1.length, 2); - assert.equal(Q1[0].name.value, 'Q1'); - assert.equal(Q1[1].name.value, 'F1'); - - assert.equal(Q2.length, 2); - assert.equal(Q2[0].name.value, 'Q2'); - assert.equal(Q2[1].name.value, 'F2'); - - assert.equal(Q3.length, 3); - assert.equal(Q3[0].name.value, 'Q3'); - assert.equal(Q3[1].name.value, 'F1'); - assert.equal(Q3[2].name.value, 'F2'); - - }); - - it('tracks fragment dependencies across nested fragments', () => { - const jsSource = loader.call({ cacheable() {} }, ` - fragment F11 on F { testQuery } - fragment F22 on F { - ...F11 - testQuery2 - } - fragment F33 on F { - ...F22 - testQuery3 - } - - query Q1 { - ...F33 - } - - query Q2 { - id - } - `); - - const module = { exports: undefined }; - eval(jsSource); - - assert.exists(module.exports.Q1); - assert.exists(module.exports.Q2); - - const Q1 = module.exports.Q1.definitions; - const Q2 = module.exports.Q2.definitions; - - assert.equal(Q1.length, 4); - assert.equal(Q1[0].name.value, 'Q1'); - assert.equal(Q1[1].name.value, 'F33'); - assert.equal(Q1[2].name.value, 'F22'); - assert.equal(Q1[3].name.value, 'F11'); - - assert.equal(Q2.length, 1); - }); - - it('correctly imports other files through the webpack loader', () => { - const query = `#import "./fragment_definition.graphql" - query { - author { - ...authorDetails - } - }`; - const jsSource = loader.call({ cacheable() {} }, query); - const oldRequire = require; - const module = { exports: undefined }; - const require = (path) => { - assert.equal(path, './fragment_definition.graphql'); - return gql` - fragment authorDetails on Author { - firstName - lastName - }`; - }; - eval(jsSource); - assert.equal(module.exports.kind, 'Document'); - const definitions = module.exports.definitions; - assert.equal(definitions.length, 2); - assert.equal(definitions[0].kind, 'OperationDefinition'); - assert.equal(definitions[1].kind, 'FragmentDefinition'); - }); - - it('tracks fragment dependencies across fragments loaded via the webpack loader', () => { - const query = `#import "./fragment_definition.graphql" - fragment F111 on F { - ...F222 - } - - query Q1 { - ...F111 - } - - query Q2 { - a - } - `; - const jsSource = loader.call({ cacheable() {} }, query); - const oldRequire = require; - const module = { exports: undefined }; - const require = (path) => { - assert.equal(path, './fragment_definition.graphql'); - return gql` - fragment F222 on F { - f1 - f2 - }`; - }; - eval(jsSource); - - assert.exists(module.exports.Q1); - assert.exists(module.exports.Q2); - - const Q1 = module.exports.Q1.definitions; - const Q2 = module.exports.Q2.definitions; - - assert.equal(Q1.length, 3); - assert.equal(Q1[0].name.value, 'Q1'); - assert.equal(Q1[1].name.value, 'F111'); - assert.equal(Q1[2].name.value, 'F222'); - - assert.equal(Q2.length, 1); - }); - - it('does not complain when presented with normal comments', (done) => { - assert.doesNotThrow(() => { - const query = `#normal comment - query { - author { - ...authorDetails - } - }`; - const jsSource = loader.call({ cacheable() {} }, query); - const module = { exports: undefined }; - eval(jsSource); - assert.equal(module.exports.kind, 'Document'); - done(); - }); - }); - - it('returns the same object for the same query', () => { - assert.isTrue(gql`{ sameQuery }` === gql`{ sameQuery }`); - }); - - it('returns the same object for the same query, even with whitespace differences', () => { - assert.isTrue(gql`{ sameQuery }` === gql` { sameQuery, }`); - }); - - const fragmentAst = gql` - fragment UserFragment on User { - firstName - lastName - } -`; - - it('returns the same object for the same fragment', () => { - assert.isTrue(gql`fragment same on Same { sameQuery }` === - gql`fragment same on Same { sameQuery }`); - }); - - it('returns the same object for the same document with substitution', () => { - // We know that calling `gql` on a fragment string will always return - // the same document, so we can reuse `fragmentAst` - assert.isTrue(gql`{ ...UserFragment } ${fragmentAst}` === - gql`{ ...UserFragment } ${fragmentAst}`); - }); - - it('can reference a fragment that references as fragment', () => { - const secondFragmentAst = gql` - fragment SecondUserFragment on User { - ...UserFragment - } - ${fragmentAst} - `; - - const ast = gql` - { - user(id: 5) { - ...SecondUserFragment - } - } - ${secondFragmentAst} - `; - - assert.deepEqual(ast, gql` - { - user(id: 5) { - ...SecondUserFragment - } - } - fragment SecondUserFragment on User { - ...UserFragment - } - fragment UserFragment on User { - firstName - lastName - } - `); - }); - - describe('fragment warnings', () => { - let warnings = []; - const oldConsoleWarn = console.warn; - beforeEach(() => { - gql.resetCaches(); - warnings = []; - console.warn = (w) => warnings.push(w); - }); - afterEach(() => { - console.warn = oldConsoleWarn; - }); - - it('warns if you use the same fragment name for different fragments', () => { - const frag1 = gql`fragment TestSame on Bar { fieldOne }`; - const frag2 = gql`fragment TestSame on Bar { fieldTwo }`; - - assert.isFalse(frag1 === frag2); - assert.equal(warnings.length, 1); - }); - - it('does not warn if you use the same fragment name for the same fragment', () => { - const frag1 = gql`fragment TestDifferent on Bar { fieldOne }`; - const frag2 = gql`fragment TestDifferent on Bar { fieldOne }`; - - assert.isTrue(frag1 === frag2); - assert.equal(warnings.length, 0); - }); - - it('does not warn if you use the same embedded fragment in two different queries', () => { - const frag1 = gql`fragment TestEmbedded on Bar { field }`; - const query1 = gql`{ bar { fieldOne ...TestEmbedded } } ${frag1}`; - const query2 = gql`{ bar { fieldTwo ...TestEmbedded } } ${frag1}`; - - assert.isFalse(query1 === query2); - assert.equal(warnings.length, 0); - }); - - it('does not warn if you use the same fragment name for embedded and non-embedded fragments', () => { - const frag1 = gql`fragment TestEmbeddedTwo on Bar { field }`; - const query1 = gql`{ bar { ...TestEmbedded } } ${frag1}`; - const query2 = gql`{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }`; - - assert.equal(warnings.length, 0); - }); - }); - - describe('unique fragments', () => { - beforeEach(() => { - gql.resetCaches(); - }); - - it('strips duplicate fragments from the document', () => { - const frag1 = gql`fragment TestDuplicate on Bar { field }`; - const query1 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1} ${frag1}`; - const query2 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1}`; - - assert.equal(query1.definitions.length, 2); - assert.equal(query1.definitions[1].kind, 'FragmentDefinition'); - // We don't test strict equality between the two queries because the source.body parsed from the - // document is not the same, but the set of definitions should be. - assert.deepEqual(query1.definitions, query2.definitions); - }); - - it('ignores duplicate fragments from second-level imports when using the webpack loader', () => { - // take a require function and a query string, use the webpack loader to process it - const load = (require, query) => { - const jsSource = loader.call({ cacheable() {} }, query); - const module = { exports: undefined }; - eval(jsSource); - return module.exports; - } - - const test_require = (path) => { - switch (path) { - case './friends.graphql': - return load(test_require, [ - '#import "./person.graphql"', - 'fragment friends on Hero { friends { ...person } }', - ].join('\n')); - case './enemies.graphql': - return load(test_require, [ - '#import "./person.graphql"', - 'fragment enemies on Hero { enemies { ...person } }', - ].join('\n')); - case './person.graphql': - return load(test_require, 'fragment person on Person { name }\n'); - default: - return null; - }; - }; - - const result = load(test_require, [ - '#import "./friends.graphql"', - '#import "./enemies.graphql"', - 'query { hero { ...friends ...enemies } }', - ].join('\n')); - - assert.equal(result.kind, 'Document'); - assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain'); - assert.equal(result.definitions[0].kind, 'OperationDefinition'); - - // the rest of the definitions should be fragments and contain one of - // each: "friends", "enemies", "person". Order does not matter - const fragments = result.definitions.slice(1) - assert(fragments.every(fragment => fragment.kind === 'FragmentDefinition')) - assert(fragments.some(fragment => fragment.name.value === 'friends')) - assert(fragments.some(fragment => fragment.name.value === 'enemies')) - assert(fragments.some(fragment => fragment.name.value === 'person')) - }); - }); - - // How to make this work? - // it.only('can reference a fragment passed as a document via shorthand', () => { - // const ast = gql` - // { - // user(id: 5) { - // ...${userFragmentDocument} - // } - // } - // `; - // - // assert.deepEqual(ast, gql` - // { - // user(id: 5) { - // ...UserFragment - // } - // } - // fragment UserFragment on User { - // firstName - // lastName - // } - // `); - // }); -}); diff --git a/node_modules/graphql-tag/test/mocha.opts b/node_modules/graphql-tag/test/mocha.opts deleted file mode 100644 index fdcea477..00000000 --- a/node_modules/graphql-tag/test/mocha.opts +++ /dev/null @@ -1 +0,0 @@ ---require babel-register diff --git a/node_modules/graphql/LICENSE b/node_modules/graphql/LICENSE deleted file mode 100644 index 7bbf892a..00000000 --- a/node_modules/graphql/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) GraphQL Contributors - -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. diff --git a/node_modules/graphql/README.md b/node_modules/graphql/README.md deleted file mode 100644 index 47cce6ad..00000000 --- a/node_modules/graphql/README.md +++ /dev/null @@ -1,167 +0,0 @@ -# GraphQL.js - -The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook. - -[![npm version](https://badge.fury.io/js/graphql.svg)](https://badge.fury.io/js/graphql) -[![Build Status](https://github.com/graphql/graphql-js/workflows/CI/badge.svg?branch=master)](https://github.com/graphql/graphql-js/actions?query=branch%3Amaster) -[![Coverage Status](https://codecov.io/gh/graphql/graphql-js/branch/master/graph/badge.svg)](https://codecov.io/gh/graphql/graphql-js) - -See more complete documentation at https://graphql.org/ and -https://graphql.org/graphql-js/. - -Looking for help? Find resources [from the community](https://graphql.org/community/). - -## Getting Started - -A general overview of GraphQL is available in the -[README](https://github.com/graphql/graphql-spec/blob/master/README.md) for the -[Specification for GraphQL](https://github.com/graphql/graphql-spec). That overview -describes a simple set of GraphQL examples that exist as [tests](src/__tests__) -in this repository. A good way to get started with this repository is to walk -through that README and the corresponding tests in parallel. - -### Using GraphQL.js - -Install GraphQL.js from npm - -With npm: - -```sh -npm install --save graphql -``` - -or using yarn: - -```sh -yarn add graphql -``` - -GraphQL.js provides two important capabilities: building a type schema and -serving queries against that type schema. - -First, build a GraphQL type schema which maps to your codebase. - -```js -import { - graphql, - GraphQLSchema, - GraphQLObjectType, - GraphQLString, -} from 'graphql'; - -var schema = new GraphQLSchema({ - query: new GraphQLObjectType({ - name: 'RootQueryType', - fields: { - hello: { - type: GraphQLString, - resolve() { - return 'world'; - }, - }, - }, - }), -}); -``` - -This defines a simple schema, with one type and one field, that resolves -to a fixed value. The `resolve` function can return a value, a promise, -or an array of promises. A more complex example is included in the top-level [tests](src/__tests__) directory. - -Then, serve the result of a query against that type schema. - -```js -var query = '{ hello }'; - -graphql(schema, query).then((result) => { - // Prints - // { - // data: { hello: "world" } - // } - console.log(result); -}); -``` - -This runs a query fetching the one field defined. The `graphql` function will -first ensure the query is syntactically and semantically valid before executing -it, reporting errors otherwise. - -```js -var query = '{ BoyHowdy }'; - -graphql(schema, query).then((result) => { - // Prints - // { - // errors: [ - // { message: 'Cannot query field BoyHowdy on RootQueryType', - // locations: [ { line: 1, column: 3 } ] } - // ] - // } - console.log(result); -}); -``` - -**Note**: Please don't forget to set `NODE_ENV=production` if you are running a production server. It will disable some checks that can be useful during development but will significantly improve performance. - -### Want to ride the bleeding edge? - -The `npm` branch in this repository is automatically maintained to be the last -commit to `master` to pass all tests, in the same form found on npm. It is -recommended to use builds deployed to npm for many reasons, but if you want to use -the latest not-yet-released version of graphql-js, you can do so by depending -directly on this branch: - -``` -npm install graphql@git://github.com/graphql/graphql-js.git#npm -``` - -### Using in a Browser - -GraphQL.js is a general-purpose library and can be used both in a Node server -and in the browser. As an example, the [GraphiQL](https://github.com/graphql/graphiql/) -tool is built with GraphQL.js! - -Building a project using GraphQL.js with [webpack](https://webpack.js.org) or -[rollup](https://github.com/rollup/rollup) should just work and only include -the portions of the library you use. This works because GraphQL.js is distributed -with both CommonJS (`require()`) and ESModule (`import`) files. Ensure that any -custom build configurations look for `.mjs` files! - -### Contributing - -We actively welcome pull requests. Learn how to [contribute](./.github/CONTRIBUTING.md). - -### Changelog - -Changes are tracked as [GitHub releases](https://github.com/graphql/graphql-js/releases). - -### License - -GraphQL.js is [MIT-licensed](./LICENSE). - -### Credits - -The `*.d.ts` files in this project are based on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/54712a7e28090c5b1253b746d1878003c954f3ff/types/graphql) definitions written by: - - - -- TonyYang https://github.com/TonyPythoneer -- Caleb Meredith https://github.com/calebmer -- Dominic Watson https://github.com/intellix -- Firede https://github.com/firede -- Kepennar https://github.com/kepennar -- Mikhail Novikov https://github.com/freiksenet -- Ivan Goncharov https://github.com/IvanGoncharov -- Hagai Cohen https://github.com/DxCx -- Ricardo Portugal https://github.com/rportugal -- Tim Griesser https://github.com/tgriesser -- Dylan Stewart https://github.com/dyst5422 -- Alessio Dionisi https://github.com/adnsio -- Divyendu Singh https://github.com/divyenduz -- Brad Zacher https://github.com/bradzacher -- Curtis Layne https://github.com/clayne11 -- Jonathan Cardoso https://github.com/JCMais -- Pavel Lang https://github.com/langpavel -- Mark Caudill https://github.com/mc0 -- Martijn Walraven https://github.com/martijnwalraven -- Jed Mao https://github.com/jedmao diff --git a/node_modules/graphql/error/GraphQLError.d.ts b/node_modules/graphql/error/GraphQLError.d.ts deleted file mode 100644 index 99001fd2..00000000 --- a/node_modules/graphql/error/GraphQLError.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { ASTNode } from '../language/ast'; -import { Source } from '../language/source'; -import { SourceLocation } from '../language/location'; - -/** - * A GraphQLError describes an Error found during the parse, validate, or - * execute phases of performing a GraphQL operation. In addition to a message - * and stack trace, it also includes information about the locations in a - * GraphQL document and/or execution result that correspond to the Error. - */ -export class GraphQLError extends Error { - constructor( - message: string, - nodes?: Maybe | ASTNode>, - source?: Maybe, - positions?: Maybe>, - path?: Maybe>, - originalError?: Maybe, - extensions?: Maybe<{ [key: string]: any }>, - ); - - /** - * A message describing the Error for debugging purposes. - * - * Enumerable, and appears in the result of JSON.stringify(). - * - * Note: should be treated as readonly, despite invariant usage. - */ - message: string; - - /** - * An array of { line, column } locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - readonly locations: ReadonlyArray | undefined; - - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - readonly path: ReadonlyArray | undefined; - - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - readonly nodes: ReadonlyArray | undefined; - - /** - * The source GraphQL document corresponding to this error. - * - * Note that if this Error represents more than one node, the source may not - * represent nodes after the first node. - */ - readonly source: Source | undefined; - - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - readonly positions: ReadonlyArray | undefined; - - /** - * The original error thrown from a field resolver during execution. - */ - readonly originalError: Maybe; - - /** - * Extension fields to add to the formatted error. - */ - readonly extensions: { [key: string]: any } | undefined; -} - -/** - * Prints a GraphQLError to a string, representing useful location information - * about the error's position in the source. - */ -export function printError(error: GraphQLError): string; diff --git a/node_modules/graphql/error/GraphQLError.js b/node_modules/graphql/error/GraphQLError.js deleted file mode 100644 index 110cb5c0..00000000 --- a/node_modules/graphql/error/GraphQLError.js +++ /dev/null @@ -1,288 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.printError = printError; -exports.GraphQLError = void 0; - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _symbols = require("../polyfills/symbols.js"); - -var _location = require("../language/location.js"); - -var _printLocation = require("../language/printLocation.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } - -function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -/** - * A GraphQLError describes an Error found during the parse, validate, or - * execute phases of performing a GraphQL operation. In addition to a message - * and stack trace, it also includes information about the locations in a - * GraphQL document and/or execution result that correspond to the Error. - */ -var GraphQLError = /*#__PURE__*/function (_Error) { - _inherits(GraphQLError, _Error); - - var _super = _createSuper(GraphQLError); - - /** - * A message describing the Error for debugging purposes. - * - * Enumerable, and appears in the result of JSON.stringify(). - * - * Note: should be treated as readonly, despite invariant usage. - */ - - /** - * An array of { line, column } locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - - /** - * The source GraphQL document for the first location of this error. - * - * Note that if this Error represents more than one node, the source may not - * represent nodes after the first node. - */ - - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - - /** - * The original error thrown from a field resolver during execution. - */ - - /** - * Extension fields to add to the formatted error. - */ - function GraphQLError(message, nodes, source, positions, path, originalError, extensions) { - var _locations2, _source2, _positions2, _extensions2; - - var _this; - - _classCallCheck(this, GraphQLError); - - _this = _super.call(this, message); // Compute list of blame nodes. - - var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions. - - - var _source = source; - - if (!_source && _nodes) { - var _nodes$0$loc; - - _source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source; - } - - var _positions = positions; - - if (!_positions && _nodes) { - _positions = _nodes.reduce(function (list, node) { - if (node.loc) { - list.push(node.loc.start); - } - - return list; - }, []); - } - - if (_positions && _positions.length === 0) { - _positions = undefined; - } - - var _locations; - - if (positions && source) { - _locations = positions.map(function (pos) { - return (0, _location.getLocation)(source, pos); - }); - } else if (_nodes) { - _locations = _nodes.reduce(function (list, node) { - if (node.loc) { - list.push((0, _location.getLocation)(node.loc.source, node.loc.start)); - } - - return list; - }, []); - } - - var _extensions = extensions; - - if (_extensions == null && originalError != null) { - var originalExtensions = originalError.extensions; - - if ((0, _isObjectLike.default)(originalExtensions)) { - _extensions = originalExtensions; - } - } - - Object.defineProperties(_assertThisInitialized(_this), { - name: { - value: 'GraphQLError' - }, - message: { - value: message, - // By being enumerable, JSON.stringify will include `message` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: true, - writable: true - }, - locations: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined, - // By being enumerable, JSON.stringify will include `locations` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: _locations != null - }, - path: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: path !== null && path !== void 0 ? path : undefined, - // By being enumerable, JSON.stringify will include `path` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: path != null - }, - nodes: { - value: _nodes !== null && _nodes !== void 0 ? _nodes : undefined - }, - source: { - value: (_source2 = _source) !== null && _source2 !== void 0 ? _source2 : undefined - }, - positions: { - value: (_positions2 = _positions) !== null && _positions2 !== void 0 ? _positions2 : undefined - }, - originalError: { - value: originalError - }, - extensions: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined, - // By being enumerable, JSON.stringify will include `path` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: _extensions != null - } - }); // Include (non-enumerable) stack trace. - - if (originalError === null || originalError === void 0 ? void 0 : originalError.stack) { - Object.defineProperty(_assertThisInitialized(_this), 'stack', { - value: originalError.stack, - writable: true, - configurable: true - }); - return _possibleConstructorReturn(_this); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - - - if (Error.captureStackTrace) { - Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError); - } else { - Object.defineProperty(_assertThisInitialized(_this), 'stack', { - value: Error().stack, - writable: true, - configurable: true - }); - } - - return _this; - } - - _createClass(GraphQLError, [{ - key: "toString", - value: function toString() { - return printError(this); - } // FIXME: workaround to not break chai comparisons, should be remove in v16 - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - - }, { - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'Object'; - } - }]); - - return GraphQLError; -}( /*#__PURE__*/_wrapNativeSuper(Error)); -/** - * Prints a GraphQLError to a string, representing useful location information - * about the error's position in the source. - */ - - -exports.GraphQLError = GraphQLError; - -function printError(error) { - var output = error.message; - - if (error.nodes) { - for (var _i2 = 0, _error$nodes2 = error.nodes; _i2 < _error$nodes2.length; _i2++) { - var node = _error$nodes2[_i2]; - - if (node.loc) { - output += '\n\n' + (0, _printLocation.printLocation)(node.loc); - } - } - } else if (error.source && error.locations) { - for (var _i4 = 0, _error$locations2 = error.locations; _i4 < _error$locations2.length; _i4++) { - var location = _error$locations2[_i4]; - output += '\n\n' + (0, _printLocation.printSourceLocation)(error.source, location); - } - } - - return output; -} diff --git a/node_modules/graphql/error/GraphQLError.js.flow b/node_modules/graphql/error/GraphQLError.js.flow deleted file mode 100644 index a820e7d8..00000000 --- a/node_modules/graphql/error/GraphQLError.js.flow +++ /dev/null @@ -1,242 +0,0 @@ -// @flow strict -// FIXME: -// flowlint uninitialized-instance-property:off - -import isObjectLike from '../jsutils/isObjectLike'; -import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols'; - -import type { ASTNode } from '../language/ast'; -import type { Source } from '../language/source'; -import type { SourceLocation } from '../language/location'; -import { getLocation } from '../language/location'; -import { printLocation, printSourceLocation } from '../language/printLocation'; - -/** - * A GraphQLError describes an Error found during the parse, validate, or - * execute phases of performing a GraphQL operation. In addition to a message - * and stack trace, it also includes information about the locations in a - * GraphQL document and/or execution result that correspond to the Error. - */ -export class GraphQLError extends Error { - /** - * A message describing the Error for debugging purposes. - * - * Enumerable, and appears in the result of JSON.stringify(). - * - * Note: should be treated as readonly, despite invariant usage. - */ - message: string; - - /** - * An array of { line, column } locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - +locations: $ReadOnlyArray | void; - - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - +path: $ReadOnlyArray | void; - - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - +nodes: $ReadOnlyArray | void; - - /** - * The source GraphQL document for the first location of this error. - * - * Note that if this Error represents more than one node, the source may not - * represent nodes after the first node. - */ - +source: Source | void; - - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - +positions: $ReadOnlyArray | void; - - /** - * The original error thrown from a field resolver during execution. - */ - +originalError: ?Error; - - /** - * Extension fields to add to the formatted error. - */ - +extensions: { [key: string]: mixed, ... } | void; - - constructor( - message: string, - nodes?: $ReadOnlyArray | ASTNode | void | null, - source?: ?Source, - positions?: ?$ReadOnlyArray, - path?: ?$ReadOnlyArray, - originalError?: ?(Error & { +extensions?: mixed, ... }), - extensions?: ?{ [key: string]: mixed, ... }, - ): void { - super(message); - - // Compute list of blame nodes. - const _nodes = Array.isArray(nodes) - ? nodes.length !== 0 - ? nodes - : undefined - : nodes - ? [nodes] - : undefined; - - // Compute locations in the source for the given nodes/positions. - let _source = source; - if (!_source && _nodes) { - _source = _nodes[0].loc?.source; - } - - let _positions = positions; - if (!_positions && _nodes) { - _positions = _nodes.reduce((list, node) => { - if (node.loc) { - list.push(node.loc.start); - } - return list; - }, []); - } - if (_positions && _positions.length === 0) { - _positions = undefined; - } - - let _locations; - if (positions && source) { - _locations = positions.map((pos) => getLocation(source, pos)); - } else if (_nodes) { - _locations = _nodes.reduce((list, node) => { - if (node.loc) { - list.push(getLocation(node.loc.source, node.loc.start)); - } - return list; - }, []); - } - - let _extensions = extensions; - if (_extensions == null && originalError != null) { - const originalExtensions = originalError.extensions; - if (isObjectLike(originalExtensions)) { - _extensions = originalExtensions; - } - } - - Object.defineProperties((this: any), { - name: { value: 'GraphQLError' }, - message: { - value: message, - // By being enumerable, JSON.stringify will include `message` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: true, - writable: true, - }, - locations: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: _locations ?? undefined, - // By being enumerable, JSON.stringify will include `locations` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: _locations != null, - }, - path: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: path ?? undefined, - // By being enumerable, JSON.stringify will include `path` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: path != null, - }, - nodes: { - value: _nodes ?? undefined, - }, - source: { - value: _source ?? undefined, - }, - positions: { - value: _positions ?? undefined, - }, - originalError: { - value: originalError, - }, - extensions: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: _extensions ?? undefined, - // By being enumerable, JSON.stringify will include `path` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: _extensions != null, - }, - }); - - // Include (non-enumerable) stack trace. - if (originalError?.stack) { - Object.defineProperty(this, 'stack', { - value: originalError.stack, - writable: true, - configurable: true, - }); - return; - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - if (Error.captureStackTrace) { - Error.captureStackTrace(this, GraphQLError); - } else { - Object.defineProperty(this, 'stack', { - value: Error().stack, - writable: true, - configurable: true, - }); - } - } - - toString(): string { - return printError(this); - } - - // FIXME: workaround to not break chai comparisons, should be remove in v16 - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG](): string { - return 'Object'; - } -} - -/** - * Prints a GraphQLError to a string, representing useful location information - * about the error's position in the source. - */ -export function printError(error: GraphQLError): string { - let output = error.message; - - if (error.nodes) { - for (const node of error.nodes) { - if (node.loc) { - output += '\n\n' + printLocation(node.loc); - } - } - } else if (error.source && error.locations) { - for (const location of error.locations) { - output += '\n\n' + printSourceLocation(error.source, location); - } - } - - return output; -} diff --git a/node_modules/graphql/error/GraphQLError.mjs b/node_modules/graphql/error/GraphQLError.mjs deleted file mode 100644 index 7f921823..00000000 --- a/node_modules/graphql/error/GraphQLError.mjs +++ /dev/null @@ -1,274 +0,0 @@ -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } - -function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -// FIXME: -// flowlint uninitialized-instance-property:off -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import { SYMBOL_TO_STRING_TAG } from "../polyfills/symbols.mjs"; -import { getLocation } from "../language/location.mjs"; -import { printLocation, printSourceLocation } from "../language/printLocation.mjs"; -/** - * A GraphQLError describes an Error found during the parse, validate, or - * execute phases of performing a GraphQL operation. In addition to a message - * and stack trace, it also includes information about the locations in a - * GraphQL document and/or execution result that correspond to the Error. - */ - -export var GraphQLError = /*#__PURE__*/function (_Error) { - _inherits(GraphQLError, _Error); - - var _super = _createSuper(GraphQLError); - - /** - * A message describing the Error for debugging purposes. - * - * Enumerable, and appears in the result of JSON.stringify(). - * - * Note: should be treated as readonly, despite invariant usage. - */ - - /** - * An array of { line, column } locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - - /** - * The source GraphQL document for the first location of this error. - * - * Note that if this Error represents more than one node, the source may not - * represent nodes after the first node. - */ - - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - - /** - * The original error thrown from a field resolver during execution. - */ - - /** - * Extension fields to add to the formatted error. - */ - function GraphQLError(message, nodes, source, positions, path, originalError, extensions) { - var _locations2, _source2, _positions2, _extensions2; - - var _this; - - _classCallCheck(this, GraphQLError); - - _this = _super.call(this, message); // Compute list of blame nodes. - - var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions. - - - var _source = source; - - if (!_source && _nodes) { - var _nodes$0$loc; - - _source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source; - } - - var _positions = positions; - - if (!_positions && _nodes) { - _positions = _nodes.reduce(function (list, node) { - if (node.loc) { - list.push(node.loc.start); - } - - return list; - }, []); - } - - if (_positions && _positions.length === 0) { - _positions = undefined; - } - - var _locations; - - if (positions && source) { - _locations = positions.map(function (pos) { - return getLocation(source, pos); - }); - } else if (_nodes) { - _locations = _nodes.reduce(function (list, node) { - if (node.loc) { - list.push(getLocation(node.loc.source, node.loc.start)); - } - - return list; - }, []); - } - - var _extensions = extensions; - - if (_extensions == null && originalError != null) { - var originalExtensions = originalError.extensions; - - if (isObjectLike(originalExtensions)) { - _extensions = originalExtensions; - } - } - - Object.defineProperties(_assertThisInitialized(_this), { - name: { - value: 'GraphQLError' - }, - message: { - value: message, - // By being enumerable, JSON.stringify will include `message` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: true, - writable: true - }, - locations: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined, - // By being enumerable, JSON.stringify will include `locations` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: _locations != null - }, - path: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: path !== null && path !== void 0 ? path : undefined, - // By being enumerable, JSON.stringify will include `path` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: path != null - }, - nodes: { - value: _nodes !== null && _nodes !== void 0 ? _nodes : undefined - }, - source: { - value: (_source2 = _source) !== null && _source2 !== void 0 ? _source2 : undefined - }, - positions: { - value: (_positions2 = _positions) !== null && _positions2 !== void 0 ? _positions2 : undefined - }, - originalError: { - value: originalError - }, - extensions: { - // Coercing falsy values to undefined ensures they will not be included - // in JSON.stringify() when not provided. - value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined, - // By being enumerable, JSON.stringify will include `path` in the - // resulting output. This ensures that the simplest possible GraphQL - // service adheres to the spec. - enumerable: _extensions != null - } - }); // Include (non-enumerable) stack trace. - - if (originalError === null || originalError === void 0 ? void 0 : originalError.stack) { - Object.defineProperty(_assertThisInitialized(_this), 'stack', { - value: originalError.stack, - writable: true, - configurable: true - }); - return _possibleConstructorReturn(_this); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - - - if (Error.captureStackTrace) { - Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError); - } else { - Object.defineProperty(_assertThisInitialized(_this), 'stack', { - value: Error().stack, - writable: true, - configurable: true - }); - } - - return _this; - } - - _createClass(GraphQLError, [{ - key: "toString", - value: function toString() { - return printError(this); - } // FIXME: workaround to not break chai comparisons, should be remove in v16 - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - - }, { - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'Object'; - } - }]); - - return GraphQLError; -}( /*#__PURE__*/_wrapNativeSuper(Error)); -/** - * Prints a GraphQLError to a string, representing useful location information - * about the error's position in the source. - */ - -export function printError(error) { - var output = error.message; - - if (error.nodes) { - for (var _i2 = 0, _error$nodes2 = error.nodes; _i2 < _error$nodes2.length; _i2++) { - var node = _error$nodes2[_i2]; - - if (node.loc) { - output += '\n\n' + printLocation(node.loc); - } - } - } else if (error.source && error.locations) { - for (var _i4 = 0, _error$locations2 = error.locations; _i4 < _error$locations2.length; _i4++) { - var location = _error$locations2[_i4]; - output += '\n\n' + printSourceLocation(error.source, location); - } - } - - return output; -} diff --git a/node_modules/graphql/error/formatError.d.ts b/node_modules/graphql/error/formatError.d.ts deleted file mode 100644 index fb3451b7..00000000 --- a/node_modules/graphql/error/formatError.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { SourceLocation } from '../language/location'; - -import { GraphQLError } from './GraphQLError'; - -/** - * Given a GraphQLError, format it according to the rules described by the - * Response Format, Errors section of the GraphQL Specification. - */ -export function formatError(error: GraphQLError): GraphQLFormattedError; - -/** - * @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors - */ -export interface GraphQLFormattedError< - TExtensions extends Record = Record -> { - /** - * A short, human-readable summary of the problem that **SHOULD NOT** change - * from occurrence to occurrence of the problem, except for purposes of - * localization. - */ - readonly message: string; - /** - * If an error can be associated to a particular point in the requested - * GraphQL document, it should contain a list of locations. - */ - readonly locations?: ReadonlyArray; - /** - * If an error can be associated to a particular field in the GraphQL result, - * it _must_ contain an entry with the key `path` that details the path of - * the response field which experienced the error. This allows clients to - * identify whether a null result is intentional or caused by a runtime error. - */ - readonly path?: ReadonlyArray; - /** - * Reserved for implementors to extend the protocol however they see fit, - * and hence there are no additional restrictions on its contents. - */ - readonly extensions?: TExtensions; -} diff --git a/node_modules/graphql/error/formatError.js b/node_modules/graphql/error/formatError.js deleted file mode 100644 index 88cd9315..00000000 --- a/node_modules/graphql/error/formatError.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.formatError = formatError; - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Given a GraphQLError, format it according to the rules described by the - * Response Format, Errors section of the GraphQL Specification. - */ -function formatError(error) { - var _error$message; - - error || (0, _devAssert.default)(0, 'Received null or undefined error.'); - var message = (_error$message = error.message) !== null && _error$message !== void 0 ? _error$message : 'An unknown error occurred.'; - var locations = error.locations; - var path = error.path; - var extensions = error.extensions; - return extensions ? { - message: message, - locations: locations, - path: path, - extensions: extensions - } : { - message: message, - locations: locations, - path: path - }; -} -/** - * @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors - */ diff --git a/node_modules/graphql/error/formatError.js.flow b/node_modules/graphql/error/formatError.js.flow deleted file mode 100644 index 94d87539..00000000 --- a/node_modules/graphql/error/formatError.js.flow +++ /dev/null @@ -1,51 +0,0 @@ -// @flow strict -import devAssert from '../jsutils/devAssert'; - -import type { SourceLocation } from '../language/location'; - -import type { GraphQLError } from './GraphQLError'; - -/** - * Given a GraphQLError, format it according to the rules described by the - * Response Format, Errors section of the GraphQL Specification. - */ -export function formatError(error: GraphQLError): GraphQLFormattedError { - devAssert(error, 'Received null or undefined error.'); - const message = error.message ?? 'An unknown error occurred.'; - const locations = error.locations; - const path = error.path; - const extensions = error.extensions; - - return extensions - ? { message, locations, path, extensions } - : { message, locations, path }; -} - -/** - * @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors - */ -export type GraphQLFormattedError = {| - /** - * A short, human-readable summary of the problem that **SHOULD NOT** change - * from occurrence to occurrence of the problem, except for purposes of - * localization. - */ - +message: string, - /** - * If an error can be associated to a particular point in the requested - * GraphQL document, it should contain a list of locations. - */ - +locations: $ReadOnlyArray | void, - /** - * If an error can be associated to a particular field in the GraphQL result, - * it _must_ contain an entry with the key `path` that details the path of - * the response field which experienced the error. This allows clients to - * identify whether a null result is intentional or caused by a runtime error. - */ - +path: $ReadOnlyArray | void, - /** - * Reserved for implementors to extend the protocol however they see fit, - * and hence there are no additional restrictions on its contents. - */ - +extensions?: { [key: string]: mixed, ... }, -|}; diff --git a/node_modules/graphql/error/formatError.mjs b/node_modules/graphql/error/formatError.mjs deleted file mode 100644 index 3f80411e..00000000 --- a/node_modules/graphql/error/formatError.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import devAssert from "../jsutils/devAssert.mjs"; - -/** - * Given a GraphQLError, format it according to the rules described by the - * Response Format, Errors section of the GraphQL Specification. - */ -export function formatError(error) { - var _error$message; - - error || devAssert(0, 'Received null or undefined error.'); - var message = (_error$message = error.message) !== null && _error$message !== void 0 ? _error$message : 'An unknown error occurred.'; - var locations = error.locations; - var path = error.path; - var extensions = error.extensions; - return extensions ? { - message: message, - locations: locations, - path: path, - extensions: extensions - } : { - message: message, - locations: locations, - path: path - }; -} -/** - * @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors - */ diff --git a/node_modules/graphql/error/index.d.ts b/node_modules/graphql/error/index.d.ts deleted file mode 100644 index 9373b716..00000000 --- a/node_modules/graphql/error/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { GraphQLError, printError } from './GraphQLError'; -export { syntaxError } from './syntaxError'; -export { locatedError } from './locatedError'; -export { formatError, GraphQLFormattedError } from './formatError'; diff --git a/node_modules/graphql/error/index.js b/node_modules/graphql/error/index.js deleted file mode 100644 index ee164b86..00000000 --- a/node_modules/graphql/error/index.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "GraphQLError", { - enumerable: true, - get: function get() { - return _GraphQLError.GraphQLError; - } -}); -Object.defineProperty(exports, "printError", { - enumerable: true, - get: function get() { - return _GraphQLError.printError; - } -}); -Object.defineProperty(exports, "syntaxError", { - enumerable: true, - get: function get() { - return _syntaxError.syntaxError; - } -}); -Object.defineProperty(exports, "locatedError", { - enumerable: true, - get: function get() { - return _locatedError.locatedError; - } -}); -Object.defineProperty(exports, "formatError", { - enumerable: true, - get: function get() { - return _formatError.formatError; - } -}); - -var _GraphQLError = require("./GraphQLError.js"); - -var _syntaxError = require("./syntaxError.js"); - -var _locatedError = require("./locatedError.js"); - -var _formatError = require("./formatError.js"); diff --git a/node_modules/graphql/error/index.js.flow b/node_modules/graphql/error/index.js.flow deleted file mode 100644 index eeaa96e0..00000000 --- a/node_modules/graphql/error/index.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -export { GraphQLError, printError } from './GraphQLError'; - -export { syntaxError } from './syntaxError'; - -export { locatedError } from './locatedError'; - -export { formatError } from './formatError'; -export type { GraphQLFormattedError } from './formatError'; diff --git a/node_modules/graphql/error/index.mjs b/node_modules/graphql/error/index.mjs deleted file mode 100644 index 5ac29d13..00000000 --- a/node_modules/graphql/error/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -export { GraphQLError, printError } from "./GraphQLError.mjs"; -export { syntaxError } from "./syntaxError.mjs"; -export { locatedError } from "./locatedError.mjs"; -export { formatError } from "./formatError.mjs"; diff --git a/node_modules/graphql/error/locatedError.d.ts b/node_modules/graphql/error/locatedError.d.ts deleted file mode 100644 index 86937570..00000000 --- a/node_modules/graphql/error/locatedError.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { ASTNode } from '../language/ast'; - -import { GraphQLError } from './GraphQLError'; - -/** - * Given an arbitrary value, presumably thrown while attempting to execute a - * GraphQL operation, produce a new GraphQLError aware of the location in the - * document responsible for the original Error. - */ -export function locatedError( - rawOriginalError: any, - nodes: ASTNode | ReadonlyArray | undefined, - path?: Maybe>, -): GraphQLError; diff --git a/node_modules/graphql/error/locatedError.js b/node_modules/graphql/error/locatedError.js deleted file mode 100644 index 658c4390..00000000 --- a/node_modules/graphql/error/locatedError.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.locatedError = locatedError; - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _GraphQLError = require("./GraphQLError.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Given an arbitrary value, presumably thrown while attempting to execute a - * GraphQL operation, produce a new GraphQLError aware of the location in the - * document responsible for the original Error. - */ -function locatedError(rawOriginalError, nodes, path) { - var _nodes; - - // Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. - var originalError = rawOriginalError instanceof Error ? rawOriginalError : new Error('Unexpected error value: ' + (0, _inspect.default)(rawOriginalError)); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. - - if (Array.isArray(originalError.path)) { - return originalError; - } - - return new _GraphQLError.GraphQLError(originalError.message, (_nodes = originalError.nodes) !== null && _nodes !== void 0 ? _nodes : nodes, originalError.source, originalError.positions, path, originalError); -} diff --git a/node_modules/graphql/error/locatedError.js.flow b/node_modules/graphql/error/locatedError.js.flow deleted file mode 100644 index 3ef40c80..00000000 --- a/node_modules/graphql/error/locatedError.js.flow +++ /dev/null @@ -1,37 +0,0 @@ -// @flow strict -import inspect from '../jsutils/inspect'; - -import type { ASTNode } from '../language/ast'; - -import { GraphQLError } from './GraphQLError'; - -/** - * Given an arbitrary value, presumably thrown while attempting to execute a - * GraphQL operation, produce a new GraphQLError aware of the location in the - * document responsible for the original Error. - */ -export function locatedError( - rawOriginalError: mixed, - nodes: ASTNode | $ReadOnlyArray | void | null, - path?: ?$ReadOnlyArray, -): GraphQLError { - // Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. - const originalError: Error | GraphQLError = - rawOriginalError instanceof Error - ? rawOriginalError - : new Error('Unexpected error value: ' + inspect(rawOriginalError)); - - // Note: this uses a brand-check to support GraphQL errors originating from other contexts. - if (Array.isArray(originalError.path)) { - return (originalError: any); - } - - return new GraphQLError( - originalError.message, - (originalError: any).nodes ?? nodes, - (originalError: any).source, - (originalError: any).positions, - path, - originalError, - ); -} diff --git a/node_modules/graphql/error/locatedError.mjs b/node_modules/graphql/error/locatedError.mjs deleted file mode 100644 index 48f4d542..00000000 --- a/node_modules/graphql/error/locatedError.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import inspect from "../jsutils/inspect.mjs"; -import { GraphQLError } from "./GraphQLError.mjs"; -/** - * Given an arbitrary value, presumably thrown while attempting to execute a - * GraphQL operation, produce a new GraphQLError aware of the location in the - * document responsible for the original Error. - */ - -export function locatedError(rawOriginalError, nodes, path) { - var _nodes; - - // Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. - var originalError = rawOriginalError instanceof Error ? rawOriginalError : new Error('Unexpected error value: ' + inspect(rawOriginalError)); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. - - if (Array.isArray(originalError.path)) { - return originalError; - } - - return new GraphQLError(originalError.message, (_nodes = originalError.nodes) !== null && _nodes !== void 0 ? _nodes : nodes, originalError.source, originalError.positions, path, originalError); -} diff --git a/node_modules/graphql/error/syntaxError.d.ts b/node_modules/graphql/error/syntaxError.d.ts deleted file mode 100644 index 1c5413c7..00000000 --- a/node_modules/graphql/error/syntaxError.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Source } from '../language/source'; - -import { GraphQLError } from './GraphQLError'; - -/** - * Produces a GraphQLError representing a syntax error, containing useful - * descriptive information about the syntax error's position in the source. - */ -export function syntaxError( - source: Source, - position: number, - description: string, -): GraphQLError; diff --git a/node_modules/graphql/error/syntaxError.js b/node_modules/graphql/error/syntaxError.js deleted file mode 100644 index 48045844..00000000 --- a/node_modules/graphql/error/syntaxError.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.syntaxError = syntaxError; - -var _GraphQLError = require("./GraphQLError.js"); - -/** - * Produces a GraphQLError representing a syntax error, containing useful - * descriptive information about the syntax error's position in the source. - */ -function syntaxError(source, position, description) { - return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]); -} diff --git a/node_modules/graphql/error/syntaxError.js.flow b/node_modules/graphql/error/syntaxError.js.flow deleted file mode 100644 index cdddcc3d..00000000 --- a/node_modules/graphql/error/syntaxError.js.flow +++ /dev/null @@ -1,18 +0,0 @@ -// @flow strict -import type { Source } from '../language/source'; - -import { GraphQLError } from './GraphQLError'; - -/** - * Produces a GraphQLError representing a syntax error, containing useful - * descriptive information about the syntax error's position in the source. - */ -export function syntaxError( - source: Source, - position: number, - description: string, -): GraphQLError { - return new GraphQLError(`Syntax Error: ${description}`, undefined, source, [ - position, - ]); -} diff --git a/node_modules/graphql/error/syntaxError.mjs b/node_modules/graphql/error/syntaxError.mjs deleted file mode 100644 index 33aae5a7..00000000 --- a/node_modules/graphql/error/syntaxError.mjs +++ /dev/null @@ -1,9 +0,0 @@ -import { GraphQLError } from "./GraphQLError.mjs"; -/** - * Produces a GraphQLError representing a syntax error, containing useful - * descriptive information about the syntax error's position in the source. - */ - -export function syntaxError(source, position, description) { - return new GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]); -} diff --git a/node_modules/graphql/execution/execute.d.ts b/node_modules/graphql/execution/execute.d.ts deleted file mode 100644 index a20db8c2..00000000 --- a/node_modules/graphql/execution/execute.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { PromiseOrValue } from '../jsutils/PromiseOrValue'; -import { Path } from '../jsutils/Path'; - -import { GraphQLError } from '../error/GraphQLError'; -import { GraphQLFormattedError } from '../error/formatError'; - -import { - DocumentNode, - OperationDefinitionNode, - SelectionSetNode, - FieldNode, - FragmentDefinitionNode, -} from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; -import { - GraphQLField, - GraphQLFieldResolver, - GraphQLResolveInfo, - GraphQLTypeResolver, - GraphQLObjectType, -} from '../type/definition'; - -/** - * Data that must be available at all points during query execution. - * - * Namely, schema of the type system that is currently executing, - * and the fragments defined in the query document - */ -export interface ExecutionContext { - schema: GraphQLSchema; - fragments: { [key: string]: FragmentDefinitionNode }; - rootValue: any; - contextValue: any; - operation: OperationDefinitionNode; - variableValues: { [key: string]: any }; - fieldResolver: GraphQLFieldResolver; - errors: Array; -} - -/** - * The result of GraphQL execution. - * - * - `errors` is included when any errors occurred as a non-empty array. - * - `data` is the result of a successful execution of the query. - * - `extensions` is reserved for adding non-standard properties. - */ -export interface ExecutionResult< - TData = { [key: string]: any }, - TExtensions = { [key: string]: any } -> { - errors?: ReadonlyArray; - // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229 - data?: TData | null; - extensions?: TExtensions; -} - -export interface FormattedExecutionResult< - TData = { [key: string]: any }, - TExtensions = { [key: string]: any } -> { - errors?: ReadonlyArray; - // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229 - data?: TData | null; - extensions?: TExtensions; -} - -export interface ExecutionArgs { - schema: GraphQLSchema; - document: DocumentNode; - rootValue?: any; - contextValue?: any; - variableValues?: Maybe<{ [key: string]: any }>; - operationName?: Maybe; - fieldResolver?: Maybe>; - typeResolver?: Maybe>; -} - -/** - * Implements the "Evaluating requests" section of the GraphQL specification. - * - * Returns either a synchronous ExecutionResult (if all encountered resolvers - * are synchronous), or a Promise of an ExecutionResult that will eventually be - * resolved and never rejected. - * - * If the arguments to this function do not result in a legal execution context, - * a GraphQLError will be thrown immediately explaining the invalid input. - * - * Accepts either an object with named arguments, or individual arguments. - */ -export function execute(args: ExecutionArgs): PromiseOrValue; -export function execute( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: Maybe<{ [key: string]: any }>, - operationName?: Maybe, - fieldResolver?: Maybe>, - typeResolver?: Maybe>, -): PromiseOrValue; - -/** - * Also implements the "Evaluating requests" section of the GraphQL specification. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ -export function executeSync(args: ExecutionArgs): ExecutionResult; - -/** - * Essential assertions before executing to provide developer feedback for - * improper use of the GraphQL library. - */ -export function assertValidExecutionArguments( - schema: GraphQLSchema, - document: DocumentNode, - rawVariableValues: Maybe<{ [key: string]: any }>, -): void; - -/** - * Constructs a ExecutionContext object from the arguments passed to - * execute, which we will pass throughout the other execution methods. - * - * Throws a GraphQLError if a valid execution context cannot be created. - */ -export function buildExecutionContext( - schema: GraphQLSchema, - document: DocumentNode, - rootValue: any, - contextValue: any, - rawVariableValues: Maybe<{ [key: string]: any }>, - operationName: Maybe, - fieldResolver: Maybe>, - typeResolver?: Maybe>, -): ReadonlyArray | ExecutionContext; - -/** - * Given a selectionSet, adds all of the fields in that selection to - * the passed in map of fields, and returns it at the end. - * - * CollectFields requires the "runtime type" of an object. For a field which - * returns an Interface or Union type, the "runtime type" will be the actual - * Object type returned by that field. - */ -export function collectFields( - exeContext: ExecutionContext, - runtimeType: GraphQLObjectType, - selectionSet: SelectionSetNode, - fields: { [key: string]: Array }, - visitedFragmentNames: { [key: string]: boolean }, -): { [key: string]: Array }; - -export function buildResolveInfo( - exeContext: ExecutionContext, - fieldDef: GraphQLField, - fieldNodes: ReadonlyArray, - parentType: GraphQLObjectType, - path: Path, -): GraphQLResolveInfo; - -/** - * If a resolveType function is not given, then a default resolve behavior is - * used which attempts two strategies: - * - * First, See if the provided value has a `__typename` field defined, if so, use - * that value as name of the resolved type. - * - * Otherwise, test each possible type for the abstract type by calling - * isTypeOf for the object being coerced, returning the first type that matches. - */ -export const defaultTypeResolver: GraphQLTypeResolver; - -/** - * If a resolve function is not given, then a default resolve behavior is used - * which takes the property of the source object of the same name as the field - * and returns it as the result, or if it's a function, returns the result - * of calling that function while passing along args and context. - */ -export const defaultFieldResolver: GraphQLFieldResolver; - -/** - * This method looks up the field on the given type definition. - * It has special casing for the two introspection fields, __schema - * and __typename. __typename is special because it can always be - * queried as a field, even in situations where no other fields - * are allowed, like on a Union. __schema could get automatically - * added to the query type, but that would require mutating type - * definitions, which would cause issues. - */ -export function getFieldDef( - schema: GraphQLSchema, - parentType: GraphQLObjectType, - fieldName: string, -): Maybe>; diff --git a/node_modules/graphql/execution/execute.js b/node_modules/graphql/execution/execute.js deleted file mode 100644 index a09c1a71..00000000 --- a/node_modules/graphql/execution/execute.js +++ /dev/null @@ -1,867 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.execute = execute; -exports.executeSync = executeSync; -exports.assertValidExecutionArguments = assertValidExecutionArguments; -exports.buildExecutionContext = buildExecutionContext; -exports.collectFields = collectFields; -exports.buildResolveInfo = buildResolveInfo; -exports.getFieldDef = getFieldDef; -exports.defaultFieldResolver = exports.defaultTypeResolver = void 0; - -var _arrayFrom = _interopRequireDefault(require("../polyfills/arrayFrom.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _memoize = _interopRequireDefault(require("../jsutils/memoize3.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _isPromise = _interopRequireDefault(require("../jsutils/isPromise.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _isCollection = _interopRequireDefault(require("../jsutils/isCollection.js")); - -var _promiseReduce = _interopRequireDefault(require("../jsutils/promiseReduce.js")); - -var _promiseForObject = _interopRequireDefault(require("../jsutils/promiseForObject.js")); - -var _Path = require("../jsutils/Path.js"); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _locatedError = require("../error/locatedError.js"); - -var _kinds = require("../language/kinds.js"); - -var _validate = require("../type/validate.js"); - -var _introspection = require("../type/introspection.js"); - -var _directives = require("../type/directives.js"); - -var _definition = require("../type/definition.js"); - -var _typeFromAST = require("../utilities/typeFromAST.js"); - -var _getOperationRootType = require("../utilities/getOperationRootType.js"); - -var _values = require("./values.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function execute(argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - return arguments.length === 1 ? executeImpl(argsOrSchema) : executeImpl({ - schema: argsOrSchema, - document: document, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - }); -} -/** - * Also implements the "Evaluating requests" section of the GraphQL specification. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ - - -function executeSync(args) { - var result = executeImpl(args); // Assert that the execution was synchronous. - - if ((0, _isPromise.default)(result)) { - throw new Error('GraphQL execution failed to complete synchronously.'); - } - - return result; -} - -function executeImpl(args) { - var schema = args.schema, - document = args.document, - rootValue = args.rootValue, - contextValue = args.contextValue, - variableValues = args.variableValues, - operationName = args.operationName, - fieldResolver = args.fieldResolver, - typeResolver = args.typeResolver; // If arguments are missing or incorrect, throw an error. - - assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, - // a "Response" with only errors is returned. - - var exeContext = buildExecutionContext(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Return early errors if execution context failed. - - if (Array.isArray(exeContext)) { - return { - errors: exeContext - }; - } // Return a Promise that will eventually resolve to the data described by - // The "Response" section of the GraphQL specification. - // - // If errors are encountered while executing a GraphQL field, only that - // field and its descendants will be omitted, and sibling fields will still - // be executed. An execution which encounters errors will still result in a - // resolved Promise. - - - var data = executeOperation(exeContext, exeContext.operation, rootValue); - return buildResponse(exeContext, data); -} -/** - * Given a completed execution context and data, build the { errors, data } - * response defined by the "Response" section of the GraphQL specification. - */ - - -function buildResponse(exeContext, data) { - if ((0, _isPromise.default)(data)) { - return data.then(function (resolved) { - return buildResponse(exeContext, resolved); - }); - } - - return exeContext.errors.length === 0 ? { - data: data - } : { - errors: exeContext.errors, - data: data - }; -} -/** - * Essential assertions before executing to provide developer feedback for - * improper use of the GraphQL library. - * - * @internal - */ - - -function assertValidExecutionArguments(schema, document, rawVariableValues) { - document || (0, _devAssert.default)(0, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. - - (0, _validate.assertValidSchema)(schema); // Variables, if provided, must be an object. - - rawVariableValues == null || (0, _isObjectLike.default)(rawVariableValues) || (0, _devAssert.default)(0, 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.'); -} -/** - * Constructs a ExecutionContext object from the arguments passed to - * execute, which we will pass throughout the other execution methods. - * - * Throws a GraphQLError if a valid execution context cannot be created. - * - * @internal - */ - - -function buildExecutionContext(schema, document, rootValue, contextValue, rawVariableValues, operationName, fieldResolver, typeResolver) { - var _definition$name, _operation$variableDe; - - var operation; - var fragments = Object.create(null); - - for (var _i2 = 0, _document$definitions2 = document.definitions; _i2 < _document$definitions2.length; _i2++) { - var definition = _document$definitions2[_i2]; - - switch (definition.kind) { - case _kinds.Kind.OPERATION_DEFINITION: - if (operationName == null) { - if (operation !== undefined) { - return [new _GraphQLError.GraphQLError('Must provide operation name if query contains multiple operations.')]; - } - - operation = definition; - } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { - operation = definition; - } - - break; - - case _kinds.Kind.FRAGMENT_DEFINITION: - fragments[definition.name.value] = definition; - break; - } - } - - if (!operation) { - if (operationName != null) { - return [new _GraphQLError.GraphQLError("Unknown operation named \"".concat(operationName, "\"."))]; - } - - return [new _GraphQLError.GraphQLError('Must provide an operation.')]; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var variableDefinitions = (_operation$variableDe = operation.variableDefinitions) !== null && _operation$variableDe !== void 0 ? _operation$variableDe : []; - var coercedVariableValues = (0, _values.getVariableValues)(schema, variableDefinitions, rawVariableValues !== null && rawVariableValues !== void 0 ? rawVariableValues : {}, { - maxErrors: 50 - }); - - if (coercedVariableValues.errors) { - return coercedVariableValues.errors; - } - - return { - schema: schema, - fragments: fragments, - rootValue: rootValue, - contextValue: contextValue, - operation: operation, - variableValues: coercedVariableValues.coerced, - fieldResolver: fieldResolver !== null && fieldResolver !== void 0 ? fieldResolver : defaultFieldResolver, - typeResolver: typeResolver !== null && typeResolver !== void 0 ? typeResolver : defaultTypeResolver, - errors: [] - }; -} -/** - * Implements the "Evaluating operations" section of the spec. - */ - - -function executeOperation(exeContext, operation, rootValue) { - var type = (0, _getOperationRootType.getOperationRootType)(exeContext.schema, operation); - var fields = collectFields(exeContext, type, operation.selectionSet, Object.create(null), Object.create(null)); - var path = undefined; // Errors from sub-fields of a NonNull type may propagate to the top level, - // at which point we still log the error and null the parent field, which - // in this case is the entire response. - - try { - var result = operation.operation === 'mutation' ? executeFieldsSerially(exeContext, type, rootValue, path, fields) : executeFields(exeContext, type, rootValue, path, fields); - - if ((0, _isPromise.default)(result)) { - return result.then(undefined, function (error) { - exeContext.errors.push(error); - return Promise.resolve(null); - }); - } - - return result; - } catch (error) { - exeContext.errors.push(error); - return null; - } -} -/** - * Implements the "Evaluating selection sets" section of the spec - * for "write" mode. - */ - - -function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) { - return (0, _promiseReduce.default)(Object.keys(fields), function (results, responseName) { - var fieldNodes = fields[responseName]; - var fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); - var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); - - if (result === undefined) { - return results; - } - - if ((0, _isPromise.default)(result)) { - return result.then(function (resolvedResult) { - results[responseName] = resolvedResult; - return results; - }); - } - - results[responseName] = result; - return results; - }, Object.create(null)); -} -/** - * Implements the "Evaluating selection sets" section of the spec - * for "read" mode. - */ - - -function executeFields(exeContext, parentType, sourceValue, path, fields) { - var results = Object.create(null); - var containsPromise = false; - - for (var _i4 = 0, _Object$keys2 = Object.keys(fields); _i4 < _Object$keys2.length; _i4++) { - var responseName = _Object$keys2[_i4]; - var fieldNodes = fields[responseName]; - var fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); - var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); - - if (result !== undefined) { - results[responseName] = result; - - if ((0, _isPromise.default)(result)) { - containsPromise = true; - } - } - } // If there are no promises, we can just return the object - - - if (!containsPromise) { - return results; - } // Otherwise, results is a map from field name to the result of resolving that - // field, which is possibly a promise. Return a promise that will return this - // same map, but with any promises replaced with the values they resolved to. - - - return (0, _promiseForObject.default)(results); -} -/** - * Given a selectionSet, adds all of the fields in that selection to - * the passed in map of fields, and returns it at the end. - * - * CollectFields requires the "runtime type" of an object. For a field which - * returns an Interface or Union type, the "runtime type" will be the actual - * Object type returned by that field. - * - * @internal - */ - - -function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFragmentNames) { - for (var _i6 = 0, _selectionSet$selecti2 = selectionSet.selections; _i6 < _selectionSet$selecti2.length; _i6++) { - var selection = _selectionSet$selecti2[_i6]; - - switch (selection.kind) { - case _kinds.Kind.FIELD: - { - if (!shouldIncludeNode(exeContext, selection)) { - continue; - } - - var name = getFieldEntryKey(selection); - - if (!fields[name]) { - fields[name] = []; - } - - fields[name].push(selection); - break; - } - - case _kinds.Kind.INLINE_FRAGMENT: - { - if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) { - continue; - } - - collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames); - break; - } - - case _kinds.Kind.FRAGMENT_SPREAD: - { - var fragName = selection.name.value; - - if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) { - continue; - } - - visitedFragmentNames[fragName] = true; - var fragment = exeContext.fragments[fragName]; - - if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) { - continue; - } - - collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames); - break; - } - } - } - - return fields; -} -/** - * Determines if a field should be included based on the @include and @skip - * directives, where @skip has higher precedence than @include. - */ - - -function shouldIncludeNode(exeContext, node) { - var skip = (0, _values.getDirectiveValues)(_directives.GraphQLSkipDirective, node, exeContext.variableValues); - - if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { - return false; - } - - var include = (0, _values.getDirectiveValues)(_directives.GraphQLIncludeDirective, node, exeContext.variableValues); - - if ((include === null || include === void 0 ? void 0 : include.if) === false) { - return false; - } - - return true; -} -/** - * Determines if a fragment is applicable to the given type. - */ - - -function doesFragmentConditionMatch(exeContext, fragment, type) { - var typeConditionNode = fragment.typeCondition; - - if (!typeConditionNode) { - return true; - } - - var conditionalType = (0, _typeFromAST.typeFromAST)(exeContext.schema, typeConditionNode); - - if (conditionalType === type) { - return true; - } - - if ((0, _definition.isAbstractType)(conditionalType)) { - return exeContext.schema.isSubType(conditionalType, type); - } - - return false; -} -/** - * Implements the logic to compute the key of a given field's entry - */ - - -function getFieldEntryKey(node) { - return node.alias ? node.alias.value : node.name.value; -} -/** - * Resolves the field on the given source object. In particular, this - * figures out the value that the field returns by calling its resolve function, - * then calls completeValue to complete promises, serialize scalars, or execute - * the sub-selection-set for objects. - */ - - -function resolveField(exeContext, parentType, source, fieldNodes, path) { - var _fieldDef$resolve; - - var fieldNode = fieldNodes[0]; - var fieldName = fieldNode.name.value; - var fieldDef = getFieldDef(exeContext.schema, parentType, fieldName); - - if (!fieldDef) { - return; - } - - var returnType = fieldDef.type; - var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver; - var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal or abrupt (error). - - try { - // Build a JS object of arguments from the field.arguments AST, using the - // variables scope to fulfill any variable references. - // TODO: find a way to memoize, in case this field is within a List type. - var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues); // The resolve function's optional third argument is a context value that - // is provided to every resolve function within an execution. It is commonly - // used to represent an authenticated user, or request-specific caches. - - var _contextValue = exeContext.contextValue; - var result = resolveFn(source, args, _contextValue, info); - var completed; - - if ((0, _isPromise.default)(result)) { - completed = result.then(function (resolved) { - return completeValue(exeContext, returnType, fieldNodes, info, path, resolved); - }); - } else { - completed = completeValue(exeContext, returnType, fieldNodes, info, path, result); - } - - if ((0, _isPromise.default)(completed)) { - // Note: we don't rely on a `catch` method, but we do expect "thenable" - // to take a second callback for the error case. - return completed.then(undefined, function (rawError) { - var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path)); - return handleFieldError(error, returnType, exeContext); - }); - } - - return completed; - } catch (rawError) { - var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path)); - return handleFieldError(error, returnType, exeContext); - } -} -/** - * @internal - */ - - -function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { - // The resolve function's optional fourth argument is a collection of - // information about the current execution state. - return { - fieldName: fieldDef.name, - fieldNodes: fieldNodes, - returnType: fieldDef.type, - parentType: parentType, - path: path, - schema: exeContext.schema, - fragments: exeContext.fragments, - rootValue: exeContext.rootValue, - operation: exeContext.operation, - variableValues: exeContext.variableValues - }; -} - -function handleFieldError(error, returnType, exeContext) { - // If the field type is non-nullable, then it is resolved without any - // protection from errors, however it still properly locates the error. - if ((0, _definition.isNonNullType)(returnType)) { - throw error; - } // Otherwise, error protection is applied, logging the error and resolving - // a null value for this field if one is encountered. - - - exeContext.errors.push(error); - return null; -} -/** - * Implements the instructions for completeValue as defined in the - * "Field entries" section of the spec. - * - * If the field type is Non-Null, then this recursively completes the value - * for the inner type. It throws a field error if that completion returns null, - * as per the "Nullability" section of the spec. - * - * If the field type is a List, then this recursively completes the value - * for the inner type on each item in the list. - * - * If the field type is a Scalar or Enum, ensures the completed value is a legal - * value of the type by calling the `serialize` method of GraphQL type - * definition. - * - * If the field is an abstract type, determine the runtime type of the value - * and then complete based on that type - * - * Otherwise, the field type expects a sub-selection set, and will complete the - * value by evaluating all sub-selections. - */ - - -function completeValue(exeContext, returnType, fieldNodes, info, path, result) { - // If result is an Error, throw a located error. - if (result instanceof Error) { - throw result; - } // If field type is NonNull, complete for inner type, and throw field error - // if result is null. - - - if ((0, _definition.isNonNullType)(returnType)) { - var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path, result); - - if (completed === null) { - throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, ".")); - } - - return completed; - } // If result value is null or undefined then return null. - - - if (result == null) { - return null; - } // If field type is List, complete each item in the list with the inner type - - - if ((0, _definition.isListType)(returnType)) { - return completeListValue(exeContext, returnType, fieldNodes, info, path, result); - } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, - // returning null if serialization is not possible. - - - if ((0, _definition.isLeafType)(returnType)) { - return completeLeafValue(returnType, result); - } // If field type is an abstract type, Interface or Union, determine the - // runtime Object type and complete for that type. - - - if ((0, _definition.isAbstractType)(returnType)) { - return completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result); - } // If field type is Object, execute and complete all sub-selections. - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isObjectType)(returnType)) { - return completeObjectValue(exeContext, returnType, fieldNodes, info, path, result); - } // istanbul ignore next (Not reachable. All possible output types have been considered) - - - false || (0, _invariant.default)(0, 'Cannot complete value of unexpected output type: ' + (0, _inspect.default)(returnType)); -} -/** - * Complete a list value by completing each item in the list with the - * inner type - */ - - -function completeListValue(exeContext, returnType, fieldNodes, info, path, result) { - if (!(0, _isCollection.default)(result)) { - throw new _GraphQLError.GraphQLError("Expected Iterable, but did not find one for field \"".concat(info.parentType.name, ".").concat(info.fieldName, "\".")); - } // This is specified as a simple map, however we're optimizing the path - // where the list contains no Promises by avoiding creating another Promise. - - - var itemType = returnType.ofType; - var containsPromise = false; - var completedResults = (0, _arrayFrom.default)(result, function (item, index) { - // No need to modify the info object containing the path, - // since from here on it is not ever accessed by resolver functions. - var itemPath = (0, _Path.addPath)(path, index, undefined); - - try { - var completedItem; - - if ((0, _isPromise.default)(item)) { - completedItem = item.then(function (resolved) { - return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved); - }); - } else { - completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item); - } - - if ((0, _isPromise.default)(completedItem)) { - containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" - // to take a second callback for the error case. - - return completedItem.then(undefined, function (rawError) { - var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath)); - return handleFieldError(error, itemType, exeContext); - }); - } - - return completedItem; - } catch (rawError) { - var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath)); - return handleFieldError(error, itemType, exeContext); - } - }); - return containsPromise ? Promise.all(completedResults) : completedResults; -} -/** - * Complete a Scalar or Enum by serializing to a valid value, returning - * null if serialization is not possible. - */ - - -function completeLeafValue(returnType, result) { - var serializedResult = returnType.serialize(result); - - if (serializedResult === undefined) { - throw new Error("Expected a value of type \"".concat((0, _inspect.default)(returnType), "\" but ") + "received: ".concat((0, _inspect.default)(result))); - } - - return serializedResult; -} -/** - * Complete a value of an abstract type by determining the runtime object type - * of that value, then complete the value for that type. - */ - - -function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result) { - var _returnType$resolveTy; - - var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver; - var contextValue = exeContext.contextValue; - var runtimeType = resolveTypeFn(result, contextValue, info, returnType); - - if ((0, _isPromise.default)(runtimeType)) { - return runtimeType.then(function (resolvedRuntimeType) { - return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result); - }); - } - - return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result); -} - -function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) { - if (runtimeTypeOrName == null) { - throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\". Either the \"").concat(returnType.name, "\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function."), fieldNodes); - } // FIXME: temporary workaround until support for passing object types would be removed in v16.0.0 - - - var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName; - - if (typeof runtimeTypeName !== 'string') { - throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\" with ") + "value ".concat((0, _inspect.default)(result), ", received \"").concat((0, _inspect.default)(runtimeTypeOrName), "\".")); - } - - var runtimeType = exeContext.schema.getType(runtimeTypeName); - - if (runtimeType == null) { - throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a type \"").concat(runtimeTypeName, "\" that does not exist inside schema."), fieldNodes); - } - - if (!(0, _definition.isObjectType)(runtimeType)) { - throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a non-object type \"").concat(runtimeTypeName, "\"."), fieldNodes); - } - - if (!exeContext.schema.isSubType(returnType, runtimeType)) { - throw new _GraphQLError.GraphQLError("Runtime Object type \"".concat(runtimeType.name, "\" is not a possible type for \"").concat(returnType.name, "\"."), fieldNodes); - } - - return runtimeType; -} -/** - * Complete an Object value by executing all sub-selections. - */ - - -function completeObjectValue(exeContext, returnType, fieldNodes, info, path, result) { - // If there is an isTypeOf predicate function, call it with the - // current result. If isTypeOf returns false, then raise an error rather - // than continuing execution. - if (returnType.isTypeOf) { - var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); - - if ((0, _isPromise.default)(isTypeOf)) { - return isTypeOf.then(function (resolvedIsTypeOf) { - if (!resolvedIsTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - - return collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result); - }); - } - - if (!isTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - } - - return collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result); -} - -function invalidReturnTypeError(returnType, result, fieldNodes) { - return new _GraphQLError.GraphQLError("Expected value of type \"".concat(returnType.name, "\" but got: ").concat((0, _inspect.default)(result), "."), fieldNodes); -} - -function collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result) { - // Collect sub-fields to execute to complete this value. - var subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); - return executeFields(exeContext, returnType, result, path, subFieldNodes); -} -/** - * A memoized collection of relevant subfields with regard to the return - * type. Memoizing ensures the subfields are not repeatedly calculated, which - * saves overhead when resolving lists of values. - */ - - -var collectSubfields = (0, _memoize.default)(_collectSubfields); - -function _collectSubfields(exeContext, returnType, fieldNodes) { - var subFieldNodes = Object.create(null); - var visitedFragmentNames = Object.create(null); - - for (var _i8 = 0; _i8 < fieldNodes.length; _i8++) { - var node = fieldNodes[_i8]; - - if (node.selectionSet) { - subFieldNodes = collectFields(exeContext, returnType, node.selectionSet, subFieldNodes, visitedFragmentNames); - } - } - - return subFieldNodes; -} -/** - * If a resolveType function is not given, then a default resolve behavior is - * used which attempts two strategies: - * - * First, See if the provided value has a `__typename` field defined, if so, use - * that value as name of the resolved type. - * - * Otherwise, test each possible type for the abstract type by calling - * isTypeOf for the object being coerced, returning the first type that matches. - */ - - -var defaultTypeResolver = function defaultTypeResolver(value, contextValue, info, abstractType) { - // First, look for `__typename`. - if ((0, _isObjectLike.default)(value) && typeof value.__typename === 'string') { - return value.__typename; - } // Otherwise, test each possible type. - - - var possibleTypes = info.schema.getPossibleTypes(abstractType); - var promisedIsTypeOfResults = []; - - for (var i = 0; i < possibleTypes.length; i++) { - var type = possibleTypes[i]; - - if (type.isTypeOf) { - var isTypeOfResult = type.isTypeOf(value, contextValue, info); - - if ((0, _isPromise.default)(isTypeOfResult)) { - promisedIsTypeOfResults[i] = isTypeOfResult; - } else if (isTypeOfResult) { - return type.name; - } - } - } - - if (promisedIsTypeOfResults.length) { - return Promise.all(promisedIsTypeOfResults).then(function (isTypeOfResults) { - for (var _i9 = 0; _i9 < isTypeOfResults.length; _i9++) { - if (isTypeOfResults[_i9]) { - return possibleTypes[_i9].name; - } - } - }); - } -}; -/** - * If a resolve function is not given, then a default resolve behavior is used - * which takes the property of the source object of the same name as the field - * and returns it as the result, or if it's a function, returns the result - * of calling that function while passing along args and context value. - */ - - -exports.defaultTypeResolver = defaultTypeResolver; - -var defaultFieldResolver = function defaultFieldResolver(source, args, contextValue, info) { - // ensure source is a value for which property access is acceptable. - if ((0, _isObjectLike.default)(source) || typeof source === 'function') { - var property = source[info.fieldName]; - - if (typeof property === 'function') { - return source[info.fieldName](args, contextValue, info); - } - - return property; - } -}; -/** - * This method looks up the field on the given type definition. - * It has special casing for the three introspection fields, - * __schema, __type and __typename. __typename is special because - * it can always be queried as a field, even in situations where no - * other fields are allowed, like on a Union. __schema and __type - * could get automatically added to the query type, but that would - * require mutating type definitions, which would cause issues. - * - * @internal - */ - - -exports.defaultFieldResolver = defaultFieldResolver; - -function getFieldDef(schema, parentType, fieldName) { - if (fieldName === _introspection.SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { - return _introspection.SchemaMetaFieldDef; - } else if (fieldName === _introspection.TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return _introspection.TypeMetaFieldDef; - } else if (fieldName === _introspection.TypeNameMetaFieldDef.name) { - return _introspection.TypeNameMetaFieldDef; - } - - return parentType.getFields()[fieldName]; -} diff --git a/node_modules/graphql/execution/execute.js.flow b/node_modules/graphql/execution/execute.js.flow deleted file mode 100644 index e49e88a9..00000000 --- a/node_modules/graphql/execution/execute.js.flow +++ /dev/null @@ -1,1248 +0,0 @@ -// @flow strict -import arrayFrom from '../polyfills/arrayFrom'; - -import type { Path } from '../jsutils/Path'; -import type { ObjMap } from '../jsutils/ObjMap'; -import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; -import inspect from '../jsutils/inspect'; -import memoize3 from '../jsutils/memoize3'; -import invariant from '../jsutils/invariant'; -import devAssert from '../jsutils/devAssert'; -import isPromise from '../jsutils/isPromise'; -import isObjectLike from '../jsutils/isObjectLike'; -import isCollection from '../jsutils/isCollection'; -import promiseReduce from '../jsutils/promiseReduce'; -import promiseForObject from '../jsutils/promiseForObject'; -import { addPath, pathToArray } from '../jsutils/Path'; - -import type { GraphQLFormattedError } from '../error/formatError'; -import { GraphQLError } from '../error/GraphQLError'; -import { locatedError } from '../error/locatedError'; - -import type { - DocumentNode, - OperationDefinitionNode, - SelectionSetNode, - FieldNode, - FragmentSpreadNode, - InlineFragmentNode, - FragmentDefinitionNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; - -import type { GraphQLSchema } from '../type/schema'; -import type { - GraphQLObjectType, - GraphQLOutputType, - GraphQLLeafType, - GraphQLAbstractType, - GraphQLField, - GraphQLFieldResolver, - GraphQLResolveInfo, - GraphQLTypeResolver, - GraphQLList, -} from '../type/definition'; -import { assertValidSchema } from '../type/validate'; -import { - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, -} from '../type/introspection'; -import { - GraphQLIncludeDirective, - GraphQLSkipDirective, -} from '../type/directives'; -import { - isNamedType, - isObjectType, - isAbstractType, - isLeafType, - isListType, - isNonNullType, -} from '../type/definition'; - -import { typeFromAST } from '../utilities/typeFromAST'; -import { getOperationRootType } from '../utilities/getOperationRootType'; - -import { - getVariableValues, - getArgumentValues, - getDirectiveValues, -} from './values'; - -/** - * Terminology - * - * "Definitions" are the generic name for top-level statements in the document. - * Examples of this include: - * 1) Operations (such as a query) - * 2) Fragments - * - * "Operations" are a generic name for requests in the document. - * Examples of this include: - * 1) query, - * 2) mutation - * - * "Selections" are the definitions that can appear legally and at - * single level of the query. These include: - * 1) field references e.g "a" - * 2) fragment "spreads" e.g. "...c" - * 3) inline fragment "spreads" e.g. "...on Type { a }" - */ - -/** - * Data that must be available at all points during query execution. - * - * Namely, schema of the type system that is currently executing, - * and the fragments defined in the query document - */ -export type ExecutionContext = {| - schema: GraphQLSchema, - fragments: ObjMap, - rootValue: mixed, - contextValue: mixed, - operation: OperationDefinitionNode, - variableValues: { [variable: string]: mixed, ... }, - fieldResolver: GraphQLFieldResolver, - typeResolver: GraphQLTypeResolver, - errors: Array, -|}; - -/** - * The result of GraphQL execution. - * - * - `errors` is included when any errors occurred as a non-empty array. - * - `data` is the result of a successful execution of the query. - * - `extensions` is reserved for adding non-standard properties. - */ -export type ExecutionResult = {| - errors?: $ReadOnlyArray, - data?: ObjMap | null, - extensions?: ObjMap, -|}; - -export type FormattedExecutionResult = {| - errors?: $ReadOnlyArray, - data?: ObjMap | null, - extensions?: ObjMap, -|}; - -export type ExecutionArgs = {| - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, - typeResolver?: ?GraphQLTypeResolver, -|}; - -/** - * Implements the "Evaluating requests" section of the GraphQL specification. - * - * Returns either a synchronous ExecutionResult (if all encountered resolvers - * are synchronous), or a Promise of an ExecutionResult that will eventually be - * resolved and never rejected. - * - * If the arguments to this function do not result in a legal execution context, - * a GraphQLError will be thrown immediately explaining the invalid input. - * - * Accepts either an object with named arguments, or individual arguments. - */ -declare function execute( - ExecutionArgs, - ..._: [] -): PromiseOrValue; -/* eslint-disable no-redeclare */ -declare function execute( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, - typeResolver?: ?GraphQLTypeResolver, -): PromiseOrValue; -export function execute( - argsOrSchema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, -) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - return arguments.length === 1 - ? executeImpl(argsOrSchema) - : executeImpl({ - schema: argsOrSchema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, - }); -} - -/** - * Also implements the "Evaluating requests" section of the GraphQL specification. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ -export function executeSync(args: ExecutionArgs): ExecutionResult { - const result = executeImpl(args); - - // Assert that the execution was synchronous. - if (isPromise(result)) { - throw new Error('GraphQL execution failed to complete synchronously.'); - } - - return result; -} - -function executeImpl(args: ExecutionArgs): PromiseOrValue { - const { - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, - } = args; - - // If arguments are missing or incorrect, throw an error. - assertValidExecutionArguments(schema, document, variableValues); - - // If a valid execution context cannot be created due to incorrect arguments, - // a "Response" with only errors is returned. - const exeContext = buildExecutionContext( - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, - ); - - // Return early errors if execution context failed. - if (Array.isArray(exeContext)) { - return { errors: exeContext }; - } - - // Return a Promise that will eventually resolve to the data described by - // The "Response" section of the GraphQL specification. - // - // If errors are encountered while executing a GraphQL field, only that - // field and its descendants will be omitted, and sibling fields will still - // be executed. An execution which encounters errors will still result in a - // resolved Promise. - const data = executeOperation(exeContext, exeContext.operation, rootValue); - return buildResponse(exeContext, data); -} - -/** - * Given a completed execution context and data, build the { errors, data } - * response defined by the "Response" section of the GraphQL specification. - */ -function buildResponse( - exeContext: ExecutionContext, - data: PromiseOrValue | null>, -): PromiseOrValue { - if (isPromise(data)) { - return data.then((resolved) => buildResponse(exeContext, resolved)); - } - return exeContext.errors.length === 0 - ? { data } - : { errors: exeContext.errors, data }; -} - -/** - * Essential assertions before executing to provide developer feedback for - * improper use of the GraphQL library. - * - * @internal - */ -export function assertValidExecutionArguments( - schema: GraphQLSchema, - document: DocumentNode, - rawVariableValues: ?{ +[variable: string]: mixed, ... }, -): void { - devAssert(document, 'Must provide document.'); - - // If the schema used for execution is invalid, throw an error. - assertValidSchema(schema); - - // Variables, if provided, must be an object. - devAssert( - rawVariableValues == null || isObjectLike(rawVariableValues), - 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', - ); -} - -/** - * Constructs a ExecutionContext object from the arguments passed to - * execute, which we will pass throughout the other execution methods. - * - * Throws a GraphQLError if a valid execution context cannot be created. - * - * @internal - */ -export function buildExecutionContext( - schema: GraphQLSchema, - document: DocumentNode, - rootValue: mixed, - contextValue: mixed, - rawVariableValues: ?{ +[variable: string]: mixed, ... }, - operationName: ?string, - fieldResolver: ?GraphQLFieldResolver, - typeResolver?: ?GraphQLTypeResolver, -): $ReadOnlyArray | ExecutionContext { - let operation: OperationDefinitionNode | void; - const fragments: ObjMap = Object.create(null); - for (const definition of document.definitions) { - switch (definition.kind) { - case Kind.OPERATION_DEFINITION: - if (operationName == null) { - if (operation !== undefined) { - return [ - new GraphQLError( - 'Must provide operation name if query contains multiple operations.', - ), - ]; - } - operation = definition; - } else if (definition.name?.value === operationName) { - operation = definition; - } - break; - case Kind.FRAGMENT_DEFINITION: - fragments[definition.name.value] = definition; - break; - } - } - - if (!operation) { - if (operationName != null) { - return [new GraphQLError(`Unknown operation named "${operationName}".`)]; - } - return [new GraphQLError('Must provide an operation.')]; - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const variableDefinitions = operation.variableDefinitions ?? []; - - const coercedVariableValues = getVariableValues( - schema, - variableDefinitions, - rawVariableValues ?? {}, - { maxErrors: 50 }, - ); - - if (coercedVariableValues.errors) { - return coercedVariableValues.errors; - } - - return { - schema, - fragments, - rootValue, - contextValue, - operation, - variableValues: coercedVariableValues.coerced, - fieldResolver: fieldResolver ?? defaultFieldResolver, - typeResolver: typeResolver ?? defaultTypeResolver, - errors: [], - }; -} - -/** - * Implements the "Evaluating operations" section of the spec. - */ -function executeOperation( - exeContext: ExecutionContext, - operation: OperationDefinitionNode, - rootValue: mixed, -): PromiseOrValue | null> { - const type = getOperationRootType(exeContext.schema, operation); - const fields = collectFields( - exeContext, - type, - operation.selectionSet, - Object.create(null), - Object.create(null), - ); - - const path = undefined; - - // Errors from sub-fields of a NonNull type may propagate to the top level, - // at which point we still log the error and null the parent field, which - // in this case is the entire response. - try { - const result = - operation.operation === 'mutation' - ? executeFieldsSerially(exeContext, type, rootValue, path, fields) - : executeFields(exeContext, type, rootValue, path, fields); - if (isPromise(result)) { - return result.then(undefined, (error) => { - exeContext.errors.push(error); - return Promise.resolve(null); - }); - } - return result; - } catch (error) { - exeContext.errors.push(error); - return null; - } -} - -/** - * Implements the "Evaluating selection sets" section of the spec - * for "write" mode. - */ -function executeFieldsSerially( - exeContext: ExecutionContext, - parentType: GraphQLObjectType, - sourceValue: mixed, - path: Path | void, - fields: ObjMap>, -): PromiseOrValue> { - return promiseReduce( - Object.keys(fields), - (results, responseName) => { - const fieldNodes = fields[responseName]; - const fieldPath = addPath(path, responseName, parentType.name); - const result = resolveField( - exeContext, - parentType, - sourceValue, - fieldNodes, - fieldPath, - ); - if (result === undefined) { - return results; - } - if (isPromise(result)) { - return result.then((resolvedResult) => { - results[responseName] = resolvedResult; - return results; - }); - } - results[responseName] = result; - return results; - }, - Object.create(null), - ); -} - -/** - * Implements the "Evaluating selection sets" section of the spec - * for "read" mode. - */ -function executeFields( - exeContext: ExecutionContext, - parentType: GraphQLObjectType, - sourceValue: mixed, - path: Path | void, - fields: ObjMap>, -): PromiseOrValue> { - const results = Object.create(null); - let containsPromise = false; - - for (const responseName of Object.keys(fields)) { - const fieldNodes = fields[responseName]; - const fieldPath = addPath(path, responseName, parentType.name); - const result = resolveField( - exeContext, - parentType, - sourceValue, - fieldNodes, - fieldPath, - ); - - if (result !== undefined) { - results[responseName] = result; - if (isPromise(result)) { - containsPromise = true; - } - } - } - - // If there are no promises, we can just return the object - if (!containsPromise) { - return results; - } - - // Otherwise, results is a map from field name to the result of resolving that - // field, which is possibly a promise. Return a promise that will return this - // same map, but with any promises replaced with the values they resolved to. - return promiseForObject(results); -} - -/** - * Given a selectionSet, adds all of the fields in that selection to - * the passed in map of fields, and returns it at the end. - * - * CollectFields requires the "runtime type" of an object. For a field which - * returns an Interface or Union type, the "runtime type" will be the actual - * Object type returned by that field. - * - * @internal - */ -export function collectFields( - exeContext: ExecutionContext, - runtimeType: GraphQLObjectType, - selectionSet: SelectionSetNode, - fields: ObjMap>, - visitedFragmentNames: ObjMap, -): ObjMap> { - for (const selection of selectionSet.selections) { - switch (selection.kind) { - case Kind.FIELD: { - if (!shouldIncludeNode(exeContext, selection)) { - continue; - } - const name = getFieldEntryKey(selection); - if (!fields[name]) { - fields[name] = []; - } - fields[name].push(selection); - break; - } - case Kind.INLINE_FRAGMENT: { - if ( - !shouldIncludeNode(exeContext, selection) || - !doesFragmentConditionMatch(exeContext, selection, runtimeType) - ) { - continue; - } - collectFields( - exeContext, - runtimeType, - selection.selectionSet, - fields, - visitedFragmentNames, - ); - break; - } - case Kind.FRAGMENT_SPREAD: { - const fragName = selection.name.value; - if ( - visitedFragmentNames[fragName] || - !shouldIncludeNode(exeContext, selection) - ) { - continue; - } - visitedFragmentNames[fragName] = true; - const fragment = exeContext.fragments[fragName]; - if ( - !fragment || - !doesFragmentConditionMatch(exeContext, fragment, runtimeType) - ) { - continue; - } - collectFields( - exeContext, - runtimeType, - fragment.selectionSet, - fields, - visitedFragmentNames, - ); - break; - } - } - } - return fields; -} - -/** - * Determines if a field should be included based on the @include and @skip - * directives, where @skip has higher precedence than @include. - */ -function shouldIncludeNode( - exeContext: ExecutionContext, - node: FragmentSpreadNode | FieldNode | InlineFragmentNode, -): boolean { - const skip = getDirectiveValues( - GraphQLSkipDirective, - node, - exeContext.variableValues, - ); - if (skip?.if === true) { - return false; - } - - const include = getDirectiveValues( - GraphQLIncludeDirective, - node, - exeContext.variableValues, - ); - if (include?.if === false) { - return false; - } - return true; -} - -/** - * Determines if a fragment is applicable to the given type. - */ -function doesFragmentConditionMatch( - exeContext: ExecutionContext, - fragment: FragmentDefinitionNode | InlineFragmentNode, - type: GraphQLObjectType, -): boolean { - const typeConditionNode = fragment.typeCondition; - if (!typeConditionNode) { - return true; - } - const conditionalType = typeFromAST(exeContext.schema, typeConditionNode); - if (conditionalType === type) { - return true; - } - if (isAbstractType(conditionalType)) { - return exeContext.schema.isSubType(conditionalType, type); - } - return false; -} - -/** - * Implements the logic to compute the key of a given field's entry - */ -function getFieldEntryKey(node: FieldNode): string { - return node.alias ? node.alias.value : node.name.value; -} - -/** - * Resolves the field on the given source object. In particular, this - * figures out the value that the field returns by calling its resolve function, - * then calls completeValue to complete promises, serialize scalars, or execute - * the sub-selection-set for objects. - */ -function resolveField( - exeContext: ExecutionContext, - parentType: GraphQLObjectType, - source: mixed, - fieldNodes: $ReadOnlyArray, - path: Path, -): PromiseOrValue { - const fieldNode = fieldNodes[0]; - const fieldName = fieldNode.name.value; - - const fieldDef = getFieldDef(exeContext.schema, parentType, fieldName); - if (!fieldDef) { - return; - } - - const returnType = fieldDef.type; - const resolveFn = fieldDef.resolve ?? exeContext.fieldResolver; - - const info = buildResolveInfo( - exeContext, - fieldDef, - fieldNodes, - parentType, - path, - ); - - // Get the resolve function, regardless of if its result is normal or abrupt (error). - try { - // Build a JS object of arguments from the field.arguments AST, using the - // variables scope to fulfill any variable references. - // TODO: find a way to memoize, in case this field is within a List type. - const args = getArgumentValues( - fieldDef, - fieldNodes[0], - exeContext.variableValues, - ); - - // The resolve function's optional third argument is a context value that - // is provided to every resolve function within an execution. It is commonly - // used to represent an authenticated user, or request-specific caches. - const contextValue = exeContext.contextValue; - - const result = resolveFn(source, args, contextValue, info); - - let completed; - if (isPromise(result)) { - completed = result.then((resolved) => - completeValue(exeContext, returnType, fieldNodes, info, path, resolved), - ); - } else { - completed = completeValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result, - ); - } - - if (isPromise(completed)) { - // Note: we don't rely on a `catch` method, but we do expect "thenable" - // to take a second callback for the error case. - return completed.then(undefined, (rawError) => { - const error = locatedError(rawError, fieldNodes, pathToArray(path)); - return handleFieldError(error, returnType, exeContext); - }); - } - return completed; - } catch (rawError) { - const error = locatedError(rawError, fieldNodes, pathToArray(path)); - return handleFieldError(error, returnType, exeContext); - } -} - -/** - * @internal - */ -export function buildResolveInfo( - exeContext: ExecutionContext, - fieldDef: GraphQLField, - fieldNodes: $ReadOnlyArray, - parentType: GraphQLObjectType, - path: Path, -): GraphQLResolveInfo { - // The resolve function's optional fourth argument is a collection of - // information about the current execution state. - return { - fieldName: fieldDef.name, - fieldNodes, - returnType: fieldDef.type, - parentType, - path, - schema: exeContext.schema, - fragments: exeContext.fragments, - rootValue: exeContext.rootValue, - operation: exeContext.operation, - variableValues: exeContext.variableValues, - }; -} - -function handleFieldError( - error: GraphQLError, - returnType: GraphQLOutputType, - exeContext: ExecutionContext, -): null { - // If the field type is non-nullable, then it is resolved without any - // protection from errors, however it still properly locates the error. - if (isNonNullType(returnType)) { - throw error; - } - - // Otherwise, error protection is applied, logging the error and resolving - // a null value for this field if one is encountered. - exeContext.errors.push(error); - return null; -} - -/** - * Implements the instructions for completeValue as defined in the - * "Field entries" section of the spec. - * - * If the field type is Non-Null, then this recursively completes the value - * for the inner type. It throws a field error if that completion returns null, - * as per the "Nullability" section of the spec. - * - * If the field type is a List, then this recursively completes the value - * for the inner type on each item in the list. - * - * If the field type is a Scalar or Enum, ensures the completed value is a legal - * value of the type by calling the `serialize` method of GraphQL type - * definition. - * - * If the field is an abstract type, determine the runtime type of the value - * and then complete based on that type - * - * Otherwise, the field type expects a sub-selection set, and will complete the - * value by evaluating all sub-selections. - */ -function completeValue( - exeContext: ExecutionContext, - returnType: GraphQLOutputType, - fieldNodes: $ReadOnlyArray, - info: GraphQLResolveInfo, - path: Path, - result: mixed, -): PromiseOrValue { - // If result is an Error, throw a located error. - if (result instanceof Error) { - throw result; - } - - // If field type is NonNull, complete for inner type, and throw field error - // if result is null. - if (isNonNullType(returnType)) { - const completed = completeValue( - exeContext, - returnType.ofType, - fieldNodes, - info, - path, - result, - ); - if (completed === null) { - throw new Error( - `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`, - ); - } - return completed; - } - - // If result value is null or undefined then return null. - if (result == null) { - return null; - } - - // If field type is List, complete each item in the list with the inner type - if (isListType(returnType)) { - return completeListValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result, - ); - } - - // If field type is a leaf type, Scalar or Enum, serialize to a valid value, - // returning null if serialization is not possible. - if (isLeafType(returnType)) { - return completeLeafValue(returnType, result); - } - - // If field type is an abstract type, Interface or Union, determine the - // runtime Object type and complete for that type. - if (isAbstractType(returnType)) { - return completeAbstractValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result, - ); - } - - // If field type is Object, execute and complete all sub-selections. - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isObjectType(returnType)) { - return completeObjectValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result, - ); - } - - // istanbul ignore next (Not reachable. All possible output types have been considered) - invariant( - false, - 'Cannot complete value of unexpected output type: ' + - inspect((returnType: empty)), - ); -} - -/** - * Complete a list value by completing each item in the list with the - * inner type - */ -function completeListValue( - exeContext: ExecutionContext, - returnType: GraphQLList, - fieldNodes: $ReadOnlyArray, - info: GraphQLResolveInfo, - path: Path, - result: mixed, -): PromiseOrValue<$ReadOnlyArray> { - if (!isCollection(result)) { - throw new GraphQLError( - `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`, - ); - } - - // This is specified as a simple map, however we're optimizing the path - // where the list contains no Promises by avoiding creating another Promise. - const itemType = returnType.ofType; - let containsPromise = false; - const completedResults = arrayFrom(result, (item, index) => { - // No need to modify the info object containing the path, - // since from here on it is not ever accessed by resolver functions. - const itemPath = addPath(path, index, undefined); - try { - let completedItem; - if (isPromise(item)) { - completedItem = item.then((resolved) => - completeValue( - exeContext, - itemType, - fieldNodes, - info, - itemPath, - resolved, - ), - ); - } else { - completedItem = completeValue( - exeContext, - itemType, - fieldNodes, - info, - itemPath, - item, - ); - } - - if (isPromise(completedItem)) { - containsPromise = true; - // Note: we don't rely on a `catch` method, but we do expect "thenable" - // to take a second callback for the error case. - return completedItem.then(undefined, (rawError) => { - const error = locatedError( - rawError, - fieldNodes, - pathToArray(itemPath), - ); - return handleFieldError(error, itemType, exeContext); - }); - } - return completedItem; - } catch (rawError) { - const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); - return handleFieldError(error, itemType, exeContext); - } - }); - - return containsPromise ? Promise.all(completedResults) : completedResults; -} - -/** - * Complete a Scalar or Enum by serializing to a valid value, returning - * null if serialization is not possible. - */ -function completeLeafValue(returnType: GraphQLLeafType, result: mixed): mixed { - const serializedResult = returnType.serialize(result); - if (serializedResult === undefined) { - throw new Error( - `Expected a value of type "${inspect(returnType)}" but ` + - `received: ${inspect(result)}`, - ); - } - return serializedResult; -} - -/** - * Complete a value of an abstract type by determining the runtime object type - * of that value, then complete the value for that type. - */ -function completeAbstractValue( - exeContext: ExecutionContext, - returnType: GraphQLAbstractType, - fieldNodes: $ReadOnlyArray, - info: GraphQLResolveInfo, - path: Path, - result: mixed, -): PromiseOrValue> { - const resolveTypeFn = returnType.resolveType ?? exeContext.typeResolver; - const contextValue = exeContext.contextValue; - const runtimeType = resolveTypeFn(result, contextValue, info, returnType); - - if (isPromise(runtimeType)) { - return runtimeType.then((resolvedRuntimeType) => - completeObjectValue( - exeContext, - ensureValidRuntimeType( - resolvedRuntimeType, - exeContext, - returnType, - fieldNodes, - info, - result, - ), - fieldNodes, - info, - path, - result, - ), - ); - } - - return completeObjectValue( - exeContext, - ensureValidRuntimeType( - runtimeType, - exeContext, - returnType, - fieldNodes, - info, - result, - ), - fieldNodes, - info, - path, - result, - ); -} - -function ensureValidRuntimeType( - runtimeTypeOrName: mixed, - exeContext: ExecutionContext, - returnType: GraphQLAbstractType, - fieldNodes: $ReadOnlyArray, - info: GraphQLResolveInfo, - result: mixed, -): GraphQLObjectType { - if (runtimeTypeOrName == null) { - throw new GraphQLError( - `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, - fieldNodes, - ); - } - - // FIXME: temporary workaround until support for passing object types would be removed in v16.0.0 - const runtimeTypeName = isNamedType(runtimeTypeOrName) - ? runtimeTypeOrName.name - : runtimeTypeOrName; - - if (typeof runtimeTypeName !== 'string') { - throw new GraphQLError( - `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` + - `value ${inspect(result)}, received "${inspect(runtimeTypeOrName)}".`, - ); - } - - const runtimeType = exeContext.schema.getType(runtimeTypeName); - if (runtimeType == null) { - throw new GraphQLError( - `Abstract type "${returnType.name}" was resolve to a type "${runtimeTypeName}" that does not exist inside schema.`, - fieldNodes, - ); - } - - if (!isObjectType(runtimeType)) { - throw new GraphQLError( - `Abstract type "${returnType.name}" was resolve to a non-object type "${runtimeTypeName}".`, - fieldNodes, - ); - } - - if (!exeContext.schema.isSubType(returnType, runtimeType)) { - throw new GraphQLError( - `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, - fieldNodes, - ); - } - - return runtimeType; -} - -/** - * Complete an Object value by executing all sub-selections. - */ -function completeObjectValue( - exeContext: ExecutionContext, - returnType: GraphQLObjectType, - fieldNodes: $ReadOnlyArray, - info: GraphQLResolveInfo, - path: Path, - result: mixed, -): PromiseOrValue> { - // If there is an isTypeOf predicate function, call it with the - // current result. If isTypeOf returns false, then raise an error rather - // than continuing execution. - if (returnType.isTypeOf) { - const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); - - if (isPromise(isTypeOf)) { - return isTypeOf.then((resolvedIsTypeOf) => { - if (!resolvedIsTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - return collectAndExecuteSubfields( - exeContext, - returnType, - fieldNodes, - path, - result, - ); - }); - } - - if (!isTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - } - - return collectAndExecuteSubfields( - exeContext, - returnType, - fieldNodes, - path, - result, - ); -} - -function invalidReturnTypeError( - returnType: GraphQLObjectType, - result: mixed, - fieldNodes: $ReadOnlyArray, -): GraphQLError { - return new GraphQLError( - `Expected value of type "${returnType.name}" but got: ${inspect(result)}.`, - fieldNodes, - ); -} - -function collectAndExecuteSubfields( - exeContext: ExecutionContext, - returnType: GraphQLObjectType, - fieldNodes: $ReadOnlyArray, - path: Path, - result: mixed, -): PromiseOrValue> { - // Collect sub-fields to execute to complete this value. - const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); - return executeFields(exeContext, returnType, result, path, subFieldNodes); -} - -/** - * A memoized collection of relevant subfields with regard to the return - * type. Memoizing ensures the subfields are not repeatedly calculated, which - * saves overhead when resolving lists of values. - */ -const collectSubfields = memoize3(_collectSubfields); -function _collectSubfields( - exeContext: ExecutionContext, - returnType: GraphQLObjectType, - fieldNodes: $ReadOnlyArray, -): ObjMap> { - let subFieldNodes = Object.create(null); - const visitedFragmentNames = Object.create(null); - for (const node of fieldNodes) { - if (node.selectionSet) { - subFieldNodes = collectFields( - exeContext, - returnType, - node.selectionSet, - subFieldNodes, - visitedFragmentNames, - ); - } - } - return subFieldNodes; -} - -/** - * If a resolveType function is not given, then a default resolve behavior is - * used which attempts two strategies: - * - * First, See if the provided value has a `__typename` field defined, if so, use - * that value as name of the resolved type. - * - * Otherwise, test each possible type for the abstract type by calling - * isTypeOf for the object being coerced, returning the first type that matches. - */ -export const defaultTypeResolver: GraphQLTypeResolver = function ( - value, - contextValue, - info, - abstractType, -) { - // First, look for `__typename`. - if (isObjectLike(value) && typeof value.__typename === 'string') { - return value.__typename; - } - - // Otherwise, test each possible type. - const possibleTypes = info.schema.getPossibleTypes(abstractType); - const promisedIsTypeOfResults = []; - - for (let i = 0; i < possibleTypes.length; i++) { - const type = possibleTypes[i]; - - if (type.isTypeOf) { - const isTypeOfResult = type.isTypeOf(value, contextValue, info); - - if (isPromise(isTypeOfResult)) { - promisedIsTypeOfResults[i] = isTypeOfResult; - } else if (isTypeOfResult) { - return type.name; - } - } - } - - if (promisedIsTypeOfResults.length) { - return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => { - for (let i = 0; i < isTypeOfResults.length; i++) { - if (isTypeOfResults[i]) { - return possibleTypes[i].name; - } - } - }); - } -}; - -/** - * If a resolve function is not given, then a default resolve behavior is used - * which takes the property of the source object of the same name as the field - * and returns it as the result, or if it's a function, returns the result - * of calling that function while passing along args and context value. - */ -export const defaultFieldResolver: GraphQLFieldResolver< - mixed, - mixed, -> = function (source: any, args, contextValue, info) { - // ensure source is a value for which property access is acceptable. - if (isObjectLike(source) || typeof source === 'function') { - const property = source[info.fieldName]; - if (typeof property === 'function') { - return source[info.fieldName](args, contextValue, info); - } - return property; - } -}; - -/** - * This method looks up the field on the given type definition. - * It has special casing for the three introspection fields, - * __schema, __type and __typename. __typename is special because - * it can always be queried as a field, even in situations where no - * other fields are allowed, like on a Union. __schema and __type - * could get automatically added to the query type, but that would - * require mutating type definitions, which would cause issues. - * - * @internal - */ -export function getFieldDef( - schema: GraphQLSchema, - parentType: GraphQLObjectType, - fieldName: string, -): ?GraphQLField { - if ( - fieldName === SchemaMetaFieldDef.name && - schema.getQueryType() === parentType - ) { - return SchemaMetaFieldDef; - } else if ( - fieldName === TypeMetaFieldDef.name && - schema.getQueryType() === parentType - ) { - return TypeMetaFieldDef; - } else if (fieldName === TypeNameMetaFieldDef.name) { - return TypeNameMetaFieldDef; - } - return parentType.getFields()[fieldName]; -} diff --git a/node_modules/graphql/execution/execute.mjs b/node_modules/graphql/execution/execute.mjs deleted file mode 100644 index e209dcdb..00000000 --- a/node_modules/graphql/execution/execute.mjs +++ /dev/null @@ -1,847 +0,0 @@ -import arrayFrom from "../polyfills/arrayFrom.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import memoize3 from "../jsutils/memoize3.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import devAssert from "../jsutils/devAssert.mjs"; -import isPromise from "../jsutils/isPromise.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import isCollection from "../jsutils/isCollection.mjs"; -import promiseReduce from "../jsutils/promiseReduce.mjs"; -import promiseForObject from "../jsutils/promiseForObject.mjs"; -import { addPath, pathToArray } from "../jsutils/Path.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { locatedError } from "../error/locatedError.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { assertValidSchema } from "../type/validate.mjs"; -import { SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from "../type/introspection.mjs"; -import { GraphQLIncludeDirective, GraphQLSkipDirective } from "../type/directives.mjs"; -import { isNamedType, isObjectType, isAbstractType, isLeafType, isListType, isNonNullType } from "../type/definition.mjs"; -import { typeFromAST } from "../utilities/typeFromAST.mjs"; -import { getOperationRootType } from "../utilities/getOperationRootType.mjs"; -import { getVariableValues, getArgumentValues, getDirectiveValues } from "./values.mjs"; -/** - * Terminology - * - * "Definitions" are the generic name for top-level statements in the document. - * Examples of this include: - * 1) Operations (such as a query) - * 2) Fragments - * - * "Operations" are a generic name for requests in the document. - * Examples of this include: - * 1) query, - * 2) mutation - * - * "Selections" are the definitions that can appear legally and at - * single level of the query. These include: - * 1) field references e.g "a" - * 2) fragment "spreads" e.g. "...c" - * 3) inline fragment "spreads" e.g. "...on Type { a }" - */ - -/** - * Data that must be available at all points during query execution. - * - * Namely, schema of the type system that is currently executing, - * and the fragments defined in the query document - */ - -export function execute(argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - return arguments.length === 1 ? executeImpl(argsOrSchema) : executeImpl({ - schema: argsOrSchema, - document: document, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - }); -} -/** - * Also implements the "Evaluating requests" section of the GraphQL specification. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ - -export function executeSync(args) { - var result = executeImpl(args); // Assert that the execution was synchronous. - - if (isPromise(result)) { - throw new Error('GraphQL execution failed to complete synchronously.'); - } - - return result; -} - -function executeImpl(args) { - var schema = args.schema, - document = args.document, - rootValue = args.rootValue, - contextValue = args.contextValue, - variableValues = args.variableValues, - operationName = args.operationName, - fieldResolver = args.fieldResolver, - typeResolver = args.typeResolver; // If arguments are missing or incorrect, throw an error. - - assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, - // a "Response" with only errors is returned. - - var exeContext = buildExecutionContext(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Return early errors if execution context failed. - - if (Array.isArray(exeContext)) { - return { - errors: exeContext - }; - } // Return a Promise that will eventually resolve to the data described by - // The "Response" section of the GraphQL specification. - // - // If errors are encountered while executing a GraphQL field, only that - // field and its descendants will be omitted, and sibling fields will still - // be executed. An execution which encounters errors will still result in a - // resolved Promise. - - - var data = executeOperation(exeContext, exeContext.operation, rootValue); - return buildResponse(exeContext, data); -} -/** - * Given a completed execution context and data, build the { errors, data } - * response defined by the "Response" section of the GraphQL specification. - */ - - -function buildResponse(exeContext, data) { - if (isPromise(data)) { - return data.then(function (resolved) { - return buildResponse(exeContext, resolved); - }); - } - - return exeContext.errors.length === 0 ? { - data: data - } : { - errors: exeContext.errors, - data: data - }; -} -/** - * Essential assertions before executing to provide developer feedback for - * improper use of the GraphQL library. - * - * @internal - */ - - -export function assertValidExecutionArguments(schema, document, rawVariableValues) { - document || devAssert(0, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. - - assertValidSchema(schema); // Variables, if provided, must be an object. - - rawVariableValues == null || isObjectLike(rawVariableValues) || devAssert(0, 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.'); -} -/** - * Constructs a ExecutionContext object from the arguments passed to - * execute, which we will pass throughout the other execution methods. - * - * Throws a GraphQLError if a valid execution context cannot be created. - * - * @internal - */ - -export function buildExecutionContext(schema, document, rootValue, contextValue, rawVariableValues, operationName, fieldResolver, typeResolver) { - var _definition$name, _operation$variableDe; - - var operation; - var fragments = Object.create(null); - - for (var _i2 = 0, _document$definitions2 = document.definitions; _i2 < _document$definitions2.length; _i2++) { - var definition = _document$definitions2[_i2]; - - switch (definition.kind) { - case Kind.OPERATION_DEFINITION: - if (operationName == null) { - if (operation !== undefined) { - return [new GraphQLError('Must provide operation name if query contains multiple operations.')]; - } - - operation = definition; - } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { - operation = definition; - } - - break; - - case Kind.FRAGMENT_DEFINITION: - fragments[definition.name.value] = definition; - break; - } - } - - if (!operation) { - if (operationName != null) { - return [new GraphQLError("Unknown operation named \"".concat(operationName, "\"."))]; - } - - return [new GraphQLError('Must provide an operation.')]; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var variableDefinitions = (_operation$variableDe = operation.variableDefinitions) !== null && _operation$variableDe !== void 0 ? _operation$variableDe : []; - var coercedVariableValues = getVariableValues(schema, variableDefinitions, rawVariableValues !== null && rawVariableValues !== void 0 ? rawVariableValues : {}, { - maxErrors: 50 - }); - - if (coercedVariableValues.errors) { - return coercedVariableValues.errors; - } - - return { - schema: schema, - fragments: fragments, - rootValue: rootValue, - contextValue: contextValue, - operation: operation, - variableValues: coercedVariableValues.coerced, - fieldResolver: fieldResolver !== null && fieldResolver !== void 0 ? fieldResolver : defaultFieldResolver, - typeResolver: typeResolver !== null && typeResolver !== void 0 ? typeResolver : defaultTypeResolver, - errors: [] - }; -} -/** - * Implements the "Evaluating operations" section of the spec. - */ - -function executeOperation(exeContext, operation, rootValue) { - var type = getOperationRootType(exeContext.schema, operation); - var fields = collectFields(exeContext, type, operation.selectionSet, Object.create(null), Object.create(null)); - var path = undefined; // Errors from sub-fields of a NonNull type may propagate to the top level, - // at which point we still log the error and null the parent field, which - // in this case is the entire response. - - try { - var result = operation.operation === 'mutation' ? executeFieldsSerially(exeContext, type, rootValue, path, fields) : executeFields(exeContext, type, rootValue, path, fields); - - if (isPromise(result)) { - return result.then(undefined, function (error) { - exeContext.errors.push(error); - return Promise.resolve(null); - }); - } - - return result; - } catch (error) { - exeContext.errors.push(error); - return null; - } -} -/** - * Implements the "Evaluating selection sets" section of the spec - * for "write" mode. - */ - - -function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) { - return promiseReduce(Object.keys(fields), function (results, responseName) { - var fieldNodes = fields[responseName]; - var fieldPath = addPath(path, responseName, parentType.name); - var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); - - if (result === undefined) { - return results; - } - - if (isPromise(result)) { - return result.then(function (resolvedResult) { - results[responseName] = resolvedResult; - return results; - }); - } - - results[responseName] = result; - return results; - }, Object.create(null)); -} -/** - * Implements the "Evaluating selection sets" section of the spec - * for "read" mode. - */ - - -function executeFields(exeContext, parentType, sourceValue, path, fields) { - var results = Object.create(null); - var containsPromise = false; - - for (var _i4 = 0, _Object$keys2 = Object.keys(fields); _i4 < _Object$keys2.length; _i4++) { - var responseName = _Object$keys2[_i4]; - var fieldNodes = fields[responseName]; - var fieldPath = addPath(path, responseName, parentType.name); - var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); - - if (result !== undefined) { - results[responseName] = result; - - if (isPromise(result)) { - containsPromise = true; - } - } - } // If there are no promises, we can just return the object - - - if (!containsPromise) { - return results; - } // Otherwise, results is a map from field name to the result of resolving that - // field, which is possibly a promise. Return a promise that will return this - // same map, but with any promises replaced with the values they resolved to. - - - return promiseForObject(results); -} -/** - * Given a selectionSet, adds all of the fields in that selection to - * the passed in map of fields, and returns it at the end. - * - * CollectFields requires the "runtime type" of an object. For a field which - * returns an Interface or Union type, the "runtime type" will be the actual - * Object type returned by that field. - * - * @internal - */ - - -export function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFragmentNames) { - for (var _i6 = 0, _selectionSet$selecti2 = selectionSet.selections; _i6 < _selectionSet$selecti2.length; _i6++) { - var selection = _selectionSet$selecti2[_i6]; - - switch (selection.kind) { - case Kind.FIELD: - { - if (!shouldIncludeNode(exeContext, selection)) { - continue; - } - - var name = getFieldEntryKey(selection); - - if (!fields[name]) { - fields[name] = []; - } - - fields[name].push(selection); - break; - } - - case Kind.INLINE_FRAGMENT: - { - if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) { - continue; - } - - collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames); - break; - } - - case Kind.FRAGMENT_SPREAD: - { - var fragName = selection.name.value; - - if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) { - continue; - } - - visitedFragmentNames[fragName] = true; - var fragment = exeContext.fragments[fragName]; - - if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) { - continue; - } - - collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames); - break; - } - } - } - - return fields; -} -/** - * Determines if a field should be included based on the @include and @skip - * directives, where @skip has higher precedence than @include. - */ - -function shouldIncludeNode(exeContext, node) { - var skip = getDirectiveValues(GraphQLSkipDirective, node, exeContext.variableValues); - - if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { - return false; - } - - var include = getDirectiveValues(GraphQLIncludeDirective, node, exeContext.variableValues); - - if ((include === null || include === void 0 ? void 0 : include.if) === false) { - return false; - } - - return true; -} -/** - * Determines if a fragment is applicable to the given type. - */ - - -function doesFragmentConditionMatch(exeContext, fragment, type) { - var typeConditionNode = fragment.typeCondition; - - if (!typeConditionNode) { - return true; - } - - var conditionalType = typeFromAST(exeContext.schema, typeConditionNode); - - if (conditionalType === type) { - return true; - } - - if (isAbstractType(conditionalType)) { - return exeContext.schema.isSubType(conditionalType, type); - } - - return false; -} -/** - * Implements the logic to compute the key of a given field's entry - */ - - -function getFieldEntryKey(node) { - return node.alias ? node.alias.value : node.name.value; -} -/** - * Resolves the field on the given source object. In particular, this - * figures out the value that the field returns by calling its resolve function, - * then calls completeValue to complete promises, serialize scalars, or execute - * the sub-selection-set for objects. - */ - - -function resolveField(exeContext, parentType, source, fieldNodes, path) { - var _fieldDef$resolve; - - var fieldNode = fieldNodes[0]; - var fieldName = fieldNode.name.value; - var fieldDef = getFieldDef(exeContext.schema, parentType, fieldName); - - if (!fieldDef) { - return; - } - - var returnType = fieldDef.type; - var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver; - var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal or abrupt (error). - - try { - // Build a JS object of arguments from the field.arguments AST, using the - // variables scope to fulfill any variable references. - // TODO: find a way to memoize, in case this field is within a List type. - var args = getArgumentValues(fieldDef, fieldNodes[0], exeContext.variableValues); // The resolve function's optional third argument is a context value that - // is provided to every resolve function within an execution. It is commonly - // used to represent an authenticated user, or request-specific caches. - - var _contextValue = exeContext.contextValue; - var result = resolveFn(source, args, _contextValue, info); - var completed; - - if (isPromise(result)) { - completed = result.then(function (resolved) { - return completeValue(exeContext, returnType, fieldNodes, info, path, resolved); - }); - } else { - completed = completeValue(exeContext, returnType, fieldNodes, info, path, result); - } - - if (isPromise(completed)) { - // Note: we don't rely on a `catch` method, but we do expect "thenable" - // to take a second callback for the error case. - return completed.then(undefined, function (rawError) { - var error = locatedError(rawError, fieldNodes, pathToArray(path)); - return handleFieldError(error, returnType, exeContext); - }); - } - - return completed; - } catch (rawError) { - var error = locatedError(rawError, fieldNodes, pathToArray(path)); - return handleFieldError(error, returnType, exeContext); - } -} -/** - * @internal - */ - - -export function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { - // The resolve function's optional fourth argument is a collection of - // information about the current execution state. - return { - fieldName: fieldDef.name, - fieldNodes: fieldNodes, - returnType: fieldDef.type, - parentType: parentType, - path: path, - schema: exeContext.schema, - fragments: exeContext.fragments, - rootValue: exeContext.rootValue, - operation: exeContext.operation, - variableValues: exeContext.variableValues - }; -} - -function handleFieldError(error, returnType, exeContext) { - // If the field type is non-nullable, then it is resolved without any - // protection from errors, however it still properly locates the error. - if (isNonNullType(returnType)) { - throw error; - } // Otherwise, error protection is applied, logging the error and resolving - // a null value for this field if one is encountered. - - - exeContext.errors.push(error); - return null; -} -/** - * Implements the instructions for completeValue as defined in the - * "Field entries" section of the spec. - * - * If the field type is Non-Null, then this recursively completes the value - * for the inner type. It throws a field error if that completion returns null, - * as per the "Nullability" section of the spec. - * - * If the field type is a List, then this recursively completes the value - * for the inner type on each item in the list. - * - * If the field type is a Scalar or Enum, ensures the completed value is a legal - * value of the type by calling the `serialize` method of GraphQL type - * definition. - * - * If the field is an abstract type, determine the runtime type of the value - * and then complete based on that type - * - * Otherwise, the field type expects a sub-selection set, and will complete the - * value by evaluating all sub-selections. - */ - - -function completeValue(exeContext, returnType, fieldNodes, info, path, result) { - // If result is an Error, throw a located error. - if (result instanceof Error) { - throw result; - } // If field type is NonNull, complete for inner type, and throw field error - // if result is null. - - - if (isNonNullType(returnType)) { - var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path, result); - - if (completed === null) { - throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, ".")); - } - - return completed; - } // If result value is null or undefined then return null. - - - if (result == null) { - return null; - } // If field type is List, complete each item in the list with the inner type - - - if (isListType(returnType)) { - return completeListValue(exeContext, returnType, fieldNodes, info, path, result); - } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, - // returning null if serialization is not possible. - - - if (isLeafType(returnType)) { - return completeLeafValue(returnType, result); - } // If field type is an abstract type, Interface or Union, determine the - // runtime Object type and complete for that type. - - - if (isAbstractType(returnType)) { - return completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result); - } // If field type is Object, execute and complete all sub-selections. - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isObjectType(returnType)) { - return completeObjectValue(exeContext, returnType, fieldNodes, info, path, result); - } // istanbul ignore next (Not reachable. All possible output types have been considered) - - - false || invariant(0, 'Cannot complete value of unexpected output type: ' + inspect(returnType)); -} -/** - * Complete a list value by completing each item in the list with the - * inner type - */ - - -function completeListValue(exeContext, returnType, fieldNodes, info, path, result) { - if (!isCollection(result)) { - throw new GraphQLError("Expected Iterable, but did not find one for field \"".concat(info.parentType.name, ".").concat(info.fieldName, "\".")); - } // This is specified as a simple map, however we're optimizing the path - // where the list contains no Promises by avoiding creating another Promise. - - - var itemType = returnType.ofType; - var containsPromise = false; - var completedResults = arrayFrom(result, function (item, index) { - // No need to modify the info object containing the path, - // since from here on it is not ever accessed by resolver functions. - var itemPath = addPath(path, index, undefined); - - try { - var completedItem; - - if (isPromise(item)) { - completedItem = item.then(function (resolved) { - return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved); - }); - } else { - completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item); - } - - if (isPromise(completedItem)) { - containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" - // to take a second callback for the error case. - - return completedItem.then(undefined, function (rawError) { - var error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); - return handleFieldError(error, itemType, exeContext); - }); - } - - return completedItem; - } catch (rawError) { - var error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); - return handleFieldError(error, itemType, exeContext); - } - }); - return containsPromise ? Promise.all(completedResults) : completedResults; -} -/** - * Complete a Scalar or Enum by serializing to a valid value, returning - * null if serialization is not possible. - */ - - -function completeLeafValue(returnType, result) { - var serializedResult = returnType.serialize(result); - - if (serializedResult === undefined) { - throw new Error("Expected a value of type \"".concat(inspect(returnType), "\" but ") + "received: ".concat(inspect(result))); - } - - return serializedResult; -} -/** - * Complete a value of an abstract type by determining the runtime object type - * of that value, then complete the value for that type. - */ - - -function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result) { - var _returnType$resolveTy; - - var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver; - var contextValue = exeContext.contextValue; - var runtimeType = resolveTypeFn(result, contextValue, info, returnType); - - if (isPromise(runtimeType)) { - return runtimeType.then(function (resolvedRuntimeType) { - return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result); - }); - } - - return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result); -} - -function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) { - if (runtimeTypeOrName == null) { - throw new GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\". Either the \"").concat(returnType.name, "\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function."), fieldNodes); - } // FIXME: temporary workaround until support for passing object types would be removed in v16.0.0 - - - var runtimeTypeName = isNamedType(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName; - - if (typeof runtimeTypeName !== 'string') { - throw new GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\" with ") + "value ".concat(inspect(result), ", received \"").concat(inspect(runtimeTypeOrName), "\".")); - } - - var runtimeType = exeContext.schema.getType(runtimeTypeName); - - if (runtimeType == null) { - throw new GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a type \"").concat(runtimeTypeName, "\" that does not exist inside schema."), fieldNodes); - } - - if (!isObjectType(runtimeType)) { - throw new GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a non-object type \"").concat(runtimeTypeName, "\"."), fieldNodes); - } - - if (!exeContext.schema.isSubType(returnType, runtimeType)) { - throw new GraphQLError("Runtime Object type \"".concat(runtimeType.name, "\" is not a possible type for \"").concat(returnType.name, "\"."), fieldNodes); - } - - return runtimeType; -} -/** - * Complete an Object value by executing all sub-selections. - */ - - -function completeObjectValue(exeContext, returnType, fieldNodes, info, path, result) { - // If there is an isTypeOf predicate function, call it with the - // current result. If isTypeOf returns false, then raise an error rather - // than continuing execution. - if (returnType.isTypeOf) { - var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); - - if (isPromise(isTypeOf)) { - return isTypeOf.then(function (resolvedIsTypeOf) { - if (!resolvedIsTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - - return collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result); - }); - } - - if (!isTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - } - - return collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result); -} - -function invalidReturnTypeError(returnType, result, fieldNodes) { - return new GraphQLError("Expected value of type \"".concat(returnType.name, "\" but got: ").concat(inspect(result), "."), fieldNodes); -} - -function collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result) { - // Collect sub-fields to execute to complete this value. - var subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); - return executeFields(exeContext, returnType, result, path, subFieldNodes); -} -/** - * A memoized collection of relevant subfields with regard to the return - * type. Memoizing ensures the subfields are not repeatedly calculated, which - * saves overhead when resolving lists of values. - */ - - -var collectSubfields = memoize3(_collectSubfields); - -function _collectSubfields(exeContext, returnType, fieldNodes) { - var subFieldNodes = Object.create(null); - var visitedFragmentNames = Object.create(null); - - for (var _i8 = 0; _i8 < fieldNodes.length; _i8++) { - var node = fieldNodes[_i8]; - - if (node.selectionSet) { - subFieldNodes = collectFields(exeContext, returnType, node.selectionSet, subFieldNodes, visitedFragmentNames); - } - } - - return subFieldNodes; -} -/** - * If a resolveType function is not given, then a default resolve behavior is - * used which attempts two strategies: - * - * First, See if the provided value has a `__typename` field defined, if so, use - * that value as name of the resolved type. - * - * Otherwise, test each possible type for the abstract type by calling - * isTypeOf for the object being coerced, returning the first type that matches. - */ - - -export var defaultTypeResolver = function defaultTypeResolver(value, contextValue, info, abstractType) { - // First, look for `__typename`. - if (isObjectLike(value) && typeof value.__typename === 'string') { - return value.__typename; - } // Otherwise, test each possible type. - - - var possibleTypes = info.schema.getPossibleTypes(abstractType); - var promisedIsTypeOfResults = []; - - for (var i = 0; i < possibleTypes.length; i++) { - var type = possibleTypes[i]; - - if (type.isTypeOf) { - var isTypeOfResult = type.isTypeOf(value, contextValue, info); - - if (isPromise(isTypeOfResult)) { - promisedIsTypeOfResults[i] = isTypeOfResult; - } else if (isTypeOfResult) { - return type.name; - } - } - } - - if (promisedIsTypeOfResults.length) { - return Promise.all(promisedIsTypeOfResults).then(function (isTypeOfResults) { - for (var _i9 = 0; _i9 < isTypeOfResults.length; _i9++) { - if (isTypeOfResults[_i9]) { - return possibleTypes[_i9].name; - } - } - }); - } -}; -/** - * If a resolve function is not given, then a default resolve behavior is used - * which takes the property of the source object of the same name as the field - * and returns it as the result, or if it's a function, returns the result - * of calling that function while passing along args and context value. - */ - -export var defaultFieldResolver = function defaultFieldResolver(source, args, contextValue, info) { - // ensure source is a value for which property access is acceptable. - if (isObjectLike(source) || typeof source === 'function') { - var property = source[info.fieldName]; - - if (typeof property === 'function') { - return source[info.fieldName](args, contextValue, info); - } - - return property; - } -}; -/** - * This method looks up the field on the given type definition. - * It has special casing for the three introspection fields, - * __schema, __type and __typename. __typename is special because - * it can always be queried as a field, even in situations where no - * other fields are allowed, like on a Union. __schema and __type - * could get automatically added to the query type, but that would - * require mutating type definitions, which would cause issues. - * - * @internal - */ - -export function getFieldDef(schema, parentType, fieldName) { - if (fieldName === SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { - return SchemaMetaFieldDef; - } else if (fieldName === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return TypeMetaFieldDef; - } else if (fieldName === TypeNameMetaFieldDef.name) { - return TypeNameMetaFieldDef; - } - - return parentType.getFields()[fieldName]; -} diff --git a/node_modules/graphql/execution/index.d.ts b/node_modules/graphql/execution/index.d.ts deleted file mode 100644 index d70ba3aa..00000000 --- a/node_modules/graphql/execution/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export { pathToArray as responsePathAsArray } from '../jsutils/Path'; - -export { - execute, - executeSync, - defaultFieldResolver, - defaultTypeResolver, - ExecutionArgs, - ExecutionResult, - FormattedExecutionResult, -} from './execute'; - -export { getDirectiveValues } from './values'; diff --git a/node_modules/graphql/execution/index.js b/node_modules/graphql/execution/index.js deleted file mode 100644 index 3d5fe467..00000000 --- a/node_modules/graphql/execution/index.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "responsePathAsArray", { - enumerable: true, - get: function get() { - return _Path.pathToArray; - } -}); -Object.defineProperty(exports, "execute", { - enumerable: true, - get: function get() { - return _execute.execute; - } -}); -Object.defineProperty(exports, "executeSync", { - enumerable: true, - get: function get() { - return _execute.executeSync; - } -}); -Object.defineProperty(exports, "defaultFieldResolver", { - enumerable: true, - get: function get() { - return _execute.defaultFieldResolver; - } -}); -Object.defineProperty(exports, "defaultTypeResolver", { - enumerable: true, - get: function get() { - return _execute.defaultTypeResolver; - } -}); -Object.defineProperty(exports, "getDirectiveValues", { - enumerable: true, - get: function get() { - return _values.getDirectiveValues; - } -}); - -var _Path = require("../jsutils/Path.js"); - -var _execute = require("./execute.js"); - -var _values = require("./values.js"); diff --git a/node_modules/graphql/execution/index.js.flow b/node_modules/graphql/execution/index.js.flow deleted file mode 100644 index c8a2ee19..00000000 --- a/node_modules/graphql/execution/index.js.flow +++ /dev/null @@ -1,17 +0,0 @@ -// @flow strict -export { pathToArray as responsePathAsArray } from '../jsutils/Path'; - -export { - execute, - executeSync, - defaultFieldResolver, - defaultTypeResolver, -} from './execute'; - -export type { - ExecutionArgs, - ExecutionResult, - FormattedExecutionResult, -} from './execute'; - -export { getDirectiveValues } from './values'; diff --git a/node_modules/graphql/execution/index.mjs b/node_modules/graphql/execution/index.mjs deleted file mode 100644 index f8c087d9..00000000 --- a/node_modules/graphql/execution/index.mjs +++ /dev/null @@ -1,3 +0,0 @@ -export { pathToArray as responsePathAsArray } from "../jsutils/Path.mjs"; -export { execute, executeSync, defaultFieldResolver, defaultTypeResolver } from "./execute.mjs"; -export { getDirectiveValues } from "./values.mjs"; diff --git a/node_modules/graphql/execution/values.d.ts b/node_modules/graphql/execution/values.d.ts deleted file mode 100644 index 8b17b548..00000000 --- a/node_modules/graphql/execution/values.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { GraphQLError } from '../error/GraphQLError'; -import { - FieldNode, - DirectiveNode, - VariableDefinitionNode, -} from '../language/ast'; - -import { GraphQLDirective } from '../type/directives'; -import { GraphQLSchema } from '../type/schema'; -import { GraphQLField } from '../type/definition'; - -type CoercedVariableValues = - | { errors: ReadonlyArray; coerced?: never } - | { errors?: never; coerced: { [key: string]: any } }; - -/** - * Prepares an object map of variableValues of the correct type based on the - * provided variable definitions and arbitrary input. If the input cannot be - * parsed to match the variable definitions, a GraphQLError will be thrown. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - */ -export function getVariableValues( - schema: GraphQLSchema, - varDefNodes: ReadonlyArray, - inputs: { [key: string]: any }, - options?: { maxErrors?: number }, -): CoercedVariableValues; - -/** - * Prepares an object map of argument values given a list of argument - * definitions and list of argument AST nodes. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - */ -export function getArgumentValues( - def: GraphQLField | GraphQLDirective, - node: FieldNode | DirectiveNode, - variableValues?: Maybe<{ [key: string]: any }>, -): { [key: string]: any }; - -/** - * Prepares an object map of argument values given a directive definition - * and a AST node which may contain directives. Optionally also accepts a map - * of variable values. - * - * If the directive does not exist on the node, returns undefined. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - */ -export function getDirectiveValues( - directiveDef: GraphQLDirective, - node: { - readonly directives?: ReadonlyArray; - }, - variableValues?: Maybe<{ [key: string]: any }>, -): undefined | { [key: string]: any }; diff --git a/node_modules/graphql/execution/values.js b/node_modules/graphql/execution/values.js deleted file mode 100644 index ac4bba95..00000000 --- a/node_modules/graphql/execution/values.js +++ /dev/null @@ -1,228 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getVariableValues = getVariableValues; -exports.getArgumentValues = getArgumentValues; -exports.getDirectiveValues = getDirectiveValues; - -var _find = _interopRequireDefault(require("../polyfills/find.js")); - -var _keyMap = _interopRequireDefault(require("../jsutils/keyMap.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _printPathArray = _interopRequireDefault(require("../jsutils/printPathArray.js")); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _kinds = require("../language/kinds.js"); - -var _printer = require("../language/printer.js"); - -var _definition = require("../type/definition.js"); - -var _typeFromAST = require("../utilities/typeFromAST.js"); - -var _valueFromAST = require("../utilities/valueFromAST.js"); - -var _coerceInputValue = require("../utilities/coerceInputValue.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Prepares an object map of variableValues of the correct type based on the - * provided variable definitions and arbitrary input. If the input cannot be - * parsed to match the variable definitions, a GraphQLError will be thrown. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - * - * @internal - */ -function getVariableValues(schema, varDefNodes, inputs, options) { - var errors = []; - var maxErrors = options === null || options === void 0 ? void 0 : options.maxErrors; - - try { - var coerced = coerceVariableValues(schema, varDefNodes, inputs, function (error) { - if (maxErrors != null && errors.length >= maxErrors) { - throw new _GraphQLError.GraphQLError('Too many errors processing variables, error limit reached. Execution aborted.'); - } - - errors.push(error); - }); - - if (errors.length === 0) { - return { - coerced: coerced - }; - } - } catch (error) { - errors.push(error); - } - - return { - errors: errors - }; -} - -function coerceVariableValues(schema, varDefNodes, inputs, onError) { - var coercedValues = {}; - - var _loop = function _loop(_i2) { - var varDefNode = varDefNodes[_i2]; - var varName = varDefNode.variable.name.value; - var varType = (0, _typeFromAST.typeFromAST)(schema, varDefNode.type); - - if (!(0, _definition.isInputType)(varType)) { - // Must use input types for variables. This should be caught during - // validation, however is checked again here for safety. - var varTypeStr = (0, _printer.print)(varDefNode.type); - onError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" expected value of type \"").concat(varTypeStr, "\" which cannot be used as an input type."), varDefNode.type)); - return "continue"; - } - - if (!hasOwnProperty(inputs, varName)) { - if (varDefNode.defaultValue) { - coercedValues[varName] = (0, _valueFromAST.valueFromAST)(varDefNode.defaultValue, varType); - } else if ((0, _definition.isNonNullType)(varType)) { - var _varTypeStr = (0, _inspect.default)(varType); - - onError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of required type \"").concat(_varTypeStr, "\" was not provided."), varDefNode)); - } - - return "continue"; - } - - var value = inputs[varName]; - - if (value === null && (0, _definition.isNonNullType)(varType)) { - var _varTypeStr2 = (0, _inspect.default)(varType); - - onError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of non-null type \"").concat(_varTypeStr2, "\" must not be null."), varDefNode)); - return "continue"; - } - - coercedValues[varName] = (0, _coerceInputValue.coerceInputValue)(value, varType, function (path, invalidValue, error) { - var prefix = "Variable \"$".concat(varName, "\" got invalid value ") + (0, _inspect.default)(invalidValue); - - if (path.length > 0) { - prefix += " at \"".concat(varName).concat((0, _printPathArray.default)(path), "\""); - } - - onError(new _GraphQLError.GraphQLError(prefix + '; ' + error.message, varDefNode, undefined, undefined, undefined, error.originalError)); - }); - }; - - for (var _i2 = 0; _i2 < varDefNodes.length; _i2++) { - var _ret = _loop(_i2); - - if (_ret === "continue") continue; - } - - return coercedValues; -} -/** - * Prepares an object map of argument values given a list of argument - * definitions and list of argument AST nodes. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - * - * @internal - */ - - -function getArgumentValues(def, node, variableValues) { - var _node$arguments; - - var coercedValues = {}; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - var argumentNodes = (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 ? _node$arguments : []; - var argNodeMap = (0, _keyMap.default)(argumentNodes, function (arg) { - return arg.name.value; - }); - - for (var _i4 = 0, _def$args2 = def.args; _i4 < _def$args2.length; _i4++) { - var argDef = _def$args2[_i4]; - var name = argDef.name; - var argType = argDef.type; - var argumentNode = argNodeMap[name]; - - if (!argumentNode) { - if (argDef.defaultValue !== undefined) { - coercedValues[name] = argDef.defaultValue; - } else if ((0, _definition.isNonNullType)(argType)) { - throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" of required type \"").concat((0, _inspect.default)(argType), "\" ") + 'was not provided.', node); - } - - continue; - } - - var valueNode = argumentNode.value; - var isNull = valueNode.kind === _kinds.Kind.NULL; - - if (valueNode.kind === _kinds.Kind.VARIABLE) { - var variableName = valueNode.name.value; - - if (variableValues == null || !hasOwnProperty(variableValues, variableName)) { - if (argDef.defaultValue !== undefined) { - coercedValues[name] = argDef.defaultValue; - } else if ((0, _definition.isNonNullType)(argType)) { - throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" of required type \"").concat((0, _inspect.default)(argType), "\" ") + "was provided the variable \"$".concat(variableName, "\" which was not provided a runtime value."), valueNode); - } - - continue; - } - - isNull = variableValues[variableName] == null; - } - - if (isNull && (0, _definition.isNonNullType)(argType)) { - throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" of non-null type \"").concat((0, _inspect.default)(argType), "\" ") + 'must not be null.', valueNode); - } - - var coercedValue = (0, _valueFromAST.valueFromAST)(valueNode, argType, variableValues); - - if (coercedValue === undefined) { - // Note: ValuesOfCorrectTypeRule validation should catch this before - // execution. This is a runtime check to ensure execution does not - // continue with an invalid argument value. - throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" has invalid value ").concat((0, _printer.print)(valueNode), "."), valueNode); - } - - coercedValues[name] = coercedValue; - } - - return coercedValues; -} -/** - * Prepares an object map of argument values given a directive definition - * and a AST node which may contain directives. Optionally also accepts a map - * of variable values. - * - * If the directive does not exist on the node, returns undefined. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - */ - - -function getDirectiveValues(directiveDef, node, variableValues) { - var directiveNode = node.directives && (0, _find.default)(node.directives, function (directive) { - return directive.name.value === directiveDef.name; - }); - - if (directiveNode) { - return getArgumentValues(directiveDef, directiveNode, variableValues); - } -} - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} diff --git a/node_modules/graphql/execution/values.js.flow b/node_modules/graphql/execution/values.js.flow deleted file mode 100644 index ef3e3901..00000000 --- a/node_modules/graphql/execution/values.js.flow +++ /dev/null @@ -1,267 +0,0 @@ -// @flow strict -import find from '../polyfills/find'; - -import type { ObjMap } from '../jsutils/ObjMap'; -import keyMap from '../jsutils/keyMap'; -import inspect from '../jsutils/inspect'; -import printPathArray from '../jsutils/printPathArray'; - -import { GraphQLError } from '../error/GraphQLError'; - -import type { - FieldNode, - DirectiveNode, - VariableDefinitionNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; -import { print } from '../language/printer'; - -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLField } from '../type/definition'; -import type { GraphQLDirective } from '../type/directives'; -import { isInputType, isNonNullType } from '../type/definition'; - -import { typeFromAST } from '../utilities/typeFromAST'; -import { valueFromAST } from '../utilities/valueFromAST'; -import { coerceInputValue } from '../utilities/coerceInputValue'; - -type CoercedVariableValues = - | {| errors: $ReadOnlyArray |} - | {| coerced: { [variable: string]: mixed, ... } |}; - -/** - * Prepares an object map of variableValues of the correct type based on the - * provided variable definitions and arbitrary input. If the input cannot be - * parsed to match the variable definitions, a GraphQLError will be thrown. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - * - * @internal - */ -export function getVariableValues( - schema: GraphQLSchema, - varDefNodes: $ReadOnlyArray, - inputs: { +[variable: string]: mixed, ... }, - options?: {| maxErrors?: number |}, -): CoercedVariableValues { - const errors = []; - const maxErrors = options?.maxErrors; - try { - const coerced = coerceVariableValues( - schema, - varDefNodes, - inputs, - (error) => { - if (maxErrors != null && errors.length >= maxErrors) { - throw new GraphQLError( - 'Too many errors processing variables, error limit reached. Execution aborted.', - ); - } - errors.push(error); - }, - ); - - if (errors.length === 0) { - return { coerced }; - } - } catch (error) { - errors.push(error); - } - - return { errors }; -} - -function coerceVariableValues( - schema: GraphQLSchema, - varDefNodes: $ReadOnlyArray, - inputs: { +[variable: string]: mixed, ... }, - onError: (GraphQLError) => void, -): { [variable: string]: mixed, ... } { - const coercedValues = {}; - for (const varDefNode of varDefNodes) { - const varName = varDefNode.variable.name.value; - const varType = typeFromAST(schema, varDefNode.type); - if (!isInputType(varType)) { - // Must use input types for variables. This should be caught during - // validation, however is checked again here for safety. - const varTypeStr = print(varDefNode.type); - onError( - new GraphQLError( - `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, - varDefNode.type, - ), - ); - continue; - } - - if (!hasOwnProperty(inputs, varName)) { - if (varDefNode.defaultValue) { - coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType); - } else if (isNonNullType(varType)) { - const varTypeStr = inspect(varType); - onError( - new GraphQLError( - `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, - varDefNode, - ), - ); - } - continue; - } - - const value = inputs[varName]; - if (value === null && isNonNullType(varType)) { - const varTypeStr = inspect(varType); - onError( - new GraphQLError( - `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, - varDefNode, - ), - ); - continue; - } - - coercedValues[varName] = coerceInputValue( - value, - varType, - (path, invalidValue, error) => { - let prefix = - `Variable "$${varName}" got invalid value ` + inspect(invalidValue); - if (path.length > 0) { - prefix += ` at "${varName}${printPathArray(path)}"`; - } - onError( - new GraphQLError( - prefix + '; ' + error.message, - varDefNode, - undefined, - undefined, - undefined, - error.originalError, - ), - ); - }, - ); - } - - return coercedValues; -} - -/** - * Prepares an object map of argument values given a list of argument - * definitions and list of argument AST nodes. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - * - * @internal - */ -export function getArgumentValues( - def: GraphQLField | GraphQLDirective, - node: FieldNode | DirectiveNode, - variableValues?: ?ObjMap, -): { [argument: string]: mixed, ... } { - const coercedValues = {}; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argumentNodes = node.arguments ?? []; - const argNodeMap = keyMap(argumentNodes, (arg) => arg.name.value); - - for (const argDef of def.args) { - const name = argDef.name; - const argType = argDef.type; - const argumentNode = argNodeMap[name]; - - if (!argumentNode) { - if (argDef.defaultValue !== undefined) { - coercedValues[name] = argDef.defaultValue; - } else if (isNonNullType(argType)) { - throw new GraphQLError( - `Argument "${name}" of required type "${inspect(argType)}" ` + - 'was not provided.', - node, - ); - } - continue; - } - - const valueNode = argumentNode.value; - let isNull = valueNode.kind === Kind.NULL; - - if (valueNode.kind === Kind.VARIABLE) { - const variableName = valueNode.name.value; - if ( - variableValues == null || - !hasOwnProperty(variableValues, variableName) - ) { - if (argDef.defaultValue !== undefined) { - coercedValues[name] = argDef.defaultValue; - } else if (isNonNullType(argType)) { - throw new GraphQLError( - `Argument "${name}" of required type "${inspect(argType)}" ` + - `was provided the variable "$${variableName}" which was not provided a runtime value.`, - valueNode, - ); - } - continue; - } - isNull = variableValues[variableName] == null; - } - - if (isNull && isNonNullType(argType)) { - throw new GraphQLError( - `Argument "${name}" of non-null type "${inspect(argType)}" ` + - 'must not be null.', - valueNode, - ); - } - - const coercedValue = valueFromAST(valueNode, argType, variableValues); - if (coercedValue === undefined) { - // Note: ValuesOfCorrectTypeRule validation should catch this before - // execution. This is a runtime check to ensure execution does not - // continue with an invalid argument value. - throw new GraphQLError( - `Argument "${name}" has invalid value ${print(valueNode)}.`, - valueNode, - ); - } - coercedValues[name] = coercedValue; - } - return coercedValues; -} - -/** - * Prepares an object map of argument values given a directive definition - * and a AST node which may contain directives. Optionally also accepts a map - * of variable values. - * - * If the directive does not exist on the node, returns undefined. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - */ -export function getDirectiveValues( - directiveDef: GraphQLDirective, - node: { +directives?: $ReadOnlyArray, ... }, - variableValues?: ?ObjMap, -): void | { [argument: string]: mixed, ... } { - const directiveNode = - node.directives && - find( - node.directives, - (directive) => directive.name.value === directiveDef.name, - ); - - if (directiveNode) { - return getArgumentValues(directiveDef, directiveNode, variableValues); - } -} - -function hasOwnProperty(obj: mixed, prop: string): boolean { - return Object.prototype.hasOwnProperty.call(obj, prop); -} diff --git a/node_modules/graphql/execution/values.mjs b/node_modules/graphql/execution/values.mjs deleted file mode 100644 index 485a210d..00000000 --- a/node_modules/graphql/execution/values.mjs +++ /dev/null @@ -1,206 +0,0 @@ -import find from "../polyfills/find.mjs"; -import keyMap from "../jsutils/keyMap.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import printPathArray from "../jsutils/printPathArray.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { print } from "../language/printer.mjs"; -import { isInputType, isNonNullType } from "../type/definition.mjs"; -import { typeFromAST } from "../utilities/typeFromAST.mjs"; -import { valueFromAST } from "../utilities/valueFromAST.mjs"; -import { coerceInputValue } from "../utilities/coerceInputValue.mjs"; - -/** - * Prepares an object map of variableValues of the correct type based on the - * provided variable definitions and arbitrary input. If the input cannot be - * parsed to match the variable definitions, a GraphQLError will be thrown. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - * - * @internal - */ -export function getVariableValues(schema, varDefNodes, inputs, options) { - var errors = []; - var maxErrors = options === null || options === void 0 ? void 0 : options.maxErrors; - - try { - var coerced = coerceVariableValues(schema, varDefNodes, inputs, function (error) { - if (maxErrors != null && errors.length >= maxErrors) { - throw new GraphQLError('Too many errors processing variables, error limit reached. Execution aborted.'); - } - - errors.push(error); - }); - - if (errors.length === 0) { - return { - coerced: coerced - }; - } - } catch (error) { - errors.push(error); - } - - return { - errors: errors - }; -} - -function coerceVariableValues(schema, varDefNodes, inputs, onError) { - var coercedValues = {}; - - var _loop = function _loop(_i2) { - var varDefNode = varDefNodes[_i2]; - var varName = varDefNode.variable.name.value; - var varType = typeFromAST(schema, varDefNode.type); - - if (!isInputType(varType)) { - // Must use input types for variables. This should be caught during - // validation, however is checked again here for safety. - var varTypeStr = print(varDefNode.type); - onError(new GraphQLError("Variable \"$".concat(varName, "\" expected value of type \"").concat(varTypeStr, "\" which cannot be used as an input type."), varDefNode.type)); - return "continue"; - } - - if (!hasOwnProperty(inputs, varName)) { - if (varDefNode.defaultValue) { - coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType); - } else if (isNonNullType(varType)) { - var _varTypeStr = inspect(varType); - - onError(new GraphQLError("Variable \"$".concat(varName, "\" of required type \"").concat(_varTypeStr, "\" was not provided."), varDefNode)); - } - - return "continue"; - } - - var value = inputs[varName]; - - if (value === null && isNonNullType(varType)) { - var _varTypeStr2 = inspect(varType); - - onError(new GraphQLError("Variable \"$".concat(varName, "\" of non-null type \"").concat(_varTypeStr2, "\" must not be null."), varDefNode)); - return "continue"; - } - - coercedValues[varName] = coerceInputValue(value, varType, function (path, invalidValue, error) { - var prefix = "Variable \"$".concat(varName, "\" got invalid value ") + inspect(invalidValue); - - if (path.length > 0) { - prefix += " at \"".concat(varName).concat(printPathArray(path), "\""); - } - - onError(new GraphQLError(prefix + '; ' + error.message, varDefNode, undefined, undefined, undefined, error.originalError)); - }); - }; - - for (var _i2 = 0; _i2 < varDefNodes.length; _i2++) { - var _ret = _loop(_i2); - - if (_ret === "continue") continue; - } - - return coercedValues; -} -/** - * Prepares an object map of argument values given a list of argument - * definitions and list of argument AST nodes. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - * - * @internal - */ - - -export function getArgumentValues(def, node, variableValues) { - var _node$arguments; - - var coercedValues = {}; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - var argumentNodes = (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 ? _node$arguments : []; - var argNodeMap = keyMap(argumentNodes, function (arg) { - return arg.name.value; - }); - - for (var _i4 = 0, _def$args2 = def.args; _i4 < _def$args2.length; _i4++) { - var argDef = _def$args2[_i4]; - var name = argDef.name; - var argType = argDef.type; - var argumentNode = argNodeMap[name]; - - if (!argumentNode) { - if (argDef.defaultValue !== undefined) { - coercedValues[name] = argDef.defaultValue; - } else if (isNonNullType(argType)) { - throw new GraphQLError("Argument \"".concat(name, "\" of required type \"").concat(inspect(argType), "\" ") + 'was not provided.', node); - } - - continue; - } - - var valueNode = argumentNode.value; - var isNull = valueNode.kind === Kind.NULL; - - if (valueNode.kind === Kind.VARIABLE) { - var variableName = valueNode.name.value; - - if (variableValues == null || !hasOwnProperty(variableValues, variableName)) { - if (argDef.defaultValue !== undefined) { - coercedValues[name] = argDef.defaultValue; - } else if (isNonNullType(argType)) { - throw new GraphQLError("Argument \"".concat(name, "\" of required type \"").concat(inspect(argType), "\" ") + "was provided the variable \"$".concat(variableName, "\" which was not provided a runtime value."), valueNode); - } - - continue; - } - - isNull = variableValues[variableName] == null; - } - - if (isNull && isNonNullType(argType)) { - throw new GraphQLError("Argument \"".concat(name, "\" of non-null type \"").concat(inspect(argType), "\" ") + 'must not be null.', valueNode); - } - - var coercedValue = valueFromAST(valueNode, argType, variableValues); - - if (coercedValue === undefined) { - // Note: ValuesOfCorrectTypeRule validation should catch this before - // execution. This is a runtime check to ensure execution does not - // continue with an invalid argument value. - throw new GraphQLError("Argument \"".concat(name, "\" has invalid value ").concat(print(valueNode), "."), valueNode); - } - - coercedValues[name] = coercedValue; - } - - return coercedValues; -} -/** - * Prepares an object map of argument values given a directive definition - * and a AST node which may contain directives. Optionally also accepts a map - * of variable values. - * - * If the directive does not exist on the node, returns undefined. - * - * Note: The returned value is a plain Object with a prototype, since it is - * exposed to user code. Care should be taken to not pull values from the - * Object prototype. - */ - -export function getDirectiveValues(directiveDef, node, variableValues) { - var directiveNode = node.directives && find(node.directives, function (directive) { - return directive.name.value === directiveDef.name; - }); - - if (directiveNode) { - return getArgumentValues(directiveDef, directiveNode, variableValues); - } -} - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} diff --git a/node_modules/graphql/graphql.d.ts b/node_modules/graphql/graphql.d.ts deleted file mode 100644 index 8ba8ef72..00000000 --- a/node_modules/graphql/graphql.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Maybe } from './jsutils/Maybe'; - -import { Source } from './language/source'; -import { GraphQLSchema } from './type/schema'; -import { GraphQLFieldResolver, GraphQLTypeResolver } from './type/definition'; -import { ExecutionResult } from './execution/execute'; - -/** - * This is the primary entry point function for fulfilling GraphQL operations - * by parsing, validating, and executing a GraphQL document along side a - * GraphQL schema. - * - * More sophisticated GraphQL servers, such as those which persist queries, - * may wish to separate the validation and execution phases to a static time - * tooling step, and a server runtime step. - * - * Accepts either an object with named arguments, or individual arguments: - * - * schema: - * The GraphQL type system to use when validating and executing a query. - * source: - * A GraphQL language formatted string representing the requested operation. - * rootValue: - * The value provided as the first argument to resolver functions on the top - * level type (e.g. the query object type). - * contextValue: - * The context value is provided as an argument to resolver functions after - * field arguments. It is used to pass shared information useful at any point - * during executing this query, for example the currently logged in user and - * connections to databases or other services. - * variableValues: - * A mapping of variable name to runtime value to use for all variables - * defined in the requestString. - * operationName: - * The name of the operation to use if requestString contains multiple - * possible operations. Can be omitted if requestString contains only - * one operation. - * fieldResolver: - * A resolver function to use when one is not provided by the schema. - * If not provided, the default field resolver is used (which looks for a - * value or method on the source value with the field's name). - */ -export interface GraphQLArgs { - schema: GraphQLSchema; - source: string | Source; - rootValue?: any; - contextValue?: any; - variableValues?: Maybe<{ [key: string]: any }>; - operationName?: Maybe; - fieldResolver?: Maybe>; - typeResolver?: Maybe>; -} - -export function graphql(args: GraphQLArgs): Promise; -export function graphql( - schema: GraphQLSchema, - source: Source | string, - rootValue?: any, - contextValue?: any, - variableValues?: Maybe<{ [key: string]: any }>, - operationName?: Maybe, - fieldResolver?: Maybe>, - typeResolver?: Maybe>, -): Promise; - -/** - * The graphqlSync function also fulfills GraphQL operations by parsing, - * validating, and executing a GraphQL document along side a GraphQL schema. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ -export function graphqlSync(args: GraphQLArgs): ExecutionResult; -export function graphqlSync( - schema: GraphQLSchema, - source: Source | string, - rootValue?: any, - contextValue?: any, - variableValues?: Maybe<{ [key: string]: any }>, - operationName?: Maybe, - fieldResolver?: Maybe>, - typeResolver?: Maybe>, -): ExecutionResult; diff --git a/node_modules/graphql/graphql.js b/node_modules/graphql/graphql.js deleted file mode 100644 index f5f4b1d7..00000000 --- a/node_modules/graphql/graphql.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.graphql = graphql; -exports.graphqlSync = graphqlSync; - -var _isPromise = _interopRequireDefault(require("./jsutils/isPromise.js")); - -var _parser = require("./language/parser.js"); - -var _validate = require("./validation/validate.js"); - -var _validate2 = require("./type/validate.js"); - -var _execute = require("./execution/execute.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - var _arguments = arguments; - - /* eslint-enable no-redeclare */ - // Always return a Promise for a consistent API. - return new Promise(function (resolve) { - return resolve( // Extract arguments from object args if provided. - _arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ - schema: argsOrSchema, - source: source, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - })); - }); -} -/** - * The graphqlSync function also fulfills GraphQL operations by parsing, - * validating, and executing a GraphQL document along side a GraphQL schema. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ - - -function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - var result = arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ - schema: argsOrSchema, - source: source, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - }); // Assert that the execution was synchronous. - - if ((0, _isPromise.default)(result)) { - throw new Error('GraphQL execution failed to complete synchronously.'); - } - - return result; -} - -function graphqlImpl(args) { - var schema = args.schema, - source = args.source, - rootValue = args.rootValue, - contextValue = args.contextValue, - variableValues = args.variableValues, - operationName = args.operationName, - fieldResolver = args.fieldResolver, - typeResolver = args.typeResolver; // Validate Schema - - var schemaValidationErrors = (0, _validate2.validateSchema)(schema); - - if (schemaValidationErrors.length > 0) { - return { - errors: schemaValidationErrors - }; - } // Parse - - - var document; - - try { - document = (0, _parser.parse)(source); - } catch (syntaxError) { - return { - errors: [syntaxError] - }; - } // Validate - - - var validationErrors = (0, _validate.validate)(schema, document); - - if (validationErrors.length > 0) { - return { - errors: validationErrors - }; - } // Execute - - - return (0, _execute.execute)({ - schema: schema, - document: document, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - }); -} diff --git a/node_modules/graphql/graphql.js.flow b/node_modules/graphql/graphql.js.flow deleted file mode 100644 index cc24308b..00000000 --- a/node_modules/graphql/graphql.js.flow +++ /dev/null @@ -1,207 +0,0 @@ -// @flow strict -import type { PromiseOrValue } from './jsutils/PromiseOrValue'; -import isPromise from './jsutils/isPromise'; - -import type { Source } from './language/source'; -import { parse } from './language/parser'; - -import { validate } from './validation/validate'; - -import type { - GraphQLFieldResolver, - GraphQLTypeResolver, -} from './type/definition'; -import type { GraphQLSchema } from './type/schema'; -import { validateSchema } from './type/validate'; - -import type { ExecutionResult } from './execution/execute'; -import { execute } from './execution/execute'; - -/** - * This is the primary entry point function for fulfilling GraphQL operations - * by parsing, validating, and executing a GraphQL document along side a - * GraphQL schema. - * - * More sophisticated GraphQL servers, such as those which persist queries, - * may wish to separate the validation and execution phases to a static time - * tooling step, and a server runtime step. - * - * Accepts either an object with named arguments, or individual arguments: - * - * schema: - * The GraphQL type system to use when validating and executing a query. - * source: - * A GraphQL language formatted string representing the requested operation. - * rootValue: - * The value provided as the first argument to resolver functions on the top - * level type (e.g. the query object type). - * contextValue: - * The context value is provided as an argument to resolver functions after - * field arguments. It is used to pass shared information useful at any point - * during executing this query, for example the currently logged in user and - * connections to databases or other services. - * variableValues: - * A mapping of variable name to runtime value to use for all variables - * defined in the requestString. - * operationName: - * The name of the operation to use if requestString contains multiple - * possible operations. Can be omitted if requestString contains only - * one operation. - * fieldResolver: - * A resolver function to use when one is not provided by the schema. - * If not provided, the default field resolver is used (which looks for a - * value or method on the source value with the field's name). - * typeResolver: - * A type resolver function to use when none is provided by the schema. - * If not provided, the default type resolver is used (which looks for a - * `__typename` field or alternatively calls the `isTypeOf` method). - */ -export type GraphQLArgs = {| - schema: GraphQLSchema, - source: string | Source, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, - typeResolver?: ?GraphQLTypeResolver, -|}; -declare function graphql(GraphQLArgs, ..._: []): Promise; -/* eslint-disable no-redeclare */ -declare function graphql( - schema: GraphQLSchema, - source: Source | string, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, - typeResolver?: ?GraphQLTypeResolver, -): Promise; -export function graphql( - argsOrSchema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, -) { - /* eslint-enable no-redeclare */ - // Always return a Promise for a consistent API. - return new Promise((resolve) => - resolve( - // Extract arguments from object args if provided. - arguments.length === 1 - ? graphqlImpl(argsOrSchema) - : graphqlImpl({ - schema: argsOrSchema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, - }), - ), - ); -} - -/** - * The graphqlSync function also fulfills GraphQL operations by parsing, - * validating, and executing a GraphQL document along side a GraphQL schema. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ -declare function graphqlSync(GraphQLArgs, ..._: []): ExecutionResult; -/* eslint-disable no-redeclare */ -declare function graphqlSync( - schema: GraphQLSchema, - source: Source | string, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, - typeResolver?: ?GraphQLTypeResolver, -): ExecutionResult; -export function graphqlSync( - argsOrSchema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, -) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - const result = - arguments.length === 1 - ? graphqlImpl(argsOrSchema) - : graphqlImpl({ - schema: argsOrSchema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, - }); - - // Assert that the execution was synchronous. - if (isPromise(result)) { - throw new Error('GraphQL execution failed to complete synchronously.'); - } - - return result; -} - -function graphqlImpl(args: GraphQLArgs): PromiseOrValue { - const { - schema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, - } = args; - - // Validate Schema - const schemaValidationErrors = validateSchema(schema); - if (schemaValidationErrors.length > 0) { - return { errors: schemaValidationErrors }; - } - - // Parse - let document; - try { - document = parse(source); - } catch (syntaxError) { - return { errors: [syntaxError] }; - } - - // Validate - const validationErrors = validate(schema, document); - if (validationErrors.length > 0) { - return { errors: validationErrors }; - } - - // Execute - return execute({ - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver, - }); -} diff --git a/node_modules/graphql/graphql.mjs b/node_modules/graphql/graphql.mjs deleted file mode 100644 index aa3cb91c..00000000 --- a/node_modules/graphql/graphql.mjs +++ /dev/null @@ -1,142 +0,0 @@ -import isPromise from "./jsutils/isPromise.mjs"; -import { parse } from "./language/parser.mjs"; -import { validate } from "./validation/validate.mjs"; -import { validateSchema } from "./type/validate.mjs"; -import { execute } from "./execution/execute.mjs"; -/** - * This is the primary entry point function for fulfilling GraphQL operations - * by parsing, validating, and executing a GraphQL document along side a - * GraphQL schema. - * - * More sophisticated GraphQL servers, such as those which persist queries, - * may wish to separate the validation and execution phases to a static time - * tooling step, and a server runtime step. - * - * Accepts either an object with named arguments, or individual arguments: - * - * schema: - * The GraphQL type system to use when validating and executing a query. - * source: - * A GraphQL language formatted string representing the requested operation. - * rootValue: - * The value provided as the first argument to resolver functions on the top - * level type (e.g. the query object type). - * contextValue: - * The context value is provided as an argument to resolver functions after - * field arguments. It is used to pass shared information useful at any point - * during executing this query, for example the currently logged in user and - * connections to databases or other services. - * variableValues: - * A mapping of variable name to runtime value to use for all variables - * defined in the requestString. - * operationName: - * The name of the operation to use if requestString contains multiple - * possible operations. Can be omitted if requestString contains only - * one operation. - * fieldResolver: - * A resolver function to use when one is not provided by the schema. - * If not provided, the default field resolver is used (which looks for a - * value or method on the source value with the field's name). - * typeResolver: - * A type resolver function to use when none is provided by the schema. - * If not provided, the default type resolver is used (which looks for a - * `__typename` field or alternatively calls the `isTypeOf` method). - */ - -export function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - var _arguments = arguments; - - /* eslint-enable no-redeclare */ - // Always return a Promise for a consistent API. - return new Promise(function (resolve) { - return resolve( // Extract arguments from object args if provided. - _arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ - schema: argsOrSchema, - source: source, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - })); - }); -} -/** - * The graphqlSync function also fulfills GraphQL operations by parsing, - * validating, and executing a GraphQL document along side a GraphQL schema. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ - -export function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - var result = arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ - schema: argsOrSchema, - source: source, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - }); // Assert that the execution was synchronous. - - if (isPromise(result)) { - throw new Error('GraphQL execution failed to complete synchronously.'); - } - - return result; -} - -function graphqlImpl(args) { - var schema = args.schema, - source = args.source, - rootValue = args.rootValue, - contextValue = args.contextValue, - variableValues = args.variableValues, - operationName = args.operationName, - fieldResolver = args.fieldResolver, - typeResolver = args.typeResolver; // Validate Schema - - var schemaValidationErrors = validateSchema(schema); - - if (schemaValidationErrors.length > 0) { - return { - errors: schemaValidationErrors - }; - } // Parse - - - var document; - - try { - document = parse(source); - } catch (syntaxError) { - return { - errors: [syntaxError] - }; - } // Validate - - - var validationErrors = validate(schema, document); - - if (validationErrors.length > 0) { - return { - errors: validationErrors - }; - } // Execute - - - return execute({ - schema: schema, - document: document, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - typeResolver: typeResolver - }); -} diff --git a/node_modules/graphql/index.d.ts b/node_modules/graphql/index.d.ts deleted file mode 100644 index 0776078b..00000000 --- a/node_modules/graphql/index.d.ts +++ /dev/null @@ -1,465 +0,0 @@ -// Minimum TypeScript Version: 2.6 - -/** - * GraphQL.js provides a reference implementation for the GraphQL specification - * but is also a useful utility for operating on GraphQL files and building - * sophisticated tools. - * - * This primary module exports a general purpose function for fulfilling all - * steps of the GraphQL specification in a single operation, but also includes - * utilities for every part of the GraphQL specification: - * - * - Parsing the GraphQL language. - * - Building a GraphQL type schema. - * - Validating a GraphQL request against a type schema. - * - Executing a GraphQL request against a type schema. - * - * This also includes utility functions for operating on GraphQL types and - * GraphQL documents to facilitate building tools. - * - * You may also import from each sub-directory directly. For example, the - * following two import statements are equivalent: - * - * import { parse } from 'graphql'; - * import { parse } from 'graphql/language'; - */ - -// The GraphQL.js version info. -export { version, versionInfo } from './version'; - -// The primary entry point into fulfilling a GraphQL request. -export { GraphQLArgs, graphql, graphqlSync } from './graphql'; - -// Create and operate on GraphQL type definitions and schema. -export { - // Definitions - GraphQLSchema, - GraphQLDirective, - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, - // Standard GraphQL Scalars - specifiedScalarTypes, - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, - // Built-in Directives defined by the Spec - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - GraphQLSpecifiedByDirective, - // "Enum" of Type Kinds - TypeKind, - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, - // GraphQL Types for introspection. - introspectionTypes, - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, - // Predicates - isSchema, - isDirective, - isType, - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, - isListType, - isNonNullType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - isWrappingType, - isNullableType, - isNamedType, - isRequiredArgument, - isRequiredInputField, - isSpecifiedScalarType, - isIntrospectionType, - isSpecifiedDirective, - // Assertions - assertSchema, - assertDirective, - assertType, - assertScalarType, - assertObjectType, - assertInterfaceType, - assertUnionType, - assertEnumType, - assertInputObjectType, - assertListType, - assertNonNullType, - assertInputType, - assertOutputType, - assertLeafType, - assertCompositeType, - assertAbstractType, - assertWrappingType, - assertNullableType, - assertNamedType, - // Un-modifiers - getNullableType, - getNamedType, - // Validate GraphQL schema. - validateSchema, - assertValidSchema, -} from './type/index'; - -export { - GraphQLType, - GraphQLInputType, - GraphQLOutputType, - GraphQLLeafType, - GraphQLCompositeType, - GraphQLAbstractType, - GraphQLWrappingType, - GraphQLNullableType, - GraphQLNamedType, - Thunk, - GraphQLSchemaConfig, - GraphQLSchemaExtensions, - GraphQLDirectiveConfig, - GraphQLDirectiveExtensions, - GraphQLArgument, - GraphQLArgumentConfig, - GraphQLArgumentExtensions, - GraphQLEnumTypeConfig, - GraphQLEnumTypeExtensions, - GraphQLEnumValue, - GraphQLEnumValueConfig, - GraphQLEnumValueExtensions, - GraphQLEnumValueConfigMap, - GraphQLField, - GraphQLFieldConfig, - GraphQLFieldExtensions, - GraphQLFieldConfigArgumentMap, - GraphQLFieldConfigMap, - GraphQLFieldMap, - GraphQLFieldResolver, - GraphQLInputField, - GraphQLInputFieldConfig, - GraphQLInputFieldExtensions, - GraphQLInputFieldConfigMap, - GraphQLInputFieldMap, - GraphQLInputObjectTypeConfig, - GraphQLInputObjectTypeExtensions, - GraphQLInterfaceTypeConfig, - GraphQLInterfaceTypeExtensions, - GraphQLIsTypeOfFn, - GraphQLObjectTypeConfig, - GraphQLObjectTypeExtensions, - GraphQLResolveInfo, - ResponsePath, - GraphQLScalarTypeConfig, - GraphQLScalarTypeExtensions, - GraphQLTypeResolver, - GraphQLUnionTypeConfig, - GraphQLUnionTypeExtensions, - GraphQLScalarSerializer, - GraphQLScalarValueParser, - GraphQLScalarLiteralParser, -} from './type/index'; - -// Parse and operate on GraphQL language source files. -export { - Token, - Source, - Location, - getLocation, - // Print source location - printLocation, - printSourceLocation, - // Lex - Lexer, - TokenKind, - // Parse - parse, - parseValue, - parseType, - // Print - print, - // Visit - visit, - visitInParallel, - getVisitFn, - BREAK, - Kind, - DirectiveLocation, - // Predicates - isDefinitionNode, - isExecutableDefinitionNode, - isSelectionNode, - isValueNode, - isTypeNode, - isTypeSystemDefinitionNode, - isTypeDefinitionNode, - isTypeSystemExtensionNode, - isTypeExtensionNode, -} from './language/index'; - -export { - ParseOptions, - SourceLocation, - TokenKindEnum, - KindEnum, - DirectiveLocationEnum, - // Visitor utilities - ASTVisitor, - Visitor, - VisitFn, - VisitorKeyMap, - // AST nodes - ASTNode, - ASTKindToNode, - // Each kind of AST node - NameNode, - DocumentNode, - DefinitionNode, - ExecutableDefinitionNode, - OperationDefinitionNode, - OperationTypeNode, - VariableDefinitionNode, - VariableNode, - SelectionSetNode, - SelectionNode, - FieldNode, - ArgumentNode, - FragmentSpreadNode, - InlineFragmentNode, - FragmentDefinitionNode, - ValueNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - NullValueNode, - EnumValueNode, - ListValueNode, - ObjectValueNode, - ObjectFieldNode, - DirectiveNode, - TypeNode, - NamedTypeNode, - ListTypeNode, - NonNullTypeNode, - TypeSystemDefinitionNode, - SchemaDefinitionNode, - OperationTypeDefinitionNode, - TypeDefinitionNode, - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - DirectiveDefinitionNode, - TypeSystemExtensionNode, - SchemaExtensionNode, - TypeExtensionNode, - ScalarTypeExtensionNode, - ObjectTypeExtensionNode, - InterfaceTypeExtensionNode, - UnionTypeExtensionNode, - EnumTypeExtensionNode, - InputObjectTypeExtensionNode, -} from './language/index'; - -// Execute GraphQL queries. -export { - execute, - executeSync, - defaultFieldResolver, - defaultTypeResolver, - responsePathAsArray, - getDirectiveValues, - ExecutionArgs, - ExecutionResult, - FormattedExecutionResult, -} from './execution/index'; - -export { - subscribe, - createSourceEventStream, - SubscriptionArgs, -} from './subscription/index'; - -// Validate GraphQL documents. -export { - validate, - ValidationContext, - // All validation rules in the GraphQL Specification. - specifiedRules, - // Individual validation rules. - ExecutableDefinitionsRule, - FieldsOnCorrectTypeRule, - FragmentsOnCompositeTypesRule, - KnownArgumentNamesRule, - KnownDirectivesRule, - KnownFragmentNamesRule, - KnownTypeNamesRule, - LoneAnonymousOperationRule, - NoFragmentCyclesRule, - NoUndefinedVariablesRule, - NoUnusedFragmentsRule, - NoUnusedVariablesRule, - OverlappingFieldsCanBeMergedRule, - PossibleFragmentSpreadsRule, - ProvidedRequiredArgumentsRule, - ScalarLeafsRule, - SingleFieldSubscriptionsRule, - UniqueArgumentNamesRule, - UniqueDirectivesPerLocationRule, - UniqueFragmentNamesRule, - UniqueInputFieldNamesRule, - UniqueOperationNamesRule, - UniqueVariableNamesRule, - ValuesOfCorrectTypeRule, - VariablesAreInputTypesRule, - VariablesInAllowedPositionRule, - // SDL-specific validation rules - LoneSchemaDefinitionRule, - UniqueOperationTypesRule, - UniqueTypeNamesRule, - UniqueEnumValueNamesRule, - UniqueFieldDefinitionNamesRule, - UniqueDirectiveNamesRule, - PossibleTypeExtensionsRule, - // Custom validation rules - NoDeprecatedCustomRule, - NoSchemaIntrospectionCustomRule, - ValidationRule, -} from './validation/index'; - -// Create, format, and print GraphQL errors. -export { - GraphQLError, - syntaxError, - locatedError, - printError, - formatError, - GraphQLFormattedError, -} from './error/index'; - -// Utilities for operating on GraphQL type schema and parsed sources. -export { - // Produce the GraphQL query recommended for a full schema introspection. - // Accepts optional IntrospectionOptions. - getIntrospectionQuery, - // Gets the target Operation from a Document. - getOperationAST, - // Gets the Type for the target Operation AST. - getOperationRootType, - // Convert a GraphQLSchema to an IntrospectionQuery. - introspectionFromSchema, - // Build a GraphQLSchema from an introspection result. - buildClientSchema, - // Build a GraphQLSchema from a parsed GraphQL Schema language AST. - buildASTSchema, - // Build a GraphQLSchema from a GraphQL schema language document. - buildSchema, - // @deprecated: Get the description from a schema AST node and supports legacy - // syntax for specifying descriptions - will be removed in v16. - getDescription, - // Extends an existing GraphQLSchema from a parsed GraphQL Schema - // language AST. - extendSchema, - // Sort a GraphQLSchema. - lexicographicSortSchema, - // Print a GraphQLSchema to GraphQL Schema language. - printSchema, - // Print a GraphQLType to GraphQL Schema language. - printType, - // Prints the built-in introspection schema in the Schema Language - // format. - printIntrospectionSchema, - // Create a GraphQLType from a GraphQL language AST. - typeFromAST, - // Create a JavaScript value from a GraphQL language AST with a Type. - valueFromAST, - // Create a JavaScript value from a GraphQL language AST without a Type. - valueFromASTUntyped, - // Create a GraphQL language AST from a JavaScript value. - astFromValue, - // A helper to use within recursive-descent visitors which need to be aware of - // the GraphQL type system. - TypeInfo, - visitWithTypeInfo, - // Coerces a JavaScript value to a GraphQL type, or produces errors. - coerceInputValue, - // Concatenates multiple AST together. - concatAST, - // Separates an AST into an AST per Operation. - separateOperations, - // Strips characters that are not significant to the validity or execution - // of a GraphQL document. - stripIgnoredCharacters, - // Comparators for types - isEqualType, - isTypeSubTypeOf, - doTypesOverlap, - // Asserts a string is a valid GraphQL name. - assertValidName, - // Determine if a string is a valid GraphQL name. - isValidNameError, - // Compares two GraphQLSchemas and detects breaking changes. - BreakingChangeType, - DangerousChangeType, - findBreakingChanges, - findDangerousChanges, - // @deprecated: Report all deprecated usage within a GraphQL document. - findDeprecatedUsages, -} from './utilities/index'; - -export { - IntrospectionOptions, - IntrospectionQuery, - IntrospectionSchema, - IntrospectionType, - IntrospectionInputType, - IntrospectionOutputType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionInputTypeRef, - IntrospectionOutputTypeRef, - IntrospectionNamedTypeRef, - IntrospectionListTypeRef, - IntrospectionNonNullTypeRef, - IntrospectionField, - IntrospectionInputValue, - IntrospectionEnumValue, - IntrospectionDirective, - BuildSchemaOptions, - BreakingChange, - DangerousChange, - TypedQueryDocumentNode, -} from './utilities/index'; diff --git a/node_modules/graphql/index.js b/node_modules/graphql/index.js deleted file mode 100644 index 88221488..00000000 --- a/node_modules/graphql/index.js +++ /dev/null @@ -1,1205 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "version", { - enumerable: true, - get: function get() { - return _version.version; - } -}); -Object.defineProperty(exports, "versionInfo", { - enumerable: true, - get: function get() { - return _version.versionInfo; - } -}); -Object.defineProperty(exports, "graphql", { - enumerable: true, - get: function get() { - return _graphql.graphql; - } -}); -Object.defineProperty(exports, "graphqlSync", { - enumerable: true, - get: function get() { - return _graphql.graphqlSync; - } -}); -Object.defineProperty(exports, "GraphQLSchema", { - enumerable: true, - get: function get() { - return _index.GraphQLSchema; - } -}); -Object.defineProperty(exports, "GraphQLDirective", { - enumerable: true, - get: function get() { - return _index.GraphQLDirective; - } -}); -Object.defineProperty(exports, "GraphQLScalarType", { - enumerable: true, - get: function get() { - return _index.GraphQLScalarType; - } -}); -Object.defineProperty(exports, "GraphQLObjectType", { - enumerable: true, - get: function get() { - return _index.GraphQLObjectType; - } -}); -Object.defineProperty(exports, "GraphQLInterfaceType", { - enumerable: true, - get: function get() { - return _index.GraphQLInterfaceType; - } -}); -Object.defineProperty(exports, "GraphQLUnionType", { - enumerable: true, - get: function get() { - return _index.GraphQLUnionType; - } -}); -Object.defineProperty(exports, "GraphQLEnumType", { - enumerable: true, - get: function get() { - return _index.GraphQLEnumType; - } -}); -Object.defineProperty(exports, "GraphQLInputObjectType", { - enumerable: true, - get: function get() { - return _index.GraphQLInputObjectType; - } -}); -Object.defineProperty(exports, "GraphQLList", { - enumerable: true, - get: function get() { - return _index.GraphQLList; - } -}); -Object.defineProperty(exports, "GraphQLNonNull", { - enumerable: true, - get: function get() { - return _index.GraphQLNonNull; - } -}); -Object.defineProperty(exports, "specifiedScalarTypes", { - enumerable: true, - get: function get() { - return _index.specifiedScalarTypes; - } -}); -Object.defineProperty(exports, "GraphQLInt", { - enumerable: true, - get: function get() { - return _index.GraphQLInt; - } -}); -Object.defineProperty(exports, "GraphQLFloat", { - enumerable: true, - get: function get() { - return _index.GraphQLFloat; - } -}); -Object.defineProperty(exports, "GraphQLString", { - enumerable: true, - get: function get() { - return _index.GraphQLString; - } -}); -Object.defineProperty(exports, "GraphQLBoolean", { - enumerable: true, - get: function get() { - return _index.GraphQLBoolean; - } -}); -Object.defineProperty(exports, "GraphQLID", { - enumerable: true, - get: function get() { - return _index.GraphQLID; - } -}); -Object.defineProperty(exports, "specifiedDirectives", { - enumerable: true, - get: function get() { - return _index.specifiedDirectives; - } -}); -Object.defineProperty(exports, "GraphQLIncludeDirective", { - enumerable: true, - get: function get() { - return _index.GraphQLIncludeDirective; - } -}); -Object.defineProperty(exports, "GraphQLSkipDirective", { - enumerable: true, - get: function get() { - return _index.GraphQLSkipDirective; - } -}); -Object.defineProperty(exports, "GraphQLDeprecatedDirective", { - enumerable: true, - get: function get() { - return _index.GraphQLDeprecatedDirective; - } -}); -Object.defineProperty(exports, "GraphQLSpecifiedByDirective", { - enumerable: true, - get: function get() { - return _index.GraphQLSpecifiedByDirective; - } -}); -Object.defineProperty(exports, "TypeKind", { - enumerable: true, - get: function get() { - return _index.TypeKind; - } -}); -Object.defineProperty(exports, "DEFAULT_DEPRECATION_REASON", { - enumerable: true, - get: function get() { - return _index.DEFAULT_DEPRECATION_REASON; - } -}); -Object.defineProperty(exports, "introspectionTypes", { - enumerable: true, - get: function get() { - return _index.introspectionTypes; - } -}); -Object.defineProperty(exports, "__Schema", { - enumerable: true, - get: function get() { - return _index.__Schema; - } -}); -Object.defineProperty(exports, "__Directive", { - enumerable: true, - get: function get() { - return _index.__Directive; - } -}); -Object.defineProperty(exports, "__DirectiveLocation", { - enumerable: true, - get: function get() { - return _index.__DirectiveLocation; - } -}); -Object.defineProperty(exports, "__Type", { - enumerable: true, - get: function get() { - return _index.__Type; - } -}); -Object.defineProperty(exports, "__Field", { - enumerable: true, - get: function get() { - return _index.__Field; - } -}); -Object.defineProperty(exports, "__InputValue", { - enumerable: true, - get: function get() { - return _index.__InputValue; - } -}); -Object.defineProperty(exports, "__EnumValue", { - enumerable: true, - get: function get() { - return _index.__EnumValue; - } -}); -Object.defineProperty(exports, "__TypeKind", { - enumerable: true, - get: function get() { - return _index.__TypeKind; - } -}); -Object.defineProperty(exports, "SchemaMetaFieldDef", { - enumerable: true, - get: function get() { - return _index.SchemaMetaFieldDef; - } -}); -Object.defineProperty(exports, "TypeMetaFieldDef", { - enumerable: true, - get: function get() { - return _index.TypeMetaFieldDef; - } -}); -Object.defineProperty(exports, "TypeNameMetaFieldDef", { - enumerable: true, - get: function get() { - return _index.TypeNameMetaFieldDef; - } -}); -Object.defineProperty(exports, "isSchema", { - enumerable: true, - get: function get() { - return _index.isSchema; - } -}); -Object.defineProperty(exports, "isDirective", { - enumerable: true, - get: function get() { - return _index.isDirective; - } -}); -Object.defineProperty(exports, "isType", { - enumerable: true, - get: function get() { - return _index.isType; - } -}); -Object.defineProperty(exports, "isScalarType", { - enumerable: true, - get: function get() { - return _index.isScalarType; - } -}); -Object.defineProperty(exports, "isObjectType", { - enumerable: true, - get: function get() { - return _index.isObjectType; - } -}); -Object.defineProperty(exports, "isInterfaceType", { - enumerable: true, - get: function get() { - return _index.isInterfaceType; - } -}); -Object.defineProperty(exports, "isUnionType", { - enumerable: true, - get: function get() { - return _index.isUnionType; - } -}); -Object.defineProperty(exports, "isEnumType", { - enumerable: true, - get: function get() { - return _index.isEnumType; - } -}); -Object.defineProperty(exports, "isInputObjectType", { - enumerable: true, - get: function get() { - return _index.isInputObjectType; - } -}); -Object.defineProperty(exports, "isListType", { - enumerable: true, - get: function get() { - return _index.isListType; - } -}); -Object.defineProperty(exports, "isNonNullType", { - enumerable: true, - get: function get() { - return _index.isNonNullType; - } -}); -Object.defineProperty(exports, "isInputType", { - enumerable: true, - get: function get() { - return _index.isInputType; - } -}); -Object.defineProperty(exports, "isOutputType", { - enumerable: true, - get: function get() { - return _index.isOutputType; - } -}); -Object.defineProperty(exports, "isLeafType", { - enumerable: true, - get: function get() { - return _index.isLeafType; - } -}); -Object.defineProperty(exports, "isCompositeType", { - enumerable: true, - get: function get() { - return _index.isCompositeType; - } -}); -Object.defineProperty(exports, "isAbstractType", { - enumerable: true, - get: function get() { - return _index.isAbstractType; - } -}); -Object.defineProperty(exports, "isWrappingType", { - enumerable: true, - get: function get() { - return _index.isWrappingType; - } -}); -Object.defineProperty(exports, "isNullableType", { - enumerable: true, - get: function get() { - return _index.isNullableType; - } -}); -Object.defineProperty(exports, "isNamedType", { - enumerable: true, - get: function get() { - return _index.isNamedType; - } -}); -Object.defineProperty(exports, "isRequiredArgument", { - enumerable: true, - get: function get() { - return _index.isRequiredArgument; - } -}); -Object.defineProperty(exports, "isRequiredInputField", { - enumerable: true, - get: function get() { - return _index.isRequiredInputField; - } -}); -Object.defineProperty(exports, "isSpecifiedScalarType", { - enumerable: true, - get: function get() { - return _index.isSpecifiedScalarType; - } -}); -Object.defineProperty(exports, "isIntrospectionType", { - enumerable: true, - get: function get() { - return _index.isIntrospectionType; - } -}); -Object.defineProperty(exports, "isSpecifiedDirective", { - enumerable: true, - get: function get() { - return _index.isSpecifiedDirective; - } -}); -Object.defineProperty(exports, "assertSchema", { - enumerable: true, - get: function get() { - return _index.assertSchema; - } -}); -Object.defineProperty(exports, "assertDirective", { - enumerable: true, - get: function get() { - return _index.assertDirective; - } -}); -Object.defineProperty(exports, "assertType", { - enumerable: true, - get: function get() { - return _index.assertType; - } -}); -Object.defineProperty(exports, "assertScalarType", { - enumerable: true, - get: function get() { - return _index.assertScalarType; - } -}); -Object.defineProperty(exports, "assertObjectType", { - enumerable: true, - get: function get() { - return _index.assertObjectType; - } -}); -Object.defineProperty(exports, "assertInterfaceType", { - enumerable: true, - get: function get() { - return _index.assertInterfaceType; - } -}); -Object.defineProperty(exports, "assertUnionType", { - enumerable: true, - get: function get() { - return _index.assertUnionType; - } -}); -Object.defineProperty(exports, "assertEnumType", { - enumerable: true, - get: function get() { - return _index.assertEnumType; - } -}); -Object.defineProperty(exports, "assertInputObjectType", { - enumerable: true, - get: function get() { - return _index.assertInputObjectType; - } -}); -Object.defineProperty(exports, "assertListType", { - enumerable: true, - get: function get() { - return _index.assertListType; - } -}); -Object.defineProperty(exports, "assertNonNullType", { - enumerable: true, - get: function get() { - return _index.assertNonNullType; - } -}); -Object.defineProperty(exports, "assertInputType", { - enumerable: true, - get: function get() { - return _index.assertInputType; - } -}); -Object.defineProperty(exports, "assertOutputType", { - enumerable: true, - get: function get() { - return _index.assertOutputType; - } -}); -Object.defineProperty(exports, "assertLeafType", { - enumerable: true, - get: function get() { - return _index.assertLeafType; - } -}); -Object.defineProperty(exports, "assertCompositeType", { - enumerable: true, - get: function get() { - return _index.assertCompositeType; - } -}); -Object.defineProperty(exports, "assertAbstractType", { - enumerable: true, - get: function get() { - return _index.assertAbstractType; - } -}); -Object.defineProperty(exports, "assertWrappingType", { - enumerable: true, - get: function get() { - return _index.assertWrappingType; - } -}); -Object.defineProperty(exports, "assertNullableType", { - enumerable: true, - get: function get() { - return _index.assertNullableType; - } -}); -Object.defineProperty(exports, "assertNamedType", { - enumerable: true, - get: function get() { - return _index.assertNamedType; - } -}); -Object.defineProperty(exports, "getNullableType", { - enumerable: true, - get: function get() { - return _index.getNullableType; - } -}); -Object.defineProperty(exports, "getNamedType", { - enumerable: true, - get: function get() { - return _index.getNamedType; - } -}); -Object.defineProperty(exports, "validateSchema", { - enumerable: true, - get: function get() { - return _index.validateSchema; - } -}); -Object.defineProperty(exports, "assertValidSchema", { - enumerable: true, - get: function get() { - return _index.assertValidSchema; - } -}); -Object.defineProperty(exports, "Token", { - enumerable: true, - get: function get() { - return _index2.Token; - } -}); -Object.defineProperty(exports, "Source", { - enumerable: true, - get: function get() { - return _index2.Source; - } -}); -Object.defineProperty(exports, "Location", { - enumerable: true, - get: function get() { - return _index2.Location; - } -}); -Object.defineProperty(exports, "getLocation", { - enumerable: true, - get: function get() { - return _index2.getLocation; - } -}); -Object.defineProperty(exports, "printLocation", { - enumerable: true, - get: function get() { - return _index2.printLocation; - } -}); -Object.defineProperty(exports, "printSourceLocation", { - enumerable: true, - get: function get() { - return _index2.printSourceLocation; - } -}); -Object.defineProperty(exports, "Lexer", { - enumerable: true, - get: function get() { - return _index2.Lexer; - } -}); -Object.defineProperty(exports, "TokenKind", { - enumerable: true, - get: function get() { - return _index2.TokenKind; - } -}); -Object.defineProperty(exports, "parse", { - enumerable: true, - get: function get() { - return _index2.parse; - } -}); -Object.defineProperty(exports, "parseValue", { - enumerable: true, - get: function get() { - return _index2.parseValue; - } -}); -Object.defineProperty(exports, "parseType", { - enumerable: true, - get: function get() { - return _index2.parseType; - } -}); -Object.defineProperty(exports, "print", { - enumerable: true, - get: function get() { - return _index2.print; - } -}); -Object.defineProperty(exports, "visit", { - enumerable: true, - get: function get() { - return _index2.visit; - } -}); -Object.defineProperty(exports, "visitInParallel", { - enumerable: true, - get: function get() { - return _index2.visitInParallel; - } -}); -Object.defineProperty(exports, "getVisitFn", { - enumerable: true, - get: function get() { - return _index2.getVisitFn; - } -}); -Object.defineProperty(exports, "BREAK", { - enumerable: true, - get: function get() { - return _index2.BREAK; - } -}); -Object.defineProperty(exports, "Kind", { - enumerable: true, - get: function get() { - return _index2.Kind; - } -}); -Object.defineProperty(exports, "DirectiveLocation", { - enumerable: true, - get: function get() { - return _index2.DirectiveLocation; - } -}); -Object.defineProperty(exports, "isDefinitionNode", { - enumerable: true, - get: function get() { - return _index2.isDefinitionNode; - } -}); -Object.defineProperty(exports, "isExecutableDefinitionNode", { - enumerable: true, - get: function get() { - return _index2.isExecutableDefinitionNode; - } -}); -Object.defineProperty(exports, "isSelectionNode", { - enumerable: true, - get: function get() { - return _index2.isSelectionNode; - } -}); -Object.defineProperty(exports, "isValueNode", { - enumerable: true, - get: function get() { - return _index2.isValueNode; - } -}); -Object.defineProperty(exports, "isTypeNode", { - enumerable: true, - get: function get() { - return _index2.isTypeNode; - } -}); -Object.defineProperty(exports, "isTypeSystemDefinitionNode", { - enumerable: true, - get: function get() { - return _index2.isTypeSystemDefinitionNode; - } -}); -Object.defineProperty(exports, "isTypeDefinitionNode", { - enumerable: true, - get: function get() { - return _index2.isTypeDefinitionNode; - } -}); -Object.defineProperty(exports, "isTypeSystemExtensionNode", { - enumerable: true, - get: function get() { - return _index2.isTypeSystemExtensionNode; - } -}); -Object.defineProperty(exports, "isTypeExtensionNode", { - enumerable: true, - get: function get() { - return _index2.isTypeExtensionNode; - } -}); -Object.defineProperty(exports, "execute", { - enumerable: true, - get: function get() { - return _index3.execute; - } -}); -Object.defineProperty(exports, "executeSync", { - enumerable: true, - get: function get() { - return _index3.executeSync; - } -}); -Object.defineProperty(exports, "defaultFieldResolver", { - enumerable: true, - get: function get() { - return _index3.defaultFieldResolver; - } -}); -Object.defineProperty(exports, "defaultTypeResolver", { - enumerable: true, - get: function get() { - return _index3.defaultTypeResolver; - } -}); -Object.defineProperty(exports, "responsePathAsArray", { - enumerable: true, - get: function get() { - return _index3.responsePathAsArray; - } -}); -Object.defineProperty(exports, "getDirectiveValues", { - enumerable: true, - get: function get() { - return _index3.getDirectiveValues; - } -}); -Object.defineProperty(exports, "subscribe", { - enumerable: true, - get: function get() { - return _index4.subscribe; - } -}); -Object.defineProperty(exports, "createSourceEventStream", { - enumerable: true, - get: function get() { - return _index4.createSourceEventStream; - } -}); -Object.defineProperty(exports, "validate", { - enumerable: true, - get: function get() { - return _index5.validate; - } -}); -Object.defineProperty(exports, "ValidationContext", { - enumerable: true, - get: function get() { - return _index5.ValidationContext; - } -}); -Object.defineProperty(exports, "specifiedRules", { - enumerable: true, - get: function get() { - return _index5.specifiedRules; - } -}); -Object.defineProperty(exports, "ExecutableDefinitionsRule", { - enumerable: true, - get: function get() { - return _index5.ExecutableDefinitionsRule; - } -}); -Object.defineProperty(exports, "FieldsOnCorrectTypeRule", { - enumerable: true, - get: function get() { - return _index5.FieldsOnCorrectTypeRule; - } -}); -Object.defineProperty(exports, "FragmentsOnCompositeTypesRule", { - enumerable: true, - get: function get() { - return _index5.FragmentsOnCompositeTypesRule; - } -}); -Object.defineProperty(exports, "KnownArgumentNamesRule", { - enumerable: true, - get: function get() { - return _index5.KnownArgumentNamesRule; - } -}); -Object.defineProperty(exports, "KnownDirectivesRule", { - enumerable: true, - get: function get() { - return _index5.KnownDirectivesRule; - } -}); -Object.defineProperty(exports, "KnownFragmentNamesRule", { - enumerable: true, - get: function get() { - return _index5.KnownFragmentNamesRule; - } -}); -Object.defineProperty(exports, "KnownTypeNamesRule", { - enumerable: true, - get: function get() { - return _index5.KnownTypeNamesRule; - } -}); -Object.defineProperty(exports, "LoneAnonymousOperationRule", { - enumerable: true, - get: function get() { - return _index5.LoneAnonymousOperationRule; - } -}); -Object.defineProperty(exports, "NoFragmentCyclesRule", { - enumerable: true, - get: function get() { - return _index5.NoFragmentCyclesRule; - } -}); -Object.defineProperty(exports, "NoUndefinedVariablesRule", { - enumerable: true, - get: function get() { - return _index5.NoUndefinedVariablesRule; - } -}); -Object.defineProperty(exports, "NoUnusedFragmentsRule", { - enumerable: true, - get: function get() { - return _index5.NoUnusedFragmentsRule; - } -}); -Object.defineProperty(exports, "NoUnusedVariablesRule", { - enumerable: true, - get: function get() { - return _index5.NoUnusedVariablesRule; - } -}); -Object.defineProperty(exports, "OverlappingFieldsCanBeMergedRule", { - enumerable: true, - get: function get() { - return _index5.OverlappingFieldsCanBeMergedRule; - } -}); -Object.defineProperty(exports, "PossibleFragmentSpreadsRule", { - enumerable: true, - get: function get() { - return _index5.PossibleFragmentSpreadsRule; - } -}); -Object.defineProperty(exports, "ProvidedRequiredArgumentsRule", { - enumerable: true, - get: function get() { - return _index5.ProvidedRequiredArgumentsRule; - } -}); -Object.defineProperty(exports, "ScalarLeafsRule", { - enumerable: true, - get: function get() { - return _index5.ScalarLeafsRule; - } -}); -Object.defineProperty(exports, "SingleFieldSubscriptionsRule", { - enumerable: true, - get: function get() { - return _index5.SingleFieldSubscriptionsRule; - } -}); -Object.defineProperty(exports, "UniqueArgumentNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueArgumentNamesRule; - } -}); -Object.defineProperty(exports, "UniqueDirectivesPerLocationRule", { - enumerable: true, - get: function get() { - return _index5.UniqueDirectivesPerLocationRule; - } -}); -Object.defineProperty(exports, "UniqueFragmentNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueFragmentNamesRule; - } -}); -Object.defineProperty(exports, "UniqueInputFieldNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueInputFieldNamesRule; - } -}); -Object.defineProperty(exports, "UniqueOperationNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueOperationNamesRule; - } -}); -Object.defineProperty(exports, "UniqueVariableNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueVariableNamesRule; - } -}); -Object.defineProperty(exports, "ValuesOfCorrectTypeRule", { - enumerable: true, - get: function get() { - return _index5.ValuesOfCorrectTypeRule; - } -}); -Object.defineProperty(exports, "VariablesAreInputTypesRule", { - enumerable: true, - get: function get() { - return _index5.VariablesAreInputTypesRule; - } -}); -Object.defineProperty(exports, "VariablesInAllowedPositionRule", { - enumerable: true, - get: function get() { - return _index5.VariablesInAllowedPositionRule; - } -}); -Object.defineProperty(exports, "LoneSchemaDefinitionRule", { - enumerable: true, - get: function get() { - return _index5.LoneSchemaDefinitionRule; - } -}); -Object.defineProperty(exports, "UniqueOperationTypesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueOperationTypesRule; - } -}); -Object.defineProperty(exports, "UniqueTypeNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueTypeNamesRule; - } -}); -Object.defineProperty(exports, "UniqueEnumValueNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueEnumValueNamesRule; - } -}); -Object.defineProperty(exports, "UniqueFieldDefinitionNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueFieldDefinitionNamesRule; - } -}); -Object.defineProperty(exports, "UniqueDirectiveNamesRule", { - enumerable: true, - get: function get() { - return _index5.UniqueDirectiveNamesRule; - } -}); -Object.defineProperty(exports, "PossibleTypeExtensionsRule", { - enumerable: true, - get: function get() { - return _index5.PossibleTypeExtensionsRule; - } -}); -Object.defineProperty(exports, "NoDeprecatedCustomRule", { - enumerable: true, - get: function get() { - return _index5.NoDeprecatedCustomRule; - } -}); -Object.defineProperty(exports, "NoSchemaIntrospectionCustomRule", { - enumerable: true, - get: function get() { - return _index5.NoSchemaIntrospectionCustomRule; - } -}); -Object.defineProperty(exports, "GraphQLError", { - enumerable: true, - get: function get() { - return _index6.GraphQLError; - } -}); -Object.defineProperty(exports, "syntaxError", { - enumerable: true, - get: function get() { - return _index6.syntaxError; - } -}); -Object.defineProperty(exports, "locatedError", { - enumerable: true, - get: function get() { - return _index6.locatedError; - } -}); -Object.defineProperty(exports, "printError", { - enumerable: true, - get: function get() { - return _index6.printError; - } -}); -Object.defineProperty(exports, "formatError", { - enumerable: true, - get: function get() { - return _index6.formatError; - } -}); -Object.defineProperty(exports, "getIntrospectionQuery", { - enumerable: true, - get: function get() { - return _index7.getIntrospectionQuery; - } -}); -Object.defineProperty(exports, "getOperationAST", { - enumerable: true, - get: function get() { - return _index7.getOperationAST; - } -}); -Object.defineProperty(exports, "getOperationRootType", { - enumerable: true, - get: function get() { - return _index7.getOperationRootType; - } -}); -Object.defineProperty(exports, "introspectionFromSchema", { - enumerable: true, - get: function get() { - return _index7.introspectionFromSchema; - } -}); -Object.defineProperty(exports, "buildClientSchema", { - enumerable: true, - get: function get() { - return _index7.buildClientSchema; - } -}); -Object.defineProperty(exports, "buildASTSchema", { - enumerable: true, - get: function get() { - return _index7.buildASTSchema; - } -}); -Object.defineProperty(exports, "buildSchema", { - enumerable: true, - get: function get() { - return _index7.buildSchema; - } -}); -Object.defineProperty(exports, "getDescription", { - enumerable: true, - get: function get() { - return _index7.getDescription; - } -}); -Object.defineProperty(exports, "extendSchema", { - enumerable: true, - get: function get() { - return _index7.extendSchema; - } -}); -Object.defineProperty(exports, "lexicographicSortSchema", { - enumerable: true, - get: function get() { - return _index7.lexicographicSortSchema; - } -}); -Object.defineProperty(exports, "printSchema", { - enumerable: true, - get: function get() { - return _index7.printSchema; - } -}); -Object.defineProperty(exports, "printType", { - enumerable: true, - get: function get() { - return _index7.printType; - } -}); -Object.defineProperty(exports, "printIntrospectionSchema", { - enumerable: true, - get: function get() { - return _index7.printIntrospectionSchema; - } -}); -Object.defineProperty(exports, "typeFromAST", { - enumerable: true, - get: function get() { - return _index7.typeFromAST; - } -}); -Object.defineProperty(exports, "valueFromAST", { - enumerable: true, - get: function get() { - return _index7.valueFromAST; - } -}); -Object.defineProperty(exports, "valueFromASTUntyped", { - enumerable: true, - get: function get() { - return _index7.valueFromASTUntyped; - } -}); -Object.defineProperty(exports, "astFromValue", { - enumerable: true, - get: function get() { - return _index7.astFromValue; - } -}); -Object.defineProperty(exports, "TypeInfo", { - enumerable: true, - get: function get() { - return _index7.TypeInfo; - } -}); -Object.defineProperty(exports, "visitWithTypeInfo", { - enumerable: true, - get: function get() { - return _index7.visitWithTypeInfo; - } -}); -Object.defineProperty(exports, "coerceInputValue", { - enumerable: true, - get: function get() { - return _index7.coerceInputValue; - } -}); -Object.defineProperty(exports, "concatAST", { - enumerable: true, - get: function get() { - return _index7.concatAST; - } -}); -Object.defineProperty(exports, "separateOperations", { - enumerable: true, - get: function get() { - return _index7.separateOperations; - } -}); -Object.defineProperty(exports, "stripIgnoredCharacters", { - enumerable: true, - get: function get() { - return _index7.stripIgnoredCharacters; - } -}); -Object.defineProperty(exports, "isEqualType", { - enumerable: true, - get: function get() { - return _index7.isEqualType; - } -}); -Object.defineProperty(exports, "isTypeSubTypeOf", { - enumerable: true, - get: function get() { - return _index7.isTypeSubTypeOf; - } -}); -Object.defineProperty(exports, "doTypesOverlap", { - enumerable: true, - get: function get() { - return _index7.doTypesOverlap; - } -}); -Object.defineProperty(exports, "assertValidName", { - enumerable: true, - get: function get() { - return _index7.assertValidName; - } -}); -Object.defineProperty(exports, "isValidNameError", { - enumerable: true, - get: function get() { - return _index7.isValidNameError; - } -}); -Object.defineProperty(exports, "BreakingChangeType", { - enumerable: true, - get: function get() { - return _index7.BreakingChangeType; - } -}); -Object.defineProperty(exports, "DangerousChangeType", { - enumerable: true, - get: function get() { - return _index7.DangerousChangeType; - } -}); -Object.defineProperty(exports, "findBreakingChanges", { - enumerable: true, - get: function get() { - return _index7.findBreakingChanges; - } -}); -Object.defineProperty(exports, "findDangerousChanges", { - enumerable: true, - get: function get() { - return _index7.findDangerousChanges; - } -}); -Object.defineProperty(exports, "findDeprecatedUsages", { - enumerable: true, - get: function get() { - return _index7.findDeprecatedUsages; - } -}); - -var _version = require("./version.js"); - -var _graphql = require("./graphql.js"); - -var _index = require("./type/index.js"); - -var _index2 = require("./language/index.js"); - -var _index3 = require("./execution/index.js"); - -var _index4 = require("./subscription/index.js"); - -var _index5 = require("./validation/index.js"); - -var _index6 = require("./error/index.js"); - -var _index7 = require("./utilities/index.js"); diff --git a/node_modules/graphql/index.js.flow b/node_modules/graphql/index.js.flow deleted file mode 100644 index 78a9bc4c..00000000 --- a/node_modules/graphql/index.js.flow +++ /dev/null @@ -1,454 +0,0 @@ -// @flow strict -/** - * GraphQL.js provides a reference implementation for the GraphQL specification - * but is also a useful utility for operating on GraphQL files and building - * sophisticated tools. - * - * This primary module exports a general purpose function for fulfilling all - * steps of the GraphQL specification in a single operation, but also includes - * utilities for every part of the GraphQL specification: - * - * - Parsing the GraphQL language. - * - Building a GraphQL type schema. - * - Validating a GraphQL request against a type schema. - * - Executing a GraphQL request against a type schema. - * - * This also includes utility functions for operating on GraphQL types and - * GraphQL documents to facilitate building tools. - * - * You may also import from each sub-directory directly. For example, the - * following two import statements are equivalent: - * - * import { parse } from 'graphql'; - * import { parse } from 'graphql/language'; - */ - -// The GraphQL.js version info. -export { version, versionInfo } from './version'; - -// The primary entry point into fulfilling a GraphQL request. -export type { GraphQLArgs } from './graphql'; -export { graphql, graphqlSync } from './graphql'; - -// Create and operate on GraphQL type definitions and schema. -export { - // Definitions - GraphQLSchema, - GraphQLDirective, - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, - // Standard GraphQL Scalars - specifiedScalarTypes, - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, - // Built-in Directives defined by the Spec - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - GraphQLSpecifiedByDirective, - // "Enum" of Type Kinds - TypeKind, - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, - // GraphQL Types for introspection. - introspectionTypes, - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, - // Predicates - isSchema, - isDirective, - isType, - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, - isListType, - isNonNullType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - isWrappingType, - isNullableType, - isNamedType, - isRequiredArgument, - isRequiredInputField, - isSpecifiedScalarType, - isIntrospectionType, - isSpecifiedDirective, - // Assertions - assertSchema, - assertDirective, - assertType, - assertScalarType, - assertObjectType, - assertInterfaceType, - assertUnionType, - assertEnumType, - assertInputObjectType, - assertListType, - assertNonNullType, - assertInputType, - assertOutputType, - assertLeafType, - assertCompositeType, - assertAbstractType, - assertWrappingType, - assertNullableType, - assertNamedType, - // Un-modifiers - getNullableType, - getNamedType, - // Validate GraphQL schema. - validateSchema, - assertValidSchema, -} from './type/index'; - -export type { - GraphQLType, - GraphQLInputType, - GraphQLOutputType, - GraphQLLeafType, - GraphQLCompositeType, - GraphQLAbstractType, - GraphQLWrappingType, - GraphQLNullableType, - GraphQLNamedType, - Thunk, - GraphQLSchemaConfig, - GraphQLDirectiveConfig, - GraphQLArgument, - GraphQLArgumentConfig, - GraphQLEnumTypeConfig, - GraphQLEnumValue, - GraphQLEnumValueConfig, - GraphQLEnumValueConfigMap, - GraphQLField, - GraphQLFieldConfig, - GraphQLFieldConfigArgumentMap, - GraphQLFieldConfigMap, - GraphQLFieldMap, - GraphQLFieldResolver, - GraphQLInputField, - GraphQLInputFieldConfig, - GraphQLInputFieldConfigMap, - GraphQLInputFieldMap, - GraphQLInputObjectTypeConfig, - GraphQLInterfaceTypeConfig, - GraphQLIsTypeOfFn, - GraphQLObjectTypeConfig, - GraphQLResolveInfo, - ResponsePath, - GraphQLScalarTypeConfig, - GraphQLTypeResolver, - GraphQLUnionTypeConfig, - GraphQLScalarSerializer, - GraphQLScalarValueParser, - GraphQLScalarLiteralParser, -} from './type/index'; - -// Parse and operate on GraphQL language source files. -export { - Token, - Source, - Location, - getLocation, - // Print source location - printLocation, - printSourceLocation, - // Lex - Lexer, - TokenKind, - // Parse - parse, - parseValue, - parseType, - // Print - print, - // Visit - visit, - visitInParallel, - getVisitFn, - BREAK, - Kind, - DirectiveLocation, - // Predicates - isDefinitionNode, - isExecutableDefinitionNode, - isSelectionNode, - isValueNode, - isTypeNode, - isTypeSystemDefinitionNode, - isTypeDefinitionNode, - isTypeSystemExtensionNode, - isTypeExtensionNode, -} from './language/index'; - -export type { - ParseOptions, - SourceLocation, - TokenKindEnum, - KindEnum, - DirectiveLocationEnum, - // Visitor utilities - ASTVisitor, - Visitor, - VisitFn, - VisitorKeyMap, - // AST nodes - ASTNode, - ASTKindToNode, - // Each kind of AST node - NameNode, - DocumentNode, - DefinitionNode, - ExecutableDefinitionNode, - OperationDefinitionNode, - OperationTypeNode, - VariableDefinitionNode, - VariableNode, - SelectionSetNode, - SelectionNode, - FieldNode, - ArgumentNode, - FragmentSpreadNode, - InlineFragmentNode, - FragmentDefinitionNode, - ValueNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - NullValueNode, - EnumValueNode, - ListValueNode, - ObjectValueNode, - ObjectFieldNode, - DirectiveNode, - TypeNode, - NamedTypeNode, - ListTypeNode, - NonNullTypeNode, - TypeSystemDefinitionNode, - SchemaDefinitionNode, - OperationTypeDefinitionNode, - TypeDefinitionNode, - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - DirectiveDefinitionNode, - TypeSystemExtensionNode, - SchemaExtensionNode, - TypeExtensionNode, - ScalarTypeExtensionNode, - ObjectTypeExtensionNode, - InterfaceTypeExtensionNode, - UnionTypeExtensionNode, - EnumTypeExtensionNode, - InputObjectTypeExtensionNode, -} from './language/index'; - -// Execute GraphQL queries. -export { - execute, - executeSync, - defaultFieldResolver, - defaultTypeResolver, - responsePathAsArray, - getDirectiveValues, -} from './execution/index'; - -export type { - ExecutionArgs, - ExecutionResult, - FormattedExecutionResult, -} from './execution/index'; - -export { subscribe, createSourceEventStream } from './subscription/index'; -export type { SubscriptionArgs } from './subscription/index'; - -// Validate GraphQL documents. -export { - validate, - ValidationContext, - // All validation rules in the GraphQL Specification. - specifiedRules, - // Individual validation rules. - ExecutableDefinitionsRule, - FieldsOnCorrectTypeRule, - FragmentsOnCompositeTypesRule, - KnownArgumentNamesRule, - KnownDirectivesRule, - KnownFragmentNamesRule, - KnownTypeNamesRule, - LoneAnonymousOperationRule, - NoFragmentCyclesRule, - NoUndefinedVariablesRule, - NoUnusedFragmentsRule, - NoUnusedVariablesRule, - OverlappingFieldsCanBeMergedRule, - PossibleFragmentSpreadsRule, - ProvidedRequiredArgumentsRule, - ScalarLeafsRule, - SingleFieldSubscriptionsRule, - UniqueArgumentNamesRule, - UniqueDirectivesPerLocationRule, - UniqueFragmentNamesRule, - UniqueInputFieldNamesRule, - UniqueOperationNamesRule, - UniqueVariableNamesRule, - ValuesOfCorrectTypeRule, - VariablesAreInputTypesRule, - VariablesInAllowedPositionRule, - // SDL-specific validation rules - LoneSchemaDefinitionRule, - UniqueOperationTypesRule, - UniqueTypeNamesRule, - UniqueEnumValueNamesRule, - UniqueFieldDefinitionNamesRule, - UniqueDirectiveNamesRule, - PossibleTypeExtensionsRule, - // Custom validation rules - NoDeprecatedCustomRule, - NoSchemaIntrospectionCustomRule, -} from './validation/index'; - -export type { ValidationRule } from './validation/index'; - -// Create, format, and print GraphQL errors. -export { - GraphQLError, - syntaxError, - locatedError, - printError, - formatError, -} from './error/index'; - -export type { GraphQLFormattedError } from './error/index'; - -// Utilities for operating on GraphQL type schema and parsed sources. -export { - // Produce the GraphQL query recommended for a full schema introspection. - // Accepts optional IntrospectionOptions. - getIntrospectionQuery, - // Gets the target Operation from a Document. - getOperationAST, - // Gets the Type for the target Operation AST. - getOperationRootType, - // Convert a GraphQLSchema to an IntrospectionQuery. - introspectionFromSchema, - // Build a GraphQLSchema from an introspection result. - buildClientSchema, - // Build a GraphQLSchema from a parsed GraphQL Schema language AST. - buildASTSchema, - // Build a GraphQLSchema from a GraphQL schema language document. - buildSchema, - // @deprecated: Get the description from a schema AST node and supports legacy - // syntax for specifying descriptions - will be removed in v16. - getDescription, - // Extends an existing GraphQLSchema from a parsed GraphQL Schema - // language AST. - extendSchema, - // Sort a GraphQLSchema. - lexicographicSortSchema, - // Print a GraphQLSchema to GraphQL Schema language. - printSchema, - // Print a GraphQLType to GraphQL Schema language. - printType, - // Prints the built-in introspection schema in the Schema Language - // format. - printIntrospectionSchema, - // Create a GraphQLType from a GraphQL language AST. - typeFromAST, - // Create a JavaScript value from a GraphQL language AST with a Type. - valueFromAST, - // Create a JavaScript value from a GraphQL language AST without a Type. - valueFromASTUntyped, - // Create a GraphQL language AST from a JavaScript value. - astFromValue, - // A helper to use within recursive-descent visitors which need to be aware of - // the GraphQL type system. - TypeInfo, - visitWithTypeInfo, - // Coerces a JavaScript value to a GraphQL type, or produces errors. - coerceInputValue, - // Concatenates multiple AST together. - concatAST, - // Separates an AST into an AST per Operation. - separateOperations, - // Strips characters that are not significant to the validity or execution - // of a GraphQL document. - stripIgnoredCharacters, - // Comparators for types - isEqualType, - isTypeSubTypeOf, - doTypesOverlap, - // Asserts a string is a valid GraphQL name. - assertValidName, - // Determine if a string is a valid GraphQL name. - isValidNameError, - // Compares two GraphQLSchemas and detects breaking changes. - BreakingChangeType, - DangerousChangeType, - findBreakingChanges, - findDangerousChanges, - // @deprecated: Report all deprecated usage within a GraphQL document. - findDeprecatedUsages, -} from './utilities/index'; - -export type { - IntrospectionOptions, - IntrospectionQuery, - IntrospectionSchema, - IntrospectionType, - IntrospectionInputType, - IntrospectionOutputType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionInputTypeRef, - IntrospectionOutputTypeRef, - IntrospectionNamedTypeRef, - IntrospectionListTypeRef, - IntrospectionNonNullTypeRef, - IntrospectionField, - IntrospectionInputValue, - IntrospectionEnumValue, - IntrospectionDirective, - BuildSchemaOptions, - BreakingChange, - DangerousChange, -} from './utilities/index'; diff --git a/node_modules/graphql/index.mjs b/node_modules/graphql/index.mjs deleted file mode 100644 index 952630a2..00000000 --- a/node_modules/graphql/index.mjs +++ /dev/null @@ -1,94 +0,0 @@ -/** - * GraphQL.js provides a reference implementation for the GraphQL specification - * but is also a useful utility for operating on GraphQL files and building - * sophisticated tools. - * - * This primary module exports a general purpose function for fulfilling all - * steps of the GraphQL specification in a single operation, but also includes - * utilities for every part of the GraphQL specification: - * - * - Parsing the GraphQL language. - * - Building a GraphQL type schema. - * - Validating a GraphQL request against a type schema. - * - Executing a GraphQL request against a type schema. - * - * This also includes utility functions for operating on GraphQL types and - * GraphQL documents to facilitate building tools. - * - * You may also import from each sub-directory directly. For example, the - * following two import statements are equivalent: - * - * import { parse } from 'graphql'; - * import { parse } from 'graphql/language'; - */ -// The GraphQL.js version info. -export { version, versionInfo } from "./version.mjs"; // The primary entry point into fulfilling a GraphQL request. - -export { graphql, graphqlSync } from "./graphql.mjs"; // Create and operate on GraphQL type definitions and schema. - -export { // Definitions -GraphQLSchema, GraphQLDirective, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull // Standard GraphQL Scalars -, specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID // Built-in Directives defined by the Spec -, specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective // "Enum" of Type Kinds -, TypeKind // Constant Deprecation Reason -, DEFAULT_DEPRECATION_REASON // GraphQL Types for introspection. -, introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind // Meta-field definitions. -, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef // Predicates -, isSchema, isDirective, isType, isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isListType, isNonNullType, isInputType, isOutputType, isLeafType, isCompositeType, isAbstractType, isWrappingType, isNullableType, isNamedType, isRequiredArgument, isRequiredInputField, isSpecifiedScalarType, isIntrospectionType, isSpecifiedDirective // Assertions -, assertSchema, assertDirective, assertType, assertScalarType, assertObjectType, assertInterfaceType, assertUnionType, assertEnumType, assertInputObjectType, assertListType, assertNonNullType, assertInputType, assertOutputType, assertLeafType, assertCompositeType, assertAbstractType, assertWrappingType, assertNullableType, assertNamedType // Un-modifiers -, getNullableType, getNamedType // Validate GraphQL schema. -, validateSchema, assertValidSchema } from "./type/index.mjs"; -// Parse and operate on GraphQL language source files. -export { Token, Source, Location, getLocation // Print source location -, printLocation, printSourceLocation // Lex -, Lexer, TokenKind // Parse -, parse, parseValue, parseType // Print -, print // Visit -, visit, visitInParallel, getVisitFn, BREAK, Kind, DirectiveLocation // Predicates -, isDefinitionNode, isExecutableDefinitionNode, isSelectionNode, isValueNode, isTypeNode, isTypeSystemDefinitionNode, isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode } from "./language/index.mjs"; -// Execute GraphQL queries. -export { execute, executeSync, defaultFieldResolver, defaultTypeResolver, responsePathAsArray, getDirectiveValues } from "./execution/index.mjs"; -export { subscribe, createSourceEventStream } from "./subscription/index.mjs"; -// Validate GraphQL documents. -export { validate, ValidationContext // All validation rules in the GraphQL Specification. -, specifiedRules // Individual validation rules. -, ExecutableDefinitionsRule, FieldsOnCorrectTypeRule, FragmentsOnCompositeTypesRule, KnownArgumentNamesRule, KnownDirectivesRule, KnownFragmentNamesRule, KnownTypeNamesRule, LoneAnonymousOperationRule, NoFragmentCyclesRule, NoUndefinedVariablesRule, NoUnusedFragmentsRule, NoUnusedVariablesRule, OverlappingFieldsCanBeMergedRule, PossibleFragmentSpreadsRule, ProvidedRequiredArgumentsRule, ScalarLeafsRule, SingleFieldSubscriptionsRule, UniqueArgumentNamesRule, UniqueDirectivesPerLocationRule, UniqueFragmentNamesRule, UniqueInputFieldNamesRule, UniqueOperationNamesRule, UniqueVariableNamesRule, ValuesOfCorrectTypeRule, VariablesAreInputTypesRule, VariablesInAllowedPositionRule // SDL-specific validation rules -, LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, PossibleTypeExtensionsRule // Custom validation rules -, NoDeprecatedCustomRule, NoSchemaIntrospectionCustomRule } from "./validation/index.mjs"; -// Create, format, and print GraphQL errors. -export { GraphQLError, syntaxError, locatedError, printError, formatError } from "./error/index.mjs"; -// Utilities for operating on GraphQL type schema and parsed sources. -export { // Produce the GraphQL query recommended for a full schema introspection. -// Accepts optional IntrospectionOptions. -getIntrospectionQuery // Gets the target Operation from a Document. -, getOperationAST // Gets the Type for the target Operation AST. -, getOperationRootType // Convert a GraphQLSchema to an IntrospectionQuery. -, introspectionFromSchema // Build a GraphQLSchema from an introspection result. -, buildClientSchema // Build a GraphQLSchema from a parsed GraphQL Schema language AST. -, buildASTSchema // Build a GraphQLSchema from a GraphQL schema language document. -, buildSchema // @deprecated: Get the description from a schema AST node and supports legacy -// syntax for specifying descriptions - will be removed in v16. -, getDescription // Extends an existing GraphQLSchema from a parsed GraphQL Schema -// language AST. -, extendSchema // Sort a GraphQLSchema. -, lexicographicSortSchema // Print a GraphQLSchema to GraphQL Schema language. -, printSchema // Print a GraphQLType to GraphQL Schema language. -, printType // Prints the built-in introspection schema in the Schema Language -// format. -, printIntrospectionSchema // Create a GraphQLType from a GraphQL language AST. -, typeFromAST // Create a JavaScript value from a GraphQL language AST with a Type. -, valueFromAST // Create a JavaScript value from a GraphQL language AST without a Type. -, valueFromASTUntyped // Create a GraphQL language AST from a JavaScript value. -, astFromValue // A helper to use within recursive-descent visitors which need to be aware of -// the GraphQL type system. -, TypeInfo, visitWithTypeInfo // Coerces a JavaScript value to a GraphQL type, or produces errors. -, coerceInputValue // Concatenates multiple AST together. -, concatAST // Separates an AST into an AST per Operation. -, separateOperations // Strips characters that are not significant to the validity or execution -// of a GraphQL document. -, stripIgnoredCharacters // Comparators for types -, isEqualType, isTypeSubTypeOf, doTypesOverlap // Asserts a string is a valid GraphQL name. -, assertValidName // Determine if a string is a valid GraphQL name. -, isValidNameError // Compares two GraphQLSchemas and detects breaking changes. -, BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges // @deprecated: Report all deprecated usage within a GraphQL document. -, findDeprecatedUsages } from "./utilities/index.mjs"; diff --git a/node_modules/graphql/jsutils/Maybe.d.ts b/node_modules/graphql/jsutils/Maybe.d.ts deleted file mode 100644 index e8b5e217..00000000 --- a/node_modules/graphql/jsutils/Maybe.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/ -export type Maybe = null | undefined | T; diff --git a/node_modules/graphql/jsutils/ObjMap.js b/node_modules/graphql/jsutils/ObjMap.js deleted file mode 100644 index 3918c74e..00000000 --- a/node_modules/graphql/jsutils/ObjMap.js +++ /dev/null @@ -1 +0,0 @@ -"use strict"; diff --git a/node_modules/graphql/jsutils/ObjMap.js.flow b/node_modules/graphql/jsutils/ObjMap.js.flow deleted file mode 100644 index a37d728b..00000000 --- a/node_modules/graphql/jsutils/ObjMap.js.flow +++ /dev/null @@ -1,8 +0,0 @@ -// @flow strict -export type ObjMap = { [key: string]: T, __proto__: null, ... }; -export type ObjMapLike = ObjMap | { [key: string]: T, ... }; - -export type ReadOnlyObjMap = { +[key: string]: T, __proto__: null, ... }; -export type ReadOnlyObjMapLike = - | ReadOnlyObjMap - | { +[key: string]: T, ... }; diff --git a/node_modules/graphql/jsutils/ObjMap.mjs b/node_modules/graphql/jsutils/ObjMap.mjs deleted file mode 100644 index 8b137891..00000000 --- a/node_modules/graphql/jsutils/ObjMap.mjs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/graphql/jsutils/Path.d.ts b/node_modules/graphql/jsutils/Path.d.ts deleted file mode 100644 index 9a2233dd..00000000 --- a/node_modules/graphql/jsutils/Path.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface Path { - prev: Path | undefined; - key: string | number; - typename: string | undefined; -} - -/** - * Given a Path and a key, return a new Path containing the new key. - */ -export function addPath( - prev: Path | undefined, - key: string | number, - typename: string | undefined, -): Path; - -/** - * Given a Path, return an Array of the path keys. - */ -export function pathToArray(path: Path): Array; diff --git a/node_modules/graphql/jsutils/Path.js b/node_modules/graphql/jsutils/Path.js deleted file mode 100644 index 9eb25171..00000000 --- a/node_modules/graphql/jsutils/Path.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addPath = addPath; -exports.pathToArray = pathToArray; - -/** - * Given a Path and a key, return a new Path containing the new key. - */ -function addPath(prev, key, typename) { - return { - prev: prev, - key: key, - typename: typename - }; -} -/** - * Given a Path, return an Array of the path keys. - */ - - -function pathToArray(path) { - var flattened = []; - var curr = path; - - while (curr) { - flattened.push(curr.key); - curr = curr.prev; - } - - return flattened.reverse(); -} diff --git a/node_modules/graphql/jsutils/Path.js.flow b/node_modules/graphql/jsutils/Path.js.flow deleted file mode 100644 index 4b0e23c8..00000000 --- a/node_modules/graphql/jsutils/Path.js.flow +++ /dev/null @@ -1,30 +0,0 @@ -// @flow strict -export type Path = {| - +prev: Path | void, - +key: string | number, - +typename: string | void, -|}; - -/** - * Given a Path and a key, return a new Path containing the new key. - */ -export function addPath( - prev: $ReadOnly | void, - key: string | number, - typename: string | void, -): Path { - return { prev, key, typename }; -} - -/** - * Given a Path, return an Array of the path keys. - */ -export function pathToArray(path: ?$ReadOnly): Array { - const flattened = []; - let curr = path; - while (curr) { - flattened.push(curr.key); - curr = curr.prev; - } - return flattened.reverse(); -} diff --git a/node_modules/graphql/jsutils/Path.mjs b/node_modules/graphql/jsutils/Path.mjs deleted file mode 100644 index af448f0d..00000000 --- a/node_modules/graphql/jsutils/Path.mjs +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Given a Path and a key, return a new Path containing the new key. - */ -export function addPath(prev, key, typename) { - return { - prev: prev, - key: key, - typename: typename - }; -} -/** - * Given a Path, return an Array of the path keys. - */ - -export function pathToArray(path) { - var flattened = []; - var curr = path; - - while (curr) { - flattened.push(curr.key); - curr = curr.prev; - } - - return flattened.reverse(); -} diff --git a/node_modules/graphql/jsutils/PromiseOrValue.d.ts b/node_modules/graphql/jsutils/PromiseOrValue.d.ts deleted file mode 100644 index 6b2517ee..00000000 --- a/node_modules/graphql/jsutils/PromiseOrValue.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type PromiseOrValue = Promise | T; diff --git a/node_modules/graphql/jsutils/PromiseOrValue.js b/node_modules/graphql/jsutils/PromiseOrValue.js deleted file mode 100644 index 3918c74e..00000000 --- a/node_modules/graphql/jsutils/PromiseOrValue.js +++ /dev/null @@ -1 +0,0 @@ -"use strict"; diff --git a/node_modules/graphql/jsutils/PromiseOrValue.js.flow b/node_modules/graphql/jsutils/PromiseOrValue.js.flow deleted file mode 100644 index dc8df500..00000000 --- a/node_modules/graphql/jsutils/PromiseOrValue.js.flow +++ /dev/null @@ -1,2 +0,0 @@ -// @flow strict -export type PromiseOrValue<+T> = Promise | T; diff --git a/node_modules/graphql/jsutils/PromiseOrValue.mjs b/node_modules/graphql/jsutils/PromiseOrValue.mjs deleted file mode 100644 index 8b137891..00000000 --- a/node_modules/graphql/jsutils/PromiseOrValue.mjs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/graphql/jsutils/defineInspect.js b/node_modules/graphql/jsutils/defineInspect.js deleted file mode 100644 index 9bcdcf57..00000000 --- a/node_modules/graphql/jsutils/defineInspect.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = defineInspect; - -var _invariant = _interopRequireDefault(require("./invariant.js")); - -var _nodejsCustomInspectSymbol = _interopRequireDefault(require("./nodejsCustomInspectSymbol.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` - */ -function defineInspect(classObject) { - var fn = classObject.prototype.toJSON; - typeof fn === 'function' || (0, _invariant.default)(0); - classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') - - if (_nodejsCustomInspectSymbol.default) { - classObject.prototype[_nodejsCustomInspectSymbol.default] = fn; - } -} diff --git a/node_modules/graphql/jsutils/defineInspect.js.flow b/node_modules/graphql/jsutils/defineInspect.js.flow deleted file mode 100644 index 5359f76f..00000000 --- a/node_modules/graphql/jsutils/defineInspect.js.flow +++ /dev/null @@ -1,20 +0,0 @@ -// @flow strict -import invariant from './invariant'; -import nodejsCustomInspectSymbol from './nodejsCustomInspectSymbol'; - -/** - * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` - */ -export default function defineInspect( - classObject: Class | ((...args: Array) => mixed), -): void { - const fn = classObject.prototype.toJSON; - invariant(typeof fn === 'function'); - - classObject.prototype.inspect = fn; - - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') - if (nodejsCustomInspectSymbol) { - classObject.prototype[nodejsCustomInspectSymbol] = fn; - } -} diff --git a/node_modules/graphql/jsutils/defineInspect.mjs b/node_modules/graphql/jsutils/defineInspect.mjs deleted file mode 100644 index 33f6fdbd..00000000 --- a/node_modules/graphql/jsutils/defineInspect.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import invariant from "./invariant.mjs"; -import nodejsCustomInspectSymbol from "./nodejsCustomInspectSymbol.mjs"; -/** - * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` - */ - -export default function defineInspect(classObject) { - var fn = classObject.prototype.toJSON; - typeof fn === 'function' || invariant(0); - classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') - - if (nodejsCustomInspectSymbol) { - classObject.prototype[nodejsCustomInspectSymbol] = fn; - } -} diff --git a/node_modules/graphql/jsutils/devAssert.js b/node_modules/graphql/jsutils/devAssert.js deleted file mode 100644 index 25e6d119..00000000 --- a/node_modules/graphql/jsutils/devAssert.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = devAssert; - -function devAssert(condition, message) { - var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') - - if (!booleanCondition) { - throw new Error(message); - } -} diff --git a/node_modules/graphql/jsutils/devAssert.js.flow b/node_modules/graphql/jsutils/devAssert.js.flow deleted file mode 100644 index 691eae7d..00000000 --- a/node_modules/graphql/jsutils/devAssert.js.flow +++ /dev/null @@ -1,8 +0,0 @@ -// @flow strict -export default function devAssert(condition: mixed, message: string): void { - const booleanCondition = Boolean(condition); - // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') - if (!booleanCondition) { - throw new Error(message); - } -} diff --git a/node_modules/graphql/jsutils/devAssert.mjs b/node_modules/graphql/jsutils/devAssert.mjs deleted file mode 100644 index e19b7eb8..00000000 --- a/node_modules/graphql/jsutils/devAssert.mjs +++ /dev/null @@ -1,7 +0,0 @@ -export default function devAssert(condition, message) { - var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') - - if (!booleanCondition) { - throw new Error(message); - } -} diff --git a/node_modules/graphql/jsutils/didYouMean.js b/node_modules/graphql/jsutils/didYouMean.js deleted file mode 100644 index d6b0d902..00000000 --- a/node_modules/graphql/jsutils/didYouMean.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = didYouMean; -var MAX_SUGGESTIONS = 5; -/** - * Given [ A, B, C ] return ' Did you mean A, B, or C?'. - */ - -// eslint-disable-next-line no-redeclare -function didYouMean(firstArg, secondArg) { - var _ref = typeof firstArg === 'string' ? [firstArg, secondArg] : [undefined, firstArg], - subMessage = _ref[0], - suggestionsArg = _ref[1]; - - var message = ' Did you mean '; - - if (subMessage) { - message += subMessage + ' '; - } - - var suggestions = suggestionsArg.map(function (x) { - return "\"".concat(x, "\""); - }); - - switch (suggestions.length) { - case 0: - return ''; - - case 1: - return message + suggestions[0] + '?'; - - case 2: - return message + suggestions[0] + ' or ' + suggestions[1] + '?'; - } - - var selected = suggestions.slice(0, MAX_SUGGESTIONS); - var lastItem = selected.pop(); - return message + selected.join(', ') + ', or ' + lastItem + '?'; -} diff --git a/node_modules/graphql/jsutils/didYouMean.js.flow b/node_modules/graphql/jsutils/didYouMean.js.flow deleted file mode 100644 index fc4e9e13..00000000 --- a/node_modules/graphql/jsutils/didYouMean.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -// @flow strict -const MAX_SUGGESTIONS = 5; - -/** - * Given [ A, B, C ] return ' Did you mean A, B, or C?'. - */ -declare function didYouMean(suggestions: $ReadOnlyArray): string; -// eslint-disable-next-line no-redeclare -declare function didYouMean( - subMessage: string, - suggestions: $ReadOnlyArray, -): string; - -// eslint-disable-next-line no-redeclare -export default function didYouMean(firstArg, secondArg) { - const [subMessage, suggestionsArg] = - typeof firstArg === 'string' - ? [firstArg, secondArg] - : [undefined, firstArg]; - - let message = ' Did you mean '; - if (subMessage) { - message += subMessage + ' '; - } - - const suggestions = suggestionsArg.map((x) => `"${x}"`); - switch (suggestions.length) { - case 0: - return ''; - case 1: - return message + suggestions[0] + '?'; - case 2: - return message + suggestions[0] + ' or ' + suggestions[1] + '?'; - } - - const selected = suggestions.slice(0, MAX_SUGGESTIONS); - const lastItem = selected.pop(); - return message + selected.join(', ') + ', or ' + lastItem + '?'; -} diff --git a/node_modules/graphql/jsutils/didYouMean.mjs b/node_modules/graphql/jsutils/didYouMean.mjs deleted file mode 100644 index 19e26cc3..00000000 --- a/node_modules/graphql/jsutils/didYouMean.mjs +++ /dev/null @@ -1,36 +0,0 @@ -var MAX_SUGGESTIONS = 5; -/** - * Given [ A, B, C ] return ' Did you mean A, B, or C?'. - */ - -// eslint-disable-next-line no-redeclare -export default function didYouMean(firstArg, secondArg) { - var _ref = typeof firstArg === 'string' ? [firstArg, secondArg] : [undefined, firstArg], - subMessage = _ref[0], - suggestionsArg = _ref[1]; - - var message = ' Did you mean '; - - if (subMessage) { - message += subMessage + ' '; - } - - var suggestions = suggestionsArg.map(function (x) { - return "\"".concat(x, "\""); - }); - - switch (suggestions.length) { - case 0: - return ''; - - case 1: - return message + suggestions[0] + '?'; - - case 2: - return message + suggestions[0] + ' or ' + suggestions[1] + '?'; - } - - var selected = suggestions.slice(0, MAX_SUGGESTIONS); - var lastItem = selected.pop(); - return message + selected.join(', ') + ', or ' + lastItem + '?'; -} diff --git a/node_modules/graphql/jsutils/identityFunc.js b/node_modules/graphql/jsutils/identityFunc.js deleted file mode 100644 index 630772f6..00000000 --- a/node_modules/graphql/jsutils/identityFunc.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = identityFunc; - -/** - * Returns the first argument it receives. - */ -function identityFunc(x) { - return x; -} diff --git a/node_modules/graphql/jsutils/identityFunc.js.flow b/node_modules/graphql/jsutils/identityFunc.js.flow deleted file mode 100644 index a37961eb..00000000 --- a/node_modules/graphql/jsutils/identityFunc.js.flow +++ /dev/null @@ -1,7 +0,0 @@ -// @flow strict -/** - * Returns the first argument it receives. - */ -export default function identityFunc(x: T): T { - return x; -} diff --git a/node_modules/graphql/jsutils/identityFunc.mjs b/node_modules/graphql/jsutils/identityFunc.mjs deleted file mode 100644 index daf23914..00000000 --- a/node_modules/graphql/jsutils/identityFunc.mjs +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Returns the first argument it receives. - */ -export default function identityFunc(x) { - return x; -} diff --git a/node_modules/graphql/jsutils/inspect.js b/node_modules/graphql/jsutils/inspect.js deleted file mode 100644 index 8d3a16c6..00000000 --- a/node_modules/graphql/jsutils/inspect.js +++ /dev/null @@ -1,133 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = inspect; - -var _nodejsCustomInspectSymbol = _interopRequireDefault(require("./nodejsCustomInspectSymbol.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var MAX_ARRAY_LENGTH = 10; -var MAX_RECURSIVE_DEPTH = 2; -/** - * Used to print values in error messages. - */ - -function inspect(value) { - return formatValue(value, []); -} - -function formatValue(value, seenValues) { - switch (_typeof(value)) { - case 'string': - return JSON.stringify(value); - - case 'function': - return value.name ? "[function ".concat(value.name, "]") : '[function]'; - - case 'object': - if (value === null) { - return 'null'; - } - - return formatObjectValue(value, seenValues); - - default: - return String(value); - } -} - -function formatObjectValue(value, previouslySeenValues) { - if (previouslySeenValues.indexOf(value) !== -1) { - return '[Circular]'; - } - - var seenValues = [].concat(previouslySeenValues, [value]); - var customInspectFn = getCustomFn(value); - - if (customInspectFn !== undefined) { - var customValue = customInspectFn.call(value); // check for infinite recursion - - if (customValue !== value) { - return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); - } - } else if (Array.isArray(value)) { - return formatArray(value, seenValues); - } - - return formatObject(value, seenValues); -} - -function formatObject(object, seenValues) { - var keys = Object.keys(object); - - if (keys.length === 0) { - return '{}'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[' + getObjectTag(object) + ']'; - } - - var properties = keys.map(function (key) { - var value = formatValue(object[key], seenValues); - return key + ': ' + value; - }); - return '{ ' + properties.join(', ') + ' }'; -} - -function formatArray(array, seenValues) { - if (array.length === 0) { - return '[]'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[Array]'; - } - - var len = Math.min(MAX_ARRAY_LENGTH, array.length); - var remaining = array.length - len; - var items = []; - - for (var i = 0; i < len; ++i) { - items.push(formatValue(array[i], seenValues)); - } - - if (remaining === 1) { - items.push('... 1 more item'); - } else if (remaining > 1) { - items.push("... ".concat(remaining, " more items")); - } - - return '[' + items.join(', ') + ']'; -} - -function getCustomFn(object) { - var customInspectFn = object[String(_nodejsCustomInspectSymbol.default)]; - - if (typeof customInspectFn === 'function') { - return customInspectFn; - } - - if (typeof object.inspect === 'function') { - return object.inspect; - } -} - -function getObjectTag(object) { - var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); - - if (tag === 'Object' && typeof object.constructor === 'function') { - var name = object.constructor.name; - - if (typeof name === 'string' && name !== '') { - return name; - } - } - - return tag; -} diff --git a/node_modules/graphql/jsutils/inspect.js.flow b/node_modules/graphql/jsutils/inspect.js.flow deleted file mode 100644 index 77a2b2c3..00000000 --- a/node_modules/graphql/jsutils/inspect.js.flow +++ /dev/null @@ -1,128 +0,0 @@ -// @flow strict -/* eslint-disable flowtype/no-weak-types */ -import nodejsCustomInspectSymbol from './nodejsCustomInspectSymbol'; - -const MAX_ARRAY_LENGTH = 10; -const MAX_RECURSIVE_DEPTH = 2; - -/** - * Used to print values in error messages. - */ -export default function inspect(value: mixed): string { - return formatValue(value, []); -} - -function formatValue(value: mixed, seenValues: Array): string { - switch (typeof value) { - case 'string': - return JSON.stringify(value); - case 'function': - return value.name ? `[function ${value.name}]` : '[function]'; - case 'object': - if (value === null) { - return 'null'; - } - return formatObjectValue(value, seenValues); - default: - return String(value); - } -} - -function formatObjectValue( - value: Object, - previouslySeenValues: Array, -): string { - if (previouslySeenValues.indexOf(value) !== -1) { - return '[Circular]'; - } - - const seenValues = [...previouslySeenValues, value]; - const customInspectFn = getCustomFn(value); - - if (customInspectFn !== undefined) { - const customValue = customInspectFn.call(value); - - // check for infinite recursion - if (customValue !== value) { - return typeof customValue === 'string' - ? customValue - : formatValue(customValue, seenValues); - } - } else if (Array.isArray(value)) { - return formatArray(value, seenValues); - } - - return formatObject(value, seenValues); -} - -function formatObject(object: Object, seenValues: Array): string { - const keys = Object.keys(object); - if (keys.length === 0) { - return '{}'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[' + getObjectTag(object) + ']'; - } - - const properties = keys.map((key) => { - const value = formatValue(object[key], seenValues); - return key + ': ' + value; - }); - - return '{ ' + properties.join(', ') + ' }'; -} - -function formatArray(array: Array, seenValues: Array): string { - if (array.length === 0) { - return '[]'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[Array]'; - } - - const len = Math.min(MAX_ARRAY_LENGTH, array.length); - const remaining = array.length - len; - const items = []; - - for (let i = 0; i < len; ++i) { - items.push(formatValue(array[i], seenValues)); - } - - if (remaining === 1) { - items.push('... 1 more item'); - } else if (remaining > 1) { - items.push(`... ${remaining} more items`); - } - - return '[' + items.join(', ') + ']'; -} - -function getCustomFn(object: Object) { - const customInspectFn = object[String(nodejsCustomInspectSymbol)]; - - if (typeof customInspectFn === 'function') { - return customInspectFn; - } - - if (typeof object.inspect === 'function') { - return object.inspect; - } -} - -function getObjectTag(object: Object): string { - const tag = Object.prototype.toString - .call(object) - .replace(/^\[object /, '') - .replace(/]$/, ''); - - if (tag === 'Object' && typeof object.constructor === 'function') { - const name = object.constructor.name; - if (typeof name === 'string' && name !== '') { - return name; - } - } - - return tag; -} diff --git a/node_modules/graphql/jsutils/inspect.mjs b/node_modules/graphql/jsutils/inspect.mjs deleted file mode 100644 index caaf7dcc..00000000 --- a/node_modules/graphql/jsutils/inspect.mjs +++ /dev/null @@ -1,124 +0,0 @@ -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/* eslint-disable flowtype/no-weak-types */ -import nodejsCustomInspectSymbol from "./nodejsCustomInspectSymbol.mjs"; -var MAX_ARRAY_LENGTH = 10; -var MAX_RECURSIVE_DEPTH = 2; -/** - * Used to print values in error messages. - */ - -export default function inspect(value) { - return formatValue(value, []); -} - -function formatValue(value, seenValues) { - switch (_typeof(value)) { - case 'string': - return JSON.stringify(value); - - case 'function': - return value.name ? "[function ".concat(value.name, "]") : '[function]'; - - case 'object': - if (value === null) { - return 'null'; - } - - return formatObjectValue(value, seenValues); - - default: - return String(value); - } -} - -function formatObjectValue(value, previouslySeenValues) { - if (previouslySeenValues.indexOf(value) !== -1) { - return '[Circular]'; - } - - var seenValues = [].concat(previouslySeenValues, [value]); - var customInspectFn = getCustomFn(value); - - if (customInspectFn !== undefined) { - var customValue = customInspectFn.call(value); // check for infinite recursion - - if (customValue !== value) { - return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); - } - } else if (Array.isArray(value)) { - return formatArray(value, seenValues); - } - - return formatObject(value, seenValues); -} - -function formatObject(object, seenValues) { - var keys = Object.keys(object); - - if (keys.length === 0) { - return '{}'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[' + getObjectTag(object) + ']'; - } - - var properties = keys.map(function (key) { - var value = formatValue(object[key], seenValues); - return key + ': ' + value; - }); - return '{ ' + properties.join(', ') + ' }'; -} - -function formatArray(array, seenValues) { - if (array.length === 0) { - return '[]'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[Array]'; - } - - var len = Math.min(MAX_ARRAY_LENGTH, array.length); - var remaining = array.length - len; - var items = []; - - for (var i = 0; i < len; ++i) { - items.push(formatValue(array[i], seenValues)); - } - - if (remaining === 1) { - items.push('... 1 more item'); - } else if (remaining > 1) { - items.push("... ".concat(remaining, " more items")); - } - - return '[' + items.join(', ') + ']'; -} - -function getCustomFn(object) { - var customInspectFn = object[String(nodejsCustomInspectSymbol)]; - - if (typeof customInspectFn === 'function') { - return customInspectFn; - } - - if (typeof object.inspect === 'function') { - return object.inspect; - } -} - -function getObjectTag(object) { - var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); - - if (tag === 'Object' && typeof object.constructor === 'function') { - var name = object.constructor.name; - - if (typeof name === 'string' && name !== '') { - return name; - } - } - - return tag; -} diff --git a/node_modules/graphql/jsutils/instanceOf.js b/node_modules/graphql/jsutils/instanceOf.js deleted file mode 100644 index be043b77..00000000 --- a/node_modules/graphql/jsutils/instanceOf.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** - * A replacement for instanceof which includes an error warning when multi-realm - * constructors are detected. - */ -// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production -// See: https://webpack.js.org/guides/production/ -var _default = process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -// eslint-disable-next-line no-shadow -function instanceOf(value, constructor) { - return value instanceof constructor; -} : // eslint-disable-next-line no-shadow -function instanceOf(value, constructor) { - if (value instanceof constructor) { - return true; - } - - if (value) { - var valueClass = value.constructor; - var className = constructor.name; - - if (className && valueClass && valueClass.name === className) { - throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.")); - } - } - - return false; -}; - -exports.default = _default; diff --git a/node_modules/graphql/jsutils/instanceOf.js.flow b/node_modules/graphql/jsutils/instanceOf.js.flow deleted file mode 100644 index 81042932..00000000 --- a/node_modules/graphql/jsutils/instanceOf.js.flow +++ /dev/null @@ -1,45 +0,0 @@ -// @flow strict -/** - * A replacement for instanceof which includes an error warning when multi-realm - * constructors are detected. - */ -declare function instanceOf( - value: mixed, - constructor: mixed, -): boolean %checks(value instanceof constructor); - -// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production -// See: https://webpack.js.org/guides/production/ -export default process.env.NODE_ENV === 'production' - ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - // eslint-disable-next-line no-shadow - function instanceOf(value: mixed, constructor: mixed): boolean { - return value instanceof constructor; - } - : // eslint-disable-next-line no-shadow - function instanceOf(value: any, constructor: any): boolean { - if (value instanceof constructor) { - return true; - } - if (value) { - const valueClass = value.constructor; - const className = constructor.name; - if (className && valueClass && valueClass.name === className) { - throw new Error( - `Cannot use ${className} "${value}" from another module or realm. - -Ensure that there is only one instance of "graphql" in the node_modules -directory. If different versions of "graphql" are the dependencies of other -relied on modules, use "resolutions" to ensure only one version is installed. - -https://yarnpkg.com/en/docs/selective-version-resolutions - -Duplicate "graphql" modules cannot be used at the same time since different -versions may have different capabilities and behavior. The data from one -version used in the function from another could produce confusing and -spurious results.`, - ); - } - } - return false; - }; diff --git a/node_modules/graphql/jsutils/instanceOf.mjs b/node_modules/graphql/jsutils/instanceOf.mjs deleted file mode 100644 index 35705313..00000000 --- a/node_modules/graphql/jsutils/instanceOf.mjs +++ /dev/null @@ -1,27 +0,0 @@ -/** - * A replacement for instanceof which includes an error warning when multi-realm - * constructors are detected. - */ -// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production -// See: https://webpack.js.org/guides/production/ -export default process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -// eslint-disable-next-line no-shadow -function instanceOf(value, constructor) { - return value instanceof constructor; -} : // eslint-disable-next-line no-shadow -function instanceOf(value, constructor) { - if (value instanceof constructor) { - return true; - } - - if (value) { - var valueClass = value.constructor; - var className = constructor.name; - - if (className && valueClass && valueClass.name === className) { - throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.")); - } - } - - return false; -}; diff --git a/node_modules/graphql/jsutils/invariant.js b/node_modules/graphql/jsutils/invariant.js deleted file mode 100644 index 2e9e16b3..00000000 --- a/node_modules/graphql/jsutils/invariant.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = invariant; - -function invariant(condition, message) { - var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') - - if (!booleanCondition) { - throw new Error(message != null ? message : 'Unexpected invariant triggered.'); - } -} diff --git a/node_modules/graphql/jsutils/invariant.js.flow b/node_modules/graphql/jsutils/invariant.js.flow deleted file mode 100644 index 62685713..00000000 --- a/node_modules/graphql/jsutils/invariant.js.flow +++ /dev/null @@ -1,10 +0,0 @@ -// @flow strict -export default function invariant(condition: mixed, message?: string): void { - const booleanCondition = Boolean(condition); - // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') - if (!booleanCondition) { - throw new Error( - message != null ? message : 'Unexpected invariant triggered.', - ); - } -} diff --git a/node_modules/graphql/jsutils/invariant.mjs b/node_modules/graphql/jsutils/invariant.mjs deleted file mode 100644 index f1aa4a68..00000000 --- a/node_modules/graphql/jsutils/invariant.mjs +++ /dev/null @@ -1,7 +0,0 @@ -export default function invariant(condition, message) { - var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') - - if (!booleanCondition) { - throw new Error(message != null ? message : 'Unexpected invariant triggered.'); - } -} diff --git a/node_modules/graphql/jsutils/isAsyncIterable.js b/node_modules/graphql/jsutils/isAsyncIterable.js deleted file mode 100644 index 0cc346c8..00000000 --- a/node_modules/graphql/jsutils/isAsyncIterable.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isAsyncIterable; - -var _symbols = require("../polyfills/symbols.js"); - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -// eslint-disable-next-line no-redeclare -function isAsyncIterable(maybeAsyncIterable) { - if (maybeAsyncIterable == null || _typeof(maybeAsyncIterable) !== 'object') { - return false; - } - - return typeof maybeAsyncIterable[_symbols.SYMBOL_ASYNC_ITERATOR] === 'function'; -} diff --git a/node_modules/graphql/jsutils/isAsyncIterable.js.flow b/node_modules/graphql/jsutils/isAsyncIterable.js.flow deleted file mode 100644 index 17e297de..00000000 --- a/node_modules/graphql/jsutils/isAsyncIterable.js.flow +++ /dev/null @@ -1,18 +0,0 @@ -// @flow strict -import { SYMBOL_ASYNC_ITERATOR } from '../polyfills/symbols'; - -/** - * Returns true if the provided object implements the AsyncIterator protocol via - * either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method. - */ -declare function isAsyncIterable(value: mixed): boolean %checks(value instanceof - AsyncIterable); - -// eslint-disable-next-line no-redeclare -export default function isAsyncIterable(maybeAsyncIterable) { - if (maybeAsyncIterable == null || typeof maybeAsyncIterable !== 'object') { - return false; - } - - return typeof maybeAsyncIterable[SYMBOL_ASYNC_ITERATOR] === 'function'; -} diff --git a/node_modules/graphql/jsutils/isAsyncIterable.mjs b/node_modules/graphql/jsutils/isAsyncIterable.mjs deleted file mode 100644 index b6243d5d..00000000 --- a/node_modules/graphql/jsutils/isAsyncIterable.mjs +++ /dev/null @@ -1,16 +0,0 @@ -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -import { SYMBOL_ASYNC_ITERATOR } from "../polyfills/symbols.mjs"; -/** - * Returns true if the provided object implements the AsyncIterator protocol via - * either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method. - */ - -// eslint-disable-next-line no-redeclare -export default function isAsyncIterable(maybeAsyncIterable) { - if (maybeAsyncIterable == null || _typeof(maybeAsyncIterable) !== 'object') { - return false; - } - - return typeof maybeAsyncIterable[SYMBOL_ASYNC_ITERATOR] === 'function'; -} diff --git a/node_modules/graphql/jsutils/isCollection.js b/node_modules/graphql/jsutils/isCollection.js deleted file mode 100644 index dc35ed66..00000000 --- a/node_modules/graphql/jsutils/isCollection.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isCollection; - -var _symbols = require("../polyfills/symbols.js"); - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/** - * Returns true if the provided object is an Object (i.e. not a string literal) - * and is either Iterable or Array-like. - * - * This may be used in place of [Array.isArray()][isArray] to determine if an - * object should be iterated-over. It always excludes string literals and - * includes Arrays (regardless of if it is Iterable). It also includes other - * Array-like objects such as NodeList, TypedArray, and Buffer. - * - * @example - * - * isCollection([ 1, 2, 3 ]) // true - * isCollection('ABC') // false - * isCollection({ length: 1, 0: 'Alpha' }) // true - * isCollection({ key: 'value' }) // false - * isCollection(new Map()) // true - * - * @param obj - * An Object value which might implement the Iterable or Array-like protocols. - * @return {boolean} true if Iterable or Array-like Object. - */ -function isCollection(obj) { - if (obj == null || _typeof(obj) !== 'object') { - return false; - } // Is Array like? - - - var length = obj.length; - - if (typeof length === 'number' && length >= 0 && length % 1 === 0) { - return true; - } // Is Iterable? - - - return typeof obj[_symbols.SYMBOL_ITERATOR] === 'function'; -} diff --git a/node_modules/graphql/jsutils/isCollection.js.flow b/node_modules/graphql/jsutils/isCollection.js.flow deleted file mode 100644 index 16f15bf0..00000000 --- a/node_modules/graphql/jsutils/isCollection.js.flow +++ /dev/null @@ -1,38 +0,0 @@ -// @flow strict -import { SYMBOL_ITERATOR } from '../polyfills/symbols'; - -/** - * Returns true if the provided object is an Object (i.e. not a string literal) - * and is either Iterable or Array-like. - * - * This may be used in place of [Array.isArray()][isArray] to determine if an - * object should be iterated-over. It always excludes string literals and - * includes Arrays (regardless of if it is Iterable). It also includes other - * Array-like objects such as NodeList, TypedArray, and Buffer. - * - * @example - * - * isCollection([ 1, 2, 3 ]) // true - * isCollection('ABC') // false - * isCollection({ length: 1, 0: 'Alpha' }) // true - * isCollection({ key: 'value' }) // false - * isCollection(new Map()) // true - * - * @param obj - * An Object value which might implement the Iterable or Array-like protocols. - * @return {boolean} true if Iterable or Array-like Object. - */ -export default function isCollection(obj: mixed): boolean { - if (obj == null || typeof obj !== 'object') { - return false; - } - - // Is Array like? - const length = obj.length; - if (typeof length === 'number' && length >= 0 && length % 1 === 0) { - return true; - } - - // Is Iterable? - return typeof obj[SYMBOL_ITERATOR] === 'function'; -} diff --git a/node_modules/graphql/jsutils/isCollection.mjs b/node_modules/graphql/jsutils/isCollection.mjs deleted file mode 100644 index 43c1d250..00000000 --- a/node_modules/graphql/jsutils/isCollection.mjs +++ /dev/null @@ -1,40 +0,0 @@ -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -import { SYMBOL_ITERATOR } from "../polyfills/symbols.mjs"; -/** - * Returns true if the provided object is an Object (i.e. not a string literal) - * and is either Iterable or Array-like. - * - * This may be used in place of [Array.isArray()][isArray] to determine if an - * object should be iterated-over. It always excludes string literals and - * includes Arrays (regardless of if it is Iterable). It also includes other - * Array-like objects such as NodeList, TypedArray, and Buffer. - * - * @example - * - * isCollection([ 1, 2, 3 ]) // true - * isCollection('ABC') // false - * isCollection({ length: 1, 0: 'Alpha' }) // true - * isCollection({ key: 'value' }) // false - * isCollection(new Map()) // true - * - * @param obj - * An Object value which might implement the Iterable or Array-like protocols. - * @return {boolean} true if Iterable or Array-like Object. - */ - -export default function isCollection(obj) { - if (obj == null || _typeof(obj) !== 'object') { - return false; - } // Is Array like? - - - var length = obj.length; - - if (typeof length === 'number' && length >= 0 && length % 1 === 0) { - return true; - } // Is Iterable? - - - return typeof obj[SYMBOL_ITERATOR] === 'function'; -} diff --git a/node_modules/graphql/jsutils/isObjectLike.js b/node_modules/graphql/jsutils/isObjectLike.js deleted file mode 100644 index 19c9a890..00000000 --- a/node_modules/graphql/jsutils/isObjectLike.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isObjectLike; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/** - * Return true if `value` is object-like. A value is object-like if it's not - * `null` and has a `typeof` result of "object". - */ -function isObjectLike(value) { - return _typeof(value) == 'object' && value !== null; -} diff --git a/node_modules/graphql/jsutils/isObjectLike.js.flow b/node_modules/graphql/jsutils/isObjectLike.js.flow deleted file mode 100644 index 86886ab2..00000000 --- a/node_modules/graphql/jsutils/isObjectLike.js.flow +++ /dev/null @@ -1,8 +0,0 @@ -// @flow strict -/** - * Return true if `value` is object-like. A value is object-like if it's not - * `null` and has a `typeof` result of "object". - */ -export default function isObjectLike(value: mixed): boolean %checks { - return typeof value == 'object' && value !== null; -} diff --git a/node_modules/graphql/jsutils/isObjectLike.mjs b/node_modules/graphql/jsutils/isObjectLike.mjs deleted file mode 100644 index 41dc3cd3..00000000 --- a/node_modules/graphql/jsutils/isObjectLike.mjs +++ /dev/null @@ -1,9 +0,0 @@ -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/** - * Return true if `value` is object-like. A value is object-like if it's not - * `null` and has a `typeof` result of "object". - */ -export default function isObjectLike(value) { - return _typeof(value) == 'object' && value !== null; -} diff --git a/node_modules/graphql/jsutils/isPromise.js b/node_modules/graphql/jsutils/isPromise.js deleted file mode 100644 index bca6cccc..00000000 --- a/node_modules/graphql/jsutils/isPromise.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isPromise; - -/** - * Returns true if the value acts like a Promise, i.e. has a "then" function, - * otherwise returns false. - */ -// eslint-disable-next-line no-redeclare -function isPromise(value) { - return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; -} diff --git a/node_modules/graphql/jsutils/isPromise.js.flow b/node_modules/graphql/jsutils/isPromise.js.flow deleted file mode 100644 index f5c9f754..00000000 --- a/node_modules/graphql/jsutils/isPromise.js.flow +++ /dev/null @@ -1,12 +0,0 @@ -// @flow strict -/** - * Returns true if the value acts like a Promise, i.e. has a "then" function, - * otherwise returns false. - */ -declare function isPromise(value: mixed): boolean %checks(value instanceof - Promise); - -// eslint-disable-next-line no-redeclare -export default function isPromise(value) { - return typeof value?.then === 'function'; -} diff --git a/node_modules/graphql/jsutils/isPromise.mjs b/node_modules/graphql/jsutils/isPromise.mjs deleted file mode 100644 index 2d9079b2..00000000 --- a/node_modules/graphql/jsutils/isPromise.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Returns true if the value acts like a Promise, i.e. has a "then" function, - * otherwise returns false. - */ -// eslint-disable-next-line no-redeclare -export default function isPromise(value) { - return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; -} diff --git a/node_modules/graphql/jsutils/keyMap.js b/node_modules/graphql/jsutils/keyMap.js deleted file mode 100644 index c0672101..00000000 --- a/node_modules/graphql/jsutils/keyMap.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = keyMap; - -/** - * Creates a keyed JS object from an array, given a function to produce the keys - * for each value in the array. - * - * This provides a convenient lookup for the array items if the key function - * produces unique results. - * - * const phoneBook = [ - * { name: 'Jon', num: '555-1234' }, - * { name: 'Jenny', num: '867-5309' } - * ] - * - * // { Jon: { name: 'Jon', num: '555-1234' }, - * // Jenny: { name: 'Jenny', num: '867-5309' } } - * const entriesByName = keyMap( - * phoneBook, - * entry => entry.name - * ) - * - * // { name: 'Jenny', num: '857-6309' } - * const jennyEntry = entriesByName['Jenny'] - * - */ -function keyMap(list, keyFn) { - return list.reduce(function (map, item) { - map[keyFn(item)] = item; - return map; - }, Object.create(null)); -} diff --git a/node_modules/graphql/jsutils/keyMap.js.flow b/node_modules/graphql/jsutils/keyMap.js.flow deleted file mode 100644 index b165360e..00000000 --- a/node_modules/graphql/jsutils/keyMap.js.flow +++ /dev/null @@ -1,35 +0,0 @@ -// @flow strict -import type { ObjMap } from './ObjMap'; - -/** - * Creates a keyed JS object from an array, given a function to produce the keys - * for each value in the array. - * - * This provides a convenient lookup for the array items if the key function - * produces unique results. - * - * const phoneBook = [ - * { name: 'Jon', num: '555-1234' }, - * { name: 'Jenny', num: '867-5309' } - * ] - * - * // { Jon: { name: 'Jon', num: '555-1234' }, - * // Jenny: { name: 'Jenny', num: '867-5309' } } - * const entriesByName = keyMap( - * phoneBook, - * entry => entry.name - * ) - * - * // { name: 'Jenny', num: '857-6309' } - * const jennyEntry = entriesByName['Jenny'] - * - */ -export default function keyMap( - list: $ReadOnlyArray, - keyFn: (item: T) => string, -): ObjMap { - return list.reduce((map, item) => { - map[keyFn(item)] = item; - return map; - }, Object.create(null)); -} diff --git a/node_modules/graphql/jsutils/keyMap.mjs b/node_modules/graphql/jsutils/keyMap.mjs deleted file mode 100644 index 567dd86a..00000000 --- a/node_modules/graphql/jsutils/keyMap.mjs +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Creates a keyed JS object from an array, given a function to produce the keys - * for each value in the array. - * - * This provides a convenient lookup for the array items if the key function - * produces unique results. - * - * const phoneBook = [ - * { name: 'Jon', num: '555-1234' }, - * { name: 'Jenny', num: '867-5309' } - * ] - * - * // { Jon: { name: 'Jon', num: '555-1234' }, - * // Jenny: { name: 'Jenny', num: '867-5309' } } - * const entriesByName = keyMap( - * phoneBook, - * entry => entry.name - * ) - * - * // { name: 'Jenny', num: '857-6309' } - * const jennyEntry = entriesByName['Jenny'] - * - */ -export default function keyMap(list, keyFn) { - return list.reduce(function (map, item) { - map[keyFn(item)] = item; - return map; - }, Object.create(null)); -} diff --git a/node_modules/graphql/jsutils/keyValMap.js b/node_modules/graphql/jsutils/keyValMap.js deleted file mode 100644 index 0b2dab52..00000000 --- a/node_modules/graphql/jsutils/keyValMap.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = keyValMap; - -/** - * Creates a keyed JS object from an array, given a function to produce the keys - * and a function to produce the values from each item in the array. - * - * const phoneBook = [ - * { name: 'Jon', num: '555-1234' }, - * { name: 'Jenny', num: '867-5309' } - * ] - * - * // { Jon: '555-1234', Jenny: '867-5309' } - * const phonesByName = keyValMap( - * phoneBook, - * entry => entry.name, - * entry => entry.num - * ) - * - */ -function keyValMap(list, keyFn, valFn) { - return list.reduce(function (map, item) { - map[keyFn(item)] = valFn(item); - return map; - }, Object.create(null)); -} diff --git a/node_modules/graphql/jsutils/keyValMap.js.flow b/node_modules/graphql/jsutils/keyValMap.js.flow deleted file mode 100644 index d3aa602b..00000000 --- a/node_modules/graphql/jsutils/keyValMap.js.flow +++ /dev/null @@ -1,30 +0,0 @@ -// @flow strict -import type { ObjMap } from './ObjMap'; - -/** - * Creates a keyed JS object from an array, given a function to produce the keys - * and a function to produce the values from each item in the array. - * - * const phoneBook = [ - * { name: 'Jon', num: '555-1234' }, - * { name: 'Jenny', num: '867-5309' } - * ] - * - * // { Jon: '555-1234', Jenny: '867-5309' } - * const phonesByName = keyValMap( - * phoneBook, - * entry => entry.name, - * entry => entry.num - * ) - * - */ -export default function keyValMap( - list: $ReadOnlyArray, - keyFn: (item: T) => string, - valFn: (item: T) => V, -): ObjMap { - return list.reduce((map, item) => { - map[keyFn(item)] = valFn(item); - return map; - }, Object.create(null)); -} diff --git a/node_modules/graphql/jsutils/keyValMap.mjs b/node_modules/graphql/jsutils/keyValMap.mjs deleted file mode 100644 index 5061c666..00000000 --- a/node_modules/graphql/jsutils/keyValMap.mjs +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Creates a keyed JS object from an array, given a function to produce the keys - * and a function to produce the values from each item in the array. - * - * const phoneBook = [ - * { name: 'Jon', num: '555-1234' }, - * { name: 'Jenny', num: '867-5309' } - * ] - * - * // { Jon: '555-1234', Jenny: '867-5309' } - * const phonesByName = keyValMap( - * phoneBook, - * entry => entry.name, - * entry => entry.num - * ) - * - */ -export default function keyValMap(list, keyFn, valFn) { - return list.reduce(function (map, item) { - map[keyFn(item)] = valFn(item); - return map; - }, Object.create(null)); -} diff --git a/node_modules/graphql/jsutils/mapValue.js b/node_modules/graphql/jsutils/mapValue.js deleted file mode 100644 index 77d90386..00000000 --- a/node_modules/graphql/jsutils/mapValue.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = mapValue; - -var _objectEntries3 = _interopRequireDefault(require("../polyfills/objectEntries.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Creates an object map with the same keys as `map` and values generated by - * running each value of `map` thru `fn`. - */ -function mapValue(map, fn) { - var result = Object.create(null); - - for (var _i2 = 0, _objectEntries2 = (0, _objectEntries3.default)(map); _i2 < _objectEntries2.length; _i2++) { - var _ref2 = _objectEntries2[_i2]; - var _key = _ref2[0]; - var _value = _ref2[1]; - result[_key] = fn(_value, _key); - } - - return result; -} diff --git a/node_modules/graphql/jsutils/mapValue.js.flow b/node_modules/graphql/jsutils/mapValue.js.flow deleted file mode 100644 index d6b5da44..00000000 --- a/node_modules/graphql/jsutils/mapValue.js.flow +++ /dev/null @@ -1,20 +0,0 @@ -// @flow strict -import objectEntries from '../polyfills/objectEntries'; - -import type { ObjMap } from './ObjMap'; - -/** - * Creates an object map with the same keys as `map` and values generated by - * running each value of `map` thru `fn`. - */ -export default function mapValue( - map: ObjMap, - fn: (value: T, key: string) => V, -): ObjMap { - const result = Object.create(null); - - for (const [key, value] of objectEntries(map)) { - result[key] = fn(value, key); - } - return result; -} diff --git a/node_modules/graphql/jsutils/mapValue.mjs b/node_modules/graphql/jsutils/mapValue.mjs deleted file mode 100644 index 7992abb7..00000000 --- a/node_modules/graphql/jsutils/mapValue.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import objectEntries from "../polyfills/objectEntries.mjs"; - -/** - * Creates an object map with the same keys as `map` and values generated by - * running each value of `map` thru `fn`. - */ -export default function mapValue(map, fn) { - var result = Object.create(null); - - for (var _i2 = 0, _objectEntries2 = objectEntries(map); _i2 < _objectEntries2.length; _i2++) { - var _ref2 = _objectEntries2[_i2]; - var _key = _ref2[0]; - var _value = _ref2[1]; - result[_key] = fn(_value, _key); - } - - return result; -} diff --git a/node_modules/graphql/jsutils/memoize3.js b/node_modules/graphql/jsutils/memoize3.js deleted file mode 100644 index db98f3f4..00000000 --- a/node_modules/graphql/jsutils/memoize3.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = memoize3; - -/** - * Memoizes the provided three-argument function. - */ -function memoize3(fn) { - var cache0; - return function memoized(a1, a2, a3) { - if (!cache0) { - cache0 = new WeakMap(); - } - - var cache1 = cache0.get(a1); - var cache2; - - if (cache1) { - cache2 = cache1.get(a2); - - if (cache2) { - var cachedValue = cache2.get(a3); - - if (cachedValue !== undefined) { - return cachedValue; - } - } - } else { - cache1 = new WeakMap(); - cache0.set(a1, cache1); - } - - if (!cache2) { - cache2 = new WeakMap(); - cache1.set(a2, cache2); - } - - var newValue = fn(a1, a2, a3); - cache2.set(a3, newValue); - return newValue; - }; -} diff --git a/node_modules/graphql/jsutils/memoize3.js.flow b/node_modules/graphql/jsutils/memoize3.js.flow deleted file mode 100644 index cd4ccd5a..00000000 --- a/node_modules/graphql/jsutils/memoize3.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -// @flow strict -/** - * Memoizes the provided three-argument function. - */ -export default function memoize3< - A1: { ... } | $ReadOnlyArray, - A2: { ... } | $ReadOnlyArray, - A3: { ... } | $ReadOnlyArray, - R: mixed, ->(fn: (A1, A2, A3) => R): (A1, A2, A3) => R { - let cache0; - - return function memoized(a1, a2, a3) { - if (!cache0) { - cache0 = new WeakMap(); - } - let cache1 = cache0.get(a1); - let cache2; - if (cache1) { - cache2 = cache1.get(a2); - if (cache2) { - const cachedValue = cache2.get(a3); - if (cachedValue !== undefined) { - return cachedValue; - } - } - } else { - cache1 = new WeakMap(); - cache0.set(a1, cache1); - } - if (!cache2) { - cache2 = new WeakMap(); - cache1.set(a2, cache2); - } - const newValue = fn(a1, a2, a3); - cache2.set(a3, newValue); - return newValue; - }; -} diff --git a/node_modules/graphql/jsutils/memoize3.mjs b/node_modules/graphql/jsutils/memoize3.mjs deleted file mode 100644 index cfaeb778..00000000 --- a/node_modules/graphql/jsutils/memoize3.mjs +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Memoizes the provided three-argument function. - */ -export default function memoize3(fn) { - var cache0; - return function memoized(a1, a2, a3) { - if (!cache0) { - cache0 = new WeakMap(); - } - - var cache1 = cache0.get(a1); - var cache2; - - if (cache1) { - cache2 = cache1.get(a2); - - if (cache2) { - var cachedValue = cache2.get(a3); - - if (cachedValue !== undefined) { - return cachedValue; - } - } - } else { - cache1 = new WeakMap(); - cache0.set(a1, cache1); - } - - if (!cache2) { - cache2 = new WeakMap(); - cache1.set(a2, cache2); - } - - var newValue = fn(a1, a2, a3); - cache2.set(a3, newValue); - return newValue; - }; -} diff --git a/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js b/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js deleted file mode 100644 index 3a128333..00000000 --- a/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; -var _default = nodejsCustomInspectSymbol; -exports.default = _default; diff --git a/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js.flow b/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js.flow deleted file mode 100644 index 114489cd..00000000 --- a/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js.flow +++ /dev/null @@ -1,8 +0,0 @@ -// @flow strict -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -const nodejsCustomInspectSymbol = - typeof Symbol === 'function' && typeof Symbol.for === 'function' - ? Symbol.for('nodejs.util.inspect.custom') - : undefined; - -export default nodejsCustomInspectSymbol; diff --git a/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs b/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs deleted file mode 100644 index afaf3e6e..00000000 --- a/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs +++ /dev/null @@ -1,3 +0,0 @@ -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; -export default nodejsCustomInspectSymbol; diff --git a/node_modules/graphql/jsutils/printPathArray.js b/node_modules/graphql/jsutils/printPathArray.js deleted file mode 100644 index 31224eb1..00000000 --- a/node_modules/graphql/jsutils/printPathArray.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = printPathArray; - -/** - * Build a string describing the path. - */ -function printPathArray(path) { - return path.map(function (key) { - return typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key; - }).join(''); -} diff --git a/node_modules/graphql/jsutils/printPathArray.js.flow b/node_modules/graphql/jsutils/printPathArray.js.flow deleted file mode 100644 index 552a4156..00000000 --- a/node_modules/graphql/jsutils/printPathArray.js.flow +++ /dev/null @@ -1,13 +0,0 @@ -// @flow strict -/** - * Build a string describing the path. - */ -export default function printPathArray( - path: $ReadOnlyArray, -): string { - return path - .map((key) => - typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key, - ) - .join(''); -} diff --git a/node_modules/graphql/jsutils/printPathArray.mjs b/node_modules/graphql/jsutils/printPathArray.mjs deleted file mode 100644 index 6bf077a5..00000000 --- a/node_modules/graphql/jsutils/printPathArray.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Build a string describing the path. - */ -export default function printPathArray(path) { - return path.map(function (key) { - return typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key; - }).join(''); -} diff --git a/node_modules/graphql/jsutils/promiseForObject.js b/node_modules/graphql/jsutils/promiseForObject.js deleted file mode 100644 index f291f9bd..00000000 --- a/node_modules/graphql/jsutils/promiseForObject.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = promiseForObject; - -/** - * This function transforms a JS object `ObjMap>` into - * a `Promise>` - * - * This is akin to bluebird's `Promise.props`, but implemented only using - * `Promise.all` so it will work with any implementation of ES6 promises. - */ -function promiseForObject(object) { - var keys = Object.keys(object); - var valuesAndPromises = keys.map(function (name) { - return object[name]; - }); - return Promise.all(valuesAndPromises).then(function (values) { - return values.reduce(function (resolvedObject, value, i) { - resolvedObject[keys[i]] = value; - return resolvedObject; - }, Object.create(null)); - }); -} diff --git a/node_modules/graphql/jsutils/promiseForObject.js.flow b/node_modules/graphql/jsutils/promiseForObject.js.flow deleted file mode 100644 index 5c2c65bb..00000000 --- a/node_modules/graphql/jsutils/promiseForObject.js.flow +++ /dev/null @@ -1,22 +0,0 @@ -// @flow strict -import type { ObjMap } from './ObjMap'; - -/** - * This function transforms a JS object `ObjMap>` into - * a `Promise>` - * - * This is akin to bluebird's `Promise.props`, but implemented only using - * `Promise.all` so it will work with any implementation of ES6 promises. - */ -export default function promiseForObject( - object: ObjMap>, -): Promise> { - const keys = Object.keys(object); - const valuesAndPromises = keys.map((name) => object[name]); - return Promise.all(valuesAndPromises).then((values) => - values.reduce((resolvedObject, value, i) => { - resolvedObject[keys[i]] = value; - return resolvedObject; - }, Object.create(null)), - ); -} diff --git a/node_modules/graphql/jsutils/promiseForObject.mjs b/node_modules/graphql/jsutils/promiseForObject.mjs deleted file mode 100644 index ee36ed45..00000000 --- a/node_modules/graphql/jsutils/promiseForObject.mjs +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This function transforms a JS object `ObjMap>` into - * a `Promise>` - * - * This is akin to bluebird's `Promise.props`, but implemented only using - * `Promise.all` so it will work with any implementation of ES6 promises. - */ -export default function promiseForObject(object) { - var keys = Object.keys(object); - var valuesAndPromises = keys.map(function (name) { - return object[name]; - }); - return Promise.all(valuesAndPromises).then(function (values) { - return values.reduce(function (resolvedObject, value, i) { - resolvedObject[keys[i]] = value; - return resolvedObject; - }, Object.create(null)); - }); -} diff --git a/node_modules/graphql/jsutils/promiseReduce.js b/node_modules/graphql/jsutils/promiseReduce.js deleted file mode 100644 index 6606926d..00000000 --- a/node_modules/graphql/jsutils/promiseReduce.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = promiseReduce; - -var _isPromise = _interopRequireDefault(require("./isPromise.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Similar to Array.prototype.reduce(), however the reducing callback may return - * a Promise, in which case reduction will continue after each promise resolves. - * - * If the callback does not return a Promise, then this function will also not - * return a Promise. - */ -function promiseReduce(values, callback, initialValue) { - return values.reduce(function (previous, value) { - return (0, _isPromise.default)(previous) ? previous.then(function (resolved) { - return callback(resolved, value); - }) : callback(previous, value); - }, initialValue); -} diff --git a/node_modules/graphql/jsutils/promiseReduce.js.flow b/node_modules/graphql/jsutils/promiseReduce.js.flow deleted file mode 100644 index ea333bcc..00000000 --- a/node_modules/graphql/jsutils/promiseReduce.js.flow +++ /dev/null @@ -1,25 +0,0 @@ -// @flow strict -import type { PromiseOrValue } from './PromiseOrValue'; - -import isPromise from './isPromise'; - -/** - * Similar to Array.prototype.reduce(), however the reducing callback may return - * a Promise, in which case reduction will continue after each promise resolves. - * - * If the callback does not return a Promise, then this function will also not - * return a Promise. - */ -export default function promiseReduce( - values: $ReadOnlyArray, - callback: (U, T) => PromiseOrValue, - initialValue: PromiseOrValue, -): PromiseOrValue { - return values.reduce( - (previous, value) => - isPromise(previous) - ? previous.then((resolved) => callback(resolved, value)) - : callback(previous, value), - initialValue, - ); -} diff --git a/node_modules/graphql/jsutils/promiseReduce.mjs b/node_modules/graphql/jsutils/promiseReduce.mjs deleted file mode 100644 index db99d5d0..00000000 --- a/node_modules/graphql/jsutils/promiseReduce.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import isPromise from "./isPromise.mjs"; -/** - * Similar to Array.prototype.reduce(), however the reducing callback may return - * a Promise, in which case reduction will continue after each promise resolves. - * - * If the callback does not return a Promise, then this function will also not - * return a Promise. - */ - -export default function promiseReduce(values, callback, initialValue) { - return values.reduce(function (previous, value) { - return isPromise(previous) ? previous.then(function (resolved) { - return callback(resolved, value); - }) : callback(previous, value); - }, initialValue); -} diff --git a/node_modules/graphql/jsutils/suggestionList.js b/node_modules/graphql/jsutils/suggestionList.js deleted file mode 100644 index cceff402..00000000 --- a/node_modules/graphql/jsutils/suggestionList.js +++ /dev/null @@ -1,137 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = suggestionList; - -/** - * Given an invalid input string and a list of valid options, returns a filtered - * list of valid options sorted based on their similarity with the input. - */ -function suggestionList(input, options) { - var optionsByDistance = Object.create(null); - var lexicalDistance = new LexicalDistance(input); - var threshold = Math.floor(input.length * 0.4) + 1; - - for (var _i2 = 0; _i2 < options.length; _i2++) { - var option = options[_i2]; - var distance = lexicalDistance.measure(option, threshold); - - if (distance !== undefined) { - optionsByDistance[option] = distance; - } - } - - return Object.keys(optionsByDistance).sort(function (a, b) { - var distanceDiff = optionsByDistance[a] - optionsByDistance[b]; - return distanceDiff !== 0 ? distanceDiff : a.localeCompare(b); - }); -} -/** - * Computes the lexical distance between strings A and B. - * - * The "distance" between two strings is given by counting the minimum number - * of edits needed to transform string A into string B. An edit can be an - * insertion, deletion, or substitution of a single character, or a swap of two - * adjacent characters. - * - * Includes a custom alteration from Damerau-Levenshtein to treat case changes - * as a single edit which helps identify mis-cased values with an edit distance - * of 1. - * - * This distance can be useful for detecting typos in input or sorting - */ - - -var LexicalDistance = /*#__PURE__*/function () { - function LexicalDistance(input) { - this._input = input; - this._inputLowerCase = input.toLowerCase(); - this._inputArray = stringToArray(this._inputLowerCase); - this._rows = [new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0)]; - } - - var _proto = LexicalDistance.prototype; - - _proto.measure = function measure(option, threshold) { - if (this._input === option) { - return 0; - } - - var optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit - - if (this._inputLowerCase === optionLowerCase) { - return 1; - } - - var a = stringToArray(optionLowerCase); - var b = this._inputArray; - - if (a.length < b.length) { - var tmp = a; - a = b; - b = tmp; - } - - var aLength = a.length; - var bLength = b.length; - - if (aLength - bLength > threshold) { - return undefined; - } - - var rows = this._rows; - - for (var j = 0; j <= bLength; j++) { - rows[0][j] = j; - } - - for (var i = 1; i <= aLength; i++) { - var upRow = rows[(i - 1) % 3]; - var currentRow = rows[i % 3]; - var smallestCell = currentRow[0] = i; - - for (var _j = 1; _j <= bLength; _j++) { - var cost = a[i - 1] === b[_j - 1] ? 0 : 1; - var currentCell = Math.min(upRow[_j] + 1, // delete - currentRow[_j - 1] + 1, // insert - upRow[_j - 1] + cost // substitute - ); - - if (i > 1 && _j > 1 && a[i - 1] === b[_j - 2] && a[i - 2] === b[_j - 1]) { - // transposition - var doubleDiagonalCell = rows[(i - 2) % 3][_j - 2]; - currentCell = Math.min(currentCell, doubleDiagonalCell + 1); - } - - if (currentCell < smallestCell) { - smallestCell = currentCell; - } - - currentRow[_j] = currentCell; - } // Early exit, since distance can't go smaller than smallest element of the previous row. - - - if (smallestCell > threshold) { - return undefined; - } - } - - var distance = rows[aLength % 3][bLength]; - return distance <= threshold ? distance : undefined; - }; - - return LexicalDistance; -}(); - -function stringToArray(str) { - var strLength = str.length; - var array = new Array(strLength); - - for (var i = 0; i < strLength; ++i) { - array[i] = str.charCodeAt(i); - } - - return array; -} diff --git a/node_modules/graphql/jsutils/suggestionList.js.flow b/node_modules/graphql/jsutils/suggestionList.js.flow deleted file mode 100644 index 4f8cdbc0..00000000 --- a/node_modules/graphql/jsutils/suggestionList.js.flow +++ /dev/null @@ -1,136 +0,0 @@ -// @flow strict -/** - * Given an invalid input string and a list of valid options, returns a filtered - * list of valid options sorted based on their similarity with the input. - */ -export default function suggestionList( - input: string, - options: $ReadOnlyArray, -): Array { - const optionsByDistance = Object.create(null); - const lexicalDistance = new LexicalDistance(input); - - const threshold = Math.floor(input.length * 0.4) + 1; - for (const option of options) { - const distance = lexicalDistance.measure(option, threshold); - if (distance !== undefined) { - optionsByDistance[option] = distance; - } - } - - return Object.keys(optionsByDistance).sort((a, b) => { - const distanceDiff = optionsByDistance[a] - optionsByDistance[b]; - return distanceDiff !== 0 ? distanceDiff : a.localeCompare(b); - }); -} - -/** - * Computes the lexical distance between strings A and B. - * - * The "distance" between two strings is given by counting the minimum number - * of edits needed to transform string A into string B. An edit can be an - * insertion, deletion, or substitution of a single character, or a swap of two - * adjacent characters. - * - * Includes a custom alteration from Damerau-Levenshtein to treat case changes - * as a single edit which helps identify mis-cased values with an edit distance - * of 1. - * - * This distance can be useful for detecting typos in input or sorting - */ -class LexicalDistance { - _input: string; - _inputLowerCase: string; - _inputArray: Array; - _rows: [Array, Array, Array]; - - constructor(input: string) { - this._input = input; - this._inputLowerCase = input.toLowerCase(); - this._inputArray = stringToArray(this._inputLowerCase); - - this._rows = [ - new Array(input.length + 1).fill(0), - new Array(input.length + 1).fill(0), - new Array(input.length + 1).fill(0), - ]; - } - - measure(option: string, threshold: number): number | void { - if (this._input === option) { - return 0; - } - - const optionLowerCase = option.toLowerCase(); - - // Any case change counts as a single edit - if (this._inputLowerCase === optionLowerCase) { - return 1; - } - - let a = stringToArray(optionLowerCase); - let b = this._inputArray; - - if (a.length < b.length) { - const tmp = a; - a = b; - b = tmp; - } - const aLength = a.length; - const bLength = b.length; - - if (aLength - bLength > threshold) { - return undefined; - } - - const rows = this._rows; - for (let j = 0; j <= bLength; j++) { - rows[0][j] = j; - } - - for (let i = 1; i <= aLength; i++) { - const upRow = rows[(i - 1) % 3]; - const currentRow = rows[i % 3]; - - let smallestCell = (currentRow[0] = i); - for (let j = 1; j <= bLength; j++) { - const cost = a[i - 1] === b[j - 1] ? 0 : 1; - - let currentCell = Math.min( - upRow[j] + 1, // delete - currentRow[j - 1] + 1, // insert - upRow[j - 1] + cost, // substitute - ); - - if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { - // transposition - const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; - currentCell = Math.min(currentCell, doubleDiagonalCell + 1); - } - - if (currentCell < smallestCell) { - smallestCell = currentCell; - } - - currentRow[j] = currentCell; - } - - // Early exit, since distance can't go smaller than smallest element of the previous row. - if (smallestCell > threshold) { - return undefined; - } - } - - const distance = rows[aLength % 3][bLength]; - return distance <= threshold ? distance : undefined; - } -} - -function stringToArray(str: string): Array { - const strLength = str.length; - const array = new Array(strLength); - for (let i = 0; i < strLength; ++i) { - array[i] = str.charCodeAt(i); - } - return array; -} diff --git a/node_modules/graphql/jsutils/suggestionList.mjs b/node_modules/graphql/jsutils/suggestionList.mjs deleted file mode 100644 index fd589f25..00000000 --- a/node_modules/graphql/jsutils/suggestionList.mjs +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Given an invalid input string and a list of valid options, returns a filtered - * list of valid options sorted based on their similarity with the input. - */ -export default function suggestionList(input, options) { - var optionsByDistance = Object.create(null); - var lexicalDistance = new LexicalDistance(input); - var threshold = Math.floor(input.length * 0.4) + 1; - - for (var _i2 = 0; _i2 < options.length; _i2++) { - var option = options[_i2]; - var distance = lexicalDistance.measure(option, threshold); - - if (distance !== undefined) { - optionsByDistance[option] = distance; - } - } - - return Object.keys(optionsByDistance).sort(function (a, b) { - var distanceDiff = optionsByDistance[a] - optionsByDistance[b]; - return distanceDiff !== 0 ? distanceDiff : a.localeCompare(b); - }); -} -/** - * Computes the lexical distance between strings A and B. - * - * The "distance" between two strings is given by counting the minimum number - * of edits needed to transform string A into string B. An edit can be an - * insertion, deletion, or substitution of a single character, or a swap of two - * adjacent characters. - * - * Includes a custom alteration from Damerau-Levenshtein to treat case changes - * as a single edit which helps identify mis-cased values with an edit distance - * of 1. - * - * This distance can be useful for detecting typos in input or sorting - */ - -var LexicalDistance = /*#__PURE__*/function () { - function LexicalDistance(input) { - this._input = input; - this._inputLowerCase = input.toLowerCase(); - this._inputArray = stringToArray(this._inputLowerCase); - this._rows = [new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0)]; - } - - var _proto = LexicalDistance.prototype; - - _proto.measure = function measure(option, threshold) { - if (this._input === option) { - return 0; - } - - var optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit - - if (this._inputLowerCase === optionLowerCase) { - return 1; - } - - var a = stringToArray(optionLowerCase); - var b = this._inputArray; - - if (a.length < b.length) { - var tmp = a; - a = b; - b = tmp; - } - - var aLength = a.length; - var bLength = b.length; - - if (aLength - bLength > threshold) { - return undefined; - } - - var rows = this._rows; - - for (var j = 0; j <= bLength; j++) { - rows[0][j] = j; - } - - for (var i = 1; i <= aLength; i++) { - var upRow = rows[(i - 1) % 3]; - var currentRow = rows[i % 3]; - var smallestCell = currentRow[0] = i; - - for (var _j = 1; _j <= bLength; _j++) { - var cost = a[i - 1] === b[_j - 1] ? 0 : 1; - var currentCell = Math.min(upRow[_j] + 1, // delete - currentRow[_j - 1] + 1, // insert - upRow[_j - 1] + cost // substitute - ); - - if (i > 1 && _j > 1 && a[i - 1] === b[_j - 2] && a[i - 2] === b[_j - 1]) { - // transposition - var doubleDiagonalCell = rows[(i - 2) % 3][_j - 2]; - currentCell = Math.min(currentCell, doubleDiagonalCell + 1); - } - - if (currentCell < smallestCell) { - smallestCell = currentCell; - } - - currentRow[_j] = currentCell; - } // Early exit, since distance can't go smaller than smallest element of the previous row. - - - if (smallestCell > threshold) { - return undefined; - } - } - - var distance = rows[aLength % 3][bLength]; - return distance <= threshold ? distance : undefined; - }; - - return LexicalDistance; -}(); - -function stringToArray(str) { - var strLength = str.length; - var array = new Array(strLength); - - for (var i = 0; i < strLength; ++i) { - array[i] = str.charCodeAt(i); - } - - return array; -} diff --git a/node_modules/graphql/jsutils/toObjMap.js b/node_modules/graphql/jsutils/toObjMap.js deleted file mode 100644 index 1768d749..00000000 --- a/node_modules/graphql/jsutils/toObjMap.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = toObjMap; - -var _objectEntries3 = _interopRequireDefault(require("../polyfills/objectEntries.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function toObjMap(obj) { - /* eslint-enable no-redeclare */ - if (Object.getPrototypeOf(obj) === null) { - return obj; - } - - var map = Object.create(null); - - for (var _i2 = 0, _objectEntries2 = (0, _objectEntries3.default)(obj); _i2 < _objectEntries2.length; _i2++) { - var _ref2 = _objectEntries2[_i2]; - var key = _ref2[0]; - var value = _ref2[1]; - map[key] = value; - } - - return map; -} diff --git a/node_modules/graphql/jsutils/toObjMap.js.flow b/node_modules/graphql/jsutils/toObjMap.js.flow deleted file mode 100644 index 81c11135..00000000 --- a/node_modules/graphql/jsutils/toObjMap.js.flow +++ /dev/null @@ -1,26 +0,0 @@ -// @flow strict -import objectEntries from '../polyfills/objectEntries'; - -import type { - ObjMap, - ObjMapLike, - ReadOnlyObjMap, - ReadOnlyObjMapLike, -} from './ObjMap'; - -/* eslint-disable no-redeclare */ -declare function toObjMap(obj: ObjMapLike): ObjMap; -declare function toObjMap(obj: ReadOnlyObjMapLike): ReadOnlyObjMap; - -export default function toObjMap(obj) { - /* eslint-enable no-redeclare */ - if (Object.getPrototypeOf(obj) === null) { - return obj; - } - - const map = Object.create(null); - for (const [key, value] of objectEntries(obj)) { - map[key] = value; - } - return map; -} diff --git a/node_modules/graphql/jsutils/toObjMap.mjs b/node_modules/graphql/jsutils/toObjMap.mjs deleted file mode 100644 index b0ddf05b..00000000 --- a/node_modules/graphql/jsutils/toObjMap.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import objectEntries from "../polyfills/objectEntries.mjs"; -export default function toObjMap(obj) { - /* eslint-enable no-redeclare */ - if (Object.getPrototypeOf(obj) === null) { - return obj; - } - - var map = Object.create(null); - - for (var _i2 = 0, _objectEntries2 = objectEntries(obj); _i2 < _objectEntries2.length; _i2++) { - var _ref2 = _objectEntries2[_i2]; - var key = _ref2[0]; - var value = _ref2[1]; - map[key] = value; - } - - return map; -} diff --git a/node_modules/graphql/language/ast.d.ts b/node_modules/graphql/language/ast.d.ts deleted file mode 100644 index 61cb9f4e..00000000 --- a/node_modules/graphql/language/ast.d.ts +++ /dev/null @@ -1,602 +0,0 @@ -import { Source } from './source'; -import { TokenKindEnum } from './tokenKind'; - -/** - * Contains a range of UTF-8 character offsets and token references that - * identify the region of the source from which the AST derived. - */ -export class Location { - /** - * The character offset at which this Node begins. - */ - readonly start: number; - - /** - * The character offset at which this Node ends. - */ - readonly end: number; - - /** - * The Token at which this Node begins. - */ - readonly startToken: Token; - - /** - * The Token at which this Node ends. - */ - readonly endToken: Token; - - /** - * The Source document the AST represents. - */ - readonly source: Source; - - constructor(startToken: Token, endToken: Token, source: Source); - - toJSON(): { start: number; end: number }; -} - -/** - * Represents a range of characters represented by a lexical token - * within a Source. - */ -export class Token { - /** - * The kind of Token. - */ - readonly kind: TokenKindEnum; - - /** - * The character offset at which this Node begins. - */ - readonly start: number; - - /** - * The character offset at which this Node ends. - */ - readonly end: number; - - /** - * The 1-indexed line number on which this Token appears. - */ - readonly line: number; - - /** - * The 1-indexed column number at which this Token begins. - */ - readonly column: number; - - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - readonly value: string | undefined; - - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - readonly prev: Token | null; - readonly next: Token | null; - - constructor( - kind: TokenKindEnum, - start: number, - end: number, - line: number, - column: number, - prev: Token | null, - value?: string, - ); - - toJSON(): { - kind: TokenKindEnum; - value: string | undefined; - line: number; - column: number; - }; -} - -/** - * @internal - */ -export function isNode(maybeNode: any): maybeNode is ASTNode; - -/** - * The list of all possible AST node types. - */ -export type ASTNode = - | NameNode - | DocumentNode - | OperationDefinitionNode - | VariableDefinitionNode - | VariableNode - | SelectionSetNode - | FieldNode - | ArgumentNode - | FragmentSpreadNode - | InlineFragmentNode - | FragmentDefinitionNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode - | ObjectFieldNode - | DirectiveNode - | NamedTypeNode - | ListTypeNode - | NonNullTypeNode - | SchemaDefinitionNode - | OperationTypeDefinitionNode - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | FieldDefinitionNode - | InputValueDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | EnumValueDefinitionNode - | InputObjectTypeDefinitionNode - | DirectiveDefinitionNode - | SchemaExtensionNode - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode; - -/** - * Utility type listing all nodes indexed by their kind. - */ -export interface ASTKindToNode { - Name: NameNode; - Document: DocumentNode; - OperationDefinition: OperationDefinitionNode; - VariableDefinition: VariableDefinitionNode; - Variable: VariableNode; - SelectionSet: SelectionSetNode; - Field: FieldNode; - Argument: ArgumentNode; - FragmentSpread: FragmentSpreadNode; - InlineFragment: InlineFragmentNode; - FragmentDefinition: FragmentDefinitionNode; - IntValue: IntValueNode; - FloatValue: FloatValueNode; - StringValue: StringValueNode; - BooleanValue: BooleanValueNode; - NullValue: NullValueNode; - EnumValue: EnumValueNode; - ListValue: ListValueNode; - ObjectValue: ObjectValueNode; - ObjectField: ObjectFieldNode; - Directive: DirectiveNode; - NamedType: NamedTypeNode; - ListType: ListTypeNode; - NonNullType: NonNullTypeNode; - SchemaDefinition: SchemaDefinitionNode; - OperationTypeDefinition: OperationTypeDefinitionNode; - ScalarTypeDefinition: ScalarTypeDefinitionNode; - ObjectTypeDefinition: ObjectTypeDefinitionNode; - FieldDefinition: FieldDefinitionNode; - InputValueDefinition: InputValueDefinitionNode; - InterfaceTypeDefinition: InterfaceTypeDefinitionNode; - UnionTypeDefinition: UnionTypeDefinitionNode; - EnumTypeDefinition: EnumTypeDefinitionNode; - EnumValueDefinition: EnumValueDefinitionNode; - InputObjectTypeDefinition: InputObjectTypeDefinitionNode; - DirectiveDefinition: DirectiveDefinitionNode; - SchemaExtension: SchemaExtensionNode; - ScalarTypeExtension: ScalarTypeExtensionNode; - ObjectTypeExtension: ObjectTypeExtensionNode; - InterfaceTypeExtension: InterfaceTypeExtensionNode; - UnionTypeExtension: UnionTypeExtensionNode; - EnumTypeExtension: EnumTypeExtensionNode; - InputObjectTypeExtension: InputObjectTypeExtensionNode; -} - -// Name - -export interface NameNode { - readonly kind: 'Name'; - readonly loc?: Location; - readonly value: string; -} - -// Document - -export interface DocumentNode { - readonly kind: 'Document'; - readonly loc?: Location; - readonly definitions: ReadonlyArray; -} - -export type DefinitionNode = - | ExecutableDefinitionNode - | TypeSystemDefinitionNode - | TypeSystemExtensionNode; - -export type ExecutableDefinitionNode = - | OperationDefinitionNode - | FragmentDefinitionNode; - -export interface OperationDefinitionNode { - readonly kind: 'OperationDefinition'; - readonly loc?: Location; - readonly operation: OperationTypeNode; - readonly name?: NameNode; - readonly variableDefinitions?: ReadonlyArray; - readonly directives?: ReadonlyArray; - readonly selectionSet: SelectionSetNode; -} - -export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; - -export interface VariableDefinitionNode { - readonly kind: 'VariableDefinition'; - readonly loc?: Location; - readonly variable: VariableNode; - readonly type: TypeNode; - readonly defaultValue?: ValueNode; - readonly directives?: ReadonlyArray; -} - -export interface VariableNode { - readonly kind: 'Variable'; - readonly loc?: Location; - readonly name: NameNode; -} - -export interface SelectionSetNode { - kind: 'SelectionSet'; - loc?: Location; - selections: ReadonlyArray; -} - -export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode; - -export interface FieldNode { - readonly kind: 'Field'; - readonly loc?: Location; - readonly alias?: NameNode; - readonly name: NameNode; - readonly arguments?: ReadonlyArray; - readonly directives?: ReadonlyArray; - readonly selectionSet?: SelectionSetNode; -} - -export interface ArgumentNode { - readonly kind: 'Argument'; - readonly loc?: Location; - readonly name: NameNode; - readonly value: ValueNode; -} - -// Fragments - -export interface FragmentSpreadNode { - readonly kind: 'FragmentSpread'; - readonly loc?: Location; - readonly name: NameNode; - readonly directives?: ReadonlyArray; -} - -export interface InlineFragmentNode { - readonly kind: 'InlineFragment'; - readonly loc?: Location; - readonly typeCondition?: NamedTypeNode; - readonly directives?: ReadonlyArray; - readonly selectionSet: SelectionSetNode; -} - -export interface FragmentDefinitionNode { - readonly kind: 'FragmentDefinition'; - readonly loc?: Location; - readonly name: NameNode; - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - readonly variableDefinitions?: ReadonlyArray; - readonly typeCondition: NamedTypeNode; - readonly directives?: ReadonlyArray; - readonly selectionSet: SelectionSetNode; -} - -// Values - -export type ValueNode = - | VariableNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode; - -export interface IntValueNode { - readonly kind: 'IntValue'; - readonly loc?: Location; - readonly value: string; -} - -export interface FloatValueNode { - readonly kind: 'FloatValue'; - readonly loc?: Location; - readonly value: string; -} - -export interface StringValueNode { - readonly kind: 'StringValue'; - readonly loc?: Location; - readonly value: string; - readonly block?: boolean; -} - -export interface BooleanValueNode { - readonly kind: 'BooleanValue'; - readonly loc?: Location; - readonly value: boolean; -} - -export interface NullValueNode { - readonly kind: 'NullValue'; - readonly loc?: Location; -} - -export interface EnumValueNode { - readonly kind: 'EnumValue'; - readonly loc?: Location; - readonly value: string; -} - -export interface ListValueNode { - readonly kind: 'ListValue'; - readonly loc?: Location; - readonly values: ReadonlyArray; -} - -export interface ObjectValueNode { - readonly kind: 'ObjectValue'; - readonly loc?: Location; - readonly fields: ReadonlyArray; -} - -export interface ObjectFieldNode { - readonly kind: 'ObjectField'; - readonly loc?: Location; - readonly name: NameNode; - readonly value: ValueNode; -} - -// Directives - -export interface DirectiveNode { - readonly kind: 'Directive'; - readonly loc?: Location; - readonly name: NameNode; - readonly arguments?: ReadonlyArray; -} - -// Type Reference - -export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; - -export interface NamedTypeNode { - readonly kind: 'NamedType'; - readonly loc?: Location; - readonly name: NameNode; -} - -export interface ListTypeNode { - readonly kind: 'ListType'; - readonly loc?: Location; - readonly type: TypeNode; -} - -export interface NonNullTypeNode { - readonly kind: 'NonNullType'; - readonly loc?: Location; - readonly type: NamedTypeNode | ListTypeNode; -} - -// Type System Definition - -export type TypeSystemDefinitionNode = - | SchemaDefinitionNode - | TypeDefinitionNode - | DirectiveDefinitionNode; - -export interface SchemaDefinitionNode { - readonly kind: 'SchemaDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly directives?: ReadonlyArray; - readonly operationTypes: ReadonlyArray; -} - -export interface OperationTypeDefinitionNode { - readonly kind: 'OperationTypeDefinition'; - readonly loc?: Location; - readonly operation: OperationTypeNode; - readonly type: NamedTypeNode; -} - -// Type Definition - -export type TypeDefinitionNode = - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | InputObjectTypeDefinitionNode; - -export interface ScalarTypeDefinitionNode { - readonly kind: 'ScalarTypeDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly directives?: ReadonlyArray; -} - -export interface ObjectTypeDefinitionNode { - readonly kind: 'ObjectTypeDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly interfaces?: ReadonlyArray; - readonly directives?: ReadonlyArray; - readonly fields?: ReadonlyArray; -} - -export interface FieldDefinitionNode { - readonly kind: 'FieldDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly arguments?: ReadonlyArray; - readonly type: TypeNode; - readonly directives?: ReadonlyArray; -} - -export interface InputValueDefinitionNode { - readonly kind: 'InputValueDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly type: TypeNode; - readonly defaultValue?: ValueNode; - readonly directives?: ReadonlyArray; -} - -export interface InterfaceTypeDefinitionNode { - readonly kind: 'InterfaceTypeDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly interfaces?: ReadonlyArray; - readonly directives?: ReadonlyArray; - readonly fields?: ReadonlyArray; -} - -export interface UnionTypeDefinitionNode { - readonly kind: 'UnionTypeDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly directives?: ReadonlyArray; - readonly types?: ReadonlyArray; -} - -export interface EnumTypeDefinitionNode { - readonly kind: 'EnumTypeDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly directives?: ReadonlyArray; - readonly values?: ReadonlyArray; -} - -export interface EnumValueDefinitionNode { - readonly kind: 'EnumValueDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly directives?: ReadonlyArray; -} - -export interface InputObjectTypeDefinitionNode { - readonly kind: 'InputObjectTypeDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly directives?: ReadonlyArray; - readonly fields?: ReadonlyArray; -} - -// Directive Definitions - -export interface DirectiveDefinitionNode { - readonly kind: 'DirectiveDefinition'; - readonly loc?: Location; - readonly description?: StringValueNode; - readonly name: NameNode; - readonly arguments?: ReadonlyArray; - readonly repeatable: boolean; - readonly locations: ReadonlyArray; -} - -// Type System Extensions - -export type TypeSystemExtensionNode = SchemaExtensionNode | TypeExtensionNode; - -export interface SchemaExtensionNode { - readonly kind: 'SchemaExtension'; - readonly loc?: Location; - readonly directives?: ReadonlyArray; - readonly operationTypes?: ReadonlyArray; -} - -// Type Extensions - -export type TypeExtensionNode = - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode; - -export interface ScalarTypeExtensionNode { - readonly kind: 'ScalarTypeExtension'; - readonly loc?: Location; - readonly name: NameNode; - readonly directives?: ReadonlyArray; -} - -export interface ObjectTypeExtensionNode { - readonly kind: 'ObjectTypeExtension'; - readonly loc?: Location; - readonly name: NameNode; - readonly interfaces?: ReadonlyArray; - readonly directives?: ReadonlyArray; - readonly fields?: ReadonlyArray; -} - -export interface InterfaceTypeExtensionNode { - readonly kind: 'InterfaceTypeExtension'; - readonly loc?: Location; - readonly name: NameNode; - readonly interfaces?: ReadonlyArray; - readonly directives?: ReadonlyArray; - readonly fields?: ReadonlyArray; -} - -export interface UnionTypeExtensionNode { - readonly kind: 'UnionTypeExtension'; - readonly loc?: Location; - readonly name: NameNode; - readonly directives?: ReadonlyArray; - readonly types?: ReadonlyArray; -} - -export interface EnumTypeExtensionNode { - readonly kind: 'EnumTypeExtension'; - readonly loc?: Location; - readonly name: NameNode; - readonly directives?: ReadonlyArray; - readonly values?: ReadonlyArray; -} - -export interface InputObjectTypeExtensionNode { - readonly kind: 'InputObjectTypeExtension'; - readonly loc?: Location; - readonly name: NameNode; - readonly directives?: ReadonlyArray; - readonly fields?: ReadonlyArray; -} diff --git a/node_modules/graphql/language/ast.js b/node_modules/graphql/language/ast.js deleted file mode 100644 index 3f8eef21..00000000 --- a/node_modules/graphql/language/ast.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isNode = isNode; -exports.Token = exports.Location = void 0; - -var _defineInspect = _interopRequireDefault(require("../jsutils/defineInspect.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Contains a range of UTF-8 character offsets and token references that - * identify the region of the source from which the AST derived. - */ -var Location = /*#__PURE__*/function () { - /** - * The character offset at which this Node begins. - */ - - /** - * The character offset at which this Node ends. - */ - - /** - * The Token at which this Node begins. - */ - - /** - * The Token at which this Node ends. - */ - - /** - * The Source document the AST represents. - */ - function Location(startToken, endToken, source) { - this.start = startToken.start; - this.end = endToken.end; - this.startToken = startToken; - this.endToken = endToken; - this.source = source; - } - - var _proto = Location.prototype; - - _proto.toJSON = function toJSON() { - return { - start: this.start, - end: this.end - }; - }; - - return Location; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.Location = Location; -(0, _defineInspect.default)(Location); -/** - * Represents a range of characters represented by a lexical token - * within a Source. - */ - -var Token = /*#__PURE__*/function () { - /** - * The kind of Token. - */ - - /** - * The character offset at which this Node begins. - */ - - /** - * The character offset at which this Node ends. - */ - - /** - * The 1-indexed line number on which this Token appears. - */ - - /** - * The 1-indexed column number at which this Token begins. - */ - - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - function Token(kind, start, end, line, column, prev, value) { - this.kind = kind; - this.start = start; - this.end = end; - this.line = line; - this.column = column; - this.value = value; - this.prev = prev; - this.next = null; - } - - var _proto2 = Token.prototype; - - _proto2.toJSON = function toJSON() { - return { - kind: this.kind, - value: this.value, - line: this.line, - column: this.column - }; - }; - - return Token; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.Token = Token; -(0, _defineInspect.default)(Token); -/** - * @internal - */ - -function isNode(maybeNode) { - return maybeNode != null && typeof maybeNode.kind === 'string'; -} -/** - * The list of all possible AST node types. - */ diff --git a/node_modules/graphql/language/ast.js.flow b/node_modules/graphql/language/ast.js.flow deleted file mode 100644 index 42ea6e3f..00000000 --- a/node_modules/graphql/language/ast.js.flow +++ /dev/null @@ -1,637 +0,0 @@ -// @flow strict -import defineInspect from '../jsutils/defineInspect'; - -import type { Source } from './source'; -import type { TokenKindEnum } from './tokenKind'; - -/** - * Contains a range of UTF-8 character offsets and token references that - * identify the region of the source from which the AST derived. - */ -export class Location { - /** - * The character offset at which this Node begins. - */ - +start: number; - - /** - * The character offset at which this Node ends. - */ - +end: number; - - /** - * The Token at which this Node begins. - */ - +startToken: Token; - - /** - * The Token at which this Node ends. - */ - +endToken: Token; - - /** - * The Source document the AST represents. - */ - +source: Source; - - constructor(startToken: Token, endToken: Token, source: Source) { - this.start = startToken.start; - this.end = endToken.end; - this.startToken = startToken; - this.endToken = endToken; - this.source = source; - } - - toJSON(): {| start: number, end: number |} { - return { start: this.start, end: this.end }; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(Location); - -/** - * Represents a range of characters represented by a lexical token - * within a Source. - */ -export class Token { - /** - * The kind of Token. - */ - +kind: TokenKindEnum; - - /** - * The character offset at which this Node begins. - */ - +start: number; - - /** - * The character offset at which this Node ends. - */ - +end: number; - - /** - * The 1-indexed line number on which this Token appears. - */ - +line: number; - - /** - * The 1-indexed column number at which this Token begins. - */ - +column: number; - - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - +value: string | void; - - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - +prev: Token | null; - +next: Token | null; - - constructor( - kind: TokenKindEnum, - start: number, - end: number, - line: number, - column: number, - prev: Token | null, - value?: string, - ) { - this.kind = kind; - this.start = start; - this.end = end; - this.line = line; - this.column = column; - this.value = value; - this.prev = prev; - this.next = null; - } - - toJSON(): {| - kind: TokenKindEnum, - value: string | void, - line: number, - column: number, - |} { - return { - kind: this.kind, - value: this.value, - line: this.line, - column: this.column, - }; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(Token); - -/** - * @internal - */ -export function isNode(maybeNode: mixed): boolean %checks { - return maybeNode != null && typeof maybeNode.kind === 'string'; -} - -/** - * The list of all possible AST node types. - */ -export type ASTNode = - | NameNode - | DocumentNode - | OperationDefinitionNode - | VariableDefinitionNode - | VariableNode - | SelectionSetNode - | FieldNode - | ArgumentNode - | FragmentSpreadNode - | InlineFragmentNode - | FragmentDefinitionNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode - | ObjectFieldNode - | DirectiveNode - | NamedTypeNode - | ListTypeNode - | NonNullTypeNode - | SchemaDefinitionNode - | OperationTypeDefinitionNode - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | FieldDefinitionNode - | InputValueDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | EnumValueDefinitionNode - | InputObjectTypeDefinitionNode - | DirectiveDefinitionNode - | SchemaExtensionNode - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode; - -/** - * Utility type listing all nodes indexed by their kind. - */ -export type ASTKindToNode = {| - Name: NameNode, - Document: DocumentNode, - OperationDefinition: OperationDefinitionNode, - VariableDefinition: VariableDefinitionNode, - Variable: VariableNode, - SelectionSet: SelectionSetNode, - Field: FieldNode, - Argument: ArgumentNode, - FragmentSpread: FragmentSpreadNode, - InlineFragment: InlineFragmentNode, - FragmentDefinition: FragmentDefinitionNode, - IntValue: IntValueNode, - FloatValue: FloatValueNode, - StringValue: StringValueNode, - BooleanValue: BooleanValueNode, - NullValue: NullValueNode, - EnumValue: EnumValueNode, - ListValue: ListValueNode, - ObjectValue: ObjectValueNode, - ObjectField: ObjectFieldNode, - Directive: DirectiveNode, - NamedType: NamedTypeNode, - ListType: ListTypeNode, - NonNullType: NonNullTypeNode, - SchemaDefinition: SchemaDefinitionNode, - OperationTypeDefinition: OperationTypeDefinitionNode, - ScalarTypeDefinition: ScalarTypeDefinitionNode, - ObjectTypeDefinition: ObjectTypeDefinitionNode, - FieldDefinition: FieldDefinitionNode, - InputValueDefinition: InputValueDefinitionNode, - InterfaceTypeDefinition: InterfaceTypeDefinitionNode, - UnionTypeDefinition: UnionTypeDefinitionNode, - EnumTypeDefinition: EnumTypeDefinitionNode, - EnumValueDefinition: EnumValueDefinitionNode, - InputObjectTypeDefinition: InputObjectTypeDefinitionNode, - DirectiveDefinition: DirectiveDefinitionNode, - SchemaExtension: SchemaExtensionNode, - ScalarTypeExtension: ScalarTypeExtensionNode, - ObjectTypeExtension: ObjectTypeExtensionNode, - InterfaceTypeExtension: InterfaceTypeExtensionNode, - UnionTypeExtension: UnionTypeExtensionNode, - EnumTypeExtension: EnumTypeExtensionNode, - InputObjectTypeExtension: InputObjectTypeExtensionNode, -|}; - -// Name - -export type NameNode = {| - +kind: 'Name', - +loc?: Location, - +value: string, -|}; - -// Document - -export type DocumentNode = {| - +kind: 'Document', - +loc?: Location, - +definitions: $ReadOnlyArray, -|}; - -export type DefinitionNode = - | ExecutableDefinitionNode - | TypeSystemDefinitionNode - | TypeSystemExtensionNode; - -export type ExecutableDefinitionNode = - | OperationDefinitionNode - | FragmentDefinitionNode; - -export type OperationDefinitionNode = {| - +kind: 'OperationDefinition', - +loc?: Location, - +operation: OperationTypeNode, - +name?: NameNode, - +variableDefinitions?: $ReadOnlyArray, - +directives?: $ReadOnlyArray, - +selectionSet: SelectionSetNode, -|}; - -export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; - -export type VariableDefinitionNode = {| - +kind: 'VariableDefinition', - +loc?: Location, - +variable: VariableNode, - +type: TypeNode, - +defaultValue?: ValueNode, - +directives?: $ReadOnlyArray, -|}; - -export type VariableNode = {| - +kind: 'Variable', - +loc?: Location, - +name: NameNode, -|}; - -export type SelectionSetNode = {| - kind: 'SelectionSet', - loc?: Location, - selections: $ReadOnlyArray, -|}; - -export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode; - -export type FieldNode = {| - +kind: 'Field', - +loc?: Location, - +alias?: NameNode, - +name: NameNode, - +arguments?: $ReadOnlyArray, - +directives?: $ReadOnlyArray, - +selectionSet?: SelectionSetNode, -|}; - -export type ArgumentNode = {| - +kind: 'Argument', - +loc?: Location, - +name: NameNode, - +value: ValueNode, -|}; - -// Fragments - -export type FragmentSpreadNode = {| - +kind: 'FragmentSpread', - +loc?: Location, - +name: NameNode, - +directives?: $ReadOnlyArray, -|}; - -export type InlineFragmentNode = {| - +kind: 'InlineFragment', - +loc?: Location, - +typeCondition?: NamedTypeNode, - +directives?: $ReadOnlyArray, - +selectionSet: SelectionSetNode, -|}; - -export type FragmentDefinitionNode = {| - +kind: 'FragmentDefinition', - +loc?: Location, - +name: NameNode, - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - +variableDefinitions?: $ReadOnlyArray, - +typeCondition: NamedTypeNode, - +directives?: $ReadOnlyArray, - +selectionSet: SelectionSetNode, -|}; - -// Values - -export type ValueNode = - | VariableNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode; - -export type IntValueNode = {| - +kind: 'IntValue', - +loc?: Location, - +value: string, -|}; - -export type FloatValueNode = {| - +kind: 'FloatValue', - +loc?: Location, - +value: string, -|}; - -export type StringValueNode = {| - +kind: 'StringValue', - +loc?: Location, - +value: string, - +block?: boolean, -|}; - -export type BooleanValueNode = {| - +kind: 'BooleanValue', - +loc?: Location, - +value: boolean, -|}; - -export type NullValueNode = {| - +kind: 'NullValue', - +loc?: Location, -|}; - -export type EnumValueNode = {| - +kind: 'EnumValue', - +loc?: Location, - +value: string, -|}; - -export type ListValueNode = {| - +kind: 'ListValue', - +loc?: Location, - +values: $ReadOnlyArray, -|}; - -export type ObjectValueNode = {| - +kind: 'ObjectValue', - +loc?: Location, - +fields: $ReadOnlyArray, -|}; - -export type ObjectFieldNode = {| - +kind: 'ObjectField', - +loc?: Location, - +name: NameNode, - +value: ValueNode, -|}; - -// Directives - -export type DirectiveNode = {| - +kind: 'Directive', - +loc?: Location, - +name: NameNode, - +arguments?: $ReadOnlyArray, -|}; - -// Type Reference - -export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; - -export type NamedTypeNode = {| - +kind: 'NamedType', - +loc?: Location, - +name: NameNode, -|}; - -export type ListTypeNode = {| - +kind: 'ListType', - +loc?: Location, - +type: TypeNode, -|}; - -export type NonNullTypeNode = {| - +kind: 'NonNullType', - +loc?: Location, - +type: NamedTypeNode | ListTypeNode, -|}; - -// Type System Definition - -export type TypeSystemDefinitionNode = - | SchemaDefinitionNode - | TypeDefinitionNode - | DirectiveDefinitionNode; - -export type SchemaDefinitionNode = {| - +kind: 'SchemaDefinition', - +loc?: Location, - +description?: StringValueNode, - +directives?: $ReadOnlyArray, - +operationTypes: $ReadOnlyArray, -|}; - -export type OperationTypeDefinitionNode = {| - +kind: 'OperationTypeDefinition', - +loc?: Location, - +operation: OperationTypeNode, - +type: NamedTypeNode, -|}; - -// Type Definition - -export type TypeDefinitionNode = - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | InputObjectTypeDefinitionNode; - -export type ScalarTypeDefinitionNode = {| - +kind: 'ScalarTypeDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +directives?: $ReadOnlyArray, -|}; - -export type ObjectTypeDefinitionNode = {| - +kind: 'ObjectTypeDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +interfaces?: $ReadOnlyArray, - +directives?: $ReadOnlyArray, - +fields?: $ReadOnlyArray, -|}; - -export type FieldDefinitionNode = {| - +kind: 'FieldDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +arguments?: $ReadOnlyArray, - +type: TypeNode, - +directives?: $ReadOnlyArray, -|}; - -export type InputValueDefinitionNode = {| - +kind: 'InputValueDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +type: TypeNode, - +defaultValue?: ValueNode, - +directives?: $ReadOnlyArray, -|}; - -export type InterfaceTypeDefinitionNode = {| - +kind: 'InterfaceTypeDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +interfaces?: $ReadOnlyArray, - +directives?: $ReadOnlyArray, - +fields?: $ReadOnlyArray, -|}; - -export type UnionTypeDefinitionNode = {| - +kind: 'UnionTypeDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +directives?: $ReadOnlyArray, - +types?: $ReadOnlyArray, -|}; - -export type EnumTypeDefinitionNode = {| - +kind: 'EnumTypeDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +directives?: $ReadOnlyArray, - +values?: $ReadOnlyArray, -|}; - -export type EnumValueDefinitionNode = {| - +kind: 'EnumValueDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +directives?: $ReadOnlyArray, -|}; - -export type InputObjectTypeDefinitionNode = {| - +kind: 'InputObjectTypeDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +directives?: $ReadOnlyArray, - +fields?: $ReadOnlyArray, -|}; - -// Directive Definitions - -export type DirectiveDefinitionNode = {| - +kind: 'DirectiveDefinition', - +loc?: Location, - +description?: StringValueNode, - +name: NameNode, - +arguments?: $ReadOnlyArray, - +repeatable: boolean, - +locations: $ReadOnlyArray, -|}; - -// Type System Extensions - -export type TypeSystemExtensionNode = SchemaExtensionNode | TypeExtensionNode; - -export type SchemaExtensionNode = {| - +kind: 'SchemaExtension', - +loc?: Location, - +directives?: $ReadOnlyArray, - +operationTypes?: $ReadOnlyArray, -|}; - -// Type Extensions - -export type TypeExtensionNode = - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode; - -export type ScalarTypeExtensionNode = {| - +kind: 'ScalarTypeExtension', - +loc?: Location, - +name: NameNode, - +directives?: $ReadOnlyArray, -|}; - -export type ObjectTypeExtensionNode = {| - +kind: 'ObjectTypeExtension', - +loc?: Location, - +name: NameNode, - +interfaces?: $ReadOnlyArray, - +directives?: $ReadOnlyArray, - +fields?: $ReadOnlyArray, -|}; - -export type InterfaceTypeExtensionNode = {| - +kind: 'InterfaceTypeExtension', - +loc?: Location, - +name: NameNode, - +interfaces?: $ReadOnlyArray, - +directives?: $ReadOnlyArray, - +fields?: $ReadOnlyArray, -|}; - -export type UnionTypeExtensionNode = {| - +kind: 'UnionTypeExtension', - +loc?: Location, - +name: NameNode, - +directives?: $ReadOnlyArray, - +types?: $ReadOnlyArray, -|}; - -export type EnumTypeExtensionNode = {| - +kind: 'EnumTypeExtension', - +loc?: Location, - +name: NameNode, - +directives?: $ReadOnlyArray, - +values?: $ReadOnlyArray, -|}; - -export type InputObjectTypeExtensionNode = {| - +kind: 'InputObjectTypeExtension', - +loc?: Location, - +name: NameNode, - +directives?: $ReadOnlyArray, - +fields?: $ReadOnlyArray, -|}; diff --git a/node_modules/graphql/language/ast.mjs b/node_modules/graphql/language/ast.mjs deleted file mode 100644 index 60854880..00000000 --- a/node_modules/graphql/language/ast.mjs +++ /dev/null @@ -1,118 +0,0 @@ -import defineInspect from "../jsutils/defineInspect.mjs"; - -/** - * Contains a range of UTF-8 character offsets and token references that - * identify the region of the source from which the AST derived. - */ -export var Location = /*#__PURE__*/function () { - /** - * The character offset at which this Node begins. - */ - - /** - * The character offset at which this Node ends. - */ - - /** - * The Token at which this Node begins. - */ - - /** - * The Token at which this Node ends. - */ - - /** - * The Source document the AST represents. - */ - function Location(startToken, endToken, source) { - this.start = startToken.start; - this.end = endToken.end; - this.startToken = startToken; - this.endToken = endToken; - this.source = source; - } - - var _proto = Location.prototype; - - _proto.toJSON = function toJSON() { - return { - start: this.start, - end: this.end - }; - }; - - return Location; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(Location); -/** - * Represents a range of characters represented by a lexical token - * within a Source. - */ - -export var Token = /*#__PURE__*/function () { - /** - * The kind of Token. - */ - - /** - * The character offset at which this Node begins. - */ - - /** - * The character offset at which this Node ends. - */ - - /** - * The 1-indexed line number on which this Token appears. - */ - - /** - * The 1-indexed column number at which this Token begins. - */ - - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - function Token(kind, start, end, line, column, prev, value) { - this.kind = kind; - this.start = start; - this.end = end; - this.line = line; - this.column = column; - this.value = value; - this.prev = prev; - this.next = null; - } - - var _proto2 = Token.prototype; - - _proto2.toJSON = function toJSON() { - return { - kind: this.kind, - value: this.value, - line: this.line, - column: this.column - }; - }; - - return Token; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(Token); -/** - * @internal - */ - -export function isNode(maybeNode) { - return maybeNode != null && typeof maybeNode.kind === 'string'; -} -/** - * The list of all possible AST node types. - */ diff --git a/node_modules/graphql/language/blockString.d.ts b/node_modules/graphql/language/blockString.d.ts deleted file mode 100644 index 70ffc666..00000000 --- a/node_modules/graphql/language/blockString.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Produces the value of a block string from its parsed raw value, similar to - * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. - * - * This implements the GraphQL spec's BlockStringValue() static algorithm. - */ -export function dedentBlockStringValue(rawString: string): string; - -/** - * @internal - */ -export function getBlockStringIndentation(body: string): number; - -/** - * Print a block string in the indented block form by adding a leading and - * trailing blank line. However, if a block string starts with whitespace and is - * a single-line, adding a leading blank line would strip that whitespace. - */ -export function printBlockString( - value: string, - indentation?: string, - preferMultipleLines?: boolean, -): string; diff --git a/node_modules/graphql/language/blockString.js b/node_modules/graphql/language/blockString.js deleted file mode 100644 index a1950418..00000000 --- a/node_modules/graphql/language/blockString.js +++ /dev/null @@ -1,134 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.dedentBlockStringValue = dedentBlockStringValue; -exports.getBlockStringIndentation = getBlockStringIndentation; -exports.printBlockString = printBlockString; - -/** - * Produces the value of a block string from its parsed raw value, similar to - * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. - * - * This implements the GraphQL spec's BlockStringValue() static algorithm. - * - * @internal - */ -function dedentBlockStringValue(rawString) { - // Expand a block string's raw value into independent lines. - var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. - - var commonIndent = getBlockStringIndentation(rawString); - - if (commonIndent !== 0) { - for (var i = 1; i < lines.length; i++) { - lines[i] = lines[i].slice(commonIndent); - } - } // Remove leading and trailing blank lines. - - - var startLine = 0; - - while (startLine < lines.length && isBlank(lines[startLine])) { - ++startLine; - } - - var endLine = lines.length; - - while (endLine > startLine && isBlank(lines[endLine - 1])) { - --endLine; - } // Return a string of the lines joined with U+000A. - - - return lines.slice(startLine, endLine).join('\n'); -} - -function isBlank(str) { - for (var i = 0; i < str.length; ++i) { - if (str[i] !== ' ' && str[i] !== '\t') { - return false; - } - } - - return true; -} -/** - * @internal - */ - - -function getBlockStringIndentation(value) { - var _commonIndent; - - var isFirstLine = true; - var isEmptyLine = true; - var indent = 0; - var commonIndent = null; - - for (var i = 0; i < value.length; ++i) { - switch (value.charCodeAt(i)) { - case 13: - // \r - if (value.charCodeAt(i + 1) === 10) { - ++i; // skip \r\n as one symbol - } - - // falls through - - case 10: - // \n - isFirstLine = false; - isEmptyLine = true; - indent = 0; - break; - - case 9: // \t - - case 32: - // - ++indent; - break; - - default: - if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) { - commonIndent = indent; - } - - isEmptyLine = false; - } - } - - return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0; -} -/** - * Print a block string in the indented block form by adding a leading and - * trailing blank line. However, if a block string starts with whitespace and is - * a single-line, adding a leading blank line would strip that whitespace. - * - * @internal - */ - - -function printBlockString(value) { - var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var isSingleLine = value.indexOf('\n') === -1; - var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; - var hasTrailingQuote = value[value.length - 1] === '"'; - var hasTrailingSlash = value[value.length - 1] === '\\'; - var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines; - var result = ''; // Format a multi-line block quote to account for leading space. - - if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { - result += '\n' + indentation; - } - - result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; - - if (printAsMultipleLines) { - result += '\n'; - } - - return '"""' + result.replace(/"""/g, '\\"""') + '"""'; -} diff --git a/node_modules/graphql/language/blockString.js.flow b/node_modules/graphql/language/blockString.js.flow deleted file mode 100644 index b8ebd907..00000000 --- a/node_modules/graphql/language/blockString.js.flow +++ /dev/null @@ -1,121 +0,0 @@ -// @flow strict -/** - * Produces the value of a block string from its parsed raw value, similar to - * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. - * - * This implements the GraphQL spec's BlockStringValue() static algorithm. - * - * @internal - */ -export function dedentBlockStringValue(rawString: string): string { - // Expand a block string's raw value into independent lines. - const lines = rawString.split(/\r\n|[\n\r]/g); - - // Remove common indentation from all lines but first. - const commonIndent = getBlockStringIndentation(rawString); - - if (commonIndent !== 0) { - for (let i = 1; i < lines.length; i++) { - lines[i] = lines[i].slice(commonIndent); - } - } - - // Remove leading and trailing blank lines. - let startLine = 0; - while (startLine < lines.length && isBlank(lines[startLine])) { - ++startLine; - } - - let endLine = lines.length; - while (endLine > startLine && isBlank(lines[endLine - 1])) { - --endLine; - } - - // Return a string of the lines joined with U+000A. - return lines.slice(startLine, endLine).join('\n'); -} - -function isBlank(str: string): boolean { - for (let i = 0; i < str.length; ++i) { - if (str[i] !== ' ' && str[i] !== '\t') { - return false; - } - } - - return true; -} - -/** - * @internal - */ -export function getBlockStringIndentation(value: string): number { - let isFirstLine = true; - let isEmptyLine = true; - let indent = 0; - let commonIndent = null; - - for (let i = 0; i < value.length; ++i) { - switch (value.charCodeAt(i)) { - case 13: // \r - if (value.charCodeAt(i + 1) === 10) { - ++i; // skip \r\n as one symbol - } - // falls through - case 10: // \n - isFirstLine = false; - isEmptyLine = true; - indent = 0; - break; - case 9: // \t - case 32: // - ++indent; - break; - default: - if ( - isEmptyLine && - !isFirstLine && - (commonIndent === null || indent < commonIndent) - ) { - commonIndent = indent; - } - isEmptyLine = false; - } - } - - return commonIndent ?? 0; -} - -/** - * Print a block string in the indented block form by adding a leading and - * trailing blank line. However, if a block string starts with whitespace and is - * a single-line, adding a leading blank line would strip that whitespace. - * - * @internal - */ -export function printBlockString( - value: string, - indentation?: string = '', - preferMultipleLines?: boolean = false, -): string { - const isSingleLine = value.indexOf('\n') === -1; - const hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; - const hasTrailingQuote = value[value.length - 1] === '"'; - const hasTrailingSlash = value[value.length - 1] === '\\'; - const printAsMultipleLines = - !isSingleLine || - hasTrailingQuote || - hasTrailingSlash || - preferMultipleLines; - - let result = ''; - // Format a multi-line block quote to account for leading space. - if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { - result += '\n' + indentation; - } - result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; - if (printAsMultipleLines) { - result += '\n'; - } - - return '"""' + result.replace(/"""/g, '\\"""') + '"""'; -} diff --git a/node_modules/graphql/language/blockString.mjs b/node_modules/graphql/language/blockString.mjs deleted file mode 100644 index 9ee1098a..00000000 --- a/node_modules/graphql/language/blockString.mjs +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Produces the value of a block string from its parsed raw value, similar to - * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. - * - * This implements the GraphQL spec's BlockStringValue() static algorithm. - * - * @internal - */ -export function dedentBlockStringValue(rawString) { - // Expand a block string's raw value into independent lines. - var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. - - var commonIndent = getBlockStringIndentation(rawString); - - if (commonIndent !== 0) { - for (var i = 1; i < lines.length; i++) { - lines[i] = lines[i].slice(commonIndent); - } - } // Remove leading and trailing blank lines. - - - var startLine = 0; - - while (startLine < lines.length && isBlank(lines[startLine])) { - ++startLine; - } - - var endLine = lines.length; - - while (endLine > startLine && isBlank(lines[endLine - 1])) { - --endLine; - } // Return a string of the lines joined with U+000A. - - - return lines.slice(startLine, endLine).join('\n'); -} - -function isBlank(str) { - for (var i = 0; i < str.length; ++i) { - if (str[i] !== ' ' && str[i] !== '\t') { - return false; - } - } - - return true; -} -/** - * @internal - */ - - -export function getBlockStringIndentation(value) { - var _commonIndent; - - var isFirstLine = true; - var isEmptyLine = true; - var indent = 0; - var commonIndent = null; - - for (var i = 0; i < value.length; ++i) { - switch (value.charCodeAt(i)) { - case 13: - // \r - if (value.charCodeAt(i + 1) === 10) { - ++i; // skip \r\n as one symbol - } - - // falls through - - case 10: - // \n - isFirstLine = false; - isEmptyLine = true; - indent = 0; - break; - - case 9: // \t - - case 32: - // - ++indent; - break; - - default: - if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) { - commonIndent = indent; - } - - isEmptyLine = false; - } - } - - return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0; -} -/** - * Print a block string in the indented block form by adding a leading and - * trailing blank line. However, if a block string starts with whitespace and is - * a single-line, adding a leading blank line would strip that whitespace. - * - * @internal - */ - -export function printBlockString(value) { - var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var isSingleLine = value.indexOf('\n') === -1; - var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; - var hasTrailingQuote = value[value.length - 1] === '"'; - var hasTrailingSlash = value[value.length - 1] === '\\'; - var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines; - var result = ''; // Format a multi-line block quote to account for leading space. - - if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { - result += '\n' + indentation; - } - - result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; - - if (printAsMultipleLines) { - result += '\n'; - } - - return '"""' + result.replace(/"""/g, '\\"""') + '"""'; -} diff --git a/node_modules/graphql/language/directiveLocation.d.ts b/node_modules/graphql/language/directiveLocation.d.ts deleted file mode 100644 index 225e129c..00000000 --- a/node_modules/graphql/language/directiveLocation.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * The set of allowed directive location values. - */ -export const DirectiveLocation: { - // Request Definitions - QUERY: 'QUERY'; - MUTATION: 'MUTATION'; - SUBSCRIPTION: 'SUBSCRIPTION'; - FIELD: 'FIELD'; - FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION'; - FRAGMENT_SPREAD: 'FRAGMENT_SPREAD'; - INLINE_FRAGMENT: 'INLINE_FRAGMENT'; - VARIABLE_DEFINITION: 'VARIABLE_DEFINITION'; - - // Type System Definitions - SCHEMA: 'SCHEMA'; - SCALAR: 'SCALAR'; - OBJECT: 'OBJECT'; - FIELD_DEFINITION: 'FIELD_DEFINITION'; - ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION'; - INTERFACE: 'INTERFACE'; - UNION: 'UNION'; - ENUM: 'ENUM'; - ENUM_VALUE: 'ENUM_VALUE'; - INPUT_OBJECT: 'INPUT_OBJECT'; - INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'; -}; - -/** - * The enum type representing the directive location values. - */ -export type DirectiveLocationEnum = typeof DirectiveLocation[keyof typeof DirectiveLocation]; diff --git a/node_modules/graphql/language/directiveLocation.js b/node_modules/graphql/language/directiveLocation.js deleted file mode 100644 index 57bb417f..00000000 --- a/node_modules/graphql/language/directiveLocation.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.DirectiveLocation = void 0; - -/** - * The set of allowed directive location values. - */ -var DirectiveLocation = Object.freeze({ - // Request Definitions - QUERY: 'QUERY', - MUTATION: 'MUTATION', - SUBSCRIPTION: 'SUBSCRIPTION', - FIELD: 'FIELD', - FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', - FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', - INLINE_FRAGMENT: 'INLINE_FRAGMENT', - VARIABLE_DEFINITION: 'VARIABLE_DEFINITION', - // Type System Definitions - SCHEMA: 'SCHEMA', - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - FIELD_DEFINITION: 'FIELD_DEFINITION', - ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - ENUM_VALUE: 'ENUM_VALUE', - INPUT_OBJECT: 'INPUT_OBJECT', - INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION' -}); -/** - * The enum type representing the directive location values. - */ - -exports.DirectiveLocation = DirectiveLocation; diff --git a/node_modules/graphql/language/directiveLocation.js.flow b/node_modules/graphql/language/directiveLocation.js.flow deleted file mode 100644 index 35340591..00000000 --- a/node_modules/graphql/language/directiveLocation.js.flow +++ /dev/null @@ -1,32 +0,0 @@ -// @flow strict -/** - * The set of allowed directive location values. - */ -export const DirectiveLocation = Object.freeze({ - // Request Definitions - QUERY: 'QUERY', - MUTATION: 'MUTATION', - SUBSCRIPTION: 'SUBSCRIPTION', - FIELD: 'FIELD', - FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', - FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', - INLINE_FRAGMENT: 'INLINE_FRAGMENT', - VARIABLE_DEFINITION: 'VARIABLE_DEFINITION', - // Type System Definitions - SCHEMA: 'SCHEMA', - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - FIELD_DEFINITION: 'FIELD_DEFINITION', - ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - ENUM_VALUE: 'ENUM_VALUE', - INPUT_OBJECT: 'INPUT_OBJECT', - INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION', -}); - -/** - * The enum type representing the directive location values. - */ -export type DirectiveLocationEnum = $Values; diff --git a/node_modules/graphql/language/directiveLocation.mjs b/node_modules/graphql/language/directiveLocation.mjs deleted file mode 100644 index 82823b7d..00000000 --- a/node_modules/graphql/language/directiveLocation.mjs +++ /dev/null @@ -1,29 +0,0 @@ -/** - * The set of allowed directive location values. - */ -export var DirectiveLocation = Object.freeze({ - // Request Definitions - QUERY: 'QUERY', - MUTATION: 'MUTATION', - SUBSCRIPTION: 'SUBSCRIPTION', - FIELD: 'FIELD', - FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', - FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', - INLINE_FRAGMENT: 'INLINE_FRAGMENT', - VARIABLE_DEFINITION: 'VARIABLE_DEFINITION', - // Type System Definitions - SCHEMA: 'SCHEMA', - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - FIELD_DEFINITION: 'FIELD_DEFINITION', - ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - ENUM_VALUE: 'ENUM_VALUE', - INPUT_OBJECT: 'INPUT_OBJECT', - INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION' -}); -/** - * The enum type representing the directive location values. - */ diff --git a/node_modules/graphql/language/experimentalOnlineParser/grammar.d.ts b/node_modules/graphql/language/experimentalOnlineParser/grammar.d.ts deleted file mode 100644 index 6e71a66a..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/grammar.d.ts +++ /dev/null @@ -1,1006 +0,0 @@ -export interface GraphQLGrammarType { - [name: string]: GraphQLGrammarRule; -} - -export type GraphQLGrammarRule = - | GraphQLGrammarRuleName - | GraphQLGrammarRuleConstraint - | GraphQLGrammarConstraintsSet; - -export type GraphQLGrammarRuleName = string; - -export type GraphQLGrammarRuleConstraint = - | GraphQLGrammarTokenConstraint - | GraphQLGrammarOfTypeConstraint - | GraphQLGrammarListOfTypeConstraint - | GraphQLGrammarPeekConstraint; - -export type GraphQLGrammarConstraintsSet = Array< - GraphQLGrammarRuleName | GraphQLGrammarRuleConstraint ->; - -export interface GraphQLGrammarBaseRuleConstraint { - butNot?: GraphQLGrammarTokenConstraint | Array; - optional?: boolean; - eatNextOnFail?: boolean; -} - -export interface GraphQLGrammarTokenConstraint - extends GraphQLGrammarBaseRuleConstraint { - token: - | '!' - | '$' - | '&' - | '(' - | ')' - | '...' - | ':' - | '=' - | '@' - | '[' - | ']' - | '{' - | '}' - | '|' - | 'Name' - | 'Int' - | 'Float' - | 'String' - | 'BlockString' - | 'Comment'; - ofValue?: string; - oneOf?: Array; - tokenName?: string; - definitionName?: boolean; - typeName?: boolean; -} - -export interface GraphQLGrammarOfTypeConstraint - extends GraphQLGrammarBaseRuleConstraint { - ofType: GraphQLGrammarRule; - tokenName?: string; -} - -export interface GraphQLGrammarListOfTypeConstraint - extends GraphQLGrammarBaseRuleConstraint { - listOfType: GraphQLGrammarRuleName; -} - -export interface GraphQLGrammarPeekConstraint - extends GraphQLGrammarBaseRuleConstraint { - peek: Array; -} - -export interface GraphQLGrammarPeekConstraintCondition { - ifCondition: GraphQLGrammarTokenConstraint; - expect: GraphQLGrammarRule; - end?: boolean; -} - -const grammar: GraphQLGrammarType = { - Name: { token: 'Name' }, - String: { token: 'String' }, - BlockString: { token: 'BlockString' }, - - Document: { listOfType: 'Definition' }, - Definition: { - peek: [ - { - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - }, - expect: 'OperationDefinition', - }, - { - ifCondition: { token: 'Name', ofValue: 'fragment' }, - expect: 'FragmentDefinition', - }, - { - ifCondition: { - token: 'Name', - oneOf: [ - 'schema', - 'scalar', - 'type', - 'interface', - 'union', - 'enum', - 'input', - 'directive', - ], - }, - expect: 'TypeSystemDefinition', - }, - { - ifCondition: { token: 'Name', ofValue: 'extend' }, - expect: 'TypeSystemExtension', - }, - { - ifCondition: { token: '{' }, - expect: 'OperationDefinition', - }, - { - ifCondition: 'String', - expect: 'TypeSystemDefinition', - }, - { - ifCondition: 'BlockString', - expect: 'TypeSystemDefinition', - }, - ], - }, - - OperationDefinition: { - peek: [ - { - ifCondition: { token: '{' }, - expect: 'SelectionSet', - }, - { - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - }, - expect: [ - 'OperationType', - { - token: 'Name', - optional: true, - tokenName: 'OperationName', - definitionName: true, - }, - { ofType: 'VariableDefinitions', optional: true }, - { ofType: 'Directives', optional: true }, - 'SelectionSet', - ], - }, - ], - }, - OperationType: { - ofType: 'OperationTypeName', - }, - OperationTypeName: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - definitionName: true, - }, - SelectionSet: [{ token: '{' }, { listOfType: 'Selection' }, { token: '}' }], - Selection: { - peek: [ - { - ifCondition: { token: '...' }, - expect: 'Fragment', - }, - { - ifCondition: { token: 'Name' }, - expect: 'Field', - }, - ], - }, - - Field: [ - { - ofType: 'Alias', - optional: true, - eatNextOnFail: true, - definitionName: true, - }, - { token: 'Name', tokenName: 'FieldName', definitionName: true }, - { ofType: 'Arguments', optional: true }, - { ofType: 'Directives', optional: true }, - { ofType: 'SelectionSet', optional: true }, - ], - - Arguments: [{ token: '(' }, { listOfType: 'Argument' }, { token: ')' }], - Argument: [ - { token: 'Name', tokenName: 'ArgumentName', definitionName: true }, - { token: ':' }, - 'Value', - ], - - Alias: [ - { token: 'Name', tokenName: 'AliasName', definitionName: true }, - { token: ':' }, - ], - - Fragment: [ - { token: '...' }, - { - peek: [ - { - ifCondition: 'FragmentName', - expect: 'FragmentSpread', - }, - { - ifCondition: { token: 'Name', ofValue: 'on' }, - expect: 'InlineFragment', - }, - { - ifCondition: { token: '@' }, - expect: 'InlineFragment', - }, - { - ifCondition: { token: '{' }, - expect: 'InlineFragment', - }, - ], - }, - ], - - FragmentSpread: ['FragmentName', { ofType: 'Directives', optional: true }], - FragmentDefinition: [ - { - token: 'Name', - ofValue: 'fragment', - tokenName: 'FragmentDefinitionKeyword', - }, - 'FragmentName', - 'TypeCondition', - { ofType: 'Directives', optional: true }, - 'SelectionSet', - ], - FragmentName: { - token: 'Name', - butNot: { token: 'Name', ofValue: 'on' }, - definitionName: true, - }, - - TypeCondition: [ - { token: 'Name', ofValue: 'on', tokenName: 'OnKeyword' }, - 'TypeName', - ], - - InlineFragment: [ - { ofType: 'TypeCondition', optional: true }, - { ofType: 'Directives', optional: true }, - 'SelectionSet', - ], - - Value: { - peek: [ - { - ifCondition: { token: '$' }, - expect: 'Variable', - }, - { - ifCondition: 'IntValue', - expect: { ofType: 'IntValue', tokenName: 'NumberValue' }, - }, - { - ifCondition: 'FloatValue', - expect: { ofType: 'FloatValue', tokenName: 'NumberValue' }, - }, - { - ifCondition: 'BooleanValue', - expect: { ofType: 'BooleanValue', tokenName: 'BooleanValue' }, - }, - { - ifCondition: 'EnumValue', - expect: { ofType: 'EnumValue', tokenName: 'EnumValue' }, - }, - { - ifCondition: 'String', - expect: { ofType: 'String', tokenName: 'StringValue' }, - }, - { - ifCondition: 'BlockString', - expect: { ofType: 'BlockString', tokenName: 'StringValue' }, - }, - { - ifCondition: 'NullValue', - expect: { ofType: 'NullValue', tokenName: 'NullValue' }, - }, - { - ifCondition: { token: '[' }, - expect: 'ListValue', - }, - { - ifCondition: { token: '{' }, - expect: 'ObjectValue', - }, - ], - }, - - ConstValue: { - peek: [ - { - ifCondition: 'IntValue', - expect: { ofType: 'IntValue' }, - }, - { - ifCondition: 'FloatValue', - expect: { ofType: 'FloatValue' }, - }, - { - ifCondition: 'BooleanValue', - expect: 'BooleanValue', - }, - { - ifCondition: 'EnumValue', - expect: 'EnumValue', - }, - { - ifCondition: 'String', - expect: { ofType: 'String', tokenName: 'StringValue' }, - }, - { - ifCondition: 'BlockString', - expect: { token: 'BlockString', tokenName: 'StringValue' }, - }, - { - ifCondition: 'NullValue', - expect: 'NullValue', - }, - { - ifCondition: { token: '[' }, - expect: 'ConstListValue', - }, - { - ifCondition: { token: '{' }, - expect: 'ObjectValue', - }, - ], - }, - - IntValue: { token: 'Int' }, - - FloatValue: { token: 'Float' }, - - StringValue: { - peek: [ - { - ifCondition: { token: 'String' }, - expect: { token: 'String', tokenName: 'StringValue' }, - }, - { - ifCondition: { token: 'BlockString' }, - expect: { token: 'BlockString', tokenName: 'StringValue' }, - }, - ], - }, - - BooleanValue: { - token: 'Name', - oneOf: ['true', 'false'], - tokenName: 'BooleanValue', - }, - - NullValue: { - token: 'Name', - ofValue: 'null', - tokenName: 'NullValue', - }, - - EnumValue: { - token: 'Name', - butNot: { token: 'Name', oneOf: ['null', 'true', 'false'] }, - tokenName: 'EnumValue', - }, - - ListValue: [ - { token: '[' }, - { listOfType: 'Value', optional: true }, - { token: ']' }, - ], - - ConstListValue: [ - { token: '[' }, - { listOfType: 'ConstValue', optional: true }, - { token: ']' }, - ], - - ObjectValue: [ - { token: '{' }, - { listOfType: 'ObjectField', optional: true }, - { token: '}' }, - ], - ObjectField: [ - { token: 'Name', tokenName: 'ObjectFieldName' }, - { token: ':' }, - { ofType: 'ConstValue' }, - ], - - Variable: [ - { token: '$', tokenName: 'VariableName' }, - { token: 'Name', tokenName: 'VariableName' }, - ], - VariableDefinitions: [ - { token: '(' }, - { listOfType: 'VariableDefinition' }, - { token: ')' }, - ], - VariableDefinition: [ - 'Variable', - { token: ':' }, - 'Type', - { ofType: 'DefaultValue', optional: true }, - ], - DefaultValue: [{ token: '=' }, 'ConstValue'], - - TypeName: { token: 'Name', tokenName: 'TypeName', typeName: true }, - - Type: { - peek: [ - { - ifCondition: { token: 'Name' }, - expect: ['TypeName', { token: '!', optional: true }], - }, - { - ifCondition: { token: '[' }, - expect: 'ListType', - }, - ], - }, - ListType: [ - { token: '[' }, - { listOfType: 'Type' }, - { token: ']' }, - { token: '!', optional: true }, - ], - - Directives: { listOfType: 'Directive' }, - Directive: [ - { token: '@', tokenName: 'DirectiveName' }, - { token: 'Name', tokenName: 'DirectiveName' }, - { ofType: 'Arguments', optional: true }, - ], - - TypeSystemDefinition: [ - { ofType: 'Description', optional: true }, - { - peek: [ - { - ifCondition: { - target: 'Name', - ofValue: 'schema', - }, - expect: 'SchemaDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'scalar', - }, - expect: 'ScalarTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'type', - }, - expect: 'ObjectTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'interface', - }, - expect: 'InterfaceTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'union', - }, - expect: 'UnionTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'enum', - }, - expect: 'EnumTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'input', - }, - expect: 'InputObjectTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'directive', - }, - expect: 'DirectiveDefinition', - }, - ], - }, - ], - - TypeSystemExtension: { - peek: [ - { - ifCondition: { - target: 'Name', - ofValue: 'schema', - }, - expect: 'SchemaExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'scalar', - }, - expect: 'ScalarTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'type', - }, - expect: 'ObjectTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'interface', - }, - expect: 'InterfaceTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'union', - }, - expect: 'UnionTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'enum', - }, - expect: 'EnumTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'input', - }, - expect: 'InputObjectTypeExtension', - }, - ], - }, - - SchemaDefinition: [ - { - token: 'Name', - ofValue: 'schema', - tokenName: 'SchemaDefinitionKeyword', - }, - { ofType: 'Directives', optional: true }, - { token: '{' }, - { listOfType: 'RootOperationTypeDefinition' }, - { token: '}' }, - ], - RootOperationTypeDefinition: [ - 'OperationType', - { token: ':' }, - { token: 'Name', tokenName: 'OperationTypeDefinitionName' }, - ], - - SchemaExtension: [ - { token: 'Name', ofValue: 'extend' }, - { token: 'Name', ofValue: 'schema' }, - 'Name', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { - ofType: [ - { token: '{' }, - { listOfType: 'RootOperationTypeDefinition' }, - { token: '}' }, - ], - optional: true, - }, - ], - }, - { - ifCondition: { token: '{' }, - expect: [ - { token: '{' }, - { listOfType: 'RootOperationTypeDefinition' }, - { token: '}' }, - ], - }, - ], - }, - ], - - Description: 'StringValue', - - ScalarTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - ], - - ScalarTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword', - }, - 'TypeName', - 'Directives', - ], - - ObjectTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword', - }, - 'TypeName', - { ofType: 'ImplementsInterfaces', optional: true }, - { ofType: 'Directives', optional: true }, - { ofType: 'FieldsDefinition', optional: true }, - ], - ImplementsInterfaces: [ - { - token: 'Name', - ofValue: 'implements', - tokenName: 'ImplementsKeyword', - }, - { token: '&', optional: true }, - 'TypeName', - { - listOfType: 'ImplementsAdditionalInterfaceName', - optional: true, - }, - ], - ImplementsAdditionalInterfaceName: [{ token: '&' }, 'TypeName'], - FieldsDefinition: [ - { token: '{' }, - { listOfType: 'FieldDefinition' }, - { token: '}' }, - ], - FieldDefinition: [ - { ofType: 'Description', optional: true }, - { token: 'Name', tokenName: 'AliasName', definitionName: true }, - { ofType: 'ArgumentsDefinition', optional: true }, - { token: ':' }, - 'Type', - { ofType: 'Directives', optional: true }, - ], - - ArgumentsDefinition: [ - { token: '(' }, - { listOfType: 'InputValueDefinition' }, - { token: ')' }, - ], - InputValueDefinition: [ - { ofType: 'Description', optional: true }, - { token: 'Name', tokenName: 'ArgumentName' }, - { token: ':' }, - 'Type', - { ofType: 'DefaultValue', optional: true }, - { ofType: 'Directives', optional: true }, - ], - - ObjectTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: 'Name', ofValue: 'interface' }, - expect: [ - 'ImplementsInterfaces', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'FieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'FieldsDefinition', - }, - ], - optional: true, - }, - ], - }, - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'FieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'FieldsDefinition', - }, - ], - }, - ], - - InterfaceTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'FieldsDefinition', optional: true }, - ], - - InterfaceTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'FieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'FieldsDefinition', - }, - ], - }, - ], - - UnionTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'UnionMemberTypes', optional: true }, - ], - - UnionMemberTypes: [ - { token: '=' }, - { token: '|', optional: true }, - 'Name', - { - listOfType: 'UnionMemberAdditionalTypeName', - optional: true, - }, - ], - - UnionMemberAdditionalTypeName: [{ token: '|' }, 'TypeName'], - - UnionTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'UnionMemberTypes', optional: true }, - ], - }, - { - ifCondition: { token: '=' }, - expect: 'UnionMemberTypes', - }, - ], - }, - ], - - EnumTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'EnumValuesDefinition', optional: true }, - ], - EnumValuesDefinition: [ - { token: '{' }, - { listOfType: 'EnumValueDefinition' }, - { token: '}' }, - ], - EnumValueDefinition: [ - { ofType: 'Description', optional: true }, - 'EnumValue', - { ofType: 'Directives', optional: true }, - ], - - EnumTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'EnumValuesDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'EnumValuesDefinition', - }, - ], - }, - ], - - InputObjectTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'InputFieldsDefinition', optional: true }, - ], - InputFieldsDefinition: [ - { token: '{' }, - { listOfType: 'InputValueDefinition' }, - { token: '}' }, - ], - - InputObjectTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'InputFieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'InputFieldsDefinition', - }, - ], - }, - ], - - DirectiveDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'directive', - tokenName: 'DirectiveDefinitionKeyword', - }, - { token: '@', tokenName: 'DirectiveName' }, - { token: 'Name', tokenName: 'DirectiveName' }, - { ofType: 'ArgumentsDefinition', optional: true }, - { token: 'Name', ofValue: 'on', tokenName: 'OnKeyword' }, - 'DirectiveLocations', - ], - DirectiveLocations: [ - { token: '|', optional: true }, - 'DirectiveLocation', - { - listOfType: 'DirectiveLocationAdditionalName', - optional: true, - }, - ], - DirectiveLocationAdditionalName: [{ token: '|' }, 'DirectiveLocation'], - DirectiveLocation: { - peek: [ - { - ifCondition: 'ExecutableDirectiveLocation', - expect: 'ExecutableDirectiveLocation', - }, - { - ifCondition: 'TypeSystemDirectiveLocation', - expect: 'TypeSystemDirectiveLocation', - }, - ], - }, - ExecutableDirectiveLocation: { - token: 'Name', - oneOf: [ - 'QUERY', - 'MUTATION', - 'SUBSCRIPTION', - 'FIELD', - 'FRAGMENT_DEFINITION', - 'FRAGMENT_SPREAD', - 'INLINE_FRAGMENT', - ], - tokenName: 'EnumValue', - }, - TypeSystemDirectiveLocation: { - token: 'Name', - oneOf: [ - 'SCHEMA', - 'SCALAR', - 'OBJECT', - 'FIELD_DEFINITION', - 'ARGUMENT_DEFINITION', - 'INTERFACE', - 'UNION', - 'ENUM', - 'ENUM_VALUE', - 'INPUT_OBJECT', - 'INPUT_FIELD_DEFINITION', - ], - tokenName: 'EnumValue', - }, -}; - -export default grammar; diff --git a/node_modules/graphql/language/experimentalOnlineParser/grammar.js b/node_modules/graphql/language/experimentalOnlineParser/grammar.js deleted file mode 100644 index 45c8f7ac..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/grammar.js +++ /dev/null @@ -1,987 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var grammar = { - Name: { - token: 'Name' - }, - String: { - token: 'String' - }, - BlockString: { - token: 'BlockString' - }, - Document: { - listOfType: 'Definition' - }, - Definition: { - peek: [{ - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'] - }, - expect: 'OperationDefinition' - }, { - ifCondition: { - token: 'Name', - ofValue: 'fragment' - }, - expect: 'FragmentDefinition' - }, { - ifCondition: { - token: 'Name', - oneOf: ['schema', 'scalar', 'type', 'interface', 'union', 'enum', 'input', 'directive'] - }, - expect: 'TypeSystemDefinition' - }, { - ifCondition: { - token: 'Name', - ofValue: 'extend' - }, - expect: 'TypeSystemExtension' - }, { - ifCondition: { - token: '{' - }, - expect: 'OperationDefinition' - }, { - ifCondition: 'String', - expect: 'TypeSystemDefinition' - }, { - ifCondition: 'BlockString', - expect: 'TypeSystemDefinition' - }] - }, - OperationDefinition: { - peek: [{ - ifCondition: { - token: '{' - }, - expect: 'SelectionSet' - }, { - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'] - }, - expect: ['OperationType', { - token: 'Name', - optional: true, - tokenName: 'OperationName', - definitionName: true - }, { - ofType: 'VariableDefinitions', - optional: true - }, { - ofType: 'Directives', - optional: true - }, 'SelectionSet'] - }] - }, - OperationType: { - ofType: 'OperationTypeName' - }, - OperationTypeName: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - definitionName: true - }, - SelectionSet: [{ - token: '{' - }, { - listOfType: 'Selection' - }, { - token: '}' - }], - Selection: { - peek: [{ - ifCondition: { - token: '...' - }, - expect: 'Fragment' - }, { - ifCondition: { - token: 'Name' - }, - expect: 'Field' - }] - }, - Field: [{ - ofType: 'Alias', - optional: true, - eatNextOnFail: true, - definitionName: true - }, { - token: 'Name', - tokenName: 'FieldName', - definitionName: true - }, { - ofType: 'Arguments', - optional: true - }, { - ofType: 'Directives', - optional: true - }, { - ofType: 'SelectionSet', - optional: true - }], - Arguments: [{ - token: '(' - }, { - listOfType: 'Argument' - }, { - token: ')' - }], - Argument: [{ - token: 'Name', - tokenName: 'ArgumentName', - definitionName: true - }, { - token: ':' - }, 'Value'], - Alias: [{ - token: 'Name', - tokenName: 'AliasName', - definitionName: true - }, { - token: ':' - }], - Fragment: [{ - token: '...' - }, { - peek: [{ - ifCondition: 'FragmentName', - expect: 'FragmentSpread' - }, { - ifCondition: { - token: 'Name', - ofValue: 'on' - }, - expect: 'InlineFragment' - }, { - ifCondition: { - token: '@' - }, - expect: 'InlineFragment' - }, { - ifCondition: { - token: '{' - }, - expect: 'InlineFragment' - }] - }], - FragmentSpread: ['FragmentName', { - ofType: 'Directives', - optional: true - }], - FragmentDefinition: [{ - token: 'Name', - ofValue: 'fragment', - tokenName: 'FragmentDefinitionKeyword' - }, 'FragmentName', 'TypeCondition', { - ofType: 'Directives', - optional: true - }, 'SelectionSet'], - FragmentName: { - token: 'Name', - butNot: { - token: 'Name', - ofValue: 'on' - }, - definitionName: true - }, - TypeCondition: [{ - token: 'Name', - ofValue: 'on', - tokenName: 'OnKeyword' - }, 'TypeName'], - InlineFragment: [{ - ofType: 'TypeCondition', - optional: true - }, { - ofType: 'Directives', - optional: true - }, 'SelectionSet'], - Value: { - peek: [{ - ifCondition: { - token: '$' - }, - expect: 'Variable' - }, { - ifCondition: 'IntValue', - expect: { - ofType: 'IntValue', - tokenName: 'NumberValue' - } - }, { - ifCondition: 'FloatValue', - expect: { - ofType: 'FloatValue', - tokenName: 'NumberValue' - } - }, { - ifCondition: 'BooleanValue', - expect: { - ofType: 'BooleanValue', - tokenName: 'BooleanValue' - } - }, { - ifCondition: 'EnumValue', - expect: { - ofType: 'EnumValue', - tokenName: 'EnumValue' - } - }, { - ifCondition: 'String', - expect: { - ofType: 'String', - tokenName: 'StringValue' - } - }, { - ifCondition: 'BlockString', - expect: { - ofType: 'BlockString', - tokenName: 'StringValue' - } - }, { - ifCondition: 'NullValue', - expect: { - ofType: 'NullValue', - tokenName: 'NullValue' - } - }, { - ifCondition: { - token: '[' - }, - expect: 'ListValue' - }, { - ifCondition: { - token: '{' - }, - expect: 'ObjectValue' - }] - }, - ConstValue: { - peek: [{ - ifCondition: 'IntValue', - expect: { - ofType: 'IntValue' - } - }, { - ifCondition: 'FloatValue', - expect: { - ofType: 'FloatValue' - } - }, { - ifCondition: 'BooleanValue', - expect: 'BooleanValue' - }, { - ifCondition: 'EnumValue', - expect: 'EnumValue' - }, { - ifCondition: 'String', - expect: { - ofType: 'String', - tokenName: 'StringValue' - } - }, { - ifCondition: 'BlockString', - expect: { - token: 'BlockString', - tokenName: 'StringValue' - } - }, { - ifCondition: 'NullValue', - expect: 'NullValue' - }, { - ifCondition: { - token: '[' - }, - expect: 'ConstListValue' - }, { - ifCondition: { - token: '{' - }, - expect: 'ObjectValue' - }] - }, - IntValue: { - token: 'Int' - }, - FloatValue: { - token: 'Float' - }, - StringValue: { - peek: [{ - ifCondition: { - token: 'String' - }, - expect: { - token: 'String', - tokenName: 'StringValue' - } - }, { - ifCondition: { - token: 'BlockString' - }, - expect: { - token: 'BlockString', - tokenName: 'StringValue' - } - }] - }, - BooleanValue: { - token: 'Name', - oneOf: ['true', 'false'], - tokenName: 'BooleanValue' - }, - NullValue: { - token: 'Name', - ofValue: 'null', - tokenName: 'NullValue' - }, - EnumValue: { - token: 'Name', - butNot: { - token: 'Name', - oneOf: ['null', 'true', 'false'] - }, - tokenName: 'EnumValue' - }, - ListValue: [{ - token: '[' - }, { - listOfType: 'Value', - optional: true - }, { - token: ']' - }], - ConstListValue: [{ - token: '[' - }, { - listOfType: 'ConstValue', - optional: true - }, { - token: ']' - }], - ObjectValue: [{ - token: '{' - }, { - listOfType: 'ObjectField', - optional: true - }, { - token: '}' - }], - ObjectField: [{ - token: 'Name', - tokenName: 'ObjectFieldName' - }, { - token: ':' - }, { - ofType: 'ConstValue' - }], - Variable: [{ - token: '$', - tokenName: 'VariableName' - }, { - token: 'Name', - tokenName: 'VariableName' - }], - VariableDefinitions: [{ - token: '(' - }, { - listOfType: 'VariableDefinition' - }, { - token: ')' - }], - VariableDefinition: ['Variable', { - token: ':' - }, 'Type', { - ofType: 'DefaultValue', - optional: true - }], - DefaultValue: [{ - token: '=' - }, 'ConstValue'], - TypeName: { - token: 'Name', - tokenName: 'TypeName', - typeName: true - }, - Type: { - peek: [{ - ifCondition: { - token: 'Name' - }, - expect: ['TypeName', { - token: '!', - optional: true - }] - }, { - ifCondition: { - token: '[' - }, - expect: 'ListType' - }] - }, - ListType: [{ - token: '[' - }, { - listOfType: 'Type' - }, { - token: ']' - }, { - token: '!', - optional: true - }], - Directives: { - listOfType: 'Directive' - }, - Directive: [{ - token: '@', - tokenName: 'DirectiveName' - }, { - token: 'Name', - tokenName: 'DirectiveName' - }, { - ofType: 'Arguments', - optional: true - }], - TypeSystemDefinition: [{ - ofType: 'Description', - optional: true - }, { - peek: [{ - ifCondition: { - target: 'Name', - ofValue: 'schema' - }, - expect: 'SchemaDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'scalar' - }, - expect: 'ScalarTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'type' - }, - expect: 'ObjectTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'interface' - }, - expect: 'InterfaceTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'union' - }, - expect: 'UnionTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'enum' - }, - expect: 'EnumTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'input' - }, - expect: 'InputObjectTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'directive' - }, - expect: 'DirectiveDefinition' - }] - }], - TypeSystemExtension: { - peek: [{ - ifCondition: { - target: 'Name', - ofValue: 'schema' - }, - expect: 'SchemaExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'scalar' - }, - expect: 'ScalarTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'type' - }, - expect: 'ObjectTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'interface' - }, - expect: 'InterfaceTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'union' - }, - expect: 'UnionTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'enum' - }, - expect: 'EnumTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'input' - }, - expect: 'InputObjectTypeExtension' - }] - }, - SchemaDefinition: [{ - token: 'Name', - ofValue: 'schema', - tokenName: 'SchemaDefinitionKeyword' - }, { - ofType: 'Directives', - optional: true - }, { - token: '{' - }, { - listOfType: 'RootOperationTypeDefinition' - }, { - token: '}' - }], - RootOperationTypeDefinition: ['OperationType', { - token: ':' - }, { - token: 'Name', - tokenName: 'OperationTypeDefinitionName' - }], - SchemaExtension: [{ - token: 'Name', - ofValue: 'extend' - }, { - token: 'Name', - ofValue: 'schema' - }, 'Name', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: [{ - token: '{' - }, { - listOfType: 'RootOperationTypeDefinition' - }, { - token: '}' - }], - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: [{ - token: '{' - }, { - listOfType: 'RootOperationTypeDefinition' - }, { - token: '}' - }] - }] - }], - Description: 'StringValue', - ScalarTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }], - ScalarTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword' - }, 'TypeName', 'Directives'], - ObjectTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword' - }, 'TypeName', { - ofType: 'ImplementsInterfaces', - optional: true - }, { - ofType: 'Directives', - optional: true - }, { - ofType: 'FieldsDefinition', - optional: true - }], - ImplementsInterfaces: [{ - token: 'Name', - ofValue: 'implements', - tokenName: 'ImplementsKeyword' - }, { - token: '&', - optional: true - }, 'TypeName', { - listOfType: 'ImplementsAdditionalInterfaceName', - optional: true - }], - ImplementsAdditionalInterfaceName: [{ - token: '&' - }, 'TypeName'], - FieldsDefinition: [{ - token: '{' - }, { - listOfType: 'FieldDefinition' - }, { - token: '}' - }], - FieldDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - tokenName: 'AliasName', - definitionName: true - }, { - ofType: 'ArgumentsDefinition', - optional: true - }, { - token: ':' - }, 'Type', { - ofType: 'Directives', - optional: true - }], - ArgumentsDefinition: [{ - token: '(' - }, { - listOfType: 'InputValueDefinition' - }, { - token: ')' - }], - InputValueDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - tokenName: 'ArgumentName' - }, { - token: ':' - }, 'Type', { - ofType: 'DefaultValue', - optional: true - }, { - ofType: 'Directives', - optional: true - }], - ObjectTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: 'Name', - ofValue: 'interface' - }, - expect: ['ImplementsInterfaces', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'FieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'FieldsDefinition' - }], - optional: true - }] - }, { - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'FieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'FieldsDefinition' - }] - }], - InterfaceTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'FieldsDefinition', - optional: true - }], - InterfaceTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'FieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'FieldsDefinition' - }] - }], - UnionTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'UnionMemberTypes', - optional: true - }], - UnionMemberTypes: [{ - token: '=' - }, { - token: '|', - optional: true - }, 'Name', { - listOfType: 'UnionMemberAdditionalTypeName', - optional: true - }], - UnionMemberAdditionalTypeName: [{ - token: '|' - }, 'TypeName'], - UnionTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'UnionMemberTypes', - optional: true - }] - }, { - ifCondition: { - token: '=' - }, - expect: 'UnionMemberTypes' - }] - }], - EnumTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'EnumValuesDefinition', - optional: true - }], - EnumValuesDefinition: [{ - token: '{' - }, { - listOfType: 'EnumValueDefinition' - }, { - token: '}' - }], - EnumValueDefinition: [{ - ofType: 'Description', - optional: true - }, 'EnumValue', { - ofType: 'Directives', - optional: true - }], - EnumTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'EnumValuesDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'EnumValuesDefinition' - }] - }], - InputObjectTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'InputFieldsDefinition', - optional: true - }], - InputFieldsDefinition: [{ - token: '{' - }, { - listOfType: 'InputValueDefinition' - }, { - token: '}' - }], - InputObjectTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'InputFieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'InputFieldsDefinition' - }] - }], - DirectiveDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'directive', - tokenName: 'DirectiveDefinitionKeyword' - }, { - token: '@', - tokenName: 'DirectiveName' - }, { - token: 'Name', - tokenName: 'DirectiveName' - }, { - ofType: 'ArgumentsDefinition', - optional: true - }, { - token: 'Name', - ofValue: 'on', - tokenName: 'OnKeyword' - }, 'DirectiveLocations'], - DirectiveLocations: [{ - token: '|', - optional: true - }, 'DirectiveLocation', { - listOfType: 'DirectiveLocationAdditionalName', - optional: true - }], - DirectiveLocationAdditionalName: [{ - token: '|' - }, 'DirectiveLocation'], - DirectiveLocation: { - peek: [{ - ifCondition: 'ExecutableDirectiveLocation', - expect: 'ExecutableDirectiveLocation' - }, { - ifCondition: 'TypeSystemDirectiveLocation', - expect: 'TypeSystemDirectiveLocation' - }] - }, - ExecutableDirectiveLocation: { - token: 'Name', - oneOf: ['QUERY', 'MUTATION', 'SUBSCRIPTION', 'FIELD', 'FRAGMENT_DEFINITION', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'], - tokenName: 'EnumValue' - }, - TypeSystemDirectiveLocation: { - token: 'Name', - oneOf: ['SCHEMA', 'SCALAR', 'OBJECT', 'FIELD_DEFINITION', 'ARGUMENT_DEFINITION', 'INTERFACE', 'UNION', 'ENUM', 'ENUM_VALUE', 'INPUT_OBJECT', 'INPUT_FIELD_DEFINITION'], - tokenName: 'EnumValue' - } // FIXME: enforce proper typing - -}; -var _default = grammar; -exports.default = _default; diff --git a/node_modules/graphql/language/experimentalOnlineParser/grammar.js.flow b/node_modules/graphql/language/experimentalOnlineParser/grammar.js.flow deleted file mode 100644 index f1d2f10f..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/grammar.js.flow +++ /dev/null @@ -1,1000 +0,0 @@ -// @flow strict -export type GraphQLGrammarType = {| - [name: string]: GraphQLGrammarRule, -|}; -export type GraphQLGrammarRuleName = string; -export type GraphQLGrammarRuleConstraint = - | GraphQLGrammarTokenConstraint - | GraphQLGrammarOfTypeConstraint - | GraphQLGrammarListOfTypeConstraint - | GraphQLGrammarPeekConstraint; -export type GraphQLGrammarConstraintsSet = Array< - GraphQLGrammarRuleName | GraphQLGrammarRuleConstraint, ->; -export type GraphQLGrammarRule = - | GraphQLGrammarRuleName - | GraphQLGrammarRuleConstraint - | GraphQLGrammarConstraintsSet; -export interface GraphQLGrammarBaseRuleConstraint { - butNot?: - | ?GraphQLGrammarTokenConstraint - | ?Array; - optional?: boolean; - eatNextOnFail?: boolean; -} -export interface GraphQLGrammarTokenConstraint - extends GraphQLGrammarBaseRuleConstraint { - token: - | '!' - | '$' - | '&' - | '(' - | ')' - | '...' - | ':' - | '=' - | '@' - | '[' - | ']' - | '{' - | '}' - | '|' - | 'Name' - | 'Int' - | 'Float' - | 'String' - | 'BlockString' - | 'Comment'; - ofValue?: ?string; - oneOf?: ?Array; - tokenName?: string; - definitionName?: boolean; - typeName?: boolean; -} -export interface GraphQLGrammarOfTypeConstraint - extends GraphQLGrammarBaseRuleConstraint { - ofType: GraphQLGrammarRule; - tokenName?: string; -} -export interface GraphQLGrammarListOfTypeConstraint - extends GraphQLGrammarBaseRuleConstraint { - listOfType: GraphQLGrammarRuleName; -} -export interface GraphQLGrammarPeekConstraint - extends GraphQLGrammarBaseRuleConstraint { - peek: Array; -} -export interface GraphQLGrammarPeekConstraintCondition { - ifCondition: GraphQLGrammarTokenConstraint; - expect: GraphQLGrammarRule; - end?: boolean; -} - -const grammar: GraphQLGrammarType = ({ - Name: { token: 'Name' }, - String: { token: 'String' }, - BlockString: { token: 'BlockString' }, - - Document: { listOfType: 'Definition' }, - Definition: { - peek: [ - { - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - }, - expect: 'OperationDefinition', - }, - { - ifCondition: { token: 'Name', ofValue: 'fragment' }, - expect: 'FragmentDefinition', - }, - { - ifCondition: { - token: 'Name', - oneOf: [ - 'schema', - 'scalar', - 'type', - 'interface', - 'union', - 'enum', - 'input', - 'directive', - ], - }, - expect: 'TypeSystemDefinition', - }, - { - ifCondition: { token: 'Name', ofValue: 'extend' }, - expect: 'TypeSystemExtension', - }, - { - ifCondition: { token: '{' }, - expect: 'OperationDefinition', - }, - { - ifCondition: 'String', - expect: 'TypeSystemDefinition', - }, - { - ifCondition: 'BlockString', - expect: 'TypeSystemDefinition', - }, - ], - }, - - OperationDefinition: { - peek: [ - { - ifCondition: { token: '{' }, - expect: 'SelectionSet', - }, - { - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - }, - expect: [ - 'OperationType', - { - token: 'Name', - optional: true, - tokenName: 'OperationName', - definitionName: true, - }, - { ofType: 'VariableDefinitions', optional: true }, - { ofType: 'Directives', optional: true }, - 'SelectionSet', - ], - }, - ], - }, - OperationType: { - ofType: 'OperationTypeName', - }, - OperationTypeName: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - definitionName: true, - }, - SelectionSet: [{ token: '{' }, { listOfType: 'Selection' }, { token: '}' }], - Selection: { - peek: [ - { - ifCondition: { token: '...' }, - expect: 'Fragment', - }, - { - ifCondition: { token: 'Name' }, - expect: 'Field', - }, - ], - }, - - Field: [ - { - ofType: 'Alias', - optional: true, - eatNextOnFail: true, - definitionName: true, - }, - { token: 'Name', tokenName: 'FieldName', definitionName: true }, - { ofType: 'Arguments', optional: true }, - { ofType: 'Directives', optional: true }, - { ofType: 'SelectionSet', optional: true }, - ], - - Arguments: [{ token: '(' }, { listOfType: 'Argument' }, { token: ')' }], - Argument: [ - { token: 'Name', tokenName: 'ArgumentName', definitionName: true }, - { token: ':' }, - 'Value', - ], - - Alias: [ - { token: 'Name', tokenName: 'AliasName', definitionName: true }, - { token: ':' }, - ], - - Fragment: [ - { token: '...' }, - { - peek: [ - { - ifCondition: 'FragmentName', - expect: 'FragmentSpread', - }, - { - ifCondition: { token: 'Name', ofValue: 'on' }, - expect: 'InlineFragment', - }, - { - ifCondition: { token: '@' }, - expect: 'InlineFragment', - }, - { - ifCondition: { token: '{' }, - expect: 'InlineFragment', - }, - ], - }, - ], - - FragmentSpread: ['FragmentName', { ofType: 'Directives', optional: true }], - FragmentDefinition: [ - { - token: 'Name', - ofValue: 'fragment', - tokenName: 'FragmentDefinitionKeyword', - }, - 'FragmentName', - 'TypeCondition', - { ofType: 'Directives', optional: true }, - 'SelectionSet', - ], - FragmentName: { - token: 'Name', - butNot: { token: 'Name', ofValue: 'on' }, - definitionName: true, - }, - - TypeCondition: [ - { token: 'Name', ofValue: 'on', tokenName: 'OnKeyword' }, - 'TypeName', - ], - - InlineFragment: [ - { ofType: 'TypeCondition', optional: true }, - { ofType: 'Directives', optional: true }, - 'SelectionSet', - ], - - Value: { - peek: [ - { - ifCondition: { token: '$' }, - expect: 'Variable', - }, - { - ifCondition: 'IntValue', - expect: { ofType: 'IntValue', tokenName: 'NumberValue' }, - }, - { - ifCondition: 'FloatValue', - expect: { ofType: 'FloatValue', tokenName: 'NumberValue' }, - }, - { - ifCondition: 'BooleanValue', - expect: { ofType: 'BooleanValue', tokenName: 'BooleanValue' }, - }, - { - ifCondition: 'EnumValue', - expect: { ofType: 'EnumValue', tokenName: 'EnumValue' }, - }, - { - ifCondition: 'String', - expect: { ofType: 'String', tokenName: 'StringValue' }, - }, - { - ifCondition: 'BlockString', - expect: { ofType: 'BlockString', tokenName: 'StringValue' }, - }, - { - ifCondition: 'NullValue', - expect: { ofType: 'NullValue', tokenName: 'NullValue' }, - }, - { - ifCondition: { token: '[' }, - expect: 'ListValue', - }, - { - ifCondition: { token: '{' }, - expect: 'ObjectValue', - }, - ], - }, - - ConstValue: { - peek: [ - { - ifCondition: 'IntValue', - expect: { ofType: 'IntValue' }, - }, - { - ifCondition: 'FloatValue', - expect: { ofType: 'FloatValue' }, - }, - { - ifCondition: 'BooleanValue', - expect: 'BooleanValue', - }, - { - ifCondition: 'EnumValue', - expect: 'EnumValue', - }, - { - ifCondition: 'String', - expect: { ofType: 'String', tokenName: 'StringValue' }, - }, - { - ifCondition: 'BlockString', - expect: { token: 'BlockString', tokenName: 'StringValue' }, - }, - { - ifCondition: 'NullValue', - expect: 'NullValue', - }, - { - ifCondition: { token: '[' }, - expect: 'ConstListValue', - }, - { - ifCondition: { token: '{' }, - expect: 'ObjectValue', - }, - ], - }, - - IntValue: { token: 'Int' }, - - FloatValue: { token: 'Float' }, - - StringValue: { - peek: [ - { - ifCondition: { token: 'String' }, - expect: { token: 'String', tokenName: 'StringValue' }, - }, - { - ifCondition: { token: 'BlockString' }, - expect: { token: 'BlockString', tokenName: 'StringValue' }, - }, - ], - }, - - BooleanValue: { - token: 'Name', - oneOf: ['true', 'false'], - tokenName: 'BooleanValue', - }, - - NullValue: { - token: 'Name', - ofValue: 'null', - tokenName: 'NullValue', - }, - - EnumValue: { - token: 'Name', - butNot: { token: 'Name', oneOf: ['null', 'true', 'false'] }, - tokenName: 'EnumValue', - }, - - ListValue: [ - { token: '[' }, - { listOfType: 'Value', optional: true }, - { token: ']' }, - ], - - ConstListValue: [ - { token: '[' }, - { listOfType: 'ConstValue', optional: true }, - { token: ']' }, - ], - - ObjectValue: [ - { token: '{' }, - { listOfType: 'ObjectField', optional: true }, - { token: '}' }, - ], - ObjectField: [ - { token: 'Name', tokenName: 'ObjectFieldName' }, - { token: ':' }, - { ofType: 'ConstValue' }, - ], - - Variable: [ - { token: '$', tokenName: 'VariableName' }, - { token: 'Name', tokenName: 'VariableName' }, - ], - VariableDefinitions: [ - { token: '(' }, - { listOfType: 'VariableDefinition' }, - { token: ')' }, - ], - VariableDefinition: [ - 'Variable', - { token: ':' }, - 'Type', - { ofType: 'DefaultValue', optional: true }, - ], - DefaultValue: [{ token: '=' }, 'ConstValue'], - - TypeName: { token: 'Name', tokenName: 'TypeName', typeName: true }, - - Type: { - peek: [ - { - ifCondition: { token: 'Name' }, - expect: ['TypeName', { token: '!', optional: true }], - }, - { - ifCondition: { token: '[' }, - expect: 'ListType', - }, - ], - }, - ListType: [ - { token: '[' }, - { listOfType: 'Type' }, - { token: ']' }, - { token: '!', optional: true }, - ], - - Directives: { listOfType: 'Directive' }, - Directive: [ - { token: '@', tokenName: 'DirectiveName' }, - { token: 'Name', tokenName: 'DirectiveName' }, - { ofType: 'Arguments', optional: true }, - ], - - TypeSystemDefinition: [ - { ofType: 'Description', optional: true }, - { - peek: [ - { - ifCondition: { - target: 'Name', - ofValue: 'schema', - }, - expect: 'SchemaDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'scalar', - }, - expect: 'ScalarTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'type', - }, - expect: 'ObjectTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'interface', - }, - expect: 'InterfaceTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'union', - }, - expect: 'UnionTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'enum', - }, - expect: 'EnumTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'input', - }, - expect: 'InputObjectTypeDefinition', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'directive', - }, - expect: 'DirectiveDefinition', - }, - ], - }, - ], - - TypeSystemExtension: { - peek: [ - { - ifCondition: { - target: 'Name', - ofValue: 'schema', - }, - expect: 'SchemaExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'scalar', - }, - expect: 'ScalarTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'type', - }, - expect: 'ObjectTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'interface', - }, - expect: 'InterfaceTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'union', - }, - expect: 'UnionTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'enum', - }, - expect: 'EnumTypeExtension', - }, - { - ifCondition: { - target: 'Name', - ofValue: 'input', - }, - expect: 'InputObjectTypeExtension', - }, - ], - }, - - SchemaDefinition: [ - { - token: 'Name', - ofValue: 'schema', - tokenName: 'SchemaDefinitionKeyword', - }, - { ofType: 'Directives', optional: true }, - { token: '{' }, - { listOfType: 'RootOperationTypeDefinition' }, - { token: '}' }, - ], - RootOperationTypeDefinition: [ - 'OperationType', - { token: ':' }, - { token: 'Name', tokenName: 'OperationTypeDefinitionName' }, - ], - - SchemaExtension: [ - { token: 'Name', ofValue: 'extend' }, - { token: 'Name', ofValue: 'schema' }, - 'Name', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { - ofType: [ - { token: '{' }, - { listOfType: 'RootOperationTypeDefinition' }, - { token: '}' }, - ], - optional: true, - }, - ], - }, - { - ifCondition: { token: '{' }, - expect: [ - { token: '{' }, - { listOfType: 'RootOperationTypeDefinition' }, - { token: '}' }, - ], - }, - ], - }, - ], - - Description: 'StringValue', - - ScalarTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - ], - - ScalarTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword', - }, - 'TypeName', - 'Directives', - ], - - ObjectTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword', - }, - 'TypeName', - { ofType: 'ImplementsInterfaces', optional: true }, - { ofType: 'Directives', optional: true }, - { ofType: 'FieldsDefinition', optional: true }, - ], - ImplementsInterfaces: [ - { - token: 'Name', - ofValue: 'implements', - tokenName: 'ImplementsKeyword', - }, - { token: '&', optional: true }, - 'TypeName', - { - listOfType: 'ImplementsAdditionalInterfaceName', - optional: true, - }, - ], - ImplementsAdditionalInterfaceName: [{ token: '&' }, 'TypeName'], - FieldsDefinition: [ - { token: '{' }, - { listOfType: 'FieldDefinition' }, - { token: '}' }, - ], - FieldDefinition: [ - { ofType: 'Description', optional: true }, - { token: 'Name', tokenName: 'AliasName', definitionName: true }, - { ofType: 'ArgumentsDefinition', optional: true }, - { token: ':' }, - 'Type', - { ofType: 'Directives', optional: true }, - ], - - ArgumentsDefinition: [ - { token: '(' }, - { listOfType: 'InputValueDefinition' }, - { token: ')' }, - ], - InputValueDefinition: [ - { ofType: 'Description', optional: true }, - { token: 'Name', tokenName: 'ArgumentName' }, - { token: ':' }, - 'Type', - { ofType: 'DefaultValue', optional: true }, - { ofType: 'Directives', optional: true }, - ], - - ObjectTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: 'Name', ofValue: 'interface' }, - expect: [ - 'ImplementsInterfaces', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'FieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'FieldsDefinition', - }, - ], - optional: true, - }, - ], - }, - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'FieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'FieldsDefinition', - }, - ], - }, - ], - - InterfaceTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'FieldsDefinition', optional: true }, - ], - - InterfaceTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'FieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'FieldsDefinition', - }, - ], - }, - ], - - UnionTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'UnionMemberTypes', optional: true }, - ], - - UnionMemberTypes: [ - { token: '=' }, - { token: '|', optional: true }, - 'Name', - { - listOfType: 'UnionMemberAdditionalTypeName', - optional: true, - }, - ], - - UnionMemberAdditionalTypeName: [{ token: '|' }, 'TypeName'], - - UnionTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'UnionMemberTypes', optional: true }, - ], - }, - { - ifCondition: { token: '=' }, - expect: 'UnionMemberTypes', - }, - ], - }, - ], - - EnumTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'EnumValuesDefinition', optional: true }, - ], - EnumValuesDefinition: [ - { token: '{' }, - { listOfType: 'EnumValueDefinition' }, - { token: '}' }, - ], - EnumValueDefinition: [ - { ofType: 'Description', optional: true }, - 'EnumValue', - { ofType: 'Directives', optional: true }, - ], - - EnumTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'EnumValuesDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'EnumValuesDefinition', - }, - ], - }, - ], - - InputObjectTypeDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword', - }, - 'TypeName', - { ofType: 'Directives', optional: true }, - { ofType: 'InputFieldsDefinition', optional: true }, - ], - InputFieldsDefinition: [ - { token: '{' }, - { listOfType: 'InputValueDefinition' }, - { token: '}' }, - ], - - InputObjectTypeExtension: [ - { - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword', - }, - { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword', - }, - 'TypeName', - { - peek: [ - { - ifCondition: { token: '@' }, - expect: [ - 'Directives', - { ofType: 'InputFieldsDefinition', optional: true }, - ], - }, - { - ifCondition: { token: '{' }, - expect: 'InputFieldsDefinition', - }, - ], - }, - ], - - DirectiveDefinition: [ - { ofType: 'Description', optional: true }, - { - token: 'Name', - ofValue: 'directive', - tokenName: 'DirectiveDefinitionKeyword', - }, - { token: '@', tokenName: 'DirectiveName' }, - { token: 'Name', tokenName: 'DirectiveName' }, - { ofType: 'ArgumentsDefinition', optional: true }, - { token: 'Name', ofValue: 'on', tokenName: 'OnKeyword' }, - 'DirectiveLocations', - ], - DirectiveLocations: [ - { token: '|', optional: true }, - 'DirectiveLocation', - { - listOfType: 'DirectiveLocationAdditionalName', - optional: true, - }, - ], - DirectiveLocationAdditionalName: [{ token: '|' }, 'DirectiveLocation'], - DirectiveLocation: { - peek: [ - { - ifCondition: 'ExecutableDirectiveLocation', - expect: 'ExecutableDirectiveLocation', - }, - { - ifCondition: 'TypeSystemDirectiveLocation', - expect: 'TypeSystemDirectiveLocation', - }, - ], - }, - ExecutableDirectiveLocation: { - token: 'Name', - oneOf: [ - 'QUERY', - 'MUTATION', - 'SUBSCRIPTION', - 'FIELD', - 'FRAGMENT_DEFINITION', - 'FRAGMENT_SPREAD', - 'INLINE_FRAGMENT', - ], - tokenName: 'EnumValue', - }, - TypeSystemDirectiveLocation: { - token: 'Name', - oneOf: [ - 'SCHEMA', - 'SCALAR', - 'OBJECT', - 'FIELD_DEFINITION', - 'ARGUMENT_DEFINITION', - 'INTERFACE', - 'UNION', - 'ENUM', - 'ENUM_VALUE', - 'INPUT_OBJECT', - 'INPUT_FIELD_DEFINITION', - ], - tokenName: 'EnumValue', - }, - // FIXME: enforce proper typing -}: any); - -export default grammar; diff --git a/node_modules/graphql/language/experimentalOnlineParser/grammar.mjs b/node_modules/graphql/language/experimentalOnlineParser/grammar.mjs deleted file mode 100644 index a31907e1..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/grammar.mjs +++ /dev/null @@ -1,980 +0,0 @@ -var grammar = { - Name: { - token: 'Name' - }, - String: { - token: 'String' - }, - BlockString: { - token: 'BlockString' - }, - Document: { - listOfType: 'Definition' - }, - Definition: { - peek: [{ - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'] - }, - expect: 'OperationDefinition' - }, { - ifCondition: { - token: 'Name', - ofValue: 'fragment' - }, - expect: 'FragmentDefinition' - }, { - ifCondition: { - token: 'Name', - oneOf: ['schema', 'scalar', 'type', 'interface', 'union', 'enum', 'input', 'directive'] - }, - expect: 'TypeSystemDefinition' - }, { - ifCondition: { - token: 'Name', - ofValue: 'extend' - }, - expect: 'TypeSystemExtension' - }, { - ifCondition: { - token: '{' - }, - expect: 'OperationDefinition' - }, { - ifCondition: 'String', - expect: 'TypeSystemDefinition' - }, { - ifCondition: 'BlockString', - expect: 'TypeSystemDefinition' - }] - }, - OperationDefinition: { - peek: [{ - ifCondition: { - token: '{' - }, - expect: 'SelectionSet' - }, { - ifCondition: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'] - }, - expect: ['OperationType', { - token: 'Name', - optional: true, - tokenName: 'OperationName', - definitionName: true - }, { - ofType: 'VariableDefinitions', - optional: true - }, { - ofType: 'Directives', - optional: true - }, 'SelectionSet'] - }] - }, - OperationType: { - ofType: 'OperationTypeName' - }, - OperationTypeName: { - token: 'Name', - oneOf: ['query', 'mutation', 'subscription'], - definitionName: true - }, - SelectionSet: [{ - token: '{' - }, { - listOfType: 'Selection' - }, { - token: '}' - }], - Selection: { - peek: [{ - ifCondition: { - token: '...' - }, - expect: 'Fragment' - }, { - ifCondition: { - token: 'Name' - }, - expect: 'Field' - }] - }, - Field: [{ - ofType: 'Alias', - optional: true, - eatNextOnFail: true, - definitionName: true - }, { - token: 'Name', - tokenName: 'FieldName', - definitionName: true - }, { - ofType: 'Arguments', - optional: true - }, { - ofType: 'Directives', - optional: true - }, { - ofType: 'SelectionSet', - optional: true - }], - Arguments: [{ - token: '(' - }, { - listOfType: 'Argument' - }, { - token: ')' - }], - Argument: [{ - token: 'Name', - tokenName: 'ArgumentName', - definitionName: true - }, { - token: ':' - }, 'Value'], - Alias: [{ - token: 'Name', - tokenName: 'AliasName', - definitionName: true - }, { - token: ':' - }], - Fragment: [{ - token: '...' - }, { - peek: [{ - ifCondition: 'FragmentName', - expect: 'FragmentSpread' - }, { - ifCondition: { - token: 'Name', - ofValue: 'on' - }, - expect: 'InlineFragment' - }, { - ifCondition: { - token: '@' - }, - expect: 'InlineFragment' - }, { - ifCondition: { - token: '{' - }, - expect: 'InlineFragment' - }] - }], - FragmentSpread: ['FragmentName', { - ofType: 'Directives', - optional: true - }], - FragmentDefinition: [{ - token: 'Name', - ofValue: 'fragment', - tokenName: 'FragmentDefinitionKeyword' - }, 'FragmentName', 'TypeCondition', { - ofType: 'Directives', - optional: true - }, 'SelectionSet'], - FragmentName: { - token: 'Name', - butNot: { - token: 'Name', - ofValue: 'on' - }, - definitionName: true - }, - TypeCondition: [{ - token: 'Name', - ofValue: 'on', - tokenName: 'OnKeyword' - }, 'TypeName'], - InlineFragment: [{ - ofType: 'TypeCondition', - optional: true - }, { - ofType: 'Directives', - optional: true - }, 'SelectionSet'], - Value: { - peek: [{ - ifCondition: { - token: '$' - }, - expect: 'Variable' - }, { - ifCondition: 'IntValue', - expect: { - ofType: 'IntValue', - tokenName: 'NumberValue' - } - }, { - ifCondition: 'FloatValue', - expect: { - ofType: 'FloatValue', - tokenName: 'NumberValue' - } - }, { - ifCondition: 'BooleanValue', - expect: { - ofType: 'BooleanValue', - tokenName: 'BooleanValue' - } - }, { - ifCondition: 'EnumValue', - expect: { - ofType: 'EnumValue', - tokenName: 'EnumValue' - } - }, { - ifCondition: 'String', - expect: { - ofType: 'String', - tokenName: 'StringValue' - } - }, { - ifCondition: 'BlockString', - expect: { - ofType: 'BlockString', - tokenName: 'StringValue' - } - }, { - ifCondition: 'NullValue', - expect: { - ofType: 'NullValue', - tokenName: 'NullValue' - } - }, { - ifCondition: { - token: '[' - }, - expect: 'ListValue' - }, { - ifCondition: { - token: '{' - }, - expect: 'ObjectValue' - }] - }, - ConstValue: { - peek: [{ - ifCondition: 'IntValue', - expect: { - ofType: 'IntValue' - } - }, { - ifCondition: 'FloatValue', - expect: { - ofType: 'FloatValue' - } - }, { - ifCondition: 'BooleanValue', - expect: 'BooleanValue' - }, { - ifCondition: 'EnumValue', - expect: 'EnumValue' - }, { - ifCondition: 'String', - expect: { - ofType: 'String', - tokenName: 'StringValue' - } - }, { - ifCondition: 'BlockString', - expect: { - token: 'BlockString', - tokenName: 'StringValue' - } - }, { - ifCondition: 'NullValue', - expect: 'NullValue' - }, { - ifCondition: { - token: '[' - }, - expect: 'ConstListValue' - }, { - ifCondition: { - token: '{' - }, - expect: 'ObjectValue' - }] - }, - IntValue: { - token: 'Int' - }, - FloatValue: { - token: 'Float' - }, - StringValue: { - peek: [{ - ifCondition: { - token: 'String' - }, - expect: { - token: 'String', - tokenName: 'StringValue' - } - }, { - ifCondition: { - token: 'BlockString' - }, - expect: { - token: 'BlockString', - tokenName: 'StringValue' - } - }] - }, - BooleanValue: { - token: 'Name', - oneOf: ['true', 'false'], - tokenName: 'BooleanValue' - }, - NullValue: { - token: 'Name', - ofValue: 'null', - tokenName: 'NullValue' - }, - EnumValue: { - token: 'Name', - butNot: { - token: 'Name', - oneOf: ['null', 'true', 'false'] - }, - tokenName: 'EnumValue' - }, - ListValue: [{ - token: '[' - }, { - listOfType: 'Value', - optional: true - }, { - token: ']' - }], - ConstListValue: [{ - token: '[' - }, { - listOfType: 'ConstValue', - optional: true - }, { - token: ']' - }], - ObjectValue: [{ - token: '{' - }, { - listOfType: 'ObjectField', - optional: true - }, { - token: '}' - }], - ObjectField: [{ - token: 'Name', - tokenName: 'ObjectFieldName' - }, { - token: ':' - }, { - ofType: 'ConstValue' - }], - Variable: [{ - token: '$', - tokenName: 'VariableName' - }, { - token: 'Name', - tokenName: 'VariableName' - }], - VariableDefinitions: [{ - token: '(' - }, { - listOfType: 'VariableDefinition' - }, { - token: ')' - }], - VariableDefinition: ['Variable', { - token: ':' - }, 'Type', { - ofType: 'DefaultValue', - optional: true - }], - DefaultValue: [{ - token: '=' - }, 'ConstValue'], - TypeName: { - token: 'Name', - tokenName: 'TypeName', - typeName: true - }, - Type: { - peek: [{ - ifCondition: { - token: 'Name' - }, - expect: ['TypeName', { - token: '!', - optional: true - }] - }, { - ifCondition: { - token: '[' - }, - expect: 'ListType' - }] - }, - ListType: [{ - token: '[' - }, { - listOfType: 'Type' - }, { - token: ']' - }, { - token: '!', - optional: true - }], - Directives: { - listOfType: 'Directive' - }, - Directive: [{ - token: '@', - tokenName: 'DirectiveName' - }, { - token: 'Name', - tokenName: 'DirectiveName' - }, { - ofType: 'Arguments', - optional: true - }], - TypeSystemDefinition: [{ - ofType: 'Description', - optional: true - }, { - peek: [{ - ifCondition: { - target: 'Name', - ofValue: 'schema' - }, - expect: 'SchemaDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'scalar' - }, - expect: 'ScalarTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'type' - }, - expect: 'ObjectTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'interface' - }, - expect: 'InterfaceTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'union' - }, - expect: 'UnionTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'enum' - }, - expect: 'EnumTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'input' - }, - expect: 'InputObjectTypeDefinition' - }, { - ifCondition: { - target: 'Name', - ofValue: 'directive' - }, - expect: 'DirectiveDefinition' - }] - }], - TypeSystemExtension: { - peek: [{ - ifCondition: { - target: 'Name', - ofValue: 'schema' - }, - expect: 'SchemaExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'scalar' - }, - expect: 'ScalarTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'type' - }, - expect: 'ObjectTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'interface' - }, - expect: 'InterfaceTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'union' - }, - expect: 'UnionTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'enum' - }, - expect: 'EnumTypeExtension' - }, { - ifCondition: { - target: 'Name', - ofValue: 'input' - }, - expect: 'InputObjectTypeExtension' - }] - }, - SchemaDefinition: [{ - token: 'Name', - ofValue: 'schema', - tokenName: 'SchemaDefinitionKeyword' - }, { - ofType: 'Directives', - optional: true - }, { - token: '{' - }, { - listOfType: 'RootOperationTypeDefinition' - }, { - token: '}' - }], - RootOperationTypeDefinition: ['OperationType', { - token: ':' - }, { - token: 'Name', - tokenName: 'OperationTypeDefinitionName' - }], - SchemaExtension: [{ - token: 'Name', - ofValue: 'extend' - }, { - token: 'Name', - ofValue: 'schema' - }, 'Name', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: [{ - token: '{' - }, { - listOfType: 'RootOperationTypeDefinition' - }, { - token: '}' - }], - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: [{ - token: '{' - }, { - listOfType: 'RootOperationTypeDefinition' - }, { - token: '}' - }] - }] - }], - Description: 'StringValue', - ScalarTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }], - ScalarTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'scalar', - tokenName: 'ScalarDefinitionKeyword' - }, 'TypeName', 'Directives'], - ObjectTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword' - }, 'TypeName', { - ofType: 'ImplementsInterfaces', - optional: true - }, { - ofType: 'Directives', - optional: true - }, { - ofType: 'FieldsDefinition', - optional: true - }], - ImplementsInterfaces: [{ - token: 'Name', - ofValue: 'implements', - tokenName: 'ImplementsKeyword' - }, { - token: '&', - optional: true - }, 'TypeName', { - listOfType: 'ImplementsAdditionalInterfaceName', - optional: true - }], - ImplementsAdditionalInterfaceName: [{ - token: '&' - }, 'TypeName'], - FieldsDefinition: [{ - token: '{' - }, { - listOfType: 'FieldDefinition' - }, { - token: '}' - }], - FieldDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - tokenName: 'AliasName', - definitionName: true - }, { - ofType: 'ArgumentsDefinition', - optional: true - }, { - token: ':' - }, 'Type', { - ofType: 'Directives', - optional: true - }], - ArgumentsDefinition: [{ - token: '(' - }, { - listOfType: 'InputValueDefinition' - }, { - token: ')' - }], - InputValueDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - tokenName: 'ArgumentName' - }, { - token: ':' - }, 'Type', { - ofType: 'DefaultValue', - optional: true - }, { - ofType: 'Directives', - optional: true - }], - ObjectTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'type', - tokenName: 'TypeDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: 'Name', - ofValue: 'interface' - }, - expect: ['ImplementsInterfaces', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'FieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'FieldsDefinition' - }], - optional: true - }] - }, { - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'FieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'FieldsDefinition' - }] - }], - InterfaceTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'FieldsDefinition', - optional: true - }], - InterfaceTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'interface', - tokenName: 'InterfaceDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'FieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'FieldsDefinition' - }] - }], - UnionTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'UnionMemberTypes', - optional: true - }], - UnionMemberTypes: [{ - token: '=' - }, { - token: '|', - optional: true - }, 'Name', { - listOfType: 'UnionMemberAdditionalTypeName', - optional: true - }], - UnionMemberAdditionalTypeName: [{ - token: '|' - }, 'TypeName'], - UnionTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'union', - tokenName: 'UnionDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'UnionMemberTypes', - optional: true - }] - }, { - ifCondition: { - token: '=' - }, - expect: 'UnionMemberTypes' - }] - }], - EnumTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'EnumValuesDefinition', - optional: true - }], - EnumValuesDefinition: [{ - token: '{' - }, { - listOfType: 'EnumValueDefinition' - }, { - token: '}' - }], - EnumValueDefinition: [{ - ofType: 'Description', - optional: true - }, 'EnumValue', { - ofType: 'Directives', - optional: true - }], - EnumTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'enum', - tokenName: 'EnumDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'EnumValuesDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'EnumValuesDefinition' - }] - }], - InputObjectTypeDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword' - }, 'TypeName', { - ofType: 'Directives', - optional: true - }, { - ofType: 'InputFieldsDefinition', - optional: true - }], - InputFieldsDefinition: [{ - token: '{' - }, { - listOfType: 'InputValueDefinition' - }, { - token: '}' - }], - InputObjectTypeExtension: [{ - token: 'Name', - ofValue: 'extend', - tokenName: 'ExtendDefinitionKeyword' - }, { - token: 'Name', - ofValue: 'input', - tokenName: 'InputDefinitionKeyword' - }, 'TypeName', { - peek: [{ - ifCondition: { - token: '@' - }, - expect: ['Directives', { - ofType: 'InputFieldsDefinition', - optional: true - }] - }, { - ifCondition: { - token: '{' - }, - expect: 'InputFieldsDefinition' - }] - }], - DirectiveDefinition: [{ - ofType: 'Description', - optional: true - }, { - token: 'Name', - ofValue: 'directive', - tokenName: 'DirectiveDefinitionKeyword' - }, { - token: '@', - tokenName: 'DirectiveName' - }, { - token: 'Name', - tokenName: 'DirectiveName' - }, { - ofType: 'ArgumentsDefinition', - optional: true - }, { - token: 'Name', - ofValue: 'on', - tokenName: 'OnKeyword' - }, 'DirectiveLocations'], - DirectiveLocations: [{ - token: '|', - optional: true - }, 'DirectiveLocation', { - listOfType: 'DirectiveLocationAdditionalName', - optional: true - }], - DirectiveLocationAdditionalName: [{ - token: '|' - }, 'DirectiveLocation'], - DirectiveLocation: { - peek: [{ - ifCondition: 'ExecutableDirectiveLocation', - expect: 'ExecutableDirectiveLocation' - }, { - ifCondition: 'TypeSystemDirectiveLocation', - expect: 'TypeSystemDirectiveLocation' - }] - }, - ExecutableDirectiveLocation: { - token: 'Name', - oneOf: ['QUERY', 'MUTATION', 'SUBSCRIPTION', 'FIELD', 'FRAGMENT_DEFINITION', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'], - tokenName: 'EnumValue' - }, - TypeSystemDirectiveLocation: { - token: 'Name', - oneOf: ['SCHEMA', 'SCALAR', 'OBJECT', 'FIELD_DEFINITION', 'ARGUMENT_DEFINITION', 'INTERFACE', 'UNION', 'ENUM', 'ENUM_VALUE', 'INPUT_OBJECT', 'INPUT_FIELD_DEFINITION'], - tokenName: 'EnumValue' - } // FIXME: enforce proper typing - -}; -export default grammar; diff --git a/node_modules/graphql/language/experimentalOnlineParser/index.d.ts b/node_modules/graphql/language/experimentalOnlineParser/index.d.ts deleted file mode 100644 index 039446a1..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { - OnlineParser, - RuleKind, - TokenKind, - OnlineParserState, -} from './onlineParser'; diff --git a/node_modules/graphql/language/experimentalOnlineParser/index.js b/node_modules/graphql/language/experimentalOnlineParser/index.js deleted file mode 100644 index dd386943..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/index.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "OnlineParser", { - enumerable: true, - get: function get() { - return _onlineParser.OnlineParser; - } -}); -Object.defineProperty(exports, "RuleKind", { - enumerable: true, - get: function get() { - return _onlineParser.RuleKind; - } -}); -Object.defineProperty(exports, "TokenKind", { - enumerable: true, - get: function get() { - return _onlineParser.TokenKind; - } -}); -Object.defineProperty(exports, "OnlineParserState", { - enumerable: true, - get: function get() { - return _onlineParser.OnlineParserState; - } -}); - -var _onlineParser = require("./onlineParser.js"); diff --git a/node_modules/graphql/language/experimentalOnlineParser/index.js.flow b/node_modules/graphql/language/experimentalOnlineParser/index.js.flow deleted file mode 100644 index 90e34f28..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/index.js.flow +++ /dev/null @@ -1,7 +0,0 @@ -// @flow strict -export { - OnlineParser, - RuleKind, - TokenKind, - OnlineParserState, -} from './onlineParser'; diff --git a/node_modules/graphql/language/experimentalOnlineParser/index.mjs b/node_modules/graphql/language/experimentalOnlineParser/index.mjs deleted file mode 100644 index a82cbe8a..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/index.mjs +++ /dev/null @@ -1 +0,0 @@ -export { OnlineParser, RuleKind, TokenKind, OnlineParserState } from "./onlineParser.mjs"; diff --git a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.d.ts b/node_modules/graphql/language/experimentalOnlineParser/onlineParser.d.ts deleted file mode 100644 index 9570b9e5..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { Lexer } from '../lexer'; - -import { - GraphQLGrammarTokenConstraint, - GraphQLGrammarOfTypeConstraint, - GraphQLGrammarListOfTypeConstraint, - GraphQLGrammarPeekConstraint, - GraphQLGrammarConstraintsSet, -} from './grammar'; - -interface BaseOnlineParserRule { - kind: string; - name?: string; - depth: number; - step: number; - expanded: boolean; - state: string; - optional?: boolean; - eatNextOnFail?: boolean; -} -interface TokenOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarTokenConstraint {} -interface OfTypeOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarOfTypeConstraint {} -interface ListOfTypeOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarListOfTypeConstraint {} -interface PeekOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarPeekConstraint { - index: number; - matched: boolean; -} -interface ConstraintsSetOnlineParserRule extends BaseOnlineParserRule { - constraintsSet: boolean; - constraints: GraphQLGrammarConstraintsSet; -} - -type OnlineParserRule = - | TokenOnlineParserRule - | OfTypeOnlineParserRule - | ListOfTypeOnlineParserRule - | PeekOnlineParserRule - | ConstraintsSetOnlineParserRule; - -export interface OnlineParserState { - rules: Array; - kind: () => string; - step: () => number; - levels: Array; - indentLevel: number | undefined; - name: string | null; - type: string | null; -} - -interface Token { - kind: string; - value?: string; - tokenName?: string | undefined; - ruleName?: string | undefined; -} - -type OnlineParserConfig = { - tabSize: number; -}; - -type OnlineParserConfigOption = { - tabSize?: number; -}; - -export class OnlineParser { - state: OnlineParserState; - _lexer: Lexer; - _config: OnlineParserConfig; - constructor( - source: string, - state?: OnlineParserState, - config?: OnlineParserConfigOption, - ); - static startState(): OnlineParserState; - static copyState(state: OnlineParserState): OnlineParserState; - sol(): boolean; - parseToken(): Token; - indentation(): number; - private readonly _parseTokenConstraint; - private readonly _parseListOfTypeConstraint; - private readonly _parseOfTypeConstraint; - private readonly _parsePeekConstraint; - private readonly _parseConstraintsSetRule; - private readonly _matchToken; - private readonly _butNot; - private readonly _transformLexerToken; - private readonly _getNextRule; - private readonly _popMatchedRule; - private readonly _rollbackRule; - private readonly _pushRule; - private readonly _getRuleKind; - private readonly _advanceToken; - private readonly _lookAhead; -} - -export const TokenKind: { - NAME: string; - INT: string; - FLOAT: string; - STRING: string; - BLOCK_STRING: string; - COMMENT: string; - PUNCTUATION: string; - EOF: string; - INVALID: string; -}; - -export const RuleKind: { - TOKEN_CONSTRAINT: string; - OF_TYPE_CONSTRAINT: string; - LIST_OF_TYPE_CONSTRAINT: string; - PEEK_CONSTRAINT: string; - CONSTRAINTS_SET: string; - CONSTRAINTS_SET_ROOT: string; - RULE_NAME: string; - INVALID: string; -}; diff --git a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.js b/node_modules/graphql/language/experimentalOnlineParser/onlineParser.js deleted file mode 100644 index 8fc07072..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.js +++ /dev/null @@ -1,604 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.OnlineParser = exports.RuleKind = exports.TokenKind = void 0; - -var _lexer = require("../lexer.js"); - -var _source = require("../source.js"); - -var _grammar = _interopRequireDefault(require("./grammar.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var TokenKind = { - NAME: 'Name', - INT: 'Int', - FLOAT: 'Float', - STRING: 'String', - BLOCK_STRING: 'BlockString', - COMMENT: 'Comment', - PUNCTUATION: 'Punctuation', - EOF: '', - INVALID: 'Invalid' -}; -exports.TokenKind = TokenKind; -var RuleKind = { - TOKEN_CONSTRAINT: 'TokenConstraint', - OF_TYPE_CONSTRAINT: 'OfTypeConstraint', - LIST_OF_TYPE_CONSTRAINT: 'ListOfTypeConstraint', - PEEK_CONSTRAINT: 'PeekConstraint', - CONSTRAINTS_SET: 'ConstraintsSet', - CONSTRAINTS_SET_ROOT: 'ConstraintsSetRoot', - RULE_NAME: 'RuleName', - INVALID: 'Invalid' -}; -exports.RuleKind = RuleKind; - -var OnlineParser = /*#__PURE__*/function () { - function OnlineParser(source, state, config) { - var _config$tabSize; - - this.state = state || OnlineParser.startState(); - this._config = { - tabSize: (_config$tabSize = config === null || config === void 0 ? void 0 : config.tabSize) !== null && _config$tabSize !== void 0 ? _config$tabSize : 2 - }; - this._lexer = new _lexer.Lexer(new _source.Source(source)); - } - - OnlineParser.startState = function startState() { - return { - rules: [// $FlowFixMe[cannot-spread-interface] - _objectSpread(_objectSpread({ - name: 'Document', - state: 'Document', - kind: 'ListOfTypeConstraint' - }, _grammar.default.Document), {}, { - expanded: false, - depth: 1, - step: 1 - })], - name: null, - type: null, - levels: [], - indentLevel: 0, - kind: function kind() { - var _this$rules; - - return ((_this$rules = this.rules[this.rules.length - 1]) === null || _this$rules === void 0 ? void 0 : _this$rules.state) || ''; - }, - step: function step() { - var _this$rules2; - - return ((_this$rules2 = this.rules[this.rules.length - 1]) === null || _this$rules2 === void 0 ? void 0 : _this$rules2.step) || 0; - } - }; - }; - - OnlineParser.copyState = function copyState(state) { - return { - name: state.name, - type: state.type, - rules: JSON.parse(JSON.stringify(state.rules)), - levels: [].concat(state.levels), - indentLevel: state.indentLevel, - kind: function kind() { - var _this$rules3; - - return ((_this$rules3 = this.rules[this.rules.length - 1]) === null || _this$rules3 === void 0 ? void 0 : _this$rules3.state) || ''; - }, - step: function step() { - var _this$rules4; - - return ((_this$rules4 = this.rules[this.rules.length - 1]) === null || _this$rules4 === void 0 ? void 0 : _this$rules4.step) || 0; - } - }; - }; - - var _proto = OnlineParser.prototype; - - _proto.sol = function sol() { - return this._lexer.source.locationOffset.line === 1 && this._lexer.source.locationOffset.column === 1; - }; - - _proto.parseToken = function parseToken() { - var rule = this._getNextRule(); - - if (this.sol()) { - this.state.indentLevel = Math.floor(this.indentation() / this._config.tabSize); - } - - if (!rule) { - return { - kind: TokenKind.INVALID, - value: '' - }; - } - - var token; - - if (this._lookAhead().kind === '') { - return { - kind: TokenKind.EOF, - value: '', - ruleName: rule.name - }; - } - - switch (rule.kind) { - case RuleKind.TOKEN_CONSTRAINT: - token = this._parseTokenConstraint(rule); - break; - - case RuleKind.LIST_OF_TYPE_CONSTRAINT: - token = this._parseListOfTypeConstraint(rule); - break; - - case RuleKind.OF_TYPE_CONSTRAINT: - token = this._parseOfTypeConstraint(rule); - break; - - case RuleKind.PEEK_CONSTRAINT: - token = this._parsePeekConstraint(rule); - break; - - case RuleKind.CONSTRAINTS_SET_ROOT: - token = this._parseConstraintsSetRule(rule); - break; - - default: - return { - kind: TokenKind.INVALID, - value: '', - ruleName: rule.name - }; - } - - if (token && token.kind === TokenKind.INVALID) { - if (rule.optional === true) { - this.state.rules.pop(); - } else { - this._rollbackRule(); - } - - return this.parseToken() || token; - } - - return token; - }; - - _proto.indentation = function indentation() { - var match = this._lexer.source.body.match(/\s*/); - - var indent = 0; - - if (match && match.length === 0) { - var whiteSpaces = match[0]; - var pos = 0; - - while (whiteSpaces.length > pos) { - if (whiteSpaces.charCodeAt(pos) === 9) { - indent += 2; - } else { - indent++; - } - - pos++; - } - } - - return indent; - }; - - _proto._parseTokenConstraint = function _parseTokenConstraint(rule) { - rule.expanded = true; - - var token = this._lookAhead(); - - if (!this._matchToken(token, rule)) { - return { - kind: TokenKind.INVALID, - value: '', - tokenName: rule.tokenName, - ruleName: rule.name - }; - } - - this._advanceToken(); - - var parserToken = this._transformLexerToken(token, rule); - - this._popMatchedRule(parserToken); - - return parserToken; - }; - - _proto._parseListOfTypeConstraint = function _parseListOfTypeConstraint(rule) { - this._pushRule(_grammar.default[rule.listOfType], rule.depth + 1, rule.listOfType, 1, rule.state); - - rule.expanded = true; - var token = this.parseToken(); - return token; - }; - - _proto._parseOfTypeConstraint = function _parseOfTypeConstraint(rule) { - if (rule.expanded) { - this._popMatchedRule(); - - return this.parseToken(); - } - - this._pushRule(rule.ofType, rule.depth + 1, rule.tokenName, 1, rule.state); - - rule.expanded = true; - var token = this.parseToken(); - return token; - }; - - _proto._parsePeekConstraint = function _parsePeekConstraint(rule) { - if (rule.expanded) { - this._popMatchedRule(); - - return this.parseToken(); - } - - while (!rule.matched && rule.index < rule.peek.length - 1) { - rule.index++; - var constraint = rule.peek[rule.index]; - var ifCondition = constraint.ifCondition; - - if (typeof ifCondition === 'string') { - ifCondition = _grammar.default[ifCondition]; - } - - var token = this._lookAhead(); - - if (ifCondition && this._matchToken(token, ifCondition)) { - rule.matched = true; - rule.expanded = true; - - this._pushRule(constraint.expect, rule.depth + 1, '', 1, rule.state); - - token = this.parseToken(); - return token; - } - } - - return { - kind: TokenKind.INVALID, - value: '', - ruleName: rule.name - }; - }; - - _proto._parseConstraintsSetRule = function _parseConstraintsSetRule(rule) { - if (rule.expanded) { - this._popMatchedRule(); - - return this.parseToken(); - } - - for (var index = rule.constraints.length - 1; index >= 0; index--) { - this._pushRule(rule.constraints[index], rule.depth + 1, '', index, rule.state); - } - - rule.expanded = true; - return this.parseToken(); - }; - - _proto._matchToken = function _matchToken(token, rule) { - if (typeof token.value === 'string') { - if (typeof rule.ofValue === 'string' && token.value !== rule.ofValue || Array.isArray(rule.oneOf) && !rule.oneOf.includes(token.value) || typeof rule.ofValue !== 'string' && !Array.isArray(rule.oneOf) && token.kind !== rule.token) { - return false; - } - - return this._butNot(token, rule); - } - - if (token.kind !== rule.token) { - return false; - } - - return this._butNot(token, rule); - }; - - _proto._butNot = function _butNot(token, rule) { - var _this = this; - - if (rule.butNot) { - if (Array.isArray(rule.butNot)) { - if (rule.butNot.reduce(function (matched, constraint) { - return matched || _this._matchToken(token, constraint); - }, false)) { - return false; - } - - return true; - } - - return !this._matchToken(token, rule.butNot); - } - - return true; - }; - - _proto._transformLexerToken = function _transformLexerToken(lexerToken, rule) { - var token; - var ruleName = rule.name || ''; - var tokenName = rule.tokenName || ''; - - if (lexerToken.kind === '' || lexerToken.value !== undefined) { - token = { - kind: lexerToken.kind, - value: lexerToken.value || '', - tokenName: tokenName, - ruleName: ruleName - }; - - if (token.kind === TokenKind.STRING) { - token.value = "\"".concat(token.value, "\""); - } else if (token.kind === TokenKind.BLOCK_STRING) { - token.value = "\"\"\"".concat(token.value, "\"\"\""); - } - } else { - token = { - kind: TokenKind.PUNCTUATION, - value: lexerToken.kind, - tokenName: tokenName, - ruleName: ruleName - }; - - if (/^[{([]/.test(token.value)) { - if (this.state.indentLevel !== undefined) { - this.state.levels = this.state.levels.concat(this.state.indentLevel + 1); - } - } else if (/^[})\]]/.test(token.value)) { - this.state.levels.pop(); - } - } - - return token; - }; - - _proto._getNextRule = function _getNextRule() { - return this.state.rules[this.state.rules.length - 1] || null; - }; - - _proto._popMatchedRule = function _popMatchedRule(token) { - var rule = this.state.rules.pop(); - - if (!rule) { - return; - } - - if (token && rule.kind === RuleKind.TOKEN_CONSTRAINT) { - var constraint = rule; - - if (typeof constraint.definitionName === 'string') { - this.state.name = token.value || null; - } else if (typeof constraint.typeName === 'string') { - this.state.type = token.value || null; - } - } - - var nextRule = this._getNextRule(); - - if (!nextRule) { - return; - } - - if (nextRule.depth === rule.depth - 1 && nextRule.expanded && nextRule.kind === RuleKind.CONSTRAINTS_SET_ROOT) { - this.state.rules.pop(); - } - - if (nextRule.depth === rule.depth - 1 && nextRule.expanded && nextRule.kind === RuleKind.LIST_OF_TYPE_CONSTRAINT) { - nextRule.expanded = false; - nextRule.optional = true; - } - }; - - _proto._rollbackRule = function _rollbackRule() { - var _this2 = this; - - if (!this.state.rules.length) { - return; - } - - var popRule = function popRule() { - var lastPoppedRule = _this2.state.rules.pop(); - - if (lastPoppedRule.eatNextOnFail === true) { - _this2.state.rules.pop(); - } - }; - - var poppedRule = this.state.rules.pop(); - - if (!poppedRule) { - return; - } - - var popped = 0; - - var nextRule = this._getNextRule(); - - while (nextRule && (poppedRule.kind !== RuleKind.LIST_OF_TYPE_CONSTRAINT || nextRule.expanded) && nextRule.depth > poppedRule.depth - 1) { - this.state.rules.pop(); - popped++; - nextRule = this._getNextRule(); - } - - if (nextRule && nextRule.expanded) { - if (nextRule.optional === true) { - popRule(); - } else { - if (nextRule.kind === RuleKind.LIST_OF_TYPE_CONSTRAINT && popped === 1) { - this.state.rules.pop(); - return; - } - - this._rollbackRule(); - } - } - }; - - _proto._pushRule = function _pushRule(baseRule, depth, name, step, state) { - var _this$_getNextRule, _this$_getNextRule2, _this$_getNextRule3, _this$_getNextRule4, _this$_getNextRule5, _this$_getNextRule6, _this$_getNextRule7, _this$_getNextRule8, _this$_getNextRule9, _this$_getNextRule10; - - this.state.name = null; - this.state.type = null; - var rule = baseRule; - - switch (this._getRuleKind(rule)) { - case RuleKind.RULE_NAME: - rule = rule; - - this._pushRule(_grammar.default[rule], depth, (typeof name === 'string' ? name : undefined) || rule, step, state); - - break; - - case RuleKind.CONSTRAINTS_SET: - rule = rule; - this.state.rules.push({ - name: name || '', - depth: depth, - expanded: false, - constraints: rule, - constraintsSet: true, - kind: RuleKind.CONSTRAINTS_SET_ROOT, - state: (typeof name === 'string' ? name : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule = this._getNextRule()) === null || _this$_getNextRule === void 0 ? void 0 : _this$_getNextRule.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule2 = this._getNextRule()) === null || _this$_getNextRule2 === void 0 ? void 0 : _this$_getNextRule2.step) || 0) + 1 - }); - break; - - case RuleKind.OF_TYPE_CONSTRAINT: - rule = rule; - this.state.rules.push({ - name: name || '', - ofType: rule.ofType, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - depth: depth, - expanded: false, - kind: RuleKind.OF_TYPE_CONSTRAINT, - state: (typeof rule.tokenName === 'string' ? rule.tokenName : undefined) || (typeof name === 'string' ? name : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule3 = this._getNextRule()) === null || _this$_getNextRule3 === void 0 ? void 0 : _this$_getNextRule3.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule4 = this._getNextRule()) === null || _this$_getNextRule4 === void 0 ? void 0 : _this$_getNextRule4.step) || 0) + 1 - }); - break; - - case RuleKind.LIST_OF_TYPE_CONSTRAINT: - rule = rule; - this.state.rules.push({ - listOfType: rule.listOfType, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth: depth, - expanded: false, - kind: RuleKind.LIST_OF_TYPE_CONSTRAINT, - state: (typeof name === 'string' ? name : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule5 = this._getNextRule()) === null || _this$_getNextRule5 === void 0 ? void 0 : _this$_getNextRule5.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule6 = this._getNextRule()) === null || _this$_getNextRule6 === void 0 ? void 0 : _this$_getNextRule6.step) || 0) + 1 - }); - break; - - case RuleKind.TOKEN_CONSTRAINT: - rule = rule; - this.state.rules.push({ - token: rule.token, - ofValue: rule.ofValue, - oneOf: rule.oneOf, - definitionName: Boolean(rule.definitionName), - typeName: Boolean(rule.typeName), - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth: depth, - expanded: false, - kind: RuleKind.TOKEN_CONSTRAINT, - state: (typeof rule.tokenName === 'string' ? rule.tokenName : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule7 = this._getNextRule()) === null || _this$_getNextRule7 === void 0 ? void 0 : _this$_getNextRule7.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule8 = this._getNextRule()) === null || _this$_getNextRule8 === void 0 ? void 0 : _this$_getNextRule8.step) || 0) + 1 - }); - break; - - case RuleKind.PEEK_CONSTRAINT: - rule = rule; - this.state.rules.push({ - peek: rule.peek, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth: depth, - index: -1, - matched: false, - expanded: false, - kind: RuleKind.PEEK_CONSTRAINT, - state: (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule9 = this._getNextRule()) === null || _this$_getNextRule9 === void 0 ? void 0 : _this$_getNextRule9.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule10 = this._getNextRule()) === null || _this$_getNextRule10 === void 0 ? void 0 : _this$_getNextRule10.step) || 0) + 1 - }); - break; - } - }; - - _proto._getRuleKind = function _getRuleKind(rule) { - if (Array.isArray(rule)) { - return RuleKind.CONSTRAINTS_SET; - } - - if (rule.constraintsSet === true) { - return RuleKind.CONSTRAINTS_SET_ROOT; - } - - if (typeof rule === 'string') { - return RuleKind.RULE_NAME; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'ofType')) { - return RuleKind.OF_TYPE_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'listOfType')) { - return RuleKind.LIST_OF_TYPE_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'peek')) { - return RuleKind.PEEK_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'token')) { - return RuleKind.TOKEN_CONSTRAINT; - } - - return RuleKind.INVALID; - }; - - _proto._advanceToken = function _advanceToken() { - return this._lexer.advance(); - }; - - _proto._lookAhead = function _lookAhead() { - try { - return this._lexer.lookahead(); - } catch (err) { - return { - kind: TokenKind.INVALID, - value: '' - }; - } - }; - - return OnlineParser; -}(); - -exports.OnlineParser = OnlineParser; diff --git a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.js.flow b/node_modules/graphql/language/experimentalOnlineParser/onlineParser.js.flow deleted file mode 100644 index eae6e898..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.js.flow +++ /dev/null @@ -1,723 +0,0 @@ -// @flow strict -import { Lexer } from '../lexer'; -import { Source } from '../source'; - -import GraphQLGrammar from './grammar'; -import type { - GraphQLGrammarRule, - GraphQLGrammarRuleName, - GraphQLGrammarRuleConstraint, - GraphQLGrammarTokenConstraint, - GraphQLGrammarOfTypeConstraint, - GraphQLGrammarListOfTypeConstraint, - GraphQLGrammarPeekConstraint, - GraphQLGrammarConstraintsSet, -} from './grammar'; - -export const TokenKind = { - NAME: 'Name', - INT: 'Int', - FLOAT: 'Float', - STRING: 'String', - BLOCK_STRING: 'BlockString', - COMMENT: 'Comment', - PUNCTUATION: 'Punctuation', - EOF: '', - INVALID: 'Invalid', -}; - -export const RuleKind = { - TOKEN_CONSTRAINT: 'TokenConstraint', - OF_TYPE_CONSTRAINT: 'OfTypeConstraint', - LIST_OF_TYPE_CONSTRAINT: 'ListOfTypeConstraint', - PEEK_CONSTRAINT: 'PeekConstraint', - CONSTRAINTS_SET: 'ConstraintsSet', - CONSTRAINTS_SET_ROOT: 'ConstraintsSetRoot', - RULE_NAME: 'RuleName', - INVALID: 'Invalid', -}; - -interface BaseOnlineParserRule { - kind: string; - name?: string; - depth: number; - step: number; - expanded: boolean; - state: string; - optional?: boolean; - eatNextOnFail?: boolean; -} -interface TokenOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarTokenConstraint {} -interface OfTypeOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarOfTypeConstraint {} -interface ListOfTypeOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarListOfTypeConstraint {} -interface PeekOnlineParserRule - extends BaseOnlineParserRule, - GraphQLGrammarPeekConstraint { - index: number; - matched: boolean; -} -interface ConstraintsSetOnlineParserRule extends BaseOnlineParserRule { - constraintsSet: boolean; - constraints: GraphQLGrammarConstraintsSet; -} - -type OnlineParserRule = - | TokenOnlineParserRule - | OfTypeOnlineParserRule - | ListOfTypeOnlineParserRule - | PeekOnlineParserRule - | ConstraintsSetOnlineParserRule; - -export type OnlineParserState = {| - rules: Array, - kind: () => string, - step: () => number, - levels: Array, - indentLevel: number, - name: string | null, - type: string | null, -|}; - -type Token = {| - kind: string, - value: string, - tokenName?: ?string, - ruleName?: ?string, -|}; - -type LexerToken = {| - kind: string, - value: ?string, -|}; - -type OnlineParserConfig = {| - tabSize: number, -|}; - -type OnlineParserConfigOption = {| - tabSize: ?number, -|}; - -export class OnlineParser { - state: OnlineParserState; - _lexer: Lexer; - _config: OnlineParserConfig; - - constructor( - source: string, - state?: OnlineParserState, - config?: OnlineParserConfigOption, - ) { - this.state = state || OnlineParser.startState(); - this._config = { - tabSize: config?.tabSize ?? 2, - }; - this._lexer = new Lexer(new Source(source)); - } - - static startState(): OnlineParserState { - return { - rules: [ - // $FlowFixMe[cannot-spread-interface] - { - name: 'Document', - state: 'Document', - kind: 'ListOfTypeConstraint', - ...GraphQLGrammar.Document, - expanded: false, - depth: 1, - step: 1, - }, - ], - name: null, - type: null, - levels: [], - indentLevel: 0, - kind(): string { - return this.rules[this.rules.length - 1]?.state || ''; - }, - step(): number { - return this.rules[this.rules.length - 1]?.step || 0; - }, - }; - } - - static copyState(state: OnlineParserState): OnlineParserState { - return { - name: state.name, - type: state.type, - rules: JSON.parse(JSON.stringify(state.rules)), - levels: [...state.levels], - indentLevel: state.indentLevel, - kind(): string { - return this.rules[this.rules.length - 1]?.state || ''; - }, - step(): number { - return this.rules[this.rules.length - 1]?.step || 0; - }, - }; - } - - sol(): boolean { - return ( - this._lexer.source.locationOffset.line === 1 && - this._lexer.source.locationOffset.column === 1 - ); - } - - parseToken(): Token { - const rule = (this._getNextRule(): any); - - if (this.sol()) { - this.state.indentLevel = Math.floor( - this.indentation() / this._config.tabSize, - ); - } - - if (!rule) { - return { - kind: TokenKind.INVALID, - value: '', - }; - } - - let token; - - if (this._lookAhead().kind === '') { - return { - kind: TokenKind.EOF, - value: '', - ruleName: rule.name, - }; - } - - switch (rule.kind) { - case RuleKind.TOKEN_CONSTRAINT: - token = this._parseTokenConstraint(rule); - break; - case RuleKind.LIST_OF_TYPE_CONSTRAINT: - token = this._parseListOfTypeConstraint(rule); - break; - case RuleKind.OF_TYPE_CONSTRAINT: - token = this._parseOfTypeConstraint(rule); - break; - case RuleKind.PEEK_CONSTRAINT: - token = this._parsePeekConstraint(rule); - break; - case RuleKind.CONSTRAINTS_SET_ROOT: - token = this._parseConstraintsSetRule(rule); - break; - default: - return { - kind: TokenKind.INVALID, - value: '', - ruleName: rule.name, - }; - } - - if (token && token.kind === TokenKind.INVALID) { - if (rule.optional === true) { - this.state.rules.pop(); - } else { - this._rollbackRule(); - } - - return this.parseToken() || token; - } - - return token; - } - - indentation(): number { - const match = this._lexer.source.body.match(/\s*/); - let indent = 0; - - if (match && match.length === 0) { - const whiteSpaces = match[0]; - let pos = 0; - while (whiteSpaces.length > pos) { - if (whiteSpaces.charCodeAt(pos) === 9) { - indent += 2; - } else { - indent++; - } - pos++; - } - } - - return indent; - } - - _parseTokenConstraint(rule: TokenOnlineParserRule): Token { - rule.expanded = true; - - const token = this._lookAhead(); - - if (!this._matchToken(token, rule)) { - return { - kind: TokenKind.INVALID, - value: '', - tokenName: rule.tokenName, - ruleName: rule.name, - }; - } - - this._advanceToken(); - const parserToken = this._transformLexerToken(token, rule); - this._popMatchedRule(parserToken); - - return parserToken; - } - - _parseListOfTypeConstraint(rule: ListOfTypeOnlineParserRule): Token { - this._pushRule( - GraphQLGrammar[rule.listOfType], - rule.depth + 1, - rule.listOfType, - 1, - rule.state, - ); - - rule.expanded = true; - - const token = this.parseToken(); - - return token; - } - - _parseOfTypeConstraint(rule: OfTypeOnlineParserRule): Token { - if (rule.expanded) { - this._popMatchedRule(); - return this.parseToken(); - } - - this._pushRule(rule.ofType, rule.depth + 1, rule.tokenName, 1, rule.state); - rule.expanded = true; - - const token = this.parseToken(); - - return token; - } - - _parsePeekConstraint(rule: PeekOnlineParserRule): Token { - if (rule.expanded) { - this._popMatchedRule(); - return this.parseToken(); - } - - while (!rule.matched && rule.index < rule.peek.length - 1) { - rule.index++; - const constraint = rule.peek[rule.index]; - - let { ifCondition } = constraint; - if (typeof ifCondition === 'string') { - ifCondition = GraphQLGrammar[ifCondition]; - } - - let token = this._lookAhead(); - if (ifCondition && this._matchToken(token, ifCondition)) { - rule.matched = true; - rule.expanded = true; - this._pushRule(constraint.expect, rule.depth + 1, '', 1, rule.state); - - token = this.parseToken(); - - return token; - } - } - - return { - kind: TokenKind.INVALID, - value: '', - ruleName: rule.name, - }; - } - - _parseConstraintsSetRule(rule: ConstraintsSetOnlineParserRule): Token { - if (rule.expanded) { - this._popMatchedRule(); - return this.parseToken(); - } - - for (let index = rule.constraints.length - 1; index >= 0; index--) { - this._pushRule( - rule.constraints[index], - rule.depth + 1, - '', - index, - rule.state, - ); - } - rule.expanded = true; - - return this.parseToken(); - } - - _matchToken( - token: Token | LexerToken, - rule: GraphQLGrammarTokenConstraint, - ): boolean { - if (typeof token.value === 'string') { - if ( - (typeof rule.ofValue === 'string' && token.value !== rule.ofValue) || - (Array.isArray(rule.oneOf) && !rule.oneOf.includes(token.value)) || - (typeof rule.ofValue !== 'string' && - !Array.isArray(rule.oneOf) && - token.kind !== rule.token) - ) { - return false; - } - - return this._butNot(token, rule); - } - - if (token.kind !== rule.token) { - return false; - } - - return this._butNot(token, rule); - } - - _butNot( - token: Token | LexerToken, - rule: GraphQLGrammarRuleConstraint, - ): boolean { - if (rule.butNot) { - if (Array.isArray(rule.butNot)) { - if ( - rule.butNot.reduce( - (matched, constraint) => - matched || this._matchToken(token, constraint), - false, - ) - ) { - return false; - } - - return true; - } - - return !this._matchToken(token, rule.butNot); - } - - return true; - } - - _transformLexerToken(lexerToken: LexerToken, rule: any): Token { - let token; - const ruleName = rule.name || ''; - const tokenName = rule.tokenName || ''; - - if (lexerToken.kind === '' || lexerToken.value !== undefined) { - token = { - kind: lexerToken.kind, - value: lexerToken.value || '', - tokenName, - ruleName, - }; - - if (token.kind === TokenKind.STRING) { - token.value = `"${token.value}"`; - } else if (token.kind === TokenKind.BLOCK_STRING) { - token.value = `"""${token.value}"""`; - } - } else { - token = { - kind: TokenKind.PUNCTUATION, - value: lexerToken.kind, - tokenName, - ruleName, - }; - - if (/^[{([]/.test(token.value)) { - if (this.state.indentLevel !== undefined) { - this.state.levels = this.state.levels.concat( - this.state.indentLevel + 1, - ); - } - } else if (/^[})\]]/.test(token.value)) { - this.state.levels.pop(); - } - } - - return token; - } - - _getNextRule(): OnlineParserRule | null { - return this.state.rules[this.state.rules.length - 1] || null; - } - - _popMatchedRule(token: ?Token) { - const rule = this.state.rules.pop(); - if (!rule) { - return; - } - - if (token && rule.kind === RuleKind.TOKEN_CONSTRAINT) { - const constraint = rule; - if (typeof constraint.definitionName === 'string') { - this.state.name = token.value || null; - } else if (typeof constraint.typeName === 'string') { - this.state.type = token.value || null; - } - } - - const nextRule = this._getNextRule(); - if (!nextRule) { - return; - } - - if ( - nextRule.depth === rule.depth - 1 && - nextRule.expanded && - nextRule.kind === RuleKind.CONSTRAINTS_SET_ROOT - ) { - this.state.rules.pop(); - } - - if ( - nextRule.depth === rule.depth - 1 && - nextRule.expanded && - nextRule.kind === RuleKind.LIST_OF_TYPE_CONSTRAINT - ) { - nextRule.expanded = false; - nextRule.optional = true; - } - } - - _rollbackRule() { - if (!this.state.rules.length) { - return; - } - - const popRule = () => { - const lastPoppedRule = this.state.rules.pop(); - - if (lastPoppedRule.eatNextOnFail === true) { - this.state.rules.pop(); - } - }; - - const poppedRule = this.state.rules.pop(); - if (!poppedRule) { - return; - } - - let popped = 0; - let nextRule = this._getNextRule(); - while ( - nextRule && - (poppedRule.kind !== RuleKind.LIST_OF_TYPE_CONSTRAINT || - nextRule.expanded) && - nextRule.depth > poppedRule.depth - 1 - ) { - this.state.rules.pop(); - popped++; - nextRule = this._getNextRule(); - } - - if (nextRule && nextRule.expanded) { - if (nextRule.optional === true) { - popRule(); - } else { - if ( - nextRule.kind === RuleKind.LIST_OF_TYPE_CONSTRAINT && - popped === 1 - ) { - this.state.rules.pop(); - return; - } - this._rollbackRule(); - } - } - } - - _pushRule( - baseRule: any, - depth: number, - name?: string, - step?: number, - state?: string, - ) { - this.state.name = null; - this.state.type = null; - let rule = baseRule; - - switch (this._getRuleKind(rule)) { - case RuleKind.RULE_NAME: - rule = (rule: GraphQLGrammarRuleName); - this._pushRule( - GraphQLGrammar[rule], - depth, - (typeof name === 'string' ? name : undefined) || rule, - step, - state, - ); - break; - case RuleKind.CONSTRAINTS_SET: - rule = (rule: GraphQLGrammarConstraintsSet); - this.state.rules.push({ - name: name || '', - depth, - expanded: false, - constraints: rule, - constraintsSet: true, - kind: RuleKind.CONSTRAINTS_SET_ROOT, - state: - (typeof name === 'string' ? name : undefined) || - (typeof state === 'string' ? state : undefined) || - this._getNextRule()?.state || - '', - step: - typeof step === 'number' - ? step - : (this._getNextRule()?.step || 0) + 1, - }); - break; - case RuleKind.OF_TYPE_CONSTRAINT: - rule = (rule: GraphQLGrammarOfTypeConstraint); - this.state.rules.push({ - name: name || '', - ofType: rule.ofType, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - depth, - expanded: false, - kind: RuleKind.OF_TYPE_CONSTRAINT, - state: - (typeof rule.tokenName === 'string' ? rule.tokenName : undefined) || - (typeof name === 'string' ? name : undefined) || - (typeof state === 'string' ? state : undefined) || - this._getNextRule()?.state || - '', - step: - typeof step === 'number' - ? step - : (this._getNextRule()?.step || 0) + 1, - }); - break; - case RuleKind.LIST_OF_TYPE_CONSTRAINT: - rule = (rule: GraphQLGrammarListOfTypeConstraint); - this.state.rules.push({ - listOfType: rule.listOfType, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth, - expanded: false, - kind: RuleKind.LIST_OF_TYPE_CONSTRAINT, - state: - (typeof name === 'string' ? name : undefined) || - (typeof state === 'string' ? state : undefined) || - this._getNextRule()?.state || - '', - step: - typeof step === 'number' - ? step - : (this._getNextRule()?.step || 0) + 1, - }); - break; - case RuleKind.TOKEN_CONSTRAINT: - rule = (rule: GraphQLGrammarTokenConstraint); - this.state.rules.push({ - token: rule.token, - ofValue: rule.ofValue, - oneOf: rule.oneOf, - definitionName: Boolean(rule.definitionName), - typeName: Boolean(rule.typeName), - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth, - expanded: false, - kind: RuleKind.TOKEN_CONSTRAINT, - state: - (typeof rule.tokenName === 'string' ? rule.tokenName : undefined) || - (typeof state === 'string' ? state : undefined) || - this._getNextRule()?.state || - '', - step: - typeof step === 'number' - ? step - : (this._getNextRule()?.step || 0) + 1, - }); - break; - case RuleKind.PEEK_CONSTRAINT: - rule = (rule: GraphQLGrammarPeekConstraint); - this.state.rules.push({ - peek: rule.peek, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth, - index: -1, - matched: false, - expanded: false, - kind: RuleKind.PEEK_CONSTRAINT, - state: - (typeof state === 'string' ? state : undefined) || - this._getNextRule()?.state || - '', - step: - typeof step === 'number' - ? step - : (this._getNextRule()?.step || 0) + 1, - }); - break; - } - } - - _getRuleKind(rule: GraphQLGrammarRule | OnlineParserRule): string { - if (Array.isArray(rule)) { - return RuleKind.CONSTRAINTS_SET; - } - - if (rule.constraintsSet === true) { - return RuleKind.CONSTRAINTS_SET_ROOT; - } - - if (typeof rule === 'string') { - return RuleKind.RULE_NAME; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'ofType')) { - return RuleKind.OF_TYPE_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'listOfType')) { - return RuleKind.LIST_OF_TYPE_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'peek')) { - return RuleKind.PEEK_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'token')) { - return RuleKind.TOKEN_CONSTRAINT; - } - - return RuleKind.INVALID; - } - - _advanceToken(): LexerToken { - return (this._lexer.advance(): any); - } - - _lookAhead(): LexerToken { - try { - return (this._lexer.lookahead(): any); - } catch (err) { - return { kind: TokenKind.INVALID, value: '' }; - } - } -} diff --git a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.mjs b/node_modules/graphql/language/experimentalOnlineParser/onlineParser.mjs deleted file mode 100644 index bd5e2fd6..00000000 --- a/node_modules/graphql/language/experimentalOnlineParser/onlineParser.mjs +++ /dev/null @@ -1,587 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import { Lexer } from "../lexer.mjs"; -import { Source } from "../source.mjs"; -import GraphQLGrammar from "./grammar.mjs"; -export var TokenKind = { - NAME: 'Name', - INT: 'Int', - FLOAT: 'Float', - STRING: 'String', - BLOCK_STRING: 'BlockString', - COMMENT: 'Comment', - PUNCTUATION: 'Punctuation', - EOF: '', - INVALID: 'Invalid' -}; -export var RuleKind = { - TOKEN_CONSTRAINT: 'TokenConstraint', - OF_TYPE_CONSTRAINT: 'OfTypeConstraint', - LIST_OF_TYPE_CONSTRAINT: 'ListOfTypeConstraint', - PEEK_CONSTRAINT: 'PeekConstraint', - CONSTRAINTS_SET: 'ConstraintsSet', - CONSTRAINTS_SET_ROOT: 'ConstraintsSetRoot', - RULE_NAME: 'RuleName', - INVALID: 'Invalid' -}; -export var OnlineParser = /*#__PURE__*/function () { - function OnlineParser(source, state, config) { - var _config$tabSize; - - this.state = state || OnlineParser.startState(); - this._config = { - tabSize: (_config$tabSize = config === null || config === void 0 ? void 0 : config.tabSize) !== null && _config$tabSize !== void 0 ? _config$tabSize : 2 - }; - this._lexer = new Lexer(new Source(source)); - } - - OnlineParser.startState = function startState() { - return { - rules: [// $FlowFixMe[cannot-spread-interface] - _objectSpread(_objectSpread({ - name: 'Document', - state: 'Document', - kind: 'ListOfTypeConstraint' - }, GraphQLGrammar.Document), {}, { - expanded: false, - depth: 1, - step: 1 - })], - name: null, - type: null, - levels: [], - indentLevel: 0, - kind: function kind() { - var _this$rules; - - return ((_this$rules = this.rules[this.rules.length - 1]) === null || _this$rules === void 0 ? void 0 : _this$rules.state) || ''; - }, - step: function step() { - var _this$rules2; - - return ((_this$rules2 = this.rules[this.rules.length - 1]) === null || _this$rules2 === void 0 ? void 0 : _this$rules2.step) || 0; - } - }; - }; - - OnlineParser.copyState = function copyState(state) { - return { - name: state.name, - type: state.type, - rules: JSON.parse(JSON.stringify(state.rules)), - levels: [].concat(state.levels), - indentLevel: state.indentLevel, - kind: function kind() { - var _this$rules3; - - return ((_this$rules3 = this.rules[this.rules.length - 1]) === null || _this$rules3 === void 0 ? void 0 : _this$rules3.state) || ''; - }, - step: function step() { - var _this$rules4; - - return ((_this$rules4 = this.rules[this.rules.length - 1]) === null || _this$rules4 === void 0 ? void 0 : _this$rules4.step) || 0; - } - }; - }; - - var _proto = OnlineParser.prototype; - - _proto.sol = function sol() { - return this._lexer.source.locationOffset.line === 1 && this._lexer.source.locationOffset.column === 1; - }; - - _proto.parseToken = function parseToken() { - var rule = this._getNextRule(); - - if (this.sol()) { - this.state.indentLevel = Math.floor(this.indentation() / this._config.tabSize); - } - - if (!rule) { - return { - kind: TokenKind.INVALID, - value: '' - }; - } - - var token; - - if (this._lookAhead().kind === '') { - return { - kind: TokenKind.EOF, - value: '', - ruleName: rule.name - }; - } - - switch (rule.kind) { - case RuleKind.TOKEN_CONSTRAINT: - token = this._parseTokenConstraint(rule); - break; - - case RuleKind.LIST_OF_TYPE_CONSTRAINT: - token = this._parseListOfTypeConstraint(rule); - break; - - case RuleKind.OF_TYPE_CONSTRAINT: - token = this._parseOfTypeConstraint(rule); - break; - - case RuleKind.PEEK_CONSTRAINT: - token = this._parsePeekConstraint(rule); - break; - - case RuleKind.CONSTRAINTS_SET_ROOT: - token = this._parseConstraintsSetRule(rule); - break; - - default: - return { - kind: TokenKind.INVALID, - value: '', - ruleName: rule.name - }; - } - - if (token && token.kind === TokenKind.INVALID) { - if (rule.optional === true) { - this.state.rules.pop(); - } else { - this._rollbackRule(); - } - - return this.parseToken() || token; - } - - return token; - }; - - _proto.indentation = function indentation() { - var match = this._lexer.source.body.match(/\s*/); - - var indent = 0; - - if (match && match.length === 0) { - var whiteSpaces = match[0]; - var pos = 0; - - while (whiteSpaces.length > pos) { - if (whiteSpaces.charCodeAt(pos) === 9) { - indent += 2; - } else { - indent++; - } - - pos++; - } - } - - return indent; - }; - - _proto._parseTokenConstraint = function _parseTokenConstraint(rule) { - rule.expanded = true; - - var token = this._lookAhead(); - - if (!this._matchToken(token, rule)) { - return { - kind: TokenKind.INVALID, - value: '', - tokenName: rule.tokenName, - ruleName: rule.name - }; - } - - this._advanceToken(); - - var parserToken = this._transformLexerToken(token, rule); - - this._popMatchedRule(parserToken); - - return parserToken; - }; - - _proto._parseListOfTypeConstraint = function _parseListOfTypeConstraint(rule) { - this._pushRule(GraphQLGrammar[rule.listOfType], rule.depth + 1, rule.listOfType, 1, rule.state); - - rule.expanded = true; - var token = this.parseToken(); - return token; - }; - - _proto._parseOfTypeConstraint = function _parseOfTypeConstraint(rule) { - if (rule.expanded) { - this._popMatchedRule(); - - return this.parseToken(); - } - - this._pushRule(rule.ofType, rule.depth + 1, rule.tokenName, 1, rule.state); - - rule.expanded = true; - var token = this.parseToken(); - return token; - }; - - _proto._parsePeekConstraint = function _parsePeekConstraint(rule) { - if (rule.expanded) { - this._popMatchedRule(); - - return this.parseToken(); - } - - while (!rule.matched && rule.index < rule.peek.length - 1) { - rule.index++; - var constraint = rule.peek[rule.index]; - var ifCondition = constraint.ifCondition; - - if (typeof ifCondition === 'string') { - ifCondition = GraphQLGrammar[ifCondition]; - } - - var token = this._lookAhead(); - - if (ifCondition && this._matchToken(token, ifCondition)) { - rule.matched = true; - rule.expanded = true; - - this._pushRule(constraint.expect, rule.depth + 1, '', 1, rule.state); - - token = this.parseToken(); - return token; - } - } - - return { - kind: TokenKind.INVALID, - value: '', - ruleName: rule.name - }; - }; - - _proto._parseConstraintsSetRule = function _parseConstraintsSetRule(rule) { - if (rule.expanded) { - this._popMatchedRule(); - - return this.parseToken(); - } - - for (var index = rule.constraints.length - 1; index >= 0; index--) { - this._pushRule(rule.constraints[index], rule.depth + 1, '', index, rule.state); - } - - rule.expanded = true; - return this.parseToken(); - }; - - _proto._matchToken = function _matchToken(token, rule) { - if (typeof token.value === 'string') { - if (typeof rule.ofValue === 'string' && token.value !== rule.ofValue || Array.isArray(rule.oneOf) && !rule.oneOf.includes(token.value) || typeof rule.ofValue !== 'string' && !Array.isArray(rule.oneOf) && token.kind !== rule.token) { - return false; - } - - return this._butNot(token, rule); - } - - if (token.kind !== rule.token) { - return false; - } - - return this._butNot(token, rule); - }; - - _proto._butNot = function _butNot(token, rule) { - var _this = this; - - if (rule.butNot) { - if (Array.isArray(rule.butNot)) { - if (rule.butNot.reduce(function (matched, constraint) { - return matched || _this._matchToken(token, constraint); - }, false)) { - return false; - } - - return true; - } - - return !this._matchToken(token, rule.butNot); - } - - return true; - }; - - _proto._transformLexerToken = function _transformLexerToken(lexerToken, rule) { - var token; - var ruleName = rule.name || ''; - var tokenName = rule.tokenName || ''; - - if (lexerToken.kind === '' || lexerToken.value !== undefined) { - token = { - kind: lexerToken.kind, - value: lexerToken.value || '', - tokenName: tokenName, - ruleName: ruleName - }; - - if (token.kind === TokenKind.STRING) { - token.value = "\"".concat(token.value, "\""); - } else if (token.kind === TokenKind.BLOCK_STRING) { - token.value = "\"\"\"".concat(token.value, "\"\"\""); - } - } else { - token = { - kind: TokenKind.PUNCTUATION, - value: lexerToken.kind, - tokenName: tokenName, - ruleName: ruleName - }; - - if (/^[{([]/.test(token.value)) { - if (this.state.indentLevel !== undefined) { - this.state.levels = this.state.levels.concat(this.state.indentLevel + 1); - } - } else if (/^[})\]]/.test(token.value)) { - this.state.levels.pop(); - } - } - - return token; - }; - - _proto._getNextRule = function _getNextRule() { - return this.state.rules[this.state.rules.length - 1] || null; - }; - - _proto._popMatchedRule = function _popMatchedRule(token) { - var rule = this.state.rules.pop(); - - if (!rule) { - return; - } - - if (token && rule.kind === RuleKind.TOKEN_CONSTRAINT) { - var constraint = rule; - - if (typeof constraint.definitionName === 'string') { - this.state.name = token.value || null; - } else if (typeof constraint.typeName === 'string') { - this.state.type = token.value || null; - } - } - - var nextRule = this._getNextRule(); - - if (!nextRule) { - return; - } - - if (nextRule.depth === rule.depth - 1 && nextRule.expanded && nextRule.kind === RuleKind.CONSTRAINTS_SET_ROOT) { - this.state.rules.pop(); - } - - if (nextRule.depth === rule.depth - 1 && nextRule.expanded && nextRule.kind === RuleKind.LIST_OF_TYPE_CONSTRAINT) { - nextRule.expanded = false; - nextRule.optional = true; - } - }; - - _proto._rollbackRule = function _rollbackRule() { - var _this2 = this; - - if (!this.state.rules.length) { - return; - } - - var popRule = function popRule() { - var lastPoppedRule = _this2.state.rules.pop(); - - if (lastPoppedRule.eatNextOnFail === true) { - _this2.state.rules.pop(); - } - }; - - var poppedRule = this.state.rules.pop(); - - if (!poppedRule) { - return; - } - - var popped = 0; - - var nextRule = this._getNextRule(); - - while (nextRule && (poppedRule.kind !== RuleKind.LIST_OF_TYPE_CONSTRAINT || nextRule.expanded) && nextRule.depth > poppedRule.depth - 1) { - this.state.rules.pop(); - popped++; - nextRule = this._getNextRule(); - } - - if (nextRule && nextRule.expanded) { - if (nextRule.optional === true) { - popRule(); - } else { - if (nextRule.kind === RuleKind.LIST_OF_TYPE_CONSTRAINT && popped === 1) { - this.state.rules.pop(); - return; - } - - this._rollbackRule(); - } - } - }; - - _proto._pushRule = function _pushRule(baseRule, depth, name, step, state) { - var _this$_getNextRule, _this$_getNextRule2, _this$_getNextRule3, _this$_getNextRule4, _this$_getNextRule5, _this$_getNextRule6, _this$_getNextRule7, _this$_getNextRule8, _this$_getNextRule9, _this$_getNextRule10; - - this.state.name = null; - this.state.type = null; - var rule = baseRule; - - switch (this._getRuleKind(rule)) { - case RuleKind.RULE_NAME: - rule = rule; - - this._pushRule(GraphQLGrammar[rule], depth, (typeof name === 'string' ? name : undefined) || rule, step, state); - - break; - - case RuleKind.CONSTRAINTS_SET: - rule = rule; - this.state.rules.push({ - name: name || '', - depth: depth, - expanded: false, - constraints: rule, - constraintsSet: true, - kind: RuleKind.CONSTRAINTS_SET_ROOT, - state: (typeof name === 'string' ? name : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule = this._getNextRule()) === null || _this$_getNextRule === void 0 ? void 0 : _this$_getNextRule.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule2 = this._getNextRule()) === null || _this$_getNextRule2 === void 0 ? void 0 : _this$_getNextRule2.step) || 0) + 1 - }); - break; - - case RuleKind.OF_TYPE_CONSTRAINT: - rule = rule; - this.state.rules.push({ - name: name || '', - ofType: rule.ofType, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - depth: depth, - expanded: false, - kind: RuleKind.OF_TYPE_CONSTRAINT, - state: (typeof rule.tokenName === 'string' ? rule.tokenName : undefined) || (typeof name === 'string' ? name : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule3 = this._getNextRule()) === null || _this$_getNextRule3 === void 0 ? void 0 : _this$_getNextRule3.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule4 = this._getNextRule()) === null || _this$_getNextRule4 === void 0 ? void 0 : _this$_getNextRule4.step) || 0) + 1 - }); - break; - - case RuleKind.LIST_OF_TYPE_CONSTRAINT: - rule = rule; - this.state.rules.push({ - listOfType: rule.listOfType, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth: depth, - expanded: false, - kind: RuleKind.LIST_OF_TYPE_CONSTRAINT, - state: (typeof name === 'string' ? name : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule5 = this._getNextRule()) === null || _this$_getNextRule5 === void 0 ? void 0 : _this$_getNextRule5.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule6 = this._getNextRule()) === null || _this$_getNextRule6 === void 0 ? void 0 : _this$_getNextRule6.step) || 0) + 1 - }); - break; - - case RuleKind.TOKEN_CONSTRAINT: - rule = rule; - this.state.rules.push({ - token: rule.token, - ofValue: rule.ofValue, - oneOf: rule.oneOf, - definitionName: Boolean(rule.definitionName), - typeName: Boolean(rule.typeName), - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth: depth, - expanded: false, - kind: RuleKind.TOKEN_CONSTRAINT, - state: (typeof rule.tokenName === 'string' ? rule.tokenName : undefined) || (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule7 = this._getNextRule()) === null || _this$_getNextRule7 === void 0 ? void 0 : _this$_getNextRule7.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule8 = this._getNextRule()) === null || _this$_getNextRule8 === void 0 ? void 0 : _this$_getNextRule8.step) || 0) + 1 - }); - break; - - case RuleKind.PEEK_CONSTRAINT: - rule = rule; - this.state.rules.push({ - peek: rule.peek, - optional: Boolean(rule.optional), - butNot: rule.butNot, - eatNextOnFail: Boolean(rule.eatNextOnFail), - name: name || '', - depth: depth, - index: -1, - matched: false, - expanded: false, - kind: RuleKind.PEEK_CONSTRAINT, - state: (typeof state === 'string' ? state : undefined) || ((_this$_getNextRule9 = this._getNextRule()) === null || _this$_getNextRule9 === void 0 ? void 0 : _this$_getNextRule9.state) || '', - step: typeof step === 'number' ? step : (((_this$_getNextRule10 = this._getNextRule()) === null || _this$_getNextRule10 === void 0 ? void 0 : _this$_getNextRule10.step) || 0) + 1 - }); - break; - } - }; - - _proto._getRuleKind = function _getRuleKind(rule) { - if (Array.isArray(rule)) { - return RuleKind.CONSTRAINTS_SET; - } - - if (rule.constraintsSet === true) { - return RuleKind.CONSTRAINTS_SET_ROOT; - } - - if (typeof rule === 'string') { - return RuleKind.RULE_NAME; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'ofType')) { - return RuleKind.OF_TYPE_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'listOfType')) { - return RuleKind.LIST_OF_TYPE_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'peek')) { - return RuleKind.PEEK_CONSTRAINT; - } - - if (Object.prototype.hasOwnProperty.call(rule, 'token')) { - return RuleKind.TOKEN_CONSTRAINT; - } - - return RuleKind.INVALID; - }; - - _proto._advanceToken = function _advanceToken() { - return this._lexer.advance(); - }; - - _proto._lookAhead = function _lookAhead() { - try { - return this._lexer.lookahead(); - } catch (err) { - return { - kind: TokenKind.INVALID, - value: '' - }; - } - }; - - return OnlineParser; -}(); diff --git a/node_modules/graphql/language/index.d.ts b/node_modules/graphql/language/index.d.ts deleted file mode 100644 index ce965383..00000000 --- a/node_modules/graphql/language/index.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -export { Source } from './source'; -export { getLocation, SourceLocation } from './location'; - -export { printLocation, printSourceLocation } from './printLocation'; - -export { Kind, KindEnum } from './kinds'; -export { TokenKind, TokenKindEnum } from './tokenKind'; -export { Lexer } from './lexer'; -export { parse, parseValue, parseType, ParseOptions } from './parser'; -export { print } from './printer'; -export { - visit, - visitInParallel, - getVisitFn, - BREAK, - ASTVisitor, - Visitor, - VisitFn, - VisitorKeyMap, -} from './visitor'; - -export { - Location, - Token, - ASTNode, - ASTKindToNode, - // Each kind of AST node - NameNode, - DocumentNode, - DefinitionNode, - ExecutableDefinitionNode, - OperationDefinitionNode, - OperationTypeNode, - VariableDefinitionNode, - VariableNode, - SelectionSetNode, - SelectionNode, - FieldNode, - ArgumentNode, - FragmentSpreadNode, - InlineFragmentNode, - FragmentDefinitionNode, - ValueNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - NullValueNode, - EnumValueNode, - ListValueNode, - ObjectValueNode, - ObjectFieldNode, - DirectiveNode, - TypeNode, - NamedTypeNode, - ListTypeNode, - NonNullTypeNode, - TypeSystemDefinitionNode, - SchemaDefinitionNode, - OperationTypeDefinitionNode, - TypeDefinitionNode, - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - DirectiveDefinitionNode, - TypeSystemExtensionNode, - SchemaExtensionNode, - TypeExtensionNode, - ScalarTypeExtensionNode, - ObjectTypeExtensionNode, - InterfaceTypeExtensionNode, - UnionTypeExtensionNode, - EnumTypeExtensionNode, - InputObjectTypeExtensionNode, -} from './ast'; - -export { - isDefinitionNode, - isExecutableDefinitionNode, - isSelectionNode, - isValueNode, - isTypeNode, - isTypeSystemDefinitionNode, - isTypeDefinitionNode, - isTypeSystemExtensionNode, - isTypeExtensionNode, -} from './predicates'; - -export { DirectiveLocation, DirectiveLocationEnum } from './directiveLocation'; diff --git a/node_modules/graphql/language/index.js b/node_modules/graphql/language/index.js deleted file mode 100644 index 63e564d1..00000000 --- a/node_modules/graphql/language/index.js +++ /dev/null @@ -1,191 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "Source", { - enumerable: true, - get: function get() { - return _source.Source; - } -}); -Object.defineProperty(exports, "getLocation", { - enumerable: true, - get: function get() { - return _location.getLocation; - } -}); -Object.defineProperty(exports, "printLocation", { - enumerable: true, - get: function get() { - return _printLocation.printLocation; - } -}); -Object.defineProperty(exports, "printSourceLocation", { - enumerable: true, - get: function get() { - return _printLocation.printSourceLocation; - } -}); -Object.defineProperty(exports, "Kind", { - enumerable: true, - get: function get() { - return _kinds.Kind; - } -}); -Object.defineProperty(exports, "TokenKind", { - enumerable: true, - get: function get() { - return _tokenKind.TokenKind; - } -}); -Object.defineProperty(exports, "Lexer", { - enumerable: true, - get: function get() { - return _lexer.Lexer; - } -}); -Object.defineProperty(exports, "parse", { - enumerable: true, - get: function get() { - return _parser.parse; - } -}); -Object.defineProperty(exports, "parseValue", { - enumerable: true, - get: function get() { - return _parser.parseValue; - } -}); -Object.defineProperty(exports, "parseType", { - enumerable: true, - get: function get() { - return _parser.parseType; - } -}); -Object.defineProperty(exports, "print", { - enumerable: true, - get: function get() { - return _printer.print; - } -}); -Object.defineProperty(exports, "visit", { - enumerable: true, - get: function get() { - return _visitor.visit; - } -}); -Object.defineProperty(exports, "visitInParallel", { - enumerable: true, - get: function get() { - return _visitor.visitInParallel; - } -}); -Object.defineProperty(exports, "getVisitFn", { - enumerable: true, - get: function get() { - return _visitor.getVisitFn; - } -}); -Object.defineProperty(exports, "BREAK", { - enumerable: true, - get: function get() { - return _visitor.BREAK; - } -}); -Object.defineProperty(exports, "Location", { - enumerable: true, - get: function get() { - return _ast.Location; - } -}); -Object.defineProperty(exports, "Token", { - enumerable: true, - get: function get() { - return _ast.Token; - } -}); -Object.defineProperty(exports, "isDefinitionNode", { - enumerable: true, - get: function get() { - return _predicates.isDefinitionNode; - } -}); -Object.defineProperty(exports, "isExecutableDefinitionNode", { - enumerable: true, - get: function get() { - return _predicates.isExecutableDefinitionNode; - } -}); -Object.defineProperty(exports, "isSelectionNode", { - enumerable: true, - get: function get() { - return _predicates.isSelectionNode; - } -}); -Object.defineProperty(exports, "isValueNode", { - enumerable: true, - get: function get() { - return _predicates.isValueNode; - } -}); -Object.defineProperty(exports, "isTypeNode", { - enumerable: true, - get: function get() { - return _predicates.isTypeNode; - } -}); -Object.defineProperty(exports, "isTypeSystemDefinitionNode", { - enumerable: true, - get: function get() { - return _predicates.isTypeSystemDefinitionNode; - } -}); -Object.defineProperty(exports, "isTypeDefinitionNode", { - enumerable: true, - get: function get() { - return _predicates.isTypeDefinitionNode; - } -}); -Object.defineProperty(exports, "isTypeSystemExtensionNode", { - enumerable: true, - get: function get() { - return _predicates.isTypeSystemExtensionNode; - } -}); -Object.defineProperty(exports, "isTypeExtensionNode", { - enumerable: true, - get: function get() { - return _predicates.isTypeExtensionNode; - } -}); -Object.defineProperty(exports, "DirectiveLocation", { - enumerable: true, - get: function get() { - return _directiveLocation.DirectiveLocation; - } -}); - -var _source = require("./source.js"); - -var _location = require("./location.js"); - -var _printLocation = require("./printLocation.js"); - -var _kinds = require("./kinds.js"); - -var _tokenKind = require("./tokenKind.js"); - -var _lexer = require("./lexer.js"); - -var _parser = require("./parser.js"); - -var _printer = require("./printer.js"); - -var _visitor = require("./visitor.js"); - -var _ast = require("./ast.js"); - -var _predicates = require("./predicates.js"); - -var _directiveLocation = require("./directiveLocation.js"); diff --git a/node_modules/graphql/language/index.js.flow b/node_modules/graphql/language/index.js.flow deleted file mode 100644 index c604e464..00000000 --- a/node_modules/graphql/language/index.js.flow +++ /dev/null @@ -1,98 +0,0 @@ -// @flow strict -export { Source } from './source'; - -export { getLocation } from './location'; -export type { SourceLocation } from './location'; - -export { printLocation, printSourceLocation } from './printLocation'; - -export { Kind } from './kinds'; -export type { KindEnum } from './kinds'; - -export { TokenKind } from './tokenKind'; -export type { TokenKindEnum } from './tokenKind'; - -export { Lexer } from './lexer'; - -export { parse, parseValue, parseType } from './parser'; -export type { ParseOptions } from './parser'; - -export { print } from './printer'; - -export { visit, visitInParallel, getVisitFn, BREAK } from './visitor'; -export type { ASTVisitor, Visitor, VisitFn, VisitorKeyMap } from './visitor'; - -export { Location, Token } from './ast'; -export type { - ASTNode, - ASTKindToNode, - // Each kind of AST node - NameNode, - DocumentNode, - DefinitionNode, - ExecutableDefinitionNode, - OperationDefinitionNode, - OperationTypeNode, - VariableDefinitionNode, - VariableNode, - SelectionSetNode, - SelectionNode, - FieldNode, - ArgumentNode, - FragmentSpreadNode, - InlineFragmentNode, - FragmentDefinitionNode, - ValueNode, - IntValueNode, - FloatValueNode, - StringValueNode, - BooleanValueNode, - NullValueNode, - EnumValueNode, - ListValueNode, - ObjectValueNode, - ObjectFieldNode, - DirectiveNode, - TypeNode, - NamedTypeNode, - ListTypeNode, - NonNullTypeNode, - TypeSystemDefinitionNode, - SchemaDefinitionNode, - OperationTypeDefinitionNode, - TypeDefinitionNode, - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - DirectiveDefinitionNode, - TypeSystemExtensionNode, - SchemaExtensionNode, - TypeExtensionNode, - ScalarTypeExtensionNode, - ObjectTypeExtensionNode, - InterfaceTypeExtensionNode, - UnionTypeExtensionNode, - EnumTypeExtensionNode, - InputObjectTypeExtensionNode, -} from './ast'; - -export { - isDefinitionNode, - isExecutableDefinitionNode, - isSelectionNode, - isValueNode, - isTypeNode, - isTypeSystemDefinitionNode, - isTypeDefinitionNode, - isTypeSystemExtensionNode, - isTypeExtensionNode, -} from './predicates'; - -export { DirectiveLocation } from './directiveLocation'; -export type { DirectiveLocationEnum } from './directiveLocation'; diff --git a/node_modules/graphql/language/index.mjs b/node_modules/graphql/language/index.mjs deleted file mode 100644 index 682e1a80..00000000 --- a/node_modules/graphql/language/index.mjs +++ /dev/null @@ -1,12 +0,0 @@ -export { Source } from "./source.mjs"; -export { getLocation } from "./location.mjs"; -export { printLocation, printSourceLocation } from "./printLocation.mjs"; -export { Kind } from "./kinds.mjs"; -export { TokenKind } from "./tokenKind.mjs"; -export { Lexer } from "./lexer.mjs"; -export { parse, parseValue, parseType } from "./parser.mjs"; -export { print } from "./printer.mjs"; -export { visit, visitInParallel, getVisitFn, BREAK } from "./visitor.mjs"; -export { Location, Token } from "./ast.mjs"; -export { isDefinitionNode, isExecutableDefinitionNode, isSelectionNode, isValueNode, isTypeNode, isTypeSystemDefinitionNode, isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode } from "./predicates.mjs"; -export { DirectiveLocation } from "./directiveLocation.mjs"; diff --git a/node_modules/graphql/language/kinds.d.ts b/node_modules/graphql/language/kinds.d.ts deleted file mode 100644 index 35a72399..00000000 --- a/node_modules/graphql/language/kinds.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * The set of allowed kind values for AST nodes. - */ -export const Kind: { - // Name - NAME: 'Name'; - - // Document - DOCUMENT: 'Document'; - OPERATION_DEFINITION: 'OperationDefinition'; - VARIABLE_DEFINITION: 'VariableDefinition'; - SELECTION_SET: 'SelectionSet'; - FIELD: 'Field'; - ARGUMENT: 'Argument'; - - // Fragments - FRAGMENT_SPREAD: 'FragmentSpread'; - INLINE_FRAGMENT: 'InlineFragment'; - FRAGMENT_DEFINITION: 'FragmentDefinition'; - - // Values - VARIABLE: 'Variable'; - INT: 'IntValue'; - FLOAT: 'FloatValue'; - STRING: 'StringValue'; - BOOLEAN: 'BooleanValue'; - NULL: 'NullValue'; - ENUM: 'EnumValue'; - LIST: 'ListValue'; - OBJECT: 'ObjectValue'; - OBJECT_FIELD: 'ObjectField'; - - // Directives - DIRECTIVE: 'Directive'; - - // Types - NAMED_TYPE: 'NamedType'; - LIST_TYPE: 'ListType'; - NON_NULL_TYPE: 'NonNullType'; - - // Type System Definitions - SCHEMA_DEFINITION: 'SchemaDefinition'; - OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition'; - - // Type Definitions - SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition'; - OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition'; - FIELD_DEFINITION: 'FieldDefinition'; - INPUT_VALUE_DEFINITION: 'InputValueDefinition'; - INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition'; - UNION_TYPE_DEFINITION: 'UnionTypeDefinition'; - ENUM_TYPE_DEFINITION: 'EnumTypeDefinition'; - ENUM_VALUE_DEFINITION: 'EnumValueDefinition'; - INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition'; - - // Directive Definitions - DIRECTIVE_DEFINITION: 'DirectiveDefinition'; - - // Type System Extensions - SCHEMA_EXTENSION: 'SchemaExtension'; - - // Type Extensions - SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension'; - OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension'; - INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension'; - UNION_TYPE_EXTENSION: 'UnionTypeExtension'; - ENUM_TYPE_EXTENSION: 'EnumTypeExtension'; - INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'; -}; - -/** - * The enum type representing the possible kind values of AST nodes. - */ -export type KindEnum = typeof Kind[keyof typeof Kind]; diff --git a/node_modules/graphql/language/kinds.js b/node_modules/graphql/language/kinds.js deleted file mode 100644 index 32b90c4a..00000000 --- a/node_modules/graphql/language/kinds.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Kind = void 0; - -/** - * The set of allowed kind values for AST nodes. - */ -var Kind = Object.freeze({ - // Name - NAME: 'Name', - // Document - DOCUMENT: 'Document', - OPERATION_DEFINITION: 'OperationDefinition', - VARIABLE_DEFINITION: 'VariableDefinition', - SELECTION_SET: 'SelectionSet', - FIELD: 'Field', - ARGUMENT: 'Argument', - // Fragments - FRAGMENT_SPREAD: 'FragmentSpread', - INLINE_FRAGMENT: 'InlineFragment', - FRAGMENT_DEFINITION: 'FragmentDefinition', - // Values - VARIABLE: 'Variable', - INT: 'IntValue', - FLOAT: 'FloatValue', - STRING: 'StringValue', - BOOLEAN: 'BooleanValue', - NULL: 'NullValue', - ENUM: 'EnumValue', - LIST: 'ListValue', - OBJECT: 'ObjectValue', - OBJECT_FIELD: 'ObjectField', - // Directives - DIRECTIVE: 'Directive', - // Types - NAMED_TYPE: 'NamedType', - LIST_TYPE: 'ListType', - NON_NULL_TYPE: 'NonNullType', - // Type System Definitions - SCHEMA_DEFINITION: 'SchemaDefinition', - OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', - // Type Definitions - SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', - OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', - FIELD_DEFINITION: 'FieldDefinition', - INPUT_VALUE_DEFINITION: 'InputValueDefinition', - INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', - UNION_TYPE_DEFINITION: 'UnionTypeDefinition', - ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', - ENUM_VALUE_DEFINITION: 'EnumValueDefinition', - INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', - // Directive Definitions - DIRECTIVE_DEFINITION: 'DirectiveDefinition', - // Type System Extensions - SCHEMA_EXTENSION: 'SchemaExtension', - // Type Extensions - SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', - OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', - INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', - UNION_TYPE_EXTENSION: 'UnionTypeExtension', - ENUM_TYPE_EXTENSION: 'EnumTypeExtension', - INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' -}); -/** - * The enum type representing the possible kind values of AST nodes. - */ - -exports.Kind = Kind; diff --git a/node_modules/graphql/language/kinds.js.flow b/node_modules/graphql/language/kinds.js.flow deleted file mode 100644 index 8826fa18..00000000 --- a/node_modules/graphql/language/kinds.js.flow +++ /dev/null @@ -1,75 +0,0 @@ -// @flow strict -/** - * The set of allowed kind values for AST nodes. - */ -export const Kind = Object.freeze({ - // Name - NAME: 'Name', - - // Document - DOCUMENT: 'Document', - OPERATION_DEFINITION: 'OperationDefinition', - VARIABLE_DEFINITION: 'VariableDefinition', - SELECTION_SET: 'SelectionSet', - FIELD: 'Field', - ARGUMENT: 'Argument', - - // Fragments - FRAGMENT_SPREAD: 'FragmentSpread', - INLINE_FRAGMENT: 'InlineFragment', - FRAGMENT_DEFINITION: 'FragmentDefinition', - - // Values - VARIABLE: 'Variable', - INT: 'IntValue', - FLOAT: 'FloatValue', - STRING: 'StringValue', - BOOLEAN: 'BooleanValue', - NULL: 'NullValue', - ENUM: 'EnumValue', - LIST: 'ListValue', - OBJECT: 'ObjectValue', - OBJECT_FIELD: 'ObjectField', - - // Directives - DIRECTIVE: 'Directive', - - // Types - NAMED_TYPE: 'NamedType', - LIST_TYPE: 'ListType', - NON_NULL_TYPE: 'NonNullType', - - // Type System Definitions - SCHEMA_DEFINITION: 'SchemaDefinition', - OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', - - // Type Definitions - SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', - OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', - FIELD_DEFINITION: 'FieldDefinition', - INPUT_VALUE_DEFINITION: 'InputValueDefinition', - INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', - UNION_TYPE_DEFINITION: 'UnionTypeDefinition', - ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', - ENUM_VALUE_DEFINITION: 'EnumValueDefinition', - INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', - - // Directive Definitions - DIRECTIVE_DEFINITION: 'DirectiveDefinition', - - // Type System Extensions - SCHEMA_EXTENSION: 'SchemaExtension', - - // Type Extensions - SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', - OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', - INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', - UNION_TYPE_EXTENSION: 'UnionTypeExtension', - ENUM_TYPE_EXTENSION: 'EnumTypeExtension', - INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension', -}); - -/** - * The enum type representing the possible kind values of AST nodes. - */ -export type KindEnum = $Values; diff --git a/node_modules/graphql/language/kinds.mjs b/node_modules/graphql/language/kinds.mjs deleted file mode 100644 index b439c711..00000000 --- a/node_modules/graphql/language/kinds.mjs +++ /dev/null @@ -1,62 +0,0 @@ -/** - * The set of allowed kind values for AST nodes. - */ -export var Kind = Object.freeze({ - // Name - NAME: 'Name', - // Document - DOCUMENT: 'Document', - OPERATION_DEFINITION: 'OperationDefinition', - VARIABLE_DEFINITION: 'VariableDefinition', - SELECTION_SET: 'SelectionSet', - FIELD: 'Field', - ARGUMENT: 'Argument', - // Fragments - FRAGMENT_SPREAD: 'FragmentSpread', - INLINE_FRAGMENT: 'InlineFragment', - FRAGMENT_DEFINITION: 'FragmentDefinition', - // Values - VARIABLE: 'Variable', - INT: 'IntValue', - FLOAT: 'FloatValue', - STRING: 'StringValue', - BOOLEAN: 'BooleanValue', - NULL: 'NullValue', - ENUM: 'EnumValue', - LIST: 'ListValue', - OBJECT: 'ObjectValue', - OBJECT_FIELD: 'ObjectField', - // Directives - DIRECTIVE: 'Directive', - // Types - NAMED_TYPE: 'NamedType', - LIST_TYPE: 'ListType', - NON_NULL_TYPE: 'NonNullType', - // Type System Definitions - SCHEMA_DEFINITION: 'SchemaDefinition', - OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', - // Type Definitions - SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', - OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', - FIELD_DEFINITION: 'FieldDefinition', - INPUT_VALUE_DEFINITION: 'InputValueDefinition', - INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', - UNION_TYPE_DEFINITION: 'UnionTypeDefinition', - ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', - ENUM_VALUE_DEFINITION: 'EnumValueDefinition', - INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', - // Directive Definitions - DIRECTIVE_DEFINITION: 'DirectiveDefinition', - // Type System Extensions - SCHEMA_EXTENSION: 'SchemaExtension', - // Type Extensions - SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', - OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', - INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', - UNION_TYPE_EXTENSION: 'UnionTypeExtension', - ENUM_TYPE_EXTENSION: 'EnumTypeExtension', - INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' -}); -/** - * The enum type representing the possible kind values of AST nodes. - */ diff --git a/node_modules/graphql/language/lexer.d.ts b/node_modules/graphql/language/lexer.d.ts deleted file mode 100644 index 40dbf9a6..00000000 --- a/node_modules/graphql/language/lexer.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Token } from './ast'; -import { Source } from './source'; -import { TokenKindEnum } from './tokenKind'; - -/** - * Given a Source object, this returns a Lexer for that source. - * A Lexer is a stateful stream generator in that every time - * it is advanced, it returns the next token in the Source. Assuming the - * source lexes, the final Token emitted by the lexer will be of kind - * EOF, after which the lexer will repeatedly return the same EOF token - * whenever called. - */ -export class Lexer { - source: Source; - - /** - * The previously focused non-ignored token. - */ - lastToken: Token; - - /** - * The currently focused non-ignored token. - */ - token: Token; - - /** - * The (1-indexed) line containing the current token. - */ - line: number; - - /** - * The character offset at which the current line begins. - */ - lineStart: number; - - constructor(source: Source); - - /** - * Advances the token stream to the next non-ignored token. - */ - advance(): Token; - - /** - * Looks ahead and returns the next non-ignored token, but does not change - * the state of Lexer. - */ - lookahead(): Token; -} - -/** - * @internal - */ -export function isPunctuatorToken(token: Token): boolean; - -/** - * @internal - */ -export function isPunctuatorTokenKind(kind: TokenKindEnum): boolean; diff --git a/node_modules/graphql/language/lexer.js b/node_modules/graphql/language/lexer.js deleted file mode 100644 index 7b2ee16a..00000000 --- a/node_modules/graphql/language/lexer.js +++ /dev/null @@ -1,690 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isPunctuatorTokenKind = isPunctuatorTokenKind; -exports.Lexer = void 0; - -var _syntaxError = require("../error/syntaxError.js"); - -var _ast = require("./ast.js"); - -var _tokenKind = require("./tokenKind.js"); - -var _blockString = require("./blockString.js"); - -/** - * Given a Source object, creates a Lexer for that source. - * A Lexer is a stateful stream generator in that every time - * it is advanced, it returns the next token in the Source. Assuming the - * source lexes, the final Token emitted by the lexer will be of kind - * EOF, after which the lexer will repeatedly return the same EOF token - * whenever called. - */ -var Lexer = /*#__PURE__*/function () { - /** - * The previously focused non-ignored token. - */ - - /** - * The currently focused non-ignored token. - */ - - /** - * The (1-indexed) line containing the current token. - */ - - /** - * The character offset at which the current line begins. - */ - function Lexer(source) { - var startOfFileToken = new _ast.Token(_tokenKind.TokenKind.SOF, 0, 0, 0, 0, null); - this.source = source; - this.lastToken = startOfFileToken; - this.token = startOfFileToken; - this.line = 1; - this.lineStart = 0; - } - /** - * Advances the token stream to the next non-ignored token. - */ - - - var _proto = Lexer.prototype; - - _proto.advance = function advance() { - this.lastToken = this.token; - var token = this.token = this.lookahead(); - return token; - } - /** - * Looks ahead and returns the next non-ignored token, but does not change - * the state of Lexer. - */ - ; - - _proto.lookahead = function lookahead() { - var token = this.token; - - if (token.kind !== _tokenKind.TokenKind.EOF) { - do { - var _token$next; - - // Note: next is only mutable during parsing, so we cast to allow this. - token = (_token$next = token.next) !== null && _token$next !== void 0 ? _token$next : token.next = readToken(this, token); - } while (token.kind === _tokenKind.TokenKind.COMMENT); - } - - return token; - }; - - return Lexer; -}(); -/** - * @internal - */ - - -exports.Lexer = Lexer; - -function isPunctuatorTokenKind(kind) { - return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R; -} - -function printCharCode(code) { - return (// NaN/undefined represents access beyond the end of the file. - isNaN(code) ? _tokenKind.TokenKind.EOF : // Trust JSON for ASCII. - code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form. - "\"\\u".concat(('00' + code.toString(16).toUpperCase()).slice(-4), "\"") - ); -} -/** - * Gets the next token from the source starting at the given position. - * - * This skips over whitespace until it finds the next lexable token, then lexes - * punctuators immediately or calls the appropriate helper function for more - * complicated tokens. - */ - - -function readToken(lexer, prev) { - var source = lexer.source; - var body = source.body; - var bodyLength = body.length; - var pos = prev.end; - - while (pos < bodyLength) { - var code = body.charCodeAt(pos); - var _line = lexer.line; - - var _col = 1 + pos - lexer.lineStart; // SourceCharacter - - - switch (code) { - case 0xfeff: // - - case 9: // \t - - case 32: // - - case 44: - // , - ++pos; - continue; - - case 10: - // \n - ++pos; - ++lexer.line; - lexer.lineStart = pos; - continue; - - case 13: - // \r - if (body.charCodeAt(pos + 1) === 10) { - pos += 2; - } else { - ++pos; - } - - ++lexer.line; - lexer.lineStart = pos; - continue; - - case 33: - // ! - return new _ast.Token(_tokenKind.TokenKind.BANG, pos, pos + 1, _line, _col, prev); - - case 35: - // # - return readComment(source, pos, _line, _col, prev); - - case 36: - // $ - return new _ast.Token(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev); - - case 38: - // & - return new _ast.Token(_tokenKind.TokenKind.AMP, pos, pos + 1, _line, _col, prev); - - case 40: - // ( - return new _ast.Token(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev); - - case 41: - // ) - return new _ast.Token(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev); - - case 46: - // . - if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) { - return new _ast.Token(_tokenKind.TokenKind.SPREAD, pos, pos + 3, _line, _col, prev); - } - - break; - - case 58: - // : - return new _ast.Token(_tokenKind.TokenKind.COLON, pos, pos + 1, _line, _col, prev); - - case 61: - // = - return new _ast.Token(_tokenKind.TokenKind.EQUALS, pos, pos + 1, _line, _col, prev); - - case 64: - // @ - return new _ast.Token(_tokenKind.TokenKind.AT, pos, pos + 1, _line, _col, prev); - - case 91: - // [ - return new _ast.Token(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev); - - case 93: - // ] - return new _ast.Token(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev); - - case 123: - // { - return new _ast.Token(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev); - - case 124: - // | - return new _ast.Token(_tokenKind.TokenKind.PIPE, pos, pos + 1, _line, _col, prev); - - case 125: - // } - return new _ast.Token(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev); - - case 34: - // " - if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) { - return readBlockString(source, pos, _line, _col, prev, lexer); - } - - return readString(source, pos, _line, _col, prev); - - case 45: // - - - case 48: // 0 - - case 49: // 1 - - case 50: // 2 - - case 51: // 3 - - case 52: // 4 - - case 53: // 5 - - case 54: // 6 - - case 55: // 7 - - case 56: // 8 - - case 57: - // 9 - return readNumber(source, pos, code, _line, _col, prev); - - case 65: // A - - case 66: // B - - case 67: // C - - case 68: // D - - case 69: // E - - case 70: // F - - case 71: // G - - case 72: // H - - case 73: // I - - case 74: // J - - case 75: // K - - case 76: // L - - case 77: // M - - case 78: // N - - case 79: // O - - case 80: // P - - case 81: // Q - - case 82: // R - - case 83: // S - - case 84: // T - - case 85: // U - - case 86: // V - - case 87: // W - - case 88: // X - - case 89: // Y - - case 90: // Z - - case 95: // _ - - case 97: // a - - case 98: // b - - case 99: // c - - case 100: // d - - case 101: // e - - case 102: // f - - case 103: // g - - case 104: // h - - case 105: // i - - case 106: // j - - case 107: // k - - case 108: // l - - case 109: // m - - case 110: // n - - case 111: // o - - case 112: // p - - case 113: // q - - case 114: // r - - case 115: // s - - case 116: // t - - case 117: // u - - case 118: // v - - case 119: // w - - case 120: // x - - case 121: // y - - case 122: - // z - return readName(source, pos, _line, _col, prev); - } - - throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code)); - } - - var line = lexer.line; - var col = 1 + pos - lexer.lineStart; - return new _ast.Token(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev); -} -/** - * Report a message that an unexpected character was encountered. - */ - - -function unexpectedCharacterMessage(code) { - if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { - return "Cannot contain the invalid character ".concat(printCharCode(code), "."); - } - - if (code === 39) { - // ' - return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; - } - - return "Cannot parse the unexpected character ".concat(printCharCode(code), "."); -} -/** - * Reads a comment token from the source file. - * - * #[\u0009\u0020-\uFFFF]* - */ - - -function readComment(source, start, line, col, prev) { - var body = source.body; - var code; - var position = start; - - do { - code = body.charCodeAt(++position); - } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator - code > 0x001f || code === 0x0009)); - - return new _ast.Token(_tokenKind.TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position)); -} -/** - * Reads a number token from the source file, either a float - * or an int depending on whether a decimal point appears. - * - * Int: -?(0|[1-9][0-9]*) - * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? - */ - - -function readNumber(source, start, firstCode, line, col, prev) { - var body = source.body; - var code = firstCode; - var position = start; - var isFloat = false; - - if (code === 45) { - // - - code = body.charCodeAt(++position); - } - - if (code === 48) { - // 0 - code = body.charCodeAt(++position); - - if (code >= 48 && code <= 57) { - throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, unexpected digit after 0: ".concat(printCharCode(code), ".")); - } - } else { - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 46) { - // . - isFloat = true; - code = body.charCodeAt(++position); - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 69 || code === 101) { - // E e - isFloat = true; - code = body.charCodeAt(++position); - - if (code === 43 || code === 45) { - // + - - code = body.charCodeAt(++position); - } - - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } // Numbers cannot be followed by . or NameStart - - - if (code === 46 || isNameStart(code)) { - throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); - } - - return new _ast.Token(isFloat ? _tokenKind.TokenKind.FLOAT : _tokenKind.TokenKind.INT, start, position, line, col, prev, body.slice(start, position)); -} -/** - * Returns the new position in the source after reading digits. - */ - - -function readDigits(source, start, firstCode) { - var body = source.body; - var position = start; - var code = firstCode; - - if (code >= 48 && code <= 57) { - // 0 - 9 - do { - code = body.charCodeAt(++position); - } while (code >= 48 && code <= 57); // 0 - 9 - - - return position; - } - - throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); -} -/** - * Reads a string token from the source file. - * - * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" - */ - - -function readString(source, start, line, col, prev) { - var body = source.body; - var position = start + 1; - var chunkStart = position; - var code = 0; - var value = ''; - - while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator - code !== 0x000a && code !== 0x000d) { - // Closing Quote (") - if (code === 34) { - value += body.slice(chunkStart, position); - return new _ast.Token(_tokenKind.TokenKind.STRING, start, position + 1, line, col, prev, value); - } // SourceCharacter - - - if (code < 0x0020 && code !== 0x0009) { - throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); - } - - ++position; - - if (code === 92) { - // \ - value += body.slice(chunkStart, position - 1); - code = body.charCodeAt(position); - - switch (code) { - case 34: - value += '"'; - break; - - case 47: - value += '/'; - break; - - case 92: - value += '\\'; - break; - - case 98: - value += '\b'; - break; - - case 102: - value += '\f'; - break; - - case 110: - value += '\n'; - break; - - case 114: - value += '\r'; - break; - - case 116: - value += '\t'; - break; - - case 117: - { - // uXXXX - var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); - - if (charCode < 0) { - var invalidSequence = body.slice(position + 1, position + 5); - throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\u".concat(invalidSequence, ".")); - } - - value += String.fromCharCode(charCode); - position += 4; - break; - } - - default: - throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); - } - - ++position; - chunkStart = position; - } - } - - throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); -} -/** - * Reads a block string token from the source file. - * - * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" - */ - - -function readBlockString(source, start, line, col, prev, lexer) { - var body = source.body; - var position = start + 3; - var chunkStart = position; - var code = 0; - var rawValue = ''; - - while (position < body.length && !isNaN(code = body.charCodeAt(position))) { - // Closing Triple-Quote (""") - if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { - rawValue += body.slice(chunkStart, position); - return new _ast.Token(_tokenKind.TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, (0, _blockString.dedentBlockStringValue)(rawValue)); - } // SourceCharacter - - - if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { - throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); - } - - if (code === 10) { - // new line - ++position; - ++lexer.line; - lexer.lineStart = position; - } else if (code === 13) { - // carriage return - if (body.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - - ++lexer.line; - lexer.lineStart = position; - } else if ( // Escape Triple-Quote (\""") - code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { - rawValue += body.slice(chunkStart, position) + '"""'; - position += 4; - chunkStart = position; - } else { - ++position; - } - } - - throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); -} -/** - * Converts four hexadecimal chars to the integer that the - * string represents. For example, uniCharCode('0','0','0','f') - * will return 15, and uniCharCode('0','0','f','f') returns 255. - * - * Returns a negative number on error, if a char was invalid. - * - * This is implemented by noting that char2hex() returns -1 on error, - * which means the result of ORing the char2hex() will also be negative. - */ - - -function uniCharCode(a, b, c, d) { - return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d); -} -/** - * Converts a hex character to its integer value. - * '0' becomes 0, '9' becomes 9 - * 'A' becomes 10, 'F' becomes 15 - * 'a' becomes 10, 'f' becomes 15 - * - * Returns -1 on error. - */ - - -function char2hex(a) { - return a >= 48 && a <= 57 ? a - 48 // 0-9 - : a >= 65 && a <= 70 ? a - 55 // A-F - : a >= 97 && a <= 102 ? a - 87 // a-f - : -1; -} -/** - * Reads an alphanumeric + underscore name from the source. - * - * [_A-Za-z][_0-9A-Za-z]* - */ - - -function readName(source, start, line, col, prev) { - var body = source.body; - var bodyLength = body.length; - var position = start + 1; - var code = 0; - - while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _ - code >= 48 && code <= 57 || // 0-9 - code >= 65 && code <= 90 || // A-Z - code >= 97 && code <= 122) // a-z - ) { - ++position; - } - - return new _ast.Token(_tokenKind.TokenKind.NAME, start, position, line, col, prev, body.slice(start, position)); -} // _ A-Z a-z - - -function isNameStart(code) { - return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122; -} diff --git a/node_modules/graphql/language/lexer.js.flow b/node_modules/graphql/language/lexer.js.flow deleted file mode 100644 index 32dba0c0..00000000 --- a/node_modules/graphql/language/lexer.js.flow +++ /dev/null @@ -1,701 +0,0 @@ -// @flow strict -import { syntaxError } from '../error/syntaxError'; - -import type { Source } from './source'; -import type { TokenKindEnum } from './tokenKind'; -import { Token } from './ast'; -import { TokenKind } from './tokenKind'; -import { dedentBlockStringValue } from './blockString'; - -/** - * Given a Source object, creates a Lexer for that source. - * A Lexer is a stateful stream generator in that every time - * it is advanced, it returns the next token in the Source. Assuming the - * source lexes, the final Token emitted by the lexer will be of kind - * EOF, after which the lexer will repeatedly return the same EOF token - * whenever called. - */ -export class Lexer { - source: Source; - - /** - * The previously focused non-ignored token. - */ - lastToken: Token; - - /** - * The currently focused non-ignored token. - */ - token: Token; - - /** - * The (1-indexed) line containing the current token. - */ - line: number; - - /** - * The character offset at which the current line begins. - */ - lineStart: number; - - constructor(source: Source) { - const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0, null); - - this.source = source; - this.lastToken = startOfFileToken; - this.token = startOfFileToken; - this.line = 1; - this.lineStart = 0; - } - - /** - * Advances the token stream to the next non-ignored token. - */ - advance(): Token { - this.lastToken = this.token; - const token = (this.token = this.lookahead()); - return token; - } - - /** - * Looks ahead and returns the next non-ignored token, but does not change - * the state of Lexer. - */ - lookahead(): Token { - let token = this.token; - if (token.kind !== TokenKind.EOF) { - do { - // Note: next is only mutable during parsing, so we cast to allow this. - token = token.next ?? ((token: any).next = readToken(this, token)); - } while (token.kind === TokenKind.COMMENT); - } - return token; - } -} - -/** - * @internal - */ -export function isPunctuatorTokenKind(kind: TokenKindEnum): boolean %checks { - return ( - kind === TokenKind.BANG || - kind === TokenKind.DOLLAR || - kind === TokenKind.AMP || - kind === TokenKind.PAREN_L || - kind === TokenKind.PAREN_R || - kind === TokenKind.SPREAD || - kind === TokenKind.COLON || - kind === TokenKind.EQUALS || - kind === TokenKind.AT || - kind === TokenKind.BRACKET_L || - kind === TokenKind.BRACKET_R || - kind === TokenKind.BRACE_L || - kind === TokenKind.PIPE || - kind === TokenKind.BRACE_R - ); -} - -function printCharCode(code: number): string { - return ( - // NaN/undefined represents access beyond the end of the file. - isNaN(code) - ? TokenKind.EOF - : // Trust JSON for ASCII. - code < 0x007f - ? JSON.stringify(String.fromCharCode(code)) - : // Otherwise print the escaped form. - `"\\u${('00' + code.toString(16).toUpperCase()).slice(-4)}"` - ); -} - -/** - * Gets the next token from the source starting at the given position. - * - * This skips over whitespace until it finds the next lexable token, then lexes - * punctuators immediately or calls the appropriate helper function for more - * complicated tokens. - */ -function readToken(lexer: Lexer, prev: Token): Token { - const source = lexer.source; - const body = source.body; - const bodyLength = body.length; - - let pos = prev.end; - while (pos < bodyLength) { - const code = body.charCodeAt(pos); - - const line = lexer.line; - const col = 1 + pos - lexer.lineStart; - - // SourceCharacter - switch (code) { - case 0xfeff: // - case 9: // \t - case 32: // - case 44: // , - ++pos; - continue; - case 10: // \n - ++pos; - ++lexer.line; - lexer.lineStart = pos; - continue; - case 13: // \r - if (body.charCodeAt(pos + 1) === 10) { - pos += 2; - } else { - ++pos; - } - ++lexer.line; - lexer.lineStart = pos; - continue; - case 33: // ! - return new Token(TokenKind.BANG, pos, pos + 1, line, col, prev); - case 35: // # - return readComment(source, pos, line, col, prev); - case 36: // $ - return new Token(TokenKind.DOLLAR, pos, pos + 1, line, col, prev); - case 38: // & - return new Token(TokenKind.AMP, pos, pos + 1, line, col, prev); - case 40: // ( - return new Token(TokenKind.PAREN_L, pos, pos + 1, line, col, prev); - case 41: // ) - return new Token(TokenKind.PAREN_R, pos, pos + 1, line, col, prev); - case 46: // . - if ( - body.charCodeAt(pos + 1) === 46 && - body.charCodeAt(pos + 2) === 46 - ) { - return new Token(TokenKind.SPREAD, pos, pos + 3, line, col, prev); - } - break; - case 58: // : - return new Token(TokenKind.COLON, pos, pos + 1, line, col, prev); - case 61: // = - return new Token(TokenKind.EQUALS, pos, pos + 1, line, col, prev); - case 64: // @ - return new Token(TokenKind.AT, pos, pos + 1, line, col, prev); - case 91: // [ - return new Token(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev); - case 93: // ] - return new Token(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev); - case 123: // { - return new Token(TokenKind.BRACE_L, pos, pos + 1, line, col, prev); - case 124: // | - return new Token(TokenKind.PIPE, pos, pos + 1, line, col, prev); - case 125: // } - return new Token(TokenKind.BRACE_R, pos, pos + 1, line, col, prev); - case 34: // " - if ( - body.charCodeAt(pos + 1) === 34 && - body.charCodeAt(pos + 2) === 34 - ) { - return readBlockString(source, pos, line, col, prev, lexer); - } - return readString(source, pos, line, col, prev); - case 45: // - - case 48: // 0 - case 49: // 1 - case 50: // 2 - case 51: // 3 - case 52: // 4 - case 53: // 5 - case 54: // 6 - case 55: // 7 - case 56: // 8 - case 57: // 9 - return readNumber(source, pos, code, line, col, prev); - case 65: // A - case 66: // B - case 67: // C - case 68: // D - case 69: // E - case 70: // F - case 71: // G - case 72: // H - case 73: // I - case 74: // J - case 75: // K - case 76: // L - case 77: // M - case 78: // N - case 79: // O - case 80: // P - case 81: // Q - case 82: // R - case 83: // S - case 84: // T - case 85: // U - case 86: // V - case 87: // W - case 88: // X - case 89: // Y - case 90: // Z - case 95: // _ - case 97: // a - case 98: // b - case 99: // c - case 100: // d - case 101: // e - case 102: // f - case 103: // g - case 104: // h - case 105: // i - case 106: // j - case 107: // k - case 108: // l - case 109: // m - case 110: // n - case 111: // o - case 112: // p - case 113: // q - case 114: // r - case 115: // s - case 116: // t - case 117: // u - case 118: // v - case 119: // w - case 120: // x - case 121: // y - case 122: // z - return readName(source, pos, line, col, prev); - } - - throw syntaxError(source, pos, unexpectedCharacterMessage(code)); - } - - const line = lexer.line; - const col = 1 + pos - lexer.lineStart; - return new Token(TokenKind.EOF, bodyLength, bodyLength, line, col, prev); -} - -/** - * Report a message that an unexpected character was encountered. - */ -function unexpectedCharacterMessage(code: number): string { - if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { - return `Cannot contain the invalid character ${printCharCode(code)}.`; - } - - if (code === 39) { - // ' - return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; - } - - return `Cannot parse the unexpected character ${printCharCode(code)}.`; -} - -/** - * Reads a comment token from the source file. - * - * #[\u0009\u0020-\uFFFF]* - */ -function readComment( - source: Source, - start: number, - line: number, - col: number, - prev: Token | null, -): Token { - const body = source.body; - let code; - let position = start; - - do { - code = body.charCodeAt(++position); - } while ( - !isNaN(code) && - // SourceCharacter but not LineTerminator - (code > 0x001f || code === 0x0009) - ); - - return new Token( - TokenKind.COMMENT, - start, - position, - line, - col, - prev, - body.slice(start + 1, position), - ); -} - -/** - * Reads a number token from the source file, either a float - * or an int depending on whether a decimal point appears. - * - * Int: -?(0|[1-9][0-9]*) - * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? - */ -function readNumber( - source: Source, - start: number, - firstCode: number, - line: number, - col: number, - prev: Token | null, -): Token { - const body = source.body; - let code = firstCode; - let position = start; - let isFloat = false; - - if (code === 45) { - // - - code = body.charCodeAt(++position); - } - - if (code === 48) { - // 0 - code = body.charCodeAt(++position); - if (code >= 48 && code <= 57) { - throw syntaxError( - source, - position, - `Invalid number, unexpected digit after 0: ${printCharCode(code)}.`, - ); - } - } else { - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 46) { - // . - isFloat = true; - - code = body.charCodeAt(++position); - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 69 || code === 101) { - // E e - isFloat = true; - - code = body.charCodeAt(++position); - if (code === 43 || code === 45) { - // + - - code = body.charCodeAt(++position); - } - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - // Numbers cannot be followed by . or NameStart - if (code === 46 || isNameStart(code)) { - throw syntaxError( - source, - position, - `Invalid number, expected digit but got: ${printCharCode(code)}.`, - ); - } - - return new Token( - isFloat ? TokenKind.FLOAT : TokenKind.INT, - start, - position, - line, - col, - prev, - body.slice(start, position), - ); -} - -/** - * Returns the new position in the source after reading digits. - */ -function readDigits(source: Source, start: number, firstCode: number): number { - const body = source.body; - let position = start; - let code = firstCode; - if (code >= 48 && code <= 57) { - // 0 - 9 - do { - code = body.charCodeAt(++position); - } while (code >= 48 && code <= 57); // 0 - 9 - return position; - } - throw syntaxError( - source, - position, - `Invalid number, expected digit but got: ${printCharCode(code)}.`, - ); -} - -/** - * Reads a string token from the source file. - * - * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" - */ -function readString( - source: Source, - start: number, - line: number, - col: number, - prev: Token | null, -): Token { - const body = source.body; - let position = start + 1; - let chunkStart = position; - let code = 0; - let value = ''; - - while ( - position < body.length && - !isNaN((code = body.charCodeAt(position))) && - // not LineTerminator - code !== 0x000a && - code !== 0x000d - ) { - // Closing Quote (") - if (code === 34) { - value += body.slice(chunkStart, position); - return new Token( - TokenKind.STRING, - start, - position + 1, - line, - col, - prev, - value, - ); - } - - // SourceCharacter - if (code < 0x0020 && code !== 0x0009) { - throw syntaxError( - source, - position, - `Invalid character within String: ${printCharCode(code)}.`, - ); - } - - ++position; - if (code === 92) { - // \ - value += body.slice(chunkStart, position - 1); - code = body.charCodeAt(position); - switch (code) { - case 34: - value += '"'; - break; - case 47: - value += '/'; - break; - case 92: - value += '\\'; - break; - case 98: - value += '\b'; - break; - case 102: - value += '\f'; - break; - case 110: - value += '\n'; - break; - case 114: - value += '\r'; - break; - case 116: - value += '\t'; - break; - case 117: { - // uXXXX - const charCode = uniCharCode( - body.charCodeAt(position + 1), - body.charCodeAt(position + 2), - body.charCodeAt(position + 3), - body.charCodeAt(position + 4), - ); - if (charCode < 0) { - const invalidSequence = body.slice(position + 1, position + 5); - throw syntaxError( - source, - position, - `Invalid character escape sequence: \\u${invalidSequence}.`, - ); - } - value += String.fromCharCode(charCode); - position += 4; - break; - } - default: - throw syntaxError( - source, - position, - `Invalid character escape sequence: \\${String.fromCharCode( - code, - )}.`, - ); - } - ++position; - chunkStart = position; - } - } - - throw syntaxError(source, position, 'Unterminated string.'); -} - -/** - * Reads a block string token from the source file. - * - * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" - */ -function readBlockString( - source: Source, - start: number, - line: number, - col: number, - prev: Token | null, - lexer: Lexer, -): Token { - const body = source.body; - let position = start + 3; - let chunkStart = position; - let code = 0; - let rawValue = ''; - - while (position < body.length && !isNaN((code = body.charCodeAt(position)))) { - // Closing Triple-Quote (""") - if ( - code === 34 && - body.charCodeAt(position + 1) === 34 && - body.charCodeAt(position + 2) === 34 - ) { - rawValue += body.slice(chunkStart, position); - return new Token( - TokenKind.BLOCK_STRING, - start, - position + 3, - line, - col, - prev, - dedentBlockStringValue(rawValue), - ); - } - - // SourceCharacter - if ( - code < 0x0020 && - code !== 0x0009 && - code !== 0x000a && - code !== 0x000d - ) { - throw syntaxError( - source, - position, - `Invalid character within String: ${printCharCode(code)}.`, - ); - } - - if (code === 10) { - // new line - ++position; - ++lexer.line; - lexer.lineStart = position; - } else if (code === 13) { - // carriage return - if (body.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - ++lexer.line; - lexer.lineStart = position; - } else if ( - // Escape Triple-Quote (\""") - code === 92 && - body.charCodeAt(position + 1) === 34 && - body.charCodeAt(position + 2) === 34 && - body.charCodeAt(position + 3) === 34 - ) { - rawValue += body.slice(chunkStart, position) + '"""'; - position += 4; - chunkStart = position; - } else { - ++position; - } - } - - throw syntaxError(source, position, 'Unterminated string.'); -} - -/** - * Converts four hexadecimal chars to the integer that the - * string represents. For example, uniCharCode('0','0','0','f') - * will return 15, and uniCharCode('0','0','f','f') returns 255. - * - * Returns a negative number on error, if a char was invalid. - * - * This is implemented by noting that char2hex() returns -1 on error, - * which means the result of ORing the char2hex() will also be negative. - */ -function uniCharCode(a: number, b: number, c: number, d: number): number { - return ( - (char2hex(a) << 12) | (char2hex(b) << 8) | (char2hex(c) << 4) | char2hex(d) - ); -} - -/** - * Converts a hex character to its integer value. - * '0' becomes 0, '9' becomes 9 - * 'A' becomes 10, 'F' becomes 15 - * 'a' becomes 10, 'f' becomes 15 - * - * Returns -1 on error. - */ -function char2hex(a: number): number { - return a >= 48 && a <= 57 - ? a - 48 // 0-9 - : a >= 65 && a <= 70 - ? a - 55 // A-F - : a >= 97 && a <= 102 - ? a - 87 // a-f - : -1; -} - -/** - * Reads an alphanumeric + underscore name from the source. - * - * [_A-Za-z][_0-9A-Za-z]* - */ -function readName( - source: Source, - start: number, - line: number, - col: number, - prev: Token | null, -): Token { - const body = source.body; - const bodyLength = body.length; - let position = start + 1; - let code = 0; - while ( - position !== bodyLength && - !isNaN((code = body.charCodeAt(position))) && - (code === 95 || // _ - (code >= 48 && code <= 57) || // 0-9 - (code >= 65 && code <= 90) || // A-Z - (code >= 97 && code <= 122)) // a-z - ) { - ++position; - } - return new Token( - TokenKind.NAME, - start, - position, - line, - col, - prev, - body.slice(start, position), - ); -} - -// _ A-Z a-z -function isNameStart(code: number): boolean { - return ( - code === 95 || (code >= 65 && code <= 90) || (code >= 97 && code <= 122) - ); -} diff --git a/node_modules/graphql/language/lexer.mjs b/node_modules/graphql/language/lexer.mjs deleted file mode 100644 index a9706319..00000000 --- a/node_modules/graphql/language/lexer.mjs +++ /dev/null @@ -1,676 +0,0 @@ -import { syntaxError } from "../error/syntaxError.mjs"; -import { Token } from "./ast.mjs"; -import { TokenKind } from "./tokenKind.mjs"; -import { dedentBlockStringValue } from "./blockString.mjs"; -/** - * Given a Source object, creates a Lexer for that source. - * A Lexer is a stateful stream generator in that every time - * it is advanced, it returns the next token in the Source. Assuming the - * source lexes, the final Token emitted by the lexer will be of kind - * EOF, after which the lexer will repeatedly return the same EOF token - * whenever called. - */ - -export var Lexer = /*#__PURE__*/function () { - /** - * The previously focused non-ignored token. - */ - - /** - * The currently focused non-ignored token. - */ - - /** - * The (1-indexed) line containing the current token. - */ - - /** - * The character offset at which the current line begins. - */ - function Lexer(source) { - var startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0, null); - this.source = source; - this.lastToken = startOfFileToken; - this.token = startOfFileToken; - this.line = 1; - this.lineStart = 0; - } - /** - * Advances the token stream to the next non-ignored token. - */ - - - var _proto = Lexer.prototype; - - _proto.advance = function advance() { - this.lastToken = this.token; - var token = this.token = this.lookahead(); - return token; - } - /** - * Looks ahead and returns the next non-ignored token, but does not change - * the state of Lexer. - */ - ; - - _proto.lookahead = function lookahead() { - var token = this.token; - - if (token.kind !== TokenKind.EOF) { - do { - var _token$next; - - // Note: next is only mutable during parsing, so we cast to allow this. - token = (_token$next = token.next) !== null && _token$next !== void 0 ? _token$next : token.next = readToken(this, token); - } while (token.kind === TokenKind.COMMENT); - } - - return token; - }; - - return Lexer; -}(); -/** - * @internal - */ - -export function isPunctuatorTokenKind(kind) { - return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R; -} - -function printCharCode(code) { - return (// NaN/undefined represents access beyond the end of the file. - isNaN(code) ? TokenKind.EOF : // Trust JSON for ASCII. - code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form. - "\"\\u".concat(('00' + code.toString(16).toUpperCase()).slice(-4), "\"") - ); -} -/** - * Gets the next token from the source starting at the given position. - * - * This skips over whitespace until it finds the next lexable token, then lexes - * punctuators immediately or calls the appropriate helper function for more - * complicated tokens. - */ - - -function readToken(lexer, prev) { - var source = lexer.source; - var body = source.body; - var bodyLength = body.length; - var pos = prev.end; - - while (pos < bodyLength) { - var code = body.charCodeAt(pos); - var _line = lexer.line; - - var _col = 1 + pos - lexer.lineStart; // SourceCharacter - - - switch (code) { - case 0xfeff: // - - case 9: // \t - - case 32: // - - case 44: - // , - ++pos; - continue; - - case 10: - // \n - ++pos; - ++lexer.line; - lexer.lineStart = pos; - continue; - - case 13: - // \r - if (body.charCodeAt(pos + 1) === 10) { - pos += 2; - } else { - ++pos; - } - - ++lexer.line; - lexer.lineStart = pos; - continue; - - case 33: - // ! - return new Token(TokenKind.BANG, pos, pos + 1, _line, _col, prev); - - case 35: - // # - return readComment(source, pos, _line, _col, prev); - - case 36: - // $ - return new Token(TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev); - - case 38: - // & - return new Token(TokenKind.AMP, pos, pos + 1, _line, _col, prev); - - case 40: - // ( - return new Token(TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev); - - case 41: - // ) - return new Token(TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev); - - case 46: - // . - if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) { - return new Token(TokenKind.SPREAD, pos, pos + 3, _line, _col, prev); - } - - break; - - case 58: - // : - return new Token(TokenKind.COLON, pos, pos + 1, _line, _col, prev); - - case 61: - // = - return new Token(TokenKind.EQUALS, pos, pos + 1, _line, _col, prev); - - case 64: - // @ - return new Token(TokenKind.AT, pos, pos + 1, _line, _col, prev); - - case 91: - // [ - return new Token(TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev); - - case 93: - // ] - return new Token(TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev); - - case 123: - // { - return new Token(TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev); - - case 124: - // | - return new Token(TokenKind.PIPE, pos, pos + 1, _line, _col, prev); - - case 125: - // } - return new Token(TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev); - - case 34: - // " - if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) { - return readBlockString(source, pos, _line, _col, prev, lexer); - } - - return readString(source, pos, _line, _col, prev); - - case 45: // - - - case 48: // 0 - - case 49: // 1 - - case 50: // 2 - - case 51: // 3 - - case 52: // 4 - - case 53: // 5 - - case 54: // 6 - - case 55: // 7 - - case 56: // 8 - - case 57: - // 9 - return readNumber(source, pos, code, _line, _col, prev); - - case 65: // A - - case 66: // B - - case 67: // C - - case 68: // D - - case 69: // E - - case 70: // F - - case 71: // G - - case 72: // H - - case 73: // I - - case 74: // J - - case 75: // K - - case 76: // L - - case 77: // M - - case 78: // N - - case 79: // O - - case 80: // P - - case 81: // Q - - case 82: // R - - case 83: // S - - case 84: // T - - case 85: // U - - case 86: // V - - case 87: // W - - case 88: // X - - case 89: // Y - - case 90: // Z - - case 95: // _ - - case 97: // a - - case 98: // b - - case 99: // c - - case 100: // d - - case 101: // e - - case 102: // f - - case 103: // g - - case 104: // h - - case 105: // i - - case 106: // j - - case 107: // k - - case 108: // l - - case 109: // m - - case 110: // n - - case 111: // o - - case 112: // p - - case 113: // q - - case 114: // r - - case 115: // s - - case 116: // t - - case 117: // u - - case 118: // v - - case 119: // w - - case 120: // x - - case 121: // y - - case 122: - // z - return readName(source, pos, _line, _col, prev); - } - - throw syntaxError(source, pos, unexpectedCharacterMessage(code)); - } - - var line = lexer.line; - var col = 1 + pos - lexer.lineStart; - return new Token(TokenKind.EOF, bodyLength, bodyLength, line, col, prev); -} -/** - * Report a message that an unexpected character was encountered. - */ - - -function unexpectedCharacterMessage(code) { - if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { - return "Cannot contain the invalid character ".concat(printCharCode(code), "."); - } - - if (code === 39) { - // ' - return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; - } - - return "Cannot parse the unexpected character ".concat(printCharCode(code), "."); -} -/** - * Reads a comment token from the source file. - * - * #[\u0009\u0020-\uFFFF]* - */ - - -function readComment(source, start, line, col, prev) { - var body = source.body; - var code; - var position = start; - - do { - code = body.charCodeAt(++position); - } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator - code > 0x001f || code === 0x0009)); - - return new Token(TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position)); -} -/** - * Reads a number token from the source file, either a float - * or an int depending on whether a decimal point appears. - * - * Int: -?(0|[1-9][0-9]*) - * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? - */ - - -function readNumber(source, start, firstCode, line, col, prev) { - var body = source.body; - var code = firstCode; - var position = start; - var isFloat = false; - - if (code === 45) { - // - - code = body.charCodeAt(++position); - } - - if (code === 48) { - // 0 - code = body.charCodeAt(++position); - - if (code >= 48 && code <= 57) { - throw syntaxError(source, position, "Invalid number, unexpected digit after 0: ".concat(printCharCode(code), ".")); - } - } else { - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 46) { - // . - isFloat = true; - code = body.charCodeAt(++position); - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 69 || code === 101) { - // E e - isFloat = true; - code = body.charCodeAt(++position); - - if (code === 43 || code === 45) { - // + - - code = body.charCodeAt(++position); - } - - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } // Numbers cannot be followed by . or NameStart - - - if (code === 46 || isNameStart(code)) { - throw syntaxError(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); - } - - return new Token(isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, line, col, prev, body.slice(start, position)); -} -/** - * Returns the new position in the source after reading digits. - */ - - -function readDigits(source, start, firstCode) { - var body = source.body; - var position = start; - var code = firstCode; - - if (code >= 48 && code <= 57) { - // 0 - 9 - do { - code = body.charCodeAt(++position); - } while (code >= 48 && code <= 57); // 0 - 9 - - - return position; - } - - throw syntaxError(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); -} -/** - * Reads a string token from the source file. - * - * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" - */ - - -function readString(source, start, line, col, prev) { - var body = source.body; - var position = start + 1; - var chunkStart = position; - var code = 0; - var value = ''; - - while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator - code !== 0x000a && code !== 0x000d) { - // Closing Quote (") - if (code === 34) { - value += body.slice(chunkStart, position); - return new Token(TokenKind.STRING, start, position + 1, line, col, prev, value); - } // SourceCharacter - - - if (code < 0x0020 && code !== 0x0009) { - throw syntaxError(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); - } - - ++position; - - if (code === 92) { - // \ - value += body.slice(chunkStart, position - 1); - code = body.charCodeAt(position); - - switch (code) { - case 34: - value += '"'; - break; - - case 47: - value += '/'; - break; - - case 92: - value += '\\'; - break; - - case 98: - value += '\b'; - break; - - case 102: - value += '\f'; - break; - - case 110: - value += '\n'; - break; - - case 114: - value += '\r'; - break; - - case 116: - value += '\t'; - break; - - case 117: - { - // uXXXX - var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); - - if (charCode < 0) { - var invalidSequence = body.slice(position + 1, position + 5); - throw syntaxError(source, position, "Invalid character escape sequence: \\u".concat(invalidSequence, ".")); - } - - value += String.fromCharCode(charCode); - position += 4; - break; - } - - default: - throw syntaxError(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); - } - - ++position; - chunkStart = position; - } - } - - throw syntaxError(source, position, 'Unterminated string.'); -} -/** - * Reads a block string token from the source file. - * - * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" - */ - - -function readBlockString(source, start, line, col, prev, lexer) { - var body = source.body; - var position = start + 3; - var chunkStart = position; - var code = 0; - var rawValue = ''; - - while (position < body.length && !isNaN(code = body.charCodeAt(position))) { - // Closing Triple-Quote (""") - if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { - rawValue += body.slice(chunkStart, position); - return new Token(TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, dedentBlockStringValue(rawValue)); - } // SourceCharacter - - - if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { - throw syntaxError(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); - } - - if (code === 10) { - // new line - ++position; - ++lexer.line; - lexer.lineStart = position; - } else if (code === 13) { - // carriage return - if (body.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - - ++lexer.line; - lexer.lineStart = position; - } else if ( // Escape Triple-Quote (\""") - code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { - rawValue += body.slice(chunkStart, position) + '"""'; - position += 4; - chunkStart = position; - } else { - ++position; - } - } - - throw syntaxError(source, position, 'Unterminated string.'); -} -/** - * Converts four hexadecimal chars to the integer that the - * string represents. For example, uniCharCode('0','0','0','f') - * will return 15, and uniCharCode('0','0','f','f') returns 255. - * - * Returns a negative number on error, if a char was invalid. - * - * This is implemented by noting that char2hex() returns -1 on error, - * which means the result of ORing the char2hex() will also be negative. - */ - - -function uniCharCode(a, b, c, d) { - return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d); -} -/** - * Converts a hex character to its integer value. - * '0' becomes 0, '9' becomes 9 - * 'A' becomes 10, 'F' becomes 15 - * 'a' becomes 10, 'f' becomes 15 - * - * Returns -1 on error. - */ - - -function char2hex(a) { - return a >= 48 && a <= 57 ? a - 48 // 0-9 - : a >= 65 && a <= 70 ? a - 55 // A-F - : a >= 97 && a <= 102 ? a - 87 // a-f - : -1; -} -/** - * Reads an alphanumeric + underscore name from the source. - * - * [_A-Za-z][_0-9A-Za-z]* - */ - - -function readName(source, start, line, col, prev) { - var body = source.body; - var bodyLength = body.length; - var position = start + 1; - var code = 0; - - while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _ - code >= 48 && code <= 57 || // 0-9 - code >= 65 && code <= 90 || // A-Z - code >= 97 && code <= 122) // a-z - ) { - ++position; - } - - return new Token(TokenKind.NAME, start, position, line, col, prev, body.slice(start, position)); -} // _ A-Z a-z - - -function isNameStart(code) { - return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122; -} diff --git a/node_modules/graphql/language/location.d.ts b/node_modules/graphql/language/location.d.ts deleted file mode 100644 index a41e82f4..00000000 --- a/node_modules/graphql/language/location.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Source } from './source'; - -/** - * Represents a location in a Source. - */ -export interface SourceLocation { - readonly line: number; - readonly column: number; -} - -/** - * Takes a Source and a UTF-8 character offset, and returns the corresponding - * line and column as a SourceLocation. - */ -export function getLocation(source: Source, position: number): SourceLocation; diff --git a/node_modules/graphql/language/location.js b/node_modules/graphql/language/location.js deleted file mode 100644 index 27d87c3d..00000000 --- a/node_modules/graphql/language/location.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getLocation = getLocation; - -/** - * Represents a location in a Source. - */ - -/** - * Takes a Source and a UTF-8 character offset, and returns the corresponding - * line and column as a SourceLocation. - */ -function getLocation(source, position) { - var lineRegexp = /\r\n|[\n\r]/g; - var line = 1; - var column = position + 1; - var match; - - while ((match = lineRegexp.exec(source.body)) && match.index < position) { - line += 1; - column = position + 1 - (match.index + match[0].length); - } - - return { - line: line, - column: column - }; -} diff --git a/node_modules/graphql/language/location.js.flow b/node_modules/graphql/language/location.js.flow deleted file mode 100644 index 94b77f17..00000000 --- a/node_modules/graphql/language/location.js.flow +++ /dev/null @@ -1,26 +0,0 @@ -// @flow strict -import type { Source } from './source'; - -/** - * Represents a location in a Source. - */ -export type SourceLocation = {| - +line: number, - +column: number, -|}; - -/** - * Takes a Source and a UTF-8 character offset, and returns the corresponding - * line and column as a SourceLocation. - */ -export function getLocation(source: Source, position: number): SourceLocation { - const lineRegexp = /\r\n|[\n\r]/g; - let line = 1; - let column = position + 1; - let match; - while ((match = lineRegexp.exec(source.body)) && match.index < position) { - line += 1; - column = position + 1 - (match.index + match[0].length); - } - return { line, column }; -} diff --git a/node_modules/graphql/language/location.mjs b/node_modules/graphql/language/location.mjs deleted file mode 100644 index e578ef0b..00000000 --- a/node_modules/graphql/language/location.mjs +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Represents a location in a Source. - */ - -/** - * Takes a Source and a UTF-8 character offset, and returns the corresponding - * line and column as a SourceLocation. - */ -export function getLocation(source, position) { - var lineRegexp = /\r\n|[\n\r]/g; - var line = 1; - var column = position + 1; - var match; - - while ((match = lineRegexp.exec(source.body)) && match.index < position) { - line += 1; - column = position + 1 - (match.index + match[0].length); - } - - return { - line: line, - column: column - }; -} diff --git a/node_modules/graphql/language/parser.d.ts b/node_modules/graphql/language/parser.d.ts deleted file mode 100644 index 368c6f8a..00000000 --- a/node_modules/graphql/language/parser.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Source } from './source'; -import { TypeNode, ValueNode, DocumentNode } from './ast'; - -/** - * Configuration options to control parser behavior - */ -export interface ParseOptions { - /** - * By default, the parser creates AST nodes that know the location - * in the source that they correspond to. This configuration flag - * disables that behavior for performance or testing. - */ - noLocation?: boolean; - - /** - * If enabled, the parser will parse empty fields sets in the Schema - * Definition Language. Otherwise, the parser will follow the current - * specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in v16. - */ - allowLegacySDLEmptyFields?: boolean; - - /** - * If enabled, the parser will parse implemented interfaces with no `&` - * character between each interface. Otherwise, the parser will follow the - * current specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in v16. - */ - allowLegacySDLImplementsInterfaces?: boolean; - - /** - * EXPERIMENTAL: - * - * If enabled, the parser will understand and parse variable definitions - * contained in a fragment definition. They'll be represented in the - * `variableDefinitions` field of the FragmentDefinitionNode. - * - * The syntax is identical to normal, query-defined variables. For example: - * - * fragment A($var: Boolean = false) on T { - * ... - * } - * - * Note: this feature is experimental and may change or be removed in the - * future. - */ - experimentalFragmentVariables?: boolean; -} - -/** - * Given a GraphQL source, parses it into a Document. - * Throws GraphQLError if a syntax error is encountered. - */ -export function parse( - source: string | Source, - options?: ParseOptions, -): DocumentNode; - -/** - * Given a string containing a GraphQL value, parse the AST for that value. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Values directly and - * in isolation of complete GraphQL documents. - */ -export function parseValue( - source: string | Source, - options?: ParseOptions, -): ValueNode; - -/** - * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for - * that type. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Types directly and - * in isolation of complete GraphQL documents. - * - * Consider providing the results to the utility function: typeFromAST(). - */ -export function parseType( - source: string | Source, - options?: ParseOptions, -): TypeNode; diff --git a/node_modules/graphql/language/parser.js b/node_modules/graphql/language/parser.js deleted file mode 100644 index cef9a778..00000000 --- a/node_modules/graphql/language/parser.js +++ /dev/null @@ -1,1566 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parse = parse; -exports.parseValue = parseValue; -exports.parseType = parseType; -exports.Parser = void 0; - -var _syntaxError = require("../error/syntaxError.js"); - -var _kinds = require("./kinds.js"); - -var _ast = require("./ast.js"); - -var _tokenKind = require("./tokenKind.js"); - -var _source = require("./source.js"); - -var _directiveLocation = require("./directiveLocation.js"); - -var _lexer = require("./lexer.js"); - -/** - * Given a GraphQL source, parses it into a Document. - * Throws GraphQLError if a syntax error is encountered. - */ -function parse(source, options) { - var parser = new Parser(source, options); - return parser.parseDocument(); -} -/** - * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for - * that value. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Values directly and - * in isolation of complete GraphQL documents. - * - * Consider providing the results to the utility function: valueFromAST(). - */ - - -function parseValue(source, options) { - var parser = new Parser(source, options); - parser.expectToken(_tokenKind.TokenKind.SOF); - var value = parser.parseValueLiteral(false); - parser.expectToken(_tokenKind.TokenKind.EOF); - return value; -} -/** - * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for - * that type. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Types directly and - * in isolation of complete GraphQL documents. - * - * Consider providing the results to the utility function: typeFromAST(). - */ - - -function parseType(source, options) { - var parser = new Parser(source, options); - parser.expectToken(_tokenKind.TokenKind.SOF); - var type = parser.parseTypeReference(); - parser.expectToken(_tokenKind.TokenKind.EOF); - return type; -} -/** - * This class is exported only to assist people in implementing their own parsers - * without duplicating too much code and should be used only as last resort for cases - * such as experimental syntax or if certain features could not be contributed upstream. - * - * It is still part of the internal API and is versioned, so any changes to it are never - * considered breaking changes. If you still need to support multiple versions of the - * library, please use the `versionInfo` variable for version detection. - * - * @internal - */ - - -var Parser = /*#__PURE__*/function () { - function Parser(source, options) { - var sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source); - this._lexer = new _lexer.Lexer(sourceObj); - this._options = options; - } - /** - * Converts a name lex token into a name parse node. - */ - - - var _proto = Parser.prototype; - - _proto.parseName = function parseName() { - var token = this.expectToken(_tokenKind.TokenKind.NAME); - return { - kind: _kinds.Kind.NAME, - value: token.value, - loc: this.loc(token) - }; - } // Implements the parsing rules in the Document section. - - /** - * Document : Definition+ - */ - ; - - _proto.parseDocument = function parseDocument() { - var start = this._lexer.token; - return { - kind: _kinds.Kind.DOCUMENT, - definitions: this.many(_tokenKind.TokenKind.SOF, this.parseDefinition, _tokenKind.TokenKind.EOF), - loc: this.loc(start) - }; - } - /** - * Definition : - * - ExecutableDefinition - * - TypeSystemDefinition - * - TypeSystemExtension - * - * ExecutableDefinition : - * - OperationDefinition - * - FragmentDefinition - */ - ; - - _proto.parseDefinition = function parseDefinition() { - if (this.peek(_tokenKind.TokenKind.NAME)) { - switch (this._lexer.token.value) { - case 'query': - case 'mutation': - case 'subscription': - return this.parseOperationDefinition(); - - case 'fragment': - return this.parseFragmentDefinition(); - - case 'schema': - case 'scalar': - case 'type': - case 'interface': - case 'union': - case 'enum': - case 'input': - case 'directive': - return this.parseTypeSystemDefinition(); - - case 'extend': - return this.parseTypeSystemExtension(); - } - } else if (this.peek(_tokenKind.TokenKind.BRACE_L)) { - return this.parseOperationDefinition(); - } else if (this.peekDescription()) { - return this.parseTypeSystemDefinition(); - } - - throw this.unexpected(); - } // Implements the parsing rules in the Operations section. - - /** - * OperationDefinition : - * - SelectionSet - * - OperationType Name? VariableDefinitions? Directives? SelectionSet - */ - ; - - _proto.parseOperationDefinition = function parseOperationDefinition() { - var start = this._lexer.token; - - if (this.peek(_tokenKind.TokenKind.BRACE_L)) { - return { - kind: _kinds.Kind.OPERATION_DEFINITION, - operation: 'query', - name: undefined, - variableDefinitions: [], - directives: [], - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - - var operation = this.parseOperationType(); - var name; - - if (this.peek(_tokenKind.TokenKind.NAME)) { - name = this.parseName(); - } - - return { - kind: _kinds.Kind.OPERATION_DEFINITION, - operation: operation, - name: name, - variableDefinitions: this.parseVariableDefinitions(), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - /** - * OperationType : one of query mutation subscription - */ - ; - - _proto.parseOperationType = function parseOperationType() { - var operationToken = this.expectToken(_tokenKind.TokenKind.NAME); - - switch (operationToken.value) { - case 'query': - return 'query'; - - case 'mutation': - return 'mutation'; - - case 'subscription': - return 'subscription'; - } - - throw this.unexpected(operationToken); - } - /** - * VariableDefinitions : ( VariableDefinition+ ) - */ - ; - - _proto.parseVariableDefinitions = function parseVariableDefinitions() { - return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseVariableDefinition, _tokenKind.TokenKind.PAREN_R); - } - /** - * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? - */ - ; - - _proto.parseVariableDefinition = function parseVariableDefinition() { - var start = this._lexer.token; - return { - kind: _kinds.Kind.VARIABLE_DEFINITION, - variable: this.parseVariable(), - type: (this.expectToken(_tokenKind.TokenKind.COLON), this.parseTypeReference()), - defaultValue: this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined, - directives: this.parseDirectives(true), - loc: this.loc(start) - }; - } - /** - * Variable : $ Name - */ - ; - - _proto.parseVariable = function parseVariable() { - var start = this._lexer.token; - this.expectToken(_tokenKind.TokenKind.DOLLAR); - return { - kind: _kinds.Kind.VARIABLE, - name: this.parseName(), - loc: this.loc(start) - }; - } - /** - * SelectionSet : { Selection+ } - */ - ; - - _proto.parseSelectionSet = function parseSelectionSet() { - var start = this._lexer.token; - return { - kind: _kinds.Kind.SELECTION_SET, - selections: this.many(_tokenKind.TokenKind.BRACE_L, this.parseSelection, _tokenKind.TokenKind.BRACE_R), - loc: this.loc(start) - }; - } - /** - * Selection : - * - Field - * - FragmentSpread - * - InlineFragment - */ - ; - - _proto.parseSelection = function parseSelection() { - return this.peek(_tokenKind.TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); - } - /** - * Field : Alias? Name Arguments? Directives? SelectionSet? - * - * Alias : Name : - */ - ; - - _proto.parseField = function parseField() { - var start = this._lexer.token; - var nameOrAlias = this.parseName(); - var alias; - var name; - - if (this.expectOptionalToken(_tokenKind.TokenKind.COLON)) { - alias = nameOrAlias; - name = this.parseName(); - } else { - name = nameOrAlias; - } - - return { - kind: _kinds.Kind.FIELD, - alias: alias, - name: name, - arguments: this.parseArguments(false), - directives: this.parseDirectives(false), - selectionSet: this.peek(_tokenKind.TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined, - loc: this.loc(start) - }; - } - /** - * Arguments[Const] : ( Argument[?Const]+ ) - */ - ; - - _proto.parseArguments = function parseArguments(isConst) { - var item = isConst ? this.parseConstArgument : this.parseArgument; - return this.optionalMany(_tokenKind.TokenKind.PAREN_L, item, _tokenKind.TokenKind.PAREN_R); - } - /** - * Argument[Const] : Name : Value[?Const] - */ - ; - - _proto.parseArgument = function parseArgument() { - var start = this._lexer.token; - var name = this.parseName(); - this.expectToken(_tokenKind.TokenKind.COLON); - return { - kind: _kinds.Kind.ARGUMENT, - name: name, - value: this.parseValueLiteral(false), - loc: this.loc(start) - }; - }; - - _proto.parseConstArgument = function parseConstArgument() { - var start = this._lexer.token; - return { - kind: _kinds.Kind.ARGUMENT, - name: this.parseName(), - value: (this.expectToken(_tokenKind.TokenKind.COLON), this.parseValueLiteral(true)), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Fragments section. - - /** - * Corresponds to both FragmentSpread and InlineFragment in the spec. - * - * FragmentSpread : ... FragmentName Directives? - * - * InlineFragment : ... TypeCondition? Directives? SelectionSet - */ - ; - - _proto.parseFragment = function parseFragment() { - var start = this._lexer.token; - this.expectToken(_tokenKind.TokenKind.SPREAD); - var hasTypeCondition = this.expectOptionalKeyword('on'); - - if (!hasTypeCondition && this.peek(_tokenKind.TokenKind.NAME)) { - return { - kind: _kinds.Kind.FRAGMENT_SPREAD, - name: this.parseFragmentName(), - directives: this.parseDirectives(false), - loc: this.loc(start) - }; - } - - return { - kind: _kinds.Kind.INLINE_FRAGMENT, - typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - /** - * FragmentDefinition : - * - fragment FragmentName on TypeCondition Directives? SelectionSet - * - * TypeCondition : NamedType - */ - ; - - _proto.parseFragmentDefinition = function parseFragmentDefinition() { - var _this$_options; - - var start = this._lexer.token; - this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes - // the grammar of FragmentDefinition: - // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet - - if (((_this$_options = this._options) === null || _this$_options === void 0 ? void 0 : _this$_options.experimentalFragmentVariables) === true) { - return { - kind: _kinds.Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - variableDefinitions: this.parseVariableDefinitions(), - typeCondition: (this.expectKeyword('on'), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - - return { - kind: _kinds.Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - typeCondition: (this.expectKeyword('on'), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - /** - * FragmentName : Name but not `on` - */ - ; - - _proto.parseFragmentName = function parseFragmentName() { - if (this._lexer.token.value === 'on') { - throw this.unexpected(); - } - - return this.parseName(); - } // Implements the parsing rules in the Values section. - - /** - * Value[Const] : - * - [~Const] Variable - * - IntValue - * - FloatValue - * - StringValue - * - BooleanValue - * - NullValue - * - EnumValue - * - ListValue[?Const] - * - ObjectValue[?Const] - * - * BooleanValue : one of `true` `false` - * - * NullValue : `null` - * - * EnumValue : Name but not `true`, `false` or `null` - */ - ; - - _proto.parseValueLiteral = function parseValueLiteral(isConst) { - var token = this._lexer.token; - - switch (token.kind) { - case _tokenKind.TokenKind.BRACKET_L: - return this.parseList(isConst); - - case _tokenKind.TokenKind.BRACE_L: - return this.parseObject(isConst); - - case _tokenKind.TokenKind.INT: - this._lexer.advance(); - - return { - kind: _kinds.Kind.INT, - value: token.value, - loc: this.loc(token) - }; - - case _tokenKind.TokenKind.FLOAT: - this._lexer.advance(); - - return { - kind: _kinds.Kind.FLOAT, - value: token.value, - loc: this.loc(token) - }; - - case _tokenKind.TokenKind.STRING: - case _tokenKind.TokenKind.BLOCK_STRING: - return this.parseStringLiteral(); - - case _tokenKind.TokenKind.NAME: - this._lexer.advance(); - - switch (token.value) { - case 'true': - return { - kind: _kinds.Kind.BOOLEAN, - value: true, - loc: this.loc(token) - }; - - case 'false': - return { - kind: _kinds.Kind.BOOLEAN, - value: false, - loc: this.loc(token) - }; - - case 'null': - return { - kind: _kinds.Kind.NULL, - loc: this.loc(token) - }; - - default: - return { - kind: _kinds.Kind.ENUM, - value: token.value, - loc: this.loc(token) - }; - } - - case _tokenKind.TokenKind.DOLLAR: - if (!isConst) { - return this.parseVariable(); - } - - break; - } - - throw this.unexpected(); - }; - - _proto.parseStringLiteral = function parseStringLiteral() { - var token = this._lexer.token; - - this._lexer.advance(); - - return { - kind: _kinds.Kind.STRING, - value: token.value, - block: token.kind === _tokenKind.TokenKind.BLOCK_STRING, - loc: this.loc(token) - }; - } - /** - * ListValue[Const] : - * - [ ] - * - [ Value[?Const]+ ] - */ - ; - - _proto.parseList = function parseList(isConst) { - var _this = this; - - var start = this._lexer.token; - - var item = function item() { - return _this.parseValueLiteral(isConst); - }; - - return { - kind: _kinds.Kind.LIST, - values: this.any(_tokenKind.TokenKind.BRACKET_L, item, _tokenKind.TokenKind.BRACKET_R), - loc: this.loc(start) - }; - } - /** - * ObjectValue[Const] : - * - { } - * - { ObjectField[?Const]+ } - */ - ; - - _proto.parseObject = function parseObject(isConst) { - var _this2 = this; - - var start = this._lexer.token; - - var item = function item() { - return _this2.parseObjectField(isConst); - }; - - return { - kind: _kinds.Kind.OBJECT, - fields: this.any(_tokenKind.TokenKind.BRACE_L, item, _tokenKind.TokenKind.BRACE_R), - loc: this.loc(start) - }; - } - /** - * ObjectField[Const] : Name : Value[?Const] - */ - ; - - _proto.parseObjectField = function parseObjectField(isConst) { - var start = this._lexer.token; - var name = this.parseName(); - this.expectToken(_tokenKind.TokenKind.COLON); - return { - kind: _kinds.Kind.OBJECT_FIELD, - name: name, - value: this.parseValueLiteral(isConst), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Directives section. - - /** - * Directives[Const] : Directive[?Const]+ - */ - ; - - _proto.parseDirectives = function parseDirectives(isConst) { - var directives = []; - - while (this.peek(_tokenKind.TokenKind.AT)) { - directives.push(this.parseDirective(isConst)); - } - - return directives; - } - /** - * Directive[Const] : @ Name Arguments[?Const]? - */ - ; - - _proto.parseDirective = function parseDirective(isConst) { - var start = this._lexer.token; - this.expectToken(_tokenKind.TokenKind.AT); - return { - kind: _kinds.Kind.DIRECTIVE, - name: this.parseName(), - arguments: this.parseArguments(isConst), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Types section. - - /** - * Type : - * - NamedType - * - ListType - * - NonNullType - */ - ; - - _proto.parseTypeReference = function parseTypeReference() { - var start = this._lexer.token; - var type; - - if (this.expectOptionalToken(_tokenKind.TokenKind.BRACKET_L)) { - type = this.parseTypeReference(); - this.expectToken(_tokenKind.TokenKind.BRACKET_R); - type = { - kind: _kinds.Kind.LIST_TYPE, - type: type, - loc: this.loc(start) - }; - } else { - type = this.parseNamedType(); - } - - if (this.expectOptionalToken(_tokenKind.TokenKind.BANG)) { - return { - kind: _kinds.Kind.NON_NULL_TYPE, - type: type, - loc: this.loc(start) - }; - } - - return type; - } - /** - * NamedType : Name - */ - ; - - _proto.parseNamedType = function parseNamedType() { - var start = this._lexer.token; - return { - kind: _kinds.Kind.NAMED_TYPE, - name: this.parseName(), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Type Definition section. - - /** - * TypeSystemDefinition : - * - SchemaDefinition - * - TypeDefinition - * - DirectiveDefinition - * - * TypeDefinition : - * - ScalarTypeDefinition - * - ObjectTypeDefinition - * - InterfaceTypeDefinition - * - UnionTypeDefinition - * - EnumTypeDefinition - * - InputObjectTypeDefinition - */ - ; - - _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() { - // Many definitions begin with a description and require a lookahead. - var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token; - - if (keywordToken.kind === _tokenKind.TokenKind.NAME) { - switch (keywordToken.value) { - case 'schema': - return this.parseSchemaDefinition(); - - case 'scalar': - return this.parseScalarTypeDefinition(); - - case 'type': - return this.parseObjectTypeDefinition(); - - case 'interface': - return this.parseInterfaceTypeDefinition(); - - case 'union': - return this.parseUnionTypeDefinition(); - - case 'enum': - return this.parseEnumTypeDefinition(); - - case 'input': - return this.parseInputObjectTypeDefinition(); - - case 'directive': - return this.parseDirectiveDefinition(); - } - } - - throw this.unexpected(keywordToken); - }; - - _proto.peekDescription = function peekDescription() { - return this.peek(_tokenKind.TokenKind.STRING) || this.peek(_tokenKind.TokenKind.BLOCK_STRING); - } - /** - * Description : StringValue - */ - ; - - _proto.parseDescription = function parseDescription() { - if (this.peekDescription()) { - return this.parseStringLiteral(); - } - } - /** - * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } - */ - ; - - _proto.parseSchemaDefinition = function parseSchemaDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('schema'); - var directives = this.parseDirectives(true); - var operationTypes = this.many(_tokenKind.TokenKind.BRACE_L, this.parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R); - return { - kind: _kinds.Kind.SCHEMA_DEFINITION, - description: description, - directives: directives, - operationTypes: operationTypes, - loc: this.loc(start) - }; - } - /** - * OperationTypeDefinition : OperationType : NamedType - */ - ; - - _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() { - var start = this._lexer.token; - var operation = this.parseOperationType(); - this.expectToken(_tokenKind.TokenKind.COLON); - var type = this.parseNamedType(); - return { - kind: _kinds.Kind.OPERATION_TYPE_DEFINITION, - operation: operation, - type: type, - loc: this.loc(start) - }; - } - /** - * ScalarTypeDefinition : Description? scalar Name Directives[Const]? - */ - ; - - _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('scalar'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - return { - kind: _kinds.Kind.SCALAR_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - loc: this.loc(start) - }; - } - /** - * ObjectTypeDefinition : - * Description? - * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? - */ - ; - - _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('type'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - return { - kind: _kinds.Kind.OBJECT_TYPE_DEFINITION, - description: description, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * ImplementsInterfaces : - * - implements `&`? NamedType - * - ImplementsInterfaces & NamedType - */ - ; - - _proto.parseImplementsInterfaces = function parseImplementsInterfaces() { - var _this$_options2; - - if (!this.expectOptionalKeyword('implements')) { - return []; - } - - if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) { - var types = []; // Optional leading ampersand - - this.expectOptionalToken(_tokenKind.TokenKind.AMP); - - do { - types.push(this.parseNamedType()); - } while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME)); - - return types; - } - - return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType); - } - /** - * FieldsDefinition : { FieldDefinition+ } - */ - ; - - _proto.parseFieldsDefinition = function parseFieldsDefinition() { - var _this$_options3; - - // Legacy support for the SDL? - if (((_this$_options3 = this._options) === null || _this$_options3 === void 0 ? void 0 : _this$_options3.allowLegacySDLEmptyFields) === true && this.peek(_tokenKind.TokenKind.BRACE_L) && this._lexer.lookahead().kind === _tokenKind.TokenKind.BRACE_R) { - this._lexer.advance(); - - this._lexer.advance(); - - return []; - } - - return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseFieldDefinition, _tokenKind.TokenKind.BRACE_R); - } - /** - * FieldDefinition : - * - Description? Name ArgumentsDefinition? : Type Directives[Const]? - */ - ; - - _proto.parseFieldDefinition = function parseFieldDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - var name = this.parseName(); - var args = this.parseArgumentDefs(); - this.expectToken(_tokenKind.TokenKind.COLON); - var type = this.parseTypeReference(); - var directives = this.parseDirectives(true); - return { - kind: _kinds.Kind.FIELD_DEFINITION, - description: description, - name: name, - arguments: args, - type: type, - directives: directives, - loc: this.loc(start) - }; - } - /** - * ArgumentsDefinition : ( InputValueDefinition+ ) - */ - ; - - _proto.parseArgumentDefs = function parseArgumentDefs() { - return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseInputValueDef, _tokenKind.TokenKind.PAREN_R); - } - /** - * InputValueDefinition : - * - Description? Name : Type DefaultValue? Directives[Const]? - */ - ; - - _proto.parseInputValueDef = function parseInputValueDef() { - var start = this._lexer.token; - var description = this.parseDescription(); - var name = this.parseName(); - this.expectToken(_tokenKind.TokenKind.COLON); - var type = this.parseTypeReference(); - var defaultValue; - - if (this.expectOptionalToken(_tokenKind.TokenKind.EQUALS)) { - defaultValue = this.parseValueLiteral(true); - } - - var directives = this.parseDirectives(true); - return { - kind: _kinds.Kind.INPUT_VALUE_DEFINITION, - description: description, - name: name, - type: type, - defaultValue: defaultValue, - directives: directives, - loc: this.loc(start) - }; - } - /** - * InterfaceTypeDefinition : - * - Description? interface Name Directives[Const]? FieldsDefinition? - */ - ; - - _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('interface'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - return { - kind: _kinds.Kind.INTERFACE_TYPE_DEFINITION, - description: description, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * UnionTypeDefinition : - * - Description? union Name Directives[Const]? UnionMemberTypes? - */ - ; - - _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('union'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var types = this.parseUnionMemberTypes(); - return { - kind: _kinds.Kind.UNION_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - types: types, - loc: this.loc(start) - }; - } - /** - * UnionMemberTypes : - * - = `|`? NamedType - * - UnionMemberTypes | NamedType - */ - ; - - _proto.parseUnionMemberTypes = function parseUnionMemberTypes() { - return this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) ? this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseNamedType) : []; - } - /** - * EnumTypeDefinition : - * - Description? enum Name Directives[Const]? EnumValuesDefinition? - */ - ; - - _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('enum'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var values = this.parseEnumValuesDefinition(); - return { - kind: _kinds.Kind.ENUM_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - values: values, - loc: this.loc(start) - }; - } - /** - * EnumValuesDefinition : { EnumValueDefinition+ } - */ - ; - - _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() { - return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseEnumValueDefinition, _tokenKind.TokenKind.BRACE_R); - } - /** - * EnumValueDefinition : Description? EnumValue Directives[Const]? - * - * EnumValue : Name - */ - ; - - _proto.parseEnumValueDefinition = function parseEnumValueDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - var name = this.parseName(); - var directives = this.parseDirectives(true); - return { - kind: _kinds.Kind.ENUM_VALUE_DEFINITION, - description: description, - name: name, - directives: directives, - loc: this.loc(start) - }; - } - /** - * InputObjectTypeDefinition : - * - Description? input Name Directives[Const]? InputFieldsDefinition? - */ - ; - - _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('input'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var fields = this.parseInputFieldsDefinition(); - return { - kind: _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * InputFieldsDefinition : { InputValueDefinition+ } - */ - ; - - _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() { - return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseInputValueDef, _tokenKind.TokenKind.BRACE_R); - } - /** - * TypeSystemExtension : - * - SchemaExtension - * - TypeExtension - * - * TypeExtension : - * - ScalarTypeExtension - * - ObjectTypeExtension - * - InterfaceTypeExtension - * - UnionTypeExtension - * - EnumTypeExtension - * - InputObjectTypeDefinition - */ - ; - - _proto.parseTypeSystemExtension = function parseTypeSystemExtension() { - var keywordToken = this._lexer.lookahead(); - - if (keywordToken.kind === _tokenKind.TokenKind.NAME) { - switch (keywordToken.value) { - case 'schema': - return this.parseSchemaExtension(); - - case 'scalar': - return this.parseScalarTypeExtension(); - - case 'type': - return this.parseObjectTypeExtension(); - - case 'interface': - return this.parseInterfaceTypeExtension(); - - case 'union': - return this.parseUnionTypeExtension(); - - case 'enum': - return this.parseEnumTypeExtension(); - - case 'input': - return this.parseInputObjectTypeExtension(); - } - } - - throw this.unexpected(keywordToken); - } - /** - * SchemaExtension : - * - extend schema Directives[Const]? { OperationTypeDefinition+ } - * - extend schema Directives[Const] - */ - ; - - _proto.parseSchemaExtension = function parseSchemaExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('schema'); - var directives = this.parseDirectives(true); - var operationTypes = this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R); - - if (directives.length === 0 && operationTypes.length === 0) { - throw this.unexpected(); - } - - return { - kind: _kinds.Kind.SCHEMA_EXTENSION, - directives: directives, - operationTypes: operationTypes, - loc: this.loc(start) - }; - } - /** - * ScalarTypeExtension : - * - extend scalar Name Directives[Const] - */ - ; - - _proto.parseScalarTypeExtension = function parseScalarTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('scalar'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - - if (directives.length === 0) { - throw this.unexpected(); - } - - return { - kind: _kinds.Kind.SCALAR_TYPE_EXTENSION, - name: name, - directives: directives, - loc: this.loc(start) - }; - } - /** - * ObjectTypeExtension : - * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend type Name ImplementsInterfaces? Directives[Const] - * - extend type Name ImplementsInterfaces - */ - ; - - _proto.parseObjectTypeExtension = function parseObjectTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('type'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - - return { - kind: _kinds.Kind.OBJECT_TYPE_EXTENSION, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * InterfaceTypeExtension : - * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend interface Name ImplementsInterfaces? Directives[Const] - * - extend interface Name ImplementsInterfaces - */ - ; - - _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('interface'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - - return { - kind: _kinds.Kind.INTERFACE_TYPE_EXTENSION, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * UnionTypeExtension : - * - extend union Name Directives[Const]? UnionMemberTypes - * - extend union Name Directives[Const] - */ - ; - - _proto.parseUnionTypeExtension = function parseUnionTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('union'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var types = this.parseUnionMemberTypes(); - - if (directives.length === 0 && types.length === 0) { - throw this.unexpected(); - } - - return { - kind: _kinds.Kind.UNION_TYPE_EXTENSION, - name: name, - directives: directives, - types: types, - loc: this.loc(start) - }; - } - /** - * EnumTypeExtension : - * - extend enum Name Directives[Const]? EnumValuesDefinition - * - extend enum Name Directives[Const] - */ - ; - - _proto.parseEnumTypeExtension = function parseEnumTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('enum'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var values = this.parseEnumValuesDefinition(); - - if (directives.length === 0 && values.length === 0) { - throw this.unexpected(); - } - - return { - kind: _kinds.Kind.ENUM_TYPE_EXTENSION, - name: name, - directives: directives, - values: values, - loc: this.loc(start) - }; - } - /** - * InputObjectTypeExtension : - * - extend input Name Directives[Const]? InputFieldsDefinition - * - extend input Name Directives[Const] - */ - ; - - _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('input'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var fields = this.parseInputFieldsDefinition(); - - if (directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - - return { - kind: _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, - name: name, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * DirectiveDefinition : - * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations - */ - ; - - _proto.parseDirectiveDefinition = function parseDirectiveDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('directive'); - this.expectToken(_tokenKind.TokenKind.AT); - var name = this.parseName(); - var args = this.parseArgumentDefs(); - var repeatable = this.expectOptionalKeyword('repeatable'); - this.expectKeyword('on'); - var locations = this.parseDirectiveLocations(); - return { - kind: _kinds.Kind.DIRECTIVE_DEFINITION, - description: description, - name: name, - arguments: args, - repeatable: repeatable, - locations: locations, - loc: this.loc(start) - }; - } - /** - * DirectiveLocations : - * - `|`? DirectiveLocation - * - DirectiveLocations | DirectiveLocation - */ - ; - - _proto.parseDirectiveLocations = function parseDirectiveLocations() { - return this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseDirectiveLocation); - } - /* - * DirectiveLocation : - * - ExecutableDirectiveLocation - * - TypeSystemDirectiveLocation - * - * ExecutableDirectiveLocation : one of - * `QUERY` - * `MUTATION` - * `SUBSCRIPTION` - * `FIELD` - * `FRAGMENT_DEFINITION` - * `FRAGMENT_SPREAD` - * `INLINE_FRAGMENT` - * - * TypeSystemDirectiveLocation : one of - * `SCHEMA` - * `SCALAR` - * `OBJECT` - * `FIELD_DEFINITION` - * `ARGUMENT_DEFINITION` - * `INTERFACE` - * `UNION` - * `ENUM` - * `ENUM_VALUE` - * `INPUT_OBJECT` - * `INPUT_FIELD_DEFINITION` - */ - ; - - _proto.parseDirectiveLocation = function parseDirectiveLocation() { - var start = this._lexer.token; - var name = this.parseName(); - - if (_directiveLocation.DirectiveLocation[name.value] !== undefined) { - return name; - } - - throw this.unexpected(start); - } // Core parsing utility functions - - /** - * Returns a location object, used to identify the place in the source that created a given parsed object. - */ - ; - - _proto.loc = function loc(startToken) { - var _this$_options4; - - if (((_this$_options4 = this._options) === null || _this$_options4 === void 0 ? void 0 : _this$_options4.noLocation) !== true) { - return new _ast.Location(startToken, this._lexer.lastToken, this._lexer.source); - } - } - /** - * Determines if the next token is of a given kind - */ - ; - - _proto.peek = function peek(kind) { - return this._lexer.token.kind === kind; - } - /** - * If the next token is of the given kind, return that token after advancing the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - ; - - _proto.expectToken = function expectToken(kind) { - var token = this._lexer.token; - - if (token.kind === kind) { - this._lexer.advance(); - - return token; - } - - throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Expected ".concat(getTokenKindDesc(kind), ", found ").concat(getTokenDesc(token), ".")); - } - /** - * If the next token is of the given kind, return that token after advancing the lexer. - * Otherwise, do not change the parser state and return undefined. - */ - ; - - _proto.expectOptionalToken = function expectOptionalToken(kind) { - var token = this._lexer.token; - - if (token.kind === kind) { - this._lexer.advance(); - - return token; - } - - return undefined; - } - /** - * If the next token is a given keyword, advance the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - ; - - _proto.expectKeyword = function expectKeyword(value) { - var token = this._lexer.token; - - if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { - this._lexer.advance(); - } else { - throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Expected \"".concat(value, "\", found ").concat(getTokenDesc(token), ".")); - } - } - /** - * If the next token is a given keyword, return "true" after advancing the lexer. - * Otherwise, do not change the parser state and return "false". - */ - ; - - _proto.expectOptionalKeyword = function expectOptionalKeyword(value) { - var token = this._lexer.token; - - if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { - this._lexer.advance(); - - return true; - } - - return false; - } - /** - * Helper function for creating an error when an unexpected lexed token is encountered. - */ - ; - - _proto.unexpected = function unexpected(atToken) { - var token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; - return (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Unexpected ".concat(getTokenDesc(token), ".")); - } - /** - * Returns a possibly empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - ; - - _proto.any = function any(openKind, parseFn, closeKind) { - this.expectToken(openKind); - var nodes = []; - - while (!this.expectOptionalToken(closeKind)) { - nodes.push(parseFn.call(this)); - } - - return nodes; - } - /** - * Returns a list of parse nodes, determined by the parseFn. - * It can be empty only if open token is missing otherwise it will always return non-empty list - * that begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - ; - - _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) { - if (this.expectOptionalToken(openKind)) { - var nodes = []; - - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - - return nodes; - } - - return []; - } - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - ; - - _proto.many = function many(openKind, parseFn, closeKind) { - this.expectToken(openKind); - var nodes = []; - - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - - return nodes; - } - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. - * Advances the parser to the next lex token after last item in the list. - */ - ; - - _proto.delimitedMany = function delimitedMany(delimiterKind, parseFn) { - this.expectOptionalToken(delimiterKind); - var nodes = []; - - do { - nodes.push(parseFn.call(this)); - } while (this.expectOptionalToken(delimiterKind)); - - return nodes; - }; - - return Parser; -}(); -/** - * A helper function to describe a token as a string for debugging. - */ - - -exports.Parser = Parser; - -function getTokenDesc(token) { - var value = token.value; - return getTokenKindDesc(token.kind) + (value != null ? " \"".concat(value, "\"") : ''); -} -/** - * A helper function to describe a token kind as a string for debugging. - */ - - -function getTokenKindDesc(kind) { - return (0, _lexer.isPunctuatorTokenKind)(kind) ? "\"".concat(kind, "\"") : kind; -} diff --git a/node_modules/graphql/language/parser.js.flow b/node_modules/graphql/language/parser.js.flow deleted file mode 100644 index ee8bd3ea..00000000 --- a/node_modules/graphql/language/parser.js.flow +++ /dev/null @@ -1,1568 +0,0 @@ -// @flow strict -import type { GraphQLError } from '../error/GraphQLError'; -import { syntaxError } from '../error/syntaxError'; - -import type { TokenKindEnum } from './tokenKind'; -import type { - Token, - NameNode, - VariableNode, - DocumentNode, - DefinitionNode, - OperationDefinitionNode, - OperationTypeNode, - VariableDefinitionNode, - SelectionSetNode, - SelectionNode, - FieldNode, - ArgumentNode, - FragmentSpreadNode, - InlineFragmentNode, - FragmentDefinitionNode, - ValueNode, - StringValueNode, - ListValueNode, - ObjectValueNode, - ObjectFieldNode, - DirectiveNode, - TypeNode, - NamedTypeNode, - TypeSystemDefinitionNode, - SchemaDefinitionNode, - OperationTypeDefinitionNode, - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - DirectiveDefinitionNode, - TypeSystemExtensionNode, - SchemaExtensionNode, - ScalarTypeExtensionNode, - ObjectTypeExtensionNode, - InterfaceTypeExtensionNode, - UnionTypeExtensionNode, - EnumTypeExtensionNode, - InputObjectTypeExtensionNode, -} from './ast'; -import { Kind } from './kinds'; -import { Location } from './ast'; -import { TokenKind } from './tokenKind'; -import { Source, isSource } from './source'; -import { DirectiveLocation } from './directiveLocation'; -import { Lexer, isPunctuatorTokenKind } from './lexer'; - -/** - * Configuration options to control parser behavior - */ -export type ParseOptions = {| - /** - * By default, the parser creates AST nodes that know the location - * in the source that they correspond to. This configuration flag - * disables that behavior for performance or testing. - */ - noLocation?: boolean, - - /** - * If enabled, the parser will parse empty fields sets in the Schema - * Definition Language. Otherwise, the parser will follow the current - * specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in v16. - */ - allowLegacySDLEmptyFields?: boolean, - - /** - * If enabled, the parser will parse implemented interfaces with no `&` - * character between each interface. Otherwise, the parser will follow the - * current specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in v16. - */ - allowLegacySDLImplementsInterfaces?: boolean, - - /** - * EXPERIMENTAL: - * - * If enabled, the parser will understand and parse variable definitions - * contained in a fragment definition. They'll be represented in the - * `variableDefinitions` field of the FragmentDefinitionNode. - * - * The syntax is identical to normal, query-defined variables. For example: - * - * fragment A($var: Boolean = false) on T { - * ... - * } - * - * Note: this feature is experimental and may change or be removed in the - * future. - */ - experimentalFragmentVariables?: boolean, -|}; - -/** - * Given a GraphQL source, parses it into a Document. - * Throws GraphQLError if a syntax error is encountered. - */ -export function parse( - source: string | Source, - options?: ParseOptions, -): DocumentNode { - const parser = new Parser(source, options); - return parser.parseDocument(); -} - -/** - * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for - * that value. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Values directly and - * in isolation of complete GraphQL documents. - * - * Consider providing the results to the utility function: valueFromAST(). - */ -export function parseValue( - source: string | Source, - options?: ParseOptions, -): ValueNode { - const parser = new Parser(source, options); - parser.expectToken(TokenKind.SOF); - const value = parser.parseValueLiteral(false); - parser.expectToken(TokenKind.EOF); - return value; -} - -/** - * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for - * that type. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Types directly and - * in isolation of complete GraphQL documents. - * - * Consider providing the results to the utility function: typeFromAST(). - */ -export function parseType( - source: string | Source, - options?: ParseOptions, -): TypeNode { - const parser = new Parser(source, options); - parser.expectToken(TokenKind.SOF); - const type = parser.parseTypeReference(); - parser.expectToken(TokenKind.EOF); - return type; -} - -/** - * This class is exported only to assist people in implementing their own parsers - * without duplicating too much code and should be used only as last resort for cases - * such as experimental syntax or if certain features could not be contributed upstream. - * - * It is still part of the internal API and is versioned, so any changes to it are never - * considered breaking changes. If you still need to support multiple versions of the - * library, please use the `versionInfo` variable for version detection. - * - * @internal - */ -export class Parser { - _options: ?ParseOptions; - _lexer: Lexer; - - constructor(source: string | Source, options?: ParseOptions) { - const sourceObj = isSource(source) ? source : new Source(source); - - this._lexer = new Lexer(sourceObj); - this._options = options; - } - - /** - * Converts a name lex token into a name parse node. - */ - parseName(): NameNode { - const token = this.expectToken(TokenKind.NAME); - return { - kind: Kind.NAME, - value: ((token.value: any): string), - loc: this.loc(token), - }; - } - - // Implements the parsing rules in the Document section. - - /** - * Document : Definition+ - */ - parseDocument(): DocumentNode { - const start = this._lexer.token; - return { - kind: Kind.DOCUMENT, - definitions: this.many( - TokenKind.SOF, - this.parseDefinition, - TokenKind.EOF, - ), - loc: this.loc(start), - }; - } - - /** - * Definition : - * - ExecutableDefinition - * - TypeSystemDefinition - * - TypeSystemExtension - * - * ExecutableDefinition : - * - OperationDefinition - * - FragmentDefinition - */ - parseDefinition(): DefinitionNode { - if (this.peek(TokenKind.NAME)) { - switch (this._lexer.token.value) { - case 'query': - case 'mutation': - case 'subscription': - return this.parseOperationDefinition(); - case 'fragment': - return this.parseFragmentDefinition(); - case 'schema': - case 'scalar': - case 'type': - case 'interface': - case 'union': - case 'enum': - case 'input': - case 'directive': - return this.parseTypeSystemDefinition(); - case 'extend': - return this.parseTypeSystemExtension(); - } - } else if (this.peek(TokenKind.BRACE_L)) { - return this.parseOperationDefinition(); - } else if (this.peekDescription()) { - return this.parseTypeSystemDefinition(); - } - - throw this.unexpected(); - } - - // Implements the parsing rules in the Operations section. - - /** - * OperationDefinition : - * - SelectionSet - * - OperationType Name? VariableDefinitions? Directives? SelectionSet - */ - parseOperationDefinition(): OperationDefinitionNode { - const start = this._lexer.token; - if (this.peek(TokenKind.BRACE_L)) { - return { - kind: Kind.OPERATION_DEFINITION, - operation: 'query', - name: undefined, - variableDefinitions: [], - directives: [], - selectionSet: this.parseSelectionSet(), - loc: this.loc(start), - }; - } - const operation = this.parseOperationType(); - let name; - if (this.peek(TokenKind.NAME)) { - name = this.parseName(); - } - return { - kind: Kind.OPERATION_DEFINITION, - operation, - name, - variableDefinitions: this.parseVariableDefinitions(), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start), - }; - } - - /** - * OperationType : one of query mutation subscription - */ - parseOperationType(): OperationTypeNode { - const operationToken = this.expectToken(TokenKind.NAME); - switch (operationToken.value) { - case 'query': - return 'query'; - case 'mutation': - return 'mutation'; - case 'subscription': - return 'subscription'; - } - - throw this.unexpected(operationToken); - } - - /** - * VariableDefinitions : ( VariableDefinition+ ) - */ - parseVariableDefinitions(): Array { - return this.optionalMany( - TokenKind.PAREN_L, - this.parseVariableDefinition, - TokenKind.PAREN_R, - ); - } - - /** - * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? - */ - parseVariableDefinition(): VariableDefinitionNode { - const start = this._lexer.token; - return { - kind: Kind.VARIABLE_DEFINITION, - variable: this.parseVariable(), - type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), - defaultValue: this.expectOptionalToken(TokenKind.EQUALS) - ? this.parseValueLiteral(true) - : undefined, - directives: this.parseDirectives(true), - loc: this.loc(start), - }; - } - - /** - * Variable : $ Name - */ - parseVariable(): VariableNode { - const start = this._lexer.token; - this.expectToken(TokenKind.DOLLAR); - return { - kind: Kind.VARIABLE, - name: this.parseName(), - loc: this.loc(start), - }; - } - - /** - * SelectionSet : { Selection+ } - */ - parseSelectionSet(): SelectionSetNode { - const start = this._lexer.token; - return { - kind: Kind.SELECTION_SET, - selections: this.many( - TokenKind.BRACE_L, - this.parseSelection, - TokenKind.BRACE_R, - ), - loc: this.loc(start), - }; - } - - /** - * Selection : - * - Field - * - FragmentSpread - * - InlineFragment - */ - parseSelection(): SelectionNode { - return this.peek(TokenKind.SPREAD) - ? this.parseFragment() - : this.parseField(); - } - - /** - * Field : Alias? Name Arguments? Directives? SelectionSet? - * - * Alias : Name : - */ - parseField(): FieldNode { - const start = this._lexer.token; - - const nameOrAlias = this.parseName(); - let alias; - let name; - if (this.expectOptionalToken(TokenKind.COLON)) { - alias = nameOrAlias; - name = this.parseName(); - } else { - name = nameOrAlias; - } - - return { - kind: Kind.FIELD, - alias, - name, - arguments: this.parseArguments(false), - directives: this.parseDirectives(false), - selectionSet: this.peek(TokenKind.BRACE_L) - ? this.parseSelectionSet() - : undefined, - loc: this.loc(start), - }; - } - - /** - * Arguments[Const] : ( Argument[?Const]+ ) - */ - parseArguments(isConst: boolean): Array { - const item = isConst ? this.parseConstArgument : this.parseArgument; - return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); - } - - /** - * Argument[Const] : Name : Value[?Const] - */ - parseArgument(): ArgumentNode { - const start = this._lexer.token; - const name = this.parseName(); - - this.expectToken(TokenKind.COLON); - return { - kind: Kind.ARGUMENT, - name, - value: this.parseValueLiteral(false), - loc: this.loc(start), - }; - } - - parseConstArgument(): ArgumentNode { - const start = this._lexer.token; - return { - kind: Kind.ARGUMENT, - name: this.parseName(), - value: (this.expectToken(TokenKind.COLON), this.parseValueLiteral(true)), - loc: this.loc(start), - }; - } - - // Implements the parsing rules in the Fragments section. - - /** - * Corresponds to both FragmentSpread and InlineFragment in the spec. - * - * FragmentSpread : ... FragmentName Directives? - * - * InlineFragment : ... TypeCondition? Directives? SelectionSet - */ - parseFragment(): FragmentSpreadNode | InlineFragmentNode { - const start = this._lexer.token; - this.expectToken(TokenKind.SPREAD); - - const hasTypeCondition = this.expectOptionalKeyword('on'); - if (!hasTypeCondition && this.peek(TokenKind.NAME)) { - return { - kind: Kind.FRAGMENT_SPREAD, - name: this.parseFragmentName(), - directives: this.parseDirectives(false), - loc: this.loc(start), - }; - } - return { - kind: Kind.INLINE_FRAGMENT, - typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start), - }; - } - - /** - * FragmentDefinition : - * - fragment FragmentName on TypeCondition Directives? SelectionSet - * - * TypeCondition : NamedType - */ - parseFragmentDefinition(): FragmentDefinitionNode { - const start = this._lexer.token; - this.expectKeyword('fragment'); - // Experimental support for defining variables within fragments changes - // the grammar of FragmentDefinition: - // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet - if (this._options?.experimentalFragmentVariables === true) { - return { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - variableDefinitions: this.parseVariableDefinitions(), - typeCondition: (this.expectKeyword('on'), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start), - }; - } - return { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - typeCondition: (this.expectKeyword('on'), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start), - }; - } - - /** - * FragmentName : Name but not `on` - */ - parseFragmentName(): NameNode { - if (this._lexer.token.value === 'on') { - throw this.unexpected(); - } - return this.parseName(); - } - - // Implements the parsing rules in the Values section. - - /** - * Value[Const] : - * - [~Const] Variable - * - IntValue - * - FloatValue - * - StringValue - * - BooleanValue - * - NullValue - * - EnumValue - * - ListValue[?Const] - * - ObjectValue[?Const] - * - * BooleanValue : one of `true` `false` - * - * NullValue : `null` - * - * EnumValue : Name but not `true`, `false` or `null` - */ - parseValueLiteral(isConst: boolean): ValueNode { - const token = this._lexer.token; - switch (token.kind) { - case TokenKind.BRACKET_L: - return this.parseList(isConst); - case TokenKind.BRACE_L: - return this.parseObject(isConst); - case TokenKind.INT: - this._lexer.advance(); - return { - kind: Kind.INT, - value: ((token.value: any): string), - loc: this.loc(token), - }; - case TokenKind.FLOAT: - this._lexer.advance(); - return { - kind: Kind.FLOAT, - value: ((token.value: any): string), - loc: this.loc(token), - }; - case TokenKind.STRING: - case TokenKind.BLOCK_STRING: - return this.parseStringLiteral(); - case TokenKind.NAME: - this._lexer.advance(); - switch (token.value) { - case 'true': - return { kind: Kind.BOOLEAN, value: true, loc: this.loc(token) }; - case 'false': - return { kind: Kind.BOOLEAN, value: false, loc: this.loc(token) }; - case 'null': - return { kind: Kind.NULL, loc: this.loc(token) }; - default: - return { - kind: Kind.ENUM, - value: ((token.value: any): string), - loc: this.loc(token), - }; - } - case TokenKind.DOLLAR: - if (!isConst) { - return this.parseVariable(); - } - break; - } - throw this.unexpected(); - } - - parseStringLiteral(): StringValueNode { - const token = this._lexer.token; - this._lexer.advance(); - return { - kind: Kind.STRING, - value: ((token.value: any): string), - block: token.kind === TokenKind.BLOCK_STRING, - loc: this.loc(token), - }; - } - - /** - * ListValue[Const] : - * - [ ] - * - [ Value[?Const]+ ] - */ - parseList(isConst: boolean): ListValueNode { - const start = this._lexer.token; - const item = () => this.parseValueLiteral(isConst); - return { - kind: Kind.LIST, - values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R), - loc: this.loc(start), - }; - } - - /** - * ObjectValue[Const] : - * - { } - * - { ObjectField[?Const]+ } - */ - parseObject(isConst: boolean): ObjectValueNode { - const start = this._lexer.token; - const item = () => this.parseObjectField(isConst); - return { - kind: Kind.OBJECT, - fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R), - loc: this.loc(start), - }; - } - - /** - * ObjectField[Const] : Name : Value[?Const] - */ - parseObjectField(isConst: boolean): ObjectFieldNode { - const start = this._lexer.token; - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - - return { - kind: Kind.OBJECT_FIELD, - name, - value: this.parseValueLiteral(isConst), - loc: this.loc(start), - }; - } - - // Implements the parsing rules in the Directives section. - - /** - * Directives[Const] : Directive[?Const]+ - */ - parseDirectives(isConst: boolean): Array { - const directives = []; - while (this.peek(TokenKind.AT)) { - directives.push(this.parseDirective(isConst)); - } - return directives; - } - - /** - * Directive[Const] : @ Name Arguments[?Const]? - */ - parseDirective(isConst: boolean): DirectiveNode { - const start = this._lexer.token; - this.expectToken(TokenKind.AT); - return { - kind: Kind.DIRECTIVE, - name: this.parseName(), - arguments: this.parseArguments(isConst), - loc: this.loc(start), - }; - } - - // Implements the parsing rules in the Types section. - - /** - * Type : - * - NamedType - * - ListType - * - NonNullType - */ - parseTypeReference(): TypeNode { - const start = this._lexer.token; - let type; - if (this.expectOptionalToken(TokenKind.BRACKET_L)) { - type = this.parseTypeReference(); - this.expectToken(TokenKind.BRACKET_R); - type = { - kind: Kind.LIST_TYPE, - type, - loc: this.loc(start), - }; - } else { - type = this.parseNamedType(); - } - - if (this.expectOptionalToken(TokenKind.BANG)) { - return { - kind: Kind.NON_NULL_TYPE, - type, - loc: this.loc(start), - }; - } - return type; - } - - /** - * NamedType : Name - */ - parseNamedType(): NamedTypeNode { - const start = this._lexer.token; - return { - kind: Kind.NAMED_TYPE, - name: this.parseName(), - loc: this.loc(start), - }; - } - - // Implements the parsing rules in the Type Definition section. - - /** - * TypeSystemDefinition : - * - SchemaDefinition - * - TypeDefinition - * - DirectiveDefinition - * - * TypeDefinition : - * - ScalarTypeDefinition - * - ObjectTypeDefinition - * - InterfaceTypeDefinition - * - UnionTypeDefinition - * - EnumTypeDefinition - * - InputObjectTypeDefinition - */ - parseTypeSystemDefinition(): TypeSystemDefinitionNode { - // Many definitions begin with a description and require a lookahead. - const keywordToken = this.peekDescription() - ? this._lexer.lookahead() - : this._lexer.token; - - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case 'schema': - return this.parseSchemaDefinition(); - case 'scalar': - return this.parseScalarTypeDefinition(); - case 'type': - return this.parseObjectTypeDefinition(); - case 'interface': - return this.parseInterfaceTypeDefinition(); - case 'union': - return this.parseUnionTypeDefinition(); - case 'enum': - return this.parseEnumTypeDefinition(); - case 'input': - return this.parseInputObjectTypeDefinition(); - case 'directive': - return this.parseDirectiveDefinition(); - } - } - - throw this.unexpected(keywordToken); - } - - peekDescription(): boolean { - return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); - } - - /** - * Description : StringValue - */ - parseDescription(): void | StringValueNode { - if (this.peekDescription()) { - return this.parseStringLiteral(); - } - } - - /** - * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } - */ - parseSchemaDefinition(): SchemaDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('schema'); - const directives = this.parseDirectives(true); - const operationTypes = this.many( - TokenKind.BRACE_L, - this.parseOperationTypeDefinition, - TokenKind.BRACE_R, - ); - return { - kind: Kind.SCHEMA_DEFINITION, - description, - directives, - operationTypes, - loc: this.loc(start), - }; - } - - /** - * OperationTypeDefinition : OperationType : NamedType - */ - parseOperationTypeDefinition(): OperationTypeDefinitionNode { - const start = this._lexer.token; - const operation = this.parseOperationType(); - this.expectToken(TokenKind.COLON); - const type = this.parseNamedType(); - return { - kind: Kind.OPERATION_TYPE_DEFINITION, - operation, - type, - loc: this.loc(start), - }; - } - - /** - * ScalarTypeDefinition : Description? scalar Name Directives[Const]? - */ - parseScalarTypeDefinition(): ScalarTypeDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('scalar'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - return { - kind: Kind.SCALAR_TYPE_DEFINITION, - description, - name, - directives, - loc: this.loc(start), - }; - } - - /** - * ObjectTypeDefinition : - * Description? - * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? - */ - parseObjectTypeDefinition(): ObjectTypeDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('type'); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseDirectives(true); - const fields = this.parseFieldsDefinition(); - return { - kind: Kind.OBJECT_TYPE_DEFINITION, - description, - name, - interfaces, - directives, - fields, - loc: this.loc(start), - }; - } - - /** - * ImplementsInterfaces : - * - implements `&`? NamedType - * - ImplementsInterfaces & NamedType - */ - parseImplementsInterfaces(): Array { - if (!this.expectOptionalKeyword('implements')) { - return []; - } - - if (this._options?.allowLegacySDLImplementsInterfaces === true) { - const types = []; - // Optional leading ampersand - this.expectOptionalToken(TokenKind.AMP); - do { - types.push(this.parseNamedType()); - } while ( - this.expectOptionalToken(TokenKind.AMP) || - this.peek(TokenKind.NAME) - ); - return types; - } - - return this.delimitedMany(TokenKind.AMP, this.parseNamedType); - } - - /** - * FieldsDefinition : { FieldDefinition+ } - */ - parseFieldsDefinition(): Array { - // Legacy support for the SDL? - if ( - this._options?.allowLegacySDLEmptyFields === true && - this.peek(TokenKind.BRACE_L) && - this._lexer.lookahead().kind === TokenKind.BRACE_R - ) { - this._lexer.advance(); - this._lexer.advance(); - return []; - } - return this.optionalMany( - TokenKind.BRACE_L, - this.parseFieldDefinition, - TokenKind.BRACE_R, - ); - } - - /** - * FieldDefinition : - * - Description? Name ArgumentsDefinition? : Type Directives[Const]? - */ - parseFieldDefinition(): FieldDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseName(); - const args = this.parseArgumentDefs(); - this.expectToken(TokenKind.COLON); - const type = this.parseTypeReference(); - const directives = this.parseDirectives(true); - return { - kind: Kind.FIELD_DEFINITION, - description, - name, - arguments: args, - type, - directives, - loc: this.loc(start), - }; - } - - /** - * ArgumentsDefinition : ( InputValueDefinition+ ) - */ - parseArgumentDefs(): Array { - return this.optionalMany( - TokenKind.PAREN_L, - this.parseInputValueDef, - TokenKind.PAREN_R, - ); - } - - /** - * InputValueDefinition : - * - Description? Name : Type DefaultValue? Directives[Const]? - */ - parseInputValueDef(): InputValueDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - const type = this.parseTypeReference(); - let defaultValue; - if (this.expectOptionalToken(TokenKind.EQUALS)) { - defaultValue = this.parseValueLiteral(true); - } - const directives = this.parseDirectives(true); - return { - kind: Kind.INPUT_VALUE_DEFINITION, - description, - name, - type, - defaultValue, - directives, - loc: this.loc(start), - }; - } - - /** - * InterfaceTypeDefinition : - * - Description? interface Name Directives[Const]? FieldsDefinition? - */ - parseInterfaceTypeDefinition(): InterfaceTypeDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('interface'); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseDirectives(true); - const fields = this.parseFieldsDefinition(); - return { - kind: Kind.INTERFACE_TYPE_DEFINITION, - description, - name, - interfaces, - directives, - fields, - loc: this.loc(start), - }; - } - - /** - * UnionTypeDefinition : - * - Description? union Name Directives[Const]? UnionMemberTypes? - */ - parseUnionTypeDefinition(): UnionTypeDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('union'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - const types = this.parseUnionMemberTypes(); - return { - kind: Kind.UNION_TYPE_DEFINITION, - description, - name, - directives, - types, - loc: this.loc(start), - }; - } - - /** - * UnionMemberTypes : - * - = `|`? NamedType - * - UnionMemberTypes | NamedType - */ - parseUnionMemberTypes(): Array { - return this.expectOptionalToken(TokenKind.EQUALS) - ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) - : []; - } - - /** - * EnumTypeDefinition : - * - Description? enum Name Directives[Const]? EnumValuesDefinition? - */ - parseEnumTypeDefinition(): EnumTypeDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('enum'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - const values = this.parseEnumValuesDefinition(); - return { - kind: Kind.ENUM_TYPE_DEFINITION, - description, - name, - directives, - values, - loc: this.loc(start), - }; - } - - /** - * EnumValuesDefinition : { EnumValueDefinition+ } - */ - parseEnumValuesDefinition(): Array { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseEnumValueDefinition, - TokenKind.BRACE_R, - ); - } - - /** - * EnumValueDefinition : Description? EnumValue Directives[Const]? - * - * EnumValue : Name - */ - parseEnumValueDefinition(): EnumValueDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseName(); - const directives = this.parseDirectives(true); - return { - kind: Kind.ENUM_VALUE_DEFINITION, - description, - name, - directives, - loc: this.loc(start), - }; - } - - /** - * InputObjectTypeDefinition : - * - Description? input Name Directives[Const]? InputFieldsDefinition? - */ - parseInputObjectTypeDefinition(): InputObjectTypeDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('input'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - const fields = this.parseInputFieldsDefinition(); - return { - kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, - description, - name, - directives, - fields, - loc: this.loc(start), - }; - } - - /** - * InputFieldsDefinition : { InputValueDefinition+ } - */ - parseInputFieldsDefinition(): Array { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseInputValueDef, - TokenKind.BRACE_R, - ); - } - - /** - * TypeSystemExtension : - * - SchemaExtension - * - TypeExtension - * - * TypeExtension : - * - ScalarTypeExtension - * - ObjectTypeExtension - * - InterfaceTypeExtension - * - UnionTypeExtension - * - EnumTypeExtension - * - InputObjectTypeDefinition - */ - parseTypeSystemExtension(): TypeSystemExtensionNode { - const keywordToken = this._lexer.lookahead(); - - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case 'schema': - return this.parseSchemaExtension(); - case 'scalar': - return this.parseScalarTypeExtension(); - case 'type': - return this.parseObjectTypeExtension(); - case 'interface': - return this.parseInterfaceTypeExtension(); - case 'union': - return this.parseUnionTypeExtension(); - case 'enum': - return this.parseEnumTypeExtension(); - case 'input': - return this.parseInputObjectTypeExtension(); - } - } - - throw this.unexpected(keywordToken); - } - - /** - * SchemaExtension : - * - extend schema Directives[Const]? { OperationTypeDefinition+ } - * - extend schema Directives[Const] - */ - parseSchemaExtension(): SchemaExtensionNode { - const start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('schema'); - const directives = this.parseDirectives(true); - const operationTypes = this.optionalMany( - TokenKind.BRACE_L, - this.parseOperationTypeDefinition, - TokenKind.BRACE_R, - ); - if (directives.length === 0 && operationTypes.length === 0) { - throw this.unexpected(); - } - return { - kind: Kind.SCHEMA_EXTENSION, - directives, - operationTypes, - loc: this.loc(start), - }; - } - - /** - * ScalarTypeExtension : - * - extend scalar Name Directives[Const] - */ - parseScalarTypeExtension(): ScalarTypeExtensionNode { - const start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('scalar'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - if (directives.length === 0) { - throw this.unexpected(); - } - return { - kind: Kind.SCALAR_TYPE_EXTENSION, - name, - directives, - loc: this.loc(start), - }; - } - - /** - * ObjectTypeExtension : - * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend type Name ImplementsInterfaces? Directives[Const] - * - extend type Name ImplementsInterfaces - */ - parseObjectTypeExtension(): ObjectTypeExtensionNode { - const start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('type'); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseDirectives(true); - const fields = this.parseFieldsDefinition(); - if ( - interfaces.length === 0 && - directives.length === 0 && - fields.length === 0 - ) { - throw this.unexpected(); - } - return { - kind: Kind.OBJECT_TYPE_EXTENSION, - name, - interfaces, - directives, - fields, - loc: this.loc(start), - }; - } - - /** - * InterfaceTypeExtension : - * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend interface Name ImplementsInterfaces? Directives[Const] - * - extend interface Name ImplementsInterfaces - */ - parseInterfaceTypeExtension(): InterfaceTypeExtensionNode { - const start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('interface'); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseDirectives(true); - const fields = this.parseFieldsDefinition(); - if ( - interfaces.length === 0 && - directives.length === 0 && - fields.length === 0 - ) { - throw this.unexpected(); - } - return { - kind: Kind.INTERFACE_TYPE_EXTENSION, - name, - interfaces, - directives, - fields, - loc: this.loc(start), - }; - } - - /** - * UnionTypeExtension : - * - extend union Name Directives[Const]? UnionMemberTypes - * - extend union Name Directives[Const] - */ - parseUnionTypeExtension(): UnionTypeExtensionNode { - const start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('union'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - const types = this.parseUnionMemberTypes(); - if (directives.length === 0 && types.length === 0) { - throw this.unexpected(); - } - return { - kind: Kind.UNION_TYPE_EXTENSION, - name, - directives, - types, - loc: this.loc(start), - }; - } - - /** - * EnumTypeExtension : - * - extend enum Name Directives[Const]? EnumValuesDefinition - * - extend enum Name Directives[Const] - */ - parseEnumTypeExtension(): EnumTypeExtensionNode { - const start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('enum'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - const values = this.parseEnumValuesDefinition(); - if (directives.length === 0 && values.length === 0) { - throw this.unexpected(); - } - return { - kind: Kind.ENUM_TYPE_EXTENSION, - name, - directives, - values, - loc: this.loc(start), - }; - } - - /** - * InputObjectTypeExtension : - * - extend input Name Directives[Const]? InputFieldsDefinition - * - extend input Name Directives[Const] - */ - parseInputObjectTypeExtension(): InputObjectTypeExtensionNode { - const start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('input'); - const name = this.parseName(); - const directives = this.parseDirectives(true); - const fields = this.parseInputFieldsDefinition(); - if (directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - return { - kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, - name, - directives, - fields, - loc: this.loc(start), - }; - } - - /** - * DirectiveDefinition : - * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations - */ - parseDirectiveDefinition(): DirectiveDefinitionNode { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword('directive'); - this.expectToken(TokenKind.AT); - const name = this.parseName(); - const args = this.parseArgumentDefs(); - const repeatable = this.expectOptionalKeyword('repeatable'); - this.expectKeyword('on'); - const locations = this.parseDirectiveLocations(); - return { - kind: Kind.DIRECTIVE_DEFINITION, - description, - name, - arguments: args, - repeatable, - locations, - loc: this.loc(start), - }; - } - - /** - * DirectiveLocations : - * - `|`? DirectiveLocation - * - DirectiveLocations | DirectiveLocation - */ - parseDirectiveLocations(): Array { - return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); - } - - /* - * DirectiveLocation : - * - ExecutableDirectiveLocation - * - TypeSystemDirectiveLocation - * - * ExecutableDirectiveLocation : one of - * `QUERY` - * `MUTATION` - * `SUBSCRIPTION` - * `FIELD` - * `FRAGMENT_DEFINITION` - * `FRAGMENT_SPREAD` - * `INLINE_FRAGMENT` - * - * TypeSystemDirectiveLocation : one of - * `SCHEMA` - * `SCALAR` - * `OBJECT` - * `FIELD_DEFINITION` - * `ARGUMENT_DEFINITION` - * `INTERFACE` - * `UNION` - * `ENUM` - * `ENUM_VALUE` - * `INPUT_OBJECT` - * `INPUT_FIELD_DEFINITION` - */ - parseDirectiveLocation(): NameNode { - const start = this._lexer.token; - const name = this.parseName(); - if (DirectiveLocation[name.value] !== undefined) { - return name; - } - throw this.unexpected(start); - } - - // Core parsing utility functions - - /** - * Returns a location object, used to identify the place in the source that created a given parsed object. - */ - loc(startToken: Token): Location | void { - if (this._options?.noLocation !== true) { - return new Location( - startToken, - this._lexer.lastToken, - this._lexer.source, - ); - } - } - - /** - * Determines if the next token is of a given kind - */ - peek(kind: TokenKindEnum): boolean { - return this._lexer.token.kind === kind; - } - - /** - * If the next token is of the given kind, return that token after advancing the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - expectToken(kind: TokenKindEnum): Token { - const token = this._lexer.token; - if (token.kind === kind) { - this._lexer.advance(); - return token; - } - - throw syntaxError( - this._lexer.source, - token.start, - `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`, - ); - } - - /** - * If the next token is of the given kind, return that token after advancing the lexer. - * Otherwise, do not change the parser state and return undefined. - */ - expectOptionalToken(kind: TokenKindEnum): ?Token { - const token = this._lexer.token; - if (token.kind === kind) { - this._lexer.advance(); - return token; - } - return undefined; - } - - /** - * If the next token is a given keyword, advance the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - expectKeyword(value: string) { - const token = this._lexer.token; - if (token.kind === TokenKind.NAME && token.value === value) { - this._lexer.advance(); - } else { - throw syntaxError( - this._lexer.source, - token.start, - `Expected "${value}", found ${getTokenDesc(token)}.`, - ); - } - } - - /** - * If the next token is a given keyword, return "true" after advancing the lexer. - * Otherwise, do not change the parser state and return "false". - */ - expectOptionalKeyword(value: string): boolean { - const token = this._lexer.token; - if (token.kind === TokenKind.NAME && token.value === value) { - this._lexer.advance(); - return true; - } - return false; - } - - /** - * Helper function for creating an error when an unexpected lexed token is encountered. - */ - unexpected(atToken?: ?Token): GraphQLError { - const token = atToken ?? this._lexer.token; - return syntaxError( - this._lexer.source, - token.start, - `Unexpected ${getTokenDesc(token)}.`, - ); - } - - /** - * Returns a possibly empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - any( - openKind: TokenKindEnum, - parseFn: () => T, - closeKind: TokenKindEnum, - ): Array { - this.expectToken(openKind); - const nodes = []; - while (!this.expectOptionalToken(closeKind)) { - nodes.push(parseFn.call(this)); - } - return nodes; - } - - /** - * Returns a list of parse nodes, determined by the parseFn. - * It can be empty only if open token is missing otherwise it will always return non-empty list - * that begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - optionalMany( - openKind: TokenKindEnum, - parseFn: () => T, - closeKind: TokenKindEnum, - ): Array { - if (this.expectOptionalToken(openKind)) { - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - return nodes; - } - return []; - } - - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - many( - openKind: TokenKindEnum, - parseFn: () => T, - closeKind: TokenKindEnum, - ): Array { - this.expectToken(openKind); - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - return nodes; - } - - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. - * Advances the parser to the next lex token after last item in the list. - */ - delimitedMany(delimiterKind: TokenKindEnum, parseFn: () => T): Array { - this.expectOptionalToken(delimiterKind); - - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (this.expectOptionalToken(delimiterKind)); - return nodes; - } -} - -/** - * A helper function to describe a token as a string for debugging. - */ -function getTokenDesc(token: Token): string { - const value = token.value; - return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ''); -} - -/** - * A helper function to describe a token kind as a string for debugging. - */ -function getTokenKindDesc(kind: TokenKindEnum): string { - return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind; -} diff --git a/node_modules/graphql/language/parser.mjs b/node_modules/graphql/language/parser.mjs deleted file mode 100644 index 3987f6c6..00000000 --- a/node_modules/graphql/language/parser.mjs +++ /dev/null @@ -1,1547 +0,0 @@ -import { syntaxError } from "../error/syntaxError.mjs"; -import { Kind } from "./kinds.mjs"; -import { Location } from "./ast.mjs"; -import { TokenKind } from "./tokenKind.mjs"; -import { Source, isSource } from "./source.mjs"; -import { DirectiveLocation } from "./directiveLocation.mjs"; -import { Lexer, isPunctuatorTokenKind } from "./lexer.mjs"; -/** - * Configuration options to control parser behavior - */ - -/** - * Given a GraphQL source, parses it into a Document. - * Throws GraphQLError if a syntax error is encountered. - */ -export function parse(source, options) { - var parser = new Parser(source, options); - return parser.parseDocument(); -} -/** - * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for - * that value. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Values directly and - * in isolation of complete GraphQL documents. - * - * Consider providing the results to the utility function: valueFromAST(). - */ - -export function parseValue(source, options) { - var parser = new Parser(source, options); - parser.expectToken(TokenKind.SOF); - var value = parser.parseValueLiteral(false); - parser.expectToken(TokenKind.EOF); - return value; -} -/** - * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for - * that type. - * Throws GraphQLError if a syntax error is encountered. - * - * This is useful within tools that operate upon GraphQL Types directly and - * in isolation of complete GraphQL documents. - * - * Consider providing the results to the utility function: typeFromAST(). - */ - -export function parseType(source, options) { - var parser = new Parser(source, options); - parser.expectToken(TokenKind.SOF); - var type = parser.parseTypeReference(); - parser.expectToken(TokenKind.EOF); - return type; -} -/** - * This class is exported only to assist people in implementing their own parsers - * without duplicating too much code and should be used only as last resort for cases - * such as experimental syntax or if certain features could not be contributed upstream. - * - * It is still part of the internal API and is versioned, so any changes to it are never - * considered breaking changes. If you still need to support multiple versions of the - * library, please use the `versionInfo` variable for version detection. - * - * @internal - */ - -export var Parser = /*#__PURE__*/function () { - function Parser(source, options) { - var sourceObj = isSource(source) ? source : new Source(source); - this._lexer = new Lexer(sourceObj); - this._options = options; - } - /** - * Converts a name lex token into a name parse node. - */ - - - var _proto = Parser.prototype; - - _proto.parseName = function parseName() { - var token = this.expectToken(TokenKind.NAME); - return { - kind: Kind.NAME, - value: token.value, - loc: this.loc(token) - }; - } // Implements the parsing rules in the Document section. - - /** - * Document : Definition+ - */ - ; - - _proto.parseDocument = function parseDocument() { - var start = this._lexer.token; - return { - kind: Kind.DOCUMENT, - definitions: this.many(TokenKind.SOF, this.parseDefinition, TokenKind.EOF), - loc: this.loc(start) - }; - } - /** - * Definition : - * - ExecutableDefinition - * - TypeSystemDefinition - * - TypeSystemExtension - * - * ExecutableDefinition : - * - OperationDefinition - * - FragmentDefinition - */ - ; - - _proto.parseDefinition = function parseDefinition() { - if (this.peek(TokenKind.NAME)) { - switch (this._lexer.token.value) { - case 'query': - case 'mutation': - case 'subscription': - return this.parseOperationDefinition(); - - case 'fragment': - return this.parseFragmentDefinition(); - - case 'schema': - case 'scalar': - case 'type': - case 'interface': - case 'union': - case 'enum': - case 'input': - case 'directive': - return this.parseTypeSystemDefinition(); - - case 'extend': - return this.parseTypeSystemExtension(); - } - } else if (this.peek(TokenKind.BRACE_L)) { - return this.parseOperationDefinition(); - } else if (this.peekDescription()) { - return this.parseTypeSystemDefinition(); - } - - throw this.unexpected(); - } // Implements the parsing rules in the Operations section. - - /** - * OperationDefinition : - * - SelectionSet - * - OperationType Name? VariableDefinitions? Directives? SelectionSet - */ - ; - - _proto.parseOperationDefinition = function parseOperationDefinition() { - var start = this._lexer.token; - - if (this.peek(TokenKind.BRACE_L)) { - return { - kind: Kind.OPERATION_DEFINITION, - operation: 'query', - name: undefined, - variableDefinitions: [], - directives: [], - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - - var operation = this.parseOperationType(); - var name; - - if (this.peek(TokenKind.NAME)) { - name = this.parseName(); - } - - return { - kind: Kind.OPERATION_DEFINITION, - operation: operation, - name: name, - variableDefinitions: this.parseVariableDefinitions(), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - /** - * OperationType : one of query mutation subscription - */ - ; - - _proto.parseOperationType = function parseOperationType() { - var operationToken = this.expectToken(TokenKind.NAME); - - switch (operationToken.value) { - case 'query': - return 'query'; - - case 'mutation': - return 'mutation'; - - case 'subscription': - return 'subscription'; - } - - throw this.unexpected(operationToken); - } - /** - * VariableDefinitions : ( VariableDefinition+ ) - */ - ; - - _proto.parseVariableDefinitions = function parseVariableDefinitions() { - return this.optionalMany(TokenKind.PAREN_L, this.parseVariableDefinition, TokenKind.PAREN_R); - } - /** - * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? - */ - ; - - _proto.parseVariableDefinition = function parseVariableDefinition() { - var start = this._lexer.token; - return { - kind: Kind.VARIABLE_DEFINITION, - variable: this.parseVariable(), - type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), - defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined, - directives: this.parseDirectives(true), - loc: this.loc(start) - }; - } - /** - * Variable : $ Name - */ - ; - - _proto.parseVariable = function parseVariable() { - var start = this._lexer.token; - this.expectToken(TokenKind.DOLLAR); - return { - kind: Kind.VARIABLE, - name: this.parseName(), - loc: this.loc(start) - }; - } - /** - * SelectionSet : { Selection+ } - */ - ; - - _proto.parseSelectionSet = function parseSelectionSet() { - var start = this._lexer.token; - return { - kind: Kind.SELECTION_SET, - selections: this.many(TokenKind.BRACE_L, this.parseSelection, TokenKind.BRACE_R), - loc: this.loc(start) - }; - } - /** - * Selection : - * - Field - * - FragmentSpread - * - InlineFragment - */ - ; - - _proto.parseSelection = function parseSelection() { - return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); - } - /** - * Field : Alias? Name Arguments? Directives? SelectionSet? - * - * Alias : Name : - */ - ; - - _proto.parseField = function parseField() { - var start = this._lexer.token; - var nameOrAlias = this.parseName(); - var alias; - var name; - - if (this.expectOptionalToken(TokenKind.COLON)) { - alias = nameOrAlias; - name = this.parseName(); - } else { - name = nameOrAlias; - } - - return { - kind: Kind.FIELD, - alias: alias, - name: name, - arguments: this.parseArguments(false), - directives: this.parseDirectives(false), - selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined, - loc: this.loc(start) - }; - } - /** - * Arguments[Const] : ( Argument[?Const]+ ) - */ - ; - - _proto.parseArguments = function parseArguments(isConst) { - var item = isConst ? this.parseConstArgument : this.parseArgument; - return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); - } - /** - * Argument[Const] : Name : Value[?Const] - */ - ; - - _proto.parseArgument = function parseArgument() { - var start = this._lexer.token; - var name = this.parseName(); - this.expectToken(TokenKind.COLON); - return { - kind: Kind.ARGUMENT, - name: name, - value: this.parseValueLiteral(false), - loc: this.loc(start) - }; - }; - - _proto.parseConstArgument = function parseConstArgument() { - var start = this._lexer.token; - return { - kind: Kind.ARGUMENT, - name: this.parseName(), - value: (this.expectToken(TokenKind.COLON), this.parseValueLiteral(true)), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Fragments section. - - /** - * Corresponds to both FragmentSpread and InlineFragment in the spec. - * - * FragmentSpread : ... FragmentName Directives? - * - * InlineFragment : ... TypeCondition? Directives? SelectionSet - */ - ; - - _proto.parseFragment = function parseFragment() { - var start = this._lexer.token; - this.expectToken(TokenKind.SPREAD); - var hasTypeCondition = this.expectOptionalKeyword('on'); - - if (!hasTypeCondition && this.peek(TokenKind.NAME)) { - return { - kind: Kind.FRAGMENT_SPREAD, - name: this.parseFragmentName(), - directives: this.parseDirectives(false), - loc: this.loc(start) - }; - } - - return { - kind: Kind.INLINE_FRAGMENT, - typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - /** - * FragmentDefinition : - * - fragment FragmentName on TypeCondition Directives? SelectionSet - * - * TypeCondition : NamedType - */ - ; - - _proto.parseFragmentDefinition = function parseFragmentDefinition() { - var _this$_options; - - var start = this._lexer.token; - this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes - // the grammar of FragmentDefinition: - // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet - - if (((_this$_options = this._options) === null || _this$_options === void 0 ? void 0 : _this$_options.experimentalFragmentVariables) === true) { - return { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - variableDefinitions: this.parseVariableDefinitions(), - typeCondition: (this.expectKeyword('on'), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - - return { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - typeCondition: (this.expectKeyword('on'), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet(), - loc: this.loc(start) - }; - } - /** - * FragmentName : Name but not `on` - */ - ; - - _proto.parseFragmentName = function parseFragmentName() { - if (this._lexer.token.value === 'on') { - throw this.unexpected(); - } - - return this.parseName(); - } // Implements the parsing rules in the Values section. - - /** - * Value[Const] : - * - [~Const] Variable - * - IntValue - * - FloatValue - * - StringValue - * - BooleanValue - * - NullValue - * - EnumValue - * - ListValue[?Const] - * - ObjectValue[?Const] - * - * BooleanValue : one of `true` `false` - * - * NullValue : `null` - * - * EnumValue : Name but not `true`, `false` or `null` - */ - ; - - _proto.parseValueLiteral = function parseValueLiteral(isConst) { - var token = this._lexer.token; - - switch (token.kind) { - case TokenKind.BRACKET_L: - return this.parseList(isConst); - - case TokenKind.BRACE_L: - return this.parseObject(isConst); - - case TokenKind.INT: - this._lexer.advance(); - - return { - kind: Kind.INT, - value: token.value, - loc: this.loc(token) - }; - - case TokenKind.FLOAT: - this._lexer.advance(); - - return { - kind: Kind.FLOAT, - value: token.value, - loc: this.loc(token) - }; - - case TokenKind.STRING: - case TokenKind.BLOCK_STRING: - return this.parseStringLiteral(); - - case TokenKind.NAME: - this._lexer.advance(); - - switch (token.value) { - case 'true': - return { - kind: Kind.BOOLEAN, - value: true, - loc: this.loc(token) - }; - - case 'false': - return { - kind: Kind.BOOLEAN, - value: false, - loc: this.loc(token) - }; - - case 'null': - return { - kind: Kind.NULL, - loc: this.loc(token) - }; - - default: - return { - kind: Kind.ENUM, - value: token.value, - loc: this.loc(token) - }; - } - - case TokenKind.DOLLAR: - if (!isConst) { - return this.parseVariable(); - } - - break; - } - - throw this.unexpected(); - }; - - _proto.parseStringLiteral = function parseStringLiteral() { - var token = this._lexer.token; - - this._lexer.advance(); - - return { - kind: Kind.STRING, - value: token.value, - block: token.kind === TokenKind.BLOCK_STRING, - loc: this.loc(token) - }; - } - /** - * ListValue[Const] : - * - [ ] - * - [ Value[?Const]+ ] - */ - ; - - _proto.parseList = function parseList(isConst) { - var _this = this; - - var start = this._lexer.token; - - var item = function item() { - return _this.parseValueLiteral(isConst); - }; - - return { - kind: Kind.LIST, - values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R), - loc: this.loc(start) - }; - } - /** - * ObjectValue[Const] : - * - { } - * - { ObjectField[?Const]+ } - */ - ; - - _proto.parseObject = function parseObject(isConst) { - var _this2 = this; - - var start = this._lexer.token; - - var item = function item() { - return _this2.parseObjectField(isConst); - }; - - return { - kind: Kind.OBJECT, - fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R), - loc: this.loc(start) - }; - } - /** - * ObjectField[Const] : Name : Value[?Const] - */ - ; - - _proto.parseObjectField = function parseObjectField(isConst) { - var start = this._lexer.token; - var name = this.parseName(); - this.expectToken(TokenKind.COLON); - return { - kind: Kind.OBJECT_FIELD, - name: name, - value: this.parseValueLiteral(isConst), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Directives section. - - /** - * Directives[Const] : Directive[?Const]+ - */ - ; - - _proto.parseDirectives = function parseDirectives(isConst) { - var directives = []; - - while (this.peek(TokenKind.AT)) { - directives.push(this.parseDirective(isConst)); - } - - return directives; - } - /** - * Directive[Const] : @ Name Arguments[?Const]? - */ - ; - - _proto.parseDirective = function parseDirective(isConst) { - var start = this._lexer.token; - this.expectToken(TokenKind.AT); - return { - kind: Kind.DIRECTIVE, - name: this.parseName(), - arguments: this.parseArguments(isConst), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Types section. - - /** - * Type : - * - NamedType - * - ListType - * - NonNullType - */ - ; - - _proto.parseTypeReference = function parseTypeReference() { - var start = this._lexer.token; - var type; - - if (this.expectOptionalToken(TokenKind.BRACKET_L)) { - type = this.parseTypeReference(); - this.expectToken(TokenKind.BRACKET_R); - type = { - kind: Kind.LIST_TYPE, - type: type, - loc: this.loc(start) - }; - } else { - type = this.parseNamedType(); - } - - if (this.expectOptionalToken(TokenKind.BANG)) { - return { - kind: Kind.NON_NULL_TYPE, - type: type, - loc: this.loc(start) - }; - } - - return type; - } - /** - * NamedType : Name - */ - ; - - _proto.parseNamedType = function parseNamedType() { - var start = this._lexer.token; - return { - kind: Kind.NAMED_TYPE, - name: this.parseName(), - loc: this.loc(start) - }; - } // Implements the parsing rules in the Type Definition section. - - /** - * TypeSystemDefinition : - * - SchemaDefinition - * - TypeDefinition - * - DirectiveDefinition - * - * TypeDefinition : - * - ScalarTypeDefinition - * - ObjectTypeDefinition - * - InterfaceTypeDefinition - * - UnionTypeDefinition - * - EnumTypeDefinition - * - InputObjectTypeDefinition - */ - ; - - _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() { - // Many definitions begin with a description and require a lookahead. - var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token; - - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case 'schema': - return this.parseSchemaDefinition(); - - case 'scalar': - return this.parseScalarTypeDefinition(); - - case 'type': - return this.parseObjectTypeDefinition(); - - case 'interface': - return this.parseInterfaceTypeDefinition(); - - case 'union': - return this.parseUnionTypeDefinition(); - - case 'enum': - return this.parseEnumTypeDefinition(); - - case 'input': - return this.parseInputObjectTypeDefinition(); - - case 'directive': - return this.parseDirectiveDefinition(); - } - } - - throw this.unexpected(keywordToken); - }; - - _proto.peekDescription = function peekDescription() { - return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); - } - /** - * Description : StringValue - */ - ; - - _proto.parseDescription = function parseDescription() { - if (this.peekDescription()) { - return this.parseStringLiteral(); - } - } - /** - * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } - */ - ; - - _proto.parseSchemaDefinition = function parseSchemaDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('schema'); - var directives = this.parseDirectives(true); - var operationTypes = this.many(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R); - return { - kind: Kind.SCHEMA_DEFINITION, - description: description, - directives: directives, - operationTypes: operationTypes, - loc: this.loc(start) - }; - } - /** - * OperationTypeDefinition : OperationType : NamedType - */ - ; - - _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() { - var start = this._lexer.token; - var operation = this.parseOperationType(); - this.expectToken(TokenKind.COLON); - var type = this.parseNamedType(); - return { - kind: Kind.OPERATION_TYPE_DEFINITION, - operation: operation, - type: type, - loc: this.loc(start) - }; - } - /** - * ScalarTypeDefinition : Description? scalar Name Directives[Const]? - */ - ; - - _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('scalar'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - return { - kind: Kind.SCALAR_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - loc: this.loc(start) - }; - } - /** - * ObjectTypeDefinition : - * Description? - * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? - */ - ; - - _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('type'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - return { - kind: Kind.OBJECT_TYPE_DEFINITION, - description: description, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * ImplementsInterfaces : - * - implements `&`? NamedType - * - ImplementsInterfaces & NamedType - */ - ; - - _proto.parseImplementsInterfaces = function parseImplementsInterfaces() { - var _this$_options2; - - if (!this.expectOptionalKeyword('implements')) { - return []; - } - - if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) { - var types = []; // Optional leading ampersand - - this.expectOptionalToken(TokenKind.AMP); - - do { - types.push(this.parseNamedType()); - } while (this.expectOptionalToken(TokenKind.AMP) || this.peek(TokenKind.NAME)); - - return types; - } - - return this.delimitedMany(TokenKind.AMP, this.parseNamedType); - } - /** - * FieldsDefinition : { FieldDefinition+ } - */ - ; - - _proto.parseFieldsDefinition = function parseFieldsDefinition() { - var _this$_options3; - - // Legacy support for the SDL? - if (((_this$_options3 = this._options) === null || _this$_options3 === void 0 ? void 0 : _this$_options3.allowLegacySDLEmptyFields) === true && this.peek(TokenKind.BRACE_L) && this._lexer.lookahead().kind === TokenKind.BRACE_R) { - this._lexer.advance(); - - this._lexer.advance(); - - return []; - } - - return this.optionalMany(TokenKind.BRACE_L, this.parseFieldDefinition, TokenKind.BRACE_R); - } - /** - * FieldDefinition : - * - Description? Name ArgumentsDefinition? : Type Directives[Const]? - */ - ; - - _proto.parseFieldDefinition = function parseFieldDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - var name = this.parseName(); - var args = this.parseArgumentDefs(); - this.expectToken(TokenKind.COLON); - var type = this.parseTypeReference(); - var directives = this.parseDirectives(true); - return { - kind: Kind.FIELD_DEFINITION, - description: description, - name: name, - arguments: args, - type: type, - directives: directives, - loc: this.loc(start) - }; - } - /** - * ArgumentsDefinition : ( InputValueDefinition+ ) - */ - ; - - _proto.parseArgumentDefs = function parseArgumentDefs() { - return this.optionalMany(TokenKind.PAREN_L, this.parseInputValueDef, TokenKind.PAREN_R); - } - /** - * InputValueDefinition : - * - Description? Name : Type DefaultValue? Directives[Const]? - */ - ; - - _proto.parseInputValueDef = function parseInputValueDef() { - var start = this._lexer.token; - var description = this.parseDescription(); - var name = this.parseName(); - this.expectToken(TokenKind.COLON); - var type = this.parseTypeReference(); - var defaultValue; - - if (this.expectOptionalToken(TokenKind.EQUALS)) { - defaultValue = this.parseValueLiteral(true); - } - - var directives = this.parseDirectives(true); - return { - kind: Kind.INPUT_VALUE_DEFINITION, - description: description, - name: name, - type: type, - defaultValue: defaultValue, - directives: directives, - loc: this.loc(start) - }; - } - /** - * InterfaceTypeDefinition : - * - Description? interface Name Directives[Const]? FieldsDefinition? - */ - ; - - _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('interface'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - return { - kind: Kind.INTERFACE_TYPE_DEFINITION, - description: description, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * UnionTypeDefinition : - * - Description? union Name Directives[Const]? UnionMemberTypes? - */ - ; - - _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('union'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var types = this.parseUnionMemberTypes(); - return { - kind: Kind.UNION_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - types: types, - loc: this.loc(start) - }; - } - /** - * UnionMemberTypes : - * - = `|`? NamedType - * - UnionMemberTypes | NamedType - */ - ; - - _proto.parseUnionMemberTypes = function parseUnionMemberTypes() { - return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : []; - } - /** - * EnumTypeDefinition : - * - Description? enum Name Directives[Const]? EnumValuesDefinition? - */ - ; - - _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('enum'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var values = this.parseEnumValuesDefinition(); - return { - kind: Kind.ENUM_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - values: values, - loc: this.loc(start) - }; - } - /** - * EnumValuesDefinition : { EnumValueDefinition+ } - */ - ; - - _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() { - return this.optionalMany(TokenKind.BRACE_L, this.parseEnumValueDefinition, TokenKind.BRACE_R); - } - /** - * EnumValueDefinition : Description? EnumValue Directives[Const]? - * - * EnumValue : Name - */ - ; - - _proto.parseEnumValueDefinition = function parseEnumValueDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - var name = this.parseName(); - var directives = this.parseDirectives(true); - return { - kind: Kind.ENUM_VALUE_DEFINITION, - description: description, - name: name, - directives: directives, - loc: this.loc(start) - }; - } - /** - * InputObjectTypeDefinition : - * - Description? input Name Directives[Const]? InputFieldsDefinition? - */ - ; - - _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('input'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var fields = this.parseInputFieldsDefinition(); - return { - kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, - description: description, - name: name, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * InputFieldsDefinition : { InputValueDefinition+ } - */ - ; - - _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() { - return this.optionalMany(TokenKind.BRACE_L, this.parseInputValueDef, TokenKind.BRACE_R); - } - /** - * TypeSystemExtension : - * - SchemaExtension - * - TypeExtension - * - * TypeExtension : - * - ScalarTypeExtension - * - ObjectTypeExtension - * - InterfaceTypeExtension - * - UnionTypeExtension - * - EnumTypeExtension - * - InputObjectTypeDefinition - */ - ; - - _proto.parseTypeSystemExtension = function parseTypeSystemExtension() { - var keywordToken = this._lexer.lookahead(); - - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case 'schema': - return this.parseSchemaExtension(); - - case 'scalar': - return this.parseScalarTypeExtension(); - - case 'type': - return this.parseObjectTypeExtension(); - - case 'interface': - return this.parseInterfaceTypeExtension(); - - case 'union': - return this.parseUnionTypeExtension(); - - case 'enum': - return this.parseEnumTypeExtension(); - - case 'input': - return this.parseInputObjectTypeExtension(); - } - } - - throw this.unexpected(keywordToken); - } - /** - * SchemaExtension : - * - extend schema Directives[Const]? { OperationTypeDefinition+ } - * - extend schema Directives[Const] - */ - ; - - _proto.parseSchemaExtension = function parseSchemaExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('schema'); - var directives = this.parseDirectives(true); - var operationTypes = this.optionalMany(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R); - - if (directives.length === 0 && operationTypes.length === 0) { - throw this.unexpected(); - } - - return { - kind: Kind.SCHEMA_EXTENSION, - directives: directives, - operationTypes: operationTypes, - loc: this.loc(start) - }; - } - /** - * ScalarTypeExtension : - * - extend scalar Name Directives[Const] - */ - ; - - _proto.parseScalarTypeExtension = function parseScalarTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('scalar'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - - if (directives.length === 0) { - throw this.unexpected(); - } - - return { - kind: Kind.SCALAR_TYPE_EXTENSION, - name: name, - directives: directives, - loc: this.loc(start) - }; - } - /** - * ObjectTypeExtension : - * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend type Name ImplementsInterfaces? Directives[Const] - * - extend type Name ImplementsInterfaces - */ - ; - - _proto.parseObjectTypeExtension = function parseObjectTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('type'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - - return { - kind: Kind.OBJECT_TYPE_EXTENSION, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * InterfaceTypeExtension : - * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend interface Name ImplementsInterfaces? Directives[Const] - * - extend interface Name ImplementsInterfaces - */ - ; - - _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('interface'); - var name = this.parseName(); - var interfaces = this.parseImplementsInterfaces(); - var directives = this.parseDirectives(true); - var fields = this.parseFieldsDefinition(); - - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - - return { - kind: Kind.INTERFACE_TYPE_EXTENSION, - name: name, - interfaces: interfaces, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * UnionTypeExtension : - * - extend union Name Directives[Const]? UnionMemberTypes - * - extend union Name Directives[Const] - */ - ; - - _proto.parseUnionTypeExtension = function parseUnionTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('union'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var types = this.parseUnionMemberTypes(); - - if (directives.length === 0 && types.length === 0) { - throw this.unexpected(); - } - - return { - kind: Kind.UNION_TYPE_EXTENSION, - name: name, - directives: directives, - types: types, - loc: this.loc(start) - }; - } - /** - * EnumTypeExtension : - * - extend enum Name Directives[Const]? EnumValuesDefinition - * - extend enum Name Directives[Const] - */ - ; - - _proto.parseEnumTypeExtension = function parseEnumTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('enum'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var values = this.parseEnumValuesDefinition(); - - if (directives.length === 0 && values.length === 0) { - throw this.unexpected(); - } - - return { - kind: Kind.ENUM_TYPE_EXTENSION, - name: name, - directives: directives, - values: values, - loc: this.loc(start) - }; - } - /** - * InputObjectTypeExtension : - * - extend input Name Directives[Const]? InputFieldsDefinition - * - extend input Name Directives[Const] - */ - ; - - _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() { - var start = this._lexer.token; - this.expectKeyword('extend'); - this.expectKeyword('input'); - var name = this.parseName(); - var directives = this.parseDirectives(true); - var fields = this.parseInputFieldsDefinition(); - - if (directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - - return { - kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, - name: name, - directives: directives, - fields: fields, - loc: this.loc(start) - }; - } - /** - * DirectiveDefinition : - * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations - */ - ; - - _proto.parseDirectiveDefinition = function parseDirectiveDefinition() { - var start = this._lexer.token; - var description = this.parseDescription(); - this.expectKeyword('directive'); - this.expectToken(TokenKind.AT); - var name = this.parseName(); - var args = this.parseArgumentDefs(); - var repeatable = this.expectOptionalKeyword('repeatable'); - this.expectKeyword('on'); - var locations = this.parseDirectiveLocations(); - return { - kind: Kind.DIRECTIVE_DEFINITION, - description: description, - name: name, - arguments: args, - repeatable: repeatable, - locations: locations, - loc: this.loc(start) - }; - } - /** - * DirectiveLocations : - * - `|`? DirectiveLocation - * - DirectiveLocations | DirectiveLocation - */ - ; - - _proto.parseDirectiveLocations = function parseDirectiveLocations() { - return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); - } - /* - * DirectiveLocation : - * - ExecutableDirectiveLocation - * - TypeSystemDirectiveLocation - * - * ExecutableDirectiveLocation : one of - * `QUERY` - * `MUTATION` - * `SUBSCRIPTION` - * `FIELD` - * `FRAGMENT_DEFINITION` - * `FRAGMENT_SPREAD` - * `INLINE_FRAGMENT` - * - * TypeSystemDirectiveLocation : one of - * `SCHEMA` - * `SCALAR` - * `OBJECT` - * `FIELD_DEFINITION` - * `ARGUMENT_DEFINITION` - * `INTERFACE` - * `UNION` - * `ENUM` - * `ENUM_VALUE` - * `INPUT_OBJECT` - * `INPUT_FIELD_DEFINITION` - */ - ; - - _proto.parseDirectiveLocation = function parseDirectiveLocation() { - var start = this._lexer.token; - var name = this.parseName(); - - if (DirectiveLocation[name.value] !== undefined) { - return name; - } - - throw this.unexpected(start); - } // Core parsing utility functions - - /** - * Returns a location object, used to identify the place in the source that created a given parsed object. - */ - ; - - _proto.loc = function loc(startToken) { - var _this$_options4; - - if (((_this$_options4 = this._options) === null || _this$_options4 === void 0 ? void 0 : _this$_options4.noLocation) !== true) { - return new Location(startToken, this._lexer.lastToken, this._lexer.source); - } - } - /** - * Determines if the next token is of a given kind - */ - ; - - _proto.peek = function peek(kind) { - return this._lexer.token.kind === kind; - } - /** - * If the next token is of the given kind, return that token after advancing the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - ; - - _proto.expectToken = function expectToken(kind) { - var token = this._lexer.token; - - if (token.kind === kind) { - this._lexer.advance(); - - return token; - } - - throw syntaxError(this._lexer.source, token.start, "Expected ".concat(getTokenKindDesc(kind), ", found ").concat(getTokenDesc(token), ".")); - } - /** - * If the next token is of the given kind, return that token after advancing the lexer. - * Otherwise, do not change the parser state and return undefined. - */ - ; - - _proto.expectOptionalToken = function expectOptionalToken(kind) { - var token = this._lexer.token; - - if (token.kind === kind) { - this._lexer.advance(); - - return token; - } - - return undefined; - } - /** - * If the next token is a given keyword, advance the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - ; - - _proto.expectKeyword = function expectKeyword(value) { - var token = this._lexer.token; - - if (token.kind === TokenKind.NAME && token.value === value) { - this._lexer.advance(); - } else { - throw syntaxError(this._lexer.source, token.start, "Expected \"".concat(value, "\", found ").concat(getTokenDesc(token), ".")); - } - } - /** - * If the next token is a given keyword, return "true" after advancing the lexer. - * Otherwise, do not change the parser state and return "false". - */ - ; - - _proto.expectOptionalKeyword = function expectOptionalKeyword(value) { - var token = this._lexer.token; - - if (token.kind === TokenKind.NAME && token.value === value) { - this._lexer.advance(); - - return true; - } - - return false; - } - /** - * Helper function for creating an error when an unexpected lexed token is encountered. - */ - ; - - _proto.unexpected = function unexpected(atToken) { - var token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; - return syntaxError(this._lexer.source, token.start, "Unexpected ".concat(getTokenDesc(token), ".")); - } - /** - * Returns a possibly empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - ; - - _proto.any = function any(openKind, parseFn, closeKind) { - this.expectToken(openKind); - var nodes = []; - - while (!this.expectOptionalToken(closeKind)) { - nodes.push(parseFn.call(this)); - } - - return nodes; - } - /** - * Returns a list of parse nodes, determined by the parseFn. - * It can be empty only if open token is missing otherwise it will always return non-empty list - * that begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - ; - - _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) { - if (this.expectOptionalToken(openKind)) { - var nodes = []; - - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - - return nodes; - } - - return []; - } - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - ; - - _proto.many = function many(openKind, parseFn, closeKind) { - this.expectToken(openKind); - var nodes = []; - - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - - return nodes; - } - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. - * Advances the parser to the next lex token after last item in the list. - */ - ; - - _proto.delimitedMany = function delimitedMany(delimiterKind, parseFn) { - this.expectOptionalToken(delimiterKind); - var nodes = []; - - do { - nodes.push(parseFn.call(this)); - } while (this.expectOptionalToken(delimiterKind)); - - return nodes; - }; - - return Parser; -}(); -/** - * A helper function to describe a token as a string for debugging. - */ - -function getTokenDesc(token) { - var value = token.value; - return getTokenKindDesc(token.kind) + (value != null ? " \"".concat(value, "\"") : ''); -} -/** - * A helper function to describe a token kind as a string for debugging. - */ - - -function getTokenKindDesc(kind) { - return isPunctuatorTokenKind(kind) ? "\"".concat(kind, "\"") : kind; -} diff --git a/node_modules/graphql/language/predicates.d.ts b/node_modules/graphql/language/predicates.d.ts deleted file mode 100644 index cdbe1f9f..00000000 --- a/node_modules/graphql/language/predicates.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { - ASTNode, - DefinitionNode, - ExecutableDefinitionNode, - SelectionNode, - ValueNode, - TypeNode, - TypeSystemDefinitionNode, - TypeDefinitionNode, - TypeSystemExtensionNode, - TypeExtensionNode, -} from './ast'; - -export function isDefinitionNode(node: ASTNode): node is DefinitionNode; - -export function isExecutableDefinitionNode( - node: ASTNode, -): node is ExecutableDefinitionNode; - -export function isSelectionNode(node: ASTNode): node is SelectionNode; - -export function isValueNode(node: ASTNode): node is ValueNode; - -export function isTypeNode(node: ASTNode): node is TypeNode; - -export function isTypeSystemDefinitionNode( - node: ASTNode, -): node is TypeSystemDefinitionNode; - -export function isTypeDefinitionNode(node: ASTNode): node is TypeDefinitionNode; - -export function isTypeSystemExtensionNode( - node: ASTNode, -): node is TypeSystemExtensionNode; - -export function isTypeExtensionNode(node: ASTNode): node is TypeExtensionNode; diff --git a/node_modules/graphql/language/predicates.js b/node_modules/graphql/language/predicates.js deleted file mode 100644 index f75f9f46..00000000 --- a/node_modules/graphql/language/predicates.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isDefinitionNode = isDefinitionNode; -exports.isExecutableDefinitionNode = isExecutableDefinitionNode; -exports.isSelectionNode = isSelectionNode; -exports.isValueNode = isValueNode; -exports.isTypeNode = isTypeNode; -exports.isTypeSystemDefinitionNode = isTypeSystemDefinitionNode; -exports.isTypeDefinitionNode = isTypeDefinitionNode; -exports.isTypeSystemExtensionNode = isTypeSystemExtensionNode; -exports.isTypeExtensionNode = isTypeExtensionNode; - -var _kinds = require("./kinds.js"); - -function isDefinitionNode(node) { - return isExecutableDefinitionNode(node) || isTypeSystemDefinitionNode(node) || isTypeSystemExtensionNode(node); -} - -function isExecutableDefinitionNode(node) { - return node.kind === _kinds.Kind.OPERATION_DEFINITION || node.kind === _kinds.Kind.FRAGMENT_DEFINITION; -} - -function isSelectionNode(node) { - return node.kind === _kinds.Kind.FIELD || node.kind === _kinds.Kind.FRAGMENT_SPREAD || node.kind === _kinds.Kind.INLINE_FRAGMENT; -} - -function isValueNode(node) { - return node.kind === _kinds.Kind.VARIABLE || node.kind === _kinds.Kind.INT || node.kind === _kinds.Kind.FLOAT || node.kind === _kinds.Kind.STRING || node.kind === _kinds.Kind.BOOLEAN || node.kind === _kinds.Kind.NULL || node.kind === _kinds.Kind.ENUM || node.kind === _kinds.Kind.LIST || node.kind === _kinds.Kind.OBJECT; -} - -function isTypeNode(node) { - return node.kind === _kinds.Kind.NAMED_TYPE || node.kind === _kinds.Kind.LIST_TYPE || node.kind === _kinds.Kind.NON_NULL_TYPE; -} - -function isTypeSystemDefinitionNode(node) { - return node.kind === _kinds.Kind.SCHEMA_DEFINITION || isTypeDefinitionNode(node) || node.kind === _kinds.Kind.DIRECTIVE_DEFINITION; -} - -function isTypeDefinitionNode(node) { - return node.kind === _kinds.Kind.SCALAR_TYPE_DEFINITION || node.kind === _kinds.Kind.OBJECT_TYPE_DEFINITION || node.kind === _kinds.Kind.INTERFACE_TYPE_DEFINITION || node.kind === _kinds.Kind.UNION_TYPE_DEFINITION || node.kind === _kinds.Kind.ENUM_TYPE_DEFINITION || node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION; -} - -function isTypeSystemExtensionNode(node) { - return node.kind === _kinds.Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); -} - -function isTypeExtensionNode(node) { - return node.kind === _kinds.Kind.SCALAR_TYPE_EXTENSION || node.kind === _kinds.Kind.OBJECT_TYPE_EXTENSION || node.kind === _kinds.Kind.INTERFACE_TYPE_EXTENSION || node.kind === _kinds.Kind.UNION_TYPE_EXTENSION || node.kind === _kinds.Kind.ENUM_TYPE_EXTENSION || node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION; -} diff --git a/node_modules/graphql/language/predicates.js.flow b/node_modules/graphql/language/predicates.js.flow deleted file mode 100644 index 5597dbbd..00000000 --- a/node_modules/graphql/language/predicates.js.flow +++ /dev/null @@ -1,82 +0,0 @@ -// @flow strict -import type { ASTNode } from './ast'; -import { Kind } from './kinds'; - -export function isDefinitionNode(node: ASTNode): boolean %checks { - return ( - isExecutableDefinitionNode(node) || - isTypeSystemDefinitionNode(node) || - isTypeSystemExtensionNode(node) - ); -} - -export function isExecutableDefinitionNode(node: ASTNode): boolean %checks { - return ( - node.kind === Kind.OPERATION_DEFINITION || - node.kind === Kind.FRAGMENT_DEFINITION - ); -} - -export function isSelectionNode(node: ASTNode): boolean %checks { - return ( - node.kind === Kind.FIELD || - node.kind === Kind.FRAGMENT_SPREAD || - node.kind === Kind.INLINE_FRAGMENT - ); -} - -export function isValueNode(node: ASTNode): boolean %checks { - return ( - node.kind === Kind.VARIABLE || - node.kind === Kind.INT || - node.kind === Kind.FLOAT || - node.kind === Kind.STRING || - node.kind === Kind.BOOLEAN || - node.kind === Kind.NULL || - node.kind === Kind.ENUM || - node.kind === Kind.LIST || - node.kind === Kind.OBJECT - ); -} - -export function isTypeNode(node: ASTNode): boolean %checks { - return ( - node.kind === Kind.NAMED_TYPE || - node.kind === Kind.LIST_TYPE || - node.kind === Kind.NON_NULL_TYPE - ); -} - -export function isTypeSystemDefinitionNode(node: ASTNode): boolean %checks { - return ( - node.kind === Kind.SCHEMA_DEFINITION || - isTypeDefinitionNode(node) || - node.kind === Kind.DIRECTIVE_DEFINITION - ); -} - -export function isTypeDefinitionNode(node: ASTNode): boolean %checks { - return ( - node.kind === Kind.SCALAR_TYPE_DEFINITION || - node.kind === Kind.OBJECT_TYPE_DEFINITION || - node.kind === Kind.INTERFACE_TYPE_DEFINITION || - node.kind === Kind.UNION_TYPE_DEFINITION || - node.kind === Kind.ENUM_TYPE_DEFINITION || - node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION - ); -} - -export function isTypeSystemExtensionNode(node: ASTNode): boolean %checks { - return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); -} - -export function isTypeExtensionNode(node: ASTNode): boolean %checks { - return ( - node.kind === Kind.SCALAR_TYPE_EXTENSION || - node.kind === Kind.OBJECT_TYPE_EXTENSION || - node.kind === Kind.INTERFACE_TYPE_EXTENSION || - node.kind === Kind.UNION_TYPE_EXTENSION || - node.kind === Kind.ENUM_TYPE_EXTENSION || - node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION - ); -} diff --git a/node_modules/graphql/language/predicates.mjs b/node_modules/graphql/language/predicates.mjs deleted file mode 100644 index 7a066f76..00000000 --- a/node_modules/graphql/language/predicates.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import { Kind } from "./kinds.mjs"; -export function isDefinitionNode(node) { - return isExecutableDefinitionNode(node) || isTypeSystemDefinitionNode(node) || isTypeSystemExtensionNode(node); -} -export function isExecutableDefinitionNode(node) { - return node.kind === Kind.OPERATION_DEFINITION || node.kind === Kind.FRAGMENT_DEFINITION; -} -export function isSelectionNode(node) { - return node.kind === Kind.FIELD || node.kind === Kind.FRAGMENT_SPREAD || node.kind === Kind.INLINE_FRAGMENT; -} -export function isValueNode(node) { - return node.kind === Kind.VARIABLE || node.kind === Kind.INT || node.kind === Kind.FLOAT || node.kind === Kind.STRING || node.kind === Kind.BOOLEAN || node.kind === Kind.NULL || node.kind === Kind.ENUM || node.kind === Kind.LIST || node.kind === Kind.OBJECT; -} -export function isTypeNode(node) { - return node.kind === Kind.NAMED_TYPE || node.kind === Kind.LIST_TYPE || node.kind === Kind.NON_NULL_TYPE; -} -export function isTypeSystemDefinitionNode(node) { - return node.kind === Kind.SCHEMA_DEFINITION || isTypeDefinitionNode(node) || node.kind === Kind.DIRECTIVE_DEFINITION; -} -export function isTypeDefinitionNode(node) { - return node.kind === Kind.SCALAR_TYPE_DEFINITION || node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.INTERFACE_TYPE_DEFINITION || node.kind === Kind.UNION_TYPE_DEFINITION || node.kind === Kind.ENUM_TYPE_DEFINITION || node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION; -} -export function isTypeSystemExtensionNode(node) { - return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); -} -export function isTypeExtensionNode(node) { - return node.kind === Kind.SCALAR_TYPE_EXTENSION || node.kind === Kind.OBJECT_TYPE_EXTENSION || node.kind === Kind.INTERFACE_TYPE_EXTENSION || node.kind === Kind.UNION_TYPE_EXTENSION || node.kind === Kind.ENUM_TYPE_EXTENSION || node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION; -} diff --git a/node_modules/graphql/language/printLocation.d.ts b/node_modules/graphql/language/printLocation.d.ts deleted file mode 100644 index 7d0c3470..00000000 --- a/node_modules/graphql/language/printLocation.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Location } from './ast'; -import { Source } from './source'; -import { SourceLocation } from './location'; - -/** - * Render a helpful description of the location in the GraphQL Source document. - */ -export function printLocation(location: Location): string; - -/** - * Render a helpful description of the location in the GraphQL Source document. - */ -export function printSourceLocation( - source: Source, - sourceLocation: SourceLocation, -): string; diff --git a/node_modules/graphql/language/printLocation.js b/node_modules/graphql/language/printLocation.js deleted file mode 100644 index 86987ba0..00000000 --- a/node_modules/graphql/language/printLocation.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.printLocation = printLocation; -exports.printSourceLocation = printSourceLocation; - -var _location = require("./location.js"); - -/** - * Render a helpful description of the location in the GraphQL Source document. - */ -function printLocation(location) { - return printSourceLocation(location.source, (0, _location.getLocation)(location.source, location.start)); -} -/** - * Render a helpful description of the location in the GraphQL Source document. - */ - - -function printSourceLocation(source, sourceLocation) { - var firstLineColumnOffset = source.locationOffset.column - 1; - var body = whitespace(firstLineColumnOffset) + source.body; - var lineIndex = sourceLocation.line - 1; - var lineOffset = source.locationOffset.line - 1; - var lineNum = sourceLocation.line + lineOffset; - var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; - var columnNum = sourceLocation.column + columnOffset; - var locationStr = "".concat(source.name, ":").concat(lineNum, ":").concat(columnNum, "\n"); - var lines = body.split(/\r\n|[\n\r]/g); - var locationLine = lines[lineIndex]; // Special case for minified documents - - if (locationLine.length > 120) { - var subLineIndex = Math.floor(columnNum / 80); - var subLineColumnNum = columnNum % 80; - var subLines = []; - - for (var i = 0; i < locationLine.length; i += 80) { - subLines.push(locationLine.slice(i, i + 80)); - } - - return locationStr + printPrefixedLines([["".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) { - return ['', subLine]; - }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]])); - } - - return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"], - ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]); -} - -function printPrefixedLines(lines) { - var existingLines = lines.filter(function (_ref) { - var _ = _ref[0], - line = _ref[1]; - return line !== undefined; - }); - var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) { - var prefix = _ref2[0]; - return prefix.length; - })); - return existingLines.map(function (_ref3) { - var prefix = _ref3[0], - line = _ref3[1]; - return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |'); - }).join('\n'); -} - -function whitespace(len) { - return Array(len + 1).join(' '); -} - -function leftPad(len, str) { - return whitespace(len - str.length) + str; -} diff --git a/node_modules/graphql/language/printLocation.js.flow b/node_modules/graphql/language/printLocation.js.flow deleted file mode 100644 index db3bf91b..00000000 --- a/node_modules/graphql/language/printLocation.js.flow +++ /dev/null @@ -1,88 +0,0 @@ -// @flow strict -import type { Source } from './source'; -import type { Location } from './ast'; -import type { SourceLocation } from './location'; -import { getLocation } from './location'; - -/** - * Render a helpful description of the location in the GraphQL Source document. - */ -export function printLocation(location: Location): string { - return printSourceLocation( - location.source, - getLocation(location.source, location.start), - ); -} - -/** - * Render a helpful description of the location in the GraphQL Source document. - */ -export function printSourceLocation( - source: Source, - sourceLocation: SourceLocation, -): string { - const firstLineColumnOffset = source.locationOffset.column - 1; - const body = whitespace(firstLineColumnOffset) + source.body; - - const lineIndex = sourceLocation.line - 1; - const lineOffset = source.locationOffset.line - 1; - const lineNum = sourceLocation.line + lineOffset; - - const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; - const columnNum = sourceLocation.column + columnOffset; - const locationStr = `${source.name}:${lineNum}:${columnNum}\n`; - - const lines = body.split(/\r\n|[\n\r]/g); - const locationLine = lines[lineIndex]; - - // Special case for minified documents - if (locationLine.length > 120) { - const subLineIndex = Math.floor(columnNum / 80); - const subLineColumnNum = columnNum % 80; - const subLines = []; - for (let i = 0; i < locationLine.length; i += 80) { - subLines.push(locationLine.slice(i, i + 80)); - } - - return ( - locationStr + - printPrefixedLines([ - [`${lineNum}`, subLines[0]], - ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['', subLine]), - [' ', whitespace(subLineColumnNum - 1) + '^'], - ['', subLines[subLineIndex + 1]], - ]) - ); - } - - return ( - locationStr + - printPrefixedLines([ - // Lines specified like this: ["prefix", "string"], - [`${lineNum - 1}`, lines[lineIndex - 1]], - [`${lineNum}`, locationLine], - ['', whitespace(columnNum - 1) + '^'], - [`${lineNum + 1}`, lines[lineIndex + 1]], - ]) - ); -} - -function printPrefixedLines(lines: $ReadOnlyArray<[string, string]>): string { - const existingLines = lines.filter(([_, line]) => line !== undefined); - - const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); - return existingLines - .map( - ([prefix, line]) => - leftPad(padLen, prefix) + (line ? ' | ' + line : ' |'), - ) - .join('\n'); -} - -function whitespace(len: number): string { - return Array(len + 1).join(' '); -} - -function leftPad(len: number, str: string): string { - return whitespace(len - str.length) + str; -} diff --git a/node_modules/graphql/language/printLocation.mjs b/node_modules/graphql/language/printLocation.mjs deleted file mode 100644 index c683f26d..00000000 --- a/node_modules/graphql/language/printLocation.mjs +++ /dev/null @@ -1,66 +0,0 @@ -import { getLocation } from "./location.mjs"; -/** - * Render a helpful description of the location in the GraphQL Source document. - */ - -export function printLocation(location) { - return printSourceLocation(location.source, getLocation(location.source, location.start)); -} -/** - * Render a helpful description of the location in the GraphQL Source document. - */ - -export function printSourceLocation(source, sourceLocation) { - var firstLineColumnOffset = source.locationOffset.column - 1; - var body = whitespace(firstLineColumnOffset) + source.body; - var lineIndex = sourceLocation.line - 1; - var lineOffset = source.locationOffset.line - 1; - var lineNum = sourceLocation.line + lineOffset; - var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; - var columnNum = sourceLocation.column + columnOffset; - var locationStr = "".concat(source.name, ":").concat(lineNum, ":").concat(columnNum, "\n"); - var lines = body.split(/\r\n|[\n\r]/g); - var locationLine = lines[lineIndex]; // Special case for minified documents - - if (locationLine.length > 120) { - var subLineIndex = Math.floor(columnNum / 80); - var subLineColumnNum = columnNum % 80; - var subLines = []; - - for (var i = 0; i < locationLine.length; i += 80) { - subLines.push(locationLine.slice(i, i + 80)); - } - - return locationStr + printPrefixedLines([["".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) { - return ['', subLine]; - }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]])); - } - - return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"], - ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]); -} - -function printPrefixedLines(lines) { - var existingLines = lines.filter(function (_ref) { - var _ = _ref[0], - line = _ref[1]; - return line !== undefined; - }); - var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) { - var prefix = _ref2[0]; - return prefix.length; - })); - return existingLines.map(function (_ref3) { - var prefix = _ref3[0], - line = _ref3[1]; - return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |'); - }).join('\n'); -} - -function whitespace(len) { - return Array(len + 1).join(' '); -} - -function leftPad(len, str) { - return whitespace(len - str.length) + str; -} diff --git a/node_modules/graphql/language/printer.d.ts b/node_modules/graphql/language/printer.d.ts deleted file mode 100644 index 9329b459..00000000 --- a/node_modules/graphql/language/printer.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ASTNode } from './ast'; - -/** - * Converts an AST into a string, using one set of reasonable - * formatting rules. - */ -export function print(ast: ASTNode): string; diff --git a/node_modules/graphql/language/printer.js b/node_modules/graphql/language/printer.js deleted file mode 100644 index b76814bf..00000000 --- a/node_modules/graphql/language/printer.js +++ /dev/null @@ -1,322 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.print = print; - -var _visitor = require("./visitor.js"); - -var _blockString = require("./blockString.js"); - -/** - * Converts an AST into a string, using one set of reasonable - * formatting rules. - */ -function print(ast) { - return (0, _visitor.visit)(ast, { - leave: printDocASTReducer - }); -} - -var MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future - -var printDocASTReducer = { - Name: function Name(node) { - return node.value; - }, - Variable: function Variable(node) { - return '$' + node.name; - }, - // Document - Document: function Document(node) { - return join(node.definitions, '\n\n') + '\n'; - }, - OperationDefinition: function OperationDefinition(node) { - var op = node.operation; - var name = node.name; - var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); - var directives = join(node.directives, ' '); - var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use - // the query short form. - - return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' '); - }, - VariableDefinition: function VariableDefinition(_ref) { - var variable = _ref.variable, - type = _ref.type, - defaultValue = _ref.defaultValue, - directives = _ref.directives; - return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' ')); - }, - SelectionSet: function SelectionSet(_ref2) { - var selections = _ref2.selections; - return block(selections); - }, - Field: function Field(_ref3) { - var alias = _ref3.alias, - name = _ref3.name, - args = _ref3.arguments, - directives = _ref3.directives, - selectionSet = _ref3.selectionSet; - var prefix = wrap('', alias, ': ') + name; - var argsLine = prefix + wrap('(', join(args, ', '), ')'); - - if (argsLine.length > MAX_LINE_LENGTH) { - argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); - } - - return join([argsLine, join(directives, ' '), selectionSet], ' '); - }, - Argument: function Argument(_ref4) { - var name = _ref4.name, - value = _ref4.value; - return name + ': ' + value; - }, - // Fragments - FragmentSpread: function FragmentSpread(_ref5) { - var name = _ref5.name, - directives = _ref5.directives; - return '...' + name + wrap(' ', join(directives, ' ')); - }, - InlineFragment: function InlineFragment(_ref6) { - var typeCondition = _ref6.typeCondition, - directives = _ref6.directives, - selectionSet = _ref6.selectionSet; - return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); - }, - FragmentDefinition: function FragmentDefinition(_ref7) { - var name = _ref7.name, - typeCondition = _ref7.typeCondition, - variableDefinitions = _ref7.variableDefinitions, - directives = _ref7.directives, - selectionSet = _ref7.selectionSet; - return (// Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet - ); - }, - // Value - IntValue: function IntValue(_ref8) { - var value = _ref8.value; - return value; - }, - FloatValue: function FloatValue(_ref9) { - var value = _ref9.value; - return value; - }, - StringValue: function StringValue(_ref10, key) { - var value = _ref10.value, - isBlockString = _ref10.block; - return isBlockString ? (0, _blockString.printBlockString)(value, key === 'description' ? '' : ' ') : JSON.stringify(value); - }, - BooleanValue: function BooleanValue(_ref11) { - var value = _ref11.value; - return value ? 'true' : 'false'; - }, - NullValue: function NullValue() { - return 'null'; - }, - EnumValue: function EnumValue(_ref12) { - var value = _ref12.value; - return value; - }, - ListValue: function ListValue(_ref13) { - var values = _ref13.values; - return '[' + join(values, ', ') + ']'; - }, - ObjectValue: function ObjectValue(_ref14) { - var fields = _ref14.fields; - return '{' + join(fields, ', ') + '}'; - }, - ObjectField: function ObjectField(_ref15) { - var name = _ref15.name, - value = _ref15.value; - return name + ': ' + value; - }, - // Directive - Directive: function Directive(_ref16) { - var name = _ref16.name, - args = _ref16.arguments; - return '@' + name + wrap('(', join(args, ', '), ')'); - }, - // Type - NamedType: function NamedType(_ref17) { - var name = _ref17.name; - return name; - }, - ListType: function ListType(_ref18) { - var type = _ref18.type; - return '[' + type + ']'; - }, - NonNullType: function NonNullType(_ref19) { - var type = _ref19.type; - return type + '!'; - }, - // Type System Definitions - SchemaDefinition: addDescription(function (_ref20) { - var directives = _ref20.directives, - operationTypes = _ref20.operationTypes; - return join(['schema', join(directives, ' '), block(operationTypes)], ' '); - }), - OperationTypeDefinition: function OperationTypeDefinition(_ref21) { - var operation = _ref21.operation, - type = _ref21.type; - return operation + ': ' + type; - }, - ScalarTypeDefinition: addDescription(function (_ref22) { - var name = _ref22.name, - directives = _ref22.directives; - return join(['scalar', name, join(directives, ' ')], ' '); - }), - ObjectTypeDefinition: addDescription(function (_ref23) { - var name = _ref23.name, - interfaces = _ref23.interfaces, - directives = _ref23.directives, - fields = _ref23.fields; - return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }), - FieldDefinition: addDescription(function (_ref24) { - var name = _ref24.name, - args = _ref24.arguments, - type = _ref24.type, - directives = _ref24.directives; - return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' ')); - }), - InputValueDefinition: addDescription(function (_ref25) { - var name = _ref25.name, - type = _ref25.type, - defaultValue = _ref25.defaultValue, - directives = _ref25.directives; - return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '); - }), - InterfaceTypeDefinition: addDescription(function (_ref26) { - var name = _ref26.name, - interfaces = _ref26.interfaces, - directives = _ref26.directives, - fields = _ref26.fields; - return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }), - UnionTypeDefinition: addDescription(function (_ref27) { - var name = _ref27.name, - directives = _ref27.directives, - types = _ref27.types; - return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); - }), - EnumTypeDefinition: addDescription(function (_ref28) { - var name = _ref28.name, - directives = _ref28.directives, - values = _ref28.values; - return join(['enum', name, join(directives, ' '), block(values)], ' '); - }), - EnumValueDefinition: addDescription(function (_ref29) { - var name = _ref29.name, - directives = _ref29.directives; - return join([name, join(directives, ' ')], ' '); - }), - InputObjectTypeDefinition: addDescription(function (_ref30) { - var name = _ref30.name, - directives = _ref30.directives, - fields = _ref30.fields; - return join(['input', name, join(directives, ' '), block(fields)], ' '); - }), - DirectiveDefinition: addDescription(function (_ref31) { - var name = _ref31.name, - args = _ref31.arguments, - repeatable = _ref31.repeatable, - locations = _ref31.locations; - return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | '); - }), - SchemaExtension: function SchemaExtension(_ref32) { - var directives = _ref32.directives, - operationTypes = _ref32.operationTypes; - return join(['extend schema', join(directives, ' '), block(operationTypes)], ' '); - }, - ScalarTypeExtension: function ScalarTypeExtension(_ref33) { - var name = _ref33.name, - directives = _ref33.directives; - return join(['extend scalar', name, join(directives, ' ')], ' '); - }, - ObjectTypeExtension: function ObjectTypeExtension(_ref34) { - var name = _ref34.name, - interfaces = _ref34.interfaces, - directives = _ref34.directives, - fields = _ref34.fields; - return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }, - InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) { - var name = _ref35.name, - interfaces = _ref35.interfaces, - directives = _ref35.directives, - fields = _ref35.fields; - return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }, - UnionTypeExtension: function UnionTypeExtension(_ref36) { - var name = _ref36.name, - directives = _ref36.directives, - types = _ref36.types; - return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); - }, - EnumTypeExtension: function EnumTypeExtension(_ref37) { - var name = _ref37.name, - directives = _ref37.directives, - values = _ref37.values; - return join(['extend enum', name, join(directives, ' '), block(values)], ' '); - }, - InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) { - var name = _ref38.name, - directives = _ref38.directives, - fields = _ref38.fields; - return join(['extend input', name, join(directives, ' '), block(fields)], ' '); - } -}; - -function addDescription(cb) { - return function (node) { - return join([node.description, cb(node)], '\n'); - }; -} -/** - * Given maybeArray, print an empty string if it is null or empty, otherwise - * print all items together separated by separator if provided - */ - - -function join(maybeArray) { - var _maybeArray$filter$jo; - - var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) { - return x; - }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ''; -} -/** - * Given array, print each item on its own line, wrapped in an - * indented "{ }" block. - */ - - -function block(array) { - return wrap('{\n', indent(join(array, '\n')), '\n}'); -} -/** - * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. - */ - - -function wrap(start, maybeString) { - var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - return maybeString != null && maybeString !== '' ? start + maybeString + end : ''; -} - -function indent(str) { - return wrap(' ', str.replace(/\n/g, '\n ')); -} - -function isMultiline(str) { - return str.indexOf('\n') !== -1; -} - -function hasMultilineItems(maybeArray) { - return maybeArray != null && maybeArray.some(isMultiline); -} diff --git a/node_modules/graphql/language/printer.js.flow b/node_modules/graphql/language/printer.js.flow deleted file mode 100644 index efaff6ca..00000000 --- a/node_modules/graphql/language/printer.js.flow +++ /dev/null @@ -1,292 +0,0 @@ -// @flow strict -import type { ASTNode } from './ast'; - -import { visit } from './visitor'; -import { printBlockString } from './blockString'; - -/** - * Converts an AST into a string, using one set of reasonable - * formatting rules. - */ -export function print(ast: ASTNode): string { - return visit(ast, { leave: printDocASTReducer }); -} - -const MAX_LINE_LENGTH = 80; - -// TODO: provide better type coverage in future -const printDocASTReducer: any = { - Name: (node) => node.value, - Variable: (node) => '$' + node.name, - - // Document - - Document: (node) => join(node.definitions, '\n\n') + '\n', - - OperationDefinition(node) { - const op = node.operation; - const name = node.name; - const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); - const directives = join(node.directives, ' '); - const selectionSet = node.selectionSet; - // Anonymous queries with no directives or variable definitions can use - // the query short form. - return !name && !directives && !varDefs && op === 'query' - ? selectionSet - : join([op, join([name, varDefs]), directives, selectionSet], ' '); - }, - - VariableDefinition: ({ variable, type, defaultValue, directives }) => - variable + - ': ' + - type + - wrap(' = ', defaultValue) + - wrap(' ', join(directives, ' ')), - SelectionSet: ({ selections }) => block(selections), - - Field: ({ alias, name, arguments: args, directives, selectionSet }) => { - const prefix = wrap('', alias, ': ') + name; - let argsLine = prefix + wrap('(', join(args, ', '), ')'); - - if (argsLine.length > MAX_LINE_LENGTH) { - argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); - } - - return join([argsLine, join(directives, ' '), selectionSet], ' '); - }, - - Argument: ({ name, value }) => name + ': ' + value, - - // Fragments - - FragmentSpread: ({ name, directives }) => - '...' + name + wrap(' ', join(directives, ' ')), - - InlineFragment: ({ typeCondition, directives, selectionSet }) => - join( - ['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], - ' ', - ), - - FragmentDefinition: ({ - name, - typeCondition, - variableDefinitions, - directives, - selectionSet, - }) => - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` + - `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` + - selectionSet, - - // Value - - IntValue: ({ value }) => value, - FloatValue: ({ value }) => value, - StringValue: ({ value, block: isBlockString }, key) => - isBlockString - ? printBlockString(value, key === 'description' ? '' : ' ') - : JSON.stringify(value), - BooleanValue: ({ value }) => (value ? 'true' : 'false'), - NullValue: () => 'null', - EnumValue: ({ value }) => value, - ListValue: ({ values }) => '[' + join(values, ', ') + ']', - ObjectValue: ({ fields }) => '{' + join(fields, ', ') + '}', - ObjectField: ({ name, value }) => name + ': ' + value, - - // Directive - - Directive: ({ name, arguments: args }) => - '@' + name + wrap('(', join(args, ', '), ')'), - - // Type - - NamedType: ({ name }) => name, - ListType: ({ type }) => '[' + type + ']', - NonNullType: ({ type }) => type + '!', - - // Type System Definitions - - SchemaDefinition: addDescription(({ directives, operationTypes }) => - join(['schema', join(directives, ' '), block(operationTypes)], ' '), - ), - - OperationTypeDefinition: ({ operation, type }) => operation + ': ' + type, - - ScalarTypeDefinition: addDescription(({ name, directives }) => - join(['scalar', name, join(directives, ' ')], ' '), - ), - - ObjectTypeDefinition: addDescription( - ({ name, interfaces, directives, fields }) => - join( - [ - 'type', - name, - wrap('implements ', join(interfaces, ' & ')), - join(directives, ' '), - block(fields), - ], - ' ', - ), - ), - - FieldDefinition: addDescription( - ({ name, arguments: args, type, directives }) => - name + - (hasMultilineItems(args) - ? wrap('(\n', indent(join(args, '\n')), '\n)') - : wrap('(', join(args, ', '), ')')) + - ': ' + - type + - wrap(' ', join(directives, ' ')), - ), - - InputValueDefinition: addDescription( - ({ name, type, defaultValue, directives }) => - join( - [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], - ' ', - ), - ), - - InterfaceTypeDefinition: addDescription( - ({ name, interfaces, directives, fields }) => - join( - [ - 'interface', - name, - wrap('implements ', join(interfaces, ' & ')), - join(directives, ' '), - block(fields), - ], - ' ', - ), - ), - - UnionTypeDefinition: addDescription(({ name, directives, types }) => - join( - [ - 'union', - name, - join(directives, ' '), - types && types.length !== 0 ? '= ' + join(types, ' | ') : '', - ], - ' ', - ), - ), - - EnumTypeDefinition: addDescription(({ name, directives, values }) => - join(['enum', name, join(directives, ' '), block(values)], ' '), - ), - - EnumValueDefinition: addDescription(({ name, directives }) => - join([name, join(directives, ' ')], ' '), - ), - - InputObjectTypeDefinition: addDescription(({ name, directives, fields }) => - join(['input', name, join(directives, ' '), block(fields)], ' '), - ), - - DirectiveDefinition: addDescription( - ({ name, arguments: args, repeatable, locations }) => - 'directive @' + - name + - (hasMultilineItems(args) - ? wrap('(\n', indent(join(args, '\n')), '\n)') - : wrap('(', join(args, ', '), ')')) + - (repeatable ? ' repeatable' : '') + - ' on ' + - join(locations, ' | '), - ), - - SchemaExtension: ({ directives, operationTypes }) => - join(['extend schema', join(directives, ' '), block(operationTypes)], ' '), - - ScalarTypeExtension: ({ name, directives }) => - join(['extend scalar', name, join(directives, ' ')], ' '), - - ObjectTypeExtension: ({ name, interfaces, directives, fields }) => - join( - [ - 'extend type', - name, - wrap('implements ', join(interfaces, ' & ')), - join(directives, ' '), - block(fields), - ], - ' ', - ), - - InterfaceTypeExtension: ({ name, interfaces, directives, fields }) => - join( - [ - 'extend interface', - name, - wrap('implements ', join(interfaces, ' & ')), - join(directives, ' '), - block(fields), - ], - ' ', - ), - - UnionTypeExtension: ({ name, directives, types }) => - join( - [ - 'extend union', - name, - join(directives, ' '), - types && types.length !== 0 ? '= ' + join(types, ' | ') : '', - ], - ' ', - ), - - EnumTypeExtension: ({ name, directives, values }) => - join(['extend enum', name, join(directives, ' '), block(values)], ' '), - - InputObjectTypeExtension: ({ name, directives, fields }) => - join(['extend input', name, join(directives, ' '), block(fields)], ' '), -}; - -function addDescription(cb) { - return (node) => join([node.description, cb(node)], '\n'); -} - -/** - * Given maybeArray, print an empty string if it is null or empty, otherwise - * print all items together separated by separator if provided - */ -function join(maybeArray: ?Array, separator = ''): string { - return maybeArray?.filter((x) => x).join(separator) ?? ''; -} - -/** - * Given array, print each item on its own line, wrapped in an - * indented "{ }" block. - */ -function block(array: ?Array): string { - return wrap('{\n', indent(join(array, '\n')), '\n}'); -} - -/** - * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. - */ -function wrap(start: string, maybeString: ?string, end: string = ''): string { - return maybeString != null && maybeString !== '' - ? start + maybeString + end - : ''; -} - -function indent(str: string): string { - return wrap(' ', str.replace(/\n/g, '\n ')); -} - -function isMultiline(str: string): boolean { - return str.indexOf('\n') !== -1; -} - -function hasMultilineItems(maybeArray: ?Array): boolean { - return maybeArray != null && maybeArray.some(isMultiline); -} diff --git a/node_modules/graphql/language/printer.mjs b/node_modules/graphql/language/printer.mjs deleted file mode 100644 index 24353111..00000000 --- a/node_modules/graphql/language/printer.mjs +++ /dev/null @@ -1,313 +0,0 @@ -import { visit } from "./visitor.mjs"; -import { printBlockString } from "./blockString.mjs"; -/** - * Converts an AST into a string, using one set of reasonable - * formatting rules. - */ - -export function print(ast) { - return visit(ast, { - leave: printDocASTReducer - }); -} -var MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future - -var printDocASTReducer = { - Name: function Name(node) { - return node.value; - }, - Variable: function Variable(node) { - return '$' + node.name; - }, - // Document - Document: function Document(node) { - return join(node.definitions, '\n\n') + '\n'; - }, - OperationDefinition: function OperationDefinition(node) { - var op = node.operation; - var name = node.name; - var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); - var directives = join(node.directives, ' '); - var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use - // the query short form. - - return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' '); - }, - VariableDefinition: function VariableDefinition(_ref) { - var variable = _ref.variable, - type = _ref.type, - defaultValue = _ref.defaultValue, - directives = _ref.directives; - return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' ')); - }, - SelectionSet: function SelectionSet(_ref2) { - var selections = _ref2.selections; - return block(selections); - }, - Field: function Field(_ref3) { - var alias = _ref3.alias, - name = _ref3.name, - args = _ref3.arguments, - directives = _ref3.directives, - selectionSet = _ref3.selectionSet; - var prefix = wrap('', alias, ': ') + name; - var argsLine = prefix + wrap('(', join(args, ', '), ')'); - - if (argsLine.length > MAX_LINE_LENGTH) { - argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); - } - - return join([argsLine, join(directives, ' '), selectionSet], ' '); - }, - Argument: function Argument(_ref4) { - var name = _ref4.name, - value = _ref4.value; - return name + ': ' + value; - }, - // Fragments - FragmentSpread: function FragmentSpread(_ref5) { - var name = _ref5.name, - directives = _ref5.directives; - return '...' + name + wrap(' ', join(directives, ' ')); - }, - InlineFragment: function InlineFragment(_ref6) { - var typeCondition = _ref6.typeCondition, - directives = _ref6.directives, - selectionSet = _ref6.selectionSet; - return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); - }, - FragmentDefinition: function FragmentDefinition(_ref7) { - var name = _ref7.name, - typeCondition = _ref7.typeCondition, - variableDefinitions = _ref7.variableDefinitions, - directives = _ref7.directives, - selectionSet = _ref7.selectionSet; - return (// Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet - ); - }, - // Value - IntValue: function IntValue(_ref8) { - var value = _ref8.value; - return value; - }, - FloatValue: function FloatValue(_ref9) { - var value = _ref9.value; - return value; - }, - StringValue: function StringValue(_ref10, key) { - var value = _ref10.value, - isBlockString = _ref10.block; - return isBlockString ? printBlockString(value, key === 'description' ? '' : ' ') : JSON.stringify(value); - }, - BooleanValue: function BooleanValue(_ref11) { - var value = _ref11.value; - return value ? 'true' : 'false'; - }, - NullValue: function NullValue() { - return 'null'; - }, - EnumValue: function EnumValue(_ref12) { - var value = _ref12.value; - return value; - }, - ListValue: function ListValue(_ref13) { - var values = _ref13.values; - return '[' + join(values, ', ') + ']'; - }, - ObjectValue: function ObjectValue(_ref14) { - var fields = _ref14.fields; - return '{' + join(fields, ', ') + '}'; - }, - ObjectField: function ObjectField(_ref15) { - var name = _ref15.name, - value = _ref15.value; - return name + ': ' + value; - }, - // Directive - Directive: function Directive(_ref16) { - var name = _ref16.name, - args = _ref16.arguments; - return '@' + name + wrap('(', join(args, ', '), ')'); - }, - // Type - NamedType: function NamedType(_ref17) { - var name = _ref17.name; - return name; - }, - ListType: function ListType(_ref18) { - var type = _ref18.type; - return '[' + type + ']'; - }, - NonNullType: function NonNullType(_ref19) { - var type = _ref19.type; - return type + '!'; - }, - // Type System Definitions - SchemaDefinition: addDescription(function (_ref20) { - var directives = _ref20.directives, - operationTypes = _ref20.operationTypes; - return join(['schema', join(directives, ' '), block(operationTypes)], ' '); - }), - OperationTypeDefinition: function OperationTypeDefinition(_ref21) { - var operation = _ref21.operation, - type = _ref21.type; - return operation + ': ' + type; - }, - ScalarTypeDefinition: addDescription(function (_ref22) { - var name = _ref22.name, - directives = _ref22.directives; - return join(['scalar', name, join(directives, ' ')], ' '); - }), - ObjectTypeDefinition: addDescription(function (_ref23) { - var name = _ref23.name, - interfaces = _ref23.interfaces, - directives = _ref23.directives, - fields = _ref23.fields; - return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }), - FieldDefinition: addDescription(function (_ref24) { - var name = _ref24.name, - args = _ref24.arguments, - type = _ref24.type, - directives = _ref24.directives; - return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' ')); - }), - InputValueDefinition: addDescription(function (_ref25) { - var name = _ref25.name, - type = _ref25.type, - defaultValue = _ref25.defaultValue, - directives = _ref25.directives; - return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '); - }), - InterfaceTypeDefinition: addDescription(function (_ref26) { - var name = _ref26.name, - interfaces = _ref26.interfaces, - directives = _ref26.directives, - fields = _ref26.fields; - return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }), - UnionTypeDefinition: addDescription(function (_ref27) { - var name = _ref27.name, - directives = _ref27.directives, - types = _ref27.types; - return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); - }), - EnumTypeDefinition: addDescription(function (_ref28) { - var name = _ref28.name, - directives = _ref28.directives, - values = _ref28.values; - return join(['enum', name, join(directives, ' '), block(values)], ' '); - }), - EnumValueDefinition: addDescription(function (_ref29) { - var name = _ref29.name, - directives = _ref29.directives; - return join([name, join(directives, ' ')], ' '); - }), - InputObjectTypeDefinition: addDescription(function (_ref30) { - var name = _ref30.name, - directives = _ref30.directives, - fields = _ref30.fields; - return join(['input', name, join(directives, ' '), block(fields)], ' '); - }), - DirectiveDefinition: addDescription(function (_ref31) { - var name = _ref31.name, - args = _ref31.arguments, - repeatable = _ref31.repeatable, - locations = _ref31.locations; - return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | '); - }), - SchemaExtension: function SchemaExtension(_ref32) { - var directives = _ref32.directives, - operationTypes = _ref32.operationTypes; - return join(['extend schema', join(directives, ' '), block(operationTypes)], ' '); - }, - ScalarTypeExtension: function ScalarTypeExtension(_ref33) { - var name = _ref33.name, - directives = _ref33.directives; - return join(['extend scalar', name, join(directives, ' ')], ' '); - }, - ObjectTypeExtension: function ObjectTypeExtension(_ref34) { - var name = _ref34.name, - interfaces = _ref34.interfaces, - directives = _ref34.directives, - fields = _ref34.fields; - return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }, - InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) { - var name = _ref35.name, - interfaces = _ref35.interfaces, - directives = _ref35.directives, - fields = _ref35.fields; - return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }, - UnionTypeExtension: function UnionTypeExtension(_ref36) { - var name = _ref36.name, - directives = _ref36.directives, - types = _ref36.types; - return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); - }, - EnumTypeExtension: function EnumTypeExtension(_ref37) { - var name = _ref37.name, - directives = _ref37.directives, - values = _ref37.values; - return join(['extend enum', name, join(directives, ' '), block(values)], ' '); - }, - InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) { - var name = _ref38.name, - directives = _ref38.directives, - fields = _ref38.fields; - return join(['extend input', name, join(directives, ' '), block(fields)], ' '); - } -}; - -function addDescription(cb) { - return function (node) { - return join([node.description, cb(node)], '\n'); - }; -} -/** - * Given maybeArray, print an empty string if it is null or empty, otherwise - * print all items together separated by separator if provided - */ - - -function join(maybeArray) { - var _maybeArray$filter$jo; - - var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) { - return x; - }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ''; -} -/** - * Given array, print each item on its own line, wrapped in an - * indented "{ }" block. - */ - - -function block(array) { - return wrap('{\n', indent(join(array, '\n')), '\n}'); -} -/** - * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. - */ - - -function wrap(start, maybeString) { - var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - return maybeString != null && maybeString !== '' ? start + maybeString + end : ''; -} - -function indent(str) { - return wrap(' ', str.replace(/\n/g, '\n ')); -} - -function isMultiline(str) { - return str.indexOf('\n') !== -1; -} - -function hasMultilineItems(maybeArray) { - return maybeArray != null && maybeArray.some(isMultiline); -} diff --git a/node_modules/graphql/language/source.d.ts b/node_modules/graphql/language/source.d.ts deleted file mode 100644 index a7df7cbb..00000000 --- a/node_modules/graphql/language/source.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -interface Location { - line: number; - column: number; -} - -/** - * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are - * optional, but they are useful for clients who store GraphQL documents in source files. - * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might - * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. - * The `line` and `column` properties in `locationOffset` are 1-indexed. - */ -export class Source { - body: string; - name: string; - locationOffset: Location; - constructor(body: string, name?: string, locationOffset?: Location); -} - -/** - * Test if the given value is a Source object. - * - * @internal - */ -export function isSource(source: any): source is Source; diff --git a/node_modules/graphql/language/source.js b/node_modules/graphql/language/source.js deleted file mode 100644 index 7b195031..00000000 --- a/node_modules/graphql/language/source.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isSource = isSource; -exports.Source = void 0; - -var _symbols = require("../polyfills/symbols.js"); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _instanceOf = _interopRequireDefault(require("../jsutils/instanceOf.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -/** - * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are - * optional, but they are useful for clients who store GraphQL documents in source files. - * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might - * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. - * The `line` and `column` properties in `locationOffset` are 1-indexed. - */ -var Source = /*#__PURE__*/function () { - function Source(body) { - var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GraphQL request'; - var locationOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { - line: 1, - column: 1 - }; - typeof body === 'string' || (0, _devAssert.default)(0, "Body must be a string. Received: ".concat((0, _inspect.default)(body), ".")); - this.body = body; - this.name = name; - this.locationOffset = locationOffset; - this.locationOffset.line > 0 || (0, _devAssert.default)(0, 'line in locationOffset is 1-indexed and must be positive.'); - this.locationOffset.column > 0 || (0, _devAssert.default)(0, 'column in locationOffset is 1-indexed and must be positive.'); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - - - _createClass(Source, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'Source'; - } - }]); - - return Source; -}(); -/** - * Test if the given value is a Source object. - * - * @internal - */ - - -exports.Source = Source; - -// eslint-disable-next-line no-redeclare -function isSource(source) { - return (0, _instanceOf.default)(source, Source); -} diff --git a/node_modules/graphql/language/source.js.flow b/node_modules/graphql/language/source.js.flow deleted file mode 100644 index 74f8e857..00000000 --- a/node_modules/graphql/language/source.js.flow +++ /dev/null @@ -1,64 +0,0 @@ -// @flow strict -import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols'; - -import inspect from '../jsutils/inspect'; -import devAssert from '../jsutils/devAssert'; -import instanceOf from '../jsutils/instanceOf'; - -type Location = {| - line: number, - column: number, -|}; - -/** - * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are - * optional, but they are useful for clients who store GraphQL documents in source files. - * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might - * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. - * The `line` and `column` properties in `locationOffset` are 1-indexed. - */ -export class Source { - body: string; - name: string; - locationOffset: Location; - - constructor( - body: string, - name: string = 'GraphQL request', - locationOffset: Location = { line: 1, column: 1 }, - ): void { - devAssert( - typeof body === 'string', - `Body must be a string. Received: ${inspect(body)}.`, - ); - - this.body = body; - this.name = name; - this.locationOffset = locationOffset; - devAssert( - this.locationOffset.line > 0, - 'line in locationOffset is 1-indexed and must be positive.', - ); - devAssert( - this.locationOffset.column > 0, - 'column in locationOffset is 1-indexed and must be positive.', - ); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'Source'; - } -} - -/** - * Test if the given value is a Source object. - * - * @internal - */ -declare function isSource(source: mixed): boolean %checks(source instanceof - Source); -// eslint-disable-next-line no-redeclare -export function isSource(source) { - return instanceOf(source, Source); -} diff --git a/node_modules/graphql/language/source.mjs b/node_modules/graphql/language/source.mjs deleted file mode 100644 index e358f613..00000000 --- a/node_modules/graphql/language/source.mjs +++ /dev/null @@ -1,51 +0,0 @@ -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -import { SYMBOL_TO_STRING_TAG } from "../polyfills/symbols.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import devAssert from "../jsutils/devAssert.mjs"; -import instanceOf from "../jsutils/instanceOf.mjs"; - -/** - * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are - * optional, but they are useful for clients who store GraphQL documents in source files. - * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might - * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. - * The `line` and `column` properties in `locationOffset` are 1-indexed. - */ -export var Source = /*#__PURE__*/function () { - function Source(body) { - var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GraphQL request'; - var locationOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { - line: 1, - column: 1 - }; - typeof body === 'string' || devAssert(0, "Body must be a string. Received: ".concat(inspect(body), ".")); - this.body = body; - this.name = name; - this.locationOffset = locationOffset; - this.locationOffset.line > 0 || devAssert(0, 'line in locationOffset is 1-indexed and must be positive.'); - this.locationOffset.column > 0 || devAssert(0, 'column in locationOffset is 1-indexed and must be positive.'); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - - - _createClass(Source, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'Source'; - } - }]); - - return Source; -}(); -/** - * Test if the given value is a Source object. - * - * @internal - */ - -// eslint-disable-next-line no-redeclare -export function isSource(source) { - return instanceOf(source, Source); -} diff --git a/node_modules/graphql/language/tokenKind.d.ts b/node_modules/graphql/language/tokenKind.d.ts deleted file mode 100644 index fa27e232..00000000 --- a/node_modules/graphql/language/tokenKind.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * An exported enum describing the different kinds of tokens that the - * lexer emits. - */ -export const TokenKind: { - SOF: ''; - EOF: ''; - BANG: '!'; - DOLLAR: '$'; - AMP: '&'; - PAREN_L: '('; - PAREN_R: ')'; - SPREAD: '...'; - COLON: ':'; - EQUALS: '='; - AT: '@'; - BRACKET_L: '['; - BRACKET_R: ']'; - BRACE_L: '{'; - PIPE: '|'; - BRACE_R: '}'; - NAME: 'Name'; - INT: 'Int'; - FLOAT: 'Float'; - STRING: 'String'; - BLOCK_STRING: 'BlockString'; - COMMENT: 'Comment'; -}; - -/** - * The enum type representing the token kinds values. - */ -export type TokenKindEnum = typeof TokenKind[keyof typeof TokenKind]; diff --git a/node_modules/graphql/language/tokenKind.js b/node_modules/graphql/language/tokenKind.js deleted file mode 100644 index 3d5532d4..00000000 --- a/node_modules/graphql/language/tokenKind.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.TokenKind = void 0; - -/** - * An exported enum describing the different kinds of tokens that the - * lexer emits. - */ -var TokenKind = Object.freeze({ - SOF: '', - EOF: '', - BANG: '!', - DOLLAR: '$', - AMP: '&', - PAREN_L: '(', - PAREN_R: ')', - SPREAD: '...', - COLON: ':', - EQUALS: '=', - AT: '@', - BRACKET_L: '[', - BRACKET_R: ']', - BRACE_L: '{', - PIPE: '|', - BRACE_R: '}', - NAME: 'Name', - INT: 'Int', - FLOAT: 'Float', - STRING: 'String', - BLOCK_STRING: 'BlockString', - COMMENT: 'Comment' -}); -/** - * The enum type representing the token kinds values. - */ - -exports.TokenKind = TokenKind; diff --git a/node_modules/graphql/language/tokenKind.js.flow b/node_modules/graphql/language/tokenKind.js.flow deleted file mode 100644 index 70b3cfb3..00000000 --- a/node_modules/graphql/language/tokenKind.js.flow +++ /dev/null @@ -1,34 +0,0 @@ -// @flow strict -/** - * An exported enum describing the different kinds of tokens that the - * lexer emits. - */ -export const TokenKind = Object.freeze({ - SOF: '', - EOF: '', - BANG: '!', - DOLLAR: '$', - AMP: '&', - PAREN_L: '(', - PAREN_R: ')', - SPREAD: '...', - COLON: ':', - EQUALS: '=', - AT: '@', - BRACKET_L: '[', - BRACKET_R: ']', - BRACE_L: '{', - PIPE: '|', - BRACE_R: '}', - NAME: 'Name', - INT: 'Int', - FLOAT: 'Float', - STRING: 'String', - BLOCK_STRING: 'BlockString', - COMMENT: 'Comment', -}); - -/** - * The enum type representing the token kinds values. - */ -export type TokenKindEnum = $Values; diff --git a/node_modules/graphql/language/tokenKind.mjs b/node_modules/graphql/language/tokenKind.mjs deleted file mode 100644 index f100b992..00000000 --- a/node_modules/graphql/language/tokenKind.mjs +++ /dev/null @@ -1,31 +0,0 @@ -/** - * An exported enum describing the different kinds of tokens that the - * lexer emits. - */ -export var TokenKind = Object.freeze({ - SOF: '', - EOF: '', - BANG: '!', - DOLLAR: '$', - AMP: '&', - PAREN_L: '(', - PAREN_R: ')', - SPREAD: '...', - COLON: ':', - EQUALS: '=', - AT: '@', - BRACKET_L: '[', - BRACKET_R: ']', - BRACE_L: '{', - PIPE: '|', - BRACE_R: '}', - NAME: 'Name', - INT: 'Int', - FLOAT: 'Float', - STRING: 'String', - BLOCK_STRING: 'BlockString', - COMMENT: 'Comment' -}); -/** - * The enum type representing the token kinds values. - */ diff --git a/node_modules/graphql/language/visitor.d.ts b/node_modules/graphql/language/visitor.d.ts deleted file mode 100644 index 22e63466..00000000 --- a/node_modules/graphql/language/visitor.d.ts +++ /dev/null @@ -1,263 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { ASTNode, ASTKindToNode } from './ast'; - -/** - * A visitor is provided to visit, it contains the collection of - * relevant functions to be called during the visitor's traversal. - */ -export type ASTVisitor = Visitor; -export type Visitor = - | EnterLeaveVisitor - | ShapeMapVisitor; - -interface EnterLeave { - readonly enter?: T; - readonly leave?: T; -} - -type EnterLeaveVisitor = EnterLeave< - VisitFn | { [K in keyof KindToNode]?: VisitFn } ->; - -type ShapeMapVisitor = { - [K in keyof KindToNode]?: - | VisitFn - | EnterLeave>; -}; - -/** - * A visitor is comprised of visit functions, which are called on each node - * during the visitor's traversal. - */ -export type VisitFn = ( - /** The current node being visiting. */ - node: TVisitedNode, - /** The index or key to this node from the parent node or Array. */ - key: string | number | undefined, - /** The parent immediately above this node, which may be an Array. */ - parent: TAnyNode | ReadonlyArray | undefined, - /** The key path to get to this node from the root node. */ - path: ReadonlyArray, - /** - * All nodes and Arrays visited before reaching parent of this node. - * These correspond to array indices in `path`. - * Note: ancestors includes arrays which contain the parent of visited node. - */ - ancestors: ReadonlyArray>, -) => any; - -/** - * A KeyMap describes each the traversable properties of each kind of node. - */ -export type VisitorKeyMap = { [P in keyof T]: ReadonlyArray }; - -// TODO: Should be `[]`, but that requires TypeScript@3 -type EmptyTuple = Array; - -export const QueryDocumentKeys: { - Name: EmptyTuple; - - Document: ['definitions']; - // Prettier forces trailing commas, but TS pre 3.2 doesn't allow them. - // prettier-ignore - OperationDefinition: [ - 'name', - 'variableDefinitions', - 'directives', - 'selectionSet' - ]; - VariableDefinition: ['variable', 'type', 'defaultValue', 'directives']; - Variable: ['name']; - SelectionSet: ['selections']; - Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet']; - Argument: ['name', 'value']; - - FragmentSpread: ['name', 'directives']; - InlineFragment: ['typeCondition', 'directives', 'selectionSet']; - // prettier-ignore - FragmentDefinition: [ - 'name', - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - 'variableDefinitions', - 'typeCondition', - 'directives', - 'selectionSet' - ]; - - IntValue: EmptyTuple; - FloatValue: EmptyTuple; - StringValue: EmptyTuple; - BooleanValue: EmptyTuple; - NullValue: EmptyTuple; - EnumValue: EmptyTuple; - ListValue: ['values']; - ObjectValue: ['fields']; - ObjectField: ['name', 'value']; - - Directive: ['name', 'arguments']; - - NamedType: ['name']; - ListType: ['type']; - NonNullType: ['type']; - - SchemaDefinition: ['description', 'directives', 'operationTypes']; - OperationTypeDefinition: ['type']; - - ScalarTypeDefinition: ['description', 'name', 'directives']; - // prettier-ignore - ObjectTypeDefinition: [ - 'description', - 'name', - 'interfaces', - 'directives', - 'fields' - ]; - FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives']; - // prettier-ignore - InputValueDefinition: [ - 'description', - 'name', - 'type', - 'defaultValue', - 'directives' - ]; - // prettier-ignore - InterfaceTypeDefinition: [ - 'description', - 'name', - 'interfaces', - 'directives', - 'fields' - ]; - UnionTypeDefinition: ['description', 'name', 'directives', 'types']; - EnumTypeDefinition: ['description', 'name', 'directives', 'values']; - EnumValueDefinition: ['description', 'name', 'directives']; - InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields']; - - DirectiveDefinition: ['description', 'name', 'arguments', 'locations']; - - SchemaExtension: ['directives', 'operationTypes']; - - ScalarTypeExtension: ['name', 'directives']; - ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields']; - InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields']; - UnionTypeExtension: ['name', 'directives', 'types']; - EnumTypeExtension: ['name', 'directives', 'values']; - InputObjectTypeExtension: ['name', 'directives', 'fields']; -}; - -export const BREAK: any; - -/** - * visit() will walk through an AST using a depth-first traversal, calling - * the visitor's enter function at each node in the traversal, and calling the - * leave function after visiting that node and all of its child nodes. - * - * By returning different values from the enter and leave functions, the - * behavior of the visitor can be altered, including skipping over a sub-tree of - * the AST (by returning false), editing the AST by returning a value or null - * to remove the value, or to stop the whole traversal by returning BREAK. - * - * When using visit() to edit an AST, the original AST will not be modified, and - * a new version of the AST with the changes applied will be returned from the - * visit function. - * - * const editedAST = visit(ast, { - * enter(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: skip visiting this node - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * }, - * leave(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: no action - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * } - * }); - * - * Alternatively to providing enter() and leave() functions, a visitor can - * instead provide functions named the same as the kinds of AST nodes, or - * enter/leave visitors at a named key, leading to four permutations of the - * visitor API: - * - * 1) Named visitors triggered when entering a node of a specific kind. - * - * visit(ast, { - * Kind(node) { - * // enter the "Kind" node - * } - * }) - * - * 2) Named visitors that trigger upon entering and leaving a node of - * a specific kind. - * - * visit(ast, { - * Kind: { - * enter(node) { - * // enter the "Kind" node - * } - * leave(node) { - * // leave the "Kind" node - * } - * } - * }) - * - * 3) Generic visitors that trigger upon entering and leaving any node. - * - * visit(ast, { - * enter(node) { - * // enter any node - * }, - * leave(node) { - * // leave any node - * } - * }) - * - * 4) Parallel visitors for entering and leaving nodes of a specific kind. - * - * visit(ast, { - * enter: { - * Kind(node) { - * // enter the "Kind" node - * } - * }, - * leave: { - * Kind(node) { - * // leave the "Kind" node - * } - * } - * }) - */ -export function visit( - root: ASTNode, - visitor: Visitor, - visitorKeys?: VisitorKeyMap, // default: QueryDocumentKeys -): any; - -/** - * Creates a new visitor instance which delegates to many visitors to run in - * parallel. Each visitor will be visited for each node before moving on. - * - * If a prior visitor edits a node, no following visitors will see that node. - */ -export function visitInParallel( - visitors: ReadonlyArray>, -): Visitor; - -/** - * Given a visitor instance, if it is leaving or not, and a node kind, return - * the function the visitor runtime should call. - */ -export function getVisitFn( - visitor: Visitor, - kind: string, - isLeaving: boolean, -): Maybe>; diff --git a/node_modules/graphql/language/visitor.js b/node_modules/graphql/language/visitor.js deleted file mode 100644 index af31e836..00000000 --- a/node_modules/graphql/language/visitor.js +++ /dev/null @@ -1,397 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.visit = visit; -exports.visitInParallel = visitInParallel; -exports.getVisitFn = getVisitFn; -exports.BREAK = exports.QueryDocumentKeys = void 0; - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _ast = require("./ast.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var QueryDocumentKeys = { - Name: [], - Document: ['definitions'], - OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'], - VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], - Variable: ['name'], - SelectionSet: ['selections'], - Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], - Argument: ['name', 'value'], - FragmentSpread: ['name', 'directives'], - InlineFragment: ['typeCondition', 'directives', 'selectionSet'], - FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'], - IntValue: [], - FloatValue: [], - StringValue: [], - BooleanValue: [], - NullValue: [], - EnumValue: [], - ListValue: ['values'], - ObjectValue: ['fields'], - ObjectField: ['name', 'value'], - Directive: ['name', 'arguments'], - NamedType: ['name'], - ListType: ['type'], - NonNullType: ['type'], - SchemaDefinition: ['description', 'directives', 'operationTypes'], - OperationTypeDefinition: ['type'], - ScalarTypeDefinition: ['description', 'name', 'directives'], - ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], - FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], - InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'], - InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], - UnionTypeDefinition: ['description', 'name', 'directives', 'types'], - EnumTypeDefinition: ['description', 'name', 'directives', 'values'], - EnumValueDefinition: ['description', 'name', 'directives'], - InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], - DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], - SchemaExtension: ['directives', 'operationTypes'], - ScalarTypeExtension: ['name', 'directives'], - ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - UnionTypeExtension: ['name', 'directives', 'types'], - EnumTypeExtension: ['name', 'directives', 'values'], - InputObjectTypeExtension: ['name', 'directives', 'fields'] -}; -exports.QueryDocumentKeys = QueryDocumentKeys; -var BREAK = Object.freeze({}); -/** - * visit() will walk through an AST using a depth-first traversal, calling - * the visitor's enter function at each node in the traversal, and calling the - * leave function after visiting that node and all of its child nodes. - * - * By returning different values from the enter and leave functions, the - * behavior of the visitor can be altered, including skipping over a sub-tree of - * the AST (by returning false), editing the AST by returning a value or null - * to remove the value, or to stop the whole traversal by returning BREAK. - * - * When using visit() to edit an AST, the original AST will not be modified, and - * a new version of the AST with the changes applied will be returned from the - * visit function. - * - * const editedAST = visit(ast, { - * enter(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: skip visiting this node - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * }, - * leave(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: no action - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * } - * }); - * - * Alternatively to providing enter() and leave() functions, a visitor can - * instead provide functions named the same as the kinds of AST nodes, or - * enter/leave visitors at a named key, leading to four permutations of the - * visitor API: - * - * 1) Named visitors triggered when entering a node of a specific kind. - * - * visit(ast, { - * Kind(node) { - * // enter the "Kind" node - * } - * }) - * - * 2) Named visitors that trigger upon entering and leaving a node of - * a specific kind. - * - * visit(ast, { - * Kind: { - * enter(node) { - * // enter the "Kind" node - * } - * leave(node) { - * // leave the "Kind" node - * } - * } - * }) - * - * 3) Generic visitors that trigger upon entering and leaving any node. - * - * visit(ast, { - * enter(node) { - * // enter any node - * }, - * leave(node) { - * // leave any node - * } - * }) - * - * 4) Parallel visitors for entering and leaving nodes of a specific kind. - * - * visit(ast, { - * enter: { - * Kind(node) { - * // enter the "Kind" node - * } - * }, - * leave: { - * Kind(node) { - * // leave the "Kind" node - * } - * } - * }) - */ - -exports.BREAK = BREAK; - -function visit(root, visitor) { - var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys; - - /* eslint-disable no-undef-init */ - var stack = undefined; - var inArray = Array.isArray(root); - var keys = [root]; - var index = -1; - var edits = []; - var node = undefined; - var key = undefined; - var parent = undefined; - var path = []; - var ancestors = []; - var newRoot = root; - /* eslint-enable no-undef-init */ - - do { - index++; - var isLeaving = index === keys.length; - var isEdited = isLeaving && edits.length !== 0; - - if (isLeaving) { - key = ancestors.length === 0 ? undefined : path[path.length - 1]; - node = parent; - parent = ancestors.pop(); - - if (isEdited) { - if (inArray) { - node = node.slice(); - } else { - var clone = {}; - - for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) { - var k = _Object$keys2[_i2]; - clone[k] = node[k]; - } - - node = clone; - } - - var editOffset = 0; - - for (var ii = 0; ii < edits.length; ii++) { - var editKey = edits[ii][0]; - var editValue = edits[ii][1]; - - if (inArray) { - editKey -= editOffset; - } - - if (inArray && editValue === null) { - node.splice(editKey, 1); - editOffset++; - } else { - node[editKey] = editValue; - } - } - } - - index = stack.index; - keys = stack.keys; - edits = stack.edits; - inArray = stack.inArray; - stack = stack.prev; - } else { - key = parent ? inArray ? index : keys[index] : undefined; - node = parent ? parent[key] : newRoot; - - if (node === null || node === undefined) { - continue; - } - - if (parent) { - path.push(key); - } - } - - var result = void 0; - - if (!Array.isArray(node)) { - if (!(0, _ast.isNode)(node)) { - throw new Error("Invalid AST Node: ".concat((0, _inspect.default)(node), ".")); - } - - var visitFn = getVisitFn(visitor, node.kind, isLeaving); - - if (visitFn) { - result = visitFn.call(visitor, node, key, parent, path, ancestors); - - if (result === BREAK) { - break; - } - - if (result === false) { - if (!isLeaving) { - path.pop(); - continue; - } - } else if (result !== undefined) { - edits.push([key, result]); - - if (!isLeaving) { - if ((0, _ast.isNode)(result)) { - node = result; - } else { - path.pop(); - continue; - } - } - } - } - } - - if (result === undefined && isEdited) { - edits.push([key, node]); - } - - if (isLeaving) { - path.pop(); - } else { - var _visitorKeys$node$kin; - - stack = { - inArray: inArray, - index: index, - keys: keys, - edits: edits, - prev: stack - }; - inArray = Array.isArray(node); - keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : []; - index = -1; - edits = []; - - if (parent) { - ancestors.push(parent); - } - - parent = node; - } - } while (stack !== undefined); - - if (edits.length !== 0) { - newRoot = edits[edits.length - 1][1]; - } - - return newRoot; -} -/** - * Creates a new visitor instance which delegates to many visitors to run in - * parallel. Each visitor will be visited for each node before moving on. - * - * If a prior visitor edits a node, no following visitors will see that node. - */ - - -function visitInParallel(visitors) { - var skipping = new Array(visitors.length); - return { - enter: function enter(node) { - for (var i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - var fn = getVisitFn(visitors[i], node.kind, - /* isLeaving */ - false); - - if (fn) { - var result = fn.apply(visitors[i], arguments); - - if (result === false) { - skipping[i] = node; - } else if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined) { - return result; - } - } - } - } - }, - leave: function leave(node) { - for (var i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - var fn = getVisitFn(visitors[i], node.kind, - /* isLeaving */ - true); - - if (fn) { - var result = fn.apply(visitors[i], arguments); - - if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined && result !== false) { - return result; - } - } - } else if (skipping[i] === node) { - skipping[i] = null; - } - } - } - }; -} -/** - * Given a visitor instance, if it is leaving or not, and a node kind, return - * the function the visitor runtime should call. - */ - - -function getVisitFn(visitor, kind, isLeaving) { - var kindVisitor = visitor[kind]; - - if (kindVisitor) { - if (!isLeaving && typeof kindVisitor === 'function') { - // { Kind() {} } - return kindVisitor; - } - - var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter; - - if (typeof kindSpecificVisitor === 'function') { - // { Kind: { enter() {}, leave() {} } } - return kindSpecificVisitor; - } - } else { - var specificVisitor = isLeaving ? visitor.leave : visitor.enter; - - if (specificVisitor) { - if (typeof specificVisitor === 'function') { - // { enter() {}, leave() {} } - return specificVisitor; - } - - var specificKindVisitor = specificVisitor[kind]; - - if (typeof specificKindVisitor === 'function') { - // { enter: { Kind() {} }, leave: { Kind() {} } } - return specificKindVisitor; - } - } - } -} diff --git a/node_modules/graphql/language/visitor.js.flow b/node_modules/graphql/language/visitor.js.flow deleted file mode 100644 index b53d476e..00000000 --- a/node_modules/graphql/language/visitor.js.flow +++ /dev/null @@ -1,437 +0,0 @@ -// @flow strict -import inspect from '../jsutils/inspect'; - -import type { ASTNode, ASTKindToNode } from './ast'; -import { isNode } from './ast'; - -/** - * A visitor is provided to visit, it contains the collection of - * relevant functions to be called during the visitor's traversal. - */ -export type ASTVisitor = Visitor; -export type Visitor> = - | EnterLeave< - | VisitFn - | ShapeMap(Node) => VisitFn>, - > - | ShapeMap< - KindToNode, - (Node) => VisitFn | EnterLeave>, - >; -type EnterLeave = {| +enter?: T, +leave?: T |}; -type ShapeMap = $Shape<$ObjMap>; - -/** - * A visitor is comprised of visit functions, which are called on each node - * during the visitor's traversal. - */ -export type VisitFn = ( - // The current node being visiting. - node: TVisitedNode, - // The index or key to this node from the parent node or Array. - key: string | number | void, - // The parent immediately above this node, which may be an Array. - parent: TAnyNode | $ReadOnlyArray | void, - // The key path to get to this node from the root node. - path: $ReadOnlyArray, - // All nodes and Arrays visited before reaching parent of this node. - // These correspond to array indices in `path`. - // Note: ancestors includes arrays which contain the parent of visited node. - ancestors: $ReadOnlyArray>, -) => any; - -/** - * A KeyMap describes each the traversable properties of each kind of node. - */ -export type VisitorKeyMap = $ObjMap< - KindToNode, - (T) => $ReadOnlyArray<$Keys>, ->; - -export const QueryDocumentKeys: VisitorKeyMap = { - Name: [], - - Document: ['definitions'], - OperationDefinition: [ - 'name', - 'variableDefinitions', - 'directives', - 'selectionSet', - ], - VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], - Variable: ['name'], - SelectionSet: ['selections'], - Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], - Argument: ['name', 'value'], - - FragmentSpread: ['name', 'directives'], - InlineFragment: ['typeCondition', 'directives', 'selectionSet'], - FragmentDefinition: [ - 'name', - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - 'variableDefinitions', - 'typeCondition', - 'directives', - 'selectionSet', - ], - - IntValue: [], - FloatValue: [], - StringValue: [], - BooleanValue: [], - NullValue: [], - EnumValue: [], - ListValue: ['values'], - ObjectValue: ['fields'], - ObjectField: ['name', 'value'], - - Directive: ['name', 'arguments'], - - NamedType: ['name'], - ListType: ['type'], - NonNullType: ['type'], - - SchemaDefinition: ['description', 'directives', 'operationTypes'], - OperationTypeDefinition: ['type'], - - ScalarTypeDefinition: ['description', 'name', 'directives'], - ObjectTypeDefinition: [ - 'description', - 'name', - 'interfaces', - 'directives', - 'fields', - ], - FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], - InputValueDefinition: [ - 'description', - 'name', - 'type', - 'defaultValue', - 'directives', - ], - InterfaceTypeDefinition: [ - 'description', - 'name', - 'interfaces', - 'directives', - 'fields', - ], - UnionTypeDefinition: ['description', 'name', 'directives', 'types'], - EnumTypeDefinition: ['description', 'name', 'directives', 'values'], - EnumValueDefinition: ['description', 'name', 'directives'], - InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], - - DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], - - SchemaExtension: ['directives', 'operationTypes'], - - ScalarTypeExtension: ['name', 'directives'], - ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - UnionTypeExtension: ['name', 'directives', 'types'], - EnumTypeExtension: ['name', 'directives', 'values'], - InputObjectTypeExtension: ['name', 'directives', 'fields'], -}; - -export const BREAK: { ... } = Object.freeze({}); - -/** - * visit() will walk through an AST using a depth-first traversal, calling - * the visitor's enter function at each node in the traversal, and calling the - * leave function after visiting that node and all of its child nodes. - * - * By returning different values from the enter and leave functions, the - * behavior of the visitor can be altered, including skipping over a sub-tree of - * the AST (by returning false), editing the AST by returning a value or null - * to remove the value, or to stop the whole traversal by returning BREAK. - * - * When using visit() to edit an AST, the original AST will not be modified, and - * a new version of the AST with the changes applied will be returned from the - * visit function. - * - * const editedAST = visit(ast, { - * enter(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: skip visiting this node - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * }, - * leave(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: no action - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * } - * }); - * - * Alternatively to providing enter() and leave() functions, a visitor can - * instead provide functions named the same as the kinds of AST nodes, or - * enter/leave visitors at a named key, leading to four permutations of the - * visitor API: - * - * 1) Named visitors triggered when entering a node of a specific kind. - * - * visit(ast, { - * Kind(node) { - * // enter the "Kind" node - * } - * }) - * - * 2) Named visitors that trigger upon entering and leaving a node of - * a specific kind. - * - * visit(ast, { - * Kind: { - * enter(node) { - * // enter the "Kind" node - * } - * leave(node) { - * // leave the "Kind" node - * } - * } - * }) - * - * 3) Generic visitors that trigger upon entering and leaving any node. - * - * visit(ast, { - * enter(node) { - * // enter any node - * }, - * leave(node) { - * // leave any node - * } - * }) - * - * 4) Parallel visitors for entering and leaving nodes of a specific kind. - * - * visit(ast, { - * enter: { - * Kind(node) { - * // enter the "Kind" node - * } - * }, - * leave: { - * Kind(node) { - * // leave the "Kind" node - * } - * } - * }) - */ -export function visit( - root: ASTNode, - visitor: Visitor, - visitorKeys: VisitorKeyMap = QueryDocumentKeys, -): any { - /* eslint-disable no-undef-init */ - let stack: any = undefined; - let inArray = Array.isArray(root); - let keys: any = [root]; - let index = -1; - let edits = []; - let node: any = undefined; - let key: any = undefined; - let parent: any = undefined; - const path: any = []; - const ancestors = []; - let newRoot = root; - /* eslint-enable no-undef-init */ - - do { - index++; - const isLeaving = index === keys.length; - const isEdited = isLeaving && edits.length !== 0; - if (isLeaving) { - key = ancestors.length === 0 ? undefined : path[path.length - 1]; - node = parent; - parent = ancestors.pop(); - if (isEdited) { - if (inArray) { - node = node.slice(); - } else { - const clone = {}; - for (const k of Object.keys(node)) { - clone[k] = node[k]; - } - node = clone; - } - let editOffset = 0; - for (let ii = 0; ii < edits.length; ii++) { - let editKey: any = edits[ii][0]; - const editValue = edits[ii][1]; - if (inArray) { - editKey -= editOffset; - } - if (inArray && editValue === null) { - node.splice(editKey, 1); - editOffset++; - } else { - node[editKey] = editValue; - } - } - } - index = stack.index; - keys = stack.keys; - edits = stack.edits; - inArray = stack.inArray; - stack = stack.prev; - } else { - key = parent ? (inArray ? index : keys[index]) : undefined; - node = parent ? parent[key] : newRoot; - if (node === null || node === undefined) { - continue; - } - if (parent) { - path.push(key); - } - } - - let result; - if (!Array.isArray(node)) { - if (!isNode(node)) { - throw new Error(`Invalid AST Node: ${inspect(node)}.`); - } - const visitFn = getVisitFn(visitor, node.kind, isLeaving); - if (visitFn) { - result = visitFn.call(visitor, node, key, parent, path, ancestors); - - if (result === BREAK) { - break; - } - - if (result === false) { - if (!isLeaving) { - path.pop(); - continue; - } - } else if (result !== undefined) { - edits.push([key, result]); - if (!isLeaving) { - if (isNode(result)) { - node = result; - } else { - path.pop(); - continue; - } - } - } - } - } - - if (result === undefined && isEdited) { - edits.push([key, node]); - } - - if (isLeaving) { - path.pop(); - } else { - stack = { inArray, index, keys, edits, prev: stack }; - inArray = Array.isArray(node); - keys = inArray ? node : visitorKeys[node.kind] ?? []; - index = -1; - edits = []; - if (parent) { - ancestors.push(parent); - } - parent = node; - } - } while (stack !== undefined); - - if (edits.length !== 0) { - newRoot = edits[edits.length - 1][1]; - } - - return newRoot; -} - -/** - * Creates a new visitor instance which delegates to many visitors to run in - * parallel. Each visitor will be visited for each node before moving on. - * - * If a prior visitor edits a node, no following visitors will see that node. - */ -export function visitInParallel( - visitors: $ReadOnlyArray>, -): Visitor { - const skipping = new Array(visitors.length); - - return { - enter(node) { - for (let i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - const fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ false); - if (fn) { - const result = fn.apply(visitors[i], arguments); - if (result === false) { - skipping[i] = node; - } else if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined) { - return result; - } - } - } - } - }, - leave(node) { - for (let i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - const fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ true); - if (fn) { - const result = fn.apply(visitors[i], arguments); - if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined && result !== false) { - return result; - } - } - } else if (skipping[i] === node) { - skipping[i] = null; - } - } - }, - }; -} - -/** - * Given a visitor instance, if it is leaving or not, and a node kind, return - * the function the visitor runtime should call. - */ -export function getVisitFn( - visitor: Visitor, - kind: string, - isLeaving: boolean, -): ?VisitFn { - const kindVisitor = visitor[kind]; - if (kindVisitor) { - if (!isLeaving && typeof kindVisitor === 'function') { - // { Kind() {} } - return kindVisitor; - } - const kindSpecificVisitor = isLeaving - ? kindVisitor.leave - : kindVisitor.enter; - if (typeof kindSpecificVisitor === 'function') { - // { Kind: { enter() {}, leave() {} } } - return kindSpecificVisitor; - } - } else { - const specificVisitor = isLeaving ? visitor.leave : visitor.enter; - if (specificVisitor) { - if (typeof specificVisitor === 'function') { - // { enter() {}, leave() {} } - return specificVisitor; - } - const specificKindVisitor = specificVisitor[kind]; - if (typeof specificKindVisitor === 'function') { - // { enter: { Kind() {} }, leave: { Kind() {} } } - return specificKindVisitor; - } - } - } -} diff --git a/node_modules/graphql/language/visitor.mjs b/node_modules/graphql/language/visitor.mjs deleted file mode 100644 index 776e0ccf..00000000 --- a/node_modules/graphql/language/visitor.mjs +++ /dev/null @@ -1,383 +0,0 @@ -import inspect from "../jsutils/inspect.mjs"; -import { isNode } from "./ast.mjs"; -/** - * A visitor is provided to visit, it contains the collection of - * relevant functions to be called during the visitor's traversal. - */ - -export var QueryDocumentKeys = { - Name: [], - Document: ['definitions'], - OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'], - VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], - Variable: ['name'], - SelectionSet: ['selections'], - Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], - Argument: ['name', 'value'], - FragmentSpread: ['name', 'directives'], - InlineFragment: ['typeCondition', 'directives', 'selectionSet'], - FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'], - IntValue: [], - FloatValue: [], - StringValue: [], - BooleanValue: [], - NullValue: [], - EnumValue: [], - ListValue: ['values'], - ObjectValue: ['fields'], - ObjectField: ['name', 'value'], - Directive: ['name', 'arguments'], - NamedType: ['name'], - ListType: ['type'], - NonNullType: ['type'], - SchemaDefinition: ['description', 'directives', 'operationTypes'], - OperationTypeDefinition: ['type'], - ScalarTypeDefinition: ['description', 'name', 'directives'], - ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], - FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], - InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'], - InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], - UnionTypeDefinition: ['description', 'name', 'directives', 'types'], - EnumTypeDefinition: ['description', 'name', 'directives', 'values'], - EnumValueDefinition: ['description', 'name', 'directives'], - InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], - DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], - SchemaExtension: ['directives', 'operationTypes'], - ScalarTypeExtension: ['name', 'directives'], - ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - UnionTypeExtension: ['name', 'directives', 'types'], - EnumTypeExtension: ['name', 'directives', 'values'], - InputObjectTypeExtension: ['name', 'directives', 'fields'] -}; -export var BREAK = Object.freeze({}); -/** - * visit() will walk through an AST using a depth-first traversal, calling - * the visitor's enter function at each node in the traversal, and calling the - * leave function after visiting that node and all of its child nodes. - * - * By returning different values from the enter and leave functions, the - * behavior of the visitor can be altered, including skipping over a sub-tree of - * the AST (by returning false), editing the AST by returning a value or null - * to remove the value, or to stop the whole traversal by returning BREAK. - * - * When using visit() to edit an AST, the original AST will not be modified, and - * a new version of the AST with the changes applied will be returned from the - * visit function. - * - * const editedAST = visit(ast, { - * enter(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: skip visiting this node - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * }, - * leave(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: no action - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * } - * }); - * - * Alternatively to providing enter() and leave() functions, a visitor can - * instead provide functions named the same as the kinds of AST nodes, or - * enter/leave visitors at a named key, leading to four permutations of the - * visitor API: - * - * 1) Named visitors triggered when entering a node of a specific kind. - * - * visit(ast, { - * Kind(node) { - * // enter the "Kind" node - * } - * }) - * - * 2) Named visitors that trigger upon entering and leaving a node of - * a specific kind. - * - * visit(ast, { - * Kind: { - * enter(node) { - * // enter the "Kind" node - * } - * leave(node) { - * // leave the "Kind" node - * } - * } - * }) - * - * 3) Generic visitors that trigger upon entering and leaving any node. - * - * visit(ast, { - * enter(node) { - * // enter any node - * }, - * leave(node) { - * // leave any node - * } - * }) - * - * 4) Parallel visitors for entering and leaving nodes of a specific kind. - * - * visit(ast, { - * enter: { - * Kind(node) { - * // enter the "Kind" node - * } - * }, - * leave: { - * Kind(node) { - * // leave the "Kind" node - * } - * } - * }) - */ - -export function visit(root, visitor) { - var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys; - - /* eslint-disable no-undef-init */ - var stack = undefined; - var inArray = Array.isArray(root); - var keys = [root]; - var index = -1; - var edits = []; - var node = undefined; - var key = undefined; - var parent = undefined; - var path = []; - var ancestors = []; - var newRoot = root; - /* eslint-enable no-undef-init */ - - do { - index++; - var isLeaving = index === keys.length; - var isEdited = isLeaving && edits.length !== 0; - - if (isLeaving) { - key = ancestors.length === 0 ? undefined : path[path.length - 1]; - node = parent; - parent = ancestors.pop(); - - if (isEdited) { - if (inArray) { - node = node.slice(); - } else { - var clone = {}; - - for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) { - var k = _Object$keys2[_i2]; - clone[k] = node[k]; - } - - node = clone; - } - - var editOffset = 0; - - for (var ii = 0; ii < edits.length; ii++) { - var editKey = edits[ii][0]; - var editValue = edits[ii][1]; - - if (inArray) { - editKey -= editOffset; - } - - if (inArray && editValue === null) { - node.splice(editKey, 1); - editOffset++; - } else { - node[editKey] = editValue; - } - } - } - - index = stack.index; - keys = stack.keys; - edits = stack.edits; - inArray = stack.inArray; - stack = stack.prev; - } else { - key = parent ? inArray ? index : keys[index] : undefined; - node = parent ? parent[key] : newRoot; - - if (node === null || node === undefined) { - continue; - } - - if (parent) { - path.push(key); - } - } - - var result = void 0; - - if (!Array.isArray(node)) { - if (!isNode(node)) { - throw new Error("Invalid AST Node: ".concat(inspect(node), ".")); - } - - var visitFn = getVisitFn(visitor, node.kind, isLeaving); - - if (visitFn) { - result = visitFn.call(visitor, node, key, parent, path, ancestors); - - if (result === BREAK) { - break; - } - - if (result === false) { - if (!isLeaving) { - path.pop(); - continue; - } - } else if (result !== undefined) { - edits.push([key, result]); - - if (!isLeaving) { - if (isNode(result)) { - node = result; - } else { - path.pop(); - continue; - } - } - } - } - } - - if (result === undefined && isEdited) { - edits.push([key, node]); - } - - if (isLeaving) { - path.pop(); - } else { - var _visitorKeys$node$kin; - - stack = { - inArray: inArray, - index: index, - keys: keys, - edits: edits, - prev: stack - }; - inArray = Array.isArray(node); - keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : []; - index = -1; - edits = []; - - if (parent) { - ancestors.push(parent); - } - - parent = node; - } - } while (stack !== undefined); - - if (edits.length !== 0) { - newRoot = edits[edits.length - 1][1]; - } - - return newRoot; -} -/** - * Creates a new visitor instance which delegates to many visitors to run in - * parallel. Each visitor will be visited for each node before moving on. - * - * If a prior visitor edits a node, no following visitors will see that node. - */ - -export function visitInParallel(visitors) { - var skipping = new Array(visitors.length); - return { - enter: function enter(node) { - for (var i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - var fn = getVisitFn(visitors[i], node.kind, - /* isLeaving */ - false); - - if (fn) { - var result = fn.apply(visitors[i], arguments); - - if (result === false) { - skipping[i] = node; - } else if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined) { - return result; - } - } - } - } - }, - leave: function leave(node) { - for (var i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - var fn = getVisitFn(visitors[i], node.kind, - /* isLeaving */ - true); - - if (fn) { - var result = fn.apply(visitors[i], arguments); - - if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined && result !== false) { - return result; - } - } - } else if (skipping[i] === node) { - skipping[i] = null; - } - } - } - }; -} -/** - * Given a visitor instance, if it is leaving or not, and a node kind, return - * the function the visitor runtime should call. - */ - -export function getVisitFn(visitor, kind, isLeaving) { - var kindVisitor = visitor[kind]; - - if (kindVisitor) { - if (!isLeaving && typeof kindVisitor === 'function') { - // { Kind() {} } - return kindVisitor; - } - - var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter; - - if (typeof kindSpecificVisitor === 'function') { - // { Kind: { enter() {}, leave() {} } } - return kindSpecificVisitor; - } - } else { - var specificVisitor = isLeaving ? visitor.leave : visitor.enter; - - if (specificVisitor) { - if (typeof specificVisitor === 'function') { - // { enter() {}, leave() {} } - return specificVisitor; - } - - var specificKindVisitor = specificVisitor[kind]; - - if (typeof specificKindVisitor === 'function') { - // { enter: { Kind() {} }, leave: { Kind() {} } } - return specificKindVisitor; - } - } - } -} diff --git a/node_modules/graphql/package.json b/node_modules/graphql/package.json deleted file mode 100644 index 6095ecaf..00000000 --- a/node_modules/graphql/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_from": "graphql@latest", - "_id": "graphql@15.4.0", - "_inBundle": false, - "_integrity": "sha512-EB3zgGchcabbsU9cFe1j+yxdzKQKAbGUWRb13DsrsMN1yyfmmIq+2+L5MqVWcDCE4V89R5AyUOi7sMOGxdsYtA==", - "_location": "/graphql", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "graphql@latest", - "name": "graphql", - "escapedName": "graphql", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/graphql/-/graphql-15.4.0.tgz", - "_shasum": "e459dea1150da5a106486ba7276518b5295a4347", - "_spec": "graphql@latest", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "bugs": { - "url": "https://github.com/graphql/graphql-js/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A Query Language and Runtime which can target any service.", - "engines": { - "node": ">= 10.x" - }, - "homepage": "https://github.com/graphql/graphql-js", - "keywords": [ - "graphql", - "graphql-js" - ], - "license": "MIT", - "main": "index", - "module": "index.mjs", - "name": "graphql", - "repository": { - "type": "git", - "url": "git+https://github.com/graphql/graphql-js.git" - }, - "sideEffects": false, - "types": "index.d.ts", - "version": "15.4.0" -} diff --git a/node_modules/graphql/polyfills/arrayFrom.js b/node_modules/graphql/polyfills/arrayFrom.js deleted file mode 100644 index 0f2eab26..00000000 --- a/node_modules/graphql/polyfills/arrayFrom.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _symbols = require("./symbols.js"); - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] -var arrayFrom = Array.from || function (obj, mapFn, thisArg) { - if (obj == null) { - throw new TypeError('Array.from requires an array-like object - not null or undefined'); - } // Is Iterable? - - - var iteratorMethod = obj[_symbols.SYMBOL_ITERATOR]; - - if (typeof iteratorMethod === 'function') { - var iterator = iteratorMethod.call(obj); - var result = []; - var step; - - for (var i = 0; !(step = iterator.next()).done; ++i) { - result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever. - // After a very large number of iterations, produce an error. - // istanbul ignore if (Too big to actually test) - - if (i > 9999999) { - throw new TypeError('Near-infinite iteration.'); - } - } - - return result; - } // Is Array like? - - - var length = obj.length; - - if (typeof length === 'number' && length >= 0 && length % 1 === 0) { - var _result = []; - - for (var _i = 0; _i < length; ++_i) { - if (Object.prototype.hasOwnProperty.call(obj, _i)) { - _result.push(mapFn.call(thisArg, obj[_i], _i)); - } - } - - return _result; - } - - return []; -}; - -var _default = arrayFrom; -exports.default = _default; diff --git a/node_modules/graphql/polyfills/arrayFrom.js.flow b/node_modules/graphql/polyfills/arrayFrom.js.flow deleted file mode 100644 index 73093b73..00000000 --- a/node_modules/graphql/polyfills/arrayFrom.js.flow +++ /dev/null @@ -1,58 +0,0 @@ -// @flow strict -import { SYMBOL_ITERATOR } from './symbols'; - -declare function arrayFrom(arrayLike: Iterable): Array; -// eslint-disable-next-line no-redeclare -declare function arrayFrom( - arrayLike: mixed, - mapFn?: (elem: mixed, index: number) => T, - thisArg?: mixed, -): Array; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] -const arrayFrom = - Array.from || - function (obj, mapFn, thisArg) { - if (obj == null) { - throw new TypeError( - 'Array.from requires an array-like object - not null or undefined', - ); - } - - // Is Iterable? - const iteratorMethod = obj[SYMBOL_ITERATOR]; - if (typeof iteratorMethod === 'function') { - const iterator = iteratorMethod.call(obj); - const result = []; - let step; - - for (let i = 0; !(step = iterator.next()).done; ++i) { - result.push(mapFn.call(thisArg, step.value, i)); - // Infinite Iterators could cause forEach to run forever. - // After a very large number of iterations, produce an error. - // istanbul ignore if (Too big to actually test) - if (i > 9999999) { - throw new TypeError('Near-infinite iteration.'); - } - } - return result; - } - - // Is Array like? - const length = obj.length; - if (typeof length === 'number' && length >= 0 && length % 1 === 0) { - const result = []; - - for (let i = 0; i < length; ++i) { - if (Object.prototype.hasOwnProperty.call(obj, i)) { - result.push(mapFn.call(thisArg, obj[i], i)); - } - } - return result; - } - - return []; - }; - -export default arrayFrom; diff --git a/node_modules/graphql/polyfills/arrayFrom.mjs b/node_modules/graphql/polyfills/arrayFrom.mjs deleted file mode 100644 index 1ea59f0f..00000000 --- a/node_modules/graphql/polyfills/arrayFrom.mjs +++ /dev/null @@ -1,49 +0,0 @@ -import { SYMBOL_ITERATOR } from "./symbols.mjs"; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] -var arrayFrom = Array.from || function (obj, mapFn, thisArg) { - if (obj == null) { - throw new TypeError('Array.from requires an array-like object - not null or undefined'); - } // Is Iterable? - - - var iteratorMethod = obj[SYMBOL_ITERATOR]; - - if (typeof iteratorMethod === 'function') { - var iterator = iteratorMethod.call(obj); - var result = []; - var step; - - for (var i = 0; !(step = iterator.next()).done; ++i) { - result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever. - // After a very large number of iterations, produce an error. - // istanbul ignore if (Too big to actually test) - - if (i > 9999999) { - throw new TypeError('Near-infinite iteration.'); - } - } - - return result; - } // Is Array like? - - - var length = obj.length; - - if (typeof length === 'number' && length >= 0 && length % 1 === 0) { - var _result = []; - - for (var _i = 0; _i < length; ++_i) { - if (Object.prototype.hasOwnProperty.call(obj, _i)) { - _result.push(mapFn.call(thisArg, obj[_i], _i)); - } - } - - return _result; - } - - return []; -}; - -export default arrayFrom; diff --git a/node_modules/graphql/polyfills/find.js b/node_modules/graphql/polyfills/find.js deleted file mode 100644 index fb14137c..00000000 --- a/node_modules/graphql/polyfills/find.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] -var find = Array.prototype.find ? function (list, predicate) { - return Array.prototype.find.call(list, predicate); -} : function (list, predicate) { - for (var _i2 = 0; _i2 < list.length; _i2++) { - var value = list[_i2]; - - if (predicate(value)) { - return value; - } - } -}; -var _default = find; -exports.default = _default; diff --git a/node_modules/graphql/polyfills/find.js.flow b/node_modules/graphql/polyfills/find.js.flow deleted file mode 100644 index 4ed151c9..00000000 --- a/node_modules/graphql/polyfills/find.js.flow +++ /dev/null @@ -1,20 +0,0 @@ -// @flow strict -declare function find( - list: $ReadOnlyArray, - predicate: (item: T) => boolean, -): T | void; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] -const find = Array.prototype.find - ? function (list, predicate) { - return Array.prototype.find.call(list, predicate); - } - : function (list, predicate) { - for (const value of list) { - if (predicate(value)) { - return value; - } - } - }; -export default find; diff --git a/node_modules/graphql/polyfills/find.mjs b/node_modules/graphql/polyfills/find.mjs deleted file mode 100644 index ed3e6f35..00000000 --- a/node_modules/graphql/polyfills/find.mjs +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] -var find = Array.prototype.find ? function (list, predicate) { - return Array.prototype.find.call(list, predicate); -} : function (list, predicate) { - for (var _i2 = 0; _i2 < list.length; _i2++) { - var value = list[_i2]; - - if (predicate(value)) { - return value; - } - } -}; -export default find; diff --git a/node_modules/graphql/polyfills/isFinite.js b/node_modules/graphql/polyfills/isFinite.js deleted file mode 100644 index 9c0e5597..00000000 --- a/node_modules/graphql/polyfills/isFinite.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var isFinitePolyfill = Number.isFinite || function (value) { - return typeof value === 'number' && isFinite(value); -}; - -var _default = isFinitePolyfill; -exports.default = _default; diff --git a/node_modules/graphql/polyfills/isFinite.js.flow b/node_modules/graphql/polyfills/isFinite.js.flow deleted file mode 100644 index 5dd02295..00000000 --- a/node_modules/graphql/polyfills/isFinite.js.flow +++ /dev/null @@ -1,13 +0,0 @@ -// @flow strict -declare function isFinitePolyfill( - value: mixed, -): boolean %checks(typeof value === 'number'); - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -const isFinitePolyfill = - Number.isFinite || - function (value) { - return typeof value === 'number' && isFinite(value); - }; -export default isFinitePolyfill; diff --git a/node_modules/graphql/polyfills/isFinite.mjs b/node_modules/graphql/polyfills/isFinite.mjs deleted file mode 100644 index 7c1aea6d..00000000 --- a/node_modules/graphql/polyfills/isFinite.mjs +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var isFinitePolyfill = Number.isFinite || function (value) { - return typeof value === 'number' && isFinite(value); -}; - -export default isFinitePolyfill; diff --git a/node_modules/graphql/polyfills/isInteger.js b/node_modules/graphql/polyfills/isInteger.js deleted file mode 100644 index 9b253614..00000000 --- a/node_modules/graphql/polyfills/isInteger.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var isInteger = Number.isInteger || function (value) { - return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; -}; - -var _default = isInteger; -exports.default = _default; diff --git a/node_modules/graphql/polyfills/isInteger.js.flow b/node_modules/graphql/polyfills/isInteger.js.flow deleted file mode 100644 index 757da927..00000000 --- a/node_modules/graphql/polyfills/isInteger.js.flow +++ /dev/null @@ -1,16 +0,0 @@ -// @flow strict -declare function isInteger(value: mixed): boolean %checks(typeof value === - 'number'); - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -const isInteger = - Number.isInteger || - function (value) { - return ( - typeof value === 'number' && - isFinite(value) && - Math.floor(value) === value - ); - }; -export default isInteger; diff --git a/node_modules/graphql/polyfills/isInteger.mjs b/node_modules/graphql/polyfills/isInteger.mjs deleted file mode 100644 index 3396f164..00000000 --- a/node_modules/graphql/polyfills/isInteger.mjs +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var isInteger = Number.isInteger || function (value) { - return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; -}; - -export default isInteger; diff --git a/node_modules/graphql/polyfills/objectEntries.js b/node_modules/graphql/polyfills/objectEntries.js deleted file mode 100644 index 749d4efb..00000000 --- a/node_modules/graphql/polyfills/objectEntries.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var objectEntries = Object.entries || function (obj) { - return Object.keys(obj).map(function (key) { - return [key, obj[key]]; - }); -}; - -var _default = objectEntries; -exports.default = _default; diff --git a/node_modules/graphql/polyfills/objectEntries.js.flow b/node_modules/graphql/polyfills/objectEntries.js.flow deleted file mode 100644 index d30e3c14..00000000 --- a/node_modules/graphql/polyfills/objectEntries.js.flow +++ /dev/null @@ -1,11 +0,0 @@ -// @flow strict -import type { ObjMap } from '../jsutils/ObjMap'; - -declare function objectEntries(obj: ObjMap): Array<[string, T]>; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -const objectEntries = - Object.entries || ((obj) => Object.keys(obj).map((key) => [key, obj[key]])); - -export default objectEntries; diff --git a/node_modules/graphql/polyfills/objectEntries.mjs b/node_modules/graphql/polyfills/objectEntries.mjs deleted file mode 100644 index 72d0c604..00000000 --- a/node_modules/graphql/polyfills/objectEntries.mjs +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var objectEntries = Object.entries || function (obj) { - return Object.keys(obj).map(function (key) { - return [key, obj[key]]; - }); -}; - -export default objectEntries; diff --git a/node_modules/graphql/polyfills/objectValues.js b/node_modules/graphql/polyfills/objectValues.js deleted file mode 100644 index ab14e650..00000000 --- a/node_modules/graphql/polyfills/objectValues.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var objectValues = Object.values || function (obj) { - return Object.keys(obj).map(function (key) { - return obj[key]; - }); -}; - -var _default = objectValues; -exports.default = _default; diff --git a/node_modules/graphql/polyfills/objectValues.js.flow b/node_modules/graphql/polyfills/objectValues.js.flow deleted file mode 100644 index 343419a6..00000000 --- a/node_modules/graphql/polyfills/objectValues.js.flow +++ /dev/null @@ -1,10 +0,0 @@ -// @flow strict -import type { ObjMap } from '../jsutils/ObjMap'; - -declare function objectValues(obj: ObjMap): Array; - -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -const objectValues = - Object.values || ((obj) => Object.keys(obj).map((key) => obj[key])); -export default objectValues; diff --git a/node_modules/graphql/polyfills/objectValues.mjs b/node_modules/graphql/polyfills/objectValues.mjs deleted file mode 100644 index afbde064..00000000 --- a/node_modules/graphql/polyfills/objectValues.mjs +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable no-redeclare */ -// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 -var objectValues = Object.values || function (obj) { - return Object.keys(obj).map(function (key) { - return obj[key]; - }); -}; - -export default objectValues; diff --git a/node_modules/graphql/polyfills/symbols.js b/node_modules/graphql/polyfills/symbols.js deleted file mode 100644 index 3d4ba2ef..00000000 --- a/node_modules/graphql/polyfills/symbols.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SYMBOL_TO_STRING_TAG = exports.SYMBOL_ASYNC_ITERATOR = exports.SYMBOL_ITERATOR = void 0; -// In ES2015 (or a polyfilled) environment, this will be Symbol.iterator -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -var SYMBOL_ITERATOR = typeof Symbol === 'function' && Symbol.iterator != null ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - -exports.SYMBOL_ITERATOR = SYMBOL_ITERATOR; -var SYMBOL_ASYNC_ITERATOR = typeof Symbol === 'function' && Symbol.asyncIterator != null ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - -exports.SYMBOL_ASYNC_ITERATOR = SYMBOL_ASYNC_ITERATOR; -var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag != null ? Symbol.toStringTag : '@@toStringTag'; -exports.SYMBOL_TO_STRING_TAG = SYMBOL_TO_STRING_TAG; diff --git a/node_modules/graphql/polyfills/symbols.js.flow b/node_modules/graphql/polyfills/symbols.js.flow deleted file mode 100644 index 66a1b2cf..00000000 --- a/node_modules/graphql/polyfills/symbols.js.flow +++ /dev/null @@ -1,20 +0,0 @@ -// @flow strict -// In ES2015 (or a polyfilled) environment, this will be Symbol.iterator -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -export const SYMBOL_ITERATOR: string = - typeof Symbol === 'function' && Symbol.iterator != null - ? Symbol.iterator - : '@@iterator'; - -// In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -export const SYMBOL_ASYNC_ITERATOR: string = - typeof Symbol === 'function' && Symbol.asyncIterator != null - ? Symbol.asyncIterator - : '@@asyncIterator'; - -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -export const SYMBOL_TO_STRING_TAG: string = - typeof Symbol === 'function' && Symbol.toStringTag != null - ? Symbol.toStringTag - : '@@toStringTag'; diff --git a/node_modules/graphql/polyfills/symbols.mjs b/node_modules/graphql/polyfills/symbols.mjs deleted file mode 100644 index b3388511..00000000 --- a/node_modules/graphql/polyfills/symbols.mjs +++ /dev/null @@ -1,8 +0,0 @@ -// In ES2015 (or a polyfilled) environment, this will be Symbol.iterator -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -export var SYMBOL_ITERATOR = typeof Symbol === 'function' && Symbol.iterator != null ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - -export var SYMBOL_ASYNC_ITERATOR = typeof Symbol === 'function' && Symbol.asyncIterator != null ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') - -export var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag != null ? Symbol.toStringTag : '@@toStringTag'; diff --git a/node_modules/graphql/subscription/index.d.ts b/node_modules/graphql/subscription/index.d.ts deleted file mode 100644 index ba8835f1..00000000 --- a/node_modules/graphql/subscription/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { - subscribe, - createSourceEventStream, - SubscriptionArgs, -} from './subscribe'; diff --git a/node_modules/graphql/subscription/index.js b/node_modules/graphql/subscription/index.js deleted file mode 100644 index 845d9447..00000000 --- a/node_modules/graphql/subscription/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "subscribe", { - enumerable: true, - get: function get() { - return _subscribe.subscribe; - } -}); -Object.defineProperty(exports, "createSourceEventStream", { - enumerable: true, - get: function get() { - return _subscribe.createSourceEventStream; - } -}); - -var _subscribe = require("./subscribe.js"); diff --git a/node_modules/graphql/subscription/index.js.flow b/node_modules/graphql/subscription/index.js.flow deleted file mode 100644 index 9f37bfd2..00000000 --- a/node_modules/graphql/subscription/index.js.flow +++ /dev/null @@ -1,3 +0,0 @@ -// @flow strict -export { subscribe, createSourceEventStream } from './subscribe'; -export type { SubscriptionArgs } from './subscribe'; diff --git a/node_modules/graphql/subscription/index.mjs b/node_modules/graphql/subscription/index.mjs deleted file mode 100644 index 8983f842..00000000 --- a/node_modules/graphql/subscription/index.mjs +++ /dev/null @@ -1 +0,0 @@ -export { subscribe, createSourceEventStream } from "./subscribe.mjs"; diff --git a/node_modules/graphql/subscription/mapAsyncIterator.d.ts b/node_modules/graphql/subscription/mapAsyncIterator.d.ts deleted file mode 100644 index 22e8a34a..00000000 --- a/node_modules/graphql/subscription/mapAsyncIterator.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { PromiseOrValue } from '../jsutils/PromiseOrValue'; - -/** - * Given an AsyncIterable and a callback function, return an AsyncIterator - * which produces values mapped via calling the callback function. - */ -export default function mapAsyncIterator( - iterable: AsyncIterable, - callback: (arg: T) => PromiseOrValue, - rejectCallback?: (arg: any) => PromiseOrValue, -): any; // TS_SPECIFIC: AsyncGenerator requires typescript@3.6 diff --git a/node_modules/graphql/subscription/mapAsyncIterator.js b/node_modules/graphql/subscription/mapAsyncIterator.js deleted file mode 100644 index 4fd37cdf..00000000 --- a/node_modules/graphql/subscription/mapAsyncIterator.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = mapAsyncIterator; - -var _symbols = require("../polyfills/symbols.js"); - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Given an AsyncIterable and a callback function, return an AsyncIterator - * which produces values mapped via calling the callback function. - */ -function mapAsyncIterator(iterable, callback, rejectCallback) { - // $FlowFixMe[prop-missing] - var iteratorMethod = iterable[_symbols.SYMBOL_ASYNC_ITERATOR]; - var iterator = iteratorMethod.call(iterable); - var $return; - var abruptClose; - - if (typeof iterator.return === 'function') { - $return = iterator.return; - - abruptClose = function abruptClose(error) { - var rethrow = function rethrow() { - return Promise.reject(error); - }; - - return $return.call(iterator).then(rethrow, rethrow); - }; - } - - function mapResult(result) { - return result.done ? result : asyncMapValue(result.value, callback).then(iteratorResult, abruptClose); - } - - var mapReject; - - if (rejectCallback) { - // Capture rejectCallback to ensure it cannot be null. - var reject = rejectCallback; - - mapReject = function mapReject(error) { - return asyncMapValue(error, reject).then(iteratorResult, abruptClose); - }; - } - /* TODO: Flow doesn't support symbols as keys: - https://github.com/facebook/flow/issues/3258 */ - - - return _defineProperty({ - next: function next() { - return iterator.next().then(mapResult, mapReject); - }, - return: function _return() { - return $return ? $return.call(iterator).then(mapResult, mapReject) : Promise.resolve({ - value: undefined, - done: true - }); - }, - throw: function _throw(error) { - if (typeof iterator.throw === 'function') { - return iterator.throw(error).then(mapResult, mapReject); - } - - return Promise.reject(error).catch(abruptClose); - } - }, _symbols.SYMBOL_ASYNC_ITERATOR, function () { - return this; - }); -} - -function asyncMapValue(value, callback) { - return new Promise(function (resolve) { - return resolve(callback(value)); - }); -} - -function iteratorResult(value) { - return { - value: value, - done: false - }; -} diff --git a/node_modules/graphql/subscription/mapAsyncIterator.js.flow b/node_modules/graphql/subscription/mapAsyncIterator.js.flow deleted file mode 100644 index 8b1d1d8f..00000000 --- a/node_modules/graphql/subscription/mapAsyncIterator.js.flow +++ /dev/null @@ -1,74 +0,0 @@ -// @flow strict -import { SYMBOL_ASYNC_ITERATOR } from '../polyfills/symbols'; - -import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; - -/** - * Given an AsyncIterable and a callback function, return an AsyncIterator - * which produces values mapped via calling the callback function. - */ -export default function mapAsyncIterator( - iterable: AsyncIterable | AsyncGenerator, - callback: (T) => PromiseOrValue, - rejectCallback?: (any) => PromiseOrValue, -): AsyncGenerator { - // $FlowFixMe[prop-missing] - const iteratorMethod = iterable[SYMBOL_ASYNC_ITERATOR]; - const iterator: any = iteratorMethod.call(iterable); - let $return: any; - let abruptClose; - if (typeof iterator.return === 'function') { - $return = iterator.return; - abruptClose = (error: mixed) => { - const rethrow = () => Promise.reject(error); - return $return.call(iterator).then(rethrow, rethrow); - }; - } - - function mapResult(result: IteratorResult) { - return result.done - ? result - : asyncMapValue(result.value, callback).then(iteratorResult, abruptClose); - } - - let mapReject; - if (rejectCallback) { - // Capture rejectCallback to ensure it cannot be null. - const reject = rejectCallback; - mapReject = (error: mixed) => - asyncMapValue(error, reject).then(iteratorResult, abruptClose); - } - - /* TODO: Flow doesn't support symbols as keys: - https://github.com/facebook/flow/issues/3258 */ - return ({ - next(): Promise> { - return iterator.next().then(mapResult, mapReject); - }, - return() { - return $return - ? $return.call(iterator).then(mapResult, mapReject) - : Promise.resolve({ value: undefined, done: true }); - }, - throw(error?: mixed): Promise> { - if (typeof iterator.throw === 'function') { - return iterator.throw(error).then(mapResult, mapReject); - } - return Promise.reject(error).catch(abruptClose); - }, - [SYMBOL_ASYNC_ITERATOR]() { - return this; - }, - }: $FlowFixMe); -} - -function asyncMapValue( - value: T, - callback: (T) => PromiseOrValue, -): Promise { - return new Promise((resolve) => resolve(callback(value))); -} - -function iteratorResult(value: T): IteratorResult { - return { value, done: false }; -} diff --git a/node_modules/graphql/subscription/mapAsyncIterator.mjs b/node_modules/graphql/subscription/mapAsyncIterator.mjs deleted file mode 100644 index ffe23e0c..00000000 --- a/node_modules/graphql/subscription/mapAsyncIterator.mjs +++ /dev/null @@ -1,79 +0,0 @@ -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import { SYMBOL_ASYNC_ITERATOR } from "../polyfills/symbols.mjs"; - -/** - * Given an AsyncIterable and a callback function, return an AsyncIterator - * which produces values mapped via calling the callback function. - */ -export default function mapAsyncIterator(iterable, callback, rejectCallback) { - // $FlowFixMe[prop-missing] - var iteratorMethod = iterable[SYMBOL_ASYNC_ITERATOR]; - var iterator = iteratorMethod.call(iterable); - var $return; - var abruptClose; - - if (typeof iterator.return === 'function') { - $return = iterator.return; - - abruptClose = function abruptClose(error) { - var rethrow = function rethrow() { - return Promise.reject(error); - }; - - return $return.call(iterator).then(rethrow, rethrow); - }; - } - - function mapResult(result) { - return result.done ? result : asyncMapValue(result.value, callback).then(iteratorResult, abruptClose); - } - - var mapReject; - - if (rejectCallback) { - // Capture rejectCallback to ensure it cannot be null. - var reject = rejectCallback; - - mapReject = function mapReject(error) { - return asyncMapValue(error, reject).then(iteratorResult, abruptClose); - }; - } - /* TODO: Flow doesn't support symbols as keys: - https://github.com/facebook/flow/issues/3258 */ - - - return _defineProperty({ - next: function next() { - return iterator.next().then(mapResult, mapReject); - }, - return: function _return() { - return $return ? $return.call(iterator).then(mapResult, mapReject) : Promise.resolve({ - value: undefined, - done: true - }); - }, - throw: function _throw(error) { - if (typeof iterator.throw === 'function') { - return iterator.throw(error).then(mapResult, mapReject); - } - - return Promise.reject(error).catch(abruptClose); - } - }, SYMBOL_ASYNC_ITERATOR, function () { - return this; - }); -} - -function asyncMapValue(value, callback) { - return new Promise(function (resolve) { - return resolve(callback(value)); - }); -} - -function iteratorResult(value) { - return { - value: value, - done: false - }; -} diff --git a/node_modules/graphql/subscription/subscribe.d.ts b/node_modules/graphql/subscription/subscribe.d.ts deleted file mode 100644 index 3ed750a3..00000000 --- a/node_modules/graphql/subscription/subscribe.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { DocumentNode } from '../language/ast'; -import { ExecutionResult } from '../execution/execute'; -import { GraphQLSchema } from '../type/schema'; -import { GraphQLFieldResolver } from '../type/definition'; - -export interface SubscriptionArgs { - schema: GraphQLSchema; - document: DocumentNode; - rootValue?: any; - contextValue?: any; - variableValues?: Maybe>; - operationName?: Maybe; - fieldResolver?: Maybe>; - subscribeFieldResolver?: Maybe>; -} - -/** - * Implements the "Subscribe" algorithm described in the GraphQL specification. - * - * Returns a Promise which resolves to either an AsyncIterator (if successful) - * or an ExecutionResult (client error). The promise will be rejected if a - * server error occurs. - * - * If the client-provided arguments to this function do not result in a - * compliant subscription, a GraphQL Response (ExecutionResult) with - * descriptive errors and no data will be returned. - * - * If the the source stream could not be created due to faulty subscription - * resolver logic or underlying systems, the promise will resolve to a single - * ExecutionResult containing `errors` and no `data`. - * - * If the operation succeeded, the promise resolves to an AsyncIterator, which - * yields a stream of ExecutionResults representing the response stream. - * - * Accepts either an object with named arguments, or individual arguments. - */ -export function subscribe( - args: SubscriptionArgs, -): Promise | ExecutionResult>; - -export function subscribe( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: Maybe<{ [key: string]: any }>, - operationName?: Maybe, - fieldResolver?: Maybe>, - subscribeFieldResolver?: Maybe>, -): Promise | ExecutionResult>; - -/** - * Implements the "CreateSourceEventStream" algorithm described in the - * GraphQL specification, resolving the subscription source event stream. - * - * Returns a Promise. - * - * If the client-provided invalid arguments, the source stream could not be - * created, or the resolver did not return an AsyncIterable, this function will - * will throw an error, which should be caught and handled by the caller. - * - * A Source Event Stream represents a sequence of events, each of which triggers - * a GraphQL execution for that event. - * - * This may be useful when hosting the stateful subscription service in a - * different process or machine than the stateless GraphQL execution engine, - * or otherwise separating these two steps. For more on this, see the - * "Supporting Subscriptions at Scale" information in the GraphQL specification. - */ -export function createSourceEventStream( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { [key: string]: any }, - operationName?: Maybe, - fieldResolver?: Maybe>, -): Promise | ExecutionResult>; diff --git a/node_modules/graphql/subscription/subscribe.js b/node_modules/graphql/subscription/subscribe.js deleted file mode 100644 index 9f8225d3..00000000 --- a/node_modules/graphql/subscription/subscribe.js +++ /dev/null @@ -1,192 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.subscribe = subscribe; -exports.createSourceEventStream = createSourceEventStream; - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _isAsyncIterable = _interopRequireDefault(require("../jsutils/isAsyncIterable.js")); - -var _Path = require("../jsutils/Path.js"); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _locatedError = require("../error/locatedError.js"); - -var _values = require("../execution/values.js"); - -var _execute = require("../execution/execute.js"); - -var _getOperationRootType = require("../utilities/getOperationRootType.js"); - -var _mapAsyncIterator = _interopRequireDefault(require("./mapAsyncIterator.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function subscribe(argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - return arguments.length === 1 ? subscribeImpl(argsOrSchema) : subscribeImpl({ - schema: argsOrSchema, - document: document, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - subscribeFieldResolver: subscribeFieldResolver - }); -} -/** - * This function checks if the error is a GraphQLError. If it is, report it as - * an ExecutionResult, containing only errors and no data. Otherwise treat the - * error as a system-class error and re-throw it. - */ - - -function reportGraphQLError(error) { - if (error instanceof _GraphQLError.GraphQLError) { - return { - errors: [error] - }; - } - - throw error; -} - -function subscribeImpl(args) { - var schema = args.schema, - document = args.document, - rootValue = args.rootValue, - contextValue = args.contextValue, - variableValues = args.variableValues, - operationName = args.operationName, - fieldResolver = args.fieldResolver, - subscribeFieldResolver = args.subscribeFieldResolver; - var sourcePromise = createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, subscribeFieldResolver); // For each payload yielded from a subscription, map it over the normal - // GraphQL `execute` function, with `payload` as the rootValue. - // This implements the "MapSourceToResponseEvent" algorithm described in - // the GraphQL specification. The `execute` function provides the - // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the - // "ExecuteQuery" algorithm, for which `execute` is also used. - - var mapSourceToResponse = function mapSourceToResponse(payload) { - return (0, _execute.execute)({ - schema: schema, - document: document, - rootValue: payload, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver - }); - }; // Resolve the Source Stream, then map every source value to a - // ExecutionResult value as described above. - - - return sourcePromise.then(function (resultOrStream) { - return (// Note: Flow can't refine isAsyncIterable, so explicit casts are used. - (0, _isAsyncIterable.default)(resultOrStream) ? (0, _mapAsyncIterator.default)(resultOrStream, mapSourceToResponse, reportGraphQLError) : resultOrStream - ); - }); -} -/** - * Implements the "CreateSourceEventStream" algorithm described in the - * GraphQL specification, resolving the subscription source event stream. - * - * Returns a Promise which resolves to either an AsyncIterable (if successful) - * or an ExecutionResult (error). The promise will be rejected if the schema or - * other arguments to this function are invalid, or if the resolved event stream - * is not an async iterable. - * - * If the client-provided arguments to this function do not result in a - * compliant subscription, a GraphQL Response (ExecutionResult) with - * descriptive errors and no data will be returned. - * - * If the the source stream could not be created due to faulty subscription - * resolver logic or underlying systems, the promise will resolve to a single - * ExecutionResult containing `errors` and no `data`. - * - * If the operation succeeded, the promise resolves to the AsyncIterable for the - * event stream returned by the resolver. - * - * A Source Event Stream represents a sequence of events, each of which triggers - * a GraphQL execution for that event. - * - * This may be useful when hosting the stateful subscription service in a - * different process or machine than the stateless GraphQL execution engine, - * or otherwise separating these two steps. For more on this, see the - * "Supporting Subscriptions at Scale" information in the GraphQL specification. - */ - - -function createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver) { - // If arguments are missing or incorrectly typed, this is an internal - // developer mistake which should throw an early error. - (0, _execute.assertValidExecutionArguments)(schema, document, variableValues); - return new Promise(function (resolve) { - // If a valid context cannot be created due to incorrect arguments, - // this will throw an error. - var exeContext = (0, _execute.buildExecutionContext)(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver); - resolve( // Return early errors if execution context failed. - Array.isArray(exeContext) ? { - errors: exeContext - } : executeSubscription(exeContext)); - }).catch(reportGraphQLError); -} - -function executeSubscription(exeContext) { - var schema = exeContext.schema, - operation = exeContext.operation, - variableValues = exeContext.variableValues, - rootValue = exeContext.rootValue; - var type = (0, _getOperationRootType.getOperationRootType)(schema, operation); - var fields = (0, _execute.collectFields)(exeContext, type, operation.selectionSet, Object.create(null), Object.create(null)); - var responseNames = Object.keys(fields); - var responseName = responseNames[0]; - var fieldNodes = fields[responseName]; - var fieldNode = fieldNodes[0]; - var fieldName = fieldNode.name.value; - var fieldDef = (0, _execute.getFieldDef)(schema, type, fieldName); - - if (!fieldDef) { - throw new _GraphQLError.GraphQLError("The subscription field \"".concat(fieldName, "\" is not defined."), fieldNodes); - } - - var path = (0, _Path.addPath)(undefined, responseName, type.name); - var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path); // Coerce to Promise for easier error handling and consistent return type. - - return new Promise(function (resolveResult) { - var _fieldDef$subscribe; - - // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. - // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. - // Build a JS object of arguments from the field.arguments AST, using the - // variables scope to fulfill any variable references. - var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues); // The resolve function's optional third argument is a context value that - // is provided to every resolve function within an execution. It is commonly - // used to represent an authenticated user, or request-specific caches. - - var contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an - // AsyncIterable yielding raw payloads. - - var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver; - resolveResult(resolveFn(rootValue, args, contextValue, info)); - }).then(function (eventStream) { - if (eventStream instanceof Error) { - throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path)); - } // Assert field returned an event stream, otherwise yield an error. - - - if (!(0, _isAsyncIterable.default)(eventStream)) { - throw new Error('Subscription field must return Async Iterable. ' + "Received: ".concat((0, _inspect.default)(eventStream), ".")); - } - - return eventStream; - }, function (error) { - throw (0, _locatedError.locatedError)(error, fieldNodes, (0, _Path.pathToArray)(path)); - }); -} diff --git a/node_modules/graphql/subscription/subscribe.js.flow b/node_modules/graphql/subscription/subscribe.js.flow deleted file mode 100644 index 7d213679..00000000 --- a/node_modules/graphql/subscription/subscribe.js.flow +++ /dev/null @@ -1,298 +0,0 @@ -// @flow strict -import inspect from '../jsutils/inspect'; -import isAsyncIterable from '../jsutils/isAsyncIterable'; -import { addPath, pathToArray } from '../jsutils/Path'; - -import { GraphQLError } from '../error/GraphQLError'; -import { locatedError } from '../error/locatedError'; - -import type { DocumentNode } from '../language/ast'; - -import type { ExecutionResult, ExecutionContext } from '../execution/execute'; -import { getArgumentValues } from '../execution/values'; -import { - assertValidExecutionArguments, - buildExecutionContext, - buildResolveInfo, - collectFields, - execute, - getFieldDef, -} from '../execution/execute'; - -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLFieldResolver } from '../type/definition'; - -import { getOperationRootType } from '../utilities/getOperationRootType'; - -import mapAsyncIterator from './mapAsyncIterator'; - -export type SubscriptionArgs = {| - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, - subscribeFieldResolver?: ?GraphQLFieldResolver, -|}; - -/** - * Implements the "Subscribe" algorithm described in the GraphQL specification. - * - * Returns a Promise which resolves to either an AsyncIterator (if successful) - * or an ExecutionResult (error). The promise will be rejected if the schema or - * other arguments to this function are invalid, or if the resolved event stream - * is not an async iterable. - * - * If the client-provided arguments to this function do not result in a - * compliant subscription, a GraphQL Response (ExecutionResult) with - * descriptive errors and no data will be returned. - * - * If the source stream could not be created due to faulty subscription - * resolver logic or underlying systems, the promise will resolve to a single - * ExecutionResult containing `errors` and no `data`. - * - * If the operation succeeded, the promise resolves to an AsyncIterator, which - * yields a stream of ExecutionResults representing the response stream. - * - * Accepts either an object with named arguments, or individual arguments. - */ -declare function subscribe( - SubscriptionArgs, - ..._: [] -): Promise | ExecutionResult>; -/* eslint-disable no-redeclare */ -declare function subscribe( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, - subscribeFieldResolver?: ?GraphQLFieldResolver, -): Promise | ExecutionResult>; -export function subscribe( - argsOrSchema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - subscribeFieldResolver, -) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - return arguments.length === 1 - ? subscribeImpl(argsOrSchema) - : subscribeImpl({ - schema: argsOrSchema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - subscribeFieldResolver, - }); -} - -/** - * This function checks if the error is a GraphQLError. If it is, report it as - * an ExecutionResult, containing only errors and no data. Otherwise treat the - * error as a system-class error and re-throw it. - */ -function reportGraphQLError(error: mixed): ExecutionResult { - if (error instanceof GraphQLError) { - return { errors: [error] }; - } - throw error; -} - -function subscribeImpl( - args: SubscriptionArgs, -): Promise | ExecutionResult> { - const { - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - subscribeFieldResolver, - } = args; - - const sourcePromise = createSourceEventStream( - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - subscribeFieldResolver, - ); - - // For each payload yielded from a subscription, map it over the normal - // GraphQL `execute` function, with `payload` as the rootValue. - // This implements the "MapSourceToResponseEvent" algorithm described in - // the GraphQL specification. The `execute` function provides the - // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the - // "ExecuteQuery" algorithm, for which `execute` is also used. - const mapSourceToResponse = (payload) => - execute({ - schema, - document, - rootValue: payload, - contextValue, - variableValues, - operationName, - fieldResolver, - }); - - // Resolve the Source Stream, then map every source value to a - // ExecutionResult value as described above. - return sourcePromise.then((resultOrStream) => - // Note: Flow can't refine isAsyncIterable, so explicit casts are used. - isAsyncIterable(resultOrStream) - ? mapAsyncIterator( - resultOrStream, - mapSourceToResponse, - reportGraphQLError, - ) - : ((resultOrStream: any): ExecutionResult), - ); -} - -/** - * Implements the "CreateSourceEventStream" algorithm described in the - * GraphQL specification, resolving the subscription source event stream. - * - * Returns a Promise which resolves to either an AsyncIterable (if successful) - * or an ExecutionResult (error). The promise will be rejected if the schema or - * other arguments to this function are invalid, or if the resolved event stream - * is not an async iterable. - * - * If the client-provided arguments to this function do not result in a - * compliant subscription, a GraphQL Response (ExecutionResult) with - * descriptive errors and no data will be returned. - * - * If the the source stream could not be created due to faulty subscription - * resolver logic or underlying systems, the promise will resolve to a single - * ExecutionResult containing `errors` and no `data`. - * - * If the operation succeeded, the promise resolves to the AsyncIterable for the - * event stream returned by the resolver. - * - * A Source Event Stream represents a sequence of events, each of which triggers - * a GraphQL execution for that event. - * - * This may be useful when hosting the stateful subscription service in a - * different process or machine than the stateless GraphQL execution engine, - * or otherwise separating these two steps. For more on this, see the - * "Supporting Subscriptions at Scale" information in the GraphQL specification. - */ -export function createSourceEventStream( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: mixed, - contextValue?: mixed, - variableValues?: ?{ +[variable: string]: mixed, ... }, - operationName?: ?string, - fieldResolver?: ?GraphQLFieldResolver, -): Promise | ExecutionResult> { - // If arguments are missing or incorrectly typed, this is an internal - // developer mistake which should throw an early error. - assertValidExecutionArguments(schema, document, variableValues); - - return new Promise((resolve) => { - // If a valid context cannot be created due to incorrect arguments, - // this will throw an error. - const exeContext = buildExecutionContext( - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - ); - - resolve( - // Return early errors if execution context failed. - Array.isArray(exeContext) - ? { errors: exeContext } - : executeSubscription(exeContext), - ); - }).catch(reportGraphQLError); -} - -function executeSubscription( - exeContext: ExecutionContext, -): Promise> { - const { schema, operation, variableValues, rootValue } = exeContext; - const type = getOperationRootType(schema, operation); - const fields = collectFields( - exeContext, - type, - operation.selectionSet, - Object.create(null), - Object.create(null), - ); - const responseNames = Object.keys(fields); - const responseName = responseNames[0]; - const fieldNodes = fields[responseName]; - const fieldNode = fieldNodes[0]; - const fieldName = fieldNode.name.value; - const fieldDef = getFieldDef(schema, type, fieldName); - - if (!fieldDef) { - throw new GraphQLError( - `The subscription field "${fieldName}" is not defined.`, - fieldNodes, - ); - } - - const path = addPath(undefined, responseName, type.name); - const info = buildResolveInfo(exeContext, fieldDef, fieldNodes, type, path); - - // Coerce to Promise for easier error handling and consistent return type. - return new Promise((resolveResult) => { - // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. - // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. - - // Build a JS object of arguments from the field.arguments AST, using the - // variables scope to fulfill any variable references. - const args = getArgumentValues(fieldDef, fieldNodes[0], variableValues); - - // The resolve function's optional third argument is a context value that - // is provided to every resolve function within an execution. It is commonly - // used to represent an authenticated user, or request-specific caches. - const contextValue = exeContext.contextValue; - - // Call the `subscribe()` resolver or the default resolver to produce an - // AsyncIterable yielding raw payloads. - const resolveFn = fieldDef.subscribe ?? exeContext.fieldResolver; - resolveResult(resolveFn(rootValue, args, contextValue, info)); - }).then( - (eventStream) => { - if (eventStream instanceof Error) { - throw locatedError(eventStream, fieldNodes, pathToArray(path)); - } - - // Assert field returned an event stream, otherwise yield an error. - if (!isAsyncIterable(eventStream)) { - throw new Error( - 'Subscription field must return Async Iterable. ' + - `Received: ${inspect(eventStream)}.`, - ); - } - return eventStream; - }, - (error) => { - throw locatedError(error, fieldNodes, pathToArray(path)); - }, - ); -} diff --git a/node_modules/graphql/subscription/subscribe.mjs b/node_modules/graphql/subscription/subscribe.mjs deleted file mode 100644 index a35acf96..00000000 --- a/node_modules/graphql/subscription/subscribe.mjs +++ /dev/null @@ -1,172 +0,0 @@ -import inspect from "../jsutils/inspect.mjs"; -import isAsyncIterable from "../jsutils/isAsyncIterable.mjs"; -import { addPath, pathToArray } from "../jsutils/Path.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { locatedError } from "../error/locatedError.mjs"; -import { getArgumentValues } from "../execution/values.mjs"; -import { assertValidExecutionArguments, buildExecutionContext, buildResolveInfo, collectFields, execute, getFieldDef } from "../execution/execute.mjs"; -import { getOperationRootType } from "../utilities/getOperationRootType.mjs"; -import mapAsyncIterator from "./mapAsyncIterator.mjs"; -export function subscribe(argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - return arguments.length === 1 ? subscribeImpl(argsOrSchema) : subscribeImpl({ - schema: argsOrSchema, - document: document, - rootValue: rootValue, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver, - subscribeFieldResolver: subscribeFieldResolver - }); -} -/** - * This function checks if the error is a GraphQLError. If it is, report it as - * an ExecutionResult, containing only errors and no data. Otherwise treat the - * error as a system-class error and re-throw it. - */ - -function reportGraphQLError(error) { - if (error instanceof GraphQLError) { - return { - errors: [error] - }; - } - - throw error; -} - -function subscribeImpl(args) { - var schema = args.schema, - document = args.document, - rootValue = args.rootValue, - contextValue = args.contextValue, - variableValues = args.variableValues, - operationName = args.operationName, - fieldResolver = args.fieldResolver, - subscribeFieldResolver = args.subscribeFieldResolver; - var sourcePromise = createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, subscribeFieldResolver); // For each payload yielded from a subscription, map it over the normal - // GraphQL `execute` function, with `payload` as the rootValue. - // This implements the "MapSourceToResponseEvent" algorithm described in - // the GraphQL specification. The `execute` function provides the - // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the - // "ExecuteQuery" algorithm, for which `execute` is also used. - - var mapSourceToResponse = function mapSourceToResponse(payload) { - return execute({ - schema: schema, - document: document, - rootValue: payload, - contextValue: contextValue, - variableValues: variableValues, - operationName: operationName, - fieldResolver: fieldResolver - }); - }; // Resolve the Source Stream, then map every source value to a - // ExecutionResult value as described above. - - - return sourcePromise.then(function (resultOrStream) { - return (// Note: Flow can't refine isAsyncIterable, so explicit casts are used. - isAsyncIterable(resultOrStream) ? mapAsyncIterator(resultOrStream, mapSourceToResponse, reportGraphQLError) : resultOrStream - ); - }); -} -/** - * Implements the "CreateSourceEventStream" algorithm described in the - * GraphQL specification, resolving the subscription source event stream. - * - * Returns a Promise which resolves to either an AsyncIterable (if successful) - * or an ExecutionResult (error). The promise will be rejected if the schema or - * other arguments to this function are invalid, or if the resolved event stream - * is not an async iterable. - * - * If the client-provided arguments to this function do not result in a - * compliant subscription, a GraphQL Response (ExecutionResult) with - * descriptive errors and no data will be returned. - * - * If the the source stream could not be created due to faulty subscription - * resolver logic or underlying systems, the promise will resolve to a single - * ExecutionResult containing `errors` and no `data`. - * - * If the operation succeeded, the promise resolves to the AsyncIterable for the - * event stream returned by the resolver. - * - * A Source Event Stream represents a sequence of events, each of which triggers - * a GraphQL execution for that event. - * - * This may be useful when hosting the stateful subscription service in a - * different process or machine than the stateless GraphQL execution engine, - * or otherwise separating these two steps. For more on this, see the - * "Supporting Subscriptions at Scale" information in the GraphQL specification. - */ - - -export function createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver) { - // If arguments are missing or incorrectly typed, this is an internal - // developer mistake which should throw an early error. - assertValidExecutionArguments(schema, document, variableValues); - return new Promise(function (resolve) { - // If a valid context cannot be created due to incorrect arguments, - // this will throw an error. - var exeContext = buildExecutionContext(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver); - resolve( // Return early errors if execution context failed. - Array.isArray(exeContext) ? { - errors: exeContext - } : executeSubscription(exeContext)); - }).catch(reportGraphQLError); -} - -function executeSubscription(exeContext) { - var schema = exeContext.schema, - operation = exeContext.operation, - variableValues = exeContext.variableValues, - rootValue = exeContext.rootValue; - var type = getOperationRootType(schema, operation); - var fields = collectFields(exeContext, type, operation.selectionSet, Object.create(null), Object.create(null)); - var responseNames = Object.keys(fields); - var responseName = responseNames[0]; - var fieldNodes = fields[responseName]; - var fieldNode = fieldNodes[0]; - var fieldName = fieldNode.name.value; - var fieldDef = getFieldDef(schema, type, fieldName); - - if (!fieldDef) { - throw new GraphQLError("The subscription field \"".concat(fieldName, "\" is not defined."), fieldNodes); - } - - var path = addPath(undefined, responseName, type.name); - var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, type, path); // Coerce to Promise for easier error handling and consistent return type. - - return new Promise(function (resolveResult) { - var _fieldDef$subscribe; - - // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. - // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. - // Build a JS object of arguments from the field.arguments AST, using the - // variables scope to fulfill any variable references. - var args = getArgumentValues(fieldDef, fieldNodes[0], variableValues); // The resolve function's optional third argument is a context value that - // is provided to every resolve function within an execution. It is commonly - // used to represent an authenticated user, or request-specific caches. - - var contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an - // AsyncIterable yielding raw payloads. - - var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver; - resolveResult(resolveFn(rootValue, args, contextValue, info)); - }).then(function (eventStream) { - if (eventStream instanceof Error) { - throw locatedError(eventStream, fieldNodes, pathToArray(path)); - } // Assert field returned an event stream, otherwise yield an error. - - - if (!isAsyncIterable(eventStream)) { - throw new Error('Subscription field must return Async Iterable. ' + "Received: ".concat(inspect(eventStream), ".")); - } - - return eventStream; - }, function (error) { - throw locatedError(error, fieldNodes, pathToArray(path)); - }); -} diff --git a/node_modules/graphql/type/definition.d.ts b/node_modules/graphql/type/definition.d.ts deleted file mode 100644 index 06799981..00000000 --- a/node_modules/graphql/type/definition.d.ts +++ /dev/null @@ -1,947 +0,0 @@ -// FIXME -/* eslint-disable import/no-cycle */ - -import { Maybe } from '../jsutils/Maybe'; - -import { PromiseOrValue } from '../jsutils/PromiseOrValue'; -import { Path } from '../jsutils/Path'; - -import { - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - ObjectTypeExtensionNode, - InterfaceTypeExtensionNode, - OperationDefinitionNode, - FieldNode, - FragmentDefinitionNode, - ValueNode, - ScalarTypeExtensionNode, - UnionTypeExtensionNode, - EnumTypeExtensionNode, - InputObjectTypeExtensionNode, -} from '../language/ast'; - -import { GraphQLSchema } from './schema'; - -/** - * These are all of the possible kinds of types. - */ -export type GraphQLType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull; - -export function isType(type: any): type is GraphQLType; - -export function assertType(type: any): GraphQLType; - -export function isScalarType(type: any): type is GraphQLScalarType; - -export function assertScalarType(type: any): GraphQLScalarType; - -export function isObjectType(type: any): type is GraphQLObjectType; - -export function assertObjectType(type: any): GraphQLObjectType; - -export function isInterfaceType(type: any): type is GraphQLInterfaceType; - -export function assertInterfaceType(type: any): GraphQLInterfaceType; - -export function isUnionType(type: any): type is GraphQLUnionType; - -export function assertUnionType(type: any): GraphQLUnionType; - -export function isEnumType(type: any): type is GraphQLEnumType; - -export function assertEnumType(type: any): GraphQLEnumType; - -export function isInputObjectType(type: any): type is GraphQLInputObjectType; - -export function assertInputObjectType(type: any): GraphQLInputObjectType; - -export function isListType(type: any): type is GraphQLList; - -export function assertListType(type: any): GraphQLList; - -export function isNonNullType(type: any): type is GraphQLNonNull; - -export function assertNonNullType(type: any): GraphQLNonNull; - -/** - * These types may be used as input types for arguments and directives. - */ -// TS_SPECIFIC: TS does not allow recursive type definitions, hence the `any`s -export type GraphQLInputType = - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - >; - -export function isInputType(type: any): type is GraphQLInputType; - -export function assertInputType(type: any): GraphQLInputType; - -/** - * These types may be used as output types as the result of fields. - */ -// TS_SPECIFIC: TS does not allow recursive type definitions, hence the `any`s -export type GraphQLOutputType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - >; - -export function isOutputType(type: any): type is GraphQLOutputType; - -export function assertOutputType(type: any): GraphQLOutputType; - -/** - * These types may describe types which may be leaf values. - */ -export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; - -export function isLeafType(type: any): type is GraphQLLeafType; - -export function assertLeafType(type: any): GraphQLLeafType; - -/** - * These types may describe the parent context of a selection set. - */ -export type GraphQLCompositeType = - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType; - -export function isCompositeType(type: any): type is GraphQLCompositeType; - -export function assertCompositeType(type: any): GraphQLCompositeType; - -/** - * These types may describe the parent context of a selection set. - */ -export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType; - -export function isAbstractType(type: any): type is GraphQLAbstractType; - -export function assertAbstractType(type: any): GraphQLAbstractType; - -/** - * List Modifier - * - * A list is a kind of type marker, a wrapping type which points to another - * type. Lists are often created within the context of defining the fields - * of an object type. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * parents: { type: new GraphQLList(Person) }, - * children: { type: new GraphQLList(Person) }, - * }) - * }) - * - */ -interface GraphQLList { - readonly ofType: T; - toString: () => string; - toJSON: () => string; - inspect: () => string; -} - -interface _GraphQLList { - (type: T): GraphQLList; - new (type: T): GraphQLList; -} - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const GraphQLList: _GraphQLList; - -/** - * Non-Null Modifier - * - * A non-null is a kind of type marker, a wrapping type which points to another - * type. Non-null types enforce that their values are never null and can ensure - * an error is raised if this ever occurs during a request. It is useful for - * fields which you can make a strong guarantee on non-nullability, for example - * usually the id field of a database row will never be null. - * - * Example: - * - * const RowType = new GraphQLObjectType({ - * name: 'Row', - * fields: () => ({ - * id: { type: new GraphQLNonNull(GraphQLString) }, - * }) - * }) - * - * Note: the enforcement of non-nullability occurs within the executor. - */ -interface GraphQLNonNull { - readonly ofType: T; - toString: () => string; - toJSON: () => string; - inspect: () => string; -} - -interface _GraphQLNonNull { - (type: T): GraphQLNonNull; - new (type: T): GraphQLNonNull; -} - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const GraphQLNonNull: _GraphQLNonNull; - -export type GraphQLWrappingType = GraphQLList | GraphQLNonNull; - -export function isWrappingType(type: any): type is GraphQLWrappingType; - -export function assertWrappingType(type: any): GraphQLWrappingType; - -/** - * These types can all accept null as a value. - */ -export type GraphQLNullableType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList; - -export function isNullableType(type: any): type is GraphQLNullableType; - -export function assertNullableType(type: any): GraphQLNullableType; - -export function getNullableType(type: undefined): undefined; -export function getNullableType(type: T): T; -export function getNullableType( - // FIXME Disabled because of https://github.com/yaacovCR/graphql-tools-fork/issues/40#issuecomment-586671219 - // eslint-disable-next-line @typescript-eslint/unified-signatures - type: GraphQLNonNull, -): T; - -/** - * These named types do not include modifiers like List or NonNull. - */ -export type GraphQLNamedType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType; - -export function isNamedType(type: any): type is GraphQLNamedType; - -export function assertNamedType(type: any): GraphQLNamedType; - -export function getNamedType(type: undefined): undefined; -export function getNamedType(type: GraphQLType): GraphQLNamedType; - -/** - * Used while defining GraphQL types to allow for circular references in - * otherwise immutable type definitions. - */ -export type Thunk = (() => T) | T; - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLScalarTypeExtensions { - [attributeName: string]: any; -} - -/** - * Scalar Type Definition - * - * The leaf values of any request and input values to arguments are - * Scalars (or Enums) and are defined with a name and a series of functions - * used to parse input from ast or variables and to ensure validity. - * - * Example: - * - * const OddType = new GraphQLScalarType({ - * name: 'Odd', - * serialize(value) { - * return value % 2 === 1 ? value : null; - * } - * }); - * - */ -export class GraphQLScalarType { - name: string; - description: Maybe; - specifiedByUrl: Maybe; - serialize: GraphQLScalarSerializer; - parseValue: GraphQLScalarValueParser; - parseLiteral: GraphQLScalarLiteralParser; - extensions: Maybe>; - astNode: Maybe; - extensionASTNodes: Maybe>; - - constructor(config: Readonly>); - - toConfig(): GraphQLScalarTypeConfig & { - specifiedByUrl: Maybe; - serialize: GraphQLScalarSerializer; - parseValue: GraphQLScalarValueParser; - parseLiteral: GraphQLScalarLiteralParser; - extensions: Maybe>; - extensionASTNodes: ReadonlyArray; - }; - - toString(): string; - toJSON(): string; - inspect(): string; -} - -export type GraphQLScalarSerializer = ( - value: any, -) => Maybe; -export type GraphQLScalarValueParser = ( - value: any, -) => Maybe; -export type GraphQLScalarLiteralParser = ( - valueNode: ValueNode, - variables: Maybe<{ [key: string]: any }>, -) => Maybe; - -export interface GraphQLScalarTypeConfig { - name: string; - description?: Maybe; - specifiedByUrl?: Maybe; - // Serializes an internal value to include in a response. - serialize?: GraphQLScalarSerializer; - // Parses an externally provided value to use as an input. - parseValue?: GraphQLScalarValueParser; - // Parses an externally provided literal value to use as an input. - parseLiteral?: GraphQLScalarLiteralParser; - extensions?: Maybe>; - astNode?: Maybe; - extensionASTNodes?: Maybe>; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - * - * We've provided these template arguments because this is an open type and - * you may find them useful. - */ -export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { - [attributeName: string]: any; -} - -/** - * Object Type Definition - * - * Almost all of the GraphQL types you define will be object types. Object types - * have a name, but most importantly describe their fields. - * - * Example: - * - * const AddressType = new GraphQLObjectType({ - * name: 'Address', - * fields: { - * street: { type: GraphQLString }, - * number: { type: GraphQLInt }, - * formatted: { - * type: GraphQLString, - * resolve(obj) { - * return obj.number + ' ' + obj.street - * } - * } - * } - * }); - * - * When two types need to refer to each other, or a type needs to refer to - * itself in a field, you can use a function expression (aka a closure or a - * thunk) to supply the fields lazily. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * name: { type: GraphQLString }, - * bestFriend: { type: PersonType }, - * }) - * }); - * - */ -export class GraphQLObjectType { - name: string; - description: Maybe; - isTypeOf: Maybe>; - extensions: Maybe>>; - astNode: Maybe; - extensionASTNodes: Maybe>; - - constructor(config: Readonly>); - - getFields(): GraphQLFieldMap; - getInterfaces(): Array; - - toConfig(): GraphQLObjectTypeConfig & { - interfaces: Array; - fields: GraphQLFieldConfigMap; - extensions: Maybe>>; - extensionASTNodes: ReadonlyArray; - }; - - toString(): string; - toJSON(): string; - inspect(): string; -} - -export function argsToArgsConfig( - args: ReadonlyArray, -): GraphQLFieldConfigArgumentMap; - -export interface GraphQLObjectTypeConfig { - name: string; - description?: Maybe; - interfaces?: Thunk>>; - fields: Thunk>; - isTypeOf?: Maybe>; - extensions?: Maybe>>; - astNode?: Maybe; - extensionASTNodes?: Maybe>; -} - -export type GraphQLTypeResolver = ( - value: TSource, - context: TContext, - info: GraphQLResolveInfo, - abstractType: GraphQLAbstractType, -) => PromiseOrValue | string>>; - -export type GraphQLIsTypeOfFn = ( - source: TSource, - context: TContext, - info: GraphQLResolveInfo, -) => PromiseOrValue; - -export type GraphQLFieldResolver< - TSource, - TContext, - TArgs = { [argName: string]: any } -> = ( - source: TSource, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => any; - -export interface GraphQLResolveInfo { - readonly fieldName: string; - readonly fieldNodes: ReadonlyArray; - readonly returnType: GraphQLOutputType; - readonly parentType: GraphQLObjectType; - readonly path: Path; - readonly schema: GraphQLSchema; - readonly fragments: { [key: string]: FragmentDefinitionNode }; - readonly rootValue: any; - readonly operation: OperationDefinitionNode; - readonly variableValues: { [variableName: string]: any }; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - * - * We've provided these template arguments because this is an open type and - * you may find them useful. - */ -export interface GraphQLFieldExtensions< - _TSource, - _TContext, - _TArgs = { [argName: string]: any } -> { - [attributeName: string]: any; -} - -export interface GraphQLFieldConfig< - TSource, - TContext, - TArgs = { [argName: string]: any } -> { - description?: Maybe; - type: GraphQLOutputType; - args?: GraphQLFieldConfigArgumentMap; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - deprecationReason?: Maybe; - extensions?: Maybe< - Readonly> - >; - astNode?: Maybe; -} - -export interface GraphQLFieldConfigArgumentMap { - [key: string]: GraphQLArgumentConfig; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLArgumentExtensions { - [attributeName: string]: any; -} - -export interface GraphQLArgumentConfig { - description?: Maybe; - type: GraphQLInputType; - defaultValue?: any; - deprecationReason?: Maybe; - extensions?: Maybe>; - astNode?: Maybe; -} - -export interface GraphQLFieldConfigMap { - [key: string]: GraphQLFieldConfig; -} - -export interface GraphQLField< - TSource, - TContext, - TArgs = { [key: string]: any } -> { - name: string; - description: Maybe; - type: GraphQLOutputType; - args: Array; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - deprecationReason: Maybe; - extensions: Maybe>>; - astNode?: Maybe; - - // @deprecated and will be removed in v16 - isDeprecated: boolean; -} - -export interface GraphQLArgument { - name: string; - description: Maybe; - type: GraphQLInputType; - defaultValue: any; - deprecationReason: Maybe; - extensions: Maybe>; - astNode: Maybe; -} - -export function isRequiredArgument(arg: GraphQLArgument): boolean; - -export interface GraphQLFieldMap { - [key: string]: GraphQLField; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLInterfaceTypeExtensions { - [attributeName: string]: any; -} - -/** - * Interface Type Definition - * - * When a field can return one of a heterogeneous set of types, a Interface type - * is used to describe what types are possible, what fields are in common across - * all types, as well as a function to determine which type is actually used - * when the field is resolved. - * - * Example: - * - * const EntityType = new GraphQLInterfaceType({ - * name: 'Entity', - * fields: { - * name: { type: GraphQLString } - * } - * }); - * - */ -export class GraphQLInterfaceType { - name: string; - description: Maybe; - resolveType: Maybe>; - extensions: Maybe>; - astNode?: Maybe; - extensionASTNodes: Maybe>; - - constructor(config: Readonly>); - getFields(): GraphQLFieldMap; - getInterfaces(): Array; - - toConfig(): GraphQLInterfaceTypeConfig & { - interfaces: Array; - fields: GraphQLFieldConfigMap; - extensions: Maybe>; - extensionASTNodes: ReadonlyArray; - }; - - toString(): string; - toJSON(): string; - inspect(): string; -} - -export interface GraphQLInterfaceTypeConfig { - name: string; - description?: Maybe; - interfaces?: Thunk>>; - fields: Thunk>; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: Maybe>; - extensions?: Maybe>; - astNode?: Maybe; - extensionASTNodes?: Maybe>; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLUnionTypeExtensions { - [attributeName: string]: any; -} - -/** - * Union Type Definition - * - * When a field can return one of a heterogeneous set of types, a Union type - * is used to describe what types are possible as well as providing a function - * to determine which type is actually used when the field is resolved. - * - * Example: - * - * const PetType = new GraphQLUnionType({ - * name: 'Pet', - * types: [ DogType, CatType ], - * resolveType(value) { - * if (value instanceof Dog) { - * return DogType; - * } - * if (value instanceof Cat) { - * return CatType; - * } - * } - * }); - * - */ -export class GraphQLUnionType { - name: string; - description: Maybe; - resolveType: Maybe>; - extensions: Maybe>; - astNode: Maybe; - extensionASTNodes: Maybe>; - - constructor(config: Readonly>); - getTypes(): Array; - - toConfig(): GraphQLUnionTypeConfig & { - types: Array; - extensions: Maybe>; - extensionASTNodes: ReadonlyArray; - }; - - toString(): string; - toJSON(): string; - inspect(): string; -} - -export interface GraphQLUnionTypeConfig { - name: string; - description?: Maybe; - types: Thunk>; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: Maybe>; - extensions?: Maybe>; - astNode?: Maybe; - extensionASTNodes?: Maybe>; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLEnumTypeExtensions { - [attributeName: string]: any; -} - -/** - * Enum Type Definition - * - * Some leaf values of requests and input values are Enums. GraphQL serializes - * Enum values as strings, however internally Enums can be represented by any - * kind of type, often integers. - * - * Example: - * - * const RGBType = new GraphQLEnumType({ - * name: 'RGB', - * values: { - * RED: { value: 0 }, - * GREEN: { value: 1 }, - * BLUE: { value: 2 } - * } - * }); - * - * Note: If a value is not provided in a definition, the name of the enum value - * will be used as its internal value. - */ -export class GraphQLEnumType { - name: string; - description: Maybe; - extensions: Maybe>; - astNode: Maybe; - extensionASTNodes: Maybe>; - - constructor(config: Readonly); - getValues(): Array; - getValue(name: string): Maybe; - serialize(value: any): Maybe; - parseValue(value: any): Maybe; - parseLiteral( - valueNode: ValueNode, - _variables: Maybe<{ [key: string]: any }>, - ): Maybe; - - toConfig(): GraphQLEnumTypeConfig & { - extensions: Maybe>; - extensionASTNodes: ReadonlyArray; - }; - - toString(): string; - toJSON(): string; - inspect(): string; -} - -export interface GraphQLEnumTypeConfig { - name: string; - description?: Maybe; - values: GraphQLEnumValueConfigMap; - extensions?: Maybe>; - astNode?: Maybe; - extensionASTNodes?: Maybe>; -} - -export interface GraphQLEnumValueConfigMap { - [key: string]: GraphQLEnumValueConfig; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLEnumValueExtensions { - [attributeName: string]: any; -} - -export interface GraphQLEnumValueConfig { - description?: Maybe; - value?: any; - deprecationReason?: Maybe; - extensions?: Maybe>; - astNode?: Maybe; -} - -export interface GraphQLEnumValue { - name: string; - description: Maybe; - value: any; - deprecationReason: Maybe; - extensions: Maybe>; - astNode?: Maybe; - - // @deprecated and will be removed in v16 - isDeprecated: boolean; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLInputObjectTypeExtensions { - [attributeName: string]: any; -} - -/** - * Input Object Type Definition - * - * An input object defines a structured collection of fields which may be - * supplied to a field argument. - * - * Using `NonNull` will ensure that a value must be provided by the query - * - * Example: - * - * const GeoPoint = new GraphQLInputObjectType({ - * name: 'GeoPoint', - * fields: { - * lat: { type: new GraphQLNonNull(GraphQLFloat) }, - * lon: { type: new GraphQLNonNull(GraphQLFloat) }, - * alt: { type: GraphQLFloat, defaultValue: 0 }, - * } - * }); - * - */ -export class GraphQLInputObjectType { - name: string; - description: Maybe; - extensions: Maybe>; - astNode: Maybe; - extensionASTNodes: Maybe>; - - constructor(config: Readonly); - getFields(): GraphQLInputFieldMap; - - toConfig(): GraphQLInputObjectTypeConfig & { - fields: GraphQLInputFieldConfigMap; - extensions: Maybe>; - extensionASTNodes: ReadonlyArray; - }; - - toString(): string; - toJSON(): string; - inspect(): string; -} - -export interface GraphQLInputObjectTypeConfig { - name: string; - description?: Maybe; - fields: Thunk; - extensions?: Maybe>; - astNode?: Maybe; - extensionASTNodes?: Maybe>; -} - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLInputFieldExtensions { - [attributeName: string]: any; -} - -export interface GraphQLInputFieldConfig { - description?: Maybe; - type: GraphQLInputType; - defaultValue?: any; - deprecationReason?: Maybe; - extensions?: Maybe>; - astNode?: Maybe; -} - -export interface GraphQLInputFieldConfigMap { - [key: string]: GraphQLInputFieldConfig; -} - -export interface GraphQLInputField { - name: string; - description?: Maybe; - type: GraphQLInputType; - defaultValue?: any; - deprecationReason: Maybe; - extensions: Maybe>; - astNode?: Maybe; -} - -export function isRequiredInputField(field: GraphQLInputField): boolean; - -export interface GraphQLInputFieldMap { - [key: string]: GraphQLInputField; -} diff --git a/node_modules/graphql/type/definition.js b/node_modules/graphql/type/definition.js deleted file mode 100644 index 21b6712e..00000000 --- a/node_modules/graphql/type/definition.js +++ /dev/null @@ -1,1225 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isType = isType; -exports.assertType = assertType; -exports.isScalarType = isScalarType; -exports.assertScalarType = assertScalarType; -exports.isObjectType = isObjectType; -exports.assertObjectType = assertObjectType; -exports.isInterfaceType = isInterfaceType; -exports.assertInterfaceType = assertInterfaceType; -exports.isUnionType = isUnionType; -exports.assertUnionType = assertUnionType; -exports.isEnumType = isEnumType; -exports.assertEnumType = assertEnumType; -exports.isInputObjectType = isInputObjectType; -exports.assertInputObjectType = assertInputObjectType; -exports.isListType = isListType; -exports.assertListType = assertListType; -exports.isNonNullType = isNonNullType; -exports.assertNonNullType = assertNonNullType; -exports.isInputType = isInputType; -exports.assertInputType = assertInputType; -exports.isOutputType = isOutputType; -exports.assertOutputType = assertOutputType; -exports.isLeafType = isLeafType; -exports.assertLeafType = assertLeafType; -exports.isCompositeType = isCompositeType; -exports.assertCompositeType = assertCompositeType; -exports.isAbstractType = isAbstractType; -exports.assertAbstractType = assertAbstractType; -exports.GraphQLList = GraphQLList; -exports.GraphQLNonNull = GraphQLNonNull; -exports.isWrappingType = isWrappingType; -exports.assertWrappingType = assertWrappingType; -exports.isNullableType = isNullableType; -exports.assertNullableType = assertNullableType; -exports.getNullableType = getNullableType; -exports.isNamedType = isNamedType; -exports.assertNamedType = assertNamedType; -exports.getNamedType = getNamedType; -exports.argsToArgsConfig = argsToArgsConfig; -exports.isRequiredArgument = isRequiredArgument; -exports.isRequiredInputField = isRequiredInputField; -exports.GraphQLInputObjectType = exports.GraphQLEnumType = exports.GraphQLUnionType = exports.GraphQLInterfaceType = exports.GraphQLObjectType = exports.GraphQLScalarType = void 0; - -var _objectEntries = _interopRequireDefault(require("../polyfills/objectEntries.js")); - -var _symbols = require("../polyfills/symbols.js"); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _keyMap = _interopRequireDefault(require("../jsutils/keyMap.js")); - -var _mapValue = _interopRequireDefault(require("../jsutils/mapValue.js")); - -var _toObjMap = _interopRequireDefault(require("../jsutils/toObjMap.js")); - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap.js")); - -var _instanceOf = _interopRequireDefault(require("../jsutils/instanceOf.js")); - -var _didYouMean = _interopRequireDefault(require("../jsutils/didYouMean.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _identityFunc = _interopRequireDefault(require("../jsutils/identityFunc.js")); - -var _defineInspect = _interopRequireDefault(require("../jsutils/defineInspect.js")); - -var _suggestionList = _interopRequireDefault(require("../jsutils/suggestionList.js")); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _kinds = require("../language/kinds.js"); - -var _printer = require("../language/printer.js"); - -var _valueFromASTUntyped = require("../utilities/valueFromASTUntyped.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function isType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type); -} - -function assertType(type) { - if (!isType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL type.")); - } - - return type; -} -/** - * There are predicates for each kind of GraphQL type. - */ - - -// eslint-disable-next-line no-redeclare -function isScalarType(type) { - return (0, _instanceOf.default)(type, GraphQLScalarType); -} - -function assertScalarType(type) { - if (!isScalarType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Scalar type.")); - } - - return type; -} - -// eslint-disable-next-line no-redeclare -function isObjectType(type) { - return (0, _instanceOf.default)(type, GraphQLObjectType); -} - -function assertObjectType(type) { - if (!isObjectType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Object type.")); - } - - return type; -} - -// eslint-disable-next-line no-redeclare -function isInterfaceType(type) { - return (0, _instanceOf.default)(type, GraphQLInterfaceType); -} - -function assertInterfaceType(type) { - if (!isInterfaceType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Interface type.")); - } - - return type; -} - -// eslint-disable-next-line no-redeclare -function isUnionType(type) { - return (0, _instanceOf.default)(type, GraphQLUnionType); -} - -function assertUnionType(type) { - if (!isUnionType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Union type.")); - } - - return type; -} - -// eslint-disable-next-line no-redeclare -function isEnumType(type) { - return (0, _instanceOf.default)(type, GraphQLEnumType); -} - -function assertEnumType(type) { - if (!isEnumType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type.")); - } - - return type; -} - -// eslint-disable-next-line no-redeclare -function isInputObjectType(type) { - return (0, _instanceOf.default)(type, GraphQLInputObjectType); -} - -function assertInputObjectType(type) { - if (!isInputObjectType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Input Object type.")); - } - - return type; -} - -// eslint-disable-next-line no-redeclare -function isListType(type) { - return (0, _instanceOf.default)(type, GraphQLList); -} - -function assertListType(type) { - if (!isListType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL List type.")); - } - - return type; -} - -// eslint-disable-next-line no-redeclare -function isNonNullType(type) { - return (0, _instanceOf.default)(type, GraphQLNonNull); -} - -function assertNonNullType(type) { - if (!isNonNullType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Non-Null type.")); - } - - return type; -} -/** - * These types may be used as input types for arguments and directives. - */ - - -function isInputType(type) { - return isScalarType(type) || isEnumType(type) || isInputObjectType(type) || isWrappingType(type) && isInputType(type.ofType); -} - -function assertInputType(type) { - if (!isInputType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL input type.")); - } - - return type; -} -/** - * These types may be used as output types as the result of fields. - */ - - -function isOutputType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isWrappingType(type) && isOutputType(type.ofType); -} - -function assertOutputType(type) { - if (!isOutputType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL output type.")); - } - - return type; -} -/** - * These types may describe types which may be leaf values. - */ - - -function isLeafType(type) { - return isScalarType(type) || isEnumType(type); -} - -function assertLeafType(type) { - if (!isLeafType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL leaf type.")); - } - - return type; -} -/** - * These types may describe the parent context of a selection set. - */ - - -function isCompositeType(type) { - return isObjectType(type) || isInterfaceType(type) || isUnionType(type); -} - -function assertCompositeType(type) { - if (!isCompositeType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL composite type.")); - } - - return type; -} -/** - * These types may describe the parent context of a selection set. - */ - - -function isAbstractType(type) { - return isInterfaceType(type) || isUnionType(type); -} - -function assertAbstractType(type) { - if (!isAbstractType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type.")); - } - - return type; -} -/** - * List Type Wrapper - * - * A list is a wrapping type which points to another type. - * Lists are often created within the context of defining the fields of - * an object type. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * parents: { type: new GraphQLList(PersonType) }, - * children: { type: new GraphQLList(PersonType) }, - * }) - * }) - * - */ -// FIXME: workaround to fix issue with Babel parser - -/* :: -declare class GraphQLList<+T: GraphQLType> { - +ofType: T; - static (ofType: T): GraphQLList; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - - -function GraphQLList(ofType) { - // istanbul ignore else (to be removed in v16.0.0) - if (this instanceof GraphQLList) { - this.ofType = assertType(ofType); - } else { - return new GraphQLList(ofType); - } -} // Need to cast through any to alter the prototype. - - -GraphQLList.prototype.toString = function toString() { - return '[' + String(this.ofType) + ']'; -}; - -GraphQLList.prototype.toJSON = function toJSON() { - return this.toString(); -}; - -Object.defineProperty(GraphQLList.prototype, _symbols.SYMBOL_TO_STRING_TAG, { - get: function get() { - return 'GraphQLList'; - } -}); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -(0, _defineInspect.default)(GraphQLList); -/** - * Non-Null Type Wrapper - * - * A non-null is a wrapping type which points to another type. - * Non-null types enforce that their values are never null and can ensure - * an error is raised if this ever occurs during a request. It is useful for - * fields which you can make a strong guarantee on non-nullability, for example - * usually the id field of a database row will never be null. - * - * Example: - * - * const RowType = new GraphQLObjectType({ - * name: 'Row', - * fields: () => ({ - * id: { type: new GraphQLNonNull(GraphQLString) }, - * }) - * }) - * - * Note: the enforcement of non-nullability occurs within the executor. - */ -// FIXME: workaround to fix issue with Babel parser - -/* :: -declare class GraphQLNonNull<+T: GraphQLNullableType> { - +ofType: T; - static (ofType: T): GraphQLNonNull; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - -function GraphQLNonNull(ofType) { - // istanbul ignore else (to be removed in v16.0.0) - if (this instanceof GraphQLNonNull) { - this.ofType = assertNullableType(ofType); - } else { - return new GraphQLNonNull(ofType); - } -} // Need to cast through any to alter the prototype. - - -GraphQLNonNull.prototype.toString = function toString() { - return String(this.ofType) + '!'; -}; - -GraphQLNonNull.prototype.toJSON = function toJSON() { - return this.toString(); -}; - -Object.defineProperty(GraphQLNonNull.prototype, _symbols.SYMBOL_TO_STRING_TAG, { - get: function get() { - return 'GraphQLNonNull'; - } -}); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -(0, _defineInspect.default)(GraphQLNonNull); -/** - * These types wrap and modify other types - */ - -function isWrappingType(type) { - return isListType(type) || isNonNullType(type); -} - -function assertWrappingType(type) { - if (!isWrappingType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL wrapping type.")); - } - - return type; -} -/** - * These types can all accept null as a value. - */ - - -function isNullableType(type) { - return isType(type) && !isNonNullType(type); -} - -function assertNullableType(type) { - if (!isNullableType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL nullable type.")); - } - - return type; -} -/* eslint-disable no-redeclare */ - - -function getNullableType(type) { - /* eslint-enable no-redeclare */ - if (type) { - return isNonNullType(type) ? type.ofType : type; - } -} -/** - * These named types do not include modifiers like List or NonNull. - */ - - -function isNamedType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type); -} - -function assertNamedType(type) { - if (!isNamedType(type)) { - throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL named type.")); - } - - return type; -} -/* eslint-disable no-redeclare */ - - -function getNamedType(type) { - /* eslint-enable no-redeclare */ - if (type) { - var unwrappedType = type; - - while (isWrappingType(unwrappedType)) { - unwrappedType = unwrappedType.ofType; - } - - return unwrappedType; - } -} -/** - * Used while defining GraphQL types to allow for circular references in - * otherwise immutable type definitions. - */ - - -function resolveThunk(thunk) { - // $FlowFixMe[incompatible-use] - return typeof thunk === 'function' ? thunk() : thunk; -} - -function undefineIfEmpty(arr) { - return arr && arr.length > 0 ? arr : undefined; -} -/** - * Scalar Type Definition - * - * The leaf values of any request and input values to arguments are - * Scalars (or Enums) and are defined with a name and a series of functions - * used to parse input from ast or variables and to ensure validity. - * - * If a type's serialize function does not return a value (i.e. it returns - * `undefined`) then an error will be raised and a `null` value will be returned - * in the response. If the serialize function returns `null`, then no error will - * be included in the response. - * - * Example: - * - * const OddType = new GraphQLScalarType({ - * name: 'Odd', - * serialize(value) { - * if (value % 2 === 1) { - * return value; - * } - * } - * }); - * - */ - - -var GraphQLScalarType = /*#__PURE__*/function () { - function GraphQLScalarType(config) { - var _config$parseValue, _config$serialize, _config$parseLiteral; - - var parseValue = (_config$parseValue = config.parseValue) !== null && _config$parseValue !== void 0 ? _config$parseValue : _identityFunc.default; - this.name = config.name; - this.description = config.description; - this.specifiedByUrl = config.specifiedByUrl; - this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== void 0 ? _config$serialize : _identityFunc.default; - this.parseValue = parseValue; - this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : function (node, variables) { - return parseValue((0, _valueFromASTUntyped.valueFromASTUntyped)(node, variables)); - }; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); - config.specifiedByUrl == null || typeof config.specifiedByUrl === 'string' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"specifiedByUrl\" as a string, ") + "but got: ".concat((0, _inspect.default)(config.specifiedByUrl), ".")); - config.serialize == null || typeof config.serialize === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided.")); - - if (config.parseLiteral) { - typeof config.parseValue === 'function' && typeof config.parseLiteral === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide both \"parseValue\" and \"parseLiteral\" functions.")); - } - } - - var _proto = GraphQLScalarType.prototype; - - _proto.toConfig = function toConfig() { - var _this$extensionASTNod; - - return { - name: this.name, - description: this.description, - specifiedByUrl: this.specifiedByUrl, - serialize: this.serialize, - parseValue: this.parseValue, - parseLiteral: this.parseLiteral, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod = this.extensionASTNodes) !== null && _this$extensionASTNod !== void 0 ? _this$extensionASTNod : [] - }; - }; - - _proto.toString = function toString() { - return this.name; - }; - - _proto.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLScalarType, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLScalarType'; - } - }]); - - return GraphQLScalarType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.GraphQLScalarType = GraphQLScalarType; -(0, _defineInspect.default)(GraphQLScalarType); - -/** - * Object Type Definition - * - * Almost all of the GraphQL types you define will be object types. Object types - * have a name, but most importantly describe their fields. - * - * Example: - * - * const AddressType = new GraphQLObjectType({ - * name: 'Address', - * fields: { - * street: { type: GraphQLString }, - * number: { type: GraphQLInt }, - * formatted: { - * type: GraphQLString, - * resolve(obj) { - * return obj.number + ' ' + obj.street - * } - * } - * } - * }); - * - * When two types need to refer to each other, or a type needs to refer to - * itself in a field, you can use a function expression (aka a closure or a - * thunk) to supply the fields lazily. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * name: { type: GraphQLString }, - * bestFriend: { type: PersonType }, - * }) - * }); - * - */ -var GraphQLObjectType = /*#__PURE__*/function () { - function GraphQLObjectType(config) { - this.name = config.name; - this.description = config.description; - this.isTypeOf = config.isTypeOf; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); - config.isTypeOf == null || typeof config.isTypeOf === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"isTypeOf\" as a function, ") + "but got: ".concat((0, _inspect.default)(config.isTypeOf), ".")); - } - - var _proto2 = GraphQLObjectType.prototype; - - _proto2.getFields = function getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - }; - - _proto2.getInterfaces = function getInterfaces() { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - - return this._interfaces; - }; - - _proto2.toConfig = function toConfig() { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - isTypeOf: this.isTypeOf, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes || [] - }; - }; - - _proto2.toString = function toString() { - return this.name; - }; - - _proto2.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLObjectType, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLObjectType'; - } - }]); - - return GraphQLObjectType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.GraphQLObjectType = GraphQLObjectType; -(0, _defineInspect.default)(GraphQLObjectType); - -function defineInterfaces(config) { - var _resolveThunk; - - var interfaces = (_resolveThunk = resolveThunk(config.interfaces)) !== null && _resolveThunk !== void 0 ? _resolveThunk : []; - Array.isArray(interfaces) || (0, _devAssert.default)(0, "".concat(config.name, " interfaces must be an Array or a function which returns an Array.")); - return interfaces; -} - -function defineFieldMap(config) { - var fieldMap = resolveThunk(config.fields); - isPlainObj(fieldMap) || (0, _devAssert.default)(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object.")); - return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) { - var _fieldConfig$args; - - isPlainObj(fieldConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object.")); - !('isDeprecated' in fieldConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" instead of \"isDeprecated\".")); - fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function' || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " field resolver must be a function if ") + "provided, but got: ".concat((0, _inspect.default)(fieldConfig.resolve), ".")); - var argsConfig = (_fieldConfig$args = fieldConfig.args) !== null && _fieldConfig$args !== void 0 ? _fieldConfig$args : {}; - isPlainObj(argsConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument names as keys.")); - var args = (0, _objectEntries.default)(argsConfig).map(function (_ref) { - var argName = _ref[0], - argConfig = _ref[1]; - return { - name: argName, - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - deprecationReason: argConfig.deprecationReason, - extensions: argConfig.extensions && (0, _toObjMap.default)(argConfig.extensions), - astNode: argConfig.astNode - }; - }); - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - args: args, - resolve: fieldConfig.resolve, - subscribe: fieldConfig.subscribe, - isDeprecated: fieldConfig.deprecationReason != null, - deprecationReason: fieldConfig.deprecationReason, - extensions: fieldConfig.extensions && (0, _toObjMap.default)(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} - -function isPlainObj(obj) { - return (0, _isObjectLike.default)(obj) && !Array.isArray(obj); -} - -function fieldsToFieldsConfig(fields) { - return (0, _mapValue.default)(fields, function (field) { - return { - description: field.description, - type: field.type, - args: argsToArgsConfig(field.args), - resolve: field.resolve, - subscribe: field.subscribe, - deprecationReason: field.deprecationReason, - extensions: field.extensions, - astNode: field.astNode - }; - }); -} -/** - * @internal - */ - - -function argsToArgsConfig(args) { - return (0, _keyValMap.default)(args, function (arg) { - return arg.name; - }, function (arg) { - return { - description: arg.description, - type: arg.type, - defaultValue: arg.defaultValue, - deprecationReason: arg.deprecationReason, - extensions: arg.extensions, - astNode: arg.astNode - }; - }); -} - -function isRequiredArgument(arg) { - return isNonNullType(arg.type) && arg.defaultValue === undefined; -} - -/** - * Interface Type Definition - * - * When a field can return one of a heterogeneous set of types, a Interface type - * is used to describe what types are possible, what fields are in common across - * all types, as well as a function to determine which type is actually used - * when the field is resolved. - * - * Example: - * - * const EntityType = new GraphQLInterfaceType({ - * name: 'Entity', - * fields: { - * name: { type: GraphQLString } - * } - * }); - * - */ -var GraphQLInterfaceType = /*#__PURE__*/function () { - function GraphQLInterfaceType(config) { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); - config.resolveType == null || typeof config.resolveType === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat((0, _inspect.default)(config.resolveType), ".")); - } - - var _proto3 = GraphQLInterfaceType.prototype; - - _proto3.getFields = function getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - }; - - _proto3.getInterfaces = function getInterfaces() { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - - return this._interfaces; - }; - - _proto3.toConfig = function toConfig() { - var _this$extensionASTNod2; - - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod2 = this.extensionASTNodes) !== null && _this$extensionASTNod2 !== void 0 ? _this$extensionASTNod2 : [] - }; - }; - - _proto3.toString = function toString() { - return this.name; - }; - - _proto3.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLInterfaceType, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLInterfaceType'; - } - }]); - - return GraphQLInterfaceType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.GraphQLInterfaceType = GraphQLInterfaceType; -(0, _defineInspect.default)(GraphQLInterfaceType); - -/** - * Union Type Definition - * - * When a field can return one of a heterogeneous set of types, a Union type - * is used to describe what types are possible as well as providing a function - * to determine which type is actually used when the field is resolved. - * - * Example: - * - * const PetType = new GraphQLUnionType({ - * name: 'Pet', - * types: [ DogType, CatType ], - * resolveType(value) { - * if (value instanceof Dog) { - * return DogType; - * } - * if (value instanceof Cat) { - * return CatType; - * } - * } - * }); - * - */ -var GraphQLUnionType = /*#__PURE__*/function () { - function GraphQLUnionType(config) { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._types = defineTypes.bind(undefined, config); - typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); - config.resolveType == null || typeof config.resolveType === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat((0, _inspect.default)(config.resolveType), ".")); - } - - var _proto4 = GraphQLUnionType.prototype; - - _proto4.getTypes = function getTypes() { - if (typeof this._types === 'function') { - this._types = this._types(); - } - - return this._types; - }; - - _proto4.toConfig = function toConfig() { - var _this$extensionASTNod3; - - return { - name: this.name, - description: this.description, - types: this.getTypes(), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod3 = this.extensionASTNodes) !== null && _this$extensionASTNod3 !== void 0 ? _this$extensionASTNod3 : [] - }; - }; - - _proto4.toString = function toString() { - return this.name; - }; - - _proto4.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLUnionType, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLUnionType'; - } - }]); - - return GraphQLUnionType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.GraphQLUnionType = GraphQLUnionType; -(0, _defineInspect.default)(GraphQLUnionType); - -function defineTypes(config) { - var types = resolveThunk(config.types); - Array.isArray(types) || (0, _devAssert.default)(0, "Must provide Array of types or a function which returns such an array for Union ".concat(config.name, ".")); - return types; -} - -/** - * Enum Type Definition - * - * Some leaf values of requests and input values are Enums. GraphQL serializes - * Enum values as strings, however internally Enums can be represented by any - * kind of type, often integers. - * - * Example: - * - * const RGBType = new GraphQLEnumType({ - * name: 'RGB', - * values: { - * RED: { value: 0 }, - * GREEN: { value: 1 }, - * BLUE: { value: 2 } - * } - * }); - * - * Note: If a value is not provided in a definition, the name of the enum value - * will be used as its internal value. - */ -var GraphQLEnumType -/* */ -= /*#__PURE__*/function () { - function GraphQLEnumType(config) { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._values = defineEnumValues(this.name, config.values); - this._valueLookup = new Map(this._values.map(function (enumValue) { - return [enumValue.value, enumValue]; - })); - this._nameLookup = (0, _keyMap.default)(this._values, function (value) { - return value.name; - }); - typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); - } - - var _proto5 = GraphQLEnumType.prototype; - - _proto5.getValues = function getValues() { - return this._values; - }; - - _proto5.getValue = function getValue(name) { - return this._nameLookup[name]; - }; - - _proto5.serialize = function serialize(outputValue) { - var enumValue = this._valueLookup.get(outputValue); - - if (enumValue === undefined) { - throw new _GraphQLError.GraphQLError("Enum \"".concat(this.name, "\" cannot represent value: ").concat((0, _inspect.default)(outputValue))); - } - - return enumValue.name; - }; - - _proto5.parseValue = function parseValue(inputValue) - /* T */ - { - if (typeof inputValue !== 'string') { - var valueStr = (0, _inspect.default)(inputValue); - throw new _GraphQLError.GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-string value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr)); - } - - var enumValue = this.getValue(inputValue); - - if (enumValue == null) { - throw new _GraphQLError.GraphQLError("Value \"".concat(inputValue, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, inputValue)); - } - - return enumValue.value; - }; - - _proto5.parseLiteral = function parseLiteral(valueNode, _variables) - /* T */ - { - // Note: variables will be resolved to a value before calling this function. - if (valueNode.kind !== _kinds.Kind.ENUM) { - var valueStr = (0, _printer.print)(valueNode); - throw new _GraphQLError.GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-enum value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr), valueNode); - } - - var enumValue = this.getValue(valueNode.value); - - if (enumValue == null) { - var _valueStr = (0, _printer.print)(valueNode); - - throw new _GraphQLError.GraphQLError("Value \"".concat(_valueStr, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, _valueStr), valueNode); - } - - return enumValue.value; - }; - - _proto5.toConfig = function toConfig() { - var _this$extensionASTNod4; - - var values = (0, _keyValMap.default)(this.getValues(), function (value) { - return value.name; - }, function (value) { - return { - description: value.description, - value: value.value, - deprecationReason: value.deprecationReason, - extensions: value.extensions, - astNode: value.astNode - }; - }); - return { - name: this.name, - description: this.description, - values: values, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod4 = this.extensionASTNodes) !== null && _this$extensionASTNod4 !== void 0 ? _this$extensionASTNod4 : [] - }; - }; - - _proto5.toString = function toString() { - return this.name; - }; - - _proto5.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLEnumType, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLEnumType'; - } - }]); - - return GraphQLEnumType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.GraphQLEnumType = GraphQLEnumType; -(0, _defineInspect.default)(GraphQLEnumType); - -function didYouMeanEnumValue(enumType, unknownValueStr) { - var allNames = enumType.getValues().map(function (value) { - return value.name; - }); - var suggestedValues = (0, _suggestionList.default)(unknownValueStr, allNames); - return (0, _didYouMean.default)('the enum value', suggestedValues); -} - -function defineEnumValues(typeName, valueMap) { - isPlainObj(valueMap) || (0, _devAssert.default)(0, "".concat(typeName, " values must be an object with value names as keys.")); - return (0, _objectEntries.default)(valueMap).map(function (_ref2) { - var valueName = _ref2[0], - valueConfig = _ref2[1]; - isPlainObj(valueConfig) || (0, _devAssert.default)(0, "".concat(typeName, ".").concat(valueName, " must refer to an object with a \"value\" key ") + "representing an internal value but got: ".concat((0, _inspect.default)(valueConfig), ".")); - !('isDeprecated' in valueConfig) || (0, _devAssert.default)(0, "".concat(typeName, ".").concat(valueName, " should provide \"deprecationReason\" instead of \"isDeprecated\".")); - return { - name: valueName, - description: valueConfig.description, - value: valueConfig.value !== undefined ? valueConfig.value : valueName, - isDeprecated: valueConfig.deprecationReason != null, - deprecationReason: valueConfig.deprecationReason, - extensions: valueConfig.extensions && (0, _toObjMap.default)(valueConfig.extensions), - astNode: valueConfig.astNode - }; - }); -} - -/** - * Input Object Type Definition - * - * An input object defines a structured collection of fields which may be - * supplied to a field argument. - * - * Using `NonNull` will ensure that a value must be provided by the query - * - * Example: - * - * const GeoPoint = new GraphQLInputObjectType({ - * name: 'GeoPoint', - * fields: { - * lat: { type: new GraphQLNonNull(GraphQLFloat) }, - * lon: { type: new GraphQLNonNull(GraphQLFloat) }, - * alt: { type: GraphQLFloat, defaultValue: 0 }, - * } - * }); - * - */ -var GraphQLInputObjectType = /*#__PURE__*/function () { - function GraphQLInputObjectType(config) { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineInputFieldMap.bind(undefined, config); - typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); - } - - var _proto6 = GraphQLInputObjectType.prototype; - - _proto6.getFields = function getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - }; - - _proto6.toConfig = function toConfig() { - var _this$extensionASTNod5; - - var fields = (0, _mapValue.default)(this.getFields(), function (field) { - return { - description: field.description, - type: field.type, - defaultValue: field.defaultValue, - extensions: field.extensions, - astNode: field.astNode - }; - }); - return { - name: this.name, - description: this.description, - fields: fields, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod5 = this.extensionASTNodes) !== null && _this$extensionASTNod5 !== void 0 ? _this$extensionASTNod5 : [] - }; - }; - - _proto6.toString = function toString() { - return this.name; - }; - - _proto6.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLInputObjectType, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLInputObjectType'; - } - }]); - - return GraphQLInputObjectType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.GraphQLInputObjectType = GraphQLInputObjectType; -(0, _defineInspect.default)(GraphQLInputObjectType); - -function defineInputFieldMap(config) { - var fieldMap = resolveThunk(config.fields); - isPlainObj(fieldMap) || (0, _devAssert.default)(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object.")); - return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) { - !('resolve' in fieldConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " field has a resolve property, but Input Types cannot define resolvers.")); - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - defaultValue: fieldConfig.defaultValue, - deprecationReason: fieldConfig.deprecationReason, - extensions: fieldConfig.extensions && (0, _toObjMap.default)(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} - -function isRequiredInputField(field) { - return isNonNullType(field.type) && field.defaultValue === undefined; -} diff --git a/node_modules/graphql/type/definition.js.flow b/node_modules/graphql/type/definition.js.flow deleted file mode 100644 index c7d1414e..00000000 --- a/node_modules/graphql/type/definition.js.flow +++ /dev/null @@ -1,1638 +0,0 @@ -// @flow strict -import objectEntries from '../polyfills/objectEntries'; -import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols'; - -import type { Path } from '../jsutils/Path'; -import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; -import type { - ObjMap, - ReadOnlyObjMap, - ReadOnlyObjMapLike, -} from '../jsutils/ObjMap'; -import inspect from '../jsutils/inspect'; -import keyMap from '../jsutils/keyMap'; -import mapValue from '../jsutils/mapValue'; -import toObjMap from '../jsutils/toObjMap'; -import devAssert from '../jsutils/devAssert'; -import keyValMap from '../jsutils/keyValMap'; -import instanceOf from '../jsutils/instanceOf'; -import didYouMean from '../jsutils/didYouMean'; -import isObjectLike from '../jsutils/isObjectLike'; -import identityFunc from '../jsutils/identityFunc'; -import defineInspect from '../jsutils/defineInspect'; -import suggestionList from '../jsutils/suggestionList'; - -import { GraphQLError } from '../error/GraphQLError'; - -import { Kind } from '../language/kinds'; -import { print } from '../language/printer'; -import type { - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - ScalarTypeExtensionNode, - ObjectTypeExtensionNode, - InterfaceTypeExtensionNode, - UnionTypeExtensionNode, - EnumTypeExtensionNode, - InputObjectTypeExtensionNode, - OperationDefinitionNode, - FieldNode, - FragmentDefinitionNode, - ValueNode, -} from '../language/ast'; - -import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped'; - -import type { GraphQLSchema } from './schema'; - -// Predicates & Assertions - -/** - * These are all of the possible kinds of types. - */ -export type GraphQLType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull; - -export function isType(type: mixed): boolean %checks { - return ( - isScalarType(type) || - isObjectType(type) || - isInterfaceType(type) || - isUnionType(type) || - isEnumType(type) || - isInputObjectType(type) || - isListType(type) || - isNonNullType(type) - ); -} - -export function assertType(type: mixed): GraphQLType { - if (!isType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`); - } - return type; -} - -/** - * There are predicates for each kind of GraphQL type. - */ - -declare function isScalarType(type: mixed): boolean %checks(type instanceof - GraphQLScalarType); -// eslint-disable-next-line no-redeclare -export function isScalarType(type) { - return instanceOf(type, GraphQLScalarType); -} - -export function assertScalarType(type: mixed): GraphQLScalarType { - if (!isScalarType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`); - } - return type; -} - -declare function isObjectType(type: mixed): boolean %checks(type instanceof - GraphQLObjectType); -// eslint-disable-next-line no-redeclare -export function isObjectType(type) { - return instanceOf(type, GraphQLObjectType); -} - -export function assertObjectType(type: mixed): GraphQLObjectType { - if (!isObjectType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`); - } - return type; -} - -declare function isInterfaceType(type: mixed): boolean %checks(type instanceof - GraphQLInterfaceType); -// eslint-disable-next-line no-redeclare -export function isInterfaceType(type) { - return instanceOf(type, GraphQLInterfaceType); -} - -export function assertInterfaceType(type: mixed): GraphQLInterfaceType { - if (!isInterfaceType(type)) { - throw new Error( - `Expected ${inspect(type)} to be a GraphQL Interface type.`, - ); - } - return type; -} - -declare function isUnionType(type: mixed): boolean %checks(type instanceof - GraphQLUnionType); -// eslint-disable-next-line no-redeclare -export function isUnionType(type) { - return instanceOf(type, GraphQLUnionType); -} - -export function assertUnionType(type: mixed): GraphQLUnionType { - if (!isUnionType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`); - } - return type; -} - -declare function isEnumType(type: mixed): boolean %checks(type instanceof - GraphQLEnumType); -// eslint-disable-next-line no-redeclare -export function isEnumType(type) { - return instanceOf(type, GraphQLEnumType); -} - -export function assertEnumType(type: mixed): GraphQLEnumType { - if (!isEnumType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`); - } - return type; -} - -declare function isInputObjectType(type: mixed): boolean %checks(type instanceof - GraphQLInputObjectType); -// eslint-disable-next-line no-redeclare -export function isInputObjectType(type) { - return instanceOf(type, GraphQLInputObjectType); -} - -export function assertInputObjectType(type: mixed): GraphQLInputObjectType { - if (!isInputObjectType(type)) { - throw new Error( - `Expected ${inspect(type)} to be a GraphQL Input Object type.`, - ); - } - return type; -} - -declare function isListType(type: mixed): boolean %checks(type instanceof - GraphQLList); -// eslint-disable-next-line no-redeclare -export function isListType(type) { - return instanceOf(type, GraphQLList); -} - -export function assertListType(type: mixed): GraphQLList { - if (!isListType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`); - } - return type; -} - -declare function isNonNullType(type: mixed): boolean %checks(type instanceof - GraphQLNonNull); -// eslint-disable-next-line no-redeclare -export function isNonNullType(type) { - return instanceOf(type, GraphQLNonNull); -} - -export function assertNonNullType(type: mixed): GraphQLNonNull { - if (!isNonNullType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`); - } - return type; -} - -/** - * These types may be used as input types for arguments and directives. - */ -export type GraphQLInputType = - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList, - >; - -export function isInputType(type: mixed): boolean %checks { - return ( - isScalarType(type) || - isEnumType(type) || - isInputObjectType(type) || - (isWrappingType(type) && isInputType(type.ofType)) - ); -} - -export function assertInputType(type: mixed): GraphQLInputType { - if (!isInputType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`); - } - return type; -} - -/** - * These types may be used as output types as the result of fields. - */ -export type GraphQLOutputType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList, - >; - -export function isOutputType(type: mixed): boolean %checks { - return ( - isScalarType(type) || - isObjectType(type) || - isInterfaceType(type) || - isUnionType(type) || - isEnumType(type) || - (isWrappingType(type) && isOutputType(type.ofType)) - ); -} - -export function assertOutputType(type: mixed): GraphQLOutputType { - if (!isOutputType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`); - } - return type; -} - -/** - * These types may describe types which may be leaf values. - */ -export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; - -export function isLeafType(type: mixed): boolean %checks { - return isScalarType(type) || isEnumType(type); -} - -export function assertLeafType(type: mixed): GraphQLLeafType { - if (!isLeafType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`); - } - return type; -} - -/** - * These types may describe the parent context of a selection set. - */ -export type GraphQLCompositeType = - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType; - -export function isCompositeType(type: mixed): boolean %checks { - return isObjectType(type) || isInterfaceType(type) || isUnionType(type); -} - -export function assertCompositeType(type: mixed): GraphQLCompositeType { - if (!isCompositeType(type)) { - throw new Error( - `Expected ${inspect(type)} to be a GraphQL composite type.`, - ); - } - return type; -} - -/** - * These types may describe the parent context of a selection set. - */ -export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType; - -export function isAbstractType(type: mixed): boolean %checks { - return isInterfaceType(type) || isUnionType(type); -} - -export function assertAbstractType(type: mixed): GraphQLAbstractType { - if (!isAbstractType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`); - } - return type; -} - -/** - * List Type Wrapper - * - * A list is a wrapping type which points to another type. - * Lists are often created within the context of defining the fields of - * an object type. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * parents: { type: new GraphQLList(PersonType) }, - * children: { type: new GraphQLList(PersonType) }, - * }) - * }) - * - */ -// FIXME: workaround to fix issue with Babel parser -/* :: -declare class GraphQLList<+T: GraphQLType> { - +ofType: T; - static (ofType: T): GraphQLList; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - -export function GraphQLList(ofType) { - // istanbul ignore else (to be removed in v16.0.0) - if (this instanceof GraphQLList) { - this.ofType = assertType(ofType); - } else { - return new GraphQLList(ofType); - } -} - -// Need to cast through any to alter the prototype. -(GraphQLList.prototype: any).toString = function toString() { - return '[' + String(this.ofType) + ']'; -}; - -(GraphQLList.prototype: any).toJSON = function toJSON() { - return this.toString(); -}; - -Object.defineProperty(GraphQLList.prototype, SYMBOL_TO_STRING_TAG, { - get() { - return 'GraphQLList'; - }, -}); - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLList); - -/** - * Non-Null Type Wrapper - * - * A non-null is a wrapping type which points to another type. - * Non-null types enforce that their values are never null and can ensure - * an error is raised if this ever occurs during a request. It is useful for - * fields which you can make a strong guarantee on non-nullability, for example - * usually the id field of a database row will never be null. - * - * Example: - * - * const RowType = new GraphQLObjectType({ - * name: 'Row', - * fields: () => ({ - * id: { type: new GraphQLNonNull(GraphQLString) }, - * }) - * }) - * - * Note: the enforcement of non-nullability occurs within the executor. - */ -// FIXME: workaround to fix issue with Babel parser -/* :: -declare class GraphQLNonNull<+T: GraphQLNullableType> { - +ofType: T; - static (ofType: T): GraphQLNonNull; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - -export function GraphQLNonNull(ofType) { - // istanbul ignore else (to be removed in v16.0.0) - if (this instanceof GraphQLNonNull) { - this.ofType = assertNullableType(ofType); - } else { - return new GraphQLNonNull(ofType); - } -} - -// Need to cast through any to alter the prototype. -(GraphQLNonNull.prototype: any).toString = function toString() { - return String(this.ofType) + '!'; -}; - -(GraphQLNonNull.prototype: any).toJSON = function toJSON() { - return this.toString(); -}; - -Object.defineProperty(GraphQLNonNull.prototype, SYMBOL_TO_STRING_TAG, { - get() { - return 'GraphQLNonNull'; - }, -}); - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLNonNull); - -/** - * These types wrap and modify other types - */ - -export type GraphQLWrappingType = GraphQLList | GraphQLNonNull; - -export function isWrappingType(type: mixed): boolean %checks { - return isListType(type) || isNonNullType(type); -} - -export function assertWrappingType(type: mixed): GraphQLWrappingType { - if (!isWrappingType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`); - } - return type; -} - -/** - * These types can all accept null as a value. - */ -export type GraphQLNullableType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList; - -export function isNullableType(type: mixed): boolean %checks { - return isType(type) && !isNonNullType(type); -} - -export function assertNullableType(type: mixed): GraphQLNullableType { - if (!isNullableType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`); - } - return type; -} - -/* eslint-disable no-redeclare */ -declare function getNullableType(type: void | null): void; -declare function getNullableType(type: T): T; -declare function getNullableType(type: GraphQLNonNull): T; -export function getNullableType(type) { - /* eslint-enable no-redeclare */ - if (type) { - return isNonNullType(type) ? type.ofType : type; - } -} - -/** - * These named types do not include modifiers like List or NonNull. - */ -export type GraphQLNamedType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType; - -export function isNamedType(type: mixed): boolean %checks { - return ( - isScalarType(type) || - isObjectType(type) || - isInterfaceType(type) || - isUnionType(type) || - isEnumType(type) || - isInputObjectType(type) - ); -} - -export function assertNamedType(type: mixed): GraphQLNamedType { - if (!isNamedType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`); - } - return type; -} - -/* eslint-disable no-redeclare */ -declare function getNamedType(type: void | null): void; -declare function getNamedType(type: GraphQLType): GraphQLNamedType; -export function getNamedType(type) { - /* eslint-enable no-redeclare */ - if (type) { - let unwrappedType = type; - while (isWrappingType(unwrappedType)) { - unwrappedType = unwrappedType.ofType; - } - return unwrappedType; - } -} - -/** - * Used while defining GraphQL types to allow for circular references in - * otherwise immutable type definitions. - */ -export type Thunk<+T> = (() => T) | T; - -function resolveThunk<+T>(thunk: Thunk): T { - // $FlowFixMe[incompatible-use] - return typeof thunk === 'function' ? thunk() : thunk; -} - -function undefineIfEmpty(arr: ?$ReadOnlyArray): ?$ReadOnlyArray { - return arr && arr.length > 0 ? arr : undefined; -} - -/** - * Scalar Type Definition - * - * The leaf values of any request and input values to arguments are - * Scalars (or Enums) and are defined with a name and a series of functions - * used to parse input from ast or variables and to ensure validity. - * - * If a type's serialize function does not return a value (i.e. it returns - * `undefined`) then an error will be raised and a `null` value will be returned - * in the response. If the serialize function returns `null`, then no error will - * be included in the response. - * - * Example: - * - * const OddType = new GraphQLScalarType({ - * name: 'Odd', - * serialize(value) { - * if (value % 2 === 1) { - * return value; - * } - * } - * }); - * - */ -export class GraphQLScalarType { - name: string; - description: ?string; - specifiedByUrl: ?string; - serialize: GraphQLScalarSerializer; - parseValue: GraphQLScalarValueParser; - parseLiteral: GraphQLScalarLiteralParser; - extensions: ?ReadOnlyObjMap; - astNode: ?ScalarTypeDefinitionNode; - extensionASTNodes: ?$ReadOnlyArray; - - constructor(config: $ReadOnly>): void { - const parseValue = config.parseValue ?? identityFunc; - this.name = config.name; - this.description = config.description; - this.specifiedByUrl = config.specifiedByUrl; - this.serialize = config.serialize ?? identityFunc; - this.parseValue = parseValue; - this.parseLiteral = - config.parseLiteral ?? - ((node, variables) => parseValue(valueFromASTUntyped(node, variables))); - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - - devAssert(typeof config.name === 'string', 'Must provide name.'); - - devAssert( - config.specifiedByUrl == null || - typeof config.specifiedByUrl === 'string', - `${this.name} must provide "specifiedByUrl" as a string, ` + - `but got: ${inspect(config.specifiedByUrl)}.`, - ); - - devAssert( - config.serialize == null || typeof config.serialize === 'function', - `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`, - ); - - if (config.parseLiteral) { - devAssert( - typeof config.parseValue === 'function' && - typeof config.parseLiteral === 'function', - `${this.name} must provide both "parseValue" and "parseLiteral" functions.`, - ); - } - } - - toConfig(): {| - ...GraphQLScalarTypeConfig, - serialize: GraphQLScalarSerializer, - parseValue: GraphQLScalarValueParser, - parseLiteral: GraphQLScalarLiteralParser, - extensions: ?ReadOnlyObjMap, - extensionASTNodes: $ReadOnlyArray, - |} { - return { - name: this.name, - description: this.description, - specifiedByUrl: this.specifiedByUrl, - serialize: this.serialize, - parseValue: this.parseValue, - parseLiteral: this.parseLiteral, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [], - }; - } - - toString(): string { - return this.name; - } - - toJSON(): string { - return this.toString(); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLScalarType'; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLScalarType); - -export type GraphQLScalarSerializer = ( - outputValue: mixed, -) => ?TExternal; - -export type GraphQLScalarValueParser = ( - inputValue: mixed, -) => ?TInternal; - -export type GraphQLScalarLiteralParser = ( - valueNode: ValueNode, - variables: ?ObjMap, -) => ?TInternal; - -export type GraphQLScalarTypeConfig = {| - name: string, - description?: ?string, - specifiedByUrl?: ?string, - // Serializes an internal value to include in a response. - serialize?: GraphQLScalarSerializer, - // Parses an externally provided value to use as an input. - parseValue?: GraphQLScalarValueParser, - // Parses an externally provided literal value to use as an input. - parseLiteral?: GraphQLScalarLiteralParser, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?ScalarTypeDefinitionNode, - extensionASTNodes?: ?$ReadOnlyArray, -|}; - -/** - * Object Type Definition - * - * Almost all of the GraphQL types you define will be object types. Object types - * have a name, but most importantly describe their fields. - * - * Example: - * - * const AddressType = new GraphQLObjectType({ - * name: 'Address', - * fields: { - * street: { type: GraphQLString }, - * number: { type: GraphQLInt }, - * formatted: { - * type: GraphQLString, - * resolve(obj) { - * return obj.number + ' ' + obj.street - * } - * } - * } - * }); - * - * When two types need to refer to each other, or a type needs to refer to - * itself in a field, you can use a function expression (aka a closure or a - * thunk) to supply the fields lazily. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * name: { type: GraphQLString }, - * bestFriend: { type: PersonType }, - * }) - * }); - * - */ -export class GraphQLObjectType { - name: string; - description: ?string; - isTypeOf: ?GraphQLIsTypeOfFn; - extensions: ?ReadOnlyObjMap; - astNode: ?ObjectTypeDefinitionNode; - extensionASTNodes: ?$ReadOnlyArray; - - _fields: Thunk>; - _interfaces: Thunk>; - - constructor(config: $ReadOnly>): void { - this.name = config.name; - this.description = config.description; - this.isTypeOf = config.isTypeOf; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - devAssert( - config.isTypeOf == null || typeof config.isTypeOf === 'function', - `${this.name} must provide "isTypeOf" as a function, ` + - `but got: ${inspect(config.isTypeOf)}.`, - ); - } - - getFields(): GraphQLFieldMap { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - return this._fields; - } - - getInterfaces(): Array { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - return this._interfaces; - } - - toConfig(): {| - ...GraphQLObjectTypeConfig, - interfaces: Array, - fields: GraphQLFieldConfigMap, - extensions: ?ReadOnlyObjMap, - extensionASTNodes: $ReadOnlyArray, - |} { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - isTypeOf: this.isTypeOf, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes || [], - }; - } - - toString(): string { - return this.name; - } - - toJSON(): string { - return this.toString(); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLObjectType'; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLObjectType); - -function defineInterfaces( - config: $ReadOnly< - | GraphQLObjectTypeConfig - | GraphQLInterfaceTypeConfig, - >, -): Array { - const interfaces = resolveThunk(config.interfaces) ?? []; - devAssert( - Array.isArray(interfaces), - `${config.name} interfaces must be an Array or a function which returns an Array.`, - ); - return interfaces; -} - -function defineFieldMap( - config: $ReadOnly< - | GraphQLObjectTypeConfig - | GraphQLInterfaceTypeConfig, - >, -): GraphQLFieldMap { - const fieldMap = resolveThunk(config.fields); - devAssert( - isPlainObj(fieldMap), - `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, - ); - - return mapValue(fieldMap, (fieldConfig, fieldName) => { - devAssert( - isPlainObj(fieldConfig), - `${config.name}.${fieldName} field config must be an object.`, - ); - devAssert( - !('isDeprecated' in fieldConfig), - `${config.name}.${fieldName} should provide "deprecationReason" instead of "isDeprecated".`, - ); - devAssert( - fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function', - `${config.name}.${fieldName} field resolver must be a function if ` + - `provided, but got: ${inspect(fieldConfig.resolve)}.`, - ); - - const argsConfig = fieldConfig.args ?? {}; - devAssert( - isPlainObj(argsConfig), - `${config.name}.${fieldName} args must be an object with argument names as keys.`, - ); - - const args = objectEntries(argsConfig).map(([argName, argConfig]) => ({ - name: argName, - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - deprecationReason: argConfig.deprecationReason, - extensions: argConfig.extensions && toObjMap(argConfig.extensions), - astNode: argConfig.astNode, - })); - - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - args, - resolve: fieldConfig.resolve, - subscribe: fieldConfig.subscribe, - isDeprecated: fieldConfig.deprecationReason != null, - deprecationReason: fieldConfig.deprecationReason, - extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode, - }; - }); -} - -function isPlainObj(obj: mixed): boolean { - return isObjectLike(obj) && !Array.isArray(obj); -} - -function fieldsToFieldsConfig( - fields: GraphQLFieldMap, -): GraphQLFieldConfigMap { - return mapValue(fields, (field) => ({ - description: field.description, - type: field.type, - args: argsToArgsConfig(field.args), - resolve: field.resolve, - subscribe: field.subscribe, - deprecationReason: field.deprecationReason, - extensions: field.extensions, - astNode: field.astNode, - })); -} - -/** - * @internal - */ -export function argsToArgsConfig( - args: $ReadOnlyArray, -): GraphQLFieldConfigArgumentMap { - return keyValMap( - args, - (arg) => arg.name, - (arg) => ({ - description: arg.description, - type: arg.type, - defaultValue: arg.defaultValue, - deprecationReason: arg.deprecationReason, - extensions: arg.extensions, - astNode: arg.astNode, - }), - ); -} - -export type GraphQLObjectTypeConfig = {| - name: string, - description?: ?string, - interfaces?: Thunk>, - fields: Thunk>, - isTypeOf?: ?GraphQLIsTypeOfFn, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?ObjectTypeDefinitionNode, - extensionASTNodes?: ?$ReadOnlyArray, -|}; - -/** - * Note: returning GraphQLObjectType is deprecated and will be removed in v16.0.0 - */ -export type GraphQLTypeResolver = ( - value: TSource, - context: TContext, - info: GraphQLResolveInfo, - abstractType: GraphQLAbstractType, -) => PromiseOrValue; - -export type GraphQLIsTypeOfFn = ( - source: TSource, - context: TContext, - info: GraphQLResolveInfo, -) => PromiseOrValue; - -export type GraphQLFieldResolver< - TSource, - TContext, - TArgs = { [argument: string]: any, ... }, -> = ( - source: TSource, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => mixed; - -export type GraphQLResolveInfo = {| - +fieldName: string, - +fieldNodes: $ReadOnlyArray, - +returnType: GraphQLOutputType, - +parentType: GraphQLObjectType, - +path: Path, - +schema: GraphQLSchema, - +fragments: ObjMap, - +rootValue: mixed, - +operation: OperationDefinitionNode, - +variableValues: { [variable: string]: mixed, ... }, -|}; - -export type GraphQLFieldConfig< - TSource, - TContext, - TArgs = { [argument: string]: any, ... }, -> = {| - description?: ?string, - type: GraphQLOutputType, - args?: GraphQLFieldConfigArgumentMap, - resolve?: GraphQLFieldResolver, - subscribe?: GraphQLFieldResolver, - deprecationReason?: ?string, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?FieldDefinitionNode, -|}; - -export type GraphQLFieldConfigArgumentMap = ObjMap; - -export type GraphQLArgumentConfig = {| - description?: ?string, - type: GraphQLInputType, - defaultValue?: mixed, - extensions?: ?ReadOnlyObjMapLike, - deprecationReason?: ?string, - astNode?: ?InputValueDefinitionNode, -|}; - -export type GraphQLFieldConfigMap = ObjMap< - GraphQLFieldConfig, ->; - -export type GraphQLField< - TSource, - TContext, - TArgs = { [argument: string]: any, ... }, -> = {| - name: string, - description: ?string, - type: GraphQLOutputType, - args: Array, - resolve?: GraphQLFieldResolver, - subscribe?: GraphQLFieldResolver, - deprecationReason: ?string, - extensions: ?ReadOnlyObjMap, - astNode: ?FieldDefinitionNode, - - // @deprecated and will be removed in v16 - isDeprecated: boolean, -|}; - -export type GraphQLArgument = {| - name: string, - description: ?string, - type: GraphQLInputType, - defaultValue: mixed, - deprecationReason: ?string, - extensions: ?ReadOnlyObjMap, - astNode: ?InputValueDefinitionNode, -|}; - -export function isRequiredArgument(arg: GraphQLArgument): boolean %checks { - return isNonNullType(arg.type) && arg.defaultValue === undefined; -} - -export type GraphQLFieldMap = ObjMap< - GraphQLField, ->; - -/** - * Interface Type Definition - * - * When a field can return one of a heterogeneous set of types, a Interface type - * is used to describe what types are possible, what fields are in common across - * all types, as well as a function to determine which type is actually used - * when the field is resolved. - * - * Example: - * - * const EntityType = new GraphQLInterfaceType({ - * name: 'Entity', - * fields: { - * name: { type: GraphQLString } - * } - * }); - * - */ -export class GraphQLInterfaceType { - name: string; - description: ?string; - resolveType: ?GraphQLTypeResolver; - extensions: ?ReadOnlyObjMap; - astNode: ?InterfaceTypeDefinitionNode; - extensionASTNodes: ?$ReadOnlyArray; - - _fields: Thunk>; - _interfaces: Thunk>; - - constructor(config: $ReadOnly>): void { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - devAssert( - config.resolveType == null || typeof config.resolveType === 'function', - `${this.name} must provide "resolveType" as a function, ` + - `but got: ${inspect(config.resolveType)}.`, - ); - } - - getFields(): GraphQLFieldMap { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - return this._fields; - } - - getInterfaces(): Array { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - return this._interfaces; - } - - toConfig(): {| - ...GraphQLInterfaceTypeConfig, - interfaces: Array, - fields: GraphQLFieldConfigMap, - extensions: ?ReadOnlyObjMap, - extensionASTNodes: $ReadOnlyArray, - |} { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [], - }; - } - - toString(): string { - return this.name; - } - - toJSON(): string { - return this.toString(); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLInterfaceType'; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLInterfaceType); - -export type GraphQLInterfaceTypeConfig = {| - name: string, - description?: ?string, - interfaces?: Thunk>, - fields: Thunk>, - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: ?GraphQLTypeResolver, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?InterfaceTypeDefinitionNode, - extensionASTNodes?: ?$ReadOnlyArray, -|}; - -/** - * Union Type Definition - * - * When a field can return one of a heterogeneous set of types, a Union type - * is used to describe what types are possible as well as providing a function - * to determine which type is actually used when the field is resolved. - * - * Example: - * - * const PetType = new GraphQLUnionType({ - * name: 'Pet', - * types: [ DogType, CatType ], - * resolveType(value) { - * if (value instanceof Dog) { - * return DogType; - * } - * if (value instanceof Cat) { - * return CatType; - * } - * } - * }); - * - */ -export class GraphQLUnionType { - name: string; - description: ?string; - resolveType: ?GraphQLTypeResolver; - extensions: ?ReadOnlyObjMap; - astNode: ?UnionTypeDefinitionNode; - extensionASTNodes: ?$ReadOnlyArray; - - _types: Thunk>; - - constructor(config: $ReadOnly>): void { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - - this._types = defineTypes.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - devAssert( - config.resolveType == null || typeof config.resolveType === 'function', - `${this.name} must provide "resolveType" as a function, ` + - `but got: ${inspect(config.resolveType)}.`, - ); - } - - getTypes(): Array { - if (typeof this._types === 'function') { - this._types = this._types(); - } - return this._types; - } - - toConfig(): {| - ...GraphQLUnionTypeConfig, - types: Array, - extensions: ?ReadOnlyObjMap, - extensionASTNodes: $ReadOnlyArray, - |} { - return { - name: this.name, - description: this.description, - types: this.getTypes(), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [], - }; - } - - toString(): string { - return this.name; - } - - toJSON(): string { - return this.toString(); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLUnionType'; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLUnionType); - -function defineTypes( - config: $ReadOnly>, -): Array { - const types = resolveThunk(config.types); - devAssert( - Array.isArray(types), - `Must provide Array of types or a function which returns such an array for Union ${config.name}.`, - ); - return types; -} - -export type GraphQLUnionTypeConfig = {| - name: string, - description?: ?string, - types: Thunk>, - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: ?GraphQLTypeResolver, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?UnionTypeDefinitionNode, - extensionASTNodes?: ?$ReadOnlyArray, -|}; - -/** - * Enum Type Definition - * - * Some leaf values of requests and input values are Enums. GraphQL serializes - * Enum values as strings, however internally Enums can be represented by any - * kind of type, often integers. - * - * Example: - * - * const RGBType = new GraphQLEnumType({ - * name: 'RGB', - * values: { - * RED: { value: 0 }, - * GREEN: { value: 1 }, - * BLUE: { value: 2 } - * } - * }); - * - * Note: If a value is not provided in a definition, the name of the enum value - * will be used as its internal value. - */ -export class GraphQLEnumType /* */ { - name: string; - description: ?string; - extensions: ?ReadOnlyObjMap; - astNode: ?EnumTypeDefinitionNode; - extensionASTNodes: ?$ReadOnlyArray; - - _values: Array */>; - _valueLookup: Map; - _nameLookup: ObjMap; - - constructor(config: $ReadOnly */>): void { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - - this._values = defineEnumValues(this.name, config.values); - this._valueLookup = new Map( - this._values.map((enumValue) => [enumValue.value, enumValue]), - ); - this._nameLookup = keyMap(this._values, (value) => value.name); - - devAssert(typeof config.name === 'string', 'Must provide name.'); - } - - getValues(): Array */> { - return this._values; - } - - getValue(name: string): ?GraphQLEnumValue { - return this._nameLookup[name]; - } - - serialize(outputValue: mixed /* T */): ?string { - const enumValue = this._valueLookup.get(outputValue); - if (enumValue === undefined) { - throw new GraphQLError( - `Enum "${this.name}" cannot represent value: ${inspect(outputValue)}`, - ); - } - return enumValue.name; - } - - parseValue(inputValue: mixed): ?any /* T */ { - if (typeof inputValue !== 'string') { - const valueStr = inspect(inputValue); - throw new GraphQLError( - `Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + - didYouMeanEnumValue(this, valueStr), - ); - } - - const enumValue = this.getValue(inputValue); - if (enumValue == null) { - throw new GraphQLError( - `Value "${inputValue}" does not exist in "${this.name}" enum.` + - didYouMeanEnumValue(this, inputValue), - ); - } - return enumValue.value; - } - - parseLiteral(valueNode: ValueNode, _variables: ?ObjMap): ?any /* T */ { - // Note: variables will be resolved to a value before calling this function. - if (valueNode.kind !== Kind.ENUM) { - const valueStr = print(valueNode); - throw new GraphQLError( - `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + - didYouMeanEnumValue(this, valueStr), - valueNode, - ); - } - - const enumValue = this.getValue(valueNode.value); - if (enumValue == null) { - const valueStr = print(valueNode); - throw new GraphQLError( - `Value "${valueStr}" does not exist in "${this.name}" enum.` + - didYouMeanEnumValue(this, valueStr), - valueNode, - ); - } - return enumValue.value; - } - - toConfig(): {| - ...GraphQLEnumTypeConfig, - extensions: ?ReadOnlyObjMap, - extensionASTNodes: $ReadOnlyArray, - |} { - const values = keyValMap( - this.getValues(), - (value) => value.name, - (value) => ({ - description: value.description, - value: value.value, - deprecationReason: value.deprecationReason, - extensions: value.extensions, - astNode: value.astNode, - }), - ); - - return { - name: this.name, - description: this.description, - values, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [], - }; - } - - toString(): string { - return this.name; - } - - toJSON(): string { - return this.toString(); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLEnumType'; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLEnumType); - -function didYouMeanEnumValue( - enumType: GraphQLEnumType, - unknownValueStr: string, -): string { - const allNames = enumType.getValues().map((value) => value.name); - const suggestedValues = suggestionList(unknownValueStr, allNames); - - return didYouMean('the enum value', suggestedValues); -} - -function defineEnumValues( - typeName: string, - valueMap: GraphQLEnumValueConfigMap /* */, -): Array */> { - devAssert( - isPlainObj(valueMap), - `${typeName} values must be an object with value names as keys.`, - ); - return objectEntries(valueMap).map(([valueName, valueConfig]) => { - devAssert( - isPlainObj(valueConfig), - `${typeName}.${valueName} must refer to an object with a "value" key ` + - `representing an internal value but got: ${inspect(valueConfig)}.`, - ); - devAssert( - !('isDeprecated' in valueConfig), - `${typeName}.${valueName} should provide "deprecationReason" instead of "isDeprecated".`, - ); - return { - name: valueName, - description: valueConfig.description, - value: valueConfig.value !== undefined ? valueConfig.value : valueName, - isDeprecated: valueConfig.deprecationReason != null, - deprecationReason: valueConfig.deprecationReason, - extensions: valueConfig.extensions && toObjMap(valueConfig.extensions), - astNode: valueConfig.astNode, - }; - }); -} - -export type GraphQLEnumTypeConfig /* */ = {| - name: string, - description?: ?string, - values: GraphQLEnumValueConfigMap /* */, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?EnumTypeDefinitionNode, - extensionASTNodes?: ?$ReadOnlyArray, -|}; - -export type GraphQLEnumValueConfigMap /* */ = ObjMap */>; - -export type GraphQLEnumValueConfig /* */ = {| - description?: ?string, - value?: any /* T */, - deprecationReason?: ?string, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?EnumValueDefinitionNode, -|}; - -export type GraphQLEnumValue /* */ = {| - name: string, - description: ?string, - value: any /* T */, - deprecationReason: ?string, - extensions: ?ReadOnlyObjMap, - astNode: ?EnumValueDefinitionNode, - - // @deprecated and will be removed in v16 - isDeprecated: boolean, -|}; - -/** - * Input Object Type Definition - * - * An input object defines a structured collection of fields which may be - * supplied to a field argument. - * - * Using `NonNull` will ensure that a value must be provided by the query - * - * Example: - * - * const GeoPoint = new GraphQLInputObjectType({ - * name: 'GeoPoint', - * fields: { - * lat: { type: new GraphQLNonNull(GraphQLFloat) }, - * lon: { type: new GraphQLNonNull(GraphQLFloat) }, - * alt: { type: GraphQLFloat, defaultValue: 0 }, - * } - * }); - * - */ -export class GraphQLInputObjectType { - name: string; - description: ?string; - extensions: ?ReadOnlyObjMap; - astNode: ?InputObjectTypeDefinitionNode; - extensionASTNodes: ?$ReadOnlyArray; - - _fields: Thunk; - - constructor(config: $ReadOnly): void { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - - this._fields = defineInputFieldMap.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - } - - getFields(): GraphQLInputFieldMap { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - return this._fields; - } - - toConfig(): {| - ...GraphQLInputObjectTypeConfig, - fields: GraphQLInputFieldConfigMap, - extensions: ?ReadOnlyObjMap, - extensionASTNodes: $ReadOnlyArray, - |} { - const fields = mapValue(this.getFields(), (field) => ({ - description: field.description, - type: field.type, - defaultValue: field.defaultValue, - extensions: field.extensions, - astNode: field.astNode, - })); - - return { - name: this.name, - description: this.description, - fields, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [], - }; - } - - toString(): string { - return this.name; - } - - toJSON(): string { - return this.toString(); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLInputObjectType'; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLInputObjectType); - -function defineInputFieldMap( - config: $ReadOnly, -): GraphQLInputFieldMap { - const fieldMap = resolveThunk(config.fields); - devAssert( - isPlainObj(fieldMap), - `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, - ); - return mapValue(fieldMap, (fieldConfig, fieldName) => { - devAssert( - !('resolve' in fieldConfig), - `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`, - ); - - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - defaultValue: fieldConfig.defaultValue, - deprecationReason: fieldConfig.deprecationReason, - extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode, - }; - }); -} - -export type GraphQLInputObjectTypeConfig = {| - name: string, - description?: ?string, - fields: Thunk, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?InputObjectTypeDefinitionNode, - extensionASTNodes?: ?$ReadOnlyArray, -|}; - -export type GraphQLInputFieldConfig = {| - description?: ?string, - type: GraphQLInputType, - defaultValue?: mixed, - deprecationReason?: ?string, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?InputValueDefinitionNode, -|}; - -export type GraphQLInputFieldConfigMap = ObjMap; - -export type GraphQLInputField = {| - name: string, - description: ?string, - type: GraphQLInputType, - defaultValue: mixed, - deprecationReason: ?string, - extensions: ?ReadOnlyObjMap, - astNode: ?InputValueDefinitionNode, -|}; - -export function isRequiredInputField( - field: GraphQLInputField, -): boolean %checks { - return isNonNullType(field.type) && field.defaultValue === undefined; -} - -export type GraphQLInputFieldMap = ObjMap; diff --git a/node_modules/graphql/type/definition.mjs b/node_modules/graphql/type/definition.mjs deleted file mode 100644 index 1ec99352..00000000 --- a/node_modules/graphql/type/definition.mjs +++ /dev/null @@ -1,1106 +0,0 @@ -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -import objectEntries from "../polyfills/objectEntries.mjs"; -import { SYMBOL_TO_STRING_TAG } from "../polyfills/symbols.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import keyMap from "../jsutils/keyMap.mjs"; -import mapValue from "../jsutils/mapValue.mjs"; -import toObjMap from "../jsutils/toObjMap.mjs"; -import devAssert from "../jsutils/devAssert.mjs"; -import keyValMap from "../jsutils/keyValMap.mjs"; -import instanceOf from "../jsutils/instanceOf.mjs"; -import didYouMean from "../jsutils/didYouMean.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import identityFunc from "../jsutils/identityFunc.mjs"; -import defineInspect from "../jsutils/defineInspect.mjs"; -import suggestionList from "../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { print } from "../language/printer.mjs"; -import { valueFromASTUntyped } from "../utilities/valueFromASTUntyped.mjs"; -export function isType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type); -} -export function assertType(type) { - if (!isType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL type.")); - } - - return type; -} -/** - * There are predicates for each kind of GraphQL type. - */ - -// eslint-disable-next-line no-redeclare -export function isScalarType(type) { - return instanceOf(type, GraphQLScalarType); -} -export function assertScalarType(type) { - if (!isScalarType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL Scalar type.")); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isObjectType(type) { - return instanceOf(type, GraphQLObjectType); -} -export function assertObjectType(type) { - if (!isObjectType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL Object type.")); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isInterfaceType(type) { - return instanceOf(type, GraphQLInterfaceType); -} -export function assertInterfaceType(type) { - if (!isInterfaceType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL Interface type.")); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isUnionType(type) { - return instanceOf(type, GraphQLUnionType); -} -export function assertUnionType(type) { - if (!isUnionType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL Union type.")); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isEnumType(type) { - return instanceOf(type, GraphQLEnumType); -} -export function assertEnumType(type) { - if (!isEnumType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL Enum type.")); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isInputObjectType(type) { - return instanceOf(type, GraphQLInputObjectType); -} -export function assertInputObjectType(type) { - if (!isInputObjectType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL Input Object type.")); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isListType(type) { - return instanceOf(type, GraphQLList); -} -export function assertListType(type) { - if (!isListType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL List type.")); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isNonNullType(type) { - return instanceOf(type, GraphQLNonNull); -} -export function assertNonNullType(type) { - if (!isNonNullType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL Non-Null type.")); - } - - return type; -} -/** - * These types may be used as input types for arguments and directives. - */ - -export function isInputType(type) { - return isScalarType(type) || isEnumType(type) || isInputObjectType(type) || isWrappingType(type) && isInputType(type.ofType); -} -export function assertInputType(type) { - if (!isInputType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL input type.")); - } - - return type; -} -/** - * These types may be used as output types as the result of fields. - */ - -export function isOutputType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isWrappingType(type) && isOutputType(type.ofType); -} -export function assertOutputType(type) { - if (!isOutputType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL output type.")); - } - - return type; -} -/** - * These types may describe types which may be leaf values. - */ - -export function isLeafType(type) { - return isScalarType(type) || isEnumType(type); -} -export function assertLeafType(type) { - if (!isLeafType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL leaf type.")); - } - - return type; -} -/** - * These types may describe the parent context of a selection set. - */ - -export function isCompositeType(type) { - return isObjectType(type) || isInterfaceType(type) || isUnionType(type); -} -export function assertCompositeType(type) { - if (!isCompositeType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL composite type.")); - } - - return type; -} -/** - * These types may describe the parent context of a selection set. - */ - -export function isAbstractType(type) { - return isInterfaceType(type) || isUnionType(type); -} -export function assertAbstractType(type) { - if (!isAbstractType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL abstract type.")); - } - - return type; -} -/** - * List Type Wrapper - * - * A list is a wrapping type which points to another type. - * Lists are often created within the context of defining the fields of - * an object type. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * parents: { type: new GraphQLList(PersonType) }, - * children: { type: new GraphQLList(PersonType) }, - * }) - * }) - * - */ -// FIXME: workaround to fix issue with Babel parser - -/* :: -declare class GraphQLList<+T: GraphQLType> { - +ofType: T; - static (ofType: T): GraphQLList; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - -export function GraphQLList(ofType) { - // istanbul ignore else (to be removed in v16.0.0) - if (this instanceof GraphQLList) { - this.ofType = assertType(ofType); - } else { - return new GraphQLList(ofType); - } -} // Need to cast through any to alter the prototype. - -GraphQLList.prototype.toString = function toString() { - return '[' + String(this.ofType) + ']'; -}; - -GraphQLList.prototype.toJSON = function toJSON() { - return this.toString(); -}; - -Object.defineProperty(GraphQLList.prototype, SYMBOL_TO_STRING_TAG, { - get: function get() { - return 'GraphQLList'; - } -}); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLList); -/** - * Non-Null Type Wrapper - * - * A non-null is a wrapping type which points to another type. - * Non-null types enforce that their values are never null and can ensure - * an error is raised if this ever occurs during a request. It is useful for - * fields which you can make a strong guarantee on non-nullability, for example - * usually the id field of a database row will never be null. - * - * Example: - * - * const RowType = new GraphQLObjectType({ - * name: 'Row', - * fields: () => ({ - * id: { type: new GraphQLNonNull(GraphQLString) }, - * }) - * }) - * - * Note: the enforcement of non-nullability occurs within the executor. - */ -// FIXME: workaround to fix issue with Babel parser - -/* :: -declare class GraphQLNonNull<+T: GraphQLNullableType> { - +ofType: T; - static (ofType: T): GraphQLNonNull; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - -export function GraphQLNonNull(ofType) { - // istanbul ignore else (to be removed in v16.0.0) - if (this instanceof GraphQLNonNull) { - this.ofType = assertNullableType(ofType); - } else { - return new GraphQLNonNull(ofType); - } -} // Need to cast through any to alter the prototype. - -GraphQLNonNull.prototype.toString = function toString() { - return String(this.ofType) + '!'; -}; - -GraphQLNonNull.prototype.toJSON = function toJSON() { - return this.toString(); -}; - -Object.defineProperty(GraphQLNonNull.prototype, SYMBOL_TO_STRING_TAG, { - get: function get() { - return 'GraphQLNonNull'; - } -}); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLNonNull); -/** - * These types wrap and modify other types - */ - -export function isWrappingType(type) { - return isListType(type) || isNonNullType(type); -} -export function assertWrappingType(type) { - if (!isWrappingType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL wrapping type.")); - } - - return type; -} -/** - * These types can all accept null as a value. - */ - -export function isNullableType(type) { - return isType(type) && !isNonNullType(type); -} -export function assertNullableType(type) { - if (!isNullableType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL nullable type.")); - } - - return type; -} -/* eslint-disable no-redeclare */ - -export function getNullableType(type) { - /* eslint-enable no-redeclare */ - if (type) { - return isNonNullType(type) ? type.ofType : type; - } -} -/** - * These named types do not include modifiers like List or NonNull. - */ - -export function isNamedType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type); -} -export function assertNamedType(type) { - if (!isNamedType(type)) { - throw new Error("Expected ".concat(inspect(type), " to be a GraphQL named type.")); - } - - return type; -} -/* eslint-disable no-redeclare */ - -export function getNamedType(type) { - /* eslint-enable no-redeclare */ - if (type) { - var unwrappedType = type; - - while (isWrappingType(unwrappedType)) { - unwrappedType = unwrappedType.ofType; - } - - return unwrappedType; - } -} -/** - * Used while defining GraphQL types to allow for circular references in - * otherwise immutable type definitions. - */ - -function resolveThunk(thunk) { - // $FlowFixMe[incompatible-use] - return typeof thunk === 'function' ? thunk() : thunk; -} - -function undefineIfEmpty(arr) { - return arr && arr.length > 0 ? arr : undefined; -} -/** - * Scalar Type Definition - * - * The leaf values of any request and input values to arguments are - * Scalars (or Enums) and are defined with a name and a series of functions - * used to parse input from ast or variables and to ensure validity. - * - * If a type's serialize function does not return a value (i.e. it returns - * `undefined`) then an error will be raised and a `null` value will be returned - * in the response. If the serialize function returns `null`, then no error will - * be included in the response. - * - * Example: - * - * const OddType = new GraphQLScalarType({ - * name: 'Odd', - * serialize(value) { - * if (value % 2 === 1) { - * return value; - * } - * } - * }); - * - */ - - -export var GraphQLScalarType = /*#__PURE__*/function () { - function GraphQLScalarType(config) { - var _config$parseValue, _config$serialize, _config$parseLiteral; - - var parseValue = (_config$parseValue = config.parseValue) !== null && _config$parseValue !== void 0 ? _config$parseValue : identityFunc; - this.name = config.name; - this.description = config.description; - this.specifiedByUrl = config.specifiedByUrl; - this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== void 0 ? _config$serialize : identityFunc; - this.parseValue = parseValue; - this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : function (node, variables) { - return parseValue(valueFromASTUntyped(node, variables)); - }; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - typeof config.name === 'string' || devAssert(0, 'Must provide name.'); - config.specifiedByUrl == null || typeof config.specifiedByUrl === 'string' || devAssert(0, "".concat(this.name, " must provide \"specifiedByUrl\" as a string, ") + "but got: ".concat(inspect(config.specifiedByUrl), ".")); - config.serialize == null || typeof config.serialize === 'function' || devAssert(0, "".concat(this.name, " must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided.")); - - if (config.parseLiteral) { - typeof config.parseValue === 'function' && typeof config.parseLiteral === 'function' || devAssert(0, "".concat(this.name, " must provide both \"parseValue\" and \"parseLiteral\" functions.")); - } - } - - var _proto = GraphQLScalarType.prototype; - - _proto.toConfig = function toConfig() { - var _this$extensionASTNod; - - return { - name: this.name, - description: this.description, - specifiedByUrl: this.specifiedByUrl, - serialize: this.serialize, - parseValue: this.parseValue, - parseLiteral: this.parseLiteral, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod = this.extensionASTNodes) !== null && _this$extensionASTNod !== void 0 ? _this$extensionASTNod : [] - }; - }; - - _proto.toString = function toString() { - return this.name; - }; - - _proto.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLScalarType, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLScalarType'; - } - }]); - - return GraphQLScalarType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLScalarType); - -/** - * Object Type Definition - * - * Almost all of the GraphQL types you define will be object types. Object types - * have a name, but most importantly describe their fields. - * - * Example: - * - * const AddressType = new GraphQLObjectType({ - * name: 'Address', - * fields: { - * street: { type: GraphQLString }, - * number: { type: GraphQLInt }, - * formatted: { - * type: GraphQLString, - * resolve(obj) { - * return obj.number + ' ' + obj.street - * } - * } - * } - * }); - * - * When two types need to refer to each other, or a type needs to refer to - * itself in a field, you can use a function expression (aka a closure or a - * thunk) to supply the fields lazily. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * name: { type: GraphQLString }, - * bestFriend: { type: PersonType }, - * }) - * }); - * - */ -export var GraphQLObjectType = /*#__PURE__*/function () { - function GraphQLObjectType(config) { - this.name = config.name; - this.description = config.description; - this.isTypeOf = config.isTypeOf; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - typeof config.name === 'string' || devAssert(0, 'Must provide name.'); - config.isTypeOf == null || typeof config.isTypeOf === 'function' || devAssert(0, "".concat(this.name, " must provide \"isTypeOf\" as a function, ") + "but got: ".concat(inspect(config.isTypeOf), ".")); - } - - var _proto2 = GraphQLObjectType.prototype; - - _proto2.getFields = function getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - }; - - _proto2.getInterfaces = function getInterfaces() { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - - return this._interfaces; - }; - - _proto2.toConfig = function toConfig() { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - isTypeOf: this.isTypeOf, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes || [] - }; - }; - - _proto2.toString = function toString() { - return this.name; - }; - - _proto2.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLObjectType, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLObjectType'; - } - }]); - - return GraphQLObjectType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLObjectType); - -function defineInterfaces(config) { - var _resolveThunk; - - var interfaces = (_resolveThunk = resolveThunk(config.interfaces)) !== null && _resolveThunk !== void 0 ? _resolveThunk : []; - Array.isArray(interfaces) || devAssert(0, "".concat(config.name, " interfaces must be an Array or a function which returns an Array.")); - return interfaces; -} - -function defineFieldMap(config) { - var fieldMap = resolveThunk(config.fields); - isPlainObj(fieldMap) || devAssert(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object.")); - return mapValue(fieldMap, function (fieldConfig, fieldName) { - var _fieldConfig$args; - - isPlainObj(fieldConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object.")); - !('isDeprecated' in fieldConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" instead of \"isDeprecated\".")); - fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function' || devAssert(0, "".concat(config.name, ".").concat(fieldName, " field resolver must be a function if ") + "provided, but got: ".concat(inspect(fieldConfig.resolve), ".")); - var argsConfig = (_fieldConfig$args = fieldConfig.args) !== null && _fieldConfig$args !== void 0 ? _fieldConfig$args : {}; - isPlainObj(argsConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument names as keys.")); - var args = objectEntries(argsConfig).map(function (_ref) { - var argName = _ref[0], - argConfig = _ref[1]; - return { - name: argName, - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - deprecationReason: argConfig.deprecationReason, - extensions: argConfig.extensions && toObjMap(argConfig.extensions), - astNode: argConfig.astNode - }; - }); - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - args: args, - resolve: fieldConfig.resolve, - subscribe: fieldConfig.subscribe, - isDeprecated: fieldConfig.deprecationReason != null, - deprecationReason: fieldConfig.deprecationReason, - extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} - -function isPlainObj(obj) { - return isObjectLike(obj) && !Array.isArray(obj); -} - -function fieldsToFieldsConfig(fields) { - return mapValue(fields, function (field) { - return { - description: field.description, - type: field.type, - args: argsToArgsConfig(field.args), - resolve: field.resolve, - subscribe: field.subscribe, - deprecationReason: field.deprecationReason, - extensions: field.extensions, - astNode: field.astNode - }; - }); -} -/** - * @internal - */ - - -export function argsToArgsConfig(args) { - return keyValMap(args, function (arg) { - return arg.name; - }, function (arg) { - return { - description: arg.description, - type: arg.type, - defaultValue: arg.defaultValue, - deprecationReason: arg.deprecationReason, - extensions: arg.extensions, - astNode: arg.astNode - }; - }); -} -export function isRequiredArgument(arg) { - return isNonNullType(arg.type) && arg.defaultValue === undefined; -} - -/** - * Interface Type Definition - * - * When a field can return one of a heterogeneous set of types, a Interface type - * is used to describe what types are possible, what fields are in common across - * all types, as well as a function to determine which type is actually used - * when the field is resolved. - * - * Example: - * - * const EntityType = new GraphQLInterfaceType({ - * name: 'Entity', - * fields: { - * name: { type: GraphQLString } - * } - * }); - * - */ -export var GraphQLInterfaceType = /*#__PURE__*/function () { - function GraphQLInterfaceType(config) { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - typeof config.name === 'string' || devAssert(0, 'Must provide name.'); - config.resolveType == null || typeof config.resolveType === 'function' || devAssert(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat(inspect(config.resolveType), ".")); - } - - var _proto3 = GraphQLInterfaceType.prototype; - - _proto3.getFields = function getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - }; - - _proto3.getInterfaces = function getInterfaces() { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - - return this._interfaces; - }; - - _proto3.toConfig = function toConfig() { - var _this$extensionASTNod2; - - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod2 = this.extensionASTNodes) !== null && _this$extensionASTNod2 !== void 0 ? _this$extensionASTNod2 : [] - }; - }; - - _proto3.toString = function toString() { - return this.name; - }; - - _proto3.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLInterfaceType, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLInterfaceType'; - } - }]); - - return GraphQLInterfaceType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLInterfaceType); - -/** - * Union Type Definition - * - * When a field can return one of a heterogeneous set of types, a Union type - * is used to describe what types are possible as well as providing a function - * to determine which type is actually used when the field is resolved. - * - * Example: - * - * const PetType = new GraphQLUnionType({ - * name: 'Pet', - * types: [ DogType, CatType ], - * resolveType(value) { - * if (value instanceof Dog) { - * return DogType; - * } - * if (value instanceof Cat) { - * return CatType; - * } - * } - * }); - * - */ -export var GraphQLUnionType = /*#__PURE__*/function () { - function GraphQLUnionType(config) { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._types = defineTypes.bind(undefined, config); - typeof config.name === 'string' || devAssert(0, 'Must provide name.'); - config.resolveType == null || typeof config.resolveType === 'function' || devAssert(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat(inspect(config.resolveType), ".")); - } - - var _proto4 = GraphQLUnionType.prototype; - - _proto4.getTypes = function getTypes() { - if (typeof this._types === 'function') { - this._types = this._types(); - } - - return this._types; - }; - - _proto4.toConfig = function toConfig() { - var _this$extensionASTNod3; - - return { - name: this.name, - description: this.description, - types: this.getTypes(), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod3 = this.extensionASTNodes) !== null && _this$extensionASTNod3 !== void 0 ? _this$extensionASTNod3 : [] - }; - }; - - _proto4.toString = function toString() { - return this.name; - }; - - _proto4.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLUnionType, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLUnionType'; - } - }]); - - return GraphQLUnionType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLUnionType); - -function defineTypes(config) { - var types = resolveThunk(config.types); - Array.isArray(types) || devAssert(0, "Must provide Array of types or a function which returns such an array for Union ".concat(config.name, ".")); - return types; -} - -/** - * Enum Type Definition - * - * Some leaf values of requests and input values are Enums. GraphQL serializes - * Enum values as strings, however internally Enums can be represented by any - * kind of type, often integers. - * - * Example: - * - * const RGBType = new GraphQLEnumType({ - * name: 'RGB', - * values: { - * RED: { value: 0 }, - * GREEN: { value: 1 }, - * BLUE: { value: 2 } - * } - * }); - * - * Note: If a value is not provided in a definition, the name of the enum value - * will be used as its internal value. - */ -export var GraphQLEnumType -/* */ -= /*#__PURE__*/function () { - function GraphQLEnumType(config) { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._values = defineEnumValues(this.name, config.values); - this._valueLookup = new Map(this._values.map(function (enumValue) { - return [enumValue.value, enumValue]; - })); - this._nameLookup = keyMap(this._values, function (value) { - return value.name; - }); - typeof config.name === 'string' || devAssert(0, 'Must provide name.'); - } - - var _proto5 = GraphQLEnumType.prototype; - - _proto5.getValues = function getValues() { - return this._values; - }; - - _proto5.getValue = function getValue(name) { - return this._nameLookup[name]; - }; - - _proto5.serialize = function serialize(outputValue) { - var enumValue = this._valueLookup.get(outputValue); - - if (enumValue === undefined) { - throw new GraphQLError("Enum \"".concat(this.name, "\" cannot represent value: ").concat(inspect(outputValue))); - } - - return enumValue.name; - }; - - _proto5.parseValue = function parseValue(inputValue) - /* T */ - { - if (typeof inputValue !== 'string') { - var valueStr = inspect(inputValue); - throw new GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-string value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr)); - } - - var enumValue = this.getValue(inputValue); - - if (enumValue == null) { - throw new GraphQLError("Value \"".concat(inputValue, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, inputValue)); - } - - return enumValue.value; - }; - - _proto5.parseLiteral = function parseLiteral(valueNode, _variables) - /* T */ - { - // Note: variables will be resolved to a value before calling this function. - if (valueNode.kind !== Kind.ENUM) { - var valueStr = print(valueNode); - throw new GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-enum value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr), valueNode); - } - - var enumValue = this.getValue(valueNode.value); - - if (enumValue == null) { - var _valueStr = print(valueNode); - - throw new GraphQLError("Value \"".concat(_valueStr, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, _valueStr), valueNode); - } - - return enumValue.value; - }; - - _proto5.toConfig = function toConfig() { - var _this$extensionASTNod4; - - var values = keyValMap(this.getValues(), function (value) { - return value.name; - }, function (value) { - return { - description: value.description, - value: value.value, - deprecationReason: value.deprecationReason, - extensions: value.extensions, - astNode: value.astNode - }; - }); - return { - name: this.name, - description: this.description, - values: values, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod4 = this.extensionASTNodes) !== null && _this$extensionASTNod4 !== void 0 ? _this$extensionASTNod4 : [] - }; - }; - - _proto5.toString = function toString() { - return this.name; - }; - - _proto5.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLEnumType, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLEnumType'; - } - }]); - - return GraphQLEnumType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLEnumType); - -function didYouMeanEnumValue(enumType, unknownValueStr) { - var allNames = enumType.getValues().map(function (value) { - return value.name; - }); - var suggestedValues = suggestionList(unknownValueStr, allNames); - return didYouMean('the enum value', suggestedValues); -} - -function defineEnumValues(typeName, valueMap) { - isPlainObj(valueMap) || devAssert(0, "".concat(typeName, " values must be an object with value names as keys.")); - return objectEntries(valueMap).map(function (_ref2) { - var valueName = _ref2[0], - valueConfig = _ref2[1]; - isPlainObj(valueConfig) || devAssert(0, "".concat(typeName, ".").concat(valueName, " must refer to an object with a \"value\" key ") + "representing an internal value but got: ".concat(inspect(valueConfig), ".")); - !('isDeprecated' in valueConfig) || devAssert(0, "".concat(typeName, ".").concat(valueName, " should provide \"deprecationReason\" instead of \"isDeprecated\".")); - return { - name: valueName, - description: valueConfig.description, - value: valueConfig.value !== undefined ? valueConfig.value : valueName, - isDeprecated: valueConfig.deprecationReason != null, - deprecationReason: valueConfig.deprecationReason, - extensions: valueConfig.extensions && toObjMap(valueConfig.extensions), - astNode: valueConfig.astNode - }; - }); -} - -/** - * Input Object Type Definition - * - * An input object defines a structured collection of fields which may be - * supplied to a field argument. - * - * Using `NonNull` will ensure that a value must be provided by the query - * - * Example: - * - * const GeoPoint = new GraphQLInputObjectType({ - * name: 'GeoPoint', - * fields: { - * lat: { type: new GraphQLNonNull(GraphQLFloat) }, - * lon: { type: new GraphQLNonNull(GraphQLFloat) }, - * alt: { type: GraphQLFloat, defaultValue: 0 }, - * } - * }); - * - */ -export var GraphQLInputObjectType = /*#__PURE__*/function () { - function GraphQLInputObjectType(config) { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineInputFieldMap.bind(undefined, config); - typeof config.name === 'string' || devAssert(0, 'Must provide name.'); - } - - var _proto6 = GraphQLInputObjectType.prototype; - - _proto6.getFields = function getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - }; - - _proto6.toConfig = function toConfig() { - var _this$extensionASTNod5; - - var fields = mapValue(this.getFields(), function (field) { - return { - description: field.description, - type: field.type, - defaultValue: field.defaultValue, - extensions: field.extensions, - astNode: field.astNode - }; - }); - return { - name: this.name, - description: this.description, - fields: fields, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod5 = this.extensionASTNodes) !== null && _this$extensionASTNod5 !== void 0 ? _this$extensionASTNod5 : [] - }; - }; - - _proto6.toString = function toString() { - return this.name; - }; - - _proto6.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLInputObjectType, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLInputObjectType'; - } - }]); - - return GraphQLInputObjectType; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLInputObjectType); - -function defineInputFieldMap(config) { - var fieldMap = resolveThunk(config.fields); - isPlainObj(fieldMap) || devAssert(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object.")); - return mapValue(fieldMap, function (fieldConfig, fieldName) { - !('resolve' in fieldConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " field has a resolve property, but Input Types cannot define resolvers.")); - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - defaultValue: fieldConfig.defaultValue, - deprecationReason: fieldConfig.deprecationReason, - extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} - -export function isRequiredInputField(field) { - return isNonNullType(field.type) && field.defaultValue === undefined; -} diff --git a/node_modules/graphql/type/directives.d.ts b/node_modules/graphql/type/directives.d.ts deleted file mode 100644 index 2c6de77b..00000000 --- a/node_modules/graphql/type/directives.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -// FIXME -/* eslint-disable import/no-cycle */ - -import { Maybe } from '../jsutils/Maybe'; - -import { DirectiveDefinitionNode } from '../language/ast'; -import { DirectiveLocationEnum } from '../language/directiveLocation'; - -import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from './definition'; - -/** - * Test if the given value is a GraphQL directive. - */ -export function isDirective(directive: any): directive is GraphQLDirective; -export function assertDirective(directive: any): GraphQLDirective; - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLDirectiveExtensions { - [attributeName: string]: any; -} - -/** - * Directives are used by the GraphQL runtime as a way of modifying execution - * behavior. Type system creators will usually not create these directly. - */ -export class GraphQLDirective { - name: string; - description: Maybe; - locations: Array; - isRepeatable: boolean; - args: Array; - extensions: Maybe>; - astNode: Maybe; - - constructor(config: Readonly); - - toConfig(): GraphQLDirectiveConfig & { - args: GraphQLFieldConfigArgumentMap; - isRepeatable: boolean; - extensions: Maybe>; - }; - - toString(): string; - toJSON(): string; - inspect(): string; -} - -export interface GraphQLDirectiveConfig { - name: string; - description?: Maybe; - locations: Array; - args?: Maybe; - isRepeatable?: Maybe; - extensions?: Maybe>; - astNode?: Maybe; -} - -/** - * Used to conditionally include fields or fragments. - */ -export const GraphQLIncludeDirective: GraphQLDirective; - -/** - * Used to conditionally skip (exclude) fields or fragments. - */ -export const GraphQLSkipDirective: GraphQLDirective; - -/** - * Used to provide a URL for specifying the behavior of custom scalar definitions. - */ -export const GraphQLSpecifiedByDirective: GraphQLDirective; - -/** - * Constant string used for default reason for a deprecation. - */ -export const DEFAULT_DEPRECATION_REASON: 'No longer supported'; - -/** - * Used to declare element of a GraphQL schema as deprecated. - */ -export const GraphQLDeprecatedDirective: GraphQLDirective; - -/** - * The full list of specified directives. - */ -export const specifiedDirectives: ReadonlyArray; - -export function isSpecifiedDirective(directive: GraphQLDirective): boolean; diff --git a/node_modules/graphql/type/directives.js b/node_modules/graphql/type/directives.js deleted file mode 100644 index 58ee0abc..00000000 --- a/node_modules/graphql/type/directives.js +++ /dev/null @@ -1,205 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isDirective = isDirective; -exports.assertDirective = assertDirective; -exports.isSpecifiedDirective = isSpecifiedDirective; -exports.specifiedDirectives = exports.GraphQLSpecifiedByDirective = exports.GraphQLDeprecatedDirective = exports.DEFAULT_DEPRECATION_REASON = exports.GraphQLSkipDirective = exports.GraphQLIncludeDirective = exports.GraphQLDirective = void 0; - -var _objectEntries = _interopRequireDefault(require("../polyfills/objectEntries.js")); - -var _symbols = require("../polyfills/symbols.js"); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _toObjMap = _interopRequireDefault(require("../jsutils/toObjMap.js")); - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _instanceOf = _interopRequireDefault(require("../jsutils/instanceOf.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _defineInspect = _interopRequireDefault(require("../jsutils/defineInspect.js")); - -var _directiveLocation = require("../language/directiveLocation.js"); - -var _scalars = require("./scalars.js"); - -var _definition = require("./definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -// eslint-disable-next-line no-redeclare -function isDirective(directive) { - return (0, _instanceOf.default)(directive, GraphQLDirective); -} - -function assertDirective(directive) { - if (!isDirective(directive)) { - throw new Error("Expected ".concat((0, _inspect.default)(directive), " to be a GraphQL directive.")); - } - - return directive; -} -/** - * Directives are used by the GraphQL runtime as a way of modifying execution - * behavior. Type system creators will usually not create these directly. - */ - - -var GraphQLDirective = /*#__PURE__*/function () { - function GraphQLDirective(config) { - var _config$isRepeatable, _config$args; - - this.name = config.name; - this.description = config.description; - this.locations = config.locations; - this.isRepeatable = (_config$isRepeatable = config.isRepeatable) !== null && _config$isRepeatable !== void 0 ? _config$isRepeatable : false; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - config.name || (0, _devAssert.default)(0, 'Directive must be named.'); - Array.isArray(config.locations) || (0, _devAssert.default)(0, "@".concat(config.name, " locations must be an Array.")); - var args = (_config$args = config.args) !== null && _config$args !== void 0 ? _config$args : {}; - (0, _isObjectLike.default)(args) && !Array.isArray(args) || (0, _devAssert.default)(0, "@".concat(config.name, " args must be an object with argument names as keys.")); - this.args = (0, _objectEntries.default)(args).map(function (_ref) { - var argName = _ref[0], - argConfig = _ref[1]; - return { - name: argName, - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - deprecationReason: argConfig.deprecationReason, - extensions: argConfig.extensions && (0, _toObjMap.default)(argConfig.extensions), - astNode: argConfig.astNode - }; - }); - } - - var _proto = GraphQLDirective.prototype; - - _proto.toConfig = function toConfig() { - return { - name: this.name, - description: this.description, - locations: this.locations, - args: (0, _definition.argsToArgsConfig)(this.args), - isRepeatable: this.isRepeatable, - extensions: this.extensions, - astNode: this.astNode - }; - }; - - _proto.toString = function toString() { - return '@' + this.name; - }; - - _proto.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLDirective, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLDirective'; - } - }]); - - return GraphQLDirective; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.GraphQLDirective = GraphQLDirective; -(0, _defineInspect.default)(GraphQLDirective); - -/** - * Used to conditionally include fields or fragments. - */ -var GraphQLIncludeDirective = new GraphQLDirective({ - name: 'include', - description: 'Directs the executor to include this field or fragment only when the `if` argument is true.', - locations: [_directiveLocation.DirectiveLocation.FIELD, _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, _directiveLocation.DirectiveLocation.INLINE_FRAGMENT], - args: { - if: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - description: 'Included when true.' - } - } -}); -/** - * Used to conditionally skip (exclude) fields or fragments. - */ - -exports.GraphQLIncludeDirective = GraphQLIncludeDirective; -var GraphQLSkipDirective = new GraphQLDirective({ - name: 'skip', - description: 'Directs the executor to skip this field or fragment when the `if` argument is true.', - locations: [_directiveLocation.DirectiveLocation.FIELD, _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, _directiveLocation.DirectiveLocation.INLINE_FRAGMENT], - args: { - if: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - description: 'Skipped when true.' - } - } -}); -/** - * Constant string used for default reason for a deprecation. - */ - -exports.GraphQLSkipDirective = GraphQLSkipDirective; -var DEFAULT_DEPRECATION_REASON = 'No longer supported'; -/** - * Used to declare element of a GraphQL schema as deprecated. - */ - -exports.DEFAULT_DEPRECATION_REASON = DEFAULT_DEPRECATION_REASON; -var GraphQLDeprecatedDirective = new GraphQLDirective({ - name: 'deprecated', - description: 'Marks an element of a GraphQL schema as no longer supported.', - locations: [_directiveLocation.DirectiveLocation.FIELD_DEFINITION, _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, _directiveLocation.DirectiveLocation.ENUM_VALUE], - args: { - reason: { - type: _scalars.GraphQLString, - description: 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', - defaultValue: DEFAULT_DEPRECATION_REASON - } - } -}); -/** - * Used to provide a URL for specifying the behaviour of custom scalar definitions. - */ - -exports.GraphQLDeprecatedDirective = GraphQLDeprecatedDirective; -var GraphQLSpecifiedByDirective = new GraphQLDirective({ - name: 'specifiedBy', - description: 'Exposes a URL that specifies the behaviour of this scalar.', - locations: [_directiveLocation.DirectiveLocation.SCALAR], - args: { - url: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLString), - description: 'The URL that specifies the behaviour of this scalar.' - } - } -}); -/** - * The full list of specified directives. - */ - -exports.GraphQLSpecifiedByDirective = GraphQLSpecifiedByDirective; -var specifiedDirectives = Object.freeze([GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective]); -exports.specifiedDirectives = specifiedDirectives; - -function isSpecifiedDirective(directive) { - return specifiedDirectives.some(function (_ref2) { - var name = _ref2.name; - return name === directive.name; - }); -} diff --git a/node_modules/graphql/type/directives.js.flow b/node_modules/graphql/type/directives.js.flow deleted file mode 100644 index fa7496e2..00000000 --- a/node_modules/graphql/type/directives.js.flow +++ /dev/null @@ -1,228 +0,0 @@ -// @flow strict -import objectEntries from '../polyfills/objectEntries'; -import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols'; - -import type { ReadOnlyObjMap, ReadOnlyObjMapLike } from '../jsutils/ObjMap'; -import inspect from '../jsutils/inspect'; -import toObjMap from '../jsutils/toObjMap'; -import devAssert from '../jsutils/devAssert'; -import instanceOf from '../jsutils/instanceOf'; -import isObjectLike from '../jsutils/isObjectLike'; -import defineInspect from '../jsutils/defineInspect'; - -import type { DirectiveDefinitionNode } from '../language/ast'; -import type { DirectiveLocationEnum } from '../language/directiveLocation'; -import { DirectiveLocation } from '../language/directiveLocation'; - -import type { - GraphQLArgument, - GraphQLFieldConfigArgumentMap, -} from './definition'; -import { GraphQLString, GraphQLBoolean } from './scalars'; -import { argsToArgsConfig, GraphQLNonNull } from './definition'; - -/** - * Test if the given value is a GraphQL directive. - */ -declare function isDirective( - directive: mixed, -): boolean %checks(directive instanceof GraphQLDirective); -// eslint-disable-next-line no-redeclare -export function isDirective(directive) { - return instanceOf(directive, GraphQLDirective); -} - -export function assertDirective(directive: mixed): GraphQLDirective { - if (!isDirective(directive)) { - throw new Error( - `Expected ${inspect(directive)} to be a GraphQL directive.`, - ); - } - return directive; -} - -/** - * Directives are used by the GraphQL runtime as a way of modifying execution - * behavior. Type system creators will usually not create these directly. - */ -export class GraphQLDirective { - name: string; - description: ?string; - locations: Array; - args: Array; - isRepeatable: boolean; - extensions: ?ReadOnlyObjMap; - astNode: ?DirectiveDefinitionNode; - - constructor(config: $ReadOnly): void { - this.name = config.name; - this.description = config.description; - this.locations = config.locations; - this.isRepeatable = config.isRepeatable ?? false; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - - devAssert(config.name, 'Directive must be named.'); - devAssert( - Array.isArray(config.locations), - `@${config.name} locations must be an Array.`, - ); - - const args = config.args ?? {}; - devAssert( - isObjectLike(args) && !Array.isArray(args), - `@${config.name} args must be an object with argument names as keys.`, - ); - - this.args = objectEntries(args).map(([argName, argConfig]) => ({ - name: argName, - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - deprecationReason: argConfig.deprecationReason, - extensions: argConfig.extensions && toObjMap(argConfig.extensions), - astNode: argConfig.astNode, - })); - } - - toConfig(): {| - ...GraphQLDirectiveConfig, - args: GraphQLFieldConfigArgumentMap, - isRepeatable: boolean, - extensions: ?ReadOnlyObjMap, - |} { - return { - name: this.name, - description: this.description, - locations: this.locations, - args: argsToArgsConfig(this.args), - isRepeatable: this.isRepeatable, - extensions: this.extensions, - astNode: this.astNode, - }; - } - - toString(): string { - return '@' + this.name; - } - - toJSON(): string { - return this.toString(); - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLDirective'; - } -} - -// Print a simplified form when appearing in `inspect` and `util.inspect`. -defineInspect(GraphQLDirective); - -export type GraphQLDirectiveConfig = {| - name: string, - description?: ?string, - locations: Array, - args?: ?GraphQLFieldConfigArgumentMap, - isRepeatable?: ?boolean, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?DirectiveDefinitionNode, -|}; - -/** - * Used to conditionally include fields or fragments. - */ -export const GraphQLIncludeDirective = new GraphQLDirective({ - name: 'include', - description: - 'Directs the executor to include this field or fragment only when the `if` argument is true.', - locations: [ - DirectiveLocation.FIELD, - DirectiveLocation.FRAGMENT_SPREAD, - DirectiveLocation.INLINE_FRAGMENT, - ], - args: { - if: { - type: new GraphQLNonNull(GraphQLBoolean), - description: 'Included when true.', - }, - }, -}); - -/** - * Used to conditionally skip (exclude) fields or fragments. - */ -export const GraphQLSkipDirective = new GraphQLDirective({ - name: 'skip', - description: - 'Directs the executor to skip this field or fragment when the `if` argument is true.', - locations: [ - DirectiveLocation.FIELD, - DirectiveLocation.FRAGMENT_SPREAD, - DirectiveLocation.INLINE_FRAGMENT, - ], - args: { - if: { - type: new GraphQLNonNull(GraphQLBoolean), - description: 'Skipped when true.', - }, - }, -}); - -/** - * Constant string used for default reason for a deprecation. - */ -export const DEFAULT_DEPRECATION_REASON = 'No longer supported'; - -/** - * Used to declare element of a GraphQL schema as deprecated. - */ -export const GraphQLDeprecatedDirective = new GraphQLDirective({ - name: 'deprecated', - description: 'Marks an element of a GraphQL schema as no longer supported.', - locations: [ - DirectiveLocation.FIELD_DEFINITION, - DirectiveLocation.ARGUMENT_DEFINITION, - DirectiveLocation.INPUT_FIELD_DEFINITION, - DirectiveLocation.ENUM_VALUE, - ], - args: { - reason: { - type: GraphQLString, - description: - 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', - defaultValue: DEFAULT_DEPRECATION_REASON, - }, - }, -}); - -/** - * Used to provide a URL for specifying the behaviour of custom scalar definitions. - */ -export const GraphQLSpecifiedByDirective = new GraphQLDirective({ - name: 'specifiedBy', - description: 'Exposes a URL that specifies the behaviour of this scalar.', - locations: [DirectiveLocation.SCALAR], - args: { - url: { - type: new GraphQLNonNull(GraphQLString), - description: 'The URL that specifies the behaviour of this scalar.', - }, - }, -}); - -/** - * The full list of specified directives. - */ -export const specifiedDirectives = Object.freeze([ - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - GraphQLSpecifiedByDirective, -]); - -export function isSpecifiedDirective( - directive: GraphQLDirective, -): boolean %checks { - return specifiedDirectives.some(({ name }) => name === directive.name); -} diff --git a/node_modules/graphql/type/directives.mjs b/node_modules/graphql/type/directives.mjs deleted file mode 100644 index 6b176581..00000000 --- a/node_modules/graphql/type/directives.mjs +++ /dev/null @@ -1,175 +0,0 @@ -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -import objectEntries from "../polyfills/objectEntries.mjs"; -import { SYMBOL_TO_STRING_TAG } from "../polyfills/symbols.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import toObjMap from "../jsutils/toObjMap.mjs"; -import devAssert from "../jsutils/devAssert.mjs"; -import instanceOf from "../jsutils/instanceOf.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import defineInspect from "../jsutils/defineInspect.mjs"; -import { DirectiveLocation } from "../language/directiveLocation.mjs"; -import { GraphQLString, GraphQLBoolean } from "./scalars.mjs"; -import { argsToArgsConfig, GraphQLNonNull } from "./definition.mjs"; -/** - * Test if the given value is a GraphQL directive. - */ - -// eslint-disable-next-line no-redeclare -export function isDirective(directive) { - return instanceOf(directive, GraphQLDirective); -} -export function assertDirective(directive) { - if (!isDirective(directive)) { - throw new Error("Expected ".concat(inspect(directive), " to be a GraphQL directive.")); - } - - return directive; -} -/** - * Directives are used by the GraphQL runtime as a way of modifying execution - * behavior. Type system creators will usually not create these directly. - */ - -export var GraphQLDirective = /*#__PURE__*/function () { - function GraphQLDirective(config) { - var _config$isRepeatable, _config$args; - - this.name = config.name; - this.description = config.description; - this.locations = config.locations; - this.isRepeatable = (_config$isRepeatable = config.isRepeatable) !== null && _config$isRepeatable !== void 0 ? _config$isRepeatable : false; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - config.name || devAssert(0, 'Directive must be named.'); - Array.isArray(config.locations) || devAssert(0, "@".concat(config.name, " locations must be an Array.")); - var args = (_config$args = config.args) !== null && _config$args !== void 0 ? _config$args : {}; - isObjectLike(args) && !Array.isArray(args) || devAssert(0, "@".concat(config.name, " args must be an object with argument names as keys.")); - this.args = objectEntries(args).map(function (_ref) { - var argName = _ref[0], - argConfig = _ref[1]; - return { - name: argName, - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - deprecationReason: argConfig.deprecationReason, - extensions: argConfig.extensions && toObjMap(argConfig.extensions), - astNode: argConfig.astNode - }; - }); - } - - var _proto = GraphQLDirective.prototype; - - _proto.toConfig = function toConfig() { - return { - name: this.name, - description: this.description, - locations: this.locations, - args: argsToArgsConfig(this.args), - isRepeatable: this.isRepeatable, - extensions: this.extensions, - astNode: this.astNode - }; - }; - - _proto.toString = function toString() { - return '@' + this.name; - }; - - _proto.toJSON = function toJSON() { - return this.toString(); - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLDirective, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLDirective'; - } - }]); - - return GraphQLDirective; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - -defineInspect(GraphQLDirective); - -/** - * Used to conditionally include fields or fragments. - */ -export var GraphQLIncludeDirective = new GraphQLDirective({ - name: 'include', - description: 'Directs the executor to include this field or fragment only when the `if` argument is true.', - locations: [DirectiveLocation.FIELD, DirectiveLocation.FRAGMENT_SPREAD, DirectiveLocation.INLINE_FRAGMENT], - args: { - if: { - type: new GraphQLNonNull(GraphQLBoolean), - description: 'Included when true.' - } - } -}); -/** - * Used to conditionally skip (exclude) fields or fragments. - */ - -export var GraphQLSkipDirective = new GraphQLDirective({ - name: 'skip', - description: 'Directs the executor to skip this field or fragment when the `if` argument is true.', - locations: [DirectiveLocation.FIELD, DirectiveLocation.FRAGMENT_SPREAD, DirectiveLocation.INLINE_FRAGMENT], - args: { - if: { - type: new GraphQLNonNull(GraphQLBoolean), - description: 'Skipped when true.' - } - } -}); -/** - * Constant string used for default reason for a deprecation. - */ - -export var DEFAULT_DEPRECATION_REASON = 'No longer supported'; -/** - * Used to declare element of a GraphQL schema as deprecated. - */ - -export var GraphQLDeprecatedDirective = new GraphQLDirective({ - name: 'deprecated', - description: 'Marks an element of a GraphQL schema as no longer supported.', - locations: [DirectiveLocation.FIELD_DEFINITION, DirectiveLocation.ARGUMENT_DEFINITION, DirectiveLocation.INPUT_FIELD_DEFINITION, DirectiveLocation.ENUM_VALUE], - args: { - reason: { - type: GraphQLString, - description: 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', - defaultValue: DEFAULT_DEPRECATION_REASON - } - } -}); -/** - * Used to provide a URL for specifying the behaviour of custom scalar definitions. - */ - -export var GraphQLSpecifiedByDirective = new GraphQLDirective({ - name: 'specifiedBy', - description: 'Exposes a URL that specifies the behaviour of this scalar.', - locations: [DirectiveLocation.SCALAR], - args: { - url: { - type: new GraphQLNonNull(GraphQLString), - description: 'The URL that specifies the behaviour of this scalar.' - } - } -}); -/** - * The full list of specified directives. - */ - -export var specifiedDirectives = Object.freeze([GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective]); -export function isSpecifiedDirective(directive) { - return specifiedDirectives.some(function (_ref2) { - var name = _ref2.name; - return name === directive.name; - }); -} diff --git a/node_modules/graphql/type/index.d.ts b/node_modules/graphql/type/index.d.ts deleted file mode 100644 index 9686f413..00000000 --- a/node_modules/graphql/type/index.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -export { Path as ResponsePath } from '../jsutils/Path'; - -export { - // Predicate - isSchema, - // Assertion - assertSchema, - // GraphQL Schema definition - GraphQLSchema, - GraphQLSchemaConfig, - GraphQLSchemaExtensions, -} from './schema'; - -export { - // Predicates - isType, - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, - isListType, - isNonNullType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - isWrappingType, - isNullableType, - isNamedType, - isRequiredArgument, - isRequiredInputField, - // Assertions - assertType, - assertScalarType, - assertObjectType, - assertInterfaceType, - assertUnionType, - assertEnumType, - assertInputObjectType, - assertListType, - assertNonNullType, - assertInputType, - assertOutputType, - assertLeafType, - assertCompositeType, - assertAbstractType, - assertWrappingType, - assertNullableType, - assertNamedType, - // Un-modifiers - getNullableType, - getNamedType, - // Definitions - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - // Type Wrappers - GraphQLList, - GraphQLNonNull, - // type - GraphQLType, - GraphQLInputType, - GraphQLOutputType, - GraphQLLeafType, - GraphQLCompositeType, - GraphQLAbstractType, - GraphQLWrappingType, - GraphQLNullableType, - GraphQLNamedType, - Thunk, - GraphQLArgument, - GraphQLArgumentConfig, - GraphQLArgumentExtensions, - GraphQLEnumTypeConfig, - GraphQLEnumTypeExtensions, - GraphQLEnumValue, - GraphQLEnumValueConfig, - GraphQLEnumValueConfigMap, - GraphQLEnumValueExtensions, - GraphQLField, - GraphQLFieldConfig, - GraphQLFieldConfigArgumentMap, - GraphQLFieldConfigMap, - GraphQLFieldExtensions, - GraphQLFieldMap, - GraphQLFieldResolver, - GraphQLInputField, - GraphQLInputFieldConfig, - GraphQLInputFieldConfigMap, - GraphQLInputFieldExtensions, - GraphQLInputFieldMap, - GraphQLInputObjectTypeConfig, - GraphQLInputObjectTypeExtensions, - GraphQLInterfaceTypeConfig, - GraphQLInterfaceTypeExtensions, - GraphQLIsTypeOfFn, - GraphQLObjectTypeConfig, - GraphQLObjectTypeExtensions, - GraphQLResolveInfo, - GraphQLScalarTypeConfig, - GraphQLScalarTypeExtensions, - GraphQLTypeResolver, - GraphQLUnionTypeConfig, - GraphQLUnionTypeExtensions, - GraphQLScalarSerializer, - GraphQLScalarValueParser, - GraphQLScalarLiteralParser, -} from './definition'; - -export { - // Predicate - isDirective, - // Assertion - assertDirective, - // Directives Definition - GraphQLDirective, - // Built-in Directives defined by the Spec - isSpecifiedDirective, - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - GraphQLSpecifiedByDirective, - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, - // type - GraphQLDirectiveConfig, - GraphQLDirectiveExtensions, -} from './directives'; - -// Common built-in scalar instances. -export { - isSpecifiedScalarType, - specifiedScalarTypes, - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, -} from './scalars'; - -export { - // "Enum" of Type Kinds - TypeKind, - // GraphQL Types for introspection. - isIntrospectionType, - introspectionTypes, - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, -} from './introspection'; - -export { validateSchema, assertValidSchema } from './validate'; diff --git a/node_modules/graphql/type/index.js b/node_modules/graphql/type/index.js deleted file mode 100644 index e245defd..00000000 --- a/node_modules/graphql/type/index.js +++ /dev/null @@ -1,509 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "isSchema", { - enumerable: true, - get: function get() { - return _schema.isSchema; - } -}); -Object.defineProperty(exports, "assertSchema", { - enumerable: true, - get: function get() { - return _schema.assertSchema; - } -}); -Object.defineProperty(exports, "GraphQLSchema", { - enumerable: true, - get: function get() { - return _schema.GraphQLSchema; - } -}); -Object.defineProperty(exports, "isType", { - enumerable: true, - get: function get() { - return _definition.isType; - } -}); -Object.defineProperty(exports, "isScalarType", { - enumerable: true, - get: function get() { - return _definition.isScalarType; - } -}); -Object.defineProperty(exports, "isObjectType", { - enumerable: true, - get: function get() { - return _definition.isObjectType; - } -}); -Object.defineProperty(exports, "isInterfaceType", { - enumerable: true, - get: function get() { - return _definition.isInterfaceType; - } -}); -Object.defineProperty(exports, "isUnionType", { - enumerable: true, - get: function get() { - return _definition.isUnionType; - } -}); -Object.defineProperty(exports, "isEnumType", { - enumerable: true, - get: function get() { - return _definition.isEnumType; - } -}); -Object.defineProperty(exports, "isInputObjectType", { - enumerable: true, - get: function get() { - return _definition.isInputObjectType; - } -}); -Object.defineProperty(exports, "isListType", { - enumerable: true, - get: function get() { - return _definition.isListType; - } -}); -Object.defineProperty(exports, "isNonNullType", { - enumerable: true, - get: function get() { - return _definition.isNonNullType; - } -}); -Object.defineProperty(exports, "isInputType", { - enumerable: true, - get: function get() { - return _definition.isInputType; - } -}); -Object.defineProperty(exports, "isOutputType", { - enumerable: true, - get: function get() { - return _definition.isOutputType; - } -}); -Object.defineProperty(exports, "isLeafType", { - enumerable: true, - get: function get() { - return _definition.isLeafType; - } -}); -Object.defineProperty(exports, "isCompositeType", { - enumerable: true, - get: function get() { - return _definition.isCompositeType; - } -}); -Object.defineProperty(exports, "isAbstractType", { - enumerable: true, - get: function get() { - return _definition.isAbstractType; - } -}); -Object.defineProperty(exports, "isWrappingType", { - enumerable: true, - get: function get() { - return _definition.isWrappingType; - } -}); -Object.defineProperty(exports, "isNullableType", { - enumerable: true, - get: function get() { - return _definition.isNullableType; - } -}); -Object.defineProperty(exports, "isNamedType", { - enumerable: true, - get: function get() { - return _definition.isNamedType; - } -}); -Object.defineProperty(exports, "isRequiredArgument", { - enumerable: true, - get: function get() { - return _definition.isRequiredArgument; - } -}); -Object.defineProperty(exports, "isRequiredInputField", { - enumerable: true, - get: function get() { - return _definition.isRequiredInputField; - } -}); -Object.defineProperty(exports, "assertType", { - enumerable: true, - get: function get() { - return _definition.assertType; - } -}); -Object.defineProperty(exports, "assertScalarType", { - enumerable: true, - get: function get() { - return _definition.assertScalarType; - } -}); -Object.defineProperty(exports, "assertObjectType", { - enumerable: true, - get: function get() { - return _definition.assertObjectType; - } -}); -Object.defineProperty(exports, "assertInterfaceType", { - enumerable: true, - get: function get() { - return _definition.assertInterfaceType; - } -}); -Object.defineProperty(exports, "assertUnionType", { - enumerable: true, - get: function get() { - return _definition.assertUnionType; - } -}); -Object.defineProperty(exports, "assertEnumType", { - enumerable: true, - get: function get() { - return _definition.assertEnumType; - } -}); -Object.defineProperty(exports, "assertInputObjectType", { - enumerable: true, - get: function get() { - return _definition.assertInputObjectType; - } -}); -Object.defineProperty(exports, "assertListType", { - enumerable: true, - get: function get() { - return _definition.assertListType; - } -}); -Object.defineProperty(exports, "assertNonNullType", { - enumerable: true, - get: function get() { - return _definition.assertNonNullType; - } -}); -Object.defineProperty(exports, "assertInputType", { - enumerable: true, - get: function get() { - return _definition.assertInputType; - } -}); -Object.defineProperty(exports, "assertOutputType", { - enumerable: true, - get: function get() { - return _definition.assertOutputType; - } -}); -Object.defineProperty(exports, "assertLeafType", { - enumerable: true, - get: function get() { - return _definition.assertLeafType; - } -}); -Object.defineProperty(exports, "assertCompositeType", { - enumerable: true, - get: function get() { - return _definition.assertCompositeType; - } -}); -Object.defineProperty(exports, "assertAbstractType", { - enumerable: true, - get: function get() { - return _definition.assertAbstractType; - } -}); -Object.defineProperty(exports, "assertWrappingType", { - enumerable: true, - get: function get() { - return _definition.assertWrappingType; - } -}); -Object.defineProperty(exports, "assertNullableType", { - enumerable: true, - get: function get() { - return _definition.assertNullableType; - } -}); -Object.defineProperty(exports, "assertNamedType", { - enumerable: true, - get: function get() { - return _definition.assertNamedType; - } -}); -Object.defineProperty(exports, "getNullableType", { - enumerable: true, - get: function get() { - return _definition.getNullableType; - } -}); -Object.defineProperty(exports, "getNamedType", { - enumerable: true, - get: function get() { - return _definition.getNamedType; - } -}); -Object.defineProperty(exports, "GraphQLScalarType", { - enumerable: true, - get: function get() { - return _definition.GraphQLScalarType; - } -}); -Object.defineProperty(exports, "GraphQLObjectType", { - enumerable: true, - get: function get() { - return _definition.GraphQLObjectType; - } -}); -Object.defineProperty(exports, "GraphQLInterfaceType", { - enumerable: true, - get: function get() { - return _definition.GraphQLInterfaceType; - } -}); -Object.defineProperty(exports, "GraphQLUnionType", { - enumerable: true, - get: function get() { - return _definition.GraphQLUnionType; - } -}); -Object.defineProperty(exports, "GraphQLEnumType", { - enumerable: true, - get: function get() { - return _definition.GraphQLEnumType; - } -}); -Object.defineProperty(exports, "GraphQLInputObjectType", { - enumerable: true, - get: function get() { - return _definition.GraphQLInputObjectType; - } -}); -Object.defineProperty(exports, "GraphQLList", { - enumerable: true, - get: function get() { - return _definition.GraphQLList; - } -}); -Object.defineProperty(exports, "GraphQLNonNull", { - enumerable: true, - get: function get() { - return _definition.GraphQLNonNull; - } -}); -Object.defineProperty(exports, "isDirective", { - enumerable: true, - get: function get() { - return _directives.isDirective; - } -}); -Object.defineProperty(exports, "assertDirective", { - enumerable: true, - get: function get() { - return _directives.assertDirective; - } -}); -Object.defineProperty(exports, "GraphQLDirective", { - enumerable: true, - get: function get() { - return _directives.GraphQLDirective; - } -}); -Object.defineProperty(exports, "isSpecifiedDirective", { - enumerable: true, - get: function get() { - return _directives.isSpecifiedDirective; - } -}); -Object.defineProperty(exports, "specifiedDirectives", { - enumerable: true, - get: function get() { - return _directives.specifiedDirectives; - } -}); -Object.defineProperty(exports, "GraphQLIncludeDirective", { - enumerable: true, - get: function get() { - return _directives.GraphQLIncludeDirective; - } -}); -Object.defineProperty(exports, "GraphQLSkipDirective", { - enumerable: true, - get: function get() { - return _directives.GraphQLSkipDirective; - } -}); -Object.defineProperty(exports, "GraphQLDeprecatedDirective", { - enumerable: true, - get: function get() { - return _directives.GraphQLDeprecatedDirective; - } -}); -Object.defineProperty(exports, "GraphQLSpecifiedByDirective", { - enumerable: true, - get: function get() { - return _directives.GraphQLSpecifiedByDirective; - } -}); -Object.defineProperty(exports, "DEFAULT_DEPRECATION_REASON", { - enumerable: true, - get: function get() { - return _directives.DEFAULT_DEPRECATION_REASON; - } -}); -Object.defineProperty(exports, "isSpecifiedScalarType", { - enumerable: true, - get: function get() { - return _scalars.isSpecifiedScalarType; - } -}); -Object.defineProperty(exports, "specifiedScalarTypes", { - enumerable: true, - get: function get() { - return _scalars.specifiedScalarTypes; - } -}); -Object.defineProperty(exports, "GraphQLInt", { - enumerable: true, - get: function get() { - return _scalars.GraphQLInt; - } -}); -Object.defineProperty(exports, "GraphQLFloat", { - enumerable: true, - get: function get() { - return _scalars.GraphQLFloat; - } -}); -Object.defineProperty(exports, "GraphQLString", { - enumerable: true, - get: function get() { - return _scalars.GraphQLString; - } -}); -Object.defineProperty(exports, "GraphQLBoolean", { - enumerable: true, - get: function get() { - return _scalars.GraphQLBoolean; - } -}); -Object.defineProperty(exports, "GraphQLID", { - enumerable: true, - get: function get() { - return _scalars.GraphQLID; - } -}); -Object.defineProperty(exports, "isIntrospectionType", { - enumerable: true, - get: function get() { - return _introspection.isIntrospectionType; - } -}); -Object.defineProperty(exports, "introspectionTypes", { - enumerable: true, - get: function get() { - return _introspection.introspectionTypes; - } -}); -Object.defineProperty(exports, "__Schema", { - enumerable: true, - get: function get() { - return _introspection.__Schema; - } -}); -Object.defineProperty(exports, "__Directive", { - enumerable: true, - get: function get() { - return _introspection.__Directive; - } -}); -Object.defineProperty(exports, "__DirectiveLocation", { - enumerable: true, - get: function get() { - return _introspection.__DirectiveLocation; - } -}); -Object.defineProperty(exports, "__Type", { - enumerable: true, - get: function get() { - return _introspection.__Type; - } -}); -Object.defineProperty(exports, "__Field", { - enumerable: true, - get: function get() { - return _introspection.__Field; - } -}); -Object.defineProperty(exports, "__InputValue", { - enumerable: true, - get: function get() { - return _introspection.__InputValue; - } -}); -Object.defineProperty(exports, "__EnumValue", { - enumerable: true, - get: function get() { - return _introspection.__EnumValue; - } -}); -Object.defineProperty(exports, "__TypeKind", { - enumerable: true, - get: function get() { - return _introspection.__TypeKind; - } -}); -Object.defineProperty(exports, "TypeKind", { - enumerable: true, - get: function get() { - return _introspection.TypeKind; - } -}); -Object.defineProperty(exports, "SchemaMetaFieldDef", { - enumerable: true, - get: function get() { - return _introspection.SchemaMetaFieldDef; - } -}); -Object.defineProperty(exports, "TypeMetaFieldDef", { - enumerable: true, - get: function get() { - return _introspection.TypeMetaFieldDef; - } -}); -Object.defineProperty(exports, "TypeNameMetaFieldDef", { - enumerable: true, - get: function get() { - return _introspection.TypeNameMetaFieldDef; - } -}); -Object.defineProperty(exports, "validateSchema", { - enumerable: true, - get: function get() { - return _validate.validateSchema; - } -}); -Object.defineProperty(exports, "assertValidSchema", { - enumerable: true, - get: function get() { - return _validate.assertValidSchema; - } -}); - -var _schema = require("./schema.js"); - -var _definition = require("./definition.js"); - -var _directives = require("./directives.js"); - -var _scalars = require("./scalars.js"); - -var _introspection = require("./introspection.js"); - -var _validate = require("./validate.js"); diff --git a/node_modules/graphql/type/index.js.flow b/node_modules/graphql/type/index.js.flow deleted file mode 100644 index 85603d0d..00000000 --- a/node_modules/graphql/type/index.js.flow +++ /dev/null @@ -1,163 +0,0 @@ -// @flow strict -export type { Path as ResponsePath } from '../jsutils/Path'; - -export { - // Predicate - isSchema, - // Assertion - assertSchema, - // GraphQL Schema definition - GraphQLSchema, -} from './schema'; -export type { GraphQLSchemaConfig } from './schema'; - -export { - // Predicates - isType, - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, - isListType, - isNonNullType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - isWrappingType, - isNullableType, - isNamedType, - isRequiredArgument, - isRequiredInputField, - // Assertions - assertType, - assertScalarType, - assertObjectType, - assertInterfaceType, - assertUnionType, - assertEnumType, - assertInputObjectType, - assertListType, - assertNonNullType, - assertInputType, - assertOutputType, - assertLeafType, - assertCompositeType, - assertAbstractType, - assertWrappingType, - assertNullableType, - assertNamedType, - // Un-modifiers - getNullableType, - getNamedType, - // Definitions - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - // Type Wrappers - GraphQLList, - GraphQLNonNull, -} from './definition'; - -export { - // Predicate - isDirective, - // Assertion - assertDirective, - // Directives Definition - GraphQLDirective, - // Built-in Directives defined by the Spec - isSpecifiedDirective, - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - GraphQLSpecifiedByDirective, - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, -} from './directives'; - -export type { GraphQLDirectiveConfig } from './directives'; - -// Common built-in scalar instances. -export { - // Predicate - isSpecifiedScalarType, - // Standard GraphQL Scalars - specifiedScalarTypes, - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, -} from './scalars'; - -export { - // Predicate - isIntrospectionType, - // GraphQL Types for introspection. - introspectionTypes, - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - // "Enum" of Type Kinds - TypeKind, - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, -} from './introspection'; - -export type { - GraphQLType, - GraphQLInputType, - GraphQLOutputType, - GraphQLLeafType, - GraphQLCompositeType, - GraphQLAbstractType, - GraphQLWrappingType, - GraphQLNullableType, - GraphQLNamedType, - Thunk, - GraphQLArgument, - GraphQLArgumentConfig, - GraphQLEnumTypeConfig, - GraphQLEnumValue, - GraphQLEnumValueConfig, - GraphQLEnumValueConfigMap, - GraphQLField, - GraphQLFieldConfig, - GraphQLFieldConfigArgumentMap, - GraphQLFieldConfigMap, - GraphQLFieldMap, - GraphQLFieldResolver, - GraphQLInputField, - GraphQLInputFieldConfig, - GraphQLInputFieldConfigMap, - GraphQLInputFieldMap, - GraphQLInputObjectTypeConfig, - GraphQLInterfaceTypeConfig, - GraphQLIsTypeOfFn, - GraphQLObjectTypeConfig, - GraphQLResolveInfo, - GraphQLScalarTypeConfig, - GraphQLTypeResolver, - GraphQLUnionTypeConfig, - GraphQLScalarSerializer, - GraphQLScalarValueParser, - GraphQLScalarLiteralParser, -} from './definition'; - -// Validate GraphQL schema. -export { validateSchema, assertValidSchema } from './validate'; diff --git a/node_modules/graphql/type/index.mjs b/node_modules/graphql/type/index.mjs deleted file mode 100644 index 48e61baf..00000000 --- a/node_modules/graphql/type/index.mjs +++ /dev/null @@ -1,27 +0,0 @@ -export { // Predicate -isSchema // Assertion -, assertSchema // GraphQL Schema definition -, GraphQLSchema } from "./schema.mjs"; -export { // Predicates -isType, isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isListType, isNonNullType, isInputType, isOutputType, isLeafType, isCompositeType, isAbstractType, isWrappingType, isNullableType, isNamedType, isRequiredArgument, isRequiredInputField // Assertions -, assertType, assertScalarType, assertObjectType, assertInterfaceType, assertUnionType, assertEnumType, assertInputObjectType, assertListType, assertNonNullType, assertInputType, assertOutputType, assertLeafType, assertCompositeType, assertAbstractType, assertWrappingType, assertNullableType, assertNamedType // Un-modifiers -, getNullableType, getNamedType // Definitions -, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType // Type Wrappers -, GraphQLList, GraphQLNonNull } from "./definition.mjs"; -export { // Predicate -isDirective // Assertion -, assertDirective // Directives Definition -, GraphQLDirective // Built-in Directives defined by the Spec -, isSpecifiedDirective, specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective // Constant Deprecation Reason -, DEFAULT_DEPRECATION_REASON } from "./directives.mjs"; -// Common built-in scalar instances. -export { // Predicate -isSpecifiedScalarType // Standard GraphQL Scalars -, specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID } from "./scalars.mjs"; -export { // Predicate -isIntrospectionType // GraphQL Types for introspection. -, introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind // "Enum" of Type Kinds -, TypeKind // Meta-field definitions. -, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from "./introspection.mjs"; -// Validate GraphQL schema. -export { validateSchema, assertValidSchema } from "./validate.mjs"; diff --git a/node_modules/graphql/type/introspection.d.ts b/node_modules/graphql/type/introspection.d.ts deleted file mode 100644 index 34cefa72..00000000 --- a/node_modules/graphql/type/introspection.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { - GraphQLObjectType, - GraphQLField, - GraphQLEnumType, - GraphQLNamedType, -} from './definition'; - -export const __Schema: GraphQLObjectType; -export const __Directive: GraphQLObjectType; -export const __DirectiveLocation: GraphQLEnumType; -export const __Type: GraphQLObjectType; -export const __Field: GraphQLObjectType; -export const __InputValue: GraphQLObjectType; -export const __EnumValue: GraphQLObjectType; - -export const TypeKind: { - SCALAR: 'SCALAR'; - OBJECT: 'OBJECT'; - INTERFACE: 'INTERFACE'; - UNION: 'UNION'; - ENUM: 'ENUM'; - INPUT_OBJECT: 'INPUT_OBJECT'; - LIST: 'LIST'; - NON_NULL: 'NON_NULL'; -}; - -export const __TypeKind: GraphQLEnumType; - -/** - * Note that these are GraphQLField and not GraphQLFieldConfig, - * so the format for args is different. - */ - -export const SchemaMetaFieldDef: GraphQLField; -export const TypeMetaFieldDef: GraphQLField; -export const TypeNameMetaFieldDef: GraphQLField; - -export const introspectionTypes: ReadonlyArray; - -export function isIntrospectionType(type: GraphQLNamedType): boolean; diff --git a/node_modules/graphql/type/introspection.js b/node_modules/graphql/type/introspection.js deleted file mode 100644 index 4bf155d2..00000000 --- a/node_modules/graphql/type/introspection.js +++ /dev/null @@ -1,615 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isIntrospectionType = isIntrospectionType; -exports.introspectionTypes = exports.TypeNameMetaFieldDef = exports.TypeMetaFieldDef = exports.SchemaMetaFieldDef = exports.__TypeKind = exports.TypeKind = exports.__EnumValue = exports.__InputValue = exports.__Field = exports.__Type = exports.__DirectiveLocation = exports.__Directive = exports.__Schema = void 0; - -var _objectValues = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _printer = require("../language/printer.js"); - -var _directiveLocation = require("../language/directiveLocation.js"); - -var _astFromValue = require("../utilities/astFromValue.js"); - -var _scalars = require("./scalars.js"); - -var _definition = require("./definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var __Schema = new _definition.GraphQLObjectType({ - name: '__Schema', - description: 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', - fields: function fields() { - return { - description: { - type: _scalars.GraphQLString, - resolve: function resolve(schema) { - return schema.description; - } - }, - types: { - description: 'A list of all types supported by this server.', - type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type))), - resolve: function resolve(schema) { - return (0, _objectValues.default)(schema.getTypeMap()); - } - }, - queryType: { - description: 'The type that query operations will be rooted at.', - type: new _definition.GraphQLNonNull(__Type), - resolve: function resolve(schema) { - return schema.getQueryType(); - } - }, - mutationType: { - description: 'If this server supports mutation, the type that mutation operations will be rooted at.', - type: __Type, - resolve: function resolve(schema) { - return schema.getMutationType(); - } - }, - subscriptionType: { - description: 'If this server support subscription, the type that subscription operations will be rooted at.', - type: __Type, - resolve: function resolve(schema) { - return schema.getSubscriptionType(); - } - }, - directives: { - description: 'A list of all directives supported by this server.', - type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__Directive))), - resolve: function resolve(schema) { - return schema.getDirectives(); - } - } - }; - } -}); - -exports.__Schema = __Schema; - -var __Directive = new _definition.GraphQLObjectType({ - name: '__Directive', - description: "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - fields: function fields() { - return { - name: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLString), - resolve: function resolve(directive) { - return directive.name; - } - }, - description: { - type: _scalars.GraphQLString, - resolve: function resolve(directive) { - return directive.description; - } - }, - isRepeatable: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - resolve: function resolve(directive) { - return directive.isRepeatable; - } - }, - locations: { - type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__DirectiveLocation))), - resolve: function resolve(directive) { - return directive.locations; - } - }, - args: { - type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue))), - resolve: function resolve(directive) { - return directive.args; - } - } - }; - } -}); - -exports.__Directive = __Directive; - -var __DirectiveLocation = new _definition.GraphQLEnumType({ - name: '__DirectiveLocation', - description: 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', - values: { - QUERY: { - value: _directiveLocation.DirectiveLocation.QUERY, - description: 'Location adjacent to a query operation.' - }, - MUTATION: { - value: _directiveLocation.DirectiveLocation.MUTATION, - description: 'Location adjacent to a mutation operation.' - }, - SUBSCRIPTION: { - value: _directiveLocation.DirectiveLocation.SUBSCRIPTION, - description: 'Location adjacent to a subscription operation.' - }, - FIELD: { - value: _directiveLocation.DirectiveLocation.FIELD, - description: 'Location adjacent to a field.' - }, - FRAGMENT_DEFINITION: { - value: _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION, - description: 'Location adjacent to a fragment definition.' - }, - FRAGMENT_SPREAD: { - value: _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, - description: 'Location adjacent to a fragment spread.' - }, - INLINE_FRAGMENT: { - value: _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, - description: 'Location adjacent to an inline fragment.' - }, - VARIABLE_DEFINITION: { - value: _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION, - description: 'Location adjacent to a variable definition.' - }, - SCHEMA: { - value: _directiveLocation.DirectiveLocation.SCHEMA, - description: 'Location adjacent to a schema definition.' - }, - SCALAR: { - value: _directiveLocation.DirectiveLocation.SCALAR, - description: 'Location adjacent to a scalar definition.' - }, - OBJECT: { - value: _directiveLocation.DirectiveLocation.OBJECT, - description: 'Location adjacent to an object type definition.' - }, - FIELD_DEFINITION: { - value: _directiveLocation.DirectiveLocation.FIELD_DEFINITION, - description: 'Location adjacent to a field definition.' - }, - ARGUMENT_DEFINITION: { - value: _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, - description: 'Location adjacent to an argument definition.' - }, - INTERFACE: { - value: _directiveLocation.DirectiveLocation.INTERFACE, - description: 'Location adjacent to an interface definition.' - }, - UNION: { - value: _directiveLocation.DirectiveLocation.UNION, - description: 'Location adjacent to a union definition.' - }, - ENUM: { - value: _directiveLocation.DirectiveLocation.ENUM, - description: 'Location adjacent to an enum definition.' - }, - ENUM_VALUE: { - value: _directiveLocation.DirectiveLocation.ENUM_VALUE, - description: 'Location adjacent to an enum value definition.' - }, - INPUT_OBJECT: { - value: _directiveLocation.DirectiveLocation.INPUT_OBJECT, - description: 'Location adjacent to an input object type definition.' - }, - INPUT_FIELD_DEFINITION: { - value: _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, - description: 'Location adjacent to an input object field definition.' - } - } -}); - -exports.__DirectiveLocation = __DirectiveLocation; - -var __Type = new _definition.GraphQLObjectType({ - name: '__Type', - description: 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', - fields: function fields() { - return { - kind: { - type: new _definition.GraphQLNonNull(__TypeKind), - resolve: function resolve(type) { - if ((0, _definition.isScalarType)(type)) { - return TypeKind.SCALAR; - } - - if ((0, _definition.isObjectType)(type)) { - return TypeKind.OBJECT; - } - - if ((0, _definition.isInterfaceType)(type)) { - return TypeKind.INTERFACE; - } - - if ((0, _definition.isUnionType)(type)) { - return TypeKind.UNION; - } - - if ((0, _definition.isEnumType)(type)) { - return TypeKind.ENUM; - } - - if ((0, _definition.isInputObjectType)(type)) { - return TypeKind.INPUT_OBJECT; - } - - if ((0, _definition.isListType)(type)) { - return TypeKind.LIST; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isNonNullType)(type)) { - return TypeKind.NON_NULL; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, "Unexpected type: \"".concat((0, _inspect.default)(type), "\".")); - } - }, - name: { - type: _scalars.GraphQLString, - resolve: function resolve(type) { - return type.name !== undefined ? type.name : undefined; - } - }, - description: { - type: _scalars.GraphQLString, - resolve: function resolve(type) { - return type.description !== undefined ? type.description : undefined; - } - }, - specifiedByUrl: { - type: _scalars.GraphQLString, - resolve: function resolve(obj) { - return obj.specifiedByUrl !== undefined ? obj.specifiedByUrl : undefined; - } - }, - fields: { - type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Field)), - args: { - includeDeprecated: { - type: _scalars.GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(type, _ref) { - var includeDeprecated = _ref.includeDeprecated; - - if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { - var fields = (0, _objectValues.default)(type.getFields()); - return includeDeprecated ? fields : fields.filter(function (field) { - return field.deprecationReason == null; - }); - } - } - }, - interfaces: { - type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), - resolve: function resolve(type) { - if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { - return type.getInterfaces(); - } - } - }, - possibleTypes: { - type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), - resolve: function resolve(type, _args, _context, _ref2) { - var schema = _ref2.schema; - - if ((0, _definition.isAbstractType)(type)) { - return schema.getPossibleTypes(type); - } - } - }, - enumValues: { - type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__EnumValue)), - args: { - includeDeprecated: { - type: _scalars.GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(type, _ref3) { - var includeDeprecated = _ref3.includeDeprecated; - - if ((0, _definition.isEnumType)(type)) { - var values = type.getValues(); - return includeDeprecated ? values : values.filter(function (field) { - return field.deprecationReason == null; - }); - } - } - }, - inputFields: { - type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue)), - args: { - includeDeprecated: { - type: _scalars.GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(type, _ref4) { - var includeDeprecated = _ref4.includeDeprecated; - - if ((0, _definition.isInputObjectType)(type)) { - var values = (0, _objectValues.default)(type.getFields()); - return includeDeprecated ? values : values.filter(function (field) { - return field.deprecationReason == null; - }); - } - } - }, - ofType: { - type: __Type, - resolve: function resolve(type) { - return type.ofType !== undefined ? type.ofType : undefined; - } - } - }; - } -}); - -exports.__Type = __Type; - -var __Field = new _definition.GraphQLObjectType({ - name: '__Field', - description: 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', - fields: function fields() { - return { - name: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLString), - resolve: function resolve(field) { - return field.name; - } - }, - description: { - type: _scalars.GraphQLString, - resolve: function resolve(field) { - return field.description; - } - }, - args: { - type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue))), - args: { - includeDeprecated: { - type: _scalars.GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(field, _ref5) { - var includeDeprecated = _ref5.includeDeprecated; - return includeDeprecated ? field.args : field.args.filter(function (arg) { - return arg.deprecationReason == null; - }); - } - }, - type: { - type: new _definition.GraphQLNonNull(__Type), - resolve: function resolve(field) { - return field.type; - } - }, - isDeprecated: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - resolve: function resolve(field) { - return field.deprecationReason != null; - } - }, - deprecationReason: { - type: _scalars.GraphQLString, - resolve: function resolve(field) { - return field.deprecationReason; - } - } - }; - } -}); - -exports.__Field = __Field; - -var __InputValue = new _definition.GraphQLObjectType({ - name: '__InputValue', - description: 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', - fields: function fields() { - return { - name: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLString), - resolve: function resolve(inputValue) { - return inputValue.name; - } - }, - description: { - type: _scalars.GraphQLString, - resolve: function resolve(inputValue) { - return inputValue.description; - } - }, - type: { - type: new _definition.GraphQLNonNull(__Type), - resolve: function resolve(inputValue) { - return inputValue.type; - } - }, - defaultValue: { - type: _scalars.GraphQLString, - description: 'A GraphQL-formatted string representing the default value for this input value.', - resolve: function resolve(inputValue) { - var type = inputValue.type, - defaultValue = inputValue.defaultValue; - var valueAST = (0, _astFromValue.astFromValue)(defaultValue, type); - return valueAST ? (0, _printer.print)(valueAST) : null; - } - }, - isDeprecated: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - resolve: function resolve(field) { - return field.deprecationReason != null; - } - }, - deprecationReason: { - type: _scalars.GraphQLString, - resolve: function resolve(obj) { - return obj.deprecationReason; - } - } - }; - } -}); - -exports.__InputValue = __InputValue; - -var __EnumValue = new _definition.GraphQLObjectType({ - name: '__EnumValue', - description: 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', - fields: function fields() { - return { - name: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLString), - resolve: function resolve(enumValue) { - return enumValue.name; - } - }, - description: { - type: _scalars.GraphQLString, - resolve: function resolve(enumValue) { - return enumValue.description; - } - }, - isDeprecated: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - resolve: function resolve(enumValue) { - return enumValue.deprecationReason != null; - } - }, - deprecationReason: { - type: _scalars.GraphQLString, - resolve: function resolve(enumValue) { - return enumValue.deprecationReason; - } - } - }; - } -}); - -exports.__EnumValue = __EnumValue; -var TypeKind = Object.freeze({ - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - INPUT_OBJECT: 'INPUT_OBJECT', - LIST: 'LIST', - NON_NULL: 'NON_NULL' -}); -exports.TypeKind = TypeKind; - -var __TypeKind = new _definition.GraphQLEnumType({ - name: '__TypeKind', - description: 'An enum describing what kind of type a given `__Type` is.', - values: { - SCALAR: { - value: TypeKind.SCALAR, - description: 'Indicates this type is a scalar.' - }, - OBJECT: { - value: TypeKind.OBJECT, - description: 'Indicates this type is an object. `fields` and `interfaces` are valid fields.' - }, - INTERFACE: { - value: TypeKind.INTERFACE, - description: 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.' - }, - UNION: { - value: TypeKind.UNION, - description: 'Indicates this type is a union. `possibleTypes` is a valid field.' - }, - ENUM: { - value: TypeKind.ENUM, - description: 'Indicates this type is an enum. `enumValues` is a valid field.' - }, - INPUT_OBJECT: { - value: TypeKind.INPUT_OBJECT, - description: 'Indicates this type is an input object. `inputFields` is a valid field.' - }, - LIST: { - value: TypeKind.LIST, - description: 'Indicates this type is a list. `ofType` is a valid field.' - }, - NON_NULL: { - value: TypeKind.NON_NULL, - description: 'Indicates this type is a non-null. `ofType` is a valid field.' - } - } -}); -/** - * Note that these are GraphQLField and not GraphQLFieldConfig, - * so the format for args is different. - */ - - -exports.__TypeKind = __TypeKind; -var SchemaMetaFieldDef = { - name: '__schema', - type: new _definition.GraphQLNonNull(__Schema), - description: 'Access the current type schema of this server.', - args: [], - resolve: function resolve(_source, _args, _context, _ref6) { - var schema = _ref6.schema; - return schema; - }, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined -}; -exports.SchemaMetaFieldDef = SchemaMetaFieldDef; -var TypeMetaFieldDef = { - name: '__type', - type: __Type, - description: 'Request the type information of a single type.', - args: [{ - name: 'name', - description: undefined, - type: new _definition.GraphQLNonNull(_scalars.GraphQLString), - defaultValue: undefined, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined - }], - resolve: function resolve(_source, _ref7, _context, _ref8) { - var name = _ref7.name; - var schema = _ref8.schema; - return schema.getType(name); - }, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined -}; -exports.TypeMetaFieldDef = TypeMetaFieldDef; -var TypeNameMetaFieldDef = { - name: '__typename', - type: new _definition.GraphQLNonNull(_scalars.GraphQLString), - description: 'The name of the current Object type at runtime.', - args: [], - resolve: function resolve(_source, _args, _context, _ref9) { - var parentType = _ref9.parentType; - return parentType.name; - }, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined -}; -exports.TypeNameMetaFieldDef = TypeNameMetaFieldDef; -var introspectionTypes = Object.freeze([__Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind]); -exports.introspectionTypes = introspectionTypes; - -function isIntrospectionType(type) { - return introspectionTypes.some(function (_ref10) { - var name = _ref10.name; - return type.name === name; - }); -} diff --git a/node_modules/graphql/type/introspection.js.flow b/node_modules/graphql/type/introspection.js.flow deleted file mode 100644 index 5077e8ba..00000000 --- a/node_modules/graphql/type/introspection.js.flow +++ /dev/null @@ -1,550 +0,0 @@ -// @flow strict -import objectValues from '../polyfills/objectValues'; - -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; - -import { print } from '../language/printer'; -import { DirectiveLocation } from '../language/directiveLocation'; -import { astFromValue } from '../utilities/astFromValue'; - -import type { GraphQLSchema } from './schema'; -import type { GraphQLDirective } from './directives'; -import type { - GraphQLType, - GraphQLNamedType, - GraphQLInputField, - GraphQLEnumValue, - GraphQLField, - GraphQLFieldConfigMap, -} from './definition'; -import { GraphQLString, GraphQLBoolean } from './scalars'; -import { - GraphQLList, - GraphQLNonNull, - GraphQLObjectType, - GraphQLEnumType, - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, - isListType, - isNonNullType, - isAbstractType, -} from './definition'; - -export const __Schema = new GraphQLObjectType({ - name: '__Schema', - description: - 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', - fields: () => - ({ - description: { - type: GraphQLString, - resolve: (schema) => schema.description, - }, - types: { - description: 'A list of all types supported by this server.', - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))), - resolve(schema) { - return objectValues(schema.getTypeMap()); - }, - }, - queryType: { - description: 'The type that query operations will be rooted at.', - type: new GraphQLNonNull(__Type), - resolve: (schema) => schema.getQueryType(), - }, - mutationType: { - description: - 'If this server supports mutation, the type that mutation operations will be rooted at.', - type: __Type, - resolve: (schema) => schema.getMutationType(), - }, - subscriptionType: { - description: - 'If this server support subscription, the type that subscription operations will be rooted at.', - type: __Type, - resolve: (schema) => schema.getSubscriptionType(), - }, - directives: { - description: 'A list of all directives supported by this server.', - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__Directive)), - ), - resolve: (schema) => schema.getDirectives(), - }, - }: GraphQLFieldConfigMap), -}); - -export const __Directive = new GraphQLObjectType({ - name: '__Directive', - description: - "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - fields: () => - ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (directive) => directive.name, - }, - description: { - type: GraphQLString, - resolve: (directive) => directive.description, - }, - isRepeatable: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (directive) => directive.isRepeatable, - }, - locations: { - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__DirectiveLocation)), - ), - resolve: (directive) => directive.locations, - }, - args: { - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__InputValue)), - ), - resolve: (directive) => directive.args, - }, - }: GraphQLFieldConfigMap), -}); - -export const __DirectiveLocation = new GraphQLEnumType({ - name: '__DirectiveLocation', - description: - 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', - values: { - QUERY: { - value: DirectiveLocation.QUERY, - description: 'Location adjacent to a query operation.', - }, - MUTATION: { - value: DirectiveLocation.MUTATION, - description: 'Location adjacent to a mutation operation.', - }, - SUBSCRIPTION: { - value: DirectiveLocation.SUBSCRIPTION, - description: 'Location adjacent to a subscription operation.', - }, - FIELD: { - value: DirectiveLocation.FIELD, - description: 'Location adjacent to a field.', - }, - FRAGMENT_DEFINITION: { - value: DirectiveLocation.FRAGMENT_DEFINITION, - description: 'Location adjacent to a fragment definition.', - }, - FRAGMENT_SPREAD: { - value: DirectiveLocation.FRAGMENT_SPREAD, - description: 'Location adjacent to a fragment spread.', - }, - INLINE_FRAGMENT: { - value: DirectiveLocation.INLINE_FRAGMENT, - description: 'Location adjacent to an inline fragment.', - }, - VARIABLE_DEFINITION: { - value: DirectiveLocation.VARIABLE_DEFINITION, - description: 'Location adjacent to a variable definition.', - }, - SCHEMA: { - value: DirectiveLocation.SCHEMA, - description: 'Location adjacent to a schema definition.', - }, - SCALAR: { - value: DirectiveLocation.SCALAR, - description: 'Location adjacent to a scalar definition.', - }, - OBJECT: { - value: DirectiveLocation.OBJECT, - description: 'Location adjacent to an object type definition.', - }, - FIELD_DEFINITION: { - value: DirectiveLocation.FIELD_DEFINITION, - description: 'Location adjacent to a field definition.', - }, - ARGUMENT_DEFINITION: { - value: DirectiveLocation.ARGUMENT_DEFINITION, - description: 'Location adjacent to an argument definition.', - }, - INTERFACE: { - value: DirectiveLocation.INTERFACE, - description: 'Location adjacent to an interface definition.', - }, - UNION: { - value: DirectiveLocation.UNION, - description: 'Location adjacent to a union definition.', - }, - ENUM: { - value: DirectiveLocation.ENUM, - description: 'Location adjacent to an enum definition.', - }, - ENUM_VALUE: { - value: DirectiveLocation.ENUM_VALUE, - description: 'Location adjacent to an enum value definition.', - }, - INPUT_OBJECT: { - value: DirectiveLocation.INPUT_OBJECT, - description: 'Location adjacent to an input object type definition.', - }, - INPUT_FIELD_DEFINITION: { - value: DirectiveLocation.INPUT_FIELD_DEFINITION, - description: 'Location adjacent to an input object field definition.', - }, - }, -}); - -export const __Type = new GraphQLObjectType({ - name: '__Type', - description: - 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', - fields: () => - ({ - kind: { - type: new GraphQLNonNull(__TypeKind), - resolve(type) { - if (isScalarType(type)) { - return TypeKind.SCALAR; - } - if (isObjectType(type)) { - return TypeKind.OBJECT; - } - if (isInterfaceType(type)) { - return TypeKind.INTERFACE; - } - if (isUnionType(type)) { - return TypeKind.UNION; - } - if (isEnumType(type)) { - return TypeKind.ENUM; - } - if (isInputObjectType(type)) { - return TypeKind.INPUT_OBJECT; - } - if (isListType(type)) { - return TypeKind.LIST; - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isNonNullType(type)) { - return TypeKind.NON_NULL; - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, `Unexpected type: "${inspect((type: empty))}".`); - }, - }, - name: { - type: GraphQLString, - resolve: (type) => (type.name !== undefined ? type.name : undefined), - }, - description: { - type: GraphQLString, - resolve: (type) => - type.description !== undefined ? type.description : undefined, - }, - specifiedByUrl: { - type: GraphQLString, - resolve: (obj) => - obj.specifiedByUrl !== undefined ? obj.specifiedByUrl : undefined, - }, - fields: { - type: new GraphQLList(new GraphQLNonNull(__Field)), - args: { - includeDeprecated: { type: GraphQLBoolean, defaultValue: false }, - }, - resolve(type, { includeDeprecated }) { - if (isObjectType(type) || isInterfaceType(type)) { - const fields = objectValues(type.getFields()); - return includeDeprecated - ? fields - : fields.filter((field) => field.deprecationReason == null); - } - }, - }, - interfaces: { - type: new GraphQLList(new GraphQLNonNull(__Type)), - resolve(type) { - if (isObjectType(type) || isInterfaceType(type)) { - return type.getInterfaces(); - } - }, - }, - possibleTypes: { - type: new GraphQLList(new GraphQLNonNull(__Type)), - resolve(type, _args, _context, { schema }) { - if (isAbstractType(type)) { - return schema.getPossibleTypes(type); - } - }, - }, - enumValues: { - type: new GraphQLList(new GraphQLNonNull(__EnumValue)), - args: { - includeDeprecated: { type: GraphQLBoolean, defaultValue: false }, - }, - resolve(type, { includeDeprecated }) { - if (isEnumType(type)) { - const values = type.getValues(); - return includeDeprecated - ? values - : values.filter((field) => field.deprecationReason == null); - } - }, - }, - inputFields: { - type: new GraphQLList(new GraphQLNonNull(__InputValue)), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false, - }, - }, - resolve(type, { includeDeprecated }) { - if (isInputObjectType(type)) { - const values = objectValues(type.getFields()); - return includeDeprecated - ? values - : values.filter((field) => field.deprecationReason == null); - } - }, - }, - ofType: { - type: __Type, - resolve: (type) => - type.ofType !== undefined ? type.ofType : undefined, - }, - }: GraphQLFieldConfigMap), -}); - -export const __Field = new GraphQLObjectType({ - name: '__Field', - description: - 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', - fields: () => - ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (field) => field.name, - }, - description: { - type: GraphQLString, - resolve: (field) => field.description, - }, - args: { - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__InputValue)), - ), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false, - }, - }, - resolve(field, { includeDeprecated }) { - return includeDeprecated - ? field.args - : field.args.filter((arg) => arg.deprecationReason == null); - }, - }, - type: { - type: new GraphQLNonNull(__Type), - resolve: (field) => field.type, - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (field) => field.deprecationReason != null, - }, - deprecationReason: { - type: GraphQLString, - resolve: (field) => field.deprecationReason, - }, - }: GraphQLFieldConfigMap, mixed>), -}); - -export const __InputValue = new GraphQLObjectType({ - name: '__InputValue', - description: - 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', - fields: () => - ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (inputValue) => inputValue.name, - }, - description: { - type: GraphQLString, - resolve: (inputValue) => inputValue.description, - }, - type: { - type: new GraphQLNonNull(__Type), - resolve: (inputValue) => inputValue.type, - }, - defaultValue: { - type: GraphQLString, - description: - 'A GraphQL-formatted string representing the default value for this input value.', - resolve(inputValue) { - const { type, defaultValue } = inputValue; - const valueAST = astFromValue(defaultValue, type); - return valueAST ? print(valueAST) : null; - }, - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (field) => field.deprecationReason != null, - }, - deprecationReason: { - type: GraphQLString, - resolve: (obj) => obj.deprecationReason, - }, - }: GraphQLFieldConfigMap), -}); - -export const __EnumValue = new GraphQLObjectType({ - name: '__EnumValue', - description: - 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', - fields: () => - ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (enumValue) => enumValue.name, - }, - description: { - type: GraphQLString, - resolve: (enumValue) => enumValue.description, - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (enumValue) => enumValue.deprecationReason != null, - }, - deprecationReason: { - type: GraphQLString, - resolve: (enumValue) => enumValue.deprecationReason, - }, - }: GraphQLFieldConfigMap), -}); - -export const TypeKind = Object.freeze({ - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - INPUT_OBJECT: 'INPUT_OBJECT', - LIST: 'LIST', - NON_NULL: 'NON_NULL', -}); - -export const __TypeKind = new GraphQLEnumType({ - name: '__TypeKind', - description: 'An enum describing what kind of type a given `__Type` is.', - values: { - SCALAR: { - value: TypeKind.SCALAR, - description: 'Indicates this type is a scalar.', - }, - OBJECT: { - value: TypeKind.OBJECT, - description: - 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', - }, - INTERFACE: { - value: TypeKind.INTERFACE, - description: - 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.', - }, - UNION: { - value: TypeKind.UNION, - description: - 'Indicates this type is a union. `possibleTypes` is a valid field.', - }, - ENUM: { - value: TypeKind.ENUM, - description: - 'Indicates this type is an enum. `enumValues` is a valid field.', - }, - INPUT_OBJECT: { - value: TypeKind.INPUT_OBJECT, - description: - 'Indicates this type is an input object. `inputFields` is a valid field.', - }, - LIST: { - value: TypeKind.LIST, - description: 'Indicates this type is a list. `ofType` is a valid field.', - }, - NON_NULL: { - value: TypeKind.NON_NULL, - description: - 'Indicates this type is a non-null. `ofType` is a valid field.', - }, - }, -}); - -/** - * Note that these are GraphQLField and not GraphQLFieldConfig, - * so the format for args is different. - */ - -export const SchemaMetaFieldDef: GraphQLField = { - name: '__schema', - type: new GraphQLNonNull(__Schema), - description: 'Access the current type schema of this server.', - args: [], - resolve: (_source, _args, _context, { schema }) => schema, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined, -}; - -export const TypeMetaFieldDef: GraphQLField = { - name: '__type', - type: __Type, - description: 'Request the type information of a single type.', - args: [ - { - name: 'name', - description: undefined, - type: new GraphQLNonNull(GraphQLString), - defaultValue: undefined, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined, - }, - ], - resolve: (_source, { name }, _context, { schema }) => schema.getType(name), - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined, -}; - -export const TypeNameMetaFieldDef: GraphQLField = { - name: '__typename', - type: new GraphQLNonNull(GraphQLString), - description: 'The name of the current Object type at runtime.', - args: [], - resolve: (_source, _args, _context, { parentType }) => parentType.name, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined, -}; - -export const introspectionTypes = Object.freeze([ - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, -]); - -export function isIntrospectionType(type: GraphQLNamedType): boolean %checks { - return introspectionTypes.some(({ name }) => type.name === name); -} diff --git a/node_modules/graphql/type/introspection.mjs b/node_modules/graphql/type/introspection.mjs deleted file mode 100644 index 772ce864..00000000 --- a/node_modules/graphql/type/introspection.mjs +++ /dev/null @@ -1,568 +0,0 @@ -import objectValues from "../polyfills/objectValues.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import { print } from "../language/printer.mjs"; -import { DirectiveLocation } from "../language/directiveLocation.mjs"; -import { astFromValue } from "../utilities/astFromValue.mjs"; -import { GraphQLString, GraphQLBoolean } from "./scalars.mjs"; -import { GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLEnumType, isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isListType, isNonNullType, isAbstractType } from "./definition.mjs"; -export var __Schema = new GraphQLObjectType({ - name: '__Schema', - description: 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', - fields: function fields() { - return { - description: { - type: GraphQLString, - resolve: function resolve(schema) { - return schema.description; - } - }, - types: { - description: 'A list of all types supported by this server.', - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))), - resolve: function resolve(schema) { - return objectValues(schema.getTypeMap()); - } - }, - queryType: { - description: 'The type that query operations will be rooted at.', - type: new GraphQLNonNull(__Type), - resolve: function resolve(schema) { - return schema.getQueryType(); - } - }, - mutationType: { - description: 'If this server supports mutation, the type that mutation operations will be rooted at.', - type: __Type, - resolve: function resolve(schema) { - return schema.getMutationType(); - } - }, - subscriptionType: { - description: 'If this server support subscription, the type that subscription operations will be rooted at.', - type: __Type, - resolve: function resolve(schema) { - return schema.getSubscriptionType(); - } - }, - directives: { - description: 'A list of all directives supported by this server.', - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Directive))), - resolve: function resolve(schema) { - return schema.getDirectives(); - } - } - }; - } -}); -export var __Directive = new GraphQLObjectType({ - name: '__Directive', - description: "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - fields: function fields() { - return { - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: function resolve(directive) { - return directive.name; - } - }, - description: { - type: GraphQLString, - resolve: function resolve(directive) { - return directive.description; - } - }, - isRepeatable: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: function resolve(directive) { - return directive.isRepeatable; - } - }, - locations: { - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__DirectiveLocation))), - resolve: function resolve(directive) { - return directive.locations; - } - }, - args: { - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))), - resolve: function resolve(directive) { - return directive.args; - } - } - }; - } -}); -export var __DirectiveLocation = new GraphQLEnumType({ - name: '__DirectiveLocation', - description: 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', - values: { - QUERY: { - value: DirectiveLocation.QUERY, - description: 'Location adjacent to a query operation.' - }, - MUTATION: { - value: DirectiveLocation.MUTATION, - description: 'Location adjacent to a mutation operation.' - }, - SUBSCRIPTION: { - value: DirectiveLocation.SUBSCRIPTION, - description: 'Location adjacent to a subscription operation.' - }, - FIELD: { - value: DirectiveLocation.FIELD, - description: 'Location adjacent to a field.' - }, - FRAGMENT_DEFINITION: { - value: DirectiveLocation.FRAGMENT_DEFINITION, - description: 'Location adjacent to a fragment definition.' - }, - FRAGMENT_SPREAD: { - value: DirectiveLocation.FRAGMENT_SPREAD, - description: 'Location adjacent to a fragment spread.' - }, - INLINE_FRAGMENT: { - value: DirectiveLocation.INLINE_FRAGMENT, - description: 'Location adjacent to an inline fragment.' - }, - VARIABLE_DEFINITION: { - value: DirectiveLocation.VARIABLE_DEFINITION, - description: 'Location adjacent to a variable definition.' - }, - SCHEMA: { - value: DirectiveLocation.SCHEMA, - description: 'Location adjacent to a schema definition.' - }, - SCALAR: { - value: DirectiveLocation.SCALAR, - description: 'Location adjacent to a scalar definition.' - }, - OBJECT: { - value: DirectiveLocation.OBJECT, - description: 'Location adjacent to an object type definition.' - }, - FIELD_DEFINITION: { - value: DirectiveLocation.FIELD_DEFINITION, - description: 'Location adjacent to a field definition.' - }, - ARGUMENT_DEFINITION: { - value: DirectiveLocation.ARGUMENT_DEFINITION, - description: 'Location adjacent to an argument definition.' - }, - INTERFACE: { - value: DirectiveLocation.INTERFACE, - description: 'Location adjacent to an interface definition.' - }, - UNION: { - value: DirectiveLocation.UNION, - description: 'Location adjacent to a union definition.' - }, - ENUM: { - value: DirectiveLocation.ENUM, - description: 'Location adjacent to an enum definition.' - }, - ENUM_VALUE: { - value: DirectiveLocation.ENUM_VALUE, - description: 'Location adjacent to an enum value definition.' - }, - INPUT_OBJECT: { - value: DirectiveLocation.INPUT_OBJECT, - description: 'Location adjacent to an input object type definition.' - }, - INPUT_FIELD_DEFINITION: { - value: DirectiveLocation.INPUT_FIELD_DEFINITION, - description: 'Location adjacent to an input object field definition.' - } - } -}); -export var __Type = new GraphQLObjectType({ - name: '__Type', - description: 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', - fields: function fields() { - return { - kind: { - type: new GraphQLNonNull(__TypeKind), - resolve: function resolve(type) { - if (isScalarType(type)) { - return TypeKind.SCALAR; - } - - if (isObjectType(type)) { - return TypeKind.OBJECT; - } - - if (isInterfaceType(type)) { - return TypeKind.INTERFACE; - } - - if (isUnionType(type)) { - return TypeKind.UNION; - } - - if (isEnumType(type)) { - return TypeKind.ENUM; - } - - if (isInputObjectType(type)) { - return TypeKind.INPUT_OBJECT; - } - - if (isListType(type)) { - return TypeKind.LIST; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isNonNullType(type)) { - return TypeKind.NON_NULL; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, "Unexpected type: \"".concat(inspect(type), "\".")); - } - }, - name: { - type: GraphQLString, - resolve: function resolve(type) { - return type.name !== undefined ? type.name : undefined; - } - }, - description: { - type: GraphQLString, - resolve: function resolve(type) { - return type.description !== undefined ? type.description : undefined; - } - }, - specifiedByUrl: { - type: GraphQLString, - resolve: function resolve(obj) { - return obj.specifiedByUrl !== undefined ? obj.specifiedByUrl : undefined; - } - }, - fields: { - type: new GraphQLList(new GraphQLNonNull(__Field)), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(type, _ref) { - var includeDeprecated = _ref.includeDeprecated; - - if (isObjectType(type) || isInterfaceType(type)) { - var fields = objectValues(type.getFields()); - return includeDeprecated ? fields : fields.filter(function (field) { - return field.deprecationReason == null; - }); - } - } - }, - interfaces: { - type: new GraphQLList(new GraphQLNonNull(__Type)), - resolve: function resolve(type) { - if (isObjectType(type) || isInterfaceType(type)) { - return type.getInterfaces(); - } - } - }, - possibleTypes: { - type: new GraphQLList(new GraphQLNonNull(__Type)), - resolve: function resolve(type, _args, _context, _ref2) { - var schema = _ref2.schema; - - if (isAbstractType(type)) { - return schema.getPossibleTypes(type); - } - } - }, - enumValues: { - type: new GraphQLList(new GraphQLNonNull(__EnumValue)), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(type, _ref3) { - var includeDeprecated = _ref3.includeDeprecated; - - if (isEnumType(type)) { - var values = type.getValues(); - return includeDeprecated ? values : values.filter(function (field) { - return field.deprecationReason == null; - }); - } - } - }, - inputFields: { - type: new GraphQLList(new GraphQLNonNull(__InputValue)), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(type, _ref4) { - var includeDeprecated = _ref4.includeDeprecated; - - if (isInputObjectType(type)) { - var values = objectValues(type.getFields()); - return includeDeprecated ? values : values.filter(function (field) { - return field.deprecationReason == null; - }); - } - } - }, - ofType: { - type: __Type, - resolve: function resolve(type) { - return type.ofType !== undefined ? type.ofType : undefined; - } - } - }; - } -}); -export var __Field = new GraphQLObjectType({ - name: '__Field', - description: 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', - fields: function fields() { - return { - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: function resolve(field) { - return field.name; - } - }, - description: { - type: GraphQLString, - resolve: function resolve(field) { - return field.description; - } - }, - args: { - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve: function resolve(field, _ref5) { - var includeDeprecated = _ref5.includeDeprecated; - return includeDeprecated ? field.args : field.args.filter(function (arg) { - return arg.deprecationReason == null; - }); - } - }, - type: { - type: new GraphQLNonNull(__Type), - resolve: function resolve(field) { - return field.type; - } - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: function resolve(field) { - return field.deprecationReason != null; - } - }, - deprecationReason: { - type: GraphQLString, - resolve: function resolve(field) { - return field.deprecationReason; - } - } - }; - } -}); -export var __InputValue = new GraphQLObjectType({ - name: '__InputValue', - description: 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', - fields: function fields() { - return { - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: function resolve(inputValue) { - return inputValue.name; - } - }, - description: { - type: GraphQLString, - resolve: function resolve(inputValue) { - return inputValue.description; - } - }, - type: { - type: new GraphQLNonNull(__Type), - resolve: function resolve(inputValue) { - return inputValue.type; - } - }, - defaultValue: { - type: GraphQLString, - description: 'A GraphQL-formatted string representing the default value for this input value.', - resolve: function resolve(inputValue) { - var type = inputValue.type, - defaultValue = inputValue.defaultValue; - var valueAST = astFromValue(defaultValue, type); - return valueAST ? print(valueAST) : null; - } - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: function resolve(field) { - return field.deprecationReason != null; - } - }, - deprecationReason: { - type: GraphQLString, - resolve: function resolve(obj) { - return obj.deprecationReason; - } - } - }; - } -}); -export var __EnumValue = new GraphQLObjectType({ - name: '__EnumValue', - description: 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', - fields: function fields() { - return { - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: function resolve(enumValue) { - return enumValue.name; - } - }, - description: { - type: GraphQLString, - resolve: function resolve(enumValue) { - return enumValue.description; - } - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: function resolve(enumValue) { - return enumValue.deprecationReason != null; - } - }, - deprecationReason: { - type: GraphQLString, - resolve: function resolve(enumValue) { - return enumValue.deprecationReason; - } - } - }; - } -}); -export var TypeKind = Object.freeze({ - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - INPUT_OBJECT: 'INPUT_OBJECT', - LIST: 'LIST', - NON_NULL: 'NON_NULL' -}); -export var __TypeKind = new GraphQLEnumType({ - name: '__TypeKind', - description: 'An enum describing what kind of type a given `__Type` is.', - values: { - SCALAR: { - value: TypeKind.SCALAR, - description: 'Indicates this type is a scalar.' - }, - OBJECT: { - value: TypeKind.OBJECT, - description: 'Indicates this type is an object. `fields` and `interfaces` are valid fields.' - }, - INTERFACE: { - value: TypeKind.INTERFACE, - description: 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.' - }, - UNION: { - value: TypeKind.UNION, - description: 'Indicates this type is a union. `possibleTypes` is a valid field.' - }, - ENUM: { - value: TypeKind.ENUM, - description: 'Indicates this type is an enum. `enumValues` is a valid field.' - }, - INPUT_OBJECT: { - value: TypeKind.INPUT_OBJECT, - description: 'Indicates this type is an input object. `inputFields` is a valid field.' - }, - LIST: { - value: TypeKind.LIST, - description: 'Indicates this type is a list. `ofType` is a valid field.' - }, - NON_NULL: { - value: TypeKind.NON_NULL, - description: 'Indicates this type is a non-null. `ofType` is a valid field.' - } - } -}); -/** - * Note that these are GraphQLField and not GraphQLFieldConfig, - * so the format for args is different. - */ - -export var SchemaMetaFieldDef = { - name: '__schema', - type: new GraphQLNonNull(__Schema), - description: 'Access the current type schema of this server.', - args: [], - resolve: function resolve(_source, _args, _context, _ref6) { - var schema = _ref6.schema; - return schema; - }, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined -}; -export var TypeMetaFieldDef = { - name: '__type', - type: __Type, - description: 'Request the type information of a single type.', - args: [{ - name: 'name', - description: undefined, - type: new GraphQLNonNull(GraphQLString), - defaultValue: undefined, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined - }], - resolve: function resolve(_source, _ref7, _context, _ref8) { - var name = _ref7.name; - var schema = _ref8.schema; - return schema.getType(name); - }, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined -}; -export var TypeNameMetaFieldDef = { - name: '__typename', - type: new GraphQLNonNull(GraphQLString), - description: 'The name of the current Object type at runtime.', - args: [], - resolve: function resolve(_source, _args, _context, _ref9) { - var parentType = _ref9.parentType; - return parentType.name; - }, - isDeprecated: false, - deprecationReason: undefined, - extensions: undefined, - astNode: undefined -}; -export var introspectionTypes = Object.freeze([__Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind]); -export function isIntrospectionType(type) { - return introspectionTypes.some(function (_ref10) { - var name = _ref10.name; - return type.name === name; - }); -} diff --git a/node_modules/graphql/type/scalars.d.ts b/node_modules/graphql/type/scalars.d.ts deleted file mode 100644 index 71593d10..00000000 --- a/node_modules/graphql/type/scalars.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { GraphQLScalarType, GraphQLNamedType } from './definition'; - -export const GraphQLInt: GraphQLScalarType; -export const GraphQLFloat: GraphQLScalarType; -export const GraphQLString: GraphQLScalarType; -export const GraphQLBoolean: GraphQLScalarType; -export const GraphQLID: GraphQLScalarType; - -export const specifiedScalarTypes: ReadonlyArray; - -export function isSpecifiedScalarType(type: GraphQLNamedType): boolean; diff --git a/node_modules/graphql/type/scalars.js b/node_modules/graphql/type/scalars.js deleted file mode 100644 index ca1f35b5..00000000 --- a/node_modules/graphql/type/scalars.js +++ /dev/null @@ -1,284 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isSpecifiedScalarType = isSpecifiedScalarType; -exports.specifiedScalarTypes = exports.GraphQLID = exports.GraphQLBoolean = exports.GraphQLString = exports.GraphQLFloat = exports.GraphQLInt = void 0; - -var _isFinite = _interopRequireDefault(require("../polyfills/isFinite.js")); - -var _isInteger = _interopRequireDefault(require("../polyfills/isInteger.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _kinds = require("../language/kinds.js"); - -var _printer = require("../language/printer.js"); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _definition = require("./definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// As per the GraphQL Spec, Integers are only treated as valid when a valid -// 32-bit signed integer, providing the broadest support across platforms. -// -// n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because -// they are internally represented as IEEE 754 doubles. -var MAX_INT = 2147483647; -var MIN_INT = -2147483648; - -function serializeInt(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 1 : 0; - } - - var num = coercedValue; - - if (typeof coercedValue === 'string' && coercedValue !== '') { - num = Number(coercedValue); - } - - if (!(0, _isInteger.default)(num)) { - throw new _GraphQLError.GraphQLError("Int cannot represent non-integer value: ".concat((0, _inspect.default)(coercedValue))); - } - - if (num > MAX_INT || num < MIN_INT) { - throw new _GraphQLError.GraphQLError('Int cannot represent non 32-bit signed integer value: ' + (0, _inspect.default)(coercedValue)); - } - - return num; -} - -function coerceInt(inputValue) { - if (!(0, _isInteger.default)(inputValue)) { - throw new _GraphQLError.GraphQLError("Int cannot represent non-integer value: ".concat((0, _inspect.default)(inputValue))); - } - - if (inputValue > MAX_INT || inputValue < MIN_INT) { - throw new _GraphQLError.GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(inputValue)); - } - - return inputValue; -} - -var GraphQLInt = new _definition.GraphQLScalarType({ - name: 'Int', - description: 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', - serialize: serializeInt, - parseValue: coerceInt, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== _kinds.Kind.INT) { - throw new _GraphQLError.GraphQLError("Int cannot represent non-integer value: ".concat((0, _printer.print)(valueNode)), valueNode); - } - - var num = parseInt(valueNode.value, 10); - - if (num > MAX_INT || num < MIN_INT) { - throw new _GraphQLError.GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(valueNode.value), valueNode); - } - - return num; - } -}); -exports.GraphQLInt = GraphQLInt; - -function serializeFloat(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 1 : 0; - } - - var num = coercedValue; - - if (typeof coercedValue === 'string' && coercedValue !== '') { - num = Number(coercedValue); - } - - if (!(0, _isFinite.default)(num)) { - throw new _GraphQLError.GraphQLError("Float cannot represent non numeric value: ".concat((0, _inspect.default)(coercedValue))); - } - - return num; -} - -function coerceFloat(inputValue) { - if (!(0, _isFinite.default)(inputValue)) { - throw new _GraphQLError.GraphQLError("Float cannot represent non numeric value: ".concat((0, _inspect.default)(inputValue))); - } - - return inputValue; -} - -var GraphQLFloat = new _definition.GraphQLScalarType({ - name: 'Float', - description: 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', - serialize: serializeFloat, - parseValue: coerceFloat, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== _kinds.Kind.FLOAT && valueNode.kind !== _kinds.Kind.INT) { - throw new _GraphQLError.GraphQLError("Float cannot represent non numeric value: ".concat((0, _printer.print)(valueNode)), valueNode); - } - - return parseFloat(valueNode.value); - } -}); // Support serializing objects with custom valueOf() or toJSON() functions - -// a common way to represent a complex value which can be represented as -// a string (ex: MongoDB id objects). - -exports.GraphQLFloat = GraphQLFloat; - -function serializeObject(outputValue) { - if ((0, _isObjectLike.default)(outputValue)) { - if (typeof outputValue.valueOf === 'function') { - var valueOfResult = outputValue.valueOf(); - - if (!(0, _isObjectLike.default)(valueOfResult)) { - return valueOfResult; - } - } - - if (typeof outputValue.toJSON === 'function') { - // $FlowFixMe[incompatible-use] - return outputValue.toJSON(); - } - } - - return outputValue; -} - -function serializeString(outputValue) { - var coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not - // attempt to coerce object, function, symbol, or other types as strings. - - if (typeof coercedValue === 'string') { - return coercedValue; - } - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 'true' : 'false'; - } - - if ((0, _isFinite.default)(coercedValue)) { - return coercedValue.toString(); - } - - throw new _GraphQLError.GraphQLError("String cannot represent value: ".concat((0, _inspect.default)(outputValue))); -} - -function coerceString(inputValue) { - if (typeof inputValue !== 'string') { - throw new _GraphQLError.GraphQLError("String cannot represent a non string value: ".concat((0, _inspect.default)(inputValue))); - } - - return inputValue; -} - -var GraphQLString = new _definition.GraphQLScalarType({ - name: 'String', - description: 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', - serialize: serializeString, - parseValue: coerceString, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== _kinds.Kind.STRING) { - throw new _GraphQLError.GraphQLError("String cannot represent a non string value: ".concat((0, _printer.print)(valueNode)), valueNode); - } - - return valueNode.value; - } -}); -exports.GraphQLString = GraphQLString; - -function serializeBoolean(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue; - } - - if ((0, _isFinite.default)(coercedValue)) { - return coercedValue !== 0; - } - - throw new _GraphQLError.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0, _inspect.default)(coercedValue))); -} - -function coerceBoolean(inputValue) { - if (typeof inputValue !== 'boolean') { - throw new _GraphQLError.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0, _inspect.default)(inputValue))); - } - - return inputValue; -} - -var GraphQLBoolean = new _definition.GraphQLScalarType({ - name: 'Boolean', - description: 'The `Boolean` scalar type represents `true` or `false`.', - serialize: serializeBoolean, - parseValue: coerceBoolean, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== _kinds.Kind.BOOLEAN) { - throw new _GraphQLError.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0, _printer.print)(valueNode)), valueNode); - } - - return valueNode.value; - } -}); -exports.GraphQLBoolean = GraphQLBoolean; - -function serializeID(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'string') { - return coercedValue; - } - - if ((0, _isInteger.default)(coercedValue)) { - return String(coercedValue); - } - - throw new _GraphQLError.GraphQLError("ID cannot represent value: ".concat((0, _inspect.default)(outputValue))); -} - -function coerceID(inputValue) { - if (typeof inputValue === 'string') { - return inputValue; - } - - if ((0, _isInteger.default)(inputValue)) { - return inputValue.toString(); - } - - throw new _GraphQLError.GraphQLError("ID cannot represent value: ".concat((0, _inspect.default)(inputValue))); -} - -var GraphQLID = new _definition.GraphQLScalarType({ - name: 'ID', - description: 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', - serialize: serializeID, - parseValue: coerceID, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== _kinds.Kind.STRING && valueNode.kind !== _kinds.Kind.INT) { - throw new _GraphQLError.GraphQLError('ID cannot represent a non-string and non-integer value: ' + (0, _printer.print)(valueNode), valueNode); - } - - return valueNode.value; - } -}); -exports.GraphQLID = GraphQLID; -var specifiedScalarTypes = Object.freeze([GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBoolean, GraphQLID]); -exports.specifiedScalarTypes = specifiedScalarTypes; - -function isSpecifiedScalarType(type) { - return specifiedScalarTypes.some(function (_ref) { - var name = _ref.name; - return type.name === name; - }); -} diff --git a/node_modules/graphql/type/scalars.js.flow b/node_modules/graphql/type/scalars.js.flow deleted file mode 100644 index b72b5794..00000000 --- a/node_modules/graphql/type/scalars.js.flow +++ /dev/null @@ -1,287 +0,0 @@ -// @flow strict -import isFinite from '../polyfills/isFinite'; -import isInteger from '../polyfills/isInteger'; - -import inspect from '../jsutils/inspect'; -import isObjectLike from '../jsutils/isObjectLike'; - -import { Kind } from '../language/kinds'; -import { print } from '../language/printer'; - -import { GraphQLError } from '../error/GraphQLError'; - -import type { GraphQLNamedType } from './definition'; -import { GraphQLScalarType } from './definition'; - -// As per the GraphQL Spec, Integers are only treated as valid when a valid -// 32-bit signed integer, providing the broadest support across platforms. -// -// n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because -// they are internally represented as IEEE 754 doubles. -const MAX_INT = 2147483647; -const MIN_INT = -2147483648; - -function serializeInt(outputValue: mixed): number { - const coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 1 : 0; - } - - let num = coercedValue; - if (typeof coercedValue === 'string' && coercedValue !== '') { - num = Number(coercedValue); - } - - if (!isInteger(num)) { - throw new GraphQLError( - `Int cannot represent non-integer value: ${inspect(coercedValue)}`, - ); - } - if (num > MAX_INT || num < MIN_INT) { - throw new GraphQLError( - 'Int cannot represent non 32-bit signed integer value: ' + - inspect(coercedValue), - ); - } - return num; -} - -function coerceInt(inputValue: mixed): number { - if (!isInteger(inputValue)) { - throw new GraphQLError( - `Int cannot represent non-integer value: ${inspect(inputValue)}`, - ); - } - if (inputValue > MAX_INT || inputValue < MIN_INT) { - throw new GraphQLError( - `Int cannot represent non 32-bit signed integer value: ${inputValue}`, - ); - } - return inputValue; -} - -export const GraphQLInt = new GraphQLScalarType({ - name: 'Int', - description: - 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', - serialize: serializeInt, - parseValue: coerceInt, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.INT) { - throw new GraphQLError( - `Int cannot represent non-integer value: ${print(valueNode)}`, - valueNode, - ); - } - const num = parseInt(valueNode.value, 10); - if (num > MAX_INT || num < MIN_INT) { - throw new GraphQLError( - `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, - valueNode, - ); - } - return num; - }, -}); - -function serializeFloat(outputValue: mixed): number { - const coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 1 : 0; - } - - let num = coercedValue; - if (typeof coercedValue === 'string' && coercedValue !== '') { - num = Number(coercedValue); - } - - if (!isFinite(num)) { - throw new GraphQLError( - `Float cannot represent non numeric value: ${inspect(coercedValue)}`, - ); - } - return num; -} - -function coerceFloat(inputValue: mixed): number { - if (!isFinite(inputValue)) { - throw new GraphQLError( - `Float cannot represent non numeric value: ${inspect(inputValue)}`, - ); - } - return inputValue; -} - -export const GraphQLFloat = new GraphQLScalarType({ - name: 'Float', - description: - 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', - serialize: serializeFloat, - parseValue: coerceFloat, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) { - throw new GraphQLError( - `Float cannot represent non numeric value: ${print(valueNode)}`, - valueNode, - ); - } - return parseFloat(valueNode.value); - }, -}); - -// Support serializing objects with custom valueOf() or toJSON() functions - -// a common way to represent a complex value which can be represented as -// a string (ex: MongoDB id objects). -function serializeObject(outputValue: mixed): mixed { - if (isObjectLike(outputValue)) { - if (typeof outputValue.valueOf === 'function') { - const valueOfResult = outputValue.valueOf(); - if (!isObjectLike(valueOfResult)) { - return valueOfResult; - } - } - if (typeof outputValue.toJSON === 'function') { - // $FlowFixMe[incompatible-use] - return outputValue.toJSON(); - } - } - return outputValue; -} - -function serializeString(outputValue: mixed): string { - const coercedValue = serializeObject(outputValue); - - // Serialize string, boolean and number values to a string, but do not - // attempt to coerce object, function, symbol, or other types as strings. - if (typeof coercedValue === 'string') { - return coercedValue; - } - if (typeof coercedValue === 'boolean') { - return coercedValue ? 'true' : 'false'; - } - if (isFinite(coercedValue)) { - return coercedValue.toString(); - } - throw new GraphQLError( - `String cannot represent value: ${inspect(outputValue)}`, - ); -} - -function coerceString(inputValue: mixed): string { - if (typeof inputValue !== 'string') { - throw new GraphQLError( - `String cannot represent a non string value: ${inspect(inputValue)}`, - ); - } - return inputValue; -} - -export const GraphQLString = new GraphQLScalarType({ - name: 'String', - description: - 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', - serialize: serializeString, - parseValue: coerceString, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.STRING) { - throw new GraphQLError( - `String cannot represent a non string value: ${print(valueNode)}`, - valueNode, - ); - } - return valueNode.value; - }, -}); - -function serializeBoolean(outputValue: mixed): boolean { - const coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue; - } - if (isFinite(coercedValue)) { - return coercedValue !== 0; - } - throw new GraphQLError( - `Boolean cannot represent a non boolean value: ${inspect(coercedValue)}`, - ); -} - -function coerceBoolean(inputValue: mixed): boolean { - if (typeof inputValue !== 'boolean') { - throw new GraphQLError( - `Boolean cannot represent a non boolean value: ${inspect(inputValue)}`, - ); - } - return inputValue; -} - -export const GraphQLBoolean = new GraphQLScalarType({ - name: 'Boolean', - description: 'The `Boolean` scalar type represents `true` or `false`.', - serialize: serializeBoolean, - parseValue: coerceBoolean, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.BOOLEAN) { - throw new GraphQLError( - `Boolean cannot represent a non boolean value: ${print(valueNode)}`, - valueNode, - ); - } - return valueNode.value; - }, -}); - -function serializeID(outputValue: mixed): string { - const coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'string') { - return coercedValue; - } - if (isInteger(coercedValue)) { - return String(coercedValue); - } - throw new GraphQLError(`ID cannot represent value: ${inspect(outputValue)}`); -} - -function coerceID(inputValue: mixed): string { - if (typeof inputValue === 'string') { - return inputValue; - } - if (isInteger(inputValue)) { - return inputValue.toString(); - } - throw new GraphQLError(`ID cannot represent value: ${inspect(inputValue)}`); -} - -export const GraphQLID = new GraphQLScalarType({ - name: 'ID', - description: - 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', - serialize: serializeID, - parseValue: coerceID, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) { - throw new GraphQLError( - 'ID cannot represent a non-string and non-integer value: ' + - print(valueNode), - valueNode, - ); - } - return valueNode.value; - }, -}); - -export const specifiedScalarTypes = Object.freeze([ - GraphQLString, - GraphQLInt, - GraphQLFloat, - GraphQLBoolean, - GraphQLID, -]); - -export function isSpecifiedScalarType(type: GraphQLNamedType): boolean %checks { - return specifiedScalarTypes.some(({ name }) => type.name === name); -} diff --git a/node_modules/graphql/type/scalars.mjs b/node_modules/graphql/type/scalars.mjs deleted file mode 100644 index e6f76a05..00000000 --- a/node_modules/graphql/type/scalars.mjs +++ /dev/null @@ -1,258 +0,0 @@ -import isFinite from "../polyfills/isFinite.mjs"; -import isInteger from "../polyfills/isInteger.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { print } from "../language/printer.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { GraphQLScalarType } from "./definition.mjs"; // As per the GraphQL Spec, Integers are only treated as valid when a valid -// 32-bit signed integer, providing the broadest support across platforms. -// -// n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because -// they are internally represented as IEEE 754 doubles. - -var MAX_INT = 2147483647; -var MIN_INT = -2147483648; - -function serializeInt(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 1 : 0; - } - - var num = coercedValue; - - if (typeof coercedValue === 'string' && coercedValue !== '') { - num = Number(coercedValue); - } - - if (!isInteger(num)) { - throw new GraphQLError("Int cannot represent non-integer value: ".concat(inspect(coercedValue))); - } - - if (num > MAX_INT || num < MIN_INT) { - throw new GraphQLError('Int cannot represent non 32-bit signed integer value: ' + inspect(coercedValue)); - } - - return num; -} - -function coerceInt(inputValue) { - if (!isInteger(inputValue)) { - throw new GraphQLError("Int cannot represent non-integer value: ".concat(inspect(inputValue))); - } - - if (inputValue > MAX_INT || inputValue < MIN_INT) { - throw new GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(inputValue)); - } - - return inputValue; -} - -export var GraphQLInt = new GraphQLScalarType({ - name: 'Int', - description: 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', - serialize: serializeInt, - parseValue: coerceInt, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== Kind.INT) { - throw new GraphQLError("Int cannot represent non-integer value: ".concat(print(valueNode)), valueNode); - } - - var num = parseInt(valueNode.value, 10); - - if (num > MAX_INT || num < MIN_INT) { - throw new GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(valueNode.value), valueNode); - } - - return num; - } -}); - -function serializeFloat(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 1 : 0; - } - - var num = coercedValue; - - if (typeof coercedValue === 'string' && coercedValue !== '') { - num = Number(coercedValue); - } - - if (!isFinite(num)) { - throw new GraphQLError("Float cannot represent non numeric value: ".concat(inspect(coercedValue))); - } - - return num; -} - -function coerceFloat(inputValue) { - if (!isFinite(inputValue)) { - throw new GraphQLError("Float cannot represent non numeric value: ".concat(inspect(inputValue))); - } - - return inputValue; -} - -export var GraphQLFloat = new GraphQLScalarType({ - name: 'Float', - description: 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', - serialize: serializeFloat, - parseValue: coerceFloat, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) { - throw new GraphQLError("Float cannot represent non numeric value: ".concat(print(valueNode)), valueNode); - } - - return parseFloat(valueNode.value); - } -}); // Support serializing objects with custom valueOf() or toJSON() functions - -// a common way to represent a complex value which can be represented as -// a string (ex: MongoDB id objects). - -function serializeObject(outputValue) { - if (isObjectLike(outputValue)) { - if (typeof outputValue.valueOf === 'function') { - var valueOfResult = outputValue.valueOf(); - - if (!isObjectLike(valueOfResult)) { - return valueOfResult; - } - } - - if (typeof outputValue.toJSON === 'function') { - // $FlowFixMe[incompatible-use] - return outputValue.toJSON(); - } - } - - return outputValue; -} - -function serializeString(outputValue) { - var coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not - // attempt to coerce object, function, symbol, or other types as strings. - - if (typeof coercedValue === 'string') { - return coercedValue; - } - - if (typeof coercedValue === 'boolean') { - return coercedValue ? 'true' : 'false'; - } - - if (isFinite(coercedValue)) { - return coercedValue.toString(); - } - - throw new GraphQLError("String cannot represent value: ".concat(inspect(outputValue))); -} - -function coerceString(inputValue) { - if (typeof inputValue !== 'string') { - throw new GraphQLError("String cannot represent a non string value: ".concat(inspect(inputValue))); - } - - return inputValue; -} - -export var GraphQLString = new GraphQLScalarType({ - name: 'String', - description: 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', - serialize: serializeString, - parseValue: coerceString, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== Kind.STRING) { - throw new GraphQLError("String cannot represent a non string value: ".concat(print(valueNode)), valueNode); - } - - return valueNode.value; - } -}); - -function serializeBoolean(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'boolean') { - return coercedValue; - } - - if (isFinite(coercedValue)) { - return coercedValue !== 0; - } - - throw new GraphQLError("Boolean cannot represent a non boolean value: ".concat(inspect(coercedValue))); -} - -function coerceBoolean(inputValue) { - if (typeof inputValue !== 'boolean') { - throw new GraphQLError("Boolean cannot represent a non boolean value: ".concat(inspect(inputValue))); - } - - return inputValue; -} - -export var GraphQLBoolean = new GraphQLScalarType({ - name: 'Boolean', - description: 'The `Boolean` scalar type represents `true` or `false`.', - serialize: serializeBoolean, - parseValue: coerceBoolean, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== Kind.BOOLEAN) { - throw new GraphQLError("Boolean cannot represent a non boolean value: ".concat(print(valueNode)), valueNode); - } - - return valueNode.value; - } -}); - -function serializeID(outputValue) { - var coercedValue = serializeObject(outputValue); - - if (typeof coercedValue === 'string') { - return coercedValue; - } - - if (isInteger(coercedValue)) { - return String(coercedValue); - } - - throw new GraphQLError("ID cannot represent value: ".concat(inspect(outputValue))); -} - -function coerceID(inputValue) { - if (typeof inputValue === 'string') { - return inputValue; - } - - if (isInteger(inputValue)) { - return inputValue.toString(); - } - - throw new GraphQLError("ID cannot represent value: ".concat(inspect(inputValue))); -} - -export var GraphQLID = new GraphQLScalarType({ - name: 'ID', - description: 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', - serialize: serializeID, - parseValue: coerceID, - parseLiteral: function parseLiteral(valueNode) { - if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) { - throw new GraphQLError('ID cannot represent a non-string and non-integer value: ' + print(valueNode), valueNode); - } - - return valueNode.value; - } -}); -export var specifiedScalarTypes = Object.freeze([GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBoolean, GraphQLID]); -export function isSpecifiedScalarType(type) { - return specifiedScalarTypes.some(function (_ref) { - var name = _ref.name; - return type.name === name; - }); -} diff --git a/node_modules/graphql/type/schema.d.ts b/node_modules/graphql/type/schema.d.ts deleted file mode 100644 index 4f759f9f..00000000 --- a/node_modules/graphql/type/schema.d.ts +++ /dev/null @@ -1,147 +0,0 @@ -// FIXME -/* eslint-disable import/no-cycle */ - -import { Maybe } from '../jsutils/Maybe'; - -import { SchemaDefinitionNode, SchemaExtensionNode } from '../language/ast'; - -import { GraphQLDirective } from './directives'; -import { - GraphQLNamedType, - GraphQLAbstractType, - GraphQLObjectType, - GraphQLInterfaceType, -} from './definition'; - -/** - * Test if the given value is a GraphQL schema. - */ -export function isSchema(schema: any): schema is GraphQLSchema; -export function assertSchema(schema: any): GraphQLSchema; - -/** - * Custom extensions - * - * @remarks - * Use a unique identifier name for your extension, for example the name of - * your library or project. Do not use a shortened identifier as this increases - * the risk of conflicts. We recommend you add at most one extension field, - * an object which can contain all the values you need. - */ -export interface GraphQLSchemaExtensions { - [attributeName: string]: any; -} - -/** - * Schema Definition - * - * A Schema is created by supplying the root types of each type of operation, - * query and mutation (optional). A schema definition is then supplied to the - * validator and executor. - * - * Example: - * - * const MyAppSchema = new GraphQLSchema({ - * query: MyAppQueryRootType, - * mutation: MyAppMutationRootType, - * }) - * - * Note: If an array of `directives` are provided to GraphQLSchema, that will be - * the exact list of directives represented and allowed. If `directives` is not - * provided then a default set of the specified directives (e.g. @include and - * @skip) will be used. If you wish to provide *additional* directives to these - * specified directives, you must explicitly declare them. Example: - * - * const MyAppSchema = new GraphQLSchema({ - * ... - * directives: specifiedDirectives.concat([ myCustomDirective ]), - * }) - * - */ -export class GraphQLSchema { - description: Maybe; - extensions: Maybe>; - astNode: Maybe; - extensionASTNodes: Maybe>; - - constructor(config: Readonly); - getQueryType(): Maybe; - getMutationType(): Maybe; - getSubscriptionType(): Maybe; - getTypeMap(): TypeMap; - getType(name: string): Maybe; - - getPossibleTypes( - abstractType: GraphQLAbstractType, - ): ReadonlyArray; - - getImplementations( - interfaceType: GraphQLInterfaceType, - ): InterfaceImplementations; - - // @deprecated: use isSubType instead - will be removed in v16. - isPossibleType( - abstractType: GraphQLAbstractType, - possibleType: GraphQLObjectType, - ): boolean; - - isSubType( - abstractType: GraphQLAbstractType, - maybeSubType: GraphQLNamedType, - ): boolean; - - getDirectives(): ReadonlyArray; - getDirective(name: string): Maybe; - - toConfig(): GraphQLSchemaConfig & { - types: Array; - directives: Array; - extensions: Maybe>; - extensionASTNodes: ReadonlyArray; - assumeValid: boolean; - }; -} - -interface TypeMap { - [key: string]: GraphQLNamedType; -} - -interface InterfaceImplementations { - objects: ReadonlyArray; - interfaces: ReadonlyArray; -} - -export interface GraphQLSchemaValidationOptions { - /** - * When building a schema from a GraphQL service's introspection result, it - * might be safe to assume the schema is valid. Set to true to assume the - * produced schema is valid. - * - * Default: false - */ - assumeValid?: boolean; -} - -export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions { - description?: Maybe; - query?: Maybe; - mutation?: Maybe; - subscription?: Maybe; - types?: Maybe>; - directives?: Maybe>; - extensions?: Maybe>; - astNode?: Maybe; - extensionASTNodes?: Maybe>; -} - -/** - * @internal - */ -export interface GraphQLSchemaNormalizedConfig extends GraphQLSchemaConfig { - description: Maybe; - types: Array; - directives: Array; - extensions: Maybe>; - extensionASTNodes: Maybe>; - assumeValid: boolean; -} diff --git a/node_modules/graphql/type/schema.js b/node_modules/graphql/type/schema.js deleted file mode 100644 index 9eef4d0b..00000000 --- a/node_modules/graphql/type/schema.js +++ /dev/null @@ -1,384 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isSchema = isSchema; -exports.assertSchema = assertSchema; -exports.GraphQLSchema = void 0; - -var _find = _interopRequireDefault(require("../polyfills/find.js")); - -var _arrayFrom3 = _interopRequireDefault(require("../polyfills/arrayFrom.js")); - -var _objectValues5 = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _symbols = require("../polyfills/symbols.js"); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _toObjMap = _interopRequireDefault(require("../jsutils/toObjMap.js")); - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _instanceOf = _interopRequireDefault(require("../jsutils/instanceOf.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _introspection = require("./introspection.js"); - -var _directives = require("./directives.js"); - -var _definition = require("./definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -// eslint-disable-next-line no-redeclare -function isSchema(schema) { - return (0, _instanceOf.default)(schema, GraphQLSchema); -} - -function assertSchema(schema) { - if (!isSchema(schema)) { - throw new Error("Expected ".concat((0, _inspect.default)(schema), " to be a GraphQL schema.")); - } - - return schema; -} -/** - * Schema Definition - * - * A Schema is created by supplying the root types of each type of operation, - * query and mutation (optional). A schema definition is then supplied to the - * validator and executor. - * - * Example: - * - * const MyAppSchema = new GraphQLSchema({ - * query: MyAppQueryRootType, - * mutation: MyAppMutationRootType, - * }) - * - * Note: When the schema is constructed, by default only the types that are - * reachable by traversing the root types are included, other types must be - * explicitly referenced. - * - * Example: - * - * const characterInterface = new GraphQLInterfaceType({ - * name: 'Character', - * ... - * }); - * - * const humanType = new GraphQLObjectType({ - * name: 'Human', - * interfaces: [characterInterface], - * ... - * }); - * - * const droidType = new GraphQLObjectType({ - * name: 'Droid', - * interfaces: [characterInterface], - * ... - * }); - * - * const schema = new GraphQLSchema({ - * query: new GraphQLObjectType({ - * name: 'Query', - * fields: { - * hero: { type: characterInterface, ... }, - * } - * }), - * ... - * // Since this schema references only the `Character` interface it's - * // necessary to explicitly list the types that implement it if - * // you want them to be included in the final schema. - * types: [humanType, droidType], - * }) - * - * Note: If an array of `directives` are provided to GraphQLSchema, that will be - * the exact list of directives represented and allowed. If `directives` is not - * provided then a default set of the specified directives (e.g. @include and - * @skip) will be used. If you wish to provide *additional* directives to these - * specified directives, you must explicitly declare them. Example: - * - * const MyAppSchema = new GraphQLSchema({ - * ... - * directives: specifiedDirectives.concat([ myCustomDirective ]), - * }) - * - */ - - -var GraphQLSchema = /*#__PURE__*/function () { - // Used as a cache for validateSchema(). - function GraphQLSchema(config) { - var _config$directives; - - // If this schema was built from a source known to be valid, then it may be - // marked with assumeValid to avoid an additional type system validation. - this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. - - (0, _isObjectLike.default)(config) || (0, _devAssert.default)(0, 'Must provide configuration object.'); - !config.types || Array.isArray(config.types) || (0, _devAssert.default)(0, "\"types\" must be Array if provided but got: ".concat((0, _inspect.default)(config.types), ".")); - !config.directives || Array.isArray(config.directives) || (0, _devAssert.default)(0, '"directives" must be Array if provided but got: ' + "".concat((0, _inspect.default)(config.directives), ".")); - this.description = config.description; - this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = config.extensionASTNodes; - this._queryType = config.query; - this._mutationType = config.mutation; - this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. - - this._directives = (_config$directives = config.directives) !== null && _config$directives !== void 0 ? _config$directives : _directives.specifiedDirectives; // To preserve order of user-provided types, we add first to add them to - // the set of "collected" types, so `collectReferencedTypes` ignore them. - - var allReferencedTypes = new Set(config.types); - - if (config.types != null) { - for (var _i2 = 0, _config$types2 = config.types; _i2 < _config$types2.length; _i2++) { - var type = _config$types2[_i2]; - // When we ready to process this type, we remove it from "collected" types - // and then add it together with all dependent types in the correct position. - allReferencedTypes.delete(type); - collectReferencedTypes(type, allReferencedTypes); - } - } - - if (this._queryType != null) { - collectReferencedTypes(this._queryType, allReferencedTypes); - } - - if (this._mutationType != null) { - collectReferencedTypes(this._mutationType, allReferencedTypes); - } - - if (this._subscriptionType != null) { - collectReferencedTypes(this._subscriptionType, allReferencedTypes); - } - - for (var _i4 = 0, _this$_directives2 = this._directives; _i4 < _this$_directives2.length; _i4++) { - var directive = _this$_directives2[_i4]; - - // Directives are not validated until validateSchema() is called. - if ((0, _directives.isDirective)(directive)) { - for (var _i6 = 0, _directive$args2 = directive.args; _i6 < _directive$args2.length; _i6++) { - var arg = _directive$args2[_i6]; - collectReferencedTypes(arg.type, allReferencedTypes); - } - } - } - - collectReferencedTypes(_introspection.__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. - - this._typeMap = Object.create(null); - this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. - - this._implementationsMap = Object.create(null); - - for (var _i8 = 0, _arrayFrom2 = (0, _arrayFrom3.default)(allReferencedTypes); _i8 < _arrayFrom2.length; _i8++) { - var namedType = _arrayFrom2[_i8]; - - if (namedType == null) { - continue; - } - - var typeName = namedType.name; - typeName || (0, _devAssert.default)(0, 'One of the provided types for building the Schema is missing a name.'); - - if (this._typeMap[typeName] !== undefined) { - throw new Error("Schema must contain uniquely named types but contains multiple types named \"".concat(typeName, "\".")); - } - - this._typeMap[typeName] = namedType; - - if ((0, _definition.isInterfaceType)(namedType)) { - // Store implementations by interface. - for (var _i10 = 0, _namedType$getInterfa2 = namedType.getInterfaces(); _i10 < _namedType$getInterfa2.length; _i10++) { - var iface = _namedType$getInterfa2[_i10]; - - if ((0, _definition.isInterfaceType)(iface)) { - var implementations = this._implementationsMap[iface.name]; - - if (implementations === undefined) { - implementations = this._implementationsMap[iface.name] = { - objects: [], - interfaces: [] - }; - } - - implementations.interfaces.push(namedType); - } - } - } else if ((0, _definition.isObjectType)(namedType)) { - // Store implementations by objects. - for (var _i12 = 0, _namedType$getInterfa4 = namedType.getInterfaces(); _i12 < _namedType$getInterfa4.length; _i12++) { - var _iface = _namedType$getInterfa4[_i12]; - - if ((0, _definition.isInterfaceType)(_iface)) { - var _implementations = this._implementationsMap[_iface.name]; - - if (_implementations === undefined) { - _implementations = this._implementationsMap[_iface.name] = { - objects: [], - interfaces: [] - }; - } - - _implementations.objects.push(namedType); - } - } - } - } - } - - var _proto = GraphQLSchema.prototype; - - _proto.getQueryType = function getQueryType() { - return this._queryType; - }; - - _proto.getMutationType = function getMutationType() { - return this._mutationType; - }; - - _proto.getSubscriptionType = function getSubscriptionType() { - return this._subscriptionType; - }; - - _proto.getTypeMap = function getTypeMap() { - return this._typeMap; - }; - - _proto.getType = function getType(name) { - return this.getTypeMap()[name]; - }; - - _proto.getPossibleTypes = function getPossibleTypes(abstractType) { - return (0, _definition.isUnionType)(abstractType) ? abstractType.getTypes() : this.getImplementations(abstractType).objects; - }; - - _proto.getImplementations = function getImplementations(interfaceType) { - var implementations = this._implementationsMap[interfaceType.name]; - return implementations !== null && implementations !== void 0 ? implementations : { - objects: [], - interfaces: [] - }; - } // @deprecated: use isSubType instead - will be removed in v16. - ; - - _proto.isPossibleType = function isPossibleType(abstractType, possibleType) { - return this.isSubType(abstractType, possibleType); - }; - - _proto.isSubType = function isSubType(abstractType, maybeSubType) { - var map = this._subTypeMap[abstractType.name]; - - if (map === undefined) { - map = Object.create(null); - - if ((0, _definition.isUnionType)(abstractType)) { - for (var _i14 = 0, _abstractType$getType2 = abstractType.getTypes(); _i14 < _abstractType$getType2.length; _i14++) { - var type = _abstractType$getType2[_i14]; - map[type.name] = true; - } - } else { - var implementations = this.getImplementations(abstractType); - - for (var _i16 = 0, _implementations$obje2 = implementations.objects; _i16 < _implementations$obje2.length; _i16++) { - var _type = _implementations$obje2[_i16]; - map[_type.name] = true; - } - - for (var _i18 = 0, _implementations$inte2 = implementations.interfaces; _i18 < _implementations$inte2.length; _i18++) { - var _type2 = _implementations$inte2[_i18]; - map[_type2.name] = true; - } - } - - this._subTypeMap[abstractType.name] = map; - } - - return map[maybeSubType.name] !== undefined; - }; - - _proto.getDirectives = function getDirectives() { - return this._directives; - }; - - _proto.getDirective = function getDirective(name) { - return (0, _find.default)(this.getDirectives(), function (directive) { - return directive.name === name; - }); - }; - - _proto.toConfig = function toConfig() { - var _this$extensionASTNod; - - return { - description: this.description, - query: this.getQueryType(), - mutation: this.getMutationType(), - subscription: this.getSubscriptionType(), - types: (0, _objectValues5.default)(this.getTypeMap()), - directives: this.getDirectives().slice(), - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod = this.extensionASTNodes) !== null && _this$extensionASTNod !== void 0 ? _this$extensionASTNod : [], - assumeValid: this.__validationErrors !== undefined - }; - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLSchema, [{ - key: _symbols.SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLSchema'; - } - }]); - - return GraphQLSchema; -}(); - -exports.GraphQLSchema = GraphQLSchema; - -function collectReferencedTypes(type, typeSet) { - var namedType = (0, _definition.getNamedType)(type); - - if (!typeSet.has(namedType)) { - typeSet.add(namedType); - - if ((0, _definition.isUnionType)(namedType)) { - for (var _i20 = 0, _namedType$getTypes2 = namedType.getTypes(); _i20 < _namedType$getTypes2.length; _i20++) { - var memberType = _namedType$getTypes2[_i20]; - collectReferencedTypes(memberType, typeSet); - } - } else if ((0, _definition.isObjectType)(namedType) || (0, _definition.isInterfaceType)(namedType)) { - for (var _i22 = 0, _namedType$getInterfa6 = namedType.getInterfaces(); _i22 < _namedType$getInterfa6.length; _i22++) { - var interfaceType = _namedType$getInterfa6[_i22]; - collectReferencedTypes(interfaceType, typeSet); - } - - for (var _i24 = 0, _objectValues2 = (0, _objectValues5.default)(namedType.getFields()); _i24 < _objectValues2.length; _i24++) { - var field = _objectValues2[_i24]; - collectReferencedTypes(field.type, typeSet); - - for (var _i26 = 0, _field$args2 = field.args; _i26 < _field$args2.length; _i26++) { - var arg = _field$args2[_i26]; - collectReferencedTypes(arg.type, typeSet); - } - } - } else if ((0, _definition.isInputObjectType)(namedType)) { - for (var _i28 = 0, _objectValues4 = (0, _objectValues5.default)(namedType.getFields()); _i28 < _objectValues4.length; _i28++) { - var _field = _objectValues4[_i28]; - collectReferencedTypes(_field.type, typeSet); - } - } - } - - return typeSet; -} diff --git a/node_modules/graphql/type/schema.js.flow b/node_modules/graphql/type/schema.js.flow deleted file mode 100644 index 0a846564..00000000 --- a/node_modules/graphql/type/schema.js.flow +++ /dev/null @@ -1,435 +0,0 @@ -// @flow strict -import find from '../polyfills/find'; -import arrayFrom from '../polyfills/arrayFrom'; -import objectValues from '../polyfills/objectValues'; -import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols'; - -import type { - ObjMap, - ReadOnlyObjMap, - ReadOnlyObjMapLike, -} from '../jsutils/ObjMap'; -import inspect from '../jsutils/inspect'; -import toObjMap from '../jsutils/toObjMap'; -import devAssert from '../jsutils/devAssert'; -import instanceOf from '../jsutils/instanceOf'; -import isObjectLike from '../jsutils/isObjectLike'; - -import type { GraphQLError } from '../error/GraphQLError'; - -import type { - SchemaDefinitionNode, - SchemaExtensionNode, -} from '../language/ast'; - -import type { - GraphQLType, - GraphQLNamedType, - GraphQLAbstractType, - GraphQLObjectType, - GraphQLInterfaceType, -} from './definition'; -import { __Schema } from './introspection'; -import { - GraphQLDirective, - isDirective, - specifiedDirectives, -} from './directives'; -import { - isObjectType, - isInterfaceType, - isUnionType, - isInputObjectType, - getNamedType, -} from './definition'; - -/** - * Test if the given value is a GraphQL schema. - */ -declare function isSchema(schema: mixed): boolean %checks(schema instanceof - GraphQLSchema); -// eslint-disable-next-line no-redeclare -export function isSchema(schema) { - return instanceOf(schema, GraphQLSchema); -} - -export function assertSchema(schema: mixed): GraphQLSchema { - if (!isSchema(schema)) { - throw new Error(`Expected ${inspect(schema)} to be a GraphQL schema.`); - } - return schema; -} - -/** - * Schema Definition - * - * A Schema is created by supplying the root types of each type of operation, - * query and mutation (optional). A schema definition is then supplied to the - * validator and executor. - * - * Example: - * - * const MyAppSchema = new GraphQLSchema({ - * query: MyAppQueryRootType, - * mutation: MyAppMutationRootType, - * }) - * - * Note: When the schema is constructed, by default only the types that are - * reachable by traversing the root types are included, other types must be - * explicitly referenced. - * - * Example: - * - * const characterInterface = new GraphQLInterfaceType({ - * name: 'Character', - * ... - * }); - * - * const humanType = new GraphQLObjectType({ - * name: 'Human', - * interfaces: [characterInterface], - * ... - * }); - * - * const droidType = new GraphQLObjectType({ - * name: 'Droid', - * interfaces: [characterInterface], - * ... - * }); - * - * const schema = new GraphQLSchema({ - * query: new GraphQLObjectType({ - * name: 'Query', - * fields: { - * hero: { type: characterInterface, ... }, - * } - * }), - * ... - * // Since this schema references only the `Character` interface it's - * // necessary to explicitly list the types that implement it if - * // you want them to be included in the final schema. - * types: [humanType, droidType], - * }) - * - * Note: If an array of `directives` are provided to GraphQLSchema, that will be - * the exact list of directives represented and allowed. If `directives` is not - * provided then a default set of the specified directives (e.g. @include and - * @skip) will be used. If you wish to provide *additional* directives to these - * specified directives, you must explicitly declare them. Example: - * - * const MyAppSchema = new GraphQLSchema({ - * ... - * directives: specifiedDirectives.concat([ myCustomDirective ]), - * }) - * - */ -export class GraphQLSchema { - description: ?string; - extensions: ?ReadOnlyObjMap; - astNode: ?SchemaDefinitionNode; - extensionASTNodes: ?$ReadOnlyArray; - - _queryType: ?GraphQLObjectType; - _mutationType: ?GraphQLObjectType; - _subscriptionType: ?GraphQLObjectType; - _directives: $ReadOnlyArray; - _typeMap: TypeMap; - _subTypeMap: ObjMap>; - _implementationsMap: ObjMap<{| - objects: Array, - interfaces: Array, - |}>; - - // Used as a cache for validateSchema(). - __validationErrors: ?$ReadOnlyArray; - - constructor(config: $ReadOnly): void { - // If this schema was built from a source known to be valid, then it may be - // marked with assumeValid to avoid an additional type system validation. - this.__validationErrors = config.assumeValid === true ? [] : undefined; - - // Check for common mistakes during construction to produce early errors. - devAssert(isObjectLike(config), 'Must provide configuration object.'); - devAssert( - !config.types || Array.isArray(config.types), - `"types" must be Array if provided but got: ${inspect(config.types)}.`, - ); - devAssert( - !config.directives || Array.isArray(config.directives), - '"directives" must be Array if provided but got: ' + - `${inspect(config.directives)}.`, - ); - - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = config.extensionASTNodes; - - this._queryType = config.query; - this._mutationType = config.mutation; - this._subscriptionType = config.subscription; - // Provide specified directives (e.g. @include and @skip) by default. - this._directives = config.directives ?? specifiedDirectives; - - // To preserve order of user-provided types, we add first to add them to - // the set of "collected" types, so `collectReferencedTypes` ignore them. - const allReferencedTypes: Set = new Set(config.types); - if (config.types != null) { - for (const type of config.types) { - // When we ready to process this type, we remove it from "collected" types - // and then add it together with all dependent types in the correct position. - allReferencedTypes.delete(type); - collectReferencedTypes(type, allReferencedTypes); - } - } - - if (this._queryType != null) { - collectReferencedTypes(this._queryType, allReferencedTypes); - } - if (this._mutationType != null) { - collectReferencedTypes(this._mutationType, allReferencedTypes); - } - if (this._subscriptionType != null) { - collectReferencedTypes(this._subscriptionType, allReferencedTypes); - } - - for (const directive of this._directives) { - // Directives are not validated until validateSchema() is called. - if (isDirective(directive)) { - for (const arg of directive.args) { - collectReferencedTypes(arg.type, allReferencedTypes); - } - } - } - collectReferencedTypes(__Schema, allReferencedTypes); - - // Storing the resulting map for reference by the schema. - this._typeMap = Object.create(null); - this._subTypeMap = Object.create(null); - // Keep track of all implementations by interface name. - this._implementationsMap = Object.create(null); - - for (const namedType of arrayFrom(allReferencedTypes)) { - if (namedType == null) { - continue; - } - - const typeName = namedType.name; - devAssert( - typeName, - 'One of the provided types for building the Schema is missing a name.', - ); - if (this._typeMap[typeName] !== undefined) { - throw new Error( - `Schema must contain uniquely named types but contains multiple types named "${typeName}".`, - ); - } - this._typeMap[typeName] = namedType; - - if (isInterfaceType(namedType)) { - // Store implementations by interface. - for (const iface of namedType.getInterfaces()) { - if (isInterfaceType(iface)) { - let implementations = this._implementationsMap[iface.name]; - if (implementations === undefined) { - implementations = this._implementationsMap[iface.name] = { - objects: [], - interfaces: [], - }; - } - - implementations.interfaces.push(namedType); - } - } - } else if (isObjectType(namedType)) { - // Store implementations by objects. - for (const iface of namedType.getInterfaces()) { - if (isInterfaceType(iface)) { - let implementations = this._implementationsMap[iface.name]; - if (implementations === undefined) { - implementations = this._implementationsMap[iface.name] = { - objects: [], - interfaces: [], - }; - } - - implementations.objects.push(namedType); - } - } - } - } - } - - getQueryType(): ?GraphQLObjectType { - return this._queryType; - } - - getMutationType(): ?GraphQLObjectType { - return this._mutationType; - } - - getSubscriptionType(): ?GraphQLObjectType { - return this._subscriptionType; - } - - getTypeMap(): TypeMap { - return this._typeMap; - } - - getType(name: string): ?GraphQLNamedType { - return this.getTypeMap()[name]; - } - - getPossibleTypes( - abstractType: GraphQLAbstractType, - ): $ReadOnlyArray { - return isUnionType(abstractType) - ? abstractType.getTypes() - : this.getImplementations(abstractType).objects; - } - - getImplementations( - interfaceType: GraphQLInterfaceType, - ): {| - objects: /* $ReadOnly */ Array, - interfaces: /* $ReadOnly */ Array, - |} { - const implementations = this._implementationsMap[interfaceType.name]; - return implementations ?? { objects: [], interfaces: [] }; - } - - // @deprecated: use isSubType instead - will be removed in v16. - isPossibleType( - abstractType: GraphQLAbstractType, - possibleType: GraphQLObjectType, - ): boolean { - return this.isSubType(abstractType, possibleType); - } - - isSubType( - abstractType: GraphQLAbstractType, - maybeSubType: GraphQLObjectType | GraphQLInterfaceType, - ): boolean { - let map = this._subTypeMap[abstractType.name]; - if (map === undefined) { - map = Object.create(null); - - if (isUnionType(abstractType)) { - for (const type of abstractType.getTypes()) { - map[type.name] = true; - } - } else { - const implementations = this.getImplementations(abstractType); - for (const type of implementations.objects) { - map[type.name] = true; - } - for (const type of implementations.interfaces) { - map[type.name] = true; - } - } - - this._subTypeMap[abstractType.name] = map; - } - return map[maybeSubType.name] !== undefined; - } - - getDirectives(): $ReadOnlyArray { - return this._directives; - } - - getDirective(name: string): ?GraphQLDirective { - return find(this.getDirectives(), (directive) => directive.name === name); - } - - toConfig(): GraphQLSchemaNormalizedConfig { - return { - description: this.description, - query: this.getQueryType(), - mutation: this.getMutationType(), - subscription: this.getSubscriptionType(), - types: objectValues(this.getTypeMap()), - directives: this.getDirectives().slice(), - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [], - assumeValid: this.__validationErrors !== undefined, - }; - } - - // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLSchema'; - } -} - -type TypeMap = ObjMap; - -export type GraphQLSchemaValidationOptions = {| - /** - * When building a schema from a GraphQL service's introspection result, it - * might be safe to assume the schema is valid. Set to true to assume the - * produced schema is valid. - * - * Default: false - */ - assumeValid?: boolean, -|}; - -export type GraphQLSchemaConfig = {| - description?: ?string, - query?: ?GraphQLObjectType, - mutation?: ?GraphQLObjectType, - subscription?: ?GraphQLObjectType, - types?: ?Array, - directives?: ?Array, - extensions?: ?ReadOnlyObjMapLike, - astNode?: ?SchemaDefinitionNode, - extensionASTNodes?: ?$ReadOnlyArray, - ...GraphQLSchemaValidationOptions, -|}; - -/** - * @internal - */ -export type GraphQLSchemaNormalizedConfig = {| - ...GraphQLSchemaConfig, - description: ?string, - types: Array, - directives: Array, - extensions: ?ReadOnlyObjMap, - extensionASTNodes: $ReadOnlyArray, - assumeValid: boolean, -|}; - -function collectReferencedTypes( - type: GraphQLType, - typeSet: Set, -): Set { - const namedType = getNamedType(type); - - if (!typeSet.has(namedType)) { - typeSet.add(namedType); - if (isUnionType(namedType)) { - for (const memberType of namedType.getTypes()) { - collectReferencedTypes(memberType, typeSet); - } - } else if (isObjectType(namedType) || isInterfaceType(namedType)) { - for (const interfaceType of namedType.getInterfaces()) { - collectReferencedTypes(interfaceType, typeSet); - } - - for (const field of objectValues(namedType.getFields())) { - collectReferencedTypes(field.type, typeSet); - for (const arg of field.args) { - collectReferencedTypes(arg.type, typeSet); - } - } - } else if (isInputObjectType(namedType)) { - for (const field of objectValues(namedType.getFields())) { - collectReferencedTypes(field.type, typeSet); - } - } - } - - return typeSet; -} diff --git a/node_modules/graphql/type/schema.mjs b/node_modules/graphql/type/schema.mjs deleted file mode 100644 index 0163455c..00000000 --- a/node_modules/graphql/type/schema.mjs +++ /dev/null @@ -1,361 +0,0 @@ -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -import find from "../polyfills/find.mjs"; -import arrayFrom from "../polyfills/arrayFrom.mjs"; -import objectValues from "../polyfills/objectValues.mjs"; -import { SYMBOL_TO_STRING_TAG } from "../polyfills/symbols.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import toObjMap from "../jsutils/toObjMap.mjs"; -import devAssert from "../jsutils/devAssert.mjs"; -import instanceOf from "../jsutils/instanceOf.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import { __Schema } from "./introspection.mjs"; -import { GraphQLDirective, isDirective, specifiedDirectives } from "./directives.mjs"; -import { isObjectType, isInterfaceType, isUnionType, isInputObjectType, getNamedType } from "./definition.mjs"; -/** - * Test if the given value is a GraphQL schema. - */ - -// eslint-disable-next-line no-redeclare -export function isSchema(schema) { - return instanceOf(schema, GraphQLSchema); -} -export function assertSchema(schema) { - if (!isSchema(schema)) { - throw new Error("Expected ".concat(inspect(schema), " to be a GraphQL schema.")); - } - - return schema; -} -/** - * Schema Definition - * - * A Schema is created by supplying the root types of each type of operation, - * query and mutation (optional). A schema definition is then supplied to the - * validator and executor. - * - * Example: - * - * const MyAppSchema = new GraphQLSchema({ - * query: MyAppQueryRootType, - * mutation: MyAppMutationRootType, - * }) - * - * Note: When the schema is constructed, by default only the types that are - * reachable by traversing the root types are included, other types must be - * explicitly referenced. - * - * Example: - * - * const characterInterface = new GraphQLInterfaceType({ - * name: 'Character', - * ... - * }); - * - * const humanType = new GraphQLObjectType({ - * name: 'Human', - * interfaces: [characterInterface], - * ... - * }); - * - * const droidType = new GraphQLObjectType({ - * name: 'Droid', - * interfaces: [characterInterface], - * ... - * }); - * - * const schema = new GraphQLSchema({ - * query: new GraphQLObjectType({ - * name: 'Query', - * fields: { - * hero: { type: characterInterface, ... }, - * } - * }), - * ... - * // Since this schema references only the `Character` interface it's - * // necessary to explicitly list the types that implement it if - * // you want them to be included in the final schema. - * types: [humanType, droidType], - * }) - * - * Note: If an array of `directives` are provided to GraphQLSchema, that will be - * the exact list of directives represented and allowed. If `directives` is not - * provided then a default set of the specified directives (e.g. @include and - * @skip) will be used. If you wish to provide *additional* directives to these - * specified directives, you must explicitly declare them. Example: - * - * const MyAppSchema = new GraphQLSchema({ - * ... - * directives: specifiedDirectives.concat([ myCustomDirective ]), - * }) - * - */ - -export var GraphQLSchema = /*#__PURE__*/function () { - // Used as a cache for validateSchema(). - function GraphQLSchema(config) { - var _config$directives; - - // If this schema was built from a source known to be valid, then it may be - // marked with assumeValid to avoid an additional type system validation. - this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. - - isObjectLike(config) || devAssert(0, 'Must provide configuration object.'); - !config.types || Array.isArray(config.types) || devAssert(0, "\"types\" must be Array if provided but got: ".concat(inspect(config.types), ".")); - !config.directives || Array.isArray(config.directives) || devAssert(0, '"directives" must be Array if provided but got: ' + "".concat(inspect(config.directives), ".")); - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = config.extensionASTNodes; - this._queryType = config.query; - this._mutationType = config.mutation; - this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. - - this._directives = (_config$directives = config.directives) !== null && _config$directives !== void 0 ? _config$directives : specifiedDirectives; // To preserve order of user-provided types, we add first to add them to - // the set of "collected" types, so `collectReferencedTypes` ignore them. - - var allReferencedTypes = new Set(config.types); - - if (config.types != null) { - for (var _i2 = 0, _config$types2 = config.types; _i2 < _config$types2.length; _i2++) { - var type = _config$types2[_i2]; - // When we ready to process this type, we remove it from "collected" types - // and then add it together with all dependent types in the correct position. - allReferencedTypes.delete(type); - collectReferencedTypes(type, allReferencedTypes); - } - } - - if (this._queryType != null) { - collectReferencedTypes(this._queryType, allReferencedTypes); - } - - if (this._mutationType != null) { - collectReferencedTypes(this._mutationType, allReferencedTypes); - } - - if (this._subscriptionType != null) { - collectReferencedTypes(this._subscriptionType, allReferencedTypes); - } - - for (var _i4 = 0, _this$_directives2 = this._directives; _i4 < _this$_directives2.length; _i4++) { - var directive = _this$_directives2[_i4]; - - // Directives are not validated until validateSchema() is called. - if (isDirective(directive)) { - for (var _i6 = 0, _directive$args2 = directive.args; _i6 < _directive$args2.length; _i6++) { - var arg = _directive$args2[_i6]; - collectReferencedTypes(arg.type, allReferencedTypes); - } - } - } - - collectReferencedTypes(__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. - - this._typeMap = Object.create(null); - this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. - - this._implementationsMap = Object.create(null); - - for (var _i8 = 0, _arrayFrom2 = arrayFrom(allReferencedTypes); _i8 < _arrayFrom2.length; _i8++) { - var namedType = _arrayFrom2[_i8]; - - if (namedType == null) { - continue; - } - - var typeName = namedType.name; - typeName || devAssert(0, 'One of the provided types for building the Schema is missing a name.'); - - if (this._typeMap[typeName] !== undefined) { - throw new Error("Schema must contain uniquely named types but contains multiple types named \"".concat(typeName, "\".")); - } - - this._typeMap[typeName] = namedType; - - if (isInterfaceType(namedType)) { - // Store implementations by interface. - for (var _i10 = 0, _namedType$getInterfa2 = namedType.getInterfaces(); _i10 < _namedType$getInterfa2.length; _i10++) { - var iface = _namedType$getInterfa2[_i10]; - - if (isInterfaceType(iface)) { - var implementations = this._implementationsMap[iface.name]; - - if (implementations === undefined) { - implementations = this._implementationsMap[iface.name] = { - objects: [], - interfaces: [] - }; - } - - implementations.interfaces.push(namedType); - } - } - } else if (isObjectType(namedType)) { - // Store implementations by objects. - for (var _i12 = 0, _namedType$getInterfa4 = namedType.getInterfaces(); _i12 < _namedType$getInterfa4.length; _i12++) { - var _iface = _namedType$getInterfa4[_i12]; - - if (isInterfaceType(_iface)) { - var _implementations = this._implementationsMap[_iface.name]; - - if (_implementations === undefined) { - _implementations = this._implementationsMap[_iface.name] = { - objects: [], - interfaces: [] - }; - } - - _implementations.objects.push(namedType); - } - } - } - } - } - - var _proto = GraphQLSchema.prototype; - - _proto.getQueryType = function getQueryType() { - return this._queryType; - }; - - _proto.getMutationType = function getMutationType() { - return this._mutationType; - }; - - _proto.getSubscriptionType = function getSubscriptionType() { - return this._subscriptionType; - }; - - _proto.getTypeMap = function getTypeMap() { - return this._typeMap; - }; - - _proto.getType = function getType(name) { - return this.getTypeMap()[name]; - }; - - _proto.getPossibleTypes = function getPossibleTypes(abstractType) { - return isUnionType(abstractType) ? abstractType.getTypes() : this.getImplementations(abstractType).objects; - }; - - _proto.getImplementations = function getImplementations(interfaceType) { - var implementations = this._implementationsMap[interfaceType.name]; - return implementations !== null && implementations !== void 0 ? implementations : { - objects: [], - interfaces: [] - }; - } // @deprecated: use isSubType instead - will be removed in v16. - ; - - _proto.isPossibleType = function isPossibleType(abstractType, possibleType) { - return this.isSubType(abstractType, possibleType); - }; - - _proto.isSubType = function isSubType(abstractType, maybeSubType) { - var map = this._subTypeMap[abstractType.name]; - - if (map === undefined) { - map = Object.create(null); - - if (isUnionType(abstractType)) { - for (var _i14 = 0, _abstractType$getType2 = abstractType.getTypes(); _i14 < _abstractType$getType2.length; _i14++) { - var type = _abstractType$getType2[_i14]; - map[type.name] = true; - } - } else { - var implementations = this.getImplementations(abstractType); - - for (var _i16 = 0, _implementations$obje2 = implementations.objects; _i16 < _implementations$obje2.length; _i16++) { - var _type = _implementations$obje2[_i16]; - map[_type.name] = true; - } - - for (var _i18 = 0, _implementations$inte2 = implementations.interfaces; _i18 < _implementations$inte2.length; _i18++) { - var _type2 = _implementations$inte2[_i18]; - map[_type2.name] = true; - } - } - - this._subTypeMap[abstractType.name] = map; - } - - return map[maybeSubType.name] !== undefined; - }; - - _proto.getDirectives = function getDirectives() { - return this._directives; - }; - - _proto.getDirective = function getDirective(name) { - return find(this.getDirectives(), function (directive) { - return directive.name === name; - }); - }; - - _proto.toConfig = function toConfig() { - var _this$extensionASTNod; - - return { - description: this.description, - query: this.getQueryType(), - mutation: this.getMutationType(), - subscription: this.getSubscriptionType(), - types: objectValues(this.getTypeMap()), - directives: this.getDirectives().slice(), - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: (_this$extensionASTNod = this.extensionASTNodes) !== null && _this$extensionASTNod !== void 0 ? _this$extensionASTNod : [], - assumeValid: this.__validationErrors !== undefined - }; - } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet - ; - - _createClass(GraphQLSchema, [{ - key: SYMBOL_TO_STRING_TAG, - get: function get() { - return 'GraphQLSchema'; - } - }]); - - return GraphQLSchema; -}(); - -function collectReferencedTypes(type, typeSet) { - var namedType = getNamedType(type); - - if (!typeSet.has(namedType)) { - typeSet.add(namedType); - - if (isUnionType(namedType)) { - for (var _i20 = 0, _namedType$getTypes2 = namedType.getTypes(); _i20 < _namedType$getTypes2.length; _i20++) { - var memberType = _namedType$getTypes2[_i20]; - collectReferencedTypes(memberType, typeSet); - } - } else if (isObjectType(namedType) || isInterfaceType(namedType)) { - for (var _i22 = 0, _namedType$getInterfa6 = namedType.getInterfaces(); _i22 < _namedType$getInterfa6.length; _i22++) { - var interfaceType = _namedType$getInterfa6[_i22]; - collectReferencedTypes(interfaceType, typeSet); - } - - for (var _i24 = 0, _objectValues2 = objectValues(namedType.getFields()); _i24 < _objectValues2.length; _i24++) { - var field = _objectValues2[_i24]; - collectReferencedTypes(field.type, typeSet); - - for (var _i26 = 0, _field$args2 = field.args; _i26 < _field$args2.length; _i26++) { - var arg = _field$args2[_i26]; - collectReferencedTypes(arg.type, typeSet); - } - } - } else if (isInputObjectType(namedType)) { - for (var _i28 = 0, _objectValues4 = objectValues(namedType.getFields()); _i28 < _objectValues4.length; _i28++) { - var _field = _objectValues4[_i28]; - collectReferencedTypes(_field.type, typeSet); - } - } - } - - return typeSet; -} diff --git a/node_modules/graphql/type/validate.d.ts b/node_modules/graphql/type/validate.d.ts deleted file mode 100644 index 98400a23..00000000 --- a/node_modules/graphql/type/validate.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { GraphQLError } from '../error/GraphQLError'; - -import { GraphQLSchema } from './schema'; - -/** - * Implements the "Type Validation" sub-sections of the specification's - * "Type System" section. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the Schema is valid. - */ -export function validateSchema( - schema: GraphQLSchema, -): ReadonlyArray; - -/** - * Utility function which asserts a schema is valid by throwing an error if - * it is invalid. - */ -export function assertValidSchema(schema: GraphQLSchema): void; diff --git a/node_modules/graphql/type/validate.js b/node_modules/graphql/type/validate.js deleted file mode 100644 index a2336684..00000000 --- a/node_modules/graphql/type/validate.js +++ /dev/null @@ -1,549 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.validateSchema = validateSchema; -exports.assertValidSchema = assertValidSchema; - -var _find = _interopRequireDefault(require("../polyfills/find.js")); - -var _objectValues5 = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _locatedError = require("../error/locatedError.js"); - -var _assertValidName = require("../utilities/assertValidName.js"); - -var _typeComparators = require("../utilities/typeComparators.js"); - -var _schema = require("./schema.js"); - -var _introspection = require("./introspection.js"); - -var _directives = require("./directives.js"); - -var _definition = require("./definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Implements the "Type Validation" sub-sections of the specification's - * "Type System" section. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the Schema is valid. - */ -function validateSchema(schema) { - // First check to ensure the provided value is in fact a GraphQLSchema. - (0, _schema.assertSchema)(schema); // If this Schema has already been validated, return the previous results. - - if (schema.__validationErrors) { - return schema.__validationErrors; - } // Validate the schema, producing a list of errors. - - - var context = new SchemaValidationContext(schema); - validateRootTypes(context); - validateDirectives(context); - validateTypes(context); // Persist the results of validation before returning to ensure validation - // does not run multiple times for this schema. - - var errors = context.getErrors(); - schema.__validationErrors = errors; - return errors; -} -/** - * Utility function which asserts a schema is valid by throwing an error if - * it is invalid. - */ - - -function assertValidSchema(schema) { - var errors = validateSchema(schema); - - if (errors.length !== 0) { - throw new Error(errors.map(function (error) { - return error.message; - }).join('\n\n')); - } -} - -var SchemaValidationContext = /*#__PURE__*/function () { - function SchemaValidationContext(schema) { - this._errors = []; - this.schema = schema; - } - - var _proto = SchemaValidationContext.prototype; - - _proto.reportError = function reportError(message, nodes) { - var _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; - - this.addError(new _GraphQLError.GraphQLError(message, _nodes)); - }; - - _proto.addError = function addError(error) { - this._errors.push(error); - }; - - _proto.getErrors = function getErrors() { - return this._errors; - }; - - return SchemaValidationContext; -}(); - -function validateRootTypes(context) { - var schema = context.schema; - var queryType = schema.getQueryType(); - - if (!queryType) { - context.reportError('Query root type must be provided.', schema.astNode); - } else if (!(0, _definition.isObjectType)(queryType)) { - var _getOperationTypeNode; - - context.reportError("Query root type must be Object type, it cannot be ".concat((0, _inspect.default)(queryType), "."), (_getOperationTypeNode = getOperationTypeNode(schema, 'query')) !== null && _getOperationTypeNode !== void 0 ? _getOperationTypeNode : queryType.astNode); - } - - var mutationType = schema.getMutationType(); - - if (mutationType && !(0, _definition.isObjectType)(mutationType)) { - var _getOperationTypeNode2; - - context.reportError('Mutation root type must be Object type if provided, it cannot be ' + "".concat((0, _inspect.default)(mutationType), "."), (_getOperationTypeNode2 = getOperationTypeNode(schema, 'mutation')) !== null && _getOperationTypeNode2 !== void 0 ? _getOperationTypeNode2 : mutationType.astNode); - } - - var subscriptionType = schema.getSubscriptionType(); - - if (subscriptionType && !(0, _definition.isObjectType)(subscriptionType)) { - var _getOperationTypeNode3; - - context.reportError('Subscription root type must be Object type if provided, it cannot be ' + "".concat((0, _inspect.default)(subscriptionType), "."), (_getOperationTypeNode3 = getOperationTypeNode(schema, 'subscription')) !== null && _getOperationTypeNode3 !== void 0 ? _getOperationTypeNode3 : subscriptionType.astNode); - } -} - -function getOperationTypeNode(schema, operation) { - var operationNodes = getAllSubNodes(schema, function (node) { - return node.operationTypes; - }); - - for (var _i2 = 0; _i2 < operationNodes.length; _i2++) { - var node = operationNodes[_i2]; - - if (node.operation === operation) { - return node.type; - } - } - - return undefined; -} - -function validateDirectives(context) { - for (var _i4 = 0, _context$schema$getDi2 = context.schema.getDirectives(); _i4 < _context$schema$getDi2.length; _i4++) { - var directive = _context$schema$getDi2[_i4]; - - // Ensure all directives are in fact GraphQL directives. - if (!(0, _directives.isDirective)(directive)) { - context.reportError("Expected directive but got: ".concat((0, _inspect.default)(directive), "."), directive === null || directive === void 0 ? void 0 : directive.astNode); - continue; - } // Ensure they are named correctly. - - - validateName(context, directive); // TODO: Ensure proper locations. - // Ensure the arguments are valid. - - for (var _i6 = 0, _directive$args2 = directive.args; _i6 < _directive$args2.length; _i6++) { - var arg = _directive$args2[_i6]; - // Ensure they are named correctly. - validateName(context, arg); // Ensure the type is an input type. - - if (!(0, _definition.isInputType)(arg.type)) { - context.reportError("The type of @".concat(directive.name, "(").concat(arg.name, ":) must be Input Type ") + "but got: ".concat((0, _inspect.default)(arg.type), "."), arg.astNode); - } - - if ((0, _definition.isRequiredArgument)(arg) && arg.deprecationReason != null) { - var _arg$astNode; - - context.reportError("Required argument @".concat(directive.name, "(").concat(arg.name, ":) cannot be deprecated."), [getDeprecatedDirectiveNode(arg.astNode), // istanbul ignore next (TODO need to write coverage tests) - (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 ? void 0 : _arg$astNode.type]); - } - } - } -} - -function validateName(context, node) { - // Ensure names are valid, however introspection types opt out. - var error = (0, _assertValidName.isValidNameError)(node.name); - - if (error) { - context.addError((0, _locatedError.locatedError)(error, node.astNode)); - } -} - -function validateTypes(context) { - var validateInputObjectCircularRefs = createInputObjectCircularRefsValidator(context); - var typeMap = context.schema.getTypeMap(); - - for (var _i8 = 0, _objectValues2 = (0, _objectValues5.default)(typeMap); _i8 < _objectValues2.length; _i8++) { - var type = _objectValues2[_i8]; - - // Ensure all provided types are in fact GraphQL type. - if (!(0, _definition.isNamedType)(type)) { - context.reportError("Expected GraphQL named type but got: ".concat((0, _inspect.default)(type), "."), type.astNode); - continue; - } // Ensure it is named correctly (excluding introspection types). - - - if (!(0, _introspection.isIntrospectionType)(type)) { - validateName(context, type); - } - - if ((0, _definition.isObjectType)(type)) { - // Ensure fields are valid - validateFields(context, type); // Ensure objects implement the interfaces they claim to. - - validateInterfaces(context, type); - } else if ((0, _definition.isInterfaceType)(type)) { - // Ensure fields are valid. - validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. - - validateInterfaces(context, type); - } else if ((0, _definition.isUnionType)(type)) { - // Ensure Unions include valid member types. - validateUnionMembers(context, type); - } else if ((0, _definition.isEnumType)(type)) { - // Ensure Enums have valid values. - validateEnumValues(context, type); - } else if ((0, _definition.isInputObjectType)(type)) { - // Ensure Input Object fields are valid. - validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references - - validateInputObjectCircularRefs(type); - } - } -} - -function validateFields(context, type) { - var fields = (0, _objectValues5.default)(type.getFields()); // Objects and Interfaces both must define one or more fields. - - if (fields.length === 0) { - context.reportError("Type ".concat(type.name, " must define one or more fields."), getAllNodes(type)); - } - - for (var _i10 = 0; _i10 < fields.length; _i10++) { - var field = fields[_i10]; - // Ensure they are named correctly. - validateName(context, field); // Ensure the type is an output type - - if (!(0, _definition.isOutputType)(field.type)) { - var _field$astNode; - - context.reportError("The type of ".concat(type.name, ".").concat(field.name, " must be Output Type ") + "but got: ".concat((0, _inspect.default)(field.type), "."), (_field$astNode = field.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type); - } // Ensure the arguments are valid - - - for (var _i12 = 0, _field$args2 = field.args; _i12 < _field$args2.length; _i12++) { - var arg = _field$args2[_i12]; - var argName = arg.name; // Ensure they are named correctly. - - validateName(context, arg); // Ensure the type is an input type - - if (!(0, _definition.isInputType)(arg.type)) { - var _arg$astNode2; - - context.reportError("The type of ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) must be Input ") + "Type but got: ".concat((0, _inspect.default)(arg.type), "."), (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type); - } - - if ((0, _definition.isRequiredArgument)(arg) && arg.deprecationReason != null) { - var _arg$astNode3; - - context.reportError("Required argument ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) cannot be deprecated."), [getDeprecatedDirectiveNode(arg.astNode), // istanbul ignore next (TODO need to write coverage tests) - (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 ? void 0 : _arg$astNode3.type]); - } - } - } -} - -function validateInterfaces(context, type) { - var ifaceTypeNames = Object.create(null); - - for (var _i14 = 0, _type$getInterfaces2 = type.getInterfaces(); _i14 < _type$getInterfaces2.length; _i14++) { - var iface = _type$getInterfaces2[_i14]; - - if (!(0, _definition.isInterfaceType)(iface)) { - context.reportError("Type ".concat((0, _inspect.default)(type), " must only implement Interface types, ") + "it cannot implement ".concat((0, _inspect.default)(iface), "."), getAllImplementsInterfaceNodes(type, iface)); - continue; - } - - if (type === iface) { - context.reportError("Type ".concat(type.name, " cannot implement itself because it would create a circular reference."), getAllImplementsInterfaceNodes(type, iface)); - continue; - } - - if (ifaceTypeNames[iface.name]) { - context.reportError("Type ".concat(type.name, " can only implement ").concat(iface.name, " once."), getAllImplementsInterfaceNodes(type, iface)); - continue; - } - - ifaceTypeNames[iface.name] = true; - validateTypeImplementsAncestors(context, type, iface); - validateTypeImplementsInterface(context, type, iface); - } -} - -function validateTypeImplementsInterface(context, type, iface) { - var typeFieldMap = type.getFields(); // Assert each interface field is implemented. - - for (var _i16 = 0, _objectValues4 = (0, _objectValues5.default)(iface.getFields()); _i16 < _objectValues4.length; _i16++) { - var ifaceField = _objectValues4[_i16]; - var fieldName = ifaceField.name; - var typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. - - if (!typeField) { - context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expected but ").concat(type.name, " does not provide it."), [ifaceField.astNode].concat(getAllNodes(type))); - continue; - } // Assert interface field type is satisfied by type field type, by being - // a valid subtype. (covariant) - - - if (!(0, _typeComparators.isTypeSubTypeOf)(context.schema, typeField.type, ifaceField.type)) { - var _ifaceField$astNode, _typeField$astNode; - - context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expects type ") + "".concat((0, _inspect.default)(ifaceField.type), " but ").concat(type.name, ".").concat(fieldName, " ") + "is type ".concat((0, _inspect.default)(typeField.type), "."), [// istanbul ignore next (TODO need to write coverage tests) - (_ifaceField$astNode = ifaceField.astNode) === null || _ifaceField$astNode === void 0 ? void 0 : _ifaceField$astNode.type, // istanbul ignore next (TODO need to write coverage tests) - (_typeField$astNode = typeField.astNode) === null || _typeField$astNode === void 0 ? void 0 : _typeField$astNode.type]); - } // Assert each interface field arg is implemented. - - - var _loop = function _loop(_i18, _ifaceField$args2) { - var ifaceArg = _ifaceField$args2[_i18]; - var argName = ifaceArg.name; - var typeArg = (0, _find.default)(typeField.args, function (arg) { - return arg.name === argName; - }); // Assert interface field arg exists on object field. - - if (!typeArg) { - context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) expected but ").concat(type.name, ".").concat(fieldName, " does not provide it."), [ifaceArg.astNode, typeField.astNode]); - return "continue"; - } // Assert interface field arg type matches object field arg type. - // (invariant) - // TODO: change to contravariant? - - - if (!(0, _typeComparators.isEqualType)(ifaceArg.type, typeArg.type)) { - var _ifaceArg$astNode, _typeArg$astNode; - - context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) ") + "expects type ".concat((0, _inspect.default)(ifaceArg.type), " but ") + "".concat(type.name, ".").concat(fieldName, "(").concat(argName, ":) is type ") + "".concat((0, _inspect.default)(typeArg.type), "."), [// istanbul ignore next (TODO need to write coverage tests) - (_ifaceArg$astNode = ifaceArg.astNode) === null || _ifaceArg$astNode === void 0 ? void 0 : _ifaceArg$astNode.type, // istanbul ignore next (TODO need to write coverage tests) - (_typeArg$astNode = typeArg.astNode) === null || _typeArg$astNode === void 0 ? void 0 : _typeArg$astNode.type]); - } // TODO: validate default values? - - }; - - for (var _i18 = 0, _ifaceField$args2 = ifaceField.args; _i18 < _ifaceField$args2.length; _i18++) { - var _ret = _loop(_i18, _ifaceField$args2); - - if (_ret === "continue") continue; - } // Assert additional arguments must not be required. - - - var _loop2 = function _loop2(_i20, _typeField$args2) { - var typeArg = _typeField$args2[_i20]; - var argName = typeArg.name; - var ifaceArg = (0, _find.default)(ifaceField.args, function (arg) { - return arg.name === argName; - }); - - if (!ifaceArg && (0, _definition.isRequiredArgument)(typeArg)) { - context.reportError("Object field ".concat(type.name, ".").concat(fieldName, " includes required argument ").concat(argName, " that is missing from the Interface field ").concat(iface.name, ".").concat(fieldName, "."), [typeArg.astNode, ifaceField.astNode]); - } - }; - - for (var _i20 = 0, _typeField$args2 = typeField.args; _i20 < _typeField$args2.length; _i20++) { - _loop2(_i20, _typeField$args2); - } - } -} - -function validateTypeImplementsAncestors(context, type, iface) { - var ifaceInterfaces = type.getInterfaces(); - - for (var _i22 = 0, _iface$getInterfaces2 = iface.getInterfaces(); _i22 < _iface$getInterfaces2.length; _i22++) { - var transitive = _iface$getInterfaces2[_i22]; - - if (ifaceInterfaces.indexOf(transitive) === -1) { - context.reportError(transitive === type ? "Type ".concat(type.name, " cannot implement ").concat(iface.name, " because it would create a circular reference.") : "Type ".concat(type.name, " must implement ").concat(transitive.name, " because it is implemented by ").concat(iface.name, "."), [].concat(getAllImplementsInterfaceNodes(iface, transitive), getAllImplementsInterfaceNodes(type, iface))); - } - } -} - -function validateUnionMembers(context, union) { - var memberTypes = union.getTypes(); - - if (memberTypes.length === 0) { - context.reportError("Union type ".concat(union.name, " must define one or more member types."), getAllNodes(union)); - } - - var includedTypeNames = Object.create(null); - - for (var _i24 = 0; _i24 < memberTypes.length; _i24++) { - var memberType = memberTypes[_i24]; - - if (includedTypeNames[memberType.name]) { - context.reportError("Union type ".concat(union.name, " can only include type ").concat(memberType.name, " once."), getUnionMemberTypeNodes(union, memberType.name)); - continue; - } - - includedTypeNames[memberType.name] = true; - - if (!(0, _definition.isObjectType)(memberType)) { - context.reportError("Union type ".concat(union.name, " can only include Object types, ") + "it cannot include ".concat((0, _inspect.default)(memberType), "."), getUnionMemberTypeNodes(union, String(memberType))); - } - } -} - -function validateEnumValues(context, enumType) { - var enumValues = enumType.getValues(); - - if (enumValues.length === 0) { - context.reportError("Enum type ".concat(enumType.name, " must define one or more values."), getAllNodes(enumType)); - } - - for (var _i26 = 0; _i26 < enumValues.length; _i26++) { - var enumValue = enumValues[_i26]; - var valueName = enumValue.name; // Ensure valid name. - - validateName(context, enumValue); - - if (valueName === 'true' || valueName === 'false' || valueName === 'null') { - context.reportError("Enum type ".concat(enumType.name, " cannot include value: ").concat(valueName, "."), enumValue.astNode); - } - } -} - -function validateInputFields(context, inputObj) { - var fields = (0, _objectValues5.default)(inputObj.getFields()); - - if (fields.length === 0) { - context.reportError("Input Object type ".concat(inputObj.name, " must define one or more fields."), getAllNodes(inputObj)); - } // Ensure the arguments are valid - - - for (var _i28 = 0; _i28 < fields.length; _i28++) { - var field = fields[_i28]; - // Ensure they are named correctly. - validateName(context, field); // Ensure the type is an input type - - if (!(0, _definition.isInputType)(field.type)) { - var _field$astNode2; - - context.reportError("The type of ".concat(inputObj.name, ".").concat(field.name, " must be Input Type ") + "but got: ".concat((0, _inspect.default)(field.type), "."), (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 ? void 0 : _field$astNode2.type); - } - - if ((0, _definition.isRequiredInputField)(field) && field.deprecationReason != null) { - var _field$astNode3; - - context.reportError("Required input field ".concat(inputObj.name, ".").concat(field.name, " cannot be deprecated."), [getDeprecatedDirectiveNode(field.astNode), // istanbul ignore next (TODO need to write coverage tests) - (_field$astNode3 = field.astNode) === null || _field$astNode3 === void 0 ? void 0 : _field$astNode3.type]); - } - } -} - -function createInputObjectCircularRefsValidator(context) { - // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. - // Tracks already visited types to maintain O(N) and to ensure that cycles - // are not redundantly reported. - var visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors - - var fieldPath = []; // Position in the type path - - var fieldPathIndexByTypeName = Object.create(null); - return detectCycleRecursive; // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - - function detectCycleRecursive(inputObj) { - if (visitedTypes[inputObj.name]) { - return; - } - - visitedTypes[inputObj.name] = true; - fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; - var fields = (0, _objectValues5.default)(inputObj.getFields()); - - for (var _i30 = 0; _i30 < fields.length; _i30++) { - var field = fields[_i30]; - - if ((0, _definition.isNonNullType)(field.type) && (0, _definition.isInputObjectType)(field.type.ofType)) { - var fieldType = field.type.ofType; - var cycleIndex = fieldPathIndexByTypeName[fieldType.name]; - fieldPath.push(field); - - if (cycleIndex === undefined) { - detectCycleRecursive(fieldType); - } else { - var cyclePath = fieldPath.slice(cycleIndex); - var pathStr = cyclePath.map(function (fieldObj) { - return fieldObj.name; - }).join('.'); - context.reportError("Cannot reference Input Object \"".concat(fieldType.name, "\" within itself through a series of non-null fields: \"").concat(pathStr, "\"."), cyclePath.map(function (fieldObj) { - return fieldObj.astNode; - })); - } - - fieldPath.pop(); - } - } - - fieldPathIndexByTypeName[inputObj.name] = undefined; - } -} - -function getAllNodes(object) { - var astNode = object.astNode, - extensionASTNodes = object.extensionASTNodes; - return astNode ? extensionASTNodes ? [astNode].concat(extensionASTNodes) : [astNode] : extensionASTNodes !== null && extensionASTNodes !== void 0 ? extensionASTNodes : []; -} - -function getAllSubNodes(object, getter) { - var subNodes = []; - - for (var _i32 = 0, _getAllNodes2 = getAllNodes(object); _i32 < _getAllNodes2.length; _i32++) { - var _getter; - - var node = _getAllNodes2[_i32]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - subNodes = subNodes.concat((_getter = getter(node)) !== null && _getter !== void 0 ? _getter : []); - } - - return subNodes; -} - -function getAllImplementsInterfaceNodes(type, iface) { - return getAllSubNodes(type, function (typeNode) { - return typeNode.interfaces; - }).filter(function (ifaceNode) { - return ifaceNode.name.value === iface.name; - }); -} - -function getUnionMemberTypeNodes(union, typeName) { - return getAllSubNodes(union, function (unionNode) { - return unionNode.types; - }).filter(function (typeNode) { - return typeNode.name.value === typeName; - }); -} - -function getDeprecatedDirectiveNode(definitionNode) { - var _definitionNode$direc; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - return definitionNode === null || definitionNode === void 0 ? void 0 : (_definitionNode$direc = definitionNode.directives) === null || _definitionNode$direc === void 0 ? void 0 : _definitionNode$direc.find(function (node) { - return node.name.value === _directives.GraphQLDeprecatedDirective.name; - }); -} diff --git a/node_modules/graphql/type/validate.js.flow b/node_modules/graphql/type/validate.js.flow deleted file mode 100644 index f870b207..00000000 --- a/node_modules/graphql/type/validate.js.flow +++ /dev/null @@ -1,670 +0,0 @@ -// @flow strict -import find from '../polyfills/find'; -import objectValues from '../polyfills/objectValues'; - -import inspect from '../jsutils/inspect'; - -import { GraphQLError } from '../error/GraphQLError'; -import { locatedError } from '../error/locatedError'; - -import type { - ASTNode, - NamedTypeNode, - DirectiveNode, - OperationTypeNode, -} from '../language/ast'; - -import { isValidNameError } from '../utilities/assertValidName'; -import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators'; - -import type { GraphQLSchema } from './schema'; -import type { - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, -} from './definition'; -import { assertSchema } from './schema'; -import { isIntrospectionType } from './introspection'; -import { isDirective, GraphQLDeprecatedDirective } from './directives'; -import { - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, - isNamedType, - isNonNullType, - isInputType, - isOutputType, - isRequiredArgument, - isRequiredInputField, -} from './definition'; - -/** - * Implements the "Type Validation" sub-sections of the specification's - * "Type System" section. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the Schema is valid. - */ -export function validateSchema( - schema: GraphQLSchema, -): $ReadOnlyArray { - // First check to ensure the provided value is in fact a GraphQLSchema. - assertSchema(schema); - - // If this Schema has already been validated, return the previous results. - if (schema.__validationErrors) { - return schema.__validationErrors; - } - - // Validate the schema, producing a list of errors. - const context = new SchemaValidationContext(schema); - validateRootTypes(context); - validateDirectives(context); - validateTypes(context); - - // Persist the results of validation before returning to ensure validation - // does not run multiple times for this schema. - const errors = context.getErrors(); - schema.__validationErrors = errors; - return errors; -} - -/** - * Utility function which asserts a schema is valid by throwing an error if - * it is invalid. - */ -export function assertValidSchema(schema: GraphQLSchema): void { - const errors = validateSchema(schema); - if (errors.length !== 0) { - throw new Error(errors.map((error) => error.message).join('\n\n')); - } -} - -class SchemaValidationContext { - +_errors: Array; - +schema: GraphQLSchema; - - constructor(schema) { - this._errors = []; - this.schema = schema; - } - - reportError( - message: string, - nodes?: $ReadOnlyArray | ?ASTNode, - ): void { - const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; - this.addError(new GraphQLError(message, _nodes)); - } - - addError(error: GraphQLError): void { - this._errors.push(error); - } - - getErrors(): $ReadOnlyArray { - return this._errors; - } -} - -function validateRootTypes(context: SchemaValidationContext): void { - const schema = context.schema; - const queryType = schema.getQueryType(); - if (!queryType) { - context.reportError('Query root type must be provided.', schema.astNode); - } else if (!isObjectType(queryType)) { - context.reportError( - `Query root type must be Object type, it cannot be ${inspect( - queryType, - )}.`, - getOperationTypeNode(schema, 'query') ?? queryType.astNode, - ); - } - - const mutationType = schema.getMutationType(); - if (mutationType && !isObjectType(mutationType)) { - context.reportError( - 'Mutation root type must be Object type if provided, it cannot be ' + - `${inspect(mutationType)}.`, - getOperationTypeNode(schema, 'mutation') ?? mutationType.astNode, - ); - } - - const subscriptionType = schema.getSubscriptionType(); - if (subscriptionType && !isObjectType(subscriptionType)) { - context.reportError( - 'Subscription root type must be Object type if provided, it cannot be ' + - `${inspect(subscriptionType)}.`, - getOperationTypeNode(schema, 'subscription') ?? subscriptionType.astNode, - ); - } -} - -function getOperationTypeNode( - schema: GraphQLSchema, - operation: OperationTypeNode, -): ?ASTNode { - const operationNodes = getAllSubNodes(schema, (node) => node.operationTypes); - for (const node of operationNodes) { - if (node.operation === operation) { - return node.type; - } - } - return undefined; -} - -function validateDirectives(context: SchemaValidationContext): void { - for (const directive of context.schema.getDirectives()) { - // Ensure all directives are in fact GraphQL directives. - if (!isDirective(directive)) { - context.reportError( - `Expected directive but got: ${inspect(directive)}.`, - directive?.astNode, - ); - continue; - } - - // Ensure they are named correctly. - validateName(context, directive); - - // TODO: Ensure proper locations. - - // Ensure the arguments are valid. - for (const arg of directive.args) { - // Ensure they are named correctly. - validateName(context, arg); - - // Ensure the type is an input type. - if (!isInputType(arg.type)) { - context.reportError( - `The type of @${directive.name}(${arg.name}:) must be Input Type ` + - `but got: ${inspect(arg.type)}.`, - arg.astNode, - ); - } - - if (isRequiredArgument(arg) && arg.deprecationReason != null) { - context.reportError( - `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(arg.astNode), - // istanbul ignore next (TODO need to write coverage tests) - arg.astNode?.type, - ], - ); - } - } - } -} - -function validateName( - context: SchemaValidationContext, - node: { +name: string, +astNode: ?ASTNode, ... }, -): void { - // Ensure names are valid, however introspection types opt out. - const error = isValidNameError(node.name); - if (error) { - context.addError(locatedError(error, node.astNode)); - } -} - -function validateTypes(context: SchemaValidationContext): void { - const validateInputObjectCircularRefs = createInputObjectCircularRefsValidator( - context, - ); - const typeMap = context.schema.getTypeMap(); - for (const type of objectValues(typeMap)) { - // Ensure all provided types are in fact GraphQL type. - if (!isNamedType(type)) { - context.reportError( - `Expected GraphQL named type but got: ${inspect(type)}.`, - type.astNode, - ); - continue; - } - - // Ensure it is named correctly (excluding introspection types). - if (!isIntrospectionType(type)) { - validateName(context, type); - } - - if (isObjectType(type)) { - // Ensure fields are valid - validateFields(context, type); - - // Ensure objects implement the interfaces they claim to. - validateInterfaces(context, type); - } else if (isInterfaceType(type)) { - // Ensure fields are valid. - validateFields(context, type); - - // Ensure interfaces implement the interfaces they claim to. - validateInterfaces(context, type); - } else if (isUnionType(type)) { - // Ensure Unions include valid member types. - validateUnionMembers(context, type); - } else if (isEnumType(type)) { - // Ensure Enums have valid values. - validateEnumValues(context, type); - } else if (isInputObjectType(type)) { - // Ensure Input Object fields are valid. - validateInputFields(context, type); - - // Ensure Input Objects do not contain non-nullable circular references - validateInputObjectCircularRefs(type); - } - } -} - -function validateFields( - context: SchemaValidationContext, - type: GraphQLObjectType | GraphQLInterfaceType, -): void { - const fields = objectValues(type.getFields()); - - // Objects and Interfaces both must define one or more fields. - if (fields.length === 0) { - context.reportError( - `Type ${type.name} must define one or more fields.`, - getAllNodes(type), - ); - } - - for (const field of fields) { - // Ensure they are named correctly. - validateName(context, field); - - // Ensure the type is an output type - if (!isOutputType(field.type)) { - context.reportError( - `The type of ${type.name}.${field.name} must be Output Type ` + - `but got: ${inspect(field.type)}.`, - field.astNode?.type, - ); - } - - // Ensure the arguments are valid - for (const arg of field.args) { - const argName = arg.name; - - // Ensure they are named correctly. - validateName(context, arg); - - // Ensure the type is an input type - if (!isInputType(arg.type)) { - context.reportError( - `The type of ${type.name}.${field.name}(${argName}:) must be Input ` + - `Type but got: ${inspect(arg.type)}.`, - arg.astNode?.type, - ); - } - - if (isRequiredArgument(arg) && arg.deprecationReason != null) { - context.reportError( - `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(arg.astNode), - // istanbul ignore next (TODO need to write coverage tests) - arg.astNode?.type, - ], - ); - } - } - } -} - -function validateInterfaces( - context: SchemaValidationContext, - type: GraphQLObjectType | GraphQLInterfaceType, -): void { - const ifaceTypeNames = Object.create(null); - for (const iface of type.getInterfaces()) { - if (!isInterfaceType(iface)) { - context.reportError( - `Type ${inspect(type)} must only implement Interface types, ` + - `it cannot implement ${inspect(iface)}.`, - getAllImplementsInterfaceNodes(type, iface), - ); - continue; - } - - if (type === iface) { - context.reportError( - `Type ${type.name} cannot implement itself because it would create a circular reference.`, - getAllImplementsInterfaceNodes(type, iface), - ); - continue; - } - - if (ifaceTypeNames[iface.name]) { - context.reportError( - `Type ${type.name} can only implement ${iface.name} once.`, - getAllImplementsInterfaceNodes(type, iface), - ); - continue; - } - - ifaceTypeNames[iface.name] = true; - - validateTypeImplementsAncestors(context, type, iface); - validateTypeImplementsInterface(context, type, iface); - } -} - -function validateTypeImplementsInterface( - context: SchemaValidationContext, - type: GraphQLObjectType | GraphQLInterfaceType, - iface: GraphQLInterfaceType, -): void { - const typeFieldMap = type.getFields(); - - // Assert each interface field is implemented. - for (const ifaceField of objectValues(iface.getFields())) { - const fieldName = ifaceField.name; - const typeField = typeFieldMap[fieldName]; - - // Assert interface field exists on type. - if (!typeField) { - context.reportError( - `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, - [ifaceField.astNode, ...getAllNodes(type)], - ); - continue; - } - - // Assert interface field type is satisfied by type field type, by being - // a valid subtype. (covariant) - if (!isTypeSubTypeOf(context.schema, typeField.type, ifaceField.type)) { - context.reportError( - `Interface field ${iface.name}.${fieldName} expects type ` + - `${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` + - `is type ${inspect(typeField.type)}.`, - [ - // istanbul ignore next (TODO need to write coverage tests) - ifaceField.astNode?.type, - // istanbul ignore next (TODO need to write coverage tests) - typeField.astNode?.type, - ], - ); - } - - // Assert each interface field arg is implemented. - for (const ifaceArg of ifaceField.args) { - const argName = ifaceArg.name; - const typeArg = find(typeField.args, (arg) => arg.name === argName); - - // Assert interface field arg exists on object field. - if (!typeArg) { - context.reportError( - `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, - [ifaceArg.astNode, typeField.astNode], - ); - continue; - } - - // Assert interface field arg type matches object field arg type. - // (invariant) - // TODO: change to contravariant? - if (!isEqualType(ifaceArg.type, typeArg.type)) { - context.reportError( - `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + - `expects type ${inspect(ifaceArg.type)} but ` + - `${type.name}.${fieldName}(${argName}:) is type ` + - `${inspect(typeArg.type)}.`, - [ - // istanbul ignore next (TODO need to write coverage tests) - ifaceArg.astNode?.type, - // istanbul ignore next (TODO need to write coverage tests) - typeArg.astNode?.type, - ], - ); - } - - // TODO: validate default values? - } - - // Assert additional arguments must not be required. - for (const typeArg of typeField.args) { - const argName = typeArg.name; - const ifaceArg = find(ifaceField.args, (arg) => arg.name === argName); - if (!ifaceArg && isRequiredArgument(typeArg)) { - context.reportError( - `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, - [typeArg.astNode, ifaceField.astNode], - ); - } - } - } -} - -function validateTypeImplementsAncestors( - context: SchemaValidationContext, - type: GraphQLObjectType | GraphQLInterfaceType, - iface: GraphQLInterfaceType, -): void { - const ifaceInterfaces = type.getInterfaces(); - for (const transitive of iface.getInterfaces()) { - if (ifaceInterfaces.indexOf(transitive) === -1) { - context.reportError( - transitive === type - ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.` - : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`, - [ - ...getAllImplementsInterfaceNodes(iface, transitive), - ...getAllImplementsInterfaceNodes(type, iface), - ], - ); - } - } -} - -function validateUnionMembers( - context: SchemaValidationContext, - union: GraphQLUnionType, -): void { - const memberTypes = union.getTypes(); - - if (memberTypes.length === 0) { - context.reportError( - `Union type ${union.name} must define one or more member types.`, - getAllNodes(union), - ); - } - - const includedTypeNames = Object.create(null); - for (const memberType of memberTypes) { - if (includedTypeNames[memberType.name]) { - context.reportError( - `Union type ${union.name} can only include type ${memberType.name} once.`, - getUnionMemberTypeNodes(union, memberType.name), - ); - continue; - } - includedTypeNames[memberType.name] = true; - if (!isObjectType(memberType)) { - context.reportError( - `Union type ${union.name} can only include Object types, ` + - `it cannot include ${inspect(memberType)}.`, - getUnionMemberTypeNodes(union, String(memberType)), - ); - } - } -} - -function validateEnumValues( - context: SchemaValidationContext, - enumType: GraphQLEnumType, -): void { - const enumValues = enumType.getValues(); - - if (enumValues.length === 0) { - context.reportError( - `Enum type ${enumType.name} must define one or more values.`, - getAllNodes(enumType), - ); - } - - for (const enumValue of enumValues) { - const valueName = enumValue.name; - - // Ensure valid name. - validateName(context, enumValue); - if (valueName === 'true' || valueName === 'false' || valueName === 'null') { - context.reportError( - `Enum type ${enumType.name} cannot include value: ${valueName}.`, - enumValue.astNode, - ); - } - } -} - -function validateInputFields( - context: SchemaValidationContext, - inputObj: GraphQLInputObjectType, -): void { - const fields = objectValues(inputObj.getFields()); - - if (fields.length === 0) { - context.reportError( - `Input Object type ${inputObj.name} must define one or more fields.`, - getAllNodes(inputObj), - ); - } - - // Ensure the arguments are valid - for (const field of fields) { - // Ensure they are named correctly. - validateName(context, field); - - // Ensure the type is an input type - if (!isInputType(field.type)) { - context.reportError( - `The type of ${inputObj.name}.${field.name} must be Input Type ` + - `but got: ${inspect(field.type)}.`, - field.astNode?.type, - ); - } - - if (isRequiredInputField(field) && field.deprecationReason != null) { - context.reportError( - `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(field.astNode), - // istanbul ignore next (TODO need to write coverage tests) - field.astNode?.type, - ], - ); - } - } -} - -function createInputObjectCircularRefsValidator( - context: SchemaValidationContext, -): (GraphQLInputObjectType) => void { - // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. - // Tracks already visited types to maintain O(N) and to ensure that cycles - // are not redundantly reported. - const visitedTypes = Object.create(null); - - // Array of types nodes used to produce meaningful errors - const fieldPath = []; - - // Position in the type path - const fieldPathIndexByTypeName = Object.create(null); - - return detectCycleRecursive; - - // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - function detectCycleRecursive(inputObj: GraphQLInputObjectType): void { - if (visitedTypes[inputObj.name]) { - return; - } - - visitedTypes[inputObj.name] = true; - fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; - - const fields = objectValues(inputObj.getFields()); - for (const field of fields) { - if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) { - const fieldType = field.type.ofType; - const cycleIndex = fieldPathIndexByTypeName[fieldType.name]; - - fieldPath.push(field); - if (cycleIndex === undefined) { - detectCycleRecursive(fieldType); - } else { - const cyclePath = fieldPath.slice(cycleIndex); - const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join('.'); - context.reportError( - `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, - cyclePath.map((fieldObj) => fieldObj.astNode), - ); - } - fieldPath.pop(); - } - } - - fieldPathIndexByTypeName[inputObj.name] = undefined; - } -} - -type SDLDefinedObject = { - +astNode: ?T, - +extensionASTNodes?: ?$ReadOnlyArray, - ... -}; - -function getAllNodes( - object: SDLDefinedObject, -): $ReadOnlyArray { - const { astNode, extensionASTNodes } = object; - return astNode - ? extensionASTNodes - ? [astNode].concat(extensionASTNodes) - : [astNode] - : extensionASTNodes ?? []; -} - -function getAllSubNodes( - object: SDLDefinedObject, - getter: (T | K) => ?(L | $ReadOnlyArray), -): $ReadOnlyArray { - let subNodes = []; - for (const node of getAllNodes(object)) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - subNodes = subNodes.concat(getter(node) ?? []); - } - return subNodes; -} - -function getAllImplementsInterfaceNodes( - type: GraphQLObjectType | GraphQLInterfaceType, - iface: GraphQLInterfaceType, -): $ReadOnlyArray { - return getAllSubNodes(type, (typeNode) => typeNode.interfaces).filter( - (ifaceNode) => ifaceNode.name.value === iface.name, - ); -} - -function getUnionMemberTypeNodes( - union: GraphQLUnionType, - typeName: string, -): ?$ReadOnlyArray { - return getAllSubNodes(union, (unionNode) => unionNode.types).filter( - (typeNode) => typeNode.name.value === typeName, - ); -} - -function getDeprecatedDirectiveNode( - definitionNode: ?{ +directives?: $ReadOnlyArray, ... }, -): ?DirectiveNode { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - return definitionNode?.directives?.find( - (node) => node.name.value === GraphQLDeprecatedDirective.name, - ); -} diff --git a/node_modules/graphql/type/validate.mjs b/node_modules/graphql/type/validate.mjs deleted file mode 100644 index ce9f7b01..00000000 --- a/node_modules/graphql/type/validate.mjs +++ /dev/null @@ -1,528 +0,0 @@ -import find from "../polyfills/find.mjs"; -import objectValues from "../polyfills/objectValues.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { locatedError } from "../error/locatedError.mjs"; -import { isValidNameError } from "../utilities/assertValidName.mjs"; -import { isEqualType, isTypeSubTypeOf } from "../utilities/typeComparators.mjs"; -import { assertSchema } from "./schema.mjs"; -import { isIntrospectionType } from "./introspection.mjs"; -import { isDirective, GraphQLDeprecatedDirective } from "./directives.mjs"; -import { isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isNamedType, isNonNullType, isInputType, isOutputType, isRequiredArgument, isRequiredInputField } from "./definition.mjs"; -/** - * Implements the "Type Validation" sub-sections of the specification's - * "Type System" section. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the Schema is valid. - */ - -export function validateSchema(schema) { - // First check to ensure the provided value is in fact a GraphQLSchema. - assertSchema(schema); // If this Schema has already been validated, return the previous results. - - if (schema.__validationErrors) { - return schema.__validationErrors; - } // Validate the schema, producing a list of errors. - - - var context = new SchemaValidationContext(schema); - validateRootTypes(context); - validateDirectives(context); - validateTypes(context); // Persist the results of validation before returning to ensure validation - // does not run multiple times for this schema. - - var errors = context.getErrors(); - schema.__validationErrors = errors; - return errors; -} -/** - * Utility function which asserts a schema is valid by throwing an error if - * it is invalid. - */ - -export function assertValidSchema(schema) { - var errors = validateSchema(schema); - - if (errors.length !== 0) { - throw new Error(errors.map(function (error) { - return error.message; - }).join('\n\n')); - } -} - -var SchemaValidationContext = /*#__PURE__*/function () { - function SchemaValidationContext(schema) { - this._errors = []; - this.schema = schema; - } - - var _proto = SchemaValidationContext.prototype; - - _proto.reportError = function reportError(message, nodes) { - var _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; - - this.addError(new GraphQLError(message, _nodes)); - }; - - _proto.addError = function addError(error) { - this._errors.push(error); - }; - - _proto.getErrors = function getErrors() { - return this._errors; - }; - - return SchemaValidationContext; -}(); - -function validateRootTypes(context) { - var schema = context.schema; - var queryType = schema.getQueryType(); - - if (!queryType) { - context.reportError('Query root type must be provided.', schema.astNode); - } else if (!isObjectType(queryType)) { - var _getOperationTypeNode; - - context.reportError("Query root type must be Object type, it cannot be ".concat(inspect(queryType), "."), (_getOperationTypeNode = getOperationTypeNode(schema, 'query')) !== null && _getOperationTypeNode !== void 0 ? _getOperationTypeNode : queryType.astNode); - } - - var mutationType = schema.getMutationType(); - - if (mutationType && !isObjectType(mutationType)) { - var _getOperationTypeNode2; - - context.reportError('Mutation root type must be Object type if provided, it cannot be ' + "".concat(inspect(mutationType), "."), (_getOperationTypeNode2 = getOperationTypeNode(schema, 'mutation')) !== null && _getOperationTypeNode2 !== void 0 ? _getOperationTypeNode2 : mutationType.astNode); - } - - var subscriptionType = schema.getSubscriptionType(); - - if (subscriptionType && !isObjectType(subscriptionType)) { - var _getOperationTypeNode3; - - context.reportError('Subscription root type must be Object type if provided, it cannot be ' + "".concat(inspect(subscriptionType), "."), (_getOperationTypeNode3 = getOperationTypeNode(schema, 'subscription')) !== null && _getOperationTypeNode3 !== void 0 ? _getOperationTypeNode3 : subscriptionType.astNode); - } -} - -function getOperationTypeNode(schema, operation) { - var operationNodes = getAllSubNodes(schema, function (node) { - return node.operationTypes; - }); - - for (var _i2 = 0; _i2 < operationNodes.length; _i2++) { - var node = operationNodes[_i2]; - - if (node.operation === operation) { - return node.type; - } - } - - return undefined; -} - -function validateDirectives(context) { - for (var _i4 = 0, _context$schema$getDi2 = context.schema.getDirectives(); _i4 < _context$schema$getDi2.length; _i4++) { - var directive = _context$schema$getDi2[_i4]; - - // Ensure all directives are in fact GraphQL directives. - if (!isDirective(directive)) { - context.reportError("Expected directive but got: ".concat(inspect(directive), "."), directive === null || directive === void 0 ? void 0 : directive.astNode); - continue; - } // Ensure they are named correctly. - - - validateName(context, directive); // TODO: Ensure proper locations. - // Ensure the arguments are valid. - - for (var _i6 = 0, _directive$args2 = directive.args; _i6 < _directive$args2.length; _i6++) { - var arg = _directive$args2[_i6]; - // Ensure they are named correctly. - validateName(context, arg); // Ensure the type is an input type. - - if (!isInputType(arg.type)) { - context.reportError("The type of @".concat(directive.name, "(").concat(arg.name, ":) must be Input Type ") + "but got: ".concat(inspect(arg.type), "."), arg.astNode); - } - - if (isRequiredArgument(arg) && arg.deprecationReason != null) { - var _arg$astNode; - - context.reportError("Required argument @".concat(directive.name, "(").concat(arg.name, ":) cannot be deprecated."), [getDeprecatedDirectiveNode(arg.astNode), // istanbul ignore next (TODO need to write coverage tests) - (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 ? void 0 : _arg$astNode.type]); - } - } - } -} - -function validateName(context, node) { - // Ensure names are valid, however introspection types opt out. - var error = isValidNameError(node.name); - - if (error) { - context.addError(locatedError(error, node.astNode)); - } -} - -function validateTypes(context) { - var validateInputObjectCircularRefs = createInputObjectCircularRefsValidator(context); - var typeMap = context.schema.getTypeMap(); - - for (var _i8 = 0, _objectValues2 = objectValues(typeMap); _i8 < _objectValues2.length; _i8++) { - var type = _objectValues2[_i8]; - - // Ensure all provided types are in fact GraphQL type. - if (!isNamedType(type)) { - context.reportError("Expected GraphQL named type but got: ".concat(inspect(type), "."), type.astNode); - continue; - } // Ensure it is named correctly (excluding introspection types). - - - if (!isIntrospectionType(type)) { - validateName(context, type); - } - - if (isObjectType(type)) { - // Ensure fields are valid - validateFields(context, type); // Ensure objects implement the interfaces they claim to. - - validateInterfaces(context, type); - } else if (isInterfaceType(type)) { - // Ensure fields are valid. - validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. - - validateInterfaces(context, type); - } else if (isUnionType(type)) { - // Ensure Unions include valid member types. - validateUnionMembers(context, type); - } else if (isEnumType(type)) { - // Ensure Enums have valid values. - validateEnumValues(context, type); - } else if (isInputObjectType(type)) { - // Ensure Input Object fields are valid. - validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references - - validateInputObjectCircularRefs(type); - } - } -} - -function validateFields(context, type) { - var fields = objectValues(type.getFields()); // Objects and Interfaces both must define one or more fields. - - if (fields.length === 0) { - context.reportError("Type ".concat(type.name, " must define one or more fields."), getAllNodes(type)); - } - - for (var _i10 = 0; _i10 < fields.length; _i10++) { - var field = fields[_i10]; - // Ensure they are named correctly. - validateName(context, field); // Ensure the type is an output type - - if (!isOutputType(field.type)) { - var _field$astNode; - - context.reportError("The type of ".concat(type.name, ".").concat(field.name, " must be Output Type ") + "but got: ".concat(inspect(field.type), "."), (_field$astNode = field.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type); - } // Ensure the arguments are valid - - - for (var _i12 = 0, _field$args2 = field.args; _i12 < _field$args2.length; _i12++) { - var arg = _field$args2[_i12]; - var argName = arg.name; // Ensure they are named correctly. - - validateName(context, arg); // Ensure the type is an input type - - if (!isInputType(arg.type)) { - var _arg$astNode2; - - context.reportError("The type of ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) must be Input ") + "Type but got: ".concat(inspect(arg.type), "."), (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type); - } - - if (isRequiredArgument(arg) && arg.deprecationReason != null) { - var _arg$astNode3; - - context.reportError("Required argument ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) cannot be deprecated."), [getDeprecatedDirectiveNode(arg.astNode), // istanbul ignore next (TODO need to write coverage tests) - (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 ? void 0 : _arg$astNode3.type]); - } - } - } -} - -function validateInterfaces(context, type) { - var ifaceTypeNames = Object.create(null); - - for (var _i14 = 0, _type$getInterfaces2 = type.getInterfaces(); _i14 < _type$getInterfaces2.length; _i14++) { - var iface = _type$getInterfaces2[_i14]; - - if (!isInterfaceType(iface)) { - context.reportError("Type ".concat(inspect(type), " must only implement Interface types, ") + "it cannot implement ".concat(inspect(iface), "."), getAllImplementsInterfaceNodes(type, iface)); - continue; - } - - if (type === iface) { - context.reportError("Type ".concat(type.name, " cannot implement itself because it would create a circular reference."), getAllImplementsInterfaceNodes(type, iface)); - continue; - } - - if (ifaceTypeNames[iface.name]) { - context.reportError("Type ".concat(type.name, " can only implement ").concat(iface.name, " once."), getAllImplementsInterfaceNodes(type, iface)); - continue; - } - - ifaceTypeNames[iface.name] = true; - validateTypeImplementsAncestors(context, type, iface); - validateTypeImplementsInterface(context, type, iface); - } -} - -function validateTypeImplementsInterface(context, type, iface) { - var typeFieldMap = type.getFields(); // Assert each interface field is implemented. - - for (var _i16 = 0, _objectValues4 = objectValues(iface.getFields()); _i16 < _objectValues4.length; _i16++) { - var ifaceField = _objectValues4[_i16]; - var fieldName = ifaceField.name; - var typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. - - if (!typeField) { - context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expected but ").concat(type.name, " does not provide it."), [ifaceField.astNode].concat(getAllNodes(type))); - continue; - } // Assert interface field type is satisfied by type field type, by being - // a valid subtype. (covariant) - - - if (!isTypeSubTypeOf(context.schema, typeField.type, ifaceField.type)) { - var _ifaceField$astNode, _typeField$astNode; - - context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expects type ") + "".concat(inspect(ifaceField.type), " but ").concat(type.name, ".").concat(fieldName, " ") + "is type ".concat(inspect(typeField.type), "."), [// istanbul ignore next (TODO need to write coverage tests) - (_ifaceField$astNode = ifaceField.astNode) === null || _ifaceField$astNode === void 0 ? void 0 : _ifaceField$astNode.type, // istanbul ignore next (TODO need to write coverage tests) - (_typeField$astNode = typeField.astNode) === null || _typeField$astNode === void 0 ? void 0 : _typeField$astNode.type]); - } // Assert each interface field arg is implemented. - - - var _loop = function _loop(_i18, _ifaceField$args2) { - var ifaceArg = _ifaceField$args2[_i18]; - var argName = ifaceArg.name; - var typeArg = find(typeField.args, function (arg) { - return arg.name === argName; - }); // Assert interface field arg exists on object field. - - if (!typeArg) { - context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) expected but ").concat(type.name, ".").concat(fieldName, " does not provide it."), [ifaceArg.astNode, typeField.astNode]); - return "continue"; - } // Assert interface field arg type matches object field arg type. - // (invariant) - // TODO: change to contravariant? - - - if (!isEqualType(ifaceArg.type, typeArg.type)) { - var _ifaceArg$astNode, _typeArg$astNode; - - context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) ") + "expects type ".concat(inspect(ifaceArg.type), " but ") + "".concat(type.name, ".").concat(fieldName, "(").concat(argName, ":) is type ") + "".concat(inspect(typeArg.type), "."), [// istanbul ignore next (TODO need to write coverage tests) - (_ifaceArg$astNode = ifaceArg.astNode) === null || _ifaceArg$astNode === void 0 ? void 0 : _ifaceArg$astNode.type, // istanbul ignore next (TODO need to write coverage tests) - (_typeArg$astNode = typeArg.astNode) === null || _typeArg$astNode === void 0 ? void 0 : _typeArg$astNode.type]); - } // TODO: validate default values? - - }; - - for (var _i18 = 0, _ifaceField$args2 = ifaceField.args; _i18 < _ifaceField$args2.length; _i18++) { - var _ret = _loop(_i18, _ifaceField$args2); - - if (_ret === "continue") continue; - } // Assert additional arguments must not be required. - - - var _loop2 = function _loop2(_i20, _typeField$args2) { - var typeArg = _typeField$args2[_i20]; - var argName = typeArg.name; - var ifaceArg = find(ifaceField.args, function (arg) { - return arg.name === argName; - }); - - if (!ifaceArg && isRequiredArgument(typeArg)) { - context.reportError("Object field ".concat(type.name, ".").concat(fieldName, " includes required argument ").concat(argName, " that is missing from the Interface field ").concat(iface.name, ".").concat(fieldName, "."), [typeArg.astNode, ifaceField.astNode]); - } - }; - - for (var _i20 = 0, _typeField$args2 = typeField.args; _i20 < _typeField$args2.length; _i20++) { - _loop2(_i20, _typeField$args2); - } - } -} - -function validateTypeImplementsAncestors(context, type, iface) { - var ifaceInterfaces = type.getInterfaces(); - - for (var _i22 = 0, _iface$getInterfaces2 = iface.getInterfaces(); _i22 < _iface$getInterfaces2.length; _i22++) { - var transitive = _iface$getInterfaces2[_i22]; - - if (ifaceInterfaces.indexOf(transitive) === -1) { - context.reportError(transitive === type ? "Type ".concat(type.name, " cannot implement ").concat(iface.name, " because it would create a circular reference.") : "Type ".concat(type.name, " must implement ").concat(transitive.name, " because it is implemented by ").concat(iface.name, "."), [].concat(getAllImplementsInterfaceNodes(iface, transitive), getAllImplementsInterfaceNodes(type, iface))); - } - } -} - -function validateUnionMembers(context, union) { - var memberTypes = union.getTypes(); - - if (memberTypes.length === 0) { - context.reportError("Union type ".concat(union.name, " must define one or more member types."), getAllNodes(union)); - } - - var includedTypeNames = Object.create(null); - - for (var _i24 = 0; _i24 < memberTypes.length; _i24++) { - var memberType = memberTypes[_i24]; - - if (includedTypeNames[memberType.name]) { - context.reportError("Union type ".concat(union.name, " can only include type ").concat(memberType.name, " once."), getUnionMemberTypeNodes(union, memberType.name)); - continue; - } - - includedTypeNames[memberType.name] = true; - - if (!isObjectType(memberType)) { - context.reportError("Union type ".concat(union.name, " can only include Object types, ") + "it cannot include ".concat(inspect(memberType), "."), getUnionMemberTypeNodes(union, String(memberType))); - } - } -} - -function validateEnumValues(context, enumType) { - var enumValues = enumType.getValues(); - - if (enumValues.length === 0) { - context.reportError("Enum type ".concat(enumType.name, " must define one or more values."), getAllNodes(enumType)); - } - - for (var _i26 = 0; _i26 < enumValues.length; _i26++) { - var enumValue = enumValues[_i26]; - var valueName = enumValue.name; // Ensure valid name. - - validateName(context, enumValue); - - if (valueName === 'true' || valueName === 'false' || valueName === 'null') { - context.reportError("Enum type ".concat(enumType.name, " cannot include value: ").concat(valueName, "."), enumValue.astNode); - } - } -} - -function validateInputFields(context, inputObj) { - var fields = objectValues(inputObj.getFields()); - - if (fields.length === 0) { - context.reportError("Input Object type ".concat(inputObj.name, " must define one or more fields."), getAllNodes(inputObj)); - } // Ensure the arguments are valid - - - for (var _i28 = 0; _i28 < fields.length; _i28++) { - var field = fields[_i28]; - // Ensure they are named correctly. - validateName(context, field); // Ensure the type is an input type - - if (!isInputType(field.type)) { - var _field$astNode2; - - context.reportError("The type of ".concat(inputObj.name, ".").concat(field.name, " must be Input Type ") + "but got: ".concat(inspect(field.type), "."), (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 ? void 0 : _field$astNode2.type); - } - - if (isRequiredInputField(field) && field.deprecationReason != null) { - var _field$astNode3; - - context.reportError("Required input field ".concat(inputObj.name, ".").concat(field.name, " cannot be deprecated."), [getDeprecatedDirectiveNode(field.astNode), // istanbul ignore next (TODO need to write coverage tests) - (_field$astNode3 = field.astNode) === null || _field$astNode3 === void 0 ? void 0 : _field$astNode3.type]); - } - } -} - -function createInputObjectCircularRefsValidator(context) { - // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. - // Tracks already visited types to maintain O(N) and to ensure that cycles - // are not redundantly reported. - var visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors - - var fieldPath = []; // Position in the type path - - var fieldPathIndexByTypeName = Object.create(null); - return detectCycleRecursive; // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - - function detectCycleRecursive(inputObj) { - if (visitedTypes[inputObj.name]) { - return; - } - - visitedTypes[inputObj.name] = true; - fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; - var fields = objectValues(inputObj.getFields()); - - for (var _i30 = 0; _i30 < fields.length; _i30++) { - var field = fields[_i30]; - - if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) { - var fieldType = field.type.ofType; - var cycleIndex = fieldPathIndexByTypeName[fieldType.name]; - fieldPath.push(field); - - if (cycleIndex === undefined) { - detectCycleRecursive(fieldType); - } else { - var cyclePath = fieldPath.slice(cycleIndex); - var pathStr = cyclePath.map(function (fieldObj) { - return fieldObj.name; - }).join('.'); - context.reportError("Cannot reference Input Object \"".concat(fieldType.name, "\" within itself through a series of non-null fields: \"").concat(pathStr, "\"."), cyclePath.map(function (fieldObj) { - return fieldObj.astNode; - })); - } - - fieldPath.pop(); - } - } - - fieldPathIndexByTypeName[inputObj.name] = undefined; - } -} - -function getAllNodes(object) { - var astNode = object.astNode, - extensionASTNodes = object.extensionASTNodes; - return astNode ? extensionASTNodes ? [astNode].concat(extensionASTNodes) : [astNode] : extensionASTNodes !== null && extensionASTNodes !== void 0 ? extensionASTNodes : []; -} - -function getAllSubNodes(object, getter) { - var subNodes = []; - - for (var _i32 = 0, _getAllNodes2 = getAllNodes(object); _i32 < _getAllNodes2.length; _i32++) { - var _getter; - - var node = _getAllNodes2[_i32]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - subNodes = subNodes.concat((_getter = getter(node)) !== null && _getter !== void 0 ? _getter : []); - } - - return subNodes; -} - -function getAllImplementsInterfaceNodes(type, iface) { - return getAllSubNodes(type, function (typeNode) { - return typeNode.interfaces; - }).filter(function (ifaceNode) { - return ifaceNode.name.value === iface.name; - }); -} - -function getUnionMemberTypeNodes(union, typeName) { - return getAllSubNodes(union, function (unionNode) { - return unionNode.types; - }).filter(function (typeNode) { - return typeNode.name.value === typeName; - }); -} - -function getDeprecatedDirectiveNode(definitionNode) { - var _definitionNode$direc; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - return definitionNode === null || definitionNode === void 0 ? void 0 : (_definitionNode$direc = definitionNode.directives) === null || _definitionNode$direc === void 0 ? void 0 : _definitionNode$direc.find(function (node) { - return node.name.value === GraphQLDeprecatedDirective.name; - }); -} diff --git a/node_modules/graphql/utilities/TypeInfo.d.ts b/node_modules/graphql/utilities/TypeInfo.d.ts deleted file mode 100644 index 499fb029..00000000 --- a/node_modules/graphql/utilities/TypeInfo.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { Visitor } from '../language/visitor'; -import { ASTNode, ASTKindToNode, FieldNode } from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; -import { GraphQLDirective } from '../type/directives'; -import { - GraphQLType, - GraphQLInputType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, - GraphQLArgument, - GraphQLEnumValue, -} from '../type/definition'; - -/** - * TypeInfo is a utility class which, given a GraphQL schema, can keep track - * of the current field and type definitions at any point in a GraphQL document - * AST during a recursive descent by calling `enter(node)` and `leave(node)`. - */ -export class TypeInfo { - constructor( - schema: GraphQLSchema, - // NOTE: this experimental optional second parameter is only needed in order - // to support non-spec-compliant code bases. You should never need to use it. - // It may disappear in the future. - getFieldDefFn?: getFieldDef, - // Initial type may be provided in rare cases to facilitate traversals - // beginning somewhere other than documents. - initialType?: GraphQLType, - ); - - getType(): Maybe; - getParentType(): Maybe; - getInputType(): Maybe; - getParentInputType(): Maybe; - getFieldDef(): GraphQLField>; - getDefaultValue(): Maybe; - getDirective(): Maybe; - getArgument(): Maybe; - getEnumValue(): Maybe; - enter(node: ASTNode): any; - leave(node: ASTNode): any; -} - -type getFieldDef = ( - schema: GraphQLSchema, - parentType: GraphQLType, - fieldNode: FieldNode, -) => Maybe>; - -/** - * Creates a new visitor instance which maintains a provided TypeInfo instance - * along with visiting visitor. - */ -export function visitWithTypeInfo( - typeInfo: TypeInfo, - visitor: Visitor, -): Visitor; diff --git a/node_modules/graphql/utilities/TypeInfo.js b/node_modules/graphql/utilities/TypeInfo.js deleted file mode 100644 index ccffc748..00000000 --- a/node_modules/graphql/utilities/TypeInfo.js +++ /dev/null @@ -1,397 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.visitWithTypeInfo = visitWithTypeInfo; -exports.TypeInfo = void 0; - -var _find = _interopRequireDefault(require("../polyfills/find.js")); - -var _kinds = require("../language/kinds.js"); - -var _ast = require("../language/ast.js"); - -var _visitor = require("../language/visitor.js"); - -var _definition = require("../type/definition.js"); - -var _introspection = require("../type/introspection.js"); - -var _typeFromAST = require("./typeFromAST.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * TypeInfo is a utility class which, given a GraphQL schema, can keep track - * of the current field and type definitions at any point in a GraphQL document - * AST during a recursive descent by calling `enter(node)` and `leave(node)`. - */ -var TypeInfo = /*#__PURE__*/function () { - function TypeInfo(schema, // NOTE: this experimental optional second parameter is only needed in order - // to support non-spec-compliant code bases. You should never need to use it. - // It may disappear in the future. - getFieldDefFn, // Initial type may be provided in rare cases to facilitate traversals - // beginning somewhere other than documents. - initialType) { - this._schema = schema; - this._typeStack = []; - this._parentTypeStack = []; - this._inputTypeStack = []; - this._fieldDefStack = []; - this._defaultValueStack = []; - this._directive = null; - this._argument = null; - this._enumValue = null; - this._getFieldDef = getFieldDefFn !== null && getFieldDefFn !== void 0 ? getFieldDefFn : getFieldDef; - - if (initialType) { - if ((0, _definition.isInputType)(initialType)) { - this._inputTypeStack.push(initialType); - } - - if ((0, _definition.isCompositeType)(initialType)) { - this._parentTypeStack.push(initialType); - } - - if ((0, _definition.isOutputType)(initialType)) { - this._typeStack.push(initialType); - } - } - } - - var _proto = TypeInfo.prototype; - - _proto.getType = function getType() { - if (this._typeStack.length > 0) { - return this._typeStack[this._typeStack.length - 1]; - } - }; - - _proto.getParentType = function getParentType() { - if (this._parentTypeStack.length > 0) { - return this._parentTypeStack[this._parentTypeStack.length - 1]; - } - }; - - _proto.getInputType = function getInputType() { - if (this._inputTypeStack.length > 0) { - return this._inputTypeStack[this._inputTypeStack.length - 1]; - } - }; - - _proto.getParentInputType = function getParentInputType() { - if (this._inputTypeStack.length > 1) { - return this._inputTypeStack[this._inputTypeStack.length - 2]; - } - }; - - _proto.getFieldDef = function getFieldDef() { - if (this._fieldDefStack.length > 0) { - return this._fieldDefStack[this._fieldDefStack.length - 1]; - } - }; - - _proto.getDefaultValue = function getDefaultValue() { - if (this._defaultValueStack.length > 0) { - return this._defaultValueStack[this._defaultValueStack.length - 1]; - } - }; - - _proto.getDirective = function getDirective() { - return this._directive; - }; - - _proto.getArgument = function getArgument() { - return this._argument; - }; - - _proto.getEnumValue = function getEnumValue() { - return this._enumValue; - }; - - _proto.enter = function enter(node) { - var schema = this._schema; // Note: many of the types below are explicitly typed as "mixed" to drop - // any assumptions of a valid schema to ensure runtime types are properly - // checked before continuing since TypeInfo is used as part of validation - // which occurs before guarantees of schema and document validity. - - switch (node.kind) { - case _kinds.Kind.SELECTION_SET: - { - var namedType = (0, _definition.getNamedType)(this.getType()); - - this._parentTypeStack.push((0, _definition.isCompositeType)(namedType) ? namedType : undefined); - - break; - } - - case _kinds.Kind.FIELD: - { - var parentType = this.getParentType(); - var fieldDef; - var fieldType; - - if (parentType) { - fieldDef = this._getFieldDef(schema, parentType, node); - - if (fieldDef) { - fieldType = fieldDef.type; - } - } - - this._fieldDefStack.push(fieldDef); - - this._typeStack.push((0, _definition.isOutputType)(fieldType) ? fieldType : undefined); - - break; - } - - case _kinds.Kind.DIRECTIVE: - this._directive = schema.getDirective(node.name.value); - break; - - case _kinds.Kind.OPERATION_DEFINITION: - { - var type; - - switch (node.operation) { - case 'query': - type = schema.getQueryType(); - break; - - case 'mutation': - type = schema.getMutationType(); - break; - - case 'subscription': - type = schema.getSubscriptionType(); - break; - } - - this._typeStack.push((0, _definition.isObjectType)(type) ? type : undefined); - - break; - } - - case _kinds.Kind.INLINE_FRAGMENT: - case _kinds.Kind.FRAGMENT_DEFINITION: - { - var typeConditionAST = node.typeCondition; - var outputType = typeConditionAST ? (0, _typeFromAST.typeFromAST)(schema, typeConditionAST) : (0, _definition.getNamedType)(this.getType()); - - this._typeStack.push((0, _definition.isOutputType)(outputType) ? outputType : undefined); - - break; - } - - case _kinds.Kind.VARIABLE_DEFINITION: - { - var inputType = (0, _typeFromAST.typeFromAST)(schema, node.type); - - this._inputTypeStack.push((0, _definition.isInputType)(inputType) ? inputType : undefined); - - break; - } - - case _kinds.Kind.ARGUMENT: - { - var _this$getDirective; - - var argDef; - var argType; - var fieldOrDirective = (_this$getDirective = this.getDirective()) !== null && _this$getDirective !== void 0 ? _this$getDirective : this.getFieldDef(); - - if (fieldOrDirective) { - argDef = (0, _find.default)(fieldOrDirective.args, function (arg) { - return arg.name === node.name.value; - }); - - if (argDef) { - argType = argDef.type; - } - } - - this._argument = argDef; - - this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); - - this._inputTypeStack.push((0, _definition.isInputType)(argType) ? argType : undefined); - - break; - } - - case _kinds.Kind.LIST: - { - var listType = (0, _definition.getNullableType)(this.getInputType()); - var itemType = (0, _definition.isListType)(listType) ? listType.ofType : listType; // List positions never have a default value. - - this._defaultValueStack.push(undefined); - - this._inputTypeStack.push((0, _definition.isInputType)(itemType) ? itemType : undefined); - - break; - } - - case _kinds.Kind.OBJECT_FIELD: - { - var objectType = (0, _definition.getNamedType)(this.getInputType()); - var inputFieldType; - var inputField; - - if ((0, _definition.isInputObjectType)(objectType)) { - inputField = objectType.getFields()[node.name.value]; - - if (inputField) { - inputFieldType = inputField.type; - } - } - - this._defaultValueStack.push(inputField ? inputField.defaultValue : undefined); - - this._inputTypeStack.push((0, _definition.isInputType)(inputFieldType) ? inputFieldType : undefined); - - break; - } - - case _kinds.Kind.ENUM: - { - var enumType = (0, _definition.getNamedType)(this.getInputType()); - var enumValue; - - if ((0, _definition.isEnumType)(enumType)) { - enumValue = enumType.getValue(node.value); - } - - this._enumValue = enumValue; - break; - } - } - }; - - _proto.leave = function leave(node) { - switch (node.kind) { - case _kinds.Kind.SELECTION_SET: - this._parentTypeStack.pop(); - - break; - - case _kinds.Kind.FIELD: - this._fieldDefStack.pop(); - - this._typeStack.pop(); - - break; - - case _kinds.Kind.DIRECTIVE: - this._directive = null; - break; - - case _kinds.Kind.OPERATION_DEFINITION: - case _kinds.Kind.INLINE_FRAGMENT: - case _kinds.Kind.FRAGMENT_DEFINITION: - this._typeStack.pop(); - - break; - - case _kinds.Kind.VARIABLE_DEFINITION: - this._inputTypeStack.pop(); - - break; - - case _kinds.Kind.ARGUMENT: - this._argument = null; - - this._defaultValueStack.pop(); - - this._inputTypeStack.pop(); - - break; - - case _kinds.Kind.LIST: - case _kinds.Kind.OBJECT_FIELD: - this._defaultValueStack.pop(); - - this._inputTypeStack.pop(); - - break; - - case _kinds.Kind.ENUM: - this._enumValue = null; - break; - } - }; - - return TypeInfo; -}(); -/** - * Not exactly the same as the executor's definition of getFieldDef, in this - * statically evaluated environment we do not always have an Object type, - * and need to handle Interface and Union types. - */ - - -exports.TypeInfo = TypeInfo; - -function getFieldDef(schema, parentType, fieldNode) { - var name = fieldNode.name.value; - - if (name === _introspection.SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { - return _introspection.SchemaMetaFieldDef; - } - - if (name === _introspection.TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return _introspection.TypeMetaFieldDef; - } - - if (name === _introspection.TypeNameMetaFieldDef.name && (0, _definition.isCompositeType)(parentType)) { - return _introspection.TypeNameMetaFieldDef; - } - - if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) { - return parentType.getFields()[name]; - } -} -/** - * Creates a new visitor instance which maintains a provided TypeInfo instance - * along with visiting visitor. - */ - - -function visitWithTypeInfo(typeInfo, visitor) { - return { - enter: function enter(node) { - typeInfo.enter(node); - var fn = (0, _visitor.getVisitFn)(visitor, node.kind, - /* isLeaving */ - false); - - if (fn) { - var result = fn.apply(visitor, arguments); - - if (result !== undefined) { - typeInfo.leave(node); - - if ((0, _ast.isNode)(result)) { - typeInfo.enter(result); - } - } - - return result; - } - }, - leave: function leave(node) { - var fn = (0, _visitor.getVisitFn)(visitor, node.kind, - /* isLeaving */ - true); - var result; - - if (fn) { - result = fn.apply(visitor, arguments); - } - - typeInfo.leave(node); - return result; - } - }; -} diff --git a/node_modules/graphql/utilities/TypeInfo.js.flow b/node_modules/graphql/utilities/TypeInfo.js.flow deleted file mode 100644 index b844f295..00000000 --- a/node_modules/graphql/utilities/TypeInfo.js.flow +++ /dev/null @@ -1,359 +0,0 @@ -// @flow strict -import find from '../polyfills/find'; - -import type { Visitor } from '../language/visitor'; -import type { ASTNode, ASTKindToNode, FieldNode } from '../language/ast'; -import { Kind } from '../language/kinds'; -import { isNode } from '../language/ast'; -import { getVisitFn } from '../language/visitor'; - -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLDirective } from '../type/directives'; -import type { - GraphQLType, - GraphQLInputType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, - GraphQLArgument, - GraphQLInputField, - GraphQLEnumValue, -} from '../type/definition'; -import { - isObjectType, - isInterfaceType, - isEnumType, - isInputObjectType, - isListType, - isCompositeType, - isInputType, - isOutputType, - getNullableType, - getNamedType, -} from '../type/definition'; -import { - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, -} from '../type/introspection'; - -import { typeFromAST } from './typeFromAST'; - -/** - * TypeInfo is a utility class which, given a GraphQL schema, can keep track - * of the current field and type definitions at any point in a GraphQL document - * AST during a recursive descent by calling `enter(node)` and `leave(node)`. - */ -export class TypeInfo { - _schema: GraphQLSchema; - _typeStack: Array; - _parentTypeStack: Array; - _inputTypeStack: Array; - _fieldDefStack: Array>; - _defaultValueStack: Array; - _directive: ?GraphQLDirective; - _argument: ?GraphQLArgument; - _enumValue: ?GraphQLEnumValue; - _getFieldDef: typeof getFieldDef; - - constructor( - schema: GraphQLSchema, - // NOTE: this experimental optional second parameter is only needed in order - // to support non-spec-compliant code bases. You should never need to use it. - // It may disappear in the future. - getFieldDefFn?: typeof getFieldDef, - // Initial type may be provided in rare cases to facilitate traversals - // beginning somewhere other than documents. - initialType?: GraphQLType, - ): void { - this._schema = schema; - this._typeStack = []; - this._parentTypeStack = []; - this._inputTypeStack = []; - this._fieldDefStack = []; - this._defaultValueStack = []; - this._directive = null; - this._argument = null; - this._enumValue = null; - this._getFieldDef = getFieldDefFn ?? getFieldDef; - if (initialType) { - if (isInputType(initialType)) { - this._inputTypeStack.push(initialType); - } - if (isCompositeType(initialType)) { - this._parentTypeStack.push(initialType); - } - if (isOutputType(initialType)) { - this._typeStack.push(initialType); - } - } - } - - getType(): ?GraphQLOutputType { - if (this._typeStack.length > 0) { - return this._typeStack[this._typeStack.length - 1]; - } - } - - getParentType(): ?GraphQLCompositeType { - if (this._parentTypeStack.length > 0) { - return this._parentTypeStack[this._parentTypeStack.length - 1]; - } - } - - getInputType(): ?GraphQLInputType { - if (this._inputTypeStack.length > 0) { - return this._inputTypeStack[this._inputTypeStack.length - 1]; - } - } - - getParentInputType(): ?GraphQLInputType { - if (this._inputTypeStack.length > 1) { - return this._inputTypeStack[this._inputTypeStack.length - 2]; - } - } - - getFieldDef(): ?GraphQLField { - if (this._fieldDefStack.length > 0) { - return this._fieldDefStack[this._fieldDefStack.length - 1]; - } - } - - getDefaultValue(): ?mixed { - if (this._defaultValueStack.length > 0) { - return this._defaultValueStack[this._defaultValueStack.length - 1]; - } - } - - getDirective(): ?GraphQLDirective { - return this._directive; - } - - getArgument(): ?GraphQLArgument { - return this._argument; - } - - getEnumValue(): ?GraphQLEnumValue { - return this._enumValue; - } - - enter(node: ASTNode) { - const schema = this._schema; - // Note: many of the types below are explicitly typed as "mixed" to drop - // any assumptions of a valid schema to ensure runtime types are properly - // checked before continuing since TypeInfo is used as part of validation - // which occurs before guarantees of schema and document validity. - switch (node.kind) { - case Kind.SELECTION_SET: { - const namedType: mixed = getNamedType(this.getType()); - this._parentTypeStack.push( - isCompositeType(namedType) ? namedType : undefined, - ); - break; - } - case Kind.FIELD: { - const parentType = this.getParentType(); - let fieldDef; - let fieldType: mixed; - if (parentType) { - fieldDef = this._getFieldDef(schema, parentType, node); - if (fieldDef) { - fieldType = fieldDef.type; - } - } - this._fieldDefStack.push(fieldDef); - this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined); - break; - } - case Kind.DIRECTIVE: - this._directive = schema.getDirective(node.name.value); - break; - case Kind.OPERATION_DEFINITION: { - let type: mixed; - switch (node.operation) { - case 'query': - type = schema.getQueryType(); - break; - case 'mutation': - type = schema.getMutationType(); - break; - case 'subscription': - type = schema.getSubscriptionType(); - break; - } - this._typeStack.push(isObjectType(type) ? type : undefined); - break; - } - case Kind.INLINE_FRAGMENT: - case Kind.FRAGMENT_DEFINITION: { - const typeConditionAST = node.typeCondition; - const outputType: mixed = typeConditionAST - ? typeFromAST(schema, typeConditionAST) - : getNamedType(this.getType()); - this._typeStack.push(isOutputType(outputType) ? outputType : undefined); - break; - } - case Kind.VARIABLE_DEFINITION: { - const inputType: mixed = typeFromAST(schema, node.type); - this._inputTypeStack.push( - isInputType(inputType) ? inputType : undefined, - ); - break; - } - case Kind.ARGUMENT: { - let argDef; - let argType: mixed; - const fieldOrDirective = this.getDirective() ?? this.getFieldDef(); - if (fieldOrDirective) { - argDef = find( - fieldOrDirective.args, - (arg) => arg.name === node.name.value, - ); - if (argDef) { - argType = argDef.type; - } - } - this._argument = argDef; - this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); - this._inputTypeStack.push(isInputType(argType) ? argType : undefined); - break; - } - case Kind.LIST: { - const listType: mixed = getNullableType(this.getInputType()); - const itemType: mixed = isListType(listType) - ? listType.ofType - : listType; - // List positions never have a default value. - this._defaultValueStack.push(undefined); - this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined); - break; - } - case Kind.OBJECT_FIELD: { - const objectType: mixed = getNamedType(this.getInputType()); - let inputFieldType: GraphQLInputType | void; - let inputField: GraphQLInputField | void; - if (isInputObjectType(objectType)) { - inputField = objectType.getFields()[node.name.value]; - if (inputField) { - inputFieldType = inputField.type; - } - } - this._defaultValueStack.push( - inputField ? inputField.defaultValue : undefined, - ); - this._inputTypeStack.push( - isInputType(inputFieldType) ? inputFieldType : undefined, - ); - break; - } - case Kind.ENUM: { - const enumType: mixed = getNamedType(this.getInputType()); - let enumValue; - if (isEnumType(enumType)) { - enumValue = enumType.getValue(node.value); - } - this._enumValue = enumValue; - break; - } - } - } - - leave(node: ASTNode) { - switch (node.kind) { - case Kind.SELECTION_SET: - this._parentTypeStack.pop(); - break; - case Kind.FIELD: - this._fieldDefStack.pop(); - this._typeStack.pop(); - break; - case Kind.DIRECTIVE: - this._directive = null; - break; - case Kind.OPERATION_DEFINITION: - case Kind.INLINE_FRAGMENT: - case Kind.FRAGMENT_DEFINITION: - this._typeStack.pop(); - break; - case Kind.VARIABLE_DEFINITION: - this._inputTypeStack.pop(); - break; - case Kind.ARGUMENT: - this._argument = null; - this._defaultValueStack.pop(); - this._inputTypeStack.pop(); - break; - case Kind.LIST: - case Kind.OBJECT_FIELD: - this._defaultValueStack.pop(); - this._inputTypeStack.pop(); - break; - case Kind.ENUM: - this._enumValue = null; - break; - } - } -} - -/** - * Not exactly the same as the executor's definition of getFieldDef, in this - * statically evaluated environment we do not always have an Object type, - * and need to handle Interface and Union types. - */ -function getFieldDef( - schema: GraphQLSchema, - parentType: GraphQLType, - fieldNode: FieldNode, -): ?GraphQLField { - const name = fieldNode.name.value; - if ( - name === SchemaMetaFieldDef.name && - schema.getQueryType() === parentType - ) { - return SchemaMetaFieldDef; - } - if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return TypeMetaFieldDef; - } - if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) { - return TypeNameMetaFieldDef; - } - if (isObjectType(parentType) || isInterfaceType(parentType)) { - return parentType.getFields()[name]; - } -} - -/** - * Creates a new visitor instance which maintains a provided TypeInfo instance - * along with visiting visitor. - */ -export function visitWithTypeInfo( - typeInfo: TypeInfo, - visitor: Visitor, -): Visitor { - return { - enter(node) { - typeInfo.enter(node); - const fn = getVisitFn(visitor, node.kind, /* isLeaving */ false); - if (fn) { - const result = fn.apply(visitor, arguments); - if (result !== undefined) { - typeInfo.leave(node); - if (isNode(result)) { - typeInfo.enter(result); - } - } - return result; - } - }, - leave(node) { - const fn = getVisitFn(visitor, node.kind, /* isLeaving */ true); - let result; - if (fn) { - result = fn.apply(visitor, arguments); - } - typeInfo.leave(node); - return result; - }, - }; -} diff --git a/node_modules/graphql/utilities/TypeInfo.mjs b/node_modules/graphql/utilities/TypeInfo.mjs deleted file mode 100644 index 00e988f3..00000000 --- a/node_modules/graphql/utilities/TypeInfo.mjs +++ /dev/null @@ -1,378 +0,0 @@ -import find from "../polyfills/find.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { isNode } from "../language/ast.mjs"; -import { getVisitFn } from "../language/visitor.mjs"; -import { isObjectType, isInterfaceType, isEnumType, isInputObjectType, isListType, isCompositeType, isInputType, isOutputType, getNullableType, getNamedType } from "../type/definition.mjs"; -import { SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from "../type/introspection.mjs"; -import { typeFromAST } from "./typeFromAST.mjs"; -/** - * TypeInfo is a utility class which, given a GraphQL schema, can keep track - * of the current field and type definitions at any point in a GraphQL document - * AST during a recursive descent by calling `enter(node)` and `leave(node)`. - */ - -export var TypeInfo = /*#__PURE__*/function () { - function TypeInfo(schema, // NOTE: this experimental optional second parameter is only needed in order - // to support non-spec-compliant code bases. You should never need to use it. - // It may disappear in the future. - getFieldDefFn, // Initial type may be provided in rare cases to facilitate traversals - // beginning somewhere other than documents. - initialType) { - this._schema = schema; - this._typeStack = []; - this._parentTypeStack = []; - this._inputTypeStack = []; - this._fieldDefStack = []; - this._defaultValueStack = []; - this._directive = null; - this._argument = null; - this._enumValue = null; - this._getFieldDef = getFieldDefFn !== null && getFieldDefFn !== void 0 ? getFieldDefFn : getFieldDef; - - if (initialType) { - if (isInputType(initialType)) { - this._inputTypeStack.push(initialType); - } - - if (isCompositeType(initialType)) { - this._parentTypeStack.push(initialType); - } - - if (isOutputType(initialType)) { - this._typeStack.push(initialType); - } - } - } - - var _proto = TypeInfo.prototype; - - _proto.getType = function getType() { - if (this._typeStack.length > 0) { - return this._typeStack[this._typeStack.length - 1]; - } - }; - - _proto.getParentType = function getParentType() { - if (this._parentTypeStack.length > 0) { - return this._parentTypeStack[this._parentTypeStack.length - 1]; - } - }; - - _proto.getInputType = function getInputType() { - if (this._inputTypeStack.length > 0) { - return this._inputTypeStack[this._inputTypeStack.length - 1]; - } - }; - - _proto.getParentInputType = function getParentInputType() { - if (this._inputTypeStack.length > 1) { - return this._inputTypeStack[this._inputTypeStack.length - 2]; - } - }; - - _proto.getFieldDef = function getFieldDef() { - if (this._fieldDefStack.length > 0) { - return this._fieldDefStack[this._fieldDefStack.length - 1]; - } - }; - - _proto.getDefaultValue = function getDefaultValue() { - if (this._defaultValueStack.length > 0) { - return this._defaultValueStack[this._defaultValueStack.length - 1]; - } - }; - - _proto.getDirective = function getDirective() { - return this._directive; - }; - - _proto.getArgument = function getArgument() { - return this._argument; - }; - - _proto.getEnumValue = function getEnumValue() { - return this._enumValue; - }; - - _proto.enter = function enter(node) { - var schema = this._schema; // Note: many of the types below are explicitly typed as "mixed" to drop - // any assumptions of a valid schema to ensure runtime types are properly - // checked before continuing since TypeInfo is used as part of validation - // which occurs before guarantees of schema and document validity. - - switch (node.kind) { - case Kind.SELECTION_SET: - { - var namedType = getNamedType(this.getType()); - - this._parentTypeStack.push(isCompositeType(namedType) ? namedType : undefined); - - break; - } - - case Kind.FIELD: - { - var parentType = this.getParentType(); - var fieldDef; - var fieldType; - - if (parentType) { - fieldDef = this._getFieldDef(schema, parentType, node); - - if (fieldDef) { - fieldType = fieldDef.type; - } - } - - this._fieldDefStack.push(fieldDef); - - this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined); - - break; - } - - case Kind.DIRECTIVE: - this._directive = schema.getDirective(node.name.value); - break; - - case Kind.OPERATION_DEFINITION: - { - var type; - - switch (node.operation) { - case 'query': - type = schema.getQueryType(); - break; - - case 'mutation': - type = schema.getMutationType(); - break; - - case 'subscription': - type = schema.getSubscriptionType(); - break; - } - - this._typeStack.push(isObjectType(type) ? type : undefined); - - break; - } - - case Kind.INLINE_FRAGMENT: - case Kind.FRAGMENT_DEFINITION: - { - var typeConditionAST = node.typeCondition; - var outputType = typeConditionAST ? typeFromAST(schema, typeConditionAST) : getNamedType(this.getType()); - - this._typeStack.push(isOutputType(outputType) ? outputType : undefined); - - break; - } - - case Kind.VARIABLE_DEFINITION: - { - var inputType = typeFromAST(schema, node.type); - - this._inputTypeStack.push(isInputType(inputType) ? inputType : undefined); - - break; - } - - case Kind.ARGUMENT: - { - var _this$getDirective; - - var argDef; - var argType; - var fieldOrDirective = (_this$getDirective = this.getDirective()) !== null && _this$getDirective !== void 0 ? _this$getDirective : this.getFieldDef(); - - if (fieldOrDirective) { - argDef = find(fieldOrDirective.args, function (arg) { - return arg.name === node.name.value; - }); - - if (argDef) { - argType = argDef.type; - } - } - - this._argument = argDef; - - this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); - - this._inputTypeStack.push(isInputType(argType) ? argType : undefined); - - break; - } - - case Kind.LIST: - { - var listType = getNullableType(this.getInputType()); - var itemType = isListType(listType) ? listType.ofType : listType; // List positions never have a default value. - - this._defaultValueStack.push(undefined); - - this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined); - - break; - } - - case Kind.OBJECT_FIELD: - { - var objectType = getNamedType(this.getInputType()); - var inputFieldType; - var inputField; - - if (isInputObjectType(objectType)) { - inputField = objectType.getFields()[node.name.value]; - - if (inputField) { - inputFieldType = inputField.type; - } - } - - this._defaultValueStack.push(inputField ? inputField.defaultValue : undefined); - - this._inputTypeStack.push(isInputType(inputFieldType) ? inputFieldType : undefined); - - break; - } - - case Kind.ENUM: - { - var enumType = getNamedType(this.getInputType()); - var enumValue; - - if (isEnumType(enumType)) { - enumValue = enumType.getValue(node.value); - } - - this._enumValue = enumValue; - break; - } - } - }; - - _proto.leave = function leave(node) { - switch (node.kind) { - case Kind.SELECTION_SET: - this._parentTypeStack.pop(); - - break; - - case Kind.FIELD: - this._fieldDefStack.pop(); - - this._typeStack.pop(); - - break; - - case Kind.DIRECTIVE: - this._directive = null; - break; - - case Kind.OPERATION_DEFINITION: - case Kind.INLINE_FRAGMENT: - case Kind.FRAGMENT_DEFINITION: - this._typeStack.pop(); - - break; - - case Kind.VARIABLE_DEFINITION: - this._inputTypeStack.pop(); - - break; - - case Kind.ARGUMENT: - this._argument = null; - - this._defaultValueStack.pop(); - - this._inputTypeStack.pop(); - - break; - - case Kind.LIST: - case Kind.OBJECT_FIELD: - this._defaultValueStack.pop(); - - this._inputTypeStack.pop(); - - break; - - case Kind.ENUM: - this._enumValue = null; - break; - } - }; - - return TypeInfo; -}(); -/** - * Not exactly the same as the executor's definition of getFieldDef, in this - * statically evaluated environment we do not always have an Object type, - * and need to handle Interface and Union types. - */ - -function getFieldDef(schema, parentType, fieldNode) { - var name = fieldNode.name.value; - - if (name === SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { - return SchemaMetaFieldDef; - } - - if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return TypeMetaFieldDef; - } - - if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) { - return TypeNameMetaFieldDef; - } - - if (isObjectType(parentType) || isInterfaceType(parentType)) { - return parentType.getFields()[name]; - } -} -/** - * Creates a new visitor instance which maintains a provided TypeInfo instance - * along with visiting visitor. - */ - - -export function visitWithTypeInfo(typeInfo, visitor) { - return { - enter: function enter(node) { - typeInfo.enter(node); - var fn = getVisitFn(visitor, node.kind, - /* isLeaving */ - false); - - if (fn) { - var result = fn.apply(visitor, arguments); - - if (result !== undefined) { - typeInfo.leave(node); - - if (isNode(result)) { - typeInfo.enter(result); - } - } - - return result; - } - }, - leave: function leave(node) { - var fn = getVisitFn(visitor, node.kind, - /* isLeaving */ - true); - var result; - - if (fn) { - result = fn.apply(visitor, arguments); - } - - typeInfo.leave(node); - return result; - } - }; -} diff --git a/node_modules/graphql/utilities/assertValidName.d.ts b/node_modules/graphql/utilities/assertValidName.d.ts deleted file mode 100644 index 5a1011e7..00000000 --- a/node_modules/graphql/utilities/assertValidName.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { GraphQLError } from '../error/GraphQLError'; - -/** - * Upholds the spec rules about naming. - */ -export function assertValidName(name: string): string; - -/** - * Returns an Error if a name is invalid. - */ -export function isValidNameError(name: string): GraphQLError | undefined; diff --git a/node_modules/graphql/utilities/assertValidName.js b/node_modules/graphql/utilities/assertValidName.js deleted file mode 100644 index 5affb006..00000000 --- a/node_modules/graphql/utilities/assertValidName.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.assertValidName = assertValidName; -exports.isValidNameError = isValidNameError; - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _GraphQLError = require("../error/GraphQLError.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/; -/** - * Upholds the spec rules about naming. - */ - -function assertValidName(name) { - var error = isValidNameError(name); - - if (error) { - throw error; - } - - return name; -} -/** - * Returns an Error if a name is invalid. - */ - - -function isValidNameError(name) { - typeof name === 'string' || (0, _devAssert.default)(0, 'Expected name to be a string.'); - - if (name.length > 1 && name[0] === '_' && name[1] === '_') { - return new _GraphQLError.GraphQLError("Name \"".concat(name, "\" must not begin with \"__\", which is reserved by GraphQL introspection.")); - } - - if (!NAME_RX.test(name)) { - return new _GraphQLError.GraphQLError("Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"".concat(name, "\" does not.")); - } -} diff --git a/node_modules/graphql/utilities/assertValidName.js.flow b/node_modules/graphql/utilities/assertValidName.js.flow deleted file mode 100644 index 2e2493a5..00000000 --- a/node_modules/graphql/utilities/assertValidName.js.flow +++ /dev/null @@ -1,34 +0,0 @@ -// @flow strict -import devAssert from '../jsutils/devAssert'; - -import { GraphQLError } from '../error/GraphQLError'; - -const NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/; - -/** - * Upholds the spec rules about naming. - */ -export function assertValidName(name: string): string { - const error = isValidNameError(name); - if (error) { - throw error; - } - return name; -} - -/** - * Returns an Error if a name is invalid. - */ -export function isValidNameError(name: string): GraphQLError | void { - devAssert(typeof name === 'string', 'Expected name to be a string.'); - if (name.length > 1 && name[0] === '_' && name[1] === '_') { - return new GraphQLError( - `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, - ); - } - if (!NAME_RX.test(name)) { - return new GraphQLError( - `Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "${name}" does not.`, - ); - } -} diff --git a/node_modules/graphql/utilities/assertValidName.mjs b/node_modules/graphql/utilities/assertValidName.mjs deleted file mode 100644 index d504d22a..00000000 --- a/node_modules/graphql/utilities/assertValidName.mjs +++ /dev/null @@ -1,31 +0,0 @@ -import devAssert from "../jsutils/devAssert.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -var NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/; -/** - * Upholds the spec rules about naming. - */ - -export function assertValidName(name) { - var error = isValidNameError(name); - - if (error) { - throw error; - } - - return name; -} -/** - * Returns an Error if a name is invalid. - */ - -export function isValidNameError(name) { - typeof name === 'string' || devAssert(0, 'Expected name to be a string.'); - - if (name.length > 1 && name[0] === '_' && name[1] === '_') { - return new GraphQLError("Name \"".concat(name, "\" must not begin with \"__\", which is reserved by GraphQL introspection.")); - } - - if (!NAME_RX.test(name)) { - return new GraphQLError("Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"".concat(name, "\" does not.")); - } -} diff --git a/node_modules/graphql/utilities/astFromValue.d.ts b/node_modules/graphql/utilities/astFromValue.d.ts deleted file mode 100644 index 19f0a8fe..00000000 --- a/node_modules/graphql/utilities/astFromValue.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { ValueNode } from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; - -/** - * Produces a GraphQL Value AST given a JavaScript value. - * - * A GraphQL type must be provided, which will be used to interpret different - * JavaScript values. - * - * | JSON Value | GraphQL Value | - * | ------------- | -------------------- | - * | Object | Input Object | - * | Array | List | - * | Boolean | Boolean | - * | String | String / Enum Value | - * | Number | Int / Float | - * | Mixed | Enum Value | - * | null | NullValue | - * - */ -export function astFromValue( - value: any, - type: GraphQLInputType, -): Maybe; diff --git a/node_modules/graphql/utilities/astFromValue.js b/node_modules/graphql/utilities/astFromValue.js deleted file mode 100644 index ab5abead..00000000 --- a/node_modules/graphql/utilities/astFromValue.js +++ /dev/null @@ -1,198 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.astFromValue = astFromValue; - -var _isFinite = _interopRequireDefault(require("../polyfills/isFinite.js")); - -var _arrayFrom3 = _interopRequireDefault(require("../polyfills/arrayFrom.js")); - -var _objectValues3 = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _isCollection = _interopRequireDefault(require("../jsutils/isCollection.js")); - -var _kinds = require("../language/kinds.js"); - -var _scalars = require("../type/scalars.js"); - -var _definition = require("../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Produces a GraphQL Value AST given a JavaScript object. - * Function will match JavaScript/JSON values to GraphQL AST schema format - * by using suggested GraphQLInputType. For example: - * - * astFromValue("value", GraphQLString) - * - * A GraphQL type must be provided, which will be used to interpret different - * JavaScript values. - * - * | JSON Value | GraphQL Value | - * | ------------- | -------------------- | - * | Object | Input Object | - * | Array | List | - * | Boolean | Boolean | - * | String | String / Enum Value | - * | Number | Int / Float | - * | Mixed | Enum Value | - * | null | NullValue | - * - */ -function astFromValue(value, type) { - if ((0, _definition.isNonNullType)(type)) { - var astValue = astFromValue(value, type.ofType); - - if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _kinds.Kind.NULL) { - return null; - } - - return astValue; - } // only explicit null, not undefined, NaN - - - if (value === null) { - return { - kind: _kinds.Kind.NULL - }; - } // undefined - - - if (value === undefined) { - return null; - } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but - // the value is not an array, convert the value using the list's item type. - - - if ((0, _definition.isListType)(type)) { - var itemType = type.ofType; - - if ((0, _isCollection.default)(value)) { - var valuesNodes = []; // Since we transpile for-of in loose mode it doesn't support iterators - // and it's required to first convert iteratable into array - - for (var _i2 = 0, _arrayFrom2 = (0, _arrayFrom3.default)(value); _i2 < _arrayFrom2.length; _i2++) { - var item = _arrayFrom2[_i2]; - var itemNode = astFromValue(item, itemType); - - if (itemNode != null) { - valuesNodes.push(itemNode); - } - } - - return { - kind: _kinds.Kind.LIST, - values: valuesNodes - }; - } - - return astFromValue(value, itemType); - } // Populate the fields of the input object by creating ASTs from each value - // in the JavaScript object according to the fields in the input type. - - - if ((0, _definition.isInputObjectType)(type)) { - if (!(0, _isObjectLike.default)(value)) { - return null; - } - - var fieldNodes = []; - - for (var _i4 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i4 < _objectValues2.length; _i4++) { - var field = _objectValues2[_i4]; - var fieldValue = astFromValue(value[field.name], field.type); - - if (fieldValue) { - fieldNodes.push({ - kind: _kinds.Kind.OBJECT_FIELD, - name: { - kind: _kinds.Kind.NAME, - value: field.name - }, - value: fieldValue - }); - } - } - - return { - kind: _kinds.Kind.OBJECT, - fields: fieldNodes - }; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isLeafType)(type)) { - // Since value is an internally represented value, it must be serialized - // to an externally represented value before converting into an AST. - var serialized = type.serialize(value); - - if (serialized == null) { - return null; - } // Others serialize based on their corresponding JavaScript scalar types. - - - if (typeof serialized === 'boolean') { - return { - kind: _kinds.Kind.BOOLEAN, - value: serialized - }; - } // JavaScript numbers can be Int or Float values. - - - if (typeof serialized === 'number' && (0, _isFinite.default)(serialized)) { - var stringNum = String(serialized); - return integerStringRegExp.test(stringNum) ? { - kind: _kinds.Kind.INT, - value: stringNum - } : { - kind: _kinds.Kind.FLOAT, - value: stringNum - }; - } - - if (typeof serialized === 'string') { - // Enum types use Enum literals. - if ((0, _definition.isEnumType)(type)) { - return { - kind: _kinds.Kind.ENUM, - value: serialized - }; - } // ID types can use Int literals. - - - if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) { - return { - kind: _kinds.Kind.INT, - value: serialized - }; - } - - return { - kind: _kinds.Kind.STRING, - value: serialized - }; - } - - throw new TypeError("Cannot convert value to AST: ".concat((0, _inspect.default)(serialized), ".")); - } // istanbul ignore next (Not reachable. All possible input types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type)); -} -/** - * IntValue: - * - NegativeSign? 0 - * - NegativeSign? NonZeroDigit ( Digit+ )? - */ - - -var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/node_modules/graphql/utilities/astFromValue.js.flow b/node_modules/graphql/utilities/astFromValue.js.flow deleted file mode 100644 index 38a20b02..00000000 --- a/node_modules/graphql/utilities/astFromValue.js.flow +++ /dev/null @@ -1,154 +0,0 @@ -// @flow strict -import isFinite from '../polyfills/isFinite'; -import arrayFrom from '../polyfills/arrayFrom'; -import objectValues from '../polyfills/objectValues'; - -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; -import isObjectLike from '../jsutils/isObjectLike'; -import isCollection from '../jsutils/isCollection'; - -import type { ValueNode } from '../language/ast'; -import { Kind } from '../language/kinds'; - -import type { GraphQLInputType } from '../type/definition'; -import { GraphQLID } from '../type/scalars'; -import { - isLeafType, - isEnumType, - isInputObjectType, - isListType, - isNonNullType, -} from '../type/definition'; - -/** - * Produces a GraphQL Value AST given a JavaScript object. - * Function will match JavaScript/JSON values to GraphQL AST schema format - * by using suggested GraphQLInputType. For example: - * - * astFromValue("value", GraphQLString) - * - * A GraphQL type must be provided, which will be used to interpret different - * JavaScript values. - * - * | JSON Value | GraphQL Value | - * | ------------- | -------------------- | - * | Object | Input Object | - * | Array | List | - * | Boolean | Boolean | - * | String | String / Enum Value | - * | Number | Int / Float | - * | Mixed | Enum Value | - * | null | NullValue | - * - */ -export function astFromValue(value: mixed, type: GraphQLInputType): ?ValueNode { - if (isNonNullType(type)) { - const astValue = astFromValue(value, type.ofType); - if (astValue?.kind === Kind.NULL) { - return null; - } - return astValue; - } - - // only explicit null, not undefined, NaN - if (value === null) { - return { kind: Kind.NULL }; - } - - // undefined - if (value === undefined) { - return null; - } - - // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but - // the value is not an array, convert the value using the list's item type. - if (isListType(type)) { - const itemType = type.ofType; - if (isCollection(value)) { - const valuesNodes = []; - // Since we transpile for-of in loose mode it doesn't support iterators - // and it's required to first convert iteratable into array - for (const item of arrayFrom(value)) { - const itemNode = astFromValue(item, itemType); - if (itemNode != null) { - valuesNodes.push(itemNode); - } - } - return { kind: Kind.LIST, values: valuesNodes }; - } - return astFromValue(value, itemType); - } - - // Populate the fields of the input object by creating ASTs from each value - // in the JavaScript object according to the fields in the input type. - if (isInputObjectType(type)) { - if (!isObjectLike(value)) { - return null; - } - const fieldNodes = []; - for (const field of objectValues(type.getFields())) { - const fieldValue = astFromValue(value[field.name], field.type); - if (fieldValue) { - fieldNodes.push({ - kind: Kind.OBJECT_FIELD, - name: { kind: Kind.NAME, value: field.name }, - value: fieldValue, - }); - } - } - return { kind: Kind.OBJECT, fields: fieldNodes }; - } - - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isLeafType(type)) { - // Since value is an internally represented value, it must be serialized - // to an externally represented value before converting into an AST. - const serialized = type.serialize(value); - if (serialized == null) { - return null; - } - - // Others serialize based on their corresponding JavaScript scalar types. - if (typeof serialized === 'boolean') { - return { kind: Kind.BOOLEAN, value: serialized }; - } - - // JavaScript numbers can be Int or Float values. - if (typeof serialized === 'number' && isFinite(serialized)) { - const stringNum = String(serialized); - return integerStringRegExp.test(stringNum) - ? { kind: Kind.INT, value: stringNum } - : { kind: Kind.FLOAT, value: stringNum }; - } - - if (typeof serialized === 'string') { - // Enum types use Enum literals. - if (isEnumType(type)) { - return { kind: Kind.ENUM, value: serialized }; - } - - // ID types can use Int literals. - if (type === GraphQLID && integerStringRegExp.test(serialized)) { - return { kind: Kind.INT, value: serialized }; - } - - return { - kind: Kind.STRING, - value: serialized, - }; - } - - throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`); - } - - // istanbul ignore next (Not reachable. All possible input types have been considered) - invariant(false, 'Unexpected input type: ' + inspect((type: empty))); -} - -/** - * IntValue: - * - NegativeSign? 0 - * - NegativeSign? NonZeroDigit ( Digit+ )? - */ -const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/node_modules/graphql/utilities/astFromValue.mjs b/node_modules/graphql/utilities/astFromValue.mjs deleted file mode 100644 index af91bb3b..00000000 --- a/node_modules/graphql/utilities/astFromValue.mjs +++ /dev/null @@ -1,179 +0,0 @@ -import isFinite from "../polyfills/isFinite.mjs"; -import arrayFrom from "../polyfills/arrayFrom.mjs"; -import objectValues from "../polyfills/objectValues.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import isCollection from "../jsutils/isCollection.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { GraphQLID } from "../type/scalars.mjs"; -import { isLeafType, isEnumType, isInputObjectType, isListType, isNonNullType } from "../type/definition.mjs"; -/** - * Produces a GraphQL Value AST given a JavaScript object. - * Function will match JavaScript/JSON values to GraphQL AST schema format - * by using suggested GraphQLInputType. For example: - * - * astFromValue("value", GraphQLString) - * - * A GraphQL type must be provided, which will be used to interpret different - * JavaScript values. - * - * | JSON Value | GraphQL Value | - * | ------------- | -------------------- | - * | Object | Input Object | - * | Array | List | - * | Boolean | Boolean | - * | String | String / Enum Value | - * | Number | Int / Float | - * | Mixed | Enum Value | - * | null | NullValue | - * - */ - -export function astFromValue(value, type) { - if (isNonNullType(type)) { - var astValue = astFromValue(value, type.ofType); - - if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === Kind.NULL) { - return null; - } - - return astValue; - } // only explicit null, not undefined, NaN - - - if (value === null) { - return { - kind: Kind.NULL - }; - } // undefined - - - if (value === undefined) { - return null; - } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but - // the value is not an array, convert the value using the list's item type. - - - if (isListType(type)) { - var itemType = type.ofType; - - if (isCollection(value)) { - var valuesNodes = []; // Since we transpile for-of in loose mode it doesn't support iterators - // and it's required to first convert iteratable into array - - for (var _i2 = 0, _arrayFrom2 = arrayFrom(value); _i2 < _arrayFrom2.length; _i2++) { - var item = _arrayFrom2[_i2]; - var itemNode = astFromValue(item, itemType); - - if (itemNode != null) { - valuesNodes.push(itemNode); - } - } - - return { - kind: Kind.LIST, - values: valuesNodes - }; - } - - return astFromValue(value, itemType); - } // Populate the fields of the input object by creating ASTs from each value - // in the JavaScript object according to the fields in the input type. - - - if (isInputObjectType(type)) { - if (!isObjectLike(value)) { - return null; - } - - var fieldNodes = []; - - for (var _i4 = 0, _objectValues2 = objectValues(type.getFields()); _i4 < _objectValues2.length; _i4++) { - var field = _objectValues2[_i4]; - var fieldValue = astFromValue(value[field.name], field.type); - - if (fieldValue) { - fieldNodes.push({ - kind: Kind.OBJECT_FIELD, - name: { - kind: Kind.NAME, - value: field.name - }, - value: fieldValue - }); - } - } - - return { - kind: Kind.OBJECT, - fields: fieldNodes - }; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isLeafType(type)) { - // Since value is an internally represented value, it must be serialized - // to an externally represented value before converting into an AST. - var serialized = type.serialize(value); - - if (serialized == null) { - return null; - } // Others serialize based on their corresponding JavaScript scalar types. - - - if (typeof serialized === 'boolean') { - return { - kind: Kind.BOOLEAN, - value: serialized - }; - } // JavaScript numbers can be Int or Float values. - - - if (typeof serialized === 'number' && isFinite(serialized)) { - var stringNum = String(serialized); - return integerStringRegExp.test(stringNum) ? { - kind: Kind.INT, - value: stringNum - } : { - kind: Kind.FLOAT, - value: stringNum - }; - } - - if (typeof serialized === 'string') { - // Enum types use Enum literals. - if (isEnumType(type)) { - return { - kind: Kind.ENUM, - value: serialized - }; - } // ID types can use Int literals. - - - if (type === GraphQLID && integerStringRegExp.test(serialized)) { - return { - kind: Kind.INT, - value: serialized - }; - } - - return { - kind: Kind.STRING, - value: serialized - }; - } - - throw new TypeError("Cannot convert value to AST: ".concat(inspect(serialized), ".")); - } // istanbul ignore next (Not reachable. All possible input types have been considered) - - - false || invariant(0, 'Unexpected input type: ' + inspect(type)); -} -/** - * IntValue: - * - NegativeSign? 0 - * - NegativeSign? NonZeroDigit ( Digit+ )? - */ - -var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/node_modules/graphql/utilities/buildASTSchema.d.ts b/node_modules/graphql/utilities/buildASTSchema.d.ts deleted file mode 100644 index e0514369..00000000 --- a/node_modules/graphql/utilities/buildASTSchema.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { DocumentNode } from '../language/ast'; -import { Source } from '../language/source'; -import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema'; -import { ParseOptions } from '../language/parser'; - -export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * This option is provided to ease adoption and will be removed in v16. - * - * Default: false - */ - commentDescriptions?: boolean; - - /** - * Set to true to assume the SDL is valid. - * - * Default: false - */ - assumeValidSDL?: boolean; -} - -/** - * This takes the ast of a schema document produced by the parse function in - * src/language/parser.js. - * - * If no schema definition is provided, then it will look for types named Query - * and Mutation. - * - * Given that AST it constructs a GraphQLSchema. The resulting schema - * has no resolve methods, so execution will use default resolvers. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function buildASTSchema( - documentAST: DocumentNode, - options?: BuildSchemaOptions, -): GraphQLSchema; - -/** - * A helper function to build a GraphQLSchema directly from a source - * document. - */ -export function buildSchema( - source: string | Source, - options?: BuildSchemaOptions & ParseOptions, -): GraphQLSchema; diff --git a/node_modules/graphql/utilities/buildASTSchema.js b/node_modules/graphql/utilities/buildASTSchema.js deleted file mode 100644 index 859e869f..00000000 --- a/node_modules/graphql/utilities/buildASTSchema.js +++ /dev/null @@ -1,117 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.buildASTSchema = buildASTSchema; -exports.buildSchema = buildSchema; - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _kinds = require("../language/kinds.js"); - -var _parser = require("../language/parser.js"); - -var _validate = require("../validation/validate.js"); - -var _schema = require("../type/schema.js"); - -var _directives = require("../type/directives.js"); - -var _extendSchema = require("./extendSchema.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * This takes the ast of a schema document produced by the parse function in - * src/language/parser.js. - * - * If no schema definition is provided, then it will look for types named Query - * and Mutation. - * - * Given that AST it constructs a GraphQLSchema. The resulting schema - * has no resolve methods, so execution will use default resolvers. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -function buildASTSchema(documentAST, options) { - documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT || (0, _devAssert.default)(0, 'Must provide valid Document AST.'); - - if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { - (0, _validate.assertValidSDL)(documentAST); - } - - var emptySchemaConfig = { - description: undefined, - types: [], - directives: [], - extensions: undefined, - extensionASTNodes: [], - assumeValid: false - }; - var config = (0, _extendSchema.extendSchemaImpl)(emptySchemaConfig, documentAST, options); - - if (config.astNode == null) { - for (var _i2 = 0, _config$types2 = config.types; _i2 < _config$types2.length; _i2++) { - var type = _config$types2[_i2]; - - switch (type.name) { - // Note: While this could make early assertions to get the correctly - // typed values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - case 'Query': - config.query = type; - break; - - case 'Mutation': - config.mutation = type; - break; - - case 'Subscription': - config.subscription = type; - break; - } - } - } - - var directives = config.directives; // If specified directives were not explicitly declared, add them. - - var _loop = function _loop(_i4) { - var stdDirective = _directives.specifiedDirectives[_i4]; - - if (directives.every(function (directive) { - return directive.name !== stdDirective.name; - })) { - directives.push(stdDirective); - } - }; - - for (var _i4 = 0; _i4 < _directives.specifiedDirectives.length; _i4++) { - _loop(_i4); - } - - return new _schema.GraphQLSchema(config); -} -/** - * A helper function to build a GraphQLSchema directly from a source - * document. - */ - - -function buildSchema(source, options) { - var document = (0, _parser.parse)(source, { - noLocation: options === null || options === void 0 ? void 0 : options.noLocation, - allowLegacySDLEmptyFields: options === null || options === void 0 ? void 0 : options.allowLegacySDLEmptyFields, - allowLegacySDLImplementsInterfaces: options === null || options === void 0 ? void 0 : options.allowLegacySDLImplementsInterfaces, - experimentalFragmentVariables: options === null || options === void 0 ? void 0 : options.experimentalFragmentVariables - }); - return buildASTSchema(document, { - commentDescriptions: options === null || options === void 0 ? void 0 : options.commentDescriptions, - assumeValidSDL: options === null || options === void 0 ? void 0 : options.assumeValidSDL, - assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid - }); -} diff --git a/node_modules/graphql/utilities/buildASTSchema.js.flow b/node_modules/graphql/utilities/buildASTSchema.js.flow deleted file mode 100644 index a271c8c6..00000000 --- a/node_modules/graphql/utilities/buildASTSchema.js.flow +++ /dev/null @@ -1,129 +0,0 @@ -// @flow strict -import devAssert from '../jsutils/devAssert'; - -import type { Source } from '../language/source'; -import type { DocumentNode } from '../language/ast'; -import type { ParseOptions } from '../language/parser'; -import { Kind } from '../language/kinds'; -import { parse } from '../language/parser'; - -import { assertValidSDL } from '../validation/validate'; - -import type { GraphQLSchemaValidationOptions } from '../type/schema'; -import { GraphQLSchema } from '../type/schema'; -import { specifiedDirectives } from '../type/directives'; - -import { extendSchemaImpl } from './extendSchema'; - -export type BuildSchemaOptions = {| - ...GraphQLSchemaValidationOptions, - - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * This option is provided to ease adoption and will be removed in v16. - * - * Default: false - */ - commentDescriptions?: boolean, - - /** - * Set to true to assume the SDL is valid. - * - * Default: false - */ - assumeValidSDL?: boolean, -|}; - -/** - * This takes the ast of a schema document produced by the parse function in - * src/language/parser.js. - * - * If no schema definition is provided, then it will look for types named Query - * and Mutation. - * - * Given that AST it constructs a GraphQLSchema. The resulting schema - * has no resolve methods, so execution will use default resolvers. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function buildASTSchema( - documentAST: DocumentNode, - options?: BuildSchemaOptions, -): GraphQLSchema { - devAssert( - documentAST != null && documentAST.kind === Kind.DOCUMENT, - 'Must provide valid Document AST.', - ); - - if (options?.assumeValid !== true && options?.assumeValidSDL !== true) { - assertValidSDL(documentAST); - } - - const emptySchemaConfig = { - description: undefined, - types: [], - directives: [], - extensions: undefined, - extensionASTNodes: [], - assumeValid: false, - }; - const config = extendSchemaImpl(emptySchemaConfig, documentAST, options); - - if (config.astNode == null) { - for (const type of config.types) { - switch (type.name) { - // Note: While this could make early assertions to get the correctly - // typed values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - case 'Query': - config.query = (type: any); - break; - case 'Mutation': - config.mutation = (type: any); - break; - case 'Subscription': - config.subscription = (type: any); - break; - } - } - } - - const { directives } = config; - // If specified directives were not explicitly declared, add them. - for (const stdDirective of specifiedDirectives) { - if (directives.every((directive) => directive.name !== stdDirective.name)) { - directives.push(stdDirective); - } - } - - return new GraphQLSchema(config); -} - -/** - * A helper function to build a GraphQLSchema directly from a source - * document. - */ -export function buildSchema( - source: string | Source, - options?: {| ...BuildSchemaOptions, ...ParseOptions |}, -): GraphQLSchema { - const document = parse(source, { - noLocation: options?.noLocation, - allowLegacySDLEmptyFields: options?.allowLegacySDLEmptyFields, - allowLegacySDLImplementsInterfaces: - options?.allowLegacySDLImplementsInterfaces, - experimentalFragmentVariables: options?.experimentalFragmentVariables, - }); - - return buildASTSchema(document, { - commentDescriptions: options?.commentDescriptions, - assumeValidSDL: options?.assumeValidSDL, - assumeValid: options?.assumeValid, - }); -} diff --git a/node_modules/graphql/utilities/buildASTSchema.mjs b/node_modules/graphql/utilities/buildASTSchema.mjs deleted file mode 100644 index 8c4d4b11..00000000 --- a/node_modules/graphql/utilities/buildASTSchema.mjs +++ /dev/null @@ -1,100 +0,0 @@ -import devAssert from "../jsutils/devAssert.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { parse } from "../language/parser.mjs"; -import { assertValidSDL } from "../validation/validate.mjs"; -import { GraphQLSchema } from "../type/schema.mjs"; -import { specifiedDirectives } from "../type/directives.mjs"; -import { extendSchemaImpl } from "./extendSchema.mjs"; - -/** - * This takes the ast of a schema document produced by the parse function in - * src/language/parser.js. - * - * If no schema definition is provided, then it will look for types named Query - * and Mutation. - * - * Given that AST it constructs a GraphQLSchema. The resulting schema - * has no resolve methods, so execution will use default resolvers. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function buildASTSchema(documentAST, options) { - documentAST != null && documentAST.kind === Kind.DOCUMENT || devAssert(0, 'Must provide valid Document AST.'); - - if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { - assertValidSDL(documentAST); - } - - var emptySchemaConfig = { - description: undefined, - types: [], - directives: [], - extensions: undefined, - extensionASTNodes: [], - assumeValid: false - }; - var config = extendSchemaImpl(emptySchemaConfig, documentAST, options); - - if (config.astNode == null) { - for (var _i2 = 0, _config$types2 = config.types; _i2 < _config$types2.length; _i2++) { - var type = _config$types2[_i2]; - - switch (type.name) { - // Note: While this could make early assertions to get the correctly - // typed values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - case 'Query': - config.query = type; - break; - - case 'Mutation': - config.mutation = type; - break; - - case 'Subscription': - config.subscription = type; - break; - } - } - } - - var directives = config.directives; // If specified directives were not explicitly declared, add them. - - var _loop = function _loop(_i4) { - var stdDirective = specifiedDirectives[_i4]; - - if (directives.every(function (directive) { - return directive.name !== stdDirective.name; - })) { - directives.push(stdDirective); - } - }; - - for (var _i4 = 0; _i4 < specifiedDirectives.length; _i4++) { - _loop(_i4); - } - - return new GraphQLSchema(config); -} -/** - * A helper function to build a GraphQLSchema directly from a source - * document. - */ - -export function buildSchema(source, options) { - var document = parse(source, { - noLocation: options === null || options === void 0 ? void 0 : options.noLocation, - allowLegacySDLEmptyFields: options === null || options === void 0 ? void 0 : options.allowLegacySDLEmptyFields, - allowLegacySDLImplementsInterfaces: options === null || options === void 0 ? void 0 : options.allowLegacySDLImplementsInterfaces, - experimentalFragmentVariables: options === null || options === void 0 ? void 0 : options.experimentalFragmentVariables - }); - return buildASTSchema(document, { - commentDescriptions: options === null || options === void 0 ? void 0 : options.commentDescriptions, - assumeValidSDL: options === null || options === void 0 ? void 0 : options.assumeValidSDL, - assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid - }); -} diff --git a/node_modules/graphql/utilities/buildClientSchema.d.ts b/node_modules/graphql/utilities/buildClientSchema.d.ts deleted file mode 100644 index a541cd30..00000000 --- a/node_modules/graphql/utilities/buildClientSchema.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema'; - -import { IntrospectionQuery } from './getIntrospectionQuery'; - -/** - * Build a GraphQLSchema for use by client tools. - * - * Given the result of a client running the introspection query, creates and - * returns a GraphQLSchema instance which can be then used with all graphql-js - * tools, but cannot be used to execute a query, as introspection does not - * represent the "resolver", "parse" or "serialize" functions or any other - * server-internal mechanisms. - * - * This function expects a complete introspection result. Don't forget to check - * the "errors" field of a server response before calling this function. - */ -export function buildClientSchema( - introspection: IntrospectionQuery, - options?: GraphQLSchemaValidationOptions, -): GraphQLSchema; diff --git a/node_modules/graphql/utilities/buildClientSchema.js b/node_modules/graphql/utilities/buildClientSchema.js deleted file mode 100644 index b9caa68f..00000000 --- a/node_modules/graphql/utilities/buildClientSchema.js +++ /dev/null @@ -1,334 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.buildClientSchema = buildClientSchema; - -var _objectValues = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _parser = require("../language/parser.js"); - -var _schema = require("../type/schema.js"); - -var _directives = require("../type/directives.js"); - -var _scalars = require("../type/scalars.js"); - -var _introspection = require("../type/introspection.js"); - -var _definition = require("../type/definition.js"); - -var _valueFromAST = require("./valueFromAST.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Build a GraphQLSchema for use by client tools. - * - * Given the result of a client running the introspection query, creates and - * returns a GraphQLSchema instance which can be then used with all graphql-js - * tools, but cannot be used to execute a query, as introspection does not - * represent the "resolver", "parse" or "serialize" functions or any other - * server-internal mechanisms. - * - * This function expects a complete introspection result. Don't forget to check - * the "errors" field of a server response before calling this function. - */ -function buildClientSchema(introspection, options) { - (0, _isObjectLike.default)(introspection) && (0, _isObjectLike.default)(introspection.__schema) || (0, _devAssert.default)(0, "Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: ".concat((0, _inspect.default)(introspection), ".")); // Get the schema from the introspection result. - - var schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. - - var typeMap = (0, _keyValMap.default)(schemaIntrospection.types, function (typeIntrospection) { - return typeIntrospection.name; - }, function (typeIntrospection) { - return buildType(typeIntrospection); - }); // Include standard types only if they are used. - - for (var _i2 = 0, _ref2 = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes); _i2 < _ref2.length; _i2++) { - var stdType = _ref2[_i2]; - - if (typeMap[stdType.name]) { - typeMap[stdType.name] = stdType; - } - } // Get the root Query, Mutation, and Subscription types. - - - var queryType = schemaIntrospection.queryType ? getObjectType(schemaIntrospection.queryType) : null; - var mutationType = schemaIntrospection.mutationType ? getObjectType(schemaIntrospection.mutationType) : null; - var subscriptionType = schemaIntrospection.subscriptionType ? getObjectType(schemaIntrospection.subscriptionType) : null; // Get the directives supported by Introspection, assuming empty-set if - // directives were not queried for. - - var directives = schemaIntrospection.directives ? schemaIntrospection.directives.map(buildDirective) : []; // Then produce and return a Schema with these types. - - return new _schema.GraphQLSchema({ - description: schemaIntrospection.description, - query: queryType, - mutation: mutationType, - subscription: subscriptionType, - types: (0, _objectValues.default)(typeMap), - directives: directives, - assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid - }); // Given a type reference in introspection, return the GraphQLType instance. - // preferring cached instances before building new instances. - - function getType(typeRef) { - if (typeRef.kind === _introspection.TypeKind.LIST) { - var itemRef = typeRef.ofType; - - if (!itemRef) { - throw new Error('Decorated type deeper than introspection query.'); - } - - return new _definition.GraphQLList(getType(itemRef)); - } - - if (typeRef.kind === _introspection.TypeKind.NON_NULL) { - var nullableRef = typeRef.ofType; - - if (!nullableRef) { - throw new Error('Decorated type deeper than introspection query.'); - } - - var nullableType = getType(nullableRef); - return new _definition.GraphQLNonNull((0, _definition.assertNullableType)(nullableType)); - } - - return getNamedType(typeRef); - } - - function getNamedType(typeRef) { - var typeName = typeRef.name; - - if (!typeName) { - throw new Error("Unknown type reference: ".concat((0, _inspect.default)(typeRef), ".")); - } - - var type = typeMap[typeName]; - - if (!type) { - throw new Error("Invalid or incomplete schema, unknown type: ".concat(typeName, ". Ensure that a full introspection query is used in order to build a client schema.")); - } - - return type; - } - - function getObjectType(typeRef) { - return (0, _definition.assertObjectType)(getNamedType(typeRef)); - } - - function getInterfaceType(typeRef) { - return (0, _definition.assertInterfaceType)(getNamedType(typeRef)); - } // Given a type's introspection result, construct the correct - // GraphQLType instance. - - - function buildType(type) { - if (type != null && type.name != null && type.kind != null) { - switch (type.kind) { - case _introspection.TypeKind.SCALAR: - return buildScalarDef(type); - - case _introspection.TypeKind.OBJECT: - return buildObjectDef(type); - - case _introspection.TypeKind.INTERFACE: - return buildInterfaceDef(type); - - case _introspection.TypeKind.UNION: - return buildUnionDef(type); - - case _introspection.TypeKind.ENUM: - return buildEnumDef(type); - - case _introspection.TypeKind.INPUT_OBJECT: - return buildInputObjectDef(type); - } - } - - var typeStr = (0, _inspect.default)(type); - throw new Error("Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ".concat(typeStr, ".")); - } - - function buildScalarDef(scalarIntrospection) { - return new _definition.GraphQLScalarType({ - name: scalarIntrospection.name, - description: scalarIntrospection.description, - specifiedByUrl: scalarIntrospection.specifiedByUrl - }); - } - - function buildImplementationsList(implementingIntrospection) { - // TODO: Temporary workaround until GraphQL ecosystem will fully support - // 'interfaces' on interface types. - if (implementingIntrospection.interfaces === null && implementingIntrospection.kind === _introspection.TypeKind.INTERFACE) { - return []; - } - - if (!implementingIntrospection.interfaces) { - var implementingIntrospectionStr = (0, _inspect.default)(implementingIntrospection); - throw new Error("Introspection result missing interfaces: ".concat(implementingIntrospectionStr, ".")); - } - - return implementingIntrospection.interfaces.map(getInterfaceType); - } - - function buildObjectDef(objectIntrospection) { - return new _definition.GraphQLObjectType({ - name: objectIntrospection.name, - description: objectIntrospection.description, - interfaces: function interfaces() { - return buildImplementationsList(objectIntrospection); - }, - fields: function fields() { - return buildFieldDefMap(objectIntrospection); - } - }); - } - - function buildInterfaceDef(interfaceIntrospection) { - return new _definition.GraphQLInterfaceType({ - name: interfaceIntrospection.name, - description: interfaceIntrospection.description, - interfaces: function interfaces() { - return buildImplementationsList(interfaceIntrospection); - }, - fields: function fields() { - return buildFieldDefMap(interfaceIntrospection); - } - }); - } - - function buildUnionDef(unionIntrospection) { - if (!unionIntrospection.possibleTypes) { - var unionIntrospectionStr = (0, _inspect.default)(unionIntrospection); - throw new Error("Introspection result missing possibleTypes: ".concat(unionIntrospectionStr, ".")); - } - - return new _definition.GraphQLUnionType({ - name: unionIntrospection.name, - description: unionIntrospection.description, - types: function types() { - return unionIntrospection.possibleTypes.map(getObjectType); - } - }); - } - - function buildEnumDef(enumIntrospection) { - if (!enumIntrospection.enumValues) { - var enumIntrospectionStr = (0, _inspect.default)(enumIntrospection); - throw new Error("Introspection result missing enumValues: ".concat(enumIntrospectionStr, ".")); - } - - return new _definition.GraphQLEnumType({ - name: enumIntrospection.name, - description: enumIntrospection.description, - values: (0, _keyValMap.default)(enumIntrospection.enumValues, function (valueIntrospection) { - return valueIntrospection.name; - }, function (valueIntrospection) { - return { - description: valueIntrospection.description, - deprecationReason: valueIntrospection.deprecationReason - }; - }) - }); - } - - function buildInputObjectDef(inputObjectIntrospection) { - if (!inputObjectIntrospection.inputFields) { - var inputObjectIntrospectionStr = (0, _inspect.default)(inputObjectIntrospection); - throw new Error("Introspection result missing inputFields: ".concat(inputObjectIntrospectionStr, ".")); - } - - return new _definition.GraphQLInputObjectType({ - name: inputObjectIntrospection.name, - description: inputObjectIntrospection.description, - fields: function fields() { - return buildInputValueDefMap(inputObjectIntrospection.inputFields); - } - }); - } - - function buildFieldDefMap(typeIntrospection) { - if (!typeIntrospection.fields) { - throw new Error("Introspection result missing fields: ".concat((0, _inspect.default)(typeIntrospection), ".")); - } - - return (0, _keyValMap.default)(typeIntrospection.fields, function (fieldIntrospection) { - return fieldIntrospection.name; - }, buildField); - } - - function buildField(fieldIntrospection) { - var type = getType(fieldIntrospection.type); - - if (!(0, _definition.isOutputType)(type)) { - var typeStr = (0, _inspect.default)(type); - throw new Error("Introspection must provide output type for fields, but received: ".concat(typeStr, ".")); - } - - if (!fieldIntrospection.args) { - var fieldIntrospectionStr = (0, _inspect.default)(fieldIntrospection); - throw new Error("Introspection result missing field args: ".concat(fieldIntrospectionStr, ".")); - } - - return { - description: fieldIntrospection.description, - deprecationReason: fieldIntrospection.deprecationReason, - type: type, - args: buildInputValueDefMap(fieldIntrospection.args) - }; - } - - function buildInputValueDefMap(inputValueIntrospections) { - return (0, _keyValMap.default)(inputValueIntrospections, function (inputValue) { - return inputValue.name; - }, buildInputValue); - } - - function buildInputValue(inputValueIntrospection) { - var type = getType(inputValueIntrospection.type); - - if (!(0, _definition.isInputType)(type)) { - var typeStr = (0, _inspect.default)(type); - throw new Error("Introspection must provide input type for arguments, but received: ".concat(typeStr, ".")); - } - - var defaultValue = inputValueIntrospection.defaultValue != null ? (0, _valueFromAST.valueFromAST)((0, _parser.parseValue)(inputValueIntrospection.defaultValue), type) : undefined; - return { - description: inputValueIntrospection.description, - type: type, - defaultValue: defaultValue - }; - } - - function buildDirective(directiveIntrospection) { - if (!directiveIntrospection.args) { - var directiveIntrospectionStr = (0, _inspect.default)(directiveIntrospection); - throw new Error("Introspection result missing directive args: ".concat(directiveIntrospectionStr, ".")); - } - - if (!directiveIntrospection.locations) { - var _directiveIntrospectionStr = (0, _inspect.default)(directiveIntrospection); - - throw new Error("Introspection result missing directive locations: ".concat(_directiveIntrospectionStr, ".")); - } - - return new _directives.GraphQLDirective({ - name: directiveIntrospection.name, - description: directiveIntrospection.description, - isRepeatable: directiveIntrospection.isRepeatable, - locations: directiveIntrospection.locations.slice(), - args: buildInputValueDefMap(directiveIntrospection.args) - }); - } -} diff --git a/node_modules/graphql/utilities/buildClientSchema.js.flow b/node_modules/graphql/utilities/buildClientSchema.js.flow deleted file mode 100644 index 3e0b5b9f..00000000 --- a/node_modules/graphql/utilities/buildClientSchema.js.flow +++ /dev/null @@ -1,407 +0,0 @@ -// @flow strict -import objectValues from '../polyfills/objectValues'; - -import inspect from '../jsutils/inspect'; -import devAssert from '../jsutils/devAssert'; -import keyValMap from '../jsutils/keyValMap'; -import isObjectLike from '../jsutils/isObjectLike'; - -import { parseValue } from '../language/parser'; - -import type { GraphQLSchemaValidationOptions } from '../type/schema'; -import type { - GraphQLType, - GraphQLNamedType, - GraphQLFieldConfig, - GraphQLFieldConfigMap, -} from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; -import { GraphQLDirective } from '../type/directives'; -import { specifiedScalarTypes } from '../type/scalars'; -import { introspectionTypes, TypeKind } from '../type/introspection'; -import { - isInputType, - isOutputType, - GraphQLList, - GraphQLNonNull, - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - assertNullableType, - assertObjectType, - assertInterfaceType, -} from '../type/definition'; - -import type { - IntrospectionQuery, - IntrospectionDirective, - IntrospectionField, - IntrospectionInputValue, - IntrospectionType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionNamedTypeRef, -} from './getIntrospectionQuery'; -import { valueFromAST } from './valueFromAST'; - -/** - * Build a GraphQLSchema for use by client tools. - * - * Given the result of a client running the introspection query, creates and - * returns a GraphQLSchema instance which can be then used with all graphql-js - * tools, but cannot be used to execute a query, as introspection does not - * represent the "resolver", "parse" or "serialize" functions or any other - * server-internal mechanisms. - * - * This function expects a complete introspection result. Don't forget to check - * the "errors" field of a server response before calling this function. - */ -export function buildClientSchema( - introspection: IntrospectionQuery, - options?: GraphQLSchemaValidationOptions, -): GraphQLSchema { - devAssert( - isObjectLike(introspection) && isObjectLike(introspection.__schema), - `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${inspect( - introspection, - )}.`, - ); - - // Get the schema from the introspection result. - const schemaIntrospection = introspection.__schema; - - // Iterate through all types, getting the type definition for each. - const typeMap = keyValMap( - schemaIntrospection.types, - (typeIntrospection) => typeIntrospection.name, - (typeIntrospection) => buildType(typeIntrospection), - ); - - // Include standard types only if they are used. - for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) { - if (typeMap[stdType.name]) { - typeMap[stdType.name] = stdType; - } - } - - // Get the root Query, Mutation, and Subscription types. - const queryType = schemaIntrospection.queryType - ? getObjectType(schemaIntrospection.queryType) - : null; - - const mutationType = schemaIntrospection.mutationType - ? getObjectType(schemaIntrospection.mutationType) - : null; - - const subscriptionType = schemaIntrospection.subscriptionType - ? getObjectType(schemaIntrospection.subscriptionType) - : null; - - // Get the directives supported by Introspection, assuming empty-set if - // directives were not queried for. - const directives = schemaIntrospection.directives - ? schemaIntrospection.directives.map(buildDirective) - : []; - - // Then produce and return a Schema with these types. - return new GraphQLSchema({ - description: schemaIntrospection.description, - query: queryType, - mutation: mutationType, - subscription: subscriptionType, - types: objectValues(typeMap), - directives, - assumeValid: options?.assumeValid, - }); - - // Given a type reference in introspection, return the GraphQLType instance. - // preferring cached instances before building new instances. - function getType(typeRef: IntrospectionTypeRef): GraphQLType { - if (typeRef.kind === TypeKind.LIST) { - const itemRef = typeRef.ofType; - if (!itemRef) { - throw new Error('Decorated type deeper than introspection query.'); - } - return new GraphQLList(getType(itemRef)); - } - if (typeRef.kind === TypeKind.NON_NULL) { - const nullableRef = typeRef.ofType; - if (!nullableRef) { - throw new Error('Decorated type deeper than introspection query.'); - } - const nullableType = getType(nullableRef); - return new GraphQLNonNull(assertNullableType(nullableType)); - } - return getNamedType(typeRef); - } - - function getNamedType( - typeRef: IntrospectionNamedTypeRef<>, - ): GraphQLNamedType { - const typeName = typeRef.name; - if (!typeName) { - throw new Error(`Unknown type reference: ${inspect(typeRef)}.`); - } - - const type = typeMap[typeName]; - if (!type) { - throw new Error( - `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`, - ); - } - - return type; - } - - function getObjectType( - typeRef: IntrospectionNamedTypeRef, - ): GraphQLObjectType { - return assertObjectType(getNamedType(typeRef)); - } - - function getInterfaceType( - typeRef: IntrospectionNamedTypeRef, - ): GraphQLInterfaceType { - return assertInterfaceType(getNamedType(typeRef)); - } - - // Given a type's introspection result, construct the correct - // GraphQLType instance. - function buildType(type: IntrospectionType): GraphQLNamedType { - if (type != null && type.name != null && type.kind != null) { - switch (type.kind) { - case TypeKind.SCALAR: - return buildScalarDef(type); - case TypeKind.OBJECT: - return buildObjectDef(type); - case TypeKind.INTERFACE: - return buildInterfaceDef(type); - case TypeKind.UNION: - return buildUnionDef(type); - case TypeKind.ENUM: - return buildEnumDef(type); - case TypeKind.INPUT_OBJECT: - return buildInputObjectDef(type); - } - } - const typeStr = inspect(type); - throw new Error( - `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`, - ); - } - - function buildScalarDef( - scalarIntrospection: IntrospectionScalarType, - ): GraphQLScalarType { - return new GraphQLScalarType({ - name: scalarIntrospection.name, - description: scalarIntrospection.description, - specifiedByUrl: scalarIntrospection.specifiedByUrl, - }); - } - - function buildImplementationsList( - implementingIntrospection: - | IntrospectionObjectType - | IntrospectionInterfaceType, - ): Array { - // TODO: Temporary workaround until GraphQL ecosystem will fully support - // 'interfaces' on interface types. - if ( - implementingIntrospection.interfaces === null && - implementingIntrospection.kind === TypeKind.INTERFACE - ) { - return []; - } - - if (!implementingIntrospection.interfaces) { - const implementingIntrospectionStr = inspect(implementingIntrospection); - throw new Error( - `Introspection result missing interfaces: ${implementingIntrospectionStr}.`, - ); - } - - return implementingIntrospection.interfaces.map(getInterfaceType); - } - - function buildObjectDef( - objectIntrospection: IntrospectionObjectType, - ): GraphQLObjectType { - return new GraphQLObjectType({ - name: objectIntrospection.name, - description: objectIntrospection.description, - interfaces: () => buildImplementationsList(objectIntrospection), - fields: () => buildFieldDefMap(objectIntrospection), - }); - } - - function buildInterfaceDef( - interfaceIntrospection: IntrospectionInterfaceType, - ): GraphQLInterfaceType { - return new GraphQLInterfaceType({ - name: interfaceIntrospection.name, - description: interfaceIntrospection.description, - interfaces: () => buildImplementationsList(interfaceIntrospection), - fields: () => buildFieldDefMap(interfaceIntrospection), - }); - } - - function buildUnionDef( - unionIntrospection: IntrospectionUnionType, - ): GraphQLUnionType { - if (!unionIntrospection.possibleTypes) { - const unionIntrospectionStr = inspect(unionIntrospection); - throw new Error( - `Introspection result missing possibleTypes: ${unionIntrospectionStr}.`, - ); - } - return new GraphQLUnionType({ - name: unionIntrospection.name, - description: unionIntrospection.description, - types: () => unionIntrospection.possibleTypes.map(getObjectType), - }); - } - - function buildEnumDef( - enumIntrospection: IntrospectionEnumType, - ): GraphQLEnumType { - if (!enumIntrospection.enumValues) { - const enumIntrospectionStr = inspect(enumIntrospection); - throw new Error( - `Introspection result missing enumValues: ${enumIntrospectionStr}.`, - ); - } - return new GraphQLEnumType({ - name: enumIntrospection.name, - description: enumIntrospection.description, - values: keyValMap( - enumIntrospection.enumValues, - (valueIntrospection) => valueIntrospection.name, - (valueIntrospection) => ({ - description: valueIntrospection.description, - deprecationReason: valueIntrospection.deprecationReason, - }), - ), - }); - } - - function buildInputObjectDef( - inputObjectIntrospection: IntrospectionInputObjectType, - ): GraphQLInputObjectType { - if (!inputObjectIntrospection.inputFields) { - const inputObjectIntrospectionStr = inspect(inputObjectIntrospection); - throw new Error( - `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`, - ); - } - return new GraphQLInputObjectType({ - name: inputObjectIntrospection.name, - description: inputObjectIntrospection.description, - fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields), - }); - } - - function buildFieldDefMap( - typeIntrospection: IntrospectionObjectType | IntrospectionInterfaceType, - ): GraphQLFieldConfigMap { - if (!typeIntrospection.fields) { - throw new Error( - `Introspection result missing fields: ${inspect(typeIntrospection)}.`, - ); - } - - return keyValMap( - typeIntrospection.fields, - (fieldIntrospection) => fieldIntrospection.name, - buildField, - ); - } - - function buildField( - fieldIntrospection: IntrospectionField, - ): GraphQLFieldConfig { - const type = getType(fieldIntrospection.type); - if (!isOutputType(type)) { - const typeStr = inspect(type); - throw new Error( - `Introspection must provide output type for fields, but received: ${typeStr}.`, - ); - } - - if (!fieldIntrospection.args) { - const fieldIntrospectionStr = inspect(fieldIntrospection); - throw new Error( - `Introspection result missing field args: ${fieldIntrospectionStr}.`, - ); - } - - return { - description: fieldIntrospection.description, - deprecationReason: fieldIntrospection.deprecationReason, - type, - args: buildInputValueDefMap(fieldIntrospection.args), - }; - } - - function buildInputValueDefMap( - inputValueIntrospections: $ReadOnlyArray, - ) { - return keyValMap( - inputValueIntrospections, - (inputValue) => inputValue.name, - buildInputValue, - ); - } - - function buildInputValue(inputValueIntrospection: IntrospectionInputValue) { - const type = getType(inputValueIntrospection.type); - if (!isInputType(type)) { - const typeStr = inspect(type); - throw new Error( - `Introspection must provide input type for arguments, but received: ${typeStr}.`, - ); - } - - const defaultValue = - inputValueIntrospection.defaultValue != null - ? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type) - : undefined; - return { - description: inputValueIntrospection.description, - type, - defaultValue, - }; - } - - function buildDirective( - directiveIntrospection: IntrospectionDirective, - ): GraphQLDirective { - if (!directiveIntrospection.args) { - const directiveIntrospectionStr = inspect(directiveIntrospection); - throw new Error( - `Introspection result missing directive args: ${directiveIntrospectionStr}.`, - ); - } - if (!directiveIntrospection.locations) { - const directiveIntrospectionStr = inspect(directiveIntrospection); - throw new Error( - `Introspection result missing directive locations: ${directiveIntrospectionStr}.`, - ); - } - return new GraphQLDirective({ - name: directiveIntrospection.name, - description: directiveIntrospection.description, - isRepeatable: directiveIntrospection.isRepeatable, - locations: directiveIntrospection.locations.slice(), - args: buildInputValueDefMap(directiveIntrospection.args), - }); - } -} diff --git a/node_modules/graphql/utilities/buildClientSchema.mjs b/node_modules/graphql/utilities/buildClientSchema.mjs deleted file mode 100644 index 667ca93b..00000000 --- a/node_modules/graphql/utilities/buildClientSchema.mjs +++ /dev/null @@ -1,314 +0,0 @@ -import objectValues from "../polyfills/objectValues.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import devAssert from "../jsutils/devAssert.mjs"; -import keyValMap from "../jsutils/keyValMap.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import { parseValue } from "../language/parser.mjs"; -import { GraphQLSchema } from "../type/schema.mjs"; -import { GraphQLDirective } from "../type/directives.mjs"; -import { specifiedScalarTypes } from "../type/scalars.mjs"; -import { introspectionTypes, TypeKind } from "../type/introspection.mjs"; -import { isInputType, isOutputType, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, assertNullableType, assertObjectType, assertInterfaceType } from "../type/definition.mjs"; -import { valueFromAST } from "./valueFromAST.mjs"; -/** - * Build a GraphQLSchema for use by client tools. - * - * Given the result of a client running the introspection query, creates and - * returns a GraphQLSchema instance which can be then used with all graphql-js - * tools, but cannot be used to execute a query, as introspection does not - * represent the "resolver", "parse" or "serialize" functions or any other - * server-internal mechanisms. - * - * This function expects a complete introspection result. Don't forget to check - * the "errors" field of a server response before calling this function. - */ - -export function buildClientSchema(introspection, options) { - isObjectLike(introspection) && isObjectLike(introspection.__schema) || devAssert(0, "Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: ".concat(inspect(introspection), ".")); // Get the schema from the introspection result. - - var schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. - - var typeMap = keyValMap(schemaIntrospection.types, function (typeIntrospection) { - return typeIntrospection.name; - }, function (typeIntrospection) { - return buildType(typeIntrospection); - }); // Include standard types only if they are used. - - for (var _i2 = 0, _ref2 = [].concat(specifiedScalarTypes, introspectionTypes); _i2 < _ref2.length; _i2++) { - var stdType = _ref2[_i2]; - - if (typeMap[stdType.name]) { - typeMap[stdType.name] = stdType; - } - } // Get the root Query, Mutation, and Subscription types. - - - var queryType = schemaIntrospection.queryType ? getObjectType(schemaIntrospection.queryType) : null; - var mutationType = schemaIntrospection.mutationType ? getObjectType(schemaIntrospection.mutationType) : null; - var subscriptionType = schemaIntrospection.subscriptionType ? getObjectType(schemaIntrospection.subscriptionType) : null; // Get the directives supported by Introspection, assuming empty-set if - // directives were not queried for. - - var directives = schemaIntrospection.directives ? schemaIntrospection.directives.map(buildDirective) : []; // Then produce and return a Schema with these types. - - return new GraphQLSchema({ - description: schemaIntrospection.description, - query: queryType, - mutation: mutationType, - subscription: subscriptionType, - types: objectValues(typeMap), - directives: directives, - assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid - }); // Given a type reference in introspection, return the GraphQLType instance. - // preferring cached instances before building new instances. - - function getType(typeRef) { - if (typeRef.kind === TypeKind.LIST) { - var itemRef = typeRef.ofType; - - if (!itemRef) { - throw new Error('Decorated type deeper than introspection query.'); - } - - return new GraphQLList(getType(itemRef)); - } - - if (typeRef.kind === TypeKind.NON_NULL) { - var nullableRef = typeRef.ofType; - - if (!nullableRef) { - throw new Error('Decorated type deeper than introspection query.'); - } - - var nullableType = getType(nullableRef); - return new GraphQLNonNull(assertNullableType(nullableType)); - } - - return getNamedType(typeRef); - } - - function getNamedType(typeRef) { - var typeName = typeRef.name; - - if (!typeName) { - throw new Error("Unknown type reference: ".concat(inspect(typeRef), ".")); - } - - var type = typeMap[typeName]; - - if (!type) { - throw new Error("Invalid or incomplete schema, unknown type: ".concat(typeName, ". Ensure that a full introspection query is used in order to build a client schema.")); - } - - return type; - } - - function getObjectType(typeRef) { - return assertObjectType(getNamedType(typeRef)); - } - - function getInterfaceType(typeRef) { - return assertInterfaceType(getNamedType(typeRef)); - } // Given a type's introspection result, construct the correct - // GraphQLType instance. - - - function buildType(type) { - if (type != null && type.name != null && type.kind != null) { - switch (type.kind) { - case TypeKind.SCALAR: - return buildScalarDef(type); - - case TypeKind.OBJECT: - return buildObjectDef(type); - - case TypeKind.INTERFACE: - return buildInterfaceDef(type); - - case TypeKind.UNION: - return buildUnionDef(type); - - case TypeKind.ENUM: - return buildEnumDef(type); - - case TypeKind.INPUT_OBJECT: - return buildInputObjectDef(type); - } - } - - var typeStr = inspect(type); - throw new Error("Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ".concat(typeStr, ".")); - } - - function buildScalarDef(scalarIntrospection) { - return new GraphQLScalarType({ - name: scalarIntrospection.name, - description: scalarIntrospection.description, - specifiedByUrl: scalarIntrospection.specifiedByUrl - }); - } - - function buildImplementationsList(implementingIntrospection) { - // TODO: Temporary workaround until GraphQL ecosystem will fully support - // 'interfaces' on interface types. - if (implementingIntrospection.interfaces === null && implementingIntrospection.kind === TypeKind.INTERFACE) { - return []; - } - - if (!implementingIntrospection.interfaces) { - var implementingIntrospectionStr = inspect(implementingIntrospection); - throw new Error("Introspection result missing interfaces: ".concat(implementingIntrospectionStr, ".")); - } - - return implementingIntrospection.interfaces.map(getInterfaceType); - } - - function buildObjectDef(objectIntrospection) { - return new GraphQLObjectType({ - name: objectIntrospection.name, - description: objectIntrospection.description, - interfaces: function interfaces() { - return buildImplementationsList(objectIntrospection); - }, - fields: function fields() { - return buildFieldDefMap(objectIntrospection); - } - }); - } - - function buildInterfaceDef(interfaceIntrospection) { - return new GraphQLInterfaceType({ - name: interfaceIntrospection.name, - description: interfaceIntrospection.description, - interfaces: function interfaces() { - return buildImplementationsList(interfaceIntrospection); - }, - fields: function fields() { - return buildFieldDefMap(interfaceIntrospection); - } - }); - } - - function buildUnionDef(unionIntrospection) { - if (!unionIntrospection.possibleTypes) { - var unionIntrospectionStr = inspect(unionIntrospection); - throw new Error("Introspection result missing possibleTypes: ".concat(unionIntrospectionStr, ".")); - } - - return new GraphQLUnionType({ - name: unionIntrospection.name, - description: unionIntrospection.description, - types: function types() { - return unionIntrospection.possibleTypes.map(getObjectType); - } - }); - } - - function buildEnumDef(enumIntrospection) { - if (!enumIntrospection.enumValues) { - var enumIntrospectionStr = inspect(enumIntrospection); - throw new Error("Introspection result missing enumValues: ".concat(enumIntrospectionStr, ".")); - } - - return new GraphQLEnumType({ - name: enumIntrospection.name, - description: enumIntrospection.description, - values: keyValMap(enumIntrospection.enumValues, function (valueIntrospection) { - return valueIntrospection.name; - }, function (valueIntrospection) { - return { - description: valueIntrospection.description, - deprecationReason: valueIntrospection.deprecationReason - }; - }) - }); - } - - function buildInputObjectDef(inputObjectIntrospection) { - if (!inputObjectIntrospection.inputFields) { - var inputObjectIntrospectionStr = inspect(inputObjectIntrospection); - throw new Error("Introspection result missing inputFields: ".concat(inputObjectIntrospectionStr, ".")); - } - - return new GraphQLInputObjectType({ - name: inputObjectIntrospection.name, - description: inputObjectIntrospection.description, - fields: function fields() { - return buildInputValueDefMap(inputObjectIntrospection.inputFields); - } - }); - } - - function buildFieldDefMap(typeIntrospection) { - if (!typeIntrospection.fields) { - throw new Error("Introspection result missing fields: ".concat(inspect(typeIntrospection), ".")); - } - - return keyValMap(typeIntrospection.fields, function (fieldIntrospection) { - return fieldIntrospection.name; - }, buildField); - } - - function buildField(fieldIntrospection) { - var type = getType(fieldIntrospection.type); - - if (!isOutputType(type)) { - var typeStr = inspect(type); - throw new Error("Introspection must provide output type for fields, but received: ".concat(typeStr, ".")); - } - - if (!fieldIntrospection.args) { - var fieldIntrospectionStr = inspect(fieldIntrospection); - throw new Error("Introspection result missing field args: ".concat(fieldIntrospectionStr, ".")); - } - - return { - description: fieldIntrospection.description, - deprecationReason: fieldIntrospection.deprecationReason, - type: type, - args: buildInputValueDefMap(fieldIntrospection.args) - }; - } - - function buildInputValueDefMap(inputValueIntrospections) { - return keyValMap(inputValueIntrospections, function (inputValue) { - return inputValue.name; - }, buildInputValue); - } - - function buildInputValue(inputValueIntrospection) { - var type = getType(inputValueIntrospection.type); - - if (!isInputType(type)) { - var typeStr = inspect(type); - throw new Error("Introspection must provide input type for arguments, but received: ".concat(typeStr, ".")); - } - - var defaultValue = inputValueIntrospection.defaultValue != null ? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type) : undefined; - return { - description: inputValueIntrospection.description, - type: type, - defaultValue: defaultValue - }; - } - - function buildDirective(directiveIntrospection) { - if (!directiveIntrospection.args) { - var directiveIntrospectionStr = inspect(directiveIntrospection); - throw new Error("Introspection result missing directive args: ".concat(directiveIntrospectionStr, ".")); - } - - if (!directiveIntrospection.locations) { - var _directiveIntrospectionStr = inspect(directiveIntrospection); - - throw new Error("Introspection result missing directive locations: ".concat(_directiveIntrospectionStr, ".")); - } - - return new GraphQLDirective({ - name: directiveIntrospection.name, - description: directiveIntrospection.description, - isRepeatable: directiveIntrospection.isRepeatable, - locations: directiveIntrospection.locations.slice(), - args: buildInputValueDefMap(directiveIntrospection.args) - }); - } -} diff --git a/node_modules/graphql/utilities/coerceInputValue.d.ts b/node_modules/graphql/utilities/coerceInputValue.d.ts deleted file mode 100644 index 45c70a5d..00000000 --- a/node_modules/graphql/utilities/coerceInputValue.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { GraphQLInputType } from '../type/definition'; -import { GraphQLError } from '../error/GraphQLError'; - -type OnErrorCB = ( - path: ReadonlyArray, - invalidValue: any, - error: GraphQLError, -) => void; - -/** - * Coerces a JavaScript value given a GraphQL Input Type. - */ -export function coerceInputValue( - inputValue: any, - type: GraphQLInputType, - onError?: OnErrorCB, -): any; diff --git a/node_modules/graphql/utilities/coerceInputValue.js b/node_modules/graphql/utilities/coerceInputValue.js deleted file mode 100644 index ddd4390f..00000000 --- a/node_modules/graphql/utilities/coerceInputValue.js +++ /dev/null @@ -1,149 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.coerceInputValue = coerceInputValue; - -var _arrayFrom = _interopRequireDefault(require("../polyfills/arrayFrom.js")); - -var _objectValues3 = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _didYouMean = _interopRequireDefault(require("../jsutils/didYouMean.js")); - -var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js")); - -var _isCollection = _interopRequireDefault(require("../jsutils/isCollection.js")); - -var _suggestionList = _interopRequireDefault(require("../jsutils/suggestionList.js")); - -var _printPathArray = _interopRequireDefault(require("../jsutils/printPathArray.js")); - -var _Path = require("../jsutils/Path.js"); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _definition = require("../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Coerces a JavaScript value given a GraphQL Input Type. - */ -function coerceInputValue(inputValue, type) { - var onError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultOnError; - return coerceInputValueImpl(inputValue, type, onError); -} - -function defaultOnError(path, invalidValue, error) { - var errorPrefix = 'Invalid value ' + (0, _inspect.default)(invalidValue); - - if (path.length > 0) { - errorPrefix += " at \"value".concat((0, _printPathArray.default)(path), "\""); - } - - error.message = errorPrefix + ': ' + error.message; - throw error; -} - -function coerceInputValueImpl(inputValue, type, onError, path) { - if ((0, _definition.isNonNullType)(type)) { - if (inputValue != null) { - return coerceInputValueImpl(inputValue, type.ofType, onError, path); - } - - onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected non-nullable type \"".concat((0, _inspect.default)(type), "\" not to be null."))); - return; - } - - if (inputValue == null) { - // Explicitly return the value null. - return null; - } - - if ((0, _definition.isListType)(type)) { - var itemType = type.ofType; - - if ((0, _isCollection.default)(inputValue)) { - return (0, _arrayFrom.default)(inputValue, function (itemValue, index) { - var itemPath = (0, _Path.addPath)(path, index, undefined); - return coerceInputValueImpl(itemValue, itemType, onError, itemPath); - }); - } // Lists accept a non-list value as a list of one. - - - return [coerceInputValueImpl(inputValue, itemType, onError, path)]; - } - - if ((0, _definition.isInputObjectType)(type)) { - if (!(0, _isObjectLike.default)(inputValue)) { - onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected type \"".concat(type.name, "\" to be an object."))); - return; - } - - var coercedValue = {}; - var fieldDefs = type.getFields(); - - for (var _i2 = 0, _objectValues2 = (0, _objectValues3.default)(fieldDefs); _i2 < _objectValues2.length; _i2++) { - var field = _objectValues2[_i2]; - var fieldValue = inputValue[field.name]; - - if (fieldValue === undefined) { - if (field.defaultValue !== undefined) { - coercedValue[field.name] = field.defaultValue; - } else if ((0, _definition.isNonNullType)(field.type)) { - var typeStr = (0, _inspect.default)(field.type); - onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Field \"".concat(field.name, "\" of required type \"").concat(typeStr, "\" was not provided."))); - } - - continue; - } - - coercedValue[field.name] = coerceInputValueImpl(fieldValue, field.type, onError, (0, _Path.addPath)(path, field.name, type.name)); - } // Ensure every provided field is defined. - - - for (var _i4 = 0, _Object$keys2 = Object.keys(inputValue); _i4 < _Object$keys2.length; _i4++) { - var fieldName = _Object$keys2[_i4]; - - if (!fieldDefs[fieldName]) { - var suggestions = (0, _suggestionList.default)(fieldName, Object.keys(type.getFields())); - onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Field \"".concat(fieldName, "\" is not defined by type \"").concat(type.name, "\".") + (0, _didYouMean.default)(suggestions))); - } - } - - return coercedValue; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isLeafType)(type)) { - var parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), - // which can throw to indicate failure. If it throws, maintain a reference - // to the original error. - - try { - parseResult = type.parseValue(inputValue); - } catch (error) { - if (error instanceof _GraphQLError.GraphQLError) { - onError((0, _Path.pathToArray)(path), inputValue, error); - } else { - onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected type \"".concat(type.name, "\". ") + error.message, undefined, undefined, undefined, undefined, error)); - } - - return; - } - - if (parseResult === undefined) { - onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected type \"".concat(type.name, "\"."))); - } - - return parseResult; - } // istanbul ignore next (Not reachable. All possible input types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type)); -} diff --git a/node_modules/graphql/utilities/coerceInputValue.js.flow b/node_modules/graphql/utilities/coerceInputValue.js.flow deleted file mode 100644 index f0c002ac..00000000 --- a/node_modules/graphql/utilities/coerceInputValue.js.flow +++ /dev/null @@ -1,192 +0,0 @@ -// @flow strict -import arrayFrom from '../polyfills/arrayFrom'; -import objectValues from '../polyfills/objectValues'; - -import type { Path } from '../jsutils/Path'; -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; -import didYouMean from '../jsutils/didYouMean'; -import isObjectLike from '../jsutils/isObjectLike'; -import isCollection from '../jsutils/isCollection'; -import suggestionList from '../jsutils/suggestionList'; -import printPathArray from '../jsutils/printPathArray'; -import { addPath, pathToArray } from '../jsutils/Path'; - -import { GraphQLError } from '../error/GraphQLError'; - -import type { GraphQLInputType } from '../type/definition'; -import { - isLeafType, - isInputObjectType, - isListType, - isNonNullType, -} from '../type/definition'; - -type OnErrorCB = ( - path: $ReadOnlyArray, - invalidValue: mixed, - error: GraphQLError, -) => void; - -/** - * Coerces a JavaScript value given a GraphQL Input Type. - */ -export function coerceInputValue( - inputValue: mixed, - type: GraphQLInputType, - onError?: OnErrorCB = defaultOnError, -): mixed { - return coerceInputValueImpl(inputValue, type, onError); -} - -function defaultOnError( - path: $ReadOnlyArray, - invalidValue: mixed, - error: GraphQLError, -): void { - let errorPrefix = 'Invalid value ' + inspect(invalidValue); - if (path.length > 0) { - errorPrefix += ` at "value${printPathArray(path)}"`; - } - error.message = errorPrefix + ': ' + error.message; - throw error; -} - -function coerceInputValueImpl( - inputValue: mixed, - type: GraphQLInputType, - onError: OnErrorCB, - path: Path | void, -): mixed { - if (isNonNullType(type)) { - if (inputValue != null) { - return coerceInputValueImpl(inputValue, type.ofType, onError, path); - } - onError( - pathToArray(path), - inputValue, - new GraphQLError( - `Expected non-nullable type "${inspect(type)}" not to be null.`, - ), - ); - return; - } - - if (inputValue == null) { - // Explicitly return the value null. - return null; - } - - if (isListType(type)) { - const itemType = type.ofType; - if (isCollection(inputValue)) { - return arrayFrom(inputValue, (itemValue, index) => { - const itemPath = addPath(path, index, undefined); - return coerceInputValueImpl(itemValue, itemType, onError, itemPath); - }); - } - // Lists accept a non-list value as a list of one. - return [coerceInputValueImpl(inputValue, itemType, onError, path)]; - } - - if (isInputObjectType(type)) { - if (!isObjectLike(inputValue)) { - onError( - pathToArray(path), - inputValue, - new GraphQLError(`Expected type "${type.name}" to be an object.`), - ); - return; - } - - const coercedValue = {}; - const fieldDefs = type.getFields(); - - for (const field of objectValues(fieldDefs)) { - const fieldValue = inputValue[field.name]; - - if (fieldValue === undefined) { - if (field.defaultValue !== undefined) { - coercedValue[field.name] = field.defaultValue; - } else if (isNonNullType(field.type)) { - const typeStr = inspect(field.type); - onError( - pathToArray(path), - inputValue, - new GraphQLError( - `Field "${field.name}" of required type "${typeStr}" was not provided.`, - ), - ); - } - continue; - } - - coercedValue[field.name] = coerceInputValueImpl( - fieldValue, - field.type, - onError, - addPath(path, field.name, type.name), - ); - } - - // Ensure every provided field is defined. - for (const fieldName of Object.keys(inputValue)) { - if (!fieldDefs[fieldName]) { - const suggestions = suggestionList( - fieldName, - Object.keys(type.getFields()), - ); - onError( - pathToArray(path), - inputValue, - new GraphQLError( - `Field "${fieldName}" is not defined by type "${type.name}".` + - didYouMean(suggestions), - ), - ); - } - } - return coercedValue; - } - - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isLeafType(type)) { - let parseResult; - - // Scalars and Enums determine if a input value is valid via parseValue(), - // which can throw to indicate failure. If it throws, maintain a reference - // to the original error. - try { - parseResult = type.parseValue(inputValue); - } catch (error) { - if (error instanceof GraphQLError) { - onError(pathToArray(path), inputValue, error); - } else { - onError( - pathToArray(path), - inputValue, - new GraphQLError( - `Expected type "${type.name}". ` + error.message, - undefined, - undefined, - undefined, - undefined, - error, - ), - ); - } - return; - } - if (parseResult === undefined) { - onError( - pathToArray(path), - inputValue, - new GraphQLError(`Expected type "${type.name}".`), - ); - } - return parseResult; - } - - // istanbul ignore next (Not reachable. All possible input types have been considered) - invariant(false, 'Unexpected input type: ' + inspect((type: empty))); -} diff --git a/node_modules/graphql/utilities/coerceInputValue.mjs b/node_modules/graphql/utilities/coerceInputValue.mjs deleted file mode 100644 index 1c306641..00000000 --- a/node_modules/graphql/utilities/coerceInputValue.mjs +++ /dev/null @@ -1,129 +0,0 @@ -import arrayFrom from "../polyfills/arrayFrom.mjs"; -import objectValues from "../polyfills/objectValues.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import didYouMean from "../jsutils/didYouMean.mjs"; -import isObjectLike from "../jsutils/isObjectLike.mjs"; -import isCollection from "../jsutils/isCollection.mjs"; -import suggestionList from "../jsutils/suggestionList.mjs"; -import printPathArray from "../jsutils/printPathArray.mjs"; -import { addPath, pathToArray } from "../jsutils/Path.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { isLeafType, isInputObjectType, isListType, isNonNullType } from "../type/definition.mjs"; - -/** - * Coerces a JavaScript value given a GraphQL Input Type. - */ -export function coerceInputValue(inputValue, type) { - var onError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultOnError; - return coerceInputValueImpl(inputValue, type, onError); -} - -function defaultOnError(path, invalidValue, error) { - var errorPrefix = 'Invalid value ' + inspect(invalidValue); - - if (path.length > 0) { - errorPrefix += " at \"value".concat(printPathArray(path), "\""); - } - - error.message = errorPrefix + ': ' + error.message; - throw error; -} - -function coerceInputValueImpl(inputValue, type, onError, path) { - if (isNonNullType(type)) { - if (inputValue != null) { - return coerceInputValueImpl(inputValue, type.ofType, onError, path); - } - - onError(pathToArray(path), inputValue, new GraphQLError("Expected non-nullable type \"".concat(inspect(type), "\" not to be null."))); - return; - } - - if (inputValue == null) { - // Explicitly return the value null. - return null; - } - - if (isListType(type)) { - var itemType = type.ofType; - - if (isCollection(inputValue)) { - return arrayFrom(inputValue, function (itemValue, index) { - var itemPath = addPath(path, index, undefined); - return coerceInputValueImpl(itemValue, itemType, onError, itemPath); - }); - } // Lists accept a non-list value as a list of one. - - - return [coerceInputValueImpl(inputValue, itemType, onError, path)]; - } - - if (isInputObjectType(type)) { - if (!isObjectLike(inputValue)) { - onError(pathToArray(path), inputValue, new GraphQLError("Expected type \"".concat(type.name, "\" to be an object."))); - return; - } - - var coercedValue = {}; - var fieldDefs = type.getFields(); - - for (var _i2 = 0, _objectValues2 = objectValues(fieldDefs); _i2 < _objectValues2.length; _i2++) { - var field = _objectValues2[_i2]; - var fieldValue = inputValue[field.name]; - - if (fieldValue === undefined) { - if (field.defaultValue !== undefined) { - coercedValue[field.name] = field.defaultValue; - } else if (isNonNullType(field.type)) { - var typeStr = inspect(field.type); - onError(pathToArray(path), inputValue, new GraphQLError("Field \"".concat(field.name, "\" of required type \"").concat(typeStr, "\" was not provided."))); - } - - continue; - } - - coercedValue[field.name] = coerceInputValueImpl(fieldValue, field.type, onError, addPath(path, field.name, type.name)); - } // Ensure every provided field is defined. - - - for (var _i4 = 0, _Object$keys2 = Object.keys(inputValue); _i4 < _Object$keys2.length; _i4++) { - var fieldName = _Object$keys2[_i4]; - - if (!fieldDefs[fieldName]) { - var suggestions = suggestionList(fieldName, Object.keys(type.getFields())); - onError(pathToArray(path), inputValue, new GraphQLError("Field \"".concat(fieldName, "\" is not defined by type \"").concat(type.name, "\".") + didYouMean(suggestions))); - } - } - - return coercedValue; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isLeafType(type)) { - var parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), - // which can throw to indicate failure. If it throws, maintain a reference - // to the original error. - - try { - parseResult = type.parseValue(inputValue); - } catch (error) { - if (error instanceof GraphQLError) { - onError(pathToArray(path), inputValue, error); - } else { - onError(pathToArray(path), inputValue, new GraphQLError("Expected type \"".concat(type.name, "\". ") + error.message, undefined, undefined, undefined, undefined, error)); - } - - return; - } - - if (parseResult === undefined) { - onError(pathToArray(path), inputValue, new GraphQLError("Expected type \"".concat(type.name, "\"."))); - } - - return parseResult; - } // istanbul ignore next (Not reachable. All possible input types have been considered) - - - false || invariant(0, 'Unexpected input type: ' + inspect(type)); -} diff --git a/node_modules/graphql/utilities/concatAST.d.ts b/node_modules/graphql/utilities/concatAST.d.ts deleted file mode 100644 index 03d441e1..00000000 --- a/node_modules/graphql/utilities/concatAST.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { DocumentNode } from '../language/ast'; - -/** - * Provided a collection of ASTs, presumably each from different files, - * concatenate the ASTs together into batched AST, useful for validating many - * GraphQL source files which together represent one conceptual application. - */ -export function concatAST(asts: ReadonlyArray): DocumentNode; diff --git a/node_modules/graphql/utilities/concatAST.js b/node_modules/graphql/utilities/concatAST.js deleted file mode 100644 index 9c3ac482..00000000 --- a/node_modules/graphql/utilities/concatAST.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.concatAST = concatAST; - -/** - * Provided a collection of ASTs, presumably each from different files, - * concatenate the ASTs together into batched AST, useful for validating many - * GraphQL source files which together represent one conceptual application. - */ -function concatAST(documents) { - var definitions = []; - - for (var _i2 = 0; _i2 < documents.length; _i2++) { - var doc = documents[_i2]; - definitions = definitions.concat(doc.definitions); - } - - return { - kind: 'Document', - definitions: definitions - }; -} diff --git a/node_modules/graphql/utilities/concatAST.js.flow b/node_modules/graphql/utilities/concatAST.js.flow deleted file mode 100644 index 0e0bb5fd..00000000 --- a/node_modules/graphql/utilities/concatAST.js.flow +++ /dev/null @@ -1,17 +0,0 @@ -// @flow strict -import type { DocumentNode } from '../language/ast'; - -/** - * Provided a collection of ASTs, presumably each from different files, - * concatenate the ASTs together into batched AST, useful for validating many - * GraphQL source files which together represent one conceptual application. - */ -export function concatAST( - documents: $ReadOnlyArray, -): DocumentNode { - let definitions = []; - for (const doc of documents) { - definitions = definitions.concat(doc.definitions); - } - return { kind: 'Document', definitions }; -} diff --git a/node_modules/graphql/utilities/concatAST.mjs b/node_modules/graphql/utilities/concatAST.mjs deleted file mode 100644 index 4e9e9ee2..00000000 --- a/node_modules/graphql/utilities/concatAST.mjs +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Provided a collection of ASTs, presumably each from different files, - * concatenate the ASTs together into batched AST, useful for validating many - * GraphQL source files which together represent one conceptual application. - */ -export function concatAST(documents) { - var definitions = []; - - for (var _i2 = 0; _i2 < documents.length; _i2++) { - var doc = documents[_i2]; - definitions = definitions.concat(doc.definitions); - } - - return { - kind: 'Document', - definitions: definitions - }; -} diff --git a/node_modules/graphql/utilities/extendSchema.d.ts b/node_modules/graphql/utilities/extendSchema.d.ts deleted file mode 100644 index 6795e014..00000000 --- a/node_modules/graphql/utilities/extendSchema.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { Location, DocumentNode, StringValueNode } from '../language/ast'; -import { - GraphQLSchemaValidationOptions, - GraphQLSchema, - GraphQLSchemaNormalizedConfig, -} from '../type/schema'; - -interface Options extends GraphQLSchemaValidationOptions { - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * This option is provided to ease adoption and will be removed in v16. - * - * Default: false - */ - commentDescriptions?: boolean; - - /** - * Set to true to assume the SDL is valid. - * - * Default: false - */ - assumeValidSDL?: boolean; -} - -/** - * Produces a new schema given an existing schema and a document which may - * contain GraphQL type extensions and definitions. The original schema will - * remain unaltered. - * - * Because a schema represents a graph of references, a schema cannot be - * extended without effectively making an entire copy. We do not know until it's - * too late if subgraphs remain unchanged. - * - * This algorithm copies the provided schema, applying extensions while - * producing the copy. The original schema remains unaltered. - * - * Accepts options as a third argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function extendSchema( - schema: GraphQLSchema, - documentAST: DocumentNode, - options?: Options, -): GraphQLSchema; - -/** - * @internal - */ -export function extendSchemaImpl( - schemaConfig: GraphQLSchemaNormalizedConfig, - documentAST: DocumentNode, - options?: Options, -): GraphQLSchemaNormalizedConfig; - -/** - * Given an ast node, returns its string description. - * @deprecated: provided to ease adoption and will be removed in v16. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function getDescription( - node: { readonly description?: StringValueNode; readonly loc?: Location }, - options?: Maybe<{ commentDescriptions?: boolean }>, -): string | undefined; diff --git a/node_modules/graphql/utilities/extendSchema.js b/node_modules/graphql/utilities/extendSchema.js deleted file mode 100644 index 0b0201d2..00000000 --- a/node_modules/graphql/utilities/extendSchema.js +++ /dev/null @@ -1,719 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.extendSchema = extendSchema; -exports.extendSchemaImpl = extendSchemaImpl; -exports.getDescription = getDescription; - -var _objectValues = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _keyMap = _interopRequireDefault(require("../jsutils/keyMap.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _mapValue = _interopRequireDefault(require("../jsutils/mapValue.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _kinds = require("../language/kinds.js"); - -var _tokenKind = require("../language/tokenKind.js"); - -var _blockString = require("../language/blockString.js"); - -var _predicates = require("../language/predicates.js"); - -var _validate = require("../validation/validate.js"); - -var _values = require("../execution/values.js"); - -var _schema = require("../type/schema.js"); - -var _scalars = require("../type/scalars.js"); - -var _introspection = require("../type/introspection.js"); - -var _directives = require("../type/directives.js"); - -var _definition = require("../type/definition.js"); - -var _valueFromAST = require("./valueFromAST.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Produces a new schema given an existing schema and a document which may - * contain GraphQL type extensions and definitions. The original schema will - * remain unaltered. - * - * Because a schema represents a graph of references, a schema cannot be - * extended without effectively making an entire copy. We do not know until it's - * too late if subgraphs remain unchanged. - * - * This algorithm copies the provided schema, applying extensions while - * producing the copy. The original schema remains unaltered. - * - * Accepts options as a third argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -function extendSchema(schema, documentAST, options) { - (0, _schema.assertSchema)(schema); - documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT || (0, _devAssert.default)(0, 'Must provide valid Document AST.'); - - if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { - (0, _validate.assertValidSDLExtension)(documentAST, schema); - } - - var schemaConfig = schema.toConfig(); - var extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); - return schemaConfig === extendedConfig ? schema : new _schema.GraphQLSchema(extendedConfig); -} -/** - * @internal - */ - - -function extendSchemaImpl(schemaConfig, documentAST, options) { - var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; - - // Collect the type definitions and extensions found in the document. - var typeDefs = []; - var typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can - // have the same name. For example, a type named "skip". - - var directiveDefs = []; - var schemaDef; // Schema extensions are collected which may add additional operation types. - - var schemaExtensions = []; - - for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) { - var def = _documentAST$definiti2[_i2]; - - if (def.kind === _kinds.Kind.SCHEMA_DEFINITION) { - schemaDef = def; - } else if (def.kind === _kinds.Kind.SCHEMA_EXTENSION) { - schemaExtensions.push(def); - } else if ((0, _predicates.isTypeDefinitionNode)(def)) { - typeDefs.push(def); - } else if ((0, _predicates.isTypeExtensionNode)(def)) { - var extendedTypeName = def.name.value; - var existingTypeExtensions = typeExtensionsMap[extendedTypeName]; - typeExtensionsMap[extendedTypeName] = existingTypeExtensions ? existingTypeExtensions.concat([def]) : [def]; - } else if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - directiveDefs.push(def); - } - } // If this document contains no new types, extensions, or directives then - // return the same unmodified GraphQLSchema instance. - - - if (Object.keys(typeExtensionsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExtensions.length === 0 && schemaDef == null) { - return schemaConfig; - } - - var typeMap = Object.create(null); - - for (var _i4 = 0, _schemaConfig$types2 = schemaConfig.types; _i4 < _schemaConfig$types2.length; _i4++) { - var existingType = _schemaConfig$types2[_i4]; - typeMap[existingType.name] = extendNamedType(existingType); - } - - for (var _i6 = 0; _i6 < typeDefs.length; _i6++) { - var _stdTypeMap$name; - - var typeNode = typeDefs[_i6]; - var name = typeNode.name.value; - typeMap[name] = (_stdTypeMap$name = stdTypeMap[name]) !== null && _stdTypeMap$name !== void 0 ? _stdTypeMap$name : buildType(typeNode); - } - - var operationTypes = _objectSpread(_objectSpread({ - // Get the extended root operation types. - query: schemaConfig.query && replaceNamedType(schemaConfig.query), - mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), - subscription: schemaConfig.subscription && replaceNamedType(schemaConfig.subscription) - }, schemaDef && getOperationTypes([schemaDef])), getOperationTypes(schemaExtensions)); // Then produce and return a Schema config with these types. - - - return _objectSpread(_objectSpread({ - description: (_schemaDef = schemaDef) === null || _schemaDef === void 0 ? void 0 : (_schemaDef$descriptio = _schemaDef.description) === null || _schemaDef$descriptio === void 0 ? void 0 : _schemaDef$descriptio.value - }, operationTypes), {}, { - types: (0, _objectValues.default)(typeMap), - directives: [].concat(schemaConfig.directives.map(replaceDirective), directiveDefs.map(buildDirective)), - extensions: undefined, - astNode: (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 ? _schemaDef2 : schemaConfig.astNode, - extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), - assumeValid: (_options$assumeValid = options === null || options === void 0 ? void 0 : options.assumeValid) !== null && _options$assumeValid !== void 0 ? _options$assumeValid : false - }); // Below are functions used for producing this schema that have closed over - // this scope and have access to the schema, cache, and newly defined types. - - function replaceType(type) { - if ((0, _definition.isListType)(type)) { - // $FlowFixMe[incompatible-return] - return new _definition.GraphQLList(replaceType(type.ofType)); - } - - if ((0, _definition.isNonNullType)(type)) { - // $FlowFixMe[incompatible-return] - return new _definition.GraphQLNonNull(replaceType(type.ofType)); - } - - return replaceNamedType(type); - } - - function replaceNamedType(type) { - // Note: While this could make early assertions to get the correctly - // typed values, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - return typeMap[type.name]; - } - - function replaceDirective(directive) { - var config = directive.toConfig(); - return new _directives.GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, { - args: (0, _mapValue.default)(config.args, extendArg) - })); - } - - function extendNamedType(type) { - if ((0, _introspection.isIntrospectionType)(type) || (0, _scalars.isSpecifiedScalarType)(type)) { - // Builtin types are not extended. - return type; - } - - if ((0, _definition.isScalarType)(type)) { - return extendScalarType(type); - } - - if ((0, _definition.isObjectType)(type)) { - return extendObjectType(type); - } - - if ((0, _definition.isInterfaceType)(type)) { - return extendInterfaceType(type); - } - - if ((0, _definition.isUnionType)(type)) { - return extendUnionType(type); - } - - if ((0, _definition.isEnumType)(type)) { - return extendEnumType(type); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isInputObjectType)(type)) { - return extendInputObjectType(type); - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); - } - - function extendInputObjectType(type) { - var _typeExtensionsMap$co; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co !== void 0 ? _typeExtensionsMap$co : []; - return new _definition.GraphQLInputObjectType(_objectSpread(_objectSpread({}, config), {}, { - fields: function fields() { - return _objectSpread(_objectSpread({}, (0, _mapValue.default)(config.fields, function (field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type) - }); - })), buildInputFieldMap(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendEnumType(type) { - var _typeExtensionsMap$ty; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && _typeExtensionsMap$ty !== void 0 ? _typeExtensionsMap$ty : []; - return new _definition.GraphQLEnumType(_objectSpread(_objectSpread({}, config), {}, { - values: _objectSpread(_objectSpread({}, config.values), buildEnumValueMap(extensions)), - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendScalarType(type) { - var _typeExtensionsMap$co2; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co2 !== void 0 ? _typeExtensionsMap$co2 : []; - var specifiedByUrl = config.specifiedByUrl; - - for (var _i8 = 0; _i8 < extensions.length; _i8++) { - var _getSpecifiedByUrl; - - var extensionNode = extensions[_i8]; - specifiedByUrl = (_getSpecifiedByUrl = getSpecifiedByUrl(extensionNode)) !== null && _getSpecifiedByUrl !== void 0 ? _getSpecifiedByUrl : specifiedByUrl; - } - - return new _definition.GraphQLScalarType(_objectSpread(_objectSpread({}, config), {}, { - specifiedByUrl: specifiedByUrl, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendObjectType(type) { - var _typeExtensionsMap$co3; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co3 !== void 0 ? _typeExtensionsMap$co3 : []; - return new _definition.GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, { - interfaces: function interfaces() { - return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions)); - }, - fields: function fields() { - return _objectSpread(_objectSpread({}, (0, _mapValue.default)(config.fields, extendField)), buildFieldMap(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendInterfaceType(type) { - var _typeExtensionsMap$co4; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co4 !== void 0 ? _typeExtensionsMap$co4 : []; - return new _definition.GraphQLInterfaceType(_objectSpread(_objectSpread({}, config), {}, { - interfaces: function interfaces() { - return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions)); - }, - fields: function fields() { - return _objectSpread(_objectSpread({}, (0, _mapValue.default)(config.fields, extendField)), buildFieldMap(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendUnionType(type) { - var _typeExtensionsMap$co5; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : []; - return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, config), {}, { - types: function types() { - return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendField(field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type), - // $FlowFixMe[incompatible-call] - args: (0, _mapValue.default)(field.args, extendArg) - }); - } - - function extendArg(arg) { - return _objectSpread(_objectSpread({}, arg), {}, { - type: replaceType(arg.type) - }); - } - - function getOperationTypes(nodes) { - var opTypes = {}; - - for (var _i10 = 0; _i10 < nodes.length; _i10++) { - var _node$operationTypes; - - var node = nodes[_i10]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; - - for (var _i12 = 0; _i12 < operationTypesNodes.length; _i12++) { - var operationType = operationTypesNodes[_i12]; - opTypes[operationType.operation] = getNamedType(operationType.type); - } - } // Note: While this could make early assertions to get the correctly - // typed values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - - - return opTypes; - } - - function getNamedType(node) { - var _stdTypeMap$name2; - - var name = node.name.value; - var type = (_stdTypeMap$name2 = stdTypeMap[name]) !== null && _stdTypeMap$name2 !== void 0 ? _stdTypeMap$name2 : typeMap[name]; - - if (type === undefined) { - throw new Error("Unknown type: \"".concat(name, "\".")); - } - - return type; - } - - function getWrappedType(node) { - if (node.kind === _kinds.Kind.LIST_TYPE) { - return new _definition.GraphQLList(getWrappedType(node.type)); - } - - if (node.kind === _kinds.Kind.NON_NULL_TYPE) { - return new _definition.GraphQLNonNull(getWrappedType(node.type)); - } - - return getNamedType(node); - } - - function buildDirective(node) { - var locations = node.locations.map(function (_ref) { - var value = _ref.value; - return value; - }); - return new _directives.GraphQLDirective({ - name: node.name.value, - description: getDescription(node, options), - locations: locations, - isRepeatable: node.repeatable, - args: buildArgumentMap(node.arguments), - astNode: node - }); - } - - function buildFieldMap(nodes) { - var fieldConfigMap = Object.create(null); - - for (var _i14 = 0; _i14 < nodes.length; _i14++) { - var _node$fields; - - var node = nodes[_i14]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var nodeFields = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; - - for (var _i16 = 0; _i16 < nodeFields.length; _i16++) { - var field = nodeFields[_i16]; - fieldConfigMap[field.name.value] = { - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - type: getWrappedType(field.type), - description: getDescription(field, options), - args: buildArgumentMap(field.arguments), - deprecationReason: getDeprecationReason(field), - astNode: field - }; - } - } - - return fieldConfigMap; - } - - function buildArgumentMap(args) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argsNodes = args !== null && args !== void 0 ? args : []; - var argConfigMap = Object.create(null); - - for (var _i18 = 0; _i18 < argsNodes.length; _i18++) { - var arg = argsNodes[_i18]; - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - var type = getWrappedType(arg.type); - argConfigMap[arg.name.value] = { - type: type, - description: getDescription(arg, options), - defaultValue: (0, _valueFromAST.valueFromAST)(arg.defaultValue, type), - deprecationReason: getDeprecationReason(arg), - astNode: arg - }; - } - - return argConfigMap; - } - - function buildInputFieldMap(nodes) { - var inputFieldMap = Object.create(null); - - for (var _i20 = 0; _i20 < nodes.length; _i20++) { - var _node$fields2; - - var node = nodes[_i20]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var fieldsNodes = (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 ? _node$fields2 : []; - - for (var _i22 = 0; _i22 < fieldsNodes.length; _i22++) { - var field = fieldsNodes[_i22]; - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - var type = getWrappedType(field.type); - inputFieldMap[field.name.value] = { - type: type, - description: getDescription(field, options), - defaultValue: (0, _valueFromAST.valueFromAST)(field.defaultValue, type), - deprecationReason: getDeprecationReason(field), - astNode: field - }; - } - } - - return inputFieldMap; - } - - function buildEnumValueMap(nodes) { - var enumValueMap = Object.create(null); - - for (var _i24 = 0; _i24 < nodes.length; _i24++) { - var _node$values; - - var node = nodes[_i24]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var valuesNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; - - for (var _i26 = 0; _i26 < valuesNodes.length; _i26++) { - var value = valuesNodes[_i26]; - enumValueMap[value.name.value] = { - description: getDescription(value, options), - deprecationReason: getDeprecationReason(value), - astNode: value - }; - } - } - - return enumValueMap; - } - - function buildInterfaces(nodes) { - var interfaces = []; - - for (var _i28 = 0; _i28 < nodes.length; _i28++) { - var _node$interfaces; - - var node = nodes[_i28]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var interfacesNodes = (_node$interfaces = node.interfaces) !== null && _node$interfaces !== void 0 ? _node$interfaces : []; - - for (var _i30 = 0; _i30 < interfacesNodes.length; _i30++) { - var type = interfacesNodes[_i30]; - // Note: While this could make assertions to get the correctly typed - // values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable - // results. - interfaces.push(getNamedType(type)); - } - } - - return interfaces; - } - - function buildUnionTypes(nodes) { - var types = []; - - for (var _i32 = 0; _i32 < nodes.length; _i32++) { - var _node$types; - - var node = nodes[_i32]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : []; - - for (var _i34 = 0; _i34 < typeNodes.length; _i34++) { - var type = typeNodes[_i34]; - // Note: While this could make assertions to get the correctly typed - // values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable - // results. - types.push(getNamedType(type)); - } - } - - return types; - } - - function buildType(astNode) { - var _typeExtensionsMap$na; - - var name = astNode.name.value; - var description = getDescription(astNode, options); - var extensionNodes = (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && _typeExtensionsMap$na !== void 0 ? _typeExtensionsMap$na : []; - - switch (astNode.kind) { - case _kinds.Kind.OBJECT_TYPE_DEFINITION: - { - var extensionASTNodes = extensionNodes; - var allNodes = [astNode].concat(extensionASTNodes); - return new _definition.GraphQLObjectType({ - name: name, - description: description, - interfaces: function interfaces() { - return buildInterfaces(allNodes); - }, - fields: function fields() { - return buildFieldMap(allNodes); - }, - astNode: astNode, - extensionASTNodes: extensionASTNodes - }); - } - - case _kinds.Kind.INTERFACE_TYPE_DEFINITION: - { - var _extensionASTNodes = extensionNodes; - - var _allNodes = [astNode].concat(_extensionASTNodes); - - return new _definition.GraphQLInterfaceType({ - name: name, - description: description, - interfaces: function interfaces() { - return buildInterfaces(_allNodes); - }, - fields: function fields() { - return buildFieldMap(_allNodes); - }, - astNode: astNode, - extensionASTNodes: _extensionASTNodes - }); - } - - case _kinds.Kind.ENUM_TYPE_DEFINITION: - { - var _extensionASTNodes2 = extensionNodes; - - var _allNodes2 = [astNode].concat(_extensionASTNodes2); - - return new _definition.GraphQLEnumType({ - name: name, - description: description, - values: buildEnumValueMap(_allNodes2), - astNode: astNode, - extensionASTNodes: _extensionASTNodes2 - }); - } - - case _kinds.Kind.UNION_TYPE_DEFINITION: - { - var _extensionASTNodes3 = extensionNodes; - - var _allNodes3 = [astNode].concat(_extensionASTNodes3); - - return new _definition.GraphQLUnionType({ - name: name, - description: description, - types: function types() { - return buildUnionTypes(_allNodes3); - }, - astNode: astNode, - extensionASTNodes: _extensionASTNodes3 - }); - } - - case _kinds.Kind.SCALAR_TYPE_DEFINITION: - { - var _extensionASTNodes4 = extensionNodes; - return new _definition.GraphQLScalarType({ - name: name, - description: description, - specifiedByUrl: getSpecifiedByUrl(astNode), - astNode: astNode, - extensionASTNodes: _extensionASTNodes4 - }); - } - - case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: - { - var _extensionASTNodes5 = extensionNodes; - - var _allNodes4 = [astNode].concat(_extensionASTNodes5); - - return new _definition.GraphQLInputObjectType({ - name: name, - description: description, - fields: function fields() { - return buildInputFieldMap(_allNodes4); - }, - astNode: astNode, - extensionASTNodes: _extensionASTNodes5 - }); - } - } // istanbul ignore next (Not reachable. All possible type definition nodes have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type definition node: ' + (0, _inspect.default)(astNode)); - } -} - -var stdTypeMap = (0, _keyMap.default)(_scalars.specifiedScalarTypes.concat(_introspection.introspectionTypes), function (type) { - return type.name; -}); -/** - * Given a field or enum value node, returns the string value for the - * deprecation reason. - */ - -function getDeprecationReason(node) { - var deprecated = (0, _values.getDirectiveValues)(_directives.GraphQLDeprecatedDirective, node); - return deprecated === null || deprecated === void 0 ? void 0 : deprecated.reason; -} -/** - * Given a scalar node, returns the string value for the specifiedByUrl. - */ - - -function getSpecifiedByUrl(node) { - var specifiedBy = (0, _values.getDirectiveValues)(_directives.GraphQLSpecifiedByDirective, node); - return specifiedBy === null || specifiedBy === void 0 ? void 0 : specifiedBy.url; -} -/** - * Given an ast node, returns its string description. - * @deprecated: provided to ease adoption and will be removed in v16. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ - - -function getDescription(node, options) { - if (node.description) { - return node.description.value; - } - - if ((options === null || options === void 0 ? void 0 : options.commentDescriptions) === true) { - var rawValue = getLeadingCommentBlock(node); - - if (rawValue !== undefined) { - return (0, _blockString.dedentBlockStringValue)('\n' + rawValue); - } - } -} - -function getLeadingCommentBlock(node) { - var loc = node.loc; - - if (!loc) { - return; - } - - var comments = []; - var token = loc.startToken.prev; - - while (token != null && token.kind === _tokenKind.TokenKind.COMMENT && token.next && token.prev && token.line + 1 === token.next.line && token.line !== token.prev.line) { - var value = String(token.value); - comments.push(value); - token = token.prev; - } - - return comments.length > 0 ? comments.reverse().join('\n') : undefined; -} diff --git a/node_modules/graphql/utilities/extendSchema.js.flow b/node_modules/graphql/utilities/extendSchema.js.flow deleted file mode 100644 index 2d5a229d..00000000 --- a/node_modules/graphql/utilities/extendSchema.js.flow +++ /dev/null @@ -1,782 +0,0 @@ -// @flow strict -import objectValues from '../polyfills/objectValues'; - -import keyMap from '../jsutils/keyMap'; -import inspect from '../jsutils/inspect'; -import mapValue from '../jsutils/mapValue'; -import invariant from '../jsutils/invariant'; -import devAssert from '../jsutils/devAssert'; - -import type { DirectiveLocationEnum } from '../language/directiveLocation'; -import type { - Location, - DocumentNode, - StringValueNode, - TypeNode, - NamedTypeNode, - SchemaDefinitionNode, - SchemaExtensionNode, - TypeDefinitionNode, - InterfaceTypeDefinitionNode, - InterfaceTypeExtensionNode, - ObjectTypeDefinitionNode, - ObjectTypeExtensionNode, - UnionTypeDefinitionNode, - UnionTypeExtensionNode, - FieldDefinitionNode, - InputObjectTypeDefinitionNode, - InputObjectTypeExtensionNode, - InputValueDefinitionNode, - EnumTypeDefinitionNode, - EnumTypeExtensionNode, - EnumValueDefinitionNode, - DirectiveDefinitionNode, - ScalarTypeDefinitionNode, - ScalarTypeExtensionNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; -import { TokenKind } from '../language/tokenKind'; -import { dedentBlockStringValue } from '../language/blockString'; -import { - isTypeDefinitionNode, - isTypeExtensionNode, -} from '../language/predicates'; - -import { assertValidSDLExtension } from '../validation/validate'; - -import { getDirectiveValues } from '../execution/values'; - -import type { - GraphQLSchemaValidationOptions, - GraphQLSchemaNormalizedConfig, -} from '../type/schema'; -import type { - GraphQLType, - GraphQLNamedType, - GraphQLFieldConfig, - GraphQLFieldConfigMap, - GraphQLArgumentConfig, - GraphQLFieldConfigArgumentMap, - GraphQLEnumValueConfigMap, - GraphQLInputFieldConfigMap, -} from '../type/definition'; -import { assertSchema, GraphQLSchema } from '../type/schema'; -import { specifiedScalarTypes, isSpecifiedScalarType } from '../type/scalars'; -import { introspectionTypes, isIntrospectionType } from '../type/introspection'; -import { - GraphQLDirective, - GraphQLDeprecatedDirective, - GraphQLSpecifiedByDirective, -} from '../type/directives'; -import { - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isListType, - isNonNullType, - isEnumType, - isInputObjectType, - GraphQLList, - GraphQLNonNull, - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, -} from '../type/definition'; - -import { valueFromAST } from './valueFromAST'; - -type Options = {| - ...GraphQLSchemaValidationOptions, - - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * This option is provided to ease adoption and will be removed in v16. - * - * Default: false - */ - commentDescriptions?: boolean, - - /** - * Set to true to assume the SDL is valid. - * - * Default: false - */ - assumeValidSDL?: boolean, -|}; - -/** - * Produces a new schema given an existing schema and a document which may - * contain GraphQL type extensions and definitions. The original schema will - * remain unaltered. - * - * Because a schema represents a graph of references, a schema cannot be - * extended without effectively making an entire copy. We do not know until it's - * too late if subgraphs remain unchanged. - * - * This algorithm copies the provided schema, applying extensions while - * producing the copy. The original schema remains unaltered. - * - * Accepts options as a third argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function extendSchema( - schema: GraphQLSchema, - documentAST: DocumentNode, - options?: Options, -): GraphQLSchema { - assertSchema(schema); - - devAssert( - documentAST != null && documentAST.kind === Kind.DOCUMENT, - 'Must provide valid Document AST.', - ); - - if (options?.assumeValid !== true && options?.assumeValidSDL !== true) { - assertValidSDLExtension(documentAST, schema); - } - - const schemaConfig = schema.toConfig(); - const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); - return schemaConfig === extendedConfig - ? schema - : new GraphQLSchema(extendedConfig); -} - -/** - * @internal - */ -export function extendSchemaImpl( - schemaConfig: GraphQLSchemaNormalizedConfig, - documentAST: DocumentNode, - options?: Options, -): GraphQLSchemaNormalizedConfig { - // Collect the type definitions and extensions found in the document. - const typeDefs: Array = []; - const typeExtensionsMap = Object.create(null); - - // New directives and types are separate because a directives and types can - // have the same name. For example, a type named "skip". - const directiveDefs: Array = []; - - let schemaDef: ?SchemaDefinitionNode; - // Schema extensions are collected which may add additional operation types. - const schemaExtensions: Array = []; - - for (const def of documentAST.definitions) { - if (def.kind === Kind.SCHEMA_DEFINITION) { - schemaDef = def; - } else if (def.kind === Kind.SCHEMA_EXTENSION) { - schemaExtensions.push(def); - } else if (isTypeDefinitionNode(def)) { - typeDefs.push(def); - } else if (isTypeExtensionNode(def)) { - const extendedTypeName = def.name.value; - const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; - typeExtensionsMap[extendedTypeName] = existingTypeExtensions - ? existingTypeExtensions.concat([def]) - : [def]; - } else if (def.kind === Kind.DIRECTIVE_DEFINITION) { - directiveDefs.push(def); - } - } - - // If this document contains no new types, extensions, or directives then - // return the same unmodified GraphQLSchema instance. - if ( - Object.keys(typeExtensionsMap).length === 0 && - typeDefs.length === 0 && - directiveDefs.length === 0 && - schemaExtensions.length === 0 && - schemaDef == null - ) { - return schemaConfig; - } - - const typeMap = Object.create(null); - for (const existingType of schemaConfig.types) { - typeMap[existingType.name] = extendNamedType(existingType); - } - - for (const typeNode of typeDefs) { - const name = typeNode.name.value; - typeMap[name] = stdTypeMap[name] ?? buildType(typeNode); - } - - const operationTypes = { - // Get the extended root operation types. - query: schemaConfig.query && replaceNamedType(schemaConfig.query), - mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), - subscription: - schemaConfig.subscription && replaceNamedType(schemaConfig.subscription), - // Then, incorporate schema definition and all schema extensions. - ...(schemaDef && getOperationTypes([schemaDef])), - ...getOperationTypes(schemaExtensions), - }; - - // Then produce and return a Schema config with these types. - return { - description: schemaDef?.description?.value, - ...operationTypes, - types: objectValues(typeMap), - directives: [ - ...schemaConfig.directives.map(replaceDirective), - ...directiveDefs.map(buildDirective), - ], - extensions: undefined, - astNode: schemaDef ?? schemaConfig.astNode, - extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), - assumeValid: options?.assumeValid ?? false, - }; - - // Below are functions used for producing this schema that have closed over - // this scope and have access to the schema, cache, and newly defined types. - - function replaceType(type: T): T { - if (isListType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLList(replaceType(type.ofType)); - } - if (isNonNullType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLNonNull(replaceType(type.ofType)); - } - return replaceNamedType(type); - } - - function replaceNamedType(type: T): T { - // Note: While this could make early assertions to get the correctly - // typed values, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - return ((typeMap[type.name]: any): T); - } - - function replaceDirective(directive: GraphQLDirective): GraphQLDirective { - const config = directive.toConfig(); - return new GraphQLDirective({ - ...config, - args: mapValue(config.args, extendArg), - }); - } - - function extendNamedType(type: GraphQLNamedType): GraphQLNamedType { - if (isIntrospectionType(type) || isSpecifiedScalarType(type)) { - // Builtin types are not extended. - return type; - } - if (isScalarType(type)) { - return extendScalarType(type); - } - if (isObjectType(type)) { - return extendObjectType(type); - } - if (isInterfaceType(type)) { - return extendInterfaceType(type); - } - if (isUnionType(type)) { - return extendUnionType(type); - } - if (isEnumType(type)) { - return extendEnumType(type); - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isInputObjectType(type)) { - return extendInputObjectType(type); - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected type: ' + inspect((type: empty))); - } - - function extendInputObjectType( - type: GraphQLInputObjectType, - ): GraphQLInputObjectType { - const config = type.toConfig(); - const extensions = typeExtensionsMap[config.name] ?? []; - - return new GraphQLInputObjectType({ - ...config, - fields: () => ({ - ...mapValue(config.fields, (field) => ({ - ...field, - type: replaceType(field.type), - })), - ...buildInputFieldMap(extensions), - }), - extensionASTNodes: config.extensionASTNodes.concat(extensions), - }); - } - - function extendEnumType(type: GraphQLEnumType): GraphQLEnumType { - const config = type.toConfig(); - const extensions = typeExtensionsMap[type.name] ?? []; - - return new GraphQLEnumType({ - ...config, - values: { - ...config.values, - ...buildEnumValueMap(extensions), - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions), - }); - } - - function extendScalarType(type: GraphQLScalarType): GraphQLScalarType { - const config = type.toConfig(); - const extensions = typeExtensionsMap[config.name] ?? []; - - let specifiedByUrl = config.specifiedByUrl; - for (const extensionNode of extensions) { - specifiedByUrl = getSpecifiedByUrl(extensionNode) ?? specifiedByUrl; - } - - return new GraphQLScalarType({ - ...config, - specifiedByUrl, - extensionASTNodes: config.extensionASTNodes.concat(extensions), - }); - } - - function extendObjectType(type: GraphQLObjectType): GraphQLObjectType { - const config = type.toConfig(); - const extensions = typeExtensionsMap[config.name] ?? []; - - return new GraphQLObjectType({ - ...config, - interfaces: () => [ - ...type.getInterfaces().map(replaceNamedType), - ...buildInterfaces(extensions), - ], - fields: () => ({ - ...mapValue(config.fields, extendField), - ...buildFieldMap(extensions), - }), - extensionASTNodes: config.extensionASTNodes.concat(extensions), - }); - } - - function extendInterfaceType( - type: GraphQLInterfaceType, - ): GraphQLInterfaceType { - const config = type.toConfig(); - const extensions = typeExtensionsMap[config.name] ?? []; - - return new GraphQLInterfaceType({ - ...config, - interfaces: () => [ - ...type.getInterfaces().map(replaceNamedType), - ...buildInterfaces(extensions), - ], - fields: () => ({ - ...mapValue(config.fields, extendField), - ...buildFieldMap(extensions), - }), - extensionASTNodes: config.extensionASTNodes.concat(extensions), - }); - } - - function extendUnionType(type: GraphQLUnionType): GraphQLUnionType { - const config = type.toConfig(); - const extensions = typeExtensionsMap[config.name] ?? []; - - return new GraphQLUnionType({ - ...config, - types: () => [ - ...type.getTypes().map(replaceNamedType), - ...buildUnionTypes(extensions), - ], - extensionASTNodes: config.extensionASTNodes.concat(extensions), - }); - } - - function extendField( - field: GraphQLFieldConfig, - ): GraphQLFieldConfig { - return { - ...field, - type: replaceType(field.type), - // $FlowFixMe[incompatible-call] - args: mapValue(field.args, extendArg), - }; - } - - function extendArg(arg: GraphQLArgumentConfig) { - return { - ...arg, - type: replaceType(arg.type), - }; - } - - function getOperationTypes( - nodes: $ReadOnlyArray, - ): {| - query: ?GraphQLObjectType, - mutation: ?GraphQLObjectType, - subscription: ?GraphQLObjectType, - |} { - const opTypes = {}; - for (const node of nodes) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const operationTypesNodes = node.operationTypes ?? []; - - for (const operationType of operationTypesNodes) { - opTypes[operationType.operation] = getNamedType(operationType.type); - } - } - - // Note: While this could make early assertions to get the correctly - // typed values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - return (opTypes: any); - } - - function getNamedType(node: NamedTypeNode): GraphQLNamedType { - const name = node.name.value; - const type = stdTypeMap[name] ?? typeMap[name]; - - if (type === undefined) { - throw new Error(`Unknown type: "${name}".`); - } - return type; - } - - function getWrappedType(node: TypeNode): GraphQLType { - if (node.kind === Kind.LIST_TYPE) { - return new GraphQLList(getWrappedType(node.type)); - } - if (node.kind === Kind.NON_NULL_TYPE) { - return new GraphQLNonNull(getWrappedType(node.type)); - } - return getNamedType(node); - } - - function buildDirective(node: DirectiveDefinitionNode): GraphQLDirective { - const locations = node.locations.map( - ({ value }) => ((value: any): DirectiveLocationEnum), - ); - - return new GraphQLDirective({ - name: node.name.value, - description: getDescription(node, options), - locations, - isRepeatable: node.repeatable, - args: buildArgumentMap(node.arguments), - astNode: node, - }); - } - - function buildFieldMap( - nodes: $ReadOnlyArray< - | InterfaceTypeDefinitionNode - | InterfaceTypeExtensionNode - | ObjectTypeDefinitionNode - | ObjectTypeExtensionNode, - >, - ): GraphQLFieldConfigMap { - const fieldConfigMap = Object.create(null); - for (const node of nodes) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const nodeFields = node.fields ?? []; - - for (const field of nodeFields) { - fieldConfigMap[field.name.value] = { - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - type: (getWrappedType(field.type): any), - description: getDescription(field, options), - args: buildArgumentMap(field.arguments), - deprecationReason: getDeprecationReason(field), - astNode: field, - }; - } - } - return fieldConfigMap; - } - - function buildArgumentMap( - args: ?$ReadOnlyArray, - ): GraphQLFieldConfigArgumentMap { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argsNodes = args ?? []; - - const argConfigMap = Object.create(null); - for (const arg of argsNodes) { - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - const type: any = getWrappedType(arg.type); - - argConfigMap[arg.name.value] = { - type, - description: getDescription(arg, options), - defaultValue: valueFromAST(arg.defaultValue, type), - deprecationReason: getDeprecationReason(arg), - astNode: arg, - }; - } - return argConfigMap; - } - - function buildInputFieldMap( - nodes: $ReadOnlyArray< - InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode, - >, - ): GraphQLInputFieldConfigMap { - const inputFieldMap = Object.create(null); - for (const node of nodes) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const fieldsNodes = node.fields ?? []; - - for (const field of fieldsNodes) { - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - const type: any = getWrappedType(field.type); - - inputFieldMap[field.name.value] = { - type, - description: getDescription(field, options), - defaultValue: valueFromAST(field.defaultValue, type), - deprecationReason: getDeprecationReason(field), - astNode: field, - }; - } - } - return inputFieldMap; - } - - function buildEnumValueMap( - nodes: $ReadOnlyArray, - ): GraphQLEnumValueConfigMap { - const enumValueMap = Object.create(null); - for (const node of nodes) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const valuesNodes = node.values ?? []; - - for (const value of valuesNodes) { - enumValueMap[value.name.value] = { - description: getDescription(value, options), - deprecationReason: getDeprecationReason(value), - astNode: value, - }; - } - } - return enumValueMap; - } - - function buildInterfaces( - nodes: $ReadOnlyArray< - | InterfaceTypeDefinitionNode - | InterfaceTypeExtensionNode - | ObjectTypeDefinitionNode - | ObjectTypeExtensionNode, - >, - ): Array { - const interfaces = []; - for (const node of nodes) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const interfacesNodes = node.interfaces ?? []; - - for (const type of interfacesNodes) { - // Note: While this could make assertions to get the correctly typed - // values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable - // results. - interfaces.push((getNamedType(type): any)); - } - } - return interfaces; - } - - function buildUnionTypes( - nodes: $ReadOnlyArray, - ): Array { - const types = []; - for (const node of nodes) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const typeNodes = node.types ?? []; - - for (const type of typeNodes) { - // Note: While this could make assertions to get the correctly typed - // values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable - // results. - types.push((getNamedType(type): any)); - } - } - return types; - } - - function buildType(astNode: TypeDefinitionNode): GraphQLNamedType { - const name = astNode.name.value; - const description = getDescription(astNode, options); - const extensionNodes = typeExtensionsMap[name] ?? []; - - switch (astNode.kind) { - case Kind.OBJECT_TYPE_DEFINITION: { - const extensionASTNodes = (extensionNodes: any); - const allNodes = [astNode, ...extensionASTNodes]; - - return new GraphQLObjectType({ - name, - description, - interfaces: () => buildInterfaces(allNodes), - fields: () => buildFieldMap(allNodes), - astNode, - extensionASTNodes, - }); - } - case Kind.INTERFACE_TYPE_DEFINITION: { - const extensionASTNodes = (extensionNodes: any); - const allNodes = [astNode, ...extensionASTNodes]; - - return new GraphQLInterfaceType({ - name, - description, - interfaces: () => buildInterfaces(allNodes), - fields: () => buildFieldMap(allNodes), - astNode, - extensionASTNodes, - }); - } - case Kind.ENUM_TYPE_DEFINITION: { - const extensionASTNodes = (extensionNodes: any); - const allNodes = [astNode, ...extensionASTNodes]; - - return new GraphQLEnumType({ - name, - description, - values: buildEnumValueMap(allNodes), - astNode, - extensionASTNodes, - }); - } - case Kind.UNION_TYPE_DEFINITION: { - const extensionASTNodes = (extensionNodes: any); - const allNodes = [astNode, ...extensionASTNodes]; - - return new GraphQLUnionType({ - name, - description, - types: () => buildUnionTypes(allNodes), - astNode, - extensionASTNodes, - }); - } - case Kind.SCALAR_TYPE_DEFINITION: { - const extensionASTNodes = (extensionNodes: any); - - return new GraphQLScalarType({ - name, - description, - specifiedByUrl: getSpecifiedByUrl(astNode), - astNode, - extensionASTNodes, - }); - } - case Kind.INPUT_OBJECT_TYPE_DEFINITION: { - const extensionASTNodes = (extensionNodes: any); - const allNodes = [astNode, ...extensionASTNodes]; - - return new GraphQLInputObjectType({ - name, - description, - fields: () => buildInputFieldMap(allNodes), - astNode, - extensionASTNodes, - }); - } - } - - // istanbul ignore next (Not reachable. All possible type definition nodes have been considered) - invariant( - false, - 'Unexpected type definition node: ' + inspect((astNode: empty)), - ); - } -} - -const stdTypeMap = keyMap( - specifiedScalarTypes.concat(introspectionTypes), - (type) => type.name, -); - -/** - * Given a field or enum value node, returns the string value for the - * deprecation reason. - */ -function getDeprecationReason( - node: - | EnumValueDefinitionNode - | FieldDefinitionNode - | InputValueDefinitionNode, -): ?string { - const deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node); - return (deprecated?.reason: any); -} - -/** - * Given a scalar node, returns the string value for the specifiedByUrl. - */ -function getSpecifiedByUrl( - node: ScalarTypeDefinitionNode | ScalarTypeExtensionNode, -): ?string { - const specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node); - return (specifiedBy?.url: any); -} - -/** - * Given an ast node, returns its string description. - * @deprecated: provided to ease adoption and will be removed in v16. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function getDescription( - node: { +description?: StringValueNode, +loc?: Location, ... }, - options: ?{ commentDescriptions?: boolean, ... }, -): void | string { - if (node.description) { - return node.description.value; - } - if (options?.commentDescriptions === true) { - const rawValue = getLeadingCommentBlock(node); - if (rawValue !== undefined) { - return dedentBlockStringValue('\n' + rawValue); - } - } -} - -function getLeadingCommentBlock(node): void | string { - const loc = node.loc; - if (!loc) { - return; - } - const comments = []; - let token = loc.startToken.prev; - while ( - token != null && - token.kind === TokenKind.COMMENT && - token.next && - token.prev && - token.line + 1 === token.next.line && - token.line !== token.prev.line - ) { - const value = String(token.value); - comments.push(value); - token = token.prev; - } - return comments.length > 0 ? comments.reverse().join('\n') : undefined; -} diff --git a/node_modules/graphql/utilities/extendSchema.mjs b/node_modules/graphql/utilities/extendSchema.mjs deleted file mode 100644 index b6ee4c9a..00000000 --- a/node_modules/graphql/utilities/extendSchema.mjs +++ /dev/null @@ -1,689 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import objectValues from "../polyfills/objectValues.mjs"; -import keyMap from "../jsutils/keyMap.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import mapValue from "../jsutils/mapValue.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import devAssert from "../jsutils/devAssert.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { TokenKind } from "../language/tokenKind.mjs"; -import { dedentBlockStringValue } from "../language/blockString.mjs"; -import { isTypeDefinitionNode, isTypeExtensionNode } from "../language/predicates.mjs"; -import { assertValidSDLExtension } from "../validation/validate.mjs"; -import { getDirectiveValues } from "../execution/values.mjs"; -import { assertSchema, GraphQLSchema } from "../type/schema.mjs"; -import { specifiedScalarTypes, isSpecifiedScalarType } from "../type/scalars.mjs"; -import { introspectionTypes, isIntrospectionType } from "../type/introspection.mjs"; -import { GraphQLDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective } from "../type/directives.mjs"; -import { isScalarType, isObjectType, isInterfaceType, isUnionType, isListType, isNonNullType, isEnumType, isInputObjectType, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType } from "../type/definition.mjs"; -import { valueFromAST } from "./valueFromAST.mjs"; - -/** - * Produces a new schema given an existing schema and a document which may - * contain GraphQL type extensions and definitions. The original schema will - * remain unaltered. - * - * Because a schema represents a graph of references, a schema cannot be - * extended without effectively making an entire copy. We do not know until it's - * too late if subgraphs remain unchanged. - * - * This algorithm copies the provided schema, applying extensions while - * producing the copy. The original schema remains unaltered. - * - * Accepts options as a third argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function extendSchema(schema, documentAST, options) { - assertSchema(schema); - documentAST != null && documentAST.kind === Kind.DOCUMENT || devAssert(0, 'Must provide valid Document AST.'); - - if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { - assertValidSDLExtension(documentAST, schema); - } - - var schemaConfig = schema.toConfig(); - var extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); - return schemaConfig === extendedConfig ? schema : new GraphQLSchema(extendedConfig); -} -/** - * @internal - */ - -export function extendSchemaImpl(schemaConfig, documentAST, options) { - var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; - - // Collect the type definitions and extensions found in the document. - var typeDefs = []; - var typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can - // have the same name. For example, a type named "skip". - - var directiveDefs = []; - var schemaDef; // Schema extensions are collected which may add additional operation types. - - var schemaExtensions = []; - - for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) { - var def = _documentAST$definiti2[_i2]; - - if (def.kind === Kind.SCHEMA_DEFINITION) { - schemaDef = def; - } else if (def.kind === Kind.SCHEMA_EXTENSION) { - schemaExtensions.push(def); - } else if (isTypeDefinitionNode(def)) { - typeDefs.push(def); - } else if (isTypeExtensionNode(def)) { - var extendedTypeName = def.name.value; - var existingTypeExtensions = typeExtensionsMap[extendedTypeName]; - typeExtensionsMap[extendedTypeName] = existingTypeExtensions ? existingTypeExtensions.concat([def]) : [def]; - } else if (def.kind === Kind.DIRECTIVE_DEFINITION) { - directiveDefs.push(def); - } - } // If this document contains no new types, extensions, or directives then - // return the same unmodified GraphQLSchema instance. - - - if (Object.keys(typeExtensionsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExtensions.length === 0 && schemaDef == null) { - return schemaConfig; - } - - var typeMap = Object.create(null); - - for (var _i4 = 0, _schemaConfig$types2 = schemaConfig.types; _i4 < _schemaConfig$types2.length; _i4++) { - var existingType = _schemaConfig$types2[_i4]; - typeMap[existingType.name] = extendNamedType(existingType); - } - - for (var _i6 = 0; _i6 < typeDefs.length; _i6++) { - var _stdTypeMap$name; - - var typeNode = typeDefs[_i6]; - var name = typeNode.name.value; - typeMap[name] = (_stdTypeMap$name = stdTypeMap[name]) !== null && _stdTypeMap$name !== void 0 ? _stdTypeMap$name : buildType(typeNode); - } - - var operationTypes = _objectSpread(_objectSpread({ - // Get the extended root operation types. - query: schemaConfig.query && replaceNamedType(schemaConfig.query), - mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), - subscription: schemaConfig.subscription && replaceNamedType(schemaConfig.subscription) - }, schemaDef && getOperationTypes([schemaDef])), getOperationTypes(schemaExtensions)); // Then produce and return a Schema config with these types. - - - return _objectSpread(_objectSpread({ - description: (_schemaDef = schemaDef) === null || _schemaDef === void 0 ? void 0 : (_schemaDef$descriptio = _schemaDef.description) === null || _schemaDef$descriptio === void 0 ? void 0 : _schemaDef$descriptio.value - }, operationTypes), {}, { - types: objectValues(typeMap), - directives: [].concat(schemaConfig.directives.map(replaceDirective), directiveDefs.map(buildDirective)), - extensions: undefined, - astNode: (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 ? _schemaDef2 : schemaConfig.astNode, - extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), - assumeValid: (_options$assumeValid = options === null || options === void 0 ? void 0 : options.assumeValid) !== null && _options$assumeValid !== void 0 ? _options$assumeValid : false - }); // Below are functions used for producing this schema that have closed over - // this scope and have access to the schema, cache, and newly defined types. - - function replaceType(type) { - if (isListType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLList(replaceType(type.ofType)); - } - - if (isNonNullType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLNonNull(replaceType(type.ofType)); - } - - return replaceNamedType(type); - } - - function replaceNamedType(type) { - // Note: While this could make early assertions to get the correctly - // typed values, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - return typeMap[type.name]; - } - - function replaceDirective(directive) { - var config = directive.toConfig(); - return new GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, { - args: mapValue(config.args, extendArg) - })); - } - - function extendNamedType(type) { - if (isIntrospectionType(type) || isSpecifiedScalarType(type)) { - // Builtin types are not extended. - return type; - } - - if (isScalarType(type)) { - return extendScalarType(type); - } - - if (isObjectType(type)) { - return extendObjectType(type); - } - - if (isInterfaceType(type)) { - return extendInterfaceType(type); - } - - if (isUnionType(type)) { - return extendUnionType(type); - } - - if (isEnumType(type)) { - return extendEnumType(type); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isInputObjectType(type)) { - return extendInputObjectType(type); - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected type: ' + inspect(type)); - } - - function extendInputObjectType(type) { - var _typeExtensionsMap$co; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co !== void 0 ? _typeExtensionsMap$co : []; - return new GraphQLInputObjectType(_objectSpread(_objectSpread({}, config), {}, { - fields: function fields() { - return _objectSpread(_objectSpread({}, mapValue(config.fields, function (field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type) - }); - })), buildInputFieldMap(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendEnumType(type) { - var _typeExtensionsMap$ty; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && _typeExtensionsMap$ty !== void 0 ? _typeExtensionsMap$ty : []; - return new GraphQLEnumType(_objectSpread(_objectSpread({}, config), {}, { - values: _objectSpread(_objectSpread({}, config.values), buildEnumValueMap(extensions)), - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendScalarType(type) { - var _typeExtensionsMap$co2; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co2 !== void 0 ? _typeExtensionsMap$co2 : []; - var specifiedByUrl = config.specifiedByUrl; - - for (var _i8 = 0; _i8 < extensions.length; _i8++) { - var _getSpecifiedByUrl; - - var extensionNode = extensions[_i8]; - specifiedByUrl = (_getSpecifiedByUrl = getSpecifiedByUrl(extensionNode)) !== null && _getSpecifiedByUrl !== void 0 ? _getSpecifiedByUrl : specifiedByUrl; - } - - return new GraphQLScalarType(_objectSpread(_objectSpread({}, config), {}, { - specifiedByUrl: specifiedByUrl, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendObjectType(type) { - var _typeExtensionsMap$co3; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co3 !== void 0 ? _typeExtensionsMap$co3 : []; - return new GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, { - interfaces: function interfaces() { - return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions)); - }, - fields: function fields() { - return _objectSpread(_objectSpread({}, mapValue(config.fields, extendField)), buildFieldMap(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendInterfaceType(type) { - var _typeExtensionsMap$co4; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co4 !== void 0 ? _typeExtensionsMap$co4 : []; - return new GraphQLInterfaceType(_objectSpread(_objectSpread({}, config), {}, { - interfaces: function interfaces() { - return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions)); - }, - fields: function fields() { - return _objectSpread(_objectSpread({}, mapValue(config.fields, extendField)), buildFieldMap(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendUnionType(type) { - var _typeExtensionsMap$co5; - - var config = type.toConfig(); - var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : []; - return new GraphQLUnionType(_objectSpread(_objectSpread({}, config), {}, { - types: function types() { - return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions)); - }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - })); - } - - function extendField(field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type), - // $FlowFixMe[incompatible-call] - args: mapValue(field.args, extendArg) - }); - } - - function extendArg(arg) { - return _objectSpread(_objectSpread({}, arg), {}, { - type: replaceType(arg.type) - }); - } - - function getOperationTypes(nodes) { - var opTypes = {}; - - for (var _i10 = 0; _i10 < nodes.length; _i10++) { - var _node$operationTypes; - - var node = nodes[_i10]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; - - for (var _i12 = 0; _i12 < operationTypesNodes.length; _i12++) { - var operationType = operationTypesNodes[_i12]; - opTypes[operationType.operation] = getNamedType(operationType.type); - } - } // Note: While this could make early assertions to get the correctly - // typed values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable results. - - - return opTypes; - } - - function getNamedType(node) { - var _stdTypeMap$name2; - - var name = node.name.value; - var type = (_stdTypeMap$name2 = stdTypeMap[name]) !== null && _stdTypeMap$name2 !== void 0 ? _stdTypeMap$name2 : typeMap[name]; - - if (type === undefined) { - throw new Error("Unknown type: \"".concat(name, "\".")); - } - - return type; - } - - function getWrappedType(node) { - if (node.kind === Kind.LIST_TYPE) { - return new GraphQLList(getWrappedType(node.type)); - } - - if (node.kind === Kind.NON_NULL_TYPE) { - return new GraphQLNonNull(getWrappedType(node.type)); - } - - return getNamedType(node); - } - - function buildDirective(node) { - var locations = node.locations.map(function (_ref) { - var value = _ref.value; - return value; - }); - return new GraphQLDirective({ - name: node.name.value, - description: getDescription(node, options), - locations: locations, - isRepeatable: node.repeatable, - args: buildArgumentMap(node.arguments), - astNode: node - }); - } - - function buildFieldMap(nodes) { - var fieldConfigMap = Object.create(null); - - for (var _i14 = 0; _i14 < nodes.length; _i14++) { - var _node$fields; - - var node = nodes[_i14]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var nodeFields = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; - - for (var _i16 = 0; _i16 < nodeFields.length; _i16++) { - var field = nodeFields[_i16]; - fieldConfigMap[field.name.value] = { - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - type: getWrappedType(field.type), - description: getDescription(field, options), - args: buildArgumentMap(field.arguments), - deprecationReason: getDeprecationReason(field), - astNode: field - }; - } - } - - return fieldConfigMap; - } - - function buildArgumentMap(args) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argsNodes = args !== null && args !== void 0 ? args : []; - var argConfigMap = Object.create(null); - - for (var _i18 = 0; _i18 < argsNodes.length; _i18++) { - var arg = argsNodes[_i18]; - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - var type = getWrappedType(arg.type); - argConfigMap[arg.name.value] = { - type: type, - description: getDescription(arg, options), - defaultValue: valueFromAST(arg.defaultValue, type), - deprecationReason: getDeprecationReason(arg), - astNode: arg - }; - } - - return argConfigMap; - } - - function buildInputFieldMap(nodes) { - var inputFieldMap = Object.create(null); - - for (var _i20 = 0; _i20 < nodes.length; _i20++) { - var _node$fields2; - - var node = nodes[_i20]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var fieldsNodes = (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 ? _node$fields2 : []; - - for (var _i22 = 0; _i22 < fieldsNodes.length; _i22++) { - var field = fieldsNodes[_i22]; - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - var type = getWrappedType(field.type); - inputFieldMap[field.name.value] = { - type: type, - description: getDescription(field, options), - defaultValue: valueFromAST(field.defaultValue, type), - deprecationReason: getDeprecationReason(field), - astNode: field - }; - } - } - - return inputFieldMap; - } - - function buildEnumValueMap(nodes) { - var enumValueMap = Object.create(null); - - for (var _i24 = 0; _i24 < nodes.length; _i24++) { - var _node$values; - - var node = nodes[_i24]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var valuesNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; - - for (var _i26 = 0; _i26 < valuesNodes.length; _i26++) { - var value = valuesNodes[_i26]; - enumValueMap[value.name.value] = { - description: getDescription(value, options), - deprecationReason: getDeprecationReason(value), - astNode: value - }; - } - } - - return enumValueMap; - } - - function buildInterfaces(nodes) { - var interfaces = []; - - for (var _i28 = 0; _i28 < nodes.length; _i28++) { - var _node$interfaces; - - var node = nodes[_i28]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var interfacesNodes = (_node$interfaces = node.interfaces) !== null && _node$interfaces !== void 0 ? _node$interfaces : []; - - for (var _i30 = 0; _i30 < interfacesNodes.length; _i30++) { - var type = interfacesNodes[_i30]; - // Note: While this could make assertions to get the correctly typed - // values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable - // results. - interfaces.push(getNamedType(type)); - } - } - - return interfaces; - } - - function buildUnionTypes(nodes) { - var types = []; - - for (var _i32 = 0; _i32 < nodes.length; _i32++) { - var _node$types; - - var node = nodes[_i32]; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : []; - - for (var _i34 = 0; _i34 < typeNodes.length; _i34++) { - var type = typeNodes[_i34]; - // Note: While this could make assertions to get the correctly typed - // values below, that would throw immediately while type system - // validation with validateSchema() will produce more actionable - // results. - types.push(getNamedType(type)); - } - } - - return types; - } - - function buildType(astNode) { - var _typeExtensionsMap$na; - - var name = astNode.name.value; - var description = getDescription(astNode, options); - var extensionNodes = (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && _typeExtensionsMap$na !== void 0 ? _typeExtensionsMap$na : []; - - switch (astNode.kind) { - case Kind.OBJECT_TYPE_DEFINITION: - { - var extensionASTNodes = extensionNodes; - var allNodes = [astNode].concat(extensionASTNodes); - return new GraphQLObjectType({ - name: name, - description: description, - interfaces: function interfaces() { - return buildInterfaces(allNodes); - }, - fields: function fields() { - return buildFieldMap(allNodes); - }, - astNode: astNode, - extensionASTNodes: extensionASTNodes - }); - } - - case Kind.INTERFACE_TYPE_DEFINITION: - { - var _extensionASTNodes = extensionNodes; - - var _allNodes = [astNode].concat(_extensionASTNodes); - - return new GraphQLInterfaceType({ - name: name, - description: description, - interfaces: function interfaces() { - return buildInterfaces(_allNodes); - }, - fields: function fields() { - return buildFieldMap(_allNodes); - }, - astNode: astNode, - extensionASTNodes: _extensionASTNodes - }); - } - - case Kind.ENUM_TYPE_DEFINITION: - { - var _extensionASTNodes2 = extensionNodes; - - var _allNodes2 = [astNode].concat(_extensionASTNodes2); - - return new GraphQLEnumType({ - name: name, - description: description, - values: buildEnumValueMap(_allNodes2), - astNode: astNode, - extensionASTNodes: _extensionASTNodes2 - }); - } - - case Kind.UNION_TYPE_DEFINITION: - { - var _extensionASTNodes3 = extensionNodes; - - var _allNodes3 = [astNode].concat(_extensionASTNodes3); - - return new GraphQLUnionType({ - name: name, - description: description, - types: function types() { - return buildUnionTypes(_allNodes3); - }, - astNode: astNode, - extensionASTNodes: _extensionASTNodes3 - }); - } - - case Kind.SCALAR_TYPE_DEFINITION: - { - var _extensionASTNodes4 = extensionNodes; - return new GraphQLScalarType({ - name: name, - description: description, - specifiedByUrl: getSpecifiedByUrl(astNode), - astNode: astNode, - extensionASTNodes: _extensionASTNodes4 - }); - } - - case Kind.INPUT_OBJECT_TYPE_DEFINITION: - { - var _extensionASTNodes5 = extensionNodes; - - var _allNodes4 = [astNode].concat(_extensionASTNodes5); - - return new GraphQLInputObjectType({ - name: name, - description: description, - fields: function fields() { - return buildInputFieldMap(_allNodes4); - }, - astNode: astNode, - extensionASTNodes: _extensionASTNodes5 - }); - } - } // istanbul ignore next (Not reachable. All possible type definition nodes have been considered) - - - false || invariant(0, 'Unexpected type definition node: ' + inspect(astNode)); - } -} -var stdTypeMap = keyMap(specifiedScalarTypes.concat(introspectionTypes), function (type) { - return type.name; -}); -/** - * Given a field or enum value node, returns the string value for the - * deprecation reason. - */ - -function getDeprecationReason(node) { - var deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node); - return deprecated === null || deprecated === void 0 ? void 0 : deprecated.reason; -} -/** - * Given a scalar node, returns the string value for the specifiedByUrl. - */ - - -function getSpecifiedByUrl(node) { - var specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node); - return specifiedBy === null || specifiedBy === void 0 ? void 0 : specifiedBy.url; -} -/** - * Given an ast node, returns its string description. - * @deprecated: provided to ease adoption and will be removed in v16. - * - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ - - -export function getDescription(node, options) { - if (node.description) { - return node.description.value; - } - - if ((options === null || options === void 0 ? void 0 : options.commentDescriptions) === true) { - var rawValue = getLeadingCommentBlock(node); - - if (rawValue !== undefined) { - return dedentBlockStringValue('\n' + rawValue); - } - } -} - -function getLeadingCommentBlock(node) { - var loc = node.loc; - - if (!loc) { - return; - } - - var comments = []; - var token = loc.startToken.prev; - - while (token != null && token.kind === TokenKind.COMMENT && token.next && token.prev && token.line + 1 === token.next.line && token.line !== token.prev.line) { - var value = String(token.value); - comments.push(value); - token = token.prev; - } - - return comments.length > 0 ? comments.reverse().join('\n') : undefined; -} diff --git a/node_modules/graphql/utilities/findBreakingChanges.d.ts b/node_modules/graphql/utilities/findBreakingChanges.d.ts deleted file mode 100644 index df35805f..00000000 --- a/node_modules/graphql/utilities/findBreakingChanges.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { GraphQLSchema } from '../type/schema'; - -export const BreakingChangeType: { - TYPE_REMOVED: 'TYPE_REMOVED'; - TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND'; - TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION'; - VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM'; - REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED'; - IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED'; - FIELD_REMOVED: 'FIELD_REMOVED'; - FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND'; - REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED'; - ARG_REMOVED: 'ARG_REMOVED'; - ARG_CHANGED_KIND: 'ARG_CHANGED_KIND'; - DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED'; - DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED'; - REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED'; - DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED'; - DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED'; -}; - -export const DangerousChangeType: { - VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM'; - TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION'; - OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED'; - OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED'; - IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED'; - ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE'; -}; - -export interface BreakingChange { - type: keyof typeof BreakingChangeType; - description: string; -} - -export interface DangerousChange { - type: keyof typeof DangerousChangeType; - description: string; -} - -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of breaking changes covered by the other functions down below. - */ -export function findBreakingChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): Array; - -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of potentially dangerous changes covered by the other functions down below. - */ -export function findDangerousChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): Array; diff --git a/node_modules/graphql/utilities/findBreakingChanges.js b/node_modules/graphql/utilities/findBreakingChanges.js deleted file mode 100644 index f316193e..00000000 --- a/node_modules/graphql/utilities/findBreakingChanges.js +++ /dev/null @@ -1,518 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.findBreakingChanges = findBreakingChanges; -exports.findDangerousChanges = findDangerousChanges; -exports.DangerousChangeType = exports.BreakingChangeType = void 0; - -var _objectValues = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _keyMap = _interopRequireDefault(require("../jsutils/keyMap.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _printer = require("../language/printer.js"); - -var _visitor = require("../language/visitor.js"); - -var _scalars = require("../type/scalars.js"); - -var _definition = require("../type/definition.js"); - -var _astFromValue = require("./astFromValue.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var BreakingChangeType = Object.freeze({ - TYPE_REMOVED: 'TYPE_REMOVED', - TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND', - TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION', - VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM', - REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED', - IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED', - FIELD_REMOVED: 'FIELD_REMOVED', - FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND', - REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED', - ARG_REMOVED: 'ARG_REMOVED', - ARG_CHANGED_KIND: 'ARG_CHANGED_KIND', - DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED', - DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED', - REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED', - DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED', - DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED' -}); -exports.BreakingChangeType = BreakingChangeType; -var DangerousChangeType = Object.freeze({ - VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM', - TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION', - OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED', - OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED', - IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED', - ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE' -}); -exports.DangerousChangeType = DangerousChangeType; - -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of breaking changes covered by the other functions down below. - */ -function findBreakingChanges(oldSchema, newSchema) { - var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) { - return change.type in BreakingChangeType; - }); - return breakingChanges; -} -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of potentially dangerous changes covered by the other functions down below. - */ - - -function findDangerousChanges(oldSchema, newSchema) { - var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) { - return change.type in DangerousChangeType; - }); - return dangerousChanges; -} - -function findSchemaChanges(oldSchema, newSchema) { - return [].concat(findTypeChanges(oldSchema, newSchema), findDirectiveChanges(oldSchema, newSchema)); -} - -function findDirectiveChanges(oldSchema, newSchema) { - var schemaChanges = []; - var directivesDiff = diff(oldSchema.getDirectives(), newSchema.getDirectives()); - - for (var _i2 = 0, _directivesDiff$remov2 = directivesDiff.removed; _i2 < _directivesDiff$remov2.length; _i2++) { - var oldDirective = _directivesDiff$remov2[_i2]; - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REMOVED, - description: "".concat(oldDirective.name, " was removed.") - }); - } - - for (var _i4 = 0, _directivesDiff$persi2 = directivesDiff.persisted; _i4 < _directivesDiff$persi2.length; _i4++) { - var _ref2 = _directivesDiff$persi2[_i4]; - var _oldDirective = _ref2[0]; - var newDirective = _ref2[1]; - var argsDiff = diff(_oldDirective.args, newDirective.args); - - for (var _i6 = 0, _argsDiff$added2 = argsDiff.added; _i6 < _argsDiff$added2.length; _i6++) { - var newArg = _argsDiff$added2[_i6]; - - if ((0, _definition.isRequiredArgument)(newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, - description: "A required arg ".concat(newArg.name, " on directive ").concat(_oldDirective.name, " was added.") - }); - } - } - - for (var _i8 = 0, _argsDiff$removed2 = argsDiff.removed; _i8 < _argsDiff$removed2.length; _i8++) { - var oldArg = _argsDiff$removed2[_i8]; - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, - description: "".concat(oldArg.name, " was removed from ").concat(_oldDirective.name, ".") - }); - } - - if (_oldDirective.isRepeatable && !newDirective.isRepeatable) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, - description: "Repeatable flag was removed from ".concat(_oldDirective.name, ".") - }); - } - - for (var _i10 = 0, _oldDirective$locatio2 = _oldDirective.locations; _i10 < _oldDirective$locatio2.length; _i10++) { - var location = _oldDirective$locatio2[_i10]; - - if (newDirective.locations.indexOf(location) === -1) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, - description: "".concat(location, " was removed from ").concat(_oldDirective.name, ".") - }); - } - } - } - - return schemaChanges; -} - -function findTypeChanges(oldSchema, newSchema) { - var schemaChanges = []; - var typesDiff = diff((0, _objectValues.default)(oldSchema.getTypeMap()), (0, _objectValues.default)(newSchema.getTypeMap())); - - for (var _i12 = 0, _typesDiff$removed2 = typesDiff.removed; _i12 < _typesDiff$removed2.length; _i12++) { - var oldType = _typesDiff$removed2[_i12]; - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED, - description: (0, _scalars.isSpecifiedScalarType)(oldType) ? "Standard scalar ".concat(oldType.name, " was removed because it is not referenced anymore.") : "".concat(oldType.name, " was removed.") - }); - } - - for (var _i14 = 0, _typesDiff$persisted2 = typesDiff.persisted; _i14 < _typesDiff$persisted2.length; _i14++) { - var _ref4 = _typesDiff$persisted2[_i14]; - var _oldType = _ref4[0]; - var newType = _ref4[1]; - - if ((0, _definition.isEnumType)(_oldType) && (0, _definition.isEnumType)(newType)) { - schemaChanges.push.apply(schemaChanges, findEnumTypeChanges(_oldType, newType)); - } else if ((0, _definition.isUnionType)(_oldType) && (0, _definition.isUnionType)(newType)) { - schemaChanges.push.apply(schemaChanges, findUnionTypeChanges(_oldType, newType)); - } else if ((0, _definition.isInputObjectType)(_oldType) && (0, _definition.isInputObjectType)(newType)) { - schemaChanges.push.apply(schemaChanges, findInputObjectTypeChanges(_oldType, newType)); - } else if ((0, _definition.isObjectType)(_oldType) && (0, _definition.isObjectType)(newType)) { - schemaChanges.push.apply(schemaChanges, findFieldChanges(_oldType, newType).concat(findImplementedInterfacesChanges(_oldType, newType))); - } else if ((0, _definition.isInterfaceType)(_oldType) && (0, _definition.isInterfaceType)(newType)) { - schemaChanges.push.apply(schemaChanges, findFieldChanges(_oldType, newType).concat(findImplementedInterfacesChanges(_oldType, newType))); - } else if (_oldType.constructor !== newType.constructor) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_CHANGED_KIND, - description: "".concat(_oldType.name, " changed from ") + "".concat(typeKindName(_oldType), " to ").concat(typeKindName(newType), ".") - }); - } - } - - return schemaChanges; -} - -function findInputObjectTypeChanges(oldType, newType) { - var schemaChanges = []; - var fieldsDiff = diff((0, _objectValues.default)(oldType.getFields()), (0, _objectValues.default)(newType.getFields())); - - for (var _i16 = 0, _fieldsDiff$added2 = fieldsDiff.added; _i16 < _fieldsDiff$added2.length; _i16++) { - var newField = _fieldsDiff$added2[_i16]; - - if ((0, _definition.isRequiredInputField)(newField)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, - description: "A required field ".concat(newField.name, " on input type ").concat(oldType.name, " was added.") - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, - description: "An optional field ".concat(newField.name, " on input type ").concat(oldType.name, " was added.") - }); - } - } - - for (var _i18 = 0, _fieldsDiff$removed2 = fieldsDiff.removed; _i18 < _fieldsDiff$removed2.length; _i18++) { - var oldField = _fieldsDiff$removed2[_i18]; - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: "".concat(oldType.name, ".").concat(oldField.name, " was removed.") - }); - } - - for (var _i20 = 0, _fieldsDiff$persisted2 = fieldsDiff.persisted; _i20 < _fieldsDiff$persisted2.length; _i20++) { - var _ref6 = _fieldsDiff$persisted2[_i20]; - var _oldField = _ref6[0]; - var _newField = _ref6[1]; - var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(_oldField.type, _newField.type); - - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: "".concat(oldType.name, ".").concat(_oldField.name, " changed type from ") + "".concat(String(_oldField.type), " to ").concat(String(_newField.type), ".") - }); - } - } - - return schemaChanges; -} - -function findUnionTypeChanges(oldType, newType) { - var schemaChanges = []; - var possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); - - for (var _i22 = 0, _possibleTypesDiff$ad2 = possibleTypesDiff.added; _i22 < _possibleTypesDiff$ad2.length; _i22++) { - var newPossibleType = _possibleTypesDiff$ad2[_i22]; - schemaChanges.push({ - type: DangerousChangeType.TYPE_ADDED_TO_UNION, - description: "".concat(newPossibleType.name, " was added to union type ").concat(oldType.name, ".") - }); - } - - for (var _i24 = 0, _possibleTypesDiff$re2 = possibleTypesDiff.removed; _i24 < _possibleTypesDiff$re2.length; _i24++) { - var oldPossibleType = _possibleTypesDiff$re2[_i24]; - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, - description: "".concat(oldPossibleType.name, " was removed from union type ").concat(oldType.name, ".") - }); - } - - return schemaChanges; -} - -function findEnumTypeChanges(oldType, newType) { - var schemaChanges = []; - var valuesDiff = diff(oldType.getValues(), newType.getValues()); - - for (var _i26 = 0, _valuesDiff$added2 = valuesDiff.added; _i26 < _valuesDiff$added2.length; _i26++) { - var newValue = _valuesDiff$added2[_i26]; - schemaChanges.push({ - type: DangerousChangeType.VALUE_ADDED_TO_ENUM, - description: "".concat(newValue.name, " was added to enum type ").concat(oldType.name, ".") - }); - } - - for (var _i28 = 0, _valuesDiff$removed2 = valuesDiff.removed; _i28 < _valuesDiff$removed2.length; _i28++) { - var oldValue = _valuesDiff$removed2[_i28]; - schemaChanges.push({ - type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, - description: "".concat(oldValue.name, " was removed from enum type ").concat(oldType.name, ".") - }); - } - - return schemaChanges; -} - -function findImplementedInterfacesChanges(oldType, newType) { - var schemaChanges = []; - var interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); - - for (var _i30 = 0, _interfacesDiff$added2 = interfacesDiff.added; _i30 < _interfacesDiff$added2.length; _i30++) { - var newInterface = _interfacesDiff$added2[_i30]; - schemaChanges.push({ - type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, - description: "".concat(newInterface.name, " added to interfaces implemented by ").concat(oldType.name, ".") - }); - } - - for (var _i32 = 0, _interfacesDiff$remov2 = interfacesDiff.removed; _i32 < _interfacesDiff$remov2.length; _i32++) { - var oldInterface = _interfacesDiff$remov2[_i32]; - schemaChanges.push({ - type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, - description: "".concat(oldType.name, " no longer implements interface ").concat(oldInterface.name, ".") - }); - } - - return schemaChanges; -} - -function findFieldChanges(oldType, newType) { - var schemaChanges = []; - var fieldsDiff = diff((0, _objectValues.default)(oldType.getFields()), (0, _objectValues.default)(newType.getFields())); - - for (var _i34 = 0, _fieldsDiff$removed4 = fieldsDiff.removed; _i34 < _fieldsDiff$removed4.length; _i34++) { - var oldField = _fieldsDiff$removed4[_i34]; - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: "".concat(oldType.name, ".").concat(oldField.name, " was removed.") - }); - } - - for (var _i36 = 0, _fieldsDiff$persisted4 = fieldsDiff.persisted; _i36 < _fieldsDiff$persisted4.length; _i36++) { - var _ref8 = _fieldsDiff$persisted4[_i36]; - var _oldField2 = _ref8[0]; - var newField = _ref8[1]; - schemaChanges.push.apply(schemaChanges, findArgChanges(oldType, _oldField2, newField)); - var isSafe = isChangeSafeForObjectOrInterfaceField(_oldField2.type, newField.type); - - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: "".concat(oldType.name, ".").concat(_oldField2.name, " changed type from ") + "".concat(String(_oldField2.type), " to ").concat(String(newField.type), ".") - }); - } - } - - return schemaChanges; -} - -function findArgChanges(oldType, oldField, newField) { - var schemaChanges = []; - var argsDiff = diff(oldField.args, newField.args); - - for (var _i38 = 0, _argsDiff$removed4 = argsDiff.removed; _i38 < _argsDiff$removed4.length; _i38++) { - var oldArg = _argsDiff$removed4[_i38]; - schemaChanges.push({ - type: BreakingChangeType.ARG_REMOVED, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(oldArg.name, " was removed.") - }); - } - - for (var _i40 = 0, _argsDiff$persisted2 = argsDiff.persisted; _i40 < _argsDiff$persisted2.length; _i40++) { - var _ref10 = _argsDiff$persisted2[_i40]; - var _oldArg = _ref10[0]; - var newArg = _ref10[1]; - var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(_oldArg.type, newArg.type); - - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.ARG_CHANGED_KIND, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " has changed type from ") + "".concat(String(_oldArg.type), " to ").concat(String(newArg.type), ".") - }); - } else if (_oldArg.defaultValue !== undefined) { - if (newArg.defaultValue === undefined) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " defaultValue was removed.") - }); - } else { - // Since we looking only for client's observable changes we should - // compare default values in the same representation as they are - // represented inside introspection. - var oldValueStr = stringifyValue(_oldArg.defaultValue, _oldArg.type); - var newValueStr = stringifyValue(newArg.defaultValue, newArg.type); - - if (oldValueStr !== newValueStr) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " has changed defaultValue from ").concat(oldValueStr, " to ").concat(newValueStr, ".") - }); - } - } - } - } - - for (var _i42 = 0, _argsDiff$added4 = argsDiff.added; _i42 < _argsDiff$added4.length; _i42++) { - var _newArg = _argsDiff$added4[_i42]; - - if ((0, _definition.isRequiredArgument)(_newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_ARG_ADDED, - description: "A required arg ".concat(_newArg.name, " on ").concat(oldType.name, ".").concat(oldField.name, " was added.") - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_ARG_ADDED, - description: "An optional arg ".concat(_newArg.name, " on ").concat(oldType.name, ".").concat(oldField.name, " was added.") - }); - } - } - - return schemaChanges; -} - -function isChangeSafeForObjectOrInterfaceField(oldType, newType) { - if ((0, _definition.isListType)(oldType)) { - return (// if they're both lists, make sure the underlying types are compatible - (0, _definition.isListType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) || // moving from nullable to non-null of the same underlying type is safe - (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) - ); - } - - if ((0, _definition.isNonNullType)(oldType)) { - // if they're both non-null, make sure the underlying types are compatible - return (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType); - } - - return (// if they're both named types, see if their names are equivalent - (0, _definition.isNamedType)(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe - (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) - ); -} - -function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { - if ((0, _definition.isListType)(oldType)) { - // if they're both lists, make sure the underlying types are compatible - return (0, _definition.isListType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType); - } - - if ((0, _definition.isNonNullType)(oldType)) { - return (// if they're both non-null, make sure the underlying types are - // compatible - (0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) || // moving from non-null to nullable of the same underlying type is safe - !(0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType) - ); - } // if they're both named types, see if their names are equivalent - - - return (0, _definition.isNamedType)(newType) && oldType.name === newType.name; -} - -function typeKindName(type) { - if ((0, _definition.isScalarType)(type)) { - return 'a Scalar type'; - } - - if ((0, _definition.isObjectType)(type)) { - return 'an Object type'; - } - - if ((0, _definition.isInterfaceType)(type)) { - return 'an Interface type'; - } - - if ((0, _definition.isUnionType)(type)) { - return 'a Union type'; - } - - if ((0, _definition.isEnumType)(type)) { - return 'an Enum type'; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isInputObjectType)(type)) { - return 'an Input type'; - } // istanbul ignore next (Not reachable. All possible named types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); -} - -function stringifyValue(value, type) { - var ast = (0, _astFromValue.astFromValue)(value, type); - ast != null || (0, _invariant.default)(0); - var sortedAST = (0, _visitor.visit)(ast, { - ObjectValue: function ObjectValue(objectNode) { - var fields = [].concat(objectNode.fields).sort(function (fieldA, fieldB) { - return fieldA.name.value.localeCompare(fieldB.name.value); - }); - return _objectSpread(_objectSpread({}, objectNode), {}, { - fields: fields - }); - } - }); - return (0, _printer.print)(sortedAST); -} - -function diff(oldArray, newArray) { - var added = []; - var removed = []; - var persisted = []; - var oldMap = (0, _keyMap.default)(oldArray, function (_ref11) { - var name = _ref11.name; - return name; - }); - var newMap = (0, _keyMap.default)(newArray, function (_ref12) { - var name = _ref12.name; - return name; - }); - - for (var _i44 = 0; _i44 < oldArray.length; _i44++) { - var oldItem = oldArray[_i44]; - var newItem = newMap[oldItem.name]; - - if (newItem === undefined) { - removed.push(oldItem); - } else { - persisted.push([oldItem, newItem]); - } - } - - for (var _i46 = 0; _i46 < newArray.length; _i46++) { - var _newItem = newArray[_i46]; - - if (oldMap[_newItem.name] === undefined) { - added.push(_newItem); - } - } - - return { - added: added, - persisted: persisted, - removed: removed - }; -} diff --git a/node_modules/graphql/utilities/findBreakingChanges.js.flow b/node_modules/graphql/utilities/findBreakingChanges.js.flow deleted file mode 100644 index 2742da55..00000000 --- a/node_modules/graphql/utilities/findBreakingChanges.js.flow +++ /dev/null @@ -1,586 +0,0 @@ -// @flow strict -import objectValues from '../polyfills/objectValues'; - -import keyMap from '../jsutils/keyMap'; -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; - -import { print } from '../language/printer'; -import { visit } from '../language/visitor'; - -import type { GraphQLSchema } from '../type/schema'; -import type { - GraphQLField, - GraphQLType, - GraphQLInputType, - GraphQLNamedType, - GraphQLEnumType, - GraphQLUnionType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLInputObjectType, -} from '../type/definition'; -import { isSpecifiedScalarType } from '../type/scalars'; -import { - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, - isNonNullType, - isListType, - isNamedType, - isRequiredArgument, - isRequiredInputField, -} from '../type/definition'; - -import { astFromValue } from './astFromValue'; - -export const BreakingChangeType = Object.freeze({ - TYPE_REMOVED: 'TYPE_REMOVED', - TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND', - TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION', - VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM', - REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED', - IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED', - FIELD_REMOVED: 'FIELD_REMOVED', - FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND', - REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED', - ARG_REMOVED: 'ARG_REMOVED', - ARG_CHANGED_KIND: 'ARG_CHANGED_KIND', - DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED', - DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED', - REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED', - DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED', - DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED', -}); - -export const DangerousChangeType = Object.freeze({ - VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM', - TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION', - OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED', - OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED', - IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED', - ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE', -}); - -export type BreakingChange = {| - type: $Keys, - description: string, -|}; - -export type DangerousChange = {| - type: $Keys, - description: string, -|}; - -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of breaking changes covered by the other functions down below. - */ -export function findBreakingChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): Array { - const breakingChanges = findSchemaChanges(oldSchema, newSchema).filter( - (change) => change.type in BreakingChangeType, - ); - return ((breakingChanges: any): Array); -} - -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of potentially dangerous changes covered by the other functions down below. - */ -export function findDangerousChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): Array { - const dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter( - (change) => change.type in DangerousChangeType, - ); - return ((dangerousChanges: any): Array); -} - -function findSchemaChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): Array { - return [ - ...findTypeChanges(oldSchema, newSchema), - ...findDirectiveChanges(oldSchema, newSchema), - ]; -} - -function findDirectiveChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): Array { - const schemaChanges = []; - - const directivesDiff = diff( - oldSchema.getDirectives(), - newSchema.getDirectives(), - ); - - for (const oldDirective of directivesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REMOVED, - description: `${oldDirective.name} was removed.`, - }); - } - - for (const [oldDirective, newDirective] of directivesDiff.persisted) { - const argsDiff = diff(oldDirective.args, newDirective.args); - - for (const newArg of argsDiff.added) { - if (isRequiredArgument(newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, - description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`, - }); - } - } - - for (const oldArg of argsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, - description: `${oldArg.name} was removed from ${oldDirective.name}.`, - }); - } - - if (oldDirective.isRepeatable && !newDirective.isRepeatable) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, - description: `Repeatable flag was removed from ${oldDirective.name}.`, - }); - } - - for (const location of oldDirective.locations) { - if (newDirective.locations.indexOf(location) === -1) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, - description: `${location} was removed from ${oldDirective.name}.`, - }); - } - } - } - - return schemaChanges; -} - -function findTypeChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): Array { - const schemaChanges = []; - - const typesDiff = diff( - objectValues(oldSchema.getTypeMap()), - objectValues(newSchema.getTypeMap()), - ); - - for (const oldType of typesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED, - description: isSpecifiedScalarType(oldType) - ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.` - : `${oldType.name} was removed.`, - }); - } - - for (const [oldType, newType] of typesDiff.persisted) { - if (isEnumType(oldType) && isEnumType(newType)) { - schemaChanges.push(...findEnumTypeChanges(oldType, newType)); - } else if (isUnionType(oldType) && isUnionType(newType)) { - schemaChanges.push(...findUnionTypeChanges(oldType, newType)); - } else if (isInputObjectType(oldType) && isInputObjectType(newType)) { - schemaChanges.push(...findInputObjectTypeChanges(oldType, newType)); - } else if (isObjectType(oldType) && isObjectType(newType)) { - schemaChanges.push( - ...findFieldChanges(oldType, newType), - ...findImplementedInterfacesChanges(oldType, newType), - ); - } else if (isInterfaceType(oldType) && isInterfaceType(newType)) { - schemaChanges.push( - ...findFieldChanges(oldType, newType), - ...findImplementedInterfacesChanges(oldType, newType), - ); - } else if (oldType.constructor !== newType.constructor) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_CHANGED_KIND, - description: - `${oldType.name} changed from ` + - `${typeKindName(oldType)} to ${typeKindName(newType)}.`, - }); - } - } - - return schemaChanges; -} - -function findInputObjectTypeChanges( - oldType: GraphQLInputObjectType, - newType: GraphQLInputObjectType, -): Array { - const schemaChanges = []; - const fieldsDiff = diff( - objectValues(oldType.getFields()), - objectValues(newType.getFields()), - ); - - for (const newField of fieldsDiff.added) { - if (isRequiredInputField(newField)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, - description: `A required field ${newField.name} on input type ${oldType.name} was added.`, - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, - description: `An optional field ${newField.name} on input type ${oldType.name} was added.`, - }); - } - } - - for (const oldField of fieldsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: `${oldType.name}.${oldField.name} was removed.`, - }); - } - - for (const [oldField, newField] of fieldsDiff.persisted) { - const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( - oldField.type, - newField.type, - ); - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: - `${oldType.name}.${oldField.name} changed type from ` + - `${String(oldField.type)} to ${String(newField.type)}.`, - }); - } - } - - return schemaChanges; -} - -function findUnionTypeChanges( - oldType: GraphQLUnionType, - newType: GraphQLUnionType, -): Array { - const schemaChanges = []; - const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); - - for (const newPossibleType of possibleTypesDiff.added) { - schemaChanges.push({ - type: DangerousChangeType.TYPE_ADDED_TO_UNION, - description: `${newPossibleType.name} was added to union type ${oldType.name}.`, - }); - } - - for (const oldPossibleType of possibleTypesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, - description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`, - }); - } - - return schemaChanges; -} - -function findEnumTypeChanges( - oldType: GraphQLEnumType, - newType: GraphQLEnumType, -): Array { - const schemaChanges = []; - const valuesDiff = diff(oldType.getValues(), newType.getValues()); - - for (const newValue of valuesDiff.added) { - schemaChanges.push({ - type: DangerousChangeType.VALUE_ADDED_TO_ENUM, - description: `${newValue.name} was added to enum type ${oldType.name}.`, - }); - } - - for (const oldValue of valuesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, - description: `${oldValue.name} was removed from enum type ${oldType.name}.`, - }); - } - - return schemaChanges; -} - -function findImplementedInterfacesChanges( - oldType: GraphQLObjectType | GraphQLInterfaceType, - newType: GraphQLObjectType | GraphQLInterfaceType, -): Array { - const schemaChanges = []; - const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); - - for (const newInterface of interfacesDiff.added) { - schemaChanges.push({ - type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, - description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`, - }); - } - - for (const oldInterface of interfacesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, - description: `${oldType.name} no longer implements interface ${oldInterface.name}.`, - }); - } - - return schemaChanges; -} - -function findFieldChanges( - oldType: GraphQLObjectType | GraphQLInterfaceType, - newType: GraphQLObjectType | GraphQLInterfaceType, -): Array { - const schemaChanges = []; - const fieldsDiff = diff( - objectValues(oldType.getFields()), - objectValues(newType.getFields()), - ); - - for (const oldField of fieldsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: `${oldType.name}.${oldField.name} was removed.`, - }); - } - - for (const [oldField, newField] of fieldsDiff.persisted) { - schemaChanges.push(...findArgChanges(oldType, oldField, newField)); - - const isSafe = isChangeSafeForObjectOrInterfaceField( - oldField.type, - newField.type, - ); - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: - `${oldType.name}.${oldField.name} changed type from ` + - `${String(oldField.type)} to ${String(newField.type)}.`, - }); - } - } - - return schemaChanges; -} - -function findArgChanges( - oldType: GraphQLObjectType | GraphQLInterfaceType, - oldField: GraphQLField, - newField: GraphQLField, -): Array { - const schemaChanges = []; - const argsDiff = diff(oldField.args, newField.args); - - for (const oldArg of argsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.ARG_REMOVED, - description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.`, - }); - } - - for (const [oldArg, newArg] of argsDiff.persisted) { - const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( - oldArg.type, - newArg.type, - ); - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.ARG_CHANGED_KIND, - description: - `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` + - `${String(oldArg.type)} to ${String(newArg.type)}.`, - }); - } else if (oldArg.defaultValue !== undefined) { - if (newArg.defaultValue === undefined) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`, - }); - } else { - // Since we looking only for client's observable changes we should - // compare default values in the same representation as they are - // represented inside introspection. - const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type); - const newValueStr = stringifyValue(newArg.defaultValue, newArg.type); - - if (oldValueStr !== newValueStr) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`, - }); - } - } - } - } - - for (const newArg of argsDiff.added) { - if (isRequiredArgument(newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_ARG_ADDED, - description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_ARG_ADDED, - description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, - }); - } - } - - return schemaChanges; -} - -function isChangeSafeForObjectOrInterfaceField( - oldType: GraphQLType, - newType: GraphQLType, -): boolean { - if (isListType(oldType)) { - return ( - // if they're both lists, make sure the underlying types are compatible - (isListType(newType) && - isChangeSafeForObjectOrInterfaceField( - oldType.ofType, - newType.ofType, - )) || - // moving from nullable to non-null of the same underlying type is safe - (isNonNullType(newType) && - isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) - ); - } - - if (isNonNullType(oldType)) { - // if they're both non-null, make sure the underlying types are compatible - return ( - isNonNullType(newType) && - isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) - ); - } - - return ( - // if they're both named types, see if their names are equivalent - (isNamedType(newType) && oldType.name === newType.name) || - // moving from nullable to non-null of the same underlying type is safe - (isNonNullType(newType) && - isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) - ); -} - -function isChangeSafeForInputObjectFieldOrFieldArg( - oldType: GraphQLType, - newType: GraphQLType, -): boolean { - if (isListType(oldType)) { - // if they're both lists, make sure the underlying types are compatible - return ( - isListType(newType) && - isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) - ); - } - - if (isNonNullType(oldType)) { - return ( - // if they're both non-null, make sure the underlying types are - // compatible - (isNonNullType(newType) && - isChangeSafeForInputObjectFieldOrFieldArg( - oldType.ofType, - newType.ofType, - )) || - // moving from non-null to nullable of the same underlying type is safe - (!isNonNullType(newType) && - isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)) - ); - } - - // if they're both named types, see if their names are equivalent - return isNamedType(newType) && oldType.name === newType.name; -} - -function typeKindName(type: GraphQLNamedType): string { - if (isScalarType(type)) { - return 'a Scalar type'; - } - if (isObjectType(type)) { - return 'an Object type'; - } - if (isInterfaceType(type)) { - return 'an Interface type'; - } - if (isUnionType(type)) { - return 'a Union type'; - } - if (isEnumType(type)) { - return 'an Enum type'; - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isInputObjectType(type)) { - return 'an Input type'; - } - - // istanbul ignore next (Not reachable. All possible named types have been considered) - invariant(false, 'Unexpected type: ' + inspect((type: empty))); -} - -function stringifyValue(value: mixed, type: GraphQLInputType): string { - const ast = astFromValue(value, type); - invariant(ast != null); - - const sortedAST = visit(ast, { - ObjectValue(objectNode) { - const fields = [...objectNode.fields].sort((fieldA, fieldB) => - fieldA.name.value.localeCompare(fieldB.name.value), - ); - return { ...objectNode, fields }; - }, - }); - - return print(sortedAST); -} - -function diff( - oldArray: $ReadOnlyArray, - newArray: $ReadOnlyArray, -): {| - added: Array, - removed: Array, - persisted: Array<[T, T]>, -|} { - const added = []; - const removed = []; - const persisted = []; - - const oldMap = keyMap(oldArray, ({ name }) => name); - const newMap = keyMap(newArray, ({ name }) => name); - - for (const oldItem of oldArray) { - const newItem = newMap[oldItem.name]; - if (newItem === undefined) { - removed.push(oldItem); - } else { - persisted.push([oldItem, newItem]); - } - } - - for (const newItem of newArray) { - if (oldMap[newItem.name] === undefined) { - added.push(newItem); - } - } - - return { added, persisted, removed }; -} diff --git a/node_modules/graphql/utilities/findBreakingChanges.mjs b/node_modules/graphql/utilities/findBreakingChanges.mjs deleted file mode 100644 index 0b48db07..00000000 --- a/node_modules/graphql/utilities/findBreakingChanges.mjs +++ /dev/null @@ -1,495 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import objectValues from "../polyfills/objectValues.mjs"; -import keyMap from "../jsutils/keyMap.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import { print } from "../language/printer.mjs"; -import { visit } from "../language/visitor.mjs"; -import { isSpecifiedScalarType } from "../type/scalars.mjs"; -import { isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isNonNullType, isListType, isNamedType, isRequiredArgument, isRequiredInputField } from "../type/definition.mjs"; -import { astFromValue } from "./astFromValue.mjs"; -export var BreakingChangeType = Object.freeze({ - TYPE_REMOVED: 'TYPE_REMOVED', - TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND', - TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION', - VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM', - REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED', - IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED', - FIELD_REMOVED: 'FIELD_REMOVED', - FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND', - REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED', - ARG_REMOVED: 'ARG_REMOVED', - ARG_CHANGED_KIND: 'ARG_CHANGED_KIND', - DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED', - DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED', - REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED', - DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED', - DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED' -}); -export var DangerousChangeType = Object.freeze({ - VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM', - TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION', - OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED', - OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED', - IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED', - ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE' -}); - -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of breaking changes covered by the other functions down below. - */ -export function findBreakingChanges(oldSchema, newSchema) { - var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) { - return change.type in BreakingChangeType; - }); - return breakingChanges; -} -/** - * Given two schemas, returns an Array containing descriptions of all the types - * of potentially dangerous changes covered by the other functions down below. - */ - -export function findDangerousChanges(oldSchema, newSchema) { - var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) { - return change.type in DangerousChangeType; - }); - return dangerousChanges; -} - -function findSchemaChanges(oldSchema, newSchema) { - return [].concat(findTypeChanges(oldSchema, newSchema), findDirectiveChanges(oldSchema, newSchema)); -} - -function findDirectiveChanges(oldSchema, newSchema) { - var schemaChanges = []; - var directivesDiff = diff(oldSchema.getDirectives(), newSchema.getDirectives()); - - for (var _i2 = 0, _directivesDiff$remov2 = directivesDiff.removed; _i2 < _directivesDiff$remov2.length; _i2++) { - var oldDirective = _directivesDiff$remov2[_i2]; - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REMOVED, - description: "".concat(oldDirective.name, " was removed.") - }); - } - - for (var _i4 = 0, _directivesDiff$persi2 = directivesDiff.persisted; _i4 < _directivesDiff$persi2.length; _i4++) { - var _ref2 = _directivesDiff$persi2[_i4]; - var _oldDirective = _ref2[0]; - var newDirective = _ref2[1]; - var argsDiff = diff(_oldDirective.args, newDirective.args); - - for (var _i6 = 0, _argsDiff$added2 = argsDiff.added; _i6 < _argsDiff$added2.length; _i6++) { - var newArg = _argsDiff$added2[_i6]; - - if (isRequiredArgument(newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, - description: "A required arg ".concat(newArg.name, " on directive ").concat(_oldDirective.name, " was added.") - }); - } - } - - for (var _i8 = 0, _argsDiff$removed2 = argsDiff.removed; _i8 < _argsDiff$removed2.length; _i8++) { - var oldArg = _argsDiff$removed2[_i8]; - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, - description: "".concat(oldArg.name, " was removed from ").concat(_oldDirective.name, ".") - }); - } - - if (_oldDirective.isRepeatable && !newDirective.isRepeatable) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, - description: "Repeatable flag was removed from ".concat(_oldDirective.name, ".") - }); - } - - for (var _i10 = 0, _oldDirective$locatio2 = _oldDirective.locations; _i10 < _oldDirective$locatio2.length; _i10++) { - var location = _oldDirective$locatio2[_i10]; - - if (newDirective.locations.indexOf(location) === -1) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, - description: "".concat(location, " was removed from ").concat(_oldDirective.name, ".") - }); - } - } - } - - return schemaChanges; -} - -function findTypeChanges(oldSchema, newSchema) { - var schemaChanges = []; - var typesDiff = diff(objectValues(oldSchema.getTypeMap()), objectValues(newSchema.getTypeMap())); - - for (var _i12 = 0, _typesDiff$removed2 = typesDiff.removed; _i12 < _typesDiff$removed2.length; _i12++) { - var oldType = _typesDiff$removed2[_i12]; - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED, - description: isSpecifiedScalarType(oldType) ? "Standard scalar ".concat(oldType.name, " was removed because it is not referenced anymore.") : "".concat(oldType.name, " was removed.") - }); - } - - for (var _i14 = 0, _typesDiff$persisted2 = typesDiff.persisted; _i14 < _typesDiff$persisted2.length; _i14++) { - var _ref4 = _typesDiff$persisted2[_i14]; - var _oldType = _ref4[0]; - var newType = _ref4[1]; - - if (isEnumType(_oldType) && isEnumType(newType)) { - schemaChanges.push.apply(schemaChanges, findEnumTypeChanges(_oldType, newType)); - } else if (isUnionType(_oldType) && isUnionType(newType)) { - schemaChanges.push.apply(schemaChanges, findUnionTypeChanges(_oldType, newType)); - } else if (isInputObjectType(_oldType) && isInputObjectType(newType)) { - schemaChanges.push.apply(schemaChanges, findInputObjectTypeChanges(_oldType, newType)); - } else if (isObjectType(_oldType) && isObjectType(newType)) { - schemaChanges.push.apply(schemaChanges, findFieldChanges(_oldType, newType).concat(findImplementedInterfacesChanges(_oldType, newType))); - } else if (isInterfaceType(_oldType) && isInterfaceType(newType)) { - schemaChanges.push.apply(schemaChanges, findFieldChanges(_oldType, newType).concat(findImplementedInterfacesChanges(_oldType, newType))); - } else if (_oldType.constructor !== newType.constructor) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_CHANGED_KIND, - description: "".concat(_oldType.name, " changed from ") + "".concat(typeKindName(_oldType), " to ").concat(typeKindName(newType), ".") - }); - } - } - - return schemaChanges; -} - -function findInputObjectTypeChanges(oldType, newType) { - var schemaChanges = []; - var fieldsDiff = diff(objectValues(oldType.getFields()), objectValues(newType.getFields())); - - for (var _i16 = 0, _fieldsDiff$added2 = fieldsDiff.added; _i16 < _fieldsDiff$added2.length; _i16++) { - var newField = _fieldsDiff$added2[_i16]; - - if (isRequiredInputField(newField)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, - description: "A required field ".concat(newField.name, " on input type ").concat(oldType.name, " was added.") - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, - description: "An optional field ".concat(newField.name, " on input type ").concat(oldType.name, " was added.") - }); - } - } - - for (var _i18 = 0, _fieldsDiff$removed2 = fieldsDiff.removed; _i18 < _fieldsDiff$removed2.length; _i18++) { - var oldField = _fieldsDiff$removed2[_i18]; - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: "".concat(oldType.name, ".").concat(oldField.name, " was removed.") - }); - } - - for (var _i20 = 0, _fieldsDiff$persisted2 = fieldsDiff.persisted; _i20 < _fieldsDiff$persisted2.length; _i20++) { - var _ref6 = _fieldsDiff$persisted2[_i20]; - var _oldField = _ref6[0]; - var _newField = _ref6[1]; - var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(_oldField.type, _newField.type); - - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: "".concat(oldType.name, ".").concat(_oldField.name, " changed type from ") + "".concat(String(_oldField.type), " to ").concat(String(_newField.type), ".") - }); - } - } - - return schemaChanges; -} - -function findUnionTypeChanges(oldType, newType) { - var schemaChanges = []; - var possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); - - for (var _i22 = 0, _possibleTypesDiff$ad2 = possibleTypesDiff.added; _i22 < _possibleTypesDiff$ad2.length; _i22++) { - var newPossibleType = _possibleTypesDiff$ad2[_i22]; - schemaChanges.push({ - type: DangerousChangeType.TYPE_ADDED_TO_UNION, - description: "".concat(newPossibleType.name, " was added to union type ").concat(oldType.name, ".") - }); - } - - for (var _i24 = 0, _possibleTypesDiff$re2 = possibleTypesDiff.removed; _i24 < _possibleTypesDiff$re2.length; _i24++) { - var oldPossibleType = _possibleTypesDiff$re2[_i24]; - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, - description: "".concat(oldPossibleType.name, " was removed from union type ").concat(oldType.name, ".") - }); - } - - return schemaChanges; -} - -function findEnumTypeChanges(oldType, newType) { - var schemaChanges = []; - var valuesDiff = diff(oldType.getValues(), newType.getValues()); - - for (var _i26 = 0, _valuesDiff$added2 = valuesDiff.added; _i26 < _valuesDiff$added2.length; _i26++) { - var newValue = _valuesDiff$added2[_i26]; - schemaChanges.push({ - type: DangerousChangeType.VALUE_ADDED_TO_ENUM, - description: "".concat(newValue.name, " was added to enum type ").concat(oldType.name, ".") - }); - } - - for (var _i28 = 0, _valuesDiff$removed2 = valuesDiff.removed; _i28 < _valuesDiff$removed2.length; _i28++) { - var oldValue = _valuesDiff$removed2[_i28]; - schemaChanges.push({ - type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, - description: "".concat(oldValue.name, " was removed from enum type ").concat(oldType.name, ".") - }); - } - - return schemaChanges; -} - -function findImplementedInterfacesChanges(oldType, newType) { - var schemaChanges = []; - var interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); - - for (var _i30 = 0, _interfacesDiff$added2 = interfacesDiff.added; _i30 < _interfacesDiff$added2.length; _i30++) { - var newInterface = _interfacesDiff$added2[_i30]; - schemaChanges.push({ - type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, - description: "".concat(newInterface.name, " added to interfaces implemented by ").concat(oldType.name, ".") - }); - } - - for (var _i32 = 0, _interfacesDiff$remov2 = interfacesDiff.removed; _i32 < _interfacesDiff$remov2.length; _i32++) { - var oldInterface = _interfacesDiff$remov2[_i32]; - schemaChanges.push({ - type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, - description: "".concat(oldType.name, " no longer implements interface ").concat(oldInterface.name, ".") - }); - } - - return schemaChanges; -} - -function findFieldChanges(oldType, newType) { - var schemaChanges = []; - var fieldsDiff = diff(objectValues(oldType.getFields()), objectValues(newType.getFields())); - - for (var _i34 = 0, _fieldsDiff$removed4 = fieldsDiff.removed; _i34 < _fieldsDiff$removed4.length; _i34++) { - var oldField = _fieldsDiff$removed4[_i34]; - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: "".concat(oldType.name, ".").concat(oldField.name, " was removed.") - }); - } - - for (var _i36 = 0, _fieldsDiff$persisted4 = fieldsDiff.persisted; _i36 < _fieldsDiff$persisted4.length; _i36++) { - var _ref8 = _fieldsDiff$persisted4[_i36]; - var _oldField2 = _ref8[0]; - var newField = _ref8[1]; - schemaChanges.push.apply(schemaChanges, findArgChanges(oldType, _oldField2, newField)); - var isSafe = isChangeSafeForObjectOrInterfaceField(_oldField2.type, newField.type); - - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: "".concat(oldType.name, ".").concat(_oldField2.name, " changed type from ") + "".concat(String(_oldField2.type), " to ").concat(String(newField.type), ".") - }); - } - } - - return schemaChanges; -} - -function findArgChanges(oldType, oldField, newField) { - var schemaChanges = []; - var argsDiff = diff(oldField.args, newField.args); - - for (var _i38 = 0, _argsDiff$removed4 = argsDiff.removed; _i38 < _argsDiff$removed4.length; _i38++) { - var oldArg = _argsDiff$removed4[_i38]; - schemaChanges.push({ - type: BreakingChangeType.ARG_REMOVED, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(oldArg.name, " was removed.") - }); - } - - for (var _i40 = 0, _argsDiff$persisted2 = argsDiff.persisted; _i40 < _argsDiff$persisted2.length; _i40++) { - var _ref10 = _argsDiff$persisted2[_i40]; - var _oldArg = _ref10[0]; - var newArg = _ref10[1]; - var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(_oldArg.type, newArg.type); - - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.ARG_CHANGED_KIND, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " has changed type from ") + "".concat(String(_oldArg.type), " to ").concat(String(newArg.type), ".") - }); - } else if (_oldArg.defaultValue !== undefined) { - if (newArg.defaultValue === undefined) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " defaultValue was removed.") - }); - } else { - // Since we looking only for client's observable changes we should - // compare default values in the same representation as they are - // represented inside introspection. - var oldValueStr = stringifyValue(_oldArg.defaultValue, _oldArg.type); - var newValueStr = stringifyValue(newArg.defaultValue, newArg.type); - - if (oldValueStr !== newValueStr) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " has changed defaultValue from ").concat(oldValueStr, " to ").concat(newValueStr, ".") - }); - } - } - } - } - - for (var _i42 = 0, _argsDiff$added4 = argsDiff.added; _i42 < _argsDiff$added4.length; _i42++) { - var _newArg = _argsDiff$added4[_i42]; - - if (isRequiredArgument(_newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_ARG_ADDED, - description: "A required arg ".concat(_newArg.name, " on ").concat(oldType.name, ".").concat(oldField.name, " was added.") - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_ARG_ADDED, - description: "An optional arg ".concat(_newArg.name, " on ").concat(oldType.name, ".").concat(oldField.name, " was added.") - }); - } - } - - return schemaChanges; -} - -function isChangeSafeForObjectOrInterfaceField(oldType, newType) { - if (isListType(oldType)) { - return (// if they're both lists, make sure the underlying types are compatible - isListType(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) || // moving from nullable to non-null of the same underlying type is safe - isNonNullType(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) - ); - } - - if (isNonNullType(oldType)) { - // if they're both non-null, make sure the underlying types are compatible - return isNonNullType(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType); - } - - return (// if they're both named types, see if their names are equivalent - isNamedType(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe - isNonNullType(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) - ); -} - -function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { - if (isListType(oldType)) { - // if they're both lists, make sure the underlying types are compatible - return isListType(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType); - } - - if (isNonNullType(oldType)) { - return (// if they're both non-null, make sure the underlying types are - // compatible - isNonNullType(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) || // moving from non-null to nullable of the same underlying type is safe - !isNonNullType(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType) - ); - } // if they're both named types, see if their names are equivalent - - - return isNamedType(newType) && oldType.name === newType.name; -} - -function typeKindName(type) { - if (isScalarType(type)) { - return 'a Scalar type'; - } - - if (isObjectType(type)) { - return 'an Object type'; - } - - if (isInterfaceType(type)) { - return 'an Interface type'; - } - - if (isUnionType(type)) { - return 'a Union type'; - } - - if (isEnumType(type)) { - return 'an Enum type'; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isInputObjectType(type)) { - return 'an Input type'; - } // istanbul ignore next (Not reachable. All possible named types have been considered) - - - false || invariant(0, 'Unexpected type: ' + inspect(type)); -} - -function stringifyValue(value, type) { - var ast = astFromValue(value, type); - ast != null || invariant(0); - var sortedAST = visit(ast, { - ObjectValue: function ObjectValue(objectNode) { - var fields = [].concat(objectNode.fields).sort(function (fieldA, fieldB) { - return fieldA.name.value.localeCompare(fieldB.name.value); - }); - return _objectSpread(_objectSpread({}, objectNode), {}, { - fields: fields - }); - } - }); - return print(sortedAST); -} - -function diff(oldArray, newArray) { - var added = []; - var removed = []; - var persisted = []; - var oldMap = keyMap(oldArray, function (_ref11) { - var name = _ref11.name; - return name; - }); - var newMap = keyMap(newArray, function (_ref12) { - var name = _ref12.name; - return name; - }); - - for (var _i44 = 0; _i44 < oldArray.length; _i44++) { - var oldItem = oldArray[_i44]; - var newItem = newMap[oldItem.name]; - - if (newItem === undefined) { - removed.push(oldItem); - } else { - persisted.push([oldItem, newItem]); - } - } - - for (var _i46 = 0; _i46 < newArray.length; _i46++) { - var _newItem = newArray[_i46]; - - if (oldMap[_newItem.name] === undefined) { - added.push(_newItem); - } - } - - return { - added: added, - persisted: persisted, - removed: removed - }; -} diff --git a/node_modules/graphql/utilities/findDeprecatedUsages.d.ts b/node_modules/graphql/utilities/findDeprecatedUsages.d.ts deleted file mode 100644 index bbdf9439..00000000 --- a/node_modules/graphql/utilities/findDeprecatedUsages.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { GraphQLError } from '../error/GraphQLError'; -import { DocumentNode } from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; - -/** - * A validation rule which reports deprecated usages. - * - * Returns a list of GraphQLError instances describing each deprecated use. - * - * @deprecated Please use `validate` with `NoDeprecatedCustomRule` instead: - * - * ``` - * import { validate, NoDeprecatedCustomRule } from 'graphql' - * - * const errors = validate(schema, document, [NoDeprecatedCustomRule]) - * ``` - */ -export function findDeprecatedUsages( - schema: GraphQLSchema, - ast: DocumentNode, -): ReadonlyArray; diff --git a/node_modules/graphql/utilities/findDeprecatedUsages.js b/node_modules/graphql/utilities/findDeprecatedUsages.js deleted file mode 100644 index e27b03e0..00000000 --- a/node_modules/graphql/utilities/findDeprecatedUsages.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.findDeprecatedUsages = findDeprecatedUsages; - -var _validate = require("../validation/validate.js"); - -var _NoDeprecatedCustomRule = require("../validation/rules/custom/NoDeprecatedCustomRule.js"); - -/** - * A validation rule which reports deprecated usages. - * - * Returns a list of GraphQLError instances describing each deprecated use. - * - * @deprecated Please use `validate` with `NoDeprecatedCustomRule` instead: - * - * ``` - * import { validate, NoDeprecatedCustomRule } from 'graphql' - * - * const errors = validate(schema, document, [NoDeprecatedCustomRule]) - * ``` - */ -function findDeprecatedUsages(schema, ast) { - return (0, _validate.validate)(schema, ast, [_NoDeprecatedCustomRule.NoDeprecatedCustomRule]); -} diff --git a/node_modules/graphql/utilities/findDeprecatedUsages.js.flow b/node_modules/graphql/utilities/findDeprecatedUsages.js.flow deleted file mode 100644 index 5db22f07..00000000 --- a/node_modules/graphql/utilities/findDeprecatedUsages.js.flow +++ /dev/null @@ -1,29 +0,0 @@ -// @flow strict -import type { GraphQLError } from '../error/GraphQLError'; - -import type { DocumentNode } from '../language/ast'; - -import type { GraphQLSchema } from '../type/schema'; - -import { validate } from '../validation/validate'; -import { NoDeprecatedCustomRule } from '../validation/rules/custom/NoDeprecatedCustomRule'; - -/** - * A validation rule which reports deprecated usages. - * - * Returns a list of GraphQLError instances describing each deprecated use. - * - * @deprecated Please use `validate` with `NoDeprecatedCustomRule` instead: - * - * ``` - * import { validate, NoDeprecatedCustomRule } from 'graphql' - * - * const errors = validate(schema, document, [NoDeprecatedCustomRule]) - * ``` - */ -export function findDeprecatedUsages( - schema: GraphQLSchema, - ast: DocumentNode, -): $ReadOnlyArray { - return validate(schema, ast, [NoDeprecatedCustomRule]); -} diff --git a/node_modules/graphql/utilities/findDeprecatedUsages.mjs b/node_modules/graphql/utilities/findDeprecatedUsages.mjs deleted file mode 100644 index 7a850046..00000000 --- a/node_modules/graphql/utilities/findDeprecatedUsages.mjs +++ /dev/null @@ -1,19 +0,0 @@ -import { validate } from "../validation/validate.mjs"; -import { NoDeprecatedCustomRule } from "../validation/rules/custom/NoDeprecatedCustomRule.mjs"; -/** - * A validation rule which reports deprecated usages. - * - * Returns a list of GraphQLError instances describing each deprecated use. - * - * @deprecated Please use `validate` with `NoDeprecatedCustomRule` instead: - * - * ``` - * import { validate, NoDeprecatedCustomRule } from 'graphql' - * - * const errors = validate(schema, document, [NoDeprecatedCustomRule]) - * ``` - */ - -export function findDeprecatedUsages(schema, ast) { - return validate(schema, ast, [NoDeprecatedCustomRule]); -} diff --git a/node_modules/graphql/utilities/getIntrospectionQuery.d.ts b/node_modules/graphql/utilities/getIntrospectionQuery.d.ts deleted file mode 100644 index b1822168..00000000 --- a/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { DirectiveLocationEnum } from '../language/directiveLocation'; - -export interface IntrospectionOptions { - // Whether to include descriptions in the introspection result. - // Default: true - descriptions?: boolean; - - // Whether to include `specifiedByUrl` in the introspection result. - // Default: false - specifiedByUrl?: boolean; - - // Whether to include `isRepeatable` flag on directives. - // Default: false - directiveIsRepeatable?: boolean; - - // Whether to include `description` field on schema. - // Default: false - schemaDescription?: boolean; -} - -export function getIntrospectionQuery(options?: IntrospectionOptions): string; - -export interface IntrospectionQuery { - readonly __schema: IntrospectionSchema; -} - -export interface IntrospectionSchema { - readonly queryType: IntrospectionNamedTypeRef; - readonly mutationType: Maybe< - IntrospectionNamedTypeRef - >; - readonly subscriptionType: Maybe< - IntrospectionNamedTypeRef - >; - readonly types: ReadonlyArray; - readonly directives: ReadonlyArray; -} - -export type IntrospectionType = - | IntrospectionScalarType - | IntrospectionObjectType - | IntrospectionInterfaceType - | IntrospectionUnionType - | IntrospectionEnumType - | IntrospectionInputObjectType; - -export type IntrospectionOutputType = - | IntrospectionScalarType - | IntrospectionObjectType - | IntrospectionInterfaceType - | IntrospectionUnionType - | IntrospectionEnumType; - -export type IntrospectionInputType = - | IntrospectionScalarType - | IntrospectionEnumType - | IntrospectionInputObjectType; - -export interface IntrospectionScalarType { - readonly kind: 'SCALAR'; - readonly name: string; - readonly description?: Maybe; - readonly specifiedByUrl?: Maybe; -} - -export interface IntrospectionObjectType { - readonly kind: 'OBJECT'; - readonly name: string; - readonly description?: Maybe; - readonly fields: ReadonlyArray; - readonly interfaces: ReadonlyArray< - IntrospectionNamedTypeRef - >; -} - -export interface IntrospectionInterfaceType { - readonly kind: 'INTERFACE'; - readonly name: string; - readonly description?: Maybe; - readonly fields: ReadonlyArray; - readonly interfaces: ReadonlyArray< - IntrospectionNamedTypeRef - >; - readonly possibleTypes: ReadonlyArray< - IntrospectionNamedTypeRef - >; -} - -export interface IntrospectionUnionType { - readonly kind: 'UNION'; - readonly name: string; - readonly description?: Maybe; - readonly possibleTypes: ReadonlyArray< - IntrospectionNamedTypeRef - >; -} - -export interface IntrospectionEnumType { - readonly kind: 'ENUM'; - readonly name: string; - readonly description?: Maybe; - readonly enumValues: ReadonlyArray; -} - -export interface IntrospectionInputObjectType { - readonly kind: 'INPUT_OBJECT'; - readonly name: string; - readonly description?: Maybe; - readonly inputFields: ReadonlyArray; -} - -export interface IntrospectionListTypeRef< - T extends IntrospectionTypeRef = IntrospectionTypeRef -> { - readonly kind: 'LIST'; - readonly ofType: T; -} - -export interface IntrospectionNonNullTypeRef< - T extends IntrospectionTypeRef = IntrospectionTypeRef -> { - readonly kind: 'NON_NULL'; - readonly ofType: T; -} - -export type IntrospectionTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef< - IntrospectionNamedTypeRef | IntrospectionListTypeRef - >; - -export type IntrospectionOutputTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef< - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - >; - -export type IntrospectionInputTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef< - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - >; - -export interface IntrospectionNamedTypeRef< - T extends IntrospectionType = IntrospectionType -> { - readonly kind: T['kind']; - readonly name: string; -} - -export interface IntrospectionField { - readonly name: string; - readonly description?: Maybe; - readonly args: ReadonlyArray; - readonly type: IntrospectionOutputTypeRef; - readonly isDeprecated: boolean; - readonly deprecationReason?: Maybe; -} - -export interface IntrospectionInputValue { - readonly name: string; - readonly description?: Maybe; - readonly type: IntrospectionInputTypeRef; - readonly defaultValue?: Maybe; -} - -export interface IntrospectionEnumValue { - readonly name: string; - readonly description?: Maybe; - readonly isDeprecated: boolean; - readonly deprecationReason?: Maybe; -} - -export interface IntrospectionDirective { - readonly name: string; - readonly description?: Maybe; - readonly isRepeatable?: boolean; - readonly locations: ReadonlyArray; - readonly args: ReadonlyArray; -} diff --git a/node_modules/graphql/utilities/getIntrospectionQuery.js b/node_modules/graphql/utilities/getIntrospectionQuery.js deleted file mode 100644 index 9975279b..00000000 --- a/node_modules/graphql/utilities/getIntrospectionQuery.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getIntrospectionQuery = getIntrospectionQuery; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function getIntrospectionQuery(options) { - var optionsWithDefault = _objectSpread({ - descriptions: true, - specifiedByUrl: false, - directiveIsRepeatable: false, - schemaDescription: false - }, options); - - var descriptions = optionsWithDefault.descriptions ? 'description' : ''; - var specifiedByUrl = optionsWithDefault.specifiedByUrl ? 'specifiedByUrl' : ''; - var directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable ? 'isRepeatable' : ''; - var schemaDescription = optionsWithDefault.schemaDescription ? descriptions : ''; - return "\n query IntrospectionQuery {\n __schema {\n ".concat(schemaDescription, "\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ").concat(descriptions, "\n ").concat(directiveIsRepeatable, "\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(descriptions, "\n ").concat(specifiedByUrl, "\n fields(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(descriptions, "\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n "); -} diff --git a/node_modules/graphql/utilities/getIntrospectionQuery.js.flow b/node_modules/graphql/utilities/getIntrospectionQuery.js.flow deleted file mode 100644 index bb88e965..00000000 --- a/node_modules/graphql/utilities/getIntrospectionQuery.js.flow +++ /dev/null @@ -1,299 +0,0 @@ -// @flow strict -import type { DirectiveLocationEnum } from '../language/directiveLocation'; - -export type IntrospectionOptions = {| - // Whether to include descriptions in the introspection result. - // Default: true - descriptions?: boolean, - - // Whether to include `specifiedByUrl` in the introspection result. - // Default: false - specifiedByUrl?: boolean, - - // Whether to include `isRepeatable` field on directives. - // Default: false - directiveIsRepeatable?: boolean, - - // Whether to include `description` field on schema. - // Default: false - schemaDescription?: boolean, -|}; - -export function getIntrospectionQuery(options?: IntrospectionOptions): string { - const optionsWithDefault = { - descriptions: true, - specifiedByUrl: false, - directiveIsRepeatable: false, - schemaDescription: false, - ...options, - }; - - const descriptions = optionsWithDefault.descriptions ? 'description' : ''; - const specifiedByUrl = optionsWithDefault.specifiedByUrl - ? 'specifiedByUrl' - : ''; - const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable - ? 'isRepeatable' - : ''; - const schemaDescription = optionsWithDefault.schemaDescription - ? descriptions - : ''; - - return ` - query IntrospectionQuery { - __schema { - ${schemaDescription} - queryType { name } - mutationType { name } - subscriptionType { name } - types { - ...FullType - } - directives { - name - ${descriptions} - ${directiveIsRepeatable} - locations - args { - ...InputValue - } - } - } - } - - fragment FullType on __Type { - kind - name - ${descriptions} - ${specifiedByUrl} - fields(includeDeprecated: true) { - name - ${descriptions} - args { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - ${descriptions} - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - - fragment InputValue on __InputValue { - name - ${descriptions} - type { ...TypeRef } - defaultValue - } - - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } - `; -} - -export type IntrospectionQuery = {| - +__schema: IntrospectionSchema, -|}; - -export type IntrospectionSchema = {| - +description?: ?string, - +queryType: IntrospectionNamedTypeRef, - +mutationType: ?IntrospectionNamedTypeRef, - +subscriptionType: ?IntrospectionNamedTypeRef, - +types: $ReadOnlyArray, - +directives: $ReadOnlyArray, -|}; - -export type IntrospectionType = - | IntrospectionScalarType - | IntrospectionObjectType - | IntrospectionInterfaceType - | IntrospectionUnionType - | IntrospectionEnumType - | IntrospectionInputObjectType; - -export type IntrospectionOutputType = - | IntrospectionScalarType - | IntrospectionObjectType - | IntrospectionInterfaceType - | IntrospectionUnionType - | IntrospectionEnumType; - -export type IntrospectionInputType = - | IntrospectionScalarType - | IntrospectionEnumType - | IntrospectionInputObjectType; - -export type IntrospectionScalarType = {| - +kind: 'SCALAR', - +name: string, - +description?: ?string, - +specifiedByUrl?: ?string, -|}; - -export type IntrospectionObjectType = {| - +kind: 'OBJECT', - +name: string, - +description?: ?string, - +fields: $ReadOnlyArray, - +interfaces: $ReadOnlyArray< - IntrospectionNamedTypeRef, - >, -|}; - -export type IntrospectionInterfaceType = {| - +kind: 'INTERFACE', - +name: string, - +description?: ?string, - +fields: $ReadOnlyArray, - +interfaces: $ReadOnlyArray< - IntrospectionNamedTypeRef, - >, - +possibleTypes: $ReadOnlyArray< - IntrospectionNamedTypeRef, - >, -|}; - -export type IntrospectionUnionType = {| - +kind: 'UNION', - +name: string, - +description?: ?string, - +possibleTypes: $ReadOnlyArray< - IntrospectionNamedTypeRef, - >, -|}; - -export type IntrospectionEnumType = {| - +kind: 'ENUM', - +name: string, - +description?: ?string, - +enumValues: $ReadOnlyArray, -|}; - -export type IntrospectionInputObjectType = {| - +kind: 'INPUT_OBJECT', - +name: string, - +description?: ?string, - +inputFields: $ReadOnlyArray, -|}; - -export type IntrospectionListTypeRef< - T: IntrospectionTypeRef = IntrospectionTypeRef, -> = {| - +kind: 'LIST', - +ofType: T, -|}; - -export type IntrospectionNonNullTypeRef< - T: IntrospectionTypeRef = IntrospectionTypeRef, -> = {| - +kind: 'NON_NULL', - +ofType: T, -|}; - -export type IntrospectionTypeRef = - | IntrospectionNamedTypeRef<> - | IntrospectionListTypeRef<> - | IntrospectionNonNullTypeRef< - IntrospectionNamedTypeRef<> | IntrospectionListTypeRef<>, - >; - -export type IntrospectionOutputTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef< - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef, - >; - -export type IntrospectionInputTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef< - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef, - >; - -export type IntrospectionNamedTypeRef< - T: IntrospectionType = IntrospectionType, -> = {| - +kind: $PropertyType, - +name: string, -|}; - -export type IntrospectionField = {| - +name: string, - +description?: ?string, - +args: $ReadOnlyArray, - +type: IntrospectionOutputTypeRef, - +isDeprecated: boolean, - +deprecationReason: ?string, -|}; - -export type IntrospectionInputValue = {| - +name: string, - +description?: ?string, - +type: IntrospectionInputTypeRef, - +defaultValue: ?string, -|}; - -export type IntrospectionEnumValue = {| - +name: string, - +description?: ?string, - +isDeprecated: boolean, - +deprecationReason: ?string, -|}; - -export type IntrospectionDirective = {| - +name: string, - +description?: ?string, - +isRepeatable?: boolean, - +locations: $ReadOnlyArray, - +args: $ReadOnlyArray, -|}; diff --git a/node_modules/graphql/utilities/getIntrospectionQuery.mjs b/node_modules/graphql/utilities/getIntrospectionQuery.mjs deleted file mode 100644 index b8c0bc86..00000000 --- a/node_modules/graphql/utilities/getIntrospectionQuery.mjs +++ /dev/null @@ -1,20 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -export function getIntrospectionQuery(options) { - var optionsWithDefault = _objectSpread({ - descriptions: true, - specifiedByUrl: false, - directiveIsRepeatable: false, - schemaDescription: false - }, options); - - var descriptions = optionsWithDefault.descriptions ? 'description' : ''; - var specifiedByUrl = optionsWithDefault.specifiedByUrl ? 'specifiedByUrl' : ''; - var directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable ? 'isRepeatable' : ''; - var schemaDescription = optionsWithDefault.schemaDescription ? descriptions : ''; - return "\n query IntrospectionQuery {\n __schema {\n ".concat(schemaDescription, "\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ").concat(descriptions, "\n ").concat(directiveIsRepeatable, "\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(descriptions, "\n ").concat(specifiedByUrl, "\n fields(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(descriptions, "\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n "); -} diff --git a/node_modules/graphql/utilities/getOperationAST.d.ts b/node_modules/graphql/utilities/getOperationAST.d.ts deleted file mode 100644 index d17a9b49..00000000 --- a/node_modules/graphql/utilities/getOperationAST.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { DocumentNode, OperationDefinitionNode } from '../language/ast'; - -/** - * Returns an operation AST given a document AST and optionally an operation - * name. If a name is not provided, an operation is only returned if only one is - * provided in the document. - */ -export function getOperationAST( - documentAST: DocumentNode, - operationName?: Maybe, -): Maybe; diff --git a/node_modules/graphql/utilities/getOperationAST.js b/node_modules/graphql/utilities/getOperationAST.js deleted file mode 100644 index 976879c5..00000000 --- a/node_modules/graphql/utilities/getOperationAST.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getOperationAST = getOperationAST; - -var _kinds = require("../language/kinds.js"); - -/** - * Returns an operation AST given a document AST and optionally an operation - * name. If a name is not provided, an operation is only returned if only one is - * provided in the document. - */ -function getOperationAST(documentAST, operationName) { - var operation = null; - - for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) { - var definition = _documentAST$definiti2[_i2]; - - if (definition.kind === _kinds.Kind.OPERATION_DEFINITION) { - var _definition$name; - - if (operationName == null) { - // If no operation name was provided, only return an Operation if there - // is one defined in the document. Upon encountering the second, return - // null. - if (operation) { - return null; - } - - operation = definition; - } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { - return definition; - } - } - } - - return operation; -} diff --git a/node_modules/graphql/utilities/getOperationAST.js.flow b/node_modules/graphql/utilities/getOperationAST.js.flow deleted file mode 100644 index eaee0b05..00000000 --- a/node_modules/graphql/utilities/getOperationAST.js.flow +++ /dev/null @@ -1,31 +0,0 @@ -// @flow strict -import type { DocumentNode, OperationDefinitionNode } from '../language/ast'; -import { Kind } from '../language/kinds'; - -/** - * Returns an operation AST given a document AST and optionally an operation - * name. If a name is not provided, an operation is only returned if only one is - * provided in the document. - */ -export function getOperationAST( - documentAST: DocumentNode, - operationName?: ?string, -): ?OperationDefinitionNode { - let operation = null; - for (const definition of documentAST.definitions) { - if (definition.kind === Kind.OPERATION_DEFINITION) { - if (operationName == null) { - // If no operation name was provided, only return an Operation if there - // is one defined in the document. Upon encountering the second, return - // null. - if (operation) { - return null; - } - operation = definition; - } else if (definition.name?.value === operationName) { - return definition; - } - } - } - return operation; -} diff --git a/node_modules/graphql/utilities/getOperationAST.mjs b/node_modules/graphql/utilities/getOperationAST.mjs deleted file mode 100644 index ce721913..00000000 --- a/node_modules/graphql/utilities/getOperationAST.mjs +++ /dev/null @@ -1,33 +0,0 @@ -import { Kind } from "../language/kinds.mjs"; -/** - * Returns an operation AST given a document AST and optionally an operation - * name. If a name is not provided, an operation is only returned if only one is - * provided in the document. - */ - -export function getOperationAST(documentAST, operationName) { - var operation = null; - - for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) { - var definition = _documentAST$definiti2[_i2]; - - if (definition.kind === Kind.OPERATION_DEFINITION) { - var _definition$name; - - if (operationName == null) { - // If no operation name was provided, only return an Operation if there - // is one defined in the document. Upon encountering the second, return - // null. - if (operation) { - return null; - } - - operation = definition; - } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { - return definition; - } - } - } - - return operation; -} diff --git a/node_modules/graphql/utilities/getOperationRootType.d.ts b/node_modules/graphql/utilities/getOperationRootType.d.ts deleted file mode 100644 index 5adc59c7..00000000 --- a/node_modules/graphql/utilities/getOperationRootType.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { - OperationDefinitionNode, - OperationTypeDefinitionNode, -} from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; -import { GraphQLObjectType } from '../type/definition'; - -/** - * Extracts the root type of the operation from the schema. - */ -export function getOperationRootType( - schema: GraphQLSchema, - operation: OperationDefinitionNode | OperationTypeDefinitionNode, -): GraphQLObjectType; diff --git a/node_modules/graphql/utilities/getOperationRootType.js b/node_modules/graphql/utilities/getOperationRootType.js deleted file mode 100644 index f179fc34..00000000 --- a/node_modules/graphql/utilities/getOperationRootType.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getOperationRootType = getOperationRootType; - -var _GraphQLError = require("../error/GraphQLError.js"); - -/** - * Extracts the root type of the operation from the schema. - */ -function getOperationRootType(schema, operation) { - if (operation.operation === 'query') { - var queryType = schema.getQueryType(); - - if (!queryType) { - throw new _GraphQLError.GraphQLError('Schema does not define the required query root type.', operation); - } - - return queryType; - } - - if (operation.operation === 'mutation') { - var mutationType = schema.getMutationType(); - - if (!mutationType) { - throw new _GraphQLError.GraphQLError('Schema is not configured for mutations.', operation); - } - - return mutationType; - } - - if (operation.operation === 'subscription') { - var subscriptionType = schema.getSubscriptionType(); - - if (!subscriptionType) { - throw new _GraphQLError.GraphQLError('Schema is not configured for subscriptions.', operation); - } - - return subscriptionType; - } - - throw new _GraphQLError.GraphQLError('Can only have query, mutation and subscription operations.', operation); -} diff --git a/node_modules/graphql/utilities/getOperationRootType.js.flow b/node_modules/graphql/utilities/getOperationRootType.js.flow deleted file mode 100644 index 5358be41..00000000 --- a/node_modules/graphql/utilities/getOperationRootType.js.flow +++ /dev/null @@ -1,56 +0,0 @@ -// @flow strict -import { GraphQLError } from '../error/GraphQLError'; - -import type { - OperationDefinitionNode, - OperationTypeDefinitionNode, -} from '../language/ast'; - -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLObjectType } from '../type/definition'; - -/** - * Extracts the root type of the operation from the schema. - */ -export function getOperationRootType( - schema: GraphQLSchema, - operation: OperationDefinitionNode | OperationTypeDefinitionNode, -): GraphQLObjectType { - if (operation.operation === 'query') { - const queryType = schema.getQueryType(); - if (!queryType) { - throw new GraphQLError( - 'Schema does not define the required query root type.', - operation, - ); - } - return queryType; - } - - if (operation.operation === 'mutation') { - const mutationType = schema.getMutationType(); - if (!mutationType) { - throw new GraphQLError( - 'Schema is not configured for mutations.', - operation, - ); - } - return mutationType; - } - - if (operation.operation === 'subscription') { - const subscriptionType = schema.getSubscriptionType(); - if (!subscriptionType) { - throw new GraphQLError( - 'Schema is not configured for subscriptions.', - operation, - ); - } - return subscriptionType; - } - - throw new GraphQLError( - 'Can only have query, mutation and subscription operations.', - operation, - ); -} diff --git a/node_modules/graphql/utilities/getOperationRootType.mjs b/node_modules/graphql/utilities/getOperationRootType.mjs deleted file mode 100644 index e0b75d7d..00000000 --- a/node_modules/graphql/utilities/getOperationRootType.mjs +++ /dev/null @@ -1,38 +0,0 @@ -import { GraphQLError } from "../error/GraphQLError.mjs"; - -/** - * Extracts the root type of the operation from the schema. - */ -export function getOperationRootType(schema, operation) { - if (operation.operation === 'query') { - var queryType = schema.getQueryType(); - - if (!queryType) { - throw new GraphQLError('Schema does not define the required query root type.', operation); - } - - return queryType; - } - - if (operation.operation === 'mutation') { - var mutationType = schema.getMutationType(); - - if (!mutationType) { - throw new GraphQLError('Schema is not configured for mutations.', operation); - } - - return mutationType; - } - - if (operation.operation === 'subscription') { - var subscriptionType = schema.getSubscriptionType(); - - if (!subscriptionType) { - throw new GraphQLError('Schema is not configured for subscriptions.', operation); - } - - return subscriptionType; - } - - throw new GraphQLError('Can only have query, mutation and subscription operations.', operation); -} diff --git a/node_modules/graphql/utilities/index.d.ts b/node_modules/graphql/utilities/index.d.ts deleted file mode 100644 index a8019f99..00000000 --- a/node_modules/graphql/utilities/index.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -export { - // Produce the GraphQL query recommended for a full schema introspection. - // Accepts optional IntrospectionOptions. - getIntrospectionQuery, - IntrospectionOptions, - IntrospectionQuery, - IntrospectionSchema, - IntrospectionType, - IntrospectionInputType, - IntrospectionOutputType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionInputTypeRef, - IntrospectionOutputTypeRef, - IntrospectionNamedTypeRef, - IntrospectionListTypeRef, - IntrospectionNonNullTypeRef, - IntrospectionField, - IntrospectionInputValue, - IntrospectionEnumValue, - IntrospectionDirective, -} from './getIntrospectionQuery'; - -// Gets the target Operation from a Document -export { getOperationAST } from './getOperationAST'; - -// Gets the Type for the target Operation AST. -export { getOperationRootType } from './getOperationRootType'; - -// Convert a GraphQLSchema to an IntrospectionQuery -export { introspectionFromSchema } from './introspectionFromSchema'; - -// Build a GraphQLSchema from an introspection result. -export { buildClientSchema } from './buildClientSchema'; - -// Build a GraphQLSchema from GraphQL Schema language. -export { - buildASTSchema, - buildSchema, - BuildSchemaOptions, -} from './buildASTSchema'; - -// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. -export { - extendSchema, - // @deprecated: Get the description from a schema AST node and supports legacy - // syntax for specifying descriptions - will be removed in v16 - getDescription, -} from './extendSchema'; - -// Sort a GraphQLSchema. -export { lexicographicSortSchema } from './lexicographicSortSchema'; - -// Print a GraphQLSchema to GraphQL Schema language. -export { - printSchema, - printType, - printIntrospectionSchema, -} from './printSchema'; - -// Create a GraphQLType from a GraphQL language AST. -export { typeFromAST } from './typeFromAST'; - -// Create a JavaScript value from a GraphQL language AST with a type. -export { valueFromAST } from './valueFromAST'; - -// Create a JavaScript value from a GraphQL language AST without a type. -export { valueFromASTUntyped } from './valueFromASTUntyped'; - -// Create a GraphQL language AST from a JavaScript value. -export { astFromValue } from './astFromValue'; - -// A helper to use within recursive-descent visitors which need to be aware of -// the GraphQL type system. -export { TypeInfo, visitWithTypeInfo } from './TypeInfo'; - -// Coerces a JavaScript value to a GraphQL type, or produces errors. -export { coerceInputValue } from './coerceInputValue'; - -// Concatenates multiple AST together. -export { concatAST } from './concatAST'; - -// Separates an AST into an AST per Operation. -export { separateOperations } from './separateOperations'; - -// Strips characters that are not significant to the validity or execution -// of a GraphQL document. -export { stripIgnoredCharacters } from './stripIgnoredCharacters'; - -// Comparators for types -export { - isEqualType, - isTypeSubTypeOf, - doTypesOverlap, -} from './typeComparators'; - -// Asserts that a string is a valid GraphQL name -export { assertValidName, isValidNameError } from './assertValidName'; - -// Compares two GraphQLSchemas and detects breaking changes. -export { - BreakingChangeType, - DangerousChangeType, - findBreakingChanges, - findDangerousChanges, - BreakingChange, - DangerousChange, -} from './findBreakingChanges'; - -// Wrapper type that contains DocumentNode and types that can be deduced from it. -export { TypedQueryDocumentNode } from './typedQueryDocumentNode'; - -// @deprecated: Report all deprecated usage within a GraphQL document. -export { findDeprecatedUsages } from './findDeprecatedUsages'; diff --git a/node_modules/graphql/utilities/index.js b/node_modules/graphql/utilities/index.js deleted file mode 100644 index 086e5f31..00000000 --- a/node_modules/graphql/utilities/index.js +++ /dev/null @@ -1,247 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "getIntrospectionQuery", { - enumerable: true, - get: function get() { - return _getIntrospectionQuery.getIntrospectionQuery; - } -}); -Object.defineProperty(exports, "getOperationAST", { - enumerable: true, - get: function get() { - return _getOperationAST.getOperationAST; - } -}); -Object.defineProperty(exports, "getOperationRootType", { - enumerable: true, - get: function get() { - return _getOperationRootType.getOperationRootType; - } -}); -Object.defineProperty(exports, "introspectionFromSchema", { - enumerable: true, - get: function get() { - return _introspectionFromSchema.introspectionFromSchema; - } -}); -Object.defineProperty(exports, "buildClientSchema", { - enumerable: true, - get: function get() { - return _buildClientSchema.buildClientSchema; - } -}); -Object.defineProperty(exports, "buildASTSchema", { - enumerable: true, - get: function get() { - return _buildASTSchema.buildASTSchema; - } -}); -Object.defineProperty(exports, "buildSchema", { - enumerable: true, - get: function get() { - return _buildASTSchema.buildSchema; - } -}); -Object.defineProperty(exports, "extendSchema", { - enumerable: true, - get: function get() { - return _extendSchema.extendSchema; - } -}); -Object.defineProperty(exports, "getDescription", { - enumerable: true, - get: function get() { - return _extendSchema.getDescription; - } -}); -Object.defineProperty(exports, "lexicographicSortSchema", { - enumerable: true, - get: function get() { - return _lexicographicSortSchema.lexicographicSortSchema; - } -}); -Object.defineProperty(exports, "printSchema", { - enumerable: true, - get: function get() { - return _printSchema.printSchema; - } -}); -Object.defineProperty(exports, "printType", { - enumerable: true, - get: function get() { - return _printSchema.printType; - } -}); -Object.defineProperty(exports, "printIntrospectionSchema", { - enumerable: true, - get: function get() { - return _printSchema.printIntrospectionSchema; - } -}); -Object.defineProperty(exports, "typeFromAST", { - enumerable: true, - get: function get() { - return _typeFromAST.typeFromAST; - } -}); -Object.defineProperty(exports, "valueFromAST", { - enumerable: true, - get: function get() { - return _valueFromAST.valueFromAST; - } -}); -Object.defineProperty(exports, "valueFromASTUntyped", { - enumerable: true, - get: function get() { - return _valueFromASTUntyped.valueFromASTUntyped; - } -}); -Object.defineProperty(exports, "astFromValue", { - enumerable: true, - get: function get() { - return _astFromValue.astFromValue; - } -}); -Object.defineProperty(exports, "TypeInfo", { - enumerable: true, - get: function get() { - return _TypeInfo.TypeInfo; - } -}); -Object.defineProperty(exports, "visitWithTypeInfo", { - enumerable: true, - get: function get() { - return _TypeInfo.visitWithTypeInfo; - } -}); -Object.defineProperty(exports, "coerceInputValue", { - enumerable: true, - get: function get() { - return _coerceInputValue.coerceInputValue; - } -}); -Object.defineProperty(exports, "concatAST", { - enumerable: true, - get: function get() { - return _concatAST.concatAST; - } -}); -Object.defineProperty(exports, "separateOperations", { - enumerable: true, - get: function get() { - return _separateOperations.separateOperations; - } -}); -Object.defineProperty(exports, "stripIgnoredCharacters", { - enumerable: true, - get: function get() { - return _stripIgnoredCharacters.stripIgnoredCharacters; - } -}); -Object.defineProperty(exports, "isEqualType", { - enumerable: true, - get: function get() { - return _typeComparators.isEqualType; - } -}); -Object.defineProperty(exports, "isTypeSubTypeOf", { - enumerable: true, - get: function get() { - return _typeComparators.isTypeSubTypeOf; - } -}); -Object.defineProperty(exports, "doTypesOverlap", { - enumerable: true, - get: function get() { - return _typeComparators.doTypesOverlap; - } -}); -Object.defineProperty(exports, "assertValidName", { - enumerable: true, - get: function get() { - return _assertValidName.assertValidName; - } -}); -Object.defineProperty(exports, "isValidNameError", { - enumerable: true, - get: function get() { - return _assertValidName.isValidNameError; - } -}); -Object.defineProperty(exports, "BreakingChangeType", { - enumerable: true, - get: function get() { - return _findBreakingChanges.BreakingChangeType; - } -}); -Object.defineProperty(exports, "DangerousChangeType", { - enumerable: true, - get: function get() { - return _findBreakingChanges.DangerousChangeType; - } -}); -Object.defineProperty(exports, "findBreakingChanges", { - enumerable: true, - get: function get() { - return _findBreakingChanges.findBreakingChanges; - } -}); -Object.defineProperty(exports, "findDangerousChanges", { - enumerable: true, - get: function get() { - return _findBreakingChanges.findDangerousChanges; - } -}); -Object.defineProperty(exports, "findDeprecatedUsages", { - enumerable: true, - get: function get() { - return _findDeprecatedUsages.findDeprecatedUsages; - } -}); - -var _getIntrospectionQuery = require("./getIntrospectionQuery.js"); - -var _getOperationAST = require("./getOperationAST.js"); - -var _getOperationRootType = require("./getOperationRootType.js"); - -var _introspectionFromSchema = require("./introspectionFromSchema.js"); - -var _buildClientSchema = require("./buildClientSchema.js"); - -var _buildASTSchema = require("./buildASTSchema.js"); - -var _extendSchema = require("./extendSchema.js"); - -var _lexicographicSortSchema = require("./lexicographicSortSchema.js"); - -var _printSchema = require("./printSchema.js"); - -var _typeFromAST = require("./typeFromAST.js"); - -var _valueFromAST = require("./valueFromAST.js"); - -var _valueFromASTUntyped = require("./valueFromASTUntyped.js"); - -var _astFromValue = require("./astFromValue.js"); - -var _TypeInfo = require("./TypeInfo.js"); - -var _coerceInputValue = require("./coerceInputValue.js"); - -var _concatAST = require("./concatAST.js"); - -var _separateOperations = require("./separateOperations.js"); - -var _stripIgnoredCharacters = require("./stripIgnoredCharacters.js"); - -var _typeComparators = require("./typeComparators.js"); - -var _assertValidName = require("./assertValidName.js"); - -var _findBreakingChanges = require("./findBreakingChanges.js"); - -var _findDeprecatedUsages = require("./findDeprecatedUsages.js"); diff --git a/node_modules/graphql/utilities/index.js.flow b/node_modules/graphql/utilities/index.js.flow deleted file mode 100644 index 96564b74..00000000 --- a/node_modules/graphql/utilities/index.js.flow +++ /dev/null @@ -1,114 +0,0 @@ -// @flow strict -// Produce the GraphQL query recommended for a full schema introspection. -// Accepts optional IntrospectionOptions. -export { getIntrospectionQuery } from './getIntrospectionQuery'; - -export type { - IntrospectionOptions, - IntrospectionQuery, - IntrospectionSchema, - IntrospectionType, - IntrospectionInputType, - IntrospectionOutputType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionInputTypeRef, - IntrospectionOutputTypeRef, - IntrospectionNamedTypeRef, - IntrospectionListTypeRef, - IntrospectionNonNullTypeRef, - IntrospectionField, - IntrospectionInputValue, - IntrospectionEnumValue, - IntrospectionDirective, -} from './getIntrospectionQuery'; - -// Gets the target Operation from a Document. -export { getOperationAST } from './getOperationAST'; - -// Gets the Type for the target Operation AST. -export { getOperationRootType } from './getOperationRootType'; - -// Convert a GraphQLSchema to an IntrospectionQuery. -export { introspectionFromSchema } from './introspectionFromSchema'; - -// Build a GraphQLSchema from an introspection result. -export { buildClientSchema } from './buildClientSchema'; - -// Build a GraphQLSchema from GraphQL Schema language. -export { buildASTSchema, buildSchema } from './buildASTSchema'; -export type { BuildSchemaOptions } from './buildASTSchema'; - -// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. -export { - extendSchema, - // @deprecated: Get the description from a schema AST node and supports legacy - // syntax for specifying descriptions - will be removed in v16. - getDescription, -} from './extendSchema'; - -// Sort a GraphQLSchema. -export { lexicographicSortSchema } from './lexicographicSortSchema'; - -// Print a GraphQLSchema to GraphQL Schema language. -export { - printSchema, - printType, - printIntrospectionSchema, -} from './printSchema'; - -// Create a GraphQLType from a GraphQL language AST. -export { typeFromAST } from './typeFromAST'; - -// Create a JavaScript value from a GraphQL language AST with a type. -export { valueFromAST } from './valueFromAST'; - -// Create a JavaScript value from a GraphQL language AST without a type. -export { valueFromASTUntyped } from './valueFromASTUntyped'; - -// Create a GraphQL language AST from a JavaScript value. -export { astFromValue } from './astFromValue'; - -// A helper to use within recursive-descent visitors which need to be aware of -// the GraphQL type system. -export { TypeInfo, visitWithTypeInfo } from './TypeInfo'; - -// Coerces a JavaScript value to a GraphQL type, or produces errors. -export { coerceInputValue } from './coerceInputValue'; - -// Concatenates multiple AST together. -export { concatAST } from './concatAST'; - -// Separates an AST into an AST per Operation. -export { separateOperations } from './separateOperations'; - -// Strips characters that are not significant to the validity or execution -// of a GraphQL document. -export { stripIgnoredCharacters } from './stripIgnoredCharacters'; - -// Comparators for types -export { - isEqualType, - isTypeSubTypeOf, - doTypesOverlap, -} from './typeComparators'; - -// Asserts that a string is a valid GraphQL name -export { assertValidName, isValidNameError } from './assertValidName'; - -// Compares two GraphQLSchemas and detects breaking changes. -export { - BreakingChangeType, - DangerousChangeType, - findBreakingChanges, - findDangerousChanges, -} from './findBreakingChanges'; -export type { BreakingChange, DangerousChange } from './findBreakingChanges'; - -// @deprecated: Report all deprecated usage within a GraphQL document. -export { findDeprecatedUsages } from './findDeprecatedUsages'; diff --git a/node_modules/graphql/utilities/index.mjs b/node_modules/graphql/utilities/index.mjs deleted file mode 100644 index 68868fe2..00000000 --- a/node_modules/graphql/utilities/index.mjs +++ /dev/null @@ -1,49 +0,0 @@ -// Produce the GraphQL query recommended for a full schema introspection. -// Accepts optional IntrospectionOptions. -export { getIntrospectionQuery } from "./getIntrospectionQuery.mjs"; -// Gets the target Operation from a Document. -export { getOperationAST } from "./getOperationAST.mjs"; // Gets the Type for the target Operation AST. - -export { getOperationRootType } from "./getOperationRootType.mjs"; // Convert a GraphQLSchema to an IntrospectionQuery. - -export { introspectionFromSchema } from "./introspectionFromSchema.mjs"; // Build a GraphQLSchema from an introspection result. - -export { buildClientSchema } from "./buildClientSchema.mjs"; // Build a GraphQLSchema from GraphQL Schema language. - -export { buildASTSchema, buildSchema } from "./buildASTSchema.mjs"; -// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. -export { extendSchema // @deprecated: Get the description from a schema AST node and supports legacy -// syntax for specifying descriptions - will be removed in v16. -, getDescription } from "./extendSchema.mjs"; // Sort a GraphQLSchema. - -export { lexicographicSortSchema } from "./lexicographicSortSchema.mjs"; // Print a GraphQLSchema to GraphQL Schema language. - -export { printSchema, printType, printIntrospectionSchema } from "./printSchema.mjs"; // Create a GraphQLType from a GraphQL language AST. - -export { typeFromAST } from "./typeFromAST.mjs"; // Create a JavaScript value from a GraphQL language AST with a type. - -export { valueFromAST } from "./valueFromAST.mjs"; // Create a JavaScript value from a GraphQL language AST without a type. - -export { valueFromASTUntyped } from "./valueFromASTUntyped.mjs"; // Create a GraphQL language AST from a JavaScript value. - -export { astFromValue } from "./astFromValue.mjs"; // A helper to use within recursive-descent visitors which need to be aware of -// the GraphQL type system. - -export { TypeInfo, visitWithTypeInfo } from "./TypeInfo.mjs"; // Coerces a JavaScript value to a GraphQL type, or produces errors. - -export { coerceInputValue } from "./coerceInputValue.mjs"; // Concatenates multiple AST together. - -export { concatAST } from "./concatAST.mjs"; // Separates an AST into an AST per Operation. - -export { separateOperations } from "./separateOperations.mjs"; // Strips characters that are not significant to the validity or execution -// of a GraphQL document. - -export { stripIgnoredCharacters } from "./stripIgnoredCharacters.mjs"; // Comparators for types - -export { isEqualType, isTypeSubTypeOf, doTypesOverlap } from "./typeComparators.mjs"; // Asserts that a string is a valid GraphQL name - -export { assertValidName, isValidNameError } from "./assertValidName.mjs"; // Compares two GraphQLSchemas and detects breaking changes. - -export { BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges } from "./findBreakingChanges.mjs"; -// @deprecated: Report all deprecated usage within a GraphQL document. -export { findDeprecatedUsages } from "./findDeprecatedUsages.mjs"; diff --git a/node_modules/graphql/utilities/introspectionFromSchema.d.ts b/node_modules/graphql/utilities/introspectionFromSchema.d.ts deleted file mode 100644 index ed9abf16..00000000 --- a/node_modules/graphql/utilities/introspectionFromSchema.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { GraphQLSchema } from '../type/schema'; - -import { - IntrospectionQuery, - IntrospectionOptions, -} from './getIntrospectionQuery'; - -/** - * Build an IntrospectionQuery from a GraphQLSchema - * - * IntrospectionQuery is useful for utilities that care about type and field - * relationships, but do not need to traverse through those relationships. - * - * This is the inverse of buildClientSchema. The primary use case is outside - * of the server context, for instance when doing schema comparisons. - */ -export function introspectionFromSchema( - schema: GraphQLSchema, - options?: IntrospectionOptions, -): IntrospectionQuery; diff --git a/node_modules/graphql/utilities/introspectionFromSchema.js b/node_modules/graphql/utilities/introspectionFromSchema.js deleted file mode 100644 index 81c21cb9..00000000 --- a/node_modules/graphql/utilities/introspectionFromSchema.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.introspectionFromSchema = introspectionFromSchema; - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _parser = require("../language/parser.js"); - -var _execute = require("../execution/execute.js"); - -var _getIntrospectionQuery = require("./getIntrospectionQuery.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Build an IntrospectionQuery from a GraphQLSchema - * - * IntrospectionQuery is useful for utilities that care about type and field - * relationships, but do not need to traverse through those relationships. - * - * This is the inverse of buildClientSchema. The primary use case is outside - * of the server context, for instance when doing schema comparisons. - */ -function introspectionFromSchema(schema, options) { - var optionsWithDefaults = _objectSpread({ - directiveIsRepeatable: true, - schemaDescription: true - }, options); - - var document = (0, _parser.parse)((0, _getIntrospectionQuery.getIntrospectionQuery)(optionsWithDefaults)); - var result = (0, _execute.executeSync)({ - schema: schema, - document: document - }); - !result.errors && result.data || (0, _invariant.default)(0); - return result.data; -} diff --git a/node_modules/graphql/utilities/introspectionFromSchema.js.flow b/node_modules/graphql/utilities/introspectionFromSchema.js.flow deleted file mode 100644 index 6bf7320a..00000000 --- a/node_modules/graphql/utilities/introspectionFromSchema.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -// @flow strict -import invariant from '../jsutils/invariant'; - -import { parse } from '../language/parser'; - -import type { GraphQLSchema } from '../type/schema'; - -import { executeSync } from '../execution/execute'; - -import type { - IntrospectionQuery, - IntrospectionOptions, -} from './getIntrospectionQuery'; -import { getIntrospectionQuery } from './getIntrospectionQuery'; - -/** - * Build an IntrospectionQuery from a GraphQLSchema - * - * IntrospectionQuery is useful for utilities that care about type and field - * relationships, but do not need to traverse through those relationships. - * - * This is the inverse of buildClientSchema. The primary use case is outside - * of the server context, for instance when doing schema comparisons. - */ -export function introspectionFromSchema( - schema: GraphQLSchema, - options?: IntrospectionOptions, -): IntrospectionQuery { - const optionsWithDefaults = { - directiveIsRepeatable: true, - schemaDescription: true, - ...options, - }; - - const document = parse(getIntrospectionQuery(optionsWithDefaults)); - const result = executeSync({ schema, document }); - invariant(!result.errors && result.data); - return (result.data: any); -} diff --git a/node_modules/graphql/utilities/introspectionFromSchema.mjs b/node_modules/graphql/utilities/introspectionFromSchema.mjs deleted file mode 100644 index 77cb4e84..00000000 --- a/node_modules/graphql/utilities/introspectionFromSchema.mjs +++ /dev/null @@ -1,34 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import invariant from "../jsutils/invariant.mjs"; -import { parse } from "../language/parser.mjs"; -import { executeSync } from "../execution/execute.mjs"; -import { getIntrospectionQuery } from "./getIntrospectionQuery.mjs"; -/** - * Build an IntrospectionQuery from a GraphQLSchema - * - * IntrospectionQuery is useful for utilities that care about type and field - * relationships, but do not need to traverse through those relationships. - * - * This is the inverse of buildClientSchema. The primary use case is outside - * of the server context, for instance when doing schema comparisons. - */ - -export function introspectionFromSchema(schema, options) { - var optionsWithDefaults = _objectSpread({ - directiveIsRepeatable: true, - schemaDescription: true - }, options); - - var document = parse(getIntrospectionQuery(optionsWithDefaults)); - var result = executeSync({ - schema: schema, - document: document - }); - !result.errors && result.data || invariant(0); - return result.data; -} diff --git a/node_modules/graphql/utilities/lexicographicSortSchema.d.ts b/node_modules/graphql/utilities/lexicographicSortSchema.d.ts deleted file mode 100644 index 7dfde701..00000000 --- a/node_modules/graphql/utilities/lexicographicSortSchema.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { GraphQLSchema } from '../type/schema'; - -/** - * Sort GraphQLSchema. - * - * This function returns a sorted copy of the given GraphQLSchema. - */ -export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema; diff --git a/node_modules/graphql/utilities/lexicographicSortSchema.js b/node_modules/graphql/utilities/lexicographicSortSchema.js deleted file mode 100644 index 684ec011..00000000 --- a/node_modules/graphql/utilities/lexicographicSortSchema.js +++ /dev/null @@ -1,200 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.lexicographicSortSchema = lexicographicSortSchema; - -var _objectValues = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap.js")); - -var _schema = require("../type/schema.js"); - -var _directives = require("../type/directives.js"); - -var _introspection = require("../type/introspection.js"); - -var _definition = require("../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Sort GraphQLSchema. - * - * This function returns a sorted copy of the given GraphQLSchema. - */ -function lexicographicSortSchema(schema) { - var schemaConfig = schema.toConfig(); - var typeMap = (0, _keyValMap.default)(sortByName(schemaConfig.types), function (type) { - return type.name; - }, sortNamedType); - return new _schema.GraphQLSchema(_objectSpread(_objectSpread({}, schemaConfig), {}, { - types: (0, _objectValues.default)(typeMap), - directives: sortByName(schemaConfig.directives).map(sortDirective), - query: replaceMaybeType(schemaConfig.query), - mutation: replaceMaybeType(schemaConfig.mutation), - subscription: replaceMaybeType(schemaConfig.subscription) - })); - - function replaceType(type) { - if ((0, _definition.isListType)(type)) { - // $FlowFixMe[incompatible-return] - return new _definition.GraphQLList(replaceType(type.ofType)); - } else if ((0, _definition.isNonNullType)(type)) { - // $FlowFixMe[incompatible-return] - return new _definition.GraphQLNonNull(replaceType(type.ofType)); - } - - return replaceNamedType(type); - } - - function replaceNamedType(type) { - return typeMap[type.name]; - } - - function replaceMaybeType(maybeType) { - return maybeType && replaceNamedType(maybeType); - } - - function sortDirective(directive) { - var config = directive.toConfig(); - return new _directives.GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, { - locations: sortBy(config.locations, function (x) { - return x; - }), - args: sortArgs(config.args) - })); - } - - function sortArgs(args) { - return sortObjMap(args, function (arg) { - return _objectSpread(_objectSpread({}, arg), {}, { - type: replaceType(arg.type) - }); - }); - } - - function sortFields(fieldsMap) { - return sortObjMap(fieldsMap, function (field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type), - args: sortArgs(field.args) - }); - }); - } - - function sortInputFields(fieldsMap) { - return sortObjMap(fieldsMap, function (field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type) - }); - }); - } - - function sortTypes(arr) { - return sortByName(arr).map(replaceNamedType); - } - - function sortNamedType(type) { - if ((0, _definition.isScalarType)(type) || (0, _introspection.isIntrospectionType)(type)) { - return type; - } - - if ((0, _definition.isObjectType)(type)) { - var config = type.toConfig(); - return new _definition.GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, { - interfaces: function interfaces() { - return sortTypes(config.interfaces); - }, - fields: function fields() { - return sortFields(config.fields); - } - })); - } - - if ((0, _definition.isInterfaceType)(type)) { - var _config = type.toConfig(); - - return new _definition.GraphQLInterfaceType(_objectSpread(_objectSpread({}, _config), {}, { - interfaces: function interfaces() { - return sortTypes(_config.interfaces); - }, - fields: function fields() { - return sortFields(_config.fields); - } - })); - } - - if ((0, _definition.isUnionType)(type)) { - var _config2 = type.toConfig(); - - return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, { - types: function types() { - return sortTypes(_config2.types); - } - })); - } - - if ((0, _definition.isEnumType)(type)) { - var _config3 = type.toConfig(); - - return new _definition.GraphQLEnumType(_objectSpread(_objectSpread({}, _config3), {}, { - values: sortObjMap(_config3.values) - })); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isInputObjectType)(type)) { - var _config4 = type.toConfig(); - - return new _definition.GraphQLInputObjectType(_objectSpread(_objectSpread({}, _config4), {}, { - fields: function fields() { - return sortInputFields(_config4.fields); - } - })); - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); - } -} - -function sortObjMap(map, sortValueFn) { - var sortedMap = Object.create(null); - var sortedKeys = sortBy(Object.keys(map), function (x) { - return x; - }); - - for (var _i2 = 0; _i2 < sortedKeys.length; _i2++) { - var key = sortedKeys[_i2]; - var value = map[key]; - sortedMap[key] = sortValueFn ? sortValueFn(value) : value; - } - - return sortedMap; -} - -function sortByName(array) { - return sortBy(array, function (obj) { - return obj.name; - }); -} - -function sortBy(array, mapToKey) { - return array.slice().sort(function (obj1, obj2) { - var key1 = mapToKey(obj1); - var key2 = mapToKey(obj2); - return key1.localeCompare(key2); - }); -} diff --git a/node_modules/graphql/utilities/lexicographicSortSchema.js.flow b/node_modules/graphql/utilities/lexicographicSortSchema.js.flow deleted file mode 100644 index 692dc662..00000000 --- a/node_modules/graphql/utilities/lexicographicSortSchema.js.flow +++ /dev/null @@ -1,186 +0,0 @@ -// @flow strict -import objectValues from '../polyfills/objectValues'; - -import type { ObjMap } from '../jsutils/ObjMap'; -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; -import keyValMap from '../jsutils/keyValMap'; - -import type { - GraphQLType, - GraphQLNamedType, - GraphQLFieldConfigMap, - GraphQLFieldConfigArgumentMap, - GraphQLInputFieldConfigMap, -} from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; -import { GraphQLDirective } from '../type/directives'; -import { isIntrospectionType } from '../type/introspection'; -import { - GraphQLList, - GraphQLNonNull, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - isListType, - isNonNullType, - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, -} from '../type/definition'; - -/** - * Sort GraphQLSchema. - * - * This function returns a sorted copy of the given GraphQLSchema. - */ -export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema { - const schemaConfig = schema.toConfig(); - const typeMap = keyValMap( - sortByName(schemaConfig.types), - (type) => type.name, - sortNamedType, - ); - - return new GraphQLSchema({ - ...schemaConfig, - types: objectValues(typeMap), - directives: sortByName(schemaConfig.directives).map(sortDirective), - query: replaceMaybeType(schemaConfig.query), - mutation: replaceMaybeType(schemaConfig.mutation), - subscription: replaceMaybeType(schemaConfig.subscription), - }); - - function replaceType(type: T): T { - if (isListType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLList(replaceType(type.ofType)); - } else if (isNonNullType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLNonNull(replaceType(type.ofType)); - } - return replaceNamedType(type); - } - - function replaceNamedType(type: T): T { - return ((typeMap[type.name]: any): T); - } - - function replaceMaybeType(maybeType: T): T { - return maybeType && replaceNamedType(maybeType); - } - - function sortDirective(directive: GraphQLDirective) { - const config = directive.toConfig(); - return new GraphQLDirective({ - ...config, - locations: sortBy(config.locations, (x) => x), - args: sortArgs(config.args), - }); - } - - function sortArgs(args: GraphQLFieldConfigArgumentMap) { - return sortObjMap(args, (arg) => ({ - ...arg, - type: replaceType(arg.type), - })); - } - - function sortFields(fieldsMap: GraphQLFieldConfigMap) { - return sortObjMap(fieldsMap, (field) => ({ - ...field, - type: replaceType(field.type), - args: sortArgs(field.args), - })); - } - - function sortInputFields(fieldsMap: GraphQLInputFieldConfigMap) { - return sortObjMap(fieldsMap, (field) => ({ - ...field, - type: replaceType(field.type), - })); - } - - function sortTypes(arr: $ReadOnlyArray): Array { - return sortByName(arr).map(replaceNamedType); - } - - function sortNamedType(type: T) { - if (isScalarType(type) || isIntrospectionType(type)) { - return type; - } - if (isObjectType(type)) { - const config = type.toConfig(); - return new GraphQLObjectType({ - ...config, - interfaces: () => sortTypes(config.interfaces), - fields: () => sortFields(config.fields), - }); - } - if (isInterfaceType(type)) { - const config = type.toConfig(); - return new GraphQLInterfaceType({ - ...config, - interfaces: () => sortTypes(config.interfaces), - fields: () => sortFields(config.fields), - }); - } - if (isUnionType(type)) { - const config = type.toConfig(); - return new GraphQLUnionType({ - ...config, - types: () => sortTypes(config.types), - }); - } - if (isEnumType(type)) { - const config = type.toConfig(); - return new GraphQLEnumType({ - ...config, - values: sortObjMap(config.values), - }); - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isInputObjectType(type)) { - const config = type.toConfig(); - return new GraphQLInputObjectType({ - ...config, - fields: () => sortInputFields(config.fields), - }); - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected type: ' + inspect((type: empty))); - } -} - -function sortObjMap(map: ObjMap, sortValueFn?: (T) => R): ObjMap { - const sortedMap = Object.create(null); - const sortedKeys = sortBy(Object.keys(map), (x) => x); - for (const key of sortedKeys) { - const value = map[key]; - sortedMap[key] = sortValueFn ? sortValueFn(value) : value; - } - return sortedMap; -} - -function sortByName( - array: $ReadOnlyArray, -): Array { - return sortBy(array, (obj) => obj.name); -} - -function sortBy( - array: $ReadOnlyArray, - mapToKey: (T) => string, -): Array { - return array.slice().sort((obj1, obj2) => { - const key1 = mapToKey(obj1); - const key2 = mapToKey(obj2); - return key1.localeCompare(key2); - }); -} diff --git a/node_modules/graphql/utilities/lexicographicSortSchema.mjs b/node_modules/graphql/utilities/lexicographicSortSchema.mjs deleted file mode 100644 index 1c2b2f38..00000000 --- a/node_modules/graphql/utilities/lexicographicSortSchema.mjs +++ /dev/null @@ -1,184 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import objectValues from "../polyfills/objectValues.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import keyValMap from "../jsutils/keyValMap.mjs"; -import { GraphQLSchema } from "../type/schema.mjs"; -import { GraphQLDirective } from "../type/directives.mjs"; -import { isIntrospectionType } from "../type/introspection.mjs"; -import { GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, isListType, isNonNullType, isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType } from "../type/definition.mjs"; -/** - * Sort GraphQLSchema. - * - * This function returns a sorted copy of the given GraphQLSchema. - */ - -export function lexicographicSortSchema(schema) { - var schemaConfig = schema.toConfig(); - var typeMap = keyValMap(sortByName(schemaConfig.types), function (type) { - return type.name; - }, sortNamedType); - return new GraphQLSchema(_objectSpread(_objectSpread({}, schemaConfig), {}, { - types: objectValues(typeMap), - directives: sortByName(schemaConfig.directives).map(sortDirective), - query: replaceMaybeType(schemaConfig.query), - mutation: replaceMaybeType(schemaConfig.mutation), - subscription: replaceMaybeType(schemaConfig.subscription) - })); - - function replaceType(type) { - if (isListType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLList(replaceType(type.ofType)); - } else if (isNonNullType(type)) { - // $FlowFixMe[incompatible-return] - return new GraphQLNonNull(replaceType(type.ofType)); - } - - return replaceNamedType(type); - } - - function replaceNamedType(type) { - return typeMap[type.name]; - } - - function replaceMaybeType(maybeType) { - return maybeType && replaceNamedType(maybeType); - } - - function sortDirective(directive) { - var config = directive.toConfig(); - return new GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, { - locations: sortBy(config.locations, function (x) { - return x; - }), - args: sortArgs(config.args) - })); - } - - function sortArgs(args) { - return sortObjMap(args, function (arg) { - return _objectSpread(_objectSpread({}, arg), {}, { - type: replaceType(arg.type) - }); - }); - } - - function sortFields(fieldsMap) { - return sortObjMap(fieldsMap, function (field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type), - args: sortArgs(field.args) - }); - }); - } - - function sortInputFields(fieldsMap) { - return sortObjMap(fieldsMap, function (field) { - return _objectSpread(_objectSpread({}, field), {}, { - type: replaceType(field.type) - }); - }); - } - - function sortTypes(arr) { - return sortByName(arr).map(replaceNamedType); - } - - function sortNamedType(type) { - if (isScalarType(type) || isIntrospectionType(type)) { - return type; - } - - if (isObjectType(type)) { - var config = type.toConfig(); - return new GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, { - interfaces: function interfaces() { - return sortTypes(config.interfaces); - }, - fields: function fields() { - return sortFields(config.fields); - } - })); - } - - if (isInterfaceType(type)) { - var _config = type.toConfig(); - - return new GraphQLInterfaceType(_objectSpread(_objectSpread({}, _config), {}, { - interfaces: function interfaces() { - return sortTypes(_config.interfaces); - }, - fields: function fields() { - return sortFields(_config.fields); - } - })); - } - - if (isUnionType(type)) { - var _config2 = type.toConfig(); - - return new GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, { - types: function types() { - return sortTypes(_config2.types); - } - })); - } - - if (isEnumType(type)) { - var _config3 = type.toConfig(); - - return new GraphQLEnumType(_objectSpread(_objectSpread({}, _config3), {}, { - values: sortObjMap(_config3.values) - })); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isInputObjectType(type)) { - var _config4 = type.toConfig(); - - return new GraphQLInputObjectType(_objectSpread(_objectSpread({}, _config4), {}, { - fields: function fields() { - return sortInputFields(_config4.fields); - } - })); - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected type: ' + inspect(type)); - } -} - -function sortObjMap(map, sortValueFn) { - var sortedMap = Object.create(null); - var sortedKeys = sortBy(Object.keys(map), function (x) { - return x; - }); - - for (var _i2 = 0; _i2 < sortedKeys.length; _i2++) { - var key = sortedKeys[_i2]; - var value = map[key]; - sortedMap[key] = sortValueFn ? sortValueFn(value) : value; - } - - return sortedMap; -} - -function sortByName(array) { - return sortBy(array, function (obj) { - return obj.name; - }); -} - -function sortBy(array, mapToKey) { - return array.slice().sort(function (obj1, obj2) { - var key1 = mapToKey(obj1); - var key2 = mapToKey(obj2); - return key1.localeCompare(key2); - }); -} diff --git a/node_modules/graphql/utilities/printSchema.d.ts b/node_modules/graphql/utilities/printSchema.d.ts deleted file mode 100644 index 1417ee58..00000000 --- a/node_modules/graphql/utilities/printSchema.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { GraphQLSchema } from '../type/schema'; -import { GraphQLNamedType } from '../type/definition'; - -export interface Options { - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * This option is provided to ease adoption and will be removed in v16. - * - * Default: false - */ - commentDescriptions?: boolean; -} - -/** - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function printSchema(schema: GraphQLSchema, options?: Options): string; - -export function printIntrospectionSchema( - schema: GraphQLSchema, - options?: Options, -): string; - -export function printType(type: GraphQLNamedType, options?: Options): string; diff --git a/node_modules/graphql/utilities/printSchema.js b/node_modules/graphql/utilities/printSchema.js deleted file mode 100644 index 3d6d6182..00000000 --- a/node_modules/graphql/utilities/printSchema.js +++ /dev/null @@ -1,289 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.printSchema = printSchema; -exports.printIntrospectionSchema = printIntrospectionSchema; -exports.printType = printType; - -var _objectValues = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _printer = require("../language/printer.js"); - -var _blockString = require("../language/blockString.js"); - -var _introspection = require("../type/introspection.js"); - -var _scalars = require("../type/scalars.js"); - -var _directives = require("../type/directives.js"); - -var _definition = require("../type/definition.js"); - -var _astFromValue = require("./astFromValue.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -function printSchema(schema, options) { - return printFilteredSchema(schema, function (n) { - return !(0, _directives.isSpecifiedDirective)(n); - }, isDefinedType, options); -} - -function printIntrospectionSchema(schema, options) { - return printFilteredSchema(schema, _directives.isSpecifiedDirective, _introspection.isIntrospectionType, options); -} - -function isDefinedType(type) { - return !(0, _scalars.isSpecifiedScalarType)(type) && !(0, _introspection.isIntrospectionType)(type); -} - -function printFilteredSchema(schema, directiveFilter, typeFilter, options) { - var directives = schema.getDirectives().filter(directiveFilter); - var types = (0, _objectValues.default)(schema.getTypeMap()).filter(typeFilter); - return [printSchemaDefinition(schema)].concat(directives.map(function (directive) { - return printDirective(directive, options); - }), types.map(function (type) { - return printType(type, options); - })).filter(Boolean).join('\n\n') + '\n'; -} - -function printSchemaDefinition(schema) { - if (schema.description == null && isSchemaOfCommonNames(schema)) { - return; - } - - var operationTypes = []; - var queryType = schema.getQueryType(); - - if (queryType) { - operationTypes.push(" query: ".concat(queryType.name)); - } - - var mutationType = schema.getMutationType(); - - if (mutationType) { - operationTypes.push(" mutation: ".concat(mutationType.name)); - } - - var subscriptionType = schema.getSubscriptionType(); - - if (subscriptionType) { - operationTypes.push(" subscription: ".concat(subscriptionType.name)); - } - - return printDescription({}, schema) + "schema {\n".concat(operationTypes.join('\n'), "\n}"); -} -/** - * GraphQL schema define root types for each type of operation. These types are - * the same as any other type and can be named in any manner, however there is - * a common naming convention: - * - * schema { - * query: Query - * mutation: Mutation - * } - * - * When using this naming convention, the schema description can be omitted. - */ - - -function isSchemaOfCommonNames(schema) { - var queryType = schema.getQueryType(); - - if (queryType && queryType.name !== 'Query') { - return false; - } - - var mutationType = schema.getMutationType(); - - if (mutationType && mutationType.name !== 'Mutation') { - return false; - } - - var subscriptionType = schema.getSubscriptionType(); - - if (subscriptionType && subscriptionType.name !== 'Subscription') { - return false; - } - - return true; -} - -function printType(type, options) { - if ((0, _definition.isScalarType)(type)) { - return printScalar(type, options); - } - - if ((0, _definition.isObjectType)(type)) { - return printObject(type, options); - } - - if ((0, _definition.isInterfaceType)(type)) { - return printInterface(type, options); - } - - if ((0, _definition.isUnionType)(type)) { - return printUnion(type, options); - } - - if ((0, _definition.isEnumType)(type)) { - return printEnum(type, options); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isInputObjectType)(type)) { - return printInputObject(type, options); - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); -} - -function printScalar(type, options) { - return printDescription(options, type) + "scalar ".concat(type.name) + printSpecifiedByUrl(type); -} - -function printImplementedInterfaces(type) { - var interfaces = type.getInterfaces(); - return interfaces.length ? ' implements ' + interfaces.map(function (i) { - return i.name; - }).join(' & ') : ''; -} - -function printObject(type, options) { - return printDescription(options, type) + "type ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type); -} - -function printInterface(type, options) { - return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type); -} - -function printUnion(type, options) { - var types = type.getTypes(); - var possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; - return printDescription(options, type) + 'union ' + type.name + possibleTypes; -} - -function printEnum(type, options) { - var values = type.getValues().map(function (value, i) { - return printDescription(options, value, ' ', !i) + ' ' + value.name + printDeprecated(value.deprecationReason); - }); - return printDescription(options, type) + "enum ".concat(type.name) + printBlock(values); -} - -function printInputObject(type, options) { - var fields = (0, _objectValues.default)(type.getFields()).map(function (f, i) { - return printDescription(options, f, ' ', !i) + ' ' + printInputValue(f); - }); - return printDescription(options, type) + "input ".concat(type.name) + printBlock(fields); -} - -function printFields(options, type) { - var fields = (0, _objectValues.default)(type.getFields()).map(function (f, i) { - return printDescription(options, f, ' ', !i) + ' ' + f.name + printArgs(options, f.args, ' ') + ': ' + String(f.type) + printDeprecated(f.deprecationReason); - }); - return printBlock(fields); -} - -function printBlock(items) { - return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; -} - -function printArgs(options, args) { - var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - - if (args.length === 0) { - return ''; - } // If every arg does not have a description, print them on one line. - - - if (args.every(function (arg) { - return !arg.description; - })) { - return '(' + args.map(printInputValue).join(', ') + ')'; - } - - return '(\n' + args.map(function (arg, i) { - return printDescription(options, arg, ' ' + indentation, !i) + ' ' + indentation + printInputValue(arg); - }).join('\n') + '\n' + indentation + ')'; -} - -function printInputValue(arg) { - var defaultAST = (0, _astFromValue.astFromValue)(arg.defaultValue, arg.type); - var argDecl = arg.name + ': ' + String(arg.type); - - if (defaultAST) { - argDecl += " = ".concat((0, _printer.print)(defaultAST)); - } - - return argDecl + printDeprecated(arg.deprecationReason); -} - -function printDirective(directive, options) { - return printDescription(options, directive) + 'directive @' + directive.name + printArgs(options, directive.args) + (directive.isRepeatable ? ' repeatable' : '') + ' on ' + directive.locations.join(' | '); -} - -function printDeprecated(reason) { - if (reason == null) { - return ''; - } - - var reasonAST = (0, _astFromValue.astFromValue)(reason, _scalars.GraphQLString); - - if (reasonAST && reason !== _directives.DEFAULT_DEPRECATION_REASON) { - return ' @deprecated(reason: ' + (0, _printer.print)(reasonAST) + ')'; - } - - return ' @deprecated'; -} - -function printSpecifiedByUrl(scalar) { - if (scalar.specifiedByUrl == null) { - return ''; - } - - var url = scalar.specifiedByUrl; - var urlAST = (0, _astFromValue.astFromValue)(url, _scalars.GraphQLString); - urlAST || (0, _invariant.default)(0, 'Unexpected null value returned from `astFromValue` for specifiedByUrl'); - return ' @specifiedBy(url: ' + (0, _printer.print)(urlAST) + ')'; -} - -function printDescription(options, def) { - var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - var firstInBlock = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; - var description = def.description; - - if (description == null) { - return ''; - } - - if ((options === null || options === void 0 ? void 0 : options.commentDescriptions) === true) { - return printDescriptionWithComments(description, indentation, firstInBlock); - } - - var preferMultipleLines = description.length > 70; - var blockString = (0, _blockString.printBlockString)(description, '', preferMultipleLines); - var prefix = indentation && !firstInBlock ? '\n' + indentation : indentation; - return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; -} - -function printDescriptionWithComments(description, indentation, firstInBlock) { - var prefix = indentation && !firstInBlock ? '\n' : ''; - var comment = description.split('\n').map(function (line) { - return indentation + (line !== '' ? '# ' + line : '#'); - }).join('\n'); - return prefix + comment + '\n'; -} diff --git a/node_modules/graphql/utilities/printSchema.js.flow b/node_modules/graphql/utilities/printSchema.js.flow deleted file mode 100644 index a240a3e9..00000000 --- a/node_modules/graphql/utilities/printSchema.js.flow +++ /dev/null @@ -1,382 +0,0 @@ -// @flow strict -import objectValues from '../polyfills/objectValues'; - -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; - -import { print } from '../language/printer'; -import { printBlockString } from '../language/blockString'; - -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLDirective } from '../type/directives'; -import type { - GraphQLNamedType, - GraphQLArgument, - GraphQLInputField, - GraphQLScalarType, - GraphQLEnumType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLInputObjectType, -} from '../type/definition'; -import { isIntrospectionType } from '../type/introspection'; -import { GraphQLString, isSpecifiedScalarType } from '../type/scalars'; -import { - DEFAULT_DEPRECATION_REASON, - isSpecifiedDirective, -} from '../type/directives'; -import { - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, -} from '../type/definition'; - -import { astFromValue } from './astFromValue'; - -type Options = {| - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * This option is provided to ease adoption and will be removed in v16. - * - * Default: false - */ - commentDescriptions?: boolean, -|}; - -/** - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function printSchema(schema: GraphQLSchema, options?: Options): string { - return printFilteredSchema( - schema, - (n) => !isSpecifiedDirective(n), - isDefinedType, - options, - ); -} - -export function printIntrospectionSchema( - schema: GraphQLSchema, - options?: Options, -): string { - return printFilteredSchema( - schema, - isSpecifiedDirective, - isIntrospectionType, - options, - ); -} - -function isDefinedType(type: GraphQLNamedType): boolean { - return !isSpecifiedScalarType(type) && !isIntrospectionType(type); -} - -function printFilteredSchema( - schema: GraphQLSchema, - directiveFilter: (type: GraphQLDirective) => boolean, - typeFilter: (type: GraphQLNamedType) => boolean, - options, -): string { - const directives = schema.getDirectives().filter(directiveFilter); - const types = objectValues(schema.getTypeMap()).filter(typeFilter); - - return ( - [printSchemaDefinition(schema)] - .concat( - directives.map((directive) => printDirective(directive, options)), - types.map((type) => printType(type, options)), - ) - .filter(Boolean) - .join('\n\n') + '\n' - ); -} - -function printSchemaDefinition(schema: GraphQLSchema): ?string { - if (schema.description == null && isSchemaOfCommonNames(schema)) { - return; - } - - const operationTypes = []; - - const queryType = schema.getQueryType(); - if (queryType) { - operationTypes.push(` query: ${queryType.name}`); - } - - const mutationType = schema.getMutationType(); - if (mutationType) { - operationTypes.push(` mutation: ${mutationType.name}`); - } - - const subscriptionType = schema.getSubscriptionType(); - if (subscriptionType) { - operationTypes.push(` subscription: ${subscriptionType.name}`); - } - - return ( - printDescription({}, schema) + `schema {\n${operationTypes.join('\n')}\n}` - ); -} - -/** - * GraphQL schema define root types for each type of operation. These types are - * the same as any other type and can be named in any manner, however there is - * a common naming convention: - * - * schema { - * query: Query - * mutation: Mutation - * } - * - * When using this naming convention, the schema description can be omitted. - */ -function isSchemaOfCommonNames(schema: GraphQLSchema): boolean { - const queryType = schema.getQueryType(); - if (queryType && queryType.name !== 'Query') { - return false; - } - - const mutationType = schema.getMutationType(); - if (mutationType && mutationType.name !== 'Mutation') { - return false; - } - - const subscriptionType = schema.getSubscriptionType(); - if (subscriptionType && subscriptionType.name !== 'Subscription') { - return false; - } - - return true; -} - -export function printType(type: GraphQLNamedType, options?: Options): string { - if (isScalarType(type)) { - return printScalar(type, options); - } - if (isObjectType(type)) { - return printObject(type, options); - } - if (isInterfaceType(type)) { - return printInterface(type, options); - } - if (isUnionType(type)) { - return printUnion(type, options); - } - if (isEnumType(type)) { - return printEnum(type, options); - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isInputObjectType(type)) { - return printInputObject(type, options); - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected type: ' + inspect((type: empty))); -} - -function printScalar(type: GraphQLScalarType, options): string { - return ( - printDescription(options, type) + - `scalar ${type.name}` + - printSpecifiedByUrl(type) - ); -} - -function printImplementedInterfaces( - type: GraphQLObjectType | GraphQLInterfaceType, -): string { - const interfaces = type.getInterfaces(); - return interfaces.length - ? ' implements ' + interfaces.map((i) => i.name).join(' & ') - : ''; -} - -function printObject(type: GraphQLObjectType, options): string { - return ( - printDescription(options, type) + - `type ${type.name}` + - printImplementedInterfaces(type) + - printFields(options, type) - ); -} - -function printInterface(type: GraphQLInterfaceType, options): string { - return ( - printDescription(options, type) + - `interface ${type.name}` + - printImplementedInterfaces(type) + - printFields(options, type) - ); -} - -function printUnion(type: GraphQLUnionType, options): string { - const types = type.getTypes(); - const possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; - return printDescription(options, type) + 'union ' + type.name + possibleTypes; -} - -function printEnum(type: GraphQLEnumType, options): string { - const values = type - .getValues() - .map( - (value, i) => - printDescription(options, value, ' ', !i) + - ' ' + - value.name + - printDeprecated(value.deprecationReason), - ); - - return ( - printDescription(options, type) + `enum ${type.name}` + printBlock(values) - ); -} - -function printInputObject(type: GraphQLInputObjectType, options): string { - const fields = objectValues(type.getFields()).map( - (f, i) => - printDescription(options, f, ' ', !i) + ' ' + printInputValue(f), - ); - return ( - printDescription(options, type) + `input ${type.name}` + printBlock(fields) - ); -} - -function printFields( - options, - type: GraphQLObjectType | GraphQLInterfaceType, -): string { - const fields = objectValues(type.getFields()).map( - (f, i) => - printDescription(options, f, ' ', !i) + - ' ' + - f.name + - printArgs(options, f.args, ' ') + - ': ' + - String(f.type) + - printDeprecated(f.deprecationReason), - ); - return printBlock(fields); -} - -function printBlock(items: $ReadOnlyArray): string { - return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; -} - -function printArgs( - options, - args: Array, - indentation: string = '', -): string { - if (args.length === 0) { - return ''; - } - - // If every arg does not have a description, print them on one line. - if (args.every((arg) => !arg.description)) { - return '(' + args.map(printInputValue).join(', ') + ')'; - } - - return ( - '(\n' + - args - .map( - (arg, i) => - printDescription(options, arg, ' ' + indentation, !i) + - ' ' + - indentation + - printInputValue(arg), - ) - .join('\n') + - '\n' + - indentation + - ')' - ); -} - -function printInputValue(arg: GraphQLInputField): string { - const defaultAST = astFromValue(arg.defaultValue, arg.type); - let argDecl = arg.name + ': ' + String(arg.type); - if (defaultAST) { - argDecl += ` = ${print(defaultAST)}`; - } - return argDecl + printDeprecated(arg.deprecationReason); -} - -function printDirective(directive: GraphQLDirective, options): string { - return ( - printDescription(options, directive) + - 'directive @' + - directive.name + - printArgs(options, directive.args) + - (directive.isRepeatable ? ' repeatable' : '') + - ' on ' + - directive.locations.join(' | ') - ); -} - -function printDeprecated(reason: ?string): string { - if (reason == null) { - return ''; - } - const reasonAST = astFromValue(reason, GraphQLString); - if (reasonAST && reason !== DEFAULT_DEPRECATION_REASON) { - return ' @deprecated(reason: ' + print(reasonAST) + ')'; - } - return ' @deprecated'; -} - -function printSpecifiedByUrl(scalar: GraphQLScalarType): string { - if (scalar.specifiedByUrl == null) { - return ''; - } - const url = scalar.specifiedByUrl; - const urlAST = astFromValue(url, GraphQLString); - invariant( - urlAST, - 'Unexpected null value returned from `astFromValue` for specifiedByUrl', - ); - return ' @specifiedBy(url: ' + print(urlAST) + ')'; -} - -function printDescription( - options, - def: { +description: ?string, ... }, - indentation: string = '', - firstInBlock: boolean = true, -): string { - const { description } = def; - if (description == null) { - return ''; - } - - if (options?.commentDescriptions === true) { - return printDescriptionWithComments(description, indentation, firstInBlock); - } - - const preferMultipleLines = description.length > 70; - const blockString = printBlockString(description, '', preferMultipleLines); - const prefix = - indentation && !firstInBlock ? '\n' + indentation : indentation; - - return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; -} - -function printDescriptionWithComments(description, indentation, firstInBlock) { - const prefix = indentation && !firstInBlock ? '\n' : ''; - const comment = description - .split('\n') - .map((line) => indentation + (line !== '' ? '# ' + line : '#')) - .join('\n'); - - return prefix + comment + '\n'; -} diff --git a/node_modules/graphql/utilities/printSchema.mjs b/node_modules/graphql/utilities/printSchema.mjs deleted file mode 100644 index a34cec43..00000000 --- a/node_modules/graphql/utilities/printSchema.mjs +++ /dev/null @@ -1,268 +0,0 @@ -import objectValues from "../polyfills/objectValues.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import { print } from "../language/printer.mjs"; -import { printBlockString } from "../language/blockString.mjs"; -import { isIntrospectionType } from "../type/introspection.mjs"; -import { GraphQLString, isSpecifiedScalarType } from "../type/scalars.mjs"; -import { DEFAULT_DEPRECATION_REASON, isSpecifiedDirective } from "../type/directives.mjs"; -import { isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType } from "../type/definition.mjs"; -import { astFromValue } from "./astFromValue.mjs"; - -/** - * Accepts options as a second argument: - * - * - commentDescriptions: - * Provide true to use preceding comments as the description. - * - */ -export function printSchema(schema, options) { - return printFilteredSchema(schema, function (n) { - return !isSpecifiedDirective(n); - }, isDefinedType, options); -} -export function printIntrospectionSchema(schema, options) { - return printFilteredSchema(schema, isSpecifiedDirective, isIntrospectionType, options); -} - -function isDefinedType(type) { - return !isSpecifiedScalarType(type) && !isIntrospectionType(type); -} - -function printFilteredSchema(schema, directiveFilter, typeFilter, options) { - var directives = schema.getDirectives().filter(directiveFilter); - var types = objectValues(schema.getTypeMap()).filter(typeFilter); - return [printSchemaDefinition(schema)].concat(directives.map(function (directive) { - return printDirective(directive, options); - }), types.map(function (type) { - return printType(type, options); - })).filter(Boolean).join('\n\n') + '\n'; -} - -function printSchemaDefinition(schema) { - if (schema.description == null && isSchemaOfCommonNames(schema)) { - return; - } - - var operationTypes = []; - var queryType = schema.getQueryType(); - - if (queryType) { - operationTypes.push(" query: ".concat(queryType.name)); - } - - var mutationType = schema.getMutationType(); - - if (mutationType) { - operationTypes.push(" mutation: ".concat(mutationType.name)); - } - - var subscriptionType = schema.getSubscriptionType(); - - if (subscriptionType) { - operationTypes.push(" subscription: ".concat(subscriptionType.name)); - } - - return printDescription({}, schema) + "schema {\n".concat(operationTypes.join('\n'), "\n}"); -} -/** - * GraphQL schema define root types for each type of operation. These types are - * the same as any other type and can be named in any manner, however there is - * a common naming convention: - * - * schema { - * query: Query - * mutation: Mutation - * } - * - * When using this naming convention, the schema description can be omitted. - */ - - -function isSchemaOfCommonNames(schema) { - var queryType = schema.getQueryType(); - - if (queryType && queryType.name !== 'Query') { - return false; - } - - var mutationType = schema.getMutationType(); - - if (mutationType && mutationType.name !== 'Mutation') { - return false; - } - - var subscriptionType = schema.getSubscriptionType(); - - if (subscriptionType && subscriptionType.name !== 'Subscription') { - return false; - } - - return true; -} - -export function printType(type, options) { - if (isScalarType(type)) { - return printScalar(type, options); - } - - if (isObjectType(type)) { - return printObject(type, options); - } - - if (isInterfaceType(type)) { - return printInterface(type, options); - } - - if (isUnionType(type)) { - return printUnion(type, options); - } - - if (isEnumType(type)) { - return printEnum(type, options); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isInputObjectType(type)) { - return printInputObject(type, options); - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected type: ' + inspect(type)); -} - -function printScalar(type, options) { - return printDescription(options, type) + "scalar ".concat(type.name) + printSpecifiedByUrl(type); -} - -function printImplementedInterfaces(type) { - var interfaces = type.getInterfaces(); - return interfaces.length ? ' implements ' + interfaces.map(function (i) { - return i.name; - }).join(' & ') : ''; -} - -function printObject(type, options) { - return printDescription(options, type) + "type ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type); -} - -function printInterface(type, options) { - return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type); -} - -function printUnion(type, options) { - var types = type.getTypes(); - var possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; - return printDescription(options, type) + 'union ' + type.name + possibleTypes; -} - -function printEnum(type, options) { - var values = type.getValues().map(function (value, i) { - return printDescription(options, value, ' ', !i) + ' ' + value.name + printDeprecated(value.deprecationReason); - }); - return printDescription(options, type) + "enum ".concat(type.name) + printBlock(values); -} - -function printInputObject(type, options) { - var fields = objectValues(type.getFields()).map(function (f, i) { - return printDescription(options, f, ' ', !i) + ' ' + printInputValue(f); - }); - return printDescription(options, type) + "input ".concat(type.name) + printBlock(fields); -} - -function printFields(options, type) { - var fields = objectValues(type.getFields()).map(function (f, i) { - return printDescription(options, f, ' ', !i) + ' ' + f.name + printArgs(options, f.args, ' ') + ': ' + String(f.type) + printDeprecated(f.deprecationReason); - }); - return printBlock(fields); -} - -function printBlock(items) { - return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; -} - -function printArgs(options, args) { - var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - - if (args.length === 0) { - return ''; - } // If every arg does not have a description, print them on one line. - - - if (args.every(function (arg) { - return !arg.description; - })) { - return '(' + args.map(printInputValue).join(', ') + ')'; - } - - return '(\n' + args.map(function (arg, i) { - return printDescription(options, arg, ' ' + indentation, !i) + ' ' + indentation + printInputValue(arg); - }).join('\n') + '\n' + indentation + ')'; -} - -function printInputValue(arg) { - var defaultAST = astFromValue(arg.defaultValue, arg.type); - var argDecl = arg.name + ': ' + String(arg.type); - - if (defaultAST) { - argDecl += " = ".concat(print(defaultAST)); - } - - return argDecl + printDeprecated(arg.deprecationReason); -} - -function printDirective(directive, options) { - return printDescription(options, directive) + 'directive @' + directive.name + printArgs(options, directive.args) + (directive.isRepeatable ? ' repeatable' : '') + ' on ' + directive.locations.join(' | '); -} - -function printDeprecated(reason) { - if (reason == null) { - return ''; - } - - var reasonAST = astFromValue(reason, GraphQLString); - - if (reasonAST && reason !== DEFAULT_DEPRECATION_REASON) { - return ' @deprecated(reason: ' + print(reasonAST) + ')'; - } - - return ' @deprecated'; -} - -function printSpecifiedByUrl(scalar) { - if (scalar.specifiedByUrl == null) { - return ''; - } - - var url = scalar.specifiedByUrl; - var urlAST = astFromValue(url, GraphQLString); - urlAST || invariant(0, 'Unexpected null value returned from `astFromValue` for specifiedByUrl'); - return ' @specifiedBy(url: ' + print(urlAST) + ')'; -} - -function printDescription(options, def) { - var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - var firstInBlock = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; - var description = def.description; - - if (description == null) { - return ''; - } - - if ((options === null || options === void 0 ? void 0 : options.commentDescriptions) === true) { - return printDescriptionWithComments(description, indentation, firstInBlock); - } - - var preferMultipleLines = description.length > 70; - var blockString = printBlockString(description, '', preferMultipleLines); - var prefix = indentation && !firstInBlock ? '\n' + indentation : indentation; - return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; -} - -function printDescriptionWithComments(description, indentation, firstInBlock) { - var prefix = indentation && !firstInBlock ? '\n' : ''; - var comment = description.split('\n').map(function (line) { - return indentation + (line !== '' ? '# ' + line : '#'); - }).join('\n'); - return prefix + comment + '\n'; -} diff --git a/node_modules/graphql/utilities/separateOperations.d.ts b/node_modules/graphql/utilities/separateOperations.d.ts deleted file mode 100644 index 28654fdb..00000000 --- a/node_modules/graphql/utilities/separateOperations.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { DocumentNode } from '../language/ast'; - -/** - * separateOperations accepts a single AST document which may contain many - * operations and fragments and returns a collection of AST documents each of - * which contains a single operation as well the fragment definitions it - * refers to. - */ -export function separateOperations( - documentAST: DocumentNode, -): { [key: string]: DocumentNode }; diff --git a/node_modules/graphql/utilities/separateOperations.js b/node_modules/graphql/utilities/separateOperations.js deleted file mode 100644 index 4b3cfbc1..00000000 --- a/node_modules/graphql/utilities/separateOperations.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.separateOperations = separateOperations; - -var _kinds = require("../language/kinds.js"); - -var _visitor = require("../language/visitor.js"); - -/** - * separateOperations accepts a single AST document which may contain many - * operations and fragments and returns a collection of AST documents each of - * which contains a single operation as well the fragment definitions it - * refers to. - */ -function separateOperations(documentAST) { - var operations = []; - var depGraph = Object.create(null); - var fromName; // Populate metadata and build a dependency graph. - - (0, _visitor.visit)(documentAST, { - OperationDefinition: function OperationDefinition(node) { - fromName = opName(node); - operations.push(node); - }, - FragmentDefinition: function FragmentDefinition(node) { - fromName = node.name.value; - }, - FragmentSpread: function FragmentSpread(node) { - var toName = node.name.value; - var dependents = depGraph[fromName]; - - if (dependents === undefined) { - dependents = depGraph[fromName] = Object.create(null); - } - - dependents[toName] = true; - } - }); // For each operation, produce a new synthesized AST which includes only what - // is necessary for completing that operation. - - var separatedDocumentASTs = Object.create(null); - - var _loop = function _loop(_i2) { - var operation = operations[_i2]; - var operationName = opName(operation); - var dependencies = Object.create(null); - collectTransitiveDependencies(dependencies, depGraph, operationName); // The list of definition nodes to be included for this operation, sorted - // to retain the same order as the original document. - - separatedDocumentASTs[operationName] = { - kind: _kinds.Kind.DOCUMENT, - definitions: documentAST.definitions.filter(function (node) { - return node === operation || node.kind === _kinds.Kind.FRAGMENT_DEFINITION && dependencies[node.name.value]; - }) - }; - }; - - for (var _i2 = 0; _i2 < operations.length; _i2++) { - _loop(_i2); - } - - return separatedDocumentASTs; -} - -// Provides the empty string for anonymous operations. -function opName(operation) { - return operation.name ? operation.name.value : ''; -} // From a dependency graph, collects a list of transitive dependencies by -// recursing through a dependency graph. - - -function collectTransitiveDependencies(collected, depGraph, fromName) { - var immediateDeps = depGraph[fromName]; - - if (immediateDeps) { - for (var _i4 = 0, _Object$keys2 = Object.keys(immediateDeps); _i4 < _Object$keys2.length; _i4++) { - var toName = _Object$keys2[_i4]; - - if (!collected[toName]) { - collected[toName] = true; - collectTransitiveDependencies(collected, depGraph, toName); - } - } - } -} diff --git a/node_modules/graphql/utilities/separateOperations.js.flow b/node_modules/graphql/utilities/separateOperations.js.flow deleted file mode 100644 index 286e4354..00000000 --- a/node_modules/graphql/utilities/separateOperations.js.flow +++ /dev/null @@ -1,87 +0,0 @@ -// @flow strict -import type { ObjMap } from '../jsutils/ObjMap'; - -import type { DocumentNode, OperationDefinitionNode } from '../language/ast'; -import { Kind } from '../language/kinds'; -import { visit } from '../language/visitor'; - -/** - * separateOperations accepts a single AST document which may contain many - * operations and fragments and returns a collection of AST documents each of - * which contains a single operation as well the fragment definitions it - * refers to. - */ -export function separateOperations( - documentAST: DocumentNode, -): ObjMap { - const operations = []; - const depGraph: DepGraph = Object.create(null); - let fromName; - - // Populate metadata and build a dependency graph. - visit(documentAST, { - OperationDefinition(node) { - fromName = opName(node); - operations.push(node); - }, - FragmentDefinition(node) { - fromName = node.name.value; - }, - FragmentSpread(node) { - const toName = node.name.value; - let dependents = depGraph[fromName]; - if (dependents === undefined) { - dependents = depGraph[fromName] = Object.create(null); - } - dependents[toName] = true; - }, - }); - - // For each operation, produce a new synthesized AST which includes only what - // is necessary for completing that operation. - const separatedDocumentASTs = Object.create(null); - for (const operation of operations) { - const operationName = opName(operation); - const dependencies = Object.create(null); - collectTransitiveDependencies(dependencies, depGraph, operationName); - - // The list of definition nodes to be included for this operation, sorted - // to retain the same order as the original document. - separatedDocumentASTs[operationName] = { - kind: Kind.DOCUMENT, - definitions: documentAST.definitions.filter( - (node) => - node === operation || - (node.kind === Kind.FRAGMENT_DEFINITION && - dependencies[node.name.value]), - ), - }; - } - - return separatedDocumentASTs; -} - -type DepGraph = ObjMap>; - -// Provides the empty string for anonymous operations. -function opName(operation: OperationDefinitionNode): string { - return operation.name ? operation.name.value : ''; -} - -// From a dependency graph, collects a list of transitive dependencies by -// recursing through a dependency graph. -function collectTransitiveDependencies( - collected: ObjMap, - depGraph: DepGraph, - fromName: string, -): void { - const immediateDeps = depGraph[fromName]; - if (immediateDeps) { - for (const toName of Object.keys(immediateDeps)) { - if (!collected[toName]) { - collected[toName] = true; - collectTransitiveDependencies(collected, depGraph, toName); - } - } - } -} diff --git a/node_modules/graphql/utilities/separateOperations.mjs b/node_modules/graphql/utilities/separateOperations.mjs deleted file mode 100644 index e657debb..00000000 --- a/node_modules/graphql/utilities/separateOperations.mjs +++ /dev/null @@ -1,80 +0,0 @@ -import { Kind } from "../language/kinds.mjs"; -import { visit } from "../language/visitor.mjs"; -/** - * separateOperations accepts a single AST document which may contain many - * operations and fragments and returns a collection of AST documents each of - * which contains a single operation as well the fragment definitions it - * refers to. - */ - -export function separateOperations(documentAST) { - var operations = []; - var depGraph = Object.create(null); - var fromName; // Populate metadata and build a dependency graph. - - visit(documentAST, { - OperationDefinition: function OperationDefinition(node) { - fromName = opName(node); - operations.push(node); - }, - FragmentDefinition: function FragmentDefinition(node) { - fromName = node.name.value; - }, - FragmentSpread: function FragmentSpread(node) { - var toName = node.name.value; - var dependents = depGraph[fromName]; - - if (dependents === undefined) { - dependents = depGraph[fromName] = Object.create(null); - } - - dependents[toName] = true; - } - }); // For each operation, produce a new synthesized AST which includes only what - // is necessary for completing that operation. - - var separatedDocumentASTs = Object.create(null); - - var _loop = function _loop(_i2) { - var operation = operations[_i2]; - var operationName = opName(operation); - var dependencies = Object.create(null); - collectTransitiveDependencies(dependencies, depGraph, operationName); // The list of definition nodes to be included for this operation, sorted - // to retain the same order as the original document. - - separatedDocumentASTs[operationName] = { - kind: Kind.DOCUMENT, - definitions: documentAST.definitions.filter(function (node) { - return node === operation || node.kind === Kind.FRAGMENT_DEFINITION && dependencies[node.name.value]; - }) - }; - }; - - for (var _i2 = 0; _i2 < operations.length; _i2++) { - _loop(_i2); - } - - return separatedDocumentASTs; -} - -// Provides the empty string for anonymous operations. -function opName(operation) { - return operation.name ? operation.name.value : ''; -} // From a dependency graph, collects a list of transitive dependencies by -// recursing through a dependency graph. - - -function collectTransitiveDependencies(collected, depGraph, fromName) { - var immediateDeps = depGraph[fromName]; - - if (immediateDeps) { - for (var _i4 = 0, _Object$keys2 = Object.keys(immediateDeps); _i4 < _Object$keys2.length; _i4++) { - var toName = _Object$keys2[_i4]; - - if (!collected[toName]) { - collected[toName] = true; - collectTransitiveDependencies(collected, depGraph, toName); - } - } - } -} diff --git a/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts b/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts deleted file mode 100644 index a131af02..00000000 --- a/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Source } from '../language/source'; - -/** - * Strips characters that are not significant to the validity or execution - * of a GraphQL document: - * - UnicodeBOM - * - WhiteSpace - * - LineTerminator - * - Comment - * - Comma - * - BlockString indentation - * - * Note: It is required to have a delimiter character between neighboring - * non-punctuator tokens and this function always uses single space as delimiter. - * - * It is guaranteed that both input and output documents if parsed would result - * in the exact same AST except for nodes location. - * - * Warning: It is guaranteed that this function will always produce stable results. - * However, it's not guaranteed that it will stay the same between different - * releases due to bugfixes or changes in the GraphQL specification. - * - * Query example: - * - * query SomeQuery($foo: String!, $bar: String) { - * someField(foo: $foo, bar: $bar) { - * a - * b { - * c - * d - * } - * } - * } - * - * Becomes: - * - * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} - * - * SDL example: - * - * """ - * Type description - * """ - * type Foo { - * """ - * Field description - * """ - * bar: String - * } - * - * Becomes: - * - * """Type description""" type Foo{"""Field description""" bar:String} - */ -export function stripIgnoredCharacters(source: string | Source): string; diff --git a/node_modules/graphql/utilities/stripIgnoredCharacters.js b/node_modules/graphql/utilities/stripIgnoredCharacters.js deleted file mode 100644 index aac5ddcf..00000000 --- a/node_modules/graphql/utilities/stripIgnoredCharacters.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.stripIgnoredCharacters = stripIgnoredCharacters; - -var _source = require("../language/source.js"); - -var _tokenKind = require("../language/tokenKind.js"); - -var _lexer = require("../language/lexer.js"); - -var _blockString = require("../language/blockString.js"); - -/** - * Strips characters that are not significant to the validity or execution - * of a GraphQL document: - * - UnicodeBOM - * - WhiteSpace - * - LineTerminator - * - Comment - * - Comma - * - BlockString indentation - * - * Note: It is required to have a delimiter character between neighboring - * non-punctuator tokens and this function always uses single space as delimiter. - * - * It is guaranteed that both input and output documents if parsed would result - * in the exact same AST except for nodes location. - * - * Warning: It is guaranteed that this function will always produce stable results. - * However, it's not guaranteed that it will stay the same between different - * releases due to bugfixes or changes in the GraphQL specification. - * - * Query example: - * - * query SomeQuery($foo: String!, $bar: String) { - * someField(foo: $foo, bar: $bar) { - * a - * b { - * c - * d - * } - * } - * } - * - * Becomes: - * - * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} - * - * SDL example: - * - * """ - * Type description - * """ - * type Foo { - * """ - * Field description - * """ - * bar: String - * } - * - * Becomes: - * - * """Type description""" type Foo{"""Field description""" bar:String} - */ -function stripIgnoredCharacters(source) { - var sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source); - var body = sourceObj.body; - var lexer = new _lexer.Lexer(sourceObj); - var strippedBody = ''; - var wasLastAddedTokenNonPunctuator = false; - - while (lexer.advance().kind !== _tokenKind.TokenKind.EOF) { - var currentToken = lexer.token; - var tokenKind = currentToken.kind; - /** - * Every two non-punctuator tokens should have space between them. - * Also prevent case of non-punctuator token following by spread resulting - * in invalid token (e.g. `1...` is invalid Float token). - */ - - var isNonPunctuator = !(0, _lexer.isPunctuatorTokenKind)(currentToken.kind); - - if (wasLastAddedTokenNonPunctuator) { - if (isNonPunctuator || currentToken.kind === _tokenKind.TokenKind.SPREAD) { - strippedBody += ' '; - } - } - - var tokenBody = body.slice(currentToken.start, currentToken.end); - - if (tokenKind === _tokenKind.TokenKind.BLOCK_STRING) { - strippedBody += dedentBlockString(tokenBody); - } else { - strippedBody += tokenBody; - } - - wasLastAddedTokenNonPunctuator = isNonPunctuator; - } - - return strippedBody; -} - -function dedentBlockString(blockStr) { - // skip leading and trailing triple quotations - var rawStr = blockStr.slice(3, -3); - var body = (0, _blockString.dedentBlockStringValue)(rawStr); - - if ((0, _blockString.getBlockStringIndentation)(body) > 0) { - body = '\n' + body; - } - - var lastChar = body[body.length - 1]; - var hasTrailingQuote = lastChar === '"' && body.slice(-4) !== '\\"""'; - - if (hasTrailingQuote || lastChar === '\\') { - body += '\n'; - } - - return '"""' + body + '"""'; -} diff --git a/node_modules/graphql/utilities/stripIgnoredCharacters.js.flow b/node_modules/graphql/utilities/stripIgnoredCharacters.js.flow deleted file mode 100644 index a5a6aa92..00000000 --- a/node_modules/graphql/utilities/stripIgnoredCharacters.js.flow +++ /dev/null @@ -1,115 +0,0 @@ -// @flow strict -import { Source, isSource } from '../language/source'; -import { TokenKind } from '../language/tokenKind'; -import { Lexer, isPunctuatorTokenKind } from '../language/lexer'; -import { - dedentBlockStringValue, - getBlockStringIndentation, -} from '../language/blockString'; - -/** - * Strips characters that are not significant to the validity or execution - * of a GraphQL document: - * - UnicodeBOM - * - WhiteSpace - * - LineTerminator - * - Comment - * - Comma - * - BlockString indentation - * - * Note: It is required to have a delimiter character between neighboring - * non-punctuator tokens and this function always uses single space as delimiter. - * - * It is guaranteed that both input and output documents if parsed would result - * in the exact same AST except for nodes location. - * - * Warning: It is guaranteed that this function will always produce stable results. - * However, it's not guaranteed that it will stay the same between different - * releases due to bugfixes or changes in the GraphQL specification. - * - * Query example: - * - * query SomeQuery($foo: String!, $bar: String) { - * someField(foo: $foo, bar: $bar) { - * a - * b { - * c - * d - * } - * } - * } - * - * Becomes: - * - * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} - * - * SDL example: - * - * """ - * Type description - * """ - * type Foo { - * """ - * Field description - * """ - * bar: String - * } - * - * Becomes: - * - * """Type description""" type Foo{"""Field description""" bar:String} - */ -export function stripIgnoredCharacters(source: string | Source): string { - const sourceObj = isSource(source) ? source : new Source(source); - - const body = sourceObj.body; - const lexer = new Lexer(sourceObj); - let strippedBody = ''; - - let wasLastAddedTokenNonPunctuator = false; - while (lexer.advance().kind !== TokenKind.EOF) { - const currentToken = lexer.token; - const tokenKind = currentToken.kind; - - /** - * Every two non-punctuator tokens should have space between them. - * Also prevent case of non-punctuator token following by spread resulting - * in invalid token (e.g. `1...` is invalid Float token). - */ - const isNonPunctuator = !isPunctuatorTokenKind(currentToken.kind); - if (wasLastAddedTokenNonPunctuator) { - if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) { - strippedBody += ' '; - } - } - - const tokenBody = body.slice(currentToken.start, currentToken.end); - if (tokenKind === TokenKind.BLOCK_STRING) { - strippedBody += dedentBlockString(tokenBody); - } else { - strippedBody += tokenBody; - } - - wasLastAddedTokenNonPunctuator = isNonPunctuator; - } - - return strippedBody; -} - -function dedentBlockString(blockStr: string): string { - // skip leading and trailing triple quotations - const rawStr = blockStr.slice(3, -3); - let body = dedentBlockStringValue(rawStr); - - if (getBlockStringIndentation(body) > 0) { - body = '\n' + body; - } - - const lastChar = body[body.length - 1]; - const hasTrailingQuote = lastChar === '"' && body.slice(-4) !== '\\"""'; - if (hasTrailingQuote || lastChar === '\\') { - body += '\n'; - } - - return '"""' + body + '"""'; -} diff --git a/node_modules/graphql/utilities/stripIgnoredCharacters.mjs b/node_modules/graphql/utilities/stripIgnoredCharacters.mjs deleted file mode 100644 index a0a07586..00000000 --- a/node_modules/graphql/utilities/stripIgnoredCharacters.mjs +++ /dev/null @@ -1,113 +0,0 @@ -import { Source, isSource } from "../language/source.mjs"; -import { TokenKind } from "../language/tokenKind.mjs"; -import { Lexer, isPunctuatorTokenKind } from "../language/lexer.mjs"; -import { dedentBlockStringValue, getBlockStringIndentation } from "../language/blockString.mjs"; -/** - * Strips characters that are not significant to the validity or execution - * of a GraphQL document: - * - UnicodeBOM - * - WhiteSpace - * - LineTerminator - * - Comment - * - Comma - * - BlockString indentation - * - * Note: It is required to have a delimiter character between neighboring - * non-punctuator tokens and this function always uses single space as delimiter. - * - * It is guaranteed that both input and output documents if parsed would result - * in the exact same AST except for nodes location. - * - * Warning: It is guaranteed that this function will always produce stable results. - * However, it's not guaranteed that it will stay the same between different - * releases due to bugfixes or changes in the GraphQL specification. - * - * Query example: - * - * query SomeQuery($foo: String!, $bar: String) { - * someField(foo: $foo, bar: $bar) { - * a - * b { - * c - * d - * } - * } - * } - * - * Becomes: - * - * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} - * - * SDL example: - * - * """ - * Type description - * """ - * type Foo { - * """ - * Field description - * """ - * bar: String - * } - * - * Becomes: - * - * """Type description""" type Foo{"""Field description""" bar:String} - */ - -export function stripIgnoredCharacters(source) { - var sourceObj = isSource(source) ? source : new Source(source); - var body = sourceObj.body; - var lexer = new Lexer(sourceObj); - var strippedBody = ''; - var wasLastAddedTokenNonPunctuator = false; - - while (lexer.advance().kind !== TokenKind.EOF) { - var currentToken = lexer.token; - var tokenKind = currentToken.kind; - /** - * Every two non-punctuator tokens should have space between them. - * Also prevent case of non-punctuator token following by spread resulting - * in invalid token (e.g. `1...` is invalid Float token). - */ - - var isNonPunctuator = !isPunctuatorTokenKind(currentToken.kind); - - if (wasLastAddedTokenNonPunctuator) { - if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) { - strippedBody += ' '; - } - } - - var tokenBody = body.slice(currentToken.start, currentToken.end); - - if (tokenKind === TokenKind.BLOCK_STRING) { - strippedBody += dedentBlockString(tokenBody); - } else { - strippedBody += tokenBody; - } - - wasLastAddedTokenNonPunctuator = isNonPunctuator; - } - - return strippedBody; -} - -function dedentBlockString(blockStr) { - // skip leading and trailing triple quotations - var rawStr = blockStr.slice(3, -3); - var body = dedentBlockStringValue(rawStr); - - if (getBlockStringIndentation(body) > 0) { - body = '\n' + body; - } - - var lastChar = body[body.length - 1]; - var hasTrailingQuote = lastChar === '"' && body.slice(-4) !== '\\"""'; - - if (hasTrailingQuote || lastChar === '\\') { - body += '\n'; - } - - return '"""' + body + '"""'; -} diff --git a/node_modules/graphql/utilities/typeComparators.d.ts b/node_modules/graphql/utilities/typeComparators.d.ts deleted file mode 100644 index 7de3e00b..00000000 --- a/node_modules/graphql/utilities/typeComparators.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { GraphQLSchema } from '../type/schema'; -import { GraphQLType, GraphQLCompositeType } from '../type/definition'; - -/** - * Provided two types, return true if the types are equal (invariant). - */ -export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean; - -/** - * Provided a type and a super type, return true if the first type is either - * equal or a subset of the second super type (covariant). - */ -export function isTypeSubTypeOf( - schema: GraphQLSchema, - maybeSubType: GraphQLType, - superType: GraphQLType, -): boolean; - -/** - * Provided two composite types, determine if they "overlap". Two composite - * types overlap when the Sets of possible concrete types for each intersect. - * - * This is often used to determine if a fragment of a given type could possibly - * be visited in a context of another type. - * - * This function is commutative. - */ -export function doTypesOverlap( - schema: GraphQLSchema, - typeA: GraphQLCompositeType, - typeB: GraphQLCompositeType, -): boolean; diff --git a/node_modules/graphql/utilities/typeComparators.js b/node_modules/graphql/utilities/typeComparators.js deleted file mode 100644 index 42ad5fd0..00000000 --- a/node_modules/graphql/utilities/typeComparators.js +++ /dev/null @@ -1,115 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isEqualType = isEqualType; -exports.isTypeSubTypeOf = isTypeSubTypeOf; -exports.doTypesOverlap = doTypesOverlap; - -var _definition = require("../type/definition.js"); - -/** - * Provided two types, return true if the types are equal (invariant). - */ -function isEqualType(typeA, typeB) { - // Equivalent types are equal. - if (typeA === typeB) { - return true; - } // If either type is non-null, the other must also be non-null. - - - if ((0, _definition.isNonNullType)(typeA) && (0, _definition.isNonNullType)(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } // If either type is a list, the other must also be a list. - - - if ((0, _definition.isListType)(typeA) && (0, _definition.isListType)(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } // Otherwise the types are not equal. - - - return false; -} -/** - * Provided a type and a super type, return true if the first type is either - * equal or a subset of the second super type (covariant). - */ - - -function isTypeSubTypeOf(schema, maybeSubType, superType) { - // Equivalent type is a valid subtype - if (maybeSubType === superType) { - return true; - } // If superType is non-null, maybeSubType must also be non-null. - - - if ((0, _definition.isNonNullType)(superType)) { - if ((0, _definition.isNonNullType)(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - - return false; - } - - if ((0, _definition.isNonNullType)(maybeSubType)) { - // If superType is nullable, maybeSubType may be non-null or nullable. - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); - } // If superType type is a list, maybeSubType type must also be a list. - - - if ((0, _definition.isListType)(superType)) { - if ((0, _definition.isListType)(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - - return false; - } - - if ((0, _definition.isListType)(maybeSubType)) { - // If superType is not a list, maybeSubType must also be not a list. - return false; - } // If superType type is an abstract type, check if it is super type of maybeSubType. - // Otherwise, the child type is not a valid subtype of the parent type. - - - return (0, _definition.isAbstractType)(superType) && ((0, _definition.isInterfaceType)(maybeSubType) || (0, _definition.isObjectType)(maybeSubType)) && schema.isSubType(superType, maybeSubType); -} -/** - * Provided two composite types, determine if they "overlap". Two composite - * types overlap when the Sets of possible concrete types for each intersect. - * - * This is often used to determine if a fragment of a given type could possibly - * be visited in a context of another type. - * - * This function is commutative. - */ - - -function doTypesOverlap(schema, typeA, typeB) { - // Equivalent types overlap - if (typeA === typeB) { - return true; - } - - if ((0, _definition.isAbstractType)(typeA)) { - if ((0, _definition.isAbstractType)(typeB)) { - // If both types are abstract, then determine if there is any intersection - // between possible concrete types of each. - return schema.getPossibleTypes(typeA).some(function (type) { - return schema.isSubType(typeB, type); - }); - } // Determine if the latter type is a possible concrete type of the former. - - - return schema.isSubType(typeA, typeB); - } - - if ((0, _definition.isAbstractType)(typeB)) { - // Determine if the former type is a possible concrete type of the latter. - return schema.isSubType(typeB, typeA); - } // Otherwise the types do not overlap. - - - return false; -} diff --git a/node_modules/graphql/utilities/typeComparators.js.flow b/node_modules/graphql/utilities/typeComparators.js.flow deleted file mode 100644 index c3b3af1d..00000000 --- a/node_modules/graphql/utilities/typeComparators.js.flow +++ /dev/null @@ -1,120 +0,0 @@ -// @flow strict -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLType, GraphQLCompositeType } from '../type/definition'; -import { - isInterfaceType, - isObjectType, - isListType, - isNonNullType, - isAbstractType, -} from '../type/definition'; - -/** - * Provided two types, return true if the types are equal (invariant). - */ -export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean { - // Equivalent types are equal. - if (typeA === typeB) { - return true; - } - - // If either type is non-null, the other must also be non-null. - if (isNonNullType(typeA) && isNonNullType(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } - - // If either type is a list, the other must also be a list. - if (isListType(typeA) && isListType(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } - - // Otherwise the types are not equal. - return false; -} - -/** - * Provided a type and a super type, return true if the first type is either - * equal or a subset of the second super type (covariant). - */ -export function isTypeSubTypeOf( - schema: GraphQLSchema, - maybeSubType: GraphQLType, - superType: GraphQLType, -): boolean { - // Equivalent type is a valid subtype - if (maybeSubType === superType) { - return true; - } - - // If superType is non-null, maybeSubType must also be non-null. - if (isNonNullType(superType)) { - if (isNonNullType(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - return false; - } - if (isNonNullType(maybeSubType)) { - // If superType is nullable, maybeSubType may be non-null or nullable. - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); - } - - // If superType type is a list, maybeSubType type must also be a list. - if (isListType(superType)) { - if (isListType(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - return false; - } - if (isListType(maybeSubType)) { - // If superType is not a list, maybeSubType must also be not a list. - return false; - } - - // If superType type is an abstract type, check if it is super type of maybeSubType. - // Otherwise, the child type is not a valid subtype of the parent type. - return ( - isAbstractType(superType) && - (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && - schema.isSubType(superType, maybeSubType) - ); -} - -/** - * Provided two composite types, determine if they "overlap". Two composite - * types overlap when the Sets of possible concrete types for each intersect. - * - * This is often used to determine if a fragment of a given type could possibly - * be visited in a context of another type. - * - * This function is commutative. - */ -export function doTypesOverlap( - schema: GraphQLSchema, - typeA: GraphQLCompositeType, - typeB: GraphQLCompositeType, -): boolean { - // Equivalent types overlap - if (typeA === typeB) { - return true; - } - - if (isAbstractType(typeA)) { - if (isAbstractType(typeB)) { - // If both types are abstract, then determine if there is any intersection - // between possible concrete types of each. - return schema - .getPossibleTypes(typeA) - .some((type) => schema.isSubType(typeB, type)); - } - // Determine if the latter type is a possible concrete type of the former. - return schema.isSubType(typeA, typeB); - } - - if (isAbstractType(typeB)) { - // Determine if the former type is a possible concrete type of the latter. - return schema.isSubType(typeB, typeA); - } - - // Otherwise the types do not overlap. - return false; -} diff --git a/node_modules/graphql/utilities/typeComparators.mjs b/node_modules/graphql/utilities/typeComparators.mjs deleted file mode 100644 index ad3288ab..00000000 --- a/node_modules/graphql/utilities/typeComparators.mjs +++ /dev/null @@ -1,104 +0,0 @@ -import { isInterfaceType, isObjectType, isListType, isNonNullType, isAbstractType } from "../type/definition.mjs"; -/** - * Provided two types, return true if the types are equal (invariant). - */ - -export function isEqualType(typeA, typeB) { - // Equivalent types are equal. - if (typeA === typeB) { - return true; - } // If either type is non-null, the other must also be non-null. - - - if (isNonNullType(typeA) && isNonNullType(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } // If either type is a list, the other must also be a list. - - - if (isListType(typeA) && isListType(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } // Otherwise the types are not equal. - - - return false; -} -/** - * Provided a type and a super type, return true if the first type is either - * equal or a subset of the second super type (covariant). - */ - -export function isTypeSubTypeOf(schema, maybeSubType, superType) { - // Equivalent type is a valid subtype - if (maybeSubType === superType) { - return true; - } // If superType is non-null, maybeSubType must also be non-null. - - - if (isNonNullType(superType)) { - if (isNonNullType(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - - return false; - } - - if (isNonNullType(maybeSubType)) { - // If superType is nullable, maybeSubType may be non-null or nullable. - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); - } // If superType type is a list, maybeSubType type must also be a list. - - - if (isListType(superType)) { - if (isListType(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - - return false; - } - - if (isListType(maybeSubType)) { - // If superType is not a list, maybeSubType must also be not a list. - return false; - } // If superType type is an abstract type, check if it is super type of maybeSubType. - // Otherwise, the child type is not a valid subtype of the parent type. - - - return isAbstractType(superType) && (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && schema.isSubType(superType, maybeSubType); -} -/** - * Provided two composite types, determine if they "overlap". Two composite - * types overlap when the Sets of possible concrete types for each intersect. - * - * This is often used to determine if a fragment of a given type could possibly - * be visited in a context of another type. - * - * This function is commutative. - */ - -export function doTypesOverlap(schema, typeA, typeB) { - // Equivalent types overlap - if (typeA === typeB) { - return true; - } - - if (isAbstractType(typeA)) { - if (isAbstractType(typeB)) { - // If both types are abstract, then determine if there is any intersection - // between possible concrete types of each. - return schema.getPossibleTypes(typeA).some(function (type) { - return schema.isSubType(typeB, type); - }); - } // Determine if the latter type is a possible concrete type of the former. - - - return schema.isSubType(typeA, typeB); - } - - if (isAbstractType(typeB)) { - // Determine if the former type is a possible concrete type of the latter. - return schema.isSubType(typeB, typeA); - } // Otherwise the types do not overlap. - - - return false; -} diff --git a/node_modules/graphql/utilities/typeFromAST.d.ts b/node_modules/graphql/utilities/typeFromAST.d.ts deleted file mode 100644 index cf32ac7c..00000000 --- a/node_modules/graphql/utilities/typeFromAST.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { NamedTypeNode, ListTypeNode, NonNullTypeNode } from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; -import { - GraphQLNamedType, - GraphQLList, - GraphQLNonNull, -} from '../type/definition'; - -/** - * Given a Schema and an AST node describing a type, return a GraphQLType - * definition which applies to that type. For example, if provided the parsed - * AST node for `[User]`, a GraphQLList instance will be returned, containing - * the type called "User" found in the schema. If a type called "User" is not - * found in the schema, then undefined will be returned. - */ -export function typeFromAST( - schema: GraphQLSchema, - typeNode: NamedTypeNode, -): GraphQLNamedType | undefined; - -export function typeFromAST( - schema: GraphQLSchema, - typeNode: ListTypeNode, -): GraphQLList | undefined; - -export function typeFromAST( - schema: GraphQLSchema, - typeNode: NonNullTypeNode, -): GraphQLNonNull | undefined; diff --git a/node_modules/graphql/utilities/typeFromAST.js b/node_modules/graphql/utilities/typeFromAST.js deleted file mode 100644 index 5e859440..00000000 --- a/node_modules/graphql/utilities/typeFromAST.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.typeFromAST = typeFromAST; - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _kinds = require("../language/kinds.js"); - -var _definition = require("../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function typeFromAST(schema, typeNode) { - /* eslint-enable no-redeclare */ - var innerType; - - if (typeNode.kind === _kinds.Kind.LIST_TYPE) { - innerType = typeFromAST(schema, typeNode.type); - return innerType && new _definition.GraphQLList(innerType); - } - - if (typeNode.kind === _kinds.Kind.NON_NULL_TYPE) { - innerType = typeFromAST(schema, typeNode.type); - return innerType && new _definition.GraphQLNonNull(innerType); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (typeNode.kind === _kinds.Kind.NAMED_TYPE) { - return schema.getType(typeNode.name.value); - } // istanbul ignore next (Not reachable. All possible type nodes have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type node: ' + (0, _inspect.default)(typeNode)); -} diff --git a/node_modules/graphql/utilities/typeFromAST.js.flow b/node_modules/graphql/utilities/typeFromAST.js.flow deleted file mode 100644 index a8450d81..00000000 --- a/node_modules/graphql/utilities/typeFromAST.js.flow +++ /dev/null @@ -1,55 +0,0 @@ -// @flow strict -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; - -import type { - NamedTypeNode, - ListTypeNode, - NonNullTypeNode, -} from '../language/ast'; - -import { Kind } from '../language/kinds'; - -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLNamedType } from '../type/definition'; -import { GraphQLList, GraphQLNonNull } from '../type/definition'; - -/** - * Given a Schema and an AST node describing a type, return a GraphQLType - * definition which applies to that type. For example, if provided the parsed - * AST node for `[User]`, a GraphQLList instance will be returned, containing - * the type called "User" found in the schema. If a type called "User" is not - * found in the schema, then undefined will be returned. - */ -/* eslint-disable no-redeclare */ -declare function typeFromAST( - schema: GraphQLSchema, - typeNode: NamedTypeNode, -): GraphQLNamedType | void; -declare function typeFromAST( - schema: GraphQLSchema, - typeNode: ListTypeNode, -): GraphQLList | void; -declare function typeFromAST( - schema: GraphQLSchema, - typeNode: NonNullTypeNode, -): GraphQLNonNull | void; -export function typeFromAST(schema, typeNode) { - /* eslint-enable no-redeclare */ - let innerType; - if (typeNode.kind === Kind.LIST_TYPE) { - innerType = typeFromAST(schema, typeNode.type); - return innerType && new GraphQLList(innerType); - } - if (typeNode.kind === Kind.NON_NULL_TYPE) { - innerType = typeFromAST(schema, typeNode.type); - return innerType && new GraphQLNonNull(innerType); - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (typeNode.kind === Kind.NAMED_TYPE) { - return schema.getType(typeNode.name.value); - } - - // istanbul ignore next (Not reachable. All possible type nodes have been considered) - invariant(false, 'Unexpected type node: ' + inspect((typeNode: empty))); -} diff --git a/node_modules/graphql/utilities/typeFromAST.mjs b/node_modules/graphql/utilities/typeFromAST.mjs deleted file mode 100644 index 740cfebf..00000000 --- a/node_modules/graphql/utilities/typeFromAST.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { GraphQLList, GraphQLNonNull } from "../type/definition.mjs"; -/** - * Given a Schema and an AST node describing a type, return a GraphQLType - * definition which applies to that type. For example, if provided the parsed - * AST node for `[User]`, a GraphQLList instance will be returned, containing - * the type called "User" found in the schema. If a type called "User" is not - * found in the schema, then undefined will be returned. - */ - -/* eslint-disable no-redeclare */ - -export function typeFromAST(schema, typeNode) { - /* eslint-enable no-redeclare */ - var innerType; - - if (typeNode.kind === Kind.LIST_TYPE) { - innerType = typeFromAST(schema, typeNode.type); - return innerType && new GraphQLList(innerType); - } - - if (typeNode.kind === Kind.NON_NULL_TYPE) { - innerType = typeFromAST(schema, typeNode.type); - return innerType && new GraphQLNonNull(innerType); - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (typeNode.kind === Kind.NAMED_TYPE) { - return schema.getType(typeNode.name.value); - } // istanbul ignore next (Not reachable. All possible type nodes have been considered) - - - false || invariant(0, 'Unexpected type node: ' + inspect(typeNode)); -} diff --git a/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts b/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts deleted file mode 100644 index 0d7b8de1..00000000 --- a/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DocumentNode, ExecutableDefinitionNode } from '../language/ast'; - -/** - * Wrapper type that contains DocumentNode and types that can be deduced from it. - */ -export interface TypedQueryDocumentNode< - TResponseData = Record, - TRequestVariables = Record -> extends DocumentNode { - readonly definitions: ReadonlyArray; - // FIXME: remove once TS implements proper way to enforce nominal typing - /** - * This type is used to ensure that the variables you pass in to the query are assignable to Variables - * and that the Result is assignable to whatever you pass your result to. The method is never actually - * implemented, but the type is valid because we list it as optional - */ - __ensureTypesOfVariablesAndResultMatching?: ( - variables: TRequestVariables, - ) => TResponseData; -} diff --git a/node_modules/graphql/utilities/valueFromAST.d.ts b/node_modules/graphql/utilities/valueFromAST.d.ts deleted file mode 100644 index acde6ba9..00000000 --- a/node_modules/graphql/utilities/valueFromAST.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { ValueNode } from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; - -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * A GraphQL type must be provided, which will be used to interpret different - * GraphQL Value literals. - * - * Returns `undefined` when the value could not be validly coerced according to - * the provided type. - * - * | GraphQL Value | JSON Value | - * | -------------------- | ------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String | String | - * | Int / Float | Number | - * | Enum Value | Mixed | - * | NullValue | null | - * - */ -export function valueFromAST( - valueNode: Maybe, - type: GraphQLInputType, - variables?: Maybe<{ [key: string]: any }>, -): any; diff --git a/node_modules/graphql/utilities/valueFromAST.js b/node_modules/graphql/utilities/valueFromAST.js deleted file mode 100644 index 0b0230c9..00000000 --- a/node_modules/graphql/utilities/valueFromAST.js +++ /dev/null @@ -1,186 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.valueFromAST = valueFromAST; - -var _objectValues3 = _interopRequireDefault(require("../polyfills/objectValues.js")); - -var _keyMap = _interopRequireDefault(require("../jsutils/keyMap.js")); - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _kinds = require("../language/kinds.js"); - -var _definition = require("../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * A GraphQL type must be provided, which will be used to interpret different - * GraphQL Value literals. - * - * Returns `undefined` when the value could not be validly coerced according to - * the provided type. - * - * | GraphQL Value | JSON Value | - * | -------------------- | ------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String | String | - * | Int / Float | Number | - * | Enum Value | Mixed | - * | NullValue | null | - * - */ -function valueFromAST(valueNode, type, variables) { - if (!valueNode) { - // When there is no node, then there is also no value. - // Importantly, this is different from returning the value null. - return; - } - - if (valueNode.kind === _kinds.Kind.VARIABLE) { - var variableName = valueNode.name.value; - - if (variables == null || variables[variableName] === undefined) { - // No valid return value. - return; - } - - var variableValue = variables[variableName]; - - if (variableValue === null && (0, _definition.isNonNullType)(type)) { - return; // Invalid: intentionally return no value. - } // Note: This does no further checking that this variable is correct. - // This assumes that this query has been validated and the variable - // usage here is of the correct type. - - - return variableValue; - } - - if ((0, _definition.isNonNullType)(type)) { - if (valueNode.kind === _kinds.Kind.NULL) { - return; // Invalid: intentionally return no value. - } - - return valueFromAST(valueNode, type.ofType, variables); - } - - if (valueNode.kind === _kinds.Kind.NULL) { - // This is explicitly returning the value null. - return null; - } - - if ((0, _definition.isListType)(type)) { - var itemType = type.ofType; - - if (valueNode.kind === _kinds.Kind.LIST) { - var coercedValues = []; - - for (var _i2 = 0, _valueNode$values2 = valueNode.values; _i2 < _valueNode$values2.length; _i2++) { - var itemNode = _valueNode$values2[_i2]; - - if (isMissingVariable(itemNode, variables)) { - // If an array contains a missing variable, it is either coerced to - // null or if the item type is non-null, it considered invalid. - if ((0, _definition.isNonNullType)(itemType)) { - return; // Invalid: intentionally return no value. - } - - coercedValues.push(null); - } else { - var itemValue = valueFromAST(itemNode, itemType, variables); - - if (itemValue === undefined) { - return; // Invalid: intentionally return no value. - } - - coercedValues.push(itemValue); - } - } - - return coercedValues; - } - - var coercedValue = valueFromAST(valueNode, itemType, variables); - - if (coercedValue === undefined) { - return; // Invalid: intentionally return no value. - } - - return [coercedValue]; - } - - if ((0, _definition.isInputObjectType)(type)) { - if (valueNode.kind !== _kinds.Kind.OBJECT) { - return; // Invalid: intentionally return no value. - } - - var coercedObj = Object.create(null); - var fieldNodes = (0, _keyMap.default)(valueNode.fields, function (field) { - return field.name.value; - }); - - for (var _i4 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i4 < _objectValues2.length; _i4++) { - var field = _objectValues2[_i4]; - var fieldNode = fieldNodes[field.name]; - - if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { - if (field.defaultValue !== undefined) { - coercedObj[field.name] = field.defaultValue; - } else if ((0, _definition.isNonNullType)(field.type)) { - return; // Invalid: intentionally return no value. - } - - continue; - } - - var fieldValue = valueFromAST(fieldNode.value, field.type, variables); - - if (fieldValue === undefined) { - return; // Invalid: intentionally return no value. - } - - coercedObj[field.name] = fieldValue; - } - - return coercedObj; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isLeafType)(type)) { - // Scalars and Enums fulfill parsing a literal value via parseLiteral(). - // Invalid values represent a failure to parse correctly, in which case - // no value is returned. - var result; - - try { - result = type.parseLiteral(valueNode, variables); - } catch (_error) { - return; // Invalid: intentionally return no value. - } - - if (result === undefined) { - return; // Invalid: intentionally return no value. - } - - return result; - } // istanbul ignore next (Not reachable. All possible input types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type)); -} // Returns true if the provided valueNode is a variable which is not defined -// in the set of variables. - - -function isMissingVariable(valueNode, variables) { - return valueNode.kind === _kinds.Kind.VARIABLE && (variables == null || variables[valueNode.name.value] === undefined); -} diff --git a/node_modules/graphql/utilities/valueFromAST.js.flow b/node_modules/graphql/utilities/valueFromAST.js.flow deleted file mode 100644 index 23d55888..00000000 --- a/node_modules/graphql/utilities/valueFromAST.js.flow +++ /dev/null @@ -1,164 +0,0 @@ -// @flow strict -import objectValues from '../polyfills/objectValues'; - -import type { ObjMap } from '../jsutils/ObjMap'; -import keyMap from '../jsutils/keyMap'; -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; - -import type { ValueNode } from '../language/ast'; -import { Kind } from '../language/kinds'; - -import type { GraphQLInputType } from '../type/definition'; -import { - isLeafType, - isInputObjectType, - isListType, - isNonNullType, -} from '../type/definition'; - -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * A GraphQL type must be provided, which will be used to interpret different - * GraphQL Value literals. - * - * Returns `undefined` when the value could not be validly coerced according to - * the provided type. - * - * | GraphQL Value | JSON Value | - * | -------------------- | ------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String | String | - * | Int / Float | Number | - * | Enum Value | Mixed | - * | NullValue | null | - * - */ -export function valueFromAST( - valueNode: ?ValueNode, - type: GraphQLInputType, - variables?: ?ObjMap, -): mixed | void { - if (!valueNode) { - // When there is no node, then there is also no value. - // Importantly, this is different from returning the value null. - return; - } - - if (valueNode.kind === Kind.VARIABLE) { - const variableName = valueNode.name.value; - if (variables == null || variables[variableName] === undefined) { - // No valid return value. - return; - } - const variableValue = variables[variableName]; - if (variableValue === null && isNonNullType(type)) { - return; // Invalid: intentionally return no value. - } - // Note: This does no further checking that this variable is correct. - // This assumes that this query has been validated and the variable - // usage here is of the correct type. - return variableValue; - } - - if (isNonNullType(type)) { - if (valueNode.kind === Kind.NULL) { - return; // Invalid: intentionally return no value. - } - return valueFromAST(valueNode, type.ofType, variables); - } - - if (valueNode.kind === Kind.NULL) { - // This is explicitly returning the value null. - return null; - } - - if (isListType(type)) { - const itemType = type.ofType; - if (valueNode.kind === Kind.LIST) { - const coercedValues = []; - for (const itemNode of valueNode.values) { - if (isMissingVariable(itemNode, variables)) { - // If an array contains a missing variable, it is either coerced to - // null or if the item type is non-null, it considered invalid. - if (isNonNullType(itemType)) { - return; // Invalid: intentionally return no value. - } - coercedValues.push(null); - } else { - const itemValue = valueFromAST(itemNode, itemType, variables); - if (itemValue === undefined) { - return; // Invalid: intentionally return no value. - } - coercedValues.push(itemValue); - } - } - return coercedValues; - } - const coercedValue = valueFromAST(valueNode, itemType, variables); - if (coercedValue === undefined) { - return; // Invalid: intentionally return no value. - } - return [coercedValue]; - } - - if (isInputObjectType(type)) { - if (valueNode.kind !== Kind.OBJECT) { - return; // Invalid: intentionally return no value. - } - const coercedObj = Object.create(null); - const fieldNodes = keyMap(valueNode.fields, (field) => field.name.value); - for (const field of objectValues(type.getFields())) { - const fieldNode = fieldNodes[field.name]; - if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { - if (field.defaultValue !== undefined) { - coercedObj[field.name] = field.defaultValue; - } else if (isNonNullType(field.type)) { - return; // Invalid: intentionally return no value. - } - continue; - } - const fieldValue = valueFromAST(fieldNode.value, field.type, variables); - if (fieldValue === undefined) { - return; // Invalid: intentionally return no value. - } - coercedObj[field.name] = fieldValue; - } - return coercedObj; - } - - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isLeafType(type)) { - // Scalars and Enums fulfill parsing a literal value via parseLiteral(). - // Invalid values represent a failure to parse correctly, in which case - // no value is returned. - let result; - try { - result = type.parseLiteral(valueNode, variables); - } catch (_error) { - return; // Invalid: intentionally return no value. - } - if (result === undefined) { - return; // Invalid: intentionally return no value. - } - return result; - } - - // istanbul ignore next (Not reachable. All possible input types have been considered) - invariant(false, 'Unexpected input type: ' + inspect((type: empty))); -} - -// Returns true if the provided valueNode is a variable which is not defined -// in the set of variables. -function isMissingVariable( - valueNode: ValueNode, - variables: ?ObjMap, -): boolean { - return ( - valueNode.kind === Kind.VARIABLE && - (variables == null || variables[valueNode.name.value] === undefined) - ); -} diff --git a/node_modules/graphql/utilities/valueFromAST.mjs b/node_modules/graphql/utilities/valueFromAST.mjs deleted file mode 100644 index 5879ea7e..00000000 --- a/node_modules/graphql/utilities/valueFromAST.mjs +++ /dev/null @@ -1,171 +0,0 @@ -import objectValues from "../polyfills/objectValues.mjs"; -import keyMap from "../jsutils/keyMap.mjs"; -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import { Kind } from "../language/kinds.mjs"; -import { isLeafType, isInputObjectType, isListType, isNonNullType } from "../type/definition.mjs"; -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * A GraphQL type must be provided, which will be used to interpret different - * GraphQL Value literals. - * - * Returns `undefined` when the value could not be validly coerced according to - * the provided type. - * - * | GraphQL Value | JSON Value | - * | -------------------- | ------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String | String | - * | Int / Float | Number | - * | Enum Value | Mixed | - * | NullValue | null | - * - */ - -export function valueFromAST(valueNode, type, variables) { - if (!valueNode) { - // When there is no node, then there is also no value. - // Importantly, this is different from returning the value null. - return; - } - - if (valueNode.kind === Kind.VARIABLE) { - var variableName = valueNode.name.value; - - if (variables == null || variables[variableName] === undefined) { - // No valid return value. - return; - } - - var variableValue = variables[variableName]; - - if (variableValue === null && isNonNullType(type)) { - return; // Invalid: intentionally return no value. - } // Note: This does no further checking that this variable is correct. - // This assumes that this query has been validated and the variable - // usage here is of the correct type. - - - return variableValue; - } - - if (isNonNullType(type)) { - if (valueNode.kind === Kind.NULL) { - return; // Invalid: intentionally return no value. - } - - return valueFromAST(valueNode, type.ofType, variables); - } - - if (valueNode.kind === Kind.NULL) { - // This is explicitly returning the value null. - return null; - } - - if (isListType(type)) { - var itemType = type.ofType; - - if (valueNode.kind === Kind.LIST) { - var coercedValues = []; - - for (var _i2 = 0, _valueNode$values2 = valueNode.values; _i2 < _valueNode$values2.length; _i2++) { - var itemNode = _valueNode$values2[_i2]; - - if (isMissingVariable(itemNode, variables)) { - // If an array contains a missing variable, it is either coerced to - // null or if the item type is non-null, it considered invalid. - if (isNonNullType(itemType)) { - return; // Invalid: intentionally return no value. - } - - coercedValues.push(null); - } else { - var itemValue = valueFromAST(itemNode, itemType, variables); - - if (itemValue === undefined) { - return; // Invalid: intentionally return no value. - } - - coercedValues.push(itemValue); - } - } - - return coercedValues; - } - - var coercedValue = valueFromAST(valueNode, itemType, variables); - - if (coercedValue === undefined) { - return; // Invalid: intentionally return no value. - } - - return [coercedValue]; - } - - if (isInputObjectType(type)) { - if (valueNode.kind !== Kind.OBJECT) { - return; // Invalid: intentionally return no value. - } - - var coercedObj = Object.create(null); - var fieldNodes = keyMap(valueNode.fields, function (field) { - return field.name.value; - }); - - for (var _i4 = 0, _objectValues2 = objectValues(type.getFields()); _i4 < _objectValues2.length; _i4++) { - var field = _objectValues2[_i4]; - var fieldNode = fieldNodes[field.name]; - - if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { - if (field.defaultValue !== undefined) { - coercedObj[field.name] = field.defaultValue; - } else if (isNonNullType(field.type)) { - return; // Invalid: intentionally return no value. - } - - continue; - } - - var fieldValue = valueFromAST(fieldNode.value, field.type, variables); - - if (fieldValue === undefined) { - return; // Invalid: intentionally return no value. - } - - coercedObj[field.name] = fieldValue; - } - - return coercedObj; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isLeafType(type)) { - // Scalars and Enums fulfill parsing a literal value via parseLiteral(). - // Invalid values represent a failure to parse correctly, in which case - // no value is returned. - var result; - - try { - result = type.parseLiteral(valueNode, variables); - } catch (_error) { - return; // Invalid: intentionally return no value. - } - - if (result === undefined) { - return; // Invalid: intentionally return no value. - } - - return result; - } // istanbul ignore next (Not reachable. All possible input types have been considered) - - - false || invariant(0, 'Unexpected input type: ' + inspect(type)); -} // Returns true if the provided valueNode is a variable which is not defined -// in the set of variables. - -function isMissingVariable(valueNode, variables) { - return valueNode.kind === Kind.VARIABLE && (variables == null || variables[valueNode.name.value] === undefined); -} diff --git a/node_modules/graphql/utilities/valueFromASTUntyped.d.ts b/node_modules/graphql/utilities/valueFromASTUntyped.d.ts deleted file mode 100644 index a44959da..00000000 --- a/node_modules/graphql/utilities/valueFromASTUntyped.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { ValueNode } from '../language/ast'; - -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value - * will reflect the provided GraphQL value AST. - * - * | GraphQL Value | JavaScript Value | - * | -------------------- | ---------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String / Enum | String | - * | Int / Float | Number | - * | Null | null | - * - */ -export function valueFromASTUntyped( - valueNode: ValueNode, - variables?: Maybe<{ [key: string]: any }>, -): any; diff --git a/node_modules/graphql/utilities/valueFromASTUntyped.js b/node_modules/graphql/utilities/valueFromASTUntyped.js deleted file mode 100644 index 5cdb4130..00000000 --- a/node_modules/graphql/utilities/valueFromASTUntyped.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.valueFromASTUntyped = valueFromASTUntyped; - -var _inspect = _interopRequireDefault(require("../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../jsutils/invariant.js")); - -var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap.js")); - -var _kinds = require("../language/kinds.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value - * will reflect the provided GraphQL value AST. - * - * | GraphQL Value | JavaScript Value | - * | -------------------- | ---------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String / Enum | String | - * | Int / Float | Number | - * | Null | null | - * - */ -function valueFromASTUntyped(valueNode, variables) { - switch (valueNode.kind) { - case _kinds.Kind.NULL: - return null; - - case _kinds.Kind.INT: - return parseInt(valueNode.value, 10); - - case _kinds.Kind.FLOAT: - return parseFloat(valueNode.value); - - case _kinds.Kind.STRING: - case _kinds.Kind.ENUM: - case _kinds.Kind.BOOLEAN: - return valueNode.value; - - case _kinds.Kind.LIST: - return valueNode.values.map(function (node) { - return valueFromASTUntyped(node, variables); - }); - - case _kinds.Kind.OBJECT: - return (0, _keyValMap.default)(valueNode.fields, function (field) { - return field.name.value; - }, function (field) { - return valueFromASTUntyped(field.value, variables); - }); - - case _kinds.Kind.VARIABLE: - return variables === null || variables === void 0 ? void 0 : variables[valueNode.name.value]; - } // istanbul ignore next (Not reachable. All possible value nodes have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected value node: ' + (0, _inspect.default)(valueNode)); -} diff --git a/node_modules/graphql/utilities/valueFromASTUntyped.js.flow b/node_modules/graphql/utilities/valueFromASTUntyped.js.flow deleted file mode 100644 index e98779d2..00000000 --- a/node_modules/graphql/utilities/valueFromASTUntyped.js.flow +++ /dev/null @@ -1,57 +0,0 @@ -// @flow strict -import type { ObjMap } from '../jsutils/ObjMap'; -import inspect from '../jsutils/inspect'; -import invariant from '../jsutils/invariant'; -import keyValMap from '../jsutils/keyValMap'; - -import { Kind } from '../language/kinds'; -import type { ValueNode } from '../language/ast'; - -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value - * will reflect the provided GraphQL value AST. - * - * | GraphQL Value | JavaScript Value | - * | -------------------- | ---------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String / Enum | String | - * | Int / Float | Number | - * | Null | null | - * - */ -export function valueFromASTUntyped( - valueNode: ValueNode, - variables?: ?ObjMap, -): mixed { - switch (valueNode.kind) { - case Kind.NULL: - return null; - case Kind.INT: - return parseInt(valueNode.value, 10); - case Kind.FLOAT: - return parseFloat(valueNode.value); - case Kind.STRING: - case Kind.ENUM: - case Kind.BOOLEAN: - return valueNode.value; - case Kind.LIST: - return valueNode.values.map((node) => - valueFromASTUntyped(node, variables), - ); - case Kind.OBJECT: - return keyValMap( - valueNode.fields, - (field) => field.name.value, - (field) => valueFromASTUntyped(field.value, variables), - ); - case Kind.VARIABLE: - return variables?.[valueNode.name.value]; - } - - // istanbul ignore next (Not reachable. All possible value nodes have been considered) - invariant(false, 'Unexpected value node: ' + inspect((valueNode: empty))); -} diff --git a/node_modules/graphql/utilities/valueFromASTUntyped.mjs b/node_modules/graphql/utilities/valueFromASTUntyped.mjs deleted file mode 100644 index e70622c2..00000000 --- a/node_modules/graphql/utilities/valueFromASTUntyped.mjs +++ /dev/null @@ -1,56 +0,0 @@ -import inspect from "../jsutils/inspect.mjs"; -import invariant from "../jsutils/invariant.mjs"; -import keyValMap from "../jsutils/keyValMap.mjs"; -import { Kind } from "../language/kinds.mjs"; - -/** - * Produces a JavaScript value given a GraphQL Value AST. - * - * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value - * will reflect the provided GraphQL value AST. - * - * | GraphQL Value | JavaScript Value | - * | -------------------- | ---------------- | - * | Input Object | Object | - * | List | Array | - * | Boolean | Boolean | - * | String / Enum | String | - * | Int / Float | Number | - * | Null | null | - * - */ -export function valueFromASTUntyped(valueNode, variables) { - switch (valueNode.kind) { - case Kind.NULL: - return null; - - case Kind.INT: - return parseInt(valueNode.value, 10); - - case Kind.FLOAT: - return parseFloat(valueNode.value); - - case Kind.STRING: - case Kind.ENUM: - case Kind.BOOLEAN: - return valueNode.value; - - case Kind.LIST: - return valueNode.values.map(function (node) { - return valueFromASTUntyped(node, variables); - }); - - case Kind.OBJECT: - return keyValMap(valueNode.fields, function (field) { - return field.name.value; - }, function (field) { - return valueFromASTUntyped(field.value, variables); - }); - - case Kind.VARIABLE: - return variables === null || variables === void 0 ? void 0 : variables[valueNode.name.value]; - } // istanbul ignore next (Not reachable. All possible value nodes have been considered) - - - false || invariant(0, 'Unexpected value node: ' + inspect(valueNode)); -} diff --git a/node_modules/graphql/validation/ValidationContext.d.ts b/node_modules/graphql/validation/ValidationContext.d.ts deleted file mode 100644 index e0ca546b..00000000 --- a/node_modules/graphql/validation/ValidationContext.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { GraphQLError } from '../error/GraphQLError'; -import { ASTVisitor } from '../language/visitor'; -import { - DocumentNode, - OperationDefinitionNode, - VariableNode, - SelectionSetNode, - FragmentSpreadNode, - FragmentDefinitionNode, -} from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; -import { GraphQLDirective } from '../type/directives'; -import { - GraphQLInputType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, - GraphQLArgument, - GraphQLEnumValue, -} from '../type/definition'; -import { TypeInfo } from '../utilities/TypeInfo'; - -type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; -interface VariableUsage { - readonly node: VariableNode; - readonly type: Maybe; - readonly defaultValue: Maybe; -} - -/** - * An instance of this class is passed as the "this" context to all validators, - * allowing access to commonly useful contextual information from within a - * validation rule. - */ -export class ASTValidationContext { - constructor(ast: DocumentNode, onError: (err: GraphQLError) => void); - - reportError(error: GraphQLError): undefined; - - getDocument(): DocumentNode; - - getFragment(name: string): Maybe; - - getFragmentSpreads(node: SelectionSetNode): ReadonlyArray; - - getRecursivelyReferencedFragments( - operation: OperationDefinitionNode, - ): ReadonlyArray; -} - -export class SDLValidationContext extends ASTValidationContext { - constructor( - ast: DocumentNode, - schema: Maybe, - onError: (err: GraphQLError) => void, - ); - - getSchema(): Maybe; -} - -export type SDLValidationRule = (context: SDLValidationContext) => ASTVisitor; - -export class ValidationContext extends ASTValidationContext { - constructor( - schema: GraphQLSchema, - ast: DocumentNode, - typeInfo: TypeInfo, - onError: (err: GraphQLError) => void, - ); - - getSchema(): GraphQLSchema; - - getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray; - - getRecursivelyReferencedFragments( - operation: OperationDefinitionNode, - ): ReadonlyArray; - - getType(): Maybe; - - getParentType(): Maybe; - - getInputType(): Maybe; - - getParentInputType(): Maybe; - - getFieldDef(): Maybe>; - - getDirective(): Maybe; - - getArgument(): Maybe; - - getEnumValue(): Maybe; -} - -export type ValidationRule = (context: ValidationContext) => ASTVisitor; diff --git a/node_modules/graphql/validation/ValidationContext.js b/node_modules/graphql/validation/ValidationContext.js deleted file mode 100644 index c70da64d..00000000 --- a/node_modules/graphql/validation/ValidationContext.js +++ /dev/null @@ -1,241 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ValidationContext = exports.SDLValidationContext = exports.ASTValidationContext = void 0; - -var _kinds = require("../language/kinds.js"); - -var _visitor = require("../language/visitor.js"); - -var _TypeInfo = require("../utilities/TypeInfo.js"); - -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - -/** - * An instance of this class is passed as the "this" context to all validators, - * allowing access to commonly useful contextual information from within a - * validation rule. - */ -var ASTValidationContext = /*#__PURE__*/function () { - function ASTValidationContext(ast, onError) { - this._ast = ast; - this._fragments = undefined; - this._fragmentSpreads = new Map(); - this._recursivelyReferencedFragments = new Map(); - this._onError = onError; - } - - var _proto = ASTValidationContext.prototype; - - _proto.reportError = function reportError(error) { - this._onError(error); - }; - - _proto.getDocument = function getDocument() { - return this._ast; - }; - - _proto.getFragment = function getFragment(name) { - var fragments = this._fragments; - - if (!fragments) { - this._fragments = fragments = this.getDocument().definitions.reduce(function (frags, statement) { - if (statement.kind === _kinds.Kind.FRAGMENT_DEFINITION) { - frags[statement.name.value] = statement; - } - - return frags; - }, Object.create(null)); - } - - return fragments[name]; - }; - - _proto.getFragmentSpreads = function getFragmentSpreads(node) { - var spreads = this._fragmentSpreads.get(node); - - if (!spreads) { - spreads = []; - var setsToVisit = [node]; - - while (setsToVisit.length !== 0) { - var set = setsToVisit.pop(); - - for (var _i2 = 0, _set$selections2 = set.selections; _i2 < _set$selections2.length; _i2++) { - var selection = _set$selections2[_i2]; - - if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) { - spreads.push(selection); - } else if (selection.selectionSet) { - setsToVisit.push(selection.selectionSet); - } - } - } - - this._fragmentSpreads.set(node, spreads); - } - - return spreads; - }; - - _proto.getRecursivelyReferencedFragments = function getRecursivelyReferencedFragments(operation) { - var fragments = this._recursivelyReferencedFragments.get(operation); - - if (!fragments) { - fragments = []; - var collectedNames = Object.create(null); - var nodesToVisit = [operation.selectionSet]; - - while (nodesToVisit.length !== 0) { - var node = nodesToVisit.pop(); - - for (var _i4 = 0, _this$getFragmentSpre2 = this.getFragmentSpreads(node); _i4 < _this$getFragmentSpre2.length; _i4++) { - var spread = _this$getFragmentSpre2[_i4]; - var fragName = spread.name.value; - - if (collectedNames[fragName] !== true) { - collectedNames[fragName] = true; - var fragment = this.getFragment(fragName); - - if (fragment) { - fragments.push(fragment); - nodesToVisit.push(fragment.selectionSet); - } - } - } - } - - this._recursivelyReferencedFragments.set(operation, fragments); - } - - return fragments; - }; - - return ASTValidationContext; -}(); - -exports.ASTValidationContext = ASTValidationContext; - -var SDLValidationContext = /*#__PURE__*/function (_ASTValidationContext) { - _inheritsLoose(SDLValidationContext, _ASTValidationContext); - - function SDLValidationContext(ast, schema, onError) { - var _this; - - _this = _ASTValidationContext.call(this, ast, onError) || this; - _this._schema = schema; - return _this; - } - - var _proto2 = SDLValidationContext.prototype; - - _proto2.getSchema = function getSchema() { - return this._schema; - }; - - return SDLValidationContext; -}(ASTValidationContext); - -exports.SDLValidationContext = SDLValidationContext; - -var ValidationContext = /*#__PURE__*/function (_ASTValidationContext2) { - _inheritsLoose(ValidationContext, _ASTValidationContext2); - - function ValidationContext(schema, ast, typeInfo, onError) { - var _this2; - - _this2 = _ASTValidationContext2.call(this, ast, onError) || this; - _this2._schema = schema; - _this2._typeInfo = typeInfo; - _this2._variableUsages = new Map(); - _this2._recursiveVariableUsages = new Map(); - return _this2; - } - - var _proto3 = ValidationContext.prototype; - - _proto3.getSchema = function getSchema() { - return this._schema; - }; - - _proto3.getVariableUsages = function getVariableUsages(node) { - var usages = this._variableUsages.get(node); - - if (!usages) { - var newUsages = []; - var typeInfo = new _TypeInfo.TypeInfo(this._schema); - (0, _visitor.visit)(node, (0, _TypeInfo.visitWithTypeInfo)(typeInfo, { - VariableDefinition: function VariableDefinition() { - return false; - }, - Variable: function Variable(variable) { - newUsages.push({ - node: variable, - type: typeInfo.getInputType(), - defaultValue: typeInfo.getDefaultValue() - }); - } - })); - usages = newUsages; - - this._variableUsages.set(node, usages); - } - - return usages; - }; - - _proto3.getRecursiveVariableUsages = function getRecursiveVariableUsages(operation) { - var usages = this._recursiveVariableUsages.get(operation); - - if (!usages) { - usages = this.getVariableUsages(operation); - - for (var _i6 = 0, _this$getRecursivelyR2 = this.getRecursivelyReferencedFragments(operation); _i6 < _this$getRecursivelyR2.length; _i6++) { - var frag = _this$getRecursivelyR2[_i6]; - usages = usages.concat(this.getVariableUsages(frag)); - } - - this._recursiveVariableUsages.set(operation, usages); - } - - return usages; - }; - - _proto3.getType = function getType() { - return this._typeInfo.getType(); - }; - - _proto3.getParentType = function getParentType() { - return this._typeInfo.getParentType(); - }; - - _proto3.getInputType = function getInputType() { - return this._typeInfo.getInputType(); - }; - - _proto3.getParentInputType = function getParentInputType() { - return this._typeInfo.getParentInputType(); - }; - - _proto3.getFieldDef = function getFieldDef() { - return this._typeInfo.getFieldDef(); - }; - - _proto3.getDirective = function getDirective() { - return this._typeInfo.getDirective(); - }; - - _proto3.getArgument = function getArgument() { - return this._typeInfo.getArgument(); - }; - - _proto3.getEnumValue = function getEnumValue() { - return this._typeInfo.getEnumValue(); - }; - - return ValidationContext; -}(ASTValidationContext); - -exports.ValidationContext = ValidationContext; diff --git a/node_modules/graphql/validation/ValidationContext.js.flow b/node_modules/graphql/validation/ValidationContext.js.flow deleted file mode 100644 index d48ffce5..00000000 --- a/node_modules/graphql/validation/ValidationContext.js.flow +++ /dev/null @@ -1,254 +0,0 @@ -// @flow strict -import type { ObjMap } from '../jsutils/ObjMap'; - -import type { GraphQLError } from '../error/GraphQLError'; - -import type { ASTVisitor } from '../language/visitor'; -import type { - DocumentNode, - OperationDefinitionNode, - VariableNode, - SelectionSetNode, - FragmentSpreadNode, - FragmentDefinitionNode, -} from '../language/ast'; - -import { Kind } from '../language/kinds'; -import { visit } from '../language/visitor'; - -import type { GraphQLSchema } from '../type/schema'; -import type { GraphQLDirective } from '../type/directives'; -import type { - GraphQLInputType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, - GraphQLArgument, - GraphQLEnumValue, -} from '../type/definition'; - -import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo'; - -type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; -type VariableUsage = {| - +node: VariableNode, - +type: ?GraphQLInputType, - +defaultValue: ?mixed, -|}; - -/** - * An instance of this class is passed as the "this" context to all validators, - * allowing access to commonly useful contextual information from within a - * validation rule. - */ -export class ASTValidationContext { - _ast: DocumentNode; - _onError: (err: GraphQLError) => void; - _fragments: ?ObjMap; - _fragmentSpreads: Map>; - _recursivelyReferencedFragments: Map< - OperationDefinitionNode, - $ReadOnlyArray, - >; - - constructor(ast: DocumentNode, onError: (err: GraphQLError) => void): void { - this._ast = ast; - this._fragments = undefined; - this._fragmentSpreads = new Map(); - this._recursivelyReferencedFragments = new Map(); - this._onError = onError; - } - - reportError(error: GraphQLError): void { - this._onError(error); - } - - getDocument(): DocumentNode { - return this._ast; - } - - getFragment(name: string): ?FragmentDefinitionNode { - let fragments = this._fragments; - if (!fragments) { - this._fragments = fragments = this.getDocument().definitions.reduce( - (frags, statement) => { - if (statement.kind === Kind.FRAGMENT_DEFINITION) { - frags[statement.name.value] = statement; - } - return frags; - }, - Object.create(null), - ); - } - return fragments[name]; - } - - getFragmentSpreads( - node: SelectionSetNode, - ): $ReadOnlyArray { - let spreads = this._fragmentSpreads.get(node); - if (!spreads) { - spreads = []; - const setsToVisit: Array = [node]; - while (setsToVisit.length !== 0) { - const set = setsToVisit.pop(); - for (const selection of set.selections) { - if (selection.kind === Kind.FRAGMENT_SPREAD) { - spreads.push(selection); - } else if (selection.selectionSet) { - setsToVisit.push(selection.selectionSet); - } - } - } - this._fragmentSpreads.set(node, spreads); - } - return spreads; - } - - getRecursivelyReferencedFragments( - operation: OperationDefinitionNode, - ): $ReadOnlyArray { - let fragments = this._recursivelyReferencedFragments.get(operation); - if (!fragments) { - fragments = []; - const collectedNames = Object.create(null); - const nodesToVisit: Array = [operation.selectionSet]; - while (nodesToVisit.length !== 0) { - const node = nodesToVisit.pop(); - for (const spread of this.getFragmentSpreads(node)) { - const fragName = spread.name.value; - if (collectedNames[fragName] !== true) { - collectedNames[fragName] = true; - const fragment = this.getFragment(fragName); - if (fragment) { - fragments.push(fragment); - nodesToVisit.push(fragment.selectionSet); - } - } - } - } - this._recursivelyReferencedFragments.set(operation, fragments); - } - return fragments; - } -} - -export type ASTValidationRule = (ASTValidationContext) => ASTVisitor; - -export class SDLValidationContext extends ASTValidationContext { - _schema: ?GraphQLSchema; - - constructor( - ast: DocumentNode, - schema: ?GraphQLSchema, - onError: (err: GraphQLError) => void, - ): void { - super(ast, onError); - this._schema = schema; - } - - getSchema(): ?GraphQLSchema { - return this._schema; - } -} - -export type SDLValidationRule = (SDLValidationContext) => ASTVisitor; - -export class ValidationContext extends ASTValidationContext { - _schema: GraphQLSchema; - _typeInfo: TypeInfo; - _variableUsages: Map>; - _recursiveVariableUsages: Map< - OperationDefinitionNode, - $ReadOnlyArray, - >; - - constructor( - schema: GraphQLSchema, - ast: DocumentNode, - typeInfo: TypeInfo, - onError: (err: GraphQLError) => void, - ): void { - super(ast, onError); - this._schema = schema; - this._typeInfo = typeInfo; - this._variableUsages = new Map(); - this._recursiveVariableUsages = new Map(); - } - - getSchema(): GraphQLSchema { - return this._schema; - } - - getVariableUsages(node: NodeWithSelectionSet): $ReadOnlyArray { - let usages = this._variableUsages.get(node); - if (!usages) { - const newUsages = []; - const typeInfo = new TypeInfo(this._schema); - visit( - node, - visitWithTypeInfo(typeInfo, { - VariableDefinition: () => false, - Variable(variable) { - newUsages.push({ - node: variable, - type: typeInfo.getInputType(), - defaultValue: typeInfo.getDefaultValue(), - }); - }, - }), - ); - usages = newUsages; - this._variableUsages.set(node, usages); - } - return usages; - } - - getRecursiveVariableUsages( - operation: OperationDefinitionNode, - ): $ReadOnlyArray { - let usages = this._recursiveVariableUsages.get(operation); - if (!usages) { - usages = this.getVariableUsages(operation); - for (const frag of this.getRecursivelyReferencedFragments(operation)) { - usages = usages.concat(this.getVariableUsages(frag)); - } - this._recursiveVariableUsages.set(operation, usages); - } - return usages; - } - - getType(): ?GraphQLOutputType { - return this._typeInfo.getType(); - } - - getParentType(): ?GraphQLCompositeType { - return this._typeInfo.getParentType(); - } - - getInputType(): ?GraphQLInputType { - return this._typeInfo.getInputType(); - } - - getParentInputType(): ?GraphQLInputType { - return this._typeInfo.getParentInputType(); - } - - getFieldDef(): ?GraphQLField { - return this._typeInfo.getFieldDef(); - } - - getDirective(): ?GraphQLDirective { - return this._typeInfo.getDirective(); - } - - getArgument(): ?GraphQLArgument { - return this._typeInfo.getArgument(); - } - - getEnumValue(): ?GraphQLEnumValue { - return this._typeInfo.getEnumValue(); - } -} - -export type ValidationRule = (ValidationContext) => ASTVisitor; diff --git a/node_modules/graphql/validation/ValidationContext.mjs b/node_modules/graphql/validation/ValidationContext.mjs deleted file mode 100644 index 55722655..00000000 --- a/node_modules/graphql/validation/ValidationContext.mjs +++ /dev/null @@ -1,224 +0,0 @@ -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - -import { Kind } from "../language/kinds.mjs"; -import { visit } from "../language/visitor.mjs"; -import { TypeInfo, visitWithTypeInfo } from "../utilities/TypeInfo.mjs"; - -/** - * An instance of this class is passed as the "this" context to all validators, - * allowing access to commonly useful contextual information from within a - * validation rule. - */ -export var ASTValidationContext = /*#__PURE__*/function () { - function ASTValidationContext(ast, onError) { - this._ast = ast; - this._fragments = undefined; - this._fragmentSpreads = new Map(); - this._recursivelyReferencedFragments = new Map(); - this._onError = onError; - } - - var _proto = ASTValidationContext.prototype; - - _proto.reportError = function reportError(error) { - this._onError(error); - }; - - _proto.getDocument = function getDocument() { - return this._ast; - }; - - _proto.getFragment = function getFragment(name) { - var fragments = this._fragments; - - if (!fragments) { - this._fragments = fragments = this.getDocument().definitions.reduce(function (frags, statement) { - if (statement.kind === Kind.FRAGMENT_DEFINITION) { - frags[statement.name.value] = statement; - } - - return frags; - }, Object.create(null)); - } - - return fragments[name]; - }; - - _proto.getFragmentSpreads = function getFragmentSpreads(node) { - var spreads = this._fragmentSpreads.get(node); - - if (!spreads) { - spreads = []; - var setsToVisit = [node]; - - while (setsToVisit.length !== 0) { - var set = setsToVisit.pop(); - - for (var _i2 = 0, _set$selections2 = set.selections; _i2 < _set$selections2.length; _i2++) { - var selection = _set$selections2[_i2]; - - if (selection.kind === Kind.FRAGMENT_SPREAD) { - spreads.push(selection); - } else if (selection.selectionSet) { - setsToVisit.push(selection.selectionSet); - } - } - } - - this._fragmentSpreads.set(node, spreads); - } - - return spreads; - }; - - _proto.getRecursivelyReferencedFragments = function getRecursivelyReferencedFragments(operation) { - var fragments = this._recursivelyReferencedFragments.get(operation); - - if (!fragments) { - fragments = []; - var collectedNames = Object.create(null); - var nodesToVisit = [operation.selectionSet]; - - while (nodesToVisit.length !== 0) { - var node = nodesToVisit.pop(); - - for (var _i4 = 0, _this$getFragmentSpre2 = this.getFragmentSpreads(node); _i4 < _this$getFragmentSpre2.length; _i4++) { - var spread = _this$getFragmentSpre2[_i4]; - var fragName = spread.name.value; - - if (collectedNames[fragName] !== true) { - collectedNames[fragName] = true; - var fragment = this.getFragment(fragName); - - if (fragment) { - fragments.push(fragment); - nodesToVisit.push(fragment.selectionSet); - } - } - } - } - - this._recursivelyReferencedFragments.set(operation, fragments); - } - - return fragments; - }; - - return ASTValidationContext; -}(); -export var SDLValidationContext = /*#__PURE__*/function (_ASTValidationContext) { - _inheritsLoose(SDLValidationContext, _ASTValidationContext); - - function SDLValidationContext(ast, schema, onError) { - var _this; - - _this = _ASTValidationContext.call(this, ast, onError) || this; - _this._schema = schema; - return _this; - } - - var _proto2 = SDLValidationContext.prototype; - - _proto2.getSchema = function getSchema() { - return this._schema; - }; - - return SDLValidationContext; -}(ASTValidationContext); -export var ValidationContext = /*#__PURE__*/function (_ASTValidationContext2) { - _inheritsLoose(ValidationContext, _ASTValidationContext2); - - function ValidationContext(schema, ast, typeInfo, onError) { - var _this2; - - _this2 = _ASTValidationContext2.call(this, ast, onError) || this; - _this2._schema = schema; - _this2._typeInfo = typeInfo; - _this2._variableUsages = new Map(); - _this2._recursiveVariableUsages = new Map(); - return _this2; - } - - var _proto3 = ValidationContext.prototype; - - _proto3.getSchema = function getSchema() { - return this._schema; - }; - - _proto3.getVariableUsages = function getVariableUsages(node) { - var usages = this._variableUsages.get(node); - - if (!usages) { - var newUsages = []; - var typeInfo = new TypeInfo(this._schema); - visit(node, visitWithTypeInfo(typeInfo, { - VariableDefinition: function VariableDefinition() { - return false; - }, - Variable: function Variable(variable) { - newUsages.push({ - node: variable, - type: typeInfo.getInputType(), - defaultValue: typeInfo.getDefaultValue() - }); - } - })); - usages = newUsages; - - this._variableUsages.set(node, usages); - } - - return usages; - }; - - _proto3.getRecursiveVariableUsages = function getRecursiveVariableUsages(operation) { - var usages = this._recursiveVariableUsages.get(operation); - - if (!usages) { - usages = this.getVariableUsages(operation); - - for (var _i6 = 0, _this$getRecursivelyR2 = this.getRecursivelyReferencedFragments(operation); _i6 < _this$getRecursivelyR2.length; _i6++) { - var frag = _this$getRecursivelyR2[_i6]; - usages = usages.concat(this.getVariableUsages(frag)); - } - - this._recursiveVariableUsages.set(operation, usages); - } - - return usages; - }; - - _proto3.getType = function getType() { - return this._typeInfo.getType(); - }; - - _proto3.getParentType = function getParentType() { - return this._typeInfo.getParentType(); - }; - - _proto3.getInputType = function getInputType() { - return this._typeInfo.getInputType(); - }; - - _proto3.getParentInputType = function getParentInputType() { - return this._typeInfo.getParentInputType(); - }; - - _proto3.getFieldDef = function getFieldDef() { - return this._typeInfo.getFieldDef(); - }; - - _proto3.getDirective = function getDirective() { - return this._typeInfo.getDirective(); - }; - - _proto3.getArgument = function getArgument() { - return this._typeInfo.getArgument(); - }; - - _proto3.getEnumValue = function getEnumValue() { - return this._typeInfo.getEnumValue(); - }; - - return ValidationContext; -}(ASTValidationContext); diff --git a/node_modules/graphql/validation/index.d.ts b/node_modules/graphql/validation/index.d.ts deleted file mode 100644 index f049bf39..00000000 --- a/node_modules/graphql/validation/index.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -export { validate } from './validate'; - -export { ValidationContext, ValidationRule } from './ValidationContext'; - -export { specifiedRules } from './specifiedRules'; - -// Spec Section: "Executable Definitions" -export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; - -// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; - -// Spec Section: "Fragments on Composite Types" -export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; - -// Spec Section: "Argument Names" -export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule'; - -// Spec Section: "Directives Are Defined" -export { KnownDirectivesRule } from './rules/KnownDirectivesRule'; - -// Spec Section: "Fragment spread target defined" -export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; - -// Spec Section: "Fragment Spread Type Existence" -export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; - -// Spec Section: "Lone Anonymous Operation" -export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; - -// Spec Section: "Fragments must not form cycles" -export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; - -// Spec Section: "All Variable Used Defined" -export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; - -// Spec Section: "Fragments must be used" -export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; - -// Spec Section: "All Variables Used" -export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; - -// Spec Section: "Field Selection Merging" -export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; - -// Spec Section: "Fragment spread is possible" -export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; - -// Spec Section: "Argument Optionality" -export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule'; - -// Spec Section: "Leaf Field Selections" -export { ScalarLeafsRule } from './rules/ScalarLeafsRule'; - -// Spec Section: "Subscriptions with Single Root Field" -export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; - -// Spec Section: "Argument Uniqueness" -export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; - -// Spec Section: "Directives Are Unique Per Location" -export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; - -// Spec Section: "Fragment Name Uniqueness" -export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; - -// Spec Section: "Input Object Field Uniqueness" -export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; - -// Spec Section: "Operation Name Uniqueness" -export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; - -// Spec Section: "Variable Uniqueness" -export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; - -// Spec Section: "Values Type Correctness" -export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; - -// Spec Section: "Variables are Input Types" -export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; - -// Spec Section: "All Variable Usages Are Allowed" -export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; - -// SDL-specific validation rules -export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; -export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; -export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; -export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; -export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; -export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; -export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; - -// Optional rules not defined by the GraphQL Specification -export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule'; -export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule'; diff --git a/node_modules/graphql/validation/index.js b/node_modules/graphql/validation/index.js deleted file mode 100644 index a36e4a93..00000000 --- a/node_modules/graphql/validation/index.js +++ /dev/null @@ -1,309 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "validate", { - enumerable: true, - get: function get() { - return _validate.validate; - } -}); -Object.defineProperty(exports, "ValidationContext", { - enumerable: true, - get: function get() { - return _ValidationContext.ValidationContext; - } -}); -Object.defineProperty(exports, "specifiedRules", { - enumerable: true, - get: function get() { - return _specifiedRules.specifiedRules; - } -}); -Object.defineProperty(exports, "ExecutableDefinitionsRule", { - enumerable: true, - get: function get() { - return _ExecutableDefinitionsRule.ExecutableDefinitionsRule; - } -}); -Object.defineProperty(exports, "FieldsOnCorrectTypeRule", { - enumerable: true, - get: function get() { - return _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule; - } -}); -Object.defineProperty(exports, "FragmentsOnCompositeTypesRule", { - enumerable: true, - get: function get() { - return _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule; - } -}); -Object.defineProperty(exports, "KnownArgumentNamesRule", { - enumerable: true, - get: function get() { - return _KnownArgumentNamesRule.KnownArgumentNamesRule; - } -}); -Object.defineProperty(exports, "KnownDirectivesRule", { - enumerable: true, - get: function get() { - return _KnownDirectivesRule.KnownDirectivesRule; - } -}); -Object.defineProperty(exports, "KnownFragmentNamesRule", { - enumerable: true, - get: function get() { - return _KnownFragmentNamesRule.KnownFragmentNamesRule; - } -}); -Object.defineProperty(exports, "KnownTypeNamesRule", { - enumerable: true, - get: function get() { - return _KnownTypeNamesRule.KnownTypeNamesRule; - } -}); -Object.defineProperty(exports, "LoneAnonymousOperationRule", { - enumerable: true, - get: function get() { - return _LoneAnonymousOperationRule.LoneAnonymousOperationRule; - } -}); -Object.defineProperty(exports, "NoFragmentCyclesRule", { - enumerable: true, - get: function get() { - return _NoFragmentCyclesRule.NoFragmentCyclesRule; - } -}); -Object.defineProperty(exports, "NoUndefinedVariablesRule", { - enumerable: true, - get: function get() { - return _NoUndefinedVariablesRule.NoUndefinedVariablesRule; - } -}); -Object.defineProperty(exports, "NoUnusedFragmentsRule", { - enumerable: true, - get: function get() { - return _NoUnusedFragmentsRule.NoUnusedFragmentsRule; - } -}); -Object.defineProperty(exports, "NoUnusedVariablesRule", { - enumerable: true, - get: function get() { - return _NoUnusedVariablesRule.NoUnusedVariablesRule; - } -}); -Object.defineProperty(exports, "OverlappingFieldsCanBeMergedRule", { - enumerable: true, - get: function get() { - return _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule; - } -}); -Object.defineProperty(exports, "PossibleFragmentSpreadsRule", { - enumerable: true, - get: function get() { - return _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule; - } -}); -Object.defineProperty(exports, "ProvidedRequiredArgumentsRule", { - enumerable: true, - get: function get() { - return _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule; - } -}); -Object.defineProperty(exports, "ScalarLeafsRule", { - enumerable: true, - get: function get() { - return _ScalarLeafsRule.ScalarLeafsRule; - } -}); -Object.defineProperty(exports, "SingleFieldSubscriptionsRule", { - enumerable: true, - get: function get() { - return _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule; - } -}); -Object.defineProperty(exports, "UniqueArgumentNamesRule", { - enumerable: true, - get: function get() { - return _UniqueArgumentNamesRule.UniqueArgumentNamesRule; - } -}); -Object.defineProperty(exports, "UniqueDirectivesPerLocationRule", { - enumerable: true, - get: function get() { - return _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule; - } -}); -Object.defineProperty(exports, "UniqueFragmentNamesRule", { - enumerable: true, - get: function get() { - return _UniqueFragmentNamesRule.UniqueFragmentNamesRule; - } -}); -Object.defineProperty(exports, "UniqueInputFieldNamesRule", { - enumerable: true, - get: function get() { - return _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule; - } -}); -Object.defineProperty(exports, "UniqueOperationNamesRule", { - enumerable: true, - get: function get() { - return _UniqueOperationNamesRule.UniqueOperationNamesRule; - } -}); -Object.defineProperty(exports, "UniqueVariableNamesRule", { - enumerable: true, - get: function get() { - return _UniqueVariableNamesRule.UniqueVariableNamesRule; - } -}); -Object.defineProperty(exports, "ValuesOfCorrectTypeRule", { - enumerable: true, - get: function get() { - return _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule; - } -}); -Object.defineProperty(exports, "VariablesAreInputTypesRule", { - enumerable: true, - get: function get() { - return _VariablesAreInputTypesRule.VariablesAreInputTypesRule; - } -}); -Object.defineProperty(exports, "VariablesInAllowedPositionRule", { - enumerable: true, - get: function get() { - return _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule; - } -}); -Object.defineProperty(exports, "LoneSchemaDefinitionRule", { - enumerable: true, - get: function get() { - return _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule; - } -}); -Object.defineProperty(exports, "UniqueOperationTypesRule", { - enumerable: true, - get: function get() { - return _UniqueOperationTypesRule.UniqueOperationTypesRule; - } -}); -Object.defineProperty(exports, "UniqueTypeNamesRule", { - enumerable: true, - get: function get() { - return _UniqueTypeNamesRule.UniqueTypeNamesRule; - } -}); -Object.defineProperty(exports, "UniqueEnumValueNamesRule", { - enumerable: true, - get: function get() { - return _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule; - } -}); -Object.defineProperty(exports, "UniqueFieldDefinitionNamesRule", { - enumerable: true, - get: function get() { - return _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule; - } -}); -Object.defineProperty(exports, "UniqueDirectiveNamesRule", { - enumerable: true, - get: function get() { - return _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule; - } -}); -Object.defineProperty(exports, "PossibleTypeExtensionsRule", { - enumerable: true, - get: function get() { - return _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule; - } -}); -Object.defineProperty(exports, "NoDeprecatedCustomRule", { - enumerable: true, - get: function get() { - return _NoDeprecatedCustomRule.NoDeprecatedCustomRule; - } -}); -Object.defineProperty(exports, "NoSchemaIntrospectionCustomRule", { - enumerable: true, - get: function get() { - return _NoSchemaIntrospectionCustomRule.NoSchemaIntrospectionCustomRule; - } -}); - -var _validate = require("./validate.js"); - -var _ValidationContext = require("./ValidationContext.js"); - -var _specifiedRules = require("./specifiedRules.js"); - -var _ExecutableDefinitionsRule = require("./rules/ExecutableDefinitionsRule.js"); - -var _FieldsOnCorrectTypeRule = require("./rules/FieldsOnCorrectTypeRule.js"); - -var _FragmentsOnCompositeTypesRule = require("./rules/FragmentsOnCompositeTypesRule.js"); - -var _KnownArgumentNamesRule = require("./rules/KnownArgumentNamesRule.js"); - -var _KnownDirectivesRule = require("./rules/KnownDirectivesRule.js"); - -var _KnownFragmentNamesRule = require("./rules/KnownFragmentNamesRule.js"); - -var _KnownTypeNamesRule = require("./rules/KnownTypeNamesRule.js"); - -var _LoneAnonymousOperationRule = require("./rules/LoneAnonymousOperationRule.js"); - -var _NoFragmentCyclesRule = require("./rules/NoFragmentCyclesRule.js"); - -var _NoUndefinedVariablesRule = require("./rules/NoUndefinedVariablesRule.js"); - -var _NoUnusedFragmentsRule = require("./rules/NoUnusedFragmentsRule.js"); - -var _NoUnusedVariablesRule = require("./rules/NoUnusedVariablesRule.js"); - -var _OverlappingFieldsCanBeMergedRule = require("./rules/OverlappingFieldsCanBeMergedRule.js"); - -var _PossibleFragmentSpreadsRule = require("./rules/PossibleFragmentSpreadsRule.js"); - -var _ProvidedRequiredArgumentsRule = require("./rules/ProvidedRequiredArgumentsRule.js"); - -var _ScalarLeafsRule = require("./rules/ScalarLeafsRule.js"); - -var _SingleFieldSubscriptionsRule = require("./rules/SingleFieldSubscriptionsRule.js"); - -var _UniqueArgumentNamesRule = require("./rules/UniqueArgumentNamesRule.js"); - -var _UniqueDirectivesPerLocationRule = require("./rules/UniqueDirectivesPerLocationRule.js"); - -var _UniqueFragmentNamesRule = require("./rules/UniqueFragmentNamesRule.js"); - -var _UniqueInputFieldNamesRule = require("./rules/UniqueInputFieldNamesRule.js"); - -var _UniqueOperationNamesRule = require("./rules/UniqueOperationNamesRule.js"); - -var _UniqueVariableNamesRule = require("./rules/UniqueVariableNamesRule.js"); - -var _ValuesOfCorrectTypeRule = require("./rules/ValuesOfCorrectTypeRule.js"); - -var _VariablesAreInputTypesRule = require("./rules/VariablesAreInputTypesRule.js"); - -var _VariablesInAllowedPositionRule = require("./rules/VariablesInAllowedPositionRule.js"); - -var _LoneSchemaDefinitionRule = require("./rules/LoneSchemaDefinitionRule.js"); - -var _UniqueOperationTypesRule = require("./rules/UniqueOperationTypesRule.js"); - -var _UniqueTypeNamesRule = require("./rules/UniqueTypeNamesRule.js"); - -var _UniqueEnumValueNamesRule = require("./rules/UniqueEnumValueNamesRule.js"); - -var _UniqueFieldDefinitionNamesRule = require("./rules/UniqueFieldDefinitionNamesRule.js"); - -var _UniqueDirectiveNamesRule = require("./rules/UniqueDirectiveNamesRule.js"); - -var _PossibleTypeExtensionsRule = require("./rules/PossibleTypeExtensionsRule.js"); - -var _NoDeprecatedCustomRule = require("./rules/custom/NoDeprecatedCustomRule.js"); - -var _NoSchemaIntrospectionCustomRule = require("./rules/custom/NoSchemaIntrospectionCustomRule.js"); diff --git a/node_modules/graphql/validation/index.js.flow b/node_modules/graphql/validation/index.js.flow deleted file mode 100644 index 3def6496..00000000 --- a/node_modules/graphql/validation/index.js.flow +++ /dev/null @@ -1,99 +0,0 @@ -// @flow strict -export { validate } from './validate'; - -export { ValidationContext } from './ValidationContext'; -export type { ValidationRule } from './ValidationContext'; - -// All validation rules in the GraphQL Specification. -export { specifiedRules } from './specifiedRules'; - -// Spec Section: "Executable Definitions" -export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; - -// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; - -// Spec Section: "Fragments on Composite Types" -export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; - -// Spec Section: "Argument Names" -export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule'; - -// Spec Section: "Directives Are Defined" -export { KnownDirectivesRule } from './rules/KnownDirectivesRule'; - -// Spec Section: "Fragment spread target defined" -export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; - -// Spec Section: "Fragment Spread Type Existence" -export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; - -// Spec Section: "Lone Anonymous Operation" -export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; - -// Spec Section: "Fragments must not form cycles" -export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; - -// Spec Section: "All Variable Used Defined" -export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; - -// Spec Section: "Fragments must be used" -export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; - -// Spec Section: "All Variables Used" -export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; - -// Spec Section: "Field Selection Merging" -export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; - -// Spec Section: "Fragment spread is possible" -export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; - -// Spec Section: "Argument Optionality" -export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule'; - -// Spec Section: "Leaf Field Selections" -export { ScalarLeafsRule } from './rules/ScalarLeafsRule'; - -// Spec Section: "Subscriptions with Single Root Field" -export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; - -// Spec Section: "Argument Uniqueness" -export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; - -// Spec Section: "Directives Are Unique Per Location" -export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; - -// Spec Section: "Fragment Name Uniqueness" -export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; - -// Spec Section: "Input Object Field Uniqueness" -export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; - -// Spec Section: "Operation Name Uniqueness" -export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; - -// Spec Section: "Variable Uniqueness" -export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; - -// Spec Section: "Values Type Correctness" -export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; - -// Spec Section: "Variables are Input Types" -export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; - -// Spec Section: "All Variable Usages Are Allowed" -export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; - -// SDL-specific validation rules -export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; -export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; -export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; -export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; -export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; -export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; -export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; - -// Optional rules not defined by the GraphQL Specification -export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule'; -export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule'; diff --git a/node_modules/graphql/validation/index.mjs b/node_modules/graphql/validation/index.mjs deleted file mode 100644 index e6a0d986..00000000 --- a/node_modules/graphql/validation/index.mjs +++ /dev/null @@ -1,67 +0,0 @@ -export { validate } from "./validate.mjs"; -export { ValidationContext } from "./ValidationContext.mjs"; -// All validation rules in the GraphQL Specification. -export { specifiedRules } from "./specifiedRules.mjs"; // Spec Section: "Executable Definitions" - -export { ExecutableDefinitionsRule } from "./rules/ExecutableDefinitionsRule.mjs"; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" - -export { FieldsOnCorrectTypeRule } from "./rules/FieldsOnCorrectTypeRule.mjs"; // Spec Section: "Fragments on Composite Types" - -export { FragmentsOnCompositeTypesRule } from "./rules/FragmentsOnCompositeTypesRule.mjs"; // Spec Section: "Argument Names" - -export { KnownArgumentNamesRule } from "./rules/KnownArgumentNamesRule.mjs"; // Spec Section: "Directives Are Defined" - -export { KnownDirectivesRule } from "./rules/KnownDirectivesRule.mjs"; // Spec Section: "Fragment spread target defined" - -export { KnownFragmentNamesRule } from "./rules/KnownFragmentNamesRule.mjs"; // Spec Section: "Fragment Spread Type Existence" - -export { KnownTypeNamesRule } from "./rules/KnownTypeNamesRule.mjs"; // Spec Section: "Lone Anonymous Operation" - -export { LoneAnonymousOperationRule } from "./rules/LoneAnonymousOperationRule.mjs"; // Spec Section: "Fragments must not form cycles" - -export { NoFragmentCyclesRule } from "./rules/NoFragmentCyclesRule.mjs"; // Spec Section: "All Variable Used Defined" - -export { NoUndefinedVariablesRule } from "./rules/NoUndefinedVariablesRule.mjs"; // Spec Section: "Fragments must be used" - -export { NoUnusedFragmentsRule } from "./rules/NoUnusedFragmentsRule.mjs"; // Spec Section: "All Variables Used" - -export { NoUnusedVariablesRule } from "./rules/NoUnusedVariablesRule.mjs"; // Spec Section: "Field Selection Merging" - -export { OverlappingFieldsCanBeMergedRule } from "./rules/OverlappingFieldsCanBeMergedRule.mjs"; // Spec Section: "Fragment spread is possible" - -export { PossibleFragmentSpreadsRule } from "./rules/PossibleFragmentSpreadsRule.mjs"; // Spec Section: "Argument Optionality" - -export { ProvidedRequiredArgumentsRule } from "./rules/ProvidedRequiredArgumentsRule.mjs"; // Spec Section: "Leaf Field Selections" - -export { ScalarLeafsRule } from "./rules/ScalarLeafsRule.mjs"; // Spec Section: "Subscriptions with Single Root Field" - -export { SingleFieldSubscriptionsRule } from "./rules/SingleFieldSubscriptionsRule.mjs"; // Spec Section: "Argument Uniqueness" - -export { UniqueArgumentNamesRule } from "./rules/UniqueArgumentNamesRule.mjs"; // Spec Section: "Directives Are Unique Per Location" - -export { UniqueDirectivesPerLocationRule } from "./rules/UniqueDirectivesPerLocationRule.mjs"; // Spec Section: "Fragment Name Uniqueness" - -export { UniqueFragmentNamesRule } from "./rules/UniqueFragmentNamesRule.mjs"; // Spec Section: "Input Object Field Uniqueness" - -export { UniqueInputFieldNamesRule } from "./rules/UniqueInputFieldNamesRule.mjs"; // Spec Section: "Operation Name Uniqueness" - -export { UniqueOperationNamesRule } from "./rules/UniqueOperationNamesRule.mjs"; // Spec Section: "Variable Uniqueness" - -export { UniqueVariableNamesRule } from "./rules/UniqueVariableNamesRule.mjs"; // Spec Section: "Values Type Correctness" - -export { ValuesOfCorrectTypeRule } from "./rules/ValuesOfCorrectTypeRule.mjs"; // Spec Section: "Variables are Input Types" - -export { VariablesAreInputTypesRule } from "./rules/VariablesAreInputTypesRule.mjs"; // Spec Section: "All Variable Usages Are Allowed" - -export { VariablesInAllowedPositionRule } from "./rules/VariablesInAllowedPositionRule.mjs"; // SDL-specific validation rules - -export { LoneSchemaDefinitionRule } from "./rules/LoneSchemaDefinitionRule.mjs"; -export { UniqueOperationTypesRule } from "./rules/UniqueOperationTypesRule.mjs"; -export { UniqueTypeNamesRule } from "./rules/UniqueTypeNamesRule.mjs"; -export { UniqueEnumValueNamesRule } from "./rules/UniqueEnumValueNamesRule.mjs"; -export { UniqueFieldDefinitionNamesRule } from "./rules/UniqueFieldDefinitionNamesRule.mjs"; -export { UniqueDirectiveNamesRule } from "./rules/UniqueDirectiveNamesRule.mjs"; -export { PossibleTypeExtensionsRule } from "./rules/PossibleTypeExtensionsRule.mjs"; // Optional rules not defined by the GraphQL Specification - -export { NoDeprecatedCustomRule } from "./rules/custom/NoDeprecatedCustomRule.mjs"; -export { NoSchemaIntrospectionCustomRule } from "./rules/custom/NoSchemaIntrospectionCustomRule.mjs"; diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitions.d.ts b/node_modules/graphql/validation/rules/ExecutableDefinitions.d.ts deleted file mode 100644 index 94557ad8..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitions.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { ExecutableDefinitionsRule } from 'graphql' - * or - * import { ExecutableDefinitionsRule } from 'graphql/validation' - */ -export { ExecutableDefinitionsRule as ExecutableDefinitions } from './ExecutableDefinitionsRule'; diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitions.js b/node_modules/graphql/validation/rules/ExecutableDefinitions.js deleted file mode 100644 index ed8c46be..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitions.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "ExecutableDefinitions", { - enumerable: true, - get: function get() { - return _ExecutableDefinitionsRule.ExecutableDefinitionsRule; - } -}); - -var _ExecutableDefinitionsRule = require("./ExecutableDefinitionsRule.js"); diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitions.js.flow b/node_modules/graphql/validation/rules/ExecutableDefinitions.js.flow deleted file mode 100644 index aac4efb7..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitions.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { ExecutableDefinitionsRule } from 'graphql' - * or - * import { ExecutableDefinitionsRule } from 'graphql/validation' - */ -export { ExecutableDefinitionsRule as ExecutableDefinitions } from './ExecutableDefinitionsRule'; diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitions.mjs b/node_modules/graphql/validation/rules/ExecutableDefinitions.mjs deleted file mode 100644 index 9dc914e4..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitions.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { ExecutableDefinitionsRule } from 'graphql' - * or - * import { ExecutableDefinitionsRule } from 'graphql/validation' - */ -export { ExecutableDefinitionsRule as ExecutableDefinitions } from "./ExecutableDefinitionsRule.mjs"; diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts b/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts deleted file mode 100644 index 9709256c..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -export function ExecutableDefinitionsRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js b/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js deleted file mode 100644 index 0c070a8e..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ExecutableDefinitionsRule = ExecutableDefinitionsRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _predicates = require("../../language/predicates.js"); - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -function ExecutableDefinitionsRule(context) { - return { - Document: function Document(node) { - for (var _i2 = 0, _node$definitions2 = node.definitions; _i2 < _node$definitions2.length; _i2++) { - var definition = _node$definitions2[_i2]; - - if (!(0, _predicates.isExecutableDefinitionNode)(definition)) { - var defName = definition.kind === _kinds.Kind.SCHEMA_DEFINITION || definition.kind === _kinds.Kind.SCHEMA_EXTENSION ? 'schema' : '"' + definition.name.value + '"'; - context.reportError(new _GraphQLError.GraphQLError("The ".concat(defName, " definition is not executable."), definition)); - } - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js.flow b/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js.flow deleted file mode 100644 index 06c0d52d..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { Kind } from '../../language/kinds'; -import { isExecutableDefinitionNode } from '../../language/predicates'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -export function ExecutableDefinitionsRule( - context: ASTValidationContext, -): ASTVisitor { - return { - Document(node) { - for (const definition of node.definitions) { - if (!isExecutableDefinitionNode(definition)) { - const defName = - definition.kind === Kind.SCHEMA_DEFINITION || - definition.kind === Kind.SCHEMA_EXTENSION - ? 'schema' - : '"' + definition.name.value + '"'; - context.reportError( - new GraphQLError( - `The ${defName} definition is not executable.`, - definition, - ), - ); - } - } - return false; - }, - }; -} diff --git a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs b/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs deleted file mode 100644 index c47b9965..00000000 --- a/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isExecutableDefinitionNode } from "../../language/predicates.mjs"; - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -export function ExecutableDefinitionsRule(context) { - return { - Document: function Document(node) { - for (var _i2 = 0, _node$definitions2 = node.definitions; _i2 < _node$definitions2.length; _i2++) { - var definition = _node$definitions2[_i2]; - - if (!isExecutableDefinitionNode(definition)) { - var defName = definition.kind === Kind.SCHEMA_DEFINITION || definition.kind === Kind.SCHEMA_EXTENSION ? 'schema' : '"' + definition.name.value + '"'; - context.reportError(new GraphQLError("The ".concat(defName, " definition is not executable."), definition)); - } - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts b/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts deleted file mode 100644 index 6091c6ce..00000000 --- a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -export function FieldsOnCorrectTypeRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js b/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js deleted file mode 100644 index 0f7ae7a5..00000000 --- a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +++ /dev/null @@ -1,130 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.FieldsOnCorrectTypeRule = FieldsOnCorrectTypeRule; - -var _arrayFrom = _interopRequireDefault(require("../../polyfills/arrayFrom.js")); - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -function FieldsOnCorrectTypeRule(context) { - return { - Field: function Field(node) { - var type = context.getParentType(); - - if (type) { - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - // This field doesn't exist, lets look for suggestions. - var schema = context.getSchema(); - var fieldName = node.name.value; // First determine if there are any suggested types to condition on. - - var suggestion = (0, _didYouMean.default)('to use an inline fragment on', getSuggestedTypeNames(schema, type, fieldName)); // If there are no suggested types, then perhaps this was a typo? - - if (suggestion === '') { - suggestion = (0, _didYouMean.default)(getSuggestedFieldNames(type, fieldName)); - } // Report an error, including helpful suggestions. - - - context.reportError(new _GraphQLError.GraphQLError("Cannot query field \"".concat(fieldName, "\" on type \"").concat(type.name, "\".") + suggestion, node)); - } - } - } - }; -} -/** - * Go through all of the implementations of type, as well as the interfaces that - * they implement. If any of those types include the provided field, suggest them, - * sorted by how often the type is referenced. - */ - - -function getSuggestedTypeNames(schema, type, fieldName) { - if (!(0, _definition.isAbstractType)(type)) { - // Must be an Object type, which does not have possible fields. - return []; - } - - var suggestedTypes = new Set(); - var usageCount = Object.create(null); - - for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) { - var possibleType = _schema$getPossibleTy2[_i2]; - - if (!possibleType.getFields()[fieldName]) { - continue; - } // This object type defines this field. - - - suggestedTypes.add(possibleType); - usageCount[possibleType.name] = 1; - - for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) { - var _usageCount$possibleI; - - var possibleInterface = _possibleType$getInte2[_i4]; - - if (!possibleInterface.getFields()[fieldName]) { - continue; - } // This interface type defines this field. - - - suggestedTypes.add(possibleInterface); - usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1; - } - } - - return (0, _arrayFrom.default)(suggestedTypes).sort(function (typeA, typeB) { - // Suggest both interface and object types based on how common they are. - var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; - - if (usageCountDiff !== 0) { - return usageCountDiff; - } // Suggest super types first followed by subtypes - - - if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) { - return -1; - } - - if ((0, _definition.isInterfaceType)(typeB) && schema.isSubType(typeB, typeA)) { - return 1; - } - - return typeA.name.localeCompare(typeB.name); - }).map(function (x) { - return x.name; - }); -} -/** - * For the field name provided, determine if there are any similar field names - * that may be the result of a typo. - */ - - -function getSuggestedFieldNames(type, fieldName) { - if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { - var possibleFieldNames = Object.keys(type.getFields()); - return (0, _suggestionList.default)(fieldName, possibleFieldNames); - } // Otherwise, must be a Union type, which does not define fields. - - - return []; -} diff --git a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js.flow b/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js.flow deleted file mode 100644 index 836de7df..00000000 --- a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js.flow +++ /dev/null @@ -1,145 +0,0 @@ -// @flow strict -import arrayFrom from '../../polyfills/arrayFrom'; - -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { FieldNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { GraphQLSchema } from '../../type/schema'; -import type { - GraphQLOutputType, - GraphQLObjectType, - GraphQLInterfaceType, -} from '../../type/definition'; -import { - isObjectType, - isInterfaceType, - isAbstractType, -} from '../../type/definition'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -export function FieldsOnCorrectTypeRule( - context: ValidationContext, -): ASTVisitor { - return { - Field(node: FieldNode) { - const type = context.getParentType(); - if (type) { - const fieldDef = context.getFieldDef(); - if (!fieldDef) { - // This field doesn't exist, lets look for suggestions. - const schema = context.getSchema(); - const fieldName = node.name.value; - - // First determine if there are any suggested types to condition on. - let suggestion = didYouMean( - 'to use an inline fragment on', - getSuggestedTypeNames(schema, type, fieldName), - ); - - // If there are no suggested types, then perhaps this was a typo? - if (suggestion === '') { - suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); - } - - // Report an error, including helpful suggestions. - context.reportError( - new GraphQLError( - `Cannot query field "${fieldName}" on type "${type.name}".` + - suggestion, - node, - ), - ); - } - } - }, - }; -} - -/** - * Go through all of the implementations of type, as well as the interfaces that - * they implement. If any of those types include the provided field, suggest them, - * sorted by how often the type is referenced. - */ -function getSuggestedTypeNames( - schema: GraphQLSchema, - type: GraphQLOutputType, - fieldName: string, -): Array { - if (!isAbstractType(type)) { - // Must be an Object type, which does not have possible fields. - return []; - } - - const suggestedTypes: Set< - GraphQLObjectType | GraphQLInterfaceType, - > = new Set(); - const usageCount = Object.create(null); - for (const possibleType of schema.getPossibleTypes(type)) { - if (!possibleType.getFields()[fieldName]) { - continue; - } - - // This object type defines this field. - suggestedTypes.add(possibleType); - usageCount[possibleType.name] = 1; - - for (const possibleInterface of possibleType.getInterfaces()) { - if (!possibleInterface.getFields()[fieldName]) { - continue; - } - - // This interface type defines this field. - suggestedTypes.add(possibleInterface); - usageCount[possibleInterface.name] = - (usageCount[possibleInterface.name] ?? 0) + 1; - } - } - - return arrayFrom(suggestedTypes) - .sort((typeA, typeB) => { - // Suggest both interface and object types based on how common they are. - const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; - if (usageCountDiff !== 0) { - return usageCountDiff; - } - - // Suggest super types first followed by subtypes - if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { - return -1; - } - if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { - return 1; - } - - return typeA.name.localeCompare(typeB.name); - }) - .map((x) => x.name); -} - -/** - * For the field name provided, determine if there are any similar field names - * that may be the result of a typo. - */ -function getSuggestedFieldNames( - type: GraphQLOutputType, - fieldName: string, -): Array { - if (isObjectType(type) || isInterfaceType(type)) { - const possibleFieldNames = Object.keys(type.getFields()); - return suggestionList(fieldName, possibleFieldNames); - } - // Otherwise, must be a Union type, which does not define fields. - return []; -} diff --git a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs b/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs deleted file mode 100644 index 7e01058b..00000000 --- a/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs +++ /dev/null @@ -1,116 +0,0 @@ -import arrayFrom from "../../polyfills/arrayFrom.mjs"; -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isObjectType, isInterfaceType, isAbstractType } from "../../type/definition.mjs"; - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -export function FieldsOnCorrectTypeRule(context) { - return { - Field: function Field(node) { - var type = context.getParentType(); - - if (type) { - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - // This field doesn't exist, lets look for suggestions. - var schema = context.getSchema(); - var fieldName = node.name.value; // First determine if there are any suggested types to condition on. - - var suggestion = didYouMean('to use an inline fragment on', getSuggestedTypeNames(schema, type, fieldName)); // If there are no suggested types, then perhaps this was a typo? - - if (suggestion === '') { - suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); - } // Report an error, including helpful suggestions. - - - context.reportError(new GraphQLError("Cannot query field \"".concat(fieldName, "\" on type \"").concat(type.name, "\".") + suggestion, node)); - } - } - } - }; -} -/** - * Go through all of the implementations of type, as well as the interfaces that - * they implement. If any of those types include the provided field, suggest them, - * sorted by how often the type is referenced. - */ - -function getSuggestedTypeNames(schema, type, fieldName) { - if (!isAbstractType(type)) { - // Must be an Object type, which does not have possible fields. - return []; - } - - var suggestedTypes = new Set(); - var usageCount = Object.create(null); - - for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) { - var possibleType = _schema$getPossibleTy2[_i2]; - - if (!possibleType.getFields()[fieldName]) { - continue; - } // This object type defines this field. - - - suggestedTypes.add(possibleType); - usageCount[possibleType.name] = 1; - - for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) { - var _usageCount$possibleI; - - var possibleInterface = _possibleType$getInte2[_i4]; - - if (!possibleInterface.getFields()[fieldName]) { - continue; - } // This interface type defines this field. - - - suggestedTypes.add(possibleInterface); - usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1; - } - } - - return arrayFrom(suggestedTypes).sort(function (typeA, typeB) { - // Suggest both interface and object types based on how common they are. - var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; - - if (usageCountDiff !== 0) { - return usageCountDiff; - } // Suggest super types first followed by subtypes - - - if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { - return -1; - } - - if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { - return 1; - } - - return typeA.name.localeCompare(typeB.name); - }).map(function (x) { - return x.name; - }); -} -/** - * For the field name provided, determine if there are any similar field names - * that may be the result of a typo. - */ - - -function getSuggestedFieldNames(type, fieldName) { - if (isObjectType(type) || isInterfaceType(type)) { - var possibleFieldNames = Object.keys(type.getFields()); - return suggestionList(fieldName, possibleFieldNames); - } // Otherwise, must be a Union type, which does not define fields. - - - return []; -} diff --git a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts b/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts deleted file mode 100644 index 70b9b140..00000000 --- a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -export function FragmentsOnCompositeTypesRule( - context: ValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js b/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js deleted file mode 100644 index 423ffcc0..00000000 --- a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.FragmentsOnCompositeTypesRule = FragmentsOnCompositeTypesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -function FragmentsOnCompositeTypesRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var typeCondition = node.typeCondition; - - if (typeCondition) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition); - - if (type && !(0, _definition.isCompositeType)(type)) { - var typeStr = (0, _printer.print)(typeCondition); - context.reportError(new _GraphQLError.GraphQLError("Fragment cannot condition on non composite type \"".concat(typeStr, "\"."), typeCondition)); - } - } - }, - FragmentDefinition: function FragmentDefinition(node) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), node.typeCondition); - - if (type && !(0, _definition.isCompositeType)(type)) { - var typeStr = (0, _printer.print)(node.typeCondition); - context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(node.name.value, "\" cannot condition on non composite type \"").concat(typeStr, "\"."), node.typeCondition)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js.flow b/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js.flow deleted file mode 100644 index 53ed6b9d..00000000 --- a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js.flow +++ /dev/null @@ -1,52 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { print } from '../../language/printer'; - -import { isCompositeType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -export function FragmentsOnCompositeTypesRule( - context: ValidationContext, -): ASTVisitor { - return { - InlineFragment(node) { - const typeCondition = node.typeCondition; - if (typeCondition) { - const type = typeFromAST(context.getSchema(), typeCondition); - if (type && !isCompositeType(type)) { - const typeStr = print(typeCondition); - context.reportError( - new GraphQLError( - `Fragment cannot condition on non composite type "${typeStr}".`, - typeCondition, - ), - ); - } - } - }, - FragmentDefinition(node) { - const type = typeFromAST(context.getSchema(), node.typeCondition); - if (type && !isCompositeType(type)) { - const typeStr = print(node.typeCondition); - context.reportError( - new GraphQLError( - `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, - node.typeCondition, - ), - ); - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs b/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs deleted file mode 100644 index 44aaac68..00000000 --- a/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { print } from "../../language/printer.mjs"; -import { isCompositeType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -export function FragmentsOnCompositeTypesRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var typeCondition = node.typeCondition; - - if (typeCondition) { - var type = typeFromAST(context.getSchema(), typeCondition); - - if (type && !isCompositeType(type)) { - var typeStr = print(typeCondition); - context.reportError(new GraphQLError("Fragment cannot condition on non composite type \"".concat(typeStr, "\"."), typeCondition)); - } - } - }, - FragmentDefinition: function FragmentDefinition(node) { - var type = typeFromAST(context.getSchema(), node.typeCondition); - - if (type && !isCompositeType(type)) { - var typeStr = print(node.typeCondition); - context.reportError(new GraphQLError("Fragment \"".concat(node.name.value, "\" cannot condition on non composite type \"").concat(typeStr, "\"."), node.typeCondition)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts b/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts deleted file mode 100644 index 8c0f8289..00000000 --- a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; -import { ASTVisitor } from '../../language/visitor'; - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -export function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor; - -/** - * @internal - */ -export function KnownArgumentNamesOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js b/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js deleted file mode 100644 index 4742b849..00000000 --- a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownArgumentNamesRule = KnownArgumentNamesRule; -exports.KnownArgumentNamesOnDirectivesRule = KnownArgumentNamesOnDirectivesRule; - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _directives = require("../../type/directives.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -function KnownArgumentNamesRule(context) { - return _objectSpread(_objectSpread({}, KnownArgumentNamesOnDirectivesRule(context)), {}, { - Argument: function Argument(argNode) { - var argDef = context.getArgument(); - var fieldDef = context.getFieldDef(); - var parentType = context.getParentType(); - - if (!argDef && fieldDef && parentType) { - var argName = argNode.name.value; - var knownArgsNames = fieldDef.args.map(function (arg) { - return arg.name; - }); - var suggestions = (0, _suggestionList.default)(argName, knownArgsNames); - context.reportError(new _GraphQLError.GraphQLError("Unknown argument \"".concat(argName, "\" on field \"").concat(parentType.name, ".").concat(fieldDef.name, "\".") + (0, _didYouMean.default)(suggestions), argNode)); - } - } - }); -} -/** - * @internal - */ - - -function KnownArgumentNamesOnDirectivesRule(context) { - var directiveArgs = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - directiveArgs[directive.name] = directive.args.map(function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - directiveArgs[def.name.value] = argsNodes.map(function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: function Directive(directiveNode) { - var directiveName = directiveNode.name.value; - var knownArgs = directiveArgs[directiveName]; - - if (directiveNode.arguments && knownArgs) { - for (var _i6 = 0, _directiveNode$argume2 = directiveNode.arguments; _i6 < _directiveNode$argume2.length; _i6++) { - var argNode = _directiveNode$argume2[_i6]; - var argName = argNode.name.value; - - if (knownArgs.indexOf(argName) === -1) { - var suggestions = (0, _suggestionList.default)(argName, knownArgs); - context.reportError(new _GraphQLError.GraphQLError("Unknown argument \"".concat(argName, "\" on directive \"@").concat(directiveName, "\".") + (0, _didYouMean.default)(suggestions), argNode)); - } - } - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js.flow b/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js.flow deleted file mode 100644 index a5f420bc..00000000 --- a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js.flow +++ /dev/null @@ -1,98 +0,0 @@ -// @flow strict -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { Kind } from '../../language/kinds'; - -import { specifiedDirectives } from '../../type/directives'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -export function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor { - return { - // eslint-disable-next-line new-cap - ...KnownArgumentNamesOnDirectivesRule(context), - Argument(argNode) { - const argDef = context.getArgument(); - const fieldDef = context.getFieldDef(); - const parentType = context.getParentType(); - - if (!argDef && fieldDef && parentType) { - const argName = argNode.name.value; - const knownArgsNames = fieldDef.args.map((arg) => arg.name); - const suggestions = suggestionList(argName, knownArgsNames); - context.reportError( - new GraphQLError( - `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + - didYouMean(suggestions), - argNode, - ), - ); - } - }, - }; -} - -/** - * @internal - */ -export function KnownArgumentNamesOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const directiveArgs = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - directiveArgs[directive.name] = directive.args.map((arg) => arg.name); - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argsNodes = def.arguments ?? []; - - directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); - } - } - - return { - Directive(directiveNode) { - const directiveName = directiveNode.name.value; - const knownArgs = directiveArgs[directiveName]; - - if (directiveNode.arguments && knownArgs) { - for (const argNode of directiveNode.arguments) { - const argName = argNode.name.value; - if (knownArgs.indexOf(argName) === -1) { - const suggestions = suggestionList(argName, knownArgs); - context.reportError( - new GraphQLError( - `Unknown argument "${argName}" on directive "@${directiveName}".` + - didYouMean(suggestions), - argNode, - ), - ); - } - } - } - - return false; - }, - }; -} diff --git a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs b/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs deleted file mode 100644 index d21057ea..00000000 --- a/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs +++ /dev/null @@ -1,89 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -export function KnownArgumentNamesRule(context) { - return _objectSpread(_objectSpread({}, KnownArgumentNamesOnDirectivesRule(context)), {}, { - Argument: function Argument(argNode) { - var argDef = context.getArgument(); - var fieldDef = context.getFieldDef(); - var parentType = context.getParentType(); - - if (!argDef && fieldDef && parentType) { - var argName = argNode.name.value; - var knownArgsNames = fieldDef.args.map(function (arg) { - return arg.name; - }); - var suggestions = suggestionList(argName, knownArgsNames); - context.reportError(new GraphQLError("Unknown argument \"".concat(argName, "\" on field \"").concat(parentType.name, ".").concat(fieldDef.name, "\".") + didYouMean(suggestions), argNode)); - } - } - }); -} -/** - * @internal - */ - -export function KnownArgumentNamesOnDirectivesRule(context) { - var directiveArgs = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - directiveArgs[directive.name] = directive.args.map(function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - directiveArgs[def.name.value] = argsNodes.map(function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: function Directive(directiveNode) { - var directiveName = directiveNode.name.value; - var knownArgs = directiveArgs[directiveName]; - - if (directiveNode.arguments && knownArgs) { - for (var _i6 = 0, _directiveNode$argume2 = directiveNode.arguments; _i6 < _directiveNode$argume2.length; _i6++) { - var argNode = _directiveNode$argume2[_i6]; - var argName = argNode.name.value; - - if (knownArgs.indexOf(argName) === -1) { - var suggestions = suggestionList(argName, knownArgs); - context.reportError(new GraphQLError("Unknown argument \"".concat(argName, "\" on directive \"@").concat(directiveName, "\".") + didYouMean(suggestions), argNode)); - } - } - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts b/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts deleted file mode 100644 index dcb6af61..00000000 --- a/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -export function KnownDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/KnownDirectivesRule.js b/node_modules/graphql/validation/rules/KnownDirectivesRule.js deleted file mode 100644 index ef2ab61a..00000000 --- a/node_modules/graphql/validation/rules/KnownDirectivesRule.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownDirectivesRule = KnownDirectivesRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../../jsutils/invariant.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _directiveLocation = require("../../language/directiveLocation.js"); - -var _directives = require("../../type/directives.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -function KnownDirectivesRule(context) { - var locationsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - locationsMap[directive.name] = directive.locations; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - locationsMap[def.name.value] = def.locations.map(function (name) { - return name.value; - }); - } - } - - return { - Directive: function Directive(node, _key, _parent, _path, ancestors) { - var name = node.name.value; - var locations = locationsMap[name]; - - if (!locations) { - context.reportError(new _GraphQLError.GraphQLError("Unknown directive \"@".concat(name, "\"."), node)); - return; - } - - var candidateLocation = getDirectiveLocationForASTPath(ancestors); - - if (candidateLocation && locations.indexOf(candidateLocation) === -1) { - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(name, "\" may not be used on ").concat(candidateLocation, "."), node)); - } - } - }; -} - -function getDirectiveLocationForASTPath(ancestors) { - var appliedTo = ancestors[ancestors.length - 1]; - !Array.isArray(appliedTo) || (0, _invariant.default)(0); - - switch (appliedTo.kind) { - case _kinds.Kind.OPERATION_DEFINITION: - return getDirectiveLocationForOperation(appliedTo.operation); - - case _kinds.Kind.FIELD: - return _directiveLocation.DirectiveLocation.FIELD; - - case _kinds.Kind.FRAGMENT_SPREAD: - return _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD; - - case _kinds.Kind.INLINE_FRAGMENT: - return _directiveLocation.DirectiveLocation.INLINE_FRAGMENT; - - case _kinds.Kind.FRAGMENT_DEFINITION: - return _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION; - - case _kinds.Kind.VARIABLE_DEFINITION: - return _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION; - - case _kinds.Kind.SCHEMA_DEFINITION: - case _kinds.Kind.SCHEMA_EXTENSION: - return _directiveLocation.DirectiveLocation.SCHEMA; - - case _kinds.Kind.SCALAR_TYPE_DEFINITION: - case _kinds.Kind.SCALAR_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.SCALAR; - - case _kinds.Kind.OBJECT_TYPE_DEFINITION: - case _kinds.Kind.OBJECT_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.OBJECT; - - case _kinds.Kind.FIELD_DEFINITION: - return _directiveLocation.DirectiveLocation.FIELD_DEFINITION; - - case _kinds.Kind.INTERFACE_TYPE_DEFINITION: - case _kinds.Kind.INTERFACE_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.INTERFACE; - - case _kinds.Kind.UNION_TYPE_DEFINITION: - case _kinds.Kind.UNION_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.UNION; - - case _kinds.Kind.ENUM_TYPE_DEFINITION: - case _kinds.Kind.ENUM_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.ENUM; - - case _kinds.Kind.ENUM_VALUE_DEFINITION: - return _directiveLocation.DirectiveLocation.ENUM_VALUE; - - case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: - case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.INPUT_OBJECT; - - case _kinds.Kind.INPUT_VALUE_DEFINITION: - { - var parentNode = ancestors[ancestors.length - 3]; - return parentNode.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION ? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION : _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION; - } - } -} - -function getDirectiveLocationForOperation(operation) { - switch (operation) { - case 'query': - return _directiveLocation.DirectiveLocation.QUERY; - - case 'mutation': - return _directiveLocation.DirectiveLocation.MUTATION; - - case 'subscription': - return _directiveLocation.DirectiveLocation.SUBSCRIPTION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected operation: ' + (0, _inspect.default)(operation)); -} diff --git a/node_modules/graphql/validation/rules/KnownDirectivesRule.js.flow b/node_modules/graphql/validation/rules/KnownDirectivesRule.js.flow deleted file mode 100644 index 79e047ab..00000000 --- a/node_modules/graphql/validation/rules/KnownDirectivesRule.js.flow +++ /dev/null @@ -1,138 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; -import invariant from '../../jsutils/invariant'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { ASTNode, OperationTypeNode } from '../../language/ast'; -import type { DirectiveLocationEnum } from '../../language/directiveLocation'; -import { Kind } from '../../language/kinds'; -import { DirectiveLocation } from '../../language/directiveLocation'; - -import { specifiedDirectives } from '../../type/directives'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -export function KnownDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const locationsMap = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - locationsMap[directive.name] = directive.locations; - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - locationsMap[def.name.value] = def.locations.map((name) => name.value); - } - } - - return { - Directive(node, _key, _parent, _path, ancestors) { - const name = node.name.value; - const locations = locationsMap[name]; - - if (!locations) { - context.reportError( - new GraphQLError(`Unknown directive "@${name}".`, node), - ); - return; - } - - const candidateLocation = getDirectiveLocationForASTPath(ancestors); - if (candidateLocation && locations.indexOf(candidateLocation) === -1) { - context.reportError( - new GraphQLError( - `Directive "@${name}" may not be used on ${candidateLocation}.`, - node, - ), - ); - } - }, - }; -} - -function getDirectiveLocationForASTPath( - ancestors: $ReadOnlyArray>, -): DirectiveLocationEnum | void { - const appliedTo = ancestors[ancestors.length - 1]; - invariant(!Array.isArray(appliedTo)); - - switch (appliedTo.kind) { - case Kind.OPERATION_DEFINITION: - return getDirectiveLocationForOperation(appliedTo.operation); - case Kind.FIELD: - return DirectiveLocation.FIELD; - case Kind.FRAGMENT_SPREAD: - return DirectiveLocation.FRAGMENT_SPREAD; - case Kind.INLINE_FRAGMENT: - return DirectiveLocation.INLINE_FRAGMENT; - case Kind.FRAGMENT_DEFINITION: - return DirectiveLocation.FRAGMENT_DEFINITION; - case Kind.VARIABLE_DEFINITION: - return DirectiveLocation.VARIABLE_DEFINITION; - case Kind.SCHEMA_DEFINITION: - case Kind.SCHEMA_EXTENSION: - return DirectiveLocation.SCHEMA; - case Kind.SCALAR_TYPE_DEFINITION: - case Kind.SCALAR_TYPE_EXTENSION: - return DirectiveLocation.SCALAR; - case Kind.OBJECT_TYPE_DEFINITION: - case Kind.OBJECT_TYPE_EXTENSION: - return DirectiveLocation.OBJECT; - case Kind.FIELD_DEFINITION: - return DirectiveLocation.FIELD_DEFINITION; - case Kind.INTERFACE_TYPE_DEFINITION: - case Kind.INTERFACE_TYPE_EXTENSION: - return DirectiveLocation.INTERFACE; - case Kind.UNION_TYPE_DEFINITION: - case Kind.UNION_TYPE_EXTENSION: - return DirectiveLocation.UNION; - case Kind.ENUM_TYPE_DEFINITION: - case Kind.ENUM_TYPE_EXTENSION: - return DirectiveLocation.ENUM; - case Kind.ENUM_VALUE_DEFINITION: - return DirectiveLocation.ENUM_VALUE; - case Kind.INPUT_OBJECT_TYPE_DEFINITION: - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return DirectiveLocation.INPUT_OBJECT; - case Kind.INPUT_VALUE_DEFINITION: { - const parentNode = ancestors[ancestors.length - 3]; - return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION - ? DirectiveLocation.INPUT_FIELD_DEFINITION - : DirectiveLocation.ARGUMENT_DEFINITION; - } - } -} - -function getDirectiveLocationForOperation( - operation: OperationTypeNode, -): DirectiveLocationEnum { - switch (operation) { - case 'query': - return DirectiveLocation.QUERY; - case 'mutation': - return DirectiveLocation.MUTATION; - case 'subscription': - return DirectiveLocation.SUBSCRIPTION; - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected operation: ' + inspect((operation: empty))); -} diff --git a/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs b/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs deleted file mode 100644 index 8889bbba..00000000 --- a/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +++ /dev/null @@ -1,134 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import invariant from "../../jsutils/invariant.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { DirectiveLocation } from "../../language/directiveLocation.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -export function KnownDirectivesRule(context) { - var locationsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - locationsMap[directive.name] = directive.locations; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - locationsMap[def.name.value] = def.locations.map(function (name) { - return name.value; - }); - } - } - - return { - Directive: function Directive(node, _key, _parent, _path, ancestors) { - var name = node.name.value; - var locations = locationsMap[name]; - - if (!locations) { - context.reportError(new GraphQLError("Unknown directive \"@".concat(name, "\"."), node)); - return; - } - - var candidateLocation = getDirectiveLocationForASTPath(ancestors); - - if (candidateLocation && locations.indexOf(candidateLocation) === -1) { - context.reportError(new GraphQLError("Directive \"@".concat(name, "\" may not be used on ").concat(candidateLocation, "."), node)); - } - } - }; -} - -function getDirectiveLocationForASTPath(ancestors) { - var appliedTo = ancestors[ancestors.length - 1]; - !Array.isArray(appliedTo) || invariant(0); - - switch (appliedTo.kind) { - case Kind.OPERATION_DEFINITION: - return getDirectiveLocationForOperation(appliedTo.operation); - - case Kind.FIELD: - return DirectiveLocation.FIELD; - - case Kind.FRAGMENT_SPREAD: - return DirectiveLocation.FRAGMENT_SPREAD; - - case Kind.INLINE_FRAGMENT: - return DirectiveLocation.INLINE_FRAGMENT; - - case Kind.FRAGMENT_DEFINITION: - return DirectiveLocation.FRAGMENT_DEFINITION; - - case Kind.VARIABLE_DEFINITION: - return DirectiveLocation.VARIABLE_DEFINITION; - - case Kind.SCHEMA_DEFINITION: - case Kind.SCHEMA_EXTENSION: - return DirectiveLocation.SCHEMA; - - case Kind.SCALAR_TYPE_DEFINITION: - case Kind.SCALAR_TYPE_EXTENSION: - return DirectiveLocation.SCALAR; - - case Kind.OBJECT_TYPE_DEFINITION: - case Kind.OBJECT_TYPE_EXTENSION: - return DirectiveLocation.OBJECT; - - case Kind.FIELD_DEFINITION: - return DirectiveLocation.FIELD_DEFINITION; - - case Kind.INTERFACE_TYPE_DEFINITION: - case Kind.INTERFACE_TYPE_EXTENSION: - return DirectiveLocation.INTERFACE; - - case Kind.UNION_TYPE_DEFINITION: - case Kind.UNION_TYPE_EXTENSION: - return DirectiveLocation.UNION; - - case Kind.ENUM_TYPE_DEFINITION: - case Kind.ENUM_TYPE_EXTENSION: - return DirectiveLocation.ENUM; - - case Kind.ENUM_VALUE_DEFINITION: - return DirectiveLocation.ENUM_VALUE; - - case Kind.INPUT_OBJECT_TYPE_DEFINITION: - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return DirectiveLocation.INPUT_OBJECT; - - case Kind.INPUT_VALUE_DEFINITION: - { - var parentNode = ancestors[ancestors.length - 3]; - return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? DirectiveLocation.INPUT_FIELD_DEFINITION : DirectiveLocation.ARGUMENT_DEFINITION; - } - } -} - -function getDirectiveLocationForOperation(operation) { - switch (operation) { - case 'query': - return DirectiveLocation.QUERY; - - case 'mutation': - return DirectiveLocation.MUTATION; - - case 'subscription': - return DirectiveLocation.SUBSCRIPTION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected operation: ' + inspect(operation)); -} diff --git a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts b/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts deleted file mode 100644 index 7b594fd9..00000000 --- a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -export function KnownFragmentNamesRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js b/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js deleted file mode 100644 index 2902ef45..00000000 --- a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownFragmentNamesRule = KnownFragmentNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -function KnownFragmentNamesRule(context) { - return { - FragmentSpread: function FragmentSpread(node) { - var fragmentName = node.name.value; - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - context.reportError(new _GraphQLError.GraphQLError("Unknown fragment \"".concat(fragmentName, "\"."), node.name)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js.flow b/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js.flow deleted file mode 100644 index 0c02736a..00000000 --- a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js.flow +++ /dev/null @@ -1,26 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -export function KnownFragmentNamesRule(context: ValidationContext): ASTVisitor { - return { - FragmentSpread(node) { - const fragmentName = node.name.value; - const fragment = context.getFragment(fragmentName); - if (!fragment) { - context.reportError( - new GraphQLError(`Unknown fragment "${fragmentName}".`, node.name), - ); - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs b/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs deleted file mode 100644 index 72f935d8..00000000 --- a/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -export function KnownFragmentNamesRule(context) { - return { - FragmentSpread: function FragmentSpread(node) { - var fragmentName = node.name.value; - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - context.reportError(new GraphQLError("Unknown fragment \"".concat(fragmentName, "\"."), node.name)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts b/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts deleted file mode 100644 index b7cd75d4..00000000 --- a/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -export function KnownTypeNamesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/KnownTypeNamesRule.js b/node_modules/graphql/validation/rules/KnownTypeNamesRule.js deleted file mode 100644 index 249e3d66..00000000 --- a/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownTypeNamesRule = KnownTypeNamesRule; - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _predicates = require("../../language/predicates.js"); - -var _scalars = require("../../type/scalars.js"); - -var _introspection = require("../../type/introspection.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -function KnownTypeNamesRule(context) { - var schema = context.getSchema(); - var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if ((0, _predicates.isTypeDefinitionNode)(def)) { - definedTypes[def.name.value] = true; - } - } - - var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes)); - return { - NamedType: function NamedType(node, _1, parent, _2, ancestors) { - var typeName = node.name.value; - - if (!existingTypesMap[typeName] && !definedTypes[typeName]) { - var _ancestors$; - - var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent; - var isSDL = definitionNode != null && isSDLNode(definitionNode); - - if (isSDL && isStandardTypeName(typeName)) { - return; - } - - var suggestedTypes = (0, _suggestionList.default)(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames); - context.reportError(new _GraphQLError.GraphQLError("Unknown type \"".concat(typeName, "\".") + (0, _didYouMean.default)(suggestedTypes), node)); - } - } - }; -} - -var standardTypeNames = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes).map(function (type) { - return type.name; -}); - -function isStandardTypeName(typeName) { - return standardTypeNames.indexOf(typeName) !== -1; -} - -function isSDLNode(value) { - return !Array.isArray(value) && ((0, _predicates.isTypeSystemDefinitionNode)(value) || (0, _predicates.isTypeSystemExtensionNode)(value)); -} diff --git a/node_modules/graphql/validation/rules/KnownTypeNamesRule.js.flow b/node_modules/graphql/validation/rules/KnownTypeNamesRule.js.flow deleted file mode 100644 index b0120dbf..00000000 --- a/node_modules/graphql/validation/rules/KnownTypeNamesRule.js.flow +++ /dev/null @@ -1,84 +0,0 @@ -// @flow strict -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; -import { - isTypeDefinitionNode, - isTypeSystemDefinitionNode, - isTypeSystemExtensionNode, -} from '../../language/predicates'; - -import { specifiedScalarTypes } from '../../type/scalars'; -import { introspectionTypes } from '../../type/introspection'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -export function KnownTypeNamesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); - - const definedTypes = Object.create(null); - for (const def of context.getDocument().definitions) { - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = true; - } - } - - const typeNames = Object.keys(existingTypesMap).concat( - Object.keys(definedTypes), - ); - - return { - NamedType(node, _1, parent, _2, ancestors) { - const typeName = node.name.value; - if (!existingTypesMap[typeName] && !definedTypes[typeName]) { - const definitionNode = ancestors[2] ?? parent; - const isSDL = definitionNode != null && isSDLNode(definitionNode); - if (isSDL && isStandardTypeName(typeName)) { - return; - } - - const suggestedTypes = suggestionList( - typeName, - isSDL ? standardTypeNames.concat(typeNames) : typeNames, - ); - context.reportError( - new GraphQLError( - `Unknown type "${typeName}".` + didYouMean(suggestedTypes), - node, - ), - ); - } - }, - }; -} - -const standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map( - (type) => type.name, -); - -function isStandardTypeName(typeName: string): boolean { - return standardTypeNames.indexOf(typeName) !== -1; -} - -function isSDLNode(value: ASTNode | $ReadOnlyArray): boolean { - return ( - !Array.isArray(value) && - (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)) - ); -} diff --git a/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs b/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs deleted file mode 100644 index 69116f52..00000000 --- a/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs +++ /dev/null @@ -1,58 +0,0 @@ -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isTypeDefinitionNode, isTypeSystemDefinitionNode, isTypeSystemExtensionNode } from "../../language/predicates.mjs"; -import { specifiedScalarTypes } from "../../type/scalars.mjs"; -import { introspectionTypes } from "../../type/introspection.mjs"; - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -export function KnownTypeNamesRule(context) { - var schema = context.getSchema(); - var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = true; - } - } - - var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes)); - return { - NamedType: function NamedType(node, _1, parent, _2, ancestors) { - var typeName = node.name.value; - - if (!existingTypesMap[typeName] && !definedTypes[typeName]) { - var _ancestors$; - - var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent; - var isSDL = definitionNode != null && isSDLNode(definitionNode); - - if (isSDL && isStandardTypeName(typeName)) { - return; - } - - var suggestedTypes = suggestionList(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames); - context.reportError(new GraphQLError("Unknown type \"".concat(typeName, "\".") + didYouMean(suggestedTypes), node)); - } - } - }; -} -var standardTypeNames = [].concat(specifiedScalarTypes, introspectionTypes).map(function (type) { - return type.name; -}); - -function isStandardTypeName(typeName) { - return standardTypeNames.indexOf(typeName) !== -1; -} - -function isSDLNode(value) { - return !Array.isArray(value) && (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)); -} diff --git a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts b/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts deleted file mode 100644 index 1ac19ef4..00000000 --- a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -export function LoneAnonymousOperationRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js b/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js deleted file mode 100644 index 116a9fb3..00000000 --- a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.LoneAnonymousOperationRule = LoneAnonymousOperationRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -function LoneAnonymousOperationRule(context) { - var operationCount = 0; - return { - Document: function Document(node) { - operationCount = node.definitions.filter(function (definition) { - return definition.kind === _kinds.Kind.OPERATION_DEFINITION; - }).length; - }, - OperationDefinition: function OperationDefinition(node) { - if (!node.name && operationCount > 1) { - context.reportError(new _GraphQLError.GraphQLError('This anonymous operation must be the only defined operation.', node)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js.flow b/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js.flow deleted file mode 100644 index e6370aa6..00000000 --- a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js.flow +++ /dev/null @@ -1,36 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { Kind } from '../../language/kinds'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -export function LoneAnonymousOperationRule( - context: ASTValidationContext, -): ASTVisitor { - let operationCount = 0; - return { - Document(node) { - operationCount = node.definitions.filter( - (definition) => definition.kind === Kind.OPERATION_DEFINITION, - ).length; - }, - OperationDefinition(node) { - if (!node.name && operationCount > 1) { - context.reportError( - new GraphQLError( - 'This anonymous operation must be the only defined operation.', - node, - ), - ); - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs b/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs deleted file mode 100644 index 134322df..00000000 --- a/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -export function LoneAnonymousOperationRule(context) { - var operationCount = 0; - return { - Document: function Document(node) { - operationCount = node.definitions.filter(function (definition) { - return definition.kind === Kind.OPERATION_DEFINITION; - }).length; - }, - OperationDefinition: function OperationDefinition(node) { - if (!node.name && operationCount > 1) { - context.reportError(new GraphQLError('This anonymous operation must be the only defined operation.', node)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinition.d.ts b/node_modules/graphql/validation/rules/LoneSchemaDefinition.d.ts deleted file mode 100644 index a38ad06a..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinition.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { LoneSchemaDefinitionRule } from 'graphql' - * or - * import { LoneSchemaDefinitionRule } from 'graphql/validation' - */ -export { LoneSchemaDefinitionRule as LoneSchemaDefinition } from './LoneSchemaDefinitionRule'; diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinition.js b/node_modules/graphql/validation/rules/LoneSchemaDefinition.js deleted file mode 100644 index 55d0b20e..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinition.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "LoneSchemaDefinition", { - enumerable: true, - get: function get() { - return _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule; - } -}); - -var _LoneSchemaDefinitionRule = require("./LoneSchemaDefinitionRule.js"); diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinition.js.flow b/node_modules/graphql/validation/rules/LoneSchemaDefinition.js.flow deleted file mode 100644 index 6d0466ad..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinition.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { LoneSchemaDefinitionRule } from 'graphql' - * or - * import { LoneSchemaDefinitionRule } from 'graphql/validation' - */ -export { LoneSchemaDefinitionRule as LoneSchemaDefinition } from './LoneSchemaDefinitionRule'; diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinition.mjs b/node_modules/graphql/validation/rules/LoneSchemaDefinition.mjs deleted file mode 100644 index 5485db00..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinition.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { LoneSchemaDefinitionRule } from 'graphql' - * or - * import { LoneSchemaDefinitionRule } from 'graphql/validation' - */ -export { LoneSchemaDefinitionRule as LoneSchemaDefinition } from "./LoneSchemaDefinitionRule.mjs"; diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts b/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts deleted file mode 100644 index 5075e74e..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -export function LoneSchemaDefinitionRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js b/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js deleted file mode 100644 index ca270c16..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.LoneSchemaDefinitionRule = LoneSchemaDefinitionRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -function LoneSchemaDefinitionRule(context) { - var _ref, _ref2, _oldSchema$astNode; - - var oldSchema = context.getSchema(); - var alreadyDefined = (_ref = (_ref2 = (_oldSchema$astNode = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 ? _oldSchema$astNode : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getQueryType()) !== null && _ref2 !== void 0 ? _ref2 : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getMutationType()) !== null && _ref !== void 0 ? _ref : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getSubscriptionType(); - var schemaDefinitionsCount = 0; - return { - SchemaDefinition: function SchemaDefinition(node) { - if (alreadyDefined) { - context.reportError(new _GraphQLError.GraphQLError('Cannot define a new schema within a schema extension.', node)); - return; - } - - if (schemaDefinitionsCount > 0) { - context.reportError(new _GraphQLError.GraphQLError('Must provide only one schema definition.', node)); - } - - ++schemaDefinitionsCount; - } - }; -} diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js.flow b/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js.flow deleted file mode 100644 index 420a2a01..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js.flow +++ /dev/null @@ -1,43 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -export function LoneSchemaDefinitionRule( - context: SDLValidationContext, -): ASTVisitor { - const oldSchema = context.getSchema(); - const alreadyDefined = - oldSchema?.astNode ?? - oldSchema?.getQueryType() ?? - oldSchema?.getMutationType() ?? - oldSchema?.getSubscriptionType(); - - let schemaDefinitionsCount = 0; - return { - SchemaDefinition(node) { - if (alreadyDefined) { - context.reportError( - new GraphQLError( - 'Cannot define a new schema within a schema extension.', - node, - ), - ); - return; - } - - if (schemaDefinitionsCount > 0) { - context.reportError( - new GraphQLError('Must provide only one schema definition.', node), - ); - } - ++schemaDefinitionsCount; - }, - }; -} diff --git a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs b/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs deleted file mode 100644 index ccc5493b..00000000 --- a/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -export function LoneSchemaDefinitionRule(context) { - var _ref, _ref2, _oldSchema$astNode; - - var oldSchema = context.getSchema(); - var alreadyDefined = (_ref = (_ref2 = (_oldSchema$astNode = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 ? _oldSchema$astNode : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getQueryType()) !== null && _ref2 !== void 0 ? _ref2 : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getMutationType()) !== null && _ref !== void 0 ? _ref : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getSubscriptionType(); - var schemaDefinitionsCount = 0; - return { - SchemaDefinition: function SchemaDefinition(node) { - if (alreadyDefined) { - context.reportError(new GraphQLError('Cannot define a new schema within a schema extension.', node)); - return; - } - - if (schemaDefinitionsCount > 0) { - context.reportError(new GraphQLError('Must provide only one schema definition.', node)); - } - - ++schemaDefinitionsCount; - } - }; -} diff --git a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts b/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts deleted file mode 100644 index 85b2b106..00000000 --- a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -export function NoFragmentCyclesRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js b/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js deleted file mode 100644 index afabeb56..00000000 --- a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoFragmentCyclesRule = NoFragmentCyclesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -function NoFragmentCyclesRule(context) { - // Tracks already visited fragments to maintain O(N) and to ensure that cycles - // are not redundantly reported. - var visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors - - var spreadPath = []; // Position in the spread path - - var spreadPathIndexByName = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - detectCycleRecursive(node); - return false; - } - }; // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - - function detectCycleRecursive(fragment) { - if (visitedFrags[fragment.name.value]) { - return; - } - - var fragmentName = fragment.name.value; - visitedFrags[fragmentName] = true; - var spreadNodes = context.getFragmentSpreads(fragment.selectionSet); - - if (spreadNodes.length === 0) { - return; - } - - spreadPathIndexByName[fragmentName] = spreadPath.length; - - for (var _i2 = 0; _i2 < spreadNodes.length; _i2++) { - var spreadNode = spreadNodes[_i2]; - var spreadName = spreadNode.name.value; - var cycleIndex = spreadPathIndexByName[spreadName]; - spreadPath.push(spreadNode); - - if (cycleIndex === undefined) { - var spreadFragment = context.getFragment(spreadName); - - if (spreadFragment) { - detectCycleRecursive(spreadFragment); - } - } else { - var cyclePath = spreadPath.slice(cycleIndex); - var viaPath = cyclePath.slice(0, -1).map(function (s) { - return '"' + s.name.value + '"'; - }).join(', '); - context.reportError(new _GraphQLError.GraphQLError("Cannot spread fragment \"".concat(spreadName, "\" within itself") + (viaPath !== '' ? " via ".concat(viaPath, ".") : '.'), cyclePath)); - } - - spreadPath.pop(); - } - - spreadPathIndexByName[fragmentName] = undefined; - } -} diff --git a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js.flow b/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js.flow deleted file mode 100644 index 56873223..00000000 --- a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js.flow +++ /dev/null @@ -1,78 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { FragmentDefinitionNode } from '../../language/ast'; - -import type { ASTValidationContext } from '../ValidationContext'; - -export function NoFragmentCyclesRule( - context: ASTValidationContext, -): ASTVisitor { - // Tracks already visited fragments to maintain O(N) and to ensure that cycles - // are not redundantly reported. - const visitedFrags = Object.create(null); - - // Array of AST nodes used to produce meaningful errors - const spreadPath = []; - - // Position in the spread path - const spreadPathIndexByName = Object.create(null); - - return { - OperationDefinition: () => false, - FragmentDefinition(node) { - detectCycleRecursive(node); - return false; - }, - }; - - // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - function detectCycleRecursive(fragment: FragmentDefinitionNode): void { - if (visitedFrags[fragment.name.value]) { - return; - } - - const fragmentName = fragment.name.value; - visitedFrags[fragmentName] = true; - - const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); - if (spreadNodes.length === 0) { - return; - } - - spreadPathIndexByName[fragmentName] = spreadPath.length; - - for (const spreadNode of spreadNodes) { - const spreadName = spreadNode.name.value; - const cycleIndex = spreadPathIndexByName[spreadName]; - - spreadPath.push(spreadNode); - if (cycleIndex === undefined) { - const spreadFragment = context.getFragment(spreadName); - if (spreadFragment) { - detectCycleRecursive(spreadFragment); - } - } else { - const cyclePath = spreadPath.slice(cycleIndex); - const viaPath = cyclePath - .slice(0, -1) - .map((s) => '"' + s.name.value + '"') - .join(', '); - - context.reportError( - new GraphQLError( - `Cannot spread fragment "${spreadName}" within itself` + - (viaPath !== '' ? ` via ${viaPath}.` : '.'), - cyclePath, - ), - ); - } - spreadPath.pop(); - } - - spreadPathIndexByName[fragmentName] = undefined; - } -} diff --git a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs b/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs deleted file mode 100644 index 8d7618e7..00000000 --- a/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -export function NoFragmentCyclesRule(context) { - // Tracks already visited fragments to maintain O(N) and to ensure that cycles - // are not redundantly reported. - var visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors - - var spreadPath = []; // Position in the spread path - - var spreadPathIndexByName = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - detectCycleRecursive(node); - return false; - } - }; // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - - function detectCycleRecursive(fragment) { - if (visitedFrags[fragment.name.value]) { - return; - } - - var fragmentName = fragment.name.value; - visitedFrags[fragmentName] = true; - var spreadNodes = context.getFragmentSpreads(fragment.selectionSet); - - if (spreadNodes.length === 0) { - return; - } - - spreadPathIndexByName[fragmentName] = spreadPath.length; - - for (var _i2 = 0; _i2 < spreadNodes.length; _i2++) { - var spreadNode = spreadNodes[_i2]; - var spreadName = spreadNode.name.value; - var cycleIndex = spreadPathIndexByName[spreadName]; - spreadPath.push(spreadNode); - - if (cycleIndex === undefined) { - var spreadFragment = context.getFragment(spreadName); - - if (spreadFragment) { - detectCycleRecursive(spreadFragment); - } - } else { - var cyclePath = spreadPath.slice(cycleIndex); - var viaPath = cyclePath.slice(0, -1).map(function (s) { - return '"' + s.name.value + '"'; - }).join(', '); - context.reportError(new GraphQLError("Cannot spread fragment \"".concat(spreadName, "\" within itself") + (viaPath !== '' ? " via ".concat(viaPath, ".") : '.'), cyclePath)); - } - - spreadPath.pop(); - } - - spreadPathIndexByName[fragmentName] = undefined; - } -} diff --git a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts b/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts deleted file mode 100644 index d1a08065..00000000 --- a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -export function NoUndefinedVariablesRule( - context: ValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js b/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js deleted file mode 100644 index d3371ec5..00000000 --- a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoUndefinedVariablesRule = NoUndefinedVariablesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -function NoUndefinedVariablesRule(context) { - var variableNameDefined = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - variableNameDefined = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var varName = node.name.value; - - if (variableNameDefined[varName] !== true) { - context.reportError(new _GraphQLError.GraphQLError(operation.name ? "Variable \"$".concat(varName, "\" is not defined by operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(varName, "\" is not defined."), [node, operation])); - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - variableNameDefined[node.variable.name.value] = true; - } - }; -} diff --git a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js.flow b/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js.flow deleted file mode 100644 index 1773ada7..00000000 --- a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js.flow +++ /dev/null @@ -1,46 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -export function NoUndefinedVariablesRule( - context: ValidationContext, -): ASTVisitor { - let variableNameDefined = Object.create(null); - - return { - OperationDefinition: { - enter() { - variableNameDefined = Object.create(null); - }, - leave(operation) { - const usages = context.getRecursiveVariableUsages(operation); - - for (const { node } of usages) { - const varName = node.name.value; - if (variableNameDefined[varName] !== true) { - context.reportError( - new GraphQLError( - operation.name - ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` - : `Variable "$${varName}" is not defined.`, - [node, operation], - ), - ); - } - } - }, - }, - VariableDefinition(node) { - variableNameDefined[node.variable.name.value] = true; - }, - }; -} diff --git a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs b/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs deleted file mode 100644 index 004059f2..00000000 --- a/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -export function NoUndefinedVariablesRule(context) { - var variableNameDefined = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - variableNameDefined = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var varName = node.name.value; - - if (variableNameDefined[varName] !== true) { - context.reportError(new GraphQLError(operation.name ? "Variable \"$".concat(varName, "\" is not defined by operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(varName, "\" is not defined."), [node, operation])); - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - variableNameDefined[node.variable.name.value] = true; - } - }; -} diff --git a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts b/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts deleted file mode 100644 index 8435bab1..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -export function NoUnusedFragmentsRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js b/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js deleted file mode 100644 index 2fa3ba28..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoUnusedFragmentsRule = NoUnusedFragmentsRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -function NoUnusedFragmentsRule(context) { - var operationDefs = []; - var fragmentDefs = []; - return { - OperationDefinition: function OperationDefinition(node) { - operationDefs.push(node); - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - fragmentDefs.push(node); - return false; - }, - Document: { - leave: function leave() { - var fragmentNameUsed = Object.create(null); - - for (var _i2 = 0; _i2 < operationDefs.length; _i2++) { - var operation = operationDefs[_i2]; - - for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) { - var fragment = _context$getRecursive2[_i4]; - fragmentNameUsed[fragment.name.value] = true; - } - } - - for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) { - var fragmentDef = fragmentDefs[_i6]; - var fragName = fragmentDef.name.value; - - if (fragmentNameUsed[fragName] !== true) { - context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(fragName, "\" is never used."), fragmentDef)); - } - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js.flow b/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js.flow deleted file mode 100644 index fd5801bb..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js.flow +++ /dev/null @@ -1,54 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -export function NoUnusedFragmentsRule( - context: ASTValidationContext, -): ASTVisitor { - const operationDefs = []; - const fragmentDefs = []; - - return { - OperationDefinition(node) { - operationDefs.push(node); - return false; - }, - FragmentDefinition(node) { - fragmentDefs.push(node); - return false; - }, - Document: { - leave() { - const fragmentNameUsed = Object.create(null); - for (const operation of operationDefs) { - for (const fragment of context.getRecursivelyReferencedFragments( - operation, - )) { - fragmentNameUsed[fragment.name.value] = true; - } - } - - for (const fragmentDef of fragmentDefs) { - const fragName = fragmentDef.name.value; - if (fragmentNameUsed[fragName] !== true) { - context.reportError( - new GraphQLError( - `Fragment "${fragName}" is never used.`, - fragmentDef, - ), - ); - } - } - }, - }, - }; -} diff --git a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs b/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs deleted file mode 100644 index 1f5f8164..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs +++ /dev/null @@ -1,45 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -export function NoUnusedFragmentsRule(context) { - var operationDefs = []; - var fragmentDefs = []; - return { - OperationDefinition: function OperationDefinition(node) { - operationDefs.push(node); - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - fragmentDefs.push(node); - return false; - }, - Document: { - leave: function leave() { - var fragmentNameUsed = Object.create(null); - - for (var _i2 = 0; _i2 < operationDefs.length; _i2++) { - var operation = operationDefs[_i2]; - - for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) { - var fragment = _context$getRecursive2[_i4]; - fragmentNameUsed[fragment.name.value] = true; - } - } - - for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) { - var fragmentDef = fragmentDefs[_i6]; - var fragName = fragmentDef.name.value; - - if (fragmentNameUsed[fragName] !== true) { - context.reportError(new GraphQLError("Fragment \"".concat(fragName, "\" is never used."), fragmentDef)); - } - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts b/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts deleted file mode 100644 index 351449d8..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -export function NoUnusedVariablesRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js b/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js deleted file mode 100644 index 10fa8c82..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoUnusedVariablesRule = NoUnusedVariablesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -function NoUnusedVariablesRule(context) { - var variableDefs = []; - return { - OperationDefinition: { - enter: function enter() { - variableDefs = []; - }, - leave: function leave(operation) { - var variableNameUsed = Object.create(null); - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - variableNameUsed[node.name.value] = true; - } - - for (var _i4 = 0, _variableDefs2 = variableDefs; _i4 < _variableDefs2.length; _i4++) { - var variableDef = _variableDefs2[_i4]; - var variableName = variableDef.variable.name.value; - - if (variableNameUsed[variableName] !== true) { - context.reportError(new _GraphQLError.GraphQLError(operation.name ? "Variable \"$".concat(variableName, "\" is never used in operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(variableName, "\" is never used."), variableDef)); - } - } - } - }, - VariableDefinition: function VariableDefinition(def) { - variableDefs.push(def); - } - }; -} diff --git a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js.flow b/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js.flow deleted file mode 100644 index ed284c8a..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js.flow +++ /dev/null @@ -1,49 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -export function NoUnusedVariablesRule(context: ValidationContext): ASTVisitor { - let variableDefs = []; - - return { - OperationDefinition: { - enter() { - variableDefs = []; - }, - leave(operation) { - const variableNameUsed = Object.create(null); - const usages = context.getRecursiveVariableUsages(operation); - - for (const { node } of usages) { - variableNameUsed[node.name.value] = true; - } - - for (const variableDef of variableDefs) { - const variableName = variableDef.variable.name.value; - if (variableNameUsed[variableName] !== true) { - context.reportError( - new GraphQLError( - operation.name - ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` - : `Variable "$${variableName}" is never used.`, - variableDef, - ), - ); - } - } - }, - }, - VariableDefinition(def) { - variableDefs.push(def); - }, - }; -} diff --git a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs b/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs deleted file mode 100644 index df62472b..00000000 --- a/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -export function NoUnusedVariablesRule(context) { - var variableDefs = []; - return { - OperationDefinition: { - enter: function enter() { - variableDefs = []; - }, - leave: function leave(operation) { - var variableNameUsed = Object.create(null); - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - variableNameUsed[node.name.value] = true; - } - - for (var _i4 = 0, _variableDefs2 = variableDefs; _i4 < _variableDefs2.length; _i4++) { - var variableDef = _variableDefs2[_i4]; - var variableName = variableDef.variable.name.value; - - if (variableNameUsed[variableName] !== true) { - context.reportError(new GraphQLError(operation.name ? "Variable \"$".concat(variableName, "\" is never used in operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(variableName, "\" is never used."), variableDef)); - } - } - } - }, - VariableDefinition: function VariableDefinition(def) { - variableDefs.push(def); - } - }; -} diff --git a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts b/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts deleted file mode 100644 index c1671c26..00000000 --- a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ -export function OverlappingFieldsCanBeMergedRule( - context: ValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js b/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js deleted file mode 100644 index 3fd18139..00000000 --- a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +++ /dev/null @@ -1,584 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.OverlappingFieldsCanBeMergedRule = OverlappingFieldsCanBeMergedRule; - -var _find = _interopRequireDefault(require("../../polyfills/find.js")); - -var _objectEntries3 = _interopRequireDefault(require("../../polyfills/objectEntries.js")); - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function reasonMessage(reason) { - if (Array.isArray(reason)) { - return reason.map(function (_ref) { - var responseName = _ref[0], - subReason = _ref[1]; - return "subfields \"".concat(responseName, "\" conflict because ") + reasonMessage(subReason); - }).join(' and '); - } - - return reason; -} -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ - - -function OverlappingFieldsCanBeMergedRule(context) { - // A memoization for when two fragments are compared "between" each other for - // conflicts. Two fragments may be compared many times, so memoizing this can - // dramatically improve the performance of this validator. - var comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given - // selection set. Selection sets may be asked for this information multiple - // times, so this improves the performance of this validator. - - var cachedFieldsAndFragmentNames = new Map(); - return { - SelectionSet: function SelectionSet(selectionSet) { - var conflicts = findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, context.getParentType(), selectionSet); - - for (var _i2 = 0; _i2 < conflicts.length; _i2++) { - var _ref3 = conflicts[_i2]; - var _ref2$ = _ref3[0]; - var responseName = _ref2$[0]; - var reason = _ref2$[1]; - var fields1 = _ref3[1]; - var fields2 = _ref3[2]; - var reasonMsg = reasonMessage(reason); - context.reportError(new _GraphQLError.GraphQLError("Fields \"".concat(responseName, "\" conflict because ").concat(reasonMsg, ". Use different aliases on the fields to fetch both if this was intentional."), fields1.concat(fields2))); - } - } - }; -} - -/** - * Algorithm: - * - * Conflicts occur when two fields exist in a query which will produce the same - * response name, but represent differing values, thus creating a conflict. - * The algorithm below finds all conflicts via making a series of comparisons - * between fields. In order to compare as few fields as possible, this makes - * a series of comparisons "within" sets of fields and "between" sets of fields. - * - * Given any selection set, a collection produces both a set of fields by - * also including all inline fragments, as well as a list of fragments - * referenced by fragment spreads. - * - * A) Each selection set represented in the document first compares "within" its - * collected set of fields, finding any conflicts between every pair of - * overlapping fields. - * Note: This is the *only time* that a the fields "within" a set are compared - * to each other. After this only fields "between" sets are compared. - * - * B) Also, if any fragment is referenced in a selection set, then a - * comparison is made "between" the original set of fields and the - * referenced fragment. - * - * C) Also, if multiple fragments are referenced, then comparisons - * are made "between" each referenced fragment. - * - * D) When comparing "between" a set of fields and a referenced fragment, first - * a comparison is made between each field in the original set of fields and - * each field in the the referenced set of fields. - * - * E) Also, if any fragment is referenced in the referenced selection set, - * then a comparison is made "between" the original set of fields and the - * referenced fragment (recursively referring to step D). - * - * F) When comparing "between" two fragments, first a comparison is made between - * each field in the first referenced set of fields and each field in the the - * second referenced set of fields. - * - * G) Also, any fragments referenced by the first must be compared to the - * second, and any fragments referenced by the second must be compared to the - * first (recursively referring to step F). - * - * H) When comparing two fields, if both have selection sets, then a comparison - * is made "between" both selection sets, first comparing the set of fields in - * the first selection set with the set of fields in the second. - * - * I) Also, if any fragment is referenced in either selection set, then a - * comparison is made "between" the other set of fields and the - * referenced fragment. - * - * J) Also, if two fragments are referenced in both selection sets, then a - * comparison is made "between" the two fragments. - * - */ -// Find all conflicts found "within" a selection set, including those found -// via spreading in fragments. Called when visiting each SelectionSet in the -// GraphQL Document. -function findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentType, selectionSet) { - var conflicts = []; - - var _getFieldsAndFragment = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet), - fieldMap = _getFieldsAndFragment[0], - fragmentNames = _getFieldsAndFragment[1]; // (A) Find find all conflicts "within" the fields of this selection set. - // Note: this is the *only place* `collectConflictsWithin` is called. - - - collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap); - - if (fragmentNames.length !== 0) { - // (B) Then collect conflicts between these fields and those represented by - // each spread fragment name found. - for (var i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fieldMap, fragmentNames[i]); // (C) Then compare this fragment with all other fragments found in this - // selection set to collect conflicts between fragments spread together. - // This compares each item in the list of fragment names to every other - // item in that same list (except for itself). - - for (var j = i + 1; j < fragmentNames.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fragmentNames[i], fragmentNames[j]); - } - } - } - - return conflicts; -} // Collect all conflicts found between a set of fields and a fragment reference -// including via spreading in any nested fragments. - - -function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) { - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - return; - } - - var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment), - fieldMap2 = _getReferencedFieldsA[0], - fragmentNames2 = _getReferencedFieldsA[1]; // Do not compare a fragment's fieldMap to itself. - - - if (fieldMap === fieldMap2) { - return; - } // (D) First collect any conflicts between the provided collection of fields - // and the collection of fields represented by the given fragment. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); // (E) Then collect any conflicts between the provided collection of fields - // and any fragment names found in the given fragment. - - for (var i = 0; i < fragmentNames2.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentNames2[i]); - } -} // Collect all conflicts found between two fragments, including via spreading in -// any nested fragments. - - -function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2) { - // No need to compare a fragment to itself. - if (fragmentName1 === fragmentName2) { - return; - } // Memoize so two fragments are not compared for conflicts more than once. - - - if (comparedFragmentPairs.has(fragmentName1, fragmentName2, areMutuallyExclusive)) { - return; - } - - comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); - var fragment1 = context.getFragment(fragmentName1); - var fragment2 = context.getFragment(fragmentName2); - - if (!fragment1 || !fragment2) { - return; - } - - var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), - fieldMap1 = _getReferencedFieldsA2[0], - fragmentNames1 = _getReferencedFieldsA2[1]; - - var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment2), - fieldMap2 = _getReferencedFieldsA3[0], - fragmentNames2 = _getReferencedFieldsA3[1]; // (F) First, collect all conflicts between these two collections of fields - // (not including any nested fragments). - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (G) Then collect conflicts between the first fragment and any nested - // fragments spread in the second fragment. - - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]); - } // (G) Then collect conflicts between the second fragment and any nested - // fragments spread in the first fragment. - - - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[i], fragmentName2); - } -} // Find all conflicts found between two selection sets, including those found -// via spreading in fragments. Called when determining if conflicts exist -// between the sub-fields of two overlapping fields. - - -function findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, parentType1, selectionSet1, parentType2, selectionSet2) { - var conflicts = []; - - var _getFieldsAndFragment2 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType1, selectionSet1), - fieldMap1 = _getFieldsAndFragment2[0], - fragmentNames1 = _getFieldsAndFragment2[1]; - - var _getFieldsAndFragment3 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType2, selectionSet2), - fieldMap2 = _getFieldsAndFragment3[0], - fragmentNames2 = _getFieldsAndFragment3[1]; // (H) First, collect all conflicts between these two collections of field. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (I) Then collect conflicts between the first collection of fields and - // those referenced by each fragment name associated with the second. - - if (fragmentNames2.length !== 0) { - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fragmentNames2[j]); - } - } // (I) Then collect conflicts between the second collection of fields and - // those referenced by each fragment name associated with the first. - - - if (fragmentNames1.length !== 0) { - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap2, fragmentNames1[i]); - } - } // (J) Also collect conflicts between any fragment names by the first and - // fragment names by the second. This compares each item in the first set of - // names to each item in the second set of names. - - - for (var _i3 = 0; _i3 < fragmentNames1.length; _i3++) { - for (var _j = 0; _j < fragmentNames2.length; _j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[_i3], fragmentNames2[_j]); - } - } - - return conflicts; -} // Collect all Conflicts "within" one collection of fields. - - -function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For every response name, if there are multiple fields, they - // must be compared to find a potential conflict. - for (var _i5 = 0, _objectEntries2 = (0, _objectEntries3.default)(fieldMap); _i5 < _objectEntries2.length; _i5++) { - var _ref5 = _objectEntries2[_i5]; - var responseName = _ref5[0]; - var fields = _ref5[1]; - - // This compares every field in the list to every other field in this list - // (except to itself). If the list only has one item, nothing needs to - // be compared. - if (fields.length > 1) { - for (var i = 0; i < fields.length; i++) { - for (var j = i + 1; j < fields.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, // within one collection is never mutually exclusive - responseName, fields[i], fields[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Collect all Conflicts between two collections of fields. This is similar to, -// but different from the `collectConflictsWithin` function above. This check -// assumes that `collectConflictsWithin` has already been called on each -// provided collection of fields. This is true because this validator traverses -// each individual selection set. - - -function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, fieldMap1, fieldMap2) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For any response name which appears in both provided field - // maps, each field from the first field map must be compared to every field - // in the second field map to find potential conflicts. - for (var _i7 = 0, _Object$keys2 = Object.keys(fieldMap1); _i7 < _Object$keys2.length; _i7++) { - var responseName = _Object$keys2[_i7]; - var fields2 = fieldMap2[responseName]; - - if (fields2) { - var fields1 = fieldMap1[responseName]; - - for (var i = 0; i < fields1.length; i++) { - for (var j = 0; j < fields2.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, fields1[i], fields2[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Determines if there is a conflict between two particular fields, including -// comparing their sub-fields. - - -function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2) { - var parentType1 = field1[0], - node1 = field1[1], - def1 = field1[2]; - var parentType2 = field2[0], - node2 = field2[1], - def2 = field2[2]; // If it is known that two fields could not possibly apply at the same - // time, due to the parent types, then it is safe to permit them to diverge - // in aliased field or arguments used as they will not present any ambiguity - // by differing. - // It is known that two parent types could never overlap if they are - // different Object types. Interface or Union types might overlap - if not - // in the current state of the schema, then perhaps in some future version, - // thus may not safely diverge. - - var areMutuallyExclusive = parentFieldsAreMutuallyExclusive || parentType1 !== parentType2 && (0, _definition.isObjectType)(parentType1) && (0, _definition.isObjectType)(parentType2); - - if (!areMutuallyExclusive) { - var _node1$arguments, _node2$arguments; - - // Two aliases must refer to the same field. - var name1 = node1.name.value; - var name2 = node2.name.value; - - if (name1 !== name2) { - return [[responseName, "\"".concat(name1, "\" and \"").concat(name2, "\" are different fields")], [node1], [node2]]; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : []; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - var args2 = (_node2$arguments = node2.arguments) !== null && _node2$arguments !== void 0 ? _node2$arguments : []; // Two field calls must have the same arguments. - - if (!sameArguments(args1, args2)) { - return [[responseName, 'they have differing arguments'], [node1], [node2]]; - } - } // The return type for each field. - - - var type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; - var type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; - - if (type1 && type2 && doTypesConflict(type1, type2)) { - return [[responseName, "they return conflicting types \"".concat((0, _inspect.default)(type1), "\" and \"").concat((0, _inspect.default)(type2), "\"")], [node1], [node2]]; - } // Collect and compare sub-fields. Use the same "visited fragment names" list - // for both collections so fields in a fragment reference are never - // compared to themselves. - - - var selectionSet1 = node1.selectionSet; - var selectionSet2 = node2.selectionSet; - - if (selectionSet1 && selectionSet2) { - var conflicts = findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, (0, _definition.getNamedType)(type1), selectionSet1, (0, _definition.getNamedType)(type2), selectionSet2); - return subfieldConflicts(conflicts, responseName, node1, node2); - } -} - -function sameArguments(arguments1, arguments2) { - if (arguments1.length !== arguments2.length) { - return false; - } - - return arguments1.every(function (argument1) { - var argument2 = (0, _find.default)(arguments2, function (argument) { - return argument.name.value === argument1.name.value; - }); - - if (!argument2) { - return false; - } - - return sameValue(argument1.value, argument2.value); - }); -} - -function sameValue(value1, value2) { - return (0, _printer.print)(value1) === (0, _printer.print)(value2); -} // Two types conflict if both types could not apply to a value simultaneously. -// Composite types are ignored as their individual field types will be compared -// later recursively. However List and Non-Null types must match. - - -function doTypesConflict(type1, type2) { - if ((0, _definition.isListType)(type1)) { - return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if ((0, _definition.isListType)(type2)) { - return true; - } - - if ((0, _definition.isNonNullType)(type1)) { - return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if ((0, _definition.isNonNullType)(type2)) { - return true; - } - - if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) { - return type1 !== type2; - } - - return false; -} // Given a selection set, return the collection of fields (a mapping of response -// name to field nodes and definitions) as well as a list of fragment names -// referenced via fragment spreads. - - -function getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet) { - var cached = cachedFieldsAndFragmentNames.get(selectionSet); - - if (!cached) { - var nodeAndDefs = Object.create(null); - var fragmentNames = Object.create(null); - - _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames); - - cached = [nodeAndDefs, Object.keys(fragmentNames)]; - cachedFieldsAndFragmentNames.set(selectionSet, cached); - } - - return cached; -} // Given a reference to a fragment, return the represented collection of fields -// as well as a list of nested fragment names referenced via fragment spreads. - - -function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment) { - // Short-circuit building a type from the node if possible. - var cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); - - if (cached) { - return cached; - } - - var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(), fragment.typeCondition); - return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment.selectionSet); -} - -function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) { - for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) { - var selection = _selectionSet$selecti2[_i9]; - - switch (selection.kind) { - case _kinds.Kind.FIELD: - { - var fieldName = selection.name.value; - var fieldDef = void 0; - - if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) { - fieldDef = parentType.getFields()[fieldName]; - } - - var responseName = selection.alias ? selection.alias.value : fieldName; - - if (!nodeAndDefs[responseName]) { - nodeAndDefs[responseName] = []; - } - - nodeAndDefs[responseName].push([parentType, selection, fieldDef]); - break; - } - - case _kinds.Kind.FRAGMENT_SPREAD: - fragmentNames[selection.name.value] = true; - break; - - case _kinds.Kind.INLINE_FRAGMENT: - { - var typeCondition = selection.typeCondition; - var inlineFragmentType = typeCondition ? (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition) : parentType; - - _collectFieldsAndFragmentNames(context, inlineFragmentType, selection.selectionSet, nodeAndDefs, fragmentNames); - - break; - } - } - } -} // Given a series of Conflicts which occurred between two sub-fields, generate -// a single Conflict. - - -function subfieldConflicts(conflicts, responseName, node1, node2) { - if (conflicts.length > 0) { - return [[responseName, conflicts.map(function (_ref6) { - var reason = _ref6[0]; - return reason; - })], conflicts.reduce(function (allFields, _ref7) { - var fields1 = _ref7[1]; - return allFields.concat(fields1); - }, [node1]), conflicts.reduce(function (allFields, _ref8) { - var fields2 = _ref8[2]; - return allFields.concat(fields2); - }, [node2])]; - } -} -/** - * A way to keep track of pairs of things when the ordering of the pair does - * not matter. We do this by maintaining a sort of double adjacency sets. - */ - - -var PairSet = /*#__PURE__*/function () { - function PairSet() { - this._data = Object.create(null); - } - - var _proto = PairSet.prototype; - - _proto.has = function has(a, b, areMutuallyExclusive) { - var first = this._data[a]; - var result = first && first[b]; - - if (result === undefined) { - return false; - } // areMutuallyExclusive being false is a superset of being true, - // hence if we want to know if this PairSet "has" these two with no - // exclusivity, we have to ensure it was added as such. - - - if (areMutuallyExclusive === false) { - return result === false; - } - - return true; - }; - - _proto.add = function add(a, b, areMutuallyExclusive) { - this._pairSetAdd(a, b, areMutuallyExclusive); - - this._pairSetAdd(b, a, areMutuallyExclusive); - }; - - _proto._pairSetAdd = function _pairSetAdd(a, b, areMutuallyExclusive) { - var map = this._data[a]; - - if (!map) { - map = Object.create(null); - this._data[a] = map; - } - - map[b] = areMutuallyExclusive; - }; - - return PairSet; -}(); diff --git a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow b/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow deleted file mode 100644 index eea7e452..00000000 --- a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +++ /dev/null @@ -1,833 +0,0 @@ -// @flow strict -import find from '../../polyfills/find'; -import objectEntries from '../../polyfills/objectEntries'; - -import type { ObjMap } from '../../jsutils/ObjMap'; -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - SelectionSetNode, - ValueNode, - FieldNode, - ArgumentNode, - FragmentDefinitionNode, -} from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { print } from '../../language/printer'; - -import type { - GraphQLNamedType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, -} from '../../type/definition'; -import { - getNamedType, - isNonNullType, - isLeafType, - isObjectType, - isListType, - isInterfaceType, -} from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; - -import type { ValidationContext } from '../ValidationContext'; - -function reasonMessage(reason: ConflictReasonMessage): string { - if (Array.isArray(reason)) { - return reason - .map( - ([responseName, subReason]) => - `subfields "${responseName}" conflict because ` + - reasonMessage(subReason), - ) - .join(' and '); - } - return reason; -} - -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ -export function OverlappingFieldsCanBeMergedRule( - context: ValidationContext, -): ASTVisitor { - // A memoization for when two fragments are compared "between" each other for - // conflicts. Two fragments may be compared many times, so memoizing this can - // dramatically improve the performance of this validator. - const comparedFragmentPairs = new PairSet(); - - // A cache for the "field map" and list of fragment names found in any given - // selection set. Selection sets may be asked for this information multiple - // times, so this improves the performance of this validator. - const cachedFieldsAndFragmentNames = new Map(); - - return { - SelectionSet(selectionSet) { - const conflicts = findConflictsWithinSelectionSet( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - context.getParentType(), - selectionSet, - ); - for (const [[responseName, reason], fields1, fields2] of conflicts) { - const reasonMsg = reasonMessage(reason); - context.reportError( - new GraphQLError( - `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, - fields1.concat(fields2), - ), - ); - } - }, - }; -} - -type Conflict = [ConflictReason, Array, Array]; -// Field name and reason. -type ConflictReason = [string, ConflictReasonMessage]; -// Reason is a string, or a nested list of conflicts. -type ConflictReasonMessage = string | Array; -// Tuple defining a field node in a context. -type NodeAndDef = [ - GraphQLCompositeType, - FieldNode, - ?GraphQLField, -]; -// Map of array of those. -type NodeAndDefCollection = ObjMap>; - -/** - * Algorithm: - * - * Conflicts occur when two fields exist in a query which will produce the same - * response name, but represent differing values, thus creating a conflict. - * The algorithm below finds all conflicts via making a series of comparisons - * between fields. In order to compare as few fields as possible, this makes - * a series of comparisons "within" sets of fields and "between" sets of fields. - * - * Given any selection set, a collection produces both a set of fields by - * also including all inline fragments, as well as a list of fragments - * referenced by fragment spreads. - * - * A) Each selection set represented in the document first compares "within" its - * collected set of fields, finding any conflicts between every pair of - * overlapping fields. - * Note: This is the *only time* that a the fields "within" a set are compared - * to each other. After this only fields "between" sets are compared. - * - * B) Also, if any fragment is referenced in a selection set, then a - * comparison is made "between" the original set of fields and the - * referenced fragment. - * - * C) Also, if multiple fragments are referenced, then comparisons - * are made "between" each referenced fragment. - * - * D) When comparing "between" a set of fields and a referenced fragment, first - * a comparison is made between each field in the original set of fields and - * each field in the the referenced set of fields. - * - * E) Also, if any fragment is referenced in the referenced selection set, - * then a comparison is made "between" the original set of fields and the - * referenced fragment (recursively referring to step D). - * - * F) When comparing "between" two fragments, first a comparison is made between - * each field in the first referenced set of fields and each field in the the - * second referenced set of fields. - * - * G) Also, any fragments referenced by the first must be compared to the - * second, and any fragments referenced by the second must be compared to the - * first (recursively referring to step F). - * - * H) When comparing two fields, if both have selection sets, then a comparison - * is made "between" both selection sets, first comparing the set of fields in - * the first selection set with the set of fields in the second. - * - * I) Also, if any fragment is referenced in either selection set, then a - * comparison is made "between" the other set of fields and the - * referenced fragment. - * - * J) Also, if two fragments are referenced in both selection sets, then a - * comparison is made "between" the two fragments. - * - */ - -// Find all conflicts found "within" a selection set, including those found -// via spreading in fragments. Called when visiting each SelectionSet in the -// GraphQL Document. -function findConflictsWithinSelectionSet( - context: ValidationContext, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - parentType: ?GraphQLNamedType, - selectionSet: SelectionSetNode, -): Array { - const conflicts = []; - - const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType, - selectionSet, - ); - - // (A) Find find all conflicts "within" the fields of this selection set. - // Note: this is the *only place* `collectConflictsWithin` is called. - collectConflictsWithin( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - fieldMap, - ); - - if (fragmentNames.length !== 0) { - // (B) Then collect conflicts between these fields and those represented by - // each spread fragment name found. - for (let i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, - fieldMap, - fragmentNames[i], - ); - // (C) Then compare this fragment with all other fragments found in this - // selection set to collect conflicts between fragments spread together. - // This compares each item in the list of fragment names to every other - // item in that same list (except for itself). - for (let j = i + 1; j < fragmentNames.length; j++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, - fragmentNames[i], - fragmentNames[j], - ); - } - } - } - return conflicts; -} - -// Collect all conflicts found between a set of fields and a fragment reference -// including via spreading in any nested fragments. -function collectConflictsBetweenFieldsAndFragment( - context: ValidationContext, - conflicts: Array, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - areMutuallyExclusive: boolean, - fieldMap: NodeAndDefCollection, - fragmentName: string, -): void { - const fragment = context.getFragment(fragmentName); - if (!fragment) { - return; - } - - const [fieldMap2, fragmentNames2] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment, - ); - - // Do not compare a fragment's fieldMap to itself. - if (fieldMap === fieldMap2) { - return; - } - - // (D) First collect any conflicts between the provided collection of fields - // and the collection of fields represented by the given fragment. - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap, - fieldMap2, - ); - - // (E) Then collect any conflicts between the provided collection of fields - // and any fragment names found in the given fragment. - for (let i = 0; i < fragmentNames2.length; i++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap, - fragmentNames2[i], - ); - } -} - -// Collect all conflicts found between two fragments, including via spreading in -// any nested fragments. -function collectConflictsBetweenFragments( - context: ValidationContext, - conflicts: Array, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - areMutuallyExclusive: boolean, - fragmentName1: string, - fragmentName2: string, -): void { - // No need to compare a fragment to itself. - if (fragmentName1 === fragmentName2) { - return; - } - - // Memoize so two fragments are not compared for conflicts more than once. - if ( - comparedFragmentPairs.has( - fragmentName1, - fragmentName2, - areMutuallyExclusive, - ) - ) { - return; - } - comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); - - const fragment1 = context.getFragment(fragmentName1); - const fragment2 = context.getFragment(fragmentName2); - if (!fragment1 || !fragment2) { - return; - } - - const [fieldMap1, fragmentNames1] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment1, - ); - const [fieldMap2, fragmentNames2] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment2, - ); - - // (F) First, collect all conflicts between these two collections of fields - // (not including any nested fragments). - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fieldMap2, - ); - - // (G) Then collect conflicts between the first fragment and any nested - // fragments spread in the second fragment. - for (let j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentName1, - fragmentNames2[j], - ); - } - - // (G) Then collect conflicts between the second fragment and any nested - // fragments spread in the first fragment. - for (let i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentNames1[i], - fragmentName2, - ); - } -} - -// Find all conflicts found between two selection sets, including those found -// via spreading in fragments. Called when determining if conflicts exist -// between the sub-fields of two overlapping fields. -function findConflictsBetweenSubSelectionSets( - context: ValidationContext, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - areMutuallyExclusive: boolean, - parentType1: ?GraphQLNamedType, - selectionSet1: SelectionSetNode, - parentType2: ?GraphQLNamedType, - selectionSet2: SelectionSetNode, -): Array { - const conflicts = []; - - const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType1, - selectionSet1, - ); - const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType2, - selectionSet2, - ); - - // (H) First, collect all conflicts between these two collections of field. - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fieldMap2, - ); - - // (I) Then collect conflicts between the first collection of fields and - // those referenced by each fragment name associated with the second. - if (fragmentNames2.length !== 0) { - for (let j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fragmentNames2[j], - ); - } - } - - // (I) Then collect conflicts between the second collection of fields and - // those referenced by each fragment name associated with the first. - if (fragmentNames1.length !== 0) { - for (let i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap2, - fragmentNames1[i], - ); - } - } - - // (J) Also collect conflicts between any fragment names by the first and - // fragment names by the second. This compares each item in the first set of - // names to each item in the second set of names. - for (let i = 0; i < fragmentNames1.length; i++) { - for (let j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentNames1[i], - fragmentNames2[j], - ); - } - } - return conflicts; -} - -// Collect all Conflicts "within" one collection of fields. -function collectConflictsWithin( - context: ValidationContext, - conflicts: Array, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - fieldMap: NodeAndDefCollection, -): void { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For every response name, if there are multiple fields, they - // must be compared to find a potential conflict. - for (const [responseName, fields] of objectEntries(fieldMap)) { - // This compares every field in the list to every other field in this list - // (except to itself). If the list only has one item, nothing needs to - // be compared. - if (fields.length > 1) { - for (let i = 0; i < fields.length; i++) { - for (let j = i + 1; j < fields.length; j++) { - const conflict = findConflict( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, // within one collection is never mutually exclusive - responseName, - fields[i], - fields[j], - ); - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} - -// Collect all Conflicts between two collections of fields. This is similar to, -// but different from the `collectConflictsWithin` function above. This check -// assumes that `collectConflictsWithin` has already been called on each -// provided collection of fields. This is true because this validator traverses -// each individual selection set. -function collectConflictsBetween( - context: ValidationContext, - conflicts: Array, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - parentFieldsAreMutuallyExclusive: boolean, - fieldMap1: NodeAndDefCollection, - fieldMap2: NodeAndDefCollection, -): void { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For any response name which appears in both provided field - // maps, each field from the first field map must be compared to every field - // in the second field map to find potential conflicts. - for (const responseName of Object.keys(fieldMap1)) { - const fields2 = fieldMap2[responseName]; - if (fields2) { - const fields1 = fieldMap1[responseName]; - for (let i = 0; i < fields1.length; i++) { - for (let j = 0; j < fields2.length; j++) { - const conflict = findConflict( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - parentFieldsAreMutuallyExclusive, - responseName, - fields1[i], - fields2[j], - ); - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} - -// Determines if there is a conflict between two particular fields, including -// comparing their sub-fields. -function findConflict( - context: ValidationContext, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - parentFieldsAreMutuallyExclusive: boolean, - responseName: string, - field1: NodeAndDef, - field2: NodeAndDef, -): ?Conflict { - const [parentType1, node1, def1] = field1; - const [parentType2, node2, def2] = field2; - - // If it is known that two fields could not possibly apply at the same - // time, due to the parent types, then it is safe to permit them to diverge - // in aliased field or arguments used as they will not present any ambiguity - // by differing. - // It is known that two parent types could never overlap if they are - // different Object types. Interface or Union types might overlap - if not - // in the current state of the schema, then perhaps in some future version, - // thus may not safely diverge. - const areMutuallyExclusive = - parentFieldsAreMutuallyExclusive || - (parentType1 !== parentType2 && - isObjectType(parentType1) && - isObjectType(parentType2)); - - if (!areMutuallyExclusive) { - // Two aliases must refer to the same field. - const name1 = node1.name.value; - const name2 = node2.name.value; - if (name1 !== name2) { - return [ - [responseName, `"${name1}" and "${name2}" are different fields`], - [node1], - [node2], - ]; - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const args1 = node1.arguments ?? []; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const args2 = node2.arguments ?? []; - // Two field calls must have the same arguments. - if (!sameArguments(args1, args2)) { - return [ - [responseName, 'they have differing arguments'], - [node1], - [node2], - ]; - } - } - - // The return type for each field. - const type1 = def1?.type; - const type2 = def2?.type; - - if (type1 && type2 && doTypesConflict(type1, type2)) { - return [ - [ - responseName, - `they return conflicting types "${inspect(type1)}" and "${inspect( - type2, - )}"`, - ], - [node1], - [node2], - ]; - } - - // Collect and compare sub-fields. Use the same "visited fragment names" list - // for both collections so fields in a fragment reference are never - // compared to themselves. - const selectionSet1 = node1.selectionSet; - const selectionSet2 = node2.selectionSet; - if (selectionSet1 && selectionSet2) { - const conflicts = findConflictsBetweenSubSelectionSets( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - getNamedType(type1), - selectionSet1, - getNamedType(type2), - selectionSet2, - ); - return subfieldConflicts(conflicts, responseName, node1, node2); - } -} - -function sameArguments( - arguments1: $ReadOnlyArray, - arguments2: $ReadOnlyArray, -): boolean { - if (arguments1.length !== arguments2.length) { - return false; - } - return arguments1.every((argument1) => { - const argument2 = find( - arguments2, - (argument) => argument.name.value === argument1.name.value, - ); - if (!argument2) { - return false; - } - return sameValue(argument1.value, argument2.value); - }); -} - -function sameValue(value1: ValueNode, value2: ValueNode): boolean { - return print(value1) === print(value2); -} - -// Two types conflict if both types could not apply to a value simultaneously. -// Composite types are ignored as their individual field types will be compared -// later recursively. However List and Non-Null types must match. -function doTypesConflict( - type1: GraphQLOutputType, - type2: GraphQLOutputType, -): boolean { - if (isListType(type1)) { - return isListType(type2) - ? doTypesConflict(type1.ofType, type2.ofType) - : true; - } - if (isListType(type2)) { - return true; - } - if (isNonNullType(type1)) { - return isNonNullType(type2) - ? doTypesConflict(type1.ofType, type2.ofType) - : true; - } - if (isNonNullType(type2)) { - return true; - } - if (isLeafType(type1) || isLeafType(type2)) { - return type1 !== type2; - } - return false; -} - -// Given a selection set, return the collection of fields (a mapping of response -// name to field nodes and definitions) as well as a list of fragment names -// referenced via fragment spreads. -function getFieldsAndFragmentNames( - context: ValidationContext, - cachedFieldsAndFragmentNames, - parentType: ?GraphQLNamedType, - selectionSet: SelectionSetNode, -): [NodeAndDefCollection, Array] { - let cached = cachedFieldsAndFragmentNames.get(selectionSet); - if (!cached) { - const nodeAndDefs = Object.create(null); - const fragmentNames = Object.create(null); - _collectFieldsAndFragmentNames( - context, - parentType, - selectionSet, - nodeAndDefs, - fragmentNames, - ); - cached = [nodeAndDefs, Object.keys(fragmentNames)]; - cachedFieldsAndFragmentNames.set(selectionSet, cached); - } - return cached; -} - -// Given a reference to a fragment, return the represented collection of fields -// as well as a list of nested fragment names referenced via fragment spreads. -function getReferencedFieldsAndFragmentNames( - context: ValidationContext, - cachedFieldsAndFragmentNames, - fragment: FragmentDefinitionNode, -) { - // Short-circuit building a type from the node if possible. - const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); - if (cached) { - return cached; - } - - const fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); - return getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragmentType, - fragment.selectionSet, - ); -} - -function _collectFieldsAndFragmentNames( - context: ValidationContext, - parentType: ?GraphQLNamedType, - selectionSet: SelectionSetNode, - nodeAndDefs, - fragmentNames, -): void { - for (const selection of selectionSet.selections) { - switch (selection.kind) { - case Kind.FIELD: { - const fieldName = selection.name.value; - let fieldDef; - if (isObjectType(parentType) || isInterfaceType(parentType)) { - fieldDef = parentType.getFields()[fieldName]; - } - const responseName = selection.alias - ? selection.alias.value - : fieldName; - if (!nodeAndDefs[responseName]) { - nodeAndDefs[responseName] = []; - } - nodeAndDefs[responseName].push([parentType, selection, fieldDef]); - break; - } - case Kind.FRAGMENT_SPREAD: - fragmentNames[selection.name.value] = true; - break; - case Kind.INLINE_FRAGMENT: { - const typeCondition = selection.typeCondition; - const inlineFragmentType = typeCondition - ? typeFromAST(context.getSchema(), typeCondition) - : parentType; - _collectFieldsAndFragmentNames( - context, - inlineFragmentType, - selection.selectionSet, - nodeAndDefs, - fragmentNames, - ); - break; - } - } - } -} - -// Given a series of Conflicts which occurred between two sub-fields, generate -// a single Conflict. -function subfieldConflicts( - conflicts: $ReadOnlyArray, - responseName: string, - node1: FieldNode, - node2: FieldNode, -): ?Conflict { - if (conflicts.length > 0) { - return [ - [responseName, conflicts.map(([reason]) => reason)], - conflicts.reduce((allFields, [, fields1]) => allFields.concat(fields1), [ - node1, - ]), - conflicts.reduce( - (allFields, [, , fields2]) => allFields.concat(fields2), - [node2], - ), - ]; - } -} - -/** - * A way to keep track of pairs of things when the ordering of the pair does - * not matter. We do this by maintaining a sort of double adjacency sets. - */ -class PairSet { - _data: ObjMap>; - - constructor() { - this._data = Object.create(null); - } - - has(a: string, b: string, areMutuallyExclusive: boolean): boolean { - const first = this._data[a]; - const result = first && first[b]; - if (result === undefined) { - return false; - } - // areMutuallyExclusive being false is a superset of being true, - // hence if we want to know if this PairSet "has" these two with no - // exclusivity, we have to ensure it was added as such. - if (areMutuallyExclusive === false) { - return result === false; - } - return true; - } - - add(a: string, b: string, areMutuallyExclusive: boolean): void { - this._pairSetAdd(a, b, areMutuallyExclusive); - this._pairSetAdd(b, a, areMutuallyExclusive); - } - - _pairSetAdd(a: string, b: string, areMutuallyExclusive: boolean): void { - let map = this._data[a]; - if (!map) { - map = Object.create(null); - this._data[a] = map; - } - map[b] = areMutuallyExclusive; - } -} diff --git a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs b/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs deleted file mode 100644 index afc5243b..00000000 --- a/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +++ /dev/null @@ -1,568 +0,0 @@ -import find from "../../polyfills/find.mjs"; -import objectEntries from "../../polyfills/objectEntries.mjs"; -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { print } from "../../language/printer.mjs"; -import { getNamedType, isNonNullType, isLeafType, isObjectType, isListType, isInterfaceType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; - -function reasonMessage(reason) { - if (Array.isArray(reason)) { - return reason.map(function (_ref) { - var responseName = _ref[0], - subReason = _ref[1]; - return "subfields \"".concat(responseName, "\" conflict because ") + reasonMessage(subReason); - }).join(' and '); - } - - return reason; -} -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ - - -export function OverlappingFieldsCanBeMergedRule(context) { - // A memoization for when two fragments are compared "between" each other for - // conflicts. Two fragments may be compared many times, so memoizing this can - // dramatically improve the performance of this validator. - var comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given - // selection set. Selection sets may be asked for this information multiple - // times, so this improves the performance of this validator. - - var cachedFieldsAndFragmentNames = new Map(); - return { - SelectionSet: function SelectionSet(selectionSet) { - var conflicts = findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, context.getParentType(), selectionSet); - - for (var _i2 = 0; _i2 < conflicts.length; _i2++) { - var _ref3 = conflicts[_i2]; - var _ref2$ = _ref3[0]; - var responseName = _ref2$[0]; - var reason = _ref2$[1]; - var fields1 = _ref3[1]; - var fields2 = _ref3[2]; - var reasonMsg = reasonMessage(reason); - context.reportError(new GraphQLError("Fields \"".concat(responseName, "\" conflict because ").concat(reasonMsg, ". Use different aliases on the fields to fetch both if this was intentional."), fields1.concat(fields2))); - } - } - }; -} - -/** - * Algorithm: - * - * Conflicts occur when two fields exist in a query which will produce the same - * response name, but represent differing values, thus creating a conflict. - * The algorithm below finds all conflicts via making a series of comparisons - * between fields. In order to compare as few fields as possible, this makes - * a series of comparisons "within" sets of fields and "between" sets of fields. - * - * Given any selection set, a collection produces both a set of fields by - * also including all inline fragments, as well as a list of fragments - * referenced by fragment spreads. - * - * A) Each selection set represented in the document first compares "within" its - * collected set of fields, finding any conflicts between every pair of - * overlapping fields. - * Note: This is the *only time* that a the fields "within" a set are compared - * to each other. After this only fields "between" sets are compared. - * - * B) Also, if any fragment is referenced in a selection set, then a - * comparison is made "between" the original set of fields and the - * referenced fragment. - * - * C) Also, if multiple fragments are referenced, then comparisons - * are made "between" each referenced fragment. - * - * D) When comparing "between" a set of fields and a referenced fragment, first - * a comparison is made between each field in the original set of fields and - * each field in the the referenced set of fields. - * - * E) Also, if any fragment is referenced in the referenced selection set, - * then a comparison is made "between" the original set of fields and the - * referenced fragment (recursively referring to step D). - * - * F) When comparing "between" two fragments, first a comparison is made between - * each field in the first referenced set of fields and each field in the the - * second referenced set of fields. - * - * G) Also, any fragments referenced by the first must be compared to the - * second, and any fragments referenced by the second must be compared to the - * first (recursively referring to step F). - * - * H) When comparing two fields, if both have selection sets, then a comparison - * is made "between" both selection sets, first comparing the set of fields in - * the first selection set with the set of fields in the second. - * - * I) Also, if any fragment is referenced in either selection set, then a - * comparison is made "between" the other set of fields and the - * referenced fragment. - * - * J) Also, if two fragments are referenced in both selection sets, then a - * comparison is made "between" the two fragments. - * - */ -// Find all conflicts found "within" a selection set, including those found -// via spreading in fragments. Called when visiting each SelectionSet in the -// GraphQL Document. -function findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentType, selectionSet) { - var conflicts = []; - - var _getFieldsAndFragment = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet), - fieldMap = _getFieldsAndFragment[0], - fragmentNames = _getFieldsAndFragment[1]; // (A) Find find all conflicts "within" the fields of this selection set. - // Note: this is the *only place* `collectConflictsWithin` is called. - - - collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap); - - if (fragmentNames.length !== 0) { - // (B) Then collect conflicts between these fields and those represented by - // each spread fragment name found. - for (var i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fieldMap, fragmentNames[i]); // (C) Then compare this fragment with all other fragments found in this - // selection set to collect conflicts between fragments spread together. - // This compares each item in the list of fragment names to every other - // item in that same list (except for itself). - - for (var j = i + 1; j < fragmentNames.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fragmentNames[i], fragmentNames[j]); - } - } - } - - return conflicts; -} // Collect all conflicts found between a set of fields and a fragment reference -// including via spreading in any nested fragments. - - -function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) { - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - return; - } - - var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment), - fieldMap2 = _getReferencedFieldsA[0], - fragmentNames2 = _getReferencedFieldsA[1]; // Do not compare a fragment's fieldMap to itself. - - - if (fieldMap === fieldMap2) { - return; - } // (D) First collect any conflicts between the provided collection of fields - // and the collection of fields represented by the given fragment. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); // (E) Then collect any conflicts between the provided collection of fields - // and any fragment names found in the given fragment. - - for (var i = 0; i < fragmentNames2.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentNames2[i]); - } -} // Collect all conflicts found between two fragments, including via spreading in -// any nested fragments. - - -function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2) { - // No need to compare a fragment to itself. - if (fragmentName1 === fragmentName2) { - return; - } // Memoize so two fragments are not compared for conflicts more than once. - - - if (comparedFragmentPairs.has(fragmentName1, fragmentName2, areMutuallyExclusive)) { - return; - } - - comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); - var fragment1 = context.getFragment(fragmentName1); - var fragment2 = context.getFragment(fragmentName2); - - if (!fragment1 || !fragment2) { - return; - } - - var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), - fieldMap1 = _getReferencedFieldsA2[0], - fragmentNames1 = _getReferencedFieldsA2[1]; - - var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment2), - fieldMap2 = _getReferencedFieldsA3[0], - fragmentNames2 = _getReferencedFieldsA3[1]; // (F) First, collect all conflicts between these two collections of fields - // (not including any nested fragments). - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (G) Then collect conflicts between the first fragment and any nested - // fragments spread in the second fragment. - - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]); - } // (G) Then collect conflicts between the second fragment and any nested - // fragments spread in the first fragment. - - - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[i], fragmentName2); - } -} // Find all conflicts found between two selection sets, including those found -// via spreading in fragments. Called when determining if conflicts exist -// between the sub-fields of two overlapping fields. - - -function findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, parentType1, selectionSet1, parentType2, selectionSet2) { - var conflicts = []; - - var _getFieldsAndFragment2 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType1, selectionSet1), - fieldMap1 = _getFieldsAndFragment2[0], - fragmentNames1 = _getFieldsAndFragment2[1]; - - var _getFieldsAndFragment3 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType2, selectionSet2), - fieldMap2 = _getFieldsAndFragment3[0], - fragmentNames2 = _getFieldsAndFragment3[1]; // (H) First, collect all conflicts between these two collections of field. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (I) Then collect conflicts between the first collection of fields and - // those referenced by each fragment name associated with the second. - - if (fragmentNames2.length !== 0) { - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fragmentNames2[j]); - } - } // (I) Then collect conflicts between the second collection of fields and - // those referenced by each fragment name associated with the first. - - - if (fragmentNames1.length !== 0) { - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap2, fragmentNames1[i]); - } - } // (J) Also collect conflicts between any fragment names by the first and - // fragment names by the second. This compares each item in the first set of - // names to each item in the second set of names. - - - for (var _i3 = 0; _i3 < fragmentNames1.length; _i3++) { - for (var _j = 0; _j < fragmentNames2.length; _j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[_i3], fragmentNames2[_j]); - } - } - - return conflicts; -} // Collect all Conflicts "within" one collection of fields. - - -function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For every response name, if there are multiple fields, they - // must be compared to find a potential conflict. - for (var _i5 = 0, _objectEntries2 = objectEntries(fieldMap); _i5 < _objectEntries2.length; _i5++) { - var _ref5 = _objectEntries2[_i5]; - var responseName = _ref5[0]; - var fields = _ref5[1]; - - // This compares every field in the list to every other field in this list - // (except to itself). If the list only has one item, nothing needs to - // be compared. - if (fields.length > 1) { - for (var i = 0; i < fields.length; i++) { - for (var j = i + 1; j < fields.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, // within one collection is never mutually exclusive - responseName, fields[i], fields[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Collect all Conflicts between two collections of fields. This is similar to, -// but different from the `collectConflictsWithin` function above. This check -// assumes that `collectConflictsWithin` has already been called on each -// provided collection of fields. This is true because this validator traverses -// each individual selection set. - - -function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, fieldMap1, fieldMap2) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For any response name which appears in both provided field - // maps, each field from the first field map must be compared to every field - // in the second field map to find potential conflicts. - for (var _i7 = 0, _Object$keys2 = Object.keys(fieldMap1); _i7 < _Object$keys2.length; _i7++) { - var responseName = _Object$keys2[_i7]; - var fields2 = fieldMap2[responseName]; - - if (fields2) { - var fields1 = fieldMap1[responseName]; - - for (var i = 0; i < fields1.length; i++) { - for (var j = 0; j < fields2.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, fields1[i], fields2[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Determines if there is a conflict between two particular fields, including -// comparing their sub-fields. - - -function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2) { - var parentType1 = field1[0], - node1 = field1[1], - def1 = field1[2]; - var parentType2 = field2[0], - node2 = field2[1], - def2 = field2[2]; // If it is known that two fields could not possibly apply at the same - // time, due to the parent types, then it is safe to permit them to diverge - // in aliased field or arguments used as they will not present any ambiguity - // by differing. - // It is known that two parent types could never overlap if they are - // different Object types. Interface or Union types might overlap - if not - // in the current state of the schema, then perhaps in some future version, - // thus may not safely diverge. - - var areMutuallyExclusive = parentFieldsAreMutuallyExclusive || parentType1 !== parentType2 && isObjectType(parentType1) && isObjectType(parentType2); - - if (!areMutuallyExclusive) { - var _node1$arguments, _node2$arguments; - - // Two aliases must refer to the same field. - var name1 = node1.name.value; - var name2 = node2.name.value; - - if (name1 !== name2) { - return [[responseName, "\"".concat(name1, "\" and \"").concat(name2, "\" are different fields")], [node1], [node2]]; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : []; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - var args2 = (_node2$arguments = node2.arguments) !== null && _node2$arguments !== void 0 ? _node2$arguments : []; // Two field calls must have the same arguments. - - if (!sameArguments(args1, args2)) { - return [[responseName, 'they have differing arguments'], [node1], [node2]]; - } - } // The return type for each field. - - - var type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; - var type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; - - if (type1 && type2 && doTypesConflict(type1, type2)) { - return [[responseName, "they return conflicting types \"".concat(inspect(type1), "\" and \"").concat(inspect(type2), "\"")], [node1], [node2]]; - } // Collect and compare sub-fields. Use the same "visited fragment names" list - // for both collections so fields in a fragment reference are never - // compared to themselves. - - - var selectionSet1 = node1.selectionSet; - var selectionSet2 = node2.selectionSet; - - if (selectionSet1 && selectionSet2) { - var conflicts = findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, getNamedType(type1), selectionSet1, getNamedType(type2), selectionSet2); - return subfieldConflicts(conflicts, responseName, node1, node2); - } -} - -function sameArguments(arguments1, arguments2) { - if (arguments1.length !== arguments2.length) { - return false; - } - - return arguments1.every(function (argument1) { - var argument2 = find(arguments2, function (argument) { - return argument.name.value === argument1.name.value; - }); - - if (!argument2) { - return false; - } - - return sameValue(argument1.value, argument2.value); - }); -} - -function sameValue(value1, value2) { - return print(value1) === print(value2); -} // Two types conflict if both types could not apply to a value simultaneously. -// Composite types are ignored as their individual field types will be compared -// later recursively. However List and Non-Null types must match. - - -function doTypesConflict(type1, type2) { - if (isListType(type1)) { - return isListType(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if (isListType(type2)) { - return true; - } - - if (isNonNullType(type1)) { - return isNonNullType(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if (isNonNullType(type2)) { - return true; - } - - if (isLeafType(type1) || isLeafType(type2)) { - return type1 !== type2; - } - - return false; -} // Given a selection set, return the collection of fields (a mapping of response -// name to field nodes and definitions) as well as a list of fragment names -// referenced via fragment spreads. - - -function getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet) { - var cached = cachedFieldsAndFragmentNames.get(selectionSet); - - if (!cached) { - var nodeAndDefs = Object.create(null); - var fragmentNames = Object.create(null); - - _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames); - - cached = [nodeAndDefs, Object.keys(fragmentNames)]; - cachedFieldsAndFragmentNames.set(selectionSet, cached); - } - - return cached; -} // Given a reference to a fragment, return the represented collection of fields -// as well as a list of nested fragment names referenced via fragment spreads. - - -function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment) { - // Short-circuit building a type from the node if possible. - var cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); - - if (cached) { - return cached; - } - - var fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); - return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment.selectionSet); -} - -function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) { - for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) { - var selection = _selectionSet$selecti2[_i9]; - - switch (selection.kind) { - case Kind.FIELD: - { - var fieldName = selection.name.value; - var fieldDef = void 0; - - if (isObjectType(parentType) || isInterfaceType(parentType)) { - fieldDef = parentType.getFields()[fieldName]; - } - - var responseName = selection.alias ? selection.alias.value : fieldName; - - if (!nodeAndDefs[responseName]) { - nodeAndDefs[responseName] = []; - } - - nodeAndDefs[responseName].push([parentType, selection, fieldDef]); - break; - } - - case Kind.FRAGMENT_SPREAD: - fragmentNames[selection.name.value] = true; - break; - - case Kind.INLINE_FRAGMENT: - { - var typeCondition = selection.typeCondition; - var inlineFragmentType = typeCondition ? typeFromAST(context.getSchema(), typeCondition) : parentType; - - _collectFieldsAndFragmentNames(context, inlineFragmentType, selection.selectionSet, nodeAndDefs, fragmentNames); - - break; - } - } - } -} // Given a series of Conflicts which occurred between two sub-fields, generate -// a single Conflict. - - -function subfieldConflicts(conflicts, responseName, node1, node2) { - if (conflicts.length > 0) { - return [[responseName, conflicts.map(function (_ref6) { - var reason = _ref6[0]; - return reason; - })], conflicts.reduce(function (allFields, _ref7) { - var fields1 = _ref7[1]; - return allFields.concat(fields1); - }, [node1]), conflicts.reduce(function (allFields, _ref8) { - var fields2 = _ref8[2]; - return allFields.concat(fields2); - }, [node2])]; - } -} -/** - * A way to keep track of pairs of things when the ordering of the pair does - * not matter. We do this by maintaining a sort of double adjacency sets. - */ - - -var PairSet = /*#__PURE__*/function () { - function PairSet() { - this._data = Object.create(null); - } - - var _proto = PairSet.prototype; - - _proto.has = function has(a, b, areMutuallyExclusive) { - var first = this._data[a]; - var result = first && first[b]; - - if (result === undefined) { - return false; - } // areMutuallyExclusive being false is a superset of being true, - // hence if we want to know if this PairSet "has" these two with no - // exclusivity, we have to ensure it was added as such. - - - if (areMutuallyExclusive === false) { - return result === false; - } - - return true; - }; - - _proto.add = function add(a, b, areMutuallyExclusive) { - this._pairSetAdd(a, b, areMutuallyExclusive); - - this._pairSetAdd(b, a, areMutuallyExclusive); - }; - - _proto._pairSetAdd = function _pairSetAdd(a, b, areMutuallyExclusive) { - var map = this._data[a]; - - if (!map) { - map = Object.create(null); - this._data[a] = map; - } - - map[b] = areMutuallyExclusive; - }; - - return PairSet; -}(); diff --git a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts b/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts deleted file mode 100644 index 36f551df..00000000 --- a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -export function PossibleFragmentSpreadsRule( - context: ValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js b/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js deleted file mode 100644 index 427905d0..00000000 --- a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PossibleFragmentSpreadsRule = PossibleFragmentSpreadsRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -var _typeComparators = require("../../utilities/typeComparators.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -function PossibleFragmentSpreadsRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var fragType = context.getType(); - var parentType = context.getParentType(); - - if ((0, _definition.isCompositeType)(fragType) && (0, _definition.isCompositeType)(parentType) && !(0, _typeComparators.doTypesOverlap)(context.getSchema(), fragType, parentType)) { - var parentTypeStr = (0, _inspect.default)(parentType); - var fragTypeStr = (0, _inspect.default)(fragType); - context.reportError(new _GraphQLError.GraphQLError("Fragment cannot be spread here as objects of type \"".concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - }, - FragmentSpread: function FragmentSpread(node) { - var fragName = node.name.value; - var fragType = getFragmentType(context, fragName); - var parentType = context.getParentType(); - - if (fragType && parentType && !(0, _typeComparators.doTypesOverlap)(context.getSchema(), fragType, parentType)) { - var parentTypeStr = (0, _inspect.default)(parentType); - var fragTypeStr = (0, _inspect.default)(fragType); - context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(fragName, "\" cannot be spread here as objects of type \"").concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - } - }; -} - -function getFragmentType(context, name) { - var frag = context.getFragment(name); - - if (frag) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), frag.typeCondition); - - if ((0, _definition.isCompositeType)(type)) { - return type; - } - } -} diff --git a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js.flow b/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js.flow deleted file mode 100644 index 9c275bb3..00000000 --- a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js.flow +++ /dev/null @@ -1,78 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { GraphQLCompositeType } from '../../type/definition'; -import { isCompositeType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; -import { doTypesOverlap } from '../../utilities/typeComparators'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -export function PossibleFragmentSpreadsRule( - context: ValidationContext, -): ASTVisitor { - return { - InlineFragment(node) { - const fragType = context.getType(); - const parentType = context.getParentType(); - if ( - isCompositeType(fragType) && - isCompositeType(parentType) && - !doTypesOverlap(context.getSchema(), fragType, parentType) - ) { - const parentTypeStr = inspect(parentType); - const fragTypeStr = inspect(fragType); - context.reportError( - new GraphQLError( - `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, - node, - ), - ); - } - }, - FragmentSpread(node) { - const fragName = node.name.value; - const fragType = getFragmentType(context, fragName); - const parentType = context.getParentType(); - if ( - fragType && - parentType && - !doTypesOverlap(context.getSchema(), fragType, parentType) - ) { - const parentTypeStr = inspect(parentType); - const fragTypeStr = inspect(fragType); - context.reportError( - new GraphQLError( - `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, - node, - ), - ); - } - }, - }; -} - -function getFragmentType( - context: ValidationContext, - name: string, -): ?GraphQLCompositeType { - const frag = context.getFragment(name); - if (frag) { - const type = typeFromAST(context.getSchema(), frag.typeCondition); - if (isCompositeType(type)) { - return type; - } - } -} diff --git a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs b/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs deleted file mode 100644 index da459258..00000000 --- a/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs +++ /dev/null @@ -1,50 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isCompositeType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; -import { doTypesOverlap } from "../../utilities/typeComparators.mjs"; - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -export function PossibleFragmentSpreadsRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var fragType = context.getType(); - var parentType = context.getParentType(); - - if (isCompositeType(fragType) && isCompositeType(parentType) && !doTypesOverlap(context.getSchema(), fragType, parentType)) { - var parentTypeStr = inspect(parentType); - var fragTypeStr = inspect(fragType); - context.reportError(new GraphQLError("Fragment cannot be spread here as objects of type \"".concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - }, - FragmentSpread: function FragmentSpread(node) { - var fragName = node.name.value; - var fragType = getFragmentType(context, fragName); - var parentType = context.getParentType(); - - if (fragType && parentType && !doTypesOverlap(context.getSchema(), fragType, parentType)) { - var parentTypeStr = inspect(parentType); - var fragTypeStr = inspect(fragType); - context.reportError(new GraphQLError("Fragment \"".concat(fragName, "\" cannot be spread here as objects of type \"").concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - } - }; -} - -function getFragmentType(context, name) { - var frag = context.getFragment(name); - - if (frag) { - var type = typeFromAST(context.getSchema(), frag.typeCondition); - - if (isCompositeType(type)) { - return type; - } - } -} diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensions.d.ts b/node_modules/graphql/validation/rules/PossibleTypeExtensions.d.ts deleted file mode 100644 index 7573375e..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensions.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { PossibleTypeExtensionsRule } from 'graphql' - * or - * import { PossibleTypeExtensionsRule } from 'graphql/validation' - */ -export { PossibleTypeExtensionsRule as PossibleTypeExtensions } from './PossibleTypeExtensionsRule'; diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensions.js b/node_modules/graphql/validation/rules/PossibleTypeExtensions.js deleted file mode 100644 index fc15d851..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensions.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "PossibleTypeExtensions", { - enumerable: true, - get: function get() { - return _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule; - } -}); - -var _PossibleTypeExtensionsRule = require("./PossibleTypeExtensionsRule.js"); diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensions.js.flow b/node_modules/graphql/validation/rules/PossibleTypeExtensions.js.flow deleted file mode 100644 index ed223f1d..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensions.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { PossibleTypeExtensionsRule } from 'graphql' - * or - * import { PossibleTypeExtensionsRule } from 'graphql/validation' - */ -export { PossibleTypeExtensionsRule as PossibleTypeExtensions } from './PossibleTypeExtensionsRule'; diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensions.mjs b/node_modules/graphql/validation/rules/PossibleTypeExtensions.mjs deleted file mode 100644 index 99796c88..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensions.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { PossibleTypeExtensionsRule } from 'graphql' - * or - * import { PossibleTypeExtensionsRule } from 'graphql/validation' - */ -export { PossibleTypeExtensionsRule as PossibleTypeExtensions } from "./PossibleTypeExtensionsRule.mjs"; diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts b/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts deleted file mode 100644 index 8337dc5b..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -export function PossibleTypeExtensionsRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js b/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js deleted file mode 100644 index 309b12b0..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +++ /dev/null @@ -1,141 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PossibleTypeExtensionsRule = PossibleTypeExtensionsRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../../jsutils/invariant.js")); - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _predicates = require("../../language/predicates.js"); - -var _definition = require("../../type/definition.js"); - -var _defKindToExtKind; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -function PossibleTypeExtensionsRule(context) { - var schema = context.getSchema(); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if ((0, _predicates.isTypeDefinitionNode)(def)) { - definedTypes[def.name.value] = def; - } - } - - return { - ScalarTypeExtension: checkExtension, - ObjectTypeExtension: checkExtension, - InterfaceTypeExtension: checkExtension, - UnionTypeExtension: checkExtension, - EnumTypeExtension: checkExtension, - InputObjectTypeExtension: checkExtension - }; - - function checkExtension(node) { - var typeName = node.name.value; - var defNode = definedTypes[typeName]; - var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName); - var expectedKind; - - if (defNode) { - expectedKind = defKindToExtKind[defNode.kind]; - } else if (existingType) { - expectedKind = typeToExtKind(existingType); - } - - if (expectedKind) { - if (expectedKind !== node.kind) { - var kindStr = extensionKindToTypeName(node.kind); - context.reportError(new _GraphQLError.GraphQLError("Cannot extend non-".concat(kindStr, " type \"").concat(typeName, "\"."), defNode ? [defNode, node] : node)); - } - } else { - var allTypeNames = Object.keys(definedTypes); - - if (schema) { - allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap())); - } - - var suggestedTypes = (0, _suggestionList.default)(typeName, allTypeNames); - context.reportError(new _GraphQLError.GraphQLError("Cannot extend type \"".concat(typeName, "\" because it is not defined.") + (0, _didYouMean.default)(suggestedTypes), node.name)); - } - } -} - -var defKindToExtKind = (_defKindToExtKind = {}, _defineProperty(_defKindToExtKind, _kinds.Kind.SCALAR_TYPE_DEFINITION, _kinds.Kind.SCALAR_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.OBJECT_TYPE_DEFINITION, _kinds.Kind.OBJECT_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.INTERFACE_TYPE_DEFINITION, _kinds.Kind.INTERFACE_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.UNION_TYPE_DEFINITION, _kinds.Kind.UNION_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.ENUM_TYPE_DEFINITION, _kinds.Kind.ENUM_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION), _defKindToExtKind); - -function typeToExtKind(type) { - if ((0, _definition.isScalarType)(type)) { - return _kinds.Kind.SCALAR_TYPE_EXTENSION; - } - - if ((0, _definition.isObjectType)(type)) { - return _kinds.Kind.OBJECT_TYPE_EXTENSION; - } - - if ((0, _definition.isInterfaceType)(type)) { - return _kinds.Kind.INTERFACE_TYPE_EXTENSION; - } - - if ((0, _definition.isUnionType)(type)) { - return _kinds.Kind.UNION_TYPE_EXTENSION; - } - - if ((0, _definition.isEnumType)(type)) { - return _kinds.Kind.ENUM_TYPE_EXTENSION; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isInputObjectType)(type)) { - return _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); -} - -function extensionKindToTypeName(kind) { - switch (kind) { - case _kinds.Kind.SCALAR_TYPE_EXTENSION: - return 'scalar'; - - case _kinds.Kind.OBJECT_TYPE_EXTENSION: - return 'object'; - - case _kinds.Kind.INTERFACE_TYPE_EXTENSION: - return 'interface'; - - case _kinds.Kind.UNION_TYPE_EXTENSION: - return 'union'; - - case _kinds.Kind.ENUM_TYPE_EXTENSION: - return 'enum'; - - case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: - return 'input object'; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected kind: ' + (0, _inspect.default)(kind)); -} diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js.flow b/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js.flow deleted file mode 100644 index 15ec1b42..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js.flow +++ /dev/null @@ -1,145 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; -import invariant from '../../jsutils/invariant'; -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { KindEnum } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; -import type { TypeExtensionNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { isTypeDefinitionNode } from '../../language/predicates'; - -import type { GraphQLNamedType } from '../../type/definition'; -import { - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, -} from '../../type/definition'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -export function PossibleTypeExtensionsRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const definedTypes = Object.create(null); - - for (const def of context.getDocument().definitions) { - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = def; - } - } - - return { - ScalarTypeExtension: checkExtension, - ObjectTypeExtension: checkExtension, - InterfaceTypeExtension: checkExtension, - UnionTypeExtension: checkExtension, - EnumTypeExtension: checkExtension, - InputObjectTypeExtension: checkExtension, - }; - - function checkExtension(node: TypeExtensionNode): void { - const typeName = node.name.value; - const defNode = definedTypes[typeName]; - const existingType = schema?.getType(typeName); - - let expectedKind; - if (defNode) { - expectedKind = defKindToExtKind[defNode.kind]; - } else if (existingType) { - expectedKind = typeToExtKind(existingType); - } - - if (expectedKind) { - if (expectedKind !== node.kind) { - const kindStr = extensionKindToTypeName(node.kind); - context.reportError( - new GraphQLError( - `Cannot extend non-${kindStr} type "${typeName}".`, - defNode ? [defNode, node] : node, - ), - ); - } - } else { - let allTypeNames = Object.keys(definedTypes); - if (schema) { - allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap())); - } - - const suggestedTypes = suggestionList(typeName, allTypeNames); - context.reportError( - new GraphQLError( - `Cannot extend type "${typeName}" because it is not defined.` + - didYouMean(suggestedTypes), - node.name, - ), - ); - } - } -} - -const defKindToExtKind = { - [Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION, - [Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION, - [Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION, - [Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION, - [Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION, - [Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION, -}; - -function typeToExtKind(type: GraphQLNamedType): KindEnum { - if (isScalarType(type)) { - return Kind.SCALAR_TYPE_EXTENSION; - } - if (isObjectType(type)) { - return Kind.OBJECT_TYPE_EXTENSION; - } - if (isInterfaceType(type)) { - return Kind.INTERFACE_TYPE_EXTENSION; - } - if (isUnionType(type)) { - return Kind.UNION_TYPE_EXTENSION; - } - if (isEnumType(type)) { - return Kind.ENUM_TYPE_EXTENSION; - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isInputObjectType(type)) { - return Kind.INPUT_OBJECT_TYPE_EXTENSION; - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected type: ' + inspect((type: empty))); -} - -function extensionKindToTypeName(kind: KindEnum): string { - switch (kind) { - case Kind.SCALAR_TYPE_EXTENSION: - return 'scalar'; - case Kind.OBJECT_TYPE_EXTENSION: - return 'object'; - case Kind.INTERFACE_TYPE_EXTENSION: - return 'interface'; - case Kind.UNION_TYPE_EXTENSION: - return 'union'; - case Kind.ENUM_TYPE_EXTENSION: - return 'enum'; - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return 'input object'; - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected kind: ' + inspect(kind)); -} diff --git a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs b/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs deleted file mode 100644 index b1066b53..00000000 --- a/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs +++ /dev/null @@ -1,124 +0,0 @@ -var _defKindToExtKind; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import inspect from "../../jsutils/inspect.mjs"; -import invariant from "../../jsutils/invariant.mjs"; -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isTypeDefinitionNode } from "../../language/predicates.mjs"; -import { isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType } from "../../type/definition.mjs"; - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -export function PossibleTypeExtensionsRule(context) { - var schema = context.getSchema(); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = def; - } - } - - return { - ScalarTypeExtension: checkExtension, - ObjectTypeExtension: checkExtension, - InterfaceTypeExtension: checkExtension, - UnionTypeExtension: checkExtension, - EnumTypeExtension: checkExtension, - InputObjectTypeExtension: checkExtension - }; - - function checkExtension(node) { - var typeName = node.name.value; - var defNode = definedTypes[typeName]; - var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName); - var expectedKind; - - if (defNode) { - expectedKind = defKindToExtKind[defNode.kind]; - } else if (existingType) { - expectedKind = typeToExtKind(existingType); - } - - if (expectedKind) { - if (expectedKind !== node.kind) { - var kindStr = extensionKindToTypeName(node.kind); - context.reportError(new GraphQLError("Cannot extend non-".concat(kindStr, " type \"").concat(typeName, "\"."), defNode ? [defNode, node] : node)); - } - } else { - var allTypeNames = Object.keys(definedTypes); - - if (schema) { - allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap())); - } - - var suggestedTypes = suggestionList(typeName, allTypeNames); - context.reportError(new GraphQLError("Cannot extend type \"".concat(typeName, "\" because it is not defined.") + didYouMean(suggestedTypes), node.name)); - } - } -} -var defKindToExtKind = (_defKindToExtKind = {}, _defineProperty(_defKindToExtKind, Kind.SCALAR_TYPE_DEFINITION, Kind.SCALAR_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.OBJECT_TYPE_DEFINITION, Kind.OBJECT_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.INTERFACE_TYPE_DEFINITION, Kind.INTERFACE_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.UNION_TYPE_DEFINITION, Kind.UNION_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.ENUM_TYPE_DEFINITION, Kind.ENUM_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_EXTENSION), _defKindToExtKind); - -function typeToExtKind(type) { - if (isScalarType(type)) { - return Kind.SCALAR_TYPE_EXTENSION; - } - - if (isObjectType(type)) { - return Kind.OBJECT_TYPE_EXTENSION; - } - - if (isInterfaceType(type)) { - return Kind.INTERFACE_TYPE_EXTENSION; - } - - if (isUnionType(type)) { - return Kind.UNION_TYPE_EXTENSION; - } - - if (isEnumType(type)) { - return Kind.ENUM_TYPE_EXTENSION; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isInputObjectType(type)) { - return Kind.INPUT_OBJECT_TYPE_EXTENSION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected type: ' + inspect(type)); -} - -function extensionKindToTypeName(kind) { - switch (kind) { - case Kind.SCALAR_TYPE_EXTENSION: - return 'scalar'; - - case Kind.OBJECT_TYPE_EXTENSION: - return 'object'; - - case Kind.INTERFACE_TYPE_EXTENSION: - return 'interface'; - - case Kind.UNION_TYPE_EXTENSION: - return 'union'; - - case Kind.ENUM_TYPE_EXTENSION: - return 'enum'; - - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return 'input object'; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected kind: ' + inspect(kind)); -} diff --git a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts b/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts deleted file mode 100644 index 116069ce..00000000 --- a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -export function ProvidedRequiredArgumentsRule( - context: ValidationContext, -): ASTVisitor; - -/** - * @internal - */ -export function ProvidedRequiredArgumentsOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js b/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js deleted file mode 100644 index b4735cf8..00000000 --- a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ProvidedRequiredArgumentsRule = ProvidedRequiredArgumentsRule; -exports.ProvidedRequiredArgumentsOnDirectivesRule = ProvidedRequiredArgumentsOnDirectivesRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _keyMap = _interopRequireDefault(require("../../jsutils/keyMap.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _printer = require("../../language/printer.js"); - -var _directives = require("../../type/directives.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -function ProvidedRequiredArgumentsRule(context) { - return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, { - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(fieldNode) { - var _fieldNode$arguments; - - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - return false; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var argNodes = (_fieldNode$arguments = fieldNode.arguments) !== null && _fieldNode$arguments !== void 0 ? _fieldNode$arguments : []; - var argNodeMap = (0, _keyMap.default)(argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i2 = 0, _fieldDef$args2 = fieldDef.args; _i2 < _fieldDef$args2.length; _i2++) { - var argDef = _fieldDef$args2[_i2]; - var argNode = argNodeMap[argDef.name]; - - if (!argNode && (0, _definition.isRequiredArgument)(argDef)) { - var argTypeStr = (0, _inspect.default)(argDef.type); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), fieldNode)); - } - } - } - } - }); -} -/** - * @internal - */ - - -function ProvidedRequiredArgumentsOnDirectivesRule(context) { - var requiredArgsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i4 = 0; _i4 < definedDirectives.length; _i4++) { - var directive = definedDirectives[_i4]; - requiredArgsMap[directive.name] = (0, _keyMap.default)(directive.args.filter(_definition.isRequiredArgument), function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i6 = 0; _i6 < astDefinitions.length; _i6++) { - var def = astDefinitions[_i6]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - requiredArgsMap[def.name.value] = (0, _keyMap.default)(argNodes.filter(isRequiredArgumentNode), function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(directiveNode) { - var directiveName = directiveNode.name.value; - var requiredArgs = requiredArgsMap[directiveName]; - - if (requiredArgs) { - var _directiveNode$argume; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var _argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; - - var argNodeMap = (0, _keyMap.default)(_argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i8 = 0, _Object$keys2 = Object.keys(requiredArgs); _i8 < _Object$keys2.length; _i8++) { - var argName = _Object$keys2[_i8]; - - if (!argNodeMap[argName]) { - var argType = requiredArgs[argName].type; - var argTypeStr = (0, _definition.isType)(argType) ? (0, _inspect.default)(argType) : (0, _printer.print)(argType); - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveName, "\" argument \"").concat(argName, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), directiveNode)); - } - } - } - } - } - }; -} - -function isRequiredArgumentNode(arg) { - return arg.type.kind === _kinds.Kind.NON_NULL_TYPE && arg.defaultValue == null; -} diff --git a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js.flow b/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js.flow deleted file mode 100644 index 11b9b3e0..00000000 --- a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js.flow +++ /dev/null @@ -1,125 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; -import keyMap from '../../jsutils/keyMap'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { InputValueDefinitionNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { print } from '../../language/printer'; - -import { specifiedDirectives } from '../../type/directives'; -import { isType, isRequiredArgument } from '../../type/definition'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -export function ProvidedRequiredArgumentsRule( - context: ValidationContext, -): ASTVisitor { - return { - // eslint-disable-next-line new-cap - ...ProvidedRequiredArgumentsOnDirectivesRule(context), - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave(fieldNode) { - const fieldDef = context.getFieldDef(); - if (!fieldDef) { - return false; - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argNodes = fieldNode.arguments ?? []; - const argNodeMap = keyMap(argNodes, (arg) => arg.name.value); - for (const argDef of fieldDef.args) { - const argNode = argNodeMap[argDef.name]; - if (!argNode && isRequiredArgument(argDef)) { - const argTypeStr = inspect(argDef.type); - context.reportError( - new GraphQLError( - `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, - fieldNode, - ), - ); - } - } - }, - }, - }; -} - -/** - * @internal - */ -export function ProvidedRequiredArgumentsOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const requiredArgsMap = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - requiredArgsMap[directive.name] = keyMap( - directive.args.filter(isRequiredArgument), - (arg) => arg.name, - ); - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argNodes = def.arguments ?? []; - - requiredArgsMap[def.name.value] = keyMap( - argNodes.filter(isRequiredArgumentNode), - (arg) => arg.name.value, - ); - } - } - - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave(directiveNode) { - const directiveName = directiveNode.name.value; - const requiredArgs = requiredArgsMap[directiveName]; - if (requiredArgs) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argNodes = directiveNode.arguments ?? []; - const argNodeMap = keyMap(argNodes, (arg) => arg.name.value); - for (const argName of Object.keys(requiredArgs)) { - if (!argNodeMap[argName]) { - const argType = requiredArgs[argName].type; - const argTypeStr = isType(argType) - ? inspect(argType) - : print(argType); - - context.reportError( - new GraphQLError( - `Directive "@${directiveName}" argument "${argName}" of type "${argTypeStr}" is required, but it was not provided.`, - directiveNode, - ), - ); - } - } - } - }, - }, - }; -} - -function isRequiredArgumentNode(arg: InputValueDefinitionNode): boolean { - return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; -} diff --git a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs b/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs deleted file mode 100644 index dc476b4a..00000000 --- a/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs +++ /dev/null @@ -1,119 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import inspect from "../../jsutils/inspect.mjs"; -import keyMap from "../../jsutils/keyMap.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { print } from "../../language/printer.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; -import { isType, isRequiredArgument } from "../../type/definition.mjs"; - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -export function ProvidedRequiredArgumentsRule(context) { - return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, { - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(fieldNode) { - var _fieldNode$arguments; - - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - return false; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var argNodes = (_fieldNode$arguments = fieldNode.arguments) !== null && _fieldNode$arguments !== void 0 ? _fieldNode$arguments : []; - var argNodeMap = keyMap(argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i2 = 0, _fieldDef$args2 = fieldDef.args; _i2 < _fieldDef$args2.length; _i2++) { - var argDef = _fieldDef$args2[_i2]; - var argNode = argNodeMap[argDef.name]; - - if (!argNode && isRequiredArgument(argDef)) { - var argTypeStr = inspect(argDef.type); - context.reportError(new GraphQLError("Field \"".concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), fieldNode)); - } - } - } - } - }); -} -/** - * @internal - */ - -export function ProvidedRequiredArgumentsOnDirectivesRule(context) { - var requiredArgsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i4 = 0; _i4 < definedDirectives.length; _i4++) { - var directive = definedDirectives[_i4]; - requiredArgsMap[directive.name] = keyMap(directive.args.filter(isRequiredArgument), function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i6 = 0; _i6 < astDefinitions.length; _i6++) { - var def = astDefinitions[_i6]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - requiredArgsMap[def.name.value] = keyMap(argNodes.filter(isRequiredArgumentNode), function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(directiveNode) { - var directiveName = directiveNode.name.value; - var requiredArgs = requiredArgsMap[directiveName]; - - if (requiredArgs) { - var _directiveNode$argume; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var _argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; - - var argNodeMap = keyMap(_argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i8 = 0, _Object$keys2 = Object.keys(requiredArgs); _i8 < _Object$keys2.length; _i8++) { - var argName = _Object$keys2[_i8]; - - if (!argNodeMap[argName]) { - var argType = requiredArgs[argName].type; - var argTypeStr = isType(argType) ? inspect(argType) : print(argType); - context.reportError(new GraphQLError("Directive \"@".concat(directiveName, "\" argument \"").concat(argName, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), directiveNode)); - } - } - } - } - } - }; -} - -function isRequiredArgumentNode(arg) { - return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; -} diff --git a/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts b/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts deleted file mode 100644 index ae956efc..00000000 --- a/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -export function ScalarLeafsRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/ScalarLeafsRule.js b/node_modules/graphql/validation/rules/ScalarLeafsRule.js deleted file mode 100644 index fc1d5deb..00000000 --- a/node_modules/graphql/validation/rules/ScalarLeafsRule.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ScalarLeafsRule = ScalarLeafsRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -function ScalarLeafsRule(context) { - return { - Field: function Field(node) { - var type = context.getType(); - var selectionSet = node.selectionSet; - - if (type) { - if ((0, _definition.isLeafType)((0, _definition.getNamedType)(type))) { - if (selectionSet) { - var fieldName = node.name.value; - var typeStr = (0, _inspect.default)(type); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(fieldName, "\" must not have a selection since type \"").concat(typeStr, "\" has no subfields."), selectionSet)); - } - } else if (!selectionSet) { - var _fieldName = node.name.value; - - var _typeStr = (0, _inspect.default)(type); - - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(_fieldName, "\" of type \"").concat(_typeStr, "\" must have a selection of subfields. Did you mean \"").concat(_fieldName, " { ... }\"?"), node)); - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/ScalarLeafsRule.js.flow b/node_modules/graphql/validation/rules/ScalarLeafsRule.js.flow deleted file mode 100644 index cac22c5f..00000000 --- a/node_modules/graphql/validation/rules/ScalarLeafsRule.js.flow +++ /dev/null @@ -1,49 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { FieldNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; - -import { getNamedType, isLeafType } from '../../type/definition'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -export function ScalarLeafsRule(context: ValidationContext): ASTVisitor { - return { - Field(node: FieldNode) { - const type = context.getType(); - const selectionSet = node.selectionSet; - if (type) { - if (isLeafType(getNamedType(type))) { - if (selectionSet) { - const fieldName = node.name.value; - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, - selectionSet, - ), - ); - } - } else if (!selectionSet) { - const fieldName = node.name.value; - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, - node, - ), - ); - } - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs b/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs deleted file mode 100644 index 8a5111dc..00000000 --- a/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { getNamedType, isLeafType } from "../../type/definition.mjs"; - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -export function ScalarLeafsRule(context) { - return { - Field: function Field(node) { - var type = context.getType(); - var selectionSet = node.selectionSet; - - if (type) { - if (isLeafType(getNamedType(type))) { - if (selectionSet) { - var fieldName = node.name.value; - var typeStr = inspect(type); - context.reportError(new GraphQLError("Field \"".concat(fieldName, "\" must not have a selection since type \"").concat(typeStr, "\" has no subfields."), selectionSet)); - } - } else if (!selectionSet) { - var _fieldName = node.name.value; - - var _typeStr = inspect(type); - - context.reportError(new GraphQLError("Field \"".concat(_fieldName, "\" of type \"").concat(_typeStr, "\" must have a selection of subfields. Did you mean \"").concat(_fieldName, " { ... }\"?"), node)); - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts b/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts deleted file mode 100644 index d56c4fdd..00000000 --- a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -export function SingleFieldSubscriptionsRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js b/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js deleted file mode 100644 index 80d199fc..00000000 --- a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SingleFieldSubscriptionsRule = SingleFieldSubscriptionsRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -function SingleFieldSubscriptionsRule(context) { - return { - OperationDefinition: function OperationDefinition(node) { - if (node.operation === 'subscription') { - if (node.selectionSet.selections.length !== 1) { - context.reportError(new _GraphQLError.GraphQLError(node.name ? "Subscription \"".concat(node.name.value, "\" must select only one top level field.") : 'Anonymous Subscription must select only one top level field.', node.selectionSet.selections.slice(1))); - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js.flow b/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js.flow deleted file mode 100644 index 290432f0..00000000 --- a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js.flow +++ /dev/null @@ -1,33 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { OperationDefinitionNode } from '../../language/ast'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -export function SingleFieldSubscriptionsRule( - context: ASTValidationContext, -): ASTVisitor { - return { - OperationDefinition(node: OperationDefinitionNode) { - if (node.operation === 'subscription') { - if (node.selectionSet.selections.length !== 1) { - context.reportError( - new GraphQLError( - node.name - ? `Subscription "${node.name.value}" must select only one top level field.` - : 'Anonymous Subscription must select only one top level field.', - node.selectionSet.selections.slice(1), - ), - ); - } - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs b/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs deleted file mode 100644 index 0dd5351e..00000000 --- a/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -export function SingleFieldSubscriptionsRule(context) { - return { - OperationDefinition: function OperationDefinition(node) { - if (node.operation === 'subscription') { - if (node.selectionSet.selections.length !== 1) { - context.reportError(new GraphQLError(node.name ? "Subscription \"".concat(node.name.value, "\" must select only one top level field.") : 'Anonymous Subscription must select only one top level field.', node.selectionSet.selections.slice(1))); - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts deleted file mode 100644 index 1d0d4f41..00000000 --- a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -export function UniqueArgumentNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js b/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js deleted file mode 100644 index f3fe5993..00000000 --- a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueArgumentNamesRule = UniqueArgumentNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -function UniqueArgumentNamesRule(context) { - var knownArgNames = Object.create(null); - return { - Field: function Field() { - knownArgNames = Object.create(null); - }, - Directive: function Directive() { - knownArgNames = Object.create(null); - }, - Argument: function Argument(node) { - var argName = node.name.value; - - if (knownArgNames[argName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one argument named \"".concat(argName, "\"."), [knownArgNames[argName], node.name])); - } else { - knownArgNames[argName] = node.name; - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js.flow deleted file mode 100644 index 499e6ed9..00000000 --- a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -export function UniqueArgumentNamesRule( - context: ASTValidationContext, -): ASTVisitor { - let knownArgNames = Object.create(null); - return { - Field() { - knownArgNames = Object.create(null); - }, - Directive() { - knownArgNames = Object.create(null); - }, - Argument(node) { - const argName = node.name.value; - if (knownArgNames[argName]) { - context.reportError( - new GraphQLError( - `There can be only one argument named "${argName}".`, - [knownArgNames[argName], node.name], - ), - ); - } else { - knownArgNames[argName] = node.name; - } - return false; - }, - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs deleted file mode 100644 index 5359d086..00000000 --- a/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs +++ /dev/null @@ -1,30 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -export function UniqueArgumentNamesRule(context) { - var knownArgNames = Object.create(null); - return { - Field: function Field() { - knownArgNames = Object.create(null); - }, - Directive: function Directive() { - knownArgNames = Object.create(null); - }, - Argument: function Argument(node) { - var argName = node.name.value; - - if (knownArgNames[argName]) { - context.reportError(new GraphQLError("There can be only one argument named \"".concat(argName, "\"."), [knownArgNames[argName], node.name])); - } else { - knownArgNames[argName] = node.name; - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNames.d.ts b/node_modules/graphql/validation/rules/UniqueDirectiveNames.d.ts deleted file mode 100644 index c197e87c..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueDirectiveNamesRule } from 'graphql' - * or - * import { UniqueDirectiveNamesRule } from 'graphql/validation' - */ -export { UniqueDirectiveNamesRule as UniqueDirectiveNames } from './UniqueDirectiveNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNames.js b/node_modules/graphql/validation/rules/UniqueDirectiveNames.js deleted file mode 100644 index 0e94e14a..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueDirectiveNames", { - enumerable: true, - get: function get() { - return _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule; - } -}); - -var _UniqueDirectiveNamesRule = require("./UniqueDirectiveNamesRule.js"); diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNames.js.flow b/node_modules/graphql/validation/rules/UniqueDirectiveNames.js.flow deleted file mode 100644 index 0dc4598d..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueDirectiveNamesRule } from 'graphql' - * or - * import { UniqueDirectiveNamesRule } from 'graphql/validation' - */ -export { UniqueDirectiveNamesRule as UniqueDirectiveNames } from './UniqueDirectiveNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNames.mjs b/node_modules/graphql/validation/rules/UniqueDirectiveNames.mjs deleted file mode 100644 index 24f4e399..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueDirectiveNamesRule } from 'graphql' - * or - * import { UniqueDirectiveNamesRule } from 'graphql/validation' - */ -export { UniqueDirectiveNamesRule as UniqueDirectiveNames } from "./UniqueDirectiveNamesRule.mjs"; diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts deleted file mode 100644 index a4dd8419..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -export function UniqueDirectiveNamesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js b/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js deleted file mode 100644 index 077da6bc..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueDirectiveNamesRule = UniqueDirectiveNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -function UniqueDirectiveNamesRule(context) { - var knownDirectiveNames = Object.create(null); - var schema = context.getSchema(); - return { - DirectiveDefinition: function DirectiveDefinition(node) { - var directiveName = node.name.value; - - if (schema === null || schema === void 0 ? void 0 : schema.getDirective(directiveName)) { - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveName, "\" already exists in the schema. It cannot be redefined."), node.name)); - return; - } - - if (knownDirectiveNames[directiveName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one directive named \"@".concat(directiveName, "\"."), [knownDirectiveNames[directiveName], node.name])); - } else { - knownDirectiveNames[directiveName] = node.name; - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js.flow deleted file mode 100644 index 688a2bb6..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js.flow +++ /dev/null @@ -1,46 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -export function UniqueDirectiveNamesRule( - context: SDLValidationContext, -): ASTVisitor { - const knownDirectiveNames = Object.create(null); - const schema = context.getSchema(); - - return { - DirectiveDefinition(node) { - const directiveName = node.name.value; - - if (schema?.getDirective(directiveName)) { - context.reportError( - new GraphQLError( - `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, - node.name, - ), - ); - return; - } - - if (knownDirectiveNames[directiveName]) { - context.reportError( - new GraphQLError( - `There can be only one directive named "@${directiveName}".`, - [knownDirectiveNames[directiveName], node.name], - ), - ); - } else { - knownDirectiveNames[directiveName] = node.name; - } - - return false; - }, - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs deleted file mode 100644 index b77197a3..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs +++ /dev/null @@ -1,29 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -export function UniqueDirectiveNamesRule(context) { - var knownDirectiveNames = Object.create(null); - var schema = context.getSchema(); - return { - DirectiveDefinition: function DirectiveDefinition(node) { - var directiveName = node.name.value; - - if (schema === null || schema === void 0 ? void 0 : schema.getDirective(directiveName)) { - context.reportError(new GraphQLError("Directive \"@".concat(directiveName, "\" already exists in the schema. It cannot be redefined."), node.name)); - return; - } - - if (knownDirectiveNames[directiveName]) { - context.reportError(new GraphQLError("There can be only one directive named \"@".concat(directiveName, "\"."), [knownDirectiveNames[directiveName], node.name])); - } else { - knownDirectiveNames[directiveName] = node.name; - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts b/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts deleted file mode 100644 index d0594465..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all directives at a given location - * are uniquely named. - */ -export function UniqueDirectivesPerLocationRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js b/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js deleted file mode 100644 index 9505a37f..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +++ /dev/null @@ -1,82 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueDirectivesPerLocationRule = UniqueDirectivesPerLocationRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _predicates = require("../../language/predicates.js"); - -var _directives = require("../../type/directives.js"); - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all non-repeatable directives at - * a given location are uniquely named. - */ -function UniqueDirectivesPerLocationRule(context) { - var uniqueDirectiveMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - uniqueDirectiveMap[directive.name] = !directive.isRepeatable; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap[def.name.value] = !def.repeatable; - } - } - - var schemaDirectives = Object.create(null); - var typeDirectivesMap = Object.create(null); - return { - // Many different AST nodes may contain directives. Rather than listing - // them all, just listen for entering any node, and check to see if it - // defines any directives. - enter: function enter(node) { - if (node.directives == null) { - return; - } - - var seenDirectives; - - if (node.kind === _kinds.Kind.SCHEMA_DEFINITION || node.kind === _kinds.Kind.SCHEMA_EXTENSION) { - seenDirectives = schemaDirectives; - } else if ((0, _predicates.isTypeDefinitionNode)(node) || (0, _predicates.isTypeExtensionNode)(node)) { - var typeName = node.name.value; - seenDirectives = typeDirectivesMap[typeName]; - - if (seenDirectives === undefined) { - typeDirectivesMap[typeName] = seenDirectives = Object.create(null); - } - } else { - seenDirectives = Object.create(null); - } - - for (var _i6 = 0, _node$directives2 = node.directives; _i6 < _node$directives2.length; _i6++) { - var _directive = _node$directives2[_i6]; - var directiveName = _directive.name.value; - - if (uniqueDirectiveMap[directiveName]) { - if (seenDirectives[directiveName]) { - context.reportError(new _GraphQLError.GraphQLError("The directive \"@".concat(directiveName, "\" can only be used once at this location."), [seenDirectives[directiveName], _directive])); - } else { - seenDirectives[directiveName] = _directive; - } - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js.flow b/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js.flow deleted file mode 100644 index a753a848..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js.flow +++ /dev/null @@ -1,90 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import { Kind } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; -import { - isTypeDefinitionNode, - isTypeExtensionNode, -} from '../../language/predicates'; - -import { specifiedDirectives } from '../../type/directives'; - -import type { - SDLValidationContext, - ValidationContext, -} from '../ValidationContext'; - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all non-repeatable directives at - * a given location are uniquely named. - */ -export function UniqueDirectivesPerLocationRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const uniqueDirectiveMap = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - uniqueDirectiveMap[directive.name] = !directive.isRepeatable; - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap[def.name.value] = !def.repeatable; - } - } - - const schemaDirectives = Object.create(null); - const typeDirectivesMap = Object.create(null); - - return { - // Many different AST nodes may contain directives. Rather than listing - // them all, just listen for entering any node, and check to see if it - // defines any directives. - enter(node) { - if (node.directives == null) { - return; - } - - let seenDirectives; - if ( - node.kind === Kind.SCHEMA_DEFINITION || - node.kind === Kind.SCHEMA_EXTENSION - ) { - seenDirectives = schemaDirectives; - } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { - const typeName = node.name.value; - seenDirectives = typeDirectivesMap[typeName]; - if (seenDirectives === undefined) { - typeDirectivesMap[typeName] = seenDirectives = Object.create(null); - } - } else { - seenDirectives = Object.create(null); - } - - for (const directive of node.directives) { - const directiveName = directive.name.value; - - if (uniqueDirectiveMap[directiveName]) { - if (seenDirectives[directiveName]) { - context.reportError( - new GraphQLError( - `The directive "@${directiveName}" can only be used once at this location.`, - [seenDirectives[directiveName], directive], - ), - ); - } else { - seenDirectives[directiveName] = directive; - } - } - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs b/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs deleted file mode 100644 index 9a3951af..00000000 --- a/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +++ /dev/null @@ -1,72 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isTypeDefinitionNode, isTypeExtensionNode } from "../../language/predicates.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all non-repeatable directives at - * a given location are uniquely named. - */ -export function UniqueDirectivesPerLocationRule(context) { - var uniqueDirectiveMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - uniqueDirectiveMap[directive.name] = !directive.isRepeatable; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap[def.name.value] = !def.repeatable; - } - } - - var schemaDirectives = Object.create(null); - var typeDirectivesMap = Object.create(null); - return { - // Many different AST nodes may contain directives. Rather than listing - // them all, just listen for entering any node, and check to see if it - // defines any directives. - enter: function enter(node) { - if (node.directives == null) { - return; - } - - var seenDirectives; - - if (node.kind === Kind.SCHEMA_DEFINITION || node.kind === Kind.SCHEMA_EXTENSION) { - seenDirectives = schemaDirectives; - } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { - var typeName = node.name.value; - seenDirectives = typeDirectivesMap[typeName]; - - if (seenDirectives === undefined) { - typeDirectivesMap[typeName] = seenDirectives = Object.create(null); - } - } else { - seenDirectives = Object.create(null); - } - - for (var _i6 = 0, _node$directives2 = node.directives; _i6 < _node$directives2.length; _i6++) { - var _directive = _node$directives2[_i6]; - var directiveName = _directive.name.value; - - if (uniqueDirectiveMap[directiveName]) { - if (seenDirectives[directiveName]) { - context.reportError(new GraphQLError("The directive \"@".concat(directiveName, "\" can only be used once at this location."), [seenDirectives[directiveName], _directive])); - } else { - seenDirectives[directiveName] = _directive; - } - } - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNames.d.ts b/node_modules/graphql/validation/rules/UniqueEnumValueNames.d.ts deleted file mode 100644 index 96d9b787..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueEnumValueNamesRule } from 'graphql' - * or - * import { UniqueEnumValueNamesRule } from 'graphql/validation' - */ -export { UniqueEnumValueNamesRule as UniqueEnumValueNames } from './UniqueEnumValueNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNames.js b/node_modules/graphql/validation/rules/UniqueEnumValueNames.js deleted file mode 100644 index 4a9b5e5b..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueEnumValueNames", { - enumerable: true, - get: function get() { - return _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule; - } -}); - -var _UniqueEnumValueNamesRule = require("./UniqueEnumValueNamesRule.js"); diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNames.js.flow b/node_modules/graphql/validation/rules/UniqueEnumValueNames.js.flow deleted file mode 100644 index 4c67b17a..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueEnumValueNamesRule } from 'graphql' - * or - * import { UniqueEnumValueNamesRule } from 'graphql/validation' - */ -export { UniqueEnumValueNamesRule as UniqueEnumValueNames } from './UniqueEnumValueNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNames.mjs b/node_modules/graphql/validation/rules/UniqueEnumValueNames.mjs deleted file mode 100644 index 05f361a8..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueEnumValueNamesRule } from 'graphql' - * or - * import { UniqueEnumValueNamesRule } from 'graphql/validation' - */ -export { UniqueEnumValueNamesRule as UniqueEnumValueNames } from "./UniqueEnumValueNamesRule.mjs"; diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts deleted file mode 100644 index 9c5ff50a..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -export function UniqueEnumValueNamesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js b/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js deleted file mode 100644 index 1fed87a4..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueEnumValueNamesRule = UniqueEnumValueNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -function UniqueEnumValueNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownValueNames = Object.create(null); - return { - EnumTypeDefinition: checkValueUniqueness, - EnumTypeExtension: checkValueUniqueness - }; - - function checkValueUniqueness(node) { - var _node$values; - - var typeName = node.name.value; - - if (!knownValueNames[typeName]) { - knownValueNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; - var valueNames = knownValueNames[typeName]; - - for (var _i2 = 0; _i2 < valueNodes.length; _i2++) { - var valueDef = valueNodes[_i2]; - var valueName = valueDef.name.value; - var existingType = existingTypeMap[typeName]; - - if ((0, _definition.isEnumType)(existingType) && existingType.getValue(valueName)) { - context.reportError(new _GraphQLError.GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" already exists in the schema. It cannot also be defined in this type extension."), valueDef.name)); - } else if (valueNames[valueName]) { - context.reportError(new _GraphQLError.GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" can only be defined once."), [valueNames[valueName], valueDef.name])); - } else { - valueNames[valueName] = valueDef.name; - } - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js.flow deleted file mode 100644 index 09515e80..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js.flow +++ /dev/null @@ -1,69 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - EnumTypeDefinitionNode, - EnumTypeExtensionNode, -} from '../../language/ast'; - -import { isEnumType } from '../../type/definition'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -export function UniqueEnumValueNamesRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - const knownValueNames = Object.create(null); - - return { - EnumTypeDefinition: checkValueUniqueness, - EnumTypeExtension: checkValueUniqueness, - }; - - function checkValueUniqueness( - node: EnumTypeDefinitionNode | EnumTypeExtensionNode, - ) { - const typeName = node.name.value; - - if (!knownValueNames[typeName]) { - knownValueNames[typeName] = Object.create(null); - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const valueNodes = node.values ?? []; - const valueNames = knownValueNames[typeName]; - - for (const valueDef of valueNodes) { - const valueName = valueDef.name.value; - - const existingType = existingTypeMap[typeName]; - if (isEnumType(existingType) && existingType.getValue(valueName)) { - context.reportError( - new GraphQLError( - `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, - valueDef.name, - ), - ); - } else if (valueNames[valueName]) { - context.reportError( - new GraphQLError( - `Enum value "${typeName}.${valueName}" can only be defined once.`, - [valueNames[valueName], valueDef.name], - ), - ); - } else { - valueNames[valueName] = valueDef.name; - } - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs deleted file mode 100644 index 4e821b8d..00000000 --- a/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs +++ /dev/null @@ -1,47 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isEnumType } from "../../type/definition.mjs"; - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -export function UniqueEnumValueNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownValueNames = Object.create(null); - return { - EnumTypeDefinition: checkValueUniqueness, - EnumTypeExtension: checkValueUniqueness - }; - - function checkValueUniqueness(node) { - var _node$values; - - var typeName = node.name.value; - - if (!knownValueNames[typeName]) { - knownValueNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; - var valueNames = knownValueNames[typeName]; - - for (var _i2 = 0; _i2 < valueNodes.length; _i2++) { - var valueDef = valueNodes[_i2]; - var valueName = valueDef.name.value; - var existingType = existingTypeMap[typeName]; - - if (isEnumType(existingType) && existingType.getValue(valueName)) { - context.reportError(new GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" already exists in the schema. It cannot also be defined in this type extension."), valueDef.name)); - } else if (valueNames[valueName]) { - context.reportError(new GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" can only be defined once."), [valueNames[valueName], valueDef.name])); - } else { - valueNames[valueName] = valueDef.name; - } - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.d.ts b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.d.ts deleted file mode 100644 index 26ebb066..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueFieldDefinitionNamesRule } from 'graphql' - * or - * import { UniqueFieldDefinitionNamesRule } from 'graphql/validation' - */ -export { UniqueFieldDefinitionNamesRule as UniqueFieldDefinitionNames } from './UniqueFieldDefinitionNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js deleted file mode 100644 index 7af0dca9..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueFieldDefinitionNames", { - enumerable: true, - get: function get() { - return _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule; - } -}); - -var _UniqueFieldDefinitionNamesRule = require("./UniqueFieldDefinitionNamesRule.js"); diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js.flow b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js.flow deleted file mode 100644 index dc548770..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueFieldDefinitionNamesRule } from 'graphql' - * or - * import { UniqueFieldDefinitionNamesRule } from 'graphql/validation' - */ -export { UniqueFieldDefinitionNamesRule as UniqueFieldDefinitionNames } from './UniqueFieldDefinitionNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.mjs b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.mjs deleted file mode 100644 index c2a3add0..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueFieldDefinitionNamesRule } from 'graphql' - * or - * import { UniqueFieldDefinitionNamesRule } from 'graphql/validation' - */ -export { UniqueFieldDefinitionNamesRule as UniqueFieldDefinitionNames } from "./UniqueFieldDefinitionNamesRule.mjs"; diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts deleted file mode 100644 index 6f356ed9..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -export function UniqueFieldDefinitionNamesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js deleted file mode 100644 index 3cdaa71e..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueFieldDefinitionNamesRule = UniqueFieldDefinitionNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -function UniqueFieldDefinitionNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownFieldNames = Object.create(null); - return { - InputObjectTypeDefinition: checkFieldUniqueness, - InputObjectTypeExtension: checkFieldUniqueness, - InterfaceTypeDefinition: checkFieldUniqueness, - InterfaceTypeExtension: checkFieldUniqueness, - ObjectTypeDefinition: checkFieldUniqueness, - ObjectTypeExtension: checkFieldUniqueness - }; - - function checkFieldUniqueness(node) { - var _node$fields; - - var typeName = node.name.value; - - if (!knownFieldNames[typeName]) { - knownFieldNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; - var fieldNames = knownFieldNames[typeName]; - - for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) { - var fieldDef = fieldNodes[_i2]; - var fieldName = fieldDef.name.value; - - if (hasField(existingTypeMap[typeName], fieldName)) { - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" already exists in the schema. It cannot also be defined in this type extension."), fieldDef.name)); - } else if (fieldNames[fieldName]) { - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" can only be defined once."), [fieldNames[fieldName], fieldDef.name])); - } else { - fieldNames[fieldName] = fieldDef.name; - } - } - - return false; - } -} - -function hasField(type, fieldName) { - if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type) || (0, _definition.isInputObjectType)(type)) { - return type.getFields()[fieldName] != null; - } - - return false; -} diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js.flow deleted file mode 100644 index 11931114..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +++ /dev/null @@ -1,87 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - NameNode, - FieldDefinitionNode, - InputValueDefinitionNode, -} from '../../language/ast'; - -import type { GraphQLNamedType } from '../../type/definition'; -import { - isObjectType, - isInterfaceType, - isInputObjectType, -} from '../../type/definition'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -export function UniqueFieldDefinitionNamesRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - const knownFieldNames = Object.create(null); - - return { - InputObjectTypeDefinition: checkFieldUniqueness, - InputObjectTypeExtension: checkFieldUniqueness, - InterfaceTypeDefinition: checkFieldUniqueness, - InterfaceTypeExtension: checkFieldUniqueness, - ObjectTypeDefinition: checkFieldUniqueness, - ObjectTypeExtension: checkFieldUniqueness, - }; - - function checkFieldUniqueness(node: { - +name: NameNode, - +fields?: $ReadOnlyArray, - ... - }) { - const typeName = node.name.value; - - if (!knownFieldNames[typeName]) { - knownFieldNames[typeName] = Object.create(null); - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const fieldNodes = node.fields ?? []; - const fieldNames = knownFieldNames[typeName]; - - for (const fieldDef of fieldNodes) { - const fieldName = fieldDef.name.value; - - if (hasField(existingTypeMap[typeName], fieldName)) { - context.reportError( - new GraphQLError( - `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, - fieldDef.name, - ), - ); - } else if (fieldNames[fieldName]) { - context.reportError( - new GraphQLError( - `Field "${typeName}.${fieldName}" can only be defined once.`, - [fieldNames[fieldName], fieldDef.name], - ), - ); - } else { - fieldNames[fieldName] = fieldDef.name; - } - } - - return false; - } -} - -function hasField(type: GraphQLNamedType, fieldName: string): boolean { - if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { - return type.getFields()[fieldName] != null; - } - return false; -} diff --git a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs deleted file mode 100644 index 176bb686..00000000 --- a/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs +++ /dev/null @@ -1,58 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isObjectType, isInterfaceType, isInputObjectType } from "../../type/definition.mjs"; - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -export function UniqueFieldDefinitionNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownFieldNames = Object.create(null); - return { - InputObjectTypeDefinition: checkFieldUniqueness, - InputObjectTypeExtension: checkFieldUniqueness, - InterfaceTypeDefinition: checkFieldUniqueness, - InterfaceTypeExtension: checkFieldUniqueness, - ObjectTypeDefinition: checkFieldUniqueness, - ObjectTypeExtension: checkFieldUniqueness - }; - - function checkFieldUniqueness(node) { - var _node$fields; - - var typeName = node.name.value; - - if (!knownFieldNames[typeName]) { - knownFieldNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; - var fieldNames = knownFieldNames[typeName]; - - for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) { - var fieldDef = fieldNodes[_i2]; - var fieldName = fieldDef.name.value; - - if (hasField(existingTypeMap[typeName], fieldName)) { - context.reportError(new GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" already exists in the schema. It cannot also be defined in this type extension."), fieldDef.name)); - } else if (fieldNames[fieldName]) { - context.reportError(new GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" can only be defined once."), [fieldNames[fieldName], fieldDef.name])); - } else { - fieldNames[fieldName] = fieldDef.name; - } - } - - return false; - } -} - -function hasField(type, fieldName) { - if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { - return type.getFields()[fieldName] != null; - } - - return false; -} diff --git a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts deleted file mode 100644 index 61541589..00000000 --- a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -export function UniqueFragmentNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js b/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js deleted file mode 100644 index d03a74e9..00000000 --- a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueFragmentNamesRule = UniqueFragmentNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -function UniqueFragmentNamesRule(context) { - var knownFragmentNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - var fragmentName = node.name.value; - - if (knownFragmentNames[fragmentName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one fragment named \"".concat(fragmentName, "\"."), [knownFragmentNames[fragmentName], node.name])); - } else { - knownFragmentNames[fragmentName] = node.name; - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js.flow deleted file mode 100644 index cb1b7775..00000000 --- a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js.flow +++ /dev/null @@ -1,34 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -export function UniqueFragmentNamesRule( - context: ASTValidationContext, -): ASTVisitor { - const knownFragmentNames = Object.create(null); - return { - OperationDefinition: () => false, - FragmentDefinition(node) { - const fragmentName = node.name.value; - if (knownFragmentNames[fragmentName]) { - context.reportError( - new GraphQLError( - `There can be only one fragment named "${fragmentName}".`, - [knownFragmentNames[fragmentName], node.name], - ), - ); - } else { - knownFragmentNames[fragmentName] = node.name; - } - return false; - }, - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs deleted file mode 100644 index d9b0ef34..00000000 --- a/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -export function UniqueFragmentNamesRule(context) { - var knownFragmentNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - var fragmentName = node.name.value; - - if (knownFragmentNames[fragmentName]) { - context.reportError(new GraphQLError("There can be only one fragment named \"".concat(fragmentName, "\"."), [knownFragmentNames[fragmentName], node.name])); - } else { - knownFragmentNames[fragmentName] = node.name; - } - - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts deleted file mode 100644 index c66d65f5..00000000 --- a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -export function UniqueInputFieldNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js b/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js deleted file mode 100644 index 4a7dfdae..00000000 --- a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueInputFieldNamesRule = UniqueInputFieldNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -function UniqueInputFieldNamesRule(context) { - var knownNameStack = []; - var knownNames = Object.create(null); - return { - ObjectValue: { - enter: function enter() { - knownNameStack.push(knownNames); - knownNames = Object.create(null); - }, - leave: function leave() { - knownNames = knownNameStack.pop(); - } - }, - ObjectField: function ObjectField(node) { - var fieldName = node.name.value; - - if (knownNames[fieldName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one input field named \"".concat(fieldName, "\"."), [knownNames[fieldName], node.name])); - } else { - knownNames[fieldName] = node.name; - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js.flow deleted file mode 100644 index e79cd7a3..00000000 --- a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js.flow +++ /dev/null @@ -1,44 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -export function UniqueInputFieldNamesRule( - context: ASTValidationContext, -): ASTVisitor { - const knownNameStack = []; - let knownNames = Object.create(null); - - return { - ObjectValue: { - enter() { - knownNameStack.push(knownNames); - knownNames = Object.create(null); - }, - leave() { - knownNames = knownNameStack.pop(); - }, - }, - ObjectField(node) { - const fieldName = node.name.value; - if (knownNames[fieldName]) { - context.reportError( - new GraphQLError( - `There can be only one input field named "${fieldName}".`, - [knownNames[fieldName], node.name], - ), - ); - } else { - knownNames[fieldName] = node.name; - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs deleted file mode 100644 index ae0c8849..00000000 --- a/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -export function UniqueInputFieldNamesRule(context) { - var knownNameStack = []; - var knownNames = Object.create(null); - return { - ObjectValue: { - enter: function enter() { - knownNameStack.push(knownNames); - knownNames = Object.create(null); - }, - leave: function leave() { - knownNames = knownNameStack.pop(); - } - }, - ObjectField: function ObjectField(node) { - var fieldName = node.name.value; - - if (knownNames[fieldName]) { - context.reportError(new GraphQLError("There can be only one input field named \"".concat(fieldName, "\"."), [knownNames[fieldName], node.name])); - } else { - knownNames[fieldName] = node.name; - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts deleted file mode 100644 index aa2d06ad..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -export function UniqueOperationNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js b/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js deleted file mode 100644 index 5c314647..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueOperationNamesRule = UniqueOperationNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -function UniqueOperationNamesRule(context) { - var knownOperationNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition(node) { - var operationName = node.name; - - if (operationName) { - if (knownOperationNames[operationName.value]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one operation named \"".concat(operationName.value, "\"."), [knownOperationNames[operationName.value], operationName])); - } else { - knownOperationNames[operationName.value] = operationName; - } - } - - return false; - }, - FragmentDefinition: function FragmentDefinition() { - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js.flow deleted file mode 100644 index 5e6afef0..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js.flow +++ /dev/null @@ -1,36 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -export function UniqueOperationNamesRule( - context: ASTValidationContext, -): ASTVisitor { - const knownOperationNames = Object.create(null); - return { - OperationDefinition(node) { - const operationName = node.name; - if (operationName) { - if (knownOperationNames[operationName.value]) { - context.reportError( - new GraphQLError( - `There can be only one operation named "${operationName.value}".`, - [knownOperationNames[operationName.value], operationName], - ), - ); - } else { - knownOperationNames[operationName.value] = operationName; - } - } - return false; - }, - FragmentDefinition: () => false, - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs deleted file mode 100644 index 28190c56..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -export function UniqueOperationNamesRule(context) { - var knownOperationNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition(node) { - var operationName = node.name; - - if (operationName) { - if (knownOperationNames[operationName.value]) { - context.reportError(new GraphQLError("There can be only one operation named \"".concat(operationName.value, "\"."), [knownOperationNames[operationName.value], operationName])); - } else { - knownOperationNames[operationName.value] = operationName; - } - } - - return false; - }, - FragmentDefinition: function FragmentDefinition() { - return false; - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypes.d.ts b/node_modules/graphql/validation/rules/UniqueOperationTypes.d.ts deleted file mode 100644 index 423932db..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypes.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueOperationTypesRule } from 'graphql' - * or - * import { UniqueOperationTypesRule } from 'graphql/validation' - */ -export { UniqueOperationTypesRule as UniqueOperationTypes } from './UniqueOperationTypesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypes.js b/node_modules/graphql/validation/rules/UniqueOperationTypes.js deleted file mode 100644 index 814f2e20..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypes.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueOperationTypes", { - enumerable: true, - get: function get() { - return _UniqueOperationTypesRule.UniqueOperationTypesRule; - } -}); - -var _UniqueOperationTypesRule = require("./UniqueOperationTypesRule.js"); diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypes.js.flow b/node_modules/graphql/validation/rules/UniqueOperationTypes.js.flow deleted file mode 100644 index 86498524..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypes.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueOperationTypesRule } from 'graphql' - * or - * import { UniqueOperationTypesRule } from 'graphql/validation' - */ -export { UniqueOperationTypesRule as UniqueOperationTypes } from './UniqueOperationTypesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypes.mjs b/node_modules/graphql/validation/rules/UniqueOperationTypes.mjs deleted file mode 100644 index 4cd53b3d..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypes.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueOperationTypesRule } from 'graphql' - * or - * import { UniqueOperationTypesRule } from 'graphql/validation' - */ -export { UniqueOperationTypesRule as UniqueOperationTypes } from "./UniqueOperationTypesRule.mjs"; diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts b/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts deleted file mode 100644 index a0d6441d..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -export function UniqueOperationTypesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js b/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js deleted file mode 100644 index fa59189f..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueOperationTypesRule = UniqueOperationTypesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -function UniqueOperationTypesRule(context) { - var schema = context.getSchema(); - var definedOperationTypes = Object.create(null); - var existingOperationTypes = schema ? { - query: schema.getQueryType(), - mutation: schema.getMutationType(), - subscription: schema.getSubscriptionType() - } : {}; - return { - SchemaDefinition: checkOperationTypes, - SchemaExtension: checkOperationTypes - }; - - function checkOperationTypes(node) { - var _node$operationTypes; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; - - for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) { - var operationType = operationTypesNodes[_i2]; - var operation = operationType.operation; - var alreadyDefinedOperationType = definedOperationTypes[operation]; - - if (existingOperationTypes[operation]) { - context.reportError(new _GraphQLError.GraphQLError("Type for ".concat(operation, " already defined in the schema. It cannot be redefined."), operationType)); - } else if (alreadyDefinedOperationType) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one ".concat(operation, " type in schema."), [alreadyDefinedOperationType, operationType])); - } else { - definedOperationTypes[operation] = operationType; - } - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js.flow b/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js.flow deleted file mode 100644 index 8a9d4bd1..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js.flow +++ /dev/null @@ -1,66 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - SchemaDefinitionNode, - SchemaExtensionNode, -} from '../../language/ast'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -export function UniqueOperationTypesRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const definedOperationTypes = Object.create(null); - const existingOperationTypes = schema - ? { - query: schema.getQueryType(), - mutation: schema.getMutationType(), - subscription: schema.getSubscriptionType(), - } - : {}; - - return { - SchemaDefinition: checkOperationTypes, - SchemaExtension: checkOperationTypes, - }; - - function checkOperationTypes( - node: SchemaDefinitionNode | SchemaExtensionNode, - ) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const operationTypesNodes = node.operationTypes ?? []; - - for (const operationType of operationTypesNodes) { - const operation = operationType.operation; - const alreadyDefinedOperationType = definedOperationTypes[operation]; - - if (existingOperationTypes[operation]) { - context.reportError( - new GraphQLError( - `Type for ${operation} already defined in the schema. It cannot be redefined.`, - operationType, - ), - ); - } else if (alreadyDefinedOperationType) { - context.reportError( - new GraphQLError( - `There can be only one ${operation} type in schema.`, - [alreadyDefinedOperationType, operationType], - ), - ); - } else { - definedOperationTypes[operation] = operationType; - } - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs b/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs deleted file mode 100644 index e79b6842..00000000 --- a/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -export function UniqueOperationTypesRule(context) { - var schema = context.getSchema(); - var definedOperationTypes = Object.create(null); - var existingOperationTypes = schema ? { - query: schema.getQueryType(), - mutation: schema.getMutationType(), - subscription: schema.getSubscriptionType() - } : {}; - return { - SchemaDefinition: checkOperationTypes, - SchemaExtension: checkOperationTypes - }; - - function checkOperationTypes(node) { - var _node$operationTypes; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; - - for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) { - var operationType = operationTypesNodes[_i2]; - var operation = operationType.operation; - var alreadyDefinedOperationType = definedOperationTypes[operation]; - - if (existingOperationTypes[operation]) { - context.reportError(new GraphQLError("Type for ".concat(operation, " already defined in the schema. It cannot be redefined."), operationType)); - } else if (alreadyDefinedOperationType) { - context.reportError(new GraphQLError("There can be only one ".concat(operation, " type in schema."), [alreadyDefinedOperationType, operationType])); - } else { - definedOperationTypes[operation] = operationType; - } - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueTypeNames.d.ts b/node_modules/graphql/validation/rules/UniqueTypeNames.d.ts deleted file mode 100644 index 1740eef8..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueTypeNamesRule } from 'graphql' - * or - * import { UniqueTypeNamesRule } from 'graphql/validation' - */ -export { UniqueTypeNamesRule as UniqueTypeNames } from './UniqueTypeNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueTypeNames.js b/node_modules/graphql/validation/rules/UniqueTypeNames.js deleted file mode 100644 index 82e72cef..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueTypeNames", { - enumerable: true, - get: function get() { - return _UniqueTypeNamesRule.UniqueTypeNamesRule; - } -}); - -var _UniqueTypeNamesRule = require("./UniqueTypeNamesRule.js"); diff --git a/node_modules/graphql/validation/rules/UniqueTypeNames.js.flow b/node_modules/graphql/validation/rules/UniqueTypeNames.js.flow deleted file mode 100644 index 2b43e1c1..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueTypeNamesRule } from 'graphql' - * or - * import { UniqueTypeNamesRule } from 'graphql/validation' - */ -export { UniqueTypeNamesRule as UniqueTypeNames } from './UniqueTypeNamesRule'; diff --git a/node_modules/graphql/validation/rules/UniqueTypeNames.mjs b/node_modules/graphql/validation/rules/UniqueTypeNames.mjs deleted file mode 100644 index ea0c5bff..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueTypeNamesRule } from 'graphql' - * or - * import { UniqueTypeNamesRule } from 'graphql/validation' - */ -export { UniqueTypeNamesRule as UniqueTypeNames } from "./UniqueTypeNamesRule.mjs"; diff --git a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts deleted file mode 100644 index e2b37594..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -export function UniqueTypeNamesRule(context: SDLValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js b/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js deleted file mode 100644 index 37257db9..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueTypeNamesRule = UniqueTypeNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -function UniqueTypeNamesRule(context) { - var knownTypeNames = Object.create(null); - var schema = context.getSchema(); - return { - ScalarTypeDefinition: checkTypeName, - ObjectTypeDefinition: checkTypeName, - InterfaceTypeDefinition: checkTypeName, - UnionTypeDefinition: checkTypeName, - EnumTypeDefinition: checkTypeName, - InputObjectTypeDefinition: checkTypeName - }; - - function checkTypeName(node) { - var typeName = node.name.value; - - if (schema === null || schema === void 0 ? void 0 : schema.getType(typeName)) { - context.reportError(new _GraphQLError.GraphQLError("Type \"".concat(typeName, "\" already exists in the schema. It cannot also be defined in this type definition."), node.name)); - return; - } - - if (knownTypeNames[typeName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one type named \"".concat(typeName, "\"."), [knownTypeNames[typeName], node.name])); - } else { - knownTypeNames[typeName] = node.name; - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js.flow deleted file mode 100644 index 3dd0e7c8..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js.flow +++ /dev/null @@ -1,53 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { TypeDefinitionNode } from '../../language/ast'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -export function UniqueTypeNamesRule(context: SDLValidationContext): ASTVisitor { - const knownTypeNames = Object.create(null); - const schema = context.getSchema(); - - return { - ScalarTypeDefinition: checkTypeName, - ObjectTypeDefinition: checkTypeName, - InterfaceTypeDefinition: checkTypeName, - UnionTypeDefinition: checkTypeName, - EnumTypeDefinition: checkTypeName, - InputObjectTypeDefinition: checkTypeName, - }; - - function checkTypeName(node: TypeDefinitionNode) { - const typeName = node.name.value; - - if (schema?.getType(typeName)) { - context.reportError( - new GraphQLError( - `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, - node.name, - ), - ); - return; - } - - if (knownTypeNames[typeName]) { - context.reportError( - new GraphQLError(`There can be only one type named "${typeName}".`, [ - knownTypeNames[typeName], - node.name, - ]), - ); - } else { - knownTypeNames[typeName] = node.name; - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs deleted file mode 100644 index 8e854ce8..00000000 --- a/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -export function UniqueTypeNamesRule(context) { - var knownTypeNames = Object.create(null); - var schema = context.getSchema(); - return { - ScalarTypeDefinition: checkTypeName, - ObjectTypeDefinition: checkTypeName, - InterfaceTypeDefinition: checkTypeName, - UnionTypeDefinition: checkTypeName, - EnumTypeDefinition: checkTypeName, - InputObjectTypeDefinition: checkTypeName - }; - - function checkTypeName(node) { - var typeName = node.name.value; - - if (schema === null || schema === void 0 ? void 0 : schema.getType(typeName)) { - context.reportError(new GraphQLError("Type \"".concat(typeName, "\" already exists in the schema. It cannot also be defined in this type definition."), node.name)); - return; - } - - if (knownTypeNames[typeName]) { - context.reportError(new GraphQLError("There can be only one type named \"".concat(typeName, "\"."), [knownTypeNames[typeName], node.name])); - } else { - knownTypeNames[typeName] = node.name; - } - - return false; - } -} diff --git a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts b/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts deleted file mode 100644 index 6f15764a..00000000 --- a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -export function UniqueVariableNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js b/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js deleted file mode 100644 index d6cae4ad..00000000 --- a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueVariableNamesRule = UniqueVariableNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -function UniqueVariableNamesRule(context) { - var knownVariableNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - knownVariableNames = Object.create(null); - }, - VariableDefinition: function VariableDefinition(node) { - var variableName = node.variable.name.value; - - if (knownVariableNames[variableName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one variable named \"$".concat(variableName, "\"."), [knownVariableNames[variableName], node.variable.name])); - } else { - knownVariableNames[variableName] = node.variable.name; - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js.flow b/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js.flow deleted file mode 100644 index 4865dc68..00000000 --- a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js.flow +++ /dev/null @@ -1,36 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { VariableDefinitionNode } from '../../language/ast'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -export function UniqueVariableNamesRule( - context: ASTValidationContext, -): ASTVisitor { - let knownVariableNames = Object.create(null); - return { - OperationDefinition() { - knownVariableNames = Object.create(null); - }, - VariableDefinition(node: VariableDefinitionNode) { - const variableName = node.variable.name.value; - if (knownVariableNames[variableName]) { - context.reportError( - new GraphQLError( - `There can be only one variable named "$${variableName}".`, - [knownVariableNames[variableName], node.variable.name], - ), - ); - } else { - knownVariableNames[variableName] = node.variable.name; - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs b/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs deleted file mode 100644 index 3b650a42..00000000 --- a/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -export function UniqueVariableNamesRule(context) { - var knownVariableNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - knownVariableNames = Object.create(null); - }, - VariableDefinition: function VariableDefinition(node) { - var variableName = node.variable.name.value; - - if (knownVariableNames[variableName]) { - context.reportError(new GraphQLError("There can be only one variable named \"$".concat(variableName, "\"."), [knownVariableNames[variableName], node.variable.name])); - } else { - knownVariableNames[variableName] = node.variable.name; - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts b/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts deleted file mode 100644 index 98ff7a74..00000000 --- a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -export function ValuesOfCorrectTypeRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js b/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js deleted file mode 100644 index d898200f..00000000 --- a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ValuesOfCorrectTypeRule = ValuesOfCorrectTypeRule; - -var _objectValues3 = _interopRequireDefault(require("../../polyfills/objectValues.js")); - -var _keyMap = _interopRequireDefault(require("../../jsutils/keyMap.js")); - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -function ValuesOfCorrectTypeRule(context) { - return { - ListValue: function ListValue(node) { - // Note: TypeInfo will traverse into a list's item type, so look to the - // parent input type to check if it is a list. - var type = (0, _definition.getNullableType)(context.getParentInputType()); - - if (!(0, _definition.isListType)(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - }, - ObjectValue: function ObjectValue(node) { - var type = (0, _definition.getNamedType)(context.getInputType()); - - if (!(0, _definition.isInputObjectType)(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } // Ensure every required field exists. - - - var fieldNodeMap = (0, _keyMap.default)(node.fields, function (field) { - return field.name.value; - }); - - for (var _i2 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i2 < _objectValues2.length; _i2++) { - var fieldDef = _objectValues2[_i2]; - var fieldNode = fieldNodeMap[fieldDef.name]; - - if (!fieldNode && (0, _definition.isRequiredInputField)(fieldDef)) { - var typeStr = (0, _inspect.default)(fieldDef.type); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(type.name, ".").concat(fieldDef.name, "\" of required type \"").concat(typeStr, "\" was not provided."), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var parentType = (0, _definition.getNamedType)(context.getParentInputType()); - var fieldType = context.getInputType(); - - if (!fieldType && (0, _definition.isInputObjectType)(parentType)) { - var suggestions = (0, _suggestionList.default)(node.name.value, Object.keys(parentType.getFields())); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(node.name.value, "\" is not defined by type \"").concat(parentType.name, "\".") + (0, _didYouMean.default)(suggestions), node)); - } - }, - NullValue: function NullValue(node) { - var type = context.getInputType(); - - if ((0, _definition.isNonNullType)(type)) { - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat((0, _inspect.default)(type), "\", found ").concat((0, _printer.print)(node), "."), node)); - } - }, - EnumValue: function EnumValue(node) { - return isValidValueNode(context, node); - }, - IntValue: function IntValue(node) { - return isValidValueNode(context, node); - }, - FloatValue: function FloatValue(node) { - return isValidValueNode(context, node); - }, - StringValue: function StringValue(node) { - return isValidValueNode(context, node); - }, - BooleanValue: function BooleanValue(node) { - return isValidValueNode(context, node); - } - }; -} -/** - * Any value literal may be a valid representation of a Scalar, depending on - * that scalar type. - */ - - -function isValidValueNode(context, node) { - // Report any error at the full type expected by the location. - var locationType = context.getInputType(); - - if (!locationType) { - return; - } - - var type = (0, _definition.getNamedType)(locationType); - - if (!(0, _definition.isLeafType)(type)) { - var typeStr = (0, _inspect.default)(locationType); - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(typeStr, "\", found ").concat((0, _printer.print)(node), "."), node)); - return; - } // Scalars and Enums determine if a literal value is valid via parseLiteral(), - // which may throw or return an invalid value to indicate failure. - - - try { - var parseResult = type.parseLiteral(node, undefined - /* variables */ - ); - - if (parseResult === undefined) { - var _typeStr = (0, _inspect.default)(locationType); - - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(_typeStr, "\", found ").concat((0, _printer.print)(node), "."), node)); - } - } catch (error) { - var _typeStr2 = (0, _inspect.default)(locationType); - - if (error instanceof _GraphQLError.GraphQLError) { - context.reportError(error); - } else { - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(_typeStr2, "\", found ").concat((0, _printer.print)(node), "; ") + error.message, node, undefined, undefined, undefined, error)); - } - } -} diff --git a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js.flow b/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js.flow deleted file mode 100644 index 09a922cc..00000000 --- a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js.flow +++ /dev/null @@ -1,158 +0,0 @@ -// @flow strict -import objectValues from '../../polyfills/objectValues'; - -import keyMap from '../../jsutils/keyMap'; -import inspect from '../../jsutils/inspect'; -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ValueNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; -import { print } from '../../language/printer'; - -import { - isLeafType, - isInputObjectType, - isListType, - isNonNullType, - isRequiredInputField, - getNullableType, - getNamedType, -} from '../../type/definition'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -export function ValuesOfCorrectTypeRule( - context: ValidationContext, -): ASTVisitor { - return { - ListValue(node) { - // Note: TypeInfo will traverse into a list's item type, so look to the - // parent input type to check if it is a list. - const type = getNullableType(context.getParentInputType()); - if (!isListType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - }, - ObjectValue(node) { - const type = getNamedType(context.getInputType()); - if (!isInputObjectType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - // Ensure every required field exists. - const fieldNodeMap = keyMap(node.fields, (field) => field.name.value); - for (const fieldDef of objectValues(type.getFields())) { - const fieldNode = fieldNodeMap[fieldDef.name]; - if (!fieldNode && isRequiredInputField(fieldDef)) { - const typeStr = inspect(fieldDef.type); - context.reportError( - new GraphQLError( - `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, - node, - ), - ); - } - } - }, - ObjectField(node) { - const parentType = getNamedType(context.getParentInputType()); - const fieldType = context.getInputType(); - if (!fieldType && isInputObjectType(parentType)) { - const suggestions = suggestionList( - node.name.value, - Object.keys(parentType.getFields()), - ); - context.reportError( - new GraphQLError( - `Field "${node.name.value}" is not defined by type "${parentType.name}".` + - didYouMean(suggestions), - node, - ), - ); - } - }, - NullValue(node) { - const type = context.getInputType(); - if (isNonNullType(type)) { - context.reportError( - new GraphQLError( - `Expected value of type "${inspect(type)}", found ${print(node)}.`, - node, - ), - ); - } - }, - EnumValue: (node) => isValidValueNode(context, node), - IntValue: (node) => isValidValueNode(context, node), - FloatValue: (node) => isValidValueNode(context, node), - StringValue: (node) => isValidValueNode(context, node), - BooleanValue: (node) => isValidValueNode(context, node), - }; -} - -/** - * Any value literal may be a valid representation of a Scalar, depending on - * that scalar type. - */ -function isValidValueNode(context: ValidationContext, node: ValueNode): void { - // Report any error at the full type expected by the location. - const locationType = context.getInputType(); - if (!locationType) { - return; - } - - const type = getNamedType(locationType); - - if (!isLeafType(type)) { - const typeStr = inspect(locationType); - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}.`, - node, - ), - ); - return; - } - - // Scalars and Enums determine if a literal value is valid via parseLiteral(), - // which may throw or return an invalid value to indicate failure. - try { - const parseResult = type.parseLiteral(node, undefined /* variables */); - if (parseResult === undefined) { - const typeStr = inspect(locationType); - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}.`, - node, - ), - ); - } - } catch (error) { - const typeStr = inspect(locationType); - if (error instanceof GraphQLError) { - context.reportError(error); - } else { - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}; ` + - error.message, - node, - undefined, - undefined, - undefined, - error, // Ensure a reference to the original error is maintained. - ), - ); - } - } -} diff --git a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs b/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs deleted file mode 100644 index 01c89676..00000000 --- a/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +++ /dev/null @@ -1,126 +0,0 @@ -import objectValues from "../../polyfills/objectValues.mjs"; -import keyMap from "../../jsutils/keyMap.mjs"; -import inspect from "../../jsutils/inspect.mjs"; -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { print } from "../../language/printer.mjs"; -import { isLeafType, isInputObjectType, isListType, isNonNullType, isRequiredInputField, getNullableType, getNamedType } from "../../type/definition.mjs"; - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -export function ValuesOfCorrectTypeRule(context) { - return { - ListValue: function ListValue(node) { - // Note: TypeInfo will traverse into a list's item type, so look to the - // parent input type to check if it is a list. - var type = getNullableType(context.getParentInputType()); - - if (!isListType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - }, - ObjectValue: function ObjectValue(node) { - var type = getNamedType(context.getInputType()); - - if (!isInputObjectType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } // Ensure every required field exists. - - - var fieldNodeMap = keyMap(node.fields, function (field) { - return field.name.value; - }); - - for (var _i2 = 0, _objectValues2 = objectValues(type.getFields()); _i2 < _objectValues2.length; _i2++) { - var fieldDef = _objectValues2[_i2]; - var fieldNode = fieldNodeMap[fieldDef.name]; - - if (!fieldNode && isRequiredInputField(fieldDef)) { - var typeStr = inspect(fieldDef.type); - context.reportError(new GraphQLError("Field \"".concat(type.name, ".").concat(fieldDef.name, "\" of required type \"").concat(typeStr, "\" was not provided."), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var parentType = getNamedType(context.getParentInputType()); - var fieldType = context.getInputType(); - - if (!fieldType && isInputObjectType(parentType)) { - var suggestions = suggestionList(node.name.value, Object.keys(parentType.getFields())); - context.reportError(new GraphQLError("Field \"".concat(node.name.value, "\" is not defined by type \"").concat(parentType.name, "\".") + didYouMean(suggestions), node)); - } - }, - NullValue: function NullValue(node) { - var type = context.getInputType(); - - if (isNonNullType(type)) { - context.reportError(new GraphQLError("Expected value of type \"".concat(inspect(type), "\", found ").concat(print(node), "."), node)); - } - }, - EnumValue: function EnumValue(node) { - return isValidValueNode(context, node); - }, - IntValue: function IntValue(node) { - return isValidValueNode(context, node); - }, - FloatValue: function FloatValue(node) { - return isValidValueNode(context, node); - }, - StringValue: function StringValue(node) { - return isValidValueNode(context, node); - }, - BooleanValue: function BooleanValue(node) { - return isValidValueNode(context, node); - } - }; -} -/** - * Any value literal may be a valid representation of a Scalar, depending on - * that scalar type. - */ - -function isValidValueNode(context, node) { - // Report any error at the full type expected by the location. - var locationType = context.getInputType(); - - if (!locationType) { - return; - } - - var type = getNamedType(locationType); - - if (!isLeafType(type)) { - var typeStr = inspect(locationType); - context.reportError(new GraphQLError("Expected value of type \"".concat(typeStr, "\", found ").concat(print(node), "."), node)); - return; - } // Scalars and Enums determine if a literal value is valid via parseLiteral(), - // which may throw or return an invalid value to indicate failure. - - - try { - var parseResult = type.parseLiteral(node, undefined - /* variables */ - ); - - if (parseResult === undefined) { - var _typeStr = inspect(locationType); - - context.reportError(new GraphQLError("Expected value of type \"".concat(_typeStr, "\", found ").concat(print(node), "."), node)); - } - } catch (error) { - var _typeStr2 = inspect(locationType); - - if (error instanceof GraphQLError) { - context.reportError(error); - } else { - context.reportError(new GraphQLError("Expected value of type \"".concat(_typeStr2, "\", found ").concat(print(node), "; ") + error.message, node, undefined, undefined, undefined, error)); - } - } -} diff --git a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts b/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts deleted file mode 100644 index c82229c7..00000000 --- a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -export function VariablesAreInputTypesRule( - context: ValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js b/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js deleted file mode 100644 index 885d3094..00000000 --- a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.VariablesAreInputTypesRule = VariablesAreInputTypesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -function VariablesAreInputTypesRule(context) { - return { - VariableDefinition: function VariableDefinition(node) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), node.type); - - if (type && !(0, _definition.isInputType)(type)) { - var variableName = node.variable.name.value; - var typeName = (0, _printer.print)(node.type); - context.reportError(new _GraphQLError.GraphQLError("Variable \"$".concat(variableName, "\" cannot be non-input type \"").concat(typeName, "\"."), node.type)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js.flow b/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js.flow deleted file mode 100644 index 2de08196..00000000 --- a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js.flow +++ /dev/null @@ -1,40 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import { print } from '../../language/printer'; -import type { ASTVisitor } from '../../language/visitor'; -import type { VariableDefinitionNode } from '../../language/ast'; - -import { isInputType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -export function VariablesAreInputTypesRule( - context: ValidationContext, -): ASTVisitor { - return { - VariableDefinition(node: VariableDefinitionNode): ?GraphQLError { - const type = typeFromAST(context.getSchema(), node.type); - - if (type && !isInputType(type)) { - const variableName = node.variable.name.value; - const typeName = print(node.type); - - context.reportError( - new GraphQLError( - `Variable "$${variableName}" cannot be non-input type "${typeName}".`, - node.type, - ), - ); - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs b/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs deleted file mode 100644 index f6e5d110..00000000 --- a/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { print } from "../../language/printer.mjs"; -import { isInputType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -export function VariablesAreInputTypesRule(context) { - return { - VariableDefinition: function VariableDefinition(node) { - var type = typeFromAST(context.getSchema(), node.type); - - if (type && !isInputType(type)) { - var variableName = node.variable.name.value; - var typeName = print(node.type); - context.reportError(new GraphQLError("Variable \"$".concat(variableName, "\" cannot be non-input type \"").concat(typeName, "\"."), node.type)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts b/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts deleted file mode 100644 index 6ee57371..00000000 --- a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Variables passed to field arguments conform to type - */ -export function VariablesInAllowedPositionRule( - context: ValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js b/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js deleted file mode 100644 index ad0ce8ce..00000000 --- a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.VariablesInAllowedPositionRule = VariablesInAllowedPositionRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -var _typeComparators = require("../../utilities/typeComparators.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Variables passed to field arguments conform to type - */ -function VariablesInAllowedPositionRule(context) { - var varDefMap = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - varDefMap = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var type = _ref2.type; - var defaultValue = _ref2.defaultValue; - var varName = node.name.value; - var varDef = varDefMap[varName]; - - if (varDef && type) { - // A var type is allowed if it is the same or more strict (e.g. is - // a subtype of) than the expected type. It can be more strict if - // the variable type is non-null when the expected type is nullable. - // If both are list types, the variable item type can be more strict - // than the expected item type (contravariant). - var schema = context.getSchema(); - var varType = (0, _typeFromAST.typeFromAST)(schema, varDef.type); - - if (varType && !allowedVariableUsage(schema, varType, varDef.defaultValue, type, defaultValue)) { - var varTypeStr = (0, _inspect.default)(varType); - var typeStr = (0, _inspect.default)(type); - context.reportError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of type \"").concat(varTypeStr, "\" used in position expecting type \"").concat(typeStr, "\"."), [varDef, node])); - } - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - varDefMap[node.variable.name.value] = node; - } - }; -} -/** - * Returns true if the variable is allowed in the location it was found, - * which includes considering if default values exist for either the variable - * or the location at which it is located. - */ - - -function allowedVariableUsage(schema, varType, varDefaultValue, locationType, locationDefaultValue) { - if ((0, _definition.isNonNullType)(locationType) && !(0, _definition.isNonNullType)(varType)) { - var hasNonNullVariableDefaultValue = varDefaultValue != null && varDefaultValue.kind !== _kinds.Kind.NULL; - var hasLocationDefaultValue = locationDefaultValue !== undefined; - - if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { - return false; - } - - var nullableLocationType = locationType.ofType; - return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, nullableLocationType); - } - - return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, locationType); -} diff --git a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js.flow b/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js.flow deleted file mode 100644 index 722ee99e..00000000 --- a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js.flow +++ /dev/null @@ -1,98 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import { Kind } from '../../language/kinds'; -import type { ValueNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { GraphQLSchema } from '../../type/schema'; -import type { GraphQLType } from '../../type/definition'; -import { isNonNullType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; -import { isTypeSubTypeOf } from '../../utilities/typeComparators'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Variables passed to field arguments conform to type - */ -export function VariablesInAllowedPositionRule( - context: ValidationContext, -): ASTVisitor { - let varDefMap = Object.create(null); - - return { - OperationDefinition: { - enter() { - varDefMap = Object.create(null); - }, - leave(operation) { - const usages = context.getRecursiveVariableUsages(operation); - - for (const { node, type, defaultValue } of usages) { - const varName = node.name.value; - const varDef = varDefMap[varName]; - if (varDef && type) { - // A var type is allowed if it is the same or more strict (e.g. is - // a subtype of) than the expected type. It can be more strict if - // the variable type is non-null when the expected type is nullable. - // If both are list types, the variable item type can be more strict - // than the expected item type (contravariant). - const schema = context.getSchema(); - const varType = typeFromAST(schema, varDef.type); - if ( - varType && - !allowedVariableUsage( - schema, - varType, - varDef.defaultValue, - type, - defaultValue, - ) - ) { - const varTypeStr = inspect(varType); - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, - [varDef, node], - ), - ); - } - } - } - }, - }, - VariableDefinition(node) { - varDefMap[node.variable.name.value] = node; - }, - }; -} - -/** - * Returns true if the variable is allowed in the location it was found, - * which includes considering if default values exist for either the variable - * or the location at which it is located. - */ -function allowedVariableUsage( - schema: GraphQLSchema, - varType: GraphQLType, - varDefaultValue: ?ValueNode, - locationType: GraphQLType, - locationDefaultValue: ?mixed, -): boolean { - if (isNonNullType(locationType) && !isNonNullType(varType)) { - const hasNonNullVariableDefaultValue = - varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; - const hasLocationDefaultValue = locationDefaultValue !== undefined; - if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { - return false; - } - const nullableLocationType = locationType.ofType; - return isTypeSubTypeOf(schema, varType, nullableLocationType); - } - return isTypeSubTypeOf(schema, varType, locationType); -} diff --git a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs b/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs deleted file mode 100644 index bdddb2f2..00000000 --- a/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs +++ /dev/null @@ -1,72 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isNonNullType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; -import { isTypeSubTypeOf } from "../../utilities/typeComparators.mjs"; - -/** - * Variables passed to field arguments conform to type - */ -export function VariablesInAllowedPositionRule(context) { - var varDefMap = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - varDefMap = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var type = _ref2.type; - var defaultValue = _ref2.defaultValue; - var varName = node.name.value; - var varDef = varDefMap[varName]; - - if (varDef && type) { - // A var type is allowed if it is the same or more strict (e.g. is - // a subtype of) than the expected type. It can be more strict if - // the variable type is non-null when the expected type is nullable. - // If both are list types, the variable item type can be more strict - // than the expected item type (contravariant). - var schema = context.getSchema(); - var varType = typeFromAST(schema, varDef.type); - - if (varType && !allowedVariableUsage(schema, varType, varDef.defaultValue, type, defaultValue)) { - var varTypeStr = inspect(varType); - var typeStr = inspect(type); - context.reportError(new GraphQLError("Variable \"$".concat(varName, "\" of type \"").concat(varTypeStr, "\" used in position expecting type \"").concat(typeStr, "\"."), [varDef, node])); - } - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - varDefMap[node.variable.name.value] = node; - } - }; -} -/** - * Returns true if the variable is allowed in the location it was found, - * which includes considering if default values exist for either the variable - * or the location at which it is located. - */ - -function allowedVariableUsage(schema, varType, varDefaultValue, locationType, locationDefaultValue) { - if (isNonNullType(locationType) && !isNonNullType(varType)) { - var hasNonNullVariableDefaultValue = varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; - var hasLocationDefaultValue = locationDefaultValue !== undefined; - - if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { - return false; - } - - var nullableLocationType = locationType.ofType; - return isTypeSubTypeOf(schema, varType, nullableLocationType); - } - - return isTypeSubTypeOf(schema, varType, locationType); -} diff --git a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts b/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts deleted file mode 100644 index d376cf85..00000000 --- a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ASTVisitor } from '../../../language/visitor'; -import { ValidationContext } from '../../ValidationContext'; - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js b/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js deleted file mode 100644 index 63ad4dce..00000000 --- a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoDeprecatedCustomRule = NoDeprecatedCustomRule; - -var _invariant = _interopRequireDefault(require("../../../jsutils/invariant.js")); - -var _GraphQLError = require("../../../error/GraphQLError.js"); - -var _definition = require("../../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -function NoDeprecatedCustomRule(context) { - return { - Field: function Field(node) { - var fieldDef = context.getFieldDef(); - var deprecationReason = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.deprecationReason; - - if (fieldDef && deprecationReason != null) { - var parentType = context.getParentType(); - parentType != null || (0, _invariant.default)(0); - context.reportError(new _GraphQLError.GraphQLError("The field ".concat(parentType.name, ".").concat(fieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - }, - Argument: function Argument(node) { - var argDef = context.getArgument(); - var deprecationReason = argDef === null || argDef === void 0 ? void 0 : argDef.deprecationReason; - - if (argDef && deprecationReason != null) { - var directiveDef = context.getDirective(); - - if (directiveDef != null) { - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } else { - var parentType = context.getParentType(); - var fieldDef = context.getFieldDef(); - parentType != null && fieldDef != null || (0, _invariant.default)(0); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(parentType.name, ".").concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var inputObjectDef = (0, _definition.getNamedType)(context.getParentInputType()); - - if ((0, _definition.isInputObjectType)(inputObjectDef)) { - var inputFieldDef = inputObjectDef.getFields()[node.name.value]; // flowlint-next-line unnecessary-optional-chain:off - - var deprecationReason = inputFieldDef === null || inputFieldDef === void 0 ? void 0 : inputFieldDef.deprecationReason; - - if (deprecationReason != null) { - context.reportError(new _GraphQLError.GraphQLError("The input field ".concat(inputObjectDef.name, ".").concat(inputFieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - } - }, - EnumValue: function EnumValue(node) { - var enumValueDef = context.getEnumValue(); - var deprecationReason = enumValueDef === null || enumValueDef === void 0 ? void 0 : enumValueDef.deprecationReason; - - if (enumValueDef && deprecationReason != null) { - var enumTypeDef = (0, _definition.getNamedType)(context.getInputType()); - enumTypeDef != null || (0, _invariant.default)(0); - context.reportError(new _GraphQLError.GraphQLError("The enum value \"".concat(enumTypeDef.name, ".").concat(enumValueDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js.flow b/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js.flow deleted file mode 100644 index 6b61065c..00000000 --- a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js.flow +++ /dev/null @@ -1,94 +0,0 @@ -// @flow strict -import invariant from '../../../jsutils/invariant'; - -import { GraphQLError } from '../../../error/GraphQLError'; - -import type { ASTVisitor } from '../../../language/visitor'; - -import { getNamedType, isInputObjectType } from '../../../type/definition'; - -import type { ValidationContext } from '../../ValidationContext'; - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { - return { - Field(node) { - const fieldDef = context.getFieldDef(); - const deprecationReason = fieldDef?.deprecationReason; - if (fieldDef && deprecationReason != null) { - const parentType = context.getParentType(); - invariant(parentType != null); - context.reportError( - new GraphQLError( - `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, - node, - ), - ); - } - }, - Argument(node) { - const argDef = context.getArgument(); - const deprecationReason = argDef?.deprecationReason; - if (argDef && deprecationReason != null) { - const directiveDef = context.getDirective(); - if (directiveDef != null) { - context.reportError( - new GraphQLError( - `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - node, - ), - ); - } else { - const parentType = context.getParentType(); - const fieldDef = context.getFieldDef(); - invariant(parentType != null && fieldDef != null); - context.reportError( - new GraphQLError( - `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - node, - ), - ); - } - } - }, - ObjectField(node) { - const inputObjectDef = getNamedType(context.getParentInputType()); - if (isInputObjectType(inputObjectDef)) { - const inputFieldDef = inputObjectDef.getFields()[node.name.value]; - // flowlint-next-line unnecessary-optional-chain:off - const deprecationReason = inputFieldDef?.deprecationReason; - if (deprecationReason != null) { - context.reportError( - new GraphQLError( - `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, - node, - ), - ); - } - } - }, - EnumValue(node) { - const enumValueDef = context.getEnumValue(); - const deprecationReason = enumValueDef?.deprecationReason; - if (enumValueDef && deprecationReason != null) { - const enumTypeDef = getNamedType(context.getInputType()); - invariant(enumTypeDef != null); - context.reportError( - new GraphQLError( - `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, - node, - ), - ); - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs b/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs deleted file mode 100644 index f0e0b36b..00000000 --- a/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs +++ /dev/null @@ -1,68 +0,0 @@ -import invariant from "../../../jsutils/invariant.mjs"; -import { GraphQLError } from "../../../error/GraphQLError.mjs"; -import { getNamedType, isInputObjectType } from "../../../type/definition.mjs"; - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -export function NoDeprecatedCustomRule(context) { - return { - Field: function Field(node) { - var fieldDef = context.getFieldDef(); - var deprecationReason = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.deprecationReason; - - if (fieldDef && deprecationReason != null) { - var parentType = context.getParentType(); - parentType != null || invariant(0); - context.reportError(new GraphQLError("The field ".concat(parentType.name, ".").concat(fieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - }, - Argument: function Argument(node) { - var argDef = context.getArgument(); - var deprecationReason = argDef === null || argDef === void 0 ? void 0 : argDef.deprecationReason; - - if (argDef && deprecationReason != null) { - var directiveDef = context.getDirective(); - - if (directiveDef != null) { - context.reportError(new GraphQLError("Directive \"@".concat(directiveDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } else { - var parentType = context.getParentType(); - var fieldDef = context.getFieldDef(); - parentType != null && fieldDef != null || invariant(0); - context.reportError(new GraphQLError("Field \"".concat(parentType.name, ".").concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var inputObjectDef = getNamedType(context.getParentInputType()); - - if (isInputObjectType(inputObjectDef)) { - var inputFieldDef = inputObjectDef.getFields()[node.name.value]; // flowlint-next-line unnecessary-optional-chain:off - - var deprecationReason = inputFieldDef === null || inputFieldDef === void 0 ? void 0 : inputFieldDef.deprecationReason; - - if (deprecationReason != null) { - context.reportError(new GraphQLError("The input field ".concat(inputObjectDef.name, ".").concat(inputFieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - } - }, - EnumValue: function EnumValue(node) { - var enumValueDef = context.getEnumValue(); - var deprecationReason = enumValueDef === null || enumValueDef === void 0 ? void 0 : enumValueDef.deprecationReason; - - if (enumValueDef && deprecationReason != null) { - var enumTypeDef = getNamedType(context.getInputType()); - enumTypeDef != null || invariant(0); - context.reportError(new GraphQLError("The enum value \"".concat(enumTypeDef.name, ".").concat(enumValueDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts b/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts deleted file mode 100644 index 3677fa1c..00000000 --- a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ASTVisitor } from '../../../language/visitor'; -import { ValidationContext } from '../../ValidationContext'; - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -export function NoSchemaIntrospectionCustomRule( - context: ValidationContext, -): ASTVisitor; diff --git a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js b/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js deleted file mode 100644 index 6861bd41..00000000 --- a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoSchemaIntrospectionCustomRule = NoSchemaIntrospectionCustomRule; - -var _GraphQLError = require("../../../error/GraphQLError.js"); - -var _definition = require("../../../type/definition.js"); - -var _introspection = require("../../../type/introspection.js"); - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -function NoSchemaIntrospectionCustomRule(context) { - return { - Field: function Field(node) { - var type = (0, _definition.getNamedType)(context.getType()); - - if (type && (0, _introspection.isIntrospectionType)(type)) { - context.reportError(new _GraphQLError.GraphQLError("GraphQL introspection has been disabled, but the requested query contained the field \"".concat(node.name.value, "\"."), node)); - } - } - }; -} diff --git a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow b/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow deleted file mode 100644 index 333ba412..00000000 --- a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow +++ /dev/null @@ -1,38 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../../error/GraphQLError'; - -import type { FieldNode } from '../../../language/ast'; -import type { ASTVisitor } from '../../../language/visitor'; - -import { getNamedType } from '../../../type/definition'; -import { isIntrospectionType } from '../../../type/introspection'; - -import type { ValidationContext } from '../../ValidationContext'; - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -export function NoSchemaIntrospectionCustomRule( - context: ValidationContext, -): ASTVisitor { - return { - Field(node: FieldNode) { - const type = getNamedType(context.getType()); - if (type && isIntrospectionType(type)) { - context.reportError( - new GraphQLError( - `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, - node, - ), - ); - } - }, - }; -} diff --git a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs b/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs deleted file mode 100644 index 26f7d747..00000000 --- a/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import { GraphQLError } from "../../../error/GraphQLError.mjs"; -import { getNamedType } from "../../../type/definition.mjs"; -import { isIntrospectionType } from "../../../type/introspection.mjs"; - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -export function NoSchemaIntrospectionCustomRule(context) { - return { - Field: function Field(node) { - var type = getNamedType(context.getType()); - - if (type && isIntrospectionType(type)) { - context.reportError(new GraphQLError("GraphQL introspection has been disabled, but the requested query contained the field \"".concat(node.name.value, "\"."), node)); - } - } - }; -} diff --git a/node_modules/graphql/validation/specifiedRules.d.ts b/node_modules/graphql/validation/specifiedRules.d.ts deleted file mode 100644 index ffb55708..00000000 --- a/node_modules/graphql/validation/specifiedRules.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ValidationRule, SDLValidationRule } from './ValidationContext'; - -/** - * This set includes all validation rules defined by the GraphQL spec. - * - * The order of the rules in this list has been adjusted to lead to the - * most clear output when encountering multiple validation errors. - */ -export const specifiedRules: ReadonlyArray; - -/** - * @internal - */ -export const specifiedSDLRules: ReadonlyArray; diff --git a/node_modules/graphql/validation/specifiedRules.js b/node_modules/graphql/validation/specifiedRules.js deleted file mode 100644 index a2048497..00000000 --- a/node_modules/graphql/validation/specifiedRules.js +++ /dev/null @@ -1,115 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.specifiedSDLRules = exports.specifiedRules = void 0; - -var _ExecutableDefinitionsRule = require("./rules/ExecutableDefinitionsRule.js"); - -var _UniqueOperationNamesRule = require("./rules/UniqueOperationNamesRule.js"); - -var _LoneAnonymousOperationRule = require("./rules/LoneAnonymousOperationRule.js"); - -var _SingleFieldSubscriptionsRule = require("./rules/SingleFieldSubscriptionsRule.js"); - -var _KnownTypeNamesRule = require("./rules/KnownTypeNamesRule.js"); - -var _FragmentsOnCompositeTypesRule = require("./rules/FragmentsOnCompositeTypesRule.js"); - -var _VariablesAreInputTypesRule = require("./rules/VariablesAreInputTypesRule.js"); - -var _ScalarLeafsRule = require("./rules/ScalarLeafsRule.js"); - -var _FieldsOnCorrectTypeRule = require("./rules/FieldsOnCorrectTypeRule.js"); - -var _UniqueFragmentNamesRule = require("./rules/UniqueFragmentNamesRule.js"); - -var _KnownFragmentNamesRule = require("./rules/KnownFragmentNamesRule.js"); - -var _NoUnusedFragmentsRule = require("./rules/NoUnusedFragmentsRule.js"); - -var _PossibleFragmentSpreadsRule = require("./rules/PossibleFragmentSpreadsRule.js"); - -var _NoFragmentCyclesRule = require("./rules/NoFragmentCyclesRule.js"); - -var _UniqueVariableNamesRule = require("./rules/UniqueVariableNamesRule.js"); - -var _NoUndefinedVariablesRule = require("./rules/NoUndefinedVariablesRule.js"); - -var _NoUnusedVariablesRule = require("./rules/NoUnusedVariablesRule.js"); - -var _KnownDirectivesRule = require("./rules/KnownDirectivesRule.js"); - -var _UniqueDirectivesPerLocationRule = require("./rules/UniqueDirectivesPerLocationRule.js"); - -var _KnownArgumentNamesRule = require("./rules/KnownArgumentNamesRule.js"); - -var _UniqueArgumentNamesRule = require("./rules/UniqueArgumentNamesRule.js"); - -var _ValuesOfCorrectTypeRule = require("./rules/ValuesOfCorrectTypeRule.js"); - -var _ProvidedRequiredArgumentsRule = require("./rules/ProvidedRequiredArgumentsRule.js"); - -var _VariablesInAllowedPositionRule = require("./rules/VariablesInAllowedPositionRule.js"); - -var _OverlappingFieldsCanBeMergedRule = require("./rules/OverlappingFieldsCanBeMergedRule.js"); - -var _UniqueInputFieldNamesRule = require("./rules/UniqueInputFieldNamesRule.js"); - -var _LoneSchemaDefinitionRule = require("./rules/LoneSchemaDefinitionRule.js"); - -var _UniqueOperationTypesRule = require("./rules/UniqueOperationTypesRule.js"); - -var _UniqueTypeNamesRule = require("./rules/UniqueTypeNamesRule.js"); - -var _UniqueEnumValueNamesRule = require("./rules/UniqueEnumValueNamesRule.js"); - -var _UniqueFieldDefinitionNamesRule = require("./rules/UniqueFieldDefinitionNamesRule.js"); - -var _UniqueDirectiveNamesRule = require("./rules/UniqueDirectiveNamesRule.js"); - -var _PossibleTypeExtensionsRule = require("./rules/PossibleTypeExtensionsRule.js"); - -// Spec Section: "Executable Definitions" -// Spec Section: "Operation Name Uniqueness" -// Spec Section: "Lone Anonymous Operation" -// Spec Section: "Subscriptions with Single Root Field" -// Spec Section: "Fragment Spread Type Existence" -// Spec Section: "Fragments on Composite Types" -// Spec Section: "Variables are Input Types" -// Spec Section: "Leaf Field Selections" -// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -// Spec Section: "Fragment Name Uniqueness" -// Spec Section: "Fragment spread target defined" -// Spec Section: "Fragments must be used" -// Spec Section: "Fragment spread is possible" -// Spec Section: "Fragments must not form cycles" -// Spec Section: "Variable Uniqueness" -// Spec Section: "All Variable Used Defined" -// Spec Section: "All Variables Used" -// Spec Section: "Directives Are Defined" -// Spec Section: "Directives Are Unique Per Location" -// Spec Section: "Argument Names" -// Spec Section: "Argument Uniqueness" -// Spec Section: "Value Type Correctness" -// Spec Section: "Argument Optionality" -// Spec Section: "All Variable Usages Are Allowed" -// Spec Section: "Field Selection Merging" -// Spec Section: "Input Object Field Uniqueness" -// SDL-specific validation rules - -/** - * This set includes all validation rules defined by the GraphQL spec. - * - * The order of the rules in this list has been adjusted to lead to the - * most clear output when encountering multiple validation errors. - */ -var specifiedRules = Object.freeze([_ExecutableDefinitionsRule.ExecutableDefinitionsRule, _UniqueOperationNamesRule.UniqueOperationNamesRule, _LoneAnonymousOperationRule.LoneAnonymousOperationRule, _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule, _KnownTypeNamesRule.KnownTypeNamesRule, _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule, _VariablesAreInputTypesRule.VariablesAreInputTypesRule, _ScalarLeafsRule.ScalarLeafsRule, _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule, _UniqueFragmentNamesRule.UniqueFragmentNamesRule, _KnownFragmentNamesRule.KnownFragmentNamesRule, _NoUnusedFragmentsRule.NoUnusedFragmentsRule, _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule, _NoFragmentCyclesRule.NoFragmentCyclesRule, _UniqueVariableNamesRule.UniqueVariableNamesRule, _NoUndefinedVariablesRule.NoUndefinedVariablesRule, _NoUnusedVariablesRule.NoUnusedVariablesRule, _KnownDirectivesRule.KnownDirectivesRule, _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, _KnownArgumentNamesRule.KnownArgumentNamesRule, _UniqueArgumentNamesRule.UniqueArgumentNamesRule, _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule, _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule, _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule, _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule, _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule]); -/** - * @internal - */ - -exports.specifiedRules = specifiedRules; -var specifiedSDLRules = Object.freeze([_LoneSchemaDefinitionRule.LoneSchemaDefinitionRule, _UniqueOperationTypesRule.UniqueOperationTypesRule, _UniqueTypeNamesRule.UniqueTypeNamesRule, _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule, _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule, _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule, _KnownTypeNamesRule.KnownTypeNamesRule, _KnownDirectivesRule.KnownDirectivesRule, _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule, _KnownArgumentNamesRule.KnownArgumentNamesOnDirectivesRule, _UniqueArgumentNamesRule.UniqueArgumentNamesRule, _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsOnDirectivesRule]); -exports.specifiedSDLRules = specifiedSDLRules; diff --git a/node_modules/graphql/validation/specifiedRules.js.flow b/node_modules/graphql/validation/specifiedRules.js.flow deleted file mode 100644 index 179e9fb2..00000000 --- a/node_modules/graphql/validation/specifiedRules.js.flow +++ /dev/null @@ -1,148 +0,0 @@ -// @flow strict -// Spec Section: "Executable Definitions" -import { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; - -// Spec Section: "Operation Name Uniqueness" -import { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; - -// Spec Section: "Lone Anonymous Operation" -import { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; - -// Spec Section: "Subscriptions with Single Root Field" -import { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; - -// Spec Section: "Fragment Spread Type Existence" -import { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; - -// Spec Section: "Fragments on Composite Types" -import { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; - -// Spec Section: "Variables are Input Types" -import { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; - -// Spec Section: "Leaf Field Selections" -import { ScalarLeafsRule } from './rules/ScalarLeafsRule'; - -// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -import { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; - -// Spec Section: "Fragment Name Uniqueness" -import { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; - -// Spec Section: "Fragment spread target defined" -import { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; - -// Spec Section: "Fragments must be used" -import { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; - -// Spec Section: "Fragment spread is possible" -import { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; - -// Spec Section: "Fragments must not form cycles" -import { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; - -// Spec Section: "Variable Uniqueness" -import { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; - -// Spec Section: "All Variable Used Defined" -import { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; - -// Spec Section: "All Variables Used" -import { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; - -// Spec Section: "Directives Are Defined" -import { KnownDirectivesRule } from './rules/KnownDirectivesRule'; - -// Spec Section: "Directives Are Unique Per Location" -import { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; - -// Spec Section: "Argument Names" -import { - KnownArgumentNamesRule, - KnownArgumentNamesOnDirectivesRule, -} from './rules/KnownArgumentNamesRule'; - -// Spec Section: "Argument Uniqueness" -import { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; - -// Spec Section: "Value Type Correctness" -import { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; - -// Spec Section: "Argument Optionality" -import { - ProvidedRequiredArgumentsRule, - ProvidedRequiredArgumentsOnDirectivesRule, -} from './rules/ProvidedRequiredArgumentsRule'; - -// Spec Section: "All Variable Usages Are Allowed" -import { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; - -// Spec Section: "Field Selection Merging" -import { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; - -// Spec Section: "Input Object Field Uniqueness" -import { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; - -// SDL-specific validation rules -import { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; -import { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; -import { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; -import { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; -import { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; -import { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; -import { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; - -/** - * This set includes all validation rules defined by the GraphQL spec. - * - * The order of the rules in this list has been adjusted to lead to the - * most clear output when encountering multiple validation errors. - */ -export const specifiedRules = Object.freeze([ - ExecutableDefinitionsRule, - UniqueOperationNamesRule, - LoneAnonymousOperationRule, - SingleFieldSubscriptionsRule, - KnownTypeNamesRule, - FragmentsOnCompositeTypesRule, - VariablesAreInputTypesRule, - ScalarLeafsRule, - FieldsOnCorrectTypeRule, - UniqueFragmentNamesRule, - KnownFragmentNamesRule, - NoUnusedFragmentsRule, - PossibleFragmentSpreadsRule, - NoFragmentCyclesRule, - UniqueVariableNamesRule, - NoUndefinedVariablesRule, - NoUnusedVariablesRule, - KnownDirectivesRule, - UniqueDirectivesPerLocationRule, - KnownArgumentNamesRule, - UniqueArgumentNamesRule, - ValuesOfCorrectTypeRule, - ProvidedRequiredArgumentsRule, - VariablesInAllowedPositionRule, - OverlappingFieldsCanBeMergedRule, - UniqueInputFieldNamesRule, -]); - -/** - * @internal - */ -export const specifiedSDLRules = Object.freeze([ - LoneSchemaDefinitionRule, - UniqueOperationTypesRule, - UniqueTypeNamesRule, - UniqueEnumValueNamesRule, - UniqueFieldDefinitionNamesRule, - UniqueDirectiveNamesRule, - KnownTypeNamesRule, - KnownDirectivesRule, - UniqueDirectivesPerLocationRule, - PossibleTypeExtensionsRule, - KnownArgumentNamesOnDirectivesRule, - UniqueArgumentNamesRule, - UniqueInputFieldNamesRule, - ProvidedRequiredArgumentsOnDirectivesRule, -]); diff --git a/node_modules/graphql/validation/specifiedRules.mjs b/node_modules/graphql/validation/specifiedRules.mjs deleted file mode 100644 index 97f4664c..00000000 --- a/node_modules/graphql/validation/specifiedRules.mjs +++ /dev/null @@ -1,73 +0,0 @@ -// Spec Section: "Executable Definitions" -import { ExecutableDefinitionsRule } from "./rules/ExecutableDefinitionsRule.mjs"; // Spec Section: "Operation Name Uniqueness" - -import { UniqueOperationNamesRule } from "./rules/UniqueOperationNamesRule.mjs"; // Spec Section: "Lone Anonymous Operation" - -import { LoneAnonymousOperationRule } from "./rules/LoneAnonymousOperationRule.mjs"; // Spec Section: "Subscriptions with Single Root Field" - -import { SingleFieldSubscriptionsRule } from "./rules/SingleFieldSubscriptionsRule.mjs"; // Spec Section: "Fragment Spread Type Existence" - -import { KnownTypeNamesRule } from "./rules/KnownTypeNamesRule.mjs"; // Spec Section: "Fragments on Composite Types" - -import { FragmentsOnCompositeTypesRule } from "./rules/FragmentsOnCompositeTypesRule.mjs"; // Spec Section: "Variables are Input Types" - -import { VariablesAreInputTypesRule } from "./rules/VariablesAreInputTypesRule.mjs"; // Spec Section: "Leaf Field Selections" - -import { ScalarLeafsRule } from "./rules/ScalarLeafsRule.mjs"; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" - -import { FieldsOnCorrectTypeRule } from "./rules/FieldsOnCorrectTypeRule.mjs"; // Spec Section: "Fragment Name Uniqueness" - -import { UniqueFragmentNamesRule } from "./rules/UniqueFragmentNamesRule.mjs"; // Spec Section: "Fragment spread target defined" - -import { KnownFragmentNamesRule } from "./rules/KnownFragmentNamesRule.mjs"; // Spec Section: "Fragments must be used" - -import { NoUnusedFragmentsRule } from "./rules/NoUnusedFragmentsRule.mjs"; // Spec Section: "Fragment spread is possible" - -import { PossibleFragmentSpreadsRule } from "./rules/PossibleFragmentSpreadsRule.mjs"; // Spec Section: "Fragments must not form cycles" - -import { NoFragmentCyclesRule } from "./rules/NoFragmentCyclesRule.mjs"; // Spec Section: "Variable Uniqueness" - -import { UniqueVariableNamesRule } from "./rules/UniqueVariableNamesRule.mjs"; // Spec Section: "All Variable Used Defined" - -import { NoUndefinedVariablesRule } from "./rules/NoUndefinedVariablesRule.mjs"; // Spec Section: "All Variables Used" - -import { NoUnusedVariablesRule } from "./rules/NoUnusedVariablesRule.mjs"; // Spec Section: "Directives Are Defined" - -import { KnownDirectivesRule } from "./rules/KnownDirectivesRule.mjs"; // Spec Section: "Directives Are Unique Per Location" - -import { UniqueDirectivesPerLocationRule } from "./rules/UniqueDirectivesPerLocationRule.mjs"; // Spec Section: "Argument Names" - -import { KnownArgumentNamesRule, KnownArgumentNamesOnDirectivesRule } from "./rules/KnownArgumentNamesRule.mjs"; // Spec Section: "Argument Uniqueness" - -import { UniqueArgumentNamesRule } from "./rules/UniqueArgumentNamesRule.mjs"; // Spec Section: "Value Type Correctness" - -import { ValuesOfCorrectTypeRule } from "./rules/ValuesOfCorrectTypeRule.mjs"; // Spec Section: "Argument Optionality" - -import { ProvidedRequiredArgumentsRule, ProvidedRequiredArgumentsOnDirectivesRule } from "./rules/ProvidedRequiredArgumentsRule.mjs"; // Spec Section: "All Variable Usages Are Allowed" - -import { VariablesInAllowedPositionRule } from "./rules/VariablesInAllowedPositionRule.mjs"; // Spec Section: "Field Selection Merging" - -import { OverlappingFieldsCanBeMergedRule } from "./rules/OverlappingFieldsCanBeMergedRule.mjs"; // Spec Section: "Input Object Field Uniqueness" - -import { UniqueInputFieldNamesRule } from "./rules/UniqueInputFieldNamesRule.mjs"; // SDL-specific validation rules - -import { LoneSchemaDefinitionRule } from "./rules/LoneSchemaDefinitionRule.mjs"; -import { UniqueOperationTypesRule } from "./rules/UniqueOperationTypesRule.mjs"; -import { UniqueTypeNamesRule } from "./rules/UniqueTypeNamesRule.mjs"; -import { UniqueEnumValueNamesRule } from "./rules/UniqueEnumValueNamesRule.mjs"; -import { UniqueFieldDefinitionNamesRule } from "./rules/UniqueFieldDefinitionNamesRule.mjs"; -import { UniqueDirectiveNamesRule } from "./rules/UniqueDirectiveNamesRule.mjs"; -import { PossibleTypeExtensionsRule } from "./rules/PossibleTypeExtensionsRule.mjs"; -/** - * This set includes all validation rules defined by the GraphQL spec. - * - * The order of the rules in this list has been adjusted to lead to the - * most clear output when encountering multiple validation errors. - */ - -export var specifiedRules = Object.freeze([ExecutableDefinitionsRule, UniqueOperationNamesRule, LoneAnonymousOperationRule, SingleFieldSubscriptionsRule, KnownTypeNamesRule, FragmentsOnCompositeTypesRule, VariablesAreInputTypesRule, ScalarLeafsRule, FieldsOnCorrectTypeRule, UniqueFragmentNamesRule, KnownFragmentNamesRule, NoUnusedFragmentsRule, PossibleFragmentSpreadsRule, NoFragmentCyclesRule, UniqueVariableNamesRule, NoUndefinedVariablesRule, NoUnusedVariablesRule, KnownDirectivesRule, UniqueDirectivesPerLocationRule, KnownArgumentNamesRule, UniqueArgumentNamesRule, ValuesOfCorrectTypeRule, ProvidedRequiredArgumentsRule, VariablesInAllowedPositionRule, OverlappingFieldsCanBeMergedRule, UniqueInputFieldNamesRule]); -/** - * @internal - */ - -export var specifiedSDLRules = Object.freeze([LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, KnownTypeNamesRule, KnownDirectivesRule, UniqueDirectivesPerLocationRule, PossibleTypeExtensionsRule, KnownArgumentNamesOnDirectivesRule, UniqueArgumentNamesRule, UniqueInputFieldNamesRule, ProvidedRequiredArgumentsOnDirectivesRule]); diff --git a/node_modules/graphql/validation/validate.d.ts b/node_modules/graphql/validation/validate.d.ts deleted file mode 100644 index 5e93a8cf..00000000 --- a/node_modules/graphql/validation/validate.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Maybe } from '../jsutils/Maybe'; - -import { GraphQLError } from '../error/GraphQLError'; - -import { DocumentNode } from '../language/ast'; - -import { GraphQLSchema } from '../type/schema'; - -import { TypeInfo } from '../utilities/TypeInfo'; - -import { ValidationRule, SDLValidationRule } from './ValidationContext'; - -/** - * Implements the "Validation" section of the spec. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the document is valid. - * - * A list of specific validation rules may be provided. If not provided, the - * default list of rules defined by the GraphQL specification will be used. - * - * Each validation rules is a function which returns a visitor - * (see the language/visitor API). Visitor methods are expected to return - * GraphQLErrors, or Arrays of GraphQLErrors when invalid. - * - * Optionally a custom TypeInfo instance may be provided. If not provided, one - * will be created from the provided schema. - */ -export function validate( - schema: GraphQLSchema, - documentAST: DocumentNode, - rules?: ReadonlyArray, - typeInfo?: TypeInfo, - options?: { maxErrors?: number }, -): ReadonlyArray; - -/** - * @internal - */ -export function validateSDL( - documentAST: DocumentNode, - schemaToExtend?: Maybe, - rules?: ReadonlyArray, -): Array; - -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ -export function assertValidSDL(documentAST: DocumentNode): void; - -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ -export function assertValidSDLExtension( - documentAST: DocumentNode, - schema: GraphQLSchema, -): void; diff --git a/node_modules/graphql/validation/validate.js b/node_modules/graphql/validation/validate.js deleted file mode 100644 index 04b823fa..00000000 --- a/node_modules/graphql/validation/validate.js +++ /dev/null @@ -1,128 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.validate = validate; -exports.validateSDL = validateSDL; -exports.assertValidSDL = assertValidSDL; -exports.assertValidSDLExtension = assertValidSDLExtension; - -var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js")); - -var _GraphQLError = require("../error/GraphQLError.js"); - -var _visitor = require("../language/visitor.js"); - -var _validate = require("../type/validate.js"); - -var _TypeInfo = require("../utilities/TypeInfo.js"); - -var _specifiedRules = require("./specifiedRules.js"); - -var _ValidationContext = require("./ValidationContext.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Implements the "Validation" section of the spec. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the document is valid. - * - * A list of specific validation rules may be provided. If not provided, the - * default list of rules defined by the GraphQL specification will be used. - * - * Each validation rules is a function which returns a visitor - * (see the language/visitor API). Visitor methods are expected to return - * GraphQLErrors, or Arrays of GraphQLErrors when invalid. - * - * Optionally a custom TypeInfo instance may be provided. If not provided, one - * will be created from the provided schema. - */ -function validate(schema, documentAST) { - var rules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _specifiedRules.specifiedRules; - var typeInfo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new _TypeInfo.TypeInfo(schema); - var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { - maxErrors: undefined - }; - documentAST || (0, _devAssert.default)(0, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. - - (0, _validate.assertValidSchema)(schema); - var abortObj = Object.freeze({}); - var errors = []; - var context = new _ValidationContext.ValidationContext(schema, documentAST, typeInfo, function (error) { - if (options.maxErrors != null && errors.length >= options.maxErrors) { - errors.push(new _GraphQLError.GraphQLError('Too many validation errors, error limit reached. Validation aborted.')); - throw abortObj; - } - - errors.push(error); - }); // This uses a specialized visitor which runs multiple visitors in parallel, - // while maintaining the visitor skip and break API. - - var visitor = (0, _visitor.visitInParallel)(rules.map(function (rule) { - return rule(context); - })); // Visit the whole document with each instance of all provided rules. - - try { - (0, _visitor.visit)(documentAST, (0, _TypeInfo.visitWithTypeInfo)(typeInfo, visitor)); - } catch (e) { - if (e !== abortObj) { - throw e; - } - } - - return errors; -} -/** - * @internal - */ - - -function validateSDL(documentAST, schemaToExtend) { - var rules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _specifiedRules.specifiedSDLRules; - var errors = []; - var context = new _ValidationContext.SDLValidationContext(documentAST, schemaToExtend, function (error) { - errors.push(error); - }); - var visitors = rules.map(function (rule) { - return rule(context); - }); - (0, _visitor.visit)(documentAST, (0, _visitor.visitInParallel)(visitors)); - return errors; -} -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ - - -function assertValidSDL(documentAST) { - var errors = validateSDL(documentAST); - - if (errors.length !== 0) { - throw new Error(errors.map(function (error) { - return error.message; - }).join('\n\n')); - } -} -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ - - -function assertValidSDLExtension(documentAST, schema) { - var errors = validateSDL(documentAST, schema); - - if (errors.length !== 0) { - throw new Error(errors.map(function (error) { - return error.message; - }).join('\n\n')); - } -} diff --git a/node_modules/graphql/validation/validate.js.flow b/node_modules/graphql/validation/validate.js.flow deleted file mode 100644 index 3dfaec6c..00000000 --- a/node_modules/graphql/validation/validate.js.flow +++ /dev/null @@ -1,128 +0,0 @@ -// @flow strict -import devAssert from '../jsutils/devAssert'; - -import { GraphQLError } from '../error/GraphQLError'; - -import type { DocumentNode } from '../language/ast'; -import { visit, visitInParallel } from '../language/visitor'; - -import type { GraphQLSchema } from '../type/schema'; -import { assertValidSchema } from '../type/validate'; - -import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo'; - -import type { SDLValidationRule, ValidationRule } from './ValidationContext'; -import { specifiedRules, specifiedSDLRules } from './specifiedRules'; -import { SDLValidationContext, ValidationContext } from './ValidationContext'; - -/** - * Implements the "Validation" section of the spec. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the document is valid. - * - * A list of specific validation rules may be provided. If not provided, the - * default list of rules defined by the GraphQL specification will be used. - * - * Each validation rules is a function which returns a visitor - * (see the language/visitor API). Visitor methods are expected to return - * GraphQLErrors, or Arrays of GraphQLErrors when invalid. - * - * Optionally a custom TypeInfo instance may be provided. If not provided, one - * will be created from the provided schema. - */ -export function validate( - schema: GraphQLSchema, - documentAST: DocumentNode, - rules?: $ReadOnlyArray = specifiedRules, - typeInfo?: TypeInfo = new TypeInfo(schema), - options?: {| maxErrors?: number |} = { maxErrors: undefined }, -): $ReadOnlyArray { - devAssert(documentAST, 'Must provide document.'); - // If the schema used for validation is invalid, throw an error. - assertValidSchema(schema); - - const abortObj = Object.freeze({}); - const errors = []; - const context = new ValidationContext( - schema, - documentAST, - typeInfo, - (error) => { - if (options.maxErrors != null && errors.length >= options.maxErrors) { - errors.push( - new GraphQLError( - 'Too many validation errors, error limit reached. Validation aborted.', - ), - ); - throw abortObj; - } - errors.push(error); - }, - ); - - // This uses a specialized visitor which runs multiple visitors in parallel, - // while maintaining the visitor skip and break API. - const visitor = visitInParallel(rules.map((rule) => rule(context))); - - // Visit the whole document with each instance of all provided rules. - try { - visit(documentAST, visitWithTypeInfo(typeInfo, visitor)); - } catch (e) { - if (e !== abortObj) { - throw e; - } - } - return errors; -} - -/** - * @internal - */ -export function validateSDL( - documentAST: DocumentNode, - schemaToExtend?: ?GraphQLSchema, - rules?: $ReadOnlyArray = specifiedSDLRules, -): $ReadOnlyArray { - const errors = []; - const context = new SDLValidationContext( - documentAST, - schemaToExtend, - (error) => { - errors.push(error); - }, - ); - - const visitors = rules.map((rule) => rule(context)); - visit(documentAST, visitInParallel(visitors)); - return errors; -} - -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ -export function assertValidSDL(documentAST: DocumentNode): void { - const errors = validateSDL(documentAST); - if (errors.length !== 0) { - throw new Error(errors.map((error) => error.message).join('\n\n')); - } -} - -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ -export function assertValidSDLExtension( - documentAST: DocumentNode, - schema: GraphQLSchema, -): void { - const errors = validateSDL(documentAST, schema); - if (errors.length !== 0) { - throw new Error(errors.map((error) => error.message).join('\n\n')); - } -} diff --git a/node_modules/graphql/validation/validate.mjs b/node_modules/graphql/validation/validate.mjs deleted file mode 100644 index 2ae71e7a..00000000 --- a/node_modules/graphql/validation/validate.mjs +++ /dev/null @@ -1,107 +0,0 @@ -import devAssert from "../jsutils/devAssert.mjs"; -import { GraphQLError } from "../error/GraphQLError.mjs"; -import { visit, visitInParallel } from "../language/visitor.mjs"; -import { assertValidSchema } from "../type/validate.mjs"; -import { TypeInfo, visitWithTypeInfo } from "../utilities/TypeInfo.mjs"; -import { specifiedRules, specifiedSDLRules } from "./specifiedRules.mjs"; -import { SDLValidationContext, ValidationContext } from "./ValidationContext.mjs"; -/** - * Implements the "Validation" section of the spec. - * - * Validation runs synchronously, returning an array of encountered errors, or - * an empty array if no errors were encountered and the document is valid. - * - * A list of specific validation rules may be provided. If not provided, the - * default list of rules defined by the GraphQL specification will be used. - * - * Each validation rules is a function which returns a visitor - * (see the language/visitor API). Visitor methods are expected to return - * GraphQLErrors, or Arrays of GraphQLErrors when invalid. - * - * Optionally a custom TypeInfo instance may be provided. If not provided, one - * will be created from the provided schema. - */ - -export function validate(schema, documentAST) { - var rules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : specifiedRules; - var typeInfo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new TypeInfo(schema); - var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { - maxErrors: undefined - }; - documentAST || devAssert(0, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. - - assertValidSchema(schema); - var abortObj = Object.freeze({}); - var errors = []; - var context = new ValidationContext(schema, documentAST, typeInfo, function (error) { - if (options.maxErrors != null && errors.length >= options.maxErrors) { - errors.push(new GraphQLError('Too many validation errors, error limit reached. Validation aborted.')); - throw abortObj; - } - - errors.push(error); - }); // This uses a specialized visitor which runs multiple visitors in parallel, - // while maintaining the visitor skip and break API. - - var visitor = visitInParallel(rules.map(function (rule) { - return rule(context); - })); // Visit the whole document with each instance of all provided rules. - - try { - visit(documentAST, visitWithTypeInfo(typeInfo, visitor)); - } catch (e) { - if (e !== abortObj) { - throw e; - } - } - - return errors; -} -/** - * @internal - */ - -export function validateSDL(documentAST, schemaToExtend) { - var rules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : specifiedSDLRules; - var errors = []; - var context = new SDLValidationContext(documentAST, schemaToExtend, function (error) { - errors.push(error); - }); - var visitors = rules.map(function (rule) { - return rule(context); - }); - visit(documentAST, visitInParallel(visitors)); - return errors; -} -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ - -export function assertValidSDL(documentAST) { - var errors = validateSDL(documentAST); - - if (errors.length !== 0) { - throw new Error(errors.map(function (error) { - return error.message; - }).join('\n\n')); - } -} -/** - * Utility function which asserts a SDL document is valid by throwing an error - * if it is invalid. - * - * @internal - */ - -export function assertValidSDLExtension(documentAST, schema) { - var errors = validateSDL(documentAST, schema); - - if (errors.length !== 0) { - throw new Error(errors.map(function (error) { - return error.message; - }).join('\n\n')); - } -} diff --git a/node_modules/graphql/version.d.ts b/node_modules/graphql/version.d.ts deleted file mode 100644 index 765329b3..00000000 --- a/node_modules/graphql/version.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * A string containing the version of the GraphQL.js library - */ -export const version: string; - -/** - * An object containing the components of the GraphQL.js version string - */ -export const versionInfo: { - major: number; - minor: number; - patch: number; - preReleaseTag: number | null; -}; diff --git a/node_modules/graphql/version.js b/node_modules/graphql/version.js deleted file mode 100644 index afc72d0a..00000000 --- a/node_modules/graphql/version.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.versionInfo = exports.version = void 0; - -/** - * Note: This file is autogenerated using "resources/gen-version.js" script and - * automatically updated by "npm version" command. - */ - -/** - * A string containing the version of the GraphQL.js library - */ -var version = '15.4.0'; -/** - * An object containing the components of the GraphQL.js version string - */ - -exports.version = version; -var versionInfo = Object.freeze({ - major: 15, - minor: 4, - patch: 0, - preReleaseTag: null -}); -exports.versionInfo = versionInfo; diff --git a/node_modules/graphql/version.js.flow b/node_modules/graphql/version.js.flow deleted file mode 100644 index 6fc0ea1a..00000000 --- a/node_modules/graphql/version.js.flow +++ /dev/null @@ -1,20 +0,0 @@ -// @flow strict -/** - * Note: This file is autogenerated using "resources/gen-version.js" script and - * automatically updated by "npm version" command. - */ - -/** - * A string containing the version of the GraphQL.js library - */ -export const version = '15.4.0'; - -/** - * An object containing the components of the GraphQL.js version string - */ -export const versionInfo = Object.freeze({ - major: 15, - minor: 4, - patch: 0, - preReleaseTag: null, -}); diff --git a/node_modules/graphql/version.mjs b/node_modules/graphql/version.mjs deleted file mode 100644 index e8b1fa5f..00000000 --- a/node_modules/graphql/version.mjs +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Note: This file is autogenerated using "resources/gen-version.js" script and - * automatically updated by "npm version" command. - */ - -/** - * A string containing the version of the GraphQL.js library - */ -export var version = '15.4.0'; -/** - * An object containing the components of the GraphQL.js version string - */ - -export var versionInfo = Object.freeze({ - major: 15, - minor: 4, - patch: 0, - preReleaseTag: null -}); diff --git a/node_modules/gtoken/CHANGELOG.md b/node_modules/gtoken/CHANGELOG.md deleted file mode 100644 index 53efc8c2..00000000 --- a/node_modules/gtoken/CHANGELOG.md +++ /dev/null @@ -1,253 +0,0 @@ -# Changelog - -[npm history][1] - -[1]: https://www.npmjs.com/package/gtoken?activeTab=versions - -### [5.0.4](https://www.github.com/googleapis/node-gtoken/compare/v5.0.3...v5.0.4) (2020-10-06) - - -### Bug Fixes - -* **deps:** upgrade google-p12-pem ([#337](https://www.github.com/googleapis/node-gtoken/issues/337)) ([77a749d](https://www.github.com/googleapis/node-gtoken/commit/77a749d646c7ccc68e974f27827a9d538dfea784)) - -### [5.0.3](https://www.github.com/googleapis/node-gtoken/compare/v5.0.2...v5.0.3) (2020-07-27) - - -### Bug Fixes - -* move gitattributes files to node templates ([#322](https://www.github.com/googleapis/node-gtoken/issues/322)) ([1d1786b](https://www.github.com/googleapis/node-gtoken/commit/1d1786b8915cd9a33577237ec6a6148a29e11a88)) - -### [5.0.2](https://www.github.com/googleapis/node-gtoken/compare/v5.0.1...v5.0.2) (2020-07-09) - - -### Bug Fixes - -* typeo in nodejs .gitattribute ([#311](https://www.github.com/googleapis/node-gtoken/issues/311)) ([8e17b4c](https://www.github.com/googleapis/node-gtoken/commit/8e17b4c0757832b2d31178684a6b24e1759d9f76)) - -### [5.0.1](https://www.github.com/googleapis/node-gtoken/compare/v5.0.0...v5.0.1) (2020-04-13) - - -### Bug Fixes - -* **deps:** update dependency gaxios to v3 ([#287](https://www.github.com/googleapis/node-gtoken/issues/287)) ([033731e](https://www.github.com/googleapis/node-gtoken/commit/033731e128fef0034b07b13183044e5060809418)) -* **deps:** update dependency google-p12-pem to v3 ([#280](https://www.github.com/googleapis/node-gtoken/issues/280)) ([25121b0](https://www.github.com/googleapis/node-gtoken/commit/25121b00cc9a4d32854f36ea8bc4bbd2cb77afbb)) -* apache license URL ([#468](https://www.github.com/googleapis/node-gtoken/issues/468)) ([#293](https://www.github.com/googleapis/node-gtoken/issues/293)) ([14a5bcd](https://www.github.com/googleapis/node-gtoken/commit/14a5bcd52d7b18d787c620451471e904784222d9)) - -## [5.0.0](https://www.github.com/googleapis/node-gtoken/compare/v4.1.4...v5.0.0) (2020-03-24) - - -### ⚠ BREAKING CHANGES - -* drop Node 8 from engines (#284) -* typescript@3.7.x introduced breaking changes to compiled code - -### Features - -* drop Node 8 from engines ([#284](https://www.github.com/googleapis/node-gtoken/issues/284)) ([209e007](https://www.github.com/googleapis/node-gtoken/commit/209e00746116a82a3cf9acc158aff12a4971f3d0)) - - -### Build System - -* update gts and typescript ([#283](https://www.github.com/googleapis/node-gtoken/issues/283)) ([ff076dc](https://www.github.com/googleapis/node-gtoken/commit/ff076dcb3da229238e7bed28d739c48986652c78)) - -### [4.1.4](https://www.github.com/googleapis/node-gtoken/compare/v4.1.3...v4.1.4) (2020-01-06) - - -### Bug Fixes - -* **deps:** pin TypeScript below 3.7.0 ([f1ae7b6](https://www.github.com/googleapis/node-gtoken/commit/f1ae7b64ead1c918546ae5bbe8546dfb4ecc788a)) -* **deps:** update dependency jws to v4 ([#251](https://www.github.com/googleapis/node-gtoken/issues/251)) ([e13542f](https://www.github.com/googleapis/node-gtoken/commit/e13542f888a81ed3ced0023e9b78ed25264b1d1c)) - -### [4.1.3](https://www.github.com/googleapis/node-gtoken/compare/v4.1.2...v4.1.3) (2019-11-15) - - -### Bug Fixes - -* **deps:** use typescript ~3.6.0 ([#246](https://www.github.com/googleapis/node-gtoken/issues/246)) ([5f725b7](https://www.github.com/googleapis/node-gtoken/commit/5f725b71f080e83058b1a23340acadc0c8704123)) - -### [4.1.2](https://www.github.com/googleapis/node-gtoken/compare/v4.1.1...v4.1.2) (2019-11-13) - - -### Bug Fixes - -* **docs:** add jsdoc-region-tag plugin ([#242](https://www.github.com/googleapis/node-gtoken/issues/242)) ([994c5cc](https://www.github.com/googleapis/node-gtoken/commit/994c5ccf92731599aa63b84c29a9d5f6b1431cc5)) - -### [4.1.1](https://www.github.com/googleapis/node-gtoken/compare/v4.1.0...v4.1.1) (2019-10-31) - - -### Bug Fixes - -* **deps:** update gaxios to 2.1.0 ([#238](https://www.github.com/googleapis/node-gtoken/issues/238)) ([bb12064](https://www.github.com/googleapis/node-gtoken/commit/bb1206420388399ef8992efe54c70bdb3fdcd965)) - -## [4.1.0](https://www.github.com/googleapis/node-gtoken/compare/v4.0.0...v4.1.0) (2019-09-24) - - -### Features - -* allow upstream libraries to force token refresh ([#229](https://www.github.com/googleapis/node-gtoken/issues/229)) ([1fd4dd1](https://www.github.com/googleapis/node-gtoken/commit/1fd4dd1)) - -## [4.0.0](https://www.github.com/googleapis/node-gtoken/compare/v3.0.2...v4.0.0) (2019-07-09) - - -### ⚠ BREAKING CHANGES - -* This commit creates multiple breaking changes. The `getToken()` -method previously returned `Promise`, where the string was the -`access_token` returned from the response. However, the `oauth2` endpoint could -return a variety of other fields, such as an `id_token` in special cases. - -```js -const token = await getToken(); -// old response: 'some.access.token' -// new response: { access_token: 'some.access.token'} -``` - -To further support this change, the `GoogleToken` class no longer exposes -a `token` variable. It now exposes `rawToken`, `accessToken`, and `idToken` -fields which can be used to access the relevant values returned in the -response. - -### Bug Fixes - -* expose all fields from response ([#218](https://www.github.com/googleapis/node-gtoken/issues/218)) ([d463370](https://www.github.com/googleapis/node-gtoken/commit/d463370)) - -### [3.0.2](https://www.github.com/googleapis/node-gtoken/compare/v3.0.1...v3.0.2) (2019-06-26) - - -### Bug Fixes - -* **docs:** make anchors work in jsdoc ([#215](https://www.github.com/googleapis/node-gtoken/issues/215)) ([c5f6c89](https://www.github.com/googleapis/node-gtoken/commit/c5f6c89)) - -### [3.0.1](https://www.github.com/googleapis/node-gtoken/compare/v3.0.0...v3.0.1) (2019-06-13) - - -### Bug Fixes - -* **docs:** move to new client docs URL ([#212](https://www.github.com/googleapis/node-gtoken/issues/212)) ([b7a8c75](https://www.github.com/googleapis/node-gtoken/commit/b7a8c75)) - -## [3.0.0](https://www.github.com/googleapis/node-gtoken/compare/v2.3.3...v3.0.0) (2019-05-07) - - -### Bug Fixes - -* **deps:** update dependency gaxios to v2 ([#191](https://www.github.com/googleapis/node-gtoken/issues/191)) ([da65ea7](https://www.github.com/googleapis/node-gtoken/commit/da65ea7)) -* **deps:** update dependency google-p12-pem to v2 ([#196](https://www.github.com/googleapis/node-gtoken/issues/196)) ([b510f06](https://www.github.com/googleapis/node-gtoken/commit/b510f06)) -* fs.readFile does not exist in browser ([#186](https://www.github.com/googleapis/node-gtoken/issues/186)) ([a16d8e7](https://www.github.com/googleapis/node-gtoken/commit/a16d8e7)) - - -### Build System - -* upgrade engines field to >=8.10.0 ([#194](https://www.github.com/googleapis/node-gtoken/issues/194)) ([ee4d6c8](https://www.github.com/googleapis/node-gtoken/commit/ee4d6c8)) - - -### BREAKING CHANGES - -* upgrade engines field to >=8.10.0 (#194) - -## v2.3.3 - -03-13-2019 14:54 PDT - -### Bug Fixes -- fix: propagate error message ([#173](https://github.com/google/node-gtoken/pull/173)) - -### Documentation -- docs: update links in contrib guide ([#171](https://github.com/google/node-gtoken/pull/171)) -- docs: move CONTRIBUTING.md to root ([#166](https://github.com/google/node-gtoken/pull/166)) -- docs: add lint/fix example to contributing guide ([#164](https://github.com/google/node-gtoken/pull/164)) - -### Internal / Testing Changes -- build: Add docuploader credentials to node publish jobs ([#176](https://github.com/google/node-gtoken/pull/176)) -- build: use node10 to run samples-test, system-test etc ([#175](https://github.com/google/node-gtoken/pull/175)) -- build: update release configuration -- chore(deps): update dependency mocha to v6 -- build: use linkinator for docs test ([#170](https://github.com/google/node-gtoken/pull/170)) -- build: create docs test npm scripts ([#169](https://github.com/google/node-gtoken/pull/169)) -- build: test using @grpc/grpc-js in CI ([#168](https://github.com/google/node-gtoken/pull/168)) -- build: ignore googleapis.com in doc link check ([#162](https://github.com/google/node-gtoken/pull/162)) -- build: check for 404s on all docs - -## v2.3.2 - -01-09-2019 13:40 PST - -### Documentation -- docs: generate docs with compodoc ([#154](https://github.com/googleapis/node-gtoken/pull/154)) -- docs: fix up the readme ([#153](https://github.com/googleapis/node-gtoken/pull/153)) - -### Internal / Testing Changes -- build: Re-generated to pick up changes in the API or client library generator. ([#158](https://github.com/googleapis/node-gtoken/pull/158)) -- build: check broken links in generated docs ([#152](https://github.com/googleapis/node-gtoken/pull/152)) -- fix: add a system test and get it passing ([#150](https://github.com/googleapis/node-gtoken/pull/150)) -- chore(build): inject yoshi automation key ([#149](https://github.com/googleapis/node-gtoken/pull/149)) - -## v2.3.1 - -12-10-2018 15:28 PST - -### Dependencies -- fix(deps): update dependency pify to v4 ([#87](https://github.com/google/node-gtoken/pull/87)) -- fix(deps): use gaxios for http requests ([#125](https://github.com/google/node-gtoken/pull/125)) - -### Internal / Testing Changes -- build: add Kokoro configs for autorelease ([#143](https://github.com/google/node-gtoken/pull/143)) -- chore: always nyc report before calling codecov ([#141](https://github.com/google/node-gtoken/pull/141)) -- chore: nyc ignore build/test by default ([#140](https://github.com/google/node-gtoken/pull/140)) -- chore: update synth metadata and templates ([#138](https://github.com/google/node-gtoken/pull/138)) -- fix(build): fix system key decryption ([#133](https://github.com/google/node-gtoken/pull/133)) -- chore(deps): update dependency typescript to ~3.2.0 ([#132](https://github.com/google/node-gtoken/pull/132)) -- chore: add a synth.metadata -- chore(deps): update dependency gts to ^0.9.0 ([#127](https://github.com/google/node-gtoken/pull/127)) -- chore: update eslintignore config ([#126](https://github.com/google/node-gtoken/pull/126)) -- chore: use latest npm on Windows ([#124](https://github.com/google/node-gtoken/pull/124)) -- chore: update CircleCI config ([#123](https://github.com/google/node-gtoken/pull/123)) -- chore: include build in eslintignore ([#120](https://github.com/google/node-gtoken/pull/120)) -- chore: update issue templates ([#116](https://github.com/google/node-gtoken/pull/116)) -- chore: remove old issue template ([#114](https://github.com/google/node-gtoken/pull/114)) -- build: run tests on node11 ([#113](https://github.com/google/node-gtoken/pull/113)) -- chore(deps): update dependency nock to v10 ([#111](https://github.com/google/node-gtoken/pull/111)) -- chores(build): do not collect sponge.xml from windows builds ([#112](https://github.com/google/node-gtoken/pull/112)) -- chore(deps): update dependency typescript to ~3.1.0 ([#110](https://github.com/google/node-gtoken/pull/110)) -- chores(build): run codecov on continuous builds ([#109](https://github.com/google/node-gtoken/pull/109)) -- chore: update new issue template ([#108](https://github.com/google/node-gtoken/pull/108)) -- chore: update CI config ([#105](https://github.com/google/node-gtoken/pull/105)) -- Update kokoro config ([#103](https://github.com/google/node-gtoken/pull/103)) -- Update CI config ([#101](https://github.com/google/node-gtoken/pull/101)) -- Don't publish sourcemaps ([#99](https://github.com/google/node-gtoken/pull/99)) -- Update kokoro config ([#97](https://github.com/google/node-gtoken/pull/97)) -- test: remove appveyor config ([#96](https://github.com/google/node-gtoken/pull/96)) -- Update CI config ([#95](https://github.com/google/node-gtoken/pull/95)) -- Enable prefer-const in the eslint config ([#94](https://github.com/google/node-gtoken/pull/94)) -- Enable no-var in eslint ([#93](https://github.com/google/node-gtoken/pull/93)) -- Update CI config ([#92](https://github.com/google/node-gtoken/pull/92)) -- Add synth and update CI config ([#91](https://github.com/google/node-gtoken/pull/91)) -- Retry npm install in CI ([#90](https://github.com/google/node-gtoken/pull/90)) -- chore(deps): update dependency nyc to v13 ([#88](https://github.com/google/node-gtoken/pull/88)) -- chore: ignore package-log.json ([#86](https://github.com/google/node-gtoken/pull/86)) -- chore: update renovate config ([#83](https://github.com/google/node-gtoken/pull/83)) -- chore(deps): lock file maintenance ([#85](https://github.com/google/node-gtoken/pull/85)) -- chore: remove greenkeeper badge ([#82](https://github.com/google/node-gtoken/pull/82)) -- test: throw on deprecation ([#81](https://github.com/google/node-gtoken/pull/81)) -- chore(deps): update dependency typescript to v3 ([#80](https://github.com/google/node-gtoken/pull/80)) -- chore: move mocha options to mocha.opts ([#78](https://github.com/google/node-gtoken/pull/78)) -- chore(deps): lock file maintenance ([#79](https://github.com/google/node-gtoken/pull/79)) -- test: use strictEqual in tests ([#76](https://github.com/google/node-gtoken/pull/76)) -- chore(deps): lock file maintenance ([#77](https://github.com/google/node-gtoken/pull/77)) -- chore(deps): update dependency typescript to ~2.9.0 ([#75](https://github.com/google/node-gtoken/pull/75)) -- chore: Configure Renovate ([#74](https://github.com/google/node-gtoken/pull/74)) -- Update gts to the latest version 🚀 ([#73](https://github.com/google/node-gtoken/pull/73)) -- Add Code of Conduct -- build: start testing against Node 10 ([#69](https://github.com/google/node-gtoken/pull/69)) -- chore(package): update nyc to version 12.0.2 ([#67](https://github.com/google/node-gtoken/pull/67)) -- chore(package): update @types/node to version 10.0.3 ([#65](https://github.com/google/node-gtoken/pull/65)) - -### 2.0.0 -New features: -- API now supports callback and promise based workflows - -Breaking changes: -- `GoogleToken` is now a class type, and must be instantiated. -- `GoogleToken.expires_at` renamed to `GoogleToken.expiresAt` -- `GoogleToken.raw_token` renamed to `GoogleToken.rawToken` -- `GoogleToken.token_expires` renamed to `GoogleToken.tokenExpires` diff --git a/node_modules/gtoken/LICENSE b/node_modules/gtoken/LICENSE deleted file mode 100644 index 061e6a68..00000000 --- a/node_modules/gtoken/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Ryan Seys - -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. diff --git a/node_modules/gtoken/README.md b/node_modules/gtoken/README.md deleted file mode 100644 index 3e1831f0..00000000 --- a/node_modules/gtoken/README.md +++ /dev/null @@ -1,182 +0,0 @@ -Google Cloud Platform logo - -# [node-gtoken](https://github.com/googleapis/node-gtoken) - -[![npm version][npm-image]][npm-url] -[![Known Vulnerabilities][snyk-image]][snyk-url] -[![codecov][codecov-image]][codecov-url] -[![Code Style: Google][gts-image]][gts-url] - -> Node.js Google Authentication Service Account Tokens - -This is a low level utility library used to interact with Google Authentication services. **In most cases, you probably want to use the [google-auth-library](https://github.com/googleapis/google-auth-library-nodejs) instead.** - -* [gtoken API Reference][client-docs] -* [github.com/googleapis/node-gtoken](https://github.com/googleapis/node-gtoken) - -## Installation - -``` sh -npm install gtoken -``` - -## Usage - -### Use with a `.pem` or `.p12` key file: - -``` js -const { GoogleToken } = require('gtoken'); -const gtoken = new GoogleToken({ - keyFile: 'path/to/key.pem', // or path to .p12 key file - email: 'my_service_account_email@developer.gserviceaccount.com', - scope: ['https://scope1', 'https://scope2'] // or space-delimited string of scopes -}); - -gtoken.getToken((err, tokens) => { - if (err) { - console.log(err); - return; - } - console.log(tokens); - // { - // access_token: 'very-secret-token', - // expires_in: 3600, - // token_type: 'Bearer' - // } -}); -``` - -You can also use the async/await style API: - -``` js -const tokens = await gtoken.getToken() -console.log(tokens); -``` - -Or use promises: - -```js -gtoken.getToken() - .then(tokens => { - console.log(tokens) - }) - .catch(console.error); -``` - -### Use with a service account `.json` key file: - -``` js -const { GoogleToken } = require('gtoken'); -const gtoken = new GoogleToken({ - keyFile: 'path/to/key.json', - scope: ['https://scope1', 'https://scope2'] // or space-delimited string of scopes -}); - -gtoken.getToken((err, tokens) => { - if (err) { - console.log(err); - return; - } - console.log(tokens); -}); -``` - -### Pass the private key as a string directly: - -``` js -const key = '-----BEGIN RSA PRIVATE KEY-----\nXXXXXXXXXXX...'; -const { GoogleToken } = require('gtoken'); -const gtoken = new GoogleToken({ - email: 'my_service_account_email@developer.gserviceaccount.com', - scope: ['https://scope1', 'https://scope2'], // or space-delimited string of scopes - key: key -}); -``` - -## Options - -> Various options that can be set when creating initializing the `gtoken` object. - -- `options.email or options.iss`: The service account email address. -- `options.scope`: An array of scope strings or space-delimited string of scopes. -- `options.sub`: The email address of the user requesting delegated access. -- `options.keyFile`: The filename of `.json` key, `.pem` key or `.p12` key. -- `options.key`: The raw RSA private key value, in place of using `options.keyFile`. - -### .getToken(callback) - -> Returns the cached tokens or requests a new one and returns it. - -``` js -gtoken.getToken((err, token) => { - console.log(err || token); - // gtoken.rawToken value is also set -}); -``` - -### .getCredentials('path/to/key.json') - -> Given a keyfile, returns the key and (if available) the client email. - -```js -const creds = await gtoken.getCredentials('path/to/key.json'); -``` - -### Properties - -> Various properties set on the gtoken object after call to `.getToken()`. - -- `gtoken.idToken`: The OIDC token returned (if any). -- `gtoken.accessToken`: The access token. -- `gtoken.expiresAt`: The expiry date as milliseconds since 1970/01/01 -- `gtoken.key`: The raw key value. -- `gtoken.rawToken`: Most recent raw token data received from Google. - -### .hasExpired() - -> Returns true if the token has expired, or token does not exist. - -``` js -const tokens = await gtoken.getToken(); -gtoken.hasExpired(); // false -``` - -### .revokeToken() - -> Revoke the token if set. - -``` js -await gtoken.revokeToken(); -console.log('Token revoked!'); -``` - -## Downloading your private `.p12` key from Google - -1. Open the [Google Developer Console][gdevconsole]. -2. Open your project and under "APIs & auth", click Credentials. -3. Generate a new `.p12` key and download it into your project. - -## Converting your `.p12` key to a `.pem` key - -You can just specify your `.p12` file (with `.p12` extension) as the `keyFile` and it will automatically be converted to a `.pem` on the fly, however this results in a slight performance hit. If you'd like to convert to a `.pem` for use later, use OpenSSL if you have it installed. - -``` sh -$ openssl pkcs12 -in key.p12 -nodes -nocerts > key.pem -``` - -Don't forget, the passphrase when converting these files is the string `'notasecret'` - -## License - -[MIT](https://github.com/googleapis/node-gtoken/blob/master/LICENSE) - -[codecov-image]: https://codecov.io/gh/googleapis/node-gtoken/branch/master/graph/badge.svg -[codecov-url]: https://codecov.io/gh/googleapis/node-gtoken -[gdevconsole]: https://console.developers.google.com -[gts-image]: https://img.shields.io/badge/code%20style-google-blueviolet.svg -[gts-url]: https://www.npmjs.com/package/gts -[npm-image]: https://img.shields.io/npm/v/gtoken.svg -[npm-url]: https://npmjs.org/package/gtoken -[snyk-image]: https://snyk.io/test/github/googleapis/node-gtoken/badge.svg -[snyk-url]: https://snyk.io/test/github/googleapis/node-gtoken -[client-docs]: https://googleapis.dev/nodejs/gtoken/latest/ diff --git a/node_modules/gtoken/build/src/index.d.ts b/node_modules/gtoken/build/src/index.d.ts deleted file mode 100644 index 84f3a096..00000000 --- a/node_modules/gtoken/build/src/index.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -export declare type GetTokenCallback = (err: Error | null, token?: TokenData) => void; -export interface Credentials { - privateKey: string; - clientEmail?: string; -} -export interface TokenData { - refresh_token?: string; - expires_in?: number; - access_token?: string; - token_type?: string; - id_token?: string; -} -export interface TokenOptions { - keyFile?: string; - key?: string; - email?: string; - iss?: string; - sub?: string; - scope?: string | string[]; - additionalClaims?: {}; -} -export interface GetTokenOptions { - forceRefresh?: boolean; -} -export declare class GoogleToken { - get accessToken(): string | undefined; - get idToken(): string | undefined; - get tokenType(): string | undefined; - get refreshToken(): string | undefined; - expiresAt?: number; - key?: string; - keyFile?: string; - iss?: string; - sub?: string; - scope?: string; - rawToken?: TokenData; - tokenExpires?: number; - email?: string; - additionalClaims?: {}; - /** - * Create a GoogleToken. - * - * @param options Configuration object. - */ - constructor(options?: TokenOptions); - /** - * Returns whether the token has expired. - * - * @return true if the token has expired, false otherwise. - */ - hasExpired(): boolean; - /** - * Returns a cached token or retrieves a new one from Google. - * - * @param callback The callback function. - */ - getToken(opts?: GetTokenOptions): Promise; - getToken(callback: GetTokenCallback, opts?: GetTokenOptions): void; - /** - * Given a keyFile, extract the key and client email if available - * @param keyFile Path to a json, pem, or p12 file that contains the key. - * @returns an object with privateKey and clientEmail properties - */ - getCredentials(keyFile: string): Promise; - private getTokenAsync; - private ensureEmail; - /** - * Revoke the token if one is set. - * - * @param callback The callback function. - */ - revokeToken(): Promise; - revokeToken(callback: (err?: Error) => void): void; - private revokeTokenAsync; - /** - * Configure the GoogleToken for re-use. - * @param {object} options Configuration object. - */ - private configure; - /** - * Request the token from Google. - */ - private requestToken; -} diff --git a/node_modules/gtoken/build/src/index.js b/node_modules/gtoken/build/src/index.js deleted file mode 100644 index 8f57d191..00000000 --- a/node_modules/gtoken/build/src/index.js +++ /dev/null @@ -1,235 +0,0 @@ -"use strict"; -/** - * Copyright 2018 Google LLC - * - * Distributed under MIT license. - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GoogleToken = void 0; -const fs = require("fs"); -const gaxios_1 = require("gaxios"); -const jws = require("jws"); -const mime = require("mime"); -const util_1 = require("util"); -const readFile = fs.readFile - ? util_1.promisify(fs.readFile) - : async () => { - // if running in the web-browser, fs.readFile may not have been shimmed. - throw new ErrorWithCode('use key rather than keyFile.', 'MISSING_CREDENTIALS'); - }; -const GOOGLE_TOKEN_URL = 'https://www.googleapis.com/oauth2/v4/token'; -const GOOGLE_REVOKE_TOKEN_URL = 'https://accounts.google.com/o/oauth2/revoke?token='; -class ErrorWithCode extends Error { - constructor(message, code) { - super(message); - this.code = code; - } -} -let getPem; -class GoogleToken { - /** - * Create a GoogleToken. - * - * @param options Configuration object. - */ - constructor(options) { - this.configure(options); - } - get accessToken() { - return this.rawToken ? this.rawToken.access_token : undefined; - } - get idToken() { - return this.rawToken ? this.rawToken.id_token : undefined; - } - get tokenType() { - return this.rawToken ? this.rawToken.token_type : undefined; - } - get refreshToken() { - return this.rawToken ? this.rawToken.refresh_token : undefined; - } - /** - * Returns whether the token has expired. - * - * @return true if the token has expired, false otherwise. - */ - hasExpired() { - const now = new Date().getTime(); - if (this.rawToken && this.expiresAt) { - return now >= this.expiresAt; - } - else { - return true; - } - } - getToken(callback, opts = {}) { - if (typeof callback === 'object') { - opts = callback; - callback = undefined; - } - opts = Object.assign({ - forceRefresh: false, - }, opts); - if (callback) { - const cb = callback; - this.getTokenAsync(opts).then(t => cb(null, t), callback); - return; - } - return this.getTokenAsync(opts); - } - /** - * Given a keyFile, extract the key and client email if available - * @param keyFile Path to a json, pem, or p12 file that contains the key. - * @returns an object with privateKey and clientEmail properties - */ - async getCredentials(keyFile) { - const mimeType = mime.getType(keyFile); - switch (mimeType) { - case 'application/json': { - // *.json file - const key = await readFile(keyFile, 'utf8'); - const body = JSON.parse(key); - const privateKey = body.private_key; - const clientEmail = body.client_email; - if (!privateKey || !clientEmail) { - throw new ErrorWithCode('private_key and client_email are required.', 'MISSING_CREDENTIALS'); - } - return { privateKey, clientEmail }; - } - case 'application/x-x509-ca-cert': { - // *.pem file - const privateKey = await readFile(keyFile, 'utf8'); - return { privateKey }; - } - case 'application/x-pkcs12': { - // *.p12 file - // NOTE: The loading of `google-p12-pem` is deferred for performance - // reasons. The `node-forge` npm module in `google-p12-pem` adds a fair - // bit time to overall module loading, and is likely not frequently - // used. In a future release, p12 support will be entirely removed. - if (!getPem) { - getPem = (await Promise.resolve().then(() => require('google-p12-pem'))).getPem; - } - const privateKey = await getPem(keyFile); - return { privateKey }; - } - default: - throw new ErrorWithCode('Unknown certificate type. Type is determined based on file extension. ' + - 'Current supported extensions are *.json, *.pem, and *.p12.', 'UNKNOWN_CERTIFICATE_TYPE'); - } - } - async getTokenAsync(opts) { - if (this.hasExpired() === false && opts.forceRefresh === false) { - return Promise.resolve(this.rawToken); - } - if (!this.key && !this.keyFile) { - throw new Error('No key or keyFile set.'); - } - if (!this.key && this.keyFile) { - const creds = await this.getCredentials(this.keyFile); - this.key = creds.privateKey; - this.iss = creds.clientEmail || this.iss; - if (!creds.clientEmail) { - this.ensureEmail(); - } - } - return this.requestToken(); - } - ensureEmail() { - if (!this.iss) { - throw new ErrorWithCode('email is required.', 'MISSING_CREDENTIALS'); - } - } - revokeToken(callback) { - if (callback) { - this.revokeTokenAsync().then(() => callback(), callback); - return; - } - return this.revokeTokenAsync(); - } - async revokeTokenAsync() { - if (!this.accessToken) { - throw new Error('No token to revoke.'); - } - const url = GOOGLE_REVOKE_TOKEN_URL + this.accessToken; - await gaxios_1.request({ url }); - this.configure({ - email: this.iss, - sub: this.sub, - key: this.key, - keyFile: this.keyFile, - scope: this.scope, - additionalClaims: this.additionalClaims, - }); - } - /** - * Configure the GoogleToken for re-use. - * @param {object} options Configuration object. - */ - configure(options = {}) { - this.keyFile = options.keyFile; - this.key = options.key; - this.rawToken = undefined; - this.iss = options.email || options.iss; - this.sub = options.sub; - this.additionalClaims = options.additionalClaims; - if (typeof options.scope === 'object') { - this.scope = options.scope.join(' '); - } - else { - this.scope = options.scope; - } - } - /** - * Request the token from Google. - */ - async requestToken() { - const iat = Math.floor(new Date().getTime() / 1000); - const additionalClaims = this.additionalClaims || {}; - const payload = Object.assign({ - iss: this.iss, - scope: this.scope, - aud: GOOGLE_TOKEN_URL, - exp: iat + 3600, - iat, - sub: this.sub, - }, additionalClaims); - const signedJWT = jws.sign({ - header: { alg: 'RS256' }, - payload, - secret: this.key, - }); - try { - const r = await gaxios_1.request({ - method: 'POST', - url: GOOGLE_TOKEN_URL, - data: { - grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', - assertion: signedJWT, - }, - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - responseType: 'json', - }); - this.rawToken = r.data; - this.expiresAt = - r.data.expires_in === null || r.data.expires_in === undefined - ? undefined - : (iat + r.data.expires_in) * 1000; - return this.rawToken; - } - catch (e) { - this.rawToken = undefined; - this.tokenExpires = undefined; - const body = e.response && e.response.data ? e.response.data : {}; - if (body.error) { - const desc = body.error_description - ? `: ${body.error_description}` - : ''; - e.message = `${body.error}${desc}`; - } - throw e; - } - } -} -exports.GoogleToken = GoogleToken; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/gtoken/package.json b/node_modules/gtoken/package.json deleted file mode 100644 index c8858091..00000000 --- a/node_modules/gtoken/package.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "_from": "gtoken@^5.0.4", - "_id": "gtoken@5.0.4", - "_inBundle": false, - "_integrity": "sha512-U9wnSp4GZ7ov6zRdPuRHG4TuqEWqRRgT1gfXGNArhzBUn9byrPeH8uTmBWU/ZiWJJvTEmkjhDIC3mqHWdVi3xQ==", - "_location": "/gtoken", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "gtoken@^5.0.4", - "name": "gtoken", - "escapedName": "gtoken", - "rawSpec": "^5.0.4", - "saveSpec": null, - "fetchSpec": "^5.0.4" - }, - "_requiredBy": [ - "/google-auth-library" - ], - "_resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.4.tgz", - "_shasum": "e8d7456ad2ff774c70176e56b9d34b1c63fb6f0b", - "_spec": "gtoken@^5.0.4", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "Google, LLC" - }, - "bugs": { - "url": "https://github.com/google/node-gtoken/issues" - }, - "bundleDependencies": false, - "dependencies": { - "gaxios": "^3.0.0", - "google-p12-pem": "^3.0.3", - "jws": "^4.0.0", - "mime": "^2.2.0" - }, - "deprecated": false, - "description": "Node.js Google Authentication Service Account Tokens", - "devDependencies": { - "@compodoc/compodoc": "^1.1.7", - "@microsoft/api-documenter": "^7.8.10", - "@microsoft/api-extractor": "^7.8.10", - "@types/jws": "^3.1.0", - "@types/mime": "^2.0.0", - "@types/mocha": "^8.0.0", - "@types/nock": "^10.0.0", - "@types/node": "^10.0.3", - "c8": "^7.0.0", - "codecov": "^3.0.2", - "gts": "^2.0.0", - "js-green-licenses": "^2.0.0", - "linkinator": "^2.0.0", - "mocha": "^8.0.0", - "nock": "^13.0.0", - "typescript": "^3.8.3" - }, - "engines": { - "node": ">=10" - }, - "files": [ - "build/src", - "!build/src/**/*.map" - ], - "homepage": "https://github.com/google/node-gtoken#readme", - "keywords": [ - "google", - "service", - "account", - "api", - "token", - "api", - "auth" - ], - "license": "MIT", - "main": "./build/src/index.js", - "name": "gtoken", - "repository": { - "type": "git", - "url": "git+https://github.com/google/node-gtoken.git" - }, - "scripts": { - "api-documenter": "api-documenter yaml --input-folder=temp", - "api-extractor": "api-extractor run --local", - "clean": "gts clean", - "compile": "tsc -p .", - "docs": "compodoc src/", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "precompile": "gts clean", - "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm install", - "prepare": "npm run compile", - "presystem-test": "npm run compile", - "pretest": "npm run compile", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha build/system-test", - "test": "c8 mocha build/test" - }, - "types": "./build/src/index.d.ts", - "version": "5.0.4" -} diff --git a/node_modules/http.min/README.md b/node_modules/http.min/README.md deleted file mode 100644 index fafbf5e6..00000000 --- a/node_modules/http.min/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# Minimal HTTP client library -[![NPM][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Coverage Status][coverage-image]][coverage-url] [![js-standard-style][standard-image]][standard-url] [![Dependencies][david-image]][david-url] [![devDependencies][david-dev-image]][david-dev-url] - -Minimal simple HTTP client with promises. -Supports HTTP, HTTPS and common methods GET, POST, PUT, PATCH, DELETE. -Includes timeout, query string, form data, JSON helpers. -No dependencies, under 100 SLOC. - -## Install - - npm install --save http.min - -## Examples - -### GET -```javascript -var http = require('http.min') -http('https://httpbin.org/get').then(function (result) { - console.log('Code: ' + result.response.statusCode) - console.log('Response: ' + result.data) -}) -``` - -### POST - -#### JSON -```javascript -var http = require('http.min') -http.post('https://httpbin.org/post', {data: 'hello'}).then(function (result) { - console.log('Code: ' + result.response.statusCode) - console.log('Response: ' + result.data) -}) -``` - -#### Form urlencoded -`data` parameter is a string. - -```javascript -var http = require('http.min') -http.post('https://httpbin.org/post', 'data=hello').then(function (result) { - console.log('Code: ' + result.response.statusCode) - console.log('Response: ' + result.data) -}) -``` - -### JSON -```javascript -var http = require('http.min') -http.json('https://httpbin.org/get').then(function (data) { - console.log('Response:', data.url) -}) -``` - -### Advanced - -#### Functions also accept [http.request options object][node-http-options]. - -```javascript -var http = require('http.min') -var options = { - protocol: 'https:', - hostname: 'httpbin.org', - path: '/get', - headers: { - 'User-Agent': 'Node.js http.min' - } -} -http.json(options).then(function (data) { - console.log('Response:', data) -}) -``` - -#### Helpers - -```javascript -var http = require('http.min') -var options = { - uri: 'https://httpbin.org/post', - // timeout in ms - timeout: 1000, - // query string helper - query: { - hello: 'test' - }, - // form urlencoded - form: { - test: 'ok' - }, - // handle JSON data - json: true - // send JSON data and expect JSON response - json: { - this: 'is data' - }, - request: function (req) { - // hook to manipulate request before being sent - // instace of node http.ClientRequest - req.setTimeout(2000) - req.on('upgrade', ...) - } -} -http.post(options).then(function (result) { - console.log('Code: ' + result.response.statusCode) - console.log('Response:', result.data) -}) -``` - -## License -ISC - -[npm-image]: https://img.shields.io/npm/v/http.min.svg -[npm-url]: https://www.npmjs.com/package/http.min -[travis-image]: https://img.shields.io/travis/matjaz/node-http.min/master.svg?style=flat -[travis-url]: https://travis-ci.org/matjaz/node-http.min -[coverage-image]: https://img.shields.io/coveralls/matjaz/node-http.min/master.svg?style=flat -[coverage-url]: https://coveralls.io/r/matjaz/node-http.min -[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg -[standard-url]: http://standardjs.com -[david-image]: https://img.shields.io/david/matjaz/node-http.min.svg?style=flat -[david-url]: https://david-dm.org/matjaz/node-http.min -[david-dev-image]: https://img.shields.io/david/dev/matjaz/node-http.min.svg?style=flat -[david-dev-url]: https://david-dm.org/matjaz/node-http.min#info=devDependencies -[node-http-options]: https://nodejs.org/api/http.html#http_http_request_options_callback diff --git a/node_modules/http.min/index.js b/node_modules/http.min/index.js deleted file mode 100644 index b6debd5b..00000000 --- a/node_modules/http.min/index.js +++ /dev/null @@ -1,109 +0,0 @@ -var url = require('url') -var http = require('http') -var https = require('https') -var querystring = require('querystring') - -var HTTP = {} -var METHODS = ['HEAD', 'OPTIONS', 'GET', 'PUT', 'PATCH', 'POST', 'DELETE'] - -METHODS.forEach(function (method) { - // https://nodejs.org/api/http.html#http_http_request_options_callback - HTTP[method.toLowerCase()] = function (options, data) { - var promise = new Promise(function (resolve, reject) { - if (typeof options === 'string') { - options = url.parse(options) - } else { - var query = options.query - if (options.form) { - data = querystring.stringify(options.form) - } - if (typeof options.json === 'object') { - data = options.json - } - if (options.uri) { - merge(options, url.parse(options.uri)) - } - if (query) { - if (Object.keys(query).length !== 0) { - options.path += '?' + querystring.stringify(query) - } - delete options.query - } - } - if (data) { - var isObject = typeof data === 'object' - var headers = options.headers || (options.headers = {}) - if (!headers['content-type']) { - headers['content-type'] = isObject ? 'application/json' : 'application/x-www-form-urlencoded' - } - if (options.json && !headers['accept']) { - headers['accept'] = 'application/json' - } - if (isObject) { - data = JSON.stringify(data) - } - headers['content-length'] = Buffer.byteLength(data) - } - options.method = method - var module = options.protocol.indexOf('https') === 0 ? https : http - var req = module.request(options, function (response) { - var data = '' - response.setEncoding('utf8') - response.on('data', function (chunk) { - data += chunk - }) - response.on('end', function () { - resolve({ - data: data, - response: response - }) - }) - }).on('error', reject) - if (options.timeout) { - req.setTimeout(options.timeout) - } - req.on('timeout', function () { - req.destroy() - reject(new Error('timeout')) - }) - if (data) { - req.write(data) - } - if (options.request) { - options.request(req) - } - req.end() - }) - if (options.json) { - promise = parseJSON(promise) - } - return promise - } -}) - -HTTP.json = function (options) { - return parseJSON(this.get(options)).then(function (result) { - return result.data - }) -} - -function merge (dest, src) { - for (var k in src) { - dest[k] = src[k] - } -} - -function parseJSON (promise) { - return promise.then(function (result) { - try { - result.data = JSON.parse(result.data) - return result - } catch (e) { - return Promise.reject(e) - } - }) -} - -// make http.get() default exported function -merge(HTTP.get, HTTP) -module.exports = HTTP.get diff --git a/node_modules/http.min/package.json b/node_modules/http.min/package.json deleted file mode 100644 index 153c7c3b..00000000 --- a/node_modules/http.min/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_args": [ - [ - "http.min@1.3.2", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "http.min@1.3.2", - "_id": "http.min@1.3.2", - "_inBundle": false, - "_integrity": "sha1-I833FAQnp8W+F01m96n776267Nc=", - "_location": "/http.min", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "http.min@1.3.2", - "name": "http.min", - "escapedName": "http.min", - "rawSpec": "1.3.2", - "saveSpec": null, - "fetchSpec": "1.3.2" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/http.min/-/http.min-1.3.2.tgz", - "_spec": "1.3.2", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Matjaz Lipus", - "email": "matjazl@gmail.com" - }, - "bugs": { - "url": "https://github.com/matjaz/node-http.min/issues" - }, - "description": "Minimalistic & simplistic HTTP client. No dependencies, under 100 SLOC.", - "devDependencies": { - "expect.js": "^0.3.1", - "istanbul": "^0.4.3", - "mocha": "^3.0.0", - "nock": "^9.0.0", - "standard": "^10.0.0" - }, - "homepage": "https://github.com/matjaz/node-http.min#readme", - "keywords": [ - "http", - "client", - "promise", - "simple", - "minimal" - ], - "license": "ISC", - "main": "index.js", - "name": "http.min", - "repository": { - "type": "git", - "url": "git://github.com/matjaz/node-http.min.git" - }, - "scripts": { - "coverage": "istanbul cover _mocha", - "mocha": "mocha", - "pretest": "standard", - "test": "npm run coverage --silent" - }, - "version": "1.3.2" -} diff --git a/node_modules/https-proxy-agent/.editorconfig b/node_modules/https-proxy-agent/.editorconfig deleted file mode 100644 index 12b4b9a3..00000000 --- a/node_modules/https-proxy-agent/.editorconfig +++ /dev/null @@ -1,37 +0,0 @@ -root = true - -[*] -indent_style = tab -indent_size = 4 -tab_width = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[{*.json,*.json.example,*.gyp,*.yml,*.yaml,*.workflow}] -indent_style = space -indent_size = 2 - -[{*.py,*.asm}] -indent_style = space - -[*.py] -indent_size = 4 - -[*.asm] -indent_size = 8 - -[*.md] -trim_trailing_whitespace = false - -# Ideal settings - some plugins might support these. -[*.js] -quote_type = single - -[{*.c,*.cc,*.h,*.hh,*.cpp,*.hpp,*.m,*.mm,*.mpp,*.js,*.java,*.go,*.rs,*.php,*.ng,*.jsx,*.ts,*.d,*.cs,*.swift}] -curly_bracket_next_line = false -spaces_around_operators = true -spaces_around_brackets = outside -# close enough to 1TB -indent_brace_style = K&R diff --git a/node_modules/https-proxy-agent/.eslintrc.js b/node_modules/https-proxy-agent/.eslintrc.js deleted file mode 100644 index 62743f2c..00000000 --- a/node_modules/https-proxy-agent/.eslintrc.js +++ /dev/null @@ -1,86 +0,0 @@ -module.exports = { - 'extends': [ - 'airbnb', - 'prettier' - ], - 'parser': '@typescript-eslint/parser', - 'parserOptions': { - 'ecmaVersion': 2018, - 'sourceType': 'module', - 'modules': true - }, - 'plugins': [ - '@typescript-eslint' - ], - 'settings': { - 'import/resolver': { - 'typescript': { - } - } - }, - 'rules': { - 'quotes': [ - 2, - 'single', - { - 'allowTemplateLiterals': true - } - ], - 'class-methods-use-this': 0, - 'consistent-return': 0, - 'func-names': 0, - 'global-require': 0, - 'guard-for-in': 0, - 'import/no-duplicates': 0, - 'import/no-dynamic-require': 0, - 'import/no-extraneous-dependencies': 0, - 'import/prefer-default-export': 0, - 'lines-between-class-members': 0, - 'no-await-in-loop': 0, - 'no-bitwise': 0, - 'no-console': 0, - 'no-continue': 0, - 'no-control-regex': 0, - 'no-empty': 0, - 'no-loop-func': 0, - 'no-nested-ternary': 0, - 'no-param-reassign': 0, - 'no-plusplus': 0, - 'no-restricted-globals': 0, - 'no-restricted-syntax': 0, - 'no-shadow': 0, - 'no-underscore-dangle': 0, - 'no-use-before-define': 0, - 'prefer-const': 0, - 'prefer-destructuring': 0, - 'camelcase': 0, - 'no-unused-vars': 0, // in favor of '@typescript-eslint/no-unused-vars' - // 'indent': 0 // in favor of '@typescript-eslint/indent' - '@typescript-eslint/no-unused-vars': 'warn', - // '@typescript-eslint/indent': ['error', 2] // this might conflict with a lot ongoing changes - '@typescript-eslint/no-array-constructor': 'error', - '@typescript-eslint/adjacent-overload-signatures': 'error', - '@typescript-eslint/class-name-casing': 'error', - '@typescript-eslint/interface-name-prefix': 'error', - '@typescript-eslint/no-empty-interface': 'error', - '@typescript-eslint/no-inferrable-types': 'error', - '@typescript-eslint/no-misused-new': 'error', - '@typescript-eslint/no-namespace': 'error', - '@typescript-eslint/no-non-null-assertion': 'error', - '@typescript-eslint/no-parameter-properties': 'error', - '@typescript-eslint/no-triple-slash-reference': 'error', - '@typescript-eslint/prefer-namespace-keyword': 'error', - '@typescript-eslint/type-annotation-spacing': 'error', - // '@typescript-eslint/array-type': 'error', - // '@typescript-eslint/ban-types': 'error', - // '@typescript-eslint/explicit-function-return-type': 'warn', - // '@typescript-eslint/explicit-member-accessibility': 'error', - // '@typescript-eslint/member-delimiter-style': 'error', - // '@typescript-eslint/no-angle-bracket-type-assertion': 'error', - // '@typescript-eslint/no-explicit-any': 'warn', - // '@typescript-eslint/no-object-literal-type-assertion': 'error', - // '@typescript-eslint/no-use-before-define': 'error', - // '@typescript-eslint/no-var-requires': 'error', - // '@typescript-eslint/prefer-interface': 'error' - } -} diff --git a/node_modules/https-proxy-agent/.github/workflows/test.yml b/node_modules/https-proxy-agent/.github/workflows/test.yml deleted file mode 100644 index 329914f9..00000000 --- a/node_modules/https-proxy-agent/.github/workflows/test.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Node CI - -on: - push: - branches: - - master - tags: - - '!*' - pull_request: - -jobs: - build: - name: Test Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [6.x, 8.x, 10.x, 12.x] - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v1 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Print Node.js Version - run: node --version - - - name: Install Dependencies - run: npm install - env: - CI: true - - - name: Run "build" step - run: npm run build --if-present - env: - CI: true - - - name: Run tests - run: npm test - env: - CI: true diff --git a/node_modules/https-proxy-agent/README.md b/node_modules/https-proxy-agent/README.md deleted file mode 100644 index 328656a9..00000000 --- a/node_modules/https-proxy-agent/README.md +++ /dev/null @@ -1,137 +0,0 @@ -https-proxy-agent -================ -### An HTTP(s) proxy `http.Agent` implementation for HTTPS -[![Build Status](https://github.com/TooTallNate/node-https-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-https-proxy-agent/actions?workflow=Node+CI) - -This module provides an `http.Agent` implementation that connects to a specified -HTTP or HTTPS proxy server, and can be used with the built-in `https` module. - -Specifically, this `Agent` implementation connects to an intermediary "proxy" -server and issues the [CONNECT HTTP method][CONNECT], which tells the proxy to -open a direct TCP connection to the destination server. - -Since this agent implements the CONNECT HTTP method, it also works with other -protocols that use this method when connecting over proxies (i.e. WebSockets). -See the "Examples" section below for more. - - -Installation ------------- - -Install with `npm`: - -``` bash -$ npm install https-proxy-agent -``` - - -Examples --------- - -#### `https` module example - -``` js -var url = require('url'); -var https = require('https'); -var HttpsProxyAgent = require('https-proxy-agent'); - -// HTTP/HTTPS proxy to connect to -var proxy = process.env.http_proxy || 'http://168.63.76.32:3128'; -console.log('using proxy server %j', proxy); - -// HTTPS endpoint for the proxy to connect to -var endpoint = process.argv[2] || 'https://graph.facebook.com/tootallnate'; -console.log('attempting to GET %j', endpoint); -var options = url.parse(endpoint); - -// create an instance of the `HttpsProxyAgent` class with the proxy server information -var agent = new HttpsProxyAgent(proxy); -options.agent = agent; - -https.get(options, function (res) { - console.log('"response" event!', res.headers); - res.pipe(process.stdout); -}); -``` - -#### `ws` WebSocket connection example - -``` js -var url = require('url'); -var WebSocket = require('ws'); -var HttpsProxyAgent = require('https-proxy-agent'); - -// HTTP/HTTPS proxy to connect to -var proxy = process.env.http_proxy || 'http://168.63.76.32:3128'; -console.log('using proxy server %j', proxy); - -// WebSocket endpoint for the proxy to connect to -var endpoint = process.argv[2] || 'ws://echo.websocket.org'; -var parsed = url.parse(endpoint); -console.log('attempting to connect to WebSocket %j', endpoint); - -// create an instance of the `HttpsProxyAgent` class with the proxy server information -var options = url.parse(proxy); - -var agent = new HttpsProxyAgent(options); - -// finally, initiate the WebSocket connection -var socket = new WebSocket(endpoint, { agent: agent }); - -socket.on('open', function () { - console.log('"open" event!'); - socket.send('hello world'); -}); - -socket.on('message', function (data, flags) { - console.log('"message" event! %j %j', data, flags); - socket.close(); -}); -``` - -API ---- - -### new HttpsProxyAgent(Object options) - -The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects -to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket -requests. This is achieved by using the [HTTP `CONNECT` method][CONNECT]. - -The `options` argument may either be a string URI of the proxy server to use, or an -"options" object with more specific properties: - - * `host` - String - Proxy host to connect to (may use `hostname` as well). Required. - * `port` - Number - Proxy port to connect to. Required. - * `protocol` - String - If `https:`, then use TLS to connect to the proxy. - * `headers` - Object - Additional HTTP headers to be sent on the HTTP CONNECT method. - * Any other options given are passed to the `net.connect()`/`tls.connect()` functions. - - -License -------- - -(The MIT License) - -Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> - -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. - -[CONNECT]: http://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_Tunneling diff --git a/node_modules/https-proxy-agent/index.d.ts b/node_modules/https-proxy-agent/index.d.ts deleted file mode 100644 index cec35d85..00000000 --- a/node_modules/https-proxy-agent/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module 'https-proxy-agent' { - import * as https from 'https'; - - namespace HttpsProxyAgent { - interface HttpsProxyAgentOptions { - host: string; - port: number | string; - secureProxy?: boolean; - headers?: { - [key: string]: string; - }; - [key: string]: any; - } - } - - // HttpsProxyAgent doesnt *actually* extend https.Agent, but for my purposes I want it to pretend that it does - class HttpsProxyAgent extends https.Agent { - constructor(opts: HttpsProxyAgent.HttpsProxyAgentOptions | string); - } - - export = HttpsProxyAgent; -} diff --git a/node_modules/https-proxy-agent/index.js b/node_modules/https-proxy-agent/index.js deleted file mode 100644 index aa3021e2..00000000 --- a/node_modules/https-proxy-agent/index.js +++ /dev/null @@ -1,239 +0,0 @@ -/** - * Module dependencies. - */ - -var net = require('net'); -var tls = require('tls'); -var url = require('url'); -var assert = require('assert'); -var Agent = require('agent-base'); -var inherits = require('util').inherits; -var debug = require('debug')('https-proxy-agent'); - -/** - * Module exports. - */ - -module.exports = HttpsProxyAgent; - -/** - * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to the - * specified "HTTP(s) proxy server" in order to proxy HTTPS requests. - * - * @api public - */ - -function HttpsProxyAgent(opts) { - if (!(this instanceof HttpsProxyAgent)) return new HttpsProxyAgent(opts); - if ('string' == typeof opts) opts = url.parse(opts); - if (!opts) - throw new Error( - 'an HTTP(S) proxy server `host` and `port` must be specified!' - ); - debug('creating new HttpsProxyAgent instance: %o', opts); - Agent.call(this, opts); - - var proxy = Object.assign({}, opts); - - // if `true`, then connect to the proxy server over TLS. defaults to `false`. - this.secureProxy = proxy.protocol - ? /^https:?$/i.test(proxy.protocol) - : false; - - // prefer `hostname` over `host`, and set the `port` if needed - proxy.host = proxy.hostname || proxy.host; - proxy.port = +proxy.port || (this.secureProxy ? 443 : 80); - - // ALPN is supported by Node.js >= v5. - // attempt to negotiate http/1.1 for proxy servers that support http/2 - if (this.secureProxy && !('ALPNProtocols' in proxy)) { - proxy.ALPNProtocols = ['http 1.1']; - } - - if (proxy.host && proxy.path) { - // if both a `host` and `path` are specified then it's most likely the - // result of a `url.parse()` call... we need to remove the `path` portion so - // that `net.connect()` doesn't attempt to open that as a unix socket file. - delete proxy.path; - delete proxy.pathname; - } - - this.proxy = proxy; -} -inherits(HttpsProxyAgent, Agent); - -/** - * Called when the node-core HTTP client library is creating a new HTTP request. - * - * @api public - */ - -HttpsProxyAgent.prototype.callback = function connect(req, opts, fn) { - var proxy = this.proxy; - - // create a socket connection to the proxy server - var socket; - if (this.secureProxy) { - socket = tls.connect(proxy); - } else { - socket = net.connect(proxy); - } - - // we need to buffer any HTTP traffic that happens with the proxy before we get - // the CONNECT response, so that if the response is anything other than an "200" - // response code, then we can re-play the "data" events on the socket once the - // HTTP parser is hooked up... - var buffers = []; - var buffersLength = 0; - - function read() { - var b = socket.read(); - if (b) ondata(b); - else socket.once('readable', read); - } - - function cleanup() { - socket.removeListener('end', onend); - socket.removeListener('error', onerror); - socket.removeListener('close', onclose); - socket.removeListener('readable', read); - } - - function onclose(err) { - debug('onclose had error %o', err); - } - - function onend() { - debug('onend'); - } - - function onerror(err) { - cleanup(); - fn(err); - } - - function ondata(b) { - buffers.push(b); - buffersLength += b.length; - var buffered = Buffer.concat(buffers, buffersLength); - var str = buffered.toString('ascii'); - - if (!~str.indexOf('\r\n\r\n')) { - // keep buffering - debug('have not received end of HTTP headers yet...'); - read(); - return; - } - - var firstLine = str.substring(0, str.indexOf('\r\n')); - var statusCode = +firstLine.split(' ')[1]; - debug('got proxy server response: %o', firstLine); - - if (200 == statusCode) { - // 200 Connected status code! - var sock = socket; - - // nullify the buffered data since we won't be needing it - buffers = buffered = null; - - if (opts.secureEndpoint) { - // since the proxy is connecting to an SSL server, we have - // to upgrade this socket connection to an SSL connection - debug( - 'upgrading proxy-connected socket to TLS connection: %o', - opts.host - ); - opts.socket = socket; - opts.servername = opts.servername || opts.host; - opts.host = null; - opts.hostname = null; - opts.port = null; - sock = tls.connect(opts); - } - - cleanup(); - req.once('socket', resume); - fn(null, sock); - } else { - // some other status code that's not 200... need to re-play the HTTP header - // "data" events onto the socket once the HTTP machinery is attached so - // that the node core `http` can parse and handle the error status code - cleanup(); - - // the original socket is closed, and a new closed socket is - // returned instead, so that the proxy doesn't get the HTTP request - // written to it (which may contain `Authorization` headers or other - // sensitive data). - // - // See: https://hackerone.com/reports/541502 - socket.destroy(); - socket = new net.Socket(); - socket.readable = true; - - // save a reference to the concat'd Buffer for the `onsocket` callback - buffers = buffered; - - // need to wait for the "socket" event to re-play the "data" events - req.once('socket', onsocket); - - fn(null, socket); - } - } - - function onsocket(socket) { - debug('replaying proxy buffer for failed request'); - assert(socket.listenerCount('data') > 0); - - // replay the "buffers" Buffer onto the `socket`, since at this point - // the HTTP module machinery has been hooked up for the user - socket.push(buffers); - - // nullify the cached Buffer instance - buffers = null; - } - - socket.on('error', onerror); - socket.on('close', onclose); - socket.on('end', onend); - - read(); - - var hostname = opts.host + ':' + opts.port; - var msg = 'CONNECT ' + hostname + ' HTTP/1.1\r\n'; - - var headers = Object.assign({}, proxy.headers); - if (proxy.auth) { - headers['Proxy-Authorization'] = - 'Basic ' + Buffer.from(proxy.auth).toString('base64'); - } - - // the Host header should only include the port - // number when it is a non-standard port - var host = opts.host; - if (!isDefaultPort(opts.port, opts.secureEndpoint)) { - host += ':' + opts.port; - } - headers['Host'] = host; - - headers['Connection'] = 'close'; - Object.keys(headers).forEach(function(name) { - msg += name + ': ' + headers[name] + '\r\n'; - }); - - socket.write(msg + '\r\n'); -}; - -/** - * Resumes a socket. - * - * @param {(net.Socket|tls.Socket)} socket The socket to resume - * @api public - */ - -function resume(socket) { - socket.resume(); -} - -function isDefaultPort(port, secure) { - return Boolean((!secure && port === 80) || (secure && port === 443)); -} diff --git a/node_modules/https-proxy-agent/package.json b/node_modules/https-proxy-agent/package.json deleted file mode 100644 index 66ea06a4..00000000 --- a/node_modules/https-proxy-agent/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_from": "https-proxy-agent@^4.0.0", - "_id": "https-proxy-agent@4.0.0", - "_inBundle": false, - "_integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", - "_location": "/https-proxy-agent", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "https-proxy-agent@^4.0.0", - "name": "https-proxy-agent", - "escapedName": "https-proxy-agent", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "_shasum": "702b71fb5520a132a66de1f67541d9e62154d82b", - "_spec": "https-proxy-agent@^4.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "bugs": { - "url": "https://github.com/TooTallNate/node-https-proxy-agent/issues" - }, - "bundleDependencies": false, - "dependencies": { - "agent-base": "5", - "debug": "4" - }, - "deprecated": false, - "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", - "devDependencies": { - "mocha": "6", - "proxy": "1" - }, - "engines": { - "node": ">= 6.0.0" - }, - "homepage": "https://github.com/TooTallNate/node-https-proxy-agent#readme", - "keywords": [ - "https", - "proxy", - "endpoint", - "agent" - ], - "license": "MIT", - "main": "./index.js", - "name": "https-proxy-agent", - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-https-proxy-agent.git" - }, - "scripts": { - "test": "mocha --reporter spec" - }, - "types": "./index.d.ts", - "version": "4.0.0" -} diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013d..00000000 --- a/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. - diff --git a/node_modules/inherits/README.md b/node_modules/inherits/README.md deleted file mode 100644 index b1c56658..00000000 --- a/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js deleted file mode 100644 index f71f2d93..00000000 --- a/node_modules/inherits/inherits.js +++ /dev/null @@ -1,9 +0,0 @@ -try { - var util = require('util'); - /* istanbul ignore next */ - if (typeof util.inherits !== 'function') throw ''; - module.exports = util.inherits; -} catch (e) { - /* istanbul ignore next */ - module.exports = require('./inherits_browser.js'); -} diff --git a/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js deleted file mode 100644 index 86bbb3dc..00000000 --- a/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,27 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json deleted file mode 100644 index 84c877ee..00000000 --- a/node_modules/inherits/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "inherits@^2.0.3", - "_id": "inherits@2.0.4", - "_inBundle": false, - "_integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "_location": "/inherits", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "inherits@^2.0.3", - "name": "inherits", - "escapedName": "inherits", - "rawSpec": "^2.0.3", - "saveSpec": null, - "fetchSpec": "^2.0.3" - }, - "_requiredBy": [ - "/concat-stream", - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "_shasum": "0fa2c64f932917c3433a0ded55363aae37416b7c", - "_spec": "inherits@^2.0.3", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/concat-stream", - "browser": "./inherits_browser.js", - "bugs": { - "url": "https://github.com/isaacs/inherits/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "devDependencies": { - "tap": "^14.2.4" - }, - "files": [ - "inherits.js", - "inherits_browser.js" - ], - "homepage": "https://github.com/isaacs/inherits#readme", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "license": "ISC", - "main": "./inherits.js", - "name": "inherits", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inherits.git" - }, - "scripts": { - "test": "tap" - }, - "version": "2.0.4" -} diff --git a/node_modules/is-stream/index.d.ts b/node_modules/is-stream/index.d.ts deleted file mode 100644 index b61027f1..00000000 --- a/node_modules/is-stream/index.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/// -import * as stream from 'stream'; - -declare const isStream: { - /** - @returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream). - - @example - ``` - import * as fs from 'fs'; - import isStream = require('is-stream'); - - isStream(fs.createReadStream('unicorn.png')); - //=> true - - isStream({}); - //=> false - ``` - */ - (stream: unknown): stream is stream.Stream; - - /** - @returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable). - - @example - ``` - import * as fs from 'fs'; - import isStream = require('is-stream'); - - isStream.writable(fs.createWriteStrem('unicorn.txt')); - //=> true - ``` - */ - writable(stream: unknown): stream is stream.Writable; - - /** - @returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable). - - @example - ``` - import * as fs from 'fs'; - import isStream = require('is-stream'); - - isStream.readable(fs.createReadStream('unicorn.png')); - //=> true - ``` - */ - readable(stream: unknown): stream is stream.Readable; - - /** - @returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex). - - @example - ``` - import {Duplex} from 'stream'; - import isStream = require('is-stream'); - - isStream.duplex(new Duplex()); - //=> true - ``` - */ - duplex(stream: unknown): stream is stream.Duplex; - - /** - @returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform). - - @example - ``` - import * as fs from 'fs'; - import Stringify = require('streaming-json-stringify'); - import isStream = require('is-stream'); - - isStream.transform(Stringify()); - //=> true - ``` - */ - transform(input: unknown): input is stream.Transform; -}; - -export = isStream; diff --git a/node_modules/is-stream/index.js b/node_modules/is-stream/index.js deleted file mode 100644 index a8d571f1..00000000 --- a/node_modules/is-stream/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const isStream = stream => - stream !== null && - typeof stream === 'object' && - typeof stream.pipe === 'function'; - -isStream.writable = stream => - isStream(stream) && - stream.writable !== false && - typeof stream._write === 'function' && - typeof stream._writableState === 'object'; - -isStream.readable = stream => - isStream(stream) && - stream.readable !== false && - typeof stream._read === 'function' && - typeof stream._readableState === 'object'; - -isStream.duplex = stream => - isStream.writable(stream) && - isStream.readable(stream); - -isStream.transform = stream => - isStream.duplex(stream) && - typeof stream._transform === 'function' && - typeof stream._transformState === 'object'; - -module.exports = isStream; diff --git a/node_modules/is-stream/license b/node_modules/is-stream/license deleted file mode 100644 index e7af2f77..00000000 --- a/node_modules/is-stream/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/is-stream/package.json b/node_modules/is-stream/package.json deleted file mode 100644 index 72c1f3e4..00000000 --- a/node_modules/is-stream/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_from": "is-stream@^2.0.0", - "_id": "is-stream@2.0.0", - "_inBundle": false, - "_integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "_location": "/is-stream", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "is-stream@^2.0.0", - "name": "is-stream", - "escapedName": "is-stream", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/gaxios" - ], - "_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "_shasum": "bde9c32680d6fae04129d6ac9d921ce7815f78e3", - "_spec": "is-stream@^2.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gaxios", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/is-stream/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Check if something is a Node.js stream", - "devDependencies": { - "@types/node": "^11.13.6", - "ava": "^1.4.1", - "tempy": "^0.3.0", - "tsd": "^0.7.2", - "xo": "^0.24.0" - }, - "engines": { - "node": ">=8" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "homepage": "https://github.com/sindresorhus/is-stream#readme", - "keywords": [ - "stream", - "type", - "streams", - "writable", - "readable", - "duplex", - "transform", - "check", - "detect", - "is" - ], - "license": "MIT", - "name": "is-stream", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/is-stream.git" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "version": "2.0.0" -} diff --git a/node_modules/is-stream/readme.md b/node_modules/is-stream/readme.md deleted file mode 100644 index fdeadb9f..00000000 --- a/node_modules/is-stream/readme.md +++ /dev/null @@ -1,57 +0,0 @@ -# is-stream [![Build Status](https://travis-ci.org/sindresorhus/is-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/is-stream) - -> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html) - - -## Install - -``` -$ npm install is-stream -``` - - -## Usage - -```js -const fs = require('fs'); -const isStream = require('is-stream'); - -isStream(fs.createReadStream('unicorn.png')); -//=> true - -isStream({}); -//=> false -``` - - -## API - -### isStream(stream) - -Returns a `boolean` for whether it's a [`Stream`](https://nodejs.org/api/stream.html#stream_stream). - -#### isStream.writable(stream) - -Returns a `boolean` for whether it's a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable). - -#### isStream.readable(stream) - -Returns a `boolean` for whether it's a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable). - -#### isStream.duplex(stream) - -Returns a `boolean` for whether it's a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex). - -#### isStream.transform(stream) - -Returns a `boolean` for whether it's a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform). - - -## Related - -- [is-file-stream](https://github.com/jamestalmage/is-file-stream) - Detect if a stream is a file stream - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/iterall/LICENSE b/node_modules/iterall/LICENSE deleted file mode 100644 index 32653d22..00000000 --- a/node_modules/iterall/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (c) 2016 Lee Byron - -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. diff --git a/node_modules/iterall/README.md b/node_modules/iterall/README.md deleted file mode 100644 index 92e1d1b2..00000000 --- a/node_modules/iterall/README.md +++ /dev/null @@ -1,838 +0,0 @@ -# JavaScript [Iterators][] and [AsyncIterators][] for all! - -[![Build Status](https://travis-ci.org/leebyron/iterall.svg?branch=master)](https://travis-ci.org/leebyron/iterall) [![Coverage Status](https://coveralls.io/repos/github/leebyron/iterall/badge.svg?branch=master)](https://coveralls.io/github/leebyron/iterall?branch=master) ![710 bytes minified and gzipped](https://img.shields.io/badge/min%20gzip%20size-757%20B-blue.svg) - -`iterall` provides a few crucial utilities for implementing and working with -[Iterables][iterators], [Async Iterables][asynciterators] and -[Array-likes][array-like] in all JavaScript environments, even old versions of -Internet Explorer, in a tiny library weighing well under 1KB when minified -and gzipped. - -This is a library for libraries. If your library takes Arrays as input, accept -Iterables instead. If your library implements a new data-structure, make -it Iterable. - -When installed via `npm`, `iterall` comes complete with [Flow][] and -[TypeScript][] definition files. Don't want to take the dependency? Feel free to -copy code directly from this repository. - -```js -// Limited to only Arrays 😥 -if (Array.isArray(thing)) { - thing.forEach(function (item, i) { - console.log('Index: ' + i, item) - }) -} - -// Accepts all Iterables and Array-likes, in any JavaScript environment! 🎉 -var isCollection = require('iterall').isCollection -var forEach = require('iterall').forEach - -if (isCollection(thing)) { - forEach(thing, function (item, i) { - console.log('Index: ' + i, item) - }) -} - -// Accepts all AsyncIterators, in any JavaScript environment! ⏳ -var forAwaitEach = require('iterall').forAwaitEach - -forAwaitEach(thing, function (item, i) { - console.log('Index: ' + i, item) -}).then(function () { - console.log('Done') -}) -``` - -## Why use Iterators? - -For most of JavaScript's history it has provided two collection data-structures: -the `Object` and the `Array`. These collections can conceptually describe nearly -all data and so it's no suprise that libraries expecting lists of -things standardized on expecting and checking for an Array. This pattern even -resulted in the addition of a new method in ES5: [`Array.isArray()`][isarray]. - -As JavaScript applications grew in complexity, moved to the [server][nodejs] -where CPU is a constrained resource, faced new problems and implemented new -algorithms, new data-structures are often required. With options from -[linked lists][linked list] to [HAMTs][hamt] developers can use what is most -efficient and provides the right properties for their program. - -However none of these new data-structures can be used in libraries where an -`Array` is expected, which means developers are often stuck between abandoning -their favorite libraries or limiting their data-structure choices at the cost of -efficiency or usefulness. - -To enable many related data-structures to be used interchangably we need a -_[protocol][]_, and luckily for us ES2015 introduced the -[Iteration Protocols][iterators] to describe all list-like data-structures which -can be iterated. That includes not just the new-to-ES2015 [Map][] and [Set][] -collections but also existing ones like [arguments][], [NodeList][] and the -various [TypedArray][], all of which return `false` for [`Array.isArray()`][isarray] -and in ES2015 implement the [Iterator protocol][iterators]. - -While Iterators are defined in ES2015, they _do not require_ ES2015 to work -correctly. In fact, Iterators were first introduced in 2012 in [Firefox v17](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#Iterator_property_and_iterator_symbol). Rather than using [`Symbol.iterator`][symbol.iterator], they used the property name `"@@iterator"` (in fact, the ECMAScript -spec still refers to well-known `Symbols` using this `@@` shorthand). By falling -back to use `"@@iterator"` when `Symbol.iterator` is not defined, Iterators can -be both safely defined and used by _any version of JavaScript_. - -Not only were Iterables defined in ES2015, they were also implemented by the -built-in data-structures including [Array][array#@@iterator]. Older JavaScript -environments do not implement `Array.prototype[@@iterator]()`, however this is -only a minor problem. JavaScript has another related and much older protocol: -[Array-like]. A value is "Array-like" if it has a numeric `length` property and -indexed access, but does not necessarily have methods like `.push()` or `.forEach()`. -Much like [`Array.from`][array.from], `iterall`'s `forEach()` and -`createIterator()` methods also accept collections which are not Iterable but -are Array-like. This means that `iterall` can be used with [Array][], -[arguments][], [NodeList][], [TypedArray][] and other Array-like collections -regardless of the JavaScript environment. - -When libraries only accept Arrays as input, they stick developers with a tough -choice: limit which data-structures can be used or limit the ability to use that -library. Accepting Iterables removes this false dichotomy, and allows libraries -to be more generally useful. There's no need to limit to ES2015 environments and -bleeding-edge browsers to accept `Iterable`. - -Only using Arrays can limit the efficiency and usefulness of your application -code, but custom data-structures can often feel like a fish out of water in -JavaScript programs, only working with code written specifically for it. -Protocols like `Iterable` helps these new data-structures work with more -libraries and built-in JavaScript behavior. There's no need to limit to ES2015 -environments and bleeding-edge browsers to implement `Iterable`. - -## Why use AsyncIterators? - -In the same way that `Iterator` provides a common interface for accessing many -different kinds of data-structures, `AsyncIterator` provides a common interface -over an asynchronous sequence of values (similar to Stream or Observable). - -Async Iterators are not yet an official part of JavaScript, however they're -a "Stage 3" proposal to be added, and browser vendors are -[working on adding support](https://bugs.chromium.org/p/v8/issues/detail?id=5855). -However, Async Iterators can be both safely defined and used today by -_any version of JavaScript_, by using the utilities in `iterall`. - -## FAQ - -> Aren't Iterables slower than Arrays? I want the highest performance possible. - -Arrays _are_ Iterables. Iterable is a protocol that Arrays adhere to in ES2015. -It's true that creating an Iterator and stepping through it can present some -overhead compared to a simple for-loop or `array.forEach`. However `iterall`'s -`forEach` will delegate directly to `array.forEach` and will use a for-loop for -Array-like objects, ensuring the best performance for Arrays while still -maintaining support for all Iterables. - -> Should my library functions also return Iterables instead of Arrays? Won't -> that be limiting? - -That could definitely be limiting if you return some generic Iterable where you -could have returned an Array, and (depending on context) I wouldn't recommend -you stop returning Arrays from functions if that's what you're doing today. -However if your functions are returning some collection data-structure that is -_not_ an Array, you should certainly consider having them implement the -Iterable protocol so they can be more widely useful. - -Here are a few examples: - -In [React][], render functions are expected to return view trees, where any -node (e.g. a `
    `) can have many children (e.g. many `
  • `). While it could -expect those children to always be represented as an Array, that would limit -React's usefulness - other data-structures couldn't be used. Instead, React -expects those children to be represented as an _Iterable_. That allows it to -continue to accept Arrays, but also accept many other data-structures. - -[Immutable.js][] implements many new kinds of data-structures (including [HAMT]) -all of which implement _Iterable_, which allows them to be used in many of -JavaScript's built-in functions, but also allows them to be used by many -libraries which accept Iterables, including React. Also, similar to -[`Array.from`][array.from], Immutable.js's constructors accept not only Arrays, -but any _Iterable_, allowing you to build any of these new data-structures from -any other data-structure. - -> Where are all the other functions like `map`, `filter`, and `reduce`? - -Those "higher order" collection functions are awesome, but they don't belong in -this library. Instead this library should be used as a basis for building such -a library (as it should be used for many other libraries). The `forEach` -function provided by `iterall` can be used as the underpinning for these. - -As an example: - -```js -function reduce (collection, reducer, initial) { - var reduced = initial - forEach(collection, function (item) { - reduced = reducer(reduced, item) - }) - return reduced -} -``` - -> How do I break out of a `forEach` or `forAwaitEach` loop early? - -While `for of` and `for await of` loops allow breaking out of a loop early with -a `break` statement, the `forEach()` and `forAwaitEach()` functions (much like -Array's `forEach`) do not support early breaking. - -Similar to the "higher order" functions described above, this library can be the -basis for this extended behavior. To support early break outs, you can use a -wrapping function supporting early breaking by throwing a `BREAK` sentinel value -from the callback and using a try/catch block to early break: - -```js -const BREAK = {} - -function forEachBreakable (collection, callback) { - try { - forEach(collection, callback) - } catch (error) { - if (error !== BREAK) { - throw error - } - } -} - -async function forAwaitEachBreakable (collection, callback) { - try { - await forAwaitEach(collection, callback) - } catch (error) { - if (error !== BREAK) { - throw error - } - } -} - -// Example usages: -forEachBreakable(obj, function (value) { - if (shouldBreakOn(value)) { - throw BREAK - } - console.log(value) -}) - -forAwaitEachBreakable(obj, async function (value) { - if (await shouldBreakOn(value)) { - throw BREAK - } - console.log(value) -}) -``` - -Note: This technique also works with the native Array `forEach` method! - - - -## API - - - -#### Table of Contents - -- [Iterable](#iterable) -- [Iterator](#iterator) -- [$$iterator](#iterator-1) - - [Examples](#examples) -- [isIterable](#isiterable) - - [Parameters](#parameters) - - [Examples](#examples-1) -- [isArrayLike](#isarraylike) - - [Parameters](#parameters-1) - - [Examples](#examples-2) -- [isCollection](#iscollection) - - [Parameters](#parameters-2) - - [Examples](#examples-3) -- [getIterator](#getiterator) - - [Parameters](#parameters-3) - - [Examples](#examples-4) -- [getIteratorMethod](#getiteratormethod) - - [Parameters](#parameters-4) - - [Examples](#examples-5) -- [createIterator](#createiterator) - - [Parameters](#parameters-5) - - [Examples](#examples-6) -- [forEach](#foreach) - - [Parameters](#parameters-6) - - [Examples](#examples-7) -- [AsyncIterable](#asynciterable) -- [AsyncIterator](#asynciterator) -- [$$asyncIterator](#asynciterator-1) - - [Examples](#examples-8) -- [isAsyncIterable](#isasynciterable) - - [Parameters](#parameters-7) - - [Examples](#examples-9) -- [getAsyncIterator](#getasynciterator) - - [Parameters](#parameters-8) - - [Examples](#examples-10) -- [getAsyncIteratorMethod](#getasynciteratormethod) - - [Parameters](#parameters-9) - - [Examples](#examples-11) -- [createAsyncIterator](#createasynciterator) - - [Parameters](#parameters-10) - - [Examples](#examples-12) -- [forAwaitEach](#forawaiteach) - - [Parameters](#parameters-11) - - [Examples](#examples-13) - -### Iterable - -- **See: [MDN Iteration protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable)** - -[Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable) -is a _protocol_ which when implemented allows a JavaScript object to define -their iteration behavior, such as what values are looped over in a -[`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) -loop or `iterall`'s `forEach` function. Many [built-in types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#Builtin_iterables) -implement the Iterable protocol, including `Array` and `Map`. - -While described by the [ES2015 version of JavaScript](http://www.ecma-international.org/ecma-262/6.0/#sec-iterable-interface) -it can be utilized by any version of JavaScript. - -### Iterator - -- **See: [MDN Iteration protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator)** - -[Iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator) -is a _protocol_ which describes a standard way to produce a sequence of -values, typically the values of the Iterable represented by this Iterator. - -While described by the [ES2015 version of JavaScript](http://www.ecma-international.org/ecma-262/6.0/#sec-iterator-interface) -it can be utilized by any version of JavaScript. - -### $$iterator - -A property name to be used as the name of an Iterable's method responsible -for producing an Iterator, referred to as `@@iterator`. Typically represents -the value `Symbol.iterator` but falls back to the string `"@@iterator"` when -`Symbol.iterator` is not defined. - -Use `$$iterator` for defining new Iterables instead of `Symbol.iterator`, -but do not use it for accessing existing Iterables, instead use -[getIterator](#getiterator) or [isIterable](#isiterable). - -Type: ([Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol) \| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)) - -#### Examples - -```javascript -var $$iterator = require('iterall').$$iterator - -function Counter (to) { - this.to = to -} - -Counter.prototype[$$iterator] = function () { - return { - to: this.to, - num: 0, - next () { - if (this.num >= this.to) { - return { value: undefined, done: true } - } - return { value: this.num++, done: false } - } - } -} - -var counter = new Counter(3) -for (var number of counter) { - console.log(number) // 0 ... 1 ... 2 -} -``` - -### isIterable - -Returns true if the provided object implements the Iterator protocol via -either implementing a `Symbol.iterator` or `"@@iterator"` method. - -#### Parameters - -- `obj` A value which might implement the Iterable protocol. - -#### Examples - -```javascript -var isIterable = require('iterall').isIterable -isIterable([ 1, 2, 3 ]) // true -isIterable('ABC') // true -isIterable({ length: 1, 0: 'Alpha' }) // false -isIterable({ key: 'value' }) // false -isIterable(new Map()) // true -``` - -Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if Iterable. - -### isArrayLike - -Returns true if the provided object implements the Array-like protocol via -defining a positive-integer `length` property. - -#### Parameters - -- `obj` A value which might implement the Array-like protocol. - -#### Examples - -```javascript -var isArrayLike = require('iterall').isArrayLike -isArrayLike([ 1, 2, 3 ]) // true -isArrayLike('ABC') // true -isArrayLike({ length: 1, 0: 'Alpha' }) // true -isArrayLike({ key: 'value' }) // false -isArrayLike(new Map()) // false -``` - -Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if Array-like. - -### isCollection - -Returns true if the provided object is an Object (i.e. not a string literal) -and is either Iterable or Array-like. - -This may be used in place of [Array.isArray()][isarray] to determine if an -object should be iterated-over. It always excludes string literals and -includes Arrays (regardless of if it is Iterable). It also includes other -Array-like objects such as NodeList, TypedArray, and Buffer. - -#### Parameters - -- `obj` An Object value which might implement the Iterable or Array-like protocols. - -#### Examples - -```javascript -var isCollection = require('iterall').isCollection -isCollection([ 1, 2, 3 ]) // true -isCollection('ABC') // false -isCollection({ length: 1, 0: 'Alpha' }) // true -isCollection({ key: 'value' }) // false -isCollection(new Map()) // true -``` - -```javascript -var forEach = require('iterall').forEach -if (isCollection(obj)) { - forEach(obj, function (value) { - console.log(value) - }) -} -``` - -Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if Iterable or Array-like Object. - -### getIterator - -If the provided object implements the Iterator protocol, its Iterator object -is returned. Otherwise returns undefined. - -#### Parameters - -- `iterable` **[Iterable](#iterable)<T>** An Iterable object which is the source of an Iterator. - -#### Examples - -```javascript -var getIterator = require('iterall').getIterator -var iterator = getIterator([ 1, 2, 3 ]) -iterator.next() // { value: 1, done: false } -iterator.next() // { value: 2, done: false } -iterator.next() // { value: 3, done: false } -iterator.next() // { value: undefined, done: true } -``` - -Returns **[Iterator](#iterator)<T>** new Iterator instance. - -### getIteratorMethod - -If the provided object implements the Iterator protocol, the method -responsible for producing its Iterator object is returned. - -This is used in rare cases for performance tuning. This method must be called -with obj as the contextual this-argument. - -#### Parameters - -- `iterable` **[Iterable](#iterable)<T>** An Iterable object which defines an `@@iterator` method. - -#### Examples - -```javascript -var getIteratorMethod = require('iterall').getIteratorMethod -var myArray = [ 1, 2, 3 ] -var method = getIteratorMethod(myArray) -if (method) { - var iterator = method.call(myArray) -} -``` - -Returns **function (): [Iterator](#iterator)<T>** `@@iterator` method. - -### createIterator - -Similar to [getIterator](#getiterator), this method returns a new Iterator given an -Iterable. However it will also create an Iterator for a non-Iterable -Array-like collection, such as Array in a non-ES2015 environment. - -`createIterator` is complimentary to `forEach`, but allows a "pull"-based -iteration as opposed to `forEach`'s "push"-based iteration. - -`createIterator` produces an Iterator for Array-likes with the same behavior -as ArrayIteratorPrototype described in the ECMAScript specification, and -does _not_ skip over "holes". - -#### Parameters - -- `collection` **([Iterable](#iterable)<T> | {length: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)})** An Iterable or Array-like object to produce an Iterator. - -#### Examples - -```javascript -var createIterator = require('iterall').createIterator - -var myArraylike = { length: 3, 0: 'Alpha', 1: 'Bravo', 2: 'Charlie' } -var iterator = createIterator(myArraylike) -iterator.next() // { value: 'Alpha', done: false } -iterator.next() // { value: 'Bravo', done: false } -iterator.next() // { value: 'Charlie', done: false } -iterator.next() // { value: undefined, done: true } -``` - -Returns **[Iterator](#iterator)<T>** new Iterator instance. - -### forEach - -Given an object which either implements the Iterable protocol or is -Array-like, iterate over it, calling the `callback` at each iteration. - -Use `forEach` where you would expect to use a `for ... of` loop in ES6. -However `forEach` adheres to the behavior of [Array#forEach][] described in -the ECMAScript specification, skipping over "holes" in Array-likes. It will -also delegate to a `forEach` method on `collection` if one is defined, -ensuring native performance for `Arrays`. - -Similar to [Array#forEach][], the `callback` function accepts three -arguments, and is provided with `thisArg` as the calling context. - -Note: providing an infinite Iterator to forEach will produce an error. - -[array#foreach]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach - -#### Parameters - -- `collection` **([Iterable](#iterable)<T> | {length: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)})** The Iterable or array to iterate over. -- `callback` **function (T, [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Function to execute for each iteration, taking up to three arguments -- `thisArg` Optional. Value to use as `this` when executing `callback`. - -#### Examples - -```javascript -var forEach = require('iterall').forEach - -forEach(myIterable, function (value, index, iterable) { - console.log(value, index, iterable === myIterable) -}) -``` - -```javascript -// ES6: -for (let value of myIterable) { - console.log(value) -} - -// Any JavaScript environment: -forEach(myIterable, function (value) { - console.log(value) -}) -``` - -### AsyncIterable - -- **See: [Async Iteration Proposal](https://tc39.github.io/proposal-async-iteration/#sec-asynciterable-interface)** - -[AsyncIterable](https://tc39.github.io/proposal-async-iteration/#sec-asynciterable-interface) -is a _protocol_ which when implemented allows a JavaScript object to define -an asynchronous iteration behavior, such as what values are looped over in -a [`for-await-of`](https://tc39.github.io/proposal-async-iteration/#sec-for-in-and-for-of-statements) -loop or `iterall`'s [forAwaitEach](#forawaiteach) function. - -While described as a proposed addition to the [ES2017 version of JavaScript](https://tc39.github.io/proposal-async-iteration/) -it can be utilized by any version of JavaScript. - -### AsyncIterator - -- **See: [Async Iteration Proposal](https://tc39.github.io/proposal-async-iteration/#sec-asynciterator-interface)** - -[AsyncIterator](https://tc39.github.io/proposal-async-iteration/#sec-asynciterator-interface) -is a _protocol_ which describes a standard way to produce and consume an -asynchronous sequence of values, typically the values of the -[AsyncIterable](#asynciterable) represented by this [AsyncIterator](#asynciterator). - -AsyncIterator is similar to Observable or Stream. Like an [Iterator](#iterator) it -also as a `next()` method, however instead of an IteratorResult, -calling this method returns a [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) for a IteratorResult. - -While described as a proposed addition to the [ES2017 version of JavaScript](https://tc39.github.io/proposal-async-iteration/) -it can be utilized by any version of JavaScript. - -### $$asyncIterator - -A property name to be used as the name of an AsyncIterable's method -responsible for producing an Iterator, referred to as `@@asyncIterator`. -Typically represents the value `Symbol.asyncIterator` but falls back to the -string `"@@asyncIterator"` when `Symbol.asyncIterator` is not defined. - -Use `$$asyncIterator` for defining new AsyncIterables instead of -`Symbol.asyncIterator`, but do not use it for accessing existing Iterables, -instead use [getAsyncIterator](#getasynciterator) or [isAsyncIterable](#isasynciterable). - -Type: ([Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol) \| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)) - -#### Examples - -```javascript -var $$asyncIterator = require('iterall').$$asyncIterator - -function Chirper (to) { - this.to = to -} - -Chirper.prototype[$$asyncIterator] = function () { - return { - to: this.to, - num: 0, - next () { - return new Promise(resolve => { - if (this.num >= this.to) { - resolve({ value: undefined, done: true }) - } else { - setTimeout(() => { - resolve({ value: this.num++, done: false }) - }, 1000) - } - }) - } - } -} - -var chirper = new Chirper(3) -for await (var number of chirper) { - console.log(number) // 0 ...wait... 1 ...wait... 2 -} -``` - -### isAsyncIterable - -Returns true if the provided object implements the AsyncIterator protocol via -either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method. - -#### Parameters - -- `obj` A value which might implement the AsyncIterable protocol. - -#### Examples - -```javascript -var isAsyncIterable = require('iterall').isAsyncIterable -isAsyncIterable(myStream) // true -isAsyncIterable('ABC') // false -``` - -Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if AsyncIterable. - -### getAsyncIterator - -If the provided object implements the AsyncIterator protocol, its -AsyncIterator object is returned. Otherwise returns undefined. - -#### Parameters - -- `asyncIterable` **[AsyncIterable](#asynciterable)<T>** An AsyncIterable object which is the source of an AsyncIterator. - -#### Examples - -```javascript -var getAsyncIterator = require('iterall').getAsyncIterator -var asyncIterator = getAsyncIterator(myStream) -asyncIterator.next().then(console.log) // { value: 1, done: false } -asyncIterator.next().then(console.log) // { value: 2, done: false } -asyncIterator.next().then(console.log) // { value: 3, done: false } -asyncIterator.next().then(console.log) // { value: undefined, done: true } -``` - -Returns **[AsyncIterator](#asynciterator)<T>** new AsyncIterator instance. - -### getAsyncIteratorMethod - -If the provided object implements the AsyncIterator protocol, the method -responsible for producing its AsyncIterator object is returned. - -This is used in rare cases for performance tuning. This method must be called -with obj as the contextual this-argument. - -#### Parameters - -- `asyncIterable` **[AsyncIterable](#asynciterable)<T>** An AsyncIterable object which defines an `@@asyncIterator` method. - -#### Examples - -```javascript -var getAsyncIteratorMethod = require('iterall').getAsyncIteratorMethod -var method = getAsyncIteratorMethod(myStream) -if (method) { - var asyncIterator = method.call(myStream) -} -``` - -Returns **function (): [AsyncIterator](#asynciterator)<T>** `@@asyncIterator` method. - -### createAsyncIterator - -Similar to [getAsyncIterator](#getasynciterator), this method returns a new AsyncIterator -given an AsyncIterable. However it will also create an AsyncIterator for a -non-async Iterable as well as non-Iterable Array-like collection, such as -Array in a pre-ES2015 environment. - -`createAsyncIterator` is complimentary to `forAwaitEach`, but allows a -buffering "pull"-based iteration as opposed to `forAwaitEach`'s -"push"-based iteration. - -`createAsyncIterator` produces an AsyncIterator for non-async Iterables as -described in the ECMAScript proposal [Async-from-Sync Iterator Objects](https://tc39.github.io/proposal-async-iteration/#sec-async-from-sync-iterator-objects). - -> Note: Creating `AsyncIterator`s requires the existence of `Promise`. -> While `Promise` has been available in modern browsers for a number of -> years, legacy browsers (like IE 11) may require a polyfill. - -#### Parameters - -- `source` **([AsyncIterable](#asynciterable)<T> | [Iterable](#iterable)<T> | {length: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)})** An AsyncIterable, Iterable, or Array-like object to produce an Iterator. - -#### Examples - -```javascript -var createAsyncIterator = require('iterall').createAsyncIterator - -var myArraylike = { length: 3, 0: 'Alpha', 1: 'Bravo', 2: 'Charlie' } -var iterator = createAsyncIterator(myArraylike) -iterator.next().then(console.log) // { value: 'Alpha', done: false } -iterator.next().then(console.log) // { value: 'Bravo', done: false } -iterator.next().then(console.log) // { value: 'Charlie', done: false } -iterator.next().then(console.log) // { value: undefined, done: true } -``` - -Returns **[AsyncIterator](#asynciterator)<T>** new AsyncIterator instance. - -### forAwaitEach - -Given an object which either implements the AsyncIterable protocol or is -Array-like, iterate over it, calling the `callback` at each iteration. - -Use `forAwaitEach` where you would expect to use a [for-await-of](https://tc39.github.io/proposal-async-iteration/#sec-for-in-and-for-of-statements) loop. - -Similar to [Array#forEach][], the `callback` function accepts three -arguments, and is provided with `thisArg` as the calling context. - -> Note: Using `forAwaitEach` requires the existence of `Promise`. -> While `Promise` has been available in modern browsers for a number of -> years, legacy browsers (like IE 11) may require a polyfill. - -#### Parameters - -- `source` **([AsyncIterable](#asynciterable)<T> | [Iterable](#iterable)<([Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<T> | T)> | {length: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)})** The AsyncIterable or array to iterate over. -- `callback` **function (T, [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Function to execute for each iteration, taking up to three arguments -- `thisArg` Optional. Value to use as `this` when executing `callback`. - -#### Examples - -```javascript -var forAwaitEach = require('iterall').forAwaitEach - -forAwaitEach(myIterable, function (value, index, iterable) { - console.log(value, index, iterable === myIterable) -}) -``` - -```javascript -// ES2017: -for await (let value of myAsyncIterable) { - console.log(await doSomethingAsync(value)) -} -console.log('done') - -// Any JavaScript environment: -forAwaitEach(myAsyncIterable, function (value) { - return doSomethingAsync(value).then(console.log) -}).then(function () { - console.log('done') -}) -``` - -## Contributing - -Contributions are welcome and encouraged! - -Remember that this library is designed to be small, straight-forward, and -well-tested. The value of new additional features will be weighed against their -size. This library also seeks to leverage and mirror the -[ECMAScript specification][] in its behavior as much as possible and reasonable. - -This repository has far more documentation and explanation than code, and it is -expected that the majority of contributions will come in the form of improving -these. - - - -[arguments]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments - -[array#@@iterator]: (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/@@iterator) - -[array-like]: http://www.2ality.com/2013/05/quirk-array-like-objects.html - -[array.from]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from - -[array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array - -[ecmascript specification]: http://www.ecma-international.org/ecma-262/6.0/ - -[flow]: https://flowtype.org/ - -[hamt]: https://en.wikipedia.org/wiki/Hash_array_mapped_trie - -[isarray]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray - -[iterators]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols - -[asynciterators]: https://tc39.github.io/proposal-async-iteration/ - -[linked list]: https://en.wikipedia.org/wiki/Linked_list - -[map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map - -[nodejs]: https://nodejs.org/ - -[nodelist]: https://developer.mozilla.org/en-US/docs/Web/API/NodeList - -[protocol]: https://en.wikipedia.org/wiki/Protocol_(object-oriented_programming) - -[react]: https://facebook.github.io/react/ - -[set]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set - -[symbol.iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator - -[typedarray]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray - -[typescript]: http://www.typescriptlang.org/ - -[immutable.js]: http://facebook.github.io/immutable-js/ diff --git a/node_modules/iterall/index.d.ts b/node_modules/iterall/index.d.ts deleted file mode 100644 index 040e1745..00000000 --- a/node_modules/iterall/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) 2016, Lee Byron - * All rights reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Note: TypeScript already has built-in definitions for -// Iterable, Iterator, AsyncIterable, and AsyncIterator so they are not -// defined here. However you may need to configure TypeScript to include them. - -export const $$iterator: unique symbol - -export function isIterable(obj: any): obj is Iterable - -export function isArrayLike(obj: any): obj is { length: number } - -export function isCollection(obj: any): obj is Iterable | { length: number } - -export function getIterator( - iterable: Iterable -): Iterator -export function getIterator(iterable: any): void | Iterator - -export function getIteratorMethod( - iterable: Iterable -): () => Iterator -export function getIteratorMethod(iterable: any): void | (() => Iterator) - -export function createIterator( - collection: Iterable -): Iterator -export function createIterator(collection: { length: number }): Iterator -export function createIterator(collection: any): void | Iterator - -type ValueOf = - TCollection extends Iterable ? TValue : never - -export function forEach>( - collection: TCollection, - callbackFn: (value: ValueOf, index: number, collection: TCollection) => any, - thisArg?: any -): void -export function forEach( - collection: TCollection, - callbackFn: (value: any, index: number, collection: TCollection) => any, - thisArg?: any -): void - -export const $$asyncIterator: unique symbol - -export function isAsyncIterable(obj: any): obj is AsyncIterable - -export function getAsyncIterator( - asyncIterable: AsyncIterable -): AsyncIterator -export function getAsyncIterator( - asyncIterable: any -): void | AsyncIterator - -export function getAsyncIteratorMethod( - asyncIterable: AsyncIterable -): () => AsyncIterator -export function getAsyncIteratorMethod( - asyncIterable: any -): void | (() => AsyncIterator) - -export function createAsyncIterator( - collection: AsyncIterable | Iterable | TValue> -): AsyncIterator -export function createAsyncIterator( - collection: {length: number} -): AsyncIterator -export function createAsyncIterator( - collection: any -): void | AsyncIterator - -type ResolvedOf = - TCollection extends AsyncIterable ? TValue : - TCollection extends Iterable ? - U extends Promise ? TValue : U : - never - -export function forAwaitEach>( - collection: TCollection, - callbackFn: (value: ResolvedOf, index: number, collection: TCollection) => any, - thisArg?: any -): Promise -export function forAwaitEach>( - collection: TCollection, - callbackFn: (value: ResolvedOf, index: number, collection: TCollection) => any, - thisArg?: any -): Promise -export function forAwaitEach( - collection: TCollection, - callbackFn: (value: any, index: number, collection: TCollection) => any, - thisArg?: any -): Promise diff --git a/node_modules/iterall/index.js b/node_modules/iterall/index.js deleted file mode 100644 index c71c5e09..00000000 --- a/node_modules/iterall/index.js +++ /dev/null @@ -1,195 +0,0 @@ -'use strict'; - -exports.isIterable = isIterable; -exports.isArrayLike = isArrayLike; -exports.isCollection = isCollection; -exports.getIterator = getIterator; -exports.getIteratorMethod = getIteratorMethod; -exports.createIterator = createIterator; -exports.forEach = forEach; -exports.isAsyncIterable = isAsyncIterable; -exports.getAsyncIterator = getAsyncIterator; -exports.getAsyncIteratorMethod = getAsyncIteratorMethod; -exports.createAsyncIterator = createAsyncIterator; -exports.forAwaitEach = forAwaitEach; - -var SYMBOL = typeof Symbol === 'function' ? Symbol : void 0; - -var SYMBOL_ITERATOR = SYMBOL && SYMBOL.iterator; - -var $$iterator = exports.$$iterator = SYMBOL_ITERATOR || '@@iterator'; - -function isIterable(obj) { - return !!getIteratorMethod(obj); -} - -function isArrayLike(obj) { - var length = obj != null && obj.length; - return typeof length === 'number' && length >= 0 && length % 1 === 0; -} - -function isCollection(obj) { - return Object(obj) === obj && (isArrayLike(obj) || isIterable(obj)); -} - -function getIterator(iterable) { - var method = getIteratorMethod(iterable); - if (method) { - return method.call(iterable); - } -} - -function getIteratorMethod(iterable) { - if (iterable != null) { - var method = SYMBOL_ITERATOR && iterable[SYMBOL_ITERATOR] || iterable['@@iterator']; - if (typeof method === 'function') { - return method; - } - } -} - -function createIterator(collection) { - if (collection != null) { - var iterator = getIterator(collection); - if (iterator) { - return iterator; - } - if (isArrayLike(collection)) { - return new ArrayLikeIterator(collection); - } - } -} - -function ArrayLikeIterator(obj) { - this._o = obj; - this._i = 0; -} - -ArrayLikeIterator.prototype[$$iterator] = function () { - return this; -}; - -ArrayLikeIterator.prototype.next = function () { - if (this._o === void 0 || this._i >= this._o.length) { - this._o = void 0; - return { value: void 0, done: true }; - } - return { value: this._o[this._i++], done: false }; -}; - -function forEach(collection, callback, thisArg) { - if (collection != null) { - if (typeof collection.forEach === 'function') { - return collection.forEach(callback, thisArg); - } - var i = 0; - var iterator = getIterator(collection); - if (iterator) { - var step; - while (!(step = iterator.next()).done) { - callback.call(thisArg, step.value, i++, collection); - - if (i > 9999999) { - throw new TypeError('Near-infinite iteration.'); - } - } - } else if (isArrayLike(collection)) { - for (; i < collection.length; i++) { - if (collection.hasOwnProperty(i)) { - callback.call(thisArg, collection[i], i, collection); - } - } - } - } -} - -var SYMBOL_ASYNC_ITERATOR = SYMBOL && SYMBOL.asyncIterator; - -var $$asyncIterator = exports.$$asyncIterator = SYMBOL_ASYNC_ITERATOR || '@@asyncIterator'; - -function isAsyncIterable(obj) { - return !!getAsyncIteratorMethod(obj); -} - -function getAsyncIterator(asyncIterable) { - var method = getAsyncIteratorMethod(asyncIterable); - if (method) { - return method.call(asyncIterable); - } -} - -function getAsyncIteratorMethod(asyncIterable) { - if (asyncIterable != null) { - var method = SYMBOL_ASYNC_ITERATOR && asyncIterable[SYMBOL_ASYNC_ITERATOR] || asyncIterable['@@asyncIterator']; - if (typeof method === 'function') { - return method; - } - } -} - -function createAsyncIterator(source) { - if (source != null) { - var asyncIterator = getAsyncIterator(source); - if (asyncIterator) { - return asyncIterator; - } - var iterator = createIterator(source); - if (iterator) { - return new AsyncFromSyncIterator(iterator); - } - } -} - -function AsyncFromSyncIterator(iterator) { - this._i = iterator; -} - -AsyncFromSyncIterator.prototype[$$asyncIterator] = function () { - return this; -}; - -AsyncFromSyncIterator.prototype.next = function (value) { - return unwrapAsyncFromSync(this._i, 'next', value); -}; - -AsyncFromSyncIterator.prototype.return = function (value) { - return this._i.return ? unwrapAsyncFromSync(this._i, 'return', value) : Promise.resolve({ value: value, done: true }); -}; - -AsyncFromSyncIterator.prototype.throw = function (value) { - return this._i.throw ? unwrapAsyncFromSync(this._i, 'throw', value) : Promise.reject(value); -}; - -function unwrapAsyncFromSync(iterator, fn, value) { - var step; - return new Promise(function (resolve) { - step = iterator[fn](value); - resolve(step.value); - }).then(function (value) { - return { value: value, done: step.done }; - }); -} - -function forAwaitEach(source, callback, thisArg) { - var asyncIterator = createAsyncIterator(source); - if (asyncIterator) { - var i = 0; - return new Promise(function (resolve, reject) { - function next() { - asyncIterator.next().then(function (step) { - if (!step.done) { - Promise.resolve(callback.call(thisArg, step.value, i++, source)).then(next).catch(reject); - } else { - resolve(); - } - - return null; - }).catch(reject); - - return null; - } - next(); - }); - } -} - diff --git a/node_modules/iterall/index.js.flow b/node_modules/iterall/index.js.flow deleted file mode 100644 index a8392c25..00000000 --- a/node_modules/iterall/index.js.flow +++ /dev/null @@ -1,721 +0,0 @@ -/** - * Copyright (c) 2016, Lee Byron - * All rights reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @ignore - */ - -/** - * [Iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator) - * is a *protocol* which describes a standard way to produce a sequence of - * values, typically the values of the Iterable represented by this Iterator. - * - * While described by the [ES2015 version of JavaScript](http://www.ecma-international.org/ecma-262/6.0/#sec-iterator-interface) - * it can be utilized by any version of JavaScript. - * - * @external Iterator - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator|MDN Iteration protocols} - */ - -/** - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable) - * is a *protocol* which when implemented allows a JavaScript object to define - * their iteration behavior, such as what values are looped over in a - * [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) - * loop or `iterall`'s `forEach` function. Many [built-in types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#Builtin_iterables) - * implement the Iterable protocol, including `Array` and `Map`. - * - * While described by the [ES2015 version of JavaScript](http://www.ecma-international.org/ecma-262/6.0/#sec-iterable-interface) - * it can be utilized by any version of JavaScript. - * - * @external Iterable - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable|MDN Iteration protocols} - */ - -// In ES2015 environments, Symbol exists -var SYMBOL /*: any */ = typeof Symbol === 'function' ? Symbol : void 0 - -// In ES2015 (or a polyfilled) environment, this will be Symbol.iterator -var SYMBOL_ITERATOR = SYMBOL && SYMBOL.iterator - -/** - * A property name to be used as the name of an Iterable's method responsible - * for producing an Iterator, referred to as `@@iterator`. Typically represents - * the value `Symbol.iterator` but falls back to the string `"@@iterator"` when - * `Symbol.iterator` is not defined. - * - * Use `$$iterator` for defining new Iterables instead of `Symbol.iterator`, - * but do not use it for accessing existing Iterables, instead use - * {@link getIterator} or {@link isIterable}. - * - * @example - * - * var $$iterator = require('iterall').$$iterator - * - * function Counter (to) { - * this.to = to - * } - * - * Counter.prototype[$$iterator] = function () { - * return { - * to: this.to, - * num: 0, - * next () { - * if (this.num >= this.to) { - * return { value: undefined, done: true } - * } - * return { value: this.num++, done: false } - * } - * } - * } - * - * var counter = new Counter(3) - * for (var number of counter) { - * console.log(number) // 0 ... 1 ... 2 - * } - * - * @type {Symbol|string} - */ -/*:: declare export var $$iterator: '@@iterator'; */ -export var $$iterator = SYMBOL_ITERATOR || '@@iterator' - -/** - * Returns true if the provided object implements the Iterator protocol via - * either implementing a `Symbol.iterator` or `"@@iterator"` method. - * - * @example - * - * var isIterable = require('iterall').isIterable - * isIterable([ 1, 2, 3 ]) // true - * isIterable('ABC') // true - * isIterable({ length: 1, 0: 'Alpha' }) // false - * isIterable({ key: 'value' }) // false - * isIterable(new Map()) // true - * - * @param obj - * A value which might implement the Iterable protocol. - * @return {boolean} true if Iterable. - */ -/*:: declare export function isIterable(obj: any): boolean; */ -export function isIterable(obj) { - return !!getIteratorMethod(obj) -} - -/** - * Returns true if the provided object implements the Array-like protocol via - * defining a positive-integer `length` property. - * - * @example - * - * var isArrayLike = require('iterall').isArrayLike - * isArrayLike([ 1, 2, 3 ]) // true - * isArrayLike('ABC') // true - * isArrayLike({ length: 1, 0: 'Alpha' }) // true - * isArrayLike({ key: 'value' }) // false - * isArrayLike(new Map()) // false - * - * @param obj - * A value which might implement the Array-like protocol. - * @return {boolean} true if Array-like. - */ -/*:: declare export function isArrayLike(obj: any): boolean; */ -export function isArrayLike(obj) { - var length = obj != null && obj.length - return typeof length === 'number' && length >= 0 && length % 1 === 0 -} - -/** - * Returns true if the provided object is an Object (i.e. not a string literal) - * and is either Iterable or Array-like. - * - * This may be used in place of [Array.isArray()][isArray] to determine if an - * object should be iterated-over. It always excludes string literals and - * includes Arrays (regardless of if it is Iterable). It also includes other - * Array-like objects such as NodeList, TypedArray, and Buffer. - * - * @example - * - * var isCollection = require('iterall').isCollection - * isCollection([ 1, 2, 3 ]) // true - * isCollection('ABC') // false - * isCollection({ length: 1, 0: 'Alpha' }) // true - * isCollection({ key: 'value' }) // false - * isCollection(new Map()) // true - * - * @example - * - * var forEach = require('iterall').forEach - * if (isCollection(obj)) { - * forEach(obj, function (value) { - * console.log(value) - * }) - * } - * - * @param obj - * An Object value which might implement the Iterable or Array-like protocols. - * @return {boolean} true if Iterable or Array-like Object. - */ -/*:: declare export function isCollection(obj: any): boolean; */ -export function isCollection(obj) { - return Object(obj) === obj && (isArrayLike(obj) || isIterable(obj)) -} - -/** - * If the provided object implements the Iterator protocol, its Iterator object - * is returned. Otherwise returns undefined. - * - * @example - * - * var getIterator = require('iterall').getIterator - * var iterator = getIterator([ 1, 2, 3 ]) - * iterator.next() // { value: 1, done: false } - * iterator.next() // { value: 2, done: false } - * iterator.next() // { value: 3, done: false } - * iterator.next() // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {Iterable} iterable - * An Iterable object which is the source of an Iterator. - * @return {Iterator} new Iterator instance. - */ -/*:: declare export var getIterator: - & (<+TValue>(iterable: Iterable) => Iterator) - & ((iterable: mixed) => void | Iterator); */ -export function getIterator(iterable) { - var method = getIteratorMethod(iterable) - if (method) { - return method.call(iterable) - } -} - -/** - * If the provided object implements the Iterator protocol, the method - * responsible for producing its Iterator object is returned. - * - * This is used in rare cases for performance tuning. This method must be called - * with obj as the contextual this-argument. - * - * @example - * - * var getIteratorMethod = require('iterall').getIteratorMethod - * var myArray = [ 1, 2, 3 ] - * var method = getIteratorMethod(myArray) - * if (method) { - * var iterator = method.call(myArray) - * } - * - * @template T the type of each iterated value - * @param {Iterable} iterable - * An Iterable object which defines an `@@iterator` method. - * @return {function(): Iterator} `@@iterator` method. - */ -/*:: declare export var getIteratorMethod: - & (<+TValue>(iterable: Iterable) => (() => Iterator)) - & ((iterable: mixed) => (void | (() => Iterator))); */ -export function getIteratorMethod(iterable) { - if (iterable != null) { - var method = - (SYMBOL_ITERATOR && iterable[SYMBOL_ITERATOR]) || iterable['@@iterator'] - if (typeof method === 'function') { - return method - } - } -} - -/** - * Similar to {@link getIterator}, this method returns a new Iterator given an - * Iterable. However it will also create an Iterator for a non-Iterable - * Array-like collection, such as Array in a non-ES2015 environment. - * - * `createIterator` is complimentary to `forEach`, but allows a "pull"-based - * iteration as opposed to `forEach`'s "push"-based iteration. - * - * `createIterator` produces an Iterator for Array-likes with the same behavior - * as ArrayIteratorPrototype described in the ECMAScript specification, and - * does *not* skip over "holes". - * - * @example - * - * var createIterator = require('iterall').createIterator - * - * var myArraylike = { length: 3, 0: 'Alpha', 1: 'Bravo', 2: 'Charlie' } - * var iterator = createIterator(myArraylike) - * iterator.next() // { value: 'Alpha', done: false } - * iterator.next() // { value: 'Bravo', done: false } - * iterator.next() // { value: 'Charlie', done: false } - * iterator.next() // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {Iterable|{ length: number }} collection - * An Iterable or Array-like object to produce an Iterator. - * @return {Iterator} new Iterator instance. - */ -/*:: declare export var createIterator: - & (<+TValue>(collection: Iterable) => Iterator) - & ((collection: {length: number}) => Iterator) - & ((collection: mixed) => (void | Iterator)); */ -export function createIterator(collection) { - if (collection != null) { - var iterator = getIterator(collection) - if (iterator) { - return iterator - } - if (isArrayLike(collection)) { - return new ArrayLikeIterator(collection) - } - } -} - -// When the object provided to `createIterator` is not Iterable but is -// Array-like, this simple Iterator is created. -function ArrayLikeIterator(obj) { - this._o = obj - this._i = 0 -} - -// Note: all Iterators are themselves Iterable. -ArrayLikeIterator.prototype[$$iterator] = function() { - return this -} - -// A simple state-machine determines the IteratorResult returned, yielding -// each value in the Array-like object in order of their indicies. -ArrayLikeIterator.prototype.next = function() { - if (this._o === void 0 || this._i >= this._o.length) { - this._o = void 0 - return { value: void 0, done: true } - } - return { value: this._o[this._i++], done: false } -} - -/** - * Given an object which either implements the Iterable protocol or is - * Array-like, iterate over it, calling the `callback` at each iteration. - * - * Use `forEach` where you would expect to use a `for ... of` loop in ES6. - * However `forEach` adheres to the behavior of [Array#forEach][] described in - * the ECMAScript specification, skipping over "holes" in Array-likes. It will - * also delegate to a `forEach` method on `collection` if one is defined, - * ensuring native performance for `Arrays`. - * - * Similar to [Array#forEach][], the `callback` function accepts three - * arguments, and is provided with `thisArg` as the calling context. - * - * Note: providing an infinite Iterator to forEach will produce an error. - * - * [Array#forEach]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach - * - * @example - * - * var forEach = require('iterall').forEach - * - * forEach(myIterable, function (value, index, iterable) { - * console.log(value, index, iterable === myIterable) - * }) - * - * @example - * - * // ES6: - * for (let value of myIterable) { - * console.log(value) - * } - * - * // Any JavaScript environment: - * forEach(myIterable, function (value) { - * console.log(value) - * }) - * - * @template T the type of each iterated value - * @param {Iterable|{ length: number }} collection - * The Iterable or array to iterate over. - * @param {function(T, number, object)} callback - * Function to execute for each iteration, taking up to three arguments - * @param [thisArg] - * Optional. Value to use as `this` when executing `callback`. - */ -/*:: declare export var forEach: - & (<+TValue, TCollection: Iterable>( - collection: TCollection, - callbackFn: (value: TValue, index: number, collection: TCollection) => any, - thisArg?: any - ) => void) - & (( - collection: TCollection, - callbackFn: (value: mixed, index: number, collection: TCollection) => any, - thisArg?: any - ) => void); */ -export function forEach(collection, callback, thisArg) { - if (collection != null) { - if (typeof collection.forEach === 'function') { - return collection.forEach(callback, thisArg) - } - var i = 0 - var iterator = getIterator(collection) - if (iterator) { - var step - while (!(step = iterator.next()).done) { - callback.call(thisArg, step.value, i++, collection) - // Infinite Iterators could cause forEach to run forever. - // After a very large number of iterations, produce an error. - /* istanbul ignore if */ - if (i > 9999999) { - throw new TypeError('Near-infinite iteration.') - } - } - } else if (isArrayLike(collection)) { - for (; i < collection.length; i++) { - if (collection.hasOwnProperty(i)) { - callback.call(thisArg, collection[i], i, collection) - } - } - } - } -} - -///////////////////////////////////////////////////// -// // -// ASYNC ITERATORS // -// // -///////////////////////////////////////////////////// - -/** - * [AsyncIterable](https://tc39.github.io/proposal-async-iteration/#sec-asynciterable-interface) - * is a *protocol* which when implemented allows a JavaScript object to define - * an asynchronous iteration behavior, such as what values are looped over in - * a [`for-await-of`](https://tc39.github.io/proposal-async-iteration/#sec-for-in-and-for-of-statements) - * loop or `iterall`'s {@link forAwaitEach} function. - * - * While described as a proposed addition to the [ES2017 version of JavaScript](https://tc39.github.io/proposal-async-iteration/) - * it can be utilized by any version of JavaScript. - * - * @external AsyncIterable - * @see {@link https://tc39.github.io/proposal-async-iteration/#sec-asynciterable-interface|Async Iteration Proposal} - * @template T The type of each iterated value - * @property {function (): AsyncIterator} Symbol.asyncIterator - * A method which produces an AsyncIterator for this AsyncIterable. - */ - -/** - * [AsyncIterator](https://tc39.github.io/proposal-async-iteration/#sec-asynciterator-interface) - * is a *protocol* which describes a standard way to produce and consume an - * asynchronous sequence of values, typically the values of the - * {@link AsyncIterable} represented by this {@link AsyncIterator}. - * - * AsyncIterator is similar to Observable or Stream. Like an {@link Iterator} it - * also as a `next()` method, however instead of an IteratorResult, - * calling this method returns a {@link Promise} for a IteratorResult. - * - * While described as a proposed addition to the [ES2017 version of JavaScript](https://tc39.github.io/proposal-async-iteration/) - * it can be utilized by any version of JavaScript. - * - * @external AsyncIterator - * @see {@link https://tc39.github.io/proposal-async-iteration/#sec-asynciterator-interface|Async Iteration Proposal} - */ - -// In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator -var SYMBOL_ASYNC_ITERATOR = SYMBOL && SYMBOL.asyncIterator - -/** - * A property name to be used as the name of an AsyncIterable's method - * responsible for producing an Iterator, referred to as `@@asyncIterator`. - * Typically represents the value `Symbol.asyncIterator` but falls back to the - * string `"@@asyncIterator"` when `Symbol.asyncIterator` is not defined. - * - * Use `$$asyncIterator` for defining new AsyncIterables instead of - * `Symbol.asyncIterator`, but do not use it for accessing existing Iterables, - * instead use {@link getAsyncIterator} or {@link isAsyncIterable}. - * - * @example - * - * var $$asyncIterator = require('iterall').$$asyncIterator - * - * function Chirper (to) { - * this.to = to - * } - * - * Chirper.prototype[$$asyncIterator] = function () { - * return { - * to: this.to, - * num: 0, - * next () { - * return new Promise(resolve => { - * if (this.num >= this.to) { - * resolve({ value: undefined, done: true }) - * } else { - * setTimeout(() => { - * resolve({ value: this.num++, done: false }) - * }, 1000) - * } - * }) - * } - * } - * } - * - * var chirper = new Chirper(3) - * for await (var number of chirper) { - * console.log(number) // 0 ...wait... 1 ...wait... 2 - * } - * - * @type {Symbol|string} - */ -/*:: declare export var $$asyncIterator: '@@asyncIterator'; */ -export var $$asyncIterator = SYMBOL_ASYNC_ITERATOR || '@@asyncIterator' - -/** - * Returns true if the provided object implements the AsyncIterator protocol via - * either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method. - * - * @example - * - * var isAsyncIterable = require('iterall').isAsyncIterable - * isAsyncIterable(myStream) // true - * isAsyncIterable('ABC') // false - * - * @param obj - * A value which might implement the AsyncIterable protocol. - * @return {boolean} true if AsyncIterable. - */ -/*:: declare export function isAsyncIterable(obj: any): boolean; */ -export function isAsyncIterable(obj) { - return !!getAsyncIteratorMethod(obj) -} - -/** - * If the provided object implements the AsyncIterator protocol, its - * AsyncIterator object is returned. Otherwise returns undefined. - * - * @example - * - * var getAsyncIterator = require('iterall').getAsyncIterator - * var asyncIterator = getAsyncIterator(myStream) - * asyncIterator.next().then(console.log) // { value: 1, done: false } - * asyncIterator.next().then(console.log) // { value: 2, done: false } - * asyncIterator.next().then(console.log) // { value: 3, done: false } - * asyncIterator.next().then(console.log) // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {AsyncIterable} asyncIterable - * An AsyncIterable object which is the source of an AsyncIterator. - * @return {AsyncIterator} new AsyncIterator instance. - */ -/*:: declare export var getAsyncIterator: - & (<+TValue>(asyncIterable: AsyncIterable) => AsyncIterator) - & ((asyncIterable: mixed) => (void | AsyncIterator)); */ -export function getAsyncIterator(asyncIterable) { - var method = getAsyncIteratorMethod(asyncIterable) - if (method) { - return method.call(asyncIterable) - } -} - -/** - * If the provided object implements the AsyncIterator protocol, the method - * responsible for producing its AsyncIterator object is returned. - * - * This is used in rare cases for performance tuning. This method must be called - * with obj as the contextual this-argument. - * - * @example - * - * var getAsyncIteratorMethod = require('iterall').getAsyncIteratorMethod - * var method = getAsyncIteratorMethod(myStream) - * if (method) { - * var asyncIterator = method.call(myStream) - * } - * - * @template T the type of each iterated value - * @param {AsyncIterable} asyncIterable - * An AsyncIterable object which defines an `@@asyncIterator` method. - * @return {function(): AsyncIterator} `@@asyncIterator` method. - */ -/*:: declare export var getAsyncIteratorMethod: - & (<+TValue>(asyncIterable: AsyncIterable) => (() => AsyncIterator)) - & ((asyncIterable: mixed) => (void | (() => AsyncIterator))); */ -export function getAsyncIteratorMethod(asyncIterable) { - if (asyncIterable != null) { - var method = - (SYMBOL_ASYNC_ITERATOR && asyncIterable[SYMBOL_ASYNC_ITERATOR]) || - asyncIterable['@@asyncIterator'] - if (typeof method === 'function') { - return method - } - } -} - -/** - * Similar to {@link getAsyncIterator}, this method returns a new AsyncIterator - * given an AsyncIterable. However it will also create an AsyncIterator for a - * non-async Iterable as well as non-Iterable Array-like collection, such as - * Array in a pre-ES2015 environment. - * - * `createAsyncIterator` is complimentary to `forAwaitEach`, but allows a - * buffering "pull"-based iteration as opposed to `forAwaitEach`'s - * "push"-based iteration. - * - * `createAsyncIterator` produces an AsyncIterator for non-async Iterables as - * described in the ECMAScript proposal [Async-from-Sync Iterator Objects](https://tc39.github.io/proposal-async-iteration/#sec-async-from-sync-iterator-objects). - * - * > Note: Creating `AsyncIterator`s requires the existence of `Promise`. - * > While `Promise` has been available in modern browsers for a number of - * > years, legacy browsers (like IE 11) may require a polyfill. - * - * @example - * - * var createAsyncIterator = require('iterall').createAsyncIterator - * - * var myArraylike = { length: 3, 0: 'Alpha', 1: 'Bravo', 2: 'Charlie' } - * var iterator = createAsyncIterator(myArraylike) - * iterator.next().then(console.log) // { value: 'Alpha', done: false } - * iterator.next().then(console.log) // { value: 'Bravo', done: false } - * iterator.next().then(console.log) // { value: 'Charlie', done: false } - * iterator.next().then(console.log) // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {AsyncIterable|Iterable|{ length: number }} source - * An AsyncIterable, Iterable, or Array-like object to produce an Iterator. - * @return {AsyncIterator} new AsyncIterator instance. - */ -/*:: declare export var createAsyncIterator: - & (<+TValue>( - collection: Iterable | TValue> | AsyncIterable - ) => AsyncIterator) - & ((collection: {length: number}) => AsyncIterator) - & ((collection: mixed) => (void | AsyncIterator)); */ -export function createAsyncIterator(source) { - if (source != null) { - var asyncIterator = getAsyncIterator(source) - if (asyncIterator) { - return asyncIterator - } - var iterator = createIterator(source) - if (iterator) { - return new AsyncFromSyncIterator(iterator) - } - } -} - -// When the object provided to `createAsyncIterator` is not AsyncIterable but is -// sync Iterable, this simple wrapper is created. -function AsyncFromSyncIterator(iterator) { - this._i = iterator -} - -// Note: all AsyncIterators are themselves AsyncIterable. -AsyncFromSyncIterator.prototype[$$asyncIterator] = function() { - return this -} - -// A simple state-machine determines the IteratorResult returned, yielding -// each value in the Array-like object in order of their indicies. -AsyncFromSyncIterator.prototype.next = function(value) { - return unwrapAsyncFromSync(this._i, 'next', value) -} - -AsyncFromSyncIterator.prototype.return = function(value) { - return this._i.return - ? unwrapAsyncFromSync(this._i, 'return', value) - : Promise.resolve({ value: value, done: true }) -} - -AsyncFromSyncIterator.prototype.throw = function(value) { - return this._i.throw - ? unwrapAsyncFromSync(this._i, 'throw', value) - : Promise.reject(value) -} - -function unwrapAsyncFromSync(iterator, fn, value) { - var step - return new Promise(function(resolve) { - step = iterator[fn](value) - resolve(step.value) - }).then(function(value) { - return { value: value, done: step.done } - }) -} - -/** - * Given an object which either implements the AsyncIterable protocol or is - * Array-like, iterate over it, calling the `callback` at each iteration. - * - * Use `forAwaitEach` where you would expect to use a [for-await-of](https://tc39.github.io/proposal-async-iteration/#sec-for-in-and-for-of-statements) loop. - * - * Similar to [Array#forEach][], the `callback` function accepts three - * arguments, and is provided with `thisArg` as the calling context. - * - * > Note: Using `forAwaitEach` requires the existence of `Promise`. - * > While `Promise` has been available in modern browsers for a number of - * > years, legacy browsers (like IE 11) may require a polyfill. - * - * @example - * - * var forAwaitEach = require('iterall').forAwaitEach - * - * forAwaitEach(myIterable, function (value, index, iterable) { - * console.log(value, index, iterable === myIterable) - * }) - * - * @example - * - * // ES2017: - * for await (let value of myAsyncIterable) { - * console.log(await doSomethingAsync(value)) - * } - * console.log('done') - * - * // Any JavaScript environment: - * forAwaitEach(myAsyncIterable, function (value) { - * return doSomethingAsync(value).then(console.log) - * }).then(function () { - * console.log('done') - * }) - * - * @template T the type of each iterated value - * @param {AsyncIterable|Iterable | T>|{ length: number }} source - * The AsyncIterable or array to iterate over. - * @param {function(T, number, object)} callback - * Function to execute for each iteration, taking up to three arguments - * @param [thisArg] - * Optional. Value to use as `this` when executing `callback`. - */ -/*:: declare export var forAwaitEach: - & (<+TValue, TCollection: Iterable | TValue> | AsyncIterable>( - collection: TCollection, - callbackFn: (value: TValue, index: number, collection: TCollection) => any, - thisArg?: any - ) => Promise) - & (( - collection: TCollection, - callbackFn: (value: mixed, index: number, collection: TCollection) => any, - thisArg?: any - ) => Promise); */ -export function forAwaitEach(source, callback, thisArg) { - var asyncIterator = createAsyncIterator(source) - if (asyncIterator) { - var i = 0 - return new Promise(function(resolve, reject) { - function next() { - asyncIterator - .next() - .then(function(step) { - if (!step.done) { - Promise.resolve(callback.call(thisArg, step.value, i++, source)) - .then(next) - .catch(reject) - } else { - resolve() - } - // Explicitly return null, silencing bluebird-style warnings. - return null - }) - .catch(reject) - // Explicitly return null, silencing bluebird-style warnings. - return null - } - next() - }) - } -} diff --git a/node_modules/iterall/index.mjs b/node_modules/iterall/index.mjs deleted file mode 100644 index a8392c25..00000000 --- a/node_modules/iterall/index.mjs +++ /dev/null @@ -1,721 +0,0 @@ -/** - * Copyright (c) 2016, Lee Byron - * All rights reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @ignore - */ - -/** - * [Iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator) - * is a *protocol* which describes a standard way to produce a sequence of - * values, typically the values of the Iterable represented by this Iterator. - * - * While described by the [ES2015 version of JavaScript](http://www.ecma-international.org/ecma-262/6.0/#sec-iterator-interface) - * it can be utilized by any version of JavaScript. - * - * @external Iterator - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator|MDN Iteration protocols} - */ - -/** - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable) - * is a *protocol* which when implemented allows a JavaScript object to define - * their iteration behavior, such as what values are looped over in a - * [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) - * loop or `iterall`'s `forEach` function. Many [built-in types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#Builtin_iterables) - * implement the Iterable protocol, including `Array` and `Map`. - * - * While described by the [ES2015 version of JavaScript](http://www.ecma-international.org/ecma-262/6.0/#sec-iterable-interface) - * it can be utilized by any version of JavaScript. - * - * @external Iterable - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable|MDN Iteration protocols} - */ - -// In ES2015 environments, Symbol exists -var SYMBOL /*: any */ = typeof Symbol === 'function' ? Symbol : void 0 - -// In ES2015 (or a polyfilled) environment, this will be Symbol.iterator -var SYMBOL_ITERATOR = SYMBOL && SYMBOL.iterator - -/** - * A property name to be used as the name of an Iterable's method responsible - * for producing an Iterator, referred to as `@@iterator`. Typically represents - * the value `Symbol.iterator` but falls back to the string `"@@iterator"` when - * `Symbol.iterator` is not defined. - * - * Use `$$iterator` for defining new Iterables instead of `Symbol.iterator`, - * but do not use it for accessing existing Iterables, instead use - * {@link getIterator} or {@link isIterable}. - * - * @example - * - * var $$iterator = require('iterall').$$iterator - * - * function Counter (to) { - * this.to = to - * } - * - * Counter.prototype[$$iterator] = function () { - * return { - * to: this.to, - * num: 0, - * next () { - * if (this.num >= this.to) { - * return { value: undefined, done: true } - * } - * return { value: this.num++, done: false } - * } - * } - * } - * - * var counter = new Counter(3) - * for (var number of counter) { - * console.log(number) // 0 ... 1 ... 2 - * } - * - * @type {Symbol|string} - */ -/*:: declare export var $$iterator: '@@iterator'; */ -export var $$iterator = SYMBOL_ITERATOR || '@@iterator' - -/** - * Returns true if the provided object implements the Iterator protocol via - * either implementing a `Symbol.iterator` or `"@@iterator"` method. - * - * @example - * - * var isIterable = require('iterall').isIterable - * isIterable([ 1, 2, 3 ]) // true - * isIterable('ABC') // true - * isIterable({ length: 1, 0: 'Alpha' }) // false - * isIterable({ key: 'value' }) // false - * isIterable(new Map()) // true - * - * @param obj - * A value which might implement the Iterable protocol. - * @return {boolean} true if Iterable. - */ -/*:: declare export function isIterable(obj: any): boolean; */ -export function isIterable(obj) { - return !!getIteratorMethod(obj) -} - -/** - * Returns true if the provided object implements the Array-like protocol via - * defining a positive-integer `length` property. - * - * @example - * - * var isArrayLike = require('iterall').isArrayLike - * isArrayLike([ 1, 2, 3 ]) // true - * isArrayLike('ABC') // true - * isArrayLike({ length: 1, 0: 'Alpha' }) // true - * isArrayLike({ key: 'value' }) // false - * isArrayLike(new Map()) // false - * - * @param obj - * A value which might implement the Array-like protocol. - * @return {boolean} true if Array-like. - */ -/*:: declare export function isArrayLike(obj: any): boolean; */ -export function isArrayLike(obj) { - var length = obj != null && obj.length - return typeof length === 'number' && length >= 0 && length % 1 === 0 -} - -/** - * Returns true if the provided object is an Object (i.e. not a string literal) - * and is either Iterable or Array-like. - * - * This may be used in place of [Array.isArray()][isArray] to determine if an - * object should be iterated-over. It always excludes string literals and - * includes Arrays (regardless of if it is Iterable). It also includes other - * Array-like objects such as NodeList, TypedArray, and Buffer. - * - * @example - * - * var isCollection = require('iterall').isCollection - * isCollection([ 1, 2, 3 ]) // true - * isCollection('ABC') // false - * isCollection({ length: 1, 0: 'Alpha' }) // true - * isCollection({ key: 'value' }) // false - * isCollection(new Map()) // true - * - * @example - * - * var forEach = require('iterall').forEach - * if (isCollection(obj)) { - * forEach(obj, function (value) { - * console.log(value) - * }) - * } - * - * @param obj - * An Object value which might implement the Iterable or Array-like protocols. - * @return {boolean} true if Iterable or Array-like Object. - */ -/*:: declare export function isCollection(obj: any): boolean; */ -export function isCollection(obj) { - return Object(obj) === obj && (isArrayLike(obj) || isIterable(obj)) -} - -/** - * If the provided object implements the Iterator protocol, its Iterator object - * is returned. Otherwise returns undefined. - * - * @example - * - * var getIterator = require('iterall').getIterator - * var iterator = getIterator([ 1, 2, 3 ]) - * iterator.next() // { value: 1, done: false } - * iterator.next() // { value: 2, done: false } - * iterator.next() // { value: 3, done: false } - * iterator.next() // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {Iterable} iterable - * An Iterable object which is the source of an Iterator. - * @return {Iterator} new Iterator instance. - */ -/*:: declare export var getIterator: - & (<+TValue>(iterable: Iterable) => Iterator) - & ((iterable: mixed) => void | Iterator); */ -export function getIterator(iterable) { - var method = getIteratorMethod(iterable) - if (method) { - return method.call(iterable) - } -} - -/** - * If the provided object implements the Iterator protocol, the method - * responsible for producing its Iterator object is returned. - * - * This is used in rare cases for performance tuning. This method must be called - * with obj as the contextual this-argument. - * - * @example - * - * var getIteratorMethod = require('iterall').getIteratorMethod - * var myArray = [ 1, 2, 3 ] - * var method = getIteratorMethod(myArray) - * if (method) { - * var iterator = method.call(myArray) - * } - * - * @template T the type of each iterated value - * @param {Iterable} iterable - * An Iterable object which defines an `@@iterator` method. - * @return {function(): Iterator} `@@iterator` method. - */ -/*:: declare export var getIteratorMethod: - & (<+TValue>(iterable: Iterable) => (() => Iterator)) - & ((iterable: mixed) => (void | (() => Iterator))); */ -export function getIteratorMethod(iterable) { - if (iterable != null) { - var method = - (SYMBOL_ITERATOR && iterable[SYMBOL_ITERATOR]) || iterable['@@iterator'] - if (typeof method === 'function') { - return method - } - } -} - -/** - * Similar to {@link getIterator}, this method returns a new Iterator given an - * Iterable. However it will also create an Iterator for a non-Iterable - * Array-like collection, such as Array in a non-ES2015 environment. - * - * `createIterator` is complimentary to `forEach`, but allows a "pull"-based - * iteration as opposed to `forEach`'s "push"-based iteration. - * - * `createIterator` produces an Iterator for Array-likes with the same behavior - * as ArrayIteratorPrototype described in the ECMAScript specification, and - * does *not* skip over "holes". - * - * @example - * - * var createIterator = require('iterall').createIterator - * - * var myArraylike = { length: 3, 0: 'Alpha', 1: 'Bravo', 2: 'Charlie' } - * var iterator = createIterator(myArraylike) - * iterator.next() // { value: 'Alpha', done: false } - * iterator.next() // { value: 'Bravo', done: false } - * iterator.next() // { value: 'Charlie', done: false } - * iterator.next() // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {Iterable|{ length: number }} collection - * An Iterable or Array-like object to produce an Iterator. - * @return {Iterator} new Iterator instance. - */ -/*:: declare export var createIterator: - & (<+TValue>(collection: Iterable) => Iterator) - & ((collection: {length: number}) => Iterator) - & ((collection: mixed) => (void | Iterator)); */ -export function createIterator(collection) { - if (collection != null) { - var iterator = getIterator(collection) - if (iterator) { - return iterator - } - if (isArrayLike(collection)) { - return new ArrayLikeIterator(collection) - } - } -} - -// When the object provided to `createIterator` is not Iterable but is -// Array-like, this simple Iterator is created. -function ArrayLikeIterator(obj) { - this._o = obj - this._i = 0 -} - -// Note: all Iterators are themselves Iterable. -ArrayLikeIterator.prototype[$$iterator] = function() { - return this -} - -// A simple state-machine determines the IteratorResult returned, yielding -// each value in the Array-like object in order of their indicies. -ArrayLikeIterator.prototype.next = function() { - if (this._o === void 0 || this._i >= this._o.length) { - this._o = void 0 - return { value: void 0, done: true } - } - return { value: this._o[this._i++], done: false } -} - -/** - * Given an object which either implements the Iterable protocol or is - * Array-like, iterate over it, calling the `callback` at each iteration. - * - * Use `forEach` where you would expect to use a `for ... of` loop in ES6. - * However `forEach` adheres to the behavior of [Array#forEach][] described in - * the ECMAScript specification, skipping over "holes" in Array-likes. It will - * also delegate to a `forEach` method on `collection` if one is defined, - * ensuring native performance for `Arrays`. - * - * Similar to [Array#forEach][], the `callback` function accepts three - * arguments, and is provided with `thisArg` as the calling context. - * - * Note: providing an infinite Iterator to forEach will produce an error. - * - * [Array#forEach]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach - * - * @example - * - * var forEach = require('iterall').forEach - * - * forEach(myIterable, function (value, index, iterable) { - * console.log(value, index, iterable === myIterable) - * }) - * - * @example - * - * // ES6: - * for (let value of myIterable) { - * console.log(value) - * } - * - * // Any JavaScript environment: - * forEach(myIterable, function (value) { - * console.log(value) - * }) - * - * @template T the type of each iterated value - * @param {Iterable|{ length: number }} collection - * The Iterable or array to iterate over. - * @param {function(T, number, object)} callback - * Function to execute for each iteration, taking up to three arguments - * @param [thisArg] - * Optional. Value to use as `this` when executing `callback`. - */ -/*:: declare export var forEach: - & (<+TValue, TCollection: Iterable>( - collection: TCollection, - callbackFn: (value: TValue, index: number, collection: TCollection) => any, - thisArg?: any - ) => void) - & (( - collection: TCollection, - callbackFn: (value: mixed, index: number, collection: TCollection) => any, - thisArg?: any - ) => void); */ -export function forEach(collection, callback, thisArg) { - if (collection != null) { - if (typeof collection.forEach === 'function') { - return collection.forEach(callback, thisArg) - } - var i = 0 - var iterator = getIterator(collection) - if (iterator) { - var step - while (!(step = iterator.next()).done) { - callback.call(thisArg, step.value, i++, collection) - // Infinite Iterators could cause forEach to run forever. - // After a very large number of iterations, produce an error. - /* istanbul ignore if */ - if (i > 9999999) { - throw new TypeError('Near-infinite iteration.') - } - } - } else if (isArrayLike(collection)) { - for (; i < collection.length; i++) { - if (collection.hasOwnProperty(i)) { - callback.call(thisArg, collection[i], i, collection) - } - } - } - } -} - -///////////////////////////////////////////////////// -// // -// ASYNC ITERATORS // -// // -///////////////////////////////////////////////////// - -/** - * [AsyncIterable](https://tc39.github.io/proposal-async-iteration/#sec-asynciterable-interface) - * is a *protocol* which when implemented allows a JavaScript object to define - * an asynchronous iteration behavior, such as what values are looped over in - * a [`for-await-of`](https://tc39.github.io/proposal-async-iteration/#sec-for-in-and-for-of-statements) - * loop or `iterall`'s {@link forAwaitEach} function. - * - * While described as a proposed addition to the [ES2017 version of JavaScript](https://tc39.github.io/proposal-async-iteration/) - * it can be utilized by any version of JavaScript. - * - * @external AsyncIterable - * @see {@link https://tc39.github.io/proposal-async-iteration/#sec-asynciterable-interface|Async Iteration Proposal} - * @template T The type of each iterated value - * @property {function (): AsyncIterator} Symbol.asyncIterator - * A method which produces an AsyncIterator for this AsyncIterable. - */ - -/** - * [AsyncIterator](https://tc39.github.io/proposal-async-iteration/#sec-asynciterator-interface) - * is a *protocol* which describes a standard way to produce and consume an - * asynchronous sequence of values, typically the values of the - * {@link AsyncIterable} represented by this {@link AsyncIterator}. - * - * AsyncIterator is similar to Observable or Stream. Like an {@link Iterator} it - * also as a `next()` method, however instead of an IteratorResult, - * calling this method returns a {@link Promise} for a IteratorResult. - * - * While described as a proposed addition to the [ES2017 version of JavaScript](https://tc39.github.io/proposal-async-iteration/) - * it can be utilized by any version of JavaScript. - * - * @external AsyncIterator - * @see {@link https://tc39.github.io/proposal-async-iteration/#sec-asynciterator-interface|Async Iteration Proposal} - */ - -// In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator -var SYMBOL_ASYNC_ITERATOR = SYMBOL && SYMBOL.asyncIterator - -/** - * A property name to be used as the name of an AsyncIterable's method - * responsible for producing an Iterator, referred to as `@@asyncIterator`. - * Typically represents the value `Symbol.asyncIterator` but falls back to the - * string `"@@asyncIterator"` when `Symbol.asyncIterator` is not defined. - * - * Use `$$asyncIterator` for defining new AsyncIterables instead of - * `Symbol.asyncIterator`, but do not use it for accessing existing Iterables, - * instead use {@link getAsyncIterator} or {@link isAsyncIterable}. - * - * @example - * - * var $$asyncIterator = require('iterall').$$asyncIterator - * - * function Chirper (to) { - * this.to = to - * } - * - * Chirper.prototype[$$asyncIterator] = function () { - * return { - * to: this.to, - * num: 0, - * next () { - * return new Promise(resolve => { - * if (this.num >= this.to) { - * resolve({ value: undefined, done: true }) - * } else { - * setTimeout(() => { - * resolve({ value: this.num++, done: false }) - * }, 1000) - * } - * }) - * } - * } - * } - * - * var chirper = new Chirper(3) - * for await (var number of chirper) { - * console.log(number) // 0 ...wait... 1 ...wait... 2 - * } - * - * @type {Symbol|string} - */ -/*:: declare export var $$asyncIterator: '@@asyncIterator'; */ -export var $$asyncIterator = SYMBOL_ASYNC_ITERATOR || '@@asyncIterator' - -/** - * Returns true if the provided object implements the AsyncIterator protocol via - * either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method. - * - * @example - * - * var isAsyncIterable = require('iterall').isAsyncIterable - * isAsyncIterable(myStream) // true - * isAsyncIterable('ABC') // false - * - * @param obj - * A value which might implement the AsyncIterable protocol. - * @return {boolean} true if AsyncIterable. - */ -/*:: declare export function isAsyncIterable(obj: any): boolean; */ -export function isAsyncIterable(obj) { - return !!getAsyncIteratorMethod(obj) -} - -/** - * If the provided object implements the AsyncIterator protocol, its - * AsyncIterator object is returned. Otherwise returns undefined. - * - * @example - * - * var getAsyncIterator = require('iterall').getAsyncIterator - * var asyncIterator = getAsyncIterator(myStream) - * asyncIterator.next().then(console.log) // { value: 1, done: false } - * asyncIterator.next().then(console.log) // { value: 2, done: false } - * asyncIterator.next().then(console.log) // { value: 3, done: false } - * asyncIterator.next().then(console.log) // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {AsyncIterable} asyncIterable - * An AsyncIterable object which is the source of an AsyncIterator. - * @return {AsyncIterator} new AsyncIterator instance. - */ -/*:: declare export var getAsyncIterator: - & (<+TValue>(asyncIterable: AsyncIterable) => AsyncIterator) - & ((asyncIterable: mixed) => (void | AsyncIterator)); */ -export function getAsyncIterator(asyncIterable) { - var method = getAsyncIteratorMethod(asyncIterable) - if (method) { - return method.call(asyncIterable) - } -} - -/** - * If the provided object implements the AsyncIterator protocol, the method - * responsible for producing its AsyncIterator object is returned. - * - * This is used in rare cases for performance tuning. This method must be called - * with obj as the contextual this-argument. - * - * @example - * - * var getAsyncIteratorMethod = require('iterall').getAsyncIteratorMethod - * var method = getAsyncIteratorMethod(myStream) - * if (method) { - * var asyncIterator = method.call(myStream) - * } - * - * @template T the type of each iterated value - * @param {AsyncIterable} asyncIterable - * An AsyncIterable object which defines an `@@asyncIterator` method. - * @return {function(): AsyncIterator} `@@asyncIterator` method. - */ -/*:: declare export var getAsyncIteratorMethod: - & (<+TValue>(asyncIterable: AsyncIterable) => (() => AsyncIterator)) - & ((asyncIterable: mixed) => (void | (() => AsyncIterator))); */ -export function getAsyncIteratorMethod(asyncIterable) { - if (asyncIterable != null) { - var method = - (SYMBOL_ASYNC_ITERATOR && asyncIterable[SYMBOL_ASYNC_ITERATOR]) || - asyncIterable['@@asyncIterator'] - if (typeof method === 'function') { - return method - } - } -} - -/** - * Similar to {@link getAsyncIterator}, this method returns a new AsyncIterator - * given an AsyncIterable. However it will also create an AsyncIterator for a - * non-async Iterable as well as non-Iterable Array-like collection, such as - * Array in a pre-ES2015 environment. - * - * `createAsyncIterator` is complimentary to `forAwaitEach`, but allows a - * buffering "pull"-based iteration as opposed to `forAwaitEach`'s - * "push"-based iteration. - * - * `createAsyncIterator` produces an AsyncIterator for non-async Iterables as - * described in the ECMAScript proposal [Async-from-Sync Iterator Objects](https://tc39.github.io/proposal-async-iteration/#sec-async-from-sync-iterator-objects). - * - * > Note: Creating `AsyncIterator`s requires the existence of `Promise`. - * > While `Promise` has been available in modern browsers for a number of - * > years, legacy browsers (like IE 11) may require a polyfill. - * - * @example - * - * var createAsyncIterator = require('iterall').createAsyncIterator - * - * var myArraylike = { length: 3, 0: 'Alpha', 1: 'Bravo', 2: 'Charlie' } - * var iterator = createAsyncIterator(myArraylike) - * iterator.next().then(console.log) // { value: 'Alpha', done: false } - * iterator.next().then(console.log) // { value: 'Bravo', done: false } - * iterator.next().then(console.log) // { value: 'Charlie', done: false } - * iterator.next().then(console.log) // { value: undefined, done: true } - * - * @template T the type of each iterated value - * @param {AsyncIterable|Iterable|{ length: number }} source - * An AsyncIterable, Iterable, or Array-like object to produce an Iterator. - * @return {AsyncIterator} new AsyncIterator instance. - */ -/*:: declare export var createAsyncIterator: - & (<+TValue>( - collection: Iterable | TValue> | AsyncIterable - ) => AsyncIterator) - & ((collection: {length: number}) => AsyncIterator) - & ((collection: mixed) => (void | AsyncIterator)); */ -export function createAsyncIterator(source) { - if (source != null) { - var asyncIterator = getAsyncIterator(source) - if (asyncIterator) { - return asyncIterator - } - var iterator = createIterator(source) - if (iterator) { - return new AsyncFromSyncIterator(iterator) - } - } -} - -// When the object provided to `createAsyncIterator` is not AsyncIterable but is -// sync Iterable, this simple wrapper is created. -function AsyncFromSyncIterator(iterator) { - this._i = iterator -} - -// Note: all AsyncIterators are themselves AsyncIterable. -AsyncFromSyncIterator.prototype[$$asyncIterator] = function() { - return this -} - -// A simple state-machine determines the IteratorResult returned, yielding -// each value in the Array-like object in order of their indicies. -AsyncFromSyncIterator.prototype.next = function(value) { - return unwrapAsyncFromSync(this._i, 'next', value) -} - -AsyncFromSyncIterator.prototype.return = function(value) { - return this._i.return - ? unwrapAsyncFromSync(this._i, 'return', value) - : Promise.resolve({ value: value, done: true }) -} - -AsyncFromSyncIterator.prototype.throw = function(value) { - return this._i.throw - ? unwrapAsyncFromSync(this._i, 'throw', value) - : Promise.reject(value) -} - -function unwrapAsyncFromSync(iterator, fn, value) { - var step - return new Promise(function(resolve) { - step = iterator[fn](value) - resolve(step.value) - }).then(function(value) { - return { value: value, done: step.done } - }) -} - -/** - * Given an object which either implements the AsyncIterable protocol or is - * Array-like, iterate over it, calling the `callback` at each iteration. - * - * Use `forAwaitEach` where you would expect to use a [for-await-of](https://tc39.github.io/proposal-async-iteration/#sec-for-in-and-for-of-statements) loop. - * - * Similar to [Array#forEach][], the `callback` function accepts three - * arguments, and is provided with `thisArg` as the calling context. - * - * > Note: Using `forAwaitEach` requires the existence of `Promise`. - * > While `Promise` has been available in modern browsers for a number of - * > years, legacy browsers (like IE 11) may require a polyfill. - * - * @example - * - * var forAwaitEach = require('iterall').forAwaitEach - * - * forAwaitEach(myIterable, function (value, index, iterable) { - * console.log(value, index, iterable === myIterable) - * }) - * - * @example - * - * // ES2017: - * for await (let value of myAsyncIterable) { - * console.log(await doSomethingAsync(value)) - * } - * console.log('done') - * - * // Any JavaScript environment: - * forAwaitEach(myAsyncIterable, function (value) { - * return doSomethingAsync(value).then(console.log) - * }).then(function () { - * console.log('done') - * }) - * - * @template T the type of each iterated value - * @param {AsyncIterable|Iterable | T>|{ length: number }} source - * The AsyncIterable or array to iterate over. - * @param {function(T, number, object)} callback - * Function to execute for each iteration, taking up to three arguments - * @param [thisArg] - * Optional. Value to use as `this` when executing `callback`. - */ -/*:: declare export var forAwaitEach: - & (<+TValue, TCollection: Iterable | TValue> | AsyncIterable>( - collection: TCollection, - callbackFn: (value: TValue, index: number, collection: TCollection) => any, - thisArg?: any - ) => Promise) - & (( - collection: TCollection, - callbackFn: (value: mixed, index: number, collection: TCollection) => any, - thisArg?: any - ) => Promise); */ -export function forAwaitEach(source, callback, thisArg) { - var asyncIterator = createAsyncIterator(source) - if (asyncIterator) { - var i = 0 - return new Promise(function(resolve, reject) { - function next() { - asyncIterator - .next() - .then(function(step) { - if (!step.done) { - Promise.resolve(callback.call(thisArg, step.value, i++, source)) - .then(next) - .catch(reject) - } else { - resolve() - } - // Explicitly return null, silencing bluebird-style warnings. - return null - }) - .catch(reject) - // Explicitly return null, silencing bluebird-style warnings. - return null - } - next() - }) - } -} diff --git a/node_modules/iterall/package.json b/node_modules/iterall/package.json deleted file mode 100644 index 73df9a03..00000000 --- a/node_modules/iterall/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "iterall@^1.2.1", - "_id": "iterall@1.3.0", - "_inBundle": false, - "_integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==", - "_location": "/iterall", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "iterall@^1.2.1", - "name": "iterall", - "escapedName": "iterall", - "rawSpec": "^1.2.1", - "saveSpec": null, - "fetchSpec": "^1.2.1" - }, - "_requiredBy": [ - "/subscriptions-transport-ws" - ], - "_resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", - "_shasum": "afcb08492e2915cbd8a0884eb93a8c94d0d72fea", - "_spec": "iterall@^1.2.1", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/subscriptions-transport-ws", - "author": { - "name": "Lee Byron", - "email": "lee@leebyron.com", - "url": "http://leebyron.com/" - }, - "bugs": { - "url": "https://github.com/leebyron/iterall/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Minimal zero-dependency utilities for using JavaScript Iterables in all environments.", - "homepage": "https://github.com/leebyron/iterall", - "keywords": [ - "es6", - "iterator", - "iterable", - "polyfill", - "for-of" - ], - "license": "MIT", - "main": "index", - "module": "index.mjs", - "name": "iterall", - "repository": { - "type": "git", - "url": "git+https://github.com/leebyron/iterall.git" - }, - "typings": "index.d.ts", - "version": "1.3.0" -} diff --git a/node_modules/json-bigint/LICENSE b/node_modules/json-bigint/LICENSE deleted file mode 100644 index 9ab4d83b..00000000 --- a/node_modules/json-bigint/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Andrey Sidorov - -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. diff --git a/node_modules/json-bigint/README.md b/node_modules/json-bigint/README.md deleted file mode 100644 index e7335c73..00000000 --- a/node_modules/json-bigint/README.md +++ /dev/null @@ -1,240 +0,0 @@ -# json-bigint - -[![Build Status](https://secure.travis-ci.org/sidorares/json-bigint.png)](http://travis-ci.org/sidorares/json-bigint) -[![NPM](https://nodei.co/npm/json-bigint.png?downloads=true&stars=true)](https://nodei.co/npm/json-bigint/) - -JSON.parse/stringify with bigints support. Based on Douglas Crockford [JSON.js](https://github.com/douglascrockford/JSON-js) package and [bignumber.js](https://github.com/MikeMcl/bignumber.js) library. - -Native `Bigint` was added to JS recently, so we added an option to leverage it instead of `bignumber.js`. However, the parsing with native `BigInt` is kept an option for backward compability. - -While most JSON parsers assume numeric values have same precision restrictions as IEEE 754 double, JSON specification _does not_ say anything about number precision. Any floating point number in decimal (optionally scientific) notation is valid JSON value. It's a good idea to serialize values which might fall out of IEEE 754 integer precision as strings in your JSON api, but `{ "value" : 9223372036854775807}`, for example, is still a valid RFC4627 JSON string, and in most JS runtimes the result of `JSON.parse` is this object: `{ value: 9223372036854776000 }` - -========== - -example: - -```js -var JSONbig = require('json-bigint'); - -var json = '{ "value" : 9223372036854775807, "v2": 123 }'; -console.log('Input:', json); -console.log(''); - -console.log('node.js built-in JSON:'); -var r = JSON.parse(json); -console.log('JSON.parse(input).value : ', r.value.toString()); -console.log('JSON.stringify(JSON.parse(input)):', JSON.stringify(r)); - -console.log('\n\nbig number JSON:'); -var r1 = JSONbig.parse(json); -console.log('JSONbig.parse(input).value : ', r1.value.toString()); -console.log('JSONbig.stringify(JSONbig.parse(input)):', JSONbig.stringify(r1)); -``` - -Output: - -``` -Input: { "value" : 9223372036854775807, "v2": 123 } - -node.js built-in JSON: -JSON.parse(input).value : 9223372036854776000 -JSON.stringify(JSON.parse(input)): {"value":9223372036854776000,"v2":123} - - -big number JSON: -JSONbig.parse(input).value : 9223372036854775807 -JSONbig.stringify(JSONbig.parse(input)): {"value":9223372036854775807,"v2":123} -``` - -### Options - -The behaviour of the parser is somewhat configurable through 'options' - -#### options.strict, boolean, default false - -Specifies the parsing should be "strict" towards reporting duplicate-keys in the parsed string. -The default follows what is allowed in standard json and resembles the behavior of JSON.parse, but overwrites any previous values with the last one assigned to the duplicate-key. - -Setting options.strict = true will fail-fast on such duplicate-key occurances and thus warn you upfront of possible lost information. - -example: - -```js -var JSONbig = require('json-bigint'); -var JSONstrict = require('json-bigint')({ strict: true }); - -var dupkeys = '{ "dupkey": "value 1", "dupkey": "value 2"}'; -console.log('\n\nDuplicate Key test with both lenient and strict JSON parsing'); -console.log('Input:', dupkeys); -var works = JSONbig.parse(dupkeys); -console.log('JSON.parse(dupkeys).dupkey: %s', works.dupkey); -var fails = 'will stay like this'; -try { - fails = JSONstrict.parse(dupkeys); - console.log('ERROR!! Should never get here'); -} catch (e) { - console.log( - 'Succesfully catched expected exception on duplicate keys: %j', - e - ); -} -``` - -Output - -``` -Duplicate Key test with big number JSON -Input: { "dupkey": "value 1", "dupkey": "value 2"} -JSON.parse(dupkeys).dupkey: value 2 -Succesfully catched expected exception on duplicate keys: {"name":"SyntaxError","message":"Duplicate key \"dupkey\"","at":33,"text":"{ \"dupkey\": \"value 1\", \"dupkey\": \"value 2\"}"} - -``` - -#### options.storeAsString, boolean, default false - -Specifies if BigInts should be stored in the object as a string, rather than the default BigNumber. - -Note that this is a dangerous behavior as it breaks the default functionality of being able to convert back-and-forth without data type changes (as this will convert all BigInts to be-and-stay strings). - -example: - -```js -var JSONbig = require('json-bigint'); -var JSONbigString = require('json-bigint')({ storeAsString: true }); -var key = '{ "key": 1234567890123456789 }'; -console.log('\n\nStoring the BigInt as a string, instead of a BigNumber'); -console.log('Input:', key); -var withInt = JSONbig.parse(key); -var withString = JSONbigString.parse(key); -console.log( - 'Default type: %s, With option type: %s', - typeof withInt.key, - typeof withString.key -); -``` - -Output - -``` -Storing the BigInt as a string, instead of a BigNumber -Input: { "key": 1234567890123456789 } -Default type: object, With option type: string - -``` - -#### options.useNativeBigInt, boolean, default false - -Specifies if parser uses native BigInt instead of bignumber.js - -example: - -```js -var JSONbig = require('json-bigint'); -var JSONbigNative = require('json-bigint')({ useNativeBigInt: true }); -var key = '{ "key": 993143214321423154315154321 }'; -console.log(`\n\nStoring the Number as native BigInt, instead of a BigNumber`); -console.log('Input:', key); -var normal = JSONbig.parse(key); -var nativeBigInt = JSONbigNative.parse(key); -console.log( - 'Default type: %s, With option type: %s', - typeof normal.key, - typeof nativeBigInt.key -); -``` - -Output - -``` -Storing the Number as native BigInt, instead of a BigNumber -Input: { "key": 993143214321423154315154321 } -Default type: object, With option type: bigint - -``` - -#### options.alwaysParseAsBig, boolean, default false - -Specifies if all numbers should be stored as BigNumber. - -Note that this is a dangerous behavior as it breaks the default functionality of being able to convert back-and-forth without data type changes (as this will convert all Number to be-and-stay BigNumber) - -example: - -```js -var JSONbig = require('json-bigint'); -var JSONbigAlways = require('json-bigint')({ alwaysParseAsBig: true }); -var key = '{ "key": 123 }'; // there is no need for BigNumber by default, but we're forcing it -console.log(`\n\nStoring the Number as a BigNumber, instead of a Number`); -console.log('Input:', key); -var normal = JSONbig.parse(key); -var always = JSONbigAlways.parse(key); -console.log( - 'Default type: %s, With option type: %s', - typeof normal.key, - typeof always.key -); -``` - -Output - -``` -Storing the Number as a BigNumber, instead of a Number -Input: { "key": 123 } -Default type: number, With option type: object - -``` - -If you want to force all numbers to be parsed as native `BigInt` -(you probably do! Otherwise any calulations become a real headache): - -```js -var JSONbig = require('json-bigint')({ - alwaysParseAsBig: true, - useNativeBigInt: true, -}); -``` - -#### options.protoAction, boolean, default: "error". Possible values: "error", "ignore", "preserve" - -#### options.constructorAction, boolean, default: "error". Possible values: "error", "ignore", "preserve" - -Controls how `__proto__` and `constructor` properties are treated. If set to "error" they are not allowed and -parse() call will throw an error. If set to "ignore" the prroperty and it;s value is skipped from parsing and object building. -If set to "preserve" the `__proto__` property is set. One should be extra careful and make sure any other library consuming generated data -is not vulnerable to prototype poisoning attacks. - -example: - -```js -var JSONbigAlways = require('json-bigint')({ protoAction: 'ignore' }); -const user = JSONbig.parse('{ "__proto__": { "admin": true }, "id": 12345 }'); -// => result is { id: 12345 } -``` - -### Links: - -- [RFC4627: The application/json Media Type for JavaScript Object Notation (JSON)](http://www.ietf.org/rfc/rfc4627.txt) -- [Re: \[Json\] Limitations on number size?](http://www.ietf.org/mail-archive/web/json/current/msg00297.html) -- [Is there any proper way to parse JSON with large numbers? (long, bigint, int64)](http://stackoverflow.com/questions/18755125/node-js-is-there-any-proper-way-to-parse-json-with-large-numbers-long-bigint) -- [What is JavaScript's Max Int? What's the highest Integer value a Number can go to without losing precision?](http://stackoverflow.com/questions/307179/what-is-javascripts-max-int-whats-the-highest-integer-value-a-number-can-go-t) -- [Large numbers erroneously rounded in Javascript](http://stackoverflow.com/questions/1379934/large-numbers-erroneously-rounded-in-javascript) - -### Note on native BigInt support - -#### Stringifying - -Full support out-of-the-box, stringifies BigInts as pure numbers (no quotes, no `n`) - -#### Limitations - -- Roundtrip operations - -`s === JSONbig.stringify(JSONbig.parse(s))` but - -`o !== JSONbig.parse(JSONbig.stringify(o))` - -when `o` has a value with something like `123n`. - -`JSONbig` stringify `123n` as `123`, which becomes `number` (aka `123` not `123n`) by default when being reparsed. - -There is currently no consistent way to deal with this issue, so we decided to leave it, handling this specific case is then up to users. diff --git a/node_modules/json-bigint/index.js b/node_modules/json-bigint/index.js deleted file mode 100644 index 4757600b..00000000 --- a/node_modules/json-bigint/index.js +++ /dev/null @@ -1,12 +0,0 @@ -var json_stringify = require('./lib/stringify.js').stringify; -var json_parse = require('./lib/parse.js'); - -module.exports = function(options) { - return { - parse: json_parse(options), - stringify: json_stringify - } -}; -//create the default method members with no options applied for backwards compatibility -module.exports.parse = json_parse(); -module.exports.stringify = json_stringify; diff --git a/node_modules/json-bigint/lib/parse.js b/node_modules/json-bigint/lib/parse.js deleted file mode 100644 index bb4e5ebf..00000000 --- a/node_modules/json-bigint/lib/parse.js +++ /dev/null @@ -1,443 +0,0 @@ -var BigNumber = null; - -// regexpxs extracted from -// (c) BSD-3-Clause -// https://github.com/fastify/secure-json-parse/graphs/contributors and https://github.com/hapijs/bourne/graphs/contributors - -const suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/; -const suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/; - -/* - json_parse.js - 2012-06-20 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - This file creates a json_parse function. - During create you can (optionally) specify some behavioural switches - - require('json-bigint')(options) - - The optional options parameter holds switches that drive certain - aspects of the parsing process: - * options.strict = true will warn about duplicate-key usage in the json. - The default (strict = false) will silently ignore those and overwrite - values for keys that are in duplicate use. - - The resulting function follows this signature: - json_parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = json_parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - This is a reference implementation. You are free to copy, modify, or - redistribute. - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. -*/ - -/*members "", "\"", "\/", "\\", at, b, call, charAt, f, fromCharCode, - hasOwnProperty, message, n, name, prototype, push, r, t, text -*/ - -var json_parse = function (options) { - 'use strict'; - - // This is a function that can parse a JSON text, producing a JavaScript - // data structure. It is a simple, recursive descent parser. It does not use - // eval or regular expressions, so it can be used as a model for implementing - // a JSON parser in other languages. - - // We are defining the function inside of another function to avoid creating - // global variables. - - // Default options one can override by passing options to the parse() - var _options = { - strict: false, // not being strict means do not generate syntax errors for "duplicate key" - storeAsString: false, // toggles whether the values should be stored as BigNumber (default) or a string - alwaysParseAsBig: false, // toggles whether all numbers should be Big - useNativeBigInt: false, // toggles whether to use native BigInt instead of bignumber.js - protoAction: 'error', - constructorAction: 'error', - }; - - // If there are options, then use them to override the default _options - if (options !== undefined && options !== null) { - if (options.strict === true) { - _options.strict = true; - } - if (options.storeAsString === true) { - _options.storeAsString = true; - } - _options.alwaysParseAsBig = - options.alwaysParseAsBig === true ? options.alwaysParseAsBig : false; - _options.useNativeBigInt = - options.useNativeBigInt === true ? options.useNativeBigInt : false; - - if (typeof options.constructorAction !== 'undefined') { - if ( - options.constructorAction === 'error' || - options.constructorAction === 'ignore' || - options.constructorAction === 'preserve' - ) { - _options.constructorAction = options.constructorAction; - } else { - throw new Error( - `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${options.constructorAction}` - ); - } - } - - if (typeof options.protoAction !== 'undefined') { - if ( - options.protoAction === 'error' || - options.protoAction === 'ignore' || - options.protoAction === 'preserve' - ) { - _options.protoAction = options.protoAction; - } else { - throw new Error( - `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${options.protoAction}` - ); - } - } - } - - var at, // The index of the current character - ch, // The current character - escapee = { - '"': '"', - '\\': '\\', - '/': '/', - b: '\b', - f: '\f', - n: '\n', - r: '\r', - t: '\t', - }, - text, - error = function (m) { - // Call error when something is wrong. - - throw { - name: 'SyntaxError', - message: m, - at: at, - text: text, - }; - }, - next = function (c) { - // If a c parameter is provided, verify that it matches the current character. - - if (c && c !== ch) { - error("Expected '" + c + "' instead of '" + ch + "'"); - } - - // Get the next character. When there are no more characters, - // return the empty string. - - ch = text.charAt(at); - at += 1; - return ch; - }, - number = function () { - // Parse a number value. - - var number, - string = ''; - - if (ch === '-') { - string = '-'; - next('-'); - } - while (ch >= '0' && ch <= '9') { - string += ch; - next(); - } - if (ch === '.') { - string += '.'; - while (next() && ch >= '0' && ch <= '9') { - string += ch; - } - } - if (ch === 'e' || ch === 'E') { - string += ch; - next(); - if (ch === '-' || ch === '+') { - string += ch; - next(); - } - while (ch >= '0' && ch <= '9') { - string += ch; - next(); - } - } - number = +string; - if (!isFinite(number)) { - error('Bad number'); - } else { - if (BigNumber == null) BigNumber = require('bignumber.js'); - //if (number > 9007199254740992 || number < -9007199254740992) - // Bignumber has stricter check: everything with length > 15 digits disallowed - if (string.length > 15) - return _options.storeAsString - ? string - : _options.useNativeBigInt - ? BigInt(string) - : new BigNumber(string); - else - return !_options.alwaysParseAsBig - ? number - : _options.useNativeBigInt - ? BigInt(number) - : new BigNumber(number); - } - }, - string = function () { - // Parse a string value. - - var hex, - i, - string = '', - uffff; - - // When parsing for string values, we must look for " and \ characters. - - if (ch === '"') { - var startAt = at; - while (next()) { - if (ch === '"') { - if (at - 1 > startAt) string += text.substring(startAt, at - 1); - next(); - return string; - } - if (ch === '\\') { - if (at - 1 > startAt) string += text.substring(startAt, at - 1); - next(); - if (ch === 'u') { - uffff = 0; - for (i = 0; i < 4; i += 1) { - hex = parseInt(next(), 16); - if (!isFinite(hex)) { - break; - } - uffff = uffff * 16 + hex; - } - string += String.fromCharCode(uffff); - } else if (typeof escapee[ch] === 'string') { - string += escapee[ch]; - } else { - break; - } - startAt = at; - } - } - } - error('Bad string'); - }, - white = function () { - // Skip whitespace. - - while (ch && ch <= ' ') { - next(); - } - }, - word = function () { - // true, false, or null. - - switch (ch) { - case 't': - next('t'); - next('r'); - next('u'); - next('e'); - return true; - case 'f': - next('f'); - next('a'); - next('l'); - next('s'); - next('e'); - return false; - case 'n': - next('n'); - next('u'); - next('l'); - next('l'); - return null; - } - error("Unexpected '" + ch + "'"); - }, - value, // Place holder for the value function. - array = function () { - // Parse an array value. - - var array = []; - - if (ch === '[') { - next('['); - white(); - if (ch === ']') { - next(']'); - return array; // empty array - } - while (ch) { - array.push(value()); - white(); - if (ch === ']') { - next(']'); - return array; - } - next(','); - white(); - } - } - error('Bad array'); - }, - object = function () { - // Parse an object value. - - var key, - object = Object.create(null); - - if (ch === '{') { - next('{'); - white(); - if (ch === '}') { - next('}'); - return object; // empty object - } - while (ch) { - key = string(); - white(); - next(':'); - if ( - _options.strict === true && - Object.hasOwnProperty.call(object, key) - ) { - error('Duplicate key "' + key + '"'); - } - - if (suspectProtoRx.test(key) === true) { - if (_options.protoAction === 'error') { - error('Object contains forbidden prototype property'); - } else if (_options.protoAction === 'ignore') { - value(); - } else { - object[key] = value(); - } - } else if (suspectConstructorRx.test(key) === true) { - if (_options.constructorAction === 'error') { - error('Object contains forbidden constructor property'); - } else if (_options.constructorAction === 'ignore') { - value(); - } else { - object[key] = value(); - } - } else { - object[key] = value(); - } - - white(); - if (ch === '}') { - next('}'); - return object; - } - next(','); - white(); - } - } - error('Bad object'); - }; - - value = function () { - // Parse a JSON value. It could be an object, an array, a string, a number, - // or a word. - - white(); - switch (ch) { - case '{': - return object(); - case '[': - return array(); - case '"': - return string(); - case '-': - return number(); - default: - return ch >= '0' && ch <= '9' ? number() : word(); - } - }; - - // Return the json_parse function. It will have access to all of the above - // functions and variables. - - return function (source, reviver) { - var result; - - text = source + ''; - at = 0; - ch = ' '; - result = value(); - white(); - if (ch) { - error('Syntax error'); - } - - // If there is a reviver function, we recursively walk the new structure, - // passing each name/value pair to the reviver function for possible - // transformation, starting with a temporary root object that holds the result - // in an empty key. If there is not a reviver function, we simply return the - // result. - - return typeof reviver === 'function' - ? (function walk(holder, key) { - var k, - v, - value = holder[key]; - if (value && typeof value === 'object') { - Object.keys(value).forEach(function (k) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - }); - } - return reviver.call(holder, key, value); - })({ '': result }, '') - : result; - }; -}; - -module.exports = json_parse; diff --git a/node_modules/json-bigint/lib/stringify.js b/node_modules/json-bigint/lib/stringify.js deleted file mode 100644 index 3bd52699..00000000 --- a/node_modules/json-bigint/lib/stringify.js +++ /dev/null @@ -1,384 +0,0 @@ -var BigNumber = require('bignumber.js'); - -/* - json2.js - 2013-05-26 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, regexp: true */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -var JSON = module.exports; - -(function () { - 'use strict'; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' - ? c - : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key], - isBigNumber = value != null && (value instanceof BigNumber || BigNumber.isBigNumber(value)); - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - if (isBigNumber) { - return value; - } else { - return quote(value); - } - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - case 'bigint': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 - ? '[]' - : gap - ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' - : '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - Object.keys(value).forEach(function(k) { - var v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - }); - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 - ? '{}' - : gap - ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' - : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } -}()); diff --git a/node_modules/json-bigint/package.json b/node_modules/json-bigint/package.json deleted file mode 100644 index a264a0cc..00000000 --- a/node_modules/json-bigint/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_from": "json-bigint@^1.0.0", - "_id": "json-bigint@1.0.0", - "_inBundle": false, - "_integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "_location": "/json-bigint", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "json-bigint@^1.0.0", - "name": "json-bigint", - "escapedName": "json-bigint", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/gcp-metadata" - ], - "_resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "_shasum": "ae547823ac0cad8398667f8cd9ef4730f5b01ff1", - "_spec": "json-bigint@^1.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/gcp-metadata", - "author": { - "name": "Andrey Sidorov", - "email": "sidorares@yandex.ru" - }, - "bugs": { - "url": "https://github.com/sidorares/json-bigint/issues" - }, - "bundleDependencies": false, - "dependencies": { - "bignumber.js": "^9.0.0" - }, - "deprecated": false, - "description": "JSON.parse with bigints support", - "devDependencies": { - "chai": "4.2.0", - "mocha": "8.0.1" - }, - "files": [ - "index.js", - "lib/parse.js", - "lib/stringify.js" - ], - "homepage": "https://github.com/sidorares/json-bigint#readme", - "keywords": [ - "JSON", - "bigint", - "bignumber", - "parse", - "json" - ], - "license": "MIT", - "main": "index.js", - "name": "json-bigint", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/sidorares/json-bigint.git" - }, - "scripts": { - "test": "./node_modules/mocha/bin/mocha -R spec --check-leaks test/*-test.js" - }, - "version": "1.0.0" -} diff --git a/node_modules/json-stringify-safe/.npmignore b/node_modules/json-stringify-safe/.npmignore deleted file mode 100644 index 17d6b367..00000000 --- a/node_modules/json-stringify-safe/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/*.tgz diff --git a/node_modules/json-stringify-safe/CHANGELOG.md b/node_modules/json-stringify-safe/CHANGELOG.md deleted file mode 100644 index 42bcb60a..00000000 --- a/node_modules/json-stringify-safe/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -## Unreleased -- Fixes stringify to only take ancestors into account when checking - circularity. - It previously assumed every visited object was circular which led to [false - positives][issue9]. - Uses the tiny serializer I wrote for [Must.js][must] a year and a half ago. -- Fixes calling the `replacer` function in the proper context (`thisArg`). -- Fixes calling the `cycleReplacer` function in the proper context (`thisArg`). -- Speeds serializing by a factor of - Big-O(h-my-god-it-linearly-searched-every-object) it had ever seen. Searching - only the ancestors for a circular references speeds up things considerably. - -[must]: https://github.com/moll/js-must -[issue9]: https://github.com/isaacs/json-stringify-safe/issues/9 diff --git a/node_modules/json-stringify-safe/LICENSE b/node_modules/json-stringify-safe/LICENSE deleted file mode 100644 index 19129e31..00000000 --- a/node_modules/json-stringify-safe/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. diff --git a/node_modules/json-stringify-safe/Makefile b/node_modules/json-stringify-safe/Makefile deleted file mode 100644 index 36088c72..00000000 --- a/node_modules/json-stringify-safe/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -NODE_OPTS = -TEST_OPTS = - -love: - @echo "Feel like makin' love." - -test: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot $(TEST_OPTS) - -spec: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec $(TEST_OPTS) - -autotest: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot --watch $(TEST_OPTS) - -autospec: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec --watch $(TEST_OPTS) - -pack: - @file=$$(npm pack); echo "$$file"; tar tf "$$file" - -publish: - npm publish - -tag: - git tag "v$$(node -e 'console.log(require("./package").version)')" - -clean: - rm -f *.tgz - npm prune --production - -.PHONY: love -.PHONY: test spec autotest autospec -.PHONY: pack publish tag -.PHONY: clean diff --git a/node_modules/json-stringify-safe/README.md b/node_modules/json-stringify-safe/README.md deleted file mode 100644 index a11f302a..00000000 --- a/node_modules/json-stringify-safe/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# json-stringify-safe - -Like JSON.stringify, but doesn't throw on circular references. - -## Usage - -Takes the same arguments as `JSON.stringify`. - -```javascript -var stringify = require('json-stringify-safe'); -var circularObj = {}; -circularObj.circularRef = circularObj; -circularObj.list = [ circularObj, circularObj ]; -console.log(stringify(circularObj, null, 2)); -``` - -Output: - -```json -{ - "circularRef": "[Circular]", - "list": [ - "[Circular]", - "[Circular]" - ] -} -``` - -## Details - -``` -stringify(obj, serializer, indent, decycler) -``` - -The first three arguments are the same as to JSON.stringify. The last -is an argument that's only used when the object has been seen already. - -The default `decycler` function returns the string `'[Circular]'`. -If, for example, you pass in `function(k,v){}` (return nothing) then it -will prune cycles. If you pass in `function(k,v){ return {foo: 'bar'}}`, -then cyclical objects will always be represented as `{"foo":"bar"}` in -the result. - -``` -stringify.getSerialize(serializer, decycler) -``` - -Returns a serializer that can be used elsewhere. This is the actual -function that's passed to JSON.stringify. - -**Note** that the function returned from `getSerialize` is stateful for now, so -do **not** use it more than once. diff --git a/node_modules/json-stringify-safe/package.json b/node_modules/json-stringify-safe/package.json deleted file mode 100644 index 551b6925..00000000 --- a/node_modules/json-stringify-safe/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_from": "json-stringify-safe@^5.0.0", - "_id": "json-stringify-safe@5.0.1", - "_inBundle": false, - "_integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "_location": "/json-stringify-safe", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "json-stringify-safe@^5.0.0", - "name": "json-stringify-safe", - "escapedName": "json-stringify-safe", - "rawSpec": "^5.0.0", - "saveSpec": null, - "fetchSpec": "^5.0.0" - }, - "_requiredBy": [ - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "_shasum": "1296a2d58fd45f19a0f6ce01d65701e2c735b6eb", - "_spec": "json-stringify-safe@^5.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - "bugs": { - "url": "https://github.com/isaacs/json-stringify-safe/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Andri Möll", - "email": "andri@dot.ee", - "url": "http://themoll.com" - } - ], - "deprecated": false, - "description": "Like JSON.stringify, but doesn't blow up on circular refs.", - "devDependencies": { - "mocha": ">= 2.1.0 < 3", - "must": ">= 0.12 < 0.13", - "sinon": ">= 1.12.2 < 2" - }, - "homepage": "https://github.com/isaacs/json-stringify-safe", - "keywords": [ - "json", - "stringify", - "circular", - "safe" - ], - "license": "ISC", - "main": "stringify.js", - "name": "json-stringify-safe", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/json-stringify-safe.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "5.0.1" -} diff --git a/node_modules/json-stringify-safe/stringify.js b/node_modules/json-stringify-safe/stringify.js deleted file mode 100644 index 124a4521..00000000 --- a/node_modules/json-stringify-safe/stringify.js +++ /dev/null @@ -1,27 +0,0 @@ -exports = module.exports = stringify -exports.getSerialize = serializer - -function stringify(obj, replacer, spaces, cycleReplacer) { - return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces) -} - -function serializer(replacer, cycleReplacer) { - var stack = [], keys = [] - - if (cycleReplacer == null) cycleReplacer = function(key, value) { - if (stack[0] === value) return "[Circular ~]" - return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]" - } - - return function(key, value) { - if (stack.length > 0) { - var thisPos = stack.indexOf(this) - ~thisPos ? stack.splice(thisPos + 1) : stack.push(this) - ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key) - if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value) - } - else stack.push(value) - - return replacer == null ? value : replacer.call(this, key, value) - } -} diff --git a/node_modules/json-stringify-safe/test/mocha.opts b/node_modules/json-stringify-safe/test/mocha.opts deleted file mode 100644 index 2544e586..00000000 --- a/node_modules/json-stringify-safe/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---recursive ---require must diff --git a/node_modules/json-stringify-safe/test/stringify_test.js b/node_modules/json-stringify-safe/test/stringify_test.js deleted file mode 100644 index 5b325831..00000000 --- a/node_modules/json-stringify-safe/test/stringify_test.js +++ /dev/null @@ -1,246 +0,0 @@ -var Sinon = require("sinon") -var stringify = require("..") -function jsonify(obj) { return JSON.stringify(obj, null, 2) } - -describe("Stringify", function() { - it("must stringify circular objects", function() { - var obj = {name: "Alice"} - obj.self = obj - var json = stringify(obj, null, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - }) - - it("must stringify circular objects with intermediaries", function() { - var obj = {name: "Alice"} - obj.identity = {self: obj} - var json = stringify(obj, null, 2) - json.must.eql(jsonify({name: "Alice", identity: {self: "[Circular ~]"}})) - }) - - it("must stringify circular objects deeper", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - obj.child.self = obj.child - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - child: {name: "Bob", self: "[Circular ~.child]"} - })) - }) - - it("must stringify circular objects deeper with intermediaries", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - obj.child.identity = {self: obj.child} - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - child: {name: "Bob", identity: {self: "[Circular ~.child]"}} - })) - }) - - it("must stringify circular objects in an array", function() { - var obj = {name: "Alice"} - obj.self = [obj, obj] - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", self: ["[Circular ~]", "[Circular ~]"] - })) - }) - - it("must stringify circular objects deeper in an array", function() { - var obj = {name: "Alice", children: [{name: "Bob"}, {name: "Eve"}]} - obj.children[0].self = obj.children[0] - obj.children[1].self = obj.children[1] - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - children: [ - {name: "Bob", self: "[Circular ~.children.0]"}, - {name: "Eve", self: "[Circular ~.children.1]"} - ] - })) - }) - - it("must stringify circular arrays", function() { - var obj = [] - obj.push(obj) - obj.push(obj) - var json = stringify(obj, null, 2) - json.must.eql(jsonify(["[Circular ~]", "[Circular ~]"])) - }) - - it("must stringify circular arrays with intermediaries", function() { - var obj = [] - obj.push({name: "Alice", self: obj}) - obj.push({name: "Bob", self: obj}) - - stringify(obj, null, 2).must.eql(jsonify([ - {name: "Alice", self: "[Circular ~]"}, - {name: "Bob", self: "[Circular ~]"} - ])) - }) - - it("must stringify repeated objects in objects", function() { - var obj = {} - var alice = {name: "Alice"} - obj.alice1 = alice - obj.alice2 = alice - - stringify(obj, null, 2).must.eql(jsonify({ - alice1: {name: "Alice"}, - alice2: {name: "Alice"} - })) - }) - - it("must stringify repeated objects in arrays", function() { - var alice = {name: "Alice"} - var obj = [alice, alice] - var json = stringify(obj, null, 2) - json.must.eql(jsonify([{name: "Alice"}, {name: "Alice"}])) - }) - - it("must call given decycler and use its output", function() { - var obj = {} - obj.a = obj - obj.b = obj - - var decycle = Sinon.spy(function() { return decycle.callCount }) - var json = stringify(obj, null, 2, decycle) - json.must.eql(jsonify({a: 1, b: 2}, null, 2)) - - decycle.callCount.must.equal(2) - decycle.thisValues[0].must.equal(obj) - decycle.args[0][0].must.equal("a") - decycle.args[0][1].must.equal(obj) - decycle.thisValues[1].must.equal(obj) - decycle.args[1][0].must.equal("b") - decycle.args[1][1].must.equal(obj) - }) - - it("must call replacer and use its output", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - - var replacer = Sinon.spy(bangString) - var json = stringify(obj, replacer, 2) - json.must.eql(jsonify({name: "Alice!", child: {name: "Bob!"}})) - - replacer.callCount.must.equal(4) - replacer.args[0][0].must.equal("") - replacer.args[0][1].must.equal(obj) - replacer.thisValues[1].must.equal(obj) - replacer.args[1][0].must.equal("name") - replacer.args[1][1].must.equal("Alice") - replacer.thisValues[2].must.equal(obj) - replacer.args[2][0].must.equal("child") - replacer.args[2][1].must.equal(obj.child) - replacer.thisValues[3].must.equal(obj.child) - replacer.args[3][0].must.equal("name") - replacer.args[3][1].must.equal("Bob") - }) - - it("must call replacer after describing circular references", function() { - var obj = {name: "Alice"} - obj.self = obj - - var replacer = Sinon.spy(bangString) - var json = stringify(obj, replacer, 2) - json.must.eql(jsonify({name: "Alice!", self: "[Circular ~]!"})) - - replacer.callCount.must.equal(3) - replacer.args[0][0].must.equal("") - replacer.args[0][1].must.equal(obj) - replacer.thisValues[1].must.equal(obj) - replacer.args[1][0].must.equal("name") - replacer.args[1][1].must.equal("Alice") - replacer.thisValues[2].must.equal(obj) - replacer.args[2][0].must.equal("self") - replacer.args[2][1].must.equal("[Circular ~]") - }) - - it("must call given decycler and use its output for nested objects", - function() { - var obj = {} - obj.a = obj - obj.b = {self: obj} - - var decycle = Sinon.spy(function() { return decycle.callCount }) - var json = stringify(obj, null, 2, decycle) - json.must.eql(jsonify({a: 1, b: {self: 2}})) - - decycle.callCount.must.equal(2) - decycle.args[0][0].must.equal("a") - decycle.args[0][1].must.equal(obj) - decycle.args[1][0].must.equal("self") - decycle.args[1][1].must.equal(obj) - }) - - it("must use decycler's output when it returned null", function() { - var obj = {a: "b"} - obj.self = obj - obj.selves = [obj, obj] - - function decycle() { return null } - stringify(obj, null, 2, decycle).must.eql(jsonify({ - a: "b", - self: null, - selves: [null, null] - })) - }) - - it("must use decycler's output when it returned undefined", function() { - var obj = {a: "b"} - obj.self = obj - obj.selves = [obj, obj] - - function decycle() {} - stringify(obj, null, 2, decycle).must.eql(jsonify({ - a: "b", - selves: [null, null] - })) - }) - - it("must throw given a decycler that returns a cycle", function() { - var obj = {} - obj.self = obj - var err - function identity(key, value) { return value } - try { stringify(obj, null, 2, identity) } catch (ex) { err = ex } - err.must.be.an.instanceof(TypeError) - }) - - describe(".getSerialize", function() { - it("must stringify circular objects", function() { - var obj = {a: "b"} - obj.circularRef = obj - obj.list = [obj, obj] - - var json = JSON.stringify(obj, stringify.getSerialize(), 2) - json.must.eql(jsonify({ - "a": "b", - "circularRef": "[Circular ~]", - "list": ["[Circular ~]", "[Circular ~]"] - })) - }) - - // This is the behavior as of Mar 3, 2015. - // The serializer function keeps state inside the returned function and - // so far I'm not sure how to not do that. JSON.stringify's replacer is not - // called _after_ serialization. - xit("must return a function that could be called twice", function() { - var obj = {name: "Alice"} - obj.self = obj - - var json - var serializer = stringify.getSerialize() - - json = JSON.stringify(obj, serializer, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - - json = JSON.stringify(obj, serializer, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - }) - }) -}) - -function bangString(key, value) { - return typeof value == "string" ? value + "!" : value -} diff --git a/node_modules/jwa/LICENSE b/node_modules/jwa/LICENSE deleted file mode 100644 index caeb8495..00000000 --- a/node_modules/jwa/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Copyright (c) 2013 Brian J. Brennan - -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. diff --git a/node_modules/jwa/README.md b/node_modules/jwa/README.md deleted file mode 100644 index 09e96485..00000000 --- a/node_modules/jwa/README.md +++ /dev/null @@ -1,150 +0,0 @@ -# node-jwa [![Build Status](https://travis-ci.org/brianloveswords/node-jwa.svg?branch=master)](https://travis-ci.org/brianloveswords/node-jwa) - -A -[JSON Web Algorithms](http://tools.ietf.org/id/draft-ietf-jose-json-web-algorithms-08.html) -implementation focusing (exclusively, at this point) on the algorithms necessary for -[JSON Web Signatures](http://self-issued.info/docs/draft-ietf-jose-json-web-signature.html). - -This library supports all of the required, recommended and optional cryptographic algorithms for JWS: - -alg Parameter Value | Digital Signature or MAC Algorithm -----------------|---------------------------- -HS256 | HMAC using SHA-256 hash algorithm -HS384 | HMAC using SHA-384 hash algorithm -HS512 | HMAC using SHA-512 hash algorithm -RS256 | RSASSA using SHA-256 hash algorithm -RS384 | RSASSA using SHA-384 hash algorithm -RS512 | RSASSA using SHA-512 hash algorithm -PS256 | RSASSA-PSS using SHA-256 hash algorithm -PS384 | RSASSA-PSS using SHA-384 hash algorithm -PS512 | RSASSA-PSS using SHA-512 hash algorithm -ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm -ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm -ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm -none | No digital signature or MAC value included - -Please note that PS* only works on Node 6.12+ (excluding 7.x). - -# Requirements - -In order to run the tests, a recent version of OpenSSL is -required. **The version that comes with OS X (OpenSSL 0.9.8r 8 Feb -2011) is not recent enough**, as it does not fully support ECDSA -keys. You'll need to use a version > 1.0.0; I tested with OpenSSL 1.0.1c 10 May 2012. - -# Testing - -To run the tests, do - -```bash -$ npm test -``` - -This will generate a bunch of keypairs to use in testing. If you want to -generate new keypairs, do `make clean` before running `npm test` again. - -## Methodology - -I spawn `openssl dgst -sign` to test OpenSSL sign → JS verify and -`openssl dgst -verify` to test JS sign → OpenSSL verify for each of the -RSA and ECDSA algorithms. - -# Usage - -## jwa(algorithm) - -Creates a new `jwa` object with `sign` and `verify` methods for the -algorithm. Valid values for algorithm can be found in the table above -(`'HS256'`, `'HS384'`, etc) and are case-sensitive. Passing an invalid -algorithm value will throw a `TypeError`. - - -## jwa#sign(input, secretOrPrivateKey) - -Sign some input with either a secret for HMAC algorithms, or a private -key for RSA and ECDSA algorithms. - -If input is not already a string or buffer, `JSON.stringify` will be -called on it to attempt to coerce it. - -For the HMAC algorithm, `secretOrPrivateKey` should be a string or a -buffer. For ECDSA and RSA, the value should be a string representing a -PEM encoded **private** key. - -Output [base64url](http://en.wikipedia.org/wiki/Base64#URL_applications) -formatted. This is for convenience as JWS expects the signature in this -format. If your application needs the output in a different format, -[please open an issue](https://github.com/brianloveswords/node-jwa/issues). In -the meantime, you can use -[brianloveswords/base64url](https://github.com/brianloveswords/base64url) -to decode the signature. - -As of nodejs *v0.11.8*, SPKAC support was introduce. If your nodeJs -version satisfies, then you can pass an object `{ key: '..', passphrase: '...' }` - - -## jwa#verify(input, signature, secretOrPublicKey) - -Verify a signature. Returns `true` or `false`. - -`signature` should be a base64url encoded string. - -For the HMAC algorithm, `secretOrPublicKey` should be a string or a -buffer. For ECDSA and RSA, the value should be a string represented a -PEM encoded **public** key. - - -# Example - -HMAC -```js -const jwa = require('jwa'); - -const hmac = jwa('HS256'); -const input = 'super important stuff'; -const secret = 'shhhhhh'; - -const signature = hmac.sign(input, secret); -hmac.verify(input, signature, secret) // === true -hmac.verify(input, signature, 'trickery!') // === false -``` - -With keys -```js -const fs = require('fs'); -const jwa = require('jwa'); -const privateKey = fs.readFileSync(__dirname + '/ecdsa-p521-private.pem'); -const publicKey = fs.readFileSync(__dirname + '/ecdsa-p521-public.pem'); - -const ecdsa = jwa('ES512'); -const input = 'very important stuff'; - -const signature = ecdsa.sign(input, privateKey); -ecdsa.verify(input, signature, publicKey) // === true -``` -## License - -MIT - -``` -Copyright (c) 2013 Brian J. Brennan - -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. -``` diff --git a/node_modules/jwa/index.js b/node_modules/jwa/index.js deleted file mode 100644 index d2061efc..00000000 --- a/node_modules/jwa/index.js +++ /dev/null @@ -1,252 +0,0 @@ -var bufferEqual = require('buffer-equal-constant-time'); -var Buffer = require('safe-buffer').Buffer; -var crypto = require('crypto'); -var formatEcdsa = require('ecdsa-sig-formatter'); -var util = require('util'); - -var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".' -var MSG_INVALID_SECRET = 'secret must be a string or buffer'; -var MSG_INVALID_VERIFIER_KEY = 'key must be a string or a buffer'; -var MSG_INVALID_SIGNER_KEY = 'key must be a string, a buffer or an object'; - -var supportsKeyObjects = typeof crypto.createPublicKey === 'function'; -if (supportsKeyObjects) { - MSG_INVALID_VERIFIER_KEY += ' or a KeyObject'; - MSG_INVALID_SECRET += 'or a KeyObject'; -} - -function checkIsPublicKey(key) { - if (Buffer.isBuffer(key)) { - return; - } - - if (typeof key === 'string') { - return; - } - - if (!supportsKeyObjects) { - throw typeError(MSG_INVALID_VERIFIER_KEY); - } - - if (typeof key !== 'object') { - throw typeError(MSG_INVALID_VERIFIER_KEY); - } - - if (typeof key.type !== 'string') { - throw typeError(MSG_INVALID_VERIFIER_KEY); - } - - if (typeof key.asymmetricKeyType !== 'string') { - throw typeError(MSG_INVALID_VERIFIER_KEY); - } - - if (typeof key.export !== 'function') { - throw typeError(MSG_INVALID_VERIFIER_KEY); - } -}; - -function checkIsPrivateKey(key) { - if (Buffer.isBuffer(key)) { - return; - } - - if (typeof key === 'string') { - return; - } - - if (typeof key === 'object') { - return; - } - - throw typeError(MSG_INVALID_SIGNER_KEY); -}; - -function checkIsSecretKey(key) { - if (Buffer.isBuffer(key)) { - return; - } - - if (typeof key === 'string') { - return key; - } - - if (!supportsKeyObjects) { - throw typeError(MSG_INVALID_SECRET); - } - - if (typeof key !== 'object') { - throw typeError(MSG_INVALID_SECRET); - } - - if (key.type !== 'secret') { - throw typeError(MSG_INVALID_SECRET); - } - - if (typeof key.export !== 'function') { - throw typeError(MSG_INVALID_SECRET); - } -} - -function fromBase64(base64) { - return base64 - .replace(/=/g, '') - .replace(/\+/g, '-') - .replace(/\//g, '_'); -} - -function toBase64(base64url) { - base64url = base64url.toString(); - - var padding = 4 - base64url.length % 4; - if (padding !== 4) { - for (var i = 0; i < padding; ++i) { - base64url += '='; - } - } - - return base64url - .replace(/\-/g, '+') - .replace(/_/g, '/'); -} - -function typeError(template) { - var args = [].slice.call(arguments, 1); - var errMsg = util.format.bind(util, template).apply(null, args); - return new TypeError(errMsg); -} - -function bufferOrString(obj) { - return Buffer.isBuffer(obj) || typeof obj === 'string'; -} - -function normalizeInput(thing) { - if (!bufferOrString(thing)) - thing = JSON.stringify(thing); - return thing; -} - -function createHmacSigner(bits) { - return function sign(thing, secret) { - checkIsSecretKey(secret); - thing = normalizeInput(thing); - var hmac = crypto.createHmac('sha' + bits, secret); - var sig = (hmac.update(thing), hmac.digest('base64')) - return fromBase64(sig); - } -} - -function createHmacVerifier(bits) { - return function verify(thing, signature, secret) { - var computedSig = createHmacSigner(bits)(thing, secret); - return bufferEqual(Buffer.from(signature), Buffer.from(computedSig)); - } -} - -function createKeySigner(bits) { - return function sign(thing, privateKey) { - checkIsPrivateKey(privateKey); - thing = normalizeInput(thing); - // Even though we are specifying "RSA" here, this works with ECDSA - // keys as well. - var signer = crypto.createSign('RSA-SHA' + bits); - var sig = (signer.update(thing), signer.sign(privateKey, 'base64')); - return fromBase64(sig); - } -} - -function createKeyVerifier(bits) { - return function verify(thing, signature, publicKey) { - checkIsPublicKey(publicKey); - thing = normalizeInput(thing); - signature = toBase64(signature); - var verifier = crypto.createVerify('RSA-SHA' + bits); - verifier.update(thing); - return verifier.verify(publicKey, signature, 'base64'); - } -} - -function createPSSKeySigner(bits) { - return function sign(thing, privateKey) { - checkIsPrivateKey(privateKey); - thing = normalizeInput(thing); - var signer = crypto.createSign('RSA-SHA' + bits); - var sig = (signer.update(thing), signer.sign({ - key: privateKey, - padding: crypto.constants.RSA_PKCS1_PSS_PADDING, - saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST - }, 'base64')); - return fromBase64(sig); - } -} - -function createPSSKeyVerifier(bits) { - return function verify(thing, signature, publicKey) { - checkIsPublicKey(publicKey); - thing = normalizeInput(thing); - signature = toBase64(signature); - var verifier = crypto.createVerify('RSA-SHA' + bits); - verifier.update(thing); - return verifier.verify({ - key: publicKey, - padding: crypto.constants.RSA_PKCS1_PSS_PADDING, - saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST - }, signature, 'base64'); - } -} - -function createECDSASigner(bits) { - var inner = createKeySigner(bits); - return function sign() { - var signature = inner.apply(null, arguments); - signature = formatEcdsa.derToJose(signature, 'ES' + bits); - return signature; - }; -} - -function createECDSAVerifer(bits) { - var inner = createKeyVerifier(bits); - return function verify(thing, signature, publicKey) { - signature = formatEcdsa.joseToDer(signature, 'ES' + bits).toString('base64'); - var result = inner(thing, signature, publicKey); - return result; - }; -} - -function createNoneSigner() { - return function sign() { - return ''; - } -} - -function createNoneVerifier() { - return function verify(thing, signature) { - return signature === ''; - } -} - -module.exports = function jwa(algorithm) { - var signerFactories = { - hs: createHmacSigner, - rs: createKeySigner, - ps: createPSSKeySigner, - es: createECDSASigner, - none: createNoneSigner, - } - var verifierFactories = { - hs: createHmacVerifier, - rs: createKeyVerifier, - ps: createPSSKeyVerifier, - es: createECDSAVerifer, - none: createNoneVerifier, - } - var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/); - if (!match) - throw typeError(MSG_INVALID_ALGORITHM, algorithm); - var algo = (match[1] || match[3]).toLowerCase(); - var bits = match[2]; - - return { - sign: signerFactories[algo](bits), - verify: verifierFactories[algo](bits), - } -}; diff --git a/node_modules/jwa/package.json b/node_modules/jwa/package.json deleted file mode 100644 index a21b6023..00000000 --- a/node_modules/jwa/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "jwa@^2.0.0", - "_id": "jwa@2.0.0", - "_inBundle": false, - "_integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", - "_location": "/jwa", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "jwa@^2.0.0", - "name": "jwa", - "escapedName": "jwa", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/jws" - ], - "_resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", - "_shasum": "a7e9c3f29dae94027ebcaf49975c9345593410fc", - "_spec": "jwa@^2.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/jws", - "author": { - "name": "Brian J. Brennan", - "email": "brianloveswords@gmail.com" - }, - "bugs": { - "url": "https://github.com/brianloveswords/node-jwa/issues" - }, - "bundleDependencies": false, - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - }, - "deprecated": false, - "description": "JWA implementation (supports all JWS algorithms)", - "devDependencies": { - "base64url": "^2.0.0", - "jwk-to-pem": "^2.0.1", - "semver": "4.3.6", - "tap": "6.2.0" - }, - "directories": { - "test": "test" - }, - "homepage": "https://github.com/brianloveswords/node-jwa#readme", - "keywords": [ - "jwa", - "jws", - "jwt", - "rsa", - "ecdsa", - "hmac" - ], - "license": "MIT", - "main": "index.js", - "name": "jwa", - "repository": { - "type": "git", - "url": "git://github.com/brianloveswords/node-jwa.git" - }, - "scripts": { - "test": "make test" - }, - "version": "2.0.0" -} diff --git a/node_modules/jws/CHANGELOG.md b/node_modules/jws/CHANGELOG.md deleted file mode 100644 index af8fc287..00000000 --- a/node_modules/jws/CHANGELOG.md +++ /dev/null @@ -1,34 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. - -## [3.0.0] -### Changed -- **BREAKING**: `jwt.verify` now requires an `algorithm` parameter, and - `jws.createVerify` requires an `algorithm` option. The `"alg"` field - signature headers is ignored. This mitigates a critical security flaw - in the library which would allow an attacker to generate signatures with - arbitrary contents that would be accepted by `jwt.verify`. See - https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/ - for details. - -## [2.0.0] - 2015-01-30 -### Changed -- **BREAKING**: Default payload encoding changed from `binary` to - `utf8`. `utf8` is a is a more sensible default than `binary` because - many payloads, as far as I can tell, will contain user-facing - strings that could be in any language. ([6b6de48]) - -- Code reorganization, thanks [@fearphage]! ([7880050]) - -### Added -- Option in all relevant methods for `encoding`. For those few users - that might be depending on a `binary` encoding of the messages, this - is for them. ([6b6de48]) - -[unreleased]: https://github.com/brianloveswords/node-jws/compare/v2.0.0...HEAD -[2.0.0]: https://github.com/brianloveswords/node-jws/compare/v1.0.1...v2.0.0 - -[7880050]: https://github.com/brianloveswords/node-jws/commit/7880050 -[6b6de48]: https://github.com/brianloveswords/node-jws/commit/6b6de48 - -[@fearphage]: https://github.com/fearphage diff --git a/node_modules/jws/LICENSE b/node_modules/jws/LICENSE deleted file mode 100644 index caeb8495..00000000 --- a/node_modules/jws/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Copyright (c) 2013 Brian J. Brennan - -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. diff --git a/node_modules/jws/index.js b/node_modules/jws/index.js deleted file mode 100644 index 8c8da930..00000000 --- a/node_modules/jws/index.js +++ /dev/null @@ -1,22 +0,0 @@ -/*global exports*/ -var SignStream = require('./lib/sign-stream'); -var VerifyStream = require('./lib/verify-stream'); - -var ALGORITHMS = [ - 'HS256', 'HS384', 'HS512', - 'RS256', 'RS384', 'RS512', - 'PS256', 'PS384', 'PS512', - 'ES256', 'ES384', 'ES512' -]; - -exports.ALGORITHMS = ALGORITHMS; -exports.sign = SignStream.sign; -exports.verify = VerifyStream.verify; -exports.decode = VerifyStream.decode; -exports.isValid = VerifyStream.isValid; -exports.createSign = function createSign(opts) { - return new SignStream(opts); -}; -exports.createVerify = function createVerify(opts) { - return new VerifyStream(opts); -}; diff --git a/node_modules/jws/lib/data-stream.js b/node_modules/jws/lib/data-stream.js deleted file mode 100644 index 3535d31d..00000000 --- a/node_modules/jws/lib/data-stream.js +++ /dev/null @@ -1,55 +0,0 @@ -/*global module, process*/ -var Buffer = require('safe-buffer').Buffer; -var Stream = require('stream'); -var util = require('util'); - -function DataStream(data) { - this.buffer = null; - this.writable = true; - this.readable = true; - - // No input - if (!data) { - this.buffer = Buffer.alloc(0); - return this; - } - - // Stream - if (typeof data.pipe === 'function') { - this.buffer = Buffer.alloc(0); - data.pipe(this); - return this; - } - - // Buffer or String - // or Object (assumedly a passworded key) - if (data.length || typeof data === 'object') { - this.buffer = data; - this.writable = false; - process.nextTick(function () { - this.emit('end', data); - this.readable = false; - this.emit('close'); - }.bind(this)); - return this; - } - - throw new TypeError('Unexpected data type ('+ typeof data + ')'); -} -util.inherits(DataStream, Stream); - -DataStream.prototype.write = function write(data) { - this.buffer = Buffer.concat([this.buffer, Buffer.from(data)]); - this.emit('data', data); -}; - -DataStream.prototype.end = function end(data) { - if (data) - this.write(data); - this.emit('end', data); - this.emit('close'); - this.writable = false; - this.readable = false; -}; - -module.exports = DataStream; diff --git a/node_modules/jws/lib/sign-stream.js b/node_modules/jws/lib/sign-stream.js deleted file mode 100644 index 6a7ee42f..00000000 --- a/node_modules/jws/lib/sign-stream.js +++ /dev/null @@ -1,78 +0,0 @@ -/*global module*/ -var Buffer = require('safe-buffer').Buffer; -var DataStream = require('./data-stream'); -var jwa = require('jwa'); -var Stream = require('stream'); -var toString = require('./tostring'); -var util = require('util'); - -function base64url(string, encoding) { - return Buffer - .from(string, encoding) - .toString('base64') - .replace(/=/g, '') - .replace(/\+/g, '-') - .replace(/\//g, '_'); -} - -function jwsSecuredInput(header, payload, encoding) { - encoding = encoding || 'utf8'; - var encodedHeader = base64url(toString(header), 'binary'); - var encodedPayload = base64url(toString(payload), encoding); - return util.format('%s.%s', encodedHeader, encodedPayload); -} - -function jwsSign(opts) { - var header = opts.header; - var payload = opts.payload; - var secretOrKey = opts.secret || opts.privateKey; - var encoding = opts.encoding; - var algo = jwa(header.alg); - var securedInput = jwsSecuredInput(header, payload, encoding); - var signature = algo.sign(securedInput, secretOrKey); - return util.format('%s.%s', securedInput, signature); -} - -function SignStream(opts) { - var secret = opts.secret||opts.privateKey||opts.key; - var secretStream = new DataStream(secret); - this.readable = true; - this.header = opts.header; - this.encoding = opts.encoding; - this.secret = this.privateKey = this.key = secretStream; - this.payload = new DataStream(opts.payload); - this.secret.once('close', function () { - if (!this.payload.writable && this.readable) - this.sign(); - }.bind(this)); - - this.payload.once('close', function () { - if (!this.secret.writable && this.readable) - this.sign(); - }.bind(this)); -} -util.inherits(SignStream, Stream); - -SignStream.prototype.sign = function sign() { - try { - var signature = jwsSign({ - header: this.header, - payload: this.payload.buffer, - secret: this.secret.buffer, - encoding: this.encoding - }); - this.emit('done', signature); - this.emit('data', signature); - this.emit('end'); - this.readable = false; - return signature; - } catch (e) { - this.readable = false; - this.emit('error', e); - this.emit('close'); - } -}; - -SignStream.sign = jwsSign; - -module.exports = SignStream; diff --git a/node_modules/jws/lib/tostring.js b/node_modules/jws/lib/tostring.js deleted file mode 100644 index f5a49a36..00000000 --- a/node_modules/jws/lib/tostring.js +++ /dev/null @@ -1,10 +0,0 @@ -/*global module*/ -var Buffer = require('buffer').Buffer; - -module.exports = function toString(obj) { - if (typeof obj === 'string') - return obj; - if (typeof obj === 'number' || Buffer.isBuffer(obj)) - return obj.toString(); - return JSON.stringify(obj); -}; diff --git a/node_modules/jws/lib/verify-stream.js b/node_modules/jws/lib/verify-stream.js deleted file mode 100644 index 39f7c73e..00000000 --- a/node_modules/jws/lib/verify-stream.js +++ /dev/null @@ -1,120 +0,0 @@ -/*global module*/ -var Buffer = require('safe-buffer').Buffer; -var DataStream = require('./data-stream'); -var jwa = require('jwa'); -var Stream = require('stream'); -var toString = require('./tostring'); -var util = require('util'); -var JWS_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/; - -function isObject(thing) { - return Object.prototype.toString.call(thing) === '[object Object]'; -} - -function safeJsonParse(thing) { - if (isObject(thing)) - return thing; - try { return JSON.parse(thing); } - catch (e) { return undefined; } -} - -function headerFromJWS(jwsSig) { - var encodedHeader = jwsSig.split('.', 1)[0]; - return safeJsonParse(Buffer.from(encodedHeader, 'base64').toString('binary')); -} - -function securedInputFromJWS(jwsSig) { - return jwsSig.split('.', 2).join('.'); -} - -function signatureFromJWS(jwsSig) { - return jwsSig.split('.')[2]; -} - -function payloadFromJWS(jwsSig, encoding) { - encoding = encoding || 'utf8'; - var payload = jwsSig.split('.')[1]; - return Buffer.from(payload, 'base64').toString(encoding); -} - -function isValidJws(string) { - return JWS_REGEX.test(string) && !!headerFromJWS(string); -} - -function jwsVerify(jwsSig, algorithm, secretOrKey) { - if (!algorithm) { - var err = new Error("Missing algorithm parameter for jws.verify"); - err.code = "MISSING_ALGORITHM"; - throw err; - } - jwsSig = toString(jwsSig); - var signature = signatureFromJWS(jwsSig); - var securedInput = securedInputFromJWS(jwsSig); - var algo = jwa(algorithm); - return algo.verify(securedInput, signature, secretOrKey); -} - -function jwsDecode(jwsSig, opts) { - opts = opts || {}; - jwsSig = toString(jwsSig); - - if (!isValidJws(jwsSig)) - return null; - - var header = headerFromJWS(jwsSig); - - if (!header) - return null; - - var payload = payloadFromJWS(jwsSig); - if (header.typ === 'JWT' || opts.json) - payload = JSON.parse(payload, opts.encoding); - - return { - header: header, - payload: payload, - signature: signatureFromJWS(jwsSig) - }; -} - -function VerifyStream(opts) { - opts = opts || {}; - var secretOrKey = opts.secret||opts.publicKey||opts.key; - var secretStream = new DataStream(secretOrKey); - this.readable = true; - this.algorithm = opts.algorithm; - this.encoding = opts.encoding; - this.secret = this.publicKey = this.key = secretStream; - this.signature = new DataStream(opts.signature); - this.secret.once('close', function () { - if (!this.signature.writable && this.readable) - this.verify(); - }.bind(this)); - - this.signature.once('close', function () { - if (!this.secret.writable && this.readable) - this.verify(); - }.bind(this)); -} -util.inherits(VerifyStream, Stream); -VerifyStream.prototype.verify = function verify() { - try { - var valid = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer); - var obj = jwsDecode(this.signature.buffer, this.encoding); - this.emit('done', valid, obj); - this.emit('data', valid); - this.emit('end'); - this.readable = false; - return valid; - } catch (e) { - this.readable = false; - this.emit('error', e); - this.emit('close'); - } -}; - -VerifyStream.decode = jwsDecode; -VerifyStream.isValid = isValidJws; -VerifyStream.verify = jwsVerify; - -module.exports = VerifyStream; diff --git a/node_modules/jws/package.json b/node_modules/jws/package.json deleted file mode 100644 index ea7502f4..00000000 --- a/node_modules/jws/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "_from": "jws@^4.0.0", - "_id": "jws@4.0.0", - "_inBundle": false, - "_integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", - "_location": "/jws", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "jws@^4.0.0", - "name": "jws", - "escapedName": "jws", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/google-auth-library", - "/gtoken" - ], - "_resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "_shasum": "2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4", - "_spec": "jws@^4.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-auth-library", - "author": { - "name": "Brian J Brennan" - }, - "bugs": { - "url": "https://github.com/brianloveswords/node-jws/issues" - }, - "bundleDependencies": false, - "dependencies": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" - }, - "deprecated": false, - "description": "Implementation of JSON Web Signatures", - "devDependencies": { - "semver": "^5.1.0", - "tape": "~2.14.0" - }, - "directories": { - "test": "test" - }, - "gitHead": "c0f6b27bcea5a2ad2e304d91c2e842e4076a6b03", - "homepage": "https://github.com/brianloveswords/node-jws#readme", - "keywords": [ - "jws", - "json", - "web", - "signatures" - ], - "license": "MIT", - "main": "index.js", - "name": "jws", - "repository": { - "type": "git", - "url": "git://github.com/brianloveswords/node-jws.git" - }, - "scripts": { - "test": "make test" - }, - "version": "4.0.0" -} diff --git a/node_modules/jws/readme.md b/node_modules/jws/readme.md deleted file mode 100644 index 2f32dca9..00000000 --- a/node_modules/jws/readme.md +++ /dev/null @@ -1,255 +0,0 @@ -# node-jws [![Build Status](https://secure.travis-ci.org/brianloveswords/node-jws.svg)](http://travis-ci.org/brianloveswords/node-jws) - -An implementation of [JSON Web Signatures](http://self-issued.info/docs/draft-ietf-jose-json-web-signature.html). - -This was developed against `draft-ietf-jose-json-web-signature-08` and -implements the entire spec **except** X.509 Certificate Chain -signing/verifying (patches welcome). - -There are both synchronous (`jws.sign`, `jws.verify`) and streaming -(`jws.createSign`, `jws.createVerify`) APIs. - -# Install - -```bash -$ npm install jws -``` - -# Usage - -## jws.ALGORITHMS - -Array of supported algorithms. The following algorithms are currently supported. - -alg Parameter Value | Digital Signature or MAC Algorithm -----------------|---------------------------- -HS256 | HMAC using SHA-256 hash algorithm -HS384 | HMAC using SHA-384 hash algorithm -HS512 | HMAC using SHA-512 hash algorithm -RS256 | RSASSA using SHA-256 hash algorithm -RS384 | RSASSA using SHA-384 hash algorithm -RS512 | RSASSA using SHA-512 hash algorithm -PS256 | RSASSA-PSS using SHA-256 hash algorithm -PS384 | RSASSA-PSS using SHA-384 hash algorithm -PS512 | RSASSA-PSS using SHA-512 hash algorithm -ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm -ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm -ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm -none | No digital signature or MAC value included - -## jws.sign(options) - -(Synchronous) Return a JSON Web Signature for a header and a payload. - -Options: - -* `header` -* `payload` -* `secret` or `privateKey` -* `encoding` (Optional, defaults to 'utf8') - -`header` must be an object with an `alg` property. `header.alg` must be -one a value found in `jws.ALGORITHMS`. See above for a table of -supported algorithms. - -If `payload` is not a buffer or a string, it will be coerced into a string -using `JSON.stringify`. - -Example - -```js -const signature = jws.sign({ - header: { alg: 'HS256' }, - payload: 'h. jon benjamin', - secret: 'has a van', -}); -``` - -## jws.verify(signature, algorithm, secretOrKey) - -(Synchronous) Returns `true` or `false` for whether a signature matches a -secret or key. - -`signature` is a JWS Signature. `header.alg` must be a value found in `jws.ALGORITHMS`. -See above for a table of supported algorithms. `secretOrKey` is a string or -buffer containing either the secret for HMAC algorithms, or the PEM -encoded public key for RSA and ECDSA. - -Note that the `"alg"` value from the signature header is ignored. - - -## jws.decode(signature) - -(Synchronous) Returns the decoded header, decoded payload, and signature -parts of the JWS Signature. - -Returns an object with three properties, e.g. -```js -{ header: { alg: 'HS256' }, - payload: 'h. jon benjamin', - signature: 'YOWPewyGHKu4Y_0M_vtlEnNlqmFOclqp4Hy6hVHfFT4' -} -``` - -## jws.createSign(options) - -Returns a new SignStream object. - -Options: - -* `header` (required) -* `payload` -* `key` || `privateKey` || `secret` -* `encoding` (Optional, defaults to 'utf8') - -Other than `header`, all options expect a string or a buffer when the -value is known ahead of time, or a stream for convenience. -`key`/`privateKey`/`secret` may also be an object when using an encrypted -private key, see the [crypto documentation][encrypted-key-docs]. - -Example: - -```js - -// This... -jws.createSign({ - header: { alg: 'RS256' }, - privateKey: privateKeyStream, - payload: payloadStream, -}).on('done', function(signature) { - // ... -}); - -// is equivalent to this: -const signer = jws.createSign({ - header: { alg: 'RS256' }, -}); -privateKeyStream.pipe(signer.privateKey); -payloadStream.pipe(signer.payload); -signer.on('done', function(signature) { - // ... -}); -``` - -## jws.createVerify(options) - -Returns a new VerifyStream object. - -Options: - -* `signature` -* `algorithm` -* `key` || `publicKey` || `secret` -* `encoding` (Optional, defaults to 'utf8') - -All options expect a string or a buffer when the value is known ahead of -time, or a stream for convenience. - -Example: - -```js - -// This... -jws.createVerify({ - publicKey: pubKeyStream, - signature: sigStream, -}).on('done', function(verified, obj) { - // ... -}); - -// is equivilant to this: -const verifier = jws.createVerify(); -pubKeyStream.pipe(verifier.publicKey); -sigStream.pipe(verifier.signature); -verifier.on('done', function(verified, obj) { - // ... -}); -``` - -## Class: SignStream - -A `Readable Stream` that emits a single data event (the calculated -signature) when done. - -### Event: 'done' -`function (signature) { }` - -### signer.payload - -A `Writable Stream` that expects the JWS payload. Do *not* use if you -passed a `payload` option to the constructor. - -Example: - -```js -payloadStream.pipe(signer.payload); -``` - -### signer.secret
    signer.key
    signer.privateKey - -A `Writable Stream`. Expects the JWS secret for HMAC, or the privateKey -for ECDSA and RSA. Do *not* use if you passed a `secret` or `key` option -to the constructor. - -Example: - -```js -privateKeyStream.pipe(signer.privateKey); -``` - -## Class: VerifyStream - -This is a `Readable Stream` that emits a single data event, the result -of whether or not that signature was valid. - -### Event: 'done' -`function (valid, obj) { }` - -`valid` is a boolean for whether or not the signature is valid. - -### verifier.signature - -A `Writable Stream` that expects a JWS Signature. Do *not* use if you -passed a `signature` option to the constructor. - -### verifier.secret
    verifier.key
    verifier.publicKey - -A `Writable Stream` that expects a public key or secret. Do *not* use if you -passed a `key` or `secret` option to the constructor. - -# TODO - -* It feels like there should be some convenience options/APIs for - defining the algorithm rather than having to define a header object - with `{ alg: 'ES512' }` or whatever every time. - -* X.509 support, ugh - -# License - -MIT - -``` -Copyright (c) 2013-2015 Brian J. Brennan - -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. -``` - -[encrypted-key-docs]: https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format diff --git a/node_modules/lodash.camelcase/LICENSE b/node_modules/lodash.camelcase/LICENSE deleted file mode 100644 index e0c69d56..00000000 --- a/node_modules/lodash.camelcase/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Copyright jQuery Foundation and other contributors - -Based on Underscore.js, copyright Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -available at https://github.com/lodash/lodash - -The following license applies to all parts of this software except as -documented below: - -==== - -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. - -==== - -Copyright and related rights for sample code are waived via CC0. Sample -code is defined as all source code displayed within the prose of the -documentation. - -CC0: http://creativecommons.org/publicdomain/zero/1.0/ - -==== - -Files located in the node_modules and vendor directories are externally -maintained libraries used by this software which have their own -licenses; we recommend you read them, as their terms may differ from the -terms above. diff --git a/node_modules/lodash.camelcase/README.md b/node_modules/lodash.camelcase/README.md deleted file mode 100644 index 333d437c..00000000 --- a/node_modules/lodash.camelcase/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# lodash.camelcase v4.3.0 - -The [lodash](https://lodash.com/) method `_.camelCase` exported as a [Node.js](https://nodejs.org/) module. - -## Installation - -Using npm: -```bash -$ {sudo -H} npm i -g npm -$ npm i --save lodash.camelcase -``` - -In Node.js: -```js -var camelCase = require('lodash.camelcase'); -``` - -See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.camelcase) for more details. diff --git a/node_modules/lodash.camelcase/index.js b/node_modules/lodash.camelcase/index.js deleted file mode 100644 index b6d8b3cf..00000000 --- a/node_modules/lodash.camelcase/index.js +++ /dev/null @@ -1,599 +0,0 @@ -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; - -/** Used to match words composed of alphanumeric characters. */ -var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - -/** Used to match Latin Unicode letters (excluding mathematical operators). */ -var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - -/** Used to compose unicode character classes. */ -var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', - rsComboSymbolsRange = '\\u20d0-\\u20f0', - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - -/** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]", - rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - -/** Used to compose unicode regexes. */ -var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', - rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - -/** Used to match apostrophes. */ -var reApos = RegExp(rsApos, 'g'); - -/** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ -var reComboMark = RegExp(rsCombo, 'g'); - -/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - -/** Used to match complex or compound words. */ -var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', - rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, - rsUpper + '+' + rsOptUpperContr, - rsDigits, - rsEmoji -].join('|'), 'g'); - -/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ -var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); - -/** Used to detect strings that need a more robust regexp to match words. */ -var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - -/** Used to map Latin Unicode letters to basic Latin letters. */ -var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 'ss' -}; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array ? array.length : 0; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; -} - -/** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function asciiToArray(string) { - return string.split(''); -} - -/** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ -function asciiWords(string) { - return string.match(reAsciiWord) || []; -} - -/** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ -function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ -var deburrLetter = basePropertyOf(deburredLetters); - -/** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ -function hasUnicode(string) { - return reHasUnicode.test(string); -} - -/** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ -function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); -} - -/** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); -} - -/** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function unicodeToArray(string) { - return string.match(reUnicode) || []; -} - -/** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ -function unicodeWords(string) { - return string.match(reUnicodeWord) || []; -} - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Built-in value references. */ -var Symbol = root.Symbol; - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - -/** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ -function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; -} - -/** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ -function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} - -/** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ -function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); -} - -/** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ -function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; -} - -/** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ -function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); -} - -/** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {string} Returns the string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ -function toString(value) { - return value == null ? '' : baseToString(value); -} - -/** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ -var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); -}); - -/** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ -function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); -} - -/** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ -function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); -} - -/** - * Converts the first character of `string` to upper case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.upperFirst('fred'); - * // => 'Fred' - * - * _.upperFirst('FRED'); - * // => 'FRED' - */ -var upperFirst = createCaseFirst('toUpperCase'); - -/** - * Splits `string` into an array of its words. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {RegExp|string} [pattern] The pattern to match words. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the words of `string`. - * @example - * - * _.words('fred, barney, & pebbles'); - * // => ['fred', 'barney', 'pebbles'] - * - * _.words('fred, barney, & pebbles', /[^, ]+/g); - * // => ['fred', 'barney', '&', 'pebbles'] - */ -function words(string, pattern, guard) { - string = toString(string); - pattern = guard ? undefined : pattern; - - if (pattern === undefined) { - return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); - } - return string.match(pattern) || []; -} - -module.exports = camelCase; diff --git a/node_modules/lodash.camelcase/package.json b/node_modules/lodash.camelcase/package.json deleted file mode 100644 index fb749ae5..00000000 --- a/node_modules/lodash.camelcase/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_from": "lodash.camelcase@^4.3.0", - "_id": "lodash.camelcase@4.3.0", - "_inBundle": false, - "_integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", - "_location": "/lodash.camelcase", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "lodash.camelcase@^4.3.0", - "name": "lodash.camelcase", - "escapedName": "lodash.camelcase", - "rawSpec": "^4.3.0", - "saveSpec": null, - "fetchSpec": "^4.3.0" - }, - "_requiredBy": [ - "/@grpc/proto-loader" - ], - "_resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "_shasum": "b28aa6288a2b9fc651035c7711f65ab6190331a6", - "_spec": "lodash.camelcase@^4.3.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/@grpc/proto-loader", - "author": { - "name": "John-David Dalton", - "email": "john.david.dalton@gmail.com", - "url": "http://allyoucanleet.com/" - }, - "bugs": { - "url": "https://github.com/lodash/lodash/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "John-David Dalton", - "email": "john.david.dalton@gmail.com", - "url": "http://allyoucanleet.com/" - }, - { - "name": "Blaine Bublitz", - "email": "blaine.bublitz@gmail.com", - "url": "https://github.com/phated" - }, - { - "name": "Mathias Bynens", - "email": "mathias@qiwi.be", - "url": "https://mathiasbynens.be/" - } - ], - "deprecated": false, - "description": "The lodash method `_.camelCase` exported as a module.", - "homepage": "https://lodash.com/", - "icon": "https://lodash.com/icon.svg", - "keywords": [ - "lodash-modularized", - "camelcase" - ], - "license": "MIT", - "name": "lodash.camelcase", - "repository": { - "type": "git", - "url": "git+https://github.com/lodash/lodash.git" - }, - "scripts": { - "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" - }, - "version": "4.3.0" -} diff --git a/node_modules/lodash/LICENSE b/node_modules/lodash/LICENSE deleted file mode 100644 index 77c42f14..00000000 --- a/node_modules/lodash/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Copyright OpenJS Foundation and other contributors - -Based on Underscore.js, copyright Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -available at https://github.com/lodash/lodash - -The following license applies to all parts of this software except as -documented below: - -==== - -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. - -==== - -Copyright and related rights for sample code are waived via CC0. Sample -code is defined as all source code displayed within the prose of the -documentation. - -CC0: http://creativecommons.org/publicdomain/zero/1.0/ - -==== - -Files located in the node_modules and vendor directories are externally -maintained libraries used by this software which have their own -licenses; we recommend you read them, as their terms may differ from the -terms above. diff --git a/node_modules/lodash/README.md b/node_modules/lodash/README.md deleted file mode 100644 index 3ab1a05c..00000000 --- a/node_modules/lodash/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# lodash v4.17.21 - -The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. - -## Installation - -Using npm: -```shell -$ npm i -g npm -$ npm i --save lodash -``` - -In Node.js: -```js -// Load the full build. -var _ = require('lodash'); -// Load the core build. -var _ = require('lodash/core'); -// Load the FP build for immutable auto-curried iteratee-first data-last methods. -var fp = require('lodash/fp'); - -// Load method categories. -var array = require('lodash/array'); -var object = require('lodash/fp/object'); - -// Cherry-pick methods for smaller browserify/rollup/webpack bundles. -var at = require('lodash/at'); -var curryN = require('lodash/fp/curryN'); -``` - -See the [package source](https://github.com/lodash/lodash/tree/4.17.21-npm) for more details. - -**Note:**
    -Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. - -## Support - -Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.
    -Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. diff --git a/node_modules/lodash/_DataView.js b/node_modules/lodash/_DataView.js deleted file mode 100644 index ac2d57ca..00000000 --- a/node_modules/lodash/_DataView.js +++ /dev/null @@ -1,7 +0,0 @@ -var getNative = require('./_getNative'), - root = require('./_root'); - -/* Built-in method references that are verified to be native. */ -var DataView = getNative(root, 'DataView'); - -module.exports = DataView; diff --git a/node_modules/lodash/_Hash.js b/node_modules/lodash/_Hash.js deleted file mode 100644 index b504fe34..00000000 --- a/node_modules/lodash/_Hash.js +++ /dev/null @@ -1,32 +0,0 @@ -var hashClear = require('./_hashClear'), - hashDelete = require('./_hashDelete'), - hashGet = require('./_hashGet'), - hashHas = require('./_hashHas'), - hashSet = require('./_hashSet'); - -/** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -// Add methods to `Hash`. -Hash.prototype.clear = hashClear; -Hash.prototype['delete'] = hashDelete; -Hash.prototype.get = hashGet; -Hash.prototype.has = hashHas; -Hash.prototype.set = hashSet; - -module.exports = Hash; diff --git a/node_modules/lodash/_LazyWrapper.js b/node_modules/lodash/_LazyWrapper.js deleted file mode 100644 index 81786c7f..00000000 --- a/node_modules/lodash/_LazyWrapper.js +++ /dev/null @@ -1,28 +0,0 @@ -var baseCreate = require('./_baseCreate'), - baseLodash = require('./_baseLodash'); - -/** Used as references for the maximum length and index of an array. */ -var MAX_ARRAY_LENGTH = 4294967295; - -/** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @constructor - * @param {*} value The value to wrap. - */ -function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; -} - -// Ensure `LazyWrapper` is an instance of `baseLodash`. -LazyWrapper.prototype = baseCreate(baseLodash.prototype); -LazyWrapper.prototype.constructor = LazyWrapper; - -module.exports = LazyWrapper; diff --git a/node_modules/lodash/_ListCache.js b/node_modules/lodash/_ListCache.js deleted file mode 100644 index 26895c3a..00000000 --- a/node_modules/lodash/_ListCache.js +++ /dev/null @@ -1,32 +0,0 @@ -var listCacheClear = require('./_listCacheClear'), - listCacheDelete = require('./_listCacheDelete'), - listCacheGet = require('./_listCacheGet'), - listCacheHas = require('./_listCacheHas'), - listCacheSet = require('./_listCacheSet'); - -/** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -// Add methods to `ListCache`. -ListCache.prototype.clear = listCacheClear; -ListCache.prototype['delete'] = listCacheDelete; -ListCache.prototype.get = listCacheGet; -ListCache.prototype.has = listCacheHas; -ListCache.prototype.set = listCacheSet; - -module.exports = ListCache; diff --git a/node_modules/lodash/_LodashWrapper.js b/node_modules/lodash/_LodashWrapper.js deleted file mode 100644 index c1e4d9df..00000000 --- a/node_modules/lodash/_LodashWrapper.js +++ /dev/null @@ -1,22 +0,0 @@ -var baseCreate = require('./_baseCreate'), - baseLodash = require('./_baseLodash'); - -/** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ -function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; -} - -LodashWrapper.prototype = baseCreate(baseLodash.prototype); -LodashWrapper.prototype.constructor = LodashWrapper; - -module.exports = LodashWrapper; diff --git a/node_modules/lodash/_Map.js b/node_modules/lodash/_Map.js deleted file mode 100644 index b73f29a0..00000000 --- a/node_modules/lodash/_Map.js +++ /dev/null @@ -1,7 +0,0 @@ -var getNative = require('./_getNative'), - root = require('./_root'); - -/* Built-in method references that are verified to be native. */ -var Map = getNative(root, 'Map'); - -module.exports = Map; diff --git a/node_modules/lodash/_MapCache.js b/node_modules/lodash/_MapCache.js deleted file mode 100644 index 4a4eea7b..00000000 --- a/node_modules/lodash/_MapCache.js +++ /dev/null @@ -1,32 +0,0 @@ -var mapCacheClear = require('./_mapCacheClear'), - mapCacheDelete = require('./_mapCacheDelete'), - mapCacheGet = require('./_mapCacheGet'), - mapCacheHas = require('./_mapCacheHas'), - mapCacheSet = require('./_mapCacheSet'); - -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -// Add methods to `MapCache`. -MapCache.prototype.clear = mapCacheClear; -MapCache.prototype['delete'] = mapCacheDelete; -MapCache.prototype.get = mapCacheGet; -MapCache.prototype.has = mapCacheHas; -MapCache.prototype.set = mapCacheSet; - -module.exports = MapCache; diff --git a/node_modules/lodash/_Promise.js b/node_modules/lodash/_Promise.js deleted file mode 100644 index 247b9e1b..00000000 --- a/node_modules/lodash/_Promise.js +++ /dev/null @@ -1,7 +0,0 @@ -var getNative = require('./_getNative'), - root = require('./_root'); - -/* Built-in method references that are verified to be native. */ -var Promise = getNative(root, 'Promise'); - -module.exports = Promise; diff --git a/node_modules/lodash/_Set.js b/node_modules/lodash/_Set.js deleted file mode 100644 index b3c8dcbf..00000000 --- a/node_modules/lodash/_Set.js +++ /dev/null @@ -1,7 +0,0 @@ -var getNative = require('./_getNative'), - root = require('./_root'); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -module.exports = Set; diff --git a/node_modules/lodash/_SetCache.js b/node_modules/lodash/_SetCache.js deleted file mode 100644 index 6468b064..00000000 --- a/node_modules/lodash/_SetCache.js +++ /dev/null @@ -1,27 +0,0 @@ -var MapCache = require('./_MapCache'), - setCacheAdd = require('./_setCacheAdd'), - setCacheHas = require('./_setCacheHas'); - -/** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } -} - -// Add methods to `SetCache`. -SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; -SetCache.prototype.has = setCacheHas; - -module.exports = SetCache; diff --git a/node_modules/lodash/_Stack.js b/node_modules/lodash/_Stack.js deleted file mode 100644 index 80b2cf1b..00000000 --- a/node_modules/lodash/_Stack.js +++ /dev/null @@ -1,27 +0,0 @@ -var ListCache = require('./_ListCache'), - stackClear = require('./_stackClear'), - stackDelete = require('./_stackDelete'), - stackGet = require('./_stackGet'), - stackHas = require('./_stackHas'), - stackSet = require('./_stackSet'); - -/** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; -} - -// Add methods to `Stack`. -Stack.prototype.clear = stackClear; -Stack.prototype['delete'] = stackDelete; -Stack.prototype.get = stackGet; -Stack.prototype.has = stackHas; -Stack.prototype.set = stackSet; - -module.exports = Stack; diff --git a/node_modules/lodash/_Symbol.js b/node_modules/lodash/_Symbol.js deleted file mode 100644 index a013f7c5..00000000 --- a/node_modules/lodash/_Symbol.js +++ /dev/null @@ -1,6 +0,0 @@ -var root = require('./_root'); - -/** Built-in value references. */ -var Symbol = root.Symbol; - -module.exports = Symbol; diff --git a/node_modules/lodash/_Uint8Array.js b/node_modules/lodash/_Uint8Array.js deleted file mode 100644 index 2fb30e15..00000000 --- a/node_modules/lodash/_Uint8Array.js +++ /dev/null @@ -1,6 +0,0 @@ -var root = require('./_root'); - -/** Built-in value references. */ -var Uint8Array = root.Uint8Array; - -module.exports = Uint8Array; diff --git a/node_modules/lodash/_WeakMap.js b/node_modules/lodash/_WeakMap.js deleted file mode 100644 index 567f86c6..00000000 --- a/node_modules/lodash/_WeakMap.js +++ /dev/null @@ -1,7 +0,0 @@ -var getNative = require('./_getNative'), - root = require('./_root'); - -/* Built-in method references that are verified to be native. */ -var WeakMap = getNative(root, 'WeakMap'); - -module.exports = WeakMap; diff --git a/node_modules/lodash/_apply.js b/node_modules/lodash/_apply.js deleted file mode 100644 index 36436dda..00000000 --- a/node_modules/lodash/_apply.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ -function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); -} - -module.exports = apply; diff --git a/node_modules/lodash/_arrayAggregator.js b/node_modules/lodash/_arrayAggregator.js deleted file mode 100644 index d96c3ca4..00000000 --- a/node_modules/lodash/_arrayAggregator.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A specialized version of `baseAggregator` for arrays. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ -function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; -} - -module.exports = arrayAggregator; diff --git a/node_modules/lodash/_arrayEach.js b/node_modules/lodash/_arrayEach.js deleted file mode 100644 index 2c5f5796..00000000 --- a/node_modules/lodash/_arrayEach.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; -} - -module.exports = arrayEach; diff --git a/node_modules/lodash/_arrayEachRight.js b/node_modules/lodash/_arrayEachRight.js deleted file mode 100644 index 976ca5c2..00000000 --- a/node_modules/lodash/_arrayEachRight.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A specialized version of `_.forEachRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; - - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; -} - -module.exports = arrayEachRight; diff --git a/node_modules/lodash/_arrayEvery.js b/node_modules/lodash/_arrayEvery.js deleted file mode 100644 index e26a9184..00000000 --- a/node_modules/lodash/_arrayEvery.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A specialized version of `_.every` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - */ -function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; -} - -module.exports = arrayEvery; diff --git a/node_modules/lodash/_arrayFilter.js b/node_modules/lodash/_arrayFilter.js deleted file mode 100644 index 75ea2544..00000000 --- a/node_modules/lodash/_arrayFilter.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ -function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; -} - -module.exports = arrayFilter; diff --git a/node_modules/lodash/_arrayIncludes.js b/node_modules/lodash/_arrayIncludes.js deleted file mode 100644 index 3737a6d9..00000000 --- a/node_modules/lodash/_arrayIncludes.js +++ /dev/null @@ -1,17 +0,0 @@ -var baseIndexOf = require('./_baseIndexOf'); - -/** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ -function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; -} - -module.exports = arrayIncludes; diff --git a/node_modules/lodash/_arrayIncludesWith.js b/node_modules/lodash/_arrayIncludesWith.js deleted file mode 100644 index 235fd975..00000000 --- a/node_modules/lodash/_arrayIncludesWith.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ -function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; -} - -module.exports = arrayIncludesWith; diff --git a/node_modules/lodash/_arrayLikeKeys.js b/node_modules/lodash/_arrayLikeKeys.js deleted file mode 100644 index b2ec9ce7..00000000 --- a/node_modules/lodash/_arrayLikeKeys.js +++ /dev/null @@ -1,49 +0,0 @@ -var baseTimes = require('./_baseTimes'), - isArguments = require('./isArguments'), - isArray = require('./isArray'), - isBuffer = require('./isBuffer'), - isIndex = require('./_isIndex'), - isTypedArray = require('./isTypedArray'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ -function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; -} - -module.exports = arrayLikeKeys; diff --git a/node_modules/lodash/_arrayMap.js b/node_modules/lodash/_arrayMap.js deleted file mode 100644 index 22b22464..00000000 --- a/node_modules/lodash/_arrayMap.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; -} - -module.exports = arrayMap; diff --git a/node_modules/lodash/_arrayPush.js b/node_modules/lodash/_arrayPush.js deleted file mode 100644 index 7d742b38..00000000 --- a/node_modules/lodash/_arrayPush.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ -function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; -} - -module.exports = arrayPush; diff --git a/node_modules/lodash/_arrayReduce.js b/node_modules/lodash/_arrayReduce.js deleted file mode 100644 index de8b79b2..00000000 --- a/node_modules/lodash/_arrayReduce.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array == null ? 0 : array.length; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; -} - -module.exports = arrayReduce; diff --git a/node_modules/lodash/_arrayReduceRight.js b/node_modules/lodash/_arrayReduceRight.js deleted file mode 100644 index 22d8976d..00000000 --- a/node_modules/lodash/_arrayReduceRight.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * A specialized version of `_.reduceRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array == null ? 0 : array.length; - if (initAccum && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; -} - -module.exports = arrayReduceRight; diff --git a/node_modules/lodash/_arraySample.js b/node_modules/lodash/_arraySample.js deleted file mode 100644 index fcab0105..00000000 --- a/node_modules/lodash/_arraySample.js +++ /dev/null @@ -1,15 +0,0 @@ -var baseRandom = require('./_baseRandom'); - -/** - * A specialized version of `_.sample` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @returns {*} Returns the random element. - */ -function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined; -} - -module.exports = arraySample; diff --git a/node_modules/lodash/_arraySampleSize.js b/node_modules/lodash/_arraySampleSize.js deleted file mode 100644 index 8c7e364f..00000000 --- a/node_modules/lodash/_arraySampleSize.js +++ /dev/null @@ -1,17 +0,0 @@ -var baseClamp = require('./_baseClamp'), - copyArray = require('./_copyArray'), - shuffleSelf = require('./_shuffleSelf'); - -/** - * A specialized version of `_.sampleSize` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ -function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); -} - -module.exports = arraySampleSize; diff --git a/node_modules/lodash/_arrayShuffle.js b/node_modules/lodash/_arrayShuffle.js deleted file mode 100644 index 46313a39..00000000 --- a/node_modules/lodash/_arrayShuffle.js +++ /dev/null @@ -1,15 +0,0 @@ -var copyArray = require('./_copyArray'), - shuffleSelf = require('./_shuffleSelf'); - -/** - * A specialized version of `_.shuffle` for arrays. - * - * @private - * @param {Array} array The array to shuffle. - * @returns {Array} Returns the new shuffled array. - */ -function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); -} - -module.exports = arrayShuffle; diff --git a/node_modules/lodash/_arraySome.js b/node_modules/lodash/_arraySome.js deleted file mode 100644 index 6fd02fd4..00000000 --- a/node_modules/lodash/_arraySome.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ -function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; -} - -module.exports = arraySome; diff --git a/node_modules/lodash/_asciiSize.js b/node_modules/lodash/_asciiSize.js deleted file mode 100644 index 11d29c33..00000000 --- a/node_modules/lodash/_asciiSize.js +++ /dev/null @@ -1,12 +0,0 @@ -var baseProperty = require('./_baseProperty'); - -/** - * Gets the size of an ASCII `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ -var asciiSize = baseProperty('length'); - -module.exports = asciiSize; diff --git a/node_modules/lodash/_asciiToArray.js b/node_modules/lodash/_asciiToArray.js deleted file mode 100644 index 8e3dd5b4..00000000 --- a/node_modules/lodash/_asciiToArray.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function asciiToArray(string) { - return string.split(''); -} - -module.exports = asciiToArray; diff --git a/node_modules/lodash/_asciiWords.js b/node_modules/lodash/_asciiWords.js deleted file mode 100644 index d765f0f7..00000000 --- a/node_modules/lodash/_asciiWords.js +++ /dev/null @@ -1,15 +0,0 @@ -/** Used to match words composed of alphanumeric characters. */ -var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - -/** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ -function asciiWords(string) { - return string.match(reAsciiWord) || []; -} - -module.exports = asciiWords; diff --git a/node_modules/lodash/_assignMergeValue.js b/node_modules/lodash/_assignMergeValue.js deleted file mode 100644 index cb1185e9..00000000 --- a/node_modules/lodash/_assignMergeValue.js +++ /dev/null @@ -1,20 +0,0 @@ -var baseAssignValue = require('./_baseAssignValue'), - eq = require('./eq'); - -/** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ -function assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } -} - -module.exports = assignMergeValue; diff --git a/node_modules/lodash/_assignValue.js b/node_modules/lodash/_assignValue.js deleted file mode 100644 index 40839575..00000000 --- a/node_modules/lodash/_assignValue.js +++ /dev/null @@ -1,28 +0,0 @@ -var baseAssignValue = require('./_baseAssignValue'), - eq = require('./eq'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ -function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } -} - -module.exports = assignValue; diff --git a/node_modules/lodash/_assocIndexOf.js b/node_modules/lodash/_assocIndexOf.js deleted file mode 100644 index 5b77a2bd..00000000 --- a/node_modules/lodash/_assocIndexOf.js +++ /dev/null @@ -1,21 +0,0 @@ -var eq = require('./eq'); - -/** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; -} - -module.exports = assocIndexOf; diff --git a/node_modules/lodash/_baseAggregator.js b/node_modules/lodash/_baseAggregator.js deleted file mode 100644 index 4bc9e91f..00000000 --- a/node_modules/lodash/_baseAggregator.js +++ /dev/null @@ -1,21 +0,0 @@ -var baseEach = require('./_baseEach'); - -/** - * Aggregates elements of `collection` on `accumulator` with keys transformed - * by `iteratee` and values set by `setter`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ -function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function(value, key, collection) { - setter(accumulator, value, iteratee(value), collection); - }); - return accumulator; -} - -module.exports = baseAggregator; diff --git a/node_modules/lodash/_baseAssign.js b/node_modules/lodash/_baseAssign.js deleted file mode 100644 index e5c4a1a5..00000000 --- a/node_modules/lodash/_baseAssign.js +++ /dev/null @@ -1,17 +0,0 @@ -var copyObject = require('./_copyObject'), - keys = require('./keys'); - -/** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); -} - -module.exports = baseAssign; diff --git a/node_modules/lodash/_baseAssignIn.js b/node_modules/lodash/_baseAssignIn.js deleted file mode 100644 index 6624f900..00000000 --- a/node_modules/lodash/_baseAssignIn.js +++ /dev/null @@ -1,17 +0,0 @@ -var copyObject = require('./_copyObject'), - keysIn = require('./keysIn'); - -/** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); -} - -module.exports = baseAssignIn; diff --git a/node_modules/lodash/_baseAssignValue.js b/node_modules/lodash/_baseAssignValue.js deleted file mode 100644 index d6f66ef3..00000000 --- a/node_modules/lodash/_baseAssignValue.js +++ /dev/null @@ -1,25 +0,0 @@ -var defineProperty = require('./_defineProperty'); - -/** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ -function baseAssignValue(object, key, value) { - if (key == '__proto__' && defineProperty) { - defineProperty(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } -} - -module.exports = baseAssignValue; diff --git a/node_modules/lodash/_baseAt.js b/node_modules/lodash/_baseAt.js deleted file mode 100644 index 90e4237a..00000000 --- a/node_modules/lodash/_baseAt.js +++ /dev/null @@ -1,23 +0,0 @@ -var get = require('./get'); - -/** - * The base implementation of `_.at` without support for individual paths. - * - * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths to pick. - * @returns {Array} Returns the picked elements. - */ -function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; - - while (++index < length) { - result[index] = skip ? undefined : get(object, paths[index]); - } - return result; -} - -module.exports = baseAt; diff --git a/node_modules/lodash/_baseClamp.js b/node_modules/lodash/_baseClamp.js deleted file mode 100644 index a1c56929..00000000 --- a/node_modules/lodash/_baseClamp.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * The base implementation of `_.clamp` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - */ -function baseClamp(number, lower, upper) { - if (number === number) { - if (upper !== undefined) { - number = number <= upper ? number : upper; - } - if (lower !== undefined) { - number = number >= lower ? number : lower; - } - } - return number; -} - -module.exports = baseClamp; diff --git a/node_modules/lodash/_baseClone.js b/node_modules/lodash/_baseClone.js deleted file mode 100644 index 69f87054..00000000 --- a/node_modules/lodash/_baseClone.js +++ /dev/null @@ -1,166 +0,0 @@ -var Stack = require('./_Stack'), - arrayEach = require('./_arrayEach'), - assignValue = require('./_assignValue'), - baseAssign = require('./_baseAssign'), - baseAssignIn = require('./_baseAssignIn'), - cloneBuffer = require('./_cloneBuffer'), - copyArray = require('./_copyArray'), - copySymbols = require('./_copySymbols'), - copySymbolsIn = require('./_copySymbolsIn'), - getAllKeys = require('./_getAllKeys'), - getAllKeysIn = require('./_getAllKeysIn'), - getTag = require('./_getTag'), - initCloneArray = require('./_initCloneArray'), - initCloneByTag = require('./_initCloneByTag'), - initCloneObject = require('./_initCloneObject'), - isArray = require('./isArray'), - isBuffer = require('./isBuffer'), - isMap = require('./isMap'), - isObject = require('./isObject'), - isSet = require('./isSet'), - keys = require('./keys'), - keysIn = require('./keysIn'); - -/** Used to compose bitmasks for cloning. */ -var CLONE_DEEP_FLAG = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG = 4; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** Used to identify `toStringTag` values supported by `_.clone`. */ -var cloneableTags = {}; -cloneableTags[argsTag] = cloneableTags[arrayTag] = -cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = -cloneableTags[boolTag] = cloneableTags[dateTag] = -cloneableTags[float32Tag] = cloneableTags[float64Tag] = -cloneableTags[int8Tag] = cloneableTags[int16Tag] = -cloneableTags[int32Tag] = cloneableTags[mapTag] = -cloneableTags[numberTag] = cloneableTags[objectTag] = -cloneableTags[regexpTag] = cloneableTags[setTag] = -cloneableTags[stringTag] = cloneableTags[symbolTag] = -cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = -cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; -cloneableTags[errorTag] = cloneableTags[funcTag] = -cloneableTags[weakMapTag] = false; - -/** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ -function baseClone(value, bitmask, customizer, key, object, stack) { - var result, - isDeep = bitmask & CLONE_DEEP_FLAG, - isFlat = bitmask & CLONE_FLAT_FLAG, - isFull = bitmask & CLONE_SYMBOLS_FLAG; - - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = (isFlat || isFunc) ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - } - - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); - - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - return result; -} - -module.exports = baseClone; diff --git a/node_modules/lodash/_baseConforms.js b/node_modules/lodash/_baseConforms.js deleted file mode 100644 index 947e20d4..00000000 --- a/node_modules/lodash/_baseConforms.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseConformsTo = require('./_baseConformsTo'), - keys = require('./keys'); - -/** - * The base implementation of `_.conforms` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. - */ -function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; -} - -module.exports = baseConforms; diff --git a/node_modules/lodash/_baseConformsTo.js b/node_modules/lodash/_baseConformsTo.js deleted file mode 100644 index e449cb84..00000000 --- a/node_modules/lodash/_baseConformsTo.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * The base implementation of `_.conformsTo` which accepts `props` to check. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - */ -function baseConformsTo(object, source, props) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object(object); - while (length--) { - var key = props[length], - predicate = source[key], - value = object[key]; - - if ((value === undefined && !(key in object)) || !predicate(value)) { - return false; - } - } - return true; -} - -module.exports = baseConformsTo; diff --git a/node_modules/lodash/_baseCreate.js b/node_modules/lodash/_baseCreate.js deleted file mode 100644 index ffa6a52a..00000000 --- a/node_modules/lodash/_baseCreate.js +++ /dev/null @@ -1,30 +0,0 @@ -var isObject = require('./isObject'); - -/** Built-in value references. */ -var objectCreate = Object.create; - -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ -var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; -}()); - -module.exports = baseCreate; diff --git a/node_modules/lodash/_baseDelay.js b/node_modules/lodash/_baseDelay.js deleted file mode 100644 index 1486d697..00000000 --- a/node_modules/lodash/_baseDelay.js +++ /dev/null @@ -1,21 +0,0 @@ -/** Error message constants. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. - */ -function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); -} - -module.exports = baseDelay; diff --git a/node_modules/lodash/_baseDifference.js b/node_modules/lodash/_baseDifference.js deleted file mode 100644 index 343ac19f..00000000 --- a/node_modules/lodash/_baseDifference.js +++ /dev/null @@ -1,67 +0,0 @@ -var SetCache = require('./_SetCache'), - arrayIncludes = require('./_arrayIncludes'), - arrayIncludesWith = require('./_arrayIncludesWith'), - arrayMap = require('./_arrayMap'), - baseUnary = require('./_baseUnary'), - cacheHas = require('./_cacheHas'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** - * The base implementation of methods like `_.difference` without support - * for excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ -function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; -} - -module.exports = baseDifference; diff --git a/node_modules/lodash/_baseEach.js b/node_modules/lodash/_baseEach.js deleted file mode 100644 index 512c0676..00000000 --- a/node_modules/lodash/_baseEach.js +++ /dev/null @@ -1,14 +0,0 @@ -var baseForOwn = require('./_baseForOwn'), - createBaseEach = require('./_createBaseEach'); - -/** - * The base implementation of `_.forEach` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ -var baseEach = createBaseEach(baseForOwn); - -module.exports = baseEach; diff --git a/node_modules/lodash/_baseEachRight.js b/node_modules/lodash/_baseEachRight.js deleted file mode 100644 index 0a8feeca..00000000 --- a/node_modules/lodash/_baseEachRight.js +++ /dev/null @@ -1,14 +0,0 @@ -var baseForOwnRight = require('./_baseForOwnRight'), - createBaseEach = require('./_createBaseEach'); - -/** - * The base implementation of `_.forEachRight` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ -var baseEachRight = createBaseEach(baseForOwnRight, true); - -module.exports = baseEachRight; diff --git a/node_modules/lodash/_baseEvery.js b/node_modules/lodash/_baseEvery.js deleted file mode 100644 index fa52f7bc..00000000 --- a/node_modules/lodash/_baseEvery.js +++ /dev/null @@ -1,21 +0,0 @@ -var baseEach = require('./_baseEach'); - -/** - * The base implementation of `_.every` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` - */ -function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; -} - -module.exports = baseEvery; diff --git a/node_modules/lodash/_baseExtremum.js b/node_modules/lodash/_baseExtremum.js deleted file mode 100644 index 9d6aa77e..00000000 --- a/node_modules/lodash/_baseExtremum.js +++ /dev/null @@ -1,32 +0,0 @@ -var isSymbol = require('./isSymbol'); - -/** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ -function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; -} - -module.exports = baseExtremum; diff --git a/node_modules/lodash/_baseFill.js b/node_modules/lodash/_baseFill.js deleted file mode 100644 index 46ef9c76..00000000 --- a/node_modules/lodash/_baseFill.js +++ /dev/null @@ -1,32 +0,0 @@ -var toInteger = require('./toInteger'), - toLength = require('./toLength'); - -/** - * The base implementation of `_.fill` without an iteratee call guard. - * - * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - */ -function baseFill(array, value, start, end) { - var length = array.length; - - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; -} - -module.exports = baseFill; diff --git a/node_modules/lodash/_baseFilter.js b/node_modules/lodash/_baseFilter.js deleted file mode 100644 index 46784773..00000000 --- a/node_modules/lodash/_baseFilter.js +++ /dev/null @@ -1,21 +0,0 @@ -var baseEach = require('./_baseEach'); - -/** - * The base implementation of `_.filter` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ -function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; -} - -module.exports = baseFilter; diff --git a/node_modules/lodash/_baseFindIndex.js b/node_modules/lodash/_baseFindIndex.js deleted file mode 100644 index e3f5d8aa..00000000 --- a/node_modules/lodash/_baseFindIndex.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; -} - -module.exports = baseFindIndex; diff --git a/node_modules/lodash/_baseFindKey.js b/node_modules/lodash/_baseFindKey.js deleted file mode 100644 index 2e430f3a..00000000 --- a/node_modules/lodash/_baseFindKey.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the found element or its key, else `undefined`. - */ -function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = key; - return false; - } - }); - return result; -} - -module.exports = baseFindKey; diff --git a/node_modules/lodash/_baseFlatten.js b/node_modules/lodash/_baseFlatten.js deleted file mode 100644 index 4b1e009b..00000000 --- a/node_modules/lodash/_baseFlatten.js +++ /dev/null @@ -1,38 +0,0 @@ -var arrayPush = require('./_arrayPush'), - isFlattenable = require('./_isFlattenable'); - -/** - * The base implementation of `_.flatten` with support for restricting flattening. - * - * @private - * @param {Array} array The array to flatten. - * @param {number} depth The maximum recursion depth. - * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. - * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. - */ -function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, - length = array.length; - - predicate || (predicate = isFlattenable); - result || (result = []); - - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; -} - -module.exports = baseFlatten; diff --git a/node_modules/lodash/_baseFor.js b/node_modules/lodash/_baseFor.js deleted file mode 100644 index d946590f..00000000 --- a/node_modules/lodash/_baseFor.js +++ /dev/null @@ -1,16 +0,0 @@ -var createBaseFor = require('./_createBaseFor'); - -/** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseFor = createBaseFor(); - -module.exports = baseFor; diff --git a/node_modules/lodash/_baseForOwn.js b/node_modules/lodash/_baseForOwn.js deleted file mode 100644 index 503d5234..00000000 --- a/node_modules/lodash/_baseForOwn.js +++ /dev/null @@ -1,16 +0,0 @@ -var baseFor = require('./_baseFor'), - keys = require('./keys'); - -/** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); -} - -module.exports = baseForOwn; diff --git a/node_modules/lodash/_baseForOwnRight.js b/node_modules/lodash/_baseForOwnRight.js deleted file mode 100644 index a4b10e6c..00000000 --- a/node_modules/lodash/_baseForOwnRight.js +++ /dev/null @@ -1,16 +0,0 @@ -var baseForRight = require('./_baseForRight'), - keys = require('./keys'); - -/** - * The base implementation of `_.forOwnRight` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); -} - -module.exports = baseForOwnRight; diff --git a/node_modules/lodash/_baseForRight.js b/node_modules/lodash/_baseForRight.js deleted file mode 100644 index 32842cd8..00000000 --- a/node_modules/lodash/_baseForRight.js +++ /dev/null @@ -1,15 +0,0 @@ -var createBaseFor = require('./_createBaseFor'); - -/** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseForRight = createBaseFor(true); - -module.exports = baseForRight; diff --git a/node_modules/lodash/_baseFunctions.js b/node_modules/lodash/_baseFunctions.js deleted file mode 100644 index d23bc9b4..00000000 --- a/node_modules/lodash/_baseFunctions.js +++ /dev/null @@ -1,19 +0,0 @@ -var arrayFilter = require('./_arrayFilter'), - isFunction = require('./isFunction'); - -/** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. - */ -function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); -} - -module.exports = baseFunctions; diff --git a/node_modules/lodash/_baseGet.js b/node_modules/lodash/_baseGet.js deleted file mode 100644 index a194913d..00000000 --- a/node_modules/lodash/_baseGet.js +++ /dev/null @@ -1,24 +0,0 @@ -var castPath = require('./_castPath'), - toKey = require('./_toKey'); - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = castPath(path, object); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - return (index && index == length) ? object : undefined; -} - -module.exports = baseGet; diff --git a/node_modules/lodash/_baseGetAllKeys.js b/node_modules/lodash/_baseGetAllKeys.js deleted file mode 100644 index 8ad204ea..00000000 --- a/node_modules/lodash/_baseGetAllKeys.js +++ /dev/null @@ -1,20 +0,0 @@ -var arrayPush = require('./_arrayPush'), - isArray = require('./isArray'); - -/** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ -function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); -} - -module.exports = baseGetAllKeys; diff --git a/node_modules/lodash/_baseGetTag.js b/node_modules/lodash/_baseGetTag.js deleted file mode 100644 index b927ccc1..00000000 --- a/node_modules/lodash/_baseGetTag.js +++ /dev/null @@ -1,28 +0,0 @@ -var Symbol = require('./_Symbol'), - getRawTag = require('./_getRawTag'), - objectToString = require('./_objectToString'); - -/** `Object#toString` result references. */ -var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - -/** Built-in value references. */ -var symToStringTag = Symbol ? Symbol.toStringTag : undefined; - -/** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); -} - -module.exports = baseGetTag; diff --git a/node_modules/lodash/_baseGt.js b/node_modules/lodash/_baseGt.js deleted file mode 100644 index 502d273c..00000000 --- a/node_modules/lodash/_baseGt.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ -function baseGt(value, other) { - return value > other; -} - -module.exports = baseGt; diff --git a/node_modules/lodash/_baseHas.js b/node_modules/lodash/_baseHas.js deleted file mode 100644 index 1b730321..00000000 --- a/node_modules/lodash/_baseHas.js +++ /dev/null @@ -1,19 +0,0 @@ -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); -} - -module.exports = baseHas; diff --git a/node_modules/lodash/_baseHasIn.js b/node_modules/lodash/_baseHasIn.js deleted file mode 100644 index 2e0d0426..00000000 --- a/node_modules/lodash/_baseHasIn.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * The base implementation of `_.hasIn` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHasIn(object, key) { - return object != null && key in Object(object); -} - -module.exports = baseHasIn; diff --git a/node_modules/lodash/_baseInRange.js b/node_modules/lodash/_baseInRange.js deleted file mode 100644 index ec956661..00000000 --- a/node_modules/lodash/_baseInRange.js +++ /dev/null @@ -1,18 +0,0 @@ -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max, - nativeMin = Math.min; - -/** - * The base implementation of `_.inRange` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to check. - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - */ -function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); -} - -module.exports = baseInRange; diff --git a/node_modules/lodash/_baseIndexOf.js b/node_modules/lodash/_baseIndexOf.js deleted file mode 100644 index 167e706e..00000000 --- a/node_modules/lodash/_baseIndexOf.js +++ /dev/null @@ -1,20 +0,0 @@ -var baseFindIndex = require('./_baseFindIndex'), - baseIsNaN = require('./_baseIsNaN'), - strictIndexOf = require('./_strictIndexOf'); - -/** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); -} - -module.exports = baseIndexOf; diff --git a/node_modules/lodash/_baseIndexOfWith.js b/node_modules/lodash/_baseIndexOfWith.js deleted file mode 100644 index f815fe0d..00000000 --- a/node_modules/lodash/_baseIndexOfWith.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This function is like `baseIndexOf` except that it accepts a comparator. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @param {Function} comparator The comparator invoked per element. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } - } - return -1; -} - -module.exports = baseIndexOfWith; diff --git a/node_modules/lodash/_baseIntersection.js b/node_modules/lodash/_baseIntersection.js deleted file mode 100644 index c1d250c2..00000000 --- a/node_modules/lodash/_baseIntersection.js +++ /dev/null @@ -1,74 +0,0 @@ -var SetCache = require('./_SetCache'), - arrayIncludes = require('./_arrayIncludes'), - arrayIncludesWith = require('./_arrayIncludesWith'), - arrayMap = require('./_arrayMap'), - baseUnary = require('./_baseUnary'), - cacheHas = require('./_cacheHas'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMin = Math.min; - -/** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ -function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - length = arrays[0].length, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - maxLength = Infinity, - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - maxLength = nativeMin(array.length, maxLength); - caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - seen = caches[0]; - - outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) - )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) - ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -module.exports = baseIntersection; diff --git a/node_modules/lodash/_baseInverter.js b/node_modules/lodash/_baseInverter.js deleted file mode 100644 index fbc337f0..00000000 --- a/node_modules/lodash/_baseInverter.js +++ /dev/null @@ -1,21 +0,0 @@ -var baseForOwn = require('./_baseForOwn'); - -/** - * The base implementation of `_.invert` and `_.invertBy` which inverts - * `object` with values transformed by `iteratee` and set by `setter`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform values. - * @param {Object} accumulator The initial inverted object. - * @returns {Function} Returns `accumulator`. - */ -function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function(value, key, object) { - setter(accumulator, iteratee(value), key, object); - }); - return accumulator; -} - -module.exports = baseInverter; diff --git a/node_modules/lodash/_baseInvoke.js b/node_modules/lodash/_baseInvoke.js deleted file mode 100644 index 49bcf3c3..00000000 --- a/node_modules/lodash/_baseInvoke.js +++ /dev/null @@ -1,24 +0,0 @@ -var apply = require('./_apply'), - castPath = require('./_castPath'), - last = require('./last'), - parent = require('./_parent'), - toKey = require('./_toKey'); - -/** - * The base implementation of `_.invoke` without support for individual - * method arguments. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - */ -function baseInvoke(object, path, args) { - path = castPath(path, object); - object = parent(object, path); - var func = object == null ? object : object[toKey(last(path))]; - return func == null ? undefined : apply(func, object, args); -} - -module.exports = baseInvoke; diff --git a/node_modules/lodash/_baseIsArguments.js b/node_modules/lodash/_baseIsArguments.js deleted file mode 100644 index b3562cca..00000000 --- a/node_modules/lodash/_baseIsArguments.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]'; - -/** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ -function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; -} - -module.exports = baseIsArguments; diff --git a/node_modules/lodash/_baseIsArrayBuffer.js b/node_modules/lodash/_baseIsArrayBuffer.js deleted file mode 100644 index a2c4f30a..00000000 --- a/node_modules/lodash/_baseIsArrayBuffer.js +++ /dev/null @@ -1,17 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -var arrayBufferTag = '[object ArrayBuffer]'; - -/** - * The base implementation of `_.isArrayBuffer` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - */ -function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; -} - -module.exports = baseIsArrayBuffer; diff --git a/node_modules/lodash/_baseIsDate.js b/node_modules/lodash/_baseIsDate.js deleted file mode 100644 index ba67c785..00000000 --- a/node_modules/lodash/_baseIsDate.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var dateTag = '[object Date]'; - -/** - * The base implementation of `_.isDate` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - */ -function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; -} - -module.exports = baseIsDate; diff --git a/node_modules/lodash/_baseIsEqual.js b/node_modules/lodash/_baseIsEqual.js deleted file mode 100644 index 00a68a4f..00000000 --- a/node_modules/lodash/_baseIsEqual.js +++ /dev/null @@ -1,28 +0,0 @@ -var baseIsEqualDeep = require('./_baseIsEqualDeep'), - isObjectLike = require('./isObjectLike'); - -/** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ -function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); -} - -module.exports = baseIsEqual; diff --git a/node_modules/lodash/_baseIsEqualDeep.js b/node_modules/lodash/_baseIsEqualDeep.js deleted file mode 100644 index e3cfd6a8..00000000 --- a/node_modules/lodash/_baseIsEqualDeep.js +++ /dev/null @@ -1,83 +0,0 @@ -var Stack = require('./_Stack'), - equalArrays = require('./_equalArrays'), - equalByTag = require('./_equalByTag'), - equalObjects = require('./_equalObjects'), - getTag = require('./_getTag'), - isArray = require('./isArray'), - isBuffer = require('./isBuffer'), - isTypedArray = require('./isTypedArray'); - -/** Used to compose bitmasks for value comparisons. */ -var COMPARE_PARTIAL_FLAG = 1; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - objectTag = '[object Object]'; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag(object), - othTag = othIsArr ? arrayTag : getTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); -} - -module.exports = baseIsEqualDeep; diff --git a/node_modules/lodash/_baseIsMap.js b/node_modules/lodash/_baseIsMap.js deleted file mode 100644 index 02a4021c..00000000 --- a/node_modules/lodash/_baseIsMap.js +++ /dev/null @@ -1,18 +0,0 @@ -var getTag = require('./_getTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var mapTag = '[object Map]'; - -/** - * The base implementation of `_.isMap` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - */ -function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; -} - -module.exports = baseIsMap; diff --git a/node_modules/lodash/_baseIsMatch.js b/node_modules/lodash/_baseIsMatch.js deleted file mode 100644 index 72494bed..00000000 --- a/node_modules/lodash/_baseIsMatch.js +++ /dev/null @@ -1,62 +0,0 @@ -var Stack = require('./_Stack'), - baseIsEqual = require('./_baseIsEqual'); - -/** Used to compose bitmasks for value comparisons. */ -var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - -/** - * The base implementation of `_.isMatch` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ -function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var stack = new Stack; - if (customizer) { - var result = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { - return false; - } - } - } - return true; -} - -module.exports = baseIsMatch; diff --git a/node_modules/lodash/_baseIsNaN.js b/node_modules/lodash/_baseIsNaN.js deleted file mode 100644 index 316f1eb1..00000000 --- a/node_modules/lodash/_baseIsNaN.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ -function baseIsNaN(value) { - return value !== value; -} - -module.exports = baseIsNaN; diff --git a/node_modules/lodash/_baseIsNative.js b/node_modules/lodash/_baseIsNative.js deleted file mode 100644 index 87023304..00000000 --- a/node_modules/lodash/_baseIsNative.js +++ /dev/null @@ -1,47 +0,0 @@ -var isFunction = require('./isFunction'), - isMasked = require('./_isMasked'), - isObject = require('./isObject'), - toSource = require('./_toSource'); - -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used for built-in method references. */ -var funcProto = Function.prototype, - objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ -function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); -} - -module.exports = baseIsNative; diff --git a/node_modules/lodash/_baseIsRegExp.js b/node_modules/lodash/_baseIsRegExp.js deleted file mode 100644 index 6cd7c1ae..00000000 --- a/node_modules/lodash/_baseIsRegExp.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var regexpTag = '[object RegExp]'; - -/** - * The base implementation of `_.isRegExp` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - */ -function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; -} - -module.exports = baseIsRegExp; diff --git a/node_modules/lodash/_baseIsSet.js b/node_modules/lodash/_baseIsSet.js deleted file mode 100644 index 6dee3671..00000000 --- a/node_modules/lodash/_baseIsSet.js +++ /dev/null @@ -1,18 +0,0 @@ -var getTag = require('./_getTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var setTag = '[object Set]'; - -/** - * The base implementation of `_.isSet` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - */ -function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; -} - -module.exports = baseIsSet; diff --git a/node_modules/lodash/_baseIsTypedArray.js b/node_modules/lodash/_baseIsTypedArray.js deleted file mode 100644 index 1edb32ff..00000000 --- a/node_modules/lodash/_baseIsTypedArray.js +++ /dev/null @@ -1,60 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isLength = require('./isLength'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** Used to identify `toStringTag` values of typed arrays. */ -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = -typedArrayTags[errorTag] = typedArrayTags[funcTag] = -typedArrayTags[mapTag] = typedArrayTags[numberTag] = -typedArrayTags[objectTag] = typedArrayTags[regexpTag] = -typedArrayTags[setTag] = typedArrayTags[stringTag] = -typedArrayTags[weakMapTag] = false; - -/** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ -function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; -} - -module.exports = baseIsTypedArray; diff --git a/node_modules/lodash/_baseIteratee.js b/node_modules/lodash/_baseIteratee.js deleted file mode 100644 index 995c2575..00000000 --- a/node_modules/lodash/_baseIteratee.js +++ /dev/null @@ -1,31 +0,0 @@ -var baseMatches = require('./_baseMatches'), - baseMatchesProperty = require('./_baseMatchesProperty'), - identity = require('./identity'), - isArray = require('./isArray'), - property = require('./property'); - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. - // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. - if (typeof value == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (typeof value == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -module.exports = baseIteratee; diff --git a/node_modules/lodash/_baseKeys.js b/node_modules/lodash/_baseKeys.js deleted file mode 100644 index 45e9e6f3..00000000 --- a/node_modules/lodash/_baseKeys.js +++ /dev/null @@ -1,30 +0,0 @@ -var isPrototype = require('./_isPrototype'), - nativeKeys = require('./_nativeKeys'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; -} - -module.exports = baseKeys; diff --git a/node_modules/lodash/_baseKeysIn.js b/node_modules/lodash/_baseKeysIn.js deleted file mode 100644 index ea8a0a17..00000000 --- a/node_modules/lodash/_baseKeysIn.js +++ /dev/null @@ -1,33 +0,0 @@ -var isObject = require('./isObject'), - isPrototype = require('./_isPrototype'), - nativeKeysIn = require('./_nativeKeysIn'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; -} - -module.exports = baseKeysIn; diff --git a/node_modules/lodash/_baseLodash.js b/node_modules/lodash/_baseLodash.js deleted file mode 100644 index f76c790e..00000000 --- a/node_modules/lodash/_baseLodash.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * The function whose prototype chain sequence wrappers inherit from. - * - * @private - */ -function baseLodash() { - // No operation performed. -} - -module.exports = baseLodash; diff --git a/node_modules/lodash/_baseLt.js b/node_modules/lodash/_baseLt.js deleted file mode 100644 index 8674d294..00000000 --- a/node_modules/lodash/_baseLt.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * The base implementation of `_.lt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - */ -function baseLt(value, other) { - return value < other; -} - -module.exports = baseLt; diff --git a/node_modules/lodash/_baseMap.js b/node_modules/lodash/_baseMap.js deleted file mode 100644 index 0bf5cead..00000000 --- a/node_modules/lodash/_baseMap.js +++ /dev/null @@ -1,22 +0,0 @@ -var baseEach = require('./_baseEach'), - isArrayLike = require('./isArrayLike'); - -/** - * The base implementation of `_.map` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; -} - -module.exports = baseMap; diff --git a/node_modules/lodash/_baseMatches.js b/node_modules/lodash/_baseMatches.js deleted file mode 100644 index e56582ad..00000000 --- a/node_modules/lodash/_baseMatches.js +++ /dev/null @@ -1,22 +0,0 @@ -var baseIsMatch = require('./_baseIsMatch'), - getMatchData = require('./_getMatchData'), - matchesStrictComparable = require('./_matchesStrictComparable'); - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - return matchesStrictComparable(matchData[0][0], matchData[0][1]); - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -module.exports = baseMatches; diff --git a/node_modules/lodash/_baseMatchesProperty.js b/node_modules/lodash/_baseMatchesProperty.js deleted file mode 100644 index 24afd893..00000000 --- a/node_modules/lodash/_baseMatchesProperty.js +++ /dev/null @@ -1,33 +0,0 @@ -var baseIsEqual = require('./_baseIsEqual'), - get = require('./get'), - hasIn = require('./hasIn'), - isKey = require('./_isKey'), - isStrictComparable = require('./_isStrictComparable'), - matchesStrictComparable = require('./_matchesStrictComparable'), - toKey = require('./_toKey'); - -/** Used to compose bitmasks for value comparisons. */ -var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ -function baseMatchesProperty(path, srcValue) { - if (isKey(path) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path), srcValue); - } - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); - }; -} - -module.exports = baseMatchesProperty; diff --git a/node_modules/lodash/_baseMean.js b/node_modules/lodash/_baseMean.js deleted file mode 100644 index fa9e00a0..00000000 --- a/node_modules/lodash/_baseMean.js +++ /dev/null @@ -1,20 +0,0 @@ -var baseSum = require('./_baseSum'); - -/** Used as references for various `Number` constants. */ -var NAN = 0 / 0; - -/** - * The base implementation of `_.mean` and `_.meanBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the mean. - */ -function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? (baseSum(array, iteratee) / length) : NAN; -} - -module.exports = baseMean; diff --git a/node_modules/lodash/_baseMerge.js b/node_modules/lodash/_baseMerge.js deleted file mode 100644 index c98b5eb0..00000000 --- a/node_modules/lodash/_baseMerge.js +++ /dev/null @@ -1,42 +0,0 @@ -var Stack = require('./_Stack'), - assignMergeValue = require('./_assignMergeValue'), - baseFor = require('./_baseFor'), - baseMergeDeep = require('./_baseMergeDeep'), - isObject = require('./isObject'), - keysIn = require('./keysIn'), - safeGet = require('./_safeGet'); - -/** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ -function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - baseFor(source, function(srcValue, key) { - stack || (stack = new Stack); - if (isObject(srcValue)) { - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } - else { - var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; - - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }, keysIn); -} - -module.exports = baseMerge; diff --git a/node_modules/lodash/_baseMergeDeep.js b/node_modules/lodash/_baseMergeDeep.js deleted file mode 100644 index 4679e8dc..00000000 --- a/node_modules/lodash/_baseMergeDeep.js +++ /dev/null @@ -1,94 +0,0 @@ -var assignMergeValue = require('./_assignMergeValue'), - cloneBuffer = require('./_cloneBuffer'), - cloneTypedArray = require('./_cloneTypedArray'), - copyArray = require('./_copyArray'), - initCloneObject = require('./_initCloneObject'), - isArguments = require('./isArguments'), - isArray = require('./isArray'), - isArrayLikeObject = require('./isArrayLikeObject'), - isBuffer = require('./isBuffer'), - isFunction = require('./isFunction'), - isObject = require('./isObject'), - isPlainObject = require('./isPlainObject'), - isTypedArray = require('./isTypedArray'), - safeGet = require('./_safeGet'), - toPlainObject = require('./toPlainObject'); - -/** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ -function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = safeGet(object, key), - srcValue = safeGet(source, key), - stacked = stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; - - var isCommon = newValue === undefined; - - if (isCommon) { - var isArr = isArray(srcValue), - isBuff = !isArr && isBuffer(srcValue), - isTyped = !isArr && !isBuff && isTypedArray(srcValue); - - newValue = srcValue; - if (isArr || isBuff || isTyped) { - if (isArray(objValue)) { - newValue = objValue; - } - else if (isArrayLikeObject(objValue)) { - newValue = copyArray(objValue); - } - else if (isBuff) { - isCommon = false; - newValue = cloneBuffer(srcValue, true); - } - else if (isTyped) { - isCommon = false; - newValue = cloneTypedArray(srcValue, true); - } - else { - newValue = []; - } - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - newValue = objValue; - if (isArguments(objValue)) { - newValue = toPlainObject(objValue); - } - else if (!isObject(objValue) || isFunction(objValue)) { - newValue = initCloneObject(srcValue); - } - } - else { - isCommon = false; - } - } - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); - } - assignMergeValue(object, key, newValue); -} - -module.exports = baseMergeDeep; diff --git a/node_modules/lodash/_baseNth.js b/node_modules/lodash/_baseNth.js deleted file mode 100644 index 0403c2a3..00000000 --- a/node_modules/lodash/_baseNth.js +++ /dev/null @@ -1,20 +0,0 @@ -var isIndex = require('./_isIndex'); - -/** - * The base implementation of `_.nth` which doesn't coerce arguments. - * - * @private - * @param {Array} array The array to query. - * @param {number} n The index of the element to return. - * @returns {*} Returns the nth element of `array`. - */ -function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined; -} - -module.exports = baseNth; diff --git a/node_modules/lodash/_baseOrderBy.js b/node_modules/lodash/_baseOrderBy.js deleted file mode 100644 index 775a0174..00000000 --- a/node_modules/lodash/_baseOrderBy.js +++ /dev/null @@ -1,49 +0,0 @@ -var arrayMap = require('./_arrayMap'), - baseGet = require('./_baseGet'), - baseIteratee = require('./_baseIteratee'), - baseMap = require('./_baseMap'), - baseSortBy = require('./_baseSortBy'), - baseUnary = require('./_baseUnary'), - compareMultiple = require('./_compareMultiple'), - identity = require('./identity'), - isArray = require('./isArray'); - -/** - * The base implementation of `_.orderBy` without param guards. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. - */ -function baseOrderBy(collection, iteratees, orders) { - if (iteratees.length) { - iteratees = arrayMap(iteratees, function(iteratee) { - if (isArray(iteratee)) { - return function(value) { - return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); - } - } - return iteratee; - }); - } else { - iteratees = [identity]; - } - - var index = -1; - iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); - - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); - - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); -} - -module.exports = baseOrderBy; diff --git a/node_modules/lodash/_basePick.js b/node_modules/lodash/_basePick.js deleted file mode 100644 index 09b458a6..00000000 --- a/node_modules/lodash/_basePick.js +++ /dev/null @@ -1,19 +0,0 @@ -var basePickBy = require('./_basePickBy'), - hasIn = require('./hasIn'); - -/** - * The base implementation of `_.pick` without support for individual - * property identifiers. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. - */ -function basePick(object, paths) { - return basePickBy(object, paths, function(value, path) { - return hasIn(object, path); - }); -} - -module.exports = basePick; diff --git a/node_modules/lodash/_basePickBy.js b/node_modules/lodash/_basePickBy.js deleted file mode 100644 index 85be68c8..00000000 --- a/node_modules/lodash/_basePickBy.js +++ /dev/null @@ -1,30 +0,0 @@ -var baseGet = require('./_baseGet'), - baseSet = require('./_baseSet'), - castPath = require('./_castPath'); - -/** - * The base implementation of `_.pickBy` without support for iteratee shorthands. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. - */ -function basePickBy(object, paths, predicate) { - var index = -1, - length = paths.length, - result = {}; - - while (++index < length) { - var path = paths[index], - value = baseGet(object, path); - - if (predicate(value, path)) { - baseSet(result, castPath(path, object), value); - } - } - return result; -} - -module.exports = basePickBy; diff --git a/node_modules/lodash/_baseProperty.js b/node_modules/lodash/_baseProperty.js deleted file mode 100644 index 496281ec..00000000 --- a/node_modules/lodash/_baseProperty.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -module.exports = baseProperty; diff --git a/node_modules/lodash/_basePropertyDeep.js b/node_modules/lodash/_basePropertyDeep.js deleted file mode 100644 index 1e5aae50..00000000 --- a/node_modules/lodash/_basePropertyDeep.js +++ /dev/null @@ -1,16 +0,0 @@ -var baseGet = require('./_baseGet'); - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -module.exports = basePropertyDeep; diff --git a/node_modules/lodash/_basePropertyOf.js b/node_modules/lodash/_basePropertyOf.js deleted file mode 100644 index 46173999..00000000 --- a/node_modules/lodash/_basePropertyOf.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ -function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; -} - -module.exports = basePropertyOf; diff --git a/node_modules/lodash/_basePullAll.js b/node_modules/lodash/_basePullAll.js deleted file mode 100644 index 305720ed..00000000 --- a/node_modules/lodash/_basePullAll.js +++ /dev/null @@ -1,51 +0,0 @@ -var arrayMap = require('./_arrayMap'), - baseIndexOf = require('./_baseIndexOf'), - baseIndexOfWith = require('./_baseIndexOfWith'), - baseUnary = require('./_baseUnary'), - copyArray = require('./_copyArray'); - -/** Used for built-in method references. */ -var arrayProto = Array.prototype; - -/** Built-in value references. */ -var splice = arrayProto.splice; - -/** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - */ -function basePullAll(array, values, iteratee, comparator) { - var indexOf = comparator ? baseIndexOfWith : baseIndexOf, - index = -1, - length = values.length, - seen = array; - - if (array === values) { - values = copyArray(values); - } - if (iteratee) { - seen = arrayMap(array, baseUnary(iteratee)); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; -} - -module.exports = basePullAll; diff --git a/node_modules/lodash/_basePullAt.js b/node_modules/lodash/_basePullAt.js deleted file mode 100644 index c3e9e710..00000000 --- a/node_modules/lodash/_basePullAt.js +++ /dev/null @@ -1,37 +0,0 @@ -var baseUnset = require('./_baseUnset'), - isIndex = require('./_isIndex'); - -/** Used for built-in method references. */ -var arrayProto = Array.prototype; - -/** Built-in value references. */ -var splice = arrayProto.splice; - -/** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ -function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; - - while (length--) { - var index = indexes[length]; - if (length == lastIndex || index !== previous) { - var previous = index; - if (isIndex(index)) { - splice.call(array, index, 1); - } else { - baseUnset(array, index); - } - } - } - return array; -} - -module.exports = basePullAt; diff --git a/node_modules/lodash/_baseRandom.js b/node_modules/lodash/_baseRandom.js deleted file mode 100644 index 94f76a76..00000000 --- a/node_modules/lodash/_baseRandom.js +++ /dev/null @@ -1,18 +0,0 @@ -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeFloor = Math.floor, - nativeRandom = Math.random; - -/** - * The base implementation of `_.random` without support for returning - * floating-point numbers. - * - * @private - * @param {number} lower The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the random number. - */ -function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); -} - -module.exports = baseRandom; diff --git a/node_modules/lodash/_baseRange.js b/node_modules/lodash/_baseRange.js deleted file mode 100644 index 0fb8e419..00000000 --- a/node_modules/lodash/_baseRange.js +++ /dev/null @@ -1,28 +0,0 @@ -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeCeil = Math.ceil, - nativeMax = Math.max; - -/** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. - * - * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. - */ -function baseRange(start, end, step, fromRight) { - var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); - - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; -} - -module.exports = baseRange; diff --git a/node_modules/lodash/_baseReduce.js b/node_modules/lodash/_baseReduce.js deleted file mode 100644 index 5a1f8b57..00000000 --- a/node_modules/lodash/_baseReduce.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for iteratee shorthands, which iterates over `collection` using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of - * `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ -function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; -} - -module.exports = baseReduce; diff --git a/node_modules/lodash/_baseRepeat.js b/node_modules/lodash/_baseRepeat.js deleted file mode 100644 index ee44c31a..00000000 --- a/node_modules/lodash/_baseRepeat.js +++ /dev/null @@ -1,35 +0,0 @@ -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeFloor = Math.floor; - -/** - * The base implementation of `_.repeat` which doesn't coerce arguments. - * - * @private - * @param {string} string The string to repeat. - * @param {number} n The number of times to repeat the string. - * @returns {string} Returns the repeated string. - */ -function baseRepeat(string, n) { - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; - } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - if (n) { - string += string; - } - } while (n); - - return result; -} - -module.exports = baseRepeat; diff --git a/node_modules/lodash/_baseRest.js b/node_modules/lodash/_baseRest.js deleted file mode 100644 index d0dc4bdd..00000000 --- a/node_modules/lodash/_baseRest.js +++ /dev/null @@ -1,17 +0,0 @@ -var identity = require('./identity'), - overRest = require('./_overRest'), - setToString = require('./_setToString'); - -/** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ -function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); -} - -module.exports = baseRest; diff --git a/node_modules/lodash/_baseSample.js b/node_modules/lodash/_baseSample.js deleted file mode 100644 index 58582b91..00000000 --- a/node_modules/lodash/_baseSample.js +++ /dev/null @@ -1,15 +0,0 @@ -var arraySample = require('./_arraySample'), - values = require('./values'); - -/** - * The base implementation of `_.sample`. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - */ -function baseSample(collection) { - return arraySample(values(collection)); -} - -module.exports = baseSample; diff --git a/node_modules/lodash/_baseSampleSize.js b/node_modules/lodash/_baseSampleSize.js deleted file mode 100644 index 5c90ec51..00000000 --- a/node_modules/lodash/_baseSampleSize.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseClamp = require('./_baseClamp'), - shuffleSelf = require('./_shuffleSelf'), - values = require('./values'); - -/** - * The base implementation of `_.sampleSize` without param guards. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ -function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); -} - -module.exports = baseSampleSize; diff --git a/node_modules/lodash/_baseSet.js b/node_modules/lodash/_baseSet.js deleted file mode 100644 index 99f4fbf9..00000000 --- a/node_modules/lodash/_baseSet.js +++ /dev/null @@ -1,51 +0,0 @@ -var assignValue = require('./_assignValue'), - castPath = require('./_castPath'), - isIndex = require('./_isIndex'), - isObject = require('./isObject'), - toKey = require('./_toKey'); - -/** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ -function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; - } - path = castPath(path, object); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; - - if (key === '__proto__' || key === 'constructor' || key === 'prototype') { - return object; - } - - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); - } - } - assignValue(nested, key, newValue); - nested = nested[key]; - } - return object; -} - -module.exports = baseSet; diff --git a/node_modules/lodash/_baseSetData.js b/node_modules/lodash/_baseSetData.js deleted file mode 100644 index c409947d..00000000 --- a/node_modules/lodash/_baseSetData.js +++ /dev/null @@ -1,17 +0,0 @@ -var identity = require('./identity'), - metaMap = require('./_metaMap'); - -/** - * The base implementation of `setData` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ -var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; -}; - -module.exports = baseSetData; diff --git a/node_modules/lodash/_baseSetToString.js b/node_modules/lodash/_baseSetToString.js deleted file mode 100644 index 89eaca38..00000000 --- a/node_modules/lodash/_baseSetToString.js +++ /dev/null @@ -1,22 +0,0 @@ -var constant = require('./constant'), - defineProperty = require('./_defineProperty'), - identity = require('./identity'); - -/** - * The base implementation of `setToString` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ -var baseSetToString = !defineProperty ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true - }); -}; - -module.exports = baseSetToString; diff --git a/node_modules/lodash/_baseShuffle.js b/node_modules/lodash/_baseShuffle.js deleted file mode 100644 index 023077ac..00000000 --- a/node_modules/lodash/_baseShuffle.js +++ /dev/null @@ -1,15 +0,0 @@ -var shuffleSelf = require('./_shuffleSelf'), - values = require('./values'); - -/** - * The base implementation of `_.shuffle`. - * - * @private - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - */ -function baseShuffle(collection) { - return shuffleSelf(values(collection)); -} - -module.exports = baseShuffle; diff --git a/node_modules/lodash/_baseSlice.js b/node_modules/lodash/_baseSlice.js deleted file mode 100644 index 786f6c99..00000000 --- a/node_modules/lodash/_baseSlice.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ -function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; -} - -module.exports = baseSlice; diff --git a/node_modules/lodash/_baseSome.js b/node_modules/lodash/_baseSome.js deleted file mode 100644 index 58f3f447..00000000 --- a/node_modules/lodash/_baseSome.js +++ /dev/null @@ -1,22 +0,0 @@ -var baseEach = require('./_baseEach'); - -/** - * The base implementation of `_.some` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ -function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; -} - -module.exports = baseSome; diff --git a/node_modules/lodash/_baseSortBy.js b/node_modules/lodash/_baseSortBy.js deleted file mode 100644 index a25c92ed..00000000 --- a/node_modules/lodash/_baseSortBy.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * The base implementation of `_.sortBy` which uses `comparer` to define the - * sort order of `array` and replaces criteria objects with their corresponding - * values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ -function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; -} - -module.exports = baseSortBy; diff --git a/node_modules/lodash/_baseSortedIndex.js b/node_modules/lodash/_baseSortedIndex.js deleted file mode 100644 index 638c366c..00000000 --- a/node_modules/lodash/_baseSortedIndex.js +++ /dev/null @@ -1,42 +0,0 @@ -var baseSortedIndexBy = require('./_baseSortedIndexBy'), - identity = require('./identity'), - isSymbol = require('./isSymbol'); - -/** Used as references for the maximum length and index of an array. */ -var MAX_ARRAY_LENGTH = 4294967295, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - -/** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ -function baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array == null ? low : array.length; - - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; - - if (computed !== null && !isSymbol(computed) && - (retHighest ? (computed <= value) : (computed < value))) { - low = mid + 1; - } else { - high = mid; - } - } - return high; - } - return baseSortedIndexBy(array, value, identity, retHighest); -} - -module.exports = baseSortedIndex; diff --git a/node_modules/lodash/_baseSortedIndexBy.js b/node_modules/lodash/_baseSortedIndexBy.js deleted file mode 100644 index c247b377..00000000 --- a/node_modules/lodash/_baseSortedIndexBy.js +++ /dev/null @@ -1,67 +0,0 @@ -var isSymbol = require('./isSymbol'); - -/** Used as references for the maximum length and index of an array. */ -var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeFloor = Math.floor, - nativeMin = Math.min; - -/** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which invokes `iteratee` for `value` and each element of `array` to compute - * their sort ranking. The iteratee is invoked with one argument; (value). - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} iteratee The iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ -function baseSortedIndexBy(array, value, iteratee, retHighest) { - var low = 0, - high = array == null ? 0 : array.length; - if (high === 0) { - return 0; - } - - value = iteratee(value); - var valIsNaN = value !== value, - valIsNull = value === null, - valIsSymbol = isSymbol(value), - valIsUndefined = value === undefined; - - while (low < high) { - var mid = nativeFloor((low + high) / 2), - computed = iteratee(array[mid]), - othIsDefined = computed !== undefined, - othIsNull = computed === null, - othIsReflexive = computed === computed, - othIsSymbol = isSymbol(computed); - - if (valIsNaN) { - var setLow = retHighest || othIsReflexive; - } else if (valIsUndefined) { - setLow = othIsReflexive && (retHighest || othIsDefined); - } else if (valIsNull) { - setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); - } else if (valIsSymbol) { - setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); - } else if (othIsNull || othIsSymbol) { - setLow = false; - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); -} - -module.exports = baseSortedIndexBy; diff --git a/node_modules/lodash/_baseSortedUniq.js b/node_modules/lodash/_baseSortedUniq.js deleted file mode 100644 index 802159a3..00000000 --- a/node_modules/lodash/_baseSortedUniq.js +++ /dev/null @@ -1,30 +0,0 @@ -var eq = require('./eq'); - -/** - * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseSortedUniq(array, iteratee) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!index || !eq(computed, seen)) { - var seen = computed; - result[resIndex++] = value === 0 ? 0 : value; - } - } - return result; -} - -module.exports = baseSortedUniq; diff --git a/node_modules/lodash/_baseSum.js b/node_modules/lodash/_baseSum.js deleted file mode 100644 index a9e84c13..00000000 --- a/node_modules/lodash/_baseSum.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * The base implementation of `_.sum` and `_.sumBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. - */ -function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; - - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } - } - return result; -} - -module.exports = baseSum; diff --git a/node_modules/lodash/_baseTimes.js b/node_modules/lodash/_baseTimes.js deleted file mode 100644 index 0603fc37..00000000 --- a/node_modules/lodash/_baseTimes.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ -function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} - -module.exports = baseTimes; diff --git a/node_modules/lodash/_baseToNumber.js b/node_modules/lodash/_baseToNumber.js deleted file mode 100644 index 04859f39..00000000 --- a/node_modules/lodash/_baseToNumber.js +++ /dev/null @@ -1,24 +0,0 @@ -var isSymbol = require('./isSymbol'); - -/** Used as references for various `Number` constants. */ -var NAN = 0 / 0; - -/** - * The base implementation of `_.toNumber` which doesn't ensure correct - * conversions of binary, hexadecimal, or octal string values. - * - * @private - * @param {*} value The value to process. - * @returns {number} Returns the number. - */ -function baseToNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - return +value; -} - -module.exports = baseToNumber; diff --git a/node_modules/lodash/_baseToPairs.js b/node_modules/lodash/_baseToPairs.js deleted file mode 100644 index bff19912..00000000 --- a/node_modules/lodash/_baseToPairs.js +++ /dev/null @@ -1,18 +0,0 @@ -var arrayMap = require('./_arrayMap'); - -/** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. - */ -function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); -} - -module.exports = baseToPairs; diff --git a/node_modules/lodash/_baseToString.js b/node_modules/lodash/_baseToString.js deleted file mode 100644 index ada6ad29..00000000 --- a/node_modules/lodash/_baseToString.js +++ /dev/null @@ -1,37 +0,0 @@ -var Symbol = require('./_Symbol'), - arrayMap = require('./_arrayMap'), - isArray = require('./isArray'), - isSymbol = require('./isSymbol'); - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - -/** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ -function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} - -module.exports = baseToString; diff --git a/node_modules/lodash/_baseTrim.js b/node_modules/lodash/_baseTrim.js deleted file mode 100644 index 3e2797d9..00000000 --- a/node_modules/lodash/_baseTrim.js +++ /dev/null @@ -1,19 +0,0 @@ -var trimmedEndIndex = require('./_trimmedEndIndex'); - -/** Used to match leading whitespace. */ -var reTrimStart = /^\s+/; - -/** - * The base implementation of `_.trim`. - * - * @private - * @param {string} string The string to trim. - * @returns {string} Returns the trimmed string. - */ -function baseTrim(string) { - return string - ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') - : string; -} - -module.exports = baseTrim; diff --git a/node_modules/lodash/_baseUnary.js b/node_modules/lodash/_baseUnary.js deleted file mode 100644 index 98639e92..00000000 --- a/node_modules/lodash/_baseUnary.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} - -module.exports = baseUnary; diff --git a/node_modules/lodash/_baseUniq.js b/node_modules/lodash/_baseUniq.js deleted file mode 100644 index aea459dc..00000000 --- a/node_modules/lodash/_baseUniq.js +++ /dev/null @@ -1,72 +0,0 @@ -var SetCache = require('./_SetCache'), - arrayIncludes = require('./_arrayIncludes'), - arrayIncludesWith = require('./_arrayIncludesWith'), - cacheHas = require('./_cacheHas'), - createSet = require('./_createSet'), - setToArray = require('./_setToArray'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -module.exports = baseUniq; diff --git a/node_modules/lodash/_baseUnset.js b/node_modules/lodash/_baseUnset.js deleted file mode 100644 index eefc6e37..00000000 --- a/node_modules/lodash/_baseUnset.js +++ /dev/null @@ -1,20 +0,0 @@ -var castPath = require('./_castPath'), - last = require('./last'), - parent = require('./_parent'), - toKey = require('./_toKey'); - -/** - * The base implementation of `_.unset`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The property path to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - */ -function baseUnset(object, path) { - path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; -} - -module.exports = baseUnset; diff --git a/node_modules/lodash/_baseUpdate.js b/node_modules/lodash/_baseUpdate.js deleted file mode 100644 index 92a62377..00000000 --- a/node_modules/lodash/_baseUpdate.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseGet = require('./_baseGet'), - baseSet = require('./_baseSet'); - -/** - * The base implementation of `_.update`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to update. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ -function baseUpdate(object, path, updater, customizer) { - return baseSet(object, path, updater(baseGet(object, path)), customizer); -} - -module.exports = baseUpdate; diff --git a/node_modules/lodash/_baseValues.js b/node_modules/lodash/_baseValues.js deleted file mode 100644 index b95faadc..00000000 --- a/node_modules/lodash/_baseValues.js +++ /dev/null @@ -1,19 +0,0 @@ -var arrayMap = require('./_arrayMap'); - -/** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ -function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); -} - -module.exports = baseValues; diff --git a/node_modules/lodash/_baseWhile.js b/node_modules/lodash/_baseWhile.js deleted file mode 100644 index 07eac61b..00000000 --- a/node_modules/lodash/_baseWhile.js +++ /dev/null @@ -1,26 +0,0 @@ -var baseSlice = require('./_baseSlice'); - -/** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ -function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} - - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); -} - -module.exports = baseWhile; diff --git a/node_modules/lodash/_baseWrapperValue.js b/node_modules/lodash/_baseWrapperValue.js deleted file mode 100644 index 443e0df5..00000000 --- a/node_modules/lodash/_baseWrapperValue.js +++ /dev/null @@ -1,25 +0,0 @@ -var LazyWrapper = require('./_LazyWrapper'), - arrayPush = require('./_arrayPush'), - arrayReduce = require('./_arrayReduce'); - -/** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ -function baseWrapperValue(value, actions) { - var result = value; - if (result instanceof LazyWrapper) { - result = result.value(); - } - return arrayReduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); -} - -module.exports = baseWrapperValue; diff --git a/node_modules/lodash/_baseXor.js b/node_modules/lodash/_baseXor.js deleted file mode 100644 index 8e69338b..00000000 --- a/node_modules/lodash/_baseXor.js +++ /dev/null @@ -1,36 +0,0 @@ -var baseDifference = require('./_baseDifference'), - baseFlatten = require('./_baseFlatten'), - baseUniq = require('./_baseUniq'); - -/** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ -function baseXor(arrays, iteratee, comparator) { - var length = arrays.length; - if (length < 2) { - return length ? baseUniq(arrays[0]) : []; - } - var index = -1, - result = Array(length); - - while (++index < length) { - var array = arrays[index], - othIndex = -1; - - while (++othIndex < length) { - if (othIndex != index) { - result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); - } - } - } - return baseUniq(baseFlatten(result, 1), iteratee, comparator); -} - -module.exports = baseXor; diff --git a/node_modules/lodash/_baseZipObject.js b/node_modules/lodash/_baseZipObject.js deleted file mode 100644 index 401f85be..00000000 --- a/node_modules/lodash/_baseZipObject.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This base implementation of `_.zipObject` which assigns values using `assignFunc`. - * - * @private - * @param {Array} props The property identifiers. - * @param {Array} values The property values. - * @param {Function} assignFunc The function to assign values. - * @returns {Object} Returns the new object. - */ -function baseZipObject(props, values, assignFunc) { - var index = -1, - length = props.length, - valsLength = values.length, - result = {}; - - while (++index < length) { - var value = index < valsLength ? values[index] : undefined; - assignFunc(result, props[index], value); - } - return result; -} - -module.exports = baseZipObject; diff --git a/node_modules/lodash/_cacheHas.js b/node_modules/lodash/_cacheHas.js deleted file mode 100644 index 2dec8926..00000000 --- a/node_modules/lodash/_cacheHas.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function cacheHas(cache, key) { - return cache.has(key); -} - -module.exports = cacheHas; diff --git a/node_modules/lodash/_castArrayLikeObject.js b/node_modules/lodash/_castArrayLikeObject.js deleted file mode 100644 index 92c75fa1..00000000 --- a/node_modules/lodash/_castArrayLikeObject.js +++ /dev/null @@ -1,14 +0,0 @@ -var isArrayLikeObject = require('./isArrayLikeObject'); - -/** - * Casts `value` to an empty array if it's not an array like object. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array|Object} Returns the cast array-like object. - */ -function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; -} - -module.exports = castArrayLikeObject; diff --git a/node_modules/lodash/_castFunction.js b/node_modules/lodash/_castFunction.js deleted file mode 100644 index 98c91ae6..00000000 --- a/node_modules/lodash/_castFunction.js +++ /dev/null @@ -1,14 +0,0 @@ -var identity = require('./identity'); - -/** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Function} Returns cast function. - */ -function castFunction(value) { - return typeof value == 'function' ? value : identity; -} - -module.exports = castFunction; diff --git a/node_modules/lodash/_castPath.js b/node_modules/lodash/_castPath.js deleted file mode 100644 index 017e4c1b..00000000 --- a/node_modules/lodash/_castPath.js +++ /dev/null @@ -1,21 +0,0 @@ -var isArray = require('./isArray'), - isKey = require('./_isKey'), - stringToPath = require('./_stringToPath'), - toString = require('./toString'); - -/** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @param {Object} [object] The object to query keys on. - * @returns {Array} Returns the cast property path array. - */ -function castPath(value, object) { - if (isArray(value)) { - return value; - } - return isKey(value, object) ? [value] : stringToPath(toString(value)); -} - -module.exports = castPath; diff --git a/node_modules/lodash/_castRest.js b/node_modules/lodash/_castRest.js deleted file mode 100644 index 213c66f1..00000000 --- a/node_modules/lodash/_castRest.js +++ /dev/null @@ -1,14 +0,0 @@ -var baseRest = require('./_baseRest'); - -/** - * A `baseRest` alias which can be replaced with `identity` by module - * replacement plugins. - * - * @private - * @type {Function} - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ -var castRest = baseRest; - -module.exports = castRest; diff --git a/node_modules/lodash/_castSlice.js b/node_modules/lodash/_castSlice.js deleted file mode 100644 index 071faeba..00000000 --- a/node_modules/lodash/_castSlice.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseSlice = require('./_baseSlice'); - -/** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ -function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); -} - -module.exports = castSlice; diff --git a/node_modules/lodash/_charsEndIndex.js b/node_modules/lodash/_charsEndIndex.js deleted file mode 100644 index 07908ff3..00000000 --- a/node_modules/lodash/_charsEndIndex.js +++ /dev/null @@ -1,19 +0,0 @@ -var baseIndexOf = require('./_baseIndexOf'); - -/** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ -function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; -} - -module.exports = charsEndIndex; diff --git a/node_modules/lodash/_charsStartIndex.js b/node_modules/lodash/_charsStartIndex.js deleted file mode 100644 index b17afd25..00000000 --- a/node_modules/lodash/_charsStartIndex.js +++ /dev/null @@ -1,20 +0,0 @@ -var baseIndexOf = require('./_baseIndexOf'); - -/** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ -function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; - - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; -} - -module.exports = charsStartIndex; diff --git a/node_modules/lodash/_cloneArrayBuffer.js b/node_modules/lodash/_cloneArrayBuffer.js deleted file mode 100644 index c3d8f6e3..00000000 --- a/node_modules/lodash/_cloneArrayBuffer.js +++ /dev/null @@ -1,16 +0,0 @@ -var Uint8Array = require('./_Uint8Array'); - -/** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ -function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; -} - -module.exports = cloneArrayBuffer; diff --git a/node_modules/lodash/_cloneBuffer.js b/node_modules/lodash/_cloneBuffer.js deleted file mode 100644 index 27c48109..00000000 --- a/node_modules/lodash/_cloneBuffer.js +++ /dev/null @@ -1,35 +0,0 @@ -var root = require('./_root'); - -/** Detect free variable `exports`. */ -var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - -/** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; - -/** Built-in value references. */ -var Buffer = moduleExports ? root.Buffer : undefined, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; - -/** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ -function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; -} - -module.exports = cloneBuffer; diff --git a/node_modules/lodash/_cloneDataView.js b/node_modules/lodash/_cloneDataView.js deleted file mode 100644 index 9c9b7b05..00000000 --- a/node_modules/lodash/_cloneDataView.js +++ /dev/null @@ -1,16 +0,0 @@ -var cloneArrayBuffer = require('./_cloneArrayBuffer'); - -/** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ -function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); -} - -module.exports = cloneDataView; diff --git a/node_modules/lodash/_cloneRegExp.js b/node_modules/lodash/_cloneRegExp.js deleted file mode 100644 index 64a30dfb..00000000 --- a/node_modules/lodash/_cloneRegExp.js +++ /dev/null @@ -1,17 +0,0 @@ -/** Used to match `RegExp` flags from their coerced string values. */ -var reFlags = /\w*$/; - -/** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ -function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; -} - -module.exports = cloneRegExp; diff --git a/node_modules/lodash/_cloneSymbol.js b/node_modules/lodash/_cloneSymbol.js deleted file mode 100644 index bede39f5..00000000 --- a/node_modules/lodash/_cloneSymbol.js +++ /dev/null @@ -1,18 +0,0 @@ -var Symbol = require('./_Symbol'); - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - -/** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ -function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; -} - -module.exports = cloneSymbol; diff --git a/node_modules/lodash/_cloneTypedArray.js b/node_modules/lodash/_cloneTypedArray.js deleted file mode 100644 index 7aad84d4..00000000 --- a/node_modules/lodash/_cloneTypedArray.js +++ /dev/null @@ -1,16 +0,0 @@ -var cloneArrayBuffer = require('./_cloneArrayBuffer'); - -/** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ -function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); -} - -module.exports = cloneTypedArray; diff --git a/node_modules/lodash/_compareAscending.js b/node_modules/lodash/_compareAscending.js deleted file mode 100644 index 8dc27910..00000000 --- a/node_modules/lodash/_compareAscending.js +++ /dev/null @@ -1,41 +0,0 @@ -var isSymbol = require('./isSymbol'); - -/** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ -function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = isSymbol(value); - - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = isSymbol(other); - - if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || - (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || - (valIsNull && othIsDefined && othIsReflexive) || - (!valIsDefined && othIsReflexive) || - !valIsReflexive) { - return 1; - } - if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || - (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || - (othIsNull && valIsDefined && valIsReflexive) || - (!othIsDefined && valIsReflexive) || - !othIsReflexive) { - return -1; - } - } - return 0; -} - -module.exports = compareAscending; diff --git a/node_modules/lodash/_compareMultiple.js b/node_modules/lodash/_compareMultiple.js deleted file mode 100644 index ad61f0fb..00000000 --- a/node_modules/lodash/_compareMultiple.js +++ /dev/null @@ -1,44 +0,0 @@ -var compareAscending = require('./_compareAscending'); - -/** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. - * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order - * of corresponding values. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {boolean[]|string[]} orders The order to sort by for each property. - * @returns {number} Returns the sort order indicator for `object`. - */ -function compareMultiple(object, other, orders) { - var index = -1, - objCriteria = object.criteria, - othCriteria = other.criteria, - length = objCriteria.length, - ordersLength = orders.length; - - while (++index < length) { - var result = compareAscending(objCriteria[index], othCriteria[index]); - if (result) { - if (index >= ordersLength) { - return result; - } - var order = orders[index]; - return result * (order == 'desc' ? -1 : 1); - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value for - // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 - // for more details. - // - // This also ensures a stable sort in V8 and other engines. - // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. - return object.index - other.index; -} - -module.exports = compareMultiple; diff --git a/node_modules/lodash/_composeArgs.js b/node_modules/lodash/_composeArgs.js deleted file mode 100644 index 1ce40f4f..00000000 --- a/node_modules/lodash/_composeArgs.js +++ /dev/null @@ -1,39 +0,0 @@ -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Creates an array that is the composition of partially applied arguments, - * placeholders, and provided arguments into a single array of arguments. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to prepend to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ -function composeArgs(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersLength = holders.length, - leftIndex = -1, - leftLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(leftLength + rangeLength), - isUncurried = !isCurried; - - while (++leftIndex < leftLength) { - result[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[holders[argsIndex]] = args[argsIndex]; - } - } - while (rangeLength--) { - result[leftIndex++] = args[argsIndex++]; - } - return result; -} - -module.exports = composeArgs; diff --git a/node_modules/lodash/_composeArgsRight.js b/node_modules/lodash/_composeArgsRight.js deleted file mode 100644 index 8dc588d0..00000000 --- a/node_modules/lodash/_composeArgsRight.js +++ /dev/null @@ -1,41 +0,0 @@ -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * This function is like `composeArgs` except that the arguments composition - * is tailored for `_.partialRight`. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to append to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ -function composeArgsRight(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersIndex = -1, - holdersLength = holders.length, - rightIndex = -1, - rightLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(rangeLength + rightLength), - isUncurried = !isCurried; - - while (++argsIndex < rangeLength) { - result[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; - } - } - return result; -} - -module.exports = composeArgsRight; diff --git a/node_modules/lodash/_copyArray.js b/node_modules/lodash/_copyArray.js deleted file mode 100644 index cd94d5d0..00000000 --- a/node_modules/lodash/_copyArray.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ -function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; -} - -module.exports = copyArray; diff --git a/node_modules/lodash/_copyObject.js b/node_modules/lodash/_copyObject.js deleted file mode 100644 index 2f2a5c23..00000000 --- a/node_modules/lodash/_copyObject.js +++ /dev/null @@ -1,40 +0,0 @@ -var assignValue = require('./_assignValue'), - baseAssignValue = require('./_baseAssignValue'); - -/** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ -function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; -} - -module.exports = copyObject; diff --git a/node_modules/lodash/_copySymbols.js b/node_modules/lodash/_copySymbols.js deleted file mode 100644 index c35944ab..00000000 --- a/node_modules/lodash/_copySymbols.js +++ /dev/null @@ -1,16 +0,0 @@ -var copyObject = require('./_copyObject'), - getSymbols = require('./_getSymbols'); - -/** - * Copies own symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ -function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); -} - -module.exports = copySymbols; diff --git a/node_modules/lodash/_copySymbolsIn.js b/node_modules/lodash/_copySymbolsIn.js deleted file mode 100644 index fdf20a73..00000000 --- a/node_modules/lodash/_copySymbolsIn.js +++ /dev/null @@ -1,16 +0,0 @@ -var copyObject = require('./_copyObject'), - getSymbolsIn = require('./_getSymbolsIn'); - -/** - * Copies own and inherited symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ -function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); -} - -module.exports = copySymbolsIn; diff --git a/node_modules/lodash/_coreJsData.js b/node_modules/lodash/_coreJsData.js deleted file mode 100644 index f8e5b4e3..00000000 --- a/node_modules/lodash/_coreJsData.js +++ /dev/null @@ -1,6 +0,0 @@ -var root = require('./_root'); - -/** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; - -module.exports = coreJsData; diff --git a/node_modules/lodash/_countHolders.js b/node_modules/lodash/_countHolders.js deleted file mode 100644 index 718fcdaa..00000000 --- a/node_modules/lodash/_countHolders.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Gets the number of `placeholder` occurrences in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} placeholder The placeholder to search for. - * @returns {number} Returns the placeholder count. - */ -function countHolders(array, placeholder) { - var length = array.length, - result = 0; - - while (length--) { - if (array[length] === placeholder) { - ++result; - } - } - return result; -} - -module.exports = countHolders; diff --git a/node_modules/lodash/_createAggregator.js b/node_modules/lodash/_createAggregator.js deleted file mode 100644 index 0be42c41..00000000 --- a/node_modules/lodash/_createAggregator.js +++ /dev/null @@ -1,23 +0,0 @@ -var arrayAggregator = require('./_arrayAggregator'), - baseAggregator = require('./_baseAggregator'), - baseIteratee = require('./_baseIteratee'), - isArray = require('./isArray'); - -/** - * Creates a function like `_.groupBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} [initializer] The accumulator object initializer. - * @returns {Function} Returns the new aggregator function. - */ -function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var func = isArray(collection) ? arrayAggregator : baseAggregator, - accumulator = initializer ? initializer() : {}; - - return func(collection, setter, baseIteratee(iteratee, 2), accumulator); - }; -} - -module.exports = createAggregator; diff --git a/node_modules/lodash/_createAssigner.js b/node_modules/lodash/_createAssigner.js deleted file mode 100644 index 1f904c51..00000000 --- a/node_modules/lodash/_createAssigner.js +++ /dev/null @@ -1,37 +0,0 @@ -var baseRest = require('./_baseRest'), - isIterateeCall = require('./_isIterateeCall'); - -/** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ -function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); -} - -module.exports = createAssigner; diff --git a/node_modules/lodash/_createBaseEach.js b/node_modules/lodash/_createBaseEach.js deleted file mode 100644 index d24fdd1b..00000000 --- a/node_modules/lodash/_createBaseEach.js +++ /dev/null @@ -1,32 +0,0 @@ -var isArrayLike = require('./isArrayLike'); - -/** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; -} - -module.exports = createBaseEach; diff --git a/node_modules/lodash/_createBaseFor.js b/node_modules/lodash/_createBaseFor.js deleted file mode 100644 index 94cbf297..00000000 --- a/node_modules/lodash/_createBaseFor.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; -} - -module.exports = createBaseFor; diff --git a/node_modules/lodash/_createBind.js b/node_modules/lodash/_createBind.js deleted file mode 100644 index 07cb99f4..00000000 --- a/node_modules/lodash/_createBind.js +++ /dev/null @@ -1,28 +0,0 @@ -var createCtor = require('./_createCtor'), - root = require('./_root'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1; - -/** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg`. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. - */ -function createBind(func, bitmask, thisArg) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return fn.apply(isBind ? thisArg : this, arguments); - } - return wrapper; -} - -module.exports = createBind; diff --git a/node_modules/lodash/_createCaseFirst.js b/node_modules/lodash/_createCaseFirst.js deleted file mode 100644 index fe8ea483..00000000 --- a/node_modules/lodash/_createCaseFirst.js +++ /dev/null @@ -1,33 +0,0 @@ -var castSlice = require('./_castSlice'), - hasUnicode = require('./_hasUnicode'), - stringToArray = require('./_stringToArray'), - toString = require('./toString'); - -/** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ -function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; -} - -module.exports = createCaseFirst; diff --git a/node_modules/lodash/_createCompounder.js b/node_modules/lodash/_createCompounder.js deleted file mode 100644 index 8d4cee2c..00000000 --- a/node_modules/lodash/_createCompounder.js +++ /dev/null @@ -1,24 +0,0 @@ -var arrayReduce = require('./_arrayReduce'), - deburr = require('./deburr'), - words = require('./words'); - -/** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]"; - -/** Used to match apostrophes. */ -var reApos = RegExp(rsApos, 'g'); - -/** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ -function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; -} - -module.exports = createCompounder; diff --git a/node_modules/lodash/_createCtor.js b/node_modules/lodash/_createCtor.js deleted file mode 100644 index 9047aa5f..00000000 --- a/node_modules/lodash/_createCtor.js +++ /dev/null @@ -1,37 +0,0 @@ -var baseCreate = require('./_baseCreate'), - isObject = require('./isObject'); - -/** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ -function createCtor(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. See - // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - switch (args.length) { - case 0: return new Ctor; - case 1: return new Ctor(args[0]); - case 2: return new Ctor(args[0], args[1]); - case 3: return new Ctor(args[0], args[1], args[2]); - case 4: return new Ctor(args[0], args[1], args[2], args[3]); - case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - } - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; -} - -module.exports = createCtor; diff --git a/node_modules/lodash/_createCurry.js b/node_modules/lodash/_createCurry.js deleted file mode 100644 index f06c2cdd..00000000 --- a/node_modules/lodash/_createCurry.js +++ /dev/null @@ -1,46 +0,0 @@ -var apply = require('./_apply'), - createCtor = require('./_createCtor'), - createHybrid = require('./_createHybrid'), - createRecurry = require('./_createRecurry'), - getHolder = require('./_getHolder'), - replaceHolders = require('./_replaceHolders'), - root = require('./_root'); - -/** - * Creates a function that wraps `func` to enable currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {number} arity The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ -function createCurry(func, bitmask, arity) { - var Ctor = createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length, - placeholder = getHolder(wrapper); - - while (index--) { - args[index] = arguments[index]; - } - var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); - - length -= holders.length; - if (length < arity) { - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); - } - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return apply(fn, this, args); - } - return wrapper; -} - -module.exports = createCurry; diff --git a/node_modules/lodash/_createFind.js b/node_modules/lodash/_createFind.js deleted file mode 100644 index 8859ff89..00000000 --- a/node_modules/lodash/_createFind.js +++ /dev/null @@ -1,25 +0,0 @@ -var baseIteratee = require('./_baseIteratee'), - isArrayLike = require('./isArrayLike'), - keys = require('./keys'); - -/** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ -function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike(collection)) { - var iteratee = baseIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { return iteratee(iterable[key], key, iterable); }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; - }; -} - -module.exports = createFind; diff --git a/node_modules/lodash/_createFlow.js b/node_modules/lodash/_createFlow.js deleted file mode 100644 index baaddbf5..00000000 --- a/node_modules/lodash/_createFlow.js +++ /dev/null @@ -1,78 +0,0 @@ -var LodashWrapper = require('./_LodashWrapper'), - flatRest = require('./_flatRest'), - getData = require('./_getData'), - getFuncName = require('./_getFuncName'), - isArray = require('./isArray'), - isLaziable = require('./_isLaziable'); - -/** Error message constants. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/** Used to compose bitmasks for function metadata. */ -var WRAP_CURRY_FLAG = 8, - WRAP_PARTIAL_FLAG = 32, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256; - -/** - * Creates a `_.flow` or `_.flowRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new flow function. - */ -function createFlow(fromRight) { - return flatRest(function(funcs) { - var length = funcs.length, - index = length, - prereq = LodashWrapper.prototype.thru; - - if (fromRight) { - funcs.reverse(); - } - while (index--) { - var func = funcs[index]; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (prereq && !wrapper && getFuncName(func) == 'wrapper') { - var wrapper = new LodashWrapper([], true); - } - } - index = wrapper ? index : length; - while (++index < length) { - func = funcs[index]; - - var funcName = getFuncName(func), - data = funcName == 'wrapper' ? getData(func) : undefined; - - if (data && isLaziable(data[0]) && - data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && - !data[4].length && data[9] == 1 - ) { - wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); - } else { - wrapper = (func.length == 1 && isLaziable(func)) - ? wrapper[funcName]() - : wrapper.thru(func); - } - } - return function() { - var args = arguments, - value = args[0]; - - if (wrapper && args.length == 1 && isArray(value)) { - return wrapper.plant(value).value(); - } - var index = 0, - result = length ? funcs[index].apply(this, args) : value; - - while (++index < length) { - result = funcs[index].call(this, result); - } - return result; - }; - }); -} - -module.exports = createFlow; diff --git a/node_modules/lodash/_createHybrid.js b/node_modules/lodash/_createHybrid.js deleted file mode 100644 index b671bd11..00000000 --- a/node_modules/lodash/_createHybrid.js +++ /dev/null @@ -1,92 +0,0 @@ -var composeArgs = require('./_composeArgs'), - composeArgsRight = require('./_composeArgsRight'), - countHolders = require('./_countHolders'), - createCtor = require('./_createCtor'), - createRecurry = require('./_createRecurry'), - getHolder = require('./_getHolder'), - reorder = require('./_reorder'), - replaceHolders = require('./_replaceHolders'), - root = require('./_root'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_ARY_FLAG = 128, - WRAP_FLIP_FLAG = 512; - -/** - * Creates a function that wraps `func` to invoke it with optional `this` - * binding of `thisArg`, partial application, and currying. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided - * to the new function. - * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ -function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { - var isAry = bitmask & WRAP_ARY_FLAG, - isBind = bitmask & WRAP_BIND_FLAG, - isBindKey = bitmask & WRAP_BIND_KEY_FLAG, - isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), - isFlip = bitmask & WRAP_FLIP_FLAG, - Ctor = isBindKey ? undefined : createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length; - - while (index--) { - args[index] = arguments[index]; - } - if (isCurried) { - var placeholder = getHolder(wrapper), - holdersCount = countHolders(args, placeholder); - } - if (partials) { - args = composeArgs(args, partials, holders, isCurried); - } - if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight, isCurried); - } - length -= holdersCount; - if (isCurried && length < arity) { - var newHolders = replaceHolders(args, placeholder); - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length - ); - } - var thisBinding = isBind ? thisArg : this, - fn = isBindKey ? thisBinding[func] : func; - - length = args.length; - if (argPos) { - args = reorder(args, argPos); - } else if (isFlip && length > 1) { - args.reverse(); - } - if (isAry && ary < length) { - args.length = ary; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtor(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; -} - -module.exports = createHybrid; diff --git a/node_modules/lodash/_createInverter.js b/node_modules/lodash/_createInverter.js deleted file mode 100644 index 6c0c5629..00000000 --- a/node_modules/lodash/_createInverter.js +++ /dev/null @@ -1,17 +0,0 @@ -var baseInverter = require('./_baseInverter'); - -/** - * Creates a function like `_.invertBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} toIteratee The function to resolve iteratees. - * @returns {Function} Returns the new inverter function. - */ -function createInverter(setter, toIteratee) { - return function(object, iteratee) { - return baseInverter(object, setter, toIteratee(iteratee), {}); - }; -} - -module.exports = createInverter; diff --git a/node_modules/lodash/_createMathOperation.js b/node_modules/lodash/_createMathOperation.js deleted file mode 100644 index f1e238ac..00000000 --- a/node_modules/lodash/_createMathOperation.js +++ /dev/null @@ -1,38 +0,0 @@ -var baseToNumber = require('./_baseToNumber'), - baseToString = require('./_baseToString'); - -/** - * Creates a function that performs a mathematical operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @param {number} [defaultValue] The value used for `undefined` arguments. - * @returns {Function} Returns the new mathematical operation function. - */ -function createMathOperation(operator, defaultValue) { - return function(value, other) { - var result; - if (value === undefined && other === undefined) { - return defaultValue; - } - if (value !== undefined) { - result = value; - } - if (other !== undefined) { - if (result === undefined) { - return other; - } - if (typeof value == 'string' || typeof other == 'string') { - value = baseToString(value); - other = baseToString(other); - } else { - value = baseToNumber(value); - other = baseToNumber(other); - } - result = operator(value, other); - } - return result; - }; -} - -module.exports = createMathOperation; diff --git a/node_modules/lodash/_createOver.js b/node_modules/lodash/_createOver.js deleted file mode 100644 index 3b945516..00000000 --- a/node_modules/lodash/_createOver.js +++ /dev/null @@ -1,27 +0,0 @@ -var apply = require('./_apply'), - arrayMap = require('./_arrayMap'), - baseIteratee = require('./_baseIteratee'), - baseRest = require('./_baseRest'), - baseUnary = require('./_baseUnary'), - flatRest = require('./_flatRest'); - -/** - * Creates a function like `_.over`. - * - * @private - * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new over function. - */ -function createOver(arrayFunc) { - return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); - return baseRest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee) { - return apply(iteratee, thisArg, args); - }); - }); - }); -} - -module.exports = createOver; diff --git a/node_modules/lodash/_createPadding.js b/node_modules/lodash/_createPadding.js deleted file mode 100644 index 2124612b..00000000 --- a/node_modules/lodash/_createPadding.js +++ /dev/null @@ -1,33 +0,0 @@ -var baseRepeat = require('./_baseRepeat'), - baseToString = require('./_baseToString'), - castSlice = require('./_castSlice'), - hasUnicode = require('./_hasUnicode'), - stringSize = require('./_stringSize'), - stringToArray = require('./_stringToArray'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeCeil = Math.ceil; - -/** - * Creates the padding for `string` based on `length`. The `chars` string - * is truncated if the number of characters exceeds `length`. - * - * @private - * @param {number} length The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padding for `string`. - */ -function createPadding(length, chars) { - chars = chars === undefined ? ' ' : baseToString(chars); - - var charsLength = chars.length; - if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; - } - var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) - ? castSlice(stringToArray(result), 0, length).join('') - : result.slice(0, length); -} - -module.exports = createPadding; diff --git a/node_modules/lodash/_createPartial.js b/node_modules/lodash/_createPartial.js deleted file mode 100644 index e16c248b..00000000 --- a/node_modules/lodash/_createPartial.js +++ /dev/null @@ -1,43 +0,0 @@ -var apply = require('./_apply'), - createCtor = require('./_createCtor'), - root = require('./_root'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1; - -/** - * Creates a function that wraps `func` to invoke it with the `this` binding - * of `thisArg` and `partials` prepended to the arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to - * the new function. - * @returns {Function} Returns the new wrapped function. - */ -function createPartial(func, bitmask, thisArg, partials) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return apply(fn, isBind ? thisArg : this, args); - } - return wrapper; -} - -module.exports = createPartial; diff --git a/node_modules/lodash/_createRange.js b/node_modules/lodash/_createRange.js deleted file mode 100644 index 9f52c779..00000000 --- a/node_modules/lodash/_createRange.js +++ /dev/null @@ -1,30 +0,0 @@ -var baseRange = require('./_baseRange'), - isIterateeCall = require('./_isIterateeCall'), - toFinite = require('./toFinite'); - -/** - * Creates a `_.range` or `_.rangeRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new range function. - */ -function createRange(fromRight) { - return function(start, end, step) { - if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { - end = step = undefined; - } - // Ensure the sign of `-0` is preserved. - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); - return baseRange(start, end, step, fromRight); - }; -} - -module.exports = createRange; diff --git a/node_modules/lodash/_createRecurry.js b/node_modules/lodash/_createRecurry.js deleted file mode 100644 index eb29fb24..00000000 --- a/node_modules/lodash/_createRecurry.js +++ /dev/null @@ -1,56 +0,0 @@ -var isLaziable = require('./_isLaziable'), - setData = require('./_setData'), - setWrapToString = require('./_setWrapToString'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_BOUND_FLAG = 4, - WRAP_CURRY_FLAG = 8, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64; - -/** - * Creates a function that wraps `func` to continue currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder value. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ -function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { - var isCurry = bitmask & WRAP_CURRY_FLAG, - newHolders = isCurry ? holders : undefined, - newHoldersRight = isCurry ? undefined : holders, - newPartials = isCurry ? partials : undefined, - newPartialsRight = isCurry ? undefined : partials; - - bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); - bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); - - if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { - bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); - } - var newData = [ - func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, - newHoldersRight, argPos, ary, arity - ]; - - var result = wrapFunc.apply(undefined, newData); - if (isLaziable(func)) { - setData(result, newData); - } - result.placeholder = placeholder; - return setWrapToString(result, func, bitmask); -} - -module.exports = createRecurry; diff --git a/node_modules/lodash/_createRelationalOperation.js b/node_modules/lodash/_createRelationalOperation.js deleted file mode 100644 index a17c6b5e..00000000 --- a/node_modules/lodash/_createRelationalOperation.js +++ /dev/null @@ -1,20 +0,0 @@ -var toNumber = require('./toNumber'); - -/** - * Creates a function that performs a relational operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @returns {Function} Returns the new relational operation function. - */ -function createRelationalOperation(operator) { - return function(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { - value = toNumber(value); - other = toNumber(other); - } - return operator(value, other); - }; -} - -module.exports = createRelationalOperation; diff --git a/node_modules/lodash/_createRound.js b/node_modules/lodash/_createRound.js deleted file mode 100644 index 88be5df3..00000000 --- a/node_modules/lodash/_createRound.js +++ /dev/null @@ -1,35 +0,0 @@ -var root = require('./_root'), - toInteger = require('./toInteger'), - toNumber = require('./toNumber'), - toString = require('./toString'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeIsFinite = root.isFinite, - nativeMin = Math.min; - -/** - * Creates a function like `_.round`. - * - * @private - * @param {string} methodName The name of the `Math` method to use when rounding. - * @returns {Function} Returns the new round function. - */ -function createRound(methodName) { - var func = Math[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision && nativeIsFinite(number)) { - // Shift with exponential notation to avoid floating-point issues. - // See [MDN](https://mdn.io/round#Examples) for more details. - var pair = (toString(number) + 'e').split('e'), - value = func(pair[0] + 'e' + (+pair[1] + precision)); - - pair = (toString(value) + 'e').split('e'); - return +(pair[0] + 'e' + (+pair[1] - precision)); - } - return func(number); - }; -} - -module.exports = createRound; diff --git a/node_modules/lodash/_createSet.js b/node_modules/lodash/_createSet.js deleted file mode 100644 index 0f644eea..00000000 --- a/node_modules/lodash/_createSet.js +++ /dev/null @@ -1,19 +0,0 @@ -var Set = require('./_Set'), - noop = require('./noop'), - setToArray = require('./_setToArray'); - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - -/** - * Creates a set object of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { - return new Set(values); -}; - -module.exports = createSet; diff --git a/node_modules/lodash/_createToPairs.js b/node_modules/lodash/_createToPairs.js deleted file mode 100644 index 568417af..00000000 --- a/node_modules/lodash/_createToPairs.js +++ /dev/null @@ -1,30 +0,0 @@ -var baseToPairs = require('./_baseToPairs'), - getTag = require('./_getTag'), - mapToArray = require('./_mapToArray'), - setToPairs = require('./_setToPairs'); - -/** `Object#toString` result references. */ -var mapTag = '[object Map]', - setTag = '[object Set]'; - -/** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ -function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; -} - -module.exports = createToPairs; diff --git a/node_modules/lodash/_createWrap.js b/node_modules/lodash/_createWrap.js deleted file mode 100644 index 33f0633e..00000000 --- a/node_modules/lodash/_createWrap.js +++ /dev/null @@ -1,106 +0,0 @@ -var baseSetData = require('./_baseSetData'), - createBind = require('./_createBind'), - createCurry = require('./_createCurry'), - createHybrid = require('./_createHybrid'), - createPartial = require('./_createPartial'), - getData = require('./_getData'), - mergeData = require('./_mergeData'), - setData = require('./_setData'), - setWrapToString = require('./_setWrapToString'), - toInteger = require('./toInteger'); - -/** Error message constants. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Creates a function that either curries or invokes `func` with optional - * `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` or `_.curryRight` of a bound function - * 8 - `_.curry` - * 16 - `_.curryRight` - * 32 - `_.partial` - * 64 - `_.partialRight` - * 128 - `_.rearg` - * 256 - `_.ary` - * 512 - `_.flip` - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to be partially applied. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ -function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { - var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; - if (!isBindKey && typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); - partials = holders = undefined; - } - ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); - arity = arity === undefined ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - - if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, - holdersRight = holders; - - partials = holders = undefined; - } - var data = isBindKey ? undefined : getData(func); - - var newData = [ - func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, - argPos, ary, arity - ]; - - if (data) { - mergeData(newData, data); - } - func = newData[0]; - bitmask = newData[1]; - thisArg = newData[2]; - partials = newData[3]; - holders = newData[4]; - arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); - - if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { - bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); - } - if (!bitmask || bitmask == WRAP_BIND_FLAG) { - var result = createBind(func, bitmask, thisArg); - } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { - result = createCurry(func, bitmask, arity); - } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { - result = createPartial(func, bitmask, thisArg, partials); - } else { - result = createHybrid.apply(undefined, newData); - } - var setter = data ? baseSetData : setData; - return setWrapToString(setter(result, newData), func, bitmask); -} - -module.exports = createWrap; diff --git a/node_modules/lodash/_customDefaultsAssignIn.js b/node_modules/lodash/_customDefaultsAssignIn.js deleted file mode 100644 index 1f49e6fc..00000000 --- a/node_modules/lodash/_customDefaultsAssignIn.js +++ /dev/null @@ -1,29 +0,0 @@ -var eq = require('./eq'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used by `_.defaults` to customize its `_.assignIn` use to assign properties - * of source objects to the destination object for all destination properties - * that resolve to `undefined`. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ -function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; -} - -module.exports = customDefaultsAssignIn; diff --git a/node_modules/lodash/_customDefaultsMerge.js b/node_modules/lodash/_customDefaultsMerge.js deleted file mode 100644 index 4cab3175..00000000 --- a/node_modules/lodash/_customDefaultsMerge.js +++ /dev/null @@ -1,28 +0,0 @@ -var baseMerge = require('./_baseMerge'), - isObject = require('./isObject'); - -/** - * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source - * objects into destination objects that are passed thru. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - * @returns {*} Returns the value to assign. - */ -function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); - stack['delete'](srcValue); - } - return objValue; -} - -module.exports = customDefaultsMerge; diff --git a/node_modules/lodash/_customOmitClone.js b/node_modules/lodash/_customOmitClone.js deleted file mode 100644 index 968db2ef..00000000 --- a/node_modules/lodash/_customOmitClone.js +++ /dev/null @@ -1,16 +0,0 @@ -var isPlainObject = require('./isPlainObject'); - -/** - * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain - * objects. - * - * @private - * @param {*} value The value to inspect. - * @param {string} key The key of the property to inspect. - * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. - */ -function customOmitClone(value) { - return isPlainObject(value) ? undefined : value; -} - -module.exports = customOmitClone; diff --git a/node_modules/lodash/_deburrLetter.js b/node_modules/lodash/_deburrLetter.js deleted file mode 100644 index 3e531edc..00000000 --- a/node_modules/lodash/_deburrLetter.js +++ /dev/null @@ -1,71 +0,0 @@ -var basePropertyOf = require('./_basePropertyOf'); - -/** Used to map Latin Unicode letters to basic Latin letters. */ -var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' -}; - -/** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ -var deburrLetter = basePropertyOf(deburredLetters); - -module.exports = deburrLetter; diff --git a/node_modules/lodash/_defineProperty.js b/node_modules/lodash/_defineProperty.js deleted file mode 100644 index b6116d92..00000000 --- a/node_modules/lodash/_defineProperty.js +++ /dev/null @@ -1,11 +0,0 @@ -var getNative = require('./_getNative'); - -var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} -}()); - -module.exports = defineProperty; diff --git a/node_modules/lodash/_equalArrays.js b/node_modules/lodash/_equalArrays.js deleted file mode 100644 index 824228c7..00000000 --- a/node_modules/lodash/_equalArrays.js +++ /dev/null @@ -1,84 +0,0 @@ -var SetCache = require('./_SetCache'), - arraySome = require('./_arraySome'), - cacheHas = require('./_cacheHas'); - -/** Used to compose bitmasks for value comparisons. */ -var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - -/** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ -function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; -} - -module.exports = equalArrays; diff --git a/node_modules/lodash/_equalByTag.js b/node_modules/lodash/_equalByTag.js deleted file mode 100644 index 71919e86..00000000 --- a/node_modules/lodash/_equalByTag.js +++ /dev/null @@ -1,112 +0,0 @@ -var Symbol = require('./_Symbol'), - Uint8Array = require('./_Uint8Array'), - eq = require('./eq'), - equalArrays = require('./_equalArrays'), - mapToArray = require('./_mapToArray'), - setToArray = require('./_setToArray'); - -/** Used to compose bitmasks for value comparisons. */ -var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - -/** `Object#toString` result references. */ -var boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - mapTag = '[object Map]', - numberTag = '[object Number]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]'; - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - -/** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; -} - -module.exports = equalByTag; diff --git a/node_modules/lodash/_equalObjects.js b/node_modules/lodash/_equalObjects.js deleted file mode 100644 index cdaacd2d..00000000 --- a/node_modules/lodash/_equalObjects.js +++ /dev/null @@ -1,90 +0,0 @@ -var getAllKeys = require('./_getAllKeys'); - -/** Used to compose bitmasks for value comparisons. */ -var COMPARE_PARTIAL_FLAG = 1; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; -} - -module.exports = equalObjects; diff --git a/node_modules/lodash/_escapeHtmlChar.js b/node_modules/lodash/_escapeHtmlChar.js deleted file mode 100644 index 7ca68ee6..00000000 --- a/node_modules/lodash/_escapeHtmlChar.js +++ /dev/null @@ -1,21 +0,0 @@ -var basePropertyOf = require('./_basePropertyOf'); - -/** Used to map characters to HTML entities. */ -var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' -}; - -/** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ -var escapeHtmlChar = basePropertyOf(htmlEscapes); - -module.exports = escapeHtmlChar; diff --git a/node_modules/lodash/_escapeStringChar.js b/node_modules/lodash/_escapeStringChar.js deleted file mode 100644 index 44eca96c..00000000 --- a/node_modules/lodash/_escapeStringChar.js +++ /dev/null @@ -1,22 +0,0 @@ -/** Used to escape characters for inclusion in compiled string literals. */ -var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' -}; - -/** - * Used by `_.template` to escape characters for inclusion in compiled string literals. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ -function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; -} - -module.exports = escapeStringChar; diff --git a/node_modules/lodash/_flatRest.js b/node_modules/lodash/_flatRest.js deleted file mode 100644 index 94ab6cca..00000000 --- a/node_modules/lodash/_flatRest.js +++ /dev/null @@ -1,16 +0,0 @@ -var flatten = require('./flatten'), - overRest = require('./_overRest'), - setToString = require('./_setToString'); - -/** - * A specialized version of `baseRest` which flattens the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ -function flatRest(func) { - return setToString(overRest(func, undefined, flatten), func + ''); -} - -module.exports = flatRest; diff --git a/node_modules/lodash/_freeGlobal.js b/node_modules/lodash/_freeGlobal.js deleted file mode 100644 index bbec998f..00000000 --- a/node_modules/lodash/_freeGlobal.js +++ /dev/null @@ -1,4 +0,0 @@ -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -module.exports = freeGlobal; diff --git a/node_modules/lodash/_getAllKeys.js b/node_modules/lodash/_getAllKeys.js deleted file mode 100644 index a9ce6995..00000000 --- a/node_modules/lodash/_getAllKeys.js +++ /dev/null @@ -1,16 +0,0 @@ -var baseGetAllKeys = require('./_baseGetAllKeys'), - getSymbols = require('./_getSymbols'), - keys = require('./keys'); - -/** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ -function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); -} - -module.exports = getAllKeys; diff --git a/node_modules/lodash/_getAllKeysIn.js b/node_modules/lodash/_getAllKeysIn.js deleted file mode 100644 index 1b466784..00000000 --- a/node_modules/lodash/_getAllKeysIn.js +++ /dev/null @@ -1,17 +0,0 @@ -var baseGetAllKeys = require('./_baseGetAllKeys'), - getSymbolsIn = require('./_getSymbolsIn'), - keysIn = require('./keysIn'); - -/** - * Creates an array of own and inherited enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ -function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); -} - -module.exports = getAllKeysIn; diff --git a/node_modules/lodash/_getData.js b/node_modules/lodash/_getData.js deleted file mode 100644 index a1fe7b77..00000000 --- a/node_modules/lodash/_getData.js +++ /dev/null @@ -1,15 +0,0 @@ -var metaMap = require('./_metaMap'), - noop = require('./noop'); - -/** - * Gets metadata for `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {*} Returns the metadata for `func`. - */ -var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); -}; - -module.exports = getData; diff --git a/node_modules/lodash/_getFuncName.js b/node_modules/lodash/_getFuncName.js deleted file mode 100644 index 21e15b33..00000000 --- a/node_modules/lodash/_getFuncName.js +++ /dev/null @@ -1,31 +0,0 @@ -var realNames = require('./_realNames'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Gets the name of `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {string} Returns the function name. - */ -function getFuncName(func) { - var result = (func.name + ''), - array = realNames[result], - length = hasOwnProperty.call(realNames, result) ? array.length : 0; - - while (length--) { - var data = array[length], - otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } - } - return result; -} - -module.exports = getFuncName; diff --git a/node_modules/lodash/_getHolder.js b/node_modules/lodash/_getHolder.js deleted file mode 100644 index 65e94b5c..00000000 --- a/node_modules/lodash/_getHolder.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Gets the argument placeholder value for `func`. - * - * @private - * @param {Function} func The function to inspect. - * @returns {*} Returns the placeholder value. - */ -function getHolder(func) { - var object = func; - return object.placeholder; -} - -module.exports = getHolder; diff --git a/node_modules/lodash/_getMapData.js b/node_modules/lodash/_getMapData.js deleted file mode 100644 index 17f63032..00000000 --- a/node_modules/lodash/_getMapData.js +++ /dev/null @@ -1,18 +0,0 @@ -var isKeyable = require('./_isKeyable'); - -/** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ -function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; -} - -module.exports = getMapData; diff --git a/node_modules/lodash/_getMatchData.js b/node_modules/lodash/_getMatchData.js deleted file mode 100644 index 2cc70f91..00000000 --- a/node_modules/lodash/_getMatchData.js +++ /dev/null @@ -1,24 +0,0 @@ -var isStrictComparable = require('./_isStrictComparable'), - keys = require('./keys'); - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = keys(object), - length = result.length; - - while (length--) { - var key = result[length], - value = object[key]; - - result[length] = [key, value, isStrictComparable(value)]; - } - return result; -} - -module.exports = getMatchData; diff --git a/node_modules/lodash/_getNative.js b/node_modules/lodash/_getNative.js deleted file mode 100644 index 97a622b8..00000000 --- a/node_modules/lodash/_getNative.js +++ /dev/null @@ -1,17 +0,0 @@ -var baseIsNative = require('./_baseIsNative'), - getValue = require('./_getValue'); - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; -} - -module.exports = getNative; diff --git a/node_modules/lodash/_getPrototype.js b/node_modules/lodash/_getPrototype.js deleted file mode 100644 index e8086121..00000000 --- a/node_modules/lodash/_getPrototype.js +++ /dev/null @@ -1,6 +0,0 @@ -var overArg = require('./_overArg'); - -/** Built-in value references. */ -var getPrototype = overArg(Object.getPrototypeOf, Object); - -module.exports = getPrototype; diff --git a/node_modules/lodash/_getRawTag.js b/node_modules/lodash/_getRawTag.js deleted file mode 100644 index 49a95c9c..00000000 --- a/node_modules/lodash/_getRawTag.js +++ /dev/null @@ -1,46 +0,0 @@ -var Symbol = require('./_Symbol'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; - -/** Built-in value references. */ -var symToStringTag = Symbol ? Symbol.toStringTag : undefined; - -/** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ -function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; -} - -module.exports = getRawTag; diff --git a/node_modules/lodash/_getSymbols.js b/node_modules/lodash/_getSymbols.js deleted file mode 100644 index 7d6eafeb..00000000 --- a/node_modules/lodash/_getSymbols.js +++ /dev/null @@ -1,30 +0,0 @@ -var arrayFilter = require('./_arrayFilter'), - stubArray = require('./stubArray'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetSymbols = Object.getOwnPropertySymbols; - -/** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ -var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); -}; - -module.exports = getSymbols; diff --git a/node_modules/lodash/_getSymbolsIn.js b/node_modules/lodash/_getSymbolsIn.js deleted file mode 100644 index cec0855a..00000000 --- a/node_modules/lodash/_getSymbolsIn.js +++ /dev/null @@ -1,25 +0,0 @@ -var arrayPush = require('./_arrayPush'), - getPrototype = require('./_getPrototype'), - getSymbols = require('./_getSymbols'), - stubArray = require('./stubArray'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetSymbols = Object.getOwnPropertySymbols; - -/** - * Creates an array of the own and inherited enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ -var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result = []; - while (object) { - arrayPush(result, getSymbols(object)); - object = getPrototype(object); - } - return result; -}; - -module.exports = getSymbolsIn; diff --git a/node_modules/lodash/_getTag.js b/node_modules/lodash/_getTag.js deleted file mode 100644 index deaf89d5..00000000 --- a/node_modules/lodash/_getTag.js +++ /dev/null @@ -1,58 +0,0 @@ -var DataView = require('./_DataView'), - Map = require('./_Map'), - Promise = require('./_Promise'), - Set = require('./_Set'), - WeakMap = require('./_WeakMap'), - baseGetTag = require('./_baseGetTag'), - toSource = require('./_toSource'); - -/** `Object#toString` result references. */ -var mapTag = '[object Map]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - setTag = '[object Set]', - weakMapTag = '[object WeakMap]'; - -var dataViewTag = '[object DataView]'; - -/** Used to detect maps, sets, and weakmaps. */ -var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - -/** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -var getTag = baseGetTag; - -// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. -if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; -} - -module.exports = getTag; diff --git a/node_modules/lodash/_getValue.js b/node_modules/lodash/_getValue.js deleted file mode 100644 index 5f7d7736..00000000 --- a/node_modules/lodash/_getValue.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ -function getValue(object, key) { - return object == null ? undefined : object[key]; -} - -module.exports = getValue; diff --git a/node_modules/lodash/_getView.js b/node_modules/lodash/_getView.js deleted file mode 100644 index df1e5d44..00000000 --- a/node_modules/lodash/_getView.js +++ /dev/null @@ -1,33 +0,0 @@ -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max, - nativeMin = Math.min; - -/** - * Gets the view, applying any `transforms` to the `start` and `end` positions. - * - * @private - * @param {number} start The start of the view. - * @param {number} end The end of the view. - * @param {Array} transforms The transformations to apply to the view. - * @returns {Object} Returns an object containing the `start` and `end` - * positions of the view. - */ -function getView(start, end, transforms) { - var index = -1, - length = transforms.length; - - while (++index < length) { - var data = transforms[index], - size = data.size; - - switch (data.type) { - case 'drop': start += size; break; - case 'dropRight': end -= size; break; - case 'take': end = nativeMin(end, start + size); break; - case 'takeRight': start = nativeMax(start, end - size); break; - } - } - return { 'start': start, 'end': end }; -} - -module.exports = getView; diff --git a/node_modules/lodash/_getWrapDetails.js b/node_modules/lodash/_getWrapDetails.js deleted file mode 100644 index 3bcc6e48..00000000 --- a/node_modules/lodash/_getWrapDetails.js +++ /dev/null @@ -1,17 +0,0 @@ -/** Used to match wrap detail comments. */ -var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, - reSplitDetails = /,? & /; - -/** - * Extracts wrapper details from the `source` body comment. - * - * @private - * @param {string} source The source to inspect. - * @returns {Array} Returns the wrapper details. - */ -function getWrapDetails(source) { - var match = source.match(reWrapDetails); - return match ? match[1].split(reSplitDetails) : []; -} - -module.exports = getWrapDetails; diff --git a/node_modules/lodash/_hasPath.js b/node_modules/lodash/_hasPath.js deleted file mode 100644 index 93dbde15..00000000 --- a/node_modules/lodash/_hasPath.js +++ /dev/null @@ -1,39 +0,0 @@ -var castPath = require('./_castPath'), - isArguments = require('./isArguments'), - isArray = require('./isArray'), - isIndex = require('./_isIndex'), - isLength = require('./isLength'), - toKey = require('./_toKey'); - -/** - * Checks if `path` exists on `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @param {Function} hasFunc The function to check properties. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - */ -function hasPath(object, path, hasFunc) { - path = castPath(path, object); - - var index = -1, - length = path.length, - result = false; - - while (++index < length) { - var key = toKey(path[index]); - if (!(result = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result || ++index != length) { - return result; - } - length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); -} - -module.exports = hasPath; diff --git a/node_modules/lodash/_hasUnicode.js b/node_modules/lodash/_hasUnicode.js deleted file mode 100644 index cb6ca15f..00000000 --- a/node_modules/lodash/_hasUnicode.js +++ /dev/null @@ -1,26 +0,0 @@ -/** Used to compose unicode character classes. */ -var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsVarRange = '\\ufe0e\\ufe0f'; - -/** Used to compose unicode capture groups. */ -var rsZWJ = '\\u200d'; - -/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ -var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - -/** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ -function hasUnicode(string) { - return reHasUnicode.test(string); -} - -module.exports = hasUnicode; diff --git a/node_modules/lodash/_hasUnicodeWord.js b/node_modules/lodash/_hasUnicodeWord.js deleted file mode 100644 index 95d52c44..00000000 --- a/node_modules/lodash/_hasUnicodeWord.js +++ /dev/null @@ -1,15 +0,0 @@ -/** Used to detect strings that need a more robust regexp to match words. */ -var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - -/** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ -function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); -} - -module.exports = hasUnicodeWord; diff --git a/node_modules/lodash/_hashClear.js b/node_modules/lodash/_hashClear.js deleted file mode 100644 index 5d4b70cc..00000000 --- a/node_modules/lodash/_hashClear.js +++ /dev/null @@ -1,15 +0,0 @@ -var nativeCreate = require('./_nativeCreate'); - -/** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ -function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; -} - -module.exports = hashClear; diff --git a/node_modules/lodash/_hashDelete.js b/node_modules/lodash/_hashDelete.js deleted file mode 100644 index ea9dabf1..00000000 --- a/node_modules/lodash/_hashDelete.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; -} - -module.exports = hashDelete; diff --git a/node_modules/lodash/_hashGet.js b/node_modules/lodash/_hashGet.js deleted file mode 100644 index 1fc2f34b..00000000 --- a/node_modules/lodash/_hashGet.js +++ /dev/null @@ -1,30 +0,0 @@ -var nativeCreate = require('./_nativeCreate'); - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; -} - -module.exports = hashGet; diff --git a/node_modules/lodash/_hashHas.js b/node_modules/lodash/_hashHas.js deleted file mode 100644 index 281a5517..00000000 --- a/node_modules/lodash/_hashHas.js +++ /dev/null @@ -1,23 +0,0 @@ -var nativeCreate = require('./_nativeCreate'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); -} - -module.exports = hashHas; diff --git a/node_modules/lodash/_hashSet.js b/node_modules/lodash/_hashSet.js deleted file mode 100644 index e1055283..00000000 --- a/node_modules/lodash/_hashSet.js +++ /dev/null @@ -1,23 +0,0 @@ -var nativeCreate = require('./_nativeCreate'); - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ -function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; -} - -module.exports = hashSet; diff --git a/node_modules/lodash/_initCloneArray.js b/node_modules/lodash/_initCloneArray.js deleted file mode 100644 index 078c15af..00000000 --- a/node_modules/lodash/_initCloneArray.js +++ /dev/null @@ -1,26 +0,0 @@ -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ -function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; -} - -module.exports = initCloneArray; diff --git a/node_modules/lodash/_initCloneByTag.js b/node_modules/lodash/_initCloneByTag.js deleted file mode 100644 index f69a008c..00000000 --- a/node_modules/lodash/_initCloneByTag.js +++ /dev/null @@ -1,77 +0,0 @@ -var cloneArrayBuffer = require('./_cloneArrayBuffer'), - cloneDataView = require('./_cloneDataView'), - cloneRegExp = require('./_cloneRegExp'), - cloneSymbol = require('./_cloneSymbol'), - cloneTypedArray = require('./_cloneTypedArray'); - -/** `Object#toString` result references. */ -var boolTag = '[object Boolean]', - dateTag = '[object Date]', - mapTag = '[object Map]', - numberTag = '[object Number]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return new Ctor; - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return new Ctor; - - case symbolTag: - return cloneSymbol(object); - } -} - -module.exports = initCloneByTag; diff --git a/node_modules/lodash/_initCloneObject.js b/node_modules/lodash/_initCloneObject.js deleted file mode 100644 index 5a13e64a..00000000 --- a/node_modules/lodash/_initCloneObject.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseCreate = require('./_baseCreate'), - getPrototype = require('./_getPrototype'), - isPrototype = require('./_isPrototype'); - -/** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; -} - -module.exports = initCloneObject; diff --git a/node_modules/lodash/_insertWrapDetails.js b/node_modules/lodash/_insertWrapDetails.js deleted file mode 100644 index e7908086..00000000 --- a/node_modules/lodash/_insertWrapDetails.js +++ /dev/null @@ -1,23 +0,0 @@ -/** Used to match wrap detail comments. */ -var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/; - -/** - * Inserts wrapper `details` in a comment at the top of the `source` body. - * - * @private - * @param {string} source The source to modify. - * @returns {Array} details The details to insert. - * @returns {string} Returns the modified source. - */ -function insertWrapDetails(source, details) { - var length = details.length; - if (!length) { - return source; - } - var lastIndex = length - 1; - details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; - details = details.join(length > 2 ? ', ' : ' '); - return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); -} - -module.exports = insertWrapDetails; diff --git a/node_modules/lodash/_isFlattenable.js b/node_modules/lodash/_isFlattenable.js deleted file mode 100644 index 4cc2c249..00000000 --- a/node_modules/lodash/_isFlattenable.js +++ /dev/null @@ -1,20 +0,0 @@ -var Symbol = require('./_Symbol'), - isArguments = require('./isArguments'), - isArray = require('./isArray'); - -/** Built-in value references. */ -var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; - -/** - * Checks if `value` is a flattenable `arguments` object or array. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. - */ -function isFlattenable(value) { - return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); -} - -module.exports = isFlattenable; diff --git a/node_modules/lodash/_isIndex.js b/node_modules/lodash/_isIndex.js deleted file mode 100644 index 061cd390..00000000 --- a/node_modules/lodash/_isIndex.js +++ /dev/null @@ -1,25 +0,0 @@ -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** Used to detect unsigned integer values. */ -var reIsUint = /^(?:0|[1-9]\d*)$/; - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); -} - -module.exports = isIndex; diff --git a/node_modules/lodash/_isIterateeCall.js b/node_modules/lodash/_isIterateeCall.js deleted file mode 100644 index a0bb5a9c..00000000 --- a/node_modules/lodash/_isIterateeCall.js +++ /dev/null @@ -1,30 +0,0 @@ -var eq = require('./eq'), - isArrayLike = require('./isArrayLike'), - isIndex = require('./_isIndex'), - isObject = require('./isObject'); - -/** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ -function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; -} - -module.exports = isIterateeCall; diff --git a/node_modules/lodash/_isKey.js b/node_modules/lodash/_isKey.js deleted file mode 100644 index ff08b068..00000000 --- a/node_modules/lodash/_isKey.js +++ /dev/null @@ -1,29 +0,0 @@ -var isArray = require('./isArray'), - isSymbol = require('./isSymbol'); - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/; - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (isArray(value)) { - return false; - } - var type = typeof value; - if (type == 'number' || type == 'symbol' || type == 'boolean' || - value == null || isSymbol(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); -} - -module.exports = isKey; diff --git a/node_modules/lodash/_isKeyable.js b/node_modules/lodash/_isKeyable.js deleted file mode 100644 index 39f1828d..00000000 --- a/node_modules/lodash/_isKeyable.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); -} - -module.exports = isKeyable; diff --git a/node_modules/lodash/_isLaziable.js b/node_modules/lodash/_isLaziable.js deleted file mode 100644 index a57c4f2d..00000000 --- a/node_modules/lodash/_isLaziable.js +++ /dev/null @@ -1,28 +0,0 @@ -var LazyWrapper = require('./_LazyWrapper'), - getData = require('./_getData'), - getFuncName = require('./_getFuncName'), - lodash = require('./wrapperLodash'); - -/** - * Checks if `func` has a lazy counterpart. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, - * else `false`. - */ -function isLaziable(func) { - var funcName = getFuncName(func), - other = lodash[funcName]; - - if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { - return true; - } - var data = getData(other); - return !!data && func === data[0]; -} - -module.exports = isLaziable; diff --git a/node_modules/lodash/_isMaskable.js b/node_modules/lodash/_isMaskable.js deleted file mode 100644 index eb98d09f..00000000 --- a/node_modules/lodash/_isMaskable.js +++ /dev/null @@ -1,14 +0,0 @@ -var coreJsData = require('./_coreJsData'), - isFunction = require('./isFunction'), - stubFalse = require('./stubFalse'); - -/** - * Checks if `func` is capable of being masked. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `func` is maskable, else `false`. - */ -var isMaskable = coreJsData ? isFunction : stubFalse; - -module.exports = isMaskable; diff --git a/node_modules/lodash/_isMasked.js b/node_modules/lodash/_isMasked.js deleted file mode 100644 index 4b0f21ba..00000000 --- a/node_modules/lodash/_isMasked.js +++ /dev/null @@ -1,20 +0,0 @@ -var coreJsData = require('./_coreJsData'); - -/** Used to detect methods masquerading as native. */ -var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; -}()); - -/** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ -function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); -} - -module.exports = isMasked; diff --git a/node_modules/lodash/_isPrototype.js b/node_modules/lodash/_isPrototype.js deleted file mode 100644 index 0f29498d..00000000 --- a/node_modules/lodash/_isPrototype.js +++ /dev/null @@ -1,18 +0,0 @@ -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ -function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; -} - -module.exports = isPrototype; diff --git a/node_modules/lodash/_isStrictComparable.js b/node_modules/lodash/_isStrictComparable.js deleted file mode 100644 index b59f40b8..00000000 --- a/node_modules/lodash/_isStrictComparable.js +++ /dev/null @@ -1,15 +0,0 @@ -var isObject = require('./isObject'); - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -module.exports = isStrictComparable; diff --git a/node_modules/lodash/_iteratorToArray.js b/node_modules/lodash/_iteratorToArray.js deleted file mode 100644 index 47685664..00000000 --- a/node_modules/lodash/_iteratorToArray.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ -function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; -} - -module.exports = iteratorToArray; diff --git a/node_modules/lodash/_lazyClone.js b/node_modules/lodash/_lazyClone.js deleted file mode 100644 index d8a51f87..00000000 --- a/node_modules/lodash/_lazyClone.js +++ /dev/null @@ -1,23 +0,0 @@ -var LazyWrapper = require('./_LazyWrapper'), - copyArray = require('./_copyArray'); - -/** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ -function lazyClone() { - var result = new LazyWrapper(this.__wrapped__); - result.__actions__ = copyArray(this.__actions__); - result.__dir__ = this.__dir__; - result.__filtered__ = this.__filtered__; - result.__iteratees__ = copyArray(this.__iteratees__); - result.__takeCount__ = this.__takeCount__; - result.__views__ = copyArray(this.__views__); - return result; -} - -module.exports = lazyClone; diff --git a/node_modules/lodash/_lazyReverse.js b/node_modules/lodash/_lazyReverse.js deleted file mode 100644 index c5b52190..00000000 --- a/node_modules/lodash/_lazyReverse.js +++ /dev/null @@ -1,23 +0,0 @@ -var LazyWrapper = require('./_LazyWrapper'); - -/** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ -function lazyReverse() { - if (this.__filtered__) { - var result = new LazyWrapper(this); - result.__dir__ = -1; - result.__filtered__ = true; - } else { - result = this.clone(); - result.__dir__ *= -1; - } - return result; -} - -module.exports = lazyReverse; diff --git a/node_modules/lodash/_lazyValue.js b/node_modules/lodash/_lazyValue.js deleted file mode 100644 index 371ca8d2..00000000 --- a/node_modules/lodash/_lazyValue.js +++ /dev/null @@ -1,69 +0,0 @@ -var baseWrapperValue = require('./_baseWrapperValue'), - getView = require('./_getView'), - isArray = require('./isArray'); - -/** Used to indicate the type of lazy iteratees. */ -var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMin = Math.min; - -/** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ -function lazyValue() { - var array = this.__wrapped__.value(), - dir = this.__dir__, - isArr = isArray(array), - isRight = dir < 0, - arrLength = isArr ? array.length : 0, - view = getView(0, arrLength, this.__views__), - start = view.start, - end = view.end, - length = end - start, - index = isRight ? end : (start - 1), - iteratees = this.__iteratees__, - iterLength = iteratees.length, - resIndex = 0, - takeCount = nativeMin(length, this.__takeCount__); - - if (!isArr || (!isRight && arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; - - outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result[resIndex++] = value; - } - return result; -} - -module.exports = lazyValue; diff --git a/node_modules/lodash/_listCacheClear.js b/node_modules/lodash/_listCacheClear.js deleted file mode 100644 index acbe39a5..00000000 --- a/node_modules/lodash/_listCacheClear.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ -function listCacheClear() { - this.__data__ = []; - this.size = 0; -} - -module.exports = listCacheClear; diff --git a/node_modules/lodash/_listCacheDelete.js b/node_modules/lodash/_listCacheDelete.js deleted file mode 100644 index b1384ade..00000000 --- a/node_modules/lodash/_listCacheDelete.js +++ /dev/null @@ -1,35 +0,0 @@ -var assocIndexOf = require('./_assocIndexOf'); - -/** Used for built-in method references. */ -var arrayProto = Array.prototype; - -/** Built-in value references. */ -var splice = arrayProto.splice; - -/** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; -} - -module.exports = listCacheDelete; diff --git a/node_modules/lodash/_listCacheGet.js b/node_modules/lodash/_listCacheGet.js deleted file mode 100644 index f8192fc3..00000000 --- a/node_modules/lodash/_listCacheGet.js +++ /dev/null @@ -1,19 +0,0 @@ -var assocIndexOf = require('./_assocIndexOf'); - -/** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; -} - -module.exports = listCacheGet; diff --git a/node_modules/lodash/_listCacheHas.js b/node_modules/lodash/_listCacheHas.js deleted file mode 100644 index 2adf6714..00000000 --- a/node_modules/lodash/_listCacheHas.js +++ /dev/null @@ -1,16 +0,0 @@ -var assocIndexOf = require('./_assocIndexOf'); - -/** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; -} - -module.exports = listCacheHas; diff --git a/node_modules/lodash/_listCacheSet.js b/node_modules/lodash/_listCacheSet.js deleted file mode 100644 index 5855c95e..00000000 --- a/node_modules/lodash/_listCacheSet.js +++ /dev/null @@ -1,26 +0,0 @@ -var assocIndexOf = require('./_assocIndexOf'); - -/** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ -function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; -} - -module.exports = listCacheSet; diff --git a/node_modules/lodash/_mapCacheClear.js b/node_modules/lodash/_mapCacheClear.js deleted file mode 100644 index bc9ca204..00000000 --- a/node_modules/lodash/_mapCacheClear.js +++ /dev/null @@ -1,21 +0,0 @@ -var Hash = require('./_Hash'), - ListCache = require('./_ListCache'), - Map = require('./_Map'); - -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; -} - -module.exports = mapCacheClear; diff --git a/node_modules/lodash/_mapCacheDelete.js b/node_modules/lodash/_mapCacheDelete.js deleted file mode 100644 index 946ca3c9..00000000 --- a/node_modules/lodash/_mapCacheDelete.js +++ /dev/null @@ -1,18 +0,0 @@ -var getMapData = require('./_getMapData'); - -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; -} - -module.exports = mapCacheDelete; diff --git a/node_modules/lodash/_mapCacheGet.js b/node_modules/lodash/_mapCacheGet.js deleted file mode 100644 index f29f55cf..00000000 --- a/node_modules/lodash/_mapCacheGet.js +++ /dev/null @@ -1,16 +0,0 @@ -var getMapData = require('./_getMapData'); - -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapCacheGet(key) { - return getMapData(this, key).get(key); -} - -module.exports = mapCacheGet; diff --git a/node_modules/lodash/_mapCacheHas.js b/node_modules/lodash/_mapCacheHas.js deleted file mode 100644 index a1214c02..00000000 --- a/node_modules/lodash/_mapCacheHas.js +++ /dev/null @@ -1,16 +0,0 @@ -var getMapData = require('./_getMapData'); - -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapCacheHas(key) { - return getMapData(this, key).has(key); -} - -module.exports = mapCacheHas; diff --git a/node_modules/lodash/_mapCacheSet.js b/node_modules/lodash/_mapCacheSet.js deleted file mode 100644 index 73468492..00000000 --- a/node_modules/lodash/_mapCacheSet.js +++ /dev/null @@ -1,22 +0,0 @@ -var getMapData = require('./_getMapData'); - -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; -} - -module.exports = mapCacheSet; diff --git a/node_modules/lodash/_mapToArray.js b/node_modules/lodash/_mapToArray.js deleted file mode 100644 index fe3dd531..00000000 --- a/node_modules/lodash/_mapToArray.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ -function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; -} - -module.exports = mapToArray; diff --git a/node_modules/lodash/_matchesStrictComparable.js b/node_modules/lodash/_matchesStrictComparable.js deleted file mode 100644 index f608af9e..00000000 --- a/node_modules/lodash/_matchesStrictComparable.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * A specialized version of `matchesProperty` for source values suitable - * for strict equality comparisons, i.e. `===`. - * - * @private - * @param {string} key The key of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ -function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); - }; -} - -module.exports = matchesStrictComparable; diff --git a/node_modules/lodash/_memoizeCapped.js b/node_modules/lodash/_memoizeCapped.js deleted file mode 100644 index 7f71c8fb..00000000 --- a/node_modules/lodash/_memoizeCapped.js +++ /dev/null @@ -1,26 +0,0 @@ -var memoize = require('./memoize'); - -/** Used as the maximum memoize cache size. */ -var MAX_MEMOIZE_SIZE = 500; - -/** - * A specialized version of `_.memoize` which clears the memoized function's - * cache when it exceeds `MAX_MEMOIZE_SIZE`. - * - * @private - * @param {Function} func The function to have its output memoized. - * @returns {Function} Returns the new memoized function. - */ -function memoizeCapped(func) { - var result = memoize(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - - var cache = result.cache; - return result; -} - -module.exports = memoizeCapped; diff --git a/node_modules/lodash/_mergeData.js b/node_modules/lodash/_mergeData.js deleted file mode 100644 index cb570f97..00000000 --- a/node_modules/lodash/_mergeData.js +++ /dev/null @@ -1,90 +0,0 @@ -var composeArgs = require('./_composeArgs'), - composeArgsRight = require('./_composeArgsRight'), - replaceHolders = require('./_replaceHolders'); - -/** Used as the internal argument placeholder. */ -var PLACEHOLDER = '__lodash_placeholder__'; - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_BOUND_FLAG = 4, - WRAP_CURRY_FLAG = 8, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMin = Math.min; - -/** - * Merges the function metadata of `source` into `data`. - * - * Merging metadata reduces the number of wrappers used to invoke a function. - * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and - * `_.rearg` modify function arguments, making the order in which they are - * executed important, preventing the merging of metadata. However, we make - * an exception for a safe combined case where curried functions have `_.ary` - * and or `_.rearg` applied. - * - * @private - * @param {Array} data The destination metadata. - * @param {Array} source The source metadata. - * @returns {Array} Returns `data`. - */ -function mergeData(data, source) { - var bitmask = data[1], - srcBitmask = source[1], - newBitmask = bitmask | srcBitmask, - isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - - var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); - - // Exit early if metadata can't be merged. - if (!(isCommon || isCombo)) { - return data; - } - // Use source `thisArg` if available. - if (srcBitmask & WRAP_BIND_FLAG) { - data[2] = source[2]; - // Set when currying a bound function. - newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; - } - // Compose partial arguments. - var value = source[3]; - if (value) { - var partials = data[3]; - data[3] = partials ? composeArgs(partials, value, source[4]) : value; - data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; - } - // Compose partial right arguments. - value = source[5]; - if (value) { - partials = data[5]; - data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; - data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; - } - // Use source `argPos` if available. - value = source[7]; - if (value) { - data[7] = value; - } - // Use source `ary` if it's smaller. - if (srcBitmask & WRAP_ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - // Use source `arity` if one is not provided. - if (data[9] == null) { - data[9] = source[9]; - } - // Use source `func` and merge bitmasks. - data[0] = source[0]; - data[1] = newBitmask; - - return data; -} - -module.exports = mergeData; diff --git a/node_modules/lodash/_metaMap.js b/node_modules/lodash/_metaMap.js deleted file mode 100644 index 0157a0b0..00000000 --- a/node_modules/lodash/_metaMap.js +++ /dev/null @@ -1,6 +0,0 @@ -var WeakMap = require('./_WeakMap'); - -/** Used to store function metadata. */ -var metaMap = WeakMap && new WeakMap; - -module.exports = metaMap; diff --git a/node_modules/lodash/_nativeCreate.js b/node_modules/lodash/_nativeCreate.js deleted file mode 100644 index c7aede85..00000000 --- a/node_modules/lodash/_nativeCreate.js +++ /dev/null @@ -1,6 +0,0 @@ -var getNative = require('./_getNative'); - -/* Built-in method references that are verified to be native. */ -var nativeCreate = getNative(Object, 'create'); - -module.exports = nativeCreate; diff --git a/node_modules/lodash/_nativeKeys.js b/node_modules/lodash/_nativeKeys.js deleted file mode 100644 index 479a104a..00000000 --- a/node_modules/lodash/_nativeKeys.js +++ /dev/null @@ -1,6 +0,0 @@ -var overArg = require('./_overArg'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeKeys = overArg(Object.keys, Object); - -module.exports = nativeKeys; diff --git a/node_modules/lodash/_nativeKeysIn.js b/node_modules/lodash/_nativeKeysIn.js deleted file mode 100644 index 00ee5059..00000000 --- a/node_modules/lodash/_nativeKeysIn.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; -} - -module.exports = nativeKeysIn; diff --git a/node_modules/lodash/_nodeUtil.js b/node_modules/lodash/_nodeUtil.js deleted file mode 100644 index 983d78f7..00000000 --- a/node_modules/lodash/_nodeUtil.js +++ /dev/null @@ -1,30 +0,0 @@ -var freeGlobal = require('./_freeGlobal'); - -/** Detect free variable `exports`. */ -var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - -/** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; - -/** Detect free variable `process` from Node.js. */ -var freeProcess = moduleExports && freeGlobal.process; - -/** Used to access faster Node.js helpers. */ -var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} -}()); - -module.exports = nodeUtil; diff --git a/node_modules/lodash/_objectToString.js b/node_modules/lodash/_objectToString.js deleted file mode 100644 index c614ec09..00000000 --- a/node_modules/lodash/_objectToString.js +++ /dev/null @@ -1,22 +0,0 @@ -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; - -/** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ -function objectToString(value) { - return nativeObjectToString.call(value); -} - -module.exports = objectToString; diff --git a/node_modules/lodash/_overArg.js b/node_modules/lodash/_overArg.js deleted file mode 100644 index 651c5c55..00000000 --- a/node_modules/lodash/_overArg.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} - -module.exports = overArg; diff --git a/node_modules/lodash/_overRest.js b/node_modules/lodash/_overRest.js deleted file mode 100644 index c7cdef33..00000000 --- a/node_modules/lodash/_overRest.js +++ /dev/null @@ -1,36 +0,0 @@ -var apply = require('./_apply'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ -function overRest(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return apply(func, this, otherArgs); - }; -} - -module.exports = overRest; diff --git a/node_modules/lodash/_parent.js b/node_modules/lodash/_parent.js deleted file mode 100644 index f174328f..00000000 --- a/node_modules/lodash/_parent.js +++ /dev/null @@ -1,16 +0,0 @@ -var baseGet = require('./_baseGet'), - baseSlice = require('./_baseSlice'); - -/** - * Gets the parent value at `path` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path to get the parent value of. - * @returns {*} Returns the parent value. - */ -function parent(object, path) { - return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); -} - -module.exports = parent; diff --git a/node_modules/lodash/_reEscape.js b/node_modules/lodash/_reEscape.js deleted file mode 100644 index 7f47eda6..00000000 --- a/node_modules/lodash/_reEscape.js +++ /dev/null @@ -1,4 +0,0 @@ -/** Used to match template delimiters. */ -var reEscape = /<%-([\s\S]+?)%>/g; - -module.exports = reEscape; diff --git a/node_modules/lodash/_reEvaluate.js b/node_modules/lodash/_reEvaluate.js deleted file mode 100644 index 6adfc312..00000000 --- a/node_modules/lodash/_reEvaluate.js +++ /dev/null @@ -1,4 +0,0 @@ -/** Used to match template delimiters. */ -var reEvaluate = /<%([\s\S]+?)%>/g; - -module.exports = reEvaluate; diff --git a/node_modules/lodash/_reInterpolate.js b/node_modules/lodash/_reInterpolate.js deleted file mode 100644 index d02ff0b2..00000000 --- a/node_modules/lodash/_reInterpolate.js +++ /dev/null @@ -1,4 +0,0 @@ -/** Used to match template delimiters. */ -var reInterpolate = /<%=([\s\S]+?)%>/g; - -module.exports = reInterpolate; diff --git a/node_modules/lodash/_realNames.js b/node_modules/lodash/_realNames.js deleted file mode 100644 index aa0d5292..00000000 --- a/node_modules/lodash/_realNames.js +++ /dev/null @@ -1,4 +0,0 @@ -/** Used to lookup unminified function names. */ -var realNames = {}; - -module.exports = realNames; diff --git a/node_modules/lodash/_reorder.js b/node_modules/lodash/_reorder.js deleted file mode 100644 index a3502b05..00000000 --- a/node_modules/lodash/_reorder.js +++ /dev/null @@ -1,29 +0,0 @@ -var copyArray = require('./_copyArray'), - isIndex = require('./_isIndex'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMin = Math.min; - -/** - * Reorder `array` according to the specified indexes where the element at - * the first index is assigned as the first element, the element at - * the second index is assigned as the second element, and so on. - * - * @private - * @param {Array} array The array to reorder. - * @param {Array} indexes The arranged array indexes. - * @returns {Array} Returns `array`. - */ -function reorder(array, indexes) { - var arrLength = array.length, - length = nativeMin(indexes.length, arrLength), - oldArray = copyArray(array); - - while (length--) { - var index = indexes[length]; - array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; - } - return array; -} - -module.exports = reorder; diff --git a/node_modules/lodash/_replaceHolders.js b/node_modules/lodash/_replaceHolders.js deleted file mode 100644 index 74360ec4..00000000 --- a/node_modules/lodash/_replaceHolders.js +++ /dev/null @@ -1,29 +0,0 @@ -/** Used as the internal argument placeholder. */ -var PLACEHOLDER = '__lodash_placeholder__'; - -/** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. - * - * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. - */ -function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value === placeholder || value === PLACEHOLDER) { - array[index] = PLACEHOLDER; - result[resIndex++] = index; - } - } - return result; -} - -module.exports = replaceHolders; diff --git a/node_modules/lodash/_root.js b/node_modules/lodash/_root.js deleted file mode 100644 index d2852bed..00000000 --- a/node_modules/lodash/_root.js +++ /dev/null @@ -1,9 +0,0 @@ -var freeGlobal = require('./_freeGlobal'); - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -module.exports = root; diff --git a/node_modules/lodash/_safeGet.js b/node_modules/lodash/_safeGet.js deleted file mode 100644 index b070897d..00000000 --- a/node_modules/lodash/_safeGet.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Gets the value at `key`, unless `key` is "__proto__" or "constructor". - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ -function safeGet(object, key) { - if (key === 'constructor' && typeof object[key] === 'function') { - return; - } - - if (key == '__proto__') { - return; - } - - return object[key]; -} - -module.exports = safeGet; diff --git a/node_modules/lodash/_setCacheAdd.js b/node_modules/lodash/_setCacheAdd.js deleted file mode 100644 index 1081a744..00000000 --- a/node_modules/lodash/_setCacheAdd.js +++ /dev/null @@ -1,19 +0,0 @@ -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ -function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; -} - -module.exports = setCacheAdd; diff --git a/node_modules/lodash/_setCacheHas.js b/node_modules/lodash/_setCacheHas.js deleted file mode 100644 index 9a492556..00000000 --- a/node_modules/lodash/_setCacheHas.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ -function setCacheHas(value) { - return this.__data__.has(value); -} - -module.exports = setCacheHas; diff --git a/node_modules/lodash/_setData.js b/node_modules/lodash/_setData.js deleted file mode 100644 index e5cf3eb9..00000000 --- a/node_modules/lodash/_setData.js +++ /dev/null @@ -1,20 +0,0 @@ -var baseSetData = require('./_baseSetData'), - shortOut = require('./_shortOut'); - -/** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity - * function to avoid garbage collection pauses in V8. See - * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ -var setData = shortOut(baseSetData); - -module.exports = setData; diff --git a/node_modules/lodash/_setToArray.js b/node_modules/lodash/_setToArray.js deleted file mode 100644 index b87f0741..00000000 --- a/node_modules/lodash/_setToArray.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -module.exports = setToArray; diff --git a/node_modules/lodash/_setToPairs.js b/node_modules/lodash/_setToPairs.js deleted file mode 100644 index 36ad37a0..00000000 --- a/node_modules/lodash/_setToPairs.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ -function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; -} - -module.exports = setToPairs; diff --git a/node_modules/lodash/_setToString.js b/node_modules/lodash/_setToString.js deleted file mode 100644 index 6ca84196..00000000 --- a/node_modules/lodash/_setToString.js +++ /dev/null @@ -1,14 +0,0 @@ -var baseSetToString = require('./_baseSetToString'), - shortOut = require('./_shortOut'); - -/** - * Sets the `toString` method of `func` to return `string`. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ -var setToString = shortOut(baseSetToString); - -module.exports = setToString; diff --git a/node_modules/lodash/_setWrapToString.js b/node_modules/lodash/_setWrapToString.js deleted file mode 100644 index decdc449..00000000 --- a/node_modules/lodash/_setWrapToString.js +++ /dev/null @@ -1,21 +0,0 @@ -var getWrapDetails = require('./_getWrapDetails'), - insertWrapDetails = require('./_insertWrapDetails'), - setToString = require('./_setToString'), - updateWrapDetails = require('./_updateWrapDetails'); - -/** - * Sets the `toString` method of `wrapper` to mimic the source of `reference` - * with wrapper details in a comment at the top of the source body. - * - * @private - * @param {Function} wrapper The function to modify. - * @param {Function} reference The reference function. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Function} Returns `wrapper`. - */ -function setWrapToString(wrapper, reference, bitmask) { - var source = (reference + ''); - return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); -} - -module.exports = setWrapToString; diff --git a/node_modules/lodash/_shortOut.js b/node_modules/lodash/_shortOut.js deleted file mode 100644 index 3300a079..00000000 --- a/node_modules/lodash/_shortOut.js +++ /dev/null @@ -1,37 +0,0 @@ -/** Used to detect hot functions by number of calls within a span of milliseconds. */ -var HOT_COUNT = 800, - HOT_SPAN = 16; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeNow = Date.now; - -/** - * Creates a function that'll short out and invoke `identity` instead - * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` - * milliseconds. - * - * @private - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new shortable function. - */ -function shortOut(func) { - var count = 0, - lastCalled = 0; - - return function() { - var stamp = nativeNow(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return arguments[0]; - } - } else { - count = 0; - } - return func.apply(undefined, arguments); - }; -} - -module.exports = shortOut; diff --git a/node_modules/lodash/_shuffleSelf.js b/node_modules/lodash/_shuffleSelf.js deleted file mode 100644 index 8bcc4f5c..00000000 --- a/node_modules/lodash/_shuffleSelf.js +++ /dev/null @@ -1,28 +0,0 @@ -var baseRandom = require('./_baseRandom'); - -/** - * A specialized version of `_.shuffle` which mutates and sets the size of `array`. - * - * @private - * @param {Array} array The array to shuffle. - * @param {number} [size=array.length] The size of `array`. - * @returns {Array} Returns `array`. - */ -function shuffleSelf(array, size) { - var index = -1, - length = array.length, - lastIndex = length - 1; - - size = size === undefined ? length : size; - while (++index < size) { - var rand = baseRandom(index, lastIndex), - value = array[rand]; - - array[rand] = array[index]; - array[index] = value; - } - array.length = size; - return array; -} - -module.exports = shuffleSelf; diff --git a/node_modules/lodash/_stackClear.js b/node_modules/lodash/_stackClear.js deleted file mode 100644 index ce8e5a92..00000000 --- a/node_modules/lodash/_stackClear.js +++ /dev/null @@ -1,15 +0,0 @@ -var ListCache = require('./_ListCache'); - -/** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ -function stackClear() { - this.__data__ = new ListCache; - this.size = 0; -} - -module.exports = stackClear; diff --git a/node_modules/lodash/_stackDelete.js b/node_modules/lodash/_stackDelete.js deleted file mode 100644 index ff9887ab..00000000 --- a/node_modules/lodash/_stackDelete.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; -} - -module.exports = stackDelete; diff --git a/node_modules/lodash/_stackGet.js b/node_modules/lodash/_stackGet.js deleted file mode 100644 index 1cdf0040..00000000 --- a/node_modules/lodash/_stackGet.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function stackGet(key) { - return this.__data__.get(key); -} - -module.exports = stackGet; diff --git a/node_modules/lodash/_stackHas.js b/node_modules/lodash/_stackHas.js deleted file mode 100644 index 16a3ad11..00000000 --- a/node_modules/lodash/_stackHas.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function stackHas(key) { - return this.__data__.has(key); -} - -module.exports = stackHas; diff --git a/node_modules/lodash/_stackSet.js b/node_modules/lodash/_stackSet.js deleted file mode 100644 index b790ac5f..00000000 --- a/node_modules/lodash/_stackSet.js +++ /dev/null @@ -1,34 +0,0 @@ -var ListCache = require('./_ListCache'), - Map = require('./_Map'), - MapCache = require('./_MapCache'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ -function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; -} - -module.exports = stackSet; diff --git a/node_modules/lodash/_strictIndexOf.js b/node_modules/lodash/_strictIndexOf.js deleted file mode 100644 index 0486a495..00000000 --- a/node_modules/lodash/_strictIndexOf.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; -} - -module.exports = strictIndexOf; diff --git a/node_modules/lodash/_strictLastIndexOf.js b/node_modules/lodash/_strictLastIndexOf.js deleted file mode 100644 index d7310dcc..00000000 --- a/node_modules/lodash/_strictLastIndexOf.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A specialized version of `_.lastIndexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; -} - -module.exports = strictLastIndexOf; diff --git a/node_modules/lodash/_stringSize.js b/node_modules/lodash/_stringSize.js deleted file mode 100644 index 17ef462a..00000000 --- a/node_modules/lodash/_stringSize.js +++ /dev/null @@ -1,18 +0,0 @@ -var asciiSize = require('./_asciiSize'), - hasUnicode = require('./_hasUnicode'), - unicodeSize = require('./_unicodeSize'); - -/** - * Gets the number of symbols in `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. - */ -function stringSize(string) { - return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); -} - -module.exports = stringSize; diff --git a/node_modules/lodash/_stringToArray.js b/node_modules/lodash/_stringToArray.js deleted file mode 100644 index d161158c..00000000 --- a/node_modules/lodash/_stringToArray.js +++ /dev/null @@ -1,18 +0,0 @@ -var asciiToArray = require('./_asciiToArray'), - hasUnicode = require('./_hasUnicode'), - unicodeToArray = require('./_unicodeToArray'); - -/** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); -} - -module.exports = stringToArray; diff --git a/node_modules/lodash/_stringToPath.js b/node_modules/lodash/_stringToPath.js deleted file mode 100644 index 8f39f8a2..00000000 --- a/node_modules/lodash/_stringToPath.js +++ /dev/null @@ -1,27 +0,0 @@ -var memoizeCapped = require('./_memoizeCapped'); - -/** Used to match property names within property paths. */ -var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -var stringToPath = memoizeCapped(function(string) { - var result = []; - if (string.charCodeAt(0) === 46 /* . */) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -}); - -module.exports = stringToPath; diff --git a/node_modules/lodash/_toKey.js b/node_modules/lodash/_toKey.js deleted file mode 100644 index c6d645c4..00000000 --- a/node_modules/lodash/_toKey.js +++ /dev/null @@ -1,21 +0,0 @@ -var isSymbol = require('./isSymbol'); - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - -/** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ -function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { - return value; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} - -module.exports = toKey; diff --git a/node_modules/lodash/_toSource.js b/node_modules/lodash/_toSource.js deleted file mode 100644 index a020b386..00000000 --- a/node_modules/lodash/_toSource.js +++ /dev/null @@ -1,26 +0,0 @@ -/** Used for built-in method references. */ -var funcProto = Function.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; -} - -module.exports = toSource; diff --git a/node_modules/lodash/_trimmedEndIndex.js b/node_modules/lodash/_trimmedEndIndex.js deleted file mode 100644 index 139439ad..00000000 --- a/node_modules/lodash/_trimmedEndIndex.js +++ /dev/null @@ -1,19 +0,0 @@ -/** Used to match a single whitespace character. */ -var reWhitespace = /\s/; - -/** - * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace - * character of `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the index of the last non-whitespace character. - */ -function trimmedEndIndex(string) { - var index = string.length; - - while (index-- && reWhitespace.test(string.charAt(index))) {} - return index; -} - -module.exports = trimmedEndIndex; diff --git a/node_modules/lodash/_unescapeHtmlChar.js b/node_modules/lodash/_unescapeHtmlChar.js deleted file mode 100644 index a71fecb3..00000000 --- a/node_modules/lodash/_unescapeHtmlChar.js +++ /dev/null @@ -1,21 +0,0 @@ -var basePropertyOf = require('./_basePropertyOf'); - -/** Used to map HTML entities to characters. */ -var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'" -}; - -/** - * Used by `_.unescape` to convert HTML entities to characters. - * - * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ -var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - -module.exports = unescapeHtmlChar; diff --git a/node_modules/lodash/_unicodeSize.js b/node_modules/lodash/_unicodeSize.js deleted file mode 100644 index 68137ec2..00000000 --- a/node_modules/lodash/_unicodeSize.js +++ /dev/null @@ -1,44 +0,0 @@ -/** Used to compose unicode character classes. */ -var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsVarRange = '\\ufe0e\\ufe0f'; - -/** Used to compose unicode capture groups. */ -var rsAstral = '[' + rsAstralRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsZWJ = '\\u200d'; - -/** Used to compose unicode regexes. */ -var reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - -/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - -/** - * Gets the size of a Unicode `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ -function unicodeSize(string) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { - ++result; - } - return result; -} - -module.exports = unicodeSize; diff --git a/node_modules/lodash/_unicodeToArray.js b/node_modules/lodash/_unicodeToArray.js deleted file mode 100644 index 2a725c06..00000000 --- a/node_modules/lodash/_unicodeToArray.js +++ /dev/null @@ -1,40 +0,0 @@ -/** Used to compose unicode character classes. */ -var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsVarRange = '\\ufe0e\\ufe0f'; - -/** Used to compose unicode capture groups. */ -var rsAstral = '[' + rsAstralRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsZWJ = '\\u200d'; - -/** Used to compose unicode regexes. */ -var reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - -/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - -/** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function unicodeToArray(string) { - return string.match(reUnicode) || []; -} - -module.exports = unicodeToArray; diff --git a/node_modules/lodash/_unicodeWords.js b/node_modules/lodash/_unicodeWords.js deleted file mode 100644 index e72e6e0f..00000000 --- a/node_modules/lodash/_unicodeWords.js +++ /dev/null @@ -1,69 +0,0 @@ -/** Used to compose unicode character classes. */ -var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - -/** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]", - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - -/** Used to compose unicode regexes. */ -var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', - rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', - rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; - -/** Used to match complex or compound words. */ -var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', - rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, - rsUpper + '+' + rsOptContrUpper, - rsOrdUpper, - rsOrdLower, - rsDigits, - rsEmoji -].join('|'), 'g'); - -/** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ -function unicodeWords(string) { - return string.match(reUnicodeWord) || []; -} - -module.exports = unicodeWords; diff --git a/node_modules/lodash/_updateWrapDetails.js b/node_modules/lodash/_updateWrapDetails.js deleted file mode 100644 index 8759fbdf..00000000 --- a/node_modules/lodash/_updateWrapDetails.js +++ /dev/null @@ -1,46 +0,0 @@ -var arrayEach = require('./_arrayEach'), - arrayIncludes = require('./_arrayIncludes'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256, - WRAP_FLIP_FLAG = 512; - -/** Used to associate wrap methods with their bit flags. */ -var wrapFlags = [ - ['ary', WRAP_ARY_FLAG], - ['bind', WRAP_BIND_FLAG], - ['bindKey', WRAP_BIND_KEY_FLAG], - ['curry', WRAP_CURRY_FLAG], - ['curryRight', WRAP_CURRY_RIGHT_FLAG], - ['flip', WRAP_FLIP_FLAG], - ['partial', WRAP_PARTIAL_FLAG], - ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], - ['rearg', WRAP_REARG_FLAG] -]; - -/** - * Updates wrapper `details` based on `bitmask` flags. - * - * @private - * @returns {Array} details The details to modify. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Array} Returns `details`. - */ -function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { - var value = '_.' + pair[0]; - if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { - details.push(value); - } - }); - return details.sort(); -} - -module.exports = updateWrapDetails; diff --git a/node_modules/lodash/_wrapperClone.js b/node_modules/lodash/_wrapperClone.js deleted file mode 100644 index 7bb58a2e..00000000 --- a/node_modules/lodash/_wrapperClone.js +++ /dev/null @@ -1,23 +0,0 @@ -var LazyWrapper = require('./_LazyWrapper'), - LodashWrapper = require('./_LodashWrapper'), - copyArray = require('./_copyArray'); - -/** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ -function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; - result.__values__ = wrapper.__values__; - return result; -} - -module.exports = wrapperClone; diff --git a/node_modules/lodash/add.js b/node_modules/lodash/add.js deleted file mode 100644 index f0695156..00000000 --- a/node_modules/lodash/add.js +++ /dev/null @@ -1,22 +0,0 @@ -var createMathOperation = require('./_createMathOperation'); - -/** - * Adds two numbers. - * - * @static - * @memberOf _ - * @since 3.4.0 - * @category Math - * @param {number} augend The first number in an addition. - * @param {number} addend The second number in an addition. - * @returns {number} Returns the total. - * @example - * - * _.add(6, 4); - * // => 10 - */ -var add = createMathOperation(function(augend, addend) { - return augend + addend; -}, 0); - -module.exports = add; diff --git a/node_modules/lodash/after.js b/node_modules/lodash/after.js deleted file mode 100644 index 3900c979..00000000 --- a/node_modules/lodash/after.js +++ /dev/null @@ -1,42 +0,0 @@ -var toInteger = require('./toInteger'); - -/** Error message constants. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/** - * The opposite of `_.before`; this method creates a function that invokes - * `func` once it's called `n` or more times. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {number} n The number of calls before `func` is invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => Logs 'done saving!' after the two async saves have completed. - */ -function after(n, func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; -} - -module.exports = after; diff --git a/node_modules/lodash/array.js b/node_modules/lodash/array.js deleted file mode 100644 index af688d3e..00000000 --- a/node_modules/lodash/array.js +++ /dev/null @@ -1,67 +0,0 @@ -module.exports = { - 'chunk': require('./chunk'), - 'compact': require('./compact'), - 'concat': require('./concat'), - 'difference': require('./difference'), - 'differenceBy': require('./differenceBy'), - 'differenceWith': require('./differenceWith'), - 'drop': require('./drop'), - 'dropRight': require('./dropRight'), - 'dropRightWhile': require('./dropRightWhile'), - 'dropWhile': require('./dropWhile'), - 'fill': require('./fill'), - 'findIndex': require('./findIndex'), - 'findLastIndex': require('./findLastIndex'), - 'first': require('./first'), - 'flatten': require('./flatten'), - 'flattenDeep': require('./flattenDeep'), - 'flattenDepth': require('./flattenDepth'), - 'fromPairs': require('./fromPairs'), - 'head': require('./head'), - 'indexOf': require('./indexOf'), - 'initial': require('./initial'), - 'intersection': require('./intersection'), - 'intersectionBy': require('./intersectionBy'), - 'intersectionWith': require('./intersectionWith'), - 'join': require('./join'), - 'last': require('./last'), - 'lastIndexOf': require('./lastIndexOf'), - 'nth': require('./nth'), - 'pull': require('./pull'), - 'pullAll': require('./pullAll'), - 'pullAllBy': require('./pullAllBy'), - 'pullAllWith': require('./pullAllWith'), - 'pullAt': require('./pullAt'), - 'remove': require('./remove'), - 'reverse': require('./reverse'), - 'slice': require('./slice'), - 'sortedIndex': require('./sortedIndex'), - 'sortedIndexBy': require('./sortedIndexBy'), - 'sortedIndexOf': require('./sortedIndexOf'), - 'sortedLastIndex': require('./sortedLastIndex'), - 'sortedLastIndexBy': require('./sortedLastIndexBy'), - 'sortedLastIndexOf': require('./sortedLastIndexOf'), - 'sortedUniq': require('./sortedUniq'), - 'sortedUniqBy': require('./sortedUniqBy'), - 'tail': require('./tail'), - 'take': require('./take'), - 'takeRight': require('./takeRight'), - 'takeRightWhile': require('./takeRightWhile'), - 'takeWhile': require('./takeWhile'), - 'union': require('./union'), - 'unionBy': require('./unionBy'), - 'unionWith': require('./unionWith'), - 'uniq': require('./uniq'), - 'uniqBy': require('./uniqBy'), - 'uniqWith': require('./uniqWith'), - 'unzip': require('./unzip'), - 'unzipWith': require('./unzipWith'), - 'without': require('./without'), - 'xor': require('./xor'), - 'xorBy': require('./xorBy'), - 'xorWith': require('./xorWith'), - 'zip': require('./zip'), - 'zipObject': require('./zipObject'), - 'zipObjectDeep': require('./zipObjectDeep'), - 'zipWith': require('./zipWith') -}; diff --git a/node_modules/lodash/ary.js b/node_modules/lodash/ary.js deleted file mode 100644 index 70c87d09..00000000 --- a/node_modules/lodash/ary.js +++ /dev/null @@ -1,29 +0,0 @@ -var createWrap = require('./_createWrap'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_ARY_FLAG = 128; - -/** - * Creates a function that invokes `func`, with up to `n` arguments, - * ignoring any additional arguments. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.ary(parseInt, 1)); - * // => [6, 8, 10] - */ -function ary(func, n, guard) { - n = guard ? undefined : n; - n = (func && n == null) ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); -} - -module.exports = ary; diff --git a/node_modules/lodash/assign.js b/node_modules/lodash/assign.js deleted file mode 100644 index 909db26a..00000000 --- a/node_modules/lodash/assign.js +++ /dev/null @@ -1,58 +0,0 @@ -var assignValue = require('./_assignValue'), - copyObject = require('./_copyObject'), - createAssigner = require('./_createAssigner'), - isArrayLike = require('./isArrayLike'), - isPrototype = require('./_isPrototype'), - keys = require('./keys'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ -var assign = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } -}); - -module.exports = assign; diff --git a/node_modules/lodash/assignIn.js b/node_modules/lodash/assignIn.js deleted file mode 100644 index e663473a..00000000 --- a/node_modules/lodash/assignIn.js +++ /dev/null @@ -1,40 +0,0 @@ -var copyObject = require('./_copyObject'), - createAssigner = require('./_createAssigner'), - keysIn = require('./keysIn'); - -/** - * This method is like `_.assign` except that it iterates over own and - * inherited source properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assign - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assignIn({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } - */ -var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); -}); - -module.exports = assignIn; diff --git a/node_modules/lodash/assignInWith.js b/node_modules/lodash/assignInWith.js deleted file mode 100644 index 68fcc0b0..00000000 --- a/node_modules/lodash/assignInWith.js +++ /dev/null @@ -1,38 +0,0 @@ -var copyObject = require('./_copyObject'), - createAssigner = require('./_createAssigner'), - keysIn = require('./keysIn'); - -/** - * This method is like `_.assignIn` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extendWith - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignInWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ -var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); -}); - -module.exports = assignInWith; diff --git a/node_modules/lodash/assignWith.js b/node_modules/lodash/assignWith.js deleted file mode 100644 index 7dc6c761..00000000 --- a/node_modules/lodash/assignWith.js +++ /dev/null @@ -1,37 +0,0 @@ -var copyObject = require('./_copyObject'), - createAssigner = require('./_createAssigner'), - keys = require('./keys'); - -/** - * This method is like `_.assign` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignInWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ -var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); -}); - -module.exports = assignWith; diff --git a/node_modules/lodash/at.js b/node_modules/lodash/at.js deleted file mode 100644 index 781ee9e5..00000000 --- a/node_modules/lodash/at.js +++ /dev/null @@ -1,23 +0,0 @@ -var baseAt = require('./_baseAt'), - flatRest = require('./_flatRest'); - -/** - * Creates an array of values corresponding to `paths` of `object`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Array} Returns the picked values. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _.at(object, ['a[0].b.c', 'a[1]']); - * // => [3, 4] - */ -var at = flatRest(baseAt); - -module.exports = at; diff --git a/node_modules/lodash/attempt.js b/node_modules/lodash/attempt.js deleted file mode 100644 index 624d0152..00000000 --- a/node_modules/lodash/attempt.js +++ /dev/null @@ -1,35 +0,0 @@ -var apply = require('./_apply'), - baseRest = require('./_baseRest'), - isError = require('./isError'); - -/** - * Attempts to invoke `func`, returning either the result or the caught error - * object. Any additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Util - * @param {Function} func The function to attempt. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {*} Returns the `func` result or error object. - * @example - * - * // Avoid throwing errors for invalid selectors. - * var elements = _.attempt(function(selector) { - * return document.querySelectorAll(selector); - * }, '>_>'); - * - * if (_.isError(elements)) { - * elements = []; - * } - */ -var attempt = baseRest(function(func, args) { - try { - return apply(func, undefined, args); - } catch (e) { - return isError(e) ? e : new Error(e); - } -}); - -module.exports = attempt; diff --git a/node_modules/lodash/before.js b/node_modules/lodash/before.js deleted file mode 100644 index a3e0a16c..00000000 --- a/node_modules/lodash/before.js +++ /dev/null @@ -1,40 +0,0 @@ -var toInteger = require('./toInteger'); - -/** Error message constants. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => Allows adding up to 4 contacts to the list. - */ -function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; -} - -module.exports = before; diff --git a/node_modules/lodash/bind.js b/node_modules/lodash/bind.js deleted file mode 100644 index b1076e93..00000000 --- a/node_modules/lodash/bind.js +++ /dev/null @@ -1,57 +0,0 @@ -var baseRest = require('./_baseRest'), - createWrap = require('./_createWrap'), - getHolder = require('./_getHolder'), - replaceHolders = require('./_replaceHolders'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1, - WRAP_PARTIAL_FLAG = 32; - -/** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and `partials` prepended to the arguments it receives. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * function greet(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // Bound with placeholders. - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ -var bind = baseRest(function(func, thisArg, partials) { - var bitmask = WRAP_BIND_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bind)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(func, bitmask, thisArg, partials, holders); -}); - -// Assign default placeholders. -bind.placeholder = {}; - -module.exports = bind; diff --git a/node_modules/lodash/bindAll.js b/node_modules/lodash/bindAll.js deleted file mode 100644 index a35706de..00000000 --- a/node_modules/lodash/bindAll.js +++ /dev/null @@ -1,41 +0,0 @@ -var arrayEach = require('./_arrayEach'), - baseAssignValue = require('./_baseAssignValue'), - bind = require('./bind'), - flatRest = require('./_flatRest'), - toKey = require('./_toKey'); - -/** - * Binds methods of an object to the object itself, overwriting the existing - * method. - * - * **Note:** This method doesn't set the "length" property of bound functions. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {Object} object The object to bind and assign the bound methods to. - * @param {...(string|string[])} methodNames The object method names to bind. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'click': function() { - * console.log('clicked ' + this.label); - * } - * }; - * - * _.bindAll(view, ['click']); - * jQuery(element).on('click', view.click); - * // => Logs 'clicked docs' when clicked. - */ -var bindAll = flatRest(function(object, methodNames) { - arrayEach(methodNames, function(key) { - key = toKey(key); - baseAssignValue(object, key, bind(object[key], object)); - }); - return object; -}); - -module.exports = bindAll; diff --git a/node_modules/lodash/bindKey.js b/node_modules/lodash/bindKey.js deleted file mode 100644 index f7fd64cd..00000000 --- a/node_modules/lodash/bindKey.js +++ /dev/null @@ -1,68 +0,0 @@ -var baseRest = require('./_baseRest'), - createWrap = require('./_createWrap'), - getHolder = require('./_getHolder'), - replaceHolders = require('./_replaceHolders'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_PARTIAL_FLAG = 32; - -/** - * Creates a function that invokes the method at `object[key]` with `partials` - * prepended to the arguments it receives. - * - * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. See - * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) - * for more details. - * - * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Function - * @param {Object} object The object to invoke the method on. - * @param {string} key The key of the method. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'user': 'fred', - * 'greet': function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * }; - * - * var bound = _.bindKey(object, 'greet', 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * object.greet = function(greeting, punctuation) { - * return greeting + 'ya ' + this.user + punctuation; - * }; - * - * bound('!'); - * // => 'hiya fred!' - * - * // Bound with placeholders. - * var bound = _.bindKey(object, 'greet', _, '!'); - * bound('hi'); - * // => 'hiya fred!' - */ -var bindKey = baseRest(function(object, key, partials) { - var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bindKey)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(key, bitmask, object, partials, holders); -}); - -// Assign default placeholders. -bindKey.placeholder = {}; - -module.exports = bindKey; diff --git a/node_modules/lodash/camelCase.js b/node_modules/lodash/camelCase.js deleted file mode 100644 index d7390def..00000000 --- a/node_modules/lodash/camelCase.js +++ /dev/null @@ -1,29 +0,0 @@ -var capitalize = require('./capitalize'), - createCompounder = require('./_createCompounder'); - -/** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ -var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); -}); - -module.exports = camelCase; diff --git a/node_modules/lodash/capitalize.js b/node_modules/lodash/capitalize.js deleted file mode 100644 index 3e1600e7..00000000 --- a/node_modules/lodash/capitalize.js +++ /dev/null @@ -1,23 +0,0 @@ -var toString = require('./toString'), - upperFirst = require('./upperFirst'); - -/** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ -function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); -} - -module.exports = capitalize; diff --git a/node_modules/lodash/castArray.js b/node_modules/lodash/castArray.js deleted file mode 100644 index e470bdb9..00000000 --- a/node_modules/lodash/castArray.js +++ /dev/null @@ -1,44 +0,0 @@ -var isArray = require('./isArray'); - -/** - * Casts `value` as an array if it's not one. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Lang - * @param {*} value The value to inspect. - * @returns {Array} Returns the cast array. - * @example - * - * _.castArray(1); - * // => [1] - * - * _.castArray({ 'a': 1 }); - * // => [{ 'a': 1 }] - * - * _.castArray('abc'); - * // => ['abc'] - * - * _.castArray(null); - * // => [null] - * - * _.castArray(undefined); - * // => [undefined] - * - * _.castArray(); - * // => [] - * - * var array = [1, 2, 3]; - * console.log(_.castArray(array) === array); - * // => true - */ -function castArray() { - if (!arguments.length) { - return []; - } - var value = arguments[0]; - return isArray(value) ? value : [value]; -} - -module.exports = castArray; diff --git a/node_modules/lodash/ceil.js b/node_modules/lodash/ceil.js deleted file mode 100644 index 56c8722c..00000000 --- a/node_modules/lodash/ceil.js +++ /dev/null @@ -1,26 +0,0 @@ -var createRound = require('./_createRound'); - -/** - * Computes `number` rounded up to `precision`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Math - * @param {number} number The number to round up. - * @param {number} [precision=0] The precision to round up to. - * @returns {number} Returns the rounded up number. - * @example - * - * _.ceil(4.006); - * // => 5 - * - * _.ceil(6.004, 2); - * // => 6.01 - * - * _.ceil(6040, -2); - * // => 6100 - */ -var ceil = createRound('ceil'); - -module.exports = ceil; diff --git a/node_modules/lodash/chain.js b/node_modules/lodash/chain.js deleted file mode 100644 index f6cd6475..00000000 --- a/node_modules/lodash/chain.js +++ /dev/null @@ -1,38 +0,0 @@ -var lodash = require('./wrapperLodash'); - -/** - * Creates a `lodash` wrapper instance that wraps `value` with explicit method - * chain sequences enabled. The result of such sequences must be unwrapped - * with `_#value`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Seq - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ -function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; -} - -module.exports = chain; diff --git a/node_modules/lodash/chunk.js b/node_modules/lodash/chunk.js deleted file mode 100644 index 5b562fef..00000000 --- a/node_modules/lodash/chunk.js +++ /dev/null @@ -1,50 +0,0 @@ -var baseSlice = require('./_baseSlice'), - isIterateeCall = require('./_isIterateeCall'), - toInteger = require('./toInteger'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeCeil = Math.ceil, - nativeMax = Math.max; - -/** - * Creates an array of elements split into groups the length of `size`. - * If `array` can't be split evenly, the final chunk will be the remaining - * elements. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to process. - * @param {number} [size=1] The length of each chunk - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the new array of chunks. - * @example - * - * _.chunk(['a', 'b', 'c', 'd'], 2); - * // => [['a', 'b'], ['c', 'd']] - * - * _.chunk(['a', 'b', 'c', 'd'], 3); - * // => [['a', 'b', 'c'], ['d']] - */ -function chunk(array, size, guard) { - if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { - size = 1; - } else { - size = nativeMax(toInteger(size), 0); - } - var length = array == null ? 0 : array.length; - if (!length || size < 1) { - return []; - } - var index = 0, - resIndex = 0, - result = Array(nativeCeil(length / size)); - - while (index < length) { - result[resIndex++] = baseSlice(array, index, (index += size)); - } - return result; -} - -module.exports = chunk; diff --git a/node_modules/lodash/clamp.js b/node_modules/lodash/clamp.js deleted file mode 100644 index 91a72c97..00000000 --- a/node_modules/lodash/clamp.js +++ /dev/null @@ -1,39 +0,0 @@ -var baseClamp = require('./_baseClamp'), - toNumber = require('./toNumber'); - -/** - * Clamps `number` within the inclusive `lower` and `upper` bounds. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Number - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - * @example - * - * _.clamp(-10, -5, 5); - * // => -5 - * - * _.clamp(10, -5, 5); - * // => 5 - */ -function clamp(number, lower, upper) { - if (upper === undefined) { - upper = lower; - lower = undefined; - } - if (upper !== undefined) { - upper = toNumber(upper); - upper = upper === upper ? upper : 0; - } - if (lower !== undefined) { - lower = toNumber(lower); - lower = lower === lower ? lower : 0; - } - return baseClamp(toNumber(number), lower, upper); -} - -module.exports = clamp; diff --git a/node_modules/lodash/clone.js b/node_modules/lodash/clone.js deleted file mode 100644 index dd439d63..00000000 --- a/node_modules/lodash/clone.js +++ /dev/null @@ -1,36 +0,0 @@ -var baseClone = require('./_baseClone'); - -/** Used to compose bitmasks for cloning. */ -var CLONE_SYMBOLS_FLAG = 4; - -/** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) - * and supports cloning arrays, array buffers, booleans, date objects, maps, - * numbers, `Object` objects, regexes, sets, strings, symbols, and typed - * arrays. The own enumerable properties of `arguments` objects are cloned - * as plain objects. An empty object is returned for uncloneable values such - * as error objects, functions, DOM nodes, and WeakMaps. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @see _.cloneDeep - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var shallow = _.clone(objects); - * console.log(shallow[0] === objects[0]); - * // => true - */ -function clone(value) { - return baseClone(value, CLONE_SYMBOLS_FLAG); -} - -module.exports = clone; diff --git a/node_modules/lodash/cloneDeep.js b/node_modules/lodash/cloneDeep.js deleted file mode 100644 index 4425fbe8..00000000 --- a/node_modules/lodash/cloneDeep.js +++ /dev/null @@ -1,29 +0,0 @@ -var baseClone = require('./_baseClone'); - -/** Used to compose bitmasks for cloning. */ -var CLONE_DEEP_FLAG = 1, - CLONE_SYMBOLS_FLAG = 4; - -/** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ -function cloneDeep(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); -} - -module.exports = cloneDeep; diff --git a/node_modules/lodash/cloneDeepWith.js b/node_modules/lodash/cloneDeepWith.js deleted file mode 100644 index fd9c6c05..00000000 --- a/node_modules/lodash/cloneDeepWith.js +++ /dev/null @@ -1,40 +0,0 @@ -var baseClone = require('./_baseClone'); - -/** Used to compose bitmasks for cloning. */ -var CLONE_DEEP_FLAG = 1, - CLONE_SYMBOLS_FLAG = 4; - -/** - * This method is like `_.cloneWith` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the deep cloned value. - * @see _.cloneWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * } - * - * var el = _.cloneDeepWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 20 - */ -function cloneDeepWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); -} - -module.exports = cloneDeepWith; diff --git a/node_modules/lodash/cloneWith.js b/node_modules/lodash/cloneWith.js deleted file mode 100644 index d2f4e756..00000000 --- a/node_modules/lodash/cloneWith.js +++ /dev/null @@ -1,42 +0,0 @@ -var baseClone = require('./_baseClone'); - -/** Used to compose bitmasks for cloning. */ -var CLONE_SYMBOLS_FLAG = 4; - -/** - * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined`, - * cloning is handled by the method instead. The `customizer` is invoked with - * up to four arguments; (value [, index|key, object, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the cloned value. - * @see _.cloneDeepWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * } - * - * var el = _.cloneWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 0 - */ -function cloneWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); -} - -module.exports = cloneWith; diff --git a/node_modules/lodash/collection.js b/node_modules/lodash/collection.js deleted file mode 100644 index 77fe837f..00000000 --- a/node_modules/lodash/collection.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - 'countBy': require('./countBy'), - 'each': require('./each'), - 'eachRight': require('./eachRight'), - 'every': require('./every'), - 'filter': require('./filter'), - 'find': require('./find'), - 'findLast': require('./findLast'), - 'flatMap': require('./flatMap'), - 'flatMapDeep': require('./flatMapDeep'), - 'flatMapDepth': require('./flatMapDepth'), - 'forEach': require('./forEach'), - 'forEachRight': require('./forEachRight'), - 'groupBy': require('./groupBy'), - 'includes': require('./includes'), - 'invokeMap': require('./invokeMap'), - 'keyBy': require('./keyBy'), - 'map': require('./map'), - 'orderBy': require('./orderBy'), - 'partition': require('./partition'), - 'reduce': require('./reduce'), - 'reduceRight': require('./reduceRight'), - 'reject': require('./reject'), - 'sample': require('./sample'), - 'sampleSize': require('./sampleSize'), - 'shuffle': require('./shuffle'), - 'size': require('./size'), - 'some': require('./some'), - 'sortBy': require('./sortBy') -}; diff --git a/node_modules/lodash/commit.js b/node_modules/lodash/commit.js deleted file mode 100644 index fe4db717..00000000 --- a/node_modules/lodash/commit.js +++ /dev/null @@ -1,33 +0,0 @@ -var LodashWrapper = require('./_LodashWrapper'); - -/** - * Executes the chain sequence and returns the wrapped result. - * - * @name commit - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2]; - * var wrapped = _(array).push(3); - * - * console.log(array); - * // => [1, 2] - * - * wrapped = wrapped.commit(); - * console.log(array); - * // => [1, 2, 3] - * - * wrapped.last(); - * // => 3 - * - * console.log(array); - * // => [1, 2, 3] - */ -function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); -} - -module.exports = wrapperCommit; diff --git a/node_modules/lodash/compact.js b/node_modules/lodash/compact.js deleted file mode 100644 index 031fab4e..00000000 --- a/node_modules/lodash/compact.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ -function compact(array) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[resIndex++] = value; - } - } - return result; -} - -module.exports = compact; diff --git a/node_modules/lodash/concat.js b/node_modules/lodash/concat.js deleted file mode 100644 index 1da48a4f..00000000 --- a/node_modules/lodash/concat.js +++ /dev/null @@ -1,43 +0,0 @@ -var arrayPush = require('./_arrayPush'), - baseFlatten = require('./_baseFlatten'), - copyArray = require('./_copyArray'), - isArray = require('./isArray'); - -/** - * Creates a new array concatenating `array` with any additional arrays - * and/or values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to concatenate. - * @param {...*} [values] The values to concatenate. - * @returns {Array} Returns the new concatenated array. - * @example - * - * var array = [1]; - * var other = _.concat(array, 2, [3], [[4]]); - * - * console.log(other); - * // => [1, 2, 3, [4]] - * - * console.log(array); - * // => [1] - */ -function concat() { - var length = arguments.length; - if (!length) { - return []; - } - var args = Array(length - 1), - array = arguments[0], - index = length; - - while (index--) { - args[index - 1] = arguments[index]; - } - return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); -} - -module.exports = concat; diff --git a/node_modules/lodash/cond.js b/node_modules/lodash/cond.js deleted file mode 100644 index 64555986..00000000 --- a/node_modules/lodash/cond.js +++ /dev/null @@ -1,60 +0,0 @@ -var apply = require('./_apply'), - arrayMap = require('./_arrayMap'), - baseIteratee = require('./_baseIteratee'), - baseRest = require('./_baseRest'); - -/** Error message constants. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/** - * Creates a function that iterates over `pairs` and invokes the corresponding - * function of the first predicate to return truthy. The predicate-function - * pairs are invoked with the `this` binding and arguments of the created - * function. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Util - * @param {Array} pairs The predicate-function pairs. - * @returns {Function} Returns the new composite function. - * @example - * - * var func = _.cond([ - * [_.matches({ 'a': 1 }), _.constant('matches A')], - * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], - * [_.stubTrue, _.constant('no match')] - * ]); - * - * func({ 'a': 1, 'b': 2 }); - * // => 'matches A' - * - * func({ 'a': 0, 'b': 1 }); - * // => 'matches B' - * - * func({ 'a': '1', 'b': '2' }); - * // => 'no match' - */ -function cond(pairs) { - var length = pairs == null ? 0 : pairs.length, - toIteratee = baseIteratee; - - pairs = !length ? [] : arrayMap(pairs, function(pair) { - if (typeof pair[1] != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return [toIteratee(pair[0]), pair[1]]; - }); - - return baseRest(function(args) { - var index = -1; - while (++index < length) { - var pair = pairs[index]; - if (apply(pair[0], this, args)) { - return apply(pair[1], this, args); - } - } - }); -} - -module.exports = cond; diff --git a/node_modules/lodash/conforms.js b/node_modules/lodash/conforms.js deleted file mode 100644 index 5501a949..00000000 --- a/node_modules/lodash/conforms.js +++ /dev/null @@ -1,35 +0,0 @@ -var baseClone = require('./_baseClone'), - baseConforms = require('./_baseConforms'); - -/** Used to compose bitmasks for cloning. */ -var CLONE_DEEP_FLAG = 1; - -/** - * Creates a function that invokes the predicate properties of `source` with - * the corresponding property values of a given object, returning `true` if - * all predicates return truthy, else `false`. - * - * **Note:** The created function is equivalent to `_.conformsTo` with - * `source` partially applied. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Util - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. - * @example - * - * var objects = [ - * { 'a': 2, 'b': 1 }, - * { 'a': 1, 'b': 2 } - * ]; - * - * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); - * // => [{ 'a': 1, 'b': 2 }] - */ -function conforms(source) { - return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); -} - -module.exports = conforms; diff --git a/node_modules/lodash/conformsTo.js b/node_modules/lodash/conformsTo.js deleted file mode 100644 index b8a93ebf..00000000 --- a/node_modules/lodash/conformsTo.js +++ /dev/null @@ -1,32 +0,0 @@ -var baseConformsTo = require('./_baseConformsTo'), - keys = require('./keys'); - -/** - * Checks if `object` conforms to `source` by invoking the predicate - * properties of `source` with the corresponding property values of `object`. - * - * **Note:** This method is equivalent to `_.conforms` when `source` is - * partially applied. - * - * @static - * @memberOf _ - * @since 4.14.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); - * // => true - * - * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); - * // => false - */ -function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); -} - -module.exports = conformsTo; diff --git a/node_modules/lodash/constant.js b/node_modules/lodash/constant.js deleted file mode 100644 index 655ece3f..00000000 --- a/node_modules/lodash/constant.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Creates a function that returns `value`. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Util - * @param {*} value The value to return from the new function. - * @returns {Function} Returns the new constant function. - * @example - * - * var objects = _.times(2, _.constant({ 'a': 1 })); - * - * console.log(objects); - * // => [{ 'a': 1 }, { 'a': 1 }] - * - * console.log(objects[0] === objects[1]); - * // => true - */ -function constant(value) { - return function() { - return value; - }; -} - -module.exports = constant; diff --git a/node_modules/lodash/core.js b/node_modules/lodash/core.js deleted file mode 100644 index be1d567d..00000000 --- a/node_modules/lodash/core.js +++ /dev/null @@ -1,3877 +0,0 @@ -/** - * @license - * Lodash (Custom Build) - * Build: `lodash core -o ./dist/lodash.core.js` - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; - - /** Used as the semantic version number. */ - var VERSION = '4.17.21'; - - /** Error message constants. */ - var FUNC_ERROR_TEXT = 'Expected a function'; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** Used to compose bitmasks for function metadata. */ - var WRAP_BIND_FLAG = 1, - WRAP_PARTIAL_FLAG = 32; - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - asyncTag = '[object AsyncFunction]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - numberTag = '[object Number]', - objectTag = '[object Object]', - proxyTag = '[object Proxy]', - regexpTag = '[object RegExp]', - stringTag = '[object String]'; - - /** Used to match HTML entities and HTML characters. */ - var reUnescapedHtml = /[&<>"']/g, - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /*--------------------------------------------------------------------------*/ - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - array.push.apply(array, values); - return array; - } - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for iteratee shorthands, which iterates over `collection` using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of - * `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ - function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ - function baseValues(object, props) { - return baseMap(props, function(key) { - return object[key]; - }); - } - - /** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - var escapeHtmlChar = basePropertyOf(htmlEscapes); - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - /*--------------------------------------------------------------------------*/ - - /** Used for built-in method references. */ - var arrayProto = Array.prototype, - objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to generate unique IDs. */ - var idCounter = 0; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; - - /** Built-in value references. */ - var objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeIsFinite = root.isFinite, - nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chain sequences. Methods that operate on and return arrays, collections, - * and functions can be chained together. Methods that retrieve a single value - * or may return a primitive value will automatically end the chain sequence - * and return the unwrapped value. Otherwise, the value must be unwrapped - * with `_#value`. - * - * Explicit chain sequences, which must be unwrapped with `_#value`, may be - * enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, it's deferred until - * `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. - * Shortcut fusion is an optimization to merge iteratee calls; this avoids - * the creation of intermediate arrays and can greatly reduce the number of - * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array and iteratees accept only - * one argument. The heuristic for whether a section qualifies for shortcut - * fusion is subject to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, - * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, - * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, - * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, - * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, - * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, - * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, - * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, - * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, - * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, - * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, - * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, - * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, - * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, - * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, - * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, - * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, - * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, - * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, - * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, - * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, - * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, - * `zipObject`, `zipObjectDeep`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, - * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, - * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, - * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, - * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, - * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Seq - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // Returns an unwrapped value. - * wrapped.reduce(_.add); - * // => 6 - * - * // Returns a wrapped value. - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - return value instanceof LodashWrapper - ? value - : new LodashWrapper(value); - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - } - - LodashWrapper.prototype = baseCreate(lodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function baseAssignValue(object, key, value) { - object[key] = value; - } - - /** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. - */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * The base implementation of `_.forEach` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEach = createBaseEach(baseForOwn); - - /** - * The base implementation of `_.every` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` - */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; - } - - /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ - function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? (current === current && !false) - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; - } - - /** - * The base implementation of `_.filter` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; - } - - /** - * The base implementation of `_.flatten` with support for restricting flattening. - * - * @private - * @param {Array} array The array to flatten. - * @param {number} depth The maximum recursion depth. - * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. - * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. - */ - function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, - length = array.length; - - predicate || (predicate = isFlattenable); - result || (result = []); - - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; - } - - /** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseFor = createBaseFor(); - - /** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); - } - - /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. - */ - function baseFunctions(object, props) { - return baseFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - return objectToString(value); - } - - /** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ - function baseGt(value, other) { - return value > other; - } - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - var baseIsArguments = noop; - - /** - * The base implementation of `_.isDate` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - */ - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : baseGetTag(object), - othTag = othIsArr ? arrayTag : baseGetTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - stack || (stack = []); - var objStack = find(stack, function(entry) { - return entry[0] == object; - }); - var othStack = find(stack, function(entry) { - return entry[0] == other; - }); - if (objStack && othStack) { - return objStack[1] == other; - } - stack.push([object, other]); - stack.push([other, object]); - if (isSameTag && !objIsObj) { - var result = (objIsArr) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - stack.pop(); - return result; - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - var result = equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - stack.pop(); - return result; - } - } - if (!isSameTag) { - return false; - } - var result = equalObjects(object, other, bitmask, customizer, equalFunc, stack); - stack.pop(); - return result; - } - - /** - * The base implementation of `_.isRegExp` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - */ - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; - } - - /** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ - function baseIteratee(func) { - if (typeof func == 'function') { - return func; - } - if (func == null) { - return identity; - } - return (typeof func == 'object' ? baseMatches : baseProperty)(func); - } - - /** - * The base implementation of `_.lt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - */ - function baseLt(value, other) { - return value < other; - } - - /** - * The base implementation of `_.map` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; - } - - /** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatches(source) { - var props = nativeKeys(source); - return function(object) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object(object); - while (length--) { - var key = props[length]; - if (!(key in object && - baseIsEqual(source[key], object[key], COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG) - )) { - return false; - } - } - return true; - }; - } - - /** - * The base implementation of `_.pick` without support for individual - * property identifiers. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. - */ - function basePick(object, props) { - object = Object(object); - return reduce(props, function(result, key) { - if (key in object) { - result[key] = object[key]; - } - return result; - }, {}); - } - - /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); - } - - /** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; - } - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source) { - return baseSlice(source, 0, source.length); - } - - /** - * The base implementation of `_.some` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; - } - - /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ - function baseWrapperValue(value, actions) { - var result = value; - return reduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); - } - - /** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = false; - - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = false; - - if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || - (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || - (valIsNull && othIsDefined && othIsReflexive) || - (!valIsDefined && othIsReflexive) || - !valIsReflexive) { - return 1; - } - if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || - (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || - (othIsNull && valIsDefined && valIsReflexive) || - (!othIsDefined && valIsReflexive) || - !othIsReflexive) { - return -1; - } - } - return 0; - } - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; - } - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); - } - - /** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; - } - - /** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; - } - - /** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ - function createCtor(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. See - // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; - } - - /** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike(collection)) { - var iteratee = baseIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { return iteratee(iterable[key], key, iterable); }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; - }; - } - - /** - * Creates a function that wraps `func` to invoke it with the `this` binding - * of `thisArg` and `partials` prepended to the arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to - * the new function. - * @returns {Function} Returns the new wrapped function. - */ - function createPartial(func, bitmask, thisArg, partials) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return fn.apply(isBind ? thisArg : this, args); - } - return wrapper; - } - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - var compared; - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!baseSome(other, function(othValue, othIndex) { - if (!indexOf(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - return result; - } - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - } - return false; - } - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = keys(object), - objLength = objProps.length, - othProps = keys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - var compared; - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - return result; - } - - /** - * A specialized version of `baseRest` which flattens the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - function flatRest(func) { - return setToString(overRest(func, undefined, flatten), func + ''); - } - - /** - * Checks if `value` is a flattenable `arguments` object or array. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. - */ - function isFlattenable(value) { - return isArray(value) || isArguments(value); - } - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; - } - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ - function overRest(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return func.apply(this, otherArgs); - }; - } - - /** - * Sets the `toString` method of `func` to return `string`. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var setToString = identity; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - return baseFilter(array, Boolean); - } - - /** - * Creates a new array concatenating `array` with any additional arrays - * and/or values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to concatenate. - * @param {...*} [values] The values to concatenate. - * @returns {Array} Returns the new concatenated array. - * @example - * - * var array = [1]; - * var other = _.concat(array, 2, [3], [[4]]); - * - * console.log(other); - * // => [1, 2, 3, [4]] - * - * console.log(array); - * // => [1] - */ - function concat() { - var length = arguments.length; - if (!length) { - return []; - } - var args = Array(length - 1), - array = arguments[0], - index = length; - - while (index--) { - args[index - 1] = arguments[index]; - } - return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */ - function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, baseIteratee(predicate, 3), index); - } - - /** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */ - function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; - } - - /** - * Recursively flattens `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, [3, [4]], 5]]); - * // => [1, 2, 3, 4, 5] - */ - function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; - } - - /** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ - function head(array) { - return (array && array.length) ? array[0] : undefined; - } - - /** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the - * offset from the end of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // Search from the `fromIndex`. - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ - function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (typeof fromIndex == 'number') { - fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; - } else { - fromIndex = 0; - } - var index = (fromIndex || 0) - 1, - isReflexive = value === value; - - while (++index < length) { - var other = array[index]; - if ((isReflexive ? other === value : other !== other)) { - return index; - } - } - return -1; - } - - /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ - function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined; - } - - /** - * Creates a slice of `array` from `start` up to, but not including, `end`. - * - * **Note:** This method is used instead of - * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are - * returned. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function slice(array, start, end) { - var length = array == null ? 0 : array.length; - start = start == null ? 0 : +start; - end = end === undefined ? length : +end; - return length ? baseSlice(array, start, end) : []; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` wrapper instance that wraps `value` with explicit method - * chain sequences enabled. The result of such sequences must be unwrapped - * with `_#value`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Seq - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ - function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; - } - - /** - * This method invokes `interceptor` and returns `value`. The interceptor - * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain sequence in order to modify intermediate results. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns `value`. - * @example - * - * _([1, 2, 3]) - * .tap(function(array) { - * // Mutate input array. - * array.pop(); - * }) - * .reverse() - * .value(); - * // => [2, 1] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - - /** - * This method is like `_.tap` except that it returns the result of `interceptor`. - * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain sequence. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns the result of `interceptor`. - * @example - * - * _(' abc ') - * .chain() - * .trim() - * .thru(function(value) { - * return [value]; - * }) - * .value(); - * // => ['abc'] - */ - function thru(value, interceptor) { - return interceptor(value); - } - - /** - * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. - * - * @name chain - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } - * ]; - * - * // A sequence without explicit chaining. - * _(users).head(); - * // => { 'user': 'barney', 'age': 36 } - * - * // A sequence with explicit chaining. - * _(users) - * .chain() - * .head() - * .pick('user') - * .value(); - * // => { 'user': 'barney' } - */ - function wrapperChain() { - return chain(this); - } - - /** - * Executes the chain sequence to resolve the unwrapped value. - * - * @name value - * @memberOf _ - * @since 0.1.0 - * @alias toJSON, valueOf - * @category Seq - * @returns {*} Returns the resolved unwrapped value. - * @example - * - * _([1, 2, 3]).value(); - * // => [1, 2, 3] - */ - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); - } - - /*------------------------------------------------------------------------*/ - - /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * **Note:** This method returns `true` for - * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because - * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of - * elements of empty collections. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.every(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.every(users, 'active'); - * // => false - */ - function every(collection, predicate, guard) { - predicate = guard ? undefined : predicate; - return baseEvery(collection, baseIteratee(predicate)); - } - - /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * **Note:** Unlike `_.remove`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.reject - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, { 'age': 36, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.filter(users, 'active'); - * // => objects for ['barney'] - * - * // Combining several predicates using `_.overEvery` or `_.overSome`. - * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); - * // => objects for ['fred', 'barney'] - */ - function filter(collection, predicate) { - return baseFilter(collection, baseIteratee(predicate)); - } - - /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */ - var find = createFind(findIndex); - - /** - * Iterates over elements of `collection` and invokes `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" - * property are iterated like arrays. To avoid this behavior use `_.forIn` - * or `_.forOwn` for object iteration. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEachRight - * @example - * - * _.forEach([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `1` then `2`. - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forEach(collection, iteratee) { - return baseEach(collection, baseIteratee(iteratee)); - } - - /** - * Creates an array of values by running each element in `collection` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, - * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, - * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, - * `template`, `trim`, `trimEnd`, `trimStart`, and `words` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - * @example - * - * function square(n) { - * return n * n; - * } - * - * _.map([4, 8], square); - * // => [16, 64] - * - * _.map({ 'a': 4, 'b': 8 }, square); - * // => [16, 64] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // The `_.property` iteratee shorthand. - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ - function map(collection, iteratee) { - return baseMap(collection, baseIteratee(iteratee)); - } - - /** - * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` thru `iteratee`, where each successive - * invocation is supplied the return value of the previous. If `accumulator` - * is not given, the first element of `collection` is used as the initial - * value. The iteratee is invoked with four arguments: - * (accumulator, value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.reduce`, `_.reduceRight`, and `_.transform`. - * - * The guarded methods are: - * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, - * and `sortBy` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduceRight - * @example - * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; - * }, 0); - * // => 3 - * - * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * return result; - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) - */ - function reduce(collection, iteratee, accumulator) { - return baseReduce(collection, baseIteratee(iteratee), accumulator, arguments.length < 3, baseEach); - } - - /** - * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable string keyed properties for objects. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns the collection size. - * @example - * - * _.size([1, 2, 3]); - * // => 3 - * - * _.size({ 'a': 1, 'b': 2 }); - * // => 2 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - if (collection == null) { - return 0; - } - collection = isArrayLike(collection) ? collection : nativeKeys(collection); - return collection.length; - } - - /** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * Iteration is stopped once `predicate` returns truthy. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.some(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.some(users, 'active'); - * // => true - */ - function some(collection, predicate, guard) { - predicate = guard ? undefined : predicate; - return baseSome(collection, baseIteratee(predicate)); - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection thru each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[])} [iteratees=[_.identity]] - * The iteratees to sort by. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 30 }, - * { 'user': 'barney', 'age': 34 } - * ]; - * - * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] - * - * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] - */ - function sortBy(collection, iteratee) { - var index = 0; - iteratee = baseIteratee(iteratee); - - return baseMap(baseMap(collection, function(value, key, collection) { - return { 'value': value, 'index': index++, 'criteria': iteratee(value, key, collection) }; - }).sort(function(object, other) { - return compareAscending(object.criteria, other.criteria) || (object.index - other.index); - }), baseProperty('value')); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => Allows adding up to 4 contacts to the list. - */ - function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and `partials` prepended to the arguments it receives. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * function greet(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // Bound with placeholders. - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ - var bind = baseRest(function(func, thisArg, partials) { - return createPartial(func, WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG, thisArg, partials); - }); - - /** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // => Logs 'deferred' after one millisecond. - */ - var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); - }); - - /** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => Logs 'later' after one second. - */ - var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - - /** - * Creates a function that negates the result of the predicate `func`. The - * `func` predicate is invoked with the `this` binding and arguments of the - * created function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new negated function. - * @example - * - * function isEven(n) { - * return n % 2 == 0; - * } - * - * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); - * // => [1, 3, 5] - */ - function negate(predicate) { - if (typeof predicate != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function() { - var args = arguments; - return !predicate.apply(this, args); - }; - } - - /** - * Creates a function that is restricted to invoking `func` once. Repeat calls - * to the function return the value of the first invocation. The `func` is - * invoked with the `this` binding and arguments of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // => `createApplication` is invoked once - */ - function once(func) { - return before(2, func); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) - * and supports cloning arrays, array buffers, booleans, date objects, maps, - * numbers, `Object` objects, regexes, sets, strings, symbols, and typed - * arrays. The own enumerable properties of `arguments` objects are cloned - * as plain objects. An empty object is returned for uncloneable values such - * as error objects, functions, DOM nodes, and WeakMaps. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @see _.cloneDeep - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var shallow = _.clone(objects); - * console.log(shallow[0] === objects[0]); - * // => true - */ - function clone(value) { - if (!isObject(value)) { - return value; - } - return isArray(value) ? copyArray(value) : copyObject(value, nativeKeys(value)); - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); - } - - /** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ - var isDate = baseIsDate; - - /** - * Checks if `value` is an empty object, collection, map, or set. - * - * Objects are considered empty if they have no own enumerable string keyed - * properties. - * - * Array-like values such as `arguments` objects, arrays, buffers, strings, or - * jQuery-like collections are considered empty if they have a `length` of `0`. - * Similarly, maps and sets are considered empty if they have a `size` of `0`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ - function isEmpty(value) { - if (isArrayLike(value) && - (isArray(value) || isString(value) || - isFunction(value.splice) || isArguments(value))) { - return !value.length; - } - return !nativeKeys(value).length; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - /** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on - * [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MIN_VALUE); - * // => true - * - * _.isFinite(Infinity); - * // => false - * - * _.isFinite('3'); - * // => false - */ - function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); - } - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** - * Checks if `value` is `NaN`. - * - * **Note:** This method is based on - * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as - * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for - * `undefined` and other non-number values. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some - // ActiveX objects in IE. - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are - * classified as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a number, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ - function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); - } - - /** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ - var isRegExp = baseIsRegExp; - - /** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ - function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); - } - - /** - * Checks if `value` is `undefined`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - * - * _.isUndefined(null); - * // => false - */ - function isUndefined(value) { - return value === undefined; - } - - /** - * Converts `value` to an array. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Array} Returns the converted array. - * @example - * - * _.toArray({ 'a': 1, 'b': 2 }); - * // => [1, 2] - * - * _.toArray('abc'); - * // => ['a', 'b', 'c'] - * - * _.toArray(1); - * // => [] - * - * _.toArray(null); - * // => [] - */ - function toArray(value) { - if (!isArrayLike(value)) { - return values(value); - } - return value.length ? copyArray(value) : []; - } - - /** - * Converts `value` to an integer. - * - * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3.2); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3.2'); - * // => 3 - */ - var toInteger = Number; - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ - var toNumber = Number; - - /** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ - function toString(value) { - if (typeof value == 'string') { - return value; - } - return value == null ? '' : (value + ''); - } - - /*------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ - var assign = createAssigner(function(object, source) { - copyObject(source, nativeKeys(source), object); - }); - - /** - * This method is like `_.assign` except that it iterates over own and - * inherited source properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assign - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assignIn({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } - */ - var assignIn = createAssigner(function(object, source) { - copyObject(source, nativeKeysIn(source), object); - }); - - /** - * Creates an object that inherits from the `prototype` object. If a - * `properties` object is given, its own enumerable string keyed properties - * are assigned to the created object. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties == null ? result : assign(result, properties); - } - - /** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep - * @example - * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var defaults = baseRest(function(object, sources) { - object = Object(object); - - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - length = 1; - } - - while (++index < length) { - var source = sources[index]; - var props = keysIn(source); - var propsIndex = -1; - var propsLength = props.length; - - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - - if (value === undefined || - (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { - object[key] = source[key]; - } - } - } - - return object; - }); - - /** - * Checks if `path` is a direct property of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = { 'a': { 'b': 2 } }; - * var other = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b'); - * // => true - * - * _.has(object, ['a', 'b']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ - function has(object, path) { - return object != null && hasOwnProperty.call(object, path); - } - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - var keys = nativeKeys; - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - var keysIn = nativeKeysIn; - - /** - * Creates an object composed of the picked `object` properties. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pick(object, ['a', 'c']); - * // => { 'a': 1, 'c': 3 } - */ - var pick = flatRest(function(object, paths) { - return object == null ? {} : basePick(object, paths); - }); - - /** - * This method is like `_.get` except that if the resolved value is a - * function it's invoked with the `this` binding of its parent object and - * its result is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; - * - * _.result(object, 'a[0].b.c1'); - * // => 3 - * - * _.result(object, 'a[0].b.c2'); - * // => 4 - * - * _.result(object, 'a[0].b.c3', 'default'); - * // => 'default' - * - * _.result(object, 'a[0].b.c3', _.constant('default')); - * // => 'default' - */ - function result(object, path, defaultValue) { - var value = object == null ? undefined : object[path]; - if (value === undefined) { - value = defaultValue; - } - return isFunction(value) ? value.call(object) : value; - } - - /** - * Creates an array of the own enumerable string keyed property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) - * - * _.values('hi'); - * // => ['h', 'i'] - */ - function values(object) { - return object == null ? [] : baseValues(object, keys(object)); - } - - /*------------------------------------------------------------------------*/ - - /** - * Converts the characters "&", "<", ">", '"', and "'" in `string` to their - * corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. See - * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * When working with HTML you should always - * [quote attribute values](http://wonko.com/post/html-escaping) to reduce - * XSS vectors. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ - function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; - } - - /*------------------------------------------------------------------------*/ - - /** - * This method returns the first argument it receives. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'a': 1 }; - * - * console.log(_.identity(object) === object); - * // => true - */ - function identity(value) { - return value; - } - - /** - * Creates a function that invokes `func` with the arguments of the created - * function. If `func` is a property name, the created function returns the - * property value for a given element. If `func` is an array or object, the - * created function returns `true` for elements that contain the equivalent - * source properties, otherwise it returns `false`. - * - * @static - * @since 4.0.0 - * @memberOf _ - * @category Util - * @param {*} [func=_.identity] The value to convert to a callback. - * @returns {Function} Returns the callback. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); - * // => [{ 'user': 'barney', 'age': 36, 'active': true }] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, _.iteratee(['user', 'fred'])); - * // => [{ 'user': 'fred', 'age': 40 }] - * - * // The `_.property` iteratee shorthand. - * _.map(users, _.iteratee('user')); - * // => ['barney', 'fred'] - * - * // Create custom iteratee shorthands. - * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { - * return !_.isRegExp(func) ? iteratee(func) : function(string) { - * return func.test(string); - * }; - * }); - * - * _.filter(['abc', 'def'], /ef/); - * // => ['def'] - */ - var iteratee = baseIteratee; - - /** - * Creates a function that performs a partial deep comparison between a given - * object and `source`, returning `true` if the given object has equivalent - * property values, else `false`. - * - * **Note:** The created function is equivalent to `_.isMatch` with `source` - * partially applied. - * - * Partial comparisons will match empty array and empty object `source` - * values against any array or object value, respectively. See `_.isEqual` - * for a list of supported value comparisons. - * - * **Note:** Multiple values can be checked by combining several matchers - * using `_.overSome` - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Util - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - * @example - * - * var objects = [ - * { 'a': 1, 'b': 2, 'c': 3 }, - * { 'a': 4, 'b': 5, 'c': 6 } - * ]; - * - * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); - * // => [{ 'a': 4, 'b': 5, 'c': 6 }] - * - * // Checking for several possible values - * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); - * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] - */ - function matches(source) { - return baseMatches(assign({}, source)); - } - - /** - * Adds all own enumerable string keyed function properties of a source - * object to the destination object. If `object` is a function, then methods - * are added to its prototype as well. - * - * **Note:** Use `_.runInContext` to create a pristine `lodash` function to - * avoid conflicts caused by modifying the original. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {Function|Object} [object=lodash] The destination object. - * @param {Object} source The object of functions to add. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.chain=true] Specify whether mixins are chainable. - * @returns {Function|Object} Returns `object`. - * @example - * - * function vowels(string) { - * return _.filter(string, function(v) { - * return /[aeiou]/i.test(v); - * }); - * } - * - * _.mixin({ 'vowels': vowels }); - * _.vowels('fred'); - * // => ['e'] - * - * _('fred').vowels().value(); - * // => ['e'] - * - * _.mixin({ 'vowels': vowels }, { 'chain': false }); - * _('fred').vowels(); - * // => ['e'] - */ - function mixin(object, source, options) { - var props = keys(source), - methodNames = baseFunctions(source, props); - - if (options == null && - !(isObject(source) && (methodNames.length || !props.length))) { - options = source; - source = object; - object = this; - methodNames = baseFunctions(source, keys(source)); - } - var chain = !(isObject(options) && 'chain' in options) || !!options.chain, - isFunc = isFunction(object); - - baseEach(methodNames, function(methodName) { - var func = source[methodName]; - object[methodName] = func; - if (isFunc) { - object.prototype[methodName] = function() { - var chainAll = this.__chain__; - if (chain || chainAll) { - var result = object(this.__wrapped__), - actions = result.__actions__ = copyArray(this.__actions__); - - actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); - result.__chain__ = chainAll; - return result; - } - return func.apply(object, arrayPush([this.value()], arguments)); - }; - } - }); - - return object; - } - - /** - * Reverts the `_` variable to its previous value and returns a reference to - * the `lodash` function. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @returns {Function} Returns the `lodash` function. - * @example - * - * var lodash = _.noConflict(); - */ - function noConflict() { - if (root._ === this) { - root._ = oldDash; - } - return this; - } - - /** - * This method returns `undefined`. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Util - * @example - * - * _.times(2, _.noop); - * // => [undefined, undefined] - */ - function noop() { - // No operation performed. - } - - /** - * Generates a unique ID. If `prefix` is given, the ID is appended to it. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {string} [prefix=''] The value to prefix the ID with. - * @returns {string} Returns the unique ID. - * @example - * - * _.uniqueId('contact_'); - * // => 'contact_104' - * - * _.uniqueId(); - * // => '105' - */ - function uniqueId(prefix) { - var id = ++idCounter; - return toString(prefix) + id; - } - - /*------------------------------------------------------------------------*/ - - /** - * Computes the maximum value of `array`. If `array` is empty or falsey, - * `undefined` is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Math - * @param {Array} array The array to iterate over. - * @returns {*} Returns the maximum value. - * @example - * - * _.max([4, 2, 8, 6]); - * // => 8 - * - * _.max([]); - * // => undefined - */ - function max(array) { - return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; - } - - /** - * Computes the minimum value of `array`. If `array` is empty or falsey, - * `undefined` is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Math - * @param {Array} array The array to iterate over. - * @returns {*} Returns the minimum value. - * @example - * - * _.min([4, 2, 8, 6]); - * // => 2 - * - * _.min([]); - * // => undefined - */ - function min(array) { - return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; - } - - /*------------------------------------------------------------------------*/ - - // Add methods that return wrapped values in chain sequences. - lodash.assignIn = assignIn; - lodash.before = before; - lodash.bind = bind; - lodash.chain = chain; - lodash.compact = compact; - lodash.concat = concat; - lodash.create = create; - lodash.defaults = defaults; - lodash.defer = defer; - lodash.delay = delay; - lodash.filter = filter; - lodash.flatten = flatten; - lodash.flattenDeep = flattenDeep; - lodash.iteratee = iteratee; - lodash.keys = keys; - lodash.map = map; - lodash.matches = matches; - lodash.mixin = mixin; - lodash.negate = negate; - lodash.once = once; - lodash.pick = pick; - lodash.slice = slice; - lodash.sortBy = sortBy; - lodash.tap = tap; - lodash.thru = thru; - lodash.toArray = toArray; - lodash.values = values; - - // Add aliases. - lodash.extend = assignIn; - - // Add methods to `lodash.prototype`. - mixin(lodash, lodash); - - /*------------------------------------------------------------------------*/ - - // Add methods that return unwrapped values in chain sequences. - lodash.clone = clone; - lodash.escape = escape; - lodash.every = every; - lodash.find = find; - lodash.forEach = forEach; - lodash.has = has; - lodash.head = head; - lodash.identity = identity; - lodash.indexOf = indexOf; - lodash.isArguments = isArguments; - lodash.isArray = isArray; - lodash.isBoolean = isBoolean; - lodash.isDate = isDate; - lodash.isEmpty = isEmpty; - lodash.isEqual = isEqual; - lodash.isFinite = isFinite; - lodash.isFunction = isFunction; - lodash.isNaN = isNaN; - lodash.isNull = isNull; - lodash.isNumber = isNumber; - lodash.isObject = isObject; - lodash.isRegExp = isRegExp; - lodash.isString = isString; - lodash.isUndefined = isUndefined; - lodash.last = last; - lodash.max = max; - lodash.min = min; - lodash.noConflict = noConflict; - lodash.noop = noop; - lodash.reduce = reduce; - lodash.result = result; - lodash.size = size; - lodash.some = some; - lodash.uniqueId = uniqueId; - - // Add aliases. - lodash.each = forEach; - lodash.first = head; - - mixin(lodash, (function() { - var source = {}; - baseForOwn(lodash, function(func, methodName) { - if (!hasOwnProperty.call(lodash.prototype, methodName)) { - source[methodName] = func; - } - }); - return source; - }()), { 'chain': false }); - - /*------------------------------------------------------------------------*/ - - /** - * The semantic version number. - * - * @static - * @memberOf _ - * @type {string} - */ - lodash.VERSION = VERSION; - - // Add `Array` methods to `lodash.prototype`. - baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { - var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName], - chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', - retUnwrapped = /^(?:pop|join|replace|shift)$/.test(methodName); - - lodash.prototype[methodName] = function() { - var args = arguments; - if (retUnwrapped && !this.__chain__) { - var value = this.value(); - return func.apply(isArray(value) ? value : [], args); - } - return this[chainName](function(value) { - return func.apply(isArray(value) ? value : [], args); - }); - }; - }); - - // Add chain sequence methods to the `lodash` wrapper. - lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; - - /*--------------------------------------------------------------------------*/ - - // Some AMD build optimizers, like r.js, check for condition patterns like: - if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { - // Expose Lodash on the global object to prevent errors when Lodash is - // loaded by a script tag in the presence of an AMD loader. - // See http://requirejs.org/docs/errors.html#mismatch for more details. - // Use `_.noConflict` to remove Lodash from the global object. - root._ = lodash; - - // Define as an anonymous module so, through path mapping, it can be - // referenced as the "underscore" module. - define(function() { - return lodash; - }); - } - // Check for `exports` after `define` in case a build optimizer adds it. - else if (freeModule) { - // Export for Node.js. - (freeModule.exports = lodash)._ = lodash; - // Export for CommonJS support. - freeExports._ = lodash; - } - else { - // Export to the global object. - root._ = lodash; - } -}.call(this)); diff --git a/node_modules/lodash/core.min.js b/node_modules/lodash/core.min.js deleted file mode 100644 index e425e4d4..00000000 --- a/node_modules/lodash/core.min.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @license - * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE - * Build: `lodash core -o ./dist/lodash.core.js` - */ -;(function(){function n(n){return H(n)&&pn.call(n,"callee")&&!yn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?Z:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return j(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function"); -return setTimeout(function(){n.apply(Z,r)},t)}function f(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function a(n,t,r){for(var e=-1,u=n.length;++et}function b(n,t,r,e,u){return n===t||(null==n||null==t||!H(n)&&!H(t)?n!==n&&t!==t:y(n,t,r,e,b,u))}function y(n,t,r,e,u,o){var i=Nn(n),c=Nn(t),f=i?"[object Array]":hn.call(n),a=c?"[object Array]":hn.call(t),f="[object Arguments]"==f?"[object Object]":f,a="[object Arguments]"==a?"[object Object]":a,l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){ -return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=T(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 1&r||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=B(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t, -r=u(i,f,r,e,o),o.pop(),r)}function g(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?d:r)(n)}function _(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;var c=o.get(n),f=o.get(t);if(c&&f)return c==t&&f==n;for(var c=-1,f=true,a=2&r?[]:Z;++cr?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,mn); -}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Fn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){return n===t||n!==n&&t!==t}function M(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1=t),t&&!U(n)}function U(n){return!!V(n)&&(n=hn.call(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function V(n){var t=typeof n; -return null!=n&&("object"==t||"function"==t)}function H(n){return null!=n&&typeof n=="object"}function K(n){return typeof n=="number"||H(n)&&"[object Number]"==hn.call(n)}function L(n){return typeof n=="string"||!Nn(n)&&H(n)&&"[object String]"==hn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return null==n?[]:u(n,Dn(n))}function X(n){return n}function Y(n,r,e){var u=Dn(r),o=h(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=h(r,Dn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(n); -return mn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=n(this.__wrapped__);return(e.__actions__=A(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var Z,nn=1/0,tn=/[&<>"']/g,rn=RegExp(tn.source),en=/^(?:0|[1-9]\d*)$/,un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){ -return function(t){return null==n?Z:n[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,bn=Object.create,yn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return V(t)?bn?bn(t):(n.prototype=t,t=new n,n.prototype=Z,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i; -var mn=function(n,t){return function(r,e){if(null==r)return r;if(!M(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=jn(e+r,0));n:{for(t=g(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r { '4': 1, '6': 2 } - * - * // The `_.property` iteratee shorthand. - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ -var countBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - ++result[key]; - } else { - baseAssignValue(result, key, 1); - } -}); - -module.exports = countBy; diff --git a/node_modules/lodash/create.js b/node_modules/lodash/create.js deleted file mode 100644 index 919edb85..00000000 --- a/node_modules/lodash/create.js +++ /dev/null @@ -1,43 +0,0 @@ -var baseAssign = require('./_baseAssign'), - baseCreate = require('./_baseCreate'); - -/** - * Creates an object that inherits from the `prototype` object. If a - * `properties` object is given, its own enumerable string keyed properties - * are assigned to the created object. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ -function create(prototype, properties) { - var result = baseCreate(prototype); - return properties == null ? result : baseAssign(result, properties); -} - -module.exports = create; diff --git a/node_modules/lodash/curry.js b/node_modules/lodash/curry.js deleted file mode 100644 index 918db1a4..00000000 --- a/node_modules/lodash/curry.js +++ /dev/null @@ -1,57 +0,0 @@ -var createWrap = require('./_createWrap'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_CURRY_FLAG = 8; - -/** - * Creates a function that accepts arguments of `func` and either invokes - * `func` returning its result, if at least `arity` number of arguments have - * been provided, or returns a function that accepts the remaining `func` - * arguments, and so on. The arity of `func` may be specified if `func.length` - * is not sufficient. - * - * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curry(abc); - * - * curried(1)(2)(3); - * // => [1, 2, 3] - * - * curried(1, 2)(3); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(1)(_, 3)(2); - * // => [1, 2, 3] - */ -function curry(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; - return result; -} - -// Assign default placeholders. -curry.placeholder = {}; - -module.exports = curry; diff --git a/node_modules/lodash/curryRight.js b/node_modules/lodash/curryRight.js deleted file mode 100644 index c85b6f33..00000000 --- a/node_modules/lodash/curryRight.js +++ /dev/null @@ -1,54 +0,0 @@ -var createWrap = require('./_createWrap'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_CURRY_RIGHT_FLAG = 16; - -/** - * This method is like `_.curry` except that arguments are applied to `func` - * in the manner of `_.partialRight` instead of `_.partial`. - * - * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curryRight(abc); - * - * curried(3)(2)(1); - * // => [1, 2, 3] - * - * curried(2, 3)(1); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(3)(1, _)(2); - * // => [1, 2, 3] - */ -function curryRight(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; - return result; -} - -// Assign default placeholders. -curryRight.placeholder = {}; - -module.exports = curryRight; diff --git a/node_modules/lodash/date.js b/node_modules/lodash/date.js deleted file mode 100644 index cbf5b410..00000000 --- a/node_modules/lodash/date.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - 'now': require('./now') -}; diff --git a/node_modules/lodash/debounce.js b/node_modules/lodash/debounce.js deleted file mode 100644 index 8f751d53..00000000 --- a/node_modules/lodash/debounce.js +++ /dev/null @@ -1,191 +0,0 @@ -var isObject = require('./isObject'), - now = require('./now'), - toNumber = require('./toNumber'); - -/** Error message constants. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max, - nativeMin = Math.min; - -/** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ -function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - timeWaiting = wait - timeSinceLastCall; - - return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; - - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - clearTimeout(timerId); - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; -} - -module.exports = debounce; diff --git a/node_modules/lodash/deburr.js b/node_modules/lodash/deburr.js deleted file mode 100644 index f85e314a..00000000 --- a/node_modules/lodash/deburr.js +++ /dev/null @@ -1,45 +0,0 @@ -var deburrLetter = require('./_deburrLetter'), - toString = require('./toString'); - -/** Used to match Latin Unicode letters (excluding mathematical operators). */ -var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - -/** Used to compose unicode character classes. */ -var rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; - -/** Used to compose unicode capture groups. */ -var rsCombo = '[' + rsComboRange + ']'; - -/** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ -var reComboMark = RegExp(rsCombo, 'g'); - -/** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ -function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); -} - -module.exports = deburr; diff --git a/node_modules/lodash/defaultTo.js b/node_modules/lodash/defaultTo.js deleted file mode 100644 index 5b333592..00000000 --- a/node_modules/lodash/defaultTo.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Checks `value` to determine whether a default value should be returned in - * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, - * or `undefined`. - * - * @static - * @memberOf _ - * @since 4.14.0 - * @category Util - * @param {*} value The value to check. - * @param {*} defaultValue The default value. - * @returns {*} Returns the resolved value. - * @example - * - * _.defaultTo(1, 10); - * // => 1 - * - * _.defaultTo(undefined, 10); - * // => 10 - */ -function defaultTo(value, defaultValue) { - return (value == null || value !== value) ? defaultValue : value; -} - -module.exports = defaultTo; diff --git a/node_modules/lodash/defaults.js b/node_modules/lodash/defaults.js deleted file mode 100644 index c74df044..00000000 --- a/node_modules/lodash/defaults.js +++ /dev/null @@ -1,64 +0,0 @@ -var baseRest = require('./_baseRest'), - eq = require('./eq'), - isIterateeCall = require('./_isIterateeCall'), - keysIn = require('./keysIn'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep - * @example - * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ -var defaults = baseRest(function(object, sources) { - object = Object(object); - - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - length = 1; - } - - while (++index < length) { - var source = sources[index]; - var props = keysIn(source); - var propsIndex = -1; - var propsLength = props.length; - - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - - if (value === undefined || - (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { - object[key] = source[key]; - } - } - } - - return object; -}); - -module.exports = defaults; diff --git a/node_modules/lodash/defaultsDeep.js b/node_modules/lodash/defaultsDeep.js deleted file mode 100644 index 9b5fa3ee..00000000 --- a/node_modules/lodash/defaultsDeep.js +++ /dev/null @@ -1,30 +0,0 @@ -var apply = require('./_apply'), - baseRest = require('./_baseRest'), - customDefaultsMerge = require('./_customDefaultsMerge'), - mergeWith = require('./mergeWith'); - -/** - * This method is like `_.defaults` except that it recursively assigns - * default properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaults - * @example - * - * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); - * // => { 'a': { 'b': 2, 'c': 3 } } - */ -var defaultsDeep = baseRest(function(args) { - args.push(undefined, customDefaultsMerge); - return apply(mergeWith, undefined, args); -}); - -module.exports = defaultsDeep; diff --git a/node_modules/lodash/defer.js b/node_modules/lodash/defer.js deleted file mode 100644 index f6d6c6fa..00000000 --- a/node_modules/lodash/defer.js +++ /dev/null @@ -1,26 +0,0 @@ -var baseDelay = require('./_baseDelay'), - baseRest = require('./_baseRest'); - -/** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // => Logs 'deferred' after one millisecond. - */ -var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); -}); - -module.exports = defer; diff --git a/node_modules/lodash/delay.js b/node_modules/lodash/delay.js deleted file mode 100644 index bd554796..00000000 --- a/node_modules/lodash/delay.js +++ /dev/null @@ -1,28 +0,0 @@ -var baseDelay = require('./_baseDelay'), - baseRest = require('./_baseRest'), - toNumber = require('./toNumber'); - -/** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => Logs 'later' after one second. - */ -var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); -}); - -module.exports = delay; diff --git a/node_modules/lodash/difference.js b/node_modules/lodash/difference.js deleted file mode 100644 index fa28bb30..00000000 --- a/node_modules/lodash/difference.js +++ /dev/null @@ -1,33 +0,0 @@ -var baseDifference = require('./_baseDifference'), - baseFlatten = require('./_baseFlatten'), - baseRest = require('./_baseRest'), - isArrayLikeObject = require('./isArrayLikeObject'); - -/** - * Creates an array of `array` values not included in the other given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * **Note:** Unlike `_.pullAll`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.without, _.xor - * @example - * - * _.difference([2, 1], [2, 3]); - * // => [1] - */ -var difference = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; -}); - -module.exports = difference; diff --git a/node_modules/lodash/differenceBy.js b/node_modules/lodash/differenceBy.js deleted file mode 100644 index 2cd63e7e..00000000 --- a/node_modules/lodash/differenceBy.js +++ /dev/null @@ -1,44 +0,0 @@ -var baseDifference = require('./_baseDifference'), - baseFlatten = require('./_baseFlatten'), - baseIteratee = require('./_baseIteratee'), - baseRest = require('./_baseRest'), - isArrayLikeObject = require('./isArrayLikeObject'), - last = require('./last'); - -/** - * This method is like `_.difference` except that it accepts `iteratee` which - * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * **Note:** Unlike `_.pullAllBy`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2] - * - * // The `_.property` iteratee shorthand. - * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ -var differenceBy = baseRest(function(array, values) { - var iteratee = last(values); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee, 2)) - : []; -}); - -module.exports = differenceBy; diff --git a/node_modules/lodash/differenceWith.js b/node_modules/lodash/differenceWith.js deleted file mode 100644 index c0233f4b..00000000 --- a/node_modules/lodash/differenceWith.js +++ /dev/null @@ -1,40 +0,0 @@ -var baseDifference = require('./_baseDifference'), - baseFlatten = require('./_baseFlatten'), - baseRest = require('./_baseRest'), - isArrayLikeObject = require('./isArrayLikeObject'), - last = require('./last'); - -/** - * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The order and - * references of result values are determined by the first array. The comparator - * is invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.pullAllWith`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * - * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); - * // => [{ 'x': 2, 'y': 1 }] - */ -var differenceWith = baseRest(function(array, values) { - var comparator = last(values); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) - : []; -}); - -module.exports = differenceWith; diff --git a/node_modules/lodash/divide.js b/node_modules/lodash/divide.js deleted file mode 100644 index 8cae0cd1..00000000 --- a/node_modules/lodash/divide.js +++ /dev/null @@ -1,22 +0,0 @@ -var createMathOperation = require('./_createMathOperation'); - -/** - * Divide two numbers. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Math - * @param {number} dividend The first number in a division. - * @param {number} divisor The second number in a division. - * @returns {number} Returns the quotient. - * @example - * - * _.divide(6, 4); - * // => 1.5 - */ -var divide = createMathOperation(function(dividend, divisor) { - return dividend / divisor; -}, 1); - -module.exports = divide; diff --git a/node_modules/lodash/drop.js b/node_modules/lodash/drop.js deleted file mode 100644 index d5c3cbaa..00000000 --- a/node_modules/lodash/drop.js +++ /dev/null @@ -1,38 +0,0 @@ -var baseSlice = require('./_baseSlice'), - toInteger = require('./toInteger'); - -/** - * Creates a slice of `array` with `n` elements dropped from the beginning. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.drop([1, 2, 3]); - * // => [2, 3] - * - * _.drop([1, 2, 3], 2); - * // => [3] - * - * _.drop([1, 2, 3], 5); - * // => [] - * - * _.drop([1, 2, 3], 0); - * // => [1, 2, 3] - */ -function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); -} - -module.exports = drop; diff --git a/node_modules/lodash/dropRight.js b/node_modules/lodash/dropRight.js deleted file mode 100644 index 441fe996..00000000 --- a/node_modules/lodash/dropRight.js +++ /dev/null @@ -1,39 +0,0 @@ -var baseSlice = require('./_baseSlice'), - toInteger = require('./toInteger'); - -/** - * Creates a slice of `array` with `n` elements dropped from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.dropRight([1, 2, 3]); - * // => [1, 2] - * - * _.dropRight([1, 2, 3], 2); - * // => [1] - * - * _.dropRight([1, 2, 3], 5); - * // => [] - * - * _.dropRight([1, 2, 3], 0); - * // => [1, 2, 3] - */ -function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); -} - -module.exports = dropRight; diff --git a/node_modules/lodash/dropRightWhile.js b/node_modules/lodash/dropRightWhile.js deleted file mode 100644 index 9ad36a04..00000000 --- a/node_modules/lodash/dropRightWhile.js +++ /dev/null @@ -1,45 +0,0 @@ -var baseIteratee = require('./_baseIteratee'), - baseWhile = require('./_baseWhile'); - -/** - * Creates a slice of `array` excluding elements dropped from the end. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.dropRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney'] - * - * // The `_.matches` iteratee shorthand. - * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropRightWhile(users, ['active', false]); - * // => objects for ['barney'] - * - * // The `_.property` iteratee shorthand. - * _.dropRightWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ -function dropRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, baseIteratee(predicate, 3), true, true) - : []; -} - -module.exports = dropRightWhile; diff --git a/node_modules/lodash/dropWhile.js b/node_modules/lodash/dropWhile.js deleted file mode 100644 index 903ef568..00000000 --- a/node_modules/lodash/dropWhile.js +++ /dev/null @@ -1,45 +0,0 @@ -var baseIteratee = require('./_baseIteratee'), - baseWhile = require('./_baseWhile'); - -/** - * Creates a slice of `array` excluding elements dropped from the beginning. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.dropWhile(users, function(o) { return !o.active; }); - * // => objects for ['pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.dropWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropWhile(users, ['active', false]); - * // => objects for ['pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.dropWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ -function dropWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, baseIteratee(predicate, 3), true) - : []; -} - -module.exports = dropWhile; diff --git a/node_modules/lodash/each.js b/node_modules/lodash/each.js deleted file mode 100644 index 8800f420..00000000 --- a/node_modules/lodash/each.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./forEach'); diff --git a/node_modules/lodash/eachRight.js b/node_modules/lodash/eachRight.js deleted file mode 100644 index 3252b2ab..00000000 --- a/node_modules/lodash/eachRight.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./forEachRight'); diff --git a/node_modules/lodash/endsWith.js b/node_modules/lodash/endsWith.js deleted file mode 100644 index 76fc866e..00000000 --- a/node_modules/lodash/endsWith.js +++ /dev/null @@ -1,43 +0,0 @@ -var baseClamp = require('./_baseClamp'), - baseToString = require('./_baseToString'), - toInteger = require('./toInteger'), - toString = require('./toString'); - -/** - * Checks if `string` ends with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search up to. - * @returns {boolean} Returns `true` if `string` ends with `target`, - * else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ -function endsWith(string, target, position) { - string = toString(string); - target = baseToString(target); - - var length = string.length; - position = position === undefined - ? length - : baseClamp(toInteger(position), 0, length); - - var end = position; - position -= target.length; - return position >= 0 && string.slice(position, end) == target; -} - -module.exports = endsWith; diff --git a/node_modules/lodash/entries.js b/node_modules/lodash/entries.js deleted file mode 100644 index 7a88df20..00000000 --- a/node_modules/lodash/entries.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./toPairs'); diff --git a/node_modules/lodash/entriesIn.js b/node_modules/lodash/entriesIn.js deleted file mode 100644 index f6c6331c..00000000 --- a/node_modules/lodash/entriesIn.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./toPairsIn'); diff --git a/node_modules/lodash/eq.js b/node_modules/lodash/eq.js deleted file mode 100644 index a9406880..00000000 --- a/node_modules/lodash/eq.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} - -module.exports = eq; diff --git a/node_modules/lodash/escape.js b/node_modules/lodash/escape.js deleted file mode 100644 index 9247e002..00000000 --- a/node_modules/lodash/escape.js +++ /dev/null @@ -1,43 +0,0 @@ -var escapeHtmlChar = require('./_escapeHtmlChar'), - toString = require('./toString'); - -/** Used to match HTML entities and HTML characters. */ -var reUnescapedHtml = /[&<>"']/g, - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - -/** - * Converts the characters "&", "<", ">", '"', and "'" in `string` to their - * corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. See - * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * When working with HTML you should always - * [quote attribute values](http://wonko.com/post/html-escaping) to reduce - * XSS vectors. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ -function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; -} - -module.exports = escape; diff --git a/node_modules/lodash/escapeRegExp.js b/node_modules/lodash/escapeRegExp.js deleted file mode 100644 index 0a58c69f..00000000 --- a/node_modules/lodash/escapeRegExp.js +++ /dev/null @@ -1,32 +0,0 @@ -var toString = require('./toString'); - -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - -/** - * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", - * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https://lodash\.com/\)' - */ -function escapeRegExp(string) { - string = toString(string); - return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : string; -} - -module.exports = escapeRegExp; diff --git a/node_modules/lodash/every.js b/node_modules/lodash/every.js deleted file mode 100644 index 25080dac..00000000 --- a/node_modules/lodash/every.js +++ /dev/null @@ -1,56 +0,0 @@ -var arrayEvery = require('./_arrayEvery'), - baseEvery = require('./_baseEvery'), - baseIteratee = require('./_baseIteratee'), - isArray = require('./isArray'), - isIterateeCall = require('./_isIterateeCall'); - -/** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * **Note:** This method returns `true` for - * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because - * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of - * elements of empty collections. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.every(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.every(users, 'active'); - * // => false - */ -function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, baseIteratee(predicate, 3)); -} - -module.exports = every; diff --git a/node_modules/lodash/extend.js b/node_modules/lodash/extend.js deleted file mode 100644 index e00166c2..00000000 --- a/node_modules/lodash/extend.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./assignIn'); diff --git a/node_modules/lodash/extendWith.js b/node_modules/lodash/extendWith.js deleted file mode 100644 index dbdcb3b4..00000000 --- a/node_modules/lodash/extendWith.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./assignInWith'); diff --git a/node_modules/lodash/fill.js b/node_modules/lodash/fill.js deleted file mode 100644 index ae13aa1c..00000000 --- a/node_modules/lodash/fill.js +++ /dev/null @@ -1,45 +0,0 @@ -var baseFill = require('./_baseFill'), - isIterateeCall = require('./_isIterateeCall'); - -/** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * _.fill(Array(3), 2); - * // => [2, 2, 2] - * - * _.fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ -function fill(array, value, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); -} - -module.exports = fill; diff --git a/node_modules/lodash/filter.js b/node_modules/lodash/filter.js deleted file mode 100644 index 89e0c8c4..00000000 --- a/node_modules/lodash/filter.js +++ /dev/null @@ -1,52 +0,0 @@ -var arrayFilter = require('./_arrayFilter'), - baseFilter = require('./_baseFilter'), - baseIteratee = require('./_baseIteratee'), - isArray = require('./isArray'); - -/** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * **Note:** Unlike `_.remove`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.reject - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, { 'age': 36, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.filter(users, 'active'); - * // => objects for ['barney'] - * - * // Combining several predicates using `_.overEvery` or `_.overSome`. - * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); - * // => objects for ['fred', 'barney'] - */ -function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, baseIteratee(predicate, 3)); -} - -module.exports = filter; diff --git a/node_modules/lodash/find.js b/node_modules/lodash/find.js deleted file mode 100644 index de732ccb..00000000 --- a/node_modules/lodash/find.js +++ /dev/null @@ -1,42 +0,0 @@ -var createFind = require('./_createFind'), - findIndex = require('./findIndex'); - -/** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */ -var find = createFind(findIndex); - -module.exports = find; diff --git a/node_modules/lodash/findIndex.js b/node_modules/lodash/findIndex.js deleted file mode 100644 index 4689069f..00000000 --- a/node_modules/lodash/findIndex.js +++ /dev/null @@ -1,55 +0,0 @@ -var baseFindIndex = require('./_baseFindIndex'), - baseIteratee = require('./_baseIteratee'), - toInteger = require('./toInteger'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */ -function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, baseIteratee(predicate, 3), index); -} - -module.exports = findIndex; diff --git a/node_modules/lodash/findKey.js b/node_modules/lodash/findKey.js deleted file mode 100644 index cac0248a..00000000 --- a/node_modules/lodash/findKey.js +++ /dev/null @@ -1,44 +0,0 @@ -var baseFindKey = require('./_baseFindKey'), - baseForOwn = require('./_baseForOwn'), - baseIteratee = require('./_baseIteratee'); - -/** - * This method is like `_.find` except that it returns the key of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) - * - * // The `_.matches` iteratee shorthand. - * _.findKey(users, { 'age': 1, 'active': true }); - * // => 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findKey(users, 'active'); - * // => 'barney' - */ -function findKey(object, predicate) { - return baseFindKey(object, baseIteratee(predicate, 3), baseForOwn); -} - -module.exports = findKey; diff --git a/node_modules/lodash/findLast.js b/node_modules/lodash/findLast.js deleted file mode 100644 index 70b4271d..00000000 --- a/node_modules/lodash/findLast.js +++ /dev/null @@ -1,25 +0,0 @@ -var createFind = require('./_createFind'), - findLastIndex = require('./findLastIndex'); - -/** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=collection.length-1] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); - * // => 3 - */ -var findLast = createFind(findLastIndex); - -module.exports = findLast; diff --git a/node_modules/lodash/findLastIndex.js b/node_modules/lodash/findLastIndex.js deleted file mode 100644 index 7da3431f..00000000 --- a/node_modules/lodash/findLastIndex.js +++ /dev/null @@ -1,59 +0,0 @@ -var baseFindIndex = require('./_baseFindIndex'), - baseIteratee = require('./_baseIteratee'), - toInteger = require('./toInteger'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max, - nativeMin = Math.min; - -/** - * This method is like `_.findIndex` except that it iterates over elements - * of `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); - * // => 2 - * - * // The `_.matches` iteratee shorthand. - * _.findLastIndex(users, { 'user': 'barney', 'active': true }); - * // => 0 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastIndex(users, ['active', false]); - * // => 2 - * - * // The `_.property` iteratee shorthand. - * _.findLastIndex(users, 'active'); - * // => 0 - */ -function findLastIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length - 1; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); - } - return baseFindIndex(array, baseIteratee(predicate, 3), index, true); -} - -module.exports = findLastIndex; diff --git a/node_modules/lodash/findLastKey.js b/node_modules/lodash/findLastKey.js deleted file mode 100644 index 66fb9fbc..00000000 --- a/node_modules/lodash/findLastKey.js +++ /dev/null @@ -1,44 +0,0 @@ -var baseFindKey = require('./_baseFindKey'), - baseForOwnRight = require('./_baseForOwnRight'), - baseIteratee = require('./_baseIteratee'); - -/** - * This method is like `_.findKey` except that it iterates over elements of - * a collection in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findLastKey(users, function(o) { return o.age < 40; }); - * // => returns 'pebbles' assuming `_.findKey` returns 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.findLastKey(users, { 'age': 36, 'active': true }); - * // => 'barney' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findLastKey(users, 'active'); - * // => 'pebbles' - */ -function findLastKey(object, predicate) { - return baseFindKey(object, baseIteratee(predicate, 3), baseForOwnRight); -} - -module.exports = findLastKey; diff --git a/node_modules/lodash/first.js b/node_modules/lodash/first.js deleted file mode 100644 index 53f4ad13..00000000 --- a/node_modules/lodash/first.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./head'); diff --git a/node_modules/lodash/flake.lock b/node_modules/lodash/flake.lock deleted file mode 100644 index dd032521..00000000 --- a/node_modules/lodash/flake.lock +++ /dev/null @@ -1,40 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1613582597, - "narHash": "sha256-6LvipIvFuhyorHpUqK3HjySC5Y6gshXHFBhU9EJ4DoM=", - "path": "/nix/store/srvplqq673sqd9vyfhyc5w1p88y1gfm4-source", - "rev": "6b1057b452c55bb3b463f0d7055bc4ec3fd1f381", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs", - "utils": "utils" - } - }, - "utils": { - "locked": { - "lastModified": 1610051610, - "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/node_modules/lodash/flake.nix b/node_modules/lodash/flake.nix deleted file mode 100644 index 15a451c6..00000000 --- a/node_modules/lodash/flake.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - inputs = { - utils.url = "github:numtide/flake-utils"; - }; - - outputs = { self, nixpkgs, utils }: - utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages."${system}"; - in rec { - devShell = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - yarn - nodejs-14_x - nodePackages.typescript-language-server - nodePackages.eslint - ]; - }; - }); -} diff --git a/node_modules/lodash/flatMap.js b/node_modules/lodash/flatMap.js deleted file mode 100644 index e6685068..00000000 --- a/node_modules/lodash/flatMap.js +++ /dev/null @@ -1,29 +0,0 @@ -var baseFlatten = require('./_baseFlatten'), - map = require('./map'); - -/** - * Creates a flattened array of values by running each element in `collection` - * thru `iteratee` and flattening the mapped results. The iteratee is invoked - * with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _.flatMap([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ -function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee), 1); -} - -module.exports = flatMap; diff --git a/node_modules/lodash/flatMapDeep.js b/node_modules/lodash/flatMapDeep.js deleted file mode 100644 index 4653d603..00000000 --- a/node_modules/lodash/flatMapDeep.js +++ /dev/null @@ -1,31 +0,0 @@ -var baseFlatten = require('./_baseFlatten'), - map = require('./map'); - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - -/** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDeep([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ -function flatMapDeep(collection, iteratee) { - return baseFlatten(map(collection, iteratee), INFINITY); -} - -module.exports = flatMapDeep; diff --git a/node_modules/lodash/flatMapDepth.js b/node_modules/lodash/flatMapDepth.js deleted file mode 100644 index 6d72005c..00000000 --- a/node_modules/lodash/flatMapDepth.js +++ /dev/null @@ -1,31 +0,0 @@ -var baseFlatten = require('./_baseFlatten'), - map = require('./map'), - toInteger = require('./toInteger'); - -/** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDepth([1, 2], duplicate, 2); - * // => [[1, 1], [2, 2]] - */ -function flatMapDepth(collection, iteratee, depth) { - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(map(collection, iteratee), depth); -} - -module.exports = flatMapDepth; diff --git a/node_modules/lodash/flatten.js b/node_modules/lodash/flatten.js deleted file mode 100644 index 3f09f7f7..00000000 --- a/node_modules/lodash/flatten.js +++ /dev/null @@ -1,22 +0,0 @@ -var baseFlatten = require('./_baseFlatten'); - -/** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */ -function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; -} - -module.exports = flatten; diff --git a/node_modules/lodash/flattenDeep.js b/node_modules/lodash/flattenDeep.js deleted file mode 100644 index 8ad585cf..00000000 --- a/node_modules/lodash/flattenDeep.js +++ /dev/null @@ -1,25 +0,0 @@ -var baseFlatten = require('./_baseFlatten'); - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - -/** - * Recursively flattens `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, [3, [4]], 5]]); - * // => [1, 2, 3, 4, 5] - */ -function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; -} - -module.exports = flattenDeep; diff --git a/node_modules/lodash/flattenDepth.js b/node_modules/lodash/flattenDepth.js deleted file mode 100644 index 441fdcc2..00000000 --- a/node_modules/lodash/flattenDepth.js +++ /dev/null @@ -1,33 +0,0 @@ -var baseFlatten = require('./_baseFlatten'), - toInteger = require('./toInteger'); - -/** - * Recursively flatten `array` up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Array - * @param {Array} array The array to flatten. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * var array = [1, [2, [3, [4]], 5]]; - * - * _.flattenDepth(array, 1); - * // => [1, 2, [3, [4]], 5] - * - * _.flattenDepth(array, 2); - * // => [1, 2, 3, [4], 5] - */ -function flattenDepth(array, depth) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(array, depth); -} - -module.exports = flattenDepth; diff --git a/node_modules/lodash/flip.js b/node_modules/lodash/flip.js deleted file mode 100644 index c28dd789..00000000 --- a/node_modules/lodash/flip.js +++ /dev/null @@ -1,28 +0,0 @@ -var createWrap = require('./_createWrap'); - -/** Used to compose bitmasks for function metadata. */ -var WRAP_FLIP_FLAG = 512; - -/** - * Creates a function that invokes `func` with arguments reversed. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new flipped function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ -function flip(func) { - return createWrap(func, WRAP_FLIP_FLAG); -} - -module.exports = flip; diff --git a/node_modules/lodash/floor.js b/node_modules/lodash/floor.js deleted file mode 100644 index ab6dfa28..00000000 --- a/node_modules/lodash/floor.js +++ /dev/null @@ -1,26 +0,0 @@ -var createRound = require('./_createRound'); - -/** - * Computes `number` rounded down to `precision`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Math - * @param {number} number The number to round down. - * @param {number} [precision=0] The precision to round down to. - * @returns {number} Returns the rounded down number. - * @example - * - * _.floor(4.006); - * // => 4 - * - * _.floor(0.046, 2); - * // => 0.04 - * - * _.floor(4060, -2); - * // => 4000 - */ -var floor = createRound('floor'); - -module.exports = floor; diff --git a/node_modules/lodash/flow.js b/node_modules/lodash/flow.js deleted file mode 100644 index 74b6b62d..00000000 --- a/node_modules/lodash/flow.js +++ /dev/null @@ -1,27 +0,0 @@ -var createFlow = require('./_createFlow'); - -/** - * Creates a function that returns the result of invoking the given functions - * with the `this` binding of the created function, where each successive - * invocation is supplied the return value of the previous. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Util - * @param {...(Function|Function[])} [funcs] The functions to invoke. - * @returns {Function} Returns the new composite function. - * @see _.flowRight - * @example - * - * function square(n) { - * return n * n; - * } - * - * var addSquare = _.flow([_.add, square]); - * addSquare(1, 2); - * // => 9 - */ -var flow = createFlow(); - -module.exports = flow; diff --git a/node_modules/lodash/flowRight.js b/node_modules/lodash/flowRight.js deleted file mode 100644 index 11461410..00000000 --- a/node_modules/lodash/flowRight.js +++ /dev/null @@ -1,26 +0,0 @@ -var createFlow = require('./_createFlow'); - -/** - * This method is like `_.flow` except that it creates a function that - * invokes the given functions from right to left. - * - * @static - * @since 3.0.0 - * @memberOf _ - * @category Util - * @param {...(Function|Function[])} [funcs] The functions to invoke. - * @returns {Function} Returns the new composite function. - * @see _.flow - * @example - * - * function square(n) { - * return n * n; - * } - * - * var addSquare = _.flowRight([square, _.add]); - * addSquare(1, 2); - * // => 9 - */ -var flowRight = createFlow(true); - -module.exports = flowRight; diff --git a/node_modules/lodash/forEach.js b/node_modules/lodash/forEach.js deleted file mode 100644 index c64eaa73..00000000 --- a/node_modules/lodash/forEach.js +++ /dev/null @@ -1,41 +0,0 @@ -var arrayEach = require('./_arrayEach'), - baseEach = require('./_baseEach'), - castFunction = require('./_castFunction'), - isArray = require('./isArray'); - -/** - * Iterates over elements of `collection` and invokes `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" - * property are iterated like arrays. To avoid this behavior use `_.forIn` - * or `_.forOwn` for object iteration. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEachRight - * @example - * - * _.forEach([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `1` then `2`. - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ -function forEach(collection, iteratee) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, castFunction(iteratee)); -} - -module.exports = forEach; diff --git a/node_modules/lodash/forEachRight.js b/node_modules/lodash/forEachRight.js deleted file mode 100644 index 7390ebaf..00000000 --- a/node_modules/lodash/forEachRight.js +++ /dev/null @@ -1,31 +0,0 @@ -var arrayEachRight = require('./_arrayEachRight'), - baseEachRight = require('./_baseEachRight'), - castFunction = require('./_castFunction'), - isArray = require('./isArray'); - -/** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @alias eachRight - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEach - * @example - * - * _.forEachRight([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `2` then `1`. - */ -function forEachRight(collection, iteratee) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, castFunction(iteratee)); -} - -module.exports = forEachRight; diff --git a/node_modules/lodash/forIn.js b/node_modules/lodash/forIn.js deleted file mode 100644 index 583a5963..00000000 --- a/node_modules/lodash/forIn.js +++ /dev/null @@ -1,39 +0,0 @@ -var baseFor = require('./_baseFor'), - castFunction = require('./_castFunction'), - keysIn = require('./keysIn'); - -/** - * Iterates over own and inherited enumerable string keyed properties of an - * object and invokes `iteratee` for each property. The iteratee is invoked - * with three arguments: (value, key, object). Iteratee functions may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forInRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forIn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). - */ -function forIn(object, iteratee) { - return object == null - ? object - : baseFor(object, castFunction(iteratee), keysIn); -} - -module.exports = forIn; diff --git a/node_modules/lodash/forInRight.js b/node_modules/lodash/forInRight.js deleted file mode 100644 index 4aedf58a..00000000 --- a/node_modules/lodash/forInRight.js +++ /dev/null @@ -1,37 +0,0 @@ -var baseForRight = require('./_baseForRight'), - castFunction = require('./_castFunction'), - keysIn = require('./keysIn'); - -/** - * This method is like `_.forIn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forIn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forInRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. - */ -function forInRight(object, iteratee) { - return object == null - ? object - : baseForRight(object, castFunction(iteratee), keysIn); -} - -module.exports = forInRight; diff --git a/node_modules/lodash/forOwn.js b/node_modules/lodash/forOwn.js deleted file mode 100644 index 94eed840..00000000 --- a/node_modules/lodash/forOwn.js +++ /dev/null @@ -1,36 +0,0 @@ -var baseForOwn = require('./_baseForOwn'), - castFunction = require('./_castFunction'); - -/** - * Iterates over own enumerable string keyed properties of an object and - * invokes `iteratee` for each property. The iteratee is invoked with three - * arguments: (value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwnRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ -function forOwn(object, iteratee) { - return object && baseForOwn(object, castFunction(iteratee)); -} - -module.exports = forOwn; diff --git a/node_modules/lodash/forOwnRight.js b/node_modules/lodash/forOwnRight.js deleted file mode 100644 index 86f338f0..00000000 --- a/node_modules/lodash/forOwnRight.js +++ /dev/null @@ -1,34 +0,0 @@ -var baseForOwnRight = require('./_baseForOwnRight'), - castFunction = require('./_castFunction'); - -/** - * This method is like `_.forOwn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwnRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. - */ -function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, castFunction(iteratee)); -} - -module.exports = forOwnRight; diff --git a/node_modules/lodash/fp.js b/node_modules/lodash/fp.js deleted file mode 100644 index e372dbbd..00000000 --- a/node_modules/lodash/fp.js +++ /dev/null @@ -1,2 +0,0 @@ -var _ = require('./lodash.min').runInContext(); -module.exports = require('./fp/_baseConvert')(_, _); diff --git a/node_modules/lodash/fp/F.js b/node_modules/lodash/fp/F.js deleted file mode 100644 index a05a63ad..00000000 --- a/node_modules/lodash/fp/F.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./stubFalse'); diff --git a/node_modules/lodash/fp/T.js b/node_modules/lodash/fp/T.js deleted file mode 100644 index e2ba8ea5..00000000 --- a/node_modules/lodash/fp/T.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./stubTrue'); diff --git a/node_modules/lodash/fp/__.js b/node_modules/lodash/fp/__.js deleted file mode 100644 index 4af98deb..00000000 --- a/node_modules/lodash/fp/__.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./placeholder'); diff --git a/node_modules/lodash/fp/_baseConvert.js b/node_modules/lodash/fp/_baseConvert.js deleted file mode 100644 index 9baf8e19..00000000 --- a/node_modules/lodash/fp/_baseConvert.js +++ /dev/null @@ -1,569 +0,0 @@ -var mapping = require('./_mapping'), - fallbackHolder = require('./placeholder'); - -/** Built-in value reference. */ -var push = Array.prototype.push; - -/** - * Creates a function, with an arity of `n`, that invokes `func` with the - * arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} n The arity of the new function. - * @returns {Function} Returns the new function. - */ -function baseArity(func, n) { - return n == 2 - ? function(a, b) { return func.apply(undefined, arguments); } - : function(a) { return func.apply(undefined, arguments); }; -} - -/** - * Creates a function that invokes `func`, with up to `n` arguments, ignoring - * any additional arguments. - * - * @private - * @param {Function} func The function to cap arguments for. - * @param {number} n The arity cap. - * @returns {Function} Returns the new function. - */ -function baseAry(func, n) { - return n == 2 - ? function(a, b) { return func(a, b); } - : function(a) { return func(a); }; -} - -/** - * Creates a clone of `array`. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the cloned array. - */ -function cloneArray(array) { - var length = array ? array.length : 0, - result = Array(length); - - while (length--) { - result[length] = array[length]; - } - return result; -} - -/** - * Creates a function that clones a given object using the assignment `func`. - * - * @private - * @param {Function} func The assignment function. - * @returns {Function} Returns the new cloner function. - */ -function createCloner(func) { - return function(object) { - return func({}, object); - }; -} - -/** - * A specialized version of `_.spread` which flattens the spread array into - * the arguments of the invoked `func`. - * - * @private - * @param {Function} func The function to spread arguments over. - * @param {number} start The start position of the spread. - * @returns {Function} Returns the new function. - */ -function flatSpread(func, start) { - return function() { - var length = arguments.length, - lastIndex = length - 1, - args = Array(length); - - while (length--) { - args[length] = arguments[length]; - } - var array = args[start], - otherArgs = args.slice(0, start); - - if (array) { - push.apply(otherArgs, array); - } - if (start != lastIndex) { - push.apply(otherArgs, args.slice(start + 1)); - } - return func.apply(this, otherArgs); - }; -} - -/** - * Creates a function that wraps `func` and uses `cloner` to clone the first - * argument it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} cloner The function to clone arguments. - * @returns {Function} Returns the new immutable function. - */ -function wrapImmutable(func, cloner) { - return function() { - var length = arguments.length; - if (!length) { - return; - } - var args = Array(length); - while (length--) { - args[length] = arguments[length]; - } - var result = args[0] = cloner.apply(undefined, args); - func.apply(undefined, args); - return result; - }; -} - -/** - * The base implementation of `convert` which accepts a `util` object of methods - * required to perform conversions. - * - * @param {Object} util The util object. - * @param {string} name The name of the function to convert. - * @param {Function} func The function to convert. - * @param {Object} [options] The options object. - * @param {boolean} [options.cap=true] Specify capping iteratee arguments. - * @param {boolean} [options.curry=true] Specify currying. - * @param {boolean} [options.fixed=true] Specify fixed arity. - * @param {boolean} [options.immutable=true] Specify immutable operations. - * @param {boolean} [options.rearg=true] Specify rearranging arguments. - * @returns {Function|Object} Returns the converted function or object. - */ -function baseConvert(util, name, func, options) { - var isLib = typeof name == 'function', - isObj = name === Object(name); - - if (isObj) { - options = func; - func = name; - name = undefined; - } - if (func == null) { - throw new TypeError; - } - options || (options = {}); - - var config = { - 'cap': 'cap' in options ? options.cap : true, - 'curry': 'curry' in options ? options.curry : true, - 'fixed': 'fixed' in options ? options.fixed : true, - 'immutable': 'immutable' in options ? options.immutable : true, - 'rearg': 'rearg' in options ? options.rearg : true - }; - - var defaultHolder = isLib ? func : fallbackHolder, - forceCurry = ('curry' in options) && options.curry, - forceFixed = ('fixed' in options) && options.fixed, - forceRearg = ('rearg' in options) && options.rearg, - pristine = isLib ? func.runInContext() : undefined; - - var helpers = isLib ? func : { - 'ary': util.ary, - 'assign': util.assign, - 'clone': util.clone, - 'curry': util.curry, - 'forEach': util.forEach, - 'isArray': util.isArray, - 'isError': util.isError, - 'isFunction': util.isFunction, - 'isWeakMap': util.isWeakMap, - 'iteratee': util.iteratee, - 'keys': util.keys, - 'rearg': util.rearg, - 'toInteger': util.toInteger, - 'toPath': util.toPath - }; - - var ary = helpers.ary, - assign = helpers.assign, - clone = helpers.clone, - curry = helpers.curry, - each = helpers.forEach, - isArray = helpers.isArray, - isError = helpers.isError, - isFunction = helpers.isFunction, - isWeakMap = helpers.isWeakMap, - keys = helpers.keys, - rearg = helpers.rearg, - toInteger = helpers.toInteger, - toPath = helpers.toPath; - - var aryMethodKeys = keys(mapping.aryMethod); - - var wrappers = { - 'castArray': function(castArray) { - return function() { - var value = arguments[0]; - return isArray(value) - ? castArray(cloneArray(value)) - : castArray.apply(undefined, arguments); - }; - }, - 'iteratee': function(iteratee) { - return function() { - var func = arguments[0], - arity = arguments[1], - result = iteratee(func, arity), - length = result.length; - - if (config.cap && typeof arity == 'number') { - arity = arity > 2 ? (arity - 2) : 1; - return (length && length <= arity) ? result : baseAry(result, arity); - } - return result; - }; - }, - 'mixin': function(mixin) { - return function(source) { - var func = this; - if (!isFunction(func)) { - return mixin(func, Object(source)); - } - var pairs = []; - each(keys(source), function(key) { - if (isFunction(source[key])) { - pairs.push([key, func.prototype[key]]); - } - }); - - mixin(func, Object(source)); - - each(pairs, function(pair) { - var value = pair[1]; - if (isFunction(value)) { - func.prototype[pair[0]] = value; - } else { - delete func.prototype[pair[0]]; - } - }); - return func; - }; - }, - 'nthArg': function(nthArg) { - return function(n) { - var arity = n < 0 ? 1 : (toInteger(n) + 1); - return curry(nthArg(n), arity); - }; - }, - 'rearg': function(rearg) { - return function(func, indexes) { - var arity = indexes ? indexes.length : 0; - return curry(rearg(func, indexes), arity); - }; - }, - 'runInContext': function(runInContext) { - return function(context) { - return baseConvert(util, runInContext(context), options); - }; - } - }; - - /*--------------------------------------------------------------------------*/ - - /** - * Casts `func` to a function with an arity capped iteratee if needed. - * - * @private - * @param {string} name The name of the function to inspect. - * @param {Function} func The function to inspect. - * @returns {Function} Returns the cast function. - */ - function castCap(name, func) { - if (config.cap) { - var indexes = mapping.iterateeRearg[name]; - if (indexes) { - return iterateeRearg(func, indexes); - } - var n = !isLib && mapping.iterateeAry[name]; - if (n) { - return iterateeAry(func, n); - } - } - return func; - } - - /** - * Casts `func` to a curried function if needed. - * - * @private - * @param {string} name The name of the function to inspect. - * @param {Function} func The function to inspect. - * @param {number} n The arity of `func`. - * @returns {Function} Returns the cast function. - */ - function castCurry(name, func, n) { - return (forceCurry || (config.curry && n > 1)) - ? curry(func, n) - : func; - } - - /** - * Casts `func` to a fixed arity function if needed. - * - * @private - * @param {string} name The name of the function to inspect. - * @param {Function} func The function to inspect. - * @param {number} n The arity cap. - * @returns {Function} Returns the cast function. - */ - function castFixed(name, func, n) { - if (config.fixed && (forceFixed || !mapping.skipFixed[name])) { - var data = mapping.methodSpread[name], - start = data && data.start; - - return start === undefined ? ary(func, n) : flatSpread(func, start); - } - return func; - } - - /** - * Casts `func` to an rearged function if needed. - * - * @private - * @param {string} name The name of the function to inspect. - * @param {Function} func The function to inspect. - * @param {number} n The arity of `func`. - * @returns {Function} Returns the cast function. - */ - function castRearg(name, func, n) { - return (config.rearg && n > 1 && (forceRearg || !mapping.skipRearg[name])) - ? rearg(func, mapping.methodRearg[name] || mapping.aryRearg[n]) - : func; - } - - /** - * Creates a clone of `object` by `path`. - * - * @private - * @param {Object} object The object to clone. - * @param {Array|string} path The path to clone by. - * @returns {Object} Returns the cloned object. - */ - function cloneByPath(object, path) { - path = toPath(path); - - var index = -1, - length = path.length, - lastIndex = length - 1, - result = clone(Object(object)), - nested = result; - - while (nested != null && ++index < length) { - var key = path[index], - value = nested[key]; - - if (value != null && - !(isFunction(value) || isError(value) || isWeakMap(value))) { - nested[key] = clone(index == lastIndex ? value : Object(value)); - } - nested = nested[key]; - } - return result; - } - - /** - * Converts `lodash` to an immutable auto-curried iteratee-first data-last - * version with conversion `options` applied. - * - * @param {Object} [options] The options object. See `baseConvert` for more details. - * @returns {Function} Returns the converted `lodash`. - */ - function convertLib(options) { - return _.runInContext.convert(options)(undefined); - } - - /** - * Create a converter function for `func` of `name`. - * - * @param {string} name The name of the function to convert. - * @param {Function} func The function to convert. - * @returns {Function} Returns the new converter function. - */ - function createConverter(name, func) { - var realName = mapping.aliasToReal[name] || name, - methodName = mapping.remap[realName] || realName, - oldOptions = options; - - return function(options) { - var newUtil = isLib ? pristine : helpers, - newFunc = isLib ? pristine[methodName] : func, - newOptions = assign(assign({}, oldOptions), options); - - return baseConvert(newUtil, realName, newFunc, newOptions); - }; - } - - /** - * Creates a function that wraps `func` to invoke its iteratee, with up to `n` - * arguments, ignoring any additional arguments. - * - * @private - * @param {Function} func The function to cap iteratee arguments for. - * @param {number} n The arity cap. - * @returns {Function} Returns the new function. - */ - function iterateeAry(func, n) { - return overArg(func, function(func) { - return typeof func == 'function' ? baseAry(func, n) : func; - }); - } - - /** - * Creates a function that wraps `func` to invoke its iteratee with arguments - * arranged according to the specified `indexes` where the argument value at - * the first index is provided as the first argument, the argument value at - * the second index is provided as the second argument, and so on. - * - * @private - * @param {Function} func The function to rearrange iteratee arguments for. - * @param {number[]} indexes The arranged argument indexes. - * @returns {Function} Returns the new function. - */ - function iterateeRearg(func, indexes) { - return overArg(func, function(func) { - var n = indexes.length; - return baseArity(rearg(baseAry(func, n), indexes), n); - }); - } - - /** - * Creates a function that invokes `func` with its first argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function() { - var length = arguments.length; - if (!length) { - return func(); - } - var args = Array(length); - while (length--) { - args[length] = arguments[length]; - } - var index = config.rearg ? 0 : (length - 1); - args[index] = transform(args[index]); - return func.apply(undefined, args); - }; - } - - /** - * Creates a function that wraps `func` and applys the conversions - * rules by `name`. - * - * @private - * @param {string} name The name of the function to wrap. - * @param {Function} func The function to wrap. - * @returns {Function} Returns the converted function. - */ - function wrap(name, func, placeholder) { - var result, - realName = mapping.aliasToReal[name] || name, - wrapped = func, - wrapper = wrappers[realName]; - - if (wrapper) { - wrapped = wrapper(func); - } - else if (config.immutable) { - if (mapping.mutate.array[realName]) { - wrapped = wrapImmutable(func, cloneArray); - } - else if (mapping.mutate.object[realName]) { - wrapped = wrapImmutable(func, createCloner(func)); - } - else if (mapping.mutate.set[realName]) { - wrapped = wrapImmutable(func, cloneByPath); - } - } - each(aryMethodKeys, function(aryKey) { - each(mapping.aryMethod[aryKey], function(otherName) { - if (realName == otherName) { - var data = mapping.methodSpread[realName], - afterRearg = data && data.afterRearg; - - result = afterRearg - ? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey) - : castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey); - - result = castCap(realName, result); - result = castCurry(realName, result, aryKey); - return false; - } - }); - return !result; - }); - - result || (result = wrapped); - if (result == func) { - result = forceCurry ? curry(result, 1) : function() { - return func.apply(this, arguments); - }; - } - result.convert = createConverter(realName, func); - result.placeholder = func.placeholder = placeholder; - - return result; - } - - /*--------------------------------------------------------------------------*/ - - if (!isObj) { - return wrap(name, func, defaultHolder); - } - var _ = func; - - // Convert methods by ary cap. - var pairs = []; - each(aryMethodKeys, function(aryKey) { - each(mapping.aryMethod[aryKey], function(key) { - var func = _[mapping.remap[key] || key]; - if (func) { - pairs.push([key, wrap(key, func, _)]); - } - }); - }); - - // Convert remaining methods. - each(keys(_), function(key) { - var func = _[key]; - if (typeof func == 'function') { - var length = pairs.length; - while (length--) { - if (pairs[length][0] == key) { - return; - } - } - func.convert = createConverter(key, func); - pairs.push([key, func]); - } - }); - - // Assign to `_` leaving `_.prototype` unchanged to allow chaining. - each(pairs, function(pair) { - _[pair[0]] = pair[1]; - }); - - _.convert = convertLib; - _.placeholder = _; - - // Assign aliases. - each(keys(_), function(key) { - each(mapping.realToAlias[key] || [], function(alias) { - _[alias] = _[key]; - }); - }); - - return _; -} - -module.exports = baseConvert; diff --git a/node_modules/lodash/fp/_convertBrowser.js b/node_modules/lodash/fp/_convertBrowser.js deleted file mode 100644 index bde030dc..00000000 --- a/node_modules/lodash/fp/_convertBrowser.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseConvert = require('./_baseConvert'); - -/** - * Converts `lodash` to an immutable auto-curried iteratee-first data-last - * version with conversion `options` applied. - * - * @param {Function} lodash The lodash function to convert. - * @param {Object} [options] The options object. See `baseConvert` for more details. - * @returns {Function} Returns the converted `lodash`. - */ -function browserConvert(lodash, options) { - return baseConvert(lodash, lodash, options); -} - -if (typeof _ == 'function' && typeof _.runInContext == 'function') { - _ = browserConvert(_.runInContext()); -} -module.exports = browserConvert; diff --git a/node_modules/lodash/fp/_falseOptions.js b/node_modules/lodash/fp/_falseOptions.js deleted file mode 100644 index 773235e3..00000000 --- a/node_modules/lodash/fp/_falseOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - 'cap': false, - 'curry': false, - 'fixed': false, - 'immutable': false, - 'rearg': false -}; diff --git a/node_modules/lodash/fp/_mapping.js b/node_modules/lodash/fp/_mapping.js deleted file mode 100644 index a642ec05..00000000 --- a/node_modules/lodash/fp/_mapping.js +++ /dev/null @@ -1,358 +0,0 @@ -/** Used to map aliases to their real names. */ -exports.aliasToReal = { - - // Lodash aliases. - 'each': 'forEach', - 'eachRight': 'forEachRight', - 'entries': 'toPairs', - 'entriesIn': 'toPairsIn', - 'extend': 'assignIn', - 'extendAll': 'assignInAll', - 'extendAllWith': 'assignInAllWith', - 'extendWith': 'assignInWith', - 'first': 'head', - - // Methods that are curried variants of others. - 'conforms': 'conformsTo', - 'matches': 'isMatch', - 'property': 'get', - - // Ramda aliases. - '__': 'placeholder', - 'F': 'stubFalse', - 'T': 'stubTrue', - 'all': 'every', - 'allPass': 'overEvery', - 'always': 'constant', - 'any': 'some', - 'anyPass': 'overSome', - 'apply': 'spread', - 'assoc': 'set', - 'assocPath': 'set', - 'complement': 'negate', - 'compose': 'flowRight', - 'contains': 'includes', - 'dissoc': 'unset', - 'dissocPath': 'unset', - 'dropLast': 'dropRight', - 'dropLastWhile': 'dropRightWhile', - 'equals': 'isEqual', - 'identical': 'eq', - 'indexBy': 'keyBy', - 'init': 'initial', - 'invertObj': 'invert', - 'juxt': 'over', - 'omitAll': 'omit', - 'nAry': 'ary', - 'path': 'get', - 'pathEq': 'matchesProperty', - 'pathOr': 'getOr', - 'paths': 'at', - 'pickAll': 'pick', - 'pipe': 'flow', - 'pluck': 'map', - 'prop': 'get', - 'propEq': 'matchesProperty', - 'propOr': 'getOr', - 'props': 'at', - 'symmetricDifference': 'xor', - 'symmetricDifferenceBy': 'xorBy', - 'symmetricDifferenceWith': 'xorWith', - 'takeLast': 'takeRight', - 'takeLastWhile': 'takeRightWhile', - 'unapply': 'rest', - 'unnest': 'flatten', - 'useWith': 'overArgs', - 'where': 'conformsTo', - 'whereEq': 'isMatch', - 'zipObj': 'zipObject' -}; - -/** Used to map ary to method names. */ -exports.aryMethod = { - '1': [ - 'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create', - 'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow', - 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll', - 'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse', - 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart', - 'uniqueId', 'words', 'zipAll' - ], - '2': [ - 'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith', - 'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith', - 'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN', - 'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference', - 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', - 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex', - 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach', - 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get', - 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection', - 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy', - 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty', - 'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit', - 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial', - 'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll', - 'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove', - 'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex', - 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy', - 'split', 'spreadFrom', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', - 'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', - 'trimCharsEnd', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', - 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', - 'zipObjectDeep' - ], - '3': [ - 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', - 'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr', - 'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith', - 'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth', - 'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd', - 'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight', - 'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy', - 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy', - 'xorWith', 'zipWith' - ], - '4': [ - 'fill', 'setWith', 'updateWith' - ] -}; - -/** Used to map ary to rearg configs. */ -exports.aryRearg = { - '2': [1, 0], - '3': [2, 0, 1], - '4': [3, 2, 0, 1] -}; - -/** Used to map method names to their iteratee ary. */ -exports.iterateeAry = { - 'dropRightWhile': 1, - 'dropWhile': 1, - 'every': 1, - 'filter': 1, - 'find': 1, - 'findFrom': 1, - 'findIndex': 1, - 'findIndexFrom': 1, - 'findKey': 1, - 'findLast': 1, - 'findLastFrom': 1, - 'findLastIndex': 1, - 'findLastIndexFrom': 1, - 'findLastKey': 1, - 'flatMap': 1, - 'flatMapDeep': 1, - 'flatMapDepth': 1, - 'forEach': 1, - 'forEachRight': 1, - 'forIn': 1, - 'forInRight': 1, - 'forOwn': 1, - 'forOwnRight': 1, - 'map': 1, - 'mapKeys': 1, - 'mapValues': 1, - 'partition': 1, - 'reduce': 2, - 'reduceRight': 2, - 'reject': 1, - 'remove': 1, - 'some': 1, - 'takeRightWhile': 1, - 'takeWhile': 1, - 'times': 1, - 'transform': 2 -}; - -/** Used to map method names to iteratee rearg configs. */ -exports.iterateeRearg = { - 'mapKeys': [1], - 'reduceRight': [1, 0] -}; - -/** Used to map method names to rearg configs. */ -exports.methodRearg = { - 'assignInAllWith': [1, 0], - 'assignInWith': [1, 2, 0], - 'assignAllWith': [1, 0], - 'assignWith': [1, 2, 0], - 'differenceBy': [1, 2, 0], - 'differenceWith': [1, 2, 0], - 'getOr': [2, 1, 0], - 'intersectionBy': [1, 2, 0], - 'intersectionWith': [1, 2, 0], - 'isEqualWith': [1, 2, 0], - 'isMatchWith': [2, 1, 0], - 'mergeAllWith': [1, 0], - 'mergeWith': [1, 2, 0], - 'padChars': [2, 1, 0], - 'padCharsEnd': [2, 1, 0], - 'padCharsStart': [2, 1, 0], - 'pullAllBy': [2, 1, 0], - 'pullAllWith': [2, 1, 0], - 'rangeStep': [1, 2, 0], - 'rangeStepRight': [1, 2, 0], - 'setWith': [3, 1, 2, 0], - 'sortedIndexBy': [2, 1, 0], - 'sortedLastIndexBy': [2, 1, 0], - 'unionBy': [1, 2, 0], - 'unionWith': [1, 2, 0], - 'updateWith': [3, 1, 2, 0], - 'xorBy': [1, 2, 0], - 'xorWith': [1, 2, 0], - 'zipWith': [1, 2, 0] -}; - -/** Used to map method names to spread configs. */ -exports.methodSpread = { - 'assignAll': { 'start': 0 }, - 'assignAllWith': { 'start': 0 }, - 'assignInAll': { 'start': 0 }, - 'assignInAllWith': { 'start': 0 }, - 'defaultsAll': { 'start': 0 }, - 'defaultsDeepAll': { 'start': 0 }, - 'invokeArgs': { 'start': 2 }, - 'invokeArgsMap': { 'start': 2 }, - 'mergeAll': { 'start': 0 }, - 'mergeAllWith': { 'start': 0 }, - 'partial': { 'start': 1 }, - 'partialRight': { 'start': 1 }, - 'without': { 'start': 1 }, - 'zipAll': { 'start': 0 } -}; - -/** Used to identify methods which mutate arrays or objects. */ -exports.mutate = { - 'array': { - 'fill': true, - 'pull': true, - 'pullAll': true, - 'pullAllBy': true, - 'pullAllWith': true, - 'pullAt': true, - 'remove': true, - 'reverse': true - }, - 'object': { - 'assign': true, - 'assignAll': true, - 'assignAllWith': true, - 'assignIn': true, - 'assignInAll': true, - 'assignInAllWith': true, - 'assignInWith': true, - 'assignWith': true, - 'defaults': true, - 'defaultsAll': true, - 'defaultsDeep': true, - 'defaultsDeepAll': true, - 'merge': true, - 'mergeAll': true, - 'mergeAllWith': true, - 'mergeWith': true, - }, - 'set': { - 'set': true, - 'setWith': true, - 'unset': true, - 'update': true, - 'updateWith': true - } -}; - -/** Used to map real names to their aliases. */ -exports.realToAlias = (function() { - var hasOwnProperty = Object.prototype.hasOwnProperty, - object = exports.aliasToReal, - result = {}; - - for (var key in object) { - var value = object[key]; - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } - } - return result; -}()); - -/** Used to map method names to other names. */ -exports.remap = { - 'assignAll': 'assign', - 'assignAllWith': 'assignWith', - 'assignInAll': 'assignIn', - 'assignInAllWith': 'assignInWith', - 'curryN': 'curry', - 'curryRightN': 'curryRight', - 'defaultsAll': 'defaults', - 'defaultsDeepAll': 'defaultsDeep', - 'findFrom': 'find', - 'findIndexFrom': 'findIndex', - 'findLastFrom': 'findLast', - 'findLastIndexFrom': 'findLastIndex', - 'getOr': 'get', - 'includesFrom': 'includes', - 'indexOfFrom': 'indexOf', - 'invokeArgs': 'invoke', - 'invokeArgsMap': 'invokeMap', - 'lastIndexOfFrom': 'lastIndexOf', - 'mergeAll': 'merge', - 'mergeAllWith': 'mergeWith', - 'padChars': 'pad', - 'padCharsEnd': 'padEnd', - 'padCharsStart': 'padStart', - 'propertyOf': 'get', - 'rangeStep': 'range', - 'rangeStepRight': 'rangeRight', - 'restFrom': 'rest', - 'spreadFrom': 'spread', - 'trimChars': 'trim', - 'trimCharsEnd': 'trimEnd', - 'trimCharsStart': 'trimStart', - 'zipAll': 'zip' -}; - -/** Used to track methods that skip fixing their arity. */ -exports.skipFixed = { - 'castArray': true, - 'flow': true, - 'flowRight': true, - 'iteratee': true, - 'mixin': true, - 'rearg': true, - 'runInContext': true -}; - -/** Used to track methods that skip rearranging arguments. */ -exports.skipRearg = { - 'add': true, - 'assign': true, - 'assignIn': true, - 'bind': true, - 'bindKey': true, - 'concat': true, - 'difference': true, - 'divide': true, - 'eq': true, - 'gt': true, - 'gte': true, - 'isEqual': true, - 'lt': true, - 'lte': true, - 'matchesProperty': true, - 'merge': true, - 'multiply': true, - 'overArgs': true, - 'partial': true, - 'partialRight': true, - 'propertyOf': true, - 'random': true, - 'range': true, - 'rangeRight': true, - 'subtract': true, - 'zip': true, - 'zipObject': true, - 'zipObjectDeep': true -}; diff --git a/node_modules/lodash/fp/_util.js b/node_modules/lodash/fp/_util.js deleted file mode 100644 index 1dbf36f5..00000000 --- a/node_modules/lodash/fp/_util.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - 'ary': require('../ary'), - 'assign': require('../_baseAssign'), - 'clone': require('../clone'), - 'curry': require('../curry'), - 'forEach': require('../_arrayEach'), - 'isArray': require('../isArray'), - 'isError': require('../isError'), - 'isFunction': require('../isFunction'), - 'isWeakMap': require('../isWeakMap'), - 'iteratee': require('../iteratee'), - 'keys': require('../_baseKeys'), - 'rearg': require('../rearg'), - 'toInteger': require('../toInteger'), - 'toPath': require('../toPath') -}; diff --git a/node_modules/lodash/fp/add.js b/node_modules/lodash/fp/add.js deleted file mode 100644 index 816eeece..00000000 --- a/node_modules/lodash/fp/add.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('add', require('../add')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/after.js b/node_modules/lodash/fp/after.js deleted file mode 100644 index 21a0167a..00000000 --- a/node_modules/lodash/fp/after.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('after', require('../after')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/all.js b/node_modules/lodash/fp/all.js deleted file mode 100644 index d0839f77..00000000 --- a/node_modules/lodash/fp/all.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./every'); diff --git a/node_modules/lodash/fp/allPass.js b/node_modules/lodash/fp/allPass.js deleted file mode 100644 index 79b73ef8..00000000 --- a/node_modules/lodash/fp/allPass.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./overEvery'); diff --git a/node_modules/lodash/fp/always.js b/node_modules/lodash/fp/always.js deleted file mode 100644 index 98877030..00000000 --- a/node_modules/lodash/fp/always.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./constant'); diff --git a/node_modules/lodash/fp/any.js b/node_modules/lodash/fp/any.js deleted file mode 100644 index 900ac25e..00000000 --- a/node_modules/lodash/fp/any.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./some'); diff --git a/node_modules/lodash/fp/anyPass.js b/node_modules/lodash/fp/anyPass.js deleted file mode 100644 index 2774ab37..00000000 --- a/node_modules/lodash/fp/anyPass.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./overSome'); diff --git a/node_modules/lodash/fp/apply.js b/node_modules/lodash/fp/apply.js deleted file mode 100644 index 2b757129..00000000 --- a/node_modules/lodash/fp/apply.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./spread'); diff --git a/node_modules/lodash/fp/array.js b/node_modules/lodash/fp/array.js deleted file mode 100644 index fe939c2c..00000000 --- a/node_modules/lodash/fp/array.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../array')); diff --git a/node_modules/lodash/fp/ary.js b/node_modules/lodash/fp/ary.js deleted file mode 100644 index 8edf1877..00000000 --- a/node_modules/lodash/fp/ary.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('ary', require('../ary')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assign.js b/node_modules/lodash/fp/assign.js deleted file mode 100644 index 23f47af1..00000000 --- a/node_modules/lodash/fp/assign.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assign', require('../assign')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assignAll.js b/node_modules/lodash/fp/assignAll.js deleted file mode 100644 index b1d36c7e..00000000 --- a/node_modules/lodash/fp/assignAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assignAll', require('../assign')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assignAllWith.js b/node_modules/lodash/fp/assignAllWith.js deleted file mode 100644 index 21e836e6..00000000 --- a/node_modules/lodash/fp/assignAllWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assignAllWith', require('../assignWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assignIn.js b/node_modules/lodash/fp/assignIn.js deleted file mode 100644 index 6e7c65fa..00000000 --- a/node_modules/lodash/fp/assignIn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assignIn', require('../assignIn')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assignInAll.js b/node_modules/lodash/fp/assignInAll.js deleted file mode 100644 index 7ba75dba..00000000 --- a/node_modules/lodash/fp/assignInAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assignInAll', require('../assignIn')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assignInAllWith.js b/node_modules/lodash/fp/assignInAllWith.js deleted file mode 100644 index e766903d..00000000 --- a/node_modules/lodash/fp/assignInAllWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assignInAllWith', require('../assignInWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assignInWith.js b/node_modules/lodash/fp/assignInWith.js deleted file mode 100644 index acb59236..00000000 --- a/node_modules/lodash/fp/assignInWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assignInWith', require('../assignInWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assignWith.js b/node_modules/lodash/fp/assignWith.js deleted file mode 100644 index eb925212..00000000 --- a/node_modules/lodash/fp/assignWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('assignWith', require('../assignWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/assoc.js b/node_modules/lodash/fp/assoc.js deleted file mode 100644 index 7648820c..00000000 --- a/node_modules/lodash/fp/assoc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./set'); diff --git a/node_modules/lodash/fp/assocPath.js b/node_modules/lodash/fp/assocPath.js deleted file mode 100644 index 7648820c..00000000 --- a/node_modules/lodash/fp/assocPath.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./set'); diff --git a/node_modules/lodash/fp/at.js b/node_modules/lodash/fp/at.js deleted file mode 100644 index cc39d257..00000000 --- a/node_modules/lodash/fp/at.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('at', require('../at')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/attempt.js b/node_modules/lodash/fp/attempt.js deleted file mode 100644 index 26ca42ea..00000000 --- a/node_modules/lodash/fp/attempt.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('attempt', require('../attempt')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/before.js b/node_modules/lodash/fp/before.js deleted file mode 100644 index 7a2de65d..00000000 --- a/node_modules/lodash/fp/before.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('before', require('../before')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/bind.js b/node_modules/lodash/fp/bind.js deleted file mode 100644 index 5cbe4f30..00000000 --- a/node_modules/lodash/fp/bind.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('bind', require('../bind')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/bindAll.js b/node_modules/lodash/fp/bindAll.js deleted file mode 100644 index 6b4a4a0f..00000000 --- a/node_modules/lodash/fp/bindAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('bindAll', require('../bindAll')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/bindKey.js b/node_modules/lodash/fp/bindKey.js deleted file mode 100644 index 6a46c6b1..00000000 --- a/node_modules/lodash/fp/bindKey.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('bindKey', require('../bindKey')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/camelCase.js b/node_modules/lodash/fp/camelCase.js deleted file mode 100644 index 87b77b49..00000000 --- a/node_modules/lodash/fp/camelCase.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('camelCase', require('../camelCase'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/capitalize.js b/node_modules/lodash/fp/capitalize.js deleted file mode 100644 index cac74e14..00000000 --- a/node_modules/lodash/fp/capitalize.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('capitalize', require('../capitalize'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/castArray.js b/node_modules/lodash/fp/castArray.js deleted file mode 100644 index 8681c099..00000000 --- a/node_modules/lodash/fp/castArray.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('castArray', require('../castArray')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/ceil.js b/node_modules/lodash/fp/ceil.js deleted file mode 100644 index f416b729..00000000 --- a/node_modules/lodash/fp/ceil.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('ceil', require('../ceil')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/chain.js b/node_modules/lodash/fp/chain.js deleted file mode 100644 index 604fe398..00000000 --- a/node_modules/lodash/fp/chain.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('chain', require('../chain'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/chunk.js b/node_modules/lodash/fp/chunk.js deleted file mode 100644 index 871ab085..00000000 --- a/node_modules/lodash/fp/chunk.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('chunk', require('../chunk')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/clamp.js b/node_modules/lodash/fp/clamp.js deleted file mode 100644 index 3b06c01c..00000000 --- a/node_modules/lodash/fp/clamp.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('clamp', require('../clamp')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/clone.js b/node_modules/lodash/fp/clone.js deleted file mode 100644 index cadb59c9..00000000 --- a/node_modules/lodash/fp/clone.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('clone', require('../clone'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/cloneDeep.js b/node_modules/lodash/fp/cloneDeep.js deleted file mode 100644 index a6107aac..00000000 --- a/node_modules/lodash/fp/cloneDeep.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('cloneDeep', require('../cloneDeep'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/cloneDeepWith.js b/node_modules/lodash/fp/cloneDeepWith.js deleted file mode 100644 index 6f01e44a..00000000 --- a/node_modules/lodash/fp/cloneDeepWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('cloneDeepWith', require('../cloneDeepWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/cloneWith.js b/node_modules/lodash/fp/cloneWith.js deleted file mode 100644 index aa885781..00000000 --- a/node_modules/lodash/fp/cloneWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('cloneWith', require('../cloneWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/collection.js b/node_modules/lodash/fp/collection.js deleted file mode 100644 index fc8b328a..00000000 --- a/node_modules/lodash/fp/collection.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../collection')); diff --git a/node_modules/lodash/fp/commit.js b/node_modules/lodash/fp/commit.js deleted file mode 100644 index 130a894f..00000000 --- a/node_modules/lodash/fp/commit.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('commit', require('../commit'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/compact.js b/node_modules/lodash/fp/compact.js deleted file mode 100644 index ce8f7a1a..00000000 --- a/node_modules/lodash/fp/compact.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('compact', require('../compact'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/complement.js b/node_modules/lodash/fp/complement.js deleted file mode 100644 index 93eb462b..00000000 --- a/node_modules/lodash/fp/complement.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./negate'); diff --git a/node_modules/lodash/fp/compose.js b/node_modules/lodash/fp/compose.js deleted file mode 100644 index 1954e942..00000000 --- a/node_modules/lodash/fp/compose.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./flowRight'); diff --git a/node_modules/lodash/fp/concat.js b/node_modules/lodash/fp/concat.js deleted file mode 100644 index e59346ad..00000000 --- a/node_modules/lodash/fp/concat.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('concat', require('../concat')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/cond.js b/node_modules/lodash/fp/cond.js deleted file mode 100644 index 6a0120ef..00000000 --- a/node_modules/lodash/fp/cond.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('cond', require('../cond'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/conforms.js b/node_modules/lodash/fp/conforms.js deleted file mode 100644 index 3247f64a..00000000 --- a/node_modules/lodash/fp/conforms.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./conformsTo'); diff --git a/node_modules/lodash/fp/conformsTo.js b/node_modules/lodash/fp/conformsTo.js deleted file mode 100644 index aa7f41ec..00000000 --- a/node_modules/lodash/fp/conformsTo.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('conformsTo', require('../conformsTo')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/constant.js b/node_modules/lodash/fp/constant.js deleted file mode 100644 index 9e406fc0..00000000 --- a/node_modules/lodash/fp/constant.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('constant', require('../constant'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/contains.js b/node_modules/lodash/fp/contains.js deleted file mode 100644 index 594722af..00000000 --- a/node_modules/lodash/fp/contains.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./includes'); diff --git a/node_modules/lodash/fp/convert.js b/node_modules/lodash/fp/convert.js deleted file mode 100644 index 4795dc42..00000000 --- a/node_modules/lodash/fp/convert.js +++ /dev/null @@ -1,18 +0,0 @@ -var baseConvert = require('./_baseConvert'), - util = require('./_util'); - -/** - * Converts `func` of `name` to an immutable auto-curried iteratee-first data-last - * version with conversion `options` applied. If `name` is an object its methods - * will be converted. - * - * @param {string} name The name of the function to wrap. - * @param {Function} [func] The function to wrap. - * @param {Object} [options] The options object. See `baseConvert` for more details. - * @returns {Function|Object} Returns the converted function or object. - */ -function convert(name, func, options) { - return baseConvert(util, name, func, options); -} - -module.exports = convert; diff --git a/node_modules/lodash/fp/countBy.js b/node_modules/lodash/fp/countBy.js deleted file mode 100644 index dfa46432..00000000 --- a/node_modules/lodash/fp/countBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('countBy', require('../countBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/create.js b/node_modules/lodash/fp/create.js deleted file mode 100644 index 752025fb..00000000 --- a/node_modules/lodash/fp/create.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('create', require('../create')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/curry.js b/node_modules/lodash/fp/curry.js deleted file mode 100644 index b0b4168c..00000000 --- a/node_modules/lodash/fp/curry.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('curry', require('../curry')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/curryN.js b/node_modules/lodash/fp/curryN.js deleted file mode 100644 index 2ae7d00a..00000000 --- a/node_modules/lodash/fp/curryN.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('curryN', require('../curry')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/curryRight.js b/node_modules/lodash/fp/curryRight.js deleted file mode 100644 index cb619eb5..00000000 --- a/node_modules/lodash/fp/curryRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('curryRight', require('../curryRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/curryRightN.js b/node_modules/lodash/fp/curryRightN.js deleted file mode 100644 index 2495afc8..00000000 --- a/node_modules/lodash/fp/curryRightN.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('curryRightN', require('../curryRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/date.js b/node_modules/lodash/fp/date.js deleted file mode 100644 index 82cb952b..00000000 --- a/node_modules/lodash/fp/date.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../date')); diff --git a/node_modules/lodash/fp/debounce.js b/node_modules/lodash/fp/debounce.js deleted file mode 100644 index 26122293..00000000 --- a/node_modules/lodash/fp/debounce.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('debounce', require('../debounce')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/deburr.js b/node_modules/lodash/fp/deburr.js deleted file mode 100644 index 96463ab8..00000000 --- a/node_modules/lodash/fp/deburr.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('deburr', require('../deburr'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/defaultTo.js b/node_modules/lodash/fp/defaultTo.js deleted file mode 100644 index d6b52a44..00000000 --- a/node_modules/lodash/fp/defaultTo.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('defaultTo', require('../defaultTo')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/defaults.js b/node_modules/lodash/fp/defaults.js deleted file mode 100644 index e1a8e6e7..00000000 --- a/node_modules/lodash/fp/defaults.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('defaults', require('../defaults')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/defaultsAll.js b/node_modules/lodash/fp/defaultsAll.js deleted file mode 100644 index 238fcc3c..00000000 --- a/node_modules/lodash/fp/defaultsAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('defaultsAll', require('../defaults')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/defaultsDeep.js b/node_modules/lodash/fp/defaultsDeep.js deleted file mode 100644 index 1f172ff9..00000000 --- a/node_modules/lodash/fp/defaultsDeep.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('defaultsDeep', require('../defaultsDeep')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/defaultsDeepAll.js b/node_modules/lodash/fp/defaultsDeepAll.js deleted file mode 100644 index 6835f2f0..00000000 --- a/node_modules/lodash/fp/defaultsDeepAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('defaultsDeepAll', require('../defaultsDeep')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/defer.js b/node_modules/lodash/fp/defer.js deleted file mode 100644 index ec7990fe..00000000 --- a/node_modules/lodash/fp/defer.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('defer', require('../defer'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/delay.js b/node_modules/lodash/fp/delay.js deleted file mode 100644 index 556dbd56..00000000 --- a/node_modules/lodash/fp/delay.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('delay', require('../delay')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/difference.js b/node_modules/lodash/fp/difference.js deleted file mode 100644 index 2d037654..00000000 --- a/node_modules/lodash/fp/difference.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('difference', require('../difference')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/differenceBy.js b/node_modules/lodash/fp/differenceBy.js deleted file mode 100644 index 2f914910..00000000 --- a/node_modules/lodash/fp/differenceBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('differenceBy', require('../differenceBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/differenceWith.js b/node_modules/lodash/fp/differenceWith.js deleted file mode 100644 index bcf5ad2e..00000000 --- a/node_modules/lodash/fp/differenceWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('differenceWith', require('../differenceWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/dissoc.js b/node_modules/lodash/fp/dissoc.js deleted file mode 100644 index 7ec7be19..00000000 --- a/node_modules/lodash/fp/dissoc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./unset'); diff --git a/node_modules/lodash/fp/dissocPath.js b/node_modules/lodash/fp/dissocPath.js deleted file mode 100644 index 7ec7be19..00000000 --- a/node_modules/lodash/fp/dissocPath.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./unset'); diff --git a/node_modules/lodash/fp/divide.js b/node_modules/lodash/fp/divide.js deleted file mode 100644 index 82048c5e..00000000 --- a/node_modules/lodash/fp/divide.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('divide', require('../divide')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/drop.js b/node_modules/lodash/fp/drop.js deleted file mode 100644 index 2fa9b4fa..00000000 --- a/node_modules/lodash/fp/drop.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('drop', require('../drop')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/dropLast.js b/node_modules/lodash/fp/dropLast.js deleted file mode 100644 index 174e5255..00000000 --- a/node_modules/lodash/fp/dropLast.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dropRight'); diff --git a/node_modules/lodash/fp/dropLastWhile.js b/node_modules/lodash/fp/dropLastWhile.js deleted file mode 100644 index be2a9d24..00000000 --- a/node_modules/lodash/fp/dropLastWhile.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dropRightWhile'); diff --git a/node_modules/lodash/fp/dropRight.js b/node_modules/lodash/fp/dropRight.js deleted file mode 100644 index e98881fc..00000000 --- a/node_modules/lodash/fp/dropRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('dropRight', require('../dropRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/dropRightWhile.js b/node_modules/lodash/fp/dropRightWhile.js deleted file mode 100644 index cacaa701..00000000 --- a/node_modules/lodash/fp/dropRightWhile.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('dropRightWhile', require('../dropRightWhile')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/dropWhile.js b/node_modules/lodash/fp/dropWhile.js deleted file mode 100644 index 285f864d..00000000 --- a/node_modules/lodash/fp/dropWhile.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('dropWhile', require('../dropWhile')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/each.js b/node_modules/lodash/fp/each.js deleted file mode 100644 index 8800f420..00000000 --- a/node_modules/lodash/fp/each.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./forEach'); diff --git a/node_modules/lodash/fp/eachRight.js b/node_modules/lodash/fp/eachRight.js deleted file mode 100644 index 3252b2ab..00000000 --- a/node_modules/lodash/fp/eachRight.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./forEachRight'); diff --git a/node_modules/lodash/fp/endsWith.js b/node_modules/lodash/fp/endsWith.js deleted file mode 100644 index 17dc2a49..00000000 --- a/node_modules/lodash/fp/endsWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('endsWith', require('../endsWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/entries.js b/node_modules/lodash/fp/entries.js deleted file mode 100644 index 7a88df20..00000000 --- a/node_modules/lodash/fp/entries.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./toPairs'); diff --git a/node_modules/lodash/fp/entriesIn.js b/node_modules/lodash/fp/entriesIn.js deleted file mode 100644 index f6c6331c..00000000 --- a/node_modules/lodash/fp/entriesIn.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./toPairsIn'); diff --git a/node_modules/lodash/fp/eq.js b/node_modules/lodash/fp/eq.js deleted file mode 100644 index 9a3d21bf..00000000 --- a/node_modules/lodash/fp/eq.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('eq', require('../eq')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/equals.js b/node_modules/lodash/fp/equals.js deleted file mode 100644 index e6a5ce0c..00000000 --- a/node_modules/lodash/fp/equals.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./isEqual'); diff --git a/node_modules/lodash/fp/escape.js b/node_modules/lodash/fp/escape.js deleted file mode 100644 index 52c1fbba..00000000 --- a/node_modules/lodash/fp/escape.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('escape', require('../escape'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/escapeRegExp.js b/node_modules/lodash/fp/escapeRegExp.js deleted file mode 100644 index 369b2eff..00000000 --- a/node_modules/lodash/fp/escapeRegExp.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('escapeRegExp', require('../escapeRegExp'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/every.js b/node_modules/lodash/fp/every.js deleted file mode 100644 index 95c2776c..00000000 --- a/node_modules/lodash/fp/every.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('every', require('../every')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/extend.js b/node_modules/lodash/fp/extend.js deleted file mode 100644 index e00166c2..00000000 --- a/node_modules/lodash/fp/extend.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./assignIn'); diff --git a/node_modules/lodash/fp/extendAll.js b/node_modules/lodash/fp/extendAll.js deleted file mode 100644 index cc55b64f..00000000 --- a/node_modules/lodash/fp/extendAll.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./assignInAll'); diff --git a/node_modules/lodash/fp/extendAllWith.js b/node_modules/lodash/fp/extendAllWith.js deleted file mode 100644 index 6679d208..00000000 --- a/node_modules/lodash/fp/extendAllWith.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./assignInAllWith'); diff --git a/node_modules/lodash/fp/extendWith.js b/node_modules/lodash/fp/extendWith.js deleted file mode 100644 index dbdcb3b4..00000000 --- a/node_modules/lodash/fp/extendWith.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./assignInWith'); diff --git a/node_modules/lodash/fp/fill.js b/node_modules/lodash/fp/fill.js deleted file mode 100644 index b2d47e84..00000000 --- a/node_modules/lodash/fp/fill.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('fill', require('../fill')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/filter.js b/node_modules/lodash/fp/filter.js deleted file mode 100644 index 796d501c..00000000 --- a/node_modules/lodash/fp/filter.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('filter', require('../filter')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/find.js b/node_modules/lodash/fp/find.js deleted file mode 100644 index f805d336..00000000 --- a/node_modules/lodash/fp/find.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('find', require('../find')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findFrom.js b/node_modules/lodash/fp/findFrom.js deleted file mode 100644 index da8275e8..00000000 --- a/node_modules/lodash/fp/findFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findFrom', require('../find')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findIndex.js b/node_modules/lodash/fp/findIndex.js deleted file mode 100644 index 8c15fd11..00000000 --- a/node_modules/lodash/fp/findIndex.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findIndex', require('../findIndex')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findIndexFrom.js b/node_modules/lodash/fp/findIndexFrom.js deleted file mode 100644 index 32e98cb9..00000000 --- a/node_modules/lodash/fp/findIndexFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findIndexFrom', require('../findIndex')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findKey.js b/node_modules/lodash/fp/findKey.js deleted file mode 100644 index 475bcfa8..00000000 --- a/node_modules/lodash/fp/findKey.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findKey', require('../findKey')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findLast.js b/node_modules/lodash/fp/findLast.js deleted file mode 100644 index 093fe94e..00000000 --- a/node_modules/lodash/fp/findLast.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findLast', require('../findLast')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findLastFrom.js b/node_modules/lodash/fp/findLastFrom.js deleted file mode 100644 index 76c38fba..00000000 --- a/node_modules/lodash/fp/findLastFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findLastFrom', require('../findLast')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findLastIndex.js b/node_modules/lodash/fp/findLastIndex.js deleted file mode 100644 index 36986df0..00000000 --- a/node_modules/lodash/fp/findLastIndex.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findLastIndex', require('../findLastIndex')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findLastIndexFrom.js b/node_modules/lodash/fp/findLastIndexFrom.js deleted file mode 100644 index 34c8176c..00000000 --- a/node_modules/lodash/fp/findLastIndexFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findLastIndexFrom', require('../findLastIndex')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/findLastKey.js b/node_modules/lodash/fp/findLastKey.js deleted file mode 100644 index 5f81b604..00000000 --- a/node_modules/lodash/fp/findLastKey.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('findLastKey', require('../findLastKey')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/first.js b/node_modules/lodash/fp/first.js deleted file mode 100644 index 53f4ad13..00000000 --- a/node_modules/lodash/fp/first.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./head'); diff --git a/node_modules/lodash/fp/flatMap.js b/node_modules/lodash/fp/flatMap.js deleted file mode 100644 index d01dc4d0..00000000 --- a/node_modules/lodash/fp/flatMap.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flatMap', require('../flatMap')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flatMapDeep.js b/node_modules/lodash/fp/flatMapDeep.js deleted file mode 100644 index 569c42eb..00000000 --- a/node_modules/lodash/fp/flatMapDeep.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flatMapDeep', require('../flatMapDeep')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flatMapDepth.js b/node_modules/lodash/fp/flatMapDepth.js deleted file mode 100644 index 6eb68fde..00000000 --- a/node_modules/lodash/fp/flatMapDepth.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flatMapDepth', require('../flatMapDepth')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flatten.js b/node_modules/lodash/fp/flatten.js deleted file mode 100644 index 30425d89..00000000 --- a/node_modules/lodash/fp/flatten.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flatten', require('../flatten'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flattenDeep.js b/node_modules/lodash/fp/flattenDeep.js deleted file mode 100644 index aed5db27..00000000 --- a/node_modules/lodash/fp/flattenDeep.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flattenDeep', require('../flattenDeep'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flattenDepth.js b/node_modules/lodash/fp/flattenDepth.js deleted file mode 100644 index ad65e378..00000000 --- a/node_modules/lodash/fp/flattenDepth.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flattenDepth', require('../flattenDepth')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flip.js b/node_modules/lodash/fp/flip.js deleted file mode 100644 index 0547e7b4..00000000 --- a/node_modules/lodash/fp/flip.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flip', require('../flip'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/floor.js b/node_modules/lodash/fp/floor.js deleted file mode 100644 index a6cf3358..00000000 --- a/node_modules/lodash/fp/floor.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('floor', require('../floor')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flow.js b/node_modules/lodash/fp/flow.js deleted file mode 100644 index cd83677a..00000000 --- a/node_modules/lodash/fp/flow.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flow', require('../flow')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/flowRight.js b/node_modules/lodash/fp/flowRight.js deleted file mode 100644 index 972a5b9b..00000000 --- a/node_modules/lodash/fp/flowRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('flowRight', require('../flowRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/forEach.js b/node_modules/lodash/fp/forEach.js deleted file mode 100644 index 2f494521..00000000 --- a/node_modules/lodash/fp/forEach.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('forEach', require('../forEach')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/forEachRight.js b/node_modules/lodash/fp/forEachRight.js deleted file mode 100644 index 3ff97336..00000000 --- a/node_modules/lodash/fp/forEachRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('forEachRight', require('../forEachRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/forIn.js b/node_modules/lodash/fp/forIn.js deleted file mode 100644 index 9341749b..00000000 --- a/node_modules/lodash/fp/forIn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('forIn', require('../forIn')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/forInRight.js b/node_modules/lodash/fp/forInRight.js deleted file mode 100644 index cecf8bbf..00000000 --- a/node_modules/lodash/fp/forInRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('forInRight', require('../forInRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/forOwn.js b/node_modules/lodash/fp/forOwn.js deleted file mode 100644 index 246449e9..00000000 --- a/node_modules/lodash/fp/forOwn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('forOwn', require('../forOwn')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/forOwnRight.js b/node_modules/lodash/fp/forOwnRight.js deleted file mode 100644 index c5e826e0..00000000 --- a/node_modules/lodash/fp/forOwnRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('forOwnRight', require('../forOwnRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/fromPairs.js b/node_modules/lodash/fp/fromPairs.js deleted file mode 100644 index f8cc5968..00000000 --- a/node_modules/lodash/fp/fromPairs.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('fromPairs', require('../fromPairs')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/function.js b/node_modules/lodash/fp/function.js deleted file mode 100644 index dfe69b1f..00000000 --- a/node_modules/lodash/fp/function.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../function')); diff --git a/node_modules/lodash/fp/functions.js b/node_modules/lodash/fp/functions.js deleted file mode 100644 index 09d1bb1b..00000000 --- a/node_modules/lodash/fp/functions.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('functions', require('../functions'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/functionsIn.js b/node_modules/lodash/fp/functionsIn.js deleted file mode 100644 index 2cfeb83e..00000000 --- a/node_modules/lodash/fp/functionsIn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('functionsIn', require('../functionsIn'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/get.js b/node_modules/lodash/fp/get.js deleted file mode 100644 index 6d3a3286..00000000 --- a/node_modules/lodash/fp/get.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('get', require('../get')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/getOr.js b/node_modules/lodash/fp/getOr.js deleted file mode 100644 index 7dbf771f..00000000 --- a/node_modules/lodash/fp/getOr.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('getOr', require('../get')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/groupBy.js b/node_modules/lodash/fp/groupBy.js deleted file mode 100644 index fc0bc78a..00000000 --- a/node_modules/lodash/fp/groupBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('groupBy', require('../groupBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/gt.js b/node_modules/lodash/fp/gt.js deleted file mode 100644 index 9e57c808..00000000 --- a/node_modules/lodash/fp/gt.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('gt', require('../gt')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/gte.js b/node_modules/lodash/fp/gte.js deleted file mode 100644 index 45847863..00000000 --- a/node_modules/lodash/fp/gte.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('gte', require('../gte')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/has.js b/node_modules/lodash/fp/has.js deleted file mode 100644 index b9012983..00000000 --- a/node_modules/lodash/fp/has.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('has', require('../has')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/hasIn.js b/node_modules/lodash/fp/hasIn.js deleted file mode 100644 index b3c3d1a3..00000000 --- a/node_modules/lodash/fp/hasIn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('hasIn', require('../hasIn')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/head.js b/node_modules/lodash/fp/head.js deleted file mode 100644 index 2694f0a2..00000000 --- a/node_modules/lodash/fp/head.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('head', require('../head'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/identical.js b/node_modules/lodash/fp/identical.js deleted file mode 100644 index 85563f4a..00000000 --- a/node_modules/lodash/fp/identical.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./eq'); diff --git a/node_modules/lodash/fp/identity.js b/node_modules/lodash/fp/identity.js deleted file mode 100644 index 096415a5..00000000 --- a/node_modules/lodash/fp/identity.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('identity', require('../identity'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/inRange.js b/node_modules/lodash/fp/inRange.js deleted file mode 100644 index 202d940b..00000000 --- a/node_modules/lodash/fp/inRange.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('inRange', require('../inRange')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/includes.js b/node_modules/lodash/fp/includes.js deleted file mode 100644 index 11467805..00000000 --- a/node_modules/lodash/fp/includes.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('includes', require('../includes')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/includesFrom.js b/node_modules/lodash/fp/includesFrom.js deleted file mode 100644 index 683afdb4..00000000 --- a/node_modules/lodash/fp/includesFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('includesFrom', require('../includes')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/indexBy.js b/node_modules/lodash/fp/indexBy.js deleted file mode 100644 index 7e64bc0f..00000000 --- a/node_modules/lodash/fp/indexBy.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./keyBy'); diff --git a/node_modules/lodash/fp/indexOf.js b/node_modules/lodash/fp/indexOf.js deleted file mode 100644 index 524658eb..00000000 --- a/node_modules/lodash/fp/indexOf.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('indexOf', require('../indexOf')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/indexOfFrom.js b/node_modules/lodash/fp/indexOfFrom.js deleted file mode 100644 index d99c822f..00000000 --- a/node_modules/lodash/fp/indexOfFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('indexOfFrom', require('../indexOf')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/init.js b/node_modules/lodash/fp/init.js deleted file mode 100644 index 2f88d8b0..00000000 --- a/node_modules/lodash/fp/init.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./initial'); diff --git a/node_modules/lodash/fp/initial.js b/node_modules/lodash/fp/initial.js deleted file mode 100644 index b732ba0b..00000000 --- a/node_modules/lodash/fp/initial.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('initial', require('../initial'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/intersection.js b/node_modules/lodash/fp/intersection.js deleted file mode 100644 index 52936d56..00000000 --- a/node_modules/lodash/fp/intersection.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('intersection', require('../intersection')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/intersectionBy.js b/node_modules/lodash/fp/intersectionBy.js deleted file mode 100644 index 72629f27..00000000 --- a/node_modules/lodash/fp/intersectionBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('intersectionBy', require('../intersectionBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/intersectionWith.js b/node_modules/lodash/fp/intersectionWith.js deleted file mode 100644 index e064f400..00000000 --- a/node_modules/lodash/fp/intersectionWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('intersectionWith', require('../intersectionWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/invert.js b/node_modules/lodash/fp/invert.js deleted file mode 100644 index 2d5d1f0d..00000000 --- a/node_modules/lodash/fp/invert.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('invert', require('../invert')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/invertBy.js b/node_modules/lodash/fp/invertBy.js deleted file mode 100644 index 63ca97ec..00000000 --- a/node_modules/lodash/fp/invertBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('invertBy', require('../invertBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/invertObj.js b/node_modules/lodash/fp/invertObj.js deleted file mode 100644 index f1d842e4..00000000 --- a/node_modules/lodash/fp/invertObj.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./invert'); diff --git a/node_modules/lodash/fp/invoke.js b/node_modules/lodash/fp/invoke.js deleted file mode 100644 index fcf17f0d..00000000 --- a/node_modules/lodash/fp/invoke.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('invoke', require('../invoke')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/invokeArgs.js b/node_modules/lodash/fp/invokeArgs.js deleted file mode 100644 index d3f2953f..00000000 --- a/node_modules/lodash/fp/invokeArgs.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('invokeArgs', require('../invoke')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/invokeArgsMap.js b/node_modules/lodash/fp/invokeArgsMap.js deleted file mode 100644 index eaa9f84f..00000000 --- a/node_modules/lodash/fp/invokeArgsMap.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('invokeArgsMap', require('../invokeMap')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/invokeMap.js b/node_modules/lodash/fp/invokeMap.js deleted file mode 100644 index 6515fd73..00000000 --- a/node_modules/lodash/fp/invokeMap.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('invokeMap', require('../invokeMap')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isArguments.js b/node_modules/lodash/fp/isArguments.js deleted file mode 100644 index 1d93c9e5..00000000 --- a/node_modules/lodash/fp/isArguments.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isArguments', require('../isArguments'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isArray.js b/node_modules/lodash/fp/isArray.js deleted file mode 100644 index ba7ade8d..00000000 --- a/node_modules/lodash/fp/isArray.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isArray', require('../isArray'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isArrayBuffer.js b/node_modules/lodash/fp/isArrayBuffer.js deleted file mode 100644 index 5088513f..00000000 --- a/node_modules/lodash/fp/isArrayBuffer.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isArrayBuffer', require('../isArrayBuffer'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isArrayLike.js b/node_modules/lodash/fp/isArrayLike.js deleted file mode 100644 index 8f1856bf..00000000 --- a/node_modules/lodash/fp/isArrayLike.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isArrayLike', require('../isArrayLike'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isArrayLikeObject.js b/node_modules/lodash/fp/isArrayLikeObject.js deleted file mode 100644 index 21084984..00000000 --- a/node_modules/lodash/fp/isArrayLikeObject.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isArrayLikeObject', require('../isArrayLikeObject'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isBoolean.js b/node_modules/lodash/fp/isBoolean.js deleted file mode 100644 index 9339f75b..00000000 --- a/node_modules/lodash/fp/isBoolean.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isBoolean', require('../isBoolean'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isBuffer.js b/node_modules/lodash/fp/isBuffer.js deleted file mode 100644 index e60b1238..00000000 --- a/node_modules/lodash/fp/isBuffer.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isBuffer', require('../isBuffer'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isDate.js b/node_modules/lodash/fp/isDate.js deleted file mode 100644 index dc41d089..00000000 --- a/node_modules/lodash/fp/isDate.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isDate', require('../isDate'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isElement.js b/node_modules/lodash/fp/isElement.js deleted file mode 100644 index 18ee039a..00000000 --- a/node_modules/lodash/fp/isElement.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isElement', require('../isElement'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isEmpty.js b/node_modules/lodash/fp/isEmpty.js deleted file mode 100644 index 0f4ae841..00000000 --- a/node_modules/lodash/fp/isEmpty.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isEmpty', require('../isEmpty'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isEqual.js b/node_modules/lodash/fp/isEqual.js deleted file mode 100644 index 41383865..00000000 --- a/node_modules/lodash/fp/isEqual.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isEqual', require('../isEqual')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isEqualWith.js b/node_modules/lodash/fp/isEqualWith.js deleted file mode 100644 index 029ff5cd..00000000 --- a/node_modules/lodash/fp/isEqualWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isEqualWith', require('../isEqualWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isError.js b/node_modules/lodash/fp/isError.js deleted file mode 100644 index 3dfd81cc..00000000 --- a/node_modules/lodash/fp/isError.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isError', require('../isError'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isFinite.js b/node_modules/lodash/fp/isFinite.js deleted file mode 100644 index 0b647b84..00000000 --- a/node_modules/lodash/fp/isFinite.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isFinite', require('../isFinite'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isFunction.js b/node_modules/lodash/fp/isFunction.js deleted file mode 100644 index ff8e5c45..00000000 --- a/node_modules/lodash/fp/isFunction.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isFunction', require('../isFunction'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isInteger.js b/node_modules/lodash/fp/isInteger.js deleted file mode 100644 index 67af4ff6..00000000 --- a/node_modules/lodash/fp/isInteger.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isInteger', require('../isInteger'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isLength.js b/node_modules/lodash/fp/isLength.js deleted file mode 100644 index fc101c5a..00000000 --- a/node_modules/lodash/fp/isLength.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isLength', require('../isLength'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isMap.js b/node_modules/lodash/fp/isMap.js deleted file mode 100644 index a209aa66..00000000 --- a/node_modules/lodash/fp/isMap.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isMap', require('../isMap'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isMatch.js b/node_modules/lodash/fp/isMatch.js deleted file mode 100644 index 6264ca17..00000000 --- a/node_modules/lodash/fp/isMatch.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isMatch', require('../isMatch')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isMatchWith.js b/node_modules/lodash/fp/isMatchWith.js deleted file mode 100644 index d95f3193..00000000 --- a/node_modules/lodash/fp/isMatchWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isMatchWith', require('../isMatchWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isNaN.js b/node_modules/lodash/fp/isNaN.js deleted file mode 100644 index 66a978f1..00000000 --- a/node_modules/lodash/fp/isNaN.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isNaN', require('../isNaN'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isNative.js b/node_modules/lodash/fp/isNative.js deleted file mode 100644 index 3d775ba9..00000000 --- a/node_modules/lodash/fp/isNative.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isNative', require('../isNative'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isNil.js b/node_modules/lodash/fp/isNil.js deleted file mode 100644 index 5952c028..00000000 --- a/node_modules/lodash/fp/isNil.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isNil', require('../isNil'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isNull.js b/node_modules/lodash/fp/isNull.js deleted file mode 100644 index f201a354..00000000 --- a/node_modules/lodash/fp/isNull.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isNull', require('../isNull'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isNumber.js b/node_modules/lodash/fp/isNumber.js deleted file mode 100644 index a2b5fa04..00000000 --- a/node_modules/lodash/fp/isNumber.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isNumber', require('../isNumber'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isObject.js b/node_modules/lodash/fp/isObject.js deleted file mode 100644 index 231ace03..00000000 --- a/node_modules/lodash/fp/isObject.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isObject', require('../isObject'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isObjectLike.js b/node_modules/lodash/fp/isObjectLike.js deleted file mode 100644 index f16082e6..00000000 --- a/node_modules/lodash/fp/isObjectLike.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isObjectLike', require('../isObjectLike'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isPlainObject.js b/node_modules/lodash/fp/isPlainObject.js deleted file mode 100644 index b5bea90d..00000000 --- a/node_modules/lodash/fp/isPlainObject.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isPlainObject', require('../isPlainObject'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isRegExp.js b/node_modules/lodash/fp/isRegExp.js deleted file mode 100644 index 12a1a3d7..00000000 --- a/node_modules/lodash/fp/isRegExp.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isRegExp', require('../isRegExp'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isSafeInteger.js b/node_modules/lodash/fp/isSafeInteger.js deleted file mode 100644 index 7230f552..00000000 --- a/node_modules/lodash/fp/isSafeInteger.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isSafeInteger', require('../isSafeInteger'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isSet.js b/node_modules/lodash/fp/isSet.js deleted file mode 100644 index 35c01f6f..00000000 --- a/node_modules/lodash/fp/isSet.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isSet', require('../isSet'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isString.js b/node_modules/lodash/fp/isString.js deleted file mode 100644 index 1fd0679e..00000000 --- a/node_modules/lodash/fp/isString.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isString', require('../isString'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isSymbol.js b/node_modules/lodash/fp/isSymbol.js deleted file mode 100644 index 38676956..00000000 --- a/node_modules/lodash/fp/isSymbol.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isSymbol', require('../isSymbol'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isTypedArray.js b/node_modules/lodash/fp/isTypedArray.js deleted file mode 100644 index 85679538..00000000 --- a/node_modules/lodash/fp/isTypedArray.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isTypedArray', require('../isTypedArray'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isUndefined.js b/node_modules/lodash/fp/isUndefined.js deleted file mode 100644 index ddbca31c..00000000 --- a/node_modules/lodash/fp/isUndefined.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isUndefined', require('../isUndefined'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isWeakMap.js b/node_modules/lodash/fp/isWeakMap.js deleted file mode 100644 index ef60c613..00000000 --- a/node_modules/lodash/fp/isWeakMap.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isWeakMap', require('../isWeakMap'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/isWeakSet.js b/node_modules/lodash/fp/isWeakSet.js deleted file mode 100644 index c99bfaa6..00000000 --- a/node_modules/lodash/fp/isWeakSet.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('isWeakSet', require('../isWeakSet'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/iteratee.js b/node_modules/lodash/fp/iteratee.js deleted file mode 100644 index 9f0f7173..00000000 --- a/node_modules/lodash/fp/iteratee.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('iteratee', require('../iteratee')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/join.js b/node_modules/lodash/fp/join.js deleted file mode 100644 index a220e003..00000000 --- a/node_modules/lodash/fp/join.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('join', require('../join')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/juxt.js b/node_modules/lodash/fp/juxt.js deleted file mode 100644 index f71e04e0..00000000 --- a/node_modules/lodash/fp/juxt.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./over'); diff --git a/node_modules/lodash/fp/kebabCase.js b/node_modules/lodash/fp/kebabCase.js deleted file mode 100644 index 60737f17..00000000 --- a/node_modules/lodash/fp/kebabCase.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('kebabCase', require('../kebabCase'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/keyBy.js b/node_modules/lodash/fp/keyBy.js deleted file mode 100644 index 9a6a85d4..00000000 --- a/node_modules/lodash/fp/keyBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('keyBy', require('../keyBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/keys.js b/node_modules/lodash/fp/keys.js deleted file mode 100644 index e12bb07f..00000000 --- a/node_modules/lodash/fp/keys.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('keys', require('../keys'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/keysIn.js b/node_modules/lodash/fp/keysIn.js deleted file mode 100644 index f3eb36a8..00000000 --- a/node_modules/lodash/fp/keysIn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('keysIn', require('../keysIn'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/lang.js b/node_modules/lodash/fp/lang.js deleted file mode 100644 index 08cc9c14..00000000 --- a/node_modules/lodash/fp/lang.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../lang')); diff --git a/node_modules/lodash/fp/last.js b/node_modules/lodash/fp/last.js deleted file mode 100644 index 0f716993..00000000 --- a/node_modules/lodash/fp/last.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('last', require('../last'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/lastIndexOf.js b/node_modules/lodash/fp/lastIndexOf.js deleted file mode 100644 index ddf39c30..00000000 --- a/node_modules/lodash/fp/lastIndexOf.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('lastIndexOf', require('../lastIndexOf')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/lastIndexOfFrom.js b/node_modules/lodash/fp/lastIndexOfFrom.js deleted file mode 100644 index 1ff6a0b5..00000000 --- a/node_modules/lodash/fp/lastIndexOfFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('lastIndexOfFrom', require('../lastIndexOf')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/lowerCase.js b/node_modules/lodash/fp/lowerCase.js deleted file mode 100644 index ea64bc15..00000000 --- a/node_modules/lodash/fp/lowerCase.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('lowerCase', require('../lowerCase'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/lowerFirst.js b/node_modules/lodash/fp/lowerFirst.js deleted file mode 100644 index 539720a3..00000000 --- a/node_modules/lodash/fp/lowerFirst.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('lowerFirst', require('../lowerFirst'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/lt.js b/node_modules/lodash/fp/lt.js deleted file mode 100644 index a31d21ec..00000000 --- a/node_modules/lodash/fp/lt.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('lt', require('../lt')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/lte.js b/node_modules/lodash/fp/lte.js deleted file mode 100644 index d795d10e..00000000 --- a/node_modules/lodash/fp/lte.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('lte', require('../lte')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/map.js b/node_modules/lodash/fp/map.js deleted file mode 100644 index cf987943..00000000 --- a/node_modules/lodash/fp/map.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('map', require('../map')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/mapKeys.js b/node_modules/lodash/fp/mapKeys.js deleted file mode 100644 index 16845870..00000000 --- a/node_modules/lodash/fp/mapKeys.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('mapKeys', require('../mapKeys')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/mapValues.js b/node_modules/lodash/fp/mapValues.js deleted file mode 100644 index 40049727..00000000 --- a/node_modules/lodash/fp/mapValues.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('mapValues', require('../mapValues')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/matches.js b/node_modules/lodash/fp/matches.js deleted file mode 100644 index 29d1e1e4..00000000 --- a/node_modules/lodash/fp/matches.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./isMatch'); diff --git a/node_modules/lodash/fp/matchesProperty.js b/node_modules/lodash/fp/matchesProperty.js deleted file mode 100644 index 4575bd24..00000000 --- a/node_modules/lodash/fp/matchesProperty.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('matchesProperty', require('../matchesProperty')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/math.js b/node_modules/lodash/fp/math.js deleted file mode 100644 index e8f50f79..00000000 --- a/node_modules/lodash/fp/math.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../math')); diff --git a/node_modules/lodash/fp/max.js b/node_modules/lodash/fp/max.js deleted file mode 100644 index a66acac2..00000000 --- a/node_modules/lodash/fp/max.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('max', require('../max'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/maxBy.js b/node_modules/lodash/fp/maxBy.js deleted file mode 100644 index d083fd64..00000000 --- a/node_modules/lodash/fp/maxBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('maxBy', require('../maxBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/mean.js b/node_modules/lodash/fp/mean.js deleted file mode 100644 index 31172460..00000000 --- a/node_modules/lodash/fp/mean.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('mean', require('../mean'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/meanBy.js b/node_modules/lodash/fp/meanBy.js deleted file mode 100644 index 556f25ed..00000000 --- a/node_modules/lodash/fp/meanBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('meanBy', require('../meanBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/memoize.js b/node_modules/lodash/fp/memoize.js deleted file mode 100644 index 638eec63..00000000 --- a/node_modules/lodash/fp/memoize.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('memoize', require('../memoize')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/merge.js b/node_modules/lodash/fp/merge.js deleted file mode 100644 index ac66adde..00000000 --- a/node_modules/lodash/fp/merge.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('merge', require('../merge')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/mergeAll.js b/node_modules/lodash/fp/mergeAll.js deleted file mode 100644 index a3674d67..00000000 --- a/node_modules/lodash/fp/mergeAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('mergeAll', require('../merge')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/mergeAllWith.js b/node_modules/lodash/fp/mergeAllWith.js deleted file mode 100644 index 4bd4206d..00000000 --- a/node_modules/lodash/fp/mergeAllWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('mergeAllWith', require('../mergeWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/mergeWith.js b/node_modules/lodash/fp/mergeWith.js deleted file mode 100644 index 00d44d5e..00000000 --- a/node_modules/lodash/fp/mergeWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('mergeWith', require('../mergeWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/method.js b/node_modules/lodash/fp/method.js deleted file mode 100644 index f4060c68..00000000 --- a/node_modules/lodash/fp/method.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('method', require('../method')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/methodOf.js b/node_modules/lodash/fp/methodOf.js deleted file mode 100644 index 61399056..00000000 --- a/node_modules/lodash/fp/methodOf.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('methodOf', require('../methodOf')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/min.js b/node_modules/lodash/fp/min.js deleted file mode 100644 index d12c6b40..00000000 --- a/node_modules/lodash/fp/min.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('min', require('../min'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/minBy.js b/node_modules/lodash/fp/minBy.js deleted file mode 100644 index fdb9e24d..00000000 --- a/node_modules/lodash/fp/minBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('minBy', require('../minBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/mixin.js b/node_modules/lodash/fp/mixin.js deleted file mode 100644 index 332e6fbf..00000000 --- a/node_modules/lodash/fp/mixin.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('mixin', require('../mixin')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/multiply.js b/node_modules/lodash/fp/multiply.js deleted file mode 100644 index 4dcf0b0d..00000000 --- a/node_modules/lodash/fp/multiply.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('multiply', require('../multiply')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/nAry.js b/node_modules/lodash/fp/nAry.js deleted file mode 100644 index f262a76c..00000000 --- a/node_modules/lodash/fp/nAry.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./ary'); diff --git a/node_modules/lodash/fp/negate.js b/node_modules/lodash/fp/negate.js deleted file mode 100644 index 8b6dc7c5..00000000 --- a/node_modules/lodash/fp/negate.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('negate', require('../negate'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/next.js b/node_modules/lodash/fp/next.js deleted file mode 100644 index 140155e2..00000000 --- a/node_modules/lodash/fp/next.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('next', require('../next'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/noop.js b/node_modules/lodash/fp/noop.js deleted file mode 100644 index b9e32cc8..00000000 --- a/node_modules/lodash/fp/noop.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('noop', require('../noop'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/now.js b/node_modules/lodash/fp/now.js deleted file mode 100644 index 6de2068a..00000000 --- a/node_modules/lodash/fp/now.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('now', require('../now'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/nth.js b/node_modules/lodash/fp/nth.js deleted file mode 100644 index da4fda74..00000000 --- a/node_modules/lodash/fp/nth.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('nth', require('../nth')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/nthArg.js b/node_modules/lodash/fp/nthArg.js deleted file mode 100644 index fce31659..00000000 --- a/node_modules/lodash/fp/nthArg.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('nthArg', require('../nthArg')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/number.js b/node_modules/lodash/fp/number.js deleted file mode 100644 index 5c10b884..00000000 --- a/node_modules/lodash/fp/number.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../number')); diff --git a/node_modules/lodash/fp/object.js b/node_modules/lodash/fp/object.js deleted file mode 100644 index ae39a134..00000000 --- a/node_modules/lodash/fp/object.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../object')); diff --git a/node_modules/lodash/fp/omit.js b/node_modules/lodash/fp/omit.js deleted file mode 100644 index fd685291..00000000 --- a/node_modules/lodash/fp/omit.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('omit', require('../omit')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/omitAll.js b/node_modules/lodash/fp/omitAll.js deleted file mode 100644 index 144cf4b9..00000000 --- a/node_modules/lodash/fp/omitAll.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./omit'); diff --git a/node_modules/lodash/fp/omitBy.js b/node_modules/lodash/fp/omitBy.js deleted file mode 100644 index 90df7380..00000000 --- a/node_modules/lodash/fp/omitBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('omitBy', require('../omitBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/once.js b/node_modules/lodash/fp/once.js deleted file mode 100644 index f8f0a5c7..00000000 --- a/node_modules/lodash/fp/once.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('once', require('../once'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/orderBy.js b/node_modules/lodash/fp/orderBy.js deleted file mode 100644 index 848e2107..00000000 --- a/node_modules/lodash/fp/orderBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('orderBy', require('../orderBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/over.js b/node_modules/lodash/fp/over.js deleted file mode 100644 index 01eba7b9..00000000 --- a/node_modules/lodash/fp/over.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('over', require('../over')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/overArgs.js b/node_modules/lodash/fp/overArgs.js deleted file mode 100644 index 738556f0..00000000 --- a/node_modules/lodash/fp/overArgs.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('overArgs', require('../overArgs')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/overEvery.js b/node_modules/lodash/fp/overEvery.js deleted file mode 100644 index 9f5a032d..00000000 --- a/node_modules/lodash/fp/overEvery.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('overEvery', require('../overEvery')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/overSome.js b/node_modules/lodash/fp/overSome.js deleted file mode 100644 index 15939d58..00000000 --- a/node_modules/lodash/fp/overSome.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('overSome', require('../overSome')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pad.js b/node_modules/lodash/fp/pad.js deleted file mode 100644 index f1dea4a9..00000000 --- a/node_modules/lodash/fp/pad.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pad', require('../pad')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/padChars.js b/node_modules/lodash/fp/padChars.js deleted file mode 100644 index d6e0804c..00000000 --- a/node_modules/lodash/fp/padChars.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('padChars', require('../pad')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/padCharsEnd.js b/node_modules/lodash/fp/padCharsEnd.js deleted file mode 100644 index d4ab79ad..00000000 --- a/node_modules/lodash/fp/padCharsEnd.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('padCharsEnd', require('../padEnd')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/padCharsStart.js b/node_modules/lodash/fp/padCharsStart.js deleted file mode 100644 index a08a3000..00000000 --- a/node_modules/lodash/fp/padCharsStart.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('padCharsStart', require('../padStart')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/padEnd.js b/node_modules/lodash/fp/padEnd.js deleted file mode 100644 index a8522ec3..00000000 --- a/node_modules/lodash/fp/padEnd.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('padEnd', require('../padEnd')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/padStart.js b/node_modules/lodash/fp/padStart.js deleted file mode 100644 index f4ca79d4..00000000 --- a/node_modules/lodash/fp/padStart.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('padStart', require('../padStart')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/parseInt.js b/node_modules/lodash/fp/parseInt.js deleted file mode 100644 index 27314ccb..00000000 --- a/node_modules/lodash/fp/parseInt.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('parseInt', require('../parseInt')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/partial.js b/node_modules/lodash/fp/partial.js deleted file mode 100644 index 5d460159..00000000 --- a/node_modules/lodash/fp/partial.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('partial', require('../partial')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/partialRight.js b/node_modules/lodash/fp/partialRight.js deleted file mode 100644 index 7f05fed0..00000000 --- a/node_modules/lodash/fp/partialRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('partialRight', require('../partialRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/partition.js b/node_modules/lodash/fp/partition.js deleted file mode 100644 index 2ebcacc1..00000000 --- a/node_modules/lodash/fp/partition.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('partition', require('../partition')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/path.js b/node_modules/lodash/fp/path.js deleted file mode 100644 index b29cfb21..00000000 --- a/node_modules/lodash/fp/path.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./get'); diff --git a/node_modules/lodash/fp/pathEq.js b/node_modules/lodash/fp/pathEq.js deleted file mode 100644 index 36c027a3..00000000 --- a/node_modules/lodash/fp/pathEq.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./matchesProperty'); diff --git a/node_modules/lodash/fp/pathOr.js b/node_modules/lodash/fp/pathOr.js deleted file mode 100644 index 4ab58209..00000000 --- a/node_modules/lodash/fp/pathOr.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./getOr'); diff --git a/node_modules/lodash/fp/paths.js b/node_modules/lodash/fp/paths.js deleted file mode 100644 index 1eb7950a..00000000 --- a/node_modules/lodash/fp/paths.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./at'); diff --git a/node_modules/lodash/fp/pick.js b/node_modules/lodash/fp/pick.js deleted file mode 100644 index 197393de..00000000 --- a/node_modules/lodash/fp/pick.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pick', require('../pick')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pickAll.js b/node_modules/lodash/fp/pickAll.js deleted file mode 100644 index a8ecd461..00000000 --- a/node_modules/lodash/fp/pickAll.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./pick'); diff --git a/node_modules/lodash/fp/pickBy.js b/node_modules/lodash/fp/pickBy.js deleted file mode 100644 index d832d16b..00000000 --- a/node_modules/lodash/fp/pickBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pickBy', require('../pickBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pipe.js b/node_modules/lodash/fp/pipe.js deleted file mode 100644 index b2e1e2cc..00000000 --- a/node_modules/lodash/fp/pipe.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./flow'); diff --git a/node_modules/lodash/fp/placeholder.js b/node_modules/lodash/fp/placeholder.js deleted file mode 100644 index 1ce17393..00000000 --- a/node_modules/lodash/fp/placeholder.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * The default argument placeholder value for methods. - * - * @type {Object} - */ -module.exports = {}; diff --git a/node_modules/lodash/fp/plant.js b/node_modules/lodash/fp/plant.js deleted file mode 100644 index eca8f32b..00000000 --- a/node_modules/lodash/fp/plant.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('plant', require('../plant'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pluck.js b/node_modules/lodash/fp/pluck.js deleted file mode 100644 index 0d1e1abf..00000000 --- a/node_modules/lodash/fp/pluck.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./map'); diff --git a/node_modules/lodash/fp/prop.js b/node_modules/lodash/fp/prop.js deleted file mode 100644 index b29cfb21..00000000 --- a/node_modules/lodash/fp/prop.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./get'); diff --git a/node_modules/lodash/fp/propEq.js b/node_modules/lodash/fp/propEq.js deleted file mode 100644 index 36c027a3..00000000 --- a/node_modules/lodash/fp/propEq.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./matchesProperty'); diff --git a/node_modules/lodash/fp/propOr.js b/node_modules/lodash/fp/propOr.js deleted file mode 100644 index 4ab58209..00000000 --- a/node_modules/lodash/fp/propOr.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./getOr'); diff --git a/node_modules/lodash/fp/property.js b/node_modules/lodash/fp/property.js deleted file mode 100644 index b29cfb21..00000000 --- a/node_modules/lodash/fp/property.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./get'); diff --git a/node_modules/lodash/fp/propertyOf.js b/node_modules/lodash/fp/propertyOf.js deleted file mode 100644 index f6273ee4..00000000 --- a/node_modules/lodash/fp/propertyOf.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('propertyOf', require('../get')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/props.js b/node_modules/lodash/fp/props.js deleted file mode 100644 index 1eb7950a..00000000 --- a/node_modules/lodash/fp/props.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./at'); diff --git a/node_modules/lodash/fp/pull.js b/node_modules/lodash/fp/pull.js deleted file mode 100644 index 8d7084f0..00000000 --- a/node_modules/lodash/fp/pull.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pull', require('../pull')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pullAll.js b/node_modules/lodash/fp/pullAll.js deleted file mode 100644 index 98d5c9a7..00000000 --- a/node_modules/lodash/fp/pullAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pullAll', require('../pullAll')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pullAllBy.js b/node_modules/lodash/fp/pullAllBy.js deleted file mode 100644 index 876bc3bf..00000000 --- a/node_modules/lodash/fp/pullAllBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pullAllBy', require('../pullAllBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pullAllWith.js b/node_modules/lodash/fp/pullAllWith.js deleted file mode 100644 index f71ba4d7..00000000 --- a/node_modules/lodash/fp/pullAllWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pullAllWith', require('../pullAllWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/pullAt.js b/node_modules/lodash/fp/pullAt.js deleted file mode 100644 index e8b3bb61..00000000 --- a/node_modules/lodash/fp/pullAt.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('pullAt', require('../pullAt')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/random.js b/node_modules/lodash/fp/random.js deleted file mode 100644 index 99d852e4..00000000 --- a/node_modules/lodash/fp/random.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('random', require('../random')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/range.js b/node_modules/lodash/fp/range.js deleted file mode 100644 index a6bb5911..00000000 --- a/node_modules/lodash/fp/range.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('range', require('../range')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/rangeRight.js b/node_modules/lodash/fp/rangeRight.js deleted file mode 100644 index fdb712f9..00000000 --- a/node_modules/lodash/fp/rangeRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('rangeRight', require('../rangeRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/rangeStep.js b/node_modules/lodash/fp/rangeStep.js deleted file mode 100644 index d72dfc20..00000000 --- a/node_modules/lodash/fp/rangeStep.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('rangeStep', require('../range')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/rangeStepRight.js b/node_modules/lodash/fp/rangeStepRight.js deleted file mode 100644 index 8b2a67bc..00000000 --- a/node_modules/lodash/fp/rangeStepRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('rangeStepRight', require('../rangeRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/rearg.js b/node_modules/lodash/fp/rearg.js deleted file mode 100644 index 678e02a3..00000000 --- a/node_modules/lodash/fp/rearg.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('rearg', require('../rearg')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/reduce.js b/node_modules/lodash/fp/reduce.js deleted file mode 100644 index 4cef0a00..00000000 --- a/node_modules/lodash/fp/reduce.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('reduce', require('../reduce')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/reduceRight.js b/node_modules/lodash/fp/reduceRight.js deleted file mode 100644 index caf5bb51..00000000 --- a/node_modules/lodash/fp/reduceRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('reduceRight', require('../reduceRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/reject.js b/node_modules/lodash/fp/reject.js deleted file mode 100644 index c1632738..00000000 --- a/node_modules/lodash/fp/reject.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('reject', require('../reject')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/remove.js b/node_modules/lodash/fp/remove.js deleted file mode 100644 index e9d13273..00000000 --- a/node_modules/lodash/fp/remove.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('remove', require('../remove')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/repeat.js b/node_modules/lodash/fp/repeat.js deleted file mode 100644 index 08470f24..00000000 --- a/node_modules/lodash/fp/repeat.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('repeat', require('../repeat')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/replace.js b/node_modules/lodash/fp/replace.js deleted file mode 100644 index 2227db62..00000000 --- a/node_modules/lodash/fp/replace.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('replace', require('../replace')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/rest.js b/node_modules/lodash/fp/rest.js deleted file mode 100644 index c1f3d64b..00000000 --- a/node_modules/lodash/fp/rest.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('rest', require('../rest')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/restFrom.js b/node_modules/lodash/fp/restFrom.js deleted file mode 100644 index 714e42b5..00000000 --- a/node_modules/lodash/fp/restFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('restFrom', require('../rest')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/result.js b/node_modules/lodash/fp/result.js deleted file mode 100644 index f86ce071..00000000 --- a/node_modules/lodash/fp/result.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('result', require('../result')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/reverse.js b/node_modules/lodash/fp/reverse.js deleted file mode 100644 index 07c9f5e4..00000000 --- a/node_modules/lodash/fp/reverse.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('reverse', require('../reverse')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/round.js b/node_modules/lodash/fp/round.js deleted file mode 100644 index 4c0e5c82..00000000 --- a/node_modules/lodash/fp/round.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('round', require('../round')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sample.js b/node_modules/lodash/fp/sample.js deleted file mode 100644 index 6bea1254..00000000 --- a/node_modules/lodash/fp/sample.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sample', require('../sample'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sampleSize.js b/node_modules/lodash/fp/sampleSize.js deleted file mode 100644 index 359ed6fc..00000000 --- a/node_modules/lodash/fp/sampleSize.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sampleSize', require('../sampleSize')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/seq.js b/node_modules/lodash/fp/seq.js deleted file mode 100644 index d8f42b0a..00000000 --- a/node_modules/lodash/fp/seq.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../seq')); diff --git a/node_modules/lodash/fp/set.js b/node_modules/lodash/fp/set.js deleted file mode 100644 index 0b56a56c..00000000 --- a/node_modules/lodash/fp/set.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('set', require('../set')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/setWith.js b/node_modules/lodash/fp/setWith.js deleted file mode 100644 index 0b584952..00000000 --- a/node_modules/lodash/fp/setWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('setWith', require('../setWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/shuffle.js b/node_modules/lodash/fp/shuffle.js deleted file mode 100644 index aa3a1ca5..00000000 --- a/node_modules/lodash/fp/shuffle.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('shuffle', require('../shuffle'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/size.js b/node_modules/lodash/fp/size.js deleted file mode 100644 index 7490136e..00000000 --- a/node_modules/lodash/fp/size.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('size', require('../size'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/slice.js b/node_modules/lodash/fp/slice.js deleted file mode 100644 index 15945d32..00000000 --- a/node_modules/lodash/fp/slice.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('slice', require('../slice')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/snakeCase.js b/node_modules/lodash/fp/snakeCase.js deleted file mode 100644 index a0ff7808..00000000 --- a/node_modules/lodash/fp/snakeCase.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('snakeCase', require('../snakeCase'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/some.js b/node_modules/lodash/fp/some.js deleted file mode 100644 index a4fa2d00..00000000 --- a/node_modules/lodash/fp/some.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('some', require('../some')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortBy.js b/node_modules/lodash/fp/sortBy.js deleted file mode 100644 index e0790ad5..00000000 --- a/node_modules/lodash/fp/sortBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortBy', require('../sortBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedIndex.js b/node_modules/lodash/fp/sortedIndex.js deleted file mode 100644 index 364a0543..00000000 --- a/node_modules/lodash/fp/sortedIndex.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedIndex', require('../sortedIndex')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedIndexBy.js b/node_modules/lodash/fp/sortedIndexBy.js deleted file mode 100644 index 9593dbd1..00000000 --- a/node_modules/lodash/fp/sortedIndexBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedIndexBy', require('../sortedIndexBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedIndexOf.js b/node_modules/lodash/fp/sortedIndexOf.js deleted file mode 100644 index c9084cab..00000000 --- a/node_modules/lodash/fp/sortedIndexOf.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedIndexOf', require('../sortedIndexOf')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedLastIndex.js b/node_modules/lodash/fp/sortedLastIndex.js deleted file mode 100644 index 47fe241a..00000000 --- a/node_modules/lodash/fp/sortedLastIndex.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedLastIndex', require('../sortedLastIndex')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedLastIndexBy.js b/node_modules/lodash/fp/sortedLastIndexBy.js deleted file mode 100644 index 0f9a3473..00000000 --- a/node_modules/lodash/fp/sortedLastIndexBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedLastIndexBy', require('../sortedLastIndexBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedLastIndexOf.js b/node_modules/lodash/fp/sortedLastIndexOf.js deleted file mode 100644 index 0d4d9327..00000000 --- a/node_modules/lodash/fp/sortedLastIndexOf.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedLastIndexOf', require('../sortedLastIndexOf')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedUniq.js b/node_modules/lodash/fp/sortedUniq.js deleted file mode 100644 index 882d2837..00000000 --- a/node_modules/lodash/fp/sortedUniq.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedUniq', require('../sortedUniq'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sortedUniqBy.js b/node_modules/lodash/fp/sortedUniqBy.js deleted file mode 100644 index 033db91c..00000000 --- a/node_modules/lodash/fp/sortedUniqBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sortedUniqBy', require('../sortedUniqBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/split.js b/node_modules/lodash/fp/split.js deleted file mode 100644 index 14de1a7e..00000000 --- a/node_modules/lodash/fp/split.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('split', require('../split')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/spread.js b/node_modules/lodash/fp/spread.js deleted file mode 100644 index 2d11b707..00000000 --- a/node_modules/lodash/fp/spread.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('spread', require('../spread')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/spreadFrom.js b/node_modules/lodash/fp/spreadFrom.js deleted file mode 100644 index 0b630df1..00000000 --- a/node_modules/lodash/fp/spreadFrom.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('spreadFrom', require('../spread')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/startCase.js b/node_modules/lodash/fp/startCase.js deleted file mode 100644 index ada98c94..00000000 --- a/node_modules/lodash/fp/startCase.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('startCase', require('../startCase'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/startsWith.js b/node_modules/lodash/fp/startsWith.js deleted file mode 100644 index 985e2f29..00000000 --- a/node_modules/lodash/fp/startsWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('startsWith', require('../startsWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/string.js b/node_modules/lodash/fp/string.js deleted file mode 100644 index 773b0370..00000000 --- a/node_modules/lodash/fp/string.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../string')); diff --git a/node_modules/lodash/fp/stubArray.js b/node_modules/lodash/fp/stubArray.js deleted file mode 100644 index cd604cb4..00000000 --- a/node_modules/lodash/fp/stubArray.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('stubArray', require('../stubArray'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/stubFalse.js b/node_modules/lodash/fp/stubFalse.js deleted file mode 100644 index 32966645..00000000 --- a/node_modules/lodash/fp/stubFalse.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('stubFalse', require('../stubFalse'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/stubObject.js b/node_modules/lodash/fp/stubObject.js deleted file mode 100644 index c6c8ec47..00000000 --- a/node_modules/lodash/fp/stubObject.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('stubObject', require('../stubObject'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/stubString.js b/node_modules/lodash/fp/stubString.js deleted file mode 100644 index 701051e8..00000000 --- a/node_modules/lodash/fp/stubString.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('stubString', require('../stubString'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/stubTrue.js b/node_modules/lodash/fp/stubTrue.js deleted file mode 100644 index 9249082c..00000000 --- a/node_modules/lodash/fp/stubTrue.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('stubTrue', require('../stubTrue'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/subtract.js b/node_modules/lodash/fp/subtract.js deleted file mode 100644 index d32b16d4..00000000 --- a/node_modules/lodash/fp/subtract.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('subtract', require('../subtract')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sum.js b/node_modules/lodash/fp/sum.js deleted file mode 100644 index 5cce12b3..00000000 --- a/node_modules/lodash/fp/sum.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sum', require('../sum'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/sumBy.js b/node_modules/lodash/fp/sumBy.js deleted file mode 100644 index c8826565..00000000 --- a/node_modules/lodash/fp/sumBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('sumBy', require('../sumBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/symmetricDifference.js b/node_modules/lodash/fp/symmetricDifference.js deleted file mode 100644 index 78c16add..00000000 --- a/node_modules/lodash/fp/symmetricDifference.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./xor'); diff --git a/node_modules/lodash/fp/symmetricDifferenceBy.js b/node_modules/lodash/fp/symmetricDifferenceBy.js deleted file mode 100644 index 298fc7ff..00000000 --- a/node_modules/lodash/fp/symmetricDifferenceBy.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./xorBy'); diff --git a/node_modules/lodash/fp/symmetricDifferenceWith.js b/node_modules/lodash/fp/symmetricDifferenceWith.js deleted file mode 100644 index 70bc6faf..00000000 --- a/node_modules/lodash/fp/symmetricDifferenceWith.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./xorWith'); diff --git a/node_modules/lodash/fp/tail.js b/node_modules/lodash/fp/tail.js deleted file mode 100644 index f122f0ac..00000000 --- a/node_modules/lodash/fp/tail.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('tail', require('../tail'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/take.js b/node_modules/lodash/fp/take.js deleted file mode 100644 index 9af98a7b..00000000 --- a/node_modules/lodash/fp/take.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('take', require('../take')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/takeLast.js b/node_modules/lodash/fp/takeLast.js deleted file mode 100644 index e98c84a1..00000000 --- a/node_modules/lodash/fp/takeLast.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./takeRight'); diff --git a/node_modules/lodash/fp/takeLastWhile.js b/node_modules/lodash/fp/takeLastWhile.js deleted file mode 100644 index 5367968a..00000000 --- a/node_modules/lodash/fp/takeLastWhile.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./takeRightWhile'); diff --git a/node_modules/lodash/fp/takeRight.js b/node_modules/lodash/fp/takeRight.js deleted file mode 100644 index b82950a6..00000000 --- a/node_modules/lodash/fp/takeRight.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('takeRight', require('../takeRight')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/takeRightWhile.js b/node_modules/lodash/fp/takeRightWhile.js deleted file mode 100644 index 8ffb0a28..00000000 --- a/node_modules/lodash/fp/takeRightWhile.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('takeRightWhile', require('../takeRightWhile')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/takeWhile.js b/node_modules/lodash/fp/takeWhile.js deleted file mode 100644 index 28136644..00000000 --- a/node_modules/lodash/fp/takeWhile.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('takeWhile', require('../takeWhile')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/tap.js b/node_modules/lodash/fp/tap.js deleted file mode 100644 index d33ad6ec..00000000 --- a/node_modules/lodash/fp/tap.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('tap', require('../tap')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/template.js b/node_modules/lodash/fp/template.js deleted file mode 100644 index 74857e1c..00000000 --- a/node_modules/lodash/fp/template.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('template', require('../template')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/templateSettings.js b/node_modules/lodash/fp/templateSettings.js deleted file mode 100644 index 7bcc0a82..00000000 --- a/node_modules/lodash/fp/templateSettings.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('templateSettings', require('../templateSettings'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/throttle.js b/node_modules/lodash/fp/throttle.js deleted file mode 100644 index 77fff142..00000000 --- a/node_modules/lodash/fp/throttle.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('throttle', require('../throttle')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/thru.js b/node_modules/lodash/fp/thru.js deleted file mode 100644 index d42b3b1d..00000000 --- a/node_modules/lodash/fp/thru.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('thru', require('../thru')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/times.js b/node_modules/lodash/fp/times.js deleted file mode 100644 index 0dab06da..00000000 --- a/node_modules/lodash/fp/times.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('times', require('../times')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toArray.js b/node_modules/lodash/fp/toArray.js deleted file mode 100644 index f0c360ac..00000000 --- a/node_modules/lodash/fp/toArray.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toArray', require('../toArray'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toFinite.js b/node_modules/lodash/fp/toFinite.js deleted file mode 100644 index 3a47687d..00000000 --- a/node_modules/lodash/fp/toFinite.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toFinite', require('../toFinite'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toInteger.js b/node_modules/lodash/fp/toInteger.js deleted file mode 100644 index e0af6a75..00000000 --- a/node_modules/lodash/fp/toInteger.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toInteger', require('../toInteger'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toIterator.js b/node_modules/lodash/fp/toIterator.js deleted file mode 100644 index 65e6baa9..00000000 --- a/node_modules/lodash/fp/toIterator.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toIterator', require('../toIterator'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toJSON.js b/node_modules/lodash/fp/toJSON.js deleted file mode 100644 index 2d718d0b..00000000 --- a/node_modules/lodash/fp/toJSON.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toJSON', require('../toJSON'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toLength.js b/node_modules/lodash/fp/toLength.js deleted file mode 100644 index b97cdd93..00000000 --- a/node_modules/lodash/fp/toLength.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toLength', require('../toLength'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toLower.js b/node_modules/lodash/fp/toLower.js deleted file mode 100644 index 616ef36a..00000000 --- a/node_modules/lodash/fp/toLower.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toLower', require('../toLower'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toNumber.js b/node_modules/lodash/fp/toNumber.js deleted file mode 100644 index d0c6f4d3..00000000 --- a/node_modules/lodash/fp/toNumber.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toNumber', require('../toNumber'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toPairs.js b/node_modules/lodash/fp/toPairs.js deleted file mode 100644 index af783786..00000000 --- a/node_modules/lodash/fp/toPairs.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toPairs', require('../toPairs'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toPairsIn.js b/node_modules/lodash/fp/toPairsIn.js deleted file mode 100644 index 66504abf..00000000 --- a/node_modules/lodash/fp/toPairsIn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toPairsIn', require('../toPairsIn'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toPath.js b/node_modules/lodash/fp/toPath.js deleted file mode 100644 index b4d5e50f..00000000 --- a/node_modules/lodash/fp/toPath.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toPath', require('../toPath'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toPlainObject.js b/node_modules/lodash/fp/toPlainObject.js deleted file mode 100644 index 278bb863..00000000 --- a/node_modules/lodash/fp/toPlainObject.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toPlainObject', require('../toPlainObject'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toSafeInteger.js b/node_modules/lodash/fp/toSafeInteger.js deleted file mode 100644 index 367a26fd..00000000 --- a/node_modules/lodash/fp/toSafeInteger.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toSafeInteger', require('../toSafeInteger'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toString.js b/node_modules/lodash/fp/toString.js deleted file mode 100644 index cec4f8e2..00000000 --- a/node_modules/lodash/fp/toString.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toString', require('../toString'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/toUpper.js b/node_modules/lodash/fp/toUpper.js deleted file mode 100644 index 54f9a560..00000000 --- a/node_modules/lodash/fp/toUpper.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('toUpper', require('../toUpper'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/transform.js b/node_modules/lodash/fp/transform.js deleted file mode 100644 index 759d088f..00000000 --- a/node_modules/lodash/fp/transform.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('transform', require('../transform')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/trim.js b/node_modules/lodash/fp/trim.js deleted file mode 100644 index e6319a74..00000000 --- a/node_modules/lodash/fp/trim.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('trim', require('../trim')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/trimChars.js b/node_modules/lodash/fp/trimChars.js deleted file mode 100644 index c9294de4..00000000 --- a/node_modules/lodash/fp/trimChars.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('trimChars', require('../trim')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/trimCharsEnd.js b/node_modules/lodash/fp/trimCharsEnd.js deleted file mode 100644 index 284bc2f8..00000000 --- a/node_modules/lodash/fp/trimCharsEnd.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('trimCharsEnd', require('../trimEnd')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/trimCharsStart.js b/node_modules/lodash/fp/trimCharsStart.js deleted file mode 100644 index ff0ee65d..00000000 --- a/node_modules/lodash/fp/trimCharsStart.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('trimCharsStart', require('../trimStart')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/trimEnd.js b/node_modules/lodash/fp/trimEnd.js deleted file mode 100644 index 71908805..00000000 --- a/node_modules/lodash/fp/trimEnd.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('trimEnd', require('../trimEnd')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/trimStart.js b/node_modules/lodash/fp/trimStart.js deleted file mode 100644 index fda902c3..00000000 --- a/node_modules/lodash/fp/trimStart.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('trimStart', require('../trimStart')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/truncate.js b/node_modules/lodash/fp/truncate.js deleted file mode 100644 index d265c1de..00000000 --- a/node_modules/lodash/fp/truncate.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('truncate', require('../truncate')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/unapply.js b/node_modules/lodash/fp/unapply.js deleted file mode 100644 index c5dfe779..00000000 --- a/node_modules/lodash/fp/unapply.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./rest'); diff --git a/node_modules/lodash/fp/unary.js b/node_modules/lodash/fp/unary.js deleted file mode 100644 index 286c945f..00000000 --- a/node_modules/lodash/fp/unary.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('unary', require('../unary'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/unescape.js b/node_modules/lodash/fp/unescape.js deleted file mode 100644 index fddcb46e..00000000 --- a/node_modules/lodash/fp/unescape.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('unescape', require('../unescape'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/union.js b/node_modules/lodash/fp/union.js deleted file mode 100644 index ef8228d7..00000000 --- a/node_modules/lodash/fp/union.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('union', require('../union')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/unionBy.js b/node_modules/lodash/fp/unionBy.js deleted file mode 100644 index 603687a1..00000000 --- a/node_modules/lodash/fp/unionBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('unionBy', require('../unionBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/unionWith.js b/node_modules/lodash/fp/unionWith.js deleted file mode 100644 index 65bb3a79..00000000 --- a/node_modules/lodash/fp/unionWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('unionWith', require('../unionWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/uniq.js b/node_modules/lodash/fp/uniq.js deleted file mode 100644 index bc185249..00000000 --- a/node_modules/lodash/fp/uniq.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('uniq', require('../uniq'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/uniqBy.js b/node_modules/lodash/fp/uniqBy.js deleted file mode 100644 index 634c6a8b..00000000 --- a/node_modules/lodash/fp/uniqBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('uniqBy', require('../uniqBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/uniqWith.js b/node_modules/lodash/fp/uniqWith.js deleted file mode 100644 index 0ec601a9..00000000 --- a/node_modules/lodash/fp/uniqWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('uniqWith', require('../uniqWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/uniqueId.js b/node_modules/lodash/fp/uniqueId.js deleted file mode 100644 index aa8fc2f7..00000000 --- a/node_modules/lodash/fp/uniqueId.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('uniqueId', require('../uniqueId')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/unnest.js b/node_modules/lodash/fp/unnest.js deleted file mode 100644 index 5d34060a..00000000 --- a/node_modules/lodash/fp/unnest.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./flatten'); diff --git a/node_modules/lodash/fp/unset.js b/node_modules/lodash/fp/unset.js deleted file mode 100644 index ea203a0f..00000000 --- a/node_modules/lodash/fp/unset.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('unset', require('../unset')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/unzip.js b/node_modules/lodash/fp/unzip.js deleted file mode 100644 index cc364b3c..00000000 --- a/node_modules/lodash/fp/unzip.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('unzip', require('../unzip'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/unzipWith.js b/node_modules/lodash/fp/unzipWith.js deleted file mode 100644 index 182eaa10..00000000 --- a/node_modules/lodash/fp/unzipWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('unzipWith', require('../unzipWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/update.js b/node_modules/lodash/fp/update.js deleted file mode 100644 index b8ce2cc9..00000000 --- a/node_modules/lodash/fp/update.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('update', require('../update')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/updateWith.js b/node_modules/lodash/fp/updateWith.js deleted file mode 100644 index d5e8282d..00000000 --- a/node_modules/lodash/fp/updateWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('updateWith', require('../updateWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/upperCase.js b/node_modules/lodash/fp/upperCase.js deleted file mode 100644 index c886f202..00000000 --- a/node_modules/lodash/fp/upperCase.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('upperCase', require('../upperCase'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/upperFirst.js b/node_modules/lodash/fp/upperFirst.js deleted file mode 100644 index d8c04df5..00000000 --- a/node_modules/lodash/fp/upperFirst.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('upperFirst', require('../upperFirst'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/useWith.js b/node_modules/lodash/fp/useWith.js deleted file mode 100644 index d8b3df5a..00000000 --- a/node_modules/lodash/fp/useWith.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./overArgs'); diff --git a/node_modules/lodash/fp/util.js b/node_modules/lodash/fp/util.js deleted file mode 100644 index 18c00bae..00000000 --- a/node_modules/lodash/fp/util.js +++ /dev/null @@ -1,2 +0,0 @@ -var convert = require('./convert'); -module.exports = convert(require('../util')); diff --git a/node_modules/lodash/fp/value.js b/node_modules/lodash/fp/value.js deleted file mode 100644 index 555eec7a..00000000 --- a/node_modules/lodash/fp/value.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('value', require('../value'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/valueOf.js b/node_modules/lodash/fp/valueOf.js deleted file mode 100644 index f968807d..00000000 --- a/node_modules/lodash/fp/valueOf.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('valueOf', require('../valueOf'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/values.js b/node_modules/lodash/fp/values.js deleted file mode 100644 index 2dfc5613..00000000 --- a/node_modules/lodash/fp/values.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('values', require('../values'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/valuesIn.js b/node_modules/lodash/fp/valuesIn.js deleted file mode 100644 index a1b2bb87..00000000 --- a/node_modules/lodash/fp/valuesIn.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('valuesIn', require('../valuesIn'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/where.js b/node_modules/lodash/fp/where.js deleted file mode 100644 index 3247f64a..00000000 --- a/node_modules/lodash/fp/where.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./conformsTo'); diff --git a/node_modules/lodash/fp/whereEq.js b/node_modules/lodash/fp/whereEq.js deleted file mode 100644 index 29d1e1e4..00000000 --- a/node_modules/lodash/fp/whereEq.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./isMatch'); diff --git a/node_modules/lodash/fp/without.js b/node_modules/lodash/fp/without.js deleted file mode 100644 index bad9e125..00000000 --- a/node_modules/lodash/fp/without.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('without', require('../without')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/words.js b/node_modules/lodash/fp/words.js deleted file mode 100644 index 4a901414..00000000 --- a/node_modules/lodash/fp/words.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('words', require('../words')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/wrap.js b/node_modules/lodash/fp/wrap.js deleted file mode 100644 index e93bd8a1..00000000 --- a/node_modules/lodash/fp/wrap.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('wrap', require('../wrap')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/wrapperAt.js b/node_modules/lodash/fp/wrapperAt.js deleted file mode 100644 index 8f0a310f..00000000 --- a/node_modules/lodash/fp/wrapperAt.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('wrapperAt', require('../wrapperAt'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/wrapperChain.js b/node_modules/lodash/fp/wrapperChain.js deleted file mode 100644 index 2a48ea2b..00000000 --- a/node_modules/lodash/fp/wrapperChain.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('wrapperChain', require('../wrapperChain'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/wrapperLodash.js b/node_modules/lodash/fp/wrapperLodash.js deleted file mode 100644 index a7162d08..00000000 --- a/node_modules/lodash/fp/wrapperLodash.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('wrapperLodash', require('../wrapperLodash'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/wrapperReverse.js b/node_modules/lodash/fp/wrapperReverse.js deleted file mode 100644 index e1481aab..00000000 --- a/node_modules/lodash/fp/wrapperReverse.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('wrapperReverse', require('../wrapperReverse'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/wrapperValue.js b/node_modules/lodash/fp/wrapperValue.js deleted file mode 100644 index 8eb9112f..00000000 --- a/node_modules/lodash/fp/wrapperValue.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('wrapperValue', require('../wrapperValue'), require('./_falseOptions')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/xor.js b/node_modules/lodash/fp/xor.js deleted file mode 100644 index 29e28194..00000000 --- a/node_modules/lodash/fp/xor.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('xor', require('../xor')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/xorBy.js b/node_modules/lodash/fp/xorBy.js deleted file mode 100644 index b355686d..00000000 --- a/node_modules/lodash/fp/xorBy.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('xorBy', require('../xorBy')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/xorWith.js b/node_modules/lodash/fp/xorWith.js deleted file mode 100644 index 8e05739a..00000000 --- a/node_modules/lodash/fp/xorWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('xorWith', require('../xorWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/zip.js b/node_modules/lodash/fp/zip.js deleted file mode 100644 index 69e147a4..00000000 --- a/node_modules/lodash/fp/zip.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('zip', require('../zip')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/zipAll.js b/node_modules/lodash/fp/zipAll.js deleted file mode 100644 index efa8ccbf..00000000 --- a/node_modules/lodash/fp/zipAll.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('zipAll', require('../zip')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/zipObj.js b/node_modules/lodash/fp/zipObj.js deleted file mode 100644 index f4a34531..00000000 --- a/node_modules/lodash/fp/zipObj.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./zipObject'); diff --git a/node_modules/lodash/fp/zipObject.js b/node_modules/lodash/fp/zipObject.js deleted file mode 100644 index 462dbb68..00000000 --- a/node_modules/lodash/fp/zipObject.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('zipObject', require('../zipObject')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/zipObjectDeep.js b/node_modules/lodash/fp/zipObjectDeep.js deleted file mode 100644 index 53a5d338..00000000 --- a/node_modules/lodash/fp/zipObjectDeep.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('zipObjectDeep', require('../zipObjectDeep')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fp/zipWith.js b/node_modules/lodash/fp/zipWith.js deleted file mode 100644 index c5cf9e21..00000000 --- a/node_modules/lodash/fp/zipWith.js +++ /dev/null @@ -1,5 +0,0 @@ -var convert = require('./convert'), - func = convert('zipWith', require('../zipWith')); - -func.placeholder = require('./placeholder'); -module.exports = func; diff --git a/node_modules/lodash/fromPairs.js b/node_modules/lodash/fromPairs.js deleted file mode 100644 index ee7940d2..00000000 --- a/node_modules/lodash/fromPairs.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * The inverse of `_.toPairs`; this method returns an object composed - * from key-value `pairs`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} pairs The key-value pairs. - * @returns {Object} Returns the new object. - * @example - * - * _.fromPairs([['a', 1], ['b', 2]]); - * // => { 'a': 1, 'b': 2 } - */ -function fromPairs(pairs) { - var index = -1, - length = pairs == null ? 0 : pairs.length, - result = {}; - - while (++index < length) { - var pair = pairs[index]; - result[pair[0]] = pair[1]; - } - return result; -} - -module.exports = fromPairs; diff --git a/node_modules/lodash/function.js b/node_modules/lodash/function.js deleted file mode 100644 index b0fc6d93..00000000 --- a/node_modules/lodash/function.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - 'after': require('./after'), - 'ary': require('./ary'), - 'before': require('./before'), - 'bind': require('./bind'), - 'bindKey': require('./bindKey'), - 'curry': require('./curry'), - 'curryRight': require('./curryRight'), - 'debounce': require('./debounce'), - 'defer': require('./defer'), - 'delay': require('./delay'), - 'flip': require('./flip'), - 'memoize': require('./memoize'), - 'negate': require('./negate'), - 'once': require('./once'), - 'overArgs': require('./overArgs'), - 'partial': require('./partial'), - 'partialRight': require('./partialRight'), - 'rearg': require('./rearg'), - 'rest': require('./rest'), - 'spread': require('./spread'), - 'throttle': require('./throttle'), - 'unary': require('./unary'), - 'wrap': require('./wrap') -}; diff --git a/node_modules/lodash/functions.js b/node_modules/lodash/functions.js deleted file mode 100644 index 9722928f..00000000 --- a/node_modules/lodash/functions.js +++ /dev/null @@ -1,31 +0,0 @@ -var baseFunctions = require('./_baseFunctions'), - keys = require('./keys'); - -/** - * Creates an array of function property names from own enumerable properties - * of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functionsIn - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functions(new Foo); - * // => ['a', 'b'] - */ -function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); -} - -module.exports = functions; diff --git a/node_modules/lodash/functionsIn.js b/node_modules/lodash/functionsIn.js deleted file mode 100644 index f00345d0..00000000 --- a/node_modules/lodash/functionsIn.js +++ /dev/null @@ -1,31 +0,0 @@ -var baseFunctions = require('./_baseFunctions'), - keysIn = require('./keysIn'); - -/** - * Creates an array of function property names from own and inherited - * enumerable properties of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functions - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functionsIn(new Foo); - * // => ['a', 'b', 'c'] - */ -function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); -} - -module.exports = functionsIn; diff --git a/node_modules/lodash/get.js b/node_modules/lodash/get.js deleted file mode 100644 index 8805ff92..00000000 --- a/node_modules/lodash/get.js +++ /dev/null @@ -1,33 +0,0 @@ -var baseGet = require('./_baseGet'); - -/** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ -function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; -} - -module.exports = get; diff --git a/node_modules/lodash/groupBy.js b/node_modules/lodash/groupBy.js deleted file mode 100644 index babf4f6b..00000000 --- a/node_modules/lodash/groupBy.js +++ /dev/null @@ -1,41 +0,0 @@ -var baseAssignValue = require('./_baseAssignValue'), - createAggregator = require('./_createAggregator'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The order of grouped values - * is determined by the order they occur in `collection`. The corresponding - * value of each key is an array of elements responsible for generating the - * key. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': [4.2], '6': [6.1, 6.3] } - * - * // The `_.property` iteratee shorthand. - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ -var groupBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - result[key].push(value); - } else { - baseAssignValue(result, key, [value]); - } -}); - -module.exports = groupBy; diff --git a/node_modules/lodash/gt.js b/node_modules/lodash/gt.js deleted file mode 100644 index 3a662828..00000000 --- a/node_modules/lodash/gt.js +++ /dev/null @@ -1,29 +0,0 @@ -var baseGt = require('./_baseGt'), - createRelationalOperation = require('./_createRelationalOperation'); - -/** - * Checks if `value` is greater than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - * @see _.lt - * @example - * - * _.gt(3, 1); - * // => true - * - * _.gt(3, 3); - * // => false - * - * _.gt(1, 3); - * // => false - */ -var gt = createRelationalOperation(baseGt); - -module.exports = gt; diff --git a/node_modules/lodash/gte.js b/node_modules/lodash/gte.js deleted file mode 100644 index 4180a687..00000000 --- a/node_modules/lodash/gte.js +++ /dev/null @@ -1,30 +0,0 @@ -var createRelationalOperation = require('./_createRelationalOperation'); - -/** - * Checks if `value` is greater than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to - * `other`, else `false`. - * @see _.lte - * @example - * - * _.gte(3, 1); - * // => true - * - * _.gte(3, 3); - * // => true - * - * _.gte(1, 3); - * // => false - */ -var gte = createRelationalOperation(function(value, other) { - return value >= other; -}); - -module.exports = gte; diff --git a/node_modules/lodash/has.js b/node_modules/lodash/has.js deleted file mode 100644 index 34df55e8..00000000 --- a/node_modules/lodash/has.js +++ /dev/null @@ -1,35 +0,0 @@ -var baseHas = require('./_baseHas'), - hasPath = require('./_hasPath'); - -/** - * Checks if `path` is a direct property of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = { 'a': { 'b': 2 } }; - * var other = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b'); - * // => true - * - * _.has(object, ['a', 'b']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ -function has(object, path) { - return object != null && hasPath(object, path, baseHas); -} - -module.exports = has; diff --git a/node_modules/lodash/hasIn.js b/node_modules/lodash/hasIn.js deleted file mode 100644 index 06a36865..00000000 --- a/node_modules/lodash/hasIn.js +++ /dev/null @@ -1,34 +0,0 @@ -var baseHasIn = require('./_baseHasIn'), - hasPath = require('./_hasPath'); - -/** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b'); - * // => true - * - * _.hasIn(object, ['a', 'b']); - * // => true - * - * _.hasIn(object, 'b'); - * // => false - */ -function hasIn(object, path) { - return object != null && hasPath(object, path, baseHasIn); -} - -module.exports = hasIn; diff --git a/node_modules/lodash/head.js b/node_modules/lodash/head.js deleted file mode 100644 index dee9d1f1..00000000 --- a/node_modules/lodash/head.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ -function head(array) { - return (array && array.length) ? array[0] : undefined; -} - -module.exports = head; diff --git a/node_modules/lodash/identity.js b/node_modules/lodash/identity.js deleted file mode 100644 index 2d5d963c..00000000 --- a/node_modules/lodash/identity.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This method returns the first argument it receives. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'a': 1 }; - * - * console.log(_.identity(object) === object); - * // => true - */ -function identity(value) { - return value; -} - -module.exports = identity; diff --git a/node_modules/lodash/inRange.js b/node_modules/lodash/inRange.js deleted file mode 100644 index f20728d9..00000000 --- a/node_modules/lodash/inRange.js +++ /dev/null @@ -1,55 +0,0 @@ -var baseInRange = require('./_baseInRange'), - toFinite = require('./toFinite'), - toNumber = require('./toNumber'); - -/** - * Checks if `n` is between `start` and up to, but not including, `end`. If - * `end` is not specified, it's set to `start` with `start` then set to `0`. - * If `start` is greater than `end` the params are swapped to support - * negative ranges. - * - * @static - * @memberOf _ - * @since 3.3.0 - * @category Number - * @param {number} number The number to check. - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - * @see _.range, _.rangeRight - * @example - * - * _.inRange(3, 2, 4); - * // => true - * - * _.inRange(4, 8); - * // => true - * - * _.inRange(4, 2); - * // => false - * - * _.inRange(2, 2); - * // => false - * - * _.inRange(1.2, 2); - * // => true - * - * _.inRange(5.2, 4); - * // => false - * - * _.inRange(-3, -2, -6); - * // => true - */ -function inRange(number, start, end) { - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - number = toNumber(number); - return baseInRange(number, start, end); -} - -module.exports = inRange; diff --git a/node_modules/lodash/includes.js b/node_modules/lodash/includes.js deleted file mode 100644 index ae0deedc..00000000 --- a/node_modules/lodash/includes.js +++ /dev/null @@ -1,53 +0,0 @@ -var baseIndexOf = require('./_baseIndexOf'), - isArrayLike = require('./isArrayLike'), - isString = require('./isString'), - toInteger = require('./toInteger'), - values = require('./values'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Checks if `value` is in `collection`. If `collection` is a string, it's - * checked for a substring of `value`, otherwise - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'a': 1, 'b': 2 }, 1); - * // => true - * - * _.includes('abcd', 'bc'); - * // => true - */ -function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); - fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; - - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return isString(collection) - ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) - : (!!length && baseIndexOf(collection, value, fromIndex) > -1); -} - -module.exports = includes; diff --git a/node_modules/lodash/index.js b/node_modules/lodash/index.js deleted file mode 100644 index 5d063e21..00000000 --- a/node_modules/lodash/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lodash'); \ No newline at end of file diff --git a/node_modules/lodash/indexOf.js b/node_modules/lodash/indexOf.js deleted file mode 100644 index 3c644af2..00000000 --- a/node_modules/lodash/indexOf.js +++ /dev/null @@ -1,42 +0,0 @@ -var baseIndexOf = require('./_baseIndexOf'), - toInteger = require('./toInteger'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the - * offset from the end of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // Search from the `fromIndex`. - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ -function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseIndexOf(array, value, index); -} - -module.exports = indexOf; diff --git a/node_modules/lodash/initial.js b/node_modules/lodash/initial.js deleted file mode 100644 index f47fc509..00000000 --- a/node_modules/lodash/initial.js +++ /dev/null @@ -1,22 +0,0 @@ -var baseSlice = require('./_baseSlice'); - -/** - * Gets all but the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - */ -function initial(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 0, -1) : []; -} - -module.exports = initial; diff --git a/node_modules/lodash/intersection.js b/node_modules/lodash/intersection.js deleted file mode 100644 index a94c1351..00000000 --- a/node_modules/lodash/intersection.js +++ /dev/null @@ -1,30 +0,0 @@ -var arrayMap = require('./_arrayMap'), - baseIntersection = require('./_baseIntersection'), - baseRest = require('./_baseRest'), - castArrayLikeObject = require('./_castArrayLikeObject'); - -/** - * Creates an array of unique values that are included in all given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersection([2, 1], [2, 3]); - * // => [2] - */ -var intersection = baseRest(function(arrays) { - var mapped = arrayMap(arrays, castArrayLikeObject); - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; -}); - -module.exports = intersection; diff --git a/node_modules/lodash/intersectionBy.js b/node_modules/lodash/intersectionBy.js deleted file mode 100644 index 31461aae..00000000 --- a/node_modules/lodash/intersectionBy.js +++ /dev/null @@ -1,45 +0,0 @@ -var arrayMap = require('./_arrayMap'), - baseIntersection = require('./_baseIntersection'), - baseIteratee = require('./_baseIteratee'), - baseRest = require('./_baseRest'), - castArrayLikeObject = require('./_castArrayLikeObject'), - last = require('./last'); - -/** - * This method is like `_.intersection` except that it accepts `iteratee` - * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [2.1] - * - * // The `_.property` iteratee shorthand. - * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }] - */ -var intersectionBy = baseRest(function(arrays) { - var iteratee = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - if (iteratee === last(mapped)) { - iteratee = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, baseIteratee(iteratee, 2)) - : []; -}); - -module.exports = intersectionBy; diff --git a/node_modules/lodash/intersectionWith.js b/node_modules/lodash/intersectionWith.js deleted file mode 100644 index 63cabfaa..00000000 --- a/node_modules/lodash/intersectionWith.js +++ /dev/null @@ -1,41 +0,0 @@ -var arrayMap = require('./_arrayMap'), - baseIntersection = require('./_baseIntersection'), - baseRest = require('./_baseRest'), - castArrayLikeObject = require('./_castArrayLikeObject'), - last = require('./last'); - -/** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The order and references - * of result values are determined by the first array. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.intersectionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }] - */ -var intersectionWith = baseRest(function(arrays) { - var comparator = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - comparator = typeof comparator == 'function' ? comparator : undefined; - if (comparator) { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, undefined, comparator) - : []; -}); - -module.exports = intersectionWith; diff --git a/node_modules/lodash/invert.js b/node_modules/lodash/invert.js deleted file mode 100644 index 8c479509..00000000 --- a/node_modules/lodash/invert.js +++ /dev/null @@ -1,42 +0,0 @@ -var constant = require('./constant'), - createInverter = require('./_createInverter'), - identity = require('./identity'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; - -/** - * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite - * property assignments of previous values. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Object - * @param {Object} object The object to invert. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invert(object); - * // => { '1': 'c', '2': 'b' } - */ -var invert = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - result[value] = key; -}, constant(identity)); - -module.exports = invert; diff --git a/node_modules/lodash/invertBy.js b/node_modules/lodash/invertBy.js deleted file mode 100644 index 3f4f7e53..00000000 --- a/node_modules/lodash/invertBy.js +++ /dev/null @@ -1,56 +0,0 @@ -var baseIteratee = require('./_baseIteratee'), - createInverter = require('./_createInverter'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; - -/** - * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` thru `iteratee`. The - * corresponding inverted value of each inverted key is an array of keys - * responsible for generating the inverted value. The iteratee is invoked - * with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Object - * @param {Object} object The object to invert. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invertBy(object); - * // => { '1': ['a', 'c'], '2': ['b'] } - * - * _.invertBy(object, function(value) { - * return 'group' + value; - * }); - * // => { 'group1': ['a', 'c'], 'group2': ['b'] } - */ -var invertBy = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } -}, baseIteratee); - -module.exports = invertBy; diff --git a/node_modules/lodash/invoke.js b/node_modules/lodash/invoke.js deleted file mode 100644 index 97d51eb5..00000000 --- a/node_modules/lodash/invoke.js +++ /dev/null @@ -1,24 +0,0 @@ -var baseInvoke = require('./_baseInvoke'), - baseRest = require('./_baseRest'); - -/** - * Invokes the method at `path` of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {...*} [args] The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - * @example - * - * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; - * - * _.invoke(object, 'a[0].b.c.slice', 1, 3); - * // => [2, 3] - */ -var invoke = baseRest(baseInvoke); - -module.exports = invoke; diff --git a/node_modules/lodash/invokeMap.js b/node_modules/lodash/invokeMap.js deleted file mode 100644 index 8da5126c..00000000 --- a/node_modules/lodash/invokeMap.js +++ /dev/null @@ -1,41 +0,0 @@ -var apply = require('./_apply'), - baseEach = require('./_baseEach'), - baseInvoke = require('./_baseInvoke'), - baseRest = require('./_baseRest'), - isArrayLike = require('./isArrayLike'); - -/** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `path` is a function, it's invoked - * for, and `this` bound to, each element in `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. - * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. - * @example - * - * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invokeMap([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ -var invokeMap = baseRest(function(collection, path, args) { - var index = -1, - isFunc = typeof path == 'function', - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value) { - result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); - }); - return result; -}); - -module.exports = invokeMap; diff --git a/node_modules/lodash/isArguments.js b/node_modules/lodash/isArguments.js deleted file mode 100644 index 8b9ed66c..00000000 --- a/node_modules/lodash/isArguments.js +++ /dev/null @@ -1,36 +0,0 @@ -var baseIsArguments = require('./_baseIsArguments'), - isObjectLike = require('./isObjectLike'); - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); -}; - -module.exports = isArguments; diff --git a/node_modules/lodash/isArray.js b/node_modules/lodash/isArray.js deleted file mode 100644 index 88ab55fd..00000000 --- a/node_modules/lodash/isArray.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -module.exports = isArray; diff --git a/node_modules/lodash/isArrayBuffer.js b/node_modules/lodash/isArrayBuffer.js deleted file mode 100644 index 12904a64..00000000 --- a/node_modules/lodash/isArrayBuffer.js +++ /dev/null @@ -1,27 +0,0 @@ -var baseIsArrayBuffer = require('./_baseIsArrayBuffer'), - baseUnary = require('./_baseUnary'), - nodeUtil = require('./_nodeUtil'); - -/* Node.js helper references. */ -var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer; - -/** - * Checks if `value` is classified as an `ArrayBuffer` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - * @example - * - * _.isArrayBuffer(new ArrayBuffer(2)); - * // => true - * - * _.isArrayBuffer(new Array(2)); - * // => false - */ -var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - -module.exports = isArrayBuffer; diff --git a/node_modules/lodash/isArrayLike.js b/node_modules/lodash/isArrayLike.js deleted file mode 100644 index 0f966805..00000000 --- a/node_modules/lodash/isArrayLike.js +++ /dev/null @@ -1,33 +0,0 @@ -var isFunction = require('./isFunction'), - isLength = require('./isLength'); - -/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); -} - -module.exports = isArrayLike; diff --git a/node_modules/lodash/isArrayLikeObject.js b/node_modules/lodash/isArrayLikeObject.js deleted file mode 100644 index 6c4812a8..00000000 --- a/node_modules/lodash/isArrayLikeObject.js +++ /dev/null @@ -1,33 +0,0 @@ -var isArrayLike = require('./isArrayLike'), - isObjectLike = require('./isObjectLike'); - -/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); -} - -module.exports = isArrayLikeObject; diff --git a/node_modules/lodash/isBoolean.js b/node_modules/lodash/isBoolean.js deleted file mode 100644 index a43ed4b8..00000000 --- a/node_modules/lodash/isBoolean.js +++ /dev/null @@ -1,29 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var boolTag = '[object Boolean]'; - -/** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ -function isBoolean(value) { - return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); -} - -module.exports = isBoolean; diff --git a/node_modules/lodash/isBuffer.js b/node_modules/lodash/isBuffer.js deleted file mode 100644 index c103cc74..00000000 --- a/node_modules/lodash/isBuffer.js +++ /dev/null @@ -1,38 +0,0 @@ -var root = require('./_root'), - stubFalse = require('./stubFalse'); - -/** Detect free variable `exports`. */ -var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - -/** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; - -/** Built-in value references. */ -var Buffer = moduleExports ? root.Buffer : undefined; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; - -/** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ -var isBuffer = nativeIsBuffer || stubFalse; - -module.exports = isBuffer; diff --git a/node_modules/lodash/isDate.js b/node_modules/lodash/isDate.js deleted file mode 100644 index 7f0209fc..00000000 --- a/node_modules/lodash/isDate.js +++ /dev/null @@ -1,27 +0,0 @@ -var baseIsDate = require('./_baseIsDate'), - baseUnary = require('./_baseUnary'), - nodeUtil = require('./_nodeUtil'); - -/* Node.js helper references. */ -var nodeIsDate = nodeUtil && nodeUtil.isDate; - -/** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ -var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; - -module.exports = isDate; diff --git a/node_modules/lodash/isElement.js b/node_modules/lodash/isElement.js deleted file mode 100644 index 76ae29c3..00000000 --- a/node_modules/lodash/isElement.js +++ /dev/null @@ -1,25 +0,0 @@ -var isObjectLike = require('./isObjectLike'), - isPlainObject = require('./isPlainObject'); - -/** - * Checks if `value` is likely a DOM element. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - * - * _.isElement(''); - * // => false - */ -function isElement(value) { - return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); -} - -module.exports = isElement; diff --git a/node_modules/lodash/isEmpty.js b/node_modules/lodash/isEmpty.js deleted file mode 100644 index 3597294a..00000000 --- a/node_modules/lodash/isEmpty.js +++ /dev/null @@ -1,77 +0,0 @@ -var baseKeys = require('./_baseKeys'), - getTag = require('./_getTag'), - isArguments = require('./isArguments'), - isArray = require('./isArray'), - isArrayLike = require('./isArrayLike'), - isBuffer = require('./isBuffer'), - isPrototype = require('./_isPrototype'), - isTypedArray = require('./isTypedArray'); - -/** `Object#toString` result references. */ -var mapTag = '[object Map]', - setTag = '[object Set]'; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Checks if `value` is an empty object, collection, map, or set. - * - * Objects are considered empty if they have no own enumerable string keyed - * properties. - * - * Array-like values such as `arguments` objects, arrays, buffers, strings, or - * jQuery-like collections are considered empty if they have a `length` of `0`. - * Similarly, maps and sets are considered empty if they have a `size` of `0`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ -function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike(value) && - (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { - return !value.length; - } - var tag = getTag(value); - if (tag == mapTag || tag == setTag) { - return !value.size; - } - if (isPrototype(value)) { - return !baseKeys(value).length; - } - for (var key in value) { - if (hasOwnProperty.call(value, key)) { - return false; - } - } - return true; -} - -module.exports = isEmpty; diff --git a/node_modules/lodash/isEqual.js b/node_modules/lodash/isEqual.js deleted file mode 100644 index 5e23e76c..00000000 --- a/node_modules/lodash/isEqual.js +++ /dev/null @@ -1,35 +0,0 @@ -var baseIsEqual = require('./_baseIsEqual'); - -/** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ -function isEqual(value, other) { - return baseIsEqual(value, other); -} - -module.exports = isEqual; diff --git a/node_modules/lodash/isEqualWith.js b/node_modules/lodash/isEqualWith.js deleted file mode 100644 index 21bdc7ff..00000000 --- a/node_modules/lodash/isEqualWith.js +++ /dev/null @@ -1,41 +0,0 @@ -var baseIsEqual = require('./_baseIsEqual'); - -/** - * This method is like `_.isEqual` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with up to - * six arguments: (objValue, othValue [, index|key, object, other, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, othValue) { - * if (isGreeting(objValue) && isGreeting(othValue)) { - * return true; - * } - * } - * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqualWith(array, other, customizer); - * // => true - */ -function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; -} - -module.exports = isEqualWith; diff --git a/node_modules/lodash/isError.js b/node_modules/lodash/isError.js deleted file mode 100644 index b4f41e00..00000000 --- a/node_modules/lodash/isError.js +++ /dev/null @@ -1,36 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'), - isPlainObject = require('./isPlainObject'); - -/** `Object#toString` result references. */ -var domExcTag = '[object DOMException]', - errorTag = '[object Error]'; - -/** - * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, - * `SyntaxError`, `TypeError`, or `URIError` object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. - * @example - * - * _.isError(new Error); - * // => true - * - * _.isError(Error); - * // => false - */ -function isError(value) { - if (!isObjectLike(value)) { - return false; - } - var tag = baseGetTag(value); - return tag == errorTag || tag == domExcTag || - (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); -} - -module.exports = isError; diff --git a/node_modules/lodash/isFinite.js b/node_modules/lodash/isFinite.js deleted file mode 100644 index 601842bc..00000000 --- a/node_modules/lodash/isFinite.js +++ /dev/null @@ -1,36 +0,0 @@ -var root = require('./_root'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeIsFinite = root.isFinite; - -/** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on - * [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MIN_VALUE); - * // => true - * - * _.isFinite(Infinity); - * // => false - * - * _.isFinite('3'); - * // => false - */ -function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); -} - -module.exports = isFinite; diff --git a/node_modules/lodash/isFunction.js b/node_modules/lodash/isFunction.js deleted file mode 100644 index 907a8cd8..00000000 --- a/node_modules/lodash/isFunction.js +++ /dev/null @@ -1,37 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObject = require('./isObject'); - -/** `Object#toString` result references. */ -var asyncTag = '[object AsyncFunction]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - proxyTag = '[object Proxy]'; - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; -} - -module.exports = isFunction; diff --git a/node_modules/lodash/isInteger.js b/node_modules/lodash/isInteger.js deleted file mode 100644 index 66aa87d5..00000000 --- a/node_modules/lodash/isInteger.js +++ /dev/null @@ -1,33 +0,0 @@ -var toInteger = require('./toInteger'); - -/** - * Checks if `value` is an integer. - * - * **Note:** This method is based on - * [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @example - * - * _.isInteger(3); - * // => true - * - * _.isInteger(Number.MIN_VALUE); - * // => false - * - * _.isInteger(Infinity); - * // => false - * - * _.isInteger('3'); - * // => false - */ -function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); -} - -module.exports = isInteger; diff --git a/node_modules/lodash/isLength.js b/node_modules/lodash/isLength.js deleted file mode 100644 index 3a95caa9..00000000 --- a/node_modules/lodash/isLength.js +++ /dev/null @@ -1,35 +0,0 @@ -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -module.exports = isLength; diff --git a/node_modules/lodash/isMap.js b/node_modules/lodash/isMap.js deleted file mode 100644 index 44f8517e..00000000 --- a/node_modules/lodash/isMap.js +++ /dev/null @@ -1,27 +0,0 @@ -var baseIsMap = require('./_baseIsMap'), - baseUnary = require('./_baseUnary'), - nodeUtil = require('./_nodeUtil'); - -/* Node.js helper references. */ -var nodeIsMap = nodeUtil && nodeUtil.isMap; - -/** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */ -var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - -module.exports = isMap; diff --git a/node_modules/lodash/isMatch.js b/node_modules/lodash/isMatch.js deleted file mode 100644 index 9773a18c..00000000 --- a/node_modules/lodash/isMatch.js +++ /dev/null @@ -1,36 +0,0 @@ -var baseIsMatch = require('./_baseIsMatch'), - getMatchData = require('./_getMatchData'); - -/** - * Performs a partial deep comparison between `object` and `source` to - * determine if `object` contains equivalent property values. - * - * **Note:** This method is equivalent to `_.matches` when `source` is - * partially applied. - * - * Partial comparisons will match empty array and empty object `source` - * values against any array or object value, respectively. See `_.isEqual` - * for a list of supported value comparisons. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.isMatch(object, { 'b': 2 }); - * // => true - * - * _.isMatch(object, { 'b': 1 }); - * // => false - */ -function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); -} - -module.exports = isMatch; diff --git a/node_modules/lodash/isMatchWith.js b/node_modules/lodash/isMatchWith.js deleted file mode 100644 index 187b6a61..00000000 --- a/node_modules/lodash/isMatchWith.js +++ /dev/null @@ -1,41 +0,0 @@ -var baseIsMatch = require('./_baseIsMatch'), - getMatchData = require('./_getMatchData'); - -/** - * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with five - * arguments: (objValue, srcValue, index|key, object, source). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, srcValue) { - * if (isGreeting(objValue) && isGreeting(srcValue)) { - * return true; - * } - * } - * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; - * - * _.isMatchWith(object, source, customizer); - * // => true - */ -function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseIsMatch(object, source, getMatchData(source), customizer); -} - -module.exports = isMatchWith; diff --git a/node_modules/lodash/isNaN.js b/node_modules/lodash/isNaN.js deleted file mode 100644 index 7d0d783b..00000000 --- a/node_modules/lodash/isNaN.js +++ /dev/null @@ -1,38 +0,0 @@ -var isNumber = require('./isNumber'); - -/** - * Checks if `value` is `NaN`. - * - * **Note:** This method is based on - * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as - * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for - * `undefined` and other non-number values. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ -function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some - // ActiveX objects in IE. - return isNumber(value) && value != +value; -} - -module.exports = isNaN; diff --git a/node_modules/lodash/isNative.js b/node_modules/lodash/isNative.js deleted file mode 100644 index f0cb8d58..00000000 --- a/node_modules/lodash/isNative.js +++ /dev/null @@ -1,40 +0,0 @@ -var baseIsNative = require('./_baseIsNative'), - isMaskable = require('./_isMaskable'); - -/** Error message constants. */ -var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.'; - -/** - * Checks if `value` is a pristine native function. - * - * **Note:** This method can't reliably detect native functions in the presence - * of the core-js package because core-js circumvents this kind of detection. - * Despite multiple requests, the core-js maintainer has made it clear: any - * attempt to fix the detection will be obstructed. As a result, we're left - * with little choice but to throw an error. Unfortunately, this also affects - * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), - * which rely on core-js. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (isMaskable(value)) { - throw new Error(CORE_ERROR_TEXT); - } - return baseIsNative(value); -} - -module.exports = isNative; diff --git a/node_modules/lodash/isNil.js b/node_modules/lodash/isNil.js deleted file mode 100644 index 79f05052..00000000 --- a/node_modules/lodash/isNil.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Checks if `value` is `null` or `undefined`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is nullish, else `false`. - * @example - * - * _.isNil(null); - * // => true - * - * _.isNil(void 0); - * // => true - * - * _.isNil(NaN); - * // => false - */ -function isNil(value) { - return value == null; -} - -module.exports = isNil; diff --git a/node_modules/lodash/isNull.js b/node_modules/lodash/isNull.js deleted file mode 100644 index c0a374d7..00000000 --- a/node_modules/lodash/isNull.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ -function isNull(value) { - return value === null; -} - -module.exports = isNull; diff --git a/node_modules/lodash/isNumber.js b/node_modules/lodash/isNumber.js deleted file mode 100644 index cd34ee46..00000000 --- a/node_modules/lodash/isNumber.js +++ /dev/null @@ -1,38 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var numberTag = '[object Number]'; - -/** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are - * classified as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a number, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ -function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); -} - -module.exports = isNumber; diff --git a/node_modules/lodash/isObject.js b/node_modules/lodash/isObject.js deleted file mode 100644 index 1dc89391..00000000 --- a/node_modules/lodash/isObject.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); -} - -module.exports = isObject; diff --git a/node_modules/lodash/isObjectLike.js b/node_modules/lodash/isObjectLike.js deleted file mode 100644 index 301716b5..00000000 --- a/node_modules/lodash/isObjectLike.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return value != null && typeof value == 'object'; -} - -module.exports = isObjectLike; diff --git a/node_modules/lodash/isPlainObject.js b/node_modules/lodash/isPlainObject.js deleted file mode 100644 index 23873731..00000000 --- a/node_modules/lodash/isPlainObject.js +++ /dev/null @@ -1,62 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - getPrototype = require('./_getPrototype'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var objectTag = '[object Object]'; - -/** Used for built-in method references. */ -var funcProto = Function.prototype, - objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** Used to infer the `Object` constructor. */ -var objectCtorString = funcToString.call(Object); - -/** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ -function isPlainObject(value) { - if (!isObjectLike(value) || baseGetTag(value) != objectTag) { - return false; - } - var proto = getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; -} - -module.exports = isPlainObject; diff --git a/node_modules/lodash/isRegExp.js b/node_modules/lodash/isRegExp.js deleted file mode 100644 index 76c9b6e9..00000000 --- a/node_modules/lodash/isRegExp.js +++ /dev/null @@ -1,27 +0,0 @@ -var baseIsRegExp = require('./_baseIsRegExp'), - baseUnary = require('./_baseUnary'), - nodeUtil = require('./_nodeUtil'); - -/* Node.js helper references. */ -var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp; - -/** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ -var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; - -module.exports = isRegExp; diff --git a/node_modules/lodash/isSafeInteger.js b/node_modules/lodash/isSafeInteger.js deleted file mode 100644 index 2a48526e..00000000 --- a/node_modules/lodash/isSafeInteger.js +++ /dev/null @@ -1,37 +0,0 @@ -var isInteger = require('./isInteger'); - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on - * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * _.isSafeInteger(3); - * // => true - * - * _.isSafeInteger(Number.MIN_VALUE); - * // => false - * - * _.isSafeInteger(Infinity); - * // => false - * - * _.isSafeInteger('3'); - * // => false - */ -function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; -} - -module.exports = isSafeInteger; diff --git a/node_modules/lodash/isSet.js b/node_modules/lodash/isSet.js deleted file mode 100644 index ab88bdf8..00000000 --- a/node_modules/lodash/isSet.js +++ /dev/null @@ -1,27 +0,0 @@ -var baseIsSet = require('./_baseIsSet'), - baseUnary = require('./_baseUnary'), - nodeUtil = require('./_nodeUtil'); - -/* Node.js helper references. */ -var nodeIsSet = nodeUtil && nodeUtil.isSet; - -/** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */ -var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - -module.exports = isSet; diff --git a/node_modules/lodash/isString.js b/node_modules/lodash/isString.js deleted file mode 100644 index 627eb9c3..00000000 --- a/node_modules/lodash/isString.js +++ /dev/null @@ -1,30 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isArray = require('./isArray'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var stringTag = '[object String]'; - -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); -} - -module.exports = isString; diff --git a/node_modules/lodash/isSymbol.js b/node_modules/lodash/isSymbol.js deleted file mode 100644 index dfb60b97..00000000 --- a/node_modules/lodash/isSymbol.js +++ /dev/null @@ -1,29 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; - -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); -} - -module.exports = isSymbol; diff --git a/node_modules/lodash/isTypedArray.js b/node_modules/lodash/isTypedArray.js deleted file mode 100644 index da3f8dd1..00000000 --- a/node_modules/lodash/isTypedArray.js +++ /dev/null @@ -1,27 +0,0 @@ -var baseIsTypedArray = require('./_baseIsTypedArray'), - baseUnary = require('./_baseUnary'), - nodeUtil = require('./_nodeUtil'); - -/* Node.js helper references. */ -var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - -/** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ -var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - -module.exports = isTypedArray; diff --git a/node_modules/lodash/isUndefined.js b/node_modules/lodash/isUndefined.js deleted file mode 100644 index 377d121a..00000000 --- a/node_modules/lodash/isUndefined.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Checks if `value` is `undefined`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - * - * _.isUndefined(null); - * // => false - */ -function isUndefined(value) { - return value === undefined; -} - -module.exports = isUndefined; diff --git a/node_modules/lodash/isWeakMap.js b/node_modules/lodash/isWeakMap.js deleted file mode 100644 index 8d36f663..00000000 --- a/node_modules/lodash/isWeakMap.js +++ /dev/null @@ -1,28 +0,0 @@ -var getTag = require('./_getTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var weakMapTag = '[object WeakMap]'; - -/** - * Checks if `value` is classified as a `WeakMap` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. - * @example - * - * _.isWeakMap(new WeakMap); - * // => true - * - * _.isWeakMap(new Map); - * // => false - */ -function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == weakMapTag; -} - -module.exports = isWeakMap; diff --git a/node_modules/lodash/isWeakSet.js b/node_modules/lodash/isWeakSet.js deleted file mode 100644 index e628b261..00000000 --- a/node_modules/lodash/isWeakSet.js +++ /dev/null @@ -1,28 +0,0 @@ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var weakSetTag = '[object WeakSet]'; - -/** - * Checks if `value` is classified as a `WeakSet` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. - * @example - * - * _.isWeakSet(new WeakSet); - * // => true - * - * _.isWeakSet(new Set); - * // => false - */ -function isWeakSet(value) { - return isObjectLike(value) && baseGetTag(value) == weakSetTag; -} - -module.exports = isWeakSet; diff --git a/node_modules/lodash/iteratee.js b/node_modules/lodash/iteratee.js deleted file mode 100644 index 61b73a8c..00000000 --- a/node_modules/lodash/iteratee.js +++ /dev/null @@ -1,53 +0,0 @@ -var baseClone = require('./_baseClone'), - baseIteratee = require('./_baseIteratee'); - -/** Used to compose bitmasks for cloning. */ -var CLONE_DEEP_FLAG = 1; - -/** - * Creates a function that invokes `func` with the arguments of the created - * function. If `func` is a property name, the created function returns the - * property value for a given element. If `func` is an array or object, the - * created function returns `true` for elements that contain the equivalent - * source properties, otherwise it returns `false`. - * - * @static - * @since 4.0.0 - * @memberOf _ - * @category Util - * @param {*} [func=_.identity] The value to convert to a callback. - * @returns {Function} Returns the callback. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); - * // => [{ 'user': 'barney', 'age': 36, 'active': true }] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, _.iteratee(['user', 'fred'])); - * // => [{ 'user': 'fred', 'age': 40 }] - * - * // The `_.property` iteratee shorthand. - * _.map(users, _.iteratee('user')); - * // => ['barney', 'fred'] - * - * // Create custom iteratee shorthands. - * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { - * return !_.isRegExp(func) ? iteratee(func) : function(string) { - * return func.test(string); - * }; - * }); - * - * _.filter(['abc', 'def'], /ef/); - * // => ['def'] - */ -function iteratee(func) { - return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); -} - -module.exports = iteratee; diff --git a/node_modules/lodash/join.js b/node_modules/lodash/join.js deleted file mode 100644 index 45de079f..00000000 --- a/node_modules/lodash/join.js +++ /dev/null @@ -1,26 +0,0 @@ -/** Used for built-in method references. */ -var arrayProto = Array.prototype; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeJoin = arrayProto.join; - -/** - * Converts all elements in `array` into a string separated by `separator`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to convert. - * @param {string} [separator=','] The element separator. - * @returns {string} Returns the joined string. - * @example - * - * _.join(['a', 'b', 'c'], '~'); - * // => 'a~b~c' - */ -function join(array, separator) { - return array == null ? '' : nativeJoin.call(array, separator); -} - -module.exports = join; diff --git a/node_modules/lodash/kebabCase.js b/node_modules/lodash/kebabCase.js deleted file mode 100644 index 8a52be64..00000000 --- a/node_modules/lodash/kebabCase.js +++ /dev/null @@ -1,28 +0,0 @@ -var createCompounder = require('./_createCompounder'); - -/** - * Converts `string` to - * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the kebab cased string. - * @example - * - * _.kebabCase('Foo Bar'); - * // => 'foo-bar' - * - * _.kebabCase('fooBar'); - * // => 'foo-bar' - * - * _.kebabCase('__FOO_BAR__'); - * // => 'foo-bar' - */ -var kebabCase = createCompounder(function(result, word, index) { - return result + (index ? '-' : '') + word.toLowerCase(); -}); - -module.exports = kebabCase; diff --git a/node_modules/lodash/keyBy.js b/node_modules/lodash/keyBy.js deleted file mode 100644 index acc007a0..00000000 --- a/node_modules/lodash/keyBy.js +++ /dev/null @@ -1,36 +0,0 @@ -var baseAssignValue = require('./_baseAssignValue'), - createAggregator = require('./_createAggregator'); - -/** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var array = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.keyBy(array, function(o) { - * return String.fromCharCode(o.code); - * }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.keyBy(array, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - */ -var keyBy = createAggregator(function(result, value, key) { - baseAssignValue(result, key, value); -}); - -module.exports = keyBy; diff --git a/node_modules/lodash/keys.js b/node_modules/lodash/keys.js deleted file mode 100644 index d143c718..00000000 --- a/node_modules/lodash/keys.js +++ /dev/null @@ -1,37 +0,0 @@ -var arrayLikeKeys = require('./_arrayLikeKeys'), - baseKeys = require('./_baseKeys'), - isArrayLike = require('./isArrayLike'); - -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); -} - -module.exports = keys; diff --git a/node_modules/lodash/keysIn.js b/node_modules/lodash/keysIn.js deleted file mode 100644 index a62308f2..00000000 --- a/node_modules/lodash/keysIn.js +++ /dev/null @@ -1,32 +0,0 @@ -var arrayLikeKeys = require('./_arrayLikeKeys'), - baseKeysIn = require('./_baseKeysIn'), - isArrayLike = require('./isArrayLike'); - -/** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ -function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); -} - -module.exports = keysIn; diff --git a/node_modules/lodash/lang.js b/node_modules/lodash/lang.js deleted file mode 100644 index a3962169..00000000 --- a/node_modules/lodash/lang.js +++ /dev/null @@ -1,58 +0,0 @@ -module.exports = { - 'castArray': require('./castArray'), - 'clone': require('./clone'), - 'cloneDeep': require('./cloneDeep'), - 'cloneDeepWith': require('./cloneDeepWith'), - 'cloneWith': require('./cloneWith'), - 'conformsTo': require('./conformsTo'), - 'eq': require('./eq'), - 'gt': require('./gt'), - 'gte': require('./gte'), - 'isArguments': require('./isArguments'), - 'isArray': require('./isArray'), - 'isArrayBuffer': require('./isArrayBuffer'), - 'isArrayLike': require('./isArrayLike'), - 'isArrayLikeObject': require('./isArrayLikeObject'), - 'isBoolean': require('./isBoolean'), - 'isBuffer': require('./isBuffer'), - 'isDate': require('./isDate'), - 'isElement': require('./isElement'), - 'isEmpty': require('./isEmpty'), - 'isEqual': require('./isEqual'), - 'isEqualWith': require('./isEqualWith'), - 'isError': require('./isError'), - 'isFinite': require('./isFinite'), - 'isFunction': require('./isFunction'), - 'isInteger': require('./isInteger'), - 'isLength': require('./isLength'), - 'isMap': require('./isMap'), - 'isMatch': require('./isMatch'), - 'isMatchWith': require('./isMatchWith'), - 'isNaN': require('./isNaN'), - 'isNative': require('./isNative'), - 'isNil': require('./isNil'), - 'isNull': require('./isNull'), - 'isNumber': require('./isNumber'), - 'isObject': require('./isObject'), - 'isObjectLike': require('./isObjectLike'), - 'isPlainObject': require('./isPlainObject'), - 'isRegExp': require('./isRegExp'), - 'isSafeInteger': require('./isSafeInteger'), - 'isSet': require('./isSet'), - 'isString': require('./isString'), - 'isSymbol': require('./isSymbol'), - 'isTypedArray': require('./isTypedArray'), - 'isUndefined': require('./isUndefined'), - 'isWeakMap': require('./isWeakMap'), - 'isWeakSet': require('./isWeakSet'), - 'lt': require('./lt'), - 'lte': require('./lte'), - 'toArray': require('./toArray'), - 'toFinite': require('./toFinite'), - 'toInteger': require('./toInteger'), - 'toLength': require('./toLength'), - 'toNumber': require('./toNumber'), - 'toPlainObject': require('./toPlainObject'), - 'toSafeInteger': require('./toSafeInteger'), - 'toString': require('./toString') -}; diff --git a/node_modules/lodash/last.js b/node_modules/lodash/last.js deleted file mode 100644 index cad1eafa..00000000 --- a/node_modules/lodash/last.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ -function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined; -} - -module.exports = last; diff --git a/node_modules/lodash/lastIndexOf.js b/node_modules/lodash/lastIndexOf.js deleted file mode 100644 index dabfb613..00000000 --- a/node_modules/lodash/lastIndexOf.js +++ /dev/null @@ -1,46 +0,0 @@ -var baseFindIndex = require('./_baseFindIndex'), - baseIsNaN = require('./_baseIsNaN'), - strictLastIndexOf = require('./_strictLastIndexOf'), - toInteger = require('./toInteger'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max, - nativeMin = Math.min; - -/** - * This method is like `_.indexOf` except that it iterates over elements of - * `array` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.lastIndexOf([1, 2, 1, 2], 2); - * // => 3 - * - * // Search from the `fromIndex`. - * _.lastIndexOf([1, 2, 1, 2], 2, 2); - * // => 1 - */ -function lastIndexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); - } - return value === value - ? strictLastIndexOf(array, value, index) - : baseFindIndex(array, baseIsNaN, index, true); -} - -module.exports = lastIndexOf; diff --git a/node_modules/lodash/lodash.js b/node_modules/lodash/lodash.js deleted file mode 100644 index 4131e936..00000000 --- a/node_modules/lodash/lodash.js +++ /dev/null @@ -1,17209 +0,0 @@ -/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; - - /** Used as the semantic version number. */ - var VERSION = '4.17.21'; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** Error message constants. */ - var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', - FUNC_ERROR_TEXT = 'Expected a function', - INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** Used as the maximum memoize cache size. */ - var MAX_MEMOIZE_SIZE = 500; - - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG = 4; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** Used to compose bitmasks for function metadata. */ - var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_BOUND_FLAG = 4, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256, - WRAP_FLIP_FLAG = 512; - - /** Used as default options for `_.truncate`. */ - var DEFAULT_TRUNC_LENGTH = 30, - DEFAULT_TRUNC_OMISSION = '...'; - - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 800, - HOT_SPAN = 16; - - /** Used to indicate the type of lazy iteratees. */ - var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_WHILE_FLAG = 3; - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; - - /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - - /** Used to associate wrap methods with their bit flags. */ - var wrapFlags = [ - ['ary', WRAP_ARY_FLAG], - ['bind', WRAP_BIND_FLAG], - ['bindKey', WRAP_BIND_KEY_FLAG], - ['curry', WRAP_CURRY_FLAG], - ['curryRight', WRAP_CURRY_RIGHT_FLAG], - ['flip', WRAP_FLIP_FLAG], - ['partial', WRAP_PARTIAL_FLAG], - ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], - ['rearg', WRAP_REARG_FLAG] - ]; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - asyncTag = '[object AsyncFunction]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - domExcTag = '[object DOMException]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - nullTag = '[object Null]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - proxyTag = '[object Proxy]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - undefinedTag = '[object Undefined]', - weakMapTag = '[object WeakMap]', - weakSetTag = '[object WeakSet]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to match empty string literals in compiled template source. */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** Used to match HTML entities and HTML characters. */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g, - reHasEscapedHtml = RegExp(reEscapedHtml.source), - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - - /** Used to match template delimiters. */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - - /** Used to match leading whitespace. */ - var reTrimStart = /^\s+/; - - /** Used to match a single whitespace character. */ - var reWhitespace = /\s/; - - /** Used to match wrap detail comments. */ - var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, - reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, - reSplitDetails = /,? & /; - - /** Used to match words composed of alphanumeric characters. */ - var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - - /** - * Used to validate the `validate` option in `_.template` variable. - * - * Forbids characters which could potentially change the meaning of the function argument definition: - * - "()," (modification of function parameters) - * - "=" (default value) - * - "[]{}" (destructuring of function parameters) - * - "/" (beginning of a comment) - * - whitespace - */ - var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; - - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; - - /** - * Used to match - * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - - /** Used to ensure capturing order of template delimiters. */ - var reNoMatch = /($^)/; - - /** Used to match unescaped characters in compiled string literals. */ - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - - /** Used to compose unicode character classes. */ - var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - - /** Used to compose unicode capture groups. */ - var rsApos = "['\u2019]", - rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - - /** Used to compose unicode regexes. */ - var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', - rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', - rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - - /** Used to match apostrophes. */ - var reApos = RegExp(rsApos, 'g'); - - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); - - /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ - var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - - /** Used to match complex or compound words. */ - var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', - rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, - rsUpper + '+' + rsOptContrUpper, - rsOrdUpper, - rsOrdLower, - rsDigits, - rsEmoji - ].join('|'), 'g'); - - /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - - /** Used to detect strings that need a more robust regexp to match words. */ - var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - - /** Used to assign default `context` object properties. */ - var contextProps = [ - 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', - 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', - 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' - ]; - - /** Used to make template sourceURLs easier to identify. */ - var templateCounter = -1; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; - - /** Used to identify `toStringTag` values supported by `_.clone`. */ - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; - - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to map HTML entities to characters. */ - var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'" - }; - - /** Used to escape characters for inclusion in compiled string literals. */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Built-in method references without a dependency on `root`. */ - var freeParseFloat = parseFloat, - freeParseInt = parseInt; - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - /* Node.js helper references. */ - var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, - nodeIsDate = nodeUtil && nodeUtil.isDate, - nodeIsMap = nodeUtil && nodeUtil.isMap, - nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, - nodeIsSet = nodeUtil && nodeUtil.isSet, - nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /*--------------------------------------------------------------------------*/ - - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } - - /** - * A specialized version of `baseAggregator` for arrays. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; - } - - /** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.forEachRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; - - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.every` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - */ - function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; - } - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; - } - - /** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; - } - - /** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array == null ? 0 : array.length; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; - } - - /** - * A specialized version of `_.reduceRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array == null ? 0 : array.length; - if (initAccum && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; - } - - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Gets the size of an ASCII `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - var asciiSize = baseProperty('length'); - - /** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function asciiToArray(string) { - return string.split(''); - } - - /** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function asciiWords(string) { - return string.match(reAsciiWord) || []; - } - - /** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the found element or its key, else `undefined`. - */ - function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = key; - return false; - } - }); - return result; - } - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); - } - - /** - * This function is like `baseIndexOf` except that it accepts a comparator. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @param {Function} comparator The comparator invoked per element. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ - function baseIsNaN(value) { - return value !== value; - } - - /** - * The base implementation of `_.mean` and `_.meanBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the mean. - */ - function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? (baseSum(array, iteratee) / length) : NAN; - } - - /** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for iteratee shorthands, which iterates over `collection` using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of - * `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ - function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.sortBy` which uses `comparer` to define the - * sort order of `array` and replaces criteria objects with their corresponding - * values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ - function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; - } - - /** - * The base implementation of `_.sum` and `_.sumBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. - */ - function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; - - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } - } - return result; - } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. - */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); - } - - /** - * The base implementation of `_.trim`. - * - * @private - * @param {string} string The string to trim. - * @returns {string} Returns the trimmed string. - */ - function baseTrim(string) { - return string - ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') - : string; - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - /** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ - function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); - } - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - /** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ - function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; - - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Gets the number of `placeholder` occurrences in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} placeholder The placeholder to search for. - * @returns {number} Returns the placeholder count. - */ - function countHolders(array, placeholder) { - var length = array.length, - result = 0; - - while (length--) { - if (array[length] === placeholder) { - ++result; - } - } - return result; - } - - /** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ - var deburrLetter = basePropertyOf(deburredLetters); - - /** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - var escapeHtmlChar = basePropertyOf(htmlEscapes); - - /** - * Used by `_.template` to escape characters for inclusion in compiled string literals. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ - function hasUnicode(string) { - return reHasUnicode.test(string); - } - - /** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ - function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); - } - - /** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; - } - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - /** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. - * - * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value === placeholder || value === PLACEHOLDER) { - array[index] = PLACEHOLDER; - result[resIndex++] = index; - } - } - return result; - } - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; - } - - /** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; - } - - /** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * A specialized version of `_.lastIndexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; - } - - /** - * Gets the number of symbols in `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. - */ - function stringSize(string) { - return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); - } - - /** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace - * character of `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the index of the last non-whitespace character. - */ - function trimmedEndIndex(string) { - var index = string.length; - - while (index-- && reWhitespace.test(string.charAt(index))) {} - return index; - } - - /** - * Used by `_.unescape` to convert HTML entities to characters. - * - * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - - /** - * Gets the size of a Unicode `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - function unicodeSize(string) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { - ++result; - } - return result; - } - - /** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function unicodeToArray(string) { - return string.match(reUnicode) || []; - } - - /** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function unicodeWords(string) { - return string.match(reUnicodeWord) || []; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new pristine `lodash` function using the `context` object. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Util - * @param {Object} [context=root] The context object. - * @returns {Function} Returns a new `lodash` function. - * @example - * - * _.mixin({ 'foo': _.constant('foo') }); - * - * var lodash = _.runInContext(); - * lodash.mixin({ 'bar': lodash.constant('bar') }); - * - * _.isFunction(_.foo); - * // => true - * _.isFunction(_.bar); - * // => false - * - * lodash.isFunction(lodash.foo); - * // => false - * lodash.isFunction(lodash.bar); - * // => true - * - * // Create a suped-up `defer` in Node.js. - * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; - */ - var runInContext = (function runInContext(context) { - context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); - - /** Built-in constructor references. */ - var Array = context.Array, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** Used for built-in method references. */ - var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - - /** Used to detect overreaching core-js shims. */ - var coreJsData = context['__core-js_shared__']; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to generate unique IDs. */ - var idCounter = 0; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** Used to infer the `Object` constructor. */ - var objectCtorString = funcToString.call(Object); - - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** Built-in value references. */ - var Buffer = moduleExports ? context.Buffer : undefined, - Symbol = context.Symbol, - Uint8Array = context.Uint8Array, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice, - spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, - symIterator = Symbol ? Symbol.iterator : undefined, - symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); - - /** Mocked built-ins. */ - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, - ctxNow = Date && Date.now !== root.Date.now && Date.now, - ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeCeil = Math.ceil, - nativeFloor = Math.floor, - nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeIsFinite = context.isFinite, - nativeJoin = arrayProto.join, - nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max, - nativeMin = Math.min, - nativeNow = Date.now, - nativeParseInt = context.parseInt, - nativeRandom = Math.random, - nativeReverse = arrayProto.reverse; - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(context, 'DataView'), - Map = getNative(context, 'Map'), - Promise = getNative(context, 'Promise'), - Set = getNative(context, 'Set'), - WeakMap = getNative(context, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - - /** Used to store function metadata. */ - var metaMap = WeakMap && new WeakMap; - - /** Used to lookup unminified function names. */ - var realNames = {}; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chain sequences. Methods that operate on and return arrays, collections, - * and functions can be chained together. Methods that retrieve a single value - * or may return a primitive value will automatically end the chain sequence - * and return the unwrapped value. Otherwise, the value must be unwrapped - * with `_#value`. - * - * Explicit chain sequences, which must be unwrapped with `_#value`, may be - * enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, it's deferred until - * `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. - * Shortcut fusion is an optimization to merge iteratee calls; this avoids - * the creation of intermediate arrays and can greatly reduce the number of - * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array and iteratees accept only - * one argument. The heuristic for whether a section qualifies for shortcut - * fusion is subject to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, - * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, - * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, - * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, - * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, - * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, - * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, - * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, - * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, - * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, - * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, - * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, - * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, - * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, - * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, - * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, - * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, - * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, - * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, - * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, - * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, - * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, - * `zipObject`, `zipObjectDeep`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, - * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, - * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, - * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, - * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, - * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Seq - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // Returns an unwrapped value. - * wrapped.reduce(_.add); - * // => 6 - * - * // Returns a wrapped value. - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { - if (value instanceof LodashWrapper) { - return value; - } - if (hasOwnProperty.call(value, '__wrapped__')) { - return wrapperClone(value); - } - } - return new LodashWrapper(value); - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - /** - * The function whose prototype chain sequence wrappers inherit from. - * - * @private - */ - function baseLodash() { - // No operation performed. - } - - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; - } - - /** - * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB) as well as ES2015 template strings. Change the - * following template settings to use alternative delimiters. - * - * @static - * @memberOf _ - * @type {Object} - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'escape': reEscape, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'evaluate': reEvaluate, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type {string} - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type {Object} - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type {Function} - */ - '_': lodash - } - }; - - // Ensure wrappers are instances of `baseLodash`. - lodash.prototype = baseLodash.prototype; - lodash.prototype.constructor = lodash; - - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @constructor - * @param {*} value The value to wrap. - */ - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } - - /** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ - function lazyClone() { - var result = new LazyWrapper(this.__wrapped__); - result.__actions__ = copyArray(this.__actions__); - result.__dir__ = this.__dir__; - result.__filtered__ = this.__filtered__; - result.__iteratees__ = copyArray(this.__iteratees__); - result.__takeCount__ = this.__takeCount__; - result.__views__ = copyArray(this.__views__); - return result; - } - - /** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ - function lazyReverse() { - if (this.__filtered__) { - var result = new LazyWrapper(this); - result.__dir__ = -1; - result.__filtered__ = true; - } else { - result = this.clone(); - result.__dir__ *= -1; - } - return result; - } - - /** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ - function lazyValue() { - var array = this.__wrapped__.value(), - dir = this.__dir__, - isArr = isArray(array), - isRight = dir < 0, - arrLength = isArr ? array.length : 0, - view = getView(0, arrLength, this.__views__), - start = view.start, - end = view.end, - length = end - start, - index = isRight ? end : (start - 1), - iteratees = this.__iteratees__, - iterLength = iteratees.length, - resIndex = 0, - takeCount = nativeMin(length, this.__takeCount__); - - if (!isArr || (!isRight && arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; - - outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result[resIndex++] = value; - } - return result; - } - - // Ensure `LazyWrapper` is an instance of `baseLodash`. - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; - } - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); - } - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } - } - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache; - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; - } - - /** - * A specialized version of `_.sample` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @returns {*} Returns the random element. - */ - function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined; - } - - /** - * A specialized version of `_.sampleSize` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); - } - - /** - * A specialized version of `_.shuffle` for arrays. - * - * @private - * @param {Array} array The array to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); - } - - /** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** - * Aggregates elements of `collection` on `accumulator` with keys transformed - * by `iteratee` and values set by `setter`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function(value, key, collection) { - setter(accumulator, value, iteratee(value), collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - - /** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); - } - - /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function baseAssignValue(object, key, value) { - if (key == '__proto__' && defineProperty) { - defineProperty(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } - } - - /** - * The base implementation of `_.at` without support for individual paths. - * - * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths to pick. - * @returns {Array} Returns the picked elements. - */ - function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; - - while (++index < length) { - result[index] = skip ? undefined : get(object, paths[index]); - } - return result; - } - - /** - * The base implementation of `_.clamp` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - */ - function baseClamp(number, lower, upper) { - if (number === number) { - if (upper !== undefined) { - number = number <= upper ? number : upper; - } - if (lower !== undefined) { - number = number >= lower ? number : lower; - } - } - return number; - } - - /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, bitmask, customizer, key, object, stack) { - var result, - isDeep = bitmask & CLONE_DEEP_FLAG, - isFlat = bitmask & CLONE_FLAT_FLAG, - isFull = bitmask & CLONE_SYMBOLS_FLAG; - - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = (isFlat || isFunc) ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - } - - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); - - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - return result; - } - - /** - * The base implementation of `_.conforms` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. - */ - function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; - } - - /** - * The base implementation of `_.conformsTo` which accepts `props` to check. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - */ - function baseConformsTo(object, source, props) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object(object); - while (length--) { - var key = props[length], - predicate = source[key], - value = object[key]; - - if ((value === undefined && !(key in object)) || !predicate(value)) { - return false; - } - } - return true; - } - - /** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. - */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * The base implementation of methods like `_.difference` without support - * for excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ - function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.forEach` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEach = createBaseEach(baseForOwn); - - /** - * The base implementation of `_.forEachRight` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEachRight = createBaseEach(baseForOwnRight, true); - - /** - * The base implementation of `_.every` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` - */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; - } - - /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ - function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; - } - - /** - * The base implementation of `_.fill` without an iteratee call guard. - * - * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - */ - function baseFill(array, value, start, end) { - var length = array.length; - - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; - } - - /** - * The base implementation of `_.filter` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; - } - - /** - * The base implementation of `_.flatten` with support for restricting flattening. - * - * @private - * @param {Array} array The array to flatten. - * @param {number} depth The maximum recursion depth. - * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. - * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. - */ - function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, - length = array.length; - - predicate || (predicate = isFlattenable); - result || (result = []); - - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; - } - - /** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseFor = createBaseFor(); - - /** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseForRight = createBaseFor(true); - - /** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); - } - - /** - * The base implementation of `_.forOwnRight` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); - } - - /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. - */ - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ - function baseGet(object, path) { - path = castPath(path, object); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - return (index && index == length) ? object : undefined; - } - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } - - /** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ - function baseGt(value, other) { - return value > other; - } - - /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); - } - - /** - * The base implementation of `_.hasIn` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHasIn(object, key) { - return object != null && key in Object(object); - } - - /** - * The base implementation of `_.inRange` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to check. - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - */ - function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); - } - - /** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ - function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - length = arrays[0].length, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - maxLength = Infinity, - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - maxLength = nativeMin(array.length, maxLength); - caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - seen = caches[0]; - - outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) - )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) - ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.invert` and `_.invertBy` which inverts - * `object` with values transformed by `iteratee` and set by `setter`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform values. - * @param {Object} accumulator The initial inverted object. - * @returns {Function} Returns `accumulator`. - */ - function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function(value, key, object) { - setter(accumulator, iteratee(value), key, object); - }); - return accumulator; - } - - /** - * The base implementation of `_.invoke` without support for individual - * method arguments. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - */ - function baseInvoke(object, path, args) { - path = castPath(path, object); - object = parent(object, path); - var func = object == null ? object : object[toKey(last(path))]; - return func == null ? undefined : apply(func, object, args); - } - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; - } - - /** - * The base implementation of `_.isArrayBuffer` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - */ - function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; - } - - /** - * The base implementation of `_.isDate` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - */ - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag(object), - othTag = othIsArr ? arrayTag : getTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - - /** - * The base implementation of `_.isMap` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - */ - function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; - } - - /** - * The base implementation of `_.isMatch` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ - function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var stack = new Stack; - if (customizer) { - var result = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { - return false; - } - } - } - return true; - } - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * The base implementation of `_.isRegExp` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - */ - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; - } - - /** - * The base implementation of `_.isSet` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - */ - function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; - } - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ - function baseIteratee(value) { - // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. - // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. - if (typeof value == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (typeof value == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); - } - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.lt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - */ - function baseLt(value, other) { - return value < other; - } - - /** - * The base implementation of `_.map` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; - } - - /** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - return matchesStrictComparable(matchData[0][0], matchData[0][1]); - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; - } - - /** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatchesProperty(path, srcValue) { - if (isKey(path) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path), srcValue); - } - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); - }; - } - - /** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - baseFor(source, function(srcValue, key) { - stack || (stack = new Stack); - if (isObject(srcValue)) { - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } - else { - var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; - - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }, keysIn); - } - - /** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = safeGet(object, key), - srcValue = safeGet(source, key), - stacked = stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; - - var isCommon = newValue === undefined; - - if (isCommon) { - var isArr = isArray(srcValue), - isBuff = !isArr && isBuffer(srcValue), - isTyped = !isArr && !isBuff && isTypedArray(srcValue); - - newValue = srcValue; - if (isArr || isBuff || isTyped) { - if (isArray(objValue)) { - newValue = objValue; - } - else if (isArrayLikeObject(objValue)) { - newValue = copyArray(objValue); - } - else if (isBuff) { - isCommon = false; - newValue = cloneBuffer(srcValue, true); - } - else if (isTyped) { - isCommon = false; - newValue = cloneTypedArray(srcValue, true); - } - else { - newValue = []; - } - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - newValue = objValue; - if (isArguments(objValue)) { - newValue = toPlainObject(objValue); - } - else if (!isObject(objValue) || isFunction(objValue)) { - newValue = initCloneObject(srcValue); - } - } - else { - isCommon = false; - } - } - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); - } - assignMergeValue(object, key, newValue); - } - - /** - * The base implementation of `_.nth` which doesn't coerce arguments. - * - * @private - * @param {Array} array The array to query. - * @param {number} n The index of the element to return. - * @returns {*} Returns the nth element of `array`. - */ - function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined; - } - - /** - * The base implementation of `_.orderBy` without param guards. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. - */ - function baseOrderBy(collection, iteratees, orders) { - if (iteratees.length) { - iteratees = arrayMap(iteratees, function(iteratee) { - if (isArray(iteratee)) { - return function(value) { - return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); - } - } - return iteratee; - }); - } else { - iteratees = [identity]; - } - - var index = -1; - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); - - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); - } - - /** - * The base implementation of `_.pick` without support for individual - * property identifiers. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. - */ - function basePick(object, paths) { - return basePickBy(object, paths, function(value, path) { - return hasIn(object, path); - }); - } - - /** - * The base implementation of `_.pickBy` without support for iteratee shorthands. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. - */ - function basePickBy(object, paths, predicate) { - var index = -1, - length = paths.length, - result = {}; - - while (++index < length) { - var path = paths[index], - value = baseGet(object, path); - - if (predicate(value, path)) { - baseSet(result, castPath(path, object), value); - } - } - return result; - } - - /** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; - } - - /** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - */ - function basePullAll(array, values, iteratee, comparator) { - var indexOf = comparator ? baseIndexOfWith : baseIndexOf, - index = -1, - length = values.length, - seen = array; - - if (array === values) { - values = copyArray(values); - } - if (iteratee) { - seen = arrayMap(array, baseUnary(iteratee)); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; - } - - /** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ - function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; - - while (length--) { - var index = indexes[length]; - if (length == lastIndex || index !== previous) { - var previous = index; - if (isIndex(index)) { - splice.call(array, index, 1); - } else { - baseUnset(array, index); - } - } - } - return array; - } - - /** - * The base implementation of `_.random` without support for returning - * floating-point numbers. - * - * @private - * @param {number} lower The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the random number. - */ - function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); - } - - /** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. - * - * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. - */ - function baseRange(start, end, step, fromRight) { - var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); - - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; - } - - /** - * The base implementation of `_.repeat` which doesn't coerce arguments. - * - * @private - * @param {string} string The string to repeat. - * @param {number} n The number of times to repeat the string. - * @returns {string} Returns the repeated string. - */ - function baseRepeat(string, n) { - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; - } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - if (n) { - string += string; - } - } while (n); - - return result; - } - - /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); - } - - /** - * The base implementation of `_.sample`. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - */ - function baseSample(collection) { - return arraySample(values(collection)); - } - - /** - * The base implementation of `_.sampleSize` without param guards. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); - } - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; - } - path = castPath(path, object); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; - - if (key === '__proto__' || key === 'constructor' || key === 'prototype') { - return object; - } - - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); - } - } - assignValue(nested, key, newValue); - nested = nested[key]; - } - return object; - } - - /** - * The base implementation of `setData` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; - - /** - * The base implementation of `setToString` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var baseSetToString = !defineProperty ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true - }); - }; - - /** - * The base implementation of `_.shuffle`. - * - * @private - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function baseShuffle(collection) { - return shuffleSelf(values(collection)); - } - - /** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; - } - - /** - * The base implementation of `_.some` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; - } - - /** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array == null ? low : array.length; - - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; - - if (computed !== null && !isSymbol(computed) && - (retHighest ? (computed <= value) : (computed < value))) { - low = mid + 1; - } else { - high = mid; - } - } - return high; - } - return baseSortedIndexBy(array, value, identity, retHighest); - } - - /** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which invokes `iteratee` for `value` and each element of `array` to compute - * their sort ranking. The iteratee is invoked with one argument; (value). - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} iteratee The iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndexBy(array, value, iteratee, retHighest) { - var low = 0, - high = array == null ? 0 : array.length; - if (high === 0) { - return 0; - } - - value = iteratee(value); - var valIsNaN = value !== value, - valIsNull = value === null, - valIsSymbol = isSymbol(value), - valIsUndefined = value === undefined; - - while (low < high) { - var mid = nativeFloor((low + high) / 2), - computed = iteratee(array[mid]), - othIsDefined = computed !== undefined, - othIsNull = computed === null, - othIsReflexive = computed === computed, - othIsSymbol = isSymbol(computed); - - if (valIsNaN) { - var setLow = retHighest || othIsReflexive; - } else if (valIsUndefined) { - setLow = othIsReflexive && (retHighest || othIsDefined); - } else if (valIsNull) { - setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); - } else if (valIsSymbol) { - setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); - } else if (othIsNull || othIsSymbol) { - setLow = false; - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - - /** - * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseSortedUniq(array, iteratee) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!index || !eq(computed, seen)) { - var seen = computed; - result[resIndex++] = value === 0 ? 0 : value; - } - } - return result; - } - - /** - * The base implementation of `_.toNumber` which doesn't ensure correct - * conversions of binary, hexadecimal, or octal string values. - * - * @private - * @param {*} value The value to process. - * @returns {number} Returns the number. - */ - function baseToNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - return +value; - } - - /** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ - function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.unset`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The property path to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - */ - function baseUnset(object, path) { - path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; - } - - /** - * The base implementation of `_.update`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to update. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseUpdate(object, path, updater, customizer) { - return baseSet(object, path, updater(baseGet(object, path)), customizer); - } - - /** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} - - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); - } - - /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ - function baseWrapperValue(value, actions) { - var result = value; - if (result instanceof LazyWrapper) { - result = result.value(); - } - return arrayReduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); - } - - /** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ - function baseXor(arrays, iteratee, comparator) { - var length = arrays.length; - if (length < 2) { - return length ? baseUniq(arrays[0]) : []; - } - var index = -1, - result = Array(length); - - while (++index < length) { - var array = arrays[index], - othIndex = -1; - - while (++othIndex < length) { - if (othIndex != index) { - result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); - } - } - } - return baseUniq(baseFlatten(result, 1), iteratee, comparator); - } - - /** - * This base implementation of `_.zipObject` which assigns values using `assignFunc`. - * - * @private - * @param {Array} props The property identifiers. - * @param {Array} values The property values. - * @param {Function} assignFunc The function to assign values. - * @returns {Object} Returns the new object. - */ - function baseZipObject(props, values, assignFunc) { - var index = -1, - length = props.length, - valsLength = values.length, - result = {}; - - while (++index < length) { - var value = index < valsLength ? values[index] : undefined; - assignFunc(result, props[index], value); - } - return result; - } - - /** - * Casts `value` to an empty array if it's not an array like object. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array|Object} Returns the cast array-like object. - */ - function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; - } - - /** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Function} Returns cast function. - */ - function castFunction(value) { - return typeof value == 'function' ? value : identity; - } - - /** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @param {Object} [object] The object to query keys on. - * @returns {Array} Returns the cast property path array. - */ - function castPath(value, object) { - if (isArray(value)) { - return value; - } - return isKey(value, object) ? [value] : stringToPath(toString(value)); - } - - /** - * A `baseRest` alias which can be replaced with `identity` by module - * replacement plugins. - * - * @private - * @type {Function} - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - var castRest = baseRest; - - /** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ - function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); - } - - /** - * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). - * - * @private - * @param {number|Object} id The timer id or timeout object of the timer to clear. - */ - var clearTimeout = ctxClearTimeout || function(id) { - return root.clearTimeout(id); - }; - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; - } - - /** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; - } - - /** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); - } - - /** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ - function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; - } - - /** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ - function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; - } - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); - } - - /** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = isSymbol(value); - - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = isSymbol(other); - - if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || - (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || - (valIsNull && othIsDefined && othIsReflexive) || - (!valIsDefined && othIsReflexive) || - !valIsReflexive) { - return 1; - } - if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || - (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || - (othIsNull && valIsDefined && valIsReflexive) || - (!othIsDefined && valIsReflexive) || - !othIsReflexive) { - return -1; - } - } - return 0; - } - - /** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. - * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order - * of corresponding values. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {boolean[]|string[]} orders The order to sort by for each property. - * @returns {number} Returns the sort order indicator for `object`. - */ - function compareMultiple(object, other, orders) { - var index = -1, - objCriteria = object.criteria, - othCriteria = other.criteria, - length = objCriteria.length, - ordersLength = orders.length; - - while (++index < length) { - var result = compareAscending(objCriteria[index], othCriteria[index]); - if (result) { - if (index >= ordersLength) { - return result; - } - var order = orders[index]; - return result * (order == 'desc' ? -1 : 1); - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value for - // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 - // for more details. - // - // This also ensures a stable sort in V8 and other engines. - // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. - return object.index - other.index; - } - - /** - * Creates an array that is the composition of partially applied arguments, - * placeholders, and provided arguments into a single array of arguments. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to prepend to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgs(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersLength = holders.length, - leftIndex = -1, - leftLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(leftLength + rangeLength), - isUncurried = !isCurried; - - while (++leftIndex < leftLength) { - result[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[holders[argsIndex]] = args[argsIndex]; - } - } - while (rangeLength--) { - result[leftIndex++] = args[argsIndex++]; - } - return result; - } - - /** - * This function is like `composeArgs` except that the arguments composition - * is tailored for `_.partialRight`. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to append to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgsRight(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersIndex = -1, - holdersLength = holders.length, - rightIndex = -1, - rightLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(rangeLength + rightLength), - isUncurried = !isCurried; - - while (++argsIndex < rangeLength) { - result[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; - } - } - return result; - } - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; - } - - /** - * Copies own symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); - } - - /** - * Copies own and inherited symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); - } - - /** - * Creates a function like `_.groupBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} [initializer] The accumulator object initializer. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var func = isArray(collection) ? arrayAggregator : baseAggregator, - accumulator = initializer ? initializer() : {}; - - return func(collection, setter, getIteratee(iteratee, 2), accumulator); - }; - } - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); - } - - /** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; - } - - /** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; - } - - /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg`. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createBind(func, bitmask, thisArg) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return fn.apply(isBind ? thisArg : this, arguments); - } - return wrapper; - } - - /** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ - function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; - } - - /** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ - function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; - } - - /** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ - function createCtor(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. See - // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - switch (args.length) { - case 0: return new Ctor; - case 1: return new Ctor(args[0]); - case 2: return new Ctor(args[0], args[1]); - case 3: return new Ctor(args[0], args[1], args[2]); - case 4: return new Ctor(args[0], args[1], args[2], args[3]); - case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - } - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; - } - - /** - * Creates a function that wraps `func` to enable currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {number} arity The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createCurry(func, bitmask, arity) { - var Ctor = createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length, - placeholder = getHolder(wrapper); - - while (index--) { - args[index] = arguments[index]; - } - var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); - - length -= holders.length; - if (length < arity) { - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); - } - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return apply(fn, this, args); - } - return wrapper; - } - - /** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike(collection)) { - var iteratee = getIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { return iteratee(iterable[key], key, iterable); }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; - }; - } - - /** - * Creates a `_.flow` or `_.flowRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new flow function. - */ - function createFlow(fromRight) { - return flatRest(function(funcs) { - var length = funcs.length, - index = length, - prereq = LodashWrapper.prototype.thru; - - if (fromRight) { - funcs.reverse(); - } - while (index--) { - var func = funcs[index]; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (prereq && !wrapper && getFuncName(func) == 'wrapper') { - var wrapper = new LodashWrapper([], true); - } - } - index = wrapper ? index : length; - while (++index < length) { - func = funcs[index]; - - var funcName = getFuncName(func), - data = funcName == 'wrapper' ? getData(func) : undefined; - - if (data && isLaziable(data[0]) && - data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && - !data[4].length && data[9] == 1 - ) { - wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); - } else { - wrapper = (func.length == 1 && isLaziable(func)) - ? wrapper[funcName]() - : wrapper.thru(func); - } - } - return function() { - var args = arguments, - value = args[0]; - - if (wrapper && args.length == 1 && isArray(value)) { - return wrapper.plant(value).value(); - } - var index = 0, - result = length ? funcs[index].apply(this, args) : value; - - while (++index < length) { - result = funcs[index].call(this, result); - } - return result; - }; - }); - } - - /** - * Creates a function that wraps `func` to invoke it with optional `this` - * binding of `thisArg`, partial application, and currying. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided - * to the new function. - * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { - var isAry = bitmask & WRAP_ARY_FLAG, - isBind = bitmask & WRAP_BIND_FLAG, - isBindKey = bitmask & WRAP_BIND_KEY_FLAG, - isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), - isFlip = bitmask & WRAP_FLIP_FLAG, - Ctor = isBindKey ? undefined : createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length; - - while (index--) { - args[index] = arguments[index]; - } - if (isCurried) { - var placeholder = getHolder(wrapper), - holdersCount = countHolders(args, placeholder); - } - if (partials) { - args = composeArgs(args, partials, holders, isCurried); - } - if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight, isCurried); - } - length -= holdersCount; - if (isCurried && length < arity) { - var newHolders = replaceHolders(args, placeholder); - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length - ); - } - var thisBinding = isBind ? thisArg : this, - fn = isBindKey ? thisBinding[func] : func; - - length = args.length; - if (argPos) { - args = reorder(args, argPos); - } else if (isFlip && length > 1) { - args.reverse(); - } - if (isAry && ary < length) { - args.length = ary; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtor(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; - } - - /** - * Creates a function like `_.invertBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} toIteratee The function to resolve iteratees. - * @returns {Function} Returns the new inverter function. - */ - function createInverter(setter, toIteratee) { - return function(object, iteratee) { - return baseInverter(object, setter, toIteratee(iteratee), {}); - }; - } - - /** - * Creates a function that performs a mathematical operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @param {number} [defaultValue] The value used for `undefined` arguments. - * @returns {Function} Returns the new mathematical operation function. - */ - function createMathOperation(operator, defaultValue) { - return function(value, other) { - var result; - if (value === undefined && other === undefined) { - return defaultValue; - } - if (value !== undefined) { - result = value; - } - if (other !== undefined) { - if (result === undefined) { - return other; - } - if (typeof value == 'string' || typeof other == 'string') { - value = baseToString(value); - other = baseToString(other); - } else { - value = baseToNumber(value); - other = baseToNumber(other); - } - result = operator(value, other); - } - return result; - }; - } - - /** - * Creates a function like `_.over`. - * - * @private - * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new over function. - */ - function createOver(arrayFunc) { - return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - return baseRest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee) { - return apply(iteratee, thisArg, args); - }); - }); - }); - } - - /** - * Creates the padding for `string` based on `length`. The `chars` string - * is truncated if the number of characters exceeds `length`. - * - * @private - * @param {number} length The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padding for `string`. - */ - function createPadding(length, chars) { - chars = chars === undefined ? ' ' : baseToString(chars); - - var charsLength = chars.length; - if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; - } - var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) - ? castSlice(stringToArray(result), 0, length).join('') - : result.slice(0, length); - } - - /** - * Creates a function that wraps `func` to invoke it with the `this` binding - * of `thisArg` and `partials` prepended to the arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to - * the new function. - * @returns {Function} Returns the new wrapped function. - */ - function createPartial(func, bitmask, thisArg, partials) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return apply(fn, isBind ? thisArg : this, args); - } - return wrapper; - } - - /** - * Creates a `_.range` or `_.rangeRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new range function. - */ - function createRange(fromRight) { - return function(start, end, step) { - if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { - end = step = undefined; - } - // Ensure the sign of `-0` is preserved. - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); - return baseRange(start, end, step, fromRight); - }; - } - - /** - * Creates a function that performs a relational operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @returns {Function} Returns the new relational operation function. - */ - function createRelationalOperation(operator) { - return function(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { - value = toNumber(value); - other = toNumber(other); - } - return operator(value, other); - }; - } - - /** - * Creates a function that wraps `func` to continue currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder value. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { - var isCurry = bitmask & WRAP_CURRY_FLAG, - newHolders = isCurry ? holders : undefined, - newHoldersRight = isCurry ? undefined : holders, - newPartials = isCurry ? partials : undefined, - newPartialsRight = isCurry ? undefined : partials; - - bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); - bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); - - if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { - bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); - } - var newData = [ - func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, - newHoldersRight, argPos, ary, arity - ]; - - var result = wrapFunc.apply(undefined, newData); - if (isLaziable(func)) { - setData(result, newData); - } - result.placeholder = placeholder; - return setWrapToString(result, func, bitmask); - } - - /** - * Creates a function like `_.round`. - * - * @private - * @param {string} methodName The name of the `Math` method to use when rounding. - * @returns {Function} Returns the new round function. - */ - function createRound(methodName) { - var func = Math[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision && nativeIsFinite(number)) { - // Shift with exponential notation to avoid floating-point issues. - // See [MDN](https://mdn.io/round#Examples) for more details. - var pair = (toString(number) + 'e').split('e'), - value = func(pair[0] + 'e' + (+pair[1] + precision)); - - pair = (toString(value) + 'e').split('e'); - return +(pair[0] + 'e' + (+pair[1] - precision)); - } - return func(number); - }; - } - - /** - * Creates a set object of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ - var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { - return new Set(values); - }; - - /** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ - function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; - } - - /** - * Creates a function that either curries or invokes `func` with optional - * `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` or `_.curryRight` of a bound function - * 8 - `_.curry` - * 16 - `_.curryRight` - * 32 - `_.partial` - * 64 - `_.partialRight` - * 128 - `_.rearg` - * 256 - `_.ary` - * 512 - `_.flip` - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to be partially applied. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { - var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; - if (!isBindKey && typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); - partials = holders = undefined; - } - ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); - arity = arity === undefined ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - - if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, - holdersRight = holders; - - partials = holders = undefined; - } - var data = isBindKey ? undefined : getData(func); - - var newData = [ - func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, - argPos, ary, arity - ]; - - if (data) { - mergeData(newData, data); - } - func = newData[0]; - bitmask = newData[1]; - thisArg = newData[2]; - partials = newData[3]; - holders = newData[4]; - arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); - - if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { - bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); - } - if (!bitmask || bitmask == WRAP_BIND_FLAG) { - var result = createBind(func, bitmask, thisArg); - } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { - result = createCurry(func, bitmask, arity); - } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { - result = createPartial(func, bitmask, thisArg, partials); - } else { - result = createHybrid.apply(undefined, newData); - } - var setter = data ? baseSetData : setData; - return setWrapToString(setter(result, newData), func, bitmask); - } - - /** - * Used by `_.defaults` to customize its `_.assignIn` use to assign properties - * of source objects to the destination object for all destination properties - * that resolve to `undefined`. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ - function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; - } - - /** - * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source - * objects into destination objects that are passed thru. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - * @returns {*} Returns the value to assign. - */ - function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); - stack['delete'](srcValue); - } - return objValue; - } - - /** - * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain - * objects. - * - * @private - * @param {*} value The value to inspect. - * @param {string} key The key of the property to inspect. - * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. - */ - function customOmitClone(value) { - return isPlainObject(value) ? undefined : value; - } - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseRest` which flattens the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - function flatRest(func) { - return setToString(overRest(func, undefined, flatten), func + ''); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /** - * Creates an array of own and inherited enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); - } - - /** - * Gets metadata for `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {*} Returns the metadata for `func`. - */ - var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); - }; - - /** - * Gets the name of `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {string} Returns the function name. - */ - function getFuncName(func) { - var result = (func.name + ''), - array = realNames[result], - length = hasOwnProperty.call(realNames, result) ? array.length : 0; - - while (length--) { - var data = array[length], - otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } - } - return result; - } - - /** - * Gets the argument placeholder value for `func`. - * - * @private - * @param {Function} func The function to inspect. - * @returns {*} Returns the placeholder value. - */ - function getHolder(func) { - var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; - return object.placeholder; - } - - /** - * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, - * this function returns the custom method, otherwise it returns `baseIteratee`. - * If arguments are provided, the chosen function is invoked with them and - * its result is returned. - * - * @private - * @param {*} [value] The value to convert to an iteratee. - * @param {number} [arity] The arity of the created iteratee. - * @returns {Function} Returns the chosen function or its result. - */ - function getIteratee() { - var result = lodash.iteratee || iteratee; - result = result === iteratee ? baseIteratee : result; - return arguments.length ? result(arguments[0], arguments[1]) : result; - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - - /** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ - function getMatchData(object) { - var result = keys(object), - length = result.length; - - while (length--) { - var key = result[length], - value = object[key]; - - result[length] = [key, value, isStrictComparable(value)]; - } - return result; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; - } - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); - }; - - /** - * Creates an array of the own and inherited enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result = []; - while (object) { - arrayPush(result, getSymbols(object)); - object = getPrototype(object); - } - return result; - }; - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; - } - - /** - * Gets the view, applying any `transforms` to the `start` and `end` positions. - * - * @private - * @param {number} start The start of the view. - * @param {number} end The end of the view. - * @param {Array} transforms The transformations to apply to the view. - * @returns {Object} Returns an object containing the `start` and `end` - * positions of the view. - */ - function getView(start, end, transforms) { - var index = -1, - length = transforms.length; - - while (++index < length) { - var data = transforms[index], - size = data.size; - - switch (data.type) { - case 'drop': start += size; break; - case 'dropRight': end -= size; break; - case 'take': end = nativeMin(end, start + size); break; - case 'takeRight': start = nativeMax(start, end - size); break; - } - } - return { 'start': start, 'end': end }; - } - - /** - * Extracts wrapper details from the `source` body comment. - * - * @private - * @param {string} source The source to inspect. - * @returns {Array} Returns the wrapper details. - */ - function getWrapDetails(source) { - var match = source.match(reWrapDetails); - return match ? match[1].split(reSplitDetails) : []; - } - - /** - * Checks if `path` exists on `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @param {Function} hasFunc The function to check properties. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - */ - function hasPath(object, path, hasFunc) { - path = castPath(path, object); - - var index = -1, - length = path.length, - result = false; - - while (++index < length) { - var key = toKey(path[index]); - if (!(result = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result || ++index != length) { - return result; - } - length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); - } - - /** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ - function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; - } - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; - } - - /** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return new Ctor; - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return new Ctor; - - case symbolTag: - return cloneSymbol(object); - } - } - - /** - * Inserts wrapper `details` in a comment at the top of the `source` body. - * - * @private - * @param {string} source The source to modify. - * @returns {Array} details The details to insert. - * @returns {string} Returns the modified source. - */ - function insertWrapDetails(source, details) { - var length = details.length; - if (!length) { - return source; - } - var lastIndex = length - 1; - details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; - details = details.join(length > 2 ? ', ' : ' '); - return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); - } - - /** - * Checks if `value` is a flattenable `arguments` object or array. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. - */ - function isFlattenable(value) { - return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); - } - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; - } - - /** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ - function isKey(value, object) { - if (isArray(value)) { - return false; - } - var type = typeof value; - if (type == 'number' || type == 'symbol' || type == 'boolean' || - value == null || isSymbol(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); - } - - /** - * Checks if `func` has a lazy counterpart. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, - * else `false`. - */ - function isLaziable(func) { - var funcName = getFuncName(func), - other = lodash[funcName]; - - if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { - return true; - } - var data = getData(other); - return !!data && func === data[0]; - } - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - /** - * Checks if `func` is capable of being masked. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `func` is maskable, else `false`. - */ - var isMaskable = coreJsData ? isFunction : stubFalse; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - /** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ - function isStrictComparable(value) { - return value === value && !isObject(value); - } - - /** - * A specialized version of `matchesProperty` for source values suitable - * for strict equality comparisons, i.e. `===`. - * - * @private - * @param {string} key The key of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); - }; - } - - /** - * A specialized version of `_.memoize` which clears the memoized function's - * cache when it exceeds `MAX_MEMOIZE_SIZE`. - * - * @private - * @param {Function} func The function to have its output memoized. - * @returns {Function} Returns the new memoized function. - */ - function memoizeCapped(func) { - var result = memoize(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - - var cache = result.cache; - return result; - } - - /** - * Merges the function metadata of `source` into `data`. - * - * Merging metadata reduces the number of wrappers used to invoke a function. - * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and - * `_.rearg` modify function arguments, making the order in which they are - * executed important, preventing the merging of metadata. However, we make - * an exception for a safe combined case where curried functions have `_.ary` - * and or `_.rearg` applied. - * - * @private - * @param {Array} data The destination metadata. - * @param {Array} source The source metadata. - * @returns {Array} Returns `data`. - */ - function mergeData(data, source) { - var bitmask = data[1], - srcBitmask = source[1], - newBitmask = bitmask | srcBitmask, - isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - - var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); - - // Exit early if metadata can't be merged. - if (!(isCommon || isCombo)) { - return data; - } - // Use source `thisArg` if available. - if (srcBitmask & WRAP_BIND_FLAG) { - data[2] = source[2]; - // Set when currying a bound function. - newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; - } - // Compose partial arguments. - var value = source[3]; - if (value) { - var partials = data[3]; - data[3] = partials ? composeArgs(partials, value, source[4]) : value; - data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; - } - // Compose partial right arguments. - value = source[5]; - if (value) { - partials = data[5]; - data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; - data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; - } - // Use source `argPos` if available. - value = source[7]; - if (value) { - data[7] = value; - } - // Use source `ary` if it's smaller. - if (srcBitmask & WRAP_ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - // Use source `arity` if one is not provided. - if (data[9] == null) { - data[9] = source[9]; - } - // Use source `func` and merge bitmasks. - data[0] = source[0]; - data[1] = newBitmask; - - return data; - } - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ - function overRest(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return apply(func, this, otherArgs); - }; - } - - /** - * Gets the parent value at `path` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path to get the parent value of. - * @returns {*} Returns the parent value. - */ - function parent(object, path) { - return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); - } - - /** - * Reorder `array` according to the specified indexes where the element at - * the first index is assigned as the first element, the element at - * the second index is assigned as the second element, and so on. - * - * @private - * @param {Array} array The array to reorder. - * @param {Array} indexes The arranged array indexes. - * @returns {Array} Returns `array`. - */ - function reorder(array, indexes) { - var arrLength = array.length, - length = nativeMin(indexes.length, arrLength), - oldArray = copyArray(array); - - while (length--) { - var index = indexes[length]; - array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; - } - return array; - } - - /** - * Gets the value at `key`, unless `key` is "__proto__" or "constructor". - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function safeGet(object, key) { - if (key === 'constructor' && typeof object[key] === 'function') { - return; - } - - if (key == '__proto__') { - return; - } - - return object[key]; - } - - /** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity - * function to avoid garbage collection pauses in V8. See - * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var setData = shortOut(baseSetData); - - /** - * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @returns {number|Object} Returns the timer id or timeout object. - */ - var setTimeout = ctxSetTimeout || function(func, wait) { - return root.setTimeout(func, wait); - }; - - /** - * Sets the `toString` method of `func` to return `string`. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var setToString = shortOut(baseSetToString); - - /** - * Sets the `toString` method of `wrapper` to mimic the source of `reference` - * with wrapper details in a comment at the top of the source body. - * - * @private - * @param {Function} wrapper The function to modify. - * @param {Function} reference The reference function. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Function} Returns `wrapper`. - */ - function setWrapToString(wrapper, reference, bitmask) { - var source = (reference + ''); - return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); - } - - /** - * Creates a function that'll short out and invoke `identity` instead - * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` - * milliseconds. - * - * @private - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new shortable function. - */ - function shortOut(func) { - var count = 0, - lastCalled = 0; - - return function() { - var stamp = nativeNow(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return arguments[0]; - } - } else { - count = 0; - } - return func.apply(undefined, arguments); - }; - } - - /** - * A specialized version of `_.shuffle` which mutates and sets the size of `array`. - * - * @private - * @param {Array} array The array to shuffle. - * @param {number} [size=array.length] The size of `array`. - * @returns {Array} Returns `array`. - */ - function shuffleSelf(array, size) { - var index = -1, - length = array.length, - lastIndex = length - 1; - - size = size === undefined ? length : size; - while (++index < size) { - var rand = baseRandom(index, lastIndex), - value = array[rand]; - - array[rand] = array[index]; - array[index] = value; - } - array.length = size; - return array; - } - - /** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ - var stringToPath = memoizeCapped(function(string) { - var result = []; - if (string.charCodeAt(0) === 46 /* . */) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; - }); - - /** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ - function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { - return value; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - /** - * Updates wrapper `details` based on `bitmask` flags. - * - * @private - * @returns {Array} details The details to modify. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Array} Returns `details`. - */ - function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { - var value = '_.' + pair[0]; - if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { - details.push(value); - } - }); - return details.sort(); - } - - /** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ - function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; - result.__values__ = wrapper.__values__; - return result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of elements split into groups the length of `size`. - * If `array` can't be split evenly, the final chunk will be the remaining - * elements. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to process. - * @param {number} [size=1] The length of each chunk - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the new array of chunks. - * @example - * - * _.chunk(['a', 'b', 'c', 'd'], 2); - * // => [['a', 'b'], ['c', 'd']] - * - * _.chunk(['a', 'b', 'c', 'd'], 3); - * // => [['a', 'b', 'c'], ['d']] - */ - function chunk(array, size, guard) { - if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { - size = 1; - } else { - size = nativeMax(toInteger(size), 0); - } - var length = array == null ? 0 : array.length; - if (!length || size < 1) { - return []; - } - var index = 0, - resIndex = 0, - result = Array(nativeCeil(length / size)); - - while (index < length) { - result[resIndex++] = baseSlice(array, index, (index += size)); - } - return result; - } - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * Creates a new array concatenating `array` with any additional arrays - * and/or values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to concatenate. - * @param {...*} [values] The values to concatenate. - * @returns {Array} Returns the new concatenated array. - * @example - * - * var array = [1]; - * var other = _.concat(array, 2, [3], [[4]]); - * - * console.log(other); - * // => [1, 2, 3, [4]] - * - * console.log(array); - * // => [1] - */ - function concat() { - var length = arguments.length; - if (!length) { - return []; - } - var args = Array(length - 1), - array = arguments[0], - index = length; - - while (index--) { - args[index - 1] = arguments[index]; - } - return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); - } - - /** - * Creates an array of `array` values not included in the other given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * **Note:** Unlike `_.pullAll`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.without, _.xor - * @example - * - * _.difference([2, 1], [2, 3]); - * // => [1] - */ - var difference = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `iteratee` which - * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * **Note:** Unlike `_.pullAllBy`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2] - * - * // The `_.property` iteratee shorthand. - * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var differenceBy = baseRest(function(array, values) { - var iteratee = last(values); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The order and - * references of result values are determined by the first array. The comparator - * is invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.pullAllWith`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * - * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); - * // => [{ 'x': 2, 'y': 1 }] - */ - var differenceWith = baseRest(function(array, values) { - var comparator = last(values); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) - : []; - }); - - /** - * Creates a slice of `array` with `n` elements dropped from the beginning. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.drop([1, 2, 3]); - * // => [2, 3] - * - * _.drop([1, 2, 3], 2); - * // => [3] - * - * _.drop([1, 2, 3], 5); - * // => [] - * - * _.drop([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with `n` elements dropped from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.dropRight([1, 2, 3]); - * // => [1, 2] - * - * _.dropRight([1, 2, 3], 2); - * // => [1] - * - * _.dropRight([1, 2, 3], 5); - * // => [] - * - * _.dropRight([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` excluding elements dropped from the end. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.dropRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney'] - * - * // The `_.matches` iteratee shorthand. - * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropRightWhile(users, ['active', false]); - * // => objects for ['barney'] - * - * // The `_.property` iteratee shorthand. - * _.dropRightWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true, true) - : []; - } - - /** - * Creates a slice of `array` excluding elements dropped from the beginning. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.dropWhile(users, function(o) { return !o.active; }); - * // => objects for ['pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.dropWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropWhile(users, ['active', false]); - * // => objects for ['pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.dropWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true) - : []; - } - - /** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * _.fill(Array(3), 2); - * // => [2, 2, 2] - * - * _.fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ - function fill(array, value, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */ - function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, getIteratee(predicate, 3), index); - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); - * // => 2 - * - * // The `_.matches` iteratee shorthand. - * _.findLastIndex(users, { 'user': 'barney', 'active': true }); - * // => 0 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastIndex(users, ['active', false]); - * // => 2 - * - * // The `_.property` iteratee shorthand. - * _.findLastIndex(users, 'active'); - * // => 0 - */ - function findLastIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length - 1; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); - } - return baseFindIndex(array, getIteratee(predicate, 3), index, true); - } - - /** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */ - function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; - } - - /** - * Recursively flattens `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, [3, [4]], 5]]); - * // => [1, 2, 3, 4, 5] - */ - function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; - } - - /** - * Recursively flatten `array` up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Array - * @param {Array} array The array to flatten. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * var array = [1, [2, [3, [4]], 5]]; - * - * _.flattenDepth(array, 1); - * // => [1, 2, [3, [4]], 5] - * - * _.flattenDepth(array, 2); - * // => [1, 2, 3, [4], 5] - */ - function flattenDepth(array, depth) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(array, depth); - } - - /** - * The inverse of `_.toPairs`; this method returns an object composed - * from key-value `pairs`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} pairs The key-value pairs. - * @returns {Object} Returns the new object. - * @example - * - * _.fromPairs([['a', 1], ['b', 2]]); - * // => { 'a': 1, 'b': 2 } - */ - function fromPairs(pairs) { - var index = -1, - length = pairs == null ? 0 : pairs.length, - result = {}; - - while (++index < length) { - var pair = pairs[index]; - result[pair[0]] = pair[1]; - } - return result; - } - - /** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ - function head(array) { - return (array && array.length) ? array[0] : undefined; - } - - /** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the - * offset from the end of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // Search from the `fromIndex`. - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ - function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseIndexOf(array, value, index); - } - - /** - * Gets all but the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - */ - function initial(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 0, -1) : []; - } - - /** - * Creates an array of unique values that are included in all given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersection([2, 1], [2, 3]); - * // => [2] - */ - var intersection = baseRest(function(arrays) { - var mapped = arrayMap(arrays, castArrayLikeObject); - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `iteratee` - * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [2.1] - * - * // The `_.property` iteratee shorthand. - * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }] - */ - var intersectionBy = baseRest(function(arrays) { - var iteratee = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - if (iteratee === last(mapped)) { - iteratee = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The order and references - * of result values are determined by the first array. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.intersectionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }] - */ - var intersectionWith = baseRest(function(arrays) { - var comparator = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - comparator = typeof comparator == 'function' ? comparator : undefined; - if (comparator) { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, undefined, comparator) - : []; - }); - - /** - * Converts all elements in `array` into a string separated by `separator`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to convert. - * @param {string} [separator=','] The element separator. - * @returns {string} Returns the joined string. - * @example - * - * _.join(['a', 'b', 'c'], '~'); - * // => 'a~b~c' - */ - function join(array, separator) { - return array == null ? '' : nativeJoin.call(array, separator); - } - - /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ - function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined; - } - - /** - * This method is like `_.indexOf` except that it iterates over elements of - * `array` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.lastIndexOf([1, 2, 1, 2], 2); - * // => 3 - * - * // Search from the `fromIndex`. - * _.lastIndexOf([1, 2, 1, 2], 2, 2); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); - } - return value === value - ? strictLastIndexOf(array, value, index) - : baseFindIndex(array, baseIsNaN, index, true); - } - - /** - * Gets the element at index `n` of `array`. If `n` is negative, the nth - * element from the end is returned. - * - * @static - * @memberOf _ - * @since 4.11.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=0] The index of the element to return. - * @returns {*} Returns the nth element of `array`. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * - * _.nth(array, 1); - * // => 'b' - * - * _.nth(array, -2); - * // => 'c'; - */ - function nth(array, n) { - return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; - } - - /** - * Removes all given values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` - * to remove elements from an array by predicate. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pull(array, 'a', 'c'); - * console.log(array); - * // => ['b', 'b'] - */ - var pull = baseRest(pullAll); - - /** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pullAll(array, ['a', 'c']); - * console.log(array); - * // => ['b', 'b'] - */ - function pullAll(array, values) { - return (array && array.length && values && values.length) - ? basePullAll(array, values) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The iteratee is invoked with one argument: (value). - * - * **Note:** Unlike `_.differenceBy`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; - * - * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); - * console.log(array); - * // => [{ 'x': 2 }] - */ - function pullAllBy(array, values, iteratee) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, getIteratee(iteratee, 2)) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `comparator` which - * is invoked to compare elements of `array` to `values`. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.differenceWith`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; - * - * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); - * console.log(array); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] - */ - function pullAllWith(array, values, comparator) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, undefined, comparator) - : array; - } - - /** - * Removes elements from `array` corresponding to `indexes` and returns an - * array of removed elements. - * - * **Note:** Unlike `_.at`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...(number|number[])} [indexes] The indexes of elements to remove. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * var pulled = _.pullAt(array, [1, 3]); - * - * console.log(array); - * // => ['a', 'c'] - * - * console.log(pulled); - * // => ['b', 'd'] - */ - var pullAt = flatRest(function(array, indexes) { - var length = array == null ? 0 : array.length, - result = baseAt(array, indexes); - - basePullAt(array, arrayMap(indexes, function(index) { - return isIndex(index, length) ? +index : index; - }).sort(compareAscending)); - - return result; - }); - - /** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked - * with three arguments: (value, index, array). - * - * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` - * to pull elements from an array by value. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); - * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] - */ - function remove(array, predicate) { - var result = []; - if (!(array && array.length)) { - return result; - } - var index = -1, - indexes = [], - length = array.length; - - predicate = getIteratee(predicate, 3); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result.push(value); - indexes.push(index); - } - } - basePullAt(array, indexes); - return result; - } - - /** - * Reverses `array` so that the first element becomes the last, the second - * element becomes the second to last, and so on. - * - * **Note:** This method mutates `array` and is based on - * [`Array#reverse`](https://mdn.io/Array/reverse). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.reverse(array); - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function reverse(array) { - return array == null ? array : nativeReverse.call(array); - } - - /** - * Creates a slice of `array` from `start` up to, but not including, `end`. - * - * **Note:** This method is used instead of - * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are - * returned. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function slice(array, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { - start = 0; - end = length; - } - else { - start = start == null ? 0 : toInteger(start); - end = end === undefined ? length : toInteger(end); - } - return baseSlice(array, start, end); - } - - /** - * Uses a binary search to determine the lowest index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([30, 50], 40); - * // => 1 - */ - function sortedIndex(array, value) { - return baseSortedIndex(array, value); - } - - /** - * This method is like `_.sortedIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); - * // => 0 - */ - function sortedIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); - } - - /** - * This method is like `_.indexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedIndexOf([4, 5, 5, 5, 6], 5); - * // => 1 - */ - function sortedIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value); - if (index < length && eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.sortedIndex` except that it returns the highest - * index at which `value` should be inserted into `array` in order to - * maintain its sort order. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedLastIndex([4, 5, 5, 5, 6], 5); - * // => 4 - */ - function sortedLastIndex(array, value) { - return baseSortedIndex(array, value, true); - } - - /** - * This method is like `_.sortedLastIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 1 - * - * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); - * // => 1 - */ - function sortedLastIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); - } - - /** - * This method is like `_.lastIndexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); - * // => 3 - */ - function sortedLastIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value, true) - 1; - if (eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.uniq` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniq([1, 1, 2]); - * // => [1, 2] - */ - function sortedUniq(array) { - return (array && array.length) - ? baseSortedUniq(array) - : []; - } - - /** - * This method is like `_.uniqBy` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); - * // => [1.1, 2.3] - */ - function sortedUniqBy(array, iteratee) { - return (array && array.length) - ? baseSortedUniq(array, getIteratee(iteratee, 2)) - : []; - } - - /** - * Gets all but the first element of `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.tail([1, 2, 3]); - * // => [2, 3] - */ - function tail(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 1, length) : []; - } - - /** - * Creates a slice of `array` with `n` elements taken from the beginning. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.take([1, 2, 3]); - * // => [1] - * - * _.take([1, 2, 3], 2); - * // => [1, 2] - * - * _.take([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.take([1, 2, 3], 0); - * // => [] - */ - function take(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with `n` elements taken from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.takeRight([1, 2, 3]); - * // => [3] - * - * _.takeRight([1, 2, 3], 2); - * // => [2, 3] - * - * _.takeRight([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.takeRight([1, 2, 3], 0); - * // => [] - */ - function takeRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.takeRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeRightWhile(users, ['active', false]); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.takeRightWhile(users, 'active'); - * // => [] - */ - function takeRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), false, true) - : []; - } - - /** - * Creates a slice of `array` with elements taken from the beginning. Elements - * are taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.takeWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matches` iteratee shorthand. - * _.takeWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeWhile(users, ['active', false]); - * // => objects for ['barney', 'fred'] - * - * // The `_.property` iteratee shorthand. - * _.takeWhile(users, 'active'); - * // => [] - */ - function takeWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3)) - : []; - } - - /** - * Creates an array of unique values, in order, from all given arrays using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.union([2], [1, 2]); - * // => [2, 1] - */ - var union = baseRest(function(arrays) { - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); - }); - - /** - * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which uniqueness is computed. Result values are chosen from the first - * array in which the value occurs. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.unionBy([2.1], [1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - var unionBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.union` except that it accepts `comparator` which - * is invoked to compare elements of `arrays`. Result values are chosen from - * the first array in which the value occurs. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.unionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var unionWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); - }); - - /** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. The order of result values is determined by the order they occur - * in the array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - */ - function uniq(array) { - return (array && array.length) ? baseUniq(array) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The order of result values is determined by the - * order they occur in the array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniqBy([2.1, 1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniqBy(array, iteratee) { - return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The order of result values is - * determined by the order they occur in the array.The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.uniqWith(objects, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] - */ - function uniqWith(array, comparator) { - comparator = typeof comparator == 'function' ? comparator : undefined; - return (array && array.length) ? baseUniq(array, undefined, comparator) : []; - } - - /** - * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-zip - * configuration. - * - * @static - * @memberOf _ - * @since 1.2.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - * - * _.unzip(zipped); - * // => [['a', 'b'], [1, 2], [true, false]] - */ - function unzip(array) { - if (!(array && array.length)) { - return []; - } - var length = 0; - array = arrayFilter(array, function(group) { - if (isArrayLikeObject(group)) { - length = nativeMax(group.length, length); - return true; - } - }); - return baseTimes(length, function(index) { - return arrayMap(array, baseProperty(index)); - }); - } - - /** - * This method is like `_.unzip` except that it accepts `iteratee` to specify - * how regrouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine - * regrouped values. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip([1, 2], [10, 20], [100, 200]); - * // => [[1, 10, 100], [2, 20, 200]] - * - * _.unzipWith(zipped, _.add); - * // => [3, 30, 300] - */ - function unzipWith(array, iteratee) { - if (!(array && array.length)) { - return []; - } - var result = unzip(array); - if (iteratee == null) { - return result; - } - return arrayMap(result, function(group) { - return apply(iteratee, undefined, group); - }); - } - - /** - * Creates an array excluding all given values using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.pull`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...*} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.xor - * @example - * - * _.without([2, 1, 2, 3], 1, 2); - * // => [3] - */ - var without = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; - }); - - /** - * Creates an array of unique values that is the - * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the given arrays. The order of result values is determined by the order - * they occur in the arrays. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.without - * @example - * - * _.xor([2, 1], [2, 3]); - * // => [1, 3] - */ - var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); - }); - - /** - * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which by which they're compared. The order of result values is determined - * by the order they occur in the arrays. The iteratee is invoked with one - * argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2, 3.4] - * - * // The `_.property` iteratee shorthand. - * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var xorBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The order of result values is - * determined by the order they occur in the arrays. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.xorWith(objects, others, _.isEqual); - * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var xorWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); - }); - - /** - * Creates an array of grouped elements, the first of which contains the - * first elements of the given arrays, the second of which contains the - * second elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - */ - var zip = baseRest(unzip); - - /** - * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property identifiers and one of corresponding values. - * - * @static - * @memberOf _ - * @since 0.4.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObject(['a', 'b'], [1, 2]); - * // => { 'a': 1, 'b': 2 } - */ - function zipObject(props, values) { - return baseZipObject(props || [], values || [], assignValue); - } - - /** - * This method is like `_.zipObject` except that it supports property paths. - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); - * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } - */ - function zipObjectDeep(props, values) { - return baseZipObject(props || [], values || [], baseSet); - } - - /** - * This method is like `_.zip` except that it accepts `iteratee` to specify - * how grouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @param {Function} [iteratee=_.identity] The function to combine - * grouped values. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { - * return a + b + c; - * }); - * // => [111, 222] - */ - var zipWith = baseRest(function(arrays) { - var length = arrays.length, - iteratee = length > 1 ? arrays[length - 1] : undefined; - - iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; - return unzipWith(arrays, iteratee); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` wrapper instance that wraps `value` with explicit method - * chain sequences enabled. The result of such sequences must be unwrapped - * with `_#value`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Seq - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ - function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; - } - - /** - * This method invokes `interceptor` and returns `value`. The interceptor - * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain sequence in order to modify intermediate results. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns `value`. - * @example - * - * _([1, 2, 3]) - * .tap(function(array) { - * // Mutate input array. - * array.pop(); - * }) - * .reverse() - * .value(); - * // => [2, 1] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - - /** - * This method is like `_.tap` except that it returns the result of `interceptor`. - * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain sequence. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns the result of `interceptor`. - * @example - * - * _(' abc ') - * .chain() - * .trim() - * .thru(function(value) { - * return [value]; - * }) - * .value(); - * // => ['abc'] - */ - function thru(value, interceptor) { - return interceptor(value); - } - - /** - * This method is the wrapper version of `_.at`. - * - * @name at - * @memberOf _ - * @since 1.0.0 - * @category Seq - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _(object).at(['a[0].b.c', 'a[1]']).value(); - * // => [3, 4] - */ - var wrapperAt = flatRest(function(paths) { - var length = paths.length, - start = length ? paths[0] : 0, - value = this.__wrapped__, - interceptor = function(object) { return baseAt(object, paths); }; - - if (length > 1 || this.__actions__.length || - !(value instanceof LazyWrapper) || !isIndex(start)) { - return this.thru(interceptor); - } - value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ - 'func': thru, - 'args': [interceptor], - 'thisArg': undefined - }); - return new LodashWrapper(value, this.__chain__).thru(function(array) { - if (length && !array.length) { - array.push(undefined); - } - return array; - }); - }); - - /** - * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. - * - * @name chain - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } - * ]; - * - * // A sequence without explicit chaining. - * _(users).head(); - * // => { 'user': 'barney', 'age': 36 } - * - * // A sequence with explicit chaining. - * _(users) - * .chain() - * .head() - * .pick('user') - * .value(); - * // => { 'user': 'barney' } - */ - function wrapperChain() { - return chain(this); - } - - /** - * Executes the chain sequence and returns the wrapped result. - * - * @name commit - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2]; - * var wrapped = _(array).push(3); - * - * console.log(array); - * // => [1, 2] - * - * wrapped = wrapped.commit(); - * console.log(array); - * // => [1, 2, 3] - * - * wrapped.last(); - * // => 3 - * - * console.log(array); - * // => [1, 2, 3] - */ - function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); - } - - /** - * Gets the next value on a wrapped object following the - * [iterator protocol](https://mdn.io/iteration_protocols#iterator). - * - * @name next - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the next iterator value. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped.next(); - * // => { 'done': false, 'value': 1 } - * - * wrapped.next(); - * // => { 'done': false, 'value': 2 } - * - * wrapped.next(); - * // => { 'done': true, 'value': undefined } - */ - function wrapperNext() { - if (this.__values__ === undefined) { - this.__values__ = toArray(this.value()); - } - var done = this.__index__ >= this.__values__.length, - value = done ? undefined : this.__values__[this.__index__++]; - - return { 'done': done, 'value': value }; - } - - /** - * Enables the wrapper to be iterable. - * - * @name Symbol.iterator - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the wrapper object. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped[Symbol.iterator]() === wrapped; - * // => true - * - * Array.from(wrapped); - * // => [1, 2] - */ - function wrapperToIterator() { - return this; - } - - /** - * Creates a clone of the chain sequence planting `value` as the wrapped value. - * - * @name plant - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @param {*} value The value to plant. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2]).map(square); - * var other = wrapped.plant([3, 4]); - * - * other.value(); - * // => [9, 16] - * - * wrapped.value(); - * // => [1, 4] - */ - function wrapperPlant(value) { - var result, - parent = this; - - while (parent instanceof baseLodash) { - var clone = wrapperClone(parent); - clone.__index__ = 0; - clone.__values__ = undefined; - if (result) { - previous.__wrapped__ = clone; - } else { - result = clone; - } - var previous = clone; - parent = parent.__wrapped__; - } - previous.__wrapped__ = value; - return result; - } - - /** - * This method is the wrapper version of `_.reverse`. - * - * **Note:** This method mutates the wrapped array. - * - * @name reverse - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2, 3]; - * - * _(array).reverse().value() - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function wrapperReverse() { - var value = this.__wrapped__; - if (value instanceof LazyWrapper) { - var wrapped = value; - if (this.__actions__.length) { - wrapped = new LazyWrapper(this); - } - wrapped = wrapped.reverse(); - wrapped.__actions__.push({ - 'func': thru, - 'args': [reverse], - 'thisArg': undefined - }); - return new LodashWrapper(wrapped, this.__chain__); - } - return this.thru(reverse); - } - - /** - * Executes the chain sequence to resolve the unwrapped value. - * - * @name value - * @memberOf _ - * @since 0.1.0 - * @alias toJSON, valueOf - * @category Seq - * @returns {*} Returns the resolved unwrapped value. - * @example - * - * _([1, 2, 3]).value(); - * // => [1, 2, 3] - */ - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the number of times the key was returned by `iteratee`. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': 1, '6': 2 } - * - * // The `_.property` iteratee shorthand. - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - ++result[key]; - } else { - baseAssignValue(result, key, 1); - } - }); - - /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * **Note:** This method returns `true` for - * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because - * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of - * elements of empty collections. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.every(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.every(users, 'active'); - * // => false - */ - function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * **Note:** Unlike `_.remove`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.reject - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, { 'age': 36, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.filter(users, 'active'); - * // => objects for ['barney'] - * - * // Combining several predicates using `_.overEvery` or `_.overSome`. - * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); - * // => objects for ['fred', 'barney'] - */ - function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */ - var find = createFind(findIndex); - - /** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=collection.length-1] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); - * // => 3 - */ - var findLast = createFind(findLastIndex); - - /** - * Creates a flattened array of values by running each element in `collection` - * thru `iteratee` and flattening the mapped results. The iteratee is invoked - * with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _.flatMap([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee), 1); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDeep([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMapDeep(collection, iteratee) { - return baseFlatten(map(collection, iteratee), INFINITY); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDepth([1, 2], duplicate, 2); - * // => [[1, 1], [2, 2]] - */ - function flatMapDepth(collection, iteratee, depth) { - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(map(collection, iteratee), depth); - } - - /** - * Iterates over elements of `collection` and invokes `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" - * property are iterated like arrays. To avoid this behavior use `_.forIn` - * or `_.forOwn` for object iteration. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEachRight - * @example - * - * _.forEach([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `1` then `2`. - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forEach(collection, iteratee) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @alias eachRight - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEach - * @example - * - * _.forEachRight([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `2` then `1`. - */ - function forEachRight(collection, iteratee) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The order of grouped values - * is determined by the order they occur in `collection`. The corresponding - * value of each key is an array of elements responsible for generating the - * key. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': [4.2], '6': [6.1, 6.3] } - * - * // The `_.property` iteratee shorthand. - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - result[key].push(value); - } else { - baseAssignValue(result, key, [value]); - } - }); - - /** - * Checks if `value` is in `collection`. If `collection` is a string, it's - * checked for a substring of `value`, otherwise - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'a': 1, 'b': 2 }, 1); - * // => true - * - * _.includes('abcd', 'bc'); - * // => true - */ - function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); - fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; - - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return isString(collection) - ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) - : (!!length && baseIndexOf(collection, value, fromIndex) > -1); - } - - /** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `path` is a function, it's invoked - * for, and `this` bound to, each element in `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. - * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. - * @example - * - * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invokeMap([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - var invokeMap = baseRest(function(collection, path, args) { - var index = -1, - isFunc = typeof path == 'function', - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value) { - result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); - }); - return result; - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var array = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.keyBy(array, function(o) { - * return String.fromCharCode(o.code); - * }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.keyBy(array, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - */ - var keyBy = createAggregator(function(result, value, key) { - baseAssignValue(result, key, value); - }); - - /** - * Creates an array of values by running each element in `collection` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, - * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, - * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, - * `template`, `trim`, `trimEnd`, `trimStart`, and `words` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - * @example - * - * function square(n) { - * return n * n; - * } - * - * _.map([4, 8], square); - * // => [16, 64] - * - * _.map({ 'a': 4, 'b': 8 }, square); - * // => [16, 64] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // The `_.property` iteratee shorthand. - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ - function map(collection, iteratee) { - var func = isArray(collection) ? arrayMap : baseMap; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.sortBy` except that it allows specifying the sort - * orders of the iteratees to sort by. If `orders` is unspecified, all values - * are sorted in ascending order. Otherwise, specify an order of "desc" for - * descending or "asc" for ascending sort order of corresponding values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] - * The iteratees to sort by. - * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 36 } - * ]; - * - * // Sort by `user` in ascending order and by `age` in descending order. - * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] - */ - function orderBy(collection, iteratees, orders, guard) { - if (collection == null) { - return []; - } - if (!isArray(iteratees)) { - iteratees = iteratees == null ? [] : [iteratees]; - } - orders = guard ? undefined : orders; - if (!isArray(orders)) { - orders = orders == null ? [] : [orders]; - } - return baseOrderBy(collection, iteratees, orders); - } - - /** - * Creates an array of elements split into two groups, the first of which - * contains elements `predicate` returns truthy for, the second of which - * contains elements `predicate` returns falsey for. The predicate is - * invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the array of grouped elements. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true }, - * { 'user': 'pebbles', 'age': 1, 'active': false } - * ]; - * - * _.partition(users, function(o) { return o.active; }); - * // => objects for [['fred'], ['barney', 'pebbles']] - * - * // The `_.matches` iteratee shorthand. - * _.partition(users, { 'age': 1, 'active': false }); - * // => objects for [['pebbles'], ['barney', 'fred']] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.partition(users, ['active', false]); - * // => objects for [['barney', 'pebbles'], ['fred']] - * - * // The `_.property` iteratee shorthand. - * _.partition(users, 'active'); - * // => objects for [['fred'], ['barney', 'pebbles']] - */ - var partition = createAggregator(function(result, value, key) { - result[key ? 0 : 1].push(value); - }, function() { return [[], []]; }); - - /** - * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` thru `iteratee`, where each successive - * invocation is supplied the return value of the previous. If `accumulator` - * is not given, the first element of `collection` is used as the initial - * value. The iteratee is invoked with four arguments: - * (accumulator, value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.reduce`, `_.reduceRight`, and `_.transform`. - * - * The guarded methods are: - * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, - * and `sortBy` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduceRight - * @example - * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; - * }, 0); - * // => 3 - * - * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * return result; - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) - */ - function reduce(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduce : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); - } - - /** - * This method is like `_.reduce` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduce - * @example - * - * var array = [[0, 1], [2, 3], [4, 5]]; - * - * _.reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduceRight : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); - } - - /** - * The opposite of `_.filter`; this method returns the elements of `collection` - * that `predicate` does **not** return truthy for. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.filter - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true } - * ]; - * - * _.reject(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.reject(users, { 'age': 40, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.reject(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.reject(users, 'active'); - * // => objects for ['barney'] - */ - function reject(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, negate(getIteratee(predicate, 3))); - } - - /** - * Gets a random element from `collection`. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - */ - function sample(collection) { - var func = isArray(collection) ? arraySample : baseSample; - return func(collection); - } - - /** - * Gets `n` random elements at unique keys from `collection` up to the - * size of `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @param {number} [n=1] The number of elements to sample. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the random elements. - * @example - * - * _.sampleSize([1, 2, 3], 2); - * // => [3, 1] - * - * _.sampleSize([1, 2, 3], 4); - * // => [2, 3, 1] - */ - function sampleSize(collection, n, guard) { - if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - var func = isArray(collection) ? arraySampleSize : baseSampleSize; - return func(collection, n); - } - - /** - * Creates an array of shuffled values, using a version of the - * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - * @example - * - * _.shuffle([1, 2, 3, 4]); - * // => [4, 1, 3, 2] - */ - function shuffle(collection) { - var func = isArray(collection) ? arrayShuffle : baseShuffle; - return func(collection); - } - - /** - * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable string keyed properties for objects. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns the collection size. - * @example - * - * _.size([1, 2, 3]); - * // => 3 - * - * _.size({ 'a': 1, 'b': 2 }); - * // => 2 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - if (collection == null) { - return 0; - } - if (isArrayLike(collection)) { - return isString(collection) ? stringSize(collection) : collection.length; - } - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { - return collection.size; - } - return baseKeys(collection).length; - } - - /** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * Iteration is stopped once `predicate` returns truthy. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.some(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.some(users, 'active'); - * // => true - */ - function some(collection, predicate, guard) { - var func = isArray(collection) ? arraySome : baseSome; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection thru each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[])} [iteratees=[_.identity]] - * The iteratees to sort by. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 30 }, - * { 'user': 'barney', 'age': 34 } - * ]; - * - * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] - * - * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] - */ - var sortBy = baseRest(function(collection, iteratees) { - if (collection == null) { - return []; - } - var length = iteratees.length; - if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { - iteratees = []; - } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { - iteratees = [iteratees[0]]; - } - return baseOrderBy(collection, baseFlatten(iteratees, 1), []); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ - var now = ctxNow || function() { - return root.Date.now(); - }; - - /*------------------------------------------------------------------------*/ - - /** - * The opposite of `_.before`; this method creates a function that invokes - * `func` once it's called `n` or more times. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {number} n The number of calls before `func` is invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => Logs 'done saving!' after the two async saves have completed. - */ - function after(n, func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that invokes `func`, with up to `n` arguments, - * ignoring any additional arguments. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.ary(parseInt, 1)); - * // => [6, 8, 10] - */ - function ary(func, n, guard) { - n = guard ? undefined : n; - n = (func && n == null) ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); - } - - /** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => Allows adding up to 4 contacts to the list. - */ - function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and `partials` prepended to the arguments it receives. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * function greet(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // Bound with placeholders. - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ - var bind = baseRest(function(func, thisArg, partials) { - var bitmask = WRAP_BIND_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bind)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(func, bitmask, thisArg, partials, holders); - }); - - /** - * Creates a function that invokes the method at `object[key]` with `partials` - * prepended to the arguments it receives. - * - * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. See - * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) - * for more details. - * - * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Function - * @param {Object} object The object to invoke the method on. - * @param {string} key The key of the method. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'user': 'fred', - * 'greet': function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * }; - * - * var bound = _.bindKey(object, 'greet', 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * object.greet = function(greeting, punctuation) { - * return greeting + 'ya ' + this.user + punctuation; - * }; - * - * bound('!'); - * // => 'hiya fred!' - * - * // Bound with placeholders. - * var bound = _.bindKey(object, 'greet', _, '!'); - * bound('hi'); - * // => 'hiya fred!' - */ - var bindKey = baseRest(function(object, key, partials) { - var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bindKey)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(key, bitmask, object, partials, holders); - }); - - /** - * Creates a function that accepts arguments of `func` and either invokes - * `func` returning its result, if at least `arity` number of arguments have - * been provided, or returns a function that accepts the remaining `func` - * arguments, and so on. The arity of `func` may be specified if `func.length` - * is not sufficient. - * - * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curry(abc); - * - * curried(1)(2)(3); - * // => [1, 2, 3] - * - * curried(1, 2)(3); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(1)(_, 3)(2); - * // => [1, 2, 3] - */ - function curry(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; - return result; - } - - /** - * This method is like `_.curry` except that arguments are applied to `func` - * in the manner of `_.partialRight` instead of `_.partial`. - * - * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curryRight(abc); - * - * curried(3)(2)(1); - * // => [1, 2, 3] - * - * curried(2, 3)(1); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(3)(1, _)(2); - * // => [1, 2, 3] - */ - function curryRight(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; - return result; - } - - /** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ - function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - timeWaiting = wait - timeSinceLastCall; - - return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; - - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - clearTimeout(timerId); - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; - } - - /** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // => Logs 'deferred' after one millisecond. - */ - var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); - }); - - /** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => Logs 'later' after one second. - */ - var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new flipped function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - function flip(func) { - return createWrap(func, WRAP_FLIP_FLAG); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) - * method interface of `clear`, `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; - */ - function memoize(func, resolver) { - if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; - - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result) || cache; - return result; - }; - memoized.cache = new (memoize.Cache || MapCache); - return memoized; - } - - // Expose `MapCache`. - memoize.Cache = MapCache; - - /** - * Creates a function that negates the result of the predicate `func`. The - * `func` predicate is invoked with the `this` binding and arguments of the - * created function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new negated function. - * @example - * - * function isEven(n) { - * return n % 2 == 0; - * } - * - * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); - * // => [1, 3, 5] - */ - function negate(predicate) { - if (typeof predicate != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function() { - var args = arguments; - switch (args.length) { - case 0: return !predicate.call(this); - case 1: return !predicate.call(this, args[0]); - case 2: return !predicate.call(this, args[0], args[1]); - case 3: return !predicate.call(this, args[0], args[1], args[2]); - } - return !predicate.apply(this, args); - }; - } - - /** - * Creates a function that is restricted to invoking `func` once. Repeat calls - * to the function return the value of the first invocation. The `func` is - * invoked with the `this` binding and arguments of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // => `createApplication` is invoked once - */ - function once(func) { - return before(2, func); - } - - /** - * Creates a function that invokes `func` with its arguments transformed. - * - * @static - * @since 4.0.0 - * @memberOf _ - * @category Function - * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms=[_.identity]] - * The argument transforms. - * @returns {Function} Returns the new function. - * @example - * - * function doubled(n) { - * return n * 2; - * } - * - * function square(n) { - * return n * n; - * } - * - * var func = _.overArgs(function(x, y) { - * return [x, y]; - * }, [square, doubled]); - * - * func(9, 3); - * // => [81, 6] - * - * func(10, 5); - * // => [100, 10] - */ - var overArgs = castRest(function(func, transforms) { - transforms = (transforms.length == 1 && isArray(transforms[0])) - ? arrayMap(transforms[0], baseUnary(getIteratee())) - : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); - - var funcsLength = transforms.length; - return baseRest(function(args) { - var index = -1, - length = nativeMin(args.length, funcsLength); - - while (++index < length) { - args[index] = transforms[index].call(this, args[index]); - } - return apply(func, this, args); - }); - }); - - /** - * Creates a function that invokes `func` with `partials` prepended to the - * arguments it receives. This method is like `_.bind` except it does **not** - * alter the `this` binding. - * - * The `_.partial.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 0.2.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var sayHelloTo = _.partial(greet, 'hello'); - * sayHelloTo('fred'); - * // => 'hello fred' - * - * // Partially applied with placeholders. - * var greetFred = _.partial(greet, _, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - */ - var partial = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partial)); - return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); - }); - - /** - * This method is like `_.partial` except that partially applied arguments - * are appended to the arguments it receives. - * - * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var greetFred = _.partialRight(greet, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - * - * // Partially applied with placeholders. - * var sayHelloTo = _.partialRight(greet, 'hello', _); - * sayHelloTo('fred'); - * // => 'hello fred' - */ - var partialRight = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partialRight)); - return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); - }); - - /** - * Creates a function that invokes `func` with arguments arranged according - * to the specified `indexes` where the argument value at the first index is - * provided as the first argument, the argument value at the second index is - * provided as the second argument, and so on. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to rearrange arguments for. - * @param {...(number|number[])} indexes The arranged argument indexes. - * @returns {Function} Returns the new function. - * @example - * - * var rearged = _.rearg(function(a, b, c) { - * return [a, b, c]; - * }, [2, 0, 1]); - * - * rearged('b', 'c', 'a') - * // => ['a', 'b', 'c'] - */ - var rearg = flatRest(function(func, indexes) { - return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); - }); - - /** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as - * an array. - * - * **Note:** This method is based on the - * [rest parameter](https://mdn.io/rest_parameters). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.rest(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ - function rest(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start === undefined ? start : toInteger(start); - return baseRest(func, start); - } - - /** - * Creates a function that invokes `func` with the `this` binding of the - * create function and an array of arguments much like - * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). - * - * **Note:** This method is based on the - * [spread operator](https://mdn.io/spread_operator). - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Function - * @param {Function} func The function to spread arguments over. - * @param {number} [start=0] The start position of the spread. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.spread(function(who, what) { - * return who + ' says ' + what; - * }); - * - * say(['fred', 'hello']); - * // => 'fred says hello' - * - * var numbers = Promise.all([ - * Promise.resolve(40), - * Promise.resolve(36) - * ]); - * - * numbers.then(_.spread(function(x, y) { - * return x + y; - * })); - * // => a Promise of 76 - */ - function spread(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start == null ? 0 : nativeMax(toInteger(start), 0); - return baseRest(function(args) { - var array = args[start], - otherArgs = castSlice(args, 0, start); - - if (array) { - arrayPush(otherArgs, array); - } - return apply(func, this, otherArgs); - }); - } - - /** - * Creates a throttled function that only invokes `func` at most once per - * every `wait` milliseconds. The throttled function comes with a `cancel` - * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide `options` to indicate whether `func` - * should be invoked on the leading and/or trailing edge of the `wait` - * timeout. The `func` is invoked with the last arguments provided to the - * throttled function. Subsequent calls to the throttled function return the - * result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the throttled function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.throttle` and `_.debounce`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to throttle. - * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=true] - * Specify invoking on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // Avoid excessively updating the position while scrolling. - * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); - * - * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. - * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); - * jQuery(element).on('click', throttled); - * - * // Cancel the trailing throttled invocation. - * jQuery(window).on('popstate', throttled.cancel); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - return debounce(func, wait, { - 'leading': leading, - 'maxWait': wait, - 'trailing': trailing - }); - } - - /** - * Creates a function that accepts up to one argument, ignoring any - * additional arguments. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.unary(parseInt)); - * // => [6, 8, 10] - */ - function unary(func) { - return ary(func, 1); - } - - /** - * Creates a function that provides `value` to `wrapper` as its first - * argument. Any additional arguments provided to the function are appended - * to those provided to the `wrapper`. The wrapper is invoked with the `this` - * binding of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {*} value The value to wrap. - * @param {Function} [wrapper=identity] The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

    ' + func(text) + '

    '; - * }); - * - * p('fred, barney, & pebbles'); - * // => '

    fred, barney, & pebbles

    ' - */ - function wrap(value, wrapper) { - return partial(castFunction(wrapper), value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Casts `value` as an array if it's not one. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Lang - * @param {*} value The value to inspect. - * @returns {Array} Returns the cast array. - * @example - * - * _.castArray(1); - * // => [1] - * - * _.castArray({ 'a': 1 }); - * // => [{ 'a': 1 }] - * - * _.castArray('abc'); - * // => ['abc'] - * - * _.castArray(null); - * // => [null] - * - * _.castArray(undefined); - * // => [undefined] - * - * _.castArray(); - * // => [] - * - * var array = [1, 2, 3]; - * console.log(_.castArray(array) === array); - * // => true - */ - function castArray() { - if (!arguments.length) { - return []; - } - var value = arguments[0]; - return isArray(value) ? value : [value]; - } - - /** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) - * and supports cloning arrays, array buffers, booleans, date objects, maps, - * numbers, `Object` objects, regexes, sets, strings, symbols, and typed - * arrays. The own enumerable properties of `arguments` objects are cloned - * as plain objects. An empty object is returned for uncloneable values such - * as error objects, functions, DOM nodes, and WeakMaps. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @see _.cloneDeep - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var shallow = _.clone(objects); - * console.log(shallow[0] === objects[0]); - * // => true - */ - function clone(value) { - return baseClone(value, CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined`, - * cloning is handled by the method instead. The `customizer` is invoked with - * up to four arguments; (value [, index|key, object, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the cloned value. - * @see _.cloneDeepWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * } - * - * var el = _.cloneWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 0 - */ - function cloneWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ - function cloneDeep(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.cloneWith` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the deep cloned value. - * @see _.cloneWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * } - * - * var el = _.cloneDeepWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 20 - */ - function cloneDeepWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * Checks if `object` conforms to `source` by invoking the predicate - * properties of `source` with the corresponding property values of `object`. - * - * **Note:** This method is equivalent to `_.conforms` when `source` is - * partially applied. - * - * @static - * @memberOf _ - * @since 4.14.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); - * // => true - * - * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); - * // => false - */ - function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Checks if `value` is greater than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - * @see _.lt - * @example - * - * _.gt(3, 1); - * // => true - * - * _.gt(3, 3); - * // => false - * - * _.gt(1, 3); - * // => false - */ - var gt = createRelationalOperation(baseGt); - - /** - * Checks if `value` is greater than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to - * `other`, else `false`. - * @see _.lte - * @example - * - * _.gte(3, 1); - * // => true - * - * _.gte(3, 3); - * // => true - * - * _.gte(1, 3); - * // => false - */ - var gte = createRelationalOperation(function(value, other) { - return value >= other; - }); - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is classified as an `ArrayBuffer` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - * @example - * - * _.isArrayBuffer(new ArrayBuffer(2)); - * // => true - * - * _.isArrayBuffer(new Array(2)); - * // => false - */ - var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); - } - - /** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); - } - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ - var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; - - /** - * Checks if `value` is likely a DOM element. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - * - * _.isElement(''); - * // => false - */ - function isElement(value) { - return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); - } - - /** - * Checks if `value` is an empty object, collection, map, or set. - * - * Objects are considered empty if they have no own enumerable string keyed - * properties. - * - * Array-like values such as `arguments` objects, arrays, buffers, strings, or - * jQuery-like collections are considered empty if they have a `length` of `0`. - * Similarly, maps and sets are considered empty if they have a `size` of `0`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ - function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike(value) && - (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { - return !value.length; - } - var tag = getTag(value); - if (tag == mapTag || tag == setTag) { - return !value.size; - } - if (isPrototype(value)) { - return !baseKeys(value).length; - } - for (var key in value) { - if (hasOwnProperty.call(value, key)) { - return false; - } - } - return true; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - /** - * This method is like `_.isEqual` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with up to - * six arguments: (objValue, othValue [, index|key, object, other, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, othValue) { - * if (isGreeting(objValue) && isGreeting(othValue)) { - * return true; - * } - * } - * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqualWith(array, other, customizer); - * // => true - */ - function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; - } - - /** - * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, - * `SyntaxError`, `TypeError`, or `URIError` object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. - * @example - * - * _.isError(new Error); - * // => true - * - * _.isError(Error); - * // => false - */ - function isError(value) { - if (!isObjectLike(value)) { - return false; - } - var tag = baseGetTag(value); - return tag == errorTag || tag == domExcTag || - (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); - } - - /** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on - * [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MIN_VALUE); - * // => true - * - * _.isFinite(Infinity); - * // => false - * - * _.isFinite('3'); - * // => false - */ - function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); - } - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** - * Checks if `value` is an integer. - * - * **Note:** This method is based on - * [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @example - * - * _.isInteger(3); - * // => true - * - * _.isInteger(Number.MIN_VALUE); - * // => false - * - * _.isInteger(Infinity); - * // => false - * - * _.isInteger('3'); - * // => false - */ - function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); - } - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */ - var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - - /** - * Performs a partial deep comparison between `object` and `source` to - * determine if `object` contains equivalent property values. - * - * **Note:** This method is equivalent to `_.matches` when `source` is - * partially applied. - * - * Partial comparisons will match empty array and empty object `source` - * values against any array or object value, respectively. See `_.isEqual` - * for a list of supported value comparisons. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.isMatch(object, { 'b': 2 }); - * // => true - * - * _.isMatch(object, { 'b': 1 }); - * // => false - */ - function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); - } - - /** - * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with five - * arguments: (objValue, srcValue, index|key, object, source). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, srcValue) { - * if (isGreeting(objValue) && isGreeting(srcValue)) { - * return true; - * } - * } - * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; - * - * _.isMatchWith(object, source, customizer); - * // => true - */ - function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseIsMatch(object, source, getMatchData(source), customizer); - } - - /** - * Checks if `value` is `NaN`. - * - * **Note:** This method is based on - * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as - * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for - * `undefined` and other non-number values. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some - // ActiveX objects in IE. - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is a pristine native function. - * - * **Note:** This method can't reliably detect native functions in the presence - * of the core-js package because core-js circumvents this kind of detection. - * Despite multiple requests, the core-js maintainer has made it clear: any - * attempt to fix the detection will be obstructed. As a result, we're left - * with little choice but to throw an error. Unfortunately, this also affects - * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), - * which rely on core-js. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ - function isNative(value) { - if (isMaskable(value)) { - throw new Error(CORE_ERROR_TEXT); - } - return baseIsNative(value); - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is `null` or `undefined`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is nullish, else `false`. - * @example - * - * _.isNil(null); - * // => true - * - * _.isNil(void 0); - * // => true - * - * _.isNil(NaN); - * // => false - */ - function isNil(value) { - return value == null; - } - - /** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are - * classified as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a number, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ - function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); - } - - /** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ - function isPlainObject(value) { - if (!isObjectLike(value) || baseGetTag(value) != objectTag) { - return false; - } - var proto = getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; - } - - /** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ - var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; - - /** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on - * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * _.isSafeInteger(3); - * // => true - * - * _.isSafeInteger(Number.MIN_VALUE); - * // => false - * - * _.isSafeInteger(Infinity); - * // => false - * - * _.isSafeInteger('3'); - * // => false - */ - function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */ - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - - /** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ - function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); - } - - /** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ - function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); - } - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** - * Checks if `value` is `undefined`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - * - * _.isUndefined(null); - * // => false - */ - function isUndefined(value) { - return value === undefined; - } - - /** - * Checks if `value` is classified as a `WeakMap` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. - * @example - * - * _.isWeakMap(new WeakMap); - * // => true - * - * _.isWeakMap(new Map); - * // => false - */ - function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == weakMapTag; - } - - /** - * Checks if `value` is classified as a `WeakSet` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. - * @example - * - * _.isWeakSet(new WeakSet); - * // => true - * - * _.isWeakSet(new Set); - * // => false - */ - function isWeakSet(value) { - return isObjectLike(value) && baseGetTag(value) == weakSetTag; - } - - /** - * Checks if `value` is less than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - * @see _.gt - * @example - * - * _.lt(1, 3); - * // => true - * - * _.lt(3, 3); - * // => false - * - * _.lt(3, 1); - * // => false - */ - var lt = createRelationalOperation(baseLt); - - /** - * Checks if `value` is less than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to - * `other`, else `false`. - * @see _.gte - * @example - * - * _.lte(1, 3); - * // => true - * - * _.lte(3, 3); - * // => true - * - * _.lte(3, 1); - * // => false - */ - var lte = createRelationalOperation(function(value, other) { - return value <= other; - }); - - /** - * Converts `value` to an array. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Array} Returns the converted array. - * @example - * - * _.toArray({ 'a': 1, 'b': 2 }); - * // => [1, 2] - * - * _.toArray('abc'); - * // => ['a', 'b', 'c'] - * - * _.toArray(1); - * // => [] - * - * _.toArray(null); - * // => [] - */ - function toArray(value) { - if (!value) { - return []; - } - if (isArrayLike(value)) { - return isString(value) ? stringToArray(value) : copyArray(value); - } - if (symIterator && value[symIterator]) { - return iteratorToArray(value[symIterator]()); - } - var tag = getTag(value), - func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); - - return func(value); - } - - /** - * Converts `value` to a finite number. - * - * @static - * @memberOf _ - * @since 4.12.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted number. - * @example - * - * _.toFinite(3.2); - * // => 3.2 - * - * _.toFinite(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toFinite(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toFinite('3.2'); - * // => 3.2 - */ - function toFinite(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - return value === value ? value : 0; - } - - /** - * Converts `value` to an integer. - * - * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3.2); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3.2'); - * // => 3 - */ - function toInteger(value) { - var result = toFinite(value), - remainder = result % 1; - - return result === result ? (remainder ? result - remainder : result) : 0; - } - - /** - * Converts `value` to an integer suitable for use as the length of an - * array-like object. - * - * **Note:** This method is based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toLength(3.2); - * // => 3 - * - * _.toLength(Number.MIN_VALUE); - * // => 0 - * - * _.toLength(Infinity); - * // => 4294967295 - * - * _.toLength('3.2'); - * // => 3 - */ - function toLength(value) { - return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; - } - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ - function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = baseTrim(value); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); - } - - /** - * Converts `value` to a plain object flattening inherited enumerable string - * keyed properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ - function toPlainObject(value) { - return copyObject(value, keysIn(value)); - } - - /** - * Converts `value` to a safe integer. A safe integer can be compared and - * represented correctly. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toSafeInteger(3.2); - * // => 3 - * - * _.toSafeInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toSafeInteger(Infinity); - * // => 9007199254740991 - * - * _.toSafeInteger('3.2'); - * // => 3 - */ - function toSafeInteger(value) { - return value - ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) - : (value === 0 ? value : 0); - } - - /** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ - function toString(value) { - return value == null ? '' : baseToString(value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ - var assign = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } - }); - - /** - * This method is like `_.assign` except that it iterates over own and - * inherited source properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assign - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assignIn({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } - */ - var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); - }); - - /** - * This method is like `_.assignIn` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extendWith - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignInWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); - }); - - /** - * This method is like `_.assign` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignInWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); - }); - - /** - * Creates an array of values corresponding to `paths` of `object`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Array} Returns the picked values. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _.at(object, ['a[0].b.c', 'a[1]']); - * // => [3, 4] - */ - var at = flatRest(baseAt); - - /** - * Creates an object that inherits from the `prototype` object. If a - * `properties` object is given, its own enumerable string keyed properties - * are assigned to the created object. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties == null ? result : baseAssign(result, properties); - } - - /** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep - * @example - * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var defaults = baseRest(function(object, sources) { - object = Object(object); - - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - length = 1; - } - - while (++index < length) { - var source = sources[index]; - var props = keysIn(source); - var propsIndex = -1; - var propsLength = props.length; - - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - - if (value === undefined || - (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { - object[key] = source[key]; - } - } - } - - return object; - }); - - /** - * This method is like `_.defaults` except that it recursively assigns - * default properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaults - * @example - * - * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); - * // => { 'a': { 'b': 2, 'c': 3 } } - */ - var defaultsDeep = baseRest(function(args) { - args.push(undefined, customDefaultsMerge); - return apply(mergeWith, undefined, args); - }); - - /** - * This method is like `_.find` except that it returns the key of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) - * - * // The `_.matches` iteratee shorthand. - * _.findKey(users, { 'age': 1, 'active': true }); - * // => 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findKey(users, 'active'); - * // => 'barney' - */ - function findKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); - } - - /** - * This method is like `_.findKey` except that it iterates over elements of - * a collection in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findLastKey(users, function(o) { return o.age < 40; }); - * // => returns 'pebbles' assuming `_.findKey` returns 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.findLastKey(users, { 'age': 36, 'active': true }); - * // => 'barney' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findLastKey(users, 'active'); - * // => 'pebbles' - */ - function findLastKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); - } - - /** - * Iterates over own and inherited enumerable string keyed properties of an - * object and invokes `iteratee` for each property. The iteratee is invoked - * with three arguments: (value, key, object). Iteratee functions may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forInRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forIn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). - */ - function forIn(object, iteratee) { - return object == null - ? object - : baseFor(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * This method is like `_.forIn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forIn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forInRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. - */ - function forInRight(object, iteratee) { - return object == null - ? object - : baseForRight(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `iteratee` for each property. The iteratee is invoked with three - * arguments: (value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwnRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forOwn(object, iteratee) { - return object && baseForOwn(object, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forOwn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwnRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. - */ - function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, getIteratee(iteratee, 3)); - } - - /** - * Creates an array of function property names from own enumerable properties - * of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functionsIn - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functions(new Foo); - * // => ['a', 'b'] - */ - function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); - } - - /** - * Creates an array of function property names from own and inherited - * enumerable properties of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functions - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functionsIn(new Foo); - * // => ['a', 'b', 'c'] - */ - function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); - } - - /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ - function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; - } - - /** - * Checks if `path` is a direct property of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = { 'a': { 'b': 2 } }; - * var other = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b'); - * // => true - * - * _.has(object, ['a', 'b']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ - function has(object, path) { - return object != null && hasPath(object, path, baseHas); - } - - /** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b'); - * // => true - * - * _.hasIn(object, ['a', 'b']); - * // => true - * - * _.hasIn(object, 'b'); - * // => false - */ - function hasIn(object, path) { - return object != null && hasPath(object, path, baseHasIn); - } - - /** - * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite - * property assignments of previous values. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Object - * @param {Object} object The object to invert. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invert(object); - * // => { '1': 'c', '2': 'b' } - */ - var invert = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - result[value] = key; - }, constant(identity)); - - /** - * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` thru `iteratee`. The - * corresponding inverted value of each inverted key is an array of keys - * responsible for generating the inverted value. The iteratee is invoked - * with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Object - * @param {Object} object The object to invert. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invertBy(object); - * // => { '1': ['a', 'c'], '2': ['b'] } - * - * _.invertBy(object, function(value) { - * return 'group' + value; - * }); - * // => { 'group1': ['a', 'c'], 'group2': ['b'] } - */ - var invertBy = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } - }, getIteratee); - - /** - * Invokes the method at `path` of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {...*} [args] The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - * @example - * - * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; - * - * _.invoke(object, 'a[0].b.c.slice', 1, 3); - * // => [2, 3] - */ - var invoke = baseRest(baseInvoke); - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); - } - - /** - * The opposite of `_.mapValues`; this method creates an object with the - * same values as `object` and keys generated by running each own enumerable - * string keyed property of `object` thru `iteratee`. The iteratee is invoked - * with three arguments: (value, key, object). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapValues - * @example - * - * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { - * return key + value; - * }); - * // => { 'a1': 1, 'b2': 2 } - */ - function mapKeys(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, iteratee(value, key, object), value); - }); - return result; - } - - /** - * Creates an object with the same keys as `object` and values generated - * by running each own enumerable string keyed property of `object` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, key, object). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapKeys - * @example - * - * var users = { - * 'fred': { 'user': 'fred', 'age': 40 }, - * 'pebbles': { 'user': 'pebbles', 'age': 1 } - * }; - * - * _.mapValues(users, function(o) { return o.age; }); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - * - * // The `_.property` iteratee shorthand. - * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - */ - function mapValues(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, key, iteratee(value, key, object)); - }); - return result; - } - - /** - * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable string keyed properties of source objects into the - * destination object. Source properties that resolve to `undefined` are - * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by - * assignment. Source objects are applied from left to right. Subsequent - * sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var object = { - * 'a': [{ 'b': 2 }, { 'd': 4 }] - * }; - * - * var other = { - * 'a': [{ 'c': 3 }, { 'e': 5 }] - * }; - * - * _.merge(object, other); - * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } - */ - var merge = createAssigner(function(object, source, srcIndex) { - baseMerge(object, source, srcIndex); - }); - - /** - * This method is like `_.merge` except that it accepts `customizer` which - * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with six arguments: - * (objValue, srcValue, key, object, source, stack). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * if (_.isArray(objValue)) { - * return objValue.concat(srcValue); - * } - * } - * - * var object = { 'a': [1], 'b': [2] }; - * var other = { 'a': [3], 'b': [4] }; - * - * _.mergeWith(object, other, customizer); - * // => { 'a': [1, 3], 'b': [2, 4] } - */ - var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { - baseMerge(object, source, srcIndex, customizer); - }); - - /** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable property paths of `object` that are not omitted. - * - * **Note:** This method is considerably slower than `_.pick`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to omit. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omit(object, ['a', 'c']); - * // => { 'b': '2' } - */ - var omit = flatRest(function(object, paths) { - var result = {}; - if (object == null) { - return result; - } - var isDeep = false; - paths = arrayMap(paths, function(path) { - path = castPath(path, object); - isDeep || (isDeep = path.length > 1); - return path; - }); - copyObject(object, getAllKeysIn(object), result); - if (isDeep) { - result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); - } - var length = paths.length; - while (length--) { - baseUnset(result, paths[length]); - } - return result; - }); - - /** - * The opposite of `_.pickBy`; this method creates an object composed of - * the own and inherited enumerable string keyed properties of `object` that - * `predicate` doesn't return truthy for. The predicate is invoked with two - * arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omitBy(object, _.isNumber); - * // => { 'b': '2' } - */ - function omitBy(object, predicate) { - return pickBy(object, negate(getIteratee(predicate))); - } - - /** - * Creates an object composed of the picked `object` properties. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pick(object, ['a', 'c']); - * // => { 'a': 1, 'c': 3 } - */ - var pick = flatRest(function(object, paths) { - return object == null ? {} : basePick(object, paths); - }); - - /** - * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with two arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pickBy(object, _.isNumber); - * // => { 'a': 1, 'c': 3 } - */ - function pickBy(object, predicate) { - if (object == null) { - return {}; - } - var props = arrayMap(getAllKeysIn(object), function(prop) { - return [prop]; - }); - predicate = getIteratee(predicate); - return basePickBy(object, props, function(value, path) { - return predicate(value, path[0]); - }); - } - - /** - * This method is like `_.get` except that if the resolved value is a - * function it's invoked with the `this` binding of its parent object and - * its result is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; - * - * _.result(object, 'a[0].b.c1'); - * // => 3 - * - * _.result(object, 'a[0].b.c2'); - * // => 4 - * - * _.result(object, 'a[0].b.c3', 'default'); - * // => 'default' - * - * _.result(object, 'a[0].b.c3', _.constant('default')); - * // => 'default' - */ - function result(object, path, defaultValue) { - path = castPath(path, object); - - var index = -1, - length = path.length; - - // Ensure the loop is entered when path is empty. - if (!length) { - length = 1; - object = undefined; - } - while (++index < length) { - var value = object == null ? undefined : object[toKey(path[index])]; - if (value === undefined) { - index = length; - value = defaultValue; - } - object = isFunction(value) ? value.call(object) : value; - } - return object; - } - - /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, - * it's created. Arrays are created for missing index properties while objects - * are created for all other missing properties. Use `_.setWith` to customize - * `path` creation. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.set(object, 'a[0].b.c', 4); - * console.log(object.a[0].b.c); - * // => 4 - * - * _.set(object, ['x', '0', 'y', 'z'], 5); - * console.log(object.x[0].y.z); - * // => 5 - */ - function set(object, path, value) { - return object == null ? object : baseSet(object, path, value); - } - - /** - * This method is like `_.set` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.setWith(object, '[0][1]', 'a', Object); - * // => { '0': { '1': 'a' } } - */ - function setWith(object, path, value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseSet(object, path, value, customizer); - } - - /** - * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. If `object` is a map or set, its - * entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entries - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ - var toPairs = createToPairs(keys); - - /** - * Creates an array of own and inherited enumerable string keyed-value pairs - * for `object` which can be consumed by `_.fromPairs`. If `object` is a map - * or set, its entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entriesIn - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) - */ - var toPairsIn = createToPairs(keysIn); - - /** - * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. If `accumulator` is not - * provided, a new object with the same `[[Prototype]]` will be used. The - * iteratee is invoked with four arguments: (accumulator, value, key, object). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.transform([2, 3, 4], function(result, n) { - * result.push(n *= n); - * return n % 2 == 0; - * }, []); - * // => [4, 9] - * - * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } - */ - function transform(object, iteratee, accumulator) { - var isArr = isArray(object), - isArrLike = isArr || isBuffer(object) || isTypedArray(object); - - iteratee = getIteratee(iteratee, 4); - if (accumulator == null) { - var Ctor = object && object.constructor; - if (isArrLike) { - accumulator = isArr ? new Ctor : []; - } - else if (isObject(object)) { - accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; - } - else { - accumulator = {}; - } - } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { - return iteratee(accumulator, value, index, object); - }); - return accumulator; - } - - /** - * Removes the property at `path` of `object`. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 7 } }] }; - * _.unset(object, 'a[0].b.c'); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - * - * _.unset(object, ['a', '0', 'b', 'c']); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - */ - function unset(object, path) { - return object == null ? true : baseUnset(object, path); - } - - /** - * This method is like `_.set` except that accepts `updater` to produce the - * value to set. Use `_.updateWith` to customize `path` creation. The `updater` - * is invoked with one argument: (value). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.update(object, 'a[0].b.c', function(n) { return n * n; }); - * console.log(object.a[0].b.c); - * // => 9 - * - * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); - * console.log(object.x[0].y.z); - * // => 0 - */ - function update(object, path, updater) { - return object == null ? object : baseUpdate(object, path, castFunction(updater)); - } - - /** - * This method is like `_.update` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.updateWith(object, '[0][1]', _.constant('a'), Object); - * // => { '0': { '1': 'a' } } - */ - function updateWith(object, path, updater, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); - } - - /** - * Creates an array of the own enumerable string keyed property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) - * - * _.values('hi'); - * // => ['h', 'i'] - */ - function values(object) { - return object == null ? [] : baseValues(object, keys(object)); - } - - /** - * Creates an array of the own and inherited enumerable string keyed property - * values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.valuesIn(new Foo); - * // => [1, 2, 3] (iteration order is not guaranteed) - */ - function valuesIn(object) { - return object == null ? [] : baseValues(object, keysIn(object)); - } - - /*------------------------------------------------------------------------*/ - - /** - * Clamps `number` within the inclusive `lower` and `upper` bounds. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Number - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - * @example - * - * _.clamp(-10, -5, 5); - * // => -5 - * - * _.clamp(10, -5, 5); - * // => 5 - */ - function clamp(number, lower, upper) { - if (upper === undefined) { - upper = lower; - lower = undefined; - } - if (upper !== undefined) { - upper = toNumber(upper); - upper = upper === upper ? upper : 0; - } - if (lower !== undefined) { - lower = toNumber(lower); - lower = lower === lower ? lower : 0; - } - return baseClamp(toNumber(number), lower, upper); - } - - /** - * Checks if `n` is between `start` and up to, but not including, `end`. If - * `end` is not specified, it's set to `start` with `start` then set to `0`. - * If `start` is greater than `end` the params are swapped to support - * negative ranges. - * - * @static - * @memberOf _ - * @since 3.3.0 - * @category Number - * @param {number} number The number to check. - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - * @see _.range, _.rangeRight - * @example - * - * _.inRange(3, 2, 4); - * // => true - * - * _.inRange(4, 8); - * // => true - * - * _.inRange(4, 2); - * // => false - * - * _.inRange(2, 2); - * // => false - * - * _.inRange(1.2, 2); - * // => true - * - * _.inRange(5.2, 4); - * // => false - * - * _.inRange(-3, -2, -6); - * // => true - */ - function inRange(number, start, end) { - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - number = toNumber(number); - return baseInRange(number, start, end); - } - - /** - * Produces a random number between the inclusive `lower` and `upper` bounds. - * If only one argument is provided a number between `0` and the given number - * is returned. If `floating` is `true`, or either `lower` or `upper` are - * floats, a floating-point number is returned instead of an integer. - * - * **Note:** JavaScript follows the IEEE-754 standard for resolving - * floating-point values which can produce unexpected results. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Number - * @param {number} [lower=0] The lower bound. - * @param {number} [upper=1] The upper bound. - * @param {boolean} [floating] Specify returning a floating-point number. - * @returns {number} Returns the random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(lower, upper, floating) { - if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { - upper = floating = undefined; - } - if (floating === undefined) { - if (typeof upper == 'boolean') { - floating = upper; - upper = undefined; - } - else if (typeof lower == 'boolean') { - floating = lower; - lower = undefined; - } - } - if (lower === undefined && upper === undefined) { - lower = 0; - upper = 1; - } - else { - lower = toFinite(lower); - if (upper === undefined) { - upper = lower; - lower = 0; - } else { - upper = toFinite(upper); - } - } - if (lower > upper) { - var temp = lower; - lower = upper; - upper = temp; - } - if (floating || lower % 1 || upper % 1) { - var rand = nativeRandom(); - return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); - } - return baseRandom(lower, upper); - } - - /*------------------------------------------------------------------------*/ - - /** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ - var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); - }); - - /** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ - function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); - } - - /** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ - function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); - } - - /** - * Checks if `string` ends with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search up to. - * @returns {boolean} Returns `true` if `string` ends with `target`, - * else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ - function endsWith(string, target, position) { - string = toString(string); - target = baseToString(target); - - var length = string.length; - position = position === undefined - ? length - : baseClamp(toInteger(position), 0, length); - - var end = position; - position -= target.length; - return position >= 0 && string.slice(position, end) == target; - } - - /** - * Converts the characters "&", "<", ">", '"', and "'" in `string` to their - * corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. See - * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * When working with HTML you should always - * [quote attribute values](http://wonko.com/post/html-escaping) to reduce - * XSS vectors. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ - function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; - } - - /** - * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", - * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https://lodash\.com/\)' - */ - function escapeRegExp(string) { - string = toString(string); - return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : string; - } - - /** - * Converts `string` to - * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the kebab cased string. - * @example - * - * _.kebabCase('Foo Bar'); - * // => 'foo-bar' - * - * _.kebabCase('fooBar'); - * // => 'foo-bar' - * - * _.kebabCase('__FOO_BAR__'); - * // => 'foo-bar' - */ - var kebabCase = createCompounder(function(result, word, index) { - return result + (index ? '-' : '') + word.toLowerCase(); - }); - - /** - * Converts `string`, as space separated words, to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.lowerCase('--Foo-Bar--'); - * // => 'foo bar' - * - * _.lowerCase('fooBar'); - * // => 'foo bar' - * - * _.lowerCase('__FOO_BAR__'); - * // => 'foo bar' - */ - var lowerCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + word.toLowerCase(); - }); - - /** - * Converts the first character of `string` to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.lowerFirst('Fred'); - * // => 'fred' - * - * _.lowerFirst('FRED'); - * // => 'fRED' - */ - var lowerFirst = createCaseFirst('toLowerCase'); - - /** - * Pads `string` on the left and right sides if it's shorter than `length`. - * Padding characters are truncated if they can't be evenly divided by `length`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.pad('abc', 8); - * // => ' abc ' - * - * _.pad('abc', 8, '_-'); - * // => '_-abc_-_' - * - * _.pad('abc', 3); - * // => 'abc' - */ - function pad(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - if (!length || strLength >= length) { - return string; - } - var mid = (length - strLength) / 2; - return ( - createPadding(nativeFloor(mid), chars) + - string + - createPadding(nativeCeil(mid), chars) - ); - } - - /** - * Pads `string` on the right side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padEnd('abc', 6); - * // => 'abc ' - * - * _.padEnd('abc', 6, '_-'); - * // => 'abc_-_' - * - * _.padEnd('abc', 3); - * // => 'abc' - */ - function padEnd(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (string + createPadding(length - strLength, chars)) - : string; - } - - /** - * Pads `string` on the left side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padStart('abc', 6); - * // => ' abc' - * - * _.padStart('abc', 6, '_-'); - * // => '_-_abc' - * - * _.padStart('abc', 3); - * // => 'abc' - */ - function padStart(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (createPadding(length - strLength, chars) + string) - : string; - } - - /** - * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a - * hexadecimal, in which case a `radix` of `16` is used. - * - * **Note:** This method aligns with the - * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category String - * @param {string} string The string to convert. - * @param {number} [radix=10] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {number} Returns the converted integer. - * @example - * - * _.parseInt('08'); - * // => 8 - * - * _.map(['6', '08', '10'], _.parseInt); - * // => [6, 8, 10] - */ - function parseInt(string, radix, guard) { - if (guard || radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); - } - - /** - * Repeats the given string `n` times. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to repeat. - * @param {number} [n=1] The number of times to repeat the string. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {string} Returns the repeated string. - * @example - * - * _.repeat('*', 3); - * // => '***' - * - * _.repeat('abc', 2); - * // => 'abcabc' - * - * _.repeat('abc', 0); - * // => '' - */ - function repeat(string, n, guard) { - if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - return baseRepeat(toString(string), n); - } - - /** - * Replaces matches for `pattern` in `string` with `replacement`. - * - * **Note:** This method is based on - * [`String#replace`](https://mdn.io/String/replace). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to modify. - * @param {RegExp|string} pattern The pattern to replace. - * @param {Function|string} replacement The match replacement. - * @returns {string} Returns the modified string. - * @example - * - * _.replace('Hi Fred', 'Fred', 'Barney'); - * // => 'Hi Barney' - */ - function replace() { - var args = arguments, - string = toString(args[0]); - - return args.length < 3 ? string : string.replace(args[1], args[2]); - } - - /** - * Converts `string` to - * [snake case](https://en.wikipedia.org/wiki/Snake_case). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the snake cased string. - * @example - * - * _.snakeCase('Foo Bar'); - * // => 'foo_bar' - * - * _.snakeCase('fooBar'); - * // => 'foo_bar' - * - * _.snakeCase('--FOO-BAR--'); - * // => 'foo_bar' - */ - var snakeCase = createCompounder(function(result, word, index) { - return result + (index ? '_' : '') + word.toLowerCase(); - }); - - /** - * Splits `string` by `separator`. - * - * **Note:** This method is based on - * [`String#split`](https://mdn.io/String/split). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to split. - * @param {RegExp|string} separator The separator pattern to split by. - * @param {number} [limit] The length to truncate results to. - * @returns {Array} Returns the string segments. - * @example - * - * _.split('a-b-c', '-', 2); - * // => ['a', 'b'] - */ - function split(string, separator, limit) { - if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { - separator = limit = undefined; - } - limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; - if (!limit) { - return []; - } - string = toString(string); - if (string && ( - typeof separator == 'string' || - (separator != null && !isRegExp(separator)) - )) { - separator = baseToString(separator); - if (!separator && hasUnicode(string)) { - return castSlice(stringToArray(string), 0, limit); - } - } - return string.split(separator, limit); - } - - /** - * Converts `string` to - * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). - * - * @static - * @memberOf _ - * @since 3.1.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the start cased string. - * @example - * - * _.startCase('--foo-bar--'); - * // => 'Foo Bar' - * - * _.startCase('fooBar'); - * // => 'Foo Bar' - * - * _.startCase('__FOO_BAR__'); - * // => 'FOO BAR' - */ - var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + upperFirst(word); - }); - - /** - * Checks if `string` starts with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, - * else `false`. - * @example - * - * _.startsWith('abc', 'a'); - * // => true - * - * _.startsWith('abc', 'b'); - * // => false - * - * _.startsWith('abc', 'b', 1); - * // => true - */ - function startsWith(string, target, position) { - string = toString(string); - position = position == null - ? 0 - : baseClamp(toInteger(position), 0, string.length); - - target = baseToString(target); - return string.slice(position, position + target.length) == target; - } - - /** - * Creates a compiled template function that can interpolate data properties - * in "interpolate" delimiters, HTML-escape interpolated data properties in - * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data - * properties may be accessed as free variables in the template. If a setting - * object is given, it takes precedence over `_.templateSettings` values. - * - * **Note:** In the development build `_.template` utilizes - * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) - * for easier debugging. - * - * For more information on precompiling templates see - * [lodash's custom builds documentation](https://lodash.com/custom-builds). - * - * For more information on Chrome extension sandboxes see - * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The template string. - * @param {Object} [options={}] The options object. - * @param {RegExp} [options.escape=_.templateSettings.escape] - * The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] - * The "evaluate" delimiter. - * @param {Object} [options.imports=_.templateSettings.imports] - * An object to import into the template as free variables. - * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] - * The "interpolate" delimiter. - * @param {string} [options.sourceURL='lodash.templateSources[n]'] - * The sourceURL of the compiled template. - * @param {string} [options.variable='obj'] - * The data object variable name. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the compiled template function. - * @example - * - * // Use the "interpolate" delimiter to create a compiled template. - * var compiled = _.template('hello <%= user %>!'); - * compiled({ 'user': 'fred' }); - * // => 'hello fred!' - * - * // Use the HTML "escape" delimiter to escape data property values. - * var compiled = _.template('<%- value %>'); - * compiled({ 'value': ' - - " - -// these messages are used in the _gracefail() method below in getBrowserTimingHeader -const RUM_ISSUES = [ - 'NREUM: no browser monitoring headers generated; disabled', - 'NREUM: transaction missing or ignored while generating browser monitoring headers', - 'NREUM: config.browser_monitoring missing, something is probably wrong', - 'NREUM: browser_monitoring headers need a transaction name', - 'NREUM: browser_monitoring requires valid application_id', - 'NREUM: browser_monitoring requires valid browser_key', - 'NREUM: browser_monitoring requires js_agent_loader script', - 'NREUM: browser_monitoring disabled by browser_monitoring.loader config' -] - -// Can't overwrite internal parameters or all heck will break loose. -const CUSTOM_DENYLIST = new Set([ - 'nr_flatten_leading' -]) - -const CUSTOM_EVENT_TYPE_REGEX = /^[a-zA-Z0-9:_ ]+$/ - -/** - * The exported New Relic API. This contains all of the functions meant to be - * used by New Relic customers. For now, that means transaction naming. - * - * You do not need to directly instantiate this class, as an instance of this is - * the return from `require('newrelic')`. - * - * @constructor - */ -function API(agent) { - this.agent = agent - this.shim = new TransactionShim(agent, 'NewRelicAPI') - this.awsLambda = new AwsLambda(agent) -} - -/** - * Give the current transaction a custom name. Overrides any New Relic naming - * rules set in configuration or from New Relic's servers. - * - * IMPORTANT: this function must be called when a transaction is active. New - * Relic transactions are tied to web requests, so this method may be called - * from within HTTP or HTTPS listener functions, Express routes, or other - * contexts where a web request or response object are in scope. - * - * @param {string} name The name you want to give the web request in the New - * Relic UI. Will be prefixed with 'Custom/' when sent. - */ -API.prototype.setTransactionName = function setTransactionName(name) { - var metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/setTransactionName' - ) - metric.incrementCallCount() - - var transaction = this.agent.tracer.getTransaction() - if (!transaction) { - return logger.warn("No transaction found when setting name to '%s'.", name) - } - - if (!name) { - if (transaction && transaction.url) { - logger.error( - "Must include name in setTransactionName call for URL %s.", - transaction.url - ) - } else { - logger.error("Must include name in setTransactionName call.") - } - - return - } - - logger.trace('Setting transaction %s name to %s', transaction.id, name) - transaction.forceName = NAMES.CUSTOM + '/' + name -} - -/** - * This method returns an object with the following methods: - * - end: end the transaction that was active when `API#getTransaction` - * was called. - * - * - ignore: set the transaction that was active when - * `API#getTransaction` was called to be ignored. - * - * @returns {TransactionHandle} The transaction object with the `end` and - * `ignore` methods on it. - */ -API.prototype.getTransaction = function getTransaction() { - var metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/getTransaction' - ) - metric.incrementCallCount() - - var transaction = this.agent.tracer.getTransaction() - if (!transaction) { - logger.debug("No transaction found when calling API#getTransaction") - return new TransactionHandle.Stub() - } - - transaction.handledExternally = true - - return new TransactionHandle(transaction, this.agent.metrics) -} - -/** - * This method returns an object with the following keys/data: - * - `trace.id`: The current trace ID - * - `span.id`: The current span ID - * - `entity.name`: The application name specified in the connect request as - * app_name. If multiple application names are specified this will only be - * the first name - * - `entity.type`: The string "SERVICE" - * - `entity.guid`: The entity ID returned in the connect reply as entity_guid - * - `hostname`: The hostname as specified in the connect request as - * utilization.full_hostname. If utilization.full_hostname is null or empty, - * this will be the hostname specified in the connect request as host. - * - * @returns {LinkingMetadata} The linking object with the data above - */ -API.prototype.getLinkingMetadata = function getLinkingMetadata(omitSupportability) { - if (omitSupportability !== true) { - const metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/getLinkingMetadata' - ) - metric.incrementCallCount() - } - - const agent = this.agent - - const segment = agent.tracer.getSegment() - const config = agent.config - - const linkingMetadata = { - 'entity.name': config.applications()[0], - 'entity.type': 'SERVICE', - 'hostname': config.getHostnameSafe() - } - - if (config.distributed_tracing.enabled && segment) { - linkingMetadata['trace.id'] = segment.transaction.traceId - const spanId = segment.getSpanId() - if (spanId) { - linkingMetadata['span.id'] = spanId - } - } else { - logger.debug('getLinkingMetadata with no active transaction') - } - - if (config.entity_guid) { - linkingMetadata['entity.guid'] = config.entity_guid - } - - return linkingMetadata -} - -/** - * Specify the `Dispatcher` and `Dispatcher Version` environment values. - * A dispatcher is typically the service responsible for brokering - * the request with the process responsible for responding to the - * request. For example Node's `http` module would be the dispatcher - * for incoming HTTP requests. - * - * @param {string} name The string you would like to report to New Relic - * as the dispatcher. - * - * @param {string} [version] The dispatcher version you would like to - * report to New Relic - */ -API.prototype.setDispatcher = function setDispatcher(name, version) { - var metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/setDispatcher' - ) - metric.incrementCallCount() - - if (!name || typeof name !== 'string') { - logger.error("setDispatcher must be called with a name, and name must be a string.") - return - } - - // No objects allowed. - if (version && typeof version !== 'object') { - version = String(version) - } else { - logger.info('setDispatcher was called with an object as the version parameter') - version = null - } - - this.agent.environment.setDispatcher(name, version, true) -} - -/** - * Give the current transaction a name based on your own idea of what - * constitutes a controller in your Node application. Also allows you to - * optionally specify the action being invoked on the controller. If the action - * is omitted, then the API will default to using the HTTP method used in the - * request (e.g. GET, POST, DELETE). Overrides any New Relic naming rules set - * in configuration or from New Relic's servers. - * - * IMPORTANT: this function must be called when a transaction is active. New - * Relic transactions are tied to web requests, so this method may be called - * from within HTTP or HTTPS listener functions, Express routes, or other - * contexts where a web request or response object are in scope. - * - * @param {string} name The name you want to give the controller in the New - * Relic UI. Will be prefixed with 'Controller/' when - * sent. - * @param {string} action The action being invoked on the controller. Defaults - * to the HTTP method used for the request. - */ -API.prototype.setControllerName = function setControllerName(name, action) { - var metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/setControllerName' - ) - metric.incrementCallCount() - - var transaction = this.agent.tracer.getTransaction() - if (!transaction) { - return logger.warn("No transaction found when setting controller to %s.", name) - } - - if (!name) { - if (transaction && transaction.url) { - logger.error( - "Must include name in setControllerName call for URL %s.", - transaction.url - ) - } else { - logger.error("Must include name in setControllerName call.") - } - - return - } - - action = action || transaction.verb || 'GET' - transaction.forceName = NAMES.CONTROLLER + '/' + name + '/' + action -} - - -/** - * Add a custom attribute to the current transaction. Some attributes are - * reserved (see CUSTOM_DENYLIST for the current, very short list), and - * as with most API methods, this must be called in the context of an - * active transaction. Most recently set value wins. - * - * @param {string} key The key you want displayed in the RPM UI. - * @param {string} value The value you want displayed. Must be serializable. - */ -API.prototype.addCustomAttribute = function addCustomAttribute(key, value) { - const metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/addCustomAttribute' - ) - metric.incrementCallCount() - - // If high security mode is on, custom attributes are disabled. - if (this.agent.config.high_security) { - logger.warnOnce( - 'Custom attributes', - 'Custom attributes are disabled by high security mode.' - ) - return false - } else if (!this.agent.config.api.custom_attributes_enabled) { - logger.debug( - 'Config.api.custom_attributes_enabled set to false, not collecting value' - ) - return false - } - - const transaction = this.agent.tracer.getTransaction() - if (!transaction) { - logger.warn('No transaction found for custom attributes.') - return false - } - - const trace = transaction.trace - if (!trace.custom) { - logger.warn( - 'Could not add attribute %s to nonexistent custom attributes.', - key - ) - return false - } - - if (CUSTOM_DENYLIST.has(key)) { - logger.warn('Not overwriting value of NR-only attribute %s.', key) - return false - } - - trace.addCustomAttribute(key, value) - - const spanContext = this.agent.tracer.getSpanContext() - if (!spanContext) { - logger.debug('No span found for custom attributes.') - // success/failure is ambiguous here. since at least 1 attempt tried, not returning false - return - } - - spanContext.addCustomAttribute(key, value, spanContext.ATTRIBUTE_PRIORITY.LOW) -} - -/** - * Adds all custom attributes in an object to the current transaction. - * - * See documentation for newrelic.addCustomAttribute for more information on - * setting custom attributes. - * - * An example of setting a custom attribute object: - * - * newrelic.addCustomAttributes({test: 'value', test2: 'value2'}); - * - * @param {object} [atts] - * @param {string} [atts.KEY] The name you want displayed in the RPM UI. - * @param {string} [atts.KEY.VALUE] The value you want displayed. Must be serializable. - */ -API.prototype.addCustomAttributes = function addCustomAttributes(atts) { - var metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/addCustomAttributes' - ) - metric.incrementCallCount() - - for (var key in atts) { - if (!properties.hasOwn(atts, key)) { - continue - } - - this.addCustomAttribute(key, atts[key]) - } -} - -/** - * Add custom span attributes in an object to the current segment/span. - * - * See documentation for newrelic.addCustomSpanAttribute for more information. - * - * An example of setting a custom span attribute: - * - * newrelic.addCustomSpanAttribute({test: 'value', test2: 'value2'}) - * - * @param {object} [atts] - * @param {string} [atts.KEY] The name you want displayed in the RPM UI.API. - * @param {string} [atts.KEY.VALUE] The value you want displayed. Must be serializable. - */ -API.prototype.addCustomSpanAttributes = function addCustomSpanAttributes(atts) { - const metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/addCustomSpanAttributes' - ) - metric.incrementCallCount() - - for (let key in atts) { - if (properties.hasOwn(atts, key)) { - this.addCustomSpanAttribute(key, atts[key]) - } - } -} - -/** - * Add a custom span attribute to the current transaction. Some attributes - * are reserved (see CUSTOM_DENYLIST for the current, very short list), and - * as with most API methods, this must be called in the context of an - * active segment/span. Most recently set value wins. - * - * @param {string} key The key you want displayed in the RPM UI. - * @param {string} value The value you want displayed. Must be serializable. - */ -API.prototype.addCustomSpanAttribute = function addCustomSpanAttribute(key, value) { - const metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/addCustomSpanAttribute' - ) - metric.incrementCallCount() - - // If high security mode is on, custom attributes are disabled. - if (this.agent.config.high_security) { - logger.warnOnce( - 'Custom span attributes', - 'Custom span attributes are disabled by high security mode.' - ) - return false - } else if (!this.agent.config.api.custom_attributes_enabled) { - logger.debug( - 'Config.api.custom_attributes_enabled set to false, not collecting value' - ) - return false - } - - const spanContext = this.agent.tracer.getSpanContext() - - if (!spanContext) { - logger.debug( - 'Could not add attribute %s. No available span.', - key - ) - return false - } - - if (CUSTOM_DENYLIST.has(key)) { - logger.warn('Not overwriting value of NR-only attribute %s.', key) - return false - } - - spanContext.addCustomAttribute(key, value) -} - -/** - * Send errors to New Relic that you've already handled yourself. Should be an - * `Error` or one of its subtypes, but the API will handle strings and objects - * that have an attached `.message` or `.stack` property. - * - * NOTE: Errors that are recorded using this method do _not_ obey the - * `ignore_status_codes` configuration. - * - * @param {Error} error - * The error to be traced. - * - * @param {object} [customAttributes] - * Optional. Any custom attributes to be displayed in the New Relic UI. - */ -API.prototype.noticeError = function noticeError(error, customAttributes) { - const metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/noticeError' - ) - metric.incrementCallCount() - - if (!this.agent.config.api.notice_error_enabled) { - logger.debug( - 'Config.api.notice_error_enabled set to false, not collecting error' - ) - return false - } - - // If high security mode is on or custom attributes are disabled, - // noticeError does not collect custom attributes. - if (this.agent.config.high_security) { - logger.debug( - 'Passing custom attributes to notice error API is disabled in high security mode.' - ) - } else if (!this.agent.config.api.custom_attributes_enabled) { - logger.debug( - 'Config.api.custom_attributes_enabled set to false, ' + - 'ignoring custom error attributes.' - ) - } - - if (typeof error === 'string') { - error = new Error(error) - } - - // Filter all object type valued attributes out - let filteredAttributes = customAttributes - if (customAttributes) { - filteredAttributes = _filterAttributes(customAttributes, 'noticeError') - } - - const transaction = this.agent.tracer.getTransaction() - this.agent.errors.addUserError(transaction, error, filteredAttributes) -} - -/** - * If the URL for a transaction matches the provided pattern, name the - * transaction with the provided name. If there are capture groups in the - * pattern (which is a standard JavaScript regular expression, and can be - * passed as either a RegExp or a string), then the substring matches ($1, $2, - * etc.) are replaced in the name string. BE CAREFUL WHEN USING SUBSTITUTION. - * If the replacement substrings are highly variable (i.e. are identifiers, - * GUIDs, or timestamps), the rule will generate too many metrics and - * potentially get your application blocked by New Relic. - * - * An example of a good rule with replacements: - * - * newrelic.addNamingRule('^/storefront/(v[1-5])/(item|category|tag)', - * 'CommerceAPI/$1/$2') - * - * An example of a bad rule with replacements: - * - * newrelic.addNamingRule('^/item/([0-9a-f]+)', 'Item/$1') - * - * Keep in mind that the original URL and any query parameters will be sent - * along with the request, so slow transactions will still be identifiable. - * - * Naming rules can not be removed once added. They can also be added via the - * agent's configuration. See configuration documentation for details. - * - * @param {RegExp} pattern The pattern to rename (with capture groups). - * @param {string} name The name to use for the transaction. - */ -API.prototype.addNamingRule = function addNamingRule(pattern, name) { - var metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/addNamingRule' - ) - metric.incrementCallCount() - - - if (!name) return logger.error("Simple naming rules require a replacement name.") - - this.agent.userNormalizer.addSimple(pattern, '/' + name) -} - -/** - * If the URL for a transaction matches the provided pattern, ignore the - * transaction attached to that URL. Useful for filtering socket.io connections - * and other long-polling requests out of your agents to keep them from - * distorting an app's apdex or mean response time. Pattern may be a (standard - * JavaScript) RegExp or a string. - * - * Example: - * - * newrelic.addIgnoringRule('^/socket\\.io/') - * - * @param {RegExp} pattern The pattern to ignore. - */ -API.prototype.addIgnoringRule = function addIgnoringRule(pattern) { - var metric = this.agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.API + '/addIgnoringRule' - ) - metric.incrementCallCount() - - if (!pattern) return logger.error("Must include a URL pattern to ignore.") - - this.agent.userNormalizer.addSimple(pattern, null) -} - -/** - * Get the header necessary for Browser Monitoring - * This script must be manually injected into your templates, as high as possible - * in the header, but _after_ any X-UA-COMPATIBLE HTTP-EQUIV meta tags. - * Otherwise you may hurt IE! - * - * This method must be called _during_ a transaction, and must be called every - * time you want to generate the headers. - * - * Do *not* reuse the headers between users, or even between requests. - * - * @param {string} [options.nonce] - Nonce to inject into ` header necessary for Browser Monitoring - * This script must be manually injected into your templates, as high as possible - * in the header, but _after_ any X-UA-COMPATIBLE HTTP-EQUIV meta tags. - * Otherwise you may hurt IE! - * - * This method must be called _during_ a transaction, and must be called every - * time you want to generate the headers. - * - * Do *not* reuse the headers between users, or even between requests. - * - * @env NEW_RELIC_BROWSER_MONITOR_ENABLE - */ - enable: true, - /** - * Request un-minified sources from the server. - * - * @env NEW_RELIC_BROWSER_MONITOR_DEBUG - */ - debug: false - }, - /** - * API Configuration - * - * Some API end points can be turned off via configuration settings to - * allow for more flexible security options. All API configuration - * options are disabled when high-security mode is enabled. - */ - api: { - /** - * Controls for the `API.addCustomAttribute` method. - * - * @env NEW_RELIC_API_CUSTOM_ATTRIBUTES - */ - custom_attributes_enabled: true, - /** - * Controls for the `API.recordCustomEvent` method. - * - * @env NEW_RELIC_API_CUSTOM_EVENTS - */ - custom_events_enabled: true, - /** - * Controls for the `API.noticeError` method. - * - * @env NEW_RELIC_API_NOTICE_ERROR - */ - notice_error_enabled: true, - }, - /** - * Transaction Events - * - * Transaction events are sent to New Relic Insights. This event data - * includes transaction timing, transaction name, and any custom parameters. - * - * Read more here: http://newrelic.com/insights - */ - transaction_events: { - attributes: { - /** - * If `true`, the agent captures attributes from transaction events. - * - * @env NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED - */ - enabled: true, - /** - * Prefix of attributes to exclude in transaction events. - * Allows * as wildcard at end. - * - * @env NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE - */ - exclude: [], - /** - * Prefix of attributes to include in transaction events. - * Allows * as wildcard at end. - * - * @env NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE - */ - include: [] - }, - /** - * If this is disabled, the agent does not collect, nor try to send, - * analytic data. - */ - enabled: true, - /** - * The agent will collect all events up to this number per minute. If - * there are more than that, a statistical sampling will be collected. - */ - max_samples_stored: 10000 - }, - - /** - * Custom Insights Events - * - * Custom insights events are JSON object that are sent to New Relic - * Insights. You can tell the agent to send your custom events via the - * `newrelic.recordCustomEvent()` API. These events are sampled once the max - * queue size is reached. You can tune this setting below. - * - * Read more here: http://newrelic.com/insights - */ - custom_insights_events: { - /** - * If this is disabled, the agent does not collect, nor try to send, custom - * event data. - */ - enabled: true, - /** - * The agent will collect all events up to this number per minute. If there - * are more than that, a statistical sampling will be collected. Currently - * this uses a priority sampling algorithm. - * - * By increasing this setting you are both increasing the memory - * requirements of the agent as well as increasing the payload to the New - * Relic servers. The memory concerns are something you should consider for - * your own server's sake. The payload of events is compressed, but if it - * grows too large the New Relic servers may reject it. - */ - max_samples_stored: 1000 - }, - /** - * This is used to configure properties about the user's host name. - */ - process_host: { - /** - * Configurable display name for hosts - * - * @env NEW_RELIC_PROCESS_HOST_DISPLAY_NAME - */ - display_name: '', - /** - * ip address preference when creating hostnames - * - * @env NEW_RELIC_IPV_PREFERENCE - */ - ipv_preference: '4' - }, - - /** - * High Security - * - * High security mode (v2) is a setting which prevents any sensitive data from - * being sent to New Relic. The local setting must match the server setting. - * If there is a mismatch the agent will log a message and act as if it is - * disabled. - * - * Attributes of high security mode (when enabled): - * * requires SSL - * * does not allow capturing of http params - * * does not allow custom params - * - * To read more see: https://docs.newrelic.com/docs/subscriptions/high-security - */ - high_security: false, - - /** - * Labels - * - * An object of label names and values that will be applied to the data sent - * from this agent. Both label names and label values have a maximum length of - * 255 characters. This object should contain at most 64 labels. - */ - labels: {}, - - /** - * These options control behavior for slow queries, but do not affect sql - * nodes in transaction traces. - */ - slow_sql: { - /** - * Enables and disables `slow_sql` recording. - * - * @env NEW_RELIC_SLOW_SQL_ENABLED - */ - enabled: false, - - /** - * Sets the maximum number of slow query samples that will be collected in a - * single harvest cycle. - * - * @env NEW_RELIC_MAX_SQL_SAMPLES - */ - max_samples: 10 - }, - - /** - * Controls behavior of datastore instance metrics. - * - * @property {bool} [instance_reporting.enabled=true] - * Enables reporting the host and port/path/id of database servers. Default - * is `true`. - * - * @property {bool} [database_name_reporting.enabled=true] - * Enables reporting of database/schema names. Default is `true`. - */ - datastore_tracer: { - instance_reporting: {enabled: true}, - database_name_reporting: {enabled: true} - }, - - /** - * Controls the behavior of span events produced by the agent. - */ - span_events: { - /** - * Enables/disables span event generation - * - * @env NEW_RELIC_SPAN_EVENTS_ENABLED - */ - enabled: true, - - attributes: { - /** - * If `true`, the agent captures attributes from span events. - * - * @env NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED - */ - enabled: true, - /** - * Prefix of attributes to exclude in span events. - * Allows * as wildcard at end. - * - * @env NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE - */ - exclude: [], - /** - * Prefix of attributes to include in span events. - * Allows * as wildcard at end. - * - * @env NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE - */ - include: [] - } - }, - - /** - * Controls the behavior of transaction segments produced by the agent. - */ - transaction_segments: { - attributes: { - /** - * If `true`, the agent captures attributes from transaction segments. - * - * @env NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED - */ - enabled: true, - /** - * Prefix of attributes to exclude in transaction segments. - * Allows * as wildcard at end. - * - * @env NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE - */ - exclude: [], - /** - * Prefix of attributes to include in transaction segments. - * Allows * as wildcard at end. - * - * @env NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE - */ - include: [] - } - }, - - /** - * Controls the method of cross agent tracing in the agent. - * Distributed tracing lets you see the path that a request takes through your - * distributed system. Enabling distributed tracing changes the behavior of some - * New Relic features, so carefully consult the transition guide before you enable - * this feature: https://docs.newrelic.com/docs/transition-guide-distributed-tracing - * Default is false. - */ - distributed_tracing: { - /** - * Enables/disables distributed tracing. - * - * @env NEW_RELIC_DISTRIBUTED_TRACING_ENABLED - */ - enabled: false, - - /** - * Exludes New Relic format distributed tracing header (`newrelic`) on - * outbound requests when set to `true`. By default (when false) - * both W3C TraceContext (`traceparent`, `tracecontext`) and - * New Relic formats will be sent. - * - * @env NEW_RELIC_DISTRIBUTED_TRACING_EXCLUDE_NEWRELIC_HEADER - */ - exclude_newrelic_header: false - }, - - /** - * Controls the use of cross-application tracing. - * - * @property {bool} [enabled=true] - * Enables tracing transactions across multiple applications. Default is `true`. - */ - cross_application_tracer: {enabled: true}, - - /** - * Controls behavior of message broker tracing. - * - * @property {bool} [segment_parameters.enabled=true] - * Enables reporting parameters on message broker segments. - */ - message_tracer: { - segment_parameters: {enabled: true} - }, - - /** - * Controls the use of infinite tracing. - */ - infinite_tracing: { - trace_observer: { - /** - * The URI HOST of the observer. Setting this enables infinite tracing. - * - * @env NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_HOST - */ - host: '', - /** - * The URI PORT of the observer. - * - * @env NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_PORT - */ - port: '443' - }, - span_events: { - /** - * The amount of spans to hold onto before dropping them - * - * @env NEW_RELIC_INFINITE_TRACING_SPAN_EVENTS_QUEUE_SIZE - */ - queue_size: 10000 - } - }, - - /** - * Specifies whether the agent will be used to monitor serverless functions. - * For example: AWS Lambda - * - * @env NEW_RELIC_SERVERLESS_MODE_ENABLED - */ - serverless_mode: { - enabled: process.env.AWS_LAMBDA_FUNCTION_NAME != null - }, - - plugins: { - /** - * Controls usage of the native metrics module which samples VM and event - * loop data. - */ - native_metrics: {enabled: true} - } -}) diff --git a/node_modules/newrelic/lib/config/env.js b/node_modules/newrelic/lib/config/env.js deleted file mode 100644 index e90e58e7..00000000 --- a/node_modules/newrelic/lib/config/env.js +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// Map of configuration values to their associated environment value names. -const ENV_MAPPING = { - newrelic_home: 'NEW_RELIC_HOME', - app_name: 'NEW_RELIC_APP_NAME', - license_key: 'NEW_RELIC_LICENSE_KEY', - apdex_t: 'NEW_RELIC_APDEX_T', - security_policies_token: 'NEW_RELIC_SECURITY_POLICIES_TOKEN', - ssl: 'NEW_RELIC_USE_SSL', - host: 'NEW_RELIC_HOST', - port: 'NEW_RELIC_PORT', - proxy: 'NEW_RELIC_PROXY_URL', - proxy_host: 'NEW_RELIC_PROXY_HOST', - proxy_port: 'NEW_RELIC_PROXY_PORT', - proxy_user: 'NEW_RELIC_PROXY_USER', - proxy_pass: 'NEW_RELIC_PROXY_PASS', - agent_enabled: 'NEW_RELIC_ENABLED', - attributes: { - enabled: 'NEW_RELIC_ATTRIBUTES_ENABLED', - exclude: 'NEW_RELIC_ATTRIBUTES_EXCLUDE', - include: 'NEW_RELIC_ATTRIBUTES_INCLUDE', - include_enabled: 'NEW_RELIC_ATTRIBUTES_INCLUDE_ENABLED' - }, - logging: { - level: 'NEW_RELIC_LOG_LEVEL', - filepath: 'NEW_RELIC_LOG', - enabled: 'NEW_RELIC_LOG_ENABLED' - }, - audit_log: { - enabled: 'NEW_RELIC_AUDIT_LOG_ENABLED', - endpoints: 'NEW_RELIC_AUDIT_LOG_ENDPOINTS' - }, - error_collector: { - attributes: { - enabled: 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED' - }, - enabled: 'NEW_RELIC_ERROR_COLLECTOR_ENABLED', - ignore_status_codes: 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES', - ignore_classes: 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS', - expected_status_codes: 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERROR_CODES', - expected_classes: 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERRORS', - }, - strip_exception_messages: { - enabled: 'NEW_RELIC_STRIP_EXCEPTION_MESSAGES_ENABLED' - }, - transaction_events: { - attributes: { - enabled: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED', - exclude: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE', - include: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE' - } - }, - transaction_tracer: { - attributes: { - enabled: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLED', - exclude: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDE', - include: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE' - }, - enabled: 'NEW_RELIC_TRACER_ENABLED', - transaction_threshold: 'NEW_RELIC_TRACER_THRESHOLD', - top_n: 'NEW_RELIC_TRACER_TOP_N', - record_sql: 'NEW_RELIC_RECORD_SQL', - explain_threshold: 'NEW_RELIC_EXPLAIN_THRESHOLD', - hide_internals: 'NEW_RELIC_HIDE_INTERNALS' - }, - utilization: { - detect_aws: 'NEW_RELIC_UTILIZATION_DETECT_AWS', - detect_pcf: 'NEW_RELIC_UTILIZATION_DETECT_PCF', - detect_azure: 'NEW_RELIC_UTILIZATION_DETECT_AZURE', - detect_gcp: 'NEW_RELIC_UTILIZATION_DETECT_GCP', - detect_docker: 'NEW_RELIC_UTILIZATION_DETECT_DOCKER', - detect_kubernetes: 'NEW_RELIC_UTILIZATION_DETECT_KUBERNETES', - logical_processors: 'NEW_RELIC_UTILIZATION_LOGICAL_PROCESSORS', - total_ram_mib: 'NEW_RELIC_UTILIZATION_TOTAL_RAM_MIB', - billing_hostname: 'NEW_RELIC_UTILIZATION_BILLING_HOSTNAME' - }, - rules: { - name: 'NEW_RELIC_NAMING_RULES', - ignore: 'NEW_RELIC_IGNORING_RULES' - }, - enforce_backstop: 'NEW_RELIC_ENFORCE_BACKSTOP', - browser_monitoring: { - attributes: { - enabled: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLED', - exclude: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDE', - include: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDE' - }, - enable: 'NEW_RELIC_BROWSER_MONITOR_ENABLE', - debug: 'NEW_RELIC_BROWSER_MONITOR_DEBUG' - }, - high_security: 'NEW_RELIC_HIGH_SECURITY', - labels: 'NEW_RELIC_LABELS', - slow_sql: { - enabled: 'NEW_RELIC_SLOW_SQL_ENABLED', - max_samples: 'NEW_RELIC_MAX_SQL_SAMPLES' - }, - process_host: { - display_name: 'NEW_RELIC_PROCESS_HOST_DISPLAY_NAME', - ipv_preference: 'NEW_RELIC_IPV_PREFERENCE' - }, - api: { - custom_attributes_enabled: 'NEW_RELIC_API_CUSTOM_ATTRIBUTES', - custom_events_enabled: 'NEW_RELIC_API_CUSTOM_EVENTS', - notice_error_enabled: 'NEW_RELIC_API_NOTICE_ERROR' - }, - datastore_tracer: { - instance_reporting: { - enabled: 'NEW_RELIC_DATASTORE_INSTANCE_REPORTING_ENABLED' - }, - database_name_reporting:{ - enabled: 'NEW_RELIC_DATASTORE_DATABASE_NAME_REPORTING_ENABLED' - } - }, - span_events: { - enabled: 'NEW_RELIC_SPAN_EVENTS_ENABLED', - attributes: { - enabled: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED', - exclude: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE', - include: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE' - } - }, - transaction_segments: { - attributes: { - enabled: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED', - exclude: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE', - include: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE' - } - }, - distributed_tracing: { - enabled: 'NEW_RELIC_DISTRIBUTED_TRACING_ENABLED', - exclude_newrelic_header: 'NEW_RELIC_DISTRIBUTED_TRACING_EXCLUDE_NEWRELIC_HEADER' - }, - message_tracer: { - segment_parameters: { - enabled: 'NEW_RELIC_MESSAGE_TRACER_SEGMENT_PARAMETERS_ENABLED' - } - }, - serverless_mode: { - enabled: 'NEW_RELIC_SERVERLESS_MODE_ENABLED' - }, - plugins: { - native_metrics: { - enabled: 'NEW_RELIC_NATIVE_METRICS_ENABLED' - } - }, - trusted_account_key: 'NEW_RELIC_TRUSTED_ACCOUNT_KEY', - primary_application_id: 'NEW_RELIC_PRIMARY_APPLICATION_ID', - account_id: 'NEW_RELIC_ACCOUNT_ID', - infinite_tracing: { - trace_observer: { - host: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_HOST', - port: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_PORT' - }, - queue_size: 'NEW_RELIC_INFINITE_TRACING_QUEUE_SIZE' - } -} - -// List of environment values which are comma-delimited lists. -const LIST_VARS = new Set([ - 'NEW_RELIC_APP_NAME', - 'NEW_RELIC_ATTRIBUTES_EXCLUDE', - 'NEW_RELIC_ATTRIBUTES_INCLUDE', - 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES', - 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS', - 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERROR_CODES', - 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERRORS', - 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_EXCLUDE', - 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_INCLUDE', - 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDE', - 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE', - 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDE', - 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDE', - 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE', - 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE', - 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE', - 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE', - 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE', - 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE', - 'NEW_RELIC_IGNORING_RULES', - 'NEW_RELIC_AUDIT_LOG_ENDPOINTS' -]) - -// Mapping to customize the split delimiter for the LIST_VARS -const LIST_VARS_CUSTOM_DELIMITERS = { - 'NEW_RELIC_APP_NAME': /;|,/ -} - -// Values in object lists are comma-delimited object literals -const OBJECT_LIST_VARS = new Set([ - 'NEW_RELIC_NAMING_RULES' -]) - -// Values in boolean variables. Is pretty tolerant about values, but don't get -// fancy--just use 'true' and 'false', everybody. -const BOOLEAN_VARS = new Set([ - 'NEW_RELIC_ENABLED', - 'NEW_RELIC_ATTRIBUTES_ENABLED', - 'NEW_RELIC_ERROR_COLLECTOR_ENABLED', - 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED', - 'NEW_RELIC_STRIP_EXCEPTION_MESSAGES_ENABLED', - 'NEW_RELIC_ATTRIBUTES_INCLUDE_ENABLED', - 'NEW_RELIC_TRACER_ENABLED', - 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLED', - 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED', - 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED', - 'NEW_RELIC_DEBUG_METRICS', - 'NEW_RELIC_DEBUG_TRACER', - 'NEW_RELIC_ENFORCE_BACKSTOP', - 'NEW_RELIC_USE_SSL', - 'NEW_RELIC_BROWSER_MONITOR_ENABLE', - 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLED', - 'NEW_RELIC_BROWSER_MONITOR_DEBUG', - 'NEW_RELIC_HIGH_SECURITY', - 'NEW_RELIC_SLOW_SQL_ENABLED', - 'NEW_RELIC_SPAN_EVENTS_ENABLED', - 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED', - 'NEW_RELIC_DISTRIBUTED_TRACING_ENABLED', - 'NEW_RELIC_DISTRIBUTED_TRACING_EXCLUDE_NEWRELIC_HEADER', - 'NEW_RELIC_LOG_ENABLED', - 'NEW_RELIC_AUDIT_LOG_ENABLED', - 'NEW_RELIC_DATASTORE_DATABASE_NAME_REPORTING_ENABLED', - 'NEW_RELIC_DATASTORE_INSTANCE_REPORTING_ENABLED', - 'NEW_RELIC_MESSAGE_TRACER_SEGMENT_PARAMETERS_ENABLED', - 'NEW_RELIC_UTILIZATION_DETECT_AWS', - 'NEW_RELIC_UTILIZATION_DETECT_PCF', - 'NEW_RELIC_UTILIZATION_DETECT_AZURE', - 'NEW_RELIC_UTILIZATION_DETECT_DOCKER', - 'NEW_RELIC_UTILIZATION_DETECT_GCP', - 'NEW_RELIC_UTILIZATION_DETECT_KUBERNETES', - 'NEW_RELIC_SERVERLESS_MODE_ENABLED', - 'NEW_RELIC_NATIVE_METRICS_ENABLED' -]) - -const FLOAT_VARS = new Set([ - 'NEW_RELIC_APDEX_T', - 'NEW_RELIC_TRACER_THRESHOLD' -]) - -const INT_VARS = new Set([ - 'NEW_RELIC_EXPLAIN_THRESHOLD', - 'NEW_RELIC_MAX_SQL_SAMPLES', - 'NEW_RELIC_INFINITE_TRACING_SPAN_EVENTS_QUEUE_SIZE' -]) - -exports.ENV_MAPPING = ENV_MAPPING -exports.LIST_VARS = LIST_VARS -exports.LIST_VARS_CUSTOM_DELIMITERS = LIST_VARS_CUSTOM_DELIMITERS -exports.OBJECT_LIST_VARS = OBJECT_LIST_VARS -exports.BOOLEAN_VARS = BOOLEAN_VARS -exports.FLOAT_VARS = FLOAT_VARS -exports.INT_VARS = INT_VARS diff --git a/node_modules/newrelic/lib/config/harvest-config-validator.js b/node_modules/newrelic/lib/config/harvest-config-validator.js deleted file mode 100644 index b07245c3..00000000 --- a/node_modules/newrelic/lib/config/harvest-config-validator.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -function isValidHarvestConfig(harvestConfig) { - if (harvestConfig == null) { - return false - } - - const harvestLimits = harvestConfig.harvest_limits - - const isValid = - isValidHarvestValue(harvestConfig.report_period_ms) && - harvestLimits != null && - Object.keys(harvestLimits).length > 0 - - return isValid -} - -function isValidHarvestValue(value) { - const isValid = value != null && (value >= 0) - return !!isValid -} - -module.exports = { - isValidHarvestConfig: isValidHarvestConfig, - isValidHarvestValue: isValidHarvestValue -} diff --git a/node_modules/newrelic/lib/config/hsm.js b/node_modules/newrelic/lib/config/hsm.js deleted file mode 100644 index f03d433e..00000000 --- a/node_modules/newrelic/lib/config/hsm.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var flatten = require('../util/flatten') - -// Config keys that can't be set by the server if high_security is enabled -const HIGH_SECURITY_SETTINGS = { - ssl: true, - strip_exception_messages: { - enabled: true - }, - allow_all_headers: false, - attributes: { - include: [] - }, - transaction_tracer: { - record_sql: 'obfuscated', - attributes: { - include: [] - } - }, - error_collector: { - attributes: { - include: [] - } - }, - browser_monitoring: { - attributes: { - include: [] - } - }, - transaction_events: { - attributes: { - include: [] - } - }, - span_events: { - attributes: { - include: [] - } - }, - transaction_segments: { - attributes: { - include: [] - } - }, - slow_sql: { - enabled: false - } -} - -const HIGH_SECURITY_KEYS = flatten.keys(HIGH_SECURITY_SETTINGS) - -// blank out these config values before sending to the collector -const REDACT_BEFORE_SEND = new Set([ - 'proxy_pass', - 'proxy_user', - 'proxy', - 'certificates' // should be public but in case user mistake and also these are huge -]) - -// process.domain needs to be stripped befeore sending -const REMOVE_BEFORE_SEND = new Set(['domain']) - -exports.HIGH_SECURITY_SETTINGS = HIGH_SECURITY_SETTINGS -exports.HIGH_SECURITY_KEYS = HIGH_SECURITY_KEYS -exports.REDACT_BEFORE_SEND = REDACT_BEFORE_SEND -exports.REMOVE_BEFORE_SEND = REMOVE_BEFORE_SEND diff --git a/node_modules/newrelic/lib/config/index.js b/node_modules/newrelic/lib/config/index.js deleted file mode 100644 index 81818f05..00000000 --- a/node_modules/newrelic/lib/config/index.js +++ /dev/null @@ -1,1729 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const AttributeFilter = require('./attribute-filter') -const CollectorResponse = require('../collector/response') -const copy = require('../util/copy') -const defaultConfig = require('./default').config -const EventEmitter = require('events').EventEmitter -const feature_flag = require('../feature_flags') -const flatten = require('../util/flatten') -const fs = require('../util/unwrapped-core').fs -const hashes = require('../util/hashes') -const os = require('os') -const parseKey = require('../collector/key-parser').parseKey -const path = require('path') -const psemver = require('../util/process-version') -const stringify = require('json-stringify-safe') -const util = require('util') -const MergeServerConfig = require('./merge-server-config') -const harvestConfigValidator = require('./harvest-config-validator') -const mergeServerConfig = new MergeServerConfig() - -/** - * CONSTANTS -- we gotta lotta 'em - */ -const AZURE_APP_NAME = 'APP_POOL_ID' -const DEFAULT_MAX_PAYLOAD_SIZE_IN_BYTES = 1000000 -const DEFAULT_CONFIG_PATH = require.resolve('./default') -const SPAN_EVENT_LIMIT = 1000 -const BASE_CONFIG_PATH = require.resolve('../../newrelic') -const DEFAULT_FILENAME = 'newrelic.js' -const CONFIG_FILE_LOCATIONS = [ - process.env.NEW_RELIC_HOME, - process.cwd(), - process.env.HOME, - path.join(__dirname, '../../../..') // above node_modules -] - -const HAS_ARBITRARY_KEYS = new Set([ - 'ignore_messages', - 'expected_messages', - 'labels' -]) - -const LASP_MAP = require('./lasp').LASP_MAP -const ENV = require('./env') -const HSM = require('./hsm') - -const exists = fs.existsSync || path.existsSync -let logger = null // Lazy-loaded in `initialize`. -let _configInstance = null - -// the REPL has no main module -if (process.mainModule && process.mainModule.filename) { - CONFIG_FILE_LOCATIONS.splice(2, 0, path.dirname(process.mainModule.filename)) -} - -function isTruthular(setting) { - if (setting == null) { - return false - } - - var normalized = setting.toString().toLowerCase() - switch (normalized) { - case 'false': - case 'f': - case 'no': - case 'n': - case 'disabled': - case '0': - return false - - default: - return true - } -} - -function fromObjectList(setting) { - try { - return JSON.parse('[' + setting + ']') - } catch (error) { - logger.error('New Relic configurator could not deserialize object list:') - logger.error(error.stack) - } -} - -function _findConfigFile() { - var candidate - var filepath - - - for (var i = 0; i < CONFIG_FILE_LOCATIONS.length; i++) { - candidate = CONFIG_FILE_LOCATIONS[i] - if (!candidate) continue - - filepath = path.join(path.resolve(candidate), DEFAULT_FILENAME) - if (!exists(filepath)) continue - - return fs.realpathSync(filepath) - } -} - -function Config(config) { - EventEmitter.call(this) - - // 1. start by cloning the defaults - try { - Object.assign(this, defaultConfig()) - } catch (err) { - logger.warn('Unable to clone the default config, %s: %s', DEFAULT_CONFIG_PATH, err) - } - - // 2. initialize undocumented, internal-only default values - - // feature flags are mostly private settings for gating unreleased features - // flags are set in the feature_flags.js file - this.feature_flag = copy.shallow(feature_flag.prerelease) - - // set by environment - this.newrelic_home = null - // set by configuration file loader - this.config_file_path = null - - // set by collector on handshake - this.run_id = null - this.account_id = null - this.application_id = null - this.web_transactions_apdex = Object.create(null) - this.cross_process_id = null - this.encoding_key = null - this.obfuscatedId = null - this.primary_application_id = null - this.trusted_account_ids = null - this.trusted_account_key = null - this.sampling_target = 10 - this.sampling_target_period_in_seconds = 60 - this.max_payload_size_in_bytes = DEFAULT_MAX_PAYLOAD_SIZE_IN_BYTES - - // this value is arbitrary - this.max_trace_segments = 900 - - this.entity_guid = null - - // feature level of this account - this.product_level = 0 - // product-level related - this.collect_traces = true - this.collect_errors = true - this.collect_span_events = true - - // override options for utilization stats - this.utilization.logical_processors = null - this.utilization.total_ram_mib = null - this.utilization.billing_hostname = null - - this.browser_monitoring.loader = 'rum' - this.browser_monitoring.loader_version = '' - - // Settings to play nice with DLPs (see NODE-1044). - this.compressed_content_encoding = 'deflate' // Deflate or gzip - this.simple_compression = false // Disables subcomponent compression - this.put_for_data_send = false // Changes http verb for harvest - - // 3. override defaults with values from the loaded / passed configuration - this._fromPassed(config) - - // 3.5. special values (only Azure environment APP_POOL_ID for now) - this._fromSpecial() - - // 4. override config with environment variables - this._featureFlagsFromEnv() - this._fromEnvironment() - - // 5. clean up anything that requires postprocessing - this._canonicalize() - - // 6. put the version in the config - this.version = require('../../package.json').version - - // TODO: this may belong in canonicalize. - if (!this.event_harvest_config) { - this.event_harvest_config = { - report_period_ms: 60000, - harvest_limits: { - analytic_event_data: this.transaction_events.max_samples_stored, - custom_event_data: this.custom_insights_events.max_samples_stored, - error_event_data: this.error_collector.max_event_samples_stored, - span_event_data: SPAN_EVENT_LIMIT - } - } - } - - // 7. serverless_mode specific settings - this._enforceServerless(config) - - // 8. apply high security overrides - if (this.high_security) { - if (this.security_policies_token) { - throw new Error( - 'Security Policies and High Security Mode cannot both be present ' + - 'in the agent configuration. If Security Policies have been set ' + - 'for your account, please ensure the security_policies_token is ' + - 'set but high_security is disabled (default).' - ) - } - this._applyHighSecurity() - } - - // 9. Set instance attribute filter using updated context - this.attributeFilter = new AttributeFilter(this) -} -util.inherits(Config, EventEmitter) - -/** - * Because this module and logger depend on each other, the logger needs - * a way to inject the actual logger instance once it's constructed. - * It's kind of a Rube Goldberg device, but it works. - * - * @param {Logger} bootstrapped The actual, configured logger. - */ -Config.prototype.setLogger = function setLogger(bootstrapped) { - logger = bootstrapped -} - -/** - * helper object for merging server side values - */ -Config.prototype.mergeServerConfig = mergeServerConfig - -/** - * Accept any configuration passed back from the server. Will log all - * recognized, unsupported, and unknown parameters. - * - * @param {object} json The config blob sent by New Relic. - */ -Config.prototype.onConnect = function onConnect(json, recursion) { - json = json || Object.create(null) - if (this.high_security && recursion !== true && !json.high_security) { - this.agent_enabled = false - this.emit('agent_enabled', false) - return - } - if (Object.keys(json).length === 0) return - - Object.keys(json).forEach(function updateProp(key) { - this._fromServer(json, key) - }, this) - - this.emit('change', this) -} - -Config.prototype._getMostSecure = function getMostSecure(key, currentVal, newVal) { - var filter = LASP_MAP[key] && LASP_MAP[key].filter - if (!this.security_policies_token || !filter) { - // If we aren't applying something vetted by security policies we - // just return the new value. - return newVal - } - // Return the most secure if we have a filter to apply - return filter(currentVal, newVal) -} - -/** - * The guts of the logic about how to deal with server-side configuration. - * - * @param {object} params A configuration dictionary. - * @param {string} key The particular configuration parameter to set. - */ -Config.prototype._fromServer = function _fromServer(params, key) { - switch (key) { - // handled by the connection - case 'messages': - break - - // *sigh* Xzibit, etc. - case 'agent_config': - this.onConnect(params[key], true) - break - - // if it's undefined or null, so be it - case 'agent_run_id': - this.run_id = params.agent_run_id - break - - // if it's undefined or null, so be it - case 'request_headers_map': - this.request_headers_map = params.request_headers_map - break - - // handled by config.onConnect - case 'high_security': - break - - // always accept these settings - case 'cross_process_id': - case 'encoding_key': - this._alwaysUpdateIfChanged(params, key) - if (this.cross_process_id && this.encoding_key) { - this.obfuscatedId = - hashes.obfuscateNameUsingKey(this.cross_process_id, this.encoding_key) - } - break - - // always accept these settings - case 'account_id': - case 'application_id': - case 'collect_errors': - case 'collect_traces': - case 'primary_application_id': - case 'product_level': - case 'max_payload_size_in_bytes': - case 'sampling_target': - case 'sampling_target_period_in_seconds': - case 'trusted_account_ids': - case 'trusted_account_key': - this._alwaysUpdateIfChanged(params, key) - break - - case 'collect_error_events': - if (params.collect_error_events === false) { - this._updateNestedIfChanged( - params, - this.error_collector, - key, - 'capture_events' - ) - } - break - - // also accept these settings - case 'url_rules': - case 'metric_name_rules': - case 'transaction_name_rules': - case 'transaction_segment_terms': - this._emitIfSet(params, key) - break - - case 'ssl': - if (!isTruthular(params.ssl)) { - logger.warn('SSL config key can no longer be disabled, not updating.') - } - break - - case 'apdex_t': - case 'web_transactions_apdex': - this._updateIfChanged(params, key) - break - case 'event_harvest_config': - const val = params[key] - const isValidConfig = harvestConfigValidator.isValidHarvestConfig(val) - if (!isValidConfig) { - this.emit(key, null) - break - } - logger.info( - 'Valid event_harvest_config received. Updating harvest cycles.', - val - ) - const limits = Object.keys(val.harvest_limits).reduce((acc, k) => { - const v = val.harvest_limits[k] - if (harvestConfigValidator.isValidHarvestValue(v)) { - acc[k] = v - } else { - logger.info(`Omitting limit for ${k} due to invalid value ${v}`) - } - return acc - }, {}) - val.harvest_limits = limits - this[key] = val - this.emit(key, val) - break - - case 'collect_analytics_events': - // never enable from server-side - // but we allow the server to disable - if (params.collect_analytics_events === false) { - this.transaction_events.enabled = false - } - break - - case 'collect_custom_events': - // never enable from server-side - // but we allow the server to disable - if (params.collect_custom_events === false) { - this.custom_insights_events.enabled = false - } - break - - case 'collect_span_events': - // never enable from server-side - // but we allow the server to disable - if (params.collect_span_events === false) { - this.span_events.enabled = false - } - break - - case 'allow_all_headers': - this._updateIfChanged(params, key) - this._canonicalize() - break - - // - // Browser Monitoring - // - case 'browser_monitoring.loader': - this._updateNestedIfChangedRaw( - params, - this.browser_monitoring, - key, - 'loader' - ) - break - - // these are used by browser_monitoring - // and the api.getRUMHeader() method - case 'js_agent_file': - case 'js_agent_loader_file': - case 'beacon': - case 'error_beacon': - case 'browser_key': - case 'js_agent_loader': - this._updateNestedIfChangedRaw( - params, - this.browser_monitoring, - key, - key - ) - break - - // - // Cross Application Tracer - // - case 'cross_application_tracer.enabled': - this._updateNestedIfChanged( - params, - this.cross_application_tracer, - key, - 'enabled' - ) - break - // - // Error Collector - // - case 'error_collector.enabled': - this._updateNestedIfChanged( - params, - this.error_collector, - 'error_collector.enabled', - 'enabled' - ) - break - case 'error_collector.ignore_status_codes': - this._validateThenUpdateStatusCodes( - params, - this.error_collector, - 'error_collector.ignore_status_codes', - 'ignore_status_codes' - ) - this._canonicalize() - break - case 'error_collector.expected_status_codes': - this._validateThenUpdateStatusCodes( - params, - this.error_collector, - 'error_collector.expected_status_codes', - 'expected_status_codes' - ) - this._canonicalize() - break - case 'error_collector.ignore_classes': - this._validateThenUpdateErrorClasses( - params, - this.error_collector, - 'error_collector.ignore_classes', - 'ignore_classes' - ) - break - case 'error_collector.expected_classes': - this._validateThenUpdateErrorClasses( - params, - this.error_collector, - 'error_collector.expected_classes', - 'expected_classes' - ) - break - case 'error_collector.ignore_messages': - this._validateThenUpdateErrorMessages( - params, - this.error_collector, - 'error_collector.ignore_messages', - 'ignore_messages' - ) - break - case 'error_collector.expected_messages': - this._validateThenUpdateErrorMessages( - params, - this.error_collector, - 'error_collector.expected_messages', - 'expected_messages' - ) - break - case 'error_collector.capture_events': - this._updateNestedIfChanged( - params, - this.error_collector, - 'error_collector.capture_events', - 'capture_events' - ) - break - case 'error_collector.max_event_samples_stored': - this._updateNestedIfChanged( - params, - this.error_collector, - 'error_collector.max_event_samples_stored', - 'max_event_samples_stored' - ) - break - - // - // Slow SQL - // - case 'slow_sql.enabled': - this._updateNestedIfChanged(params, this.slow_sql, key, 'enabled') - break - - // - // Transaction Events - // - case 'transaction_events.enabled': - this._updateNestedIfChanged( - params, - this.transaction_events, - key, - 'enabled' - ) - break - - // - // Transaction Tracer - // - case 'transaction_tracer.enabled': - this._updateNestedIfChanged( - params, - this.transaction_tracer, - 'transaction_tracer.enabled', - 'enabled' - ) - break - case 'transaction_tracer.transaction_threshold': - this._updateNestedIfChanged( - params, - this.transaction_tracer, - 'transaction_tracer.transaction_threshold', - 'transaction_threshold' - ) - break - - // Entity GUID - case 'entity_guid': - this.entity_guid = params[key] - break - - // These settings aren't supported by the agent (yet). - case 'sampling_rate': - case 'episodes_file': - case 'episodes_url': - case 'rum.load_episodes_file': - // Ensure the most secure setting is applied to the settings below - // when enabling them. - case 'attributes.include_enabled': - case 'strip_exception_messages.enabled': - case 'transaction_tracer.record_sql': - this.logUnsupported(params, key) - break - - // These settings are not allowed from the server. - case 'attributes.enabled': - case 'attributes.exclude': - case 'attributes.include': - case 'browser_monitoring.attributes.enabled': - case 'browser_monitoring.attributes.exclude': - case 'browser_monitoring.attributes.include': - case 'error_collector.attributes.enabled': - case 'error_collector.attributes.exclude': - case 'error_collector.attributes.include': - case 'transaction_events.attributes.enabled': - case 'transaction_events.attributes.exclude': - case 'transaction_events.attributes.include': - case 'transaction_events.max_samples_stored': - case 'transaction_tracer.attributes.enabled': - case 'transaction_tracer.attributes.exclude': - case 'transaction_tracer.attributes.include': - case 'serverless_mode.enabled': - break - - default: - this.logUnknown(params, key) - } -} - -/** - * Change a value sent by the collector if and only if it's different from the - * value we already have. Emit an event with the key name and the new value, - * and log that the value has changed. - * - * @param {object} json Config blob sent by collector. - * @param {string} key Value we're looking to set. - */ -Config.prototype._alwaysUpdateIfChanged = function _alwaysUpdateIfChanged(json, key) { - var value = json[key] - if (value != null && this[key] !== value) { - if (Array.isArray(value) && Array.isArray(this[key])) { - value.forEach(function pushIfNew(element) { - if (this[key].indexOf(element) === -1) this[key].push(element) - }, this) - } else { - this[key] = value - } - this.emit(key, value) - logger.debug('Configuration of %s was changed to %s by New Relic.', key, value) - } -} - -/** - * Change a value sent by the collector if and only if it's different from the - * value we already have. Emit an event with the key name and the new value, - * and log that the value has changed. - * - * @param {object} json Config blob sent by collector. - * @param {string} key Value we're looking to set. - */ -Config.prototype._updateIfChanged = function _updateIfChanged(json, key) { - this._updateNestedIfChanged(json, this, key, key) -} - -/** - * Expected and Ignored status code configuration values should look like this - * - * [500,'501','503-507'] - * - * If the server side config is not in this format, it might put the agent - * in a world of hurt. So, before we pass everything on to - * _updateNestedIfChanged, we'll do some validation. - * - * @param {object} remote JSON sent from New Relic. - * @param {object} local A portion of this configuration object. - * @param {string} remoteKey The name sent by New Relic. - * @param {string} localKey The local name. - */ -Config.prototype._validateThenUpdateStatusCodes = _validateThenUpdateStatusCodes -function _validateThenUpdateStatusCodes(remote, local, remoteKey, localKey) { - let valueToTest = remote[remoteKey] - if (!Array.isArray(valueToTest)) { - logger.warn( - 'Saw SSC (ignore|expect)_status_codes that is not an array, will not merge: %s', - valueToTest - ) - return - } - - let valid = true - valueToTest.forEach(function validateArray(thingToTest) { - if (!('string' === (typeof thingToTest) || 'number' === (typeof thingToTest))) { - logger.warn( - 'Saw SSC (ignore|expect)_status_code that is not a number or string,' + - 'will not merge: %s', thingToTest - ) - valid = false - } - }) - if (!valid) { - return - } - - return this._updateNestedIfChanged(remote, local, remoteKey, localKey) -} - -/** - * Expected and Ignored classes configuration values should look like this - * - * ['Error','Again'] - * - * If the server side config is not in this format, it might put the agent - * in a world of hurt. So, before we pass everything on to - * _updateNestedIfChanged, we'll do some validation. - * - * @param {object} remote JSON sent from New Relic. - * @param {object} local A portion of this configuration object. - * @param {string} remoteKey The name sent by New Relic. - * @param {string} localKey The local name. - */ -Config.prototype._validateThenUpdateErrorClasses = _validateThenUpdateErrorClasses - -function _validateThenUpdateErrorClasses(remote, local, remoteKey, localKey) { - let valueToTest = remote[remoteKey] - if (!Array.isArray(valueToTest)) { - logger.warn( - 'Saw SSC (ignore|expect)_classes that is not an array, will not merge: %s', - valueToTest - ) - return - } - - let valid = true - Object.keys(valueToTest).forEach(function validateArray(key) { - let thingToTest = valueToTest[key] - if ('string' !== (typeof thingToTest)) { - logger.warn( - 'Saw SSC (ignore|expect)_class that is not a string, will not merge: %s', - thingToTest - ) - valid = false - } - }) - if (!valid) { - return - } - - return this._updateNestedIfChanged(remote, local, remoteKey, localKey) -} - -/** - * Expected and Ignore messages configuration values should look like this - * - * {'ErrorType':['Error Message']} - * - * If the server side config is not in this format, it might put the agent - * in a world of hurt. So, before we pass everything on to - * _updateNestedIfChanged, we'll do some validation. - * - * @param {object} remote JSON sent from New Relic. - * @param {object} local A portion of this configuration object. - * @param {string} remoteKey The name sent by New Relic. - * @param {string} localKey The local name. - */ -Config.prototype._validateThenUpdateErrorMessages = _validateThenUpdateErrorMessages - -function _validateThenUpdateErrorMessages(remote, local, remoteKey, localKey) { - let valueToTest = remote[remoteKey] - if (Array.isArray(valueToTest)) { - logger.warn( - 'Saw SSC (ignore|expect)_message that is an Array, will not merge: %s', - valueToTest - ) - return - } - - if (!valueToTest) { - logger.warn('SSC ignore|expect_message is null or undefined, will not merge') - return - } - - if ('object' !== typeof valueToTest) { - logger.warn( - 'Saw SSC (ignore|expect)_message that is primitive/scaler, will not merge: %s', - valueToTest - ) - return - } - - if (!valueToTest) { - logger.warn('SSC ignore|expect_message is null or undefined, will not merge') - return - } - - let valid = true - Object.keys(valueToTest).forEach(function validateArray(key) { - let arrayToTest = valueToTest[key] - if (!Array.isArray(arrayToTest)) { - logger.warn( - 'Saw SSC message array that is not an array, will not merge: %s', - arrayToTest - ) - valid = false - } - }) - if (!valid) { - return - } - - return this._updateNestedIfChanged(remote, local, remoteKey, localKey) -} -/** - * Some parameter values are nested, need a simple way to change them as well. - * Will merge local and remote if and only if both are arrays. - * - * @param {object} remote JSON sent from New Relic. - * @param {object} local A portion of this configuration object. - * @param {string} remoteKey The name sent by New Relic. - * @param {string} localKey The local name. - */ -Config.prototype._updateNestedIfChanged = _updateNestedIfChanged - -function _updateNestedIfChanged(remote, local, remoteKey, localKey) { - // if high-sec mode is enabled, we do not accept server changes to high-sec - if (this.high_security && HSM.HIGH_SECURITY_KEYS.indexOf(remoteKey) !== -1) { - return this.logDisabled(remote, remoteKey) - } - return this._updateNestedIfChangedRaw(remote, local, remoteKey, localKey) -} - -Config.prototype._updateNestedIfChangedRaw = _updateNestedIfChangedRaw - -function _updateNestedIfChangedRaw(remote, local, remoteKey, localKey) { - return this.mergeServerConfig.updateNestedIfChanged( - this, - remote, - local, - remoteKey, - localKey, - logger - ) -} - -/** - * Some parameter values are just to be passed on. - * - * @param {object} json Config blob sent by collector. - * @param {string} key Value we're looking to set. - */ -Config.prototype._emitIfSet = function _emitIfSet(json, key) { - var value = json[key] - if (value != null) this.emit(key, value) -} - -/** - * The agent would normally do something with this parameter, but server-side - * configuration is disabled via local settings or HSM. - * - * @param {object} json Config blob sent by collector. - * @param {string} key Value the agent won't set. - */ -Config.prototype.logDisabled = function logDisabled(json, key) { - var value = json[key] - if (value != null) { - logger.debug( - 'Server-side configuration of %s is currently disabled by local configuration. ' + - '(Server sent value of %s.)', - key, - value - ) - } -} - -/** - * Help support out by putting in the logs the fact that we don't currently - * support the provided configuration key, and including the sent value. - * - * @param {object} json Config blob sent by collector. - * @param {string} key Value the agent doesn't set. - */ -Config.prototype.logUnsupported = function logUnsupported(json, key) { - var value = json[key] - if (value !== null && value !== undefined) { - logger.debug( - 'Server-side configuration of %s is currently not supported by the ' + - 'Node.js agent. (Server sent value of %s.)', - key, - value - ) - this.emit(key, value) - } -} - -/** - * The agent knows nothing about this parameter. - * - * @param {object} json Config blob sent by collector. - * @param {string} key Value the agent knows nothing about. - */ -Config.prototype.logUnknown = function logUnknown(json, key) { - var value = json[key] - logger.debug( - 'New Relic sent unknown configuration parameter %s with value %s.', - key, - value - ) -} - -/** - * Return the availability of async_hook for use by the agent. - */ -Config.prototype.checkAsyncHookStatus = function checkAsyncHookStatus() { - return ( - this.feature_flag.await_support && - (psemver.satisfies('>=8') || psemver.prerelease()) - ) -} - -/** - * Gets the user set host display name. If not provided, it returns the default value. - * - * This function is written is this strange way becauase of the use of caching variables. - * I wanted to cache the DisplayHost, but if I attached the variable to the config object, - * it sends the extra variable to New Relic, which is not desired. - * - * @return {string} display host name - */ -Config.prototype.getDisplayHost = getDisplayHost - -Config.prototype.clearDisplayHostCache = function clearDisplayHostCache() { - this.getDisplayHost = getDisplayHost -} - -function getDisplayHost() { - var _displayHost - this.getDisplayHost = function getCachedDisplayHost() { - return _displayHost - } - if (this.process_host.display_name === '') { - _displayHost = this.getHostnameSafe() - return _displayHost - } - var stringBuffer = Buffer.from(this.process_host.display_name, 'utf8') - var numBytes = stringBuffer.length - - if (numBytes > 255) { - logger.warn('Custom host display name must be less than 255 bytes') - _displayHost = this.getHostnameSafe() - return _displayHost - } - - _displayHost = this.process_host.display_name - return _displayHost -} - -/** - * Gets the system's host name. If that fails, it just returns ipv4/6 based on the user's - * process_host.ipv_preferenece setting. - * - * This function is written is this strange way becauase of the use of caching variables. - * I wanted to cache the Hostname, but if I attached the variable to the config object, - * it sends the extra variable to New Relic, which is not desired. - * - * @return {string} host name - */ -Config.prototype.getHostnameSafe = getHostnameSafe - -Config.prototype.clearHostnameCache = function clearHostnameCache() { - this.getHostnameSafe = getHostnameSafe -} - -Config.prototype.getIPAddresses = function getIPAddresses() { - var addresses = Object.create(null) - var interfaces = os.networkInterfaces() - - for (var interfaceKey in interfaces) { - if (interfaceKey.match(/^lo/)) continue - - var interfaceDescriptions = interfaces[interfaceKey] - for (var i = 0; i < interfaceDescriptions.length; i++) { - var description = interfaceDescriptions[i] - var family = description.family.toLowerCase() - addresses[family] = description.address - } - } - return addresses -} - -function getHostnameSafe() { - var _hostname - this.getHostnameSafe = function getCachedHostname() { - return _hostname - } - try { - _hostname = os.hostname() - return _hostname - } catch (e) { - var addresses = this.getIPAddresses() - - if (this.process_host.ipv_preference === '6' && addresses.ipv6) { - _hostname = addresses.ipv6 - } else if (addresses.ipv4) { - logger.info('Defaulting to ipv4 address for host name') - _hostname = addresses.ipv4 - } else if (addresses.ipv6) { - logger.info('Defaulting to ipv6 address for host name') - _hostname = addresses.ipv6 - } else { - logger.info('No hostname, ipv4, or ipv6 address found for machine') - _hostname = 'UNKNOWN_BOX' - } - - return _hostname - } -} - -/** - * Ensure that the apps names are always returned as a list. - */ -Config.prototype.applications = function applications() { - var apps = this.app_name - - if (Array.isArray(apps) && apps.length > 0) { - return apps - } - - if (apps && typeof apps === 'string') { - return [apps] - } - - return [] -} - -/** - * Safely overwrite defaults with values passed to constructor. - * - * @param {object} external The configuration being loaded. - * @param {object} internal Whichever chunk of the config being overridden. - */ -Config.prototype._fromPassed = function _fromPassed(external, internal, arbitrary) { - if (!external) return - if (!internal) internal = this - - Object.keys(external).forEach(function overwrite(key) { - // if it's not in the defaults, it doesn't exist - if (!arbitrary && internal[key] === undefined) return - - if (key === 'ssl' && !isTruthular(external.ssl)) { - logger.warn('SSL config key can no longer be disabled, not updating.') - return - } - - try { - var node = external[key] - } catch (err) { - logger.warn('Error thrown on access of user config for key: %s', key) - return - } - - if (typeof node === 'object' && !Array.isArray(node)) { - // is top level and can have arbitrary keys - var allowArbitrary = internal === this || HAS_ARBITRARY_KEYS.has(key) - this._fromPassed(node, internal[key], allowArbitrary) - } else { - internal[key] = node - } - }, this) -} - -/** - * Some values should be picked up only if they're not otherwise set, like - * the Windows / Azure application name. Don't set it if there's already - * a non-empty value set via the configuration file, and allow these - * values to be overwritten by environment variables. Just saves a step for - * PaaS users who don't want to have multiple settings for a single piece - * of configuration. - */ -Config.prototype._fromSpecial = function _fromSpecial() { - var name = this.app_name - if (name === null || name === undefined || name === '' || - (Array.isArray(name) && name.length === 0)) { - var azureName = process.env[AZURE_APP_NAME] - if (azureName) this.app_name = azureName.split(',') - } -} - -/** - * Iterate over all feature flags and check for the corresponding environment variable - * (of the form NEW_RELIC_FEATURE_FLAG_). - */ -Config.prototype._featureFlagsFromEnv = function _featureFlagsFromEnv() { - const flags = Object.keys(feature_flag.prerelease).concat(feature_flag.released) - const config = this - flags.forEach(function checkFlag(flag) { - const envVal = process.env['NEW_RELIC_FEATURE_FLAG_' + flag.toUpperCase()] - if (envVal) { - config.feature_flag[flag] = isTruthular(envVal) - } - }) -} - -/** - * Recursively visit the nodes of the constant containing the mapping between - * environment variable names, overriding any configuration values that are - * found in the environment. Operates purely via side effects. - * - * @param object metadata The current level of the mapping object. Should never - * need to set this yourself. - * @param object data The current level of the configuration object. Should - * never need to set this yourself. - */ -Config.prototype._fromEnvironment = function _fromEnvironment(metadata, data) { - if (!metadata) metadata = ENV.ENV_MAPPING - if (!data) data = this - - Object.keys(metadata).forEach(function applyEnvDefault(value) { - // if it's not in the config, it doesn't exist - if (data[value] === undefined) { - return - } - - var node = metadata[value] - if (typeof node === 'string') { - var setting = process.env[node] - if (setting) { - if (ENV.LIST_VARS.has(node)) { - let split = ENV.LIST_VARS_CUSTOM_DELIMITERS[node] || /,/ - data[value] = setting.split(split).map(function trimVal(k) { - return k.trim() - }) - } else if (ENV.OBJECT_LIST_VARS.has(node)) { - data[value] = fromObjectList(setting) - } else if (ENV.BOOLEAN_VARS.has(node)) { - if (value === 'ssl' && !isTruthular(setting)) { - logger.warn('SSL config key can no longer be disabled, not updating.') - return - } - data[value] = isTruthular(setting) - } else if (ENV.FLOAT_VARS.has(node)) { - data[value] = parseFloat(setting, 10) - } else if (ENV.INT_VARS.has(node)) { - data[value] = parseInt(setting, 10) - } else { - data[value] = setting - } - } - } else { - // don't crash if the mapping has config keys the current config doesn't. - if (!data[value]) data[value] = Object.create(null) - this._fromEnvironment(node, data[value]) - } - }, this) -} - -/** - * Returns true if logging has been manually enabled via configuration file or - * environment variable. - * - * @param {*} inputConfig configuration passed to the Config constructor - * - * @returns {boolean} - */ -Config.prototype._loggingManuallySet = function _loggingManuallySet(inputConfig) { - const inputEnabled = inputConfig && inputConfig.logging && inputConfig.logging.enabled - const envEnabled = process.env.NEW_RELIC_LOG_ENABLED - - return (inputEnabled !== undefined) || (envEnabled !== undefined) -} - -/** - * Returns true if native-metrics has been manually enabled via configuration - * file or enveironment variable - * - * @param {*} inputConfig configuration pass to the Config constructor - * - * @returns {boolean} - */ -Config.prototype._nativeMetricsManuallySet = - function _nativeMetricsManuallySet(inputConfig) { - const inputEnabled = inputConfig - && inputConfig.plugins - && inputConfig.plugins.native_metrics - && inputConfig.plugins.native_metrics.enabled - const envEnabled = process.env.NEW_RELIC_NATIVE_METRICS_ENABLED - - return (inputEnabled !== undefined) || (envEnabled !== undefined) - } - -/** - * Returns true if distributed tracing has been manually enabled via configuration file or - * environment variable. - * - * @param {*} inputConfig configuration passed to the Config constructor - * - * @returns {boolean} - */ -Config.prototype._DTManuallySet = function _DTManuallySet(inputConfig) { - const inputEnabled = inputConfig - && inputConfig.distributed_tracing - && inputConfig.distributed_tracing.enabled - - const envEnabled = process.env.NEW_RELIC_DISTRIBUTED_TRACING_ENABLED - - return (inputEnabled !== undefined) || (envEnabled !== undefined) -} - -/** - * Enforces config rules specific to running in serverless_mode: - * - disables cross_application_tracer.enabled if set - * - defaults logging to disabled - * - verifies data specific to running DT is defined either in config file of env vars - * @param {*} inputConfig configuration passed to the Config constructor - */ -Config.prototype._enforceServerless = function _enforceServerless(inputConfig) { - if (this.serverless_mode.enabled) { - // Explicitly disable old CAT in serverless_mode - if (this.cross_application_tracer.enabled) { - this.cross_application_tracer.enabled = false - logger.info('Cross application tracing is explicitly disabled in serverless_mode.') - } - - if (this.infinite_tracing.trace_observer.host) { - this.infinite_tracing.trace_observer.host = '' - this.infinite_tracing.trace_observer.port = '' - logger.info('Infinite tracing is explicitly disabled in serverless_mode.') - } - - if (!this._loggingManuallySet(inputConfig)) { - this.logging.enabled = false - - logger.info( - 'Logging is disabled by default when serverless_mode is enabled. ' + - 'If desired, enable logging via config file or environment variable and ' + - 'set filepath to a valid path for current environment, stdout or stderr.' - ) - } - - if (this._nativeMetricsManuallySet(inputConfig) && - this.plugins.native_metrics.enabled) { - logger.info( - 'Enabling the native-metrics module when in serverless mode may greatly ' + - 'increase cold-start times. Given the limited benefit of the VM metrics' + - 'and general lack of control in a serverless environment, we do not ' + - 'recommend this trade-off.' - ) - } else { - this.plugins.native_metrics.enabled = false - - logger.info( - 'The native-metrics module is disabled by default when serverless_mode ' + - 'is enabled. If desired, enable the native-metrics module via config file ' + - 'or environment variable.' - ) - } - - if (!this._DTManuallySet(inputConfig)) { - this.distributed_tracing.enabled = true - } - - if (!this.account_id) { - if (this.distributed_tracing.enabled) { - logger.warn( - 'Using distributed tracing in serverless mode requires account_id be ' + - 'defined, either in your newrelic.js file or via environment variables. ' + - 'Disabling distributed tracing.' - ) - this.distributed_tracing.enabled = false - } - - return - } - // default trusted_account_key to account_id - this.trusted_account_key = this.trusted_account_key || this.account_id - - // Not required in serverless mode but must default to Unknown to function. - this.primary_application_id = this.primary_application_id || 'Unknown' - - return - } - - const DT_KEYS = ['account_id', 'primary_application_id', 'trusted_account_key'] - // Don't allow DT config settings to be set if serverless_mode is disabled - DT_KEYS.forEach((key) => { - if (this[key]) { - logger.warn( - key + ' was configured locally without enabling serverless_mode. ' + - 'This local value will be ignored and set by the New Relic servers.' - ) - this[key] = null - } - }) -} - -/** - * Depending on how the status codes are set, they could be strings, which - * makes strict equality testing / indexOf fail. To keep things cheap, parse - * them once, after configuration has finished loading. Other one-off shims - * based on special properties of configuration values should go here as well. - */ -Config.prototype._canonicalize = function _canonicalize() { - var statusCodes = this.error_collector && this.error_collector.ignore_status_codes - if (statusCodes) { - this.error_collector.ignore_status_codes = _parseCodes(statusCodes) - } - - const expectedCodes = this.error_collector && this.error_collector.expected_status_codes - if (statusCodes) { - this.error_collector.expected_status_codes = _parseCodes(expectedCodes) - } - - var logAliases = { - verbose: 'trace', - debugging: 'debug', - warning: 'warn', - err: 'error' - } - var level = this.logging.level - this.logging.level = logAliases[level] || level - - if (this.host === '') { - var region = parseKey(this.license_key) - if (region) { - this.host = 'collector.' + region + '.nr-data.net' - } else { - this.host = 'collector.newrelic.com' - } - } - - if (isTruthular(this.ignore_server_configuration)) { - logger.warnOnce( - 'IgnoreServerConfigurationWarning', - 'The local config setting `ignore_server_configuration` has been deprecated ' + - 'and removed as of Agent v5. Please review agent documentation or contact ' + - 'New Relic support.' - ) - } - - this.serverless_mode.enabled = this.serverless_mode.enabled - && this.feature_flag.serverless_mode - - if (this.license_key) { - this.license_key = this.license_key.trim() - } -} - -function _parseCodes(codes) { - // range does not support negative values - function parseRange(range, parsed) { - var split = range.split('-') - if (split.length !== 2) { - logger.warn('Failed to parse range %s', range) - return parsed - } - if (split[0] === '') { // catch negative code. ex. -7 - return parsed.push(parseInt(range, 10)) - } - var lower = parseInt(split[0], 10) - var upper = parseInt(split[1], 10) - if (Number.isNaN(lower) || Number.isNaN(upper)) { - logger.warn('Range must contain two numbers %s', range) - return parsed - } - if (lower > upper) { - logger.warn('Range must start with lower bound %s', range) - } else if (lower < 0 || upper > 1000) { - logger.warn('Range must be between 0 and 1000 %s', range) - } else { // success - for (var i = lower; i <= upper; i++) { - parsed.push(i) - } - } - return parsed - } - - var parsedCodes = [] - for (var i = 0; i < codes.length; i++) { - var code = codes[i] - var parsedCode - if (typeof code === 'string' && code.indexOf('-') !== -1) { - parseRange(code, parsedCodes) - } else { - parsedCode = parseInt(code, 10) - if (!Number.isNaN(parsedCode)) { - parsedCodes.push(parsedCode) - } else { - logger.warn('Failed to parse status code %s', code) - } - } - } - return parsedCodes -} - -/** - * This goes through the settings that high security mode needs and coerces - * them to be correct. - */ -Config.prototype._applyHighSecurity = function _applyHighSecurity() { - var config = this - checkNode('', this, HSM.HIGH_SECURITY_SETTINGS) - // as a one off, we add a global exclude rule to the list to keep from - // clobbering user defined rules - - this.attributes.exclude.push('request.parameters.*') - - function checkNode(base, target, settings) { - Object.keys(settings).forEach(checkKey.bind(null, base, target, settings)) - } - - function checkKey(base, target, settings, key) { - var hsValue = settings[key] - - if (hsValue && typeof hsValue === 'object' && !(hsValue instanceof Array)) { - if (typeof target[key] !== 'object') { - logger.warn( - 'High Security Mode: %s should be an object, found %s', - key, - target[key] - ) - target[key] = Object.create(null) - } - - return checkNode(base + key + '.', target[key], hsValue) - } - - if (target[key] !== hsValue) { - logger.warn( - 'High Security Mode: %s was set to %s, coercing to %s', - key, - target[key], - hsValue - ) - target[key] = hsValue - config.emit(base + key, hsValue) - } - } -} - -/** - * Checks policies received from preconnect against those expected - * by the agent, if LASP-enabled. Responds with an error to shut down - * the agent if necessary. - * - * @param {Agent} agent - * @param {object} policies - * - * @returns {CollectorResponse} The result of the processing, with the known - * policies as the response payload. - */ -Config.prototype.applyLasp = function applyLasp(agent, policies) { - var config = this - var keys = Object.keys(policies) - - if (!config.security_policies_token) { - if (keys.length) { - logger.error( - 'The agent received one or more unexpected security policies and will shut down.' - ) - return CollectorResponse.fatal(null) - } - return CollectorResponse.success(null) - } - - var missingLASP = [] - var missingRequired = [] - - var finalPolicies = keys.reduce(function applyPolicy(obj, name) { - var policy = policies[name] - var localMapping = LASP_MAP[name] - - if (!localMapping) { - if (!policy.required) { - // policy is not implemented in agent -- don't send to connect - return obj - } - // policy is required but does not exist in agent -- fail - missingRequired.push(name) - } else { - var splitConfigName = localMapping.path.split('.') - var settingBlock = config[splitConfigName[0]] - // pull out the configuration subsection that the option lives in - for (var i = 1; i < splitConfigName.length - 1; ++i) { - settingBlock = settingBlock[splitConfigName[i]] - } - var valueName = splitConfigName[splitConfigName.length - 1] - var localVal = settingBlock[valueName] - - // Indexes into "allowed values" based on "enabled" setting - // to retreive proper mapping. - var policyValues = localMapping.allowedValues - var policyValue = policyValues[policy.enabled ? 1 : 0] - - // get the most secure setting between local config and the policy - var finalValue = settingBlock[valueName] = config._getMostSecure( - name, - localVal, - policyValue - ) - policy.enabled = policyValues.indexOf(finalValue) === 1 - obj[name] = policy - - if (!policy.enabled && localMapping.applyAdditionalSettings) { - localMapping.applyAdditionalSettings(config) - } - - if (finalValue !== localVal) { - // finalValue is more secure than original local val, - // so drop corresponding data - localMapping.clearData(agent) - } - } - - return obj - }, Object.create(null)) - - Object.keys(LASP_MAP).forEach(function checkPolicy(name) { - if (!policies[name]) { - // agent is expecting a policy that was not sent from server -- fail - missingLASP.push(name) - } - }) - - let fatalMessage = null - if (missingLASP.length) { - fatalMessage = - 'The agent did not receive one or more security policies that it ' + - 'expected and will shut down: ' + missingLASP.join(', ') + '.' - } else if (missingRequired.length) { - fatalMessage = - 'The agent received one or more required security policies that it ' + - 'does not recognize and will shut down: ' + missingRequired.join(', ') + - '. Please check if a newer agent version supports these policies ' + - 'or contact support.' - } - - if (fatalMessage) { - logger.error(fatalMessage) - return CollectorResponse.fatal(null) - } - - return CollectorResponse.success(finalPolicies) -} - -Config.prototype.validateFlags = function validateFlags() { - Object.keys(this.feature_flag).forEach(function forEachFlag(key) { - if (feature_flag.released.indexOf(key) > -1) { - logger.warn('Feature flag %s has been released', key) - } - if (feature_flag.unreleased.indexOf(key) > -1) { - logger.warn('Feature flag %s has been deprecated', key) - } - }) -} - -function redactValue(value) { - const REDACT_VALUE = '****' - - let result = null - if (Array.isArray(value)) { - // Redact each value so we know if was configured and how many values - result = value.map(() => REDACT_VALUE) - } else { - result = REDACT_VALUE - } - - return result -} - -/** - * Get a JSONifiable object containing all settings we want to report to the - * collector and store in the environment_values table. - * - * @return Object containing simple key-value pairs of settings - */ -Config.prototype.publicSettings = function publicSettings() { - var settings = Object.create(null) - - for (var key in this) { - if (this.hasOwnProperty(key) && !REMOVE_BEFORE_SEND.has(key)) { - if (HSM.REDACT_BEFORE_SEND.has(key)) { - const value = this[key] - settings[key] = redactValue(value) - } else if (!HSM.REMOVE_BEFORE_SEND.has(key)) { - settings[key] = this[key] - } - } - } - - // Agent-side setting is 'enable', but collector-side setting is - // 'auto_instrument'. Send both values up. - settings.browser_monitoring.auto_instrument = settings.browser_monitoring.enable - - try { - settings = stringify(settings) - // Remove simple circular references - return flatten(Object.create(null), '', JSON.parse(settings)) - } catch (err) { - logger.error(err, 'Unable to stringify settings object') - } -} - -Config.prototype.getAggregatorConfig = function getAggregatorConfig(method) { - const harvestConfig = this.event_harvest_config - const isValidConfig = harvestConfigValidator.isValidHarvestConfig(harvestConfig) - const limit = harvestConfig.harvest_limits[method] - if (!isValidConfig || !harvestConfigValidator.isValidHarvestValue(limit)) { - return null - } - - return { - limit, - periodMs: harvestConfig.report_period_ms - } -} - -/** - * Create a configuration, either from a configuration file or the node - * process's environment. - * - * For configuration via file, check these directories, in order, for a - * file named 'newrelic.js': - * - * 1. The process's current working directory at startup. - * 2. The same directory as the process's main module (i.e. the filename - * passed to node on the command line). - * 3. The directory pointed to by the environment variable NEW_RELIC_HOME. - * 4. The current process's HOME directory. - * 5. If this module is installed as a dependency, the directory above the - * node_modules folder in which newrelic is installed. - * - * For configration via environment (useful on Joyent, Azure, Heroku, or - * other PaaS offerings), set NEW_RELIC_NO_CONFIG_FILE to something truthy - * and read README.md for details on what configuration variables are - * necessary, as well as a complete enumeration of the other available - * variables. - * - * @param {object} config Optional configuration to be used in place of a - * config file. - */ -function initialize(config) { - /** - * When the logger is required here, it bootstraps itself and then - * injects itself into this module's closure via setLogger on the - * instance of the logger it creates. - */ - logger = require('../logger') - - if (config) return new Config(config) - - if (isTruthular(process.env.NEW_RELIC_NO_CONFIG_FILE)) { - config = new Config(Object.create(null)) - if (config.newrelic_home) delete config.newrelic_home - return config - } - - var filepath = _findConfigFile() - if (!filepath) { - _noConfigFile() - return null - } - - var userConf - try { - userConf = require(filepath).config - } catch (error) { - logger.error(error) - - throw new Error([ - `Unable to read configuration file "${filepath}".`, - `A base configuration file can be copied from ${BASE_CONFIG_PATH}`, - 'and renamed to "newrelic.js" in the directory from which you will start', - 'your application.' - ].join('\n')) - } - - config = new Config(userConf) - config.config_file_path = filepath - logger.debug('Using configuration file %s.', filepath) - - config.validateFlags() - - return config -} - -function _noConfigFile() { - const mainpath = path.resolve(path.join(process.cwd(), DEFAULT_FILENAME)) - // If agent was loaded with -r flag, default to the path of the file being executed - const mainModule = process.mainModule && process.mainModule.filename || process.argv[1] - const altpath = path.resolve( - path.dirname(mainModule), - DEFAULT_FILENAME - ) - - let locations = mainpath - if (mainpath !== altpath) { - locations += ' or\n' + altpath - } - - /* eslint-disable no-console */ - console.error([ - 'Unable to find New Relic module configuration. A base configuration file', - `can be copied from ${BASE_CONFIG_PATH}`, - `and put at ${locations}.`, - 'If you are not using file-based configuration, please set the environment', - 'variable `NEW_RELIC_NO_CONFIG_FILE=true`.' - ].join('\n')) - /* eslint-enable no-console */ -} - -/** - * This function honors the singleton nature of this module while allowing - * consumers to just request an instance without having to worry if one was - * already created. - */ -function getOrCreateInstance() { - if (_configInstance === null) { - try { - _configInstance = initialize() - } catch (err) { - /* eslint-disable no-console */ - console.error('New Relic for Node.js is disabled due to an error:') - console.error(err.stack) - /* eslint-enable no-console */ - - // Config construction has potential to throw due to invalid settings. - // This allows the agent to return a stub api without crashing the process. - _configInstance = Object.assign(defaultConfig(), {agent_enabled: false}) - _configInstance.setLogger = Config.prototype.setLogger - } - } - return _configInstance -} - -function getInstance() { - return _configInstance -} - -function createInstance(config) { - _configInstance = initialize(config) - return _configInstance -} - -const REMOVE_BEFORE_SEND = new Set(['attributeFilter']) - -/** - * Preserve the legacy initializer, but also allow consumers to manage their - * own configuration if they choose. - */ -Config.initialize = initialize -Config.getOrCreateInstance = getOrCreateInstance -Config.getInstance = getInstance -Config.createInstance = createInstance -Config.SPAN_EVENT_LIMIT = SPAN_EVENT_LIMIT - -module.exports = Config diff --git a/node_modules/newrelic/lib/config/lasp.js b/node_modules/newrelic/lib/config/lasp.js deleted file mode 100644 index f9b165b4..00000000 --- a/node_modules/newrelic/lib/config/lasp.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// TODO: would likely be easier to understand if the allowedValues mapping -// just took the raw enabled/disabled and translated. This is not a hot path. - -/** - * path: Full nested path for the local configuration item. - * allowedValues: - * Array of valid config values to map for incoming enabled/disabled. - * policy.enabled: false uses index 0, policy.enabled: true uses index 1. - * filter: Allows for calculating most secure setting to use - * applyAdditionalSettings: Applies additional settings that are required - * when the policy is disabled. - * clearData: Clears the relevant agent collection. - */ -const LASP_MAP = { - // LASP key - record_sql: { - // full path to corresponding config key - path: 'transaction_tracer.record_sql', - // Mapping from policy enabled status to usable config value - // policy.enabled: false === off, policy.enabled: true === 'obfuscated' - allowedValues: ['off', 'obfuscated'], - // Tracks the precedent of settings controlled by LASP. - filter: function mostSecureRecordSQL(first, second) { - // Ordered from least to most secure - var recordSQLSettings = ['obfuscated', 'off'] - var firstIdx = recordSQLSettings.indexOf(first) - var secondIdx = recordSQLSettings.indexOf(second) - if (firstIdx < 0 && secondIdx < 0) { - // Return the most secure possible - return recordSQLSettings[recordSQLSettings.length - 1] - } - return firstIdx < secondIdx ? second : first - }, - // Invokes agent method to drop any corresponding data - clearData: function resetCollectedData(agent) { - agent._resetQueries() - } - }, - - attributes_include: { - path: 'attributes.include_enabled', - allowedValues: [false, true], - filter: function mostSecureAttributesInclude(first, second) { - return first && second - }, - applyAdditionalSettings: function applyAdditionalSettings(config) { - config.attributes.exclude.push('request.parameters.*') - }, - clearData: function clearCollectedData(agent) { - if (agent.config.attributes.enabled && agent.config.attributes.include.length) { - agent.traces.clear() - } - } - }, - - // TODO: rename config key, because the names contradict each other's behavior - allow_raw_exception_messages: { - path: 'strip_exception_messages.enabled', - // if raw messages are allowed, then we should not strip them - // policy.enabled: false === true, policy.enabled: true === false - allowedValues: [true, false], - filter: function mostSecureStripException(first, second) { - return first || second - }, - clearData: function resetErrors(agent) { - agent._resetErrors() - } - }, - - custom_events: { - path: 'api.custom_events_enabled', - allowedValues: [false, true], - filter: function mostSecureCustomEvents(first, second) { - return first && second - }, - clearData: function resetCustomEvents(agent) { - agent._resetCustomEvents() - } - }, - - custom_parameters: { - path: 'api.custom_attributes_enabled', - allowedValues: [false, true], - filter: function mostSecureCustomAttributes(first, second) { - return first && second - }, - clearData: function resetCustomAttributes(agent) { - if (agent.config.attributes.enabled) { - agent.traces.clear() - } - } - }, - // Unimplemented - custom_instrumentation_editor: null, - message_parameters: null, - job_arguments: null -} - -exports.LASP_MAP = LASP_MAP diff --git a/node_modules/newrelic/lib/config/merge-server-config.js b/node_modules/newrelic/lib/config/merge-server-config.js deleted file mode 100644 index 3a683582..00000000 --- a/node_modules/newrelic/lib/config/merge-server-config.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -class MergeServerConfig { - // eslint-disable-next-line max-params - updateNestedIfChanged(config, remote, local, remoteKey, localKey, logger) { - var value = remote[remoteKey] - - // if the value hasn't changed, skip this work. - // currently, this will always treat objects as - // new as it does not do a deep-check. - if (value === null || local[localKey] === value) { - return - } - - // we need different update/merge logic if the server - // value is an array, a simple object, or anything else - if (Array.isArray(value) && Array.isArray(local[localKey])) { - this.updateArray(value, local, localKey) - } else if (this.isSimpleObject(value) && this.isSimpleObject(local[localKey])) { - this.updateObject(value, local, localKey) - } else { - local[localKey] = value - } - config.emit(remoteKey, value) - logger.debug('Configuration of %s was changed to %s by New Relic.', remoteKey, value) - } - - updateArray(value, local, localKey) { - value.forEach( (element) => { - if (local[localKey].indexOf(element) === -1) local[localKey].push(element) - }) - } - - updateObject(value, local, localKey) { - // go through each key of the object and update it - Object.keys(value).forEach( (element) => { - if (Array.isArray(local[localKey][element]) && Array.isArray(value[element])) { - // if both key-values are arrays, push the remote value onto the local array - value[element].forEach( (elementValue) => { - if (-1 === local[localKey][element].indexOf(elementValue)) { - local[localKey][element].push(elementValue) - } - }) - } else { - // otherwise, replace the local value with the server value - local[localKey][element] = value[element] - } - }) - } - - isSimpleObject(thing) { - return 'object' === (typeof thing) && thing !== null - } -} - -module.exports = MergeServerConfig diff --git a/node_modules/newrelic/lib/custom-events/custom-event-aggregator.js b/node_modules/newrelic/lib/custom-events/custom-event-aggregator.js deleted file mode 100644 index 8634be3e..00000000 --- a/node_modules/newrelic/lib/custom-events/custom-event-aggregator.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'custom-event-aggregator'}) -const EventAggregator = require('../aggregators/event-aggregator') - -const NAMES = require('../metrics/names') - -class CustomEventAggregator extends EventAggregator { - constructor(opts, collector, metrics) { - opts = opts || {} - opts.method = opts.method || 'custom_event_data' - opts.metricNames = NAMES.CUSTOM_EVENTS - - super(opts, collector, metrics) - } - - _toPayloadSync() { - const events = this.events - - if (events.length === 0) { - logger.debug('No custom events to send.') - return - } - - const eventData = events.toArray() - - return [this.runId, eventData] - } -} - -module.exports = CustomEventAggregator diff --git a/node_modules/newrelic/lib/db/parse-sql.js b/node_modules/newrelic/lib/db/parse-sql.js deleted file mode 100644 index a94245e3..00000000 --- a/node_modules/newrelic/lib/db/parse-sql.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// TODO: remove in favor of /lib/db/query-parsers/sql.js -// This module is currently used only in the Oracle instrumentation - -var logger = require('../logger').child({component: 'parse_sql'}) -var StatementMatcher = require('./statement-matcher') -var ParsedStatement = require('./parsed-statement') -var stringify = require('json-stringify-safe') - - -var OPERATIONS = [ - new StatementMatcher('select', /^\s*select[\S\s]*from[\s\[]+([^\]\s,)(;]*).*/gi), - new StatementMatcher('update', /^\s*update\s+([^\s,;]*).*/gi), - new StatementMatcher('insert', /^\s*insert(?:\s+ignore)?\s+into\s+([^\s(,;]*).*/gi), - new StatementMatcher('delete', /^\s*delete\s+from\s+([^\s,(;]*).*/gi) -] -var COMMENT_PATTERN = /\/\\*.*?\\*\// - -// This must be called syncronously after the initial db call for backtraces to -// work correctly - -module.exports = function parseSql(type, sql) { - // Sometimes we get an object here from MySQL. We have been unable to - // reproduce it, so we'll just log what that object is and return a statement - // type of `other`. - if (typeof sql === 'object' && sql.sql !== undefined) sql = sql.sql - if (typeof sql !== 'string') { - if (logger.traceEnabled()) { - try { - logger.trace( - 'parseSQL got an a non-string sql that looks like: %s', - stringify(sql) - ) - } catch (err) { - logger.debug(err, 'Unabled to stringify SQL') - } - } - return new ParsedStatement(type, 'other', null, sql) - } - - sql = sql.replace(COMMENT_PATTERN, '').trim() - - - var parsedStatement - - for (var i = 0, l = OPERATIONS.length; i < l; i++) { - parsedStatement = OPERATIONS[i].getParsedStatement(sql) - if (parsedStatement) { - return new ParsedStatement( - type, - parsedStatement.operation, - parsedStatement.collection, - parsedStatement.query - ) - } - } - - return new ParsedStatement(type, 'other', null, sql) -} diff --git a/node_modules/newrelic/lib/db/parsed-statement.js b/node_modules/newrelic/lib/db/parsed-statement.js deleted file mode 100644 index e20eb7e4..00000000 --- a/node_modules/newrelic/lib/db/parsed-statement.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const {DB, ALL} = require('../metrics/names') -const {DESTINATIONS} = require('../config/attribute-filter') - - -function ParsedStatement(type, operation, collection, raw) { - this.type = type - this.operation = operation - this.collection = collection - this.trace = null - this.raw = '' - - if (typeof raw === 'string') { - this.trace = new Error().stack - this.raw = raw - } -} - -ParsedStatement.prototype.recordMetrics = function recordMetrics(segment, scope) { - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var transaction = segment.transaction - var type = transaction.isWeb() ? DB.WEB : DB.OTHER - var thisTypeSlash = this.type + '/' - var operation = DB.OPERATION + '/' + thisTypeSlash + this.operation - - // Note, an operation metric should _always_ be created even if the action was - // a statement. This is part of the spec. - - // Rollups - transaction.measure(operation, null, duration, exclusive) - transaction.measure(DB.PREFIX + type, null, duration, exclusive) - transaction.measure(DB.PREFIX + thisTypeSlash + type, null, duration, exclusive) - transaction.measure(DB.PREFIX + thisTypeSlash + ALL, null, duration, exclusive) - transaction.measure(DB.ALL, null, duration, exclusive) - - // If we can parse the SQL statement, create a 'statement' metric, and use it - // as the scoped metric for transaction breakdowns. Otherwise, skip the - // 'statement' metric and use the 'operation' metric as the scoped metric for - // transaction breakdowns. - if (this.collection) { - var collection = - DB.STATEMENT + '/' + thisTypeSlash + this.collection + '/' + this.operation - transaction.measure(collection, null, duration, exclusive) - if (scope) { - transaction.measure(collection, scope, duration, exclusive) - } - } else if (scope) { - transaction.measure(operation, scope, duration, exclusive) - } - - // This recorder is side-effectful Because we are depending on the recorder - // setting the transaction name, recorders must always be run before generating - // the final transaction trace - segment.name = collection || operation - - // Datastore instance metrics. - const attributes = segment.attributes.get(DESTINATIONS.TRANS_SEGMENT) - if (attributes.host && attributes.port_path_or_id) { - var instanceName = DB.INSTANCE + '/' + thisTypeSlash + attributes.host + - '/' + attributes.port_path_or_id - transaction.measure(instanceName, null, duration, exclusive) - } - - if (this.raw) { - transaction.agent.queries.add( - segment, - this.type.toLowerCase(), - this.raw, - this.trace - ) - } -} - -module.exports = ParsedStatement diff --git a/node_modules/newrelic/lib/db/query-parsers/sql.js b/node_modules/newrelic/lib/db/query-parsers/sql.js deleted file mode 100644 index a8bfb12e..00000000 --- a/node_modules/newrelic/lib/db/query-parsers/sql.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../../logger').child({component: 'sql_query_parser'}) -var StatementMatcher = require('../statement-matcher') -var stringify = require('json-stringify-safe') - - -var OPERATIONS = [ - new StatementMatcher( - 'select', - /^[^\S]*?select\b[\s\S]+?\bfrom[\s\n\r\[\(]+([^\]\s\n\r,)(;]*)/gim - ), - new StatementMatcher('update', /^[^\S]*?update[^\S]+?([^\s\n\r,;]+)/gim), - new StatementMatcher( - 'insert', - /^[^\S]*?insert(?:[^\S]+ignore)?[^\S]+into[^\S]+([^\s\n\r(,;]+)/gim - ), - new StatementMatcher('delete', /^[^\S]*?delete[^\S]+?from[^\S]+([^\s\n\r,(;]+)/gim) -] -var COMMENT_PATTERN = /\/\\*.*?\\*\//g - -// This must be called syncronously after the initial db call for backtraces to -// work correctly - -module.exports = function parseSql(sql) { - // Sometimes we get an object here from MySQL. We have been unable to - // reproduce it, so we'll just log what that object is and return a statement - // type of `other`. - if (typeof sql === 'object' && sql.sql !== undefined) sql = sql.sql - if (typeof sql !== 'string') { - if (logger.traceEnabled()) { - try { - logger.trace( - 'parseSQL got an a non-string sql that looks like: %s', - stringify(sql) - ) - } catch (err) { - logger.debug(err, 'Unabler to stringify SQL') - } - } - return { - operation: 'other', - collection: null, - query: '' - } - } - - sql = sql.replace(COMMENT_PATTERN, '').trim() - - - var parsedStatement - - for (var i = 0, l = OPERATIONS.length; i < l; i++) { - parsedStatement = OPERATIONS[i].getParsedStatement(sql) - if (parsedStatement) { - break - } - } - - if (parsedStatement) { - return parsedStatement - } - - return { - operation: 'other', - collection: null, - query: sql - } -} diff --git a/node_modules/newrelic/lib/db/query-sample.js b/node_modules/newrelic/lib/db/query-sample.js deleted file mode 100644 index de7a70bf..00000000 --- a/node_modules/newrelic/lib/db/query-sample.js +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var codec = require('../util/codec') -var Stats = require('../stats') -var util = require('util') - -function QuerySample(tracer, slowQuery) { - Stats.call(this) - this.tracer = tracer - this.trace = slowQuery - this.aggregate(slowQuery) -} - -util.inherits(QuerySample, Stats) - -QuerySample.prototype.aggregate = function aggregate(slowQuery) { - this.recordValue(slowQuery.duration) - if (this.trace && this.trace.duration >= slowQuery.duration) return - this.trace = slowQuery -} - -QuerySample.prototype.merge = function merge(sample) { - Stats.prototype.merge.call(this, sample) - if (this.trace.duration < sample.trace.duration) { - this.trace = sample.trace - } -} - -QuerySample.prototype.prepareJSON = function prepareJSON(done) { - var transaction = this.trace.segment.transaction - var sample = this - var trace = sample.trace - - var params = sample.getParams() - - if (!this.tracer.config.simple_compression) { - codec.encode(params, respond) - } else { - process.nextTick(respond.bind(null, null, params)) - } - - function respond(err, data) { - if (err) return done(err) - - done(null, _getJSON(sample, trace, transaction, data)) - } -} - -QuerySample.prototype.prepareJSONSync = function prepareJSONSync() { - const transaction = this.trace.segment.transaction - const sample = this - const trace = sample.trace - - const params = sample.getParams() - const data = this.tracer.config.simple_compression ? params : codec.encodeSync(params) - return _getJSON(sample, trace, transaction, data) -} - -function _getJSON(sample, trace, transaction, data) { - return [ - transaction.getFullName(), - transaction.url || '', - trace.id, - getQuery(sample.tracer.config, trace), - trace.metric, - sample.callCount, - sample.total, - sample.min, - sample.max, - data - ] -} - -QuerySample.prototype.getParams = function getParams() { - var segmentAttrs = this.trace.segment.getAttributes() - var params = { - backtrace: this.trace.trace, - } - - if (segmentAttrs.host) { - params.host = segmentAttrs.host - } - - if (segmentAttrs.port_path_or_id) { - params.port_path_or_id = segmentAttrs.port_path_or_id - } - - if (segmentAttrs.database_name) { - params.database_name = segmentAttrs.database_name - } - - if (this.tracer.config.distributed_tracing.enabled) { - this.trace.segment.transaction.addDistributedTraceIntrinsics(params) - } - - return params -} - -function getQuery(config, trace) { - switch (config.transaction_tracer.record_sql) { - case 'raw': - return trace.query - case 'obfuscated': - return trace.obfuscated - default: - return '?' - } -} - -module.exports = QuerySample diff --git a/node_modules/newrelic/lib/db/query-trace-aggregator.js b/node_modules/newrelic/lib/db/query-trace-aggregator.js deleted file mode 100644 index cf652909..00000000 --- a/node_modules/newrelic/lib/db/query-trace-aggregator.js +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const a = require('async') -const logger = require('../logger').child({component: 'query_tracer'}) -const Aggregator = require('../aggregators/base-aggregator') -const SlowQuery = require('./slow-query') -const QuerySample = require('./query-sample') - -class QueryTraceAggregator extends Aggregator { - constructor(opts, collector) { - opts = opts || {} - opts.method = opts.method || 'sql_trace_data' - if (!opts.config) { - throw new Error('config required by query trace aggregator') - } - super(opts, collector) - - const config = opts.config - this.samples = new Map() - - this.config = config - } - - removeShortest() { - let shortest = null - for (let sample of this.samples.values()) { - const trace = sample.trace - if (!shortest || shortest.duration > trace.duration) { - shortest = trace - } - } - - this.samples.delete(shortest.normalized) - } - - _merge(samples) { - for (let sample of samples.values()) { - let ownSample = this.samples.get(sample.trace.normalized) - if (ownSample) { - ownSample.merge(sample) - } else { - this.samples.set(sample.trace.normalized, sample) - } - } - } - - add(segment, type, query, trace) { - const ttConfig = this.config.transaction_tracer - - // If DT is enabled and the segment is part of a sampled transaction - // (i.e. we are creating a span event for this segment), then we need - // to collect the sql trace. - var slowQuery - switch (ttConfig.record_sql) { - case 'raw': - slowQuery = new SlowQuery(segment, type, query, trace) - logger.trace('recording raw sql') - segment.addAttribute('sql', slowQuery.query, true) - break - case 'obfuscated': - slowQuery = new SlowQuery(segment, type, query, trace) - logger.trace('recording obfuscated sql') - segment.addAttribute('sql_obfuscated', slowQuery.obfuscated, true) - break - default: - logger.trace( - 'not recording sql statement, transaction_tracer.record_sql was set to %s', - ttConfig.record_sql - ) - return - } - - if (segment.getDurationInMillis() < ttConfig.explain_threshold) { - return - } - - slowQuery = slowQuery || new SlowQuery(segment, type, query, trace) - - segment.addAttribute('backtrace', slowQuery.trace) - - if (!this.config.slow_sql.enabled) { - return - } - - const ownSample = this.samples.get(slowQuery.normalized) - if (ownSample) { - return ownSample.aggregate(slowQuery) - } - - this.samples.set(slowQuery.normalized, new QuerySample(this, slowQuery)) - - // Do not remove the shortest sample when in serverless mode, since - // sampling is disabled. - if (this.config.serverless_mode.enabled) { - return - } - - if (this.samples.size > this.config.slow_sql.max_samples) { - this.removeShortest() - } - } - - _toPayload(cb) { - if (this.samples.size === 0) { - logger.debug('No query traces to send.') - return cb(null, null) - } - - const runId = this.runId - - return this.prepareJSON((err, data) => cb(err, [runId, data])) - } - - _toPayloadSync() { - if (this.samples.size > 0) { - return [this.runId, this.prepareJSONSync()] - } - - logger.debug('No query traces to send.') - } - - _getMergeData() { - return this.samples - } - - clear() { - this.samples = new Map() - } - - prepareJSON(done) { - a.map(this.samples.values(), (sample, cb) => sample.prepareJSON(cb), done) - } - - prepareJSONSync() { - return Array.from(this.samples.values()).map((sample) => sample.prepareJSONSync()) - } -} - -module.exports = QueryTraceAggregator diff --git a/node_modules/newrelic/lib/db/slow-query.js b/node_modules/newrelic/lib/db/slow-query.js deleted file mode 100644 index b693a4ee..00000000 --- a/node_modules/newrelic/lib/db/slow-query.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const obfuscate = require('../util/sql/obfuscate') -const crypto = require('crypto') -const path = require('path') -const NR_ROOT = path.resolve(__dirname, '..') - -function SlowQuery(segment, type, query, trace) { - this.obfuscated = obfuscate(query, type) - this.normalized = this.obfuscated.replace(/\?\s*,\s*|\s*/g, '') - this.id = normalizedHash(this.normalized) - this.segment = segment - this.query = query - this.metric = segment.name - this.trace = formatTrace(trace) - this.duration = segment.getDurationInMillis() -} - -function normalizedHash(value) { - // We leverage the last 16 hex digits of which would mostly fit in a long and - // rely on parseInt to drop bits that do not fit in a JS number - return parseInt(crypto.createHash('sha1').update(value).digest('hex').slice(-16), 16) -} - -function formatTrace(trace) { - // remove error message and instrumentation frames from stack trace - return trace ? trace.split('\n').slice(1).filter(notNR).join('\n') : '' -} - -function notNR(frame) { - return frame.indexOf(NR_ROOT) === -1 -} - -module.exports = SlowQuery diff --git a/node_modules/newrelic/lib/db/statement-matcher.js b/node_modules/newrelic/lib/db/statement-matcher.js deleted file mode 100644 index 5dac1a6c..00000000 --- a/node_modules/newrelic/lib/db/statement-matcher.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// ( ` database` . ` table ` ) -var CLEANER = /^\(?(?:([`'"]?)(.*?)\1\.)?([`'"]?)(.*?)\3\)?$/ - -function StatementMatcher(operation, operationPattern) { - this.operation = operation - this.matcher = new RegExp('^\\s*' + operation, 'ig') - this.operationPattern = operationPattern -} - -StatementMatcher.prototype.getParsedStatement = function getParsedStatement(sql) { - this.operationPattern.lastIndex = 0 - this.matcher.lastIndex = 0 - CLEANER.lastIndex = 0 - - if (this.matcher.test(sql)) { - var queryMatch = this.operationPattern.exec(sql) - var collection = queryMatch ? queryMatch[1] : 'unknown' - var database = null - - // If the cleaner can match this collection, pull out the cleaned up names - // from there. The spec doesn't want the database names in the collection - // name, but for legacy reasons we keep it. - // TODO: Either update the spec (and CATs) to accept database name in the - // collection name or remove it here. - var cleanerMatch = CLEANER.exec(collection) - if (cleanerMatch && cleanerMatch[4]) { - collection = cleanerMatch[4] - if (cleanerMatch[2]) { - database = cleanerMatch[2] - collection = database + '.' + collection - } - } - - // TODO: Pass through the database here to the parsed statement. It could - // be used for datastore attributes. - return { - operation: this.operation, - database: database, - collection: collection, - query: sql - } - } - - return null -} - -module.exports = StatementMatcher diff --git a/node_modules/newrelic/lib/db/utils.js b/node_modules/newrelic/lib/db/utils.js deleted file mode 100644 index 2bc3a50f..00000000 --- a/node_modules/newrelic/lib/db/utils.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports.extractDatabaseChangeFromUse = extractDatabaseChangeFromUse - -function extractDatabaseChangeFromUse(sql) { - // The character ranges for this were pulled from - // http://dev.mysql.com/doc/refman/5.7/en/identifiers.html - var match = /^\s*use[^\w`]+([\w$_\u0080-\uFFFF]+|`[^`]+`)[\s;]*$/i.exec(sql) - return match && match[1] || null -} diff --git a/node_modules/newrelic/lib/environment.js b/node_modules/newrelic/lib/environment.js deleted file mode 100644 index 35b6766c..00000000 --- a/node_modules/newrelic/lib/environment.js +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var a = require('async') -var path = require('path') -var fs = require('./util/unwrapped-core').fs -var os = require('os') -var logger = require('./logger').child({component: 'environment'}) -var stringify = require('json-stringify-safe') - - -// As of 1.7.0 you can no longer dynamically link v8 -// https://github.com/nodejs/io.js/commit/d726a177ed -var remapping = { - node_install_npm: "npm installed?", - node_install_waf: "WAF build system installed?", - node_use_openssl: "OpenSSL support?", - node_shared_openssl: "Dynamically linked to OpenSSL?", - node_shared_v8: "Dynamically linked to V8?", - node_shared_zlib: "Dynamically linked to Zlib?", - node_use_dtrace: "DTrace support?", - node_use_etw: "Event Tracing for Windows (ETW) support?" -} - -var settings = Object.create(null) - -/** - * Fetches the setting of the given name, defaulting to an empty array. - * - * @param {string} name - The name of the setting to look for. - * - * @return {Array.} An array of values matching that name. - */ -function getSetting(name) { - return settings[name] || [] -} - -/** - * Add a setting to the module's shared settings object. - * - * @param {string} name - The name of the setting value being added. - * @param {string} value - The value to add or the setting. - */ -function addSetting(name, value) { - if (!settings[name]) { - settings[name] = [value] - } else if (settings[name].indexOf(value) === -1) { - settings[name].push(value) - } -} - -/** - * Remove settings with the given name. - * - * @param {string} name - The name of the setting to remove. - */ -function clearSetting(name) { - delete settings[name] -} - -/** - * Build up a list of top-level packages available to an application relative to - * the provided root. - * - * @param {string} root - Path to start listing packages from. - * @param {Array} [packages=[]] - Array to append found packages to. - * @param {function} callback - Callback function. - * - * @return {Array} List of packages. - */ -function listPackages(root, packages, callback) { - // listPackages(root, callback) - if (typeof packages === 'function') { - callback = packages - packages = [] - } - _log('Listing packages in %s', root) - - a.waterfall([ - a.apply(fs.readdir, root), - function iterateDirs(dirs, cb) { - a.eachLimit(dirs, 2, forEachDir, cb) - } - ], function onAllDirsRead(err) { - _log('Done listing packages in %s', root) - if (err) { - logger.trace(err, 'Could not list packages in %s (probably not an error)', root) - return callback() - } - callback(null, packages) - }) - - function forEachDir(dir, cb) { - _log('Checking package %s in %s', dir, root) - - // Skip npm's binary directory where it stores executables. - if (dir === '.bin') { - _log('Skipping .bin directory') - return setImmediate(cb) - } - - // Recurse into module scopes. - if (dir[0] === '@') { - logger.trace('Recursing into scoped module directory %s', dir) - return listPackages(path.resolve(root, dir), packages, cb) - } - - // Read the package and pull out the name and version of it. - var pkg = path.resolve(root, dir, 'package.json') - fs.readFile(pkg, function onPackageRead(err, pkgFile) { - _log('Read package at %s', pkg) - if (err) { - logger.debug(err, 'Could not read %s.', pkg) - return cb() - } - - var name = null - var version = null - try { - var pkgData = JSON.parse(pkgFile) - name = pkgData.name - version = pkgData.version - } catch (e) { - logger.debug(err, 'Could not parse package file %s.', pkg) - } - - packages.push([name || dir, version || '']) - _log('Package from %s added (%s@%s)', pkg, name, version) - cb() - }) - } -} - -/** - * Build up a list of dependencies from a given node_module root. - * - * @param {string} root - Path to start listing dependencies from. - * @param {Array} [children] - Array to append found dependencies to. - * @param {object} [visited] - Map of visited directories. - * @param {function} callback - Callback to send deps to. - * - * @return {Array} List of dependencies. - */ -function listDependencies(root, children, visited, callback) { - // listDependencies(root, callback) - if (typeof children === 'function') { - callback = children - children = [] - visited = Object.create(null) - } - // listDependencies(root, {children|visited}, callback) - if (typeof visited === 'function') { - callback = visited - if (Array.isArray(children)) { - visited = Object.create(null) - } else { - visited = children - children = [] - } - } - _log('Listing dependencies in %s', root) - - a.waterfall([ - a.apply(fs.readdir, root), - function iterateDirs(dirs, cb) { - a.eachLimit(dirs, 2, forEachEntry, cb) - } - ], function onAllDirsRead(err) { - _log('Done listing dependencies in %s', root) - if (err) { - logger.trace(err, 'Could not read directories in %s (probably not an error)', root) - return callback() - } - callback(null, children) - }) - - function forEachEntry(entry, cb) { - _log('Checking dependencies in %s (%s)', entry, root) - - var candidate = path.resolve(root, entry, 'node_modules') - fs.realpath(candidate, function realPathCb(err, realCandidate) { - _log('Resolved %s to real path %s', candidate, realCandidate) - if (err) { - // Don't care to log about files that don't exist. - if (err.code !== 'ENOENT') { - logger.debug(err, 'Failed to resolve candidate real path %s', candidate) - } - _log(err, 'Real path for %s failed', candidate) - return cb() - } - - // Make sure we haven't been to this directory before. - if (visited[realCandidate]) { - logger.trace('Not revisiting %s (from %s)', realCandidate, candidate) - return cb() - } - visited[realCandidate] = true - - // Load the packages and dependencies for this directory. - a.series([ - a.apply(listPackages, realCandidate, children), - a.apply(listDependencies, realCandidate, children, visited) - ], function onRecurseListComplete(loadErr) { - _log('Done with dependencies in %s', realCandidate) - if (loadErr) { - logger.debug(loadErr, 'Failed to list dependencies in %s', realCandidate) - } - cb() - }) - }) - } -} - -/** - * Build up a list of packages, starting from the current directory. - * - * @return {Object} Two lists, of packages and dependencies, with the - * appropriate names. - */ -function getLocalPackages(callback) { - var packages = [] - var dependencies = [] - var candidate = process.cwd() - var visited = Object.create(null) - _log('Getting local packages') - - a.whilst(function checkCandidate(cb) { - return cb(null, candidate) - }, function iterate(cb) { - _log('Checking for local packages in %s', candidate) - var root = path.resolve(candidate, 'node_modules') - a.series([ - a.apply(listPackages, root, packages), - a.apply(listDependencies, root, dependencies, visited) - ], function onListComplete(err) { - _log('Done checking for local packages in %s', candidate) - var last = candidate - candidate = path.dirname(candidate) - if (last === candidate) { - candidate = null - } - cb(err) - }) - }, function whileComplete(err) { - _log('Done getting local packages') - if (err) { - callback(err) - } else { - callback(null, {packages: packages, dependencies: dependencies}) - } - }) -} - -/** - * Generic method for getting packages and dependencies relative to a - * provided root directory. - * - * @param {string} root - Where to start looking -- doesn't add node_modules. - * - * @return {Object} Two lists, of packages and dependencies, with the - * appropriate names. - */ -function getPackages(root, cb) { - var packages = [] - var dependencies = [] - _log('Getting packages from %s', root) - - a.series([ - a.apply(listPackages, root, packages), - a.apply(listDependencies, root, dependencies) - ], function onListComplete(err) { - _log('Done getting packages from %s', root) - if (err) { - cb(err) - } else { - cb(null, {packages: packages, dependencies: dependencies}) - } - }) -} - -/** - * Generate a list of globally-installed packages, if available / accessible - * via the environment. - * - * @return {Object} Two lists, of packages and dependencies, with the - * appropriate names. - */ -function getGlobalPackages(cb) { - _log('Getting global packages') - if (process.config && process.config.variables) { - var prefix = process.config.variables.node_prefix - if (prefix) { - var root = path.resolve(prefix, 'lib', 'node_modules') - _log('Getting global packages from %s', root) - return getPackages(root, cb) - } - } - - _log('No global packages to get') - setImmediate(cb, null, {packages: [], dependencies: []}) -} - -/** - * Take a list of packages and reduce it to a list of pairs serialized - * to JSON (to simplify things on the collector end) where each - * package appears at most once, with all the versions joined into a - * comma-delimited list. - * - * @return {Array.} Sorted list of [name, version] pairs. - */ -function flattenVersions(packages) { - var info = Object.create(null) - packages.forEach(function cb_forEach(pair) { - var p = pair[0] - var v = pair[1] - - if (info[p]) { - if (info[p].indexOf(v) < 0) info[p].push(v) - } else { - info[p] = [v] - } - }) - - return Object.keys(info) - .map(function cb_map(key) { - return [key, info[key].join(', ')] - }) - .sort() - .map(function cb_map(pair) { - try { - return stringify(pair) - } catch (err) { - logger.debug(err, 'Unabled to stringify package version') - return '' - } - }) -} - -/** - * There are a bunch of settings generated at build time that are useful to - * know for troubleshooting purposes. These settings are only available in 0.7 - * and up. - * - * This function works entirely via side effects using the - * addSetting function. - */ -function remapConfigSettings() { - if (process.config && process.config.variables) { - var variables = process.config.variables - Object.keys(variables).forEach(function cb_forEach(key) { - if (remapping[key]) { - var value = variables[key] - - if (value === true || value === 1) value = 'yes' - if (value === false || value === 0) value = 'no' - - addSetting(remapping[key], value) - } - }) - } -} - -function getOtherPackages(callback) { - _log('Getting other packages') - var other = {packages: [], dependencies: []} - - if (!process.env.NODE_PATH) { - return callback(null, other) - } - - var paths - if (process.platform === 'win32') { // why. WHY. - paths = process.env.NODE_PATH.split(';') - } else { - paths = process.env.NODE_PATH.split(':') - } - _log('Looking for other packages in %j', paths) - - a.eachLimit(paths, 2, function listEachOtherPackage(nodePath, cb) { - if (nodePath[0] !== '/') nodePath = path.resolve(process.cwd(), nodePath) - _log('Getting other packages from %s', nodePath) - getPackages(nodePath, function onGetPackageFinish(err, nextSet) { - _log('Done getting other packages from %s', nodePath) - if (!err && nextSet) { - other.packages.push.apply(other.packages, nextSet.packages) - other.dependencies.push.apply(other.dependencies, nextSet.dependencies) - } - cb(err) - }) - }, function onOtherFinish(err) { - _log('Done getting other packages') - callback(err, other) - }) -} - -function getHomePackages(cb) { - var homeDir = null - if (process.platform === 'win32') { - if (process.env.USERDIR) { - homeDir = process.env.USERDIR - } - } else if (process.env.HOME) { - homeDir = process.env.HOME - } - - _log('Getting home packages from %s', homeDir) - if (!homeDir) { - return cb(null, null) - } - - a.mapSeries({ - home: path.resolve(homeDir, '.node_modules'), - homeOld: path.resolve(homeDir, '.node_libraries') - }, getPackages, function onHomeFinish(err, packages) { - _log('Done getting home packages from %s', homeDir) - cb(err, packages) - }) -} - -/** - * Scrape the list of packages, following the algorithm as described in the - * node module page: - * - * http://nodejs.org/docs/latest/api/modules.html - * - * This function works entirely via side effects using the addSetting - * function. - */ -function findPackages(cb) { - _log('Finding all packages') - a.parallelLimit({ - local: time(getLocalPackages), - global: time(getGlobalPackages), - other: time(getOtherPackages), - home: time(getHomePackages) - }, 2, function onPackageComplete(err, data) { - _log('Done finding all packages') - if (err) { - return cb(err) - } - - var packages = data.local.packages - packages.push.apply(packages, data.global.packages) - packages.push.apply(packages, data.other.packages) - - var dependencies = data.local.dependencies - dependencies.push.apply(dependencies, data.global.dependencies) - dependencies.push.apply(dependencies, data.other.dependencies) - - if (data.home) { - if (data.home.home) { - packages.unshift.apply(packages, data.home.home.packages) - dependencies.unshift.apply(dependencies, data.home.home.dependencies) - } - if (data.home.homeOld) { - packages.unshift.apply(packages, data.home.homeOld.packages) - dependencies.unshift.apply(dependencies, data.home.homeOld.dependencies) - } - } - - addSetting('Packages', flattenVersions(packages)) - addSetting('Dependencies', flattenVersions(dependencies)) - cb() - }) -} - -function time(fn) { - var name = fn.name - return function timeWrapper(cb) { - var start = Date.now() - logger.trace('Starting %s', name) - return fn(function wrappedCb() { - var end = Date.now() - logger.trace('Finished %s in %dms', name, end - start) - cb.apply(this, arguments) - }) - } -} - -/** - * Settings actually get scraped below. - */ -function gatherEnv() { - addSetting('Processors', os.cpus().length) - addSetting('OS', os.type()) - addSetting('OS version', os.release()) - addSetting('Node.js version', process.version) - addSetting('Architecture', process.arch) - - if ('NODE_ENV' in process.env) { - addSetting('NODE_ENV', process.env.NODE_ENV) - } -} - -function refreshSyncOnly() { - // gather persisted settings - var framework = getSetting('Framework') - var dispatcher = getSetting('Dispatcher') - var dispatcherVersion = getSetting('Dispatcher Version') - - // clearing and rebuilding a global variable - settings = Object.create(null) - // add persisted settings - if (framework.length) { - framework.forEach(function addFrameworks(fw) { - addSetting('Framework', fw) - }) - } - - if (dispatcher.length) { - dispatcher.forEach(function addDispatchers(d) { - addSetting('Dispatcher', d) - }) - } - - if (dispatcherVersion.length) { - dispatcher.forEach(function addDispatchers(d) { - addSetting('Dispatcher Version', d) - }) - } - - gatherEnv() - remapConfigSettings() -} - -/** - * Reset settings and gather them, built to minimally refactor this file. - */ -function refresh(cb) { - _log('Refreshing environment settings') - refreshSyncOnly() - - var packages = getSetting('Packages') - var dependencies = getSetting('Dependencies') - - if (packages.length && dependencies.length) { - settings.Packages = packages - settings.Dependencies = dependencies - _log('Using cached values') - setImmediate(cb) - } else { - _log('Fetching new package information') - findPackages(cb) - } -} - -/** - * Refreshes settings and returns the settings object. - * - * @private - * - * @param {function} cb - Callback to send results to. - */ -function getJSON(cb) { - _log('Getting environment JSON') - refresh(function onRefreshFinish(err) { - _log('Environment refresh finished') - if (err) { - cb(err) - return - } - - var items = [] - Object.keys(settings).forEach(function settingKeysForEach(key) { - settings[key].forEach(function settingsValuesForEach(setting) { - items.push([key, setting]) - }) - }) - _log('JSON got') - cb(null, items) - }) -} - -// At startup, do the synchronous environment scanning stuff. -refreshSyncOnly() - -var userSetDispatcher = false -module.exports = { - setFramework: function setFramework(framework) { - addSetting('Framework', framework) - }, - setDispatcher: function setDispatcher(dispatcher, version, userSet) { - if (userSetDispatcher) { - return - } - - userSetDispatcher = !!userSet - clearSetting('Dispatcher Version') - clearSetting('Dispatcher') - - // TODO: Decide if this should only happen once for internals as well. - if (version) { - addSetting('Dispatcher Version', version) - } - - addSetting('Dispatcher', dispatcher) - }, - clearFramework: function clearFramework() { - clearSetting('Framework') - }, - clearDispatcher: function clearDispatcher() { - // This method is only used for tests. - userSetDispatcher = false - clearSetting('Dispatcher') - clearSetting('Dispatcher Version') - }, - listPackages: listPackages, - getJSON: getJSON, - get: getSetting, - refresh: refresh -} - -/** - * For super verbose logging that we can disable completely, separate from the - * rest of logging. - */ -function _log() { - // logger.trace.apply(logger, arguments) -} diff --git a/node_modules/newrelic/lib/errors/error-collector.js b/node_modules/newrelic/lib/errors/error-collector.js deleted file mode 100644 index 3524e5d7..00000000 --- a/node_modules/newrelic/lib/errors/error-collector.js +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const errorsModule = require('./index') - -const logger = require('../logger').child({component: 'error_tracer'}) -const urltils = require('../util/urltils') -const Exception = require('../errors').Exception -const errorHelper = require('./helper') -const createError = errorsModule.createError -const createEvent = errorsModule.createEvent - -const NAMES = require('../metrics/names') - -/** - * ErrorCollector is responsible for collecting JS errors and errored-out HTTP - * transactions, and for converting them to error traces and error events expected - * by the collector. - * - * @private - * @class - */ -class ErrorCollector { - constructor(config, traceAggregator, eventAggregator, metrics) { - this.config = config - this.traceAggregator = traceAggregator - this.eventAggregator = eventAggregator - this.metrics = metrics - - this.seenObjectsByTransaction = Object.create(null) - this.seenStringsByTransaction = Object.create(null) - - this.traceAggregator.on( - 'starting error_data data send.', - this._onSendErrorTrace.bind(this) - ) - } - - _onSendErrorTrace() { - // Clear dupe checking each time error traces attempt to send. - this._clearSeenErrors() - } - - start() { - // TODO: Log? Return true/false? - - const errorCollectorEnabled = - this.config.error_collector && this.config.error_collector.enabled - - if (!errorCollectorEnabled) { - return - } - - if (errorCollectorEnabled && this.config.collect_errors) { - this.traceAggregator.start() - } - - if (this.config.error_collector.capture_events) { - this.eventAggregator.start() - } - } - - stop() { - this.traceAggregator.stop() - this.eventAggregator.stop() - } - - /** - * - * This function takes an exception and determines whether the exception - * has been seen before by this aggregator. This function mutates the - * book keeping structures to reflect the exception has been seen. - * - * @param {?Transaction} transaction - - * @param {Error} exception - The error to be checked. - */ - _haveSeen(transaction, exception) { - const txId = transaction ? transaction.id : 'Unknown' - - if (typeof exception === 'object') { - if (!this.seenObjectsByTransaction[txId]) { - this.seenObjectsByTransaction[txId] = new WeakSet() - } - - var seenObjects = this.seenObjectsByTransaction[txId] - if (seenObjects.has(exception)) { - return true - } - - // TODO: Refactor usage of `_haveSeen` so that we don't have the side effect - // of marking the exception as seen when we're just testing for if we've - // seen it! - seenObjects.add(exception) - } else { // typeof exception !== 'object' - if (!this.seenStringsByTransaction[txId]) { - this.seenStringsByTransaction[txId] = Object.create(null) - } - - var seenStrings = this.seenStringsByTransaction[txId] - if (seenStrings[exception]) { - return true - } - - seenStrings[exception] = true - } - return false - } - - /** - * Every finished transaction goes through this handler, so do as little as - * possible. - * - * @param {Transaction} transaction - * - * @return {number} The number of unexpected errors - */ - onTransactionFinished(transaction) { - if (!transaction) throw new Error('Error collector got a blank transaction.') - if (transaction.ignore) { - return - } - - // TODO: Prob shouldn't do any work if errors fully disabled. - - // collect user errors even if status code is ignored - let collectedErrors = 0 - let expectedErrors = 0 - - // errors from noticeError are currently exempt from - // ignore and exclude rules - if (transaction.userErrors.length) { - for (let i = 0; i < transaction.userErrors.length; i++) { - const exception = transaction.userErrors[i] - if (this.collect(transaction, exception)) { - ++collectedErrors - } - } - } - - const isErroredTransaction = urltils.isError(this.config, transaction.statusCode) - const isIgnoredErrorStatusCode = urltils.isIgnoredError( - this.config, - transaction.statusCode - ) - - const isExpectedErrorStatusCode = urltils.isExpectedError( - this.config, - transaction.statusCode - ) - - // collect other exceptions only if status code is not ignored - if (transaction.exceptions.length && !isIgnoredErrorStatusCode) { - for (let i = 0; i < transaction.exceptions.length; i++) { - const exception = transaction.exceptions[i] - if (this.collect(transaction, exception)) { - ++collectedErrors - // if we could collect it, then check if expected - if (isExpectedErrorStatusCode || - errorHelper.isExpectedException( - transaction, - exception.error, - this.config, - urltils - ) - ) { - ++expectedErrors - } - } - } - } else if (isErroredTransaction && this.collect(transaction)) { - ++collectedErrors - if (isExpectedErrorStatusCode) { - ++expectedErrors - } - } - - const unexpectedErrors = collectedErrors - expectedErrors - - // the metric should be incremented only if the error was not expected - if (unexpectedErrors > 0) { - this.metrics - .getOrCreateMetric(NAMES.ERRORS.PREFIX + transaction.getFullName()) - .incrementCallCount(unexpectedErrors) - } - } - - /** - * This function collects the error right away when transaction is not supplied. Otherwise it - * delays collecting the error until the transaction ends. - * - * NOTE: this interface is unofficial and may change in future. - * - * @param {?Transaction} transaction Transaction associated with the error. - * @param {Error} error The error to be traced. - * @param {?object} customAttributes Custom attributes associated with the request (optional). - */ - add(transaction, error, customAttributes) { - if (!error) { - return - } - - const shouldCollectErrors = this._shouldCollectErrors() - if (!shouldCollectErrors) { - logger.trace('error_collector.enabled is false, dropping application error.') - return - } - - if (errorHelper.shouldIgnoreError(transaction, error, this.config)) { - logger.trace('Ignoring error') - return - } - - const timestamp = Date.now() - const exception = new Exception({error, timestamp, customAttributes}) - - if (transaction) { - transaction.addException(exception) - } else { - this.collect(transaction, exception) - } - } - - /** - * This function is used to collect errors specifically added using the - * `API#noticeError()` method. - * - * Similarly to add(), it collects the error right away when transaction is - * not supplied. Otherwise it delays collecting the error until the transaction - * ends. The reason for separating the API errors from other exceptions is that - * different ignore rules apply to them. - * - * NOTE: this interface is unofficial and may change in future. - * - * @param {?Transaction} transaction Transaction associated with the error. - * @param {Exception} exception The Exception to be traced. - */ - addUserError(transaction, error, customAttributes) { - if (!error) { - return - } - - const shouldCollectErrors = this._shouldCollectErrors() - if (!shouldCollectErrors) { - logger.trace('error_collector.enabled is false, dropping user reported error.') - return - } - - const timestamp = Date.now() - const exception = new Exception({error, timestamp, customAttributes}) - - if (transaction) { - transaction.addUserError(exception) - } else { - this.collect(transaction, exception) - } - } - - /** - * Collects the error and also creates the error event. - * - * This function uses an array of seen exceptions to ensure errors don't get double-counted. It - * can also be used as an unofficial means of marking that user errors shouldn't be traced. - * - * For an error to be traced, at least one of the transaction or the error must be present. - * - * NOTE: this interface is unofficial and may change in future. - * - * @param {?Transaction} transaction Transaction associated with the error. - * @param {?Exception} exception The Exception object to be traced. - * @return {bool} True if the error was collected. - */ - collect(transaction, exception) { - if (!exception) { - exception = new Exception({}) - } - - if (exception.error) { - if (this._haveSeen(transaction, exception.error)) { - return false - } - - const error = exception.error - if (typeof error !== 'string' && !error.message && !error.stack) { - logger.trace(error, 'Got error that is not an instance of Error or string.') - exception.error = null - } - } - - if (!exception.error && (!transaction || !transaction.statusCode || transaction.error)) { - return false - } - - if (exception.error) { - logger.trace(exception.error, 'Got exception to trace:') - } - - const errorTrace = createError(transaction, exception, this.config) - - const isExpectedError = true === errorTrace[4].intrinsics['error.expected'] - - if (isExpectedError) { - this.metrics.getOrCreateMetric(NAMES.ERRORS.EXPECTED).incrementCallCount() - } else { - this.metrics.getOrCreateMetric(NAMES.ERRORS.ALL).incrementCallCount() - - if (transaction) { - if (transaction.isWeb()) { - this.metrics.getOrCreateMetric(NAMES.ERRORS.WEB).incrementCallCount() - } else { - this.metrics.getOrCreateMetric(NAMES.ERRORS.OTHER).incrementCallCount() - } - } - } - - // defaults true in config/index. can be modified server-side - if (this.config.collect_errors) { - this.traceAggregator.add(errorTrace) - } - - if (this.config.error_collector.capture_events === true) { - const priority = transaction && transaction.priority || Math.random() - const event = createEvent(transaction, errorTrace, exception.timestamp, this.config) - this.eventAggregator.add(event, priority) - } - - return true - } - - // TODO: ideally, this becomes unnecessary - clearAll() { - this.traceAggregator.clear() - this.eventAggregator.clear() - - this._clearSeenErrors() - } - - _clearSeenErrors() { - this.seenStringsByTransaction = Object.create(null) - this.seenObjectsByTransaction = Object.create(null) - } - - _shouldCollectErrors() { - const errorCollectorEnabled = - this.config.error_collector && this.config.error_collector.enabled - - const shouldCaptureTraceOrEvent = - this.config.collect_errors || // are traces enabled - (this.config.error_collector && this.config.error_collector.capture_events) - - return errorCollectorEnabled && shouldCaptureTraceOrEvent - } - - reconfigure(config) { - this.config = config - - this.traceAggregator.reconfigure(config) - this.eventAggregator.reconfigure(config) - - const errorCollectorEnabled = - this.config.error_collector && this.config.error_collector.enabled - - if (!errorCollectorEnabled) { - this.stop() - return - } - - if (this.config.collect_errors === false) { - this.traceAggregator.stop() - } - - if (this.config.error_collector.capture_events === false) { - this.eventAggregator.stop() - } - } -} - -module.exports = ErrorCollector diff --git a/node_modules/newrelic/lib/errors/error-event-aggregator.js b/node_modules/newrelic/lib/errors/error-event-aggregator.js deleted file mode 100644 index 6337c590..00000000 --- a/node_modules/newrelic/lib/errors/error-event-aggregator.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'error_tracer'}) -const EventAggregator = require('../aggregators/event-aggregator') - -const NAMES = require('../metrics/names') - -class ErrorEventAggregator extends EventAggregator { - constructor(opts, collector, metrics) { - opts = opts || {} - opts.method = opts.method || 'error_event_data' - opts.metricNames = NAMES.TRANSACTION_ERROR - - super(opts, collector, metrics) - } - - _toPayloadSync() { - const events = this.events - - if (events.length === 0) { - logger.debug('No error events to send.') - return - } - - const metrics = { - reservoir_size: events.limit, - events_seen: events.seen - } - - const eventData = events.toArray() - - return [this.runId, metrics, eventData] - } -} - -module.exports = ErrorEventAggregator diff --git a/node_modules/newrelic/lib/errors/error-trace-aggregator.js b/node_modules/newrelic/lib/errors/error-trace-aggregator.js deleted file mode 100644 index 4bf360a6..00000000 --- a/node_modules/newrelic/lib/errors/error-trace-aggregator.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'error_tracer'}) -const TraceAggregator = require('../aggregators/trace-aggregator') - -// TODO: do traces ever have differing algorithms or -// always first-come? If same, can standardize in TraceAggregator -// Otherwise, TraceAggregator may not be a thing -class ErrorTraceAggregator extends TraceAggregator { - constructor(opts, collector) { - opts = opts || {} - opts.method = opts.method || 'error_data' - - super(opts, collector) - - this.errors = [] - } - - add(error) { - if (this.errors.length < this.limit) { - logger.debug(error, 'Error to be sent to collector.') - this.errors.push(error) - } else { - logger.debug( - 'Already have %d errors to send to collector, not keeping.', this.limit) - } - } - - _toPayloadSync() { - if (this.errors.length > 0) { - return [this.runId, this.errors] - } - - logger.debug('No error traces to send.') - } - - _getMergeData() { - return this.errors - } - - _merge(errors) { - if (!errors) { - return - } - - const len = Math.min(errors.length, this.limit - this.errors.length) - logger.warn('Merging %s (of %s) errors for next delivery.', len, errors.length) - - for (var i = 0; i < len; i++) { - this.errors.push(errors[i]) - } - } - - clear() { - this.errors = [] - } -} - -module.exports = ErrorTraceAggregator diff --git a/node_modules/newrelic/lib/errors/helper.js b/node_modules/newrelic/lib/errors/helper.js deleted file mode 100644 index 992f0ea1..00000000 --- a/node_modules/newrelic/lib/errors/helper.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = { - isExpected: function isExpected(type, message, transaction, config, urltils) { - let isExpectedTransactionCode = false - if (transaction && urltils.isExpectedError(config, transaction.statusCode)) { - isExpectedTransactionCode = true - } - return this.isExpectedErrorMessage(config, type, message) || - this.isExpectedErrorClass(config, type) || - isExpectedTransactionCode - }, - isExpectedErrorMessage: function isExpectedErrorMessage(config, type, message) { - if (!config.error_collector.expected_messages[type]) { - return false - } - if (config.error_collector.expected_messages[type].length > 0) { - if (-1 !== config.error_collector.expected_messages[type].indexOf(message)) { - return true - } - } - return false - }, - isExpectedErrorClass: function isExpectedErrorClass(config, className) { - if (config.error_collector.expected_classes.length > 0) { - if (-1 !== config.error_collector.expected_classes.indexOf(className)) { - return true - } - } - return false - }, - isExpectedException: function isExpectedException( - transaction, - exception, - config, - urltils - ) { - let {type, message} = this.extractErrorInformation( - transaction, - exception, - config, - urltils - ) - - return this.isExpectedErrorClass(config, type) || - this.isExpectedErrorMessage(config, type, message) - }, - - extractErrorInformation: function extractErrorInformation( - transaction, - error, - config, - urltils - ) { - let name = 'Unknown' - let message = '' - let type = 'Error' - - // String errors do not provide us with as much information to provide to the - // user, but it is a common pattern. - if (typeof error === 'string') { - message = error - } else if ( - error !== null && - typeof error === 'object' && - error.message && - !config.high_security && - !config.strip_exception_messages.enabled - ) { - message = error.message - - if (error.name) { - type = error.name - } else if (error.constructor && error.constructor.name) { - type = error.constructor.name - } - } else if (transaction && transaction.statusCode && - urltils.isError(config, transaction.statusCode)) { - message = 'HttpError ' + transaction.statusCode - } - - if (transaction) { - // transaction.getName is expensive due to running normalizers and ignore - // rules if a name hasn't been assigned yet. - const txName = transaction.getFullName() - if (txName) { - name = txName - } - } - - return { - name:name, - message:message, - type:type, - } - }, - - shouldIgnoreError: function shouldIgnoreError(transaction, error, config) { - // extract _just_ the error information, not transaction stuff - let errorInfo = this.extractErrorInformation(null, error, config, null) - - return this.shouldIgnoreErrorClass(errorInfo, config) || - this.shouldIgnoreErrorMessage(errorInfo, config) || - this.shouldIgnoreStatusCode(transaction, config) - }, - - shouldIgnoreStatusCode: function shouldIgnoreStatusCode(transaction, config) { - if (!transaction) { - return false - } - return config.error_collector.ignore_status_codes.indexOf( - transaction.statusCode - ) !== -1 - }, - - shouldIgnoreErrorClass: function shouldIgnoreErrorClass(errorInfo, config) { - if (config.error_collector.ignore_classes.length < 1) { - return false - } - - return -1 !== config.error_collector.ignore_classes.indexOf(errorInfo.type) - }, - - shouldIgnoreErrorMessage: function shouldIgnoreErrorMessage(errorInfo, config) { - let configIgnoreMessages = config.error_collector.ignore_messages[errorInfo.type] - if (!configIgnoreMessages) { - return false - } - - if (configIgnoreMessages.length > 0) { - if (-1 !== configIgnoreMessages.indexOf(errorInfo.message)) { - return true - } - } - return false - } -} diff --git a/node_modules/newrelic/lib/errors/index.js b/node_modules/newrelic/lib/errors/index.js deleted file mode 100644 index e984e68c..00000000 --- a/node_modules/newrelic/lib/errors/index.js +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var DESTINATIONS = require('../config/attribute-filter').DESTINATIONS -var NAMES = require('../metrics/names') -var props = require('../util/properties') -var urltils = require('../util/urltils') -const errorHelper = require('../errors/helper') - -class Exception { - constructor({error, timestamp, customAttributes, agentAttributes}) { - this.error = error - this.timestamp = timestamp || 0 - this.customAttributes = customAttributes || {} - this.agentAttributes = agentAttributes || {} - } - - getErrorDetails(config) { - const errorDetails = errorHelper.extractErrorInformation(null, this.error, config) - errorDetails.expected = this.isExpected(config, errorDetails) - - return errorDetails - } - - isExpected(config, {type, message}) { - if (!this._expected) { - this._expected = - errorHelper.isExpectedErrorClass(config, type) || - errorHelper.isExpectedErrorMessage(config, type, message) - } - - return this._expected - } -} - -/** - * Given either or both of a transaction and an exception, generate an error - * trace in the JSON format expected by the collector. Since this will be - * used by both the HTTP instrumentation, which uses HTTP status codes to - * determine whether a transaction is in error, and the domain-based error - * handler, which traps actual instances of Error, try to set sensible - * defaults for everything. - * - * @param {Transaction} transaction The agent transaction, coming from the instrumentatation - * @param {Exception} exception An custom Exception object with the error and other information - * @param {object} config The configuration to use when creating the object - */ -function createError(transaction, exception, config) { - const error = exception.error - let {name, message, type} = errorHelper.extractErrorInformation( - transaction, - error, - config, - urltils - ) - - let params = { - userAttributes: Object.create(null), - agentAttributes: Object.create(null), - intrinsics: Object.create(null) - } - - if (transaction) { - // Copy all of the parameters off of the transaction. - params.intrinsics = transaction.getIntrinsicAttributes() - let transactionAgentAttributes = transaction.trace.attributes.get(DESTINATIONS.ERROR_EVENT) - transactionAgentAttributes = transactionAgentAttributes || {} - - // Merge the agent attributes specific to this error event with the transaction attributes - const agentAttributes = Object.assign(exception.agentAttributes, transactionAgentAttributes) - params.agentAttributes = agentAttributes - - // There should be no attributes to copy in HSM, but check status anyway - if (!config.high_security) { - const custom = transaction.trace.custom.get(DESTINATIONS.ERROR_EVENT) - urltils.overwriteParameters(custom, params.userAttributes) - } - } - - const customAttributes = exception.customAttributes - if (!config.high_security && config.api.custom_attributes_enabled && customAttributes) { - for (let key in customAttributes) { - if (props.hasOwn(customAttributes, key)) { - const dest = config.attributeFilter.filterTransaction( - DESTINATIONS.ERROR_EVENT, - key - ) - if (dest & DESTINATIONS.ERROR_EVENT) { - params.userAttributes[key] = customAttributes[key] - } - } - } - } - - const stack = exception.error && exception.error.stack - if (stack) { - params.stack_trace = ('' + stack).split(/[\n\r]/g) - if (config.high_security || config.strip_exception_messages.enabled) { - params.stack_trace[0] = exception.error.name + ': ' - } - } - - params.intrinsics['error.expected'] = false - if (errorHelper.isExpected(type, message, transaction, config, urltils)) { - params.intrinsics['error.expected'] = true - } - - let res = [0, name, message, type, params] - if (transaction) { - res.transaction = transaction.id - } - return res -} - -/** - * Creates a structure for error event that is sent to the collector. - * The error parameter is an output of the createError() function for a given exception. - */ -function createEvent(transaction, error, timestamp, config) { - var message = error[2] - var errorClass = error[3] - var errorParams = error[4] - - var intrinsicAttributes = _getErrorEventIntrinsicAttrs( - transaction, - errorClass, - message, - errorParams.intrinsics['error.expected'], - timestamp, - config - ) - - // the error structure created by createError() already performs filtering of custom - // and agent attributes, so it is ok to just copy them - var userAttributes = Object.assign(Object.create(null), errorParams.userAttributes) - var agentAttributes = Object.assign(Object.create(null), errorParams.agentAttributes) - - var errorEvent = [ - intrinsicAttributes, - userAttributes, - agentAttributes - ] - - return errorEvent -} - -// eslint-disable-next-line max-params -function _getErrorEventIntrinsicAttrs( - transaction, - errorClass, - message, - expected, - timestamp, - conf -) { - // the server expects seconds instead of milliseconds - if (timestamp) timestamp = timestamp / 1000 - - var attributes = { - type: "TransactionError", - "error.class": errorClass, - "error.message": conf.high_security ? '' : message, - timestamp: timestamp, - 'error.expected': expected - } - - if (transaction) { - attributes.transactionName = transaction.getFullName() - attributes.duration = transaction.timer.getDurationInMillis() / 1000 - - var metric = transaction.metrics.getMetric(NAMES.QUEUETIME) - if (metric) { - attributes.queueDuration = metric.total - } - - metric = transaction.metrics.getMetric(NAMES.EXTERNAL.ALL) - if (metric) { - attributes.externalDuration = metric.total - attributes.externalCallCount = metric.callCount - } - - metric = transaction.metrics.getMetric(NAMES.DB.ALL) - if (metric) { - attributes.databaseDuration = metric.total - attributes.databaseCallCount = metric.callCount - } - - if (transaction.syntheticsData) { - attributes["nr.syntheticsResourceId"] = transaction.syntheticsData.resourceId - attributes["nr.syntheticsJobId"] = transaction.syntheticsData.jobId - attributes["nr.syntheticsMonitorId"] = transaction.syntheticsData.monitorId - } - - if (transaction.agent.config.distributed_tracing.enabled) { - transaction.addDistributedTraceIntrinsics(attributes) - } else { - attributes['nr.referringTransactionGuid'] = transaction.referringTransactionGuid - } - - attributes['nr.transactionGuid'] = transaction.id - - if (transaction.port) { - attributes.port = transaction.port - } - } else { - attributes.transactionName = 'Unknown' - } - - return attributes -} - -module.exports.createError = createError -module.exports.createEvent = createEvent -module.exports.Exception = Exception diff --git a/node_modules/newrelic/lib/feature_flags.js b/node_modules/newrelic/lib/feature_flags.js deleted file mode 100644 index e0ce920a..00000000 --- a/node_modules/newrelic/lib/feature_flags.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// unreleased flags gating an active feature -exports.prerelease = { - express5: false, - await_support: true, - serverless_mode: true, - promise_segments: false, - reverse_naming_rules: false, - fastify_instrumentation: false -} - -// flags that are no longer used for released features -exports.released = [ - 'released', - 'cat', - 'custom_instrumentation', - 'custom_metrics', - 'express_segments', - 'native_metrics', - 'protocol_17', - 'send_request_uri_attribute', - 'synthetics', - 'dt_format_w3c' -] - -// flags that are no longer used for unreleased features -exports.unreleased = [ - 'unreleased' -] diff --git a/node_modules/newrelic/lib/grpc/connection.js b/node_modules/newrelic/lib/grpc/connection.js deleted file mode 100644 index 5c808f08..00000000 --- a/node_modules/newrelic/lib/grpc/connection.js +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const protoLoader = require('@grpc/proto-loader') -const grpc = require('../proxy/grpc') -const logger = require('../logger').child({component: 'grpc_connection'}) -const EventEmitter = require('events') -const NAMES = require('../metrics/names') -const util = require('util') - -const connectionStates = require('./connection/states') - -const protoOptions = {keepCase: true, - longs: String, - enums: String, - defaults: true, - oneofs: true -} - -const pathProtoDefinition = __dirname + - '../../../lib/grpc/endpoints/infinite-tracing/v1.proto' - -const DEFAULT_RECONNECT_DELAY_MS = 15 * 1000 - -/** - * Class for managing the GRPC connection - * - * Both @grpc/grpc-js and grpc will manage the http2 connections - * for us -- this class manages the _stream_ connection logic. - * - * Will emit events based on the connectionStates (see above - */ -class GrpcConnection extends EventEmitter { - /** - * GrpcConnection constructor - * - * Standard property setting/initilization, and sets an initial - * connection state of disconnected - * - * @param {Object} traceObserverConfig config item config.infinite_tracing.trace_observer - * @param {MetricAggregator} metrics metric aggregator, for supportability metrics - * @param {Number} [reconnectDelayMs=15000] number of milliseconds to wait before reconnecting - * for error states that require a reconnect delay. - */ - constructor(traceObserverConfig, metrics, reconnectDelayMs) { - super() - - this._reconnectDelayMs = reconnectDelayMs || DEFAULT_RECONNECT_DELAY_MS - - this._metrics = metrics - this._setState(connectionStates.disconnected) - - this._endpoint = this.getTraceObserverEndpoint(traceObserverConfig) - this._licensekey = null - this._runId = null - this._requestHeadersMap = null - - this.stream = null - } - - /** - * Sets connection details - * - * Allows setting of connection details _after_ object constructions - * but before the actual connection. - * - * @param {string} endpoint the GRPC server's endpoint - * @param {string} license_key the agent license key - * @param {string} run_id the current agent run id (also called agent run token) - * @param {object} requestHeadersMap request headers map received from server connect. - * @param {string} [rootCerts] string of root (ca) certificates to attach to the connection. - */ - setConnectionDetails(license_key, run_id, requestHeadersMap, rootCerts) { - this._licenseKey = license_key - this._runId = run_id - this._requestHeadersMap = requestHeadersMap - this._rootCerts = rootCerts - - return this - } - - getTraceObserverEndpoint(traceObserverConfig) { - return `${traceObserverConfig.host}:${traceObserverConfig.port}` - } - - /** - * Sets the connection state - * - * Used to indicate a transition from one connection state to - * the next. Also responsible for emitting the connect state event - * - * @param {int} state The connection state (See connectionStates above) - * @param {ClientDuplexStreamImpl} state The GRPC stream, when defined - */ - _setState(state, stream = null) { - this._state = state - this.emit(connectionStates[state], stream) - } - - /** - * Start the Connection - * - * Public Entry point -- initiates a connection - */ - connectSpans() { - if (this._state !== connectionStates.disconnected) { - return - } - - this._setState(connectionStates.connecting) - logger.trace('Connecting to gRPC endpoint.') - - try { - this.stream = this._connectSpans() - - // May not actually be "connected" at this point but we can write to the stream - // immediately. - this._setState(connectionStates.connected, this.stream) - } catch (err) { - logger.warn( - err, - 'Unexpected error establishing gRPC stream, will not attempt reconnect.' - ) - this._disconnect() - } - } - - /** - * End the current stream and set state to disconnected. - * - * No more data can be sent until connected again. - */ - disconnect() { - if (this._state === connectionStates.disconnected) { - return - } - - this._disconnect() - } - - /** - * Method returns GRPC metadata for initial connection - * - * @param {string} license_key - * @param {string} run_id - */ - _getMetadata(license_key, run_id, requestHeadersMap, env) { - const metadata = new grpc.Metadata() - metadata.add('license_key', license_key) - metadata.add('agent_run_token', run_id) - - // p17 spec: If request_headers_map is empty or absent, - // the agent SHOULD NOT apply anything to its requests. - if (requestHeadersMap) { - for (const [key, value] of Object.entries(requestHeadersMap)) { - metadata.add(key.toLowerCase(), value) // keys MUST be lowercase for Infinite Tracing - } - } - - // check environment variables for testing parameters and - // pass to server via meta-data. - const flaky = parseInt(env.NEWRELIC_GRPCCONNECTION_METADATA_FLAKY, 10) - const delay = parseInt(env.NEWRELIC_GRPCCONNECTION_METADATA_DELAY, 10) - if (flaky) { - logger.trace('Adding flaky metadata: %s', flaky) - metadata.add('flaky', flaky) - } - if (delay) { - logger.trace('Adding delay metadata: %s', delay) - metadata.add('delay',delay) - } - - return metadata - } - - /** - * Disconnects from gRPC endpoint and schedules establishing a new connection. - * @param {number} reconnectDelayMs number of milliseconds to wait before reconnecting. - */ - _reconnect(reconnectDelayMs = 0) { - this._disconnect() - - logger.trace('Reconnecting to gRPC endpoint in [%s] seconds', reconnectDelayMs) - - setTimeout( - this.connectSpans.bind(this), - reconnectDelayMs - ) - } - - _disconnect() { - logger.trace('Disconnecting from gRPC endpoint.') - - if (this.stream) { - this.stream.removeAllListeners() - - const oldStream = this.stream - this.stream.on('status', function endStreamStatusHandler(grpcStatus) { - logger.trace('End stream status received [%s]: %s', grpcStatus.code, grpcStatus.details) - - // Cleanup the final end stream listeners. - oldStream.removeAllListeners() - }) - - // Listen to any final errors to prevent throwing. - // This is unlikely but if the server closes post - // removing listeners and prior to response it could - // happen. We noticed this via tests on Node 14. - this.stream.on('error', function endStreamErrorHandler(err) { - logger.trace('End stream error received. Code: [%s]: %s', err.code, err.details) - }) - - // Indicates to server we are done. - // Server officially closes the stream. - this.stream.end() - - this.stream = null - } - - this._setState(connectionStates.disconnected) - } - - /** - * Central location to setup stream observers - * - * Events from the GRPC stream (a ClientDuplexStreamImpl) are the main way - * we communicate with the GRPC server. - * - * @param {ClientDuplexStreamImpl} stream - */ - _setupSpanStreamObservers(stream) { - // listen for responses from server and log - if (logger.traceEnabled()) { - stream.on('data', function data(response) { - logger.trace("gRPC span response stream: %s", JSON.stringify(response)) - }) - } - - // listen for status that indicate stream has ended, - // and we need to disconnect - stream.on('status', (grpcStatus) => { - logger.trace('gRPC Status Received [%s]: %s', grpcStatus.code, grpcStatus.details) - const grpcStatusName = - grpc.status[grpcStatus.code] ? grpc.status[grpcStatus.code] : 'UNKNOWN' - - if (grpc.status[grpc.status.UNIMPLEMENTED] === grpcStatusName) { - this._metrics.getOrCreateMetric( - NAMES.INFINITE_TRACING.SPAN_RESPONSE_GRPC_UNIMPLEMENTED - ).incrementCallCount() - - // per the spec, An UNIMPLEMENTED status code from gRPC indicates - // that the versioned Trace Observer is no longer available. Agents - // MUST NOT attempt to reconnect in this case - logger.info( - '[UNIMPLEMENTED]: Trace Obserserver is no longer available. Shutting down connection.' - ) - this._disconnect() - } else if (grpc.status[grpc.status.OK] === grpcStatusName) { - this._reconnect() - } else { - this._metrics.getOrCreateMetric( - util.format(NAMES.INFINITE_TRACING.SPAN_RESPONSE_GRPC_STATUS, grpcStatusName) - ).incrementCallCount() - - this._reconnect(this._reconnectDelayMs) - } - }) - - // if we don't listen for the errors they'll bubble - // up and crash the application - stream.on('error', (err) => { - this._metrics.getOrCreateMetric(NAMES.INFINITE_TRACING.SPAN_RESPONSE_ERROR) - .incrementCallCount() - - // For errors, the status will either result in a disconnect or a reconnect - // delay that should prevent too frequent spamming. Unless the app is idle - // and regularly getting Status 13 reconnects from the server, in which case - // this will be almost the only logging. - logger.warn('Span stream error. Code: [%s]: %s', err.code, err.details) - }) - } - - /** - * Creates the GRPC credentials needed - */ - _generateCredentials(grpcApi) { - let certBuffer = null - - // Current settable value for testing. If allowed to be overriden via - // configuration, this should be removed in place of setting - // this._rootCerts from config via normal configuration precedence. - const envTestCerts = process.env.NEWRELIC_GRPCCONNECTION_CA - const rootCerts = this._rootCerts || envTestCerts - if (rootCerts) { - logger.debug('Infinite tracing root certificates found to attach to requests.') - try { - certBuffer = Buffer.from(rootCerts, 'utf-8') - } catch (err) { - logger.warn('Failed to create buffer from rootCerts, proceeding without.', err) - } - } - - // null/undefined ca treated same as calling createSsl() - return grpcApi.credentials.createSsl(certBuffer) - } - - /** - * Internal/private method for connection - * - * Contains the actual logic that connects to the GRPC service. - * "Connection" can be a somewhat misleading term here. This method - * invokes the "recordSpan" remote proceduce call. Behind the scenes - * this makes an http2 request with the metadata, and then returns - * a stream for further writing. - */ - _connectSpans() { - const packageDefinition = protoLoader.loadSync(pathProtoDefinition, protoOptions) - - const serviceDefinition = grpc.loadPackageDefinition( - packageDefinition - ).com.newrelic.trace.v1 - - const credentials = this._generateCredentials(grpc) - const client = new serviceDefinition.IngestService( - this._endpoint, - credentials - ) - - const metadata = - this._getMetadata(this._licenseKey, this._runId, this._requestHeadersMap, process.env) - - const stream = client.recordSpan(metadata) - this._setupSpanStreamObservers(stream) - - return stream - } -} - -module.exports = GrpcConnection diff --git a/node_modules/newrelic/lib/grpc/connection/states.js b/node_modules/newrelic/lib/grpc/connection/states.js deleted file mode 100644 index 600f5acb..00000000 --- a/node_modules/newrelic/lib/grpc/connection/states.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' -module.exports = { - disconnected:0, - connecting:1, - connected:2, - 0:'disconnected', - 1:'connecting', - 2:'connected' -} diff --git a/node_modules/newrelic/lib/grpc/endpoints/infinite-tracing/v1.proto b/node_modules/newrelic/lib/grpc/endpoints/infinite-tracing/v1.proto deleted file mode 100644 index f0027cc6..00000000 --- a/node_modules/newrelic/lib/grpc/endpoints/infinite-tracing/v1.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; - -package com.newrelic.trace.v1; - -service IngestService { - // Accepts a stream of Span messages, and returns an irregular stream of - // RecordStatus messages. - rpc RecordSpan(stream Span) returns (stream RecordStatus) {} -} - -message Span { - string trace_id = 1; - map intrinsics = 2; - map user_attributes = 3; - map agent_attributes = 4; -} - -message AttributeValue { - oneof value { - string string_value = 1; - bool bool_value = 2; - int64 int_value = 3; - double double_value = 4; - } -} - -message RecordStatus { - uint64 messages_seen = 1; -} diff --git a/node_modules/newrelic/lib/header-attributes.js b/node_modules/newrelic/lib/header-attributes.js deleted file mode 100644 index 2c094294..00000000 --- a/node_modules/newrelic/lib/header-attributes.js +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const DESTS = require('./config/attribute-filter').DESTINATIONS - -const COLLECTED_REQUEST_HEADERS = [ - 'accept', - 'content-length', - 'content-type', - 'referer', - 'user-agent', - 'host' -] - -const HEADER_ATTR_NAMES = { - 'accept': 'accept', - 'accept-charset': 'acceptCharset', - 'accept-encoding': 'acceptEncoding', - 'access-control-allow-headers': 'accessControlAllowHeaders', - 'access-control-allow-methods': 'accessControlAllowMethods', - 'access-control-allow-origin': 'accessControlAllowOrigin', - 'age': 'age', - 'allow': 'allow', - 'authorization': 'authorization', - 'cache-control': 'cacheControl', - 'connection': 'connection', - 'cookie': 'cookie', - 'content-encoding': 'contentEncoding', - 'content-length': 'contentLength', - 'content-type': 'contentType', - 'date': 'date', - 'etag': 'eTag', - 'expect': 'expect', - 'expires': 'expires', - 'forwarded': 'forwarded', - 'host': 'host', - 'if-match': 'ifMatch', - 'if-modified-since': 'ifModifiedSince', - 'last-modified': 'lastModified', - 'location': 'location', - 'newrelic': 'newrelic', - 'origin': 'origin', - 'proxy-authorization': 'proxyAuthorization', - 'referer': 'referer', - 'refresh': 'refresh', - 'server': 'server', - 'set-cookie': 'setCookie', - 'transfer-encoding': 'transferEncoding', - 'user-agent': 'userAgent', - 'upgrade': 'upgrade', - 'vary': 'vary', - 'x-correlation-id': 'xCorrelationId', - 'x-csrf-token': 'xCsrfToken', - 'x-forwarded-for': 'xForwardedFor', - 'x-http-method-override': 'xHttpMethodOverride', - 'x-newrelic-app-data': 'xNewrelicAppData', - 'x-newrelic-id': 'xNewrelicId', - 'x-newrelic-synthetics': 'xNewrelicSynthetics', - 'x-newrelic-transaction': 'xNewrelicTransaction', - 'x-powered-by': 'xPoweredBy', - 'x-queue-start': 'xQueueStart', - 'x-request-id': 'xRequestId', - 'x-request-start': 'xRequestStart', - 'x-requested-with': 'xRequestedWith' -} - -const REQUEST_HEADER_PREFIX = 'request.headers.' -const RESPONSE_HEADER_PREFIX = 'response.headers.' -const REQUEST_HEADER_NAMES = Object.create(null) -const RESPONSE_HEADER_NAMES = Object.create(null) - -_setHeaderAttrNames(REQUEST_HEADER_NAMES, REQUEST_HEADER_PREFIX) -_setHeaderAttrNames(RESPONSE_HEADER_NAMES, RESPONSE_HEADER_PREFIX) - -function _setHeaderAttrNames(dest, prefix) { - Object.keys(HEADER_ATTR_NAMES).forEach(function forEachHeader(h) { - dest[h] = prefix + HEADER_ATTR_NAMES[h] - }) -} - -function _headerToCamelCase(header) { - if (header.length === 0) { - return '' - } - - if (header.length === 1) { - return header.toLowerCase() - } - - const newHeader = header.charAt(0).toLowerCase() + header.slice(1) - - // Converts headers in the form 'header-name' to be in the form 'headerName' - return newHeader.replace(/[\W_]+(\w)/g, function capitalize(m, $1) { - return $1.toUpperCase() - }) -} - -function _collectHeaders(headers, nameMap, prefix, transaction) { - if (!headers) { - return - } - - if (!transaction.agent.config.allow_all_headers) { - headers = Object.keys(headers).reduce((collection, key) => { - collection[key.toLowerCase()] = headers[key] - return collection - }, {}) - } - - var headerKeys = !transaction.agent.config.allow_all_headers - ? COLLECTED_REQUEST_HEADERS - : Object.keys(headers) - - const segment = transaction.agent.tracer.getSegment() - - for (var i = 0; i < headerKeys.length; i++) { - var headerKey = headerKeys[i] - var header = headers[headerKey] - if (header !== undefined) { - // If any more processing of the headers is required consider refactoring this. - if (headerKey === 'referer' && typeof header === 'string') { - var queryParamIndex = header.indexOf('?') - if (queryParamIndex !== -1) { - header = header.substring(0, queryParamIndex) - } - } - - var attributeName = nameMap[headerKey] || prefix + _headerToCamelCase(headerKey) - transaction.trace.attributes.addAttribute( - DESTS.TRANS_COMMON, - attributeName, - header - ) - - segment.addSpanAttribute(attributeName, header) - } - } -} - -/** - * Adds request headers as request.headers.* attributes to the given transaction. - * @param {Object.} headers - Request headers to add attributes for. - * @param {Transaction} transaction - Transaction to add header attributes to. - */ -function collectRequestHeaders(headers, transaction) { - _collectHeaders(headers, REQUEST_HEADER_NAMES, REQUEST_HEADER_PREFIX, transaction) -} - -/** - * Adds response headers as response.headers.* attributes to the given transaction. - * @param {Object.} headers - Response headers to add attributes for. - * @param {Transaction} transaction - Transaction to add header attributes to. - */ -function collectResponseHeaders(headers, transaction) { - _collectHeaders(headers, RESPONSE_HEADER_NAMES, RESPONSE_HEADER_PREFIX, transaction) -} - -module.exports = { - collectRequestHeaders, - collectResponseHeaders -} diff --git a/node_modules/newrelic/lib/header-processing.js b/node_modules/newrelic/lib/header-processing.js deleted file mode 100644 index 8fa011ce..00000000 --- a/node_modules/newrelic/lib/header-processing.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const REQUEST_START_HEADER = 'x-request-start' -const QUEUE_HEADER = 'x-queue-start' -const CONTENT_LENGTH_REGEX = /^Content-Length$/i - -/** - * Extracts queue time from the incoming request headers. - * - * Queue time is provided by certain providers by stamping the request - * header with the time the request arrived at the router. - * @param {*} logger - * @param {*} requestHeaders - */ -function getQueueTime(logger, requestHeaders) { - const headerValue = requestHeaders[REQUEST_START_HEADER] || requestHeaders[QUEUE_HEADER] - if (!headerValue) { - return null - } - - const split = headerValue.split('=') - const rawQueueTime = split.length > 1 ? split[1] : headerValue - - const parsedQueueTime = parseFloat(rawQueueTime) - if (isNaN(parsedQueueTime)) { - logger.warn('Queue time header parsed as NaN. See trace level log for value.') - - // This header can hold up to 4096 bytes which could quickly fill up logs. - // Do not log a level higher than debug. - logger.trace('Queue time: %s', rawQueueTime) - - return null - } - - const convertedQueueTime = convertUnit(parsedQueueTime) - return convertedQueueTime -} - -function convertUnit(time) { - let convertedTime = time - if (convertedTime > 1e18) { - // nano seconds - convertedTime = convertedTime / 1e6 - } else if (convertedTime > 1e15) { - // micro seconds - convertedTime = convertedTime / 1e3 - } else if (convertedTime < 1e12) { - // seconds - convertedTime = convertedTime * 1e3 - } - - return convertedTime -} - -/** - * Returns the value of the Content-Length header - * - * If no header is found, returns -1 - * - * @param {*} headers - */ -function getContentLengthFromHeaders(headers) { - let contentLength = -1 - for (const [headerName, headerValue] of Object.entries(headers)) { - if (CONTENT_LENGTH_REGEX.test(headerName)) { - return headerValue - } - } - return contentLength -} - -module.exports = { - getQueueTime, - getContentLengthFromHeaders -} diff --git a/node_modules/newrelic/lib/instrumentation/@hapi/hapi.js b/node_modules/newrelic/lib/instrumentation/@hapi/hapi.js deleted file mode 100644 index c31c8c32..00000000 --- a/node_modules/newrelic/lib/instrumentation/@hapi/hapi.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = require('../hapi') diff --git a/node_modules/newrelic/lib/instrumentation/amqplib.js b/node_modules/newrelic/lib/instrumentation/amqplib.js deleted file mode 100644 index 8adc11d2..00000000 --- a/node_modules/newrelic/lib/instrumentation/amqplib.js +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var url = require('url') - - -// TODO: Make this an external module. -// var newrelic = require('newrelic') -// newrelic.instrumentMessages('amqplib', instrumentChannelAPI) -// newrelic.instrumentMessages('amqplib/channel_api', instrumentChannelAPI) -// newrelic.instrumentMessages('amqplib/channel_api.js', instrumentChannelAPI) -// newrelic.instrumentMessages('amqplib/callback_api', instrumentCallbackAPI) -// newrelic.instrumentMessages('amqplib/callback_api.js', instrumentCallbackAPI) -module.exports.selfRegister = function selfRegister(shimmer) { - shimmer.registerInstrumentation({ - moduleName: 'amqplib', - type: 'message', - onRequire: instrumentChannelAPI - }) - shimmer.registerInstrumentation({ - moduleName: 'amqplib/channel_api', - type: 'message', - onRequire: instrumentChannelAPI - }) - shimmer.registerInstrumentation({ - moduleName: 'amqplib/channel_api.js', - type: 'message', - onRequire: instrumentChannelAPI - }) - shimmer.registerInstrumentation({ - moduleName: 'amqplib/callback_api', - type: 'message', - onRequire: instrumentCallbackAPI - }) - shimmer.registerInstrumentation({ - moduleName: 'amqplib/callback_api.js', - type: 'message', - onRequire: instrumentCallbackAPI - }) -} - -module.exports.instrumentPromiseAPI = instrumentChannelAPI -module.exports.instrumentCallbackAPI = instrumentCallbackAPI - -var CHANNEL_METHODS = [ - 'close', - 'open', - 'assertQueue', - 'checkQueue', - 'deleteQueue', - 'bindQueue', - 'unbindQueue', - 'assertExchange', - 'checkExchange', - 'deleteExchange', - 'bindExchange', - 'unbindExchange', - 'cancel', - 'prefetch', - 'recover' -] - -var TEMP_RE = /^amq\./ - - -function instrumentChannelAPI(shim, amqp) { - instrumentAMQP(shim, amqp, true) - wrapPromiseChannel(shim) -} - -function instrumentCallbackAPI(shim, amqp) { - instrumentAMQP(shim, amqp, false) - wrapCallbackChannel(shim) -} - -function instrumentAMQP(shim, amqp, promiseMode) { - if (!amqp || !amqp.connect) { - shim.logger.debug('This module is not the amqplib we\'re looking for.') - return false - } - - if (shim.isWrapped(amqp.connect)) { - shim.logger.trace('This module has already been instrumented, skipping.') - return - } - shim.setLibrary(shim.RABBITMQ) - - shim.record(amqp, 'connect', function recordConnect(shim, connect, name, args) { - var connArgs = args[0] - var params = null - - if (shim.isString(connArgs)) { - connArgs = url.parse(connArgs) - params = {host: connArgs.hostname} - if (connArgs.port) { - params.port = connArgs.port - } - } - - return { - name: 'amqplib.connect', - callback: promiseMode ? null : shim.LAST, - promise: promiseMode, - parameters: params, - - stream: null, - recorder: null - } - }) - - wrapChannel(shim) -} - -function wrapChannel(shim) { - var libChannel = shim.require('./lib/channel') - if (!libChannel || !libChannel.Channel || !libChannel.Channel.prototype) { - shim.logger.debug('Could not get Channel class to instrument.') - return - } - - var proto = libChannel.Channel.prototype - if (shim.isWrapped(proto.sendMessage)) { - shim.logger.trace('Channel already instrumented.') - return - } - shim.logger.trace('Instrumenting basic Channel class.') - - shim.wrap(proto, 'sendOrEnqueue', function wrapSendOrEnqueue(shim, fn) { - if (!shim.isFunction(fn)) { - return fn - } - - return function wrappedSendOrEnqueue() { - var segment = shim.getSegment() - var cb = arguments[arguments.length - 1] - if (!shim.isFunction(cb) || !segment) { - shim.logger.debug( - {cb: !!cb, segment: !!segment}, - 'Not binding sendOrEnqueue callback' - ) - return fn.apply(this, arguments) - } - - shim.logger.trace('Binding sendOrEnqueue callback to %s', segment.name) - var args = shim.argsToArray.apply(shim, arguments) - args[args.length - 1] = shim.bindSegment(cb, segment) - return fn.apply(this, args) - } - }) - - // Example fields: - // { exchange: 'test-exchange-topic', - // routingKey: 'routing.key', - // mandatory: false, - // immediate: false, - // ticket: undefined, - // contentType: undefined, - // contentEncoding: undefined, - // headers: {}, - // deliveryMode: undefined, - // priority: undefined, - // correlationId: undefined, - // replyTo: undefined, - // expiration: undefined, - // messageId: undefined, - // timestamp: undefined, - // type: undefined, - // userId: undefined, - // appId: undefined, - // clusterId: undefined } - - shim.recordProduce(proto, 'sendMessage', recordSendMessage) - function recordSendMessage(shim, fn, n, args) { - var fields = args[0] - if (!fields) { - return null - } - var isDefault = fields.exchange === '' - let exchange = 'Default' - if (!isDefault) { - exchange = TEMP_RE.test(fields.exchange) ? null : fields.exchange - } - - return { - destinationName: exchange, - destinationType: shim.EXCHANGE, - routingKey: fields.routingKey, - headers: fields.headers, - parameters: getParameters(Object.create(null), fields) - } - } -} - -function getParameters(parameters, fields) { - if (fields.routingKey) { - parameters.routing_key = fields.routingKey - } - if (fields.correlationId) { - parameters.correlation_id = fields.correlationId - } - if (fields.replyTo) { - parameters.reply_to = fields.replyTo - } - - return parameters -} - -function wrapPromiseChannel(shim) { - var libPModel = shim.require('./lib/channel_model') - if (!libPModel || !libPModel.Channel || !libPModel.Channel.prototype) { - shim.logger.debug('Could not get promise model Channel to instrument') - } - - var proto = libPModel.Channel.prototype - if (shim.isWrapped(proto.consume)) { - shim.logger.trace('Promise model already isntrumented.') - return - } - - shim.record(proto, CHANNEL_METHODS, function recordChannelMethod(shim, fn, name) { - return { - name: 'Channel#' + name, - promise: true - } - }) - - shim.recordConsume(proto, 'get', { - destinationName: shim.FIRST, - promise: true, - messageHandler: function handleConsumedMessage(shim, fn, name, message) { - if (!message) { - shim.logger.trace('No results from consume.') - return null - } - var parameters = Object.create(null) - getParameters(parameters, message.fields) - getParameters(parameters, message.properties) - - var headers = null - if (message.properties && message.properties.headers) { - headers = message.properties.headers - } - - return {parameters: parameters, headers: headers} - } - }) - - shim.recordPurgeQueue(proto, 'purgeQueue', function recordPurge(shim, fn, name, args) { - var queue = args[0] || null - if (TEMP_RE.test(queue)) { - queue = null - } - - return {queue: queue, promise: true} - }) - - shim.recordSubscribedConsume(proto, 'consume', { - name: 'amqplib.Channel#consume', - queue: shim.FIRST, - consumer: shim.SECOND, - promise: true, - messageHandler: describeMessage - }) -} - -function wrapCallbackChannel(shim) { - var libCbModel = shim.require('./lib/callback_model') - if (!libCbModel || !libCbModel.Channel || !libCbModel.Channel.prototype) { - shim.logger.debug('Could not get callback model Channel to instrument') - return - } - - var proto = libCbModel.Channel.prototype - if (shim.isWrapped(proto.consume)) { - return - } - - // Example message: - // { fields: - // { consumerTag: 'amq.ctag-8oZE10ovvyAP8e-vgbOnSA', - // deliveryTag: 1, - // redelivered: false, - // exchange: 'test-exchange-topic', - // routingKey: 'routing.key' }, - // properties: - // { contentType: undefined, - // contentEncoding: undefined, - // headers: {}, - // deliveryMode: undefined, - // priority: undefined, - // correlationId: undefined, - // replyTo: undefined, - // expiration: undefined, - // messageId: undefined, - // timestamp: undefined, - // type: undefined, - // userId: undefined, - // appId: undefined, - // clusterId: undefined }, - // content: Buffer [ 97 ] } - - shim.record(proto, CHANNEL_METHODS, function recordChannelMethod(shim, fn, name) { - return { - name: 'Channel#' + name, - callback: shim.LAST - } - }) - - shim.recordConsume(proto, 'get', { - destinationName: shim.FIRST, - callback: shim.LAST, - messageHandler: function handleConsumedMessage(shim, fn, name, args) { - var message = args[1] - if (!message) { - shim.logger.trace('No results from consume.') - return null - } - var parameters = Object.create(null) - getParameters(parameters, message.fields) - getParameters(parameters, message.properties) - - var headers = null - if (message.properties && message.properties.headers) { - headers = message.properties.headers - } - - return {parameters: parameters, headers: headers} - } - }) - - shim.recordPurgeQueue(proto, 'purgeQueue', function recordPurge(shim, fn, name, args) { - var queue = args[0] - if (TEMP_RE.test(queue)) { - queue = null - } - - return {queue: queue, callback: shim.LAST} - }) - - - shim.recordSubscribedConsume(proto, 'consume', { - name: 'amqplib.Channel#consume', - queue: shim.FIRST, - consumer: shim.SECOND, - callback: shim.FOURTH, - promise: false, - messageHandler: describeMessage - }) -} - -function describeMessage(shim, consumer, name, args) { - var message = args[0] - if (!message || !message.properties) { - shim.logger.debug( - {message: message}, - 'Failed to find message in consume arguments.' - ) - return null - } - - var exchangeName = message.fields.exchange - var parameters = getParameters(Object.create(null), message.fields) - getParameters(parameters, message.properties) - - if (!exchangeName) { - exchangeName = 'Default' - } else if (TEMP_RE.test(exchangeName)) { - exchangeName = null - } - - return { - destinationName: exchangeName, - destinationType: shim.EXCHANGE, - routingKey: message.fields.routingKey, - headers: message.properties.headers, - parameters: parameters - } -} diff --git a/node_modules/newrelic/lib/instrumentation/bluebird.js b/node_modules/newrelic/lib/instrumentation/bluebird.js deleted file mode 100644 index c79a023a..00000000 --- a/node_modules/newrelic/lib/instrumentation/bluebird.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// XXX We are not instrumenting bluebird's cancellation feature because it seems -// rather like an edge case feature. It is not enabled by default and has strange -// effects on the interface. If our lack of support for cancellation becomes an -// issue we can revisit this decision. -// -// http://bluebirdjs.com/docs/api/cancellation.html - -module.exports = function initialize(agent, bluebird, moduleName, shim) { - const Promise = bluebird.Promise - const proto = Promise && Promise.prototype - if (!proto) { - shim.logger.debug('Could not find promise prototype, not instrumenting.') - return false - } - - shim.setClass(Promise) - - // _resolveFromResolver is in bluebird 2.x - // _execute is in bluebird 3.x - shim.wrapExecutorCaller(proto, ['_execute', '_resolveFromResolver']) - shim.wrapThen(proto, [ - 'asCallback', 'done', 'each', 'filter', 'finally', 'lastly', 'map', - 'mapSeries', 'nodeify', 'reduce', 'spread', 'tap', 'tapCatch', 'then' - ]) - shim.wrapCatch(proto, ['catch', 'caught', 'error']) - shim.wrapCast(proto, [ - 'all', 'any', 'bind', 'call', 'catchReturn', 'catchThrow', 'delay', 'get', - 'props', 'race', 'reflect', 'return', 'some', 'thenReturn', 'thenThrow', - 'throw', 'timeout' - ]) - - shim.wrapCast(Promise, [ - 'all', 'allSettled', 'any', 'attempt', 'bind', 'cast', 'delay', 'each', - 'filter', 'fromCallback', 'fromNode', 'fulfilled', 'join', 'map', - 'mapSeries', 'props', 'race', 'reduce', 'reject', 'rejected', 'resolve', - 'some', 'try' - ]) - shim.wrapPromisify(Promise, ['coroutine', 'method', 'promisify']) - - // Using `getNewLibraryCopy` needs to trigger re-instrumenting. - shim.wrap( - bluebird.Promise, - 'getNewLibraryCopy', - function wrapNewCopy(shim, original) { - return function wrappedNewCopy() { - shim.logger.trace('Instrumenting new library copy...') - var copy = original.apply(this, arguments) - module.exports(agent, copy, moduleName, shim) - return copy - } - } - ) - - // Need to copy over `coroutine.addYieldHandler` - var coroutine = Promise && Promise.coroutine - if (shim.isWrapped(coroutine)) { - var original = shim.getOriginal(coroutine) - coroutine.addYieldHandler = original && original.addYieldHandler - } -} diff --git a/node_modules/newrelic/lib/instrumentation/cassandra-driver.js b/node_modules/newrelic/lib/instrumentation/cassandra-driver.js deleted file mode 100644 index ed4d046c..00000000 --- a/node_modules/newrelic/lib/instrumentation/cassandra-driver.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function initialize(agent, cassandra, moduleName, shim) { - var proto = cassandra.Client.prototype - shim.setDatastore(shim.CASSANDRA) - shim.recordOperation(proto, ['connect', 'shutdown'], {callback: shim.LAST}) - shim.recordQuery(proto, '_innerExecute', {query: shim.FIRST, callback: shim.LAST}) - shim.recordBatchQuery(proto, 'batch', { - query: findBatchQueryArg, - callback: shim.LAST - }) -} - -/** - * Given the arguments for Cassandra's `batch` method, this finds the first - * query in the batch. - * - * @return {string} The query for this batch request. - */ -function findBatchQueryArg(shim, batch, fnName, args) { - var sql = (args[0] && args[0][0]) || '' - return sql.query || sql -} diff --git a/node_modules/newrelic/lib/instrumentation/connect.js b/node_modules/newrelic/lib/instrumentation/connect.js deleted file mode 100644 index b1bf23e0..00000000 --- a/node_modules/newrelic/lib/instrumentation/connect.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function initialize(agent, connect, moduleName, shim) { - if (!connect) { - shim.logger.debug('Connect not supplied, not instrumenting.') - return false - } - - shim.setFramework(shim.CONNECT) - - shim.setRouteParser(function parseRoute(shim, fn, fnName, route) { - return route.url - }) - - var proto = (connect && connect.HTTPServer && connect.HTTPServer.prototype) || // v1 - (connect && connect.proto) // v2 - - shim.wrapMiddlewareMounter(proto, 'use', { - route: shim.FIRST, - endpoint: shim.LAST, - wrapper: wrapMiddleware - }) - - wrapConnectExport(shim, connect, !proto) -} - -function wrapMiddleware(shim, middleware, name, route) { - var spec = { - matchArity: true, - route: route, - type: shim.MIDDLEWARE, - next: shim.LAST, - req: shim.FIRST - } - - if (middleware.length === 4) { - spec.type = shim.ERRORWARE - spec.req = shim.SECOND - } - - if (shim.isWrapped(middleware)) { - // In some cases the middleware will be instrumented by a framework - // that uses connect (e.g. express v3) and we omit the connect - // instrumentation. - return middleware - } - - return shim.recordMiddleware(middleware, spec) -} - -function wrapConnectExport(shim, connect, v3) { - shim.wrapExport(connect, function wrapExport(shim, fn) { - var wrapper = shim.wrap(fn, function wrapConnect(shim, _fn) { - return function wrappedConnect() { - var res = _fn.apply(this, arguments) - if (v3) { - shim.wrapMiddlewareMounter(res, 'use', { - route: shim.FIRST, - wrapper: wrapMiddleware - }) - } - return res - } - }) - shim.proxy(fn, Object.keys(fn), wrapper) - return wrapper - }) -} diff --git a/node_modules/newrelic/lib/instrumentation/core/async_hooks.js b/node_modules/newrelic/lib/instrumentation/core/async_hooks.js deleted file mode 100644 index c709b8b5..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/async_hooks.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../../logger').child({component: 'async_hooks'}) -var promInit = require('../promise') - -module.exports = initialize - -/** - * The spec for the native `Promise` class. - */ -var STATIC_PROMISE_METHODS = ['accept', 'all', 'defer', 'race', 'reject', 'resolve'] -var NATIVE_PROMISE_SPEC = { - name: 'global', - constructor: 'Promise', - executor: true, - useFinally: false, - $proto: { - then: ['then', 'chain'], - catch: ['catch'] - }, - $static: { - $copy: STATIC_PROMISE_METHODS, - cast: STATIC_PROMISE_METHODS - } -} - -function initialize(agent, shim) { - var enableHooks = agent.config.checkAsyncHookStatus() - if (enableHooks && tryAsyncHooks(agent, shim)) { - logger.debug('Using async_hooks.') - } else { - logger.debug('Using promise instrumentation.') - promInit(agent, global, NATIVE_PROMISE_SPEC) - } -} - -function tryAsyncHooks(agent, shim) { - var asyncHooks = null - try { - asyncHooks = require('async_hooks') - } catch (e) { - logger.info(e, 'Not using async_hooks module.') - return false - } - - // this map is reused to track the segment that was active when - // the before callback is called to be replaced in the after callback - var segmentMap = new Map() - module.exports.segmentMap = segmentMap - - var hook = asyncHooks.createHook({ - init: function initHook(id, type, triggerId, promiseWrap) { - var transaction = agent.getTransaction() - var parentSegment = segmentMap.get(triggerId) - - if (!parentSegment && !transaction || type !== 'PROMISE') { - return - } - - var activeSegment = shim.getActiveSegment() || parentSegment - if (promiseWrap && promiseWrap.promise) { - promiseWrap.promise.__NR_id = id - } - segmentMap.set(id, activeSegment) - }, - - before: function beforeHook(id) { - var hookSegment = segmentMap.get(id) - - if (!hookSegment) { - return - } - - segmentMap.set(id, shim.getActiveSegment()) - shim.setActiveSegment(hookSegment) - }, - after: function afterHook(id) { - var hookSegment = segmentMap.get(id) - - // hookSegment is the segment that was active before the promise - // executed. If the promise is executing before a segment has been - // restored, hookSegment will be null and should be restored. Thus - // undefined is the only invalid value here. - if (hookSegment === undefined) { - return - } - - segmentMap.set(id, shim.getActiveSegment()) - shim.setActiveSegment(hookSegment) - }, - destroy: function destHook(id) { - segmentMap.delete(id) - } - }).enable() - - agent.on('unload', function disableHook() { - hook.disable() - }) - - return true -} diff --git a/node_modules/newrelic/lib/instrumentation/core/child_process.js b/node_modules/newrelic/lib/instrumentation/core/child_process.js deleted file mode 100644 index bb630c46..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/child_process.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = initialize - -function initialize(agent, childProcess, moduleName, shim) { - if (!childProcess) { - shim.log.debug('Could not find child_process, not instrumenting') - return false - } - - const methods = ['exec', 'execFile'] - - shim.record( - childProcess, - methods, - function recordExec(shim, fn, name) { - return {name: 'child_process.' + name, callback: shim.LAST} - } - ) - - if (childProcess.ChildProcess) { - wrapChildProcessClass(shim, childProcess.ChildProcess) - } else { - shim.logger.warn('childProcess.ChildProcess should be available in v2.2.0 or higher') - } - - function wrapChildProcessClass(shim, childProcessClass) { - shim.wrap( - childProcessClass.prototype, - 'on', - function wrapChildProcessClassOn(shim, fn) { - return function wrappedChildProcessOn() { - const args = shim.argsToArray.apply(shim, arguments) - const cbIndex = args.length - 1 - - const originalListener = args[cbIndex] - if (!shim.isFunction(originalListener)) { - return fn.apply(this, arguments) - } - - shim.bindSegment(args, cbIndex) - - // Leverage events.removeListener() mechanism that checks listener - // property to allow our wrapped listeners to match and remove appropriately. - // Avoids having to instrument removeListener() and potentially doubling - // lookup. Since our wrapping will only be referenced by the events - // collection, we should not need to unwrap. - args[cbIndex].listener = originalListener - - return fn.apply(this, args) - } - } - ) - } - - makePromisifyCompatible(shim, childProcess) -} - -function makePromisifyCompatible(shim, childProcess) { - const originalExec = shim.getOriginal(childProcess.exec) - Object.getOwnPropertySymbols(originalExec).forEach((symbol) => { - childProcess.exec[symbol] = originalExec[symbol] - }) - - const originalExecFile = shim.getOriginal(childProcess.execFile) - Object.getOwnPropertySymbols(originalExecFile).forEach((symbol) => { - childProcess.execFile[symbol] = originalExecFile[symbol] - }) -} diff --git a/node_modules/newrelic/lib/instrumentation/core/crypto.js b/node_modules/newrelic/lib/instrumentation/core/crypto.js deleted file mode 100644 index a3e8c0bc..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/crypto.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = initialize - -function initialize(agent, crypto, moduleName, shim) { - shim.record( - crypto, - [ - 'pbkdf2', - 'randomBytes', - 'pseudoRandomBytes', - 'randomFill', - 'scrypt' - ], - function recordCryptoMethod(shim, fn, name) { - return { - name: 'crypto.' + name, - callback: shim.LAST, - callbackRequired: true // sync version used too heavily - too much overhead - } - } - ) -} diff --git a/node_modules/newrelic/lib/instrumentation/core/dns.js b/node_modules/newrelic/lib/instrumentation/core/dns.js deleted file mode 100644 index 3d8a742b..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/dns.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = initialize - -function initialize(agent, dns, moduleName, shim) { - const methods = [ - 'lookup', - 'resolve', - 'resolve4', - 'resolve6', - 'resolveCname', - 'resolveMx', - 'resolveNaptr', - 'resolveNs', - 'resolvePtr', - 'resolveSrv', - 'resolveTxt', - 'reverse' - ] - - shim.record( - dns, - methods, - function recordDnsMethod(shim, fn, name) { - return { name: 'dns.' + name, callback: shim.LAST } - } - ) -} diff --git a/node_modules/newrelic/lib/instrumentation/core/domain.js b/node_modules/newrelic/lib/instrumentation/core/domain.js deleted file mode 100644 index d37e2764..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/domain.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = initialize - -function initialize(agent, domain, name, shim) { - var proto = domain.Domain.prototype - shim.wrap( - proto, - 'emit', - wrapEmit - ) - - function wrapEmit(shim, original) { - return function wrappedEmit(ev) { - var shouldRestoreContext = - ev === 'error' && - shim.getActiveSegment() === null && - shim.getSegment(this) - - if (!shouldRestoreContext) { - return original.apply(this, arguments) - } - - shim.setActiveSegment(shim.getSegment(this)) - try { - return original.apply(this, arguments) - } finally { - shim.setActiveSegment(null) - } - } - } -} diff --git a/node_modules/newrelic/lib/instrumentation/core/fs.js b/node_modules/newrelic/lib/instrumentation/core/fs.js deleted file mode 100644 index b1caa88e..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/fs.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const record = require('../../metrics/recorders/generic') -const NAMES = require('../../metrics/names') - -module.exports = initialize - -function initialize(agent, fs, moduleName, shim) { - const methods = [ - 'rename', - 'truncate', - 'chown', - 'lchown', - 'fchown', - 'chmod', - 'lchmod', - 'fchmod', - 'stat', - 'lstat', - 'fstat', - 'link', - 'symlink', - 'readlink', - 'realpath', - 'unlink', - 'rmdir', - 'mkdir', - 'mkdtemp', - 'readdir', - 'close', - 'open', - 'utimes', - 'futimes', - 'fsync', - 'readFile', - 'writeFile', - 'appendFile', - 'exists', - 'ftruncate' - ] - - const nonRecordedMethods = [ - 'write', - 'read' - ] - - shim.record(fs, methods, recordFs) - - const originalExists = shim.getOriginal(fs.exists) - Object.getOwnPropertySymbols(originalExists).forEach((symbol) => { - fs.exists[symbol] = originalExists[symbol] - }) - - fs.realpath.native = shim.getOriginal(fs.realpath).native - - shim.record( - fs.realpath, - 'native', - function recordRealpathNative(shim, fn) { - return recordFs(shim, fn, 'realpath.native') - } - ) - - shim.wrap( - fs, - nonRecordedMethods, - function wrapNonRecordedFs(shim, fn) { - return function wrappedNonRecordedFs() { - // these are called in tight loops so opting out early - if (!shim.getActiveSegment()) { - return fn.apply(this, arguments) - } - - const args = shim.argsToArray.apply(shim, arguments) - const cbIndex = args.length - 1 - - shim.bindSegment(args, cbIndex) - - return fn.apply(this, args) - } - } - ) - - shim.wrap( - fs, - ['watch', 'watchFile'], - function wrapFsWatch(shim, fn) { - return function wrappedFsWatch() { - const result = fn.apply(this, arguments) - shim.bindSegment(result, 'emit') - - return result - } - } - ) - - function recordFs(shim, fn, name) { - return {name: NAMES.FS.PREFIX + name, callback: shim.LAST, recorder: record} - } -} diff --git a/node_modules/newrelic/lib/instrumentation/core/globals.js b/node_modules/newrelic/lib/instrumentation/core/globals.js deleted file mode 100644 index 37251944..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/globals.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var asyncHooks = require('./async_hooks') - -module.exports = initialize - - -function initialize(agent, nodule, name, shim) { - let exceptionCallbackRegistered = false - - // `_fatalException` is an undocumented feature of domains, introduced in - // Node.js v0.8. We use `_fatalException` because wrapping it will not - // potentially change the behavior of the server unlike listening for - // `uncaughtException`. - shim.wrap(process, '_fatalException', function wrapper(shim, original) { - return function wrappedFatalException(error) { - // Only record the error if we are not currently within an instrumented - // domain. - // In serverless mode this will be handled by its own _fatalException wrapper - if ( - !shim.agent.config.serverless_mode.enabled && - !process.domain && - !exceptionCallbackRegistered - ) { - agent.errors.add(null, error) - shim.setActiveSegment(null) - } - return original.apply(this, arguments) - } - }) - - shim.wrap(process, 'emit', function wrapEmit(shim, original) { - return function wrappedEmit(ev, error, promise) { - // Check for unhandledRejections here so we don't change the behavior of - // the event. - if (ev === 'unhandledRejection' && error && !process.domain) { - if (process.listenerCount('unhandledRejection') === 0) { - // If there are no unhandledRejection handlers report the error. - const segment = promise.__NR_id - ? (asyncHooks.segmentMap.get(promise.__NR_id)) - : (promise.__NR_context && promise.__NR_context.getSegment()) - const tx = segment && segment.transaction - shim.logger.trace( - 'Captured unhandled rejection for transaction %s', - tx && tx.id - ) - agent.errors.add(tx, error) - } - } - - return original.apply(this, arguments) - } - }) - - shim.wrap(process, 'setUncaughtExceptionCaptureCallback', wrapUncaughtExceptionCallback) - - function wrapUncaughtExceptionCallback(shim, original) { - return function wrapped(fn) { - exceptionCallbackRegistered = fn !== null - return original.apply(this, arguments) - } - } - - // This will initialize the most optimal native-promise instrumentation that - // we have available. - asyncHooks(agent, shim) -} diff --git a/node_modules/newrelic/lib/instrumentation/core/http-outbound.js b/node_modules/newrelic/lib/instrumentation/core/http-outbound.js deleted file mode 100644 index 111ffb8b..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/http-outbound.js +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var recordExternal = require('../../metrics/recorders/http_external') -var urltils = require('../../util/urltils') -var hashes = require('../../util/hashes') -var logger = require('../../logger').child({component: 'outbound'}) -var shimmer = require('../../shimmer') -var util = require('util') -var url = require('url') -var copy = require('../../util/copy') - -const NAMES = require('../../metrics/names') -const SHIM_SYMBOLS = require('../../shim/constants').SYMBOLS - -const DEFAULT_HOST = 'localhost' -const DEFAULT_PORT = 80 -const DEFAULT_SSL_PORT = 443 - -const NEWRELIC_ID_HEADER = 'x-newrelic-id' -const NEWRELIC_TRANSACTION_HEADER = 'x-newrelic-transaction' -const NEWRELIC_SYNTHETICS_HEADER = 'x-newrelic-synthetics' - -/** - * Instruments an outbound HTTP request. - * - * @param {Agent} agent - * @param {object} opts - * @param {function} makeRequest - * - * @return {http.ClientRequest} The instrumented outbound request. - */ -module.exports = function instrumentOutbound(agent, opts, makeRequest) { - if (typeof opts === 'string') { - opts = url.parse(opts) - } else { - opts = copy.shallow(opts) - } - - let hostname = opts.hostname || opts.host || DEFAULT_HOST - let port = opts.port || opts.defaultPort - if (!port) { - port = (!opts.protocol || opts.protocol === 'http:') ? DEFAULT_PORT : DEFAULT_SSL_PORT - } - - if (!hostname || port < 1) { - logger.warn( - 'Invalid host name (%s) or port (%s) for outbound request.', - hostname, port - ) - return makeRequest(opts) - } - - // Technically we shouldn't append the port if this is an https request on 443 - // but due to legacy issues we can't do that without moving customer's cheese. - // - // TODO: Move customers cheese by not appending the default port for https. - if (port && port !== DEFAULT_PORT) { - hostname += ':' + port - } - - const name = NAMES.EXTERNAL.PREFIX + hostname - - const parent = agent.tracer.getSegment() - if (parent && parent.opaque) { - logger.trace( - 'Not capturing data for outbound request (%s) because parent segment opaque (%s)', - name, - parent.name - ) - - return makeRequest(opts) - } - - - return agent.tracer.addSegment( - name, - recordExternal(hostname, 'http'), - parent, - false, - instrumentRequest - ) - - function instrumentRequest(segment) { - const transaction = segment.transaction - const outboundHeaders = Object.create(null) - - if (agent.config.encoding_key && transaction.syntheticsHeader) { - outboundHeaders[NEWRELIC_SYNTHETICS_HEADER] = transaction.syntheticsHeader - } - - // TODO: abstract header logic shared with TransactionShim#insertCATRequestHeaders - if (agent.config.distributed_tracing.enabled) { - if (opts.headers && opts.headers[SHIM_SYMBOLS.DISABLE_DT]) { - logger.trace('Distributed tracing disabled by instrumentation.') - } else { - transaction.insertDistributedTraceHeaders(outboundHeaders) - } - } else if (agent.config.cross_application_tracer.enabled) { - if (agent.config.encoding_key) { - _addCATHeaders(agent, transaction, outboundHeaders) - } else { - logger.trace('No encoding key found, not adding CAT headers') - } - } else { - logger.trace('CAT disabled, not adding headers!') - } - - if (util.isArray(opts.headers)) { - opts.headers = opts.headers.slice() - Array.prototype.push.apply( - opts.headers, - Object.keys(outboundHeaders).map(function getHeaderTuples(key) { - return [key, outboundHeaders[key]] - }) - ) - } else { - opts.headers = Object.assign( - Object.create(null), - opts.headers, - outboundHeaders - ) - } - - segment.start() - const request = makeRequest(opts) - const parsed = urltils.scrubAndParseParameters(request.path) - const proto = parsed.protocol || opts.protocol || 'http:' - segment.name += parsed.path - Object.defineProperty(request, '__NR_segment', { - value: segment - }) - - if (parsed.parameters) { - // Scrub and parse returns on object with a null prototype. - for (let key in parsed.parameters) { // eslint-disable-line guard-for-in - segment.addSpanAttribute(`request.parameters.${key}`, parsed.parameters[key]) - } - } - segment.addAttribute('url', `${proto}//${hostname}${parsed.path}`) - segment.addAttribute('procedure', opts.method || 'GET') - - // Wrap the emit method. We're doing a special wrapper instead of using - // `tracer.bindEmitter` because we want to do some logic based on certain - // events. - shimmer.wrapMethod(request, 'request.emit', 'emit', function wrapEmit(emit) { - const boundEmit = agent.tracer.bindFunction(emit, segment) - return function wrappedRequestEmit(evnt, arg) { - if (evnt === 'error') { - segment.end() - handleError(segment, request, arg) - } else if (evnt === 'response') { - handleResponse(segment, hostname, request, arg) - } - - return boundEmit.apply(this, arguments) - } - }) - _makeNonEnumerable(request, 'emit') - - return request - } -} - -/** - * Notices the given error if there is no listener for the `error` event on the - * request object. - * - * @param {TraceSegment} segment - * @param {http.ClientRequest} req - * @param {Error} error - * - * @return {bool} True if the error will be collected by New Relic. - */ -function handleError(segment, req, error) { - if (req.listenerCount('error') > 0) { - logger.trace( - error, - 'Not capturing outbound error because user has already handled it.' - ) - return false - } - - logger.trace(error, 'Captured outbound error on behalf of the user.') - const tx = segment.transaction - tx.agent.errors.add(tx, error) - return true -} - -/** - * Ties the response object to the request segment. - * - * @param {TraceSegment} segment - * @param {string} hostname - * @param {http.ClientRequest} req - * @param {http.IncomingMessage} res - */ -function handleResponse(segment, hostname, req, res) { - // Add response attributes for spans - segment.addSpanAttribute('http.statusCode', res.statusCode) - segment.addSpanAttribute('http.statusText', res.statusMessage) - - // If CAT is enabled, grab those headers! - const agent = segment.transaction.agent - if ( - agent.config.cross_application_tracer.enabled && - !agent.config.distributed_tracing.enabled - ) { - pullCatHeaders(agent.config, segment, hostname, res.headers['x-newrelic-app-data']) - } - - // Again a custom emit wrapper because we want to watch for the `end` event. - shimmer.wrapMethod(res, 'response', 'emit', function wrapEmit(emit) { - var boundEmit = agent.tracer.bindFunction(emit, segment) - return function wrappedResponseEmit(evnt) { - if (evnt === 'end') { - segment.end() - } - return boundEmit.apply(this, arguments) - } - }) - _makeNonEnumerable(res, 'emit') -} - -function pullCatHeaders(config, segment, host, obfAppData) { - if (!config.encoding_key) { - logger.trace('config.encoding_key is not set - not parsing response CAT headers') - return - } - - if (!config.trusted_account_ids) { - logger.trace( - 'config.trusted_account_ids is not set - not parsing response CAT headers' - ) - return - } - - // is our downstream request CAT-aware? - if (!obfAppData) { - logger.trace('Got no CAT app data in response header x-newrelic-app-data') - } else { - var appData = null - try { - appData = - JSON.parse(hashes.deobfuscateNameUsingKey(obfAppData, config.encoding_key)) - } catch (e) { - logger.warn('Got an unparsable CAT header x-newrelic-app-data: %s', obfAppData) - return - } - // Make sure it is a trusted account - if (appData.length && typeof appData[0] === 'string') { - var accountId = appData[0].split('#')[0] - accountId = parseInt(accountId, 10) - if (config.trusted_account_ids.indexOf(accountId) === -1) { - logger.trace('Response from untrusted CAT header account id: %s', accountId) - } else { - segment.catId = appData[0] - segment.catTransaction = appData[1] - segment.name = NAMES.EXTERNAL.TRANSACTION + host + '/' + - segment.catId + '/' + segment.catTransaction - if (appData.length >= 6) { - segment.addAttribute('transaction_guid', appData[5]) - } - logger.trace('Got inbound response CAT headers in transaction %s', - segment.transaction.id) - } - } - } -} - -function _makeNonEnumerable(obj, prop) { - try { - var desc = Object.getOwnPropertyDescriptor(obj, prop) - desc.enumerable = false - Object.defineProperty(obj, prop, desc) - } catch (e) { - logger.debug(e, 'Failed to make %s non enumerable.', prop) - } -} - -function _addCATHeaders(agent, tx, outboundHeaders) { - if (agent.config.obfuscatedId) { - outboundHeaders[NEWRELIC_ID_HEADER] = agent.config.obfuscatedId - } - - var pathHash = hashes.calculatePathHash( - agent.config.applications()[0], - tx.getFullName() || '', - tx.referringPathHash - ) - tx.pushPathHash(pathHash) - - try { - let txData = JSON.stringify([ - tx.id, - false, - tx.tripId || tx.id, - pathHash - ]) - txData = hashes.obfuscateNameUsingKey(txData, agent.config.encoding_key) - outboundHeaders[NEWRELIC_TRANSACTION_HEADER] = txData - - logger.trace( - 'Added outbound request CAT headers in transaction %s', - tx.id - ) - } catch (err) { - logger.trace(err, 'Failed to create CAT payload') - } -} diff --git a/node_modules/newrelic/lib/instrumentation/core/http.js b/node_modules/newrelic/lib/instrumentation/core/http.js deleted file mode 100644 index bab27865..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/http.js +++ /dev/null @@ -1,664 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const shimmer = require('../../shimmer') -const logger = require('../../logger').child({component: 'http'}) -const recordWeb = require('../../metrics/recorders/http') -const hashes = require('../../util/hashes') -const cat = require('../../util/cat') -const instrumentOutbound = require('./http-outbound') -const util = require('util') -const url = require('url') -const urltils = require('../../util/urltils') -const properties = require('../../util/properties') -const headerAttributes = require('../../header-attributes') -const headerProcessing = require('../../header-processing') - -const NAMES = require('../../metrics/names') -const DESTS = require('../../config/attribute-filter').DESTINATIONS - -/* - * - * CONSTANTS - * - */ -const NR_CONNECTION_PROP = '__NR__connection' -const NEWRELIC_ID_HEADER = 'x-newrelic-id' -const NEWRELIC_APP_DATA_HEADER = 'x-newrelic-app-data' -const NEWRELIC_TRANSACTION_HEADER = 'x-newrelic-transaction' -const NEWRELIC_SYNTHETICS_HEADER = 'x-newrelic-synthetics' -const TRANSACTION_INFO_KEY = '__NR_transactionInfo' - - -// For incoming requests this instrumentation functions by wrapping -// `http.createServer` and `http.Server#addListener`. The former merely sets the -// agent dispatcher to 'http' and the latter wraps any event handlers bound to -// `request`. -// -// The `request` event listener wrapper creates a transaction proxy which will -// start a new transaction whenever a new request comes in. It also scans the -// headers of the incoming request looking for CAT and synthetics headers. - -function wrapEmitWithTransaction(agent, emit, isHTTPS) { - const tracer = agent.tracer - const transport = isHTTPS ? 'HTTPS' : 'HTTP' - let serverPort = null - - return tracer.transactionProxy(function wrappedHandler(evnt, request, response) { - var transaction = tracer.getTransaction() - if (!transaction) return emit.apply(this, arguments) - - transaction.nameState.setPrefix(NAMES.NODEJS.PREFIX) - transaction.nameState.setDelimiter(NAMES.ACTION_DELIMITER) - - // Store the transaction information on the request and response. - const txInfo = storeTxInfo(transaction, request, response) - - // Hook for web framework instrumentations that don't have easy access to - // the request entry point. - if (properties.hasOwn(this, '__NR_onRequestStarted')) { - this.__NR_onRequestStarted(request, response) - } - - if (request) { - initializeRequest(transaction, request) - } - - // Create the transaction segment using the request URL for now. Once a - // better name can be determined this segment will be renamed to that. - const segment = tracer.createSegment(request.url, recordWeb) - segment.start() - - if (request.method != null) { - segment.addSpanAttribute( - 'request.method', - request.method - ) - } - - if (txInfo) { - // Seed segment stack to enable parenting logic leveraged by - // web framework instrumentations. - txInfo.segmentStack.push(segment) - } - - transaction.type = 'web' - transaction.baseSegment = segment - - /* Needed for Connect and Express middleware that monkeypatch request - * and response via listeners. - */ - tracer.bindEmitter(request, segment) - tracer.bindEmitter(response, segment) - - // the error tracer needs a URL for tracing, even though naming overwrites - transaction.parsedUrl = url.parse(request.url, true) - transaction.url = transaction.parsedUrl.pathname - transaction.verb = request.method - - // URL is sent as an agent attribute with transaction events - transaction.trace.attributes.addAttribute( - DESTS.TRANS_EVENT | DESTS.ERROR_EVENT, - 'request.uri', - transaction.url - ) - - segment.addSpanAttribute( - 'request.uri', - transaction.url - ) - - // store the port on which this transaction runs - if (this.address instanceof Function) { - var address = this.address() - if (address) { - serverPort = address.port - } - } - transaction.port = serverPort - - // need to set any config-driven names early for RUM - logger.trace({url: request.url, transaction: transaction.id}, - 'Applying user naming rules for RUM.') - transaction.applyUserNamingRules(request.url) - - const queueTimeStamp = headerProcessing.getQueueTime(logger, request.headers) - if (queueTimeStamp) { - transaction.queueTime = Date.now() - queueTimeStamp - } - - const synthHeader = request.headers[NEWRELIC_SYNTHETICS_HEADER] - - if (synthHeader && agent.config.trusted_account_ids && agent.config.encoding_key) { - handleSyntheticsHeader( - synthHeader, - agent.config.encoding_key, - agent.config.trusted_account_ids, - transaction - ) - } - - if (agent.config.distributed_tracing.enabled) { - // Node http headers are automatically lowercase - transaction.acceptDistributedTraceHeaders(transport, request.headers) - } else if (agent.config.cross_application_tracer.enabled) { - const incomingCatId = request.headers[NEWRELIC_ID_HEADER] - const obfTransaction = request.headers[NEWRELIC_TRANSACTION_HEADER] - - if (agent.config.encoding_key) { - cat.handleCatHeaders(incomingCatId, obfTransaction, agent.config.encoding_key, transaction) - if (transaction.incomingCatId) { - logger.trace('Got inbound request CAT headers in transaction %s', - transaction.id) - } - } - } - - function instrumentedFinish() { - // Remove listeners so this doesn't get called twice. - response.removeListener('finish', instrumentedFinish) - request.removeListener('aborted', instrumentedFinish) - - // Naming must happen before the segment and transaction are ended, - // because metrics recording depends on naming's side effects. - transaction.finalizeNameFromUri(transaction.parsedUrl, response.statusCode) - - if (response) { - if (response.statusCode != null) { - var responseCode = String(response.statusCode) - - if (/^\d+$/.test(responseCode)) { - transaction.trace.attributes.addAttribute( - DESTS.TRANS_COMMON, - 'http.statusCode', - responseCode - ) - - segment.addSpanAttribute('http.statusCode', responseCode) - } - } - - if (response.statusMessage !== undefined) { - transaction.trace.attributes.addAttribute( - DESTS.TRANS_COMMON, - 'http.statusText', - response.statusMessage - ) - - segment.addSpanAttribute('http.statusText', response.statusMessage) - } - - var headers = response.getHeaders() - if (headers) { - headerAttributes.collectResponseHeaders(headers, transaction) - } - } - - // And we are done! End the segment and transaction. - segment.end() - transaction.end() - } - response.once('finish', instrumentedFinish) - request.once('aborted', instrumentedFinish) - - return tracer.bindFunction(emit, segment).apply(this, arguments) - }) -} - -function storeTxInfo(transaction, request, response) { - if (!request || !response) { - logger.debug('Missing request or response object! Not storing transaction info.') - return - } - var hideInternal = transaction.agent.config.transaction_tracer.hide_internals - - var txInfo = { - transaction: transaction, - segmentStack: [], - errorHandled: false, - error: null - } - if (hideInternal) { - properties.setInternal(request, TRANSACTION_INFO_KEY, txInfo) - properties.setInternal(response, TRANSACTION_INFO_KEY, txInfo) - } else { - request[TRANSACTION_INFO_KEY] = response[TRANSACTION_INFO_KEY] = txInfo - } - - logger.trace( - 'Stored transaction %s information on request and response', - transaction.id - ) - - return txInfo -} - -function initializeRequest(transaction, request) { - headerAttributes.collectRequestHeaders(request.headers, transaction) - - if (request.method != null) { - transaction.trace.attributes.addAttribute( - DESTS.TRANS_COMMON, - 'request.method', - request.method - ) - transaction.nameState.setVerb(request.method) - } -} - -function wrapResponseEnd(agent, proto) { - var tracer = agent.tracer - - // On end, we must freeze the current name state to maintain the route that - // responded and also end the current segment (otherwise it may become truncated). - shimmer.wrapMethod(proto, 'Response.prototype', 'end', function wrapResEnd(end) { - if (typeof end !== 'function') { - logger.debug('Response#end is not a function?') - return end - } - - return function wrappedResEnd() { - var txInfo = this && this[TRANSACTION_INFO_KEY] - if (!txInfo) { - return end.apply(this, arguments) - } - - // If an error happend, add it to the aggregator. - if (txInfo.error) { - if (!txInfo.errorHandled || urltils.isError(agent.config, this.statusCode)) { - agent.errors.add(txInfo.transaction, txInfo.error) - } - } - - // End all the segments leading up to and including this one. - for (var i = txInfo.segmentStack.length - 1; i >= 0; --i) { - txInfo.segmentStack[i].end() - } - var segment = tracer.getSegment() - if (segment) { - segment.end() - } - - // Freeze the name state to prevent further changes. - txInfo.transaction.nameState.freeze() - - return end.apply(this, arguments) - } - }) -} - -// CAT this wont be used unless CAT is enabled, see below where we actually do -// the shimmer stuff if you'd like to verify. -function wrapWriteHead(agent, writeHead) { - return function wrappedWriteHead() { - var transaction = agent.tracer.getTransaction() - if (!transaction) { - logger.trace('No transaction - not adding response CAT headers') - return writeHead.apply(this, arguments) - } - if (transaction.syntheticsHeader) { - this.setHeader(NEWRELIC_SYNTHETICS_HEADER, transaction.syntheticsHeader) - } - - if (!transaction.incomingCatId) { - logger.trace('No incoming CAT ID - not adding response CAT headers') - return writeHead.apply(this, arguments) - } - - if (!agent.config.trusted_account_ids) { - logger.trace( - 'No account IDs in config.trusted_account_ids - not adding response CAT headers' - ) - return writeHead.apply(this, arguments) - } - - var accountId = transaction.incomingCatId.split('#')[0] - accountId = parseInt(accountId, 10) - if (agent.config.trusted_account_ids.indexOf(accountId) === -1) { - logger.trace( - 'Request from untrusted account id: %s - not adding response CAT headers', - accountId - ) - return writeHead.apply(this, arguments) - } - - // Not sure this could ever happen, but should guard against it anyway - // otherwise exception we blow up the user's app. - if (!agent.config.cross_process_id || !agent.config.encoding_key) { - logger.trace( - 'Managed to have %s but not cross_process_id (%s) or encoding_key (%s) - %s', - 'agent.config.trusted_account_ids', - agent.config.cross_process_id, - agent.config.encoding_key, - 'not adding response CAT headers' - ) - return writeHead.apply(this, arguments) - } - - // -1 means no content length header was sent. We should only send this - // value in the appData if the header is set. - var contentLength = -1 - var new_headers = arguments[arguments.length - 1] - - if (typeof new_headers === 'object') { - contentLength = headerProcessing.getContentLengthFromHeaders(new_headers) - } - - const currentHeaders = this.getHeaders() - if (contentLength === -1 && currentHeaders) { - contentLength = headerProcessing.getContentLengthFromHeaders(currentHeaders) - } - // Stored on the tx so we can push a metric with this time instead of - // actual duration. - transaction.catResponseTime = transaction.timer.getDurationInMillis() - - var appData = null - var txName = transaction.getFullName() || '' - - try { - appData = JSON.stringify([ - agent.config.cross_process_id, // cross_process_id - txName, // transaction name - transaction.queueTime / 1000, // queue time (s) - transaction.catResponseTime / 1000, // response time (s) - contentLength, // content length (if content-length header is also being sent) - transaction.id, // TransactionGuid - false // force a transaction trace to be recorded - ]) - } catch (err) { - logger.trace( - err, - 'Failed to serialize transaction: %s - not adding CAT response headers', - txName - ) - return writeHead.apply(this, arguments) - } - - var encKey = agent.config.encoding_key - var obfAppData = hashes.obfuscateNameUsingKey(appData, encKey) - this.setHeader(NEWRELIC_APP_DATA_HEADER, obfAppData) - logger.trace('Added outbound response CAT headers in transaction %s', transaction.id) - - return writeHead.apply(this, arguments) - } -} - -// Taken from the Node code base, internal/url.js -function urlToOptions(_url) { - const options = { - protocol: _url.protocol, - hostname: typeof _url.hostname === 'string' && _url.hostname.startsWith('[') ? - _url.hostname.slice(1, -1) : - _url.hostname, - hash: _url.hash, - search: _url.search, - pathname: _url.pathname, - path: `${_url.pathname || ''}${_url.search || ''}`, - href: _url.href - } - if (_url.port !== '') { - options.port = Number(_url.port) - } - if (_url.username || _url.password) { - options.auth = `${_url.username}:${_url.password}` - } - return options -} - -function wrapRequest(agent, request) { - return function wrappedRequest(input, options, cb) { - // If the first argument is a URL, merge it into the options object. - // This code is copied from Node internals. - if (typeof input === 'string') { - const urlStr = input - input = urlToOptions(new URL(urlStr)) - } else if (input.constructor && input.constructor.name === 'URL') { - input = urlToOptions(input) - } else { - cb = options - options = input - input = null - } - - if (typeof options === 'function') { - cb = options - options = input || {} - } else { - options = Object.assign(input || {}, options) - } - - let reqArgs = [options, cb] - - - // Don't pollute metrics and calls with NR connections - const internalOnly = options && options[NR_CONNECTION_PROP] - if (internalOnly) { - delete options[NR_CONNECTION_PROP] - } - - // If this is not a request we're recording, exit early. - const transaction = agent.tracer.getTransaction() - if (!transaction || internalOnly) { - if (!internalOnly && logger.traceEnabled()) { - const logOpts = typeof options === 'string' ? url.parse(options) : options - logger.trace( - 'No transaction, not recording external to %s:%s', - logOpts.hostname || logOpts.host, - logOpts.port - ) - } - return request.apply(this, reqArgs) - } - - const args = agent.tracer.slice(reqArgs) - const context = this - - return instrumentOutbound(agent, options, function makeRequest(opts) { - args[0] = opts - return request.apply(context, args) - }) - } -} - -module.exports = function initialize(agent, http, moduleName) { - if (!http) { - logger.debug('Did not get http module, not instrumenting!') - return false - } - - const IS_HTTPS = moduleName === 'https' - - // FIXME: will this ever not be called? - shimmer.wrapMethod(http, 'http', 'createServer', function cb_wrapMethod(createServer) { - return function setDispatcher(requestListener) { // eslint-disable-line no-unused-vars - agent.environment.setDispatcher('http') - return createServer.apply(this, arguments) - } - }) - - // It's not a great idea to monkeypatch EventEmitter methods given how hot - // they are, but this method is simple and works with all versions of node - // supported by the module. - shimmer.wrapMethod( - http.Server && http.Server.prototype, - 'http.Server.prototype', - 'emit', - function wrapEmit(emit) { - var txStarter = wrapEmitWithTransaction(agent, emit, IS_HTTPS) - return function wrappedEmit(evnt) { - if (evnt === 'request') { - return txStarter.apply(this, arguments) - } - return emit.apply(this, arguments) - } - } - ) - - wrapResponseEnd(agent, http.ServerResponse && http.ServerResponse.prototype) - - - // If CAT is enabled we'll wrap `writeHead` to inject our headers. - if (agent.config.cross_application_tracer.enabled) { - shimmer.wrapMethod( - http.ServerResponse && http.ServerResponse.prototype, - 'http.ServerResponse.prototype', - 'writeHead', - wrapWriteHead.bind(null, agent) - ) - } - - var agentProto = http && http.Agent && http.Agent.prototype - - shimmer.wrapMethod( - http, - 'http', - 'request', - wrapRequest.bind(null, agent) - ) - - shimmer.wrapMethod( - http, - 'http', - 'get', - wrapRequest.bind(null, agent) - ) - - shimmer.wrapMethod( - agentProto, - 'http.Agent.prototype', - 'createConnection', - function wrapCreateConnection(original) { - return function wrappedCreateConnection() { - if (!agent.getTransaction()) { - return original.apply(this, arguments) - } - - var segment = agent.tracer.createSegment('http.Agent#createConnection') - - var args = agent.tracer.slice(arguments) - if (typeof args[1] === 'function') { - args[1] = agent.tracer.bindFunction(args[1], segment, true) - } - - var sock = agent.tracer.bindFunction(original, segment, true).apply(this, args) - return sock - } - } - ) -} - -/** - * Take the X-NewRelic-Synthetics header and apply any appropriate data to the - * transaction for later use. This is the gate keeper for attributes being - * added onto the transaction object for synthetics. - * - * @param {string} header - The raw X-NewRelic-Synthetics header - * @param {string} encKey - Encoding key handed down from the server - * @param {Array.} trustedIds - Array of accounts to trust the header from. - * @param {Transaction} transaction - Where the synthetics data is attached to. - */ -function handleSyntheticsHeader(header, encKey, trustedIds, transaction) { - var synthData = parseSyntheticsHeader(header, encKey, trustedIds) - if (!synthData) { - return - } - - transaction.syntheticsData = synthData - transaction.syntheticsHeader = header -} - -/** - * Parse out and verify the the pieces of the X-NewRelic-Synthetics header. - * - * @param {string} header - The raw X-NewRelic-Synthetics header - * @param {string} encKey - Encoding key handed down from the server - * @param {Array.} trustedIds - Array of accounts to trust the header from. - * @return {Object|null} - On successful parse and verification an object of - * synthetics data is returned, otherwise null is - * returned. - */ -function parseSyntheticsHeader(header, encKey, trustedIds) { - // Eagerly declare this object because we know what it should look like and - // can use that for header verification. - var parsedData = { - version: null, - accountId: null, - resourceId: null, - jobId: null, - monitorId: null - } - var synthData = null - try { - synthData = JSON.parse( - hashes.deobfuscateNameUsingKey(header, encKey) - ) - } catch (e) { - logger.trace(e, 'Got unparsable synthetics header: %s', header) - return - } - - if (!util.isArray(synthData)) { - logger.trace( - 'Synthetics data is not an array: %s (%s)', - synthData, - typeof synthData - ) - return - } - - - if (synthData.length < Object.keys(parsedData).length) { - logger.trace( - 'Synthetics header length is %s, expected at least %s', - synthData.length, - Object.keys(parsedData).length - ) - } - - parsedData.version = synthData[0] - if (parsedData.version !== 1) { - logger.trace( - 'Synthetics header version is not 1, got: %s (%s)', - parsedData.version, - synthData - ) - return - } - - parsedData.accountId = synthData[1] - if (parsedData.accountId) { - if (trustedIds.indexOf(parsedData.accountId) === -1) { - logger.trace( - 'Synthetics header account ID is not in trusted account IDs: %s (%s)', - parsedData.accountId, - trustedIds - ) - return - } - } else { - logger.trace('Synthetics header account ID missing.') - return - } - - parsedData.resourceId = synthData[2] - if (!parsedData.resourceId) { - logger.trace('Synthetics resource ID is missing.') - return - } - - parsedData.jobId = synthData[3] - if (!parsedData.jobId) { - logger.trace('Synthetics job ID is missing.') - } - - parsedData.monitorId = synthData[4] - if (!parsedData.monitorId) { - logger.trace('Synthetics monitor ID is missing.') - } - - return parsedData -} diff --git a/node_modules/newrelic/lib/instrumentation/core/inspector.js b/node_modules/newrelic/lib/instrumentation/core/inspector.js deleted file mode 100644 index 2f6c03c4..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/inspector.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = initialize - -function initialize(agent, inspector, name, shim) { - var sessionProto = inspector && inspector.Session && inspector.Session.prototype - if (!sessionProto) { - return false - } - - shim.wrap( - sessionProto, - 'post', - function wrapPost(shim, fn) { - return function wrappedPost() { - var args = shim.argsToArray.apply(shim, arguments) - shim.bindCallbackSegment(args, shim.LAST) - return fn.apply(this, args) - } - } - ) -} diff --git a/node_modules/newrelic/lib/instrumentation/core/net.js b/node_modules/newrelic/lib/instrumentation/core/net.js deleted file mode 100644 index 5e244507..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/net.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function initialize(agent, net, moduleName, shim) { - shim.wrap(net, ['connect', 'createConnection'], wrapCreate) - function wrapCreate(shim, fn, name) { - return function wrappedCreateConnection() { - const segment = shim.getActiveSegment() - if (!segment) { - return fn.apply(this, arguments) - } - - const child = shim.createSegment('net.' + name, null, segment) - const sock = shim.applySegment(fn, child, true, this, arguments) - wrapSocket(sock, child) - return sock - } - } - - const serverProto = net.Server.prototype - - shim.wrap(serverProto, ['listen', 'close'], function wrapNoRecord(shim, fn) { - return function wrappedNoRecord() { - if (!shim.getActiveSegment()) { - return fn.apply(this, arguments) - } - - const args = shim.argsToArray.apply(shim, arguments) - const cbIndex = args.length - 1 - - shim.bindSegment(args, cbIndex) - - return fn.apply(this, args) - } - }) - - shim.wrap(serverProto, '_listen2', wrapListen2) - shim.wrap(net.Socket.prototype, 'connect', wrapConnect) - - function wrapListen2(shim, fn) { - return function wrappedListen2() { - const segment = shim.getActiveSegment() - const emit = this.emit - - if (!segment || !emit) return fn.apply(this, arguments) - - this.emit = wrappedEmit - - return fn.apply(this, arguments) - - function wrappedEmit(ev, socket) { - if (ev !== 'connection' || !socket || !socket._handle) { - return emit.apply(this, arguments) - } - - const child = shim.createSegment('net.Server.onconnection', segment) - - if (socket._handle.onread) { - shim.bindSegment(socket._handle, 'onread', child) - } - - return shim.applySegment(emit, child, true, this, arguments) - } - } - } - - function wrapConnect(shim, fn) { - return function connectWrapper() { - if (!agent.getTransaction()) { - return fn.apply(this, arguments) - } - - const socket = this - const args = normalizeConnectArgs(arguments) - - const segment = shim.createSegment('net.Socket.connect') - - if (args[1]) { - args[1] = shim.bindSegment(args[1], segment) - } - - const result = shim.applySegment(fn, segment, true, this, args) - - if (socket._handle) { - shim.bindSegment(socket._handle, 'onread', segment) - } - shim.bindSegment(socket, 'emit', segment) - - return result - } - } - - function wrapSocket(sock, segment) { - shim.wrap(sock, 'emit', function emitWrapper(shim, fn) { - return shim.bindSegment(fn, segment) - }) - } -} - -// taken from node master on 2013/10/30 -function normalizeConnectArgs(args) { - let options = Object.create(null) - - function toNumber(x) { - return (x = Number(x)) >= 0 ? x : false - } - if (typeof args[0] === 'object' && args[0] !== null) { - // connect(options, [cb]) - options = args[0] - } else if (typeof args[0] === 'string' && toNumber(args[0]) === false) { - // connect(path, [cb]); - options.path = args[0] - } else { - // connect(port, [host], [cb]) - options.port = args[0] - if (typeof args[1] === 'string') { - options.host = args[1] - } - } - - const cb = args[args.length - 1] - return typeof cb === 'function' ? [options, cb] : [options] -} diff --git a/node_modules/newrelic/lib/instrumentation/core/timers.js b/node_modules/newrelic/lib/instrumentation/core/timers.js deleted file mode 100644 index c9834df2..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/timers.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = initialize - -function initialize(agent, timers, moduleName, shim) { - const processMethods = ['nextTick', '_nextDomainTick', '_tickDomainCallback'] - - shim.wrap( - process, - processMethods, - function wrapProcess(shim, fn) { - return function wrappedProcess() { - const segment = shim.getActiveSegment() - if (!segment) { - return fn.apply(this, arguments) - } - - // Manual copy because helper methods add significant overhead in some usages - var len = arguments.length - var args = new Array(len) - for (var i = 0; i < len; ++i) { - args[i] = arguments[i] - } - - shim.bindSegment(args, shim.FIRST, segment) - - return fn.apply(this, args) - } - } - ) - - instrumentTimerMethods(timers) - - // If we need to instrument separate references to timers on the global object, - // do that now. - if (!shim.isWrapped(global.setTimeout)) { - instrumentTimerMethods(global) - } - - function instrumentTimerMethods(nodule) { - const asynchronizers = [ - 'setTimeout', - 'setInterval' - ] - - shim.record(nodule, asynchronizers, recordAsynchronizers) - - // We don't want to create segments for setImmediate calls, as the - // object allocation may incur too much overhead in some situations - shim.wrap(nodule, 'setImmediate', wrapSetImmediate) - - shim.wrap(nodule, 'clearTimeout', wrapClearTimeout) - - makeWrappedPromisifyCompatible(shim, nodule) - } - - function wrapSetImmediate(shim, fn) { - return function wrappedSetImmediate() { - const args = shim.argsToArray.apply(shim, arguments) - shim.bindSegment(args, shim.FIRST) - - return fn.apply(this, args) - } - } - - function wrapClearTimeout(shim, fn) { - return function wrappedClearTimeout(timer) { - if (timer && timer._onTimeout) { - const segment = timer._onTimeout.__NR_segment - if (segment) { - segment.ignore = true - } - } - - return fn.apply(this, arguments) - } - } - - function recordAsynchronizers(shim, fn, name) { - return {name: 'timers.' + name, callback: shim.FIRST} - } -} - -function makeWrappedPromisifyCompatible(shim, timers) { - const originalSetTimout = shim.getOriginal(timers.setTimeout) - Object.getOwnPropertySymbols(originalSetTimout).forEach((symbol) => { - timers.setTimeout[symbol] = originalSetTimout[symbol] - }) - - const originalSetInterval = shim.getOriginal(timers.setInterval) - Object.getOwnPropertySymbols(originalSetInterval).forEach((symbol) => { - timers.setInterval[symbol] = originalSetInterval[symbol] - }) - - const originalSetImmediate = shim.getOriginal(timers.setImmediate) - Object.getOwnPropertySymbols(originalSetImmediate).forEach((symbol) => { - timers.setImmediate[symbol] = originalSetImmediate[symbol] - }) -} diff --git a/node_modules/newrelic/lib/instrumentation/core/zlib.js b/node_modules/newrelic/lib/instrumentation/core/zlib.js deleted file mode 100644 index 4bad281f..00000000 --- a/node_modules/newrelic/lib/instrumentation/core/zlib.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const recorder = require('../../metrics/recorders/generic') - -module.exports = initialize - -var methods = [ - 'deflate', - 'deflateRaw', - 'gzip', - 'gunzip', - 'inflate', - 'inflateRaw', - 'unzip' -] - -function initialize(agent, zlib, moduleName, shim) { - shim.record(zlib, methods, recordZLib) - - if (zlib.Deflate && zlib.Deflate.prototype) { - var proto = Object.getPrototypeOf(zlib.Deflate.prototype) - if (proto._transform) { - // streams2 - shim.wrap(proto, '_transform', wrapNoSegment) - } else if (proto.write && proto.flush && proto.end) { - // plain ol' streams - shim.wrap(proto, ['write', 'flush', 'end'], wrapNoSegment) - } - } - - function recordZLib(shim, fn, name) { - return {name: `zlib.${name}`, callback: shim.LAST, recorder} - } -} - -function wrapNoSegment(shim, fn) { - return function wrappedZLibNoSegment() { - if (!shim.getActiveSegment()) { - return fn.apply(this, arguments) - } - - const args = shim.argsToArray.apply(shim, arguments) - const cbIndex = args.length - 1 - - shim.bindSegment(args, cbIndex) - - return fn.apply(this, args) - } -} diff --git a/node_modules/newrelic/lib/instrumentation/director.js b/node_modules/newrelic/lib/instrumentation/director.js deleted file mode 100644 index 276776e8..00000000 --- a/node_modules/newrelic/lib/instrumentation/director.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function initialize(agent, director, moduleName, shim) { - shim.setFramework(shim.DIRECTOR) - - shim.setRouteParser(function routeParser(shim, fn, fnName, route) { - return route instanceof Array ? route.join('/') : route - }) - - var methods = ['on', 'route'] - var proto = director.Router.prototype - shim.wrapMiddlewareMounter(proto, methods, { - route: shim.SECOND, - wrapper: function wrapMiddleware(shim, middleware, name, path) { - return shim.recordMiddleware(middleware, { - route: path, - req: function getReq() { - return this.req - }, - params: function getParams() { - return this.params - }, - next: shim.LAST - }) - } - }) - - shim.wrap(proto, 'mount', function wrapMount(shim, mount) { - return function wrappedMount(routes, path) { - var isAsync = this.async - shim.wrap(routes, director.http.methods, function wrapRoute(shim, route) { - return shim.recordMiddleware(route, { - route: path.join('/'), - req: function getReq() { - return this.req - }, - params: function getParams() { - return this.params - }, - next: isAsync ? shim.LAST : null - }) - }) - var args = [routes, path] - return mount.apply(this, args) - } - }) -} diff --git a/node_modules/newrelic/lib/instrumentation/express.js b/node_modules/newrelic/lib/instrumentation/express.js deleted file mode 100644 index 3d1f069c..00000000 --- a/node_modules/newrelic/lib/instrumentation/express.js +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/** - * Express middleware generates traces where middleware are considered siblings - * (ended on 'next' invocation) and not nested. Middlware are nested below the - * routers they are mounted to. - */ - -module.exports = function initialize(agent, express, moduleName, shim) { - if (!express || !express.Router) { - shim.logger.debug('Could not find Express Router, not instrumenting.') - return false - } - shim.setFramework(shim.EXPRESS) - - shim.setErrorPredicate(function expressErrorPredicate(err) { - return err !== 'route' && err !== 'router' - }) - - if (express.Router.use) { - wrapExpress4(shim, express) - } else { - wrapExpress3(shim, express) - } -} - -function wrapExpress4(shim, express) { - // Wrap `use` and `route` which are hung off `Router` directly, not on a - // prototype. - shim.wrapMiddlewareMounter(express.Router, 'use', { - route: shim.FIRST, - wrapper: wrapMiddleware - }) - - shim.wrapMiddlewareMounter(express.application, 'use', { - route: shim.FIRST, - wrapper: wrapMiddleware - }) - - shim.wrap(express.Router, 'route', function wrapRoute(shim, fn) { - if (!shim.isFunction(fn)) { - return fn - } - - return function wrappedRoute() { - var route = fn.apply(this, arguments) - - // Express should create a new route and layer every time Router#route is - // called, but just to be on the safe side, make sure we haven't wrapped - // this already. - if (!shim.isWrapped(route, 'get')) { - wrapRouteMethods(shim, route, '') - - var layer = this.stack[this.stack.length - 1] - - // This wraps a 'done' function but not a traditional 'next' function. This allows - // the route to stay on the stack for middleware nesting after the router. - // The segment will be automatically ended by the http/https instrumentation. - shim.recordMiddleware(layer, 'handle', { - type: shim.ROUTE, - req: shim.FIRST, - next: shim.LAST, - matchArity: true, - route: route.path - }) - } - return route - } - }) - - shim.wrapMiddlewareMounter(express.Router, 'param', { - route: shim.FIRST, - wrapper: function wrapParamware(shim, middleware, fnName, route) { - return shim.recordParamware(middleware, { - name: route, - req: shim.FIRST, - next: shim.THIRD - }) - } - }) - - wrapResponse(shim, express.response) -} - -function wrapExpress3(shim, express) { - // In Express 3 the app returned from `express()` is actually a `connect` app - // which we have no access to before creation. We can not easily wrap the app - // because there are a lot of methods dangling on it that act on the app itself. - // Really we just care about apps being used as `request` event listeners on - // `http.Server` instances so we'll wrap that instead. - - shim.wrapMiddlewareMounter(express.Router.prototype, 'param', { - route: shim.FIRST, - wrapper: function wrapParamware(shim, middleware, fnName, route) { - return shim.recordParamware(middleware, { - name: route, - req: shim.FIRST, - next: shim.THIRD - }) - } - }) - shim.wrapMiddlewareMounter(express.Router.prototype, 'use', { - route: shim.FIRST, - wrapper: wrapMiddleware - }) - shim.wrapMiddlewareMounter(express.application, 'use', { - route: shim.FIRST, - wrapper: wrapMiddleware - }) - - // NOTE: Do not wrap application route methods in Express 3, they all just - // forward their arguments to the router. - wrapRouteMethods(shim, express.Router.prototype, shim.FIRST) - wrapResponse(shim, express.response) -} - -function wrapRouteMethods(shim, route, path) { - var methods = ['all', 'delete', 'get', 'head', 'opts', 'post', 'put', 'patch'] - shim.wrapMiddlewareMounter(route, methods, {route: path, wrapper: wrapMiddleware}) -} - -function wrapResponse(shim, response) { - shim.recordRender(response, 'render', { - view: shim.FIRST, - callback: function bindCallback(shim, render, name, segment, args) { - var cbIdx = shim.normalizeIndex(args.length, shim.LAST) - if (cbIdx === null) { - return - } - - var res = this - var cb = args[cbIdx] - if (!shim.isFunction(cb)) { - ++cbIdx - cb = function defaultRenderCB(err, str) { - // https://github.com/expressjs/express/blob/4.x/lib/response.js#L961-L962 - if (err) return res.req.next(err) - res.send(str) - } - args.push(cb) - } - args[cbIdx] = shim.bindSegment(cb, segment, true) - } - }) -} - -function wrapMiddleware(shim, middleware, name, route) { - var method = null - var spec = { - route: route, - type: shim.MIDDLEWARE, - matchArity: true, - req: shim.FIRST - } - - if (middleware.lazyrouter) { - method = 'handle' - spec.type = shim.APPLICATION - } else if (middleware.stack) { - method = 'handle' - spec.type = shim.ROUTER - } else if (middleware.length === 4) { - spec.type = shim.ERRORWARE - spec.req = shim.SECOND - } - - // Express apps just pass their middleware through to their router. We do not - // want to count the same middleware twice, so we check if it has already been - // wrapped. Express also wraps apps mounted on apps, so we need to check if - // this middleware is that app wrapper. - // - // NOTE: Express did not name its app wrapper until 4.6.0. - if (shim.isWrapped(middleware, method) || name === 'mounted_app') { - // Don't double-wrap middleware - return middleware - } - - return shim.recordMiddleware(middleware, method, spec) -} diff --git a/node_modules/newrelic/lib/instrumentation/fastify.js b/node_modules/newrelic/lib/instrumentation/fastify.js deleted file mode 100644 index eaf41310..00000000 --- a/node_modules/newrelic/lib/instrumentation/fastify.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict' -const { - buildMiddlewareSpecForRouteHandler, - buildMiddlewareSpecForMiddlewareFunction -} = require ('./fastify/spec-builders') -/** - * Sets up fastify route handler - * - * Fastify's onRoute hook will fire whenever - * a route is registered. This is the most straight - * forward way to get at a fastify route definition. - * Not only are we _not_ relying on private implementations - * that could change, fastify is pretty good about protecting - * those private implementations from access, and getting - * at them would require a lot of gymnastics and hard to - * maintain code - */ -const setupRouteHandler = (shim, fastify) => { - fastify.addHook('onRoute', (routeOptions)=>{ - if (!routeOptions.handler) { - return - } - /** - * recordMiddlware handler call - * - * The WebFramework shim treats the main route handler like any other - * i.e. dont be confused by the call to recordMiddlware -- we don't - * have a recordRouteHandler, everything goes through recordMiddleware - */ - const newRouteHandler = shim.recordMiddleware( - routeOptions.handler, - buildMiddlewareSpecForRouteHandler(shim, routeOptions.path) - ) - - routeOptions.handler = newRouteHandler - }) -} - -const setupMiddlewareHandlers = (shim, fastify) => { - shim.wrap(fastify, 'use', function wrapFastifyUse(shim, fn) { - return function wrappedFastifyUser() { - const args = shim.argsToArray.apply(shim, arguments) - const middlewareFunction = args[0] - const newMiddlewareFunction = shim.recordMiddleware( - middlewareFunction, - buildMiddlewareSpecForMiddlewareFunction(shim) - ) - // replace original function with our function - args[0] = newMiddlewareFunction - // console.log(middlewareFunction.__NR_original) - return fn.apply(this, args) - } - }) -} - -module.exports = function initialize(agent, fastify, moduleName, shim) { - if (!agent.config.feature_flag.fastify_instrumentation) { - return - } - shim.setFramework(shim.FASTIFY) - /** - * Fastify exports a function, so we need to use wrapExport - */ - shim.wrapExport(fastify, function wrapFastifyModule(shim, fn) { - return function wrappedFastifyModule() { - // normalize arguments - const args = shim.argsToArray.apply(shim, arguments) - - // call original function get get fastify object (which is singleton-ish) - const fastifyForWrapping = fn.apply(this, args) - - setupRouteHandler(shim, fastifyForWrapping) - - setupMiddlewareHandlers(shim, fastifyForWrapping) - - return fastifyForWrapping - } - }) -} diff --git a/node_modules/newrelic/lib/instrumentation/fastify/spec-builders.js b/node_modules/newrelic/lib/instrumentation/fastify/spec-builders.js deleted file mode 100644 index 42a627e2..00000000 --- a/node_modules/newrelic/lib/instrumentation/fastify/spec-builders.js +++ /dev/null @@ -1,106 +0,0 @@ -'use strict' - -const getRawRequestFromFastifyRequest = (shim, fn, fnName, args) => { - const request = args[0] - if (request && request.raw) { - return request.raw - } -} - -const getParamsFromFastifyRequest = (shim, fn, fnName, args) => { - const req = args[0] - return req && req.params -} - -/** - * Builds the recordMiddleware Spec for the route handler - * - * A spec is basically a specification -- or a list - * of insrtuctions to the recordMiddleware function - * that provide it with the information it needs to - * do its job. You could also think of it as a - * mini-DSL - */ -function buildMiddlewareSpecForRouteHandler(shim, path) { - return { - /** - * The path to use for transaction naming - */ - route: path, - - /** - * A function the returns the NodeJS Request Object - * - * The job of the `req` callback is to return the current NodeJS - * IncomingMessage object for this particular handler. Most NodeJS - * frameworks will pass the request to each handler -- sometimes (as - * is the case here) wrapped by another object. - * - * @param {any} shim the Webframework Shim - * @param {any} fn the handler function passed to buildMiddlewareSpec - * @param {any} fnName the handler function's name - * @param {any} args the arguments passed to the handler function - */ - req: getRawRequestFromFastifyRequest, - /** - * A function where we can wrap next, reply send, etc. methods - * - * This one is tricky. The `next` function will, same as - * the `req` function above, receives the fn, fnName, - * and args from the handler function. It _also_ receives - * a `wrap` function. This wrap function will allow us to - * to bind a segment for any next function/method, or any - * method that would finish the request handling (i.e. - * `reply`, `respond`, etc.) - * - * This is far more useful when instrumenting actual middleware vs. - * instrumenting a simple route handler. However, if the route - * handling API uses a method call for responding (vs. returning a value) - * then this method is required/useful again. - * - * The isFinal param determines whether or not a path is appended for - * this particuar piece of middleware. (i.e. if this is the final handler - * that is actually handling the request, the path is actually left on) - */ - next: function wrapNext(shim, fn, fnName, args, bindSegment) { - const reply = args[1] - if (!shim.isFunction(reply)) { - return - } - const isFinal = true - bindSegment(reply, 'send', isFinal) - }, - - /** - * A function that returns the request paramates - * - * @param {any} shim the Webframework Shim - * @param {any} fn the handler function passed to buildMiddlewareSpec - * @param {any} fnName the handler function's name - * @param {any} args the arguments passed to the handler function - */ - params: getParamsFromFastifyRequest - } -} - -function buildMiddlewareSpecForMiddlewareFunction() { - return { - req: getRawRequestFromFastifyRequest, - - next: function wrapNext(shim, fn, fnName, args, bindSegment) { - const next = args[2] - if (!shim.isFunction(next)) { - return - } - const isFinal = false - bindSegment(next, null, isFinal) - }, - - params: getParamsFromFastifyRequest - } -} - -module.exports = { - buildMiddlewareSpecForRouteHandler, - buildMiddlewareSpecForMiddlewareFunction -} diff --git a/node_modules/newrelic/lib/instrumentation/generic-pool.js b/node_modules/newrelic/lib/instrumentation/generic-pool.js deleted file mode 100644 index 4f26a220..00000000 --- a/node_modules/newrelic/lib/instrumentation/generic-pool.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function initialize(agent, generic, moduleName, shim) { - if (!generic || !generic.Pool || !generic.Pool.prototype) { - return false - } - - var proto = generic.Pool.prototype - shim.wrap(proto, 'acquire', function wrapAcquire(shim, acquire) { - if (!shim.isFunction(acquire)) { - return acquire - } - - return function wrappedAcquire(callback, priority) { - return acquire.call(this, shim.bindSegment(callback), priority) - } - }) - - shim.wrap(proto, ['drain', 'destroyAllNow'], function wrap(shim, original) { - if (!shim.isFunction(original)) { - return original - } - - return function wrappedMethod(cb) { - return original.call(this, shim.bindSegment(cb)) - } - }) -} diff --git a/node_modules/newrelic/lib/instrumentation/hapi.js b/node_modules/newrelic/lib/instrumentation/hapi.js deleted file mode 100644 index f21c8d8b..00000000 --- a/node_modules/newrelic/lib/instrumentation/hapi.js +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var shared = require('./hapi/shared') - - -module.exports = function initialize(agent, hapi, moduleName, shim) { - if (!agent || !hapi || !shim) { - shim && shim.logger.debug( - 'Hapi instrumentation function called with incorrect arguments, not instrumenting.' - ) - return false - } - - shim.setFramework(shim.HAPI) - - shim.setErrorPredicate(function hapiErrorPredicate(err) { - return (err instanceof Error) - }) - - if (hapi.createServer) { - wrapCreateServer(shim, hapi) - } else if (hapi.Server) { - // Server.connection was removed in v17 - if (!hapi.Server.prototype.connection) { - return require('./hapi/hapi-17')(agent, hapi, moduleName, shim) - } - - // See if we can find the plugin class. This should be the super class of - // Server and will cover more scenarios. - var Plugin = hapi.Server.super_ - if (_isPluginClass(Plugin)) { - wrapServer(shim, Plugin) - } else { - wrapServer(shim, hapi.Server) - } - } -} - -function wrapServer(shim, Server) { - // wrap server.handler function that registers a new handler type - // the second argument is expected to be a function that generates the handler function - shim.wrap(Server.prototype, 'handler', function wrapHandler(shim, original) { - return function wrappedHandler() { - var args = shim.argsToArray.apply(shim, arguments) - - var handlerGenerator = args[1] - if (typeof handlerGenerator === 'function') { - args[1] = wrapGenerator(handlerGenerator) - } - - return original.apply(this, args) - - function wrapGenerator(generator) { - function wrappedGenerator() { - var generatorArgs = shim.argsToArray.apply(shim, arguments) - var handler = generator.apply(this, generatorArgs) - if (typeof handler === 'function') { - var route = generatorArgs[0] - return wrapRouteHandler(shim, handler, route && route.path) - } - return handler - } - - wrappedGenerator.defaults = generator.defaults - - return wrappedGenerator - } - } - }) - - shim.wrap(Server.prototype, 'route', function wrapRoute(shim, original) { - return function wrappedRoute() { - var args = shim.argsToArray.apply(shim, arguments) - - // first argument is expected to be the route configuration object - if (!shim.isObject(args[0])) { - return original.apply(this, args) - } - - // If route is created via a plugin, pull prefix if it exists - const prefix = this.realm - && this.realm.modifiers - && this.realm.modifiers.route - && this.realm.modifiers.route.prefix - || '' - - _wrapRoute(shim, args[0]) - - return original.apply(this, args) - - function _wrapRoute(shim, route) { - const routePath = prefix + route.path - // handler function could be on the route object, or on a nested config object - if (shim.isArray(route)) { - for (var i = 0; i < route.length; ++i) { - _wrapRoute(shim, route[i]) - } - return - } else if (route.config) { - if (route.config.pre) { - // config objects can also contain multiple OTHER handlers in a `pre` array - route.config.pre = wrapPreHandlers(shim, route.config.pre, routePath) - } - if (route.config.handler) { - wrapRouteHandler(shim, route.config, routePath) - return - } - } - wrapRouteHandler(shim, route, routePath) - } - } - }) - - shim.wrap(Server.prototype, 'ext', function wrapExt(shim, original) { - return function wrappedExt(event, method) { - var args = shim.argsToArray.apply(shim, arguments) - - if (shim.isArray(event)) { - for (var i = 0; i < event.length; i++) { - event[i].method = wrapMiddleware(shim, event[i].method, event[i].type) - } - } else if (shim.isObject(event)) { - event.method = wrapMiddleware(shim, event.method, event.type) - } else if (shim.isString(event)) { - args[1] = wrapMiddleware(shim, method, event) - } else { - shim.logger.debug('Unsupported event type %j', event) - return - } - - return original.apply(this, args) - } - }) -} - -function wrapCreateServer(shim, hapi) { - shim.wrap(hapi, 'createServer', function getWrapper(shim, createServer) { - return function createServerWrapper() { - var server = createServer.apply(this, arguments) - wrapServer(shim, server.constructor) - shim.unwrap(hapi, 'createServer') - return server - } - }) -} - -function wrapPreHandlers(shim, container, path) { - if (shim.isArray(container)) { - for (var i = 0; i < container.length; ++i) { - container[i] = wrapPreHandlers(shim, container[i], path) - } - return container - } else if (shim.isFunction(container)) { - return _wrapPreHandler(container) - } else if (container.method && shim.isFunction(container.method)) { - return shim.wrap(container, 'method', function wrapHandler(shim, handler) { - return _wrapPreHandler(handler) - }) - } - // The 'pre' option also allows strings pointing to methods registered via - // server.method() (ie: 'methodName(args)'). For the most part, these should - // be simple utility functions, but may be something we want to wrap in the future. - return container - - function _wrapPreHandler(handler) { - return shim.recordMiddleware( - wrapHapiHandler(shim, handler), - buildMiddlewareSpec(shim, path, true) - ) - } -} - -function wrapRouteHandler(shim, container, path) { - if (shim.isFunction(container)) { - return _wrapRouteHandler(container) - } else if (container.handler && shim.isFunction(container.handler)) { - return shim.wrap(container, 'handler', function wrapHandler(shim, handler) { - return _wrapRouteHandler(handler) - }) - } - - function _wrapRouteHandler(handler) { - return shim.recordMiddleware( - wrapHapiHandler(shim, handler), - buildMiddlewareSpec(shim, path) - ) - } -} - -function buildMiddlewareSpec(shim, path, isPreHandler) { - return { - route: path, - req: function getReq(shim, fn, fnName, args) { - var request = args[0] - if (request && request.raw) { - return request.raw.req - } - }, - next: function wrapNext(shim, fn, fnName, args, wrap) { - var reply = args[1] - if (!shim.isFunction(reply)) { - return - } - wrapReply(wrap, reply, isPreHandler) - }, - params: function getParams(shim, fn, fnName, args) { - var req = args[0] - return req && req.params - } - } -} - -function wrapHapiHandler(shim, handler) { - return shim.wrap(handler, function wrapHandler(shim, original) { - return function wrapped() { - var reply = arguments[1] - if (reply) { - shim.recordRender(reply, 'view') - } - return original.apply(this, arguments) - } - }) -} - -function wrapMiddleware(shim, middleware, event) { - if (!shared.ROUTE_EVENTS[event]) { - return middleware - } - - var spec = { - route: event, - type: event === 'onPreResponse' ? shim.ERRORWARE : shim.MIDDLEWARE, - next: function wrapNext(shim, fn, fnName, args, wrap) { - var reply = args[1] - if (!reply || !shim.isFunction(reply.continue)) return - wrap(reply, 'continue') - }, - req: function getReq(shim, fn, fnName, args) { - var request = args[0] - if (request && request.raw) { - return request.raw.req - } - } - } - - return shim.recordMiddleware(middleware, spec) -} - -function _isPluginClass(Plugin) { - if (typeof Plugin !== 'function' || !Plugin.prototype) { - return false - } - - var proto = Plugin.prototype - return ( - typeof proto.handler === 'function' && - typeof proto.route === 'function' && - typeof proto.ext === 'function' - ) -} - -function wrapReply(wrap, reply, isPreHandler) { - var isFinal = !isPreHandler - // The only reply method that is actually used by pre-handlers is `response`. All - // other methods still exist, but don't function as they do in normal route handlers. - // Since they can still be referenced by users, they still need to be wrapped. - wrap(reply, 'continue', isFinal) - wrap(reply, 'redirect', isFinal) - wrap(reply, 'close', isFinal) - wrap(reply, 'response', isFinal) -} diff --git a/node_modules/newrelic/lib/instrumentation/hapi/hapi-17.js b/node_modules/newrelic/lib/instrumentation/hapi/hapi-17.js deleted file mode 100644 index 43958d35..00000000 --- a/node_modules/newrelic/lib/instrumentation/hapi/hapi-17.js +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const shared = require('./shared') -const record = require('../../metrics/recorders/generic') - -// TODO: abstract and consolidate mostly-shared hapi functionality -module.exports = function initialize(agent, hapi, moduleName, shim) { - // At this point, framework and error predicate have both already been set via ./hapi, - // so we only need to set the response predicate and wrap the server object - shim.setResponsePredicate(function hapiResponsePredicate(args, result) { - return !(result instanceof Error) && (result !== args[1].continue) - }) - - // 'Server' and 'server' both point to the same export, - // but we can't make any assumption about which will be used. - // Since we wrap the prototype, the second wrap should exit early. - shim.wrapReturn(hapi, 'server', serverFactoryWrapper) - shim.wrapReturn(hapi, 'Server', serverFactoryWrapper) -} - -function serverFactoryWrapper(shim, fn, fnName, server) { - serverPostConstructor.call(server, shim) -} - -function serverPostConstructor(shim) { - var proto = Object.getPrototypeOf(this) - - if (shim.isWrapped(proto.decorate)) { - shim.logger.trace('Already wrapped Server proto, not wrapping again') - return - } - - shim.wrap(proto, 'decorate', function wrapDecorate(shim, original) { - return function wrappedDecorate(type) { - // server.decorate also accepts 'request', 'toolkit', 'server' types, - // but we're only concerned with 'handler' - if (type !== 'handler') { - return original.apply(this, arguments) - } - - // Convert arguments to usable array - var args = shim.argsToArray.apply(shim, arguments) - - // Wrap the third server.decorate arg, the user-defined handler - shim.wrap(args, shim.THIRD, function wrapHandler(shim, fn) { - if (typeof fn !== 'function') { - return - } - - if (fn.defaults) { - wrappedHandler.defaults = fn.defaults - } - - return wrappedHandler - - function wrappedHandler(route) { - var ret = fn.apply(this, arguments) - - return (typeof ret === 'function') - ? wrapRouteHandler(shim, ret, route && route.path) - : ret - } - }) - - return original.apply(this, args) - } - }) - - shim.wrap(proto, 'route', function wrapRoute(shim, original) { - return function wrappedRoute() { - var args = shim.argsToArray.apply(shim, arguments) - - if (!shim.isObject(args[0])) { - return original.apply(this, args) - } - - // If route is created via a plugin, pull prefix if it exists - const prefix = this.realm - && this.realm.modifiers - && this.realm.modifiers.route - && this.realm.modifiers.route.prefix - || '' - - _wrapRoute(shim, args[0]) - - return original.apply(this, args) - - function _wrapRoute(shim, route) { - const routePath = prefix + route.path - if (shim.isArray(route)) { - for (var i = 0; i < route.length; ++i) { - _wrapRoute(shim, route[i]) - } - return - } else if (route.options) { - // v17 now prefers `options` property... - if (route.options.pre) { - // config objects can also contain multiple OTHER handlers in a `pre` array - route.options.pre = wrapPreHandlers(shim, route.options.pre, routePath) - } - if (route.options.handler) { - _wrapRouteHandler(shim, route.options, routePath) - return - } - } else if (route.config) { - // ... but `config` still works - if (route.config.pre) { - route.config.pre = wrapPreHandlers(shim, route.config.pre, routePath) - } - if (route.config.handler) { - _wrapRouteHandler(shim, route.config, routePath) - return - } - } - _wrapRouteHandler(shim, route, routePath) - } - - function _wrapRouteHandler(shim, container, path) { - if (typeof container.handler !== 'function') { - return - } - shim.wrap(container, 'handler', function wrapHandler(shim, handler) { - return wrapRouteHandler(shim, handler, path) - }) - } - } - }) - - shim.wrap(proto, 'ext', function wrapExt(shim, original) { - return function wrappedExt(event, method) { - var args = shim.argsToArray.apply(shim, arguments) - - if (shim.isArray(event)) { - for (var i = 0; i < event.length; i++) { - event[i].method = wrapMiddleware(shim, event[i].method, event[i].type) - } - } else if (shim.isObject(event)) { - event.method = wrapMiddleware(shim, event.method, event.type) - } else if (shim.isString(event)) { - args[1] = wrapMiddleware(shim, method, event) - } else { - shim.logger.debug('Unsupported event type %j', event) - return - } - - return original.apply(this, args) - } - }) -} - -function wrapPreHandlers(shim, container, path) { - if (shim.isArray(container)) { - for (var i = 0; i < container.length; ++i) { - container[i] = wrapPreHandlers(shim, container[i], path) - } - return container - } else if (shim.isFunction(container)) { - return wrapPreHandler(shim, container, path) - } else if (container.method && shim.isFunction(container.method)) { - return shim.wrap(container, 'method', function wrapHandler(shim, handler) { - return wrapPreHandler(shim, handler, path) - }) - } -} - -function wrapPreHandler(shim, container, path) { - return shim.record(container, (shim) => { - return {name: [shim.HAPI, ' pre handler: ','(',path,')'].join(''), recorder: record} - }) -} - -function wrapRouteHandler(shim, handler, path) { - return shim.recordMiddleware(handler, { - route: path, - req: function getReq(shim, fn, fnName, args) { - var request = args[0] - if (request && request.raw) { - return request.raw.req - } - }, - promise: true, - params: function getParams(shim, fn, fnName, args) { - var req = args[0] - return req && req.params - } - }) -} - -function wrapMiddleware(shim, middleware, event) { - if (!shared.ROUTE_EVENTS[event]) { - return middleware - } - - return shim.recordMiddleware(middleware, { - route: event, - type: event === 'onPreResponse' ? shim.ERRORWARE : shim.MIDDLEWARE, - promise: true, - req: function getReq(shim, fn, fnName, args) { - var req = args[0] - return req && req.raw && req.raw.req - } - }) -} diff --git a/node_modules/newrelic/lib/instrumentation/hapi/shared.js b/node_modules/newrelic/lib/instrumentation/hapi/shared.js deleted file mode 100644 index 784b3e5b..00000000 --- a/node_modules/newrelic/lib/instrumentation/hapi/shared.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// This object defines all the events that we want to wrap extensions -// for, as they are the only ones associated with requests. -var ROUTE_EVENTS = { - onRequest: true, - onPreAuth: true, - onCredentials: true, - onPostAuth: true, - onPreHandler: true, - onPostHandler: true, - onPreResponse: true, - - // Server events - onPreStart: false, - onPostStart: false, - onPreStop: false, - onPostStop: false -} - -module.exports = { - ROUTE_EVENTS: ROUTE_EVENTS -} diff --git a/node_modules/newrelic/lib/instrumentation/ioredis.js b/node_modules/newrelic/lib/instrumentation/ioredis.js deleted file mode 100644 index 7079329d..00000000 --- a/node_modules/newrelic/lib/instrumentation/ioredis.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var stringify = require('json-stringify-safe') -var urltils = require('../util/urltils.js') - - -module.exports = function initialize(agent, redis, moduleName, shim) { - var proto = redis && redis.prototype - if (!proto) { - return false - } - - shim.setDatastore(shim.REDIS) - shim.recordOperation(proto, 'sendCommand', wrapSendCommand) - - function wrapSendCommand(shim, original, name, args) { - var command = args[0] - - // TODO: Instance attributes for ioredis - var parameters = { - host: this.connector.options.host, - port_path_or_id: this.connector.options.port - } - - var keys = command.args - if (keys && typeof keys !== 'function') { - var src = Object.create(null) - try { - src.key = stringify(keys[0]) - } catch (err) { - shim.logger.debug(err, 'Failed to stringify ioredis key') - src.key = '' - } - urltils.copyParameters(src, parameters) - } - - return { - name: (command.name || 'unknown'), - parameters: parameters, - promise: true - } - } -} diff --git a/node_modules/newrelic/lib/instrumentation/memcached.js b/node_modules/newrelic/lib/instrumentation/memcached.js deleted file mode 100644 index 6f338cab..00000000 --- a/node_modules/newrelic/lib/instrumentation/memcached.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var stringify = require('json-stringify-safe') - -function wrapKeys(metacall) { - if (metacall.key) { - return [metacall.key] - } else if (metacall.multi) { - return metacall.command.split(' ').slice(1) - } - - return [] -} - -/** - * Thanks to Hernan Silberman! - * - * instrument the memcached driver to intercept calls and keep stats on them. - */ -module.exports = function initialize(agent, memcached, moduleName, shim) { - var proto = memcached && memcached.prototype - if (!proto) { - return false - } - - shim.setDatastore(shim.MEMCACHED) - shim.recordOperation( - proto, - 'command', - function commandWrapper(shim, original, name, args) { - // The `command` method takes two arguments: a query generator and a server - // address. The query generator returns a simple object describing the - // memcached call. The server parameter is only provided for multi-calls. - // When not provided, it can be derived from the key being interacted with. - var metacall = args[0]() - var server = args[1] - var keys = wrapKeys(metacall) - var parameters = Object.create(null) - try { - parameters.key = stringify(keys[0]) - } catch (err) { - shim.logger.debug(err, 'Unable to stringify memcache key') - parameters.key = '' - } - - // Capture connection info for datastore instance metric. - var location = null - if (typeof server === 'string') { - location = server - } else if (this.HashRing && this.HashRing.get && metacall.key) { - location = this.HashRing.get(metacall.key) - } - if (location) { - location = location.split(':') - parameters.host = location[0] - parameters.port_path_or_id = location[1] - } - - // rewrap the metacall for the command object - args[0] = function rewrapped() { - return metacall - } - - // finally, execute the original command - return { - name: metacall.type || 'Unknown', - callback: function wrapCallback(shim, fn, fnName, opSegment) { - shim.bindCallbackSegment(metacall, 'callback', opSegment) - }, - parameters: parameters - } - } - ) -} diff --git a/node_modules/newrelic/lib/instrumentation/mongodb.js b/node_modules/newrelic/lib/instrumentation/mongodb.js deleted file mode 100644 index f84a2dff..00000000 --- a/node_modules/newrelic/lib/instrumentation/mongodb.js +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const semver = require('semver') - -// XXX: When this instrumentation is modularized, update this thread -// with a cautionary note: -// https://discuss.newrelic.com/t/feature-idea-using-mongoose-cursors-memory-leaking-very-quickly/49270/14 -// -// This instrumentation is deep linked against in the mongoose instrumentation -// snippet. The snippet will break once this file is moved from this -// location. - -// legacy endpoint enumerations -const DB_OPS = [ - 'addUser', - 'authenticate', - 'collection', - 'collectionNames', - 'collections', - 'command', - 'createCollection', - 'createIndex', - 'cursorInfo', - 'dereference', - 'dropCollection', - 'dropDatabase', - 'dropIndex', - 'ensureIndex', - 'eval', - 'executeDbAdminCommand', - 'indexInformation', - 'logout', - 'open', - 'reIndex', - 'removeUser', - 'renameCollection', - 'stats', - '_executeInsertCommand', - '_executeQueryCommand' -] - -const COLLECTION_OPS = [ - 'aggregate', - 'bulkWrite', - 'count', - 'createIndex', - 'deleteMany', - 'deleteOne', - 'distinct', - 'drop', - 'dropAllIndexes', - 'dropIndex', - 'ensureIndex', - 'findAndModify', - 'findAndRemove', - 'findOne', - 'findOneAndDelete', - 'findOneAndReplace', - 'findOneAndUpdate', - 'geoHaystackSearch', - 'geoNear', - 'group', - 'indexes', - 'indexExists', - 'indexInformation', - 'insert', - 'insertMany', - 'insertOne', - 'isCapped', - 'mapReduce', - 'options', - 'parallelCollectionScan', - 'reIndex', - 'remove', - 'rename', - 'replaceOne', - 'save', - 'stats', - 'update', - 'updateMany', - 'updateOne' -] - -const GRID_OPS = [ - 'put', - 'get', - 'delete' -] - -const CURSOR_OPS = [ - 'nextObject', - 'next', - 'toArray', - 'count', - 'explain' -] - -module.exports = initialize - -function initialize(agent, mongodb, moduleName, shim) { - if (!mongodb) return - - shim.setDatastore(shim.MONGODB) - shim.setParser(function mongoQueryParser(operation) { - let collection = this.collectionName || 'unknown' - if (this.collection && this.collection.collectionName) { - collection = this.collection.collectionName - } else if (this.s && this.s.name) { - collection = this.s.name - } else if (this.ns) { - collection = this.ns.split(/\./)[1] || collection - } - - return {operation, collection} - }) - - const mongoVersion = shim.require('./package.json').version - if (semver.satisfies(mongoVersion, '>=3.0.6') && mongodb.instrument) { - instrument306(shim, mongodb) - } else if (mongodb.instrument) { - instrumentInstrument(shim, mongodb) - } else { - instrumentLegacy(shim, mongodb) - } -} - -function instrument306(shim, mongodb) { - const instrumenter = mongodb.instrument(Object.create(null), () => {}) - captureAttributesOnStarted(shim, instrumenter) - instrumentLegacy(shim, mongodb) - - if (shim.isFunction(instrumenter.uninstrument)) { - shim.agent.once('unload', function uninstrumentMongo() { - instrumenter.uninstrument() - }) - } -} - -function instrumentInstrument(shim, mongodb) { - const recordDesc = { - 'Gridstore': {isQuery: false, makeDesc: function makeGridDesc(opName) { - return {name:'GridFS-' + opName, callback: shim.LAST} - }}, - 'OrderedBulkOperation': {isQuery: true, makeDesc: makeQueryDescFunc}, - 'UnorderedBulkOperation': {isQuery: true, makeDesc: makeQueryDescFunc}, - 'CommandCursor': {isQuery: true, makeDesc: makeQueryDescFunc}, - 'AggregationCursor': {isQuery: true, makeDesc: makeQueryDescFunc}, - 'Cursor': {isQuery: true, makeDesc: makeQueryDescFunc}, - 'Collection': {isQuery: true, makeDesc: makeQueryDescFunc}, - 'Db': {isQuery: false, makeDesc: function makeDbDesc() { - return {callback: shim.LAST} - }} - } - - // instrument using the apm api - const instrumenter = mongodb.instrument(Object.create(null), instrumentModules) - captureAttributesOnStarted(shim, instrumenter) - - function instrumentModules(err, instrumentations) { - if (err) { - shim.logger - .trace('Unable to instrument mongo using the apm api due to error: %s', err) - // fallback to legacy instrumentation? - return - } - instrumentations.forEach(instrumentModule) - } - - function instrumentModule(module) { - var object = module.obj - var instrumentations = module.instrumentations - for (var i = 0; i < instrumentations.length; i++) { - applyInstrumentation(module.name, object, instrumentations[i]) - } - } - - function applyInstrumentation(objectName, object, instrumentation) { - var methods = instrumentation.methods - var methodOptions = instrumentation.options - if (methodOptions.callback) { - for (var j = 0; j < methods.length; j++) { - var method = methods[j] - - var isQuery = recordDesc[objectName].isQuery - var makeDescFunc = recordDesc[objectName].makeDesc - var proto = object.prototype - if (isQuery) { - shim.recordQuery(proto, method, makeDescFunc(shim, method)) - } else if (isQuery === false) { // could be unset - shim.recordOperation(proto, method, makeDescFunc(shim, method)) - } else { - shim.logger.trace('No wrapping method found for %s', objectName) - } - } - } - - // the cursor object implements Readable stream and internally calls nextObject on - // each read, in which case we do not want to record each nextObject() call - if (/Cursor$/.test(objectName)) { - shim.recordOperation(object.prototype, 'pipe') - } - } -} - -function captureAttributesOnStarted(shim, instrumenter) { - instrumenter.on('started', function onMongoEventStarted(evnt) { - // This assumes that this `started` event is fired _after_ our wrapper - // starts and creates the segment. We perform a check of the segment name - // out of an excess of caution. - const connId = evnt.connectionId - if (connId) { - // Mongo sticks the path to the domain socket in the "host" slot, but we - // want it in the "port", so if we have a domain socket we need to change - // the order of our parameters. - if (typeof connId === 'string') { - const parts = connId.split(':') - if (parts.length && parts[0][0] === '/') { - shim.captureInstanceAttributes('localhost', parts[0], evnt.databaseName) - } else { - shim.captureInstanceAttributes(parts[0], parts[1], evnt.databaseName) - } - } else if (connId.domainSocket) { - shim.captureInstanceAttributes('localhost', connId.host, evnt.databaseName) - } else { - shim.captureInstanceAttributes(connId.host, connId.port, evnt.databaseName) - } - } - }) -} - -function instrumentLegacy(shim, mongodb) { - instrumentCursor(mongodb.Cursor) - instrumentCursor(shim.require('./lib/aggregation_cursor')) - instrumentCursor(shim.require('./lib/command_cursor')) - - if (mongodb.Collection && mongodb.Collection.prototype) { - const proto = mongodb.Collection.prototype - for (let i = 0; i < COLLECTION_OPS.length; i++) { - shim.recordQuery( - proto, - COLLECTION_OPS[i], - makeQueryDescFunc(shim, COLLECTION_OPS[i]) - ) - } - } - - if (mongodb.Grid && mongodb.Grid.prototype) { - const proto = mongodb.Grid.prototype - for (let i = 0; i < CURSOR_OPS.length; i++) { - shim.recordOperation(proto, GRID_OPS[i], - {name:'GridFS-' + GRID_OPS[i], callback: shim.LAST}) - } - } - - if (mongodb.Db && mongodb.Db.prototype) { - const proto = mongodb.Db.prototype - shim.recordOperation(proto, DB_OPS, {callback: shim.LAST}) - shim.recordOperation(mongodb.Db, 'connect', {callback: shim.LAST}) - } - - function instrumentCursor(Cursor) { - if (Cursor && Cursor.prototype) { - const proto = Cursor.prototype - for (let i = 0; i < CURSOR_OPS.length; i++) { - shim.recordQuery(proto, CURSOR_OPS[i], makeQueryDescFunc(shim, CURSOR_OPS[i])) - } - - shim.recordQuery(proto, 'each', makeQueryDescFunc(shim, 'each')) - shim.recordOperation(proto, 'pipe') - } - } -} - -function makeQueryDescFunc(shim, methodName) { - if (methodName === 'each') { - return function eachDescFunc() { - const parameters = getInstanceAttributeParameters(shim, this) - return {query: methodName, parameters, rowCallback: shim.LAST} - } - } - - return function queryDescFunc() { - // segment name does not actually use query string - // method name is set as query so the query parser has access to the op name - const parameters = getInstanceAttributeParameters(shim, this) - return {query: methodName, parameters, callback: shim.LAST} - } -} - -function getInstanceAttributeParameters(shim, obj) { - if (obj.db && obj.db.serverConfig) { - shim.logger.trace('Adding datastore instance attributes from obj.db.serverConfig') - const serverConfig = obj.db.serverConfig - const db = serverConfig.db || serverConfig.dbInstance - return doCapture(serverConfig, db && db.databaseName) - } else if (obj.s && obj.s.db && obj.s.topology) { - shim.logger.trace( - 'Adding datastore instance attributes from obj.s.db + obj.s.topology' - ) - const databaseName = obj.s.db.databaseName || null - const topology = obj.s.topology - if (topology.s && topology.s.options) { - return doCapture(topology.s.options, databaseName) - } - } - - shim.logger.trace('Could not find datastore instance attributes.') - return { - host: null, - port_path_or_id: null, - database_name: null - } - - function doCapture(conf, database) { - let host = conf.host - let port = conf.port - - // If using a domain socket, mongo stores the path as the host name, but we - // pass it through the port value. - if ( - (conf.socketOptions && conf.socketOptions.domainSocket) || - /\.sock$/.test(host) - ) { - port = host - host = 'localhost' - } - - return { - host: host, - port_path_or_id: port, - database_name: database - } - } -} diff --git a/node_modules/newrelic/lib/instrumentation/mysql.js b/node_modules/newrelic/lib/instrumentation/mysql.js deleted file mode 100644 index e6ffb396..00000000 --- a/node_modules/newrelic/lib/instrumentation/mysql.js +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var dbutils = require('../db/utils') -var properties = require('../util/properties') - - -module.exports = function initialize(agent, mysql, moduleName, shim) { - shim.setDatastore(shim.MYSQL) - shim.__wrappedPoolConnection = false - - shim.wrapReturn(mysql, 'createConnection', wrapCreateConnection) - function wrapCreateConnection(shim, fn, fnName, connection) { - shim.logger.debug('Wrapping Connection#query') - if (wrapQueriable(shim, connection, false)) { - var connProto = Object.getPrototypeOf(connection) - shim.setInternalProperty(connProto, '__NR_storeDatabase', true) - shim.unwrap(mysql, 'createConnection') - } - } - - shim.wrapReturn(mysql, 'createPool', wrapCreatePool) - function wrapCreatePool(shim, fn, fnName, pool) { - shim.logger.debug('Wrapping Pool#query and Pool#getConnection') - if (wrapQueriable(shim, pool, true) && wrapGetConnection(shim, pool)) { - shim.unwrap(mysql, 'createPool') - } - } - - shim.wrapReturn(mysql, 'createPoolCluster', wrapCreatePoolCluster) - function wrapCreatePoolCluster(shim, fn, fnName, poolCluster) { - shim.logger.debug('Wrapping PoolCluster#of') - var proto = Object.getPrototypeOf(poolCluster) - shim.wrapReturn(proto, 'of', wrapPoolClusterOf) - function wrapPoolClusterOf(shim, of, _n, poolNamespace) { - if (wrapGetConnection(shim, poolNamespace)) { - shim.unwrap(proto, 'of') - } - } - - shim.logger.debug('Wrapping PoolCluster#getConnection') - if (wrapGetConnection(shim, poolCluster)) { - shim.unwrap(mysql, 'createPoolCluster') - } - } -} - -function wrapGetConnection(shim, connectable) { - if ( - !connectable || - !connectable.getConnection || - shim.isWrapped(connectable.getConnection) - ) { - shim.logger.trace({ - connectable: !!connectable, - getConnection: !!(connectable && connectable.getConnection), - isWrapped: !!(connectable && shim.isWrapped(connectable.getConnection)) - }, 'Not wrapping getConnection') - return false - } - - var proto = Object.getPrototypeOf(connectable) - shim.wrap(proto, 'getConnection', function doWrapGetConnection(shim, fn) { - return function wrappedGetConnection() { - var args = shim.toArray(arguments) - var cbIdx = args.length - 1 - - if (shim.isFunction(args[cbIdx]) && !shim.isWrapped(args[cbIdx])) { - shim.logger.trace({ - hasSegment: !!shim.getSegment() - }, 'Wrapping callback with segment') - var cb = args[cbIdx] - if (!shim.__wrappedPoolConnection) { - cb = shim.wrap(cb, wrapGetConnectionCallback) - } - args[cbIdx] = shim.bindSegment(cb) - } - return fn.apply(this, args) - } - }) - - return true -} - -function wrapGetConnectionCallback(shim, cb) { - return function wrappedGetConnectionCallback(err, conn) { - try { - shim.logger.debug('Wrapping PoolConnection#query') - if (!err && wrapQueriable(shim, conn, false)) { - // Leave getConnection wrapped in order to maintain TX state, but we can - // simplify the wrapping of its callback in future calls. - shim.__wrappedPoolConnection = true - } - } catch (_err) { - shim.logger.debug( - {error: _err}, - 'Attempt to wrap PoolConnection#query resulted in thrown error' - ) - } - return cb.apply(this, arguments) - } -} - -function wrapQueriable(shim, queriable, isPoolQuery) { - if (!queriable || !queriable.query || shim.isWrapped(queriable.query)) { - shim.logger.debug({ - queriable: !!queriable, - query: !!(queriable && queriable.query), - isWrapped: !!(queriable && shim.isWrapped(queriable.query)) - }, 'Not wrappying queriable') - return false - } - - var proto = Object.getPrototypeOf(queriable) - - var describe - if (isPoolQuery) { - describe = describePoolQuery - } else { - describe = describeQuery - shim.setInternalProperty(proto, '__NR_databaseName', null) - } - - shim.recordQuery(proto, 'query', describe) - - if (queriable.execute) { - shim.recordQuery(proto, 'execute', describe) - } - - return true -} - -function extractQueryArgs(shim, args) { - var query = '' - var callback = null - - // Figure out the query parameter. - if (shim.isString(args[0])) { - // query(sql [, values], callback) - query = args[0] - } else { - // query(opts [, values], callback) - query = args[0].sql - } - - // Then determine the query values and callback parameters. - if (shim.isArray(args[1])) { - // query({opts|sql}, values, callback) - callback = 2 - } else { - // query({opts|sql}, callback) - callback = 1 - } - - return { - query: query, - callback: callback - } -} - -function describeQuery(shim, queryFn, fnName, args) { - shim.logger.trace('Recording query') - var extractedArgs = extractQueryArgs(shim, args) - - // Pull out instance attributes. - var parameters = getInstanceParameters(shim, this, extractedArgs.query) - - shim.logger.trace({ - query: !!extractedArgs.query, - callback: !!extractedArgs.callback, - parameters: !!parameters - }, 'Query segment descriptor') - - return { - stream: true, - query: extractedArgs.query, - callback: extractedArgs.callback, - parameters: parameters, - record: true - } -} - -function describePoolQuery(shim, queryFn, fnName, args) { - shim.logger.trace('Recording pool query') - var extractedArgs = extractQueryArgs(shim, args) - return { - stream: true, - query: null, - callback: extractedArgs.callback, - name: 'MySQL Pool#query', - record: false - } -} - -function getInstanceParameters(shim, queryable, query) { - var parameters = {host: null, port_path_or_id: null, database_name: null} - var conf = queryable.config - conf = (conf && conf.connectionConfig) || conf - var databaseName = queryable.__NR_databaseName || null - if (conf) { - parameters.database_name = databaseName = databaseName || conf.database - - if (properties.hasOwn(conf, 'socketPath') && conf.socketPath) { - // In the unix domain socket case we force the host to be localhost - parameters.host = 'localhost' - parameters.port_path_or_id = conf.socketPath - } else { - parameters.host = conf.host - parameters.port_path_or_id = conf.port - } - } else { - shim.logger.trace('No query config detected, not collecting db instance data') - } - - storeDatabaseName(shim, queryable, query) - return parameters -} - -function storeDatabaseName(shim, queryable, query) { - if (queryable.__NR_storeDatabase) { - var databaseName = dbutils.extractDatabaseChangeFromUse(query) - if (databaseName) { - shim.setInternalProperty(queryable, '__NR_databaseName', databaseName) - } - } -} diff --git a/node_modules/newrelic/lib/instrumentation/oracle.js b/node_modules/newrelic/lib/instrumentation/oracle.js deleted file mode 100644 index b95868b2..00000000 --- a/node_modules/newrelic/lib/instrumentation/oracle.js +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger').child({component: 'oracle'}) -var shimmer = require('../shimmer') -var parseSql = require('../db/parse-sql') -var ORACLE = require('../metrics/names').ORACLE - -module.exports = function initialize(agent, oracle) { - var tracer = agent.tracer - var wrapped = false - - logger.trace('wrapping oracle.connect and oracle.connectSync') - - shimmer.wrapMethod(oracle, 'Oracle', 'connect', function cb_wrapMethod(connect) { - return function wrappedConnect(connectData, cb) { - return connect.call( - this, - connectData, - tracer.bindFunction(wrapConnection) - ) - - function wrapConnection(err, connection) { - if (!err) ensureConnectionWrapped(connection) - return cb(err, connection) - } - } - }) - - shimmer.wrapMethod(oracle, 'Oracle', 'connectSync', function wrapSyncConnect(connect) { - return function wrappedSyncConnect() { - var connection = connect.apply(this, arguments) - ensureConnectionWrapped(connection) - return connection - } - }) - - function ensureConnectionWrapped(connection) { - // return early in case called from an async connect after wrapping - if (wrapped) return - logger.trace('wrapping oracle connection prototype') - wrapped = true - - oracle.connectSync.__NR_unwrap() - oracle.connect.__NR_unwrap() - shimmer.wrapMethod(oracle, 'Oracle', 'connect', function wrapMethod(connect) { - return tracer.wrapFunctionNoSegment(connect, 'connect') - }) - - var proto = Object.getPrototypeOf(connection) - wrapConnectionExecute(proto, tracer) - wrapConnectionPrepare(proto, tracer) - - shimmer.wrapMethod(proto, 'Oracle', 'reader', function wrapMethod(createReader) { - return function wrappedConnect(sql) { - var reader = createReader.apply(this, arguments) - wrapReader(reader, tracer, sql) - return reader - } - }) - } -} - -function wrapConnectionExecute(connection, tracer) { - shimmer.wrapMethod(connection, 'Oracle.connection', 'execute', wrapExecute) - - function wrapExecute(execute) { - return tracer.wrapFunction(ORACLE.STATEMENT + 'other/', null, execute, wrappedExecute) - } - - function wrappedExecute(segment, args, bind) { - var ps = parseSql(ORACLE.PREFIX, args[0]) - var collection = ps.collection - var operation = ps.operation - - segment.name = ORACLE.STATEMENT + collection + '/Connection.execute/' + operation - logger.trace( - 'capturing oracle query. collection: %s, Operation: %s', - collection, - operation - ) - - segment.transaction.addRecorder(ps.recordMetrics.bind(ps, segment)) - args[2] = bind(args[2]) - return args - } -} - -function wrapReader(reader, tracer, sql) { - var ps = parseSql(ORACLE.PREFIX, sql) - shimmer.wrapMethod(reader, 'Oracle.Reader', 'nextRow', wrapNextRow) - shimmer.wrapMethod(reader, 'Oracle.Reader', 'nextRows', wrapNextRows) - - function wrapNextRow(nextRow) { - return tracer.wrapFunctionLast( - ORACLE.STATEMENT + ps.collection + '/Reader.nextRow/' + ps.operation, - ps.recordMetrics.bind(ps), - nextRow - ) - } - - function wrapNextRows(nextRows) { - return tracer.wrapFunctionLast( - ORACLE.STATEMENT + ps.collection + '/Reader.nextRows/' + ps.operation, - ps.recordMetrics.bind(ps), - nextRows - ) - } -} - -function wrapConnectionPrepare(connection, tracer) { - shimmer.wrapMethod(connection, 'Oracle.connection', 'prepare', wrapPrepare) - - function wrapPrepare(prepare) { - return function wrappedPrepare(sql) { - var ps = parseSql(ORACLE.PREFIX, sql) - var prepared = prepare.apply(this, arguments) - shimmer.wrapMethod(prepared, 'Oracle', 'execute', wrapExecute) - return prepared - - function wrapExecute(execute) { - return tracer.wrapFunctionLast( - ORACLE.STATEMENT + ps.collection + '/Statement.execute/' + ps.operation, - ps.recordMetrics.bind(ps), - execute - ) - } - } - } -} diff --git a/node_modules/newrelic/lib/instrumentation/pg.js b/node_modules/newrelic/lib/instrumentation/pg.js deleted file mode 100644 index 793ae1fc..00000000 --- a/node_modules/newrelic/lib/instrumentation/pg.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -function getQuery(shim, original, name, args) { - var config = args[0] - var statement - if (config && (typeof config === 'string' || config instanceof String)) { - statement = config - } else if (config && config.text) { - statement = config.text - } else { - // Won't be matched by parser, but should be handled properly - statement = 'Other' - } - return statement -} - -module.exports = function initialize(agent, pgsql, moduleName, shim) { - shim.setDatastore(shim.POSTGRES) - // allows for native wrapping to not happen if not necessary - // when env var is true - - if (process.env.NODE_PG_FORCE_NATIVE) { - return instrumentPGNative(pgsql) - } - - // wrapping for native - function instrumentPGNative(pg) { - shim.wrapReturn(pg, 'Client', clientFactoryWrapper) - shim.wrapReturn(pg.pools, 'Client', clientFactoryWrapper) - - // In pg v5 the Client class used by pg-pool is the same Client - // class as pg.Client. Since querying through the Pool class just - // defers to Client.query in this case we should skip instrumenting - // the Client class on Pool. - // Note: pg v5 was the only version to have both the Pool - // constructor and pg.pools so we can check against pg.pools to only - // instrument pg.Pool on v6 and later. - if (!pg.pools) { - shim.wrapClass(pg, 'Pool', {post: poolPostConstructor, es6: true}) - } - } - - function poolPostConstructor(shim) { - if (!shim.isWrapped(this.Client)) { - shim.wrapClass(this, 'Client', clientPostConstructor) - } - } - - function clientFactoryWrapper(shim, fn, fnName, client) { - clientPostConstructor.call(client, shim) - } - - function clientPostConstructor(shim) { - shim.recordQuery(this, 'query', { - callback: shim.LAST, - query: getQuery, - stream: 'row', - parameters: getInstanceParameters(shim, this), - internal: false - }) - - shim.record(this, 'connect', function pgConnectNamer() { - return { - name: 'connect', - callback: shim.LAST - } - }) - } - - // The pg module defines "native" getter which sets up the native client lazily - // (only when called). We replace the getter, so that we can instrument the native - // client. The original getter replaces itself with the instance of the native - // client, so only instrument if the getter exists (otherwise assume already - // instrumented). - var origGetter = pgsql.__lookupGetter__('native') - if (origGetter) { - delete pgsql.native - pgsql.__defineGetter__('native', function getNative() { - var temp = origGetter() - if (temp != null) { - instrumentPGNative(temp) - } - return temp - }) - } - - // wrapping for JS - shim.recordQuery( - pgsql && pgsql.Client && pgsql.Client.prototype, - 'query', - function wrapJSClientQuery(shim) { - return { - callback: shim.LAST, - query: getQuery, - stream: 'row', - parameters: getInstanceParameters(shim, this), - internal: false - } - } - ) -} - -function getInstanceParameters(shim, client) { - return { - host: client.host || null, - port_path_or_id: client.port || null, - database_name: client.database || null - } -} diff --git a/node_modules/newrelic/lib/instrumentation/promise.js b/node_modules/newrelic/lib/instrumentation/promise.js deleted file mode 100644 index e6b9267d..00000000 --- a/node_modules/newrelic/lib/instrumentation/promise.js +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var util = require('util') -var properties = require('../util/properties') -var shimmer = require('../shimmer') - - -/** - * @namespace Library.Spec - * - * @property {string} name - * The name of this promise library. - * - * @property {?string} constructor - * Optional. The name of the property that is the Promise constructor. Default - * is to use the library itself as the Promise constructor. - * - * @property {?bool} executor - * Optional. If true, the Promise constructor itself will be wrapped for the - * executor. If false then `_proto`, `_static`, or `_library` must have an - * `executor` field whose value is the name of the executor function. Default - * is false. - * - * @property {Library.Spec.Mapping} $proto - * The mapping for Promise instance method concepts (i.e. `then`). These are - * mapped on the Promise class' prototype. - * - * @property {Library.Spec.Mapping} $static - * The mapping for Promise static method concepts (i.e. `all`, `race`). These - * are mapped on the Promise class itself. - * - * @property {?Library.Spec.Mapping} $library - * The mapping for library-level static method concepts (i.e. `fcall`, `when`). - * These are mapped on the library containing the Promise class. NOTE: in most - * promise implementations, the Promise class is itself the library thus this - * property is unnecessary. - */ - -/** - * @namespace Library.Spec.Mapping - * - * @desc - * A mapping of promise concepts (i.e. `then`) to this library's implementation - * name(s) (i.e. `["then", "chain"]`). Each value can by either a single string - * or an array of strings if the concept exists under multiple keys. If any - * given concept doesn't exist in this library, it is simply skipped. - * - * @property {array} $copy - * An array of properties or methods to just directly copy without wrapping. - * This field only matters when `Library.Spec.executor` is `true`. - * - * @property {string|array} executor - * - * - * @property {string|array} then - * - * - * @property {string|array} all - * - * - * @property {string|array} race - * - * - * @property {string|array} resolve - * Indicates methods to wrap which are resolve factories. This method only - * requires wrapping if the library doesn't use an executor internally to - * implement it. - * - * @property {string|array} reject - * Indicates methods to wrap which are reject factories. Like `resolve`, this - * method only requires wrapping if the library doesn't use an executor - * internally to implement it. - */ - -/** - * Instruments a promise library. - * - * @param {Agent} agent - The New Relic APM agent. - * @param {function} library - The promise library. - * @param {?Library.Spec} spec - Spec for this promise library mapping. - */ -module.exports = function initialize(agent, library, spec) { - if (spec.useFinally == null) { - spec.useFinally = true - } - // Wrap library-level methods. - wrapStaticMethods(library, spec.name, spec.$library) - - // Wrap prototype methods. - var Promise = library[spec.constructor] - wrapPrototype(Promise.prototype) - wrapStaticMethods(Promise, spec.constructor, spec.$static) - - // See if we are wrapping the class itself. - if (spec.executor) { - shimmer.wrapMethod(library, spec.name, spec.constructor, wrapPromise) - } - - /** - * Wraps the Promise constructor as the executor. - */ - function wrapPromise() { - // Copy all unwrapped properties over. - if (spec.$static && spec.$static.$copy) { - spec.$static.$copy.forEach(function copyKeys(key) { - if (!wrappedPromise[key]) { - wrappedPromise[key] = Promise[key] - } - }) - } - - var passThrough = spec.$static && spec.$static.$passThrough - if (passThrough) { - passThrough.forEach(function assignProxy(proxyProp) { - if (!properties.hasOwn(wrappedPromise, proxyProp)) { - Object.defineProperty(wrappedPromise, proxyProp, { - enumerable: true, - configurable: true, - get: function getOriginal() { - return Promise[proxyProp] - }, - set: function setOriginal(newValue) { - Promise[proxyProp] = newValue - } - }) - } - }) - } - - // Inherit to pass `instanceof` checks. - util.inherits(wrappedPromise, Promise) - - // Make the wrapper. - return wrappedPromise - } - - function wrappedPromise(executor) { - if (!(this instanceof wrappedPromise)) { - return Promise(executor) // eslint-disable-line new-cap - } - - var parent = agent.tracer.segment - var promise = null - if ( - !parent || - !parent.transaction.isActive() || - typeof executor !== 'function' || - arguments.length !== 1 - ) { - // We are expecting one function argument for executor, anything else is - // non-standard, do not attempt to wrap. Also do not attempt to wrap if we - // are not in a transaction. - var cnstrctArgs = agent.tracer.slice(arguments) - cnstrctArgs.unshift(Promise) // `unshift` === `push_front` - promise = new (Promise.bind.apply(Promise, cnstrctArgs))() - } else { - var segmentName = 'Promise ' + (executor.name || '') - var context = { - promise: null, - self: null, - args: null - } - promise = new Promise(wrapExecutorContext(context)) - context.promise = promise - var segment = _createSegment(segmentName) - Contextualizer.link(null, promise, segment, spec.useFinally) - - agent.tracer.segment = segment - segment.start() - try { - // Must run after promise is defined so that `__NR_wrapper` can be set. - executor.apply(context.self, context.args) - } catch (e) { - context.args[1](e) - } finally { - agent.tracer.segment = parent - segment.touch() - } - } - - // The Promise must be created using the "real" Promise constructor (using - // normal Promise.apply(this) method does not work). But the prototype - // chain must include the wrappedPromise.prototype, V8's promise - // implementation uses promise.constructor to create new Promises for - // calls to `then`, `chain` and `catch` which allows these Promises to - // also be instrumented. - promise.__proto__ = wrappedPromise.prototype // eslint-disable-line no-proto - - return promise - } - - function wrapPrototype(PromiseProto, name) { - // Don't wrap the proto if there is no spec for it. - if (!spec.$proto) { - return - } - - name = name || (spec.constructor + '.prototype') - - // Wrap up instance methods. - _safeWrap(PromiseProto, name, spec.$proto.executor, wrapExecutorCaller) - _safeWrap(PromiseProto, name, spec.$proto.then, wrapThen) - _safeWrap(PromiseProto, name, spec.$proto.cast, wrapCast) - _safeWrap(PromiseProto, name, spec.$proto.catch, wrapCatch) - } - - function wrapStaticMethods(lib, name, staticSpec) { - // Don't bother with empty specs. - if (!staticSpec) { - return - } - - _safeWrap(lib, name, staticSpec.cast, wrapCast) - _safeWrap(lib, name, staticSpec.promisify, wrapPromisifiy) - } - - function wrapExecutorCaller(caller) { - return function wrappedExecutorCaller(executor) { - var parent = agent.tracer.getSegment() - if (!(this instanceof Promise) || !parent || !parent.transaction.isActive()) { - return caller.apply(this, arguments) - } - - var context = { - promise: this, - self: null, - args: null - } - if (!this.__NR_context) { - var segmentName = 'Promise ' + executor.name || '' - var segment = _createSegment(segmentName) - Contextualizer.link(null, this, segment, spec.useFinally) - } - var args = [].slice.call(arguments) - args[0] = wrapExecutorContext(context, this.__NR_context.getSegment()) - var ret = caller.apply(this, args) - - // Bluebird catches executor errors and auto-rejects when it catches them, - // thus we need to do so as well. - // - // When adding new libraries, make sure to check that they behave the same - // way. We may need to enhance the promise spec to handle this variance. - try { - executor.apply(context.self, context.args) - } catch (e) { - context.args[1](e) - } - return ret - } - } - - /** - * Creates a function which will export the context and arguments of its - * execution. - * - * @param {object} context - The object to export the execution context with. - * - * @return {function} A function which, when executed, will add its context - * and arguments to the `context` parameter. - */ - function wrapExecutorContext(context) { - return function contextExporter(resolve, reject) { - context.self = this - context.args = [].slice.call(arguments) - context.args[0] = wrapResolver(context, resolve) - context.args[1] = wrapResolver(context, reject) - } - } - - function wrapResolver(context, fn) { - return function wrappedResolveReject(val) { - var promise = context.promise - if (promise && promise.__NR_context) { - promise.__NR_context.getSegment().touch() - } - fn(val) - } - } - - /** - * Creates a wrapper for `Promise#then` that extends the transaction context. - * - * @return {function} A wrapped version of `Promise#then`. - */ - function wrapThen(then, name) { - return _wrapThen(then, name, true) - } - - /** - * Creates a wrapper for `Promise#catch` that extends the transaction context. - * - * @return {function} A wrapped version of `Promise#catch`. - */ - function wrapCatch(cach, name) { - return _wrapThen(cach, name, false) - } - - /** - * Creates a wrapper for promise chain extending methods. - * - * @param {function} then - * The function we are to wrap as a chain extender. - * - * @param {bool} useAllParams - * When true, all parameters which are functions will be wrapped. Otherwise, - * only the last parameter will be wrapped. - * - * @return {function} A wrapped version of the function. - */ - function _wrapThen(then, name, useAllParams) { - // Don't wrap non-functions. - if (typeof then !== 'function' || then.name === '__NR_wrappedThen') { - return then - } - - return function __NR_wrappedThen() { - if (!(this instanceof Promise)) { - return then.apply(this, arguments) - } - - var segmentNamePrefix = 'Promise#' + name + ' ' - var thenSegment = agent.tracer.getSegment() - var promise = this - - // Wrap up the arguments and execute the real then. - var isWrapped = false - var args = [].map.call(arguments, wrapHandler) - var next = then.apply(this, args) - - // If we got a promise (which we should have), link the parent's context. - if (!isWrapped && next instanceof Promise && next !== promise) { - Contextualizer.link(promise, next, thenSegment, spec.useFinally) - } - return next - - function wrapHandler(fn, i, arr) { - if ( - typeof fn !== 'function' || // Not a function - fn.name === '__NR_wrappedThenHandler' || // Already wrapped - (!useAllParams && i !== (arr.length - 1)) // Don't want all and not last - ) { - isWrapped = fn && fn.name === '__NR_wrappedThenHandler' - return fn - } - - return function __NR_wrappedThenHandler() { - if (!next || !next.__NR_context) { - return fn.apply(this, arguments) - } - - var promSegment = next.__NR_context.getSegment() - var segmentName = segmentNamePrefix + (fn.name || '') - var segment = _createSegment(segmentName, promSegment) - if (segment && segment !== promSegment) { - next.__NR_context.setSegment(segment) - promSegment = segment - } - - var ret = null - try { - ret = agent.tracer.bindFunction(fn, promSegment, true).apply(this, arguments) - } finally { - if (ret && typeof ret.then === 'function') { - ret = next.__NR_context.continue(ret) - } - } - return ret - } - } - } - } - - /** - * Creates a wrapper around the static `Promise` factory method. - */ - function wrapCast(cast, name) { - if (typeof cast !== 'function' || cast.name === '__NR_wrappedCast') { - return cast - } - - var CAST_SEGMENT_NAME = 'Promise.' + name - return function __NR_wrappedCast() { - var segment = _createSegment(CAST_SEGMENT_NAME) - var prom = cast.apply(this, arguments) - if (segment) { - Contextualizer.link(null, prom, segment, spec.useFinally) - } - return prom - } - } - - function wrapPromisifiy(promisify, name) { - if (typeof promisify !== 'function' || promisify.name === '__NR_wrappedPromisify') { - return promisify - } - - var WRAP_SEGMENT_NAME = 'Promise.' + name - return function __NR_wrappedPromisify() { - var promisified = promisify.apply(this, arguments) - if (typeof promisified !== 'function') { - return promisified - } - - Object.keys(promisified).forEach(function forEachProperty(prop) { - __NR_wrappedPromisified[prop] = promisified[prop] - }) - - return __NR_wrappedPromisified - function __NR_wrappedPromisified() { - var segment = _createSegment(WRAP_SEGMENT_NAME) - var prom = agent.tracer.bindFunction(promisified, segment, true) - .apply(this, arguments) - - if (segment) { - Contextualizer.link(null, prom, segment, spec.useFinally) - } - - return prom - } - } - } - - function _createSegment(name, parent) { - return agent.config.feature_flag.promise_segments === true - ? agent.tracer.createSegment(name, null, parent) - : (parent || agent.tracer.getSegment()) - } -} - -/** - * Performs a `wrapMethod` if and only if `methods` is truthy and has a length - * greater than zero. - * - * @param {object} obj - The source of the methods to wrap. - * @param {string} name - The name of this source. - * @param {string|array} methods - The names of the methods to wrap. - * @param {function} wrapper - The function which wraps the methods. - */ -function _safeWrap(obj, name, methods, wrapper) { - if (methods && methods.length) { - shimmer.wrapMethod(obj, name, methods, wrapper) - } -} - -function Context(segment) { - this.segments = [segment] -} - -Context.prototype = Object.create(null) - -Context.prototype.branch = function branch() { - return this.segments.push(null) - 1 -} - -function Contextualizer(idx, context, useFinally) { - this.parentIdx = -1 - this.idx = idx - this.context = context - this.child = null - this.useFinally = useFinally -} -module.exports.Contextualizer = Contextualizer - -Contextualizer.link = function link(prev, next, segment, useFinally) { - var ctxlzr = prev && prev.__NR_context - if (ctxlzr && !ctxlzr.isActive()) { - ctxlzr = prev.__NR_context = null - } - - if (ctxlzr) { - // If prev has one child already, branch the context and update the child. - if (ctxlzr.child) { - // When the branch-point is the 2nd through nth link in the chain, it is - // necessary to track its segment separately so the branches can parent - // their segments on the branch-point. - if (ctxlzr.parentIdx !== -1) { - ctxlzr.idx = ctxlzr.context.branch() - } - - // The first child needs to be updated to have its own branch as well. And - // each of that child's children must be updated with the new parent index. - // This is the only non-constant-time action for linking, but it only - // happens with branching promise chains specifically when the 2nd branch - // is added. - // - // Note: This does not account for branches of branches. That may result - // in improperly parented segments. - var parent = ctxlzr - var child = ctxlzr.child - var branchIdx = ctxlzr.context.branch() - do { - child.parentIdx = parent.idx - child.idx = branchIdx - parent = child - child = child.child - } while (child) - - // We set the child to something falsey that isn't `null` so we can - // distinguish between having no child, having one child, and having - // multiple children. - ctxlzr.child = false - } - - // If this is a branching link then create a new branch for the next promise. - // Otherwise, we can just piggy-back on the previous link's spot. - var idx = ctxlzr.child === false ? ctxlzr.context.branch() : ctxlzr.idx - - // Create a new context for this next promise. - next.__NR_context = new Contextualizer(idx, ctxlzr.context, ctxlzr.useFinally) - next.__NR_context.parentIdx = ctxlzr.idx - - // If this was our first child, remember it in case we have a 2nd. - if (ctxlzr.child === null) { - ctxlzr.child = next.__NR_context - } - } else if (segment) { - // This next promise is the root of a chain. Either there was no previous - // promise or the promise was created out of context. - next.__NR_context = new Contextualizer(0, new Context(segment), useFinally) - } -} - -Contextualizer.prototype = Object.create(null) - -Contextualizer.prototype.isActive = function isActive() { - var segments = this.context.segments - var segment = segments[this.idx] || segments[this.parentIdx] || segments[0] - return segment && segment.transaction.isActive() -} - -Contextualizer.prototype.getSegment = function getSegment() { - var segments = this.context.segments - var segment = segments[this.idx] - if (segment == null) { - segment = segments[this.idx] = segments[this.parentIdx] || segments[0] - } - return segment -} - -Contextualizer.prototype.setSegment = function setSegment(segment) { - return this.context.segments[this.idx] = segment -} - -Contextualizer.prototype.toJSON = function toJSON() { - // No-op. -} - -Contextualizer.prototype.continue = function continueContext(prom) { - var self = this - var nextContext = prom.__NR_context - if (!nextContext) { - return prom - } - - // If we have `finally`, use that to sneak our context update. - if (typeof prom.finally === 'function' && nextContext.useFinally) { - return prom.finally(__NR_continueContext) - } - - // No `finally` means we need to hook into resolve and reject individually and - // pass through whatever happened. - return prom.then(function __NR_thenContext(val) { - __NR_continueContext() - return val - }, function __NR_catchContext(err) { - __NR_continueContext() - throw err // Re-throwing promise rejection, this is not New Relic's error. - }) - - function __NR_continueContext() { - self.setSegment(nextContext.getSegment()) - } -} diff --git a/node_modules/newrelic/lib/instrumentation/q.js b/node_modules/newrelic/lib/instrumentation/q.js deleted file mode 100644 index a879a00d..00000000 --- a/node_modules/newrelic/lib/instrumentation/q.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var wrap = require('../shimmer').wrapMethod - -module.exports = initialize - -function initialize(agent, Q) { - function wrapUninstrumented(original, method) { - return agent.tracer.wrapFunctionFirstNoSegment(original, method) - } - - if (Q.nextTick) { - // The wrap() call for nextTick wipes the sub-function. Save a reference - // now so it can be restored later - var savedRunAfter = Q.nextTick.runAfter - - wrap(Q, 'Q', 'nextTick', wrapUninstrumented) - - if (savedRunAfter) { - Q.nextTick.runAfter = savedRunAfter - wrap(Q.nextTick, 'Q.nextTick', 'runAfter', wrapUninstrumented) - } - } -} diff --git a/node_modules/newrelic/lib/instrumentation/redis.js b/node_modules/newrelic/lib/instrumentation/redis.js deleted file mode 100644 index 6242e9ad..00000000 --- a/node_modules/newrelic/lib/instrumentation/redis.js +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var hasOwnProperty = require('../util/properties').hasOwn -var stringify = require('json-stringify-safe') - -module.exports = function initialize(agent, redis, moduleName, shim) { - var proto = redis && redis.RedisClient && redis.RedisClient.prototype - if (!proto) { - return false - } - - shim.setDatastore(shim.REDIS) - if (proto.internal_send_command) { - shim.recordOperation( - proto, - 'internal_send_command', - function wrapInternalSendCommand(shim, internal_send_command, name, args) { - var commandObject = args[0] - var keys = commandObject.args - var parameters = getInstanceParameters(this) - - if (keys && keys.length > 0) { - try { - parameters.key = stringify(keys[0]) - } catch (err) { - shim.logger.debug(err, 'Failed to stringify internal send command redis key') - parameters.key = '' - } - } - - return { - name: commandObject.command || 'other', - parameters: parameters, - callback: function bindCallback(shim, _f, _n, segment) { - if (shim.isFunction(commandObject.callback)) { - shim.bindCallbackSegment(commandObject, 'callback', segment) - } else { - var self = this - commandObject.callback = shim.bindSegment(function __NR_redisCallback(err) { - if (err && self.emit instanceof Function) { - self.emit('error', err) - } - }, segment, true) - } - } - } - } - ) - } else { - // For redis versions <2.6.1 - shim.recordOperation( - proto, - 'send_command', - function wrapSendCommand(shim, send_command, name, args) { - var keys = args[1] - var parameters = getInstanceParameters(this) - - if (keys && !shim.isFunction(keys)) { - try { - parameters.key = stringify(keys[0]) - } catch (err) { - shim.logger.debug(err, 'Failed to stringify redis key for send command') - parameters.key = '' - } - } - - return { - name: args[0] || 'other', - parameters: parameters, - callback: function bindCallback(shim, _f, _n, segment) { - var last = args[args.length - 1] - if (shim.isFunction(last)) { - shim.bindCallbackSegment(args, shim.LAST, segment) - } else if (shim.isArray(last) && shim.isFunction(last[last.length - 1])) { - shim.bindCallbackSegment(last, shim.LAST, segment) - } - } - } - } - ) - } - - function getInstanceParameters(client) { - if (hasOwnProperty(client, 'port') && hasOwnProperty(client, 'host')) { - // for redis <=0.11 - return doCapture(client) - } else if (hasOwnProperty(client, 'connection_options')) { - // for redis 2.4.0 - 2.6.2 - return doCapture(client.connection_options) - } else if (hasOwnProperty(client, 'connectionOption')) { - // for redis 0.12 - 2.2.5 - return doCapture(client.connectionOption) - } else if (hasOwnProperty(client, 'options')) { - // for redis 2.3.0 - 2.3.1 - return doCapture(client.options) - } - - shim.logger.debug('Could not access instance attributes on connection.') - return { - host: null, - port_path_or_id: null, - database_name: null - } - - function doCapture(opts) { - var db = (hasOwnProperty(client, 'selected_db') ? client.selected_db : opts.db) || 0 - - return { - host: opts.host || 'localhost', - port_path_or_id: opts.path || opts.port || '6379', - database_name: db - } - } - } -} diff --git a/node_modules/newrelic/lib/instrumentation/restify.js b/node_modules/newrelic/lib/instrumentation/restify.js deleted file mode 100644 index 3b74b477..00000000 --- a/node_modules/newrelic/lib/instrumentation/restify.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = function initialize(agent, restify, moduleName, shim) { - shim.setFramework(shim.RESTIFY) - shim.setRouteParser(function routeParser(shim, fn, fnName, route) { - return (route && route.path) || route - }) - let wrappedServerClass = false - - shim.setErrorPredicate(function restifyErrorPredicate(err) { - return err instanceof Error - }) - - // Restify extends the core http.ServerResponse object when it's loaded, - // so these methods are separate from core instrumentation. - const http = require('http') - const methods = ['send', 'sendRaw', 'redirect'] - - shim.wrap(http.ServerResponse.prototype, methods, function wrapMethod(shim, fn) { - return function wrappedMethod() { - const segment = shim.getActiveSegment() - - if (segment) { - // Freezing the name state prevents transaction names from potentially being - // manipulated by asynchronous response methods executed as part of res.send() - // but before `next()` is called. - segment.transaction.nameState.freeze() - } - - return fn.apply(this, arguments) - } - }) - - shim.wrapReturn(restify, 'createServer', wrapCreateServer) - function wrapCreateServer(shim, fn, fnName, server) { - // If we have not wrapped the server class, now's the time to do that. - if (server && !wrappedServerClass) { - wrappedServerClass = true - wrapServer(Object.getPrototypeOf(server)) - } - } - - function wrapServer(serverProto) { - // These are all the methods for mounting routed middleware. - var routings = ['del', 'get', 'head', 'opts', 'post', 'put', 'patch'] - shim.wrapMiddlewareMounter(serverProto, routings, { - route: shim.FIRST, - endpoint: shim.LAST, - wrapper: function wrapMiddleware(shim, middleware, name, route) { - if (shim.isWrapped(middleware)) { - return middleware - } - return shim.recordMiddleware(middleware, { - matchArity: true, - route, - req: shim.FIRST, - next: shim.LAST - }) - } - }) - - // These methods do not accept a route, just middleware functions. - const mounters = ['pre', 'use'] - shim.wrapMiddlewareMounter(serverProto, mounters, function wrapper(shim, middleware) { - if (shim.isWrapped(middleware)) { - return middleware - } - return shim.recordMiddleware(middleware, { - matchArity: true, - req: shim.FIRST, - next: shim.LAST - }) - }) - } -} diff --git a/node_modules/newrelic/lib/instrumentation/vision.js b/node_modules/newrelic/lib/instrumentation/vision.js deleted file mode 100644 index 66efc895..00000000 --- a/node_modules/newrelic/lib/instrumentation/vision.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var semver = require('semver') - -module.exports = function initialize(agent, vision, moduleName, shim) { - var plugin = vision.plugin - - if (!plugin || !plugin.pkg || semver.lt(plugin.pkg.version, '5.0.0')) { - shim.logger.debug('Vision instrumentation requires v5 or greater, not instrumenting') - return false - } - - // Vision is only meant to be used with hapi - shim.setFramework(shim.HAPI) - - shim.wrap(plugin, 'register', function wrapRegister(shim, register) { - return function wrappedRegister(server) { - shim.wrap(server, 'decorate', wrapDecorate) - - var ret = register.apply(this, arguments) - - shim.unwrapOnce(server, 'decorate') - - return ret - } - }) -} - -function wrapDecorate(shim, decorate) { - return function wrappedDecorate(type, name, handler) { - if (type !== 'toolkit' || name !== 'view') { - return decorate.apply(this, arguments) - } - - var args = shim.argsToArray.apply(shim, arguments) - args[2] = shim.recordRender(handler, { promise: true }) - - return decorate.apply(this, args) - } -} diff --git a/node_modules/newrelic/lib/instrumentation/when.js b/node_modules/newrelic/lib/instrumentation/when.js deleted file mode 100644 index 6a7df176..00000000 --- a/node_modules/newrelic/lib/instrumentation/when.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var promInit = require('./promise') - -var STATIC_PROMISE_METHODS = [ - 'reject', 'resolve', 'all', 'any', 'some', 'map', 'reduce', 'filter', 'reduceRight' -] - -var WHEN_SPEC = { - name: 'when', - constructor: 'Promise', - executor: true, - $proto: { - then: ['then', 'done', 'spread', 'finally', 'ensure'], - catch: ['catch', 'otherwise'] - }, - $static: { - cast: STATIC_PROMISE_METHODS, - $copy: STATIC_PROMISE_METHODS.concat([ - '_defer', - '_handler', - 'race', - '_traverse', - '_visitRemaining', - 'settle', - 'iterate', - 'unfold', - 'never' - ]), - $passThrough: [ - 'enterContext', - 'exitContext', - 'createContext', - 'onFatalRejection', - 'onPotentiallyUnhandledRejectionHandled', - 'onPotentiallyUnhandledRejection' - ] - }, - $library: { - cast: STATIC_PROMISE_METHODS - } -} - -module.exports = function initialize(agent, library) { - if (!library || !library.Promise) { - return false - } - - promInit(agent, library, WHEN_SPEC) -} diff --git a/node_modules/newrelic/lib/instrumentations.js b/node_modules/newrelic/lib/instrumentations.js deleted file mode 100644 index f7031f8a..00000000 --- a/node_modules/newrelic/lib/instrumentations.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var MODULE_TYPE = require('./shim/constants').MODULE_TYPE - -// Return a new copy of this array every time we're called -module.exports = function instrumentations() { - return { - 'aws-sdk': {module: '@newrelic/aws-sdk'}, - 'amqplib': {type: MODULE_TYPE.MESSAGE}, - 'cassandra-driver': {type: MODULE_TYPE.DATASTORE}, - 'connect': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'bluebird': {type: MODULE_TYPE.PROMISE}, - 'director': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'express': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'fastify': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'generic-pool': {type: MODULE_TYPE.GENERIC}, - '@hapi/hapi': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'hapi': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'ioredis': {type: MODULE_TYPE.DATASTORE}, - 'koa': {module: '@newrelic/koa'}, - 'memcached': {type: MODULE_TYPE.DATASTORE}, - 'mongodb': {type: MODULE_TYPE.DATASTORE}, - 'mysql': {type: MODULE_TYPE.DATASTORE}, - 'pg': {type: MODULE_TYPE.DATASTORE}, - 'q': {type: null}, - 'redis': {type: MODULE_TYPE.DATASTORE}, - 'restify': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'superagent': {module: '@newrelic/superagent'}, - 'oracle': {type: null}, - 'vision': {type: MODULE_TYPE.WEB_FRAMEWORK}, - 'when': {type: null} - } -} diff --git a/node_modules/newrelic/lib/logger.js b/node_modules/newrelic/lib/logger.js deleted file mode 100644 index 23ea8c50..00000000 --- a/node_modules/newrelic/lib/logger.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var Logger = require('./util/logger') -var fs = require('./util/unwrapped-core').fs - -// create bootstrapping logger -module.exports = new Logger({ - name: 'newrelic_bootstrap', - stream: process.stdout, - level: 'info' -}) - -/** - * Don't load config until this point, because it requires this - * module, and if it gets loaded too early, module.exports will have no - * value. - */ -var config = require('./config').getOrCreateInstance() -if (config) { - var options = { - name: 'newrelic', - level: config.logging.level, - enabled: config.logging.enabled - } - - // create the "real" logger - module.exports = new Logger(options) - - if (config.logging.enabled) { - var stream - switch (config.logging.filepath) { - case 'stdout': - stream = process.stdout - break - - case 'stderr': - stream = process.stderr - break - - default: - stream = fs.createWriteStream(config.logging.filepath, {flags: 'a+'}) - stream.on('error', function logStreamOnError(err) { - /* eslint-disable no-console */ - // Since our normal logging didn't work, dump this to stderr. - console.error('New Relic failed to open log file ' + config.logging.filepath) - console.error(err) - /* eslint-enable no-console */ - }) - } - module.exports.pipe(stream) - } - - // now tell the config module to switch to the real logger - config.setLogger(module.exports) -} diff --git a/node_modules/newrelic/lib/metrics/index.js b/node_modules/newrelic/lib/metrics/index.js deleted file mode 100644 index fbd4bac8..00000000 --- a/node_modules/newrelic/lib/metrics/index.js +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const Stats = require('../stats') -const ApdexStats = require('../stats/apdex.js') -const NAMES = require('./names') - - -/* - * - * CONSTANTS - * - */ -const FROM_MILLIS = 1e-3 - -/** - * A metric is a set of aggregated data (summary statistics) associated with a - * metric name. Some metrics belong to scopes, which are typically the name of - * a transaction or a background task. This class is a collection of mappings - * from names (or scopes and names) to data, as well as functions for - * manipulating those data directly. It also can produce a serialized - * representation suitable for stringifying into JSON and sending to the - * collector. - * - * There are several metrics collections in existence at any given time. Each - * agent has one metrics collection, which is created at the beginning of each - * harvest cycle. Each new transaction also gets its own metrics collection, - * which is merged into the agent's metrics when the transaction is finalized. - * This allows each set of metrics to be added to the harvest cycle atomically, - * which guarantees that each transaction will not have its metrics split - * across multiple harvest cycles. If delivery to the collector fails, the - * metrics collection associated with the failed delivery can be merged back - * into the metrics collection for the ongoing harvest cycle. - * - * Metrics can be remapped, which is a process by which they are assigned a - * short, numerical ID by New Relic. This can shrink the serialized JSON - * considerably. The mapping from transaction name (and scope) happens only - * at serialization time, which allows the mappings from name to ID to happen - * on the fly. - * - * @param {Number} apdexT The apdex-tolerating value, for use in creating apdex - * statistics. - * @param {MetricMapper} mapper The mapper that turns metric names into IDs. - */ -function Metrics(apdexT, mapper, normalizer) { - if (apdexT == null || apdexT === '') { - throw new Error("metrics must be created with apdexT") - } - if (!mapper) throw new Error("metrics must be created with a mapper") - if (!normalizer) throw new Error("metrics must be created with a name normalizer") - - this.empty = true - this.started = Date.now() - this.apdexT = apdexT - this.mapper = mapper - this.normalizer = normalizer - this.unscoped = Object.create(null) // {name : stats} - this.scoped = Object.create(null) // {scope : {name : stats}} -} - -/** - * This is the preferred way for interacting with metrics. Set the duration - * (and optionally the amount of that duration that was exclusive to that - * particular metric and not any child operations to that metric) of an - * operation. If there are no data for the name (and optional scope) existing, - * the collection will create a set of data before recording the measurement. - * - * @param {string} name The name of the metric. - * @param {string} scope (Optional) The scope to which the metric belongs. - * @param {Number} duration The duration of the related operation, in milliseconds. - * @param {Number} exclusive (Optional) The portion of the operation specific to this - * metric. - * @return {Stats} The aggregated data related to this metric. - */ -Metrics.prototype.measureMilliseconds = measureMilliseconds - -function measureMilliseconds(name, scope, duration, exclusive) { - var stats = this.getOrCreateMetric(name, scope) - stats.recordValueInMillis(duration, exclusive) - return stats -} - -/** - * Set the size of an operation. If there are no data for the name existing, - * the collection will create a set of data before recording the measurement. - * - * @param {string} name The name of the metric. - * @param {Number} size The size of the related operation, in bytes. - * @return {Stats} The aggregated data related to this metric. - */ -Metrics.prototype.measureBytes = function measureBytes(name, size) { - var stats = this.getOrCreateMetric(name) - stats.recordValueInBytes(size) - return stats -} - -/** - * Look up the mapping from a name (and optionally a scope) to a set of metric - * data for that name, creating the data if they don't already exist. - * - * @param {string} name The name of the requested metric. - * @param {string} scope (Optional) The scope to which the metric is bound. - * @return {Stats} The aggregated data for that name. - */ -Metrics.prototype.getOrCreateMetric = function getOrCreateMetric(name, scope) { - var resolved = this._resolve(scope) - var stats = resolved[name] - if (!stats) { - this.empty = false - stats = resolved[name] = new Stats() - } - return stats -} - -/** - * Look up the mapping from a name (and optionally a scope) to a set of metric - * apdex data for that name, creating the data if they don't already exist. - * - * @param {string} name The name of the requested metric. - * @param {string} scope The scope to which the metric is bound - * (optional). - * @param {number} overrideApdex A custom apdexT for this metric, in - * milliseconds. This will be the same for - * a given run, because key transaction metrics - * are set at connect time via server-side - * configuration. - * - * @return {ApdexStats} The aggregated data for that name. - */ -Metrics.prototype.getOrCreateApdexMetric = getOrCreateApdexMetric - -function getOrCreateApdexMetric(name, scope, overrideApdex) { - if (!name) throw new Error('Metrics must be named') - - var resolved = this._resolve(scope) - - if (!resolved[name]) { - this.empty = false - - // Only use the given override to create the metric if this is not the - // global apdex AND we have a valid value. - var apdexT = name !== NAMES.APDEX && overrideApdex > 0 - ? (overrideApdex * FROM_MILLIS) : this.apdexT - resolved[name] = new ApdexStats(apdexT) - } - return resolved[name] -} - -/** - * Look up a metric, and don't create it if it doesn't exist. Can create scopes - * as a byproduct, but this function is only intended for use in testing, so - * it's not a big deal. - * - * @param {string} name Metric name. - * @param {string} scope (Optional) The scope, if any, to which the metric - * belongs. - * @return {object} Either a stats aggregate, an apdex stats aggregate, or - * undefined. - */ -Metrics.prototype.getMetric = function getMetric(name, scope) { - if (!name) throw new Error('Metrics must be named') - - return this._resolve(scope)[name] -} - -/** - * Convert this collection into a representation suitable for serialization - * by JSON.stringify and delivery to the collector. Hope you like nested - * arrays! - * - * @return {Object} Set of nested arrays containing metric information. - */ -Metrics.prototype.toJSON = function toJSON() { - return this._toUnscopedData().concat(this._toScopedData()) -} - -/** - * Combine two sets of metric data. Intended to be used as described above, - * either when folding a transaction's metrics into the agent's metrics for - * later harvest, or one harvest cycle's metrics into the next when a - * delivery attempt to the collector fails. Among the more performance- - * critical pieces of code in the agent, so some performance tuning would - * probably be a good idea. - * - * @param {Metrics} other - * The collection to be folded into this one. - * - * @param {boolean} adjustStartTime - * If the start time for the timeslice should be adjusted. - */ -Metrics.prototype.merge = function merge(other, adjustStartTime) { - this.empty = this.empty && other.empty - if (adjustStartTime) { - this.started = Math.min(this.started, other.started) - } - _merge(this.unscoped, other.unscoped) - - // Loop through all scopes and merge them. Since we know `.scoped` has a `null` - // prototype we don't need to worry about own property checks. - for (var scope in other.scoped) { // eslint-disable-line guard-for-in - _merge(this._resolve(scope), other.scoped[scope]) - } -} -function _merge(a, b) { - for (var name in b) { - if (a[name]) { - a[name].merge(b[name]) - } else { - a[name] = b[name] - } - } -} - -/** - * Look up the metric namespace belonging to a scope, creating it if it doesn't - * already exist. - * - * @param {string} scope (Optional) The scope to look up. - * @return {object} The namespace associated with the provided scope, or the - * un-scoped metrics if the scope isn't set. - */ -Metrics.prototype._resolve = function _resolve(scope) { - var resolved = this.unscoped - - if (scope) { - resolved = this.scoped[scope] - if (!resolved) { - resolved = this.scoped[scope] = Object.create(null) - } - } - - return resolved -} - -/** - * Map a metric to its nested-array representation, applying any name -> ID - * mappings along the way. Split from _getScopedData for performance. - * - * @param {string} name The string to look up. - */ -Metrics.prototype._getUnscopedData = function _getUnscopedData(name) { - if (!this.unscoped[name]) return - - var normalized = this.normalizer.normalize(name) - if (normalized.ignore || !normalized.value) return - - return [this.mapper.map(normalized.value), this.unscoped[name]] -} - -/** - * Map a metric to its nested-array representation, applying any name -> ID - * mappings along the way. Split from _getUnscopedData for performance. - * - * @param {string} name The string to look up. - */ -Metrics.prototype._getScopedData = function _getScopedData(name, scope) { - if (!this.scoped[scope][name]) return - - var normalized = this.normalizer.normalize(name) - if (normalized.ignore || !normalized.value) return - - return [this.mapper.map(normalized.value, scope), this.scoped[scope][name]] -} - -/** - * @return {object} A serializable version of the unscoped metrics. Intended - * for use by toJSON. - */ -Metrics.prototype._toUnscopedData = function _toUnscopedData() { - var metricData = [] - - Object.keys(this.unscoped).forEach(function cb_forEach(name) { - var data = this._getUnscopedData(name) - if (data) metricData.push(data) - }, this) - - return metricData -} - -/** - * @return {object} A serializable version of the scoped metrics. Intended for - * use by toJSON. - */ -Metrics.prototype._toScopedData = function _toScopedData() { - var metricData = [] - - Object.keys(this.scoped).forEach(function forEachScope(scope) { - Object.keys(this.scoped[scope]).forEach(function forEachMetric(name) { - var data = this._getScopedData(name, scope) - if (data) metricData.push(data) - }, this) - }, this) - - return metricData -} - -module.exports = Metrics diff --git a/node_modules/newrelic/lib/metrics/mapper.js b/node_modules/newrelic/lib/metrics/mapper.js deleted file mode 100644 index 234f036e..00000000 --- a/node_modules/newrelic/lib/metrics/mapper.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger').child({component: 'mapper'}) - - -/** - * To tighten up the metrics JSON, the collector will maintain a list of - * mappings from metric names (which sometimes include scopes as well) to - * numeric IDs. As the agent sends new metric names to the collector, the - * collector will return corresponding metric IDs, in the expectation that the - * agent will uses those IDs instead of the names going forward. - * - * @param {Array} raw A list of metric spec -> ID mappings represented as - * 2-element arrays: [{name : 'Metric', scope : 'Scope'}, 1] - */ -function MetricMapper(raw) { - this.unscoped = Object.create(null) - this.scoped = Object.create(null) - this.length = 0 - - this.load(raw) -} - -/** - * Parse the list of metric mappings returned on metric_data responses from the - * collector. These continue to stream in as the agent runs, so keep adding to - * the collection rather than resetting. - * - * https://hudson.newrelic.com/job/collector-master/javadoc/com/nr/collector/datatypes/MetricData.html - * - * @param {Array} raw A list of metric spec -> ID mappings represented as - * 2-element arrays: [{name : 'Metric', scope : 'Scope'}, 1] - */ -MetricMapper.prototype.load = function load(raw) { - if (!(raw && raw.length)) { - logger.debug("No new metric mappings from server.") - return - } - - for (var i = 0; i < raw.length; i++) { - var spec = raw[i][0] - var scope = spec.scope - var name = spec.name - var id = raw[i][1] - var resolved - - - if (scope) { - if (!this.scoped[scope]) { - this.scoped[scope] = Object.create(null) - } - resolved = this.scoped[scope] - } else { - resolved = this.unscoped - } - - if (!resolved[name]) this.length++ - resolved[name] = id - logger.trace("Metric spec %s has been mapped to ID %s.", spec, id) - } - logger.debug("Parsed %d metric ids (%d total).", raw.length, this.length) -} - -/** - * @param {String} name The metric name. - * @param {String} scope The scope for the metric, if set. - * - * @returns {object} Either a metric spec based on the parameters, or the - * server-sent ID. - */ -MetricMapper.prototype.map = function map(name, scope) { - if (scope) { - if (this.scoped[scope] && this.scoped[scope][name]) { - return this.scoped[scope][name] - } - return {name: name, scope: scope} - } - - if (this.unscoped[name]) { - return this.unscoped[name] - } - - return {name: name} -} - -module.exports = MetricMapper diff --git a/node_modules/newrelic/lib/metrics/metric-aggregator.js b/node_modules/newrelic/lib/metrics/metric-aggregator.js deleted file mode 100644 index 4be35712..00000000 --- a/node_modules/newrelic/lib/metrics/metric-aggregator.js +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'metric-aggregator'}) -const Aggregator = require('../aggregators/base-aggregator') -const Metrics = require('../metrics') - -const FROM_MILLIS = 1e-3 - -class MetricAggregator extends Aggregator { - constructor(opts, collector) { - _isValidOrThrow(opts) - - opts.method = opts.method || 'metric_data' - - super(opts, collector) - - this._apdexT = opts.apdexT - this._mapper = opts.mapper - this._normalizer = opts.normalizer - - this._metrics = new Metrics(this._apdexT, this._mapper, this._normalizer) - } - - get empty() { - return this._metrics.empty - } - - get started() { - return this._metrics.started - } - - _toPayloadSync() { - if (this._metrics.empty) { - logger.debug('No metrics to send.') - return - } - - const beginSeconds = this._metrics.started * FROM_MILLIS - const endSeconds = Date.now() * FROM_MILLIS - - const payload = [ - this.runId, - beginSeconds, - endSeconds, - this._metrics.toJSON() - ] - - return payload - } - - _getMergeData() { - return this._metrics - } - - _merge(metrics) { - if (!metrics) { - return - } - - // Adjust start when merging due to server round-trip - this.merge(metrics, true) - } - - merge(metrics, adjustStartTime) { - this._metrics.merge(metrics, adjustStartTime) - } - - clear() { - this._metrics = new Metrics(this._apdexT, this._mapper, this._normalizer) - } - - /** - * Look up the mapping from a name (and optionally a scope) to a set of metric - * data for that name, creating the data if they don't already exist. - * - * @param {string} name The name of the requested metric. - * @param {string} scope (Optional) The scope to which the metric is bound. - * @return {Stats} The aggregated data for that name. - */ - getOrCreateMetric(name, scope) { - return this._metrics.getOrCreateMetric(name, scope) - } - - /** - * This is the preferred way for interacting with metrics. Set the duration - * (and optionally the amount of that duration that was exclusive to that - * particular metric and not any child operations to that metric) of an - * operation. If there are no data for the name (and optional scope) existing, - * the collection will create a set of data before recording the measurement. - * - * @param {string} name The name of the metric. - * @param {string} scope (Optional) The scope to which the metric belongs. - * @param {Number} duration The duration of the related operation, in milliseconds. - * @param {Number} exclusive (Optional) The portion of the operation specific to this - * metric. - * @return {Stats} The aggregated data related to this metric. - */ - measureMilliseconds(name, scope, duration, exclusive) { - return this._metrics.measureMilliseconds(name, scope, duration, exclusive) - } - - /** - * Set the size of an operation. If there are no data for the name existing, - * the collection will create a set of data before recording the measurement. - * - * @param {string} name The name of the metric. - * @param {Number} size The size of the related operation, in bytes. - * @return {Stats} The aggregated data related to this metric. - */ - measureBytes(name, size) { - return this._metrics.measureBytes(name, size) - } - - /** - * Look up a metric, and don't create it if it doesn't exist. Can create scopes - * as a byproduct, but this function is only intended for use in testing, so - * it's not a big deal. - * - * @param {string} name Metric name. - * @param {string} scope (Optional) The scope, if any, to which the metric - * belongs. - * @return {object} Either a stats aggregate, an apdex stats aggregate, or - * undefined. - */ - getMetric(name, scope) { - return this._metrics.getMetric(name, scope) - } - - /** - * Look up the mapping from a name (and optionally a scope) to a set of metric - * apdex data for that name, creating the data if they don't already exist. - * - * @param {string} name The name of the requested metric. - * @param {string} scope The scope to which the metric is bound - * (optional). - * @param {number} overrideApdex A custom apdexT for this metric, in - * milliseconds. This will be the same for - * a given run, because key transaction metrics - * are set at connect time via server-side - * configuration. - * - * @return {ApdexStats} The aggregated data for that name. - */ - getOrCreateApdexMetric(name, scope, overrideApdex) { - return this._metrics.getOrCreateApdexMetric(name, scope, overrideApdex) - } - - reconfigure(config) { - super.reconfigure(config) - - this._apdexT = config.apdex_t - this._metrics.apdexT = this._apdexT - } -} - -function _isValidOrThrow(opts) { - if (!opts) { - throw new Error('Metric aggregator must be created with options.') - } - - if (opts.apdexT == null || opts.apdexT === '') { - throw new Error("Metric aggregator must be created with apdexT") - } - - if (!opts.mapper) { - throw new Error("Metric aggregator must be created with a mapper") - } - - if (!opts.normalizer) { - throw new Error("Metric aggregator must be created with a name normalizer") - } -} - -module.exports = MetricAggregator diff --git a/node_modules/newrelic/lib/metrics/names.js b/node_modules/newrelic/lib/metrics/names.js deleted file mode 100644 index 671c5a4f..00000000 --- a/node_modules/newrelic/lib/metrics/names.js +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const NODEJS = { - PREFIX: 'Nodejs/' -} - -const ALL = 'all' - -const SUPPORTABILITY = { - PREFIX: 'Supportability/', - UNINSTRUMENTED: 'Supportability/Uninstrumented', - EVENTS: 'Supportability/Events', - API: 'Supportability/API', - TRANSACTION_API: 'Supportability/API/Transaction', - UTILIZATION: 'Supportability/utilization', - DEPENDENCIES: 'Supportability/InstalledDependencies', - NODEJS: 'Supportability/Nodejs', - REGISTRATION: 'Supportability/Registration', - EVENT_HARVEST: 'Supportability/EventHarvest', - INFINITE_TRACING: 'Supportability/InfiniteTracing' -} - -const ERRORS = { - PREFIX: 'Errors/', - ALL: 'Errors/' + ALL, - EXPECTED: 'ErrorsExpected/' + ALL, - WEB: 'Errors/allWeb', - OTHER: 'Errors/allOther' -} - -const EVENTS = { - WAIT: 'Events/wait', - DROPPED: SUPPORTABILITY.PREFIX + 'AnalyticsEvents/Discarded', - SEEN: SUPPORTABILITY.PREFIX + 'AnalyticsEvents/TotalEventsSeen', - SENT: SUPPORTABILITY.PREFIX + 'AnalyticsEvents/TotalEventsSent' -} - -const MEMORY = { - PHYSICAL: 'Memory/Physical', - FREE_HEAP: 'Memory/Heap/Free', - USED_HEAP: 'Memory/Heap/Used', - MAX_HEAP: 'Memory/Heap/Max', - USED_NONHEAP: 'Memory/NonHeap/Used' -} - -const CPU = { - SYSTEM_TIME: 'CPU/System Time', - SYSTEM_UTILIZATION: 'CPU/System/Utilization', - USER_TIME: 'CPU/User Time', - USER_UTILIZATION: 'CPU/User/Utilization' -} - -const GC = { - PREFIX: 'GC/', - PAUSE_TIME: 'GC/System/Pauses' -} - -const VIEW = { - PREFIX: 'View/', - RENDER: '/Rendering' -} - -const LOOP = { - PREFIX: NODEJS.PREFIX + 'EventLoop/', - USAGE: NODEJS.PREFIX + 'EventLoop/CPU/Usage' -} - -const DB = { - PREFIX: 'Datastore/', - STATEMENT: 'Datastore/statement', - OPERATION: 'Datastore/operation', - INSTANCE: 'Datastore/instance', - ALL: 'Datastore/' + ALL, - WEB: 'allWeb', - OTHER: 'allOther' -} - -const EXTERNAL = { - PREFIX: 'External/', - ALL: 'External/' + ALL, - WEB: 'External/allWeb', - OTHER: 'External/allOther', - APP: 'ExternalApp/', - TRANSACTION: 'ExternalTransaction/' -} - -const FUNCTION = { - PREFIX: 'Function/' -} - -const MIDDLEWARE = { - PREFIX: NODEJS.PREFIX + 'Middleware/' -} - -const FS = { - PREFIX: 'Filesystem/' -} - -const MEMCACHE = { - PREFIX: 'Memcache', - OPERATION: DB.OPERATION + '/Memcache/', - INSTANCE: DB.INSTANCE + '/Memcache/', - ALL: DB.PREFIX + 'Memcache/' + ALL -} - -const MONGODB = { - PREFIX: 'MongoDB', - STATEMENT: DB.STATEMENT + '/MongoDB/', - OPERATION: DB.OPERATION + '/MongoDB/', - INSTANCE: DB.INSTANCE + '/MongoDB/' -} - -const MYSQL = { - PREFIX: 'MySQL', - STATEMENT: DB.STATEMENT + '/MySQL/', - OPERATION: DB.OPERATION + '/MySQL/', - INSTANCE: DB.INSTANCE + '/MySQL/' -} - -const REDIS = { - PREFIX: 'Redis', - OPERATION: DB.OPERATION + '/Redis/', - INSTANCE: DB.INSTANCE + '/Redis/', - ALL: DB.PREFIX + 'Redis/' + ALL -} - -const POSTGRES = { - PREFIX: 'Postgres', - STATEMENT: DB.STATEMENT + '/Postgres/', - OPERATION: DB.OPERATION + '/Postgres/', - INSTANCE: DB.INSTANCE + '/Postgres/' -} - -const CASSANDRA = { - PREFIX: 'Cassandra', - OPERATION: DB.OPERATION + '/Cassandra/', - STATEMENT: DB.STATEMENT + '/Cassandra/', - INSTANCE: DB.INSTANCE + '/Cassandra/', - ALL: DB.PREFIX + 'Cassandra/' + ALL - -} - -const ORACLE = { - PREFIX: 'Oracle', - STATEMENT: DB.STATEMENT + '/Oracle/', - OPERATION: DB.OPERATION + '/Oracle/', - INSTANCE: DB.INSTANCE + '/Oracle/' -} - -const EXPRESS = { - PREFIX: 'Expressjs/', - MIDDLEWARE: MIDDLEWARE.PREFIX + 'Expressjs/', - ERROR_HANDLER: MIDDLEWARE.PREFIX + 'Expressjs/' -} - -const RESTIFY = { - PREFIX: 'Restify/' -} - -const HAPI = { - PREFIX: 'Hapi/', - MIDDLEWARE: MIDDLEWARE.PREFIX + 'Hapi/', -} - -const UTILIZATION = { - AWS_ERROR: SUPPORTABILITY.UTILIZATION + '/aws/error', - PCF_ERROR: SUPPORTABILITY.UTILIZATION + '/pcf/error', - AZURE_ERROR: SUPPORTABILITY.UTILIZATION + '/azure/error', - GCP_ERROR: SUPPORTABILITY.UTILIZATION + '/gcp/error', - DOCKER_ERROR: SUPPORTABILITY.UTILIZATION + '/docker/error', - BOOT_ID_ERROR: SUPPORTABILITY.UTILIZATION + '/boot_id/error' -} - - -const CUSTOM_EVENTS = { - PREFIX: SUPPORTABILITY.EVENTS + '/Customer/', - DROPPED: SUPPORTABILITY.EVENTS + '/Customer/Dropped', - SEEN: SUPPORTABILITY.EVENTS + '/Customer/Seen', - SENT: SUPPORTABILITY.EVENTS + '/Customer/Sent', - TOO_LARGE: SUPPORTABILITY.EVENTS + '/Customer/TooLarge', - FAILED: SUPPORTABILITY.EVENTS + '/Customer/FailedToSend' -} - -const TRANSACTION_ERROR = { - DROPPED: SUPPORTABILITY.EVENTS + '/TransactionError/Dropped', - SEEN: SUPPORTABILITY.EVENTS + '/TransactionError/Seen', - SENT: SUPPORTABILITY.EVENTS + '/TransactionError/Sent' -} - -const EVENT_HARVEST = { - REPORT_PERIOD: SUPPORTABILITY.EVENT_HARVEST + '/ReportPeriod', - HARVEST_LIMIT: { - ANALYTIC: SUPPORTABILITY.EVENT_HARVEST + '/AnalyticEventData/HarvestLimit', - CUSTOM: SUPPORTABILITY.EVENT_HARVEST + '/CustomEventData/HarvestLimit', - ERROR: SUPPORTABILITY.EVENT_HARVEST + '/ErrorEventData/HarvestLimit', - SPAN: SUPPORTABILITY.EVENT_HARVEST + '/SpanEventData/HarvestLimit' - } -} - -const WEB = { - RESPONSE_TIME: 'WebTransaction', - FRAMEWORK_PREFIX: 'WebFrameworkUri', - TOTAL_TIME: 'WebTransactionTotalTime' -} - -const OTHER_TRANSACTION = { - PREFIX: 'OtherTransaction', - RESPONSE_TIME: 'OtherTransaction', - TOTAL_TIME: 'OtherTransactionTotalTime', - MESSAGE: 'OtherTransaction/Message' -} - -const MESSAGE_TRANSACTION = { - PREFIX: 'OtherTransaction/Message', - RESPONSE_TIME: 'OtherTransaction/Message', - TOTAL_TIME: 'OtherTransactionTotalTime/Message' -} - -const TRUNCATED = { - PREFIX: 'Truncated/' -} - -const DISTRIBUTED_TRACE = { - DURATION: 'DurationByCaller', - ERRORS: 'ErrorsByCaller', - TRANSPORT: 'TransportDuration' -} - -const SPAN_EVENTS = { - SEEN: SUPPORTABILITY.PREFIX + 'SpanEvent/TotalEventsSeen', - SENT: SUPPORTABILITY.PREFIX + 'SpanEvent/TotalEventsSent', - DROPPED: SUPPORTABILITY.PREFIX + 'SpanEvent/Discarded' -} - -const INFINITE_TRACING = { - SEEN: SUPPORTABILITY.INFINITE_TRACING + '/Span/Seen', - SENT: SUPPORTABILITY.INFINITE_TRACING + '/Span/Sent', - DROPPED: SUPPORTABILITY.INFINITE_TRACING + '/Span/Dropped', - SPAN_RESPONSE_ERROR: SUPPORTABILITY.INFINITE_TRACING + '/Span/Response/Error', - SPAN_RESPONSE_GRPC_UNIMPLEMENTED: SUPPORTABILITY.INFINITE_TRACING + '/Span/gRPC/UNIMPLEMENTED', - SPAN_RESPONSE_GRPC_STATUS: SUPPORTABILITY.INFINITE_TRACING + '/Span/gRPC/%s', - QUEUE_CAPACITY: SUPPORTABILITY.INFINITE_TRACING + '/Span/QueueCapacity', - QUEUE_SIZE: SUPPORTABILITY.INFINITE_TRACING + '/Span/QueueSize', - DRAIN_DURATION: SUPPORTABILITY.INFINITE_TRACING + '/Drain/Duration', -} - -module.exports = { - ACTION_DELIMITER: '/', - ALL: ALL, - APDEX: 'Apdex', - CASSANDRA: CASSANDRA, - CLIENT_APPLICATION: 'ClientApplication', - CONTROLLER: 'Controller', - CPU: CPU, - CUSTOM: 'Custom', - CUSTOM_EVENTS: CUSTOM_EVENTS, - DB: DB, - DISTRIBUTED_TRACE, - ERRORS: ERRORS, - EVENTS: EVENTS, - EVENT_HARVEST: EVENT_HARVEST, - EXPRESS: EXPRESS, - EXTERNAL: EXTERNAL, - FS: FS, - FUNCTION: FUNCTION, - GC: GC, - HAPI: HAPI, - HTTP: 'HttpDispatcher', - INFINITE_TRACING: INFINITE_TRACING, - LOOP: LOOP, - MEMCACHE: MEMCACHE, - MEMORY: MEMORY, - MESSAGE_TRANSACTION: MESSAGE_TRANSACTION, - MIDDLEWARE: MIDDLEWARE, - MONGODB: MONGODB, - MYSQL: MYSQL, - NODEJS: NODEJS, - NORMALIZED: 'NormalizedUri', - ORACLE: ORACLE, - OTHER_TRANSACTION: OTHER_TRANSACTION, - POSTGRES: POSTGRES, - QUEUETIME: 'WebFrontend/QueueTime', - REDIS: REDIS, - RESTIFY: RESTIFY, - SPAN_EVENTS: SPAN_EVENTS, - SUPPORTABILITY: SUPPORTABILITY, - TRANSACTION_ERROR: TRANSACTION_ERROR, - TRUNCATED: TRUNCATED, - URI: 'Uri', - UTILIZATION: UTILIZATION, - VIEW: VIEW, - WEB: WEB -} diff --git a/node_modules/newrelic/lib/metrics/normalizer.js b/node_modules/newrelic/lib/metrics/normalizer.js deleted file mode 100644 index cca5bf95..00000000 --- a/node_modules/newrelic/lib/metrics/normalizer.js +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var EventEmitter = require('events').EventEmitter -var util = require('util') -var logger = require('../logger').child({component: 'metric_normalizer'}) -var deepEqual = require('../util/deep-equal') -var NormalizerRule = require('./normalizer/rule') -var NAMES = require('../metrics/names.js') - - -function url(normalized, path, config) { - if (normalized) return NAMES.NORMALIZED + normalized - - if (config.enforce_backstop) { - return NAMES.NORMALIZED + '/*' - } - - return NAMES.URI + path -} - -function plain(normalized, path) { - if (normalized) { - return normalized - } - - return path -} - -/** - * The collector keeps track of rules that should be applied to metric names, - * and sends these rules to the agent at connection time. These rules can - * either change the name of the metric or indicate that metrics associated with - * this name (which is generally a URL path) should be ignored altogether. - * - * @param {object} config The agent's configuration blob, which has a parameter - * that indicates whether to enforce the normalization - * backstop. - */ -function MetricNormalizer(config, type) { - if (!config) throw new Error("normalizer must be created with configuration.") - if (!type) throw new Error("normalizer must be created with a type.") - - EventEmitter.call(this) - - this.config = config - this.type = type - // some mildly cheesy polymorphism to make normalizers work generically - if (type === 'URL') { - this.formatter = url - } else { - this.formatter = plain - } - - this.rules = [] -} -util.inherits(MetricNormalizer, EventEmitter) - -// -------------------------------------------------------------------------- // - -/** - * @typedef {Object} NormalizationResults - * - * @property {bool} matched - True if a rule was found that matched. - * @property {bool} ignore - True if the given input should be ignored. - * @property {string} value - The normalized input value. - */ - -// -------------------------------------------------------------------------- // - -/** - * Convert the raw, de-serialized JSON response into a set of - * NormalizationRules. - * - * @param object json The de-serialized JSON response sent on collector - * connection. - */ -MetricNormalizer.prototype.load = function load(json) { - if (json) { - this.rules = [] - logger.debug("Received %s %s normalization rule(s) from the server", - json.length, this.type) - - json.forEach(function cb_forEach(ruleJSON) { - // no need to add the same rule twice - var rule = new NormalizerRule(ruleJSON) - if (!this.rules.find(deepEqual.bind(null, rule))) { - this.rules.push(rule) - logger.trace("Loaded %s normalization rule: %s", this.type, rule) - } - }, this) - - /* I (FLN) always forget this, so making a note: JS sort is always - * IN-PLACE, even though it returns the sorted array. - */ - this.rules.sort(function cb_sort(a, b) { - return a.precedence - b.precedence - }) - - logger.debug("Loaded %s %s normalization rule(s).", this.rules.length, this.type) - } -} - -/** - * Load any rules found in the configuration into a metric normalizer. - * - * Operates via side effects. - */ -MetricNormalizer.prototype.loadFromConfig = function loadFromConfig() { - var rules = this.config.rules - - if (rules && rules.name && rules.name.length > 0) { - rules.name.forEach(function cb_forEach(rule) { - if (!rule.pattern) { - return logger.error( - {rule: rule}, - "Simple naming rules require a pattern." - ) - } - if (!rule.name) { - return logger.error( - {rule: rule}, - "Simple naming rules require a replacement name." - ) - } - - var precedence = rule.precedence - var terminal = rule.terminate_chain - var json = { - match_expression: rule.pattern, - eval_order: (typeof precedence === 'number') ? precedence : 500, - terminate_chain: (typeof terminal === 'boolean') ? terminal : true, - replace_all: rule.replace_all, - replacement: rule.name, - ignore: false - } - - // Find where the rule should be inserted and do so. - var reverse = this.config.feature_flag.reverse_naming_rules - var insert = this.rules.findIndex(function findRule(r) { - return reverse - ? r.precedence >= json.eval_order - : r.precedence > json.eval_order - }) - if (insert === -1) { - this.rules.push(new NormalizerRule(json)) - } else { - this.rules.splice(insert, 0, new NormalizerRule(json)) - } - }, this) - } - - if (rules && rules.ignore && rules.ignore.length > 0) { - rules.ignore.forEach(function cb_forEach(pattern) { - this.addSimple(pattern) - }, this) - } -} - -/** - * Add simple, user-provided rules to the head of the match list. These rules - * will always be highest precedence, always will terminate matching, and - * will always apply to the URL as a whole. If no name is provided, then - * transactions attached to the matching URLs will be ignored. - * - * - `addSimple(opts)` - * - `addSimple(pattern [, name])` - * - * @param {RegExp} pattern The pattern to rename (with capture groups). - * @param {string} [name] The name to use for the transaction. - */ -MetricNormalizer.prototype.addSimple = function addSimple(pattern, name) { - if (!pattern) return logger.error("Simple naming rules require a pattern.") - - var json = { - match_expression: pattern, - eval_order: 0, - terminate_chain: true, - replace_all: false, - replacement: null, - ignore: false - } - - if (name) { - json.replacement = name - } else { - json.ignore = true - } - - this.rules.unshift(new NormalizerRule(json)) -} - -/** - * Turn a (scrubbed) URL path into partial metric name. - * - * @param {string} path - The URL path to turn into a name. - * - * @returns {NormalizationResults} - The results of normalization. - */ -MetricNormalizer.prototype.normalize = function normalize(path) { - var last = path - var length = this.rules.length - var normalized - var matched = false - var ignored = false - - // Apply each of our rules in turn. - for (var i = 0; i < length; i++) { - var rule = this.rules[i] - var applied = rule.apply(last) - if (!rule.matched) { - continue - } - - if (rule.ignore) { - ignored = true - } else { - matched = true - normalized = applied - - // emit event when a rule is matched - // we could also include an array of matched rules in the returned map, but - // that would increase memory overhead by creating additional array - this.emit('appliedRule', rule, normalized, last) - - logger.trace({rule: rule, type: this.type}, - "Normalized %s to %s.", last, normalized) - last = normalized - } - - if (rule.isTerminal) { - logger.trace({rule: rule}, "Terminating normalization.") - break - } - } - - // Return the normalized path. - return { - matched: matched, - ignore: ignored, - value: this.formatter(normalized, path, this.config) - } -} - -module.exports = MetricNormalizer diff --git a/node_modules/newrelic/lib/metrics/normalizer/rule.js b/node_modules/newrelic/lib/metrics/normalizer/rule.js deleted file mode 100644 index c4cacd9d..00000000 --- a/node_modules/newrelic/lib/metrics/normalizer/rule.js +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../../logger').child({component: 'normalizer_rule'}) - - -/** - * JavaScript just has to do things slightly differently. - */ -var replaceReplacer = function replaceReplacer(input) { - return input.replace(/\\/g, '$') -} - -/** - * Be liberal about accepting incomplete information, because we don't want - * bad rules from the collector to crash client apps. Otherwise, this is a - * fairly straightforward mapping of the concepts in metric normalization - * rules into an object form. - * - * @param {Object} json A JavaScript object literal parsed out from the JSON - * from the collector. - */ -function NormalizerRule(json) { - if (!json) { - logger.debug( - "Received incompletely specified metric normalization rule from collector." - ) - json = Object.create(null) - } - - this.eachSegment = json.each_segment || false - this.precedence = json.eval_order || 0 - this.isTerminal = json.terminate_chain || false - this.replacement = replaceReplacer(json.replacement || '$0') - this.replaceAll = json.replace_all || false - this.ignore = json.ignore || false - this.matched = false - - var modifiers = 'i' - if (this.replaceAll) modifiers += 'g' - - // don't allow this to fail - if (json.match_expression instanceof RegExp) { - this.pattern = _addRegExpFlags(json.match_expression, modifiers) - } else { - try { - this.pattern = new RegExp(json.match_expression || '^$', modifiers) - } catch (error) { - logger.warn(error, "Problem compiling metric normalization rule pattern.") - this.pattern = /^$/ - } - } -} - -/** - * Allow the higher-level functions to operate on input uniformly. - * - * @param {string} input URL to potentially be split. - */ -NormalizerRule.prototype.getSegments = function getSegments(input) { - if (this.eachSegment) { - return input.split('/') - } - - return [input] -} - -/** - * Check if a URL matches a rule. - * - * Does not set {NormalizerRule#matched}. - * - * @param {string} input - URL to match. - * - * @return {bool} - True if this rule matches the given input, otherwise false. - */ -NormalizerRule.prototype.matches = function matches(input) { - var segments = this.getSegments(input) - - for (var i = 0; i < segments.length; ++i) { - if (this.pattern.test(segments[i])) { - return true - } - } - - return false -} - -/** - * Apply the substitutions, if any, to the input. - * - * Also sets {NormalizerRule#matched} to true if this rule did match the given - * input. - * - * String.split will return empty segments when the path has a leading slash or - * contains a run of slashes. Don't inadvertently substitute or drop these empty - * segments, or the normalized path will be wrong. - * - * XXX In Node v0.8 and Node v0.10, `RegExp#test` advances internal state and - * XXX tracks where it left off from the previous match. This has the side - * XXX effect that reusing the same object may cause false negatives if you do - * XXX not reset that state. The only way to reset the state is to set - * XXX `RegExp#lastIndex` to `0`. - * - * @param {string} input - URL to normalize. - * - * @return {string?} - The normalized url, or `null` if this is an ignore rule - * that matched this url. - */ -NormalizerRule.prototype.apply = function apply(input) { - // For ignore rules, just see if we match and return either `null` or the - // original input. - if (this.ignore) { - return (this.matched = this.matches(input)) ? null : input - } - - this.matched = false - var result = this.getSegments(input) - .map(function applyMap(segment) { - // Discussion of why we use `lastIndex` in function documentation to - // prevent de-opt due to long function. - this.pattern.lastIndex = 0 - if (segment && this.pattern.test(segment)) { - this.matched = true - return segment.replace(this.pattern, this.replacement) - } - return segment - }, this) - .join('/') - return input[0] === '/' && result[0] !== '/' ? '/' + result : result -} - -NormalizerRule.prototype.toJSON = function toJSON() { - return { - eachSegment: this.eachSegment, - precedence: this.precedence, - isTerminal: this.isTerminal, - replacement: this.replacement, - replaceAll: this.replaceAll, - ignore: this.ignore, - pattern: this.pattern.source - } -} - -/** - * Merges the given flags with those already in a regular expression. - * - * @param {RegExp} re - The regular expression to add flags to. - * @param {string} flags - The flags to add to the regex. - * - * @return {RegExp} - A regular expression with all the given flags added. - */ -function _addRegExpFlags(re, flags) { - var foundMissing = false - var reFlags = re.flags - for (var i = 0; i < flags.length; ++i) { - if (reFlags.indexOf(flags[i]) === -1) { - foundMissing = true - reFlags += flags[i] - } - } - return foundMissing ? new RegExp(re.source, reFlags) : re -} - -module.exports = NormalizerRule diff --git a/node_modules/newrelic/lib/metrics/normalizer/tx_segment.js b/node_modules/newrelic/lib/metrics/normalizer/tx_segment.js deleted file mode 100644 index 9a15555e..00000000 --- a/node_modules/newrelic/lib/metrics/normalizer/tx_segment.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../../logger').child({component: 'tx_segment_normalizer'}) - -module.exports = TxSegmentNormalizer - -function TxSegmentNormalizer() { - this.terms = [] -} - -/** - * This normalize method is wicked. The best bet is to read the spec: - * https://newrelic.atlassian.net/wiki/pages/viewpage.action?spaceKey=eng&title=Language+agent+transaction+segment+terms+rules - * - * A copy paste of the rules that were followed: - * 1. Find the first rule where the prefix key matches the prefix of the - * transaction name. If no matching rules are found, abort. - * 2. Strip the prefix from the transaction name. - * 3. Split the rest of the transaction name into segments on slashes ('/'). - * 4. For each segment: - * If the segment appears in the array of strings given under the terms key, - * keep it unchanged. Else, replace it with a placeholder ('*') - * 5. Collapse all adjacent placeholder segments into a single '*' segment. - * 6. Join together the modified segments with slashes, and re-prepend the prefix. - * - * @param {string} path - The transaction metric path to normalize. - * - * @return {NormalizationResults} - The results of normalizing the given path. - */ -TxSegmentNormalizer.prototype.normalize = function normalize(path) { - var currentTerm - var prefix - for (var i = 0; i < this.terms.length; i++) { - currentTerm = this.terms[i] - prefix = currentTerm.prefix - if (path.lastIndexOf(prefix, 0) === -1) { - continue - } - var fragment = path.slice(prefix.length) - var parts = fragment.split('/') - var result = [] - var prev - - var segment - for (var j = 0; j < parts.length; j++) { - segment = parts[j] - - if (segment === '' && j + 1 === parts.length) break - - if (currentTerm.terms.indexOf(segment) === -1) { - if (prev === '*') continue - result.push(prev = '*') - } else { - result.push(prev = segment) - } - } - logger.trace('Normalizing %s because of rule: %s', path, currentTerm) - return { - matched: true, // To match MetricNormalizer - ignore: false, // ^^ - value: prefix + result.join('/') - } - } - - return { - matched: false, // To match MetricNormalizer - ignore: false, // ^^ - value: path - } -} - -TxSegmentNormalizer.prototype.load = function load(json) { - if (Array.isArray(json)) { - this.terms = filterRules(json) - } else { - logger.warn( - 'transaction_segment_terms was not an array got: %s (%s)', - typeof json, - json - ) - } -} - -function filterRules(rules) { - var map = Object.create(null) - - for (var i = 0, l = rules.length; i < l; ++i) { - var prefix = rules[i].prefix - - if (!prefix || typeof prefix !== 'string') continue - - if (prefix[prefix.length - 1] !== '/') { - prefix = prefix + '/' - rules[i].prefix = prefix - } - - var segments = prefix.split('/') - if (segments.length !== 3 || !segments[0] || !segments[1] || segments[3]) continue - - if (Array.isArray(rules[i].terms)) { - map[prefix] = rules[i] - } - } - - var keys = Object.keys(map) - var filtered = new Array(keys.length) - - for (i = 0, l = keys.length; i < l; ++i) { - filtered[i] = map[keys[i]] - } - - return filtered -} diff --git a/node_modules/newrelic/lib/metrics/recorders/custom.js b/node_modules/newrelic/lib/metrics/recorders/custom.js deleted file mode 100644 index 4b1667ec..00000000 --- a/node_modules/newrelic/lib/metrics/recorders/custom.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var NAMES = require('../names') - -function record(segment, scope) { - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var transaction = segment.transaction - var name = NAMES.CUSTOM + NAMES.ACTION_DELIMITER + segment.name - - if (scope) transaction.measure(name, scope, duration, exclusive) - - transaction.measure(name, null, duration, exclusive) -} - -module.exports = record diff --git a/node_modules/newrelic/lib/metrics/recorders/distributed-trace.js b/node_modules/newrelic/lib/metrics/recorders/distributed-trace.js deleted file mode 100644 index 8e6ef6fa..00000000 --- a/node_modules/newrelic/lib/metrics/recorders/distributed-trace.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const NAMES = require('../names') - -function recordDistributedTrace(tx, suffix, duration, exclusive) { - const distTraceReceived = !!tx.acceptedDistributedTrace - const tag = [ - tx.parentType || 'Unknown', - tx.parentAcct || 'Unknown', - tx.parentApp || 'Unknown', - tx.parentTransportType || 'Unknown', - 'all' - ].join('/') - - const suffixes = ['', suffix] - - suffixes.forEach(function record(suf) { - tx.measure( - `${NAMES.DISTRIBUTED_TRACE.DURATION}/${tag}${suf}`, - null, - duration, - exclusive - ) - - if (tx.hasErrors()) { - tx.measure( - `${NAMES.DISTRIBUTED_TRACE.ERRORS}/${tag}${suf}`, - null, - duration, - exclusive - ) - } - - if (distTraceReceived) { - tx.measure( - `${NAMES.DISTRIBUTED_TRACE.TRANSPORT}/${tag}${suf}`, - null, - duration, - exclusive - ) - } - }) -} - -module.exports = recordDistributedTrace diff --git a/node_modules/newrelic/lib/metrics/recorders/generic.js b/node_modules/newrelic/lib/metrics/recorders/generic.js deleted file mode 100644 index 59d71346..00000000 --- a/node_modules/newrelic/lib/metrics/recorders/generic.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -function record(segment, scope) { - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var transaction = segment.transaction - - - if (scope) transaction.measure(segment.name, scope, duration, exclusive) - - transaction.measure(segment.name, null, duration, exclusive) -} - -module.exports = record diff --git a/node_modules/newrelic/lib/metrics/recorders/http.js b/node_modules/newrelic/lib/metrics/recorders/http.js deleted file mode 100644 index 52796a56..00000000 --- a/node_modules/newrelic/lib/metrics/recorders/http.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const NAMES = require('../../metrics/names') -const recordDistributedTrace = require('./distributed-trace') - -const TO_MILLIS = 1e3 - -function recordWeb(segment, scope) { - // in web metrics, scope is required - if (!scope) return - - var tx = segment.transaction - // if there was a nested webTransaction use its recorder instead - if (tx.type === 'web' && tx.baseSegment && segment !== tx.baseSegment) { - return - } - - var duration = segment.getDurationInMillis() - var totalTime = tx.trace.getTotalTimeDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var partial = segment.partialName - var config = segment.transaction.agent.config - // named / key transaction support requires per-name apdexT - var keyApdexInMillis = config.web_transactions_apdex[scope] * TO_MILLIS || 0 - - tx.measure(NAMES.WEB.RESPONSE_TIME, null, duration, exclusive) - tx.measure(NAMES.WEB.TOTAL_TIME, null, totalTime, exclusive) - tx.measure(NAMES.HTTP, null, duration, exclusive) - tx.measure(scope, null, duration, exclusive) - tx.measure(NAMES.WEB.TOTAL_TIME + '/' + partial, null, totalTime, exclusive) - - if (tx.queueTime > 0) { - tx.measure(NAMES.QUEUETIME, null, tx.queueTime) - } - - if (config.distributed_tracing.enabled) { - recordDistributedTrace(tx, 'Web', duration, exclusive) - } else if (tx.incomingCatId) { - tx.measure( - NAMES.CLIENT_APPLICATION + '/' + tx.incomingCatId + "/all", - null, - tx.catResponseTime - ) - } - - tx._setApdex(NAMES.APDEX + '/' + partial, duration, keyApdexInMillis) - tx._setApdex(NAMES.APDEX, duration, keyApdexInMillis) -} - -module.exports = recordWeb diff --git a/node_modules/newrelic/lib/metrics/recorders/http_external.js b/node_modules/newrelic/lib/metrics/recorders/http_external.js deleted file mode 100644 index a7613261..00000000 --- a/node_modules/newrelic/lib/metrics/recorders/http_external.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var EXTERNAL = require('../../metrics/names').EXTERNAL - - -function recordExternal(host, library) { - return function externalRecorder(segment, scope) { - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var transaction = segment.transaction - var metricName = EXTERNAL.PREFIX + host + '/' + library - var rollupType = transaction.isWeb() ? EXTERNAL.WEB : EXTERNAL.OTHER - var rollupHost = EXTERNAL.PREFIX + host + '/all' - - if (segment.catId && segment.catTransaction) { - transaction.measure( - EXTERNAL.APP + host + '/' + segment.catId + '/all', - null, - duration, - exclusive - ) - - transaction.measure( - EXTERNAL.TRANSACTION + host + '/' + segment.catId + '/' + segment.catTransaction, - null, - duration, - exclusive - ) - - // This CAT metric replaces scoped External/{host}/{method} - if (scope) { - transaction.measure( - EXTERNAL.TRANSACTION + host + '/' + segment.catId + - '/' + segment.catTransaction, - scope, - duration, - exclusive - ) - } - } else if (scope) { - transaction.measure(metricName, scope, duration, exclusive) - } - - transaction.measure(metricName, null, duration, exclusive) - transaction.measure(rollupType, null, duration, exclusive) - transaction.measure(rollupHost, null, duration, exclusive) - transaction.measure(EXTERNAL.ALL, null, duration, exclusive) - } -} - -module.exports = recordExternal diff --git a/node_modules/newrelic/lib/metrics/recorders/message-transaction.js b/node_modules/newrelic/lib/metrics/recorders/message-transaction.js deleted file mode 100644 index 53f3a799..00000000 --- a/node_modules/newrelic/lib/metrics/recorders/message-transaction.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var NAMES = require('../../metrics/names.js') - -function recordMessageTransaction(segment, scope) { - var tx = segment.transaction - if (tx.type !== 'message' || tx.baseSegment !== segment) { - return - } - - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var totalTime = segment.transaction.trace.getTotalTimeDurationInMillis() - - var tx = segment.transaction - if (scope) { - tx.measure(scope, null, duration, exclusive) - tx.measure( - NAMES.MESSAGE_TRANSACTION.TOTAL_TIME + '/' + tx.getName(), - null, - totalTime, - exclusive - ) - } - - tx.measure( - NAMES.MESSAGE_TRANSACTION.RESPONSE_TIME + '/all', - null, - duration, - exclusive - ) - tx.measure( - NAMES.OTHER_TRANSACTION.RESPONSE_TIME + '/all', - null, - duration, - exclusive - ) - tx.measure(NAMES.OTHER_TRANSACTION.TOTAL_TIME, null, totalTime, exclusive) -} - -module.exports = recordMessageTransaction diff --git a/node_modules/newrelic/lib/metrics/recorders/other.js b/node_modules/newrelic/lib/metrics/recorders/other.js deleted file mode 100644 index 3e4d37d9..00000000 --- a/node_modules/newrelic/lib/metrics/recorders/other.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const NAMES = require('../../metrics/names') -const recordDistributedTrace = require('./distributed-trace') - -function recordBackground(segment, scope) { - // if there was a nested otherTransaction use its recorder instead - var tx = segment.transaction - if (tx.type === 'bg' && tx.baseSegment && segment !== tx.baseSegment) { - return - } - - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var totalTime = segment.transaction.trace.getTotalTimeDurationInMillis() - var name = segment.partialName - - if (scope) { - tx.measure(scope, null, duration, exclusive) - tx.measure( - NAMES.OTHER_TRANSACTION.TOTAL_TIME + '/' + name, - null, - totalTime, - exclusive - ) - } - // rollup for background total time doesn't have `/all` where the response - // time version does. - tx.measure( - NAMES.OTHER_TRANSACTION.RESPONSE_TIME + '/all', - null, - duration, - exclusive - ) - tx.measure(NAMES.OTHER_TRANSACTION.TOTAL_TIME, null, totalTime, exclusive) - - if (tx.agent.config.distributed_tracing.enabled) { - recordDistributedTrace(tx, 'Other', duration, exclusive) - } -} - -module.exports = recordBackground diff --git a/node_modules/newrelic/lib/parse-proc-cpuinfo.js b/node_modules/newrelic/lib/parse-proc-cpuinfo.js deleted file mode 100644 index 73e9f49f..00000000 --- a/node_modules/newrelic/lib/parse-proc-cpuinfo.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('./logger.js').child({component: 'proc-cpuinfo'}) -module.exports = parseProcCPUInfo - -function parseProcCPUInfo(data) { - var relevantAttributes = [ - 'processor', - 'physical id', - 'cpu cores', - 'core id' - ] - - var processorStats = { - logical: null, - cores: null, - packages: null - } - - // Tibber fix - if (!data) return processorStats - - // seperate the processors - var splitData = data.split('\n') - .map(function formatAttribute(attr) { - return attr.split(':') - .map(function eliminateExtraWhitespace(s) { - return s.replace(/\\r|\\t| {2,}/g, '').trim() - }) - }) - - var validData = splitData.filter(function checkForValidAttrs(a) { - return a.length === 2 && relevantAttributes.indexOf(a[0]) !== -1 - }) - if (validData.length === 0) { - logger.debug('No applicable cpu attributes found') - return processorStats - } - - splitData = collapseMultilineValues(splitData) - - var processors = seperateProcessors(splitData) - - processorStats = countProcessorStats(processors) - if (!processorStats.cores) { - if (processorStats.logical === 1) { - // some older, single-core processors might not list ids, - // so we'll mark them 1 - processorStats.cores = 1 - processorStats.packages = 1 - } else { - // there is no way of knowing how many packages - // or cores there are - processorStats.cores = null - processorStats.packages = null - } - } - return processorStats -} - -// some values are split up over multiple lines, these won't be broken -// by split(':'), and should be folded into the last seen valid value -function collapseMultilineValues(li) { - var tmp = [] - var last - for (var i = 0; i < li.length; ++i) { - if (li[i].length === 2) { - // store the last valid entry to append invalid entries to - last = li[i] - tmp.push(last) - } else { - last[1] += li[i][0] - } - } - - return tmp -} - -// walk through the processed list of key, value pairs and populate -// objects till you find a collision -function seperateProcessors(processorData) { - var processors = [] - var processor = Object.create(null) - for (var i = 0; i < processorData.length; ++i) { - var key = processorData[i][0] - var value = processorData[i][1] - if (processor[key] !== undefined) { - processors.push(processor) - processor = Object.create(null) - } - processor[key] = value - } - processors.push(processor) - return processors -} - -function countProcessorStats(processors) { - var phys = [] - var cores = [] - - for (var i = 0; i < processors.length; i++) { - var processor = processors[i] - if (processor['physical id'] && - processor['cpu cores'] && - phys.indexOf(processor['physical id']) === -1) { - phys.push(processor['physical id']) - cores.push(processor['cpu cores']) - } - } - - return { - logical: processors.length, - cores: cores - .map(function convertToInt(s) { - return parseInt(s, 10) - }) - .reduce(function sum(a, b) { - return a + b - }, 0), - packages: phys.length - } -} diff --git a/node_modules/newrelic/lib/parse-proc-meminfo.js b/node_modules/newrelic/lib/parse-proc-meminfo.js deleted file mode 100644 index 48015303..00000000 --- a/node_modules/newrelic/lib/parse-proc-meminfo.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('./logger.js').child({component: 'proc-meminfo'}) - -module.exports = parseProcMeminfo - -function parseProcMeminfo(data) { - // Tibber fix - if (!data) return null - - var mem_total = parseInt(data.replace(/MemTotal:\s*(\d*)\skB/, '$1'), 10) - - if (mem_total) return mem_total / 1024 - - logger.debug('Unable to parse memory string:', data) - return null -} diff --git a/node_modules/newrelic/lib/prioritized-attributes.js b/node_modules/newrelic/lib/prioritized-attributes.js deleted file mode 100644 index f844a474..00000000 --- a/node_modules/newrelic/lib/prioritized-attributes.js +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const Config = require('./config') -const logger = require('./logger').child({component: 'attributes'}) -const isValidType = require('./util/attribute-types') -const byteUtils = require('./util/byte-limit') -const properties = require('./util/properties') - -const ATTRIBUTE_PRIORITY = { - HIGH: Infinity, - LOW: -Infinity -} - -class PrioritizedAttributes { - constructor(scope, limit = Infinity) { - this.filter = makeFilter(scope) - this.limit = limit - - this.attributes = new Map() - } - - - isValidLength(str) { - return typeof str === 'number' || byteUtils.isValidLength(str, 255) - } - - _set(destinations, key, value, truncateExempt, priority) { - this.attributes.set(key, {value, destinations, truncateExempt, priority}) - } - - get(dest) { - const attrs = Object.create(null) - - for (let [key, attr] of this.attributes) { - if (!(attr.destinations & dest)) { - continue - } - - attrs[key] = typeof attr.value === 'string' && !attr.truncateExempt - ? byteUtils.truncate(attr.value, 255) - : attr.value - } - - return attrs - } - - has(key) { - this.attributes.has(key) - } - - reset() { - this.attributes = new Map() - } - - addAttribute( - destinations, - key, - value, - truncateExempt = false, - priority = ATTRIBUTE_PRIORITY.HIGH - ) { - const existingAttribute = this.attributes.get(key) - - let droppableAttributeKey = null - if (!existingAttribute && this.attributes.size === this.limit) { - droppableAttributeKey = this._getDroppableAttributeKey(priority) - - if (!droppableAttributeKey) { - logger.debug( - `Maximum number of custom attributes have been added. - Dropping attribute ${key} with ${value} type.` - ) - - return - } - } - - if (existingAttribute && priority < existingAttribute.priority) { - logger.debug('incoming priority for \'%s\' is lower than existing, not updating.', key) - logger.trace( - '%s attribute retained value: %s, ignored value: %s', - key, - existingAttribute.value, - value - ) - return - } - - if (!isValidType(value)) { - logger.debug( - 'Not adding attribute %s with %s value type. This is expected for undefined' + - 'attributes and only an issue if an attribute is not expected to be undefined' + - 'or not of the type expected.', - key, - typeof value - ) - return - } - - if (!this.isValidLength(key)) { - logger.warn( - 'Length limit exceeded for attribute name, not adding: %s', - key - ) - return - } - - - // Only set the attribute if at least one destination passed - const validDestinations = this.filter(destinations, key) - if (!validDestinations) { - return - } - - if (droppableAttributeKey) { - logger.trace( - 'dropping existing lower priority attribute %s ' + - 'to add higher priority attribute %s', - droppableAttributeKey, - key - ) - - this.attributes.delete(droppableAttributeKey) - } - - this._set(validDestinations, key, value, truncateExempt, priority) - } - - addAttributes(destinations, attrs) { - for (let key in attrs) { - if (properties.hasOwn(attrs, key)) { - this.addAttribute(destinations, key, attrs[key]) - } - } - } - - /** - * Returns true if a given key is valid for any of the - * provided destinations. - * - * @param {DESTINATIONS} destinations - * @param {string} key - */ - hasValidDestination(destinations, key) { - const validDestinations = this.filter(destinations, key) - return !!validDestinations - } - - _getDroppableAttributeKey(incomingPriority) { - // There will never be anything lower priority to drop - if (incomingPriority === ATTRIBUTE_PRIORITY.LOW) { - return null - } - - this.lastFoundIndexCache = this.lastFoundIndexCache || Object.create(null) - const lastFoundIndex = this.lastFoundIndexCache[incomingPriority] - - // We've already dropped all items lower than incomingPriority. - // We can honor the cache because at the point by which we've dropped - // all lower priority items, due to being at max capacity, there will never be another - // lower-priority item added. Lower priority items are unable to drop higher priority items. - if (lastFoundIndex === -1) { - return null - } - - // We can't reverse iterate w/o creating an array that will iterate, - // so we just iterate forward stopping once we've checked the last cached index. - let lowerPriorityAttributeName = null - let foundIndex = -1 - - let index = 0 - for (const [key, attribute] of this.attributes) { - // Don't search past last found lower priority item. - // At the point of dropping items for this priority, - // lower priority items will never be added. - if (lastFoundIndex && index > lastFoundIndex) { - break - } - - if (attribute.priority < incomingPriority) { - lowerPriorityAttributeName = key - foundIndex = index - } - - index++ - } - - // Item may not get dropped, so we simply store the index as - // an upper maximum and allow a future pass to clear out. - this.lastFoundIndexCache[incomingPriority] = foundIndex - - return lowerPriorityAttributeName - } -} - -function makeFilter(scope) { - const {attributeFilter} = Config.getInstance() - if (scope === 'transaction') { - return (d, k) => attributeFilter.filterTransaction(d, k) - } else if (scope === 'segment') { - return (d, k) => attributeFilter.filterSegment(d, k) - } -} - -module.exports = { - PrioritizedAttributes: PrioritizedAttributes, - ATTRIBUTE_PRIORITY: ATTRIBUTE_PRIORITY -} diff --git a/node_modules/newrelic/lib/priority-queue.js b/node_modules/newrelic/lib/priority-queue.js deleted file mode 100644 index 9535f0d8..00000000 --- a/node_modules/newrelic/lib/priority-queue.js +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var Heap = require('@tyriar/fibonacci-heap').FibonacciHeap - -function PriorityQueue(limit) { - this.limit = limit == null ? 10 : limit - this.seen = 0 - this._data = new Heap() - - Object.defineProperty(this, 'length', { - get: function getLength() { - return this._data._nodeCount - } - }) -} - -PriorityQueue.prototype.overflow = function overflow() { - var diff = this.seen - this.limit - return diff >= 0 ? diff : 0 -} - -PriorityQueue.prototype.getMinimumPriority = function getMinimumPriority() { - return this.length < this.limit ? 0 : this._data.findMinimum().key -} - -PriorityQueue.prototype.add = function add(value, priority) { - this.seen++ - if (this.limit <= 0) { - return false - } - priority = priority || Math.random() - if (this.length === this.limit) { - return this._replace(value, priority) - } - this._data.insert(priority, value) - return true -} - -PriorityQueue.prototype._replace = function _replace(value, priority) { - if (priority > this._data.findMinimum().key) { - this._data.insert(priority, value) - this._data.extractMinimum() - return true - } - return false -} - -PriorityQueue.prototype.getRawEvents = function getRawEvents() { - var events = [] - var min = this._data.findMinimum() - - if (min) { - _getRawEvents(min, events) - } - - return events - - function _getRawEvents(head, evts) { - var current = head - - do { - evts.push({value: current.value, priority: current.key}) - if (current.child) { - _getRawEvents(current.child, evts) - } - current = current.next - } while (current !== head) - } -} - -PriorityQueue.prototype.toArray = function toArray() { - var nodes = [] - var min = this._data.findMinimum() - - if (min) { - serializeHeap(min, nodes) - } - - return nodes - - function serializeHeap(head, arr) { - var current = head - - do { - arr.push(current.value) - if (current.child) { - serializeHeap(current.child, arr) - } - current = current.next - } while (current !== head) - } -} - -PriorityQueue.prototype.setLimit = function setLimit(newLimit) { - this.limit = newLimit - while (this.length > newLimit) { - this._data.extractMinimum() - } -} - -PriorityQueue.prototype.merge = function merge(events) { - if (!events || !events.length) { - return - } - - if (events instanceof PriorityQueue) { - while (events.length) { - var current = events._data.extractMinimum() - this.add(current.value, current.key) - } - } else { - for (var i = 0; i < events.length; ++i) { - this.add(events[i].value, events[i].priority) - } - } -} - -module.exports = PriorityQueue diff --git a/node_modules/newrelic/lib/proxy/grpc.js b/node_modules/newrelic/lib/proxy/grpc.js deleted file mode 100644 index dbf49067..00000000 --- a/node_modules/newrelic/lib/proxy/grpc.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' -class ProxyGrpc { - constructor(grpcLibrary = '@grpc/grpc-js') { - this.library = require(grpcLibrary) - - // add methods or objets from base grpc class that we need as needed - this.credentials = this.library.credentials - this.Metadata = this.library.Metadata - this.loadPackageDefinition = this.library.loadPackageDefinition - this.status = this.library.status - this.Server = this.library.Server - this.ServerCredentials = this.library.ServerCredentials - } -} -module.exports = (new ProxyGrpc) diff --git a/node_modules/newrelic/lib/reservoir.js b/node_modules/newrelic/lib/reservoir.js deleted file mode 100644 index d869ffcb..00000000 --- a/node_modules/newrelic/lib/reservoir.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// from http://en.wikipedia.org/wiki/Reservoir_sampling - -function Reservoir(limit) { - this.limit = limit || 10 - this.seen = 0 - this._data = [] -} - -Reservoir.prototype.overflow = function overflow() { - var diff = this.seen - this.limit - return diff >= 0 ? diff : 0 -} - -Reservoir.prototype.add = function add(item) { - if (this.seen < this.limit) { - this._data.push(item) - } else { - // Take a number between 0 and n + 1, drop the element at that index - // from the array. If the element to drop is the (n + 1)th, the new item is - // not added, otherwise the new item replaces the item that was - // dropped. - // This is effectively the same as adding the new element to the - // end, swapping the last element (the new one) with a random element in the list, - // then dropping the last element (the potentially swapped one) in the list. - var toReplace = Math.floor(Math.random() * (this.seen + 2)) - if (toReplace < this.limit) this._data[toReplace] = item - } - this.seen++ -} - -Reservoir.prototype.toArray = function toArray() { - return this._data -} - -Reservoir.prototype.merge = function merge(items) { - if (!items || !items.length) return - if (items === this._data) return - for (var i = 0; i < items.length; i++) { - this.add(items[i]) - } -} - -Reservoir.prototype.setLimit = function setLimit(newLimit) { - this.limit = newLimit - if (this._data.length > newLimit) { - this._data = this._data.slice(0, newLimit) - } -} - -module.exports = Reservoir diff --git a/node_modules/newrelic/lib/sampler.js b/node_modules/newrelic/lib/sampler.js deleted file mode 100644 index 30a454cd..00000000 --- a/node_modules/newrelic/lib/sampler.js +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var NAMES = require('./metrics/names') -var logger = require('./logger').child({component: 'sampler'}) -var Timer = require('./timer') -var os = require('os') - -/* - * - * CONSTANTS - * - */ -var MILLIS = 1e3 -var MICROS = 1e6 -var CPUS = os.cpus().length -var SAMPLE_INTERVAL = 15 * MILLIS - -var samplers = [] - -function Sampler(sampler, interval) { - this.id = setInterval(sampler, interval) - this.id.unref() -} - -Sampler.prototype.stop = function stop() { - clearInterval(this.id) -} - -function recordQueueTime(agent, timer) { - timer.end() - agent.metrics.measureMilliseconds(NAMES.EVENTS.WAIT, null, timer.getDurationInMillis()) -} - -function sampleMemory(agent) { - return function memorySampler() { - try { - var mem = process.memoryUsage() - agent.metrics.measureBytes(NAMES.MEMORY.PHYSICAL, mem.rss) - agent.metrics.measureBytes(NAMES.MEMORY.USED_HEAP, mem.heapUsed) - agent.metrics.measureBytes(NAMES.MEMORY.MAX_HEAP, mem.heapTotal) - agent.metrics.measureBytes(NAMES.MEMORY.FREE_HEAP, mem.heapTotal - mem.heapUsed) - agent.metrics.measureBytes(NAMES.MEMORY.USED_NONHEAP, mem.rss - mem.heapTotal) - logger.trace(mem, 'Recorded memory') - } catch (e) { - logger.debug('Could not record memory usage', e) - } - } -} - -function checkEvents(agent) { - return function eventSampler() { - var timer = new Timer() - timer.begin() - setTimeout(recordQueueTime.bind(null, agent, timer), 0) - } -} - -function getCpuSample(lastSample) { - try { - return process.cpuUsage(lastSample) - } catch (e) { - logger.debug('Could not record cpu usage', e) - return null - } -} - -function generateCPUMetricRecorder(agent) { - var lastSampleTime - // userTime and sysTime are in seconds - return function recordCPUMetrics(userTime, sysTime) { - var elapsedUptime - if (!lastSampleTime) { - elapsedUptime = process.uptime() - } else { - elapsedUptime = (Date.now() - lastSampleTime) / MILLIS - } - - var totalCpuTime = CPUS * elapsedUptime - - lastSampleTime = Date.now() - - var userUtil = userTime / totalCpuTime - var sysUtil = sysTime / totalCpuTime - - recordValue(agent, NAMES.CPU.USER_TIME, userTime) - recordValue(agent, NAMES.CPU.SYSTEM_TIME, sysTime) - recordValue(agent, NAMES.CPU.USER_UTILIZATION, userUtil) - recordValue(agent, NAMES.CPU.SYSTEM_UTILIZATION, sysUtil) - } -} - -function sampleCpu(agent) { - var lastSample - var recordCPU = generateCPUMetricRecorder(agent) - return function cpuSampler() { - var cpuSample = getCpuSample(lastSample) - lastSample = getCpuSample() - - if (lastSample == null) { - return - } - - recordCPU(cpuSample.user / MICROS, cpuSample.system / MICROS) - } -} - -function sampleCpuNative(agent, nativeMetrics) { - var recordCPU = generateCPUMetricRecorder(agent) - nativeMetrics.on('usage', function collectResourceUsage(usage) { - recordCPU(usage.diff.ru_utime / MILLIS, usage.diff.ru_stime / MILLIS) - }) - - return function cpuSampler() { - // NOOP? - } -} - -function sampleLoop(agent, nativeMetrics) { - return function loopSampler() { - // Convert from microseconds to seconds - const loopMetrics = nativeMetrics.getLoopMetrics() - divideMetric(loopMetrics.usage, MICROS) - - recordCompleteMetric(agent, NAMES.LOOP.USAGE, loopMetrics.usage) - } -} - -function sampleGc(agent, nativeMetrics) { - return function gcSampler() { - const gcMetrics = nativeMetrics.getGCMetrics() - - Object.keys(gcMetrics).forEach(function forEachGCType(gcType) { - // Convert from milliseconds to seconds. - const gc = gcMetrics[gcType] - divideMetric(gc.metrics, MILLIS) - - recordCompleteMetric(agent, NAMES.GC.PAUSE_TIME, gc.metrics) - if (gc.type) { - recordCompleteMetric(agent, NAMES.GC.PREFIX + gc.type, gc.metrics) - } else { - logger.debug(gc, 'Unknown GC type %j', gc.typeId) - } - }) - } -} - -var sampler = module.exports = { - state: 'stopped', - sampleMemory: sampleMemory, - checkEvents: checkEvents, - sampleCpu: sampleCpu, - sampleGc: sampleGc, - sampleLoop: sampleLoop, - nativeMetrics: null, - - start: function start(agent) { - samplers.push(new Sampler(sampleMemory(agent), 5 * MILLIS)) - samplers.push(new Sampler(checkEvents(agent), SAMPLE_INTERVAL)) - - // This requires a native module which may have failed to build. - if (agent.config.plugins.native_metrics.enabled && !this.nativeMetrics) { - try { - this.nativeMetrics = require('@newrelic/native-metrics')({ - timeout: SAMPLE_INTERVAL - }) - } catch (err) { - logger.info( - {error: {message: err.message, stack: err.stack}}, - 'Not adding native metric sampler.' - ) - agent.metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.DEPENDENCIES + '/NoNativeMetricsModule' - ).incrementCallCount() - } - } - - if (this.nativeMetrics) { - if (!this.nativeMetrics.bound) { - this.nativeMetrics.bind(SAMPLE_INTERVAL) - } - - // Add GC events if available. - if (this.nativeMetrics.gcEnabled) { - samplers.push(new Sampler(sampleGc(agent, this.nativeMetrics), SAMPLE_INTERVAL)) - } - - // Add loop metrics if available. - if (this.nativeMetrics.loopEnabled) { - samplers.push(new Sampler(sampleLoop(agent, this.nativeMetrics), SAMPLE_INTERVAL)) - } - } - - // Add CPU sampling using the built-in data if available, otherwise pulling - // from the native module. - if (process.cpuUsage) { // introduced in 6.1.0 - samplers.push(new Sampler(sampleCpu(agent), SAMPLE_INTERVAL)) - } else if (this.nativeMetrics && this.nativeMetrics.usageEnabled) { - samplers.push( - new Sampler(sampleCpuNative(agent, this.nativeMetrics), SAMPLE_INTERVAL) - ) - } else { - logger.debug('Not adding CPU metric sampler.') - } - - sampler.state = 'running' - }, - - stop: function stop() { - samplers.forEach(function forEachSampler(s) { - s.stop() - }) - samplers = [] - sampler.state = 'stopped' - if (this.nativeMetrics) { - this.nativeMetrics.unbind() - this.nativeMetrics.removeAllListeners() - - // Setting this.nativeMetrics to null allows us to config a new - // nativeMetrics object after the first start call. - this.nativeMetrics = null - } - } -} - -function recordValue(agent, metric, value) { - var stats = agent.metrics.getOrCreateMetric(metric) - stats.recordValue(value) - logger.trace('Recorded metric %s: %j', metric, value) -} - -function recordCompleteMetric(agent, metricName, metric) { - var stats = agent.metrics.getOrCreateMetric(metricName) - stats.merge(metric) - logger.trace('Recorded metric %s: %j', metricName, metric) -} - -function divideMetric(metric, divisor) { - metric.min /= divisor - metric.max /= divisor - metric.total /= divisor - metric.sumOfSquares /= (divisor * divisor) -} diff --git a/node_modules/newrelic/lib/serverless/api-gateway.js b/node_modules/newrelic/lib/serverless/api-gateway.js deleted file mode 100644 index daab51f6..00000000 --- a/node_modules/newrelic/lib/serverless/api-gateway.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/** - * This class captures data needed to construct a web transaction from - * a API Gateway Lambda proxy request. This is to be used with the setWebRequest - * method. - */ -class LambdaProxyWebRequest { - constructor(event) { - this.headers = event.headers - this.url = { - 'path': event.path, - 'port': event.headers['X-Forwarded-Port'], - 'requestParameters': event.queryStringParameters - } - this.method = event.httpMethod - this.transportType = event.headers['X-Forwarded-Proto'] - } -} - -/** - * This class captures data necessary to create a web transaction from the lambda's web - * response to API Gateway when used with API Gateway Lambda proxy. This is to be used - * with the setWebResponse method. - */ -class LambdaProxyWebResponse { - constructor(lambdaResponse) { - this.headers = lambdaResponse.headers - this.statusCode = lambdaResponse.statusCode - } -} - -/** - * Determines if Lambda event appears to be a valid Lambda Proxy event. - * - * @param {Object} event The event to inspect. - * - * @returns {boolean} Whether the given object contains fields necessary - * to create a web transaction. - */ -function isLambdaProxyEvent(event) { - return !!(event.path && event.headers && event.httpMethod) -} - -/** - * Determines if Lambda event appears to be a valid Lambda Proxy response. - * - * @param {Object} event The response to inspect. - * - * @returns {boolean} Whether the given object contains fields necessary - * to create a web transaction. - */ -function isValidLambdaProxyResponse(response) { - return !!(response && response.statusCode) -} - -module.exports = { - LambdaProxyWebRequest, - LambdaProxyWebResponse, - isLambdaProxyEvent, - isValidLambdaProxyResponse -} diff --git a/node_modules/newrelic/lib/serverless/aws-lambda.js b/node_modules/newrelic/lib/serverless/aws-lambda.js deleted file mode 100644 index c001ac53..00000000 --- a/node_modules/newrelic/lib/serverless/aws-lambda.js +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const apiGateway = require('./api-gateway') -const headerAttributes = require('../header-attributes') -const get = require('../util/get') -const logger = require('../logger').child({component: 'aws-lambda'}) -const recordBackground = require('../metrics/recorders/other') -const recordWeb = require('../metrics/recorders/http') -const TransactionShim = require('../shim/transaction-shim') -const urltils = require('../util/urltils') - -// CONSTANTS -const ATTR_DEST = require('../config/attribute-filter').DESTINATIONS -const COLD_START_KEY = 'aws.lambda.coldStart' -const EVENT_SOURCE_PREFIX = 'aws.lambda.eventSource' -const EVENT_SOURCE_ARN_KEY = `${EVENT_SOURCE_PREFIX}.arn` -const EVENT_SOURCE_TYPE_KEY = `${EVENT_SOURCE_PREFIX}.eventType` -const NAMES = require('../metrics/names') - -const EVENT_SOURCE_INFO = require('./event-sources') - -// A function with no references used to stub out closures -function cleanClosure() {} - -// this array holds all the closures used to end transactions -let transactionEnders = [] - -// this tracks unhandled exceptions to be able to relate them back to -// the invocation transaction. -let uncaughtException = null - -// Tracking the first time patchLambdaHandler is called for one off functionality -let patchCalled = false -let coldStartRecorded = false - -class AwsLambda { - constructor(agent) { - this.agent = agent - this.shim = new TransactionShim(agent, 'aws-lambda') - } - - // FOR TESTING PURPOSES ONLY - _resetModuleState() { - patchCalled = false - coldStartRecorded = false - transactionEnders = [] - } - - _detectEventType(event) { - const pathMatch = (obj, path) => { - return get(obj, path, null) !== null - } - - for (const typeInfo of Object.values(EVENT_SOURCE_INFO)) { - if (typeInfo.required_keys.every((path) => pathMatch(event, path))) { - return typeInfo - } - } - - return null - } - - patchLambdaHandler(handler) { - const awsLambda = this - const shim = this.shim - - if (typeof handler !== 'function') { - logger.warn('handler argument is not a function and cannot be recorded') - return handler - } - - if (!patchCalled) { - // Only wrap emit on process the first time patch is called. - patchCalled = true - - // There is no prependListener in node 4, so we wrap emit to look for 'beforeExit' - // NOTE: This may be converted to holding onto a single ender function if only - // one invocation is executing at a time. - shim.wrap(process, 'emit', function wrapEmit(shim, emit) { - return function wrappedEmit(ev) { - if (ev === 'beforeExit') { - transactionEnders.forEach((ender) => { - ender() - }) - transactionEnders = [] - } - return emit.apply(process, arguments) - } - }) - - shim.wrap(process, '_fatalException', function wrapper(shim, original) { - return function wrappedFatalException(error) { - // logic placed before the _fatalException call, since it ends the invocation - uncaughtException = error - transactionEnders.forEach((ender) => { - ender() - }) - transactionEnders = [] - return original.apply(this, arguments) - } - }) - } - - return shim.bindCreateTransaction(wrappedHandler, {type: shim.BG}) - - function wrappedHandler() { - const args = shim.argsToArray.apply(shim, arguments) - - const event = args[0] - const context = args[1] - - const functionName = context.functionName - const group = NAMES.FUNCTION.PREFIX - const transactionName = group + functionName - - const transaction = shim.tracer.getTransaction() - if (!transaction) { - return handler.apply(this, arguments) - } - - transaction.setPartialName(transactionName) - - const isApiGatewayLambdaProxy = apiGateway.isLambdaProxyEvent(event) - const segmentRecorder = isApiGatewayLambdaProxy ? recordWeb : recordBackground - const segment = shim.createSegment(functionName, segmentRecorder) - transaction.baseSegment = segment - - // resultProcessor is used to execute additional logic based on the - // payload supplied to the callback. - let resultProcessor - if (isApiGatewayLambdaProxy) { - const webRequest = new apiGateway.LambdaProxyWebRequest(event) - setWebRequest(shim, transaction, webRequest) - resultProcessor = getApiGatewayLambdaProxyResultProcessor(transaction) - } - - - const cbIndex = args.length - 1 - - // Add transaction ending closure to the list of functions to be called on - // beforeExit (i.e. in the case that context.{done,fail,succeed} or callback - // were not called). - const txnEnder = endTransaction.bind( - null, - transaction, - transactionEnders.length - ) - - transactionEnders.push(txnEnder) - - args[cbIndex] = wrapCallbackAndCaptureError( - transaction, - txnEnder, - args[cbIndex], - resultProcessor - ) - - // context.{done,fail,succeed} are all considered deprecated by - // AWS, but are considered functional. - context.done = wrapCallbackAndCaptureError(transaction, txnEnder, context.done) - context.fail = wrapCallbackAndCaptureError(transaction, txnEnder, context.fail) - shim.wrap(context, 'succeed', function wrapSucceed(shim, original) { - return function wrappedSucceed() { - txnEnder() - return original.apply(this, arguments) - } - }) - - const awsAttributes = awsLambda._getAwsAgentAttributes(event, context) - transaction.trace.attributes.addAttributes( - ATTR_DEST.TRANS_COMMON, - awsAttributes - ) - - shim.agent.setLambdaArn(context.invokedFunctionArn) - - shim.agent.setLambdaFunctionVersion(context.functionVersion) - - segment.addSpanAttributes(awsAttributes) - - segment.start() - - let res - try { - res = shim.applySegment(handler, segment, false, this, args) - } catch (err) { - uncaughtException = err - txnEnder() - throw err - } - if (shim.isPromise(res)) { - res = lambdaInterceptPromise(res, txnEnder) - } - return res - } - - // In order to capture error events - // we need to store the error in uncaughtException - // otherwise the transaction will end before they are captured - function lambdaInterceptPromise(prom, cb) { - return prom.then(function onThen(arg) { - cb() - return arg - }, function onCatch(err) { - uncaughtException = err - cb() - throw err // This is not our error, just rethrowing the promise rejection. - }) - } - - function wrapCallbackAndCaptureError(transaction, txnEnder, cb, processResult) { - return function wrappedCallback() { - let err = arguments[0] - if (typeof err === 'string') { - err = new Error(err) - } - - shim.agent.errors.add(transaction, err) - - if (processResult) { - const result = arguments[1] - processResult(result) - } - - txnEnder() - - return cb.apply(this, arguments) - } - } - } - - _getAwsAgentAttributes(event, context) { - const attributes = { - 'aws.lambda.arn': context.invokedFunctionArn, - 'aws.requestId': context.awsRequestId - } - - const eventSourceInfo = this._detectEventType(event) - - if (eventSourceInfo) { - attributes[EVENT_SOURCE_TYPE_KEY] = eventSourceInfo.name - - for (const key of Object.keys(eventSourceInfo.attributes)) { - const value = get(event, eventSourceInfo.attributes[key], null) - - if (value === null) { - continue - } - - attributes[key] = value - } - } - - setEventSourceAttributes(event, attributes) - - if (!coldStartRecorded) { - coldStartRecorded = attributes[COLD_START_KEY] = true - } - - return attributes - } -} - -function setEventSourceAttributes(event, attributes) { - if (event.Records) { - const record = event.Records[0] - if (record.eventSourceARN) { - // SQS/Kinesis Stream/DynamoDB/CodeCommit - attributes[EVENT_SOURCE_ARN_KEY] = record.eventSourceARN - } else if (record.s3 && record.s3.bucket && record.s3.bucket.arn) { - // S3 - attributes[EVENT_SOURCE_ARN_KEY] = record.s3.bucket.arn - } else if (record.EventSubscriptionArn) { - // SNS - attributes[EVENT_SOURCE_ARN_KEY] = record.EventSubscriptionArn - } else { - logger.trace('Unable to determine ARN from event record.', event, record) - } - } else if (event.records && event.deliveryStreamArn) { - // Kinesis Firehose - attributes[EVENT_SOURCE_ARN_KEY] = event.deliveryStreamArn - } else if (event.requestContext && event.requestContext.elb && - event.requestContext.elb.targetGroupArn) { - attributes[EVENT_SOURCE_ARN_KEY] = event.requestContext.elb.targetGroupArn - } else if (event.resources && event.resources[0]) { - attributes[EVENT_SOURCE_ARN_KEY] = event.resources[0] - } else { - logger.trace('Unable to determine ARN for event type.', event) - } -} - -function getApiGatewayLambdaProxyResultProcessor(transaction) { - return function processApiGatewayLambdaProxyResponse(response) { - if (apiGateway.isValidLambdaProxyResponse(response)) { - const webResponse = new apiGateway.LambdaProxyWebResponse(response) - setWebResponse(transaction, webResponse) - } else { - logger.debug('Did not contain a valid API Gateway Lambda Proxy response.') - } - } -} - -function setWebRequest(shim, transaction, request) { - transaction.type = shim.WEB - - const segment = transaction.baseSegment - - transaction.url = urltils.scrub(request.url.path) - transaction.verb = request.method - transaction.trace.attributes.addAttribute( - ATTR_DEST.TRANS_COMMON, - 'request.method', - request.method - ) - - segment.addSpanAttribute( - 'request.method', - request.method - ) - - transaction.port = request.url.port - - transaction.addRequestParameters(request.url.requestParameters) - - // URL is sent as an agent attribute with transaction events - transaction.trace.attributes.addAttribute( - ATTR_DEST.TRANS_EVENT | ATTR_DEST.ERROR_EVENT, - 'request.uri', - request.url.path - ) - - segment.addSpanAttribute( - 'request.uri', - request.url.path - ) - - headerAttributes.collectRequestHeaders(request.headers, transaction) - - if (shim.agent.config.distributed_tracing.enabled) { - const lowercaseHeaders = lowercaseObjectKeys(request.headers) - - const transportType = request.transportType && request.transportType.toUpperCase() - transaction.acceptDistributedTraceHeaders(transportType, lowercaseHeaders) - } -} - -function lowercaseObjectKeys(original) { - const lowercaseObject = Object.keys(original) - .reduce((destination, key) => { - destination[key.toLowerCase()] = original[key] - return destination - }, {}) - - return lowercaseObject -} - -function endTransaction(transaction, enderIndex) { - if (transactionEnders[enderIndex] === cleanClosure) { - // In the case where we have already been called, we return early. There may be a - // case where this is called more than once, given the lambda is left in a dirty - // state after thread suspension (e.g. timeouts) - return - } - - if (uncaughtException !== null) { - transaction.agent.errors.add(transaction, uncaughtException) - uncaughtException = null - } - - transaction.baseSegment.end() - - // Clear the end closure to let go of captured references - transactionEnders[enderIndex] = cleanClosure - transaction.finalizeName() - transaction.end() - try { - transaction.agent.harvestSync() - } catch (err) { - logger.warn('Failed to harvest transaction', err) - } -} - -function setWebResponse(transaction, response) { - transaction.statusCode = response.statusCode - - const responseCode = String(response.statusCode) - - if (/^\d+$/.test(responseCode)) { - transaction.trace.attributes.addAttribute( - ATTR_DEST.TRANS_COMMON, - 'http.statusCode', - responseCode - ) - - const segment = transaction.agent.tracer.getSegment() - - segment.addSpanAttribute('http.statusCode', responseCode) - } - - headerAttributes.collectResponseHeaders(response.headers, transaction) -} - -module.exports = AwsLambda diff --git a/node_modules/newrelic/lib/serverless/event-sources.json b/node_modules/newrelic/lib/serverless/event-sources.json deleted file mode 100644 index d2f48e12..00000000 --- a/node_modules/newrelic/lib/serverless/event-sources.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "alb": { - "attributes": {}, - "name": "alb", - "required_keys": [ - "httpMethod", - "requestContext.elb" - ] - }, - "apiGateway": { - "attributes": { - "aws.lambda.eventSource.accountId": "requestContext.accountId", - "aws.lambda.eventSource.apiId": "requestContext.apiId", - "aws.lambda.eventSource.resourceId": "requestContext.resourceId", - "aws.lambda.eventSource.resourcePath": "requestContext.resourcePath", - "aws.lambda.eventSource.stage": "requestContext.stage" - }, - "name": "apiGateway", - "required_keys": [ - "headers", - "httpMethod", - "path", - "requestContext", - "requestContext.stage" - ] - }, - "cloudFront": { - "attributes": {}, - "name": "cloudFront", - "required_keys": [ - "Records[0].cf" - ] - }, - "cloudWatchScheduled": { - "attributes": { - "aws.lambda.eventSource.account": "account", - "aws.lambda.eventSource.id": "id", - "aws.lambda.eventSource.region": "region", - "aws.lambda.eventSource.resource": "resources[0]", - "aws.lambda.eventSource.time": "time" - }, - "name": "cloudWatch_scheduled", - "required_keys": [ - "detail-type", - "source" - ] - }, - "dynamoStreams": { - "attributes": { - "aws.lambda.eventSource.length": "Records.length" - }, - "name": "dynamo_streams", - "required_keys": [ - "Records[0].dynamodb" - ] - }, - "firehose": { - "attributes": { - "aws.lambda.eventSource.length": "records.length", - "aws.lambda.eventSource.region": "region" - }, - "name": "firehose", - "required_keys": [ - "deliveryStreamArn", - "records[0].kinesisRecordMetadata" - ] - }, - "kinesis": { - "attributes": { - "aws.lambda.eventSource.length": "Records.length", - "aws.lambda.eventSource.region": "Records[0].awsRegion" - }, - "name": "kinesis", - "required_keys": [ - "Records[0].kinesis" - ] - }, - "s3": { - "attributes": { - "aws.lambda.eventSource.bucketName": "Records[0].s3.bucket.name", - "aws.lambda.eventSource.eventName": "Records[0].eventName", - "aws.lambda.eventSource.eventTime": "Records[0].eventTime", - "aws.lambda.eventSource.length": "Records.length", - "aws.lambda.eventSource.objectKey": "Records[0].s3.object.key", - "aws.lambda.eventSource.objectSequencer": "Records[0].s3.object.sequencer", - "aws.lambda.eventSource.objectSize": "Records[0].s3.object.size", - "aws.lambda.eventSource.region": "Records[0].awsRegion" - }, - "name": "s3", - "required_keys": [ - "Records[0].s3" - ] - }, - "ses": { - "attributes": { - "aws.lambda.eventSource.date": "Records[0].ses.mail.commonHeaders.date", - "aws.lambda.eventSource.length": "Records.length", - "aws.lambda.eventSource.messageId": "Records[0].ses.mail.commonHeaders.messageId", - "aws.lambda.eventSource.returnPath": "Records[0].ses.mail.commonHeaders.returnPath" - }, - "name": "ses", - "required_keys": [ - "Records[0].ses" - ] - }, - "sns": { - "attributes": { - "aws.lambda.eventSource.length": "Records.length", - "aws.lambda.eventSource.messageId": "Records[0].Sns.MessageId", - "aws.lambda.eventSource.timestamp": "Records[0].Sns.Timestamp", - "aws.lambda.eventSource.topicArn": "Records[0].Sns.TopicArn", - "aws.lambda.eventSource.type": "Records[0].Sns.Type" - }, - "name": "sns", - "required_keys": [ - "Records[0].Sns" - ] - }, - "sqs": { - "attributes": { - "aws.lambda.eventSource.length": "Records.length" - }, - "name": "sqs", - "required_keys": [ - "Records[0].receiptHandle" - ] - } -} \ No newline at end of file diff --git a/node_modules/newrelic/lib/shim/conglomerate-shim.js b/node_modules/newrelic/lib/shim/conglomerate-shim.js deleted file mode 100644 index 93601cfd..00000000 --- a/node_modules/newrelic/lib/shim/conglomerate-shim.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'ConglomerateShim'}) -const Shim = require('./shim') - -const {MODULE_TYPE} = require('./constants') -const SHIM_CLASSES = { - [MODULE_TYPE.GENERIC]: Shim, - [MODULE_TYPE.DATASTORE]: require('./datastore-shim'), - [MODULE_TYPE.MESSAGE]: require('./message-shim'), - [MODULE_TYPE.PROMISE]: require('./promise-shim'), - [MODULE_TYPE.TRANSACTION]: require('./transaction-shim'), - [MODULE_TYPE.WEB_FRAMEWORK]: require('./webframework-shim') -} - -/** - * A shim for wrapping all-in-one modules which implement multiple services. - * - * @private - * @extends Shim - */ -class ConglomerateShim extends Shim { - constructor(agent, moduleName, resolvedName) { - super(agent, moduleName, resolvedName) - this._logger = logger.child({module: moduleName}) - this._resolvedName = resolvedName - } - - get GENERIC() { - return MODULE_TYPE.GENERIC - } - get DATASTORE() { - return MODULE_TYPE.DATASTORE - } - get MESSAGE() { - return MODULE_TYPE.MESSAGE - } - get PROMISE() { - return MODULE_TYPE.PROMISE - } - get TRANSACTION() { - return MODULE_TYPE.TRANSACTION - } - get WEB_FRAMEWORK() { - return MODULE_TYPE.WEB_FRAMEWORK - } - - /** - * Constructs a new `Shim` of the specified type for instrumenting submodules - * of the conglomerate module. - * - * @param {MODULE_TYPE} type - The type of shim to construct. - * @param {string} submodule - The name of the submodule this will instrument. - * - * @return {Shim} A new shim of the given type. - */ - makeSpecializedShim(type, submodule) { - const ShimClass = SHIM_CLASSES[type] - const shim = new ShimClass(this.agent, this.moduleName, this._resolvedName) - shim._logger = shim._logger.child({submodule}) - return shim - } -} - -module.exports = ConglomerateShim diff --git a/node_modules/newrelic/lib/shim/constants.js b/node_modules/newrelic/lib/shim/constants.js deleted file mode 100644 index e10557c1..00000000 --- a/node_modules/newrelic/lib/shim/constants.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/** - * Enumeration of module instrumentation types. - * - * @private - * @readonly - * @enum {string} - */ -const MODULE_TYPE = { - /** Utility/generic module, such as pooling libraries. */ - GENERIC: 'generic', - - /** @private */ - CONGLOMERATE: 'conglomerate', - - /** Database module, such as the MongoDB or MySQL drivers. */ - DATASTORE: 'datastore', - - /** Messaging module, such as AMQP */ - MESSAGE: 'message', - - /** Promise module, such as Bluebird */ - PROMISE: 'promise', - - /** @private */ - TRANSACTION: 'transaction', - - /** Web server framework module, such as Express or Restify. */ - WEB_FRAMEWORK: 'web-framework' -} - -/** - * Enumeration of symbols used by shims. - * - * @memberof Shim.prototype - * @readonly - * @enum {Symbol} - */ -const SYMBOLS = { - /** Indicates distributed tracing should be disabled for a single request. */ - DISABLE_DT: Symbol('Disable distributed tracing') -} - -exports.MODULE_TYPE = MODULE_TYPE -exports.SYMBOLS = SYMBOLS diff --git a/node_modules/newrelic/lib/shim/datastore-shim.js b/node_modules/newrelic/lib/shim/datastore-shim.js deleted file mode 100644 index 0cf39728..00000000 --- a/node_modules/newrelic/lib/shim/datastore-shim.js +++ /dev/null @@ -1,926 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const dbutil = require('../db/utils') -const hasOwnProperty = require('../util/properties').hasOwn -const logger = require('../logger').child({component: 'DatastoreShim'}) -const metrics = require('../metrics/names') -const parseSql = require('../db/query-parsers/sql') -const ParsedStatement = require('../db/parsed-statement') -const Shim = require('./shim') -const urltils = require('../util/urltils') -const util = require('util') - - -/** - * An enumeration of well-known datastores so that new instrumentations can use - * the same names we already use for first-party instrumentation. - * - * Each of these values is also exposed directly on the DatastoreShim class as - * static members. - * - * @readonly - * @memberof DatastoreShim - * @enum {string} - */ -const DATASTORE_NAMES = { - CASSANDRA: 'Cassandra', - DYNAMODB: 'DynamoDB', - MEMCACHED: 'Memcache', - MONGODB: 'MongoDB', - MYSQL: 'MySQL', - NEPTUNE: 'Neptune', - POSTGRES: 'Postgres', - REDIS: 'Redis' -} - -/** - * Default value for unknown instance parameters. - * - * @readonly - * @private - */ -const INSTANCE_UNKNOWN = 'unknown' - -const defaultParsers = { - 'SQL': parseSql -} - -/** - * Pre-defined query parsers for well-known languages. - * - * Each of these values is also exposed directly on the DatastoreShim class as - * static members. - * - * @readonly - * @memberof DatastoreShim - * @enum {string} - */ -const QUERY_PARSERS = { - SQL_PARSER: 'SQL' -} - -/** - * Constructs a shim associated with the given agent instance, specialized for - * instrumenting datastores. - * - * @constructor - * @extends Shim - * @classdesc - * A helper class for wrapping datastore modules. - * - * @param {Agent} agent - * The agent this shim will use. - * - * @param {string} moduleName - * The name of the module being instrumented. - * - * @param {string} resolvedName - * The full path to the loaded module. - * - * @param {string} [datastoreId] - * The name of the datastore being instrumented. If available, use one of the - * values from {@link DatastoreShim.DATASTORE_NAMES}. - * Calls {@link DatastoreShim#setDatastore} if datastoreId is - * specified. - * - * @see Shim - * @see DatastoreShim.DATASTORE_NAMES - */ -function DatastoreShim(agent, moduleName, resolvedName, datastoreId) { - Shim.call(this, agent, moduleName, resolvedName) - this._logger = logger.child({module: moduleName}) - if (datastoreId) { - this.setDatastore(datastoreId) - } - this.queryParser = defaultParsers[this.SQL_PARSER] -} -module.exports = DatastoreShim - -util.inherits(DatastoreShim, Shim) - -// Add constants on the shim for the well-known datastores. -DatastoreShim.DATASTORE_NAMES = DATASTORE_NAMES -Object.keys(DATASTORE_NAMES).forEach(function defineDatastoreMetricEnum(dsName) { - Shim.defineProperty(DatastoreShim, dsName, DATASTORE_NAMES[dsName]) - Shim.defineProperty(DatastoreShim.prototype, dsName, DATASTORE_NAMES[dsName]) -}) - -// Add constants on the shim for the provided query parsers. -DatastoreShim.QUERY_PARSERS = QUERY_PARSERS -Object.keys(QUERY_PARSERS).forEach(function defineQueryParserEnum(qpName) { - Shim.defineProperty(DatastoreShim, qpName, QUERY_PARSERS[qpName]) - Shim.defineProperty(DatastoreShim.prototype, qpName, QUERY_PARSERS[qpName]) -}) - -DatastoreShim.prototype.setDatastore = setDatastore -DatastoreShim.prototype.recordOperation = recordOperation -DatastoreShim.prototype.recordQuery = recordQuery -DatastoreShim.prototype.recordBatchQuery = recordBatchQuery -DatastoreShim.prototype.parseQuery = parseQuery -DatastoreShim.prototype.setParser = setParser -DatastoreShim.prototype.bindRowCallbackSegment = bindRowCallbackSegment -DatastoreShim.prototype.captureInstanceAttributes = captureInstanceAttributes -DatastoreShim.prototype.getDatabaseNameFromUseQuery = getDatabaseNameFromUseQuery - -// -------------------------------------------------------------------------- // - -/** - * @callback QuerySpecFunction - * - * @summary - * Used for determining information about a query when it can not be simply - * found in the arguments. - * - * @param {Shim} shim - * The shim this function was passed to. - * - * @param {Function} func - * The function being recorded. - * - * @param {string} name - * The name of the function. - * - * @param {Array.<*>} args - * The arguments being passed into the function. - * - * @return {QuerySpec} The spec for how this query should be recorded. - * - * @see DatastoreShim#recordQuery - * @see DatastoreShim#recordBatchQuery - * @see QuerySpec - */ - -/** - * @callback QueryFunction - * - * @summary - * Pulls the query argument out from an array of arguments. - * - * @param {Shim} shim - * The shim this function was passed to. - * - * @param {Function} func - * The function being recorded. - * - * @param {string} name - * The name of the function. - * - * @param {Array.<*>} args - * The arguments being passed into the function. - * - * @return {string} The query string from the arguments list. - * - * @see QuerySpec - * @see QuerySpecFunction - */ - -/** - * @callback QueryParserFunction - * - * @summary - * Used to parse queries to extract the basic information about it. - * - * @param {string} query - The query to be parsed. - * - * @return {ParsedQueryData} An object containing the basic information about - * the query. - * - * @see DatastoreShim#setParser - * @see ParsedQueryData - */ - -/** - * @interface OperationSpec - * - * @description - * Describes the interface for an operation function. - * - * @property {string} [name] - * The name for this operation. If omitted, the operation function's name will - * used instead. - * - * @property {DatastoreParameters} [parameters] - * Extra parameters to be set on the metric for the operation. - * - * @property {bool} [record=true] - * Indicates if the operation should be recorded as a metric. A segment will be - * created even if this is `false`. - * - * @property {number|CallbackBindFunction} [callback] - * If a number, it is the offset in the arguments array for the operation's - * callback argument. If it is a function, it should perform the segment - * binding to the callback. - * - * @property {bool} [promise=false] - * If `true`, the return value will be wrapped as a Promise. - * - * @see DatastoreShim#recordOperation - * @see QuerySpec - * @see DatastoreParameters - */ - -/** - * @interface QuerySpec - * @extends OperationSpec - * - * @description - * Describes the interface for a query function. Extends {@link OperationSpec} - * with query-specific parameters. - * - * @property {bool} [stream=false] - * If `true`, the return value will be wrapped as a stream. - * - * @property {number|string|QueryFunction} query - * If a number, it is the offset in the arguments array for the query string - * argument. If a string, it is the query being executed. If a function, it - * will be passed the arguments and must return the query string. - * - * @see DatastoreShim#recordQuery - * @see DatastoreShim#recordBatchQuery - * @see QuerySpecFunction - * @see QueryFunction - * @see OperationSpec - * @see DatastoreParameters - */ - -/** - * @interface DatastoreParameters - * - * @description - * Extra parameters which may be added to an operation or query segment. All of - * these properties are optional. - * - * @property {string} host - * The host of the database server being interacted with. If provided, along - * with `port_path_or_id`, then an instance metric will also be generated for - * this database. - * - * @property {number|string} port_path_or_id - * The port number or path to domain socket used to connect to the database - * server. - * - * @property {string} database_name - * The name of the database being queried or operated on. - * - * @see OperationSpec - * @see QuerySpec - */ - -/** - * @interface ParsedQueryData - * - * @description - * Returned by a {@link QueryParserFunction}, this information is used to - * generate the name for recording datastore queries. - * - * @property {string} operation - * The datastore operation such as `SELECT` or `UPDATE`. - * - * @property {string} collection - * The collection being queried. This would be the table name from a SQL - * statement or the collection name in a MongoDB query. - * - * @property {string} [query] - * The query with any sensitive information redacted and comments removed. - * - * @see DatastoreShim#setParser - * @see QueryParserFunction - */ - -// -------------------------------------------------------------------------- // - -/** - * Sets the vendor the module implements. - * - * This is used to determine the names for metrics and segments. If a string is - * passed, metric names will be generated using that name. - * - * This method *MUST* be called to use any methods that generate - * segments or metrics. - * - * @memberof DatastoreShim.prototype - * - * @param {string} datastore - * The name of this datastore. Use one of the well-known constants listed in - * {@link DatastoreShim.DATASTORE_NAMES} if available for the datastore. - * - * @see DatastoreShim.DATASTORE_NAMES - * @see DatastoreShim#recordBatchQuery - * @see DatastoreShim#recordQuery - * @see DatastoreShim#recordOperation - * @see DatastoreShim#parseQuery - */ -function setDatastore(datastore) { - this._metrics = { - PREFIX: datastore, - STATEMENT: metrics.DB.STATEMENT + '/' + datastore + '/', - OPERATION: metrics.DB.OPERATION + '/' + datastore + '/', - INSTANCE: metrics.DB.INSTANCE + '/' + datastore + '/', - ALL: metrics.DB.PREFIX + datastore + '/' + metrics.ALL - } - - this._datastore = datastore - - this._logger = this._logger.child({datastore: this._metrics.PREFIX}) - this.logger.trace({metrics: this._metrics}, 'Datastore metric names set') -} - -/** - * Sets the query parser used by this shim instance. - * - * @memberof DatastoreShim.prototype - * - * @param {string|QueryParserFunction} parser - * The string used to look up a default parser or the function used to parse - * queries. It is recommended that you use one of the well-known constants if - * available in the {@link DatastoreShim.QUERY_PARSERS}. - * - * @see DatastoreShim.QUERY_PARSERS - * @see QueryParserFunction - * @see ParsedQueryData - */ -function setParser(parser) { - if (this.isString(parser)) { - var newParser = defaultParsers[parser] - if (newParser) { - this.queryParser = newParser - } else { - this.logger.debug( - 'Attempted to set the query parser to invalid parser %s, not setting new parser', - parser - ) - } - } else if (this.isFunction(parser)) { - this.queryParser = parser - } else { - this.logger.trace( - "Received invalid parser (%s)", - parser - ) - } -} - -/** - * Wraps the given properties as datastore operations that should be recorded. - * - * - `recordOperation(nodule, properties, opSpec)` - * - `recordOperation(func, opSpec)` - * - * The resulting wrapped methods will record their actions using the datastore - * `OPERATION` metric. - * - * NOTE: Calling this method before {@link DatastoreShim#setDatastore} - * will result in an exception. - * - * @memberof DatastoreShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {OperationSpec|SegmentFunction} opSpec - * The spec for this operation function. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see OperationSpec - * @see SegmentFunction - */ -function recordOperation(nodule, properties, opSpec) { - if (this.isObject(properties) && !this.isArray(properties)) { - // operation(func, opSpec) - opSpec = properties - properties = null - } - if (!opSpec) { - opSpec = Object.create(null) - } - - return this.record(nodule, properties, function opRecorder(shim, fn, fnName, args) { - shim.logger.trace('Recording datastore operation "%s"', fnName) - - // Derive the segment information. - var segDesc = null - if (shim.isFunction(opSpec)) { - segDesc = opSpec.call(this, shim, fn, fnName, args) - } else { - segDesc = { - name: opSpec.name || fnName || 'other', - parameters: opSpec.parameters, - callback: opSpec.callback, - after: 'after' in opSpec ? opSpec.after : null, - promise: 'promise' in opSpec ? opSpec.promise : null, - record: opSpec.record, - opaque: opSpec.opaque || false - } - } - if (hasOwnProperty(segDesc, 'parameters')) { - _normalizeParameters.call(shim, segDesc.parameters) - } - - // Adjust the segment name with the metric prefix and add a recorder. - if (!hasOwnProperty(segDesc, 'record') || segDesc.record !== false) { - segDesc.name = shim._metrics.OPERATION + segDesc.name - segDesc.recorder = _recordOperationMetrics.bind(shim) - - segDesc.internal = true - } - - // And done. - return segDesc - }) -} - -/** - * Wraps the given properties as datastore query that should be recorded. - * - * - `recordQuery(nodule, properties, querySpec)` - * - `recordQuery(func, querySpec)` - * - * The resulting wrapped methods will record their actions using the datastore - * `STATEMENT` metric. - * - * NOTE: Calling this method before {@link DatastoreShim#setDatastore} - * will result in an exception. - * - * @memberof DatastoreShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {QuerySpec|QuerySpecFunction} querySpec - * The spec for this query function. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see DatastoreShim#recordBatchQuery - * @see QuerySpec - * @see QuerySpecFunction - */ -function recordQuery(nodule, properties, querySpec) { - return _recordQuery.call(this, '', nodule, properties, querySpec) -} - -/** - * Just like {@link DatastoreShim#recordQuery}, but with a `batch` suffix for - * the recorded metric. - * - * - `recordBatchQuery(nodule, properties, querySpec)` - * - `recordBatchQuery(func, querySpec)` - * - * The resulting wrapped methods will record their actions using the datastore - * `STATEMENT` metric with a `/batch` suffix. - * - * NOTE: Calling this method before {@link DatastoreShim#setDatastore} - * will result in an exception. - * - * @memberof DatastoreShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {QuerySpec|QuerySpecFunction} querySpec - * The spec for this query function. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see DatastoreShim#recordQuery - * @see QuerySpec - * @see QuerySpecFunction - */ -function recordBatchQuery(nodule, properties, querySpec) { - return _recordQuery.call(this, '/batch', nodule, properties, querySpec) -} - -/** - * Parses the given query to extract information for any metrics that will be - * created. - * - * NOTE: Calling this method before {@link DatastoreShim#setDatastore} - * will result in an exception. - * - * @memberof DatastoreShim.prototype - * - * @param {string} query - The query to parse. - * - * @param {Object} nodule - Context for the queryParse to run under. - * - * @return {ParsedStatement} The parsed query object. - * - * @see DatastoreShim#setParser - */ -function parseQuery(query, nodule) { - var parsed = this.queryParser.call(nodule, query) - - var collection = parsed.collection - // strip enclosing special characters from collection (table) name - if (typeof collection === 'string' && collection.length > 2) { - if (/^[\[{'"`]/.test(collection)) { - collection = collection.substr(1) - } - if (/[\]}'"`]$/.test(collection)) { - collection = collection.substr(0, collection.length - 1) - } - } - - var queryRecorded = ( - this.agent.config.transaction_tracer.record_sql === 'raw' || - this.agent.config.transaction_tracer.record_sql === 'obfuscated' - ) - - return new ParsedStatement( - this._metrics.PREFIX, - parsed.operation, - collection, - queryRecorded ? parsed.query : null - ) -} - -/** - * Wraps the callback in an arguments array with one that is bound to a segment. - * - * - `bindRowCallbackSegment(args, cbIdx [, parentSegment])` - * - * @memberof DatastoreShim.prototype - * - * @param {Array} args - * The arguments array to replace the callback in. - * - * @param {Number} cbIdx - * The index of the callback in the arguments array. - * - * @param {TraceSegment} [parentSegment] - * Optional. The segment to be the parent row callback's segment. Defaults to - * the segment active when the row callback is first called. - */ -function bindRowCallbackSegment(args, cbIdx, parentSegment) { - var idx = this.normalizeIndex(args.length, cbIdx) - if (idx === null) { - this.logger.debug('Not binding row callback, invalid cbIdx %s', cbIdx) - return - } - - // Pull out the callback and make sure it is a function. - var cb = args[idx] - if (!this.isFunction(cb)) { - this.logger.debug('Argument %d is not a function, not binding row callback', cbIdx) - return cb - } - this.logger.trace('Wrapping argument %d as a row callback.', cbIdx) - - // We have a little state to maintain through potentially multiple calls. - var callCounter = 0 - var segment = null - var segmentName = 'Callback: ' + this.getName(cb) - var shim = this - - var wrapper = this.bindSegment(function rowCallbackWrapper() { - // The first time this row callback is fired we want to touch the parent - // segment and create the callback segment. - if (++callCounter === 1) { - var realParent = parentSegment || shim.getSegment() - realParent && realParent.touch() - segment = shim.createSegment(segmentName, realParent) - - if (segment) { - segment.async = false - } - } - - // Update the segment name and run the actual callback. - if (segment) { - segment.addAttribute('count', callCounter) - } - - return shim.applySegment(cb, segment, true, this, arguments) - }, parentSegment) - - // Mark this as wrapped and put it in the args array. - this.setInternalProperty(wrapper, '__NR_original', cb) - args[idx] = wrapper -} - -/** - * Normalizes and adds datastore instance attributes to the current segment. - * - * If the current segment was not created by this shim then no action is taken. - * - * @memberof DatastoreShim.prototype - * - * @param {string} host - The name of the database host. - * @param {number|string} port - The port, path, or ID of the database server. - * @param {string} database - The name of the database in use. - */ -function captureInstanceAttributes(host, port, database) { - // See if we are currently in a segment created by us. - var segment = this.getSegment() - if (!segment || segment.shim !== this) { - this.logger.trace( - 'Not adding db instance metric attributes to segment %j', - segment && segment.name - ) - return - } - this.logger.trace('Adding db instance attributes to segment %j', segment.name) - - // Normalize the instance attributes. - var attributes = _normalizeParameters.call(this, { - host, - port_path_or_id: port, - database_name: database - }) - - for (let key in attributes) { - if (attributes[key]) { - segment.addAttribute(key, attributes[key]) - } - } -} - -/** - * Parses the database name from a `USE` SQL query. - * - * @param {string} query - The SQL query to parse the database name from. - * - * @return {?string} The name of the database if it could be parsed, otherwise - * `null`. - */ -function getDatabaseNameFromUseQuery(query) { - return dbutil.extractDatabaseChangeFromUse(query) -} - -// -------------------------------------------------------------------------- // - -/** - * Wraps the given properties as datastore query that should be recorded. - * - * - `_recordQuery(suffix, nodule, properties, querySpec)` - * - `_recordQuery(suffix, func, querySpec)` - * - * The resulting wrapped methods will record their actions using the datastore - * `STATEMENT` metric. - * - * @private - * @this DatastoreShim - * - * @param {string} suffix - * Suffix to be added to the segment name. - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {QuerySpec|QueryFunction} querySpec - * The spec for this query function. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see DatastoreShim#recordQuery - * @see DatastoreShim#recordBatchQuery - * @see QuerySpec - * @see QuerySpecFunction - */ -function _recordQuery(suffix, nodule, properties, querySpec) { - if (this.isObject(properties) && !this.isArray(properties)) { - // _recordQuery(suffix, func, querySpec) - querySpec = properties - properties = null - } - if (!querySpec) { - this.logger.debug('Missing query spec for recordQuery, not wrapping.') - return nodule - } - - return this.record(nodule, properties, function queryRecord(shim, fn, fnName, args) { - shim.logger.trace('Determining query information for %j', fnName) - - var queryDesc = querySpec - if (shim.isFunction(querySpec)) { - queryDesc = querySpec.call(this, shim, fn, fnName, args) - } - - // If we're not actually recording this, then just return the segment - // descriptor now. - if (hasOwnProperty(queryDesc, 'record') && queryDesc.record === false) { - var parameters = - _normalizeParameters.call(shim, queryDesc.parameters || Object.create(null)) - return { - name: queryDesc.name || fnName, - parameters, - callback: 'callback' in queryDesc ? queryDesc.callback : null, - rowCallback: 'rowCallback' in queryDesc ? queryDesc.rowCallback : null, - stream: 'stream' in queryDesc ? queryDesc.stream : null, - after: 'after' in queryDesc ? queryDesc.after : null, - promise: 'promise' in queryDesc ? queryDesc.promise : null, - internal: 'internal' in queryDesc ? queryDesc.internal : false, - opaque: 'opaque' in queryDesc ? queryDesc.opaque : false - } - } - - // Fetch the query string. - var queryStr = _extractQueryStr.call(shim, fn, fnName, queryDesc, this, args) - if (!shim.isString(queryStr)) { - return null - } - - // Parse the query and assemble the name. - var parsed = shim.parseQuery(queryStr, this) - var name = (parsed.collection || 'other') + '/' + parsed.operation + suffix - shim.logger.trace('Found and parsed query %s -> %s', parsed.type, name) - - // Return the segment descriptor. - var parameters = - _normalizeParameters.call(shim, queryDesc.parameters || Object.create(null)) - return { - name: shim._metrics.STATEMENT + name, - parameters: parameters, - callback: 'callback' in queryDesc ? queryDesc.callback : null, - rowCallback: 'rowCallback' in queryDesc ? queryDesc.rowCallback : null, - stream: 'stream' in queryDesc ? queryDesc.stream : null, - after: 'after' in queryDesc ? queryDesc.after : null, - promise: 'promise' in queryDesc ? queryDesc.promise : null, - internal: 'internal' in queryDesc ? queryDesc.internal : true, - opaque: 'opaque' in queryDesc ? queryDesc.opaque : false, - recorder: function queryRecorder(segment, scope) { - if (segment) { - parsed.recordMetrics(segment, scope) - } - } - } - }) -} - -/** - * Records all the metrics required for database operations. - * - * - `_recordOperationMetrics(segment [, scope])` - * - * @private - * @this DatastoreShim - * @implements {MetricFunction} - * - * @param {TraceSegment} segment - The segment being recorded. - * @param {string} [scope] - The scope of the segment. - * - * @see DatastoreShim#recordOperation - * @see MetricFunction - */ -function _recordOperationMetrics(segment, scope) { - if (!segment) { - return - } - - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var transaction = segment.transaction - var type = transaction.isWeb() ? 'allWeb' : 'allOther' - var operation = segment.name - - if (scope) { - transaction.measure(operation, scope, duration, exclusive) - } - - transaction.measure(operation, null, duration, exclusive) - transaction.measure(metrics.DB.PREFIX + type, null, duration, exclusive) - transaction.measure(metrics.DB.ALL, null, duration, exclusive) - transaction.measure(this._metrics.ALL, null, duration, exclusive) - transaction.measure( - metrics.DB.PREFIX + this._metrics.PREFIX + '/' + type, - null, - duration, - exclusive - ) - - const attributes = segment.getAttributes() - if (attributes.host && attributes.port_path_or_id ) { - const instanceName = [ - metrics.DB.INSTANCE, - this._metrics.PREFIX, - attributes.host, - attributes.port_path_or_id - ].join('/') - - transaction.measure(instanceName, null, duration, exclusive) - } -} - -/** - * Extracts the query string from the arguments according to the given spec. - * - * - `_extractQueryStr(fn, fnName, spec, ctx, args)` - * - * @private - * @this DatastoreShim - * - * @param {Function} fn - The query function to be executed. - * @param {string} fnName - The name of the query function. - * @param {QuerySpec} spec - The query spec. - * @param {*} ctx - The context of the query function's execution. - * @param {Array} args - The arguments for the query function. - * - * @return {?string} The query from the arguments if found, otherwise `null`. - */ -function _extractQueryStr(fn, fnName, spec, ctx, args) { - var queryStr = spec.query - if (this.isNumber(queryStr)) { - var queryIdx = this.normalizeIndex(args.length, queryStr) - if (queryIdx === null) { - this.logger.debug('Invalid query index %d of %d', queryStr, args.length) - return null - } - queryStr = args[queryIdx] - } else if (this.isFunction(queryStr)) { - queryStr = queryStr.call(ctx, this, fn, fnName, args) - } - - return queryStr -} - -/** - * Normalizes segment parameter values. - * - * - `_normalizeParameters([parameters])` - * - * Removes disabled parameters and corrects other values, such as changing host - * from `localhost` to the actual host name. - * - * @private - * @this DatastoreShim - * - * @param {object} [parameters={}] - The segment parameters to clean up. - * - * @return {object} - The normalized segment parameters. - */ -function _normalizeParameters(parameters) { - parameters = parameters || Object.create(null) - var config = this.agent.config - var dsTracerConf = config.datastore_tracer - - parameters.product = parameters.product || this._datastore - - // Add database name if provided and enabled. - if (!dsTracerConf.database_name_reporting.enabled) { - delete parameters.database_name - } else if ( - hasOwnProperty(parameters, 'database_name') && - parameters.database_name !== false - ) { - parameters.database_name = typeof parameters.database_name === 'number' - ? String(parameters.database_name) - : (parameters.database_name || INSTANCE_UNKNOWN) - } - - // Add instance information if enabled. - if (!dsTracerConf.instance_reporting.enabled) { - delete parameters.host - delete parameters.port_path_or_id - } else { - // Determine appropriate defaults for host and port. - if (hasOwnProperty(parameters, 'port_path_or_id')) { - parameters.port_path_or_id = String(parameters.port_path_or_id || INSTANCE_UNKNOWN) - } - if (hasOwnProperty(parameters, 'host')) { - if (parameters.host && urltils.isLocalhost(parameters.host)) { - parameters.host = config.getHostnameSafe(parameters.host) - } - - // Config's default name of a host is `UNKNOWN_BOX`. - if (!parameters.host || parameters.host === 'UNKNOWN_BOX') { - parameters.host = INSTANCE_UNKNOWN - } - } - } - - return parameters -} diff --git a/node_modules/newrelic/lib/shim/index.js b/node_modules/newrelic/lib/shim/index.js deleted file mode 100644 index fd18b7cc..00000000 --- a/node_modules/newrelic/lib/shim/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const constants = require('./constants') - -const Shim = require('./shim') -const ConglomerateShim = require('./conglomerate-shim') -const DatastoreShim = require('./datastore-shim') -const MessageShim = require('./message-shim') -const PromiseShim = require('./promise-shim') -const TransactionShim = require('./transaction-shim') -const WebFrameworkShim = require('./webframework-shim') -const properties = require('../util/properties') - -function createShimFromType(type, agent, moduleName, resolvedName) { - var shim = null - if (properties.hasOwn(SHIM_TYPE_MAP, type)) { - var ShimClass = SHIM_TYPE_MAP[type] - shim = new ShimClass(agent, moduleName, resolvedName) - } else { - shim = new Shim(agent, moduleName, resolvedName) - } - return shim -} - -var SHIM_TYPE_MAP = Object.create(null) -SHIM_TYPE_MAP[constants.MODULE_TYPE.GENERIC] = Shim -SHIM_TYPE_MAP[constants.MODULE_TYPE.CONGLOMERATE] = ConglomerateShim -SHIM_TYPE_MAP[constants.MODULE_TYPE.DATASTORE] = DatastoreShim -SHIM_TYPE_MAP[constants.MODULE_TYPE.MESSAGE] = MessageShim -SHIM_TYPE_MAP[constants.MODULE_TYPE.PROMISE] = PromiseShim -SHIM_TYPE_MAP[constants.MODULE_TYPE.TRANSACTION] = TransactionShim -SHIM_TYPE_MAP[constants.MODULE_TYPE.WEB_FRAMEWORK] = WebFrameworkShim - -exports.constants = constants -exports.Shim = Shim -exports.ConglomerateShim = ConglomerateShim -exports.DatastoreShim = DatastoreShim -exports.MessageShim = MessageShim -exports.PromiseShim = PromiseShim -exports.TransactionShim = TransactionShim -exports.WebFrameworkShim = WebFrameworkShim -exports.createShimFromType = createShimFromType diff --git a/node_modules/newrelic/lib/shim/message-shim.js b/node_modules/newrelic/lib/shim/message-shim.js deleted file mode 100644 index bc3a2813..00000000 --- a/node_modules/newrelic/lib/shim/message-shim.js +++ /dev/null @@ -1,870 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var copy = require('../util/copy') -var genericRecorder = require('../metrics/recorders/generic') -var logger = require('../logger').child({component: 'MessageShim'}) -var messageTransactionRecorder = require('../metrics/recorders/message-transaction') -var props = require('../util/properties') -var TransactionShim = require('./transaction-shim') -var Shim = require('./shim') // For Shim.defineProperty -var util = require('util') - -var ATTR_DESTS = require('../config/attribute-filter').DESTINATIONS - - -/** - * Enumeration of well-known message brokers. - * - * @readonly - * @memberof MessageShim - * @enum {string} - */ -const LIBRARY_NAMES = { - IRONMQ: 'IronMQ', - KAFKA: 'Kafka', - RABBITMQ: 'RabbitMQ', - SNS: 'SNS', - SQS: 'SQS' -} - -/** - * Mapping of well-known message brokers to their distributed tracing transport - * type. - * - * @private - * @readonly - * @enum {string} - */ -const LIBRARY_TRANSPORT_TYPES = { - AMQP: TransactionShim.TRANSPORT_TYPES.AMQP, - IronMQ: TransactionShim.TRANSPORT_TYPES.IRONMQ, - Kafka: TransactionShim.TRANSPORT_TYPES.KAFKA, - RabbitMQ: TransactionShim.TRANSPORT_TYPES.AMQP -} - -/** - * Enumeration of possible message broker destination types. - * - * @readonly - * @memberof MessageShim - * @enum {string} - */ -const DESTINATION_TYPES = { - EXCHANGE: 'Exchange', - QUEUE: 'Queue', - TOPIC: 'Topic' -} - - -/** - * Constructs a shim specialized for instrumenting message brokers. - * - * @constructor - * @extends TransactionShim - * @classdesc - * Used for instrumenting message broker client libraries. - * - * @param {Agent} agent - * The agent this shim will use. - * - * @param {string} moduleName - * The name of the module being instrumented. - * - * @param {string} resolvedName - * The full path to the loaded module. - * - * @see Shim - * @see TransactionShim - */ -function MessageShim(agent, moduleName, resolvedName) { - TransactionShim.call(this, agent, moduleName, resolvedName) - this._logger = logger.child({module: moduleName}) - this._metrics = null - this._transportType = TransactionShim.TRANSPORT_TYPES.UNKNOWN -} -module.exports = MessageShim -util.inherits(MessageShim, TransactionShim) - -// Add constants on the shim for message broker libraries. -MessageShim.LIBRARY_NAMES = LIBRARY_NAMES -Object.keys(LIBRARY_NAMES).forEach(function defineLibraryEnum(libName) { - Shim.defineProperty(MessageShim, libName, LIBRARY_NAMES[libName]) - Shim.defineProperty(MessageShim.prototype, libName, LIBRARY_NAMES[libName]) -}) - -// Add constants to the shim for message broker destination types. -MessageShim.DESTINATION_TYPES = DESTINATION_TYPES -Object.keys(DESTINATION_TYPES).forEach(function defineTypesEnum(type) { - Shim.defineProperty(MessageShim, type, DESTINATION_TYPES[type]) - Shim.defineProperty(MessageShim.prototype, type, DESTINATION_TYPES[type]) -}) - -MessageShim.prototype.setLibrary = setLibrary -MessageShim.prototype.recordProduce = recordProduce -MessageShim.prototype.recordConsume = recordConsume -MessageShim.prototype.recordPurgeQueue = recordPurgeQueue -MessageShim.prototype.recordSubscribedConsume = recordSubscribedConsume - -// -------------------------------------------------------------------------- // - -/** - * @callback MessageFunction - * - * @summary - * Used for determining information about a message either being produced or - * consumed. - * - * @param {MessageShim} shim - * The shim this function was handed to. - * - * @param {Function} func - * The produce method or message consumer. - * - * @param {string} name - * The name of the producer or consumer. - * - * @param {Array.<*>} args - * The arguments being passed into the produce method or consumer. - * - * @return {MessageSpec} The specification for the message being produced or - * consumed. - * - * @see MessageShim#recordProduce - * @see MessageShim#recordConsume - */ - -/** - * @callback MessageHandlerFunction - * - * @summary - * A function that is used to extract properties from a consumed message. This - * method is handed the results of a consume call. If the consume used a - * callback, then this method will receive the arguments to the callback. If - * the consume used a promise, then this method will receive the resolved - * value. - * - * @param {MessageShim} shim - * The shim this function was handed to. - * - * @param {Function} func - * The produce method or message consumer. - * - * @param {string} name - * The name of the producer or consumer. - * - * @param {Array|*} args - * Either the arguments for the consumer callback function or the result of - * the resolved consume promise, depending on the mode of the instrumented - * method. - * - * @return {MessageSpec} The extracted properties of the consumed message. - * - * @see MessageShim#recordConsume - */ - -/** - * @callback MessageConsumerWrapperFunction - * - * @summary - * Function that is used to wrap message consumer functions. Used along side - * the MessageShim#recordSubscribedConsume API method. - * - * @param {MessageShim} shim - * The shim this function was handed to. - * - * @param {Function} consumer - * The message consumer to wrap. - * - * @param {string} name - * The name of the consumer method. - * - * @param {string} queue - * The name of the queue this consumer is being subscribed to. - * - * @return {Function} The consumer method, possibly wrapped. - * - * @see MessageShim#recordSubscribedConsume - * @see MessageShim#recordConsume - */ - -/** - * @interface MessageSpec - * @extends RecorderSpec - * - * @description - * The specification for a message being produced or consumed. - * - * @property {string} destinationName - * The name of the exchange or queue the message is being produced to or - * consumed from. - * - * @property {MessageShim.DESTINATION_TYPES} [destinationType=null] - * The type of the destination. Defaults to `shim.EXCHANGE`. - * - * @property {Object} [headers=null] - * A reference to the message headers. On produce, more headers will be added - * to this object which should be sent along with the message. On consume, - * cross-application headers will be read from this object. - * - * @property {string} [routingKey=null] - * The routing key for the message. If provided on consume, the routing key - * will be added to the transaction attributes as `message.routingKey`. - * - * @property {string} [queue=null] - * The name of the queue the message was consumed from. If provided on - * consume, the queue name will be added to the transaction attributes as - * `message.queueName`. - * - * @property {string} [parameters.correlation_id] - * In AMQP, this should be the correlation Id of the message, if it has one. - * - * @property {string} [parameters.reply_to] - * In AMQP, this should be the name of the queue to reply to, if the message - * has one. - * - * @property {MessageHandlerFunction} [messageHandler] - * An optional function to extract message properties from a consumed message. - * This method is only used in the consume case to pull data from the - * retrieved message. - * - * @see RecorderSpec - * @see MessageShim#recordProduce - * @see MessageShim#recordConsume - * @see MessageShim.DESTINATION_TYPES - */ - -/** - * @interface MessageSubscribeSpec - * @extends MessageSpec - * - * @description - * Specification for message subscriber methods. That is, methods which - * register a consumer to start receiving messages. - * - * @property {number} consumer - * The index of the consumer in the method's arguments. Note that if the - * consumer and callback indexes point to the same argument, the argument will - * be wrapped as a consumer. - * - * @property {MessageHandlerFunction} messageHandler - * A function to extract message properties from a consumed message. - * This method is only used in the consume case to pull data from the - * retrieved message. Its return value is combined with the `MessageSubscribeSpec` - * to fully describe the consumed message. - * - * @see MessageSpec - * @see MessageConsumerWrapperFunction - * @see MessageShim#recordSubscribedConsume - */ - -// -------------------------------------------------------------------------- // - -/** - * Sets the vendor of the message broker being instrumented. - * - * This is used to generate the names for metrics and segments. If a string is - * passed, metric names will be generated using that. - * - * @memberof MessageShim.prototype - * - * @param {MessageShim.LIBRARY_NAMES|string} library - * The name of the message broker library. Use one of the well-known constants - * listed in {@link MessageShim.LIBRARY_NAMES} if available for the library. - * - * @see MessageShim.LIBRARY_NAMES - */ -function setLibrary(library) { - this._metrics = { - PREFIX: 'MessageBroker/', - LIBRARY: library, - PRODUCE: 'Produce/', - CONSUME: 'Consume/', - PURGE: 'Purge/', - NAMED: 'Named/', - TEMP: 'Temp' - } - - if (LIBRARY_TRANSPORT_TYPES[library]) { - this._transportType = LIBRARY_TRANSPORT_TYPES[library] - } - - this._logger = this._logger.child({library: library}) - this.logger.trace({metrics: this._metrics}, 'Library metric names set') -} - -/** - * Wraps the given properties as message producing methods to be recorded. - * - * - `recordProduce(nodule, properties, recordNamer)` - * - `recordProduce(func, recordNamer)` - * - * The resulting wrapped methods will record their executions using the messaging - * `PRODUCE` metric. - * - * @memberof MessageShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {MessageFunction} recordNamer - * A function which specifies details of the message. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see MessageSpec - * @see MessageFunction - */ -function recordProduce(nodule, properties, recordNamer) { - if (this.isFunction(properties)) { - // recordProduce(func, recordNamer) - recordNamer = properties - properties = null - } - - return this.record(nodule, properties, function recordProd(shim) { - var msgDesc = recordNamer.apply(this, arguments) - if (!msgDesc) { - return null - } - - var name = _nameMessageSegment(shim, msgDesc, shim._metrics.PRODUCE) - if (!shim.agent.config.message_tracer.segment_parameters.enabled) { - delete msgDesc.parameters - } else if (msgDesc.routingKey) { - msgDesc.parameters = shim.setDefaults(msgDesc.parameters, { - routing_key: msgDesc.routingKey - }) - } - - return { - name: name, - promise: msgDesc.promise || false, - callback: msgDesc.callback || null, - recorder: genericRecorder, - inContext: function generateCATHeaders() { - if (msgDesc.headers) { - shim.insertCATRequestHeaders(msgDesc.headers, true) - } - }, - parameters: msgDesc.parameters || null, - opaque: msgDesc.opaque || false - } - }) -} - -/** - * Wraps the given properties as message consumers to be recorded. - * - * - `recordConsume(nodule, properties, spec)` - * - `recordConsume(func, spec)` - * - * The resulting wrapped methods will record their executions using the messaging - * `CONSUME` metric, possibly also starting a message transaction. Note that - * this should wrap the message _consumer_, to record methods which subscribe - * consumers see {@link MessageShim#recordSubscribedConsume} - * - * @memberof MessageShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {MessageSpec|MessageFunction} spec - * The spec for the method or a function which returns the details of the - * method. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see MessageShim#recordSubscribedConsume - * @see MessageSpec - * @see MessageFunction - */ -function recordConsume(nodule, properties, spec) { - if (this.isObject(properties) && !this.isArray(properties)) { - // recordConsume(func, spec) - spec = properties - properties = null - } - var DEFAULT_SPEC = { - destinationName: null, - promise: false, - callback: null, - messageHandler: null - } - if (!this.isFunction(spec)) { - spec = this.setDefaults(spec, DEFAULT_SPEC) - } - - return this.wrap(nodule, properties, function wrapConsume(shim, fn, fnName) { - if (!shim.isFunction(fn)) { - shim.logger.debug('Not wrapping %s (%s) as consume', fn, fnName) - return fn - } - - return function consumeRecorder() { - var parent = shim.getSegment() - if (!parent || !parent.transaction.isActive()) { - shim.logger.trace('Not recording consume, no active transaction.') - return fn.apply(this, arguments) - } - - // Process the message args. - var args = shim.argsToArray.apply(shim, arguments) - var msgDesc = null - if (shim.isFunction(spec)) { - msgDesc = spec.call(this, shim, fn, fnName, args) - shim.setDefaults(msgDesc, DEFAULT_SPEC) - } else { - msgDesc = { - destinationName: null, - callback: spec.callback, - promise: spec.promise, - messageHandler: spec.messageHandler - } - - var destIdx = shim.normalizeIndex(args.length, spec.destinationName) - if (destIdx !== null) { - msgDesc.destinationName = args[destIdx] - } - } - - // Make the segment if we can. - if (!msgDesc) { - shim.logger.trace('Not recording consume, no message descriptor.') - return fn.apply(this, args) - } - - const name = _nameMessageSegment(shim, msgDesc, shim._metrics.CONSUME) - - // Adds details needed by createSegment when used with a spec - msgDesc.name = name - msgDesc.recorder = genericRecorder - msgDesc.parent = parent - - var segment = shim.createSegment(msgDesc) - var getParams = shim.agent.config.message_tracer.segment_parameters.enabled - var resHandler = shim.isFunction(msgDesc.messageHandler) - ? msgDesc.messageHandler : null - - var cbIdx = shim.normalizeIndex(args.length, msgDesc.callback) - if (cbIdx !== null) { - shim.bindCallbackSegment(args, cbIdx, segment) - - // If we have a callback and a results handler, then wrap the callback so - // we can call the results handler and get the message properties. - if (resHandler) { - shim.wrap(args, cbIdx, function wrapCb(shim, cb, cbName) { - if (shim.isFunction(cb)) { - return function cbWrapper() { - var cbArgs = shim.argsToArray.apply(shim, arguments) - var msgProps = resHandler.call(this, shim, cb, cbName, cbArgs) - if (getParams && msgProps && msgProps.parameters) { - shim.copySegmentParameters(segment, msgProps.parameters) - } - - return cb.apply(this, arguments) - } - } - }) - } - } - - // Call the method in the context of our segment. - var ret = shim.applySegment(fn, segment, true, this, args) - - // Intercept the promise to handle the result. - if (resHandler && ret && msgDesc.promise && shim.isPromise(ret)) { - ret = ret.then(function interceptValue(res) { - var msgProps = resHandler.call(this, shim, fn, fnName, res) - if (getParams && msgProps && msgProps.parameters) { - shim.copySegmentParameters(segment, msgProps.parameters) - } - return res - }) - } - - return ret - } - }) -} - -/** - * Wraps the given properties as queue purging methods. - * - * - `recordPurgeQueue(nodule, properties, spec)` - * - `recordPurgeQueue(func, spec)` - * - * @memberof MessageShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {RecorderSpec} spec - * The specification for this queue purge method's interface. - * - * @param {string} spec.queue - * The name of the queue being purged. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see RecorderSpec - */ -function recordPurgeQueue(nodule, properties, spec) { - if (!nodule) { - this.logger.debug('Not wrapping non-existent nodule.') - return nodule - } - - // Sort out the parameters. - if (!this.isString(properties) && !this.isArray(properties)) { - // recordPurgeQueue(nodule, spec) - spec = properties - properties = null - } - - // Fill the spec with defaults. - var specIsFunction = this.isFunction(spec) - if (!specIsFunction) { - spec = this.setDefaults(spec, { - queue: null, - callback: null, - promise: false, - internal: false - }) - } - - return this.record(nodule, properties, function purgeRecorder(shim, fn, name, args) { - var descriptor = spec - if (specIsFunction) { - descriptor = spec.apply(this, arguments) - } - - var queue = descriptor.queue - if (shim.isNumber(queue)) { - var queueIdx = shim.normalizeIndex(args.length, descriptor.queue) - queue = args[queueIdx] - } - - return { - name: _nameMessageSegment(shim, { - destinationType: shim.QUEUE, - destinationName: queue - }, shim._metrics.PURGE), - recorder: genericRecorder, - callback: descriptor.callback, - promise: descriptor.promise, - internal: descriptor.internal - } - }) -} - -/** - * Wraps the given properties as message subscription methods. - * - * - `recordSubscribedConsume(nodule, properties, spec)` - * - `recordSubscribedConsume(func, spec)` - * - * Message subscriber methods are ones used to register a message consumer with - * the message library. See {@link MessageShim#recordConsume} for recording - * the consumer itself. - * - * Note that unlike most `shim.recordX` methods, this method will call the - * `spec.wrapper` method even if no transaction is active. - * - * @memberof MessageShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {MessageSubscribeSpec} spec - * The specification for this subscription method's interface. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see Shim#record - * @see MessageShim#recordConsume - * @see MessageSubscribeSpec - */ -function recordSubscribedConsume(nodule, properties, spec) { - if (!nodule) { - this.logger.debug('Not wrapping non-existent nodule.') - return nodule - } - - // Sort out the parameters. - if (this.isObject(properties) && !this.isArray(properties)) { - // recordSubscribedConsume(nodule, spec) - spec = properties - properties = null - } - - // Fill the spec with defaults. - spec = this.setDefaults(spec, { - name: null, - destinationName: null, - destinationType: null, - consumer: null, - callback: null, - messageHandler: null, - promise: false - }) - - // Make sure our spec has what we need. - if (!this.isFunction(spec.messageHandler)) { - this.logger.debug('spec.messageHandler should be a function') - return nodule - } else if (!this.isNumber(spec.consumer)) { - this.logger.debug('spec.consumer is required for recordSubscribedConsume') - return nodule - } - - var destNameIsArg = this.isNumber(spec.destinationName) - - // Must wrap the subscribe method independently to ensure that we can wrap - // the consumer regardless of transaction state. - var wrapped = this.wrap(nodule, properties, function wrapSubscribe(shim, fn) { - if (!shim.isFunction(fn)) { - return fn - } - return function wrappedSubscribe() { - var args = shim.argsToArray.apply(shim, arguments) - var queueIdx = shim.normalizeIndex(args.length, spec.queue) - var consumerIdx = shim.normalizeIndex(args.length, spec.consumer) - var queue = queueIdx === null ? null : args[queueIdx] - var destName = null - - if (destNameIsArg) { - var destNameIdx = shim.normalizeIndex(args.length, spec.destinationName) - if (destNameIdx !== null) { - destName = args[destNameIdx] - } - } - - if (consumerIdx !== null) { - args[consumerIdx] = shim.wrap( - args[consumerIdx], - makeWrapConsumer(queue, destName) - ) - } - - return fn.apply(this, args) - } - }) - - // Wrap the subscriber with segment creation. - return this.record(wrapped, properties, function recordSubscribe(shim, fn, name, args) { - // Make sure the specified consumer and callback indexes do not overlap. - // This could happen for instance if the function signature is - // `fn(consumer [, callback])` and specified as `consumer: shim.FIRST`, - // `callback: shim.LAST`. - var consumerIdx = shim.normalizeIndex(args.length, spec.consumer) - var cbIdx = shim.normalizeIndex(args.length, spec.callback) - if (cbIdx === consumerIdx) { - cbIdx = null - } - - return { - name: spec.name || name, - callback: cbIdx, - promise: spec.promise, - - stream: false, - internal: false - } - }) - - function makeWrapConsumer(queue, destinationName) { - var msgDescDefaults = copy.shallow(spec) - if (destNameIsArg && destinationName != null) { - msgDescDefaults.destinationName = destinationName - } - if (queue != null) { - msgDescDefaults.queue = queue - } - - return function wrapConsumer(shim, consumer, cName) { - if (!shim.isFunction(consumer)) { - return consumer - } - - return shim.bindCreateTransaction(function createConsumeTrans() { - // If there is no transaction or we're in a pre-existing transaction, - // then don't do anything. Note that the latter should never happen. - var args = shim.argsToArray.apply(shim, arguments) - var tx = shim.tracer.getTransaction() - - if (!tx || tx.baseSegment) { - shim.logger.debug({transaction: !!tx}, 'Failed to start message transaction.') - return consumer.apply(this, args) - } - - var msgDesc = spec.messageHandler.call(this, shim, consumer, cName, args) - - // If message could not be handled, immediately kill this transaction. - if (!msgDesc) { - shim.logger.debug('No description for message, cancelling transaction.') - tx.setForceIgnore(true) - tx.end() - return consumer.apply(this, args) - } - - // Derive the transaction name. - shim.setDefaults(msgDesc, msgDescDefaults) - var txName = _nameMessageTransaction(shim, msgDesc) - tx.setPartialName(txName) - tx.baseSegment = shim.createSegment({ - name: tx.getFullName(), - recorder: messageTransactionRecorder - }) - - // Add would-be baseSegment attributes to transaction trace - for (var key in msgDesc.parameters) { - if (props.hasOwn(msgDesc.parameters, key)) { - tx.trace.attributes.addAttribute( - ATTR_DESTS.NONE, - 'message.parameters.' + key, - msgDesc.parameters[key]) - - tx.baseSegment.attributes.addAttribute( - ATTR_DESTS.NONE, - 'message.parameters.' + key, - msgDesc.parameters[key] - ) - } - } - - // If we have a routing key, add it to the transaction. Note that it is - // camel cased here, but snake cased in the segment parameters. - if (!shim.agent.config.high_security) { - if (msgDesc.routingKey) { - tx.trace.attributes.addAttribute( - ATTR_DESTS.TRANS_COMMON, - 'message.routingKey', - msgDesc.routingKey - ) - - tx.baseSegment.addSpanAttribute( - 'message.routingKey', - msgDesc.routingKey - ) - } - if (shim.isString(msgDesc.queue)) { - tx.trace.attributes.addAttribute( - ATTR_DESTS.TRANS_COMMON, - 'message.queueName', - msgDesc.queue - ) - - tx.baseSegment.addSpanAttribute( - 'message.queueName', - msgDesc.queue - ) - } - } - if (msgDesc.headers) { - shim.handleCATHeaders(msgDesc.headers, tx.baseSegment, shim._transportType) - } - - shim.logger.trace('Started message transaction %s named %s', tx.id, txName) - - // Execute the original function and attempt to hook in the transaction - // finish. - var ret = null - try { - ret = shim.applySegment(consumer, tx.baseSegment, true, this, args) - } finally { - if (shim.isPromise(ret)) { - shim.logger.trace('Got a promise, attaching tx %s ending to promise', tx.id) - ret = shim.interceptPromise(ret, endTransaction) - } else if (!tx.handledExternally) { - // We have no way of knowing when this transaction ended! ABORT! - shim.logger.trace('Immediately ending message tx %s', tx.id) - setImmediate(endTransaction) - } - } - - return ret - - function endTransaction() { - tx.finalizeName(null) // Use existing partial name. - tx.end() - } - }, { - type: shim.MESSAGE, - nest: true - }) - } - } -} - -// -------------------------------------------------------------------------- // - -/** - * Constructs a message segment name from the given message descriptor. - * - * @private - * - * @param {MessageShim} shim - The shim the segment will be constructed by. - * @param {MessageSpec} msgDesc - The message descriptor. - * @param {string} action - Produce or consume? - * - * @return {string} The generated name of the message segment. - */ -function _nameMessageSegment(shim, msgDesc, action) { - var name = - shim._metrics.PREFIX + shim._metrics.LIBRARY + '/' + - (msgDesc.destinationType || shim.EXCHANGE) + '/' + action - - if (msgDesc.destinationName) { - name += shim._metrics.NAMED + msgDesc.destinationName - } else { - name += shim._metrics.TEMP - } - - return name -} - -function _nameMessageTransaction(shim, msgDesc) { - var name = - shim._metrics.LIBRARY + '/' + - (msgDesc.destinationType || shim.EXCHANGE) + '/' - - if (msgDesc.destinationName) { - name += shim._metrics.NAMED + msgDesc.destinationName - } else { - name += shim._metrics.TEMP - } - - return name -} diff --git a/node_modules/newrelic/lib/shim/promise-shim.js b/node_modules/newrelic/lib/shim/promise-shim.js deleted file mode 100644 index 14fd6a42..00000000 --- a/node_modules/newrelic/lib/shim/promise-shim.js +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'PromiseShim'}) -const Shim = require('./shim') - -/** - * A helper class for wrapping promise modules. - * - * @extends Shim - */ -class PromiseShim extends Shim { - /** - * Constructs a shim associated with the given agent instance, specialized for - * instrumenting promise libraries. - * - * @param {Agent} agent - * The agent this shim will use. - * - * @param {string} moduleName - * The name of the module being instrumented. - * - * @param {string} resolvedName - * The full path to the loaded module. - * - * @see Shim - */ - constructor(agent, moduleName, resolvedName) { - super(agent, moduleName, resolvedName) - this._logger = logger.child({module: moduleName}) - this._class = null - } - - /** - * Grants access to the `Contextualizer` class used by the `PromiseShim` to - * propagate context down promise chains. - * - * @private - */ - static get Contextualizer() { - return Contextualizer - } - - /** - * Sets the class used to indentify promises from the wrapped promise library. - * - * @param {function} clss - The promise library's class. - */ - setClass(clss) { - this._class = clss - } - - /** - * Checks if the given object is an instance of a promise from the promise - * library being wrapped. - * - * @param {*} obj - The object to check the instance type of. - * - * @return {bool} True if the provided object is an instance of a promise from - * this promise library. - * - * @see PromiseShim#setClass - */ - isPromiseInstance(obj) { - return !!this._class && obj instanceof this._class - } - - /** - * Wraps the given properties as constructors for the promise library. - * - * - `wrapConstructor(nodule, properties)` - * - `wrapConstructor(func)` - * - * It is only necessary to wrap the constructor for the class if there is no - * other way to access the executor function. Some libraries expose a separate - * method which is called to execute the executor. If that is available, it is - * better to wrap that using {@link PromiseShim#wrapExecutorCaller} than to - * use this method. - * - * @param {object|function} nodule - * The source of the properties to wrap, or a single function to wrap. - * - * @param {string|array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the constructor to wrap. - * - * @return {object|function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see PromiseShim#wrapExecutorCaller - */ - wrapConstructor(nodule, properties) { - return this.wrapClass(nodule, properties, { - pre: function prePromise(shim, Promise, name, args) { - // We are expecting one function argument for executor, anything else is - // non-standard, do not attempt to wrap. Also do not attempt to wrap if - // we are not in a transaction. - if (args.length !== 1 || !shim.isFunction(args[0]) || !shim.getActiveSegment()) { - return - } - _wrapExecutorContext(shim, args) - }, - post: function postPromise(shim, Promise, name, args) { - // This extra property is added by `_wrapExecutorContext` in the pre step. - const executor = args[0] - const context = executor && executor.__NR_executorContext - if (!context || !shim.isFunction(context.executor)) { - return - } - - context.promise = this - Contextualizer.link(null, this, shim.getSegment()) - try { - // Must run after promise is defined so that `__NR_wrapper` can be set. - context.executor.apply(context.self, context.args) - } catch (e) { - const reject = context.args[1] - reject(e) - } - } - }) - } - - /** - * Wraps the given properties as the caller of promise executors. - * - * - `wrapExecutorCaller(nodule, properties)` - * - `wrapExecutorCaller(func)` - * - * Wrapping the executor caller method directly is preferable to wrapping - * the constructor of the promise class. - * - * @param {object|function} nodule - * The source of the properties to wrap, or a single function to wrap. - * - * @param {string|array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @return {object|function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see PromiseShim#wrapConstructor - */ - wrapExecutorCaller(nodule, properties) { - return this.wrap(nodule, properties, function executorWrapper(shim, caller) { - if (!shim.isFunction(caller) || shim.isWrapped(caller)) { - return - } - - return function wrappedExecutorCaller(executor) { - var parent = shim.getActiveSegment() - if (!this || !parent) { - return caller.apply(this, arguments) - } - - if (!this.__NR_context) { - Contextualizer.link(null, this, parent) - } - - const args = shim.argsToArray.apply(shim, arguments) - _wrapExecutorContext(shim, args) - const ret = caller.apply(this, args) - const context = args[0].__NR_executorContext - context.promise = this - - // Bluebird catches executor errors and auto-rejects when it catches them, - // thus we need to do so as well. - // - // When adding new libraries, make sure to check that they behave the same - // way. We may need to enhance the promise spec to handle this variance. - try { - executor.apply(context.self, context.args) - } catch (e) { - const reject = context.args[1] - reject(e) - } - return ret - } - }) - } - - /** - * Wraps the given properties as methods which take is some value other than - * a function to call and return a promise. - * - * - `wrapCast(nodule, properties)` - * - `wrapCast(func)` - * - * Examples of promise cast methods include `Promise.resolve`, `Promise.all`, - * and Bluebird's `Promise.delay`. These are static methods which accept some - * arbitrary value and return a Promise instance. - * - * @param {object|function} nodule - * The source of the properties to wrap, or a single function to wrap. - * - * @param {string|array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @return {object|function} The first parameter to this function, after - * wrapping it or its properties. - */ - wrapCast(nodule, properties) { - return this.wrap(nodule, properties, function castWrapper(shim, cast) { - if (!shim.isFunction(cast) || shim.isWrapped(cast)) { - return - } - - return function __NR_wrappedCast() { - const segment = shim.getSegment() - const prom = cast.apply(this, arguments) - if (segment) { - Contextualizer.link(null, prom, segment) - } - return prom - } - }) - } - - /** - * Wraps the given properties as promise chaining methods. - * - * - `wrapThen(nodule, properties)` - * - `wrapThen(func)` - * - * NOTE: You must set class used by the library before wrapping then-methods. - * - * Examples of promise then methods include `Promise#then`, `Promise#finally`, - * and Bluebird's `Promise#map`. These are methods which take a function to - * execute once the promise resolves and hands back a new promise. - * - * @param {object|function} nodule - * The source of the properties to wrap, or a single function to wrap. - * - * @param {string|array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @return {object|function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see PromiseShim#setClass - * @see PromiseShim#wrapCatch - */ - wrapThen(nodule, properties) { - return this.wrap(nodule, properties, _wrapThen, [true]) - } - - /** - * Wraps the given properties as rejected promise chaining methods. - * - * - `wrapCatch(nodule, properties)` - * - `wrapCatch(func)` - * - * NOTE: You must set class used by the library before wrapping catch-methods. - * - * Promise catch methods differ from then methods in that only one function - * will be executed and only if the promise is rejected. Some libraries accept - * an additional argument to `Promise#catch` which is usually an error class - * to filter rejections by. This wrap method will handle that case. - * - * @param {object|function} nodule - * The source of the properties to wrap, or a single function to wrap. - * - * @param {string|array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @return {object|function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see PromiseShim#setClass - * @see PromiseShim#wrapThen - */ - wrapCatch(nodule, properties) { - return this.wrap(nodule, properties, _wrapThen, [false]) - } - - /** - * Wraps the given properties as callback-to-promise conversion methods. - * - * - `wrapPromisify(nodule, properties)` - * - `wrapPromisify(func)` - * - * @param {object|function} nodule - * The source of the properties to wrap, or a single function to wrap. - * - * @param {string|array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @return {object|function} The first parameter to this function, after - * wrapping it or its properties. - */ - wrapPromisify(nodule, properties) { - return this.wrap(nodule, properties, function promisifyWrapper(shim, promisify) { - if (!shim.isFunction(promisify) || shim.isWrapped(promisify)) { - return - } - - return function __NR_wrappedPromisify() { - const promisified = promisify.apply(this, arguments) - if (typeof promisified !== 'function') { - return promisified - } - - Object.keys(promisified).forEach(function forEachProperty(prop) { - __NR_wrappedPromisified[prop] = promisified[prop] - }) - - return __NR_wrappedPromisified - function __NR_wrappedPromisified() { - const segment = shim.getActiveSegment() - if (!segment) { - return promisified.apply(this, arguments) - } - - const prom = shim.applySegment(promisified, segment, true, this, arguments) - Contextualizer.link(null, prom, segment) - return prom - } - } - }) - } -} -module.exports = PromiseShim - -// -------------------------------------------------------------------------- // - -/** - * @private - */ -function _wrapExecutorContext(shim, args) { - const context = { - executor: args[0], - promise: null, - self: null, - args: null - } - contextExporter.__NR_executorContext = context - args[0] = contextExporter - - function contextExporter(resolve, reject) { - context.self = this - context.args = shim.argsToArray.apply(shim, arguments) - context.args[0] = _wrapResolver(context, resolve) - context.args[1] = _wrapResolver(context, reject) - } -} - -/** - * @private - */ -function _wrapResolver(context, fn) { - return function wrappedResolveReject(val) { - const promise = context.promise - if (promise && promise.__NR_context) { - promise.__NR_context.getSegment().touch() - } - fn(val) - } -} - -/** - * @private - */ -function _wrapThen(shim, fn, name, useAllParams) { - // Don't wrap non-functions. - if (shim.isWrapped(fn) || !shim.isFunction(fn)) { - return - } - - return function __NR_wrappedThen() { - if (!(this instanceof shim._class)) { - return fn.apply(this, arguments) - } - - const thenSegment = shim.getSegment() - const promise = this - - // Wrap up the arguments and execute the real then. - let isWrapped = false - const args = new Array(arguments.length) - for (let i = 0; i < arguments.length; ++i) { - args[i] = wrapHandler(arguments[i], i, arguments.length) - } - const next = fn.apply(this, args) - - // If we got a promise (which we should have), link the parent's context. - if (!isWrapped && next instanceof shim._class && next !== promise) { - Contextualizer.link(promise, next, thenSegment) - } - return next - - function wrapHandler(handler, i, length) { - if ( - !shim.isFunction(handler) || // Not a function - shim.isWrapped(handler) || // Already wrapped - (!useAllParams && i !== (length - 1)) // Don't want all and not last - ) { - isWrapped = shim.isWrapped(handler) - return handler - } - - return function __NR_wrappedThenHandler() { - if (!next || !next.__NR_context) { - return handler.apply(this, arguments) - } - - let promSegment = next.__NR_context.getSegment() - const segment = promSegment || shim.getSegment() - if (segment && segment !== promSegment) { - next.__NR_context.setSegment(segment) - promSegment = segment - } - - let ret = null - try { - ret = shim.applySegment(handler, promSegment, true, this, arguments) - } finally { - if (ret && typeof ret.then === 'function') { - ret = next.__NR_context.continueContext(ret) - } - } - return ret - } - } - } -} - -/** - * @private - */ -class Context { - constructor(segment) { - this.segments = [segment] - } - - branch() { - return this.segments.push(null) - 1 - } -} - -/** - * @private - */ -class Contextualizer { - constructor(idx, context) { - this.parentIdx = -1 - this.idx = idx - this.context = context - this.child = null - } - - static link(prev, next, segment) { - let ctxlzr = prev && prev.__NR_context - if (ctxlzr && !ctxlzr.isActive()) { - ctxlzr = prev.__NR_context = null - } - - if (ctxlzr) { - // If prev has one child already, branch the context and update the child. - if (ctxlzr.child) { - // When the branch-point is the 2nd through nth link in the chain, it is - // necessary to track its segment separately so the branches can parent - // their segments on the branch-point. - if (ctxlzr.parentIdx !== -1) { - ctxlzr.idx = ctxlzr.context.branch() - } - - // The first child needs to be updated to have its own branch as well. And - // each of that child's children must be updated with the new parent index. - // This is the only non-constant-time action for linking, but it only - // happens with branching promise chains specifically when the 2nd branch - // is added. - // - // Note: This does not account for branches of branches. That may result - // in improperly parented segments. - let parent = ctxlzr - let child = ctxlzr.child - const branchIdx = ctxlzr.context.branch() - do { - child.parentIdx = parent.idx - child.idx = branchIdx - parent = child - child = child.child - } while (child) - - // We set the child to something falsey that isn't `null` so we can - // distinguish between having no child, having one child, and having - // multiple children. - ctxlzr.child = false - } - - // If this is a branching link then create a new branch for the next promise. - // Otherwise, we can just piggy-back on the previous link's spot. - const idx = ctxlzr.child === false ? ctxlzr.context.branch() : ctxlzr.idx - - // Create a new context for this next promise. - next.__NR_context = new Contextualizer(idx, ctxlzr.context) - next.__NR_context.parentIdx = ctxlzr.idx - - // If this was our first child, remember it in case we have a 2nd. - if (ctxlzr.child === null) { - ctxlzr.child = next.__NR_context - } - } else if (segment) { - // This next promise is the root of a chain. Either there was no previous - // promise or the promise was created out of context. - next.__NR_context = new Contextualizer(0, new Context(segment)) - } - } - - isActive() { - const segments = this.context.segments - const segment = segments[this.idx] || segments[this.parentIdx] || segments[0] - return segment && segment.transaction.isActive() - } - - getSegment() { - const segments = this.context.segments - let segment = segments[this.idx] - if (segment == null) { - segment = segments[this.idx] = segments[this.parentIdx] || segments[0] - } - return segment - } - - setSegment(segment) { - return this.context.segments[this.idx] = segment - } - - toJSON() { - // No-op. - } - - continueContext(prom) { - const self = this - const nextContext = prom.__NR_context - if (!nextContext) { - return prom - } - - // If we have `finally`, use that to sneak our context update. - if (typeof prom.finally === 'function') { - return prom.finally(__NR_continueContext) - } - - // No `finally` means we need to hook into resolve and reject individually and - // pass through whatever happened. - return prom.then(function __NR_thenContext(val) { - __NR_continueContext() - return val - }, function __NR_catchContext(err) { - __NR_continueContext() - throw err // Re-throwing promise rejection, this is not New Relic's error. - }) - - function __NR_continueContext() { - self.setSegment(nextContext.getSegment()) - } - } -} diff --git a/node_modules/newrelic/lib/shim/shim.js b/node_modules/newrelic/lib/shim/shim.js deleted file mode 100644 index 7afd8546..00000000 --- a/node_modules/newrelic/lib/shim/shim.js +++ /dev/null @@ -1,2350 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const arity = require('../util/arity') -const constants = require('./constants') -const events = require('events') -const hasOwnProperty = require('../util/properties').hasOwn -const logger = require('../logger').child({component: 'Shim'}) -const path = require('path') -const specs = require('./specs') -const util = require('util') - -// Some modules do terrible things, like change the prototype of functions. To -// avoid crashing things we'll use a cached copy of apply everywhere. -const fnApply = Function.prototype.apply - -/** - * Constructs a shim associated with the given agent instance. - * - * @constructor - * @classdesc - * A helper class for wrapping modules with segments. - * - * @param {Agent} agent - The agent this shim will use. - * @param {string} moduleName - The name of the module being instrumented. - * @param {string} resolvedName - The full path to the loaded module. - */ -function Shim(agent, moduleName, resolvedName) { - if (!agent || !moduleName) { - throw new Error('Shim must be initialized with an agent and module name.') - } - - this._logger = logger.child({module: moduleName}) - this._agent = agent - this._toExport = null - this._debug = false - this.defineProperty(this, 'moduleName', moduleName) - - // Determine the root directory of the module. - var moduleRoot = null - var next = resolvedName || '/' - do { - moduleRoot = next - next = path.dirname(moduleRoot) - } while (moduleRoot.length > 1 && !/node_modules(?:\/@[^/]+)?$/.test(next)) - this._moduleRoot = moduleRoot -} -module.exports = Shim - -Shim.defineProperty = defineProperty -Shim.defineProperties = defineProperties - -// Copy the argument index enumeration onto the shim. -Shim.prototype.ARG_INDEXES = specs.ARG_INDEXES -defineProperties(Shim.prototype, specs.ARG_INDEXES) - -// Copy symbols to the shim as well. -defineProperties(Shim, constants.SYMBOLS) -defineProperties(Shim.prototype, constants.SYMBOLS) - -// Define other miscellaneous properties of the shim. -defineProperties(Shim.prototype, { - /** - * The agent associated with this shim. - * - * @readonly - * @member {Agent} Shim.prototype.agent - */ - agent: function getAgent() { - return this._agent - }, - - /** - * The tracer in use by the agent for the shim. - * - * @readonly - * @member {Tracer} Shim.prototype.tracer - */ - tracer: function getTracer() { - return this._agent.tracer - }, - - /** - * The logger for this shim. - * - * @readonly - * @member {Logger} Shim.prototype.logger - */ - logger: function getLogger() { - return this._logger - } -}) - -Shim.prototype.wrap = wrap -Shim.prototype.bindSegment = bindSegment -Shim.prototype.bindPromise = bindPromise - -Shim.prototype.execute = execute -Shim.prototype.wrapReturn = wrapReturn -Shim.prototype.wrapClass = wrapClass -Shim.prototype.wrapExport = wrapExport -Shim.prototype.record = record -Shim.prototype.isWrapped = isWrapped -Shim.prototype.unwrap = unwrap -Shim.prototype.unwrapOnce = unwrapOnce -Shim.prototype.getOriginal = getOriginal -Shim.prototype.getSegment = getSegment -Shim.prototype.getActiveSegment = getActiveSegment -Shim.prototype.setActiveSegment = setActiveSegment -Shim.prototype.storeSegment = storeSegment -Shim.prototype.bindCallbackSegment = bindCallbackSegment -Shim.prototype.applySegment = applySegment -Shim.prototype.createSegment = createSegment -Shim.prototype.getName = getName -Shim.prototype.isObject = isObject -Shim.prototype.isFunction = isFunction -Shim.prototype.isPromise = isPromise -Shim.prototype.isString = isString -Shim.prototype.isNumber = isNumber -Shim.prototype.isBoolean = isBoolean -Shim.prototype.isArray = isArray -Shim.prototype.isNull = isNull -Shim.prototype.toArray = toArray -Shim.prototype.argsToArray = argsToArray -Shim.prototype.normalizeIndex = normalizeIndex -Shim.prototype.listenerCount = listenerCount -Shim.prototype.once = once - -Shim.prototype.setInternalProperty = setInternalProperty - -Shim.prototype.defineProperty = defineProperty -Shim.prototype.defineProperties = defineProperties -Shim.prototype.setDefaults = setDefaults -Shim.prototype.proxy = proxy -Shim.prototype.require = shimRequire -Shim.prototype.copySegmentParameters = copySegmentParameters -Shim.prototype.interceptPromise = interceptPromise -Shim.prototype.fixArity = arity.fixArity - -// Internal methods. -Shim.prototype.getExport = getExport -Shim.prototype.enableDebug = enableDebug -Shim.prototype.__NR_unwrap = unwrapAll - -// -------------------------------------------------------------------------- // - -/** - * @callback WrapFunction - * - * @summary - * A function which performs the actual wrapping logic. - * - * @description - * If the return value of this function is not `original` then the return value - * will be marked as a wrapper. - * - * @param {Shim} shim - * The shim this function was passed to. - * - * @param {Object|Function} original - * The item which needs wrapping. Most of the time this will be a function. - * - * @param {string} name - * The name of `original` if it can be determined, otherwise `''`. - * - * @return {*} The wrapper for the original, or the original value itself. - */ - -/** - * @private - * @callback ArrayWrapFunction - * - * @description - * A wrap function used on elements of an array. In addition to the parameters - * of `WrapFunction`, these also receive an `index` and `total` as described - * below. - * - * @see WrapFunction - * - * @param {number} index - The index of the current element in the array. - * @param {number} total - The total number of items in the array. - */ - -/** - * @private - * @callback ArgumentsFunction - * - * @param {Shim} shim - * The shim this function was passed to. - * - * @param {Function} func - * The function these arguments were passed to. - * - * @param {*} context - * The context the function is executing under (i.e. `this`). - * - * @param {Array.<*>} args - * The arguments being passed into the function. - */ - -/** - * @callback SegmentFunction - * - * @summary - * A function which is called to compose a segment. - * - * @param {Shim} shim - * The shim this function was passed to. - * - * @param {Function} func - * The function the segment is created for. - * - * @param {string} name - * The name of the function. - * - * @param {Array.<*>} args - * The arguments being passed into the function. - * - * @return {string|SegmentSpec} The desired properties for the new segment. - */ - -/** - * @callback RecorderFunction - * - * @summary - * A function which is called to compose a segment for recording. - * - * @param {Shim} shim - * The shim this function was passed to. - * - * @param {Function} func - * The function being recorded. - * - * @param {string} name - * The name of the function. - * - * @param {Array.<*>} args - * The arguments being passed into the function. - * - * @return {string|RecorderSpec} The desired properties for the new segment. - */ - -/** - * @callback CallbackBindFunction - * - * @summary - * Performs segment binding on a callback function. Useful when identifying a - * callback is more complex than a simple argument offset. - * - * @param {Shim} shim - * The shim this function was passed to. - * - * @param {Function} func - * The function being recorded. - * - * @param {string} name - * The name of the function. - * - * @param {TraceSegment} segment - * The segment that the callback should be bound to. - * - * @param {Array.<*>} args - * The arguments being passed into the function. - */ - -/** - * @private - * @callback MetricFunction - * - * @summary - * Measures all the necessary metrics for the given segment. This functionality - * is meant to be used by Shim subclasses, instrumentations should never create - * their own recorders. - * - * @param {TraceSegment} segment - The segment to record. - * @param {string} [scope] - The scope of the recording. - */ - -/** - * @callback ConstructorHookFunction - * - * @summary - * Pre/post constructor execution hook for wrapping classes. Used by - * {@link ClassWrapSpec}. - * - * @param {Shim} shim - * The shim performing the wrapping/binding. - * - * @param {Function} Base - * The class that was wrapped. - * - * @param {string} name - * The name of the `Base` class. - * - * @param {Array.<*>} args - * The arguments to the class constructor. - * - * @see ClassWrapSpec - */ - -/** - * @private - * @interface Spec - * - * @description - * The syntax for declarative instrumentation. It can be used interlaced with - * custom, hand-written instrumentation for one-off or hard to simplifiy - * instrumentation logic. - * - * @property {Spec|WrapFunction} $return - * Changes the context to the return value of the current context. This means - * the sub spec will not be executed up front, but instead upon every execution - * of the current context. - * - * ```js - * var ret = func.apply(this, args); - * return shim.wrap(ret, spec.$return) - * ``` - * - * @property {Spec|WrapFunction} $proto - * Changes the context to the prototype of the current context. The prototype - * is found using `Object.getPrototypeOf`. - * - * ```js - * shim.wrap(Object.getPrototypeOf(context), spec.$proto) - * ``` - * - * @property {bool} $once - * Ensures that the parent spec will only be executed one time if the value is - * `true`. Good for preventing double wrapping of prototype methods. - * - * ```js - * if (spec.$once && spec.__NR_onceExecuted) { - * return context - * } - * spec.__NR_onceExecuted = true - * ``` - * - * @property {ArgumentsFunction} $arguments - * Executes the function with all of the arguments passed in. The arguments can - * be modified in place. This will execute before `$eachArgument`. - * - * ```js - * spec.$arguments(args) - * ``` - * - * @property {Spec|ArrayWrapFunction} $eachArgument - * Executes `shim.wrap` on each argument passed to the current context. The - * returned arguments will then be used to actually execute the function. - * - * ```js - * var argLength = arguments.length - * var extraArgs = extras.concat([0, argLength]) - * var iIdx = extraArgs.length - 2 - * var args = new Array(argLength) - * for (var i = 0; i < argLength; ++i) { - * extraArgs[iIdx] = i - * args[i] = shim.wrap(arguments[i], spec.$eachArgument, extraArgs) - * } - * func.apply(this, args) - * ``` - * - * @property {Array.<{$properties: Array., $spec: Spec}>} $wrappings - * Executes `shim.wrap` with the current context as the `nodule` for each - * element in the array. The `$properties` sub-key must list one or more - * properties to be wrapped. The `$spec` sub-key must be a {@link Spec} or - * {@link WrapFunction} for wrapping the properties. - * - * ```js - * spec.$wrappings.forEach(function($wrap) { - * shim.wrap(context, $wrap.$properties, $wrap.$spec) - * }) - * ``` - * - * @property {bool|string|SegmentFunction} $segment - * Controls segment creation. If a falsey value (i.e. `undefined`, `false`, - * `null`, etc) then no segment will be created. If the value is `true`, then - * the name of the current context is used to name the segment. If the value is - * a string then that string will be the name of the segment. Lastly, if the - * value is a function, that function will be called with the current context - * and arguments. - * - * ```js - * var segment = null - * if (spec.$segment) { - * var seg = {name: spec.$segment} - * if (shim.isFunction(seg.name)) { - * seg = seg.name(func, this, arguments) - * } - * else if (seg.name === true) { - * seg.name = func.name - * } - * segment = shim.createSegment(seg.name, seg.recorder, seg.parent) - * } - * ``` - * - * @property {Object.} $cache - * Adds the value as an extra parameter to all specs in the same context as the - * cache. If the current context is a function, the cache will be recreated on - * each invocation of the function. This value can be useful for passing a - * value at runtime from one spec into another. - * - * ```js - * var args = extras || [] - * if (spec.$cache) { - * args.push({}) - * } - * ``` - * - * @property {number} $callback - * Indicates that one of the parameters is a callback which should be wrapped. - * - * ```js - * if (shim.isNumber(spec.$callback)) { - * var idx = spec.$callback - * if (idx < 0) { - * idx = args.length + idx - * } - * args[idx] = shim.bindSegment(args[idx], segment) - * } - * ``` - * - * @property {Spec|WrapFunction} property - * Any field which does not start with a `$` is assumed to name a property on - * the current context which should be wrapped. This is simply shorthand for a - * `$wrappings` with only one `$properties` value. - */ - -/** - * @interface SegmentSpec - * - * @description - * The return value from a {@link SegmentFunction}, used to set the parameters - * of segment creation. - * - * @property {string} name - * The name for the segment to-be. - * - * @property {MetricFunction} [recorder] - * A metric recorder for the segment. This is purely for internal use by shim - * classes. Instrumentations should never implement their own metric functions. - * - * @property {TraceSegment} [parent] - * The parent segment. Defaults to the currently active segment. - * - * @see RecorderSpec - * @see SegmentFunction - */ - -/** - * @interface RecorderSpec - * @extends SegmentSpec - * - * @description - * The return value from a {@link RecorderFunction}, used to set the parameters - * of segment creation and lifetime. Extends the {@link SegmentSpec}. - * - * @property {bool|string} [stream] - * Indicates if the return value from the wrapped function is a stream. If the - * value is truthy then the recording will extend to the `end` event of the - * stream. If the value is a string it is assumed to be the name of an event to - * measure. A segment will be created to record emissions of the event. - * - * @property {bool} [promise] - * Indicates if the return value from the wrapped function is a Promise. If the - * value is truthy then the recording will extend to the completion of the - * Promise. - * - * @property {number|CallbackBindFunction} [callback] - * If this is a number, it identifies which argument is the callback and the - * segment will also be bound to the callback. Otherwise, the passed function - * should perform the segment binding itself. - * - * @property {number|CallbackBindFunction} [rowCallback] - * Like `callback`, this identifies a callback function in the arguments. The - * difference is that the default behavior for row callbacks is to only create - * one segment for all calls to the callback. This is mostly useful for - * functions which will be called repeatedly, such as once for each item in a - * result set. - * - * @property {bool} [internal=false] - * Marks this as the boundary point into the instrumented library. If `true` - * and the current segment is _also_ marked as `internal` by the same shim, - * then we will not record this inner activity. - * - * This is useful when instrumenting a library which implements high-order - * methods which simply call other public methods and you only want to record - * the method directly called by the user while still instrumenting all - * endpoints. - * - * @property {function} [after=null] - * A function to call after the synchronous execution of the recorded method. - * If the function synchronously threw an error, that error will be handed to - * this function. - * - * @property {bool} [callbackRequired] - * When `true`, a recorded method must be called with a callback for a segment - * to be created. Does not apply if a custom callback method has been assigned - * via {@link callback}. - * - * @see SegmentSpec - * @see RecorderFunction - */ - -/** - * @interface ClassWrapSpec - * - * @description - * Specifies the style of wrapping and construction hooks for wrapping classes. - * - * @property {bool} [es6=false] - * @property {ConstructorHookFunction} [pre=null] - * A function called with the constructor's arguments before the base class' - * constructor is executed. The `this` value will be `null`. - * - * @property {ConstructorHookFunction} [post=null] - * A function called with the constructor's arguments after the base class' - * constructor is executed. The `this` value will be the just-constructed object. - * - */ - -// -------------------------------------------------------------------------- // - -/** - * Entry point for executing a spec. - * - * @memberof Shim.prototype - */ -function execute(nodule, spec) { - if (this.isFunction(spec)) { - spec(this, nodule) - } else { - _specToFunction(spec)(this, nodule) - } -} - -/** - * Executes the provided spec on one or more objects. - * - * - `wrap(nodule, properties, spec [, args])` - * - `wrap(func, spec [, args])` - * - * When called with a `nodule` and one or more properties, the spec will be - * executed on each property listed and the return value put back on the - * `nodule`. - * - * When called with just a function, the spec will be executed on the function - * and the return value of the spec simply passed back. - * - * The wrapped version will have the same prototype as the original - * method. - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {Spec|WrapFunction} spec - * The spec for wrapping these items. - * - * @param {Array.<*>} [args=[]] - * Optional extra arguments to be sent to the spec when executing it. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see WrapFunction - */ -function wrap(nodule, properties, spec, args) { - if (!nodule) { - this.logger.debug('Not wrapping non-existent nodule.') - return nodule - } - - // Sort out the parameters. - if (this.isObject(properties) && !this.isArray(properties)) { - // wrap(nodule, spec [, args]) - args = spec - spec = properties - properties = null - } - if (this.isFunction(spec)) { - // wrap(nodule [, properties], wrapper [, args]) - spec = { - wrapper: spec - } - } - - // TODO: Add option for omitting __NR_original; unwrappable: false - spec = this.setDefaults(spec, {matchArity: false}) - - // If we're just wrapping one thing, just wrap it and return. - if (properties == null) { - const name = this.getName(nodule) - this.logger.trace('Wrapping nodule itself (%s).', name) - return _wrap(this, nodule, name, spec, args) - } - - // Coerce properties into an array. - if (!this.isArray(properties)) { - properties = [properties] - } - - // Wrap each property and return the nodule. - this.logger.trace('Wrapping %d properties on nodule.', properties.length) - properties.forEach(function wrapEachProperty(prop) { - // Skip nonexistent properties. - var original = nodule[prop] - if (!original) { - this.logger.debug('Not wrapping missing property "%s"', prop) - return - } - - // Wrap up the property and add a special unwrapper. - var wrapped = _wrap(this, original, prop, spec, args) - if (wrapped && wrapped !== original) { - this.logger.trace('Replacing "%s" with wrapped version', prop) - - nodule[prop] = wrapped - this.setInternalProperty(wrapped, '__NR_unwrap', function unwrapWrap() { - nodule[prop] = original - return original - }) - } - }, this) - return nodule -} - -/** - * Executes the provided spec with the return value of the given properties. - * - * - `wrapReturn(nodule, properties, spec [, args])` - * - `wrapReturn(func, spec [, args])` - * - * If the wrapper is executed with `new` then the wrapped function will also be - * called with `new`. This feature should only be used with factory methods - * disguised as classes. Normally {@link Shim#wrapClass} should be used to wrap - * constructors instead. - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {Spec|WrapReturnFunction} spec - * The spec for wrapping the returned value from the properties. - * - * @param {Array.<*>} [args=[]] - * Optional extra arguments to be sent to the spec when executing it. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - * @see WrapReturnFunction - */ -function wrapReturn(nodule, properties, spec, args) { - // Munge our parameters as needed. - if (this.isObject(properties) && !this.isArray(properties)) { - // wrapReturn(nodule, spec [, args]) - args = spec - spec = properties - properties = null - } - if (!this.isFunction(spec)) { - spec = _specToFunction(spec) - } - if (!this.isArray(args)) { - args = [] - } - - // Perform the wrapping! - return this.wrap(nodule, properties, function returnWrapper(shim, fn, fnName) { - // Only functions can have return values for us to wrap. - if (!shim.isFunction(fn)) { - return fn - } - - let unwrapReference = null - const handler = { - get: function getTrap(target, prop) { - // Allow for look up of the target - if (prop === '__NR_original') { - return target - } - if (prop === '__NR_unwrap') { - return unwrapReference - } - - return target[prop] - }, - defineProperty: function definePropertyTrap(target, key, descriptor) { - if (key === '__NR_unwrap') { - unwrapReference = descriptor.value - } else { - Object.defineProperty(target, key, descriptor) - } - return true - }, - set: function setTrap(target, key, val) { - if (key === '__NR_unwrap') { - unwrapReference = val - } else { - target[key] = val - } - return true - }, - construct: function constructTrap(Target, proxyArgs) { - // Call the underlying function. If this was called as a constructor, call - // the wrapped function as a constructor too. - let ret = new Target(...proxyArgs) - - // Assemble the arguments to hand to the spec. - const _args = [shim, fn, fnName, ret] - if (args.length > 0) { - _args.push.apply(_args, args) - } - - // Call the spec and see if it handed back a different return value. - const newRet = spec.apply(ret, _args) - if (newRet) { - ret = newRet - } - - return ret - }, - apply: function applyTrap(target, thisArg, proxyArgs) { - // Call the underlying function. If this was called as a constructor, call - // the wrapped function as a constructor too. - let ret = target.apply(thisArg, proxyArgs) - - // Assemble the arguments to hand to the spec. - const _args = [shim, fn, fnName, ret] - if (args.length > 0) { - _args.push.apply(_args, args) - } - - // Call the spec and see if it handed back a different return value. - const newRet = spec.apply(thisArg, _args) - if (newRet) { - ret = newRet - } - - return ret - } - } - return new Proxy(fn, handler) - }) -} - -/** - * Wraps a class constructor using a subclass with pre- and post-construction - * hooks. - * - * - `wrapClass(nodule, properties, spec [, args])` - * - `wrapClass(func, spec [, args])` - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the constructor to wrap. - * - * @param {ClassWrapSpec|ConstructorHookFunction} spec - * The spec for wrapping the returned value from the properties or a post hook. - * - * @param {Array.<*>} [args=[]] - * Optional extra arguments to be sent to the spec when executing it. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see Shim#wrap - */ -function wrapClass(nodule, properties, spec, args) { - // Munge our parameters as needed. - if (this.isObject(properties) && !this.isArray(properties)) { - // wrapReturn(nodule, spec [, args]) - args = spec - spec = properties - properties = null - } - if (this.isFunction(spec)) { - spec = {pre: null, post: spec} - } else { - spec.pre = spec.pre || null - spec.post = spec.post || null - } - if (!this.isArray(args)) { - args = [] - } - - // Perform the wrapping! - return this.wrap(nodule, properties, function classWrapper(shim, Base, fnName) { - // Only functions can have return values for us to wrap. - if (!shim.isFunction(Base) || shim.isWrapped(Base)) { - return Base - } - - // When es6 classes are being wrapped, we need to use an es6 class due to - // the fact our es5 wrapper depends on calling the constructor without `new`. - var wrapper = spec.es6 || /^class /.test(Base.toString()) - ? _es6WrapClass - : _es5WrapClass - - return wrapper(shim, Base, fnName, spec, args) - }) -} - -/** - * Wraps the actual module being instrumented to change what `require` returns. - * - * - `wrapExport(nodule, spec)` - * - * @memberof Shim.prototype - * - * @param {*} nodule - * The original export to replace with our new one. - * - * @param {WrapFunction} spec - * A wrapper function. The return value from this spec is what will replace - * the export. - * - * @return {*} The return value from `spec`. - */ -function wrapExport(nodule, spec) { - return this._toExport = this.wrap(nodule, null, spec) -} - -/** - * If the export was wrapped, that wrapper is returned, otherwise `defaultExport`. - * - * @private - * @memberof Shim.prototype - * - * @param {*} defaultExport - The original export in case it was never wrapped. - * - * @return {*} The result from calling {@link Shim#wrapExport} or `defaultExport` - * if it was never used. - * - * @see Shim.wrapExport - */ -function getExport(defaultExport) { - return this._toExport || defaultExport -} - -/** - * Determines if the specified function or property exists and is wrapped. - * - * - `isWrapped(nodule, property)` - * - `isWrapped(func)` - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the property or a single function to check. - * - * @param {string} [property] - * The property to check. If omitted, the `nodule` parameter is assumed to be - * the function to check. - * - * @return {bool} True if the item exists and has been wrapped. - * - * @see Shim#wrap - * @see Shim#bindSegment - */ -function isWrapped(nodule, property) { - if (property) { - return !!(nodule && nodule[property] && nodule[property].__NR_original) - } - return !!(nodule && nodule.__NR_original) -} - -/** - * Wraps a function with segment creation and binding. - * - * - `record(nodule, properties, recordNamer)` - * - `record(func, recordNamer)` - * - * This is shorthand for calling {@link Shim#wrap} and manually creating a segment. - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to record, or a single function to record. - * - * @param {string|Array.} [properties] - * One or more properties to record. If omitted, the `nodule` parameter is - * assumed to be the function to record. - * - * @param {RecorderFunction} recordNamer - * A function which returns a record descriptor that gives the name and type of - * record we'll make. - * - * @return {Object|Function} The first parameter, possibly wrapped. - * - * @see RecorderFunction - * @see RecorderSpec - * @see Shim#wrap - */ -function record(nodule, properties, recordNamer) { - if (this.isFunction(properties)) { - recordNamer = properties - properties = null - } - - return this.wrap(nodule, properties, function makeWrapper(shim, fn, name) { - // Can't record things that aren't functions. - if (!shim.isFunction(fn)) { - shim.logger.debug('Not recording non-function "%s".', name) - return fn - } - shim.logger.trace('Wrapping "%s" with metric recording.', name) - - return function wrapper() { - // Create the segment that will be recorded. - var args = argsToArray.apply(shim, arguments) - var segDesc = recordNamer.call(this, shim, fn, name, args) - if (!segDesc) { - shim.logger.trace('No segment descriptor for "%s", not recording.', name) - return fnApply.call(fn, this, args) - } - segDesc = new specs.RecorderSpec(segDesc) - - // See if we're in an active transaction. - var parent - if (segDesc.parent) { - // We only want to continue recording in a transaction if the - // transaction is active. - parent = segDesc.parent.transaction.isActive() ? segDesc.parent : null - } else { - parent = shim.getActiveSegment() - } - - if (!parent) { - shim.logger.debug('Not recording function %s, not in a transaction.', name) - return fnApply.call(fn, this, arguments) - } - - if ( - segDesc.callbackRequired && - !_hasValidCallbackArg(shim, args, segDesc.callback) - ) { - return fnApply.call(fn, this, arguments) - } - - // Only create a segment if: - // - We are _not_ making an internal segment. - // - OR the parent segment is either not internal or not from this shim. - var shouldCreateSegment = !( - parent.opaque || (segDesc.internal && parent.internal && shim === parent.shim) - ) - - var segment = shouldCreateSegment ? _rawCreateSegment(shim, segDesc) : parent - - return _doRecord.call(this, segment, args, segDesc, shouldCreateSegment) - } - - function _hasValidCallbackArg(shim, args, specCallback) { - if (shim.isNumber(specCallback)) { - const cbIdx = normalizeIndex(args.length, specCallback) - if (cbIdx === null) { - return false - } - - const callback = args[cbIdx] - return shim.isFunction(callback) - } - - return true - } - - function _doRecord(segment, args, segDesc, shouldCreateSegment) { - // Now bind any callbacks specified in the segment descriptor. - _bindAllCallbacks.call(this, shim, fn, name, args, { - spec: segDesc, - segment: segment, - shouldCreateSegment: shouldCreateSegment - }) - - // Apply the function, and (if it returned a stream) bind that too. - // The reason there is no check for `segment` is because it should - // be guaranteed by the parent and active transaction check - // at the beginning of this function. - var ret = _applyRecorderSegment(segment, this, args, segDesc) - if (ret) { - if (segDesc.stream) { - shim.logger.trace('Binding return value as stream.') - _bindStream(shim, ret, segment, { - event: shim.isString(segDesc.stream) ? segDesc.stream : null, - shouldCreateSegment: shouldCreateSegment - }) - } else if (segDesc.promise && shim.isPromise(ret)) { - shim.logger.trace('Binding return value as Promise.') - ret = shim.bindPromise(ret, segment) - } - } - return ret - } - - function _applyRecorderSegment(segment, ctx, args, segDesc) { - var error = null - var promised = false - var ret - try { - ret = shim.applySegment(fn, segment, true, ctx, args, segDesc.inContext) - if (segDesc.after && segDesc.promise && shim.isPromise(ret)) { - promised = true - return ret.then(function onThen(val) { - segment.touch() - segDesc.after(shim, fn, name, null, val) - return val - }, function onCatch(err) { - segment.touch() - segDesc.after(shim, fn, name, err, null) - throw err // NOTE: This is not an error from our instrumentation. - }) - } - return ret - } catch (err) { - error = err - throw err // Just rethrowing this error, not our error! - } finally { - if (segDesc.after && (error || !promised)) { - segDesc.after(shim, fn, name, error, ret) - } - } - } - }) -} - -/** - * Unwraps one or more items, revealing the original value. - * - * - `unwrap(nodule, property)` - * - `unwrap(func)` - * - * If called with a `nodule` and properties, the unwrapped values will be put - * back on the nodule. Otherwise, the unwrapped function is just returned. - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to unwrap, or a single function to unwrap. - * - * @param {string|Array.} [properties] - * One or more properties to unwrap. If omitted, the `nodule` parameter is - * assumed to be the function to unwrap. - * - * @return {Object|Function} The first parameter after unwrapping. - */ -function unwrap(nodule, properties) { - // Don't try to unwrap potentially `null` or `undefined` things. - if (!nodule) { - return nodule - } - - // If we're unwrapping multiple things - if (this.isArray(properties)) { - properties.forEach(unwrap.bind(this, nodule)) - return nodule - } - - this.logger.trace('Unwrapping %s', properties || '') - var original = properties ? nodule[properties] : nodule - while (original && original.__NR_original) { - original = this.isFunction(original.__NR_unwrap) - ? original.__NR_unwrap() - : original.__NR_original - } - return original -} - -/** - * Unwraps one item, revealing the underlying value. - * - * - `unwrapOnce(nodule, property)` - * - `unwrapOnce(func)` - * - * If called with a `nodule` and properties, the unwrapped value will be put - * back on the nodule. Otherwise, the unwrapped function is just returned. - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to unwrap, or a single function to unwrap. - * - * @param {string|Array.} [properties] - * One or more properties to unwrap. If omitted, the `nodule` parameter is - * assumed to be the function to unwrap. - * - * @return {Object|Function} The first parameter after unwrapping. - */ -function unwrapOnce(nodule, properties) { - // Don't try to unwrap potentially `null` or `undefined` things. - if (!nodule) { - return nodule - } - - // If we're unwrapping multiple things - if (this.isArray(properties)) { - properties.forEach(unwrapOnce.bind(this, nodule)) - return nodule - } - - this.logger.trace('Unwrapping %s', properties || '') - var original = properties ? nodule[properties] : nodule - if (original && original.__NR_original) { - original = this.isFunction(original.__NR_unwrap) - ? original.__NR_unwrap() - : original.__NR_original - } - return original -} - -/** - * Retrieves the original method for a wrapped function. - * - * - `getOriginal(nodule, property)` - * - `getOriginal(func)` - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source of the property to get the original of, or a function to unwrap. - * - * @param {string} [property] - * A property on `nodule` to get the original value of. - * - * @return {Object|Function} The original value for the given item. - */ -function getOriginal(nodule, property) { - if (!nodule) { - return nodule - } - - var original = property ? nodule[property] : nodule - while (original && original.__NR_original) { - original = original.__NR_original - } - return original -} - -/** - * Binds the execution of a function to a single segment. - * - * - `bindSegment(nodule , property [, segment [, full]])` - * - `bindSegment(func [, segment [, full]])` - * - * If called with a `nodule` and a property, the wrapped property will be put - * back on the nodule. Otherwise, the wrapped function is just returned. - * - * @memberof Shim.prototype - * - * @param {Object|Function} nodule - * The source for the property or a single function to bind to a segment. - * - * @param {string} [property] - * The property to bind. If omitted, the `nodule` parameter is assumed - * to be the function to bind the segment to. - * - * @param {?TraceSegment} [segment=null] - * The segment to bind the execution of the function to. If omitted or `null` - * the currently active segment will be bound instead. - * - * @param {bool} [full=false] - * Indicates if the full lifetime of the segment is bound to this function. - * - * @return {Object|Function} The first parameter after wrapping. - */ -function bindSegment(nodule, property, segment, full) { - // Don't bind to null arguments. - if (!nodule) { - return nodule - } - - // Determine our arguments. - if (this.isObject(property) && !this.isArray(property)) { - // bindSegment(func, segment [, full]) - full = segment - segment = property - property = null - } - - // This protects against the `bindSegment(func, null, true)` case, where the - // segment is `null`, and thus `true` (the full param) is detected as the - // segment. - if (segment != null && !this.isObject(segment)) { - this.logger.debug({segment: segment}, 'Segment is not a segment, not binding.') - return nodule - } - - var wrapped = this.wrap(nodule, property, function wrapFunc(shim, func) { - if (!shim.isFunction(func)) { - return func - } - - // Wrap up the function with this segment. - segment = segment || shim.getSegment() - if (!segment) { - return func - } - - var binder = _makeBindWrapper(shim, func, segment, full || false) - shim.storeSegment(binder, segment) - return binder - }) - - return wrapped -} - -/** - * Replaces the callback in an arguments array with one that has been bound to - * the given segment. - * - * - `bindCallbackSegment(args, cbIdx [, segment])` - * - `bindCallbackSegment(obj, property [, segment])` - * - * @memberof Shim.prototype - * - * @param {Array|Object} args - * The arguments array to pull the cb from. - * - * @param {number|string} cbIdx - * The index of the callback. - * - * @param {TraceSegment} [parentSegment] - * The segment to use as the callback segment's parent. Defaults to the - * currently active segment. - * - * @see Shim#bindSegment - */ -function bindCallbackSegment(args, cbIdx, parentSegment) { - if (!args) { - return - } - - if (this.isNumber(cbIdx)) { - var normalizedCBIdx = normalizeIndex(args.length, cbIdx) - if (normalizedCBIdx === null) { - // Bad index. - this.logger.debug( - 'Invalid index %d for args of length %d, not binding callback segment', - cbIdx, args.length - ) - return - } - cbIdx = normalizedCBIdx - } - - // Pull out the callback and make sure it is a function. - var cb = args[cbIdx] - if (this.isFunction(cb)) { - var shim = this - var realParent = parentSegment || shim.getSegment() - args[cbIdx] = shim.wrap(cb, null, function callbackWrapper(shim, fn, name) { - return function wrappedCallback() { - if (realParent) { - realParent.opaque = false - } - var segment = _rawCreateSegment(shim, new specs.SegmentSpec({ - name: 'Callback: ' + name, - parent: realParent - })) - - if (segment) { - segment.async = false - } - - // CB may end the transaction so update the parent's time preemptively. - realParent && realParent.touch() - return shim.applySegment(cb, segment, true, this, arguments) - } - }) - shim.storeSegment(args[cbIdx], realParent) - } -} - -/** - * Retrieves the segment associated with the given object, or the current - * segment if no object is given. - * - * - `getSegment([obj])` - * - * @memberof Shim.prototype - * - * @param {*} [obj] - The object to retrieve a segment from. - * - * @return {?TraceSegment} The trace segment associated with the given object or - * the current segment if no object is provided or no segment is associated - * with the object. - */ -function getSegment(obj) { - if (obj && obj.__NR_segment) { - return obj.__NR_segment - } - return this.tracer.getSegment() -} - - -/** - * Retrieves the segment associated with the given object, or the currently - * active segment if no object is given. - * - * - `getActiveSegment([obj])` - * - * An active segment is one whose transaction is still active (e.g. has not - * ended yet). - * - * @memberof Shim.prototype - * - * @param {*} [obj] - The object to retrieve a segment from. - * - * @return {?TraceSegment} The trace segment associated with the given object or - * the currently active segment if no object is provided or no segment is - * associated with the object. - */ -function getActiveSegment(obj) { - var segment = this.getSegment(obj) - if (segment && segment.transaction && segment.transaction.isActive()) { - return segment - } - return null -} - -/** - * Explicitly sets the active segment to the one passed in. This method - * should only be used if there is no function to tie a segment's timing - * to. - * - * - `setActiveSegment(segment)` - * - * @memberof Shim.prototype - * - * @param {TraceSegment} segment - The segment to set as the active segment. - * - */ -function setActiveSegment(segment) { - return this.tracer.segment = segment -} - -/** - * Associates a segment with the given object. - * - * - `storeSegment(obj [, segment])` - * - * If no segment is provided, the currently active segment is used. - * - * @memberof Shim.prototype - * - * @param {!*} obj - The object to retrieve a segment from. - * @param {TraceSegment} [segment] - The segment to link the object to. - */ -function storeSegment(obj, segment) { - this.setInternalProperty(obj, '__NR_segment', segment || this.tracer.getSegment()) -} - -/** - * Sets the given segment as the active one for the duration of the function's - * execution. - * - * - `applySegment(func, segment, full, context, args[, inContextCB])` - * - * @memberof Shim.prototype - * - * @param {Function} func - * The function to execute in the context of the given segment. - * - * @param {TraceSegment} segment - * The segment to make active for the duration of the function. - * - * @param {bool} full - * Indicates if the full lifetime of the segment is bound to this function. - * - * @param {*} context - * The `this` argument for the function. - * - * @param {Array.<*>} args - * The arguments to be passed into the function. - * - * @param {Function} [inContextCB] - * The function used to do more instrumentation work. This function is - * guaranteed to be executed with the segment associated with. - * - * - * @return {*} Whatever value `func` returned. - */ -/* eslint-disable max-params */ -function applySegment(func, segment, full, context, args, inContextCB) { - // Exist fast for bad arguments. - if (!this.isFunction(func)) { - return - } - - if (!segment) { - this.logger.trace('No segment to apply to function.') - return fnApply.call(func, context, args) - } - this.logger.trace('Applying segment %s', segment.name) - - // Set this segment as the current one on the tracer. - var tracer = this.tracer - var prevSegment = tracer.segment - tracer.segment = segment - if (full) { - segment.start() - } - - if (typeof inContextCB === 'function') { - inContextCB() - } - - // Execute the function and then return the tracer segment to the old one. - try { - return fnApply.call(func, context, args) - } catch (error) { - if (prevSegment === null && process.domain != null) { - process.domain.__NR_segment = tracer.segment - } - - throw error // Rethrowing application error, this is not an agent error. - } finally { - if (full) { - segment.touch() - } - tracer.segment = prevSegment - } -} -/* eslint-enable max-params */ - -/** - * Creates a new segment. - * - * - `createSegment(opts)` - * - `createSegment(name [, recorder] [, parent])` - * - * @memberof Shim.prototype - * - * @param {string} name - * The name to give the new segment. - * - * @param {?Function} [recorder=null] - * Optional. A function which will record the segment as a metric. Default is - * to not record the segment. - * - * @param {TraceSegment} [parent] - * Optional. The segment to use as the parent. Default is to use the currently - * active segment. - * - * @return {?TraceSegment} A new trace segment if a transaction is active, else - * `null` is returned. - */ -function createSegment(name, recorder, parent) { - var opts = null - if (this.isString(name)) { - // createSegment(name [, recorder] [, parent]) - opts = new specs.SegmentSpec({name}) - - // if the recorder arg is not used, it can either be omitted or null - if (this.isFunction(recorder) || this.isNull(recorder)) { - // createSegment(name, recorder [, parent]) - opts.recorder = recorder - opts.parent = parent - } else { - // createSegment(name [, parent]) - opts.parent = recorder - } - } else { - // createSegment(opts) - opts = name - } - - return _rawCreateSegment(this, opts) -} - -function _rawCreateSegment(shim, opts) { - // Grab parent segment when none in opts so we can check opaqueness - opts.parent = opts.parent || shim.getActiveSegment() - - // When parent exists and is opaque, no new segment will be created - // by tracer.createSegment and the parent will be returned. We bail - // out early so we do not risk modifying the parent segment. - if (opts.parent && opts.parent.opaque) { - shim.logger.trace(opts, 'Did not create segment because parent is opaque') - return opts.parent - } - - var segment = shim.tracer.createSegment(opts.name, opts.recorder, opts.parent) - if (segment) { - segment.internal = opts.internal - segment.opaque = opts.opaque - segment.shim = shim - - if (hasOwnProperty(opts, 'parameters')) { - shim.copySegmentParameters(segment, opts.parameters) - } - shim.logger.trace(opts, 'Created segment') - } else { - shim.logger.debug(opts,'Failed to create segment') - } - - return segment -} - -/** - * Determine the name of an object. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to get a name for. - * - * @return {string} The name of the object if it has one, else ``. - */ -function getName(obj) { - return String((!obj || obj === true) ? obj : (obj.name || '')) -} - -/** - * Determines if the given object is an Object. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to check. - * - * @return {bool} True if the object is an Object, else false. - */ -function isObject(obj) { - return obj instanceof Object -} - -/** - * Determines if the given object exists and is a function. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to check. - * - * @return {bool} True if the object is a function, else false. - */ -function isFunction(obj) { - return typeof obj === 'function' -} - -/** - * Determines if the given object exists and is a string. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to check. - * - * @return {bool} True if the object is a string, else false. - */ -function isString(obj) { - return typeof obj === 'string' -} - -/** - * Determines if the given object is a number literal. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to check. - * - * @return {bool} True if the object is a number literal, else false. - */ -function isNumber(obj) { - return typeof obj === 'number' -} - -/** - * Determines if the given object is a boolean literal. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to check. - * - * @return {bool} True if the object is a boolean literal, else false. - */ -function isBoolean(obj) { - return typeof obj === 'boolean' -} - -/** - * Determines if the given object exists and is an array. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to check. - * - * @return {bool} True if the object is an array, else false. - */ -function isArray(obj) { - return obj instanceof Array -} - -/** - * Determines if the given object is a promise instance. - * - * @memberof Shim.prototype - * - * @param {*} obj - The object to check. - * - * @return {bool} True if the object is a promise, else false. - */ -function isPromise(obj) { - return obj && typeof obj.then === 'function' -} - -/** - * Determines if the given value is null. - * - * @memberof Shim.prototype - * - * @param {*} val - The value to check. - * - * @return {bool} True if the value is null, else false. - */ -function isNull(val) { - return val === null -} - -/** - * Converts an array-like object into an array. - * - * @memberof Shim.prototype - * - * @param {*} obj - The array-like object (i.e. `arguments`). - * - * @return {Array.<*>} An instance of `Array` containing the elements of the - * array-like. - */ -function toArray(obj) { - var len = obj.length - var arr = new Array(len) - for (var i = 0; i < len; ++i) { - arr[i] = obj[i] - } - return arr -} - -/** - * Like {@link Shim#toArray}, but converts `arguments` to an array. - * - * This is the preferred function, when used with `.apply`, for converting the - * `arguments` object into an actual `Array` as it will not cause deopts. - * - * @memberof Shim.prototype - * - * @return {Array} An array containing the elements of `arguments`. - * - * @see Shim#toArray - * @see https://github.com/petkaantonov/bluebird/wiki/Optimization-killers - */ -function argsToArray() { - var len = arguments.length - var arr = new Array(len) - for (var i = 0; i < len; ++i) { - arr[i] = arguments[i] - } - return arr -} - -/** - * Ensures the given index is a valid index inside the array. - * - * A negative index value is converted to a positive one by adding it to the - * array length before checking it. - * - * @memberof Shim.prototype - * - * @param {number} arrayLength - The length of the array this index is for. - * @param {number} idx - The index to normalize. - * - * @return {?number} The adjusted index value if it is valid, else `null`. - */ -function normalizeIndex(arrayLength, idx) { - if (idx < 0) { - idx = arrayLength + idx - } - return (idx < 0 || idx >= arrayLength) ? null : idx -} - -/** - * Retrieves the number of listeners for the given event. - * - * @memberof Shim.prototype - * - * @param {object} emitter - The emitter to count the listeners on. - * @param {string} event - The event to count. - * - * @return {number} The number of listeners on the given event for this emitter. - */ -function listenerCount(emitter, evnt) { - if (events.EventEmitter.listenerCount) { - return events.EventEmitter.listenerCount(emitter, evnt) - } - return emitter.listeners(evnt).length -} - -/** - * Wraps a function such that it will only be executed once. - * - * @memberof Shim.prototype - * - * @param {function} fn - The function to wrap in an execution guard. - * - * @return {function} A function which will execute `fn` at most once. - */ -function once(fn) { - var called = false - return function onceCaller() { - if (!called) { - called = true - return fn.apply(this, arguments) - } - } -} - -/** - * Sets a property to the given value. If the property doesn't exist yet it will - * be made writable and non-enumerable. - * - * @memberof Shim.prototype - * - * @param {!object} obj - The object to add the property to. - * @param {!string} name - The name for this property. - * @param {*} val - The value to set the property as. - * - * @return {object} The `obj` value. - */ -function setInternalProperty(obj, name, val) { - if (!obj || !name) { - this.logger.debug('Not setting property; object or name is missing.') - return obj - } - - try { - if (this.agent.config.transaction_tracer.hide_internals) { - _slowSetInternalProperty(obj, name, val) - } else { - obj[name] = val - } - } catch (err) { - this.logger.debug(err, 'Failed to set property "%s" to %j', name, val) - } - return obj -} - -function _slowSetInternalProperty(obj, name, val) { - if (!hasOwnProperty(obj, name)) { - Object.defineProperty(obj, name, { - enumerable: false, - writable: true, - value: val - }) - } else { - obj[name] = val - } -} - -/** - * Defines a read-only property on the given object. - * - * @memberof Shim.prototype - * - * @param {object} obj - * The object to add the property to. - * - * @param {string} name - * The name of the property to add. - * - * @param {*|function} value - * The value to set. If a function is given, it is used as a getter, otherwise - * the value is directly set as an unwritable property. - */ -function defineProperty(obj, name, value) { - // We have define property! Use that. - var prop = { - enumerable: true, - configurable: true - } - if (isFunction(value)) { - prop.get = value - } else { - prop.writable = false - prop.value = value - } - Object.defineProperty(obj, name, prop) -} - -/** - * Adds several properties to the given object. - * - * @memberof Shim.prototype - * - * @param {object} obj - The object to add the properties to. - * @param {object} props - A mapping of properties to values to add. - * - * @see Shim#defineProperty - */ -function defineProperties(obj, props) { - var keys = Object.keys(props) - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - defineProperty(obj, key, props[key]) - } -} - -/** - * Performs a shallow copy of each property from `defaults` only if `obj` does - * not already have that property. - * - * @memberof Shim.prototype - * - * @param {object?} obj - The object to copy the defaults onto. - * @param {object} defaults - A mapping of keys to default values. - * - * @return {object} The `obj` with the default values copied onto it. If `obj` - * was falsey, then a new object with the defaults copied onto it is returned - * instead. - */ -function setDefaults(obj, defaults) { - if (!obj) { - obj = Object.create(null) - } - var keys = Object.keys(defaults) - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - if (!hasOwnProperty(obj, key)) { - obj[key] = defaults[key] - } - } - - return obj -} - -/** - * Proxies all set/get actions for each given property on `dest` onto `source`. - * - * @memberof Shim.prototype - * - * @param {*} source - * The object on which all the set/get actions will actually occur. - * - * @param {string|Array.} properties - * All of the properties to proxy. - * - * @param {*} dest - * The object which is proxying the source's properties. - */ -function proxy(source, properties, dest) { - if (!this.isArray(properties)) { - properties = [properties] - } - - properties.forEach(function forEachProxyProp(prop) { - Object.defineProperty(dest, prop, { - get: function proxyGet() { - return source[prop] - }, - set: function proxySet(val) { - return source[prop] = val - } - }) - }) -} - -/** - * Loads a node module from the instrumented library's own root directory. - * - * @memberof Shim.prototype - * - * @param {string} filePath - A relative path inside the module's directory. - * - * @return {*?} The result of loading the given module. If the module fails to - * load, `null` is returned instead. - */ -function shimRequire(filePath) { - try { - return require(path.resolve(this._moduleRoot, filePath)) - } catch (e) { - this.logger.debug('Failed to load %j: %s', filePath, e.stack) - return null - } -} - -/** - * Executes the given callback when the promise is finalized, whether it is - * resolved or rejected. - * - * @memberof Shim.prototype - * - * @param {Promise} prom - Some kind of promise. Must have a `then` method. - * @param {Function} cb - A function to call when the promise resolves. - * - * @return {Promise} A new promise to replace the original one. - */ -function interceptPromise(prom, cb) { - if (this.isFunction(prom.finally)) { - return prom.finally(cb) - } - return prom.then(function onThen(arg) { - cb() - return arg - }, function onCatch(err) { - cb() - throw err // This is not our error, just rethrowing the promise rejection. - }) -} - -/** - * Binds the given segment to the completion of the Promise. - * Updates segment timing and resets opaque state. - * - * @memberof Shim.prototype - * - * @param {!Promise} promise - * The Promise to bind. - * - * @param {!TraceSegment} segment - * The segment to bind to the Promise. - * - * @return {Promise} The promise to continue with. - */ -function bindPromise(promise, segment) { - return this.interceptPromise(promise, function thenTouch() { - segment.opaque = false - segment.touch() - }) -} - -/** - * Copies the given parameters onto the segment, respecting the current agent - * configuration. - * - * @memberof Shim.protoype - * - * @param {TraceSegment} segment - The segment to copy the parameters onto. - * @param {object} parameters - The paramters to copy. - */ -function copySegmentParameters(segment, parameters) { - for (var key in parameters) { - if (hasOwnProperty(parameters, key)) { - segment.addAttribute(key, parameters[key]) - } - } -} - -/** - * Enables debugging mode of the shim. - * - * In debug mode the shim will track all methods that it wraps so they can be - * unwrapped. This should _not_ be done in production code because a lot more - * objects are held onto in memory. - * - * @private - * @memberof Shim.prototype - */ -function enableDebug() { - this.logger.warn('Enabling debug mode for shim!') - this._debug = true - this._wrapped = [] -} - -/** - * Unwraps everything that the shim has wrapped. Only works if debugging mode is - * enabled first. - * - * @private - * @member Shim.prototype.__NR_unwrap - */ -function unwrapAll() { - if (this._wrapped) { - this.logger.debug('Unwrapping %d items.', this._wrapped.length) - this._wrapped.forEach(function unwrapEach(wrapped) { - this.unwrap(wrapped) - }, this) - } -} - -// -------------------------------------------------------------------------- // - -/** - * Coerces the given spec into a function which {@link Shim#wrap} can use. - * - * @private - * - * @param {Spec|WrapFunction} spec - The spec to coerce into a function. - * - * @return {WrapFunction} The spec itself if spec is a function, otherwise a - * function which will execute the spec when called. - */ -/* eslint-disable no-unused-vars */ -function _specToFunction(spec) { - throw new Error('Declarative specs are not implemented yet.') -} -/* eslint-enable no-unused-vars */ - -/** - * Executes the provided spec on the given object. - * - * - `_wrap(shim, original, name, spec [, args])` - * - * @private - * - * @param {Shim} shim - * The shim that is executing the wrapping. - * - * @param {*} original - * The object being wrapped. - * - * @param {string} name - * A logical name for the item to be wrapped. - * - * @param {WrapFunction} spec - * The spec for wrapping these items. - * - * @param {Array.<*>} [args=[]] - * Optional extra arguments to be sent to the spec when executing it. - * - * @return {Function} The return value from `spec` or the original value if it - * did not return anything. - */ -function _wrap(shim, original, name, spec, args) { - // Assemble the spec's arguments. - var specArgs = [shim, original, name] - if (args && args.length) { - specArgs.push.apply(specArgs, args) - } - - // Apply the spec and see if it returned a wrapped version of the property. - var wrapped = spec.wrapper.apply(null, specArgs) - if (wrapped && wrapped !== original) { - if (spec.matchArity && shim.isFunction(wrapped)) { - wrapped = arity.fixArity(original, wrapped) - } - - // TODO: Once all wrapping is converted to proxies, we won't need to - // set this property as the trap on 'get' will return the original for - // __NR_original. For now, we have to prevent setting this on original. - if (!wrapped.__NR_original) { - shim.setInternalProperty(wrapped, '__NR_original', original) - } - - if (shim._debug) { - shim._wrapped.push(wrapped) - } - } else { - wrapped = original - } - return wrapped -} - -/** - * Creates the `bindSegment` wrapper function in its own, clean closure. - * - * @private - * - * @param {Shim} shim - * The shim used for the binding. - * - * @param {function} fn - * The function to be bound to the segment. - * - * @param {TraceSegment} segment - * The segment the function is bound to. - * - * @param {boolean} full - * Indicates if the segment's full lifetime is bound to the function. - * - * @return {function} A function which wraps `fn` and makes the given segment - * active for the duration of its execution. - */ -function _makeBindWrapper(shim, fn, segment, full) { - return function wrapper() { - return shim.applySegment(fn, segment, full, this, arguments) - } -} - -/** - * Binds all callbacks identified in the given spec. - * - * The callbacks are bound using the method meant for that type if available - * (i.e. `bindRowCallbackSegment` for `rowCallback`), but will fall back to the - * generic callback binding method, `bindCallbackSegment`, otherwise. - * - * @this * - * @private - * - * @param {Shim} shim - * The shim performing this binding. - * - * @param {Function} fn - * The function the spec describes. - * - * @param {string} name - * The name of the function the spec describes. - * - * @param {Array} args - * The arguments to be passed into `fn`. - * - * @param {object} spec - * The specification for bind the callbacks. - * - * @param {SegmentSpec} spec.spec - * The segment specification for the function we're pulling callbacks out of. - * - * @param {TraceSegment} spec.segment - * The segment measuring the function which will be the parent of any callback - * segments that may be created. - * - * @param {bool} spec.shouldCreateSegment - * Flag indicating if we should create segments for the callbacks. We almost - * always do, but in the special case of nested internal methods we do not. - */ -function _bindAllCallbacks(shim, fn, name, args, spec) { - // Check for a normal callback. - if (hasOwnProperty(spec.spec, 'callback') && spec.spec.callback !== null) { - _bindCallback(this, spec.spec.callback, shim.bindCallbackSegment) - } - - // And check for a row callback. - if (hasOwnProperty(spec.spec, 'rowCallback') && spec.spec.rowCallback !== null) { - _bindCallback( - this, - spec.spec.rowCallback, - shim.bindRowCallbackSegment || shim.bindCallbackSegment - ) - } - - function _bindCallback(context, callback, binder) { - if (shim.isFunction(callback)) { - callback.call(context, shim, fn, name, spec.segment, args) - } else if (shim.isNumber(callback)) { - shim.logger.trace('Binding callback %d segment: %j', callback, !!spec.segment) - var cbIdx = normalizeIndex(args.length, callback) - if (cbIdx !== null) { - if (spec.shouldCreateSegment) { - binder.call(shim, args, cbIdx, spec.segment) - } else { - args[cbIdx] = shim.bindSegment(args[cbIdx], spec.segment, true) - } - } - } - } -} - -/** - * Binds the given segment to the lifetime of the stream. - * - * @private - * - * @param {Shim} shim - * The shim performing the wrapping/binding. - * - * @param {EventEmitter} stream - * The stream to bind. - * - * @param {?TraceSegment} segment - * The segment to bind to the stream. - * - * @param {Object} [spec] - * Specification for how to bind the stream. The `end` and `error` events will - * always be bound, so if no functionality is desired beyond that, then this - * parameter may be omitted. - * - * @param {string} [spec.event] - * The name of an event to record. If provided, a new segment will be created - * for this event and will measure each time the event is emitted. - * - * @param {bool} spec.shouldCreateSegment - * Indicates if any child segments should be created. This should always be - * true unless this segment and its parent are both internal segments. - */ -function _bindStream(shim, stream, segment, spec) { - if (!segment || !shim.isFunction(stream.emit)) { - shim.logger.trace( - 'Not binding stream; have segment=%j; typeof emit=%s', - !!segment, typeof stream.emit - ) - return - } - - // We have a segment and an emit function, pull out the relevant parts of the - // spec and prepare to create an event segment. - var specEvent = (spec && spec.event) || null - var shouldCreateSegment = (spec && spec.shouldCreateSegment) || false - var segmentName = 'Event callback: ' + specEvent - - // Wrap emit such that each event handler is executed within context of this - // segment or the event-specific segment. - shim.wrap(stream, 'emit', function wrapStreamEmit(shim, emit) { - var tx = segment.transaction - var streamBoundEmit = shim.bindSegment(emit, segment, true) - var eventSegment = null - var eventBoundEmit = null - var emitCount = 0 - - if (!shouldCreateSegment) { - return streamBoundEmit - } - - return function wrappedEmit(evnt) { - var emitToCall = streamBoundEmit - if (evnt === specEvent && tx.isActive()) { - if (!eventBoundEmit) { - eventSegment = shim.createSegment(segmentName, segment) - eventBoundEmit = shim.bindSegment(emit, eventSegment, true) - } - eventSegment.addAttribute('count', ++emitCount) - emitToCall = eventBoundEmit - } - if (evnt === 'end' || evnt === 'error') { - segment.opaque = false - segment.touch() - } - - return emitToCall.apply(this, arguments) - } - }) - - // Also wrap up any listeners for end or error events. - shim.wrap(stream, ['on', 'addListener'], function wrapOn(shim, fn) { - if (!shim.isFunction(fn)) { - return fn - } - - return function wrappedOn(onEvent) { - if (onEvent !== specEvent && (onEvent === 'end' || onEvent === 'error')) { - var args = argsToArray.apply(shim, arguments) - shim.bindCallbackSegment(args, shim.LAST, segment) - return fn.apply(this, args) - } - return fn.apply(this, arguments) - } - }) -} - -/** -* Wraps an es6-style class using a subclass. -* -* - `_es6WrapClass(shim, Base, fnName, spec, args)` -* -* @private -* -* @param {Shim} shim -* The shim performing the wrapping/binding. -* -* @param {class} Base -* The es6 class to be wrapped. -* -* @param {string} fnName -* The name of the base class. -* -* @param {ClassWrapSpec} spec -* The spec with pre- and post-execution hooks to call. -* -* @param {Array.<*>} args -* Extra arguments to pass through to the pre- and post-execution hooks. -* -* @return {class} A class that extends Base with execution hooks. - */ -function _es6WrapClass(shim, Base, fnName, spec, args) { - return class WrappedClass extends Base { - constructor() { - var cnstrctArgs = shim.argsToArray.apply(shim, arguments) - // Assemble the arguments to hand to the spec. - var _args = [shim, Base, fnName, cnstrctArgs] - if (args.length > 0) { - _args.push.apply(_args, args) - } - - // Call the spec's before hook, then call the base constructor, then call - // the spec's after hook. - spec.pre && spec.pre.apply(null, _args) - super(...cnstrctArgs) - spec.post && spec.post.apply(this, _args) - } - } -} - -/** - * Wraps an es5-style class using a subclass. - * - * - `_es5WrapClass(shim, Base, fnName, spec, args)` - * - * @private - * - * @param {Shim} shim - * The shim performing the wrapping/binding. - * - * @param {Function} Base - * The class to be wrapped. - * - * @param {string} fnName - * The name of the base class. - * - * @param {ClassWrapSpec} spec - * The spec with pre- and post-execution hooks to call. - * - * @param {Array.<*>} args - * Extra arguments to pass through to the pre- and post-execution hooks. - * - * @return {Function} A class that extends Base with execution hooks. - */ -function _es5WrapClass(shim, Base, fnName, spec, args) { - function WrappedClass() { - var cnstrctArgs = argsToArray.apply(shim, arguments) - if (!(this instanceof WrappedClass)) { - // Some libraries support calling constructors without the `new` keyword. - // In order to support this we must apply the super constructor if `this` - // is not an instance of ourself. JavaScript really needs a better way - // to generically apply constructors. - cnstrctArgs.unshift(WrappedClass) // `unshift` === `push_front` - return new (WrappedClass.bind.apply(WrappedClass, cnstrctArgs))() - } - - // Assemble the arguments to hand to the spec. - var _args = [shim, Base, fnName, cnstrctArgs] - if (args.length > 0) { - _args.push.apply(_args, args) - } - - // Call the spec's before hook, then call the base constructor, then call - // the spec's after hook. - spec.pre && spec.pre.apply(null, _args) - Base.apply(this, cnstrctArgs) - spec.post && spec.post.apply(this, _args) - } - util.inherits(WrappedClass, Base) - WrappedClass.prototype = Base.prototype - - return WrappedClass -} diff --git a/node_modules/newrelic/lib/shim/specs/index.js b/node_modules/newrelic/lib/shim/specs/index.js deleted file mode 100644 index bc920ec3..00000000 --- a/node_modules/newrelic/lib/shim/specs/index.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var hasOwnProperty = require('../../util/properties').hasOwn -var util = require('util') - -/** - * Enumeration of argument indexes. - * - * Anywhere that an argument index is used, one of these or a direct integer - * value can be used. These are just named constants to improve readability. - * - * Each of these values is also exposed directly on the DatastoreShim class as - * static members. - * - * @readonly - * @memberof Shim.prototype - * @enum {number} - */ -var ARG_INDEXES = { - FIRST: 0, - SECOND: 1, - THIRD: 2, - FOURTH: 3, - LAST: -1 -} - -exports.ARG_INDEXES = ARG_INDEXES - -exports.cast = cast - -exports.MiddlewareSpec = MiddlewareSpec -exports.RecorderSpec = RecorderSpec -exports.SegmentSpec = SegmentSpec -exports.WrapSpec = WrapSpec - -function cast(Class, spec) { - return spec instanceof Class ? spec : new Class(spec) -} - -function WrapSpec(spec) { - this.wrapper = typeof spec === 'function' ? spec : spec.wrapper - this.matchArity = hasOwnProperty(spec, 'matchArity') ? spec.matchArity : false -} - -function SegmentSpec(spec) { - this.name = hasOwnProperty(spec, 'name') ? spec.name : null - this.recorder = hasOwnProperty(spec, 'recorder') ? spec.recorder : null - this.inContext = hasOwnProperty(spec, 'inContext') ? spec.inContext : null - this.parent = hasOwnProperty(spec, 'parent') ? spec.parent : null - this.parameters = hasOwnProperty(spec, 'parameters') ? spec.parameters : null - this.internal = hasOwnProperty(spec, 'internal') ? spec.internal : false - this.opaque = hasOwnProperty(spec, 'opaque') ? spec.opaque : false -} - -function RecorderSpec(spec) { - SegmentSpec.call(this, spec) - this.stream = hasOwnProperty(spec, 'stream') ? spec.stream : null - this.promise = hasOwnProperty(spec, 'promise') ? spec.promise : null - this.callback = hasOwnProperty(spec, 'callback') ? spec.callback : null - this.rowCallback = hasOwnProperty(spec, 'rowCallback') ? spec.rowCallback : null - this.after = hasOwnProperty(spec, 'after') ? spec.after : null - this.callbackRequired = - hasOwnProperty(spec, 'callbackRequired') ? spec.callbackRequired : null -} -util.inherits(RecorderSpec, SegmentSpec) - -function MiddlewareSpec(spec) { - RecorderSpec.call(this, spec) - this.req = hasOwnProperty(spec, 'req' ) ? spec.req : ARG_INDEXES.FIRST - this.res = hasOwnProperty(spec, 'res' ) ? spec.res : ARG_INDEXES.SECOND - this.next = hasOwnProperty(spec, 'next' ) ? spec.next : ARG_INDEXES.THIRD - this.type = hasOwnProperty(spec, 'type' ) ? spec.type : 'MIDDLEWARE' - this.route = hasOwnProperty(spec, 'route' ) ? spec.route : null - this.params = hasOwnProperty(spec, 'params') ? spec.params : _defaultGetParams - this.appendPath = hasOwnProperty(spec, 'appendPath') ? spec.appendPath : true -} -util.inherits(MiddlewareSpec, RecorderSpec) - -function _defaultGetParams(shim, fn, name, args, req) { - return req && req.params -} diff --git a/node_modules/newrelic/lib/shim/transaction-shim.js b/node_modules/newrelic/lib/shim/transaction-shim.js deleted file mode 100644 index c71a3612..00000000 --- a/node_modules/newrelic/lib/shim/transaction-shim.js +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const cat = require('../util/cat') -const hashes = require('../util/hashes') -const logger = require('../logger').child({component: 'TransactionShim'}) -const Shim = require('./shim') -const Transaction = require('../transaction') -const util = require('util') - -const HTTP_CAT_ID_HEADER = 'X-NewRelic-Id' -const MQ_CAT_ID_HEADER = 'NewRelicID' -const MATCH_CAT_ID_HEADER = new RegExp( - '^(?:' + HTTP_CAT_ID_HEADER + '|' + MQ_CAT_ID_HEADER + ')$', - 'i' -) -const HTTP_CAT_TRANSACTION_HEADER = 'X-NewRelic-Transaction' -const MQ_CAT_TRANSACTION_HEADER = 'NewRelicTransaction' -const MATCH_CAT_TRANSACTION_HEADER = new RegExp( - '^(?:' + HTTP_CAT_TRANSACTION_HEADER + '|' + MQ_CAT_TRANSACTION_HEADER + ')$', - 'i' -) -const HTTP_CAT_APP_DATA_HEADER = 'X-NewRelic-App-Data' -const MQ_CAT_APP_DATA_HEADER = 'NewRelicAppData' -const MATCH_CAT_APP_DATA_HEADER = new RegExp( - '^(?:' + HTTP_CAT_APP_DATA_HEADER + '|' + MQ_CAT_APP_DATA_HEADER + ')$', - 'i' -) - -const TRANSACTION_TYPES_SET = Transaction.TYPES_SET - -/** - * Constructs a transaction managing shim. - * - * @constructor - * @extends Shim - * @classdesc - * A helper class for working with transactions. - * - * @param {Agent} agent - The agent the shim will use. - * @param {string} moduleName - The name of the module being instrumented. - * @param {string} resolvedName - The full path to the loaded module. - * - * @see Shim - * @see WebFrameworkShim - */ -function TransactionShim(agent, moduleName, resolvedName) { - Shim.call(this, agent, moduleName, resolvedName) - this._logger = logger.child({module: moduleName}) -} -module.exports = TransactionShim -util.inherits(TransactionShim, Shim) - -/** - * Enumeration of transaction types. - * - * Each of these values is also exposed directly on the `TransactionShim` class - * as static members. - * - * @readonly - * @memberof TransactionShim.prototype - * @enum {string} - */ -TransactionShim.TRANSACTION_TYPES = Transaction.TYPES -Object.keys(Transaction.TYPES).forEach(function defineTypeEnum(type) { - Shim.defineProperty(TransactionShim, type, Transaction.TYPES[type]) - Shim.defineProperty(TransactionShim.prototype, type, Transaction.TYPES[type]) -}) - - -/** - * Enumeration of possible transaction transport types used for distributed tracing. - * - * This enumeration is also exposed on the `TransactionShim` class. - * - * @readonly - * @memberof TransactionShim.prototype - * @enum {string} - */ -Shim.defineProperty( - TransactionShim, - 'TRANSPORT_TYPES', - Transaction.TRANSPORT_TYPES -) -Shim.defineProperty( - TransactionShim.prototype, - 'TRANSPORT_TYPES', - Transaction.TRANSPORT_TYPES -) - -TransactionShim.prototype.bindCreateTransaction = bindCreateTransaction -TransactionShim.prototype.pushTransactionName = pushTransactionName -TransactionShim.prototype.popTransactionName = popTransactionName -TransactionShim.prototype.setTransactionName = setTransactionName -TransactionShim.prototype.handleCATHeaders = handleCATHeaders -TransactionShim.prototype.insertCATRequestHeaders = insertCATRequestHeaders -TransactionShim.prototype.insertCATReplyHeader = insertCATReplyHeader - -// -------------------------------------------------------------------------- // - -/** - * @interface TransactionSpec - * - * @description - * Describes the type of transaction to be created by the function being - * wrapped by {@link Shim#bindCreateTransaction}. - * - * @property {string} type - * The type of transaction to create. Must be one of the values from - * {@link Shim#TRANSACTION_TYPES}. - * - * @property {bool} [nest=false] - * Indicates if the transaction being created is allowed to be nested within - * another transaction of the same type. If `false`, the default, the transaction - * will only be created if there is no existing transaction, or the current - * transaction is of a different type. If `true`, the transaction will be - * created regardless of the current transaction's type. - * - * @see Shim#bindCreateTransaction - * @see Shim#TRANSACTION_TYPES - */ - -// -------------------------------------------------------------------------- // - -/** - * Wraps one or more functions such that new transactions are created when - * invoked. - * - * - `bindCreateTransaction(nodule, property, spec)` - * - `bindCreateTransaction(func, spec)` - * - * @memberof TransactionShim.prototype - * - * @param {Object|Function} nodule - * The source for the property to wrap, or a single function to wrap. - * - * @param {string} [property] - * The property to wrap. If omitted, the `nodule` parameter is assumed to be - * the function to wrap. - * - * @param {TransactionSpec} spec - * The spec for creating the transaction. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its property. - */ -function bindCreateTransaction(nodule, property, spec) { - if (this.isObject(property) && !this.isArray(property)) { - // bindCreateTransaction(nodule, spec) - spec = property - property = null - } - - // Refuse to perform the wrapping if `spec.type` is not valid. - if (!TRANSACTION_TYPES_SET[spec.type]) { - this.logger.error( - {stack: (new Error()).stack}, - 'Invalid spec type "%s", must be one of %j.', - spec.type, Object.keys(TRANSACTION_TYPES_SET) - ) - return nodule - } - - // Perform the actual wrapping. - return this.wrap(nodule, property, function makeTransWrapper(shim, fn, name) { - if (!shim.isFunction(fn)) { - shim.logger.debug('Not wrapping "%s" with transaction, not a function.', name) - return fn - } - - // Is this transaction supposed to be nested? Pick the right wrapper for the - // job. - var makeWrapper = spec.nest ? _makeNestedTransWrapper : _makeTransWrapper - return makeWrapper(shim, fn, name, spec) - }) -} - -/** - * Pushes a new path segment onto the transaction naming stack. - * - * - `pushTransactionName(pathSegment)` - * - * Transactions are named for the middlware that sends the reponse. Some web - * frameworks are capable of mounting middlware in complex routing stacks. In - * order to maintain the correct name, transactions keep a stack of mount points - * for each middlware/router/app/whatever. The instrumentation should push on - * the mount path for wrapped things when route resolution enters and pop it - * back off when resolution exits the item. - * - * @memberof TransactionShim.prototype - * - * @param {string} pathSegment - The path segment to add to the naming stack. - */ -function pushTransactionName(pathSegment) { - var tx = this.tracer.getTransaction() - if (tx && tx.nameState) { - tx.nameState.appendPath(pathSegment) - } -} - -/** - * Pops one or more elements off the transaction naming stack. - * - * - `popTransactionName([pathSegment])` - * - * Ideally it is not necessary to ever provide the `pathSegment` parameter for - * this function, but we do not live in an ideal world. - * - * @memberof TransactionShim.prototype - * - * @param {string} [pathSegment] - * Optional. Path segment to pop the stack repeatedly until a segment matching - * `pathSegment` is removed. - */ -function popTransactionName(pathSegment) { - var tx = this.tracer.getTransaction() - if (tx && tx.nameState) { - tx.nameState.popPath(pathSegment) - } -} - -/** - * Sets the name to be used for this transaction. - * - * - `setTransactionName(name)` - * - * Either this _or_ the naming stack should be used. Do not use them together. - * - * @memberof TransactionShim.prototype - * - * @param {string} name - The name to use for the transaction. - */ -function setTransactionName(name) { - var tx = this.tracer.getTransaction() - if (tx) { - tx.setPartialName(name) - } -} - -/** - * Retrieves whatever CAT headers may be in the given headers. - * - * - `handleCATHeaders(headers [, segment [, transportType]])` - * - * @memberof TransactionShim.prototype - * - * This will check for either header naming style, and both request and reply - * CAT headers. - * - * @param {object} headers - * The request/response headers object to look in. - * - * @param {TraceSegment} [segment=null] - * The trace segment to associate the header data with. If no segment is - * provided then the currently active segment is used. - * - * @param {string} [transportType='Unknown'] - * The transport type that brought the headers. Usually `HTTP` or `HTTPS`. - */ -function handleCATHeaders(headers, segment, transportType) { - // Is CAT enabled? - if (!this.agent.config.cross_application_tracer.enabled) { - this.logger.trace('CAT disabled, not extracting header.') - return - } - if (!this.agent.config.encoding_key) { - this.logger.warn('Missing encoding key, not extracting CAT headers!') - return - } else if (!headers) { - this.logger.debug('No headers to search for CAT within') - return - } - - // Check that we're in an active transaction. - segment = segment || this.getSegment() - if (!segment || !segment.transaction.isActive()) { - this.logger.trace('Not adding CAT reply header, not in an active transaction.') - return - } - - const transaction = segment.transaction - - if (this.agent.config.distributed_tracing.enabled) { - transaction.acceptDistributedTraceHeaders(transportType, headers) - return - } - - // Hunt down the CAT headers. - var catId = null - var transactionData = null - var appData = null - for (var key in headers) { // eslint-disable-line guard-for-in - if (MATCH_CAT_ID_HEADER.test(key)) { - catId = headers[key] - } else if (MATCH_CAT_TRANSACTION_HEADER.test(key)) { - transactionData = headers[key] - } else if (MATCH_CAT_APP_DATA_HEADER.test(key)) { - appData = headers[key] - } - if (catId && transactionData && appData) { - break - } - } - - if (catId && transactionData) { - cat.handleCatHeaders(catId, transactionData, this.agent.config.encoding_key, transaction) - if (transaction.incomingCatId) { - this.logger.trace( - 'Got inbound CAT headers in transaction %s from %s', - transaction.id, - transaction.incomingCatId - ) - } - } - - if (appData) { - _handleCATReplyHeader(this, segment, appData) - // TODO: Handle adding ExternalTransaction metrics for this segment. - } -} - -/** - * Adds CAT headers for an outbound request. - * - * - `insertCATRequestHeaders(headers [, useAlternateHeaderNames])` - * - * @memberof TransactionShim.prototype - * - * @param {object} headers - * The outbound request headers object to inject our CAT headers into. - * - * @param {bool} [useAlternateHeaderNames=false] - * Indicates if HTTP-style headers should be used or alternate style. Some - * transport protocols are more strict on the characters allowed in headers - * and this option can be used to toggle use of pure-alpha header names. - */ -// TODO: abstract header logic shared with wrapRequest in http instrumentation -function insertCATRequestHeaders(headers, useAlternateHeaderNames) { - const crossAppTracingEnabled = this.agent.config.cross_application_tracer.enabled - const distributedTracingEnabled = this.agent.config.distributed_tracing.enabled - - if (!distributedTracingEnabled && !crossAppTracingEnabled) { - this.logger.trace( - 'Distributed Tracing and CAT are both disabled, not adding headers.' - ) - return - } - - if (!headers) { - this.logger.debug('Missing headers object, not adding headers!') - return - } - - const tx = this.tracer.getTransaction() - if (!tx || !tx.isActive()) { - this.logger.trace('No active transaction found, not adding headers.') - return - } - - if (distributedTracingEnabled) { - // TODO: Should probably honor SHIM_SYMBOLS.DISABLE_DT. - // TODO: Official testing and support. - tx.insertDistributedTraceHeaders(headers) - } else { - if (!this.agent.config.encoding_key) { - this.logger.warn('Missing encoding key, not adding CAT headers!') - return - } - - // Determine the names of the headers we'll add. - let transHeader = HTTP_CAT_TRANSACTION_HEADER - let idHeader = HTTP_CAT_ID_HEADER - if (useAlternateHeaderNames) { - idHeader = MQ_CAT_ID_HEADER - transHeader = MQ_CAT_TRANSACTION_HEADER - } - - // Add in the application ID. - if (this.agent.config.obfuscatedId) { - headers[idHeader] = this.agent.config.obfuscatedId - } - - // Generate an application path hash. This is essentially a snapshot of what - // the transaction would be named if it ended right now. - const pathHash = hashes.calculatePathHash( - this.agent.config.applications()[0], - tx.getFullName(), - tx.referringPathHash - ) - - tx.pushPathHash(pathHash) - - try { - const catData = hashes.obfuscateNameUsingKey( - JSON.stringify([tx.id, false, tx.tripId || tx.id, pathHash]), - this.agent.config.encoding_key - ) - if (catData) { - headers[transHeader] = catData - this.logger.trace('Added CAT headers for transaction %s', tx.id) - } - } catch (e) { - this.logger.warn({error: e.stack}, 'Failed to serialize CAT header!') - } - } -} - -/** - * Adds CAT headers for an outbound response. - * - * - `insertCATReplyHeaders(headers [, useAlternateHeaderNames])` - * - * @memberof TransactionShim.prototype - * - * @param {object} headers - * The outbound response headers object to inject our CAT headers into. - * - * @param {bool} [useAlternateHeaderNames=false] - * Indicates if HTTP-style headers should be used or alternate style. Some - * transport protocols are more strict on the characters allowed in headers - * and this option can be used to toggle use of pure-alpha header names. - */ -function insertCATReplyHeader(headers, useAlternateHeaderNames) { - // Is CAT enabled? - var config = this.agent.config - if (!config.cross_application_tracer.enabled) { - this.logger.trace('CAT disabled, not adding CAT reply header.') - return - } else if (config.distributed_tracing.enabled) { - this.logger.warn('Distributed tracing is enabled, not adding CAT reply header.') - return - } else if (!config.encoding_key) { - this.logger.warn('Missing encoding key, not adding CAT reply header!') - return - } else if (!headers) { - this.logger.debug('Missing headers object, not adding CAT reply header!') - return - } - - // Are we in a transaction? - var segment = this.getSegment() - if (!segment || !segment.transaction.isActive()) { - this.logger.trace('Not adding CAT reply header, not in an active transaction.') - return - } - var tx = segment.transaction - - // Hunt down the content length. - // NOTE: In AMQP, content-type and content-encoding are guaranteed fields, but - // there is no content-length field or header. For that, content length will - // always be -1. - var contentLength = -1 - for (var key in headers) { - if (key.toLowerCase() === 'content-length') { - contentLength = headers[key] - break - } - } - - // Compose the obfuscated app data value. - var appData = null - var txName = tx.getFullName() - try { - appData = hashes.obfuscateNameUsingKey(JSON.stringify([ - config.cross_process_id, - txName, - tx.queueTime / 1000, - tx.catResponseTime / 1000, - contentLength, - tx.id, - false - ]), config.encoding_key) - } catch (e) { - this.logger.warn({error: e.stack}, 'Failed to serialize CAT data for %s', txName) - } - - // Add the header. - headers[ - useAlternateHeaderNames ? MQ_CAT_APP_DATA_HEADER : HTTP_CAT_APP_DATA_HEADER - ] = appData - this.logger.trace('Added outbound response CAT headers for transaction %s', tx.id) -} - -/** - * Parses the given CAT response app-data and links the transaction to it. - * - * - `_handleCATReplyHeader(shim, segment, appData)` - * - * @private - * - * @param {TransactionShim} shim - * The shim to use in the process of extracting the app data. - * - * @param {!TraceSegment} segment - * The segment to attach the CAT data to. - * - * @param {string} appData - * The application data to parse and use. - */ -function _handleCATReplyHeader(shim, segment, appData) { - // Attempt to parse the app data header. - var config = shim.agent.config - try { - appData = JSON.parse( - hashes.deobfuscateNameUsingKey(appData, config.encoding_key) - ) - } catch (e) { - shim.logger.warn('Unparsable CAT application data header: %s', appData) - return - } - - // Make sure the app data is of the expected format and that we trust the - // origin application. - if (!appData.length || !shim.isString(appData[0])) { - shim.logger.trace('Unknown format for CAT application data header.') - return - } - var accountId = parseInt(appData[0].split('#')[0], 10) - var trustedIds = config.trusted_account_ids - if (trustedIds && trustedIds.indexOf(accountId) === -1) { - shim.logger.trace('CAT headers from untrusted application %s', accountId) - return - } - - // It's good! Pull out the data we care about. - segment.catId = appData[0] - segment.catTransaction = appData[1] - if (appData.length >= 6) { - segment.addAttribute('transaction_guid', appData[5]) - } - shim.logger.trace( - 'Got inbound response CAT headers for transaction %s from %s', - segment.transaction.id, - appData[5] - ) -} - -/** - * Creates a function that binds transactions to the execution of the function. - * - * The created transaction may be nested within an existing transaction if - * `spec.type` is not the same as the current transaction's type. - * - * @private - * - * @param {Shim} shim - * The shim used for the binding. - * - * @param {function} fn - * The function link with the transaction. - * - * @param {string} name - * The name of the wrapped function. - * - * @param {TransactionSpec} spec - * The spec for the transaction to create. - * - * @return {function} A function which wraps `fn` and creates potentially nested - * transactions linked to its execution. - */ -function _makeNestedTransWrapper(shim, fn, name, spec) { - return function nestedTransactionWrapper() { - if (!shim.agent.canCollectData()) { - return fn.apply(this, arguments) - } - - // Reuse existing transactions only if the type matches. - var transaction = shim.tracer.getTransaction() - var segment = shim.tracer.segment - - // Only create a new transaction if we either do not have a current - // transaction _or_ the current transaction is not of the type we want. - if (!transaction || spec.type !== transaction.type) { - shim.logger.trace('Creating new nested %s transaction for %s', spec.type, name) - transaction = new Transaction(shim.agent) - transaction.type = spec.type - segment = transaction.trace.root - } - - return shim.applySegment(fn, segment, false, this, arguments) - } -} - -/** - * Creates a function that binds transactions to the execution of the function. - * - * A transaction will only be created if there is not a currently active one. - * - * @private - * - * @param {Shim} shim - * The shim used for the binding. - * - * @param {function} fn - * The function link with the transaction. - * - * @param {string} name - * The name of the wrapped function. - * - * @param {TransactionSpec} spec - * The spec for the transaction to create. - * - * @return {function} A function which wraps `fn` and potentially creates a new - * transaction linked to the function's execution. - */ -function _makeTransWrapper(shim, fn, name, spec) { - return function transactionWrapper() { - // Don't nest transactions, reuse existing ones! - const existingTransaction = shim.tracer.getTransaction() - if (!shim.agent.canCollectData() || existingTransaction) { - return fn.apply(this, arguments) - } - - shim.logger.trace('Creating new %s transaction for %s', spec.type, name) - var transaction = new Transaction(shim.agent) - transaction.type = spec.type - return shim.applySegment(fn, transaction.trace.root, false, this, arguments) - } -} diff --git a/node_modules/newrelic/lib/shim/webframework-shim.js b/node_modules/newrelic/lib/shim/webframework-shim.js deleted file mode 100644 index c2e6a5a5..00000000 --- a/node_modules/newrelic/lib/shim/webframework-shim.js +++ /dev/null @@ -1,1184 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var genericRecorder = require('../metrics/recorders/generic') -var logger = require('../logger.js').child({component: 'WebFrameworkShim'}) -var metrics = require('../metrics/names') -var TransactionShim = require('./transaction-shim') -var Shim = require('./shim') -var specs = require('./specs') -var urltils = require('../util/urltils') -var util = require('util') - - -/** - * An enumeration of well-known web frameworks so that new instrumentations can - * use the same names we already use for first-party instrumentation. - * - * Each of these values is also exposed directly on the WebFrameworkShim class - * as static members. - * - * @readonly - * @memberof WebFrameworkShim - * @enum {string} - */ -var FRAMEWORK_NAMES = { - CONNECT: 'Connect', - DIRECTOR: 'Director', - EXPRESS: 'Expressjs', - HAPI: 'Hapi', - KOA: 'Koa', - RESTIFY: 'Restify', - FASTIFY: 'Fastify' -} - -var MIDDLEWARE_TYPE_DETAILS = { - APPLICATION: {name: 'Mounted App: ', path: true, record: false}, - ERRORWARE: {name: '', path: false, record: true}, - MIDDLEWARE: {name: '', path: false, record: true}, - PARAMWARE: {name: '', path: false, record: true}, - ROUTE: {name: 'Route Path: ', path: true, record: false}, - ROUTER: {name: 'Router: ', path: true, record: false} -} - -var MIDDLEWARE_TYPE_NAMES = { - APPLICATION: 'APPLICATION', - ERRORWARE: 'ERRORWARE', - MIDDLEWARE: 'MIDDLEWARE', - PARAMWARE: 'PARAMWARE', - ROUTE: 'ROUTE', - ROUTER: 'ROUTER' -} - -/** - * Name of the key used to store transaction information on `req` and `res`. - * - * @private - */ -var TRANSACTION_INFO_KEY = '__NR_transactionInfo' - - -/** - * Constructs a shim associated with the given agent instance, specialized for - * instrumenting web frameworks. - * - * @constructor - * @extends TransactionShim - * @classdesc - * A helper class for wrapping web framework modules. - * - * @param {Agent} agent - * The agent this shim will use. - * - * @param {string} moduleName - * The name of the module being instrumented. - * - * @param {string} resolvedName - * The full path to the loaded module. - * - * @param {string} [frameworkId] - * The name of the web framework being instrumented. If available, use one of - * the values from {@link WebFrameworkShim.FRAMEWORK_NAMES}. - * - * @see TransactionShim - * @see WebFrameworkShim.FRAMEWORK_NAMES - */ -function WebFrameworkShim(agent, moduleName, resolvedName, frameworkId) { - TransactionShim.call(this, agent, moduleName, resolvedName) - this._logger = logger.child({module: moduleName}) - if (frameworkId) { - this.setFramework(frameworkId) - } - - this._routeParser = _defaultRouteParser - this._errorPredicate = _defaultErrorPredicate - this._responsePredicate = _defaultResponsePredicate -} -module.exports = WebFrameworkShim -util.inherits(WebFrameworkShim, TransactionShim) - -// Add constants on the shim for the well-known frameworks. -WebFrameworkShim.FRAMEWORK_NAMES = FRAMEWORK_NAMES -Object.keys(FRAMEWORK_NAMES).forEach(function defineWebFrameworkMetricEnum(fwName) { - Shim.defineProperty(WebFrameworkShim, fwName, FRAMEWORK_NAMES[fwName]) - Shim.defineProperty(WebFrameworkShim.prototype, fwName, FRAMEWORK_NAMES[fwName]) -}) - -WebFrameworkShim.MIDDLEWARE_TYPE_NAMES = MIDDLEWARE_TYPE_NAMES -Object.keys(MIDDLEWARE_TYPE_NAMES).forEach(function defineMiddlewareTypeEnum(mtName) { - Shim.defineProperty(WebFrameworkShim, mtName, MIDDLEWARE_TYPE_NAMES[mtName]) - Shim.defineProperty(WebFrameworkShim.prototype, mtName, MIDDLEWARE_TYPE_NAMES[mtName]) -}) - -WebFrameworkShim.prototype.setRouteParser = setRouteParser -WebFrameworkShim.prototype.setFramework = setFramework -WebFrameworkShim.prototype.setTransactionUri = setTransactionUri -WebFrameworkShim.prototype.wrapMiddlewareMounter = wrapMiddlewareMounter -WebFrameworkShim.prototype.recordParamware = recordParamware -WebFrameworkShim.prototype.recordMiddleware = recordMiddleware -WebFrameworkShim.prototype.recordRender = recordRender -WebFrameworkShim.prototype.noticeError = noticeError -WebFrameworkShim.prototype.errorHandled = errorHandled -WebFrameworkShim.prototype.setErrorPredicate = setErrorPredicate -WebFrameworkShim.prototype.setResponsePredicate = setResponsePredicate -WebFrameworkShim.prototype.savePossibleTransactionName = savePossibleTransactionName -WebFrameworkShim.prototype.captureUrlParams = captureUrlParams - -// -------------------------------------------------------------------------- // - -/** - * @callback RouteParserFunction - * - * @summary - * Called whenever new middleware are mounted using the instrumented framework, - * this method should pull out a representation of the mounted path. - * - * @param {WebFrameworkShim} shim - * The shim in use for this instrumentation. - * - * @param {function} fn - * The function which received this route string/RegExp. - * - * @param {string} fnName - * The name of the function to which this route was given. - * - * @param {string|RegExp} route - * The route that was given to the function. - * - * @return {string|RegExp} The mount point from the given route. - */ - -/** - * @callback RouteRequestFunction - * - * @summary - * Extracts the request object from the arguments to the middleware function. - * - * @param {WebFrameworkShim} shim - The shim used for instrumentation. - * @param {function} fn - The middleware function. - * @param {string} fnName - The name of the middleware function. - * @param {Array} args - The arguments to the middleware function. - * - * @return {Object} The request object. - */ - -/** - * @callback RouteNextFunction - * - * @summary - * Used to wrap functions that users can call to continue to the next middleware. - * - * @param {WebFrameworkShim} shim - The shim used for instrumentation. - * @param {function} fn - The middleware function. - * @param {string} fnName - The name of the middleware function. - * @param {Array} args - The arguments to the middleware function. - * @param {NextWrapperFunction} wrap - A function to wrap an individual next function. - * - * @return {Object} The request object. - */ - -/** - * @callback RouteParameterFunction - * - * @summary - * Extracts the route parameters from the arguments to the middleware function. - * - * @param {WebFrameworkShim} shim - The shim used for instrumentation. - * @param {function} fn - The middleware function. - * @param {string} fnName - The name of the middleware function. - * @param {Array} args - The arguments to the middleware function. - * - * @return {Object} A map of route parameter names to values. - */ - -/** - * @callback MiddlewareWrapperFunction - * - * @summary - * Called for each middleware passed to a mounting method. Should perform the - * wrapping of the middleware. - * - * @param {WebFrameworkShim} shim - * The shim used for instrumentation. - * - * @param {function} middleware - * The middleware function to wrap. - * - * @param {string} fnName - * The name of the middleware function. - * - * @param {string} [route=null] - * The route the middleware is mounted on if one was found. - * - * @see WebFrameworkShim#recordMiddleware - * @see WebFrameworkShim#recordParamware - */ - -/** - * @interface MiddlewareSpec - * - * @description - * Describes the interface for middleware functions with this instrumentation. - * - * @property {number|RouteRequestFunction} [req=shim.FIRST] - * Indicates which argument to the middleware is the request object. It can also be - * a function to extract the request object from the middleware arguments. - * - * @property {number} [res=shim.SECOND] - * Indicates which argument to the middleware is the response object. - * - * @property {number|RouteNextFunction} [next=shim.THIRD] - * Indicates which argument to the middleware function is the callback. When it is - * a function, it will be called with the arguments of the middleware and a function - * for wrapping calls that represent continuation from the current middleware. - * - * @property {string} [name] - * The name to use for this middleware. Defaults to `middleware.name`. - * - * @property {RouteParameterFunction} [params] - * A function to extract the route parameters from the middleware arguments. - * Defaults to using `req.params`. - * - * @property {string} [type='MIDDLEWARE'] - * - * @property {string|function} [route=null] - * Route/path used for naming segments and transaction name candidates. If a function, - * will be invoked just before segment creation with middleware invocation. - * - * @property {boolean} [appendPath=true] - * Indicates that the path associated with the middleware should be appended - * and popped from the stack of name candidates. - */ - -/** - * @interface MiddlewareMounterSpec - * - * @description - * Describes the arguments provided to mounting methods (e.g. `app.post()`). - * - * @property {number|string} [route=null] - * Tells which argument may be the mounting path for the other arguments. If - * the indicated argument is a function it is assumed the route was not provided - * and the indicated argument is a middleware function. If a string is provided - * it will be used as the mounting path. - * - * @property {MiddlewareWrapperFunction} [wrapper] - * A function to call for each middleware function passed to the mounter. - */ - -/** - * @interface RenderSpec - * @extends RecorderSpec - * - * @description - * Describes the interface for render methods. - * - * @property {number} [view=shim.FIRST] - * Identifies which argument is the name of the view being rendered. Defaults - * to {@link Shim#ARG_INDEXES shim.FIRST}. - * - * @see SegmentSpec - * @see RecorderSpec - */ - -// -------------------------------------------------------------------------- // - -/** - * Sets the function used to convert the route handed to middleware-adding - * methods into a string. - * - * - `setRouteParser(parser)` - * - * @memberof WebFrameworkShim.prototype - * - * @param {RouteParserFunction} parser - The parser function to use. - */ -function setRouteParser(parser) { - if (!this.isFunction(parser)) { - return this.logger.debug('Given route parser is not a function.') - } - this._routeParser = parser -} - -/** - * Sets the name of the web framework in use by the server to the one given. - * - * - `setFramework(framework)` - * - * This should be the first thing the instrumentation does. - * - * @memberof WebFrameworkShim.prototype - * - * @param {WebFrameworkShim.FRAMEWORK_NAMES|string} framework - * The name of the framework. - * - * @see WebFrameworkShim.FRAMEWORK_NAMES - */ -function setFramework(framework) { - this._metrics = { - PREFIX: framework + '/', - FRAMEWORK: framework, - MIDDLEWARE: metrics.MIDDLEWARE.PREFIX - } - this.agent.environment.setFramework(framework) - - this._logger = this._logger.child({framework: framework}) - this.logger.trace({metrics: this._metrics}, 'Framework metric names set') -} - -/** - * Sets the URI path to be used for naming the transaction currenty in scope. - * - * @memberof WebFrameworkShim.prototype - * - * @param {string} uri - The URI path to use for the transaction. - */ -function setTransactionUri(uri) { - var tx = this.tracer.getTransaction() - if (!tx) { - return - } - - tx.nameState.setName( - this._metrics.FRAMEWORK, - tx.verb, - metrics.ACTION_DELIMITER, - uri - ) -} - -/** - * Records calls to methods used for rendering views. - * - * - `recordRender(nodule, properties [, spec])` - * - `recordRender(func [, spec])` - * - * @memberof WebFrameworkShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {RenderSpec} [spec] - * The spec for wrapping the render method. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - */ -function recordRender(nodule, properties, spec) { - if (this.isObject(properties) && !this.isArray(properties)) { - // recordRender(func, spec) - spec = properties - properties = null - } - - spec = this.setDefaults(spec, { - view: this.FIRST, - callback: null, - promise: null - }) - - return this.record(nodule, properties, function renderRecorder(shim, fn, name, args) { - var viewIdx = shim.normalizeIndex(args.length, spec.view) - if (viewIdx === null) { - shim.logger.debug( - 'Invalid spec.view (%d vs %d), not recording.', - spec.view, args.length - ) - return null - } - - return { - name: metrics.VIEW.PREFIX + args[viewIdx] + metrics.VIEW.RENDER, - callback: spec.callback, - promise: spec.promise, - recorder: genericRecorder, - - // Hidden class stuff - rowCallback: null, - stream: null, - internal: false - } - }) -} - -/** - * Wraps a method that is used to add middleware to a server. The middleware - * can then be recorded as metrics. - * - * - `wrapMiddlewareMounter(nodule, properties [, spec])` - * - `wrapMiddlewareMounter(func [, spec])` - * - * @memberof WebFrameworkShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {MiddlewareMounterSpec} [spec] - * Spec describing the parameters for this middleware mount point. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see WebFrameworkShim#recordMiddleware - */ -function wrapMiddlewareMounter(nodule, properties, spec) { - if (properties && !this.isString(properties) && !this.isArray(properties)) { - // wrapMiddlewareMounter(func, spec) - spec = properties - properties = null - } - if (this.isFunction(spec)) { - // wrapMiddlewareMounter(nodule [, properties], wrapper) - spec = {wrapper: spec} - } - - spec = this.setDefaults(spec, { - route: null, - endpoint: null - }) - - var wrapSpec = { - wrapper: function wrapMounter(shim, fn, fnName) { - if (!shim.isFunction(fn)) { - return fn - } - - return function wrappedMounter() { - var args = shim.argsToArray.apply(shim, arguments) - - // Normalize the route index and pull out the route argument if provided. - var routeIdx = null - var route = null - if (shim.isNumber(spec.route)) { - routeIdx = shim.normalizeIndex(args.length, spec.route) - route = routeIdx === null ? null : args[routeIdx] - const isArrayOfFunctions = shim.isArray(route) && shim.isFunction(route[0]) - if (shim.isFunction(route) || isArrayOfFunctions) { - routeIdx = null - route = null - } else if (shim.isArray(route)) { - route = route.map((routeArg) => { - return shim._routeParser.call(this, shim, fn, fnName, routeArg) - }) - } else { - route = shim._routeParser.call(this, shim, fn, fnName, route) - } - } else if (spec.route !== null) { - route = shim._routeParser.call(this, shim, fn, fnName, spec.route) - } - - _wrapMiddlewares.call(this, routeIdx, args) - function _wrapMiddlewares(_routeIdx, middlewares) { - for (let i = 0; i < middlewares.length; ++i) { - // If this argument is the route argument skip it. - if (i === _routeIdx) { - continue - } - - // Some platforms accept an arbitrarily nested array of middlewares, - // so if this argument is an array we must recurse into it. - var middleware = middlewares[i] - if (middleware instanceof Array) { - _wrapMiddlewares(null, middleware) - continue - } - - middlewares[i] = spec.wrapper.call( - this, - shim, - middleware, - shim.getName(middleware), - route - ) - } - } - - return fn.apply(this, args) - } - } - } - - _copyExpectedSpecParameters(wrapSpec, spec) - - return this.wrap(nodule, properties, wrapSpec) -} - -/** - * Records the provided function as a middleware. - * - * - `recordMiddleware(nodule, properties [, spec])` - * - `recordMiddleware(func [, spec])` - * - * @memberof WebFrameworkShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {MiddlewareSpec} [spec] - * The spec for wrapping the middleware. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - * - * @see WebFrameworkShim#wrapMiddlewareMounter - */ -function recordMiddleware(nodule, properties, spec) { - if (this.isObject(properties) && !this.isArray(properties)) { - // recordMiddleware(func, spec) - spec = properties - properties = null - } - spec = spec || Object.create(null) - - var mwSpec = new specs.MiddlewareSpec(spec) - var wrapSpec = new specs.WrapSpec(function wrapMiddleware(shim, middleware) { - return _recordMiddleware(shim, middleware, mwSpec) - }) - - _copyExpectedSpecParameters(wrapSpec, spec) - - return this.wrap(nodule, properties, wrapSpec) -} - -/** - * Records the provided function as a paramware. - * - * - `recordParamware(nodule, properties [, spec])` - * - `recordParamware(func [, spec])` - * - * Paramware are specialized middleware that execute when certain route - * parameters are encountered. For example, the route `/users/:userId` could - * trigger a paramware hooked to `userId`. - * - * For every new request that comes in, this should be called as early in the - * processing as possible. - * - * @memberof WebFrameworkShim.prototype - * - * @param {Object|Function} nodule - * The source for the properties to wrap, or a single function to wrap. - * - * @param {string|Array.} [properties] - * One or more properties to wrap. If omitted, the `nodule` parameter is - * assumed to be the function to wrap. - * - * @param {MiddlewareSpec} [spec] - * The spec for wrapping the middleware. - * - * @return {Object|Function} The first parameter to this function, after - * wrapping it or its properties. - */ -function recordParamware(nodule, properties, spec) { - if (this.isObject(properties) && !this.isArray(properties)) { - // recordParamware(func, spec) - spec = properties - properties = null - } - spec = spec || Object.create(null) - - var mwSpec = new specs.MiddlewareSpec(spec) - if (spec && this.isString(spec.name)) { - mwSpec.route = '[param handler :' + spec.name + ']' - } else { - mwSpec.route = '[param handler]' - } - mwSpec.type = MIDDLEWARE_TYPE_NAMES.PARAMWARE - - var wrapSpec = new specs.WrapSpec(function wrapParamware(shim, middleware, name) { - mwSpec.name = name - return _recordMiddleware(shim, middleware, mwSpec) - }) - - _copyExpectedSpecParameters(wrapSpec, spec) - - return this.wrap(nodule, properties, wrapSpec) -} - -/** - * Tells the shim that the given request has caused an error. - * - * The given error will be checked for truthiness and if it passes the error - * predicate check before being held onto. - * - * Use {@link WebFrameworkShim#errorHandled} to unnotice an error if it is later - * caught by the user. - * - * @memberof WebFrameworkShim.prototype - * - * @param {Request} req - The request which caused the error. - * @param {*?} err - The error which has occurred. - * - * @see WebFrameworkShim#errorHandled - * @see WebFrameworkShim#setErrorPredicate - */ -function noticeError(req, err) { - var txInfo = _getTransactionInfo(this, req) - if (txInfo && _isError(this, err)) { - _noticeError(this, txInfo, err) - } -} - -/** - * Indicates that the given error has been handled for this request. - * - * @memberof WebFrameworkShim.prototype - * - * @param {Request} req - The request which caused the error. - * @param {*} err - The error which has been handled. - * - * @see WebFrameworkShim#noticeError - * @see WebFrameworkShim#setErrorPredicate - */ -function errorHandled(req, err) { - var txInfo = _getTransactionInfo(this, req) - if (txInfo && txInfo.error === err) { - txInfo.errorHandled = true - } -} - -/** - * Sets a function to call when an error is noticed to determine if it is really - * an error. - * - * @memberof WebFrameworkShim.prototype - * - * @param {function(object): bool} pred - * Function which should return true if the object passed to it is considered - * an error. - * - * @see WebFrameworkShim#noticeError - * @see WebFrameworkShim#errorHandled - */ -function setErrorPredicate(pred) { - this._errorPredicate = pred -} - -/** - * Marks the current path as a potential responder. - * - * @memberof WebFrameworkShim.prototype - * - * @param {Request} req - The request which caused the error. - */ -function savePossibleTransactionName(req) { - var txInfo = _getTransactionInfo(this, req) - if (txInfo && txInfo.transaction) { - txInfo.transaction.nameState.markPath() - } -} - -/** - * Sets a function to call with the result of a middleware to determine if it has - * responded. - * - * @memberof WebFrameworkShim.prototype - * - * @param {function(args, object): bool} pred - * Function which should return true if the object passed to it is considered - * a response. - */ -function setResponsePredicate(pred) { - this._responsePredicate = pred -} - -/** - * Capture URL parameters from a request object as attributes of the current segment. - * - * @memberof WebFrameworkShim.prototype - * - * @param {Object} params - * An object with key-value pairs. - */ -function captureUrlParams(params) { - var segment = this.getSegment() - if (segment && !this.agent.config.high_security) { - urltils.copyParameters(params, segment.parameters) - } -} - -// -------------------------------------------------------------------------- // - -/** - * Default route parser function if one is not provided. - * - * @private - * - * @param {WebFrameworkShim} shim - * The shim in use for this instrumentation. - * - * @param {function} fn - * The function which received this route string/RegExp. - * - * @param {string} fnName - * The name of the function to which this route was given. - * - * @param {string|RegExp} route - * The route that was given to the function. - * - * @see RouteParserFunction - */ -function _defaultRouteParser(shim, fn, fnName, route) { - if (route instanceof RegExp) { - return '/' + route.source + '/' - } else if (typeof route === 'string') { - return route - } - - return '' -} - -/** - * Default error predicate just returns true. - * - * @private - * - * @return {bool} True. Always. - */ -function _defaultErrorPredicate() { - return true -} - -/** - * Default response predicate just returns false. - * - * @private - * - * @return {bool} False. Always. - */ -function _defaultResponsePredicate() { - return false -} - -/** - * Wraps the given function in a middleware recorder function. - * - * @private - * - * @param {WebFrameworkShim} shim - * The shim used for this instrumentation. - * - * @param {function} middleware - * The middleware function to record. - * - * @param {MiddlewareSpec} spec - * The spec describing the middleware. - * - * @return {function} The middleware function wrapped in a recorder. - */ -function _recordMiddleware(shim, middleware, spec) { - function getRoute() { - let route = spec.route || '/' - - if (shim.isFunction(route)) { - route = route() - } - - if (route instanceof RegExp) { - route = '/' + route.source + '/' - } else if (shim.isArray(route)) { - route = route.join(',') - } else if (route[0] !== '/') { - route = '/' + route - } - - return route - } - - const typeDetails = MIDDLEWARE_TYPE_DETAILS[spec.type] - const name = spec.name || shim.getName(shim.getOriginal(middleware)) - let metricName = shim._metrics.PREFIX + typeDetails.name - if (typeDetails.record) { - metricName = shim._metrics.MIDDLEWARE + metricName + name - } - - function getSegmentName(route) { - let segmentName = metricName - if (typeDetails.path) { - segmentName += route - } else if (route.length > 1) { - segmentName += '/' + route - } - - return segmentName - } - - var isErrorWare = spec.type === MIDDLEWARE_TYPE_NAMES.ERRORWARE - var getReq = shim.isFunction(spec.req) ? spec.req : _makeGetReq(shim, spec.req) - - return shim.record( - middleware, - spec.promise - ? middlewareWithPromiseRecorder - : middlewareWithCallbackRecorder - ) - - // TODO: let's please break these out - function middlewareWithCallbackRecorder(shim, fn, fnName, args) { - const route = getRoute() - - // Pull out the request object. - var req = getReq.call(this, shim, fn, fnName, args) - - // Fetch the transaction information from that request. - var txInfo = _getTransactionInfo(shim, req) - if (!txInfo || !txInfo.transaction) { - shim.logger.debug( - {txInfo: txInfo}, - 'Could not get transaction info in %s (%s)', - route, fnName - ) - return null - } - txInfo.transaction.nameState.setPrefix(shim._metrics.FRAMEWORK) - txInfo.errorHandled |= isErrorWare - - // Copy over route parameters onto the transaction root. - var params = shim.agent.config.high_security - ? null : spec.params.call(this, shim, fn, fnName, args, req) - - // Wrap up `next` and push on our name state if we find it. We only want to - // push the name state if there is a next so that we can safely remove it - // if context leaves this middleware. - var nextWrapper = null - if (shim.isFunction(spec.next)) { - const nextDetails = { - route, - wrapNext: spec.next, - isErrorWare, - isPromise: false, - appendPath: spec.appendPath - } - - nextWrapper = _makeNextBinder(nextDetails, txInfo) - } else { - var nextIdx = shim.normalizeIndex(args.length, spec.next) - if (nextIdx !== null && args[nextIdx] instanceof Function) { - const nextDetails = { - route, - wrapNext: function wrapNext(s, f, n, _args, wrap) { - wrap(_args, nextIdx) - }, - isErrorWare, - isPromise: false, - appendPath: spec.appendPath - } - - nextWrapper = _makeNextBinder(nextDetails, txInfo) - } - } - - // Append this middleware's mount point if it's not an errorware... - // (to avoid doubling up, a la 'WebTransaction/Expressjs/GET//test/test') - if (!isErrorWare && spec.appendPath) { - txInfo.transaction.nameState.appendPath(route, params) - } - - // ...and possibly construct a recorder - var recorder = null - if (typeDetails.record) { - var stackPath = txInfo.transaction.nameState.getPath() || '' - recorder = _makeMiddlewareRecorder(shim, metricName + '/' + stackPath) - } - - const segmentName = getSegmentName(route) - - // Finally, return the segment descriptor. - return { - name: segmentName, - callback: nextWrapper, - parent: txInfo.segmentStack[txInfo.segmentStack.length - 1], - recorder: recorder, - parameters: params, - after: function afterExec(shim, _fn, _name, err) { - var errIsError = _isError(shim, err) - if (errIsError) { - _noticeError(shim, txInfo, err) - } else if (!nextWrapper && !isErrorWare && spec.appendPath) { - txInfo.transaction.nameState.popPath(route) - } - if (errIsError || !nextWrapper) { - txInfo.segmentStack.pop() - } - } - } - } - - function middlewareWithPromiseRecorder(shim, fn, fnName, args) { - const route = getRoute() - - // Pull out the request object. - var req = getReq.call(this, shim, fn, fnName, args) - - // Fetch the transaction information from that request. - var txInfo = _getTransactionInfo(shim, req) - if (!txInfo || !txInfo.transaction) { - shim.logger.debug( - {txInfo: txInfo}, - 'Could not get transaction info in %s (%s)', - route, fnName - ) - return null - } - txInfo.transaction.nameState.setPrefix(shim._metrics.FRAMEWORK) - txInfo.errorHandled |= isErrorWare - - // Copy over route parameters onto the transaction root. - var params = shim.agent.config.high_security - ? null : spec.params.call(this, shim, fn, fnName, args, req) - - // Append this middleware's mount point and possibly construct a recorder. - if (spec.appendPath) { - txInfo.transaction.nameState.appendPath(route, params) - } - var recorder = null - if (typeDetails.record) { - var stackPath = txInfo.transaction.nameState.getPath() || '' - recorder = _makeMiddlewareRecorder(shim, metricName + '/' + stackPath) - } - - // The next callback style can still apply to promise based - // middleware (e.g. koa). In this case we would like to remove the - // path for the current executing middleware, then readd it once the - // next callback is done (either asynchronously or after the - // returned promise is resolved). - var nextWrapper = function pushSegment(shim, _fn, _name, segment) { - txInfo.segmentStack.push(segment) - } - if (shim.isFunction(spec.next)) { - const nextDetails = { - route, - wrapNext: spec.next, - isErrorWare, - isPromise: true, - appendPath: spec.appendPath - } - nextWrapper = _makeNextBinder(nextDetails, txInfo) - } else { - var nextIdx = shim.normalizeIndex(args.length, spec.next) - if (nextIdx !== null && args[nextIdx] instanceof Function) { - const nextDetails = { - route, - wrapNext: function wrapNext(s, f, n, _args, wrap) { - wrap(_args, nextIdx) - }, - isErrorWare, - isPromise: true, - appendPath: spec.appendPath - } - - nextWrapper = _makeNextBinder(nextDetails, txInfo) - } - } - - const segmentName = getSegmentName(route) - - // Finally, return the segment descriptor. - return { - name: segmentName, - parent: txInfo.segmentStack[txInfo.segmentStack.length - 1], - promise: spec.promise, - callback: nextWrapper, - recorder: recorder, - parameters: params, - after: function afterExec(shim, _fn, _name, err, result) { - if (shim._responsePredicate(args, result)) { - txInfo.transaction.nameState.freeze() - } - if (_isError(shim, err)) { - _noticeError(shim, txInfo, err) - } else { - txInfo.errorHandled = true - - if (spec.appendPath) { - txInfo.transaction.nameState.popPath(route) - } - } - txInfo.segmentStack.pop() - } - } - } -} - -function _makeGetReq(shim, req) { - return function getReqFromArgs(shim, fn, name, args) { - var reqIdx = shim.normalizeIndex(args.length, req) - if (reqIdx === null || !args[reqIdx]) { - shim.logger.debug('Can not find request parameter, not recording.') - return null - } - return args[reqIdx] - } -} - -function _makeNextBinder(nextDetails, txInfo) { - return function bindNext(shim, fn, _name, segment, args) { - if (!segment) { - return - } - txInfo.segmentStack.push(segment) - - nextDetails.wrapNext(shim, fn, _name, args, nextWrapper) - - // Called from outside to wrap functions that could be called to continue - // to the next middleware - function nextWrapper(nodule, property, isFinal) { - shim.wrap(nodule, property, function wrapper(shim, original) { - const parentSegment = segment || shim.getSegment() - return shim.bindSegment(function boundNext(err) { - // Only pop the stack if we didn't error. This way the transaction - // name is derived from the failing middleware. - if (_isError(shim, err)) { - _noticeError(shim, txInfo, err) - } else if (!isFinal && !nextDetails.isErrorWare && nextDetails.appendPath) { - segment.transaction.nameState.popPath(nextDetails.route) - } - - // The next call does not signify the end of the segment - // calling next in the promise case. Keep the segment on the - // stack and wait for its promise to be resolved to end it. - if (!nextDetails.isPromise) { - txInfo.segmentStack.pop() - segment.end() - } - var ret = original.apply(this, arguments) - - if (nextDetails.isPromise && shim.isPromise(ret)) { - // After the next call has resolved, we should reinstate the - // segment responsible for calling next in case there is - // more work to do in that scope. - return ret.then(function onNextFinish(v) { - if (nextDetails.appendPath) { - segment.transaction.nameState.appendPath(nextDetails.route) - } - - txInfo.segmentStack.push(segment) - - return v - }) - } - - return ret - }, parentSegment) // Bind to parent. - }) - } - } -} - -/** - * Retrieves the cached transaction information from the given object if it is - * available. - * - * @private - * - * @param {WebFrameworkShim} shim - The shim used for this instrumentation. - * @param {http.IncomingMessage} req - The incoming request object. - * - * @return {object?} The transaction information if available, otherwise null. - */ -function _getTransactionInfo(shim, req) { - try { - return req[TRANSACTION_INFO_KEY] || null - } catch (e) { - shim.logger.debug(e, 'Failed to fetch transaction info from req') - return null - } -} - -/** - * Creates a recorder for middleware metrics. - * - * @private - * - * - * @param {string} path - The mounting path of the middleware. - * @param {Segment} segment - The segment generated for this middleware. - * @param {string} scope - The scope of the metric to record. - */ -function _makeMiddlewareRecorder(shim, metricName) { - return function middlewareMetricRecorder(segment, scope) { - var duration = segment.getDurationInMillis() - var exclusive = segment.getExclusiveDurationInMillis() - var transaction = segment.transaction - - if (scope) { - transaction.measure(metricName, scope, duration, exclusive) - } - transaction.measure(metricName, null, duration, exclusive) - } -} - -/** - * Adds the given error to the transaction information if it is actually an error. - * - * @private - * - * @param {WebFrameworkShim} shim - * The shim used for this web framework. - * - * @param {TransactionInfo} txInfo - * The transaction context information for the request. - * - * @param {*} err - * The error to notice. - */ -function _noticeError(shim, txInfo, err) { - txInfo.error = err - txInfo.errorHandled = false -} - -/** - * Determines if the given object is an error according to the shim. - * - * @private - * - * @param {WebFrameworkShim} shim - * The shim used for this web framework. - * - * @param {?*} err - * The object to check for error-ness. - * - * @return {bool} True if the given object is an error according to the shim. - */ -function _isError(shim, err) { - return err && shim._errorPredicate(err) -} - -/** - * Copy the keys expected from source to destination. - * - * @private - * - * @param {Object} destination - * The spec object receiving the expected values - * - * @param {Object} source - * The spec object the values are coming from - */ -function _copyExpectedSpecParameters(destination, source) { - var keys = [ - 'matchArity' - ] - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - if (source[key] != null) { - destination[key] = source[key] - } - } -} diff --git a/node_modules/newrelic/lib/shimmer.js b/node_modules/newrelic/lib/shimmer.js deleted file mode 100644 index fb7282c1..00000000 --- a/node_modules/newrelic/lib/shimmer.js +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var path = require('path') -var fs = require('./util/unwrapped-core').fs -var logger = require('./logger').child({component: 'shimmer'}) -var INSTRUMENTATIONS = require('./instrumentations')() -var properties = require('./util/properties') -var shims = require('./shim') - -var MODULE_TYPE = shims.constants.MODULE_TYPE - -var CORE_INSTRUMENTATION = { - child_process: { - type: MODULE_TYPE.GENERIC, - file: 'child_process.js' - }, - crypto: { - type: MODULE_TYPE.GENERIC, - file: 'crypto.js' - }, - // domain: { // XXX Do not include domains in this list! The - // type: MODULE_TYPE.GENERIC, // core instrumentations are run at startup by - // file: 'domain.js' // requiring each of their modules. Loading - // }, // `domain` has side effects that we try to avoid. - dns: { - type: MODULE_TYPE.GENERIC, - file: 'dns.js' - }, - fs: { - type: MODULE_TYPE.GENERIC, - file: 'fs.js' - }, - http: { - type: MODULE_TYPE.TRANSACTION, - file: 'http.js' - }, - https: { - type: MODULE_TYPE.TRANSACTION, - file: 'http.js' - }, - inspector: { - type: MODULE_TYPE.GENERIC, - file: 'inspector.js' - }, - net: { - type: MODULE_TYPE.GENERIC, - file: 'net.js' - }, - timers: { - type: MODULE_TYPE.GENERIC, - file: 'timers.js' - }, - zlib: { - type: MODULE_TYPE.GENERIC, - file: 'zlib.js' - } -} - -const FORCE_MODULE_RESOLUTION_WARNING = - 'Unable to retrieve cached path for one or more modules ' + - 'with an already loaded parent. Forcing resolution. ' + - 'This should not occur during normal agent execution. ' + - 'Module resolution performance my be impacted. ' + - 'See trace-level logs for specific modules.' - -/** - * Unwrapping is only likely to be used by test code, and is a fairly drastic - * maneuver, but it should be pretty safe if there's a desire to reboot the - * agent in flight. - * - * All of the wrapped methods are tracked in this variable and used by unwrapAll - * below. - */ -var instrumented = [] - -function applyDebugState(shimmer, shim, nodule) { - if (shimmer.debug) { - shim.enableDebug() - instrumented.push(shim) - instrumented.push({__NR_unwrap: function unwrapNodule() { - delete nodule.__NR_instrumented_errored - delete nodule.__NR_instrumented - delete nodule.__NR_shim - }}) - nodule.__NR_shim = shim - } -} - -/** - * All instrumentation files must export the same interface: a single - * initialization function that takes the agent and the module to be - * instrumented. - */ -function instrument(agent, nodule, moduleName, resolvedName) { - var instrumentation = shimmer.registeredInstrumentations[moduleName] - if (properties.hasOwn(nodule, '__NR_instrumented') - || properties.hasOwn(nodule, '__NR_instrumented_errored')) { - logger.trace( - 'Already instrumented or failed to instrument %s, skipping redundant instrumentation', - moduleName - ) - return nodule - } - - - var shim = shims.createShimFromType( - instrumentation.type, - agent, - moduleName, - resolvedName - ) - - applyDebugState(shimmer, shim, nodule) - - try { - if (instrumentation.onRequire(shim, nodule, moduleName) !== false) { - nodule = shim.getExport(nodule) - nodule.__NR_instrumented = true - } - } catch (instrumentationError) { - nodule.__NR_instrumented_errored = true - if (instrumentation.onError) { - try { - instrumentation.onError(instrumentationError) - } catch (e) { - logger.warn( - e, instrumentationError, - 'Custom instrumentation for %s failed, then the onError handler threw an error', - moduleName - ) - } - } else { - logger.warn( - instrumentationError, - 'Custom instrumentation for %s failed. Please report this to the ' + - 'maintainers of the custom instrumentation.', - moduleName - ) - } - } - - return nodule -} - -function _firstPartyInstrumentation(agent, fileName, shim, nodule, moduleName) { - var fullPath = path.resolve(fileName) - if (!fs.existsSync(fileName)) { - return logger.warn( - 'Tried to load instrumentation from %s, but file does not exist', - fullPath - ) - } - try { - return require(fileName)(agent, nodule, moduleName, shim) - } catch (error) { - logger.warn( - error, - 'Failed to instrument module %s using %s', - path.basename(fileName, '.js'), - fullPath - ) - } -} - -function _postLoad(agent, nodule, name, resolvedName) { - var instrumentation - instrumentation = shimmer.getInstrumentationNameFromModuleName(name) - - // Check if this is a known instrumentation and then run it. - if (shimmer.registeredInstrumentations[instrumentation]) { - logger.trace('Instrumenting %s.', name) - return instrument(agent, nodule, instrumentation, resolvedName) - } - - return nodule -} - -var shimmer = module.exports = { - /** - * If debug isn't false, the agent will retain references to wrapped methods - * for the entire lifetime of the agent. Some instrumentation depends on - * wrapping functions on individual objects, and this will cause the agent - * to retain references to a large number of dead objects. - */ - debug: false, - - /** - * Detects if the given function has already been wrapped. - * - * @param {function} fn - The function to look for a wrapper on. - * - * @return {bool} True if `fn` exists and has an attached original, else false. - */ - isWrapped: function isWrapped(fn) { - return !!(fn && fn.__NR_original) - }, - - /** - * Don't throw, but do log and bail out if wrapping fails. - * - * Provide an escape hatch by creating a closure around the original method - * and object / module wrapped into a helper function that will restore the - * original function / method. See Sinon for a systematic use of this - * pattern. - * - * @param {object} nodule Class or module containing the function to wrap. - * @param {object} noduleName Human-readable module / Class name. More - * helpful than you'd think. - * @param {string} methods One or more names of methods or functions to extract - * and wrap. - * @param {function} wrapper A generator that, when called, returns a - * wrapped version of the original function. - */ - wrapMethod: function wrapMethod(nodule, noduleName, methods, wrapper) { - if (!methods) { - return logger.warn( - new Error(), - "Must include a method name to wrap. Called from:" - ) - } - - if (!noduleName) noduleName = '[unknown]' - if (!Array.isArray(methods)) methods = [methods] - - methods.forEach(function cb_forEach(method) { - var fqmn = noduleName + '.' + method - - if (!nodule) { - return logger.debug("Can't wrap %s from nonexistent object.", fqmn) - } - - if (!wrapper) { - return logger.debug("Can't wrap %s without a wrapper generator.", fqmn) - } - - var original = nodule[method] - - if (!original) return logger.trace("%s not defined, so not wrapping.", fqmn) - if (original.__NR_unwrap) return logger.debug("%s already wrapped by agent.", fqmn) - - var wrapped = wrapper(original, method) - Object.keys(original).forEach((key) => { - wrapped[key] = original[key] - }) - wrapped.__NR_original = original - wrapped.__NR_unwrap = function __NR_unwrap() { - nodule[method] = original - logger.trace("Removed instrumentation from %s.", fqmn) - } - - nodule[method] = wrapped - if (shimmer.debug) instrumented.push(wrapped) - logger.trace("Instrumented %s.", fqmn) - }) - }, - - /** - * Sometimes you gotta do some crazy stuff to get the job done. Instead of using - * regular monkeypatching, wrapDeprecated allows you to pass in a getter and setter - * and then uses defineProperty to replace the original property with an - * accessor. Note that responsibility for unwrapping is not handled by this - * function. - * - * @param {object} nodule Class or module containing the property to - * wrap. - * @param {object} noduleName Human-readable module / Class name. More - * helpful than you'd think. - * @param {string} property The property to replace with the accessor. - * @param {function} options Optional getter and setter to use for the accessor. - * - * @returns {object} The original value of the property. - */ - wrapDeprecated: function wrapDeprecated(nodule, noduleName, property, options) { - if (!property) { - logger.warn(new Error(), "Must include a function name to wrap. Called from:") - return - } - - if (!noduleName) noduleName = '[unknown]' - - var fqmn = noduleName + '.' + property - if (!nodule) { - logger.debug("Can't wrap %s from nonexistent object.", fqmn) - return - } - - var original = nodule[property] - if (!original) { - logger.trace("%s not defined, so not wrapping.", fqmn) - return - } - - delete nodule[property] - - var descriptor = { - configurable: true, - enumerable: true - } - if (options.get) descriptor.get = options.get - if (options.set) descriptor.set = options.set - Object.defineProperty(nodule, property, descriptor) - logger.trace("Instrumented %s.", fqmn) - - if (shimmer.debug) { - instrumented.push({ - __NR_unwrap: function unwrapDeprecated() { - delete nodule[property] - nodule[property] = original - } - }) - } - - return original - }, - - unwrapMethod: function unwrapMethod(nodule, noduleName, method) { - if (!noduleName) noduleName = '[unknown]' - if (!method) return logger.debug("Must include a method name to unwrap. " + - "Called from: %s", new Error().stack) - - var fqmn = noduleName + '.' + method - - if (!nodule) { - return logger.debug("Can't unwrap %s from nonexistent object.", fqmn) - } - - var wrapped = nodule[method] - - // keep instrumented up to date - var pos = instrumented.indexOf(wrapped) - if (pos !== -1) instrumented.splice(pos, 1) - - if (!wrapped) return logger.debug("%s not defined, so not unwrapping.", fqmn) - if (!wrapped.__NR_unwrap) return logger.debug("%s isn't unwrappable.", fqmn) - - wrapped.__NR_unwrap() - }, - - unwrapAll: function unwrapAll() { - instrumented.forEach(function cb_forEach(wrapper) { - wrapper.__NR_unwrap() - }) - instrumented = [] - }, - - /** - * Patch the module.load function so that we see modules loading and - * have an opportunity to patch them with instrumentation. - */ - patchModule: function patchModule(agent) { - logger.trace("Wrapping module loader.") - var Module = require('module') - var filepathMap = {} - - shimmer.wrapMethod(Module, 'Module', '_resolveFilename', function wrapRes(resolve) { - return function wrappedResolveFilename(file) { - // This is triggered by the load call, so record the path that has been seen so - // we can examine it after the load call has returned. - const resolvedFilepath = resolve.apply(this, arguments) - filepathMap[file] = resolvedFilepath - return resolvedFilepath - } - }) - - shimmer.wrapMethod(Module, 'Module', '_load', function wrapLoad(load) { - return function wrappedLoad(request, parent, isMain) { - // _load() will invoke _resolveFilename() first time resolving a module. - const m = load.apply(this, arguments) - - const fileName = resolveFileName(request, parent, isMain) - return _postLoad(agent, m, request, fileName) - } - }) - - /** - * Forces file name resolve for modules not in our cache when - * their parent has already been loaded/cached by Node. - * Provides a fall-back for unexpected cases that may occur. - * Also provides flexibilty for testing now that node 11+ caches these. - * @param {*} request - * @param {*} parent - * @param {*} isMain - */ - function resolveFileName(request, parent, isMain) { - const cachedPath = filepathMap[request] - if (!cachedPath && parent && parent.loaded) { - logger.warnOnce('Force Resolution', FORCE_MODULE_RESOLUTION_WARNING) - - if (logger.traceEnabled()) { - logger.trace(`No cached path found for ${request}. Forcing resolution.`) - } - - // Our patched _resolveFilename will cache. No need to here. - return Module._resolveFilename(request, parent, isMain) - } - - return cachedPath - } - }, - - unpatchModule: function unpatchModule() { - logger.trace("Unwrapping to previous module loader.") - var Module = require('module') - - shimmer.unwrapMethod(Module, 'Module', '_resolveFilename') - shimmer.unwrapMethod(Module, 'Module', '_load') - }, - - bootstrapInstrumentation: function bootstrapInstrumentation(agent) { - // Instrument global. - const globalShim = new shims.Shim(agent, 'globals', 'globals') - applyDebugState(shimmer, globalShim, global) - var globalsFilepath = path.join(__dirname, 'instrumentation', 'core', 'globals.js') - _firstPartyInstrumentation(agent, globalsFilepath, globalShim, global, 'globals') - - // Instrument each of the core modules. - Object.keys(CORE_INSTRUMENTATION).forEach(function forEachCore(mojule) { - const core = CORE_INSTRUMENTATION[mojule] - const filePath = path.join(__dirname, 'instrumentation', 'core', core.file) - let uninstrumented = null - - try { - uninstrumented = require(mojule) - } catch (err) { - logger.trace( - 'Could not load core module %s got error %s', - mojule, - err - ) - } - - const shim = shims.createShimFromType(core.type, agent, mojule, mojule) - applyDebugState(shimmer, shim, core) - _firstPartyInstrumentation(agent, filePath, shim, uninstrumented, mojule) - }) - - // Register all the first-party instrumentations. - Object.keys(INSTRUMENTATIONS).forEach(function forEachInstrumentation(moduleName) { - var instrInfo = INSTRUMENTATIONS[moduleName] - if (instrInfo.module) { - // Because external instrumentations can change independent of - // the agent core, we don't want breakages in them to entirely - // disable the agent. - try { - var hooks = require(instrInfo.module + '/nr-hooks') - hooks.forEach(shimmer.registerInstrumentation) - } catch (e) { - logger.warn('Failed to load instrumentation for ' + instrInfo.module, e) - return - } - } else if (moduleName === 'amqplib') { - // TODO: Remove this code when amqplib instrumentation is made external. - require('./instrumentation/amqplib').selfRegister(shimmer) - } else { - var fileName = path.join(__dirname, 'instrumentation', moduleName + '.js') - shimmer.registerInstrumentation({ - moduleName: moduleName, - type: instrInfo.type, - onRequire: _firstPartyInstrumentation.bind(null, agent, fileName) - }) - } - }) - - // Even though domain is a core module we add it as a registered - // instrumentation to be lazy-loaded because we do not want to cause domain - // usage. - var domainPath = path.join(__dirname, 'instrumentation/core/domain.js') - shimmer.registerInstrumentation({ - moduleName: 'domain', - type: null, - onRequire: _firstPartyInstrumentation.bind(null, agent, domainPath) - }) - }, - - registerInstrumentation: function registerInstrumentation(opts) { - shimmer.registeredInstrumentations[opts.moduleName] = opts - }, - - registeredInstrumentations: Object.create(null), - - /** - * NOT FOR USE IN PRODUCTION CODE - * - * If an instrumented module has a dependency on another instrumented module, - * and multiple tests are being run in a single test suite with their own - * setup and teardown between tests, it's possible transitive dependencies - * will be unwrapped in the module cache in-place (which needs to happen to - * prevent stale closures from channeling instrumentation data to incorrect - * agents, but which means the transitive dependencies won't get re-wrapped - * the next time the parent module is required). - * - * Since this only applies in test code, it's not worth the drastic - * monkeypatching to Module necessary to walk the list of child modules and - * re-wrap them. - * - * Use this to re-apply any applicable instrumentation. - */ - reinstrument: function reinstrument(agent, modulePath) { - return _postLoad(agent, require(modulePath), modulePath) - }, - - /** - * Given a NodeJS module name, return the name/identifier of our - * instrumentation. These two things are usually, but not always, - * the same. - */ - getInstrumentationNameFromModuleName(moduleName) { - var instrumentation - // XXX When updating these special cases, also update `uninstrumented`. - // To allow for instrumenting both 'pg' and 'pg.js'. - if (moduleName === 'pg.js') { - instrumentation = 'pg' - } if (moduleName === 'mysql2') { - // mysql2 (https://github.com/sidorares/node-mysql2) is a drop in replacement for - // mysql which conforms to the existing mysql API. If we see mysql2, treat it as - // mysql - instrumentation = 'mysql' - } else { - instrumentation = moduleName - } - return instrumentation - } -} diff --git a/node_modules/newrelic/lib/spans/create-span-event-aggregator.js b/node_modules/newrelic/lib/spans/create-span-event-aggregator.js deleted file mode 100644 index cad5e561..00000000 --- a/node_modules/newrelic/lib/spans/create-span-event-aggregator.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const psemver = require('../util/process-version') -const logger = require('../logger') -const SpanEventAggregator = require('./span-event-aggregator') -const StreamingSpanEventAggregator = require('./streaming-span-event-aggregator') - -function createSpanEventAggregator(config, collector, metrics) { - let shouldCreateStreaming = false - if (config.infinite_tracing.trace_observer.host) { - // TODO: ideally this validation and configuration clearing would happen - // in the config. Since we don't currently have a way to generate - // support metrics in the config, keeping this related logic together here. - // If logic happened prior, could merely check for existance of trace_observer.host. - shouldCreateStreaming = validateInfiniteTracing(config.infinite_tracing.trace_observer) - - if (!shouldCreateStreaming) { - // Explicitly disable for any downstream consumers - config.infinite_tracing.trace_observer.host = '' - config.infinite_tracing.trace_observer.port = '' - } - } - - if (shouldCreateStreaming) { - return createStreamingAggregator(config, collector, metrics) - } - - return createStandardAggregator(config, collector, metrics) -} - -function createStreamingAggregator(config, collector, metrics) { - logger.trace('Creating streaming span event aggregator for infinite tracing.') - - // loading the class here to ensure its behind a feature flag - // and won't trigger a grpc load in node 8 - const GrpcConnection = require('../grpc/connection') - const connection = new GrpcConnection(config.infinite_tracing.trace_observer, metrics) - const SpanStreamer = require('./span-streamer') - const spanStreamer = new SpanStreamer( - config.license_key, - connection, - metrics, - config.infinite_tracing.span_events.queue_size - ) - - const opts = { - periodMs: 1000, - limit: 50000, - span_streamer: spanStreamer - } - - const aggregator = new StreamingSpanEventAggregator(opts, collector, metrics) - - return aggregator -} - -function createStandardAggregator(config, collector, metrics) { - logger.trace('Creating standard span event aggregator.') - - const opts = { - periodMs: config.event_harvest_config.report_period_ms, - limit: config.event_harvest_config.harvest_limits.span_event_data - } - - const aggregator = new SpanEventAggregator(opts, collector, metrics) - return aggregator -} - -function validateInfiniteTracing(trace_observer) { - if (!psemver.satisfies('>=10.10.0')) { - logger.warn( - 'Infinite tracing disabled: this version of Node is not supported (must be >=10.10.0)' - ) - return false - } - - trace_observer.host = trace_observer.host.trim() - - if (!validateHostName(trace_observer.host)) { - logger.warn('Infinite tracing disabled: invalid infinite_tracing.trace_observer.host value') - - return false - } - - if (typeof trace_observer.port !== 'string') { - trace_observer.port = String(trace_observer.port) - } - - trace_observer.port = trace_observer.port.trim() - - if (!validatePortValue(trace_observer.port)) { - logger.warn('Infinite tracing disabled: invalid infinite_tracing.trace_observer.port value') - - return false - } - - return true -} - -function validateHostName(host) { - // Regular expression for validating a hostname - const hostReg = /(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/ - - return hostReg.test(host) -} - -function validatePortValue(port) { - if (port.length === 0) return false - - return !isNaN(port) -} - -module.exports = createSpanEventAggregator diff --git a/node_modules/newrelic/lib/spans/map-to-streaming-type.js b/node_modules/newrelic/lib/spans/map-to-streaming-type.js deleted file mode 100644 index aced1fbc..00000000 --- a/node_modules/newrelic/lib/spans/map-to-streaming-type.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const STRING_TYPE = 'string_value' -const BOOL_TYPE = 'bool_value' -const INT_TYPE = 'int_value' -const DOUBLE_TYPE = 'double_value' - -function mapToStreamingType(value) { - if (value === null || value === undefined) { - return - } - - const valueType = typeof value - - let protoTypeString = null - switch (valueType) { - case 'string': { - protoTypeString = STRING_TYPE - break - } - case 'boolean': { - protoTypeString = BOOL_TYPE - break - } - case 'number': { - const isInteger = Number.isInteger(value) - protoTypeString = isInteger ? INT_TYPE : DOUBLE_TYPE - break - } - default: { - protoTypeString = null - } - } - - if (protoTypeString) { - return { - [protoTypeString]: value - } - } - - return -} - -module.exports = mapToStreamingType diff --git a/node_modules/newrelic/lib/spans/span-context.js b/node_modules/newrelic/lib/spans/span-context.js deleted file mode 100644 index 0c2d70eb..00000000 --- a/node_modules/newrelic/lib/spans/span-context.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const {MAXIMUM_CUSTOM_ATTRIBUTES} = require('../attributes') -const {PrioritizedAttributes, ATTRIBUTE_PRIORITY} = require('../prioritized-attributes') -const {DESTINATIONS} = require('../config/attribute-filter') - -// Scoping impacts memoization. We could decide to add a scope instead of including -// spans in segment scope in the future. -const ATTRIBUTE_SCOPE = 'segment' - -class SpanContext { - constructor(intrinsicAttributes, customAttributes) { - this.intrinsicAttributes = intrinsicAttributes || Object.create(null) - - this.customAttributes = - customAttributes || new PrioritizedAttributes(ATTRIBUTE_SCOPE, MAXIMUM_CUSTOM_ATTRIBUTES) - - this.ATTRIBUTE_PRIORITY = ATTRIBUTE_PRIORITY - - this.hasError = false - this.errorDetails = null - } - - addIntrinsicAttribute(key, value) { - this.intrinsicAttributes[key] = value - } - - addCustomAttribute(key, value, priority) { - this.customAttributes.addAttribute( - DESTINATIONS.SPAN_EVENT, - key, - value, - false, - priority - ) - } - - /** - * Set error details to be potentially be used to create span - * attributes. Attributes will be created unless the transaction - * ends with an ignored error status code. - * - * Last error wins. - */ - setError(details) { - this.hasError = true - - // Error details will be used to create attributes unless the transaction ends - // with an ignored status code. - this.errorDetails = details - } -} - -module.exports = SpanContext diff --git a/node_modules/newrelic/lib/spans/span-event-aggregator.js b/node_modules/newrelic/lib/spans/span-event-aggregator.js deleted file mode 100644 index a4f8e6f7..00000000 --- a/node_modules/newrelic/lib/spans/span-event-aggregator.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger') -let spanLogger = null -const EventAggregator = require('../aggregators/event-aggregator') -const SpanEvent = require('./span-event') -const NAMES = require('../metrics/names') -const LIMIT = 1000 - -class SpanEventAggregator extends EventAggregator { - constructor(opts, collector, metrics) { - opts = opts || {} - opts.method = opts.method || 'span_event_data' - opts.metricNames = opts.metricNames || NAMES.SPAN_EVENTS - - spanLogger = logger.child({component: 'span_aggregator'}) - - super(opts, collector, metrics) - } - - _toPayloadSync() { - const events = this.events - - if (events.length === 0) { - spanLogger.debug('No span events to send.') - return - } - - const metrics = { - reservoir_size: events.limit, - events_seen: events.seen - } - const eventData = events.toArray() - - return [this.runId, metrics, eventData] - } - - start() { - logger.debug('starting SpanEventAggregator') - return super.start() - } - - send() { - if (spanLogger.traceEnabled()) { - spanLogger.trace({ - spansCollected: this.length, - spansSeen: this.seen - }, 'Entity stats on span harvest') - } - super.send() - } - - /** - * Attempts to add the given segment to the collection. - * - * @param {TraceSegment} segment - The segment to add. - * @param {string} [parentId=null] - The GUID of the parent span. - * - * @return {bool} True if the segment was added, or false if it was discarded. - */ - addSegment(segment, parentId, isRoot) { - // Check if the priority would be accepted before creating the event object. - const tx = segment.transaction - - if (tx.priority < this._items.getMinimumPriority()) { - ++this.events.seen - this._metrics.getOrCreateMetric(this._metricNames.SEEN).incrementCallCount() - - return false - } - const span = SpanEvent.fromSegment(segment, parentId || null, isRoot) - return this.add(span, tx.priority) - } -} - -module.exports = SpanEventAggregator -module.exports.LIMIT = LIMIT diff --git a/node_modules/newrelic/lib/spans/span-event.js b/node_modules/newrelic/lib/spans/span-event.js deleted file mode 100644 index 35284bf5..00000000 --- a/node_modules/newrelic/lib/spans/span-event.js +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const Config = require('../config') -const {truncate} = require('../util/byte-limit') - -const {DESTINATIONS} = require('../config/attribute-filter') -const NAMES = require('../metrics/names') -const HTTP_LIBRARY = 'http' -const CLIENT_KIND = 'client' -const CATEGORIES = { - HTTP: 'http', - DATASTORE: 'datastore', - GENERIC: 'generic' -} - -const EMPTY_USER_ATTRS = Object.freeze(Object.create(null)) - -/** - * All the intrinsic attributes for span events, regardless of kind. - */ -class SpanIntrinsics { - constructor() { - this.type = 'Span' - this.traceId = null - this.guid = null - this.parentId = null - this.transactionId = null - this.sampled = null - this.priority = null - this.name = null - this.category = CATEGORIES.GENERIC - this.component = null - this.timestamp = null - this.duration = null - this['nr.entryPoint'] = null - this['span.kind'] = null - this.trustedParentId = null - this.tracingVendors = null - } -} - -/** - * General span event class. - * - * Do not construct directly, instead use one of the static `from*` methods such - * as `SpanEvent.fromSegment`. - * - * @private - * @class - */ -class SpanEvent { - constructor(attributes, customAttributes) { - this.customAttributes = customAttributes - this.attributes = attributes - this.intrinsics = new SpanIntrinsics() - } - - static get CATEGORIES() { - return CATEGORIES - } - - static get DatastoreSpanEvent() { - return DatastoreSpanEvent - } - - static get HttpSpanEvent() { - return HttpSpanEvent - } - - /** - * Constructs a `SpanEvent` from the given segment. - * - * The constructed span event will contain extra data depending on the - * category of the segment. - * - * @param {TraceSegment} segment - The segment to turn into a span event. - * @param {?string} [parentId=null] - The ID of the segment's parent. - * - * @return {SpanEvent} The constructed event. - */ - static fromSegment(segment, parentId = null, isRoot = false) { - const spanContext = segment.getSpanContext() - - // Since segments already hold span agent attributes and we want to leverage - // filtering, we add to the segment attributes prior to processing. - if (spanContext.hasError && !segment.transaction.hasIgnoredErrorStatusCode()) { - const details = spanContext.errorDetails - segment.addSpanAttribute('error.message', details.message) - segment.addSpanAttribute('error.class', details.type) - if (details.expected) { - segment.addSpanAttribute('error.expected', details.expected) - } - } - - const attributes = segment.attributes.get(DESTINATIONS.SPAN_EVENT) - - const customAttributes = spanContext.customAttributes.get(DESTINATIONS.SPAN_EVENT) - - let span = null - if (HttpSpanEvent.testSegment(segment)) { - span = new HttpSpanEvent(attributes, customAttributes) - } else if (DatastoreSpanEvent.testSegment(segment)) { - span = new DatastoreSpanEvent(attributes, customAttributes) - } else { - span = new SpanEvent(attributes, customAttributes) - } - - for (const [key, value] of Object.entries(spanContext.intrinsicAttributes)) { - span.intrinsics[key] = value - } - - const tx = segment.transaction - - span.intrinsics.traceId = tx.traceId - span.intrinsics.guid = segment.id - span.intrinsics.parentId = parentId - span.intrinsics.transactionId = tx.id - span.intrinsics.sampled = tx.sampled - span.intrinsics.priority = tx.priority - span.intrinsics.name = segment.name - - if (isRoot) { - span.intrinsics.trustedParentId = tx.traceContext.trustedParentId - if (tx.traceContext.tracingVendors) { - span.intrinsics.tracingVendors = tx.traceContext.tracingVendors - } - } - - // Only set this if it will be `true`. Must be `null` otherwise. - if (tx.baseSegment === segment) { - span.intrinsics['nr.entryPoint'] = true - } - - // Timestamp in milliseconds, duration in seconds. Yay consistency! - span.intrinsics.timestamp = segment.timer.start - span.intrinsics.duration = segment.timer.getDurationInMillis() / 1000 - - return span - } - - toJSON() { - return [ - _filterNulls(this.intrinsics), - this.customAttributes ? - _filterNulls(this.customAttributes) : - EMPTY_USER_ATTRS, - _filterNulls(this.attributes) - ] - } - - addCustomAttribute(key, value, truncateExempt = false) { - const {attributeFilter} = Config.getInstance() - const dest = attributeFilter.filterSegment(DESTINATIONS.SPAN_EVENT, key) - if (dest & DESTINATIONS.SPAN_EVENT) { - this.customAttributes[key] = truncateExempt ? value : _truncate(value) - } - } - - addAttribute(key, value, truncateExempt = false) { - const {attributeFilter} = Config.getInstance() - const dest = attributeFilter.filterSegment(DESTINATIONS.SPAN_EVENT, key) - if (dest & DESTINATIONS.SPAN_EVENT) { - this.attributes[key] = truncateExempt ? value : _truncate(value) - } - } -} - -/** - * Span event class for external requests. - * - * @private - * @class - */ -class HttpSpanEvent extends SpanEvent { - constructor(attributes, customAttributes) { - super(attributes, customAttributes) - - this.intrinsics.category = CATEGORIES.HTTP - this.intrinsics.component = attributes.library || HTTP_LIBRARY - this.intrinsics['span.kind'] = CLIENT_KIND - - if (attributes.library) { - attributes.library = null - } - - if (attributes.url) { - this.addAttribute('http.url', attributes.url) - attributes.url = null - } - - if (attributes.procedure) { - this.addAttribute('http.method', attributes.procedure) - attributes.procedure = null - } - } - - static testSegment(segment) { - return segment.name.startsWith(NAMES.EXTERNAL.PREFIX) - } -} - -/** - * Span event class for datastore operations and queries. - * - * @private - * @class. - */ -class DatastoreSpanEvent extends SpanEvent { - constructor(attributes, customAttributes) { - super(attributes, customAttributes) - - this.intrinsics.category = CATEGORIES.DATASTORE - this.intrinsics['span.kind'] = CLIENT_KIND - - if (attributes.product) { - this.intrinsics.component = attributes.product - attributes.product = null - } - - if (attributes.collection) { - this.addAttribute('db.collection', attributes.collection) - attributes.collection = null - } - - if (attributes.sql || attributes.sql_obfuscated) { - let sql = null - if (attributes.sql_obfuscated) { - sql = _truncate(attributes.sql_obfuscated) - attributes.sql_obfuscated = null - } else if (attributes.sql) { - sql = _truncate(attributes.sql) - attributes.sql = null - } - - // Flag as exempt from normal attribute truncation - this.addAttribute('db.statement', sql, true) - } - - if (attributes.database_name) { - this.addAttribute('db.instance', attributes.database_name) - attributes.database_name = null - } - - if (attributes.host) { - this.addAttribute('peer.hostname', attributes.host) - - if (attributes.port_path_or_id) { - const address = `${attributes.host}:${attributes.port_path_or_id}` - this.addAttribute('peer.address', address) - attributes.port_path_or_id = null - } - attributes.host = null - } - } - - static testSegment(segment) { - return segment.name.startsWith(NAMES.DB.PREFIX) - } -} - -function _truncate(val) { - let truncated = truncate(val, 1997) - if (truncated !== val) { - truncated += '...' - } - return truncated -} - -function _filterNulls(obj) { - const out = Object.create(null) - for (let key in obj) { - if (obj[key] != null) { - out[key] = obj[key] - } - } - return out -} - -module.exports = SpanEvent diff --git a/node_modules/newrelic/lib/spans/span-streamer.js b/node_modules/newrelic/lib/spans/span-streamer.js deleted file mode 100644 index acc67234..00000000 --- a/node_modules/newrelic/lib/spans/span-streamer.js +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'span-streamer'}) -const NAMES = require('../metrics/names').INFINITE_TRACING - -const SPAN_DROP_MSG_INTERVAL_MS = 30000 -const SPAN_DROP_MSG = - 'Queue full, dropping spans. ' + - `Will not warn again for ${SPAN_DROP_MSG_INTERVAL_MS / 1000} seconds.` - -class SpanStreamer { - constructor(license_key, connection, metrics, queue_size) { - this.stream = null - this.license_key = license_key - this.connection = connection - this.queue_size = queue_size - this.spans = [] - this._metrics = metrics - this._writable = false - - // 'connected' indicates a safely writeable stream. - // May still be mid-connect to gRPC server. - this.connection.on('connected', (stream) =>{ - logger.info('Span streamer connected') - this.stream = stream - this._writable = true - this.sendQueue() - }) - - this.connection.on('disconnected', () =>{ - logger.info('Span streamer disconnected') - this.stream = null - this._writable = false - }) - } - - /* Accepts a span and either writes it to the stream, queues it to be sent, - * or drops it depending on stream/queue state - */ - write(span) { - this._metrics.getOrCreateMetric(NAMES.SEEN).incrementCallCount() - - // If not writeable (because of backpressure) queue the span - if (!this._writable) { - if (this.spans.length < this.queue_size) { - this.spans.push(span) - return - } - - // While this can be directionally calculated between seen/sent the - // queue makes that a bit more disconnected. This will be a bit more specific. - this._metrics.getOrCreateMetric(NAMES.DROPPED).incrementCallCount() - - // If the queue is full drop the span - logger.infoOncePer( - 'SPAN_DROP_MSG', // key for the OncePer - SPAN_DROP_MSG_INTERVAL_MS, - SPAN_DROP_MSG - ) - - return - } - - const formattedSpan = span.toStreamingFormat() - - try { - this.send(formattedSpan) - } catch (err) { - logger.error(err) - // TODO: something has gone horribly wrong. - // We may want to log and turn off this aggregator - // to prevent sending further spans. Maybe even "disable" their creation? - // or is there a situation where we can recover? - } - } - - /** - * Sends the span over the stream. Spans are only sent here if the stream is - * in a writable state. If the stream becomes unwritable after sending the - * span, a drain event handler is setup to continue writing when possible. - */ - send(span) { - // false indicates the stream has reached the highWaterMark - // and future writes should be avoided until drained. written items, - // including the one that returned false, will still be buffered. - this._writable = this.stream.write(span) - this._metrics.getOrCreateMetric(NAMES.SENT).incrementCallCount() - - if (!this._writable) { - const waitDrainStart = Date.now() - const onDrain = this.drain.bind(this, waitDrainStart) - this.stream.once('drain', onDrain) - } - } - - /** - * Drains the span queue that built up when the connection was - * back-pressured or disconnected. `waitDrainStart` is when the stream - * initially blocked, used to time how long the stream was blocked. If this - * is not defined, it is assumed this is being called after a reconnect, - * and the metric is not used. - */ - drain(waitDrainStart) { - // Metric can be used to see how frequently completing drains as well as - // average time to drain from when we first notice. - const drainCompleted = Date.now() - const drainDurationMs = drainCompleted - waitDrainStart - this._metrics.getOrCreateMetric(NAMES.DRAIN_DURATION) - .recordValue(drainDurationMs / 1000) - - // Once the 'drain' event fires we can begin writing to the stream again - this._writable = true - - this.sendQueue() - } - - sendQueue() { - logger.trace('Sending spans from queue.') - - // Continue sending the spans that were in the queue. _writable is checked - // so that if a send fails while clearing the queue, this drain handler can - // finish, and the drain handler setup on the failed send will then attempt - // to clear the queue - while (this.spans.length > 0 && this._writable) { - const nextObject = this.spans.shift() - this.send(nextObject.toStreamingFormat()) - } - - logger.trace( - 'Finished sending spans from queue. Items left in queue: %s', - this.spans.length - ) - } - - connect(agent_run_id, requestHeadersMap) { - this.connection.setConnectionDetails( - this.license_key, - agent_run_id, - requestHeadersMap - ) - - this.connection.connectSpans() - } - - disconnect() { - this.connection.disconnect() - } - - createMetrics() { - this._metrics.getOrCreateMetric(NAMES.QUEUE_CAPACITY).recordValue(this.queue_size) - this._metrics.getOrCreateMetric(NAMES.QUEUE_SIZE).recordValue(this.spans.length) - } -} - -module.exports = SpanStreamer diff --git a/node_modules/newrelic/lib/spans/streaming-span-attributes.js b/node_modules/newrelic/lib/spans/streaming-span-attributes.js deleted file mode 100644 index 77bf5af6..00000000 --- a/node_modules/newrelic/lib/spans/streaming-span-attributes.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const mapToStreamingType = require('./map-to-streaming-type') - -/** - * Specialized attribute collection class for use with infinite streaming. - * Currently designed to be sent over grpc via the v1.proto definition. - * - * @private - * @class - */ -class StreamingSpanAttributes { - constructor(attributes) { - if (attributes) { - this.addAttributes(attributes) - } - } - - /** - * Add a key/value pair to the attribute collection. - * null/undefined values will be dropped. - * - * Does not apply filtering/truncation. - * - * @param {string} key Name of the attribute to be stored. - * @param {string|boolean|number} value Value of the attribute to be stored. - */ - addAttribute(key, value) { - const streamingValue = mapToStreamingType(value) - if (streamingValue) { - this[key] = streamingValue - return true - } - - return false - } - - /** - * Adds all attributes in an object to the attribute collection. - * null/undefined values will be dropped. - * - * Does not apply filtering/truncation. - * - * @param {object} [attributes] - * @param {string} [attributes.key] Name of the attribute to be stored. - * @param {string|boolean|number} [attributes.value] Value of the attribute to be stored. - */ - addAttributes(attributes) { - if (!attributes) { - return - } - - for (let [key, value] of Object.entries(attributes)) { - this.addAttribute(key, value) - } - } -} - -module.exports = StreamingSpanAttributes diff --git a/node_modules/newrelic/lib/spans/streaming-span-event-aggregator.js b/node_modules/newrelic/lib/spans/streaming-span-event-aggregator.js deleted file mode 100644 index a062ea8a..00000000 --- a/node_modules/newrelic/lib/spans/streaming-span-event-aggregator.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const Aggregator = require('../aggregators/base-aggregator') -const StreamingSpanEvent = require('./streaming-span-event') -const logger = require('../logger').child({component: 'streaming-span-event-aggregator'}) - -const SEND_WARNING = - 'send() is not currently supported on streaming span event aggregator. ' + - 'This warning will not appear again this agent run.' - -// TODO: this doesn't "aggregate". Perhaps we need a different terminology -// for the base-class and then this implementation can avoid the misleading language. -class StreamingSpanEventAggregator extends Aggregator { - constructor(opts, collector, metrics) { - opts = opts || {} - opts.periodMs = opts.periodMs ? opts.periodMs : 1000 - opts.limit = opts.limit ? opts.limit : 10000 - opts.method = opts.method || 'span_event_data' - - super(opts, collector) - - this.stream = opts.span_streamer - this.metrics = metrics - this.started = false - this.isStream = true - } - - start() { - if (this.started) { - return - } - - logger.trace('StreamingSpanEventAggregator starting up') - this.stream.connect(this.runId, this.requestHeadersMap) - this.started = true - - this.emit('started') - } - - stop() { - if (!this.started) { - return - } - - logger.trace('StreamingSpanEventAggregator stopping') - this.stream.disconnect() - this.started = false - - this.emit('stopped') - } - - send() { - // Only log once started. This will get invoked on initial harvest - // prior to start which we'll just ignore. - if (this.started) { - logger.warnOnce(SEND_WARNING) - } - - this.emit(`finished ${this.method} data send.`) - - return - } - - /** - * Not a payload based aggregator - * - * This is here to implement the implicit interface - */ - _toPayloadSync() { - return - } - - /** - * Attempts to add the given segment to the collection. - * - * @param {TraceSegment} segment - The segment to add. - * @param {string} [parentId=null] - The GUID of the parent span. - * - * @return {bool} True if the segment was added, or false if it was discarded. - */ - addSegment(segment, parentId, isRoot) { - if (!this.started) { - logger.trace('Aggregator has not yet started, dropping span (%s).', segment.name) - return - } - - const span = StreamingSpanEvent.fromSegment(segment, parentId, isRoot) - this.stream.write(span) - } - - reconfigure(config) { - super.reconfigure(config) - - this.requestHeadersMap = config.request_headers_map - } - - createMetrics() { - this.stream.createMetrics() - } -} - -module.exports = StreamingSpanEventAggregator diff --git a/node_modules/newrelic/lib/spans/streaming-span-event.js b/node_modules/newrelic/lib/spans/streaming-span-event.js deleted file mode 100644 index f83f1744..00000000 --- a/node_modules/newrelic/lib/spans/streaming-span-event.js +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const StreamingSpanAttributes = require('./streaming-span-attributes') -const {truncate} = require('../util/byte-limit') -const Config = require('../config') - -const {DESTINATIONS} = require('../config/attribute-filter') -const NAMES = require('../metrics/names') -const HTTP_LIBRARY = 'http' -const CLIENT_KIND = 'client' -const CATEGORIES = { - HTTP: 'http', - DATASTORE: 'datastore', - GENERIC: 'generic' -} - -/** - * Specialized span event class for use with infinite streaming. - * Currently designed to be sent over grpc via the v1.proto definition. - * - * @private - * @class - */ -class StreamingSpanEvent { - /** - * @param {*} traceId TraceId for the Span. - * @param {object} agentAttributes Initial set of agent attributes. - * Must be pre-filtered and truncated. - * @param {object} customAttributes Initial set of custom attributes. - * Must be pre-filtered and truncated. - */ - constructor(traceId, agentAttributes, customAttributes) { - this._traceId = traceId - - this._intrinsicAttributes = new StreamingSpanAttributes() - this._intrinsicAttributes.addAttribute('traceId', traceId) - this._intrinsicAttributes.addAttribute('type', 'Span') - this._intrinsicAttributes.addAttribute('category', CATEGORIES.GENERIC) - - this._customAttributes = new StreamingSpanAttributes(customAttributes) - this._agentAttributes = new StreamingSpanAttributes(agentAttributes) - } - - /** - * Add a key/value pair to the Span's instrinisics collection. - * - * @param {string} key Name of the attribute to be stored. - * @param {string|boolean|number} value Value of the attribute to be stored. - */ - addIntrinsicAttribute(key, value) { - this._intrinsicAttributes.addAttribute(key, value) - } - - /** - * Add a key/value pair to the Span's custom/user attributes collection. - * @param {string} key Name of the attribute to be stored. - * @param {string|boolean|number} value Value of the attribute to be stored. - * @param {boolean} [truncateExempt=false] Set to true if attribute should not be truncated. - */ - addCustomAttribute(key, value, truncateExempt = false) { - const shouldKeep = this._checkFilter(key) - if (shouldKeep) { - const processedValue = truncateExempt ? value : _truncate(value) - this._customAttributes.addAttribute(key, processedValue) - } - } - - /** - * Add a key/value pair to the Span's agent attributes collection. - * @param {string} key Name of the attribute to be stored. - * @param {string|boolean|number} value Value of the attribute to be stored. - * @param {boolean} [truncateExempt=false] Set to true if attribute should not be truncated. - */ - addAgentAttribute(key, value, truncateExempt = false) { - const shouldKeep = this._checkFilter(key) - if (shouldKeep) { - const processedValue = truncateExempt ? value : _truncate(value) - this._agentAttributes.addAttribute(key, processedValue) - } - } - - _checkFilter(key) { - const {attributeFilter} = Config.getInstance() - const dest = attributeFilter.filterSegment(DESTINATIONS.SPAN_EVENT, key) - return dest & DESTINATIONS.SPAN_EVENT - } - - toStreamingFormat() { - // Attributes are pre-formatted. - const formatted = { - trace_id: this._traceId, - intrinsics: this._intrinsicAttributes, - user_attributes: this._customAttributes, - agent_attributes: this._agentAttributes - } - return formatted - } - - static fromSegment(segment, parentId = null, isRoot = false) { - const spanContext = segment.getSpanContext() - - // Since segments already hold span agent attributes and we want to leverage - // filtering, we add to the segment attributes prior to processing. - if (spanContext.hasError && !segment.transaction.hasIgnoredErrorStatusCode()) { - const details = spanContext.errorDetails - segment.addSpanAttribute('error.message', details.message) - segment.addSpanAttribute('error.class', details.type) - if (details.expected) { - segment.addSpanAttribute('error.expected', details.expected) - } - } - - const agentAttributes = segment.attributes.get(DESTINATIONS.SPAN_EVENT) - - const customAttributes = spanContext.customAttributes.get(DESTINATIONS.SPAN_EVENT) - - const transaction = segment.transaction - const traceId = transaction.traceId - - let span = null - if (StreamingHttpSpanEvent.isHttpSegment(segment)) { - span = new StreamingHttpSpanEvent(traceId, agentAttributes, customAttributes) - } else if (StreamingDatastoreSpanEvent.isDatastoreSegment(segment)) { - span = new StreamingDatastoreSpanEvent(traceId, agentAttributes, customAttributes) - } else { - span = new StreamingSpanEvent(traceId, agentAttributes, customAttributes) - } - - for (const [key, value] of Object.entries(spanContext.intrinsicAttributes)) { - span.addIntrinsicAttribute(key, value) - } - - span.addIntrinsicAttribute('guid', segment.id) - span.addIntrinsicAttribute('parentId', parentId) - span.addIntrinsicAttribute('transactionId', transaction.id) - span.addIntrinsicAttribute('sampled', transaction.sampled) - span.addIntrinsicAttribute('priority', transaction.priority) - span.addIntrinsicAttribute('name', segment.name) - - if (isRoot) { - span.addIntrinsicAttribute('trustedParentId', transaction.traceContext.trustedParentId) - if (transaction.traceContext.tracingVendors) { - span.addIntrinsicAttribute('tracingVendors', transaction.traceContext.tracingVendors) - } - } - - // Only set this if it will be `true`. Must be `null` otherwise. - if (transaction.baseSegment === segment) { - span.addIntrinsicAttribute('nr.entryPoint', true) - } - - // Timestamp in milliseconds, duration in seconds. Yay consistency! - span.addIntrinsicAttribute('timestamp', segment.timer.start) - span.addIntrinsicAttribute('duration', segment.timer.getDurationInMillis() / 1000) - - return span - } -} - -/** - * Specialized span event class for external requests for use with infinite streaming. - * Currently designed to be sent over grpc via the v1.proto definition. - * - * @private - * @class - */ -class StreamingHttpSpanEvent extends StreamingSpanEvent { - /** - * @param {*} traceId TraceId for the Span. - * @param {object} agentAttributes Initial set of agent attributes. - * Must be pre-filtered and truncated. - * @param {object} customAttributes Initial set of custom attributes. - * Must be pre-filtered and truncated. - */ - constructor(traceId, agentAttributes, customAttributes) { - super(traceId, agentAttributes, customAttributes) - - this.addIntrinsicAttribute('category', CATEGORIES.HTTP) - this.addIntrinsicAttribute('component', agentAttributes.library || HTTP_LIBRARY) - this.addIntrinsicAttribute('span.kind', CLIENT_KIND) - - if (agentAttributes.library) { - agentAttributes.library = null - } - - if (agentAttributes.url) { - this.addAgentAttribute('http.url', agentAttributes.url) - agentAttributes.url = null - } - - if (agentAttributes.procedure) { - this.addAgentAttribute('http.method', agentAttributes.procedure) - agentAttributes.procedure = null - } - } - - static isHttpSegment(segment) { - return segment.name.startsWith(NAMES.EXTERNAL.PREFIX) - } -} - -/** - * Specialized span event class for datastore operations and queries for use with - * infinite streaming. - * Currently designed to be sent over grpc via the v1.proto definition. - * - * @private - * @class. - */ -class StreamingDatastoreSpanEvent extends StreamingSpanEvent { - /** - * @param {*} traceId TraceId for the Span. - * @param {object} agentAttributes Initial set of agent attributes. - * Must be pre-filtered and truncated. - * @param {object} customAttributes Initial set of custom attributes. - * Must be pre-filtered and truncated. - */ - constructor(traceId, agentAttributes, customAttributes) { - super(traceId, agentAttributes, customAttributes) - - this.addIntrinsicAttribute('category', CATEGORIES.DATASTORE) - this.addIntrinsicAttribute('span.kind', CLIENT_KIND) - - if (agentAttributes.product) { - this.addIntrinsicAttribute('component', agentAttributes.product) - agentAttributes.product = null - } - - if (agentAttributes.collection) { - this.addAgentAttribute('db.collection', agentAttributes.collection) - agentAttributes.collection = null - } - - if (agentAttributes.sql || agentAttributes.sql_obfuscated) { - let sql = null - if (agentAttributes.sql_obfuscated) { - sql = _truncate(agentAttributes.sql_obfuscated) - agentAttributes.sql_obfuscated = null - } else if (agentAttributes.sql) { - sql = _truncate(agentAttributes.sql) - agentAttributes.sql = null - } - - // Flag as exempt from normal attribute truncation - this.addAgentAttribute('db.statement', sql, true) - } - - if (agentAttributes.database_name) { - this.addAgentAttribute('db.instance', agentAttributes.database_name) - agentAttributes.database_name = null - } - - if (agentAttributes.host) { - this.addAgentAttribute('peer.hostname', agentAttributes.host) - - if (agentAttributes.port_path_or_id) { - const address = `${agentAttributes.host}:${agentAttributes.port_path_or_id}` - this.addAgentAttribute('peer.address', address) - agentAttributes.port_path_or_id = null - } - - agentAttributes.host = null - } - } - - static isDatastoreSegment(segment) { - return segment.name.startsWith(NAMES.DB.PREFIX) - } -} - -function _truncate(val) { - let truncated = truncate(val, 1997) - if (truncated !== val) { - truncated += '...' - } - return truncated -} - -module.exports = StreamingSpanEvent diff --git a/node_modules/newrelic/lib/stats/apdex.js b/node_modules/newrelic/lib/stats/apdex.js deleted file mode 100644 index 7817e19f..00000000 --- a/node_modules/newrelic/lib/stats/apdex.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/* - * - * CONSTANTS - * - */ -var FROM_MILLIS = 1e-3 - - -function ApdexStats(apdexT) { - if (!apdexT && apdexT !== 0) { - throw new Error('Apdex summary must be created with apdexT.') - } - this.apdexT = apdexT - - this.satisfying = 0 - this.tolerating = 0 - this.frustrating = 0 -} - -ApdexStats.prototype.recordValue = function recordValue(time, overrideApdex) { - var apdexT = overrideApdex || this.apdexT - if (time <= apdexT) { - ++this.satisfying - } else if (time <= 4 * apdexT) { - ++this.tolerating - } else { - ++this.frustrating - } -} - -ApdexStats.prototype.recordValueInMillis = -function recordValueInMillis(timeInMillis, overrideApdex) { - this.recordValue(timeInMillis * FROM_MILLIS, overrideApdex * FROM_MILLIS) -} - -/** - * Used by the error handler to indicate that a user was frustrated by a page - * error. - */ -ApdexStats.prototype.incrementFrustrating = function incrementFrustrating() { - ++this.frustrating -} - -/** - * When merging apdex stastics, the apdex tolerating value isn't brought along - * for the ride. - * - * @param {ApdexStats} other The existing apdex stats being merged in. - */ -ApdexStats.prototype.merge = function merge(other) { - this.satisfying += other.satisfying - this.tolerating += other.tolerating - this.frustrating += other.frustrating -} - -/** - * This feels dirty: ApdexStats override the ordinary statistics serialization - * format by putting satisfying, tolerating and frustrating values in the - * first three fields in the array and setting the next two to the apdex (used - * by calculations inside RPM), followed by 0. - * - * @returns {Array} A six-value array where only the first three values are - * significant: satisfying, tolerating, and frustrating - * load times, respectively. - */ -ApdexStats.prototype.toJSON = function toJSON() { - return [ - this.satisfying, - this.tolerating, - this.frustrating, - this.apdexT, - this.apdexT, - 0 - ] -} - -module.exports = ApdexStats diff --git a/node_modules/newrelic/lib/stats/index.js b/node_modules/newrelic/lib/stats/index.js deleted file mode 100644 index 87be0b98..00000000 --- a/node_modules/newrelic/lib/stats/index.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/* - * - * CONSTANTS - * - */ -var BYTES_PER_MB = 1024 * 1024 -var FROM_MILLIS = 1e-3 - - -/** - * Simple container for tracking running statistics for a metric. - */ -function Stats() { - this.total = 0 - this.totalExclusive = 0 - this.min = 0 - this.max = 0 - this.sumOfSquares = 0 - this.callCount = 0 -} - -/** - * Update the summary statistics with a new value. - * - * @param {Number} totalTime Time, in seconds, of the measurement. - * @param {Number} exclusiveTime Time that was taken by only the - * current measurement (optional). - */ -Stats.prototype.recordValue = function recordValue(totalTime, exclusiveTime) { - // even if a caller messes up, don't break everything else - if (totalTime !== 0 && !totalTime) totalTime = 0 - if (exclusiveTime !== 0 && !exclusiveTime) exclusiveTime = totalTime - - if (this.callCount > 0) { - this.min = Math.min(totalTime, this.min) - } else { - this.min = totalTime - } - this.max = Math.max(totalTime, this.max) - - this.sumOfSquares += (totalTime * totalTime) - ++this.callCount - this.total += totalTime - this.totalExclusive += exclusiveTime -} - -/** - * Until the collector accepts statistics in milliseconds, this code is going - * to have some hinky floating-point values to deal with. - */ -Stats.prototype.recordValueInMillis = recordValueInMillis -function recordValueInMillis(totalTime, exclusiveTime) { - this.recordValue( - totalTime * FROM_MILLIS, - exclusiveTime >= 0 ? exclusiveTime * FROM_MILLIS : null - ) -} - -Stats.prototype.recordValueInBytes = function recordValueInBytes(bytes, exclusiveBytes) { - exclusiveBytes = exclusiveBytes || bytes - this.recordValue(bytes / BYTES_PER_MB, exclusiveBytes / BYTES_PER_MB) -} - -Stats.prototype.incrementCallCount = function incrementCallCount(count) { - if (typeof count === 'undefined') count = 1 - this.callCount += count -} - -/** - * Fold another summary's statistics into this one. - */ -Stats.prototype.merge = function merge(other) { - if (other.count && !other.callCount) { - other.callCount = other.count - } - - if (other.totalExclusive == null) { - other.totalExclusive = other.total - } - - if (other.callCount > 0) { - if (this.callCount > 0) { - this.min = Math.min(this.min, other.min) - } else { - this.min = other.min - } - } - this.max = Math.max(this.max, other.max) - - this.total += other.total - this.totalExclusive += other.totalExclusive - this.sumOfSquares += other.sumOfSquares - this.callCount += other.callCount -} - -/** - * The serializer relies upon this representation, so don't change the - * values, cardinality, or ordering of this array without ensuring that - * it matches the version of the "protocol" being sent to the collector. - * - * @returns {Array} Number of calls, - * total time in seconds, - * time for this metric alone in seconds, - * shortest individual time in seconds, - * longest individual time in seconds, - * running sum of squares. - */ -Stats.prototype.toJSON = function toJSON() { - return [ - this.callCount, - this.total, - this.totalExclusive, - this.min, - this.max, - this.sumOfSquares - ] -} - -module.exports = Stats diff --git a/node_modules/newrelic/lib/system-info.js b/node_modules/newrelic/lib/system-info.js deleted file mode 100644 index a73621ab..00000000 --- a/node_modules/newrelic/lib/system-info.js +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var exec = require('child_process').exec -var readProc = require('./utilization/common').readProc -var getBootId = require('./utilization/docker-info').getBootId -var utilization = require('./utilization') -var logger = require('./logger.js').child({component: 'system-info'}) -var os = require('os') -var parseCpuInfo = require('./parse-proc-cpuinfo') -var parseMemInfo = require('./parse-proc-meminfo') -var platform = os.platform() - -module.exports = fetchSystemInfo - -function isInteger(i) { - return i === parseInt(i, 10) -} - -function fetchSystemInfo(agent, callback) { - var config = agent.config - var systemInfo = { - processorArch: os.arch() - } - - var utilizationConfig = Object.create(null) - if (config.utilization) { - var configProcessors = config.utilization.logical_processors - var configRam = config.utilization.total_ram_mib - var configHostname = config.utilization.billing_hostname - - if (configProcessors) { - var parsedConfigProcessors = parseFloat(configProcessors, 10) - if (!isNaN(parsedConfigProcessors) && isInteger(parsedConfigProcessors)) { - utilizationConfig.logical_processors = parsedConfigProcessors - } else { - logger.info( - '%s supplied in config for utilization.logical_processors, expected a number', - configProcessors - ) - } - } - - if (configRam) { - var parsedConfigRam = parseFloat(configRam, 10) - if (!isNaN(parsedConfigRam) && isInteger(parsedConfigRam)) { - utilizationConfig.total_ram_mib = parsedConfigRam - } else { - logger.info( - '%s supplied in config for utilization.total_ram_mib, expected a number', - configRam - ) - } - } - - if (configHostname) { - if (typeof configHostname === 'string') { - utilizationConfig.hostname = configHostname - } else { - logger.info( - '%s supplied in config for utilization.Hostname, expected a string', - configHostname - ) - } - } - - if (Object.keys(utilizationConfig).length > 0) { - systemInfo.config = utilizationConfig - } - } - - var tasksDone = 0 - var numTasks = 5 - function finishedResponse() { - if (++tasksDone === numTasks) { - callback(null, systemInfo) - } - } - - module.exports._getProcessorStats(function getProcessCB(processorStats) { - systemInfo.packages = processorStats.packages - systemInfo.logicalProcessors = processorStats.logical - systemInfo.cores = processorStats.cores - finishedResponse() - }) - module.exports._getMemoryStats(function getMemCB(memory) { - systemInfo.memory = memory - finishedResponse() - }) - getKernelVersion(function getVersionCB(kernelVersion) { - systemInfo.kernelVersion = kernelVersion - finishedResponse() - }) - utilization.getVendors(agent, function getVendorInfo(err, vendors) { - if (vendors) { - systemInfo.vendors = vendors - } - finishedResponse() - }) - getBootId(agent, function reportBootId(err, bootId) { - if (bootId) { - systemInfo.bootId = bootId - } - finishedResponse() - }) -} - -// placed on module for mocking purposes in tests -module.exports._getProcessorStats = function getProcessorStats(callback) { - var processorStats = { - logical: null, - cores: null, - packages: null - } - - if (platform.match(/darwin/i)) { - getSysctlValue(['hw.packages'], function getPackages(packages) { - getSysctlValue(['hw.physicalcpu_max', 'hw.physicalcpu'], function getCores(cores) { - getSysctlValue( - ['hw.logicalcpu_max', 'hw.logicalcpu', 'hw.ncpu'], - function getLogicalCpu(logical) { - processorStats.logical = parseFloat(logical, 10) - processorStats.cores = parseFloat(cores, 10) - processorStats.packages = parseFloat(packages, 10) - - for (var key in processorStats) { - if (!processorStats[key] || !isInteger(processorStats[key])) { - processorStats[key] = null - } - } - - callback(processorStats) - } - ) - }) - }) - } else if (platform.match(/bsd/i)) { - getSysctlValue(['hw.ncpu'], function getLogicalCpu(logical) { - processorStats.logical = logical - callback(processorStats) - }) - } else if (platform.match(/linux/i)) { - readProc('/proc/cpuinfo', function parseProc(err, data) { - callback(parseCpuInfo(data)) - }) - } else { - logger.debug('Unknown platform: %s; could not retrieve processor info', platform) - callback(processorStats) - } -} - -// placed on module for mocking purposes in tests -module.exports._getMemoryStats = function getMemoryStats(callback) { - if (platform.match(/darwin/i)) { - getSysctlValue(['hw.memsize'], function getMem(memory) { - callback(parseInt(memory, 10) / (1024 * 1024)) - }) - } else if (platform.match(/bsd/i)) { - getSysctlValue(['hw.realmem'], function getMem(memory) { - callback(parseInt(memory, 10) / (1024 * 1024)) - }) - } else if (platform.match(/linux/i)) { - readProc('/proc/meminfo', function parseProc(err, data) { - callback(parseMemInfo(data)) - }) - } else { - logger.debug('Unknown platform: %s; could not retrieve memory info', platform) - callback(null) - } -} - -function getKernelVersion(callback) { - if (platform.match(/darwin/i)) { - getSysctlValue(['kern.version'], function getMem(version) { - callback(version) - }) - } else if (platform.match(/bsd/i)) { - getSysctlValue(['kern.version'], function getMem(version) { - callback(version) - }) - } else if (platform.match(/linux/i)) { - readProc('/proc/version', function parseProc(err, data) { - callback(data) - }) - } else { - logger.debug('Unknown platform: %s; could not read kernel version', platform) - callback(null) - } -} - -function getSysctlValue(names, callback) { - if (!names) return callback(null) - var returned = false - var ran = 0 - names.forEach(function sysctlName(name) { - exec('sysctl -n ' + name, respond) - - function respond(err, stdout, stderr) { - if (returned) return - if (err) { - logger.debug('Error when trying to run: sysctl -n %s: %s', name, err.message) - callback(null) - returned = true - } else if (!stderr) { - callback(stdout) - returned = true - } - if (++ran === names.length && !returned) { - logger.debug('No sysctl info found for names: %j', names) - callback(null) - } - } - }) -} diff --git a/node_modules/newrelic/lib/timer.js b/node_modules/newrelic/lib/timer.js deleted file mode 100644 index 86e887e3..00000000 --- a/node_modules/newrelic/lib/timer.js +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/** - - * Explicit enumeration of the states a transaction can be in: - * - * PENDING upon instantiation (implicitly, no start time set) - * RUNNING while timer is running (implicitly, start time is set but no stop - * time is set). - * STOPPED timer has been completed (implicitly, start time and stop time - * are set, but the timer has not yet been harvested). - * DEAD timer has been harvested and can only have its duration read. - */ -var PENDING = 1 -var RUNNING = 2 -var STOPPED = 3 - - -function hrToMillis(hr) { - // process.hrTime gives you [second, nanosecond] duration pairs - return (hr[0] * 1e3) + (hr[1] / 1e6) -} - -/** - * A mildly tricky timer that tracks its own state and allows its duration - * to be set manually. - */ -function Timer() { - this.state = PENDING - this.touched = false - this.hrDuration = null - this.hrstart = null - this.start = null - this.durationInMillis = null -} - -/** - * Start measuring time elapsed. - * - * Uses process.hrtime if available, Date.now() otherwise. - */ -Timer.prototype.begin = function begin() { - if (this.state > PENDING) return - - this.start = Date.now() - this.hrstart = process.hrtime() - this.state = RUNNING -} - -/** - * End measurement. - */ -Timer.prototype.end = function end() { - if (this.state > RUNNING) return - if (this.state === PENDING) this.begin() - this.hrDuration = process.hrtime(this.hrstart) - this.touched = true - this.state = STOPPED -} - -/** - * Update the duration of the timer without ending it.. - */ -Timer.prototype.touch = function touch() { - this.touched = true - if (this.state > RUNNING) return - if (this.state === PENDING) this.begin() - - this.hrDuration = process.hrtime(this.hrstart) -} - -/** - * End the segment if it is still running, if touched use that time instead of - * "now". Returns a boolean indicating whether the end time changed. - */ -Timer.prototype.softEnd = function softEnd() { - if (this.state > RUNNING) return false - if (this.state === PENDING) this.begin() - - this.state = STOPPED - - if (this.touched) return false - this.hrDuration = process.hrtime(this.hrstart) - this.touched = true - return true -} - -/** - * @return {bool} Is this timer currently running? - */ -Timer.prototype.isRunning = function isRunning() { - return this.state === RUNNING -} - -/** - * @return {bool} Is this timer still alive? - */ -Timer.prototype.isActive = function isActive() { - return this.state < STOPPED -} - -/** - * @return {bool} Has the timer been touched or ended? - */ -Timer.prototype.hasEnd = function hasEnd() { - return !!this.hrDuration -} - -/* - * Sets duration and stops the timer, since the passed-in duration will take precendence - * over the measured duration. - * @param {number} duration The duration the timer should report. - */ -Timer.prototype.overwriteDurationInMillis = overwriteDurationInMillis -function overwriteDurationInMillis(duration) { - this.touched = true - this.durationInMillis = duration - this.state = STOPPED -} - -/** - * When testing, it's convenient to be able to control time. Stops the timer - * as a byproduct. - * - * @param {number} duration How long the timer ran. - * @param {number} start When the timer started running (optional). - */ -Timer.prototype.setDurationInMillis = function setDurationInMillis(duration, start) { - if (this.state > RUNNING) { - return - } - - if (this.state === PENDING && !start && start !== 0) { - this.begin() - } - - this.state = STOPPED - this.durationInMillis = duration - - // this assignment is incorrect, process.hrtime doesn't time from epoch, which - // is the assumption being made here. since hrstart isn't used - // anywhere except to calculate duration, and we are setting duration - // this is fine. - this.hrstart = [Math.floor(start / 1e3), start % 1e3 * 1e6] - if (start != null) { - this.start = start - } -} - -/** - * Returns how long the timer has been running (if it's still running) or - * how long it ran (if it's been ended or touched). - */ -Timer.prototype.getDurationInMillis = function getDurationInMillis() { - if (this.state === PENDING) return 0 - - // only set by setDurationInMillis - if (this.durationInMillis !== null && this.durationInMillis >= 0) { - return this.durationInMillis - } - - // prioritize .end() and .touch() - if (this.hrDuration) { - return hrToMillis(this.hrDuration) - } - - return hrToMillis(process.hrtime(this.hrstart)) -} - -/** - * Get a single object containing the interval this timer was active. - * - * @return {Array} 2-tuple of start time in milliseconds, end time in - * milliseconds. - */ -Timer.prototype.toRange = function toRange() { - return [this.start, this.start + this.getDurationInMillis()] -} - -/** - * Abstract away the nonsense related to having both an - * hrtime start time and a regular one, and always return - * milliseconds since start. - * - * @param {Timer} other The point relative to which this timer started. - * @return {number} The offset in (floating-point) milliseconds. - */ -Timer.prototype.startedRelativeTo = function startedRelativeTo(other) { - if (this.hrstart && other.hrstart) { - var s = this.hrstart[0] - other.hrstart[0] - var ns = this.hrstart[1] - other.hrstart[1] - - - return hrToMillis([s, ns]) - } - - return this.start - other.start -} - -/** - * Returns true if this timer ends after the other. - */ -Timer.prototype.endsAfter = function compare(other) { - return (this.getDurationInMillis() + this.start) > - (other.getDurationInMillis() + other.start) -} - - -module.exports = Timer diff --git a/node_modules/newrelic/lib/transaction/dt-payload.js b/node_modules/newrelic/lib/transaction/dt-payload.js deleted file mode 100644 index 7cb50af5..00000000 --- a/node_modules/newrelic/lib/transaction/dt-payload.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger').child({component: 'distributedTracePayload'}) - -const DT_VERSION_MAJOR = 0 -const DT_VERSION_MINOR = 1 - -module.exports = class DistributedTracePayload { - /** - * The class reponsible for producing distributed trace payloads. - * Created by calling {@link TransactionHandle#_createDistributedTracePayload}. - * - * @constructor - */ - constructor(payload) { - logger.trace('DistributedTracePayload created with %s', payload) - this.plainTextPayload = JSON.stringify({ - v: [DT_VERSION_MAJOR, DT_VERSION_MINOR], - d: payload - }) - this.base64Payload = null - } - - /** - * @returns {String} The base64 encoded JSON representation of the - * distributed trace payload. - */ - text() { - logger.trace('DistributedTracePayload text: %s', this.plainTextPayload) - return this.plainTextPayload - } - - /** - * Construct a payload suitable for HTTP transport. - * - * @returns {String} The base64 encoded JSON representation of the - * distributed trace payload. - */ - httpSafe() { - if (!this.base64Payload) { - this.base64Payload = Buffer.from(this.plainTextPayload, 'utf-8').toString('base64') - } - logger.trace('DistributedTracePayload httpSafe: %s', this.base64Payload) - return this.base64Payload - } -} - -module.exports.Stub = class DistributedTracePayloadStub { - text() { - logger.debug('DistributedTracePayloadStub text') - return '' - } - - httpSafe() { - logger.debug('DistributedTracePayloadStub httpSafe') - return '' - } -} diff --git a/node_modules/newrelic/lib/transaction/handle.js b/node_modules/newrelic/lib/transaction/handle.js deleted file mode 100644 index c44c5e37..00000000 --- a/node_modules/newrelic/lib/transaction/handle.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'transactionHandle'}) - -const NAMES = require('../../lib/metrics/names') - -class TransactionHandle { - /** - * A light representation of a transaction instance, returned by calling - * {@link API#getTransaction}. - * - * @constructor - */ - constructor(transaction, metrics) { - this._transaction = transaction - this._metrics = metrics - } - - /** - * End the transaction. - * - * @param {Function} callback - */ - end(callback) { - const tx = this._transaction.end() - if (typeof callback === 'function') { - // XXX: Since Transaction#end is now synchronous, this needs to - // asynchronously call the callback like Transaction#end used to. - // Change this to be synchronous in the next major version. - setImmediate(callback, tx) - } - } - - /** - * Mark the transaction to be ignored. - */ - ignore() { - this._transaction.setForceIgnore(true) - } - - /** - * Return whether this Transaction is being sampled - */ - isSampled() { - return this._transaction.isSampled() - } - - /** - * Parsing incoming headers for use in a distributed trace. - * W3C TraceContext format is preferred over the NewRelic DT format. - * NewRelic DT format will be used if no `traceparent` header is found. - * @param @param {string} [transportType='Unknown'] - The transport type that delivered the trace. - * @param {object} headers - Headers to search for supported formats. Keys must be lowercase. - */ - acceptDistributedTraceHeaders(transportType, headers) { - incrementApiSupportMetric(this._metrics, 'acceptDistributedTraceHeaders') - return this._transaction.acceptDistributedTraceHeaders(transportType, headers) - } - - /** - * Inserts distributed trace headers into the provided headers map. - * @param {Object} headers - */ - insertDistributedTraceHeaders(headers) { - incrementApiSupportMetric(this._metrics, 'insertDistributedTraceHeaders') - return this._transaction.insertDistributedTraceHeaders(headers) - } -} - -module.exports = TransactionHandle - -function incrementApiSupportMetric(metrics, functionName) { - if (!metrics) { - logger.warnOnce( - 'Cannot add TransactionHandle API support metric. The metrics collection is missing.' - ) - return - } - - const metric = metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.TRANSACTION_API + '/' + functionName - ) - - metric.incrementCallCount() - return metric -} - -module.exports.Stub = class TransactionHandleStub { - end(callback) { - if (callback instanceof Function) { - setImmediate(callback) - } - logger.debug("No transaction found when calling Transaction.end") - } - - ignore() { - logger.debug("No transaction found when calling Transaction.ignore") - } - - isSampled() { - logger.debug("No transaction found when calling Transaction.isSampled") - } - - acceptDistributedTraceHeaders() { - logger.debug("No transaction found when calling Transaction.acceptDistributedTraceHeaders") - } - - insertDistributedTraceHeaders() { - logger.debug("No transaction found when calling Transaction.insertDistributedTraceHeaders") - } -} diff --git a/node_modules/newrelic/lib/transaction/index.js b/node_modules/newrelic/lib/transaction/index.js deleted file mode 100644 index fa4778e9..00000000 --- a/node_modules/newrelic/lib/transaction/index.js +++ /dev/null @@ -1,1299 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const errorHelper = require('../errors/helper') -var hashes = require('../util/hashes') -var logger = require('../logger').child({component: 'transaction'}) -var Metrics = require('../metrics') -var NAMES = require('../metrics/names') -var NameState = require('./name-state') -var props = require('../util/properties') -var Timer = require('../timer') -var Trace = require('./trace') -var url = require('url') -var urltils = require('../util/urltils') -const TraceContext = require('./tracecontext').TraceContext - -/* - * - * CONSTANTS - * - */ -const DESTS = require('../config/attribute-filter').DESTINATIONS -const FROM_MILLIS = 1e-3 -const TYPES = { - WEB: 'web', - BG: 'bg', - MESSAGE: 'message' -} -const TYPES_SET = _makeValueSet(TYPES) -const TYPE_METRICS = { - web: NAMES.WEB.RESPONSE_TIME, - bg: NAMES.OTHER_TRANSACTION.RESPONSE_TIME, - message: NAMES.OTHER_TRANSACTION.MESSAGE -} -const TRANSPORT_TYPES = { - AMQP: 'AMQP', - HTTP: 'HTTP', - HTTPS: 'HTTPS', - IRONMQ: 'IronMQ', - JMS: 'JMS', - KAFKA: 'Kafka', - OTHER: 'Other', - QUEUE: 'Queue', - UNKNOWN: 'Unknown' -} -const TRANSPORT_TYPES_SET = _makeValueSet(TRANSPORT_TYPES) -const REQUIRED_DT_KEYS = ['ty', 'ac', 'ap', 'tr', 'ti'] -const DTPayload = require('./dt-payload') -const DTPayloadStub = DTPayload.Stub - -const TRACE_CONTEXT_PARENT_HEADER = 'traceparent' -const TRACE_CONTEXT_STATE_HEADER = 'tracestate' -const NEWRELIC_TRACE_HEADER = 'newrelic' - -const MULTIPLE_INSERT_MESSAGE = - 'insertDistributedTraceHeaders called on headers object that already contains ' + - 'distributed trace data. These may be overwritten. traceparent? \'%s\', newrelic? \'%s\'.' - -/** - * Bundle together the metrics and the trace segment for a single agent - * transaction. - * - * @param {Object} agent The agent. - */ -function Transaction(agent) { - if (!agent) throw new Error('every transaction must be bound to the agent') - - this.traceFlag = false - if (agent.config.logging.diagnostics) { - this.traceStacks = [] - } else { - this.traceStacks = null - } - - this.agent = agent - this.metrics = new Metrics( - agent.config.apdex_t, - agent.mapper, - agent.metricNameNormalizer - ) - - ++agent.activeTransactions - - this.numSegments = 0 - this.id = hashes.makeId(16) - - this.trace = new Trace(this) - this.exceptions = [] - this.userErrors = [] - this.timer = new Timer() - this.timer.begin() - - this._recorders = [] - this._intrinsicAttributes = Object.create(null) - this._partialName = null - - // If handledExternally is set to true the transaction will not ended - // automatically, instead it should be ended by user code. - this.handledExternally = false - - // hidden class optimization - this.catResponseTime = 0 - this.error = null - this.forceIgnore = null - this.forceName = null - this.ignore = false - this.incomingCatId = null - this.name = null - this.nameState = new NameState(null, null, null, null) - this.pathHashes = [] - this.queueTime = 0 - this.referringPathHash = null - this.referringTransactionGuid = null - this.invalidIncomingExternalTransaction = false - this.statusCode = null - this.syntheticsHeader = null - this.syntheticsData = null - this.url = null - this.parsedUrl = null - this.verb = null - this.baseSegment = null - this.type = TYPES.WEB - // DT fields - this.parentId = null - this.parentType = null - this.parentApp = null - this.parentAcct = null - this.parentTransportType = null - this.parentTransportDuration = null - this._traceId = null - Object.defineProperty(this, "traceId", { - get() { - if (this._traceId === null) { - this._traceId = hashes.makeId(32) - } - return this._traceId - }, - set(traceId) { - this._traceId = traceId - } - }) - this.parentSpanId = null - this.isDistributedTrace = null - this.acceptedDistributedTrace = null - - // Lazy evaluate the priority and sampling in case we end up accepting a payload. - this.priority = null - this.sampled = null - this.traceContext = new TraceContext(this) - - agent.emit('transactionStarted', this) - this.probe('Transaction created', {id: this.id}) -} - -Transaction.TYPES = TYPES -Transaction.TYPES_SET = TYPES_SET -Transaction.TRANSPORT_TYPES = TRANSPORT_TYPES -Transaction.TRANSPORT_TYPES_SET = TRANSPORT_TYPES_SET -Transaction.TRACE_CONTEXT_PARENT_HEADER = TRACE_CONTEXT_PARENT_HEADER - -Transaction.prototype.probe = function probe(action, extra) { - if (this.traceStacks) { - this.traceStacks.push({ - stack: (new Error(action)).stack.split('\n'), - extra: extra - }) - } -} - -/** - * Add a clear API method for determining whether a transaction is web or - * background. - * - * @returns {boolean} Whether this transaction has a URL. - */ -Transaction.prototype.isWeb = function isWeb() { - return this.type === TYPES.WEB -} - -/** - * @return {bool} Is this transaction still alive? - */ -Transaction.prototype.isActive = function isActive() { - return this.timer.isActive() -} - -/** - * Close out the current transaction and its associated trace. Remove any - * instances of this transaction annotated onto the call stack. - */ -Transaction.prototype.end = function end() { - if (!this.timer.isActive()) return - if (this.traceFlag) { - logger.warn( - {segment: {name: this.name, stacks: this.traceStacks}}, - 'Flagged transaction ended.' - ) - } - - if (!this.name) { - this.finalizeName(null) // Use existing partial name. - } - if (this.baseSegment) { - this.baseSegment.touch() - } - - this.agent.recordSupportability('Nodejs/Transactions/Segments', this.numSegments) - this._calculatePriority() - - this.trace.end() - - this.timer.end() - // recorders must be run before the trace is collected - if (!this.ignore) { - this.record() - - // This method currently must be called after all recorders have been fired due - // to some of the recorders (namely the db recorders) adding parameters to the - // segments. - this.trace.generateSpanEvents() - } - - this.agent.emit('transactionFinished', this) - return this -} - -/** - * For web transactions, this represents the time from when the request was received - * to when response was sent. For background transactions, it is equal to duration - * of the transaction trace (until last segment ended). - */ -Transaction.prototype.getResponseTimeInMillis = function getResponseTimeInMillis() { - if (this.isWeb()) { - return this.timer.getDurationInMillis() - } - return this.trace.getDurationInMillis() -} - -/** - * Executes the user and server provided naming rules to clean up the given url. - * - * @private - * - * @param {string} requestUrl - The URL to normalize. - * - * @return {object} The normalization results after running user and server rules. - */ -Transaction.prototype._runUserNamingRules = function _runUserNamingRules(requestUrl) { - // 1. user normalization rules (set in configuration) - var normalized = this.agent.userNormalizer.normalize(requestUrl) - if (normalized.matched) { - // After applying user naming rule, apply server-side sent rules to - // further squash possible MGIs - var serverNormalized = this.agent.urlNormalizer.normalize(normalized.value) - if (serverNormalized.ignore) { - normalized.ignore = true - } - if (serverNormalized.matched) { - // NAMES.NORMALIZED is prepended by the sever rule normalizer - normalized.value = serverNormalized.value - } else { - normalized.value = NAMES.NORMALIZED + normalized.value - } - } - return normalized -} - -/** - * Executes the user naming rules and applies the results to the transaction. - * - * @param {string} requestUrl - The URL to normalize and apply to this transaction. - */ -Transaction.prototype.applyUserNamingRules = function applyUserNamingRules(requestUrl) { - var normalized = this._runUserNamingRules(requestUrl) - if (normalized.ignore) { - this.ignore = normalized.ignore - } - if (normalized.matched) { - this._partialName = normalized.value - } -} - -/** - * Set's the transaction partial name. - * - * The partial name is everything after the `WebTransaction/` part. - * - * @param {string} name - The new transaction partial name to use. - */ -Transaction.prototype.setPartialName = function setPartialName(name) { - this._partialName = name -} - -/** - * Derive the transaction partial name from the given url and status code. - * - * @private - * - * @param {string} requestUrl - The URL to derive the name from. - * @param {number} status - The status code of the response. - * - * @return {object} An object with the derived partial name in `value` and a - * boolean flag in `ignore`. - */ -Transaction.prototype._partialNameFromUri = _partialNameFromUri -function _partialNameFromUri(requestUrl, status) { - var scrubbedUrl = urltils.scrub(requestUrl) - - // 0. If there is a name in the name-state stack, use it. - var partialName = this._partialName - var ignore = false - if (!this.nameState.isEmpty()) { - partialName = this.nameState.getFullName() - } - - // 1. name set by the api - if (this.forceName !== null) { - partialName = this.forceName - } - - // 2. user normalization rules (set in configuration) can override transaction - // naming from API - var userNormalized = this._runUserNamingRules(scrubbedUrl) - ignore = ignore || userNormalized.ignore - if (userNormalized.matched) { - partialName = userNormalized.value - } - - // 3. URL normalization rules (sent by server). - // Nothing has already set a name for this transaction, so normalize and - // potentially apply the URL backstop now. Only do so if no user rules matched. - if (!partialName) { - // avoid polluting root path when 404 - const statusName = this.nameState.getStatusName(status) - if (statusName) { - partialName = statusName - } else { - var normalized = this.agent.urlNormalizer.normalize(scrubbedUrl) - ignore = ignore || normalized.ignore - partialName = normalized.value - } - } - - return { - ignore: ignore, - value: partialName - } -} - -/** - * Set the forceIgnore value on the transaction. This will cause the - * transaction to clean up after itself without collecting any data. - * - * @param {Boolean} ignore The value to assign to transaction.ignore - */ -Transaction.prototype.setForceIgnore = function setForceIgnore(ignore) { - if (ignore != null) { - this.forceIgnore = ignore - } else { - logger.debug("Transaction#setForceIgnore called with null value") - } -} - -/** - * - * Gets the current ignore state for the transaction. - * - */ - -Transaction.prototype.isIgnored = function getIgnore() { - return this.ignore || this.forceIgnore -} - -/** - * Derives the transaction's name from the given URL and status code. - * - * The transaction's name will be set after this as well as its ignored status - * based on the derived name. - * - * @param {string} requestURL - The URL to derive the request's name and status from. - * @param {number} statusCode - The response status code. - */ -Transaction.prototype.finalizeNameFromUri = finalizeNameFromUri -function finalizeNameFromUri(requestURL, statusCode) { - if (logger.traceEnabled()) { - logger.trace({requestURL: requestURL, statusCode: statusCode, transactionId: this.id, - transactionName: this.name}, 'Setting transaction name') - } - - this.url = urltils.scrub(requestURL) - this.statusCode = statusCode - - // Derive the name from the request URL. - var partialName = this._partialNameFromUri(requestURL, statusCode) - this._partialName = partialName.value - if (partialName.ignore) { - this.ignore = true - } - - // If a namestate stack exists, copy route parameters over to the trace. - if (!this.nameState.isEmpty() && this.baseSegment) { - this.nameState.forEachParams(function forEachRouteParams(params) { - for (var key in params) { - if (props.hasOwn(params, key)) { - this.trace.attributes.addAttribute( - DESTS.NONE, - 'request.parameters.' + key, - params[key] - ) - - const segment = this.agent.tracer.getSegment() - - if (!segment) { - logger - .trace('Active segment not available, not adding request.parameters attribute for %s', - key) - } else { - segment.attributes.addAttribute( - DESTS.NONE, - 'request.parameters.' + key, - params[key] - ) - } - } - } - }, this) - } - - // Apply transaction name normalization rules (sent by server) to full name. - var fullName = TYPE_METRICS[this.type] + '/' + this._partialName - var normalized = this.agent.transactionNameNormalizer.normalize(fullName) - if (normalized.ignore) { - this.ignore = true - } - this.name = normalized.value - - // 5. transaction segment term normalizer - this.name = this.agent.txSegmentNormalizer.normalize(this.name).value - - // Allow the API to explicitly set the ignored status. - if (this.forceIgnore !== null) { - this.ignore = this.forceIgnore - } - - this.baseSegment && this._markAsWeb(requestURL) - - this._copyNameToActiveSpan(this.name) - - if (logger.traceEnabled()) { - logger.trace({ - transactionId: this.id, - transactionName: this.name, - ignore: this.ignore - }, 'Finished setting transaction name from Uri') - } -} - -Transaction.prototype._copyNameToActiveSpan = function _copyNameToActiveSpan(name) { - const spanContext = this.agent.tracer.getSpanContext() - if (!spanContext) { - logger.trace('Span context not available, not adding transaction.name attribute for %s', name) - return - } - - spanContext.addIntrinsicAttribute('transaction.name', name) -} - -/** - * Copies final base segment parameters to trace attributes before reapplying - * them to the segment. - * - * @param {string} rawURL The URL, as it came in, for parameter extraction. - */ -Transaction.prototype._markAsWeb = function _markAsWeb(rawURL) { - // Because we are assured we have the URL here, lets grab query params. - var params = urltils.parseParameters(rawURL) - for (var key in params) { - if (props.hasOwn(params, key)) { - this.trace.attributes.addAttribute( - DESTS.NONE, - 'request.parameters.' + key, - params[key] - ) - - const segment = this.agent.tracer.getSegment() - - if (!segment) { - logger - .trace( - 'Active segment not available, not adding request.parameters span attribute for %s', - key) - } else { - segment.attributes.addAttribute( - DESTS.NONE, - 'request.parameters.' + key, - params[key] - ) - } - } - } - this.baseSegment.markAsWeb() -} - -/** - * Sets the transaction's name and determines if it will be ignored. - * - * @param {string} [name] - * Optional. The partial name to use for the finalized transaction. If ommitted - * the current partial name is used. - */ -Transaction.prototype.finalizeName = function finalizeName(name) { - // If no name is given, and this is a web transaction with a url, then - // finalize the name using the stored url. - if (name == null && this.type === 'web' && this.url) { - return this.finalizeNameFromUri(this.url, this.statusCode) - } - - this._partialName = this.forceName || name || this._partialName - if (!this._partialName) { - logger.debug('No name for transaction %s, not finalizing.', this.id) - return - } - - var fullName = TYPE_METRICS[this.type] + '/' + this._partialName - - // Transaction normalizers run on the full metric name, not the user facing - // transaction name. - var normalized = this.agent.transactionNameNormalizer.normalize(fullName) - if (normalized.ignore) { - this.ignore = true - } - this.name = normalized.value - - if (this.forceIgnore !== null) { - this.ignore = this.forceIgnore - } - - this.baseSegment && this.baseSegment.setNameFromTransaction() - - this._copyNameToActiveSpan(this.name) - - if (logger.traceEnabled()) { - logger.trace({ - transactionId: this.id, - transactionName: this.name, - ignore: this.ignore - }, 'Finished setting transaction name from string') - } -} - -/** - * Gets the transaction name safely. - * - * Gathering the transaction name for WebTransactions is risky complicated - * business. OtherTransactions (aka background) are much simpler as they are - * always fully specified by the user at creation time. - * - * This has the potential of causing the normalizers run extra times, which can - * cause extra performance overhead. Once this is refactored we can make the - * caching better and eliminate this extra overhead. Be mindful of if/when this - * is called. - */ -Transaction.prototype.getName = function getName() { - if (this.isWeb() && this.url) { - return this._partialNameFromUri(this.url, this.statusCode).value - } - return this._partialName -} - -Transaction.prototype.getFullName = function getFullName() { - var name = null - if (this.forceName) { - name = this.forceName - } else if (this.name) { - return this.name - } else { - name = this.getName() - } - - if (!name) { - return null - } - var fullName = TYPE_METRICS[this.type] + '/' + name - return this.agent.transactionNameNormalizer.normalize(fullName).value -} - -/** - * Returns the full URL of the transaction with query, search, or hash portions - * removed. This is only applicable for web transactions. - * - * Caches to ._scrubbedUrl, pulls in from .parsedUrl if it is available, - * otherwise it will parse .url, store it on .parsedUrl, then scrub the URL and - * store it in the cache. - * - * Returns a string or undefined. - */ -Transaction.prototype.getScrubbedUrl = function getScrubbedUrl() { - if (!this.isWeb()) return - if (this._scrubbedUrl) return this._scrubbedUrl - - // If we don't have a parsedUrl, lets populate it from .url - if (!this.parsedUrl) { - // At time of writing .url should always be set by the time we get here - // because that is what .isWeb() checks against. In the future it may be - // instead checking a enum or other property so guard ourselves just in - // case. - if (!this.url) return - this.parsedUrl = url.parse(this.url) - } - - var scrubbedParsedUrl = Object.assign(Object.create(null), this.parsedUrl) - scrubbedParsedUrl.search = null - scrubbedParsedUrl.query = null - scrubbedParsedUrl.href = null - scrubbedParsedUrl.path = null - scrubbedParsedUrl.hash = null - - this._scrubbedUrl = url.format(scrubbedParsedUrl) - - return this._scrubbedUrl -} - -/** - * The instrumentation associates metrics with the different kinds of trace - * segments. The metrics recorders are dependent on the transaction name to - * collect their scoped metrics, and so must wait for the transaction's - * name to be finalized before the recording process. Segments are only - * responsible for their own life cycle, so responsibility for understanding - * when the transaction name has been finalized is handed off to the trace, - * which for now defers running these recorders until the trace is ended. - * - * @param {Function} recorder The callback which records metrics. Takes a - * single parameter, which is the transaction's - * name. - */ -Transaction.prototype.addRecorder = function addRecorder(recorder) { - this._recorders.push(recorder) -} - -/** - * Run the metrics recorders for this trace. If the transaction's name / - * scope hasn't been set yet, the recorder will be passed an undefined name, - * and should be written to handle this. - */ -Transaction.prototype.record = function record() { - var name = this.name - for (var i = 0, l = this._recorders.length; i < l; ++i) { - this._recorders[i](name) - } -} - -/** - * Measure the duration of an operation named by a metric, optionally - * belonging to a scope. - * - * @param {string} name The name of the metric to gather. - * @param {string} scope (optional) Scope to which the metric is bound. - * @param {number} duration The time taken by the operation, in milliseconds. - * @param {number} exclusive The time exclusively taken by an operation, and - * not its children. - */ -Transaction.prototype.measure = function measure(name, scope, duration, exclusive) { - this.metrics.measureMilliseconds(name, scope, duration, exclusive) -} - -/** - * Based on the status code and the duration of a web transaction, either - * mark the transaction as frustrating, or record its time for apdex purposes. - * - * @param {string} name Metric name. - * @param {number} duration Duration of the transaction, in milliseconds. - * @param {number} keyApdex A key transaction apdexT, in milliseconds - * (optional). - */ -Transaction.prototype._setApdex = function _setApdex(name, duration, keyApdexInMillis) { - var apdexStats = this.metrics.getOrCreateApdexMetric(name, null, keyApdexInMillis) - - // if we have an error-like status code, and all the errors are - // expected, we know the status code was caused by an expected - // error, so we will not report "frustrating". Otherwise, we - // don't know which error triggered the error-like status code, - // and will still incrementing frustrating. If this is an issue, - // users can either set a status code as expected, or ignore the - // specific error to avoid incrementing to frustrating - if ( - urltils.isError(this.agent.config, this.statusCode) && - !urltils.isExpectedError(this.agent.config, this.statusCode) && - !this.hasOnlyExpectedErrors() - ) { - apdexStats.incrementFrustrating() - } else { - apdexStats.recordValueInMillis(duration, keyApdexInMillis) - } -} - -/** - * Store first 10 unique path hashes calculated for a transaction. - * - * @param {string} pathHash Path hash - */ -Transaction.prototype.pushPathHash = function pushPathHash(pathHash) { - if (this.pathHashes.length >= 10 || this.pathHashes.indexOf(pathHash) !== -1) return - this.pathHashes.unshift(pathHash) -} - -/** - * Return whether transaction spawned any outbound requests. - */ -Transaction.prototype.includesOutboundRequests = function includesOutboundRequests() { - return this.pathHashes.length > 0 -} - -/** - * Get unique previous path hashes for a transaction. Does not include - * current path hash. - */ -Transaction.prototype.alternatePathHashes = function alternatePathHashes() { - var curHash = hashes.calculatePathHash( - this.agent.config.applications()[0], - this.getFullName(), - this.referringPathHash - ) - var altHashes = this.pathHashes.slice() - var curIndex = altHashes.indexOf(curHash) - - if (curIndex !== -1) altHashes.splice(curIndex, 1) - - return altHashes.length === 0 ? null : altHashes.sort().join(',') -} - -/** - * Add the error information to the current segment and add the segment ID as - * an attribute onto the exception. - * - * @param {Exception} exception The exception object to be collected. - */ -Transaction.prototype._linkExceptionToSegment = _linkExceptionToSegment - -function _linkExceptionToSegment(exception) { - const segment = this.agent.tracer.getSegment() - if (!segment) { - return - } - - const spanContext = segment.getSpanContext() - if (spanContext) { - // Exception attributes will be added to span unless transaction - // status code has been ignored. Last error wins. - const config = this.agent.config - const details = exception.getErrorDetails(config) - spanContext.setError(details) - } - - // Add the span/segment ID to the exception as agent attributes - exception.agentAttributes.spanId = segment.id -} - -/** - * Associate an exception with the transaction. When the transaction ends, - * the exception will be collected along with the transaction details. - * - * @param {Exception} exception The exception object to be collected. - */ -Transaction.prototype.addException = _addException - -function _addException(exception) { - this._linkExceptionToSegment(exception) - this.exceptions.push(exception) -} - -/** - * Associate a user error (reported using the noticeError() API) with the transaction. - * When the transaction ends, the exception will be collected along with the transaction - * details. - * - * @param {Exception} exception The exception object to be collected. - */ -Transaction.prototype.addUserError = _addUserError - -function _addUserError(exception) { - this._linkExceptionToSegment(exception) - this.userErrors.push(exception) -} - -/** - * Returns if the transaction's current status code is errored - * but considered ignored via the config. - */ -Transaction.prototype.hasIgnoredErrorStatusCode = function _hasIgnoredErrorStatusCode() { - return urltils.isIgnoredError(this.agent.config, this.statusCode) -} - -/** - * Returns true if an error happened during the transaction or if the transaction itself is - * considered to be an error. - */ -Transaction.prototype.hasErrors = function _hasErrors() { - var isErroredTransaction = urltils.isError(this.agent.config, this.statusCode) - var transactionHasExceptions = this.exceptions.length > 0 - var transactionHasuserErrors = this.userErrors.length > 0 - return (transactionHasExceptions || transactionHasuserErrors || isErroredTransaction) -} - -// Returns true if all the errors/exceptions collected so far are expected errors -Transaction.prototype.hasOnlyExpectedErrors = function hasOnlyExpectedErrors() { - if (0 === this.exceptions.length) { - return false - } - - for (let i = 0;i < this.exceptions.length;i++) { - const exception = this.exceptions[i] - // this expection is neither expected nor ignored - const isUnexpected = !( - errorHelper.isExpectedException( - this, - exception.error, - this.agent.config, - urltils - ) || - errorHelper.shouldIgnoreError( - this, - exception.error, - this.agent.config - ) - ) - if (isUnexpected) { - return false - } - } - return true -} - -/** - * Returns agent intrinsic attribute for this transaction. - */ -Transaction.prototype.getIntrinsicAttributes = function getIntrinsicAttributes() { - if (!this._intrinsicAttributes.totalTime) { - var config = this.agent.config - this._intrinsicAttributes.totalTime = - this.trace.getTotalTimeDurationInMillis() * FROM_MILLIS - - if (config.distributed_tracing.enabled) { - this.addDistributedTraceIntrinsics(this._intrinsicAttributes) - } else if (config.cross_application_tracer.enabled) { - this._intrinsicAttributes.path_hash = hashes.calculatePathHash( - config.applications()[0], - this.name || this._partialName, - this.referringPathHash - ) - this._intrinsicAttributes.trip_id = this.tripId || this.id - if (this.referringTransactionGuid) { - this._intrinsicAttributes.referring_transaction_guid = - this.referringTransactionGuid - } - if (this.incomingCatId) { - this._intrinsicAttributes.client_cross_process_id = this.incomingCatId - } - } - - if (this.syntheticsData) { - this._intrinsicAttributes.synthetics_resource_id = this.syntheticsData.resourceId - this._intrinsicAttributes.synthetics_job_id = this.syntheticsData.jobId - this._intrinsicAttributes.synthetics_monitor_id = this.syntheticsData.monitorId - } - } - return Object.assign(Object.create(null), this._intrinsicAttributes) -} - -/** - * Parsing incoming headers for use in a distributed trace. - * W3C TraceContext format is preferred over the NewRelic DT format. - * NewRelic DT format will be used if no `traceparent` header is found. - * @param @param {string} [transport='Unknown'] - The transport type that delivered the trace. - * @param {object} headers - Headers to search for supported trace formats. Keys must be lowercase. - */ -Transaction.prototype.acceptDistributedTraceHeaders = acceptDistributedTraceHeaders -function acceptDistributedTraceHeaders(transportType, headers) { - const transport = TRANSPORT_TYPES_SET[transportType] ? transportType : TRANSPORT_TYPES.UNKNOWN - - // assumes header keys already lowercase - const traceparent = headers[TRACE_CONTEXT_PARENT_HEADER] - - if (traceparent) { - logger.trace('Accepting trace context DT payload for transaction %s', this.id) - // assumes header keys already lowercase - const tracestate = headers[TRACE_CONTEXT_STATE_HEADER] - this.acceptTraceContextPayload(traceparent, tracestate, transport) - } else if (NEWRELIC_TRACE_HEADER in headers) { - logger.trace('Accepting newrelic DT payload for transaction %s', this.id) - // assumes header keys already lowercase - const payload = headers[NEWRELIC_TRACE_HEADER] - this._acceptDistributedTracePayload(payload, transport) - } -} - -/** - * Inserts distributed trace headers into the provided headers map. - * @param {Object} headers - */ -Transaction.prototype.insertDistributedTraceHeaders = insertDistributedTraceHeaders -function insertDistributedTraceHeaders(headers) { - if (!headers) { - logger.trace('insertDistributedTraceHeaders called without headers.') - return - } - - checkForExistingNrTraceHeaders(headers) - - // Ensure we have priority before generating trace headers. - this._calculatePriority() - - this.traceContext.addTraceContextHeaders(headers) - this.isDistributedTrace = true - - logger.trace('Added outbound request w3c trace context headers in transaction %s', this.id) - - if (this.agent.config.distributed_tracing.exclude_newrelic_header) { - logger.trace('Excluding newrelic header due to exclude_newrelic_header: true') - return - } - - try { - const newrelicFormatData = this._createDistributedTracePayload().httpSafe() - headers[NEWRELIC_TRACE_HEADER] = newrelicFormatData - logger.trace('Added outbound request distributed tracing headers in transaction %s', this.id) - } catch (error) { - logger.trace(error, 'Failed to create distributed trace payload') - } -} - -function checkForExistingNrTraceHeaders(headers) { - const traceparentHeader = headers[TRACE_CONTEXT_PARENT_HEADER] - const newrelicHeader = headers[NEWRELIC_TRACE_HEADER] - - const hasExisting = traceparentHeader || newrelicHeader - if (hasExisting) { - logger.trace(MULTIPLE_INSERT_MESSAGE, traceparentHeader, newrelicHeader) - } -} - -Transaction.prototype.acceptTraceContextPayload = acceptTraceContextPayload -function acceptTraceContextPayload(traceparent, tracestate, transport) { - if (this.isDistributedTrace) { - logger.warn( - 'Already accepted or created a distributed trace payload for transaction %s, ignoring call', - this.id - ) - - if (this.acceptedDistributedTrace) { - this.agent.recordSupportability('TraceContext/Accept/Ignored/Multiple') - } else { - this.agent.recordSupportability('TraceContext/Accept/Ignored/CreateBeforeAccept') - } - - return - } - - const traceContext = - this.traceContext.acceptTraceContextPayload(traceparent, tracestate) - - if (traceContext.acceptedTraceparent) { - this.acceptedDistributedTrace = true - this.isDistributedTrace = true - - this.traceId = traceContext.traceId - this.parentSpanId = traceContext.parentSpanId - this.parentTransportDuration = traceContext.transportDuration - this.parentTransportType = transport - - if (traceContext.acceptedTracestate) { - this.parentType = traceContext.parentType - this.parentAcct = traceContext.accountId - this.parentApp = traceContext.appId - this.parentId = traceContext.transactionId - this.sampled = traceContext.sampled - this.priority = traceContext.priority - } - } -} - -/** - * Parses incoming distributed trace header payload. - * - * @param {object} payload - The distributed trace payload to accept. - * @param {string} [transport='Unknown'] - The transport type that delivered the payload. - */ -Transaction.prototype._acceptDistributedTracePayload = _acceptDistributedTracePayload -function _acceptDistributedTracePayload(payload, transport) { - if (!payload) { - this.agent.recordSupportability('DistributedTrace/AcceptPayload/Ignored/Null') - return - } - - if (this.isDistributedTrace) { - logger.warn( - 'Already accepted or created a distributed trace payload for transaction %s, ignoring call', - this.id - ) - if (this.parentId) { - this.agent.recordSupportability('DistributedTrace/AcceptPayload/Ignored/Multiple') - } else { - this.agent.recordSupportability( - 'DistributedTrace/AcceptPayload/Ignored/CreateBeforeAccept' - ) - } - return - } - - const config = this.agent.config - const distTraceEnabled = config.distributed_tracing.enabled - const trustedAccount = config.trusted_account_key || config.account_id - - if (!distTraceEnabled || !trustedAccount) { - logger.debug( - 'Invalid configuration for distributed trace payload, not accepting ' + - '(distributed_tracing.enabled: %s, trustKey: %s', - distTraceEnabled, - trustedAccount - ) - - this.agent.recordSupportability('DistributedTrace/AcceptPayload/Exception') - return - } - - const parsed = this._getParsedPayload(payload) - - if (!parsed) { - return - } - - if (!parsed.v || !parsed.d) { - if (!parsed.v) { - logger.warn( - 'Received a distributed trace payload with no version field', - this.id - ) - } - if (!parsed.d) { - logger.warn( - 'Received a distributed trace payload with no data field', - this.id - ) - } - this.agent.recordSupportability('DistributedTrace/AcceptPayload/ParseException') - return - } - - const majorVersion = parsed.v && typeof parsed.v[0] === 'number' && parsed.v[0] - if (majorVersion == null) { - logger.warn('Invalid distributed trace payload, not accepting') - this.agent.recordSupportability('DistributedTrace/AcceptPayload/Exception') - } - if (majorVersion > 0) { // TODO: Add DistributedTracePayload class? - this.agent.recordSupportability('DistributedTrace/AcceptPayload/Ignored/MajorVersion') - return - } - - const data = parsed.d - - if (!data) { - logger.warn('No distributed trace data received, not accepting payload') - this.agent.recordSupportability('DistributedTrace/AcceptPayload/Exception') - return - } - - const requiredKeysExist = REQUIRED_DT_KEYS.every(function checkExists(key) { - return data[key] != null - }) - // Either parentSpanId or parentId are required. - if (!requiredKeysExist || data.tx == null && data.id == null) { - this.agent.recordSupportability('DistributedTrace/AcceptPayload/ParseException') - return - } - - const trustedAccountKey = data.tk || data.ac - if (trustedAccountKey !== trustedAccount) { - this.agent.recordSupportability( - `DistributedTrace/AcceptPayload/Ignored/UntrustedAccount` - ) - return - } - - this.parentType = data.ty - this.parentApp = data.ap - this.parentAcct = data.ac - this.parentTransportType = transport - this.parentTransportDuration = Math.max(0, (Date.now() - data.ti) / 1000) - this.traceId = data.tr - - if (data.pr) { - this.priority = data.pr - this.sampled = data.sa != null ? data.sa : this.sampled - } - - if (data.tx) { - this.parentId = data.tx - } - - if (data.id) { - this.parentSpanId = data.id - } - - this.isDistributedTrace = true - // Track if the distributed trace was created through accepting, since - // there is potentially no data difference between creation from - // Mobile or Browser trace payloads and creation. - this.acceptedDistributedTrace = true - - this.agent.recordSupportability('DistributedTrace/AcceptPayload/Success') -} - -/** - * Returns parsed payload object after attempting to decode it from base64, - * and parsing the JSON string. - */ -Transaction.prototype._getParsedPayload = function _getParsedPayload(payload) { - let parsed = payload - - if (typeof payload === 'string') { - if (payload.charAt(0) !== '{' && payload.charAt(0) !== '[') { - try { - payload = Buffer.from(payload, 'base64').toString('utf-8') - } catch (err) { - logger.warn( - err, - 'Got unparseable distributed trace payload in transaction %s', - this.id - ) - this.agent.recordSupportability('DistributedTrace/AcceptPayload/ParseException') - return null - } - } - try { - parsed = JSON.parse(payload) - } catch (err) { - logger.warn( - err, - 'Failed to parse distributed trace payload in transaction %s', - this.id - ) - this.agent.recordSupportability('DistributedTrace/AcceptPayload/ParseException') - return null - } - } - - return parsed -} - -/** - * Creates a distributed trace payload. - */ -Transaction.prototype._createDistributedTracePayload = _createDistributedTracePayload - -function _createDistributedTracePayload() { - const config = this.agent.config - const accountId = config.account_id - const appId = config.primary_application_id - const distTraceEnabled = config.distributed_tracing.enabled - - if (!accountId || !appId || !distTraceEnabled) { - logger.debug( - 'Invalid configuration for distributed trace payload ' + - '(distributed_tracing.enabled: %s, account_id: %s, application_id: %s) ' + - 'in transaction %s', - distTraceEnabled, - accountId, - appId, - this.id - ) - - return new DTPayloadStub() - } - - const currSegment = this.agent.tracer.getSegment() - const data = { - ty: 'App', - ac: accountId, - ap: appId, - tx: this.id, - tr: this.traceId, - pr: this.priority, - sa: this.sampled, - ti: Date.now() - } - - if (config.span_events.enabled && this.sampled && currSegment) { - data.id = currSegment.id - } - - if (config.trusted_account_key && config.trusted_account_key !== accountId) { - data.tk = config.trusted_account_key - } - - this.isDistributedTrace = true - this.agent.recordSupportability('DistributedTrace/CreatePayload/Success') - - return new DTPayload(data) -} - -/** - * Adds distributed trace attributes to instrinsics object. - */ -Transaction.prototype.addDistributedTraceIntrinsics = addDistributedTraceIntrinsics -function addDistributedTraceIntrinsics(attrs) { - this._calculatePriority() - - // *always* add these if DT flag is enabled. - attrs.traceId = this.traceId - attrs.guid = this.id - attrs.priority = this.priority - - attrs.sampled = !!this.sampled - - // add the rest only if payload was received - if (this.parentType) { - attrs['parent.type'] = this.parentType - } - - if (this.parentApp) { - attrs['parent.app'] = this.parentApp - } - - if (this.parentAcct) { - attrs['parent.account'] = this.parentAcct - } - - if (this.parentTransportType) { - attrs['parent.transportType'] = this.parentTransportType - } - - if (this.parentTransportDuration != null) { - attrs['parent.transportDuration'] = this.parentTransportDuration - } -} - -Transaction.prototype.isSampled = function isSampled() { - this._calculatePriority() - return this.sampled -} - -/** - * Generates a priority for the transaction if it does not have one already. - */ -Transaction.prototype._calculatePriority = function _calculatePriority() { - if (this.priority === null) { - this.priority = Math.random() - // We want to separate the priority roll from the decision roll to - // avoid biasing the priority range - this.sampled = this.agent.transactionSampler.shouldSample(Math.random()) - if (this.sampled) { - this.priority += 1 - } - - // Truncate the priority after potentially modifying it to avoid floating - // point errors. - this.priority = (this.priority * 1e6 | 0) / 1e6 - } -} - -function _makeValueSet(obj) { - return Object.keys(obj).map((t) => obj[t]).reduce(function reduceToMap(o, t) { - o[t] = true - return o - }, Object.create(null)) -} - -Transaction.prototype.addRequestParameters = addRequestParameters - -/** - * Adds request/query parameters to create attributes in the form - * 'request.parameters.{key}'. These attributes will only be created - * when 'request.parameters.*' is included in the attribute config. - * @param {Object.} requestParameters - */ -function addRequestParameters(requestParameters) { - for (var key in requestParameters) { - if (props.hasOwn(requestParameters, key)) { - this.trace.attributes.addAttribute( - DESTS.NONE, - 'request.parameters.' + key, - requestParameters[key] - ) - - const segment = this.baseSegment - - segment.attributes.addAttribute( - DESTS.NONE, - 'request.parameters.' + key, - requestParameters[key] - ) - } - } -} - -module.exports = Transaction diff --git a/node_modules/newrelic/lib/transaction/name-state.js b/node_modules/newrelic/lib/transaction/name-state.js deleted file mode 100644 index f2965632..00000000 --- a/node_modules/newrelic/lib/transaction/name-state.js +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger.js').child({component: 'name-state'}) -var NAMES = require('../metrics/names') - -// TODO: Figure out a way to phase out legacy transaction names. -var LEGACY_NAMING = { - Custom: true, - - Connect: true, - Director: true, - Expressjs: true, - Hapi: true, - Nodejs: true, - Restify: true -} - -const STATUS_CODE_NAMES = { - 404: '(not found)', - 501: '(not implemented)', - 405: '(method not allowed)' -} - -/** - * Manages transaction names using a stack of paths. - * - * @constructor - */ -function NameState(prefix, verb, delimiter, path) { - this.reset() - this.setName(prefix, verb, delimiter, path) - this._frozen = false -} - -NameState.prototype.setName = function setName(prefix, verb, delimiter, path) { - if (this._frozen) { - return - } - - this.setPrefix(prefix) - this.verb = verb && verb.toUpperCase() - this.delimiter = delimiter - this.pathStack = path ? [{path: path, params: null}] : [] - this._pathCache = null - this.markedPath = [] - logger.trace('setName called on name state, path stack now %j', this.pathStack) -} - -NameState.prototype.getStatusName = function getStatusName(statusCode) { - const name = STATUS_CODE_NAMES[statusCode] - if (name) { - if (LEGACY_NAMING.hasOwnProperty(this.prefix)) { - return _getName(this, name) - } - return NAMES.WEB.FRAMEWORK_PREFIX + '/' + _getName(this, name) - } -} - -NameState.prototype.markPath = function markPath() { - this.markedPath = this.pathStack.slice() -} - -/** - * Sets the metric prefix (i.e. Expressjs). - */ -NameState.prototype.setPrefix = function setPrefix(prefix) { - if (this._frozen) { - return - } - - if (prefix === null) { - this.prefix = null - return - } - this.prefix = (prefix[prefix.length - 1] === '/') ? - prefix.substring(0, prefix.length - 1) : prefix -} - -/** - * Sets the HTTP verb (i.e. GET/POST/PUT) - */ -NameState.prototype.setVerb = function setVerb(verb) { - if (!this._frozen) { - this.verb = verb && verb.toUpperCase() - } -} - -/** - * Sets the delimiter character used to separate the http verb from the path. - */ -NameState.prototype.setDelimiter = function setDelimiter(delimiter) { - if (!this._frozen) { - this.delimiter = delimiter - } -} - -NameState.prototype.isEmpty = function isEmpty() { - return this.pathStack.length === 0 && this.markedPath.length === 0 -} - -/** - * Pushes a new path element onto the naming stack. - */ -NameState.prototype.appendPath = function appendPath(path, params) { - if (!this._frozen && path != null) { - var strPath = path instanceof RegExp ? path.source : String(path) - this.pathStack.push({path: strPath, params: params || null}) - - if (path !== '') { - this._pathCache = null - } - logger.trace('Appended %s to path stack', strPath) - } -} - -/** - * Pushes a new path element onto the naming stack if the stack is - * empty. - */ -NameState.prototype.appendPathIfEmpty = function appendPathIfEmpty(path, params) { - if (!this._frozen && this.isEmpty()) { - return this.appendPath(path, params || null) - } -} - -/** - * Pops the last element off the name stack. - * - * If `path` is provided, the stack is popped back to the first element matching - * `path`. If no element matches, the stack is left unchanged. - * - * @param {string} [path] - Optional. A path piece to pop back to. - */ -NameState.prototype.popPath = function popPath(path) { - if (this._frozen || this.pathStack.length === 0) { - return - } - - this._pathCache = null - var pops = 0 - if (path != null) { - const idx = _findLastIndex(this.pathStack, (a) => a.path === path) - if (idx !== -1) { - pops = this.pathStack.length - idx - this.pathStack.splice(idx) - } - } else { - pops = 1 - this.pathStack.pop() - } - logger.trace('Popped %j from path, %d removed', path, pops) -} - -NameState.prototype.getPath = function getPath() { - var ps = !this.pathStack.length ? this.markedPath : this.pathStack - var psLength = ps.length - if (this._pathCache) { - return this._pathCache - } else if (psLength === 0) { - return null // nameState initialized but never set - } - - var path = '/' - for (var i = 0; i < psLength; ++i) { - var a = ps[i].path - if (a && a !== '/') { - if (a[0] !== '/' && path[path.length - 1] !== '/') { - path += '/' - } else if (a[0] === '/' && path[path.length - 1] === '/') { - a = a.substr(1) - } - path += a - } - } - - return this._pathCache = path -} - -NameState.prototype.getNameNotFound = function getNameNotFound() { - var name = _getName(this, '(not found)') - if (LEGACY_NAMING.hasOwnProperty(this.prefix)) { - return name - } - return NAMES.WEB.FRAMEWORK_PREFIX + '/' + name -} - -NameState.prototype.getName = function getName() { - var path = this.getPath() - if (path === null) { - return null - } - - return _getName(this, path) -} - -NameState.prototype.getFullName = function getFullName() { - var name = this.getName() - if (LEGACY_NAMING.hasOwnProperty(this.prefix)) { - return name - } - return NAMES.WEB.FRAMEWORK_PREFIX + '/' + name -} - -NameState.prototype.forEachParams = function forEachParams(fn, ctx) { - this.pathStack.forEach(function forEachPathStack(a) { - if (a.params) { - fn.call(ctx, a.params) - } - }) -} - -/** - * Locks the name state, preventing future changes from taking effect. - */ -NameState.prototype.freeze = function freeze() { - this._frozen = true -} - -NameState.prototype.reset = function reset() { - if (this._frozen) { - return - } - - logger.trace('Reset called on name state, path stack was %j', this.pathStack) - this.prefix = null - this.verb = null - this.delimiter = null - this.pathStack = [] - this._pathCache = null -} - -function _getName(nameState, path) { - var verb = nameState.verb ? '/' + nameState.verb : '' - return (nameState.prefix || '') + verb + (nameState.delimiter || '') + path -} - -/** - * Finds the last index of a single element in an array matching `pred`. - * - * @param {Array} arr - Array to search. - * @param {Function} pred - Predicate function that returns `true` on matches. - * @param {*} ctx - The `this` arg for `pred`. - * - * @returns {number} - This index of the last matching item, or `-1`. - */ -function _findLastIndex(arr, pred, ctx) { - for (let i = arr.length - 1; i >= 0; --i) { - if (pred.call(ctx, arr[i], i, arr)) { - return i - } - } - return -1 -} - -module.exports = NameState diff --git a/node_modules/newrelic/lib/transaction/trace/aggregator.js b/node_modules/newrelic/lib/transaction/trace/aggregator.js deleted file mode 100644 index 96cbef84..00000000 --- a/node_modules/newrelic/lib/transaction/trace/aggregator.js +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' -const a = require('async') -const logger = require('../../logger').child({component: 'Transaction Trace Aggregator'}) - -/* - * - * CONSTANTS - * - */ -const TO_MILLIS = 1e3 -const TraceAggregator = require('../../aggregators/trace-aggregator') - -/** - * Locus for the complicated logic surrounding the selection of slow - * transaction traces for submission to the collector. - * - * @param {object} config Dictionary containing transaction tracing - * parameters. Required. - */ -class TransactionTraceAggregator extends TraceAggregator { - constructor(opts, collector) { - opts = opts || {} - opts.method = opts.method || 'trace_sample_data' - if (!opts.config) { - throw new Error('config required by trace aggregator') - } - - super(opts, collector) - /* - * From - * - * https://newrelic.atlassian.net/wiki/display/eng/Transaction+Trace+Collection+Improvements - * - * 5 Transaction Trace Guarantee - * - * For the initial experience problem, the Agent will sample up to 1 - * transaction per minute until it has sampled 5 transactions. This - * guarantees that the agent will always report some transaction traces. - * There is no time out for this sampling period - the agent always - * samples until it has collected 5 transactions. The agent doesn't - * simply report the first 5 transactions that it sees because it's - * likely (particularly for a local dev test) that all 5 transactions - * would be associated with one request (a single web page and its - * resources). - */ - - - const config = opts.config - this.reported = 0 - this.config = config - - // Setting up top n capacity. - this.capacity = 1 - if (config.transaction_tracer && - config.transaction_tracer.top_n) { - this.capacity = config.transaction_tracer.top_n - } - - // hidden class optimization - this.trace = null - this.syntheticsTraces = [] - this.requestTimes = Object.create(null) - this.noTraceSubmitted = 0 - } - - /** - * For every five harvest cycles (or "minutes"), if no new slow transactions - * have been added, reset the requestTime match and allow a new set of five - * to start populating the Top N Slow Trace list. - */ - resetTimingTracker() { - this.requestTimes = Object.create(null) - this.noTraceSubmitted = 0 - } - - /** - * Add a trace to the slow trace list, if and only if it fulfills the necessary - * criteria. - * - * @param {Transaction} transaction The transaction, which we need to check - * apdexT, as well as getting the trace. - */ - add(transaction) { - if (!transaction) { - return - } - - if ( - this.config.collect_traces && - this.config.transaction_tracer && - this.config.transaction_tracer.enabled && - transaction && - transaction.metrics - ) { - const trace = transaction.trace - const name = transaction.getFullName() - const duration = trace.getDurationInMillis() - const apdexT = transaction.metrics.apdexT - - if (transaction.syntheticsData) { - this.addSyntheticsTrace(trace) - } else if (this.isBetter(name, duration, apdexT)) { - this.trace = trace - - // because of the "first 5" rule, this may or may not be the slowest - if (!this.requestTimes[name] || this.requestTimes[name] < duration) { - this.requestTimes[name] = duration - } - } - } - } - - addSyntheticsTrace(trace) { - if (this.syntheticsTraces.length < 20) { - this.syntheticsTraces.push(trace) - return true - } - return false - } - - /** - * Reset the trace diversity settings. - */ - clear() { - this.trace = null - this.syntheticsTraces = [] - } - - _merge(data) { - if (!data) { - return - } - if (data.trace) { - this.add(data.trace.transaction) - } - if (data.synthetics) { - for (let i = 0; i < data.synthetics.length; ++i) { - const trace = data.synthetics[i] - if (!this.addSyntheticsTrace(trace)) { - break - } - } - } - } - - _getMergeData() { - return { - trace: this.trace, - synthetics: this.synthetricsTraces - } - } - - getTraces() { - const traces = [].concat(this.syntheticsTraces) - const maxTraceSegments = this.config.max_trace_segments - if (this.trace) { - const trace = this.trace - if (trace.segmentsSeen > maxTraceSegments) { - logger.warn( - 'Transaction %s (%s) contained %d segments, only collecting the first %d', - trace.transaction.name, - trace.transaction.id, - trace.segmentsSeen, - maxTraceSegments - ) - } - this.noTraceSubmitted = 0 - traces.push(trace) - } else if (++this.noTraceSubmitted >= 5) { - this.resetTimingTracker() - } - return traces.length === 0 ? null : traces - } - - _toPayloadSync() { - const traces = this.getTraces() - if (!traces) { - logger.debug('No transaction traces to send.') - return null - } - - return [ - this.runId, - traces.map((trace) => trace.generateJSONSync()) - ] - } - - _toPayload(callback) { - const traces = this.getTraces() - if (!traces) { - return callback(null, traces) - } - return a.map( - traces, - (trace, cb) => trace.generateJSON(cb), - (err, encodedTraces) => callback(err, [this.runId, encodedTraces]) - ) - } - - _afterSend(successful) { - if (successful) { - ++this.reported - } - } - - /** - * Determine whether a new trace is more worth keeping than an old one. - * This gets called on every single transactionFinished event, so return as - * quickly as possible and call as few external functions as possible. On the - * converse, there's some complicated logic here, so spell things out. - * - * All specifications are from - * https://newrelic.atlassian.net/wiki/display/eng/Transaction+Trace+Collection+Improvements - * - * @param {string} name Name of this transaction's key metric. - * @param {number} duration Time the transaction took, in milliseconds. - * @param {number} apdexT Apdex tolerating threshold, in seconds. - */ - isBetter(name, duration, apdexT) { - /* 1. If the transaction duration is below the tracing threshold, the - * transaction is skipped. - * - * The threshold for slow traces defaults to apdex_f, which is 4 * apdex_t. - */ - const config = this.config.transaction_tracer - let isOverThreshold - - if (config && - config.transaction_threshold != null && - config.transaction_threshold !== 'apdex_f' && - typeof config.transaction_threshold === 'number') { - isOverThreshold = duration >= config.transaction_threshold * TO_MILLIS - } else { - isOverThreshold = duration >= 4 * TO_MILLIS * apdexT - } - if (!isOverThreshold) return false - - /* 2. If the transaction duration is less than the duration of the current - * slow transaction, the transaction is skipped. - */ - let slowerThanExisting = true - if (this.trace) { - slowerThanExisting = this.trace.getDurationInMillis() < duration - } - if (!slowerThanExisting) return false - - /* We always gather some slow transactions at the start, regardless of - * the size of Top N. This changes the behavior of the rest of the - * decision-making process in some subtle ways. - */ - const hasMetGuarantee = this.reported >= 5 - - /* 3. If the transaction's name is in the transaction map and its duration - * is less than the response time in the map, it is skipped. - */ - let slowerThanCaptured = true - if (hasMetGuarantee) { - if (this.requestTimes[name]) { - slowerThanCaptured = this.requestTimes[name] < duration - } - } - if (!slowerThanCaptured) return false - - /* Not part of enumerated rules, but necessary for Top N support: - * Ensure this name is either already in the request time map - * or that the map still hasn't hit capacity. - */ - if (hasMetGuarantee && - !this.requestTimes[name] && - Object.keys(this.requestTimes).length >= this.capacity) { - return false - } - - /* 4. The transaction is held as the slowest transaction. - */ - return true - } -} - -module.exports = TransactionTraceAggregator diff --git a/node_modules/newrelic/lib/transaction/trace/exclusive-time-calculator.js b/node_modules/newrelic/lib/transaction/trace/exclusive-time-calculator.js deleted file mode 100644 index edc516de..00000000 --- a/node_modules/newrelic/lib/transaction/trace/exclusive-time-calculator.js +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -class ExclusiveCalculator { - constructor(root) { - this.toProcess = [root] - // use a second stack to do a post-order traversal - this.parentStack = [] - } - - /** - * Kicks off the exclusive duration calculation. This is performed - * using a depth first, postorder traversal over the tree. - */ - process() { - while (this.toProcess.length) { - const segment = this.toProcess.pop() - const children = segment.getChildren() - // when we hit a leaf, calc the exclusive time and report the time - // range to the parent - if (children.length === 0) { - segment._exclusiveDuration = segment.getDurationInMillis() - if (this.parentStack.length) { - this.finishLeaf(segment.timer.toRange()) - } - } else { - // in the case we are processing an internal node, we just push it on the stack - // and push its children to be processed. all processing will be done after its - // children are all done (i.e. postorder) - this.parentStack.push({ - childrenLeft: children.length, - segment: segment, - childPairs: [] - }) - for (var i = children.length - 1; i >= 0; --i) { - this.toProcess.push(children[i]) - } - } - } - } - - /** - * Updates the immediate parent in the parent stack that a leaf node has - * been processed. If the parent isn't expecting any more children to - * be processed, it pops the stack and propagates the processing to - * more distant predecessors. - * - * @param {Array} childRange An array of start and end time for the finished leaf node - */ - finishLeaf(childRange) { - let parent = this.parentStack[this.parentStack.length - 1] - // push the current segment's range pair up to the parent's child pairs - parent.childPairs = merge(parent.childPairs, [childRange]) - // decrement the number of children expected for the current parent; process the - // parent if it is not expecting any further children to finish (i.e. the number - // of children left to process is 0). - while (--parent.childrenLeft === 0) { - // pull off the finished parent and assign the exclusive duration - const {segment: finishedParent, childPairs} = this.parentStack.pop() - const timer = finishedParent.timer - const finishedEnd = timer.getDurationInMillis() + timer.start - let duration = finishedParent.getDurationInMillis() - for (let i = 0; i < childPairs.length; ++i) { - const pair = childPairs[i] - // since these are non-overlapping and ordered by start time, the first one - // to start after the parent's end marks the end of the segments we care - // about. - if (pair[0] >= finishedEnd) { - break - } - duration -= Math.min(pair[1], finishedEnd) - pair[0] - } - - finishedParent._exclusiveDuration = duration - parent = this.parentStack[this.parentStack.length - 1] - // since the parent was potentially a child of another segment, we need to - // rerun this for the parent's parent till we hit a parent with children yet - // to be processed. - if (parent) { - // merge the current child segments in with the finished parent's range - const inserted = merge(childPairs, [finishedParent.timer.toRange()]) - // merge the finished parent's merged range into its parent's range - parent.childPairs = merge(parent.childPairs, inserted) - } else { - // in the case where the parent doesn't exist, we are done and can break out. - break - } - } - } -} - -function merge(first, second) { - if (!first.length) { - return second - } - - if (!second.length) { - return first - } - - const res = [] - var resIdx = 0 - var firstIdx = 0 - var secondIdx = 0 - // N.B. this is destructive, it will be updating the end times for range arrays in - // the input arrays. If we need to reuse these arrays for anything, this behavior - // must be changed. - var currInterval = first[firstIdx][0] < second[secondIdx][0] - ? first[firstIdx++] - : second[secondIdx++] - - while (firstIdx < first.length && secondIdx < second.length) { - var next = first[firstIdx][0] < second[secondIdx][0] - ? first[firstIdx++] - : second[secondIdx++] - if (next[0] <= currInterval[1]) { - // if the segment overlaps, update the end of the current merged segment - currInterval[1] = Math.max(next[1], currInterval[1]) - } else { - // if there is no overlap, start a new merging segment and push the old one - res[resIdx++] = currInterval - currInterval = next - } - } - - - const firstIsRemainder = firstIdx !== first.length - const remainder = firstIsRemainder ? first : second - let remainderIdx = firstIsRemainder ? firstIdx : secondIdx - - // merge the segments overlapping with the current interval - while (remainder[remainderIdx] && remainder[remainderIdx][0] <= currInterval[1]) { - currInterval[1] = Math.max(remainder[remainderIdx++][1], currInterval[1]) - } - - res[resIdx++] = currInterval - - // append the remaining non-overlapping ranges - for (;remainderIdx < remainder.length; ++remainderIdx) { - res[resIdx++] = remainder[remainderIdx] - } - - return res -} - -module.exports = ExclusiveCalculator diff --git a/node_modules/newrelic/lib/transaction/trace/index.js b/node_modules/newrelic/lib/transaction/trace/index.js deleted file mode 100644 index 0493c61c..00000000 --- a/node_modules/newrelic/lib/transaction/trace/index.js +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var codec = require('../../util/codec') -var Segment = require('./segment') -var {Attributes, MAXIMUM_CUSTOM_ATTRIBUTES} = require('../../attributes') -var logger = require('../../logger').child({component: 'trace'}) - - -var {DESTINATIONS} = require('../../config/attribute-filter') -var FROM_MILLIS = 1e-3 -const ATTRIBUTE_SCOPE = 'transaction' - -const REQUEST_URI_KEY = 'request.uri' -const UNKNOWN_URI_PLACEHOLDER = '/Unknown' - -/** - * A Trace holds the root of the Segment graph and produces the final - * serialization of the transaction trace. - * - * @param {Transaction} transaction The transaction bound to the trace. - */ -function Trace(transaction) { - if (!transaction) throw new Error('All traces must be associated with a transaction.') - - this.transaction = transaction - - this.root = new Segment(transaction, 'ROOT') - this.root.start() - - this.intrinsics = Object.create(null) - this.segmentsSeen = 0 - this.totalTimeCache = null - - this.custom = new Attributes(ATTRIBUTE_SCOPE, MAXIMUM_CUSTOM_ATTRIBUTES) - this.attributes = new Attributes(ATTRIBUTE_SCOPE) - - // sending displayName if set by user - var displayName = transaction.agent.config.getDisplayHost() - var hostName = transaction.agent.config.getHostnameSafe() - if (displayName !== hostName) { - this.attributes.addAttribute( - DESTINATIONS.TRANS_COMMON, - 'host.displayName', - displayName - ) - - this.displayName = displayName - } - this.domain = null -} - -/** - * End and close the current trace. Triggers metric recording for trace - * segments that support recording. - */ -Trace.prototype.end = function end() { - const segments = [this.root] - - while (segments.length) { - const segment = segments.pop() - segment.finalize() - - const children = segment.getChildren() - for (let i = 0; i < children.length; ++i) { - segments.push(children[i]) - } - } -} - -/** - * Iterates over the trace tree and generates a span event for each segment. - */ -Trace.prototype.generateSpanEvents = function generateSpanEvents() { - const config = this.transaction.agent.config - - const infiniteTracingConfigured = Boolean(config.infinite_tracing.trace_observer.host) - - if ( - (infiniteTracingConfigured || this.transaction.sampled) && - config.span_events.enabled && - config.distributed_tracing.enabled - ) { - let toProcess = [] - - // Root segment does not become a span, so we need to process it separately. - const spanAggregator = this.transaction.agent.spanEventAggregator - - const children = this.root.getChildren() - - if (children.length > 0) { - // At the point where these attributes are available, we only have a - // root span. Adding attributes to first non-root span here. - const attributeMap = { - 'host.displayName': this.displayName, - 'parent.type': this.transaction.parentType, - 'parent.app': this.transaction.parentApp, - 'parent.account': this.transaction.parentAcct, - 'parent.transportType': this.transaction.parentTransportType, - 'parent.transportDuration': this.transaction.parentTransportDuration - } - - for (const [key, value] of Object.entries(attributeMap)) { - if (value !== null) { - children[0].addSpanAttribute(key, value) - } - } - } - - for (let i = 0; i < children.length; ++i) { - toProcess.push(new DTTraceNode(children[i], this.transaction.parentSpanId, true)) - } - - while (toProcess.length) { - let segmentInfo = toProcess.pop() - let segment = segmentInfo.segment - - // Even though at some point we might want to stop adding events because all the priorities - // should be the same, we need to count the spans as seen. - spanAggregator.addSegment(segment, segmentInfo.parentId, segmentInfo.isRoot) - - const nodes = segment.getChildren() - for (let i = 0; i < nodes.length; ++i) { - const node = new DTTraceNode(nodes[i], segment.id) - toProcess.push(node) - } - } - } -} - -function DTTraceNode(segment, parentId, isRoot = false) { - this.segment = segment - this.parentId = parentId - this.isRoot = isRoot -} - -/** - * Add a child to the list of segments. - * - * @param {string} childName Name for the new segment. - * @returns {Segment} Newly-created Segment. - */ -Trace.prototype.add = function add(childName, callback) { - return this.root.add(childName, callback) -} - -/** - * Explicitly set a trace's runtime instead of using it as a stopwatch. - * (As a byproduct, stops the timer.) - * - * @param {int} duration Duration of this particular trace. - * @param {int} startTimeInMillis (optional) Start of this trace. - */ -Trace.prototype.setDurationInMillis = setDurationInMillis - -function setDurationInMillis(duration, startTimeInMillis) { - this.root.setDurationInMillis(duration, startTimeInMillis) -} - -/** - * @return {integer} The amount of time the trace took, in milliseconds. - */ -Trace.prototype.getDurationInMillis = function getDurationInMillis() { - return this.root.getDurationInMillis() -} - -/** - * Adds given key-value pair to trace's custom attributes, if it passes filtering rules. - * - * @param {string} key - The attribute name. - * @param {string} value - The attribute value. - */ -Trace.prototype.addCustomAttribute = function addCustomAttribute(key, value) { - if (this.custom.has(key)) { - logger.debug( - 'Potentially changing custom attribute %s from %s to %s.', - key, - this.custom.attributes[key].value, - value - ) - } - - this.custom.addAttribute(DESTINATIONS.TRANS_SCOPE, key, value) -} - -/** - * The duration of the transaction trace tree that only this level accounts - * for. - * - * @return {integer} The amount of time the trace took, minus any child - * traces, in milliseconds. - */ -Trace.prototype.getExclusiveDurationInMillis = function getExclusiveDurationInMillis() { - return this.root.getExclusiveDurationInMillis() -} - - -/** - * The duration of all segments in a transaction trace. The root is not - * accounted for, since it doesn't represent a unit of work. - * - * @return {integer} The sum of durations for all segments in a trace in - * milliseconds - */ -Trace.prototype.getTotalTimeDurationInMillis = function getTotalTimeDurationInMillis() { - if (this.totalTimeCache !== null) return this.totalTimeCache - if (this.root.children.length === 0) return 0 - var segments = this.root.getChildren() - var totalTimeInMillis = 0 - - while (segments.length !== 0) { - var segment = segments.pop() - totalTimeInMillis += segment.getExclusiveDurationInMillis() - segments = segments.concat(segment.getChildren()) - } - - if (!this.transaction.isActive()) this.totalTimeCache = totalTimeInMillis - return totalTimeInMillis -} - -/** - * The serializer is asynchronous, so serialization is as well. - * - * The transaction trace sent to the collector is a nested set of arrays. The - * outermost array has the following fields, in order: - * - * 0: start time of the trace, in milliseconds - * 1: duration, in milliseconds - * 2: the path, or root metric name - * 3: the URL (fragment) for this trace - * 4: an array of segment arrays, deflated and then base64 encoded - * 5: the guid for this transaction, used to correlate across - * transactions - * 6: reserved for future use, specified to be null for now - * 7: FIXME: RUM2 force persist flag - * - * In addition, there is a "root node" (not the same as the first child, which - * is a node with the special name ROOT and contents otherwise identical to the - * top-level segment of the actual trace) with the following fields: - * - * 0: start time IN SECONDS - * 1: a dictionary containing request parameters - * 2: a dictionary containing custom parameters (currently not user-modifiable) - * 3: the transaction trace segments (including the aforementioned root node) - * 4: FIXME: a dictionary containing "parameter groups" with special information - * related to this trace - * - * @param {Function} callback Called after serialization with either - * an error (in the first parameter) or - * the serialized transaction trace. - */ -Trace.prototype.generateJSON = function generateJSON(callback) { - const serializedTrace = this._serializeTrace() - - const trace = this - if (!this.transaction.agent.config.simple_compression) { - codec.encode(serializedTrace, respond) - } else { - setImmediate(respond, null, serializedTrace) - } - - function respond(err, data) { - if (err) { - return callback(err, null, null) - } - - return callback(null, trace._generatePayload(data), trace) - } -} - -/** - * This is the synchronous version of Trace#generateJSON - */ -Trace.prototype.generateJSONSync = function generateJSONSync() { - const serializedTrace = this._serializeTrace() - const shouldCompress = !this.transaction.agent.config.simple_compression - const data = shouldCompress ? codec.encodeSync(serializedTrace) : serializedTrace - return this._generatePayload(data) -} - -/** - * Generates the payload used in a trace harvest. - * - * @private - * - * @returns {Array} The formatted payload. - */ -Trace.prototype._generatePayload = function _generatePayload(data) { - let syntheticsResourceId = null - if (this.transaction.syntheticsData) { - syntheticsResourceId = this.transaction.syntheticsData.resourceId - } - - const requestUri = this._getRequestUri() - - return [ - this.root.timer.start, // start - this.transaction.getResponseTimeInMillis(), // response time - this.transaction.getFullName(), // path - requestUri, // request.uri - data, // encodedCompressedData - this.transaction.id, // guid - null, // reserved for future use - false, // forcePersist - null, // xraySessionId - syntheticsResourceId // synthetics resource id - ] -} - -/** - * Returns the transaction URL if attribute is not exluded globally or - * for transaction traces. Returns '/Unknown' if included but not known. - * - * The URI on a trace is a special attribute. It is included as a positional field, - * not as an "agent attribute", to avoid having to decompress on the backend. - * But it still needs to be gaited by the same attribute exclusion/inclusion - * rules so sensitive information can be removed. - */ -Trace.prototype._getRequestUri = function _getRequestUri() { - const canAddUri = this.attributes.hasValidDestination(DESTINATIONS.TRANS_TRACE, REQUEST_URI_KEY) - let requestUri = null // must be null if excluded - if (canAddUri) { - requestUri = this.transaction.url || UNKNOWN_URI_PLACEHOLDER - } - - return requestUri -} - -/** - * Serializes the trace into the expected JSON format to be sent. - * - * @private - * - * @returns {Array} Serialized trace data. - */ -Trace.prototype._serializeTrace = function _serializeTrace() { - const attributes = { - agentAttributes: this.attributes.get(DESTINATIONS.TRANS_TRACE), - userAttributes: this.custom.get(DESTINATIONS.TRANS_TRACE), - intrinsics: this.intrinsics - } - - return [ - this.root.timer.start * FROM_MILLIS, - {}, // moved to agentAttributes - { - // hint to RPM for how to display this trace's segments - nr_flatten_leading: false - }, // moved to userAttributes - this.root.toJSON(), - attributes, - [] // FIXME: parameter groups - ] -} - -module.exports = Trace diff --git a/node_modules/newrelic/lib/transaction/trace/segment.js b/node_modules/newrelic/lib/transaction/trace/segment.js deleted file mode 100644 index fb51597d..00000000 --- a/node_modules/newrelic/lib/transaction/trace/segment.js +++ /dev/null @@ -1,493 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const {DESTINATIONS} = require('../../config/attribute-filter') -const logger = require('../../logger').child({component: 'segment'}) -const Timer = require('../../timer') -const urltils = require('../../util/urltils') -const hashes = require('../../util/hashes') - -const {Attributes} = require('../../attributes') -const ExclusiveCalculator = require('./exclusive-time-calculator') -const SpanContext = require('../../spans/span-context') - -const NAMES = require('../../metrics/names') -const INSTANCE_UNKNOWN = 'unknown' -const STATE = { - EXTERNAL: 'EXTERNAL', - CALLBACK: 'CALLBACK' -} -const ATTRIBUTE_SCOPE = 'segment' - - -/** - * Initializes the segment and binds the recorder to itself, if provided. - * - * @constructor - * @classdesc - * TraceSegments are inserted to track instrumented function calls. Each one is - * bound to a transaction, given a name (used only internally to the framework - * for now), and has one or more children (that are also part of the same - * transaction), as well as an associated timer. - * - * @param {Transaction} transaction - * The transaction to which this segment will be bound. - * - * @param {string} name - * Human-readable name for this segment (e.g. 'http', 'net', 'express', - * 'mysql', etc). - * - * @param {?function} recorder - * Callback that takes a segment and a scope name as attributes (intended to be - * used to record metrics related to the segment). - */ -function TraceSegment(transaction, name, recorder) { - this.name = name - this.transaction = transaction - - ++transaction.numSegments - ++transaction.agent.totalActiveSegments - ++transaction.agent.segmentsCreatedInHarvest - - if (recorder) { - transaction.addRecorder(recorder.bind(null, this)) - } - - this.attributes = new Attributes(ATTRIBUTE_SCOPE) - - this.children = [] - - // Generate a unique id for use in span events. - this.id = hashes.makeId() - this.timer = new Timer() - - this.internal = false - this.opaque = false - this.shim = null - - // hidden class optimization - this.partialName = null - this._exclusiveDuration = null - this._collect = true - this.host = null - this.port = null - this.state = STATE.EXTERNAL - this.async = true - this.ignore = false - - this.probe('new TraceSegment') -} - -TraceSegment.prototype.getSpanContext = function getSpanContext() { - const config = this.transaction.agent.config - const spansEnabled = config.distributed_tracing.enabled && config.span_events.enabled - - if (!this._spanContext && spansEnabled) { - this._spanContext = new SpanContext() - } - - return this._spanContext -} - -TraceSegment.prototype.addAttribute = -function addAttribute(key, value, truncateExempt = false) { - this.attributes.addAttribute( - DESTINATIONS.SEGMENT_SCOPE, - key, - value, - truncateExempt - ) -} - -TraceSegment.prototype.addSpanAttribute = -function addSpanAttribute(key, value, truncateExempt = false) { - this.attributes.addAttribute( - DESTINATIONS.SPAN_EVENT, - key, - value, - truncateExempt - ) -} - -TraceSegment.prototype.addSpanAttributes = -function addSpanAttributes(attributes) { - this.attributes.addAttributes( - DESTINATIONS.SPAN_EVENT, - attributes - ) -} - -TraceSegment.prototype.getAttributes = function getAttributes() { - return this.attributes.get(DESTINATIONS.TRANS_SEGMENT) -} - -TraceSegment.prototype.getSpanId = function getSpanId() { - const conf = this.transaction.agent.config - const enabled = conf.span_events.enabled && conf.distributed_tracing.enabled - if (enabled) { - return this.id - } - - return null -} - -/** - * @param {string} host - * The name of the host of the database. This will be normalized if the string - * represents localhost. - * - * @param {string|number} port - * The database's port, path to unix socket, or id. - * - * @param {string|number|bool} database - * The name or ID of the database that was connected to. Or `false` if there is - * no database name (i.e. Redis has no databases, only hosts). - */ -TraceSegment.prototype.captureDBInstanceAttributes = captureDBInstanceAttributes - -function captureDBInstanceAttributes(host, port, database) { - var config = this.transaction.agent.config - var dsTracerConf = config.datastore_tracer - - // Add database name if provided and enabled. - if (database !== false && dsTracerConf.database_name_reporting.enabled) { - this.addAttribute( - 'database_name', - typeof database === 'number' ? database : (database || INSTANCE_UNKNOWN) - ) - } - - // Add instance information if enabled. - if (dsTracerConf.instance_reporting.enabled) { - // Determine appropriate defaults for host and port. - port = port || INSTANCE_UNKNOWN - if (host && urltils.isLocalhost(host)) { - host = config.getHostnameSafe(host) - } - if (!host || host === 'UNKNOWN_BOX') { // Config's default name of a host. - host = INSTANCE_UNKNOWN - } - - this.addAttribute('host', host) - this.addAttribute('port_path_or_id', String(port)) - } -} - -TraceSegment.prototype.moveToCallbackState = function moveToCallbackState() { - this.state = STATE.CALLBACK -} - -TraceSegment.prototype.isInCallbackState = function isInCallbackState() { - return this.state === STATE.CALLBACK -} - -TraceSegment.prototype.probe = function probe(action) { - if (this.transaction.traceStacks) { - this.transaction.probe(action, {segment: this.name}) - } -} - - -/** - * For use when a transaction is ending. The transaction segment should - * be named after the transaction it belongs to (which is only known by - * the end). - */ -TraceSegment.prototype.setNameFromTransaction = function setNameFromTransaction() { - var transaction = this.transaction - - // transaction name and transaciton segment name must match - this.name = transaction.getFullName() - - // partialName is used to name apdex metrics when recording - this.partialName = transaction._partialName -} - -/** - * Once a transaction is named, the web segment also needs to be updated to - * match it (which implies this method must be called subsequent to - * transaction.finalizeNameFromUri). To properly name apdex metrics during metric - * recording, it's also necessary to copy the transaction's partial name. And - * finally, marking the trace segment as being a web segment copies the - * segment's parameters onto the transaction. - */ -TraceSegment.prototype.markAsWeb = function markAsWeb() { - var transaction = this.transaction - this.setNameFromTransaction() - - var traceAttrs = transaction.trace.attributes.get(DESTINATIONS.TRANS_TRACE) - Object.keys(traceAttrs).forEach((key) => { - if (!this.attributes.has(key)) { - this.addAttribute(key, traceAttrs[key]) - } - }) -} - -/** - * A segment attached to something evented (such as a database - * cursor) just finished an action, so set the timer to mark - * the timer as having a stop time. - */ -TraceSegment.prototype.touch = function touch() { - this.probe('Touched') - this.timer.touch() - this._updateRootTimer() -} - -TraceSegment.prototype.overwriteDurationInMillis = overwriteDurationInMillis -function overwriteDurationInMillis(duration, start) { - this.timer.overwriteDurationInMillis(duration, start) -} - - -TraceSegment.prototype.start = function start() { - this.timer.begin() -} - -/** - * Stop timing the related action. - */ -TraceSegment.prototype.end = function end() { - if (!this.timer.isActive()) return - this.probe('Ended') - this.timer.end() - this._updateRootTimer() -} - -TraceSegment.prototype.finalize = function finalize() { - if (this.timer.softEnd()) { - this._updateRootTimer() - // timer.softEnd() returns true if the timer was ended prematurely, so - // in that case we can name the segment as truncated - this.name = NAMES.TRUNCATED.PREFIX + this.name - } - - this.addAttribute( - 'nr_exclusive_duration_millis', - this.getExclusiveDurationInMillis() - ) -} - -/** - * Helper to set the end of the root timer to this segment's root if it is later - * in time. - */ -TraceSegment.prototype._updateRootTimer = function _updateRootTimer() { - var root = this.transaction.trace.root - if (this.timer.endsAfter(root.timer)) { - var newDuration = ( - this.timer.start + - this.getDurationInMillis() - - root.timer.start - ) - root.overwriteDurationInMillis(newDuration) - } -} - -/** - * Test to see if underlying timer is still active - * - * @returns {boolean} true if no longer active, else false. - */ -TraceSegment.prototype._isEnded = function _isEnded() { - return !this.timer.isActive() || this.timer.touched -} - -/** - * Add a new segment to a scope implicitly bounded by this segment. - * - * @param {string} childName New human-readable name for the segment. - * @returns {TraceSegment} New nested TraceSegment. - */ -TraceSegment.prototype.add = function add(childName, recorder) { - if (this.opaque) { - logger.trace('Skipping child addition on opaque segment') - return this - } - logger.trace('Adding segment %s to %s in %s', childName, this.name, this.transaction.id) - var segment = new TraceSegment(this.transaction, childName, recorder) - var config = this.transaction.agent.config - - if (this.transaction.trace.segmentsSeen++ >= config.max_trace_segments) { - segment._collect = false - } - this.children.push(segment) - - if (config.debug && config.debug.double_linked_transactions) { - segment.parent = this - } - - return segment -} - -/** - * Set the duration of the segment explicitly. - * - * @param {Number} duration Duration in milliseconds. - */ -TraceSegment.prototype.setDurationInMillis = setDurationInMillis - -function setDurationInMillis(duration, start) { - this.timer.setDurationInMillis(duration, start) -} - -TraceSegment.prototype.getDurationInMillis = function getDurationInMillis() { - return this.timer.getDurationInMillis() -} - -/** - * Only for testing! - * - * @param {number} duration Milliseconds of exclusive duration. - */ -TraceSegment.prototype._setExclusiveDurationInMillis = _setExclusiveDurationInMillis - -function _setExclusiveDurationInMillis(duration) { - this._exclusiveDuration = duration -} - -/** - * The duration of the transaction trace tree that only this level accounts - * for. - * - * @return {integer} The amount of time the trace took, minus any child - * segments, in milliseconds. - */ -TraceSegment.prototype.getExclusiveDurationInMillis = getExclusiveDurationInMillis - -function getExclusiveDurationInMillis() { - if (this._exclusiveDuration == null) { - // Calculate the exclusive time for the subtree rooted at `this` - const calculator = new ExclusiveCalculator(this) - calculator.process() - } - return this._exclusiveDuration -} - -TraceSegment.prototype.getChildren = function getChildren() { - var children = [] - for (var i = 0, len = this.children.length; i < len; ++i) { - if (!this.children[i].ignore) { - children.push(this.children[i]) - } - } - return children -} - -TraceSegment.prototype.getCollectedChildren = function getCollectedChildren() { - var children = [] - for (var i = 0, len = this.children.length; i < len; ++i) { - if (this.children[i]._collect && !this.children[i].ignore) { - children.push(this.children[i]) - } - } - return children -} - -/** - * Enumerate the timings of this segment's descendants. - * - * @param {Number} end The end of this segment, to keep the calculated - * duration from exceeding the duration of the - * parent. Defaults to Infinity. - * - * @returns {Array} Unsorted list of [start, end] pairs, with no pair - * having an end greater than the passed in end time. - */ -TraceSegment.prototype._getChildPairs = function _getChildPairs(end) { - // quick optimization - if (this.children.length < 1) return [] - if (!end) end = Infinity - - var children = this.getChildren() - var childPairs = [] - while (children.length) { - var child = children.pop() - var pair = child.timer.toRange() - - if (pair[0] >= end) continue - - children = children.concat(child.getChildren()) - - pair[1] = Math.min(pair[1], end) - childPairs.push(pair) - } - - return childPairs -} - -/** - * This is perhaps the most poorly-documented element of transaction traces: - * what do each of the segment representations look like prior to encoding? - * Spelunking in the code for the other agents has revealed that each child - * node is an array with the following field in the following order: - * - * 0: entry timestamp relative to transaction start time - * 1: exit timestamp - * 2: metric name - * 3: parameters as a name -> value JSON dictionary - * 4: any child segments - * - * Other agents include further fields in this. I haven't gotten to the bottom - * of all of them (and Ruby, of course, sends marshalled Ruby object), but - * here's what I know so far: - * - * in Java: - * 5: class name - * 6: method name - * - * in Python: - * 5: a "label" - * - * FIXME: I don't know if it makes sense to add custom fields for Node. TBD - */ -TraceSegment.prototype.toJSON = function toJSON() { - // use depth-first search on the segment tree using stack - const resultDest = [] - // array of objects relating a segment and the destination for its - // serialized data. - const segmentsToProcess = [{ - segment: this, - destination: resultDest - }] - - while (segmentsToProcess.length !== 0) { - const {segment, destination} = segmentsToProcess.pop() - - const start = segment.timer.startedRelativeTo(segment.transaction.trace.root.timer) - const duration = segment.getDurationInMillis() - - const segmentChildren = segment.getCollectedChildren() - const childArray = [] - - // push serialized data into the specified destination - destination.push([ - start, - start + duration, - segment.name, - segment.getAttributes(), - childArray - ]) - - if (segmentChildren.length) { - // push the children and the parent's children array into the stack. - // to preserve the chronological order of the children, push them - // onto the stack backwards (so the first one created is on top). - for (var i = segmentChildren.length - 1; i >= 0; --i) { - segmentsToProcess.push({ - segment: segmentChildren[i], - destination: childArray - }) - } - } - } - - // pull the result out of the array we serialized it into - return resultDest[0] -} - -module.exports = TraceSegment diff --git a/node_modules/newrelic/lib/transaction/tracecontext.js b/node_modules/newrelic/lib/transaction/tracecontext.js deleted file mode 100644 index 0cc64a59..00000000 --- a/node_modules/newrelic/lib/transaction/tracecontext.js +++ /dev/null @@ -1,599 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const logger = require('../logger').child({component: 'TraceContext'}) -const hashes = require('../util/hashes') - -const TRACE_CONTEXT_PARENT_HEADER = 'traceparent' -const TRACE_CONTEXT_STATE_HEADER = 'tracestate' -const PARENT_TYPES = ['App', 'Browser', 'Mobile'] -const APP_PARENT_TYPE = PARENT_TYPES.indexOf('App') - -const W3C_TRACEPARENT_VERSION = '00' -const NR_TRACESTATE_VERSION = 0 - -// 255 (ff) explicitly not allowed for version -const VERSION_VALID_RGX = /^((?![f]{2})[a-f0-9]{2})$/ -const TRACEID_VALID_RGX = /^((?![0]{32})[a-f0-9]{32})$/ -const PARENTID_VALID_RGX = /^((?![0]{16})[a-f0-9]{16})$/ -const FLAGS_VALID_RGX = /^([a-f0-9]{2})$/ - -const FLAGS = { - sampled: 0x00000001 -} - -/** - * The class reponsible for accepting, validating, and producing w3c tracecontext headers. - */ -class TraceContext { - /** - * Create a TraceContext object - * @param {Transaction} transaction - a transaction object to attach to. - */ - constructor(transaction) { - this.transaction = transaction - this.tracingVendors = null - this.trustedParentId = null - this._traceStateRaw = null - this.flags = { - get sampled() { - return transaction.sampled - } - } - } - - /** - * Creates a W3C TraceContext traceparent header payload. - */ - createTraceparent() { - // In case we receive a trace ID that isn't the proper length, zero pad - let traceId = this.transaction.traceId - traceId = traceId.padStart(32, '0') - - // If we had to pad, there's a chance this is an invalid upper-case header - // originating from a newrelic format DT payload being accepted. - if (traceId !== this.transaction.traceId && !TRACEID_VALID_RGX.test(traceId)) { - traceId = traceId.toLowerCase() - } - - // If no segment/span is in context, generate one so we can have a valid traceparent - const segment = this.transaction.agent.tracer.getSegment() - let parentId = segment && segment.id - if (!parentId) { - parentId = hashes.makeId(16) - logger.debug( - 'No segment/span in context. Generated new traceparent parentId (%s) for traceId (%s)', - parentId, - traceId - ) - } - - return `${W3C_TRACEPARENT_VERSION}-${traceId}-${parentId}-${this.createFlagsHex()}` - } - - /** - * Creates a W3C TraceContext tracestate header payload. - */ - createTracestate() { - const config = this.transaction.agent.config - const trustedAccountKey = config.trusted_account_key - const version = NR_TRACESTATE_VERSION - const parentType = APP_PARENT_TYPE - const appId = config.primary_application_id - const accountId = config.account_id - - if (!accountId || !appId || !trustedAccountKey) { - logger.debug( - 'Unable to create tracestate header due to missing required fields ' + - '(account_id: %s, primary_application_id: %s, trusted_account_key: %s) in transaction %s' + - 'This may occur if a trace is created prior to the agent fully starting.', - accountId, - appId, - trustedAccountKey, - this.transaction.id - ) - - this.transaction.agent.recordSupportability('TraceContext/TraceState/Create/Exception') - - return this._traceStateRaw || '' - } - - // If no segment/span is in context, we do not send one as - // we technically do not have a "span" on the agent side and - // this trace data is newrelic specific. - let spanId = '' - if (config.span_events.enabled) { - const segment = this.transaction.agent.tracer.getSegment() - if (segment) { - spanId = segment.id - } else { - logger.debug('No segment/span in context. Not sending spanId in tracestate.') - } - } else { - logger.trace('Span events disabled. Not sending spanId in tracestate.') - } - - const transactionId = config.transaction_events.enabled ? this.transaction.id : '' - const sampled = this.transaction.sampled ? '1' : '0' - const priority = this.transaction.priority ? this.transaction.priority.toFixed(6) : '' - const timestamp = Date.now() - - const nrTraceState = `${trustedAccountKey}@nr=${version}-${parentType}-${accountId}` + - `-${appId}-${spanId}-${transactionId}-${sampled}-${priority}-${timestamp}` - - if (this._traceStateRaw) { - return `${nrTraceState},${this._traceStateRaw}` - } - - return nrTraceState - } - - /** - * Takes a headers object and modifies it in place by adding Trace Context headers - * @param {object} headers - Headers for an HTTP request - */ - addTraceContextHeaders(headers) { - if (!headers) { - return - } - - const traceParent = this.createTraceparent() - headers[TRACE_CONTEXT_PARENT_HEADER] = traceParent - - logger.trace('traceparent added with %s', traceParent) - - const tracestate = this.createTracestate() - if (tracestate) { - headers[TRACE_CONTEXT_STATE_HEADER] = tracestate - logger.trace('tracestate added with %s', tracestate) - } - - this.transaction.agent.recordSupportability('TraceContext/Create/Success') - } - - /** - * @typedef TraceContextData - * @property {boolean} acceptedTraceparent - Whether a W3C traceparent headers was - * parsed, validated, and accepted - * @property {boolean} acceptedTracestate - Whether a New Relic tracestate headers was - * parsed, validated, and accepted - * @property {boolean} entryValid - Whether the matching NR tracestate string is valid - * @property {Intrinsics} intrinsics - All the parts of the New Relic tracestate string - * parsed and split out into an object - * @property {string} newTraceState - The raw tracestate without the New Relic entry - */ - - /** - * Takes a TraceContext headers from an HTTP request, parses them, validates them, and - * applies the values to the internal state, returning an object with the - * relevant Trace Context data and validation information. - * - * @param {string} traceparent - W3C traceparent header from an HTTP request - * @param {string} tracestate - W3C tracestate header from an HTTP request - * @returns {Object} returns an Object with the traceparent data and validation info - */ - acceptTraceContextPayload(traceparent, tracestate) { - const traceContextData = { - acceptedTraceparent: false, - acceptedTracestate: false, - acceptedNRTracestate: false, - traceId: null, - parentSpanId: null, - parentType: null, - accountId: null, - appId: null, - transactionId: null, - sampled: null, - priority: null, - transportDuration: null - } - - // - // Parsing traceparent - // - if (!traceparent) { - // From the W3C spec: If the vendor failed to parse traceparent, it MUST NOT - // attempt to parse tracestate - return traceContextData - } - - logger.trace('Accepting TraceContext for transaction %s', this.transaction.id) - const parsedParent = this._validateAndParseTraceParentHeader(traceparent) - - // Log if there is a version mismatch in traceparent - if (parsedParent.version !== W3C_TRACEPARENT_VERSION) { - logger.trace( - 'Incoming traceparent version: %s, agent traceparent version: %s', - parsedParent.version, - W3C_TRACEPARENT_VERSION - ) - } - - if (parsedParent.entryValid) { - logger.trace('Accepted traceparent for transaction %s', this.transaction.id) - traceContextData.acceptedTraceparent = true - - traceContextData.traceId = parsedParent.traceId - traceContextData.parentSpanId = parsedParent.parentId - } else { - logger.trace( - 'Invalid traceparent for transaction %s: %s', - this.transaction.id, - traceparent - ) - - this.transaction.agent.recordSupportability( - 'TraceContext/TraceParent/Parse/Exception' - ) - // From the W3C spec: If the vendor failed to parse traceparent, it MUST NOT - // attempt to parse tracestate - return traceContextData - } - - // - // Parsing tracestate - // - if (!tracestate) { - logger.trace('No tracestate for transaction %s', this.transaction.id) - - return traceContextData - } - - const parsedState = this._validateAndParseTraceStateHeader(tracestate) - - if (!parsedState.traceStateValid) { - logger.trace('Invalid tracestate for transaction %s: %s', - this.transaction.id, - tracestate - ) - - this.transaction.agent.recordSupportability('TraceContext/TraceState/Parse/Exception') - return traceContextData - } - - // Keep the raw, non-NewRelic tracestate string stored so that we can propogate it - this._traceStateRaw = parsedState.newTraceState - - // These need to be kept to be added to root span events as an attribute - this.tracingVendors = parsedState.vendors - - if ( - parsedState.intrinsics && - parsedState.intrinsics.version !== NR_TRACESTATE_VERSION - ) { - logger.trace( - 'Incoming tracestate version: %s, agent tracestate version: %s', - parsedState.intrinsics.version, - NR_TRACESTATE_VERSION - ) - } - - if (parsedState.entryValid) { - logger.trace('Accepted tracestate for transaction %s', this.transaction.id) - traceContextData.acceptedTracestate = true - - traceContextData.parentType = parsedState.intrinsics.parentType - traceContextData.accountId = parsedState.intrinsics.accountId - traceContextData.appId = parsedState.intrinsics.appId - traceContextData.transactionId = parsedState.intrinsics.transactionId - traceContextData.sampled = parsedState.intrinsics.sampled - traceContextData.priority = parsedState.intrinsics.priority - traceContextData.transportDuration = - Math.max(0, (Date.now() - parsedState.intrinsics.timestamp) / 1000) - - this.trustedParentId = parsedState.intrinsics.spanId - this._traceStateRaw = parsedState.newTraceState - - this.transaction.agent.recordSupportability('TraceContext/Accept/Success') - } else if (parsedState.entryFound) { - logger.error('Invalid tracestate for transaction %s: %s', - this.transaction.id, tracestate) - - this.transaction.agent.recordSupportability( - 'TraceContext/TraceState/InvalidNrEntry' - ) - } - - return traceContextData - } - - /** - * Validate a traceparent header string and return an object with the relevant parts - * parsed out if valid. - * - * @param {string} traceparent - a W3C traceparent header string - * @returns {Object} returns an Object with the traceparent data and validation info - */ - _validateAndParseTraceParentHeader(traceparent) { - const traceParentInfo = { - entryValid: false, - version: null, - traceId: null, - parentId: null, - flags: null - } - - if (!traceparent) { - return traceParentInfo - } - - const trimmed = traceparent.trim() - const parts = trimmed.split('-') - - // No extra data allowed this version. - if (parts[0] === W3C_TRACEPARENT_VERSION && parts.length !== 4) { - return traceParentInfo - } - - const [version, traceId, parentId, flags] = parts - const isValid = - VERSION_VALID_RGX.test(version) && - TRACEID_VALID_RGX.test(traceId) && - PARENTID_VALID_RGX.test(parentId) && - FLAGS_VALID_RGX.test(flags) - - if (isValid) { - traceParentInfo.entryValid = true - traceParentInfo.version = version - traceParentInfo.traceId = traceId - traceParentInfo.parentId = parentId - traceParentInfo.flags = flags - } - - return traceParentInfo - } - - // Not used now, but will be useful when traceparent has more flags - parseFlagsHex(flags) { - const flagsInt = parseInt(flags, 16) - return Object.keys(FLAGS).reduce((o, key) => { - o[key] = Boolean(flagsInt & FLAGS[key]) - return o - }, {}) - } - - createFlagsHex() { - const flagsNum = Object.keys(this.flags).reduce((num, key) => { - if (this.flags[key]) { - num += FLAGS[key] - } - return num - }, 0) - return flagsNum.toString(16).padStart(2, '0') - } - - /** - * @typedef TraceStateData - * @property {boolean} entryFound - Whether a New Relic tracestate string with a match - * trusted account key field is found - * @property {boolean} entryValid - Whether the matching NR tracestate string is valid - * @property {string} entryInvalidReason - Why the tracestate did not validate - * @property {Intrinsics} intrinsics - All the parts of the New Relic tracestate string - * parsed and split out into an object - * @property {string} newTraceState - The raw tracestate without the New Relic entry - * @property {array} vendors - All the vendor strings found in the tracestate - */ - - /** - * Accepts a W3C tracestate header string and returns an object with information about - * the validity and intrinsics of the parsed tracestate string - * - * @param {string} tracestate - A raw W3C tracestate header string - * @returns {TraceStateData} returns an object with validation information and - * instrinsics on any relevant New Relic tracestate strings found - */ - _validateAndParseTraceStateHeader(tracestate) { - let tsd = { - entryFound: false, - entryValid: undefined, - entryInvalidReason: undefined, - traceStateValid: undefined, - intrinsics: undefined, - newTraceState: undefined, - vendors: undefined - } - - // See if there's a New Relic Trace State - const trustedKey = this.transaction.agent.config.trusted_account_key - const hasTrustKey = Boolean(trustedKey) - const expectedNrKey = `${trustedKey}@nr` - - if (!hasTrustKey) { - logger.debug( - 'Unable to accept any New Relic tracestate list members. ' + - 'Missing trusted_account_key. ' + - 'This may occur if a trace is received prior to the agent fully starting.' - ) - - this.transaction.agent.recordSupportability('TraceContext/TraceState/Accept/Exception') - } - - let nrTraceStateValue = null - - const finalListMembers = [] - const vendors = [] - - const incomingListMembers = tracestate.split(',') - for (let i = 0; i < incomingListMembers.length; i++) { - const listMember = incomingListMembers[i].trim() - - // Multiple tracestate headers may get combined. Empty headers - // can result in a header such as tracestate: 'foo=1, ' which - // should still be considered valid with the empty item discarded. - if (listMember !== '') { - const listMemberParts = listMember.split('=') - if (listMemberParts.length !== 2) { - tsd.traceStateValid = false - logger.debug('Unable to parse tracestate list members.') - this.transaction.agent - .recordSupportability('TraceContext/TraceState/Parse/Exception/ListMember') - - return tsd - } - - const [vendorKey, vendorValue] = listMemberParts - if (hasTrustKey && (vendorKey === expectedNrKey)) { - // Matching members do not get added to vendors. - // We'll replace the first valid entry and drop the rest - // (which would be invalid members if they exist). - - // We only want the first one. - nrTraceStateValue = nrTraceStateValue || vendorValue - } else { - vendors.push(vendorKey) - - finalListMembers.push(listMember) - } - } - } - - tsd.traceStateValid = true - - // Rebuild potentially cleaned-up listmembers - tsd.newTraceState = finalListMembers.join(',') - - if (vendors.length > 0) { - tsd.vendors = vendors.join(',') - } - - if (!hasTrustKey) { - return tsd - } - - if (nrTraceStateValue) { - tsd.entryFound = true - - const intrinsicsValidation = this._validateAndParseIntrinsics(nrTraceStateValue) - if (intrinsicsValidation.entryValid) { - tsd.entryValid = true - tsd.intrinsics = intrinsicsValidation - } else { - tsd.entryInvalidReason = intrinsicsValidation.invalidReason - tsd.entryValid = false - } - } else { - // TraceParent has been accepted, but no trustedKey on tracestate - this.transaction.agent.recordSupportability('TraceContext/TraceState/NoNrEntry') - } - - return tsd - } - - /** - * @typedef Intrinsics - * @property {number} version - TraceContext spec version used - * @property {number} parentType - The type of component that produced this tracestate - * @property {string} accountId - * @property {string} appId - * @property {string} spanId - * @property {string} transactionId - * @property {integer} sampled - 1 or 0, whether the receiving agent should sample - * @property {number} priority - floating point of the priority the agent should use, - * rounded to 6 decimal places - * @property {number} timestamp - when the payload was created, milliseconds since epoch - * @property {boolean} entryValid - if all entries in the Intrinsics object is valid - */ - - /** - * Accepts a New Relic intrinsics string and returls a validation object w/ - * the validity and intrinsics of the tracestate - * - * @param {string} nrTracestateValue - The value part of a New Relic tracestate entry - * @returns {Intrinsics} returns an Intrinsics object with validation information and - * instrinsics on any relevant New Relic tracestate strings found - */ - _validateAndParseIntrinsics(nrTracestateValue) { - const intrinsics = this._parseIntrinsics(nrTracestateValue) - - // Functions that return true when the field is invalid - const isNull = v => v == null - const intrinsicInvalidations = { - version: isNaN, // required, int - parentType: isNull, // required, str - accountId: isNull, // required, str - appId: isNull, // required, str - sampled: v => v == null ? false : isNaN(v), // not required, int - priority: v => v == null ? false : isNaN(v), // not required, float - timestamp: isNaN // required, int - } - - - // If a field is found invalid, flag the entry as not valid - intrinsics.entryValid = true - for (const key of Object.keys(intrinsicInvalidations)) { - const invalidation = intrinsicInvalidations[key] - if (invalidation && invalidation(intrinsics[key])) { - intrinsics.entryValid = false - intrinsics.entryInvalidReason = `${key} failed invalidation test` - } - } - - // Convert to types expected by Transaction - if (intrinsics.sampled != null) { - intrinsics.sampled = Boolean(intrinsics.sampled) - } - - intrinsics.parentType = PARENT_TYPES[intrinsics.parentType] - if (!intrinsics.parentType) intrinsics.entryValid = false - - return intrinsics - } - - /** - * Parses intrinsics of a New Relic tracestate entry's value - */ - _parseIntrinsics(nrTracestateValue) { - const intrinsics = this._extractTraceStateIntrinsics(nrTracestateValue) - - const intrinsicConversions = { - version: parseInt, - parentType: parseInt, - - // these two can be null, don't try to parse a null - sampled: v => v == null ? v : parseInt(v, 10), - priority: v => v == null ? v : parseFloat(v), - - timestamp: parseInt, - } - - for (const key of Object.keys(intrinsicConversions)) { - const conversion = intrinsicConversions[key] - if (conversion) { - intrinsics[key] = conversion(intrinsics[key]) - } - } - - return intrinsics - } - - _extractTraceStateIntrinsics(nrTracestate) { - const splitValues = nrTracestate.split('-') - - // convert empty strings to null - splitValues.forEach((value, i) => { - if (value === '') splitValues[i] = null - }) - - const intrinsics = { - version: splitValues[0], - parentType: splitValues[1], - accountId: splitValues[2], - appId: splitValues[3], - spanId: splitValues[4], - transactionId: splitValues[5], - sampled: splitValues[6], - priority: splitValues[7], - timestamp: splitValues[8] - } - - return intrinsics - } -} - -module.exports.TraceContext = TraceContext -module.exports.TRACE_CONTEXT_PARENT_HEADER = TRACE_CONTEXT_PARENT_HEADER -module.exports.TRACE_CONTEXT_STATE_HEADER = TRACE_CONTEXT_STATE_HEADER diff --git a/node_modules/newrelic/lib/transaction/tracer/index.js b/node_modules/newrelic/lib/transaction/tracer/index.js deleted file mode 100644 index 1ef810d4..00000000 --- a/node_modules/newrelic/lib/transaction/tracer/index.js +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var Transaction = require('../index.js') -var logger = require('../../logger').child({component: 'tracer'}) - -/* - * CONSTANTS - */ -var ORIGINAL = '__NR_original' -var SEGMENT = '__NR_segment' - - -module.exports = Tracer - -function Tracer(agent) { - if (!agent) throw new Error("Must be initialized with an agent.") - - this.agent = agent - this._segment = null -} - -Tracer.prototype.getTransaction = getTransaction -Tracer.prototype.getSegment = getSegment -Tracer.prototype.getSpanContext = getSpanContext -Tracer.prototype.createSegment = createSegment -Tracer.prototype.addSegment = addSegment -Tracer.prototype.transactionProxy = transactionProxy -Tracer.prototype.transactionNestProxy = transactionNestProxy -Tracer.prototype.bindFunction = bindFunction -Tracer.prototype.bindEmitter = bindEmitter -Tracer.prototype.getOriginal = getOriginal -Tracer.prototype.getSegmentFromWrapped = getSegmentFromWrapped -Tracer.prototype.slice = argSlice -Tracer.prototype.wrapFunctionNoSegment = wrapFunctionNoSegment -Tracer.prototype.wrapFunctionFirstNoSegment = wrapFunctionFirstNoSegment -Tracer.prototype.wrapFunction = wrapFunction -Tracer.prototype.wrapFunctionLast = wrapFunctionLast -Tracer.prototype.wrapFunctionFirst = wrapFunctionFirst -Tracer.prototype.wrapSyncFunction = wrapSyncFunction -Tracer.prototype.wrapCallback = wrapCallback - -Object.defineProperty(Tracer.prototype, 'segment', { - get: function segmentGetter() { - return this._segment - }, - set: function segmentSetter(segment) { - this._segment && this._segment.probe('Segment removed from tracer') - segment && segment.probe('Set tracer.segment') - return this._segment = segment - } -}) - -function getTransaction() { - if (this.segment && this.segment.transaction && this.segment.transaction.isActive()) { - return this.segment.transaction - } - - return null -} - -function getSegment() { - return this.segment -} - -function getSpanContext() { - return this.segment && this.segment.getSpanContext() -} - -function createSegment(name, recorder, _parent) { - var parent = _parent || this.segment - if (!parent || !parent.transaction.isActive()) { - logger.trace({ - hasParent: !!parent, - transactionActive: (parent && parent.transaction.isActive()) - }, 'Not creating segment %s, no parent or active transaction available.', name) - return null - } - return parent.add(name, recorder) -} - -function addSegment(name, recorder, parent, full, task) { - if (typeof task !== 'function') { - throw new Error('task must be a function') - } - - var segment = this.createSegment(name, recorder, parent) - - return this.bindFunction(task, segment, full)(segment) -} - -function transactionProxy(handler) { - // if there's no handler, there's nothing to proxy. - if (typeof handler !== 'function') return handler - - var tracer = this - var wrapped = function wrapTransactionInvocation() { - if (!tracer.agent.canCollectData()) { - return handler.apply(this, arguments) - } - - // don't nest transactions, reuse existing ones - var segment = tracer.segment - if (segment) { - if (segment.transaction.traceStacks) { - segment.probe('!!! Nested transaction creation !!!') - segment.transaction.traceFlag = true // Will log the stacks when it ends. - } - logger.warn({ - transaction: {id: segment.transaction.id, name: segment.transaction.getName()}, - segment: segment.name - }, 'Active transaction when creating non-nested transaction') - tracer.agent.recordSupportability('Nodejs/Transactions/Nested') - return handler.apply(this, arguments) - } - var transaction = new Transaction(tracer.agent) - return tracer.bindFunction(handler, transaction.trace.root, true) - .apply(this, arguments) - } - - wrapped[ORIGINAL] = handler - - return wrapped -} - - -/** - * Use transactionNestProxy to wrap a closure that is a top-level handler that - * is meant to start transactions. This wraps the first half of asynchronous - * handlers. Use bindFunction to wrap handler callbacks. This detects to see - * if there is an in play segment and uses that as the root instead of - * transaction.trace.root. - * - * @param {Function} handler - Generator to be proxied. - * - * @return {Function} Proxy. - */ -function transactionNestProxy(type, handler) { - if (handler === undefined && typeof type === 'function') { - handler = type - type = undefined - } - // if there's no handler, there's nothing to proxy. - if (typeof handler !== 'function') return handler - - var tracer = this - var wrapped = function wrapTransactionInvocation() { - if (!tracer.agent.canCollectData()) { - return handler.apply(this, arguments) - } - - // don't nest transactions, reuse existing ones - var transaction = tracer.getTransaction() - var segment = tracer.segment - - var createNew = false - - if (!transaction || transaction.type !== type) { - createNew = true - } - - if (createNew) { - transaction = new Transaction(tracer.agent) - transaction.type = type - segment = transaction.trace.root - } - - return tracer.bindFunction(handler, segment).apply(this, arguments) - } - - wrapped[ORIGINAL] = handler - - return wrapped -} - -function bindFunction(handler, segment, full) { - if (typeof handler !== 'function') { - return handler - } - - return _makeWrapped(this, handler, segment || this.segment, !!full) -} -function _makeWrapped(tracer, handler, active, full) { - wrapped[ORIGINAL] = getOriginal(handler) - wrapped[SEGMENT] = active - - return wrapped - - function wrapped() { - var prev = tracer.segment - tracer.segment = active - if (active && full) active.start() - try { - return handler.apply(this, arguments) - } catch (err) { - logger.trace(err, "Error from wrapped function:") - - if (prev === null && process.domain != null) { - process.domain.__NR_transactionSegment = tracer.segment - } - - throw err // Re-throwing application error, this is not an agent error. - } finally { - if (active && full) active.touch() - tracer.segment = prev - } - } -} - -function getOriginal(fn) { - return fn && fn[ORIGINAL] ? fn[ORIGINAL] : fn -} - -function getSegmentFromWrapped(fn) { - return fn && fn[SEGMENT] ? fn[SEGMENT] : null -} - -function bindEmitter(emitter, segment) { - if (!emitter || !emitter.emit) { - return emitter - } - - var emit = getOriginal(emitter.emit) - emitter.emit = this.bindFunction(emit, segment) - - return emitter -} - -function argSlice(args) { - /** - * Usefully nerfed version of slice for use in instrumentation. Way faster - * than using [].slice.call, and maybe putting it in here (instead of the - * same module context where it will be used) will make it faster by - * defeating inlining. - * - * http://jsperf.com/array-slice-call-arguments-2 - * - * for untrustworthy benchmark numbers. Only useful for copying whole - * arrays, and really only meant to be used with the arguments array like. - * - * Also putting this comment inside the function in an effort to defeat - * inlining. - * - */ - var length = args.length - var array = new Array(length) - - for (var i = 0; i < length; i++) { - array[i] = args[i] - } - - return array -} - -function wrapFunctionNoSegment(original, name, wrapper) { - if (typeof original !== 'function') return original - - logger.trace('Wrapping function %s (no segment)', name || original.name || 'anonymous') - var tracer = this - - return wrappedFunction - - function wrappedFunction() { - if (!tracer.getTransaction()) return original.apply(this, arguments) - var args = tracer.slice(arguments) - - if (wrapper === undefined) { - var last = args.length - 1 - var cb = args[last] - if (typeof cb === 'function') { - args[last] = tracer.bindFunction(cb) - } - } else { - args = wrapper(args) - } - return original.apply(this, args) - } -} - -function wrapFunctionFirstNoSegment(original, name) { - if (typeof original !== 'function') return original - - logger.trace('Wrapping function %s (no segment)', name || original.name || 'anonymous') - var tracer = this - - return wrappedFunction - - function wrappedFunction() { - if (!tracer.getTransaction()) return original.apply(this, arguments) - var args = tracer.slice(arguments) - var cb = args[0] - if (typeof cb === 'function') { - args[0] = tracer.bindFunction(cb) - } - return original.apply(this, args) - } -} - -function wrapFunctionLast(name, recorder, original) { - if (typeof original !== 'function') { - logger.trace('Not wrapping "%s" because it was not a function', name) - return original - } - - logger.trace('Wrapping %s as a callback-last function', name) - var tracer = this - - return wrappedFunction - - function wrappedFunction() { - var transaction = tracer.getTransaction() - if (!transaction) { - logger.trace('Not creating segment "%s" because no transaction was active', name) - return original.apply(this, arguments) - } - - logger.trace('Creating "%s" segment for transaction %s.', name, transaction.id) - var args = tracer.slice(arguments) - var last = args.length - 1 - var cb = args[last] - if (typeof cb !== 'function') return original.apply(this, arguments) - var child = tracer.createSegment(name, recorder) - args[last] = tracer.wrapCallback(cb, child, wrappedCallback) - child.start() - return tracer.bindFunction(original, child).apply(this, args) - - function wrappedCallback() { - logger.trace('Ending "%s" segment for transaction %s.', name, transaction.id) - child.touch() - return cb.apply(this, arguments) - } - } -} - -function wrapFunctionFirst(name, recorder, original) { - if (typeof original !== 'function') { - logger.trace('Not wrapping "%s" because it was not a function', name) - return original - } - - logger.trace('Wrapping %s as a callback-first function', name) - var tracer = this - - return wrappedFunction - - function wrappedFunction() { - var transaction = tracer.getTransaction() - if (!transaction) { - logger.trace('Not creating segment "%s" because no transaction was active', name) - return original.apply(this, arguments) - } - - logger.trace('Creating "%s" segment for transaction %s.', name, transaction.id) - var args = tracer.slice(arguments) - var cb = args[0] - if (typeof cb !== 'function') return original.apply(this, arguments) - var child = tracer.createSegment(name, recorder) - args[0] = tracer.wrapCallback(cb, child, wrappedCallback) - child.start() - return tracer.bindFunction(original, child).apply(this, args) - - function wrappedCallback() { - logger.trace('Ending "%s" segment for transaction %s.', name, transaction.id) - child.touch() - var result = cb.apply(this, arguments) - return result - } - } -} - -function wrapFunction(name, recorder, original, wrapper, resp) { - if (typeof original !== 'function' || !wrapper) { - logger.trace('Not wrapping "%s" because it was not a function', name) - return original - } - - logger.trace('Wrapping %s using a custom wrapper', name) - - var tracer = this - - return wrappedFunction - - function wrappedFunction() { - var transaction = tracer.getTransaction() - if (!transaction) { - logger.trace('Not creating segment "%s" because no transaction was active', name) - return original.apply(this, arguments) - } - - logger.trace('Creating "%s" segment for transaction %s.', name, transaction.id) - - var child = tracer.createSegment(name, recorder) - var args = wrapper.call(this, child, tracer.slice(arguments), bind) - child.start() - var result = tracer.bindFunction(original, child).apply(this, args) - if (resp) result = resp.call(this, child, result, bind) - return result - - function bind(fn) { - if (!fn) return fn - return tracer.wrapCallback(fn, child, function nrWrappedHandler() { - logger.trace('Touching "%s" segment for transaction %s.', name, transaction.id) - child.touch() - return fn.apply(this, arguments) - }) - } - } -} - -function wrapSyncFunction(name, recorder, original) { - if (typeof original !== 'function') { - logger.trace('Not wrapping "%s" because it was not a function', name) - return original - } - - logger.trace('Wrapping "%s" as a synchronous function', name) - - var tracer = this - - return wrappedFunction - - function wrappedFunction() { - var transaction = tracer.getTransaction() - if (!transaction) { - logger.trace('Not creating segment "%s" because no transaction was active', name) - return original.apply(this, arguments) - } - logger.trace('Creating "%s" sync segment for transaction %s.', name, transaction.id) - var child = tracer.createSegment(name, recorder) - if (child) child.async = false - return tracer.bindFunction(original, child, true).apply(this, arguments) - } -} - -function wrapCallback(original, segment, wrapped) { - var tracer = this - - if (typeof original !== 'function') return original - - logger.trace( - 'Wrapping callback for "%s" segment', - segment ? segment.name : 'unknown' - ) - - return tracer.bindFunction(function wrappedCallback() { - if (wrapped) wrapped[ORIGINAL] = original - - var child = tracer.createSegment( - 'Callback: ' + (original.name || 'anonymous'), - null, - segment - ) - - if (child) child.async = false - - return tracer.bindFunction(wrapped || original, child, true).apply(this, arguments) - }, segment, false) -} diff --git a/node_modules/newrelic/lib/transaction/transaction-event-aggregator.js b/node_modules/newrelic/lib/transaction/transaction-event-aggregator.js deleted file mode 100644 index 6a11b6c8..00000000 --- a/node_modules/newrelic/lib/transaction/transaction-event-aggregator.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const async = require('async') -const logger = require('../logger').child({component: 'transaction-event-aggregator'}) -const EventAggregator = require('../aggregators/event-aggregator') - -const NAMES = require('../metrics/names') - -const SPLIT_THRESHOLD = 5000 - -class TransactionEventAggregator extends EventAggregator { - constructor(opts, collector, metrics) { - opts = opts || {} - opts.method = opts.method || 'analytic_event_data' - opts.metricNames = NAMES.EVENTS - - super(opts, collector, metrics) - - this.splitThreshold = opts.splitThreshold || SPLIT_THRESHOLD - } - - _toPayloadSync() { - // this is still used by traditional send when payloads not split - const events = this.events - - if (events.length === 0) { - logger.debug('No transaction events to send.') - return - } - - const metrics = { - reservoir_size: events.limit, - events_seen: events.seen - } - - const eventData = events.toArray() - - return [this.runId, metrics, eventData] - } - - send() { - if (this.events.length < this.splitThreshold) { - return super.send() - } - - // TODO: log? - this.emit(`starting ${this.method} data send.`) - - logger.debug('Splitting transaction events into multiple payloads') - - const data = this._getMergeData() - - this.clear() - - const eventPayloadPairs = this._splitData(data) - - this._sendMultiple(eventPayloadPairs, () => { - // TODO: Log? - this.emit(`finished ${this.method} data send.`) - }) - } - - _splitData(data) { - // TODO: update this to pull the priority off the event when DT is released - const events = data.getRawEvents() - const size = Math.floor(data.length / 2) - const limit = Math.floor(data.limit / 2) - const seen = Math.floor(data.seen / 2) - - const firstHalfRawEvents = events.splice(0, size) - const firstMetrics = { - reservoir_size: limit, - events_seen: seen - } - const firstHalfEventData = firstHalfRawEvents.map(this._rawEventsToValues) - const firstPayload = [this.runId, firstMetrics, firstHalfEventData] - - - const secondHalfRawEvents = events - const secondMetrics = { - reservoir_size: data.limit - limit, - events_seen: data.seen - seen - } - const secondHalfEventData = secondHalfRawEvents.map(this._rawEventsToValues) - const secondPayload = [this.runId, secondMetrics, secondHalfEventData] - - - const eventPayloadPairs = [ - { rawData: firstHalfRawEvents, payload: firstPayload }, - { rawData: secondHalfRawEvents, payload: secondPayload} - ] - - return eventPayloadPairs - } - - _rawEventsToValues(rawEvent) { - return rawEvent.value - } - - _sendMultiple(eventPayloadPairs, sendCallback) { - const self = this - - // Send payloads one at a time - async.eachOfSeries(eventPayloadPairs, (payloadPair, index, asyncCallback) => { - logger.debug( - 'Sending payload %d of %d to %s', - index + 1, - eventPayloadPairs.length, - self.method - ) - - self._sendSplitPayload(payloadPair.rawData, payloadPair.payload, (error) => { - if (error) { - logger.warn(error, 'An error occurred sending payload') - } - - logger.trace( - 'Finished sending payload %d of %d to %s', - index + 1, - eventPayloadPairs.length, - self.method - ) - - // don't pass on error, allow next payload to attempt to send - asyncCallback() - }) - }, function afterAllPayloadsSent() { - logger.debug( - 'Finished sending %d payloads to %s', - eventPayloadPairs.length, - self.method - ) - - sendCallback() - }) - } - - _sendSplitPayload(rawData, payload, callback) { - this.collector[this.method](payload, (error, response) => { - if (response && response.retainData) { - this._merge(rawData) - } - - callback(error) - }) - } -} - -module.exports = TransactionEventAggregator diff --git a/node_modules/newrelic/lib/uninstrumented.js b/node_modules/newrelic/lib/uninstrumented.js deleted file mode 100644 index ae9cac76..00000000 --- a/node_modules/newrelic/lib/uninstrumented.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var path = require('path') -var logger = require('./logger') -var NAMES = require('./metrics/names') -var properties = require('./util/properties') -const shimmer = require('./shimmer') - -// Static variable holding map of un-instrumented modules for use in the future -var uninstrumented = Object.create(null) - -// Log a helpful message about un-instrumented modules -function logUninstrumented() { - const modules = Object.keys(uninstrumented) - if (modules.length > 0) { - var message = - 'The newrelic module must be the first module required.\n' + - 'The following modules were required before newrelic and are not being ' + - 'instrumented:' - - modules.forEach(function buildMessage(module) { - message += '\n\t' + uninstrumented[module].name - + ': ' + uninstrumented[module].filename - }) - - logger.warn(message) - } -} - -// Create Supportability/Uninstrumented/ metrics -// -// @param metrics Agent metrics aggregator -function createMetrics(metrics) { - const modules = Object.keys(uninstrumented) - if (modules.length > 0) { - metrics.getOrCreateMetric(NAMES.SUPPORTABILITY.UNINSTRUMENTED).incrementCallCount() - } - - modules.forEach(function addMetrics(module) { - metrics.getOrCreateMetric( - NAMES.SUPPORTABILITY.UNINSTRUMENTED + '/' + uninstrumented[module].name - ).incrementCallCount() - }) -} - -// Check for any instrument-able modules that have already been loaded. This does -// not check core modules as we don't have access to the core module loader -// cache. But, users probably are missing instrumentation for other modules if -// they are missing instrumentation for core modules. -function check() { - const instrumentations = Object.keys(shimmer.registeredInstrumentations) - // Special case since we do some hackish stuff in lib/shimmer.js to make pg.js, - // and mysql2 work. - instrumentations.push('pg.js', 'mysql2') - - for (var filename in require.cache) { - if (!properties.hasOwn(require.cache, filename)) { - continue - } - - // only interested in whatever follows the last occurrence of node_modules - const paths = filename.split('node_modules' + path.sep) - const modulePath = paths[paths.length - 1] - - for (let i = 0; i < instrumentations.length; i++) { - const name = instrumentations[i] - if (modulePath.startsWith(name) && !uninstrumented[name]) { - uninstrumented[name] = { name, filename } - } - } - } - - logUninstrumented() -} - -module.exports = { check, createMetrics } diff --git a/node_modules/newrelic/lib/util/arity.js b/node_modules/newrelic/lib/util/arity.js deleted file mode 100644 index 04c8ff02..00000000 --- a/node_modules/newrelic/lib/util/arity.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var hasOwnProperty = require('./properties').hasOwn - -// Starting in what we believe to be Node v4 you can set the name and length of -// a function as properties. This is more ideal than wrapping a function. -exports.fixArity = fixArity - -function fixArity(original, wrapper) { - var toDefine = { - name: { value: original.name }, - length: { value: original.length } - } - - if (!hasOwnProperty(wrapper, '__NR_name')) { - toDefine.__NR_name = { - configurable: false, - enumerable: false, - writable: false, - value: wrapper.name - } - } - - Object.defineProperties(wrapper, toDefine) - - return wrapper -} diff --git a/node_modules/newrelic/lib/util/attribute-types.js b/node_modules/newrelic/lib/util/attribute-types.js deleted file mode 100644 index 4bf8582a..00000000 --- a/node_modules/newrelic/lib/util/attribute-types.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const VALID_ATTR_TYPES = new Set([ - 'string', - 'number', - 'boolean' -]) - -/** - * Checks incoming attribute value against valid types: - * string, number, & boolean. - * - * @param {*} val - * - * @return {boolean} - */ -function isValidType(val) { - return VALID_ATTR_TYPES.has(typeof val) -} - -module.exports = isValidType diff --git a/node_modules/newrelic/lib/util/byte-limit.js b/node_modules/newrelic/lib/util/byte-limit.js deleted file mode 100644 index ca076532..00000000 --- a/node_modules/newrelic/lib/util/byte-limit.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -/** - * Checks if a given string is within agent attribute limits. - * - * @param {string} str - Object key name or value - * @param {number} limit - String byte limit - */ -function isValidLength(str, limit) { - return Buffer.byteLength(str, 'utf8') <= limit -} - -/** - * Returns the relative position of the end of the string (in bytes) and the limit. - * >1 if the string is longer than the limit - * 0 if the string is at the limit - * <1 if the string is shorter than the limit - * - * @param {string} str - * @param {number} limit - String byte limit - */ -function compareLength(str, limit) { - return Buffer.byteLength(str) - limit -} - -/** - * Trims a string value to given byte limit, if necessary. - * - * @private - * - * @param {string} val - The value to truncate to given byte limit. - * @param {number} limit - The byte limit - * - * @return {string} The truncated value. - */ -function truncate(val, limit) { - // First truncation handles the simple case of only one-byte characters. - val = val.substring(0, limit) - if (isValidLength(val, limit)) { - return val - } - - - // Our limitation is on byte length, and the string could contain multi-byte - // characters. Doing a byte-substring could chop a character in half. Instead - // we do a binary search over the byte length of the substrings. - var substrLen = val.length - var delta = Math.ceil(substrLen / 2) - var cmpVal = compareLength(val.substring(0, substrLen), limit) - - // Continue the binary search till: - // 1) The string is the desired length (i.e. cmpVal = 0) OR - // 2) The desired string must split a character to acheive the desired byte length - // In this case, we should cut the character that would be split. - // (i.e. delta > 1 character OR the string is larger than the limit) - var substr - while (cmpVal && (cmpVal > 0 || delta > 1)) { - substrLen = cmpVal < 0 ? substrLen + delta : substrLen - delta - substr = val.substring(0, substrLen) - cmpVal = compareLength(substr, limit) - delta = Math.ceil(delta / 2) - } - - return substr -} - -module.exports.isValidLength = isValidLength -module.exports.compareLength = compareLength -module.exports.truncate = truncate diff --git a/node_modules/newrelic/lib/util/cat.js b/node_modules/newrelic/lib/util/cat.js deleted file mode 100644 index 018faf60..00000000 --- a/node_modules/newrelic/lib/util/cat.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var util = require('util') -var hashes = require('./hashes') -var logger = require('../logger').child({component: 'cat'}) - -module.exports.handleCatHeaders = handleCatHeaders -module.exports.parsedHeadersToTrans = parsedHeadersToTrans - -function handleCatHeaders(incomingCatId, obfTransaction, encKey, transaction) { - var parsedCatId = null - if (incomingCatId) { - parsedCatId = hashes.deobfuscateNameUsingKey( - incomingCatId, - encKey - ) - } - - var externalTrans = null - if (obfTransaction) { - try { - externalTrans = JSON.parse( - hashes.deobfuscateNameUsingKey(obfTransaction, encKey) - ) - } catch (e) { - logger.trace( - 'Got an unparsable CAT header x-newrelic-transaction: %s', - obfTransaction - ) - } - } - - parsedHeadersToTrans(parsedCatId, externalTrans, transaction) -} - -function parsedHeadersToTrans(parsedCatId, externalTrans, transaction) { - if (typeof parsedCatId === 'string') { - transaction.incomingCatId = parsedCatId - } - - if (util.isArray(externalTrans)) { - transaction.referringTransactionGuid = externalTrans[0] - if (typeof externalTrans[2] === 'string') { - transaction.tripId = externalTrans[2] - } else if (externalTrans[2]) { - transaction.invalidIncomingExternalTransaction = true - } - - if (_isValidReferringHash(externalTrans[3])) { - transaction.referringPathHash = externalTrans[3] - } else if (externalTrans[3]) { - transaction.invalidIncomingExternalTransaction = true - } - } -} - -function _isValidReferringHash(hash) { - return (typeof hash === 'string') -} diff --git a/node_modules/newrelic/lib/util/codec.js b/node_modules/newrelic/lib/util/codec.js deleted file mode 100644 index 3a0575a8..00000000 --- a/node_modules/newrelic/lib/util/codec.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var stringify = require('json-stringify-safe') -var zlib = require('zlib') - -module.exports = { - /** - * Take in an object literal, and deflate and then Base64 encode it. - * - * zlib works with streams, so this must be used asynchronously. - * - * @param {object} data - * The data to encode. - * - * @param {Function} callback - * The callback to take the results. The first parameter is any errors from - * encoding, and the second parameter is the encoded data object. - */ - encode: function encode(data, callback) { - try { - zlib.deflate(stringify(data), function cb_deflate(err, raw) { - if (err) return callback(err) - - return callback(null, raw.toString('base64')) - }) - } catch (err) { - return callback(err) - } - }, - - /** - * Base64 decode a string, decompress it, and then turn the results back into - * a JavaScript object. - * - * zlib works with streams, so this must be used asynchronously. - * - * @param {object} encoded - * The data to decode. - * - * @param {Function} callback - * The callback to take the results. The first parameter is any errors from - * decoding, and the second parameter is the decoded data object. - */ - decode: function decode(encoded, callback) { - zlib.inflate(Buffer.from(encoded, 'base64'), function cb_inflate(err, raw) { - if (err) return callback(err) - - let json - try { - json = JSON.parse(raw) - } catch (error) { - return callback(error) - } - - return callback(null, json) - }) - }, - - /** - * Take in an object literal, and deflate and then Base64 encode it. - * - * This is the synchronous version. - * - * @param {object} data - * The data to encode. - */ - encodeSync: function encodeSync(data) { - return zlib.deflateSync(stringify(data)).toString('base64') - }, - - /** - * Base64 decode a string, decompress it, and then turn the results back into - * a JavaScript object. - * - * This is the synchronous version. - * - * @param {object} encoded - * The data to decode. - */ - decodeSync: function decodeSync(encoded) { - return JSON.parse(zlib.inflateSync(Buffer.from(encoded, 'base64'))) - } -} diff --git a/node_modules/newrelic/lib/util/copy.js b/node_modules/newrelic/lib/util/copy.js deleted file mode 100644 index 18401b1d..00000000 --- a/node_modules/newrelic/lib/util/copy.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var hasOwnProperty = require('./properties').hasOwn - -exports.shallow = shallowCopy - -/** - * Performs a shallow copy of all properties on the source object. - * - * @param {object} source - The object to copy the properties from. - * @param {object} [dest={}] - The object to copy the properties to. - * - * @return {object} The destination object. - */ -function shallowCopy(source, dest) { - dest = dest || Object.create(null) - for (var k in source) { - if (hasOwnProperty(source, k)) { - dest[k] = source[k] - } - } - return dest -} diff --git a/node_modules/newrelic/lib/util/deep-equal.js b/node_modules/newrelic/lib/util/deep-equal.js deleted file mode 100644 index 7cfeb3ee..00000000 --- a/node_modules/newrelic/lib/util/deep-equal.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -function isArguments(object) { - return Object.prototype.toString.call(object) === '[object Arguments]' -} - -function slice(args) { - // Array.prototype.slice on arguments array-like is expensive - var l = args.length, a = [], i - for (i = 0; i < l; i++) { - a[i] = args[i] - } - return a -} - -/** - * This is a node-specific version of deepEquals, modeled on bits and pieces - * of loads of other implementations of this algorithm, most notably the - * one in the Node.js source and Underscore's. It doesn't throw and handles - * cycles. - * - * Everybody who writes one of these functions puts the documentation - * inline, which makes it incredibly hard to follow. Here's what this version - * of the algorithm does, in order: - * - * 1. === only tests objects and and functions by reference. Null is an object. - * Any pair of identical entities failing this test are therefore objects - * (including null), which need a recursive compare by attribute. - * 2. Since the only matching entities to get to this test must be objects, if - * a or b is not an object, they're clearly not the same. All unfiltered a - * and b getting are objects (including null). - * 3. null is an object, but null === null. All unfiltered a and b are non-null - * objects. - * 4. Buffers need to be special-cased because they live partially on the wrong - * side of the C++ / JavaScript barrier. Still, calling this on structures - * that can contain Buffers is a bad idea, because they can contain - * multiple megabytes of data and comparing them byte-by-byte is very - * expensive. buffertools is a better solution here, but this version of - * this code is dependency free. - * 5. It's much faster to compare dates by numeric value than by lexical value. - * 6. Same goes for Regexps. - * 7. The parts of an arguments list most people care about are the arguments - * themselves, not the callee, which you shouldn't be looking at anyway. - * 8. Objects are more complex: - * a. ensure that a and b are on the same constructor chain - * b. ensure that a and b have the same number of own properties (which is - * what Object.keys returns). - * c. ensure that cyclical references don't blow up the stack. - * d. ensure that all the key names match (faster) - * e. ensure that all of the associated values match, recursively (slower) - * - * (SOMEWHAT UNTESTED) ASSUMPTIONS: - * - * o Functions are only considered identical if they unify to the same - * reference. To anything else is to invite the wrath of the halting problem. - * o V8 is smart enough to optimize treating an Array like any other kind of - * object. - * o Users of this function are cool with mutually recursive data structures - * that are otherwise identical being treated as the same. - */ -function deeper(a, b, ca, cb) { - if (a === b) { - return true - } else if (typeof a !== 'object' || typeof b !== 'object') { - return false - } else if (a === null || b === null) { - return false - } else if (Buffer.isBuffer(a) && Buffer.isBuffer(b)) { - if (a.length !== b.length) return false - - // potentially incredibly expensive - for (var i = 0; i < a.length; i++) if (a[i] !== b[i]) return false - - return true - } else if (a instanceof Date && b instanceof Date) { - return a.getTime() === b.getTime() - } else if (a instanceof RegExp && b instanceof RegExp) { - return a.source === b.source && - a.global === b.global && - a.multiline === b.multiline && - a.lastIndex === b.lastIndex && - a.ignoreCase === b.ignoreCase - } else if (isArguments(a) || isArguments(b)) { - if (!(isArguments(a) && isArguments(b))) return false - - return deeper(slice(a), slice(b), ca, cb) - } - - if (a.constructor !== b.constructor) return false - - var ka = Object.keys(a), kb = Object.keys(b) - if (ka.length !== kb.length) return false - - var cal = ca.length - while (cal--) if (ca[cal] === a) return cb[cal] === b - ca.push(a); cb.push(b) - - ka.sort(); kb.sort() - for (var j = ka.length - 1; j >= 0; j--) if (ka[j] !== kb[j]) return false - - var key - for (var k = ka.length - 1; k >= 0; k--) { - key = ka[k] - if (!deeper(a[key], b[key], ca, cb)) return false - } - - ca.pop(); cb.pop() - - return true -} - -module.exports = function exports(a, b) { - return deeper(a, b, [], []) -} diff --git a/node_modules/newrelic/lib/util/flatten.js b/node_modules/newrelic/lib/util/flatten.js deleted file mode 100644 index 9cb4a6b2..00000000 --- a/node_modules/newrelic/lib/util/flatten.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -exports = module.exports = flatten -exports.keys = flatKeys - -/** - * Flatten nested maps of JSONifiable data. - * - * Ex: {a: 5, b: {c: true, d: 7}} -> {a: 5, 'b.c': true, 'b.d': 7} - * - * @private - * - * @param {object} result Object to place key-value pairs into, normally called with `{}`. - * @param {string} prefix Prefix for keys, normally called with `''`. - * @param {object} obj Object to be flattened. - * - * @return {object} Object with flattened key-value pairs - */ -function flatten(result, prefix, obj, seen) { - seen = seen || [] - seen.push(obj) - - for (var key in obj) { - if (seen.indexOf(obj[key]) > -1) { - continue - } - - if (obj[key] instanceof Object) flatten(result, prefix + key + '.', obj[key], seen) - else result[prefix + key] = obj[key] - } - - return result -} - -/** - * Retrieves all the keys that would exist in the flattened version of the object. - * - * @private - * - * @param {object} obj - The object to get the flat keys of. - * @param {string} prefix - A prefix for the keys, usually `''`. - * @param {bool} arrayIdx - Flag indicating if array indexes should be iterated. - * - * @return {array.} An array of keys names. - */ -function flatKeys(obj, prefix, arrayIdxs) { - var keys = [] - var seen = [] - recurse(prefix || '', obj) - return keys - - function recurse(p, o) { - seen.push(o) - - for (var key in o) { - if (seen.indexOf(o[key]) !== -1) { - continue - } - - if (o[key] instanceof Object && (arrayIdxs || !Array.isArray(o[key]))) { - recurse(p + key + '.', o[key]) - } else { - keys.push(p + key) - } - } - } -} diff --git a/node_modules/newrelic/lib/util/get.js b/node_modules/newrelic/lib/util/get.js deleted file mode 100644 index 2d194728..00000000 --- a/node_modules/newrelic/lib/util/get.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -// A simplified implementation of lodash.get -// see: https://www.npmjs.com/package/lodash.get -function get(obj, keys, defaultVal) { - keys = Array.isArray(keys) ? keys : keys.replace(/(\[(\d)\])/g, '.$2').split('.') - obj = obj[keys[0]] - - if (obj && keys.length > 1) { - return get(obj, keys.slice(1), defaultVal) - } - - return obj === undefined ? defaultVal : obj -} - -module.exports = get diff --git a/node_modules/newrelic/lib/util/hashes.js b/node_modules/newrelic/lib/util/hashes.js deleted file mode 100644 index 9e991559..00000000 --- a/node_modules/newrelic/lib/util/hashes.js +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -const crypto = require('crypto') - -function encode(bytes, keyBytes) { - for (var i = 0; i < bytes.length; i++) { - // This is really dense but happens commonly so I'm in-lining some of what - // could be tossed into variables. It takes the current byte of bytes, then - // XORs it with the current byte of the key (which uses modulo to make sure - // to not overrun the end.) - bytes.writeUInt8(bytes.readUInt8(i) ^ keyBytes.readUInt8(i % keyBytes.length), i) - } - return bytes -} - -function obfuscateNameUsingKey(name, key) { - var encodedBytes = Buffer.from(name, 'utf-8') - var keyBytes = Buffer.from(key) - return encode(encodedBytes, keyBytes).toString('base64') -} - -function deobfuscateNameUsingKey(name, key) { - var bytes = Buffer.from(name, 'base64') - var keyBytes = Buffer.from(key) - - return encode(bytes, keyBytes).toString("utf-8") -} - -function calculatePathHash(appName, pathName, referingPathHash) { - if (typeof referingPathHash === 'string') { - referingPathHash = parseInt(referingPathHash, 16) - } - var rotated = ((referingPathHash << 1) | (referingPathHash >>> 31)) >>> 0 - var hash = getHash(appName, pathName) - - var result = (rotated ^ hash) >>> 0 - - // This is a trick to pad it out to 8 chars regardless of length. - var retval = ('00000000' + result.toString(16)).substr(-8) - - return retval -} - -function getHash(appName, txName) { - var md5sum = crypto.createHash('md5') - md5sum.update(appName + ';' + txName, 'utf8') - var buf = md5sum.digest() - if (!(buf instanceof Buffer)) { - buf = Buffer.from(buf) - } - // pull the low 4 bytes in network byte order - return buf.slice(buf.length - 4, buf.length).readUInt32BE(0) -} - -const rand = Math.random - -const max32 = Math.pow(2, 32) - 1 -function randInt32() { - return Math.floor(rand() * max32) -} - -function int32ToByteArray(int32) { - // we want to represent the input as a 4-bytes array - let byteArray = new Uint8Array(4) - - for (let i = 0; i < byteArray.length; i++) { - let byte = int32 & 0xff - byteArray[i] = byte - int32 = (int32 - byte) / 256 - } - - return byteArray -} - -// Lookup table for converting byte values to hex -const byteToHex = [] -for (let i = 0; i < 256; ++i) { - byteToHex[i] = (i + 0x100).toString(16).substr(1) -} - -function makeId(length = 16) { - // length is number of hex characters, which multiplied by 4 is the number of - // bits, then divided by 8 is number of bytes. Or just divide by 2 - const numBytes = Math.ceil(length / 2) - let randBytes = new Uint8Array(numBytes) - - // Generate random bytes one 32-bit integer at a time - const numInts = Math.ceil(numBytes / 4) // 32 bit integers are 4 bytes - for (let i = 0; i < numInts; i++) { - const int = randInt32() - const bytes = int32ToByteArray(int) - for (let j = 0; j < 4; j++) { - // This could "overflow" since we're iterating over the number of ints, which could - // be more data than needed. But out-of-bound index assignment on typed arrays are - // discarded - randBytes[(i * 4) + j] = bytes[j] - } - } - - // Convert the byte array to a hex string - let id = '' - for (let i = 0; i < randBytes.length; i++) { - id += byteToHex[randBytes[i]] - } - - // For odd number lengths, we may get an extra character since byteToHex returns two - // characters, so trim to the desired length. - return id.substring(0, length) -} - -exports.obfuscateNameUsingKey = obfuscateNameUsingKey -exports.deobfuscateNameUsingKey = deobfuscateNameUsingKey -exports.calculatePathHash = calculatePathHash -exports.getHash = getHash -exports.makeId = makeId diff --git a/node_modules/newrelic/lib/util/label-parser.js b/node_modules/newrelic/lib/util/label-parser.js deleted file mode 100644 index 903a0c4b..00000000 --- a/node_modules/newrelic/lib/util/label-parser.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = parse -module.exports.fromString = fromString -module.exports.fromMap = fromMap - - -// this creates a copy of trim that can be used with map -var trim = Function.prototype.call.bind(String.prototype.trim) -var logger = require('../logger').child({component: 'label-parser'}) -var stringify = require('json-stringify-safe') - -function parse(labels) { - var results - - if (!labels) { - return [] - } else if (typeof labels === 'string') { - results = fromString(labels) - } else if (labels) { - results = fromMap(labels) - } - - results.warnings.forEach(function logWarnings(messaage) { - logger.warn(messaage) - }) - - return results.labels -} - -function fromString(raw) { - var map = Object.create(null) - - if (!raw) { - return {labels: [], warnings: []} - } - - var pairs = raw.split(';').map(trim) - var parts - - - while (!pairs[pairs.length - 1]) { - pairs.pop() - } - - while (!pairs[0]) { - pairs.shift() - } - - for (var i = 0, l = pairs.length; i < l; ++i) { - parts = pairs[i].split(':').map(trim) - - if (parts.length !== 2) { - return warn('Could not create a Label pair from ' + parts[i]) - } else if (!parts[0]) { - return warn('Label key can not be empty') - } else if (!parts[1]) { - return warn('Label value can not be empty') - } - - map[parts[0]] = parts[1] - } - - return fromMap(map) - - function warn(message) { - return {labels: [], warnings: [ - 'Invalid Label String: ' + raw, - message - ]} - } -} - -function fromMap(map) { - var warnings = [] - var labels = [] - - Object.keys(map).forEach(function processKeys(key) { - var type = truncate(key, 255) - - if (!map[key] || typeof map[key] !== 'string') { - return warnings.push( - 'Label value for ' + type + - 'should be a string with a length between 1 and 255 characters' - ) - } - - var value = truncate(map[key], 255) - - if (type !== key) { - warnings.push('Label key too long: ' + type) - } - - if (value !== map[key]) { - warnings.push('Label value too long: ' + value) - } - - labels.push({label_type: type, label_value: value}) - }) - - if (labels.length > 64) { - warnings.push('Too many Labels, list truncated to 64') - labels = labels.slice(0, 64) - } - - if (warnings.length) { - try { - warnings.unshift('Partially Invalid Label Setting: ' + stringify(map)) - } catch (err) { - logger.debug(err, 'Failed to stringify labels') - } - } - - return {labels: labels, warnings: warnings} -} - -function truncate(str, max) { - var len = 0 - var chr - for (var i = 0, l = str.length; i < l; ++i) { - chr = str.charCodeAt(i) - if (chr >= 0xD800 && chr <= 0xDBFF && i !== l) { - i += 1 - } - - if (++len === max) { - break - } - } - - return str.slice(0, i + 1) -} diff --git a/node_modules/newrelic/lib/util/logger.js b/node_modules/newrelic/lib/util/logger.js deleted file mode 100644 index 90c80087..00000000 --- a/node_modules/newrelic/lib/util/logger.js +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var stringify = require('json-stringify-safe') -var util = require('util') -var Readable = require('readable-stream') -var os = require('os') - -module.exports = Logger - -const LEVELS = { - trace: 10, - debug: 20, - info: 30, - warn: 40, - error: 50, - fatal: 60 -} - -// The maximum string length in V8 was somewhere around 256M characters for a -// long time. Note that is characters, not bytes. This limit was upped to around -// 1G characters sometime during Node 8's lifetime (before 8.3.0 I believe). -// Using 128M characters as limit to keep the logger well away from the limit -// and not balloon host machine's memory. -const MAX_LOG_BUFFER = 1024 * 1024 * 128 // 128M characters - -util.inherits(Logger, Readable) - -function Logger(options, extra) { - if (!(this instanceof Logger)) { - return new Logger(options, extra) - } - - Readable.call(this) - var passedInLevel = this.coerce(options.level) - this.options = { - _level: passedInLevel, - enabled: options.enabled === undefined ? true : options.enabled - } - this._nestedLog = false - this.name = options.name - this.hostname = options.hostname || os.hostname() - this.extra = extra || Object.create(null) - this.buffer = '' - this.reading = false - if (options.stream) { - this.pipe(options.stream) - } -} -Logger.MAX_LOG_BUFFER = MAX_LOG_BUFFER - -Logger.prototype.coerce = function coerce(value) { - if (!isNaN(parseInt(value, 10)) && isFinite(value)) { - // value is numeric - if (value < 10) value = 10 - if (value > 60) value = 60 - - return value - } - return LEVELS[value] || 50 -} - -var loggingFunctions = Object.create(null) - -Object.keys(LEVELS).forEach(function buildLevel(_level) { - var level = Logger.prototype.coerce(LEVELS[_level]) - - function log(extra) { - if (!this.options.enabled) return false - if (level < this.options._level) return false - - var has_extra = typeof extra === 'object' - var args = Array.prototype.slice.call(arguments, has_extra ? 1 : 0) - return this.write(level, args, has_extra ? extra : null) - } - - loggingFunctions[_level] = function checkLevel() { - log.apply(this, arguments) - } - - var seenMessages = Object.create(null) - loggingFunctions[_level + 'Once'] = function logOnce(key) { - if (typeof key !== 'string') { - this.debug('Attempted to key on a non-string in ' + _level + 'Once: ' + key) - return - } - - if (!this.options.enabled) return false - if (level < this.options._level) return false - - if (seenMessages[key] !== true) { - var args = Array.prototype.slice.call(arguments, 1) - var writeSuccessful = log.apply(this, args) - - if (writeSuccessful) { - seenMessages[key] = true - } - } - } - - var seenPerInterval = Object.create(null) - loggingFunctions[_level + 'OncePer'] = function logOncePer(key, interval) { - if (typeof key !== 'string') { - this.debug('Attempted to key on a non-string in ' + _level + 'Once: ' + key) - return - } - - if (!this.options.enabled) return false - if (level < this.options._level) return false - - if (seenPerInterval[key] !== true) { - var args = Array.prototype.slice.call(arguments, 2) - var writeSuccessful = log.apply(this, args) - - if (writeSuccessful) { - seenPerInterval[key] = true - - var clearSeen = setTimeout(function clearKey() { - delete seenPerInterval[key] - }, interval) - - clearSeen.unref() - } - } - } - - loggingFunctions[_level + 'Enabled'] = function levelEnabled() { - return level >= this.options._level - } -}) - -Object.assign(Logger.prototype, loggingFunctions) - -Logger.prototype.child = function child(extra) { - var childLogger = Object.create(loggingFunctions) - - childLogger.extra = Object.assign(Object.create(null), this.extra, extra) - - var parent = this - childLogger.options = parent.options - - childLogger.write = function write(level, args, _extra) { - _extra = getPropertiesToLog(_extra) - _extra = Object.assign(Object.create(null), this.extra, _extra) - - return parent.write(level, args, _extra) - } - - childLogger.setEnabled = Logger.prototype.setEnabled - childLogger.child = Logger.prototype.child - - return childLogger -} - -Logger.prototype.level = function level(lvl) { - this.options._level = this.coerce(lvl) -} - -Logger.prototype.setEnabled = function setEnabled(enabled) { - if (typeof enabled === 'boolean') { - this.options.enabled = enabled - } -} - -Logger.prototype._read = function _read() { - if (this.buffer.length !== 0) { - this.reading = this.push(this.buffer) - this.buffer = '' - } else { - this.reading = true - } -} - -/** - * For performance reasons we do not support %j because we will have - * already converted the objects to strings. - * Returns a boolean representing the status of the write - * (success/failure) - */ -Logger.prototype.write = function write(level, args, extra) { - if (this._nestedLog) { - // This log is downstream of another log call and should be ignored - return - } - this._nestedLog = true - for (var i = 0, l = args.length; i < l; ++i) { - if (typeof args[i] === 'function') { - args[i] = args[i].valueOf() - } else if (typeof args[i] === 'object') { - try { - args[i] = stringify(args[i]) - } catch (err) { // eslint-disable-line no-unused-vars - this.debug('Failed to stringfy object for log') - args[i] = '[UNPARSABLE OBJECT]' - } - } - } - - var entry = new Entry(this, level, util.format.apply(util, args)) - - Object.assign(entry, this.extra, getPropertiesToLog(extra)) - - var data = '' - try { - data = stringify(entry) + '\n' - } catch (err) { // eslint-disable-line no-unused-vars - this.debug('Unabled to stringify log message') - } - - if (this.reading) { - this.reading = this.push(data) - } else if (this.buffer.length + data.length < MAX_LOG_BUFFER) { - this.buffer += data - } else if (process.emitWarning) { - process.emitWarning( - 'Dropping log message, buffer would overflow.', - 'NewRelicWarning', - 'NRWARN001' - ) - } - this._nestedLog = false - return true -} - -function Entry(logger, level, msg) { - this.v = 0 - this.level = level - this.name = logger.name - this.hostname = logger.hostname - this.pid = process.pid - this.time = new Date().toISOString() - this.msg = msg -} - -function getPropertiesToLog(extra) { - var obj = Object.assign(Object.create(null), extra) - // Error properties (message, stack) are not enumerable, so getting them directly - if (extra instanceof Error) { - var names = Object.getOwnPropertyNames(extra) - if (names) { - for (var i = 0; i < names.length; i++) { - obj[names[i]] = extra[names[i]] - } - } - } - return obj -} diff --git a/node_modules/newrelic/lib/util/process-version.js b/node_modules/newrelic/lib/util/process-version.js deleted file mode 100644 index be942bd1..00000000 --- a/node_modules/newrelic/lib/util/process-version.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var semver = require('semver') - -// The logger needs to be lazy-loaded to get around ordering issues with config. -var logger = null - -exports.satisfies = satisfies -exports.prerelease = prerelease - -/** - * Safely checks if the process version satisfies the given semver range. - * - * @param {string} check - The semantic version range to check. - * - * @return {bool} True if the process version satisfies the given version, false - * otherwise. - */ -function satisfies(check) { - try { - return semver.satisfies(process.version, check) - } catch (e) { - _logWarn(e, 'Bad process version for satisfies check.') - return false - } -} - -/** - * Safely checks if the process version is a pre-release version. - * - * @return {bool} True if the process version is pre-release, false otherwise. - */ -function prerelease() { - try { - return semver.prerelease(process.version) - } catch (e) { - _logWarn(e, 'Bad process version for prelease check.') - return false - } -} - -function _logWarn() { - if (!logger) { - logger = require('../logger').child({component: 'util-process-version'}) - } - logger.warn.apply(logger, arguments) -} diff --git a/node_modules/newrelic/lib/util/properties.js b/node_modules/newrelic/lib/util/properties.js deleted file mode 100644 index ad904725..00000000 --- a/node_modules/newrelic/lib/util/properties.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var hasOwnProperty = Object.hasOwnProperty - -// The logger needs to be lazy-loaded to get around ordering issues with config. -var _logger = null -var getLogger = function makeLogger() { - _logger = require('../logger').child({component: 'util-properties'}) - getLogger = function reallyGetLogger() { - return _logger - } - return _logger -} - -/** - * Checks if an object has its own property with the given key. - * - * It is possible to create objects which do not inherit from `Object` by doing - * `Object.create(null)`. These objects do not have the `hasOwnProperty` method. - * This method uses a cached version of `hasOwnProperty` to check for the - * property, thus avoiding the potential `undefined is not a function` error. - * - * @private - * - * @param {*} obj - The item to check for the property on. - * @param {string} key - The name of the property to look for. - * - * @return {bool} True if the given object has its own property with the given - * key. - */ -exports.hasOwn = function hasOwn(obj, key) { - return hasOwnProperty.call(obj, key) -} - -/** - * Checks if a given object is empty. - * - * @param {*} obj - The object to check for properties on. - * - * @return {bool} True if the object has no keys of its own. - */ -exports.isEmpty = function isEmpty(obj) { - // Use this case for null prototyped objects. - for (var key in obj) { - if (exports.hasOwn(obj, key)) { - return false - } - } - return true -} - -/** - * Sets a non-enumerable property on an object with the given value. - * - * XXX: This process is very slow, so use only when necessary. Check the - * configuration `transaction_tracer.hide_internals` before calling this. - * - * @private - * - * @param {*} obj - The item to add the hidden property to. - * @param {string} name - The name of the property to add. - * @param {*} val - The value to set the property to. - * - * @return {*} The `obj` argument. - */ -exports.setInternal = function setInternalProperty(obj, name, val) { - if (!obj || !name) { - getLogger().debug('Not setting property; object or name is missing.') - return obj - } - - try { - if (!exports.hasOwn(obj, name)) { - Object.defineProperty(obj, name, { - enumerable: false, - writable: true, - value: val - }) - } else { - obj[name] = val - } - } catch (err) { - getLogger().debug(err, 'Failed to set property "%s" to %j', name, val) - } - return obj -} diff --git a/node_modules/newrelic/lib/util/sql/obfuscate.js b/node_modules/newrelic/lib/util/sql/obfuscate.js deleted file mode 100644 index 984172f0..00000000 --- a/node_modules/newrelic/lib/util/sql/obfuscate.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -module.exports = obfuscate - -var singleQuote = /'(?:''|[^'])*?(?:\\'.*|'(?!'))/ -var doubleQuote = /"(?:[^"]|"")*?(?:\\".*|"(?!"))/ -var dollarQuote = /(\$(?!\d)[^$]*?\$).*?(?:\1|$)/ -var oracleQuote = /q'\[.*?(?:\]'|$)|q'\{.*?(?:\}'|$)|q'\<.*?(?:\>'|$)|q'\(.*?(?:\)'|$)/ -var comment = /(?:#|--).*?(?=\r|\n|$)/ -var multilineComment = /\/\*(?:[^/]|\/[^*])*?(?:\*\/|\/\*.*)/ -var uuid = /\{?(?:[0-9a-f]\-*){32}\}?/ -var hex = /0x[0-9a-f]+/ -var boolean = /true|false|null/ -var number = /\b-?(?:[0-9]+\.)?[0-9]+([eE][+-]?[0-9]+)?/ - -var dialects = obfuscate.dialects = Object.create(null) - -dialects.mysql = [ - replacer(join( - [doubleQuote, singleQuote, comment, multilineComment, hex, boolean, number], - 'gi' - )), - unmatchedPairs(/'|"|\/\*|\*\//) -] - -dialects.postgres = [ - replacer(join( - [dollarQuote, singleQuote, comment, multilineComment, uuid, boolean, number], - 'gi' - )), - unmatchedPairs(/'|\/\*|\*\/|(?:\$(?!\?))/) -] - -dialects.cassandra = [ - replacer(join( - [singleQuote, comment, multilineComment, uuid, hex, boolean, number], - 'gi' - )), - unmatchedPairs(/'|\/\*|\*\//) -] - -dialects.oracle = [ - replacer(join( - [oracleQuote, singleQuote, comment, multilineComment, number], - 'gi' - )), - unmatchedPairs(/'|\/\*|\*\//) -] - -dialects.default = dialects.mysql - -function obfuscate(raw, dialect) { - var replacers = dialects[dialect] - if (!replacers) { - replacers = dialects.default - } - - var obfuscated = raw - for (var i = 0, l = replacers.length; i < l; ++i) { - obfuscated = replacers[i](obfuscated) - } - - return obfuscated -} - -function join(expressions, flags) { - return new RegExp(expressions.map(toPart).join('|'), flags) -} - -function toPart(expressions) { - return expressions.toString().slice(1, -1) -} - -function replacer(regex) { - function replace(sql) { - return sql.replace(regex, '?') - } - replace.regex = regex - - return replace -} - -function unmatchedPairs(regex) { - function check(sql) { - return regex.test(sql) ? '?' : sql - } - check.regex = regex - - return check -} diff --git a/node_modules/newrelic/lib/util/stream-sink.js b/node_modules/newrelic/lib/util/stream-sink.js deleted file mode 100644 index 86beecd3..00000000 --- a/node_modules/newrelic/lib/util/stream-sink.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var EventEmitter = require('events').EventEmitter -var util = require('util') - - -/** - * Pipe a readable stream into this sink that fulfills the Writable Stream - * contract and the callback will be fired when the stream has been completely - * read. - */ -function StreamSink(callback) { - EventEmitter.call(this) - - this.callback = callback - this.sink = '' - this.writable = true - - var sink = this - this.on('error', function handle_error(error) { - sink.writable = false - callback(error) - }) -} -util.inherits(StreamSink, EventEmitter) - -StreamSink.prototype.write = function write(string) { - if (!this.writable) { - this.emit('error', new Error("Sink no longer writable!")) - return false - } - - // Explicitly copy buffer contents so we are sure to release references to - // the TLS slab buffer region. - this.sink += string.toString() - - return true -} - -StreamSink.prototype.end = function end() { - this.writable = false - - this.callback(null, this.sink) -} - -StreamSink.prototype.destroy = function destroy() { - this.emit('close') - this.writable = false - - delete this.sink -} - -module.exports = StreamSink diff --git a/node_modules/newrelic/lib/util/unwrapped-core.js b/node_modules/newrelic/lib/util/unwrapped-core.js deleted file mode 100644 index fc001e81..00000000 --- a/node_modules/newrelic/lib/util/unwrapped-core.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var copy = require('./copy') -var fs = require('fs') - -exports.fs = copy.shallow(fs) diff --git a/node_modules/newrelic/lib/util/urltils.js b/node_modules/newrelic/lib/util/urltils.js deleted file mode 100644 index 8c3466c0..00000000 --- a/node_modules/newrelic/lib/util/urltils.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var url = require('url') - -var LOCALHOST_NAMES = { - "localhost": true, - "127.0.0.1": true, - "0.0.0.0": true, - "0:0:0:0:0:0:0:1": true, - "::1": true, - "0:0:0:0:0:0:0:0": true, - "::": true -} - -/** - * Utility functions for enforcing New Relic naming conditions on URLs, - * and extracting and setting parameters on traces / web trace segments. - */ -module.exports = { - /** - * Dictionary whose keys are all synonyms for localhost. - * - * @const - */ - LOCALHOST_NAMES: LOCALHOST_NAMES, - - /** - * Checks if the given name is in the dictionary of localhost names. - * - * @param {string} host - The hostname to lookup. - * - * @return {bool} - True if the given hostname is a synonym for localhost. - */ - isLocalhost: function isLocahost(host) { - return LOCALHOST_NAMES[host] != null - }, - - /** - * This was handed down from the prototype as the canonical list of status - * codes that short-circuit naming and normalization. The agent can be - * configured to mark HTTP status codes as not being errors. - * - * @param {Config} config The configuration containing the error list. - * @param {string} code The HTTP status code to check. - * - * @returns {bool} Whether the status code should be ignored. - */ - isError: function isError(config, code) { - return code >= 400 && !isIgnoredStatusCodeForErrors(config, code) - }, - - /** - * Returns true if the status code is an HTTP error, and it is configured to be ignored. - * - * @param {Config} config The configuration containing the error list. - * @param {string} code The HTTP status code to check. - * - * @returns {bool} Whether the status code should be ignored. - */ - isIgnoredError: function isIgnoredError(config, code) { - return code >= 400 && isIgnoredStatusCodeForErrors(config, code) - }, - - /** - * Returns true if the status code is configured to be expected - * - * @param {Config} config The configuration containing the error list. - * @param {string} code The HTTP status code to check. - * - * @returns {bool} Whether the status code is expected. - * - */ - isExpectedError: function isExpectedError(config, code) { - return isExpectedStatusCodeForErrors(config, code) - }, - - /** - * Get back the pieces of the URL that New Relic cares about. Apply these - * restrictions, in order: - * - * 1. Ensure that after parsing the URL, there's at least '/' - * 2. Strip off session trackers after ';' (a New Relic convention) - * 3. Remove trailing slash. - * - * @param {string} requestURL The URL fragment to be scrubbed. - * @return {string} The cleaned URL. - */ - scrub: function scrub(requestURL) { - if (typeof requestURL === 'string') { - requestURL = url.parse(requestURL) - } - - var path = requestURL.pathname - - if (path) { - path = path.split(';')[0] - - if (path !== '/' && path.charAt(path.length - 1) === '/') { - path = path.substring(0, path.length - 1) - } - } else { - path = '/' - } - - return path - }, - - /** - * Extract query parameters, dealing with bare parameters and parameters with - * no value as appropriate: - * - * 'var1&var2=value' is not necessarily the same as 'var1=&var2=value' - * - * In my world, one is an assertion of presence, and the other is an empty - * variable. Some web frameworks behave this way as well, so don't lose - * information. - * - * @param {string} requestURL The URL to be parsed. - * @returns {object} The parameters parsed from the request - */ - parseParameters: function parseParameters(requestURL) { - var parsed = requestURL - - if (typeof requestURL === 'string') { - parsed = url.parse(requestURL, true) - } - - var parameters = Object.create(null) - - if (parsed.query) { - var keys = Object.keys(parsed.query) - - for (var i = 0, l = keys.length; i < l; ++i) { - var key = keys[i] - if (parsed.query[key] === '' && parsed.path.indexOf(key + '=') === -1) { - parameters[key] = true - } else { - parameters[key] = parsed.query[key] - } - } - } - - return parameters - }, - - /** - * Performs the logic of `urltils.scrub` and `urltils.parseParameters` with - * only a single parse of the given URL. - * - * @param {string} requestURL - The URL to scrub and extra parameters from. - * - * @return {object} An object containing the scrubbed url at `.path` and the - * parsed parameters at `.parameters`. - */ - scrubAndParseParameters: function scrubAndParseParameters(requestURL) { - if (typeof requestURL === 'string') { - requestURL = url.parse(requestURL, true) - } - return { - protocol: requestURL.protocol, - path: this.scrub(requestURL), - parameters: this.parseParameters(requestURL) - } - }, - - /** - * Copy a set of request parameters from one object to another, - * but do not overwrite any existing parameters in destination, - * including parameters set to null or undefined. - * - * @param {object} source Parameters to be copied (not changed). - * @param {object} destination Dictionary to which parameters are copied - * (mutated in place). - */ - copyParameters: function copyParameters(source, destination) { - if (source && destination) { - var keys = Object.keys(source) - for (var i = 0; i < keys.length; i++) { - var key = keys[i] - if (!(key in destination)) { - destination[key] = source[key] - } - } - } - }, - - /** - * Copy a set of request parameters from one object to another. - * Existing attributes on the `destination` will be overwritten. - * - * @param {object} source Parameters to be copied (not changed). - * @param {object} destination Dictionary to which parameters are copied - * (mutated in place). - */ - overwriteParameters: function overwriteParameters(source, destination) { - var keys = Object.keys(source) - for (var i = 0; i < keys.length; i++) { - var key = keys[i] - destination[key] = source[key] - } - } -} - -function isIgnoredStatusCodeForErrors(config, code) { - var codes = [] - if (config && - config.error_collector && - config.error_collector.ignore_status_codes) { - codes = config.error_collector.ignore_status_codes - } - return codes.indexOf(parseInt(code, 10)) >= 0 -} - -function isExpectedStatusCodeForErrors(config, code) { - var codes = [] - if (config && - config.error_collector && - config.error_collector.expected_status_codes) { - codes = config.error_collector.expected_status_codes - } - return codes.indexOf(parseInt(code, 10)) >= 0 -} diff --git a/node_modules/newrelic/lib/utilization/aws-info.js b/node_modules/newrelic/lib/utilization/aws-info.js deleted file mode 100644 index 574fc586..00000000 --- a/node_modules/newrelic/lib/utilization/aws-info.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger.js').child({component: 'aws-info'}) -var common = require('./common') -var NAMES = require('../metrics/names.js') - -module.exports = fetchAWSInfo -module.exports.clearCache = function clearAWSCache() { - results = null -} - -var results = null - -function fetchAWSInfo(agent, callback) { - if (!agent.config.utilization || !agent.config.utilization.detect_aws) { - return setImmediate(callback, null) - } - - if (results) { - return setImmediate(callback, null, results) - } - - var instanceHost = '169.254.169.254' - var apiVersion = '2016-09-02' - var endpoint = 'dynamic/instance-identity/document' - var url = 'http://' + instanceHost + '/' + apiVersion + '/' + endpoint - common.request(url, agent, function getMetadata(err, data) { - if (err) { - return callback(err) - } - - try { - data = JSON.parse(data) - } catch (e) { - logger.debug(e, 'Failed to parse AWS metadata.') - data = null - } - - results = common.getKeys(data, ['availabilityZone', 'instanceId', 'instanceType']) - if (results == null) { - logger.debug('AWS metadata was invalid.') - agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.AWS_ERROR).incrementCallCount() - } - callback(null, results) - }) -} diff --git a/node_modules/newrelic/lib/utilization/azure-info.js b/node_modules/newrelic/lib/utilization/azure-info.js deleted file mode 100644 index 34e8cc93..00000000 --- a/node_modules/newrelic/lib/utilization/azure-info.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var common = require('./common') -var logger = require('../logger.js').child({component: 'azure-info'}) -var NAMES = require('../metrics/names.js') - - -module.exports = fetchAzureInfo -module.exports.clearCache = function clearAzureCache() { - results = null -} - -var results = null - -function fetchAzureInfo(agent, callback) { - if (!agent.config.utilization || !agent.config.utilization.detect_azure) { - return setImmediate(callback, null, null) - } - - if (results) { - return setImmediate(callback, null, results) - } - - var instanceHost = '169.254.169.254' - var apiVersion = '2017-03-01' - var endpoint = '/metadata/instance/compute' - common.request({ - host: instanceHost, - path: endpoint + '?api-version=' + apiVersion, - headers: {Metadata: 'true'} - }, agent, function getMetadata(err, data) { - if (err) { - return callback(err) - } - - // Hopefully the data is parsable as JSON. - try { - data = JSON.parse(data) - } catch (e) { - logger.debug(e, 'Failed to parse Azure metadata.') - data = null - } - - // Get out just the keys we care about. - results = common.getKeys(data, ['location', 'name', 'vmId', 'vmSize']) - if (results == null) { - logger.debug('Azure metadata was invalid.') - agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.AZURE_ERROR).incrementCallCount() - } - - // Call back! - callback(null, results) - }) -} diff --git a/node_modules/newrelic/lib/utilization/common.js b/node_modules/newrelic/lib/utilization/common.js deleted file mode 100644 index 194b2120..00000000 --- a/node_modules/newrelic/lib/utilization/common.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var concat = require('concat-stream') -var http = require('http') -var logger = require('../logger').child({component: 'utilization-request'}) -var fs = require('../util/unwrapped-core').fs -var properties = require('../util/properties') -const url = require('url') - - -exports.checkValueString = checkValueString -function checkValueString(str) { - if (!str || !str.length || Buffer.byteLength(str) > 255) { - return false - } - - var len = str.length - var validCharacters = /[0-9a-zA-Z_ ./-]/ - for (var i = 0; i < len; ++i) { - if (str.charCodeAt(i) < 128 && !validCharacters.test(str[i])) { - return false - } - } - return true -} - -exports.getKeys = function getKeys(data, keys) { - if (!data) { - return null - } - - var results = Object.create(null) - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - if (!properties.hasOwn(data, key) || !data[key]) { - logger.debug('Key %s missing from metadata', key) - return null - } - var value = data[key] - if (typeof value === 'number') { - value = value.toString() - } - - // If any value is invalid, the whole thing must be trashed. - if (!checkValueString(value)) { - logger.debug('Invalid metadata value found: %s -> %s', key, value) - return null - } - results[key] = value - } - - return results -} - -exports.request = function request(opts, agent, cb) { - // Add default timeout of a second to the request - - if (typeof opts === 'string') { - opts = url.parse(opts) - } - - opts.timeout = opts.timeout || 1000 - - var req = http.get(opts, function awsRequest(res) { - res.pipe(concat(respond)) - function respond(data) { - agent.removeListener('errored', abortRequest) - agent.removeListener('stopped', abortRequest) - agent.removeListener('disconnected', abortRequest) - - if (res.statusCode !== 200) { - logger.debug( - 'Got %d %s from metadata request %j', - res.statusCode, res.statusMessage || '', opts - ) - return cb(new Error('Request for metadata failed.')) - } else if (!data) { - logger.debug('Got no response data?') - return cb(new Error('No reponse data received.')) - } - - cb(null, data.toString('utf8')) - } - }) - - req.setTimeout(1000, function requestTimeout() { - req.abort() - }) - - req.on('error', function requestError(err) { - if (err.code === 'ECONNRESET') { - logger.debug('Request for metadata %j timed out', opts) - return cb(err) - } - - logger.debug('Message for metadata %j: %s', opts, err.message) - cb(err) - }) - agent.once('errored', abortRequest) - agent.once('stopped', abortRequest) - agent.once('disconnected', abortRequest) - - function abortRequest() { - logger.debug('Aborting request for metadata at %j', opts) - req.abort() - agent.removeListener('errored', abortRequest) - agent.removeListener('stopped', abortRequest) - agent.removeListener('disconnected', abortRequest) - } -} - -exports.readProc = readProc -function readProc(path, callback) { - fs.readFile(path, function readProcFile(err, data) { - if (err) { - logger.error(err, 'Error when trying to read %s', path) - callback(err, null) - } else { - callback(null, data.toString()) - } - }) -} diff --git a/node_modules/newrelic/lib/utilization/docker-info.js b/node_modules/newrelic/lib/utilization/docker-info.js deleted file mode 100644 index c33cafea..00000000 --- a/node_modules/newrelic/lib/utilization/docker-info.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger').child({component: 'docker-info'}) -var common = require('./common') -var NAMES = require('../metrics/names') -var os = require('os') - -module.exports.getVendorInfo = fetchDockerVendorInfo -module.exports.clearVendorCache = function clearDockerVendorCache() { - vendorInfo = null -} - -module.exports.getBootId = function getBootId(agent, callback) { - if (!/linux/i.test(os.platform())) { - logger.debug('Platform is not a flavor of linux, omitting boot info') - return setImmediate(callback, null, null) - } - - common.readProc('/proc/sys/kernel/random/boot_id', function readProcBootId(err, data) { - if (!data) { - bootIdError() - return callback(null, null) - } - - data = data.trim() - var asciiData = Buffer.from(data, 'ascii').toString() - - if (data !== asciiData) { - bootIdError() - return callback(null, null) - } - - if (data.length !== 36) { - bootIdError() - if (data.length > 128) { - data = data.substr(0, 128) - } - } - - return callback(null, data) - }) - - function bootIdError() { - agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.BOOT_ID_ERROR) - .incrementCallCount() - } -} - -var vendorInfo = null - -function fetchDockerVendorInfo(agent, callback) { - if (!agent.config.utilization || !agent.config.utilization.detect_docker) { - return callback(null, null) - } - - if (vendorInfo) { - return callback(null, vendorInfo) - } - - if (!os.platform().match(/linux/i)) { - logger.debug('Platform is not a flavor of linux, omitting docker info') - return callback(null) - } - - common.readProc('/proc/self/cgroup', function getCGroup(err, data) { - if (!data) { - return callback(null) - } - - var id = null - findCGroups(data, 'cpu', function forEachCpuGroup(cpuGroup) { - var match = /(?:^|[^0-9a-f])([0-9a-f]{64})(?:[^0-9a-f]|$)/.exec(cpuGroup) - if (match) { - id = match[1] - return false - } - - return true - }) - - if (id) { - vendorInfo = {id: id} - callback(null, vendorInfo) - } else { - logger.debug('No matching cpu group found.') - callback(null, null) - } - }) -} - -function findCGroups(info, cgroup, eachCb) { - var target = new RegExp('^\\d+:[^:]*?\\b' + cgroup + '\\b[^:]*:') - var lines = info.split('\n') - for (var i = 0; i < lines.length; ++i) { - var line = lines[i] - if (target.test(line) && !eachCb(line.split(':')[2])) { - break - } - } -} diff --git a/node_modules/newrelic/lib/utilization/gcp-info.js b/node_modules/newrelic/lib/utilization/gcp-info.js deleted file mode 100644 index a4ac0439..00000000 --- a/node_modules/newrelic/lib/utilization/gcp-info.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger.js').child({component: 'gcp-info'}) -var common = require('./common') -var NAMES = require('../metrics/names.js') - -module.exports = fetchGCPInfo -module.exports.clearCache = function clearGCPCache() { - resultDict = null -} - -var resultDict - -function fetchGCPInfo(agent, callback) { - if (!agent.config.utilization || !agent.config.utilization.detect_gcp) { - return setImmediate(callback, null) - } - - if (resultDict) { - return setImmediate(callback, null, resultDict) - } - - common.request({ - host: 'metadata.google.internal', - path: '/computeMetadata/v1/instance/?recursive=true', - headers: { - 'Metadata-Flavor': 'Google' - } - }, agent, function getMetadata(err, data) { - if (err) { - return callback(err) - } - - try { - data = JSON.parse(data) - } catch (e) { - logger.debug(e, 'Failed to parse GCP metadata.') - data = null - } - - var results = common.getKeys(data, ['id', 'machineType', 'name', 'zone']) - if (results == null) { - logger.debug('GCP metadata was invalid.') - agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.GCP_ERROR).incrementCallCount() - } else { - // normalize - results.machineType = - results.machineType.substr(results.machineType.lastIndexOf('/') + 1) - results.zone = - results.zone.substr(results.zone.lastIndexOf('/') + 1) - - resultDict = results - } - callback(null, results) - }) -} diff --git a/node_modules/newrelic/lib/utilization/index.js b/node_modules/newrelic/lib/utilization/index.js deleted file mode 100644 index 36860506..00000000 --- a/node_modules/newrelic/lib/utilization/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger').child({component: 'utilization'}) - -var VENDOR_METHODS = { - aws: require('./aws-info'), - pcf: require('./pcf-info'), - azure: require('./azure-info'), - gcp: require('./gcp-info'), - docker: require('./docker-info').getVendorInfo, - kubernetes: require('./kubernetes-info') -} -var VENDOR_NAMES = Object.keys(VENDOR_METHODS) - -module.exports.getVendors = getVendors -function getVendors(agent, callback) { - var done = 0 - var vendors = null - VENDOR_NAMES.forEach(function getVendorInfo(vendor) { - VENDOR_METHODS[vendor](agent, function getInfo(err, result) { - logger.trace('Vendor %s finished.', vendor) - if (result) { - vendors = vendors || Object.create(null) - vendors[vendor] = result - } - - if (++done === VENDOR_NAMES.length) { - callback(null, vendors) - } - }) - }) -} diff --git a/node_modules/newrelic/lib/utilization/kubernetes-info.js b/node_modules/newrelic/lib/utilization/kubernetes-info.js deleted file mode 100644 index 692abb80..00000000 --- a/node_modules/newrelic/lib/utilization/kubernetes-info.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' -const logger = require('../logger').child({component: 'kubernetes-info'}) - -let info = null - -module.exports = getKubernetesInfo -module.exports.clearCache = function clearAWSCache() { - info = null -} - -function getKubernetesInfo(agent, callback) { - if (!agent.config.utilization || !agent.config.utilization.detect_kubernetes) { - return setImmediate(callback, null, null) - } - - if (info) { - return setImmediate(callback, null, info) - } - - if (!process.env.KUBERNETES_SERVICE_HOST) { - logger.debug('No Kubernetes service host found.') - return setImmediate(callback, null, null) - } - - info = {kubernetes_service_host: process.env.KUBERNETES_SERVICE_HOST} - - setImmediate(callback, null, info) -} diff --git a/node_modules/newrelic/lib/utilization/pcf-info.js b/node_modules/newrelic/lib/utilization/pcf-info.js deleted file mode 100644 index 5e4e8f39..00000000 --- a/node_modules/newrelic/lib/utilization/pcf-info.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('../logger.js').child({component: 'pcf-info'}) -var NAMES = require('../metrics/names.js') -var common = require('./common') - -module.exports = fetchPCFInfo - -function fetchPCFInfo(agent, callback) { - if (!agent.config.utilization || !agent.config.utilization.detect_pcf) { - return setImmediate(callback, null, null) - } - - var metadataMap = { - 'CF_INSTANCE_GUID': 'cf_instance_guid', - 'CF_INSTANCE_IP': 'cf_instance_ip', - 'MEMORY_LIMIT': 'memory_limit' - } - - var results = Object.create(null) - var keys = Object.keys(metadataMap) - for (var i = 0; i < keys.length; i++) { - var key = keys[i] - var value = process.env[key] - if (value == null) { - logger.trace('Could not find environment value for %s', key) - return setImmediate(callback, null, null) - } - if (!common.checkValueString(value)) { - logger.trace('Invalid environment value for %s: %j', key, value) - agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.PCF_ERROR).incrementCallCount() - return setImmediate(callback, null, null) - } - results[metadataMap[key]] = value - } - - setImmediate(callback, null, results) -} diff --git a/node_modules/newrelic/newrelic.js b/node_modules/newrelic/newrelic.js deleted file mode 100644 index 0b71bc1a..00000000 --- a/node_modules/newrelic/newrelic.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict' -/** - * New Relic agent configuration. - * - * See lib/config/default.js in the agent distribution for a more complete - * description of configuration variables and their potential values. - */ -exports.config = { - /** - * Array of application names. - */ - app_name: ['My Application'], - /** - * Your New Relic license key. - */ - license_key: 'license key here', - /** - * This setting controls distributed tracing. - * Distributed tracing lets you see the path that a request takes through your - * distributed system. Enabling distributed tracing changes the behavior of some - * New Relic features, so carefully consult the transition guide before you enable - * this feature: https://docs.newrelic.com/docs/transition-guide-distributed-tracing - * Default is false. - */ - distributed_tracing: { - /** - * Enables/disables distributed tracing. - * - * @env NEW_RELIC_DISTRIBUTED_TRACING_ENABLED - */ - enabled: false - }, - logging: { - /** - * Level at which to log. 'trace' is most useful to New Relic when diagnosing - * issues with the agent, 'info' and higher will impose the least overhead on - * production applications. - */ - level: 'info' - }, - /** - * When true, all request headers except for those listed in attributes.exclude - * will be captured for all traces, unless otherwise specified in a destination's - * attributes include/exclude lists. - */ - allow_all_headers: true, - attributes: { - /** - * Prefix of attributes to exclude from all destinations. Allows * as wildcard - * at end. - * - * NOTE: If excluding headers, they must be in camelCase form to be filtered. - * - * @env NEW_RELIC_ATTRIBUTES_EXCLUDE - */ - exclude: [ - 'request.headers.cookie', - 'request.headers.authorization', - 'request.headers.proxyAuthorization', - 'request.headers.setCookie*', - 'request.headers.x*', - 'response.headers.cookie', - 'response.headers.authorization', - 'response.headers.proxyAuthorization', - 'response.headers.setCookie*', - 'response.headers.x*' - ] - } -} diff --git a/node_modules/newrelic/package.json b/node_modules/newrelic/package.json deleted file mode 100644 index c4e22dad..00000000 --- a/node_modules/newrelic/package.json +++ /dev/null @@ -1,232 +0,0 @@ -{ - "_from": "newrelic", - "_id": "newrelic@7.0.1", - "_inBundle": false, - "_integrity": "sha512-DMuznXjT4Eh4nXpM5CIxnuY+3Lv6imVdsjOwgPSPD6aKzrPuXg1qpqhh07WjGkUA3XpuAaiwDmxjz4WHrSfJUg==", - "_location": "/newrelic", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "newrelic", - "name": "newrelic", - "escapedName": "newrelic", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/newrelic/-/newrelic-7.0.1.tgz", - "_shasum": "281085a03af42c955ff06f7c5c5a11e209e763d7", - "_spec": "newrelic", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "bin": { - "newrelic-naming-rules": "bin/test-naming-rules.js" - }, - "bugs": { - "url": "https://github.com/newrelic/node-newrelic/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Saxon D'Aubin", - "email": "saxon@newrelic.com", - "url": "http://newrelic.com" - }, - { - "name": "Forrest L Norvell", - "email": "forrest@newrelic.com", - "url": "http://newrelic.com/" - }, - { - "name": "Jacob Groundwater", - "email": "jacob@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Wraithan", - "email": "wmcdonald@newrelic.com", - "url": "Chris McDonald" - }, - { - "name": "Michael Hayes", - "email": "mhayes@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Bryan Clement", - "email": "bclement@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Jeff Olfert", - "email": "jolfert@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Wilson Bilkovich", - "email": "wbilkovich@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Jonathan Merrill", - "email": "jmerrill@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Martin Kuba", - "email": "mkuba@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Tim Krajcar", - "email": "tkrajcar@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Eric Wang", - "email": "ewang@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Natalie Wolfe", - "email": "nwolfe@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Seth Shober", - "email": "sshober@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Peter Svetlichny", - "email": "psvetlichny@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Michael Goin", - "email": "mgoin@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Alan Storm", - "email": "astorm@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Carlo Pearson", - "email": "cpearson@newrelic.com", - "url": "https://newrelic.com" - }, - { - "name": "Nick Tzaperas", - "email": "ntzaperas@newrelic.com", - "url": "https://newrelic.com" - } - ], - "dependencies": { - "@grpc/grpc-js": "1.2.0", - "@grpc/proto-loader": "^0.5.5", - "@newrelic/aws-sdk": "^3.0.0", - "@newrelic/koa": "^5.0.0", - "@newrelic/native-metrics": "^6.0.0", - "@newrelic/superagent": "^4.0.0", - "@tyriar/fibonacci-heap": "^2.0.7", - "async": "^3.2.0", - "concat-stream": "^2.0.0", - "https-proxy-agent": "^4.0.0", - "json-stringify-safe": "^5.0.0", - "readable-stream": "^3.6.0", - "semver": "^5.3.0" - }, - "deprecated": false, - "description": "New Relic agent", - "devDependencies": { - "@newrelic/proxy": "^2.0.0", - "@newrelic/test-utilities": "^5.0.0", - "JSV": "~4.0.2", - "architect": "*", - "benchmark": "^2.1.4", - "bluebird": "^3.4.7", - "chai": "^4.1.2", - "eslint": "^6.8.0", - "express": "*", - "fastify": "^2.14.1", - "generic-pool": "^3.6.1", - "glob": "^7.1.2", - "got": "^8.0.1", - "http-errors": "^1.7.3", - "jsdoc": "^3.6.3", - "memcached": ">=0.2.8", - "minami": "^1.1.1", - "mongodb": "^3.3.3", - "mysql": "*", - "nock": "11.8.0", - "proxyquire": "^1.8.0", - "q": "*", - "redis": "^1.0.0", - "request": "^2.88.0", - "restify": "^8.4.0", - "rimraf": "^2.6.3", - "should": "*", - "sinon": "^4.5.0", - "tap": "^14.10.8", - "temp": "^0.8.1", - "through": "^2.3.6", - "when": "*" - }, - "directories": { - "lib": "lib" - }, - "engines": { - "node": ">=10.0.0", - "npm": ">=3.0.0" - }, - "homepage": "http://github.com/newrelic/node-newrelic", - "keywords": [ - "apm", - "performance", - "monitoring", - "instrumentation", - "debugging", - "profiling" - ], - "license": "Apache-2.0", - "name": "newrelic", - "optionalDependencies": { - "@newrelic/native-metrics": "^6.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/newrelic/node-newrelic.git" - }, - "scripts": { - "bench": "node ./bin/run-bench.js", - "ca-gen": "./bin/update-ca-bundle.sh", - "clean": "./bin/clean.sh", - "docker-env": "./bin/docker-env-vars.sh", - "docs": "npm ci && jsdoc -c ./jsdoc-conf.json --private -r .", - "integration": "npm run prepare-test && npm run sub-install && time tap --no-esm test/integration/**/**/*.tap.js --timeout=180 --no-coverage", - "lint": "eslint ./*.js lib test", - "prepare-test": "npm ci && npm run ca-gen && npm run ssl && npm run docker-env", - "public-docs": "npm ci && jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/", - "publish-docs": "./bin/publish-docs.sh", - "services": "./bin/docker-services.sh", - "smoke": "npm run clean && ./bin/smoke.sh", - "ssl": "./bin/ssl.sh", - "sub-install": "node test/bin/install_sub_deps", - "test": "npm run integration && npm run unit", - "unit": "rm -f newrelic_agent.log && time tap --test-regex='(\\/|^test\\/unit\\/.*\\.test\\.js)$' --timeout=180 --no-coverage", - "update-cross-agent-tests": "./bin/update-cats.sh", - "versioned": "npm run prepare-test && time ./bin/run-versioned-tests.sh", - "versioned-tests": "./bin/run-versioned-tests.sh" - }, - "version": "7.0.1" -} diff --git a/node_modules/newrelic/stub_api.js b/node_modules/newrelic/stub_api.js deleted file mode 100644 index 0cef9738..00000000 --- a/node_modules/newrelic/stub_api.js +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2020 New Relic Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict' - -var logger = require('./lib/logger.js') -var RealAPI = require('./api.js') -var TransactionHandle = require('./lib/transaction/handle') - - -/* eslint-disable no-eval */ -function stubFunction(name) { - return eval( - "(function () {return function " + name + "() {" + - "logger.debug('Not calling " + name + " because New Relic is disabled.');" + - "}}())" - ) -} -/* eslint-enable no-eval */ - -function Stub() {} - -var keys = Object.keys(RealAPI.prototype) -var length = keys.length - - -/* This way the stub API doesn't have to be updated in lockstep with the regular - * API. - */ -for (var i = 0; i < length; i++) { - var functionName = keys[i] - Stub.prototype[functionName] = stubFunction(functionName) -} - -Stub.prototype.startSegment = startSegment -Stub.prototype.startWebTransaction = startWebTransaction -Stub.prototype.startBackgroundTransaction = startBackgroundTransaction -Stub.prototype.getTransaction = getTransaction -Stub.prototype.getBrowserTimingHeader = getBrowserTimingHeader -Stub.prototype.shutdown = shutdown -Stub.prototype.setLambdaHandler = setLambdaHandler -Stub.prototype.getLinkingMetadata = getLinkingMetadata -Stub.prototype.getTraceMetadata = getTraceMetadata - -// This code gets injected into HTML templates -// and we don't want it to return undefined/null. -function getBrowserTimingHeader() { - logger.debug('Not calling getBrowserTimingHeader because New Relic is disabled.') - return '' -} - -function getTransaction() { - return new TransactionHandle.Stub() -} - -function setLambdaHandler(callback) { - logger.debug('Not calling setLambdaHandler because New Relic is disabled.') - return callback -} - -function startSegment(name, record, handler, callback) { - logger.debug('Not calling `startSegment` becuase New Relic is disabled.') - if (typeof handler === 'function') { - return handler(callback) - } - return null -} - -function getLinkingMetadata() { - return {} -} - -function getTraceMetadata() { - return { - traceId: '', - spanId: '' - } -} - -function startWebTransaction(url, callback) { - logger.debug('Not calling startWebTransaction because New Relic is disabled.') - if (typeof callback === 'function') { - return callback() - } - - return null -} - -function startBackgroundTransaction(name, group, callback) { - logger.debug('Not calling startBackgroundTransaction because New Relic is disabled.') - if (typeof callback === 'function') { - return callback() - } - - if (typeof group === 'function') { - return group() - } - - return null -} - -// Normally the following call executes callback asynchronously -function shutdown(options, cb) { - logger.debug('Not calling shutdown because New Relic is disabled.') - - var callback = cb - if (!callback) { - if (typeof options === 'function') { - callback = options - } else { - callback = function __NR_defaultCb() {} - } - } - - setImmediate(callback) -} - -module.exports = Stub diff --git a/node_modules/newrelic/third_party_manifest.json b/node_modules/newrelic/third_party_manifest.json deleted file mode 100644 index 00ff784f..00000000 --- a/node_modules/newrelic/third_party_manifest.json +++ /dev/null @@ -1,608 +0,0 @@ -{ - "lastUpdated": "Tue Nov 17 2020 14:58:13 GMT-0800 (Pacific Standard Time)", - "projectName": "New Relic Node Agent", - "projectUrl": "https://github.com/newrelic/node-newrelic", - "includeDev": true, - "dependencies": { - "@grpc/grpc-js@1.2.0": { - "name": "@grpc/grpc-js", - "version": "1.2.0", - "range": "1.2.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", - "versionedRepoUrl": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.2.0", - "licenseFile": "node_modules/@grpc/grpc-js/LICENSE", - "licenseUrl": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.2.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Google Inc." - }, - "@grpc/proto-loader@0.5.5": { - "name": "@grpc/proto-loader", - "version": "0.5.5", - "range": "^0.5.5", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/grpc/grpc-node", - "versionedRepoUrl": "https://github.com/grpc/grpc-node/tree/v0.5.5", - "licenseFile": "node_modules/@grpc/proto-loader/LICENSE", - "licenseUrl": "https://github.com/grpc/grpc-node/blob/v0.5.5/LICENSE", - "licenseTextSource": "file", - "publisher": "Google Inc." - }, - "@newrelic/aws-sdk@3.0.0": { - "name": "@newrelic/aws-sdk", - "version": "3.0.0", - "range": "^3.0.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-newrelic-aws-sdk", - "versionedRepoUrl": "https://github.com/newrelic/node-newrelic-aws-sdk/tree/v3.0.0", - "licenseFile": "node_modules/@newrelic/aws-sdk/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-newrelic-aws-sdk/blob/v3.0.0/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "@newrelic/koa@5.0.0": { - "name": "@newrelic/koa", - "version": "5.0.0", - "range": "^5.0.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-newrelic-koa", - "versionedRepoUrl": "https://github.com/newrelic/node-newrelic-koa/tree/v5.0.0", - "licenseFile": "node_modules/@newrelic/koa/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-newrelic-koa/blob/v5.0.0/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "@newrelic/superagent@4.0.0": { - "name": "@newrelic/superagent", - "version": "4.0.0", - "range": "^4.0.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-newrelic-superagent", - "versionedRepoUrl": "https://github.com/newrelic/node-newrelic-superagent/tree/v4.0.0", - "licenseFile": "node_modules/@newrelic/superagent/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-newrelic-superagent/blob/v4.0.0/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js Agent Team", - "email": "nodejs@newrelic.com" - }, - "@tyriar/fibonacci-heap@2.0.9": { - "name": "@tyriar/fibonacci-heap", - "version": "2.0.9", - "range": "^2.0.7", - "licenses": "MIT", - "repoUrl": "https://github.com/gwtw/ts-fibonacci-heap", - "versionedRepoUrl": "https://github.com/gwtw/ts-fibonacci-heap/tree/v2.0.9", - "licenseFile": "node_modules/@tyriar/fibonacci-heap/LICENSE", - "licenseUrl": "https://github.com/gwtw/ts-fibonacci-heap/blob/v2.0.9/LICENSE", - "licenseTextSource": "file", - "publisher": "Daniel Imms", - "url": "http://www.growingwiththeweb.com" - }, - "async@3.2.0": { - "name": "async", - "version": "3.2.0", - "range": "^3.2.0", - "licenses": "MIT", - "repoUrl": "https://github.com/caolan/async", - "versionedRepoUrl": "https://github.com/caolan/async/tree/v3.2.0", - "licenseFile": "node_modules/async/LICENSE", - "licenseUrl": "https://github.com/caolan/async/blob/v3.2.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Caolan McMahon" - }, - "concat-stream@2.0.0": { - "name": "concat-stream", - "version": "2.0.0", - "range": "^2.0.0", - "licenses": "MIT", - "repoUrl": "https://github.com/maxogden/concat-stream", - "versionedRepoUrl": "https://github.com/maxogden/concat-stream/tree/v2.0.0", - "licenseFile": "node_modules/concat-stream/LICENSE", - "licenseUrl": "https://github.com/maxogden/concat-stream/blob/v2.0.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Max Ogden", - "email": "max@maxogden.com" - }, - "https-proxy-agent@4.0.0": { - "name": "https-proxy-agent", - "version": "4.0.0", - "range": "^4.0.0", - "licenses": "MIT", - "repoUrl": "https://github.com/TooTallNate/node-https-proxy-agent", - "versionedRepoUrl": "https://github.com/TooTallNate/node-https-proxy-agent/tree/v4.0.0", - "licenseFile": "node_modules/https-proxy-agent/README.md", - "licenseUrl": "https://github.com/TooTallNate/node-https-proxy-agent/blob/v4.0.0/README.md", - "licenseTextSource": "spdx", - "publisher": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "json-stringify-safe@5.0.1": { - "name": "json-stringify-safe", - "version": "5.0.1", - "range": "^5.0.0", - "licenses": "ISC", - "repoUrl": "https://github.com/isaacs/json-stringify-safe", - "versionedRepoUrl": "https://github.com/isaacs/json-stringify-safe/tree/v5.0.1", - "licenseFile": "node_modules/json-stringify-safe/LICENSE", - "licenseUrl": "https://github.com/isaacs/json-stringify-safe/blob/v5.0.1/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - "readable-stream@3.6.0": { - "name": "readable-stream", - "version": "3.6.0", - "range": "^3.6.0", - "licenses": "MIT", - "repoUrl": "https://github.com/nodejs/readable-stream", - "versionedRepoUrl": "https://github.com/nodejs/readable-stream/tree/v3.6.0", - "licenseFile": "node_modules/readable-stream/LICENSE", - "licenseUrl": "https://github.com/nodejs/readable-stream/blob/v3.6.0/LICENSE", - "licenseTextSource": "file" - }, - "semver@5.7.1": { - "name": "semver", - "version": "5.7.1", - "range": "^5.3.0", - "licenses": "ISC", - "repoUrl": "https://github.com/npm/node-semver", - "versionedRepoUrl": "https://github.com/npm/node-semver/tree/v5.7.1", - "licenseFile": "node_modules/semver/LICENSE", - "licenseUrl": "https://github.com/npm/node-semver/blob/v5.7.1/LICENSE", - "licenseTextSource": "file" - } - }, - "devDependencies": { - "@newrelic/proxy@2.0.0": { - "name": "@newrelic/proxy", - "version": "2.0.0", - "range": "^2.0.0", - "licenses": "MIT", - "repoUrl": "https://github.com/newrelic/proxy", - "versionedRepoUrl": "https://github.com/newrelic/proxy/tree/v2.0.0", - "licenseFile": "node_modules/@newrelic/proxy/README.md", - "licenseUrl": "https://github.com/newrelic/proxy/blob/v2.0.0/README.md", - "licenseTextSource": "spdx", - "publisher": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "@newrelic/test-utilities@5.0.0": { - "name": "@newrelic/test-utilities", - "version": "5.0.0", - "range": "^5.0.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/newrelic/node-test-utilities", - "versionedRepoUrl": "https://github.com/newrelic/node-test-utilities/tree/v5.0.0", - "licenseFile": "node_modules/@newrelic/test-utilities/LICENSE", - "licenseUrl": "https://github.com/newrelic/node-test-utilities/blob/v5.0.0/LICENSE", - "licenseTextSource": "file", - "publisher": "New Relic Node.js agent team", - "email": "nodejs@newrelic.com" - }, - "JSV@4.0.2": { - "name": "JSV", - "version": "4.0.2", - "range": "~4.0.2", - "licenses": "FreeBSD", - "repoUrl": "https://github.com/garycourt/JSV", - "versionedRepoUrl": "https://github.com/garycourt/JSV/tree/v4.0.2", - "licenseFile": "node_modules/JSV/README.md", - "licenseUrl": "https://github.com/garycourt/JSV/tree/v4.0.2#license", - "licenseTextSource": "UNKNOWN", - "publisher": "Gary Court", - "email": "gary.court@gmail.com", - "FOR_REVIEW": [ - "Unable to determine source for license text." - ] - }, - "architect@0.1.13": { - "name": "architect", - "version": "0.1.13", - "range": "*", - "licenses": "MIT", - "repoUrl": "https://github.com/c9/architect", - "versionedRepoUrl": "https://github.com/c9/architect/tree/v0.1.13", - "licenseFile": "node_modules/architect/LICENSE", - "licenseUrl": "https://github.com/c9/architect/blob/v0.1.13/LICENSE", - "licenseTextSource": "file", - "publisher": "ajax.org B.V.", - "email": "info@ajax.org" - }, - "benchmark@2.1.4": { - "name": "benchmark", - "version": "2.1.4", - "range": "^2.1.4", - "licenses": "MIT", - "repoUrl": "https://github.com/bestiejs/benchmark.js", - "versionedRepoUrl": "https://github.com/bestiejs/benchmark.js/tree/v2.1.4", - "licenseFile": "node_modules/benchmark/LICENSE", - "licenseUrl": "https://github.com/bestiejs/benchmark.js/blob/v2.1.4/LICENSE", - "licenseTextSource": "file", - "publisher": "Mathias Bynens", - "email": "mathias@qiwi.be", - "url": "https://mathiasbynens.be/" - }, - "bluebird@3.7.1": { - "name": "bluebird", - "version": "3.7.1", - "range": "^3.4.7", - "licenses": "MIT", - "repoUrl": "https://github.com/petkaantonov/bluebird", - "versionedRepoUrl": "https://github.com/petkaantonov/bluebird/tree/v3.7.1", - "licenseFile": "node_modules/bluebird/LICENSE", - "licenseUrl": "https://github.com/petkaantonov/bluebird/blob/v3.7.1/LICENSE", - "licenseTextSource": "file", - "publisher": "Petka Antonov", - "email": "petka_antonov@hotmail.com", - "url": "http://github.com/petkaantonov/" - }, - "chai@4.2.0": { - "name": "chai", - "version": "4.2.0", - "range": "^4.1.2", - "licenses": "MIT", - "repoUrl": "https://github.com/chaijs/chai", - "versionedRepoUrl": "https://github.com/chaijs/chai/tree/v4.2.0", - "licenseFile": "node_modules/chai/LICENSE", - "licenseUrl": "https://github.com/chaijs/chai/blob/v4.2.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Jake Luer", - "email": "jake@alogicalparadox.com" - }, - "eslint@6.8.0": { - "name": "eslint", - "version": "6.8.0", - "range": "^6.8.0", - "licenses": "MIT", - "repoUrl": "https://github.com/eslint/eslint", - "versionedRepoUrl": "https://github.com/eslint/eslint/tree/v6.8.0", - "licenseFile": "node_modules/eslint/LICENSE", - "licenseUrl": "https://github.com/eslint/eslint/blob/v6.8.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Nicholas C. Zakas", - "email": "nicholas+npm@nczconsulting.com" - }, - "express@4.17.1": { - "name": "express", - "version": "4.17.1", - "range": "*", - "licenses": "MIT", - "repoUrl": "https://github.com/expressjs/express", - "versionedRepoUrl": "https://github.com/expressjs/express/tree/v4.17.1", - "licenseFile": "node_modules/express/LICENSE", - "licenseUrl": "https://github.com/expressjs/express/blob/v4.17.1/LICENSE", - "licenseTextSource": "file", - "publisher": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "fastify@2.14.1": { - "name": "fastify", - "version": "2.14.1", - "range": "^2.14.1", - "licenses": "MIT", - "repoUrl": "https://github.com/fastify/fastify", - "versionedRepoUrl": "https://github.com/fastify/fastify/tree/v2.14.1", - "licenseFile": "node_modules/fastify/LICENSE", - "licenseUrl": "https://github.com/fastify/fastify/blob/v2.14.1/LICENSE", - "licenseTextSource": "file", - "publisher": "Matteo Collina", - "email": "hello@matteocollina.com" - }, - "generic-pool@3.7.1": { - "name": "generic-pool", - "version": "3.7.1", - "range": "^3.6.1", - "licenses": "MIT", - "repoUrl": "https://github.com/coopernurse/node-pool", - "versionedRepoUrl": "https://github.com/coopernurse/node-pool/tree/v3.7.1", - "licenseFile": "node_modules/generic-pool/README.md", - "licenseUrl": "https://github.com/coopernurse/node-pool/blob/v3.7.1/README.md", - "licenseTextSource": "spdx", - "publisher": "James Cooper", - "email": "james@bitmechanic.com" - }, - "glob@7.1.6": { - "name": "glob", - "version": "7.1.6", - "range": "^7.1.2", - "licenses": "ISC", - "repoUrl": "https://github.com/isaacs/node-glob", - "versionedRepoUrl": "https://github.com/isaacs/node-glob/tree/v7.1.6", - "licenseFile": "node_modules/glob/LICENSE", - "licenseUrl": "https://github.com/isaacs/node-glob/blob/v7.1.6/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "got@8.3.2": { - "name": "got", - "version": "8.3.2", - "range": "^8.0.1", - "licenses": "MIT", - "repoUrl": "https://github.com/sindresorhus/got", - "versionedRepoUrl": "https://github.com/sindresorhus/got/tree/v8.3.2", - "licenseFile": "node_modules/got/license", - "licenseUrl": "https://github.com/sindresorhus/got/blob/v8.3.2/license", - "licenseTextSource": "file" - }, - "http-errors@1.7.3": { - "name": "http-errors", - "version": "1.7.3", - "range": "^1.7.3", - "licenses": "MIT", - "repoUrl": "https://github.com/jshttp/http-errors", - "versionedRepoUrl": "https://github.com/jshttp/http-errors/tree/v1.7.3", - "licenseFile": "node_modules/http-errors/LICENSE", - "licenseUrl": "https://github.com/jshttp/http-errors/blob/v1.7.3/LICENSE", - "licenseTextSource": "file", - "publisher": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "jsdoc@3.6.3": { - "name": "jsdoc", - "version": "3.6.3", - "range": "^3.6.3", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/jsdoc/jsdoc", - "versionedRepoUrl": "https://github.com/jsdoc/jsdoc/tree/v3.6.3", - "licenseFile": "node_modules/jsdoc/LICENSE.md", - "licenseUrl": "https://github.com/jsdoc/jsdoc/blob/v3.6.3/LICENSE.md", - "licenseTextSource": "file", - "publisher": "Michael Mathews", - "email": "micmath@gmail.com" - }, - "memcached@2.2.2": { - "name": "memcached", - "version": "2.2.2", - "range": ">=0.2.8", - "licenses": "MIT", - "repoUrl": "https://github.com/3rd-Eden/node-memcached", - "versionedRepoUrl": "https://github.com/3rd-Eden/node-memcached/tree/v2.2.2", - "licenseFile": "node_modules/memcached/LICENSE", - "licenseUrl": "https://github.com/3rd-Eden/node-memcached/blob/v2.2.2/LICENSE", - "licenseTextSource": "file", - "publisher": "Arnout Kazemier" - }, - "minami@1.2.3": { - "name": "minami", - "version": "1.2.3", - "range": "^1.1.1", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/Nijikokun/minami", - "versionedRepoUrl": "https://github.com/Nijikokun/minami/tree/v1.2.3", - "licenseFile": "node_modules/minami/LICENSE", - "licenseUrl": "https://github.com/Nijikokun/minami/blob/v1.2.3/LICENSE", - "licenseTextSource": "file", - "publisher": "Nijiko Yonskai", - "email": "nijikokun@gmail.com" - }, - "mongodb@3.3.4": { - "name": "mongodb", - "version": "3.3.4", - "range": "^3.3.3", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/mongodb/node-mongodb-native", - "versionedRepoUrl": "https://github.com/mongodb/node-mongodb-native/tree/v3.3.4", - "licenseFile": "node_modules/mongodb/LICENSE.md", - "licenseUrl": "https://github.com/mongodb/node-mongodb-native/blob/v3.3.4/LICENSE.md", - "licenseTextSource": "file" - }, - "mysql@2.17.1": { - "name": "mysql", - "version": "2.17.1", - "range": "*", - "licenses": "MIT", - "repoUrl": "https://github.com/mysqljs/mysql", - "versionedRepoUrl": "https://github.com/mysqljs/mysql/tree/v2.17.1", - "licenseFile": "node_modules/mysql/License", - "licenseUrl": "https://github.com/mysqljs/mysql/blob/v2.17.1/License", - "licenseTextSource": "file", - "publisher": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "nock@11.8.0": { - "name": "nock", - "version": "11.8.0", - "range": "11.8.0", - "licenses": "MIT", - "repoUrl": "https://github.com/nock/nock", - "versionedRepoUrl": "https://github.com/nock/nock/tree/v11.8.0", - "licenseFile": "node_modules/nock/LICENSE", - "licenseUrl": "https://github.com/nock/nock/blob/v11.8.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Pedro Teixeira", - "email": "pedro.teixeira@gmail.com" - }, - "proxyquire@1.8.0": { - "name": "proxyquire", - "version": "1.8.0", - "range": "^1.8.0", - "licenses": "MIT", - "repoUrl": "https://github.com/thlorenz/proxyquire", - "versionedRepoUrl": "https://github.com/thlorenz/proxyquire/tree/v1.8.0", - "licenseFile": "node_modules/proxyquire/LICENSE", - "licenseUrl": "https://github.com/thlorenz/proxyquire/blob/v1.8.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Thorsten Lorenz" - }, - "q@1.5.1": { - "name": "q", - "version": "1.5.1", - "range": "*", - "licenses": "MIT", - "repoUrl": "https://github.com/kriskowal/q", - "versionedRepoUrl": "https://github.com/kriskowal/q/tree/v1.5.1", - "licenseFile": "node_modules/q/LICENSE", - "licenseUrl": "https://github.com/kriskowal/q/blob/v1.5.1/LICENSE", - "licenseTextSource": "file", - "publisher": "Kris Kowal", - "email": "kris@cixar.com", - "url": "https://github.com/kriskowal" - }, - "redis@1.0.0": { - "name": "redis", - "version": "1.0.0", - "range": "^1.0.0", - "licenses": "MIT", - "repoUrl": "https://github.com/mranney/node_redis", - "versionedRepoUrl": "https://github.com/mranney/node_redis/tree/v1.0.0", - "licenseFile": "node_modules/redis/README.md", - "licenseUrl": "https://github.com/mranney/node_redis/blob/v1.0.0/README.md", - "licenseTextSource": "spdx", - "publisher": "Matt Ranney", - "email": "mjr@ranney.com" - }, - "request@2.88.0": { - "name": "request", - "version": "2.88.0", - "range": "^2.88.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/request/request", - "versionedRepoUrl": "https://github.com/request/request/tree/v2.88.0", - "licenseFile": "node_modules/request/LICENSE", - "licenseUrl": "https://github.com/request/request/blob/v2.88.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "request@2.88.2": { - "name": "request", - "version": "2.88.2", - "range": "^2.88.0", - "licenses": "Apache-2.0", - "repoUrl": "https://github.com/request/request", - "versionedRepoUrl": "https://github.com/request/request/tree/v2.88.2", - "licenseFile": "node_modules/coveralls/node_modules/request/LICENSE", - "licenseUrl": "https://github.com/request/request/blob/v2.88.2/LICENSE", - "licenseTextSource": "file", - "publisher": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "restify@8.4.0": { - "name": "restify", - "version": "8.4.0", - "range": "^8.4.0", - "licenses": "MIT", - "repoUrl": "https://github.com/restify/node-restify", - "versionedRepoUrl": "https://github.com/restify/node-restify/tree/v8.4.0", - "licenseFile": "node_modules/restify/LICENSE", - "licenseUrl": "https://github.com/restify/node-restify/blob/v8.4.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Mark Cavage", - "email": "mcavage@gmail.com" - }, - "rimraf@2.6.3": { - "name": "rimraf", - "version": "2.6.3", - "range": "^2.6.3", - "licenses": "ISC", - "repoUrl": "https://github.com/isaacs/rimraf", - "versionedRepoUrl": "https://github.com/isaacs/rimraf/tree/v2.6.3", - "licenseFile": "node_modules/flat-cache/node_modules/rimraf/LICENSE", - "licenseUrl": "https://github.com/isaacs/rimraf/blob/v2.6.3/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "rimraf@2.7.1": { - "name": "rimraf", - "version": "2.7.1", - "range": "^2.6.3", - "licenses": "ISC", - "repoUrl": "https://github.com/isaacs/rimraf", - "versionedRepoUrl": "https://github.com/isaacs/rimraf/tree/v2.7.1", - "licenseFile": "node_modules/rimraf/LICENSE", - "licenseUrl": "https://github.com/isaacs/rimraf/blob/v2.7.1/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "should@13.2.3": { - "name": "should", - "version": "13.2.3", - "range": "*", - "licenses": "MIT", - "repoUrl": "https://github.com/shouldjs/should.js", - "versionedRepoUrl": "https://github.com/shouldjs/should.js/tree/v13.2.3", - "licenseFile": "node_modules/should/LICENSE", - "licenseUrl": "https://github.com/shouldjs/should.js/blob/v13.2.3/LICENSE", - "licenseTextSource": "file", - "publisher": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "sinon@4.5.0": { - "name": "sinon", - "version": "4.5.0", - "range": "^4.5.0", - "licenses": "BSD-3-Clause", - "repoUrl": "https://github.com/sinonjs/sinon", - "versionedRepoUrl": "https://github.com/sinonjs/sinon/tree/v4.5.0", - "licenseFile": "node_modules/sinon/LICENSE", - "licenseUrl": "https://github.com/sinonjs/sinon/blob/v4.5.0/LICENSE", - "licenseTextSource": "file", - "publisher": "Christian Johansen" - }, - "tap@14.10.8": { - "name": "tap", - "version": "14.10.8", - "range": "^14.10.8", - "licenses": "ISC", - "repoUrl": "https://github.com/tapjs/node-tap", - "versionedRepoUrl": "https://github.com/tapjs/node-tap/tree/v14.10.8", - "licenseFile": "node_modules/tap/LICENSE", - "licenseUrl": "https://github.com/tapjs/node-tap/blob/v14.10.8/LICENSE", - "licenseTextSource": "file", - "publisher": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - "temp@0.8.4": { - "name": "temp", - "version": "0.8.4", - "range": "^0.8.1", - "licenses": "MIT", - "repoUrl": "https://github.com/bruce/node-temp", - "versionedRepoUrl": "https://github.com/bruce/node-temp/tree/v0.8.4", - "licenseFile": "node_modules/temp/LICENSE", - "licenseUrl": "https://github.com/bruce/node-temp/blob/v0.8.4/LICENSE", - "licenseTextSource": "file", - "publisher": "Bruce Williams", - "email": "brwcodes@gmail.com" - }, - "through@2.3.8": { - "name": "through", - "version": "2.3.8", - "range": "^2.3.6", - "licenses": "MIT", - "repoUrl": "https://github.com/dominictarr/through", - "versionedRepoUrl": "https://github.com/dominictarr/through/tree/v2.3.8", - "licenseFile": "node_modules/through/LICENSE.MIT", - "licenseUrl": "https://github.com/dominictarr/through/blob/v2.3.8/LICENSE.MIT", - "licenseTextSource": "file", - "publisher": "Dominic Tarr", - "email": "dominic.tarr@gmail.com", - "url": "dominictarr.com" - }, - "when@3.7.8": { - "name": "when", - "version": "3.7.8", - "range": "*", - "licenses": "MIT", - "repoUrl": "https://github.com/cujojs/when", - "versionedRepoUrl": "https://github.com/cujojs/when/tree/v3.7.8", - "licenseFile": "node_modules/when/LICENSE.txt", - "licenseUrl": "https://github.com/cujojs/when/blob/v3.7.8/LICENSE.txt", - "licenseTextSource": "file" - } - } -} diff --git a/node_modules/node-fetch/CHANGELOG.md b/node_modules/node-fetch/CHANGELOG.md deleted file mode 100644 index 543d3d94..00000000 --- a/node_modules/node-fetch/CHANGELOG.md +++ /dev/null @@ -1,272 +0,0 @@ - -Changelog -========= - - -# 2.x release - -## v2.6.1 - -**This is an important security release. It is strongly recommended to update as soon as possible.** - -- Fix: honor the `size` option after following a redirect. - -## v2.6.0 - -- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information. -- Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body. -- Fix: `Response.url` should return empty string instead of `null` by default. - -## v2.5.0 - -- Enhance: `Response` object now includes `redirected` property. -- Enhance: `fetch()` now accepts third-party `Blob` implementation as body. -- Other: disable `package-lock.json` generation as we never commit them. -- Other: dev dependency update. -- Other: readme update. - -## v2.4.1 - -- Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export. - -## v2.4.0 - -- Enhance: added `Brotli` compression support (using node's zlib). -- Enhance: updated `Blob` implementation per spec. -- Fix: set content type automatically for `URLSearchParams`. -- Fix: `Headers` now reject empty header names. -- Fix: test cases, as node 12+ no longer accepts invalid header response. - -## v2.3.0 - -- Enhance: added `AbortSignal` support, with README example. -- Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`. -- Fix: update `browser.js` to support react-native environment, where `self` isn't available globally. - -## v2.2.1 - -- Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header. -- Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag. -- Other: Better README. - -## v2.2.0 - -- Enhance: Support all `ArrayBuffer` view types -- Enhance: Support Web Workers -- Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file -- Fix: Add `__esModule` property to the exports object -- Other: Better example in README for writing response to a file -- Other: More tests for Agent - -## v2.1.2 - -- Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects -- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size -- Fix: support custom `Host` headers with any casing -- Fix: support importing `fetch()` from TypeScript in `browser.js` -- Fix: handle the redirect response body properly - -## v2.1.1 - -Fix packaging errors in v2.1.0. - -## v2.1.0 - -- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request` -- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner -- Fix: silently ignore invalid HTTP headers -- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses -- Fix: include bodies when following a redirection when appropriate - -## v2.0.0 - -This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2. - -### General changes - -- Major: Node.js 0.10.x and 0.12.x support is dropped -- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports -- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable -- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup) -- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings -- Other: rewrite in ES2015 using Babel -- Other: use Codecov for code coverage tracking -- Other: update package.json script for npm 5 -- Other: `encoding` module is now optional (alpha.7) -- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9) -- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9) - -### HTTP requests - -- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec) -- Fix: errors in a response are caught before the body is accessed -- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+ - -### Response and Request classes - -- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior -- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2) -- Major: internal methods are no longer exposed -- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec) -- Enhance: add `response.arrayBuffer()` (also applies to Requests) -- Enhance: add experimental `response.blob()` (also applies to Requests) -- Enhance: `URLSearchParams` is now accepted as a body -- Enhance: wrap `response.json()` json parsing error as `FetchError` -- Fix: fix Request and Response with `null` body - -### Headers class - -- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec) -- Enhance: make Headers iterable -- Enhance: make Headers constructor accept an array of tuples -- Enhance: make sure header names and values are valid in HTTP -- Fix: coerce Headers prototype function parameters to strings, where applicable - -### Documentation - -- Enhance: more comprehensive API docs -- Enhance: add a list of default headers in README - - -# 1.x release - -## backport releases (v1.7.0 and beyond) - -See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details. - -## v1.6.3 - -- Enhance: error handling document to explain `FetchError` design -- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0) - -## v1.6.2 - -- Enhance: minor document update -- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error - -## v1.6.1 - -- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string -- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance -- Fix: documentation update - -## v1.6.0 - -- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer -- Enhance: better old server support by handling raw deflate response -- Enhance: skip encoding detection for non-HTML/XML response -- Enhance: minor document update -- Fix: HEAD request doesn't need decompression, as body is empty -- Fix: `req.body` now accepts a Node.js buffer - -## v1.5.3 - -- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate -- Fix: allow resolving response and cloned response in any order -- Fix: avoid setting `content-length` when `form-data` body use streams -- Fix: send DELETE request with content-length when body is present -- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch - -## v1.5.2 - -- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent - -## v1.5.1 - -- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection - -## v1.5.0 - -- Enhance: rejected promise now use custom `Error` (thx to @pekeler) -- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) -- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR) - -## v1.4.1 - -- Fix: wrapping Request instance with FormData body again should preserve the body as-is - -## v1.4.0 - -- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR) -- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin) -- Enhance: Body constructor has been refactored out (thx to @kirill-konshin) -- Enhance: Headers now has `forEach` method (thx to @tricoder42) -- Enhance: back to 100% code coverage -- Fix: better form-data support (thx to @item4) -- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR) - -## v1.3.3 - -- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests -- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header -- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec -- Fix: `Request` and `Response` constructors now parse headers input using `Headers` - -## v1.3.2 - -- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature) - -## v1.3.1 - -- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side) - -## v1.3.0 - -- Enhance: now `fetch.Request` is exposed as well - -## v1.2.1 - -- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes - -## v1.2.0 - -- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier - -## v1.1.2 - -- Fix: `Headers` should only support `String` and `Array` properties, and ignore others - -## v1.1.1 - -- Enhance: now req.headers accept both plain object and `Headers` instance - -## v1.1.0 - -- Enhance: timeout now also applies to response body (in case of slow response) -- Fix: timeout is now cleared properly when fetch is done/has failed - -## v1.0.6 - -- Fix: less greedy content-type charset matching - -## v1.0.5 - -- Fix: when `follow = 0`, fetch should not follow redirect -- Enhance: update tests for better coverage -- Enhance: code formatting -- Enhance: clean up doc - -## v1.0.4 - -- Enhance: test iojs support -- Enhance: timeout attached to socket event only fire once per redirect - -## v1.0.3 - -- Fix: response size limit should reject large chunk -- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD) - -## v1.0.2 - -- Fix: added res.ok per spec change - -## v1.0.0 - -- Enhance: better test coverage and doc - - -# 0.x release - -## v0.1 - -- Major: initial public release diff --git a/node_modules/node-fetch/LICENSE.md b/node_modules/node-fetch/LICENSE.md deleted file mode 100644 index 660ffecb..00000000 --- a/node_modules/node-fetch/LICENSE.md +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 David Frank - -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. - diff --git a/node_modules/node-fetch/README.md b/node_modules/node-fetch/README.md deleted file mode 100644 index 2dde7428..00000000 --- a/node_modules/node-fetch/README.md +++ /dev/null @@ -1,590 +0,0 @@ -node-fetch -========== - -[![npm version][npm-image]][npm-url] -[![build status][travis-image]][travis-url] -[![coverage status][codecov-image]][codecov-url] -[![install size][install-size-image]][install-size-url] -[![Discord][discord-image]][discord-url] - -A light-weight module that brings `window.fetch` to Node.js - -(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567)) - -[![Backers][opencollective-image]][opencollective-url] - - - -- [Motivation](#motivation) -- [Features](#features) -- [Difference from client-side fetch](#difference-from-client-side-fetch) -- [Installation](#installation) -- [Loading and configuring the module](#loading-and-configuring-the-module) -- [Common Usage](#common-usage) - - [Plain text or HTML](#plain-text-or-html) - - [JSON](#json) - - [Simple Post](#simple-post) - - [Post with JSON](#post-with-json) - - [Post with form parameters](#post-with-form-parameters) - - [Handling exceptions](#handling-exceptions) - - [Handling client and server errors](#handling-client-and-server-errors) -- [Advanced Usage](#advanced-usage) - - [Streams](#streams) - - [Buffer](#buffer) - - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data) - - [Extract Set-Cookie Header](#extract-set-cookie-header) - - [Post data using a file stream](#post-data-using-a-file-stream) - - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart) - - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal) -- [API](#api) - - [fetch(url[, options])](#fetchurl-options) - - [Options](#options) - - [Class: Request](#class-request) - - [Class: Response](#class-response) - - [Class: Headers](#class-headers) - - [Interface: Body](#interface-body) - - [Class: FetchError](#class-fetcherror) -- [License](#license) -- [Acknowledgement](#acknowledgement) - - - -## Motivation - -Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. - -See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side). - -## Features - -- Stay consistent with `window.fetch` API. -- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences. -- Use native promise but allow substituting it with [insert your favorite promise library]. -- Use native Node streams for body on both request and response. -- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically. -- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting. - -## Difference from client-side fetch - -- See [Known Differences](LIMITS.md) for details. -- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue. -- Pull requests are welcomed too! - -## Installation - -Current stable release (`2.x`) - -```sh -$ npm install node-fetch -``` - -## Loading and configuring the module -We suggest you load the module via `require` until the stabilization of ES modules in node: -```js -const fetch = require('node-fetch'); -``` - -If you are using a Promise library other than native, set it through `fetch.Promise`: -```js -const Bluebird = require('bluebird'); - -fetch.Promise = Bluebird; -``` - -## Common Usage - -NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences. - -#### Plain text or HTML -```js -fetch('https://github.com/') - .then(res => res.text()) - .then(body => console.log(body)); -``` - -#### JSON - -```js - -fetch('https://api.github.com/users/github') - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Simple Post -```js -fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' }) - .then(res => res.json()) // expecting a json response - .then(json => console.log(json)); -``` - -#### Post with JSON - -```js -const body = { a: 1 }; - -fetch('https://httpbin.org/post', { - method: 'post', - body: JSON.stringify(body), - headers: { 'Content-Type': 'application/json' }, - }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Post with form parameters -`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods. - -NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such: - -```js -const { URLSearchParams } = require('url'); - -const params = new URLSearchParams(); -params.append('a', 1); - -fetch('https://httpbin.org/post', { method: 'POST', body: params }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Handling exceptions -NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information. - -Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details. - -```js -fetch('https://domain.invalid/') - .catch(err => console.error(err)); -``` - -#### Handling client and server errors -It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses: - -```js -function checkStatus(res) { - if (res.ok) { // res.status >= 200 && res.status < 300 - return res; - } else { - throw MyCustomError(res.statusText); - } -} - -fetch('https://httpbin.org/status/400') - .then(checkStatus) - .then(res => console.log('will not get here...')) -``` - -## Advanced Usage - -#### Streams -The "Node.js way" is to use streams when possible: - -```js -fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') - .then(res => { - const dest = fs.createWriteStream('./octocat.png'); - res.body.pipe(dest); - }); -``` - -#### Buffer -If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API) - -```js -const fileType = require('file-type'); - -fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') - .then(res => res.buffer()) - .then(buffer => fileType(buffer)) - .then(type => { /* ... */ }); -``` - -#### Accessing Headers and other Meta data -```js -fetch('https://github.com/') - .then(res => { - console.log(res.ok); - console.log(res.status); - console.log(res.statusText); - console.log(res.headers.raw()); - console.log(res.headers.get('content-type')); - }); -``` - -#### Extract Set-Cookie Header - -Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API. - -```js -fetch(url).then(res => { - // returns an array of values, instead of a string of comma-separated values - console.log(res.headers.raw()['set-cookie']); -}); -``` - -#### Post data using a file stream - -```js -const { createReadStream } = require('fs'); - -const stream = createReadStream('input.txt'); - -fetch('https://httpbin.org/post', { method: 'POST', body: stream }) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Post with form-data (detect multipart) - -```js -const FormData = require('form-data'); - -const form = new FormData(); -form.append('a', 1); - -fetch('https://httpbin.org/post', { method: 'POST', body: form }) - .then(res => res.json()) - .then(json => console.log(json)); - -// OR, using custom headers -// NOTE: getHeaders() is non-standard API - -const form = new FormData(); -form.append('a', 1); - -const options = { - method: 'POST', - body: form, - headers: form.getHeaders() -} - -fetch('https://httpbin.org/post', options) - .then(res => res.json()) - .then(json => console.log(json)); -``` - -#### Request cancellation with AbortSignal - -> NOTE: You may cancel streamed requests only on Node >= v8.0.0 - -You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller). - -An example of timing out a request after 150ms could be achieved as the following: - -```js -import AbortController from 'abort-controller'; - -const controller = new AbortController(); -const timeout = setTimeout( - () => { controller.abort(); }, - 150, -); - -fetch(url, { signal: controller.signal }) - .then(res => res.json()) - .then( - data => { - useData(data) - }, - err => { - if (err.name === 'AbortError') { - // request was aborted - } - }, - ) - .finally(() => { - clearTimeout(timeout); - }); -``` - -See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples. - - -## API - -### fetch(url[, options]) - -- `url` A string representing the URL for fetching -- `options` [Options](#fetch-options) for the HTTP(S) request -- Returns: Promise<[Response](#class-response)> - -Perform an HTTP(S) fetch. - -`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`. - - -### Options - -The default values are shown after each option key. - -```js -{ - // These properties are part of the Fetch Standard - method: 'GET', - headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below) - body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream - redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect - signal: null, // pass an instance of AbortSignal to optionally abort requests - - // The following properties are node-fetch extensions - follow: 20, // maximum redirect count. 0 to not follow redirect - timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead. - compress: true, // support gzip/deflate content encoding. false to disable - size: 0, // maximum response body size in bytes. 0 to disable - agent: null // http(s).Agent instance or function that returns an instance (see below) -} -``` - -##### Default Headers - -If no values are set, the following request headers will be sent automatically: - -Header | Value -------------------- | -------------------------------------------------------- -`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ -`Accept` | `*/*` -`Connection` | `close` _(when no `options.agent` is present)_ -`Content-Length` | _(automatically calculated, if possible)_ -`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ -`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)` - -Note: when `body` is a `Stream`, `Content-Length` is not set automatically. - -##### Custom Agent - -The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following: - -- Support self-signed certificate -- Use only IPv4 or IPv6 -- Custom DNS Lookup - -See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information. - -In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol. - -```js -const httpAgent = new http.Agent({ - keepAlive: true -}); -const httpsAgent = new https.Agent({ - keepAlive: true -}); - -const options = { - agent: function (_parsedURL) { - if (_parsedURL.protocol == 'http:') { - return httpAgent; - } else { - return httpsAgent; - } - } -} -``` - - -### Class: Request - -An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface. - -Due to the nature of Node.js, the following properties are not implemented at this moment: - -- `type` -- `destination` -- `referrer` -- `referrerPolicy` -- `mode` -- `credentials` -- `cache` -- `integrity` -- `keepalive` - -The following node-fetch extension properties are provided: - -- `follow` -- `compress` -- `counter` -- `agent` - -See [options](#fetch-options) for exact meaning of these extensions. - -#### new Request(input[, options]) - -*(spec-compliant)* - -- `input` A string representing a URL, or another `Request` (which will be cloned) -- `options` [Options][#fetch-options] for the HTTP(S) request - -Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). - -In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object. - - -### Class: Response - -An HTTP(S) response. This class implements the [Body](#iface-body) interface. - -The following properties are not implemented in node-fetch at this moment: - -- `Response.error()` -- `Response.redirect()` -- `type` -- `trailer` - -#### new Response([body[, options]]) - -*(spec-compliant)* - -- `body` A `String` or [`Readable` stream][node-readable] -- `options` A [`ResponseInit`][response-init] options dictionary - -Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response). - -Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly. - -#### response.ok - -*(spec-compliant)* - -Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. - -#### response.redirected - -*(spec-compliant)* - -Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0. - - -### Class: Headers - -This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented. - -#### new Headers([init]) - -*(spec-compliant)* - -- `init` Optional argument to pre-fill the `Headers` object - -Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object. - -```js -// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class - -const meta = { - 'Content-Type': 'text/xml', - 'Breaking-Bad': '<3' -}; -const headers = new Headers(meta); - -// The above is equivalent to -const meta = [ - [ 'Content-Type', 'text/xml' ], - [ 'Breaking-Bad', '<3' ] -]; -const headers = new Headers(meta); - -// You can in fact use any iterable objects, like a Map or even another Headers -const meta = new Map(); -meta.set('Content-Type', 'text/xml'); -meta.set('Breaking-Bad', '<3'); -const headers = new Headers(meta); -const copyOfHeaders = new Headers(headers); -``` - - -### Interface: Body - -`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes. - -The following methods are not yet implemented in node-fetch at this moment: - -- `formData()` - -#### body.body - -*(deviation from spec)* - -* Node.js [`Readable` stream][node-readable] - -Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable]. - -#### body.bodyUsed - -*(spec-compliant)* - -* `Boolean` - -A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again. - -#### body.arrayBuffer() -#### body.blob() -#### body.json() -#### body.text() - -*(spec-compliant)* - -* Returns: Promise - -Consume the body and return a promise that will resolve to one of these formats. - -#### body.buffer() - -*(node-fetch extension)* - -* Returns: Promise<Buffer> - -Consume the body and return a promise that will resolve to a Buffer. - -#### body.textConverted() - -*(node-fetch extension)* - -* Returns: Promise<String> - -Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible. - -(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.) - - -### Class: FetchError - -*(node-fetch extension)* - -An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info. - - -### Class: AbortError - -*(node-fetch extension)* - -An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info. - -## Acknowledgement - -Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference. - -`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr). - -## License - -MIT - -[npm-image]: https://flat.badgen.net/npm/v/node-fetch -[npm-url]: https://www.npmjs.com/package/node-fetch -[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch -[travis-url]: https://travis-ci.org/bitinn/node-fetch -[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master -[codecov-url]: https://codecov.io/gh/bitinn/node-fetch -[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch -[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch -[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square -[discord-url]: https://discord.gg/Zxbndcm -[opencollective-image]: https://opencollective.com/node-fetch/backers.svg -[opencollective-url]: https://opencollective.com/node-fetch -[whatwg-fetch]: https://fetch.spec.whatwg.org/ -[response-init]: https://fetch.spec.whatwg.org/#responseinit -[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams -[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers -[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md -[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md -[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md diff --git a/node_modules/node-fetch/browser.js b/node_modules/node-fetch/browser.js deleted file mode 100644 index 83c54c58..00000000 --- a/node_modules/node-fetch/browser.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -// ref: https://github.com/tc39/proposal-global -var getGlobal = function () { - // the only reliable means to get the global object is - // `Function('return this')()` - // However, this causes CSP violations in Chrome apps. - if (typeof self !== 'undefined') { return self; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - throw new Error('unable to locate global object'); -} - -var global = getGlobal(); - -module.exports = exports = global.fetch; - -// Needed for TypeScript and Webpack. -if (global.fetch) { - exports.default = global.fetch.bind(global); -} - -exports.Headers = global.Headers; -exports.Request = global.Request; -exports.Response = global.Response; \ No newline at end of file diff --git a/node_modules/node-fetch/lib/index.es.js b/node_modules/node-fetch/lib/index.es.js deleted file mode 100644 index 61906c95..00000000 --- a/node_modules/node-fetch/lib/index.es.js +++ /dev/null @@ -1,1640 +0,0 @@ -process.emitWarning("The .es.js file is deprecated. Use .mjs instead."); - -import Stream from 'stream'; -import http from 'http'; -import Url from 'url'; -import https from 'https'; -import zlib from 'zlib'; - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout, - size: request.size - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -export default fetch; -export { Headers, Request, Response, FetchError }; diff --git a/node_modules/node-fetch/lib/index.js b/node_modules/node-fetch/lib/index.js deleted file mode 100644 index 4b241bfb..00000000 --- a/node_modules/node-fetch/lib/index.js +++ /dev/null @@ -1,1649 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var Stream = _interopDefault(require('stream')); -var http = _interopDefault(require('http')); -var Url = _interopDefault(require('url')); -var https = _interopDefault(require('https')); -var zlib = _interopDefault(require('zlib')); - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout, - size: request.size - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -module.exports = exports = fetch; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = exports; -exports.Headers = Headers; -exports.Request = Request; -exports.Response = Response; -exports.FetchError = FetchError; diff --git a/node_modules/node-fetch/lib/index.mjs b/node_modules/node-fetch/lib/index.mjs deleted file mode 100644 index ecf59af8..00000000 --- a/node_modules/node-fetch/lib/index.mjs +++ /dev/null @@ -1,1638 +0,0 @@ -import Stream from 'stream'; -import http from 'http'; -import Url from 'url'; -import https from 'https'; -import zlib from 'zlib'; - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; - - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } - - this[BUFFER] = Buffer.concat(buffers); - - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } - } - get size() { - return this[BUFFER].length; - } - get type() { - return this[TYPE]; - } - text() { - return Promise.resolve(this[BUFFER].toString()); - } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); - } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; - } - toString() { - return '[object Blob]'; - } - slice() { - const size = this.size; - - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); - - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; - } -} - -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); - -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * fetch-error.js - * - * FetchError interface for operational errors - */ - -/** - * Create FetchError instance - * - * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError - */ -function FetchError(message, type, systemError) { - Error.call(this, message); - - this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; - -let convert; -try { - convert = require('encoding').convert; -} catch (e) {} - -const INTERNALS = Symbol('Body internals'); - -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; - -/** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -function Body(body) { - var _this = this; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; - - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; - - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, - - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, - - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; - - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); - } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, - - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, - - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; - - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; - -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); - -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); - } - } -}; - -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; - - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } - - this[INTERNALS].disturbed = true; - - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } - - let body = this.body; - - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is blob - if (isBlob(body)) { - body = body.stream(); - } - - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } - - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } - - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; - - return new Body.Promise(function (resolve, reject) { - let resTimeout; - - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } - - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } - - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); - return; - } - - accumBytes += chunk.length; - accum.push(chunk); - }); - - body.on('end', function () { - if (abort) { - return; - } - - clearTimeout(resTimeout); - - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); - } - }); - }); -} - -/** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding - * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String - */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } - - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; - - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } - - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - - // html5 - if (!res && str) { - res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - this[MAP] = Object.create(null); - - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); - - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } - - return; - } - - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } - - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } - - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } - - return this[MAP][key].join(', '); - } - - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; - - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; - - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } - - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } - - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } - - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } - - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } - - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } - - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } - - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } - - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); - -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; - - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} - -const INTERNAL = Symbol('internal'); - -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; -} - -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } - - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; - - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } - - this[INTERNAL].index = index + 1; - - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); - -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); - -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); - - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } - - return obj; -} - -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} - -const INTERNALS$1 = Symbol('Response internals'); - -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; - -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - Body.call(this, body, opts); - - const status = opts.status || 200; - const headers = new Headers(opts.headers); - - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } - - get url() { - return this[INTERNALS$1].url || ''; - } - - get status() { - return this[INTERNALS$1].status; - } - - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } - - get redirected() { - return this[INTERNALS$1].counter > 0; - } - - get statusText() { - return this[INTERNALS$1].statusText; - } - - get headers() { - return this[INTERNALS$1].headers; - } - - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} - -Body.mixIn(Response.prototype); - -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); - -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); - -const INTERNALS$2 = Symbol('Request internals'); - -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; - -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; - -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} - -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} - -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - let parsedURL; - - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parse_url(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parse_url(`${input}`); - } - input = {}; - } else { - parsedURL = parse_url(input.url); - } - - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); - - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } - - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; - - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); - - const headers = new Headers(init.headers || input.headers || {}); - - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } - - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; - - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } - - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; - - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } - - get method() { - return this[INTERNALS$2].method; - } - - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } - - get headers() { - return this[INTERNALS$2].headers; - } - - get redirect() { - return this[INTERNALS$2].redirect; - } - - get signal() { - return this[INTERNALS$2].signal; - } - - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); - -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); - -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); - -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); - - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } - - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } - - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } - - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } - - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } - - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } - - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } - - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } - - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } - - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js - - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} - -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ - -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); - - this.type = 'aborted'; - this.message = message; - - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} - -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; - -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; -const resolve_url = Url.resolve; - -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); - - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; - - let response = null; - - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - - if (signal && signal.aborted) { - abort(); - return; - } - - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; - - // send request - const req = send(options); - let reqTimeout; - - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } - - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } - - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); - - req.on('response', function (res) { - clearTimeout(reqTimeout); - - const headers = createHeadersLenient(res.headers); - - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); - - // HTTP fetch step 5.3 - const locationURL = location === null ? null : resolve_url(request.url, location); - - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } - - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout, - size: request.size - }; - - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } - - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } - - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); - - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; -}; - -// expose Promise -fetch.Promise = global.Promise; - -export default fetch; -export { Headers, Request, Response, FetchError }; diff --git a/node_modules/node-fetch/package.json b/node_modules/node-fetch/package.json deleted file mode 100644 index fae74dc5..00000000 --- a/node_modules/node-fetch/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "_from": "node-fetch@2.6.1", - "_id": "node-fetch@2.6.1", - "_inBundle": false, - "_integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "_location": "/node-fetch", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "node-fetch@2.6.1", - "name": "node-fetch", - "escapedName": "node-fetch", - "rawSpec": "2.6.1", - "saveSpec": null, - "fetchSpec": "2.6.1" - }, - "_requiredBy": [ - "/cross-fetch" - ], - "_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "_shasum": "045bd323631f76ed2e2b55573394416b639a0052", - "_spec": "node-fetch@2.6.1", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/cross-fetch", - "author": { - "name": "David Frank" - }, - "browser": "./browser.js", - "bugs": { - "url": "https://github.com/bitinn/node-fetch/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "A light-weight module that brings window.fetch to node.js", - "devDependencies": { - "@ungap/url-search-params": "^0.1.2", - "abort-controller": "^1.1.0", - "abortcontroller-polyfill": "^1.3.0", - "babel-core": "^6.26.3", - "babel-plugin-istanbul": "^4.1.6", - "babel-preset-env": "^1.6.1", - "babel-register": "^6.16.3", - "chai": "^3.5.0", - "chai-as-promised": "^7.1.1", - "chai-iterator": "^1.1.1", - "chai-string": "~1.3.0", - "codecov": "^3.3.0", - "cross-env": "^5.2.0", - "form-data": "^2.3.3", - "is-builtin-module": "^1.0.0", - "mocha": "^5.0.0", - "nyc": "11.9.0", - "parted": "^0.1.1", - "promise": "^8.0.3", - "resumer": "0.0.0", - "rollup": "^0.63.4", - "rollup-plugin-babel": "^3.0.7", - "string-to-arraybuffer": "^1.0.2", - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "files": [ - "lib/index.js", - "lib/index.mjs", - "lib/index.es.js", - "browser.js" - ], - "homepage": "https://github.com/bitinn/node-fetch", - "keywords": [ - "fetch", - "http", - "promise" - ], - "license": "MIT", - "main": "lib/index", - "module": "lib/index.mjs", - "name": "node-fetch", - "repository": { - "type": "git", - "url": "git+https://github.com/bitinn/node-fetch.git" - }, - "scripts": { - "build": "cross-env BABEL_ENV=rollup rollup -c", - "coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json", - "prepare": "npm run build", - "report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js", - "test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js" - }, - "version": "2.6.1" -} diff --git a/node_modules/node-forge/CHANGELOG.md b/node_modules/node-forge/CHANGELOG.md deleted file mode 100644 index 81176fa8..00000000 --- a/node_modules/node-forge/CHANGELOG.md +++ /dev/null @@ -1,265 +0,0 @@ -Forge ChangeLog -=============== - -## 0.10.0 - 2019-09-01 - -### Changed -- **BREAKING**: Node.js 4 no longer supported. The code *may* still work, and - non-invasive patches to keep it working will be considered. However, more - modern tools no longer support old Node.js versions making testing difficult. - -### Removed -- **BREAKING**: Remove `util.getPath`, `util.setPath`, and `util.deletePath`. - `util.setPath` had a potential prototype pollution security issue when used - with unsafe inputs. These functions are not used by `forge` itself. They date - from an early time when `forge` was targeted at providing general helper - functions. The library direction changed to be more focused on cryptography. - Many other excellent libraries are more suitable for general utilities. If - you need a replacement for these functions, consier `get`, `set`, and `unset` - from [lodash](https://lodash.com/). But also consider the potential similar - security issues with those APIs. - -## 0.9.2 - 2019-09-01 - -### Changed -- Added `util.setPath` security note to function docs and to README. - -### Notes -- **SECURITY**: The `util.setPath` function has the potential to cause - prototype pollution if used with unsafe input. - - This function is **not** used internally by `forge`. - - The rest of the library is unaffected by this issue. - - **Do not** use unsafe input with this function. - - Usage with known input should function as expected. (Including input - intentionally using potentially problematic keys.) - - No code changes will be made to address this issue in 0.9.x. The current - behavior *could* be considered a feature rather than a security issue. - 0.10.0 will be released that removes `util.getPath` and `util.setPath`. - Consider `get` and `set` from [lodash](https://lodash.com/) if you need - replacements. But also consider the potential similar security issues with - those APIs. - - https://snyk.io/vuln/SNYK-JS-NODEFORGE-598677 - - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7720 - -## 0.9.1 - 2019-09-26 - -### Fixed -- Ensure DES-CBC given IV is long enough for block size. - -## 0.9.0 - 2019-09-04 - -### Added -- Add ed25519.publicKeyFromAsn1 and ed25519.privateKeyFromAsn1 APIs. -- A few OIDs used in EV certs. - -### Fixed -- Improve ed25519 NativeBuffer check. - -## 0.8.5 - 2019-06-18 - -### Fixed -- Remove use of `const`. - -## 0.8.4 - 2019-05-22 - -### Changed -- Replace all instances of Node.js `new Buffer` with `Buffer.from` and `Buffer.alloc`. - -## 0.8.3 - 2019-05-15 - -### Fixed -- Use basic character set for code. - -## 0.8.2 - 2019-03-18 - -### Fixed -- Fix tag calculation when continuing an AES-GCM block. - -### Changed -- Switch to eslint. - -## 0.8.1 - 2019-02-23 - -### Fixed -- Fix off-by-1 bug with kem random generation. - -## 0.8.0 - 2019-01-31 - -### Fixed -- Handle creation of certificates with `notBefore` and `notAfter` dates less - than Jan 1, 1950 or greater than or equal to Jan 1, 2050. - -### Added -- Add OID 2.5.4.13 "description". -- Add OID 2.16.840.1.113730.1.13 "nsComment". - - Also handle extension when creating a certificate. -- `pki.verifyCertificateChain`: - - Add `validityCheckDate` option to allow checking the certificate validity - period against an arbitrary `Date` or `null` for no check at all. The - current date is used by default. -- `tls.createConnection`: - - Add `verifyOptions` option that passes through to - `pki.verifyCertificateChain`. Can be used for the above `validityCheckDate` - option. - -### Changed -- Support WebCrypto API in web workers. -- `rsa.generateKeyPair`: - - Use `crypto.generateKeyPair`/`crypto.generateKeyPairSync` on Node.js if - available (10.12.0+) and not in pure JS mode. - - Use JS fallback in `rsa.generateKeyPair` if `prng` option specified since - this isn't supported by current native APIs. - - Only run key generation comparison tests if keys will be deterministic. -- PhantomJS is deprecated, now using Headless Chrome with Karma. -- **Note**: Using Headless Chrome vs PhantomJS may cause newer JS features to - slip into releases without proper support for older runtimes and browsers. - Please report such issues and they will be addressed. -- `pki.verifyCertificateChain`: - - Signature changed to `(caStore, chain, options)`. Older `(caStore, chain, - verify)` signature is still supported. New style is to to pass in a - `verify` option. - -## 0.7.6 - 2018-08-14 - -### Added -- Test on Node.js 10.x. -- Support for PKCS#7 detached signatures. - -### Changed -- Improve webpack/browser detection. - -## 0.7.5 - 2018-03-30 - -### Fixed -- Remove use of `const`. - -## 0.7.4 - 2018-03-07 - -### Fixed -- Potential regex denial of service in form.js. - -### Added -- Support for ED25519. -- Support for baseN/base58. - -## 0.7.3 - 2018-03-05 - -- Re-publish with npm 5.6.0 due to file timestamp issues. - -## 0.7.2 - 2018-02-27 - -### Added -- Support verification of SHA-384 certificates. -- `1.2.840.10040.4.3'`/`dsa-with-sha1` OID. - -### Fixed -- Support importing PKCS#7 data with no certificates. RFC 2315 sec 9.1 states - certificates are optional. -- `asn1.equals` loop bug. -- Fortuna implementation bugs. - -## 0.7.1 - 2017-03-27 - -### Fixed - -- Fix digestLength for hashes based on SHA-512. - -## 0.7.0 - 2017-02-07 - -### Fixed - -- Fix test looping bugs so all tests are run. -- Improved ASN.1 parsing. Many failure cases eliminated. More sanity checks. - Better behavior in default mode of parsing BIT STRINGs. Better handling of - parsed BIT STRINGs in `toDer()`. More tests. -- Improve X.509 BIT STRING handling by using new capture modes. - -### Changed - -- Major refactor to use CommonJS plus a browser build system. -- Updated tests, examples, docs. -- Updated dependencies. -- Updated flash build system. -- Improve OID mapping code. -- Change test servers from Python to JavaScript. -- Improve PhantomJS support. -- Move Bower/bundle support to - [forge-dist](https://github.com/digitalbazaar/forge-dist). -- **BREAKING**: Require minimal digest algorithm dependencies from individual - modules. -- Enforce currently supported bit param values for byte buffer access. May be - **BREAKING** for code that depended on unspecified and/or incorrect behavior. -- Improve `asn1.prettyPrint()` BIT STRING display. - -### Added - -- webpack bundler support via `npm run build`: - - Builds `.js`, `.min.js`, and basic sourcemaps. - - Basic build: `forge.js`. - - Build with extra utils and networking support: `forge.all.js`. - - Build WebWorker support: `prime.worker.js`. -- Browserify support in package.json. -- Karma browser testing. -- `forge.options` field. -- `forge.options.usePureJavaScript` flag. -- `forge.util.isNodejs` flag (used to select "native" APIs). -- Run PhantomJS tests in Travis-CI. -- Add "Donations" section to README. -- Add IRC to "Contact" section of README. -- Add "Security Considerations" section to README. -- Add pbkdf2 usePureJavaScript test. -- Add rsa.generateKeyPair async and usePureJavaScript tests. -- Add .editorconfig support. -- Add `md.all.js` which includes all digest algorithms. -- Add asn1 `equals()` and `copy()`. -- Add asn1 `validate()` capture options for BIT STRING contents and value. - -### Removed - -- **BREAKING**: Can no longer call `forge({...})` to create new instances. -- Remove a large amount of old cruft. - -### Migration from 0.6.x to 0.7.x - -- (all) If you used the feature to create a new forge instance with new - configuration options you will need to rework your code. That ability has - been removed due to implementation complexity. The main rare use was to set - the option to use pure JavaScript. That is now available as a library global - flag `forge.options.usePureJavaScript`. -- (npm,bower) If you used the default main file there is little to nothing to - change. -- (npm) If you accessed a sub-resource like `forge/js/pki` you should either - switch to just using the main `forge` and access `forge.pki` or update to - `forge/lib/pki`. -- (bower) If you used a sub-resource like `forge/js/pki` you should switch to - just using `forge` and access `forge.pki`. The bower release bundles - everything in one minified file. -- (bower) A configured workerScript like - `/bower_components/forge/js/prime.worker.js` will need to change to - `/bower_components/forge/dist/prime.worker.min.js`. -- (all) If you used the networking support or flash socket support, you will - need to use a custom build and/or adjust where files are loaded from. This - functionality is not included in the bower distribution by default and is - also now in a different directory. -- (all) The library should now directly support building custom bundles with - webpack, browserify, or similar. -- (all) If building a custom bundle ensure the correct dependencies are - included. In particular, note there is now a `md.all.js` file to include all - digest algorithms. Individual files limit what they include by default to - allow smaller custom builds. For instance, `pbdkf2.js` has a `sha1` default - but does not include any algorithm files by default. This allows the - possibility to include only `sha256` without the overhead of `sha1` and - `sha512`. - -### Notes - -- This major update requires updating the version to 0.7.x. The existing - work-in-progress "0.7.x" branch will be painfully rebased on top of this new - 0.7.x and moved forward to 0.8.x or later as needed. -- 0.7.x is a start of simplifying forge based on common issues and what has - appeared to be the most common usage. Please file issues with feedback if the - changes are problematic for your use cases. - -## 0.6.x - 2016 and earlier - -- See Git commit log or https://github.com/digitalbazaar/forge. diff --git a/node_modules/node-forge/LICENSE b/node_modules/node-forge/LICENSE deleted file mode 100644 index 2b48a95b..00000000 --- a/node_modules/node-forge/LICENSE +++ /dev/null @@ -1,331 +0,0 @@ -You may use the Forge project under the terms of either the BSD License or the -GNU General Public License (GPL) Version 2. - -The BSD License is recommended for most projects. It is simple and easy to -understand and it places almost no restrictions on what you can do with the -Forge project. - -If the GPL suits your project better you are also free to use Forge under -that license. - -You don't have to do anything special to choose one license or the other and -you don't have to notify anyone which license you are using. You are free to -use this project in commercial projects as long as the copyright header is -left intact. - -If you are a commercial entity and use this set of libraries in your -commercial software then reasonable payment to Digital Bazaar, if you can -afford it, is not required but is expected and would be appreciated. If this -library saves you time, then it's saving you money. The cost of developing -the Forge software was on the order of several hundred hours and tens of -thousands of dollars. We are attempting to strike a balance between helping -the development community while not being taken advantage of by lucrative -commercial entities for our efforts. - -------------------------------------------------------------------------------- -New BSD License (3-clause) -Copyright (c) 2010, Digital Bazaar, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Digital Bazaar, Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL DIGITAL BAZAAR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - diff --git a/node_modules/node-forge/README.md b/node_modules/node-forge/README.md deleted file mode 100644 index 40bf2956..00000000 --- a/node_modules/node-forge/README.md +++ /dev/null @@ -1,2099 +0,0 @@ -# Forge - -[![npm package](https://nodei.co/npm/node-forge.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/node-forge/) - -[![Build status](https://img.shields.io/travis/digitalbazaar/forge.svg?branch=master)](https://travis-ci.org/digitalbazaar/forge) - -A native implementation of [TLS][] (and various other cryptographic tools) in -[JavaScript][]. - -Introduction ------------- - -The Forge software is a fully native implementation of the [TLS][] protocol -in JavaScript, a set of cryptography utilities, and a set of tools for -developing Web Apps that utilize many network resources. - -Performance ------------- - -Forge is fast. Benchmarks against other popular JavaScript cryptography -libraries can be found here: - -* http://dominictarr.github.io/crypto-bench/ -* http://cryptojs.altervista.org/test/simulate-threading-speed_test.html - -Documentation -------------- - -* [Introduction](#introduction) -* [Performance](#performance) -* [Installation](#installation) -* [Testing](#testing) -* [Contributing](#contributing) - -### API - -* [Options](#options) - -### Transports - -* [TLS](#tls) -* [HTTP](#http) -* [SSH](#ssh) -* [XHR](#xhr) -* [Sockets](#socket) - -### Ciphers - -* [CIPHER](#cipher) -* [AES](#aes) -* [DES](#des) -* [RC2](#rc2) - -### PKI - -* [ED25519](#ed25519) -* [RSA](#rsa) -* [RSA-KEM](#rsakem) -* [X.509](#x509) -* [PKCS#5](#pkcs5) -* [PKCS#7](#pkcs7) -* [PKCS#8](#pkcs8) -* [PKCS#10](#pkcs10) -* [PKCS#12](#pkcs12) -* [ASN.1](#asn) - -### Message Digests - -* [SHA1](#sha1) -* [SHA256](#sha256) -* [SHA384](#sha384) -* [SHA512](#sha512) -* [MD5](#md5) -* [HMAC](#hmac) - -### Utilities - -* [Prime](#prime) -* [PRNG](#prng) -* [Tasks](#task) -* [Utilities](#util) -* [Logging](#log) -* [Debugging](#debug) -* [Flash Networking Support](#flash) - -### Other - -* [Security Considerations](#security-considerations) -* [Library Background](#library-background) -* [Contact](#contact) -* [Donations](#donations) - ---------------------------------------- - -Installation ------------- - -**Note**: Please see the [Security Considerations](#security-considerations) -section before using packaging systems and pre-built files. - -Forge uses a [CommonJS][] module structure with a build process for browser -bundles. The older [0.6.x][] branch with standalone files is available but will -not be regularly updated. - -### Node.js - -If you want to use forge with [Node.js][], it is available through `npm`: - -https://npmjs.org/package/node-forge - -Installation: - - npm install node-forge - -You can then use forge as a regular module: - -```js -var forge = require('node-forge'); -``` - -The npm package includes pre-built `forge.min.js`, `forge.all.min.js`, and -`prime.worker.min.js` using the [UMD][] format. - -### Bundle / Bower - -Each release is published in a separate repository as pre-built and minimized -basic forge bundles using the [UMD][] format. - -https://github.com/digitalbazaar/forge-dist - -This bundle can be used in many environments. In particular it can be installed -with [Bower][]: - - bower install forge - -### jsDelivr CDN - -To use it via [jsDelivr](https://www.jsdelivr.com/package/npm/node-forge) include this in your html: - -```html - -``` - -### unpkg CDN - -To use it via [unpkg](https://unpkg.com/#/) include this in your html: - -```html - -``` - -### Development Requirements - -The core JavaScript has the following requirements to build and test: - -* Building a browser bundle: - * Node.js - * npm -* Testing - * Node.js - * npm - * Chrome, Firefox, Safari (optional) - -Some special networking features can optionally use a Flash component. See the -[Flash README](./flash/README.md) for details. - -### Building for a web browser - -To create single file bundles for use with browsers run the following: - - npm install - npm run build - -This will create single non-minimized and minimized files that can be -included in the browser: - - dist/forge.js - dist/forge.min.js - -A bundle that adds some utilities and networking support is also available: - - dist/forge.all.js - dist/forge.all.min.js - -Include the file via: - -```html - -``` -or -```html - -``` - -The above bundles will synchronously create a global 'forge' object. - -**Note**: These bundles will not include any WebWorker scripts (eg: -`dist/prime.worker.js`), so these will need to be accessible from the browser -if any WebWorkers are used. - -### Building a custom browser bundle - -The build process uses [webpack][] and the [config](./webpack.config.js) file -can be modified to generate a file or files that only contain the parts of -forge you need. - -[Browserify][] override support is also present in `package.json`. - -Testing -------- - -### Prepare to run tests - - npm install - -### Running automated tests with Node.js - -Forge natively runs in a [Node.js][] environment: - - npm test - -### Running automated tests with Headless Chrome - -Automated testing is done via [Karma][]. By default it will run the tests with -Headless Chrome. - - npm run test-karma - -Is 'mocha' reporter output too verbose? Other reporters are available. Try -'dots', 'progress', or 'tap'. - - npm run test-karma -- --reporters progress - -By default [webpack][] is used. [Browserify][] can also be used. - - BUNDLER=browserify npm run test-karma - -### Running automated tests with one or more browsers - -You can also specify one or more browsers to use. - - npm run test-karma -- --browsers Chrome,Firefox,Safari,ChromeHeadless - -The reporter option and `BUNDLER` environment variable can also be used. - -### Running manual tests in a browser - -Testing in a browser uses [webpack][] to combine forge and all tests and then -loading the result in a browser. A simple web server is provided that will -output the HTTP or HTTPS URLs to load. It also will start a simple Flash Policy -Server. Unit tests and older legacy tests are provided. Custom ports can be -used by running `node tests/server.js` manually. - -To run the unit tests in a browser a special forge build is required: - - npm run test-build - -To run legacy browser based tests the main forge build is required: - - npm run build - -The tests are run with a custom server that prints out the URLs to use: - - npm run test-server - -### Running other tests - -There are some other random tests and benchmarks available in the tests -directory. - -### Coverage testing - -To perform coverage testing of the unit tests, run the following. The results -will be put in the `coverage/` directory. Note that coverage testing can slow -down some tests considerably. - - npm install - npm run coverage - -Contributing ------------- - -Any contributions (eg: PRs) that are accepted will be brought under the same -license used by the rest of the Forge project. This license allows Forge to -be used under the terms of either the BSD License or the GNU General Public -License (GPL) Version 2. - -See: [LICENSE](https://github.com/digitalbazaar/forge/blob/cbebca3780658703d925b61b2caffb1d263a6c1d/LICENSE) - -If a contribution contains 3rd party source code with its own license, it -may retain it, so long as that license is compatible with the Forge license. - -API ---- - - - -### Options - -If at any time you wish to disable the use of native code, where available, -for particular forge features like its secure random number generator, you -may set the ```forge.options.usePureJavaScript``` flag to ```true```. It is -not recommended that you set this flag as native code is typically more -performant and may have stronger security properties. It may be useful to -set this flag to test certain features that you plan to run in environments -that are different from your testing environment. - -To disable native code when including forge in the browser: - -```js -// run this *after* including the forge script -forge.options.usePureJavaScript = true; -``` - -To disable native code when using Node.js: - -```js -var forge = require('node-forge'); -forge.options.usePureJavaScript = true; -``` - -Transports ----------- - - - -### TLS - -Provides a native javascript client and server-side [TLS][] implementation. - -__Examples__ - -```js -// create TLS client -var client = forge.tls.createConnection({ - server: false, - caStore: /* Array of PEM-formatted certs or a CA store object */, - sessionCache: {}, - // supported cipher suites in order of preference - cipherSuites: [ - forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA, - forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA], - virtualHost: 'example.com', - verify: function(connection, verified, depth, certs) { - if(depth === 0) { - var cn = certs[0].subject.getField('CN').value; - if(cn !== 'example.com') { - verified = { - alert: forge.tls.Alert.Description.bad_certificate, - message: 'Certificate common name does not match hostname.' - }; - } - } - return verified; - }, - connected: function(connection) { - console.log('connected'); - // send message to server - connection.prepare(forge.util.encodeUtf8('Hi server!')); - /* NOTE: experimental, start heartbeat retransmission timer - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000);*/ - }, - /* provide a client-side cert if you want - getCertificate: function(connection, hint) { - return myClientCertificate; - }, - /* the private key for the client-side cert if provided */ - getPrivateKey: function(connection, cert) { - return myClientPrivateKey; - }, - tlsDataReady: function(connection) { - // TLS data (encrypted) is ready to be sent to the server - sendToServerSomehow(connection.tlsData.getBytes()); - // if you were communicating with the server below, you'd do: - // server.process(connection.tlsData.getBytes()); - }, - dataReady: function(connection) { - // clear data from the server is ready - console.log('the server sent: ' + - forge.util.decodeUtf8(connection.data.getBytes())); - // close connection - connection.close(); - }, - /* NOTE: experimental - heartbeatReceived: function(connection, payload) { - // restart retransmission timer, look at payload - clearInterval(myHeartbeatTimer); - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000); - payload.getBytes(); - },*/ - closed: function(connection) { - console.log('disconnected'); - }, - error: function(connection, error) { - console.log('uh oh', error); - } -}); - -// start the handshake process -client.handshake(); - -// when encrypted TLS data is received from the server, process it -client.process(encryptedBytesFromServer); - -// create TLS server -var server = forge.tls.createConnection({ - server: true, - caStore: /* Array of PEM-formatted certs or a CA store object */, - sessionCache: {}, - // supported cipher suites in order of preference - cipherSuites: [ - forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA, - forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA], - // require a client-side certificate if you want - verifyClient: true, - verify: function(connection, verified, depth, certs) { - if(depth === 0) { - var cn = certs[0].subject.getField('CN').value; - if(cn !== 'the-client') { - verified = { - alert: forge.tls.Alert.Description.bad_certificate, - message: 'Certificate common name does not match expected client.' - }; - } - } - return verified; - }, - connected: function(connection) { - console.log('connected'); - // send message to client - connection.prepare(forge.util.encodeUtf8('Hi client!')); - /* NOTE: experimental, start heartbeat retransmission timer - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000);*/ - }, - getCertificate: function(connection, hint) { - return myServerCertificate; - }, - getPrivateKey: function(connection, cert) { - return myServerPrivateKey; - }, - tlsDataReady: function(connection) { - // TLS data (encrypted) is ready to be sent to the client - sendToClientSomehow(connection.tlsData.getBytes()); - // if you were communicating with the client above you'd do: - // client.process(connection.tlsData.getBytes()); - }, - dataReady: function(connection) { - // clear data from the client is ready - console.log('the client sent: ' + - forge.util.decodeUtf8(connection.data.getBytes())); - // close connection - connection.close(); - }, - /* NOTE: experimental - heartbeatReceived: function(connection, payload) { - // restart retransmission timer, look at payload - clearInterval(myHeartbeatTimer); - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000); - payload.getBytes(); - },*/ - closed: function(connection) { - console.log('disconnected'); - }, - error: function(connection, error) { - console.log('uh oh', error); - } -}); - -// when encrypted TLS data is received from the client, process it -server.process(encryptedBytesFromClient); -``` - -Connect to a TLS server using node's net.Socket: - -```js -var socket = new net.Socket(); - -var client = forge.tls.createConnection({ - server: false, - verify: function(connection, verified, depth, certs) { - // skip verification for testing - console.log('[tls] server certificate verified'); - return true; - }, - connected: function(connection) { - console.log('[tls] connected'); - // prepare some data to send (note that the string is interpreted as - // 'binary' encoded, which works for HTTP which only uses ASCII, use - // forge.util.encodeUtf8(str) otherwise - client.prepare('GET / HTTP/1.0\r\n\r\n'); - }, - tlsDataReady: function(connection) { - // encrypted data is ready to be sent to the server - var data = connection.tlsData.getBytes(); - socket.write(data, 'binary'); // encoding should be 'binary' - }, - dataReady: function(connection) { - // clear data from the server is ready - var data = connection.data.getBytes(); - console.log('[tls] data received from the server: ' + data); - }, - closed: function() { - console.log('[tls] disconnected'); - }, - error: function(connection, error) { - console.log('[tls] error', error); - } -}); - -socket.on('connect', function() { - console.log('[socket] connected'); - client.handshake(); -}); -socket.on('data', function(data) { - client.process(data.toString('binary')); // encoding should be 'binary' -}); -socket.on('end', function() { - console.log('[socket] disconnected'); -}); - -// connect to google.com -socket.connect(443, 'google.com'); - -// or connect to gmail's imap server (but don't send the HTTP header above) -//socket.connect(993, 'imap.gmail.com'); -``` - - - -### HTTP - -Provides a native [JavaScript][] mini-implementation of an http client that -uses pooled sockets. - -__Examples__ - -```js -// create an HTTP GET request -var request = forge.http.createRequest({method: 'GET', path: url.path}); - -// send the request somewhere -sendSomehow(request.toString()); - -// receive response -var buffer = forge.util.createBuffer(); -var response = forge.http.createResponse(); -var someAsyncDataHandler = function(bytes) { - if(!response.bodyReceived) { - buffer.putBytes(bytes); - if(!response.headerReceived) { - if(response.readHeader(buffer)) { - console.log('HTTP response header: ' + response.toString()); - } - } - if(response.headerReceived && !response.bodyReceived) { - if(response.readBody(buffer)) { - console.log('HTTP response body: ' + response.body); - } - } - } -}; -``` - - - -### SSH - -Provides some SSH utility functions. - -__Examples__ - -```js -// encodes (and optionally encrypts) a private RSA key as a Putty PPK file -forge.ssh.privateKeyToPutty(privateKey, passphrase, comment); - -// encodes a public RSA key as an OpenSSH file -forge.ssh.publicKeyToOpenSSH(key, comment); - -// encodes a private RSA key as an OpenSSH file -forge.ssh.privateKeyToOpenSSH(privateKey, passphrase); - -// gets the SSH public key fingerprint in a byte buffer -forge.ssh.getPublicKeyFingerprint(key); - -// gets a hex-encoded, colon-delimited SSH public key fingerprint -forge.ssh.getPublicKeyFingerprint(key, {encoding: 'hex', delimiter: ':'}); -``` - - - -### XHR - -Provides an XmlHttpRequest implementation using forge.http as a backend. - -__Examples__ - -```js -// TODO -``` - - - -### Sockets - -Provides an interface to create and use raw sockets provided via Flash. - -__Examples__ - -```js -// TODO -``` - -Ciphers -------- - - - -### CIPHER - -Provides a basic API for block encryption and decryption. There is built-in -support for the ciphers: [AES][], [3DES][], and [DES][], and for the modes -of operation: [ECB][], [CBC][], [CFB][], [OFB][], [CTR][], and [GCM][]. - -These algorithms are currently supported: - -* AES-ECB -* AES-CBC -* AES-CFB -* AES-OFB -* AES-CTR -* AES-GCM -* 3DES-ECB -* 3DES-CBC -* DES-ECB -* DES-CBC - -When using an [AES][] algorithm, the key size will determine whether -AES-128, AES-192, or AES-256 is used (all are supported). When a [DES][] -algorithm is used, the key size will determine whether [3DES][] or regular -[DES][] is used. Use a [3DES][] algorithm to enforce Triple-DES. - -__Examples__ - -```js -// generate a random key and IV -// Note: a key size of 16 bytes will use AES-128, 24 => AES-192, 32 => AES-256 -var key = forge.random.getBytesSync(16); -var iv = forge.random.getBytesSync(16); - -/* alternatively, generate a password-based 16-byte key -var salt = forge.random.getBytesSync(128); -var key = forge.pkcs5.pbkdf2('password', salt, numIterations, 16); -*/ - -// encrypt some bytes using CBC mode -// (other modes include: ECB, CFB, OFB, CTR, and GCM) -// Note: CBC and ECB modes use PKCS#7 padding as default -var cipher = forge.cipher.createCipher('AES-CBC', key); -cipher.start({iv: iv}); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output; -// outputs encrypted hex -console.log(encrypted.toHex()); - -// decrypt some bytes using CBC mode -// (other modes include: CFB, OFB, CTR, and GCM) -var decipher = forge.cipher.createDecipher('AES-CBC', key); -decipher.start({iv: iv}); -decipher.update(encrypted); -var result = decipher.finish(); // check 'result' for true/false -// outputs decrypted hex -console.log(decipher.output.toHex()); - -// decrypt bytes using CBC mode and streaming -// Performance can suffer for large multi-MB inputs due to buffer -// manipulations. Stream processing in chunks can offer significant -// improvement. CPU intensive update() calls could also be performed with -// setImmediate/setTimeout to avoid blocking the main browser UI thread (not -// shown here). Optimal block size depends on the JavaScript VM and other -// factors. Encryption can use a simple technique for increased performance. -var encryptedBytes = encrypted.bytes(); -var decipher = forge.cipher.createDecipher('AES-CBC', key); -decipher.start({iv: iv}); -var length = encryptedBytes.length; -var chunkSize = 1024 * 64; -var index = 0; -var decrypted = ''; -do { - decrypted += decipher.output.getBytes(); - var buf = forge.util.createBuffer(encryptedBytes.substr(index, chunkSize)); - decipher.update(buf); - index += chunkSize; -} while(index < length); -var result = decipher.finish(); -assert(result); -decrypted += decipher.output.getBytes(); -console.log(forge.util.bytesToHex(decrypted)); - -// encrypt some bytes using GCM mode -var cipher = forge.cipher.createCipher('AES-GCM', key); -cipher.start({ - iv: iv, // should be a 12-byte binary-encoded string or byte buffer - additionalData: 'binary-encoded string', // optional - tagLength: 128 // optional, defaults to 128 bits -}); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output; -var tag = cipher.mode.tag; -// outputs encrypted hex -console.log(encrypted.toHex()); -// outputs authentication tag -console.log(tag.toHex()); - -// decrypt some bytes using GCM mode -var decipher = forge.cipher.createDecipher('AES-GCM', key); -decipher.start({ - iv: iv, - additionalData: 'binary-encoded string', // optional - tagLength: 128, // optional, defaults to 128 bits - tag: tag // authentication tag from encryption -}); -decipher.update(encrypted); -var pass = decipher.finish(); -// pass is false if there was a failure (eg: authentication tag didn't match) -if(pass) { - // outputs decrypted hex - console.log(decipher.output.toHex()); -} -``` - -Using forge in Node.js to match openssl's "enc" command line tool (**Note**: OpenSSL "enc" uses a non-standard file format with a custom key derivation function and a fixed iteration count of 1, which some consider less secure than alternatives such as [OpenPGP](https://tools.ietf.org/html/rfc4880)/[GnuPG](https://www.gnupg.org/)): - -```js -var forge = require('node-forge'); -var fs = require('fs'); - -// openssl enc -des3 -in input.txt -out input.enc -function encrypt(password) { - var input = fs.readFileSync('input.txt', {encoding: 'binary'}); - - // 3DES key and IV sizes - var keySize = 24; - var ivSize = 8; - - // get derived bytes - // Notes: - // 1. If using an alternative hash (eg: "-md sha1") pass - // "forge.md.sha1.create()" as the final parameter. - // 2. If using "-nosalt", set salt to null. - var salt = forge.random.getBytesSync(8); - // var md = forge.md.sha1.create(); // "-md sha1" - var derivedBytes = forge.pbe.opensslDeriveBytes( - password, salt, keySize + ivSize/*, md*/); - var buffer = forge.util.createBuffer(derivedBytes); - var key = buffer.getBytes(keySize); - var iv = buffer.getBytes(ivSize); - - var cipher = forge.cipher.createCipher('3DES-CBC', key); - cipher.start({iv: iv}); - cipher.update(forge.util.createBuffer(input, 'binary')); - cipher.finish(); - - var output = forge.util.createBuffer(); - - // if using a salt, prepend this to the output: - if(salt !== null) { - output.putBytes('Salted__'); // (add to match openssl tool output) - output.putBytes(salt); - } - output.putBuffer(cipher.output); - - fs.writeFileSync('input.enc', output.getBytes(), {encoding: 'binary'}); -} - -// openssl enc -d -des3 -in input.enc -out input.dec.txt -function decrypt(password) { - var input = fs.readFileSync('input.enc', {encoding: 'binary'}); - - // parse salt from input - input = forge.util.createBuffer(input, 'binary'); - // skip "Salted__" (if known to be present) - input.getBytes('Salted__'.length); - // read 8-byte salt - var salt = input.getBytes(8); - - // Note: if using "-nosalt", skip above parsing and use - // var salt = null; - - // 3DES key and IV sizes - var keySize = 24; - var ivSize = 8; - - var derivedBytes = forge.pbe.opensslDeriveBytes( - password, salt, keySize + ivSize); - var buffer = forge.util.createBuffer(derivedBytes); - var key = buffer.getBytes(keySize); - var iv = buffer.getBytes(ivSize); - - var decipher = forge.cipher.createDecipher('3DES-CBC', key); - decipher.start({iv: iv}); - decipher.update(input); - var result = decipher.finish(); // check 'result' for true/false - - fs.writeFileSync( - 'input.dec.txt', decipher.output.getBytes(), {encoding: 'binary'}); -} -``` - - - -### AES - -Provides [AES][] encryption and decryption in [CBC][], [CFB][], [OFB][], -[CTR][], and [GCM][] modes. See [CIPHER](#cipher) for examples. - - - -### DES - -Provides [3DES][] and [DES][] encryption and decryption in [ECB][] and -[CBC][] modes. See [CIPHER](#cipher) for examples. - - - -### RC2 - -__Examples__ - -```js -// generate a random key and IV -var key = forge.random.getBytesSync(16); -var iv = forge.random.getBytesSync(8); - -// encrypt some bytes -var cipher = forge.rc2.createEncryptionCipher(key); -cipher.start(iv); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output; -// outputs encrypted hex -console.log(encrypted.toHex()); - -// decrypt some bytes -var cipher = forge.rc2.createDecryptionCipher(key); -cipher.start(iv); -cipher.update(encrypted); -cipher.finish(); -// outputs decrypted hex -console.log(cipher.output.toHex()); -``` - -PKI ---- - -Provides [X.509][] certificate support, ED25519 key generation and -signing/verifying, and RSA public and private key encoding, decoding, -encryption/decryption, and signing/verifying. - - - -### ED25519 - -Special thanks to [TweetNaCl.js][] for providing the bulk of the implementation. - -__Examples__ - -```js -var ed25519 = forge.pki.ed25519; - -// generate a random ED25519 keypair -var keypair = ed25519.generateKeyPair(); -// `keypair.publicKey` is a node.js Buffer or Uint8Array -// `keypair.privateKey` is a node.js Buffer or Uint8Array - -// generate a random ED25519 keypair based on a random 32-byte seed -var seed = forge.random.getBytesSync(32); -var keypair = ed25519.generateKeyPair({seed: seed}); - -// generate a random ED25519 keypair based on a "password" 32-byte seed -var password = 'Mai9ohgh6ahxee0jutheew0pungoozil'; -var seed = new forge.util.ByteBuffer(password, 'utf8'); -var keypair = ed25519.generateKeyPair({seed: seed}); - -// sign a UTF-8 message -var signature = ED25519.sign({ - message: 'test', - // also accepts `binary` if you want to pass a binary string - encoding: 'utf8', - // node.js Buffer, Uint8Array, forge ByteBuffer, binary string - privateKey: privateKey -}); -// `signature` is a node.js Buffer or Uint8Array - -// sign a message passed as a buffer -var signature = ED25519.sign({ - // also accepts a forge ByteBuffer or Uint8Array - message: Buffer.from('test', 'utf8'), - privateKey: privateKey -}); - -// sign a message digest (shorter "message" == better performance) -var md = forge.md.sha256.create(); -md.update('test', 'utf8'); -var signature = ED25519.sign({ - md: md, - privateKey: privateKey -}); - -// verify a signature on a UTF-8 message -var verified = ED25519.verify({ - message: 'test', - encoding: 'utf8', - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - signature: signature, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - publicKey: publicKey -}); -// `verified` is true/false - -// sign a message passed as a buffer -var verified = ED25519.verify({ - // also accepts a forge ByteBuffer or Uint8Array - message: Buffer.from('test', 'utf8'), - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - signature: signature, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - publicKey: publicKey -}); - -// verify a signature on a message digest -var md = forge.md.sha256.create(); -md.update('test', 'utf8'); -var verified = ED25519.verify({ - md: md, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - signature: signature, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - publicKey: publicKey -}); -``` - - - -### RSA - -__Examples__ - -```js -var rsa = forge.pki.rsa; - -// generate an RSA key pair synchronously -// *NOT RECOMMENDED*: Can be significantly slower than async and may block -// JavaScript execution. Will use native Node.js 10.12.0+ API if possible. -var keypair = rsa.generateKeyPair({bits: 2048, e: 0x10001}); - -// generate an RSA key pair asynchronously (uses web workers if available) -// use workers: -1 to run a fast core estimator to optimize # of workers -// *RECOMMENDED*: Can be significantly faster than sync. Will use native -// Node.js 10.12.0+ or WebCrypto API if possible. -rsa.generateKeyPair({bits: 2048, workers: 2}, function(err, keypair) { - // keypair.privateKey, keypair.publicKey -}); - -// generate an RSA key pair in steps that attempt to run for a specified period -// of time on the main JS thread -var state = rsa.createKeyPairGenerationState(2048, 0x10001); -var step = function() { - // run for 100 ms - if(!rsa.stepKeyPairGenerationState(state, 100)) { - setTimeout(step, 1); - } - else { - // done, turn off progress indicator, use state.keys - } -}; -// turn on progress indicator, schedule generation to run -setTimeout(step); - -// sign data with a private key and output DigestInfo DER-encoded bytes -// (defaults to RSASSA PKCS#1 v1.5) -var md = forge.md.sha1.create(); -md.update('sign this', 'utf8'); -var signature = privateKey.sign(md); - -// verify data with a public key -// (defaults to RSASSA PKCS#1 v1.5) -var verified = publicKey.verify(md.digest().bytes(), signature); - -// sign data using RSASSA-PSS where PSS uses a SHA-1 hash, a SHA-1 based -// masking function MGF1, and a 20 byte salt -var md = forge.md.sha1.create(); -md.update('sign this', 'utf8'); -var pss = forge.pss.create({ - md: forge.md.sha1.create(), - mgf: forge.mgf.mgf1.create(forge.md.sha1.create()), - saltLength: 20 - // optionally pass 'prng' with a custom PRNG implementation - // optionalls pass 'salt' with a forge.util.ByteBuffer w/custom salt -}); -var signature = privateKey.sign(md, pss); - -// verify RSASSA-PSS signature -var pss = forge.pss.create({ - md: forge.md.sha1.create(), - mgf: forge.mgf.mgf1.create(forge.md.sha1.create()), - saltLength: 20 - // optionally pass 'prng' with a custom PRNG implementation -}); -var md = forge.md.sha1.create(); -md.update('sign this', 'utf8'); -publicKey.verify(md.digest().getBytes(), signature, pss); - -// encrypt data with a public key (defaults to RSAES PKCS#1 v1.5) -var encrypted = publicKey.encrypt(bytes); - -// decrypt data with a private key (defaults to RSAES PKCS#1 v1.5) -var decrypted = privateKey.decrypt(encrypted); - -// encrypt data with a public key using RSAES PKCS#1 v1.5 -var encrypted = publicKey.encrypt(bytes, 'RSAES-PKCS1-V1_5'); - -// decrypt data with a private key using RSAES PKCS#1 v1.5 -var decrypted = privateKey.decrypt(encrypted, 'RSAES-PKCS1-V1_5'); - -// encrypt data with a public key using RSAES-OAEP -var encrypted = publicKey.encrypt(bytes, 'RSA-OAEP'); - -// decrypt data with a private key using RSAES-OAEP -var decrypted = privateKey.decrypt(encrypted, 'RSA-OAEP'); - -// encrypt data with a public key using RSAES-OAEP/SHA-256 -var encrypted = publicKey.encrypt(bytes, 'RSA-OAEP', { - md: forge.md.sha256.create() -}); - -// decrypt data with a private key using RSAES-OAEP/SHA-256 -var decrypted = privateKey.decrypt(encrypted, 'RSA-OAEP', { - md: forge.md.sha256.create() -}); - -// encrypt data with a public key using RSAES-OAEP/SHA-256/MGF1-SHA-1 -// compatible with Java's RSA/ECB/OAEPWithSHA-256AndMGF1Padding -var encrypted = publicKey.encrypt(bytes, 'RSA-OAEP', { - md: forge.md.sha256.create(), - mgf1: { - md: forge.md.sha1.create() - } -}); - -// decrypt data with a private key using RSAES-OAEP/SHA-256/MGF1-SHA-1 -// compatible with Java's RSA/ECB/OAEPWithSHA-256AndMGF1Padding -var decrypted = privateKey.decrypt(encrypted, 'RSA-OAEP', { - md: forge.md.sha256.create(), - mgf1: { - md: forge.md.sha1.create() - } -}); - -``` - - - -### RSA-KEM - -__Examples__ - -```js -// generate an RSA key pair asynchronously (uses web workers if available) -// use workers: -1 to run a fast core estimator to optimize # of workers -forge.rsa.generateKeyPair({bits: 2048, workers: -1}, function(err, keypair) { - // keypair.privateKey, keypair.publicKey -}); - -// generate and encapsulate a 16-byte secret key -var kdf1 = new forge.kem.kdf1(forge.md.sha1.create()); -var kem = forge.kem.rsa.create(kdf1); -var result = kem.encrypt(keypair.publicKey, 16); -// result has 'encapsulation' and 'key' - -// encrypt some bytes -var iv = forge.random.getBytesSync(12); -var someBytes = 'hello world!'; -var cipher = forge.cipher.createCipher('AES-GCM', result.key); -cipher.start({iv: iv}); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output.getBytes(); -var tag = cipher.mode.tag.getBytes(); - -// send 'encrypted', 'iv', 'tag', and result.encapsulation to recipient - -// decrypt encapsulated 16-byte secret key -var kdf1 = new forge.kem.kdf1(forge.md.sha1.create()); -var kem = forge.kem.rsa.create(kdf1); -var key = kem.decrypt(keypair.privateKey, result.encapsulation, 16); - -// decrypt some bytes -var decipher = forge.cipher.createDecipher('AES-GCM', key); -decipher.start({iv: iv, tag: tag}); -decipher.update(forge.util.createBuffer(encrypted)); -var pass = decipher.finish(); -// pass is false if there was a failure (eg: authentication tag didn't match) -if(pass) { - // outputs 'hello world!' - console.log(decipher.output.getBytes()); -} - -``` - - - -### X.509 - -__Examples__ - -```js -var pki = forge.pki; - -// convert a PEM-formatted public key to a Forge public key -var publicKey = pki.publicKeyFromPem(pem); - -// convert a Forge public key to PEM-format -var pem = pki.publicKeyToPem(publicKey); - -// convert an ASN.1 SubjectPublicKeyInfo to a Forge public key -var publicKey = pki.publicKeyFromAsn1(subjectPublicKeyInfo); - -// convert a Forge public key to an ASN.1 SubjectPublicKeyInfo -var subjectPublicKeyInfo = pki.publicKeyToAsn1(publicKey); - -// gets a SHA-1 RSAPublicKey fingerprint a byte buffer -pki.getPublicKeyFingerprint(key); - -// gets a SHA-1 SubjectPublicKeyInfo fingerprint a byte buffer -pki.getPublicKeyFingerprint(key, {type: 'SubjectPublicKeyInfo'}); - -// gets a hex-encoded, colon-delimited SHA-1 RSAPublicKey public key fingerprint -pki.getPublicKeyFingerprint(key, {encoding: 'hex', delimiter: ':'}); - -// gets a hex-encoded, colon-delimited SHA-1 SubjectPublicKeyInfo public key fingerprint -pki.getPublicKeyFingerprint(key, { - type: 'SubjectPublicKeyInfo', - encoding: 'hex', - delimiter: ':' -}); - -// gets a hex-encoded, colon-delimited MD5 RSAPublicKey public key fingerprint -pki.getPublicKeyFingerprint(key, { - md: forge.md.md5.create(), - encoding: 'hex', - delimiter: ':' -}); - -// creates a CA store -var caStore = pki.createCaStore([/* PEM-encoded cert */, ...]); - -// add a certificate to the CA store -caStore.addCertificate(certObjectOrPemString); - -// gets the issuer (its certificate) for the given certificate -var issuerCert = caStore.getIssuer(subjectCert); - -// verifies a certificate chain against a CA store -pki.verifyCertificateChain(caStore, chain, customVerifyCallback); - -// signs a certificate using the given private key -cert.sign(privateKey); - -// signs a certificate using SHA-256 instead of SHA-1 -cert.sign(privateKey, forge.md.sha256.create()); - -// verifies an issued certificate using the certificates public key -var verified = issuer.verify(issued); - -// generate a keypair and create an X.509v3 certificate -var keys = pki.rsa.generateKeyPair(2048); -var cert = pki.createCertificate(); -cert.publicKey = keys.publicKey; -// alternatively set public key from a csr -//cert.publicKey = csr.publicKey; -// NOTE: serialNumber is the hex encoded value of an ASN.1 INTEGER. -// Conforming CAs should ensure serialNumber is: -// - no more than 20 octets -// - non-negative (prefix a '00' if your value starts with a '1' bit) -cert.serialNumber = '01'; -cert.validity.notBefore = new Date(); -cert.validity.notAfter = new Date(); -cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1); -var attrs = [{ - name: 'commonName', - value: 'example.org' -}, { - name: 'countryName', - value: 'US' -}, { - shortName: 'ST', - value: 'Virginia' -}, { - name: 'localityName', - value: 'Blacksburg' -}, { - name: 'organizationName', - value: 'Test' -}, { - shortName: 'OU', - value: 'Test' -}]; -cert.setSubject(attrs); -// alternatively set subject from a csr -//cert.setSubject(csr.subject.attributes); -cert.setIssuer(attrs); -cert.setExtensions([{ - name: 'basicConstraints', - cA: true -}, { - name: 'keyUsage', - keyCertSign: true, - digitalSignature: true, - nonRepudiation: true, - keyEncipherment: true, - dataEncipherment: true -}, { - name: 'extKeyUsage', - serverAuth: true, - clientAuth: true, - codeSigning: true, - emailProtection: true, - timeStamping: true -}, { - name: 'nsCertType', - client: true, - server: true, - email: true, - objsign: true, - sslCA: true, - emailCA: true, - objCA: true -}, { - name: 'subjectAltName', - altNames: [{ - type: 6, // URI - value: 'http://example.org/webid#me' - }, { - type: 7, // IP - ip: '127.0.0.1' - }] -}, { - name: 'subjectKeyIdentifier' -}]); -/* alternatively set extensions from a csr -var extensions = csr.getAttribute({name: 'extensionRequest'}).extensions; -// optionally add more extensions -extensions.push.apply(extensions, [{ - name: 'basicConstraints', - cA: true -}, { - name: 'keyUsage', - keyCertSign: true, - digitalSignature: true, - nonRepudiation: true, - keyEncipherment: true, - dataEncipherment: true -}]); -cert.setExtensions(extensions); -*/ -// self-sign certificate -cert.sign(keys.privateKey); - -// convert a Forge certificate to PEM -var pem = pki.certificateToPem(cert); - -// convert a Forge certificate from PEM -var cert = pki.certificateFromPem(pem); - -// convert an ASN.1 X.509x3 object to a Forge certificate -var cert = pki.certificateFromAsn1(obj); - -// convert a Forge certificate to an ASN.1 X.509v3 object -var asn1Cert = pki.certificateToAsn1(cert); -``` - - - -### PKCS#5 - -Provides the password-based key-derivation function from [PKCS#5][]. - -__Examples__ - -```js -// generate a password-based 16-byte key -// note an optional message digest can be passed as the final parameter -var salt = forge.random.getBytesSync(128); -var derivedKey = forge.pkcs5.pbkdf2('password', salt, numIterations, 16); - -// generate key asynchronously -// note an optional message digest can be passed before the callback -forge.pkcs5.pbkdf2('password', salt, numIterations, 16, function(err, derivedKey) { - // do something w/derivedKey -}); -``` - - - -### PKCS#7 - -Provides cryptographically protected messages from [PKCS#7][]. - -__Examples__ - -```js -// convert a message from PEM -var p7 = forge.pkcs7.messageFromPem(pem); -// look at p7.recipients - -// find a recipient by the issuer of a certificate -var recipient = p7.findRecipient(cert); - -// decrypt -p7.decrypt(p7.recipients[0], privateKey); - -// create a p7 enveloped message -var p7 = forge.pkcs7.createEnvelopedData(); - -// add a recipient -var cert = forge.pki.certificateFromPem(certPem); -p7.addRecipient(cert); - -// set content -p7.content = forge.util.createBuffer('Hello'); - -// encrypt -p7.encrypt(); - -// convert message to PEM -var pem = forge.pkcs7.messageToPem(p7); - -// create a degenerate PKCS#7 certificate container -// (CRLs not currently supported, only certificates) -var p7 = forge.pkcs7.createSignedData(); -p7.addCertificate(certOrCertPem1); -p7.addCertificate(certOrCertPem2); -var pem = forge.pkcs7.messageToPem(p7); - -// create PKCS#7 signed data with authenticatedAttributes -// attributes include: PKCS#9 content-type, message-digest, and signing-time -var p7 = forge.pkcs7.createSignedData(); -p7.content = forge.util.createBuffer('Some content to be signed.', 'utf8'); -p7.addCertificate(certOrCertPem); -p7.addSigner({ - key: privateKeyAssociatedWithCert, - certificate: certOrCertPem, - digestAlgorithm: forge.pki.oids.sha256, - authenticatedAttributes: [{ - type: forge.pki.oids.contentType, - value: forge.pki.oids.data - }, { - type: forge.pki.oids.messageDigest - // value will be auto-populated at signing time - }, { - type: forge.pki.oids.signingTime, - // value can also be auto-populated at signing time - value: new Date() - }] -}); -p7.sign(); -var pem = forge.pkcs7.messageToPem(p7); - -// PKCS#7 Sign in detached mode. -// Includes the signature and certificate without the signed data. -p7.sign({detached: true}); - -``` - - - -### PKCS#8 - -__Examples__ - -```js -var pki = forge.pki; - -// convert a PEM-formatted private key to a Forge private key -var privateKey = pki.privateKeyFromPem(pem); - -// convert a Forge private key to PEM-format -var pem = pki.privateKeyToPem(privateKey); - -// convert an ASN.1 PrivateKeyInfo or RSAPrivateKey to a Forge private key -var privateKey = pki.privateKeyFromAsn1(rsaPrivateKey); - -// convert a Forge private key to an ASN.1 RSAPrivateKey -var rsaPrivateKey = pki.privateKeyToAsn1(privateKey); - -// wrap an RSAPrivateKey ASN.1 object in a PKCS#8 ASN.1 PrivateKeyInfo -var privateKeyInfo = pki.wrapRsaPrivateKey(rsaPrivateKey); - -// convert a PKCS#8 ASN.1 PrivateKeyInfo to PEM -var pem = pki.privateKeyInfoToPem(privateKeyInfo); - -// encrypts a PrivateKeyInfo using a custom password and -// outputs an EncryptedPrivateKeyInfo -var encryptedPrivateKeyInfo = pki.encryptPrivateKeyInfo( - privateKeyInfo, 'myCustomPasswordHere', { - algorithm: 'aes256', // 'aes128', 'aes192', 'aes256', '3des' - }); - -// decrypts an ASN.1 EncryptedPrivateKeyInfo that was encrypted -// with a custom password -var privateKeyInfo = pki.decryptPrivateKeyInfo( - encryptedPrivateKeyInfo, 'myCustomPasswordHere'); - -// converts an EncryptedPrivateKeyInfo to PEM -var pem = pki.encryptedPrivateKeyToPem(encryptedPrivateKeyInfo); - -// converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format -var encryptedPrivateKeyInfo = pki.encryptedPrivateKeyFromPem(pem); - -// wraps and encrypts a Forge private key and outputs it in PEM format -var pem = pki.encryptRsaPrivateKey(privateKey, 'password'); - -// encrypts a Forge private key and outputs it in PEM format using OpenSSL's -// proprietary legacy format + encapsulated PEM headers (DEK-Info) -var pem = pki.encryptRsaPrivateKey(privateKey, 'password', {legacy: true}); - -// decrypts a PEM-formatted, encrypted private key -var privateKey = pki.decryptRsaPrivateKey(pem, 'password'); - -// sets an RSA public key from a private key -var publicKey = pki.setRsaPublicKey(privateKey.n, privateKey.e); -``` - - - -### PKCS#10 - -Provides certification requests or certificate signing requests (CSR) from -[PKCS#10][]. - -__Examples__ - -```js -// generate a key pair -var keys = forge.pki.rsa.generateKeyPair(1024); - -// create a certification request (CSR) -var csr = forge.pki.createCertificationRequest(); -csr.publicKey = keys.publicKey; -csr.setSubject([{ - name: 'commonName', - value: 'example.org' -}, { - name: 'countryName', - value: 'US' -}, { - shortName: 'ST', - value: 'Virginia' -}, { - name: 'localityName', - value: 'Blacksburg' -}, { - name: 'organizationName', - value: 'Test' -}, { - shortName: 'OU', - value: 'Test' -}]); -// set (optional) attributes -csr.setAttributes([{ - name: 'challengePassword', - value: 'password' -}, { - name: 'unstructuredName', - value: 'My Company, Inc.' -}, { - name: 'extensionRequest', - extensions: [{ - name: 'subjectAltName', - altNames: [{ - // 2 is DNS type - type: 2, - value: 'test.domain.com' - }, { - type: 2, - value: 'other.domain.com', - }, { - type: 2, - value: 'www.domain.net' - }] - }] -}]); - -// sign certification request -csr.sign(keys.privateKey); - -// verify certification request -var verified = csr.verify(); - -// convert certification request to PEM-format -var pem = forge.pki.certificationRequestToPem(csr); - -// convert a Forge certification request from PEM-format -var csr = forge.pki.certificationRequestFromPem(pem); - -// get an attribute -csr.getAttribute({name: 'challengePassword'}); - -// get extensions array -csr.getAttribute({name: 'extensionRequest'}).extensions; - -``` - - - -### PKCS#12 - -Provides the cryptographic archive file format from [PKCS#12][]. - -**Note for Chrome/Firefox/iOS/similar users**: If you have trouble importing -a PKCS#12 container, try using the TripleDES algorithm. It can be passed -to `forge.pkcs12.toPkcs12Asn1` using the `{algorithm: '3des'}` option. - -__Examples__ - -```js -// decode p12 from base64 -var p12Der = forge.util.decode64(p12b64); -// get p12 as ASN.1 object -var p12Asn1 = forge.asn1.fromDer(p12Der); -// decrypt p12 using the password 'password' -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, 'password'); -// decrypt p12 using non-strict parsing mode (resolves some ASN.1 parse errors) -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, false, 'password'); -// decrypt p12 using literally no password (eg: Mac OS X/apple push) -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1); -// decrypt p12 using an "empty" password (eg: OpenSSL with no password input) -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, ''); -// p12.safeContents is an array of safe contents, each of -// which contains an array of safeBags - -// get bags by friendlyName -var bags = p12.getBags({friendlyName: 'test'}); -// bags are key'd by attribute type (here "friendlyName") -// and the key values are an array of matching objects -var cert = bags.friendlyName[0]; - -// get bags by localKeyId -var bags = p12.getBags({localKeyId: buffer}); -// bags are key'd by attribute type (here "localKeyId") -// and the key values are an array of matching objects -var cert = bags.localKeyId[0]; - -// get bags by localKeyId (input in hex) -var bags = p12.getBags({localKeyIdHex: '7b59377ff142d0be4565e9ac3d396c01401cd879'}); -// bags are key'd by attribute type (here "localKeyId", *not* "localKeyIdHex") -// and the key values are an array of matching objects -var cert = bags.localKeyId[0]; - -// get bags by type -var bags = p12.getBags({bagType: forge.pki.oids.certBag}); -// bags are key'd by bagType and each bagType key's value -// is an array of matches (in this case, certificate objects) -var cert = bags[forge.pki.oids.certBag][0]; - -// get bags by friendlyName and filter on bag type -var bags = p12.getBags({ - friendlyName: 'test', - bagType: forge.pki.oids.certBag -}); - -// get key bags -var bags = p12.getBags({bagType: forge.pki.oids.keyBag}); -// get key -var bag = bags[forge.pki.oids.keyBag][0]; -var key = bag.key; -// if the key is in a format unrecognized by forge then -// bag.key will be `null`, use bag.asn1 to get the ASN.1 -// representation of the key -if(bag.key === null) { - var keyAsn1 = bag.asn1; - // can now convert back to DER/PEM/etc for export -} - -// generate a p12 using AES (default) -var p12Asn1 = forge.pkcs12.toPkcs12Asn1( - privateKey, certificateChain, 'password'); - -// generate a p12 that can be imported by Chrome/Firefox/iOS -// (requires the use of Triple DES instead of AES) -var p12Asn1 = forge.pkcs12.toPkcs12Asn1( - privateKey, certificateChain, 'password', - {algorithm: '3des'}); - -// base64-encode p12 -var p12Der = forge.asn1.toDer(p12Asn1).getBytes(); -var p12b64 = forge.util.encode64(p12Der); - -// create download link for p12 -var a = document.createElement('a'); -a.download = 'example.p12'; -a.setAttribute('href', 'data:application/x-pkcs12;base64,' + p12b64); -a.appendChild(document.createTextNode('Download')); -``` - - - -### ASN.1 - -Provides [ASN.1][] DER encoding and decoding. - -__Examples__ - -```js -var asn1 = forge.asn1; - -// create a SubjectPublicKeyInfo -var subjectPublicKeyInfo = - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids['rsaEncryption']).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // subjectPublicKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, [ - // RSAPublicKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // modulus (n) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.n)), - // publicExponent (e) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.e)) - ]) - ]) - ]); - -// serialize an ASN.1 object to DER format -var derBuffer = asn1.toDer(subjectPublicKeyInfo); - -// deserialize to an ASN.1 object from a byte buffer filled with DER data -var object = asn1.fromDer(derBuffer); - -// convert an OID dot-separated string to a byte buffer -var derOidBuffer = asn1.oidToDer('1.2.840.113549.1.1.5'); - -// convert a byte buffer with a DER-encoded OID to a dot-separated string -console.log(asn1.derToOid(derOidBuffer)); -// output: 1.2.840.113549.1.1.5 - -// validates that an ASN.1 object matches a particular ASN.1 structure and -// captures data of interest from that structure for easy access -var publicKeyValidator = { - name: 'SubjectPublicKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'subjectPublicKeyInfo', - value: [{ - name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'publicKeyOid' - }] - }, { - // subjectPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - value: [{ - // RSAPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'rsaPublicKey' - }] - }] -}; - -var capture = {}; -var errors = []; -if(!asn1.validate( - publicKeyValidator, subjectPublicKeyInfo, validator, capture, errors)) { - throw 'ASN.1 object is not a SubjectPublicKeyInfo.'; -} -// capture.subjectPublicKeyInfo contains the full ASN.1 object -// capture.rsaPublicKey contains the full ASN.1 object for the RSA public key -// capture.publicKeyOid only contains the value for the OID -var oid = asn1.derToOid(capture.publicKeyOid); -if(oid !== pki.oids['rsaEncryption']) { - throw 'Unsupported OID.'; -} - -// pretty print an ASN.1 object to a string for debugging purposes -asn1.prettyPrint(object); -``` - -Message Digests ----------------- - - - -### SHA1 - -Provides [SHA-1][] message digests. - -__Examples__ - -```js -var md = forge.md.sha1.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 -``` - - - -### SHA256 - -Provides [SHA-256][] message digests. - -__Examples__ - -```js -var md = forge.md.sha256.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592 -``` - - - -### SHA384 - -Provides [SHA-384][] message digests. - -__Examples__ - -```js -var md = forge.md.sha384.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1 -``` - - - -### SHA512 - -Provides [SHA-512][] message digests. - -__Examples__ - -```js -// SHA-512 -var md = forge.md.sha512.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6 - -// SHA-512/224 -var md = forge.md.sha512.sha224.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 944cd2847fb54558d4775db0485a50003111c8e5daa63fe722c6aa37 - -// SHA-512/256 -var md = forge.md.sha512.sha256.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: dd9d67b371519c339ed8dbd25af90e976a1eeefd4ad3d889005e532fc5bef04d -``` - - - -### MD5 - -Provides [MD5][] message digests. - -__Examples__ - -```js -var md = forge.md.md5.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 9e107d9d372bb6826bd81d3542a419d6 -``` - - - -### HMAC - -Provides [HMAC][] w/any supported message digest algorithm. - -__Examples__ - -```js -var hmac = forge.hmac.create(); -hmac.start('sha1', 'Jefe'); -hmac.update('what do ya want for nothing?'); -console.log(hmac.digest().toHex()); -// output: effcdf6ae5eb2fa2d27416d5f184df9c259a7c79 -``` - -Utilities ---------- - - - -### Prime - -Provides an API for generating large, random, probable primes. - -__Examples__ - -```js -// generate a random prime on the main JS thread -var bits = 1024; -forge.prime.generateProbablePrime(bits, function(err, num) { - console.log('random prime', num.toString(16)); -}); - -// generate a random prime using Web Workers (if available, otherwise -// falls back to the main thread) -var bits = 1024; -var options = { - algorithm: { - name: 'PRIMEINC', - workers: -1 // auto-optimize # of workers - } -}; -forge.prime.generateProbablePrime(bits, options, function(err, num) { - console.log('random prime', num.toString(16)); -}); -``` - - - -### PRNG - -Provides a [Fortuna][]-based cryptographically-secure pseudo-random number -generator, to be used with a cryptographic function backend, e.g. [AES][]. An -implementation using [AES][] as a backend is provided. An API for collecting -entropy is given, though if window.crypto.getRandomValues is available, it will -be used automatically. - -__Examples__ - -```js -// get some random bytes synchronously -var bytes = forge.random.getBytesSync(32); -console.log(forge.util.bytesToHex(bytes)); - -// get some random bytes asynchronously -forge.random.getBytes(32, function(err, bytes) { - console.log(forge.util.bytesToHex(bytes)); -}); - -// collect some entropy if you'd like -forge.random.collect(someRandomBytes); -jQuery().mousemove(function(e) { - forge.random.collectInt(e.clientX, 16); - forge.random.collectInt(e.clientY, 16); -}); - -// specify a seed file for use with the synchronous API if you'd like -forge.random.seedFileSync = function(needed) { - // get 'needed' number of random bytes from somewhere - return fetchedRandomBytes; -}; - -// specify a seed file for use with the asynchronous API if you'd like -forge.random.seedFile = function(needed, callback) { - // get the 'needed' number of random bytes from somewhere - callback(null, fetchedRandomBytes); -}); - -// register the main thread to send entropy or a Web Worker to receive -// entropy on demand from the main thread -forge.random.registerWorker(self); - -// generate a new instance of a PRNG with no collected entropy -var myPrng = forge.random.createInstance(); -``` - - - -### Tasks - -Provides queuing and synchronizing tasks in a web application. - -__Examples__ - -```js -// TODO -``` - - - -### Utilities - -Provides utility functions, including byte buffer support, base64, -bytes to/from hex, zlib inflate/deflate, etc. - -__Examples__ - -```js -// encode/decode base64 -var encoded = forge.util.encode64(str); -var str = forge.util.decode64(encoded); - -// encode/decode UTF-8 -var encoded = forge.util.encodeUtf8(str); -var str = forge.util.decodeUtf8(encoded); - -// bytes to/from hex -var bytes = forge.util.hexToBytes(hex); -var hex = forge.util.bytesToHex(bytes); - -// create an empty byte buffer -var buffer = forge.util.createBuffer(); -// create a byte buffer from raw binary bytes -var buffer = forge.util.createBuffer(input, 'raw'); -// create a byte buffer from utf8 bytes -var buffer = forge.util.createBuffer(input, 'utf8'); - -// get the length of the buffer in bytes -buffer.length(); -// put bytes into the buffer -buffer.putBytes(bytes); -// put a 32-bit integer into the buffer -buffer.putInt32(10); -// buffer to hex -buffer.toHex(); -// get a copy of the bytes in the buffer -bytes.bytes(/* count */); -// empty this buffer and get its contents -bytes.getBytes(/* count */); - -// convert a forge buffer into a Node.js Buffer -// make sure you specify the encoding as 'binary' -var forgeBuffer = forge.util.createBuffer(); -var nodeBuffer = Buffer.from(forgeBuffer.getBytes(), 'binary'); - -// convert a Node.js Buffer into a forge buffer -// make sure you specify the encoding as 'binary' -var nodeBuffer = Buffer.from('CAFE', 'hex'); -var forgeBuffer = forge.util.createBuffer(nodeBuffer.toString('binary')); - -// parse a URL -var parsed = forge.util.parseUrl('http://example.com/foo?bar=baz'); -// parsed.scheme, parsed.host, parsed.port, parsed.path, parsed.fullHost -``` - - - -### Logging - -Provides logging to a javascript console using various categories and -levels of verbosity. - -__Examples__ - -```js -// TODO -``` - - - -### Debugging - -Provides storage of debugging information normally inaccessible in -closures for viewing/investigation. - -__Examples__ - -```js -// TODO -``` - - - -### Flash Networking Support - -The [flash README](./flash/README.md) provides details on rebuilding the -optional Flash component used for networking. It also provides details on -Policy Server support. - -Security Considerations ------------------------ - -When using this code please keep the following in mind: - -- Cryptography is hard. Please review and test this code before depending on it - for critical functionality. -- The nature of JavaScript is that execution of this code depends on trusting a - very large set of JavaScript tools and systems. Consider runtime variations, - runtime characteristics, runtime optimization, code optimization, code - minimization, code obfuscation, bundling tools, possible bugs, the Forge code - itself, and so on. -- If using pre-built bundles from [Bower][] or similar be aware someone else - ran the tools to create those files. -- Use a secure transport channel such as [TLS][] to load scripts and consider - using additional security mechanisms such as [Subresource Integrity][] script - attributes. -- Use "native" functionality where possible. This can be critical when dealing - with performance and random number generation. Note that the JavaScript - random number algorithms should perform well if given suitable entropy. -- Understand possible attacks against cryptographic systems. For instance side - channel and timing attacks may be possible due to the difficulty in - implementing constant time algorithms in pure JavaScript. -- Certain features in this library are less susceptible to attacks depending on - usage. This primarily includes features that deal with data format - manipulation or those that are not involved in communication. - -Library Background ------------------- - -* https://digitalbazaar.com/2010/07/20/javascript-tls-1/ -* https://digitalbazaar.com/2010/07/20/javascript-tls-2/ - -Contact -------- - -* Code: https://github.com/digitalbazaar/forge -* Bugs: https://github.com/digitalbazaar/forge/issues -* Email: support@digitalbazaar.com -* IRC: [#forgejs][] on [freenode][] - -Donations ---------- - -Financial support is welcome and helps contribute to futher development: - -* For [PayPal][] please send to paypal@digitalbazaar.com. -* Something else? Please contact support@digitalbazaar.com. - -[#forgejs]: https://webchat.freenode.net/?channels=#forgejs -[0.6.x]: https://github.com/digitalbazaar/forge/tree/0.6.x -[3DES]: https://en.wikipedia.org/wiki/Triple_DES -[AES]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard -[ASN.1]: https://en.wikipedia.org/wiki/ASN.1 -[Bower]: https://bower.io/ -[Browserify]: http://browserify.org/ -[CBC]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[CFB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[CTR]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[CommonJS]: https://en.wikipedia.org/wiki/CommonJS -[DES]: https://en.wikipedia.org/wiki/Data_Encryption_Standard -[ECB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[Fortuna]: https://en.wikipedia.org/wiki/Fortuna_(PRNG) -[GCM]: https://en.wikipedia.org/wiki/GCM_mode -[HMAC]: https://en.wikipedia.org/wiki/HMAC -[JavaScript]: https://en.wikipedia.org/wiki/JavaScript -[Karma]: https://karma-runner.github.io/ -[MD5]: https://en.wikipedia.org/wiki/MD5 -[Node.js]: https://nodejs.org/ -[OFB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[PKCS#10]: https://en.wikipedia.org/wiki/Certificate_signing_request -[PKCS#12]: https://en.wikipedia.org/wiki/PKCS_%E2%99%AF12 -[PKCS#5]: https://en.wikipedia.org/wiki/PKCS -[PKCS#7]: https://en.wikipedia.org/wiki/Cryptographic_Message_Syntax -[PayPal]: https://www.paypal.com/ -[RC2]: https://en.wikipedia.org/wiki/RC2 -[SHA-1]: https://en.wikipedia.org/wiki/SHA-1 -[SHA-256]: https://en.wikipedia.org/wiki/SHA-256 -[SHA-384]: https://en.wikipedia.org/wiki/SHA-384 -[SHA-512]: https://en.wikipedia.org/wiki/SHA-512 -[Subresource Integrity]: https://www.w3.org/TR/SRI/ -[TLS]: https://en.wikipedia.org/wiki/Transport_Layer_Security -[UMD]: https://github.com/umdjs/umd -[X.509]: https://en.wikipedia.org/wiki/X.509 -[freenode]: https://freenode.net/ -[unpkg]: https://unpkg.com/ -[webpack]: https://webpack.github.io/ -[TweetNaCl.js]: https://github.com/dchest/tweetnacl-js diff --git a/node_modules/node-forge/dist/forge.all.min.js b/node_modules/node-forge/dist/forge.all.min.js deleted file mode 100644 index 340fb127..00000000 --- a/node_modules/node-forge/dist/forge.all.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.forge=t():e.forge=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=36)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t){var n=r(0),a=r(40),i=e.exports=n.util=n.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(i.isArrayBuffer(e)||i.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&a.setAttribute("a",n=!n))}}i.nextTick=i.setImmediate}(),i.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,i.globalScope=i.isNodejs?t:"undefined"==typeof self?window:self,i.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},i.isArrayBufferView=function(e){return e&&i.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},i.ByteBuffer=o,i.ByteStringBuffer=o;i.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},i.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},i.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},i.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},i.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},i.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},i.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(i.encodeUtf8(e))},i.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},i.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},i.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},i.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},i.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},i.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},i.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},i.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},i.ByteStringBuffer.prototype.copy=function(){var e=i.createBuffer(this.data);return e.read=this.read,e},i.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},i.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},i.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},i.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},i.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},i.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},i.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},i.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},i.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},i.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},i.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},i.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},i.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},i.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},i.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},i.DataBuffer.prototype.copy=function(){return new i.DataBuffer(this)},i.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},i.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},i.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},i.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},i.xorBytes=function(e,t,r){for(var n="",a="",i="",s=0,o=0;r>0;--r,++s)a=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(n+=i,i="",o=0),i+=String.fromCharCode(a),++o;return n+=i},i.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.encode64=function(e,t){for(var r,n,a,i="",s="",o=0;o>2),i+=c.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=c.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":c.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",s=0;s>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},i.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},i.decodeUtf8=function(e){return decodeURIComponent(escape(e))},i.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},i.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},i.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var a=r=r||0,i=0;i>2),i+=c.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=c.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":c.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.binary.base64.decode=function(e,t,r){var n,a,i,s,o=t;o||(o=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,l=r=r||0;c>4,64!==i&&(o[l++]=(15&a)<<4|i>>2,64!==s&&(o[l++]=(3&i)<<6|s));return t?l-r:o.subarray(0,l)},i.binary.base58.encode=function(e,t){return i.binary.baseN.encode(e,l,t)},i.binary.base58.decode=function(e,t){return i.binary.baseN.decode(e,l,t)},i.text={utf8:{},utf16:{}},i.text.utf8.encode=function(e,t,r){e=i.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var a=r=r||0,s=0;s0?(a=r[n].substring(0,s),i=r[n].substring(s+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===m&&(m="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=m):t=r(e),t},i.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:i.getQueryVariables(r)}},i.makeRequest=function(e){var t=i.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},i.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},i.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},i.format=function(e){for(var t,r,n=/%./g,a=0,i=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&i.push(r),s=n.lastIndex;var o=t[0][1];switch(o){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+o+"?>")}}return i.push(e.substring(s)),i.join("")},i.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===n?".":n,c=a<0?"-":"",u=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(i?s+Math.abs(a-u).toFixed(i).slice(2):"")},i.formatSize=function(e){return e=e>=1073741824?i.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?i.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?i.formatNumber(e/1024,0)+" KiB":i.formatNumber(e,0)+" bytes"},i.bytesFromIP=function(e){return-1!==e.indexOf(".")?i.bytesFromIPv4(e):-1!==e.indexOf(":")?i.bytesFromIPv6(e):null},i.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=i.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},i.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in i&&!e.update)return t(null,i.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return i.cores=navigator.hardwareConcurrency,t(null,i.cores);if("undefined"==typeof Worker)return i.cores=1,t(null,i.cores);if("undefined"==typeof Blob)return i.cores=2,t(null,i.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()o.st&&a.sta.st&&o.stt){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}a.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},a.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},a.create=function(e,t,r,i,s){if(n.util.isArray(i)){for(var o=[],c=0;cr){if(s.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=t.length(),d.remaining=r,d.requested=h,d}h=r}var y=32==(32&c);if(y)if(p=[],void 0===h)for(;;){if(i(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}o=t.length(),p.push(e(t,r,n+1,s)),r-=o-t.length()}else for(;h>0;)o=t.length(),p.push(e(t,h,n+1,s)),r-=o-t.length(),h-=o-t.length();void 0===p&&u===a.Class.UNIVERSAL&&l===a.Type.BITSTRING&&(f=t.bytes(h));if(void 0===p&&s.decodeBitStrings&&u===a.Class.UNIVERSAL&&l===a.Type.BITSTRING&&h>1){var g=t.read,v=r,m=0;if(l===a.Type.BITSTRING&&(i(t,r,1),m=t.getByte(),r--),0===m)try{o=t.length();var C={verbose:s.verbose,strict:!0,decodeBitStrings:!0},E=e(t,r,n+1,C),S=o-t.length();r-=S,l==a.Type.BITSTRING&&S++;var T=E.tagClass;S!==h||T!==a.Class.UNIVERSAL&&T!==a.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(t.read=g,r=v)}if(void 0===p){if(void 0===h){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=r}if(l===a.Type.BMPSTRING)for(p="";h>0;h-=2)i(t,r,2),p+=String.fromCharCode(t.getInt16()),r-=2;else p=t.getBytes(h)}var b=void 0===f?null:{bitStringContents:f};return a.create(u,l,y,p,b)}(e,e.length(),0,t)},a.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,i=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=a.equals(e,e.original))),s)i.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:i.putByte(0);for(var o=0;o1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?i.putBytes(e.value.substr(1)):i.putBytes(e.value);if(t.putByte(r),i.length()<=127)t.putByte(127&i.length());else{var c=i.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(o=u.length-1;o>=0;--o)t.putByte(u.charCodeAt(o))}return t.putBuffer(i),t},a.oidToDer=function(e){var t,r,a,i,s=e.split("."),o=n.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c>>=7,t||(i|=128),r.push(i),t=!1}while(a>0);for(var u=r.length-1;u>=0;--u)o.putByte(r[u])}return o},a.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var a=0;e.length()>0;)a<<=7,128&(r=e.getByte())?a+=127&r:(t+="."+(a+r),a=0);return t},a.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},a.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var p=e.length-5,f=e.charAt(p);"+"!==f&&"-"!==f||(u=60*parseInt(e.substr(p+1,2),10)+parseInt(e.substr(p+4,2),10),u*=6e4,"+"===f&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,c),t.setTime(+t+u)):(t.setFullYear(r,n,a),t.setHours(i,s,o,c)),t},a.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},a.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},a.validate=function(e,t,r,i){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)i&&(e.tagClass!==t.tagClass&&i.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&i.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var o=0,c=0;s&&c0&&(i+="\n");for(var o="",c=0;c1?i+="0x"+n.util.bytesToHex(e.value.slice(1)):i+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);1==f?i+=" (1 unused bit shown)":f>1&&(i+=" ("+f+" unused bits shown)")}}else e.type===a.Type.OCTETSTRING?(s.test(e.value)||(i+="("+e.value+") "),i+="0x"+n.util.bytesToHex(e.value)):e.type===a.Type.UTF8?i+=n.util.decodeUtf8(e.value):e.type===a.Type.PRINTABLESTRING||e.type===a.Type.IA5String?i+=e.value:s.test(e.value)?i+="0x"+n.util.bytesToHex(e.value):0===e.value.length?i+="[null]":i+=e.value}return i}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){var n=r(0);function a(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(14),r(21),r(1),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var a=d({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},n.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var a=d({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},n.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){l||p();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return h(r._w,e,t,!1)},decrypt:function(e,t){return h(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var a=0;a>>=2;for(a=0;a>8^255&p^99,i[y]=p,s[p]=y,h=(f=e[p])<<24^p<<16^p<<8^p^f,d=((r=e[y])^(n=e[r])^(a=e[n]))<<24^(y^a)<<16^(y^n^a)<<8^y^r^a;for(var v=0;v<4;++v)c[v][y]=h,u[v][p]=d,h=h<<24|h>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=r^e[e[e[r^a]]],g^=e[e[g]])}}function f(e,t){for(var r,n=e.slice(0),a=1,s=n.length,c=4*(s+6+1),l=s;l>>16&255]<<24^i[r>>>8&255]<<16^i[255&r]<<8^i[r>>>24]^o[a]<<24,a++):s>6&&l%s==4&&(r=i[r>>>24]<<24^i[r>>>16&255]<<16^i[r>>>8&255]<<8^i[255&r]),n[l]=n[l-s]^r;if(t){for(var p,f=u[0],h=u[1],d=u[2],y=u[3],g=n.slice(0),v=(l=0,(c=n.length)-4);l>>24]]^h[i[p>>>16&255]]^d[i[p>>>8&255]]^y[i[255&p]];n=g}return n}function h(e,t,r,n){var a,o,l,p,f,h,d,y,g,v,m,C,E=e.length/4-1;n?(a=u[0],o=u[1],l=u[2],p=u[3],f=s):(a=c[0],o=c[1],l=c[2],p=c[3],f=i),h=t[0]^e[0],d=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var S=3,T=1;T>>24]^o[d>>>16&255]^l[y>>>8&255]^p[255&g]^e[++S],m=a[d>>>24]^o[y>>>16&255]^l[g>>>8&255]^p[255&h]^e[++S],C=a[y>>>24]^o[g>>>16&255]^l[h>>>8&255]^p[255&d]^e[++S],g=a[g>>>24]^o[h>>>16&255]^l[d>>>8&255]^p[255&y]^e[++S],h=v,d=m,y=C;r[0]=f[h>>>24]<<24^f[d>>>16&255]<<16^f[y>>>8&255]<<8^f[255&g]^e[++S],r[n?3:1]=f[d>>>24]<<24^f[y>>>16&255]<<16^f[g>>>8&255]<<8^f[255&h]^e[++S],r[2]=f[y>>>24]<<24^f[g>>>16&255]<<16^f[h>>>8&255]<<8^f[255&d]^e[++S],r[n?1:3]=f[g>>>24]<<24^f[h>>>16&255]<<16^f[d>>>8&255]<<8^f[255&y]^e[++S]}function d(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),a=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof n.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,a.call(t,r)},t}},function(e,t,r){var n=r(0);n.pki=n.pki||{};var a=e.exports=n.pki.oids=n.oids=n.oids||{};function i(e,t){a[e]=t,a[t]=e}function s(e,t){a[e]=t}i("1.2.840.113549.1.1.1","rsaEncryption"),i("1.2.840.113549.1.1.4","md5WithRSAEncryption"),i("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),i("1.2.840.113549.1.1.7","RSAES-OAEP"),i("1.2.840.113549.1.1.8","mgf1"),i("1.2.840.113549.1.1.9","pSpecified"),i("1.2.840.113549.1.1.10","RSASSA-PSS"),i("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),i("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),i("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),i("1.3.101.112","EdDSA25519"),i("1.2.840.10040.4.3","dsa-with-sha1"),i("1.3.14.3.2.7","desCBC"),i("1.3.14.3.2.26","sha1"),i("2.16.840.1.101.3.4.2.1","sha256"),i("2.16.840.1.101.3.4.2.2","sha384"),i("2.16.840.1.101.3.4.2.3","sha512"),i("1.2.840.113549.2.5","md5"),i("1.2.840.113549.1.7.1","data"),i("1.2.840.113549.1.7.2","signedData"),i("1.2.840.113549.1.7.3","envelopedData"),i("1.2.840.113549.1.7.4","signedAndEnvelopedData"),i("1.2.840.113549.1.7.5","digestedData"),i("1.2.840.113549.1.7.6","encryptedData"),i("1.2.840.113549.1.9.1","emailAddress"),i("1.2.840.113549.1.9.2","unstructuredName"),i("1.2.840.113549.1.9.3","contentType"),i("1.2.840.113549.1.9.4","messageDigest"),i("1.2.840.113549.1.9.5","signingTime"),i("1.2.840.113549.1.9.6","counterSignature"),i("1.2.840.113549.1.9.7","challengePassword"),i("1.2.840.113549.1.9.8","unstructuredAddress"),i("1.2.840.113549.1.9.14","extensionRequest"),i("1.2.840.113549.1.9.20","friendlyName"),i("1.2.840.113549.1.9.21","localKeyId"),i("1.2.840.113549.1.9.22.1","x509Certificate"),i("1.2.840.113549.1.12.10.1.1","keyBag"),i("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),i("1.2.840.113549.1.12.10.1.3","certBag"),i("1.2.840.113549.1.12.10.1.4","crlBag"),i("1.2.840.113549.1.12.10.1.5","secretBag"),i("1.2.840.113549.1.12.10.1.6","safeContentsBag"),i("1.2.840.113549.1.5.13","pkcs5PBES2"),i("1.2.840.113549.1.5.12","pkcs5PBKDF2"),i("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),i("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),i("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),i("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),i("1.2.840.113549.2.7","hmacWithSHA1"),i("1.2.840.113549.2.8","hmacWithSHA224"),i("1.2.840.113549.2.9","hmacWithSHA256"),i("1.2.840.113549.2.10","hmacWithSHA384"),i("1.2.840.113549.2.11","hmacWithSHA512"),i("1.2.840.113549.3.7","des-EDE3-CBC"),i("2.16.840.1.101.3.4.1.2","aes128-CBC"),i("2.16.840.1.101.3.4.1.22","aes192-CBC"),i("2.16.840.1.101.3.4.1.42","aes256-CBC"),i("2.5.4.3","commonName"),i("2.5.4.5","serialName"),i("2.5.4.6","countryName"),i("2.5.4.7","localityName"),i("2.5.4.8","stateOrProvinceName"),i("2.5.4.9","streetAddress"),i("2.5.4.10","organizationName"),i("2.5.4.11","organizationalUnitName"),i("2.5.4.13","description"),i("2.5.4.15","businessCategory"),i("2.5.4.17","postalCode"),i("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),i("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),i("2.16.840.1.113730.1.1","nsCertType"),i("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),i("2.5.29.14","subjectKeyIdentifier"),i("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),i("2.5.29.17","subjectAltName"),i("2.5.29.18","issuerAltName"),i("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),i("2.5.29.31","cRLDistributionPoints"),i("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),i("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),i("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),i("1.3.6.1.4.1.11129.2.4.2","timestampList"),i("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),i("1.3.6.1.5.5.7.3.1","serverAuth"),i("1.3.6.1.5.5.7.3.2","clientAuth"),i("1.3.6.1.5.5.7.3.3","codeSigning"),i("1.3.6.1.5.5.7.3.4","emailProtection"),i("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){var n=r(0);r(1);var a=e.exports=n.pem=n.pem||{};function i(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},a=0;a65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),i=a-s-1,s=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(s=a);return t}function s(e){return e.replace(/^\s+/,"")}a.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(a+=i(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(a+=i(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=i(r)),e.headers)for(var s=0;st.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),u=s.length();for(c=0;c>>0,c>>>0];for(var u=a.fullMessageLength.length-1;u>=0;--u)a.fullMessageLength[u]+=c[1],c[1]=c[0]+(a.fullMessageLength[u]/4294967296>>>0),a.fullMessageLength[u]=a.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(i),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var c,u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;s.putBytes(i.substr(0,a.blockLength-u));for(var l=8*a.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=c>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(f,r,s);var h=n.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},a};var i=null,s=!1;function o(e,t,r){for(var n,a,i,s,o,c,u,l=r.length();l>=64;){for(a=e.h0,i=e.h1,s=e.h2,o=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(a<<5|a>>>27)+(o^i&(s^o))+c+1518500249+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(a<<5|a>>>27)+(o^i&(s^o))+c+1518500249+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+1859775393+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+1859775393+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i&s|o&(i^s))+c+2400959708+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+3395469782+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+c|0,l-=64}}},function(e,t,r){var n=r(0);r(3),r(8),r(15),r(7),r(22),r(2),r(9),r(1);var a=function(e,t,r,a){var i=n.util.createBuffer(),s=e.length>>1,o=s+(1&e.length),c=e.substr(0,o),u=e.substr(s,o),l=n.util.createBuffer(),p=n.hmac.create();r=t+r;var f=Math.ceil(a/16),h=Math.ceil(a/20);p.start("MD5",c);var d=n.util.createBuffer();l.putBytes(r);for(var y=0;y0&&(u.queue(e,u.createAlert(e,{level:u.Alert.Level.warning,description:u.Alert.Description.no_renegotiation})),u.flush(e)),e.process()},u.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===u.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});else{var s=t.fragment,c=s.length();if(a={version:{major:s.getByte(),minor:s.getByte()},random:n.util.createBuffer(s.getBytes(32)),session_id:o(s,1),extensions:[]},i?(a.cipher_suite=s.getBytes(2),a.compression_method=s.getByte()):(a.cipher_suites=o(s,2),a.compression_methods=o(s,1)),(c=r-(c-s.length()))>0){for(var l=o(s,2);l.length()>0;)a.extensions.push({type:[l.getByte(),l.getByte()],data:o(l,2)});if(!i)for(var p=0;p0;){if(0!==h.getByte())break;e.session.extensions.server_name.serverNameList.push(o(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=u.getCipherSuite(a.cipher_suite);else for(var d=n.util.createBuffer(a.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=u.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:u.CompressionMethod.none}return a},u.createSecurityParameters=function(e,t){var r=e.entity===u.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:u.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:u.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},u.handleServerHello=function(e,t,r){var n=u.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=d,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,u.createSecurityParameters(e,n)),e.session.id=a,e.process()}},u.handleClientHello=function(e,t,r){var a=u.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),s=null;if(e.sessionCache&&(null===(s=e.sessionCache.getSession(i))?i="":(s.version.major!==a.version.major||s.version.minor>a.version.minor)&&(s=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var o,c=1;c0;)a=o(c.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),l.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var f=e.entity===u.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==l.length?0===l.length?e.expect=f?p:C:(f?e.session.serverCertificate=l[0]:e.session.clientCertificate=l[0],u.verifyCertificateChain(e,l)&&(e.expect=f?p:C)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}}),e.process()},u.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});e.expect=f,e.process()},u.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:o(a,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=n.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}});try{var c=e.session.sp;c.pre_master_secret=s.decrypt(i.enc_pre_master_secret);var l=e.session.clientHelloVersion;if(l.major!==c.pre_master_secret.charCodeAt(0)||l.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){c.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},u.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:o(n,1),certificate_authorities:o(n,2)};e.session.certificateRequest=a,e.expect=h,e.process()},u.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var s={signature:o(a,2).getBytes()},c=n.util.createBuffer();c.putBuffer(e.session.md5.digest()),c.putBuffer(e.session.sha1.digest()),c=c.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure}})}e.expect=S,e.process()},u.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificate(e)}),u.queue(e,t)),t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createClientKeyExchange(e)}),u.queue(e,t),e.expect=v;var s=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificateVerify(e,t)})),u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.pending=u.createConnectionState(e),e.state.current.write=e.state.pending.write,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)})),e.expect=d,u.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return s(e,null);u.getClientSignature(e,s)},u.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var r=e.entity===u.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=u.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?y:T,e.process()},u.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var s=i.bytes();i.read+=4;var o=t.fragment.getBytes();(i=n.util.createBuffer()).putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var c=e.entity===u.ConnectionEnd.client,l=c?"server finished":"client finished",p=e.session.sp;if((i=a(p.master_secret,l,i.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&c||!e.session.resuming&&!c)&&(u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)}))),e.expect=c?g:b,e.handshaking=!1,++e.handshakes,e.peerCertificate=c?e.session.serverCertificate:e.session.clientCertificate,u.flush(e),e.isConnected=!0,e.connected(e),e.process()},u.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case u.Alert.Description.close_notify:r="Connection closed.";break;case u.Alert.Description.unexpected_message:r="Unexpected message.";break;case u.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case u.Alert.Description.decryption_failed:r="Decryption failed.";break;case u.Alert.Description.record_overflow:r="Record overflow.";break;case u.Alert.Description.decompression_failure:r="Decompression failed.";break;case u.Alert.Description.handshake_failure:r="Handshake failure.";break;case u.Alert.Description.bad_certificate:r="Bad certificate.";break;case u.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case u.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case u.Alert.Description.certificate_expired:r="Certificate expired.";break;case u.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case u.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case u.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case u.Alert.Description.access_denied:r="Access denied.";break;case u.Alert.Description.decode_error:r="Decode error.";break;case u.Alert.Description.decrypt_error:r="Decrypt error.";break;case u.Alert.Description.export_restriction:r="Export restriction.";break;case u.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case u.Alert.Description.insufficient_security:r="Insufficient security.";break;case u.Alert.Description.internal_error:r="Internal error.";break;case u.Alert.Description.user_canceled:r="User canceled.";break;case u.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===u.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===u.ConnectionEnd.client?"server":"client",alert:a}),e.process()},u.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(i+4);r.read+=4,a in x[e.entity][e.expect]?(e.entity!==u.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==u.HandshakeType.hello_request&&a!==u.HandshakeType.certificate_verify&&a!==u.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),x[e.entity][e.expect][a](e,t,i)):u.handleUnexpected(e,t)},u.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},u.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),s=r.getBytes(i);if(a===u.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>s.length)return e.process();u.queue(e,u.createRecord(e,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_response,s)})),u.flush(e)}else if(a===u.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(s))}e.process()};var l=1,p=2,f=3,h=4,d=5,y=6,g=7,v=8,m=1,C=2,E=3,S=4,T=5,b=6,I=u.handleUnexpected,A=u.handleChangeCipherSpec,B=u.handleAlert,k=u.handleHandshake,N=u.handleApplicationData,w=u.handleHeartbeat,R=[];R[u.ConnectionEnd.client]=[[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[A,B,I,I,w],[I,B,k,I,w],[I,B,k,N,w],[I,B,k,I,w]],R[u.ConnectionEnd.server]=[[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[A,B,I,I,w],[I,B,k,I,w],[I,B,k,N,w],[I,B,k,I,w]];var L=u.handleHelloRequest,_=u.handleServerHello,U=u.handleCertificate,D=u.handleServerKeyExchange,P=u.handleCertificateRequest,O=u.handleServerHelloDone,V=u.handleFinished,x=[];x[u.ConnectionEnd.client]=[[I,I,_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,U,D,P,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,D,P,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,P,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var K=u.handleClientHello,M=u.handleClientKeyExchange,F=u.handleCertificateVerify;x[u.ConnectionEnd.server]=[[I,K,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,M,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,F,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],u.generateKeys=function(e,t){var r=a,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===u.Versions.TLS_1_0.major&&e.version.minor===u.Versions.TLS_1_0.minor;s&&(i+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",n,i),c={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return s&&(c.client_write_IV=o.getBytes(t.fixed_iv_length),c.server_write_IV=o.getBytes(t.fixed_iv_length)),c},u.createConnectionState=function(e){var t=e.entity===u.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}),!e.fail},e.session){var a=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(a),a.keys=u.generateKeys(e,a),n.read.macKey=t?a.keys.server_write_MAC_key:a.keys.client_write_MAC_key,n.write.macKey=t?a.keys.client_write_MAC_key:a.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,a),a.compression_algorithm){case u.CompressionMethod.none:break;case u.CompressionMethod.deflate:n.read.compressFunction=s,n.write.compressFunction=i;break;default:throw new Error("Unsupported compression algorithm.")}}return n},u.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},u.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},u.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),u.createRecord(e,{type:u.ContentType.alert,data:r})},u.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(d+=2);var y=e.session.id,g=y.length+1+2+4+28+2+i+1+o+d,v=n.util.createBuffer();return v.putByte(u.HandshakeType.client_hello),v.putInt24(g),v.putByte(e.version.major),v.putByte(e.version.minor),v.putBytes(e.session.sp.client_random),c(v,1,n.util.createBuffer(y)),c(v,2,t),c(v,1,s),d>0&&c(v,2,l),v},u.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,a=n.util.createBuffer();return a.putByte(u.HandshakeType.server_hello),a.putInt24(r),a.putByte(e.version.major),a.putByte(e.version.minor),a.putBytes(e.session.sp.server_random),c(a,1,n.util.createBuffer(t)),a.putByte(e.session.cipherSuite.id[0]),a.putByte(e.session.cipherSuite.id[1]),a.putByte(e.session.compressionMethod),a},u.createCertificate=function(e){var t,r=e.entity===u.ConnectionEnd.client,a=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,t));var i=n.util.createBuffer();if(null!==a)try{n.util.isArray(a)||(a=[a]);for(var s=null,o=0;ou.MaxFragment;)a.push(u.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,u.MaxFragment))})),i=i.slice(u.MaxFragment);i.length>0&&a.push(u.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var s=0;s0&&(a=r.order[0]),null!==a&&a in r.cache)for(var i in t=r.cache[a],delete r.cache[a],r.order)if(r.order[i]===a){r.order.splice(i,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var a=r.order.shift();delete r.cache[a]}a=n.util.bytesToHex(e);r.order.push(a),r.cache[a]=t}}return r},u.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var a in r=[],u.CipherSuites)r.push(u.CipherSuites[a]);var i=e.server?u.ConnectionEnd.server:u.ConnectionEnd.client,s=e.sessionCache?u.createSessionCache(e.sessionCache):null,o={version:{major:u.Version.major,minor:u.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===u.ConnectionEnd.client?"client":"server"),r.send&&(u.queue(t,u.createAlert(t,r.alert)),u.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){o.version={major:u.Version.major,minor:u.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=(o.entity,u.ConnectionEnd.client,0),o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(e||void 0===e),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=u.createConnectionState(o)}};o.reset();return o.handshake=function(e){if(o.entity!==u.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0;var t=null;(e=e||"").length>0&&(o.sessionCache&&(t=o.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&o.sessionCache&&null!==(t=o.sessionCache.getSession())&&(e=t.id),o.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(o.version=t.version,o.session.sp=t.sp),o.session.sp.client_random=u.createRandom().getBytes(),o.open=!0,u.queue(o,u.createRecord(o,{type:u.ContentType.handshake,data:u.createClientHello(o)})),u.flush(o)}},o.process=function(e){var t=0;return e&&o.input.putBytes(e),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(t=function(e){var t=0,r=e.input,a=r.length();if(a<5)t=5-a;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}})}return t}(o)),o.fail||null===o.record||o.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();n8?3:1,v=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],C=0,E=0;E>>4^T))<<4,S^=t=65535&((T^=t)>>>-16^S),S^=(t=858993459&(S>>>2^(T^=t<<-16)))<<2,S^=t=65535&((T^=t)>>>-16^S),S^=(t=1431655765&(S>>>1^(T^=t<<-16)))<<1,S^=t=16711935&((T^=t)>>>8^S),t=(S^=(t=1431655765&(S>>>1^(T^=t<<8)))<<1)<<8|(T^=t)>>>20&240,S=T<<24|T<<8&16711680|T>>>8&65280|T>>>24&240,T=t;for(var b=0;b>>26,T=T<<2|T>>>26):(S=S<<1|S>>>27,T=T<<1|T>>>27);var I=r[(S&=-15)>>>28]|n[S>>>24&15]|a[S>>>20&15]|i[S>>>16&15]|s[S>>>12&15]|o[S>>>8&15]|c[S>>>4&15],A=u[(T&=-15)>>>28]|l[T>>>24&15]|p[T>>>20&15]|f[T>>>16&15]|h[T>>>12&15]|d[T>>>8&15]|y[T>>>4&15];t=65535&(A>>>16^I),v[C++]=I^t,v[C++]=A^t<<16}}return v}(t),this._init=!0}},a("DES-ECB",n.cipher.modes.ecb),a("DES-CBC",n.cipher.modes.cbc),a("DES-CFB",n.cipher.modes.cfb),a("DES-OFB",n.cipher.modes.ofb),a("DES-CTR",n.cipher.modes.ctr),a("3DES-ECB",n.cipher.modes.ecb),a("3DES-CBC",n.cipher.modes.cbc),a("3DES-CFB",n.cipher.modes.cfb),a("3DES-OFB",n.cipher.modes.ofb),a("3DES-CTR",n.cipher.modes.ctr);var i=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function h(e,t,r,n){var a,h,d=32===e.length?3:9;a=3===d?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(h=252645135&(y>>>4^g))<<4,y^=(h=65535&(y>>>16^(g^=h)))<<16,y^=h=858993459&((g^=h)>>>2^y),y^=h=16711935&((g^=h<<2)>>>8^y),y=(y^=(h=1431655765&(y>>>1^(g^=h<<8)))<<1)<<1|y>>>31,g=(g^=h)<<1|g>>>31;for(var v=0;v>>4|g<<28)^e[E+1];h=y,y=g,g=h^(s[S>>>24&63]|c[S>>>16&63]|l[S>>>8&63]|f[63&S]|i[T>>>24&63]|o[T>>>16&63]|u[T>>>8&63]|p[63&T])}h=y,y=g,g=h}g=g>>>1|g<<31,g^=h=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(h=16711935&(g>>>8^(y^=h<<1)))<<8,g^=(h=858993459&(g>>>2^(y^=h)))<<2,g^=h=65535&((y^=h)>>>16^g),g^=h=252645135&((y^=h<<16)>>>4^g),y^=h<<4,r[0]=y,r[1]=g}function d(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),a=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof n.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,a.call(t,r)},t}},function(e,t,r){var n=r(0);if(r(3),r(13),r(6),r(27),r(28),r(2),r(1),void 0===a)var a=n.jsbn.BigInteger;var i=n.util.isNodejs?r(17):null,s=n.asn1,o=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,u=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},h=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},d=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);i.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),i.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return a.value.push(i),a.value.push(o),s.toDer(a).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var i;t.dP||(t.dP=t.d.mod(t.p.subtract(a.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(a.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{i=new a(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(i.compareTo(t.n)>=0||!i.gcd(t.n).equals(a.ONE));for(var s=(e=e.multiply(i.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var c=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return c=c.multiply(i.modInverse(t.n)).mod(t.n)};function g(e,t,r){var a=n.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=i-11,s}a.putByte(0),a.putByte(r);var o,c=i-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var u=0;u0;){var l=0,p=n.random.getBytes(c);for(u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function m(e,t,r){"function"==typeof t&&(r=t,t={});var i={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?u(t,e.q):void o(e.qBits,u))}))}function o(e,t){n.prime.generateProbablePrime(e,i,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var i=e.p;e.p=e.q,e.q=i}if(0!==e.p.subtract(a.ONE).gcd(e.e).compareTo(a.ONE))return e.p=null,void s();if(0!==e.q.subtract(a.ONE).gcd(e.e).compareTo(a.ONE))return e.q=null,void o(e.qBits,u);if(e.p1=e.p.subtract(a.ONE),e.q1=e.q.subtract(a.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(a.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(i.prng=t.prng),s()}function C(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function S(e){return n.util.isNodejs&&"function"==typeof i[e]}function T(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function b(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function I(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),a=0;a0;)l.putByte(0),--p;return l.putBytes(n.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o}var c=new a(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,t,r).toString(16),l=n.util.createBuffer(),p=s-Math.ceil(u.length/2);p>0;)l.putByte(0),--p;return l.putBytes(n.util.hexToBytes(u)),!1!==i?v(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var i,s=(r=r||{}).prng||n.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(i.eInt),i},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new a(null);r.fromInt(30);for(var n,i=0,s=function(e,t){return e|t},o=+new Date,l=0;null===e.keys&&(t<=0||lp?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(a.ONE).gcd(e.e).compareTo(a.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(a.ONE),e.q1=e.q.subtract(a.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(a.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}l+=(n=+new Date)-o,o=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,a){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(a=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(a=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,a=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(a=r,r=void 0):(a=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(a){if(S("generateKeyPair"))return i.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return a(e);a(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(T("generateKey")&&T("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){a(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));a(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(b("generateKey")&&b("exportKey")){var u=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));a(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){a(e)}},void(u.onerror=function(e){a(e)})}}else if(S("generateKeyPairSync")){var l=i.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var p=c.rsa.createKeyPairGenerationState(e,t,r);if(!a)return c.rsa.stepKeyPairGenerationState(p,0),p.keys;m(p,r,a)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,a){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return c.rsa.encrypt(i,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=v(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===(t=v(t,r,!0))}});var a=c.rsa.decrypt(t,r,!0,!1);return n.verify(e,a,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,a,i,s,o,u){var l={n:e,e:t,d:r,p:a,q:i,dP:s,dQ:o,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var a=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(a,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return c.rsa.encrypt(n,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,i,o,u,f,h,d,y={},g=[];if(s.validate(e,l,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,p,y,g)){var v=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw v.errors=g,v}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),i=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),o=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),f=n.util.createBuffer(y.privateKeyExponent1).toHex(),h=n.util.createBuffer(y.privateKeyExponent2).toHex(),d=n.util.createBuffer(y.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new a(t,16),new a(r,16),new a(i,16),new a(o,16),new a(u,16),new a(f,16),new a(h,16),new a(d,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,h,t,r)){var i,o=s.derToOid(t.publicKeyOid);if(o!==c.oids.rsaEncryption)throw(i=new Error("Cannot read public key. Unknown OID.")).oid=o,i;e=t.rsaPublicKey}if(r=[],!s.validate(e,f,t,r))throw(i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,i;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),l=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new a(u,16),new a(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e))])}},function(e,t,r){var n,a=r(0);e.exports=a.jsbn=a.jsbn||{};function i(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new i(null)}function o(e,t,r,n,a,i){for(var s=16383&t,o=t>>14;--i>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=o*c+u*s;a=((c=s*c+((16383&l)<<14)+r.data[n]+a)>>28)+(l>>14)+o*u,r.data[n++]=268435455&c}return a}a.jsbn.BigInteger=i,"undefined"==typeof navigator?(i.prototype.am=o,n=28):"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(e,t,r,n,a,i){for(var s=32767&t,o=t>>15;--i>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=o*c+u*s;a=((c=s*c+((32767&l)<<15)+r.data[n]+(1073741823&a))>>>30)+(l>>>15)+o*u+(a>>>30),r.data[n++]=1073741823&c}return a},n=30):"Netscape"!=navigator.appName?(i.prototype.am=function(e,t,r,n,a,i){for(;--i>=0;){var s=t*this.data[e++]+r.data[n]+a;a=Math.floor(s/67108864),r.data[n++]=67108863&s}return a},n=26):(i.prototype.am=o,n=28),i.prototype.DB=n,i.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function T(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function b(){}function I(e){return e}function A(e){this.r2=s(),this.q3=s(),i.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(i.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},i.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},i.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},i.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,a=!1,s=0;--n>=0;){var o=8==r?255&e[n]:f(e,n);o<0?"-"==e.charAt(n)&&(a=!0):(a=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<>this.DB-s):this.data[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},i.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},i.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>a|o,o=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},i.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var s=r+1;s>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},i.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),a=r.t;for(t.t=a+n.t;--a>=0;)t.data[a]=0;for(a=0;a=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},i.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,r)):(n.copyTo(o),a.copyTo(r));var p=o.t,f=o.data[p-1];if(0!=f){var h=f*(1<1?o.data[p-2]>>this.F2:0),y=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(E,r)),i.ONE.dlShiftTo(p,E),E.subTo(o,o);o.t=0;){var S=r.data[--m]==f?this.DM:Math.floor(r.data[m]*y+(r.data[m-1]+v)*g);if((r.data[m]+=o.am(0,S,r,C,0,p))0&&r.rShiftTo(l,r),c<0&&i.ZERO.subTo(r,r)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},i.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},i.prototype.exp=function(e,t){if(e>4294967295||e<1)return i.ONE;var r=s(),n=s(),a=t.convert(this),o=d(e)-1;for(a.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,a,r);else{var c=r;r=n,n=c}return t.revert(r)},i.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(o>o)>0&&(a=!0,i=p(r));s>=0;)o>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&n,o<=0&&(o+=this.DB,--s)),r>0&&(a=!0),a&&(i+=p(r));return a?i:"0"},i.prototype.negate=function(){var e=s();return i.ZERO.subTo(this,e),e},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},i.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(i.ZERO)>0&&e.subTo(t,t),t},i.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},i.ZERO=h(0),i.ONE=h(1),b.prototype.convert=I,b.prototype.revert=I,b.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},b.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],k=(1<<26)/B[B.length-1];i.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},i.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=h(r),a=s(),i=s(),o="";for(this.divRemTo(n,a,i);a.signum()>0;)o=(r+i.intValue()).toString(e).substr(1)+o,a.divRemTo(n,a,i);return i.intValue().toString(e)+o},i.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),a=!1,s=0,o=0,c=0;c=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(i.ONE.shiftLeft(e-1),m,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(i.ONE.shiftLeft(e-1),this);else{var n=new Array,a=7&e;n.length=1+(e>>3),t.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},i.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},i.prototype.multiplyLowerTo=function(e,t,r){var n,a=Math.min(this.t+e.t,t);for(r.s=0,r.t=a;a>0;)r.data[--a]=0;for(n=r.t-this.t;a=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},i.prototype.millerRabin=function(e){var t=this.subtract(i.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,a=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var c=n.modPow(a,this);if(0!=c.compareTo(i.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},i.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,a=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[a++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==a&&(128&this.s)!=(128&r)&&++a,(a>0||r!=this.s)&&(t[a++]=r);return t},i.prototype.equals=function(e){return 0==this.compareTo(e)},i.prototype.min=function(e){return this.compareTo(e)<0?this:e},i.prototype.max=function(e){return this.compareTo(e)>0?this:e},i.prototype.and=function(e){var t=s();return this.bitwiseTo(e,v,t),t},i.prototype.or=function(e){var t=s();return this.bitwiseTo(e,m,t),t},i.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,C,t),t},i.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},i.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var p=s();for(n.sqrTo(o[1],p);c<=l;)o[c]=s(),n.mulTo(p,o[c-2],o[c]),c+=2}var f,v,m=e.t-1,C=!0,E=s();for(a=d(e.data[m])-1;m>=0;){for(a>=u?f=e.data[m]>>a-u&l:(f=(e.data[m]&(1<0&&(f|=e.data[m-1]>>this.DB+a-u)),c=r;0==(1&f);)f>>=1,--c;if((a-=c)<0&&(a+=this.DB,--m),C)o[f].copyTo(i),C=!1;else{for(;c>1;)n.sqrTo(i,E),n.sqrTo(E,i),c-=2;c>0?n.sqrTo(i,E):(v=i,i=E,E=v),n.mulTo(E,o[f],i)}for(;m>=0&&0==(e.data[m]&1<=0?(r.subTo(n,r),t&&a.subTo(o,a),s.subTo(c,s)):(n.subTo(r,n),t&&o.subTo(a,o),c.subTo(s,c))}return 0!=n.compareTo(i.ONE)?i.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},i.prototype.pow=function(e){return this.exp(e,new b)},i.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var a=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(a0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r},i.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=B[B.length-1]){for(t=0;t>>0,o>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=o[1],o[1]=o[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;s.putBytes(i.substr(0,a.blockLength-o));for(var c,u=0,p=a.fullMessageLength.length-1;p>=0;--p)u=(c=8*a.fullMessageLength[p]+u)/4294967296>>>0,s.putInt32Le(c>>>0);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(f,r,s);var h=n.util.createBuffer();return h.putInt32Le(f.h0),h.putInt32Le(f.h1),h.putInt32Le(f.h2),h.putInt32Le(f.h3),h},a};var i=null,s=null,o=null,c=null,u=!1;function l(e,t,r){for(var n,a,i,u,l,p,f,h=r.length();h>=64;){for(a=e.h0,i=e.h1,u=e.h2,l=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),n=a+(l^i&(u^l))+c[f]+t[f],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;for(;f<32;++f)n=a+(u^l&(i^u))+c[f]+t[s[f]],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;for(;f<48;++f)n=a+(i^u^l)+c[f]+t[s[f]],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;for(;f<64;++f)n=a+(u^(i|~l))+c[f]+t[s[f]],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+u|0,e.h3=e.h3+l|0,h-=64}}},function(e,t,r){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(17)),e.exports=n.pbkdf2=i.pbkdf2=function(e,t,r,i,s,o){if("function"==typeof s&&(o=s,s=null),n.util.isNodejs&&!n.options.usePureJavaScript&&a.pbkdf2&&(null===s||"object"!=typeof s)&&(a.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),o?4===a.pbkdf2Sync.length?a.pbkdf2(e,t,r,i,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):a.pbkdf2(e,t,r,i,s,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,t,r,i).toString("binary"):a.pbkdf2Sync(e,t,r,i,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in n.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=n.md[s].create()}var c=s.digestLength;if(i>4294967295*c){var u=new Error("Derived key is too long.");if(o)return o(u);throw u}var l=Math.ceil(i/c),p=i-(l-1)*c,f=n.hmac.create();f.start(s,e);var h,d,y,g="";if(!o){for(var v=1;v<=l;++v){f.start(null,null),f.update(t),f.update(n.util.int32ToBytes(v)),h=y=f.digest().getBytes();for(var m=2;m<=r;++m)f.start(null,null),f.update(y),d=f.digest().getBytes(),h=n.util.xorBytes(h,d,c),y=d;g+=vl)return o(null,g);f.start(null,null),f.update(t),f.update(n.util.int32ToBytes(v)),h=y=f.digest().getBytes(),m=2,E()}function E(){if(m<=r)return f.start(null,null),f.update(y),d=f.digest().getBytes(),h=n.util.xorBytes(h,d,c),y=d,++m,n.util.setImmediate(E);g+=v128)throw new Error('Invalid "nsComment" content.');e.value=a.create(a.Class.UNIVERSAL,a.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var d=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(a.create(a.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[a.create(a.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(a.create(a.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var v=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(a.create(a.Class.CONTEXT_SPECIFIC,2,!1,v))}}else if("cRLDistributionPoints"===e.name){e.value=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);l=e.value.value;var m,C=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),E=a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=p[0],c.validity.notAfter=p[1],c.tbsCertificate=r.tbsCertificate,t){var f;if(c.md=null,c.signatureOid in s)switch(s[c.signatureOid]){case"sha1WithRSAEncryption":c.md=n.md.sha1.create();break;case"md5WithRSAEncryption":c.md=n.md.md5.create();break;case"sha256WithRSAEncryption":c.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=n.md.sha512.create();break;case"RSASSA-PSS":c.md=n.md.sha256.create()}if(null===c.md)throw(f=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,f;var y=a.toDer(c.tbsCertificate);c.md.update(y.getBytes())}var v=n.md.sha1.create();c.issuer.getField=function(e){return h(c.issuer,e)},c.issuer.addField=function(e){g([e]),c.issuer.attributes.push(e)},c.issuer.attributes=i.RDNAttributesAsArray(r.certIssuer,v),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=v.digest().toHex();var m=n.md.sha1.create();return c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){g([e]),c.subject.attributes.push(e)},c.subject.attributes=i.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=m.digest().toHex(),r.certExtensions?c.extensions=i.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=i.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},i.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),i=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&i)}else if("basicConstraints"===t.name){(c=a.fromDer(t.value)).value.length>0&&c.value[0].type===a.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var o=null;c.value.length>0&&c.value[0].type===a.Type.INTEGER?o=c.value[0].value:c.value.length>1&&(o=c.value[1].value),null!==o&&(t.pathLenConstraint=a.derToInteger(o))}else if("extKeyUsage"===t.name)for(var c=a.fromDer(t.value),u=0;u1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var p;t.altNames=[];c=a.fromDer(t.value);for(var f=0;f=E&&e0&&s.value.push(i.certificateExtensionsToAsn1(e.extensions)),s},i.getCertificationRequestInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(e.version).getBytes()),y(e.subject),i.publicKeyToAsn1(e.publicKey),C(e)])},i.distinguishedNameToAsn1=function(e){return y(e)},i.certificateToAsn1=function(e){var t=e.tbsCertificate||i.getTBSCertificate(e);return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[t,a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},i.certificateExtensionsToAsn1=function(e){var t=a.create(a.Class.CONTEXT_SPECIFIC,3,!0,[]),r=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;nl.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:i.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===c){if(null===(p=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(f=!0,p=l),p){var h=p;n.util.isArray(h)||(h=[h]);for(var d=!1;!d&&h.length>0;){p=h.shift();try{d=p.verify(l)}catch(e){}}d||(c={message:"Certificate signature is invalid.",error:i.certificateError.bad_certificate})}null!==c||p&&!f||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:i.certificateError.unknown_ca})}if(null===c&&p&&!l.isIssuer(p)&&(c={message:"Certificate issuer is invalid.",error:i.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&gm.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:i.certificateError.bad_certificate})}var E=null===c||c.error,S=r.verify?r.verify(E,u,a):E;if(!0!==S)throw!0===E&&(c={message:"The application rejected the certificate.",error:i.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||n.util.isArray(S)?"string"==typeof S&&(c.error=S):(S.message&&(c.message=S.message),S.error&&(c.error=S.error))),c;c=null,o=!1,++u}while(t.length>0);return!0}},function(e,t,r){var n=r(0);r(2),r(1),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,a=e.mgf,i=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||n.random,c={encode:function(e,c){var u,l,p=c-1,f=Math.ceil(p/8),h=e.digest().getBytes();if(f>8*f-p&255;return(E=String.fromCharCode(E.charCodeAt(0)&~S)+E.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,o){var c,u=o-1,l=Math.ceil(u/8);if(s=s.substr(-l),l>8*l-u&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=a.generate(h,p),g="";for(c=0;c4){var r=e;e=n.util.createBuffer();for(var a=0;a0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},a.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},a.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},a.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},a.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},a.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},a.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0)e.read-=this.blockSize;else for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},a.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0)e.read-=this.blockSize;else for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},a.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},a.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},a.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0)e.read-=this.blockSize;else for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},a.ofb.prototype.decrypt=a.ofb.prototype.encrypt,a.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},a.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},a.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},a.ctr.prototype.decrypt=a.ctr.prototype.encrypt,a.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},a.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var a=r.length();if(12===a)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*a)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=o(8*t.length());var i=t.length()%this.blockSize;for(i&&t.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},a.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},a.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var a=0;a0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},a.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,a=this._m[r][n];t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3]}return t},a.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},a.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),s=0;s>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;c--)w>>=8,w+=A.at(c)+N.at(c),N.setAt(c,255&w);k.putBuffer(N)}E=k,p.putBuffer(b)}return p.truncate(p.length()-i),p},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var a,o={},c=[];if(!i.validate(t,u,o,c))throw(a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,a;if((e=i.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(a=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,a.supportedOids=["pkcs5PBKDF2"],a;if((e=i.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(a=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,a.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],a;var l,p,h=o.kdfSalt,d=n.util.createBuffer(o.kdfIterationCount);switch(d=d.getInt(d.length()<<3),s.oids[e]){case"aes128-CBC":l=16,p=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,p=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,p=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,p=n.des.createDecryptionCipher;break;case"desCBC":l=8,p=n.des.createDecryptionCipher}var y=f(o.prfOid),g=n.pkcs5.pbkdf2(r,h,d,l,y),v=o.encIv,m=p(g);return m.start(v),m},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var a={},o=[];if(!i.validate(t,l,a,o))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,y;var c,u,p,h=n.util.createBuffer(a.salt),d=n.util.createBuffer(a.iterations);switch(d=d.getInt(d.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,p=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,p=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=f(a.prfOid),v=s.pbe.generatePkcs12Key(r,h,1,d,c,g);return g.start(),p(v,s.pbe.generatePkcs12Key(r,h,2,d,u,g))},s.pbe.opensslDeriveBytes=function(e,t,r,a){if(null==a){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');a=n.md.md5.create()}null===t&&(t="");for(var i=[p(a,e+t)],s=16,o=1;s>>0,o>>>0];for(var u=a.fullMessageLength.length-1;u>=0;--u)a.fullMessageLength[u]+=o[1],o[1]=o[0]+(a.fullMessageLength[u]/4294967296>>>0),a.fullMessageLength[u]=a.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o,u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;s.putBytes(i.substr(0,a.blockLength-u));for(var l=8*a.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=o>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(f,r,s);var h=n.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},a};var i=null,s=!1,o=null;function c(e,t,r){for(var n,a,i,s,c,u,l,p,f,h,d,y,g,v=r.length();v>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=((a=t[c-15])>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[c]=n+t[c-7]+a+t[c-16]|0;for(u=e.h0,l=e.h1,p=e.h2,f=e.h3,h=e.h4,d=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)i=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&l|p&(u^l),n=g+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(y^h&(d^y))+o[c]+t[c],g=y,y=d,d=h,h=f+n>>>0,f=p,p=l,l=u,u=n+(a=i+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+p|0,e.h3=e.h3+f|0,e.h4=e.h4+h|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,v-=64}}},function(e,t,r){var n=r(0);r(1);var a=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(a=r(17)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,i=new Array(32),s=0;s<32;++s)i[s]=r.create();function o(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var a=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(a),t.generated=0}function u(e){var t=null,r=n.util.globalScope,a=r.crypto||r.msCrypto;a&&a.getRandomValues&&(t=function(e){return a.getRandomValues(e)});var i=n.util.createBuffer();if(t)for(;i.length()>16)))<<16,f=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)p=f>>>(c<<3),p^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&p))}return i.getBytes(e)}return t.pools=i,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var a=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed,u=n.util.createBuffer();t.key=null,function l(p){if(p)return r(p);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(l)}));var f=a(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=s(a(t.key,i(t.seed))),t.seed=o(a(t.key,t.seed)),n.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,a=t.plugin.increment,i=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&o();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=i(r(t.key,a(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},a?(t.seedFile=function(e,t){a.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return a.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,n=0;n>a&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},function(e,t,r){var n=r(0);r(1);var a=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],s=function(e,t){return e<>16-t},o=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,s=e.length(),o=t,c=Math.ceil(o/8),u=255>>(7&o);for(r=s;r<128;r++)i.putByte(a[i.at(r-1)+i.at(r-s)&255]);for(i.setAt(128-c,a[i.at(128-c)&u]),r=127-c;r>=0;r--)i.setAt(r,a[i.at(r+1)^i.at(r+c)]);return i};var c=function(e,t,r){var a,c,u,l,p=!1,f=null,h=null,d=null,y=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(a=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=s(e[u],i[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(a=function(e){for(u=3;u>=0;u--)e[u]=o(e[u],i[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var n=f.getInt16Le();null!==d&&(r?n^=d.getInt16Le():d.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var a=0;a=8;)g([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var n=8===f.length()?8:8-f.length();f.fillWithByte(n,n)}if(t&&(p=!0,v.update()),!r&&(t=0===f.length()))if(e)t=e(8,h,!r);else{var a=h.length(),i=h.at(a-1);i>a?t=!1:h.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var a=n.rc2.createEncryptionCipher(e,128);return a.start(t,r),a},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var a=n.rc2.createDecryptionCipher(e,128);return a.start(t,r),a},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},function(e,t,r){var n=r(0);r(1),r(2),r(9);var a=e.exports=n.pkcs1=n.pkcs1||{};function i(e,t,r){r||(r=n.md.sha1.create());for(var a="",i=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+o),a+=r.digest().getBytes()}return a.substring(0,t)}a.encode_rsa_oaep=function(e,t,r){var a,s,o,c;"string"==typeof r?(a=r,s=arguments[3]||void 0,o=arguments[4]||void 0):r&&(a=r.label||void 0,s=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),o?o.start():o=n.md.sha1.create(),c||(c=o);var u=Math.ceil(e.n.bitLength()/8),l=u-2*o.digestLength-2;if(t.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=l,g;a||(a=""),o.update(a,"raw");for(var p=o.digest(),f="",h=l-t.length,d=0;de&&(s=c(e,t));var h=s.toString(16);a.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(p,0)}}}h()}(e,t,a,i);return o(e,t,a,i)}(e,u,i.options,a);throw new Error("Invalid prime generation algorithm: "+i.name)}}function o(e,t,r,i){var s=c(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(s.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),function e(t,r,i,s,o,u,l){var p=+new Date;do{if(t.bitLength()>r&&(t=c(r,i)),t.isProbablePrime(o))return l(null,t);t.dAddOffset(a[s++%8],0)}while(u<0||+new Date-p=0&&a.push(o):a.push(o))}return a}function h(e){if(e.composed||e.constructed){for(var t=n.util.createBuffer(),r=0;r0&&(c=a.create(a.Class.UNIVERSAL,a.Type.SET,!0,p));var f=[],h=[];null!==t&&(h=n.util.isArray(t)?t:[t]);for(var d=[],y=0;y0){var C=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,d),E=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.data).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(C).getBytes())])]);f.push(E)}var S=null;if(null!==e){var T=i.wrapRsaPrivateKey(i.privateKeyToAsn1(e));S=null===r?a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.keyBag).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[T]),c]):a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.pkcs8ShroudedKeyBag).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[i.encryptPrivateKeyInfo(T,r,o)]),c]);var b=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[S]),I=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.data).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(b).getBytes())])]);f.push(I)}var A,B=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,f);if(o.useMac){var k=n.md.sha1.create(),N=new n.util.ByteBuffer(n.random.getBytes(o.saltSize)),w=o.count,R=(e=s.generateKey(r,N,3,w,20),n.hmac.create());R.start(k,e),R.update(a.toDer(B).getBytes());var L=R.getMac();A=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.sha1).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,L.getBytes())]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,N.getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(w).getBytes())])}return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(3).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.data).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(B).getBytes())])]),A])},s.generateKey=n.pbe.generatePkcs12Key},function(e,t,r){var n=r(0);r(3),r(1);var a=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var s={name:"ContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=s;var o={name:"EncryptedContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},i.encryptedDataValidator={name:"EncryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var c={name:"SignerInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(0);r(1),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var a=new n.util.ByteBuffer,i=Math.ceil(r/e.digestLength),s=0;s>>0,s>>>0];for(var o=h.fullMessageLength.length-1;o>=0;--o)h.fullMessageLength[o]+=s[1],s[1]=s[0]+(h.fullMessageLength[o]/4294967296>>>0),h.fullMessageLength[o]=h.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return a.putBytes(e),l(r,i,a),(a.read>2048||0===a.length())&&a.compact(),h},h.digest=function(){var t=n.util.createBuffer();t.putBytes(a.bytes());var o,c=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var u=8*h.fullMessageLength[0],p=0;p>>0,t.putInt32(u>>>0),u=o>>>0;t.putInt32(u);var f=new Array(r.length);for(p=0;p=128;){for(R=0;R<16;++R)t[R][0]=r.getInt32()>>>0,t[R][1]=r.getInt32()>>>0;for(;R<80;++R)n=(((L=(U=t[R-2])[0])>>>19|(_=U[1])<<13)^(_>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|_>>>19)^(_<<3|L>>>29)^(L<<26|_>>>6))>>>0,i=(((L=(P=t[R-15])[0])>>>1|(_=P[1])<<31)^(L>>>8|_<<24)^L>>>7)>>>0,s=((L<<31|_>>>1)^(L<<24|_>>>8)^(L<<25|_>>>7))>>>0,D=t[R-7],O=t[R-16],_=a+D[1]+s+O[1],t[R][0]=n+D[0]+i+O[0]+(_/4294967296>>>0)>>>0,t[R][1]=_>>>0;for(d=e[0][0],y=e[0][1],g=e[1][0],v=e[1][1],m=e[2][0],C=e[2][1],E=e[3][0],S=e[3][1],T=e[4][0],b=e[4][1],I=e[5][0],A=e[5][1],B=e[6][0],k=e[6][1],N=e[7][0],w=e[7][1],R=0;R<80;++R)l=((T>>>14|b<<18)^(T>>>18|b<<14)^(b>>>9|T<<23))>>>0,p=(B^T&(I^B))>>>0,o=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,u=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,f=(d&g|m&(d^g))>>>0,h=(y&v|C&(y^v))>>>0,_=w+(((T<<18|b>>>14)^(T<<14|b>>>18)^(b<<23|T>>>9))>>>0)+((k^b&(A^k))>>>0)+c[R][1]+t[R][1],n=N+l+p+c[R][0]+t[R][0]+(_/4294967296>>>0)>>>0,a=_>>>0,i=o+f+((_=u+h)/4294967296>>>0)>>>0,s=_>>>0,N=B,w=k,B=I,k=A,I=T,A=b,T=E+n+((_=S+a)/4294967296>>>0)>>>0,b=_>>>0,E=m,S=C,m=g,C=v,g=d,v=y,d=n+i+((_=a+s)/4294967296>>>0)>>>0,y=_>>>0;_=e[0][1]+y,e[0][0]=e[0][0]+d+(_/4294967296>>>0)>>>0,e[0][1]=_>>>0,_=e[1][1]+v,e[1][0]=e[1][0]+g+(_/4294967296>>>0)>>>0,e[1][1]=_>>>0,_=e[2][1]+C,e[2][0]=e[2][0]+m+(_/4294967296>>>0)>>>0,e[2][1]=_>>>0,_=e[3][1]+S,e[3][0]=e[3][0]+E+(_/4294967296>>>0)>>>0,e[3][1]=_>>>0,_=e[4][1]+b,e[4][0]=e[4][0]+T+(_/4294967296>>>0)>>>0,e[4][1]=_>>>0,_=e[5][1]+A,e[5][0]=e[5][0]+I+(_/4294967296>>>0)>>>0,e[5][1]=_>>>0,_=e[6][1]+k,e[6][0]=e[6][0]+B+(_/4294967296>>>0)>>>0,e[6][1]=_>>>0,_=e[7][1]+w,e[7][0]=e[7][0]+N+(_/4294967296>>>0)>>>0,e[7][1]=_>>>0,V-=128}}},function(e,t,r){var n=r(0);r(1),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var a={},i=[],s=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var o=0;o0;)(r=e.requests.shift()).request.aborted&&(r=null);null===r?(null!==t.options&&(t.options=null),e.idle.push(t)):(t.retries=1,t.options=r,u(e,t))},p=function(e,t,r){t.options=null,t.connected=function(r){if(null===t.options)l(e,t);else{var n=t.options.request;if(n.connectTime=+new Date-n.connectTime,r.socket=t,t.options.connected(r),n.aborted)t.close();else{var a=n.toString();n.body&&(a+=n.body),n.time=+new Date,t.send(a),n.time=+new Date-n.time,t.options.response.time=+new Date,t.sending=!0}}},t.closed=function(r){if(t.sending)t.sending=!1,t.retries>0?(--t.retries,u(e,t)):t.error({id:t.id,type:"ioError",message:"Connection closed during send. Broken pipe.",bytesAvailable:0});else{var n=t.options.response;n.readBodyUntilClose&&(n.time=+new Date-n.time,n.bodyReceived=!0,t.options.bodyReady({request:t.options.request,response:n,socket:t})),t.options.closed(r),l(e,t)}},t.data=function(r){if(t.sending=!1,t.options.request.aborted)t.close();else{var n=t.options.response,a=t.receive(r.bytesAvailable);if(null!==a)if(t.buffer.putBytes(a),n.headerReceived||(n.readHeader(t.buffer),n.headerReceived&&t.options.headerReady({request:t.options.request,response:n,socket:t})),n.headerReceived&&!n.bodyReceived&&n.readBody(t.buffer),n.bodyReceived)t.options.bodyReady({request:t.options.request,response:n,socket:t}),-1!=(n.getField("Connection")||"").indexOf("close")||"HTTP/1.0"===n.version&&null===n.getField("Keep-Alive")?t.close():l(e,t)}},t.error=function(e){t.options.error({type:e.type,message:e.message,request:t.options.request,response:t.options.response,socket:t}),t.close()},r?((t=n.tls.wrapSocket({sessionId:null,sessionCache:{},caStore:r.caStore,cipherSuites:r.cipherSuites,socket:t,virtualHost:r.virtualHost,verify:r.verify,getCertificate:r.getCertificate,getPrivateKey:r.getPrivateKey,getSignature:r.getSignature,deflate:r.deflate||null,inflate:r.inflate||null})).options=null,t.buffer=n.util.createBuffer(),e.sockets.push(t),r.prime?t.connect({host:e.url.host,port:e.url.port,policyPort:e.policyPort,policyUrl:e.policyUrl}):e.idle.push(t)):(t.buffer=n.util.createBuffer(),e.sockets.push(t),e.idle.push(t))},f=function(e){var t=!1;if(-1!==e.maxAge){var r=y(new Date);e.created+e.maxAge<=r&&(t=!0)}return t};a.createClient=function(e){var t=null;e.caCerts&&(t=n.pki.createCaStore(e.caCerts)),e.url=e.url||window.location.protocol+"//"+window.location.host;var r=a.parseUrl(e.url);if(!r){var i=new Error("Invalid url.");throw i.details={url:e.url},i}e.connections=e.connections||1;var l=e.socketPool,h={url:r,socketPool:l,policyPort:e.policyPort,policyUrl:e.policyUrl,requests:[],sockets:[],idle:[],secure:"https"===r.scheme,cookies:{},persistCookies:void 0===e.persistCookies||e.persistCookies};n.debug&&n.debug.get("forge.http","clients").push(h),o(h);var d=null;h.secure&&(d={caStore:t,cipherSuites:e.cipherSuites||null,virtualHost:e.virtualHost||r.host,verify:e.verify||function(e,t,r,n){if(0===r&&!0===t){var a=n[r].subject.getField("CN");null!==a&&h.url.host===a.value||(t={message:"Certificate common name does not match url host."})}return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,prime:e.primeTlsSockets||!1},null!==l.flashApi&&(d.deflate=function(e){return n.util.deflate(l.flashApi,e,!0)},d.inflate=function(e){return n.util.inflate(l.flashApi,e,!0)}));for(var g=0;g100?(t.body=n.util.deflate(t.flashApi,t.body),t.bodyDeflated=!0,t.setField("Content-Encoding","deflate"),t.setField("Content-Length",t.body.length)):null!==t.body&&t.setField("Content-Length",t.body.length);var e=t.method.toUpperCase()+" "+t.path+" "+t.version+"\r\n";for(var r in t.fields)for(var a=t.fields[r],i=0;i=3)){var o=new Error("Invalid http response header.");throw o.details={line:r},o}a.version=n[0],a.code=parseInt(n[1],10),a.message=n.slice(2).join(" ")}else 0===r.length?a.headerReceived=!0:s(r);return a.headerReceived};return a.readBody=function(e){var o=a.getField("Content-Length"),c=a.getField("Transfer-Encoding");if(null!==o&&(o=parseInt(o)),null!==o&&o>=0)a.body=a.body||"",a.body+=e.getBytes(o),a.bodyReceived=a.body.length===o;else if(null!==c){if(-1==c.indexOf("chunked")){var u=new Error("Unknown Transfer-Encoding.");throw u.details={transferEncoding:c},u}a.body=a.body||"",function(e){for(var n="";null!==n&&e.length()>0;)if(t>0){if(t+2>e.length())break;a.body+=e.getBytes(t),e.getBytes(2),t=0}else if(r)for(n=i(e);null!==n;)n.length>0?(s(n),n=i(e)):(a.bodyReceived=!0,n=null);else null!==(n=i(e))&&(t=parseInt(n.split(";",1)[0],16),r=0===t);a.bodyReceived}(e)}else null!==o&&o<0||null===o&&null!==a.getField("Content-Type")?(a.body=a.body||"",a.body+=e.getBytes(),a.readBodyUntilClose=!0):(a.body=null,a.bodyReceived=!0);return a.bodyReceived&&(a.time=+new Date-a.time),null!==a.flashApi&&a.bodyReceived&&null!==a.body&&"deflate"===a.getField("Content-Encoding")&&(a.body=n.util.inflate(a.flashApi,a.body)),a.bodyReceived},a.getCookies=function(){var e=[];if("Set-Cookie"in a.fields)for(var t=a.fields["Set-Cookie"],r=+new Date/1e3,n=/\s*([^=]*)=?([^;]*)(;|$)/g,i=0;i0;)o.push(u%i),u=u/i|0}for(a=0;0===e[a]&&a=0;--a)n+=t[o[a]]}else n=function(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(o%n),o=o/n|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[i[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},r.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=n[t];if(!r){r=n[t]=[];for(var a=0;a>=8;for(;l>0;)o.push(255&l),l>>=8}for(var p=0;e[p]===s&&p=a.Versions.TLS_1_1.minor&&c.output.putBytes(r),c.update(e.fragment),c.finish(o)&&(e.fragment=c.output,e.length=e.fragment.length(),i=!0),i}function o(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function c(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),s=a-1-i;s=o?(e.fragment=s.output.getBytes(l-o),u=s.output.getBytes(o)):e.fragment=s.output.getBytes(),e.fragment=n.util.createBuffer(e.fragment),e.length=e.fragment.length();var p=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),i=function(e,t,r){var a=n.hmac.create();return a.start("SHA1",e),a.update(t),t=a.digest().getBytes(),a.start(null,null),a.update(r),r=a.digest().getBytes(),t===r}(t.macKey,u,p)&&i}a.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=a.BulkCipherAlgorithm.aes,e.cipher_type=a.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=a.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i},a.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=a.BulkCipherAlgorithm.aes,e.cipher_type=a.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=a.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i}},function(e,t,r){var n=r(0);r(31),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){var n=r(0);r(13),r(2),r(32),r(1);var a=r(44),i=a.publicKeyValidator,s=a.privateKeyValidator;if(void 0===o)var o=n.jsbn.BigInteger;var c=n.util.ByteBuffer,u="undefined"==typeof Buffer?Uint8Array:Buffer;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var l=n.ed25519;function p(e){var t=e.message;if(t instanceof Uint8Array||t instanceof u)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new c(t,r)}else if(!(t instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new u(t.length()),a=0;a=0;--r)x(n,n),1!==r&&K(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),K(r,r,a),K(r,r,i),K(r,r,i),K(e[0],r,i),x(n,e[0]),K(n,n,i),k(n,a)&&K(e[0],e[0],C);if(x(n,e[0]),K(n,n,i),k(n,a))return-1;w(e[0])===t[31]>>7&&V(e[0],f,e[0]);return K(e[3],e[0],e[1]),0}(o,n))return-1;for(a=0;a=0};var f=P(),h=P([1]),d=P([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=P([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=P([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=P([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),C=P([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(e,t){var r=n.md.sha512.create(),a=new c(e);r.update(a.getBytes(t),"binary");var i=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(i,"binary");for(var s=new u(l.constants.HASH_BYTE_LENGTH),o=0;o<64;++o)s[o]=i.charCodeAt(o);return s}function S(e,t){var r,n,a,i;for(n=63;n>=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*m[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*m[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function T(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;S(e,t)}function b(e,t){var r=P(),n=P(),a=P(),i=P(),s=P(),o=P(),c=P(),u=P(),l=P();V(r,e[1],e[0]),V(l,t[1],t[0]),K(r,r,l),O(n,e[0],e[1]),O(l,t[0],t[1]),K(n,n,l),K(a,e[3],t[3]),K(a,a,y),K(i,e[2],t[2]),O(i,i,i),V(s,n,r),V(o,i,a),O(c,i,a),O(u,n,r),K(e[0],s,o),K(e[1],u,c),K(e[2],c,o),K(e[3],s,u)}function I(e,t,r){for(var n=0;n<4;++n)D(e[n],t[n],r)}function A(e,t){var r=P(),n=P(),a=P();!function(e,t){var r,n=P();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)x(n,n),2!==r&&4!==r&&K(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(a,t[2]),K(r,t[0],a),K(n,t[1],a),B(e,n),e[31]^=w(r)<<7}function B(e,t){var r,n,a,i=P(),s=P();for(r=0;r<16;++r)s[r]=t[r];for(U(s),U(s),U(s),n=0;n<2;++n){for(i[0]=s[0]-65517,r=1;r<15;++r)i[r]=s[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,D(s,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function k(e,t){var r=new u(32),n=new u(32);return B(r,e),B(n,t),N(r,0,n,0)}function N(e,t,r,n){return function(e,t,r,n,a){var i,s=0;for(i=0;i>>8)-1}(e,t,r,n,32)}function w(e){var t=new u(32);return B(t,e),1&t[0]}function R(e,t,r){var n,a;for(_(e[0],f),_(e[1],h),_(e[2],h),_(e[3],f),a=255;a>=0;--a)I(e,t,n=r[a/8|0]>>(7&a)&1),b(t,e),b(e,e),I(e,t,n)}function L(e,t){var r=[P(),P(),P(),P()];_(r[0],g),_(r[1],v),_(r[2],h),K(r[3],g,v),R(e,r,t)}function _(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function U(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function D(e,t,r){for(var n,a=~(r-1),i=0;i<16;++i)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function P(e){var t,r=new Float64Array(16);if(e)for(t=0;t0&&(s=n.util.fillString(String.fromCharCode(0),c)+s),{encapsulation:t.encrypt(s,"NONE"),key:e.generate(s,i)}},decrypt:function(t,r,n){var a=t.decrypt(r,"NONE");return e.generate(a,n)}};return i},n.kem.kdf1=function(e,t){i(this,e,0,t||e.digestLength)},n.kem.kdf2=function(e,t){i(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(15),r(9),r(24),r(32)},function(e,t,r){var n=r(0);r(5),r(3),r(11),r(6),r(7),r(30),r(2),r(1),r(18);var a=n.asn1,i=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!a.validate(e,i.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:a.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function o(e){for(var t,r=[],i=0;i0){for(var r=a.create(a.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i=r&&s0&&s.value[0].value.push(a.create(a.Class.CONTEXT_SPECIFIC,0,!0,t)),i.length>0&&s.value[0].value.push(a.create(a.Class.CONTEXT_SPECIFIC,1,!0,i)),s.value[0].value.push(a.create(a.Class.UNIVERSAL,a.Type.SET,!0,e.signerInfos)),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,a=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=n.pki.certificateFromPem(i)),r=i.issuer.attributes,a=i.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=n.pki.privateKeyFromPem(s));var o=t.digestAlgorithm||n.pki.oids.sha1;switch(o){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,p=0;p="8"&&(r="00"+r);var a=n.util.hexToBytes(r);e.putInt32(a.length),e.putBytes(a)}function s(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=g[this.state].block)},v.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==f&&(this.state=u,m(this,0)),this.blocks},v.prototype.sleep=function(e){e=void 0===e?0:e,this.state=g[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=u,m(t,0)}),e)},v.prototype.wait=function(e){e.wait(this)},v.prototype.wakeup=function(){this.state===p&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=u,m(this,0))},v.prototype.cancel=function(){this.state=g[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},v.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,m(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===u)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||m(n,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,m(e.parent,t))};r?setTimeout(n,0):n(t)},C=function(e,t){e.state=f,delete i[e.id],null===e.parent&&(e.type in o?0===o[e.type].length?n.log.error(a,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):o[e.type][0]!==e?n.log.error(a,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(o[e.type].shift(),0===o[e.type].length?delete o[e.type]:o[e.type][0].start()):n.log.error(a,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new v({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in o?o[e.type].push(t):(o[t.type]=[t],function(e){e.error=!1,e.state=g[e.state][y],setTimeout((function(){e.state===u&&(e.swapTime=+new Date,e.run(e),m(e,0))}),0)}(t))},n.task.cancel=function(e){e in o&&(o[e]=[o[e][0]])},n.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}},function(e,t,r){var n,a,i,s=r(0),o=e.exports=s.form=s.form||{};n=jQuery,a=/([^\[]*?)\[(.*?)\]/g,i=function(e,t,r,i){for(var s=[],o=0;o0&&r.push(t[1]),t.length>=2&&r.push(t[2]);return 0===r.length&&r.push(e),r}(t))})),t=s,n.each(t,(function(a,s){if(i&&0!==s.length&&s in i&&(s=i[s]),0===s.length&&(s=e.length),e[s])a==t.length-1?(n.isArray(e[s])||(e[s]=[e[s]]),e[s].push(r)):e=e[s];else if(a==t.length-1)e[s]=r;else{var o=t[a+1];if(0===o.length)e[s]=[];else{var c=o-0==o&&o.length>0;e[s]=c?[]:{}}e=e[s]}}))},o.serialize=function(e,t,r){var a={};return t=t||".",n.each(e.serializeArray(),(function(){i(a,this.name.split(t),this.value||"",r)})),a}},function(e,t,r){var n=r(0);r(10),n.tls.wrapSocket=function(e){var t=e.socket,r={id:t.id,connected:t.connected||function(e){},closed:t.closed||function(e){},data:t.data||function(e){},error:t.error||function(e){}},a=n.tls.createConnection({server:!1,sessionId:e.sessionId||null,caStore:e.caStore||[],sessionCache:e.sessionCache||null,cipherSuites:e.cipherSuites||null,virtualHost:e.virtualHost,verify:e.verify,getCertificate:e.getCertificate,getPrivateKey:e.getPrivateKey,getSignature:e.getSignature,deflate:e.deflate,inflate:e.inflate,connected:function(e){1===e.handshakes&&r.connected({id:t.id,type:"connect",bytesAvailable:e.data.length()})},tlsDataReady:function(e){return t.send(e.tlsData.getBytes())},dataReady:function(e){r.data({id:t.id,type:"socketData",bytesAvailable:e.data.length()})},closed:function(e){t.close()},error:function(e,n){r.error({id:t.id,type:"tlsError",message:n.message,bytesAvailable:0,error:n}),t.close()}});t.connected=function(t){a.handshake(e.sessionId)},t.closed=function(e){a.open&&a.handshaking&&r.error({id:t.id,type:"ioError",message:"Connection closed during handshake.",bytesAvailable:0}),a.close(),r.closed({id:t.id,type:"close",bytesAvailable:0})},t.error=function(e){r.error({id:t.id,type:e.type,message:e.message,bytesAvailable:0}),a.close()};var i=0;return t.data=function(e){if(a.open){if(e.bytesAvailable>=i){var r=Math.max(e.bytesAvailable,i),n=t.receive(r);null!==n&&(i=a.process(n))}}else t.receive(e.bytesAvailable)},r.destroy=function(){t.destroy()},r.setSessionCache=function(e){a.sessionCache=tls.createSessionCache(e)},r.connect=function(e){t.connect(e)},r.close=function(){a.close()},r.isConnected=function(){return a.isConnected&&t.isConnected()},r.send=function(e){return a.prepare(e)},r.receive=function(e){return a.data.getBytes(e)},r.bytesAvailable=function(){return a.data.length()},r}},function(e,t,r){var n=r(0);r(34),r(35);var a,i,s,o,c,u,l,p,f,h,d=e.exports=n.xhr=n.xhr||{};a=jQuery,i="forge.xhr",s=null,o=0,c=null,u=null,l={},p=10,f=n.net,h=n.http,d.init=function(e){n.log.debug(i,"initializing",e),o=e.policyPort||o,c=e.policyUrl||c,p=e.connections||p,s=f.createSocketPool({flashId:e.flashId,policyPort:o,policyUrl:c,msie:e.msie||!1}),u=h.createClient({url:e.url||window.location.protocol+"//"+window.location.host,socketPool:s,policyPort:o,policyUrl:c,connections:e.connections||p,caCerts:e.caCerts,cipherSuites:e.cipherSuites,persistCookies:e.persistCookies||!0,primeTlsSockets:e.primeTlsSockets||!1,verify:e.verify,getCertificate:e.getCertificate,getPrivateKey:e.getPrivateKey,getSignature:e.getSignature}),l[u.url.full]=u,n.log.debug(i,"ready")},d.cleanup=function(){for(var e in l)l[e].destroy();l={},u=null,s.destroy(),s=null},d.setCookie=function(e){if(e.maxAge=e.maxAge||-1,e.domain)for(var t in l){var r=l[t];h.withinCookieDomain(r.url,e)&&r.secure===e.secure&&r.setCookie(e)}else u.setCookie(e)},d.getCookie=function(e,t,r){var a=null;if(r)for(var i in l){var s=l[i];if(h.withinCookieDomain(s.url,r)){var o=s.getCookie(e,t);null!==o&&(null===a?a=o:n.util.isArray(a)?a.push(o):a=[a,o])}}else a=u.getCookie(e,t);return a},d.removeCookie=function(e,t,r){var n=!1;if(r)for(var a in l){var i=l[a];h.withinCookieDomain(i.url,r)&&i.removeCookie(e,t)&&(n=!0)}else n=u.removeCookie(e,t);return n},d.create=function(e){e=a.extend({logWarningOnError:!0,verbose:!1,logError:function(){},logWarning:function(){},logDebug:function(){},logVerbose:function(){},url:null},e||{});var t={client:null,request:null,response:null,asynchronous:!0,sendFlag:!1,errorFlag:!1},r={error:e.logError||n.log.error,warning:e.logWarning||n.log.warning,debug:e.logDebug||n.log.debug,verbose:e.logVerbose||n.log.verbose},f={onreadystatechange:null,readyState:0,responseText:"",responseXML:null,status:0,statusText:""};if(null===e.url)t.client=u;else{var d=h.parseUrl(e.url);d||(new Error("Invalid url.").details={url:e.url}),d.full in l?t.client=l[d.full]:(t.client=h.createClient({url:e.url,socketPool:s,policyPort:e.policyPort||o,policyUrl:e.policyUrl||c,connections:e.connections||p,caCerts:e.caCerts,cipherSuites:e.cipherSuites,persistCookies:e.persistCookies||!0,primeTlsSockets:e.primeTlsSockets||!1,verify:e.verify,getCertificate:e.getCertificate,getPrivateKey:e.getPrivateKey,getSignature:e.getSignature}),l[d.full]=t.client)}return f.open=function(e,r,n,a,i){switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"PATCH":case"POST":case"PUT":break;case"CONNECT":case"TRACE":case"TRACK":throw new Error("CONNECT, TRACE and TRACK methods are disallowed");default:throw new Error("Invalid method: "+e)}t.sendFlag=!1,f.responseText="",f.responseXML=null,f.status=0,f.statusText="",t.request=h.createRequest({method:e,path:r}),f.readyState=1,f.onreadystatechange&&f.onreadystatechange()},f.setRequestHeader=function(e,r){if(1!=f.readyState||t.sendFlag)throw new Error("XHR not open or sending");t.request.setField(e,r)},f.send=function(e){if(1!=f.readyState||t.sendFlag)throw new Error("XHR not open or sending");if(e&&"GET"!==t.request.method&&"HEAD"!==t.request.method)if("undefined"!=typeof XMLSerializer)if(e instanceof Document){var n=new XMLSerializer;t.request.body=n.serializeToString(e)}else t.request.body=e;else void 0!==e.xml?t.request.body=e.xml:t.request.body=e;t.errorFlag=!1,t.sendFlag=!0,f.onreadystatechange&&f.onreadystatechange();var a={};a.request=t.request,a.headerReady=function(e){f.cookies=t.client.cookies,f.readyState=2,f.status=e.response.code,f.statusText=e.response.message,t.response=e.response,f.onreadystatechange&&f.onreadystatechange(),t.response.aborted||(f.readyState=3,f.onreadystatechange&&f.onreadystatechange())},a.bodyReady=function(e){f.readyState=4;var n=e.response.getField("Content-Type");if(n&&(0===n.indexOf("text/xml")||0===n.indexOf("application/xml")||-1!==n.indexOf("+xml")))try{var s=new ActiveXObject("MicrosoftXMLDOM");s.async=!1,s.loadXML(e.response.body),f.responseXML=s}catch(e){var o=new DOMParser;f.responseXML=o.parseFromString(e.body,"text/xml")}var c=0;null!==e.response.body&&(f.responseText=e.response.body,c=e.response.body.length);var u=t.request,l=u.method+" "+u.path+" "+f.status+" "+f.statusText+" "+c+"B "+(e.request.connectTime+e.request.time+e.response.time)+"ms";a.verbose?(f.status>=400&&a.logWarningOnError?r.warning:r.verbose)(i,l,e,e.response.body?"\n"+e.response.body:"\nNo content"):(f.status>=400&&a.logWarningOnError?r.warning:r.debug)(i,l),f.onreadystatechange&&f.onreadystatechange()},a.error=function(e){var n=t.request;r.error(i,n.method+" "+n.path,e),f.responseText="",f.responseXML=null,t.errorFlag=!0,f.status=0,f.statusText="",f.readyState=4,f.onreadystatechange&&f.onreadystatechange()},t.client.send(a)},f.abort=function(){t.request.abort(),f.responseText="",f.responseXML=null,t.errorFlag=!0,f.status=0,f.statusText="",t.request=null,t.response=null,4===f.readyState||0===f.readyState||1===f.readyState&&!t.sendFlag||(f.readyState=4,t.sendFlag=!1,f.onreadystatechange&&f.onreadystatechange()),f.readyState=0},f.getAllResponseHeaders=function(){var e="";if(null!==t.response){var r=t.response.fields;a.each(r,(function(t,r){a.each(r,(function(r,n){e+=t+": "+n+"\r\n"}))}))}return e},f.getResponseHeader=function(e){var r=null;return null!==t.response&&e in t.response.fields&&(r=t.response.fields[e],n.util.isArray(r)&&(r=r.join())),r},f}}])})); -//# sourceMappingURL=forge.all.min.js.map \ No newline at end of file diff --git a/node_modules/node-forge/dist/forge.all.min.js.map b/node_modules/node-forge/dist/forge.all.min.js.map deleted file mode 100644 index 225d220e..00000000 --- a/node_modules/node-forge/dist/forge.all.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"forge.all.min.js","sources":["webpack://[name]/forge.all.min.js"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file diff --git a/node_modules/node-forge/dist/forge.min.js b/node_modules/node-forge/dist/forge.min.js deleted file mode 100644 index 997e6d78..00000000 --- a/node_modules/node-forge/dist/forge.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.forge=t():e.forge=t()}(window,(function(){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=34)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t){var a=r(0),n=r(37),i=e.exports=a.util=a.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(i.isArrayBuffer(e)||i.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&n.setAttribute("a",a=!a))}}i.nextTick=i.setImmediate}(),i.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,i.globalScope=i.isNodejs?t:"undefined"==typeof self?window:self,i.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},i.isArrayBufferView=function(e){return e&&i.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},i.ByteBuffer=o,i.ByteStringBuffer=o;i.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},i.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},i.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},i.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},i.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},i.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},i.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(i.encodeUtf8(e))},i.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},i.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},i.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},i.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},i.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},i.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},i.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},i.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},i.ByteStringBuffer.prototype.copy=function(){var e=i.createBuffer(this.data);return e.read=this.read,e},i.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},i.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},i.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},i.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),a=new Uint8Array(this.length()+t);return a.set(r),this.data=new DataView(a.buffer),this},i.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},i.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},i.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},i.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},i.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},i.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},i.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},i.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},i.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},i.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},i.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},i.DataBuffer.prototype.copy=function(){return new i.DataBuffer(this)},i.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},i.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},i.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},i.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},i.xorBytes=function(e,t,r){for(var a="",n="",i="",s=0,o=0;r>0;--r,++s)n=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(a+=i,i="",o=0),i+=String.fromCharCode(n),++o;return a+=i},i.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.encode64=function(e,t){for(var r,a,n,i="",s="",o=0;o>2),i+=c.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=c.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":c.charAt(63&n)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,a,n,i="",s=0;s>4),64!==a&&(i+=String.fromCharCode((15&r)<<4|a>>2),64!==n&&(i+=String.fromCharCode((3&a)<<6|n)));return i},i.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},i.decodeUtf8=function(e){return decodeURIComponent(escape(e))},i.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:n.encode,decode:n.decode}},i.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},i.binary.raw.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(e.length));for(var n=r=r||0,i=0;i>2),i+=c.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=c.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":c.charAt(63&n)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.binary.base64.decode=function(e,t,r){var a,n,i,s,o=t;o||(o=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,l=r=r||0;c>4,64!==i&&(o[l++]=(15&n)<<4|i>>2,64!==s&&(o[l++]=(3&i)<<6|s));return t?l-r:o.subarray(0,l)},i.binary.base58.encode=function(e,t){return i.binary.baseN.encode(e,l,t)},i.binary.base58.decode=function(e,t){return i.binary.baseN.decode(e,l,t)},i.text={utf8:{},utf16:{}},i.text.utf8.encode=function(e,t,r){e=i.encodeUtf8(e);var a=t;a||(a=new Uint8Array(e.length));for(var n=r=r||0,s=0;s0?(n=r[a].substring(0,s),i=r[a].substring(s+1)):(n=r[a],i=null),n in t||(t[n]=[]),n in Object.prototype||null===i||t[n].push(unescape(i))}return t};return void 0===e?(null===v&&(v="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=v):t=r(e),t},i.parseFragment=function(e){var t=e,r="",a=e.indexOf("?");a>0&&(t=e.substring(0,a),r=e.substring(a+1));var n=t.split("/");return n.length>0&&""===n[0]&&n.shift(),{pathString:t,queryString:r,path:n,query:""===r?{}:i.getQueryVariables(r)}},i.makeRequest=function(e){var t=i.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var a;return void 0===e?a=t.query:(a=t.query[e])&&void 0!==r&&(a=a[r]),a},getQueryLast:function(e,t){var a=r.getQuery(e);return a?a[a.length-1]:t}};return r},i.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var a=jQuery.param(t||{});return r=r||"",e+(a.length>0?"?"+a:"")+(r.length>0?"#"+r:"")},i.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},i.format=function(e){for(var t,r,a=/%./g,n=0,i=[],s=0;t=a.exec(e);){(r=e.substring(s,a.lastIndex-2)).length>0&&i.push(r),s=a.lastIndex;var o=t[0][1];switch(o){case"s":case"o":n");break;case"%":i.push("%");break;default:i.push("<%"+o+"?>")}}return i.push(e.substring(s)),i.join("")},i.formatNumber=function(e,t,r,a){var n=e,i=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===a?".":a,c=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(i),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(i?s+Math.abs(n-u).toFixed(i).slice(2):"")},i.formatSize=function(e){return e=e>=1073741824?i.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?i.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?i.formatNumber(e/1024,0)+" KiB":i.formatNumber(e,0)+" bytes"},i.bytesFromIP=function(e){return-1!==e.indexOf(".")?i.bytesFromIPv4(e):-1!==e.indexOf(":")?i.bytesFromIPv6(e):null},i.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=i.createBuffer(),r=0;rr[a].end-r[a].start&&(a=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var u=r[a];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},i.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in i&&!e.update)return t(null,i.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return i.cores=navigator.hardwareConcurrency,t(null,i.cores);if("undefined"==typeof Worker)return i.cores=1,t(null,i.cores);if("undefined"==typeof Blob)return i.cores=2,t(null,i.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()o.st&&n.stn.st&&o.stt){var a=new Error("Too few bytes to parse DER.");throw a.available=e.length(),a.remaining=t,a.requested=r,a}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(e,t,r,i,s){if(a.util.isArray(i)){for(var o=[],c=0;cr){if(s.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=t.length(),d.remaining=r,d.requested=h,d}h=r}var y=32==(32&c);if(y)if(p=[],void 0===h)for(;;){if(i(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}o=t.length(),p.push(e(t,r,a+1,s)),r-=o-t.length()}else for(;h>0;)o=t.length(),p.push(e(t,h,a+1,s)),r-=o-t.length(),h-=o-t.length();void 0===p&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&(f=t.bytes(h));if(void 0===p&&s.decodeBitStrings&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&h>1){var g=t.read,m=r,v=0;if(l===n.Type.BITSTRING&&(i(t,r,1),v=t.getByte(),r--),0===v)try{o=t.length();var C={verbose:s.verbose,strict:!0,decodeBitStrings:!0},E=e(t,r,a+1,C),S=o-t.length();r-=S,l==n.Type.BITSTRING&&S++;var T=E.tagClass;S!==h||T!==n.Class.UNIVERSAL&&T!==n.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(t.read=g,r=m)}if(void 0===p){if(void 0===h){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=r}if(l===n.Type.BMPSTRING)for(p="";h>0;h-=2)i(t,r,2),p+=String.fromCharCode(t.getInt16()),r-=2;else p=t.getBytes(h)}var I=void 0===f?null:{bitStringContents:f};return n.create(u,l,y,p,I)}(e,e.length(),0,t)},n.toDer=function(e){var t=a.util.createBuffer(),r=e.tagClass|e.type,i=a.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=n.equals(e,e.original))),s)i.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:i.putByte(0);for(var o=0;o1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?i.putBytes(e.value.substr(1)):i.putBytes(e.value);if(t.putByte(r),i.length()<=127)t.putByte(127&i.length());else{var c=i.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(o=u.length-1;o>=0;--o)t.putByte(u.charCodeAt(o))}return t.putBuffer(i),t},n.oidToDer=function(e){var t,r,n,i,s=e.split("."),o=a.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c>>=7,t||(i|=128),r.push(i),t=!1}while(n>0);for(var u=r.length-1;u>=0;--u)o.putByte(r[u])}return o},n.derToOid=function(e){var t;"string"==typeof e&&(e=a.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},n.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var a=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,a,n),t.setUTCHours(i,s,o,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},n.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),a=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var p=e.length-5,f=e.charAt(p);"+"!==f&&"-"!==f||(u=60*parseInt(e.substr(p+1,2),10)+parseInt(e.substr(p+4,2),10),u*=6e4,"+"===f&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,a,n),t.setUTCHours(i,s,o,c),t.setTime(+t+u)):(t.setFullYear(r,a,n),t.setHours(i,s,o,c)),t},n.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},n.derToInteger=function(e){"string"==typeof e&&(e=a.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},n.validate=function(e,t,r,i){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)i&&(e.tagClass!==t.tagClass&&i.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&i.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&a.util.isArray(t.value))for(var o=0,c=0;s&&c0&&(i+="\n");for(var o="",c=0;c1?i+="0x"+a.util.bytesToHex(e.value.slice(1)):i+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);1==f?i+=" (1 unused bit shown)":f>1&&(i+=" ("+f+" unused bits shown)")}}else e.type===n.Type.OCTETSTRING?(s.test(e.value)||(i+="("+e.value+") "),i+="0x"+a.util.bytesToHex(e.value)):e.type===n.Type.UTF8?i+=a.util.decodeUtf8(e.value):e.type===n.Type.PRINTABLESTRING||e.type===n.Type.IA5String?i+=e.value:s.test(e.value)?i+="0x"+a.util.bytesToHex(e.value):0===e.value.length?i+="[null]":i+=e.value}return i}},function(e,t,r){var a=r(0);e.exports=a.md=a.md||{},a.md.algorithms=a.md.algorithms||{}},function(e,t,r){var a=r(0);function n(e,t){a.cipher.registerAlgorithm(e,(function(){return new a.aes.Algorithm(e,t)}))}r(13),r(19),r(1),e.exports=a.aes=a.aes||{},a.aes.startEncrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!1,mode:a});return n.start(t),n},a.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},a.aes.startDecrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!0,mode:a});return n.start(t),n},a.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},a.aes.Algorithm=function(e,t){l||p();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return h(r._w,e,t,!1)},decrypt:function(e,t){return h(r._w,e,t,!0)}}}),r._init=!1},a.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(a.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=a.util.createBuffer();for(var n=0;n>>=2;for(n=0;n>8^255&p^99,i[y]=p,s[p]=y,h=(f=e[p])<<24^p<<16^p<<8^p^f,d=((r=e[y])^(a=e[r])^(n=e[a]))<<24^(y^n)<<16^(y^a^n)<<8^y^r^n;for(var m=0;m<4;++m)c[m][y]=h,u[m][p]=d,h=h<<24|h>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=r^e[e[e[r^n]]],g^=e[e[g]])}}function f(e,t){for(var r,a=e.slice(0),n=1,s=a.length,c=4*(s+6+1),l=s;l>>16&255]<<24^i[r>>>8&255]<<16^i[255&r]<<8^i[r>>>24]^o[n]<<24,n++):s>6&&l%s==4&&(r=i[r>>>24]<<24^i[r>>>16&255]<<16^i[r>>>8&255]<<8^i[255&r]),a[l]=a[l-s]^r;if(t){for(var p,f=u[0],h=u[1],d=u[2],y=u[3],g=a.slice(0),m=(l=0,(c=a.length)-4);l>>24]]^h[i[p>>>16&255]]^d[i[p>>>8&255]]^y[i[255&p]];a=g}return a}function h(e,t,r,a){var n,o,l,p,f,h,d,y,g,m,v,C,E=e.length/4-1;a?(n=u[0],o=u[1],l=u[2],p=u[3],f=s):(n=c[0],o=c[1],l=c[2],p=c[3],f=i),h=t[0]^e[0],d=t[a?3:1]^e[1],y=t[2]^e[2],g=t[a?1:3]^e[3];for(var S=3,T=1;T>>24]^o[d>>>16&255]^l[y>>>8&255]^p[255&g]^e[++S],v=n[d>>>24]^o[y>>>16&255]^l[g>>>8&255]^p[255&h]^e[++S],C=n[y>>>24]^o[g>>>16&255]^l[h>>>8&255]^p[255&d]^e[++S],g=n[g>>>24]^o[h>>>16&255]^l[d>>>8&255]^p[255&y]^e[++S],h=m,d=v,y=C;r[0]=f[h>>>24]<<24^f[d>>>16&255]<<16^f[y>>>8&255]<<8^f[255&g]^e[++S],r[a?3:1]=f[d>>>24]<<24^f[y>>>16&255]<<16^f[g>>>8&255]<<8^f[255&h]^e[++S],r[2]=f[y>>>24]<<24^f[g>>>16&255]<<16^f[h>>>8&255]<<8^f[255&d]^e[++S],r[a?1:3]=f[g>>>24]<<24^f[h>>>16&255]<<16^f[d>>>8&255]<<8^f[255&y]^e[++S]}function d(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?a.cipher.createDecipher(r,e.key):a.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof a.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}},function(e,t,r){var a=r(0);a.pki=a.pki||{};var n=e.exports=a.pki.oids=a.oids=a.oids||{};function i(e,t){n[e]=t,n[t]=e}function s(e,t){n[e]=t}i("1.2.840.113549.1.1.1","rsaEncryption"),i("1.2.840.113549.1.1.4","md5WithRSAEncryption"),i("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),i("1.2.840.113549.1.1.7","RSAES-OAEP"),i("1.2.840.113549.1.1.8","mgf1"),i("1.2.840.113549.1.1.9","pSpecified"),i("1.2.840.113549.1.1.10","RSASSA-PSS"),i("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),i("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),i("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),i("1.3.101.112","EdDSA25519"),i("1.2.840.10040.4.3","dsa-with-sha1"),i("1.3.14.3.2.7","desCBC"),i("1.3.14.3.2.26","sha1"),i("2.16.840.1.101.3.4.2.1","sha256"),i("2.16.840.1.101.3.4.2.2","sha384"),i("2.16.840.1.101.3.4.2.3","sha512"),i("1.2.840.113549.2.5","md5"),i("1.2.840.113549.1.7.1","data"),i("1.2.840.113549.1.7.2","signedData"),i("1.2.840.113549.1.7.3","envelopedData"),i("1.2.840.113549.1.7.4","signedAndEnvelopedData"),i("1.2.840.113549.1.7.5","digestedData"),i("1.2.840.113549.1.7.6","encryptedData"),i("1.2.840.113549.1.9.1","emailAddress"),i("1.2.840.113549.1.9.2","unstructuredName"),i("1.2.840.113549.1.9.3","contentType"),i("1.2.840.113549.1.9.4","messageDigest"),i("1.2.840.113549.1.9.5","signingTime"),i("1.2.840.113549.1.9.6","counterSignature"),i("1.2.840.113549.1.9.7","challengePassword"),i("1.2.840.113549.1.9.8","unstructuredAddress"),i("1.2.840.113549.1.9.14","extensionRequest"),i("1.2.840.113549.1.9.20","friendlyName"),i("1.2.840.113549.1.9.21","localKeyId"),i("1.2.840.113549.1.9.22.1","x509Certificate"),i("1.2.840.113549.1.12.10.1.1","keyBag"),i("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),i("1.2.840.113549.1.12.10.1.3","certBag"),i("1.2.840.113549.1.12.10.1.4","crlBag"),i("1.2.840.113549.1.12.10.1.5","secretBag"),i("1.2.840.113549.1.12.10.1.6","safeContentsBag"),i("1.2.840.113549.1.5.13","pkcs5PBES2"),i("1.2.840.113549.1.5.12","pkcs5PBKDF2"),i("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),i("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),i("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),i("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),i("1.2.840.113549.2.7","hmacWithSHA1"),i("1.2.840.113549.2.8","hmacWithSHA224"),i("1.2.840.113549.2.9","hmacWithSHA256"),i("1.2.840.113549.2.10","hmacWithSHA384"),i("1.2.840.113549.2.11","hmacWithSHA512"),i("1.2.840.113549.3.7","des-EDE3-CBC"),i("2.16.840.1.101.3.4.1.2","aes128-CBC"),i("2.16.840.1.101.3.4.1.22","aes192-CBC"),i("2.16.840.1.101.3.4.1.42","aes256-CBC"),i("2.5.4.3","commonName"),i("2.5.4.5","serialName"),i("2.5.4.6","countryName"),i("2.5.4.7","localityName"),i("2.5.4.8","stateOrProvinceName"),i("2.5.4.9","streetAddress"),i("2.5.4.10","organizationName"),i("2.5.4.11","organizationalUnitName"),i("2.5.4.13","description"),i("2.5.4.15","businessCategory"),i("2.5.4.17","postalCode"),i("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),i("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),i("2.16.840.1.113730.1.1","nsCertType"),i("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),i("2.5.29.14","subjectKeyIdentifier"),i("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),i("2.5.29.17","subjectAltName"),i("2.5.29.18","issuerAltName"),i("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),i("2.5.29.31","cRLDistributionPoints"),i("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),i("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),i("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),i("1.3.6.1.4.1.11129.2.4.2","timestampList"),i("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),i("1.3.6.1.5.5.7.3.1","serverAuth"),i("1.3.6.1.5.5.7.3.2","clientAuth"),i("1.3.6.1.5.5.7.3.3","codeSigning"),i("1.3.6.1.5.5.7.3.4","emailProtection"),i("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){var a=r(0);r(1);var n=e.exports=a.pem=a.pem||{};function i(e){for(var t=e.name+": ",r=[],a=function(e,t){return" "+t},n=0;n65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),i=n-s-1,s=-1,++n}else" "!==t[n]&&"\t"!==t[n]&&","!==t[n]||(s=n);return t}function s(e){return e.replace(/^\s+/,"")}n.encode=function(e,t){t=t||{};var r,n="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(n+=i(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(n+=i(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),n+=i(r)),e.headers)for(var s=0;st.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=a.util.createBuffer(),n=a.util.createBuffer(),u=s.length();for(c=0;c>>0,c>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=c[1],c[1]=c[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(i),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=a.util.createBuffer();s.putBytes(t.bytes());var c,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(i.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=c>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(f,r,s);var h=a.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},n};var i=null,s=!1;function o(e,t,r){for(var a,n,i,s,o,c,u,l=r.length();l>=64;){for(n=e.h0,i=e.h1,s=e.h2,o=e.h3,c=e.h4,u=0;u<16;++u)a=r.getInt32(),t[u]=a,a=(n<<5|n>>>27)+(o^i&(s^o))+c+1518500249+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<20;++u)a=(a=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|a>>>31,t[u]=a,a=(n<<5|n>>>27)+(o^i&(s^o))+c+1518500249+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<32;++u)a=(a=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|a>>>31,t[u]=a,a=(n<<5|n>>>27)+(i^s^o)+c+1859775393+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<40;++u)a=(a=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|a>>>30,t[u]=a,a=(n<<5|n>>>27)+(i^s^o)+c+1859775393+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<60;++u)a=(a=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|a>>>30,t[u]=a,a=(n<<5|n>>>27)+(i&s|o&(i^s))+c+2400959708+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<80;++u)a=(a=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|a>>>30,t[u]=a,a=(n<<5|n>>>27)+(i^s^o)+c+3395469782+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;e.h0=e.h0+n|0,e.h1=e.h1+i|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+c|0,l-=64}}},function(e,t,r){var a=r(0);function n(e,t){a.cipher.registerAlgorithm(e,(function(){return new a.des.Algorithm(e,t)}))}r(13),r(19),r(1),e.exports=a.des=a.des||{},a.des.startEncrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!1,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},a.des.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},a.des.startDecrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!0,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},a.des.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},a.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return h(r._keys,e,t,!1)},decrypt:function(e,t){return h(r._keys,e,t,!0)}}}),r._init=!1},a.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=a.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],p=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],C=0,E=0;E>>4^T))<<4,S^=t=65535&((T^=t)>>>-16^S),S^=(t=858993459&(S>>>2^(T^=t<<-16)))<<2,S^=t=65535&((T^=t)>>>-16^S),S^=(t=1431655765&(S>>>1^(T^=t<<-16)))<<1,S^=t=16711935&((T^=t)>>>8^S),t=(S^=(t=1431655765&(S>>>1^(T^=t<<8)))<<1)<<8|(T^=t)>>>20&240,S=T<<24|T<<8&16711680|T>>>8&65280|T>>>24&240,T=t;for(var I=0;I>>26,T=T<<2|T>>>26):(S=S<<1|S>>>27,T=T<<1|T>>>27);var b=r[(S&=-15)>>>28]|a[S>>>24&15]|n[S>>>20&15]|i[S>>>16&15]|s[S>>>12&15]|o[S>>>8&15]|c[S>>>4&15],A=u[(T&=-15)>>>28]|l[T>>>24&15]|p[T>>>20&15]|f[T>>>16&15]|h[T>>>12&15]|d[T>>>8&15]|y[T>>>4&15];t=65535&(A>>>16^b),m[C++]=b^t,m[C++]=A^t<<16}}return m}(t),this._init=!0}},n("DES-ECB",a.cipher.modes.ecb),n("DES-CBC",a.cipher.modes.cbc),n("DES-CFB",a.cipher.modes.cfb),n("DES-OFB",a.cipher.modes.ofb),n("DES-CTR",a.cipher.modes.ctr),n("3DES-ECB",a.cipher.modes.ecb),n("3DES-CBC",a.cipher.modes.cbc),n("3DES-CFB",a.cipher.modes.cfb),n("3DES-OFB",a.cipher.modes.ofb),n("3DES-CTR",a.cipher.modes.ctr);var i=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function h(e,t,r,a){var n,h,d=32===e.length?3:9;n=3===d?a?[30,-2,-2]:[0,32,2]:a?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(h=252645135&(y>>>4^g))<<4,y^=(h=65535&(y>>>16^(g^=h)))<<16,y^=h=858993459&((g^=h)>>>2^y),y^=h=16711935&((g^=h<<2)>>>8^y),y=(y^=(h=1431655765&(y>>>1^(g^=h<<8)))<<1)<<1|y>>>31,g=(g^=h)<<1|g>>>31;for(var m=0;m>>4|g<<28)^e[E+1];h=y,y=g,g=h^(s[S>>>24&63]|c[S>>>16&63]|l[S>>>8&63]|f[63&S]|i[T>>>24&63]|o[T>>>16&63]|u[T>>>8&63]|p[63&T])}h=y,y=g,g=h}g=g>>>1|g<<31,g^=h=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(h=16711935&(g>>>8^(y^=h<<1)))<<8,g^=(h=858993459&(g>>>2^(y^=h)))<<2,g^=h=65535&((y^=h)>>>16^g),g^=h=252645135&((y^=h<<16)>>>4^g),y^=h<<4,r[0]=y,r[1]=g}function d(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?a.cipher.createDecipher(r,e.key):a.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof a.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}},function(e,t,r){var a=r(0);if(r(3),r(12),r(6),r(26),r(27),r(2),r(1),void 0===n)var n=a.jsbn.BigInteger;var i=a.util.isNodejs?r(16):null,s=a.asn1,o=a.util;a.pki=a.pki||{},e.exports=a.pki.rsa=a.rsa=a.rsa||{};var c=a.pki,u=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},h=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},d=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var a=s.oidToDer(t).getBytes(),n=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);i.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,a)),i.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(i),n.value.push(o),s.toDer(n).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var i;t.dP||(t.dP=t.d.mod(t.p.subtract(n.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(n.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{i=new n(a.util.bytesToHex(a.random.getBytes(t.n.bitLength()/8)),16)}while(i.compareTo(t.n)>=0||!i.gcd(t.n).equals(n.ONE));for(var s=(e=e.multiply(i.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var c=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return c=c.multiply(i.modInverse(t.n)).mod(t.n)};function g(e,t,r){var n=a.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=i-11,s}n.putByte(0),n.putByte(r);var o,c=i-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var u=0;u0;){var l=0,p=a.random.getBytes(c);for(u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function v(e,t,r){"function"==typeof t&&(r=t,t={});var i={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,a){return t?r(t):(e.p=a,null!==e.q?u(t,e.q):void o(e.qBits,u))}))}function o(e,t){a.prime.generateProbablePrime(e,i,t)}function u(t,a){if(t)return r(t);if(e.q=a,e.p.compareTo(e.q)<0){var i=e.p;e.p=e.q,e.q=i}if(0!==e.p.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.p=null,void s();if(0!==e.q.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.q=null,void o(e.qBits,u);if(e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(n.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(i.prng=t.prng),s()}function C(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=a.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function S(e){return a.util.isNodejs&&"function"==typeof i[e]}function T(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function I(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function b(e){for(var t=a.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n0;)l.putByte(0),--p;return l.putBytes(a.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o}var c=new n(a.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,t,r).toString(16),l=a.util.createBuffer(),p=s-Math.ceil(u.length/2);p>0;)l.putByte(0),--p;return l.putBytes(a.util.hexToBytes(u)),!1!==i?m(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var i,s=(r=r||{}).prng||a.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(i.eInt),i},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new n(null);r.fromInt(30);for(var a,i=0,s=function(e,t){return e|t},o=+new Date,l=0;null===e.keys&&(t<=0||lp?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(n.ONE).gcd(e.e).compareTo(n.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(n.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}l+=(a=+new Date)-o,o=a}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!a.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(S("generateKeyPair"))return i.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(T("generateKey")&&T("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:b(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(a.util.createBuffer(e)));n(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(I("generateKey")&&I("exportKey")){var u=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:b(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(a.util.createBuffer(t)));n(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(u.onerror=function(e){n(e)})}}else if(S("generateKeyPairSync")){var l=i.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var p=c.rsa.createKeyPairGenerationState(e,t,r);if(!n)return c.rsa.stepKeyPairGenerationState(p,0),p.keys;v(p,r,n)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return a.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return c.rsa.encrypt(i,r,!0)},verify:function(e,t,a){"string"==typeof a?a=a.toUpperCase():void 0===a&&(a="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===a?a={verify:function(e,t){return t=m(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==a&&"NULL"!==a&&null!==a||(a={verify:function(e,t){return e===(t=m(t,r,!0))}});var n=c.rsa.decrypt(t,r,!0,!1);return a.verify(e,n,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,n,i,s,o,u){var l={n:e,e:t,d:r,p:n,q:i,dP:s,dQ:o,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return a.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var a=t.encode(e,l.n.bitLength());return c.rsa.encrypt(a,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,i,o,u,f,h,d,y={},g=[];if(s.validate(e,l,y,g)&&(e=s.fromDer(a.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,p,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=a.util.createBuffer(y.privateKeyModulus).toHex(),r=a.util.createBuffer(y.privateKeyPublicExponent).toHex(),i=a.util.createBuffer(y.privateKeyPrivateExponent).toHex(),o=a.util.createBuffer(y.privateKeyPrime1).toHex(),u=a.util.createBuffer(y.privateKeyPrime2).toHex(),f=a.util.createBuffer(y.privateKeyExponent1).toHex(),h=a.util.createBuffer(y.privateKeyExponent2).toHex(),d=a.util.createBuffer(y.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new n(t,16),new n(r,16),new n(i,16),new n(o,16),new n(u,16),new n(f,16),new n(h,16),new n(d,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,h,t,r)){var i,o=s.derToOid(t.publicKeyOid);if(o!==c.oids.rsaEncryption)throw(i=new Error("Cannot read public key. Unknown OID.")).oid=o,i;e=t.rsaPublicKey}if(r=[],!s.validate(e,f,t,r))throw(i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,i;var u=a.util.createBuffer(t.publicKeyModulus).toHex(),l=a.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new n(u,16),new n(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e))])}},function(e,t,r){var a,n=r(0);e.exports=n.jsbn=n.jsbn||{};function i(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new i(null)}function o(e,t,r,a,n,i){for(var s=16383&t,o=t>>14;--i>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=o*c+u*s;n=((c=s*c+((16383&l)<<14)+r.data[a]+n)>>28)+(l>>14)+o*u,r.data[a++]=268435455&c}return n}n.jsbn.BigInteger=i,"undefined"==typeof navigator?(i.prototype.am=o,a=28):"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(e,t,r,a,n,i){for(var s=32767&t,o=t>>15;--i>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=o*c+u*s;n=((c=s*c+((32767&l)<<15)+r.data[a]+(1073741823&n))>>>30)+(l>>>15)+o*u+(n>>>30),r.data[a++]=1073741823&c}return n},a=30):"Netscape"!=navigator.appName?(i.prototype.am=function(e,t,r,a,n,i){for(;--i>=0;){var s=t*this.data[e++]+r.data[a]+n;n=Math.floor(s/67108864),r.data[a++]=67108863&s}return n},a=26):(i.prototype.am=o,a=28),i.prototype.DB=a,i.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function T(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function I(){}function b(e){return e}function A(e){this.r2=s(),this.q3=s(),i.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(i.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,a,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},i.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},i.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},i.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,n=!1,s=0;--a>=0;){var o=8==r?255&e[a]:f(e,a);o<0?"-"==e.charAt(a)&&(n=!0):(n=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<>this.DB-s):this.data[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},i.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},i.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>n|o,o=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},i.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var a=e%this.DB,n=this.DB-a,i=(1<>a;for(var s=r+1;s>a;a>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;a+=this.s}else{for(a+=this.s;r>=this.DB;a-=e.s}t.s=a<0?-1:0,a<-1?t.data[r++]=this.DV+a:a>0&&(t.data[r++]=a),t.t=r,t.clamp()},i.prototype.multiplyTo=function(e,t){var r=this.abs(),a=e.abs(),n=r.t;for(t.t=n+a.t;--n>=0;)t.data[n]=0;for(n=0;n=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},i.prototype.divRemTo=function(e,t,r){var a=e.abs();if(!(a.t<=0)){var n=this.abs();if(n.t0?(a.lShiftTo(l,o),n.lShiftTo(l,r)):(a.copyTo(o),n.copyTo(r));var p=o.t,f=o.data[p-1];if(0!=f){var h=f*(1<1?o.data[p-2]>>this.F2:0),y=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(E,r)),i.ONE.dlShiftTo(p,E),E.subTo(o,o);o.t=0;){var S=r.data[--v]==f?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=o.am(0,S,r,C,0,p))0&&r.rShiftTo(l,r),c<0&&i.ZERO.subTo(r,r)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},i.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},i.prototype.exp=function(e,t){if(e>4294967295||e<1)return i.ONE;var r=s(),a=s(),n=t.convert(this),o=d(e)-1;for(n.copyTo(r);--o>=0;)if(t.sqrTo(r,a),(e&1<0)t.mulTo(a,n,r);else{var c=r;r=a,a=c}return t.revert(r)},i.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,a=(1<0)for(o>o)>0&&(n=!0,i=p(r));s>=0;)o>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&a,o<=0&&(o+=this.DB,--s)),r>0&&(n=!0),n&&(i+=p(r));return n?i:"0"},i.prototype.negate=function(){var e=s();return i.ZERO.subTo(this,e),e},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},i.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(i.ZERO)>0&&e.subTo(t,t),t},i.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},i.ZERO=h(0),i.ONE=h(1),I.prototype.convert=b,I.prototype.revert=b,I.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},I.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],N=(1<<26)/B[B.length-1];i.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},i.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),a=h(r),n=s(),i=s(),o="";for(this.divRemTo(a,n,i);n.signum()>0;)o=(r+i.intValue()).toString(e).substr(1)+o,n.divRemTo(a,n,i);return i.intValue().toString(e)+o},i.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),a=Math.pow(t,r),n=!1,s=0,o=0,c=0;c=r&&(this.dMultiply(a),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),n&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(i.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(i.ONE.shiftLeft(e-1),this);else{var a=new Array,n=7&e;a.length=1+(e>>3),t.nextBytes(a),n>0?a[0]&=(1<>=this.DB;if(e.t>=this.DB;a+=this.s}else{for(a+=this.s;r>=this.DB;a+=e.s}t.s=a<0?-1:0,a>0?t.data[r++]=a:a<-1&&(t.data[r++]=this.DV+a),t.t=r,t.clamp()},i.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},i.prototype.multiplyLowerTo=function(e,t,r){var a,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(a=r.t-this.t;n=0;)r.data[a]=0;for(a=Math.max(t-this.t,0);a0)if(0==t)r=this.data[0]%e;else for(var a=this.t-1;a>=0;--a)r=(t*r+this.data[a])%e;return r},i.prototype.millerRabin=function(e){var t=this.subtract(i.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var a,n=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var c=a.modPow(n,this);if(0!=c.compareTo(i.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},i.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,a=this.DB-e*this.DB%8,n=0;if(e-- >0)for(a>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<=0;)a<8?(r=(this.data[e]&(1<>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},i.prototype.equals=function(e){return 0==this.compareTo(e)},i.prototype.min=function(e){return this.compareTo(e)<0?this:e},i.prototype.max=function(e){return this.compareTo(e)>0?this:e},i.prototype.and=function(e){var t=s();return this.bitwiseTo(e,m,t),t},i.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t},i.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,C,t),t},i.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},i.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var p=s();for(a.sqrTo(o[1],p);c<=l;)o[c]=s(),a.mulTo(p,o[c-2],o[c]),c+=2}var f,m,v=e.t-1,C=!0,E=s();for(n=d(e.data[v])-1;v>=0;){for(n>=u?f=e.data[v]>>n-u&l:(f=(e.data[v]&(1<0&&(f|=e.data[v-1]>>this.DB+n-u)),c=r;0==(1&f);)f>>=1,--c;if((n-=c)<0&&(n+=this.DB,--v),C)o[f].copyTo(i),C=!1;else{for(;c>1;)a.sqrTo(i,E),a.sqrTo(E,i),c-=2;c>0?a.sqrTo(i,E):(m=i,i=E,E=m),a.mulTo(E,o[f],i)}for(;v>=0&&0==(e.data[v]&1<=0?(r.subTo(a,r),t&&n.subTo(o,n),s.subTo(c,s)):(a.subTo(r,a),t&&o.subTo(n,o),c.subTo(s,c))}return 0!=a.compareTo(i.ONE)?i.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},i.prototype.pow=function(e){return this.exp(e,new I)},i.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var a=t;t=r,r=a}var n=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(n0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r},i.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=B[B.length-1]){for(t=0;t>>0,o>>>0];for(var c=n.fullMessageLength.length-1;c>=0;--c)n.fullMessageLength[c]+=o[1],o[1]=o[0]+(n.fullMessageLength[c]/4294967296>>>0),n.fullMessageLength[c]=n.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=a.util.createBuffer();s.putBytes(t.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(i.substr(0,n.blockLength-o));for(var c,u=0,p=n.fullMessageLength.length-1;p>=0;--p)u=(c=8*n.fullMessageLength[p]+u)/4294967296>>>0,s.putInt32Le(c>>>0);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(f,r,s);var h=a.util.createBuffer();return h.putInt32Le(f.h0),h.putInt32Le(f.h1),h.putInt32Le(f.h2),h.putInt32Le(f.h3),h},n};var i=null,s=null,o=null,c=null,u=!1;function l(e,t,r){for(var a,n,i,u,l,p,f,h=r.length();h>=64;){for(n=e.h0,i=e.h1,u=e.h2,l=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),a=n+(l^i&(u^l))+c[f]+t[f],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;for(;f<32;++f)a=n+(u^l&(i^u))+c[f]+t[s[f]],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;for(;f<48;++f)a=n+(i^u^l)+c[f]+t[s[f]],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;for(;f<64;++f)a=n+(u^(i|~l))+c[f]+t[s[f]],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;e.h0=e.h0+n|0,e.h1=e.h1+i|0,e.h2=e.h2+u|0,e.h3=e.h3+l|0,h-=64}}},function(e,t,r){var a=r(0);r(8),r(4),r(1);var n,i=a.pkcs5=a.pkcs5||{};a.util.isNodejs&&!a.options.usePureJavaScript&&(n=r(16)),e.exports=a.pbkdf2=i.pbkdf2=function(e,t,r,i,s,o){if("function"==typeof s&&(o=s,s=null),a.util.isNodejs&&!a.options.usePureJavaScript&&n.pbkdf2&&(null===s||"object"!=typeof s)&&(n.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),o?4===n.pbkdf2Sync.length?n.pbkdf2(e,t,r,i,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):n.pbkdf2(e,t,r,i,s,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):4===n.pbkdf2Sync.length?n.pbkdf2Sync(e,t,r,i).toString("binary"):n.pbkdf2Sync(e,t,r,i,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in a.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=a.md[s].create()}var c=s.digestLength;if(i>4294967295*c){var u=new Error("Derived key is too long.");if(o)return o(u);throw u}var l=Math.ceil(i/c),p=i-(l-1)*c,f=a.hmac.create();f.start(s,e);var h,d,y,g="";if(!o){for(var m=1;m<=l;++m){f.start(null,null),f.update(t),f.update(a.util.int32ToBytes(m)),h=y=f.digest().getBytes();for(var v=2;v<=r;++v)f.start(null,null),f.update(y),d=f.digest().getBytes(),h=a.util.xorBytes(h,d,c),y=d;g+=ml)return o(null,g);f.start(null,null),f.update(t),f.update(a.util.int32ToBytes(m)),h=y=f.digest().getBytes(),v=2,E()}function E(){if(v<=r)return f.start(null,null),f.update(y),d=f.digest().getBytes(),h=a.util.xorBytes(h,d,c),y=d,++v,a.util.setImmediate(E);g+=m128)throw new Error('Invalid "nsComment" content.');e.value=n.create(n.Class.UNIVERSAL,n.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var d=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[n.create(n.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var m=a.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;var v,C=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),E=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=p[0],c.validity.notAfter=p[1],c.tbsCertificate=r.tbsCertificate,t){var f;if(c.md=null,c.signatureOid in s)switch(s[c.signatureOid]){case"sha1WithRSAEncryption":c.md=a.md.sha1.create();break;case"md5WithRSAEncryption":c.md=a.md.md5.create();break;case"sha256WithRSAEncryption":c.md=a.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=a.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=a.md.sha512.create();break;case"RSASSA-PSS":c.md=a.md.sha256.create()}if(null===c.md)throw(f=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,f;var y=n.toDer(c.tbsCertificate);c.md.update(y.getBytes())}var m=a.md.sha1.create();c.issuer.getField=function(e){return h(c.issuer,e)},c.issuer.addField=function(e){g([e]),c.issuer.attributes.push(e)},c.issuer.attributes=i.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var v=a.md.sha1.create();return c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){g([e]),c.subject.attributes.push(e)},c.subject.attributes=i.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),r.certExtensions?c.extensions=i.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=i.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},i.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),i=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&i)}else if("basicConstraints"===t.name){(c=n.fromDer(t.value)).value.length>0&&c.value[0].type===n.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var o=null;c.value.length>0&&c.value[0].type===n.Type.INTEGER?o=c.value[0].value:c.value.length>1&&(o=c.value[1].value),null!==o&&(t.pathLenConstraint=n.derToInteger(o))}else if("extKeyUsage"===t.name)for(var c=n.fromDer(t.value),u=0;u1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var p;t.altNames=[];c=n.fromDer(t.value);for(var f=0;f=E&&e0&&s.value.push(i.certificateExtensionsToAsn1(e.extensions)),s},i.getCertificationRequestInfo=function(e){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),y(e.subject),i.publicKeyToAsn1(e.publicKey),C(e)])},i.distinguishedNameToAsn1=function(e){return y(e)},i.certificateToAsn1=function(e){var t=e.tbsCertificate||i.getTBSCertificate(e);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[t,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},i.certificateExtensionsToAsn1=function(e){var t=n.create(n.Class.CONTEXT_SPECIFIC,3,!0,[]),r=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);t.value.push(r);for(var a=0;al.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:i.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===c){if(null===(p=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(f=!0,p=l),p){var h=p;a.util.isArray(h)||(h=[h]);for(var d=!1;!d&&h.length>0;){p=h.shift();try{d=p.verify(l)}catch(e){}}d||(c={message:"Certificate signature is invalid.",error:i.certificateError.bad_certificate})}null!==c||p&&!f||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:i.certificateError.unknown_ca})}if(null===c&&p&&!l.isIssuer(p)&&(c={message:"Certificate issuer is invalid.",error:i.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&gv.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:i.certificateError.bad_certificate})}var E=null===c||c.error,S=r.verify?r.verify(E,u,n):E;if(!0!==S)throw!0===E&&(c={message:"The application rejected the certificate.",error:i.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||a.util.isArray(S)?"string"==typeof S&&(c.error=S):(S.message&&(c.message=S.message),S.error&&(c.error=S.error))),c;c=null,o=!1,++u}while(t.length>0);return!0}},function(e,t,r){var a=r(0);r(2),r(1),(e.exports=a.pss=a.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,i=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=a.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||a.random,c={encode:function(e,c){var u,l,p=c-1,f=Math.ceil(p/8),h=e.digest().getBytes();if(f>8*f-p&255;return(E=String.fromCharCode(E.charCodeAt(0)&~S)+E.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,o){var c,u=o-1,l=Math.ceil(u/8);if(s=s.substr(-l),l>8*l-u&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=n.generate(h,p),g="";for(c=0;c4){var r=e;e=a.util.createBuffer();for(var n=0;n0))return!0;for(var a=0;a0))return!0;for(var a=0;a0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},n.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},n.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var a=0;a0))return!0;for(var a=0;a0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},n.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},n.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.cfb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},n.cfb.prototype.decrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},n.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},n.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ofb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},n.ofb.prototype.decrypt=n.ofb.prototype.encrypt,n.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},n.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ctr.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},n.ctr.prototype.decrypt=n.ctr.prototype.encrypt,n.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0,this._R=3774873600},n.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=a.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?a.util.createBuffer(e.additionalData):a.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=a.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*n)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=a.util.createBuffer(t),this._aDataLength=o(8*t.length());var i=t.length()%this.blockSize;for(i&&t.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},n.gcm.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize){for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},n.gcm.prototype.decrypt=function(e,t,r){var a=e.length();if(a0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n0;--a)t[a]=e[a]>>>1|(1&e[a-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},n.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var a=e[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][a];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}return t},n.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},n.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,a=4*r,n=16*r,i=new Array(n),s=0;s>>1,n=new Array(r);n[a]=e.slice(0);for(var i=a>>>1;i>0;)this.pow(n[2*i],n[i]=[]),i>>=1;for(i=2;i>1,o=s+(1&e.length),c=e.substr(0,o),u=e.substr(s,o),l=a.util.createBuffer(),p=a.hmac.create();r=t+r;var f=Math.ceil(n/16),h=Math.ceil(n/20);p.start("MD5",c);var d=a.util.createBuffer();l.putBytes(r);for(var y=0;y0&&(u.queue(e,u.createAlert(e,{level:u.Alert.Level.warning,description:u.Alert.Description.no_renegotiation})),u.flush(e)),e.process()},u.parseHelloMessage=function(e,t,r){var n=null,i=e.entity===u.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});else{var s=t.fragment,c=s.length();if(n={version:{major:s.getByte(),minor:s.getByte()},random:a.util.createBuffer(s.getBytes(32)),session_id:o(s,1),extensions:[]},i?(n.cipher_suite=s.getBytes(2),n.compression_method=s.getByte()):(n.cipher_suites=o(s,2),n.compression_methods=o(s,1)),(c=r-(c-s.length()))>0){for(var l=o(s,2);l.length()>0;)n.extensions.push({type:[l.getByte(),l.getByte()],data:o(l,2)});if(!i)for(var p=0;p0;){if(0!==h.getByte())break;e.session.extensions.server_name.serverNameList.push(o(h,2).getBytes())}}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=u.getCipherSuite(n.cipher_suite);else for(var d=a.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=u.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(n.cipher_suite)});e.session.compressionMethod=i?n.compression_method:u.CompressionMethod.none}return n},u.createSecurityParameters=function(e,t){var r=e.entity===u.ConnectionEnd.client,a=t.random.bytes(),n=r?e.session.sp.client_random:a,i=r?a:u.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:u.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:i}},u.handleServerHello=function(e,t,r){var a=u.parseHelloMessage(e,t,r);if(!e.fail){if(!(a.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});e.version.minor=a.version.minor,e.session.version=e.version;var n=a.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=d,e.session.resuming=!0,e.session.sp.server_random=a.random.bytes()):(e.expect=l,e.session.resuming=!1,u.createSecurityParameters(e,a)),e.session.id=n,e.process()}},u.handleClientHello=function(e,t,r){var n=u.parseHelloMessage(e,t,r);if(!e.fail){var i=n.session_id.bytes(),s=null;if(e.sessionCache&&(null===(s=e.sessionCache.getSession(i))?i="":(s.version.major!==n.version.major||s.version.minor>n.version.minor)&&(s=null,i="")),0===i.length&&(i=a.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=n.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var o,c=1;c0;)n=o(c.certificate_list,3),i=a.asn1.fromDer(n),n=a.pki.certificateFromAsn1(i,!0),l.push(n)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var f=e.entity===u.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==l.length?0===l.length?e.expect=f?p:C:(f?e.session.serverCertificate=l[0]:e.session.clientCertificate=l[0],u.verifyCertificateChain(e,l)&&(e.expect=f?p:C)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}}),e.process()},u.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});e.expect=f,e.process()},u.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});var n=t.fragment,i={enc_pre_master_secret:o(n,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=a.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}});try{var c=e.session.sp;c.pre_master_secret=s.decrypt(i.enc_pre_master_secret);var l=e.session.clientHelloVersion;if(l.major!==c.pre_master_secret.charCodeAt(0)||l.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){c.pre_master_secret=a.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},u.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var a=t.fragment,n={certificate_types:o(a,1),certificate_authorities:o(a,2)};e.session.certificateRequest=n,e.expect=h,e.process()},u.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var s={signature:o(n,2).getBytes()},c=a.util.createBuffer();c.putBuffer(e.session.md5.digest()),c.putBuffer(e.session.sha1.digest()),c=c.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure}})}e.expect=S,e.process()},u.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.insufficient_security}},i=e.verify(e,n.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||a.util.isArray(i)?"number"==typeof i&&(n.alert.description=i):(i.message&&(n.message=i.message),i.alert&&(n.alert.description=i.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificate(e)}),u.queue(e,t)),t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createClientKeyExchange(e)}),u.queue(e,t),e.expect=m;var s=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificateVerify(e,t)})),u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.pending=u.createConnectionState(e),e.state.current.write=e.state.pending.write,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)})),e.expect=d,u.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return s(e,null);u.getClientSignature(e,s)},u.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var r=e.entity===u.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=u.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?y:T,e.process()},u.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var s=i.bytes();i.read+=4;var o=t.fragment.getBytes();(i=a.util.createBuffer()).putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var c=e.entity===u.ConnectionEnd.client,l=c?"server finished":"client finished",p=e.session.sp;if((i=n(p.master_secret,l,i.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&c||!e.session.resuming&&!c)&&(u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)}))),e.expect=c?g:I,e.handshaking=!1,++e.handshakes,e.peerCertificate=c?e.session.serverCertificate:e.session.clientCertificate,u.flush(e),e.isConnected=!0,e.connected(e),e.process()},u.handleAlert=function(e,t){var r,a=t.fragment,n={level:a.getByte(),description:a.getByte()};switch(n.description){case u.Alert.Description.close_notify:r="Connection closed.";break;case u.Alert.Description.unexpected_message:r="Unexpected message.";break;case u.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case u.Alert.Description.decryption_failed:r="Decryption failed.";break;case u.Alert.Description.record_overflow:r="Record overflow.";break;case u.Alert.Description.decompression_failure:r="Decompression failed.";break;case u.Alert.Description.handshake_failure:r="Handshake failure.";break;case u.Alert.Description.bad_certificate:r="Bad certificate.";break;case u.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case u.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case u.Alert.Description.certificate_expired:r="Certificate expired.";break;case u.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case u.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case u.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case u.Alert.Description.access_denied:r="Access denied.";break;case u.Alert.Description.decode_error:r="Decode error.";break;case u.Alert.Description.decrypt_error:r="Decrypt error.";break;case u.Alert.Description.export_restriction:r="Export restriction.";break;case u.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case u.Alert.Description.insufficient_security:r="Insufficient security.";break;case u.Alert.Description.internal_error:r="Internal error.";break;case u.Alert.Description.user_canceled:r="User canceled.";break;case u.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(n.description===u.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===u.ConnectionEnd.client?"server":"client",alert:n}),e.process()},u.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=a.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(i+4);r.read+=4,n in K[e.entity][e.expect]?(e.entity!==u.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),n!==u.HandshakeType.hello_request&&n!==u.HandshakeType.certificate_verify&&n!==u.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),K[e.entity][e.expect][n](e,t,i)):u.handleUnexpected(e,t)},u.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},u.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt16(),s=r.getBytes(i);if(n===u.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>s.length)return e.process();u.queue(e,u.createRecord(e,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_response,s)})),u.flush(e)}else if(n===u.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,a.util.createBuffer(s))}e.process()};var l=1,p=2,f=3,h=4,d=5,y=6,g=7,m=8,v=1,C=2,E=3,S=4,T=5,I=6,b=u.handleUnexpected,A=u.handleChangeCipherSpec,B=u.handleAlert,N=u.handleHandshake,k=u.handleApplicationData,w=u.handleHeartbeat,R=[];R[u.ConnectionEnd.client]=[[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[A,B,b,b,w],[b,B,N,b,w],[b,B,N,k,w],[b,B,N,b,w]],R[u.ConnectionEnd.server]=[[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[A,B,b,b,w],[b,B,N,b,w],[b,B,N,k,w],[b,B,N,b,w]];var _=u.handleHelloRequest,L=u.handleServerHello,U=u.handleCertificate,D=u.handleServerKeyExchange,P=u.handleCertificateRequest,V=u.handleServerHelloDone,O=u.handleFinished,K=[];K[u.ConnectionEnd.client]=[[b,b,L,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,U,D,P,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,D,P,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,P,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,O],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b]];var x=u.handleClientHello,M=u.handleClientKeyExchange,F=u.handleCertificateVerify;K[u.ConnectionEnd.server]=[[b,x,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,U,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,M,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,F,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,O],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b]],u.generateKeys=function(e,t){var r=n,a=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",a,48).bytes(),t.pre_master_secret=null),a=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===u.Versions.TLS_1_0.major&&e.version.minor===u.Versions.TLS_1_0.minor;s&&(i+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",a,i),c={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return s&&(c.client_write_IV=o.getBytes(t.fixed_iv_length),c.server_write_IV=o.getBytes(t.fixed_iv_length)),c},u.createConnectionState=function(e){var t=e.entity===u.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},a={read:r(),write:r()};if(a.read.update=function(e,t){return a.read.cipherFunction(t,a.read)?a.read.compressFunction(e,t,a.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_record_mac}}),!e.fail},a.write.update=function(e,t){return a.write.compressFunction(e,t,a.write)?a.write.cipherFunction(t,a.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}),!e.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=u.generateKeys(e,n),a.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,a.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(a,e,n),n.compression_algorithm){case u.CompressionMethod.none:break;case u.CompressionMethod.deflate:a.read.compressFunction=s,a.write.compressFunction=i;break;default:throw new Error("Unsupported compression algorithm.")}}return a},u.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=a.util.createBuffer();return r.putInt32(t),r.putBytes(a.random.getBytes(28)),r},u.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},u.createAlert=function(e,t){var r=a.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),u.createRecord(e,{type:u.ContentType.alert,data:r})},u.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=a.util.createBuffer(),r=0;r0&&(d+=2);var y=e.session.id,g=y.length+1+2+4+28+2+i+1+o+d,m=a.util.createBuffer();return m.putByte(u.HandshakeType.client_hello),m.putInt24(g),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),c(m,1,a.util.createBuffer(y)),c(m,2,t),c(m,1,s),d>0&&c(m,2,l),m},u.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=a.util.createBuffer();return n.putByte(u.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),c(n,1,a.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},u.createCertificate=function(e){var t,r=e.entity===u.ConnectionEnd.client,n=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,n=e.getCertificate(e,t));var i=a.util.createBuffer();if(null!==n)try{a.util.isArray(n)||(n=[n]);for(var s=null,o=0;ou.MaxFragment;)n.push(u.createRecord(e,{type:t.type,data:a.util.createBuffer(i.slice(0,u.MaxFragment))})),i=i.slice(u.MaxFragment);i.length>0&&n.push(u.createRecord(e,{type:t.type,data:a.util.createBuffer(i)}))}for(var s=0;s0&&(n=r.order[0]),null!==n&&n in r.cache)for(var i in t=r.cache[n],delete r.cache[n],r.order)if(r.order[i]===n){r.order.splice(i,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=a.util.bytesToHex(e);r.order.push(n),r.cache[n]=t}}return r},u.createConnection=function(e){var t=null;t=e.caStore?a.util.isArray(e.caStore)?a.pki.createCaStore(e.caStore):e.caStore:a.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var n in r=[],u.CipherSuites)r.push(u.CipherSuites[n]);var i=e.server?u.ConnectionEnd.server:u.ConnectionEnd.client,s=e.sessionCache?u.createSessionCache(e.sessionCache):null,o={version:{major:u.Version.major,minor:u.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,a){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===u.ConnectionEnd.client?"client":"server"),r.send&&(u.queue(t,u.createAlert(t,r.alert)),u.flush(t));var a=!1!==r.fatal;a&&(t.fail=!0),e.error(t,r),a&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){o.version={major:u.Version.major,minor:u.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=(o.entity,u.ConnectionEnd.client,0),o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(e||void 0===e),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=u.createConnectionState(o)}};o.reset();return o.handshake=function(e){if(o.entity!==u.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0;var t=null;(e=e||"").length>0&&(o.sessionCache&&(t=o.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&o.sessionCache&&null!==(t=o.sessionCache.getSession())&&(e=t.id),o.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:a.md.md5.create(),sha1:a.md.sha1.create()},t&&(o.version=t.version,o.session.sp=t.sp),o.session.sp.client_random=u.createRandom().getBytes(),o.open=!0,u.queue(o,u.createRecord(o,{type:u.ContentType.handshake,data:u.createClientHello(o)})),u.flush(o)}},o.process=function(e){var t=0;return e&&o.input.putBytes(e),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(t=function(e){var t=0,r=e.input,n=r.length();if(n<5)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:a.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}})}return t}(o)),o.fail||null===o.record||o.record.ready||(t=function(e){var t=0,r=e.input,a=r.length();a=0;c--)w>>=8,w+=A.at(c)+k.at(c),k.setAt(c,255&w);N.putBuffer(k)}E=N,p.putBuffer(I)}return p.truncate(p.length()-i),p},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var a=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw a.oid=e,a.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],a}},s.pbe.getCipherForPBES2=function(e,t,r){var n,o={},c=[];if(!i.validate(t,u,o,c))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,n;if((e=i.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=i.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var l,p,h=o.kdfSalt,d=a.util.createBuffer(o.kdfIterationCount);switch(d=d.getInt(d.length()<<3),s.oids[e]){case"aes128-CBC":l=16,p=a.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,p=a.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,p=a.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,p=a.des.createDecryptionCipher;break;case"desCBC":l=8,p=a.des.createDecryptionCipher}var y=f(o.prfOid),g=a.pkcs5.pbkdf2(r,h,d,l,y),m=o.encIv,v=p(g);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},o=[];if(!i.validate(t,l,n,o))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,y;var c,u,p,h=a.util.createBuffer(n.salt),d=a.util.createBuffer(n.iterations);switch(d=d.getInt(d.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,p=a.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,p=function(e,t){var r=a.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=f(n.prfOid),m=s.pbe.generatePkcs12Key(r,h,1,d,c,g);return g.start(),p(m,s.pbe.generatePkcs12Key(r,h,2,d,u,g))},s.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in a.md))throw new Error('"md5" hash algorithm unavailable.');n=a.md.md5.create()}null===t&&(t="");for(var i=[p(n,e+t)],s=16,o=1;s>>0,o>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=o[1],o[1]=o[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=a.util.createBuffer();s.putBytes(t.bytes());var o,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(i.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=o>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(f,r,s);var h=a.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},n};var i=null,s=!1,o=null;function c(e,t,r){for(var a,n,i,s,c,u,l,p,f,h,d,y,g,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)a=((a=t[c-2])>>>17|a<<15)^(a>>>19|a<<13)^a>>>10,n=((n=t[c-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[c]=a+t[c-7]+n+t[c-16]|0;for(u=e.h0,l=e.h1,p=e.h2,f=e.h3,h=e.h4,d=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)i=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&l|p&(u^l),a=g+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(y^h&(d^y))+o[c]+t[c],g=y,y=d,d=h,h=f+a>>>0,f=p,p=l,l=u,u=a+(n=i+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+p|0,e.h3=e.h3+f|0,e.h4=e.h4+h|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},function(e,t,r){var a=r(0);r(1);var n=null;!a.util.isNodejs||a.options.usePureJavaScript||process.versions["node-webkit"]||(n=r(16)),(e.exports=a.prng=a.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,i=new Array(32),s=0;s<32;++s)i[s]=r.create();function o(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,a=0;a<32;++a)t.reseeds%r==0&&(e.update(t.pools[a].digest().getBytes()),t.pools[a].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var n=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(n),t.generated=0}function u(e){var t=null,r=a.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var i=a.util.createBuffer();if(t)for(;i.length()>16)))<<16,f=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)p=f>>>(c<<3),p^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&p))}return i.getBytes(e)}return t.pools=i,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed,u=a.util.createBuffer();t.key=null,function l(p){if(p)return r(p);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return a.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,a){if(r)return e(r);t.collect(a),c(),e()}))}(l)}));var f=n(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=s(n(t.key,i(t.seed))),t.seed=o(n(t.key,t.seed)),a.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,i=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=a.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&o();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=i(r(t.key,n(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},n?(t.seedFile=function(e,t){n.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return n.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,a=0;a>n&255);t.collect(a)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var a=r.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",e),t(a.forge.prng.err,a.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var a=r.data;a.forge&&a.forge.prng&&t.seedFile(a.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},function(e,t,r){var a=r(0);r(1);var n=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],s=function(e,t){return e<>16-t},o=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=a.rc2=a.rc2||{},a.rc2.expandKey=function(e,t){"string"==typeof e&&(e=a.util.createBuffer(e)),t=t||128;var r,i=e,s=e.length(),o=t,c=Math.ceil(o/8),u=255>>(7&o);for(r=s;r<128;r++)i.putByte(n[i.at(r-1)+i.at(r-s)&255]);for(i.setAt(128-c,n[i.at(128-c)&u]),r=127-c;r>=0;r--)i.setAt(r,n[i.at(r+1)^i.at(r+c)]);return i};var c=function(e,t,r){var n,c,u,l,p=!1,f=null,h=null,d=null,y=[];for(e=a.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(n=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=s(e[u],i[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(n=function(e){for(u=3;u>=0;u--)e[u]=o(e[u],i[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var a=f.getInt16Le();null!==d&&(r?a^=d.getInt16Le():d.putInt16Le(a)),t.push(65535&a)}l=r?0:63;for(var n=0;n=8;)g([[5,n],[1,c],[6,n],[1,c],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var a=8===f.length()?8:8-f.length();f.fillWithByte(a,a)}if(t&&(p=!0,m.update()),!r&&(t=0===f.length()))if(e)t=e(8,h,!r);else{var n=h.length(),i=h.at(n-1);i>n?t=!1:h.truncate(i)}return t}}};a.rc2.startEncrypting=function(e,t,r){var n=a.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},a.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},a.rc2.startDecrypting=function(e,t,r){var n=a.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},a.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},function(e,t,r){var a=r(0);r(1),r(2),r(9);var n=e.exports=a.pkcs1=a.pkcs1||{};function i(e,t,r){r||(r=a.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+o),n+=r.digest().getBytes()}return n.substring(0,t)}n.encode_rsa_oaep=function(e,t,r){var n,s,o,c;"string"==typeof r?(n=r,s=arguments[3]||void 0,o=arguments[4]||void 0):r&&(n=r.label||void 0,s=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),o?o.start():o=a.md.sha1.create(),c||(c=o);var u=Math.ceil(e.n.bitLength()/8),l=u-2*o.digestLength-2;if(t.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=l,g;n||(n=""),o.update(n,"raw");for(var p=o.digest(),f="",h=l-t.length,d=0;de&&(s=c(e,t));var h=s.toString(16);n.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(p,0)}}}h()}(e,t,n,i);return o(e,t,n,i)}(e,u,i.options,n);throw new Error("Invalid prime generation algorithm: "+i.name)}}function o(e,t,r,i){var s=c(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(s.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),function e(t,r,i,s,o,u,l){var p=+new Date;do{if(t.bitLength()>r&&(t=c(r,i)),t.isProbablePrime(o))return l(null,t);t.dAddOffset(n[s++%8],0)}while(u<0||+new Date-p=0&&n.push(o):n.push(o))}return n}function h(e){if(e.composed||e.constructed){for(var t=a.util.createBuffer(),r=0;r0&&(c=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,p));var f=[],h=[];null!==t&&(h=a.util.isArray(t)?t:[t]);for(var d=[],y=0;y0){var C=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,d),E=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(C).getBytes())])]);f.push(E)}var S=null;if(null!==e){var T=i.wrapRsaPrivateKey(i.privateKeyToAsn1(e));S=null===r?n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.keyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[T]),c]):n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.pkcs8ShroudedKeyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[i.encryptPrivateKeyInfo(T,r,o)]),c]);var I=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[S]),b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(I).getBytes())])]);f.push(b)}var A,B=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,f);if(o.useMac){var N=a.md.sha1.create(),k=new a.util.ByteBuffer(a.random.getBytes(o.saltSize)),w=o.count,R=(e=s.generateKey(r,k,3,w,20),a.hmac.create());R.start(N,e),R.update(n.toDer(B).getBytes());var _=R.getMac();A=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.sha1).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,_.getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,k.getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(w).getBytes())])}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(3).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(B).getBytes())])]),A])},s.generateKey=a.pbe.generatePkcs12Key},function(e,t,r){var a=r(0);r(3),r(1);var n=a.asn1,i=e.exports=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=a.pkcs7||{},a.pkcs7.asn1=i;var s={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=s;var o={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},i.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var c={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var a=r(0);r(1),a.mgf=a.mgf||{},(e.exports=a.mgf.mgf1=a.mgf1=a.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new a.util.ByteBuffer,i=Math.ceil(r/e.digestLength),s=0;s>>0,s>>>0];for(var o=h.fullMessageLength.length-1;o>=0;--o)h.fullMessageLength[o]+=s[1],s[1]=s[0]+(h.fullMessageLength[o]/4294967296>>>0),h.fullMessageLength[o]=h.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return n.putBytes(e),l(r,i,n),(n.read>2048||0===n.length())&&n.compact(),h},h.digest=function(){var t=a.util.createBuffer();t.putBytes(n.bytes());var o,c=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var u=8*h.fullMessageLength[0],p=0;p>>0,t.putInt32(u>>>0),u=o>>>0;t.putInt32(u);var f=new Array(r.length);for(p=0;p=128;){for(R=0;R<16;++R)t[R][0]=r.getInt32()>>>0,t[R][1]=r.getInt32()>>>0;for(;R<80;++R)a=(((_=(U=t[R-2])[0])>>>19|(L=U[1])<<13)^(L>>>29|_<<3)^_>>>6)>>>0,n=((_<<13|L>>>19)^(L<<3|_>>>29)^(_<<26|L>>>6))>>>0,i=(((_=(P=t[R-15])[0])>>>1|(L=P[1])<<31)^(_>>>8|L<<24)^_>>>7)>>>0,s=((_<<31|L>>>1)^(_<<24|L>>>8)^(_<<25|L>>>7))>>>0,D=t[R-7],V=t[R-16],L=n+D[1]+s+V[1],t[R][0]=a+D[0]+i+V[0]+(L/4294967296>>>0)>>>0,t[R][1]=L>>>0;for(d=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],v=e[2][0],C=e[2][1],E=e[3][0],S=e[3][1],T=e[4][0],I=e[4][1],b=e[5][0],A=e[5][1],B=e[6][0],N=e[6][1],k=e[7][0],w=e[7][1],R=0;R<80;++R)l=((T>>>14|I<<18)^(T>>>18|I<<14)^(I>>>9|T<<23))>>>0,p=(B^T&(b^B))>>>0,o=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,u=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,f=(d&g|v&(d^g))>>>0,h=(y&m|C&(y^m))>>>0,L=w+(((T<<18|I>>>14)^(T<<14|I>>>18)^(I<<23|T>>>9))>>>0)+((N^I&(A^N))>>>0)+c[R][1]+t[R][1],a=k+l+p+c[R][0]+t[R][0]+(L/4294967296>>>0)>>>0,n=L>>>0,i=o+f+((L=u+h)/4294967296>>>0)>>>0,s=L>>>0,k=B,w=N,B=b,N=A,b=T,A=I,T=E+a+((L=S+n)/4294967296>>>0)>>>0,I=L>>>0,E=v,S=C,v=g,C=m,g=d,m=y,d=a+i+((L=n+s)/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+d+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+m,e[1][0]=e[1][0]+g+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+C,e[2][0]=e[2][0]+v+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+S,e[3][0]=e[3][0]+E+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+I,e[4][0]=e[4][0]+T+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+A,e[5][0]=e[5][0]+b+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+N,e[6][0]=e[6][0]+B+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+w,e[7][0]=e[7][0]+k+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,O-=128}}},function(e,t,r){var a=r(0);r(1),e.exports=a.log=a.log||{},a.log.levels=["none","error","warning","info","debug","verbose","max"];var n={},i=[],s=null;a.log.LEVEL_LOCKED=2,a.log.NO_LEVEL_CHECK=4,a.log.INTERPOLATE=8;for(var o=0;o0;)o.push(u%i),u=u/i|0}for(n=0;0===e[n]&&n=0;--n)a+=t[o[n]]}else a=function(e,t){var r=0,a=t.length,n=t.charAt(0),i=[0];for(r=0;r0;)i.push(o%a),o=o/a|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[i[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");a=a.match(l).join("\r\n")}return a},r.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=a[t];if(!r){r=a[t]=[];for(var n=0;n>=8;for(;l>0;)o.push(255&l),l>>=8}for(var p=0;e[p]===s&&p=n.Versions.TLS_1_1.minor&&c.output.putBytes(r),c.update(e.fragment),c.finish(o)&&(e.fragment=c.output,e.length=e.fragment.length(),i=!0),i}function o(e,t,r){if(!r){var a=e-t.length()%e;t.fillWithByte(a-1,a)}return!0}function c(e,t,r){var a=!0;if(r){for(var n=t.length(),i=t.last(),s=n-1-i;s=o?(e.fragment=s.output.getBytes(l-o),u=s.output.getBytes(o)):e.fragment=s.output.getBytes(),e.fragment=a.util.createBuffer(e.fragment),e.length=e.fragment.length();var p=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),i=function(e,t,r){var n=a.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}(t.macKey,u,p)&&i}n.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,e.cipher_type=n.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=n.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i},n.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,e.cipher_type=n.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=n.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i}},function(e,t,r){var a=r(0);r(30),e.exports=a.mgf=a.mgf||{},a.mgf.mgf1=a.mgf1},function(e,t,r){var a=r(0);r(12),r(2),r(32),r(1);var n=r(41),i=n.publicKeyValidator,s=n.privateKeyValidator;if(void 0===o)var o=a.jsbn.BigInteger;var c=a.util.ByteBuffer,u="undefined"==typeof Buffer?Uint8Array:Buffer;a.pki=a.pki||{},e.exports=a.pki.ed25519=a.ed25519=a.ed25519||{};var l=a.ed25519;function p(e){var t=e.message;if(t instanceof Uint8Array||t instanceof u)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new c(t,r)}else if(!(t instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var a=new u(t.length()),n=0;n=0;--r)K(a,a),1!==r&&x(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(r,r),x(r,r,n),x(r,r,i),x(r,r,i),x(e[0],r,i),K(a,e[0]),x(a,a,i),N(a,n)&&x(e[0],e[0],C);if(K(a,e[0]),x(a,a,i),N(a,n))return-1;w(e[0])===t[31]>>7&&O(e[0],f,e[0]);return x(e[3],e[0],e[1]),0}(o,a))return-1;for(n=0;n=0};var f=P(),h=P([1]),d=P([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=P([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=P([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=P([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),C=P([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(e,t){var r=a.md.sha512.create(),n=new c(e);r.update(n.getBytes(t),"binary");var i=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(i,"binary");for(var s=new u(l.constants.HASH_BYTE_LENGTH),o=0;o<64;++o)s[o]=i.charCodeAt(o);return s}function S(e,t){var r,a,n,i;for(a=63;a>=32;--a){for(r=0,n=a-32,i=a-12;n>8,t[n]-=256*r;t[n]+=r,t[a]=0}for(r=0,n=0;n<32;++n)t[n]+=r-(t[31]>>4)*v[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=r*v[n];for(a=0;a<32;++a)t[a+1]+=t[a]>>8,e[a]=255&t[a]}function T(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;S(e,t)}function I(e,t){var r=P(),a=P(),n=P(),i=P(),s=P(),o=P(),c=P(),u=P(),l=P();O(r,e[1],e[0]),O(l,t[1],t[0]),x(r,r,l),V(a,e[0],e[1]),V(l,t[0],t[1]),x(a,a,l),x(n,e[3],t[3]),x(n,n,y),x(i,e[2],t[2]),V(i,i,i),O(s,a,r),O(o,i,n),V(c,i,n),V(u,a,r),x(e[0],s,o),x(e[1],u,c),x(e[2],c,o),x(e[3],s,u)}function b(e,t,r){for(var a=0;a<4;++a)D(e[a],t[a],r)}function A(e,t){var r=P(),a=P(),n=P();!function(e,t){var r,a=P();for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)K(a,a),2!==r&&4!==r&&x(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(n,t[2]),x(r,t[0],n),x(a,t[1],n),B(e,a),e[31]^=w(r)<<7}function B(e,t){var r,a,n,i=P(),s=P();for(r=0;r<16;++r)s[r]=t[r];for(U(s),U(s),U(s),a=0;a<2;++a){for(i[0]=s[0]-65517,r=1;r<15;++r)i[r]=s[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),n=i[15]>>16&1,i[14]&=65535,D(s,i,1-n)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function N(e,t){var r=new u(32),a=new u(32);return B(r,e),B(a,t),k(r,0,a,0)}function k(e,t,r,a){return function(e,t,r,a,n){var i,s=0;for(i=0;i>>8)-1}(e,t,r,a,32)}function w(e){var t=new u(32);return B(t,e),1&t[0]}function R(e,t,r){var a,n;for(L(e[0],f),L(e[1],h),L(e[2],h),L(e[3],f),n=255;n>=0;--n)b(e,t,a=r[n/8|0]>>(7&n)&1),I(t,e),I(e,e),b(e,t,a)}function _(e,t){var r=[P(),P(),P(),P()];L(r[0],g),L(r[1],m),L(r[2],h),x(r[3],g,m),R(e,r,t)}function L(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function U(e){var t,r,a=1;for(t=0;t<16;++t)r=e[t]+a+65535,a=Math.floor(r/65536),e[t]=r-65536*a;e[0]+=a-1+37*(a-1)}function D(e,t,r){for(var a,n=~(r-1),i=0;i<16;++i)a=n&(e[i]^t[i]),e[i]^=a,t[i]^=a}function P(e){var t,r=new Float64Array(16);if(e)for(t=0;t0&&(s=a.util.fillString(String.fromCharCode(0),c)+s),{encapsulation:t.encrypt(s,"NONE"),key:e.generate(s,i)}},decrypt:function(t,r,a){var n=t.decrypt(r,"NONE");return e.generate(n,a)}};return i},a.kem.kdf1=function(e,t){i(this,e,0,t||e.digestLength)},a.kem.kdf2=function(e,t){i(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(14),r(9),r(23),r(32)},function(e,t,r){var a=r(0);r(5),r(3),r(10),r(6),r(7),r(29),r(2),r(1),r(17);var n=a.asn1,i=e.exports=a.pkcs7=a.pkcs7||{};function s(e){var t={},r=[];if(!n.validate(e,i.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(t.issuer),serialNumber:a.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:n.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function o(e){for(var t,r=[],i=0;i0){for(var r=n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i=r&&s0&&s.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,t)),i.length>0&&s.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,i)),s.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,e.signerInfos)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=a.pki.certificateFromPem(i)),r=i.issuer.attributes,n=i.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=a.pki.privateKeyFromPem(s));var o=t.digestAlgorithm||a.pki.oids.sha1;switch(o){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,p=0;p="8"&&(r="00"+r);var n=a.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function s(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=a.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=g[this.state].block)},m.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==f&&(this.state=u,v(this,0)),this.blocks},m.prototype.sleep=function(e){e=void 0===e?0:e,this.state=g[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=u,v(t,0)}),e)},m.prototype.wait=function(e){e.wait(this)},m.prototype.wakeup=function(){this.state===p&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=u,v(this,0))},m.prototype.cancel=function(){this.state=g[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},m.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,v(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var v=function(e,t){var r=t>30||+new Date-e.swapTime>20,a=function(t){if(t++,e.state===u)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var a=e.subtasks.shift();a.error=e.error,a.swapTime=e.swapTime,a.userData=e.userData,a.run(a),a.error||v(a,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,v(e.parent,t))};r?setTimeout(a,0):a(t)},C=function(e,t){e.state=f,delete i[e.id],null===e.parent&&(e.type in o?0===o[e.type].length?a.log.error(n,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):o[e.type][0]!==e?a.log.error(n,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(o[e.type].shift(),0===o[e.type].length?delete o[e.type]:o[e.type][0].start()):a.log.error(n,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=a.task=a.task||{},a.task.start=function(e){var t=new m({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in o?o[e.type].push(t):(o[t.type]=[t],function(e){e.error=!1,e.state=g[e.state][y],setTimeout((function(){e.state===u&&(e.swapTime=+new Date,e.run(e),v(e,0))}),0)}(t))},a.task.cancel=function(e){e in o&&(o[e]=[o[e][0]])},a.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}}])})); -//# sourceMappingURL=forge.min.js.map \ No newline at end of file diff --git a/node_modules/node-forge/dist/forge.min.js.map b/node_modules/node-forge/dist/forge.min.js.map deleted file mode 100644 index 8e904656..00000000 --- a/node_modules/node-forge/dist/forge.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"forge.min.js","sources":["webpack://[name]/forge.min.js"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file diff --git a/node_modules/node-forge/dist/prime.worker.min.js b/node_modules/node-forge/dist/prime.worker.min.js deleted file mode 100644 index 41433bed..00000000 --- a/node_modules/node-forge/dist/prime.worker.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(t){var i={};function r(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=t,r.c=i,r.d=function(t,i,o){r.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,i){if(1&i&&(t=r(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var s in t)r.d(o,s,function(i){return t[i]}.bind(null,s));return o},r.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(i,"a",i),i},r.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},r.p="",r(r.s=1)}([function(t,i){t.exports={options:{usePureJavaScript:!1}}},function(t,i,r){r(2),t.exports=r(0)},function(t,i,r){var o=r(0);r(3);var s=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],e=(1<<26)/s[s.length-1],a=o.jsbn.BigInteger;new a(null).fromInt(2),self.addEventListener("message",(function(t){var i=function(t){for(var i=new a(t.hex,16),r=0,o=t.workLoad,s=0;s=0);var u=o.modPow(s,t);if(0!==u.compareTo(a.ONE)&&0!==u.compareTo(i)){for(var f=r;--f;){if(0===(u=u.modPowInt(2,t)).compareTo(a.ONE))return!1;if(0===u.compareTo(i))break}if(0===f)return!1}}var p;return!0}(t)}},function(t,i,r){var o,s=r(0);t.exports=s.jsbn=s.jsbn||{};function e(t,i,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,i,r):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function a(){return new e(null)}function n(t,i,r,o,s,e){for(var a=16383&i,n=i>>14;--e>=0;){var h=16383&this.data[t],u=this.data[t++]>>14,f=n*h+u*a;s=((h=a*h+((16383&f)<<14)+r.data[o]+s)>>28)+(f>>14)+n*u,r.data[o++]=268435455&h}return s}s.jsbn.BigInteger=e,"undefined"==typeof navigator?(e.prototype.am=n,o=28):"Microsoft Internet Explorer"==navigator.appName?(e.prototype.am=function(t,i,r,o,s,e){for(var a=32767&i,n=i>>15;--e>=0;){var h=32767&this.data[t],u=this.data[t++]>>15,f=n*h+u*a;s=((h=a*h+((32767&f)<<15)+r.data[o]+(1073741823&s))>>>30)+(f>>>15)+n*u+(s>>>30),r.data[o++]=1073741823&h}return s},o=30):"Netscape"!=navigator.appName?(e.prototype.am=function(t,i,r,o,s,e){for(;--e>=0;){var a=i*this.data[t++]+r.data[o]+s;s=Math.floor(a/67108864),r.data[o++]=67108863&a}return s},o=26):(e.prototype.am=n,o=28),e.prototype.DB=o,e.prototype.DM=(1<>>16)&&(t=i,r+=16),0!=(i=t>>8)&&(t=i,r+=8),0!=(i=t>>4)&&(t=i,r+=4),0!=(i=t>>2)&&(t=i,r+=2),0!=(i=t>>1)&&(t=i,r+=1),r}function l(t){this.m=t}function v(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function B(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function S(){}function M(t){return t}function w(t){this.r2=a(),this.q3=a(),e.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}l.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},l.prototype.revert=function(t){return t},l.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},l.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},l.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},v.prototype.convert=function(t){var i=a();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(e.ZERO)>0&&this.m.subTo(i,i),i},v.prototype.revert=function(t){var i=a();return t.copyTo(i),this.reduce(i),i},v.prototype.reduce=function(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var i=0;i>15)*this.mpl&this.um)<<15)&t.DM;for(r=i+this.m.t,t.data[r]+=this.m.am(0,o,t,i,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},v.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},v.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},e.prototype.copyTo=function(t){for(var i=this.t-1;i>=0;--i)t.data[i]=this.data[i];t.t=this.t,t.s=this.s},e.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0},e.prototype.fromString=function(t,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(t,i);r=2}this.t=0,this.s=0;for(var o=t.length,s=!1,a=0;--o>=0;){var n=8==r?255&t[o]:d(t,o);n<0?"-"==t.charAt(o)&&(s=!0):(s=!1,0==a?this.data[this.t++]=n:a+r>this.DB?(this.data[this.t-1]|=(n&(1<>this.DB-a):this.data[this.t-1]|=n<=this.DB&&(a-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t},e.prototype.dlShiftTo=function(t,i){var r;for(r=this.t-1;r>=0;--r)i.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)i.data[r]=0;i.t=this.t+t,i.s=this.s},e.prototype.drShiftTo=function(t,i){for(var r=t;r=0;--r)i.data[r+a+1]=this.data[r]>>s|n,n=(this.data[r]&e)<=0;--r)i.data[r]=0;i.data[a]=n,i.t=this.t+a+1,i.s=this.s,i.clamp()},e.prototype.rShiftTo=function(t,i){i.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)i.t=0;else{var o=t%this.DB,s=this.DB-o,e=(1<>o;for(var a=r+1;a>o;o>0&&(i.data[this.t-r-1]|=(this.s&e)<>=this.DB;if(t.t>=this.DB;o+=this.s}else{for(o+=this.s;r>=this.DB;o-=t.s}i.s=o<0?-1:0,o<-1?i.data[r++]=this.DV+o:o>0&&(i.data[r++]=o),i.t=r,i.clamp()},e.prototype.multiplyTo=function(t,i){var r=this.abs(),o=t.abs(),s=r.t;for(i.t=s+o.t;--s>=0;)i.data[s]=0;for(s=0;s=0;)t.data[r]=0;for(r=0;r=i.DV&&(t.data[r+i.t]-=i.DV,t.data[r+i.t+1]=1)}t.t>0&&(t.data[t.t-1]+=i.am(r,i.data[r],t,2*r,0,1)),t.s=0,t.clamp()},e.prototype.divRemTo=function(t,i,r){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t0?(o.lShiftTo(f,n),s.lShiftTo(f,r)):(o.copyTo(n),s.copyTo(r));var p=n.t,d=n.data[p-1];if(0!=d){var c=d*(1<1?n.data[p-2]>>this.F2:0),l=this.FV/c,v=(1<=0&&(r.data[r.t++]=1,r.subTo(g,r)),e.ONE.dlShiftTo(p,g),g.subTo(n,n);n.t=0;){var D=r.data[--y]==d?this.DM:Math.floor(r.data[y]*l+(r.data[y-1]+T)*v);if((r.data[y]+=n.am(0,D,r,b,0,p))0&&r.rShiftTo(f,r),h<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i},e.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},e.prototype.exp=function(t,i){if(t>4294967295||t<1)return e.ONE;var r=a(),o=a(),s=i.convert(this),n=m(t)-1;for(s.copyTo(r);--n>=0;)if(i.sqrTo(r,o),(t&1<0)i.mulTo(o,s,r);else{var h=r;r=o,o=h}return i.revert(r)},e.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,o=(1<0)for(n>n)>0&&(s=!0,e=p(r));a>=0;)n>(n+=this.DB-i)):(r=this.data[a]>>(n-=i)&o,n<=0&&(n+=this.DB,--a)),r>0&&(s=!0),s&&(e+=p(r));return s?e:"0"},e.prototype.negate=function(){var t=a();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(t){var i=this.s-t.s;if(0!=i)return i;var r=this.t;if(0!=(i=r-t.t))return this.s<0?-i:i;for(;--r>=0;)if(0!=(i=this.data[r]-t.data[r]))return i;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+m(this.data[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var i=a();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(e.ZERO)>0&&t.subTo(i,i),i},e.prototype.modPowInt=function(t,i){var r;return r=t<256||i.isEven()?new l(i):new v(i),this.exp(t,r)},e.ZERO=c(0),e.ONE=c(1),S.prototype.convert=M,S.prototype.revert=M,S.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r)},S.prototype.sqrTo=function(t,i){t.squareTo(i)},w.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=a();return t.copyTo(i),this.reduce(i),i},w.prototype.revert=function(t){return t},w.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},w.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},w.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)};var E=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],O=(1<<26)/E[E.length-1];e.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},e.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),r=Math.pow(t,i),o=c(r),s=a(),e=a(),n="";for(this.divRemTo(o,s,e);s.signum()>0;)n=(r+e.intValue()).toString(t).substr(1)+n,s.divRemTo(o,s,e);return e.intValue().toString(t)+n},e.prototype.fromRadix=function(t,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),o=Math.pow(i,r),s=!1,a=0,n=0,h=0;h=r&&(this.dMultiply(o),this.dAddOffset(n,0),a=0,n=0))}a>0&&(this.dMultiply(Math.pow(i,a)),this.dAddOffset(n,0)),s&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,i,r){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var o=new Array,s=7&t;o.length=1+(t>>3),i.nextBytes(o),s>0?o[0]&=(1<>=this.DB;if(t.t>=this.DB;o+=this.s}else{for(o+=this.s;r>=this.DB;o+=t.s}i.s=o<0?-1:0,o>0?i.data[r++]=o:o<-1&&(i.data[r++]=this.DV+o),i.t=r,i.clamp()},e.prototype.dMultiply=function(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(t,i){if(0!=t){for(;this.t<=i;)this.data[this.t++]=0;for(this.data[i]+=t;this.data[i]>=this.DV;)this.data[i]-=this.DV,++i>=this.t&&(this.data[this.t++]=0),++this.data[i]}},e.prototype.multiplyLowerTo=function(t,i,r){var o,s=Math.min(this.t+t.t,i);for(r.s=0,r.t=s;s>0;)r.data[--s]=0;for(o=r.t-this.t;s=0;)r.data[o]=0;for(o=Math.max(i-this.t,0);o0)if(0==i)r=this.data[0]%t;else for(var o=this.t-1;o>=0;--o)r=(i*r+this.data[o])%t;return r},e.prototype.millerRabin=function(t){var i=this.subtract(e.ONE),r=i.getLowestSetBit();if(r<=0)return!1;for(var o,s=i.shiftRight(r),a={nextBytes:function(t){for(var i=0;i=0);var h=o.modPow(s,this);if(0!=h.compareTo(e.ONE)&&0!=h.compareTo(i)){for(var u=1;u++>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},e.prototype.toByteArray=function(){var t=this.t,i=new Array;i[0]=this.s;var r,o=this.DB-t*this.DB%8,s=0;if(t-- >0)for(o>o)!=(this.s&this.DM)>>o&&(i[s++]=r|this.s<=0;)o<8?(r=(this.data[t]&(1<>(o+=this.DB-8)):(r=this.data[t]>>(o-=8)&255,o<=0&&(o+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==s&&(128&this.s)!=(128&r)&&++s,(s>0||r!=this.s)&&(i[s++]=r);return i},e.prototype.equals=function(t){return 0==this.compareTo(t)},e.prototype.min=function(t){return this.compareTo(t)<0?this:t},e.prototype.max=function(t){return this.compareTo(t)>0?this:t},e.prototype.and=function(t){var i=a();return this.bitwiseTo(t,T,i),i},e.prototype.or=function(t){var i=a();return this.bitwiseTo(t,y,i),i},e.prototype.xor=function(t){var i=a();return this.bitwiseTo(t,b,i),i},e.prototype.andNot=function(t){var i=a();return this.bitwiseTo(t,g,i),i},e.prototype.not=function(){for(var t=a(),i=0;i=this.t?0!=this.s:0!=(this.data[i]&1<1){var p=a();for(o.sqrTo(n[1],p);h<=f;)n[h]=a(),o.mulTo(p,n[h-2],n[h]),h+=2}var d,T,y=t.t-1,b=!0,g=a();for(s=m(t.data[y])-1;y>=0;){for(s>=u?d=t.data[y]>>s-u&f:(d=(t.data[y]&(1<0&&(d|=t.data[y-1]>>this.DB+s-u)),h=r;0==(1&d);)d>>=1,--h;if((s-=h)<0&&(s+=this.DB,--y),b)n[d].copyTo(e),b=!1;else{for(;h>1;)o.sqrTo(e,g),o.sqrTo(g,e),h-=2;h>0?o.sqrTo(e,g):(T=e,e=g,g=T),o.mulTo(g,n[d],e)}for(;y>=0&&0==(t.data[y]&1<=0?(r.subTo(o,r),i&&s.subTo(n,s),a.subTo(h,a)):(o.subTo(r,o),i&&n.subTo(s,n),h.subTo(a,h))}return 0!=o.compareTo(e.ONE)?e.ZERO:h.compareTo(t)>=0?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h},e.prototype.pow=function(t){return this.exp(t,new S)},e.prototype.gcd=function(t){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var o=i;i=r,r=o}var s=i.getLowestSetBit(),e=r.getLowestSetBit();if(e<0)return i;for(s0&&(i.rShiftTo(e,i),r.rShiftTo(e,r));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r));return e>0&&r.lShiftTo(e,r),r},e.prototype.isProbablePrime=function(t){var i,r=this.abs();if(1==r.t&&r.data[0]<=E[E.length-1]){for(i=0;i', key); - * cipher.start({iv: iv}); - * - * Creates an AES cipher object to encrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as a string of bytes, an array of bytes, - * a byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.startEncrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: false, - mode: mode - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var cipher = forge.cipher.createCipher('AES-', key); - * - * Creates an AES cipher object to encrypt data using the given symmetric key. - * - * The key may be given as a string of bytes, an array of bytes, a - * byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.createEncryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: false, - mode: mode - }); -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('AES-', key); - * decipher.start({iv: iv}); - * - * Creates an AES cipher object to decrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as a string of bytes, an array of bytes, - * a byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.startDecrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: true, - mode: mode - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('AES-', key); - * - * Creates an AES cipher object to decrypt data using the given symmetric key. - * - * The key may be given as a string of bytes, an array of bytes, a - * byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.createDecryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: true, - mode: mode - }); -}; - -/** - * Creates a new AES cipher algorithm object. - * - * @param name the name of the algorithm. - * @param mode the mode factory function. - * - * @return the AES algorithm object. - */ -forge.aes.Algorithm = function(name, mode) { - if(!init) { - initialize(); - } - var self = this; - self.name = name; - self.mode = new mode({ - blockSize: 16, - cipher: { - encrypt: function(inBlock, outBlock) { - return _updateBlock(self._w, inBlock, outBlock, false); - }, - decrypt: function(inBlock, outBlock) { - return _updateBlock(self._w, inBlock, outBlock, true); - } - } - }); - self._init = false; -}; - -/** - * Initializes this AES algorithm by expanding its key. - * - * @param options the options to use. - * key the key to use with this algorithm. - * decrypt true if the algorithm should be initialized for decryption, - * false for encryption. - */ -forge.aes.Algorithm.prototype.initialize = function(options) { - if(this._init) { - return; - } - - var key = options.key; - var tmp; - - /* Note: The key may be a string of bytes, an array of bytes, a byte - buffer, or an array of 32-bit integers. If the key is in bytes, then - it must be 16, 24, or 32 bytes in length. If it is in 32-bit - integers, it must be 4, 6, or 8 integers long. */ - - if(typeof key === 'string' && - (key.length === 16 || key.length === 24 || key.length === 32)) { - // convert key string into byte buffer - key = forge.util.createBuffer(key); - } else if(forge.util.isArray(key) && - (key.length === 16 || key.length === 24 || key.length === 32)) { - // convert key integer array into byte buffer - tmp = key; - key = forge.util.createBuffer(); - for(var i = 0; i < tmp.length; ++i) { - key.putByte(tmp[i]); - } - } - - // convert key byte buffer into 32-bit integer array - if(!forge.util.isArray(key)) { - tmp = key; - key = []; - - // key lengths of 16, 24, 32 bytes allowed - var len = tmp.length(); - if(len === 16 || len === 24 || len === 32) { - len = len >>> 2; - for(var i = 0; i < len; ++i) { - key.push(tmp.getInt32()); - } - } - } - - // key must be an array of 32-bit integers by now - if(!forge.util.isArray(key) || - !(key.length === 4 || key.length === 6 || key.length === 8)) { - throw new Error('Invalid key parameter.'); - } - - // encryption operation is always used for these modes - var mode = this.mode.name; - var encryptOp = (['CFB', 'OFB', 'CTR', 'GCM'].indexOf(mode) !== -1); - - // do key expansion - this._w = _expandKey(key, options.decrypt && !encryptOp); - this._init = true; -}; - -/** - * Expands a key. Typically only used for testing. - * - * @param key the symmetric key to expand, as an array of 32-bit words. - * @param decrypt true to expand for decryption, false for encryption. - * - * @return the expanded key. - */ -forge.aes._expandKey = function(key, decrypt) { - if(!init) { - initialize(); - } - return _expandKey(key, decrypt); -}; - -/** - * Updates a single block. Typically only used for testing. - * - * @param w the expanded key to use. - * @param input an array of block-size 32-bit words. - * @param output an array of block-size 32-bit words. - * @param decrypt true to decrypt, false to encrypt. - */ -forge.aes._updateBlock = _updateBlock; - -/** Register AES algorithms **/ - -registerAlgorithm('AES-ECB', forge.cipher.modes.ecb); -registerAlgorithm('AES-CBC', forge.cipher.modes.cbc); -registerAlgorithm('AES-CFB', forge.cipher.modes.cfb); -registerAlgorithm('AES-OFB', forge.cipher.modes.ofb); -registerAlgorithm('AES-CTR', forge.cipher.modes.ctr); -registerAlgorithm('AES-GCM', forge.cipher.modes.gcm); - -function registerAlgorithm(name, mode) { - var factory = function() { - return new forge.aes.Algorithm(name, mode); - }; - forge.cipher.registerAlgorithm(name, factory); -} - -/** AES implementation **/ - -var init = false; // not yet initialized -var Nb = 4; // number of words comprising the state (AES = 4) -var sbox; // non-linear substitution table used in key expansion -var isbox; // inversion of sbox -var rcon; // round constant word array -var mix; // mix-columns table -var imix; // inverse mix-columns table - -/** - * Performs initialization, ie: precomputes tables to optimize for speed. - * - * One way to understand how AES works is to imagine that 'addition' and - * 'multiplication' are interfaces that require certain mathematical - * properties to hold true (ie: they are associative) but they might have - * different implementations and produce different kinds of results ... - * provided that their mathematical properties remain true. AES defines - * its own methods of addition and multiplication but keeps some important - * properties the same, ie: associativity and distributivity. The - * explanation below tries to shed some light on how AES defines addition - * and multiplication of bytes and 32-bit words in order to perform its - * encryption and decryption algorithms. - * - * The basics: - * - * The AES algorithm views bytes as binary representations of polynomials - * that have either 1 or 0 as the coefficients. It defines the addition - * or subtraction of two bytes as the XOR operation. It also defines the - * multiplication of two bytes as a finite field referred to as GF(2^8) - * (Note: 'GF' means "Galois Field" which is a field that contains a finite - * number of elements so GF(2^8) has 256 elements). - * - * This means that any two bytes can be represented as binary polynomials; - * when they multiplied together and modularly reduced by an irreducible - * polynomial of the 8th degree, the results are the field GF(2^8). The - * specific irreducible polynomial that AES uses in hexadecimal is 0x11b. - * This multiplication is associative with 0x01 as the identity: - * - * (b * 0x01 = GF(b, 0x01) = b). - * - * The operation GF(b, 0x02) can be performed at the byte level by left - * shifting b once and then XOR'ing it (to perform the modular reduction) - * with 0x11b if b is >= 128. Repeated application of the multiplication - * of 0x02 can be used to implement the multiplication of any two bytes. - * - * For instance, multiplying 0x57 and 0x13, denoted as GF(0x57, 0x13), can - * be performed by factoring 0x13 into 0x01, 0x02, and 0x10. Then these - * factors can each be multiplied by 0x57 and then added together. To do - * the multiplication, values for 0x57 multiplied by each of these 3 factors - * can be precomputed and stored in a table. To add them, the values from - * the table are XOR'd together. - * - * AES also defines addition and multiplication of words, that is 4-byte - * numbers represented as polynomials of 3 degrees where the coefficients - * are the values of the bytes. - * - * The word [a0, a1, a2, a3] is a polynomial a3x^3 + a2x^2 + a1x + a0. - * - * Addition is performed by XOR'ing like powers of x. Multiplication - * is performed in two steps, the first is an algebriac expansion as - * you would do normally (where addition is XOR). But the result is - * a polynomial larger than 3 degrees and thus it cannot fit in a word. So - * next the result is modularly reduced by an AES-specific polynomial of - * degree 4 which will always produce a polynomial of less than 4 degrees - * such that it will fit in a word. In AES, this polynomial is x^4 + 1. - * - * The modular product of two polynomials 'a' and 'b' is thus: - * - * d(x) = d3x^3 + d2x^2 + d1x + d0 - * with - * d0 = GF(a0, b0) ^ GF(a3, b1) ^ GF(a2, b2) ^ GF(a1, b3) - * d1 = GF(a1, b0) ^ GF(a0, b1) ^ GF(a3, b2) ^ GF(a2, b3) - * d2 = GF(a2, b0) ^ GF(a1, b1) ^ GF(a0, b2) ^ GF(a3, b3) - * d3 = GF(a3, b0) ^ GF(a2, b1) ^ GF(a1, b2) ^ GF(a0, b3) - * - * As a matrix: - * - * [d0] = [a0 a3 a2 a1][b0] - * [d1] [a1 a0 a3 a2][b1] - * [d2] [a2 a1 a0 a3][b2] - * [d3] [a3 a2 a1 a0][b3] - * - * Special polynomials defined by AES (0x02 == {02}): - * a(x) = {03}x^3 + {01}x^2 + {01}x + {02} - * a^-1(x) = {0b}x^3 + {0d}x^2 + {09}x + {0e}. - * - * These polynomials are used in the MixColumns() and InverseMixColumns() - * operations, respectively, to cause each element in the state to affect - * the output (referred to as diffusing). - * - * RotWord() uses: a0 = a1 = a2 = {00} and a3 = {01}, which is the - * polynomial x3. - * - * The ShiftRows() method modifies the last 3 rows in the state (where - * the state is 4 words with 4 bytes per word) by shifting bytes cyclically. - * The 1st byte in the second row is moved to the end of the row. The 1st - * and 2nd bytes in the third row are moved to the end of the row. The 1st, - * 2nd, and 3rd bytes are moved in the fourth row. - * - * More details on how AES arithmetic works: - * - * In the polynomial representation of binary numbers, XOR performs addition - * and subtraction and multiplication in GF(2^8) denoted as GF(a, b) - * corresponds with the multiplication of polynomials modulo an irreducible - * polynomial of degree 8. In other words, for AES, GF(a, b) will multiply - * polynomial 'a' with polynomial 'b' and then do a modular reduction by - * an AES-specific irreducible polynomial of degree 8. - * - * A polynomial is irreducible if its only divisors are one and itself. For - * the AES algorithm, this irreducible polynomial is: - * - * m(x) = x^8 + x^4 + x^3 + x + 1, - * - * or {01}{1b} in hexadecimal notation, where each coefficient is a bit: - * 100011011 = 283 = 0x11b. - * - * For example, GF(0x57, 0x83) = 0xc1 because - * - * 0x57 = 87 = 01010111 = x^6 + x^4 + x^2 + x + 1 - * 0x85 = 131 = 10000101 = x^7 + x + 1 - * - * (x^6 + x^4 + x^2 + x + 1) * (x^7 + x + 1) - * = x^13 + x^11 + x^9 + x^8 + x^7 + - * x^7 + x^5 + x^3 + x^2 + x + - * x^6 + x^4 + x^2 + x + 1 - * = x^13 + x^11 + x^9 + x^8 + x^6 + x^5 + x^4 + x^3 + 1 = y - * y modulo (x^8 + x^4 + x^3 + x + 1) - * = x^7 + x^6 + 1. - * - * The modular reduction by m(x) guarantees the result will be a binary - * polynomial of less than degree 8, so that it can fit in a byte. - * - * The operation to multiply a binary polynomial b with x (the polynomial - * x in binary representation is 00000010) is: - * - * b_7x^8 + b_6x^7 + b_5x^6 + b_4x^5 + b_3x^4 + b_2x^3 + b_1x^2 + b_0x^1 - * - * To get GF(b, x) we must reduce that by m(x). If b_7 is 0 (that is the - * most significant bit is 0 in b) then the result is already reduced. If - * it is 1, then we can reduce it by subtracting m(x) via an XOR. - * - * It follows that multiplication by x (00000010 or 0x02) can be implemented - * by performing a left shift followed by a conditional bitwise XOR with - * 0x1b. This operation on bytes is denoted by xtime(). Multiplication by - * higher powers of x can be implemented by repeated application of xtime(). - * - * By adding intermediate results, multiplication by any constant can be - * implemented. For instance: - * - * GF(0x57, 0x13) = 0xfe because: - * - * xtime(b) = (b & 128) ? (b << 1 ^ 0x11b) : (b << 1) - * - * Note: We XOR with 0x11b instead of 0x1b because in javascript our - * datatype for b can be larger than 1 byte, so a left shift will not - * automatically eliminate bits that overflow a byte ... by XOR'ing the - * overflow bit with 1 (the extra one from 0x11b) we zero it out. - * - * GF(0x57, 0x02) = xtime(0x57) = 0xae - * GF(0x57, 0x04) = xtime(0xae) = 0x47 - * GF(0x57, 0x08) = xtime(0x47) = 0x8e - * GF(0x57, 0x10) = xtime(0x8e) = 0x07 - * - * GF(0x57, 0x13) = GF(0x57, (0x01 ^ 0x02 ^ 0x10)) - * - * And by the distributive property (since XOR is addition and GF() is - * multiplication): - * - * = GF(0x57, 0x01) ^ GF(0x57, 0x02) ^ GF(0x57, 0x10) - * = 0x57 ^ 0xae ^ 0x07 - * = 0xfe. - */ -function initialize() { - init = true; - - /* Populate the Rcon table. These are the values given by - [x^(i-1),{00},{00},{00}] where x^(i-1) are powers of x (and x = 0x02) - in the field of GF(2^8), where i starts at 1. - - rcon[0] = [0x00, 0x00, 0x00, 0x00] - rcon[1] = [0x01, 0x00, 0x00, 0x00] 2^(1-1) = 2^0 = 1 - rcon[2] = [0x02, 0x00, 0x00, 0x00] 2^(2-1) = 2^1 = 2 - ... - rcon[9] = [0x1B, 0x00, 0x00, 0x00] 2^(9-1) = 2^8 = 0x1B - rcon[10] = [0x36, 0x00, 0x00, 0x00] 2^(10-1) = 2^9 = 0x36 - - We only store the first byte because it is the only one used. - */ - rcon = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36]; - - // compute xtime table which maps i onto GF(i, 0x02) - var xtime = new Array(256); - for(var i = 0; i < 128; ++i) { - xtime[i] = i << 1; - xtime[i + 128] = (i + 128) << 1 ^ 0x11B; - } - - // compute all other tables - sbox = new Array(256); - isbox = new Array(256); - mix = new Array(4); - imix = new Array(4); - for(var i = 0; i < 4; ++i) { - mix[i] = new Array(256); - imix[i] = new Array(256); - } - var e = 0, ei = 0, e2, e4, e8, sx, sx2, me, ime; - for(var i = 0; i < 256; ++i) { - /* We need to generate the SubBytes() sbox and isbox tables so that - we can perform byte substitutions. This requires us to traverse - all of the elements in GF, find their multiplicative inverses, - and apply to each the following affine transformation: - - bi' = bi ^ b(i + 4) mod 8 ^ b(i + 5) mod 8 ^ b(i + 6) mod 8 ^ - b(i + 7) mod 8 ^ ci - for 0 <= i < 8, where bi is the ith bit of the byte, and ci is the - ith bit of a byte c with the value {63} or {01100011}. - - It is possible to traverse every possible value in a Galois field - using what is referred to as a 'generator'. There are many - generators (128 out of 256): 3,5,6,9,11,82 to name a few. To fully - traverse GF we iterate 255 times, multiplying by our generator - each time. - - On each iteration we can determine the multiplicative inverse for - the current element. - - Suppose there is an element in GF 'e'. For a given generator 'g', - e = g^x. The multiplicative inverse of e is g^(255 - x). It turns - out that if use the inverse of a generator as another generator - it will produce all of the corresponding multiplicative inverses - at the same time. For this reason, we choose 5 as our inverse - generator because it only requires 2 multiplies and 1 add and its - inverse, 82, requires relatively few operations as well. - - In order to apply the affine transformation, the multiplicative - inverse 'ei' of 'e' can be repeatedly XOR'd (4 times) with a - bit-cycling of 'ei'. To do this 'ei' is first stored in 's' and - 'x'. Then 's' is left shifted and the high bit of 's' is made the - low bit. The resulting value is stored in 's'. Then 'x' is XOR'd - with 's' and stored in 'x'. On each subsequent iteration the same - operation is performed. When 4 iterations are complete, 'x' is - XOR'd with 'c' (0x63) and the transformed value is stored in 'x'. - For example: - - s = 01000001 - x = 01000001 - - iteration 1: s = 10000010, x ^= s - iteration 2: s = 00000101, x ^= s - iteration 3: s = 00001010, x ^= s - iteration 4: s = 00010100, x ^= s - x ^= 0x63 - - This can be done with a loop where s = (s << 1) | (s >> 7). However, - it can also be done by using a single 16-bit (in this case 32-bit) - number 'sx'. Since XOR is an associative operation, we can set 'sx' - to 'ei' and then XOR it with 'sx' left-shifted 1,2,3, and 4 times. - The most significant bits will flow into the high 8 bit positions - and be correctly XOR'd with one another. All that remains will be - to cycle the high 8 bits by XOR'ing them all with the lower 8 bits - afterwards. - - At the same time we're populating sbox and isbox we can precompute - the multiplication we'll need to do to do MixColumns() later. - */ - - // apply affine transformation - sx = ei ^ (ei << 1) ^ (ei << 2) ^ (ei << 3) ^ (ei << 4); - sx = (sx >> 8) ^ (sx & 255) ^ 0x63; - - // update tables - sbox[e] = sx; - isbox[sx] = e; - - /* Mixing columns is done using matrix multiplication. The columns - that are to be mixed are each a single word in the current state. - The state has Nb columns (4 columns). Therefore each column is a - 4 byte word. So to mix the columns in a single column 'c' where - its rows are r0, r1, r2, and r3, we use the following matrix - multiplication: - - [2 3 1 1]*[r0,c]=[r'0,c] - [1 2 3 1] [r1,c] [r'1,c] - [1 1 2 3] [r2,c] [r'2,c] - [3 1 1 2] [r3,c] [r'3,c] - - r0, r1, r2, and r3 are each 1 byte of one of the words in the - state (a column). To do matrix multiplication for each mixed - column c' we multiply the corresponding row from the left matrix - with the corresponding column from the right matrix. In total, we - get 4 equations: - - r0,c' = 2*r0,c + 3*r1,c + 1*r2,c + 1*r3,c - r1,c' = 1*r0,c + 2*r1,c + 3*r2,c + 1*r3,c - r2,c' = 1*r0,c + 1*r1,c + 2*r2,c + 3*r3,c - r3,c' = 3*r0,c + 1*r1,c + 1*r2,c + 2*r3,c - - As usual, the multiplication is as previously defined and the - addition is XOR. In order to optimize mixing columns we can store - the multiplication results in tables. If you think of the whole - column as a word (it might help to visualize by mentally rotating - the equations above by counterclockwise 90 degrees) then you can - see that it would be useful to map the multiplications performed on - each byte (r0, r1, r2, r3) onto a word as well. For instance, we - could map 2*r0,1*r0,1*r0,3*r0 onto a word by storing 2*r0 in the - highest 8 bits and 3*r0 in the lowest 8 bits (with the other two - respectively in the middle). This means that a table can be - constructed that uses r0 as an index to the word. We can do the - same with r1, r2, and r3, creating a total of 4 tables. - - To construct a full c', we can just look up each byte of c in - their respective tables and XOR the results together. - - Also, to build each table we only have to calculate the word - for 2,1,1,3 for every byte ... which we can do on each iteration - of this loop since we will iterate over every byte. After we have - calculated 2,1,1,3 we can get the results for the other tables - by cycling the byte at the end to the beginning. For instance - we can take the result of table 2,1,1,3 and produce table 3,2,1,1 - by moving the right most byte to the left most position just like - how you can imagine the 3 moved out of 2,1,1,3 and to the front - to produce 3,2,1,1. - - There is another optimization in that the same multiples of - the current element we need in order to advance our generator - to the next iteration can be reused in performing the 2,1,1,3 - calculation. We also calculate the inverse mix column tables, - with e,9,d,b being the inverse of 2,1,1,3. - - When we're done, and we need to actually mix columns, the first - byte of each state word should be put through mix[0] (2,1,1,3), - the second through mix[1] (3,2,1,1) and so forth. Then they should - be XOR'd together to produce the fully mixed column. - */ - - // calculate mix and imix table values - sx2 = xtime[sx]; - e2 = xtime[e]; - e4 = xtime[e2]; - e8 = xtime[e4]; - me = - (sx2 << 24) ^ // 2 - (sx << 16) ^ // 1 - (sx << 8) ^ // 1 - (sx ^ sx2); // 3 - ime = - (e2 ^ e4 ^ e8) << 24 ^ // E (14) - (e ^ e8) << 16 ^ // 9 - (e ^ e4 ^ e8) << 8 ^ // D (13) - (e ^ e2 ^ e8); // B (11) - // produce each of the mix tables by rotating the 2,1,1,3 value - for(var n = 0; n < 4; ++n) { - mix[n][e] = me; - imix[n][sx] = ime; - // cycle the right most byte to the left most position - // ie: 2,1,1,3 becomes 3,2,1,1 - me = me << 24 | me >>> 8; - ime = ime << 24 | ime >>> 8; - } - - // get next element and inverse - if(e === 0) { - // 1 is the inverse of 1 - e = ei = 1; - } else { - // e = 2e + 2*2*2*(10e)) = multiply e by 82 (chosen generator) - // ei = ei + 2*2*ei = multiply ei by 5 (inverse generator) - e = e2 ^ xtime[xtime[xtime[e2 ^ e8]]]; - ei ^= xtime[xtime[ei]]; - } - } -} - -/** - * Generates a key schedule using the AES key expansion algorithm. - * - * The AES algorithm takes the Cipher Key, K, and performs a Key Expansion - * routine to generate a key schedule. The Key Expansion generates a total - * of Nb*(Nr + 1) words: the algorithm requires an initial set of Nb words, - * and each of the Nr rounds requires Nb words of key data. The resulting - * key schedule consists of a linear array of 4-byte words, denoted [wi ], - * with i in the range 0 <= i < Nb(Nr + 1). - * - * KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk) - * AES-128 (Nb=4, Nk=4, Nr=10) - * AES-192 (Nb=4, Nk=6, Nr=12) - * AES-256 (Nb=4, Nk=8, Nr=14) - * Note: Nr=Nk+6. - * - * Nb is the number of columns (32-bit words) comprising the State (or - * number of bytes in a block). For AES, Nb=4. - * - * @param key the key to schedule (as an array of 32-bit words). - * @param decrypt true to modify the key schedule to decrypt, false not to. - * - * @return the generated key schedule. - */ -function _expandKey(key, decrypt) { - // copy the key's words to initialize the key schedule - var w = key.slice(0); - - /* RotWord() will rotate a word, moving the first byte to the last - byte's position (shifting the other bytes left). - - We will be getting the value of Rcon at i / Nk. 'i' will iterate - from Nk to (Nb * Nr+1). Nk = 4 (4 byte key), Nb = 4 (4 words in - a block), Nr = Nk + 6 (10). Therefore 'i' will iterate from - 4 to 44 (exclusive). Each time we iterate 4 times, i / Nk will - increase by 1. We use a counter iNk to keep track of this. - */ - - // go through the rounds expanding the key - var temp, iNk = 1; - var Nk = w.length; - var Nr1 = Nk + 6 + 1; - var end = Nb * Nr1; - for(var i = Nk; i < end; ++i) { - temp = w[i - 1]; - if(i % Nk === 0) { - // temp = SubWord(RotWord(temp)) ^ Rcon[i / Nk] - temp = - sbox[temp >>> 16 & 255] << 24 ^ - sbox[temp >>> 8 & 255] << 16 ^ - sbox[temp & 255] << 8 ^ - sbox[temp >>> 24] ^ (rcon[iNk] << 24); - iNk++; - } else if(Nk > 6 && (i % Nk === 4)) { - // temp = SubWord(temp) - temp = - sbox[temp >>> 24] << 24 ^ - sbox[temp >>> 16 & 255] << 16 ^ - sbox[temp >>> 8 & 255] << 8 ^ - sbox[temp & 255]; - } - w[i] = w[i - Nk] ^ temp; - } - - /* When we are updating a cipher block we always use the code path for - encryption whether we are decrypting or not (to shorten code and - simplify the generation of look up tables). However, because there - are differences in the decryption algorithm, other than just swapping - in different look up tables, we must transform our key schedule to - account for these changes: - - 1. The decryption algorithm gets its key rounds in reverse order. - 2. The decryption algorithm adds the round key before mixing columns - instead of afterwards. - - We don't need to modify our key schedule to handle the first case, - we can just traverse the key schedule in reverse order when decrypting. - - The second case requires a little work. - - The tables we built for performing rounds will take an input and then - perform SubBytes() and MixColumns() or, for the decrypt version, - InvSubBytes() and InvMixColumns(). But the decrypt algorithm requires - us to AddRoundKey() before InvMixColumns(). This means we'll need to - apply some transformations to the round key to inverse-mix its columns - so they'll be correct for moving AddRoundKey() to after the state has - had its columns inverse-mixed. - - To inverse-mix the columns of the state when we're decrypting we use a - lookup table that will apply InvSubBytes() and InvMixColumns() at the - same time. However, the round key's bytes are not inverse-substituted - in the decryption algorithm. To get around this problem, we can first - substitute the bytes in the round key so that when we apply the - transformation via the InvSubBytes()+InvMixColumns() table, it will - undo our substitution leaving us with the original value that we - want -- and then inverse-mix that value. - - This change will correctly alter our key schedule so that we can XOR - each round key with our already transformed decryption state. This - allows us to use the same code path as the encryption algorithm. - - We make one more change to the decryption key. Since the decryption - algorithm runs in reverse from the encryption algorithm, we reverse - the order of the round keys to avoid having to iterate over the key - schedule backwards when running the encryption algorithm later in - decryption mode. In addition to reversing the order of the round keys, - we also swap each round key's 2nd and 4th rows. See the comments - section where rounds are performed for more details about why this is - done. These changes are done inline with the other substitution - described above. - */ - if(decrypt) { - var tmp; - var m0 = imix[0]; - var m1 = imix[1]; - var m2 = imix[2]; - var m3 = imix[3]; - var wnew = w.slice(0); - end = w.length; - for(var i = 0, wi = end - Nb; i < end; i += Nb, wi -= Nb) { - // do not sub the first or last round key (round keys are Nb - // words) as no column mixing is performed before they are added, - // but do change the key order - if(i === 0 || i === (end - Nb)) { - wnew[i] = w[wi]; - wnew[i + 1] = w[wi + 3]; - wnew[i + 2] = w[wi + 2]; - wnew[i + 3] = w[wi + 1]; - } else { - // substitute each round key byte because the inverse-mix - // table will inverse-substitute it (effectively cancel the - // substitution because round key bytes aren't sub'd in - // decryption mode) and swap indexes 3 and 1 - for(var n = 0; n < Nb; ++n) { - tmp = w[wi + n]; - wnew[i + (3&-n)] = - m0[sbox[tmp >>> 24]] ^ - m1[sbox[tmp >>> 16 & 255]] ^ - m2[sbox[tmp >>> 8 & 255]] ^ - m3[sbox[tmp & 255]]; - } - } - } - w = wnew; - } - - return w; -} - -/** - * Updates a single block (16 bytes) using AES. The update will either - * encrypt or decrypt the block. - * - * @param w the key schedule. - * @param input the input block (an array of 32-bit words). - * @param output the updated output block. - * @param decrypt true to decrypt the block, false to encrypt it. - */ -function _updateBlock(w, input, output, decrypt) { - /* - Cipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)]) - begin - byte state[4,Nb] - state = in - AddRoundKey(state, w[0, Nb-1]) - for round = 1 step 1 to Nr-1 - SubBytes(state) - ShiftRows(state) - MixColumns(state) - AddRoundKey(state, w[round*Nb, (round+1)*Nb-1]) - end for - SubBytes(state) - ShiftRows(state) - AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - out = state - end - - InvCipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)]) - begin - byte state[4,Nb] - state = in - AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - for round = Nr-1 step -1 downto 1 - InvShiftRows(state) - InvSubBytes(state) - AddRoundKey(state, w[round*Nb, (round+1)*Nb-1]) - InvMixColumns(state) - end for - InvShiftRows(state) - InvSubBytes(state) - AddRoundKey(state, w[0, Nb-1]) - out = state - end - */ - - // Encrypt: AddRoundKey(state, w[0, Nb-1]) - // Decrypt: AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - var Nr = w.length / 4 - 1; - var m0, m1, m2, m3, sub; - if(decrypt) { - m0 = imix[0]; - m1 = imix[1]; - m2 = imix[2]; - m3 = imix[3]; - sub = isbox; - } else { - m0 = mix[0]; - m1 = mix[1]; - m2 = mix[2]; - m3 = mix[3]; - sub = sbox; - } - var a, b, c, d, a2, b2, c2; - a = input[0] ^ w[0]; - b = input[decrypt ? 3 : 1] ^ w[1]; - c = input[2] ^ w[2]; - d = input[decrypt ? 1 : 3] ^ w[3]; - var i = 3; - - /* In order to share code we follow the encryption algorithm when both - encrypting and decrypting. To account for the changes required in the - decryption algorithm, we use different lookup tables when decrypting - and use a modified key schedule to account for the difference in the - order of transformations applied when performing rounds. We also get - key rounds in reverse order (relative to encryption). */ - for(var round = 1; round < Nr; ++round) { - /* As described above, we'll be using table lookups to perform the - column mixing. Each column is stored as a word in the state (the - array 'input' has one column as a word at each index). In order to - mix a column, we perform these transformations on each row in c, - which is 1 byte in each word. The new column for c0 is c'0: - - m0 m1 m2 m3 - r0,c'0 = 2*r0,c0 + 3*r1,c0 + 1*r2,c0 + 1*r3,c0 - r1,c'0 = 1*r0,c0 + 2*r1,c0 + 3*r2,c0 + 1*r3,c0 - r2,c'0 = 1*r0,c0 + 1*r1,c0 + 2*r2,c0 + 3*r3,c0 - r3,c'0 = 3*r0,c0 + 1*r1,c0 + 1*r2,c0 + 2*r3,c0 - - So using mix tables where c0 is a word with r0 being its upper - 8 bits and r3 being its lower 8 bits: - - m0[c0 >> 24] will yield this word: [2*r0,1*r0,1*r0,3*r0] - ... - m3[c0 & 255] will yield this word: [1*r3,1*r3,3*r3,2*r3] - - Therefore to mix the columns in each word in the state we - do the following (& 255 omitted for brevity): - c'0,r0 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - c'0,r1 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - c'0,r2 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - c'0,r3 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - - However, before mixing, the algorithm requires us to perform - ShiftRows(). The ShiftRows() transformation cyclically shifts the - last 3 rows of the state over different offsets. The first row - (r = 0) is not shifted. - - s'_r,c = s_r,(c + shift(r, Nb) mod Nb - for 0 < r < 4 and 0 <= c < Nb and - shift(1, 4) = 1 - shift(2, 4) = 2 - shift(3, 4) = 3. - - This causes the first byte in r = 1 to be moved to the end of - the row, the first 2 bytes in r = 2 to be moved to the end of - the row, the first 3 bytes in r = 3 to be moved to the end of - the row: - - r1: [c0 c1 c2 c3] => [c1 c2 c3 c0] - r2: [c0 c1 c2 c3] [c2 c3 c0 c1] - r3: [c0 c1 c2 c3] [c3 c0 c1 c2] - - We can make these substitutions inline with our column mixing to - generate an updated set of equations to produce each word in the - state (note the columns have changed positions): - - c0 c1 c2 c3 => c0 c1 c2 c3 - c0 c1 c2 c3 c1 c2 c3 c0 (cycled 1 byte) - c0 c1 c2 c3 c2 c3 c0 c1 (cycled 2 bytes) - c0 c1 c2 c3 c3 c0 c1 c2 (cycled 3 bytes) - - Therefore: - - c'0 = 2*r0,c0 + 3*r1,c1 + 1*r2,c2 + 1*r3,c3 - c'0 = 1*r0,c0 + 2*r1,c1 + 3*r2,c2 + 1*r3,c3 - c'0 = 1*r0,c0 + 1*r1,c1 + 2*r2,c2 + 3*r3,c3 - c'0 = 3*r0,c0 + 1*r1,c1 + 1*r2,c2 + 2*r3,c3 - - c'1 = 2*r0,c1 + 3*r1,c2 + 1*r2,c3 + 1*r3,c0 - c'1 = 1*r0,c1 + 2*r1,c2 + 3*r2,c3 + 1*r3,c0 - c'1 = 1*r0,c1 + 1*r1,c2 + 2*r2,c3 + 3*r3,c0 - c'1 = 3*r0,c1 + 1*r1,c2 + 1*r2,c3 + 2*r3,c0 - - ... and so forth for c'2 and c'3. The important distinction is - that the columns are cycling, with c0 being used with the m0 - map when calculating c0, but c1 being used with the m0 map when - calculating c1 ... and so forth. - - When performing the inverse we transform the mirror image and - skip the bottom row, instead of the top one, and move upwards: - - c3 c2 c1 c0 => c0 c3 c2 c1 (cycled 3 bytes) *same as encryption - c3 c2 c1 c0 c1 c0 c3 c2 (cycled 2 bytes) - c3 c2 c1 c0 c2 c1 c0 c3 (cycled 1 byte) *same as encryption - c3 c2 c1 c0 c3 c2 c1 c0 - - If you compare the resulting matrices for ShiftRows()+MixColumns() - and for InvShiftRows()+InvMixColumns() the 2nd and 4th columns are - different (in encrypt mode vs. decrypt mode). So in order to use - the same code to handle both encryption and decryption, we will - need to do some mapping. - - If in encryption mode we let a=c0, b=c1, c=c2, d=c3, and r be - a row number in the state, then the resulting matrix in encryption - mode for applying the above transformations would be: - - r1: a b c d - r2: b c d a - r3: c d a b - r4: d a b c - - If we did the same in decryption mode we would get: - - r1: a d c b - r2: b a d c - r3: c b a d - r4: d c b a - - If instead we swap d and b (set b=c3 and d=c1), then we get: - - r1: a b c d - r2: d a b c - r3: c d a b - r4: b c d a - - Now the 1st and 3rd rows are the same as the encryption matrix. All - we need to do then to make the mapping exactly the same is to swap - the 2nd and 4th rows when in decryption mode. To do this without - having to do it on each iteration, we swapped the 2nd and 4th rows - in the decryption key schedule. We also have to do the swap above - when we first pull in the input and when we set the final output. */ - a2 = - m0[a >>> 24] ^ - m1[b >>> 16 & 255] ^ - m2[c >>> 8 & 255] ^ - m3[d & 255] ^ w[++i]; - b2 = - m0[b >>> 24] ^ - m1[c >>> 16 & 255] ^ - m2[d >>> 8 & 255] ^ - m3[a & 255] ^ w[++i]; - c2 = - m0[c >>> 24] ^ - m1[d >>> 16 & 255] ^ - m2[a >>> 8 & 255] ^ - m3[b & 255] ^ w[++i]; - d = - m0[d >>> 24] ^ - m1[a >>> 16 & 255] ^ - m2[b >>> 8 & 255] ^ - m3[c & 255] ^ w[++i]; - a = a2; - b = b2; - c = c2; - } - - /* - Encrypt: - SubBytes(state) - ShiftRows(state) - AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - - Decrypt: - InvShiftRows(state) - InvSubBytes(state) - AddRoundKey(state, w[0, Nb-1]) - */ - // Note: rows are shifted inline - output[0] = - (sub[a >>> 24] << 24) ^ - (sub[b >>> 16 & 255] << 16) ^ - (sub[c >>> 8 & 255] << 8) ^ - (sub[d & 255]) ^ w[++i]; - output[decrypt ? 3 : 1] = - (sub[b >>> 24] << 24) ^ - (sub[c >>> 16 & 255] << 16) ^ - (sub[d >>> 8 & 255] << 8) ^ - (sub[a & 255]) ^ w[++i]; - output[2] = - (sub[c >>> 24] << 24) ^ - (sub[d >>> 16 & 255] << 16) ^ - (sub[a >>> 8 & 255] << 8) ^ - (sub[b & 255]) ^ w[++i]; - output[decrypt ? 1 : 3] = - (sub[d >>> 24] << 24) ^ - (sub[a >>> 16 & 255] << 16) ^ - (sub[b >>> 8 & 255] << 8) ^ - (sub[c & 255]) ^ w[++i]; -} - -/** - * Deprecated. Instead, use: - * - * forge.cipher.createCipher('AES-', key); - * forge.cipher.createDecipher('AES-', key); - * - * Creates a deprecated AES cipher object. This object's mode will default to - * CBC (cipher-block-chaining). - * - * The key and iv may be given as a string of bytes, an array of bytes, a - * byte buffer, or an array of 32-bit words. - * - * @param options the options to use. - * key the symmetric key to use. - * output the buffer to write to. - * decrypt true for decryption, false for encryption. - * mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -function _createCipher(options) { - options = options || {}; - var mode = (options.mode || 'CBC').toUpperCase(); - var algorithm = 'AES-' + mode; - - var cipher; - if(options.decrypt) { - cipher = forge.cipher.createDecipher(algorithm, options.key); - } else { - cipher = forge.cipher.createCipher(algorithm, options.key); - } - - // backwards compatible start API - var start = cipher.start; - cipher.start = function(iv, options) { - // backwards compatibility: support second arg as output buffer - var output = null; - if(options instanceof forge.util.ByteBuffer) { - output = options; - options = {}; - } - options = options || {}; - options.output = output; - options.iv = iv; - start.call(cipher, options); - }; - - return cipher; -} diff --git a/node_modules/node-forge/lib/aesCipherSuites.js b/node_modules/node-forge/lib/aesCipherSuites.js deleted file mode 100644 index fed60f36..00000000 --- a/node_modules/node-forge/lib/aesCipherSuites.js +++ /dev/null @@ -1,282 +0,0 @@ -/** - * A Javascript implementation of AES Cipher Suites for TLS. - * - * @author Dave Longley - * - * Copyright (c) 2009-2015 Digital Bazaar, Inc. - * - */ -var forge = require('./forge'); -require('./aes'); -require('./tls'); - -var tls = module.exports = forge.tls; - -/** - * Supported cipher suites. - */ -tls.CipherSuites['TLS_RSA_WITH_AES_128_CBC_SHA'] = { - id: [0x00, 0x2f], - name: 'TLS_RSA_WITH_AES_128_CBC_SHA', - initSecurityParameters: function(sp) { - sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes; - sp.cipher_type = tls.CipherType.block; - sp.enc_key_length = 16; - sp.block_length = 16; - sp.fixed_iv_length = 16; - sp.record_iv_length = 16; - sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1; - sp.mac_length = 20; - sp.mac_key_length = 20; - }, - initConnectionState: initConnectionState -}; -tls.CipherSuites['TLS_RSA_WITH_AES_256_CBC_SHA'] = { - id: [0x00, 0x35], - name: 'TLS_RSA_WITH_AES_256_CBC_SHA', - initSecurityParameters: function(sp) { - sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes; - sp.cipher_type = tls.CipherType.block; - sp.enc_key_length = 32; - sp.block_length = 16; - sp.fixed_iv_length = 16; - sp.record_iv_length = 16; - sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1; - sp.mac_length = 20; - sp.mac_key_length = 20; - }, - initConnectionState: initConnectionState -}; - -function initConnectionState(state, c, sp) { - var client = (c.entity === forge.tls.ConnectionEnd.client); - - // cipher setup - state.read.cipherState = { - init: false, - cipher: forge.cipher.createDecipher('AES-CBC', client ? - sp.keys.server_write_key : sp.keys.client_write_key), - iv: client ? sp.keys.server_write_IV : sp.keys.client_write_IV - }; - state.write.cipherState = { - init: false, - cipher: forge.cipher.createCipher('AES-CBC', client ? - sp.keys.client_write_key : sp.keys.server_write_key), - iv: client ? sp.keys.client_write_IV : sp.keys.server_write_IV - }; - state.read.cipherFunction = decrypt_aes_cbc_sha1; - state.write.cipherFunction = encrypt_aes_cbc_sha1; - - // MAC setup - state.read.macLength = state.write.macLength = sp.mac_length; - state.read.macFunction = state.write.macFunction = tls.hmac_sha1; -} - -/** - * Encrypts the TLSCompressed record into a TLSCipherText record using AES - * in CBC mode. - * - * @param record the TLSCompressed record to encrypt. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -function encrypt_aes_cbc_sha1(record, s) { - var rval = false; - - // append MAC to fragment, update sequence number - var mac = s.macFunction(s.macKey, s.sequenceNumber, record); - record.fragment.putBytes(mac); - s.updateSequenceNumber(); - - // TLS 1.1+ use an explicit IV every time to protect against CBC attacks - var iv; - if(record.version.minor === tls.Versions.TLS_1_0.minor) { - // use the pre-generated IV when initializing for TLS 1.0, otherwise use - // the residue from the previous encryption - iv = s.cipherState.init ? null : s.cipherState.iv; - } else { - iv = forge.random.getBytesSync(16); - } - - s.cipherState.init = true; - - // start cipher - var cipher = s.cipherState.cipher; - cipher.start({iv: iv}); - - // TLS 1.1+ write IV into output - if(record.version.minor >= tls.Versions.TLS_1_1.minor) { - cipher.output.putBytes(iv); - } - - // do encryption (default padding is appropriate) - cipher.update(record.fragment); - if(cipher.finish(encrypt_aes_cbc_sha1_padding)) { - // set record fragment to encrypted output - record.fragment = cipher.output; - record.length = record.fragment.length(); - rval = true; - } - - return rval; -} - -/** - * Handles padding for aes_cbc_sha1 in encrypt mode. - * - * @param blockSize the block size. - * @param input the input buffer. - * @param decrypt true in decrypt mode, false in encrypt mode. - * - * @return true on success, false on failure. - */ -function encrypt_aes_cbc_sha1_padding(blockSize, input, decrypt) { - /* The encrypted data length (TLSCiphertext.length) is one more than the sum - of SecurityParameters.block_length, TLSCompressed.length, - SecurityParameters.mac_length, and padding_length. - - The padding may be any length up to 255 bytes long, as long as it results in - the TLSCiphertext.length being an integral multiple of the block length. - Lengths longer than necessary might be desirable to frustrate attacks on a - protocol based on analysis of the lengths of exchanged messages. Each uint8 - in the padding data vector must be filled with the padding length value. - - The padding length should be such that the total size of the - GenericBlockCipher structure is a multiple of the cipher's block length. - Legal values range from zero to 255, inclusive. This length specifies the - length of the padding field exclusive of the padding_length field itself. - - This is slightly different from PKCS#7 because the padding value is 1 - less than the actual number of padding bytes if you include the - padding_length uint8 itself as a padding byte. */ - if(!decrypt) { - // get the number of padding bytes required to reach the blockSize and - // subtract 1 for the padding value (to make room for the padding_length - // uint8) - var padding = blockSize - (input.length() % blockSize); - input.fillWithByte(padding - 1, padding); - } - return true; -} - -/** - * Handles padding for aes_cbc_sha1 in decrypt mode. - * - * @param blockSize the block size. - * @param output the output buffer. - * @param decrypt true in decrypt mode, false in encrypt mode. - * - * @return true on success, false on failure. - */ -function decrypt_aes_cbc_sha1_padding(blockSize, output, decrypt) { - var rval = true; - if(decrypt) { - /* The last byte in the output specifies the number of padding bytes not - including itself. Each of the padding bytes has the same value as that - last byte (known as the padding_length). Here we check all padding - bytes to ensure they have the value of padding_length even if one of - them is bad in order to ward-off timing attacks. */ - var len = output.length(); - var paddingLength = output.last(); - for(var i = len - 1 - paddingLength; i < len - 1; ++i) { - rval = rval && (output.at(i) == paddingLength); - } - if(rval) { - // trim off padding bytes and last padding length byte - output.truncate(paddingLength + 1); - } - } - return rval; -} - -/** - * Decrypts a TLSCipherText record into a TLSCompressed record using - * AES in CBC mode. - * - * @param record the TLSCipherText record to decrypt. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -function decrypt_aes_cbc_sha1(record, s) { - var rval = false; - - var iv; - if(record.version.minor === tls.Versions.TLS_1_0.minor) { - // use pre-generated IV when initializing for TLS 1.0, otherwise use the - // residue from the previous decryption - iv = s.cipherState.init ? null : s.cipherState.iv; - } else { - // TLS 1.1+ use an explicit IV every time to protect against CBC attacks - // that is appended to the record fragment - iv = record.fragment.getBytes(16); - } - - s.cipherState.init = true; - - // start cipher - var cipher = s.cipherState.cipher; - cipher.start({iv: iv}); - - // do decryption - cipher.update(record.fragment); - rval = cipher.finish(decrypt_aes_cbc_sha1_padding); - - // even if decryption fails, keep going to minimize timing attacks - - // decrypted data: - // first (len - 20) bytes = application data - // last 20 bytes = MAC - var macLen = s.macLength; - - // create a random MAC to check against should the mac length check fail - // Note: do this regardless of the failure to keep timing consistent - var mac = forge.random.getBytesSync(macLen); - - // get fragment and mac - var len = cipher.output.length(); - if(len >= macLen) { - record.fragment = cipher.output.getBytes(len - macLen); - mac = cipher.output.getBytes(macLen); - } else { - // bad data, but get bytes anyway to try to keep timing consistent - record.fragment = cipher.output.getBytes(); - } - record.fragment = forge.util.createBuffer(record.fragment); - record.length = record.fragment.length(); - - // see if data integrity checks out, update sequence number - var mac2 = s.macFunction(s.macKey, s.sequenceNumber, record); - s.updateSequenceNumber(); - rval = compareMacs(s.macKey, mac, mac2) && rval; - return rval; -} - -/** - * Safely compare two MACs. This function will compare two MACs in a way - * that protects against timing attacks. - * - * TODO: Expose elsewhere as a utility API. - * - * See: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/february/double-hmac-verification/ - * - * @param key the MAC key to use. - * @param mac1 as a binary-encoded string of bytes. - * @param mac2 as a binary-encoded string of bytes. - * - * @return true if the MACs are the same, false if not. - */ -function compareMacs(key, mac1, mac2) { - var hmac = forge.hmac.create(); - - hmac.start('SHA1', key); - hmac.update(mac1); - mac1 = hmac.digest().getBytes(); - - hmac.start(null, null); - hmac.update(mac2); - mac2 = hmac.digest().getBytes(); - - return mac1 === mac2; -} diff --git a/node_modules/node-forge/lib/asn1-validator.js b/node_modules/node-forge/lib/asn1-validator.js deleted file mode 100644 index 2be32850..00000000 --- a/node_modules/node-forge/lib/asn1-validator.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) 2019 Digital Bazaar, Inc. - */ - -var forge = require('./forge'); -require('./asn1'); -var asn1 = forge.asn1; - -exports.privateKeyValidator = { - // PrivateKeyInfo - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // Version (INTEGER) - name: 'PrivateKeyInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyVersion' - }, { - // privateKeyAlgorithm - name: 'PrivateKeyInfo.privateKeyAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'privateKeyOid' - }] - }, { - // PrivateKey - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'privateKey' - }] -}; - -exports.publicKeyValidator = { - name: 'SubjectPublicKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'subjectPublicKeyInfo', - value: [{ - name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'publicKeyOid' - }] - }, - // capture group for ed25519PublicKey - { - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - composed: true, - captureBitStringValue: 'ed25519PublicKey' - } - // FIXME: this is capture group for rsaPublicKey, use it in this API or - // discard? - /* { - // subjectPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - value: [{ - // RSAPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'rsaPublicKey' - }] - } */ - ] -}; diff --git a/node_modules/node-forge/lib/asn1.js b/node_modules/node-forge/lib/asn1.js deleted file mode 100644 index e0fea0e0..00000000 --- a/node_modules/node-forge/lib/asn1.js +++ /dev/null @@ -1,1408 +0,0 @@ -/** - * Javascript implementation of Abstract Syntax Notation Number One. - * - * @author Dave Longley - * - * Copyright (c) 2010-2015 Digital Bazaar, Inc. - * - * An API for storing data using the Abstract Syntax Notation Number One - * format using DER (Distinguished Encoding Rules) encoding. This encoding is - * commonly used to store data for PKI, i.e. X.509 Certificates, and this - * implementation exists for that purpose. - * - * Abstract Syntax Notation Number One (ASN.1) is used to define the abstract - * syntax of information without restricting the way the information is encoded - * for transmission. It provides a standard that allows for open systems - * communication. ASN.1 defines the syntax of information data and a number of - * simple data types as well as a notation for describing them and specifying - * values for them. - * - * The RSA algorithm creates public and private keys that are often stored in - * X.509 or PKCS#X formats -- which use ASN.1 (encoded in DER format). This - * class provides the most basic functionality required to store and load DSA - * keys that are encoded according to ASN.1. - * - * The most common binary encodings for ASN.1 are BER (Basic Encoding Rules) - * and DER (Distinguished Encoding Rules). DER is just a subset of BER that - * has stricter requirements for how data must be encoded. - * - * Each ASN.1 structure has a tag (a byte identifying the ASN.1 structure type) - * and a byte array for the value of this ASN1 structure which may be data or a - * list of ASN.1 structures. - * - * Each ASN.1 structure using BER is (Tag-Length-Value): - * - * | byte 0 | bytes X | bytes Y | - * |--------|---------|---------- - * | tag | length | value | - * - * ASN.1 allows for tags to be of "High-tag-number form" which allows a tag to - * be two or more octets, but that is not supported by this class. A tag is - * only 1 byte. Bits 1-5 give the tag number (ie the data type within a - * particular 'class'), 6 indicates whether or not the ASN.1 value is - * constructed from other ASN.1 values, and bits 7 and 8 give the 'class'. If - * bits 7 and 8 are both zero, the class is UNIVERSAL. If only bit 7 is set, - * then the class is APPLICATION. If only bit 8 is set, then the class is - * CONTEXT_SPECIFIC. If both bits 7 and 8 are set, then the class is PRIVATE. - * The tag numbers for the data types for the class UNIVERSAL are listed below: - * - * UNIVERSAL 0 Reserved for use by the encoding rules - * UNIVERSAL 1 Boolean type - * UNIVERSAL 2 Integer type - * UNIVERSAL 3 Bitstring type - * UNIVERSAL 4 Octetstring type - * UNIVERSAL 5 Null type - * UNIVERSAL 6 Object identifier type - * UNIVERSAL 7 Object descriptor type - * UNIVERSAL 8 External type and Instance-of type - * UNIVERSAL 9 Real type - * UNIVERSAL 10 Enumerated type - * UNIVERSAL 11 Embedded-pdv type - * UNIVERSAL 12 UTF8String type - * UNIVERSAL 13 Relative object identifier type - * UNIVERSAL 14-15 Reserved for future editions - * UNIVERSAL 16 Sequence and Sequence-of types - * UNIVERSAL 17 Set and Set-of types - * UNIVERSAL 18-22, 25-30 Character string types - * UNIVERSAL 23-24 Time types - * - * The length of an ASN.1 structure is specified after the tag identifier. - * There is a definite form and an indefinite form. The indefinite form may - * be used if the encoding is constructed and not all immediately available. - * The indefinite form is encoded using a length byte with only the 8th bit - * set. The end of the constructed object is marked using end-of-contents - * octets (two zero bytes). - * - * The definite form looks like this: - * - * The length may take up 1 or more bytes, it depends on the length of the - * value of the ASN.1 structure. DER encoding requires that if the ASN.1 - * structure has a value that has a length greater than 127, more than 1 byte - * will be used to store its length, otherwise just one byte will be used. - * This is strict. - * - * In the case that the length of the ASN.1 value is less than 127, 1 octet - * (byte) is used to store the "short form" length. The 8th bit has a value of - * 0 indicating the length is "short form" and not "long form" and bits 7-1 - * give the length of the data. (The 8th bit is the left-most, most significant - * bit: also known as big endian or network format). - * - * In the case that the length of the ASN.1 value is greater than 127, 2 to - * 127 octets (bytes) are used to store the "long form" length. The first - * byte's 8th bit is set to 1 to indicate the length is "long form." Bits 7-1 - * give the number of additional octets. All following octets are in base 256 - * with the most significant digit first (typical big-endian binary unsigned - * integer storage). So, for instance, if the length of a value was 257, the - * first byte would be set to: - * - * 10000010 = 130 = 0x82. - * - * This indicates there are 2 octets (base 256) for the length. The second and - * third bytes (the octets just mentioned) would store the length in base 256: - * - * octet 2: 00000001 = 1 * 256^1 = 256 - * octet 3: 00000001 = 1 * 256^0 = 1 - * total = 257 - * - * The algorithm for converting a js integer value of 257 to base-256 is: - * - * var value = 257; - * var bytes = []; - * bytes[0] = (value >>> 8) & 0xFF; // most significant byte first - * bytes[1] = value & 0xFF; // least significant byte last - * - * On the ASN.1 UNIVERSAL Object Identifier (OID) type: - * - * An OID can be written like: "value1.value2.value3...valueN" - * - * The DER encoding rules: - * - * The first byte has the value 40 * value1 + value2. - * The following bytes, if any, encode the remaining values. Each value is - * encoded in base 128, most significant digit first (big endian), with as - * few digits as possible, and the most significant bit of each byte set - * to 1 except the last in each value's encoding. For example: Given the - * OID "1.2.840.113549", its DER encoding is (remember each byte except the - * last one in each encoding is OR'd with 0x80): - * - * byte 1: 40 * 1 + 2 = 42 = 0x2A. - * bytes 2-3: 128 * 6 + 72 = 840 = 6 72 = 6 72 = 0x0648 = 0x8648 - * bytes 4-6: 16384 * 6 + 128 * 119 + 13 = 6 119 13 = 0x06770D = 0x86F70D - * - * The final value is: 0x2A864886F70D. - * The full OID (including ASN.1 tag and length of 6 bytes) is: - * 0x06062A864886F70D - */ -var forge = require('./forge'); -require('./util'); -require('./oids'); - -/* ASN.1 API */ -var asn1 = module.exports = forge.asn1 = forge.asn1 || {}; - -/** - * ASN.1 classes. - */ -asn1.Class = { - UNIVERSAL: 0x00, - APPLICATION: 0x40, - CONTEXT_SPECIFIC: 0x80, - PRIVATE: 0xC0 -}; - -/** - * ASN.1 types. Not all types are supported by this implementation, only - * those necessary to implement a simple PKI are implemented. - */ -asn1.Type = { - NONE: 0, - BOOLEAN: 1, - INTEGER: 2, - BITSTRING: 3, - OCTETSTRING: 4, - NULL: 5, - OID: 6, - ODESC: 7, - EXTERNAL: 8, - REAL: 9, - ENUMERATED: 10, - EMBEDDED: 11, - UTF8: 12, - ROID: 13, - SEQUENCE: 16, - SET: 17, - PRINTABLESTRING: 19, - IA5STRING: 22, - UTCTIME: 23, - GENERALIZEDTIME: 24, - BMPSTRING: 30 -}; - -/** - * Creates a new asn1 object. - * - * @param tagClass the tag class for the object. - * @param type the data type (tag number) for the object. - * @param constructed true if the asn1 object is in constructed form. - * @param value the value for the object, if it is not constructed. - * @param [options] the options to use: - * [bitStringContents] the plain BIT STRING content including padding - * byte. - * - * @return the asn1 object. - */ -asn1.create = function(tagClass, type, constructed, value, options) { - /* An asn1 object has a tagClass, a type, a constructed flag, and a - value. The value's type depends on the constructed flag. If - constructed, it will contain a list of other asn1 objects. If not, - it will contain the ASN.1 value as an array of bytes formatted - according to the ASN.1 data type. */ - - // remove undefined values - if(forge.util.isArray(value)) { - var tmp = []; - for(var i = 0; i < value.length; ++i) { - if(value[i] !== undefined) { - tmp.push(value[i]); - } - } - value = tmp; - } - - var obj = { - tagClass: tagClass, - type: type, - constructed: constructed, - composed: constructed || forge.util.isArray(value), - value: value - }; - if(options && 'bitStringContents' in options) { - // TODO: copy byte buffer if it's a buffer not a string - obj.bitStringContents = options.bitStringContents; - // TODO: add readonly flag to avoid this overhead - // save copy to detect changes - obj.original = asn1.copy(obj); - } - return obj; -}; - -/** - * Copies an asn1 object. - * - * @param obj the asn1 object. - * @param [options] copy options: - * [excludeBitStringContents] true to not copy bitStringContents - * - * @return the a copy of the asn1 object. - */ -asn1.copy = function(obj, options) { - var copy; - - if(forge.util.isArray(obj)) { - copy = []; - for(var i = 0; i < obj.length; ++i) { - copy.push(asn1.copy(obj[i], options)); - } - return copy; - } - - if(typeof obj === 'string') { - // TODO: copy byte buffer if it's a buffer not a string - return obj; - } - - copy = { - tagClass: obj.tagClass, - type: obj.type, - constructed: obj.constructed, - composed: obj.composed, - value: asn1.copy(obj.value, options) - }; - if(options && !options.excludeBitStringContents) { - // TODO: copy byte buffer if it's a buffer not a string - copy.bitStringContents = obj.bitStringContents; - } - return copy; -}; - -/** - * Compares asn1 objects for equality. - * - * Note this function does not run in constant time. - * - * @param obj1 the first asn1 object. - * @param obj2 the second asn1 object. - * @param [options] compare options: - * [includeBitStringContents] true to compare bitStringContents - * - * @return true if the asn1 objects are equal. - */ -asn1.equals = function(obj1, obj2, options) { - if(forge.util.isArray(obj1)) { - if(!forge.util.isArray(obj2)) { - return false; - } - if(obj1.length !== obj2.length) { - return false; - } - for(var i = 0; i < obj1.length; ++i) { - if(!asn1.equals(obj1[i], obj2[i])) { - return false; - } - } - return true; - } - - if(typeof obj1 !== typeof obj2) { - return false; - } - - if(typeof obj1 === 'string') { - return obj1 === obj2; - } - - var equal = obj1.tagClass === obj2.tagClass && - obj1.type === obj2.type && - obj1.constructed === obj2.constructed && - obj1.composed === obj2.composed && - asn1.equals(obj1.value, obj2.value); - if(options && options.includeBitStringContents) { - equal = equal && (obj1.bitStringContents === obj2.bitStringContents); - } - - return equal; -}; - -/** - * Gets the length of a BER-encoded ASN.1 value. - * - * In case the length is not specified, undefined is returned. - * - * @param b the BER-encoded ASN.1 byte buffer, starting with the first - * length byte. - * - * @return the length of the BER-encoded ASN.1 value or undefined. - */ -asn1.getBerValueLength = function(b) { - // TODO: move this function and related DER/BER functions to a der.js - // file; better abstract ASN.1 away from der/ber. - var b2 = b.getByte(); - if(b2 === 0x80) { - return undefined; - } - - // see if the length is "short form" or "long form" (bit 8 set) - var length; - var longForm = b2 & 0x80; - if(!longForm) { - // length is just the first byte - length = b2; - } else { - // the number of bytes the length is specified in bits 7 through 1 - // and each length byte is in big-endian base-256 - length = b.getInt((b2 & 0x7F) << 3); - } - return length; -}; - -/** - * Check if the byte buffer has enough bytes. Throws an Error if not. - * - * @param bytes the byte buffer to parse from. - * @param remaining the bytes remaining in the current parsing state. - * @param n the number of bytes the buffer must have. - */ -function _checkBufferLength(bytes, remaining, n) { - if(n > remaining) { - var error = new Error('Too few bytes to parse DER.'); - error.available = bytes.length(); - error.remaining = remaining; - error.requested = n; - throw error; - } -} - -/** - * Gets the length of a BER-encoded ASN.1 value. - * - * In case the length is not specified, undefined is returned. - * - * @param bytes the byte buffer to parse from. - * @param remaining the bytes remaining in the current parsing state. - * - * @return the length of the BER-encoded ASN.1 value or undefined. - */ -var _getValueLength = function(bytes, remaining) { - // TODO: move this function and related DER/BER functions to a der.js - // file; better abstract ASN.1 away from der/ber. - // fromDer already checked that this byte exists - var b2 = bytes.getByte(); - remaining--; - if(b2 === 0x80) { - return undefined; - } - - // see if the length is "short form" or "long form" (bit 8 set) - var length; - var longForm = b2 & 0x80; - if(!longForm) { - // length is just the first byte - length = b2; - } else { - // the number of bytes the length is specified in bits 7 through 1 - // and each length byte is in big-endian base-256 - var longFormBytes = b2 & 0x7F; - _checkBufferLength(bytes, remaining, longFormBytes); - length = bytes.getInt(longFormBytes << 3); - } - // FIXME: this will only happen for 32 bit getInt with high bit set - if(length < 0) { - throw new Error('Negative length: ' + length); - } - return length; -}; - -/** - * Parses an asn1 object from a byte buffer in DER format. - * - * @param bytes the byte buffer to parse from. - * @param [strict] true to be strict when checking value lengths, false to - * allow truncated values (default: true). - * @param [options] object with options or boolean strict flag - * [strict] true to be strict when checking value lengths, false to - * allow truncated values (default: true). - * [decodeBitStrings] true to attempt to decode the content of - * BIT STRINGs (not OCTET STRINGs) using strict mode. Note that - * without schema support to understand the data context this can - * erroneously decode values that happen to be valid ASN.1. This - * flag will be deprecated or removed as soon as schema support is - * available. (default: true) - * - * @return the parsed asn1 object. - */ -asn1.fromDer = function(bytes, options) { - if(options === undefined) { - options = { - strict: true, - decodeBitStrings: true - }; - } - if(typeof options === 'boolean') { - options = { - strict: options, - decodeBitStrings: true - }; - } - if(!('strict' in options)) { - options.strict = true; - } - if(!('decodeBitStrings' in options)) { - options.decodeBitStrings = true; - } - - // wrap in buffer if needed - if(typeof bytes === 'string') { - bytes = forge.util.createBuffer(bytes); - } - - return _fromDer(bytes, bytes.length(), 0, options); -}; - -/** - * Internal function to parse an asn1 object from a byte buffer in DER format. - * - * @param bytes the byte buffer to parse from. - * @param remaining the number of bytes remaining for this chunk. - * @param depth the current parsing depth. - * @param options object with same options as fromDer(). - * - * @return the parsed asn1 object. - */ -function _fromDer(bytes, remaining, depth, options) { - // temporary storage for consumption calculations - var start; - - // minimum length for ASN.1 DER structure is 2 - _checkBufferLength(bytes, remaining, 2); - - // get the first byte - var b1 = bytes.getByte(); - // consumed one byte - remaining--; - - // get the tag class - var tagClass = (b1 & 0xC0); - - // get the type (bits 1-5) - var type = b1 & 0x1F; - - // get the variable value length and adjust remaining bytes - start = bytes.length(); - var length = _getValueLength(bytes, remaining); - remaining -= start - bytes.length(); - - // ensure there are enough bytes to get the value - if(length !== undefined && length > remaining) { - if(options.strict) { - var error = new Error('Too few bytes to read ASN.1 value.'); - error.available = bytes.length(); - error.remaining = remaining; - error.requested = length; - throw error; - } - // Note: be lenient with truncated values and use remaining state bytes - length = remaining; - } - - // value storage - var value; - // possible BIT STRING contents storage - var bitStringContents; - - // constructed flag is bit 6 (32 = 0x20) of the first byte - var constructed = ((b1 & 0x20) === 0x20); - if(constructed) { - // parse child asn1 objects from the value - value = []; - if(length === undefined) { - // asn1 object of indefinite length, read until end tag - for(;;) { - _checkBufferLength(bytes, remaining, 2); - if(bytes.bytes(2) === String.fromCharCode(0, 0)) { - bytes.getBytes(2); - remaining -= 2; - break; - } - start = bytes.length(); - value.push(_fromDer(bytes, remaining, depth + 1, options)); - remaining -= start - bytes.length(); - } - } else { - // parsing asn1 object of definite length - while(length > 0) { - start = bytes.length(); - value.push(_fromDer(bytes, length, depth + 1, options)); - remaining -= start - bytes.length(); - length -= start - bytes.length(); - } - } - } - - // if a BIT STRING, save the contents including padding - if(value === undefined && tagClass === asn1.Class.UNIVERSAL && - type === asn1.Type.BITSTRING) { - bitStringContents = bytes.bytes(length); - } - - // determine if a non-constructed value should be decoded as a composed - // value that contains other ASN.1 objects. BIT STRINGs (and OCTET STRINGs) - // can be used this way. - if(value === undefined && options.decodeBitStrings && - tagClass === asn1.Class.UNIVERSAL && - // FIXME: OCTET STRINGs not yet supported here - // .. other parts of forge expect to decode OCTET STRINGs manually - (type === asn1.Type.BITSTRING /*|| type === asn1.Type.OCTETSTRING*/) && - length > 1) { - // save read position - var savedRead = bytes.read; - var savedRemaining = remaining; - var unused = 0; - if(type === asn1.Type.BITSTRING) { - /* The first octet gives the number of bits by which the length of the - bit string is less than the next multiple of eight (this is called - the "number of unused bits"). - - The second and following octets give the value of the bit string - converted to an octet string. */ - _checkBufferLength(bytes, remaining, 1); - unused = bytes.getByte(); - remaining--; - } - // if all bits are used, maybe the BIT/OCTET STRING holds ASN.1 objs - if(unused === 0) { - try { - // attempt to parse child asn1 object from the value - // (stored in array to signal composed value) - start = bytes.length(); - var subOptions = { - // enforce strict mode to avoid parsing ASN.1 from plain data - verbose: options.verbose, - strict: true, - decodeBitStrings: true - }; - var composed = _fromDer(bytes, remaining, depth + 1, subOptions); - var used = start - bytes.length(); - remaining -= used; - if(type == asn1.Type.BITSTRING) { - used++; - } - - // if the data all decoded and the class indicates UNIVERSAL or - // CONTEXT_SPECIFIC then assume we've got an encapsulated ASN.1 object - var tc = composed.tagClass; - if(used === length && - (tc === asn1.Class.UNIVERSAL || tc === asn1.Class.CONTEXT_SPECIFIC)) { - value = [composed]; - } - } catch(ex) { - } - } - if(value === undefined) { - // restore read position - bytes.read = savedRead; - remaining = savedRemaining; - } - } - - if(value === undefined) { - // asn1 not constructed or composed, get raw value - // TODO: do DER to OID conversion and vice-versa in .toDer? - - if(length === undefined) { - if(options.strict) { - throw new Error('Non-constructed ASN.1 object of indefinite length.'); - } - // be lenient and use remaining state bytes - length = remaining; - } - - if(type === asn1.Type.BMPSTRING) { - value = ''; - for(; length > 0; length -= 2) { - _checkBufferLength(bytes, remaining, 2); - value += String.fromCharCode(bytes.getInt16()); - remaining -= 2; - } - } else { - value = bytes.getBytes(length); - } - } - - // add BIT STRING contents if available - var asn1Options = bitStringContents === undefined ? null : { - bitStringContents: bitStringContents - }; - - // create and return asn1 object - return asn1.create(tagClass, type, constructed, value, asn1Options); -} - -/** - * Converts the given asn1 object to a buffer of bytes in DER format. - * - * @param asn1 the asn1 object to convert to bytes. - * - * @return the buffer of bytes. - */ -asn1.toDer = function(obj) { - var bytes = forge.util.createBuffer(); - - // build the first byte - var b1 = obj.tagClass | obj.type; - - // for storing the ASN.1 value - var value = forge.util.createBuffer(); - - // use BIT STRING contents if available and data not changed - var useBitStringContents = false; - if('bitStringContents' in obj) { - useBitStringContents = true; - if(obj.original) { - useBitStringContents = asn1.equals(obj, obj.original); - } - } - - if(useBitStringContents) { - value.putBytes(obj.bitStringContents); - } else if(obj.composed) { - // if composed, use each child asn1 object's DER bytes as value - // turn on 6th bit (0x20 = 32) to indicate asn1 is constructed - // from other asn1 objects - if(obj.constructed) { - b1 |= 0x20; - } else { - // type is a bit string, add unused bits of 0x00 - value.putByte(0x00); - } - - // add all of the child DER bytes together - for(var i = 0; i < obj.value.length; ++i) { - if(obj.value[i] !== undefined) { - value.putBuffer(asn1.toDer(obj.value[i])); - } - } - } else { - // use asn1.value directly - if(obj.type === asn1.Type.BMPSTRING) { - for(var i = 0; i < obj.value.length; ++i) { - value.putInt16(obj.value.charCodeAt(i)); - } - } else { - // ensure integer is minimally-encoded - // TODO: should all leading bytes be stripped vs just one? - // .. ex '00 00 01' => '01'? - if(obj.type === asn1.Type.INTEGER && - obj.value.length > 1 && - // leading 0x00 for positive integer - ((obj.value.charCodeAt(0) === 0 && - (obj.value.charCodeAt(1) & 0x80) === 0) || - // leading 0xFF for negative integer - (obj.value.charCodeAt(0) === 0xFF && - (obj.value.charCodeAt(1) & 0x80) === 0x80))) { - value.putBytes(obj.value.substr(1)); - } else { - value.putBytes(obj.value); - } - } - } - - // add tag byte - bytes.putByte(b1); - - // use "short form" encoding - if(value.length() <= 127) { - // one byte describes the length - // bit 8 = 0 and bits 7-1 = length - bytes.putByte(value.length() & 0x7F); - } else { - // use "long form" encoding - // 2 to 127 bytes describe the length - // first byte: bit 8 = 1 and bits 7-1 = # of additional bytes - // other bytes: length in base 256, big-endian - var len = value.length(); - var lenBytes = ''; - do { - lenBytes += String.fromCharCode(len & 0xFF); - len = len >>> 8; - } while(len > 0); - - // set first byte to # bytes used to store the length and turn on - // bit 8 to indicate long-form length is used - bytes.putByte(lenBytes.length | 0x80); - - // concatenate length bytes in reverse since they were generated - // little endian and we need big endian - for(var i = lenBytes.length - 1; i >= 0; --i) { - bytes.putByte(lenBytes.charCodeAt(i)); - } - } - - // concatenate value bytes - bytes.putBuffer(value); - return bytes; -}; - -/** - * Converts an OID dot-separated string to a byte buffer. The byte buffer - * contains only the DER-encoded value, not any tag or length bytes. - * - * @param oid the OID dot-separated string. - * - * @return the byte buffer. - */ -asn1.oidToDer = function(oid) { - // split OID into individual values - var values = oid.split('.'); - var bytes = forge.util.createBuffer(); - - // first byte is 40 * value1 + value2 - bytes.putByte(40 * parseInt(values[0], 10) + parseInt(values[1], 10)); - // other bytes are each value in base 128 with 8th bit set except for - // the last byte for each value - var last, valueBytes, value, b; - for(var i = 2; i < values.length; ++i) { - // produce value bytes in reverse because we don't know how many - // bytes it will take to store the value - last = true; - valueBytes = []; - value = parseInt(values[i], 10); - do { - b = value & 0x7F; - value = value >>> 7; - // if value is not last, then turn on 8th bit - if(!last) { - b |= 0x80; - } - valueBytes.push(b); - last = false; - } while(value > 0); - - // add value bytes in reverse (needs to be in big endian) - for(var n = valueBytes.length - 1; n >= 0; --n) { - bytes.putByte(valueBytes[n]); - } - } - - return bytes; -}; - -/** - * Converts a DER-encoded byte buffer to an OID dot-separated string. The - * byte buffer should contain only the DER-encoded value, not any tag or - * length bytes. - * - * @param bytes the byte buffer. - * - * @return the OID dot-separated string. - */ -asn1.derToOid = function(bytes) { - var oid; - - // wrap in buffer if needed - if(typeof bytes === 'string') { - bytes = forge.util.createBuffer(bytes); - } - - // first byte is 40 * value1 + value2 - var b = bytes.getByte(); - oid = Math.floor(b / 40) + '.' + (b % 40); - - // other bytes are each value in base 128 with 8th bit set except for - // the last byte for each value - var value = 0; - while(bytes.length() > 0) { - b = bytes.getByte(); - value = value << 7; - // not the last byte for the value - if(b & 0x80) { - value += b & 0x7F; - } else { - // last byte - oid += '.' + (value + b); - value = 0; - } - } - - return oid; -}; - -/** - * Converts a UTCTime value to a date. - * - * Note: GeneralizedTime has 4 digits for the year and is used for X.509 - * dates past 2049. Parsing that structure hasn't been implemented yet. - * - * @param utc the UTCTime value to convert. - * - * @return the date. - */ -asn1.utcTimeToDate = function(utc) { - /* The following formats can be used: - - YYMMDDhhmmZ - YYMMDDhhmm+hh'mm' - YYMMDDhhmm-hh'mm' - YYMMDDhhmmssZ - YYMMDDhhmmss+hh'mm' - YYMMDDhhmmss-hh'mm' - - Where: - - YY is the least significant two digits of the year - MM is the month (01 to 12) - DD is the day (01 to 31) - hh is the hour (00 to 23) - mm are the minutes (00 to 59) - ss are the seconds (00 to 59) - Z indicates that local time is GMT, + indicates that local time is - later than GMT, and - indicates that local time is earlier than GMT - hh' is the absolute value of the offset from GMT in hours - mm' is the absolute value of the offset from GMT in minutes */ - var date = new Date(); - - // if YY >= 50 use 19xx, if YY < 50 use 20xx - var year = parseInt(utc.substr(0, 2), 10); - year = (year >= 50) ? 1900 + year : 2000 + year; - var MM = parseInt(utc.substr(2, 2), 10) - 1; // use 0-11 for month - var DD = parseInt(utc.substr(4, 2), 10); - var hh = parseInt(utc.substr(6, 2), 10); - var mm = parseInt(utc.substr(8, 2), 10); - var ss = 0; - - // not just YYMMDDhhmmZ - if(utc.length > 11) { - // get character after minutes - var c = utc.charAt(10); - var end = 10; - - // see if seconds are present - if(c !== '+' && c !== '-') { - // get seconds - ss = parseInt(utc.substr(10, 2), 10); - end += 2; - } - } - - // update date - date.setUTCFullYear(year, MM, DD); - date.setUTCHours(hh, mm, ss, 0); - - if(end) { - // get +/- after end of time - c = utc.charAt(end); - if(c === '+' || c === '-') { - // get hours+minutes offset - var hhoffset = parseInt(utc.substr(end + 1, 2), 10); - var mmoffset = parseInt(utc.substr(end + 4, 2), 10); - - // calculate offset in milliseconds - var offset = hhoffset * 60 + mmoffset; - offset *= 60000; - - // apply offset - if(c === '+') { - date.setTime(+date - offset); - } else { - date.setTime(+date + offset); - } - } - } - - return date; -}; - -/** - * Converts a GeneralizedTime value to a date. - * - * @param gentime the GeneralizedTime value to convert. - * - * @return the date. - */ -asn1.generalizedTimeToDate = function(gentime) { - /* The following formats can be used: - - YYYYMMDDHHMMSS - YYYYMMDDHHMMSS.fff - YYYYMMDDHHMMSSZ - YYYYMMDDHHMMSS.fffZ - YYYYMMDDHHMMSS+hh'mm' - YYYYMMDDHHMMSS.fff+hh'mm' - YYYYMMDDHHMMSS-hh'mm' - YYYYMMDDHHMMSS.fff-hh'mm' - - Where: - - YYYY is the year - MM is the month (01 to 12) - DD is the day (01 to 31) - hh is the hour (00 to 23) - mm are the minutes (00 to 59) - ss are the seconds (00 to 59) - .fff is the second fraction, accurate to three decimal places - Z indicates that local time is GMT, + indicates that local time is - later than GMT, and - indicates that local time is earlier than GMT - hh' is the absolute value of the offset from GMT in hours - mm' is the absolute value of the offset from GMT in minutes */ - var date = new Date(); - - var YYYY = parseInt(gentime.substr(0, 4), 10); - var MM = parseInt(gentime.substr(4, 2), 10) - 1; // use 0-11 for month - var DD = parseInt(gentime.substr(6, 2), 10); - var hh = parseInt(gentime.substr(8, 2), 10); - var mm = parseInt(gentime.substr(10, 2), 10); - var ss = parseInt(gentime.substr(12, 2), 10); - var fff = 0; - var offset = 0; - var isUTC = false; - - if(gentime.charAt(gentime.length - 1) === 'Z') { - isUTC = true; - } - - var end = gentime.length - 5, c = gentime.charAt(end); - if(c === '+' || c === '-') { - // get hours+minutes offset - var hhoffset = parseInt(gentime.substr(end + 1, 2), 10); - var mmoffset = parseInt(gentime.substr(end + 4, 2), 10); - - // calculate offset in milliseconds - offset = hhoffset * 60 + mmoffset; - offset *= 60000; - - // apply offset - if(c === '+') { - offset *= -1; - } - - isUTC = true; - } - - // check for second fraction - if(gentime.charAt(14) === '.') { - fff = parseFloat(gentime.substr(14), 10) * 1000; - } - - if(isUTC) { - date.setUTCFullYear(YYYY, MM, DD); - date.setUTCHours(hh, mm, ss, fff); - - // apply offset - date.setTime(+date + offset); - } else { - date.setFullYear(YYYY, MM, DD); - date.setHours(hh, mm, ss, fff); - } - - return date; -}; - -/** - * Converts a date to a UTCTime value. - * - * Note: GeneralizedTime has 4 digits for the year and is used for X.509 - * dates past 2049. Converting to a GeneralizedTime hasn't been - * implemented yet. - * - * @param date the date to convert. - * - * @return the UTCTime value. - */ -asn1.dateToUtcTime = function(date) { - // TODO: validate; currently assumes proper format - if(typeof date === 'string') { - return date; - } - - var rval = ''; - - // create format YYMMDDhhmmssZ - var format = []; - format.push(('' + date.getUTCFullYear()).substr(2)); - format.push('' + (date.getUTCMonth() + 1)); - format.push('' + date.getUTCDate()); - format.push('' + date.getUTCHours()); - format.push('' + date.getUTCMinutes()); - format.push('' + date.getUTCSeconds()); - - // ensure 2 digits are used for each format entry - for(var i = 0; i < format.length; ++i) { - if(format[i].length < 2) { - rval += '0'; - } - rval += format[i]; - } - rval += 'Z'; - - return rval; -}; - -/** - * Converts a date to a GeneralizedTime value. - * - * @param date the date to convert. - * - * @return the GeneralizedTime value as a string. - */ -asn1.dateToGeneralizedTime = function(date) { - // TODO: validate; currently assumes proper format - if(typeof date === 'string') { - return date; - } - - var rval = ''; - - // create format YYYYMMDDHHMMSSZ - var format = []; - format.push('' + date.getUTCFullYear()); - format.push('' + (date.getUTCMonth() + 1)); - format.push('' + date.getUTCDate()); - format.push('' + date.getUTCHours()); - format.push('' + date.getUTCMinutes()); - format.push('' + date.getUTCSeconds()); - - // ensure 2 digits are used for each format entry - for(var i = 0; i < format.length; ++i) { - if(format[i].length < 2) { - rval += '0'; - } - rval += format[i]; - } - rval += 'Z'; - - return rval; -}; - -/** - * Converts a javascript integer to a DER-encoded byte buffer to be used - * as the value for an INTEGER type. - * - * @param x the integer. - * - * @return the byte buffer. - */ -asn1.integerToDer = function(x) { - var rval = forge.util.createBuffer(); - if(x >= -0x80 && x < 0x80) { - return rval.putSignedInt(x, 8); - } - if(x >= -0x8000 && x < 0x8000) { - return rval.putSignedInt(x, 16); - } - if(x >= -0x800000 && x < 0x800000) { - return rval.putSignedInt(x, 24); - } - if(x >= -0x80000000 && x < 0x80000000) { - return rval.putSignedInt(x, 32); - } - var error = new Error('Integer too large; max is 32-bits.'); - error.integer = x; - throw error; -}; - -/** - * Converts a DER-encoded byte buffer to a javascript integer. This is - * typically used to decode the value of an INTEGER type. - * - * @param bytes the byte buffer. - * - * @return the integer. - */ -asn1.derToInteger = function(bytes) { - // wrap in buffer if needed - if(typeof bytes === 'string') { - bytes = forge.util.createBuffer(bytes); - } - - var n = bytes.length() * 8; - if(n > 32) { - throw new Error('Integer too large; max is 32-bits.'); - } - return bytes.getSignedInt(n); -}; - -/** - * Validates that the given ASN.1 object is at least a super set of the - * given ASN.1 structure. Only tag classes and types are checked. An - * optional map may also be provided to capture ASN.1 values while the - * structure is checked. - * - * To capture an ASN.1 value, set an object in the validator's 'capture' - * parameter to the key to use in the capture map. To capture the full - * ASN.1 object, specify 'captureAsn1'. To capture BIT STRING bytes, including - * the leading unused bits counter byte, specify 'captureBitStringContents'. - * To capture BIT STRING bytes, without the leading unused bits counter byte, - * specify 'captureBitStringValue'. - * - * Objects in the validator may set a field 'optional' to true to indicate - * that it isn't necessary to pass validation. - * - * @param obj the ASN.1 object to validate. - * @param v the ASN.1 structure validator. - * @param capture an optional map to capture values in. - * @param errors an optional array for storing validation errors. - * - * @return true on success, false on failure. - */ -asn1.validate = function(obj, v, capture, errors) { - var rval = false; - - // ensure tag class and type are the same if specified - if((obj.tagClass === v.tagClass || typeof(v.tagClass) === 'undefined') && - (obj.type === v.type || typeof(v.type) === 'undefined')) { - // ensure constructed flag is the same if specified - if(obj.constructed === v.constructed || - typeof(v.constructed) === 'undefined') { - rval = true; - - // handle sub values - if(v.value && forge.util.isArray(v.value)) { - var j = 0; - for(var i = 0; rval && i < v.value.length; ++i) { - rval = v.value[i].optional || false; - if(obj.value[j]) { - rval = asn1.validate(obj.value[j], v.value[i], capture, errors); - if(rval) { - ++j; - } else if(v.value[i].optional) { - rval = true; - } - } - if(!rval && errors) { - errors.push( - '[' + v.name + '] ' + - 'Tag class "' + v.tagClass + '", type "' + - v.type + '" expected value length "' + - v.value.length + '", got "' + - obj.value.length + '"'); - } - } - } - - if(rval && capture) { - if(v.capture) { - capture[v.capture] = obj.value; - } - if(v.captureAsn1) { - capture[v.captureAsn1] = obj; - } - if(v.captureBitStringContents && 'bitStringContents' in obj) { - capture[v.captureBitStringContents] = obj.bitStringContents; - } - if(v.captureBitStringValue && 'bitStringContents' in obj) { - var value; - if(obj.bitStringContents.length < 2) { - capture[v.captureBitStringValue] = ''; - } else { - // FIXME: support unused bits with data shifting - var unused = obj.bitStringContents.charCodeAt(0); - if(unused !== 0) { - throw new Error( - 'captureBitStringValue only supported for zero unused bits'); - } - capture[v.captureBitStringValue] = obj.bitStringContents.slice(1); - } - } - } - } else if(errors) { - errors.push( - '[' + v.name + '] ' + - 'Expected constructed "' + v.constructed + '", got "' + - obj.constructed + '"'); - } - } else if(errors) { - if(obj.tagClass !== v.tagClass) { - errors.push( - '[' + v.name + '] ' + - 'Expected tag class "' + v.tagClass + '", got "' + - obj.tagClass + '"'); - } - if(obj.type !== v.type) { - errors.push( - '[' + v.name + '] ' + - 'Expected type "' + v.type + '", got "' + obj.type + '"'); - } - } - return rval; -}; - -// regex for testing for non-latin characters -var _nonLatinRegex = /[^\\u0000-\\u00ff]/; - -/** - * Pretty prints an ASN.1 object to a string. - * - * @param obj the object to write out. - * @param level the level in the tree. - * @param indentation the indentation to use. - * - * @return the string. - */ -asn1.prettyPrint = function(obj, level, indentation) { - var rval = ''; - - // set default level and indentation - level = level || 0; - indentation = indentation || 2; - - // start new line for deep levels - if(level > 0) { - rval += '\n'; - } - - // create indent - var indent = ''; - for(var i = 0; i < level * indentation; ++i) { - indent += ' '; - } - - // print class:type - rval += indent + 'Tag: '; - switch(obj.tagClass) { - case asn1.Class.UNIVERSAL: - rval += 'Universal:'; - break; - case asn1.Class.APPLICATION: - rval += 'Application:'; - break; - case asn1.Class.CONTEXT_SPECIFIC: - rval += 'Context-Specific:'; - break; - case asn1.Class.PRIVATE: - rval += 'Private:'; - break; - } - - if(obj.tagClass === asn1.Class.UNIVERSAL) { - rval += obj.type; - - // known types - switch(obj.type) { - case asn1.Type.NONE: - rval += ' (None)'; - break; - case asn1.Type.BOOLEAN: - rval += ' (Boolean)'; - break; - case asn1.Type.INTEGER: - rval += ' (Integer)'; - break; - case asn1.Type.BITSTRING: - rval += ' (Bit string)'; - break; - case asn1.Type.OCTETSTRING: - rval += ' (Octet string)'; - break; - case asn1.Type.NULL: - rval += ' (Null)'; - break; - case asn1.Type.OID: - rval += ' (Object Identifier)'; - break; - case asn1.Type.ODESC: - rval += ' (Object Descriptor)'; - break; - case asn1.Type.EXTERNAL: - rval += ' (External or Instance of)'; - break; - case asn1.Type.REAL: - rval += ' (Real)'; - break; - case asn1.Type.ENUMERATED: - rval += ' (Enumerated)'; - break; - case asn1.Type.EMBEDDED: - rval += ' (Embedded PDV)'; - break; - case asn1.Type.UTF8: - rval += ' (UTF8)'; - break; - case asn1.Type.ROID: - rval += ' (Relative Object Identifier)'; - break; - case asn1.Type.SEQUENCE: - rval += ' (Sequence)'; - break; - case asn1.Type.SET: - rval += ' (Set)'; - break; - case asn1.Type.PRINTABLESTRING: - rval += ' (Printable String)'; - break; - case asn1.Type.IA5String: - rval += ' (IA5String (ASCII))'; - break; - case asn1.Type.UTCTIME: - rval += ' (UTC time)'; - break; - case asn1.Type.GENERALIZEDTIME: - rval += ' (Generalized time)'; - break; - case asn1.Type.BMPSTRING: - rval += ' (BMP String)'; - break; - } - } else { - rval += obj.type; - } - - rval += '\n'; - rval += indent + 'Constructed: ' + obj.constructed + '\n'; - - if(obj.composed) { - var subvalues = 0; - var sub = ''; - for(var i = 0; i < obj.value.length; ++i) { - if(obj.value[i] !== undefined) { - subvalues += 1; - sub += asn1.prettyPrint(obj.value[i], level + 1, indentation); - if((i + 1) < obj.value.length) { - sub += ','; - } - } - } - rval += indent + 'Sub values: ' + subvalues + sub; - } else { - rval += indent + 'Value: '; - if(obj.type === asn1.Type.OID) { - var oid = asn1.derToOid(obj.value); - rval += oid; - if(forge.pki && forge.pki.oids) { - if(oid in forge.pki.oids) { - rval += ' (' + forge.pki.oids[oid] + ') '; - } - } - } - if(obj.type === asn1.Type.INTEGER) { - try { - rval += asn1.derToInteger(obj.value); - } catch(ex) { - rval += '0x' + forge.util.bytesToHex(obj.value); - } - } else if(obj.type === asn1.Type.BITSTRING) { - // TODO: shift bits as needed to display without padding - if(obj.value.length > 1) { - // remove unused bits field - rval += '0x' + forge.util.bytesToHex(obj.value.slice(1)); - } else { - rval += '(none)'; - } - // show unused bit count - if(obj.value.length > 0) { - var unused = obj.value.charCodeAt(0); - if(unused == 1) { - rval += ' (1 unused bit shown)'; - } else if(unused > 1) { - rval += ' (' + unused + ' unused bits shown)'; - } - } - } else if(obj.type === asn1.Type.OCTETSTRING) { - if(!_nonLatinRegex.test(obj.value)) { - rval += '(' + obj.value + ') '; - } - rval += '0x' + forge.util.bytesToHex(obj.value); - } else if(obj.type === asn1.Type.UTF8) { - rval += forge.util.decodeUtf8(obj.value); - } else if(obj.type === asn1.Type.PRINTABLESTRING || - obj.type === asn1.Type.IA5String) { - rval += obj.value; - } else if(_nonLatinRegex.test(obj.value)) { - rval += '0x' + forge.util.bytesToHex(obj.value); - } else if(obj.value.length === 0) { - rval += '[null]'; - } else { - rval += obj.value; - } - } - - return rval; -}; diff --git a/node_modules/node-forge/lib/baseN.js b/node_modules/node-forge/lib/baseN.js deleted file mode 100644 index 824fa36d..00000000 --- a/node_modules/node-forge/lib/baseN.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Base-N/Base-X encoding/decoding functions. - * - * Original implementation from base-x: - * https://github.com/cryptocoinjs/base-x - * - * Which is MIT licensed: - * - * The MIT License (MIT) - * - * Copyright base-x contributors (c) 2016 - * - * 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. - */ -var api = {}; -module.exports = api; - -// baseN alphabet indexes -var _reverseAlphabets = {}; - -/** - * BaseN-encodes a Uint8Array using the given alphabet. - * - * @param input the Uint8Array to encode. - * @param maxline the maximum number of encoded characters per line to use, - * defaults to none. - * - * @return the baseN-encoded output string. - */ -api.encode = function(input, alphabet, maxline) { - if(typeof alphabet !== 'string') { - throw new TypeError('"alphabet" must be a string.'); - } - if(maxline !== undefined && typeof maxline !== 'number') { - throw new TypeError('"maxline" must be a number.'); - } - - var output = ''; - - if(!(input instanceof Uint8Array)) { - // assume forge byte buffer - output = _encodeWithByteBuffer(input, alphabet); - } else { - var i = 0; - var base = alphabet.length; - var first = alphabet.charAt(0); - var digits = [0]; - for(i = 0; i < input.length; ++i) { - for(var j = 0, carry = input[i]; j < digits.length; ++j) { - carry += digits[j] << 8; - digits[j] = carry % base; - carry = (carry / base) | 0; - } - - while(carry > 0) { - digits.push(carry % base); - carry = (carry / base) | 0; - } - } - - // deal with leading zeros - for(i = 0; input[i] === 0 && i < input.length - 1; ++i) { - output += first; - } - // convert digits to a string - for(i = digits.length - 1; i >= 0; --i) { - output += alphabet[digits[i]]; - } - } - - if(maxline) { - var regex = new RegExp('.{1,' + maxline + '}', 'g'); - output = output.match(regex).join('\r\n'); - } - - return output; -}; - -/** - * Decodes a baseN-encoded (using the given alphabet) string to a - * Uint8Array. - * - * @param input the baseN-encoded input string. - * - * @return the Uint8Array. - */ -api.decode = function(input, alphabet) { - if(typeof input !== 'string') { - throw new TypeError('"input" must be a string.'); - } - if(typeof alphabet !== 'string') { - throw new TypeError('"alphabet" must be a string.'); - } - - var table = _reverseAlphabets[alphabet]; - if(!table) { - // compute reverse alphabet - table = _reverseAlphabets[alphabet] = []; - for(var i = 0; i < alphabet.length; ++i) { - table[alphabet.charCodeAt(i)] = i; - } - } - - // remove whitespace characters - input = input.replace(/\s/g, ''); - - var base = alphabet.length; - var first = alphabet.charAt(0); - var bytes = [0]; - for(var i = 0; i < input.length; i++) { - var value = table[input.charCodeAt(i)]; - if(value === undefined) { - return; - } - - for(var j = 0, carry = value; j < bytes.length; ++j) { - carry += bytes[j] * base; - bytes[j] = carry & 0xff; - carry >>= 8; - } - - while(carry > 0) { - bytes.push(carry & 0xff); - carry >>= 8; - } - } - - // deal with leading zeros - for(var k = 0; input[k] === first && k < input.length - 1; ++k) { - bytes.push(0); - } - - if(typeof Buffer !== 'undefined') { - return Buffer.from(bytes.reverse()); - } - - return new Uint8Array(bytes.reverse()); -}; - -function _encodeWithByteBuffer(input, alphabet) { - var i = 0; - var base = alphabet.length; - var first = alphabet.charAt(0); - var digits = [0]; - for(i = 0; i < input.length(); ++i) { - for(var j = 0, carry = input.at(i); j < digits.length; ++j) { - carry += digits[j] << 8; - digits[j] = carry % base; - carry = (carry / base) | 0; - } - - while(carry > 0) { - digits.push(carry % base); - carry = (carry / base) | 0; - } - } - - var output = ''; - - // deal with leading zeros - for(i = 0; input.at(i) === 0 && i < input.length() - 1; ++i) { - output += first; - } - // convert digits to a string - for(i = digits.length - 1; i >= 0; --i) { - output += alphabet[digits[i]]; - } - - return output; -} diff --git a/node_modules/node-forge/lib/cipher.js b/node_modules/node-forge/lib/cipher.js deleted file mode 100644 index f2c36e65..00000000 --- a/node_modules/node-forge/lib/cipher.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Cipher base API. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -module.exports = forge.cipher = forge.cipher || {}; - -// registered algorithms -forge.cipher.algorithms = forge.cipher.algorithms || {}; - -/** - * Creates a cipher object that can be used to encrypt data using the given - * algorithm and key. The algorithm may be provided as a string value for a - * previously registered algorithm or it may be given as a cipher algorithm - * API object. - * - * @param algorithm the algorithm to use, either a string or an algorithm API - * object. - * @param key the key to use, as a binary-encoded string of bytes or a - * byte buffer. - * - * @return the cipher. - */ -forge.cipher.createCipher = function(algorithm, key) { - var api = algorithm; - if(typeof api === 'string') { - api = forge.cipher.getAlgorithm(api); - if(api) { - api = api(); - } - } - if(!api) { - throw new Error('Unsupported algorithm: ' + algorithm); - } - - // assume block cipher - return new forge.cipher.BlockCipher({ - algorithm: api, - key: key, - decrypt: false - }); -}; - -/** - * Creates a decipher object that can be used to decrypt data using the given - * algorithm and key. The algorithm may be provided as a string value for a - * previously registered algorithm or it may be given as a cipher algorithm - * API object. - * - * @param algorithm the algorithm to use, either a string or an algorithm API - * object. - * @param key the key to use, as a binary-encoded string of bytes or a - * byte buffer. - * - * @return the cipher. - */ -forge.cipher.createDecipher = function(algorithm, key) { - var api = algorithm; - if(typeof api === 'string') { - api = forge.cipher.getAlgorithm(api); - if(api) { - api = api(); - } - } - if(!api) { - throw new Error('Unsupported algorithm: ' + algorithm); - } - - // assume block cipher - return new forge.cipher.BlockCipher({ - algorithm: api, - key: key, - decrypt: true - }); -}; - -/** - * Registers an algorithm by name. If the name was already registered, the - * algorithm API object will be overwritten. - * - * @param name the name of the algorithm. - * @param algorithm the algorithm API object. - */ -forge.cipher.registerAlgorithm = function(name, algorithm) { - name = name.toUpperCase(); - forge.cipher.algorithms[name] = algorithm; -}; - -/** - * Gets a registered algorithm by name. - * - * @param name the name of the algorithm. - * - * @return the algorithm, if found, null if not. - */ -forge.cipher.getAlgorithm = function(name) { - name = name.toUpperCase(); - if(name in forge.cipher.algorithms) { - return forge.cipher.algorithms[name]; - } - return null; -}; - -var BlockCipher = forge.cipher.BlockCipher = function(options) { - this.algorithm = options.algorithm; - this.mode = this.algorithm.mode; - this.blockSize = this.mode.blockSize; - this._finish = false; - this._input = null; - this.output = null; - this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt; - this._decrypt = options.decrypt; - this.algorithm.initialize(options); -}; - -/** - * Starts or restarts the encryption or decryption process, whichever - * was previously configured. - * - * For non-GCM mode, the IV may be a binary-encoded string of bytes, an array - * of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in - * bytes, then it must be Nb (16) bytes in length. If the IV is given in as - * 32-bit integers, then it must be 4 integers long. - * - * Note: an IV is not required or used in ECB mode. - * - * For GCM-mode, the IV must be given as a binary-encoded string of bytes or - * a byte buffer. The number of bytes should be 12 (96 bits) as recommended - * by NIST SP-800-38D but another length may be given. - * - * @param options the options to use: - * iv the initialization vector to use as a binary-encoded string of - * bytes, null to reuse the last ciphered block from a previous - * update() (this "residue" method is for legacy support only). - * additionalData additional authentication data as a binary-encoded - * string of bytes, for 'GCM' mode, (default: none). - * tagLength desired length of authentication tag, in bits, for - * 'GCM' mode (0-128, default: 128). - * tag the authentication tag to check if decrypting, as a - * binary-encoded string of bytes. - * output the output the buffer to write to, null to create one. - */ -BlockCipher.prototype.start = function(options) { - options = options || {}; - var opts = {}; - for(var key in options) { - opts[key] = options[key]; - } - opts.decrypt = this._decrypt; - this._finish = false; - this._input = forge.util.createBuffer(); - this.output = options.output || forge.util.createBuffer(); - this.mode.start(opts); -}; - -/** - * Updates the next block according to the cipher mode. - * - * @param input the buffer to read from. - */ -BlockCipher.prototype.update = function(input) { - if(input) { - // input given, so empty it into the input buffer - this._input.putBuffer(input); - } - - // do cipher operation until it needs more input and not finished - while(!this._op.call(this.mode, this._input, this.output, this._finish) && - !this._finish) {} - - // free consumed memory from input buffer - this._input.compact(); -}; - -/** - * Finishes encrypting or decrypting. - * - * @param pad a padding function to use in CBC mode, null for default, - * signature(blockSize, buffer, decrypt). - * - * @return true if successful, false on error. - */ -BlockCipher.prototype.finish = function(pad) { - // backwards-compatibility w/deprecated padding API - // Note: will overwrite padding functions even after another start() call - if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) { - this.mode.pad = function(input) { - return pad(this.blockSize, input, false); - }; - this.mode.unpad = function(output) { - return pad(this.blockSize, output, true); - }; - } - - // build options for padding and afterFinish functions - var options = {}; - options.decrypt = this._decrypt; - - // get # of bytes that won't fill a block - options.overflow = this._input.length() % this.blockSize; - - if(!this._decrypt && this.mode.pad) { - if(!this.mode.pad(this._input, options)) { - return false; - } - } - - // do final update - this._finish = true; - this.update(); - - if(this._decrypt && this.mode.unpad) { - if(!this.mode.unpad(this.output, options)) { - return false; - } - } - - if(this.mode.afterFinish) { - if(!this.mode.afterFinish(this.output, options)) { - return false; - } - } - - return true; -}; diff --git a/node_modules/node-forge/lib/cipherModes.js b/node_modules/node-forge/lib/cipherModes.js deleted file mode 100644 index 339915cc..00000000 --- a/node_modules/node-forge/lib/cipherModes.js +++ /dev/null @@ -1,999 +0,0 @@ -/** - * Supported cipher modes. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -forge.cipher = forge.cipher || {}; - -// supported cipher modes -var modes = module.exports = forge.cipher.modes = forge.cipher.modes || {}; - -/** Electronic codebook (ECB) (Don't use this; it's not secure) **/ - -modes.ecb = function(options) { - options = options || {}; - this.name = 'ECB'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = new Array(this._ints); - this._outBlock = new Array(this._ints); -}; - -modes.ecb.prototype.start = function(options) {}; - -modes.ecb.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // write output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i]); - } -}; - -modes.ecb.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - } - - // decrypt block - this.cipher.decrypt(this._inBlock, this._outBlock); - - // write output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i]); - } -}; - -modes.ecb.prototype.pad = function(input, options) { - // add PKCS#7 padding to block (each pad byte is the - // value of the number of pad bytes) - var padding = (input.length() === this.blockSize ? - this.blockSize : (this.blockSize - input.length())); - input.fillWithByte(padding, padding); - return true; -}; - -modes.ecb.prototype.unpad = function(output, options) { - // check for error: input data not a multiple of blockSize - if(options.overflow > 0) { - return false; - } - - // ensure padding byte count is valid - var len = output.length(); - var count = output.at(len - 1); - if(count > (this.blockSize << 2)) { - return false; - } - - // trim off padding bytes - output.truncate(count); - return true; -}; - -/** Cipher-block Chaining (CBC) **/ - -modes.cbc = function(options) { - options = options || {}; - this.name = 'CBC'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = new Array(this._ints); - this._outBlock = new Array(this._ints); -}; - -modes.cbc.prototype.start = function(options) { - // Note: legacy support for using IV residue (has security flaws) - // if IV is null, reuse block from previous processing - if(options.iv === null) { - // must have a previous block - if(!this._prev) { - throw new Error('Invalid IV parameter.'); - } - this._iv = this._prev.slice(0); - } else if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } else { - // save IV as "previous" block - this._iv = transformIV(options.iv, this.blockSize); - this._prev = this._iv.slice(0); - } -}; - -modes.cbc.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - // CBC XOR's IV (or previous block) with plaintext - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._prev[i] ^ input.getInt32(); - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // write output, save previous block - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i]); - } - this._prev = this._outBlock; -}; - -modes.cbc.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - } - - // decrypt block - this.cipher.decrypt(this._inBlock, this._outBlock); - - // write output, save previous ciphered block - // CBC XOR's IV (or previous block) with ciphertext - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._prev[i] ^ this._outBlock[i]); - } - this._prev = this._inBlock.slice(0); -}; - -modes.cbc.prototype.pad = function(input, options) { - // add PKCS#7 padding to block (each pad byte is the - // value of the number of pad bytes) - var padding = (input.length() === this.blockSize ? - this.blockSize : (this.blockSize - input.length())); - input.fillWithByte(padding, padding); - return true; -}; - -modes.cbc.prototype.unpad = function(output, options) { - // check for error: input data not a multiple of blockSize - if(options.overflow > 0) { - return false; - } - - // ensure padding byte count is valid - var len = output.length(); - var count = output.at(len - 1); - if(count > (this.blockSize << 2)) { - return false; - } - - // trim off padding bytes - output.truncate(count); - return true; -}; - -/** Cipher feedback (CFB) **/ - -modes.cfb = function(options) { - options = options || {}; - this.name = 'CFB'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = null; - this._outBlock = new Array(this._ints); - this._partialBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; -}; - -modes.cfb.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // use IV as first input - this._iv = transformIV(options.iv, this.blockSize); - this._inBlock = this._iv.slice(0); - this._partialBytes = 0; -}; - -modes.cfb.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output, write input as output - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32() ^ this._outBlock[i]; - output.putInt32(this._inBlock[i]); - } - return; - } - - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output, write input as partial output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialBlock[i] = input.getInt32() ^ this._outBlock[i]; - this._partialOutput.putInt32(this._partialBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } else { - // block complete, update input block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._partialBlock[i]; - } - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; -}; - -modes.cfb.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block (CFB always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output, write input as output - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - output.putInt32(this._inBlock[i] ^ this._outBlock[i]); - } - return; - } - - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output, write input as partial output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialBlock[i] = input.getInt32(); - this._partialOutput.putInt32(this._partialBlock[i] ^ this._outBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } else { - // block complete, update input block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._partialBlock[i]; - } - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; -}; - -/** Output feedback (OFB) **/ - -modes.ofb = function(options) { - options = options || {}; - this.name = 'OFB'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = null; - this._outBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; -}; - -modes.ofb.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // use IV as first input - this._iv = transformIV(options.iv, this.blockSize); - this._inBlock = this._iv.slice(0); - this._partialBytes = 0; -}; - -modes.ofb.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(input.length() === 0) { - return true; - } - - // encrypt block (OFB always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output and update next input - for(var i = 0; i < this._ints; ++i) { - output.putInt32(input.getInt32() ^ this._outBlock[i]); - this._inBlock[i] = this._outBlock[i]; - } - return; - } - - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } else { - // block complete, update input block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._outBlock[i]; - } - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; -}; - -modes.ofb.prototype.decrypt = modes.ofb.prototype.encrypt; - -/** Counter (CTR) **/ - -modes.ctr = function(options) { - options = options || {}; - this.name = 'CTR'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = null; - this._outBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; -}; - -modes.ctr.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // use IV as first input - this._iv = transformIV(options.iv, this.blockSize); - this._inBlock = this._iv.slice(0); - this._partialBytes = 0; -}; - -modes.ctr.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block (CTR always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(input.getInt32() ^ this._outBlock[i]); - } - } else { - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; - } - - // block complete, increment counter (input block) - inc32(this._inBlock); -}; - -modes.ctr.prototype.decrypt = modes.ctr.prototype.encrypt; - -/** Galois/Counter Mode (GCM) **/ - -modes.gcm = function(options) { - options = options || {}; - this.name = 'GCM'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = new Array(this._ints); - this._outBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; - - // R is actually this value concatenated with 120 more zero bits, but - // we only XOR against R so the other zeros have no effect -- we just - // apply this value to the first integer in a block - this._R = 0xE1000000; -}; - -modes.gcm.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // ensure IV is a byte buffer - var iv = forge.util.createBuffer(options.iv); - - // no ciphered data processed yet - this._cipherLength = 0; - - // default additional data is none - var additionalData; - if('additionalData' in options) { - additionalData = forge.util.createBuffer(options.additionalData); - } else { - additionalData = forge.util.createBuffer(); - } - - // default tag length is 128 bits - if('tagLength' in options) { - this._tagLength = options.tagLength; - } else { - this._tagLength = 128; - } - - // if tag is given, ensure tag matches tag length - this._tag = null; - if(options.decrypt) { - // save tag to check later - this._tag = forge.util.createBuffer(options.tag).getBytes(); - if(this._tag.length !== (this._tagLength / 8)) { - throw new Error('Authentication tag does not match tag length.'); - } - } - - // create tmp storage for hash calculation - this._hashBlock = new Array(this._ints); - - // no tag generated yet - this.tag = null; - - // generate hash subkey - // (apply block cipher to "zero" block) - this._hashSubkey = new Array(this._ints); - this.cipher.encrypt([0, 0, 0, 0], this._hashSubkey); - - // generate table M - // use 4-bit tables (32 component decomposition of a 16 byte value) - // 8-bit tables take more space and are known to have security - // vulnerabilities (in native implementations) - this.componentBits = 4; - this._m = this.generateHashTable(this._hashSubkey, this.componentBits); - - // Note: support IV length different from 96 bits? (only supporting - // 96 bits is recommended by NIST SP-800-38D) - // generate J_0 - var ivLength = iv.length(); - if(ivLength === 12) { - // 96-bit IV - this._j0 = [iv.getInt32(), iv.getInt32(), iv.getInt32(), 1]; - } else { - // IV is NOT 96-bits - this._j0 = [0, 0, 0, 0]; - while(iv.length() > 0) { - this._j0 = this.ghash( - this._hashSubkey, this._j0, - [iv.getInt32(), iv.getInt32(), iv.getInt32(), iv.getInt32()]); - } - this._j0 = this.ghash( - this._hashSubkey, this._j0, [0, 0].concat(from64To32(ivLength * 8))); - } - - // generate ICB (initial counter block) - this._inBlock = this._j0.slice(0); - inc32(this._inBlock); - this._partialBytes = 0; - - // consume authentication data - additionalData = forge.util.createBuffer(additionalData); - // save additional data length as a BE 64-bit number - this._aDataLength = from64To32(additionalData.length() * 8); - // pad additional data to 128 bit (16 byte) block size - var overflow = additionalData.length() % this.blockSize; - if(overflow) { - additionalData.fillWithByte(0, this.blockSize - overflow); - } - this._s = [0, 0, 0, 0]; - while(additionalData.length() > 0) { - this._s = this.ghash(this._hashSubkey, this._s, [ - additionalData.getInt32(), - additionalData.getInt32(), - additionalData.getInt32(), - additionalData.getInt32() - ]); - } -}; - -modes.gcm.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i] ^= input.getInt32()); - } - this._cipherLength += this.blockSize; - } else { - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); - } - - if(partialBytes <= 0 || finish) { - // handle overflow prior to hashing - if(finish) { - // get block overflow - var overflow = inputLength % this.blockSize; - this._cipherLength += overflow; - // truncate for hash function - this._partialOutput.truncate(this.blockSize - overflow); - } else { - this._cipherLength += this.blockSize; - } - - // get output block for hashing - for(var i = 0; i < this._ints; ++i) { - this._outBlock[i] = this._partialOutput.getInt32(); - } - this._partialOutput.read -= this.blockSize; - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - // block still incomplete, restore input buffer, get partial output, - // and return early - input.read -= this.blockSize; - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; - } - - // update hash block S - this._s = this.ghash(this._hashSubkey, this._s, this._outBlock); - - // increment counter (input block) - inc32(this._inBlock); -}; - -modes.gcm.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - var inputLength = input.length(); - if(inputLength < this.blockSize && !(finish && inputLength > 0)) { - return true; - } - - // encrypt block (GCM always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // increment counter (input block) - inc32(this._inBlock); - - // update hash block S - this._hashBlock[0] = input.getInt32(); - this._hashBlock[1] = input.getInt32(); - this._hashBlock[2] = input.getInt32(); - this._hashBlock[3] = input.getInt32(); - this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock); - - // XOR hash input with output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i] ^ this._hashBlock[i]); - } - - // increment cipher data length - if(inputLength < this.blockSize) { - this._cipherLength += inputLength % this.blockSize; - } else { - this._cipherLength += this.blockSize; - } -}; - -modes.gcm.prototype.afterFinish = function(output, options) { - var rval = true; - - // handle overflow - if(options.decrypt && options.overflow) { - output.truncate(this.blockSize - options.overflow); - } - - // handle authentication tag - this.tag = forge.util.createBuffer(); - - // concatenate additional data length with cipher length - var lengths = this._aDataLength.concat(from64To32(this._cipherLength * 8)); - - // include lengths in hash - this._s = this.ghash(this._hashSubkey, this._s, lengths); - - // do GCTR(J_0, S) - var tag = []; - this.cipher.encrypt(this._j0, tag); - for(var i = 0; i < this._ints; ++i) { - this.tag.putInt32(this._s[i] ^ tag[i]); - } - - // trim tag to length - this.tag.truncate(this.tag.length() % (this._tagLength / 8)); - - // check authentication tag - if(options.decrypt && this.tag.bytes() !== this._tag) { - rval = false; - } - - return rval; -}; - -/** - * See NIST SP-800-38D 6.3 (Algorithm 1). This function performs Galois - * field multiplication. The field, GF(2^128), is defined by the polynomial: - * - * x^128 + x^7 + x^2 + x + 1 - * - * Which is represented in little-endian binary form as: 11100001 (0xe1). When - * the value of a coefficient is 1, a bit is set. The value R, is the - * concatenation of this value and 120 zero bits, yielding a 128-bit value - * which matches the block size. - * - * This function will multiply two elements (vectors of bytes), X and Y, in - * the field GF(2^128). The result is initialized to zero. For each bit of - * X (out of 128), x_i, if x_i is set, then the result is multiplied (XOR'd) - * by the current value of Y. For each bit, the value of Y will be raised by - * a power of x (multiplied by the polynomial x). This can be achieved by - * shifting Y once to the right. If the current value of Y, prior to being - * multiplied by x, has 0 as its LSB, then it is a 127th degree polynomial. - * Otherwise, we must divide by R after shifting to find the remainder. - * - * @param x the first block to multiply by the second. - * @param y the second block to multiply by the first. - * - * @return the block result of the multiplication. - */ -modes.gcm.prototype.multiply = function(x, y) { - var z_i = [0, 0, 0, 0]; - var v_i = y.slice(0); - - // calculate Z_128 (block has 128 bits) - for(var i = 0; i < 128; ++i) { - // if x_i is 0, Z_{i+1} = Z_i (unchanged) - // else Z_{i+1} = Z_i ^ V_i - // get x_i by finding 32-bit int position, then left shift 1 by remainder - var x_i = x[(i / 32) | 0] & (1 << (31 - i % 32)); - if(x_i) { - z_i[0] ^= v_i[0]; - z_i[1] ^= v_i[1]; - z_i[2] ^= v_i[2]; - z_i[3] ^= v_i[3]; - } - - // if LSB(V_i) is 1, V_i = V_i >> 1 - // else V_i = (V_i >> 1) ^ R - this.pow(v_i, v_i); - } - - return z_i; -}; - -modes.gcm.prototype.pow = function(x, out) { - // if LSB(x) is 1, x = x >>> 1 - // else x = (x >>> 1) ^ R - var lsb = x[3] & 1; - - // always do x >>> 1: - // starting with the rightmost integer, shift each integer to the right - // one bit, pulling in the bit from the integer to the left as its top - // most bit (do this for the last 3 integers) - for(var i = 3; i > 0; --i) { - out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31); - } - // shift the first integer normally - out[0] = x[0] >>> 1; - - // if lsb was not set, then polynomial had a degree of 127 and doesn't - // need to divided; otherwise, XOR with R to find the remainder; we only - // need to XOR the first integer since R technically ends w/120 zero bits - if(lsb) { - out[0] ^= this._R; - } -}; - -modes.gcm.prototype.tableMultiply = function(x) { - // assumes 4-bit tables are used - var z = [0, 0, 0, 0]; - for(var i = 0; i < 32; ++i) { - var idx = (i / 8) | 0; - var x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF; - var ah = this._m[i][x_i]; - z[0] ^= ah[0]; - z[1] ^= ah[1]; - z[2] ^= ah[2]; - z[3] ^= ah[3]; - } - return z; -}; - -/** - * A continuing version of the GHASH algorithm that operates on a single - * block. The hash block, last hash value (Ym) and the new block to hash - * are given. - * - * @param h the hash block. - * @param y the previous value for Ym, use [0, 0, 0, 0] for a new hash. - * @param x the block to hash. - * - * @return the hashed value (Ym). - */ -modes.gcm.prototype.ghash = function(h, y, x) { - y[0] ^= x[0]; - y[1] ^= x[1]; - y[2] ^= x[2]; - y[3] ^= x[3]; - return this.tableMultiply(y); - //return this.multiply(y, h); -}; - -/** - * Precomputes a table for multiplying against the hash subkey. This - * mechanism provides a substantial speed increase over multiplication - * performed without a table. The table-based multiplication this table is - * for solves X * H by multiplying each component of X by H and then - * composing the results together using XOR. - * - * This function can be used to generate tables with different bit sizes - * for the components, however, this implementation assumes there are - * 32 components of X (which is a 16 byte vector), therefore each component - * takes 4-bits (so the table is constructed with bits=4). - * - * @param h the hash subkey. - * @param bits the bit size for a component. - */ -modes.gcm.prototype.generateHashTable = function(h, bits) { - // TODO: There are further optimizations that would use only the - // first table M_0 (or some variant) along with a remainder table; - // this can be explored in the future - var multiplier = 8 / bits; - var perInt = 4 * multiplier; - var size = 16 * multiplier; - var m = new Array(size); - for(var i = 0; i < size; ++i) { - var tmp = [0, 0, 0, 0]; - var idx = (i / perInt) | 0; - var shft = ((perInt - 1 - (i % perInt)) * bits); - tmp[idx] = (1 << (bits - 1)) << shft; - m[i] = this.generateSubHashTable(this.multiply(tmp, h), bits); - } - return m; -}; - -/** - * Generates a table for multiplying against the hash subkey for one - * particular component (out of all possible component values). - * - * @param mid the pre-multiplied value for the middle key of the table. - * @param bits the bit size for a component. - */ -modes.gcm.prototype.generateSubHashTable = function(mid, bits) { - // compute the table quickly by minimizing the number of - // POW operations -- they only need to be performed for powers of 2, - // all other entries can be composed from those powers using XOR - var size = 1 << bits; - var half = size >>> 1; - var m = new Array(size); - m[half] = mid.slice(0); - var i = half >>> 1; - while(i > 0) { - // raise m0[2 * i] and store in m0[i] - this.pow(m[2 * i], m[i] = []); - i >>= 1; - } - i = 2; - while(i < half) { - for(var j = 1; j < i; ++j) { - var m_i = m[i]; - var m_j = m[j]; - m[i + j] = [ - m_i[0] ^ m_j[0], - m_i[1] ^ m_j[1], - m_i[2] ^ m_j[2], - m_i[3] ^ m_j[3] - ]; - } - i *= 2; - } - m[0] = [0, 0, 0, 0]; - /* Note: We could avoid storing these by doing composition during multiply - calculate top half using composition by speed is preferred. */ - for(i = half + 1; i < size; ++i) { - var c = m[i ^ half]; - m[i] = [mid[0] ^ c[0], mid[1] ^ c[1], mid[2] ^ c[2], mid[3] ^ c[3]]; - } - return m; -}; - -/** Utility functions */ - -function transformIV(iv, blockSize) { - if(typeof iv === 'string') { - // convert iv string into byte buffer - iv = forge.util.createBuffer(iv); - } - - if(forge.util.isArray(iv) && iv.length > 4) { - // convert iv byte array into byte buffer - var tmp = iv; - iv = forge.util.createBuffer(); - for(var i = 0; i < tmp.length; ++i) { - iv.putByte(tmp[i]); - } - } - - if(iv.length() < blockSize) { - throw new Error( - 'Invalid IV length; got ' + iv.length() + - ' bytes and expected ' + blockSize + ' bytes.'); - } - - if(!forge.util.isArray(iv)) { - // convert iv byte buffer into 32-bit integer array - var ints = []; - var blocks = blockSize / 4; - for(var i = 0; i < blocks; ++i) { - ints.push(iv.getInt32()); - } - iv = ints; - } - - return iv; -} - -function inc32(block) { - // increment last 32 bits of block only - block[block.length - 1] = (block[block.length - 1] + 1) & 0xFFFFFFFF; -} - -function from64To32(num) { - // convert 64-bit number to two BE Int32s - return [(num / 0x100000000) | 0, num & 0xFFFFFFFF]; -} diff --git a/node_modules/node-forge/lib/debug.js b/node_modules/node-forge/lib/debug.js deleted file mode 100644 index 26756350..00000000 --- a/node_modules/node-forge/lib/debug.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Debugging support for web applications. - * - * @author David I. Lehn - * - * Copyright 2008-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); - -/* DEBUG API */ -module.exports = forge.debug = forge.debug || {}; - -// Private storage for debugging. -// Useful to expose data that is otherwise unviewable behind closures. -// NOTE: remember that this can hold references to data and cause leaks! -// format is "forge._debug.. = data" -// Example: -// (function() { -// var cat = 'forge.test.Test'; // debugging category -// var sState = {...}; // local state -// forge.debug.set(cat, 'sState', sState); -// })(); -forge.debug.storage = {}; - -/** - * Gets debug data. Omit name for all cat data Omit name and cat for - * all data. - * - * @param cat name of debugging category. - * @param name name of data to get (optional). - * @return object with requested debug data or undefined. - */ -forge.debug.get = function(cat, name) { - var rval; - if(typeof(cat) === 'undefined') { - rval = forge.debug.storage; - } else if(cat in forge.debug.storage) { - if(typeof(name) === 'undefined') { - rval = forge.debug.storage[cat]; - } else { - rval = forge.debug.storage[cat][name]; - } - } - return rval; -}; - -/** - * Sets debug data. - * - * @param cat name of debugging category. - * @param name name of data to set. - * @param data data to set. - */ -forge.debug.set = function(cat, name, data) { - if(!(cat in forge.debug.storage)) { - forge.debug.storage[cat] = {}; - } - forge.debug.storage[cat][name] = data; -}; - -/** - * Clears debug data. Omit name for all cat data. Omit name and cat for - * all data. - * - * @param cat name of debugging category. - * @param name name of data to clear or omit to clear entire category. - */ -forge.debug.clear = function(cat, name) { - if(typeof(cat) === 'undefined') { - forge.debug.storage = {}; - } else if(cat in forge.debug.storage) { - if(typeof(name) === 'undefined') { - delete forge.debug.storage[cat]; - } else { - delete forge.debug.storage[cat][name]; - } - } -}; diff --git a/node_modules/node-forge/lib/des.js b/node_modules/node-forge/lib/des.js deleted file mode 100644 index ed8239aa..00000000 --- a/node_modules/node-forge/lib/des.js +++ /dev/null @@ -1,496 +0,0 @@ -/** - * DES (Data Encryption Standard) implementation. - * - * This implementation supports DES as well as 3DES-EDE in ECB and CBC mode. - * It is based on the BSD-licensed implementation by Paul Tero: - * - * Paul Tero, July 2001 - * http://www.tero.co.uk/des/ - * - * Optimised for performance with large blocks by - * Michael Hayworth, November 2001 - * http://www.netdealing.com - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @author Stefan Siegl - * @author Dave Longley - * - * Copyright (c) 2012 Stefan Siegl - * Copyright (c) 2012-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./cipher'); -require('./cipherModes'); -require('./util'); - -/* DES API */ -module.exports = forge.des = forge.des || {}; - -/** - * Deprecated. Instead, use: - * - * var cipher = forge.cipher.createCipher('DES-', key); - * cipher.start({iv: iv}); - * - * Creates an DES cipher object to encrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as binary-encoded strings of bytes or - * byte buffers. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC' if IV is - * given, 'ECB' if null). - * - * @return the cipher. - */ -forge.des.startEncrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: false, - mode: mode || (iv === null ? 'ECB' : 'CBC') - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var cipher = forge.cipher.createCipher('DES-', key); - * - * Creates an DES cipher object to encrypt data using the given symmetric key. - * - * The key may be given as a binary-encoded string of bytes or a byte buffer. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.des.createEncryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: false, - mode: mode - }); -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('DES-', key); - * decipher.start({iv: iv}); - * - * Creates an DES cipher object to decrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as binary-encoded strings of bytes or - * byte buffers. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC' if IV is - * given, 'ECB' if null). - * - * @return the cipher. - */ -forge.des.startDecrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: true, - mode: mode || (iv === null ? 'ECB' : 'CBC') - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('DES-', key); - * - * Creates an DES cipher object to decrypt data using the given symmetric key. - * - * The key may be given as a binary-encoded string of bytes or a byte buffer. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.des.createDecryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: true, - mode: mode - }); -}; - -/** - * Creates a new DES cipher algorithm object. - * - * @param name the name of the algorithm. - * @param mode the mode factory function. - * - * @return the DES algorithm object. - */ -forge.des.Algorithm = function(name, mode) { - var self = this; - self.name = name; - self.mode = new mode({ - blockSize: 8, - cipher: { - encrypt: function(inBlock, outBlock) { - return _updateBlock(self._keys, inBlock, outBlock, false); - }, - decrypt: function(inBlock, outBlock) { - return _updateBlock(self._keys, inBlock, outBlock, true); - } - } - }); - self._init = false; -}; - -/** - * Initializes this DES algorithm by expanding its key. - * - * @param options the options to use. - * key the key to use with this algorithm. - * decrypt true if the algorithm should be initialized for decryption, - * false for encryption. - */ -forge.des.Algorithm.prototype.initialize = function(options) { - if(this._init) { - return; - } - - var key = forge.util.createBuffer(options.key); - if(this.name.indexOf('3DES') === 0) { - if(key.length() !== 24) { - throw new Error('Invalid Triple-DES key size: ' + key.length() * 8); - } - } - - // do key expansion to 16 or 48 subkeys (single or triple DES) - this._keys = _createKeys(key); - this._init = true; -}; - -/** Register DES algorithms **/ - -registerAlgorithm('DES-ECB', forge.cipher.modes.ecb); -registerAlgorithm('DES-CBC', forge.cipher.modes.cbc); -registerAlgorithm('DES-CFB', forge.cipher.modes.cfb); -registerAlgorithm('DES-OFB', forge.cipher.modes.ofb); -registerAlgorithm('DES-CTR', forge.cipher.modes.ctr); - -registerAlgorithm('3DES-ECB', forge.cipher.modes.ecb); -registerAlgorithm('3DES-CBC', forge.cipher.modes.cbc); -registerAlgorithm('3DES-CFB', forge.cipher.modes.cfb); -registerAlgorithm('3DES-OFB', forge.cipher.modes.ofb); -registerAlgorithm('3DES-CTR', forge.cipher.modes.ctr); - -function registerAlgorithm(name, mode) { - var factory = function() { - return new forge.des.Algorithm(name, mode); - }; - forge.cipher.registerAlgorithm(name, factory); -} - -/** DES implementation **/ - -var spfunction1 = [0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004]; -var spfunction2 = [-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000]; -var spfunction3 = [0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200]; -var spfunction4 = [0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080]; -var spfunction5 = [0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100]; -var spfunction6 = [0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010]; -var spfunction7 = [0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002]; -var spfunction8 = [0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000]; - -/** - * Create necessary sub keys. - * - * @param key the 64-bit or 192-bit key. - * - * @return the expanded keys. - */ -function _createKeys(key) { - var pc2bytes0 = [0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204], - pc2bytes1 = [0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101], - pc2bytes2 = [0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808], - pc2bytes3 = [0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000], - pc2bytes4 = [0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010], - pc2bytes5 = [0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420], - pc2bytes6 = [0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002], - pc2bytes7 = [0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800], - pc2bytes8 = [0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002], - pc2bytes9 = [0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408], - pc2bytes10 = [0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020], - pc2bytes11 = [0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200], - pc2bytes12 = [0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010], - pc2bytes13 = [0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105]; - - // how many iterations (1 for des, 3 for triple des) - // changed by Paul 16/6/2007 to use Triple DES for 9+ byte keys - var iterations = key.length() > 8 ? 3 : 1; - - // stores the return keys - var keys = []; - - // now define the left shifts which need to be done - var shifts = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0]; - - var n = 0, tmp; - for(var j = 0; j < iterations; j++) { - var left = key.getInt32(); - var right = key.getInt32(); - - tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; - right ^= tmp; - left ^= (tmp << 4); - - tmp = ((right >>> -16) ^ left) & 0x0000ffff; - left ^= tmp; - right ^= (tmp << -16); - - tmp = ((left >>> 2) ^ right) & 0x33333333; - right ^= tmp; - left ^= (tmp << 2); - - tmp = ((right >>> -16) ^ left) & 0x0000ffff; - left ^= tmp; - right ^= (tmp << -16); - - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - tmp = ((right >>> 8) ^ left) & 0x00ff00ff; - left ^= tmp; - right ^= (tmp << 8); - - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - // right needs to be shifted and OR'd with last four bits of left - tmp = (left << 8) | ((right >>> 20) & 0x000000f0); - - // left needs to be put upside down - left = ((right << 24) | ((right << 8) & 0xff0000) | - ((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0)); - right = tmp; - - // now go through and perform these shifts on the left and right keys - for(var i = 0; i < shifts.length; ++i) { - //shift the keys either one or two bits to the left - if(shifts[i]) { - left = (left << 2) | (left >>> 26); - right = (right << 2) | (right >>> 26); - } else { - left = (left << 1) | (left >>> 27); - right = (right << 1) | (right >>> 27); - } - left &= -0xf; - right &= -0xf; - - // now apply PC-2, in such a way that E is easier when encrypting or - // decrypting this conversion will look like PC-2 except only the last 6 - // bits of each byte are used rather than 48 consecutive bits and the - // order of lines will be according to how the S selection functions will - // be applied: S2, S4, S6, S8, S1, S3, S5, S7 - var lefttmp = ( - pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf] | - pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf] | - pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf] | - pc2bytes6[(left >>> 4) & 0xf]); - var righttmp = ( - pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf] | - pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf] | - pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf] | - pc2bytes13[(right >>> 4) & 0xf]); - tmp = ((righttmp >>> 16) ^ lefttmp) & 0x0000ffff; - keys[n++] = lefttmp ^ tmp; - keys[n++] = righttmp ^ (tmp << 16); - } - } - - return keys; -} - -/** - * Updates a single block (1 byte) using DES. The update will either - * encrypt or decrypt the block. - * - * @param keys the expanded keys. - * @param input the input block (an array of 32-bit words). - * @param output the updated output block. - * @param decrypt true to decrypt the block, false to encrypt it. - */ -function _updateBlock(keys, input, output, decrypt) { - // set up loops for single or triple DES - var iterations = keys.length === 32 ? 3 : 9; - var looping; - if(iterations === 3) { - looping = decrypt ? [30, -2, -2] : [0, 32, 2]; - } else { - looping = (decrypt ? - [94, 62, -2, 32, 64, 2, 30, -2, -2] : - [0, 32, 2, 62, 30, -2, 64, 96, 2]); - } - - var tmp; - - var left = input[0]; - var right = input[1]; - - // first each 64 bit chunk of the message must be permuted according to IP - tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; - right ^= tmp; - left ^= (tmp << 4); - - tmp = ((left >>> 16) ^ right) & 0x0000ffff; - right ^= tmp; - left ^= (tmp << 16); - - tmp = ((right >>> 2) ^ left) & 0x33333333; - left ^= tmp; - right ^= (tmp << 2); - - tmp = ((right >>> 8) ^ left) & 0x00ff00ff; - left ^= tmp; - right ^= (tmp << 8); - - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - // rotate left 1 bit - left = ((left << 1) | (left >>> 31)); - right = ((right << 1) | (right >>> 31)); - - for(var j = 0; j < iterations; j += 3) { - var endloop = looping[j + 1]; - var loopinc = looping[j + 2]; - - // now go through and perform the encryption or decryption - for(var i = looping[j]; i != endloop; i += loopinc) { - var right1 = right ^ keys[i]; - var right2 = ((right >>> 4) | (right << 28)) ^ keys[i + 1]; - - // passing these bytes through the S selection functions - tmp = left; - left = right; - right = tmp ^ ( - spfunction2[(right1 >>> 24) & 0x3f] | - spfunction4[(right1 >>> 16) & 0x3f] | - spfunction6[(right1 >>> 8) & 0x3f] | - spfunction8[right1 & 0x3f] | - spfunction1[(right2 >>> 24) & 0x3f] | - spfunction3[(right2 >>> 16) & 0x3f] | - spfunction5[(right2 >>> 8) & 0x3f] | - spfunction7[right2 & 0x3f]); - } - // unreverse left and right - tmp = left; - left = right; - right = tmp; - } - - // rotate right 1 bit - left = ((left >>> 1) | (left << 31)); - right = ((right >>> 1) | (right << 31)); - - // now perform IP-1, which is IP in the opposite direction - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - tmp = ((right >>> 8) ^ left) & 0x00ff00ff; - left ^= tmp; - right ^= (tmp << 8); - - tmp = ((right >>> 2) ^ left) & 0x33333333; - left ^= tmp; - right ^= (tmp << 2); - - tmp = ((left >>> 16) ^ right) & 0x0000ffff; - right ^= tmp; - left ^= (tmp << 16); - - tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; - right ^= tmp; - left ^= (tmp << 4); - - output[0] = left; - output[1] = right; -} - -/** - * Deprecated. Instead, use: - * - * forge.cipher.createCipher('DES-', key); - * forge.cipher.createDecipher('DES-', key); - * - * Creates a deprecated DES cipher object. This object's mode will default to - * CBC (cipher-block-chaining). - * - * The key may be given as a binary-encoded string of bytes or a byte buffer. - * - * @param options the options to use. - * key the symmetric key to use (64 or 192 bits). - * output the buffer to write to. - * decrypt true for decryption, false for encryption. - * mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -function _createCipher(options) { - options = options || {}; - var mode = (options.mode || 'CBC').toUpperCase(); - var algorithm = 'DES-' + mode; - - var cipher; - if(options.decrypt) { - cipher = forge.cipher.createDecipher(algorithm, options.key); - } else { - cipher = forge.cipher.createCipher(algorithm, options.key); - } - - // backwards compatible start API - var start = cipher.start; - cipher.start = function(iv, options) { - // backwards compatibility: support second arg as output buffer - var output = null; - if(options instanceof forge.util.ByteBuffer) { - output = options; - options = {}; - } - options = options || {}; - options.output = output; - options.iv = iv; - start.call(cipher, options); - }; - - return cipher; -} diff --git a/node_modules/node-forge/lib/ed25519.js b/node_modules/node-forge/lib/ed25519.js deleted file mode 100644 index f3e6faaa..00000000 --- a/node_modules/node-forge/lib/ed25519.js +++ /dev/null @@ -1,1072 +0,0 @@ -/** - * JavaScript implementation of Ed25519. - * - * Copyright (c) 2017-2019 Digital Bazaar, Inc. - * - * This implementation is based on the most excellent TweetNaCl which is - * in the public domain. Many thanks to its contributors: - * - * https://github.com/dchest/tweetnacl-js - */ -var forge = require('./forge'); -require('./jsbn'); -require('./random'); -require('./sha512'); -require('./util'); -var asn1Validator = require('./asn1-validator'); -var publicKeyValidator = asn1Validator.publicKeyValidator; -var privateKeyValidator = asn1Validator.privateKeyValidator; - -if(typeof BigInteger === 'undefined') { - var BigInteger = forge.jsbn.BigInteger; -} - -var ByteBuffer = forge.util.ByteBuffer; -var NativeBuffer = typeof Buffer === 'undefined' ? Uint8Array : Buffer; - -/* - * Ed25519 algorithms, see RFC 8032: - * https://tools.ietf.org/html/rfc8032 - */ -forge.pki = forge.pki || {}; -module.exports = forge.pki.ed25519 = forge.ed25519 = forge.ed25519 || {}; -var ed25519 = forge.ed25519; - -ed25519.constants = {}; -ed25519.constants.PUBLIC_KEY_BYTE_LENGTH = 32; -ed25519.constants.PRIVATE_KEY_BYTE_LENGTH = 64; -ed25519.constants.SEED_BYTE_LENGTH = 32; -ed25519.constants.SIGN_BYTE_LENGTH = 64; -ed25519.constants.HASH_BYTE_LENGTH = 64; - -ed25519.generateKeyPair = function(options) { - options = options || {}; - var seed = options.seed; - if(seed === undefined) { - // generate seed - seed = forge.random.getBytesSync(ed25519.constants.SEED_BYTE_LENGTH); - } else if(typeof seed === 'string') { - if(seed.length !== ed25519.constants.SEED_BYTE_LENGTH) { - throw new TypeError( - '"seed" must be ' + ed25519.constants.SEED_BYTE_LENGTH + - ' bytes in length.'); - } - } else if(!(seed instanceof Uint8Array)) { - throw new TypeError( - '"seed" must be a node.js Buffer, Uint8Array, or a binary string.'); - } - - seed = messageToNativeBuffer({message: seed, encoding: 'binary'}); - - var pk = new NativeBuffer(ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); - var sk = new NativeBuffer(ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); - for(var i = 0; i < 32; ++i) { - sk[i] = seed[i]; - } - crypto_sign_keypair(pk, sk); - return {publicKey: pk, privateKey: sk}; -}; - -/** - * Converts a private key from a RFC8410 ASN.1 encoding. - * - * @param obj - The asn1 representation of a private key. - * - * @returns {Object} keyInfo - The key information. - * @returns {Buffer|Uint8Array} keyInfo.privateKeyBytes - 32 private key bytes. - */ -ed25519.privateKeyFromAsn1 = function(obj) { - var capture = {}; - var errors = []; - var valid = forge.asn1.validate(obj, privateKeyValidator, capture, errors); - if(!valid) { - var error = new Error('Invalid Key.'); - error.errors = errors; - throw error; - } - var oid = forge.asn1.derToOid(capture.privateKeyOid); - var ed25519Oid = forge.oids.EdDSA25519; - if(oid !== ed25519Oid) { - throw new Error('Invalid OID "' + oid + '"; OID must be "' + - ed25519Oid + '".'); - } - var privateKey = capture.privateKey; - // manually extract the private key bytes from nested octet string, see FIXME: - // https://github.com/digitalbazaar/forge/blob/master/lib/asn1.js#L542 - var privateKeyBytes = messageToNativeBuffer({ - message: forge.asn1.fromDer(privateKey).value, - encoding: 'binary' - }); - // TODO: RFC8410 specifies a format for encoding the public key bytes along - // with the private key bytes. `publicKeyBytes` can be returned in the - // future. https://tools.ietf.org/html/rfc8410#section-10.3 - return {privateKeyBytes: privateKeyBytes}; -}; - -/** - * Converts a public key from a RFC8410 ASN.1 encoding. - * - * @param obj - The asn1 representation of a public key. - * - * @return {Buffer|Uint8Array} - 32 public key bytes. - */ -ed25519.publicKeyFromAsn1 = function(obj) { - // get SubjectPublicKeyInfo - var capture = {}; - var errors = []; - var valid = forge.asn1.validate(obj, publicKeyValidator, capture, errors); - if(!valid) { - var error = new Error('Invalid Key.'); - error.errors = errors; - throw error; - } - var oid = forge.asn1.derToOid(capture.publicKeyOid); - var ed25519Oid = forge.oids.EdDSA25519; - if(oid !== ed25519Oid) { - throw new Error('Invalid OID "' + oid + '"; OID must be "' + - ed25519Oid + '".'); - } - var publicKeyBytes = capture.ed25519PublicKey; - if(publicKeyBytes.length !== ed25519.constants.PUBLIC_KEY_BYTE_LENGTH) { - throw new Error('Key length is invalid.'); - } - return messageToNativeBuffer({ - message: publicKeyBytes, - encoding: 'binary' - }); -}; - -ed25519.publicKeyFromPrivateKey = function(options) { - options = options || {}; - var privateKey = messageToNativeBuffer({ - message: options.privateKey, encoding: 'binary' - }); - if(privateKey.length !== ed25519.constants.PRIVATE_KEY_BYTE_LENGTH) { - throw new TypeError( - '"options.privateKey" must have a byte length of ' + - ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); - } - - var pk = new NativeBuffer(ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); - for(var i = 0; i < pk.length; ++i) { - pk[i] = privateKey[32 + i]; - } - return pk; -}; - -ed25519.sign = function(options) { - options = options || {}; - var msg = messageToNativeBuffer(options); - var privateKey = messageToNativeBuffer({ - message: options.privateKey, - encoding: 'binary' - }); - if(privateKey.length === ed25519.constants.SEED_BYTE_LENGTH) { - var keyPair = ed25519.generateKeyPair({seed: privateKey}); - privateKey = keyPair.privateKey; - } else if(privateKey.length !== ed25519.constants.PRIVATE_KEY_BYTE_LENGTH) { - throw new TypeError( - '"options.privateKey" must have a byte length of ' + - ed25519.constants.SEED_BYTE_LENGTH + ' or ' + - ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); - } - - var signedMsg = new NativeBuffer( - ed25519.constants.SIGN_BYTE_LENGTH + msg.length); - crypto_sign(signedMsg, msg, msg.length, privateKey); - - var sig = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH); - for(var i = 0; i < sig.length; ++i) { - sig[i] = signedMsg[i]; - } - return sig; -}; - -ed25519.verify = function(options) { - options = options || {}; - var msg = messageToNativeBuffer(options); - if(options.signature === undefined) { - throw new TypeError( - '"options.signature" must be a node.js Buffer, a Uint8Array, a forge ' + - 'ByteBuffer, or a binary string.'); - } - var sig = messageToNativeBuffer({ - message: options.signature, - encoding: 'binary' - }); - if(sig.length !== ed25519.constants.SIGN_BYTE_LENGTH) { - throw new TypeError( - '"options.signature" must have a byte length of ' + - ed25519.constants.SIGN_BYTE_LENGTH); - } - var publicKey = messageToNativeBuffer({ - message: options.publicKey, - encoding: 'binary' - }); - if(publicKey.length !== ed25519.constants.PUBLIC_KEY_BYTE_LENGTH) { - throw new TypeError( - '"options.publicKey" must have a byte length of ' + - ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); - } - - var sm = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH + msg.length); - var m = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH + msg.length); - var i; - for(i = 0; i < ed25519.constants.SIGN_BYTE_LENGTH; ++i) { - sm[i] = sig[i]; - } - for(i = 0; i < msg.length; ++i) { - sm[i + ed25519.constants.SIGN_BYTE_LENGTH] = msg[i]; - } - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); -}; - -function messageToNativeBuffer(options) { - var message = options.message; - if(message instanceof Uint8Array || message instanceof NativeBuffer) { - return message; - } - - var encoding = options.encoding; - if(message === undefined) { - if(options.md) { - // TODO: more rigorous validation that `md` is a MessageDigest - message = options.md.digest().getBytes(); - encoding = 'binary'; - } else { - throw new TypeError('"options.message" or "options.md" not specified.'); - } - } - - if(typeof message === 'string' && !encoding) { - throw new TypeError('"options.encoding" must be "binary" or "utf8".'); - } - - if(typeof message === 'string') { - if(typeof Buffer !== 'undefined') { - return Buffer.from(message, encoding); - } - message = new ByteBuffer(message, encoding); - } else if(!(message instanceof ByteBuffer)) { - throw new TypeError( - '"options.message" must be a node.js Buffer, a Uint8Array, a forge ' + - 'ByteBuffer, or a string with "options.encoding" specifying its ' + - 'encoding.'); - } - - // convert to native buffer - var buffer = new NativeBuffer(message.length()); - for(var i = 0; i < buffer.length; ++i) { - buffer[i] = message.at(i); - } - return buffer; -} - -var gf0 = gf(); -var gf1 = gf([1]); -var D = gf([ - 0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, - 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]); -var D2 = gf([ - 0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, - 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]); -var X = gf([ - 0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, - 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]); -var Y = gf([ - 0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, - 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]); -var L = new Float64Array([ - 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, - 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); -var I = gf([ - 0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, - 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - -// TODO: update forge buffer implementation to use `Buffer` or `Uint8Array`, -// whichever is available, to improve performance -function sha512(msg, msgLen) { - // Note: `out` and `msg` are NativeBuffer - var md = forge.md.sha512.create(); - var buffer = new ByteBuffer(msg); - md.update(buffer.getBytes(msgLen), 'binary'); - var hash = md.digest().getBytes(); - if(typeof Buffer !== 'undefined') { - return Buffer.from(hash, 'binary'); - } - var out = new NativeBuffer(ed25519.constants.HASH_BYTE_LENGTH); - for(var i = 0; i < 64; ++i) { - out[i] = hash.charCodeAt(i); - } - return out; -} - -function crypto_sign_keypair(pk, sk) { - var p = [gf(), gf(), gf(), gf()]; - var i; - - var d = sha512(sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - scalarbase(p, d); - pack(pk, p); - - for(i = 0; i < 32; ++i) { - sk[i + 32] = pk[i]; - } - return 0; -} - -// Note: difference from C - smlen returned, not passed as argument. -function crypto_sign(sm, m, n, sk) { - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - - var d = sha512(sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - var smlen = n + 64; - for(i = 0; i < n; ++i) { - sm[64 + i] = m[i]; - } - for(i = 0; i < 32; ++i) { - sm[32 + i] = d[32 + i]; - } - - var r = sha512(sm.subarray(32), n + 32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - - for(i = 32; i < 64; ++i) { - sm[i] = sk[i]; - } - var h = sha512(sm, n + 64); - reduce(h); - - for(i = 32; i < 64; ++i) { - x[i] = 0; - } - for(i = 0; i < 32; ++i) { - x[i] = r[i]; - } - for(i = 0; i < 32; ++i) { - for(j = 0; j < 32; j++) { - x[i + j] += h[i] * d[j]; - } - } - - modL(sm.subarray(32), x); - return smlen; -} - -function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new NativeBuffer(32); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; - - mlen = -1; - if(n < 64) { - return -1; - } - - if(unpackneg(q, pk)) { - return -1; - } - - for(i = 0; i < n; ++i) { - m[i] = sm[i]; - } - for(i = 0; i < 32; ++i) { - m[i + 32] = pk[i]; - } - var h = sha512(m, n); - reduce(h); - scalarmult(p, q, h); - - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - - n -= 64; - if(crypto_verify_32(sm, 0, t, 0)) { - for(i = 0; i < n; ++i) { - m[i] = 0; - } - return -1; - } - - for(i = 0; i < n; ++i) { - m[i] = sm[i + 64]; - } - mlen = n; - return mlen; -} - -function modL(r, x) { - var carry, i, j, k; - for(i = 63; i >= 32; --i) { - carry = 0; - for(j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for(j = 0; j < 32; ++j) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for(j = 0; j < 32; ++j) { - x[j] -= carry * L[j]; - } - for(i = 0; i < 32; ++i) { - x[i + 1] += x[i] >> 8; - r[i] = x[i] & 255; - } -} - -function reduce(r) { - var x = new Float64Array(64); - for(var i = 0; i < 64; ++i) { - x[i] = r[i]; - r[i] = 0; - } - modL(r, x); -} - -function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); -} - -function cswap(p, q, b) { - for(var i = 0; i < 4; ++i) { - sel25519(p[i], q[i], b); - } -} - -function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; -} - -function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for(i = 0; i < 16; ++i) { - t[i] = n[i]; - } - car25519(t); - car25519(t); - car25519(t); - for(j = 0; j < 2; ++j) { - m[0] = t[0] - 0xffed; - for(i = 1; i < 15; ++i) { - m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1); - m[i-1] &= 0xffff; - } - m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1); - b = (m[15] >> 16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1 - b); - } - for (i = 0; i < 16; i++) { - o[2 * i] = t[i] & 0xff; - o[2 * i + 1] = t[i] >> 8; - } -} - -function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - - S(chk, r[0]); - M(chk, chk, den); - if(neq25519(chk, num)) { - M(r[0], r[0], I); - } - - S(chk, r[0]); - M(chk, chk, den); - if(neq25519(chk, num)) { - return -1; - } - - if(par25519(r[0]) === (p[31] >> 7)) { - Z(r[0], gf0, r[0]); - } - - M(r[3], r[0], r[1]); - return 0; -} - -function unpack25519(o, n) { - var i; - for(i = 0; i < 16; ++i) { - o[i] = n[2 * i] + (n[2 * i + 1] << 8); - } - o[15] &= 0x7fff; -} - -function pow2523(o, i) { - var c = gf(); - var a; - for(a = 0; a < 16; ++a) { - c[a] = i[a]; - } - for(a = 250; a >= 0; --a) { - S(c, c); - if(a !== 1) { - M(c, c, i); - } - } - for(a = 0; a < 16; ++a) { - o[a] = c[a]; - } -} - -function neq25519(a, b) { - var c = new NativeBuffer(32); - var d = new NativeBuffer(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); -} - -function crypto_verify_32(x, xi, y, yi) { - return vn(x, xi, y, yi, 32); -} - -function vn(x, xi, y, yi, n) { - var i, d = 0; - for(i = 0; i < n; ++i) { - d |= x[xi + i] ^ y[yi + i]; - } - return (1 & ((d - 1) >>> 8)) - 1; -} - -function par25519(a) { - var d = new NativeBuffer(32); - pack25519(d, a); - return d[0] & 1; -} - -function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for(i = 255; i >= 0; --i) { - b = (s[(i / 8)|0] >> (i & 7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } -} - -function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); -} - -function set25519(r, a) { - var i; - for(i = 0; i < 16; i++) { - r[i] = a[i] | 0; - } -} - -function inv25519(o, i) { - var c = gf(); - var a; - for(a = 0; a < 16; ++a) { - c[a] = i[a]; - } - for(a = 253; a >= 0; --a) { - S(c, c); - if(a !== 2 && a !== 4) { - M(c, c, i); - } - } - for(a = 0; a < 16; ++a) { - o[a] = c[a]; - } -} - -function car25519(o) { - var i, v, c = 1; - for(i = 0; i < 16; ++i) { - v = o[i] + c + 65535; - c = Math.floor(v / 65536); - o[i] = v - c * 65536; - } - o[0] += c - 1 + 37 * (c - 1); -} - -function sel25519(p, q, b) { - var t, c = ~(b - 1); - for(var i = 0; i < 16; ++i) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } -} - -function gf(init) { - var i, r = new Float64Array(16); - if(init) { - for(i = 0; i < init.length; ++i) { - r[i] = init[i]; - } - } - return r; -} - -function A(o, a, b) { - for(var i = 0; i < 16; ++i) { - o[i] = a[i] + b[i]; - } -} - -function Z(o, a, b) { - for(var i = 0; i < 16; ++i) { - o[i] = a[i] - b[i]; - } -} - -function S(o, a) { - M(o, a, a); -} - -function M(o, a, b) { - var v, c, - t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, - t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, - t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, - t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, - b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3], - b4 = b[4], - b5 = b[5], - b6 = b[6], - b7 = b[7], - b8 = b[8], - b9 = b[9], - b10 = b[10], - b11 = b[11], - b12 = b[12], - b13 = b[13], - b14 = b[14], - b15 = b[15]; - - v = a[0]; - t0 += v * b0; - t1 += v * b1; - t2 += v * b2; - t3 += v * b3; - t4 += v * b4; - t5 += v * b5; - t6 += v * b6; - t7 += v * b7; - t8 += v * b8; - t9 += v * b9; - t10 += v * b10; - t11 += v * b11; - t12 += v * b12; - t13 += v * b13; - t14 += v * b14; - t15 += v * b15; - v = a[1]; - t1 += v * b0; - t2 += v * b1; - t3 += v * b2; - t4 += v * b3; - t5 += v * b4; - t6 += v * b5; - t7 += v * b6; - t8 += v * b7; - t9 += v * b8; - t10 += v * b9; - t11 += v * b10; - t12 += v * b11; - t13 += v * b12; - t14 += v * b13; - t15 += v * b14; - t16 += v * b15; - v = a[2]; - t2 += v * b0; - t3 += v * b1; - t4 += v * b2; - t5 += v * b3; - t6 += v * b4; - t7 += v * b5; - t8 += v * b6; - t9 += v * b7; - t10 += v * b8; - t11 += v * b9; - t12 += v * b10; - t13 += v * b11; - t14 += v * b12; - t15 += v * b13; - t16 += v * b14; - t17 += v * b15; - v = a[3]; - t3 += v * b0; - t4 += v * b1; - t5 += v * b2; - t6 += v * b3; - t7 += v * b4; - t8 += v * b5; - t9 += v * b6; - t10 += v * b7; - t11 += v * b8; - t12 += v * b9; - t13 += v * b10; - t14 += v * b11; - t15 += v * b12; - t16 += v * b13; - t17 += v * b14; - t18 += v * b15; - v = a[4]; - t4 += v * b0; - t5 += v * b1; - t6 += v * b2; - t7 += v * b3; - t8 += v * b4; - t9 += v * b5; - t10 += v * b6; - t11 += v * b7; - t12 += v * b8; - t13 += v * b9; - t14 += v * b10; - t15 += v * b11; - t16 += v * b12; - t17 += v * b13; - t18 += v * b14; - t19 += v * b15; - v = a[5]; - t5 += v * b0; - t6 += v * b1; - t7 += v * b2; - t8 += v * b3; - t9 += v * b4; - t10 += v * b5; - t11 += v * b6; - t12 += v * b7; - t13 += v * b8; - t14 += v * b9; - t15 += v * b10; - t16 += v * b11; - t17 += v * b12; - t18 += v * b13; - t19 += v * b14; - t20 += v * b15; - v = a[6]; - t6 += v * b0; - t7 += v * b1; - t8 += v * b2; - t9 += v * b3; - t10 += v * b4; - t11 += v * b5; - t12 += v * b6; - t13 += v * b7; - t14 += v * b8; - t15 += v * b9; - t16 += v * b10; - t17 += v * b11; - t18 += v * b12; - t19 += v * b13; - t20 += v * b14; - t21 += v * b15; - v = a[7]; - t7 += v * b0; - t8 += v * b1; - t9 += v * b2; - t10 += v * b3; - t11 += v * b4; - t12 += v * b5; - t13 += v * b6; - t14 += v * b7; - t15 += v * b8; - t16 += v * b9; - t17 += v * b10; - t18 += v * b11; - t19 += v * b12; - t20 += v * b13; - t21 += v * b14; - t22 += v * b15; - v = a[8]; - t8 += v * b0; - t9 += v * b1; - t10 += v * b2; - t11 += v * b3; - t12 += v * b4; - t13 += v * b5; - t14 += v * b6; - t15 += v * b7; - t16 += v * b8; - t17 += v * b9; - t18 += v * b10; - t19 += v * b11; - t20 += v * b12; - t21 += v * b13; - t22 += v * b14; - t23 += v * b15; - v = a[9]; - t9 += v * b0; - t10 += v * b1; - t11 += v * b2; - t12 += v * b3; - t13 += v * b4; - t14 += v * b5; - t15 += v * b6; - t16 += v * b7; - t17 += v * b8; - t18 += v * b9; - t19 += v * b10; - t20 += v * b11; - t21 += v * b12; - t22 += v * b13; - t23 += v * b14; - t24 += v * b15; - v = a[10]; - t10 += v * b0; - t11 += v * b1; - t12 += v * b2; - t13 += v * b3; - t14 += v * b4; - t15 += v * b5; - t16 += v * b6; - t17 += v * b7; - t18 += v * b8; - t19 += v * b9; - t20 += v * b10; - t21 += v * b11; - t22 += v * b12; - t23 += v * b13; - t24 += v * b14; - t25 += v * b15; - v = a[11]; - t11 += v * b0; - t12 += v * b1; - t13 += v * b2; - t14 += v * b3; - t15 += v * b4; - t16 += v * b5; - t17 += v * b6; - t18 += v * b7; - t19 += v * b8; - t20 += v * b9; - t21 += v * b10; - t22 += v * b11; - t23 += v * b12; - t24 += v * b13; - t25 += v * b14; - t26 += v * b15; - v = a[12]; - t12 += v * b0; - t13 += v * b1; - t14 += v * b2; - t15 += v * b3; - t16 += v * b4; - t17 += v * b5; - t18 += v * b6; - t19 += v * b7; - t20 += v * b8; - t21 += v * b9; - t22 += v * b10; - t23 += v * b11; - t24 += v * b12; - t25 += v * b13; - t26 += v * b14; - t27 += v * b15; - v = a[13]; - t13 += v * b0; - t14 += v * b1; - t15 += v * b2; - t16 += v * b3; - t17 += v * b4; - t18 += v * b5; - t19 += v * b6; - t20 += v * b7; - t21 += v * b8; - t22 += v * b9; - t23 += v * b10; - t24 += v * b11; - t25 += v * b12; - t26 += v * b13; - t27 += v * b14; - t28 += v * b15; - v = a[14]; - t14 += v * b0; - t15 += v * b1; - t16 += v * b2; - t17 += v * b3; - t18 += v * b4; - t19 += v * b5; - t20 += v * b6; - t21 += v * b7; - t22 += v * b8; - t23 += v * b9; - t24 += v * b10; - t25 += v * b11; - t26 += v * b12; - t27 += v * b13; - t28 += v * b14; - t29 += v * b15; - v = a[15]; - t15 += v * b0; - t16 += v * b1; - t17 += v * b2; - t18 += v * b3; - t19 += v * b4; - t20 += v * b5; - t21 += v * b6; - t22 += v * b7; - t23 += v * b8; - t24 += v * b9; - t25 += v * b10; - t26 += v * b11; - t27 += v * b12; - t28 += v * b13; - t29 += v * b14; - t30 += v * b15; - - t0 += 38 * t16; - t1 += 38 * t17; - t2 += 38 * t18; - t3 += 38 * t19; - t4 += 38 * t20; - t5 += 38 * t21; - t6 += 38 * t22; - t7 += 38 * t23; - t8 += 38 * t24; - t9 += 38 * t25; - t10 += 38 * t26; - t11 += 38 * t27; - t12 += 38 * t28; - t13 += 38 * t29; - t14 += 38 * t30; - // t15 left as is - - // first car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - // second car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - o[ 0] = t0; - o[ 1] = t1; - o[ 2] = t2; - o[ 3] = t3; - o[ 4] = t4; - o[ 5] = t5; - o[ 6] = t6; - o[ 7] = t7; - o[ 8] = t8; - o[ 9] = t9; - o[10] = t10; - o[11] = t11; - o[12] = t12; - o[13] = t13; - o[14] = t14; - o[15] = t15; -} diff --git a/node_modules/node-forge/lib/forge.js b/node_modules/node-forge/lib/forge.js deleted file mode 100644 index 2e243a9d..00000000 --- a/node_modules/node-forge/lib/forge.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Node.js module for Forge. - * - * @author Dave Longley - * - * Copyright 2011-2016 Digital Bazaar, Inc. - */ -module.exports = { - // default options - options: { - usePureJavaScript: false - } -}; diff --git a/node_modules/node-forge/lib/form.js b/node_modules/node-forge/lib/form.js deleted file mode 100644 index 4d7843a2..00000000 --- a/node_modules/node-forge/lib/form.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Functions for manipulating web forms. - * - * @author David I. Lehn - * @author Dave Longley - * @author Mike Johnson - * - * Copyright (c) 2011-2014 Digital Bazaar, Inc. All rights reserved. - */ -var forge = require('./forge'); - -/* Form API */ -var form = module.exports = forge.form = forge.form || {}; - -(function($) { - -/** - * Regex for parsing a single name property (handles array brackets). - */ -var _regex = /([^\[]*?)\[(.*?)\]/g; - -/** - * Parses a single name property into an array with the name and any - * array indices. - * - * @param name the name to parse. - * - * @return the array of the name and its array indices in order. - */ -var _parseName = function(name) { - var rval = []; - - var matches; - while(!!(matches = _regex.exec(name))) { - if(matches[1].length > 0) { - rval.push(matches[1]); - } - if(matches.length >= 2) { - rval.push(matches[2]); - } - } - if(rval.length === 0) { - rval.push(name); - } - - return rval; -}; - -/** - * Adds a field from the given form to the given object. - * - * @param obj the object. - * @param names the field as an array of object property names. - * @param value the value of the field. - * @param dict a dictionary of names to replace. - */ -var _addField = function(obj, names, value, dict) { - // combine array names that fall within square brackets - var tmp = []; - for(var i = 0; i < names.length; ++i) { - // check name for starting square bracket but no ending one - var name = names[i]; - if(name.indexOf('[') !== -1 && name.indexOf(']') === -1 && - i < names.length - 1) { - do { - name += '.' + names[++i]; - } while(i < names.length - 1 && names[i].indexOf(']') === -1); - } - tmp.push(name); - } - names = tmp; - - // split out array indexes - var tmp = []; - $.each(names, function(n, name) { - tmp = tmp.concat(_parseName(name)); - }); - names = tmp; - - // iterate over object property names until value is set - $.each(names, function(n, name) { - // do dictionary name replacement - if(dict && name.length !== 0 && name in dict) { - name = dict[name]; - } - - // blank name indicates appending to an array, set name to - // new last index of array - if(name.length === 0) { - name = obj.length; - } - - // value already exists, append value - if(obj[name]) { - // last name in the field - if(n == names.length - 1) { - // more than one value, so convert into an array - if(!$.isArray(obj[name])) { - obj[name] = [obj[name]]; - } - obj[name].push(value); - } else { - // not last name, go deeper into object - obj = obj[name]; - } - } else if(n == names.length - 1) { - // new value, last name in the field, set value - obj[name] = value; - } else { - // new value, not last name, go deeper - // get next name - var next = names[n + 1]; - - // blank next value indicates array-appending, so create array - if(next.length === 0) { - obj[name] = []; - } else { - // if next name is a number create an array, otherwise a map - var isNum = ((next - 0) == next && next.length > 0); - obj[name] = isNum ? [] : {}; - } - obj = obj[name]; - } - }); -}; - -/** - * Serializes a form to a JSON object. Object properties will be separated - * using the given separator (defaults to '.') and by square brackets. - * - * @param input the jquery form to serialize. - * @param sep the object-property separator (defaults to '.'). - * @param dict a dictionary of names to replace (name=replace). - * - * @return the JSON-serialized form. - */ -form.serialize = function(input, sep, dict) { - var rval = {}; - - // add all fields in the form to the object - sep = sep || '.'; - $.each(input.serializeArray(), function() { - _addField(rval, this.name.split(sep), this.value || '', dict); - }); - - return rval; -}; - -})(jQuery); diff --git a/node_modules/node-forge/lib/hmac.js b/node_modules/node-forge/lib/hmac.js deleted file mode 100644 index b155f247..00000000 --- a/node_modules/node-forge/lib/hmac.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Hash-based Message Authentication Code implementation. Requires a message - * digest object that can be obtained, for example, from forge.md.sha1 or - * forge.md.md5. - * - * @author Dave Longley - * - * Copyright (c) 2010-2012 Digital Bazaar, Inc. All rights reserved. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -/* HMAC API */ -var hmac = module.exports = forge.hmac = forge.hmac || {}; - -/** - * Creates an HMAC object that uses the given message digest object. - * - * @return an HMAC object. - */ -hmac.create = function() { - // the hmac key to use - var _key = null; - - // the message digest to use - var _md = null; - - // the inner padding - var _ipadding = null; - - // the outer padding - var _opadding = null; - - // hmac context - var ctx = {}; - - /** - * Starts or restarts the HMAC with the given key and message digest. - * - * @param md the message digest to use, null to reuse the previous one, - * a string to use builtin 'sha1', 'md5', 'sha256'. - * @param key the key to use as a string, array of bytes, byte buffer, - * or null to reuse the previous key. - */ - ctx.start = function(md, key) { - if(md !== null) { - if(typeof md === 'string') { - // create builtin message digest - md = md.toLowerCase(); - if(md in forge.md.algorithms) { - _md = forge.md.algorithms[md].create(); - } else { - throw new Error('Unknown hash algorithm "' + md + '"'); - } - } else { - // store message digest - _md = md; - } - } - - if(key === null) { - // reuse previous key - key = _key; - } else { - if(typeof key === 'string') { - // convert string into byte buffer - key = forge.util.createBuffer(key); - } else if(forge.util.isArray(key)) { - // convert byte array into byte buffer - var tmp = key; - key = forge.util.createBuffer(); - for(var i = 0; i < tmp.length; ++i) { - key.putByte(tmp[i]); - } - } - - // if key is longer than blocksize, hash it - var keylen = key.length(); - if(keylen > _md.blockLength) { - _md.start(); - _md.update(key.bytes()); - key = _md.digest(); - } - - // mix key into inner and outer padding - // ipadding = [0x36 * blocksize] ^ key - // opadding = [0x5C * blocksize] ^ key - _ipadding = forge.util.createBuffer(); - _opadding = forge.util.createBuffer(); - keylen = key.length(); - for(var i = 0; i < keylen; ++i) { - var tmp = key.at(i); - _ipadding.putByte(0x36 ^ tmp); - _opadding.putByte(0x5C ^ tmp); - } - - // if key is shorter than blocksize, add additional padding - if(keylen < _md.blockLength) { - var tmp = _md.blockLength - keylen; - for(var i = 0; i < tmp; ++i) { - _ipadding.putByte(0x36); - _opadding.putByte(0x5C); - } - } - _key = key; - _ipadding = _ipadding.bytes(); - _opadding = _opadding.bytes(); - } - - // digest is done like so: hash(opadding | hash(ipadding | message)) - - // prepare to do inner hash - // hash(ipadding | message) - _md.start(); - _md.update(_ipadding); - }; - - /** - * Updates the HMAC with the given message bytes. - * - * @param bytes the bytes to update with. - */ - ctx.update = function(bytes) { - _md.update(bytes); - }; - - /** - * Produces the Message Authentication Code (MAC). - * - * @return a byte buffer containing the digest value. - */ - ctx.getMac = function() { - // digest is done like so: hash(opadding | hash(ipadding | message)) - // here we do the outer hashing - var inner = _md.digest().bytes(); - _md.start(); - _md.update(_opadding); - _md.update(inner); - return _md.digest(); - }; - // alias for getMac - ctx.digest = ctx.getMac; - - return ctx; -}; diff --git a/node_modules/node-forge/lib/http.js b/node_modules/node-forge/lib/http.js deleted file mode 100644 index 1dcb0a65..00000000 --- a/node_modules/node-forge/lib/http.js +++ /dev/null @@ -1,1364 +0,0 @@ -/** - * HTTP client-side implementation that uses forge.net sockets. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. All rights reserved. - */ -var forge = require('./forge'); -require('./debug'); -require('./tls'); -require('./util'); - -// define http namespace -var http = module.exports = forge.http = forge.http || {}; - -// logging category -var cat = 'forge.http'; - -// add array of clients to debug storage -if(forge.debug) { - forge.debug.set('forge.http', 'clients', []); -} - -// normalizes an http header field name -var _normalize = function(name) { - return name.toLowerCase().replace(/(^.)|(-.)/g, - function(a) {return a.toUpperCase();}); -}; - -/** - * Gets the local storage ID for the given client. - * - * @param client the client to get the local storage ID for. - * - * @return the local storage ID to use. - */ -var _getStorageId = function(client) { - // TODO: include browser in ID to avoid sharing cookies between - // browsers (if this is undesirable) - // navigator.userAgent - return 'forge.http.' + - client.url.scheme + '.' + - client.url.host + '.' + - client.url.port; -}; - -/** - * Loads persistent cookies from disk for the given client. - * - * @param client the client. - */ -var _loadCookies = function(client) { - if(client.persistCookies) { - try { - var cookies = forge.util.getItem( - client.socketPool.flashApi, - _getStorageId(client), 'cookies'); - client.cookies = cookies || {}; - } catch(ex) { - // no flash storage available, just silently fail - // TODO: i assume we want this logged somewhere or - // should it actually generate an error - //forge.log.error(cat, ex); - } - } -}; - -/** - * Saves persistent cookies on disk for the given client. - * - * @param client the client. - */ -var _saveCookies = function(client) { - if(client.persistCookies) { - try { - forge.util.setItem( - client.socketPool.flashApi, - _getStorageId(client), 'cookies', client.cookies); - } catch(ex) { - // no flash storage available, just silently fail - // TODO: i assume we want this logged somewhere or - // should it actually generate an error - //forge.log.error(cat, ex); - } - } - - // FIXME: remove me - _loadCookies(client); -}; - -/** - * Clears persistent cookies on disk for the given client. - * - * @param client the client. - */ -var _clearCookies = function(client) { - if(client.persistCookies) { - try { - // only thing stored is 'cookies', so clear whole storage - forge.util.clearItems( - client.socketPool.flashApi, - _getStorageId(client)); - } catch(ex) { - // no flash storage available, just silently fail - // TODO: i assume we want this logged somewhere or - // should it actually generate an error - //forge.log.error(cat, ex); - } - } -}; - -/** - * Connects and sends a request. - * - * @param client the http client. - * @param socket the socket to use. - */ -var _doRequest = function(client, socket) { - if(socket.isConnected()) { - // already connected - socket.options.request.connectTime = +new Date(); - socket.connected({ - type: 'connect', - id: socket.id - }); - } else { - // connect - socket.options.request.connectTime = +new Date(); - socket.connect({ - host: client.url.host, - port: client.url.port, - policyPort: client.policyPort, - policyUrl: client.policyUrl - }); - } -}; - -/** - * Handles the next request or marks a socket as idle. - * - * @param client the http client. - * @param socket the socket. - */ -var _handleNextRequest = function(client, socket) { - // clear buffer - socket.buffer.clear(); - - // get pending request - var pending = null; - while(pending === null && client.requests.length > 0) { - pending = client.requests.shift(); - if(pending.request.aborted) { - pending = null; - } - } - - // mark socket idle if no pending requests - if(pending === null) { - if(socket.options !== null) { - socket.options = null; - } - client.idle.push(socket); - } else { - // handle pending request, allow 1 retry - socket.retries = 1; - socket.options = pending; - _doRequest(client, socket); - } -}; - -/** - * Sets up a socket for use with an http client. - * - * @param client the parent http client. - * @param socket the socket to set up. - * @param tlsOptions if the socket must use TLS, the TLS options. - */ -var _initSocket = function(client, socket, tlsOptions) { - // no socket options yet - socket.options = null; - - // set up handlers - socket.connected = function(e) { - // socket primed by caching TLS session, handle next request - if(socket.options === null) { - _handleNextRequest(client, socket); - } else { - // socket in use - var request = socket.options.request; - request.connectTime = +new Date() - request.connectTime; - e.socket = socket; - socket.options.connected(e); - if(request.aborted) { - socket.close(); - } else { - var out = request.toString(); - if(request.body) { - out += request.body; - } - request.time = +new Date(); - socket.send(out); - request.time = +new Date() - request.time; - socket.options.response.time = +new Date(); - socket.sending = true; - } - } - }; - socket.closed = function(e) { - if(socket.sending) { - socket.sending = false; - if(socket.retries > 0) { - --socket.retries; - _doRequest(client, socket); - } else { - // error, closed during send - socket.error({ - id: socket.id, - type: 'ioError', - message: 'Connection closed during send. Broken pipe.', - bytesAvailable: 0 - }); - } - } else { - // handle unspecified content-length transfer - var response = socket.options.response; - if(response.readBodyUntilClose) { - response.time = +new Date() - response.time; - response.bodyReceived = true; - socket.options.bodyReady({ - request: socket.options.request, - response: response, - socket: socket - }); - } - socket.options.closed(e); - _handleNextRequest(client, socket); - } - }; - socket.data = function(e) { - socket.sending = false; - var request = socket.options.request; - if(request.aborted) { - socket.close(); - } else { - // receive all bytes available - var response = socket.options.response; - var bytes = socket.receive(e.bytesAvailable); - if(bytes !== null) { - // receive header and then body - socket.buffer.putBytes(bytes); - if(!response.headerReceived) { - response.readHeader(socket.buffer); - if(response.headerReceived) { - socket.options.headerReady({ - request: socket.options.request, - response: response, - socket: socket - }); - } - } - if(response.headerReceived && !response.bodyReceived) { - response.readBody(socket.buffer); - } - if(response.bodyReceived) { - socket.options.bodyReady({ - request: socket.options.request, - response: response, - socket: socket - }); - // close connection if requested or by default on http/1.0 - var value = response.getField('Connection') || ''; - if(value.indexOf('close') != -1 || - (response.version === 'HTTP/1.0' && - response.getField('Keep-Alive') === null)) { - socket.close(); - } else { - _handleNextRequest(client, socket); - } - } - } - } - }; - socket.error = function(e) { - // do error callback, include request - socket.options.error({ - type: e.type, - message: e.message, - request: socket.options.request, - response: socket.options.response, - socket: socket - }); - socket.close(); - }; - - // wrap socket for TLS - if(tlsOptions) { - socket = forge.tls.wrapSocket({ - sessionId: null, - sessionCache: {}, - caStore: tlsOptions.caStore, - cipherSuites: tlsOptions.cipherSuites, - socket: socket, - virtualHost: tlsOptions.virtualHost, - verify: tlsOptions.verify, - getCertificate: tlsOptions.getCertificate, - getPrivateKey: tlsOptions.getPrivateKey, - getSignature: tlsOptions.getSignature, - deflate: tlsOptions.deflate || null, - inflate: tlsOptions.inflate || null - }); - - socket.options = null; - socket.buffer = forge.util.createBuffer(); - client.sockets.push(socket); - if(tlsOptions.prime) { - // prime socket by connecting and caching TLS session, will do - // next request from there - socket.connect({ - host: client.url.host, - port: client.url.port, - policyPort: client.policyPort, - policyUrl: client.policyUrl - }); - } else { - // do not prime socket, just add as idle - client.idle.push(socket); - } - } else { - // no need to prime non-TLS sockets - socket.buffer = forge.util.createBuffer(); - client.sockets.push(socket); - client.idle.push(socket); - } -}; - -/** - * Checks to see if the given cookie has expired. If the cookie's max-age - * plus its created time is less than the time now, it has expired, unless - * its max-age is set to -1 which indicates it will never expire. - * - * @param cookie the cookie to check. - * - * @return true if it has expired, false if not. - */ -var _hasCookieExpired = function(cookie) { - var rval = false; - - if(cookie.maxAge !== -1) { - var now = _getUtcTime(new Date()); - var expires = cookie.created + cookie.maxAge; - if(expires <= now) { - rval = true; - } - } - - return rval; -}; - -/** - * Adds cookies in the given client to the given request. - * - * @param client the client. - * @param request the request. - */ -var _writeCookies = function(client, request) { - var expired = []; - var url = client.url; - var cookies = client.cookies; - for(var name in cookies) { - // get cookie paths - var paths = cookies[name]; - for(var p in paths) { - var cookie = paths[p]; - if(_hasCookieExpired(cookie)) { - // store for clean up - expired.push(cookie); - } else if(request.path.indexOf(cookie.path) === 0) { - // path or path's ancestor must match cookie.path - request.addCookie(cookie); - } - } - } - - // clean up expired cookies - for(var i = 0; i < expired.length; ++i) { - var cookie = expired[i]; - client.removeCookie(cookie.name, cookie.path); - } -}; - -/** - * Gets cookies from the given response and adds the to the given client. - * - * @param client the client. - * @param response the response. - */ -var _readCookies = function(client, response) { - var cookies = response.getCookies(); - for(var i = 0; i < cookies.length; ++i) { - try { - client.setCookie(cookies[i]); - } catch(ex) { - // ignore failure to add other-domain, etc. cookies - } - } -}; - -/** - * Creates an http client that uses forge.net sockets as a backend and - * forge.tls for security. - * - * @param options: - * url: the url to connect to (scheme://host:port). - * socketPool: the flash socket pool to use. - * policyPort: the flash policy port to use (if other than the - * socket pool default), use 0 for flash default. - * policyUrl: the flash policy file URL to use (if provided will - * be used instead of a policy port). - * connections: number of connections to use to handle requests. - * caCerts: an array of certificates to trust for TLS, certs may - * be PEM-formatted or cert objects produced via forge.pki. - * cipherSuites: an optional array of cipher suites to use, - * see forge.tls.CipherSuites. - * virtualHost: the virtual server name to use in a TLS SNI - * extension, if not provided the url host will be used. - * verify: a custom TLS certificate verify callback to use. - * getCertificate: an optional callback used to get a client-side - * certificate (see forge.tls for details). - * getPrivateKey: an optional callback used to get a client-side - * private key (see forge.tls for details). - * getSignature: an optional callback used to get a client-side - * signature (see forge.tls for details). - * persistCookies: true to use persistent cookies via flash local - * storage, false to only keep cookies in javascript. - * primeTlsSockets: true to immediately connect TLS sockets on - * their creation so that they will cache TLS sessions for reuse. - * - * @return the client. - */ -http.createClient = function(options) { - // create CA store to share with all TLS connections - var caStore = null; - if(options.caCerts) { - caStore = forge.pki.createCaStore(options.caCerts); - } - - // get scheme, host, and port from url - options.url = (options.url || - window.location.protocol + '//' + window.location.host); - var url = http.parseUrl(options.url); - if(!url) { - var error = new Error('Invalid url.'); - error.details = {url: options.url}; - throw error; - } - - // default to 1 connection - options.connections = options.connections || 1; - - // create client - var sp = options.socketPool; - var client = { - // url - url: url, - // socket pool - socketPool: sp, - // the policy port to use - policyPort: options.policyPort, - // policy url to use - policyUrl: options.policyUrl, - // queue of requests to service - requests: [], - // all sockets - sockets: [], - // idle sockets - idle: [], - // whether or not the connections are secure - secure: (url.scheme === 'https'), - // cookie jar (key'd off of name and then path, there is only 1 domain - // and one setting for secure per client so name+path is unique) - cookies: {}, - // default to flash storage of cookies - persistCookies: (typeof(options.persistCookies) === 'undefined') ? - true : options.persistCookies - }; - - // add client to debug storage - if(forge.debug) { - forge.debug.get('forge.http', 'clients').push(client); - } - - // load cookies from disk - _loadCookies(client); - - /** - * A default certificate verify function that checks a certificate common - * name against the client's URL host. - * - * @param c the TLS connection. - * @param verified true if cert is verified, otherwise alert number. - * @param depth the chain depth. - * @param certs the cert chain. - * - * @return true if verified and the common name matches the host, error - * otherwise. - */ - var _defaultCertificateVerify = function(c, verified, depth, certs) { - if(depth === 0 && verified === true) { - // compare common name to url host - var cn = certs[depth].subject.getField('CN'); - if(cn === null || client.url.host !== cn.value) { - verified = { - message: 'Certificate common name does not match url host.' - }; - } - } - return verified; - }; - - // determine if TLS is used - var tlsOptions = null; - if(client.secure) { - tlsOptions = { - caStore: caStore, - cipherSuites: options.cipherSuites || null, - virtualHost: options.virtualHost || url.host, - verify: options.verify || _defaultCertificateVerify, - getCertificate: options.getCertificate || null, - getPrivateKey: options.getPrivateKey || null, - getSignature: options.getSignature || null, - prime: options.primeTlsSockets || false - }; - - // if socket pool uses a flash api, then add deflate support to TLS - if(sp.flashApi !== null) { - tlsOptions.deflate = function(bytes) { - // strip 2 byte zlib header and 4 byte trailer - return forge.util.deflate(sp.flashApi, bytes, true); - }; - tlsOptions.inflate = function(bytes) { - return forge.util.inflate(sp.flashApi, bytes, true); - }; - } - } - - // create and initialize sockets - for(var i = 0; i < options.connections; ++i) { - _initSocket(client, sp.createSocket(), tlsOptions); - } - - /** - * Sends a request. A method 'abort' will be set on the request that - * can be called to attempt to abort the request. - * - * @param options: - * request: the request to send. - * connected: a callback for when the connection is open. - * closed: a callback for when the connection is closed. - * headerReady: a callback for when the response header arrives. - * bodyReady: a callback for when the response body arrives. - * error: a callback for if an error occurs. - */ - client.send = function(options) { - // add host header if not set - if(options.request.getField('Host') === null) { - options.request.setField('Host', client.url.fullHost); - } - - // set default dummy handlers - var opts = {}; - opts.request = options.request; - opts.connected = options.connected || function() {}; - opts.closed = options.close || function() {}; - opts.headerReady = function(e) { - // read cookies - _readCookies(client, e.response); - if(options.headerReady) { - options.headerReady(e); - } - }; - opts.bodyReady = options.bodyReady || function() {}; - opts.error = options.error || function() {}; - - // create response - opts.response = http.createResponse(); - opts.response.time = 0; - opts.response.flashApi = client.socketPool.flashApi; - opts.request.flashApi = client.socketPool.flashApi; - - // create abort function - opts.request.abort = function() { - // set aborted, clear handlers - opts.request.aborted = true; - opts.connected = function() {}; - opts.closed = function() {}; - opts.headerReady = function() {}; - opts.bodyReady = function() {}; - opts.error = function() {}; - }; - - // add cookies to request - _writeCookies(client, opts.request); - - // queue request options if there are no idle sockets - if(client.idle.length === 0) { - client.requests.push(opts); - } else { - // use an idle socket, prefer an idle *connected* socket first - var socket = null; - var len = client.idle.length; - for(var i = 0; socket === null && i < len; ++i) { - socket = client.idle[i]; - if(socket.isConnected()) { - client.idle.splice(i, 1); - } else { - socket = null; - } - } - // no connected socket available, get unconnected socket - if(socket === null) { - socket = client.idle.pop(); - } - socket.options = opts; - _doRequest(client, socket); - } - }; - - /** - * Destroys this client. - */ - client.destroy = function() { - // clear pending requests, close and destroy sockets - client.requests = []; - for(var i = 0; i < client.sockets.length; ++i) { - client.sockets[i].close(); - client.sockets[i].destroy(); - } - client.socketPool = null; - client.sockets = []; - client.idle = []; - }; - - /** - * Sets a cookie for use with all connections made by this client. Any - * cookie with the same name will be replaced. If the cookie's value - * is undefined, null, or the blank string, the cookie will be removed. - * - * If the cookie's domain doesn't match this client's url host or the - * cookie's secure flag doesn't match this client's url scheme, then - * setting the cookie will fail with an exception. - * - * @param cookie the cookie with parameters: - * name: the name of the cookie. - * value: the value of the cookie. - * comment: an optional comment string. - * maxAge: the age of the cookie in seconds relative to created time. - * secure: true if the cookie must be sent over a secure protocol. - * httpOnly: true to restrict access to the cookie from javascript - * (inaffective since the cookies are stored in javascript). - * path: the path for the cookie. - * domain: optional domain the cookie belongs to (must start with dot). - * version: optional version of the cookie. - * created: creation time, in UTC seconds, of the cookie. - */ - client.setCookie = function(cookie) { - var rval; - if(typeof(cookie.name) !== 'undefined') { - if(cookie.value === null || typeof(cookie.value) === 'undefined' || - cookie.value === '') { - // remove cookie - rval = client.removeCookie(cookie.name, cookie.path); - } else { - // set cookie defaults - cookie.comment = cookie.comment || ''; - cookie.maxAge = cookie.maxAge || 0; - cookie.secure = (typeof(cookie.secure) === 'undefined') ? - true : cookie.secure; - cookie.httpOnly = cookie.httpOnly || true; - cookie.path = cookie.path || '/'; - cookie.domain = cookie.domain || null; - cookie.version = cookie.version || null; - cookie.created = _getUtcTime(new Date()); - - // do secure check - if(cookie.secure !== client.secure) { - var error = new Error('Http client url scheme is incompatible ' + - 'with cookie secure flag.'); - error.url = client.url; - error.cookie = cookie; - throw error; - } - // make sure url host is within cookie.domain - if(!http.withinCookieDomain(client.url, cookie)) { - var error = new Error('Http client url scheme is incompatible ' + - 'with cookie secure flag.'); - error.url = client.url; - error.cookie = cookie; - throw error; - } - - // add new cookie - if(!(cookie.name in client.cookies)) { - client.cookies[cookie.name] = {}; - } - client.cookies[cookie.name][cookie.path] = cookie; - rval = true; - - // save cookies - _saveCookies(client); - } - } - - return rval; - }; - - /** - * Gets a cookie by its name. - * - * @param name the name of the cookie to retrieve. - * @param path an optional path for the cookie (if there are multiple - * cookies with the same name but different paths). - * - * @return the cookie or null if not found. - */ - client.getCookie = function(name, path) { - var rval = null; - if(name in client.cookies) { - var paths = client.cookies[name]; - - // get path-specific cookie - if(path) { - if(path in paths) { - rval = paths[path]; - } - } else { - // get first cookie - for(var p in paths) { - rval = paths[p]; - break; - } - } - } - return rval; - }; - - /** - * Removes a cookie. - * - * @param name the name of the cookie to remove. - * @param path an optional path for the cookie (if there are multiple - * cookies with the same name but different paths). - * - * @return true if a cookie was removed, false if not. - */ - client.removeCookie = function(name, path) { - var rval = false; - if(name in client.cookies) { - // delete the specific path - if(path) { - var paths = client.cookies[name]; - if(path in paths) { - rval = true; - delete client.cookies[name][path]; - // clean up entry if empty - var empty = true; - for(var i in client.cookies[name]) { - empty = false; - break; - } - if(empty) { - delete client.cookies[name]; - } - } - } else { - // delete all cookies with the given name - rval = true; - delete client.cookies[name]; - } - } - if(rval) { - // save cookies - _saveCookies(client); - } - return rval; - }; - - /** - * Clears all cookies stored in this client. - */ - client.clearCookies = function() { - client.cookies = {}; - _clearCookies(client); - }; - - if(forge.log) { - forge.log.debug('forge.http', 'created client', options); - } - - return client; -}; - -/** - * Trims the whitespace off of the beginning and end of a string. - * - * @param str the string to trim. - * - * @return the trimmed string. - */ -var _trimString = function(str) { - return str.replace(/^\s*/, '').replace(/\s*$/, ''); -}; - -/** - * Creates an http header object. - * - * @return the http header object. - */ -var _createHeader = function() { - var header = { - fields: {}, - setField: function(name, value) { - // normalize field name, trim value - header.fields[_normalize(name)] = [_trimString('' + value)]; - }, - appendField: function(name, value) { - name = _normalize(name); - if(!(name in header.fields)) { - header.fields[name] = []; - } - header.fields[name].push(_trimString('' + value)); - }, - getField: function(name, index) { - var rval = null; - name = _normalize(name); - if(name in header.fields) { - index = index || 0; - rval = header.fields[name][index]; - } - return rval; - } - }; - return header; -}; - -/** - * Gets the time in utc seconds given a date. - * - * @param d the date to use. - * - * @return the time in utc seconds. - */ -var _getUtcTime = function(d) { - var utc = +d + d.getTimezoneOffset() * 60000; - return Math.floor(+new Date() / 1000); -}; - -/** - * Creates an http request. - * - * @param options: - * version: the version. - * method: the method. - * path: the path. - * body: the body. - * headers: custom header fields to add, - * eg: [{'Content-Length': 0}]. - * - * @return the http request. - */ -http.createRequest = function(options) { - options = options || {}; - var request = _createHeader(); - request.version = options.version || 'HTTP/1.1'; - request.method = options.method || null; - request.path = options.path || null; - request.body = options.body || null; - request.bodyDeflated = false; - request.flashApi = null; - - // add custom headers - var headers = options.headers || []; - if(!forge.util.isArray(headers)) { - headers = [headers]; - } - for(var i = 0; i < headers.length; ++i) { - for(var name in headers[i]) { - request.appendField(name, headers[i][name]); - } - } - - /** - * Adds a cookie to the request 'Cookie' header. - * - * @param cookie a cookie to add. - */ - request.addCookie = function(cookie) { - var value = ''; - var field = request.getField('Cookie'); - if(field !== null) { - // separate cookies by semi-colons - value = field + '; '; - } - - // get current time in utc seconds - var now = _getUtcTime(new Date()); - - // output cookie name and value - value += cookie.name + '=' + cookie.value; - request.setField('Cookie', value); - }; - - /** - * Converts an http request into a string that can be sent as an - * HTTP request. Does not include any data. - * - * @return the string representation of the request. - */ - request.toString = function() { - /* Sample request header: - GET /some/path/?query HTTP/1.1 - Host: www.someurl.com - Connection: close - Accept-Encoding: deflate - Accept: image/gif, text/html - User-Agent: Mozilla 4.0 - */ - - // set default headers - if(request.getField('User-Agent') === null) { - request.setField('User-Agent', 'forge.http 1.0'); - } - if(request.getField('Accept') === null) { - request.setField('Accept', '*/*'); - } - if(request.getField('Connection') === null) { - request.setField('Connection', 'keep-alive'); - request.setField('Keep-Alive', '115'); - } - - // add Accept-Encoding if not specified - if(request.flashApi !== null && - request.getField('Accept-Encoding') === null) { - request.setField('Accept-Encoding', 'deflate'); - } - - // if the body isn't null, deflate it if its larger than 100 bytes - if(request.flashApi !== null && request.body !== null && - request.getField('Content-Encoding') === null && - !request.bodyDeflated && request.body.length > 100) { - // use flash to compress data - request.body = forge.util.deflate(request.flashApi, request.body); - request.bodyDeflated = true; - request.setField('Content-Encoding', 'deflate'); - request.setField('Content-Length', request.body.length); - } else if(request.body !== null) { - // set content length for body - request.setField('Content-Length', request.body.length); - } - - // build start line - var rval = - request.method.toUpperCase() + ' ' + request.path + ' ' + - request.version + '\r\n'; - - // add each header - for(var name in request.fields) { - var fields = request.fields[name]; - for(var i = 0; i < fields.length; ++i) { - rval += name + ': ' + fields[i] + '\r\n'; - } - } - // final terminating CRLF - rval += '\r\n'; - - return rval; - }; - - return request; -}; - -/** - * Creates an empty http response header. - * - * @return the empty http response header. - */ -http.createResponse = function() { - // private vars - var _first = true; - var _chunkSize = 0; - var _chunksFinished = false; - - // create response - var response = _createHeader(); - response.version = null; - response.code = 0; - response.message = null; - response.body = null; - response.headerReceived = false; - response.bodyReceived = false; - response.flashApi = null; - - /** - * Reads a line that ends in CRLF from a byte buffer. - * - * @param b the byte buffer. - * - * @return the line or null if none was found. - */ - var _readCrlf = function(b) { - var line = null; - var i = b.data.indexOf('\r\n', b.read); - if(i != -1) { - // read line, skip CRLF - line = b.getBytes(i - b.read); - b.getBytes(2); - } - return line; - }; - - /** - * Parses a header field and appends it to the response. - * - * @param line the header field line. - */ - var _parseHeader = function(line) { - var tmp = line.indexOf(':'); - var name = line.substring(0, tmp++); - response.appendField( - name, (tmp < line.length) ? line.substring(tmp) : ''); - }; - - /** - * Reads an http response header from a buffer of bytes. - * - * @param b the byte buffer to parse the header from. - * - * @return true if the whole header was read, false if not. - */ - response.readHeader = function(b) { - // read header lines (each ends in CRLF) - var line = ''; - while(!response.headerReceived && line !== null) { - line = _readCrlf(b); - if(line !== null) { - // parse first line - if(_first) { - _first = false; - var tmp = line.split(' '); - if(tmp.length >= 3) { - response.version = tmp[0]; - response.code = parseInt(tmp[1], 10); - response.message = tmp.slice(2).join(' '); - } else { - // invalid header - var error = new Error('Invalid http response header.'); - error.details = {'line': line}; - throw error; - } - } else if(line.length === 0) { - // handle final line, end of header - response.headerReceived = true; - } else { - _parseHeader(line); - } - } - } - - return response.headerReceived; - }; - - /** - * Reads some chunked http response entity-body from the given buffer of - * bytes. - * - * @param b the byte buffer to read from. - * - * @return true if the whole body was read, false if not. - */ - var _readChunkedBody = function(b) { - /* Chunked transfer-encoding sends data in a series of chunks, - followed by a set of 0-N http trailers. - The format is as follows: - - chunk-size (in hex) CRLF - chunk data (with "chunk-size" many bytes) CRLF - ... (N many chunks) - chunk-size (of 0 indicating the last chunk) CRLF - N many http trailers followed by CRLF - blank line + CRLF (terminates the trailers) - - If there are no http trailers, then after the chunk-size of 0, - there is still a single CRLF (indicating the blank line + CRLF - that terminates the trailers). In other words, you always terminate - the trailers with blank line + CRLF, regardless of 0-N trailers. */ - - /* From RFC-2616, section 3.6.1, here is the pseudo-code for - implementing chunked transfer-encoding: - - length := 0 - read chunk-size, chunk-extension (if any) and CRLF - while (chunk-size > 0) { - read chunk-data and CRLF - append chunk-data to entity-body - length := length + chunk-size - read chunk-size and CRLF - } - read entity-header - while (entity-header not empty) { - append entity-header to existing header fields - read entity-header - } - Content-Length := length - Remove "chunked" from Transfer-Encoding - */ - - var line = ''; - while(line !== null && b.length() > 0) { - // if in the process of reading a chunk - if(_chunkSize > 0) { - // if there are not enough bytes to read chunk and its - // trailing CRLF, we must wait for more data to be received - if(_chunkSize + 2 > b.length()) { - break; - } - - // read chunk data, skip CRLF - response.body += b.getBytes(_chunkSize); - b.getBytes(2); - _chunkSize = 0; - } else if(!_chunksFinished) { - // more chunks, read next chunk-size line - line = _readCrlf(b); - if(line !== null) { - // parse chunk-size (ignore any chunk extension) - _chunkSize = parseInt(line.split(';', 1)[0], 16); - _chunksFinished = (_chunkSize === 0); - } - } else { - // chunks finished, read next trailer - line = _readCrlf(b); - while(line !== null) { - if(line.length > 0) { - // parse trailer - _parseHeader(line); - // read next trailer - line = _readCrlf(b); - } else { - // body received - response.bodyReceived = true; - line = null; - } - } - } - } - - return response.bodyReceived; - }; - - /** - * Reads an http response body from a buffer of bytes. - * - * @param b the byte buffer to read from. - * - * @return true if the whole body was read, false if not. - */ - response.readBody = function(b) { - var contentLength = response.getField('Content-Length'); - var transferEncoding = response.getField('Transfer-Encoding'); - if(contentLength !== null) { - contentLength = parseInt(contentLength); - } - - // read specified length - if(contentLength !== null && contentLength >= 0) { - response.body = response.body || ''; - response.body += b.getBytes(contentLength); - response.bodyReceived = (response.body.length === contentLength); - } else if(transferEncoding !== null) { - // read chunked encoding - if(transferEncoding.indexOf('chunked') != -1) { - response.body = response.body || ''; - _readChunkedBody(b); - } else { - var error = new Error('Unknown Transfer-Encoding.'); - error.details = {'transferEncoding': transferEncoding}; - throw error; - } - } else if((contentLength !== null && contentLength < 0) || - (contentLength === null && - response.getField('Content-Type') !== null)) { - // read all data in the buffer - response.body = response.body || ''; - response.body += b.getBytes(); - response.readBodyUntilClose = true; - } else { - // no body - response.body = null; - response.bodyReceived = true; - } - - if(response.bodyReceived) { - response.time = +new Date() - response.time; - } - - if(response.flashApi !== null && - response.bodyReceived && response.body !== null && - response.getField('Content-Encoding') === 'deflate') { - // inflate using flash api - response.body = forge.util.inflate( - response.flashApi, response.body); - } - - return response.bodyReceived; - }; - - /** - * Parses an array of cookies from the 'Set-Cookie' field, if present. - * - * @return the array of cookies. - */ - response.getCookies = function() { - var rval = []; - - // get Set-Cookie field - if('Set-Cookie' in response.fields) { - var field = response.fields['Set-Cookie']; - - // get current local time in seconds - var now = +new Date() / 1000; - - // regex for parsing 'name1=value1; name2=value2; name3' - var regex = /\s*([^=]*)=?([^;]*)(;|$)/g; - - // examples: - // Set-Cookie: cookie1_name=cookie1_value; max-age=0; path=/ - // Set-Cookie: c2=v2; expires=Thu, 21-Aug-2008 23:47:25 GMT; path=/ - for(var i = 0; i < field.length; ++i) { - var fv = field[i]; - var m; - regex.lastIndex = 0; - var first = true; - var cookie = {}; - do { - m = regex.exec(fv); - if(m !== null) { - var name = _trimString(m[1]); - var value = _trimString(m[2]); - - // cookie_name=value - if(first) { - cookie.name = name; - cookie.value = value; - first = false; - } else { - // property_name=value - name = name.toLowerCase(); - switch(name) { - case 'expires': - // replace hyphens w/spaces so date will parse - value = value.replace(/-/g, ' '); - var secs = Date.parse(value) / 1000; - cookie.maxAge = Math.max(0, secs - now); - break; - case 'max-age': - cookie.maxAge = parseInt(value, 10); - break; - case 'secure': - cookie.secure = true; - break; - case 'httponly': - cookie.httpOnly = true; - break; - default: - if(name !== '') { - cookie[name] = value; - } - } - } - } - } while(m !== null && m[0] !== ''); - rval.push(cookie); - } - } - - return rval; - }; - - /** - * Converts an http response into a string that can be sent as an - * HTTP response. Does not include any data. - * - * @return the string representation of the response. - */ - response.toString = function() { - /* Sample response header: - HTTP/1.0 200 OK - Host: www.someurl.com - Connection: close - */ - - // build start line - var rval = - response.version + ' ' + response.code + ' ' + response.message + '\r\n'; - - // add each header - for(var name in response.fields) { - var fields = response.fields[name]; - for(var i = 0; i < fields.length; ++i) { - rval += name + ': ' + fields[i] + '\r\n'; - } - } - // final terminating CRLF - rval += '\r\n'; - - return rval; - }; - - return response; -}; - -/** - * Parses the scheme, host, and port from an http(s) url. - * - * @param str the url string. - * - * @return the parsed url object or null if the url is invalid. - */ -http.parseUrl = forge.util.parseUrl; - -/** - * Returns true if the given url is within the given cookie's domain. - * - * @param url the url to check. - * @param cookie the cookie or cookie domain to check. - */ -http.withinCookieDomain = function(url, cookie) { - var rval = false; - - // cookie may be null, a cookie object, or a domain string - var domain = (cookie === null || typeof cookie === 'string') ? - cookie : cookie.domain; - - // any domain will do - if(domain === null) { - rval = true; - } else if(domain.charAt(0) === '.') { - // ensure domain starts with a '.' - // parse URL as necessary - if(typeof url === 'string') { - url = http.parseUrl(url); - } - - // add '.' to front of URL host to match against domain - var host = '.' + url.host; - - // if the host ends with domain then it falls within it - var idx = host.lastIndexOf(domain); - if(idx !== -1 && (idx + domain.length === host.length)) { - rval = true; - } - } - - return rval; -}; diff --git a/node_modules/node-forge/lib/index.all.js b/node_modules/node-forge/lib/index.all.js deleted file mode 100644 index 22ba72b6..00000000 --- a/node_modules/node-forge/lib/index.all.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Node.js module for Forge with extra utils and networking. - * - * @author Dave Longley - * - * Copyright 2011-2016 Digital Bazaar, Inc. - */ -module.exports = require('./forge'); -// require core forge -require('./index'); -// additional utils and networking support -require('./form'); -require('./socket'); -require('./tlssocket'); -require('./http'); -require('./xhr'); diff --git a/node_modules/node-forge/lib/index.js b/node_modules/node-forge/lib/index.js deleted file mode 100644 index ea8c14cf..00000000 --- a/node_modules/node-forge/lib/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Node.js module for Forge. - * - * @author Dave Longley - * - * Copyright 2011-2016 Digital Bazaar, Inc. - */ -module.exports = require('./forge'); -require('./aes'); -require('./aesCipherSuites'); -require('./asn1'); -require('./cipher'); -require('./debug'); -require('./des'); -require('./ed25519'); -require('./hmac'); -require('./kem'); -require('./log'); -require('./md.all'); -require('./mgf1'); -require('./pbkdf2'); -require('./pem'); -require('./pkcs1'); -require('./pkcs12'); -require('./pkcs7'); -require('./pki'); -require('./prime'); -require('./prng'); -require('./pss'); -require('./random'); -require('./rc2'); -require('./ssh'); -require('./task'); -require('./tls'); -require('./util'); diff --git a/node_modules/node-forge/lib/jsbn.js b/node_modules/node-forge/lib/jsbn.js deleted file mode 100644 index 11f965c5..00000000 --- a/node_modules/node-forge/lib/jsbn.js +++ /dev/null @@ -1,1264 +0,0 @@ -// Copyright (c) 2005 Tom Wu -// All Rights Reserved. -// See "LICENSE" for details. - -// Basic JavaScript BN library - subset useful for RSA encryption. - -/* -Licensing (LICENSE) -------------------- - -This software is covered under the following copyright: -*/ -/* - * Copyright (c) 2003-2005 Tom Wu - * All Rights Reserved. - * - * 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" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF - * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * In addition, the following condition applies: - * - * All redistributions must retain an intact copy of this copyright notice - * and disclaimer. - */ -/* -Address all questions regarding this license to: - - Tom Wu - tjw@cs.Stanford.EDU -*/ -var forge = require('./forge'); - -module.exports = forge.jsbn = forge.jsbn || {}; - -// Bits per digit -var dbits; - -// JavaScript engine analysis -var canary = 0xdeadbeefcafe; -var j_lm = ((canary&0xffffff)==0xefcafe); - -// (public) Constructor -function BigInteger(a,b,c) { - this.data = []; - if(a != null) - if("number" == typeof a) this.fromNumber(a,b,c); - else if(b == null && "string" != typeof a) this.fromString(a,256); - else this.fromString(a,b); -} -forge.jsbn.BigInteger = BigInteger; - -// return new, unset BigInteger -function nbi() { return new BigInteger(null); } - -// am: Compute w_j += (x*this_i), propagate carries, -// c is initial carry, returns final carry. -// c < 3*dvalue, x < 2*dvalue, this_i < dvalue -// We need to select the fastest one that works in this environment. - -// am1: use a single mult and divide to get the high bits, -// max digit bits should be 26 because -// max internal value = 2*dvalue^2-2*dvalue (< 2^53) -function am1(i,x,w,j,c,n) { - while(--n >= 0) { - var v = x*this.data[i++]+w.data[j]+c; - c = Math.floor(v/0x4000000); - w.data[j++] = v&0x3ffffff; - } - return c; -} -// am2 avoids a big mult-and-extract completely. -// Max digit bits should be <= 30 because we do bitwise ops -// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) -function am2(i,x,w,j,c,n) { - var xl = x&0x7fff, xh = x>>15; - while(--n >= 0) { - var l = this.data[i]&0x7fff; - var h = this.data[i++]>>15; - var m = xh*l+h*xl; - l = xl*l+((m&0x7fff)<<15)+w.data[j]+(c&0x3fffffff); - c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); - w.data[j++] = l&0x3fffffff; - } - return c; -} -// Alternately, set max digit bits to 28 since some -// browsers slow down when dealing with 32-bit numbers. -function am3(i,x,w,j,c,n) { - var xl = x&0x3fff, xh = x>>14; - while(--n >= 0) { - var l = this.data[i]&0x3fff; - var h = this.data[i++]>>14; - var m = xh*l+h*xl; - l = xl*l+((m&0x3fff)<<14)+w.data[j]+c; - c = (l>>28)+(m>>14)+xh*h; - w.data[j++] = l&0xfffffff; - } - return c; -} - -// node.js (no browser) -if(typeof(navigator) === 'undefined') -{ - BigInteger.prototype.am = am3; - dbits = 28; -} else if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { - BigInteger.prototype.am = am2; - dbits = 30; -} else if(j_lm && (navigator.appName != "Netscape")) { - BigInteger.prototype.am = am1; - dbits = 26; -} else { // Mozilla/Netscape seems to prefer am3 - BigInteger.prototype.am = am3; - dbits = 28; -} - -BigInteger.prototype.DB = dbits; -BigInteger.prototype.DM = ((1<= 0; --i) r.data[i] = this.data[i]; - r.t = this.t; - r.s = this.s; -} - -// (protected) set from integer value x, -DV <= x < DV -function bnpFromInt(x) { - this.t = 1; - this.s = (x<0)?-1:0; - if(x > 0) this.data[0] = x; - else if(x < -1) this.data[0] = x+this.DV; - else this.t = 0; -} - -// return bigint initialized to value -function nbv(i) { var r = nbi(); r.fromInt(i); return r; } - -// (protected) set from string and radix -function bnpFromString(s,b) { - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 256) k = 8; // byte array - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else { this.fromRadix(s,b); return; } - this.t = 0; - this.s = 0; - var i = s.length, mi = false, sh = 0; - while(--i >= 0) { - var x = (k==8)?s[i]&0xff:intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-") mi = true; - continue; - } - mi = false; - if(sh == 0) - this.data[this.t++] = x; - else if(sh+k > this.DB) { - this.data[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); - } else - this.data[this.t-1] |= x<= this.DB) sh -= this.DB; - } - if(k == 8 && (s[0]&0x80) != 0) { - this.s = -1; - if(sh > 0) this.data[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this.data[this.t-1] == c) --this.t; -} - -// (public) return string representation in given radix -function bnToString(b) { - if(this.s < 0) return "-"+this.negate().toString(b); - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else return this.toRadix(b); - var km = (1< 0) { - if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); } - while(i >= 0) { - if(p < k) { - d = (this.data[i]&((1<>(p+=this.DB-k); - } else { - d = (this.data[i]>>(p-=k))&km; - if(p <= 0) { p += this.DB; --i; } - } - if(d > 0) m = true; - if(m) r += int2char(d); - } - } - return m?r:"0"; -} - -// (public) -this -function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } - -// (public) |this| -function bnAbs() { return (this.s<0)?this.negate():this; } - -// (public) return + if this > a, - if this < a, 0 if equal -function bnCompareTo(a) { - var r = this.s-a.s; - if(r != 0) return r; - var i = this.t; - r = i-a.t; - if(r != 0) return (this.s<0)?-r:r; - while(--i >= 0) if((r=this.data[i]-a.data[i]) != 0) return r; - return 0; -} - -// returns bit length of the integer x -function nbits(x) { - var r = 1, t; - if((t=x>>>16) != 0) { x = t; r += 16; } - if((t=x>>8) != 0) { x = t; r += 8; } - if((t=x>>4) != 0) { x = t; r += 4; } - if((t=x>>2) != 0) { x = t; r += 2; } - if((t=x>>1) != 0) { x = t; r += 1; } - return r; -} - -// (public) return the number of bits in "this" -function bnBitLength() { - if(this.t <= 0) return 0; - return this.DB*(this.t-1)+nbits(this.data[this.t-1]^(this.s&this.DM)); -} - -// (protected) r = this << n*DB -function bnpDLShiftTo(n,r) { - var i; - for(i = this.t-1; i >= 0; --i) r.data[i+n] = this.data[i]; - for(i = n-1; i >= 0; --i) r.data[i] = 0; - r.t = this.t+n; - r.s = this.s; -} - -// (protected) r = this >> n*DB -function bnpDRShiftTo(n,r) { - for(var i = n; i < this.t; ++i) r.data[i-n] = this.data[i]; - r.t = Math.max(this.t-n,0); - r.s = this.s; -} - -// (protected) r = this << n -function bnpLShiftTo(n,r) { - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<= 0; --i) { - r.data[i+ds+1] = (this.data[i]>>cbs)|c; - c = (this.data[i]&bm)<= 0; --i) r.data[i] = 0; - r.data[ds] = c; - r.t = this.t+ds+1; - r.s = this.s; - r.clamp(); -} - -// (protected) r = this >> n -function bnpRShiftTo(n,r) { - r.s = this.s; - var ds = Math.floor(n/this.DB); - if(ds >= this.t) { r.t = 0; return; } - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<>bs; - for(var i = ds+1; i < this.t; ++i) { - r.data[i-ds-1] |= (this.data[i]&bm)<>bs; - } - if(bs > 0) r.data[this.t-ds-1] |= (this.s&bm)<>= this.DB; - } - if(a.t < this.t) { - c -= a.s; - while(i < this.t) { - c += this.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; - } else { - c += this.s; - while(i < a.t) { - c -= a.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c -= a.s; - } - r.s = (c<0)?-1:0; - if(c < -1) r.data[i++] = this.DV+c; - else if(c > 0) r.data[i++] = c; - r.t = i; - r.clamp(); -} - -// (protected) r = this * a, r != this,a (HAC 14.12) -// "this" should be the larger one if appropriate. -function bnpMultiplyTo(a,r) { - var x = this.abs(), y = a.abs(); - var i = x.t; - r.t = i+y.t; - while(--i >= 0) r.data[i] = 0; - for(i = 0; i < y.t; ++i) r.data[i+x.t] = x.am(0,y.data[i],r,i,0,x.t); - r.s = 0; - r.clamp(); - if(this.s != a.s) BigInteger.ZERO.subTo(r,r); -} - -// (protected) r = this^2, r != this (HAC 14.16) -function bnpSquareTo(r) { - var x = this.abs(); - var i = r.t = 2*x.t; - while(--i >= 0) r.data[i] = 0; - for(i = 0; i < x.t-1; ++i) { - var c = x.am(i,x.data[i],r,2*i,0,1); - if((r.data[i+x.t]+=x.am(i+1,2*x.data[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { - r.data[i+x.t] -= x.DV; - r.data[i+x.t+1] = 1; - } - } - if(r.t > 0) r.data[r.t-1] += x.am(i,x.data[i],r,2*i,0,1); - r.s = 0; - r.clamp(); -} - -// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) -// r != q, this != m. q or r may be null. -function bnpDivRemTo(m,q,r) { - var pm = m.abs(); - if(pm.t <= 0) return; - var pt = this.abs(); - if(pt.t < pm.t) { - if(q != null) q.fromInt(0); - if(r != null) this.copyTo(r); - return; - } - if(r == null) r = nbi(); - var y = nbi(), ts = this.s, ms = m.s; - var nsh = this.DB-nbits(pm.data[pm.t-1]); // normalize modulus - if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } - var ys = y.t; - var y0 = y.data[ys-1]; - if(y0 == 0) return; - var yt = y0*(1<1)?y.data[ys-2]>>this.F2:0); - var d1 = this.FV/yt, d2 = (1<= 0) { - r.data[r.t++] = 1; - r.subTo(t,r); - } - BigInteger.ONE.dlShiftTo(ys,t); - t.subTo(y,y); // "negative" y so we can replace sub with am later - while(y.t < ys) y.data[y.t++] = 0; - while(--j >= 0) { - // Estimate quotient digit - var qd = (r.data[--i]==y0)?this.DM:Math.floor(r.data[i]*d1+(r.data[i-1]+e)*d2); - if((r.data[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out - y.dlShiftTo(j,t); - r.subTo(t,r); - while(r.data[i] < --qd) r.subTo(t,r); - } - } - if(q != null) { - r.drShiftTo(ys,q); - if(ts != ms) BigInteger.ZERO.subTo(q,q); - } - r.t = ys; - r.clamp(); - if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder - if(ts < 0) BigInteger.ZERO.subTo(r,r); -} - -// (public) this mod a -function bnMod(a) { - var r = nbi(); - this.abs().divRemTo(a,null,r); - if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); - return r; -} - -// Modular reduction using "classic" algorithm -function Classic(m) { this.m = m; } -function cConvert(x) { - if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); - else return x; -} -function cRevert(x) { return x; } -function cReduce(x) { x.divRemTo(this.m,null,x); } -function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } -function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - -Classic.prototype.convert = cConvert; -Classic.prototype.revert = cRevert; -Classic.prototype.reduce = cReduce; -Classic.prototype.mulTo = cMulTo; -Classic.prototype.sqrTo = cSqrTo; - -// (protected) return "-1/this % 2^DB"; useful for Mont. reduction -// justification: -// xy == 1 (mod m) -// xy = 1+km -// xy(2-xy) = (1+km)(1-km) -// x[y(2-xy)] = 1-k^2m^2 -// x[y(2-xy)] == 1 (mod m^2) -// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 -// should reduce x and y(2-xy) by m^2 at each step to keep size bounded. -// JS multiply "overflows" differently from C/C++, so care is needed here. -function bnpInvDigit() { - if(this.t < 1) return 0; - var x = this.data[0]; - if((x&1) == 0) return 0; - var y = x&3; // y == 1/x mod 2^2 - y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 - y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 - y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 - // last step - calculate inverse mod DV directly; - // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints - y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits - // we really want the negative inverse, and -DV < y < DV - return (y>0)?this.DV-y:-y; -} - -// Montgomery reduction -function Montgomery(m) { - this.m = m; - this.mp = m.invDigit(); - this.mpl = this.mp&0x7fff; - this.mph = this.mp>>15; - this.um = (1<<(m.DB-15))-1; - this.mt2 = 2*m.t; -} - -// xR mod m -function montConvert(x) { - var r = nbi(); - x.abs().dlShiftTo(this.m.t,r); - r.divRemTo(this.m,null,r); - if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); - return r; -} - -// x/R mod m -function montRevert(x) { - var r = nbi(); - x.copyTo(r); - this.reduce(r); - return r; -} - -// x = x/R mod m (HAC 14.32) -function montReduce(x) { - while(x.t <= this.mt2) // pad x so am has enough room later - x.data[x.t++] = 0; - for(var i = 0; i < this.m.t; ++i) { - // faster way of calculating u0 = x.data[i]*mp mod DV - var j = x.data[i]&0x7fff; - var u0 = (j*this.mpl+(((j*this.mph+(x.data[i]>>15)*this.mpl)&this.um)<<15))&x.DM; - // use am to combine the multiply-shift-add into one call - j = i+this.m.t; - x.data[j] += this.m.am(0,u0,x,i,0,this.m.t); - // propagate carry - while(x.data[j] >= x.DV) { x.data[j] -= x.DV; x.data[++j]++; } - } - x.clamp(); - x.drShiftTo(this.m.t,x); - if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); -} - -// r = "x^2/R mod m"; x != r -function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - -// r = "xy/R mod m"; x,y != r -function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - -Montgomery.prototype.convert = montConvert; -Montgomery.prototype.revert = montRevert; -Montgomery.prototype.reduce = montReduce; -Montgomery.prototype.mulTo = montMulTo; -Montgomery.prototype.sqrTo = montSqrTo; - -// (protected) true iff this is even -function bnpIsEven() { return ((this.t>0)?(this.data[0]&1):this.s) == 0; } - -// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) -function bnpExp(e,z) { - if(e > 0xffffffff || e < 1) return BigInteger.ONE; - var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; - g.copyTo(r); - while(--i >= 0) { - z.sqrTo(r,r2); - if((e&(1< 0) z.mulTo(r2,g,r); - else { var t = r; r = r2; r2 = t; } - } - return z.revert(r); -} - -// (public) this^e % m, 0 <= e < 2^32 -function bnModPowInt(e,m) { - var z; - if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); - return this.exp(e,z); -} - -// protected -BigInteger.prototype.copyTo = bnpCopyTo; -BigInteger.prototype.fromInt = bnpFromInt; -BigInteger.prototype.fromString = bnpFromString; -BigInteger.prototype.clamp = bnpClamp; -BigInteger.prototype.dlShiftTo = bnpDLShiftTo; -BigInteger.prototype.drShiftTo = bnpDRShiftTo; -BigInteger.prototype.lShiftTo = bnpLShiftTo; -BigInteger.prototype.rShiftTo = bnpRShiftTo; -BigInteger.prototype.subTo = bnpSubTo; -BigInteger.prototype.multiplyTo = bnpMultiplyTo; -BigInteger.prototype.squareTo = bnpSquareTo; -BigInteger.prototype.divRemTo = bnpDivRemTo; -BigInteger.prototype.invDigit = bnpInvDigit; -BigInteger.prototype.isEven = bnpIsEven; -BigInteger.prototype.exp = bnpExp; - -// public -BigInteger.prototype.toString = bnToString; -BigInteger.prototype.negate = bnNegate; -BigInteger.prototype.abs = bnAbs; -BigInteger.prototype.compareTo = bnCompareTo; -BigInteger.prototype.bitLength = bnBitLength; -BigInteger.prototype.mod = bnMod; -BigInteger.prototype.modPowInt = bnModPowInt; - -// "constants" -BigInteger.ZERO = nbv(0); -BigInteger.ONE = nbv(1); - -// jsbn2 lib - -//Copyright (c) 2005-2009 Tom Wu -//All Rights Reserved. -//See "LICENSE" for details (See jsbn.js for LICENSE). - -//Extended JavaScript BN functions, required for RSA private ops. - -//Version 1.1: new BigInteger("0", 10) returns "proper" zero - -//(public) -function bnClone() { var r = nbi(); this.copyTo(r); return r; } - -//(public) return value as integer -function bnIntValue() { -if(this.s < 0) { - if(this.t == 1) return this.data[0]-this.DV; - else if(this.t == 0) return -1; -} else if(this.t == 1) return this.data[0]; -else if(this.t == 0) return 0; -// assumes 16 < DB < 32 -return ((this.data[1]&((1<<(32-this.DB))-1))<>24; } - -//(public) return value as short (assumes DB>=16) -function bnShortValue() { return (this.t==0)?this.s:(this.data[0]<<16)>>16; } - -//(protected) return x s.t. r^x < DV -function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } - -//(public) 0 if this == 0, 1 if this > 0 -function bnSigNum() { -if(this.s < 0) return -1; -else if(this.t <= 0 || (this.t == 1 && this.data[0] <= 0)) return 0; -else return 1; -} - -//(protected) convert to radix string -function bnpToRadix(b) { -if(b == null) b = 10; -if(this.signum() == 0 || b < 2 || b > 36) return "0"; -var cs = this.chunkSize(b); -var a = Math.pow(b,cs); -var d = nbv(a), y = nbi(), z = nbi(), r = ""; -this.divRemTo(d,y,z); -while(y.signum() > 0) { - r = (a+z.intValue()).toString(b).substr(1) + r; - y.divRemTo(d,y,z); -} -return z.intValue().toString(b) + r; -} - -//(protected) convert from radix string -function bnpFromRadix(s,b) { -this.fromInt(0); -if(b == null) b = 10; -var cs = this.chunkSize(b); -var d = Math.pow(b,cs), mi = false, j = 0, w = 0; -for(var i = 0; i < s.length; ++i) { - var x = intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-" && this.signum() == 0) mi = true; - continue; - } - w = b*w+x; - if(++j >= cs) { - this.dMultiply(d); - this.dAddOffset(w,0); - j = 0; - w = 0; - } -} -if(j > 0) { - this.dMultiply(Math.pow(b,j)); - this.dAddOffset(w,0); -} -if(mi) BigInteger.ZERO.subTo(this,this); -} - -//(protected) alternate constructor -function bnpFromNumber(a,b,c) { -if("number" == typeof b) { - // new BigInteger(int,int,RNG) - if(a < 2) this.fromInt(1); - else { - this.fromNumber(a,c); - if(!this.testBit(a-1)) // force MSB set - this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); - if(this.isEven()) this.dAddOffset(1,0); // force odd - while(!this.isProbablePrime(b)) { - this.dAddOffset(2,0); - if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); - } - } -} else { - // new BigInteger(int,RNG) - var x = new Array(), t = a&7; - x.length = (a>>3)+1; - b.nextBytes(x); - if(t > 0) x[0] &= ((1< 0) { - if(p < this.DB && (d = this.data[i]>>p) != (this.s&this.DM)>>p) - r[k++] = d|(this.s<<(this.DB-p)); - while(i >= 0) { - if(p < 8) { - d = (this.data[i]&((1<>(p+=this.DB-8); - } else { - d = (this.data[i]>>(p-=8))&0xff; - if(p <= 0) { p += this.DB; --i; } - } - if((d&0x80) != 0) d |= -256; - if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; - if(k > 0 || d != this.s) r[k++] = d; - } -} -return r; -} - -function bnEquals(a) { return(this.compareTo(a)==0); } -function bnMin(a) { return(this.compareTo(a)<0)?this:a; } -function bnMax(a) { return(this.compareTo(a)>0)?this:a; } - -//(protected) r = this op a (bitwise) -function bnpBitwiseTo(a,op,r) { -var i, f, m = Math.min(a.t,this.t); -for(i = 0; i < m; ++i) r.data[i] = op(this.data[i],a.data[i]); -if(a.t < this.t) { - f = a.s&this.DM; - for(i = m; i < this.t; ++i) r.data[i] = op(this.data[i],f); - r.t = this.t; -} else { - f = this.s&this.DM; - for(i = m; i < a.t; ++i) r.data[i] = op(f,a.data[i]); - r.t = a.t; -} -r.s = op(this.s,a.s); -r.clamp(); -} - -//(public) this & a -function op_and(x,y) { return x&y; } -function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } - -//(public) this | a -function op_or(x,y) { return x|y; } -function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } - -//(public) this ^ a -function op_xor(x,y) { return x^y; } -function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } - -//(public) this & ~a -function op_andnot(x,y) { return x&~y; } -function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } - -//(public) ~this -function bnNot() { -var r = nbi(); -for(var i = 0; i < this.t; ++i) r.data[i] = this.DM&~this.data[i]; -r.t = this.t; -r.s = ~this.s; -return r; -} - -//(public) this << n -function bnShiftLeft(n) { -var r = nbi(); -if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); -return r; -} - -//(public) this >> n -function bnShiftRight(n) { -var r = nbi(); -if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); -return r; -} - -//return index of lowest 1-bit in x, x < 2^31 -function lbit(x) { -if(x == 0) return -1; -var r = 0; -if((x&0xffff) == 0) { x >>= 16; r += 16; } -if((x&0xff) == 0) { x >>= 8; r += 8; } -if((x&0xf) == 0) { x >>= 4; r += 4; } -if((x&3) == 0) { x >>= 2; r += 2; } -if((x&1) == 0) ++r; -return r; -} - -//(public) returns index of lowest 1-bit (or -1 if none) -function bnGetLowestSetBit() { -for(var i = 0; i < this.t; ++i) - if(this.data[i] != 0) return i*this.DB+lbit(this.data[i]); -if(this.s < 0) return this.t*this.DB; -return -1; -} - -//return number of 1 bits in x -function cbit(x) { -var r = 0; -while(x != 0) { x &= x-1; ++r; } -return r; -} - -//(public) return number of set bits -function bnBitCount() { -var r = 0, x = this.s&this.DM; -for(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x); -return r; -} - -//(public) true iff nth bit is set -function bnTestBit(n) { -var j = Math.floor(n/this.DB); -if(j >= this.t) return(this.s!=0); -return((this.data[j]&(1<<(n%this.DB)))!=0); -} - -//(protected) this op (1<>= this.DB; -} -if(a.t < this.t) { - c += a.s; - while(i < this.t) { - c += this.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; -} else { - c += this.s; - while(i < a.t) { - c += a.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c += a.s; -} -r.s = (c<0)?-1:0; -if(c > 0) r.data[i++] = c; -else if(c < -1) r.data[i++] = this.DV+c; -r.t = i; -r.clamp(); -} - -//(public) this + a -function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } - -//(public) this - a -function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } - -//(public) this * a -function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } - -//(public) this / a -function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } - -//(public) this % a -function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } - -//(public) [this/a,this%a] -function bnDivideAndRemainder(a) { -var q = nbi(), r = nbi(); -this.divRemTo(a,q,r); -return new Array(q,r); -} - -//(protected) this *= n, this >= 0, 1 < n < DV -function bnpDMultiply(n) { -this.data[this.t] = this.am(0,n-1,this,0,0,this.t); -++this.t; -this.clamp(); -} - -//(protected) this += n << w words, this >= 0 -function bnpDAddOffset(n,w) { -if(n == 0) return; -while(this.t <= w) this.data[this.t++] = 0; -this.data[w] += n; -while(this.data[w] >= this.DV) { - this.data[w] -= this.DV; - if(++w >= this.t) this.data[this.t++] = 0; - ++this.data[w]; -} -} - -//A "null" reducer -function NullExp() {} -function nNop(x) { return x; } -function nMulTo(x,y,r) { x.multiplyTo(y,r); } -function nSqrTo(x,r) { x.squareTo(r); } - -NullExp.prototype.convert = nNop; -NullExp.prototype.revert = nNop; -NullExp.prototype.mulTo = nMulTo; -NullExp.prototype.sqrTo = nSqrTo; - -//(public) this^e -function bnPow(e) { return this.exp(e,new NullExp()); } - -//(protected) r = lower n words of "this * a", a.t <= n -//"this" should be the larger one if appropriate. -function bnpMultiplyLowerTo(a,n,r) { -var i = Math.min(this.t+a.t,n); -r.s = 0; // assumes a,this >= 0 -r.t = i; -while(i > 0) r.data[--i] = 0; -var j; -for(j = r.t-this.t; i < j; ++i) r.data[i+this.t] = this.am(0,a.data[i],r,i,0,this.t); -for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a.data[i],r,i,0,n-i); -r.clamp(); -} - -//(protected) r = "this * a" without lower n words, n > 0 -//"this" should be the larger one if appropriate. -function bnpMultiplyUpperTo(a,n,r) { ---n; -var i = r.t = this.t+a.t-n; -r.s = 0; // assumes a,this >= 0 -while(--i >= 0) r.data[i] = 0; -for(i = Math.max(n-this.t,0); i < a.t; ++i) - r.data[this.t+i-n] = this.am(n-i,a.data[i],r,0,0,this.t+i-n); -r.clamp(); -r.drShiftTo(1,r); -} - -//Barrett modular reduction -function Barrett(m) { -// setup Barrett -this.r2 = nbi(); -this.q3 = nbi(); -BigInteger.ONE.dlShiftTo(2*m.t,this.r2); -this.mu = this.r2.divide(m); -this.m = m; -} - -function barrettConvert(x) { -if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); -else if(x.compareTo(this.m) < 0) return x; -else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } -} - -function barrettRevert(x) { return x; } - -//x = x mod m (HAC 14.42) -function barrettReduce(x) { -x.drShiftTo(this.m.t-1,this.r2); -if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } -this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); -this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); -while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); -x.subTo(this.r2,x); -while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); -} - -//r = x^2 mod m; x != r -function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - -//r = x*y mod m; x,y != r -function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - -Barrett.prototype.convert = barrettConvert; -Barrett.prototype.revert = barrettRevert; -Barrett.prototype.reduce = barrettReduce; -Barrett.prototype.mulTo = barrettMulTo; -Barrett.prototype.sqrTo = barrettSqrTo; - -//(public) this^e % m (HAC 14.85) -function bnModPow(e,m) { -var i = e.bitLength(), k, r = nbv(1), z; -if(i <= 0) return r; -else if(i < 18) k = 1; -else if(i < 48) k = 3; -else if(i < 144) k = 4; -else if(i < 768) k = 5; -else k = 6; -if(i < 8) - z = new Classic(m); -else if(m.isEven()) - z = new Barrett(m); -else - z = new Montgomery(m); - -// precomputation -var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { - var g2 = nbi(); - z.sqrTo(g[1],g2); - while(n <= km) { - g[n] = nbi(); - z.mulTo(g2,g[n-2],g[n]); - n += 2; - } -} - -var j = e.t-1, w, is1 = true, r2 = nbi(), t; -i = nbits(e.data[j])-1; -while(j >= 0) { - if(i >= k1) w = (e.data[j]>>(i-k1))&km; - else { - w = (e.data[j]&((1<<(i+1))-1))<<(k1-i); - if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1); - } - - n = k; - while((w&1) == 0) { w >>= 1; --n; } - if((i -= n) < 0) { i += this.DB; --j; } - if(is1) { // ret == 1, don't bother squaring or multiplying it - g[w].copyTo(r); - is1 = false; - } else { - while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } - if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } - z.mulTo(r2,g[w],r); - } - - while(j >= 0 && (e.data[j]&(1< 0) { - x.rShiftTo(g,x); - y.rShiftTo(g,y); -} -while(x.signum() > 0) { - if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); - if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); - if(x.compareTo(y) >= 0) { - x.subTo(y,x); - x.rShiftTo(1,x); - } else { - y.subTo(x,y); - y.rShiftTo(1,y); - } -} -if(g > 0) y.lShiftTo(g,y); -return y; -} - -//(protected) this % n, n < 2^26 -function bnpModInt(n) { -if(n <= 0) return 0; -var d = this.DV%n, r = (this.s<0)?n-1:0; -if(this.t > 0) - if(d == 0) r = this.data[0]%n; - else for(var i = this.t-1; i >= 0; --i) r = (d*r+this.data[i])%n; -return r; -} - -//(public) 1/this % m (HAC 14.61) -function bnModInverse(m) { -var ac = m.isEven(); -if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; -var u = m.clone(), v = this.clone(); -var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); -while(u.signum() != 0) { - while(u.isEven()) { - u.rShiftTo(1,u); - if(ac) { - if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } - a.rShiftTo(1,a); - } else if(!b.isEven()) b.subTo(m,b); - b.rShiftTo(1,b); - } - while(v.isEven()) { - v.rShiftTo(1,v); - if(ac) { - if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } - c.rShiftTo(1,c); - } else if(!d.isEven()) d.subTo(m,d); - d.rShiftTo(1,d); - } - if(u.compareTo(v) >= 0) { - u.subTo(v,u); - if(ac) a.subTo(c,a); - b.subTo(d,b); - } else { - v.subTo(u,v); - if(ac) c.subTo(a,c); - d.subTo(b,d); - } -} -if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; -if(d.compareTo(m) >= 0) return d.subtract(m); -if(d.signum() < 0) d.addTo(m,d); else return d; -if(d.signum() < 0) return d.add(m); else return d; -} - -var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509]; -var lplim = (1<<26)/lowprimes[lowprimes.length-1]; - -//(public) test primality with certainty >= 1-.5^t -function bnIsProbablePrime(t) { -var i, x = this.abs(); -if(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) { - for(i = 0; i < lowprimes.length; ++i) - if(x.data[0] == lowprimes[i]) return true; - return false; -} -if(x.isEven()) return false; -i = 1; -while(i < lowprimes.length) { - var m = lowprimes[i], j = i+1; - while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; - m = x.modInt(m); - while(i < j) if(m%lowprimes[i++] == 0) return false; -} -return x.millerRabin(t); -} - -//(protected) true if probably prime (HAC 4.24, Miller-Rabin) -function bnpMillerRabin(t) { -var n1 = this.subtract(BigInteger.ONE); -var k = n1.getLowestSetBit(); -if(k <= 0) return false; -var r = n1.shiftRight(k); -var prng = bnGetPrng(); -var a; -for(var i = 0; i < t; ++i) { - // select witness 'a' at random from between 1 and n1 - do { - a = new BigInteger(this.bitLength(), prng); - } - while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0); - var y = a.modPow(r,this); - if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { - var j = 1; - while(j++ < k && y.compareTo(n1) != 0) { - y = y.modPowInt(2,this); - if(y.compareTo(BigInteger.ONE) == 0) return false; - } - if(y.compareTo(n1) != 0) return false; - } -} -return true; -} - -// get pseudo random number generator -function bnGetPrng() { - // create prng with api that matches BigInteger secure random - return { - // x is an array to fill with bytes - nextBytes: function(x) { - for(var i = 0; i < x.length; ++i) { - x[i] = Math.floor(Math.random() * 0x0100); - } - } - }; -} - -//protected -BigInteger.prototype.chunkSize = bnpChunkSize; -BigInteger.prototype.toRadix = bnpToRadix; -BigInteger.prototype.fromRadix = bnpFromRadix; -BigInteger.prototype.fromNumber = bnpFromNumber; -BigInteger.prototype.bitwiseTo = bnpBitwiseTo; -BigInteger.prototype.changeBit = bnpChangeBit; -BigInteger.prototype.addTo = bnpAddTo; -BigInteger.prototype.dMultiply = bnpDMultiply; -BigInteger.prototype.dAddOffset = bnpDAddOffset; -BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; -BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; -BigInteger.prototype.modInt = bnpModInt; -BigInteger.prototype.millerRabin = bnpMillerRabin; - -//public -BigInteger.prototype.clone = bnClone; -BigInteger.prototype.intValue = bnIntValue; -BigInteger.prototype.byteValue = bnByteValue; -BigInteger.prototype.shortValue = bnShortValue; -BigInteger.prototype.signum = bnSigNum; -BigInteger.prototype.toByteArray = bnToByteArray; -BigInteger.prototype.equals = bnEquals; -BigInteger.prototype.min = bnMin; -BigInteger.prototype.max = bnMax; -BigInteger.prototype.and = bnAnd; -BigInteger.prototype.or = bnOr; -BigInteger.prototype.xor = bnXor; -BigInteger.prototype.andNot = bnAndNot; -BigInteger.prototype.not = bnNot; -BigInteger.prototype.shiftLeft = bnShiftLeft; -BigInteger.prototype.shiftRight = bnShiftRight; -BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; -BigInteger.prototype.bitCount = bnBitCount; -BigInteger.prototype.testBit = bnTestBit; -BigInteger.prototype.setBit = bnSetBit; -BigInteger.prototype.clearBit = bnClearBit; -BigInteger.prototype.flipBit = bnFlipBit; -BigInteger.prototype.add = bnAdd; -BigInteger.prototype.subtract = bnSubtract; -BigInteger.prototype.multiply = bnMultiply; -BigInteger.prototype.divide = bnDivide; -BigInteger.prototype.remainder = bnRemainder; -BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; -BigInteger.prototype.modPow = bnModPow; -BigInteger.prototype.modInverse = bnModInverse; -BigInteger.prototype.pow = bnPow; -BigInteger.prototype.gcd = bnGCD; -BigInteger.prototype.isProbablePrime = bnIsProbablePrime; - -//BigInteger interfaces not implemented in jsbn: - -//BigInteger(int signum, byte[] magnitude) -//double doubleValue() -//float floatValue() -//int hashCode() -//long longValue() -//static BigInteger valueOf(long val) diff --git a/node_modules/node-forge/lib/kem.js b/node_modules/node-forge/lib/kem.js deleted file mode 100644 index 1967016d..00000000 --- a/node_modules/node-forge/lib/kem.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Javascript implementation of RSA-KEM. - * - * @author Lautaro Cozzani Rodriguez - * @author Dave Longley - * - * Copyright (c) 2014 Lautaro Cozzani - * Copyright (c) 2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); -require('./random'); -require('./jsbn'); - -module.exports = forge.kem = forge.kem || {}; - -var BigInteger = forge.jsbn.BigInteger; - -/** - * The API for the RSA Key Encapsulation Mechanism (RSA-KEM) from ISO 18033-2. - */ -forge.kem.rsa = {}; - -/** - * Creates an RSA KEM API object for generating a secret asymmetric key. - * - * The symmetric key may be generated via a call to 'encrypt', which will - * produce a ciphertext to be transmitted to the recipient and a key to be - * kept secret. The ciphertext is a parameter to be passed to 'decrypt' which - * will produce the same secret key for the recipient to use to decrypt a - * message that was encrypted with the secret key. - * - * @param kdf the KDF API to use (eg: new forge.kem.kdf1()). - * @param options the options to use. - * [prng] a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". - */ -forge.kem.rsa.create = function(kdf, options) { - options = options || {}; - var prng = options.prng || forge.random; - - var kem = {}; - - /** - * Generates a secret key and its encapsulation. - * - * @param publicKey the RSA public key to encrypt with. - * @param keyLength the length, in bytes, of the secret key to generate. - * - * @return an object with: - * encapsulation: the ciphertext for generating the secret key, as a - * binary-encoded string of bytes. - * key: the secret key to use for encrypting a message. - */ - kem.encrypt = function(publicKey, keyLength) { - // generate a random r where 1 < r < n - var byteLength = Math.ceil(publicKey.n.bitLength() / 8); - var r; - do { - r = new BigInteger( - forge.util.bytesToHex(prng.getBytesSync(byteLength)), - 16).mod(publicKey.n); - } while(r.compareTo(BigInteger.ONE) <= 0); - - // prepend r with zeros - r = forge.util.hexToBytes(r.toString(16)); - var zeros = byteLength - r.length; - if(zeros > 0) { - r = forge.util.fillString(String.fromCharCode(0), zeros) + r; - } - - // encrypt the random - var encapsulation = publicKey.encrypt(r, 'NONE'); - - // generate the secret key - var key = kdf.generate(r, keyLength); - - return {encapsulation: encapsulation, key: key}; - }; - - /** - * Decrypts an encapsulated secret key. - * - * @param privateKey the RSA private key to decrypt with. - * @param encapsulation the ciphertext for generating the secret key, as - * a binary-encoded string of bytes. - * @param keyLength the length, in bytes, of the secret key to generate. - * - * @return the secret key as a binary-encoded string of bytes. - */ - kem.decrypt = function(privateKey, encapsulation, keyLength) { - // decrypt the encapsulation and generate the secret key - var r = privateKey.decrypt(encapsulation, 'NONE'); - return kdf.generate(r, keyLength); - }; - - return kem; -}; - -// TODO: add forge.kem.kdf.create('KDF1', {md: ..., ...}) API? - -/** - * Creates a key derivation API object that implements KDF1 per ISO 18033-2. - * - * @param md the hash API to use. - * @param [digestLength] an optional digest length that must be positive and - * less than or equal to md.digestLength. - * - * @return a KDF1 API object. - */ -forge.kem.kdf1 = function(md, digestLength) { - _createKDF(this, md, 0, digestLength || md.digestLength); -}; - -/** - * Creates a key derivation API object that implements KDF2 per ISO 18033-2. - * - * @param md the hash API to use. - * @param [digestLength] an optional digest length that must be positive and - * less than or equal to md.digestLength. - * - * @return a KDF2 API object. - */ -forge.kem.kdf2 = function(md, digestLength) { - _createKDF(this, md, 1, digestLength || md.digestLength); -}; - -/** - * Creates a KDF1 or KDF2 API object. - * - * @param md the hash API to use. - * @param counterStart the starting index for the counter. - * @param digestLength the digest length to use. - * - * @return the KDF API object. - */ -function _createKDF(kdf, md, counterStart, digestLength) { - /** - * Generate a key of the specified length. - * - * @param x the binary-encoded byte string to generate a key from. - * @param length the number of bytes to generate (the size of the key). - * - * @return the key as a binary-encoded string. - */ - kdf.generate = function(x, length) { - var key = new forge.util.ByteBuffer(); - - // run counter from counterStart to ceil(length / Hash.len) - var k = Math.ceil(length / digestLength) + counterStart; - - var c = new forge.util.ByteBuffer(); - for(var i = counterStart; i < k; ++i) { - // I2OSP(i, 4): convert counter to an octet string of 4 octets - c.putInt32(i); - - // digest 'x' and the counter and add the result to the key - md.start(); - md.update(x + c.getBytes()); - var hash = md.digest(); - key.putBytes(hash.getBytes(digestLength)); - } - - // truncate to the correct key length - key.truncate(key.length() - length); - return key.getBytes(); - }; -} diff --git a/node_modules/node-forge/lib/log.js b/node_modules/node-forge/lib/log.js deleted file mode 100644 index 8d36f4a8..00000000 --- a/node_modules/node-forge/lib/log.js +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Cross-browser support for logging in a web application. - * - * @author David I. Lehn - * - * Copyright (c) 2008-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -/* LOG API */ -module.exports = forge.log = forge.log || {}; - -/** - * Application logging system. - * - * Each logger level available as it's own function of the form: - * forge.log.level(category, args...) - * The category is an arbitrary string, and the args are the same as - * Firebug's console.log API. By default the call will be output as: - * 'LEVEL [category] , args[1], ...' - * This enables proper % formatting via the first argument. - * Each category is enabled by default but can be enabled or disabled with - * the setCategoryEnabled() function. - */ -// list of known levels -forge.log.levels = [ - 'none', 'error', 'warning', 'info', 'debug', 'verbose', 'max']; -// info on the levels indexed by name: -// index: level index -// name: uppercased display name -var sLevelInfo = {}; -// list of loggers -var sLoggers = []; -/** - * Standard console logger. If no console support is enabled this will - * remain null. Check before using. - */ -var sConsoleLogger = null; - -// logger flags -/** - * Lock the level at the current value. Used in cases where user config may - * set the level such that only critical messages are seen but more verbose - * messages are needed for debugging or other purposes. - */ -forge.log.LEVEL_LOCKED = (1 << 1); -/** - * Always call log function. By default, the logging system will check the - * message level against logger.level before calling the log function. This - * flag allows the function to do its own check. - */ -forge.log.NO_LEVEL_CHECK = (1 << 2); -/** - * Perform message interpolation with the passed arguments. "%" style - * fields in log messages will be replaced by arguments as needed. Some - * loggers, such as Firebug, may do this automatically. The original log - * message will be available as 'message' and the interpolated version will - * be available as 'fullMessage'. - */ -forge.log.INTERPOLATE = (1 << 3); - -// setup each log level -for(var i = 0; i < forge.log.levels.length; ++i) { - var level = forge.log.levels[i]; - sLevelInfo[level] = { - index: i, - name: level.toUpperCase() - }; -} - -/** - * Message logger. Will dispatch a message to registered loggers as needed. - * - * @param message message object - */ -forge.log.logMessage = function(message) { - var messageLevelIndex = sLevelInfo[message.level].index; - for(var i = 0; i < sLoggers.length; ++i) { - var logger = sLoggers[i]; - if(logger.flags & forge.log.NO_LEVEL_CHECK) { - logger.f(message); - } else { - // get logger level - var loggerLevelIndex = sLevelInfo[logger.level].index; - // check level - if(messageLevelIndex <= loggerLevelIndex) { - // message critical enough, call logger - logger.f(logger, message); - } - } - } -}; - -/** - * Sets the 'standard' key on a message object to: - * "LEVEL [category] " + message - * - * @param message a message log object - */ -forge.log.prepareStandard = function(message) { - if(!('standard' in message)) { - message.standard = - sLevelInfo[message.level].name + - //' ' + +message.timestamp + - ' [' + message.category + '] ' + - message.message; - } -}; - -/** - * Sets the 'full' key on a message object to the original message - * interpolated via % formatting with the message arguments. - * - * @param message a message log object. - */ -forge.log.prepareFull = function(message) { - if(!('full' in message)) { - // copy args and insert message at the front - var args = [message.message]; - args = args.concat([] || message['arguments']); - // format the message - message.full = forge.util.format.apply(this, args); - } -}; - -/** - * Applies both preparseStandard() and prepareFull() to a message object and - * store result in 'standardFull'. - * - * @param message a message log object. - */ -forge.log.prepareStandardFull = function(message) { - if(!('standardFull' in message)) { - // FIXME implement 'standardFull' logging - forge.log.prepareStandard(message); - message.standardFull = message.standard; - } -}; - -// create log level functions -if(true) { - // levels for which we want functions - var levels = ['error', 'warning', 'info', 'debug', 'verbose']; - for(var i = 0; i < levels.length; ++i) { - // wrap in a function to ensure proper level var is passed - (function(level) { - // create function for this level - forge.log[level] = function(category, message/*, args...*/) { - // convert arguments to real array, remove category and message - var args = Array.prototype.slice.call(arguments).slice(2); - // create message object - // Note: interpolation and standard formatting is done lazily - var msg = { - timestamp: new Date(), - level: level, - category: category, - message: message, - 'arguments': args - /*standard*/ - /*full*/ - /*fullMessage*/ - }; - // process this message - forge.log.logMessage(msg); - }; - })(levels[i]); - } -} - -/** - * Creates a new logger with specified custom logging function. - * - * The logging function has a signature of: - * function(logger, message) - * logger: current logger - * message: object: - * level: level id - * category: category - * message: string message - * arguments: Array of extra arguments - * fullMessage: interpolated message and arguments if INTERPOLATE flag set - * - * @param logFunction a logging function which takes a log message object - * as a parameter. - * - * @return a logger object. - */ -forge.log.makeLogger = function(logFunction) { - var logger = { - flags: 0, - f: logFunction - }; - forge.log.setLevel(logger, 'none'); - return logger; -}; - -/** - * Sets the current log level on a logger. - * - * @param logger the target logger. - * @param level the new maximum log level as a string. - * - * @return true if set, false if not. - */ -forge.log.setLevel = function(logger, level) { - var rval = false; - if(logger && !(logger.flags & forge.log.LEVEL_LOCKED)) { - for(var i = 0; i < forge.log.levels.length; ++i) { - var aValidLevel = forge.log.levels[i]; - if(level == aValidLevel) { - // set level - logger.level = level; - rval = true; - break; - } - } - } - - return rval; -}; - -/** - * Locks the log level at its current value. - * - * @param logger the target logger. - * @param lock boolean lock value, default to true. - */ -forge.log.lock = function(logger, lock) { - if(typeof lock === 'undefined' || lock) { - logger.flags |= forge.log.LEVEL_LOCKED; - } else { - logger.flags &= ~forge.log.LEVEL_LOCKED; - } -}; - -/** - * Adds a logger. - * - * @param logger the logger object. - */ -forge.log.addLogger = function(logger) { - sLoggers.push(logger); -}; - -// setup the console logger if possible, else create fake console.log -if(typeof(console) !== 'undefined' && 'log' in console) { - var logger; - if(console.error && console.warn && console.info && console.debug) { - // looks like Firebug-style logging is available - // level handlers map - var levelHandlers = { - error: console.error, - warning: console.warn, - info: console.info, - debug: console.debug, - verbose: console.debug - }; - var f = function(logger, message) { - forge.log.prepareStandard(message); - var handler = levelHandlers[message.level]; - // prepend standard message and concat args - var args = [message.standard]; - args = args.concat(message['arguments'].slice()); - // apply to low-level console function - handler.apply(console, args); - }; - logger = forge.log.makeLogger(f); - } else { - // only appear to have basic console.log - var f = function(logger, message) { - forge.log.prepareStandardFull(message); - console.log(message.standardFull); - }; - logger = forge.log.makeLogger(f); - } - forge.log.setLevel(logger, 'debug'); - forge.log.addLogger(logger); - sConsoleLogger = logger; -} else { - // define fake console.log to avoid potential script errors on - // browsers that do not have console logging - console = { - log: function() {} - }; -} - -/* - * Check for logging control query vars. - * - * console.level= - * Set's the console log level by name. Useful to override defaults and - * allow more verbose logging before a user config is loaded. - * - * console.lock= - * Lock the console log level at whatever level it is set at. This is run - * after console.level is processed. Useful to force a level of verbosity - * that could otherwise be limited by a user config. - */ -if(sConsoleLogger !== null) { - var query = forge.util.getQueryVariables(); - if('console.level' in query) { - // set with last value - forge.log.setLevel( - sConsoleLogger, query['console.level'].slice(-1)[0]); - } - if('console.lock' in query) { - // set with last value - var lock = query['console.lock'].slice(-1)[0]; - if(lock == 'true') { - forge.log.lock(sConsoleLogger); - } - } -} - -// provide public access to console logger -forge.log.consoleLogger = sConsoleLogger; diff --git a/node_modules/node-forge/lib/md.all.js b/node_modules/node-forge/lib/md.all.js deleted file mode 100644 index 4e0974bd..00000000 --- a/node_modules/node-forge/lib/md.all.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Node.js module for all known Forge message digests. - * - * @author Dave Longley - * - * Copyright 2011-2017 Digital Bazaar, Inc. - */ -module.exports = require('./md'); - -require('./md5'); -require('./sha1'); -require('./sha256'); -require('./sha512'); diff --git a/node_modules/node-forge/lib/md.js b/node_modules/node-forge/lib/md.js deleted file mode 100644 index e4a280c5..00000000 --- a/node_modules/node-forge/lib/md.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Node.js module for Forge message digests. - * - * @author Dave Longley - * - * Copyright 2011-2017 Digital Bazaar, Inc. - */ -var forge = require('./forge'); - -module.exports = forge.md = forge.md || {}; -forge.md.algorithms = forge.md.algorithms || {}; diff --git a/node_modules/node-forge/lib/md5.js b/node_modules/node-forge/lib/md5.js deleted file mode 100644 index d0ba8f65..00000000 --- a/node_modules/node-forge/lib/md5.js +++ /dev/null @@ -1,289 +0,0 @@ -/** - * Message Digest Algorithm 5 with 128-bit digest (MD5) implementation. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var md5 = module.exports = forge.md5 = forge.md5 || {}; -forge.md.md5 = forge.md.algorithms.md5 = md5; - -/** - * Creates an MD5 message digest object. - * - * @return a message digest object. - */ -md5.create = function() { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - // MD5 state contains four 32-bit integers - var _state = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for word storage - var _w = new Array(16); - - // message digest object - var md = { - algorithm: 'md5', - blockLength: 64, - digestLength: 16, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 8 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength64 for backwards-compatibility) - md.fullMessageLength = md.messageLength64 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _state = { - h0: 0x67452301, - h1: 0xEFCDAB89, - h2: 0x98BADCFE, - h3: 0x10325476 - }; - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = (len[1] / 0x100000000) >>> 0; - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_state, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate MD5 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 448 mod 512. In other words, - the data to be digested must be a multiple of 512 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 8 bytes (64 - bits), that means that the last segment of the data must have 56 bytes - (448 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 448 mod 512 because - 512 - 128 = 448. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 448 mod 512, then 512 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in little-endian order; since length - // is stored in bytes we multiply by 8 and add carry - var bits, carry = 0; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - bits = md.fullMessageLength[i] * 8 + carry; - carry = (bits / 0x100000000) >>> 0; - finalBlock.putInt32Le(bits >>> 0); - } - - var s2 = { - h0: _state.h0, - h1: _state.h1, - h2: _state.h2, - h3: _state.h3 - }; - _update(s2, _w, finalBlock); - var rval = forge.util.createBuffer(); - rval.putInt32Le(s2.h0); - rval.putInt32Le(s2.h1); - rval.putInt32Le(s2.h2); - rval.putInt32Le(s2.h3); - return rval; - }; - - return md; -}; - -// padding, constant tables for calculating md5 -var _padding = null; -var _g = null; -var _r = null; -var _k = null; -var _initialized = false; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 64); - - // g values - _g = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, - 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, - 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9]; - - // rounds table - _r = [ - 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, - 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, - 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, - 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]; - - // get the result of abs(sin(i + 1)) as a 32-bit integer - _k = new Array(64); - for(var i = 0; i < 64; ++i) { - _k[i] = Math.floor(Math.abs(Math.sin(i + 1)) * 0x100000000); - } - - // now initialized - _initialized = true; -} - -/** - * Updates an MD5 state with the given byte buffer. - * - * @param s the MD5 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (64 byte) chunks - var t, a, b, c, d, f, r, i; - var len = bytes.length(); - while(len >= 64) { - // initialize hash value for this chunk - a = s.h0; - b = s.h1; - c = s.h2; - d = s.h3; - - // round 1 - for(i = 0; i < 16; ++i) { - w[i] = bytes.getInt32Le(); - f = d ^ (b & (c ^ d)); - t = (a + f + _k[i] + w[i]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - // round 2 - for(; i < 32; ++i) { - f = c ^ (d & (b ^ c)); - t = (a + f + _k[i] + w[_g[i]]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - // round 3 - for(; i < 48; ++i) { - f = b ^ c ^ d; - t = (a + f + _k[i] + w[_g[i]]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - // round 4 - for(; i < 64; ++i) { - f = c ^ (b | ~d); - t = (a + f + _k[i] + w[_g[i]]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - - // update hash state - s.h0 = (s.h0 + a) | 0; - s.h1 = (s.h1 + b) | 0; - s.h2 = (s.h2 + c) | 0; - s.h3 = (s.h3 + d) | 0; - - len -= 64; - } -} diff --git a/node_modules/node-forge/lib/mgf.js b/node_modules/node-forge/lib/mgf.js deleted file mode 100644 index 0223bc36..00000000 --- a/node_modules/node-forge/lib/mgf.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Node.js module for Forge mask generation functions. - * - * @author Stefan Siegl - * - * Copyright 2012 Stefan Siegl - */ -var forge = require('./forge'); -require('./mgf1'); - -module.exports = forge.mgf = forge.mgf || {}; -forge.mgf.mgf1 = forge.mgf1; diff --git a/node_modules/node-forge/lib/mgf1.js b/node_modules/node-forge/lib/mgf1.js deleted file mode 100644 index 25ed1f7f..00000000 --- a/node_modules/node-forge/lib/mgf1.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Javascript implementation of mask generation function MGF1. - * - * @author Stefan Siegl - * @author Dave Longley - * - * Copyright (c) 2012 Stefan Siegl - * Copyright (c) 2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -forge.mgf = forge.mgf || {}; -var mgf1 = module.exports = forge.mgf.mgf1 = forge.mgf1 = forge.mgf1 || {}; - -/** - * Creates a MGF1 mask generation function object. - * - * @param md the message digest API to use (eg: forge.md.sha1.create()). - * - * @return a mask generation function object. - */ -mgf1.create = function(md) { - var mgf = { - /** - * Generate mask of specified length. - * - * @param {String} seed The seed for mask generation. - * @param maskLen Number of bytes to generate. - * @return {String} The generated mask. - */ - generate: function(seed, maskLen) { - /* 2. Let T be the empty octet string. */ - var t = new forge.util.ByteBuffer(); - - /* 3. For counter from 0 to ceil(maskLen / hLen), do the following: */ - var len = Math.ceil(maskLen / md.digestLength); - for(var i = 0; i < len; i++) { - /* a. Convert counter to an octet string C of length 4 octets */ - var c = new forge.util.ByteBuffer(); - c.putInt32(i); - - /* b. Concatenate the hash of the seed mgfSeed and C to the octet - * string T: */ - md.start(); - md.update(seed + c.getBytes()); - t.putBuffer(md.digest()); - } - - /* Output the leading maskLen octets of T as the octet string mask. */ - t.truncate(t.length() - maskLen); - return t.getBytes(); - } - }; - - return mgf; -}; diff --git a/node_modules/node-forge/lib/oids.js b/node_modules/node-forge/lib/oids.js deleted file mode 100644 index 6a937f57..00000000 --- a/node_modules/node-forge/lib/oids.js +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Object IDs for ASN.1. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); - -forge.pki = forge.pki || {}; -var oids = module.exports = forge.pki.oids = forge.oids = forge.oids || {}; - -// set id to name mapping and name to id mapping -function _IN(id, name) { - oids[id] = name; - oids[name] = id; -} -// set id to name mapping only -function _I_(id, name) { - oids[id] = name; -} - -// algorithm OIDs -_IN('1.2.840.113549.1.1.1', 'rsaEncryption'); -// Note: md2 & md4 not implemented -//_IN('1.2.840.113549.1.1.2', 'md2WithRSAEncryption'); -//_IN('1.2.840.113549.1.1.3', 'md4WithRSAEncryption'); -_IN('1.2.840.113549.1.1.4', 'md5WithRSAEncryption'); -_IN('1.2.840.113549.1.1.5', 'sha1WithRSAEncryption'); -_IN('1.2.840.113549.1.1.7', 'RSAES-OAEP'); -_IN('1.2.840.113549.1.1.8', 'mgf1'); -_IN('1.2.840.113549.1.1.9', 'pSpecified'); -_IN('1.2.840.113549.1.1.10', 'RSASSA-PSS'); -_IN('1.2.840.113549.1.1.11', 'sha256WithRSAEncryption'); -_IN('1.2.840.113549.1.1.12', 'sha384WithRSAEncryption'); -_IN('1.2.840.113549.1.1.13', 'sha512WithRSAEncryption'); -// Edwards-curve Digital Signature Algorithm (EdDSA) Ed25519 -_IN('1.3.101.112', 'EdDSA25519'); - -_IN('1.2.840.10040.4.3', 'dsa-with-sha1'); - -_IN('1.3.14.3.2.7', 'desCBC'); - -_IN('1.3.14.3.2.26', 'sha1'); -_IN('2.16.840.1.101.3.4.2.1', 'sha256'); -_IN('2.16.840.1.101.3.4.2.2', 'sha384'); -_IN('2.16.840.1.101.3.4.2.3', 'sha512'); -_IN('1.2.840.113549.2.5', 'md5'); - -// pkcs#7 content types -_IN('1.2.840.113549.1.7.1', 'data'); -_IN('1.2.840.113549.1.7.2', 'signedData'); -_IN('1.2.840.113549.1.7.3', 'envelopedData'); -_IN('1.2.840.113549.1.7.4', 'signedAndEnvelopedData'); -_IN('1.2.840.113549.1.7.5', 'digestedData'); -_IN('1.2.840.113549.1.7.6', 'encryptedData'); - -// pkcs#9 oids -_IN('1.2.840.113549.1.9.1', 'emailAddress'); -_IN('1.2.840.113549.1.9.2', 'unstructuredName'); -_IN('1.2.840.113549.1.9.3', 'contentType'); -_IN('1.2.840.113549.1.9.4', 'messageDigest'); -_IN('1.2.840.113549.1.9.5', 'signingTime'); -_IN('1.2.840.113549.1.9.6', 'counterSignature'); -_IN('1.2.840.113549.1.9.7', 'challengePassword'); -_IN('1.2.840.113549.1.9.8', 'unstructuredAddress'); -_IN('1.2.840.113549.1.9.14', 'extensionRequest'); - -_IN('1.2.840.113549.1.9.20', 'friendlyName'); -_IN('1.2.840.113549.1.9.21', 'localKeyId'); -_IN('1.2.840.113549.1.9.22.1', 'x509Certificate'); - -// pkcs#12 safe bags -_IN('1.2.840.113549.1.12.10.1.1', 'keyBag'); -_IN('1.2.840.113549.1.12.10.1.2', 'pkcs8ShroudedKeyBag'); -_IN('1.2.840.113549.1.12.10.1.3', 'certBag'); -_IN('1.2.840.113549.1.12.10.1.4', 'crlBag'); -_IN('1.2.840.113549.1.12.10.1.5', 'secretBag'); -_IN('1.2.840.113549.1.12.10.1.6', 'safeContentsBag'); - -// password-based-encryption for pkcs#12 -_IN('1.2.840.113549.1.5.13', 'pkcs5PBES2'); -_IN('1.2.840.113549.1.5.12', 'pkcs5PBKDF2'); - -_IN('1.2.840.113549.1.12.1.1', 'pbeWithSHAAnd128BitRC4'); -_IN('1.2.840.113549.1.12.1.2', 'pbeWithSHAAnd40BitRC4'); -_IN('1.2.840.113549.1.12.1.3', 'pbeWithSHAAnd3-KeyTripleDES-CBC'); -_IN('1.2.840.113549.1.12.1.4', 'pbeWithSHAAnd2-KeyTripleDES-CBC'); -_IN('1.2.840.113549.1.12.1.5', 'pbeWithSHAAnd128BitRC2-CBC'); -_IN('1.2.840.113549.1.12.1.6', 'pbewithSHAAnd40BitRC2-CBC'); - -// hmac OIDs -_IN('1.2.840.113549.2.7', 'hmacWithSHA1'); -_IN('1.2.840.113549.2.8', 'hmacWithSHA224'); -_IN('1.2.840.113549.2.9', 'hmacWithSHA256'); -_IN('1.2.840.113549.2.10', 'hmacWithSHA384'); -_IN('1.2.840.113549.2.11', 'hmacWithSHA512'); - -// symmetric key algorithm oids -_IN('1.2.840.113549.3.7', 'des-EDE3-CBC'); -_IN('2.16.840.1.101.3.4.1.2', 'aes128-CBC'); -_IN('2.16.840.1.101.3.4.1.22', 'aes192-CBC'); -_IN('2.16.840.1.101.3.4.1.42', 'aes256-CBC'); - -// certificate issuer/subject OIDs -_IN('2.5.4.3', 'commonName'); -_IN('2.5.4.5', 'serialName'); -_IN('2.5.4.6', 'countryName'); -_IN('2.5.4.7', 'localityName'); -_IN('2.5.4.8', 'stateOrProvinceName'); -_IN('2.5.4.9', 'streetAddress'); -_IN('2.5.4.10', 'organizationName'); -_IN('2.5.4.11', 'organizationalUnitName'); -_IN('2.5.4.13', 'description'); -_IN('2.5.4.15', 'businessCategory'); -_IN('2.5.4.17', 'postalCode'); -_IN('1.3.6.1.4.1.311.60.2.1.2', 'jurisdictionOfIncorporationStateOrProvinceName'); -_IN('1.3.6.1.4.1.311.60.2.1.3', 'jurisdictionOfIncorporationCountryName'); - -// X.509 extension OIDs -_IN('2.16.840.1.113730.1.1', 'nsCertType'); -_IN('2.16.840.1.113730.1.13', 'nsComment'); // deprecated in theory; still widely used -_I_('2.5.29.1', 'authorityKeyIdentifier'); // deprecated, use .35 -_I_('2.5.29.2', 'keyAttributes'); // obsolete use .37 or .15 -_I_('2.5.29.3', 'certificatePolicies'); // deprecated, use .32 -_I_('2.5.29.4', 'keyUsageRestriction'); // obsolete use .37 or .15 -_I_('2.5.29.5', 'policyMapping'); // deprecated use .33 -_I_('2.5.29.6', 'subtreesConstraint'); // obsolete use .30 -_I_('2.5.29.7', 'subjectAltName'); // deprecated use .17 -_I_('2.5.29.8', 'issuerAltName'); // deprecated use .18 -_I_('2.5.29.9', 'subjectDirectoryAttributes'); -_I_('2.5.29.10', 'basicConstraints'); // deprecated use .19 -_I_('2.5.29.11', 'nameConstraints'); // deprecated use .30 -_I_('2.5.29.12', 'policyConstraints'); // deprecated use .36 -_I_('2.5.29.13', 'basicConstraints'); // deprecated use .19 -_IN('2.5.29.14', 'subjectKeyIdentifier'); -_IN('2.5.29.15', 'keyUsage'); -_I_('2.5.29.16', 'privateKeyUsagePeriod'); -_IN('2.5.29.17', 'subjectAltName'); -_IN('2.5.29.18', 'issuerAltName'); -_IN('2.5.29.19', 'basicConstraints'); -_I_('2.5.29.20', 'cRLNumber'); -_I_('2.5.29.21', 'cRLReason'); -_I_('2.5.29.22', 'expirationDate'); -_I_('2.5.29.23', 'instructionCode'); -_I_('2.5.29.24', 'invalidityDate'); -_I_('2.5.29.25', 'cRLDistributionPoints'); // deprecated use .31 -_I_('2.5.29.26', 'issuingDistributionPoint'); // deprecated use .28 -_I_('2.5.29.27', 'deltaCRLIndicator'); -_I_('2.5.29.28', 'issuingDistributionPoint'); -_I_('2.5.29.29', 'certificateIssuer'); -_I_('2.5.29.30', 'nameConstraints'); -_IN('2.5.29.31', 'cRLDistributionPoints'); -_IN('2.5.29.32', 'certificatePolicies'); -_I_('2.5.29.33', 'policyMappings'); -_I_('2.5.29.34', 'policyConstraints'); // deprecated use .36 -_IN('2.5.29.35', 'authorityKeyIdentifier'); -_I_('2.5.29.36', 'policyConstraints'); -_IN('2.5.29.37', 'extKeyUsage'); -_I_('2.5.29.46', 'freshestCRL'); -_I_('2.5.29.54', 'inhibitAnyPolicy'); - -// extKeyUsage purposes -_IN('1.3.6.1.4.1.11129.2.4.2', 'timestampList'); -_IN('1.3.6.1.5.5.7.1.1', 'authorityInfoAccess'); -_IN('1.3.6.1.5.5.7.3.1', 'serverAuth'); -_IN('1.3.6.1.5.5.7.3.2', 'clientAuth'); -_IN('1.3.6.1.5.5.7.3.3', 'codeSigning'); -_IN('1.3.6.1.5.5.7.3.4', 'emailProtection'); -_IN('1.3.6.1.5.5.7.3.8', 'timeStamping'); diff --git a/node_modules/node-forge/lib/pbe.js b/node_modules/node-forge/lib/pbe.js deleted file mode 100644 index cf8456ba..00000000 --- a/node_modules/node-forge/lib/pbe.js +++ /dev/null @@ -1,1023 +0,0 @@ -/** - * Password-based encryption functions. - * - * @author Dave Longley - * @author Stefan Siegl - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - * Copyright (c) 2012 Stefan Siegl - * - * An EncryptedPrivateKeyInfo: - * - * EncryptedPrivateKeyInfo ::= SEQUENCE { - * encryptionAlgorithm EncryptionAlgorithmIdentifier, - * encryptedData EncryptedData } - * - * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier - * - * EncryptedData ::= OCTET STRING - */ -var forge = require('./forge'); -require('./aes'); -require('./asn1'); -require('./des'); -require('./md'); -require('./oids'); -require('./pbkdf2'); -require('./pem'); -require('./random'); -require('./rc2'); -require('./rsa'); -require('./util'); - -if(typeof BigInteger === 'undefined') { - var BigInteger = forge.jsbn.BigInteger; -} - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -/* Password-based encryption implementation. */ -var pki = forge.pki = forge.pki || {}; -module.exports = pki.pbe = forge.pbe = forge.pbe || {}; -var oids = pki.oids; - -// validator for an EncryptedPrivateKeyInfo structure -// Note: Currently only works w/algorithm params -var encryptedPrivateKeyValidator = { - name: 'EncryptedPrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedPrivateKeyInfo.encryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encryptionOid' - }, { - name: 'AlgorithmIdentifier.parameters', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'encryptionParams' - }] - }, { - // encryptedData - name: 'EncryptedPrivateKeyInfo.encryptedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'encryptedData' - }] -}; - -// validator for a PBES2Algorithms structure -// Note: Currently only works w/PBKDF2 + AES encryption schemes -var PBES2AlgorithmsValidator = { - name: 'PBES2Algorithms', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.keyDerivationFunc', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.keyDerivationFunc.oid', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'kdfOid' - }, { - name: 'PBES2Algorithms.params', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.params.salt', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'kdfSalt' - }, { - name: 'PBES2Algorithms.params.iterationCount', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'kdfIterationCount' - }, { - name: 'PBES2Algorithms.params.keyLength', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - optional: true, - capture: 'keyLength' - }, { - // prf - name: 'PBES2Algorithms.params.prf', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - value: [{ - name: 'PBES2Algorithms.params.prf.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'prfOid' - }] - }] - }] - }, { - name: 'PBES2Algorithms.encryptionScheme', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.encryptionScheme.oid', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encOid' - }, { - name: 'PBES2Algorithms.encryptionScheme.iv', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'encIv' - }] - }] -}; - -var pkcs12PbeParamsValidator = { - name: 'pkcs-12PbeParams', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'pkcs-12PbeParams.salt', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'salt' - }, { - name: 'pkcs-12PbeParams.iterations', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'iterations' - }] -}; - -/** - * Encrypts a ASN.1 PrivateKeyInfo object, producing an EncryptedPrivateKeyInfo. - * - * PBES2Algorithms ALGORITHM-IDENTIFIER ::= - * { {PBES2-params IDENTIFIED BY id-PBES2}, ...} - * - * id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13} - * - * PBES2-params ::= SEQUENCE { - * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}}, - * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} - * } - * - * PBES2-KDFs ALGORITHM-IDENTIFIER ::= - * { {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ... } - * - * PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... } - * - * PBKDF2-params ::= SEQUENCE { - * salt CHOICE { - * specified OCTET STRING, - * otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}} - * }, - * iterationCount INTEGER (1..MAX), - * keyLength INTEGER (1..MAX) OPTIONAL, - * prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1 - * } - * - * @param obj the ASN.1 PrivateKeyInfo object. - * @param password the password to encrypt with. - * @param options: - * algorithm the encryption algorithm to use - * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'. - * count the iteration count to use. - * saltSize the salt size to use. - * prfAlgorithm the PRF message digest algorithm to use - * ('sha1', 'sha224', 'sha256', 'sha384', 'sha512') - * - * @return the ASN.1 EncryptedPrivateKeyInfo. - */ -pki.encryptPrivateKeyInfo = function(obj, password, options) { - // set default options - options = options || {}; - options.saltSize = options.saltSize || 8; - options.count = options.count || 2048; - options.algorithm = options.algorithm || 'aes128'; - options.prfAlgorithm = options.prfAlgorithm || 'sha1'; - - // generate PBE params - var salt = forge.random.getBytesSync(options.saltSize); - var count = options.count; - var countBytes = asn1.integerToDer(count); - var dkLen; - var encryptionAlgorithm; - var encryptedData; - if(options.algorithm.indexOf('aes') === 0 || options.algorithm === 'des') { - // do PBES2 - var ivLen, encOid, cipherFn; - switch(options.algorithm) { - case 'aes128': - dkLen = 16; - ivLen = 16; - encOid = oids['aes128-CBC']; - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes192': - dkLen = 24; - ivLen = 16; - encOid = oids['aes192-CBC']; - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes256': - dkLen = 32; - ivLen = 16; - encOid = oids['aes256-CBC']; - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'des': - dkLen = 8; - ivLen = 8; - encOid = oids['desCBC']; - cipherFn = forge.des.createEncryptionCipher; - break; - default: - var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.'); - error.algorithm = options.algorithm; - throw error; - } - - // get PRF message digest - var prfAlgorithm = 'hmacWith' + options.prfAlgorithm.toUpperCase(); - var md = prfAlgorithmToMessageDigest(prfAlgorithm); - - // encrypt private key using pbe SHA-1 and AES/DES - var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md); - var iv = forge.random.getBytesSync(ivLen); - var cipher = cipherFn(dk); - cipher.start(iv); - cipher.update(asn1.toDer(obj)); - cipher.finish(); - encryptedData = cipher.output.getBytes(); - - // get PBKDF2-params - var params = createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm); - - encryptionAlgorithm = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oids['pkcs5PBES2']).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // keyDerivationFunc - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oids['pkcs5PBKDF2']).getBytes()), - // PBKDF2-params - params - ]), - // encryptionScheme - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(encOid).getBytes()), - // iv - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, iv) - ]) - ]) - ]); - } else if(options.algorithm === '3des') { - // Do PKCS12 PBE - dkLen = 24; - - var saltBytes = new forge.util.ByteBuffer(salt); - var dk = pki.pbe.generatePkcs12Key(password, saltBytes, 1, count, dkLen); - var iv = pki.pbe.generatePkcs12Key(password, saltBytes, 2, count, dkLen); - var cipher = forge.des.createEncryptionCipher(dk); - cipher.start(iv); - cipher.update(asn1.toDer(obj)); - cipher.finish(); - encryptedData = cipher.output.getBytes(); - - encryptionAlgorithm = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oids['pbeWithSHAAnd3-KeyTripleDES-CBC']).getBytes()), - // pkcs-12PbeParams - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // salt - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt), - // iteration count - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - countBytes.getBytes()) - ]) - ]); - } else { - var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.'); - error.algorithm = options.algorithm; - throw error; - } - - // EncryptedPrivateKeyInfo - var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // encryptionAlgorithm - encryptionAlgorithm, - // encryptedData - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, encryptedData) - ]); - return rval; -}; - -/** - * Decrypts a ASN.1 PrivateKeyInfo object. - * - * @param obj the ASN.1 EncryptedPrivateKeyInfo object. - * @param password the password to decrypt with. - * - * @return the ASN.1 PrivateKeyInfo on success, null on failure. - */ -pki.decryptPrivateKeyInfo = function(obj, password) { - var rval = null; - - // get PBE params - var capture = {}; - var errors = []; - if(!asn1.validate(obj, encryptedPrivateKeyValidator, capture, errors)) { - var error = new Error('Cannot read encrypted private key. ' + - 'ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); - error.errors = errors; - throw error; - } - - // get cipher - var oid = asn1.derToOid(capture.encryptionOid); - var cipher = pki.pbe.getCipher(oid, capture.encryptionParams, password); - - // get encrypted data - var encrypted = forge.util.createBuffer(capture.encryptedData); - - cipher.update(encrypted); - if(cipher.finish()) { - rval = asn1.fromDer(cipher.output); - } - - return rval; -}; - -/** - * Converts a EncryptedPrivateKeyInfo to PEM format. - * - * @param epki the EncryptedPrivateKeyInfo. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted encrypted private key. - */ -pki.encryptedPrivateKeyToPem = function(epki, maxline) { - // convert to DER, then PEM-encode - var msg = { - type: 'ENCRYPTED PRIVATE KEY', - body: asn1.toDer(epki).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format. Decryption - * is not performed. - * - * @param pem the EncryptedPrivateKeyInfo in PEM-format. - * - * @return the ASN.1 EncryptedPrivateKeyInfo. - */ -pki.encryptedPrivateKeyFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'ENCRYPTED PRIVATE KEY') { - var error = new Error('Could not convert encrypted private key from PEM; ' + - 'PEM header type is "ENCRYPTED PRIVATE KEY".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert encrypted private key from PEM; ' + - 'PEM is encrypted.'); - } - - // convert DER to ASN.1 object - return asn1.fromDer(msg.body); -}; - -/** - * Encrypts an RSA private key. By default, the key will be wrapped in - * a PrivateKeyInfo and encrypted to produce a PKCS#8 EncryptedPrivateKeyInfo. - * This is the standard, preferred way to encrypt a private key. - * - * To produce a non-standard PEM-encrypted private key that uses encapsulated - * headers to indicate the encryption algorithm (old-style non-PKCS#8 OpenSSL - * private key encryption), set the 'legacy' option to true. Note: Using this - * option will cause the iteration count to be forced to 1. - * - * Note: The 'des' algorithm is supported, but it is not considered to be - * secure because it only uses a single 56-bit key. If possible, it is highly - * recommended that a different algorithm be used. - * - * @param rsaKey the RSA key to encrypt. - * @param password the password to use. - * @param options: - * algorithm: the encryption algorithm to use - * ('aes128', 'aes192', 'aes256', '3des', 'des'). - * count: the iteration count to use. - * saltSize: the salt size to use. - * legacy: output an old non-PKCS#8 PEM-encrypted+encapsulated - * headers (DEK-Info) private key. - * - * @return the PEM-encoded ASN.1 EncryptedPrivateKeyInfo. - */ -pki.encryptRsaPrivateKey = function(rsaKey, password, options) { - // standard PKCS#8 - options = options || {}; - if(!options.legacy) { - // encrypt PrivateKeyInfo - var rval = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(rsaKey)); - rval = pki.encryptPrivateKeyInfo(rval, password, options); - return pki.encryptedPrivateKeyToPem(rval); - } - - // legacy non-PKCS#8 - var algorithm; - var iv; - var dkLen; - var cipherFn; - switch(options.algorithm) { - case 'aes128': - algorithm = 'AES-128-CBC'; - dkLen = 16; - iv = forge.random.getBytesSync(16); - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes192': - algorithm = 'AES-192-CBC'; - dkLen = 24; - iv = forge.random.getBytesSync(16); - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes256': - algorithm = 'AES-256-CBC'; - dkLen = 32; - iv = forge.random.getBytesSync(16); - cipherFn = forge.aes.createEncryptionCipher; - break; - case '3des': - algorithm = 'DES-EDE3-CBC'; - dkLen = 24; - iv = forge.random.getBytesSync(8); - cipherFn = forge.des.createEncryptionCipher; - break; - case 'des': - algorithm = 'DES-CBC'; - dkLen = 8; - iv = forge.random.getBytesSync(8); - cipherFn = forge.des.createEncryptionCipher; - break; - default: - var error = new Error('Could not encrypt RSA private key; unsupported ' + - 'encryption algorithm "' + options.algorithm + '".'); - error.algorithm = options.algorithm; - throw error; - } - - // encrypt private key using OpenSSL legacy key derivation - var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen); - var cipher = cipherFn(dk); - cipher.start(iv); - cipher.update(asn1.toDer(pki.privateKeyToAsn1(rsaKey))); - cipher.finish(); - - var msg = { - type: 'RSA PRIVATE KEY', - procType: { - version: '4', - type: 'ENCRYPTED' - }, - dekInfo: { - algorithm: algorithm, - parameters: forge.util.bytesToHex(iv).toUpperCase() - }, - body: cipher.output.getBytes() - }; - return forge.pem.encode(msg); -}; - -/** - * Decrypts an RSA private key. - * - * @param pem the PEM-formatted EncryptedPrivateKeyInfo to decrypt. - * @param password the password to use. - * - * @return the RSA key on success, null on failure. - */ -pki.decryptRsaPrivateKey = function(pem, password) { - var rval = null; - - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'ENCRYPTED PRIVATE KEY' && - msg.type !== 'PRIVATE KEY' && - msg.type !== 'RSA PRIVATE KEY') { - var error = new Error('Could not convert private key from PEM; PEM header type ' + - 'is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'); - error.headerType = error; - throw error; - } - - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - var dkLen; - var cipherFn; - switch(msg.dekInfo.algorithm) { - case 'DES-CBC': - dkLen = 8; - cipherFn = forge.des.createDecryptionCipher; - break; - case 'DES-EDE3-CBC': - dkLen = 24; - cipherFn = forge.des.createDecryptionCipher; - break; - case 'AES-128-CBC': - dkLen = 16; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'AES-192-CBC': - dkLen = 24; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'AES-256-CBC': - dkLen = 32; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'RC2-40-CBC': - dkLen = 5; - cipherFn = function(key) { - return forge.rc2.createDecryptionCipher(key, 40); - }; - break; - case 'RC2-64-CBC': - dkLen = 8; - cipherFn = function(key) { - return forge.rc2.createDecryptionCipher(key, 64); - }; - break; - case 'RC2-128-CBC': - dkLen = 16; - cipherFn = function(key) { - return forge.rc2.createDecryptionCipher(key, 128); - }; - break; - default: - var error = new Error('Could not decrypt private key; unsupported ' + - 'encryption algorithm "' + msg.dekInfo.algorithm + '".'); - error.algorithm = msg.dekInfo.algorithm; - throw error; - } - - // use OpenSSL legacy key derivation - var iv = forge.util.hexToBytes(msg.dekInfo.parameters); - var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen); - var cipher = cipherFn(dk); - cipher.start(iv); - cipher.update(forge.util.createBuffer(msg.body)); - if(cipher.finish()) { - rval = cipher.output.getBytes(); - } else { - return rval; - } - } else { - rval = msg.body; - } - - if(msg.type === 'ENCRYPTED PRIVATE KEY') { - rval = pki.decryptPrivateKeyInfo(asn1.fromDer(rval), password); - } else { - // decryption already performed above - rval = asn1.fromDer(rval); - } - - if(rval !== null) { - rval = pki.privateKeyFromAsn1(rval); - } - - return rval; -}; - -/** - * Derives a PKCS#12 key. - * - * @param password the password to derive the key material from, null or - * undefined for none. - * @param salt the salt, as a ByteBuffer, to use. - * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC). - * @param iter the iteration count. - * @param n the number of bytes to derive from the password. - * @param md the message digest to use, defaults to SHA-1. - * - * @return a ByteBuffer with the bytes derived from the password. - */ -pki.pbe.generatePkcs12Key = function(password, salt, id, iter, n, md) { - var j, l; - - if(typeof md === 'undefined' || md === null) { - if(!('sha1' in forge.md)) { - throw new Error('"sha1" hash algorithm unavailable.'); - } - md = forge.md.sha1.create(); - } - - var u = md.digestLength; - var v = md.blockLength; - var result = new forge.util.ByteBuffer(); - - /* Convert password to Unicode byte buffer + trailing 0-byte. */ - var passBuf = new forge.util.ByteBuffer(); - if(password !== null && password !== undefined) { - for(l = 0; l < password.length; l++) { - passBuf.putInt16(password.charCodeAt(l)); - } - passBuf.putInt16(0); - } - - /* Length of salt and password in BYTES. */ - var p = passBuf.length(); - var s = salt.length(); - - /* 1. Construct a string, D (the "diversifier"), by concatenating - v copies of ID. */ - var D = new forge.util.ByteBuffer(); - D.fillWithByte(id, v); - - /* 2. Concatenate copies of the salt together to create a string S of length - v * ceil(s / v) bytes (the final copy of the salt may be trunacted - to create S). - Note that if the salt is the empty string, then so is S. */ - var Slen = v * Math.ceil(s / v); - var S = new forge.util.ByteBuffer(); - for(l = 0; l < Slen; l++) { - S.putByte(salt.at(l % s)); - } - - /* 3. Concatenate copies of the password together to create a string P of - length v * ceil(p / v) bytes (the final copy of the password may be - truncated to create P). - Note that if the password is the empty string, then so is P. */ - var Plen = v * Math.ceil(p / v); - var P = new forge.util.ByteBuffer(); - for(l = 0; l < Plen; l++) { - P.putByte(passBuf.at(l % p)); - } - - /* 4. Set I=S||P to be the concatenation of S and P. */ - var I = S; - I.putBuffer(P); - - /* 5. Set c=ceil(n / u). */ - var c = Math.ceil(n / u); - - /* 6. For i=1, 2, ..., c, do the following: */ - for(var i = 1; i <= c; i++) { - /* a) Set Ai=H^r(D||I). (l.e. the rth hash of D||I, H(H(H(...H(D||I)))) */ - var buf = new forge.util.ByteBuffer(); - buf.putBytes(D.bytes()); - buf.putBytes(I.bytes()); - for(var round = 0; round < iter; round++) { - md.start(); - md.update(buf.getBytes()); - buf = md.digest(); - } - - /* b) Concatenate copies of Ai to create a string B of length v bytes (the - final copy of Ai may be truncated to create B). */ - var B = new forge.util.ByteBuffer(); - for(l = 0; l < v; l++) { - B.putByte(buf.at(l % u)); - } - - /* c) Treating I as a concatenation I0, I1, ..., Ik-1 of v-byte blocks, - where k=ceil(s / v) + ceil(p / v), modify I by setting - Ij=(Ij+B+1) mod 2v for each j. */ - var k = Math.ceil(s / v) + Math.ceil(p / v); - var Inew = new forge.util.ByteBuffer(); - for(j = 0; j < k; j++) { - var chunk = new forge.util.ByteBuffer(I.getBytes(v)); - var x = 0x1ff; - for(l = B.length() - 1; l >= 0; l--) { - x = x >> 8; - x += B.at(l) + chunk.at(l); - chunk.setAt(l, x & 0xff); - } - Inew.putBuffer(chunk); - } - I = Inew; - - /* Add Ai to A. */ - result.putBuffer(buf); - } - - result.truncate(result.length() - n); - return result; -}; - -/** - * Get new Forge cipher object instance. - * - * @param oid the OID (in string notation). - * @param params the ASN.1 params object. - * @param password the password to decrypt with. - * - * @return new cipher object instance. - */ -pki.pbe.getCipher = function(oid, params, password) { - switch(oid) { - case pki.oids['pkcs5PBES2']: - return pki.pbe.getCipherForPBES2(oid, params, password); - - case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']: - case pki.oids['pbewithSHAAnd40BitRC2-CBC']: - return pki.pbe.getCipherForPKCS12PBE(oid, params, password); - - default: - var error = new Error('Cannot read encrypted PBE data block. Unsupported OID.'); - error.oid = oid; - error.supportedOids = [ - 'pkcs5PBES2', - 'pbeWithSHAAnd3-KeyTripleDES-CBC', - 'pbewithSHAAnd40BitRC2-CBC' - ]; - throw error; - } -}; - -/** - * Get new Forge cipher object instance according to PBES2 params block. - * - * The returned cipher instance is already started using the IV - * from PBES2 parameter block. - * - * @param oid the PKCS#5 PBKDF2 OID (in string notation). - * @param params the ASN.1 PBES2-params object. - * @param password the password to decrypt with. - * - * @return new cipher object instance. - */ -pki.pbe.getCipherForPBES2 = function(oid, params, password) { - // get PBE params - var capture = {}; - var errors = []; - if(!asn1.validate(params, PBES2AlgorithmsValidator, capture, errors)) { - var error = new Error('Cannot read password-based-encryption algorithm ' + - 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); - error.errors = errors; - throw error; - } - - // check oids - oid = asn1.derToOid(capture.kdfOid); - if(oid !== pki.oids['pkcs5PBKDF2']) { - var error = new Error('Cannot read encrypted private key. ' + - 'Unsupported key derivation function OID.'); - error.oid = oid; - error.supportedOids = ['pkcs5PBKDF2']; - throw error; - } - oid = asn1.derToOid(capture.encOid); - if(oid !== pki.oids['aes128-CBC'] && - oid !== pki.oids['aes192-CBC'] && - oid !== pki.oids['aes256-CBC'] && - oid !== pki.oids['des-EDE3-CBC'] && - oid !== pki.oids['desCBC']) { - var error = new Error('Cannot read encrypted private key. ' + - 'Unsupported encryption scheme OID.'); - error.oid = oid; - error.supportedOids = [ - 'aes128-CBC', 'aes192-CBC', 'aes256-CBC', 'des-EDE3-CBC', 'desCBC']; - throw error; - } - - // set PBE params - var salt = capture.kdfSalt; - var count = forge.util.createBuffer(capture.kdfIterationCount); - count = count.getInt(count.length() << 3); - var dkLen; - var cipherFn; - switch(pki.oids[oid]) { - case 'aes128-CBC': - dkLen = 16; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'aes192-CBC': - dkLen = 24; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'aes256-CBC': - dkLen = 32; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'des-EDE3-CBC': - dkLen = 24; - cipherFn = forge.des.createDecryptionCipher; - break; - case 'desCBC': - dkLen = 8; - cipherFn = forge.des.createDecryptionCipher; - break; - } - - // get PRF message digest - var md = prfOidToMessageDigest(capture.prfOid); - - // decrypt private key using pbe with chosen PRF and AES/DES - var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md); - var iv = capture.encIv; - var cipher = cipherFn(dk); - cipher.start(iv); - - return cipher; -}; - -/** - * Get new Forge cipher object instance for PKCS#12 PBE. - * - * The returned cipher instance is already started using the key & IV - * derived from the provided password and PKCS#12 PBE salt. - * - * @param oid The PKCS#12 PBE OID (in string notation). - * @param params The ASN.1 PKCS#12 PBE-params object. - * @param password The password to decrypt with. - * - * @return the new cipher object instance. - */ -pki.pbe.getCipherForPKCS12PBE = function(oid, params, password) { - // get PBE params - var capture = {}; - var errors = []; - if(!asn1.validate(params, pkcs12PbeParamsValidator, capture, errors)) { - var error = new Error('Cannot read password-based-encryption algorithm ' + - 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); - error.errors = errors; - throw error; - } - - var salt = forge.util.createBuffer(capture.salt); - var count = forge.util.createBuffer(capture.iterations); - count = count.getInt(count.length() << 3); - - var dkLen, dIvLen, cipherFn; - switch(oid) { - case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']: - dkLen = 24; - dIvLen = 8; - cipherFn = forge.des.startDecrypting; - break; - - case pki.oids['pbewithSHAAnd40BitRC2-CBC']: - dkLen = 5; - dIvLen = 8; - cipherFn = function(key, iv) { - var cipher = forge.rc2.createDecryptionCipher(key, 40); - cipher.start(iv, null); - return cipher; - }; - break; - - default: - var error = new Error('Cannot read PKCS #12 PBE data block. Unsupported OID.'); - error.oid = oid; - throw error; - } - - // get PRF message digest - var md = prfOidToMessageDigest(capture.prfOid); - var key = pki.pbe.generatePkcs12Key(password, salt, 1, count, dkLen, md); - md.start(); - var iv = pki.pbe.generatePkcs12Key(password, salt, 2, count, dIvLen, md); - - return cipherFn(key, iv); -}; - -/** - * OpenSSL's legacy key derivation function. - * - * See: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html - * - * @param password the password to derive the key from. - * @param salt the salt to use, null for none. - * @param dkLen the number of bytes needed for the derived key. - * @param [options] the options to use: - * [md] an optional message digest object to use. - */ -pki.pbe.opensslDeriveBytes = function(password, salt, dkLen, md) { - if(typeof md === 'undefined' || md === null) { - if(!('md5' in forge.md)) { - throw new Error('"md5" hash algorithm unavailable.'); - } - md = forge.md.md5.create(); - } - if(salt === null) { - salt = ''; - } - var digests = [hash(md, password + salt)]; - for(var length = 16, i = 1; length < dkLen; ++i, length += 16) { - digests.push(hash(md, digests[i - 1] + password + salt)); - } - return digests.join('').substr(0, dkLen); -}; - -function hash(md, bytes) { - return md.start().update(bytes).digest().getBytes(); -} - -function prfOidToMessageDigest(prfOid) { - // get PRF algorithm, default to SHA-1 - var prfAlgorithm; - if(!prfOid) { - prfAlgorithm = 'hmacWithSHA1'; - } else { - prfAlgorithm = pki.oids[asn1.derToOid(prfOid)]; - if(!prfAlgorithm) { - var error = new Error('Unsupported PRF OID.'); - error.oid = prfOid; - error.supported = [ - 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384', - 'hmacWithSHA512']; - throw error; - } - } - return prfAlgorithmToMessageDigest(prfAlgorithm); -} - -function prfAlgorithmToMessageDigest(prfAlgorithm) { - var factory = forge.md; - switch(prfAlgorithm) { - case 'hmacWithSHA224': - factory = forge.md.sha512; - case 'hmacWithSHA1': - case 'hmacWithSHA256': - case 'hmacWithSHA384': - case 'hmacWithSHA512': - prfAlgorithm = prfAlgorithm.substr(8).toLowerCase(); - break; - default: - var error = new Error('Unsupported PRF algorithm.'); - error.algorithm = prfAlgorithm; - error.supported = [ - 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384', - 'hmacWithSHA512']; - throw error; - } - if(!factory || !(prfAlgorithm in factory)) { - throw new Error('Unknown hash algorithm: ' + prfAlgorithm); - } - return factory[prfAlgorithm].create(); -} - -function createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm) { - var params = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // salt - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt), - // iteration count - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - countBytes.getBytes()) - ]); - // when PRF algorithm is not SHA-1 default, add key length and PRF algorithm - if(prfAlgorithm !== 'hmacWithSHA1') { - params.value.push( - // key length - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(dkLen.toString(16))), - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids[prfAlgorithm]).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ])); - } - return params; -} diff --git a/node_modules/node-forge/lib/pbkdf2.js b/node_modules/node-forge/lib/pbkdf2.js deleted file mode 100644 index 714560e3..00000000 --- a/node_modules/node-forge/lib/pbkdf2.js +++ /dev/null @@ -1,211 +0,0 @@ -/** - * Password-Based Key-Derivation Function #2 implementation. - * - * See RFC 2898 for details. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./hmac'); -require('./md'); -require('./util'); - -var pkcs5 = forge.pkcs5 = forge.pkcs5 || {}; - -var crypto; -if(forge.util.isNodejs && !forge.options.usePureJavaScript) { - crypto = require('crypto'); -} - -/** - * Derives a key from a password. - * - * @param p the password as a binary-encoded string of bytes. - * @param s the salt as a binary-encoded string of bytes. - * @param c the iteration count, a positive integer. - * @param dkLen the intended length, in bytes, of the derived key, - * (max: 2^32 - 1) * hash length of the PRF. - * @param [md] the message digest (or algorithm identifier as a string) to use - * in the PRF, defaults to SHA-1. - * @param [callback(err, key)] presence triggers asynchronous version, called - * once the operation completes. - * - * @return the derived key, as a binary-encoded string of bytes, for the - * synchronous version (if no callback is specified). - */ -module.exports = forge.pbkdf2 = pkcs5.pbkdf2 = function( - p, s, c, dkLen, md, callback) { - if(typeof md === 'function') { - callback = md; - md = null; - } - - // use native implementation if possible and not disabled, note that - // some node versions only support SHA-1, others allow digest to be changed - if(forge.util.isNodejs && !forge.options.usePureJavaScript && - crypto.pbkdf2 && (md === null || typeof md !== 'object') && - (crypto.pbkdf2Sync.length > 4 || (!md || md === 'sha1'))) { - if(typeof md !== 'string') { - // default prf to SHA-1 - md = 'sha1'; - } - p = Buffer.from(p, 'binary'); - s = Buffer.from(s, 'binary'); - if(!callback) { - if(crypto.pbkdf2Sync.length === 4) { - return crypto.pbkdf2Sync(p, s, c, dkLen).toString('binary'); - } - return crypto.pbkdf2Sync(p, s, c, dkLen, md).toString('binary'); - } - if(crypto.pbkdf2Sync.length === 4) { - return crypto.pbkdf2(p, s, c, dkLen, function(err, key) { - if(err) { - return callback(err); - } - callback(null, key.toString('binary')); - }); - } - return crypto.pbkdf2(p, s, c, dkLen, md, function(err, key) { - if(err) { - return callback(err); - } - callback(null, key.toString('binary')); - }); - } - - if(typeof md === 'undefined' || md === null) { - // default prf to SHA-1 - md = 'sha1'; - } - if(typeof md === 'string') { - if(!(md in forge.md.algorithms)) { - throw new Error('Unknown hash algorithm: ' + md); - } - md = forge.md[md].create(); - } - - var hLen = md.digestLength; - - /* 1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and - stop. */ - if(dkLen > (0xFFFFFFFF * hLen)) { - var err = new Error('Derived key is too long.'); - if(callback) { - return callback(err); - } - throw err; - } - - /* 2. Let len be the number of hLen-octet blocks in the derived key, - rounding up, and let r be the number of octets in the last - block: - - len = CEIL(dkLen / hLen), - r = dkLen - (len - 1) * hLen. */ - var len = Math.ceil(dkLen / hLen); - var r = dkLen - (len - 1) * hLen; - - /* 3. For each block of the derived key apply the function F defined - below to the password P, the salt S, the iteration count c, and - the block index to compute the block: - - T_1 = F(P, S, c, 1), - T_2 = F(P, S, c, 2), - ... - T_len = F(P, S, c, len), - - where the function F is defined as the exclusive-or sum of the - first c iterates of the underlying pseudorandom function PRF - applied to the password P and the concatenation of the salt S - and the block index i: - - F(P, S, c, i) = u_1 XOR u_2 XOR ... XOR u_c - - where - - u_1 = PRF(P, S || INT(i)), - u_2 = PRF(P, u_1), - ... - u_c = PRF(P, u_{c-1}). - - Here, INT(i) is a four-octet encoding of the integer i, most - significant octet first. */ - var prf = forge.hmac.create(); - prf.start(md, p); - var dk = ''; - var xor, u_c, u_c1; - - // sync version - if(!callback) { - for(var i = 1; i <= len; ++i) { - // PRF(P, S || INT(i)) (first iteration) - prf.start(null, null); - prf.update(s); - prf.update(forge.util.int32ToBytes(i)); - xor = u_c1 = prf.digest().getBytes(); - - // PRF(P, u_{c-1}) (other iterations) - for(var j = 2; j <= c; ++j) { - prf.start(null, null); - prf.update(u_c1); - u_c = prf.digest().getBytes(); - // F(p, s, c, i) - xor = forge.util.xorBytes(xor, u_c, hLen); - u_c1 = u_c; - } - - /* 4. Concatenate the blocks and extract the first dkLen octets to - produce a derived key DK: - - DK = T_1 || T_2 || ... || T_len<0..r-1> */ - dk += (i < len) ? xor : xor.substr(0, r); - } - /* 5. Output the derived key DK. */ - return dk; - } - - // async version - var i = 1, j; - function outer() { - if(i > len) { - // done - return callback(null, dk); - } - - // PRF(P, S || INT(i)) (first iteration) - prf.start(null, null); - prf.update(s); - prf.update(forge.util.int32ToBytes(i)); - xor = u_c1 = prf.digest().getBytes(); - - // PRF(P, u_{c-1}) (other iterations) - j = 2; - inner(); - } - - function inner() { - if(j <= c) { - prf.start(null, null); - prf.update(u_c1); - u_c = prf.digest().getBytes(); - // F(p, s, c, i) - xor = forge.util.xorBytes(xor, u_c, hLen); - u_c1 = u_c; - ++j; - return forge.util.setImmediate(inner); - } - - /* 4. Concatenate the blocks and extract the first dkLen octets to - produce a derived key DK: - - DK = T_1 || T_2 || ... || T_len<0..r-1> */ - dk += (i < len) ? xor : xor.substr(0, r); - - ++i; - outer(); - } - - outer(); -}; diff --git a/node_modules/node-forge/lib/pem.js b/node_modules/node-forge/lib/pem.js deleted file mode 100644 index aed8bdf9..00000000 --- a/node_modules/node-forge/lib/pem.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Javascript implementation of basic PEM (Privacy Enhanced Mail) algorithms. - * - * See: RFC 1421. - * - * @author Dave Longley - * - * Copyright (c) 2013-2014 Digital Bazaar, Inc. - * - * A Forge PEM object has the following fields: - * - * type: identifies the type of message (eg: "RSA PRIVATE KEY"). - * - * procType: identifies the type of processing performed on the message, - * it has two subfields: version and type, eg: 4,ENCRYPTED. - * - * contentDomain: identifies the type of content in the message, typically - * only uses the value: "RFC822". - * - * dekInfo: identifies the message encryption algorithm and mode and includes - * any parameters for the algorithm, it has two subfields: algorithm and - * parameters, eg: DES-CBC,F8143EDE5960C597. - * - * headers: contains all other PEM encapsulated headers -- where order is - * significant (for pairing data like recipient ID + key info). - * - * body: the binary-encoded body. - */ -var forge = require('./forge'); -require('./util'); - -// shortcut for pem API -var pem = module.exports = forge.pem = forge.pem || {}; - -/** - * Encodes (serializes) the given PEM object. - * - * @param msg the PEM message object to encode. - * @param options the options to use: - * maxline the maximum characters per line for the body, (default: 64). - * - * @return the PEM-formatted string. - */ -pem.encode = function(msg, options) { - options = options || {}; - var rval = '-----BEGIN ' + msg.type + '-----\r\n'; - - // encode special headers - var header; - if(msg.procType) { - header = { - name: 'Proc-Type', - values: [String(msg.procType.version), msg.procType.type] - }; - rval += foldHeader(header); - } - if(msg.contentDomain) { - header = {name: 'Content-Domain', values: [msg.contentDomain]}; - rval += foldHeader(header); - } - if(msg.dekInfo) { - header = {name: 'DEK-Info', values: [msg.dekInfo.algorithm]}; - if(msg.dekInfo.parameters) { - header.values.push(msg.dekInfo.parameters); - } - rval += foldHeader(header); - } - - if(msg.headers) { - // encode all other headers - for(var i = 0; i < msg.headers.length; ++i) { - rval += foldHeader(msg.headers[i]); - } - } - - // terminate header - if(msg.procType) { - rval += '\r\n'; - } - - // add body - rval += forge.util.encode64(msg.body, options.maxline || 64) + '\r\n'; - - rval += '-----END ' + msg.type + '-----\r\n'; - return rval; -}; - -/** - * Decodes (deserializes) all PEM messages found in the given string. - * - * @param str the PEM-formatted string to decode. - * - * @return the PEM message objects in an array. - */ -pem.decode = function(str) { - var rval = []; - - // split string into PEM messages (be lenient w/EOF on BEGIN line) - var rMessage = /\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g; - var rHeader = /([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/; - var rCRLF = /\r?\n/; - var match; - while(true) { - match = rMessage.exec(str); - if(!match) { - break; - } - - var msg = { - type: match[1], - procType: null, - contentDomain: null, - dekInfo: null, - headers: [], - body: forge.util.decode64(match[3]) - }; - rval.push(msg); - - // no headers - if(!match[2]) { - continue; - } - - // parse headers - var lines = match[2].split(rCRLF); - var li = 0; - while(match && li < lines.length) { - // get line, trim any rhs whitespace - var line = lines[li].replace(/\s+$/, ''); - - // RFC2822 unfold any following folded lines - for(var nl = li + 1; nl < lines.length; ++nl) { - var next = lines[nl]; - if(!/\s/.test(next[0])) { - break; - } - line += next; - li = nl; - } - - // parse header - match = line.match(rHeader); - if(match) { - var header = {name: match[1], values: []}; - var values = match[2].split(','); - for(var vi = 0; vi < values.length; ++vi) { - header.values.push(ltrim(values[vi])); - } - - // Proc-Type must be the first header - if(!msg.procType) { - if(header.name !== 'Proc-Type') { - throw new Error('Invalid PEM formatted message. The first ' + - 'encapsulated header must be "Proc-Type".'); - } else if(header.values.length !== 2) { - throw new Error('Invalid PEM formatted message. The "Proc-Type" ' + - 'header must have two subfields.'); - } - msg.procType = {version: values[0], type: values[1]}; - } else if(!msg.contentDomain && header.name === 'Content-Domain') { - // special-case Content-Domain - msg.contentDomain = values[0] || ''; - } else if(!msg.dekInfo && header.name === 'DEK-Info') { - // special-case DEK-Info - if(header.values.length === 0) { - throw new Error('Invalid PEM formatted message. The "DEK-Info" ' + - 'header must have at least one subfield.'); - } - msg.dekInfo = {algorithm: values[0], parameters: values[1] || null}; - } else { - msg.headers.push(header); - } - } - - ++li; - } - - if(msg.procType === 'ENCRYPTED' && !msg.dekInfo) { - throw new Error('Invalid PEM formatted message. The "DEK-Info" ' + - 'header must be present if "Proc-Type" is "ENCRYPTED".'); - } - } - - if(rval.length === 0) { - throw new Error('Invalid PEM formatted message.'); - } - - return rval; -}; - -function foldHeader(header) { - var rval = header.name + ': '; - - // ensure values with CRLF are folded - var values = []; - var insertSpace = function(match, $1) { - return ' ' + $1; - }; - for(var i = 0; i < header.values.length; ++i) { - values.push(header.values[i].replace(/^(\S+\r\n)/, insertSpace)); - } - rval += values.join(',') + '\r\n'; - - // do folding - var length = 0; - var candidate = -1; - for(var i = 0; i < rval.length; ++i, ++length) { - if(length > 65 && candidate !== -1) { - var insert = rval[candidate]; - if(insert === ',') { - ++candidate; - rval = rval.substr(0, candidate) + '\r\n ' + rval.substr(candidate); - } else { - rval = rval.substr(0, candidate) + - '\r\n' + insert + rval.substr(candidate + 1); - } - length = (i - candidate - 1); - candidate = -1; - ++i; - } else if(rval[i] === ' ' || rval[i] === '\t' || rval[i] === ',') { - candidate = i; - } - } - - return rval; -} - -function ltrim(str) { - return str.replace(/^\s+/, ''); -} diff --git a/node_modules/node-forge/lib/pkcs1.js b/node_modules/node-forge/lib/pkcs1.js deleted file mode 100644 index a3af9242..00000000 --- a/node_modules/node-forge/lib/pkcs1.js +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Partial implementation of PKCS#1 v2.2: RSA-OEAP - * - * Modified but based on the following MIT and BSD licensed code: - * - * https://github.com/kjur/jsjws/blob/master/rsa.js: - * - * The 'jsjws'(JSON Web Signature JavaScript Library) License - * - * Copyright (c) 2012 Kenji Urushima - * - * 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. - * - * http://webrsa.cvs.sourceforge.net/viewvc/webrsa/Client/RSAES-OAEP.js?content-type=text%2Fplain: - * - * RSAES-OAEP.js - * $Id: RSAES-OAEP.js,v 1.1.1.1 2003/03/19 15:37:20 ellispritchard Exp $ - * JavaScript Implementation of PKCS #1 v2.1 RSA CRYPTOGRAPHY STANDARD (RSA Laboratories, June 14, 2002) - * Copyright (C) Ellis Pritchard, Guardian Unlimited 2003. - * Contact: ellis@nukinetics.com - * Distributed under the BSD License. - * - * Official documentation: http://www.rsa.com/rsalabs/node.asp?id=2125 - * - * @author Evan Jones (http://evanjones.ca/) - * @author Dave Longley - * - * Copyright (c) 2013-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); -require('./random'); -require('./sha1'); - -// shortcut for PKCS#1 API -var pkcs1 = module.exports = forge.pkcs1 = forge.pkcs1 || {}; - -/** - * Encode the given RSAES-OAEP message (M) using key, with optional label (L) - * and seed. - * - * This method does not perform RSA encryption, it only encodes the message - * using RSAES-OAEP. - * - * @param key the RSA key to use. - * @param message the message to encode. - * @param options the options to use: - * label an optional label to use. - * seed the seed to use. - * md the message digest object to use, undefined for SHA-1. - * mgf1 optional mgf1 parameters: - * md the message digest object to use for MGF1. - * - * @return the encoded message bytes. - */ -pkcs1.encode_rsa_oaep = function(key, message, options) { - // parse arguments - var label; - var seed; - var md; - var mgf1Md; - // legacy args (label, seed, md) - if(typeof options === 'string') { - label = options; - seed = arguments[3] || undefined; - md = arguments[4] || undefined; - } else if(options) { - label = options.label || undefined; - seed = options.seed || undefined; - md = options.md || undefined; - if(options.mgf1 && options.mgf1.md) { - mgf1Md = options.mgf1.md; - } - } - - // default OAEP to SHA-1 message digest - if(!md) { - md = forge.md.sha1.create(); - } else { - md.start(); - } - - // default MGF-1 to same as OAEP - if(!mgf1Md) { - mgf1Md = md; - } - - // compute length in bytes and check output - var keyLength = Math.ceil(key.n.bitLength() / 8); - var maxLength = keyLength - 2 * md.digestLength - 2; - if(message.length > maxLength) { - var error = new Error('RSAES-OAEP input message length is too long.'); - error.length = message.length; - error.maxLength = maxLength; - throw error; - } - - if(!label) { - label = ''; - } - md.update(label, 'raw'); - var lHash = md.digest(); - - var PS = ''; - var PS_length = maxLength - message.length; - for(var i = 0; i < PS_length; i++) { - PS += '\x00'; - } - - var DB = lHash.getBytes() + PS + '\x01' + message; - - if(!seed) { - seed = forge.random.getBytes(md.digestLength); - } else if(seed.length !== md.digestLength) { - var error = new Error('Invalid RSAES-OAEP seed. The seed length must ' + - 'match the digest length.'); - error.seedLength = seed.length; - error.digestLength = md.digestLength; - throw error; - } - - var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md); - var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length); - - var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md); - var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length); - - // return encoded message - return '\x00' + maskedSeed + maskedDB; -}; - -/** - * Decode the given RSAES-OAEP encoded message (EM) using key, with optional - * label (L). - * - * This method does not perform RSA decryption, it only decodes the message - * using RSAES-OAEP. - * - * @param key the RSA key to use. - * @param em the encoded message to decode. - * @param options the options to use: - * label an optional label to use. - * md the message digest object to use for OAEP, undefined for SHA-1. - * mgf1 optional mgf1 parameters: - * md the message digest object to use for MGF1. - * - * @return the decoded message bytes. - */ -pkcs1.decode_rsa_oaep = function(key, em, options) { - // parse args - var label; - var md; - var mgf1Md; - // legacy args - if(typeof options === 'string') { - label = options; - md = arguments[3] || undefined; - } else if(options) { - label = options.label || undefined; - md = options.md || undefined; - if(options.mgf1 && options.mgf1.md) { - mgf1Md = options.mgf1.md; - } - } - - // compute length in bytes - var keyLength = Math.ceil(key.n.bitLength() / 8); - - if(em.length !== keyLength) { - var error = new Error('RSAES-OAEP encoded message length is invalid.'); - error.length = em.length; - error.expectedLength = keyLength; - throw error; - } - - // default OAEP to SHA-1 message digest - if(md === undefined) { - md = forge.md.sha1.create(); - } else { - md.start(); - } - - // default MGF-1 to same as OAEP - if(!mgf1Md) { - mgf1Md = md; - } - - if(keyLength < 2 * md.digestLength + 2) { - throw new Error('RSAES-OAEP key is too short for the hash function.'); - } - - if(!label) { - label = ''; - } - md.update(label, 'raw'); - var lHash = md.digest().getBytes(); - - // split the message into its parts - var y = em.charAt(0); - var maskedSeed = em.substring(1, md.digestLength + 1); - var maskedDB = em.substring(1 + md.digestLength); - - var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md); - var seed = forge.util.xorBytes(maskedSeed, seedMask, maskedSeed.length); - - var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md); - var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length); - - var lHashPrime = db.substring(0, md.digestLength); - - // constant time check that all values match what is expected - var error = (y !== '\x00'); - - // constant time check lHash vs lHashPrime - for(var i = 0; i < md.digestLength; ++i) { - error |= (lHash.charAt(i) !== lHashPrime.charAt(i)); - } - - // "constant time" find the 0x1 byte separating the padding (zeros) from the - // message - // TODO: It must be possible to do this in a better/smarter way? - var in_ps = 1; - var index = md.digestLength; - for(var j = md.digestLength; j < db.length; j++) { - var code = db.charCodeAt(j); - - var is_0 = (code & 0x1) ^ 0x1; - - // non-zero if not 0 or 1 in the ps section - var error_mask = in_ps ? 0xfffe : 0x0000; - error |= (code & error_mask); - - // latch in_ps to zero after we find 0x1 - in_ps = in_ps & is_0; - index += in_ps; - } - - if(error || db.charCodeAt(index) !== 0x1) { - throw new Error('Invalid RSAES-OAEP padding.'); - } - - return db.substring(index + 1); -}; - -function rsa_mgf1(seed, maskLength, hash) { - // default to SHA-1 message digest - if(!hash) { - hash = forge.md.sha1.create(); - } - var t = ''; - var count = Math.ceil(maskLength / hash.digestLength); - for(var i = 0; i < count; ++i) { - var c = String.fromCharCode( - (i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF); - hash.start(); - hash.update(seed + c); - t += hash.digest().getBytes(); - } - return t.substring(0, maskLength); -} diff --git a/node_modules/node-forge/lib/pkcs12.js b/node_modules/node-forge/lib/pkcs12.js deleted file mode 100644 index cd06c494..00000000 --- a/node_modules/node-forge/lib/pkcs12.js +++ /dev/null @@ -1,1074 +0,0 @@ -/** - * Javascript implementation of PKCS#12. - * - * @author Dave Longley - * @author Stefan Siegl - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - * Copyright (c) 2012 Stefan Siegl - * - * The ASN.1 representation of PKCS#12 is as follows - * (see ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12-tc1.pdf for details) - * - * PFX ::= SEQUENCE { - * version INTEGER {v3(3)}(v3,...), - * authSafe ContentInfo, - * macData MacData OPTIONAL - * } - * - * MacData ::= SEQUENCE { - * mac DigestInfo, - * macSalt OCTET STRING, - * iterations INTEGER DEFAULT 1 - * } - * Note: The iterations default is for historical reasons and its use is - * deprecated. A higher value, like 1024, is recommended. - * - * DigestInfo is defined in PKCS#7 as follows: - * - * DigestInfo ::= SEQUENCE { - * digestAlgorithm DigestAlgorithmIdentifier, - * digest Digest - * } - * - * DigestAlgorithmIdentifier ::= AlgorithmIdentifier - * - * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters - * for the algorithm, if any. In the case of SHA1 there is none. - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * Digest ::= OCTET STRING - * - * - * ContentInfo ::= SEQUENCE { - * contentType ContentType, - * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL - * } - * - * ContentType ::= OBJECT IDENTIFIER - * - * AuthenticatedSafe ::= SEQUENCE OF ContentInfo - * -- Data if unencrypted - * -- EncryptedData if password-encrypted - * -- EnvelopedData if public key-encrypted - * - * - * SafeContents ::= SEQUENCE OF SafeBag - * - * SafeBag ::= SEQUENCE { - * bagId BAG-TYPE.&id ({PKCS12BagSet}) - * bagValue [0] EXPLICIT BAG-TYPE.&Type({PKCS12BagSet}{@bagId}), - * bagAttributes SET OF PKCS12Attribute OPTIONAL - * } - * - * PKCS12Attribute ::= SEQUENCE { - * attrId ATTRIBUTE.&id ({PKCS12AttrSet}), - * attrValues SET OF ATTRIBUTE.&Type ({PKCS12AttrSet}{@attrId}) - * } -- This type is compatible with the X.500 type 'Attribute' - * - * PKCS12AttrSet ATTRIBUTE ::= { - * friendlyName | -- from PKCS #9 - * localKeyId, -- from PKCS #9 - * ... -- Other attributes are allowed - * } - * - * CertBag ::= SEQUENCE { - * certId BAG-TYPE.&id ({CertTypes}), - * certValue [0] EXPLICIT BAG-TYPE.&Type ({CertTypes}{@certId}) - * } - * - * x509Certificate BAG-TYPE ::= {OCTET STRING IDENTIFIED BY {certTypes 1}} - * -- DER-encoded X.509 certificate stored in OCTET STRING - * - * sdsiCertificate BAG-TYPE ::= {IA5String IDENTIFIED BY {certTypes 2}} - * -- Base64-encoded SDSI certificate stored in IA5String - * - * CertTypes BAG-TYPE ::= { - * x509Certificate | - * sdsiCertificate, - * ... -- For future extensions - * } - */ -var forge = require('./forge'); -require('./asn1'); -require('./hmac'); -require('./oids'); -require('./pkcs7asn1'); -require('./pbe'); -require('./random'); -require('./rsa'); -require('./sha1'); -require('./util'); -require('./x509'); - -// shortcut for asn.1 & PKI API -var asn1 = forge.asn1; -var pki = forge.pki; - -// shortcut for PKCS#12 API -var p12 = module.exports = forge.pkcs12 = forge.pkcs12 || {}; - -var contentInfoValidator = { - name: 'ContentInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, // a ContentInfo - constructed: true, - value: [{ - name: 'ContentInfo.contentType', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'contentType' - }, { - name: 'ContentInfo.content', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - constructed: true, - captureAsn1: 'content' - }] -}; - -var pfxValidator = { - name: 'PFX', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PFX.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, - contentInfoValidator, { - name: 'PFX.macData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'mac', - value: [{ - name: 'PFX.macData.mac', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, // DigestInfo - constructed: true, - value: [{ - name: 'PFX.macData.mac.digestAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, // DigestAlgorithmIdentifier - constructed: true, - value: [{ - name: 'PFX.macData.mac.digestAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'macAlgorithm' - }, { - name: 'PFX.macData.mac.digestAlgorithm.parameters', - tagClass: asn1.Class.UNIVERSAL, - captureAsn1: 'macAlgorithmParameters' - }] - }, { - name: 'PFX.macData.mac.digest', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'macDigest' - }] - }, { - name: 'PFX.macData.macSalt', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'macSalt' - }, { - name: 'PFX.macData.iterations', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - optional: true, - capture: 'macIterations' - }] - }] -}; - -var safeBagValidator = { - name: 'SafeBag', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SafeBag.bagId', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'bagId' - }, { - name: 'SafeBag.bagValue', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - constructed: true, - captureAsn1: 'bagValue' - }, { - name: 'SafeBag.bagAttributes', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - optional: true, - capture: 'bagAttributes' - }] -}; - -var attributeValidator = { - name: 'Attribute', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'Attribute.attrId', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'oid' - }, { - name: 'Attribute.attrValues', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - capture: 'values' - }] -}; - -var certBagValidator = { - name: 'CertBag', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'CertBag.certId', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'certId' - }, { - name: 'CertBag.certValue', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - constructed: true, - /* So far we only support X.509 certificates (which are wrapped in - an OCTET STRING, hence hard code that here). */ - value: [{ - name: 'CertBag.certValue[0]', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.OCTETSTRING, - constructed: false, - capture: 'cert' - }] - }] -}; - -/** - * Search SafeContents structure for bags with matching attributes. - * - * The search can optionally be narrowed by a certain bag type. - * - * @param safeContents the SafeContents structure to search in. - * @param attrName the name of the attribute to compare against. - * @param attrValue the attribute value to search for. - * @param [bagType] bag type to narrow search by. - * - * @return an array of matching bags. - */ -function _getBagsByAttribute(safeContents, attrName, attrValue, bagType) { - var result = []; - - for(var i = 0; i < safeContents.length; i++) { - for(var j = 0; j < safeContents[i].safeBags.length; j++) { - var bag = safeContents[i].safeBags[j]; - if(bagType !== undefined && bag.type !== bagType) { - continue; - } - // only filter by bag type, no attribute specified - if(attrName === null) { - result.push(bag); - continue; - } - if(bag.attributes[attrName] !== undefined && - bag.attributes[attrName].indexOf(attrValue) >= 0) { - result.push(bag); - } - } - } - - return result; -} - -/** - * Converts a PKCS#12 PFX in ASN.1 notation into a PFX object. - * - * @param obj The PKCS#12 PFX in ASN.1 notation. - * @param strict true to use strict DER decoding, false not to (default: true). - * @param {String} password Password to decrypt with (optional). - * - * @return PKCS#12 PFX object. - */ -p12.pkcs12FromAsn1 = function(obj, strict, password) { - // handle args - if(typeof strict === 'string') { - password = strict; - strict = true; - } else if(strict === undefined) { - strict = true; - } - - // validate PFX and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, pfxValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#12 PFX. ' + - 'ASN.1 object is not an PKCS#12 PFX.'); - error.errors = error; - throw error; - } - - var pfx = { - version: capture.version.charCodeAt(0), - safeContents: [], - - /** - * Gets bags with matching attributes. - * - * @param filter the attributes to filter by: - * [localKeyId] the localKeyId to search for. - * [localKeyIdHex] the localKeyId in hex to search for. - * [friendlyName] the friendly name to search for. - * [bagType] bag type to narrow each attribute search by. - * - * @return a map of attribute type to an array of matching bags or, if no - * attribute was given but a bag type, the map key will be the - * bag type. - */ - getBags: function(filter) { - var rval = {}; - - var localKeyId; - if('localKeyId' in filter) { - localKeyId = filter.localKeyId; - } else if('localKeyIdHex' in filter) { - localKeyId = forge.util.hexToBytes(filter.localKeyIdHex); - } - - // filter on bagType only - if(localKeyId === undefined && !('friendlyName' in filter) && - 'bagType' in filter) { - rval[filter.bagType] = _getBagsByAttribute( - pfx.safeContents, null, null, filter.bagType); - } - - if(localKeyId !== undefined) { - rval.localKeyId = _getBagsByAttribute( - pfx.safeContents, 'localKeyId', - localKeyId, filter.bagType); - } - if('friendlyName' in filter) { - rval.friendlyName = _getBagsByAttribute( - pfx.safeContents, 'friendlyName', - filter.friendlyName, filter.bagType); - } - - return rval; - }, - - /** - * DEPRECATED: use getBags() instead. - * - * Get bags with matching friendlyName attribute. - * - * @param friendlyName the friendly name to search for. - * @param [bagType] bag type to narrow search by. - * - * @return an array of bags with matching friendlyName attribute. - */ - getBagsByFriendlyName: function(friendlyName, bagType) { - return _getBagsByAttribute( - pfx.safeContents, 'friendlyName', friendlyName, bagType); - }, - - /** - * DEPRECATED: use getBags() instead. - * - * Get bags with matching localKeyId attribute. - * - * @param localKeyId the localKeyId to search for. - * @param [bagType] bag type to narrow search by. - * - * @return an array of bags with matching localKeyId attribute. - */ - getBagsByLocalKeyId: function(localKeyId, bagType) { - return _getBagsByAttribute( - pfx.safeContents, 'localKeyId', localKeyId, bagType); - } - }; - - if(capture.version.charCodeAt(0) !== 3) { - var error = new Error('PKCS#12 PFX of version other than 3 not supported.'); - error.version = capture.version.charCodeAt(0); - throw error; - } - - if(asn1.derToOid(capture.contentType) !== pki.oids.data) { - var error = new Error('Only PKCS#12 PFX in password integrity mode supported.'); - error.oid = asn1.derToOid(capture.contentType); - throw error; - } - - var data = capture.content.value[0]; - if(data.tagClass !== asn1.Class.UNIVERSAL || - data.type !== asn1.Type.OCTETSTRING) { - throw new Error('PKCS#12 authSafe content data is not an OCTET STRING.'); - } - data = _decodePkcs7Data(data); - - // check for MAC - if(capture.mac) { - var md = null; - var macKeyBytes = 0; - var macAlgorithm = asn1.derToOid(capture.macAlgorithm); - switch(macAlgorithm) { - case pki.oids.sha1: - md = forge.md.sha1.create(); - macKeyBytes = 20; - break; - case pki.oids.sha256: - md = forge.md.sha256.create(); - macKeyBytes = 32; - break; - case pki.oids.sha384: - md = forge.md.sha384.create(); - macKeyBytes = 48; - break; - case pki.oids.sha512: - md = forge.md.sha512.create(); - macKeyBytes = 64; - break; - case pki.oids.md5: - md = forge.md.md5.create(); - macKeyBytes = 16; - break; - } - if(md === null) { - throw new Error('PKCS#12 uses unsupported MAC algorithm: ' + macAlgorithm); - } - - // verify MAC (iterations default to 1) - var macSalt = new forge.util.ByteBuffer(capture.macSalt); - var macIterations = (('macIterations' in capture) ? - parseInt(forge.util.bytesToHex(capture.macIterations), 16) : 1); - var macKey = p12.generateKey( - password, macSalt, 3, macIterations, macKeyBytes, md); - var mac = forge.hmac.create(); - mac.start(md, macKey); - mac.update(data.value); - var macValue = mac.getMac(); - if(macValue.getBytes() !== capture.macDigest) { - throw new Error('PKCS#12 MAC could not be verified. Invalid password?'); - } - } - - _decodeAuthenticatedSafe(pfx, data.value, strict, password); - return pfx; -}; - -/** - * Decodes PKCS#7 Data. PKCS#7 (RFC 2315) defines "Data" as an OCTET STRING, - * but it is sometimes an OCTET STRING that is composed/constructed of chunks, - * each its own OCTET STRING. This is BER-encoding vs. DER-encoding. This - * function transforms this corner-case into the usual simple, - * non-composed/constructed OCTET STRING. - * - * This function may be moved to ASN.1 at some point to better deal with - * more BER-encoding issues, should they arise. - * - * @param data the ASN.1 Data object to transform. - */ -function _decodePkcs7Data(data) { - // handle special case of "chunked" data content: an octet string composed - // of other octet strings - if(data.composed || data.constructed) { - var value = forge.util.createBuffer(); - for(var i = 0; i < data.value.length; ++i) { - value.putBytes(data.value[i].value); - } - data.composed = data.constructed = false; - data.value = value.getBytes(); - } - return data; -} - -/** - * Decode PKCS#12 AuthenticatedSafe (BER encoded) into PFX object. - * - * The AuthenticatedSafe is a BER-encoded SEQUENCE OF ContentInfo. - * - * @param pfx The PKCS#12 PFX object to fill. - * @param {String} authSafe BER-encoded AuthenticatedSafe. - * @param strict true to use strict DER decoding, false not to. - * @param {String} password Password to decrypt with (optional). - */ -function _decodeAuthenticatedSafe(pfx, authSafe, strict, password) { - authSafe = asn1.fromDer(authSafe, strict); /* actually it's BER encoded */ - - if(authSafe.tagClass !== asn1.Class.UNIVERSAL || - authSafe.type !== asn1.Type.SEQUENCE || - authSafe.constructed !== true) { - throw new Error('PKCS#12 AuthenticatedSafe expected to be a ' + - 'SEQUENCE OF ContentInfo'); - } - - for(var i = 0; i < authSafe.value.length; i++) { - var contentInfo = authSafe.value[i]; - - // validate contentInfo and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(contentInfo, contentInfoValidator, capture, errors)) { - var error = new Error('Cannot read ContentInfo.'); - error.errors = errors; - throw error; - } - - var obj = { - encrypted: false - }; - var safeContents = null; - var data = capture.content.value[0]; - switch(asn1.derToOid(capture.contentType)) { - case pki.oids.data: - if(data.tagClass !== asn1.Class.UNIVERSAL || - data.type !== asn1.Type.OCTETSTRING) { - throw new Error('PKCS#12 SafeContents Data is not an OCTET STRING.'); - } - safeContents = _decodePkcs7Data(data).value; - break; - case pki.oids.encryptedData: - safeContents = _decryptSafeContents(data, password); - obj.encrypted = true; - break; - default: - var error = new Error('Unsupported PKCS#12 contentType.'); - error.contentType = asn1.derToOid(capture.contentType); - throw error; - } - - obj.safeBags = _decodeSafeContents(safeContents, strict, password); - pfx.safeContents.push(obj); - } -} - -/** - * Decrypt PKCS#7 EncryptedData structure. - * - * @param data ASN.1 encoded EncryptedContentInfo object. - * @param password The user-provided password. - * - * @return The decrypted SafeContents (ASN.1 object). - */ -function _decryptSafeContents(data, password) { - var capture = {}; - var errors = []; - if(!asn1.validate( - data, forge.pkcs7.asn1.encryptedDataValidator, capture, errors)) { - var error = new Error('Cannot read EncryptedContentInfo.'); - error.errors = errors; - throw error; - } - - var oid = asn1.derToOid(capture.contentType); - if(oid !== pki.oids.data) { - var error = new Error( - 'PKCS#12 EncryptedContentInfo ContentType is not Data.'); - error.oid = oid; - throw error; - } - - // get cipher - oid = asn1.derToOid(capture.encAlgorithm); - var cipher = pki.pbe.getCipher(oid, capture.encParameter, password); - - // get encrypted data - var encryptedContentAsn1 = _decodePkcs7Data(capture.encryptedContentAsn1); - var encrypted = forge.util.createBuffer(encryptedContentAsn1.value); - - cipher.update(encrypted); - if(!cipher.finish()) { - throw new Error('Failed to decrypt PKCS#12 SafeContents.'); - } - - return cipher.output.getBytes(); -} - -/** - * Decode PKCS#12 SafeContents (BER-encoded) into array of Bag objects. - * - * The safeContents is a BER-encoded SEQUENCE OF SafeBag. - * - * @param {String} safeContents BER-encoded safeContents. - * @param strict true to use strict DER decoding, false not to. - * @param {String} password Password to decrypt with (optional). - * - * @return {Array} Array of Bag objects. - */ -function _decodeSafeContents(safeContents, strict, password) { - // if strict and no safe contents, return empty safes - if(!strict && safeContents.length === 0) { - return []; - } - - // actually it's BER-encoded - safeContents = asn1.fromDer(safeContents, strict); - - if(safeContents.tagClass !== asn1.Class.UNIVERSAL || - safeContents.type !== asn1.Type.SEQUENCE || - safeContents.constructed !== true) { - throw new Error( - 'PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.'); - } - - var res = []; - for(var i = 0; i < safeContents.value.length; i++) { - var safeBag = safeContents.value[i]; - - // validate SafeBag and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(safeBag, safeBagValidator, capture, errors)) { - var error = new Error('Cannot read SafeBag.'); - error.errors = errors; - throw error; - } - - /* Create bag object and push to result array. */ - var bag = { - type: asn1.derToOid(capture.bagId), - attributes: _decodeBagAttributes(capture.bagAttributes) - }; - res.push(bag); - - var validator, decoder; - var bagAsn1 = capture.bagValue.value[0]; - switch(bag.type) { - case pki.oids.pkcs8ShroudedKeyBag: - /* bagAsn1 has a EncryptedPrivateKeyInfo, which we need to decrypt. - Afterwards we can handle it like a keyBag, - which is a PrivateKeyInfo. */ - bagAsn1 = pki.decryptPrivateKeyInfo(bagAsn1, password); - if(bagAsn1 === null) { - throw new Error( - 'Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?'); - } - - /* fall through */ - case pki.oids.keyBag: - /* A PKCS#12 keyBag is a simple PrivateKeyInfo as understood by our - PKI module, hence we don't have to do validation/capturing here, - just pass what we already got. */ - try { - bag.key = pki.privateKeyFromAsn1(bagAsn1); - } catch(e) { - // ignore unknown key type, pass asn1 value - bag.key = null; - bag.asn1 = bagAsn1; - } - continue; /* Nothing more to do. */ - - case pki.oids.certBag: - /* A PKCS#12 certBag can wrap both X.509 and sdsi certificates. - Therefore put the SafeBag content through another validator to - capture the fields. Afterwards check & store the results. */ - validator = certBagValidator; - decoder = function() { - if(asn1.derToOid(capture.certId) !== pki.oids.x509Certificate) { - var error = new Error( - 'Unsupported certificate type, only X.509 supported.'); - error.oid = asn1.derToOid(capture.certId); - throw error; - } - - // true=produce cert hash - var certAsn1 = asn1.fromDer(capture.cert, strict); - try { - bag.cert = pki.certificateFromAsn1(certAsn1, true); - } catch(e) { - // ignore unknown cert type, pass asn1 value - bag.cert = null; - bag.asn1 = certAsn1; - } - }; - break; - - default: - var error = new Error('Unsupported PKCS#12 SafeBag type.'); - error.oid = bag.type; - throw error; - } - - /* Validate SafeBag value (i.e. CertBag, etc.) and capture data if needed. */ - if(validator !== undefined && - !asn1.validate(bagAsn1, validator, capture, errors)) { - var error = new Error('Cannot read PKCS#12 ' + validator.name); - error.errors = errors; - throw error; - } - - /* Call decoder function from above to store the results. */ - decoder(); - } - - return res; -} - -/** - * Decode PKCS#12 SET OF PKCS12Attribute into JavaScript object. - * - * @param attributes SET OF PKCS12Attribute (ASN.1 object). - * - * @return the decoded attributes. - */ -function _decodeBagAttributes(attributes) { - var decodedAttrs = {}; - - if(attributes !== undefined) { - for(var i = 0; i < attributes.length; ++i) { - var capture = {}; - var errors = []; - if(!asn1.validate(attributes[i], attributeValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#12 BagAttribute.'); - error.errors = errors; - throw error; - } - - var oid = asn1.derToOid(capture.oid); - if(pki.oids[oid] === undefined) { - // unsupported attribute type, ignore. - continue; - } - - decodedAttrs[pki.oids[oid]] = []; - for(var j = 0; j < capture.values.length; ++j) { - decodedAttrs[pki.oids[oid]].push(capture.values[j].value); - } - } - } - - return decodedAttrs; -} - -/** - * Wraps a private key and certificate in a PKCS#12 PFX wrapper. If a - * password is provided then the private key will be encrypted. - * - * An entire certificate chain may also be included. To do this, pass - * an array for the "cert" parameter where the first certificate is - * the one that is paired with the private key and each subsequent one - * verifies the previous one. The certificates may be in PEM format or - * have been already parsed by Forge. - * - * @todo implement password-based-encryption for the whole package - * - * @param key the private key. - * @param cert the certificate (may be an array of certificates in order - * to specify a certificate chain). - * @param password the password to use, null for none. - * @param options: - * algorithm the encryption algorithm to use - * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'. - * count the iteration count to use. - * saltSize the salt size to use. - * useMac true to include a MAC, false not to, defaults to true. - * localKeyId the local key ID to use, in hex. - * friendlyName the friendly name to use. - * generateLocalKeyId true to generate a random local key ID, - * false not to, defaults to true. - * - * @return the PKCS#12 PFX ASN.1 object. - */ -p12.toPkcs12Asn1 = function(key, cert, password, options) { - // set default options - options = options || {}; - options.saltSize = options.saltSize || 8; - options.count = options.count || 2048; - options.algorithm = options.algorithm || options.encAlgorithm || 'aes128'; - if(!('useMac' in options)) { - options.useMac = true; - } - if(!('localKeyId' in options)) { - options.localKeyId = null; - } - if(!('generateLocalKeyId' in options)) { - options.generateLocalKeyId = true; - } - - var localKeyId = options.localKeyId; - var bagAttrs; - if(localKeyId !== null) { - localKeyId = forge.util.hexToBytes(localKeyId); - } else if(options.generateLocalKeyId) { - // use SHA-1 of paired cert, if available - if(cert) { - var pairedCert = forge.util.isArray(cert) ? cert[0] : cert; - if(typeof pairedCert === 'string') { - pairedCert = pki.certificateFromPem(pairedCert); - } - var sha1 = forge.md.sha1.create(); - sha1.update(asn1.toDer(pki.certificateToAsn1(pairedCert)).getBytes()); - localKeyId = sha1.digest().getBytes(); - } else { - // FIXME: consider using SHA-1 of public key (which can be generated - // from private key components), see: cert.generateSubjectKeyIdentifier - // generate random bytes - localKeyId = forge.random.getBytes(20); - } - } - - var attrs = []; - if(localKeyId !== null) { - attrs.push( - // localKeyID - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // attrId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.localKeyId).getBytes()), - // attrValues - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - localKeyId) - ]) - ])); - } - if('friendlyName' in options) { - attrs.push( - // friendlyName - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // attrId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.friendlyName).getBytes()), - // attrValues - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BMPSTRING, false, - options.friendlyName) - ]) - ])); - } - - if(attrs.length > 0) { - bagAttrs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, attrs); - } - - // collect contents for AuthenticatedSafe - var contents = []; - - // create safe bag(s) for certificate chain - var chain = []; - if(cert !== null) { - if(forge.util.isArray(cert)) { - chain = cert; - } else { - chain = [cert]; - } - } - - var certSafeBags = []; - for(var i = 0; i < chain.length; ++i) { - // convert cert from PEM as necessary - cert = chain[i]; - if(typeof cert === 'string') { - cert = pki.certificateFromPem(cert); - } - - // SafeBag - var certBagAttrs = (i === 0) ? bagAttrs : undefined; - var certAsn1 = pki.certificateToAsn1(cert); - var certSafeBag = - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // bagId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.certBag).getBytes()), - // bagValue - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // CertBag - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // certId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.x509Certificate).getBytes()), - // certValue (x509Certificate) - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(certAsn1).getBytes()) - ])])]), - // bagAttributes (OPTIONAL) - certBagAttrs - ]); - certSafeBags.push(certSafeBag); - } - - if(certSafeBags.length > 0) { - // SafeContents - var certSafeContents = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, certSafeBags); - - // ContentInfo - var certCI = - // PKCS#7 ContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // contentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - // OID for the content type is 'data' - asn1.oidToDer(pki.oids.data).getBytes()), - // content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(certSafeContents).getBytes()) - ]) - ]); - contents.push(certCI); - } - - // create safe contents for private key - var keyBag = null; - if(key !== null) { - // SafeBag - var pkAsn1 = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(key)); - if(password === null) { - // no encryption - keyBag = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // bagId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.keyBag).getBytes()), - // bagValue - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // PrivateKeyInfo - pkAsn1 - ]), - // bagAttributes (OPTIONAL) - bagAttrs - ]); - } else { - // encrypted PrivateKeyInfo - keyBag = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // bagId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.pkcs8ShroudedKeyBag).getBytes()), - // bagValue - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // EncryptedPrivateKeyInfo - pki.encryptPrivateKeyInfo(pkAsn1, password, options) - ]), - // bagAttributes (OPTIONAL) - bagAttrs - ]); - } - - // SafeContents - var keySafeContents = - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [keyBag]); - - // ContentInfo - var keyCI = - // PKCS#7 ContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // contentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - // OID for the content type is 'data' - asn1.oidToDer(pki.oids.data).getBytes()), - // content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(keySafeContents).getBytes()) - ]) - ]); - contents.push(keyCI); - } - - // create AuthenticatedSafe by stringing together the contents - var safe = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, contents); - - var macData; - if(options.useMac) { - // MacData - var sha1 = forge.md.sha1.create(); - var macSalt = new forge.util.ByteBuffer( - forge.random.getBytes(options.saltSize)); - var count = options.count; - // 160-bit key - var key = p12.generateKey(password, macSalt, 3, count, 20); - var mac = forge.hmac.create(); - mac.start(sha1, key); - mac.update(asn1.toDer(safe).getBytes()); - var macValue = mac.getMac(); - macData = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // mac DigestInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // digestAlgorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm = SHA-1 - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.sha1).getBytes()), - // parameters = Null - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // digest - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, - false, macValue.getBytes()) - ]), - // macSalt OCTET STRING - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, macSalt.getBytes()), - // iterations INTEGER (XXX: Only support count < 65536) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(count).getBytes() - ) - ]); - } - - // PFX - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version (3) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(3).getBytes()), - // PKCS#7 ContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // contentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - // OID for the content type is 'data' - asn1.oidToDer(pki.oids.data).getBytes()), - // content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(safe).getBytes()) - ]) - ]), - macData - ]); -}; - -/** - * Derives a PKCS#12 key. - * - * @param password the password to derive the key material from, null or - * undefined for none. - * @param salt the salt, as a ByteBuffer, to use. - * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC). - * @param iter the iteration count. - * @param n the number of bytes to derive from the password. - * @param md the message digest to use, defaults to SHA-1. - * - * @return a ByteBuffer with the bytes derived from the password. - */ -p12.generateKey = forge.pbe.generatePkcs12Key; diff --git a/node_modules/node-forge/lib/pkcs7.js b/node_modules/node-forge/lib/pkcs7.js deleted file mode 100644 index bb87de36..00000000 --- a/node_modules/node-forge/lib/pkcs7.js +++ /dev/null @@ -1,1257 +0,0 @@ -/** - * Javascript implementation of PKCS#7 v1.5. - * - * @author Stefan Siegl - * @author Dave Longley - * - * Copyright (c) 2012 Stefan Siegl - * Copyright (c) 2012-2015 Digital Bazaar, Inc. - * - * Currently this implementation only supports ContentType of EnvelopedData, - * EncryptedData, or SignedData at the root level. The top level elements may - * contain only a ContentInfo of ContentType Data, i.e. plain data. Further - * nesting is not (yet) supported. - * - * The Forge validators for PKCS #7's ASN.1 structures are available from - * a separate file pkcs7asn1.js, since those are referenced from other - * PKCS standards like PKCS #12. - */ -var forge = require('./forge'); -require('./aes'); -require('./asn1'); -require('./des'); -require('./oids'); -require('./pem'); -require('./pkcs7asn1'); -require('./random'); -require('./util'); -require('./x509'); - -// shortcut for ASN.1 API -var asn1 = forge.asn1; - -// shortcut for PKCS#7 API -var p7 = module.exports = forge.pkcs7 = forge.pkcs7 || {}; - -/** - * Converts a PKCS#7 message from PEM format. - * - * @param pem the PEM-formatted PKCS#7 message. - * - * @return the PKCS#7 message. - */ -p7.messageFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'PKCS7') { - var error = new Error('Could not convert PKCS#7 message from PEM; PEM ' + - 'header type is not "PKCS#7".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert PKCS#7 message from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body); - - return p7.messageFromAsn1(obj); -}; - -/** - * Converts a PKCS#7 message to PEM format. - * - * @param msg The PKCS#7 message object - * @param maxline The maximum characters per line, defaults to 64. - * - * @return The PEM-formatted PKCS#7 message. - */ -p7.messageToPem = function(msg, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var pemObj = { - type: 'PKCS7', - body: asn1.toDer(msg.toAsn1()).getBytes() - }; - return forge.pem.encode(pemObj, {maxline: maxline}); -}; - -/** - * Converts a PKCS#7 message from an ASN.1 object. - * - * @param obj the ASN.1 representation of a ContentInfo. - * - * @return the PKCS#7 message. - */ -p7.messageFromAsn1 = function(obj) { - // validate root level ContentInfo and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, p7.asn1.contentInfoValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 message. ' + - 'ASN.1 object is not an PKCS#7 ContentInfo.'); - error.errors = errors; - throw error; - } - - var contentType = asn1.derToOid(capture.contentType); - var msg; - - switch(contentType) { - case forge.pki.oids.envelopedData: - msg = p7.createEnvelopedData(); - break; - - case forge.pki.oids.encryptedData: - msg = p7.createEncryptedData(); - break; - - case forge.pki.oids.signedData: - msg = p7.createSignedData(); - break; - - default: - throw new Error('Cannot read PKCS#7 message. ContentType with OID ' + - contentType + ' is not (yet) supported.'); - } - - msg.fromAsn1(capture.content.value[0]); - return msg; -}; - -p7.createSignedData = function() { - var msg = null; - msg = { - type: forge.pki.oids.signedData, - version: 1, - certificates: [], - crls: [], - // TODO: add json-formatted signer stuff here? - signers: [], - // populated during sign() - digestAlgorithmIdentifiers: [], - contentInfo: null, - signerInfos: [], - - fromAsn1: function(obj) { - // validate SignedData content block and capture data. - _fromAsn1(msg, obj, p7.asn1.signedDataValidator); - msg.certificates = []; - msg.crls = []; - msg.digestAlgorithmIdentifiers = []; - msg.contentInfo = null; - msg.signerInfos = []; - - if(msg.rawCapture.certificates) { - var certs = msg.rawCapture.certificates.value; - for(var i = 0; i < certs.length; ++i) { - msg.certificates.push(forge.pki.certificateFromAsn1(certs[i])); - } - } - - // TODO: parse crls - }, - - toAsn1: function() { - // degenerate case with no content - if(!msg.contentInfo) { - msg.sign(); - } - - var certs = []; - for(var i = 0; i < msg.certificates.length; ++i) { - certs.push(forge.pki.certificateToAsn1(msg.certificates[i])); - } - - var crls = []; - // TODO: implement CRLs - - // [0] SignedData - var signedData = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(msg.version).getBytes()), - // DigestAlgorithmIdentifiers - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SET, true, - msg.digestAlgorithmIdentifiers), - // ContentInfo - msg.contentInfo - ]) - ]); - if(certs.length > 0) { - // [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL - signedData.value[0].value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, certs)); - } - if(crls.length > 0) { - // [1] IMPLICIT CertificateRevocationLists OPTIONAL - signedData.value[0].value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, crls)); - } - // SignerInfos - signedData.value[0].value.push( - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, - msg.signerInfos)); - - // ContentInfo - return asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // ContentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(msg.type).getBytes()), - // [0] SignedData - signedData - ]); - }, - - /** - * Add (another) entity to list of signers. - * - * Note: If authenticatedAttributes are provided, then, per RFC 2315, - * they must include at least two attributes: content type and - * message digest. The message digest attribute value will be - * auto-calculated during signing and will be ignored if provided. - * - * Here's an example of providing these two attributes: - * - * forge.pkcs7.createSignedData(); - * p7.addSigner({ - * issuer: cert.issuer.attributes, - * serialNumber: cert.serialNumber, - * key: privateKey, - * digestAlgorithm: forge.pki.oids.sha1, - * authenticatedAttributes: [{ - * type: forge.pki.oids.contentType, - * value: forge.pki.oids.data - * }, { - * type: forge.pki.oids.messageDigest - * }] - * }); - * - * TODO: Support [subjectKeyIdentifier] as signer's ID. - * - * @param signer the signer information: - * key the signer's private key. - * [certificate] a certificate containing the public key - * associated with the signer's private key; use this option as - * an alternative to specifying signer.issuer and - * signer.serialNumber. - * [issuer] the issuer attributes (eg: cert.issuer.attributes). - * [serialNumber] the signer's certificate's serial number in - * hexadecimal (eg: cert.serialNumber). - * [digestAlgorithm] the message digest OID, as a string, to use - * (eg: forge.pki.oids.sha1). - * [authenticatedAttributes] an optional array of attributes - * to also sign along with the content. - */ - addSigner: function(signer) { - var issuer = signer.issuer; - var serialNumber = signer.serialNumber; - if(signer.certificate) { - var cert = signer.certificate; - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - issuer = cert.issuer.attributes; - serialNumber = cert.serialNumber; - } - var key = signer.key; - if(!key) { - throw new Error( - 'Could not add PKCS#7 signer; no private key specified.'); - } - if(typeof key === 'string') { - key = forge.pki.privateKeyFromPem(key); - } - - // ensure OID known for digest algorithm - var digestAlgorithm = signer.digestAlgorithm || forge.pki.oids.sha1; - switch(digestAlgorithm) { - case forge.pki.oids.sha1: - case forge.pki.oids.sha256: - case forge.pki.oids.sha384: - case forge.pki.oids.sha512: - case forge.pki.oids.md5: - break; - default: - throw new Error( - 'Could not add PKCS#7 signer; unknown message digest algorithm: ' + - digestAlgorithm); - } - - // if authenticatedAttributes is present, then the attributes - // must contain at least PKCS #9 content-type and message-digest - var authenticatedAttributes = signer.authenticatedAttributes || []; - if(authenticatedAttributes.length > 0) { - var contentType = false; - var messageDigest = false; - for(var i = 0; i < authenticatedAttributes.length; ++i) { - var attr = authenticatedAttributes[i]; - if(!contentType && attr.type === forge.pki.oids.contentType) { - contentType = true; - if(messageDigest) { - break; - } - continue; - } - if(!messageDigest && attr.type === forge.pki.oids.messageDigest) { - messageDigest = true; - if(contentType) { - break; - } - continue; - } - } - - if(!contentType || !messageDigest) { - throw new Error('Invalid signer.authenticatedAttributes. If ' + - 'signer.authenticatedAttributes is specified, then it must ' + - 'contain at least two attributes, PKCS #9 content-type and ' + - 'PKCS #9 message-digest.'); - } - } - - msg.signers.push({ - key: key, - version: 1, - issuer: issuer, - serialNumber: serialNumber, - digestAlgorithm: digestAlgorithm, - signatureAlgorithm: forge.pki.oids.rsaEncryption, - signature: null, - authenticatedAttributes: authenticatedAttributes, - unauthenticatedAttributes: [] - }); - }, - - /** - * Signs the content. - * @param options Options to apply when signing: - * [detached] boolean. If signing should be done in detached mode. Defaults to false. - */ - sign: function(options) { - options = options || {}; - // auto-generate content info - if(typeof msg.content !== 'object' || msg.contentInfo === null) { - // use Data ContentInfo - msg.contentInfo = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // ContentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(forge.pki.oids.data).getBytes()) - ]); - - // add actual content, if present - if('content' in msg) { - var content; - if(msg.content instanceof forge.util.ByteBuffer) { - content = msg.content.bytes(); - } else if(typeof msg.content === 'string') { - content = forge.util.encodeUtf8(msg.content); - } - - if (options.detached) { - msg.detachedContent = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, content); - } else { - msg.contentInfo.value.push( - // [0] EXPLICIT content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - content) - ])); - } - } - } - - // no signers, return early (degenerate case for certificate container) - if(msg.signers.length === 0) { - return; - } - - // generate digest algorithm identifiers - var mds = addDigestAlgorithmIds(); - - // generate signerInfos - addSignerInfos(mds); - }, - - verify: function() { - throw new Error('PKCS#7 signature verification not yet implemented.'); - }, - - /** - * Add a certificate. - * - * @param cert the certificate to add. - */ - addCertificate: function(cert) { - // convert from PEM - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - msg.certificates.push(cert); - }, - - /** - * Add a certificate revokation list. - * - * @param crl the certificate revokation list to add. - */ - addCertificateRevokationList: function(crl) { - throw new Error('PKCS#7 CRL support not yet implemented.'); - } - }; - return msg; - - function addDigestAlgorithmIds() { - var mds = {}; - - for(var i = 0; i < msg.signers.length; ++i) { - var signer = msg.signers[i]; - var oid = signer.digestAlgorithm; - if(!(oid in mds)) { - // content digest - mds[oid] = forge.md[forge.pki.oids[oid]].create(); - } - if(signer.authenticatedAttributes.length === 0) { - // no custom attributes to digest; use content message digest - signer.md = mds[oid]; - } else { - // custom attributes to be digested; use own message digest - // TODO: optimize to just copy message digest state if that - // feature is ever supported with message digests - signer.md = forge.md[forge.pki.oids[oid]].create(); - } - } - - // add unique digest algorithm identifiers - msg.digestAlgorithmIdentifiers = []; - for(var oid in mds) { - msg.digestAlgorithmIdentifiers.push( - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oid).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ])); - } - - return mds; - } - - function addSignerInfos(mds) { - var content; - - if (msg.detachedContent) { - // Signature has been made in detached mode. - content = msg.detachedContent; - } else { - // Note: ContentInfo is a SEQUENCE with 2 values, second value is - // the content field and is optional for a ContentInfo but required here - // since signers are present - // get ContentInfo content - content = msg.contentInfo.value[1]; - // skip [0] EXPLICIT content wrapper - content = content.value[0]; - } - - if(!content) { - throw new Error( - 'Could not sign PKCS#7 message; there is no content to sign.'); - } - - // get ContentInfo content type - var contentType = asn1.derToOid(msg.contentInfo.value[0].value); - - // serialize content - var bytes = asn1.toDer(content); - - // skip identifier and length per RFC 2315 9.3 - // skip identifier (1 byte) - bytes.getByte(); - // read and discard length bytes - asn1.getBerValueLength(bytes); - bytes = bytes.getBytes(); - - // digest content DER value bytes - for(var oid in mds) { - mds[oid].start().update(bytes); - } - - // sign content - var signingTime = new Date(); - for(var i = 0; i < msg.signers.length; ++i) { - var signer = msg.signers[i]; - - if(signer.authenticatedAttributes.length === 0) { - // if ContentInfo content type is not "Data", then - // authenticatedAttributes must be present per RFC 2315 - if(contentType !== forge.pki.oids.data) { - throw new Error( - 'Invalid signer; authenticatedAttributes must be present ' + - 'when the ContentInfo content type is not PKCS#7 Data.'); - } - } else { - // process authenticated attributes - // [0] IMPLICIT - signer.authenticatedAttributesAsn1 = asn1.create( - asn1.Class.CONTEXT_SPECIFIC, 0, true, []); - - // per RFC 2315, attributes are to be digested using a SET container - // not the above [0] IMPLICIT container - var attrsAsn1 = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SET, true, []); - - for(var ai = 0; ai < signer.authenticatedAttributes.length; ++ai) { - var attr = signer.authenticatedAttributes[ai]; - if(attr.type === forge.pki.oids.messageDigest) { - // use content message digest as value - attr.value = mds[signer.digestAlgorithm].digest(); - } else if(attr.type === forge.pki.oids.signingTime) { - // auto-populate signing time if not already set - if(!attr.value) { - attr.value = signingTime; - } - } - - // convert to ASN.1 and push onto Attributes SET (for signing) and - // onto authenticatedAttributesAsn1 to complete SignedData ASN.1 - // TODO: optimize away duplication - attrsAsn1.value.push(_attributeToAsn1(attr)); - signer.authenticatedAttributesAsn1.value.push(_attributeToAsn1(attr)); - } - - // DER-serialize and digest SET OF attributes only - bytes = asn1.toDer(attrsAsn1).getBytes(); - signer.md.start().update(bytes); - } - - // sign digest - signer.signature = signer.key.sign(signer.md, 'RSASSA-PKCS1-V1_5'); - } - - // add signer info - msg.signerInfos = _signersToAsn1(msg.signers); - } -}; - -/** - * Creates an empty PKCS#7 message of type EncryptedData. - * - * @return the message. - */ -p7.createEncryptedData = function() { - var msg = null; - msg = { - type: forge.pki.oids.encryptedData, - version: 0, - encryptedContent: { - algorithm: forge.pki.oids['aes256-CBC'] - }, - - /** - * Reads an EncryptedData content block (in ASN.1 format) - * - * @param obj The ASN.1 representation of the EncryptedData content block - */ - fromAsn1: function(obj) { - // Validate EncryptedData content block and capture data. - _fromAsn1(msg, obj, p7.asn1.encryptedDataValidator); - }, - - /** - * Decrypt encrypted content - * - * @param key The (symmetric) key as a byte buffer - */ - decrypt: function(key) { - if(key !== undefined) { - msg.encryptedContent.key = key; - } - _decryptContent(msg); - } - }; - return msg; -}; - -/** - * Creates an empty PKCS#7 message of type EnvelopedData. - * - * @return the message. - */ -p7.createEnvelopedData = function() { - var msg = null; - msg = { - type: forge.pki.oids.envelopedData, - version: 0, - recipients: [], - encryptedContent: { - algorithm: forge.pki.oids['aes256-CBC'] - }, - - /** - * Reads an EnvelopedData content block (in ASN.1 format) - * - * @param obj the ASN.1 representation of the EnvelopedData content block. - */ - fromAsn1: function(obj) { - // validate EnvelopedData content block and capture data - var capture = _fromAsn1(msg, obj, p7.asn1.envelopedDataValidator); - msg.recipients = _recipientsFromAsn1(capture.recipientInfos.value); - }, - - toAsn1: function() { - // ContentInfo - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // ContentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(msg.type).getBytes()), - // [0] EnvelopedData - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(msg.version).getBytes()), - // RecipientInfos - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, - _recipientsToAsn1(msg.recipients)), - // EncryptedContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, - _encryptedContentToAsn1(msg.encryptedContent)) - ]) - ]) - ]); - }, - - /** - * Find recipient by X.509 certificate's issuer. - * - * @param cert the certificate with the issuer to look for. - * - * @return the recipient object. - */ - findRecipient: function(cert) { - var sAttr = cert.issuer.attributes; - - for(var i = 0; i < msg.recipients.length; ++i) { - var r = msg.recipients[i]; - var rAttr = r.issuer; - - if(r.serialNumber !== cert.serialNumber) { - continue; - } - - if(rAttr.length !== sAttr.length) { - continue; - } - - var match = true; - for(var j = 0; j < sAttr.length; ++j) { - if(rAttr[j].type !== sAttr[j].type || - rAttr[j].value !== sAttr[j].value) { - match = false; - break; - } - } - - if(match) { - return r; - } - } - - return null; - }, - - /** - * Decrypt enveloped content - * - * @param recipient The recipient object related to the private key - * @param privKey The (RSA) private key object - */ - decrypt: function(recipient, privKey) { - if(msg.encryptedContent.key === undefined && recipient !== undefined && - privKey !== undefined) { - switch(recipient.encryptedContent.algorithm) { - case forge.pki.oids.rsaEncryption: - case forge.pki.oids.desCBC: - var key = privKey.decrypt(recipient.encryptedContent.content); - msg.encryptedContent.key = forge.util.createBuffer(key); - break; - - default: - throw new Error('Unsupported asymmetric cipher, ' + - 'OID ' + recipient.encryptedContent.algorithm); - } - } - - _decryptContent(msg); - }, - - /** - * Add (another) entity to list of recipients. - * - * @param cert The certificate of the entity to add. - */ - addRecipient: function(cert) { - msg.recipients.push({ - version: 0, - issuer: cert.issuer.attributes, - serialNumber: cert.serialNumber, - encryptedContent: { - // We simply assume rsaEncryption here, since forge.pki only - // supports RSA so far. If the PKI module supports other - // ciphers one day, we need to modify this one as well. - algorithm: forge.pki.oids.rsaEncryption, - key: cert.publicKey - } - }); - }, - - /** - * Encrypt enveloped content. - * - * This function supports two optional arguments, cipher and key, which - * can be used to influence symmetric encryption. Unless cipher is - * provided, the cipher specified in encryptedContent.algorithm is used - * (defaults to AES-256-CBC). If no key is provided, encryptedContent.key - * is (re-)used. If that one's not set, a random key will be generated - * automatically. - * - * @param [key] The key to be used for symmetric encryption. - * @param [cipher] The OID of the symmetric cipher to use. - */ - encrypt: function(key, cipher) { - // Part 1: Symmetric encryption - if(msg.encryptedContent.content === undefined) { - cipher = cipher || msg.encryptedContent.algorithm; - key = key || msg.encryptedContent.key; - - var keyLen, ivLen, ciphFn; - switch(cipher) { - case forge.pki.oids['aes128-CBC']: - keyLen = 16; - ivLen = 16; - ciphFn = forge.aes.createEncryptionCipher; - break; - - case forge.pki.oids['aes192-CBC']: - keyLen = 24; - ivLen = 16; - ciphFn = forge.aes.createEncryptionCipher; - break; - - case forge.pki.oids['aes256-CBC']: - keyLen = 32; - ivLen = 16; - ciphFn = forge.aes.createEncryptionCipher; - break; - - case forge.pki.oids['des-EDE3-CBC']: - keyLen = 24; - ivLen = 8; - ciphFn = forge.des.createEncryptionCipher; - break; - - default: - throw new Error('Unsupported symmetric cipher, OID ' + cipher); - } - - if(key === undefined) { - key = forge.util.createBuffer(forge.random.getBytes(keyLen)); - } else if(key.length() != keyLen) { - throw new Error('Symmetric key has wrong length; ' + - 'got ' + key.length() + ' bytes, expected ' + keyLen + '.'); - } - - // Keep a copy of the key & IV in the object, so the caller can - // use it for whatever reason. - msg.encryptedContent.algorithm = cipher; - msg.encryptedContent.key = key; - msg.encryptedContent.parameter = forge.util.createBuffer( - forge.random.getBytes(ivLen)); - - var ciph = ciphFn(key); - ciph.start(msg.encryptedContent.parameter.copy()); - ciph.update(msg.content); - - // The finish function does PKCS#7 padding by default, therefore - // no action required by us. - if(!ciph.finish()) { - throw new Error('Symmetric encryption failed.'); - } - - msg.encryptedContent.content = ciph.output; - } - - // Part 2: asymmetric encryption for each recipient - for(var i = 0; i < msg.recipients.length; ++i) { - var recipient = msg.recipients[i]; - - // Nothing to do, encryption already done. - if(recipient.encryptedContent.content !== undefined) { - continue; - } - - switch(recipient.encryptedContent.algorithm) { - case forge.pki.oids.rsaEncryption: - recipient.encryptedContent.content = - recipient.encryptedContent.key.encrypt( - msg.encryptedContent.key.data); - break; - - default: - throw new Error('Unsupported asymmetric cipher, OID ' + - recipient.encryptedContent.algorithm); - } - } - } - }; - return msg; -}; - -/** - * Converts a single recipient from an ASN.1 object. - * - * @param obj the ASN.1 RecipientInfo. - * - * @return the recipient object. - */ -function _recipientFromAsn1(obj) { - // validate EnvelopedData content block and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, p7.asn1.recipientInfoValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 RecipientInfo. ' + - 'ASN.1 object is not an PKCS#7 RecipientInfo.'); - error.errors = errors; - throw error; - } - - return { - version: capture.version.charCodeAt(0), - issuer: forge.pki.RDNAttributesAsArray(capture.issuer), - serialNumber: forge.util.createBuffer(capture.serial).toHex(), - encryptedContent: { - algorithm: asn1.derToOid(capture.encAlgorithm), - parameter: capture.encParameter.value, - content: capture.encKey - } - }; -} - -/** - * Converts a single recipient object to an ASN.1 object. - * - * @param obj the recipient object. - * - * @return the ASN.1 RecipientInfo. - */ -function _recipientToAsn1(obj) { - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(obj.version).getBytes()), - // IssuerAndSerialNumber - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Name - forge.pki.distinguishedNameToAsn1({attributes: obj.issuer}), - // Serial - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(obj.serialNumber)) - ]), - // KeyEncryptionAlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(obj.encryptedContent.algorithm).getBytes()), - // Parameter, force NULL, only RSA supported for now. - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // EncryptedKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - obj.encryptedContent.content) - ]); -} - -/** - * Map a set of RecipientInfo ASN.1 objects to recipient objects. - * - * @param infos an array of ASN.1 representations RecipientInfo (i.e. SET OF). - * - * @return an array of recipient objects. - */ -function _recipientsFromAsn1(infos) { - var ret = []; - for(var i = 0; i < infos.length; ++i) { - ret.push(_recipientFromAsn1(infos[i])); - } - return ret; -} - -/** - * Map an array of recipient objects to ASN.1 RecipientInfo objects. - * - * @param recipients an array of recipientInfo objects. - * - * @return an array of ASN.1 RecipientInfos. - */ -function _recipientsToAsn1(recipients) { - var ret = []; - for(var i = 0; i < recipients.length; ++i) { - ret.push(_recipientToAsn1(recipients[i])); - } - return ret; -} - -/** - * Converts a single signer from an ASN.1 object. - * - * @param obj the ASN.1 representation of a SignerInfo. - * - * @return the signer object. - */ -function _signerFromAsn1(obj) { - // validate EnvelopedData content block and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, p7.asn1.signerInfoValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 SignerInfo. ' + - 'ASN.1 object is not an PKCS#7 SignerInfo.'); - error.errors = errors; - throw error; - } - - var rval = { - version: capture.version.charCodeAt(0), - issuer: forge.pki.RDNAttributesAsArray(capture.issuer), - serialNumber: forge.util.createBuffer(capture.serial).toHex(), - digestAlgorithm: asn1.derToOid(capture.digestAlgorithm), - signatureAlgorithm: asn1.derToOid(capture.signatureAlgorithm), - signature: capture.signature, - authenticatedAttributes: [], - unauthenticatedAttributes: [] - }; - - // TODO: convert attributes - var authenticatedAttributes = capture.authenticatedAttributes || []; - var unauthenticatedAttributes = capture.unauthenticatedAttributes || []; - - return rval; -} - -/** - * Converts a single signerInfo object to an ASN.1 object. - * - * @param obj the signerInfo object. - * - * @return the ASN.1 representation of a SignerInfo. - */ -function _signerToAsn1(obj) { - // SignerInfo - var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(obj.version).getBytes()), - // issuerAndSerialNumber - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // name - forge.pki.distinguishedNameToAsn1({attributes: obj.issuer}), - // serial - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(obj.serialNumber)) - ]), - // digestAlgorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(obj.digestAlgorithm).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]) - ]); - - // authenticatedAttributes (OPTIONAL) - if(obj.authenticatedAttributesAsn1) { - // add ASN.1 previously generated during signing - rval.value.push(obj.authenticatedAttributesAsn1); - } - - // digestEncryptionAlgorithm - rval.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(obj.signatureAlgorithm).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ])); - - // encryptedDigest - rval.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, obj.signature)); - - // unauthenticatedAttributes (OPTIONAL) - if(obj.unauthenticatedAttributes.length > 0) { - // [1] IMPLICIT - var attrsAsn1 = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, []); - for(var i = 0; i < obj.unauthenticatedAttributes.length; ++i) { - var attr = obj.unauthenticatedAttributes[i]; - attrsAsn1.values.push(_attributeToAsn1(attr)); - } - rval.value.push(attrsAsn1); - } - - return rval; -} - -/** - * Map a set of SignerInfo ASN.1 objects to an array of signer objects. - * - * @param signerInfoAsn1s an array of ASN.1 SignerInfos (i.e. SET OF). - * - * @return an array of signers objects. - */ -function _signersFromAsn1(signerInfoAsn1s) { - var ret = []; - for(var i = 0; i < signerInfoAsn1s.length; ++i) { - ret.push(_signerFromAsn1(signerInfoAsn1s[i])); - } - return ret; -} - -/** - * Map an array of signer objects to ASN.1 objects. - * - * @param signers an array of signer objects. - * - * @return an array of ASN.1 SignerInfos. - */ -function _signersToAsn1(signers) { - var ret = []; - for(var i = 0; i < signers.length; ++i) { - ret.push(_signerToAsn1(signers[i])); - } - return ret; -} - -/** - * Convert an attribute object to an ASN.1 Attribute. - * - * @param attr the attribute object. - * - * @return the ASN.1 Attribute. - */ -function _attributeToAsn1(attr) { - var value; - - // TODO: generalize to support more attributes - if(attr.type === forge.pki.oids.contentType) { - value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.value).getBytes()); - } else if(attr.type === forge.pki.oids.messageDigest) { - value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - attr.value.bytes()); - } else if(attr.type === forge.pki.oids.signingTime) { - /* Note per RFC 2985: Dates between 1 January 1950 and 31 December 2049 - (inclusive) MUST be encoded as UTCTime. Any dates with year values - before 1950 or after 2049 MUST be encoded as GeneralizedTime. [Further,] - UTCTime values MUST be expressed in Greenwich Mean Time (Zulu) and MUST - include seconds (i.e., times are YYMMDDHHMMSSZ), even where the - number of seconds is zero. Midnight (GMT) must be represented as - "YYMMDD000000Z". */ - // TODO: make these module-level constants - var jan_1_1950 = new Date('1950-01-01T00:00:00Z'); - var jan_1_2050 = new Date('2050-01-01T00:00:00Z'); - var date = attr.value; - if(typeof date === 'string') { - // try to parse date - var timestamp = Date.parse(date); - if(!isNaN(timestamp)) { - date = new Date(timestamp); - } else if(date.length === 13) { - // YYMMDDHHMMSSZ (13 chars for UTCTime) - date = asn1.utcTimeToDate(date); - } else { - // assume generalized time - date = asn1.generalizedTimeToDate(date); - } - } - - if(date >= jan_1_1950 && date < jan_1_2050) { - value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false, - asn1.dateToUtcTime(date)); - } else { - value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false, - asn1.dateToGeneralizedTime(date)); - } - } - - // TODO: expose as common API call - // create a RelativeDistinguishedName set - // each value in the set is an AttributeTypeAndValue first - // containing the type (an OID) and second the value - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AttributeType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.type).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - // AttributeValue - value - ]) - ]); -} - -/** - * Map messages encrypted content to ASN.1 objects. - * - * @param ec The encryptedContent object of the message. - * - * @return ASN.1 representation of the encryptedContent object (SEQUENCE). - */ -function _encryptedContentToAsn1(ec) { - return [ - // ContentType, always Data for the moment - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(forge.pki.oids.data).getBytes()), - // ContentEncryptionAlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(ec.algorithm).getBytes()), - // Parameters (IV) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - ec.parameter.getBytes()) - ]), - // [0] EncryptedContent - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - ec.content.getBytes()) - ]) - ]; -} - -/** - * Reads the "common part" of an PKCS#7 content block (in ASN.1 format) - * - * This function reads the "common part" of the PKCS#7 content blocks - * EncryptedData and EnvelopedData, i.e. version number and symmetrically - * encrypted content block. - * - * The result of the ASN.1 validate and capture process is returned - * to allow the caller to extract further data, e.g. the list of recipients - * in case of a EnvelopedData object. - * - * @param msg the PKCS#7 object to read the data to. - * @param obj the ASN.1 representation of the content block. - * @param validator the ASN.1 structure validator object to use. - * - * @return the value map captured by validator object. - */ -function _fromAsn1(msg, obj, validator) { - var capture = {}; - var errors = []; - if(!asn1.validate(obj, validator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 message. ' + - 'ASN.1 object is not a supported PKCS#7 message.'); - error.errors = error; - throw error; - } - - // Check contentType, so far we only support (raw) Data. - var contentType = asn1.derToOid(capture.contentType); - if(contentType !== forge.pki.oids.data) { - throw new Error('Unsupported PKCS#7 message. ' + - 'Only wrapped ContentType Data supported.'); - } - - if(capture.encryptedContent) { - var content = ''; - if(forge.util.isArray(capture.encryptedContent)) { - for(var i = 0; i < capture.encryptedContent.length; ++i) { - if(capture.encryptedContent[i].type !== asn1.Type.OCTETSTRING) { - throw new Error('Malformed PKCS#7 message, expecting encrypted ' + - 'content constructed of only OCTET STRING objects.'); - } - content += capture.encryptedContent[i].value; - } - } else { - content = capture.encryptedContent; - } - msg.encryptedContent = { - algorithm: asn1.derToOid(capture.encAlgorithm), - parameter: forge.util.createBuffer(capture.encParameter.value), - content: forge.util.createBuffer(content) - }; - } - - if(capture.content) { - var content = ''; - if(forge.util.isArray(capture.content)) { - for(var i = 0; i < capture.content.length; ++i) { - if(capture.content[i].type !== asn1.Type.OCTETSTRING) { - throw new Error('Malformed PKCS#7 message, expecting ' + - 'content constructed of only OCTET STRING objects.'); - } - content += capture.content[i].value; - } - } else { - content = capture.content; - } - msg.content = forge.util.createBuffer(content); - } - - msg.version = capture.version.charCodeAt(0); - msg.rawCapture = capture; - - return capture; -} - -/** - * Decrypt the symmetrically encrypted content block of the PKCS#7 message. - * - * Decryption is skipped in case the PKCS#7 message object already has a - * (decrypted) content attribute. The algorithm, key and cipher parameters - * (probably the iv) are taken from the encryptedContent attribute of the - * message object. - * - * @param The PKCS#7 message object. - */ -function _decryptContent(msg) { - if(msg.encryptedContent.key === undefined) { - throw new Error('Symmetric key not available.'); - } - - if(msg.content === undefined) { - var ciph; - - switch(msg.encryptedContent.algorithm) { - case forge.pki.oids['aes128-CBC']: - case forge.pki.oids['aes192-CBC']: - case forge.pki.oids['aes256-CBC']: - ciph = forge.aes.createDecryptionCipher(msg.encryptedContent.key); - break; - - case forge.pki.oids['desCBC']: - case forge.pki.oids['des-EDE3-CBC']: - ciph = forge.des.createDecryptionCipher(msg.encryptedContent.key); - break; - - default: - throw new Error('Unsupported symmetric cipher, OID ' + - msg.encryptedContent.algorithm); - } - ciph.start(msg.encryptedContent.parameter); - ciph.update(msg.encryptedContent.content); - - if(!ciph.finish()) { - throw new Error('Symmetric decryption failed.'); - } - - msg.content = ciph.output; - } -} diff --git a/node_modules/node-forge/lib/pkcs7asn1.js b/node_modules/node-forge/lib/pkcs7asn1.js deleted file mode 100644 index a2ac01f8..00000000 --- a/node_modules/node-forge/lib/pkcs7asn1.js +++ /dev/null @@ -1,409 +0,0 @@ -/** - * Javascript implementation of ASN.1 validators for PKCS#7 v1.5. - * - * @author Dave Longley - * @author Stefan Siegl - * - * Copyright (c) 2012-2015 Digital Bazaar, Inc. - * Copyright (c) 2012 Stefan Siegl - * - * The ASN.1 representation of PKCS#7 is as follows - * (see RFC #2315 for details, http://www.ietf.org/rfc/rfc2315.txt): - * - * A PKCS#7 message consists of a ContentInfo on root level, which may - * contain any number of further ContentInfo nested into it. - * - * ContentInfo ::= SEQUENCE { - * contentType ContentType, - * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL - * } - * - * ContentType ::= OBJECT IDENTIFIER - * - * EnvelopedData ::= SEQUENCE { - * version Version, - * recipientInfos RecipientInfos, - * encryptedContentInfo EncryptedContentInfo - * } - * - * EncryptedData ::= SEQUENCE { - * version Version, - * encryptedContentInfo EncryptedContentInfo - * } - * - * id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) - * us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } - * - * SignedData ::= SEQUENCE { - * version INTEGER, - * digestAlgorithms DigestAlgorithmIdentifiers, - * contentInfo ContentInfo, - * certificates [0] IMPLICIT Certificates OPTIONAL, - * crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, - * signerInfos SignerInfos - * } - * - * SignerInfos ::= SET OF SignerInfo - * - * SignerInfo ::= SEQUENCE { - * version Version, - * issuerAndSerialNumber IssuerAndSerialNumber, - * digestAlgorithm DigestAlgorithmIdentifier, - * authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, - * digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier, - * encryptedDigest EncryptedDigest, - * unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL - * } - * - * EncryptedDigest ::= OCTET STRING - * - * Attributes ::= SET OF Attribute - * - * Attribute ::= SEQUENCE { - * attrType OBJECT IDENTIFIER, - * attrValues SET OF AttributeValue - * } - * - * AttributeValue ::= ANY - * - * Version ::= INTEGER - * - * RecipientInfos ::= SET OF RecipientInfo - * - * EncryptedContentInfo ::= SEQUENCE { - * contentType ContentType, - * contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, - * encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL - * } - * - * ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier - * - * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters - * for the algorithm, if any. In the case of AES and DES3, there is only one, - * the IV. - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * EncryptedContent ::= OCTET STRING - * - * RecipientInfo ::= SEQUENCE { - * version Version, - * issuerAndSerialNumber IssuerAndSerialNumber, - * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, - * encryptedKey EncryptedKey - * } - * - * IssuerAndSerialNumber ::= SEQUENCE { - * issuer Name, - * serialNumber CertificateSerialNumber - * } - * - * CertificateSerialNumber ::= INTEGER - * - * KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier - * - * EncryptedKey ::= OCTET STRING - */ -var forge = require('./forge'); -require('./asn1'); -require('./util'); - -// shortcut for ASN.1 API -var asn1 = forge.asn1; - -// shortcut for PKCS#7 API -var p7v = module.exports = forge.pkcs7asn1 = forge.pkcs7asn1 || {}; -forge.pkcs7 = forge.pkcs7 || {}; -forge.pkcs7.asn1 = p7v; - -var contentInfoValidator = { - name: 'ContentInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'ContentInfo.ContentType', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'contentType' - }, { - name: 'ContentInfo.content', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - captureAsn1: 'content' - }] -}; -p7v.contentInfoValidator = contentInfoValidator; - -var encryptedContentInfoValidator = { - name: 'EncryptedContentInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedContentInfo.contentType', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'contentType' - }, { - name: 'EncryptedContentInfo.contentEncryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedContentInfo.contentEncryptionAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encAlgorithm' - }, { - name: 'EncryptedContentInfo.contentEncryptionAlgorithm.parameter', - tagClass: asn1.Class.UNIVERSAL, - captureAsn1: 'encParameter' - }] - }, { - name: 'EncryptedContentInfo.encryptedContent', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - /* The PKCS#7 structure output by OpenSSL somewhat differs from what - * other implementations do generate. - * - * OpenSSL generates a structure like this: - * SEQUENCE { - * ... - * [0] - * 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38 - * C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45 - * ... - * } - * - * Whereas other implementations (and this PKCS#7 module) generate: - * SEQUENCE { - * ... - * [0] { - * OCTET STRING - * 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38 - * C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45 - * ... - * } - * } - * - * In order to support both, we just capture the context specific - * field here. The OCTET STRING bit is removed below. - */ - capture: 'encryptedContent', - captureAsn1: 'encryptedContentAsn1' - }] -}; - -p7v.envelopedDataValidator = { - name: 'EnvelopedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EnvelopedData.Version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, { - name: 'EnvelopedData.RecipientInfos', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - captureAsn1: 'recipientInfos' - }].concat(encryptedContentInfoValidator) -}; - -p7v.encryptedDataValidator = { - name: 'EncryptedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedData.Version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }].concat(encryptedContentInfoValidator) -}; - -var signerValidator = { - name: 'SignerInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignerInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false - }, { - name: 'SignerInfo.issuerAndSerialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignerInfo.issuerAndSerialNumber.issuer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'issuer' - }, { - name: 'SignerInfo.issuerAndSerialNumber.serialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'serial' - }] - }, { - name: 'SignerInfo.digestAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignerInfo.digestAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'digestAlgorithm' - }, { - name: 'SignerInfo.digestAlgorithm.parameter', - tagClass: asn1.Class.UNIVERSAL, - constructed: false, - captureAsn1: 'digestParameter', - optional: true - }] - }, { - name: 'SignerInfo.authenticatedAttributes', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - capture: 'authenticatedAttributes' - }, { - name: 'SignerInfo.digestEncryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - capture: 'signatureAlgorithm' - }, { - name: 'SignerInfo.encryptedDigest', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'signature' - }, { - name: 'SignerInfo.unauthenticatedAttributes', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - constructed: true, - optional: true, - capture: 'unauthenticatedAttributes' - }] -}; - -p7v.signedDataValidator = { - name: 'SignedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignedData.Version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, { - name: 'SignedData.DigestAlgorithms', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - captureAsn1: 'digestAlgorithms' - }, - contentInfoValidator, - { - name: 'SignedData.Certificates', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - optional: true, - captureAsn1: 'certificates' - }, { - name: 'SignedData.CertificateRevocationLists', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - optional: true, - captureAsn1: 'crls' - }, { - name: 'SignedData.SignerInfos', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - capture: 'signerInfos', - optional: true, - value: [signerValidator] - }] -}; - -p7v.recipientInfoValidator = { - name: 'RecipientInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'RecipientInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, { - name: 'RecipientInfo.issuerAndSerial', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'RecipientInfo.issuerAndSerial.issuer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'issuer' - }, { - name: 'RecipientInfo.issuerAndSerial.serialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'serial' - }] - }, { - name: 'RecipientInfo.keyEncryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'RecipientInfo.keyEncryptionAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encAlgorithm' - }, { - name: 'RecipientInfo.keyEncryptionAlgorithm.parameter', - tagClass: asn1.Class.UNIVERSAL, - constructed: false, - captureAsn1: 'encParameter' - }] - }, { - name: 'RecipientInfo.encryptedKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'encKey' - }] -}; diff --git a/node_modules/node-forge/lib/pki.js b/node_modules/node-forge/lib/pki.js deleted file mode 100644 index ee82ff1c..00000000 --- a/node_modules/node-forge/lib/pki.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Javascript implementation of a basic Public Key Infrastructure, including - * support for RSA public and private keys. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./asn1'); -require('./oids'); -require('./pbe'); -require('./pem'); -require('./pbkdf2'); -require('./pkcs12'); -require('./pss'); -require('./rsa'); -require('./util'); -require('./x509'); - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -/* Public Key Infrastructure (PKI) implementation. */ -var pki = module.exports = forge.pki = forge.pki || {}; - -/** - * NOTE: THIS METHOD IS DEPRECATED. Use pem.decode() instead. - * - * Converts PEM-formatted data to DER. - * - * @param pem the PEM-formatted data. - * - * @return the DER-formatted data. - */ -pki.pemToDer = function(pem) { - var msg = forge.pem.decode(pem)[0]; - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert PEM to DER; PEM is encrypted.'); - } - return forge.util.createBuffer(msg.body); -}; - -/** - * Converts an RSA private key from PEM format. - * - * @param pem the PEM-formatted private key. - * - * @return the private key. - */ -pki.privateKeyFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'PRIVATE KEY' && msg.type !== 'RSA PRIVATE KEY') { - var error = new Error('Could not convert private key from PEM; PEM ' + - 'header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert private key from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body); - - return pki.privateKeyFromAsn1(obj); -}; - -/** - * Converts an RSA private key to PEM format. - * - * @param key the private key. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted private key. - */ -pki.privateKeyToPem = function(key, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'RSA PRIVATE KEY', - body: asn1.toDer(pki.privateKeyToAsn1(key)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts a PrivateKeyInfo to PEM format. - * - * @param pki the PrivateKeyInfo. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted private key. - */ -pki.privateKeyInfoToPem = function(pki, maxline) { - // convert to DER, then PEM-encode - var msg = { - type: 'PRIVATE KEY', - body: asn1.toDer(pki).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; diff --git a/node_modules/node-forge/lib/prime.js b/node_modules/node-forge/lib/prime.js deleted file mode 100644 index 3d51473f..00000000 --- a/node_modules/node-forge/lib/prime.js +++ /dev/null @@ -1,297 +0,0 @@ -/** - * Prime number generation API. - * - * @author Dave Longley - * - * Copyright (c) 2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); -require('./jsbn'); -require('./random'); - -(function() { - -// forge.prime already defined -if(forge.prime) { - module.exports = forge.prime; - return; -} - -/* PRIME API */ -var prime = module.exports = forge.prime = forge.prime || {}; - -var BigInteger = forge.jsbn.BigInteger; - -// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 -var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; -var THIRTY = new BigInteger(null); -THIRTY.fromInt(30); -var op_or = function(x, y) {return x|y;}; - -/** - * Generates a random probable prime with the given number of bits. - * - * Alternative algorithms can be specified by name as a string or as an - * object with custom options like so: - * - * { - * name: 'PRIMEINC', - * options: { - * maxBlockTime: , - * millerRabinTests: , - * workerScript: , - * workers: . - * workLoad: the size of the work load, ie: number of possible prime - * numbers for each web worker to check per work assignment, - * (default: 100). - * } - * } - * - * @param bits the number of bits for the prime number. - * @param options the options to use. - * [algorithm] the algorithm to use (default: 'PRIMEINC'). - * [prng] a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". - * - * @return callback(err, num) called once the operation completes. - */ -prime.generateProbablePrime = function(bits, options, callback) { - if(typeof options === 'function') { - callback = options; - options = {}; - } - options = options || {}; - - // default to PRIMEINC algorithm - var algorithm = options.algorithm || 'PRIMEINC'; - if(typeof algorithm === 'string') { - algorithm = {name: algorithm}; - } - algorithm.options = algorithm.options || {}; - - // create prng with api that matches BigInteger secure random - var prng = options.prng || forge.random; - var rng = { - // x is an array to fill with bytes - nextBytes: function(x) { - var b = prng.getBytesSync(x.length); - for(var i = 0; i < x.length; ++i) { - x[i] = b.charCodeAt(i); - } - } - }; - - if(algorithm.name === 'PRIMEINC') { - return primeincFindPrime(bits, rng, algorithm.options, callback); - } - - throw new Error('Invalid prime generation algorithm: ' + algorithm.name); -}; - -function primeincFindPrime(bits, rng, options, callback) { - if('workers' in options) { - return primeincFindPrimeWithWorkers(bits, rng, options, callback); - } - return primeincFindPrimeWithoutWorkers(bits, rng, options, callback); -} - -function primeincFindPrimeWithoutWorkers(bits, rng, options, callback) { - // initialize random number - var num = generateRandom(bits, rng); - - /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The - number we are given is always aligned at 30k + 1. Each time the number is - determined not to be prime we add to get to the next 'i', eg: if the number - was at 30k + 1 we add 6. */ - var deltaIdx = 0; - - // get required number of MR tests - var mrTests = getMillerRabinTests(num.bitLength()); - if('millerRabinTests' in options) { - mrTests = options.millerRabinTests; - } - - // find prime nearest to 'num' for maxBlockTime ms - // 10 ms gives 5ms of leeway for other calculations before dropping - // below 60fps (1000/60 == 16.67), but in reality, the number will - // likely be higher due to an 'atomic' big int modPow - var maxBlockTime = 10; - if('maxBlockTime' in options) { - maxBlockTime = options.maxBlockTime; - } - - _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback); -} - -function _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback) { - var start = +new Date(); - do { - // overflow, regenerate random number - if(num.bitLength() > bits) { - num = generateRandom(bits, rng); - } - // do primality test - if(num.isProbablePrime(mrTests)) { - return callback(null, num); - } - // get next potential prime - num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); - } while(maxBlockTime < 0 || (+new Date() - start < maxBlockTime)); - - // keep trying later - forge.util.setImmediate(function() { - _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback); - }); -} - -// NOTE: This algorithm is indeterminate in nature because workers -// run in parallel looking at different segments of numbers. Even if this -// algorithm is run twice with the same input from a predictable RNG, it -// may produce different outputs. -function primeincFindPrimeWithWorkers(bits, rng, options, callback) { - // web workers unavailable - if(typeof Worker === 'undefined') { - return primeincFindPrimeWithoutWorkers(bits, rng, options, callback); - } - - // initialize random number - var num = generateRandom(bits, rng); - - // use web workers to generate keys - var numWorkers = options.workers; - var workLoad = options.workLoad || 100; - var range = workLoad * 30 / 8; - var workerScript = options.workerScript || 'forge/prime.worker.js'; - if(numWorkers === -1) { - return forge.util.estimateCores(function(err, cores) { - if(err) { - // default to 2 - cores = 2; - } - numWorkers = cores - 1; - generate(); - }); - } - generate(); - - function generate() { - // require at least 1 worker - numWorkers = Math.max(1, numWorkers); - - // TODO: consider optimizing by starting workers outside getPrime() ... - // note that in order to clean up they will have to be made internally - // asynchronous which may actually be slower - - // start workers immediately - var workers = []; - for(var i = 0; i < numWorkers; ++i) { - // FIXME: fix path or use blob URLs - workers[i] = new Worker(workerScript); - } - var running = numWorkers; - - // listen for requests from workers and assign ranges to find prime - for(var i = 0; i < numWorkers; ++i) { - workers[i].addEventListener('message', workerMessage); - } - - /* Note: The distribution of random numbers is unknown. Therefore, each - web worker is continuously allocated a range of numbers to check for a - random number until one is found. - - Every 30 numbers will be checked just 8 times, because prime numbers - have the form: - - 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this) - - Therefore, if we want a web worker to run N checks before asking for - a new range of numbers, each range must contain N*30/8 numbers. - - For 100 checks (workLoad), this is a range of 375. */ - - var found = false; - function workerMessage(e) { - // ignore message, prime already found - if(found) { - return; - } - - --running; - var data = e.data; - if(data.found) { - // terminate all workers - for(var i = 0; i < workers.length; ++i) { - workers[i].terminate(); - } - found = true; - return callback(null, new BigInteger(data.prime, 16)); - } - - // overflow, regenerate random number - if(num.bitLength() > bits) { - num = generateRandom(bits, rng); - } - - // assign new range to check - var hex = num.toString(16); - - // start prime search - e.target.postMessage({ - hex: hex, - workLoad: workLoad - }); - - num.dAddOffset(range, 0); - } - } -} - -/** - * Generates a random number using the given number of bits and RNG. - * - * @param bits the number of bits for the number. - * @param rng the random number generator to use. - * - * @return the random number. - */ -function generateRandom(bits, rng) { - var num = new BigInteger(bits, rng); - // force MSB set - var bits1 = bits - 1; - if(!num.testBit(bits1)) { - num.bitwiseTo(BigInteger.ONE.shiftLeft(bits1), op_or, num); - } - // align number on 30k+1 boundary - num.dAddOffset(31 - num.mod(THIRTY).byteValue(), 0); - return num; -} - -/** - * Returns the required number of Miller-Rabin tests to generate a - * prime with an error probability of (1/2)^80. - * - * See Handbook of Applied Cryptography Chapter 4, Table 4.4. - * - * @param bits the bit size. - * - * @return the required number of iterations. - */ -function getMillerRabinTests(bits) { - if(bits <= 100) return 27; - if(bits <= 150) return 18; - if(bits <= 200) return 15; - if(bits <= 250) return 12; - if(bits <= 300) return 9; - if(bits <= 350) return 8; - if(bits <= 400) return 7; - if(bits <= 500) return 6; - if(bits <= 600) return 5; - if(bits <= 800) return 4; - if(bits <= 1250) return 3; - return 2; -} - -})(); diff --git a/node_modules/node-forge/lib/prime.worker.js b/node_modules/node-forge/lib/prime.worker.js deleted file mode 100644 index ce1355d9..00000000 --- a/node_modules/node-forge/lib/prime.worker.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * RSA Key Generation Worker. - * - * @author Dave Longley - * - * Copyright (c) 2013 Digital Bazaar, Inc. - */ -// worker is built using CommonJS syntax to include all code in one worker file -//importScripts('jsbn.js'); -var forge = require('./forge'); -require('./jsbn'); - -// prime constants -var LOW_PRIMES = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; -var LP_LIMIT = (1 << 26) / LOW_PRIMES[LOW_PRIMES.length - 1]; - -var BigInteger = forge.jsbn.BigInteger; -var BIG_TWO = new BigInteger(null); -BIG_TWO.fromInt(2); - -self.addEventListener('message', function(e) { - var result = findPrime(e.data); - self.postMessage(result); -}); - -// start receiving ranges to check -self.postMessage({found: false}); - -// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 -var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; - -function findPrime(data) { - // TODO: abstract based on data.algorithm (PRIMEINC vs. others) - - // create BigInteger from given random bytes - var num = new BigInteger(data.hex, 16); - - /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The - number we are given is always aligned at 30k + 1. Each time the number is - determined not to be prime we add to get to the next 'i', eg: if the number - was at 30k + 1 we add 6. */ - var deltaIdx = 0; - - // find nearest prime - var workLoad = data.workLoad; - for(var i = 0; i < workLoad; ++i) { - // do primality test - if(isProbablePrime(num)) { - return {found: true, prime: num.toString(16)}; - } - // get next potential prime - num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); - } - - return {found: false}; -} - -function isProbablePrime(n) { - // divide by low primes, ignore even checks, etc (n alread aligned properly) - var i = 1; - while(i < LOW_PRIMES.length) { - var m = LOW_PRIMES[i]; - var j = i + 1; - while(j < LOW_PRIMES.length && m < LP_LIMIT) { - m *= LOW_PRIMES[j++]; - } - m = n.modInt(m); - while(i < j) { - if(m % LOW_PRIMES[i++] === 0) { - return false; - } - } - } - return runMillerRabin(n); -} - -// HAC 4.24, Miller-Rabin -function runMillerRabin(n) { - // n1 = n - 1 - var n1 = n.subtract(BigInteger.ONE); - - // get s and d such that n1 = 2^s * d - var s = n1.getLowestSetBit(); - if(s <= 0) { - return false; - } - var d = n1.shiftRight(s); - - var k = _getMillerRabinTests(n.bitLength()); - var prng = getPrng(); - var a; - for(var i = 0; i < k; ++i) { - // select witness 'a' at random from between 1 and n - 1 - do { - a = new BigInteger(n.bitLength(), prng); - } while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0); - - /* See if 'a' is a composite witness. */ - - // x = a^d mod n - var x = a.modPow(d, n); - - // probably prime - if(x.compareTo(BigInteger.ONE) === 0 || x.compareTo(n1) === 0) { - continue; - } - - var j = s; - while(--j) { - // x = x^2 mod a - x = x.modPowInt(2, n); - - // 'n' is composite because no previous x == -1 mod n - if(x.compareTo(BigInteger.ONE) === 0) { - return false; - } - // x == -1 mod n, so probably prime - if(x.compareTo(n1) === 0) { - break; - } - } - - // 'x' is first_x^(n1/2) and is not +/- 1, so 'n' is not prime - if(j === 0) { - return false; - } - } - - return true; -} - -// get pseudo random number generator -function getPrng() { - // create prng with api that matches BigInteger secure random - return { - // x is an array to fill with bytes - nextBytes: function(x) { - for(var i = 0; i < x.length; ++i) { - x[i] = Math.floor(Math.random() * 0xFF); - } - } - }; -} - -/** - * Returns the required number of Miller-Rabin tests to generate a - * prime with an error probability of (1/2)^80. - * - * See Handbook of Applied Cryptography Chapter 4, Table 4.4. - * - * @param bits the bit size. - * - * @return the required number of iterations. - */ -function _getMillerRabinTests(bits) { - if(bits <= 100) return 27; - if(bits <= 150) return 18; - if(bits <= 200) return 15; - if(bits <= 250) return 12; - if(bits <= 300) return 9; - if(bits <= 350) return 8; - if(bits <= 400) return 7; - if(bits <= 500) return 6; - if(bits <= 600) return 5; - if(bits <= 800) return 4; - if(bits <= 1250) return 3; - return 2; -} diff --git a/node_modules/node-forge/lib/prng.js b/node_modules/node-forge/lib/prng.js deleted file mode 100644 index c2f5f051..00000000 --- a/node_modules/node-forge/lib/prng.js +++ /dev/null @@ -1,419 +0,0 @@ -/** - * A javascript implementation of a cryptographically-secure - * Pseudo Random Number Generator (PRNG). The Fortuna algorithm is followed - * here though the use of SHA-256 is not enforced; when generating an - * a PRNG context, the hashing algorithm and block cipher used for - * the generator are specified via a plugin. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -var _crypto = null; -if(forge.util.isNodejs && !forge.options.usePureJavaScript && - !process.versions['node-webkit']) { - _crypto = require('crypto'); -} - -/* PRNG API */ -var prng = module.exports = forge.prng = forge.prng || {}; - -/** - * Creates a new PRNG context. - * - * A PRNG plugin must be passed in that will provide: - * - * 1. A function that initializes the key and seed of a PRNG context. It - * will be given a 16 byte key and a 16 byte seed. Any key expansion - * or transformation of the seed from a byte string into an array of - * integers (or similar) should be performed. - * 2. The cryptographic function used by the generator. It takes a key and - * a seed. - * 3. A seed increment function. It takes the seed and returns seed + 1. - * 4. An api to create a message digest. - * - * For an example, see random.js. - * - * @param plugin the PRNG plugin to use. - */ -prng.create = function(plugin) { - var ctx = { - plugin: plugin, - key: null, - seed: null, - time: null, - // number of reseeds so far - reseeds: 0, - // amount of data generated so far - generated: 0, - // no initial key bytes - keyBytes: '' - }; - - // create 32 entropy pools (each is a message digest) - var md = plugin.md; - var pools = new Array(32); - for(var i = 0; i < 32; ++i) { - pools[i] = md.create(); - } - ctx.pools = pools; - - // entropy pools are written to cyclically, starting at index 0 - ctx.pool = 0; - - /** - * Generates random bytes. The bytes may be generated synchronously or - * asynchronously. Web workers must use the asynchronous interface or - * else the behavior is undefined. - * - * @param count the number of random bytes to generate. - * @param [callback(err, bytes)] called once the operation completes. - * - * @return count random bytes as a string. - */ - ctx.generate = function(count, callback) { - // do synchronously - if(!callback) { - return ctx.generateSync(count); - } - - // simple generator using counter-based CBC - var cipher = ctx.plugin.cipher; - var increment = ctx.plugin.increment; - var formatKey = ctx.plugin.formatKey; - var formatSeed = ctx.plugin.formatSeed; - var b = forge.util.createBuffer(); - - // paranoid deviation from Fortuna: - // reset key for every request to protect previously - // generated random bytes should the key be discovered; - // there is no 100ms based reseeding because of this - // forced reseed for every `generate` call - ctx.key = null; - - generate(); - - function generate(err) { - if(err) { - return callback(err); - } - - // sufficient bytes generated - if(b.length() >= count) { - return callback(null, b.getBytes(count)); - } - - // if amount of data generated is greater than 1 MiB, trigger reseed - if(ctx.generated > 0xfffff) { - ctx.key = null; - } - - if(ctx.key === null) { - // prevent stack overflow - return forge.util.nextTick(function() { - _reseed(generate); - }); - } - - // generate the random bytes - var bytes = cipher(ctx.key, ctx.seed); - ctx.generated += bytes.length; - b.putBytes(bytes); - - // generate bytes for a new key and seed - ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed))); - ctx.seed = formatSeed(cipher(ctx.key, ctx.seed)); - - forge.util.setImmediate(generate); - } - }; - - /** - * Generates random bytes synchronously. - * - * @param count the number of random bytes to generate. - * - * @return count random bytes as a string. - */ - ctx.generateSync = function(count) { - // simple generator using counter-based CBC - var cipher = ctx.plugin.cipher; - var increment = ctx.plugin.increment; - var formatKey = ctx.plugin.formatKey; - var formatSeed = ctx.plugin.formatSeed; - - // paranoid deviation from Fortuna: - // reset key for every request to protect previously - // generated random bytes should the key be discovered; - // there is no 100ms based reseeding because of this - // forced reseed for every `generateSync` call - ctx.key = null; - - var b = forge.util.createBuffer(); - while(b.length() < count) { - // if amount of data generated is greater than 1 MiB, trigger reseed - if(ctx.generated > 0xfffff) { - ctx.key = null; - } - - if(ctx.key === null) { - _reseedSync(); - } - - // generate the random bytes - var bytes = cipher(ctx.key, ctx.seed); - ctx.generated += bytes.length; - b.putBytes(bytes); - - // generate bytes for a new key and seed - ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed))); - ctx.seed = formatSeed(cipher(ctx.key, ctx.seed)); - } - - return b.getBytes(count); - }; - - /** - * Private function that asynchronously reseeds a generator. - * - * @param callback(err) called once the operation completes. - */ - function _reseed(callback) { - if(ctx.pools[0].messageLength >= 32) { - _seed(); - return callback(); - } - // not enough seed data... - var needed = (32 - ctx.pools[0].messageLength) << 5; - ctx.seedFile(needed, function(err, bytes) { - if(err) { - return callback(err); - } - ctx.collect(bytes); - _seed(); - callback(); - }); - } - - /** - * Private function that synchronously reseeds a generator. - */ - function _reseedSync() { - if(ctx.pools[0].messageLength >= 32) { - return _seed(); - } - // not enough seed data... - var needed = (32 - ctx.pools[0].messageLength) << 5; - ctx.collect(ctx.seedFileSync(needed)); - _seed(); - } - - /** - * Private function that seeds a generator once enough bytes are available. - */ - function _seed() { - // update reseed count - ctx.reseeds = (ctx.reseeds === 0xffffffff) ? 0 : ctx.reseeds + 1; - - // goal is to update `key` via: - // key = hash(key + s) - // where 's' is all collected entropy from selected pools, then... - - // create a plugin-based message digest - var md = ctx.plugin.md.create(); - - // consume current key bytes - md.update(ctx.keyBytes); - - // digest the entropy of pools whose index k meet the - // condition 'n mod 2^k == 0' where n is the number of reseeds - var _2powK = 1; - for(var k = 0; k < 32; ++k) { - if(ctx.reseeds % _2powK === 0) { - md.update(ctx.pools[k].digest().getBytes()); - ctx.pools[k].start(); - } - _2powK = _2powK << 1; - } - - // get digest for key bytes - ctx.keyBytes = md.digest().getBytes(); - - // paranoid deviation from Fortuna: - // update `seed` via `seed = hash(key)` - // instead of initializing to zero once and only - // ever incrementing it - md.start(); - md.update(ctx.keyBytes); - var seedBytes = md.digest().getBytes(); - - // update state - ctx.key = ctx.plugin.formatKey(ctx.keyBytes); - ctx.seed = ctx.plugin.formatSeed(seedBytes); - ctx.generated = 0; - } - - /** - * The built-in default seedFile. This seedFile is used when entropy - * is needed immediately. - * - * @param needed the number of bytes that are needed. - * - * @return the random bytes. - */ - function defaultSeedFile(needed) { - // use window.crypto.getRandomValues strong source of entropy if available - var getRandomValues = null; - var globalScope = forge.util.globalScope; - var _crypto = globalScope.crypto || globalScope.msCrypto; - if(_crypto && _crypto.getRandomValues) { - getRandomValues = function(arr) { - return _crypto.getRandomValues(arr); - }; - } - - var b = forge.util.createBuffer(); - if(getRandomValues) { - while(b.length() < needed) { - // max byte length is 65536 before QuotaExceededError is thrown - // http://www.w3.org/TR/WebCryptoAPI/#RandomSource-method-getRandomValues - var count = Math.max(1, Math.min(needed - b.length(), 65536) / 4); - var entropy = new Uint32Array(Math.floor(count)); - try { - getRandomValues(entropy); - for(var i = 0; i < entropy.length; ++i) { - b.putInt32(entropy[i]); - } - } catch(e) { - /* only ignore QuotaExceededError */ - if(!(typeof QuotaExceededError !== 'undefined' && - e instanceof QuotaExceededError)) { - throw e; - } - } - } - } - - // be sad and add some weak random data - if(b.length() < needed) { - /* Draws from Park-Miller "minimal standard" 31 bit PRNG, - implemented with David G. Carta's optimization: with 32 bit math - and without division (Public Domain). */ - var hi, lo, next; - var seed = Math.floor(Math.random() * 0x010000); - while(b.length() < needed) { - lo = 16807 * (seed & 0xFFFF); - hi = 16807 * (seed >> 16); - lo += (hi & 0x7FFF) << 16; - lo += hi >> 15; - lo = (lo & 0x7FFFFFFF) + (lo >> 31); - seed = lo & 0xFFFFFFFF; - - // consume lower 3 bytes of seed - for(var i = 0; i < 3; ++i) { - // throw in more pseudo random - next = seed >>> (i << 3); - next ^= Math.floor(Math.random() * 0x0100); - b.putByte(String.fromCharCode(next & 0xFF)); - } - } - } - - return b.getBytes(needed); - } - // initialize seed file APIs - if(_crypto) { - // use nodejs async API - ctx.seedFile = function(needed, callback) { - _crypto.randomBytes(needed, function(err, bytes) { - if(err) { - return callback(err); - } - callback(null, bytes.toString()); - }); - }; - // use nodejs sync API - ctx.seedFileSync = function(needed) { - return _crypto.randomBytes(needed).toString(); - }; - } else { - ctx.seedFile = function(needed, callback) { - try { - callback(null, defaultSeedFile(needed)); - } catch(e) { - callback(e); - } - }; - ctx.seedFileSync = defaultSeedFile; - } - - /** - * Adds entropy to a prng ctx's accumulator. - * - * @param bytes the bytes of entropy as a string. - */ - ctx.collect = function(bytes) { - // iterate over pools distributing entropy cyclically - var count = bytes.length; - for(var i = 0; i < count; ++i) { - ctx.pools[ctx.pool].update(bytes.substr(i, 1)); - ctx.pool = (ctx.pool === 31) ? 0 : ctx.pool + 1; - } - }; - - /** - * Collects an integer of n bits. - * - * @param i the integer entropy. - * @param n the number of bits in the integer. - */ - ctx.collectInt = function(i, n) { - var bytes = ''; - for(var x = 0; x < n; x += 8) { - bytes += String.fromCharCode((i >> x) & 0xFF); - } - ctx.collect(bytes); - }; - - /** - * Registers a Web Worker to receive immediate entropy from the main thread. - * This method is required until Web Workers can access the native crypto - * API. This method should be called twice for each created worker, once in - * the main thread, and once in the worker itself. - * - * @param worker the worker to register. - */ - ctx.registerWorker = function(worker) { - // worker receives random bytes - if(worker === self) { - ctx.seedFile = function(needed, callback) { - function listener(e) { - var data = e.data; - if(data.forge && data.forge.prng) { - self.removeEventListener('message', listener); - callback(data.forge.prng.err, data.forge.prng.bytes); - } - } - self.addEventListener('message', listener); - self.postMessage({forge: {prng: {needed: needed}}}); - }; - } else { - // main thread sends random bytes upon request - var listener = function(e) { - var data = e.data; - if(data.forge && data.forge.prng) { - ctx.seedFile(data.forge.prng.needed, function(err, bytes) { - worker.postMessage({forge: {prng: {err: err, bytes: bytes}}}); - }); - } - }; - // TODO: do we need to remove the event listener when the worker dies? - worker.addEventListener('message', listener); - } - }; - - return ctx; -}; diff --git a/node_modules/node-forge/lib/pss.js b/node_modules/node-forge/lib/pss.js deleted file mode 100644 index 2596693c..00000000 --- a/node_modules/node-forge/lib/pss.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * Javascript implementation of PKCS#1 PSS signature padding. - * - * @author Stefan Siegl - * - * Copyright (c) 2012 Stefan Siegl - */ -var forge = require('./forge'); -require('./random'); -require('./util'); - -// shortcut for PSS API -var pss = module.exports = forge.pss = forge.pss || {}; - -/** - * Creates a PSS signature scheme object. - * - * There are several ways to provide a salt for encoding: - * - * 1. Specify the saltLength only and the built-in PRNG will generate it. - * 2. Specify the saltLength and a custom PRNG with 'getBytesSync' defined that - * will be used. - * 3. Specify the salt itself as a forge.util.ByteBuffer. - * - * @param options the options to use: - * md the message digest object to use, a forge md instance. - * mgf the mask generation function to use, a forge mgf instance. - * [saltLength] the length of the salt in octets. - * [prng] the pseudo-random number generator to use to produce a salt. - * [salt] the salt to use when encoding. - * - * @return a signature scheme object. - */ -pss.create = function(options) { - // backwards compatibility w/legacy args: hash, mgf, sLen - if(arguments.length === 3) { - options = { - md: arguments[0], - mgf: arguments[1], - saltLength: arguments[2] - }; - } - - var hash = options.md; - var mgf = options.mgf; - var hLen = hash.digestLength; - - var salt_ = options.salt || null; - if(typeof salt_ === 'string') { - // assume binary-encoded string - salt_ = forge.util.createBuffer(salt_); - } - - var sLen; - if('saltLength' in options) { - sLen = options.saltLength; - } else if(salt_ !== null) { - sLen = salt_.length(); - } else { - throw new Error('Salt length not specified or specific salt not given.'); - } - - if(salt_ !== null && salt_.length() !== sLen) { - throw new Error('Given salt length does not match length of given salt.'); - } - - var prng = options.prng || forge.random; - - var pssobj = {}; - - /** - * Encodes a PSS signature. - * - * This function implements EMSA-PSS-ENCODE as per RFC 3447, section 9.1.1. - * - * @param md the message digest object with the hash to sign. - * @param modsBits the length of the RSA modulus in bits. - * - * @return the encoded message as a binary-encoded string of length - * ceil((modBits - 1) / 8). - */ - pssobj.encode = function(md, modBits) { - var i; - var emBits = modBits - 1; - var emLen = Math.ceil(emBits / 8); - - /* 2. Let mHash = Hash(M), an octet string of length hLen. */ - var mHash = md.digest().getBytes(); - - /* 3. If emLen < hLen + sLen + 2, output "encoding error" and stop. */ - if(emLen < hLen + sLen + 2) { - throw new Error('Message is too long to encrypt.'); - } - - /* 4. Generate a random octet string salt of length sLen; if sLen = 0, - * then salt is the empty string. */ - var salt; - if(salt_ === null) { - salt = prng.getBytesSync(sLen); - } else { - salt = salt_.bytes(); - } - - /* 5. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt; */ - var m_ = new forge.util.ByteBuffer(); - m_.fillWithByte(0, 8); - m_.putBytes(mHash); - m_.putBytes(salt); - - /* 6. Let H = Hash(M'), an octet string of length hLen. */ - hash.start(); - hash.update(m_.getBytes()); - var h = hash.digest().getBytes(); - - /* 7. Generate an octet string PS consisting of emLen - sLen - hLen - 2 - * zero octets. The length of PS may be 0. */ - var ps = new forge.util.ByteBuffer(); - ps.fillWithByte(0, emLen - sLen - hLen - 2); - - /* 8. Let DB = PS || 0x01 || salt; DB is an octet string of length - * emLen - hLen - 1. */ - ps.putByte(0x01); - ps.putBytes(salt); - var db = ps.getBytes(); - - /* 9. Let dbMask = MGF(H, emLen - hLen - 1). */ - var maskLen = emLen - hLen - 1; - var dbMask = mgf.generate(h, maskLen); - - /* 10. Let maskedDB = DB \xor dbMask. */ - var maskedDB = ''; - for(i = 0; i < maskLen; i++) { - maskedDB += String.fromCharCode(db.charCodeAt(i) ^ dbMask.charCodeAt(i)); - } - - /* 11. Set the leftmost 8emLen - emBits bits of the leftmost octet in - * maskedDB to zero. */ - var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF; - maskedDB = String.fromCharCode(maskedDB.charCodeAt(0) & ~mask) + - maskedDB.substr(1); - - /* 12. Let EM = maskedDB || H || 0xbc. - * 13. Output EM. */ - return maskedDB + h + String.fromCharCode(0xbc); - }; - - /** - * Verifies a PSS signature. - * - * This function implements EMSA-PSS-VERIFY as per RFC 3447, section 9.1.2. - * - * @param mHash the message digest hash, as a binary-encoded string, to - * compare against the signature. - * @param em the encoded message, as a binary-encoded string - * (RSA decryption result). - * @param modsBits the length of the RSA modulus in bits. - * - * @return true if the signature was verified, false if not. - */ - pssobj.verify = function(mHash, em, modBits) { - var i; - var emBits = modBits - 1; - var emLen = Math.ceil(emBits / 8); - - /* c. Convert the message representative m to an encoded message EM - * of length emLen = ceil((modBits - 1) / 8) octets, where modBits - * is the length in bits of the RSA modulus n */ - em = em.substr(-emLen); - - /* 3. If emLen < hLen + sLen + 2, output "inconsistent" and stop. */ - if(emLen < hLen + sLen + 2) { - throw new Error('Inconsistent parameters to PSS signature verification.'); - } - - /* 4. If the rightmost octet of EM does not have hexadecimal value - * 0xbc, output "inconsistent" and stop. */ - if(em.charCodeAt(emLen - 1) !== 0xbc) { - throw new Error('Encoded message does not end in 0xBC.'); - } - - /* 5. Let maskedDB be the leftmost emLen - hLen - 1 octets of EM, and - * let H be the next hLen octets. */ - var maskLen = emLen - hLen - 1; - var maskedDB = em.substr(0, maskLen); - var h = em.substr(maskLen, hLen); - - /* 6. If the leftmost 8emLen - emBits bits of the leftmost octet in - * maskedDB are not all equal to zero, output "inconsistent" and stop. */ - var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF; - if((maskedDB.charCodeAt(0) & mask) !== 0) { - throw new Error('Bits beyond keysize not zero as expected.'); - } - - /* 7. Let dbMask = MGF(H, emLen - hLen - 1). */ - var dbMask = mgf.generate(h, maskLen); - - /* 8. Let DB = maskedDB \xor dbMask. */ - var db = ''; - for(i = 0; i < maskLen; i++) { - db += String.fromCharCode(maskedDB.charCodeAt(i) ^ dbMask.charCodeAt(i)); - } - - /* 9. Set the leftmost 8emLen - emBits bits of the leftmost octet - * in DB to zero. */ - db = String.fromCharCode(db.charCodeAt(0) & ~mask) + db.substr(1); - - /* 10. If the emLen - hLen - sLen - 2 leftmost octets of DB are not zero - * or if the octet at position emLen - hLen - sLen - 1 (the leftmost - * position is "position 1") does not have hexadecimal value 0x01, - * output "inconsistent" and stop. */ - var checkLen = emLen - hLen - sLen - 2; - for(i = 0; i < checkLen; i++) { - if(db.charCodeAt(i) !== 0x00) { - throw new Error('Leftmost octets not zero as expected'); - } - } - - if(db.charCodeAt(checkLen) !== 0x01) { - throw new Error('Inconsistent PSS signature, 0x01 marker not found'); - } - - /* 11. Let salt be the last sLen octets of DB. */ - var salt = db.substr(-sLen); - - /* 12. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt */ - var m_ = new forge.util.ByteBuffer(); - m_.fillWithByte(0, 8); - m_.putBytes(mHash); - m_.putBytes(salt); - - /* 13. Let H' = Hash(M'), an octet string of length hLen. */ - hash.start(); - hash.update(m_.getBytes()); - var h_ = hash.digest().getBytes(); - - /* 14. If H = H', output "consistent." Otherwise, output "inconsistent." */ - return h === h_; - }; - - return pssobj; -}; diff --git a/node_modules/node-forge/lib/random.js b/node_modules/node-forge/lib/random.js deleted file mode 100644 index d4e4bea9..00000000 --- a/node_modules/node-forge/lib/random.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * An API for getting cryptographically-secure random bytes. The bytes are - * generated using the Fortuna algorithm devised by Bruce Schneier and - * Niels Ferguson. - * - * Getting strong random bytes is not yet easy to do in javascript. The only - * truish random entropy that can be collected is from the mouse, keyboard, or - * from timing with respect to page loads, etc. This generator makes a poor - * attempt at providing random bytes when those sources haven't yet provided - * enough entropy to initially seed or to reseed the PRNG. - * - * @author Dave Longley - * - * Copyright (c) 2009-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./aes'); -require('./sha256'); -require('./prng'); -require('./util'); - -(function() { - -// forge.random already defined -if(forge.random && forge.random.getBytes) { - module.exports = forge.random; - return; -} - -(function(jQuery) { - -// the default prng plugin, uses AES-128 -var prng_aes = {}; -var _prng_aes_output = new Array(4); -var _prng_aes_buffer = forge.util.createBuffer(); -prng_aes.formatKey = function(key) { - // convert the key into 32-bit integers - var tmp = forge.util.createBuffer(key); - key = new Array(4); - key[0] = tmp.getInt32(); - key[1] = tmp.getInt32(); - key[2] = tmp.getInt32(); - key[3] = tmp.getInt32(); - - // return the expanded key - return forge.aes._expandKey(key, false); -}; -prng_aes.formatSeed = function(seed) { - // convert seed into 32-bit integers - var tmp = forge.util.createBuffer(seed); - seed = new Array(4); - seed[0] = tmp.getInt32(); - seed[1] = tmp.getInt32(); - seed[2] = tmp.getInt32(); - seed[3] = tmp.getInt32(); - return seed; -}; -prng_aes.cipher = function(key, seed) { - forge.aes._updateBlock(key, seed, _prng_aes_output, false); - _prng_aes_buffer.putInt32(_prng_aes_output[0]); - _prng_aes_buffer.putInt32(_prng_aes_output[1]); - _prng_aes_buffer.putInt32(_prng_aes_output[2]); - _prng_aes_buffer.putInt32(_prng_aes_output[3]); - return _prng_aes_buffer.getBytes(); -}; -prng_aes.increment = function(seed) { - // FIXME: do we care about carry or signed issues? - ++seed[3]; - return seed; -}; -prng_aes.md = forge.md.sha256; - -/** - * Creates a new PRNG. - */ -function spawnPrng() { - var ctx = forge.prng.create(prng_aes); - - /** - * Gets random bytes. If a native secure crypto API is unavailable, this - * method tries to make the bytes more unpredictable by drawing from data that - * can be collected from the user of the browser, eg: mouse movement. - * - * If a callback is given, this method will be called asynchronously. - * - * @param count the number of random bytes to get. - * @param [callback(err, bytes)] called once the operation completes. - * - * @return the random bytes in a string. - */ - ctx.getBytes = function(count, callback) { - return ctx.generate(count, callback); - }; - - /** - * Gets random bytes asynchronously. If a native secure crypto API is - * unavailable, this method tries to make the bytes more unpredictable by - * drawing from data that can be collected from the user of the browser, - * eg: mouse movement. - * - * @param count the number of random bytes to get. - * - * @return the random bytes in a string. - */ - ctx.getBytesSync = function(count) { - return ctx.generate(count); - }; - - return ctx; -} - -// create default prng context -var _ctx = spawnPrng(); - -// add other sources of entropy only if window.crypto.getRandomValues is not -// available -- otherwise this source will be automatically used by the prng -var getRandomValues = null; -var globalScope = forge.util.globalScope; -var _crypto = globalScope.crypto || globalScope.msCrypto; -if(_crypto && _crypto.getRandomValues) { - getRandomValues = function(arr) { - return _crypto.getRandomValues(arr); - }; -} - -if(forge.options.usePureJavaScript || - (!forge.util.isNodejs && !getRandomValues)) { - // if this is a web worker, do not use weak entropy, instead register to - // receive strong entropy asynchronously from the main thread - if(typeof window === 'undefined' || window.document === undefined) { - // FIXME: - } - - // get load time entropy - _ctx.collectInt(+new Date(), 32); - - // add some entropy from navigator object - if(typeof(navigator) !== 'undefined') { - var _navBytes = ''; - for(var key in navigator) { - try { - if(typeof(navigator[key]) == 'string') { - _navBytes += navigator[key]; - } - } catch(e) { - /* Some navigator keys might not be accessible, e.g. the geolocation - attribute throws an exception if touched in Mozilla chrome:// - context. - - Silently ignore this and just don't use this as a source of - entropy. */ - } - } - _ctx.collect(_navBytes); - _navBytes = null; - } - - // add mouse and keyboard collectors if jquery is available - if(jQuery) { - // set up mouse entropy capture - jQuery().mousemove(function(e) { - // add mouse coords - _ctx.collectInt(e.clientX, 16); - _ctx.collectInt(e.clientY, 16); - }); - - // set up keyboard entropy capture - jQuery().keypress(function(e) { - _ctx.collectInt(e.charCode, 8); - }); - } -} - -/* Random API */ -if(!forge.random) { - forge.random = _ctx; -} else { - // extend forge.random with _ctx - for(var key in _ctx) { - forge.random[key] = _ctx[key]; - } -} - -// expose spawn PRNG -forge.random.createInstance = spawnPrng; - -module.exports = forge.random; - -})(typeof(jQuery) !== 'undefined' ? jQuery : null); - -})(); diff --git a/node_modules/node-forge/lib/rc2.js b/node_modules/node-forge/lib/rc2.js deleted file mode 100644 index e33f78a7..00000000 --- a/node_modules/node-forge/lib/rc2.js +++ /dev/null @@ -1,410 +0,0 @@ -/** - * RC2 implementation. - * - * @author Stefan Siegl - * - * Copyright (c) 2012 Stefan Siegl - * - * Information on the RC2 cipher is available from RFC #2268, - * http://www.ietf.org/rfc/rfc2268.txt - */ -var forge = require('./forge'); -require('./util'); - -var piTable = [ - 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d, - 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2, - 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32, - 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82, - 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc, - 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26, - 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03, - 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7, - 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a, - 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec, - 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39, - 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31, - 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9, - 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9, - 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e, - 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad -]; - -var s = [1, 2, 3, 5]; - -/** - * Rotate a word left by given number of bits. - * - * Bits that are shifted out on the left are put back in on the right - * hand side. - * - * @param word The word to shift left. - * @param bits The number of bits to shift by. - * @return The rotated word. - */ -var rol = function(word, bits) { - return ((word << bits) & 0xffff) | ((word & 0xffff) >> (16 - bits)); -}; - -/** - * Rotate a word right by given number of bits. - * - * Bits that are shifted out on the right are put back in on the left - * hand side. - * - * @param word The word to shift right. - * @param bits The number of bits to shift by. - * @return The rotated word. - */ -var ror = function(word, bits) { - return ((word & 0xffff) >> bits) | ((word << (16 - bits)) & 0xffff); -}; - -/* RC2 API */ -module.exports = forge.rc2 = forge.rc2 || {}; - -/** - * Perform RC2 key expansion as per RFC #2268, section 2. - * - * @param key variable-length user key (between 1 and 128 bytes) - * @param effKeyBits number of effective key bits (default: 128) - * @return the expanded RC2 key (ByteBuffer of 128 bytes) - */ -forge.rc2.expandKey = function(key, effKeyBits) { - if(typeof key === 'string') { - key = forge.util.createBuffer(key); - } - effKeyBits = effKeyBits || 128; - - /* introduce variables that match the names used in RFC #2268 */ - var L = key; - var T = key.length(); - var T1 = effKeyBits; - var T8 = Math.ceil(T1 / 8); - var TM = 0xff >> (T1 & 0x07); - var i; - - for(i = T; i < 128; i++) { - L.putByte(piTable[(L.at(i - 1) + L.at(i - T)) & 0xff]); - } - - L.setAt(128 - T8, piTable[L.at(128 - T8) & TM]); - - for(i = 127 - T8; i >= 0; i--) { - L.setAt(i, piTable[L.at(i + 1) ^ L.at(i + T8)]); - } - - return L; -}; - -/** - * Creates a RC2 cipher object. - * - * @param key the symmetric key to use (as base for key generation). - * @param bits the number of effective key bits. - * @param encrypt false for decryption, true for encryption. - * - * @return the cipher. - */ -var createCipher = function(key, bits, encrypt) { - var _finish = false, _input = null, _output = null, _iv = null; - var mixRound, mashRound; - var i, j, K = []; - - /* Expand key and fill into K[] Array */ - key = forge.rc2.expandKey(key, bits); - for(i = 0; i < 64; i++) { - K.push(key.getInt16Le()); - } - - if(encrypt) { - /** - * Perform one mixing round "in place". - * - * @param R Array of four words to perform mixing on. - */ - mixRound = function(R) { - for(i = 0; i < 4; i++) { - R[i] += K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + - ((~R[(i + 3) % 4]) & R[(i + 1) % 4]); - R[i] = rol(R[i], s[i]); - j++; - } - }; - - /** - * Perform one mashing round "in place". - * - * @param R Array of four words to perform mashing on. - */ - mashRound = function(R) { - for(i = 0; i < 4; i++) { - R[i] += K[R[(i + 3) % 4] & 63]; - } - }; - } else { - /** - * Perform one r-mixing round "in place". - * - * @param R Array of four words to perform mixing on. - */ - mixRound = function(R) { - for(i = 3; i >= 0; i--) { - R[i] = ror(R[i], s[i]); - R[i] -= K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + - ((~R[(i + 3) % 4]) & R[(i + 1) % 4]); - j--; - } - }; - - /** - * Perform one r-mashing round "in place". - * - * @param R Array of four words to perform mashing on. - */ - mashRound = function(R) { - for(i = 3; i >= 0; i--) { - R[i] -= K[R[(i + 3) % 4] & 63]; - } - }; - } - - /** - * Run the specified cipher execution plan. - * - * This function takes four words from the input buffer, applies the IV on - * it (if requested) and runs the provided execution plan. - * - * The plan must be put together in form of a array of arrays. Where the - * outer one is simply a list of steps to perform and the inner one needs - * to have two elements: the first one telling how many rounds to perform, - * the second one telling what to do (i.e. the function to call). - * - * @param {Array} plan The plan to execute. - */ - var runPlan = function(plan) { - var R = []; - - /* Get data from input buffer and fill the four words into R */ - for(i = 0; i < 4; i++) { - var val = _input.getInt16Le(); - - if(_iv !== null) { - if(encrypt) { - /* We're encrypting, apply the IV first. */ - val ^= _iv.getInt16Le(); - } else { - /* We're decryption, keep cipher text for next block. */ - _iv.putInt16Le(val); - } - } - - R.push(val & 0xffff); - } - - /* Reset global "j" variable as per spec. */ - j = encrypt ? 0 : 63; - - /* Run execution plan. */ - for(var ptr = 0; ptr < plan.length; ptr++) { - for(var ctr = 0; ctr < plan[ptr][0]; ctr++) { - plan[ptr][1](R); - } - } - - /* Write back result to output buffer. */ - for(i = 0; i < 4; i++) { - if(_iv !== null) { - if(encrypt) { - /* We're encrypting in CBC-mode, feed back encrypted bytes into - IV buffer to carry it forward to next block. */ - _iv.putInt16Le(R[i]); - } else { - R[i] ^= _iv.getInt16Le(); - } - } - - _output.putInt16Le(R[i]); - } - }; - - /* Create cipher object */ - var cipher = null; - cipher = { - /** - * Starts or restarts the encryption or decryption process, whichever - * was previously configured. - * - * To use the cipher in CBC mode, iv may be given either as a string - * of bytes, or as a byte buffer. For ECB mode, give null as iv. - * - * @param iv the initialization vector to use, null for ECB mode. - * @param output the output the buffer to write to, null to create one. - */ - start: function(iv, output) { - if(iv) { - /* CBC mode */ - if(typeof iv === 'string') { - iv = forge.util.createBuffer(iv); - } - } - - _finish = false; - _input = forge.util.createBuffer(); - _output = output || new forge.util.createBuffer(); - _iv = iv; - - cipher.output = _output; - }, - - /** - * Updates the next block. - * - * @param input the buffer to read from. - */ - update: function(input) { - if(!_finish) { - // not finishing, so fill the input buffer with more input - _input.putBuffer(input); - } - - while(_input.length() >= 8) { - runPlan([ - [ 5, mixRound ], - [ 1, mashRound ], - [ 6, mixRound ], - [ 1, mashRound ], - [ 5, mixRound ] - ]); - } - }, - - /** - * Finishes encrypting or decrypting. - * - * @param pad a padding function to use, null for PKCS#7 padding, - * signature(blockSize, buffer, decrypt). - * - * @return true if successful, false on error. - */ - finish: function(pad) { - var rval = true; - - if(encrypt) { - if(pad) { - rval = pad(8, _input, !encrypt); - } else { - // add PKCS#7 padding to block (each pad byte is the - // value of the number of pad bytes) - var padding = (_input.length() === 8) ? 8 : (8 - _input.length()); - _input.fillWithByte(padding, padding); - } - } - - if(rval) { - // do final update - _finish = true; - cipher.update(); - } - - if(!encrypt) { - // check for error: input data not a multiple of block size - rval = (_input.length() === 0); - if(rval) { - if(pad) { - rval = pad(8, _output, !encrypt); - } else { - // ensure padding byte count is valid - var len = _output.length(); - var count = _output.at(len - 1); - - if(count > len) { - rval = false; - } else { - // trim off padding bytes - _output.truncate(count); - } - } - } - } - - return rval; - } - }; - - return cipher; -}; - -/** - * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the - * given symmetric key. The output will be stored in the 'output' member - * of the returned cipher. - * - * The key and iv may be given as a string of bytes or a byte buffer. - * The cipher is initialized to use 128 effective key bits. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * - * @return the cipher. - */ -forge.rc2.startEncrypting = function(key, iv, output) { - var cipher = forge.rc2.createEncryptionCipher(key, 128); - cipher.start(iv, output); - return cipher; -}; - -/** - * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the - * given symmetric key. - * - * The key may be given as a string of bytes or a byte buffer. - * - * To start encrypting call start() on the cipher with an iv and optional - * output buffer. - * - * @param key the symmetric key to use. - * - * @return the cipher. - */ -forge.rc2.createEncryptionCipher = function(key, bits) { - return createCipher(key, bits, true); -}; - -/** - * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the - * given symmetric key. The output will be stored in the 'output' member - * of the returned cipher. - * - * The key and iv may be given as a string of bytes or a byte buffer. - * The cipher is initialized to use 128 effective key bits. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * - * @return the cipher. - */ -forge.rc2.startDecrypting = function(key, iv, output) { - var cipher = forge.rc2.createDecryptionCipher(key, 128); - cipher.start(iv, output); - return cipher; -}; - -/** - * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the - * given symmetric key. - * - * The key may be given as a string of bytes or a byte buffer. - * - * To start decrypting call start() on the cipher with an iv and optional - * output buffer. - * - * @param key the symmetric key to use. - * - * @return the cipher. - */ -forge.rc2.createDecryptionCipher = function(key, bits) { - return createCipher(key, bits, false); -}; diff --git a/node_modules/node-forge/lib/rsa.js b/node_modules/node-forge/lib/rsa.js deleted file mode 100644 index 7c67917c..00000000 --- a/node_modules/node-forge/lib/rsa.js +++ /dev/null @@ -1,1858 +0,0 @@ -/** - * Javascript implementation of basic RSA algorithms. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - * - * The only algorithm currently supported for PKI is RSA. - * - * An RSA key is often stored in ASN.1 DER format. The SubjectPublicKeyInfo - * ASN.1 structure is composed of an algorithm of type AlgorithmIdentifier - * and a subjectPublicKey of type bit string. - * - * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters - * for the algorithm, if any. In the case of RSA, there aren't any. - * - * SubjectPublicKeyInfo ::= SEQUENCE { - * algorithm AlgorithmIdentifier, - * subjectPublicKey BIT STRING - * } - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * For an RSA public key, the subjectPublicKey is: - * - * RSAPublicKey ::= SEQUENCE { - * modulus INTEGER, -- n - * publicExponent INTEGER -- e - * } - * - * PrivateKeyInfo ::= SEQUENCE { - * version Version, - * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, - * privateKey PrivateKey, - * attributes [0] IMPLICIT Attributes OPTIONAL - * } - * - * Version ::= INTEGER - * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier - * PrivateKey ::= OCTET STRING - * Attributes ::= SET OF Attribute - * - * An RSA private key as the following structure: - * - * RSAPrivateKey ::= SEQUENCE { - * version Version, - * modulus INTEGER, -- n - * publicExponent INTEGER, -- e - * privateExponent INTEGER, -- d - * prime1 INTEGER, -- p - * prime2 INTEGER, -- q - * exponent1 INTEGER, -- d mod (p-1) - * exponent2 INTEGER, -- d mod (q-1) - * coefficient INTEGER -- (inverse of q) mod p - * } - * - * Version ::= INTEGER - * - * The OID for the RSA key algorithm is: 1.2.840.113549.1.1.1 - */ -var forge = require('./forge'); -require('./asn1'); -require('./jsbn'); -require('./oids'); -require('./pkcs1'); -require('./prime'); -require('./random'); -require('./util'); - -if(typeof BigInteger === 'undefined') { - var BigInteger = forge.jsbn.BigInteger; -} - -var _crypto = forge.util.isNodejs ? require('crypto') : null; - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -// shortcut for util API -var util = forge.util; - -/* - * RSA encryption and decryption, see RFC 2313. - */ -forge.pki = forge.pki || {}; -module.exports = forge.pki.rsa = forge.rsa = forge.rsa || {}; -var pki = forge.pki; - -// for finding primes, which are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 -var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; - -// validator for a PrivateKeyInfo structure -var privateKeyValidator = { - // PrivateKeyInfo - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // Version (INTEGER) - name: 'PrivateKeyInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyVersion' - }, { - // privateKeyAlgorithm - name: 'PrivateKeyInfo.privateKeyAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'privateKeyOid' - }] - }, { - // PrivateKey - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'privateKey' - }] -}; - -// validator for an RSA private key -var rsaPrivateKeyValidator = { - // RSAPrivateKey - name: 'RSAPrivateKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // Version (INTEGER) - name: 'RSAPrivateKey.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyVersion' - }, { - // modulus (n) - name: 'RSAPrivateKey.modulus', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyModulus' - }, { - // publicExponent (e) - name: 'RSAPrivateKey.publicExponent', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPublicExponent' - }, { - // privateExponent (d) - name: 'RSAPrivateKey.privateExponent', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPrivateExponent' - }, { - // prime1 (p) - name: 'RSAPrivateKey.prime1', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPrime1' - }, { - // prime2 (q) - name: 'RSAPrivateKey.prime2', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPrime2' - }, { - // exponent1 (d mod (p-1)) - name: 'RSAPrivateKey.exponent1', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyExponent1' - }, { - // exponent2 (d mod (q-1)) - name: 'RSAPrivateKey.exponent2', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyExponent2' - }, { - // coefficient ((inverse of q) mod p) - name: 'RSAPrivateKey.coefficient', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyCoefficient' - }] -}; - -// validator for an RSA public key -var rsaPublicKeyValidator = { - // RSAPublicKey - name: 'RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // modulus (n) - name: 'RSAPublicKey.modulus', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'publicKeyModulus' - }, { - // publicExponent (e) - name: 'RSAPublicKey.exponent', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'publicKeyExponent' - }] -}; - -// validator for an SubjectPublicKeyInfo structure -// Note: Currently only works with an RSA public key -var publicKeyValidator = forge.pki.rsa.publicKeyValidator = { - name: 'SubjectPublicKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'subjectPublicKeyInfo', - value: [{ - name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'publicKeyOid' - }] - }, { - // subjectPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - value: [{ - // RSAPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'rsaPublicKey' - }] - }] -}; - -/** - * Wrap digest in DigestInfo object. - * - * This function implements EMSA-PKCS1-v1_5-ENCODE as per RFC 3447. - * - * DigestInfo ::= SEQUENCE { - * digestAlgorithm DigestAlgorithmIdentifier, - * digest Digest - * } - * - * DigestAlgorithmIdentifier ::= AlgorithmIdentifier - * Digest ::= OCTET STRING - * - * @param md the message digest object with the hash to sign. - * - * @return the encoded message (ready for RSA encrytion) - */ -var emsaPkcs1v15encode = function(md) { - // get the oid for the algorithm - var oid; - if(md.algorithm in pki.oids) { - oid = pki.oids[md.algorithm]; - } else { - var error = new Error('Unknown message digest algorithm.'); - error.algorithm = md.algorithm; - throw error; - } - var oidBytes = asn1.oidToDer(oid).getBytes(); - - // create the digest info - var digestInfo = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var digestAlgorithm = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - digestAlgorithm.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OID, false, oidBytes)); - digestAlgorithm.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')); - var digest = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, - false, md.digest().getBytes()); - digestInfo.value.push(digestAlgorithm); - digestInfo.value.push(digest); - - // encode digest info - return asn1.toDer(digestInfo).getBytes(); -}; - -/** - * Performs x^c mod n (RSA encryption or decryption operation). - * - * @param x the number to raise and mod. - * @param key the key to use. - * @param pub true if the key is public, false if private. - * - * @return the result of x^c mod n. - */ -var _modPow = function(x, key, pub) { - if(pub) { - return x.modPow(key.e, key.n); - } - - if(!key.p || !key.q) { - // allow calculation without CRT params (slow) - return x.modPow(key.d, key.n); - } - - // pre-compute dP, dQ, and qInv if necessary - if(!key.dP) { - key.dP = key.d.mod(key.p.subtract(BigInteger.ONE)); - } - if(!key.dQ) { - key.dQ = key.d.mod(key.q.subtract(BigInteger.ONE)); - } - if(!key.qInv) { - key.qInv = key.q.modInverse(key.p); - } - - /* Chinese remainder theorem (CRT) states: - - Suppose n1, n2, ..., nk are positive integers which are pairwise - coprime (n1 and n2 have no common factors other than 1). For any - integers x1, x2, ..., xk there exists an integer x solving the - system of simultaneous congruences (where ~= means modularly - congruent so a ~= b mod n means a mod n = b mod n): - - x ~= x1 mod n1 - x ~= x2 mod n2 - ... - x ~= xk mod nk - - This system of congruences has a single simultaneous solution x - between 0 and n - 1. Furthermore, each xk solution and x itself - is congruent modulo the product n = n1*n2*...*nk. - So x1 mod n = x2 mod n = xk mod n = x mod n. - - The single simultaneous solution x can be solved with the following - equation: - - x = sum(xi*ri*si) mod n where ri = n/ni and si = ri^-1 mod ni. - - Where x is less than n, xi = x mod ni. - - For RSA we are only concerned with k = 2. The modulus n = pq, where - p and q are coprime. The RSA decryption algorithm is: - - y = x^d mod n - - Given the above: - - x1 = x^d mod p - r1 = n/p = q - s1 = q^-1 mod p - x2 = x^d mod q - r2 = n/q = p - s2 = p^-1 mod q - - So y = (x1r1s1 + x2r2s2) mod n - = ((x^d mod p)q(q^-1 mod p) + (x^d mod q)p(p^-1 mod q)) mod n - - According to Fermat's Little Theorem, if the modulus P is prime, - for any integer A not evenly divisible by P, A^(P-1) ~= 1 mod P. - Since A is not divisible by P it follows that if: - N ~= M mod (P - 1), then A^N mod P = A^M mod P. Therefore: - - A^N mod P = A^(M mod (P - 1)) mod P. (The latter takes less effort - to calculate). In order to calculate x^d mod p more quickly the - exponent d mod (p - 1) is stored in the RSA private key (the same - is done for x^d mod q). These values are referred to as dP and dQ - respectively. Therefore we now have: - - y = ((x^dP mod p)q(q^-1 mod p) + (x^dQ mod q)p(p^-1 mod q)) mod n - - Since we'll be reducing x^dP by modulo p (same for q) we can also - reduce x by p (and q respectively) before hand. Therefore, let - - xp = ((x mod p)^dP mod p), and - xq = ((x mod q)^dQ mod q), yielding: - - y = (xp*q*(q^-1 mod p) + xq*p*(p^-1 mod q)) mod n - - This can be further reduced to a simple algorithm that only - requires 1 inverse (the q inverse is used) to be used and stored. - The algorithm is called Garner's algorithm. If qInv is the - inverse of q, we simply calculate: - - y = (qInv*(xp - xq) mod p) * q + xq - - However, there are two further complications. First, we need to - ensure that xp > xq to prevent signed BigIntegers from being used - so we add p until this is true (since we will be mod'ing with - p anyway). Then, there is a known timing attack on algorithms - using the CRT. To mitigate this risk, "cryptographic blinding" - should be used. This requires simply generating a random number r - between 0 and n-1 and its inverse and multiplying x by r^e before - calculating y and then multiplying y by r^-1 afterwards. Note that - r must be coprime with n (gcd(r, n) === 1) in order to have an - inverse. - */ - - // cryptographic blinding - var r; - do { - r = new BigInteger( - forge.util.bytesToHex(forge.random.getBytes(key.n.bitLength() / 8)), - 16); - } while(r.compareTo(key.n) >= 0 || !r.gcd(key.n).equals(BigInteger.ONE)); - x = x.multiply(r.modPow(key.e, key.n)).mod(key.n); - - // calculate xp and xq - var xp = x.mod(key.p).modPow(key.dP, key.p); - var xq = x.mod(key.q).modPow(key.dQ, key.q); - - // xp must be larger than xq to avoid signed bit usage - while(xp.compareTo(xq) < 0) { - xp = xp.add(key.p); - } - - // do last step - var y = xp.subtract(xq) - .multiply(key.qInv).mod(key.p) - .multiply(key.q).add(xq); - - // remove effect of random for cryptographic blinding - y = y.multiply(r.modInverse(key.n)).mod(key.n); - - return y; -}; - -/** - * NOTE: THIS METHOD IS DEPRECATED, use 'sign' on a private key object or - * 'encrypt' on a public key object instead. - * - * Performs RSA encryption. - * - * The parameter bt controls whether to put padding bytes before the - * message passed in. Set bt to either true or false to disable padding - * completely (in order to handle e.g. EMSA-PSS encoding seperately before), - * signaling whether the encryption operation is a public key operation - * (i.e. encrypting data) or not, i.e. private key operation (data signing). - * - * For PKCS#1 v1.5 padding pass in the block type to use, i.e. either 0x01 - * (for signing) or 0x02 (for encryption). The key operation mode (private - * or public) is derived from this flag in that case). - * - * @param m the message to encrypt as a byte string. - * @param key the RSA key to use. - * @param bt for PKCS#1 v1.5 padding, the block type to use - * (0x01 for private key, 0x02 for public), - * to disable padding: true = public key, false = private key. - * - * @return the encrypted bytes as a string. - */ -pki.rsa.encrypt = function(m, key, bt) { - var pub = bt; - var eb; - - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - if(bt !== false && bt !== true) { - // legacy, default to PKCS#1 v1.5 padding - pub = (bt === 0x02); - eb = _encodePkcs1_v1_5(m, key, bt); - } else { - eb = forge.util.createBuffer(); - eb.putBytes(m); - } - - // load encryption block as big integer 'x' - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var x = new BigInteger(eb.toHex(), 16); - - // do RSA encryption - var y = _modPow(x, key, pub); - - // convert y into the encrypted data byte string, if y is shorter in - // bytes than k, then prepend zero bytes to fill up ed - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var yhex = y.toString(16); - var ed = forge.util.createBuffer(); - var zeros = k - Math.ceil(yhex.length / 2); - while(zeros > 0) { - ed.putByte(0x00); - --zeros; - } - ed.putBytes(forge.util.hexToBytes(yhex)); - return ed.getBytes(); -}; - -/** - * NOTE: THIS METHOD IS DEPRECATED, use 'decrypt' on a private key object or - * 'verify' on a public key object instead. - * - * Performs RSA decryption. - * - * The parameter ml controls whether to apply PKCS#1 v1.5 padding - * or not. Set ml = false to disable padding removal completely - * (in order to handle e.g. EMSA-PSS later on) and simply pass back - * the RSA encryption block. - * - * @param ed the encrypted data to decrypt in as a byte string. - * @param key the RSA key to use. - * @param pub true for a public key operation, false for private. - * @param ml the message length, if known, false to disable padding. - * - * @return the decrypted message as a byte string. - */ -pki.rsa.decrypt = function(ed, key, pub, ml) { - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - // error if the length of the encrypted data ED is not k - if(ed.length !== k) { - var error = new Error('Encrypted message length is invalid.'); - error.length = ed.length; - error.expected = k; - throw error; - } - - // convert encrypted data into a big integer - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var y = new BigInteger(forge.util.createBuffer(ed).toHex(), 16); - - // y must be less than the modulus or it wasn't the result of - // a previous mod operation (encryption) using that modulus - if(y.compareTo(key.n) >= 0) { - throw new Error('Encrypted message is invalid.'); - } - - // do RSA decryption - var x = _modPow(y, key, pub); - - // create the encryption block, if x is shorter in bytes than k, then - // prepend zero bytes to fill up eb - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var xhex = x.toString(16); - var eb = forge.util.createBuffer(); - var zeros = k - Math.ceil(xhex.length / 2); - while(zeros > 0) { - eb.putByte(0x00); - --zeros; - } - eb.putBytes(forge.util.hexToBytes(xhex)); - - if(ml !== false) { - // legacy, default to PKCS#1 v1.5 padding - return _decodePkcs1_v1_5(eb.getBytes(), key, pub); - } - - // return message - return eb.getBytes(); -}; - -/** - * Creates an RSA key-pair generation state object. It is used to allow - * key-generation to be performed in steps. It also allows for a UI to - * display progress updates. - * - * @param bits the size for the private key in bits, defaults to 2048. - * @param e the public exponent to use, defaults to 65537 (0x10001). - * @param [options] the options to use. - * prng a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". - * algorithm the algorithm to use (default: 'PRIMEINC'). - * - * @return the state object to use to generate the key-pair. - */ -pki.rsa.createKeyPairGenerationState = function(bits, e, options) { - // TODO: migrate step-based prime generation code to forge.prime - - // set default bits - if(typeof(bits) === 'string') { - bits = parseInt(bits, 10); - } - bits = bits || 2048; - - // create prng with api that matches BigInteger secure random - options = options || {}; - var prng = options.prng || forge.random; - var rng = { - // x is an array to fill with bytes - nextBytes: function(x) { - var b = prng.getBytesSync(x.length); - for(var i = 0; i < x.length; ++i) { - x[i] = b.charCodeAt(i); - } - } - }; - - var algorithm = options.algorithm || 'PRIMEINC'; - - // create PRIMEINC algorithm state - var rval; - if(algorithm === 'PRIMEINC') { - rval = { - algorithm: algorithm, - state: 0, - bits: bits, - rng: rng, - eInt: e || 65537, - e: new BigInteger(null), - p: null, - q: null, - qBits: bits >> 1, - pBits: bits - (bits >> 1), - pqState: 0, - num: null, - keys: null - }; - rval.e.fromInt(rval.eInt); - } else { - throw new Error('Invalid key generation algorithm: ' + algorithm); - } - - return rval; -}; - -/** - * Attempts to runs the key-generation algorithm for at most n seconds - * (approximately) using the given state. When key-generation has completed, - * the keys will be stored in state.keys. - * - * To use this function to update a UI while generating a key or to prevent - * causing browser lockups/warnings, set "n" to a value other than 0. A - * simple pattern for generating a key and showing a progress indicator is: - * - * var state = pki.rsa.createKeyPairGenerationState(2048); - * var step = function() { - * // step key-generation, run algorithm for 100 ms, repeat - * if(!forge.pki.rsa.stepKeyPairGenerationState(state, 100)) { - * setTimeout(step, 1); - * } else { - * // key-generation complete - * // TODO: turn off progress indicator here - * // TODO: use the generated key-pair in "state.keys" - * } - * }; - * // TODO: turn on progress indicator here - * setTimeout(step, 0); - * - * @param state the state to use. - * @param n the maximum number of milliseconds to run the algorithm for, 0 - * to run the algorithm to completion. - * - * @return true if the key-generation completed, false if not. - */ -pki.rsa.stepKeyPairGenerationState = function(state, n) { - // set default algorithm if not set - if(!('algorithm' in state)) { - state.algorithm = 'PRIMEINC'; - } - - // TODO: migrate step-based prime generation code to forge.prime - // TODO: abstract as PRIMEINC algorithm - - // do key generation (based on Tom Wu's rsa.js, see jsbn.js license) - // with some minor optimizations and designed to run in steps - - // local state vars - var THIRTY = new BigInteger(null); - THIRTY.fromInt(30); - var deltaIdx = 0; - var op_or = function(x, y) {return x | y;}; - - // keep stepping until time limit is reached or done - var t1 = +new Date(); - var t2; - var total = 0; - while(state.keys === null && (n <= 0 || total < n)) { - // generate p or q - if(state.state === 0) { - /* Note: All primes are of the form: - - 30k+i, for i < 30 and gcd(30, i)=1, where there are 8 values for i - - When we generate a random number, we always align it at 30k + 1. Each - time the number is determined not to be prime we add to get to the - next 'i', eg: if the number was at 30k + 1 we add 6. */ - var bits = (state.p === null) ? state.pBits : state.qBits; - var bits1 = bits - 1; - - // get a random number - if(state.pqState === 0) { - state.num = new BigInteger(bits, state.rng); - // force MSB set - if(!state.num.testBit(bits1)) { - state.num.bitwiseTo( - BigInteger.ONE.shiftLeft(bits1), op_or, state.num); - } - // align number on 30k+1 boundary - state.num.dAddOffset(31 - state.num.mod(THIRTY).byteValue(), 0); - deltaIdx = 0; - - ++state.pqState; - } else if(state.pqState === 1) { - // try to make the number a prime - if(state.num.bitLength() > bits) { - // overflow, try again - state.pqState = 0; - // do primality test - } else if(state.num.isProbablePrime( - _getMillerRabinTests(state.num.bitLength()))) { - ++state.pqState; - } else { - // get next potential prime - state.num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); - } - } else if(state.pqState === 2) { - // ensure number is coprime with e - state.pqState = - (state.num.subtract(BigInteger.ONE).gcd(state.e) - .compareTo(BigInteger.ONE) === 0) ? 3 : 0; - } else if(state.pqState === 3) { - // store p or q - state.pqState = 0; - if(state.p === null) { - state.p = state.num; - } else { - state.q = state.num; - } - - // advance state if both p and q are ready - if(state.p !== null && state.q !== null) { - ++state.state; - } - state.num = null; - } - } else if(state.state === 1) { - // ensure p is larger than q (swap them if not) - if(state.p.compareTo(state.q) < 0) { - state.num = state.p; - state.p = state.q; - state.q = state.num; - } - ++state.state; - } else if(state.state === 2) { - // compute phi: (p - 1)(q - 1) (Euler's totient function) - state.p1 = state.p.subtract(BigInteger.ONE); - state.q1 = state.q.subtract(BigInteger.ONE); - state.phi = state.p1.multiply(state.q1); - ++state.state; - } else if(state.state === 3) { - // ensure e and phi are coprime - if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) === 0) { - // phi and e are coprime, advance - ++state.state; - } else { - // phi and e aren't coprime, so generate a new p and q - state.p = null; - state.q = null; - state.state = 0; - } - } else if(state.state === 4) { - // create n, ensure n is has the right number of bits - state.n = state.p.multiply(state.q); - - // ensure n is right number of bits - if(state.n.bitLength() === state.bits) { - // success, advance - ++state.state; - } else { - // failed, get new q - state.q = null; - state.state = 0; - } - } else if(state.state === 5) { - // set keys - var d = state.e.modInverse(state.phi); - state.keys = { - privateKey: pki.rsa.setPrivateKey( - state.n, state.e, d, state.p, state.q, - d.mod(state.p1), d.mod(state.q1), - state.q.modInverse(state.p)), - publicKey: pki.rsa.setPublicKey(state.n, state.e) - }; - } - - // update timing - t2 = +new Date(); - total += t2 - t1; - t1 = t2; - } - - return state.keys !== null; -}; - -/** - * Generates an RSA public-private key pair in a single call. - * - * To generate a key-pair in steps (to allow for progress updates and to - * prevent blocking or warnings in slow browsers) then use the key-pair - * generation state functions. - * - * To generate a key-pair asynchronously (either through web-workers, if - * available, or by breaking up the work on the main thread), pass a - * callback function. - * - * @param [bits] the size for the private key in bits, defaults to 2048. - * @param [e] the public exponent to use, defaults to 65537. - * @param [options] options for key-pair generation, if given then 'bits' - * and 'e' must *not* be given: - * bits the size for the private key in bits, (default: 2048). - * e the public exponent to use, (default: 65537 (0x10001)). - * workerScript the worker script URL. - * workers the number of web workers (if supported) to use, - * (default: 2). - * workLoad the size of the work load, ie: number of possible prime - * numbers for each web worker to check per work assignment, - * (default: 100). - * prng a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". Disables use of native APIs. - * algorithm the algorithm to use (default: 'PRIMEINC'). - * @param [callback(err, keypair)] called once the operation completes. - * - * @return an object with privateKey and publicKey properties. - */ -pki.rsa.generateKeyPair = function(bits, e, options, callback) { - // (bits), (options), (callback) - if(arguments.length === 1) { - if(typeof bits === 'object') { - options = bits; - bits = undefined; - } else if(typeof bits === 'function') { - callback = bits; - bits = undefined; - } - } else if(arguments.length === 2) { - // (bits, e), (bits, options), (bits, callback), (options, callback) - if(typeof bits === 'number') { - if(typeof e === 'function') { - callback = e; - e = undefined; - } else if(typeof e !== 'number') { - options = e; - e = undefined; - } - } else { - options = bits; - callback = e; - bits = undefined; - e = undefined; - } - } else if(arguments.length === 3) { - // (bits, e, options), (bits, e, callback), (bits, options, callback) - if(typeof e === 'number') { - if(typeof options === 'function') { - callback = options; - options = undefined; - } - } else { - callback = options; - options = e; - e = undefined; - } - } - options = options || {}; - if(bits === undefined) { - bits = options.bits || 2048; - } - if(e === undefined) { - e = options.e || 0x10001; - } - - // use native code if permitted, available, and parameters are acceptable - if(!forge.options.usePureJavaScript && !options.prng && - bits >= 256 && bits <= 16384 && (e === 0x10001 || e === 3)) { - if(callback) { - // try native async - if(_detectNodeCrypto('generateKeyPair')) { - return _crypto.generateKeyPair('rsa', { - modulusLength: bits, - publicExponent: e, - publicKeyEncoding: { - type: 'spki', - format: 'pem' - }, - privateKeyEncoding: { - type: 'pkcs8', - format: 'pem' - } - }, function(err, pub, priv) { - if(err) { - return callback(err); - } - callback(null, { - privateKey: pki.privateKeyFromPem(priv), - publicKey: pki.publicKeyFromPem(pub) - }); - }); - } - if(_detectSubtleCrypto('generateKey') && - _detectSubtleCrypto('exportKey')) { - // use standard native generateKey - return util.globalScope.crypto.subtle.generateKey({ - name: 'RSASSA-PKCS1-v1_5', - modulusLength: bits, - publicExponent: _intToUint8Array(e), - hash: {name: 'SHA-256'} - }, true /* key can be exported*/, ['sign', 'verify']) - .then(function(pair) { - return util.globalScope.crypto.subtle.exportKey( - 'pkcs8', pair.privateKey); - // avoiding catch(function(err) {...}) to support IE <= 8 - }).then(undefined, function(err) { - callback(err); - }).then(function(pkcs8) { - if(pkcs8) { - var privateKey = pki.privateKeyFromAsn1( - asn1.fromDer(forge.util.createBuffer(pkcs8))); - callback(null, { - privateKey: privateKey, - publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e) - }); - } - }); - } - if(_detectSubtleMsCrypto('generateKey') && - _detectSubtleMsCrypto('exportKey')) { - var genOp = util.globalScope.msCrypto.subtle.generateKey({ - name: 'RSASSA-PKCS1-v1_5', - modulusLength: bits, - publicExponent: _intToUint8Array(e), - hash: {name: 'SHA-256'} - }, true /* key can be exported*/, ['sign', 'verify']); - genOp.oncomplete = function(e) { - var pair = e.target.result; - var exportOp = util.globalScope.msCrypto.subtle.exportKey( - 'pkcs8', pair.privateKey); - exportOp.oncomplete = function(e) { - var pkcs8 = e.target.result; - var privateKey = pki.privateKeyFromAsn1( - asn1.fromDer(forge.util.createBuffer(pkcs8))); - callback(null, { - privateKey: privateKey, - publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e) - }); - }; - exportOp.onerror = function(err) { - callback(err); - }; - }; - genOp.onerror = function(err) { - callback(err); - }; - return; - } - } else { - // try native sync - if(_detectNodeCrypto('generateKeyPairSync')) { - var keypair = _crypto.generateKeyPairSync('rsa', { - modulusLength: bits, - publicExponent: e, - publicKeyEncoding: { - type: 'spki', - format: 'pem' - }, - privateKeyEncoding: { - type: 'pkcs8', - format: 'pem' - } - }); - return { - privateKey: pki.privateKeyFromPem(keypair.privateKey), - publicKey: pki.publicKeyFromPem(keypair.publicKey) - }; - } - } - } - - // use JavaScript implementation - var state = pki.rsa.createKeyPairGenerationState(bits, e, options); - if(!callback) { - pki.rsa.stepKeyPairGenerationState(state, 0); - return state.keys; - } - _generateKeyPair(state, options, callback); -}; - -/** - * Sets an RSA public key from BigIntegers modulus and exponent. - * - * @param n the modulus. - * @param e the exponent. - * - * @return the public key. - */ -pki.setRsaPublicKey = pki.rsa.setPublicKey = function(n, e) { - var key = { - n: n, - e: e - }; - - /** - * Encrypts the given data with this public key. Newer applications - * should use the 'RSA-OAEP' decryption scheme, 'RSAES-PKCS1-V1_5' is for - * legacy applications. - * - * @param data the byte string to encrypt. - * @param scheme the encryption scheme to use: - * 'RSAES-PKCS1-V1_5' (default), - * 'RSA-OAEP', - * 'RAW', 'NONE', or null to perform raw RSA encryption, - * an object with an 'encode' property set to a function - * with the signature 'function(data, key)' that returns - * a binary-encoded string representing the encoded data. - * @param schemeOptions any scheme-specific options. - * - * @return the encrypted byte string. - */ - key.encrypt = function(data, scheme, schemeOptions) { - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } else if(scheme === undefined) { - scheme = 'RSAES-PKCS1-V1_5'; - } - - if(scheme === 'RSAES-PKCS1-V1_5') { - scheme = { - encode: function(m, key, pub) { - return _encodePkcs1_v1_5(m, key, 0x02).getBytes(); - } - }; - } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') { - scheme = { - encode: function(m, key) { - return forge.pkcs1.encode_rsa_oaep(key, m, schemeOptions); - } - }; - } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { - scheme = {encode: function(e) {return e;}}; - } else if(typeof scheme === 'string') { - throw new Error('Unsupported encryption scheme: "' + scheme + '".'); - } - - // do scheme-based encoding then rsa encryption - var e = scheme.encode(data, key, true); - return pki.rsa.encrypt(e, key, true); - }; - - /** - * Verifies the given signature against the given digest. - * - * PKCS#1 supports multiple (currently two) signature schemes: - * RSASSA-PKCS1-V1_5 and RSASSA-PSS. - * - * By default this implementation uses the "old scheme", i.e. - * RSASSA-PKCS1-V1_5, in which case once RSA-decrypted, the - * signature is an OCTET STRING that holds a DigestInfo. - * - * DigestInfo ::= SEQUENCE { - * digestAlgorithm DigestAlgorithmIdentifier, - * digest Digest - * } - * DigestAlgorithmIdentifier ::= AlgorithmIdentifier - * Digest ::= OCTET STRING - * - * To perform PSS signature verification, provide an instance - * of Forge PSS object as the scheme parameter. - * - * @param digest the message digest hash to compare against the signature, - * as a binary-encoded string. - * @param signature the signature to verify, as a binary-encoded string. - * @param scheme signature verification scheme to use: - * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5, - * a Forge PSS object for RSASSA-PSS, - * 'NONE' or null for none, DigestInfo will not be expected, but - * PKCS#1 v1.5 padding will still be used. - * - * @return true if the signature was verified, false if not. - */ - key.verify = function(digest, signature, scheme) { - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } else if(scheme === undefined) { - scheme = 'RSASSA-PKCS1-V1_5'; - } - - if(scheme === 'RSASSA-PKCS1-V1_5') { - scheme = { - verify: function(digest, d) { - // remove padding - d = _decodePkcs1_v1_5(d, key, true); - // d is ASN.1 BER-encoded DigestInfo - var obj = asn1.fromDer(d); - // compare the given digest to the decrypted one - return digest === obj.value[1].value; - } - }; - } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { - scheme = { - verify: function(digest, d) { - // remove padding - d = _decodePkcs1_v1_5(d, key, true); - return digest === d; - } - }; - } - - // do rsa decryption w/o any decoding, then verify -- which does decoding - var d = pki.rsa.decrypt(signature, key, true, false); - return scheme.verify(digest, d, key.n.bitLength()); - }; - - return key; -}; - -/** - * Sets an RSA private key from BigIntegers modulus, exponent, primes, - * prime exponents, and modular multiplicative inverse. - * - * @param n the modulus. - * @param e the public exponent. - * @param d the private exponent ((inverse of e) mod n). - * @param p the first prime. - * @param q the second prime. - * @param dP exponent1 (d mod (p-1)). - * @param dQ exponent2 (d mod (q-1)). - * @param qInv ((inverse of q) mod p) - * - * @return the private key. - */ -pki.setRsaPrivateKey = pki.rsa.setPrivateKey = function( - n, e, d, p, q, dP, dQ, qInv) { - var key = { - n: n, - e: e, - d: d, - p: p, - q: q, - dP: dP, - dQ: dQ, - qInv: qInv - }; - - /** - * Decrypts the given data with this private key. The decryption scheme - * must match the one used to encrypt the data. - * - * @param data the byte string to decrypt. - * @param scheme the decryption scheme to use: - * 'RSAES-PKCS1-V1_5' (default), - * 'RSA-OAEP', - * 'RAW', 'NONE', or null to perform raw RSA decryption. - * @param schemeOptions any scheme-specific options. - * - * @return the decrypted byte string. - */ - key.decrypt = function(data, scheme, schemeOptions) { - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } else if(scheme === undefined) { - scheme = 'RSAES-PKCS1-V1_5'; - } - - // do rsa decryption w/o any decoding - var d = pki.rsa.decrypt(data, key, false, false); - - if(scheme === 'RSAES-PKCS1-V1_5') { - scheme = {decode: _decodePkcs1_v1_5}; - } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') { - scheme = { - decode: function(d, key) { - return forge.pkcs1.decode_rsa_oaep(key, d, schemeOptions); - } - }; - } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { - scheme = {decode: function(d) {return d;}}; - } else { - throw new Error('Unsupported encryption scheme: "' + scheme + '".'); - } - - // decode according to scheme - return scheme.decode(d, key, false); - }; - - /** - * Signs the given digest, producing a signature. - * - * PKCS#1 supports multiple (currently two) signature schemes: - * RSASSA-PKCS1-V1_5 and RSASSA-PSS. - * - * By default this implementation uses the "old scheme", i.e. - * RSASSA-PKCS1-V1_5. In order to generate a PSS signature, provide - * an instance of Forge PSS object as the scheme parameter. - * - * @param md the message digest object with the hash to sign. - * @param scheme the signature scheme to use: - * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5, - * a Forge PSS object for RSASSA-PSS, - * 'NONE' or null for none, DigestInfo will not be used but - * PKCS#1 v1.5 padding will still be used. - * - * @return the signature as a byte string. - */ - key.sign = function(md, scheme) { - /* Note: The internal implementation of RSA operations is being - transitioned away from a PKCS#1 v1.5 hard-coded scheme. Some legacy - code like the use of an encoding block identifier 'bt' will eventually - be removed. */ - - // private key operation - var bt = false; - - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } - - if(scheme === undefined || scheme === 'RSASSA-PKCS1-V1_5') { - scheme = {encode: emsaPkcs1v15encode}; - bt = 0x01; - } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { - scheme = {encode: function() {return md;}}; - bt = 0x01; - } - - // encode and then encrypt - var d = scheme.encode(md, key.n.bitLength()); - return pki.rsa.encrypt(d, key, bt); - }; - - return key; -}; - -/** - * Wraps an RSAPrivateKey ASN.1 object in an ASN.1 PrivateKeyInfo object. - * - * @param rsaKey the ASN.1 RSAPrivateKey. - * - * @return the ASN.1 PrivateKeyInfo. - */ -pki.wrapRsaPrivateKey = function(rsaKey) { - // PrivateKeyInfo - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version (0) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(0).getBytes()), - // privateKeyAlgorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.rsaEncryption).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // PrivateKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(rsaKey).getBytes()) - ]); -}; - -/** - * Converts a private key from an ASN.1 object. - * - * @param obj the ASN.1 representation of a PrivateKeyInfo containing an - * RSAPrivateKey or an RSAPrivateKey. - * - * @return the private key. - */ -pki.privateKeyFromAsn1 = function(obj) { - // get PrivateKeyInfo - var capture = {}; - var errors = []; - if(asn1.validate(obj, privateKeyValidator, capture, errors)) { - obj = asn1.fromDer(forge.util.createBuffer(capture.privateKey)); - } - - // get RSAPrivateKey - capture = {}; - errors = []; - if(!asn1.validate(obj, rsaPrivateKeyValidator, capture, errors)) { - var error = new Error('Cannot read private key. ' + - 'ASN.1 object does not contain an RSAPrivateKey.'); - error.errors = errors; - throw error; - } - - // Note: Version is currently ignored. - // capture.privateKeyVersion - // FIXME: inefficient, get a BigInteger that uses byte strings - var n, e, d, p, q, dP, dQ, qInv; - n = forge.util.createBuffer(capture.privateKeyModulus).toHex(); - e = forge.util.createBuffer(capture.privateKeyPublicExponent).toHex(); - d = forge.util.createBuffer(capture.privateKeyPrivateExponent).toHex(); - p = forge.util.createBuffer(capture.privateKeyPrime1).toHex(); - q = forge.util.createBuffer(capture.privateKeyPrime2).toHex(); - dP = forge.util.createBuffer(capture.privateKeyExponent1).toHex(); - dQ = forge.util.createBuffer(capture.privateKeyExponent2).toHex(); - qInv = forge.util.createBuffer(capture.privateKeyCoefficient).toHex(); - - // set private key - return pki.setRsaPrivateKey( - new BigInteger(n, 16), - new BigInteger(e, 16), - new BigInteger(d, 16), - new BigInteger(p, 16), - new BigInteger(q, 16), - new BigInteger(dP, 16), - new BigInteger(dQ, 16), - new BigInteger(qInv, 16)); -}; - -/** - * Converts a private key to an ASN.1 RSAPrivateKey. - * - * @param key the private key. - * - * @return the ASN.1 representation of an RSAPrivateKey. - */ -pki.privateKeyToAsn1 = pki.privateKeyToRSAPrivateKey = function(key) { - // RSAPrivateKey - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version (0 = only 2 primes, 1 multiple primes) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(0).getBytes()), - // modulus (n) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.n)), - // publicExponent (e) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.e)), - // privateExponent (d) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.d)), - // privateKeyPrime1 (p) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.p)), - // privateKeyPrime2 (q) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.q)), - // privateKeyExponent1 (dP) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.dP)), - // privateKeyExponent2 (dQ) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.dQ)), - // coefficient (qInv) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.qInv)) - ]); -}; - -/** - * Converts a public key from an ASN.1 SubjectPublicKeyInfo or RSAPublicKey. - * - * @param obj the asn1 representation of a SubjectPublicKeyInfo or RSAPublicKey. - * - * @return the public key. - */ -pki.publicKeyFromAsn1 = function(obj) { - // get SubjectPublicKeyInfo - var capture = {}; - var errors = []; - if(asn1.validate(obj, publicKeyValidator, capture, errors)) { - // get oid - var oid = asn1.derToOid(capture.publicKeyOid); - if(oid !== pki.oids.rsaEncryption) { - var error = new Error('Cannot read public key. Unknown OID.'); - error.oid = oid; - throw error; - } - obj = capture.rsaPublicKey; - } - - // get RSA params - errors = []; - if(!asn1.validate(obj, rsaPublicKeyValidator, capture, errors)) { - var error = new Error('Cannot read public key. ' + - 'ASN.1 object does not contain an RSAPublicKey.'); - error.errors = errors; - throw error; - } - - // FIXME: inefficient, get a BigInteger that uses byte strings - var n = forge.util.createBuffer(capture.publicKeyModulus).toHex(); - var e = forge.util.createBuffer(capture.publicKeyExponent).toHex(); - - // set public key - return pki.setRsaPublicKey( - new BigInteger(n, 16), - new BigInteger(e, 16)); -}; - -/** - * Converts a public key to an ASN.1 SubjectPublicKeyInfo. - * - * @param key the public key. - * - * @return the asn1 representation of a SubjectPublicKeyInfo. - */ -pki.publicKeyToAsn1 = pki.publicKeyToSubjectPublicKeyInfo = function(key) { - // SubjectPublicKeyInfo - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.rsaEncryption).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // subjectPublicKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, [ - pki.publicKeyToRSAPublicKey(key) - ]) - ]); -}; - -/** - * Converts a public key to an ASN.1 RSAPublicKey. - * - * @param key the public key. - * - * @return the asn1 representation of a RSAPublicKey. - */ -pki.publicKeyToRSAPublicKey = function(key) { - // RSAPublicKey - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // modulus (n) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.n)), - // publicExponent (e) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.e)) - ]); -}; - -/** - * Encodes a message using PKCS#1 v1.5 padding. - * - * @param m the message to encode. - * @param key the RSA key to use. - * @param bt the block type to use, i.e. either 0x01 (for signing) or 0x02 - * (for encryption). - * - * @return the padded byte buffer. - */ -function _encodePkcs1_v1_5(m, key, bt) { - var eb = forge.util.createBuffer(); - - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - /* use PKCS#1 v1.5 padding */ - if(m.length > (k - 11)) { - var error = new Error('Message is too long for PKCS#1 v1.5 padding.'); - error.length = m.length; - error.max = k - 11; - throw error; - } - - /* A block type BT, a padding string PS, and the data D shall be - formatted into an octet string EB, the encryption block: - - EB = 00 || BT || PS || 00 || D - - The block type BT shall be a single octet indicating the structure of - the encryption block. For this version of the document it shall have - value 00, 01, or 02. For a private-key operation, the block type - shall be 00 or 01. For a public-key operation, it shall be 02. - - The padding string PS shall consist of k-3-||D|| octets. For block - type 00, the octets shall have value 00; for block type 01, they - shall have value FF; and for block type 02, they shall be - pseudorandomly generated and nonzero. This makes the length of the - encryption block EB equal to k. */ - - // build the encryption block - eb.putByte(0x00); - eb.putByte(bt); - - // create the padding - var padNum = k - 3 - m.length; - var padByte; - // private key op - if(bt === 0x00 || bt === 0x01) { - padByte = (bt === 0x00) ? 0x00 : 0xFF; - for(var i = 0; i < padNum; ++i) { - eb.putByte(padByte); - } - } else { - // public key op - // pad with random non-zero values - while(padNum > 0) { - var numZeros = 0; - var padBytes = forge.random.getBytes(padNum); - for(var i = 0; i < padNum; ++i) { - padByte = padBytes.charCodeAt(i); - if(padByte === 0) { - ++numZeros; - } else { - eb.putByte(padByte); - } - } - padNum = numZeros; - } - } - - // zero followed by message - eb.putByte(0x00); - eb.putBytes(m); - - return eb; -} - -/** - * Decodes a message using PKCS#1 v1.5 padding. - * - * @param em the message to decode. - * @param key the RSA key to use. - * @param pub true if the key is a public key, false if it is private. - * @param ml the message length, if specified. - * - * @return the decoded bytes. - */ -function _decodePkcs1_v1_5(em, key, pub, ml) { - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - /* It is an error if any of the following conditions occurs: - - 1. The encryption block EB cannot be parsed unambiguously. - 2. The padding string PS consists of fewer than eight octets - or is inconsisent with the block type BT. - 3. The decryption process is a public-key operation and the block - type BT is not 00 or 01, or the decryption process is a - private-key operation and the block type is not 02. - */ - - // parse the encryption block - var eb = forge.util.createBuffer(em); - var first = eb.getByte(); - var bt = eb.getByte(); - if(first !== 0x00 || - (pub && bt !== 0x00 && bt !== 0x01) || - (!pub && bt != 0x02) || - (pub && bt === 0x00 && typeof(ml) === 'undefined')) { - throw new Error('Encryption block is invalid.'); - } - - var padNum = 0; - if(bt === 0x00) { - // check all padding bytes for 0x00 - padNum = k - 3 - ml; - for(var i = 0; i < padNum; ++i) { - if(eb.getByte() !== 0x00) { - throw new Error('Encryption block is invalid.'); - } - } - } else if(bt === 0x01) { - // find the first byte that isn't 0xFF, should be after all padding - padNum = 0; - while(eb.length() > 1) { - if(eb.getByte() !== 0xFF) { - --eb.read; - break; - } - ++padNum; - } - } else if(bt === 0x02) { - // look for 0x00 byte - padNum = 0; - while(eb.length() > 1) { - if(eb.getByte() === 0x00) { - --eb.read; - break; - } - ++padNum; - } - } - - // zero must be 0x00 and padNum must be (k - 3 - message length) - var zero = eb.getByte(); - if(zero !== 0x00 || padNum !== (k - 3 - eb.length())) { - throw new Error('Encryption block is invalid.'); - } - - return eb.getBytes(); -} - -/** - * Runs the key-generation algorithm asynchronously, either in the background - * via Web Workers, or using the main thread and setImmediate. - * - * @param state the key-pair generation state. - * @param [options] options for key-pair generation: - * workerScript the worker script URL. - * workers the number of web workers (if supported) to use, - * (default: 2, -1 to use estimated cores minus one). - * workLoad the size of the work load, ie: number of possible prime - * numbers for each web worker to check per work assignment, - * (default: 100). - * @param callback(err, keypair) called once the operation completes. - */ -function _generateKeyPair(state, options, callback) { - if(typeof options === 'function') { - callback = options; - options = {}; - } - options = options || {}; - - var opts = { - algorithm: { - name: options.algorithm || 'PRIMEINC', - options: { - workers: options.workers || 2, - workLoad: options.workLoad || 100, - workerScript: options.workerScript - } - } - }; - if('prng' in options) { - opts.prng = options.prng; - } - - generate(); - - function generate() { - // find p and then q (done in series to simplify) - getPrime(state.pBits, function(err, num) { - if(err) { - return callback(err); - } - state.p = num; - if(state.q !== null) { - return finish(err, state.q); - } - getPrime(state.qBits, finish); - }); - } - - function getPrime(bits, callback) { - forge.prime.generateProbablePrime(bits, opts, callback); - } - - function finish(err, num) { - if(err) { - return callback(err); - } - - // set q - state.q = num; - - // ensure p is larger than q (swap them if not) - if(state.p.compareTo(state.q) < 0) { - var tmp = state.p; - state.p = state.q; - state.q = tmp; - } - - // ensure p is coprime with e - if(state.p.subtract(BigInteger.ONE).gcd(state.e) - .compareTo(BigInteger.ONE) !== 0) { - state.p = null; - generate(); - return; - } - - // ensure q is coprime with e - if(state.q.subtract(BigInteger.ONE).gcd(state.e) - .compareTo(BigInteger.ONE) !== 0) { - state.q = null; - getPrime(state.qBits, finish); - return; - } - - // compute phi: (p - 1)(q - 1) (Euler's totient function) - state.p1 = state.p.subtract(BigInteger.ONE); - state.q1 = state.q.subtract(BigInteger.ONE); - state.phi = state.p1.multiply(state.q1); - - // ensure e and phi are coprime - if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) !== 0) { - // phi and e aren't coprime, so generate a new p and q - state.p = state.q = null; - generate(); - return; - } - - // create n, ensure n is has the right number of bits - state.n = state.p.multiply(state.q); - if(state.n.bitLength() !== state.bits) { - // failed, get new q - state.q = null; - getPrime(state.qBits, finish); - return; - } - - // set keys - var d = state.e.modInverse(state.phi); - state.keys = { - privateKey: pki.rsa.setPrivateKey( - state.n, state.e, d, state.p, state.q, - d.mod(state.p1), d.mod(state.q1), - state.q.modInverse(state.p)), - publicKey: pki.rsa.setPublicKey(state.n, state.e) - }; - - callback(null, state.keys); - } -} - -/** - * Converts a positive BigInteger into 2's-complement big-endian bytes. - * - * @param b the big integer to convert. - * - * @return the bytes. - */ -function _bnToBytes(b) { - // prepend 0x00 if first byte >= 0x80 - var hex = b.toString(16); - if(hex[0] >= '8') { - hex = '00' + hex; - } - var bytes = forge.util.hexToBytes(hex); - - // ensure integer is minimally-encoded - if(bytes.length > 1 && - // leading 0x00 for positive integer - ((bytes.charCodeAt(0) === 0 && - (bytes.charCodeAt(1) & 0x80) === 0) || - // leading 0xFF for negative integer - (bytes.charCodeAt(0) === 0xFF && - (bytes.charCodeAt(1) & 0x80) === 0x80))) { - return bytes.substr(1); - } - return bytes; -} - -/** - * Returns the required number of Miller-Rabin tests to generate a - * prime with an error probability of (1/2)^80. - * - * See Handbook of Applied Cryptography Chapter 4, Table 4.4. - * - * @param bits the bit size. - * - * @return the required number of iterations. - */ -function _getMillerRabinTests(bits) { - if(bits <= 100) return 27; - if(bits <= 150) return 18; - if(bits <= 200) return 15; - if(bits <= 250) return 12; - if(bits <= 300) return 9; - if(bits <= 350) return 8; - if(bits <= 400) return 7; - if(bits <= 500) return 6; - if(bits <= 600) return 5; - if(bits <= 800) return 4; - if(bits <= 1250) return 3; - return 2; -} - -/** - * Performs feature detection on the Node crypto interface. - * - * @param fn the feature (function) to detect. - * - * @return true if detected, false if not. - */ -function _detectNodeCrypto(fn) { - return forge.util.isNodejs && typeof _crypto[fn] === 'function'; -} - -/** - * Performs feature detection on the SubtleCrypto interface. - * - * @param fn the feature (function) to detect. - * - * @return true if detected, false if not. - */ -function _detectSubtleCrypto(fn) { - return (typeof util.globalScope !== 'undefined' && - typeof util.globalScope.crypto === 'object' && - typeof util.globalScope.crypto.subtle === 'object' && - typeof util.globalScope.crypto.subtle[fn] === 'function'); -} - -/** - * Performs feature detection on the deprecated Microsoft Internet Explorer - * outdated SubtleCrypto interface. This function should only be used after - * checking for the modern, standard SubtleCrypto interface. - * - * @param fn the feature (function) to detect. - * - * @return true if detected, false if not. - */ -function _detectSubtleMsCrypto(fn) { - return (typeof util.globalScope !== 'undefined' && - typeof util.globalScope.msCrypto === 'object' && - typeof util.globalScope.msCrypto.subtle === 'object' && - typeof util.globalScope.msCrypto.subtle[fn] === 'function'); -} - -function _intToUint8Array(x) { - var bytes = forge.util.hexToBytes(x.toString(16)); - var buffer = new Uint8Array(bytes.length); - for(var i = 0; i < bytes.length; ++i) { - buffer[i] = bytes.charCodeAt(i); - } - return buffer; -} - -function _privateKeyFromJwk(jwk) { - if(jwk.kty !== 'RSA') { - throw new Error( - 'Unsupported key algorithm "' + jwk.kty + '"; algorithm must be "RSA".'); - } - return pki.setRsaPrivateKey( - _base64ToBigInt(jwk.n), - _base64ToBigInt(jwk.e), - _base64ToBigInt(jwk.d), - _base64ToBigInt(jwk.p), - _base64ToBigInt(jwk.q), - _base64ToBigInt(jwk.dp), - _base64ToBigInt(jwk.dq), - _base64ToBigInt(jwk.qi)); -} - -function _publicKeyFromJwk(jwk) { - if(jwk.kty !== 'RSA') { - throw new Error('Key algorithm must be "RSA".'); - } - return pki.setRsaPublicKey( - _base64ToBigInt(jwk.n), - _base64ToBigInt(jwk.e)); -} - -function _base64ToBigInt(b64) { - return new BigInteger(forge.util.bytesToHex(forge.util.decode64(b64)), 16); -} diff --git a/node_modules/node-forge/lib/sha1.js b/node_modules/node-forge/lib/sha1.js deleted file mode 100644 index 5f84eb66..00000000 --- a/node_modules/node-forge/lib/sha1.js +++ /dev/null @@ -1,319 +0,0 @@ -/** - * Secure Hash Algorithm with 160-bit digest (SHA-1) implementation. - * - * @author Dave Longley - * - * Copyright (c) 2010-2015 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var sha1 = module.exports = forge.sha1 = forge.sha1 || {}; -forge.md.sha1 = forge.md.algorithms.sha1 = sha1; - -/** - * Creates a SHA-1 message digest object. - * - * @return a message digest object. - */ -sha1.create = function() { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - // SHA-1 state contains five 32-bit integers - var _state = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for word storage - var _w = new Array(80); - - // message digest object - var md = { - algorithm: 'sha1', - blockLength: 64, - digestLength: 20, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 8 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength64 for backwards-compatibility) - md.fullMessageLength = md.messageLength64 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _state = { - h0: 0x67452301, - h1: 0xEFCDAB89, - h2: 0x98BADCFE, - h3: 0x10325476, - h4: 0xC3D2E1F0 - }; - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = ((len[1] / 0x100000000) >>> 0); - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_state, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate SHA-1 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 448 mod 512. In other words, - the data to be digested must be a multiple of 512 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 8 bytes (64 - bits), that means that the last segment of the data must have 56 bytes - (448 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 448 mod 512 because - 512 - 128 = 448. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 448 mod 512, then 512 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in big-endian order; since length - // is stored in bytes we multiply by 8 and add carry from next int - var next, carry; - var bits = md.fullMessageLength[0] * 8; - for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { - next = md.fullMessageLength[i + 1] * 8; - carry = (next / 0x100000000) >>> 0; - bits += carry; - finalBlock.putInt32(bits >>> 0); - bits = next >>> 0; - } - finalBlock.putInt32(bits); - - var s2 = { - h0: _state.h0, - h1: _state.h1, - h2: _state.h2, - h3: _state.h3, - h4: _state.h4 - }; - _update(s2, _w, finalBlock); - var rval = forge.util.createBuffer(); - rval.putInt32(s2.h0); - rval.putInt32(s2.h1); - rval.putInt32(s2.h2); - rval.putInt32(s2.h3); - rval.putInt32(s2.h4); - return rval; - }; - - return md; -}; - -// sha-1 padding bytes not initialized yet -var _padding = null; -var _initialized = false; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 64); - - // now initialized - _initialized = true; -} - -/** - * Updates a SHA-1 state with the given byte buffer. - * - * @param s the SHA-1 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (64 byte) chunks - var t, a, b, c, d, e, f, i; - var len = bytes.length(); - while(len >= 64) { - // the w array will be populated with sixteen 32-bit big-endian words - // and then extended into 80 32-bit words according to SHA-1 algorithm - // and for 32-79 using Max Locktyukhin's optimization - - // initialize hash value for this chunk - a = s.h0; - b = s.h1; - c = s.h2; - d = s.h3; - e = s.h4; - - // round 1 - for(i = 0; i < 16; ++i) { - t = bytes.getInt32(); - w[i] = t; - f = d ^ (b & (c ^ d)); - t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - for(; i < 20; ++i) { - t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]); - t = (t << 1) | (t >>> 31); - w[i] = t; - f = d ^ (b & (c ^ d)); - t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - // round 2 - for(; i < 32; ++i) { - t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]); - t = (t << 1) | (t >>> 31); - w[i] = t; - f = b ^ c ^ d; - t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - for(; i < 40; ++i) { - t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); - t = (t << 2) | (t >>> 30); - w[i] = t; - f = b ^ c ^ d; - t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - // round 3 - for(; i < 60; ++i) { - t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); - t = (t << 2) | (t >>> 30); - w[i] = t; - f = (b & c) | (d & (b ^ c)); - t = ((a << 5) | (a >>> 27)) + f + e + 0x8F1BBCDC + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - // round 4 - for(; i < 80; ++i) { - t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); - t = (t << 2) | (t >>> 30); - w[i] = t; - f = b ^ c ^ d; - t = ((a << 5) | (a >>> 27)) + f + e + 0xCA62C1D6 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - - // update hash state - s.h0 = (s.h0 + a) | 0; - s.h1 = (s.h1 + b) | 0; - s.h2 = (s.h2 + c) | 0; - s.h3 = (s.h3 + d) | 0; - s.h4 = (s.h4 + e) | 0; - - len -= 64; - } -} diff --git a/node_modules/node-forge/lib/sha256.js b/node_modules/node-forge/lib/sha256.js deleted file mode 100644 index 0659ad71..00000000 --- a/node_modules/node-forge/lib/sha256.js +++ /dev/null @@ -1,327 +0,0 @@ -/** - * Secure Hash Algorithm with 256-bit digest (SHA-256) implementation. - * - * See FIPS 180-2 for details. - * - * @author Dave Longley - * - * Copyright (c) 2010-2015 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var sha256 = module.exports = forge.sha256 = forge.sha256 || {}; -forge.md.sha256 = forge.md.algorithms.sha256 = sha256; - -/** - * Creates a SHA-256 message digest object. - * - * @return a message digest object. - */ -sha256.create = function() { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - // SHA-256 state contains eight 32-bit integers - var _state = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for word storage - var _w = new Array(64); - - // message digest object - var md = { - algorithm: 'sha256', - blockLength: 64, - digestLength: 32, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 8 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength64 for backwards-compatibility) - md.fullMessageLength = md.messageLength64 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _state = { - h0: 0x6A09E667, - h1: 0xBB67AE85, - h2: 0x3C6EF372, - h3: 0xA54FF53A, - h4: 0x510E527F, - h5: 0x9B05688C, - h6: 0x1F83D9AB, - h7: 0x5BE0CD19 - }; - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = ((len[1] / 0x100000000) >>> 0); - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_state, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate SHA-256 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 448 mod 512. In other words, - the data to be digested must be a multiple of 512 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 8 bytes (64 - bits), that means that the last segment of the data must have 56 bytes - (448 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 448 mod 512 because - 512 - 128 = 448. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 448 mod 512, then 512 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in big-endian order; since length - // is stored in bytes we multiply by 8 and add carry from next int - var next, carry; - var bits = md.fullMessageLength[0] * 8; - for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { - next = md.fullMessageLength[i + 1] * 8; - carry = (next / 0x100000000) >>> 0; - bits += carry; - finalBlock.putInt32(bits >>> 0); - bits = next >>> 0; - } - finalBlock.putInt32(bits); - - var s2 = { - h0: _state.h0, - h1: _state.h1, - h2: _state.h2, - h3: _state.h3, - h4: _state.h4, - h5: _state.h5, - h6: _state.h6, - h7: _state.h7 - }; - _update(s2, _w, finalBlock); - var rval = forge.util.createBuffer(); - rval.putInt32(s2.h0); - rval.putInt32(s2.h1); - rval.putInt32(s2.h2); - rval.putInt32(s2.h3); - rval.putInt32(s2.h4); - rval.putInt32(s2.h5); - rval.putInt32(s2.h6); - rval.putInt32(s2.h7); - return rval; - }; - - return md; -}; - -// sha-256 padding bytes not initialized yet -var _padding = null; -var _initialized = false; - -// table of constants -var _k = null; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 64); - - // create K table for SHA-256 - _k = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; - - // now initialized - _initialized = true; -} - -/** - * Updates a SHA-256 state with the given byte buffer. - * - * @param s the SHA-256 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (64 byte) chunks - var t1, t2, s0, s1, ch, maj, i, a, b, c, d, e, f, g, h; - var len = bytes.length(); - while(len >= 64) { - // the w array will be populated with sixteen 32-bit big-endian words - // and then extended into 64 32-bit words according to SHA-256 - for(i = 0; i < 16; ++i) { - w[i] = bytes.getInt32(); - } - for(; i < 64; ++i) { - // XOR word 2 words ago rot right 17, rot right 19, shft right 10 - t1 = w[i - 2]; - t1 = - ((t1 >>> 17) | (t1 << 15)) ^ - ((t1 >>> 19) | (t1 << 13)) ^ - (t1 >>> 10); - // XOR word 15 words ago rot right 7, rot right 18, shft right 3 - t2 = w[i - 15]; - t2 = - ((t2 >>> 7) | (t2 << 25)) ^ - ((t2 >>> 18) | (t2 << 14)) ^ - (t2 >>> 3); - // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^32 - w[i] = (t1 + w[i - 7] + t2 + w[i - 16]) | 0; - } - - // initialize hash value for this chunk - a = s.h0; - b = s.h1; - c = s.h2; - d = s.h3; - e = s.h4; - f = s.h5; - g = s.h6; - h = s.h7; - - // round function - for(i = 0; i < 64; ++i) { - // Sum1(e) - s1 = - ((e >>> 6) | (e << 26)) ^ - ((e >>> 11) | (e << 21)) ^ - ((e >>> 25) | (e << 7)); - // Ch(e, f, g) (optimized the same way as SHA-1) - ch = g ^ (e & (f ^ g)); - // Sum0(a) - s0 = - ((a >>> 2) | (a << 30)) ^ - ((a >>> 13) | (a << 19)) ^ - ((a >>> 22) | (a << 10)); - // Maj(a, b, c) (optimized the same way as SHA-1) - maj = (a & b) | (c & (a ^ b)); - - // main algorithm - t1 = h + s1 + ch + _k[i] + w[i]; - t2 = s0 + maj; - h = g; - g = f; - f = e; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - // can't truncate with `| 0` - e = (d + t1) >>> 0; - d = c; - c = b; - b = a; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - // can't truncate with `| 0` - a = (t1 + t2) >>> 0; - } - - // update hash state - s.h0 = (s.h0 + a) | 0; - s.h1 = (s.h1 + b) | 0; - s.h2 = (s.h2 + c) | 0; - s.h3 = (s.h3 + d) | 0; - s.h4 = (s.h4 + e) | 0; - s.h5 = (s.h5 + f) | 0; - s.h6 = (s.h6 + g) | 0; - s.h7 = (s.h7 + h) | 0; - len -= 64; - } -} diff --git a/node_modules/node-forge/lib/sha512.js b/node_modules/node-forge/lib/sha512.js deleted file mode 100644 index e09b442a..00000000 --- a/node_modules/node-forge/lib/sha512.js +++ /dev/null @@ -1,561 +0,0 @@ -/** - * Secure Hash Algorithm with a 1024-bit block size implementation. - * - * This includes: SHA-512, SHA-384, SHA-512/224, and SHA-512/256. For - * SHA-256 (block size 512 bits), see sha256.js. - * - * See FIPS 180-4 for details. - * - * @author Dave Longley - * - * Copyright (c) 2014-2015 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var sha512 = module.exports = forge.sha512 = forge.sha512 || {}; - -// SHA-512 -forge.md.sha512 = forge.md.algorithms.sha512 = sha512; - -// SHA-384 -var sha384 = forge.sha384 = forge.sha512.sha384 = forge.sha512.sha384 || {}; -sha384.create = function() { - return sha512.create('SHA-384'); -}; -forge.md.sha384 = forge.md.algorithms.sha384 = sha384; - -// SHA-512/256 -forge.sha512.sha256 = forge.sha512.sha256 || { - create: function() { - return sha512.create('SHA-512/256'); - } -}; -forge.md['sha512/256'] = forge.md.algorithms['sha512/256'] = - forge.sha512.sha256; - -// SHA-512/224 -forge.sha512.sha224 = forge.sha512.sha224 || { - create: function() { - return sha512.create('SHA-512/224'); - } -}; -forge.md['sha512/224'] = forge.md.algorithms['sha512/224'] = - forge.sha512.sha224; - -/** - * Creates a SHA-2 message digest object. - * - * @param algorithm the algorithm to use (SHA-512, SHA-384, SHA-512/224, - * SHA-512/256). - * - * @return a message digest object. - */ -sha512.create = function(algorithm) { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - if(typeof algorithm === 'undefined') { - algorithm = 'SHA-512'; - } - - if(!(algorithm in _states)) { - throw new Error('Invalid SHA-512 algorithm: ' + algorithm); - } - - // SHA-512 state contains eight 64-bit integers (each as two 32-bit ints) - var _state = _states[algorithm]; - var _h = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for 64-bit word storage - var _w = new Array(80); - for(var wi = 0; wi < 80; ++wi) { - _w[wi] = new Array(2); - } - - // determine digest length by algorithm name (default) - var digestLength = 64; - switch(algorithm) { - case 'SHA-384': - digestLength = 48; - break; - case 'SHA-512/256': - digestLength = 32; - break; - case 'SHA-512/224': - digestLength = 28; - break; - } - - // message digest object - var md = { - // SHA-512 => sha512 - algorithm: algorithm.replace('-', '').toLowerCase(), - blockLength: 128, - digestLength: digestLength, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 16 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength128 for backwards-compatibility) - md.fullMessageLength = md.messageLength128 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _h = new Array(_state.length); - for(var i = 0; i < _state.length; ++i) { - _h[i] = _state[i].slice(0); - } - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = ((len[1] / 0x100000000) >>> 0); - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_h, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate SHA-512 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 896 mod 1024. In other words, - the data to be digested must be a multiple of 1024 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 16 bytes (128 - bits), that means that the last segment of the data must have 112 bytes - (896 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 896 mod 1024 because - 1024 - 128 = 896. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 896 mod 1024, then 1024 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in big-endian order; since length - // is stored in bytes we multiply by 8 and add carry from next int - var next, carry; - var bits = md.fullMessageLength[0] * 8; - for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { - next = md.fullMessageLength[i + 1] * 8; - carry = (next / 0x100000000) >>> 0; - bits += carry; - finalBlock.putInt32(bits >>> 0); - bits = next >>> 0; - } - finalBlock.putInt32(bits); - - var h = new Array(_h.length); - for(var i = 0; i < _h.length; ++i) { - h[i] = _h[i].slice(0); - } - _update(h, _w, finalBlock); - var rval = forge.util.createBuffer(); - var hlen; - if(algorithm === 'SHA-512') { - hlen = h.length; - } else if(algorithm === 'SHA-384') { - hlen = h.length - 2; - } else { - hlen = h.length - 4; - } - for(var i = 0; i < hlen; ++i) { - rval.putInt32(h[i][0]); - if(i !== hlen - 1 || algorithm !== 'SHA-512/224') { - rval.putInt32(h[i][1]); - } - } - return rval; - }; - - return md; -}; - -// sha-512 padding bytes not initialized yet -var _padding = null; -var _initialized = false; - -// table of constants -var _k = null; - -// initial hash states -var _states = null; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 128); - - // create K table for SHA-512 - _k = [ - [0x428a2f98, 0xd728ae22], [0x71374491, 0x23ef65cd], - [0xb5c0fbcf, 0xec4d3b2f], [0xe9b5dba5, 0x8189dbbc], - [0x3956c25b, 0xf348b538], [0x59f111f1, 0xb605d019], - [0x923f82a4, 0xaf194f9b], [0xab1c5ed5, 0xda6d8118], - [0xd807aa98, 0xa3030242], [0x12835b01, 0x45706fbe], - [0x243185be, 0x4ee4b28c], [0x550c7dc3, 0xd5ffb4e2], - [0x72be5d74, 0xf27b896f], [0x80deb1fe, 0x3b1696b1], - [0x9bdc06a7, 0x25c71235], [0xc19bf174, 0xcf692694], - [0xe49b69c1, 0x9ef14ad2], [0xefbe4786, 0x384f25e3], - [0x0fc19dc6, 0x8b8cd5b5], [0x240ca1cc, 0x77ac9c65], - [0x2de92c6f, 0x592b0275], [0x4a7484aa, 0x6ea6e483], - [0x5cb0a9dc, 0xbd41fbd4], [0x76f988da, 0x831153b5], - [0x983e5152, 0xee66dfab], [0xa831c66d, 0x2db43210], - [0xb00327c8, 0x98fb213f], [0xbf597fc7, 0xbeef0ee4], - [0xc6e00bf3, 0x3da88fc2], [0xd5a79147, 0x930aa725], - [0x06ca6351, 0xe003826f], [0x14292967, 0x0a0e6e70], - [0x27b70a85, 0x46d22ffc], [0x2e1b2138, 0x5c26c926], - [0x4d2c6dfc, 0x5ac42aed], [0x53380d13, 0x9d95b3df], - [0x650a7354, 0x8baf63de], [0x766a0abb, 0x3c77b2a8], - [0x81c2c92e, 0x47edaee6], [0x92722c85, 0x1482353b], - [0xa2bfe8a1, 0x4cf10364], [0xa81a664b, 0xbc423001], - [0xc24b8b70, 0xd0f89791], [0xc76c51a3, 0x0654be30], - [0xd192e819, 0xd6ef5218], [0xd6990624, 0x5565a910], - [0xf40e3585, 0x5771202a], [0x106aa070, 0x32bbd1b8], - [0x19a4c116, 0xb8d2d0c8], [0x1e376c08, 0x5141ab53], - [0x2748774c, 0xdf8eeb99], [0x34b0bcb5, 0xe19b48a8], - [0x391c0cb3, 0xc5c95a63], [0x4ed8aa4a, 0xe3418acb], - [0x5b9cca4f, 0x7763e373], [0x682e6ff3, 0xd6b2b8a3], - [0x748f82ee, 0x5defb2fc], [0x78a5636f, 0x43172f60], - [0x84c87814, 0xa1f0ab72], [0x8cc70208, 0x1a6439ec], - [0x90befffa, 0x23631e28], [0xa4506ceb, 0xde82bde9], - [0xbef9a3f7, 0xb2c67915], [0xc67178f2, 0xe372532b], - [0xca273ece, 0xea26619c], [0xd186b8c7, 0x21c0c207], - [0xeada7dd6, 0xcde0eb1e], [0xf57d4f7f, 0xee6ed178], - [0x06f067aa, 0x72176fba], [0x0a637dc5, 0xa2c898a6], - [0x113f9804, 0xbef90dae], [0x1b710b35, 0x131c471b], - [0x28db77f5, 0x23047d84], [0x32caab7b, 0x40c72493], - [0x3c9ebe0a, 0x15c9bebc], [0x431d67c4, 0x9c100d4c], - [0x4cc5d4be, 0xcb3e42b6], [0x597f299c, 0xfc657e2a], - [0x5fcb6fab, 0x3ad6faec], [0x6c44198c, 0x4a475817] - ]; - - // initial hash states - _states = {}; - _states['SHA-512'] = [ - [0x6a09e667, 0xf3bcc908], - [0xbb67ae85, 0x84caa73b], - [0x3c6ef372, 0xfe94f82b], - [0xa54ff53a, 0x5f1d36f1], - [0x510e527f, 0xade682d1], - [0x9b05688c, 0x2b3e6c1f], - [0x1f83d9ab, 0xfb41bd6b], - [0x5be0cd19, 0x137e2179] - ]; - _states['SHA-384'] = [ - [0xcbbb9d5d, 0xc1059ed8], - [0x629a292a, 0x367cd507], - [0x9159015a, 0x3070dd17], - [0x152fecd8, 0xf70e5939], - [0x67332667, 0xffc00b31], - [0x8eb44a87, 0x68581511], - [0xdb0c2e0d, 0x64f98fa7], - [0x47b5481d, 0xbefa4fa4] - ]; - _states['SHA-512/256'] = [ - [0x22312194, 0xFC2BF72C], - [0x9F555FA3, 0xC84C64C2], - [0x2393B86B, 0x6F53B151], - [0x96387719, 0x5940EABD], - [0x96283EE2, 0xA88EFFE3], - [0xBE5E1E25, 0x53863992], - [0x2B0199FC, 0x2C85B8AA], - [0x0EB72DDC, 0x81C52CA2] - ]; - _states['SHA-512/224'] = [ - [0x8C3D37C8, 0x19544DA2], - [0x73E19966, 0x89DCD4D6], - [0x1DFAB7AE, 0x32FF9C82], - [0x679DD514, 0x582F9FCF], - [0x0F6D2B69, 0x7BD44DA8], - [0x77E36F73, 0x04C48942], - [0x3F9D85A8, 0x6A1D36C8], - [0x1112E6AD, 0x91D692A1] - ]; - - // now initialized - _initialized = true; -} - -/** - * Updates a SHA-512 state with the given byte buffer. - * - * @param s the SHA-512 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (128 byte) chunks - var t1_hi, t1_lo; - var t2_hi, t2_lo; - var s0_hi, s0_lo; - var s1_hi, s1_lo; - var ch_hi, ch_lo; - var maj_hi, maj_lo; - var a_hi, a_lo; - var b_hi, b_lo; - var c_hi, c_lo; - var d_hi, d_lo; - var e_hi, e_lo; - var f_hi, f_lo; - var g_hi, g_lo; - var h_hi, h_lo; - var i, hi, lo, w2, w7, w15, w16; - var len = bytes.length(); - while(len >= 128) { - // the w array will be populated with sixteen 64-bit big-endian words - // and then extended into 64 64-bit words according to SHA-512 - for(i = 0; i < 16; ++i) { - w[i][0] = bytes.getInt32() >>> 0; - w[i][1] = bytes.getInt32() >>> 0; - } - for(; i < 80; ++i) { - // for word 2 words ago: ROTR 19(x) ^ ROTR 61(x) ^ SHR 6(x) - w2 = w[i - 2]; - hi = w2[0]; - lo = w2[1]; - - // high bits - t1_hi = ( - ((hi >>> 19) | (lo << 13)) ^ // ROTR 19 - ((lo >>> 29) | (hi << 3)) ^ // ROTR 61/(swap + ROTR 29) - (hi >>> 6)) >>> 0; // SHR 6 - // low bits - t1_lo = ( - ((hi << 13) | (lo >>> 19)) ^ // ROTR 19 - ((lo << 3) | (hi >>> 29)) ^ // ROTR 61/(swap + ROTR 29) - ((hi << 26) | (lo >>> 6))) >>> 0; // SHR 6 - - // for word 15 words ago: ROTR 1(x) ^ ROTR 8(x) ^ SHR 7(x) - w15 = w[i - 15]; - hi = w15[0]; - lo = w15[1]; - - // high bits - t2_hi = ( - ((hi >>> 1) | (lo << 31)) ^ // ROTR 1 - ((hi >>> 8) | (lo << 24)) ^ // ROTR 8 - (hi >>> 7)) >>> 0; // SHR 7 - // low bits - t2_lo = ( - ((hi << 31) | (lo >>> 1)) ^ // ROTR 1 - ((hi << 24) | (lo >>> 8)) ^ // ROTR 8 - ((hi << 25) | (lo >>> 7))) >>> 0; // SHR 7 - - // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^64 (carry lo overflow) - w7 = w[i - 7]; - w16 = w[i - 16]; - lo = (t1_lo + w7[1] + t2_lo + w16[1]); - w[i][0] = (t1_hi + w7[0] + t2_hi + w16[0] + - ((lo / 0x100000000) >>> 0)) >>> 0; - w[i][1] = lo >>> 0; - } - - // initialize hash value for this chunk - a_hi = s[0][0]; - a_lo = s[0][1]; - b_hi = s[1][0]; - b_lo = s[1][1]; - c_hi = s[2][0]; - c_lo = s[2][1]; - d_hi = s[3][0]; - d_lo = s[3][1]; - e_hi = s[4][0]; - e_lo = s[4][1]; - f_hi = s[5][0]; - f_lo = s[5][1]; - g_hi = s[6][0]; - g_lo = s[6][1]; - h_hi = s[7][0]; - h_lo = s[7][1]; - - // round function - for(i = 0; i < 80; ++i) { - // Sum1(e) = ROTR 14(e) ^ ROTR 18(e) ^ ROTR 41(e) - s1_hi = ( - ((e_hi >>> 14) | (e_lo << 18)) ^ // ROTR 14 - ((e_hi >>> 18) | (e_lo << 14)) ^ // ROTR 18 - ((e_lo >>> 9) | (e_hi << 23))) >>> 0; // ROTR 41/(swap + ROTR 9) - s1_lo = ( - ((e_hi << 18) | (e_lo >>> 14)) ^ // ROTR 14 - ((e_hi << 14) | (e_lo >>> 18)) ^ // ROTR 18 - ((e_lo << 23) | (e_hi >>> 9))) >>> 0; // ROTR 41/(swap + ROTR 9) - - // Ch(e, f, g) (optimized the same way as SHA-1) - ch_hi = (g_hi ^ (e_hi & (f_hi ^ g_hi))) >>> 0; - ch_lo = (g_lo ^ (e_lo & (f_lo ^ g_lo))) >>> 0; - - // Sum0(a) = ROTR 28(a) ^ ROTR 34(a) ^ ROTR 39(a) - s0_hi = ( - ((a_hi >>> 28) | (a_lo << 4)) ^ // ROTR 28 - ((a_lo >>> 2) | (a_hi << 30)) ^ // ROTR 34/(swap + ROTR 2) - ((a_lo >>> 7) | (a_hi << 25))) >>> 0; // ROTR 39/(swap + ROTR 7) - s0_lo = ( - ((a_hi << 4) | (a_lo >>> 28)) ^ // ROTR 28 - ((a_lo << 30) | (a_hi >>> 2)) ^ // ROTR 34/(swap + ROTR 2) - ((a_lo << 25) | (a_hi >>> 7))) >>> 0; // ROTR 39/(swap + ROTR 7) - - // Maj(a, b, c) (optimized the same way as SHA-1) - maj_hi = ((a_hi & b_hi) | (c_hi & (a_hi ^ b_hi))) >>> 0; - maj_lo = ((a_lo & b_lo) | (c_lo & (a_lo ^ b_lo))) >>> 0; - - // main algorithm - // t1 = (h + s1 + ch + _k[i] + _w[i]) modulo 2^64 (carry lo overflow) - lo = (h_lo + s1_lo + ch_lo + _k[i][1] + w[i][1]); - t1_hi = (h_hi + s1_hi + ch_hi + _k[i][0] + w[i][0] + - ((lo / 0x100000000) >>> 0)) >>> 0; - t1_lo = lo >>> 0; - - // t2 = s0 + maj modulo 2^64 (carry lo overflow) - lo = s0_lo + maj_lo; - t2_hi = (s0_hi + maj_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - t2_lo = lo >>> 0; - - h_hi = g_hi; - h_lo = g_lo; - - g_hi = f_hi; - g_lo = f_lo; - - f_hi = e_hi; - f_lo = e_lo; - - // e = (d + t1) modulo 2^64 (carry lo overflow) - lo = d_lo + t1_lo; - e_hi = (d_hi + t1_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - e_lo = lo >>> 0; - - d_hi = c_hi; - d_lo = c_lo; - - c_hi = b_hi; - c_lo = b_lo; - - b_hi = a_hi; - b_lo = a_lo; - - // a = (t1 + t2) modulo 2^64 (carry lo overflow) - lo = t1_lo + t2_lo; - a_hi = (t1_hi + t2_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - a_lo = lo >>> 0; - } - - // update hash state (additional modulo 2^64) - lo = s[0][1] + a_lo; - s[0][0] = (s[0][0] + a_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[0][1] = lo >>> 0; - - lo = s[1][1] + b_lo; - s[1][0] = (s[1][0] + b_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[1][1] = lo >>> 0; - - lo = s[2][1] + c_lo; - s[2][0] = (s[2][0] + c_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[2][1] = lo >>> 0; - - lo = s[3][1] + d_lo; - s[3][0] = (s[3][0] + d_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[3][1] = lo >>> 0; - - lo = s[4][1] + e_lo; - s[4][0] = (s[4][0] + e_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[4][1] = lo >>> 0; - - lo = s[5][1] + f_lo; - s[5][0] = (s[5][0] + f_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[5][1] = lo >>> 0; - - lo = s[6][1] + g_lo; - s[6][0] = (s[6][0] + g_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[6][1] = lo >>> 0; - - lo = s[7][1] + h_lo; - s[7][0] = (s[7][0] + h_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[7][1] = lo >>> 0; - - len -= 128; - } -} diff --git a/node_modules/node-forge/lib/socket.js b/node_modules/node-forge/lib/socket.js deleted file mode 100644 index 3a1d7ff2..00000000 --- a/node_modules/node-forge/lib/socket.js +++ /dev/null @@ -1,287 +0,0 @@ -/** - * Socket implementation that uses flash SocketPool class as a backend. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -// define net namespace -var net = module.exports = forge.net = forge.net || {}; - -// map of flash ID to socket pool -net.socketPools = {}; - -/** - * Creates a flash socket pool. - * - * @param options: - * flashId: the dom ID for the flash object element. - * policyPort: the default policy port for sockets, 0 to use the - * flash default. - * policyUrl: the default policy file URL for sockets (if provided - * used instead of a policy port). - * msie: true if the browser is msie, false if not. - * - * @return the created socket pool. - */ -net.createSocketPool = function(options) { - // set default - options.msie = options.msie || false; - - // initialize the flash interface - var spId = options.flashId; - var api = document.getElementById(spId); - api.init({marshallExceptions: !options.msie}); - - // create socket pool entry - var sp = { - // ID of the socket pool - id: spId, - // flash interface - flashApi: api, - // map of socket ID to sockets - sockets: {}, - // default policy port - policyPort: options.policyPort || 0, - // default policy URL - policyUrl: options.policyUrl || null - }; - net.socketPools[spId] = sp; - - // create event handler, subscribe to flash events - if(options.msie === true) { - sp.handler = function(e) { - if(e.id in sp.sockets) { - // get handler function - var f; - switch(e.type) { - case 'connect': - f = 'connected'; - break; - case 'close': - f = 'closed'; - break; - case 'socketData': - f = 'data'; - break; - default: - f = 'error'; - break; - } - /* IE calls javascript on the thread of the external object - that triggered the event (in this case flash) ... which will - either run concurrently with other javascript or pre-empt any - running javascript in the middle of its execution (BAD!) ... - calling setTimeout() will schedule the javascript to run on - the javascript thread and solve this EVIL problem. */ - setTimeout(function() {sp.sockets[e.id][f](e);}, 0); - } - }; - } else { - sp.handler = function(e) { - if(e.id in sp.sockets) { - // get handler function - var f; - switch(e.type) { - case 'connect': - f = 'connected'; - break; - case 'close': - f = 'closed'; - break; - case 'socketData': - f = 'data'; - break; - default: - f = 'error'; - break; - } - sp.sockets[e.id][f](e); - } - }; - } - var handler = 'forge.net.socketPools[\'' + spId + '\'].handler'; - api.subscribe('connect', handler); - api.subscribe('close', handler); - api.subscribe('socketData', handler); - api.subscribe('ioError', handler); - api.subscribe('securityError', handler); - - /** - * Destroys a socket pool. The socket pool still needs to be cleaned - * up via net.cleanup(). - */ - sp.destroy = function() { - delete net.socketPools[options.flashId]; - for(var id in sp.sockets) { - sp.sockets[id].destroy(); - } - sp.sockets = {}; - api.cleanup(); - }; - - /** - * Creates a new socket. - * - * @param options: - * connected: function(event) called when the socket connects. - * closed: function(event) called when the socket closes. - * data: function(event) called when socket data has arrived, - * it can be read from the socket using receive(). - * error: function(event) called when a socket error occurs. - */ - sp.createSocket = function(options) { - // default to empty options - options = options || {}; - - // create flash socket - var id = api.create(); - - // create javascript socket wrapper - var socket = { - id: id, - // set handlers - connected: options.connected || function(e) {}, - closed: options.closed || function(e) {}, - data: options.data || function(e) {}, - error: options.error || function(e) {} - }; - - /** - * Destroys this socket. - */ - socket.destroy = function() { - api.destroy(id); - delete sp.sockets[id]; - }; - - /** - * Connects this socket. - * - * @param options: - * host: the host to connect to. - * port: the port to connect to. - * policyPort: the policy port to use (if non-default), 0 to - * use the flash default. - * policyUrl: the policy file URL to use (instead of port). - */ - socket.connect = function(options) { - // give precedence to policy URL over policy port - // if no policy URL and passed port isn't 0, use default port, - // otherwise use 0 for the port - var policyUrl = options.policyUrl || null; - var policyPort = 0; - if(policyUrl === null && options.policyPort !== 0) { - policyPort = options.policyPort || sp.policyPort; - } - api.connect(id, options.host, options.port, policyPort, policyUrl); - }; - - /** - * Closes this socket. - */ - socket.close = function() { - api.close(id); - socket.closed({ - id: socket.id, - type: 'close', - bytesAvailable: 0 - }); - }; - - /** - * Determines if the socket is connected or not. - * - * @return true if connected, false if not. - */ - socket.isConnected = function() { - return api.isConnected(id); - }; - - /** - * Writes bytes to this socket. - * - * @param bytes the bytes (as a string) to write. - * - * @return true on success, false on failure. - */ - socket.send = function(bytes) { - return api.send(id, forge.util.encode64(bytes)); - }; - - /** - * Reads bytes from this socket (non-blocking). Fewer than the number - * of bytes requested may be read if enough bytes are not available. - * - * This method should be called from the data handler if there are - * enough bytes available. To see how many bytes are available, check - * the 'bytesAvailable' property on the event in the data handler or - * call the bytesAvailable() function on the socket. If the browser is - * msie, then the bytesAvailable() function should be used to avoid - * race conditions. Otherwise, using the property on the data handler's - * event may be quicker. - * - * @param count the maximum number of bytes to read. - * - * @return the bytes read (as a string) or null on error. - */ - socket.receive = function(count) { - var rval = api.receive(id, count).rval; - return (rval === null) ? null : forge.util.decode64(rval); - }; - - /** - * Gets the number of bytes available for receiving on the socket. - * - * @return the number of bytes available for receiving. - */ - socket.bytesAvailable = function() { - return api.getBytesAvailable(id); - }; - - // store and return socket - sp.sockets[id] = socket; - return socket; - }; - - return sp; -}; - -/** - * Destroys a flash socket pool. - * - * @param options: - * flashId: the dom ID for the flash object element. - */ -net.destroySocketPool = function(options) { - if(options.flashId in net.socketPools) { - var sp = net.socketPools[options.flashId]; - sp.destroy(); - } -}; - -/** - * Creates a new socket. - * - * @param options: - * flashId: the dom ID for the flash object element. - * connected: function(event) called when the socket connects. - * closed: function(event) called when the socket closes. - * data: function(event) called when socket data has arrived, it - * can be read from the socket using receive(). - * error: function(event) called when a socket error occurs. - * - * @return the created socket. - */ -net.createSocket = function(options) { - var socket = null; - if(options.flashId in net.socketPools) { - // get related socket pool - var sp = net.socketPools[options.flashId]; - socket = sp.createSocket(options); - } - return socket; -}; diff --git a/node_modules/node-forge/lib/ssh.js b/node_modules/node-forge/lib/ssh.js deleted file mode 100644 index 6480203a..00000000 --- a/node_modules/node-forge/lib/ssh.js +++ /dev/null @@ -1,236 +0,0 @@ -/** - * Functions to output keys in SSH-friendly formats. - * - * This is part of the Forge project which may be used under the terms of - * either the BSD License or the GNU General Public License (GPL) Version 2. - * - * See: https://github.com/digitalbazaar/forge/blob/cbebca3780658703d925b61b2caffb1d263a6c1d/LICENSE - * - * @author https://github.com/shellac - */ -var forge = require('./forge'); -require('./aes'); -require('./hmac'); -require('./md5'); -require('./sha1'); -require('./util'); - -var ssh = module.exports = forge.ssh = forge.ssh || {}; - -/** - * Encodes (and optionally encrypts) a private RSA key as a Putty PPK file. - * - * @param privateKey the key. - * @param passphrase a passphrase to protect the key (falsy for no encryption). - * @param comment a comment to include in the key file. - * - * @return the PPK file as a string. - */ -ssh.privateKeyToPutty = function(privateKey, passphrase, comment) { - comment = comment || ''; - passphrase = passphrase || ''; - var algorithm = 'ssh-rsa'; - var encryptionAlgorithm = (passphrase === '') ? 'none' : 'aes256-cbc'; - - var ppk = 'PuTTY-User-Key-File-2: ' + algorithm + '\r\n'; - ppk += 'Encryption: ' + encryptionAlgorithm + '\r\n'; - ppk += 'Comment: ' + comment + '\r\n'; - - // public key into buffer for ppk - var pubbuffer = forge.util.createBuffer(); - _addStringToBuffer(pubbuffer, algorithm); - _addBigIntegerToBuffer(pubbuffer, privateKey.e); - _addBigIntegerToBuffer(pubbuffer, privateKey.n); - - // write public key - var pub = forge.util.encode64(pubbuffer.bytes(), 64); - var length = Math.floor(pub.length / 66) + 1; // 66 = 64 + \r\n - ppk += 'Public-Lines: ' + length + '\r\n'; - ppk += pub; - - // private key into a buffer - var privbuffer = forge.util.createBuffer(); - _addBigIntegerToBuffer(privbuffer, privateKey.d); - _addBigIntegerToBuffer(privbuffer, privateKey.p); - _addBigIntegerToBuffer(privbuffer, privateKey.q); - _addBigIntegerToBuffer(privbuffer, privateKey.qInv); - - // optionally encrypt the private key - var priv; - if(!passphrase) { - // use the unencrypted buffer - priv = forge.util.encode64(privbuffer.bytes(), 64); - } else { - // encrypt RSA key using passphrase - var encLen = privbuffer.length() + 16 - 1; - encLen -= encLen % 16; - - // pad private key with sha1-d data -- needs to be a multiple of 16 - var padding = _sha1(privbuffer.bytes()); - - padding.truncate(padding.length() - encLen + privbuffer.length()); - privbuffer.putBuffer(padding); - - var aeskey = forge.util.createBuffer(); - aeskey.putBuffer(_sha1('\x00\x00\x00\x00', passphrase)); - aeskey.putBuffer(_sha1('\x00\x00\x00\x01', passphrase)); - - // encrypt some bytes using CBC mode - // key is 40 bytes, so truncate *by* 8 bytes - var cipher = forge.aes.createEncryptionCipher(aeskey.truncate(8), 'CBC'); - cipher.start(forge.util.createBuffer().fillWithByte(0, 16)); - cipher.update(privbuffer.copy()); - cipher.finish(); - var encrypted = cipher.output; - - // Note: this appears to differ from Putty -- is forge wrong, or putty? - // due to padding we finish as an exact multiple of 16 - encrypted.truncate(16); // all padding - - priv = forge.util.encode64(encrypted.bytes(), 64); - } - - // output private key - length = Math.floor(priv.length / 66) + 1; // 64 + \r\n - ppk += '\r\nPrivate-Lines: ' + length + '\r\n'; - ppk += priv; - - // MAC - var mackey = _sha1('putty-private-key-file-mac-key', passphrase); - - var macbuffer = forge.util.createBuffer(); - _addStringToBuffer(macbuffer, algorithm); - _addStringToBuffer(macbuffer, encryptionAlgorithm); - _addStringToBuffer(macbuffer, comment); - macbuffer.putInt32(pubbuffer.length()); - macbuffer.putBuffer(pubbuffer); - macbuffer.putInt32(privbuffer.length()); - macbuffer.putBuffer(privbuffer); - - var hmac = forge.hmac.create(); - hmac.start('sha1', mackey); - hmac.update(macbuffer.bytes()); - - ppk += '\r\nPrivate-MAC: ' + hmac.digest().toHex() + '\r\n'; - - return ppk; -}; - -/** - * Encodes a public RSA key as an OpenSSH file. - * - * @param key the key. - * @param comment a comment. - * - * @return the public key in OpenSSH format. - */ -ssh.publicKeyToOpenSSH = function(key, comment) { - var type = 'ssh-rsa'; - comment = comment || ''; - - var buffer = forge.util.createBuffer(); - _addStringToBuffer(buffer, type); - _addBigIntegerToBuffer(buffer, key.e); - _addBigIntegerToBuffer(buffer, key.n); - - return type + ' ' + forge.util.encode64(buffer.bytes()) + ' ' + comment; -}; - -/** - * Encodes a private RSA key as an OpenSSH file. - * - * @param key the key. - * @param passphrase a passphrase to protect the key (falsy for no encryption). - * - * @return the public key in OpenSSH format. - */ -ssh.privateKeyToOpenSSH = function(privateKey, passphrase) { - if(!passphrase) { - return forge.pki.privateKeyToPem(privateKey); - } - // OpenSSH private key is just a legacy format, it seems - return forge.pki.encryptRsaPrivateKey(privateKey, passphrase, - {legacy: true, algorithm: 'aes128'}); -}; - -/** - * Gets the SSH fingerprint for the given public key. - * - * @param options the options to use. - * [md] the message digest object to use (defaults to forge.md.md5). - * [encoding] an alternative output encoding, such as 'hex' - * (defaults to none, outputs a byte buffer). - * [delimiter] the delimiter to use between bytes for 'hex' encoded - * output, eg: ':' (defaults to none). - * - * @return the fingerprint as a byte buffer or other encoding based on options. - */ -ssh.getPublicKeyFingerprint = function(key, options) { - options = options || {}; - var md = options.md || forge.md.md5.create(); - - var type = 'ssh-rsa'; - var buffer = forge.util.createBuffer(); - _addStringToBuffer(buffer, type); - _addBigIntegerToBuffer(buffer, key.e); - _addBigIntegerToBuffer(buffer, key.n); - - // hash public key bytes - md.start(); - md.update(buffer.getBytes()); - var digest = md.digest(); - if(options.encoding === 'hex') { - var hex = digest.toHex(); - if(options.delimiter) { - return hex.match(/.{2}/g).join(options.delimiter); - } - return hex; - } else if(options.encoding === 'binary') { - return digest.getBytes(); - } else if(options.encoding) { - throw new Error('Unknown encoding "' + options.encoding + '".'); - } - return digest; -}; - -/** - * Adds len(val) then val to a buffer. - * - * @param buffer the buffer to add to. - * @param val a big integer. - */ -function _addBigIntegerToBuffer(buffer, val) { - var hexVal = val.toString(16); - // ensure 2s complement +ve - if(hexVal[0] >= '8') { - hexVal = '00' + hexVal; - } - var bytes = forge.util.hexToBytes(hexVal); - buffer.putInt32(bytes.length); - buffer.putBytes(bytes); -} - -/** - * Adds len(val) then val to a buffer. - * - * @param buffer the buffer to add to. - * @param val a string. - */ -function _addStringToBuffer(buffer, val) { - buffer.putInt32(val.length); - buffer.putString(val); -} - -/** - * Hashes the arguments into one value using SHA-1. - * - * @return the sha1 hash of the provided arguments. - */ -function _sha1() { - var sha = forge.md.sha1.create(); - var num = arguments.length; - for (var i = 0; i < num; ++i) { - sha.update(arguments[i]); - } - return sha.digest(); -} diff --git a/node_modules/node-forge/lib/task.js b/node_modules/node-forge/lib/task.js deleted file mode 100644 index df486600..00000000 --- a/node_modules/node-forge/lib/task.js +++ /dev/null @@ -1,725 +0,0 @@ -/** - * Support for concurrent task management and synchronization in web - * applications. - * - * @author Dave Longley - * @author David I. Lehn - * - * Copyright (c) 2009-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./debug'); -require('./log'); -require('./util'); - -// logging category -var cat = 'forge.task'; - -// verbose level -// 0: off, 1: a little, 2: a whole lot -// Verbose debug logging is surrounded by a level check to avoid the -// performance issues with even calling the logging code regardless if it -// is actually logged. For performance reasons this should not be set to 2 -// for production use. -// ex: if(sVL >= 2) forge.log.verbose(....) -var sVL = 0; - -// track tasks for debugging -var sTasks = {}; -var sNextTaskId = 0; -// debug access -forge.debug.set(cat, 'tasks', sTasks); - -// a map of task type to task queue -var sTaskQueues = {}; -// debug access -forge.debug.set(cat, 'queues', sTaskQueues); - -// name for unnamed tasks -var sNoTaskName = '?'; - -// maximum number of doNext() recursions before a context swap occurs -// FIXME: might need to tweak this based on the browser -var sMaxRecursions = 30; - -// time slice for doing tasks before a context swap occurs -// FIXME: might need to tweak this based on the browser -var sTimeSlice = 20; - -/** - * Task states. - * - * READY: ready to start processing - * RUNNING: task or a subtask is running - * BLOCKED: task is waiting to acquire N permits to continue - * SLEEPING: task is sleeping for a period of time - * DONE: task is done - * ERROR: task has an error - */ -var READY = 'ready'; -var RUNNING = 'running'; -var BLOCKED = 'blocked'; -var SLEEPING = 'sleeping'; -var DONE = 'done'; -var ERROR = 'error'; - -/** - * Task actions. Used to control state transitions. - * - * STOP: stop processing - * START: start processing tasks - * BLOCK: block task from continuing until 1 or more permits are released - * UNBLOCK: release one or more permits - * SLEEP: sleep for a period of time - * WAKEUP: wakeup early from SLEEPING state - * CANCEL: cancel further tasks - * FAIL: a failure occured - */ -var STOP = 'stop'; -var START = 'start'; -var BLOCK = 'block'; -var UNBLOCK = 'unblock'; -var SLEEP = 'sleep'; -var WAKEUP = 'wakeup'; -var CANCEL = 'cancel'; -var FAIL = 'fail'; - -/** - * State transition table. - * - * nextState = sStateTable[currentState][action] - */ -var sStateTable = {}; - -sStateTable[READY] = {}; -sStateTable[READY][STOP] = READY; -sStateTable[READY][START] = RUNNING; -sStateTable[READY][CANCEL] = DONE; -sStateTable[READY][FAIL] = ERROR; - -sStateTable[RUNNING] = {}; -sStateTable[RUNNING][STOP] = READY; -sStateTable[RUNNING][START] = RUNNING; -sStateTable[RUNNING][BLOCK] = BLOCKED; -sStateTable[RUNNING][UNBLOCK] = RUNNING; -sStateTable[RUNNING][SLEEP] = SLEEPING; -sStateTable[RUNNING][WAKEUP] = RUNNING; -sStateTable[RUNNING][CANCEL] = DONE; -sStateTable[RUNNING][FAIL] = ERROR; - -sStateTable[BLOCKED] = {}; -sStateTable[BLOCKED][STOP] = BLOCKED; -sStateTable[BLOCKED][START] = BLOCKED; -sStateTable[BLOCKED][BLOCK] = BLOCKED; -sStateTable[BLOCKED][UNBLOCK] = BLOCKED; -sStateTable[BLOCKED][SLEEP] = BLOCKED; -sStateTable[BLOCKED][WAKEUP] = BLOCKED; -sStateTable[BLOCKED][CANCEL] = DONE; -sStateTable[BLOCKED][FAIL] = ERROR; - -sStateTable[SLEEPING] = {}; -sStateTable[SLEEPING][STOP] = SLEEPING; -sStateTable[SLEEPING][START] = SLEEPING; -sStateTable[SLEEPING][BLOCK] = SLEEPING; -sStateTable[SLEEPING][UNBLOCK] = SLEEPING; -sStateTable[SLEEPING][SLEEP] = SLEEPING; -sStateTable[SLEEPING][WAKEUP] = SLEEPING; -sStateTable[SLEEPING][CANCEL] = DONE; -sStateTable[SLEEPING][FAIL] = ERROR; - -sStateTable[DONE] = {}; -sStateTable[DONE][STOP] = DONE; -sStateTable[DONE][START] = DONE; -sStateTable[DONE][BLOCK] = DONE; -sStateTable[DONE][UNBLOCK] = DONE; -sStateTable[DONE][SLEEP] = DONE; -sStateTable[DONE][WAKEUP] = DONE; -sStateTable[DONE][CANCEL] = DONE; -sStateTable[DONE][FAIL] = ERROR; - -sStateTable[ERROR] = {}; -sStateTable[ERROR][STOP] = ERROR; -sStateTable[ERROR][START] = ERROR; -sStateTable[ERROR][BLOCK] = ERROR; -sStateTable[ERROR][UNBLOCK] = ERROR; -sStateTable[ERROR][SLEEP] = ERROR; -sStateTable[ERROR][WAKEUP] = ERROR; -sStateTable[ERROR][CANCEL] = ERROR; -sStateTable[ERROR][FAIL] = ERROR; - -/** - * Creates a new task. - * - * @param options options for this task - * run: the run function for the task (required) - * name: the run function for the task (optional) - * parent: parent of this task (optional) - * - * @return the empty task. - */ -var Task = function(options) { - // task id - this.id = -1; - - // task name - this.name = options.name || sNoTaskName; - - // task has no parent - this.parent = options.parent || null; - - // save run function - this.run = options.run; - - // create a queue of subtasks to run - this.subtasks = []; - - // error flag - this.error = false; - - // state of the task - this.state = READY; - - // number of times the task has been blocked (also the number - // of permits needed to be released to continue running) - this.blocks = 0; - - // timeout id when sleeping - this.timeoutId = null; - - // no swap time yet - this.swapTime = null; - - // no user data - this.userData = null; - - // initialize task - // FIXME: deal with overflow - this.id = sNextTaskId++; - sTasks[this.id] = this; - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] init', this.id, this.name, this); - } -}; - -/** - * Logs debug information on this task and the system state. - */ -Task.prototype.debug = function(msg) { - msg = msg || ''; - forge.log.debug(cat, msg, - '[%s][%s] task:', this.id, this.name, this, - 'subtasks:', this.subtasks.length, - 'queue:', sTaskQueues); -}; - -/** - * Adds a subtask to run after task.doNext() or task.fail() is called. - * - * @param name human readable name for this task (optional). - * @param subrun a function to run that takes the current task as - * its first parameter. - * - * @return the current task (useful for chaining next() calls). - */ -Task.prototype.next = function(name, subrun) { - // juggle parameters if it looks like no name is given - if(typeof(name) === 'function') { - subrun = name; - - // inherit parent's name - name = this.name; - } - // create subtask, set parent to this task, propagate callbacks - var subtask = new Task({ - run: subrun, - name: name, - parent: this - }); - // start subtasks running - subtask.state = RUNNING; - subtask.type = this.type; - subtask.successCallback = this.successCallback || null; - subtask.failureCallback = this.failureCallback || null; - - // queue a new subtask - this.subtasks.push(subtask); - - return this; -}; - -/** - * Adds subtasks to run in parallel after task.doNext() or task.fail() - * is called. - * - * @param name human readable name for this task (optional). - * @param subrun functions to run that take the current task as - * their first parameter. - * - * @return the current task (useful for chaining next() calls). - */ -Task.prototype.parallel = function(name, subrun) { - // juggle parameters if it looks like no name is given - if(forge.util.isArray(name)) { - subrun = name; - - // inherit parent's name - name = this.name; - } - // Wrap parallel tasks in a regular task so they are started at the - // proper time. - return this.next(name, function(task) { - // block waiting for subtasks - var ptask = task; - ptask.block(subrun.length); - - // we pass the iterator from the loop below as a parameter - // to a function because it is otherwise included in the - // closure and changes as the loop changes -- causing i - // to always be set to its highest value - var startParallelTask = function(pname, pi) { - forge.task.start({ - type: pname, - run: function(task) { - subrun[pi](task); - }, - success: function(task) { - ptask.unblock(); - }, - failure: function(task) { - ptask.unblock(); - } - }); - }; - - for(var i = 0; i < subrun.length; i++) { - // Type must be unique so task starts in parallel: - // name + private string + task id + sub-task index - // start tasks in parallel and unblock when the finish - var pname = name + '__parallel-' + task.id + '-' + i; - var pi = i; - startParallelTask(pname, pi); - } - }); -}; - -/** - * Stops a running task. - */ -Task.prototype.stop = function() { - this.state = sStateTable[this.state][STOP]; -}; - -/** - * Starts running a task. - */ -Task.prototype.start = function() { - this.error = false; - this.state = sStateTable[this.state][START]; - - // try to restart - if(this.state === RUNNING) { - this.start = new Date(); - this.run(this); - runNext(this, 0); - } -}; - -/** - * Blocks a task until it one or more permits have been released. The - * task will not resume until the requested number of permits have - * been released with call(s) to unblock(). - * - * @param n number of permits to wait for(default: 1). - */ -Task.prototype.block = function(n) { - n = typeof(n) === 'undefined' ? 1 : n; - this.blocks += n; - if(this.blocks > 0) { - this.state = sStateTable[this.state][BLOCK]; - } -}; - -/** - * Releases a permit to unblock a task. If a task was blocked by - * requesting N permits via block(), then it will only continue - * running once enough permits have been released via unblock() calls. - * - * If multiple processes need to synchronize with a single task then - * use a condition variable (see forge.task.createCondition). It is - * an error to unblock a task more times than it has been blocked. - * - * @param n number of permits to release (default: 1). - * - * @return the current block count (task is unblocked when count is 0) - */ -Task.prototype.unblock = function(n) { - n = typeof(n) === 'undefined' ? 1 : n; - this.blocks -= n; - if(this.blocks === 0 && this.state !== DONE) { - this.state = RUNNING; - runNext(this, 0); - } - return this.blocks; -}; - -/** - * Sleep for a period of time before resuming tasks. - * - * @param n number of milliseconds to sleep (default: 0). - */ -Task.prototype.sleep = function(n) { - n = typeof(n) === 'undefined' ? 0 : n; - this.state = sStateTable[this.state][SLEEP]; - var self = this; - this.timeoutId = setTimeout(function() { - self.timeoutId = null; - self.state = RUNNING; - runNext(self, 0); - }, n); -}; - -/** - * Waits on a condition variable until notified. The next task will - * not be scheduled until notification. A condition variable can be - * created with forge.task.createCondition(). - * - * Once cond.notify() is called, the task will continue. - * - * @param cond the condition variable to wait on. - */ -Task.prototype.wait = function(cond) { - cond.wait(this); -}; - -/** - * If sleeping, wakeup and continue running tasks. - */ -Task.prototype.wakeup = function() { - if(this.state === SLEEPING) { - cancelTimeout(this.timeoutId); - this.timeoutId = null; - this.state = RUNNING; - runNext(this, 0); - } -}; - -/** - * Cancel all remaining subtasks of this task. - */ -Task.prototype.cancel = function() { - this.state = sStateTable[this.state][CANCEL]; - // remove permits needed - this.permitsNeeded = 0; - // cancel timeouts - if(this.timeoutId !== null) { - cancelTimeout(this.timeoutId); - this.timeoutId = null; - } - // remove subtasks - this.subtasks = []; -}; - -/** - * Finishes this task with failure and sets error flag. The entire - * task will be aborted unless the next task that should execute - * is passed as a parameter. This allows levels of subtasks to be - * skipped. For instance, to abort only this tasks's subtasks, then - * call fail(task.parent). To abort this task's subtasks and its - * parent's subtasks, call fail(task.parent.parent). To abort - * all tasks and simply call the task callback, call fail() or - * fail(null). - * - * The task callback (success or failure) will always, eventually, be - * called. - * - * @param next the task to continue at, or null to abort entirely. - */ -Task.prototype.fail = function(next) { - // set error flag - this.error = true; - - // finish task - finish(this, true); - - if(next) { - // propagate task info - next.error = this.error; - next.swapTime = this.swapTime; - next.userData = this.userData; - - // do next task as specified - runNext(next, 0); - } else { - if(this.parent !== null) { - // finish root task (ensures it is removed from task queue) - var parent = this.parent; - while(parent.parent !== null) { - // propagate task info - parent.error = this.error; - parent.swapTime = this.swapTime; - parent.userData = this.userData; - parent = parent.parent; - } - finish(parent, true); - } - - // call failure callback if one exists - if(this.failureCallback) { - this.failureCallback(this); - } - } -}; - -/** - * Asynchronously start a task. - * - * @param task the task to start. - */ -var start = function(task) { - task.error = false; - task.state = sStateTable[task.state][START]; - setTimeout(function() { - if(task.state === RUNNING) { - task.swapTime = +new Date(); - task.run(task); - runNext(task, 0); - } - }, 0); -}; - -/** - * Run the next subtask or finish this task. - * - * @param task the task to process. - * @param recurse the recursion count. - */ -var runNext = function(task, recurse) { - // get time since last context swap (ms), if enough time has passed set - // swap to true to indicate that doNext was performed asynchronously - // also, if recurse is too high do asynchronously - var swap = - (recurse > sMaxRecursions) || - (+new Date() - task.swapTime) > sTimeSlice; - - var doNext = function(recurse) { - recurse++; - if(task.state === RUNNING) { - if(swap) { - // update swap time - task.swapTime = +new Date(); - } - - if(task.subtasks.length > 0) { - // run next subtask - var subtask = task.subtasks.shift(); - subtask.error = task.error; - subtask.swapTime = task.swapTime; - subtask.userData = task.userData; - subtask.run(subtask); - if(!subtask.error) { - runNext(subtask, recurse); - } - } else { - finish(task); - - if(!task.error) { - // chain back up and run parent - if(task.parent !== null) { - // propagate task info - task.parent.error = task.error; - task.parent.swapTime = task.swapTime; - task.parent.userData = task.userData; - - // no subtasks left, call run next subtask on parent - runNext(task.parent, recurse); - } - } - } - } - }; - - if(swap) { - // we're swapping, so run asynchronously - setTimeout(doNext, 0); - } else { - // not swapping, so run synchronously - doNext(recurse); - } -}; - -/** - * Finishes a task and looks for the next task in the queue to start. - * - * @param task the task to finish. - * @param suppressCallbacks true to suppress callbacks. - */ -var finish = function(task, suppressCallbacks) { - // subtask is now done - task.state = DONE; - - delete sTasks[task.id]; - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] finish', - task.id, task.name, task); - } - - // only do queue processing for root tasks - if(task.parent === null) { - // report error if queue is missing - if(!(task.type in sTaskQueues)) { - forge.log.error(cat, - '[%s][%s] task queue missing [%s]', - task.id, task.name, task.type); - } else if(sTaskQueues[task.type].length === 0) { - // report error if queue is empty - forge.log.error(cat, - '[%s][%s] task queue empty [%s]', - task.id, task.name, task.type); - } else if(sTaskQueues[task.type][0] !== task) { - // report error if this task isn't the first in the queue - forge.log.error(cat, - '[%s][%s] task not first in queue [%s]', - task.id, task.name, task.type); - } else { - // remove ourselves from the queue - sTaskQueues[task.type].shift(); - // clean up queue if it is empty - if(sTaskQueues[task.type].length === 0) { - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] delete queue [%s]', - task.id, task.name, task.type); - } - /* Note: Only a task can delete a queue of its own type. This - is used as a way to synchronize tasks. If a queue for a certain - task type exists, then a task of that type is running. - */ - delete sTaskQueues[task.type]; - } else { - // dequeue the next task and start it - if(sVL >= 1) { - forge.log.verbose(cat, - '[%s][%s] queue start next [%s] remain:%s', - task.id, task.name, task.type, - sTaskQueues[task.type].length); - } - sTaskQueues[task.type][0].start(); - } - } - - if(!suppressCallbacks) { - // call final callback if one exists - if(task.error && task.failureCallback) { - task.failureCallback(task); - } else if(!task.error && task.successCallback) { - task.successCallback(task); - } - } - } -}; - -/* Tasks API */ -module.exports = forge.task = forge.task || {}; - -/** - * Starts a new task that will run the passed function asynchronously. - * - * In order to finish the task, either task.doNext() or task.fail() - * *must* be called. - * - * The task must have a type (a string identifier) that can be used to - * synchronize it with other tasks of the same type. That type can also - * be used to cancel tasks that haven't started yet. - * - * To start a task, the following object must be provided as a parameter - * (each function takes a task object as its first parameter): - * - * { - * type: the type of task. - * run: the function to run to execute the task. - * success: a callback to call when the task succeeds (optional). - * failure: a callback to call when the task fails (optional). - * } - * - * @param options the object as described above. - */ -forge.task.start = function(options) { - // create a new task - var task = new Task({ - run: options.run, - name: options.name || sNoTaskName - }); - task.type = options.type; - task.successCallback = options.success || null; - task.failureCallback = options.failure || null; - - // append the task onto the appropriate queue - if(!(task.type in sTaskQueues)) { - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] create queue [%s]', - task.id, task.name, task.type); - } - // create the queue with the new task - sTaskQueues[task.type] = [task]; - start(task); - } else { - // push the task onto the queue, it will be run after a task - // with the same type completes - sTaskQueues[options.type].push(task); - } -}; - -/** - * Cancels all tasks of the given type that haven't started yet. - * - * @param type the type of task to cancel. - */ -forge.task.cancel = function(type) { - // find the task queue - if(type in sTaskQueues) { - // empty all but the current task from the queue - sTaskQueues[type] = [sTaskQueues[type][0]]; - } -}; - -/** - * Creates a condition variable to synchronize tasks. To make a task wait - * on the condition variable, call task.wait(condition). To notify all - * tasks that are waiting, call condition.notify(). - * - * @return the condition variable. - */ -forge.task.createCondition = function() { - var cond = { - // all tasks that are blocked - tasks: {} - }; - - /** - * Causes the given task to block until notify is called. If the task - * is already waiting on this condition then this is a no-op. - * - * @param task the task to cause to wait. - */ - cond.wait = function(task) { - // only block once - if(!(task.id in cond.tasks)) { - task.block(); - cond.tasks[task.id] = task; - } - }; - - /** - * Notifies all waiting tasks to wake up. - */ - cond.notify = function() { - // since unblock() will run the next task from here, make sure to - // clear the condition's blocked task list before unblocking - var tmp = cond.tasks; - cond.tasks = {}; - for(var id in tmp) { - tmp[id].unblock(); - } - }; - - return cond; -}; diff --git a/node_modules/node-forge/lib/tls.js b/node_modules/node-forge/lib/tls.js deleted file mode 100644 index fadfd646..00000000 --- a/node_modules/node-forge/lib/tls.js +++ /dev/null @@ -1,4282 +0,0 @@ -/** - * A Javascript implementation of Transport Layer Security (TLS). - * - * @author Dave Longley - * - * Copyright (c) 2009-2014 Digital Bazaar, Inc. - * - * The TLS Handshake Protocol involves the following steps: - * - * - Exchange hello messages to agree on algorithms, exchange random values, - * and check for session resumption. - * - * - Exchange the necessary cryptographic parameters to allow the client and - * server to agree on a premaster secret. - * - * - Exchange certificates and cryptographic information to allow the client - * and server to authenticate themselves. - * - * - Generate a master secret from the premaster secret and exchanged random - * values. - * - * - Provide security parameters to the record layer. - * - * - Allow the client and server to verify that their peer has calculated the - * same security parameters and that the handshake occurred without tampering - * by an attacker. - * - * Up to 4 different messages may be sent during a key exchange. The server - * certificate, the server key exchange, the client certificate, and the - * client key exchange. - * - * A typical handshake (from the client's perspective). - * - * 1. Client sends ClientHello. - * 2. Client receives ServerHello. - * 3. Client receives optional Certificate. - * 4. Client receives optional ServerKeyExchange. - * 5. Client receives ServerHelloDone. - * 6. Client sends optional Certificate. - * 7. Client sends ClientKeyExchange. - * 8. Client sends optional CertificateVerify. - * 9. Client sends ChangeCipherSpec. - * 10. Client sends Finished. - * 11. Client receives ChangeCipherSpec. - * 12. Client receives Finished. - * 13. Client sends/receives application data. - * - * To reuse an existing session: - * - * 1. Client sends ClientHello with session ID for reuse. - * 2. Client receives ServerHello with same session ID if reusing. - * 3. Client receives ChangeCipherSpec message if reusing. - * 4. Client receives Finished. - * 5. Client sends ChangeCipherSpec. - * 6. Client sends Finished. - * - * Note: Client ignores HelloRequest if in the middle of a handshake. - * - * Record Layer: - * - * The record layer fragments information blocks into TLSPlaintext records - * carrying data in chunks of 2^14 bytes or less. Client message boundaries are - * not preserved in the record layer (i.e., multiple client messages of the - * same ContentType MAY be coalesced into a single TLSPlaintext record, or a - * single message MAY be fragmented across several records). - * - * struct { - * uint8 major; - * uint8 minor; - * } ProtocolVersion; - * - * struct { - * ContentType type; - * ProtocolVersion version; - * uint16 length; - * opaque fragment[TLSPlaintext.length]; - * } TLSPlaintext; - * - * type: - * The higher-level protocol used to process the enclosed fragment. - * - * version: - * The version of the protocol being employed. TLS Version 1.2 uses version - * {3, 3}. TLS Version 1.0 uses version {3, 1}. Note that a client that - * supports multiple versions of TLS may not know what version will be - * employed before it receives the ServerHello. - * - * length: - * The length (in bytes) of the following TLSPlaintext.fragment. The length - * MUST NOT exceed 2^14 = 16384 bytes. - * - * fragment: - * The application data. This data is transparent and treated as an - * independent block to be dealt with by the higher-level protocol specified - * by the type field. - * - * Implementations MUST NOT send zero-length fragments of Handshake, Alert, or - * ChangeCipherSpec content types. Zero-length fragments of Application data - * MAY be sent as they are potentially useful as a traffic analysis - * countermeasure. - * - * Note: Data of different TLS record layer content types MAY be interleaved. - * Application data is generally of lower precedence for transmission than - * other content types. However, records MUST be delivered to the network in - * the same order as they are protected by the record layer. Recipients MUST - * receive and process interleaved application layer traffic during handshakes - * subsequent to the first one on a connection. - * - * struct { - * ContentType type; // same as TLSPlaintext.type - * ProtocolVersion version;// same as TLSPlaintext.version - * uint16 length; - * opaque fragment[TLSCompressed.length]; - * } TLSCompressed; - * - * length: - * The length (in bytes) of the following TLSCompressed.fragment. - * The length MUST NOT exceed 2^14 + 1024. - * - * fragment: - * The compressed form of TLSPlaintext.fragment. - * - * Note: A CompressionMethod.null operation is an identity operation; no fields - * are altered. In this implementation, since no compression is supported, - * uncompressed records are always the same as compressed records. - * - * Encryption Information: - * - * The encryption and MAC functions translate a TLSCompressed structure into a - * TLSCiphertext. The decryption functions reverse the process. The MAC of the - * record also includes a sequence number so that missing, extra, or repeated - * messages are detectable. - * - * struct { - * ContentType type; - * ProtocolVersion version; - * uint16 length; - * select (SecurityParameters.cipher_type) { - * case stream: GenericStreamCipher; - * case block: GenericBlockCipher; - * case aead: GenericAEADCipher; - * } fragment; - * } TLSCiphertext; - * - * type: - * The type field is identical to TLSCompressed.type. - * - * version: - * The version field is identical to TLSCompressed.version. - * - * length: - * The length (in bytes) of the following TLSCiphertext.fragment. - * The length MUST NOT exceed 2^14 + 2048. - * - * fragment: - * The encrypted form of TLSCompressed.fragment, with the MAC. - * - * Note: Only CBC Block Ciphers are supported by this implementation. - * - * The TLSCompressed.fragment structures are converted to/from block - * TLSCiphertext.fragment structures. - * - * struct { - * opaque IV[SecurityParameters.record_iv_length]; - * block-ciphered struct { - * opaque content[TLSCompressed.length]; - * opaque MAC[SecurityParameters.mac_length]; - * uint8 padding[GenericBlockCipher.padding_length]; - * uint8 padding_length; - * }; - * } GenericBlockCipher; - * - * The MAC is generated as described in Section 6.2.3.1. - * - * IV: - * The Initialization Vector (IV) SHOULD be chosen at random, and MUST be - * unpredictable. Note that in versions of TLS prior to 1.1, there was no - * IV field, and the last ciphertext block of the previous record (the "CBC - * residue") was used as the IV. This was changed to prevent the attacks - * described in [CBCATT]. For block ciphers, the IV length is of length - * SecurityParameters.record_iv_length, which is equal to the - * SecurityParameters.block_size. - * - * padding: - * Padding that is added to force the length of the plaintext to be an - * integral multiple of the block cipher's block length. The padding MAY be - * any length up to 255 bytes, as long as it results in the - * TLSCiphertext.length being an integral multiple of the block length. - * Lengths longer than necessary might be desirable to frustrate attacks on - * a protocol that are based on analysis of the lengths of exchanged - * messages. Each uint8 in the padding data vector MUST be filled with the - * padding length value. The receiver MUST check this padding and MUST use - * the bad_record_mac alert to indicate padding errors. - * - * padding_length: - * The padding length MUST be such that the total size of the - * GenericBlockCipher structure is a multiple of the cipher's block length. - * Legal values range from zero to 255, inclusive. This length specifies the - * length of the padding field exclusive of the padding_length field itself. - * - * The encrypted data length (TLSCiphertext.length) is one more than the sum of - * SecurityParameters.block_length, TLSCompressed.length, - * SecurityParameters.mac_length, and padding_length. - * - * Example: If the block length is 8 bytes, the content length - * (TLSCompressed.length) is 61 bytes, and the MAC length is 20 bytes, then the - * length before padding is 82 bytes (this does not include the IV. Thus, the - * padding length modulo 8 must be equal to 6 in order to make the total length - * an even multiple of 8 bytes (the block length). The padding length can be - * 6, 14, 22, and so on, through 254. If the padding length were the minimum - * necessary, 6, the padding would be 6 bytes, each containing the value 6. - * Thus, the last 8 octets of the GenericBlockCipher before block encryption - * would be xx 06 06 06 06 06 06 06, where xx is the last octet of the MAC. - * - * Note: With block ciphers in CBC mode (Cipher Block Chaining), it is critical - * that the entire plaintext of the record be known before any ciphertext is - * transmitted. Otherwise, it is possible for the attacker to mount the attack - * described in [CBCATT]. - * - * Implementation note: Canvel et al. [CBCTIME] have demonstrated a timing - * attack on CBC padding based on the time required to compute the MAC. In - * order to defend against this attack, implementations MUST ensure that - * record processing time is essentially the same whether or not the padding - * is correct. In general, the best way to do this is to compute the MAC even - * if the padding is incorrect, and only then reject the packet. For instance, - * if the pad appears to be incorrect, the implementation might assume a - * zero-length pad and then compute the MAC. This leaves a small timing - * channel, since MAC performance depends, to some extent, on the size of the - * data fragment, but it is not believed to be large enough to be exploitable, - * due to the large block size of existing MACs and the small size of the - * timing signal. - */ -var forge = require('./forge'); -require('./asn1'); -require('./hmac'); -require('./md5'); -require('./pem'); -require('./pki'); -require('./random'); -require('./sha1'); -require('./util'); - -/** - * Generates pseudo random bytes by mixing the result of two hash functions, - * MD5 and SHA-1. - * - * prf_TLS1(secret, label, seed) = - * P_MD5(S1, label + seed) XOR P_SHA-1(S2, label + seed); - * - * Each P_hash function functions as follows: - * - * P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + - * HMAC_hash(secret, A(2) + seed) + - * HMAC_hash(secret, A(3) + seed) + ... - * A() is defined as: - * A(0) = seed - * A(i) = HMAC_hash(secret, A(i-1)) - * - * The '+' operator denotes concatenation. - * - * As many iterations A(N) as are needed are performed to generate enough - * pseudo random byte output. If an iteration creates more data than is - * necessary, then it is truncated. - * - * Therefore: - * A(1) = HMAC_hash(secret, A(0)) - * = HMAC_hash(secret, seed) - * A(2) = HMAC_hash(secret, A(1)) - * = HMAC_hash(secret, HMAC_hash(secret, seed)) - * - * Therefore: - * P_hash(secret, seed) = - * HMAC_hash(secret, HMAC_hash(secret, A(0)) + seed) + - * HMAC_hash(secret, HMAC_hash(secret, A(1)) + seed) + - * ... - * - * Therefore: - * P_hash(secret, seed) = - * HMAC_hash(secret, HMAC_hash(secret, seed) + seed) + - * HMAC_hash(secret, HMAC_hash(secret, HMAC_hash(secret, seed)) + seed) + - * ... - * - * @param secret the secret to use. - * @param label the label to use. - * @param seed the seed value to use. - * @param length the number of bytes to generate. - * - * @return the pseudo random bytes in a byte buffer. - */ -var prf_TLS1 = function(secret, label, seed, length) { - var rval = forge.util.createBuffer(); - - /* For TLS 1.0, the secret is split in half, into two secrets of equal - length. If the secret has an odd length then the last byte of the first - half will be the same as the first byte of the second. The length of the - two secrets is half of the secret rounded up. */ - var idx = (secret.length >> 1); - var slen = idx + (secret.length & 1); - var s1 = secret.substr(0, slen); - var s2 = secret.substr(idx, slen); - var ai = forge.util.createBuffer(); - var hmac = forge.hmac.create(); - seed = label + seed; - - // determine the number of iterations that must be performed to generate - // enough output bytes, md5 creates 16 byte hashes, sha1 creates 20 - var md5itr = Math.ceil(length / 16); - var sha1itr = Math.ceil(length / 20); - - // do md5 iterations - hmac.start('MD5', s1); - var md5bytes = forge.util.createBuffer(); - ai.putBytes(seed); - for(var i = 0; i < md5itr; ++i) { - // HMAC_hash(secret, A(i-1)) - hmac.start(null, null); - hmac.update(ai.getBytes()); - ai.putBuffer(hmac.digest()); - - // HMAC_hash(secret, A(i) + seed) - hmac.start(null, null); - hmac.update(ai.bytes() + seed); - md5bytes.putBuffer(hmac.digest()); - } - - // do sha1 iterations - hmac.start('SHA1', s2); - var sha1bytes = forge.util.createBuffer(); - ai.clear(); - ai.putBytes(seed); - for(var i = 0; i < sha1itr; ++i) { - // HMAC_hash(secret, A(i-1)) - hmac.start(null, null); - hmac.update(ai.getBytes()); - ai.putBuffer(hmac.digest()); - - // HMAC_hash(secret, A(i) + seed) - hmac.start(null, null); - hmac.update(ai.bytes() + seed); - sha1bytes.putBuffer(hmac.digest()); - } - - // XOR the md5 bytes with the sha1 bytes - rval.putBytes(forge.util.xorBytes( - md5bytes.getBytes(), sha1bytes.getBytes(), length)); - - return rval; -}; - -/** - * Generates pseudo random bytes using a SHA256 algorithm. For TLS 1.2. - * - * @param secret the secret to use. - * @param label the label to use. - * @param seed the seed value to use. - * @param length the number of bytes to generate. - * - * @return the pseudo random bytes in a byte buffer. - */ -var prf_sha256 = function(secret, label, seed, length) { - // FIXME: implement me for TLS 1.2 -}; - -/** - * Gets a MAC for a record using the SHA-1 hash algorithm. - * - * @param key the mac key. - * @param state the sequence number (array of two 32-bit integers). - * @param record the record. - * - * @return the sha-1 hash (20 bytes) for the given record. - */ -var hmac_sha1 = function(key, seqNum, record) { - /* MAC is computed like so: - HMAC_hash( - key, seqNum + - TLSCompressed.type + - TLSCompressed.version + - TLSCompressed.length + - TLSCompressed.fragment) - */ - var hmac = forge.hmac.create(); - hmac.start('SHA1', key); - var b = forge.util.createBuffer(); - b.putInt32(seqNum[0]); - b.putInt32(seqNum[1]); - b.putByte(record.type); - b.putByte(record.version.major); - b.putByte(record.version.minor); - b.putInt16(record.length); - b.putBytes(record.fragment.bytes()); - hmac.update(b.getBytes()); - return hmac.digest().getBytes(); -}; - -/** - * Compresses the TLSPlaintext record into a TLSCompressed record using the - * deflate algorithm. - * - * @param c the TLS connection. - * @param record the TLSPlaintext record to compress. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -var deflate = function(c, record, s) { - var rval = false; - - try { - var bytes = c.deflate(record.fragment.getBytes()); - record.fragment = forge.util.createBuffer(bytes); - record.length = bytes.length; - rval = true; - } catch(ex) { - // deflate error, fail out - } - - return rval; -}; - -/** - * Decompresses the TLSCompressed record into a TLSPlaintext record using the - * deflate algorithm. - * - * @param c the TLS connection. - * @param record the TLSCompressed record to decompress. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -var inflate = function(c, record, s) { - var rval = false; - - try { - var bytes = c.inflate(record.fragment.getBytes()); - record.fragment = forge.util.createBuffer(bytes); - record.length = bytes.length; - rval = true; - } catch(ex) { - // inflate error, fail out - } - - return rval; -}; - -/** - * Reads a TLS variable-length vector from a byte buffer. - * - * Variable-length vectors are defined by specifying a subrange of legal - * lengths, inclusively, using the notation . When these are - * encoded, the actual length precedes the vector's contents in the byte - * stream. The length will be in the form of a number consuming as many bytes - * as required to hold the vector's specified maximum (ceiling) length. A - * variable-length vector with an actual length field of zero is referred to - * as an empty vector. - * - * @param b the byte buffer. - * @param lenBytes the number of bytes required to store the length. - * - * @return the resulting byte buffer. - */ -var readVector = function(b, lenBytes) { - var len = 0; - switch(lenBytes) { - case 1: - len = b.getByte(); - break; - case 2: - len = b.getInt16(); - break; - case 3: - len = b.getInt24(); - break; - case 4: - len = b.getInt32(); - break; - } - - // read vector bytes into a new buffer - return forge.util.createBuffer(b.getBytes(len)); -}; - -/** - * Writes a TLS variable-length vector to a byte buffer. - * - * @param b the byte buffer. - * @param lenBytes the number of bytes required to store the length. - * @param v the byte buffer vector. - */ -var writeVector = function(b, lenBytes, v) { - // encode length at the start of the vector, where the number of bytes for - // the length is the maximum number of bytes it would take to encode the - // vector's ceiling - b.putInt(v.length(), lenBytes << 3); - b.putBuffer(v); -}; - -/** - * The tls implementation. - */ -var tls = {}; - -/** - * Version: TLS 1.2 = 3.3, TLS 1.1 = 3.2, TLS 1.0 = 3.1. Both TLS 1.1 and - * TLS 1.2 were still too new (ie: openSSL didn't implement them) at the time - * of this implementation so TLS 1.0 was implemented instead. - */ -tls.Versions = { - TLS_1_0: {major: 3, minor: 1}, - TLS_1_1: {major: 3, minor: 2}, - TLS_1_2: {major: 3, minor: 3} -}; -tls.SupportedVersions = [ - tls.Versions.TLS_1_1, - tls.Versions.TLS_1_0 -]; -tls.Version = tls.SupportedVersions[0]; - -/** - * Maximum fragment size. True maximum is 16384, but we fragment before that - * to allow for unusual small increases during compression. - */ -tls.MaxFragment = 16384 - 1024; - -/** - * Whether this entity is considered the "client" or "server". - * enum { server, client } ConnectionEnd; - */ -tls.ConnectionEnd = { - server: 0, - client: 1 -}; - -/** - * Pseudo-random function algorithm used to generate keys from the master - * secret. - * enum { tls_prf_sha256 } PRFAlgorithm; - */ -tls.PRFAlgorithm = { - tls_prf_sha256: 0 -}; - -/** - * Bulk encryption algorithms. - * enum { null, rc4, des3, aes } BulkCipherAlgorithm; - */ -tls.BulkCipherAlgorithm = { - none: null, - rc4: 0, - des3: 1, - aes: 2 -}; - -/** - * Cipher types. - * enum { stream, block, aead } CipherType; - */ -tls.CipherType = { - stream: 0, - block: 1, - aead: 2 -}; - -/** - * MAC (Message Authentication Code) algorithms. - * enum { null, hmac_md5, hmac_sha1, hmac_sha256, - * hmac_sha384, hmac_sha512} MACAlgorithm; - */ -tls.MACAlgorithm = { - none: null, - hmac_md5: 0, - hmac_sha1: 1, - hmac_sha256: 2, - hmac_sha384: 3, - hmac_sha512: 4 -}; - -/** - * Compression algorithms. - * enum { null(0), deflate(1), (255) } CompressionMethod; - */ -tls.CompressionMethod = { - none: 0, - deflate: 1 -}; - -/** - * TLS record content types. - * enum { - * change_cipher_spec(20), alert(21), handshake(22), - * application_data(23), (255) - * } ContentType; - */ -tls.ContentType = { - change_cipher_spec: 20, - alert: 21, - handshake: 22, - application_data: 23, - heartbeat: 24 -}; - -/** - * TLS handshake types. - * enum { - * hello_request(0), client_hello(1), server_hello(2), - * certificate(11), server_key_exchange (12), - * certificate_request(13), server_hello_done(14), - * certificate_verify(15), client_key_exchange(16), - * finished(20), (255) - * } HandshakeType; - */ -tls.HandshakeType = { - hello_request: 0, - client_hello: 1, - server_hello: 2, - certificate: 11, - server_key_exchange: 12, - certificate_request: 13, - server_hello_done: 14, - certificate_verify: 15, - client_key_exchange: 16, - finished: 20 -}; - -/** - * TLS Alert Protocol. - * - * enum { warning(1), fatal(2), (255) } AlertLevel; - * - * enum { - * close_notify(0), - * unexpected_message(10), - * bad_record_mac(20), - * decryption_failed(21), - * record_overflow(22), - * decompression_failure(30), - * handshake_failure(40), - * bad_certificate(42), - * unsupported_certificate(43), - * certificate_revoked(44), - * certificate_expired(45), - * certificate_unknown(46), - * illegal_parameter(47), - * unknown_ca(48), - * access_denied(49), - * decode_error(50), - * decrypt_error(51), - * export_restriction(60), - * protocol_version(70), - * insufficient_security(71), - * internal_error(80), - * user_canceled(90), - * no_renegotiation(100), - * (255) - * } AlertDescription; - * - * struct { - * AlertLevel level; - * AlertDescription description; - * } Alert; - */ -tls.Alert = {}; -tls.Alert.Level = { - warning: 1, - fatal: 2 -}; -tls.Alert.Description = { - close_notify: 0, - unexpected_message: 10, - bad_record_mac: 20, - decryption_failed: 21, - record_overflow: 22, - decompression_failure: 30, - handshake_failure: 40, - bad_certificate: 42, - unsupported_certificate: 43, - certificate_revoked: 44, - certificate_expired: 45, - certificate_unknown: 46, - illegal_parameter: 47, - unknown_ca: 48, - access_denied: 49, - decode_error: 50, - decrypt_error: 51, - export_restriction: 60, - protocol_version: 70, - insufficient_security: 71, - internal_error: 80, - user_canceled: 90, - no_renegotiation: 100 -}; - -/** - * TLS Heartbeat Message types. - * enum { - * heartbeat_request(1), - * heartbeat_response(2), - * (255) - * } HeartbeatMessageType; - */ -tls.HeartbeatMessageType = { - heartbeat_request: 1, - heartbeat_response: 2 -}; - -/** - * Supported cipher suites. - */ -tls.CipherSuites = {}; - -/** - * Gets a supported cipher suite from its 2 byte ID. - * - * @param twoBytes two bytes in a string. - * - * @return the matching supported cipher suite or null. - */ -tls.getCipherSuite = function(twoBytes) { - var rval = null; - for(var key in tls.CipherSuites) { - var cs = tls.CipherSuites[key]; - if(cs.id[0] === twoBytes.charCodeAt(0) && - cs.id[1] === twoBytes.charCodeAt(1)) { - rval = cs; - break; - } - } - return rval; -}; - -/** - * Called when an unexpected record is encountered. - * - * @param c the connection. - * @param record the record. - */ -tls.handleUnexpected = function(c, record) { - // if connection is client and closed, ignore unexpected messages - var ignore = (!c.open && c.entity === tls.ConnectionEnd.client); - if(!ignore) { - c.error(c, { - message: 'Unexpected message. Received TLS record out of order.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.unexpected_message - } - }); - } -}; - -/** - * Called when a client receives a HelloRequest record. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleHelloRequest = function(c, record, length) { - // ignore renegotiation requests from the server during a handshake, but - // if handshaking, send a warning alert that renegotation is denied - if(!c.handshaking && c.handshakes > 0) { - // send alert warning - tls.queue(c, tls.createAlert(c, { - level: tls.Alert.Level.warning, - description: tls.Alert.Description.no_renegotiation - })); - tls.flush(c); - } - - // continue - c.process(); -}; - -/** - * Parses a hello message from a ClientHello or ServerHello record. - * - * @param record the record to parse. - * - * @return the parsed message. - */ -tls.parseHelloMessage = function(c, record, length) { - var msg = null; - - var client = (c.entity === tls.ConnectionEnd.client); - - // minimum of 38 bytes in message - if(length < 38) { - c.error(c, { - message: client ? - 'Invalid ServerHello message. Message too short.' : - 'Invalid ClientHello message. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } else { - // use 'remaining' to calculate # of remaining bytes in the message - var b = record.fragment; - var remaining = b.length(); - msg = { - version: { - major: b.getByte(), - minor: b.getByte() - }, - random: forge.util.createBuffer(b.getBytes(32)), - session_id: readVector(b, 1), - extensions: [] - }; - if(client) { - msg.cipher_suite = b.getBytes(2); - msg.compression_method = b.getByte(); - } else { - msg.cipher_suites = readVector(b, 2); - msg.compression_methods = readVector(b, 1); - } - - // read extensions if there are any bytes left in the message - remaining = length - (remaining - b.length()); - if(remaining > 0) { - // parse extensions - var exts = readVector(b, 2); - while(exts.length() > 0) { - msg.extensions.push({ - type: [exts.getByte(), exts.getByte()], - data: readVector(exts, 2) - }); - } - - // TODO: make extension support modular - if(!client) { - for(var i = 0; i < msg.extensions.length; ++i) { - var ext = msg.extensions[i]; - - // support SNI extension - if(ext.type[0] === 0x00 && ext.type[1] === 0x00) { - // get server name list - var snl = readVector(ext.data, 2); - while(snl.length() > 0) { - // read server name type - var snType = snl.getByte(); - - // only HostName type (0x00) is known, break out if - // another type is detected - if(snType !== 0x00) { - break; - } - - // add host name to server name list - c.session.extensions.server_name.serverNameList.push( - readVector(snl, 2).getBytes()); - } - } - } - } - } - - // version already set, do not allow version change - if(c.session.version) { - if(msg.version.major !== c.session.version.major || - msg.version.minor !== c.session.version.minor) { - return c.error(c, { - message: 'TLS version change is disallowed during renegotiation.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.protocol_version - } - }); - } - } - - // get the chosen (ServerHello) cipher suite - if(client) { - // FIXME: should be checking configured acceptable cipher suites - c.session.cipherSuite = tls.getCipherSuite(msg.cipher_suite); - } else { - // get a supported preferred (ClientHello) cipher suite - // choose the first supported cipher suite - var tmp = forge.util.createBuffer(msg.cipher_suites.bytes()); - while(tmp.length() > 0) { - // FIXME: should be checking configured acceptable suites - // cipher suites take up 2 bytes - c.session.cipherSuite = tls.getCipherSuite(tmp.getBytes(2)); - if(c.session.cipherSuite !== null) { - break; - } - } - } - - // cipher suite not supported - if(c.session.cipherSuite === null) { - return c.error(c, { - message: 'No cipher suites in common.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.handshake_failure - }, - cipherSuite: forge.util.bytesToHex(msg.cipher_suite) - }); - } - - // TODO: handle compression methods - if(client) { - c.session.compressionMethod = msg.compression_method; - } else { - // no compression - c.session.compressionMethod = tls.CompressionMethod.none; - } - } - - return msg; -}; - -/** - * Creates security parameters for the given connection based on the given - * hello message. - * - * @param c the TLS connection. - * @param msg the hello message. - */ -tls.createSecurityParameters = function(c, msg) { - /* Note: security params are from TLS 1.2, some values like prf_algorithm - are ignored for TLS 1.0/1.1 and the builtin as specified in the spec is - used. */ - - // TODO: handle other options from server when more supported - - // get client and server randoms - var client = (c.entity === tls.ConnectionEnd.client); - var msgRandom = msg.random.bytes(); - var cRandom = client ? c.session.sp.client_random : msgRandom; - var sRandom = client ? msgRandom : tls.createRandom().getBytes(); - - // create new security parameters - c.session.sp = { - entity: c.entity, - prf_algorithm: tls.PRFAlgorithm.tls_prf_sha256, - bulk_cipher_algorithm: null, - cipher_type: null, - enc_key_length: null, - block_length: null, - fixed_iv_length: null, - record_iv_length: null, - mac_algorithm: null, - mac_length: null, - mac_key_length: null, - compression_algorithm: c.session.compressionMethod, - pre_master_secret: null, - master_secret: null, - client_random: cRandom, - server_random: sRandom - }; -}; - -/** - * Called when a client receives a ServerHello record. - * - * When a ServerHello message will be sent: - * The server will send this message in response to a client hello message - * when it was able to find an acceptable set of algorithms. If it cannot - * find such a match, it will respond with a handshake failure alert. - * - * uint24 length; - * struct { - * ProtocolVersion server_version; - * Random random; - * SessionID session_id; - * CipherSuite cipher_suite; - * CompressionMethod compression_method; - * select(extensions_present) { - * case false: - * struct {}; - * case true: - * Extension extensions<0..2^16-1>; - * }; - * } ServerHello; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleServerHello = function(c, record, length) { - var msg = tls.parseHelloMessage(c, record, length); - if(c.fail) { - return; - } - - // ensure server version is compatible - if(msg.version.minor <= c.version.minor) { - c.version.minor = msg.version.minor; - } else { - return c.error(c, { - message: 'Incompatible TLS version.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.protocol_version - } - }); - } - - // indicate session version has been set - c.session.version = c.version; - - // get the session ID from the message - var sessionId = msg.session_id.bytes(); - - // if the session ID is not blank and matches the cached one, resume - // the session - if(sessionId.length > 0 && sessionId === c.session.id) { - // resuming session, expect a ChangeCipherSpec next - c.expect = SCC; - c.session.resuming = true; - - // get new server random - c.session.sp.server_random = msg.random.bytes(); - } else { - // not resuming, expect a server Certificate message next - c.expect = SCE; - c.session.resuming = false; - - // create new security parameters - tls.createSecurityParameters(c, msg); - } - - // set new session ID - c.session.id = sessionId; - - // continue - c.process(); -}; - -/** - * Called when a server receives a ClientHello record. - * - * When a ClientHello message will be sent: - * When a client first connects to a server it is required to send the - * client hello as its first message. The client can also send a client - * hello in response to a hello request or on its own initiative in order - * to renegotiate the security parameters in an existing connection. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleClientHello = function(c, record, length) { - var msg = tls.parseHelloMessage(c, record, length); - if(c.fail) { - return; - } - - // get the session ID from the message - var sessionId = msg.session_id.bytes(); - - // see if the given session ID is in the cache - var session = null; - if(c.sessionCache) { - session = c.sessionCache.getSession(sessionId); - if(session === null) { - // session ID not found - sessionId = ''; - } else if(session.version.major !== msg.version.major || - session.version.minor > msg.version.minor) { - // if session version is incompatible with client version, do not resume - session = null; - sessionId = ''; - } - } - - // no session found to resume, generate a new session ID - if(sessionId.length === 0) { - sessionId = forge.random.getBytes(32); - } - - // update session - c.session.id = sessionId; - c.session.clientHelloVersion = msg.version; - c.session.sp = {}; - if(session) { - // use version and security parameters from resumed session - c.version = c.session.version = session.version; - c.session.sp = session.sp; - } else { - // use highest compatible minor version - var version; - for(var i = 1; i < tls.SupportedVersions.length; ++i) { - version = tls.SupportedVersions[i]; - if(version.minor <= msg.version.minor) { - break; - } - } - c.version = {major: version.major, minor: version.minor}; - c.session.version = c.version; - } - - // if a session is set, resume it - if(session !== null) { - // resuming session, expect a ChangeCipherSpec next - c.expect = CCC; - c.session.resuming = true; - - // get new client random - c.session.sp.client_random = msg.random.bytes(); - } else { - // not resuming, expect a Certificate or ClientKeyExchange - c.expect = (c.verifyClient !== false) ? CCE : CKE; - c.session.resuming = false; - - // create new security parameters - tls.createSecurityParameters(c, msg); - } - - // connection now open - c.open = true; - - // queue server hello - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createServerHello(c) - })); - - if(c.session.resuming) { - // queue change cipher spec message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.change_cipher_spec, - data: tls.createChangeCipherSpec() - })); - - // create pending state - c.state.pending = tls.createConnectionState(c); - - // change current write state to pending write state - c.state.current.write = c.state.pending.write; - - // queue finished - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createFinished(c) - })); - } else { - // queue server certificate - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificate(c) - })); - - if(!c.fail) { - // queue server key exchange - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createServerKeyExchange(c) - })); - - // request client certificate if set - if(c.verifyClient !== false) { - // queue certificate request - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificateRequest(c) - })); - } - - // queue server hello done - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createServerHelloDone(c) - })); - } - } - - // send records - tls.flush(c); - - // continue - c.process(); -}; - -/** - * Called when a client receives a Certificate record. - * - * When this message will be sent: - * The server must send a certificate whenever the agreed-upon key exchange - * method is not an anonymous one. This message will always immediately - * follow the server hello message. - * - * Meaning of this message: - * The certificate type must be appropriate for the selected cipher suite's - * key exchange algorithm, and is generally an X.509v3 certificate. It must - * contain a key which matches the key exchange method, as follows. Unless - * otherwise specified, the signing algorithm for the certificate must be - * the same as the algorithm for the certificate key. Unless otherwise - * specified, the public key may be of any length. - * - * opaque ASN.1Cert<1..2^24-1>; - * struct { - * ASN.1Cert certificate_list<1..2^24-1>; - * } Certificate; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleCertificate = function(c, record, length) { - // minimum of 3 bytes in message - if(length < 3) { - return c.error(c, { - message: 'Invalid Certificate message. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - var b = record.fragment; - var msg = { - certificate_list: readVector(b, 3) - }; - - /* The sender's certificate will be first in the list (chain), each - subsequent one that follows will certify the previous one, but root - certificates (self-signed) that specify the certificate authority may - be omitted under the assumption that clients must already possess it. */ - var cert, asn1; - var certs = []; - try { - while(msg.certificate_list.length() > 0) { - // each entry in msg.certificate_list is a vector with 3 len bytes - cert = readVector(msg.certificate_list, 3); - asn1 = forge.asn1.fromDer(cert); - cert = forge.pki.certificateFromAsn1(asn1, true); - certs.push(cert); - } - } catch(ex) { - return c.error(c, { - message: 'Could not parse certificate list.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.bad_certificate - } - }); - } - - // ensure at least 1 certificate was provided if in client-mode - // or if verifyClient was set to true to require a certificate - // (as opposed to 'optional') - var client = (c.entity === tls.ConnectionEnd.client); - if((client || c.verifyClient === true) && certs.length === 0) { - // error, no certificate - c.error(c, { - message: client ? - 'No server certificate provided.' : - 'No client certificate provided.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } else if(certs.length === 0) { - // no certs to verify - // expect a ServerKeyExchange or ClientKeyExchange message next - c.expect = client ? SKE : CKE; - } else { - // save certificate in session - if(client) { - c.session.serverCertificate = certs[0]; - } else { - c.session.clientCertificate = certs[0]; - } - - if(tls.verifyCertificateChain(c, certs)) { - // expect a ServerKeyExchange or ClientKeyExchange message next - c.expect = client ? SKE : CKE; - } - } - - // continue - c.process(); -}; - -/** - * Called when a client receives a ServerKeyExchange record. - * - * When this message will be sent: - * This message will be sent immediately after the server certificate - * message (or the server hello message, if this is an anonymous - * negotiation). - * - * The server key exchange message is sent by the server only when the - * server certificate message (if sent) does not contain enough data to - * allow the client to exchange a premaster secret. - * - * Meaning of this message: - * This message conveys cryptographic information to allow the client to - * communicate the premaster secret: either an RSA public key to encrypt - * the premaster secret with, or a Diffie-Hellman public key with which the - * client can complete a key exchange (with the result being the premaster - * secret.) - * - * enum { - * dhe_dss, dhe_rsa, dh_anon, rsa, dh_dss, dh_rsa - * } KeyExchangeAlgorithm; - * - * struct { - * opaque dh_p<1..2^16-1>; - * opaque dh_g<1..2^16-1>; - * opaque dh_Ys<1..2^16-1>; - * } ServerDHParams; - * - * struct { - * select(KeyExchangeAlgorithm) { - * case dh_anon: - * ServerDHParams params; - * case dhe_dss: - * case dhe_rsa: - * ServerDHParams params; - * digitally-signed struct { - * opaque client_random[32]; - * opaque server_random[32]; - * ServerDHParams params; - * } signed_params; - * case rsa: - * case dh_dss: - * case dh_rsa: - * struct {}; - * }; - * } ServerKeyExchange; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleServerKeyExchange = function(c, record, length) { - // this implementation only supports RSA, no Diffie-Hellman support - // so any length > 0 is invalid - if(length > 0) { - return c.error(c, { - message: 'Invalid key parameters. Only RSA is supported.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.unsupported_certificate - } - }); - } - - // expect an optional CertificateRequest message next - c.expect = SCR; - - // continue - c.process(); -}; - -/** - * Called when a client receives a ClientKeyExchange record. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleClientKeyExchange = function(c, record, length) { - // this implementation only supports RSA, no Diffie-Hellman support - // so any length < 48 is invalid - if(length < 48) { - return c.error(c, { - message: 'Invalid key parameters. Only RSA is supported.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.unsupported_certificate - } - }); - } - - var b = record.fragment; - var msg = { - enc_pre_master_secret: readVector(b, 2).getBytes() - }; - - // do rsa decryption - var privateKey = null; - if(c.getPrivateKey) { - try { - privateKey = c.getPrivateKey(c, c.session.serverCertificate); - privateKey = forge.pki.privateKeyFromPem(privateKey); - } catch(ex) { - c.error(c, { - message: 'Could not get private key.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - } - - if(privateKey === null) { - return c.error(c, { - message: 'No private key set.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - - try { - // decrypt 48-byte pre-master secret - var sp = c.session.sp; - sp.pre_master_secret = privateKey.decrypt(msg.enc_pre_master_secret); - - // ensure client hello version matches first 2 bytes - var version = c.session.clientHelloVersion; - if(version.major !== sp.pre_master_secret.charCodeAt(0) || - version.minor !== sp.pre_master_secret.charCodeAt(1)) { - // error, do not send alert (see BLEI attack below) - throw new Error('TLS version rollback attack detected.'); - } - } catch(ex) { - /* Note: Daniel Bleichenbacher [BLEI] can be used to attack a - TLS server which is using PKCS#1 encoded RSA, so instead of - failing here, we generate 48 random bytes and use that as - the pre-master secret. */ - sp.pre_master_secret = forge.random.getBytes(48); - } - - // expect a CertificateVerify message if a Certificate was received that - // does not have fixed Diffie-Hellman params, otherwise expect - // ChangeCipherSpec - c.expect = CCC; - if(c.session.clientCertificate !== null) { - // only RSA support, so expect CertificateVerify - // TODO: support Diffie-Hellman - c.expect = CCV; - } - - // continue - c.process(); -}; - -/** - * Called when a client receives a CertificateRequest record. - * - * When this message will be sent: - * A non-anonymous server can optionally request a certificate from the - * client, if appropriate for the selected cipher suite. This message, if - * sent, will immediately follow the Server Key Exchange message (if it is - * sent; otherwise, the Server Certificate message). - * - * enum { - * rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), - * rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), - * fortezza_dms_RESERVED(20), (255) - * } ClientCertificateType; - * - * opaque DistinguishedName<1..2^16-1>; - * - * struct { - * ClientCertificateType certificate_types<1..2^8-1>; - * SignatureAndHashAlgorithm supported_signature_algorithms<2^16-1>; - * DistinguishedName certificate_authorities<0..2^16-1>; - * } CertificateRequest; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleCertificateRequest = function(c, record, length) { - // minimum of 3 bytes in message - if(length < 3) { - return c.error(c, { - message: 'Invalid CertificateRequest. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - // TODO: TLS 1.2+ has different format including - // SignatureAndHashAlgorithm after cert types - var b = record.fragment; - var msg = { - certificate_types: readVector(b, 1), - certificate_authorities: readVector(b, 2) - }; - - // save certificate request in session - c.session.certificateRequest = msg; - - // expect a ServerHelloDone message next - c.expect = SHD; - - // continue - c.process(); -}; - -/** - * Called when a server receives a CertificateVerify record. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleCertificateVerify = function(c, record, length) { - if(length < 2) { - return c.error(c, { - message: 'Invalid CertificateVerify. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - // rewind to get full bytes for message so it can be manually - // digested below (special case for CertificateVerify messages because - // they must be digested *after* handling as opposed to all others) - var b = record.fragment; - b.read -= 4; - var msgBytes = b.bytes(); - b.read += 4; - - var msg = { - signature: readVector(b, 2).getBytes() - }; - - // TODO: add support for DSA - - // generate data to verify - var verify = forge.util.createBuffer(); - verify.putBuffer(c.session.md5.digest()); - verify.putBuffer(c.session.sha1.digest()); - verify = verify.getBytes(); - - try { - var cert = c.session.clientCertificate; - /*b = forge.pki.rsa.decrypt( - msg.signature, cert.publicKey, true, verify.length); - if(b !== verify) {*/ - if(!cert.publicKey.verify(verify, msg.signature, 'NONE')) { - throw new Error('CertificateVerify signature does not match.'); - } - - // digest message now that it has been handled - c.session.md5.update(msgBytes); - c.session.sha1.update(msgBytes); - } catch(ex) { - return c.error(c, { - message: 'Bad signature in CertificateVerify.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.handshake_failure - } - }); - } - - // expect ChangeCipherSpec - c.expect = CCC; - - // continue - c.process(); -}; - -/** - * Called when a client receives a ServerHelloDone record. - * - * When this message will be sent: - * The server hello done message is sent by the server to indicate the end - * of the server hello and associated messages. After sending this message - * the server will wait for a client response. - * - * Meaning of this message: - * This message means that the server is done sending messages to support - * the key exchange, and the client can proceed with its phase of the key - * exchange. - * - * Upon receipt of the server hello done message the client should verify - * that the server provided a valid certificate if required and check that - * the server hello parameters are acceptable. - * - * struct {} ServerHelloDone; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleServerHelloDone = function(c, record, length) { - // len must be 0 bytes - if(length > 0) { - return c.error(c, { - message: 'Invalid ServerHelloDone message. Invalid length.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.record_overflow - } - }); - } - - if(c.serverCertificate === null) { - // no server certificate was provided - var error = { - message: 'No server certificate provided. Not enough security.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.insufficient_security - } - }; - - // call application callback - var depth = 0; - var ret = c.verify(c, error.alert.description, depth, []); - if(ret !== true) { - // check for custom alert info - if(ret || ret === 0) { - // set custom message and alert description - if(typeof ret === 'object' && !forge.util.isArray(ret)) { - if(ret.message) { - error.message = ret.message; - } - if(ret.alert) { - error.alert.description = ret.alert; - } - } else if(typeof ret === 'number') { - // set custom alert description - error.alert.description = ret; - } - } - - // send error - return c.error(c, error); - } - } - - // create client certificate message if requested - if(c.session.certificateRequest !== null) { - record = tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificate(c) - }); - tls.queue(c, record); - } - - // create client key exchange message - record = tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createClientKeyExchange(c) - }); - tls.queue(c, record); - - // expect no messages until the following callback has been called - c.expect = SER; - - // create callback to handle client signature (for client-certs) - var callback = function(c, signature) { - if(c.session.certificateRequest !== null && - c.session.clientCertificate !== null) { - // create certificate verify message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificateVerify(c, signature) - })); - } - - // create change cipher spec message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.change_cipher_spec, - data: tls.createChangeCipherSpec() - })); - - // create pending state - c.state.pending = tls.createConnectionState(c); - - // change current write state to pending write state - c.state.current.write = c.state.pending.write; - - // create finished message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createFinished(c) - })); - - // expect a server ChangeCipherSpec message next - c.expect = SCC; - - // send records - tls.flush(c); - - // continue - c.process(); - }; - - // if there is no certificate request or no client certificate, do - // callback immediately - if(c.session.certificateRequest === null || - c.session.clientCertificate === null) { - return callback(c, null); - } - - // otherwise get the client signature - tls.getClientSignature(c, callback); -}; - -/** - * Called when a ChangeCipherSpec record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleChangeCipherSpec = function(c, record) { - if(record.fragment.getByte() !== 0x01) { - return c.error(c, { - message: 'Invalid ChangeCipherSpec message received.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - // create pending state if: - // 1. Resuming session in client mode OR - // 2. NOT resuming session in server mode - var client = (c.entity === tls.ConnectionEnd.client); - if((c.session.resuming && client) || (!c.session.resuming && !client)) { - c.state.pending = tls.createConnectionState(c); - } - - // change current read state to pending read state - c.state.current.read = c.state.pending.read; - - // clear pending state if: - // 1. NOT resuming session in client mode OR - // 2. resuming a session in server mode - if((!c.session.resuming && client) || (c.session.resuming && !client)) { - c.state.pending = null; - } - - // expect a Finished record next - c.expect = client ? SFI : CFI; - - // continue - c.process(); -}; - -/** - * Called when a Finished record is received. - * - * When this message will be sent: - * A finished message is always sent immediately after a change - * cipher spec message to verify that the key exchange and - * authentication processes were successful. It is essential that a - * change cipher spec message be received between the other - * handshake messages and the Finished message. - * - * Meaning of this message: - * The finished message is the first protected with the just- - * negotiated algorithms, keys, and secrets. Recipients of finished - * messages must verify that the contents are correct. Once a side - * has sent its Finished message and received and validated the - * Finished message from its peer, it may begin to send and receive - * application data over the connection. - * - * struct { - * opaque verify_data[verify_data_length]; - * } Finished; - * - * verify_data - * PRF(master_secret, finished_label, Hash(handshake_messages)) - * [0..verify_data_length-1]; - * - * finished_label - * For Finished messages sent by the client, the string - * "client finished". For Finished messages sent by the server, the - * string "server finished". - * - * verify_data_length depends on the cipher suite. If it is not specified - * by the cipher suite, then it is 12. Versions of TLS < 1.2 always used - * 12 bytes. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleFinished = function(c, record, length) { - // rewind to get full bytes for message so it can be manually - // digested below (special case for Finished messages because they - // must be digested *after* handling as opposed to all others) - var b = record.fragment; - b.read -= 4; - var msgBytes = b.bytes(); - b.read += 4; - - // message contains only verify_data - var vd = record.fragment.getBytes(); - - // ensure verify data is correct - b = forge.util.createBuffer(); - b.putBuffer(c.session.md5.digest()); - b.putBuffer(c.session.sha1.digest()); - - // set label based on entity type - var client = (c.entity === tls.ConnectionEnd.client); - var label = client ? 'server finished' : 'client finished'; - - // TODO: determine prf function and verify length for TLS 1.2 - var sp = c.session.sp; - var vdl = 12; - var prf = prf_TLS1; - b = prf(sp.master_secret, label, b.getBytes(), vdl); - if(b.getBytes() !== vd) { - return c.error(c, { - message: 'Invalid verify_data in Finished message.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.decrypt_error - } - }); - } - - // digest finished message now that it has been handled - c.session.md5.update(msgBytes); - c.session.sha1.update(msgBytes); - - // resuming session as client or NOT resuming session as server - if((c.session.resuming && client) || (!c.session.resuming && !client)) { - // create change cipher spec message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.change_cipher_spec, - data: tls.createChangeCipherSpec() - })); - - // change current write state to pending write state, clear pending - c.state.current.write = c.state.pending.write; - c.state.pending = null; - - // create finished message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createFinished(c) - })); - } - - // expect application data next - c.expect = client ? SAD : CAD; - - // handshake complete - c.handshaking = false; - ++c.handshakes; - - // save access to peer certificate - c.peerCertificate = client ? - c.session.serverCertificate : c.session.clientCertificate; - - // send records - tls.flush(c); - - // now connected - c.isConnected = true; - c.connected(c); - - // continue - c.process(); -}; - -/** - * Called when an Alert record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleAlert = function(c, record) { - // read alert - var b = record.fragment; - var alert = { - level: b.getByte(), - description: b.getByte() - }; - - // TODO: consider using a table? - // get appropriate message - var msg; - switch(alert.description) { - case tls.Alert.Description.close_notify: - msg = 'Connection closed.'; - break; - case tls.Alert.Description.unexpected_message: - msg = 'Unexpected message.'; - break; - case tls.Alert.Description.bad_record_mac: - msg = 'Bad record MAC.'; - break; - case tls.Alert.Description.decryption_failed: - msg = 'Decryption failed.'; - break; - case tls.Alert.Description.record_overflow: - msg = 'Record overflow.'; - break; - case tls.Alert.Description.decompression_failure: - msg = 'Decompression failed.'; - break; - case tls.Alert.Description.handshake_failure: - msg = 'Handshake failure.'; - break; - case tls.Alert.Description.bad_certificate: - msg = 'Bad certificate.'; - break; - case tls.Alert.Description.unsupported_certificate: - msg = 'Unsupported certificate.'; - break; - case tls.Alert.Description.certificate_revoked: - msg = 'Certificate revoked.'; - break; - case tls.Alert.Description.certificate_expired: - msg = 'Certificate expired.'; - break; - case tls.Alert.Description.certificate_unknown: - msg = 'Certificate unknown.'; - break; - case tls.Alert.Description.illegal_parameter: - msg = 'Illegal parameter.'; - break; - case tls.Alert.Description.unknown_ca: - msg = 'Unknown certificate authority.'; - break; - case tls.Alert.Description.access_denied: - msg = 'Access denied.'; - break; - case tls.Alert.Description.decode_error: - msg = 'Decode error.'; - break; - case tls.Alert.Description.decrypt_error: - msg = 'Decrypt error.'; - break; - case tls.Alert.Description.export_restriction: - msg = 'Export restriction.'; - break; - case tls.Alert.Description.protocol_version: - msg = 'Unsupported protocol version.'; - break; - case tls.Alert.Description.insufficient_security: - msg = 'Insufficient security.'; - break; - case tls.Alert.Description.internal_error: - msg = 'Internal error.'; - break; - case tls.Alert.Description.user_canceled: - msg = 'User canceled.'; - break; - case tls.Alert.Description.no_renegotiation: - msg = 'Renegotiation not supported.'; - break; - default: - msg = 'Unknown error.'; - break; - } - - // close connection on close_notify, not an error - if(alert.description === tls.Alert.Description.close_notify) { - return c.close(); - } - - // call error handler - c.error(c, { - message: msg, - send: false, - // origin is the opposite end - origin: (c.entity === tls.ConnectionEnd.client) ? 'server' : 'client', - alert: alert - }); - - // continue - c.process(); -}; - -/** - * Called when a Handshake record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleHandshake = function(c, record) { - // get the handshake type and message length - var b = record.fragment; - var type = b.getByte(); - var length = b.getInt24(); - - // see if the record fragment doesn't yet contain the full message - if(length > b.length()) { - // cache the record, clear its fragment, and reset the buffer read - // pointer before the type and length were read - c.fragmented = record; - record.fragment = forge.util.createBuffer(); - b.read -= 4; - - // continue - return c.process(); - } - - // full message now available, clear cache, reset read pointer to - // before type and length - c.fragmented = null; - b.read -= 4; - - // save the handshake bytes for digestion after handler is found - // (include type and length of handshake msg) - var bytes = b.bytes(length + 4); - - // restore read pointer - b.read += 4; - - // handle expected message - if(type in hsTable[c.entity][c.expect]) { - // initialize server session - if(c.entity === tls.ConnectionEnd.server && !c.open && !c.fail) { - c.handshaking = true; - c.session = { - version: null, - extensions: { - server_name: { - serverNameList: [] - } - }, - cipherSuite: null, - compressionMethod: null, - serverCertificate: null, - clientCertificate: null, - md5: forge.md.md5.create(), - sha1: forge.md.sha1.create() - }; - } - - /* Update handshake messages digest. Finished and CertificateVerify - messages are not digested here. They can't be digested as part of - the verify_data that they contain. These messages are manually - digested in their handlers. HelloRequest messages are simply never - included in the handshake message digest according to spec. */ - if(type !== tls.HandshakeType.hello_request && - type !== tls.HandshakeType.certificate_verify && - type !== tls.HandshakeType.finished) { - c.session.md5.update(bytes); - c.session.sha1.update(bytes); - } - - // handle specific handshake type record - hsTable[c.entity][c.expect][type](c, record, length); - } else { - // unexpected record - tls.handleUnexpected(c, record); - } -}; - -/** - * Called when an ApplicationData record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleApplicationData = function(c, record) { - // buffer data, notify that its ready - c.data.putBuffer(record.fragment); - c.dataReady(c); - - // continue - c.process(); -}; - -/** - * Called when a Heartbeat record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleHeartbeat = function(c, record) { - // get the heartbeat type and payload - var b = record.fragment; - var type = b.getByte(); - var length = b.getInt16(); - var payload = b.getBytes(length); - - if(type === tls.HeartbeatMessageType.heartbeat_request) { - // discard request during handshake or if length is too large - if(c.handshaking || length > payload.length) { - // continue - return c.process(); - } - // retransmit payload - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.heartbeat, - data: tls.createHeartbeat( - tls.HeartbeatMessageType.heartbeat_response, payload) - })); - tls.flush(c); - } else if(type === tls.HeartbeatMessageType.heartbeat_response) { - // check payload against expected payload, discard heartbeat if no match - if(payload !== c.expectedHeartbeatPayload) { - // continue - return c.process(); - } - - // notify that a valid heartbeat was received - if(c.heartbeatReceived) { - c.heartbeatReceived(c, forge.util.createBuffer(payload)); - } - } - - // continue - c.process(); -}; - -/** - * The transistional state tables for receiving TLS records. It maps the - * current TLS engine state and a received record to a function to handle the - * record and update the state. - * - * For instance, if the current state is SHE, then the TLS engine is expecting - * a ServerHello record. Once a record is received, the handler function is - * looked up using the state SHE and the record's content type. - * - * The resulting function will either be an error handler or a record handler. - * The function will take whatever action is appropriate and update the state - * for the next record. - * - * The states are all based on possible server record types. Note that the - * client will never specifically expect to receive a HelloRequest or an alert - * from the server so there is no state that reflects this. These messages may - * occur at any time. - * - * There are two tables for mapping states because there is a second tier of - * types for handshake messages. Once a record with a content type of handshake - * is received, the handshake record handler will look up the handshake type in - * the secondary map to get its appropriate handler. - * - * Valid message orders are as follows: - * - * =======================FULL HANDSHAKE====================== - * Client Server - * - * ClientHello --------> - * ServerHello - * Certificate* - * ServerKeyExchange* - * CertificateRequest* - * <-------- ServerHelloDone - * Certificate* - * ClientKeyExchange - * CertificateVerify* - * [ChangeCipherSpec] - * Finished --------> - * [ChangeCipherSpec] - * <-------- Finished - * Application Data <-------> Application Data - * - * =====================SESSION RESUMPTION===================== - * Client Server - * - * ClientHello --------> - * ServerHello - * [ChangeCipherSpec] - * <-------- Finished - * [ChangeCipherSpec] - * Finished --------> - * Application Data <-------> Application Data - */ -// client expect states (indicate which records are expected to be received) -var SHE = 0; // rcv server hello -var SCE = 1; // rcv server certificate -var SKE = 2; // rcv server key exchange -var SCR = 3; // rcv certificate request -var SHD = 4; // rcv server hello done -var SCC = 5; // rcv change cipher spec -var SFI = 6; // rcv finished -var SAD = 7; // rcv application data -var SER = 8; // not expecting any messages at this point - -// server expect states -var CHE = 0; // rcv client hello -var CCE = 1; // rcv client certificate -var CKE = 2; // rcv client key exchange -var CCV = 3; // rcv certificate verify -var CCC = 4; // rcv change cipher spec -var CFI = 5; // rcv finished -var CAD = 6; // rcv application data -var CER = 7; // not expecting any messages at this point - -// map client current expect state and content type to function -var __ = tls.handleUnexpected; -var R0 = tls.handleChangeCipherSpec; -var R1 = tls.handleAlert; -var R2 = tls.handleHandshake; -var R3 = tls.handleApplicationData; -var R4 = tls.handleHeartbeat; -var ctTable = []; -ctTable[tls.ConnectionEnd.client] = [ -// CC,AL,HS,AD,HB -/*SHE*/[__,R1,R2,__,R4], -/*SCE*/[__,R1,R2,__,R4], -/*SKE*/[__,R1,R2,__,R4], -/*SCR*/[__,R1,R2,__,R4], -/*SHD*/[__,R1,R2,__,R4], -/*SCC*/[R0,R1,__,__,R4], -/*SFI*/[__,R1,R2,__,R4], -/*SAD*/[__,R1,R2,R3,R4], -/*SER*/[__,R1,R2,__,R4] -]; - -// map server current expect state and content type to function -ctTable[tls.ConnectionEnd.server] = [ -// CC,AL,HS,AD -/*CHE*/[__,R1,R2,__,R4], -/*CCE*/[__,R1,R2,__,R4], -/*CKE*/[__,R1,R2,__,R4], -/*CCV*/[__,R1,R2,__,R4], -/*CCC*/[R0,R1,__,__,R4], -/*CFI*/[__,R1,R2,__,R4], -/*CAD*/[__,R1,R2,R3,R4], -/*CER*/[__,R1,R2,__,R4] -]; - -// map client current expect state and handshake type to function -var H0 = tls.handleHelloRequest; -var H1 = tls.handleServerHello; -var H2 = tls.handleCertificate; -var H3 = tls.handleServerKeyExchange; -var H4 = tls.handleCertificateRequest; -var H5 = tls.handleServerHelloDone; -var H6 = tls.handleFinished; -var hsTable = []; -hsTable[tls.ConnectionEnd.client] = [ -// HR,01,SH,03,04,05,06,07,08,09,10,SC,SK,CR,HD,15,CK,17,18,19,FI -/*SHE*/[__,__,H1,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*SCE*/[H0,__,__,__,__,__,__,__,__,__,__,H2,H3,H4,H5,__,__,__,__,__,__], -/*SKE*/[H0,__,__,__,__,__,__,__,__,__,__,__,H3,H4,H5,__,__,__,__,__,__], -/*SCR*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,H4,H5,__,__,__,__,__,__], -/*SHD*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,H5,__,__,__,__,__,__], -/*SCC*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*SFI*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H6], -/*SAD*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*SER*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__] -]; - -// map server current expect state and handshake type to function -// Note: CAD[CH] does not map to FB because renegotation is prohibited -var H7 = tls.handleClientHello; -var H8 = tls.handleClientKeyExchange; -var H9 = tls.handleCertificateVerify; -hsTable[tls.ConnectionEnd.server] = [ -// 01,CH,02,03,04,05,06,07,08,09,10,CC,12,13,14,CV,CK,17,18,19,FI -/*CHE*/[__,H7,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*CCE*/[__,__,__,__,__,__,__,__,__,__,__,H2,__,__,__,__,__,__,__,__,__], -/*CKE*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H8,__,__,__,__], -/*CCV*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H9,__,__,__,__,__], -/*CCC*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*CFI*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H6], -/*CAD*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*CER*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__] -]; - -/** - * Generates the master_secret and keys using the given security parameters. - * - * The security parameters for a TLS connection state are defined as such: - * - * struct { - * ConnectionEnd entity; - * PRFAlgorithm prf_algorithm; - * BulkCipherAlgorithm bulk_cipher_algorithm; - * CipherType cipher_type; - * uint8 enc_key_length; - * uint8 block_length; - * uint8 fixed_iv_length; - * uint8 record_iv_length; - * MACAlgorithm mac_algorithm; - * uint8 mac_length; - * uint8 mac_key_length; - * CompressionMethod compression_algorithm; - * opaque master_secret[48]; - * opaque client_random[32]; - * opaque server_random[32]; - * } SecurityParameters; - * - * Note that this definition is from TLS 1.2. In TLS 1.0 some of these - * parameters are ignored because, for instance, the PRFAlgorithm is a - * builtin-fixed algorithm combining iterations of MD5 and SHA-1 in TLS 1.0. - * - * The Record Protocol requires an algorithm to generate keys required by the - * current connection state. - * - * The master secret is expanded into a sequence of secure bytes, which is then - * split to a client write MAC key, a server write MAC key, a client write - * encryption key, and a server write encryption key. In TLS 1.0 a client write - * IV and server write IV are also generated. Each of these is generated from - * the byte sequence in that order. Unused values are empty. In TLS 1.2, some - * AEAD ciphers may additionally require a client write IV and a server write - * IV (see Section 6.2.3.3). - * - * When keys, MAC keys, and IVs are generated, the master secret is used as an - * entropy source. - * - * To generate the key material, compute: - * - * master_secret = PRF(pre_master_secret, "master secret", - * ClientHello.random + ServerHello.random) - * - * key_block = PRF(SecurityParameters.master_secret, - * "key expansion", - * SecurityParameters.server_random + - * SecurityParameters.client_random); - * - * until enough output has been generated. Then, the key_block is - * partitioned as follows: - * - * client_write_MAC_key[SecurityParameters.mac_key_length] - * server_write_MAC_key[SecurityParameters.mac_key_length] - * client_write_key[SecurityParameters.enc_key_length] - * server_write_key[SecurityParameters.enc_key_length] - * client_write_IV[SecurityParameters.fixed_iv_length] - * server_write_IV[SecurityParameters.fixed_iv_length] - * - * In TLS 1.2, the client_write_IV and server_write_IV are only generated for - * implicit nonce techniques as described in Section 3.2.1 of [AEAD]. This - * implementation uses TLS 1.0 so IVs are generated. - * - * Implementation note: The currently defined cipher suite which requires the - * most material is AES_256_CBC_SHA256. It requires 2 x 32 byte keys and 2 x 32 - * byte MAC keys, for a total 128 bytes of key material. In TLS 1.0 it also - * requires 2 x 16 byte IVs, so it actually takes 160 bytes of key material. - * - * @param c the connection. - * @param sp the security parameters to use. - * - * @return the security keys. - */ -tls.generateKeys = function(c, sp) { - // TLS_RSA_WITH_AES_128_CBC_SHA (required to be compliant with TLS 1.2) & - // TLS_RSA_WITH_AES_256_CBC_SHA are the only cipher suites implemented - // at present - - // TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA is required to be compliant with - // TLS 1.0 but we don't care right now because AES is better and we have - // an implementation for it - - // TODO: TLS 1.2 implementation - /* - // determine the PRF - var prf; - switch(sp.prf_algorithm) { - case tls.PRFAlgorithm.tls_prf_sha256: - prf = prf_sha256; - break; - default: - // should never happen - throw new Error('Invalid PRF'); - } - */ - - // TLS 1.0/1.1 implementation - var prf = prf_TLS1; - - // concatenate server and client random - var random = sp.client_random + sp.server_random; - - // only create master secret if session is new - if(!c.session.resuming) { - // create master secret, clean up pre-master secret - sp.master_secret = prf( - sp.pre_master_secret, 'master secret', random, 48).bytes(); - sp.pre_master_secret = null; - } - - // generate the amount of key material needed - random = sp.server_random + sp.client_random; - var length = 2 * sp.mac_key_length + 2 * sp.enc_key_length; - - // include IV for TLS/1.0 - var tls10 = (c.version.major === tls.Versions.TLS_1_0.major && - c.version.minor === tls.Versions.TLS_1_0.minor); - if(tls10) { - length += 2 * sp.fixed_iv_length; - } - var km = prf(sp.master_secret, 'key expansion', random, length); - - // split the key material into the MAC and encryption keys - var rval = { - client_write_MAC_key: km.getBytes(sp.mac_key_length), - server_write_MAC_key: km.getBytes(sp.mac_key_length), - client_write_key: km.getBytes(sp.enc_key_length), - server_write_key: km.getBytes(sp.enc_key_length) - }; - - // include TLS 1.0 IVs - if(tls10) { - rval.client_write_IV = km.getBytes(sp.fixed_iv_length); - rval.server_write_IV = km.getBytes(sp.fixed_iv_length); - } - - return rval; -}; - -/** - * Creates a new initialized TLS connection state. A connection state has - * a read mode and a write mode. - * - * compression state: - * The current state of the compression algorithm. - * - * cipher state: - * The current state of the encryption algorithm. This will consist of the - * scheduled key for that connection. For stream ciphers, this will also - * contain whatever state information is necessary to allow the stream to - * continue to encrypt or decrypt data. - * - * MAC key: - * The MAC key for the connection. - * - * sequence number: - * Each connection state contains a sequence number, which is maintained - * separately for read and write states. The sequence number MUST be set to - * zero whenever a connection state is made the active state. Sequence - * numbers are of type uint64 and may not exceed 2^64-1. Sequence numbers do - * not wrap. If a TLS implementation would need to wrap a sequence number, - * it must renegotiate instead. A sequence number is incremented after each - * record: specifically, the first record transmitted under a particular - * connection state MUST use sequence number 0. - * - * @param c the connection. - * - * @return the new initialized TLS connection state. - */ -tls.createConnectionState = function(c) { - var client = (c.entity === tls.ConnectionEnd.client); - - var createMode = function() { - var mode = { - // two 32-bit numbers, first is most significant - sequenceNumber: [0, 0], - macKey: null, - macLength: 0, - macFunction: null, - cipherState: null, - cipherFunction: function(record) {return true;}, - compressionState: null, - compressFunction: function(record) {return true;}, - updateSequenceNumber: function() { - if(mode.sequenceNumber[1] === 0xFFFFFFFF) { - mode.sequenceNumber[1] = 0; - ++mode.sequenceNumber[0]; - } else { - ++mode.sequenceNumber[1]; - } - } - }; - return mode; - }; - var state = { - read: createMode(), - write: createMode() - }; - - // update function in read mode will decrypt then decompress a record - state.read.update = function(c, record) { - if(!state.read.cipherFunction(record, state.read)) { - c.error(c, { - message: 'Could not decrypt record or bad MAC.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - // doesn't matter if decryption failed or MAC was - // invalid, return the same error so as not to reveal - // which one occurred - description: tls.Alert.Description.bad_record_mac - } - }); - } else if(!state.read.compressFunction(c, record, state.read)) { - c.error(c, { - message: 'Could not decompress record.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.decompression_failure - } - }); - } - return !c.fail; - }; - - // update function in write mode will compress then encrypt a record - state.write.update = function(c, record) { - if(!state.write.compressFunction(c, record, state.write)) { - // error, but do not send alert since it would require - // compression as well - c.error(c, { - message: 'Could not compress record.', - send: false, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } else if(!state.write.cipherFunction(record, state.write)) { - // error, but do not send alert since it would require - // encryption as well - c.error(c, { - message: 'Could not encrypt record.', - send: false, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - return !c.fail; - }; - - // handle security parameters - if(c.session) { - var sp = c.session.sp; - c.session.cipherSuite.initSecurityParameters(sp); - - // generate keys - sp.keys = tls.generateKeys(c, sp); - state.read.macKey = client ? - sp.keys.server_write_MAC_key : sp.keys.client_write_MAC_key; - state.write.macKey = client ? - sp.keys.client_write_MAC_key : sp.keys.server_write_MAC_key; - - // cipher suite setup - c.session.cipherSuite.initConnectionState(state, c, sp); - - // compression setup - switch(sp.compression_algorithm) { - case tls.CompressionMethod.none: - break; - case tls.CompressionMethod.deflate: - state.read.compressFunction = inflate; - state.write.compressFunction = deflate; - break; - default: - throw new Error('Unsupported compression algorithm.'); - } - } - - return state; -}; - -/** - * Creates a Random structure. - * - * struct { - * uint32 gmt_unix_time; - * opaque random_bytes[28]; - * } Random; - * - * gmt_unix_time: - * The current time and date in standard UNIX 32-bit format (seconds since - * the midnight starting Jan 1, 1970, UTC, ignoring leap seconds) according - * to the sender's internal clock. Clocks are not required to be set - * correctly by the basic TLS protocol; higher-level or application - * protocols may define additional requirements. Note that, for historical - * reasons, the data element is named using GMT, the predecessor of the - * current worldwide time base, UTC. - * random_bytes: - * 28 bytes generated by a secure random number generator. - * - * @return the Random structure as a byte array. - */ -tls.createRandom = function() { - // get UTC milliseconds - var d = new Date(); - var utc = +d + d.getTimezoneOffset() * 60000; - var rval = forge.util.createBuffer(); - rval.putInt32(utc); - rval.putBytes(forge.random.getBytes(28)); - return rval; -}; - -/** - * Creates a TLS record with the given type and data. - * - * @param c the connection. - * @param options: - * type: the record type. - * data: the plain text data in a byte buffer. - * - * @return the created record. - */ -tls.createRecord = function(c, options) { - if(!options.data) { - return null; - } - var record = { - type: options.type, - version: { - major: c.version.major, - minor: c.version.minor - }, - length: options.data.length(), - fragment: options.data - }; - return record; -}; - -/** - * Creates a TLS alert record. - * - * @param c the connection. - * @param alert: - * level: the TLS alert level. - * description: the TLS alert description. - * - * @return the created alert record. - */ -tls.createAlert = function(c, alert) { - var b = forge.util.createBuffer(); - b.putByte(alert.level); - b.putByte(alert.description); - return tls.createRecord(c, { - type: tls.ContentType.alert, - data: b - }); -}; - -/* The structure of a TLS handshake message. - * - * struct { - * HandshakeType msg_type; // handshake type - * uint24 length; // bytes in message - * select(HandshakeType) { - * case hello_request: HelloRequest; - * case client_hello: ClientHello; - * case server_hello: ServerHello; - * case certificate: Certificate; - * case server_key_exchange: ServerKeyExchange; - * case certificate_request: CertificateRequest; - * case server_hello_done: ServerHelloDone; - * case certificate_verify: CertificateVerify; - * case client_key_exchange: ClientKeyExchange; - * case finished: Finished; - * } body; - * } Handshake; - */ - -/** - * Creates a ClientHello message. - * - * opaque SessionID<0..32>; - * enum { null(0), deflate(1), (255) } CompressionMethod; - * uint8 CipherSuite[2]; - * - * struct { - * ProtocolVersion client_version; - * Random random; - * SessionID session_id; - * CipherSuite cipher_suites<2..2^16-2>; - * CompressionMethod compression_methods<1..2^8-1>; - * select(extensions_present) { - * case false: - * struct {}; - * case true: - * Extension extensions<0..2^16-1>; - * }; - * } ClientHello; - * - * The extension format for extended client hellos and server hellos is: - * - * struct { - * ExtensionType extension_type; - * opaque extension_data<0..2^16-1>; - * } Extension; - * - * Here: - * - * - "extension_type" identifies the particular extension type. - * - "extension_data" contains information specific to the particular - * extension type. - * - * The extension types defined in this document are: - * - * enum { - * server_name(0), max_fragment_length(1), - * client_certificate_url(2), trusted_ca_keys(3), - * truncated_hmac(4), status_request(5), (65535) - * } ExtensionType; - * - * @param c the connection. - * - * @return the ClientHello byte buffer. - */ -tls.createClientHello = function(c) { - // save hello version - c.session.clientHelloVersion = { - major: c.version.major, - minor: c.version.minor - }; - - // create supported cipher suites - var cipherSuites = forge.util.createBuffer(); - for(var i = 0; i < c.cipherSuites.length; ++i) { - var cs = c.cipherSuites[i]; - cipherSuites.putByte(cs.id[0]); - cipherSuites.putByte(cs.id[1]); - } - var cSuites = cipherSuites.length(); - - // create supported compression methods, null always supported, but - // also support deflate if connection has inflate and deflate methods - var compressionMethods = forge.util.createBuffer(); - compressionMethods.putByte(tls.CompressionMethod.none); - // FIXME: deflate support disabled until issues with raw deflate data - // without zlib headers are resolved - /* - if(c.inflate !== null && c.deflate !== null) { - compressionMethods.putByte(tls.CompressionMethod.deflate); - } - */ - var cMethods = compressionMethods.length(); - - // create TLS SNI (server name indication) extension if virtual host - // has been specified, see RFC 3546 - var extensions = forge.util.createBuffer(); - if(c.virtualHost) { - // create extension struct - var ext = forge.util.createBuffer(); - ext.putByte(0x00); // type server_name (ExtensionType is 2 bytes) - ext.putByte(0x00); - - /* In order to provide the server name, clients MAY include an - * extension of type "server_name" in the (extended) client hello. - * The "extension_data" field of this extension SHALL contain - * "ServerNameList" where: - * - * struct { - * NameType name_type; - * select(name_type) { - * case host_name: HostName; - * } name; - * } ServerName; - * - * enum { - * host_name(0), (255) - * } NameType; - * - * opaque HostName<1..2^16-1>; - * - * struct { - * ServerName server_name_list<1..2^16-1> - * } ServerNameList; - */ - var serverName = forge.util.createBuffer(); - serverName.putByte(0x00); // type host_name - writeVector(serverName, 2, forge.util.createBuffer(c.virtualHost)); - - // ServerNameList is in extension_data - var snList = forge.util.createBuffer(); - writeVector(snList, 2, serverName); - writeVector(ext, 2, snList); - extensions.putBuffer(ext); - } - var extLength = extensions.length(); - if(extLength > 0) { - // add extension vector length - extLength += 2; - } - - // determine length of the handshake message - // cipher suites and compression methods size will need to be - // updated if more get added to the list - var sessionId = c.session.id; - var length = - sessionId.length + 1 + // session ID vector - 2 + // version (major + minor) - 4 + 28 + // random time and random bytes - 2 + cSuites + // cipher suites vector - 1 + cMethods + // compression methods vector - extLength; // extensions vector - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.client_hello); - rval.putInt24(length); // handshake length - rval.putByte(c.version.major); // major version - rval.putByte(c.version.minor); // minor version - rval.putBytes(c.session.sp.client_random); // random time + bytes - writeVector(rval, 1, forge.util.createBuffer(sessionId)); - writeVector(rval, 2, cipherSuites); - writeVector(rval, 1, compressionMethods); - if(extLength > 0) { - writeVector(rval, 2, extensions); - } - return rval; -}; - -/** - * Creates a ServerHello message. - * - * @param c the connection. - * - * @return the ServerHello byte buffer. - */ -tls.createServerHello = function(c) { - // determine length of the handshake message - var sessionId = c.session.id; - var length = - sessionId.length + 1 + // session ID vector - 2 + // version (major + minor) - 4 + 28 + // random time and random bytes - 2 + // chosen cipher suite - 1; // chosen compression method - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.server_hello); - rval.putInt24(length); // handshake length - rval.putByte(c.version.major); // major version - rval.putByte(c.version.minor); // minor version - rval.putBytes(c.session.sp.server_random); // random time + bytes - writeVector(rval, 1, forge.util.createBuffer(sessionId)); - rval.putByte(c.session.cipherSuite.id[0]); - rval.putByte(c.session.cipherSuite.id[1]); - rval.putByte(c.session.compressionMethod); - return rval; -}; - -/** - * Creates a Certificate message. - * - * When this message will be sent: - * This is the first message the client can send after receiving a server - * hello done message and the first message the server can send after - * sending a ServerHello. This client message is only sent if the server - * requests a certificate. If no suitable certificate is available, the - * client should send a certificate message containing no certificates. If - * client authentication is required by the server for the handshake to - * continue, it may respond with a fatal handshake failure alert. - * - * opaque ASN.1Cert<1..2^24-1>; - * - * struct { - * ASN.1Cert certificate_list<0..2^24-1>; - * } Certificate; - * - * @param c the connection. - * - * @return the Certificate byte buffer. - */ -tls.createCertificate = function(c) { - // TODO: check certificate request to ensure types are supported - - // get a certificate (a certificate as a PEM string) - var client = (c.entity === tls.ConnectionEnd.client); - var cert = null; - if(c.getCertificate) { - var hint; - if(client) { - hint = c.session.certificateRequest; - } else { - hint = c.session.extensions.server_name.serverNameList; - } - cert = c.getCertificate(c, hint); - } - - // buffer to hold certificate list - var certList = forge.util.createBuffer(); - if(cert !== null) { - try { - // normalize cert to a chain of certificates - if(!forge.util.isArray(cert)) { - cert = [cert]; - } - var asn1 = null; - for(var i = 0; i < cert.length; ++i) { - var msg = forge.pem.decode(cert[i])[0]; - if(msg.type !== 'CERTIFICATE' && - msg.type !== 'X509 CERTIFICATE' && - msg.type !== 'TRUSTED CERTIFICATE') { - var error = new Error('Could not convert certificate from PEM; PEM ' + - 'header type is not "CERTIFICATE", "X509 CERTIFICATE", or ' + - '"TRUSTED CERTIFICATE".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert certificate from PEM; PEM is encrypted.'); - } - - var der = forge.util.createBuffer(msg.body); - if(asn1 === null) { - asn1 = forge.asn1.fromDer(der.bytes(), false); - } - - // certificate entry is itself a vector with 3 length bytes - var certBuffer = forge.util.createBuffer(); - writeVector(certBuffer, 3, der); - - // add cert vector to cert list vector - certList.putBuffer(certBuffer); - } - - // save certificate - cert = forge.pki.certificateFromAsn1(asn1); - if(client) { - c.session.clientCertificate = cert; - } else { - c.session.serverCertificate = cert; - } - } catch(ex) { - return c.error(c, { - message: 'Could not send certificate list.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.bad_certificate - } - }); - } - } - - // determine length of the handshake message - var length = 3 + certList.length(); // cert list vector - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.certificate); - rval.putInt24(length); - writeVector(rval, 3, certList); - return rval; -}; - -/** - * Creates a ClientKeyExchange message. - * - * When this message will be sent: - * This message is always sent by the client. It will immediately follow the - * client certificate message, if it is sent. Otherwise it will be the first - * message sent by the client after it receives the server hello done - * message. - * - * Meaning of this message: - * With this message, the premaster secret is set, either though direct - * transmission of the RSA-encrypted secret, or by the transmission of - * Diffie-Hellman parameters which will allow each side to agree upon the - * same premaster secret. When the key exchange method is DH_RSA or DH_DSS, - * client certification has been requested, and the client was able to - * respond with a certificate which contained a Diffie-Hellman public key - * whose parameters (group and generator) matched those specified by the - * server in its certificate, this message will not contain any data. - * - * Meaning of this message: - * If RSA is being used for key agreement and authentication, the client - * generates a 48-byte premaster secret, encrypts it using the public key - * from the server's certificate or the temporary RSA key provided in a - * server key exchange message, and sends the result in an encrypted - * premaster secret message. This structure is a variant of the client - * key exchange message, not a message in itself. - * - * struct { - * select(KeyExchangeAlgorithm) { - * case rsa: EncryptedPreMasterSecret; - * case diffie_hellman: ClientDiffieHellmanPublic; - * } exchange_keys; - * } ClientKeyExchange; - * - * struct { - * ProtocolVersion client_version; - * opaque random[46]; - * } PreMasterSecret; - * - * struct { - * public-key-encrypted PreMasterSecret pre_master_secret; - * } EncryptedPreMasterSecret; - * - * A public-key-encrypted element is encoded as a vector <0..2^16-1>. - * - * @param c the connection. - * - * @return the ClientKeyExchange byte buffer. - */ -tls.createClientKeyExchange = function(c) { - // create buffer to encrypt - var b = forge.util.createBuffer(); - - // add highest client-supported protocol to help server avoid version - // rollback attacks - b.putByte(c.session.clientHelloVersion.major); - b.putByte(c.session.clientHelloVersion.minor); - - // generate and add 46 random bytes - b.putBytes(forge.random.getBytes(46)); - - // save pre-master secret - var sp = c.session.sp; - sp.pre_master_secret = b.getBytes(); - - // RSA-encrypt the pre-master secret - var key = c.session.serverCertificate.publicKey; - b = key.encrypt(sp.pre_master_secret); - - /* Note: The encrypted pre-master secret will be stored in a - public-key-encrypted opaque vector that has the length prefixed using - 2 bytes, so include those 2 bytes in the handshake message length. This - is done as a minor optimization instead of calling writeVector(). */ - - // determine length of the handshake message - var length = b.length + 2; - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.client_key_exchange); - rval.putInt24(length); - // add vector length bytes - rval.putInt16(b.length); - rval.putBytes(b); - return rval; -}; - -/** - * Creates a ServerKeyExchange message. - * - * @param c the connection. - * - * @return the ServerKeyExchange byte buffer. - */ -tls.createServerKeyExchange = function(c) { - // this implementation only supports RSA, no Diffie-Hellman support, - // so this record is empty - - // determine length of the handshake message - var length = 0; - - // build record fragment - var rval = forge.util.createBuffer(); - if(length > 0) { - rval.putByte(tls.HandshakeType.server_key_exchange); - rval.putInt24(length); - } - return rval; -}; - -/** - * Gets the signed data used to verify a client-side certificate. See - * tls.createCertificateVerify() for details. - * - * @param c the connection. - * @param callback the callback to call once the signed data is ready. - */ -tls.getClientSignature = function(c, callback) { - // generate data to RSA encrypt - var b = forge.util.createBuffer(); - b.putBuffer(c.session.md5.digest()); - b.putBuffer(c.session.sha1.digest()); - b = b.getBytes(); - - // create default signing function as necessary - c.getSignature = c.getSignature || function(c, b, callback) { - // do rsa encryption, call callback - var privateKey = null; - if(c.getPrivateKey) { - try { - privateKey = c.getPrivateKey(c, c.session.clientCertificate); - privateKey = forge.pki.privateKeyFromPem(privateKey); - } catch(ex) { - c.error(c, { - message: 'Could not get private key.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - } - if(privateKey === null) { - c.error(c, { - message: 'No private key set.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } else { - b = privateKey.sign(b, null); - } - callback(c, b); - }; - - // get client signature - c.getSignature(c, b, callback); -}; - -/** - * Creates a CertificateVerify message. - * - * Meaning of this message: - * This structure conveys the client's Diffie-Hellman public value - * (Yc) if it was not already included in the client's certificate. - * The encoding used for Yc is determined by the enumerated - * PublicValueEncoding. This structure is a variant of the client - * key exchange message, not a message in itself. - * - * When this message will be sent: - * This message is used to provide explicit verification of a client - * certificate. This message is only sent following a client - * certificate that has signing capability (i.e. all certificates - * except those containing fixed Diffie-Hellman parameters). When - * sent, it will immediately follow the client key exchange message. - * - * struct { - * Signature signature; - * } CertificateVerify; - * - * CertificateVerify.signature.md5_hash - * MD5(handshake_messages); - * - * Certificate.signature.sha_hash - * SHA(handshake_messages); - * - * Here handshake_messages refers to all handshake messages sent or - * received starting at client hello up to but not including this - * message, including the type and length fields of the handshake - * messages. - * - * select(SignatureAlgorithm) { - * case anonymous: struct { }; - * case rsa: - * digitally-signed struct { - * opaque md5_hash[16]; - * opaque sha_hash[20]; - * }; - * case dsa: - * digitally-signed struct { - * opaque sha_hash[20]; - * }; - * } Signature; - * - * In digital signing, one-way hash functions are used as input for a - * signing algorithm. A digitally-signed element is encoded as an opaque - * vector <0..2^16-1>, where the length is specified by the signing - * algorithm and key. - * - * In RSA signing, a 36-byte structure of two hashes (one SHA and one - * MD5) is signed (encrypted with the private key). It is encoded with - * PKCS #1 block type 0 or type 1 as described in [PKCS1]. - * - * In DSS, the 20 bytes of the SHA hash are run directly through the - * Digital Signing Algorithm with no additional hashing. - * - * @param c the connection. - * @param signature the signature to include in the message. - * - * @return the CertificateVerify byte buffer. - */ -tls.createCertificateVerify = function(c, signature) { - /* Note: The signature will be stored in a "digitally-signed" opaque - vector that has the length prefixed using 2 bytes, so include those - 2 bytes in the handshake message length. This is done as a minor - optimization instead of calling writeVector(). */ - - // determine length of the handshake message - var length = signature.length + 2; - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.certificate_verify); - rval.putInt24(length); - // add vector length bytes - rval.putInt16(signature.length); - rval.putBytes(signature); - return rval; -}; - -/** - * Creates a CertificateRequest message. - * - * @param c the connection. - * - * @return the CertificateRequest byte buffer. - */ -tls.createCertificateRequest = function(c) { - // TODO: support other certificate types - var certTypes = forge.util.createBuffer(); - - // common RSA certificate type - certTypes.putByte(0x01); - - // add distinguished names from CA store - var cAs = forge.util.createBuffer(); - for(var key in c.caStore.certs) { - var cert = c.caStore.certs[key]; - var dn = forge.pki.distinguishedNameToAsn1(cert.subject); - var byteBuffer = forge.asn1.toDer(dn); - cAs.putInt16(byteBuffer.length()); - cAs.putBuffer(byteBuffer); - } - - // TODO: TLS 1.2+ has a different format - - // determine length of the handshake message - var length = - 1 + certTypes.length() + - 2 + cAs.length(); - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.certificate_request); - rval.putInt24(length); - writeVector(rval, 1, certTypes); - writeVector(rval, 2, cAs); - return rval; -}; - -/** - * Creates a ServerHelloDone message. - * - * @param c the connection. - * - * @return the ServerHelloDone byte buffer. - */ -tls.createServerHelloDone = function(c) { - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.server_hello_done); - rval.putInt24(0); - return rval; -}; - -/** - * Creates a ChangeCipherSpec message. - * - * The change cipher spec protocol exists to signal transitions in - * ciphering strategies. The protocol consists of a single message, - * which is encrypted and compressed under the current (not the pending) - * connection state. The message consists of a single byte of value 1. - * - * struct { - * enum { change_cipher_spec(1), (255) } type; - * } ChangeCipherSpec; - * - * @return the ChangeCipherSpec byte buffer. - */ -tls.createChangeCipherSpec = function() { - var rval = forge.util.createBuffer(); - rval.putByte(0x01); - return rval; -}; - -/** - * Creates a Finished message. - * - * struct { - * opaque verify_data[12]; - * } Finished; - * - * verify_data - * PRF(master_secret, finished_label, MD5(handshake_messages) + - * SHA-1(handshake_messages)) [0..11]; - * - * finished_label - * For Finished messages sent by the client, the string "client - * finished". For Finished messages sent by the server, the - * string "server finished". - * - * handshake_messages - * All of the data from all handshake messages up to but not - * including this message. This is only data visible at the - * handshake layer and does not include record layer headers. - * This is the concatenation of all the Handshake structures as - * defined in 7.4 exchanged thus far. - * - * @param c the connection. - * - * @return the Finished byte buffer. - */ -tls.createFinished = function(c) { - // generate verify_data - var b = forge.util.createBuffer(); - b.putBuffer(c.session.md5.digest()); - b.putBuffer(c.session.sha1.digest()); - - // TODO: determine prf function and verify length for TLS 1.2 - var client = (c.entity === tls.ConnectionEnd.client); - var sp = c.session.sp; - var vdl = 12; - var prf = prf_TLS1; - var label = client ? 'client finished' : 'server finished'; - b = prf(sp.master_secret, label, b.getBytes(), vdl); - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.finished); - rval.putInt24(b.length()); - rval.putBuffer(b); - return rval; -}; - -/** - * Creates a HeartbeatMessage (See RFC 6520). - * - * struct { - * HeartbeatMessageType type; - * uint16 payload_length; - * opaque payload[HeartbeatMessage.payload_length]; - * opaque padding[padding_length]; - * } HeartbeatMessage; - * - * The total length of a HeartbeatMessage MUST NOT exceed 2^14 or - * max_fragment_length when negotiated as defined in [RFC6066]. - * - * type: The message type, either heartbeat_request or heartbeat_response. - * - * payload_length: The length of the payload. - * - * payload: The payload consists of arbitrary content. - * - * padding: The padding is random content that MUST be ignored by the - * receiver. The length of a HeartbeatMessage is TLSPlaintext.length - * for TLS and DTLSPlaintext.length for DTLS. Furthermore, the - * length of the type field is 1 byte, and the length of the - * payload_length is 2. Therefore, the padding_length is - * TLSPlaintext.length - payload_length - 3 for TLS and - * DTLSPlaintext.length - payload_length - 3 for DTLS. The - * padding_length MUST be at least 16. - * - * The sender of a HeartbeatMessage MUST use a random padding of at - * least 16 bytes. The padding of a received HeartbeatMessage message - * MUST be ignored. - * - * If the payload_length of a received HeartbeatMessage is too large, - * the received HeartbeatMessage MUST be discarded silently. - * - * @param c the connection. - * @param type the tls.HeartbeatMessageType. - * @param payload the heartbeat data to send as the payload. - * @param [payloadLength] the payload length to use, defaults to the - * actual payload length. - * - * @return the HeartbeatRequest byte buffer. - */ -tls.createHeartbeat = function(type, payload, payloadLength) { - if(typeof payloadLength === 'undefined') { - payloadLength = payload.length; - } - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(type); // heartbeat message type - rval.putInt16(payloadLength); // payload length - rval.putBytes(payload); // payload - // padding - var plaintextLength = rval.length(); - var paddingLength = Math.max(16, plaintextLength - payloadLength - 3); - rval.putBytes(forge.random.getBytes(paddingLength)); - return rval; -}; - -/** - * Fragments, compresses, encrypts, and queues a record for delivery. - * - * @param c the connection. - * @param record the record to queue. - */ -tls.queue = function(c, record) { - // error during record creation - if(!record) { - return; - } - - if(record.fragment.length() === 0) { - if(record.type === tls.ContentType.handshake || - record.type === tls.ContentType.alert || - record.type === tls.ContentType.change_cipher_spec) { - // Empty handshake, alert of change cipher spec messages are not allowed per the TLS specification and should not be sent. - return; - } - } - - // if the record is a handshake record, update handshake hashes - if(record.type === tls.ContentType.handshake) { - var bytes = record.fragment.bytes(); - c.session.md5.update(bytes); - c.session.sha1.update(bytes); - bytes = null; - } - - // handle record fragmentation - var records; - if(record.fragment.length() <= tls.MaxFragment) { - records = [record]; - } else { - // fragment data as long as it is too long - records = []; - var data = record.fragment.bytes(); - while(data.length > tls.MaxFragment) { - records.push(tls.createRecord(c, { - type: record.type, - data: forge.util.createBuffer(data.slice(0, tls.MaxFragment)) - })); - data = data.slice(tls.MaxFragment); - } - // add last record - if(data.length > 0) { - records.push(tls.createRecord(c, { - type: record.type, - data: forge.util.createBuffer(data) - })); - } - } - - // compress and encrypt all fragmented records - for(var i = 0; i < records.length && !c.fail; ++i) { - // update the record using current write state - var rec = records[i]; - var s = c.state.current.write; - if(s.update(c, rec)) { - // store record - c.records.push(rec); - } - } -}; - -/** - * Flushes all queued records to the output buffer and calls the - * tlsDataReady() handler on the given connection. - * - * @param c the connection. - * - * @return true on success, false on failure. - */ -tls.flush = function(c) { - for(var i = 0; i < c.records.length; ++i) { - var record = c.records[i]; - - // add record header and fragment - c.tlsData.putByte(record.type); - c.tlsData.putByte(record.version.major); - c.tlsData.putByte(record.version.minor); - c.tlsData.putInt16(record.fragment.length()); - c.tlsData.putBuffer(c.records[i].fragment); - } - c.records = []; - return c.tlsDataReady(c); -}; - -/** - * Maps a pki.certificateError to a tls.Alert.Description. - * - * @param error the error to map. - * - * @return the alert description. - */ -var _certErrorToAlertDesc = function(error) { - switch(error) { - case true: - return true; - case forge.pki.certificateError.bad_certificate: - return tls.Alert.Description.bad_certificate; - case forge.pki.certificateError.unsupported_certificate: - return tls.Alert.Description.unsupported_certificate; - case forge.pki.certificateError.certificate_revoked: - return tls.Alert.Description.certificate_revoked; - case forge.pki.certificateError.certificate_expired: - return tls.Alert.Description.certificate_expired; - case forge.pki.certificateError.certificate_unknown: - return tls.Alert.Description.certificate_unknown; - case forge.pki.certificateError.unknown_ca: - return tls.Alert.Description.unknown_ca; - default: - return tls.Alert.Description.bad_certificate; - } -}; - -/** - * Maps a tls.Alert.Description to a pki.certificateError. - * - * @param desc the alert description. - * - * @return the certificate error. - */ -var _alertDescToCertError = function(desc) { - switch(desc) { - case true: - return true; - case tls.Alert.Description.bad_certificate: - return forge.pki.certificateError.bad_certificate; - case tls.Alert.Description.unsupported_certificate: - return forge.pki.certificateError.unsupported_certificate; - case tls.Alert.Description.certificate_revoked: - return forge.pki.certificateError.certificate_revoked; - case tls.Alert.Description.certificate_expired: - return forge.pki.certificateError.certificate_expired; - case tls.Alert.Description.certificate_unknown: - return forge.pki.certificateError.certificate_unknown; - case tls.Alert.Description.unknown_ca: - return forge.pki.certificateError.unknown_ca; - default: - return forge.pki.certificateError.bad_certificate; - } -}; - -/** - * Verifies a certificate chain against the given connection's - * Certificate Authority store. - * - * @param c the TLS connection. - * @param chain the certificate chain to verify, with the root or highest - * authority at the end. - * - * @return true if successful, false if not. - */ -tls.verifyCertificateChain = function(c, chain) { - try { - // Make a copy of c.verifyOptions so that we can modify options.verify - // without modifying c.verifyOptions. - var options = {}; - for (var key in c.verifyOptions) { - options[key] = c.verifyOptions[key]; - } - - options.verify = function(vfd, depth, chain) { - // convert pki.certificateError to tls alert description - var desc = _certErrorToAlertDesc(vfd); - - // call application callback - var ret = c.verify(c, vfd, depth, chain); - if(ret !== true) { - if(typeof ret === 'object' && !forge.util.isArray(ret)) { - // throw custom error - var error = new Error('The application rejected the certificate.'); - error.send = true; - error.alert = { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.bad_certificate - }; - if(ret.message) { - error.message = ret.message; - } - if(ret.alert) { - error.alert.description = ret.alert; - } - throw error; - } - - // convert tls alert description to pki.certificateError - if(ret !== vfd) { - ret = _alertDescToCertError(ret); - } - } - - return ret; - }; - - // verify chain - forge.pki.verifyCertificateChain(c.caStore, chain, options); - } catch(ex) { - // build tls error if not already customized - var err = ex; - if(typeof err !== 'object' || forge.util.isArray(err)) { - err = { - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: _certErrorToAlertDesc(ex) - } - }; - } - if(!('send' in err)) { - err.send = true; - } - if(!('alert' in err)) { - err.alert = { - level: tls.Alert.Level.fatal, - description: _certErrorToAlertDesc(err.error) - }; - } - - // send error - c.error(c, err); - } - - return !c.fail; -}; - -/** - * Creates a new TLS session cache. - * - * @param cache optional map of session ID to cached session. - * @param capacity the maximum size for the cache (default: 100). - * - * @return the new TLS session cache. - */ -tls.createSessionCache = function(cache, capacity) { - var rval = null; - - // assume input is already a session cache object - if(cache && cache.getSession && cache.setSession && cache.order) { - rval = cache; - } else { - // create cache - rval = {}; - rval.cache = cache || {}; - rval.capacity = Math.max(capacity || 100, 1); - rval.order = []; - - // store order for sessions, delete session overflow - for(var key in cache) { - if(rval.order.length <= capacity) { - rval.order.push(key); - } else { - delete cache[key]; - } - } - - // get a session from a session ID (or get any session) - rval.getSession = function(sessionId) { - var session = null; - var key = null; - - // if session ID provided, use it - if(sessionId) { - key = forge.util.bytesToHex(sessionId); - } else if(rval.order.length > 0) { - // get first session from cache - key = rval.order[0]; - } - - if(key !== null && key in rval.cache) { - // get cached session and remove from cache - session = rval.cache[key]; - delete rval.cache[key]; - for(var i in rval.order) { - if(rval.order[i] === key) { - rval.order.splice(i, 1); - break; - } - } - } - - return session; - }; - - // set a session in the cache - rval.setSession = function(sessionId, session) { - // remove session from cache if at capacity - if(rval.order.length === rval.capacity) { - var key = rval.order.shift(); - delete rval.cache[key]; - } - // add session to cache - var key = forge.util.bytesToHex(sessionId); - rval.order.push(key); - rval.cache[key] = session; - }; - } - - return rval; -}; - -/** - * Creates a new TLS connection. - * - * See public createConnection() docs for more details. - * - * @param options the options for this connection. - * - * @return the new TLS connection. - */ -tls.createConnection = function(options) { - var caStore = null; - if(options.caStore) { - // if CA store is an array, convert it to a CA store object - if(forge.util.isArray(options.caStore)) { - caStore = forge.pki.createCaStore(options.caStore); - } else { - caStore = options.caStore; - } - } else { - // create empty CA store - caStore = forge.pki.createCaStore(); - } - - // setup default cipher suites - var cipherSuites = options.cipherSuites || null; - if(cipherSuites === null) { - cipherSuites = []; - for(var key in tls.CipherSuites) { - cipherSuites.push(tls.CipherSuites[key]); - } - } - - // set default entity - var entity = (options.server || false) ? - tls.ConnectionEnd.server : tls.ConnectionEnd.client; - - // create session cache if requested - var sessionCache = options.sessionCache ? - tls.createSessionCache(options.sessionCache) : null; - - // create TLS connection - var c = { - version: {major: tls.Version.major, minor: tls.Version.minor}, - entity: entity, - sessionId: options.sessionId, - caStore: caStore, - sessionCache: sessionCache, - cipherSuites: cipherSuites, - connected: options.connected, - virtualHost: options.virtualHost || null, - verifyClient: options.verifyClient || false, - verify: options.verify || function(cn, vfd, dpth, cts) {return vfd;}, - verifyOptions: options.verifyOptions || {}, - getCertificate: options.getCertificate || null, - getPrivateKey: options.getPrivateKey || null, - getSignature: options.getSignature || null, - input: forge.util.createBuffer(), - tlsData: forge.util.createBuffer(), - data: forge.util.createBuffer(), - tlsDataReady: options.tlsDataReady, - dataReady: options.dataReady, - heartbeatReceived: options.heartbeatReceived, - closed: options.closed, - error: function(c, ex) { - // set origin if not set - ex.origin = ex.origin || - ((c.entity === tls.ConnectionEnd.client) ? 'client' : 'server'); - - // send TLS alert - if(ex.send) { - tls.queue(c, tls.createAlert(c, ex.alert)); - tls.flush(c); - } - - // error is fatal by default - var fatal = (ex.fatal !== false); - if(fatal) { - // set fail flag - c.fail = true; - } - - // call error handler first - options.error(c, ex); - - if(fatal) { - // fatal error, close connection, do not clear fail - c.close(false); - } - }, - deflate: options.deflate || null, - inflate: options.inflate || null - }; - - /** - * Resets a closed TLS connection for reuse. Called in c.close(). - * - * @param clearFail true to clear the fail flag (default: true). - */ - c.reset = function(clearFail) { - c.version = {major: tls.Version.major, minor: tls.Version.minor}; - c.record = null; - c.session = null; - c.peerCertificate = null; - c.state = { - pending: null, - current: null - }; - c.expect = (c.entity === tls.ConnectionEnd.client) ? SHE : CHE; - c.fragmented = null; - c.records = []; - c.open = false; - c.handshakes = 0; - c.handshaking = false; - c.isConnected = false; - c.fail = !(clearFail || typeof(clearFail) === 'undefined'); - c.input.clear(); - c.tlsData.clear(); - c.data.clear(); - c.state.current = tls.createConnectionState(c); - }; - - // do initial reset of connection - c.reset(); - - /** - * Updates the current TLS engine state based on the given record. - * - * @param c the TLS connection. - * @param record the TLS record to act on. - */ - var _update = function(c, record) { - // get record handler (align type in table by subtracting lowest) - var aligned = record.type - tls.ContentType.change_cipher_spec; - var handlers = ctTable[c.entity][c.expect]; - if(aligned in handlers) { - handlers[aligned](c, record); - } else { - // unexpected record - tls.handleUnexpected(c, record); - } - }; - - /** - * Reads the record header and initializes the next record on the given - * connection. - * - * @param c the TLS connection with the next record. - * - * @return 0 if the input data could be processed, otherwise the - * number of bytes required for data to be processed. - */ - var _readRecordHeader = function(c) { - var rval = 0; - - // get input buffer and its length - var b = c.input; - var len = b.length(); - - // need at least 5 bytes to initialize a record - if(len < 5) { - rval = 5 - len; - } else { - // enough bytes for header - // initialize record - c.record = { - type: b.getByte(), - version: { - major: b.getByte(), - minor: b.getByte() - }, - length: b.getInt16(), - fragment: forge.util.createBuffer(), - ready: false - }; - - // check record version - var compatibleVersion = (c.record.version.major === c.version.major); - if(compatibleVersion && c.session && c.session.version) { - // session version already set, require same minor version - compatibleVersion = (c.record.version.minor === c.version.minor); - } - if(!compatibleVersion) { - c.error(c, { - message: 'Incompatible TLS version.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.protocol_version - } - }); - } - } - - return rval; - }; - - /** - * Reads the next record's contents and appends its message to any - * previously fragmented message. - * - * @param c the TLS connection with the next record. - * - * @return 0 if the input data could be processed, otherwise the - * number of bytes required for data to be processed. - */ - var _readRecord = function(c) { - var rval = 0; - - // ensure there is enough input data to get the entire record - var b = c.input; - var len = b.length(); - if(len < c.record.length) { - // not enough data yet, return how much is required - rval = c.record.length - len; - } else { - // there is enough data to parse the pending record - // fill record fragment and compact input buffer - c.record.fragment.putBytes(b.getBytes(c.record.length)); - b.compact(); - - // update record using current read state - var s = c.state.current.read; - if(s.update(c, c.record)) { - // see if there is a previously fragmented message that the - // new record's message fragment should be appended to - if(c.fragmented !== null) { - // if the record type matches a previously fragmented - // record, append the record fragment to it - if(c.fragmented.type === c.record.type) { - // concatenate record fragments - c.fragmented.fragment.putBuffer(c.record.fragment); - c.record = c.fragmented; - } else { - // error, invalid fragmented record - c.error(c, { - message: 'Invalid fragmented record.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: - tls.Alert.Description.unexpected_message - } - }); - } - } - - // record is now ready - c.record.ready = true; - } - } - - return rval; - }; - - /** - * Performs a handshake using the TLS Handshake Protocol, as a client. - * - * This method should only be called if the connection is in client mode. - * - * @param sessionId the session ID to use, null to start a new one. - */ - c.handshake = function(sessionId) { - // error to call this in non-client mode - if(c.entity !== tls.ConnectionEnd.client) { - // not fatal error - c.error(c, { - message: 'Cannot initiate handshake as a server.', - fatal: false - }); - } else if(c.handshaking) { - // handshake is already in progress, fail but not fatal error - c.error(c, { - message: 'Handshake already in progress.', - fatal: false - }); - } else { - // clear fail flag on reuse - if(c.fail && !c.open && c.handshakes === 0) { - c.fail = false; - } - - // now handshaking - c.handshaking = true; - - // default to blank (new session) - sessionId = sessionId || ''; - - // if a session ID was specified, try to find it in the cache - var session = null; - if(sessionId.length > 0) { - if(c.sessionCache) { - session = c.sessionCache.getSession(sessionId); - } - - // matching session not found in cache, clear session ID - if(session === null) { - sessionId = ''; - } - } - - // no session given, grab a session from the cache, if available - if(sessionId.length === 0 && c.sessionCache) { - session = c.sessionCache.getSession(); - if(session !== null) { - sessionId = session.id; - } - } - - // set up session - c.session = { - id: sessionId, - version: null, - cipherSuite: null, - compressionMethod: null, - serverCertificate: null, - certificateRequest: null, - clientCertificate: null, - sp: {}, - md5: forge.md.md5.create(), - sha1: forge.md.sha1.create() - }; - - // use existing session information - if(session) { - // only update version on connection, session version not yet set - c.version = session.version; - c.session.sp = session.sp; - } - - // generate new client random - c.session.sp.client_random = tls.createRandom().getBytes(); - - // connection now open - c.open = true; - - // send hello - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createClientHello(c) - })); - tls.flush(c); - } - }; - - /** - * Called when TLS protocol data has been received from somewhere and should - * be processed by the TLS engine. - * - * @param data the TLS protocol data, as a string, to process. - * - * @return 0 if the data could be processed, otherwise the number of bytes - * required for data to be processed. - */ - c.process = function(data) { - var rval = 0; - - // buffer input data - if(data) { - c.input.putBytes(data); - } - - // process next record if no failure, process will be called after - // each record is handled (since handling can be asynchronous) - if(!c.fail) { - // reset record if ready and now empty - if(c.record !== null && - c.record.ready && c.record.fragment.isEmpty()) { - c.record = null; - } - - // if there is no pending record, try to read record header - if(c.record === null) { - rval = _readRecordHeader(c); - } - - // read the next record (if record not yet ready) - if(!c.fail && c.record !== null && !c.record.ready) { - rval = _readRecord(c); - } - - // record ready to be handled, update engine state - if(!c.fail && c.record !== null && c.record.ready) { - _update(c, c.record); - } - } - - return rval; - }; - - /** - * Requests that application data be packaged into a TLS record. The - * tlsDataReady handler will be called when the TLS record(s) have been - * prepared. - * - * @param data the application data, as a raw 'binary' encoded string, to - * be sent; to send utf-16/utf-8 string data, use the return value - * of util.encodeUtf8(str). - * - * @return true on success, false on failure. - */ - c.prepare = function(data) { - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.application_data, - data: forge.util.createBuffer(data) - })); - return tls.flush(c); - }; - - /** - * Requests that a heartbeat request be packaged into a TLS record for - * transmission. The tlsDataReady handler will be called when TLS record(s) - * have been prepared. - * - * When a heartbeat response has been received, the heartbeatReceived - * handler will be called with the matching payload. This handler can - * be used to clear a retransmission timer, etc. - * - * @param payload the heartbeat data to send as the payload in the message. - * @param [payloadLength] the payload length to use, defaults to the - * actual payload length. - * - * @return true on success, false on failure. - */ - c.prepareHeartbeatRequest = function(payload, payloadLength) { - if(payload instanceof forge.util.ByteBuffer) { - payload = payload.bytes(); - } - if(typeof payloadLength === 'undefined') { - payloadLength = payload.length; - } - c.expectedHeartbeatPayload = payload; - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.heartbeat, - data: tls.createHeartbeat( - tls.HeartbeatMessageType.heartbeat_request, payload, payloadLength) - })); - return tls.flush(c); - }; - - /** - * Closes the connection (sends a close_notify alert). - * - * @param clearFail true to clear the fail flag (default: true). - */ - c.close = function(clearFail) { - // save session if connection didn't fail - if(!c.fail && c.sessionCache && c.session) { - // only need to preserve session ID, version, and security params - var session = { - id: c.session.id, - version: c.session.version, - sp: c.session.sp - }; - session.sp.keys = null; - c.sessionCache.setSession(session.id, session); - } - - if(c.open) { - // connection no longer open, clear input - c.open = false; - c.input.clear(); - - // if connected or handshaking, send an alert - if(c.isConnected || c.handshaking) { - c.isConnected = c.handshaking = false; - - // send close_notify alert - tls.queue(c, tls.createAlert(c, { - level: tls.Alert.Level.warning, - description: tls.Alert.Description.close_notify - })); - tls.flush(c); - } - - // call handler - c.closed(c); - } - - // reset TLS connection, do not clear fail flag - c.reset(clearFail); - }; - - return c; -}; - -/* TLS API */ -module.exports = forge.tls = forge.tls || {}; - -// expose non-functions -for(var key in tls) { - if(typeof tls[key] !== 'function') { - forge.tls[key] = tls[key]; - } -} - -// expose prf_tls1 for testing -forge.tls.prf_tls1 = prf_TLS1; - -// expose sha1 hmac method -forge.tls.hmac_sha1 = hmac_sha1; - -// expose session cache creation -forge.tls.createSessionCache = tls.createSessionCache; - -/** - * Creates a new TLS connection. This does not make any assumptions about the - * transport layer that TLS is working on top of, ie: it does not assume there - * is a TCP/IP connection or establish one. A TLS connection is totally - * abstracted away from the layer is runs on top of, it merely establishes a - * secure channel between a client" and a "server". - * - * A TLS connection contains 4 connection states: pending read and write, and - * current read and write. - * - * At initialization, the current read and write states will be null. Only once - * the security parameters have been set and the keys have been generated can - * the pending states be converted into current states. Current states will be - * updated for each record processed. - * - * A custom certificate verify callback may be provided to check information - * like the common name on the server's certificate. It will be called for - * every certificate in the chain. It has the following signature: - * - * variable func(c, certs, index, preVerify) - * Where: - * c The TLS connection - * verified Set to true if certificate was verified, otherwise the alert - * tls.Alert.Description for why the certificate failed. - * depth The current index in the chain, where 0 is the server's cert. - * certs The certificate chain, *NOTE* if the server was anonymous then - * the chain will be empty. - * - * The function returns true on success and on failure either the appropriate - * tls.Alert.Description or an object with 'alert' set to the appropriate - * tls.Alert.Description and 'message' set to a custom error message. If true - * is not returned then the connection will abort using, in order of - * availability, first the returned alert description, second the preVerify - * alert description, and lastly the default 'bad_certificate'. - * - * There are three callbacks that can be used to make use of client-side - * certificates where each takes the TLS connection as the first parameter: - * - * getCertificate(conn, hint) - * The second parameter is a hint as to which certificate should be - * returned. If the connection entity is a client, then the hint will be - * the CertificateRequest message from the server that is part of the - * TLS protocol. If the connection entity is a server, then it will be - * the servername list provided via an SNI extension the ClientHello, if - * one was provided (empty array if not). The hint can be examined to - * determine which certificate to use (advanced). Most implementations - * will just return a certificate. The return value must be a - * PEM-formatted certificate or an array of PEM-formatted certificates - * that constitute a certificate chain, with the first in the array/chain - * being the client's certificate. - * getPrivateKey(conn, certificate) - * The second parameter is an forge.pki X.509 certificate object that - * is associated with the requested private key. The return value must - * be a PEM-formatted private key. - * getSignature(conn, bytes, callback) - * This callback can be used instead of getPrivateKey if the private key - * is not directly accessible in javascript or should not be. For - * instance, a secure external web service could provide the signature - * in exchange for appropriate credentials. The second parameter is a - * string of bytes to be signed that are part of the TLS protocol. These - * bytes are used to verify that the private key for the previously - * provided client-side certificate is accessible to the client. The - * callback is a function that takes 2 parameters, the TLS connection - * and the RSA encrypted (signed) bytes as a string. This callback must - * be called once the signature is ready. - * - * @param options the options for this connection: - * server: true if the connection is server-side, false for client. - * sessionId: a session ID to reuse, null for a new connection. - * caStore: an array of certificates to trust. - * sessionCache: a session cache to use. - * cipherSuites: an optional array of cipher suites to use, - * see tls.CipherSuites. - * connected: function(conn) called when the first handshake completes. - * virtualHost: the virtual server name to use in a TLS SNI extension. - * verifyClient: true to require a client certificate in server mode, - * 'optional' to request one, false not to (default: false). - * verify: a handler used to custom verify certificates in the chain. - * verifyOptions: an object with options for the certificate chain validation. - * See documentation of pki.verifyCertificateChain for possible options. - * verifyOptions.verify is ignored. If you wish to specify a verify handler - * use the verify key. - * getCertificate: an optional callback used to get a certificate or - * a chain of certificates (as an array). - * getPrivateKey: an optional callback used to get a private key. - * getSignature: an optional callback used to get a signature. - * tlsDataReady: function(conn) called when TLS protocol data has been - * prepared and is ready to be used (typically sent over a socket - * connection to its destination), read from conn.tlsData buffer. - * dataReady: function(conn) called when application data has - * been parsed from a TLS record and should be consumed by the - * application, read from conn.data buffer. - * closed: function(conn) called when the connection has been closed. - * error: function(conn, error) called when there was an error. - * deflate: function(inBytes) if provided, will deflate TLS records using - * the deflate algorithm if the server supports it. - * inflate: function(inBytes) if provided, will inflate TLS records using - * the deflate algorithm if the server supports it. - * - * @return the new TLS connection. - */ -forge.tls.createConnection = tls.createConnection; diff --git a/node_modules/node-forge/lib/tlssocket.js b/node_modules/node-forge/lib/tlssocket.js deleted file mode 100644 index d09b6509..00000000 --- a/node_modules/node-forge/lib/tlssocket.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Socket wrapping functions for TLS. - * - * @author Dave Longley - * - * Copyright (c) 2009-2012 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./tls'); - -/** - * Wraps a forge.net socket with a TLS layer. - * - * @param options: - * sessionId: a session ID to reuse, null for a new connection if no session - * cache is provided or it is empty. - * caStore: an array of certificates to trust. - * sessionCache: a session cache to use. - * cipherSuites: an optional array of cipher suites to use, see - * tls.CipherSuites. - * socket: the socket to wrap. - * virtualHost: the virtual server name to use in a TLS SNI extension. - * verify: a handler used to custom verify certificates in the chain. - * getCertificate: an optional callback used to get a certificate. - * getPrivateKey: an optional callback used to get a private key. - * getSignature: an optional callback used to get a signature. - * deflate: function(inBytes) if provided, will deflate TLS records using - * the deflate algorithm if the server supports it. - * inflate: function(inBytes) if provided, will inflate TLS records using - * the deflate algorithm if the server supports it. - * - * @return the TLS-wrapped socket. - */ -forge.tls.wrapSocket = function(options) { - // get raw socket - var socket = options.socket; - - // create TLS socket - var tlsSocket = { - id: socket.id, - // set handlers - connected: socket.connected || function(e) {}, - closed: socket.closed || function(e) {}, - data: socket.data || function(e) {}, - error: socket.error || function(e) {} - }; - - // create TLS connection - var c = forge.tls.createConnection({ - server: false, - sessionId: options.sessionId || null, - caStore: options.caStore || [], - sessionCache: options.sessionCache || null, - cipherSuites: options.cipherSuites || null, - virtualHost: options.virtualHost, - verify: options.verify, - getCertificate: options.getCertificate, - getPrivateKey: options.getPrivateKey, - getSignature: options.getSignature, - deflate: options.deflate, - inflate: options.inflate, - connected: function(c) { - // first handshake complete, call handler - if(c.handshakes === 1) { - tlsSocket.connected({ - id: socket.id, - type: 'connect', - bytesAvailable: c.data.length() - }); - } - }, - tlsDataReady: function(c) { - // send TLS data over socket - return socket.send(c.tlsData.getBytes()); - }, - dataReady: function(c) { - // indicate application data is ready - tlsSocket.data({ - id: socket.id, - type: 'socketData', - bytesAvailable: c.data.length() - }); - }, - closed: function(c) { - // close socket - socket.close(); - }, - error: function(c, e) { - // send error, close socket - tlsSocket.error({ - id: socket.id, - type: 'tlsError', - message: e.message, - bytesAvailable: 0, - error: e - }); - socket.close(); - } - }); - - // handle doing handshake after connecting - socket.connected = function(e) { - c.handshake(options.sessionId); - }; - - // handle closing TLS connection - socket.closed = function(e) { - if(c.open && c.handshaking) { - // error - tlsSocket.error({ - id: socket.id, - type: 'ioError', - message: 'Connection closed during handshake.', - bytesAvailable: 0 - }); - } - c.close(); - - // call socket handler - tlsSocket.closed({ - id: socket.id, - type: 'close', - bytesAvailable: 0 - }); - }; - - // handle error on socket - socket.error = function(e) { - // error - tlsSocket.error({ - id: socket.id, - type: e.type, - message: e.message, - bytesAvailable: 0 - }); - c.close(); - }; - - // handle receiving raw TLS data from socket - var _requiredBytes = 0; - socket.data = function(e) { - // drop data if connection not open - if(!c.open) { - socket.receive(e.bytesAvailable); - } else { - // only receive if there are enough bytes available to - // process a record - if(e.bytesAvailable >= _requiredBytes) { - var count = Math.max(e.bytesAvailable, _requiredBytes); - var data = socket.receive(count); - if(data !== null) { - _requiredBytes = c.process(data); - } - } - } - }; - - /** - * Destroys this socket. - */ - tlsSocket.destroy = function() { - socket.destroy(); - }; - - /** - * Sets this socket's TLS session cache. This should be called before - * the socket is connected or after it is closed. - * - * The cache is an object mapping session IDs to internal opaque state. - * An application might need to change the cache used by a particular - * tlsSocket between connections if it accesses multiple TLS hosts. - * - * @param cache the session cache to use. - */ - tlsSocket.setSessionCache = function(cache) { - c.sessionCache = tls.createSessionCache(cache); - }; - - /** - * Connects this socket. - * - * @param options: - * host: the host to connect to. - * port: the port to connect to. - * policyPort: the policy port to use (if non-default), 0 to - * use the flash default. - * policyUrl: the policy file URL to use (instead of port). - */ - tlsSocket.connect = function(options) { - socket.connect(options); - }; - - /** - * Closes this socket. - */ - tlsSocket.close = function() { - c.close(); - }; - - /** - * Determines if the socket is connected or not. - * - * @return true if connected, false if not. - */ - tlsSocket.isConnected = function() { - return c.isConnected && socket.isConnected(); - }; - - /** - * Writes bytes to this socket. - * - * @param bytes the bytes (as a string) to write. - * - * @return true on success, false on failure. - */ - tlsSocket.send = function(bytes) { - return c.prepare(bytes); - }; - - /** - * Reads bytes from this socket (non-blocking). Fewer than the number of - * bytes requested may be read if enough bytes are not available. - * - * This method should be called from the data handler if there are enough - * bytes available. To see how many bytes are available, check the - * 'bytesAvailable' property on the event in the data handler or call the - * bytesAvailable() function on the socket. If the browser is msie, then the - * bytesAvailable() function should be used to avoid race conditions. - * Otherwise, using the property on the data handler's event may be quicker. - * - * @param count the maximum number of bytes to read. - * - * @return the bytes read (as a string) or null on error. - */ - tlsSocket.receive = function(count) { - return c.data.getBytes(count); - }; - - /** - * Gets the number of bytes available for receiving on the socket. - * - * @return the number of bytes available for receiving. - */ - tlsSocket.bytesAvailable = function() { - return c.data.length(); - }; - - return tlsSocket; -}; diff --git a/node_modules/node-forge/lib/util.js b/node_modules/node-forge/lib/util.js deleted file mode 100644 index 98dfd342..00000000 --- a/node_modules/node-forge/lib/util.js +++ /dev/null @@ -1,2907 +0,0 @@ -/** - * Utility functions for web applications. - * - * @author Dave Longley - * - * Copyright (c) 2010-2018 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -var baseN = require('./baseN'); - -/* Utilities API */ -var util = module.exports = forge.util = forge.util || {}; - -// define setImmediate and nextTick -(function() { - // use native nextTick (unless we're in webpack) - // webpack (or better node-libs-browser polyfill) sets process.browser. - // this way we can detect webpack properly - if(typeof process !== 'undefined' && process.nextTick && !process.browser) { - util.nextTick = process.nextTick; - if(typeof setImmediate === 'function') { - util.setImmediate = setImmediate; - } else { - // polyfill setImmediate with nextTick, older versions of node - // (those w/o setImmediate) won't totally starve IO - util.setImmediate = util.nextTick; - } - return; - } - - // polyfill nextTick with native setImmediate - if(typeof setImmediate === 'function') { - util.setImmediate = function() { return setImmediate.apply(undefined, arguments); }; - util.nextTick = function(callback) { - return setImmediate(callback); - }; - return; - } - - /* Note: A polyfill upgrade pattern is used here to allow combining - polyfills. For example, MutationObserver is fast, but blocks UI updates, - so it needs to allow UI updates periodically, so it falls back on - postMessage or setTimeout. */ - - // polyfill with setTimeout - util.setImmediate = function(callback) { - setTimeout(callback, 0); - }; - - // upgrade polyfill to use postMessage - if(typeof window !== 'undefined' && - typeof window.postMessage === 'function') { - var msg = 'forge.setImmediate'; - var callbacks = []; - util.setImmediate = function(callback) { - callbacks.push(callback); - // only send message when one hasn't been sent in - // the current turn of the event loop - if(callbacks.length === 1) { - window.postMessage(msg, '*'); - } - }; - function handler(event) { - if(event.source === window && event.data === msg) { - event.stopPropagation(); - var copy = callbacks.slice(); - callbacks.length = 0; - copy.forEach(function(callback) { - callback(); - }); - } - } - window.addEventListener('message', handler, true); - } - - // upgrade polyfill to use MutationObserver - if(typeof MutationObserver !== 'undefined') { - // polyfill with MutationObserver - var now = Date.now(); - var attr = true; - var div = document.createElement('div'); - var callbacks = []; - new MutationObserver(function() { - var copy = callbacks.slice(); - callbacks.length = 0; - copy.forEach(function(callback) { - callback(); - }); - }).observe(div, {attributes: true}); - var oldSetImmediate = util.setImmediate; - util.setImmediate = function(callback) { - if(Date.now() - now > 15) { - now = Date.now(); - oldSetImmediate(callback); - } else { - callbacks.push(callback); - // only trigger observer when it hasn't been triggered in - // the current turn of the event loop - if(callbacks.length === 1) { - div.setAttribute('a', attr = !attr); - } - } - }; - } - - util.nextTick = util.setImmediate; -})(); - -// check if running under Node.js -util.isNodejs = - typeof process !== 'undefined' && process.versions && process.versions.node; - - -// 'self' will also work in Web Workers (instance of WorkerGlobalScope) while -// it will point to `window` in the main thread. -// To remain compatible with older browsers, we fall back to 'window' if 'self' -// is not available. -util.globalScope = (function() { - if(util.isNodejs) { - return global; - } - - return typeof self === 'undefined' ? window : self; -})(); - -// define isArray -util.isArray = Array.isArray || function(x) { - return Object.prototype.toString.call(x) === '[object Array]'; -}; - -// define isArrayBuffer -util.isArrayBuffer = function(x) { - return typeof ArrayBuffer !== 'undefined' && x instanceof ArrayBuffer; -}; - -// define isArrayBufferView -util.isArrayBufferView = function(x) { - return x && util.isArrayBuffer(x.buffer) && x.byteLength !== undefined; -}; - -/** - * Ensure a bits param is 8, 16, 24, or 32. Used to validate input for - * algorithms where bit manipulation, JavaScript limitations, and/or algorithm - * design only allow for byte operations of a limited size. - * - * @param n number of bits. - * - * Throw Error if n invalid. - */ -function _checkBitsParam(n) { - if(!(n === 8 || n === 16 || n === 24 || n === 32)) { - throw new Error('Only 8, 16, 24, or 32 bits supported: ' + n); - } -} - -// TODO: set ByteBuffer to best available backing -util.ByteBuffer = ByteStringBuffer; - -/** Buffer w/BinaryString backing */ - -/** - * Constructor for a binary string backed byte buffer. - * - * @param [b] the bytes to wrap (either encoded as string, one byte per - * character, or as an ArrayBuffer or Typed Array). - */ -function ByteStringBuffer(b) { - // TODO: update to match DataBuffer API - - // the data in this buffer - this.data = ''; - // the pointer for reading from this buffer - this.read = 0; - - if(typeof b === 'string') { - this.data = b; - } else if(util.isArrayBuffer(b) || util.isArrayBufferView(b)) { - if(typeof Buffer !== 'undefined' && b instanceof Buffer) { - this.data = b.toString('binary'); - } else { - // convert native buffer to forge buffer - // FIXME: support native buffers internally instead - var arr = new Uint8Array(b); - try { - this.data = String.fromCharCode.apply(null, arr); - } catch(e) { - for(var i = 0; i < arr.length; ++i) { - this.putByte(arr[i]); - } - } - } - } else if(b instanceof ByteStringBuffer || - (typeof b === 'object' && typeof b.data === 'string' && - typeof b.read === 'number')) { - // copy existing buffer - this.data = b.data; - this.read = b.read; - } - - // used for v8 optimization - this._constructedStringLength = 0; -} -util.ByteStringBuffer = ByteStringBuffer; - -/* Note: This is an optimization for V8-based browsers. When V8 concatenates - a string, the strings are only joined logically using a "cons string" or - "constructed/concatenated string". These containers keep references to one - another and can result in very large memory usage. For example, if a 2MB - string is constructed by concatenating 4 bytes together at a time, the - memory usage will be ~44MB; so ~22x increase. The strings are only joined - together when an operation requiring their joining takes place, such as - substr(). This function is called when adding data to this buffer to ensure - these types of strings are periodically joined to reduce the memory - footprint. */ -var _MAX_CONSTRUCTED_STRING_LENGTH = 4096; -util.ByteStringBuffer.prototype._optimizeConstructedString = function(x) { - this._constructedStringLength += x; - if(this._constructedStringLength > _MAX_CONSTRUCTED_STRING_LENGTH) { - // this substr() should cause the constructed string to join - this.data.substr(0, 1); - this._constructedStringLength = 0; - } -}; - -/** - * Gets the number of bytes in this buffer. - * - * @return the number of bytes in this buffer. - */ -util.ByteStringBuffer.prototype.length = function() { - return this.data.length - this.read; -}; - -/** - * Gets whether or not this buffer is empty. - * - * @return true if this buffer is empty, false if not. - */ -util.ByteStringBuffer.prototype.isEmpty = function() { - return this.length() <= 0; -}; - -/** - * Puts a byte in this buffer. - * - * @param b the byte to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putByte = function(b) { - return this.putBytes(String.fromCharCode(b)); -}; - -/** - * Puts a byte in this buffer N times. - * - * @param b the byte to put. - * @param n the number of bytes of value b to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.fillWithByte = function(b, n) { - b = String.fromCharCode(b); - var d = this.data; - while(n > 0) { - if(n & 1) { - d += b; - } - n >>>= 1; - if(n > 0) { - b += b; - } - } - this.data = d; - this._optimizeConstructedString(n); - return this; -}; - -/** - * Puts bytes in this buffer. - * - * @param bytes the bytes (as a binary encoded string) to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putBytes = function(bytes) { - this.data += bytes; - this._optimizeConstructedString(bytes.length); - return this; -}; - -/** - * Puts a UTF-16 encoded string into this buffer. - * - * @param str the string to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putString = function(str) { - return this.putBytes(util.encodeUtf8(str)); -}; - -/** - * Puts a 16-bit integer in this buffer in big-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt16 = function(i) { - return this.putBytes( - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -/** - * Puts a 24-bit integer in this buffer in big-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt24 = function(i) { - return this.putBytes( - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -/** - * Puts a 32-bit integer in this buffer in big-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt32 = function(i) { - return this.putBytes( - String.fromCharCode(i >> 24 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -/** - * Puts a 16-bit integer in this buffer in little-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt16Le = function(i) { - return this.putBytes( - String.fromCharCode(i & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF)); -}; - -/** - * Puts a 24-bit integer in this buffer in little-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt24Le = function(i) { - return this.putBytes( - String.fromCharCode(i & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF)); -}; - -/** - * Puts a 32-bit integer in this buffer in little-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt32Le = function(i) { - return this.putBytes( - String.fromCharCode(i & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 24 & 0xFF)); -}; - -/** - * Puts an n-bit integer in this buffer in big-endian order. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt = function(i, n) { - _checkBitsParam(n); - var bytes = ''; - do { - n -= 8; - bytes += String.fromCharCode((i >> n) & 0xFF); - } while(n > 0); - return this.putBytes(bytes); -}; - -/** - * Puts a signed n-bit integer in this buffer in big-endian order. Two's - * complement representation is used. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putSignedInt = function(i, n) { - // putInt checks n - if(i < 0) { - i += 2 << (n - 1); - } - return this.putInt(i, n); -}; - -/** - * Puts the given buffer into this buffer. - * - * @param buffer the buffer to put into this one. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putBuffer = function(buffer) { - return this.putBytes(buffer.getBytes()); -}; - -/** - * Gets a byte from this buffer and advances the read pointer by 1. - * - * @return the byte. - */ -util.ByteStringBuffer.prototype.getByte = function() { - return this.data.charCodeAt(this.read++); -}; - -/** - * Gets a uint16 from this buffer in big-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.ByteStringBuffer.prototype.getInt16 = function() { - var rval = ( - this.data.charCodeAt(this.read) << 8 ^ - this.data.charCodeAt(this.read + 1)); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in big-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.ByteStringBuffer.prototype.getInt24 = function() { - var rval = ( - this.data.charCodeAt(this.read) << 16 ^ - this.data.charCodeAt(this.read + 1) << 8 ^ - this.data.charCodeAt(this.read + 2)); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in big-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.ByteStringBuffer.prototype.getInt32 = function() { - var rval = ( - this.data.charCodeAt(this.read) << 24 ^ - this.data.charCodeAt(this.read + 1) << 16 ^ - this.data.charCodeAt(this.read + 2) << 8 ^ - this.data.charCodeAt(this.read + 3)); - this.read += 4; - return rval; -}; - -/** - * Gets a uint16 from this buffer in little-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.ByteStringBuffer.prototype.getInt16Le = function() { - var rval = ( - this.data.charCodeAt(this.read) ^ - this.data.charCodeAt(this.read + 1) << 8); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in little-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.ByteStringBuffer.prototype.getInt24Le = function() { - var rval = ( - this.data.charCodeAt(this.read) ^ - this.data.charCodeAt(this.read + 1) << 8 ^ - this.data.charCodeAt(this.read + 2) << 16); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in little-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.ByteStringBuffer.prototype.getInt32Le = function() { - var rval = ( - this.data.charCodeAt(this.read) ^ - this.data.charCodeAt(this.read + 1) << 8 ^ - this.data.charCodeAt(this.read + 2) << 16 ^ - this.data.charCodeAt(this.read + 3) << 24); - this.read += 4; - return rval; -}; - -/** - * Gets an n-bit integer from this buffer in big-endian order and advances the - * read pointer by ceil(n/8). - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.ByteStringBuffer.prototype.getInt = function(n) { - _checkBitsParam(n); - var rval = 0; - do { - // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits. - rval = (rval << 8) + this.data.charCodeAt(this.read++); - n -= 8; - } while(n > 0); - return rval; -}; - -/** - * Gets a signed n-bit integer from this buffer in big-endian order, using - * two's complement, and advances the read pointer by n/8. - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.ByteStringBuffer.prototype.getSignedInt = function(n) { - // getInt checks n - var x = this.getInt(n); - var max = 2 << (n - 2); - if(x >= max) { - x -= max << 1; - } - return x; -}; - -/** - * Reads bytes out as a binary encoded string and clears them from the - * buffer. Note that the resulting string is binary encoded (in node.js this - * encoding is referred to as `binary`, it is *not* `utf8`). - * - * @param count the number of bytes to read, undefined or null for all. - * - * @return a binary encoded string of bytes. - */ -util.ByteStringBuffer.prototype.getBytes = function(count) { - var rval; - if(count) { - // read count bytes - count = Math.min(this.length(), count); - rval = this.data.slice(this.read, this.read + count); - this.read += count; - } else if(count === 0) { - rval = ''; - } else { - // read all bytes, optimize to only copy when needed - rval = (this.read === 0) ? this.data : this.data.slice(this.read); - this.clear(); - } - return rval; -}; - -/** - * Gets a binary encoded string of the bytes from this buffer without - * modifying the read pointer. - * - * @param count the number of bytes to get, omit to get all. - * - * @return a string full of binary encoded characters. - */ -util.ByteStringBuffer.prototype.bytes = function(count) { - return (typeof(count) === 'undefined' ? - this.data.slice(this.read) : - this.data.slice(this.read, this.read + count)); -}; - -/** - * Gets a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * - * @return the byte. - */ -util.ByteStringBuffer.prototype.at = function(i) { - return this.data.charCodeAt(this.read + i); -}; - -/** - * Puts a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * @param b the byte to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.setAt = function(i, b) { - this.data = this.data.substr(0, this.read + i) + - String.fromCharCode(b) + - this.data.substr(this.read + i + 1); - return this; -}; - -/** - * Gets the last byte without modifying the read pointer. - * - * @return the last byte. - */ -util.ByteStringBuffer.prototype.last = function() { - return this.data.charCodeAt(this.data.length - 1); -}; - -/** - * Creates a copy of this buffer. - * - * @return the copy. - */ -util.ByteStringBuffer.prototype.copy = function() { - var c = util.createBuffer(this.data); - c.read = this.read; - return c; -}; - -/** - * Compacts this buffer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.compact = function() { - if(this.read > 0) { - this.data = this.data.slice(this.read); - this.read = 0; - } - return this; -}; - -/** - * Clears this buffer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.clear = function() { - this.data = ''; - this.read = 0; - return this; -}; - -/** - * Shortens this buffer by triming bytes off of the end of this buffer. - * - * @param count the number of bytes to trim off. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.truncate = function(count) { - var len = Math.max(0, this.length() - count); - this.data = this.data.substr(this.read, len); - this.read = 0; - return this; -}; - -/** - * Converts this buffer to a hexadecimal string. - * - * @return a hexadecimal string. - */ -util.ByteStringBuffer.prototype.toHex = function() { - var rval = ''; - for(var i = this.read; i < this.data.length; ++i) { - var b = this.data.charCodeAt(i); - if(b < 16) { - rval += '0'; - } - rval += b.toString(16); - } - return rval; -}; - -/** - * Converts this buffer to a UTF-16 string (standard JavaScript string). - * - * @return a UTF-16 string. - */ -util.ByteStringBuffer.prototype.toString = function() { - return util.decodeUtf8(this.bytes()); -}; - -/** End Buffer w/BinaryString backing */ - -/** Buffer w/UInt8Array backing */ - -/** - * FIXME: Experimental. Do not use yet. - * - * Constructor for an ArrayBuffer-backed byte buffer. - * - * The buffer may be constructed from a string, an ArrayBuffer, DataView, or a - * TypedArray. - * - * If a string is given, its encoding should be provided as an option, - * otherwise it will default to 'binary'. A 'binary' string is encoded such - * that each character is one byte in length and size. - * - * If an ArrayBuffer, DataView, or TypedArray is given, it will be used - * *directly* without any copying. Note that, if a write to the buffer requires - * more space, the buffer will allocate a new backing ArrayBuffer to - * accommodate. The starting read and write offsets for the buffer may be - * given as options. - * - * @param [b] the initial bytes for this buffer. - * @param options the options to use: - * [readOffset] the starting read offset to use (default: 0). - * [writeOffset] the starting write offset to use (default: the - * length of the first parameter). - * [growSize] the minimum amount, in bytes, to grow the buffer by to - * accommodate writes (default: 1024). - * [encoding] the encoding ('binary', 'utf8', 'utf16', 'hex') for the - * first parameter, if it is a string (default: 'binary'). - */ -function DataBuffer(b, options) { - // default options - options = options || {}; - - // pointers for read from/write to buffer - this.read = options.readOffset || 0; - this.growSize = options.growSize || 1024; - - var isArrayBuffer = util.isArrayBuffer(b); - var isArrayBufferView = util.isArrayBufferView(b); - if(isArrayBuffer || isArrayBufferView) { - // use ArrayBuffer directly - if(isArrayBuffer) { - this.data = new DataView(b); - } else { - // TODO: adjust read/write offset based on the type of view - // or specify that this must be done in the options ... that the - // offsets are byte-based - this.data = new DataView(b.buffer, b.byteOffset, b.byteLength); - } - this.write = ('writeOffset' in options ? - options.writeOffset : this.data.byteLength); - return; - } - - // initialize to empty array buffer and add any given bytes using putBytes - this.data = new DataView(new ArrayBuffer(0)); - this.write = 0; - - if(b !== null && b !== undefined) { - this.putBytes(b); - } - - if('writeOffset' in options) { - this.write = options.writeOffset; - } -} -util.DataBuffer = DataBuffer; - -/** - * Gets the number of bytes in this buffer. - * - * @return the number of bytes in this buffer. - */ -util.DataBuffer.prototype.length = function() { - return this.write - this.read; -}; - -/** - * Gets whether or not this buffer is empty. - * - * @return true if this buffer is empty, false if not. - */ -util.DataBuffer.prototype.isEmpty = function() { - return this.length() <= 0; -}; - -/** - * Ensures this buffer has enough empty space to accommodate the given number - * of bytes. An optional parameter may be given that indicates a minimum - * amount to grow the buffer if necessary. If the parameter is not given, - * the buffer will be grown by some previously-specified default amount - * or heuristic. - * - * @param amount the number of bytes to accommodate. - * @param [growSize] the minimum amount, in bytes, to grow the buffer by if - * necessary. - */ -util.DataBuffer.prototype.accommodate = function(amount, growSize) { - if(this.length() >= amount) { - return this; - } - growSize = Math.max(growSize || this.growSize, amount); - - // grow buffer - var src = new Uint8Array( - this.data.buffer, this.data.byteOffset, this.data.byteLength); - var dst = new Uint8Array(this.length() + growSize); - dst.set(src); - this.data = new DataView(dst.buffer); - - return this; -}; - -/** - * Puts a byte in this buffer. - * - * @param b the byte to put. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putByte = function(b) { - this.accommodate(1); - this.data.setUint8(this.write++, b); - return this; -}; - -/** - * Puts a byte in this buffer N times. - * - * @param b the byte to put. - * @param n the number of bytes of value b to put. - * - * @return this buffer. - */ -util.DataBuffer.prototype.fillWithByte = function(b, n) { - this.accommodate(n); - for(var i = 0; i < n; ++i) { - this.data.setUint8(b); - } - return this; -}; - -/** - * Puts bytes in this buffer. The bytes may be given as a string, an - * ArrayBuffer, a DataView, or a TypedArray. - * - * @param bytes the bytes to put. - * @param [encoding] the encoding for the first parameter ('binary', 'utf8', - * 'utf16', 'hex'), if it is a string (default: 'binary'). - * - * @return this buffer. - */ -util.DataBuffer.prototype.putBytes = function(bytes, encoding) { - if(util.isArrayBufferView(bytes)) { - var src = new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength); - var len = src.byteLength - src.byteOffset; - this.accommodate(len); - var dst = new Uint8Array(this.data.buffer, this.write); - dst.set(src); - this.write += len; - return this; - } - - if(util.isArrayBuffer(bytes)) { - var src = new Uint8Array(bytes); - this.accommodate(src.byteLength); - var dst = new Uint8Array(this.data.buffer); - dst.set(src, this.write); - this.write += src.byteLength; - return this; - } - - // bytes is a util.DataBuffer or equivalent - if(bytes instanceof util.DataBuffer || - (typeof bytes === 'object' && - typeof bytes.read === 'number' && typeof bytes.write === 'number' && - util.isArrayBufferView(bytes.data))) { - var src = new Uint8Array(bytes.data.byteLength, bytes.read, bytes.length()); - this.accommodate(src.byteLength); - var dst = new Uint8Array(bytes.data.byteLength, this.write); - dst.set(src); - this.write += src.byteLength; - return this; - } - - if(bytes instanceof util.ByteStringBuffer) { - // copy binary string and process as the same as a string parameter below - bytes = bytes.data; - encoding = 'binary'; - } - - // string conversion - encoding = encoding || 'binary'; - if(typeof bytes === 'string') { - var view; - - // decode from string - if(encoding === 'hex') { - this.accommodate(Math.ceil(bytes.length / 2)); - view = new Uint8Array(this.data.buffer, this.write); - this.write += util.binary.hex.decode(bytes, view, this.write); - return this; - } - if(encoding === 'base64') { - this.accommodate(Math.ceil(bytes.length / 4) * 3); - view = new Uint8Array(this.data.buffer, this.write); - this.write += util.binary.base64.decode(bytes, view, this.write); - return this; - } - - // encode text as UTF-8 bytes - if(encoding === 'utf8') { - // encode as UTF-8 then decode string as raw binary - bytes = util.encodeUtf8(bytes); - encoding = 'binary'; - } - - // decode string as raw binary - if(encoding === 'binary' || encoding === 'raw') { - // one byte per character - this.accommodate(bytes.length); - view = new Uint8Array(this.data.buffer, this.write); - this.write += util.binary.raw.decode(view); - return this; - } - - // encode text as UTF-16 bytes - if(encoding === 'utf16') { - // two bytes per character - this.accommodate(bytes.length * 2); - view = new Uint16Array(this.data.buffer, this.write); - this.write += util.text.utf16.encode(view); - return this; - } - - throw new Error('Invalid encoding: ' + encoding); - } - - throw Error('Invalid parameter: ' + bytes); -}; - -/** - * Puts the given buffer into this buffer. - * - * @param buffer the buffer to put into this one. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putBuffer = function(buffer) { - this.putBytes(buffer); - buffer.clear(); - return this; -}; - -/** - * Puts a string into this buffer. - * - * @param str the string to put. - * @param [encoding] the encoding for the string (default: 'utf16'). - * - * @return this buffer. - */ -util.DataBuffer.prototype.putString = function(str) { - return this.putBytes(str, 'utf16'); -}; - -/** - * Puts a 16-bit integer in this buffer in big-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt16 = function(i) { - this.accommodate(2); - this.data.setInt16(this.write, i); - this.write += 2; - return this; -}; - -/** - * Puts a 24-bit integer in this buffer in big-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt24 = function(i) { - this.accommodate(3); - this.data.setInt16(this.write, i >> 8 & 0xFFFF); - this.data.setInt8(this.write, i >> 16 & 0xFF); - this.write += 3; - return this; -}; - -/** - * Puts a 32-bit integer in this buffer in big-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt32 = function(i) { - this.accommodate(4); - this.data.setInt32(this.write, i); - this.write += 4; - return this; -}; - -/** - * Puts a 16-bit integer in this buffer in little-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt16Le = function(i) { - this.accommodate(2); - this.data.setInt16(this.write, i, true); - this.write += 2; - return this; -}; - -/** - * Puts a 24-bit integer in this buffer in little-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt24Le = function(i) { - this.accommodate(3); - this.data.setInt8(this.write, i >> 16 & 0xFF); - this.data.setInt16(this.write, i >> 8 & 0xFFFF, true); - this.write += 3; - return this; -}; - -/** - * Puts a 32-bit integer in this buffer in little-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt32Le = function(i) { - this.accommodate(4); - this.data.setInt32(this.write, i, true); - this.write += 4; - return this; -}; - -/** - * Puts an n-bit integer in this buffer in big-endian order. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt = function(i, n) { - _checkBitsParam(n); - this.accommodate(n / 8); - do { - n -= 8; - this.data.setInt8(this.write++, (i >> n) & 0xFF); - } while(n > 0); - return this; -}; - -/** - * Puts a signed n-bit integer in this buffer in big-endian order. Two's - * complement representation is used. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putSignedInt = function(i, n) { - _checkBitsParam(n); - this.accommodate(n / 8); - if(i < 0) { - i += 2 << (n - 1); - } - return this.putInt(i, n); -}; - -/** - * Gets a byte from this buffer and advances the read pointer by 1. - * - * @return the byte. - */ -util.DataBuffer.prototype.getByte = function() { - return this.data.getInt8(this.read++); -}; - -/** - * Gets a uint16 from this buffer in big-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.DataBuffer.prototype.getInt16 = function() { - var rval = this.data.getInt16(this.read); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in big-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.DataBuffer.prototype.getInt24 = function() { - var rval = ( - this.data.getInt16(this.read) << 8 ^ - this.data.getInt8(this.read + 2)); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in big-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.DataBuffer.prototype.getInt32 = function() { - var rval = this.data.getInt32(this.read); - this.read += 4; - return rval; -}; - -/** - * Gets a uint16 from this buffer in little-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.DataBuffer.prototype.getInt16Le = function() { - var rval = this.data.getInt16(this.read, true); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in little-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.DataBuffer.prototype.getInt24Le = function() { - var rval = ( - this.data.getInt8(this.read) ^ - this.data.getInt16(this.read + 1, true) << 8); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in little-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.DataBuffer.prototype.getInt32Le = function() { - var rval = this.data.getInt32(this.read, true); - this.read += 4; - return rval; -}; - -/** - * Gets an n-bit integer from this buffer in big-endian order and advances the - * read pointer by n/8. - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.DataBuffer.prototype.getInt = function(n) { - _checkBitsParam(n); - var rval = 0; - do { - // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits. - rval = (rval << 8) + this.data.getInt8(this.read++); - n -= 8; - } while(n > 0); - return rval; -}; - -/** - * Gets a signed n-bit integer from this buffer in big-endian order, using - * two's complement, and advances the read pointer by n/8. - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.DataBuffer.prototype.getSignedInt = function(n) { - // getInt checks n - var x = this.getInt(n); - var max = 2 << (n - 2); - if(x >= max) { - x -= max << 1; - } - return x; -}; - -/** - * Reads bytes out as a binary encoded string and clears them from the - * buffer. - * - * @param count the number of bytes to read, undefined or null for all. - * - * @return a binary encoded string of bytes. - */ -util.DataBuffer.prototype.getBytes = function(count) { - // TODO: deprecate this method, it is poorly named and - // this.toString('binary') replaces it - // add a toTypedArray()/toArrayBuffer() function - var rval; - if(count) { - // read count bytes - count = Math.min(this.length(), count); - rval = this.data.slice(this.read, this.read + count); - this.read += count; - } else if(count === 0) { - rval = ''; - } else { - // read all bytes, optimize to only copy when needed - rval = (this.read === 0) ? this.data : this.data.slice(this.read); - this.clear(); - } - return rval; -}; - -/** - * Gets a binary encoded string of the bytes from this buffer without - * modifying the read pointer. - * - * @param count the number of bytes to get, omit to get all. - * - * @return a string full of binary encoded characters. - */ -util.DataBuffer.prototype.bytes = function(count) { - // TODO: deprecate this method, it is poorly named, add "getString()" - return (typeof(count) === 'undefined' ? - this.data.slice(this.read) : - this.data.slice(this.read, this.read + count)); -}; - -/** - * Gets a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * - * @return the byte. - */ -util.DataBuffer.prototype.at = function(i) { - return this.data.getUint8(this.read + i); -}; - -/** - * Puts a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * @param b the byte to put. - * - * @return this buffer. - */ -util.DataBuffer.prototype.setAt = function(i, b) { - this.data.setUint8(i, b); - return this; -}; - -/** - * Gets the last byte without modifying the read pointer. - * - * @return the last byte. - */ -util.DataBuffer.prototype.last = function() { - return this.data.getUint8(this.write - 1); -}; - -/** - * Creates a copy of this buffer. - * - * @return the copy. - */ -util.DataBuffer.prototype.copy = function() { - return new util.DataBuffer(this); -}; - -/** - * Compacts this buffer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.compact = function() { - if(this.read > 0) { - var src = new Uint8Array(this.data.buffer, this.read); - var dst = new Uint8Array(src.byteLength); - dst.set(src); - this.data = new DataView(dst); - this.write -= this.read; - this.read = 0; - } - return this; -}; - -/** - * Clears this buffer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.clear = function() { - this.data = new DataView(new ArrayBuffer(0)); - this.read = this.write = 0; - return this; -}; - -/** - * Shortens this buffer by triming bytes off of the end of this buffer. - * - * @param count the number of bytes to trim off. - * - * @return this buffer. - */ -util.DataBuffer.prototype.truncate = function(count) { - this.write = Math.max(0, this.length() - count); - this.read = Math.min(this.read, this.write); - return this; -}; - -/** - * Converts this buffer to a hexadecimal string. - * - * @return a hexadecimal string. - */ -util.DataBuffer.prototype.toHex = function() { - var rval = ''; - for(var i = this.read; i < this.data.byteLength; ++i) { - var b = this.data.getUint8(i); - if(b < 16) { - rval += '0'; - } - rval += b.toString(16); - } - return rval; -}; - -/** - * Converts this buffer to a string, using the given encoding. If no - * encoding is given, 'utf8' (UTF-8) is used. - * - * @param [encoding] the encoding to use: 'binary', 'utf8', 'utf16', 'hex', - * 'base64' (default: 'utf8'). - * - * @return a string representation of the bytes in this buffer. - */ -util.DataBuffer.prototype.toString = function(encoding) { - var view = new Uint8Array(this.data, this.read, this.length()); - encoding = encoding || 'utf8'; - - // encode to string - if(encoding === 'binary' || encoding === 'raw') { - return util.binary.raw.encode(view); - } - if(encoding === 'hex') { - return util.binary.hex.encode(view); - } - if(encoding === 'base64') { - return util.binary.base64.encode(view); - } - - // decode to text - if(encoding === 'utf8') { - return util.text.utf8.decode(view); - } - if(encoding === 'utf16') { - return util.text.utf16.decode(view); - } - - throw new Error('Invalid encoding: ' + encoding); -}; - -/** End Buffer w/UInt8Array backing */ - -/** - * Creates a buffer that stores bytes. A value may be given to populate the - * buffer with data. This value can either be string of encoded bytes or a - * regular string of characters. When passing a string of binary encoded - * bytes, the encoding `raw` should be given. This is also the default. When - * passing a string of characters, the encoding `utf8` should be given. - * - * @param [input] a string with encoded bytes to store in the buffer. - * @param [encoding] (default: 'raw', other: 'utf8'). - */ -util.createBuffer = function(input, encoding) { - // TODO: deprecate, use new ByteBuffer() instead - encoding = encoding || 'raw'; - if(input !== undefined && encoding === 'utf8') { - input = util.encodeUtf8(input); - } - return new util.ByteBuffer(input); -}; - -/** - * Fills a string with a particular value. If you want the string to be a byte - * string, pass in String.fromCharCode(theByte). - * - * @param c the character to fill the string with, use String.fromCharCode - * to fill the string with a byte value. - * @param n the number of characters of value c to fill with. - * - * @return the filled string. - */ -util.fillString = function(c, n) { - var s = ''; - while(n > 0) { - if(n & 1) { - s += c; - } - n >>>= 1; - if(n > 0) { - c += c; - } - } - return s; -}; - -/** - * Performs a per byte XOR between two byte strings and returns the result as a - * string of bytes. - * - * @param s1 first string of bytes. - * @param s2 second string of bytes. - * @param n the number of bytes to XOR. - * - * @return the XOR'd result. - */ -util.xorBytes = function(s1, s2, n) { - var s3 = ''; - var b = ''; - var t = ''; - var i = 0; - var c = 0; - for(; n > 0; --n, ++i) { - b = s1.charCodeAt(i) ^ s2.charCodeAt(i); - if(c >= 10) { - s3 += t; - t = ''; - c = 0; - } - t += String.fromCharCode(b); - ++c; - } - s3 += t; - return s3; -}; - -/** - * Converts a hex string into a 'binary' encoded string of bytes. - * - * @param hex the hexadecimal string to convert. - * - * @return the binary-encoded string of bytes. - */ -util.hexToBytes = function(hex) { - // TODO: deprecate: "Deprecated. Use util.binary.hex.decode instead." - var rval = ''; - var i = 0; - if(hex.length & 1 == 1) { - // odd number of characters, convert first character alone - i = 1; - rval += String.fromCharCode(parseInt(hex[0], 16)); - } - // convert 2 characters (1 byte) at a time - for(; i < hex.length; i += 2) { - rval += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); - } - return rval; -}; - -/** - * Converts a 'binary' encoded string of bytes to hex. - * - * @param bytes the byte string to convert. - * - * @return the string of hexadecimal characters. - */ -util.bytesToHex = function(bytes) { - // TODO: deprecate: "Deprecated. Use util.binary.hex.encode instead." - return util.createBuffer(bytes).toHex(); -}; - -/** - * Converts an 32-bit integer to 4-big-endian byte string. - * - * @param i the integer. - * - * @return the byte string. - */ -util.int32ToBytes = function(i) { - return ( - String.fromCharCode(i >> 24 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -// base64 characters, reverse mapping -var _base64 = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; -var _base64Idx = [ -/*43 -43 = 0*/ -/*'+', 1, 2, 3,'/' */ - 62, -1, -1, -1, 63, - -/*'0','1','2','3','4','5','6','7','8','9' */ - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - -/*15, 16, 17,'=', 19, 20, 21 */ - -1, -1, -1, 64, -1, -1, -1, - -/*65 - 43 = 22*/ -/*'A','B','C','D','E','F','G','H','I','J','K','L','M', */ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - -/*'N','O','P','Q','R','S','T','U','V','W','X','Y','Z' */ - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - -/*91 - 43 = 48 */ -/*48, 49, 50, 51, 52, 53 */ - -1, -1, -1, -1, -1, -1, - -/*97 - 43 = 54*/ -/*'a','b','c','d','e','f','g','h','i','j','k','l','m' */ - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - -/*'n','o','p','q','r','s','t','u','v','w','x','y','z' */ - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 -]; - -// base58 characters (Bitcoin alphabet) -var _base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; - -/** - * Base64 encodes a 'binary' encoded string of bytes. - * - * @param input the binary encoded string of bytes to base64-encode. - * @param maxline the maximum number of encoded characters per line to use, - * defaults to none. - * - * @return the base64-encoded output. - */ -util.encode64 = function(input, maxline) { - // TODO: deprecate: "Deprecated. Use util.binary.base64.encode instead." - var line = ''; - var output = ''; - var chr1, chr2, chr3; - var i = 0; - while(i < input.length) { - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - - // encode 4 character group - line += _base64.charAt(chr1 >> 2); - line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4)); - if(isNaN(chr2)) { - line += '=='; - } else { - line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6)); - line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63); - } - - if(maxline && line.length > maxline) { - output += line.substr(0, maxline) + '\r\n'; - line = line.substr(maxline); - } - } - output += line; - return output; -}; - -/** - * Base64 decodes a string into a 'binary' encoded string of bytes. - * - * @param input the base64-encoded input. - * - * @return the binary encoded string. - */ -util.decode64 = function(input) { - // TODO: deprecate: "Deprecated. Use util.binary.base64.decode instead." - - // remove all non-base64 characters - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); - - var output = ''; - var enc1, enc2, enc3, enc4; - var i = 0; - - while(i < input.length) { - enc1 = _base64Idx[input.charCodeAt(i++) - 43]; - enc2 = _base64Idx[input.charCodeAt(i++) - 43]; - enc3 = _base64Idx[input.charCodeAt(i++) - 43]; - enc4 = _base64Idx[input.charCodeAt(i++) - 43]; - - output += String.fromCharCode((enc1 << 2) | (enc2 >> 4)); - if(enc3 !== 64) { - // decoded at least 2 bytes - output += String.fromCharCode(((enc2 & 15) << 4) | (enc3 >> 2)); - if(enc4 !== 64) { - // decoded 3 bytes - output += String.fromCharCode(((enc3 & 3) << 6) | enc4); - } - } - } - - return output; -}; - -/** - * Encodes the given string of characters (a standard JavaScript - * string) as a binary encoded string where the bytes represent - * a UTF-8 encoded string of characters. Non-ASCII characters will be - * encoded as multiple bytes according to UTF-8. - * - * @param str a standard string of characters to encode. - * - * @return the binary encoded string. - */ -util.encodeUtf8 = function(str) { - return unescape(encodeURIComponent(str)); -}; - -/** - * Decodes a binary encoded string that contains bytes that - * represent a UTF-8 encoded string of characters -- into a - * string of characters (a standard JavaScript string). - * - * @param str the binary encoded string to decode. - * - * @return the resulting standard string of characters. - */ -util.decodeUtf8 = function(str) { - return decodeURIComponent(escape(str)); -}; - -// binary encoding/decoding tools -// FIXME: Experimental. Do not use yet. -util.binary = { - raw: {}, - hex: {}, - base64: {}, - base58: {}, - baseN : { - encode: baseN.encode, - decode: baseN.decode - } -}; - -/** - * Encodes a Uint8Array as a binary-encoded string. This encoding uses - * a value between 0 and 255 for each character. - * - * @param bytes the Uint8Array to encode. - * - * @return the binary-encoded string. - */ -util.binary.raw.encode = function(bytes) { - return String.fromCharCode.apply(null, bytes); -}; - -/** - * Decodes a binary-encoded string to a Uint8Array. This encoding uses - * a value between 0 and 255 for each character. - * - * @param str the binary-encoded string to decode. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.binary.raw.decode = function(str, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(str.length); - } - offset = offset || 0; - var j = offset; - for(var i = 0; i < str.length; ++i) { - out[j++] = str.charCodeAt(i); - } - return output ? (j - offset) : out; -}; - -/** - * Encodes a 'binary' string, ArrayBuffer, DataView, TypedArray, or - * ByteBuffer as a string of hexadecimal characters. - * - * @param bytes the bytes to convert. - * - * @return the string of hexadecimal characters. - */ -util.binary.hex.encode = util.bytesToHex; - -/** - * Decodes a hex-encoded string to a Uint8Array. - * - * @param hex the hexadecimal string to convert. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.binary.hex.decode = function(hex, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(Math.ceil(hex.length / 2)); - } - offset = offset || 0; - var i = 0, j = offset; - if(hex.length & 1) { - // odd number of characters, convert first character alone - i = 1; - out[j++] = parseInt(hex[0], 16); - } - // convert 2 characters (1 byte) at a time - for(; i < hex.length; i += 2) { - out[j++] = parseInt(hex.substr(i, 2), 16); - } - return output ? (j - offset) : out; -}; - -/** - * Base64-encodes a Uint8Array. - * - * @param input the Uint8Array to encode. - * @param maxline the maximum number of encoded characters per line to use, - * defaults to none. - * - * @return the base64-encoded output string. - */ -util.binary.base64.encode = function(input, maxline) { - var line = ''; - var output = ''; - var chr1, chr2, chr3; - var i = 0; - while(i < input.byteLength) { - chr1 = input[i++]; - chr2 = input[i++]; - chr3 = input[i++]; - - // encode 4 character group - line += _base64.charAt(chr1 >> 2); - line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4)); - if(isNaN(chr2)) { - line += '=='; - } else { - line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6)); - line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63); - } - - if(maxline && line.length > maxline) { - output += line.substr(0, maxline) + '\r\n'; - line = line.substr(maxline); - } - } - output += line; - return output; -}; - -/** - * Decodes a base64-encoded string to a Uint8Array. - * - * @param input the base64-encoded input string. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.binary.base64.decode = function(input, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(Math.ceil(input.length / 4) * 3); - } - - // remove all non-base64 characters - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); - - offset = offset || 0; - var enc1, enc2, enc3, enc4; - var i = 0, j = offset; - - while(i < input.length) { - enc1 = _base64Idx[input.charCodeAt(i++) - 43]; - enc2 = _base64Idx[input.charCodeAt(i++) - 43]; - enc3 = _base64Idx[input.charCodeAt(i++) - 43]; - enc4 = _base64Idx[input.charCodeAt(i++) - 43]; - - out[j++] = (enc1 << 2) | (enc2 >> 4); - if(enc3 !== 64) { - // decoded at least 2 bytes - out[j++] = ((enc2 & 15) << 4) | (enc3 >> 2); - if(enc4 !== 64) { - // decoded 3 bytes - out[j++] = ((enc3 & 3) << 6) | enc4; - } - } - } - - // make sure result is the exact decoded length - return output ? (j - offset) : out.subarray(0, j); -}; - -// add support for base58 encoding/decoding with Bitcoin alphabet -util.binary.base58.encode = function(input, maxline) { - return util.binary.baseN.encode(input, _base58, maxline); -}; -util.binary.base58.decode = function(input, maxline) { - return util.binary.baseN.decode(input, _base58, maxline); -}; - -// text encoding/decoding tools -// FIXME: Experimental. Do not use yet. -util.text = { - utf8: {}, - utf16: {} -}; - -/** - * Encodes the given string as UTF-8 in a Uint8Array. - * - * @param str the string to encode. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.text.utf8.encode = function(str, output, offset) { - str = util.encodeUtf8(str); - var out = output; - if(!out) { - out = new Uint8Array(str.length); - } - offset = offset || 0; - var j = offset; - for(var i = 0; i < str.length; ++i) { - out[j++] = str.charCodeAt(i); - } - return output ? (j - offset) : out; -}; - -/** - * Decodes the UTF-8 contents from a Uint8Array. - * - * @param bytes the Uint8Array to decode. - * - * @return the resulting string. - */ -util.text.utf8.decode = function(bytes) { - return util.decodeUtf8(String.fromCharCode.apply(null, bytes)); -}; - -/** - * Encodes the given string as UTF-16 in a Uint8Array. - * - * @param str the string to encode. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.text.utf16.encode = function(str, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(str.length * 2); - } - var view = new Uint16Array(out.buffer); - offset = offset || 0; - var j = offset; - var k = offset; - for(var i = 0; i < str.length; ++i) { - view[k++] = str.charCodeAt(i); - j += 2; - } - return output ? (j - offset) : out; -}; - -/** - * Decodes the UTF-16 contents from a Uint8Array. - * - * @param bytes the Uint8Array to decode. - * - * @return the resulting string. - */ -util.text.utf16.decode = function(bytes) { - return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer)); -}; - -/** - * Deflates the given data using a flash interface. - * - * @param api the flash interface. - * @param bytes the data. - * @param raw true to return only raw deflate data, false to include zlib - * header and trailer. - * - * @return the deflated data as a string. - */ -util.deflate = function(api, bytes, raw) { - bytes = util.decode64(api.deflate(util.encode64(bytes)).rval); - - // strip zlib header and trailer if necessary - if(raw) { - // zlib header is 2 bytes (CMF,FLG) where FLG indicates that - // there is a 4-byte DICT (alder-32) block before the data if - // its 5th bit is set - var start = 2; - var flg = bytes.charCodeAt(1); - if(flg & 0x20) { - start = 6; - } - // zlib trailer is 4 bytes of adler-32 - bytes = bytes.substring(start, bytes.length - 4); - } - - return bytes; -}; - -/** - * Inflates the given data using a flash interface. - * - * @param api the flash interface. - * @param bytes the data. - * @param raw true if the incoming data has no zlib header or trailer and is - * raw DEFLATE data. - * - * @return the inflated data as a string, null on error. - */ -util.inflate = function(api, bytes, raw) { - // TODO: add zlib header and trailer if necessary/possible - var rval = api.inflate(util.encode64(bytes)).rval; - return (rval === null) ? null : util.decode64(rval); -}; - -/** - * Sets a storage object. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param obj the storage object, null to remove. - */ -var _setStorageObject = function(api, id, obj) { - if(!api) { - throw new Error('WebStorage not available.'); - } - - var rval; - if(obj === null) { - rval = api.removeItem(id); - } else { - // json-encode and base64-encode object - obj = util.encode64(JSON.stringify(obj)); - rval = api.setItem(id, obj); - } - - // handle potential flash error - if(typeof(rval) !== 'undefined' && rval.rval !== true) { - var error = new Error(rval.error.message); - error.id = rval.error.id; - error.name = rval.error.name; - throw error; - } -}; - -/** - * Gets a storage object. - * - * @param api the storage interface. - * @param id the storage ID to use. - * - * @return the storage object entry or null if none exists. - */ -var _getStorageObject = function(api, id) { - if(!api) { - throw new Error('WebStorage not available.'); - } - - // get the existing entry - var rval = api.getItem(id); - - /* Note: We check api.init because we can't do (api == localStorage) - on IE because of "Class doesn't support Automation" exception. Only - the flash api has an init method so this works too, but we need a - better solution in the future. */ - - // flash returns item wrapped in an object, handle special case - if(api.init) { - if(rval.rval === null) { - if(rval.error) { - var error = new Error(rval.error.message); - error.id = rval.error.id; - error.name = rval.error.name; - throw error; - } - // no error, but also no item - rval = null; - } else { - rval = rval.rval; - } - } - - // handle decoding - if(rval !== null) { - // base64-decode and json-decode data - rval = JSON.parse(util.decode64(rval)); - } - - return rval; -}; - -/** - * Stores an item in local storage. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param key the key for the item. - * @param data the data for the item (any javascript object/primitive). - */ -var _setItem = function(api, id, key, data) { - // get storage object - var obj = _getStorageObject(api, id); - if(obj === null) { - // create a new storage object - obj = {}; - } - // update key - obj[key] = data; - - // set storage object - _setStorageObject(api, id, obj); -}; - -/** - * Gets an item from local storage. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param key the key for the item. - * - * @return the item. - */ -var _getItem = function(api, id, key) { - // get storage object - var rval = _getStorageObject(api, id); - if(rval !== null) { - // return data at key - rval = (key in rval) ? rval[key] : null; - } - - return rval; -}; - -/** - * Removes an item from local storage. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param key the key for the item. - */ -var _removeItem = function(api, id, key) { - // get storage object - var obj = _getStorageObject(api, id); - if(obj !== null && key in obj) { - // remove key - delete obj[key]; - - // see if entry has no keys remaining - var empty = true; - for(var prop in obj) { - empty = false; - break; - } - if(empty) { - // remove entry entirely if no keys are left - obj = null; - } - - // set storage object - _setStorageObject(api, id, obj); - } -}; - -/** - * Clears the local disk storage identified by the given ID. - * - * @param api the storage interface. - * @param id the storage ID to use. - */ -var _clearItems = function(api, id) { - _setStorageObject(api, id, null); -}; - -/** - * Calls a storage function. - * - * @param func the function to call. - * @param args the arguments for the function. - * @param location the location argument. - * - * @return the return value from the function. - */ -var _callStorageFunction = function(func, args, location) { - var rval = null; - - // default storage types - if(typeof(location) === 'undefined') { - location = ['web', 'flash']; - } - - // apply storage types in order of preference - var type; - var done = false; - var exception = null; - for(var idx in location) { - type = location[idx]; - try { - if(type === 'flash' || type === 'both') { - if(args[0] === null) { - throw new Error('Flash local storage not available.'); - } - rval = func.apply(this, args); - done = (type === 'flash'); - } - if(type === 'web' || type === 'both') { - args[0] = localStorage; - rval = func.apply(this, args); - done = true; - } - } catch(ex) { - exception = ex; - } - if(done) { - break; - } - } - - if(!done) { - throw exception; - } - - return rval; -}; - -/** - * Stores an item on local disk. - * - * The available types of local storage include 'flash', 'web', and 'both'. - * - * The type 'flash' refers to flash local storage (SharedObject). In order - * to use flash local storage, the 'api' parameter must be valid. The type - * 'web' refers to WebStorage, if supported by the browser. The type 'both' - * refers to storing using both 'flash' and 'web', not just one or the - * other. - * - * The location array should list the storage types to use in order of - * preference: - * - * ['flash']: flash only storage - * ['web']: web only storage - * ['both']: try to store in both - * ['flash','web']: store in flash first, but if not available, 'web' - * ['web','flash']: store in web first, but if not available, 'flash' - * - * The location array defaults to: ['web', 'flash'] - * - * @param api the flash interface, null to use only WebStorage. - * @param id the storage ID to use. - * @param key the key for the item. - * @param data the data for the item (any javascript object/primitive). - * @param location an array with the preferred types of storage to use. - */ -util.setItem = function(api, id, key, data, location) { - _callStorageFunction(_setItem, arguments, location); -}; - -/** - * Gets an item on local disk. - * - * Set setItem() for details on storage types. - * - * @param api the flash interface, null to use only WebStorage. - * @param id the storage ID to use. - * @param key the key for the item. - * @param location an array with the preferred types of storage to use. - * - * @return the item. - */ -util.getItem = function(api, id, key, location) { - return _callStorageFunction(_getItem, arguments, location); -}; - -/** - * Removes an item on local disk. - * - * Set setItem() for details on storage types. - * - * @param api the flash interface. - * @param id the storage ID to use. - * @param key the key for the item. - * @param location an array with the preferred types of storage to use. - */ -util.removeItem = function(api, id, key, location) { - _callStorageFunction(_removeItem, arguments, location); -}; - -/** - * Clears the local disk storage identified by the given ID. - * - * Set setItem() for details on storage types. - * - * @param api the flash interface if flash is available. - * @param id the storage ID to use. - * @param location an array with the preferred types of storage to use. - */ -util.clearItems = function(api, id, location) { - _callStorageFunction(_clearItems, arguments, location); -}; - -/** - * Parses the scheme, host, and port from an http(s) url. - * - * @param str the url string. - * - * @return the parsed url object or null if the url is invalid. - */ -util.parseUrl = function(str) { - // FIXME: this regex looks a bit broken - var regex = /^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g; - regex.lastIndex = 0; - var m = regex.exec(str); - var url = (m === null) ? null : { - full: str, - scheme: m[1], - host: m[2], - port: m[3], - path: m[4] - }; - if(url) { - url.fullHost = url.host; - if(url.port) { - if(url.port !== 80 && url.scheme === 'http') { - url.fullHost += ':' + url.port; - } else if(url.port !== 443 && url.scheme === 'https') { - url.fullHost += ':' + url.port; - } - } else if(url.scheme === 'http') { - url.port = 80; - } else if(url.scheme === 'https') { - url.port = 443; - } - url.full = url.scheme + '://' + url.fullHost; - } - return url; -}; - -/* Storage for query variables */ -var _queryVariables = null; - -/** - * Returns the window location query variables. Query is parsed on the first - * call and the same object is returned on subsequent calls. The mapping - * is from keys to an array of values. Parameters without values will have - * an object key set but no value added to the value array. Values are - * unescaped. - * - * ...?k1=v1&k2=v2: - * { - * "k1": ["v1"], - * "k2": ["v2"] - * } - * - * ...?k1=v1&k1=v2: - * { - * "k1": ["v1", "v2"] - * } - * - * ...?k1=v1&k2: - * { - * "k1": ["v1"], - * "k2": [] - * } - * - * ...?k1=v1&k1: - * { - * "k1": ["v1"] - * } - * - * ...?k1&k1: - * { - * "k1": [] - * } - * - * @param query the query string to parse (optional, default to cached - * results from parsing window location search query). - * - * @return object mapping keys to variables. - */ -util.getQueryVariables = function(query) { - var parse = function(q) { - var rval = {}; - var kvpairs = q.split('&'); - for(var i = 0; i < kvpairs.length; i++) { - var pos = kvpairs[i].indexOf('='); - var key; - var val; - if(pos > 0) { - key = kvpairs[i].substring(0, pos); - val = kvpairs[i].substring(pos + 1); - } else { - key = kvpairs[i]; - val = null; - } - if(!(key in rval)) { - rval[key] = []; - } - // disallow overriding object prototype keys - if(!(key in Object.prototype) && val !== null) { - rval[key].push(unescape(val)); - } - } - return rval; - }; - - var rval; - if(typeof(query) === 'undefined') { - // set cached variables if needed - if(_queryVariables === null) { - if(typeof(window) !== 'undefined' && window.location && window.location.search) { - // parse window search query - _queryVariables = parse(window.location.search.substring(1)); - } else { - // no query variables available - _queryVariables = {}; - } - } - rval = _queryVariables; - } else { - // parse given query - rval = parse(query); - } - return rval; -}; - -/** - * Parses a fragment into a path and query. This method will take a URI - * fragment and break it up as if it were the main URI. For example: - * /bar/baz?a=1&b=2 - * results in: - * { - * path: ["bar", "baz"], - * query: {"k1": ["v1"], "k2": ["v2"]} - * } - * - * @return object with a path array and query object. - */ -util.parseFragment = function(fragment) { - // default to whole fragment - var fp = fragment; - var fq = ''; - // split into path and query if possible at the first '?' - var pos = fragment.indexOf('?'); - if(pos > 0) { - fp = fragment.substring(0, pos); - fq = fragment.substring(pos + 1); - } - // split path based on '/' and ignore first element if empty - var path = fp.split('/'); - if(path.length > 0 && path[0] === '') { - path.shift(); - } - // convert query into object - var query = (fq === '') ? {} : util.getQueryVariables(fq); - - return { - pathString: fp, - queryString: fq, - path: path, - query: query - }; -}; - -/** - * Makes a request out of a URI-like request string. This is intended to - * be used where a fragment id (after a URI '#') is parsed as a URI with - * path and query parts. The string should have a path beginning and - * delimited by '/' and optional query parameters following a '?'. The - * query should be a standard URL set of key value pairs delimited by - * '&'. For backwards compatibility the initial '/' on the path is not - * required. The request object has the following API, (fully described - * in the method code): - * { - * path: . - * query: , - * getPath(i): get part or all of the split path array, - * getQuery(k, i): get part or all of a query key array, - * getQueryLast(k, _default): get last element of a query key array. - * } - * - * @return object with request parameters. - */ -util.makeRequest = function(reqString) { - var frag = util.parseFragment(reqString); - var req = { - // full path string - path: frag.pathString, - // full query string - query: frag.queryString, - /** - * Get path or element in path. - * - * @param i optional path index. - * - * @return path or part of path if i provided. - */ - getPath: function(i) { - return (typeof(i) === 'undefined') ? frag.path : frag.path[i]; - }, - /** - * Get query, values for a key, or value for a key index. - * - * @param k optional query key. - * @param i optional query key index. - * - * @return query, values for a key, or value for a key index. - */ - getQuery: function(k, i) { - var rval; - if(typeof(k) === 'undefined') { - rval = frag.query; - } else { - rval = frag.query[k]; - if(rval && typeof(i) !== 'undefined') { - rval = rval[i]; - } - } - return rval; - }, - getQueryLast: function(k, _default) { - var rval; - var vals = req.getQuery(k); - if(vals) { - rval = vals[vals.length - 1]; - } else { - rval = _default; - } - return rval; - } - }; - return req; -}; - -/** - * Makes a URI out of a path, an object with query parameters, and a - * fragment. Uses jQuery.param() internally for query string creation. - * If the path is an array, it will be joined with '/'. - * - * @param path string path or array of strings. - * @param query object with query parameters. (optional) - * @param fragment fragment string. (optional) - * - * @return string object with request parameters. - */ -util.makeLink = function(path, query, fragment) { - // join path parts if needed - path = jQuery.isArray(path) ? path.join('/') : path; - - var qstr = jQuery.param(query || {}); - fragment = fragment || ''; - return path + - ((qstr.length > 0) ? ('?' + qstr) : '') + - ((fragment.length > 0) ? ('#' + fragment) : ''); -}; - -/** - * Check if an object is empty. - * - * Taken from: - * http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object-from-json/679937#679937 - * - * @param object the object to check. - */ -util.isEmpty = function(obj) { - for(var prop in obj) { - if(obj.hasOwnProperty(prop)) { - return false; - } - } - return true; -}; - -/** - * Format with simple printf-style interpolation. - * - * %%: literal '%' - * %s,%o: convert next argument into a string. - * - * @param format the string to format. - * @param ... arguments to interpolate into the format string. - */ -util.format = function(format) { - var re = /%./g; - // current match - var match; - // current part - var part; - // current arg index - var argi = 0; - // collected parts to recombine later - var parts = []; - // last index found - var last = 0; - // loop while matches remain - while((match = re.exec(format))) { - part = format.substring(last, re.lastIndex - 2); - // don't add empty strings (ie, parts between %s%s) - if(part.length > 0) { - parts.push(part); - } - last = re.lastIndex; - // switch on % code - var code = match[0][1]; - switch(code) { - case 's': - case 'o': - // check if enough arguments were given - if(argi < arguments.length) { - parts.push(arguments[argi++ + 1]); - } else { - parts.push(''); - } - break; - // FIXME: do proper formating for numbers, etc - //case 'f': - //case 'd': - case '%': - parts.push('%'); - break; - default: - parts.push('<%' + code + '?>'); - } - } - // add trailing part of format string - parts.push(format.substring(last)); - return parts.join(''); -}; - -/** - * Formats a number. - * - * http://snipplr.com/view/5945/javascript-numberformat--ported-from-php/ - */ -util.formatNumber = function(number, decimals, dec_point, thousands_sep) { - // http://kevin.vanzonneveld.net - // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) - // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // + bugfix by: Michael White (http://crestidg.com) - // + bugfix by: Benjamin Lupton - // + bugfix by: Allan Jensen (http://www.winternet.no) - // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) - // * example 1: number_format(1234.5678, 2, '.', ''); - // * returns 1: 1234.57 - - var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals; - var d = dec_point === undefined ? ',' : dec_point; - var t = thousands_sep === undefined ? - '.' : thousands_sep, s = n < 0 ? '-' : ''; - var i = parseInt((n = Math.abs(+n || 0).toFixed(c)), 10) + ''; - var j = (i.length > 3) ? i.length % 3 : 0; - return s + (j ? i.substr(0, j) + t : '') + - i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + t) + - (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ''); -}; - -/** - * Formats a byte size. - * - * http://snipplr.com/view/5949/format-humanize-file-byte-size-presentation-in-javascript/ - */ -util.formatSize = function(size) { - if(size >= 1073741824) { - size = util.formatNumber(size / 1073741824, 2, '.', '') + ' GiB'; - } else if(size >= 1048576) { - size = util.formatNumber(size / 1048576, 2, '.', '') + ' MiB'; - } else if(size >= 1024) { - size = util.formatNumber(size / 1024, 0) + ' KiB'; - } else { - size = util.formatNumber(size, 0) + ' bytes'; - } - return size; -}; - -/** - * Converts an IPv4 or IPv6 string representation into bytes (in network order). - * - * @param ip the IPv4 or IPv6 address to convert. - * - * @return the 4-byte IPv6 or 16-byte IPv6 address or null if the address can't - * be parsed. - */ -util.bytesFromIP = function(ip) { - if(ip.indexOf('.') !== -1) { - return util.bytesFromIPv4(ip); - } - if(ip.indexOf(':') !== -1) { - return util.bytesFromIPv6(ip); - } - return null; -}; - -/** - * Converts an IPv4 string representation into bytes (in network order). - * - * @param ip the IPv4 address to convert. - * - * @return the 4-byte address or null if the address can't be parsed. - */ -util.bytesFromIPv4 = function(ip) { - ip = ip.split('.'); - if(ip.length !== 4) { - return null; - } - var b = util.createBuffer(); - for(var i = 0; i < ip.length; ++i) { - var num = parseInt(ip[i], 10); - if(isNaN(num)) { - return null; - } - b.putByte(num); - } - return b.getBytes(); -}; - -/** - * Converts an IPv6 string representation into bytes (in network order). - * - * @param ip the IPv6 address to convert. - * - * @return the 16-byte address or null if the address can't be parsed. - */ -util.bytesFromIPv6 = function(ip) { - var blanks = 0; - ip = ip.split(':').filter(function(e) { - if(e.length === 0) ++blanks; - return true; - }); - var zeros = (8 - ip.length + blanks) * 2; - var b = util.createBuffer(); - for(var i = 0; i < 8; ++i) { - if(!ip[i] || ip[i].length === 0) { - b.fillWithByte(0, zeros); - zeros = 0; - continue; - } - var bytes = util.hexToBytes(ip[i]); - if(bytes.length < 2) { - b.putByte(0); - } - b.putBytes(bytes); - } - return b.getBytes(); -}; - -/** - * Converts 4-bytes into an IPv4 string representation or 16-bytes into - * an IPv6 string representation. The bytes must be in network order. - * - * @param bytes the bytes to convert. - * - * @return the IPv4 or IPv6 string representation if 4 or 16 bytes, - * respectively, are given, otherwise null. - */ -util.bytesToIP = function(bytes) { - if(bytes.length === 4) { - return util.bytesToIPv4(bytes); - } - if(bytes.length === 16) { - return util.bytesToIPv6(bytes); - } - return null; -}; - -/** - * Converts 4-bytes into an IPv4 string representation. The bytes must be - * in network order. - * - * @param bytes the bytes to convert. - * - * @return the IPv4 string representation or null for an invalid # of bytes. - */ -util.bytesToIPv4 = function(bytes) { - if(bytes.length !== 4) { - return null; - } - var ip = []; - for(var i = 0; i < bytes.length; ++i) { - ip.push(bytes.charCodeAt(i)); - } - return ip.join('.'); -}; - -/** - * Converts 16-bytes into an IPv16 string representation. The bytes must be - * in network order. - * - * @param bytes the bytes to convert. - * - * @return the IPv16 string representation or null for an invalid # of bytes. - */ -util.bytesToIPv6 = function(bytes) { - if(bytes.length !== 16) { - return null; - } - var ip = []; - var zeroGroups = []; - var zeroMaxGroup = 0; - for(var i = 0; i < bytes.length; i += 2) { - var hex = util.bytesToHex(bytes[i] + bytes[i + 1]); - // canonicalize zero representation - while(hex[0] === '0' && hex !== '0') { - hex = hex.substr(1); - } - if(hex === '0') { - var last = zeroGroups[zeroGroups.length - 1]; - var idx = ip.length; - if(!last || idx !== last.end + 1) { - zeroGroups.push({start: idx, end: idx}); - } else { - last.end = idx; - if((last.end - last.start) > - (zeroGroups[zeroMaxGroup].end - zeroGroups[zeroMaxGroup].start)) { - zeroMaxGroup = zeroGroups.length - 1; - } - } - } - ip.push(hex); - } - if(zeroGroups.length > 0) { - var group = zeroGroups[zeroMaxGroup]; - // only shorten group of length > 0 - if(group.end - group.start > 0) { - ip.splice(group.start, group.end - group.start + 1, ''); - if(group.start === 0) { - ip.unshift(''); - } - if(group.end === 7) { - ip.push(''); - } - } - } - return ip.join(':'); -}; - -/** - * Estimates the number of processes that can be run concurrently. If - * creating Web Workers, keep in mind that the main JavaScript process needs - * its own core. - * - * @param options the options to use: - * update true to force an update (not use the cached value). - * @param callback(err, max) called once the operation completes. - */ -util.estimateCores = function(options, callback) { - if(typeof options === 'function') { - callback = options; - options = {}; - } - options = options || {}; - if('cores' in util && !options.update) { - return callback(null, util.cores); - } - if(typeof navigator !== 'undefined' && - 'hardwareConcurrency' in navigator && - navigator.hardwareConcurrency > 0) { - util.cores = navigator.hardwareConcurrency; - return callback(null, util.cores); - } - if(typeof Worker === 'undefined') { - // workers not available - util.cores = 1; - return callback(null, util.cores); - } - if(typeof Blob === 'undefined') { - // can't estimate, default to 2 - util.cores = 2; - return callback(null, util.cores); - } - - // create worker concurrency estimation code as blob - var blobUrl = URL.createObjectURL(new Blob(['(', - function() { - self.addEventListener('message', function(e) { - // run worker for 4 ms - var st = Date.now(); - var et = st + 4; - while(Date.now() < et); - self.postMessage({st: st, et: et}); - }); - }.toString(), - ')()'], {type: 'application/javascript'})); - - // take 5 samples using 16 workers - sample([], 5, 16); - - function sample(max, samples, numWorkers) { - if(samples === 0) { - // get overlap average - var avg = Math.floor(max.reduce(function(avg, x) { - return avg + x; - }, 0) / max.length); - util.cores = Math.max(1, avg); - URL.revokeObjectURL(blobUrl); - return callback(null, util.cores); - } - map(numWorkers, function(err, results) { - max.push(reduce(numWorkers, results)); - sample(max, samples - 1, numWorkers); - }); - } - - function map(numWorkers, callback) { - var workers = []; - var results = []; - for(var i = 0; i < numWorkers; ++i) { - var worker = new Worker(blobUrl); - worker.addEventListener('message', function(e) { - results.push(e.data); - if(results.length === numWorkers) { - for(var i = 0; i < numWorkers; ++i) { - workers[i].terminate(); - } - callback(null, results); - } - }); - workers.push(worker); - } - for(var i = 0; i < numWorkers; ++i) { - workers[i].postMessage(i); - } - } - - function reduce(numWorkers, results) { - // find overlapping time windows - var overlaps = []; - for(var n = 0; n < numWorkers; ++n) { - var r1 = results[n]; - var overlap = overlaps[n] = []; - for(var i = 0; i < numWorkers; ++i) { - if(n === i) { - continue; - } - var r2 = results[i]; - if((r1.st > r2.st && r1.st < r2.et) || - (r2.st > r1.st && r2.st < r1.et)) { - overlap.push(i); - } - } - } - // get maximum overlaps ... don't include overlapping worker itself - // as the main JS process was also being scheduled during the work and - // would have to be subtracted from the estimate anyway - return overlaps.reduce(function(max, overlap) { - return Math.max(max, overlap.length); - }, 0); - } -}; diff --git a/node_modules/node-forge/lib/x509.js b/node_modules/node-forge/lib/x509.js deleted file mode 100644 index 95dbc294..00000000 --- a/node_modules/node-forge/lib/x509.js +++ /dev/null @@ -1,3333 +0,0 @@ -/** - * Javascript implementation of X.509 and related components (such as - * Certification Signing Requests) of a Public Key Infrastructure. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - * - * The ASN.1 representation of an X.509v3 certificate is as follows - * (see RFC 2459): - * - * Certificate ::= SEQUENCE { - * tbsCertificate TBSCertificate, - * signatureAlgorithm AlgorithmIdentifier, - * signatureValue BIT STRING - * } - * - * TBSCertificate ::= SEQUENCE { - * version [0] EXPLICIT Version DEFAULT v1, - * serialNumber CertificateSerialNumber, - * signature AlgorithmIdentifier, - * issuer Name, - * validity Validity, - * subject Name, - * subjectPublicKeyInfo SubjectPublicKeyInfo, - * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, - * -- If present, version shall be v2 or v3 - * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, - * -- If present, version shall be v2 or v3 - * extensions [3] EXPLICIT Extensions OPTIONAL - * -- If present, version shall be v3 - * } - * - * Version ::= INTEGER { v1(0), v2(1), v3(2) } - * - * CertificateSerialNumber ::= INTEGER - * - * Name ::= CHOICE { - * // only one possible choice for now - * RDNSequence - * } - * - * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName - * - * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue - * - * AttributeTypeAndValue ::= SEQUENCE { - * type AttributeType, - * value AttributeValue - * } - * AttributeType ::= OBJECT IDENTIFIER - * AttributeValue ::= ANY DEFINED BY AttributeType - * - * Validity ::= SEQUENCE { - * notBefore Time, - * notAfter Time - * } - * - * Time ::= CHOICE { - * utcTime UTCTime, - * generalTime GeneralizedTime - * } - * - * UniqueIdentifier ::= BIT STRING - * - * SubjectPublicKeyInfo ::= SEQUENCE { - * algorithm AlgorithmIdentifier, - * subjectPublicKey BIT STRING - * } - * - * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension - * - * Extension ::= SEQUENCE { - * extnID OBJECT IDENTIFIER, - * critical BOOLEAN DEFAULT FALSE, - * extnValue OCTET STRING - * } - * - * The only key algorithm currently supported for PKI is RSA. - * - * RSASSA-PSS signatures are described in RFC 3447 and RFC 4055. - * - * PKCS#10 v1.7 describes certificate signing requests: - * - * CertificationRequestInfo: - * - * CertificationRequestInfo ::= SEQUENCE { - * version INTEGER { v1(0) } (v1,...), - * subject Name, - * subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }}, - * attributes [0] Attributes{{ CRIAttributes }} - * } - * - * Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }} - * - * CRIAttributes ATTRIBUTE ::= { - * ... -- add any locally defined attributes here -- } - * - * Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE { - * type ATTRIBUTE.&id({IOSet}), - * values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type}) - * } - * - * CertificationRequest ::= SEQUENCE { - * certificationRequestInfo CertificationRequestInfo, - * signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }}, - * signature BIT STRING - * } - */ -var forge = require('./forge'); -require('./aes'); -require('./asn1'); -require('./des'); -require('./md'); -require('./mgf'); -require('./oids'); -require('./pem'); -require('./pss'); -require('./rsa'); -require('./util'); - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -/* Public Key Infrastructure (PKI) implementation. */ -var pki = module.exports = forge.pki = forge.pki || {}; -var oids = pki.oids; - -// short name OID mappings -var _shortNames = {}; -_shortNames['CN'] = oids['commonName']; -_shortNames['commonName'] = 'CN'; -_shortNames['C'] = oids['countryName']; -_shortNames['countryName'] = 'C'; -_shortNames['L'] = oids['localityName']; -_shortNames['localityName'] = 'L'; -_shortNames['ST'] = oids['stateOrProvinceName']; -_shortNames['stateOrProvinceName'] = 'ST'; -_shortNames['O'] = oids['organizationName']; -_shortNames['organizationName'] = 'O'; -_shortNames['OU'] = oids['organizationalUnitName']; -_shortNames['organizationalUnitName'] = 'OU'; -_shortNames['E'] = oids['emailAddress']; -_shortNames['emailAddress'] = 'E'; - -// validator for an SubjectPublicKeyInfo structure -// Note: Currently only works with an RSA public key -var publicKeyValidator = forge.pki.rsa.publicKeyValidator; - -// validator for an X.509v3 certificate -var x509CertificateValidator = { - name: 'Certificate', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'Certificate.TBSCertificate', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'tbsCertificate', - value: [{ - name: 'Certificate.TBSCertificate.version', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - value: [{ - name: 'Certificate.TBSCertificate.version.integer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'certVersion' - }] - }, { - name: 'Certificate.TBSCertificate.serialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'certSerialNumber' - }, { - name: 'Certificate.TBSCertificate.signature', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'Certificate.TBSCertificate.signature.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'certinfoSignatureOid' - }, { - name: 'Certificate.TBSCertificate.signature.parameters', - tagClass: asn1.Class.UNIVERSAL, - optional: true, - captureAsn1: 'certinfoSignatureParams' - }] - }, { - name: 'Certificate.TBSCertificate.issuer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certIssuer' - }, { - name: 'Certificate.TBSCertificate.validity', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - // Note: UTC and generalized times may both appear so the capture - // names are based on their detected order, the names used below - // are only for the common case, which validity time really means - // "notBefore" and which means "notAfter" will be determined by order - value: [{ - // notBefore (Time) (UTC time case) - name: 'Certificate.TBSCertificate.validity.notBefore (utc)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.UTCTIME, - constructed: false, - optional: true, - capture: 'certValidity1UTCTime' - }, { - // notBefore (Time) (generalized time case) - name: 'Certificate.TBSCertificate.validity.notBefore (generalized)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.GENERALIZEDTIME, - constructed: false, - optional: true, - capture: 'certValidity2GeneralizedTime' - }, { - // notAfter (Time) (only UTC time is supported) - name: 'Certificate.TBSCertificate.validity.notAfter (utc)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.UTCTIME, - constructed: false, - optional: true, - capture: 'certValidity3UTCTime' - }, { - // notAfter (Time) (only UTC time is supported) - name: 'Certificate.TBSCertificate.validity.notAfter (generalized)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.GENERALIZEDTIME, - constructed: false, - optional: true, - capture: 'certValidity4GeneralizedTime' - }] - }, { - // Name (subject) (RDNSequence) - name: 'Certificate.TBSCertificate.subject', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certSubject' - }, - // SubjectPublicKeyInfo - publicKeyValidator, - { - // issuerUniqueID (optional) - name: 'Certificate.TBSCertificate.issuerUniqueID', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - constructed: true, - optional: true, - value: [{ - name: 'Certificate.TBSCertificate.issuerUniqueID.id', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - // TODO: support arbitrary bit length ids - captureBitStringValue: 'certIssuerUniqueId' - }] - }, { - // subjectUniqueID (optional) - name: 'Certificate.TBSCertificate.subjectUniqueID', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 2, - constructed: true, - optional: true, - value: [{ - name: 'Certificate.TBSCertificate.subjectUniqueID.id', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - // TODO: support arbitrary bit length ids - captureBitStringValue: 'certSubjectUniqueId' - }] - }, { - // Extensions (optional) - name: 'Certificate.TBSCertificate.extensions', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 3, - constructed: true, - captureAsn1: 'certExtensions', - optional: true - }] - }, { - // AlgorithmIdentifier (signature algorithm) - name: 'Certificate.signatureAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // algorithm - name: 'Certificate.signatureAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'certSignatureOid' - }, { - name: 'Certificate.TBSCertificate.signature.parameters', - tagClass: asn1.Class.UNIVERSAL, - optional: true, - captureAsn1: 'certSignatureParams' - }] - }, { - // SignatureValue - name: 'Certificate.signatureValue', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - captureBitStringValue: 'certSignature' - }] -}; - -var rsassaPssParameterValidator = { - name: 'rsapss', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'rsapss.hashAlgorithm', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - value: [{ - name: 'rsapss.hashAlgorithm.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.SEQUENCE, - constructed: true, - optional: true, - value: [{ - name: 'rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'hashOid' - /* parameter block omitted, for SHA1 NULL anyhow. */ - }] - }] - }, { - name: 'rsapss.maskGenAlgorithm', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - constructed: true, - value: [{ - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.SEQUENCE, - constructed: true, - optional: true, - value: [{ - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'maskGenOid' - }, { - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'maskGenHashOid' - /* parameter block omitted, for SHA1 NULL anyhow. */ - }] - }] - }] - }, { - name: 'rsapss.saltLength', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 2, - optional: true, - value: [{ - name: 'rsapss.saltLength.saltLength', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.INTEGER, - constructed: false, - capture: 'saltLength' - }] - }, { - name: 'rsapss.trailerField', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 3, - optional: true, - value: [{ - name: 'rsapss.trailer.trailer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.INTEGER, - constructed: false, - capture: 'trailer' - }] - }] -}; - -// validator for a CertificationRequestInfo structure -var certificationRequestInfoValidator = { - name: 'CertificationRequestInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certificationRequestInfo', - value: [{ - name: 'CertificationRequestInfo.integer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'certificationRequestInfoVersion' - }, { - // Name (subject) (RDNSequence) - name: 'CertificationRequestInfo.subject', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certificationRequestInfoSubject' - }, - // SubjectPublicKeyInfo - publicKeyValidator, - { - name: 'CertificationRequestInfo.attributes', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - capture: 'certificationRequestInfoAttributes', - value: [{ - name: 'CertificationRequestInfo.attributes', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'CertificationRequestInfo.attributes.type', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false - }, { - name: 'CertificationRequestInfo.attributes.value', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true - }] - }] - }] -}; - -// validator for a CertificationRequest structure -var certificationRequestValidator = { - name: 'CertificationRequest', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'csr', - value: [ - certificationRequestInfoValidator, { - // AlgorithmIdentifier (signature algorithm) - name: 'CertificationRequest.signatureAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // algorithm - name: 'CertificationRequest.signatureAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'csrSignatureOid' - }, { - name: 'CertificationRequest.signatureAlgorithm.parameters', - tagClass: asn1.Class.UNIVERSAL, - optional: true, - captureAsn1: 'csrSignatureParams' - }] - }, { - // signature - name: 'CertificationRequest.signature', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - captureBitStringValue: 'csrSignature' - } - ] -}; - -/** - * Converts an RDNSequence of ASN.1 DER-encoded RelativeDistinguishedName - * sets into an array with objects that have type and value properties. - * - * @param rdn the RDNSequence to convert. - * @param md a message digest to append type and value to if provided. - */ -pki.RDNAttributesAsArray = function(rdn, md) { - var rval = []; - - // each value in 'rdn' in is a SET of RelativeDistinguishedName - var set, attr, obj; - for(var si = 0; si < rdn.value.length; ++si) { - // get the RelativeDistinguishedName set - set = rdn.value[si]; - - // each value in the SET is an AttributeTypeAndValue sequence - // containing first a type (an OID) and second a value (defined by - // the OID) - for(var i = 0; i < set.value.length; ++i) { - obj = {}; - attr = set.value[i]; - obj.type = asn1.derToOid(attr.value[0].value); - obj.value = attr.value[1].value; - obj.valueTagClass = attr.value[1].type; - // if the OID is known, get its name and short name - if(obj.type in oids) { - obj.name = oids[obj.type]; - if(obj.name in _shortNames) { - obj.shortName = _shortNames[obj.name]; - } - } - if(md) { - md.update(obj.type); - md.update(obj.value); - } - rval.push(obj); - } - } - - return rval; -}; - -/** - * Converts ASN.1 CRIAttributes into an array with objects that have type and - * value properties. - * - * @param attributes the CRIAttributes to convert. - */ -pki.CRIAttributesAsArray = function(attributes) { - var rval = []; - - // each value in 'attributes' in is a SEQUENCE with an OID and a SET - for(var si = 0; si < attributes.length; ++si) { - // get the attribute sequence - var seq = attributes[si]; - - // each value in the SEQUENCE containing first a type (an OID) and - // second a set of values (defined by the OID) - var type = asn1.derToOid(seq.value[0].value); - var values = seq.value[1].value; - for(var vi = 0; vi < values.length; ++vi) { - var obj = {}; - obj.type = type; - obj.value = values[vi].value; - obj.valueTagClass = values[vi].type; - // if the OID is known, get its name and short name - if(obj.type in oids) { - obj.name = oids[obj.type]; - if(obj.name in _shortNames) { - obj.shortName = _shortNames[obj.name]; - } - } - // parse extensions - if(obj.type === oids.extensionRequest) { - obj.extensions = []; - for(var ei = 0; ei < obj.value.length; ++ei) { - obj.extensions.push(pki.certificateExtensionFromAsn1(obj.value[ei])); - } - } - rval.push(obj); - } - } - - return rval; -}; - -/** - * Gets an issuer or subject attribute from its name, type, or short name. - * - * @param obj the issuer or subject object. - * @param options a short name string or an object with: - * shortName the short name for the attribute. - * name the name for the attribute. - * type the type for the attribute. - * - * @return the attribute. - */ -function _getAttribute(obj, options) { - if(typeof options === 'string') { - options = {shortName: options}; - } - - var rval = null; - var attr; - for(var i = 0; rval === null && i < obj.attributes.length; ++i) { - attr = obj.attributes[i]; - if(options.type && options.type === attr.type) { - rval = attr; - } else if(options.name && options.name === attr.name) { - rval = attr; - } else if(options.shortName && options.shortName === attr.shortName) { - rval = attr; - } - } - return rval; -} - -/** - * Converts signature parameters from ASN.1 structure. - * - * Currently only RSASSA-PSS supported. The PKCS#1 v1.5 signature scheme had - * no parameters. - * - * RSASSA-PSS-params ::= SEQUENCE { - * hashAlgorithm [0] HashAlgorithm DEFAULT - * sha1Identifier, - * maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT - * mgf1SHA1Identifier, - * saltLength [2] INTEGER DEFAULT 20, - * trailerField [3] INTEGER DEFAULT 1 - * } - * - * HashAlgorithm ::= AlgorithmIdentifier - * - * MaskGenAlgorithm ::= AlgorithmIdentifier - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * @param oid The OID specifying the signature algorithm - * @param obj The ASN.1 structure holding the parameters - * @param fillDefaults Whether to use return default values where omitted - * @return signature parameter object - */ -var _readSignatureParameters = function(oid, obj, fillDefaults) { - var params = {}; - - if(oid !== oids['RSASSA-PSS']) { - return params; - } - - if(fillDefaults) { - params = { - hash: { - algorithmOid: oids['sha1'] - }, - mgf: { - algorithmOid: oids['mgf1'], - hash: { - algorithmOid: oids['sha1'] - } - }, - saltLength: 20 - }; - } - - var capture = {}; - var errors = []; - if(!asn1.validate(obj, rsassaPssParameterValidator, capture, errors)) { - var error = new Error('Cannot read RSASSA-PSS parameter block.'); - error.errors = errors; - throw error; - } - - if(capture.hashOid !== undefined) { - params.hash = params.hash || {}; - params.hash.algorithmOid = asn1.derToOid(capture.hashOid); - } - - if(capture.maskGenOid !== undefined) { - params.mgf = params.mgf || {}; - params.mgf.algorithmOid = asn1.derToOid(capture.maskGenOid); - params.mgf.hash = params.mgf.hash || {}; - params.mgf.hash.algorithmOid = asn1.derToOid(capture.maskGenHashOid); - } - - if(capture.saltLength !== undefined) { - params.saltLength = capture.saltLength.charCodeAt(0); - } - - return params; -}; - -/** - * Converts an X.509 certificate from PEM format. - * - * Note: If the certificate is to be verified then compute hash should - * be set to true. This will scan the TBSCertificate part of the ASN.1 - * object while it is converted so it doesn't need to be converted back - * to ASN.1-DER-encoding later. - * - * @param pem the PEM-formatted certificate. - * @param computeHash true to compute the hash for verification. - * @param strict true to be strict when checking ASN.1 value lengths, false to - * allow truncated values (default: true). - * - * @return the certificate. - */ -pki.certificateFromPem = function(pem, computeHash, strict) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'CERTIFICATE' && - msg.type !== 'X509 CERTIFICATE' && - msg.type !== 'TRUSTED CERTIFICATE') { - var error = new Error( - 'Could not convert certificate from PEM; PEM header type ' + - 'is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error( - 'Could not convert certificate from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body, strict); - - return pki.certificateFromAsn1(obj, computeHash); -}; - -/** - * Converts an X.509 certificate to PEM format. - * - * @param cert the certificate. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted certificate. - */ -pki.certificateToPem = function(cert, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'CERTIFICATE', - body: asn1.toDer(pki.certificateToAsn1(cert)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts an RSA public key from PEM format. - * - * @param pem the PEM-formatted public key. - * - * @return the public key. - */ -pki.publicKeyFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'PUBLIC KEY' && msg.type !== 'RSA PUBLIC KEY') { - var error = new Error('Could not convert public key from PEM; PEM header ' + - 'type is not "PUBLIC KEY" or "RSA PUBLIC KEY".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert public key from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body); - - return pki.publicKeyFromAsn1(obj); -}; - -/** - * Converts an RSA public key to PEM format (using a SubjectPublicKeyInfo). - * - * @param key the public key. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted public key. - */ -pki.publicKeyToPem = function(key, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'PUBLIC KEY', - body: asn1.toDer(pki.publicKeyToAsn1(key)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts an RSA public key to PEM format (using an RSAPublicKey). - * - * @param key the public key. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted public key. - */ -pki.publicKeyToRSAPublicKeyPem = function(key, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'RSA PUBLIC KEY', - body: asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Gets a fingerprint for the given public key. - * - * @param options the options to use. - * [md] the message digest object to use (defaults to forge.md.sha1). - * [type] the type of fingerprint, such as 'RSAPublicKey', - * 'SubjectPublicKeyInfo' (defaults to 'RSAPublicKey'). - * [encoding] an alternative output encoding, such as 'hex' - * (defaults to none, outputs a byte buffer). - * [delimiter] the delimiter to use between bytes for 'hex' encoded - * output, eg: ':' (defaults to none). - * - * @return the fingerprint as a byte buffer or other encoding based on options. - */ -pki.getPublicKeyFingerprint = function(key, options) { - options = options || {}; - var md = options.md || forge.md.sha1.create(); - var type = options.type || 'RSAPublicKey'; - - var bytes; - switch(type) { - case 'RSAPublicKey': - bytes = asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes(); - break; - case 'SubjectPublicKeyInfo': - bytes = asn1.toDer(pki.publicKeyToAsn1(key)).getBytes(); - break; - default: - throw new Error('Unknown fingerprint type "' + options.type + '".'); - } - - // hash public key bytes - md.start(); - md.update(bytes); - var digest = md.digest(); - if(options.encoding === 'hex') { - var hex = digest.toHex(); - if(options.delimiter) { - return hex.match(/.{2}/g).join(options.delimiter); - } - return hex; - } else if(options.encoding === 'binary') { - return digest.getBytes(); - } else if(options.encoding) { - throw new Error('Unknown encoding "' + options.encoding + '".'); - } - return digest; -}; - -/** - * Converts a PKCS#10 certification request (CSR) from PEM format. - * - * Note: If the certification request is to be verified then compute hash - * should be set to true. This will scan the CertificationRequestInfo part of - * the ASN.1 object while it is converted so it doesn't need to be converted - * back to ASN.1-DER-encoding later. - * - * @param pem the PEM-formatted certificate. - * @param computeHash true to compute the hash for verification. - * @param strict true to be strict when checking ASN.1 value lengths, false to - * allow truncated values (default: true). - * - * @return the certification request (CSR). - */ -pki.certificationRequestFromPem = function(pem, computeHash, strict) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'CERTIFICATE REQUEST') { - var error = new Error('Could not convert certification request from PEM; ' + - 'PEM header type is not "CERTIFICATE REQUEST".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert certification request from PEM; ' + - 'PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body, strict); - - return pki.certificationRequestFromAsn1(obj, computeHash); -}; - -/** - * Converts a PKCS#10 certification request (CSR) to PEM format. - * - * @param csr the certification request. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted certification request. - */ -pki.certificationRequestToPem = function(csr, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'CERTIFICATE REQUEST', - body: asn1.toDer(pki.certificationRequestToAsn1(csr)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Creates an empty X.509v3 RSA certificate. - * - * @return the certificate. - */ -pki.createCertificate = function() { - var cert = {}; - cert.version = 0x02; - cert.serialNumber = '00'; - cert.signatureOid = null; - cert.signature = null; - cert.siginfo = {}; - cert.siginfo.algorithmOid = null; - cert.validity = {}; - cert.validity.notBefore = new Date(); - cert.validity.notAfter = new Date(); - - cert.issuer = {}; - cert.issuer.getField = function(sn) { - return _getAttribute(cert.issuer, sn); - }; - cert.issuer.addField = function(attr) { - _fillMissingFields([attr]); - cert.issuer.attributes.push(attr); - }; - cert.issuer.attributes = []; - cert.issuer.hash = null; - - cert.subject = {}; - cert.subject.getField = function(sn) { - return _getAttribute(cert.subject, sn); - }; - cert.subject.addField = function(attr) { - _fillMissingFields([attr]); - cert.subject.attributes.push(attr); - }; - cert.subject.attributes = []; - cert.subject.hash = null; - - cert.extensions = []; - cert.publicKey = null; - cert.md = null; - - /** - * Sets the subject of this certificate. - * - * @param attrs the array of subject attributes to use. - * @param uniqueId an optional a unique ID to use. - */ - cert.setSubject = function(attrs, uniqueId) { - // set new attributes, clear hash - _fillMissingFields(attrs); - cert.subject.attributes = attrs; - delete cert.subject.uniqueId; - if(uniqueId) { - // TODO: support arbitrary bit length ids - cert.subject.uniqueId = uniqueId; - } - cert.subject.hash = null; - }; - - /** - * Sets the issuer of this certificate. - * - * @param attrs the array of issuer attributes to use. - * @param uniqueId an optional a unique ID to use. - */ - cert.setIssuer = function(attrs, uniqueId) { - // set new attributes, clear hash - _fillMissingFields(attrs); - cert.issuer.attributes = attrs; - delete cert.issuer.uniqueId; - if(uniqueId) { - // TODO: support arbitrary bit length ids - cert.issuer.uniqueId = uniqueId; - } - cert.issuer.hash = null; - }; - - /** - * Sets the extensions of this certificate. - * - * @param exts the array of extensions to use. - */ - cert.setExtensions = function(exts) { - for(var i = 0; i < exts.length; ++i) { - _fillMissingExtensionFields(exts[i], {cert: cert}); - } - // set new extensions - cert.extensions = exts; - }; - - /** - * Gets an extension by its name or id. - * - * @param options the name to use or an object with: - * name the name to use. - * id the id to use. - * - * @return the extension or null if not found. - */ - cert.getExtension = function(options) { - if(typeof options === 'string') { - options = {name: options}; - } - - var rval = null; - var ext; - for(var i = 0; rval === null && i < cert.extensions.length; ++i) { - ext = cert.extensions[i]; - if(options.id && ext.id === options.id) { - rval = ext; - } else if(options.name && ext.name === options.name) { - rval = ext; - } - } - return rval; - }; - - /** - * Signs this certificate using the given private key. - * - * @param key the private key to sign with. - * @param md the message digest object to use (defaults to forge.md.sha1). - */ - cert.sign = function(key, md) { - // TODO: get signature OID from private key - cert.md = md || forge.md.sha1.create(); - var algorithmOid = oids[cert.md.algorithm + 'WithRSAEncryption']; - if(!algorithmOid) { - var error = new Error('Could not compute certificate digest. ' + - 'Unknown message digest algorithm OID.'); - error.algorithm = cert.md.algorithm; - throw error; - } - cert.signatureOid = cert.siginfo.algorithmOid = algorithmOid; - - // get TBSCertificate, convert to DER - cert.tbsCertificate = pki.getTBSCertificate(cert); - var bytes = asn1.toDer(cert.tbsCertificate); - - // digest and sign - cert.md.update(bytes.getBytes()); - cert.signature = key.sign(cert.md); - }; - - /** - * Attempts verify the signature on the passed certificate using this - * certificate's public key. - * - * @param child the certificate to verify. - * - * @return true if verified, false if not. - */ - cert.verify = function(child) { - var rval = false; - - if(!cert.issued(child)) { - var issuer = child.issuer; - var subject = cert.subject; - var error = new Error( - 'The parent certificate did not issue the given child ' + - 'certificate; the child certificate\'s issuer does not match the ' + - 'parent\'s subject.'); - error.expectedIssuer = issuer.attributes; - error.actualIssuer = subject.attributes; - throw error; - } - - var md = child.md; - if(md === null) { - // check signature OID for supported signature types - if(child.signatureOid in oids) { - var oid = oids[child.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - md = forge.md.sha256.create(); - break; - } - } - if(md === null) { - var error = new Error('Could not compute certificate digest. ' + - 'Unknown signature OID.'); - error.signatureOid = child.signatureOid; - throw error; - } - - // produce DER formatted TBSCertificate and digest it - var tbsCertificate = child.tbsCertificate || pki.getTBSCertificate(child); - var bytes = asn1.toDer(tbsCertificate); - md.update(bytes.getBytes()); - } - - if(md !== null) { - var scheme; - - switch(child.signatureOid) { - case oids.sha1WithRSAEncryption: - scheme = undefined; /* use PKCS#1 v1.5 padding scheme */ - break; - case oids['RSASSA-PSS']: - var hash, mgf; - - /* initialize mgf */ - hash = oids[child.signatureParameters.mgf.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - var error = new Error('Unsupported MGF hash function.'); - error.oid = child.signatureParameters.mgf.hash.algorithmOid; - error.name = hash; - throw error; - } - - mgf = oids[child.signatureParameters.mgf.algorithmOid]; - if(mgf === undefined || forge.mgf[mgf] === undefined) { - var error = new Error('Unsupported MGF function.'); - error.oid = child.signatureParameters.mgf.algorithmOid; - error.name = mgf; - throw error; - } - - mgf = forge.mgf[mgf].create(forge.md[hash].create()); - - /* initialize hash function */ - hash = oids[child.signatureParameters.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - throw { - message: 'Unsupported RSASSA-PSS hash function.', - oid: child.signatureParameters.hash.algorithmOid, - name: hash - }; - } - - scheme = forge.pss.create(forge.md[hash].create(), mgf, - child.signatureParameters.saltLength); - break; - } - - // verify signature on cert using public key - rval = cert.publicKey.verify( - md.digest().getBytes(), child.signature, scheme); - } - - return rval; - }; - - /** - * Returns true if this certificate's issuer matches the passed - * certificate's subject. Note that no signature check is performed. - * - * @param parent the certificate to check. - * - * @return true if this certificate's issuer matches the passed certificate's - * subject. - */ - cert.isIssuer = function(parent) { - var rval = false; - - var i = cert.issuer; - var s = parent.subject; - - // compare hashes if present - if(i.hash && s.hash) { - rval = (i.hash === s.hash); - } else if(i.attributes.length === s.attributes.length) { - // all attributes are the same so issuer matches subject - rval = true; - var iattr, sattr; - for(var n = 0; rval && n < i.attributes.length; ++n) { - iattr = i.attributes[n]; - sattr = s.attributes[n]; - if(iattr.type !== sattr.type || iattr.value !== sattr.value) { - // attribute mismatch - rval = false; - } - } - } - - return rval; - }; - - /** - * Returns true if this certificate's subject matches the issuer of the - * given certificate). Note that not signature check is performed. - * - * @param child the certificate to check. - * - * @return true if this certificate's subject matches the passed - * certificate's issuer. - */ - cert.issued = function(child) { - return child.isIssuer(cert); - }; - - /** - * Generates the subjectKeyIdentifier for this certificate as byte buffer. - * - * @return the subjectKeyIdentifier for this certificate as byte buffer. - */ - cert.generateSubjectKeyIdentifier = function() { - /* See: 4.2.1.2 section of the the RFC3280, keyIdentifier is either: - - (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the - value of the BIT STRING subjectPublicKey (excluding the tag, - length, and number of unused bits). - - (2) The keyIdentifier is composed of a four bit type field with - the value 0100 followed by the least significant 60 bits of the - SHA-1 hash of the value of the BIT STRING subjectPublicKey - (excluding the tag, length, and number of unused bit string bits). - */ - - // skipping the tag, length, and number of unused bits is the same - // as just using the RSAPublicKey (for RSA keys, which are the - // only ones supported) - return pki.getPublicKeyFingerprint(cert.publicKey, {type: 'RSAPublicKey'}); - }; - - /** - * Verifies the subjectKeyIdentifier extension value for this certificate - * against its public key. If no extension is found, false will be - * returned. - * - * @return true if verified, false if not. - */ - cert.verifySubjectKeyIdentifier = function() { - var oid = oids['subjectKeyIdentifier']; - for(var i = 0; i < cert.extensions.length; ++i) { - var ext = cert.extensions[i]; - if(ext.id === oid) { - var ski = cert.generateSubjectKeyIdentifier().getBytes(); - return (forge.util.hexToBytes(ext.subjectKeyIdentifier) === ski); - } - } - return false; - }; - - return cert; -}; - -/** - * Converts an X.509v3 RSA certificate from an ASN.1 object. - * - * Note: If the certificate is to be verified then compute hash should - * be set to true. There is currently no implementation for converting - * a certificate back to ASN.1 so the TBSCertificate part of the ASN.1 - * object needs to be scanned before the cert object is created. - * - * @param obj the asn1 representation of an X.509v3 RSA certificate. - * @param computeHash true to compute the hash for verification. - * - * @return the certificate. - */ -pki.certificateFromAsn1 = function(obj, computeHash) { - // validate certificate and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, x509CertificateValidator, capture, errors)) { - var error = new Error('Cannot read X.509 certificate. ' + - 'ASN.1 object is not an X509v3 Certificate.'); - error.errors = errors; - throw error; - } - - // get oid - var oid = asn1.derToOid(capture.publicKeyOid); - if(oid !== pki.oids.rsaEncryption) { - throw new Error('Cannot read public key. OID is not RSA.'); - } - - // create certificate - var cert = pki.createCertificate(); - cert.version = capture.certVersion ? - capture.certVersion.charCodeAt(0) : 0; - var serial = forge.util.createBuffer(capture.certSerialNumber); - cert.serialNumber = serial.toHex(); - cert.signatureOid = forge.asn1.derToOid(capture.certSignatureOid); - cert.signatureParameters = _readSignatureParameters( - cert.signatureOid, capture.certSignatureParams, true); - cert.siginfo.algorithmOid = forge.asn1.derToOid(capture.certinfoSignatureOid); - cert.siginfo.parameters = _readSignatureParameters(cert.siginfo.algorithmOid, - capture.certinfoSignatureParams, false); - cert.signature = capture.certSignature; - - var validity = []; - if(capture.certValidity1UTCTime !== undefined) { - validity.push(asn1.utcTimeToDate(capture.certValidity1UTCTime)); - } - if(capture.certValidity2GeneralizedTime !== undefined) { - validity.push(asn1.generalizedTimeToDate( - capture.certValidity2GeneralizedTime)); - } - if(capture.certValidity3UTCTime !== undefined) { - validity.push(asn1.utcTimeToDate(capture.certValidity3UTCTime)); - } - if(capture.certValidity4GeneralizedTime !== undefined) { - validity.push(asn1.generalizedTimeToDate( - capture.certValidity4GeneralizedTime)); - } - if(validity.length > 2) { - throw new Error('Cannot read notBefore/notAfter validity times; more ' + - 'than two times were provided in the certificate.'); - } - if(validity.length < 2) { - throw new Error('Cannot read notBefore/notAfter validity times; they ' + - 'were not provided as either UTCTime or GeneralizedTime.'); - } - cert.validity.notBefore = validity[0]; - cert.validity.notAfter = validity[1]; - - // keep TBSCertificate to preserve signature when exporting - cert.tbsCertificate = capture.tbsCertificate; - - if(computeHash) { - // check signature OID for supported signature types - cert.md = null; - if(cert.signatureOid in oids) { - var oid = oids[cert.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - cert.md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - cert.md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - cert.md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - cert.md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - cert.md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - cert.md = forge.md.sha256.create(); - break; - } - } - if(cert.md === null) { - var error = new Error('Could not compute certificate digest. ' + - 'Unknown signature OID.'); - error.signatureOid = cert.signatureOid; - throw error; - } - - // produce DER formatted TBSCertificate and digest it - var bytes = asn1.toDer(cert.tbsCertificate); - cert.md.update(bytes.getBytes()); - } - - // handle issuer, build issuer message digest - var imd = forge.md.sha1.create(); - cert.issuer.getField = function(sn) { - return _getAttribute(cert.issuer, sn); - }; - cert.issuer.addField = function(attr) { - _fillMissingFields([attr]); - cert.issuer.attributes.push(attr); - }; - cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer, imd); - if(capture.certIssuerUniqueId) { - cert.issuer.uniqueId = capture.certIssuerUniqueId; - } - cert.issuer.hash = imd.digest().toHex(); - - // handle subject, build subject message digest - var smd = forge.md.sha1.create(); - cert.subject.getField = function(sn) { - return _getAttribute(cert.subject, sn); - }; - cert.subject.addField = function(attr) { - _fillMissingFields([attr]); - cert.subject.attributes.push(attr); - }; - cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject, smd); - if(capture.certSubjectUniqueId) { - cert.subject.uniqueId = capture.certSubjectUniqueId; - } - cert.subject.hash = smd.digest().toHex(); - - // handle extensions - if(capture.certExtensions) { - cert.extensions = pki.certificateExtensionsFromAsn1(capture.certExtensions); - } else { - cert.extensions = []; - } - - // convert RSA public key from ASN.1 - cert.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo); - - return cert; -}; - -/** - * Converts an ASN.1 extensions object (with extension sequences as its - * values) into an array of extension objects with types and values. - * - * Supported extensions: - * - * id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 } - * KeyUsage ::= BIT STRING { - * digitalSignature (0), - * nonRepudiation (1), - * keyEncipherment (2), - * dataEncipherment (3), - * keyAgreement (4), - * keyCertSign (5), - * cRLSign (6), - * encipherOnly (7), - * decipherOnly (8) - * } - * - * id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 } - * BasicConstraints ::= SEQUENCE { - * cA BOOLEAN DEFAULT FALSE, - * pathLenConstraint INTEGER (0..MAX) OPTIONAL - * } - * - * subjectAltName EXTENSION ::= { - * SYNTAX GeneralNames - * IDENTIFIED BY id-ce-subjectAltName - * } - * - * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName - * - * GeneralName ::= CHOICE { - * otherName [0] INSTANCE OF OTHER-NAME, - * rfc822Name [1] IA5String, - * dNSName [2] IA5String, - * x400Address [3] ORAddress, - * directoryName [4] Name, - * ediPartyName [5] EDIPartyName, - * uniformResourceIdentifier [6] IA5String, - * IPAddress [7] OCTET STRING, - * registeredID [8] OBJECT IDENTIFIER - * } - * - * OTHER-NAME ::= TYPE-IDENTIFIER - * - * EDIPartyName ::= SEQUENCE { - * nameAssigner [0] DirectoryString {ub-name} OPTIONAL, - * partyName [1] DirectoryString {ub-name} - * } - * - * @param exts the extensions ASN.1 with extension sequences to parse. - * - * @return the array. - */ -pki.certificateExtensionsFromAsn1 = function(exts) { - var rval = []; - for(var i = 0; i < exts.value.length; ++i) { - // get extension sequence - var extseq = exts.value[i]; - for(var ei = 0; ei < extseq.value.length; ++ei) { - rval.push(pki.certificateExtensionFromAsn1(extseq.value[ei])); - } - } - - return rval; -}; - -/** - * Parses a single certificate extension from ASN.1. - * - * @param ext the extension in ASN.1 format. - * - * @return the parsed extension as an object. - */ -pki.certificateExtensionFromAsn1 = function(ext) { - // an extension has: - // [0] extnID OBJECT IDENTIFIER - // [1] critical BOOLEAN DEFAULT FALSE - // [2] extnValue OCTET STRING - var e = {}; - e.id = asn1.derToOid(ext.value[0].value); - e.critical = false; - if(ext.value[1].type === asn1.Type.BOOLEAN) { - e.critical = (ext.value[1].value.charCodeAt(0) !== 0x00); - e.value = ext.value[2].value; - } else { - e.value = ext.value[1].value; - } - // if the oid is known, get its name - if(e.id in oids) { - e.name = oids[e.id]; - - // handle key usage - if(e.name === 'keyUsage') { - // get value as BIT STRING - var ev = asn1.fromDer(e.value); - var b2 = 0x00; - var b3 = 0x00; - if(ev.value.length > 1) { - // skip first byte, just indicates unused bits which - // will be padded with 0s anyway - // get bytes with flag bits - b2 = ev.value.charCodeAt(1); - b3 = ev.value.length > 2 ? ev.value.charCodeAt(2) : 0; - } - // set flags - e.digitalSignature = (b2 & 0x80) === 0x80; - e.nonRepudiation = (b2 & 0x40) === 0x40; - e.keyEncipherment = (b2 & 0x20) === 0x20; - e.dataEncipherment = (b2 & 0x10) === 0x10; - e.keyAgreement = (b2 & 0x08) === 0x08; - e.keyCertSign = (b2 & 0x04) === 0x04; - e.cRLSign = (b2 & 0x02) === 0x02; - e.encipherOnly = (b2 & 0x01) === 0x01; - e.decipherOnly = (b3 & 0x80) === 0x80; - } else if(e.name === 'basicConstraints') { - // handle basic constraints - // get value as SEQUENCE - var ev = asn1.fromDer(e.value); - // get cA BOOLEAN flag (defaults to false) - if(ev.value.length > 0 && ev.value[0].type === asn1.Type.BOOLEAN) { - e.cA = (ev.value[0].value.charCodeAt(0) !== 0x00); - } else { - e.cA = false; - } - // get path length constraint - var value = null; - if(ev.value.length > 0 && ev.value[0].type === asn1.Type.INTEGER) { - value = ev.value[0].value; - } else if(ev.value.length > 1) { - value = ev.value[1].value; - } - if(value !== null) { - e.pathLenConstraint = asn1.derToInteger(value); - } - } else if(e.name === 'extKeyUsage') { - // handle extKeyUsage - // value is a SEQUENCE of OIDs - var ev = asn1.fromDer(e.value); - for(var vi = 0; vi < ev.value.length; ++vi) { - var oid = asn1.derToOid(ev.value[vi].value); - if(oid in oids) { - e[oids[oid]] = true; - } else { - e[oid] = true; - } - } - } else if(e.name === 'nsCertType') { - // handle nsCertType - // get value as BIT STRING - var ev = asn1.fromDer(e.value); - var b2 = 0x00; - if(ev.value.length > 1) { - // skip first byte, just indicates unused bits which - // will be padded with 0s anyway - // get bytes with flag bits - b2 = ev.value.charCodeAt(1); - } - // set flags - e.client = (b2 & 0x80) === 0x80; - e.server = (b2 & 0x40) === 0x40; - e.email = (b2 & 0x20) === 0x20; - e.objsign = (b2 & 0x10) === 0x10; - e.reserved = (b2 & 0x08) === 0x08; - e.sslCA = (b2 & 0x04) === 0x04; - e.emailCA = (b2 & 0x02) === 0x02; - e.objCA = (b2 & 0x01) === 0x01; - } else if( - e.name === 'subjectAltName' || - e.name === 'issuerAltName') { - // handle subjectAltName/issuerAltName - e.altNames = []; - - // ev is a SYNTAX SEQUENCE - var gn; - var ev = asn1.fromDer(e.value); - for(var n = 0; n < ev.value.length; ++n) { - // get GeneralName - gn = ev.value[n]; - - var altName = { - type: gn.type, - value: gn.value - }; - e.altNames.push(altName); - - // Note: Support for types 1,2,6,7,8 - switch(gn.type) { - // rfc822Name - case 1: - // dNSName - case 2: - // uniformResourceIdentifier (URI) - case 6: - break; - // IPAddress - case 7: - // convert to IPv4/IPv6 string representation - altName.ip = forge.util.bytesToIP(gn.value); - break; - // registeredID - case 8: - altName.oid = asn1.derToOid(gn.value); - break; - default: - // unsupported - } - } - } else if(e.name === 'subjectKeyIdentifier') { - // value is an OCTETSTRING w/the hash of the key-type specific - // public key structure (eg: RSAPublicKey) - var ev = asn1.fromDer(e.value); - e.subjectKeyIdentifier = forge.util.bytesToHex(ev.value); - } - } - return e; -}; - -/** - * Converts a PKCS#10 certification request (CSR) from an ASN.1 object. - * - * Note: If the certification request is to be verified then compute hash - * should be set to true. There is currently no implementation for converting - * a certificate back to ASN.1 so the CertificationRequestInfo part of the - * ASN.1 object needs to be scanned before the csr object is created. - * - * @param obj the asn1 representation of a PKCS#10 certification request (CSR). - * @param computeHash true to compute the hash for verification. - * - * @return the certification request (CSR). - */ -pki.certificationRequestFromAsn1 = function(obj, computeHash) { - // validate certification request and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, certificationRequestValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#10 certificate request. ' + - 'ASN.1 object is not a PKCS#10 CertificationRequest.'); - error.errors = errors; - throw error; - } - - // get oid - var oid = asn1.derToOid(capture.publicKeyOid); - if(oid !== pki.oids.rsaEncryption) { - throw new Error('Cannot read public key. OID is not RSA.'); - } - - // create certification request - var csr = pki.createCertificationRequest(); - csr.version = capture.csrVersion ? capture.csrVersion.charCodeAt(0) : 0; - csr.signatureOid = forge.asn1.derToOid(capture.csrSignatureOid); - csr.signatureParameters = _readSignatureParameters( - csr.signatureOid, capture.csrSignatureParams, true); - csr.siginfo.algorithmOid = forge.asn1.derToOid(capture.csrSignatureOid); - csr.siginfo.parameters = _readSignatureParameters( - csr.siginfo.algorithmOid, capture.csrSignatureParams, false); - csr.signature = capture.csrSignature; - - // keep CertificationRequestInfo to preserve signature when exporting - csr.certificationRequestInfo = capture.certificationRequestInfo; - - if(computeHash) { - // check signature OID for supported signature types - csr.md = null; - if(csr.signatureOid in oids) { - var oid = oids[csr.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - csr.md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - csr.md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - csr.md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - csr.md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - csr.md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - csr.md = forge.md.sha256.create(); - break; - } - } - if(csr.md === null) { - var error = new Error('Could not compute certification request digest. ' + - 'Unknown signature OID.'); - error.signatureOid = csr.signatureOid; - throw error; - } - - // produce DER formatted CertificationRequestInfo and digest it - var bytes = asn1.toDer(csr.certificationRequestInfo); - csr.md.update(bytes.getBytes()); - } - - // handle subject, build subject message digest - var smd = forge.md.sha1.create(); - csr.subject.getField = function(sn) { - return _getAttribute(csr.subject, sn); - }; - csr.subject.addField = function(attr) { - _fillMissingFields([attr]); - csr.subject.attributes.push(attr); - }; - csr.subject.attributes = pki.RDNAttributesAsArray( - capture.certificationRequestInfoSubject, smd); - csr.subject.hash = smd.digest().toHex(); - - // convert RSA public key from ASN.1 - csr.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo); - - // convert attributes from ASN.1 - csr.getAttribute = function(sn) { - return _getAttribute(csr, sn); - }; - csr.addAttribute = function(attr) { - _fillMissingFields([attr]); - csr.attributes.push(attr); - }; - csr.attributes = pki.CRIAttributesAsArray( - capture.certificationRequestInfoAttributes || []); - - return csr; -}; - -/** - * Creates an empty certification request (a CSR or certificate signing - * request). Once created, its public key and attributes can be set and then - * it can be signed. - * - * @return the empty certification request. - */ -pki.createCertificationRequest = function() { - var csr = {}; - csr.version = 0x00; - csr.signatureOid = null; - csr.signature = null; - csr.siginfo = {}; - csr.siginfo.algorithmOid = null; - - csr.subject = {}; - csr.subject.getField = function(sn) { - return _getAttribute(csr.subject, sn); - }; - csr.subject.addField = function(attr) { - _fillMissingFields([attr]); - csr.subject.attributes.push(attr); - }; - csr.subject.attributes = []; - csr.subject.hash = null; - - csr.publicKey = null; - csr.attributes = []; - csr.getAttribute = function(sn) { - return _getAttribute(csr, sn); - }; - csr.addAttribute = function(attr) { - _fillMissingFields([attr]); - csr.attributes.push(attr); - }; - csr.md = null; - - /** - * Sets the subject of this certification request. - * - * @param attrs the array of subject attributes to use. - */ - csr.setSubject = function(attrs) { - // set new attributes - _fillMissingFields(attrs); - csr.subject.attributes = attrs; - csr.subject.hash = null; - }; - - /** - * Sets the attributes of this certification request. - * - * @param attrs the array of attributes to use. - */ - csr.setAttributes = function(attrs) { - // set new attributes - _fillMissingFields(attrs); - csr.attributes = attrs; - }; - - /** - * Signs this certification request using the given private key. - * - * @param key the private key to sign with. - * @param md the message digest object to use (defaults to forge.md.sha1). - */ - csr.sign = function(key, md) { - // TODO: get signature OID from private key - csr.md = md || forge.md.sha1.create(); - var algorithmOid = oids[csr.md.algorithm + 'WithRSAEncryption']; - if(!algorithmOid) { - var error = new Error('Could not compute certification request digest. ' + - 'Unknown message digest algorithm OID.'); - error.algorithm = csr.md.algorithm; - throw error; - } - csr.signatureOid = csr.siginfo.algorithmOid = algorithmOid; - - // get CertificationRequestInfo, convert to DER - csr.certificationRequestInfo = pki.getCertificationRequestInfo(csr); - var bytes = asn1.toDer(csr.certificationRequestInfo); - - // digest and sign - csr.md.update(bytes.getBytes()); - csr.signature = key.sign(csr.md); - }; - - /** - * Attempts verify the signature on the passed certification request using - * its public key. - * - * A CSR that has been exported to a file in PEM format can be verified using - * OpenSSL using this command: - * - * openssl req -in -verify -noout -text - * - * @return true if verified, false if not. - */ - csr.verify = function() { - var rval = false; - - var md = csr.md; - if(md === null) { - // check signature OID for supported signature types - if(csr.signatureOid in oids) { - // TODO: create DRY `OID to md` function - var oid = oids[csr.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - md = forge.md.sha256.create(); - break; - } - } - if(md === null) { - var error = new Error( - 'Could not compute certification request digest. ' + - 'Unknown signature OID.'); - error.signatureOid = csr.signatureOid; - throw error; - } - - // produce DER formatted CertificationRequestInfo and digest it - var cri = csr.certificationRequestInfo || - pki.getCertificationRequestInfo(csr); - var bytes = asn1.toDer(cri); - md.update(bytes.getBytes()); - } - - if(md !== null) { - var scheme; - - switch(csr.signatureOid) { - case oids.sha1WithRSAEncryption: - /* use PKCS#1 v1.5 padding scheme */ - break; - case oids['RSASSA-PSS']: - var hash, mgf; - - /* initialize mgf */ - hash = oids[csr.signatureParameters.mgf.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - var error = new Error('Unsupported MGF hash function.'); - error.oid = csr.signatureParameters.mgf.hash.algorithmOid; - error.name = hash; - throw error; - } - - mgf = oids[csr.signatureParameters.mgf.algorithmOid]; - if(mgf === undefined || forge.mgf[mgf] === undefined) { - var error = new Error('Unsupported MGF function.'); - error.oid = csr.signatureParameters.mgf.algorithmOid; - error.name = mgf; - throw error; - } - - mgf = forge.mgf[mgf].create(forge.md[hash].create()); - - /* initialize hash function */ - hash = oids[csr.signatureParameters.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - var error = new Error('Unsupported RSASSA-PSS hash function.'); - error.oid = csr.signatureParameters.hash.algorithmOid; - error.name = hash; - throw error; - } - - scheme = forge.pss.create(forge.md[hash].create(), mgf, - csr.signatureParameters.saltLength); - break; - } - - // verify signature on csr using its public key - rval = csr.publicKey.verify( - md.digest().getBytes(), csr.signature, scheme); - } - - return rval; - }; - - return csr; -}; - -/** - * Converts an X.509 subject or issuer to an ASN.1 RDNSequence. - * - * @param obj the subject or issuer (distinguished name). - * - * @return the ASN.1 RDNSequence. - */ -function _dnToAsn1(obj) { - // create an empty RDNSequence - var rval = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - // iterate over attributes - var attr, set; - var attrs = obj.attributes; - for(var i = 0; i < attrs.length; ++i) { - attr = attrs[i]; - var value = attr.value; - - // reuse tag class for attribute value if available - var valueTagClass = asn1.Type.PRINTABLESTRING; - if('valueTagClass' in attr) { - valueTagClass = attr.valueTagClass; - - if(valueTagClass === asn1.Type.UTF8) { - value = forge.util.encodeUtf8(value); - } - // FIXME: handle more encodings - } - - // create a RelativeDistinguishedName set - // each value in the set is an AttributeTypeAndValue first - // containing the type (an OID) and second the value - set = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AttributeType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.type).getBytes()), - // AttributeValue - asn1.create(asn1.Class.UNIVERSAL, valueTagClass, false, value) - ]) - ]); - rval.value.push(set); - } - - return rval; -} - -/** - * Gets all printable attributes (typically of an issuer or subject) in a - * simplified JSON format for display. - * - * @param attrs the attributes. - * - * @return the JSON for display. - */ -function _getAttributesAsJson(attrs) { - var rval = {}; - for(var i = 0; i < attrs.length; ++i) { - var attr = attrs[i]; - if(attr.shortName && ( - attr.valueTagClass === asn1.Type.UTF8 || - attr.valueTagClass === asn1.Type.PRINTABLESTRING || - attr.valueTagClass === asn1.Type.IA5STRING)) { - var value = attr.value; - if(attr.valueTagClass === asn1.Type.UTF8) { - value = forge.util.encodeUtf8(attr.value); - } - if(!(attr.shortName in rval)) { - rval[attr.shortName] = value; - } else if(forge.util.isArray(rval[attr.shortName])) { - rval[attr.shortName].push(value); - } else { - rval[attr.shortName] = [rval[attr.shortName], value]; - } - } - } - return rval; -} - -/** - * Fills in missing fields in attributes. - * - * @param attrs the attributes to fill missing fields in. - */ -function _fillMissingFields(attrs) { - var attr; - for(var i = 0; i < attrs.length; ++i) { - attr = attrs[i]; - - // populate missing name - if(typeof attr.name === 'undefined') { - if(attr.type && attr.type in pki.oids) { - attr.name = pki.oids[attr.type]; - } else if(attr.shortName && attr.shortName in _shortNames) { - attr.name = pki.oids[_shortNames[attr.shortName]]; - } - } - - // populate missing type (OID) - if(typeof attr.type === 'undefined') { - if(attr.name && attr.name in pki.oids) { - attr.type = pki.oids[attr.name]; - } else { - var error = new Error('Attribute type not specified.'); - error.attribute = attr; - throw error; - } - } - - // populate missing shortname - if(typeof attr.shortName === 'undefined') { - if(attr.name && attr.name in _shortNames) { - attr.shortName = _shortNames[attr.name]; - } - } - - // convert extensions to value - if(attr.type === oids.extensionRequest) { - attr.valueConstructed = true; - attr.valueTagClass = asn1.Type.SEQUENCE; - if(!attr.value && attr.extensions) { - attr.value = []; - for(var ei = 0; ei < attr.extensions.length; ++ei) { - attr.value.push(pki.certificateExtensionToAsn1( - _fillMissingExtensionFields(attr.extensions[ei]))); - } - } - } - - if(typeof attr.value === 'undefined') { - var error = new Error('Attribute value not specified.'); - error.attribute = attr; - throw error; - } - } -} - -/** - * Fills in missing fields in certificate extensions. - * - * @param e the extension. - * @param [options] the options to use. - * [cert] the certificate the extensions are for. - * - * @return the extension. - */ -function _fillMissingExtensionFields(e, options) { - options = options || {}; - - // populate missing name - if(typeof e.name === 'undefined') { - if(e.id && e.id in pki.oids) { - e.name = pki.oids[e.id]; - } - } - - // populate missing id - if(typeof e.id === 'undefined') { - if(e.name && e.name in pki.oids) { - e.id = pki.oids[e.name]; - } else { - var error = new Error('Extension ID not specified.'); - error.extension = e; - throw error; - } - } - - if(typeof e.value !== 'undefined') { - return e; - } - - // handle missing value: - - // value is a BIT STRING - if(e.name === 'keyUsage') { - // build flags - var unused = 0; - var b2 = 0x00; - var b3 = 0x00; - if(e.digitalSignature) { - b2 |= 0x80; - unused = 7; - } - if(e.nonRepudiation) { - b2 |= 0x40; - unused = 6; - } - if(e.keyEncipherment) { - b2 |= 0x20; - unused = 5; - } - if(e.dataEncipherment) { - b2 |= 0x10; - unused = 4; - } - if(e.keyAgreement) { - b2 |= 0x08; - unused = 3; - } - if(e.keyCertSign) { - b2 |= 0x04; - unused = 2; - } - if(e.cRLSign) { - b2 |= 0x02; - unused = 1; - } - if(e.encipherOnly) { - b2 |= 0x01; - unused = 0; - } - if(e.decipherOnly) { - b3 |= 0x80; - unused = 7; - } - - // create bit string - var value = String.fromCharCode(unused); - if(b3 !== 0) { - value += String.fromCharCode(b2) + String.fromCharCode(b3); - } else if(b2 !== 0) { - value += String.fromCharCode(b2); - } - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value); - } else if(e.name === 'basicConstraints') { - // basicConstraints is a SEQUENCE - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - // cA BOOLEAN flag defaults to false - if(e.cA) { - e.value.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, - String.fromCharCode(0xFF))); - } - if('pathLenConstraint' in e) { - e.value.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(e.pathLenConstraint).getBytes())); - } - } else if(e.name === 'extKeyUsage') { - // extKeyUsage is a SEQUENCE of OIDs - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var seq = e.value.value; - for(var key in e) { - if(e[key] !== true) { - continue; - } - // key is name in OID map - if(key in oids) { - seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, - false, asn1.oidToDer(oids[key]).getBytes())); - } else if(key.indexOf('.') !== -1) { - // assume key is an OID - seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, - false, asn1.oidToDer(key).getBytes())); - } - } - } else if(e.name === 'nsCertType') { - // nsCertType is a BIT STRING - // build flags - var unused = 0; - var b2 = 0x00; - - if(e.client) { - b2 |= 0x80; - unused = 7; - } - if(e.server) { - b2 |= 0x40; - unused = 6; - } - if(e.email) { - b2 |= 0x20; - unused = 5; - } - if(e.objsign) { - b2 |= 0x10; - unused = 4; - } - if(e.reserved) { - b2 |= 0x08; - unused = 3; - } - if(e.sslCA) { - b2 |= 0x04; - unused = 2; - } - if(e.emailCA) { - b2 |= 0x02; - unused = 1; - } - if(e.objCA) { - b2 |= 0x01; - unused = 0; - } - - // create bit string - var value = String.fromCharCode(unused); - if(b2 !== 0) { - value += String.fromCharCode(b2); - } - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value); - } else if(e.name === 'subjectAltName' || e.name === 'issuerAltName') { - // SYNTAX SEQUENCE - e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - var altName; - for(var n = 0; n < e.altNames.length; ++n) { - altName = e.altNames[n]; - var value = altName.value; - // handle IP - if(altName.type === 7 && altName.ip) { - value = forge.util.bytesFromIP(altName.ip); - if(value === null) { - var error = new Error( - 'Extension "ip" value is not a valid IPv4 or IPv6 address.'); - error.extension = e; - throw error; - } - } else if(altName.type === 8) { - // handle OID - if(altName.oid) { - value = asn1.oidToDer(asn1.oidToDer(altName.oid)); - } else { - // deprecated ... convert value to OID - value = asn1.oidToDer(value); - } - } - e.value.value.push(asn1.create( - asn1.Class.CONTEXT_SPECIFIC, altName.type, false, - value)); - } - } else if(e.name === 'nsComment' && options.cert) { - // sanity check value is ASCII (req'd) and not too big - if(!(/^[\x00-\x7F]*$/.test(e.comment)) || - (e.comment.length < 1) || (e.comment.length > 128)) { - throw new Error('Invalid "nsComment" content.'); - } - // IA5STRING opaque comment - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.IA5STRING, false, e.comment); - } else if(e.name === 'subjectKeyIdentifier' && options.cert) { - var ski = options.cert.generateSubjectKeyIdentifier(); - e.subjectKeyIdentifier = ski.toHex(); - // OCTETSTRING w/digest - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, ski.getBytes()); - } else if(e.name === 'authorityKeyIdentifier' && options.cert) { - // SYNTAX SEQUENCE - e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var seq = e.value.value; - - if(e.keyIdentifier) { - var keyIdentifier = (e.keyIdentifier === true ? - options.cert.generateSubjectKeyIdentifier().getBytes() : - e.keyIdentifier); - seq.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, false, keyIdentifier)); - } - - if(e.authorityCertIssuer) { - var authorityCertIssuer = [ - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 4, true, [ - _dnToAsn1(e.authorityCertIssuer === true ? - options.cert.issuer : e.authorityCertIssuer) - ]) - ]; - seq.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, authorityCertIssuer)); - } - - if(e.serialNumber) { - var serialNumber = forge.util.hexToBytes(e.serialNumber === true ? - options.cert.serialNumber : e.serialNumber); - seq.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, false, serialNumber)); - } - } else if(e.name === 'cRLDistributionPoints') { - e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var seq = e.value.value; - - // Create sub SEQUENCE of DistributionPointName - var subSeq = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - // Create fullName CHOICE - var fullNameGeneralNames = asn1.create( - asn1.Class.CONTEXT_SPECIFIC, 0, true, []); - var altName; - for(var n = 0; n < e.altNames.length; ++n) { - altName = e.altNames[n]; - var value = altName.value; - // handle IP - if(altName.type === 7 && altName.ip) { - value = forge.util.bytesFromIP(altName.ip); - if(value === null) { - var error = new Error( - 'Extension "ip" value is not a valid IPv4 or IPv6 address.'); - error.extension = e; - throw error; - } - } else if(altName.type === 8) { - // handle OID - if(altName.oid) { - value = asn1.oidToDer(asn1.oidToDer(altName.oid)); - } else { - // deprecated ... convert value to OID - value = asn1.oidToDer(value); - } - } - fullNameGeneralNames.value.push(asn1.create( - asn1.Class.CONTEXT_SPECIFIC, altName.type, false, - value)); - } - - // Add to the parent SEQUENCE - subSeq.value.push(asn1.create( - asn1.Class.CONTEXT_SPECIFIC, 0, true, [fullNameGeneralNames])); - seq.push(subSeq); - } - - // ensure value has been defined by now - if(typeof e.value === 'undefined') { - var error = new Error('Extension value not specified.'); - error.extension = e; - throw error; - } - - return e; -} - -/** - * Convert signature parameters object to ASN.1 - * - * @param {String} oid Signature algorithm OID - * @param params The signature parametrs object - * @return ASN.1 object representing signature parameters - */ -function _signatureParametersToAsn1(oid, params) { - switch(oid) { - case oids['RSASSA-PSS']: - var parts = []; - - if(params.hash.algorithmOid !== undefined) { - parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(params.hash.algorithmOid).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]) - ])); - } - - if(params.mgf.algorithmOid !== undefined) { - parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(params.mgf.algorithmOid).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(params.mgf.hash.algorithmOid).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]) - ]) - ])); - } - - if(params.saltLength !== undefined) { - parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(params.saltLength).getBytes()) - ])); - } - - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, parts); - - default: - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, ''); - } -} - -/** - * Converts a certification request's attributes to an ASN.1 set of - * CRIAttributes. - * - * @param csr certification request. - * - * @return the ASN.1 set of CRIAttributes. - */ -function _CRIAttributesToAsn1(csr) { - // create an empty context-specific container - var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []); - - // no attributes, return empty container - if(csr.attributes.length === 0) { - return rval; - } - - // each attribute has a sequence with a type and a set of values - var attrs = csr.attributes; - for(var i = 0; i < attrs.length; ++i) { - var attr = attrs[i]; - var value = attr.value; - - // reuse tag class for attribute value if available - var valueTagClass = asn1.Type.UTF8; - if('valueTagClass' in attr) { - valueTagClass = attr.valueTagClass; - } - if(valueTagClass === asn1.Type.UTF8) { - value = forge.util.encodeUtf8(value); - } - var valueConstructed = false; - if('valueConstructed' in attr) { - valueConstructed = attr.valueConstructed; - } - // FIXME: handle more encodings - - // create a RelativeDistinguishedName set - // each value in the set is an AttributeTypeAndValue first - // containing the type (an OID) and second the value - var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AttributeType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.type).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - // AttributeValue - asn1.create( - asn1.Class.UNIVERSAL, valueTagClass, valueConstructed, value) - ]) - ]); - rval.value.push(seq); - } - - return rval; -} - -var jan_1_1950 = new Date('1950-01-01T00:00:00Z'); -var jan_1_2050 = new Date('2050-01-01T00:00:00Z'); - -/** - * Converts a Date object to ASN.1 - * Handles the different format before and after 1st January 2050 - * - * @param date date object. - * - * @return the ASN.1 object representing the date. - */ -function _dateToAsn1(date) { - if(date >= jan_1_1950 && date < jan_1_2050) { - return asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false, - asn1.dateToUtcTime(date)); - } else { - return asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false, - asn1.dateToGeneralizedTime(date)); - } -} - -/** - * Gets the ASN.1 TBSCertificate part of an X.509v3 certificate. - * - * @param cert the certificate. - * - * @return the asn1 TBSCertificate. - */ -pki.getTBSCertificate = function(cert) { - // TBSCertificate - var notBefore = _dateToAsn1(cert.validity.notBefore); - var notAfter = _dateToAsn1(cert.validity.notAfter); - var tbs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // integer - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(cert.version).getBytes()) - ]), - // serialNumber - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(cert.serialNumber)), - // signature - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(cert.siginfo.algorithmOid).getBytes()), - // parameters - _signatureParametersToAsn1( - cert.siginfo.algorithmOid, cert.siginfo.parameters) - ]), - // issuer - _dnToAsn1(cert.issuer), - // validity - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - notBefore, - notAfter - ]), - // subject - _dnToAsn1(cert.subject), - // SubjectPublicKeyInfo - pki.publicKeyToAsn1(cert.publicKey) - ]); - - if(cert.issuer.uniqueId) { - // issuerUniqueID (optional) - tbs.value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - // TODO: support arbitrary bit length ids - String.fromCharCode(0x00) + - cert.issuer.uniqueId - ) - ]) - ); - } - if(cert.subject.uniqueId) { - // subjectUniqueID (optional) - tbs.value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - // TODO: support arbitrary bit length ids - String.fromCharCode(0x00) + - cert.subject.uniqueId - ) - ]) - ); - } - - if(cert.extensions.length > 0) { - // extensions (optional) - tbs.value.push(pki.certificateExtensionsToAsn1(cert.extensions)); - } - - return tbs; -}; - -/** - * Gets the ASN.1 CertificationRequestInfo part of a - * PKCS#10 CertificationRequest. - * - * @param csr the certification request. - * - * @return the asn1 CertificationRequestInfo. - */ -pki.getCertificationRequestInfo = function(csr) { - // CertificationRequestInfo - var cri = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(csr.version).getBytes()), - // subject - _dnToAsn1(csr.subject), - // SubjectPublicKeyInfo - pki.publicKeyToAsn1(csr.publicKey), - // attributes - _CRIAttributesToAsn1(csr) - ]); - - return cri; -}; - -/** - * Converts a DistinguishedName (subject or issuer) to an ASN.1 object. - * - * @param dn the DistinguishedName. - * - * @return the asn1 representation of a DistinguishedName. - */ -pki.distinguishedNameToAsn1 = function(dn) { - return _dnToAsn1(dn); -}; - -/** - * Converts an X.509v3 RSA certificate to an ASN.1 object. - * - * @param cert the certificate. - * - * @return the asn1 representation of an X.509v3 RSA certificate. - */ -pki.certificateToAsn1 = function(cert) { - // prefer cached TBSCertificate over generating one - var tbsCertificate = cert.tbsCertificate || pki.getTBSCertificate(cert); - - // Certificate - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // TBSCertificate - tbsCertificate, - // AlgorithmIdentifier (signature algorithm) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(cert.signatureOid).getBytes()), - // parameters - _signatureParametersToAsn1(cert.signatureOid, cert.signatureParameters) - ]), - // SignatureValue - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - String.fromCharCode(0x00) + cert.signature) - ]); -}; - -/** - * Converts X.509v3 certificate extensions to ASN.1. - * - * @param exts the extensions to convert. - * - * @return the extensions in ASN.1 format. - */ -pki.certificateExtensionsToAsn1 = function(exts) { - // create top-level extension container - var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []); - - // create extension sequence (stores a sequence for each extension) - var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - rval.value.push(seq); - - for(var i = 0; i < exts.length; ++i) { - seq.value.push(pki.certificateExtensionToAsn1(exts[i])); - } - - return rval; -}; - -/** - * Converts a single certificate extension to ASN.1. - * - * @param ext the extension to convert. - * - * @return the extension in ASN.1 format. - */ -pki.certificateExtensionToAsn1 = function(ext) { - // create a sequence for each extension - var extseq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - // extnID (OID) - extseq.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(ext.id).getBytes())); - - // critical defaults to false - if(ext.critical) { - // critical BOOLEAN DEFAULT FALSE - extseq.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, - String.fromCharCode(0xFF))); - } - - var value = ext.value; - if(typeof ext.value !== 'string') { - // value is asn.1 - value = asn1.toDer(value).getBytes(); - } - - // extnValue (OCTET STRING) - extseq.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, value)); - - return extseq; -}; - -/** - * Converts a PKCS#10 certification request to an ASN.1 object. - * - * @param csr the certification request. - * - * @return the asn1 representation of a certification request. - */ -pki.certificationRequestToAsn1 = function(csr) { - // prefer cached CertificationRequestInfo over generating one - var cri = csr.certificationRequestInfo || - pki.getCertificationRequestInfo(csr); - - // Certificate - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // CertificationRequestInfo - cri, - // AlgorithmIdentifier (signature algorithm) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(csr.signatureOid).getBytes()), - // parameters - _signatureParametersToAsn1(csr.signatureOid, csr.signatureParameters) - ]), - // signature - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - String.fromCharCode(0x00) + csr.signature) - ]); -}; - -/** - * Creates a CA store. - * - * @param certs an optional array of certificate objects or PEM-formatted - * certificate strings to add to the CA store. - * - * @return the CA store. - */ -pki.createCaStore = function(certs) { - // create CA store - var caStore = { - // stored certificates - certs: {} - }; - - /** - * Gets the certificate that issued the passed certificate or its - * 'parent'. - * - * @param cert the certificate to get the parent for. - * - * @return the parent certificate or null if none was found. - */ - caStore.getIssuer = function(cert) { - var rval = getBySubject(cert.issuer); - - // see if there are multiple matches - /*if(forge.util.isArray(rval)) { - // TODO: resolve multiple matches by checking - // authorityKey/subjectKey/issuerUniqueID/other identifiers, etc. - // FIXME: or alternatively do authority key mapping - // if possible (X.509v1 certs can't work?) - throw new Error('Resolving multiple issuer matches not implemented yet.'); - }*/ - - return rval; - }; - - /** - * Adds a trusted certificate to the store. - * - * @param cert the certificate to add as a trusted certificate (either a - * pki.certificate object or a PEM-formatted certificate). - */ - caStore.addCertificate = function(cert) { - // convert from pem if necessary - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - - ensureSubjectHasHash(cert.subject); - - if(!caStore.hasCertificate(cert)) { // avoid duplicate certificates in store - if(cert.subject.hash in caStore.certs) { - // subject hash already exists, append to array - var tmp = caStore.certs[cert.subject.hash]; - if(!forge.util.isArray(tmp)) { - tmp = [tmp]; - } - tmp.push(cert); - caStore.certs[cert.subject.hash] = tmp; - } else { - caStore.certs[cert.subject.hash] = cert; - } - } - }; - - /** - * Checks to see if the given certificate is in the store. - * - * @param cert the certificate to check (either a pki.certificate or a - * PEM-formatted certificate). - * - * @return true if the certificate is in the store, false if not. - */ - caStore.hasCertificate = function(cert) { - // convert from pem if necessary - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - - var match = getBySubject(cert.subject); - if(!match) { - return false; - } - if(!forge.util.isArray(match)) { - match = [match]; - } - // compare DER-encoding of certificates - var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes(); - for(var i = 0; i < match.length; ++i) { - var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes(); - if(der1 === der2) { - return true; - } - } - return false; - }; - - /** - * Lists all of the certificates kept in the store. - * - * @return an array of all of the pki.certificate objects in the store. - */ - caStore.listAllCertificates = function() { - var certList = []; - - for(var hash in caStore.certs) { - if(caStore.certs.hasOwnProperty(hash)) { - var value = caStore.certs[hash]; - if(!forge.util.isArray(value)) { - certList.push(value); - } else { - for(var i = 0; i < value.length; ++i) { - certList.push(value[i]); - } - } - } - } - - return certList; - }; - - /** - * Removes a certificate from the store. - * - * @param cert the certificate to remove (either a pki.certificate or a - * PEM-formatted certificate). - * - * @return the certificate that was removed or null if the certificate - * wasn't in store. - */ - caStore.removeCertificate = function(cert) { - var result; - - // convert from pem if necessary - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - ensureSubjectHasHash(cert.subject); - if(!caStore.hasCertificate(cert)) { - return null; - } - - var match = getBySubject(cert.subject); - - if(!forge.util.isArray(match)) { - result = caStore.certs[cert.subject.hash]; - delete caStore.certs[cert.subject.hash]; - return result; - } - - // compare DER-encoding of certificates - var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes(); - for(var i = 0; i < match.length; ++i) { - var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes(); - if(der1 === der2) { - result = match[i]; - match.splice(i, 1); - } - } - if(match.length === 0) { - delete caStore.certs[cert.subject.hash]; - } - - return result; - }; - - function getBySubject(subject) { - ensureSubjectHasHash(subject); - return caStore.certs[subject.hash] || null; - } - - function ensureSubjectHasHash(subject) { - // produce subject hash if it doesn't exist - if(!subject.hash) { - var md = forge.md.sha1.create(); - subject.attributes = pki.RDNAttributesAsArray(_dnToAsn1(subject), md); - subject.hash = md.digest().toHex(); - } - } - - // auto-add passed in certs - if(certs) { - // parse PEM-formatted certificates as necessary - for(var i = 0; i < certs.length; ++i) { - var cert = certs[i]; - caStore.addCertificate(cert); - } - } - - return caStore; -}; - -/** - * Certificate verification errors, based on TLS. - */ -pki.certificateError = { - bad_certificate: 'forge.pki.BadCertificate', - unsupported_certificate: 'forge.pki.UnsupportedCertificate', - certificate_revoked: 'forge.pki.CertificateRevoked', - certificate_expired: 'forge.pki.CertificateExpired', - certificate_unknown: 'forge.pki.CertificateUnknown', - unknown_ca: 'forge.pki.UnknownCertificateAuthority' -}; - -/** - * Verifies a certificate chain against the given Certificate Authority store - * with an optional custom verify callback. - * - * @param caStore a certificate store to verify against. - * @param chain the certificate chain to verify, with the root or highest - * authority at the end (an array of certificates). - * @param options a callback to be called for every certificate in the chain or - * an object with: - * verify a callback to be called for every certificate in the - * chain - * validityCheckDate the date against which the certificate - * validity period should be checked. Pass null to not check - * the validity period. By default, the current date is used. - * - * The verify callback has the following signature: - * - * verified - Set to true if certificate was verified, otherwise the - * pki.certificateError for why the certificate failed. - * depth - The current index in the chain, where 0 is the end point's cert. - * certs - The certificate chain, *NOTE* an empty chain indicates an anonymous - * end point. - * - * The function returns true on success and on failure either the appropriate - * pki.certificateError or an object with 'error' set to the appropriate - * pki.certificateError and 'message' set to a custom error message. - * - * @return true if successful, error thrown if not. - */ -pki.verifyCertificateChain = function(caStore, chain, options) { - /* From: RFC3280 - Internet X.509 Public Key Infrastructure Certificate - Section 6: Certification Path Validation - See inline parentheticals related to this particular implementation. - - The primary goal of path validation is to verify the binding between - a subject distinguished name or a subject alternative name and subject - public key, as represented in the end entity certificate, based on the - public key of the trust anchor. This requires obtaining a sequence of - certificates that support that binding. That sequence should be provided - in the passed 'chain'. The trust anchor should be in the given CA - store. The 'end entity' certificate is the certificate provided by the - end point (typically a server) and is the first in the chain. - - To meet this goal, the path validation process verifies, among other - things, that a prospective certification path (a sequence of n - certificates or a 'chain') satisfies the following conditions: - - (a) for all x in {1, ..., n-1}, the subject of certificate x is - the issuer of certificate x+1; - - (b) certificate 1 is issued by the trust anchor; - - (c) certificate n is the certificate to be validated; and - - (d) for all x in {1, ..., n}, the certificate was valid at the - time in question. - - Note that here 'n' is index 0 in the chain and 1 is the last certificate - in the chain and it must be signed by a certificate in the connection's - CA store. - - The path validation process also determines the set of certificate - policies that are valid for this path, based on the certificate policies - extension, policy mapping extension, policy constraints extension, and - inhibit any-policy extension. - - Note: Policy mapping extension not supported (Not Required). - - Note: If the certificate has an unsupported critical extension, then it - must be rejected. - - Note: A certificate is self-issued if the DNs that appear in the subject - and issuer fields are identical and are not empty. - - The path validation algorithm assumes the following seven inputs are - provided to the path processing logic. What this specific implementation - will use is provided parenthetically: - - (a) a prospective certification path of length n (the 'chain') - (b) the current date/time: ('now'). - (c) user-initial-policy-set: A set of certificate policy identifiers - naming the policies that are acceptable to the certificate user. - The user-initial-policy-set contains the special value any-policy - if the user is not concerned about certificate policy - (Not implemented. Any policy is accepted). - (d) trust anchor information, describing a CA that serves as a trust - anchor for the certification path. The trust anchor information - includes: - - (1) the trusted issuer name, - (2) the trusted public key algorithm, - (3) the trusted public key, and - (4) optionally, the trusted public key parameters associated - with the public key. - - (Trust anchors are provided via certificates in the CA store). - - The trust anchor information may be provided to the path processing - procedure in the form of a self-signed certificate. The trusted anchor - information is trusted because it was delivered to the path processing - procedure by some trustworthy out-of-band procedure. If the trusted - public key algorithm requires parameters, then the parameters are - provided along with the trusted public key (No parameters used in this - implementation). - - (e) initial-policy-mapping-inhibit, which indicates if policy mapping is - allowed in the certification path. - (Not implemented, no policy checking) - - (f) initial-explicit-policy, which indicates if the path must be valid - for at least one of the certificate policies in the user-initial- - policy-set. - (Not implemented, no policy checking) - - (g) initial-any-policy-inhibit, which indicates whether the - anyPolicy OID should be processed if it is included in a - certificate. - (Not implemented, so any policy is valid provided that it is - not marked as critical) */ - - /* Basic Path Processing: - - For each certificate in the 'chain', the following is checked: - - 1. The certificate validity period includes the current time. - 2. The certificate was signed by its parent (where the parent is either - the next in the chain or from the CA store). Allow processing to - continue to the next step if no parent is found but the certificate is - in the CA store. - 3. TODO: The certificate has not been revoked. - 4. The certificate issuer name matches the parent's subject name. - 5. TODO: If the certificate is self-issued and not the final certificate - in the chain, skip this step, otherwise verify that the subject name - is within one of the permitted subtrees of X.500 distinguished names - and that each of the alternative names in the subjectAltName extension - (critical or non-critical) is within one of the permitted subtrees for - that name type. - 6. TODO: If the certificate is self-issued and not the final certificate - in the chain, skip this step, otherwise verify that the subject name - is not within one of the excluded subtrees for X.500 distinguished - names and none of the subjectAltName extension names are excluded for - that name type. - 7. The other steps in the algorithm for basic path processing involve - handling the policy extension which is not presently supported in this - implementation. Instead, if a critical policy extension is found, the - certificate is rejected as not supported. - 8. If the certificate is not the first or if its the only certificate in - the chain (having no parent from the CA store or is self-signed) and it - has a critical key usage extension, verify that the keyCertSign bit is - set. If the key usage extension exists, verify that the basic - constraints extension exists. If the basic constraints extension exists, - verify that the cA flag is set. If pathLenConstraint is set, ensure that - the number of certificates that precede in the chain (come earlier - in the chain as implemented below), excluding the very first in the - chain (typically the end-entity one), isn't greater than the - pathLenConstraint. This constraint limits the number of intermediate - CAs that may appear below a CA before only end-entity certificates - may be issued. */ - - // if a verify callback is passed as the third parameter, package it within - // the options object. This is to support a legacy function signature that - // expected the verify callback as the third parameter. - if(typeof options === 'function') { - options = {verify: options}; - } - options = options || {}; - - // copy cert chain references to another array to protect against changes - // in verify callback - chain = chain.slice(0); - var certs = chain.slice(0); - - var validityCheckDate = options.validityCheckDate; - // if no validityCheckDate is specified, default to the current date. Make - // sure to maintain the value null because it indicates that the validity - // period should not be checked. - if(typeof validityCheckDate === 'undefined') { - validityCheckDate = new Date(); - } - - // verify each cert in the chain using its parent, where the parent - // is either the next in the chain or from the CA store - var first = true; - var error = null; - var depth = 0; - do { - var cert = chain.shift(); - var parent = null; - var selfSigned = false; - - if(validityCheckDate) { - // 1. check valid time - if(validityCheckDate < cert.validity.notBefore || - validityCheckDate > cert.validity.notAfter) { - error = { - message: 'Certificate is not valid yet or has expired.', - error: pki.certificateError.certificate_expired, - notBefore: cert.validity.notBefore, - notAfter: cert.validity.notAfter, - // TODO: we might want to reconsider renaming 'now' to - // 'validityCheckDate' should this API be changed in the future. - now: validityCheckDate - }; - } - } - - // 2. verify with parent from chain or CA store - if(error === null) { - parent = chain[0] || caStore.getIssuer(cert); - if(parent === null) { - // check for self-signed cert - if(cert.isIssuer(cert)) { - selfSigned = true; - parent = cert; - } - } - - if(parent) { - // FIXME: current CA store implementation might have multiple - // certificates where the issuer can't be determined from the - // certificate (happens rarely with, eg: old certificates) so normalize - // by always putting parents into an array - // TODO: there's may be an extreme degenerate case currently uncovered - // where an old intermediate certificate seems to have a matching parent - // but none of the parents actually verify ... but the intermediate - // is in the CA and it should pass this check; needs investigation - var parents = parent; - if(!forge.util.isArray(parents)) { - parents = [parents]; - } - - // try to verify with each possible parent (typically only one) - var verified = false; - while(!verified && parents.length > 0) { - parent = parents.shift(); - try { - verified = parent.verify(cert); - } catch(ex) { - // failure to verify, don't care why, try next one - } - } - - if(!verified) { - error = { - message: 'Certificate signature is invalid.', - error: pki.certificateError.bad_certificate - }; - } - } - - if(error === null && (!parent || selfSigned) && - !caStore.hasCertificate(cert)) { - // no parent issuer and certificate itself is not trusted - error = { - message: 'Certificate is not trusted.', - error: pki.certificateError.unknown_ca - }; - } - } - - // TODO: 3. check revoked - - // 4. check for matching issuer/subject - if(error === null && parent && !cert.isIssuer(parent)) { - // parent is not issuer - error = { - message: 'Certificate issuer is invalid.', - error: pki.certificateError.bad_certificate - }; - } - - // 5. TODO: check names with permitted names tree - - // 6. TODO: check names against excluded names tree - - // 7. check for unsupported critical extensions - if(error === null) { - // supported extensions - var se = { - keyUsage: true, - basicConstraints: true - }; - for(var i = 0; error === null && i < cert.extensions.length; ++i) { - var ext = cert.extensions[i]; - if(ext.critical && !(ext.name in se)) { - error = { - message: - 'Certificate has an unsupported critical extension.', - error: pki.certificateError.unsupported_certificate - }; - } - } - } - - // 8. check for CA if cert is not first or is the only certificate - // remaining in chain with no parent or is self-signed - if(error === null && - (!first || (chain.length === 0 && (!parent || selfSigned)))) { - // first check keyUsage extension and then basic constraints - var bcExt = cert.getExtension('basicConstraints'); - var keyUsageExt = cert.getExtension('keyUsage'); - if(keyUsageExt !== null) { - // keyCertSign must be true and there must be a basic - // constraints extension - if(!keyUsageExt.keyCertSign || bcExt === null) { - // bad certificate - error = { - message: - 'Certificate keyUsage or basicConstraints conflict ' + - 'or indicate that the certificate is not a CA. ' + - 'If the certificate is the only one in the chain or ' + - 'isn\'t the first then the certificate must be a ' + - 'valid CA.', - error: pki.certificateError.bad_certificate - }; - } - } - // basic constraints cA flag must be set - if(error === null && bcExt !== null && !bcExt.cA) { - // bad certificate - error = { - message: - 'Certificate basicConstraints indicates the certificate ' + - 'is not a CA.', - error: pki.certificateError.bad_certificate - }; - } - // if error is not null and keyUsage is available, then we know it - // has keyCertSign and there is a basic constraints extension too, - // which means we can check pathLenConstraint (if it exists) - if(error === null && keyUsageExt !== null && - 'pathLenConstraint' in bcExt) { - // pathLen is the maximum # of intermediate CA certs that can be - // found between the current certificate and the end-entity (depth 0) - // certificate; this number does not include the end-entity (depth 0, - // last in the chain) even if it happens to be a CA certificate itself - var pathLen = depth - 1; - if(pathLen > bcExt.pathLenConstraint) { - // pathLenConstraint violated, bad certificate - error = { - message: - 'Certificate basicConstraints pathLenConstraint violated.', - error: pki.certificateError.bad_certificate - }; - } - } - } - - // call application callback - var vfd = (error === null) ? true : error.error; - var ret = options.verify ? options.verify(vfd, depth, certs) : vfd; - if(ret === true) { - // clear any set error - error = null; - } else { - // if passed basic tests, set default message and alert - if(vfd === true) { - error = { - message: 'The application rejected the certificate.', - error: pki.certificateError.bad_certificate - }; - } - - // check for custom error info - if(ret || ret === 0) { - // set custom message and error - if(typeof ret === 'object' && !forge.util.isArray(ret)) { - if(ret.message) { - error.message = ret.message; - } - if(ret.error) { - error.error = ret.error; - } - } else if(typeof ret === 'string') { - // set custom error - error.error = ret; - } - } - - // throw error - throw error; - } - - // no longer first cert in chain - first = false; - ++depth; - } while(chain.length > 0); - - return true; -}; diff --git a/node_modules/node-forge/lib/xhr.js b/node_modules/node-forge/lib/xhr.js deleted file mode 100644 index e493c3b6..00000000 --- a/node_modules/node-forge/lib/xhr.js +++ /dev/null @@ -1,736 +0,0 @@ -/** - * XmlHttpRequest implementation that uses TLS and flash SocketPool. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./socket'); -require('./http'); - -/* XHR API */ -var xhrApi = module.exports = forge.xhr = forge.xhr || {}; - -(function($) { - -// logging category -var cat = 'forge.xhr'; - -/* -XMLHttpRequest interface definition from: -http://www.w3.org/TR/XMLHttpRequest - -interface XMLHttpRequest { - // event handler - attribute EventListener onreadystatechange; - - // state - const unsigned short UNSENT = 0; - const unsigned short OPENED = 1; - const unsigned short HEADERS_RECEIVED = 2; - const unsigned short LOADING = 3; - const unsigned short DONE = 4; - readonly attribute unsigned short readyState; - - // request - void open(in DOMString method, in DOMString url); - void open(in DOMString method, in DOMString url, in boolean async); - void open(in DOMString method, in DOMString url, - in boolean async, in DOMString user); - void open(in DOMString method, in DOMString url, - in boolean async, in DOMString user, in DOMString password); - void setRequestHeader(in DOMString header, in DOMString value); - void send(); - void send(in DOMString data); - void send(in Document data); - void abort(); - - // response - DOMString getAllResponseHeaders(); - DOMString getResponseHeader(in DOMString header); - readonly attribute DOMString responseText; - readonly attribute Document responseXML; - readonly attribute unsigned short status; - readonly attribute DOMString statusText; -}; -*/ - -// readyStates -var UNSENT = 0; -var OPENED = 1; -var HEADERS_RECEIVED = 2; -var LOADING = 3; -var DONE = 4; - -// exceptions -var INVALID_STATE_ERR = 11; -var SYNTAX_ERR = 12; -var SECURITY_ERR = 18; -var NETWORK_ERR = 19; -var ABORT_ERR = 20; - -// private flash socket pool vars -var _sp = null; -var _policyPort = 0; -var _policyUrl = null; - -// default client (used if no special URL provided when creating an XHR) -var _client = null; - -// all clients including the default, key'd by full base url -// (multiple cross-domain http clients are permitted so there may be more -// than one client in this map) -// TODO: provide optional clean up API for non-default clients -var _clients = {}; - -// the default maximum number of concurrents connections per client -var _maxConnections = 10; - -var net = forge.net; -var http = forge.http; - -/** - * Initializes flash XHR support. - * - * @param options: - * url: the default base URL to connect to if xhr URLs are relative, - * ie: https://myserver.com. - * flashId: the dom ID of the flash SocketPool. - * policyPort: the port that provides the server's flash policy, 0 to use - * the flash default. - * policyUrl: the policy file URL to use instead of a policy port. - * msie: true if browser is internet explorer, false if not. - * connections: the maximum number of concurrent connections. - * caCerts: a list of PEM-formatted certificates to trust. - * cipherSuites: an optional array of cipher suites to use, - * see forge.tls.CipherSuites. - * verify: optional TLS certificate verify callback to use (see forge.tls - * for details). - * getCertificate: an optional callback used to get a client-side - * certificate (see forge.tls for details). - * getPrivateKey: an optional callback used to get a client-side private - * key (see forge.tls for details). - * getSignature: an optional callback used to get a client-side signature - * (see forge.tls for details). - * persistCookies: true to use persistent cookies via flash local storage, - * false to only keep cookies in javascript. - * primeTlsSockets: true to immediately connect TLS sockets on their - * creation so that they will cache TLS sessions for reuse. - */ -xhrApi.init = function(options) { - forge.log.debug(cat, 'initializing', options); - - // update default policy port and max connections - _policyPort = options.policyPort || _policyPort; - _policyUrl = options.policyUrl || _policyUrl; - _maxConnections = options.connections || _maxConnections; - - // create the flash socket pool - _sp = net.createSocketPool({ - flashId: options.flashId, - policyPort: _policyPort, - policyUrl: _policyUrl, - msie: options.msie || false - }); - - // create default http client - _client = http.createClient({ - url: options.url || ( - window.location.protocol + '//' + window.location.host), - socketPool: _sp, - policyPort: _policyPort, - policyUrl: _policyUrl, - connections: options.connections || _maxConnections, - caCerts: options.caCerts, - cipherSuites: options.cipherSuites, - persistCookies: options.persistCookies || true, - primeTlsSockets: options.primeTlsSockets || false, - verify: options.verify, - getCertificate: options.getCertificate, - getPrivateKey: options.getPrivateKey, - getSignature: options.getSignature - }); - _clients[_client.url.full] = _client; - - forge.log.debug(cat, 'ready'); -}; - -/** - * Called to clean up the clients and socket pool. - */ -xhrApi.cleanup = function() { - // destroy all clients - for(var key in _clients) { - _clients[key].destroy(); - } - _clients = {}; - _client = null; - - // destroy socket pool - _sp.destroy(); - _sp = null; -}; - -/** - * Sets a cookie. - * - * @param cookie the cookie with parameters: - * name: the name of the cookie. - * value: the value of the cookie. - * comment: an optional comment string. - * maxAge: the age of the cookie in seconds relative to created time. - * secure: true if the cookie must be sent over a secure protocol. - * httpOnly: true to restrict access to the cookie from javascript - * (inaffective since the cookies are stored in javascript). - * path: the path for the cookie. - * domain: optional domain the cookie belongs to (must start with dot). - * version: optional version of the cookie. - * created: creation time, in UTC seconds, of the cookie. - */ -xhrApi.setCookie = function(cookie) { - // default cookie expiration to never - cookie.maxAge = cookie.maxAge || -1; - - // if the cookie's domain is set, use the appropriate client - if(cookie.domain) { - // add the cookies to the applicable domains - for(var key in _clients) { - var client = _clients[key]; - if(http.withinCookieDomain(client.url, cookie) && - client.secure === cookie.secure) { - client.setCookie(cookie); - } - } - } else { - // use the default domain - // FIXME: should a null domain cookie be added to all clients? should - // this be an option? - _client.setCookie(cookie); - } -}; - -/** - * Gets a cookie. - * - * @param name the name of the cookie. - * @param path an optional path for the cookie (if there are multiple cookies - * with the same name but different paths). - * @param domain an optional domain for the cookie (if not using the default - * domain). - * - * @return the cookie, cookies (if multiple matches), or null if not found. - */ -xhrApi.getCookie = function(name, path, domain) { - var rval = null; - - if(domain) { - // get the cookies from the applicable domains - for(var key in _clients) { - var client = _clients[key]; - if(http.withinCookieDomain(client.url, domain)) { - var cookie = client.getCookie(name, path); - if(cookie !== null) { - if(rval === null) { - rval = cookie; - } else if(!forge.util.isArray(rval)) { - rval = [rval, cookie]; - } else { - rval.push(cookie); - } - } - } - } - } else { - // get cookie from default domain - rval = _client.getCookie(name, path); - } - - return rval; -}; - -/** - * Removes a cookie. - * - * @param name the name of the cookie. - * @param path an optional path for the cookie (if there are multiple cookies - * with the same name but different paths). - * @param domain an optional domain for the cookie (if not using the default - * domain). - * - * @return true if a cookie was removed, false if not. - */ -xhrApi.removeCookie = function(name, path, domain) { - var rval = false; - - if(domain) { - // remove the cookies from the applicable domains - for(var key in _clients) { - var client = _clients[key]; - if(http.withinCookieDomain(client.url, domain)) { - if(client.removeCookie(name, path)) { - rval = true; - } - } - } - } else { - // remove cookie from default domain - rval = _client.removeCookie(name, path); - } - - return rval; -}; - -/** - * Creates a new XmlHttpRequest. By default the base URL, flash policy port, - * etc, will be used. However, an XHR can be created to point at another - * cross-domain URL. - * - * @param options: - * logWarningOnError: If true and an HTTP error status code is received then - * log a warning, otherwise log a verbose message. - * verbose: If true be very verbose in the output including the response - * event and response body, otherwise only include status, timing, and - * data size. - * logError: a multi-var log function for warnings that takes the log - * category as the first var. - * logWarning: a multi-var log function for warnings that takes the log - * category as the first var. - * logDebug: a multi-var log function for warnings that takes the log - * category as the first var. - * logVerbose: a multi-var log function for warnings that takes the log - * category as the first var. - * url: the default base URL to connect to if xhr URLs are relative, - * eg: https://myserver.com, and note that the following options will be - * ignored if the URL is absent or the same as the default base URL. - * policyPort: the port that provides the server's flash policy, 0 to use - * the flash default. - * policyUrl: the policy file URL to use instead of a policy port. - * connections: the maximum number of concurrent connections. - * caCerts: a list of PEM-formatted certificates to trust. - * cipherSuites: an optional array of cipher suites to use, see - * forge.tls.CipherSuites. - * verify: optional TLS certificate verify callback to use (see forge.tls - * for details). - * getCertificate: an optional callback used to get a client-side - * certificate. - * getPrivateKey: an optional callback used to get a client-side private key. - * getSignature: an optional callback used to get a client-side signature. - * persistCookies: true to use persistent cookies via flash local storage, - * false to only keep cookies in javascript. - * primeTlsSockets: true to immediately connect TLS sockets on their - * creation so that they will cache TLS sessions for reuse. - * - * @return the XmlHttpRequest. - */ -xhrApi.create = function(options) { - // set option defaults - options = $.extend({ - logWarningOnError: true, - verbose: false, - logError: function() {}, - logWarning: function() {}, - logDebug: function() {}, - logVerbose: function() {}, - url: null - }, options || {}); - - // private xhr state - var _state = { - // the http client to use - client: null, - // request storage - request: null, - // response storage - response: null, - // asynchronous, true if doing asynchronous communication - asynchronous: true, - // sendFlag, true if send has been called - sendFlag: false, - // errorFlag, true if a network error occurred - errorFlag: false - }; - - // private log functions - var _log = { - error: options.logError || forge.log.error, - warning: options.logWarning || forge.log.warning, - debug: options.logDebug || forge.log.debug, - verbose: options.logVerbose || forge.log.verbose - }; - - // create public xhr interface - var xhr = { - // an EventListener - onreadystatechange: null, - // readonly, the current readyState - readyState: UNSENT, - // a string with the response entity-body - responseText: '', - // a Document for response entity-bodies that are XML - responseXML: null, - // readonly, returns the HTTP status code (i.e. 404) - status: 0, - // readonly, returns the HTTP status message (i.e. 'Not Found') - statusText: '' - }; - - // determine which http client to use - if(options.url === null) { - // use default - _state.client = _client; - } else { - var url = http.parseUrl(options.url); - if(!url) { - var error = new Error('Invalid url.'); - error.details = { - url: options.url - }; - } - - // find client - if(url.full in _clients) { - // client found - _state.client = _clients[url.full]; - } else { - // create client - _state.client = http.createClient({ - url: options.url, - socketPool: _sp, - policyPort: options.policyPort || _policyPort, - policyUrl: options.policyUrl || _policyUrl, - connections: options.connections || _maxConnections, - caCerts: options.caCerts, - cipherSuites: options.cipherSuites, - persistCookies: options.persistCookies || true, - primeTlsSockets: options.primeTlsSockets || false, - verify: options.verify, - getCertificate: options.getCertificate, - getPrivateKey: options.getPrivateKey, - getSignature: options.getSignature - }); - _clients[url.full] = _state.client; - } - } - - /** - * Opens the request. This method will create the HTTP request to send. - * - * @param method the HTTP method (i.e. 'GET'). - * @param url the relative url (the HTTP request path). - * @param async always true, ignored. - * @param user always null, ignored. - * @param password always null, ignored. - */ - xhr.open = function(method, url, async, user, password) { - // 1. validate Document if one is associated - // TODO: not implemented (not used yet) - - // 2. validate method token - // 3. change method to uppercase if it matches a known - // method (here we just require it to be uppercase, and - // we do not allow the standard methods) - // 4. disallow CONNECT, TRACE, or TRACK with a security error - switch(method) { - case 'DELETE': - case 'GET': - case 'HEAD': - case 'OPTIONS': - case 'PATCH': - case 'POST': - case 'PUT': - // valid method - break; - case 'CONNECT': - case 'TRACE': - case 'TRACK': - throw new Error('CONNECT, TRACE and TRACK methods are disallowed'); - default: - throw new Error('Invalid method: ' + method); - } - - // TODO: other validation steps in algorithm are not implemented - - // 19. set send flag to false - // set response body to null - // empty list of request headers - // set request method to given method - // set request URL - // set username, password - // set asychronous flag - _state.sendFlag = false; - xhr.responseText = ''; - xhr.responseXML = null; - - // custom: reset status and statusText - xhr.status = 0; - xhr.statusText = ''; - - // create the HTTP request - _state.request = http.createRequest({ - method: method, - path: url - }); - - // 20. set state to OPENED - xhr.readyState = OPENED; - - // 21. dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - }; - - /** - * Adds an HTTP header field to the request. - * - * @param header the name of the header field. - * @param value the value of the header field. - */ - xhr.setRequestHeader = function(header, value) { - // 1. if state is not OPENED or send flag is true, raise exception - if(xhr.readyState != OPENED || _state.sendFlag) { - throw new Error('XHR not open or sending'); - } - - // TODO: other validation steps in spec aren't implemented - - // set header - _state.request.setField(header, value); - }; - - /** - * Sends the request and any associated data. - * - * @param data a string or Document object to send, null to send no data. - */ - xhr.send = function(data) { - // 1. if state is not OPENED or 2. send flag is true, raise - // an invalid state exception - if(xhr.readyState != OPENED || _state.sendFlag) { - throw new Error('XHR not open or sending'); - } - - // 3. ignore data if method is GET or HEAD - if(data && - _state.request.method !== 'GET' && - _state.request.method !== 'HEAD') { - // handle non-IE case - if(typeof(XMLSerializer) !== 'undefined') { - if(data instanceof Document) { - var xs = new XMLSerializer(); - _state.request.body = xs.serializeToString(data); - } else { - _state.request.body = data; - } - } else { - // poorly implemented IE case - if(typeof(data.xml) !== 'undefined') { - _state.request.body = data.xml; - } else { - _state.request.body = data; - } - } - } - - // 4. release storage mutex (not used) - - // 5. set error flag to false - _state.errorFlag = false; - - // 6. if asynchronous is true (must be in this implementation) - - // 6.1 set send flag to true - _state.sendFlag = true; - - // 6.2 dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - - // create send options - var options = {}; - options.request = _state.request; - options.headerReady = function(e) { - // make cookies available for ease of use/iteration - xhr.cookies = _state.client.cookies; - - // TODO: update document.cookie with any cookies where the - // script's domain matches - - // headers received - xhr.readyState = HEADERS_RECEIVED; - xhr.status = e.response.code; - xhr.statusText = e.response.message; - _state.response = e.response; - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - if(!_state.response.aborted) { - // now loading body - xhr.readyState = LOADING; - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - } - }; - options.bodyReady = function(e) { - xhr.readyState = DONE; - var ct = e.response.getField('Content-Type'); - // Note: this null/undefined check is done outside because IE - // dies otherwise on a "'null' is null" error - if(ct) { - if(ct.indexOf('text/xml') === 0 || - ct.indexOf('application/xml') === 0 || - ct.indexOf('+xml') !== -1) { - try { - var doc = new ActiveXObject('MicrosoftXMLDOM'); - doc.async = false; - doc.loadXML(e.response.body); - xhr.responseXML = doc; - } catch(ex) { - var parser = new DOMParser(); - xhr.responseXML = parser.parseFromString(ex.body, 'text/xml'); - } - } - } - - var length = 0; - if(e.response.body !== null) { - xhr.responseText = e.response.body; - length = e.response.body.length; - } - // build logging output - var req = _state.request; - var output = - req.method + ' ' + req.path + ' ' + - xhr.status + ' ' + xhr.statusText + ' ' + - length + 'B ' + - (e.request.connectTime + e.request.time + e.response.time) + - 'ms'; - var lFunc; - if(options.verbose) { - lFunc = (xhr.status >= 400 && options.logWarningOnError) ? - _log.warning : _log.verbose; - lFunc(cat, output, - e, e.response.body ? '\n' + e.response.body : '\nNo content'); - } else { - lFunc = (xhr.status >= 400 && options.logWarningOnError) ? - _log.warning : _log.debug; - lFunc(cat, output); - } - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - }; - options.error = function(e) { - var req = _state.request; - _log.error(cat, req.method + ' ' + req.path, e); - - // 1. set response body to null - xhr.responseText = ''; - xhr.responseXML = null; - - // 2. set error flag to true (and reset status) - _state.errorFlag = true; - xhr.status = 0; - xhr.statusText = ''; - - // 3. set state to done - xhr.readyState = DONE; - - // 4. asyc flag is always true, so dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - }; - - // 7. send request - _state.client.send(options); - }; - - /** - * Aborts the request. - */ - xhr.abort = function() { - // 1. abort send - // 2. stop network activity - _state.request.abort(); - - // 3. set response to null - xhr.responseText = ''; - xhr.responseXML = null; - - // 4. set error flag to true (and reset status) - _state.errorFlag = true; - xhr.status = 0; - xhr.statusText = ''; - - // 5. clear user headers - _state.request = null; - _state.response = null; - - // 6. if state is DONE or UNSENT, or if OPENED and send flag is false - if(xhr.readyState === DONE || xhr.readyState === UNSENT || - (xhr.readyState === OPENED && !_state.sendFlag)) { - // 7. set ready state to unsent - xhr.readyState = UNSENT; - } else { - // 6.1 set state to DONE - xhr.readyState = DONE; - - // 6.2 set send flag to false - _state.sendFlag = false; - - // 6.3 dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - - // 7. set state to UNSENT - xhr.readyState = UNSENT; - } - }; - - /** - * Gets all response headers as a string. - * - * @return the HTTP-encoded response header fields. - */ - xhr.getAllResponseHeaders = function() { - var rval = ''; - if(_state.response !== null) { - var fields = _state.response.fields; - $.each(fields, function(name, array) { - $.each(array, function(i, value) { - rval += name + ': ' + value + '\r\n'; - }); - }); - } - return rval; - }; - - /** - * Gets a single header field value or, if there are multiple - * fields with the same name, a comma-separated list of header - * values. - * - * @return the header field value(s) or null. - */ - xhr.getResponseHeader = function(header) { - var rval = null; - if(_state.response !== null) { - if(header in _state.response.fields) { - rval = _state.response.fields[header]; - if(forge.util.isArray(rval)) { - rval = rval.join(); - } - } - } - return rval; - }; - - return xhr; -}; - -})(jQuery); diff --git a/node_modules/node-forge/package.json b/node_modules/node-forge/package.json deleted file mode 100644 index 0e1d2793..00000000 --- a/node_modules/node-forge/package.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "_from": "node-forge@^0.10.0", - "_id": "node-forge@0.10.0", - "_inBundle": false, - "_integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "_location": "/node-forge", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-forge@^0.10.0", - "name": "node-forge", - "escapedName": "node-forge", - "rawSpec": "^0.10.0", - "saveSpec": null, - "fetchSpec": "^0.10.0" - }, - "_requiredBy": [ - "/google-p12-pem" - ], - "_resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "_shasum": "32dea2afb3e9926f02ee5ce8794902691a676bf3", - "_spec": "node-forge@^0.10.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/google-p12-pem", - "author": { - "name": "Digital Bazaar, Inc.", - "email": "support@digitalbazaar.com", - "url": "http://digitalbazaar.com/" - }, - "browser": { - "buffer": false, - "crypto": false, - "process": false - }, - "bugs": { - "url": "https://github.com/digitalbazaar/forge/issues", - "email": "support@digitalbazaar.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Dave Longley", - "email": "dlongley@digitalbazaar.com" - }, - { - "name": "David I. Lehn", - "email": "dlehn@digitalbazaar.com" - }, - { - "name": "Stefan Siegl", - "email": "stesie@brokenpipe.de" - }, - { - "name": "Christoph Dorn", - "email": "christoph@christophdorn.com" - } - ], - "deprecated": false, - "description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.", - "devDependencies": { - "browserify": "^16.5.2", - "commander": "^2.20.0", - "cross-env": "^5.2.1", - "eslint": "^7.8.1", - "eslint-config-digitalbazaar": "^2.5.0", - "express": "^4.16.2", - "karma": "^4.4.1", - "karma-browserify": "^7.0.0", - "karma-chrome-launcher": "^3.1.0", - "karma-edge-launcher": "^0.4.2", - "karma-firefox-launcher": "^1.3.0", - "karma-ie-launcher": "^1.0.0", - "karma-mocha": "^1.3.0", - "karma-mocha-reporter": "^2.2.5", - "karma-safari-launcher": "^1.0.0", - "karma-sauce-launcher": "^2.0.2", - "karma-sourcemap-loader": "^0.3.8", - "karma-tap-reporter": "0.0.6", - "karma-webpack": "^4.0.2", - "mocha": "^5.2.0", - "mocha-lcov-reporter": "^1.2.0", - "nodejs-websocket": "^1.7.1", - "nyc": "^15.1.0", - "opts": "^1.2.7", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.12", - "worker-loader": "^2.0.0" - }, - "engines": { - "node": ">= 6.0.0" - }, - "files": [ - "lib/*.js", - "flash/swf/*.swf", - "dist/*.min.js", - "dist/*.min.js.map" - ], - "homepage": "https://github.com/digitalbazaar/forge", - "jspm": { - "format": "amd" - }, - "keywords": [ - "aes", - "asn", - "asn.1", - "cbc", - "crypto", - "cryptography", - "csr", - "des", - "gcm", - "hmac", - "http", - "https", - "md5", - "network", - "pkcs", - "pki", - "prng", - "rc2", - "rsa", - "sha1", - "sha256", - "sha384", - "sha512", - "ssh", - "tls", - "x.509", - "x509" - ], - "license": "(BSD-3-Clause OR GPL-2.0)", - "main": "lib/index.js", - "name": "node-forge", - "nyc": { - "exclude": [ - "tests" - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/digitalbazaar/forge.git" - }, - "scripts": { - "build": "webpack", - "coverage": "rm -rf coverage && nyc --reporter=lcov --reporter=text-summary npm test", - "coverage-report": "nyc report", - "lint": "eslint *.js lib/*.js tests/*.js tests/**/*.js examples/*.js flash/*.js", - "prepublish": "npm run build", - "test": "cross-env NODE_ENV=test mocha -t 30000 -R ${REPORTER:-spec} tests/unit/index.js", - "test-build": "webpack --config webpack-tests.config.js", - "test-karma": "karma start", - "test-karma-sauce": "karma start karma-sauce.conf", - "test-server": "node tests/server.js", - "test-server-webid": "node tests/websockets/server-webid.js", - "test-server-ws": "node tests/websockets/server-ws.js" - }, - "version": "0.10.0" -} diff --git a/node_modules/optimism/LICENSE b/node_modules/optimism/LICENSE deleted file mode 100644 index d56df848..00000000 --- a/node_modules/optimism/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Ben Newman - -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. diff --git a/node_modules/optimism/README.md b/node_modules/optimism/README.md deleted file mode 100644 index 96a17f66..00000000 --- a/node_modules/optimism/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# optimism   [![Build Status](https://travis-ci.org/benjamn/optimism.svg?branch=master)](https://travis-ci.org/benjamn/optimism) [![Greenkeeper badge](https://badges.greenkeeper.io/benjamn/optimism.svg)](https://greenkeeper.io/) - -Composable reactive caching with efficient invalidation. diff --git a/node_modules/optimism/lib/bundle.cjs.js b/node_modules/optimism/lib/bundle.cjs.js deleted file mode 100644 index ee4adfe4..00000000 --- a/node_modules/optimism/lib/bundle.cjs.js +++ /dev/null @@ -1,508 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var context = require('@wry/context'); - -function defaultDispose() { } -var Cache = /** @class */ (function () { - function Cache(max, dispose) { - if (max === void 0) { max = Infinity; } - if (dispose === void 0) { dispose = defaultDispose; } - this.max = max; - this.dispose = dispose; - this.map = new Map(); - this.newest = null; - this.oldest = null; - } - Cache.prototype.has = function (key) { - return this.map.has(key); - }; - Cache.prototype.get = function (key) { - var entry = this.getEntry(key); - return entry && entry.value; - }; - Cache.prototype.getEntry = function (key) { - var entry = this.map.get(key); - if (entry && entry !== this.newest) { - var older = entry.older, newer = entry.newer; - if (newer) { - newer.older = older; - } - if (older) { - older.newer = newer; - } - entry.older = this.newest; - entry.older.newer = entry; - entry.newer = null; - this.newest = entry; - if (entry === this.oldest) { - this.oldest = newer; - } - } - return entry; - }; - Cache.prototype.set = function (key, value) { - var entry = this.getEntry(key); - if (entry) { - return entry.value = value; - } - entry = { - key: key, - value: value, - newer: null, - older: this.newest - }; - if (this.newest) { - this.newest.newer = entry; - } - this.newest = entry; - this.oldest = this.oldest || entry; - this.map.set(key, entry); - return entry.value; - }; - Cache.prototype.clean = function () { - while (this.oldest && this.map.size > this.max) { - this.delete(this.oldest.key); - } - }; - Cache.prototype.delete = function (key) { - var entry = this.map.get(key); - if (entry) { - if (entry === this.newest) { - this.newest = entry.older; - } - if (entry === this.oldest) { - this.oldest = entry.newer; - } - if (entry.newer) { - entry.newer.older = entry.older; - } - if (entry.older) { - entry.older.newer = entry.newer; - } - this.map.delete(key); - this.dispose(entry.value, key); - return true; - } - return false; - }; - return Cache; -}()); - -var parentEntrySlot = new context.Slot(); - -var reusableEmptyArray = []; -var emptySetPool = []; -var POOL_TARGET_SIZE = 100; -// Since this package might be used browsers, we should avoid using the -// Node built-in assert module. -function assert(condition, optionalMessage) { - if (!condition) { - throw new Error(optionalMessage || "assertion failure"); - } -} -function valueIs(a, b) { - var len = a.length; - return ( - // Unknown values are not equal to each other. - len > 0 && - // Both values must be ordinary (or both exceptional) to be equal. - len === b.length && - // The underlying value or exception must be the same. - a[len - 1] === b[len - 1]); -} -function valueGet(value) { - switch (value.length) { - case 0: throw new Error("unknown value"); - case 1: return value[0]; - case 2: throw value[1]; - } -} -function valueCopy(value) { - return value.slice(0); -} -var Entry = /** @class */ (function () { - function Entry(fn, args) { - this.fn = fn; - this.args = args; - this.parents = new Set(); - this.childValues = new Map(); - // When this Entry has children that are dirty, this property becomes - // a Set containing other Entry objects, borrowed from emptySetPool. - // When the set becomes empty, it gets recycled back to emptySetPool. - this.dirtyChildren = null; - this.dirty = true; - this.recomputing = false; - this.value = []; - ++Entry.count; - } - // This is the most important method of the Entry API, because it - // determines whether the cached this.value can be returned immediately, - // or must be recomputed. The overall performance of the caching system - // depends on the truth of the following observations: (1) this.dirty is - // usually false, (2) this.dirtyChildren is usually null/empty, and thus - // (3) valueGet(this.value) is usually returned without recomputation. - Entry.prototype.recompute = function () { - assert(!this.recomputing, "already recomputing"); - if (!rememberParent(this) && maybeReportOrphan(this)) { - // The recipient of the entry.reportOrphan callback decided to dispose - // of this orphan entry by calling entry.dispose(), so we don't need to - // (and should not) proceed with the recomputation. - return void 0; - } - return mightBeDirty(this) - ? reallyRecompute(this) - : valueGet(this.value); - }; - Entry.prototype.setDirty = function () { - if (this.dirty) - return; - this.dirty = true; - this.value.length = 0; - reportDirty(this); - // We can go ahead and unsubscribe here, since any further dirty - // notifications we receive will be redundant, and unsubscribing may - // free up some resources, e.g. file watchers. - maybeUnsubscribe(this); - }; - Entry.prototype.dispose = function () { - var _this = this; - forgetChildren(this).forEach(maybeReportOrphan); - maybeUnsubscribe(this); - // Because this entry has been kicked out of the cache (in index.js), - // we've lost the ability to find out if/when this entry becomes dirty, - // whether that happens through a subscription, because of a direct call - // to entry.setDirty(), or because one of its children becomes dirty. - // Because of this loss of future information, we have to assume the - // worst (that this entry might have become dirty very soon), so we must - // immediately mark this entry's parents as dirty. Normally we could - // just call entry.setDirty() rather than calling parent.setDirty() for - // each parent, but that would leave this entry in parent.childValues - // and parent.dirtyChildren, which would prevent the child from being - // truly forgotten. - this.parents.forEach(function (parent) { - parent.setDirty(); - forgetChild(parent, _this); - }); - }; - Entry.count = 0; - return Entry; -}()); -function rememberParent(child) { - var parent = parentEntrySlot.getValue(); - if (parent) { - child.parents.add(parent); - if (!parent.childValues.has(child)) { - parent.childValues.set(child, []); - } - if (mightBeDirty(child)) { - reportDirtyChild(parent, child); - } - else { - reportCleanChild(parent, child); - } - return parent; - } -} -function reallyRecompute(entry) { - // Since this recomputation is likely to re-remember some of this - // entry's children, we forget our children here but do not call - // maybeReportOrphan until after the recomputation finishes. - var originalChildren = forgetChildren(entry); - // Set entry as the parent entry while calling recomputeNewValue(entry). - parentEntrySlot.withValue(entry, recomputeNewValue, [entry]); - if (maybeSubscribe(entry)) { - // If we successfully recomputed entry.value and did not fail to - // (re)subscribe, then this Entry is no longer explicitly dirty. - setClean(entry); - } - // Now that we've had a chance to re-remember any children that were - // involved in the recomputation, we can safely report any orphan - // children that remain. - originalChildren.forEach(maybeReportOrphan); - return valueGet(entry.value); -} -function recomputeNewValue(entry) { - entry.recomputing = true; - // Set entry.value as unknown. - entry.value.length = 0; - try { - // If entry.fn succeeds, entry.value will become a normal Value. - entry.value[0] = entry.fn.apply(null, entry.args); - } - catch (e) { - // If entry.fn throws, entry.value will become exceptional. - entry.value[1] = e; - } - // Either way, this line is always reached. - entry.recomputing = false; -} -function mightBeDirty(entry) { - return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); -} -function setClean(entry) { - entry.dirty = false; - if (mightBeDirty(entry)) { - // This Entry may still have dirty children, in which case we can't - // let our parents know we're clean just yet. - return; - } - reportClean(entry); -} -function reportDirty(child) { - child.parents.forEach(function (parent) { return reportDirtyChild(parent, child); }); -} -function reportClean(child) { - child.parents.forEach(function (parent) { return reportCleanChild(parent, child); }); -} -// Let a parent Entry know that one of its children may be dirty. -function reportDirtyChild(parent, child) { - // Must have called rememberParent(child) before calling - // reportDirtyChild(parent, child). - assert(parent.childValues.has(child)); - assert(mightBeDirty(child)); - if (!parent.dirtyChildren) { - parent.dirtyChildren = emptySetPool.pop() || new Set; - } - else if (parent.dirtyChildren.has(child)) { - // If we already know this child is dirty, then we must have already - // informed our own parents that we are dirty, so we can terminate - // the recursion early. - return; - } - parent.dirtyChildren.add(child); - reportDirty(parent); -} -// Let a parent Entry know that one of its children is no longer dirty. -function reportCleanChild(parent, child) { - // Must have called rememberChild(child) before calling - // reportCleanChild(parent, child). - assert(parent.childValues.has(child)); - assert(!mightBeDirty(child)); - var childValue = parent.childValues.get(child); - if (childValue.length === 0) { - parent.childValues.set(child, valueCopy(child.value)); - } - else if (!valueIs(childValue, child.value)) { - parent.setDirty(); - } - removeDirtyChild(parent, child); - if (mightBeDirty(parent)) { - return; - } - reportClean(parent); -} -function removeDirtyChild(parent, child) { - var dc = parent.dirtyChildren; - if (dc) { - dc.delete(child); - if (dc.size === 0) { - if (emptySetPool.length < POOL_TARGET_SIZE) { - emptySetPool.push(dc); - } - parent.dirtyChildren = null; - } - } -} -// If the given entry has a reportOrphan method, and no remaining parents, -// call entry.reportOrphan and return true iff it returns true. The -// reportOrphan function should return true to indicate entry.dispose() -// has been called, and the entry has been removed from any other caches -// (see index.js for the only current example). -function maybeReportOrphan(entry) { - return entry.parents.size === 0 && - typeof entry.reportOrphan === "function" && - entry.reportOrphan() === true; -} -// Removes all children from this entry and returns an array of the -// removed children. -function forgetChildren(parent) { - var children = reusableEmptyArray; - if (parent.childValues.size > 0) { - children = []; - parent.childValues.forEach(function (_value, child) { - forgetChild(parent, child); - children.push(child); - }); - } - // After we forget all our children, this.dirtyChildren must be empty - // and therefore must have been reset to null. - assert(parent.dirtyChildren === null); - return children; -} -function forgetChild(parent, child) { - child.parents.delete(parent); - parent.childValues.delete(child); - removeDirtyChild(parent, child); -} -function maybeSubscribe(entry) { - if (typeof entry.subscribe === "function") { - try { - maybeUnsubscribe(entry); // Prevent double subscriptions. - entry.unsubscribe = entry.subscribe.apply(null, entry.args); - } - catch (e) { - // If this Entry has a subscribe function and it threw an exception - // (or an unsubscribe function it previously returned now throws), - // return false to indicate that we were not able to subscribe (or - // unsubscribe), and this Entry should remain dirty. - entry.setDirty(); - return false; - } - } - // Returning true indicates either that there was no entry.subscribe - // function or that it succeeded. - return true; -} -function maybeUnsubscribe(entry) { - var unsubscribe = entry.unsubscribe; - if (typeof unsubscribe === "function") { - entry.unsubscribe = void 0; - unsubscribe(); - } -} - -// A trie data structure that holds object keys weakly, yet can also hold -// non-object keys, unlike the native `WeakMap`. -var KeyTrie = /** @class */ (function () { - function KeyTrie(weakness) { - this.weakness = weakness; - } - KeyTrie.prototype.lookup = function () { - var array = []; - for (var _i = 0; _i < arguments.length; _i++) { - array[_i] = arguments[_i]; - } - return this.lookupArray(array); - }; - KeyTrie.prototype.lookupArray = function (array) { - var node = this; - array.forEach(function (key) { return node = node.getChildTrie(key); }); - return node.data || (node.data = Object.create(null)); - }; - KeyTrie.prototype.getChildTrie = function (key) { - var map = this.weakness && isObjRef(key) - ? this.weak || (this.weak = new WeakMap()) - : this.strong || (this.strong = new Map()); - var child = map.get(key); - if (!child) - map.set(key, child = new KeyTrie(this.weakness)); - return child; - }; - return KeyTrie; -}()); -function isObjRef(value) { - switch (typeof value) { - case "object": - if (value === null) - break; - // Fall through to return true... - case "function": - return true; - } - return false; -} - -// The defaultMakeCacheKey function is remarkably powerful, because it gives -// a unique object for any shallow-identical list of arguments. If you need -// to implement a custom makeCacheKey function, you may find it helpful to -// delegate the final work to defaultMakeCacheKey, which is why we export it -// here. However, you may want to avoid defaultMakeCacheKey if your runtime -// does not support WeakMap, or you have the ability to return a string key. -// In those cases, just write your own custom makeCacheKey functions. -var keyTrie = new KeyTrie(typeof WeakMap === "function"); -function defaultMakeCacheKey() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return keyTrie.lookupArray(args); -} -var caches = new Set(); -function wrap(originalFunction, options) { - if (options === void 0) { options = Object.create(null); } - var cache = new Cache(options.max || Math.pow(2, 16), function (entry) { return entry.dispose(); }); - var disposable = !!options.disposable; - var makeCacheKey = options.makeCacheKey || defaultMakeCacheKey; - function optimistic() { - if (disposable && !parentEntrySlot.hasValue()) { - // If there's no current parent computation, and this wrapped - // function is disposable (meaning we don't care about entry.value, - // just dependency tracking), then we can short-cut everything else - // in this function, because entry.recompute() is going to recycle - // the entry object without recomputing anything, anyway. - return void 0; - } - var key = makeCacheKey.apply(null, arguments); - if (key === void 0) { - return originalFunction.apply(null, arguments); - } - var args = Array.prototype.slice.call(arguments); - var entry = cache.get(key); - if (entry) { - entry.args = args; - } - else { - entry = new Entry(originalFunction, args); - cache.set(key, entry); - entry.subscribe = options.subscribe; - if (disposable) { - entry.reportOrphan = function () { return cache.delete(key); }; - } - } - var value = entry.recompute(); - // Move this entry to the front of the least-recently used queue, - // since we just finished computing its value. - cache.set(key, entry); - caches.add(cache); - // Clean up any excess entries in the cache, but only if there is no - // active parent entry, meaning we're not in the middle of a larger - // computation that might be flummoxed by the cleaning. - if (!parentEntrySlot.hasValue()) { - caches.forEach(function (cache) { return cache.clean(); }); - caches.clear(); - } - // If options.disposable is truthy, the caller of wrap is telling us - // they don't care about the result of entry.recompute(), so we should - // avoid returning the value, so it won't be accidentally used. - return disposable ? void 0 : value; - } - optimistic.dirty = function () { - var key = makeCacheKey.apply(null, arguments); - var child = key !== void 0 && cache.get(key); - if (child) { - child.setDirty(); - } - }; - return optimistic; -} - -Object.defineProperty(exports, 'asyncFromGen', { - enumerable: true, - get: function () { - return context.asyncFromGen; - } -}); -Object.defineProperty(exports, 'bindContext', { - enumerable: true, - get: function () { - return context.bind; - } -}); -Object.defineProperty(exports, 'noContext', { - enumerable: true, - get: function () { - return context.noContext; - } -}); -Object.defineProperty(exports, 'setTimeout', { - enumerable: true, - get: function () { - return context.setTimeout; - } -}); -exports.KeyTrie = KeyTrie; -exports.defaultMakeCacheKey = defaultMakeCacheKey; -exports.wrap = wrap; -//# sourceMappingURL=bundle.cjs.js.map diff --git a/node_modules/optimism/lib/bundle.cjs.js.map b/node_modules/optimism/lib/bundle.cjs.js.map deleted file mode 100644 index 2fae8990..00000000 --- a/node_modules/optimism/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.cjs.js","sources":["../src/cache.ts","../src/context.ts","../src/entry.ts","../src/key-trie.ts","../src/index.ts"],"sourcesContent":["interface Node {\n key: K;\n value: V;\n newer: Node | null;\n older: Node | null;\n}\n\nfunction defaultDispose() {}\n\nexport class Cache {\n private map = new Map>();\n private newest: Node | null = null;\n private oldest: Node | null = null;\n\n constructor(\n private max = Infinity,\n public dispose: (value: V, key: K) => void = defaultDispose,\n ) {}\n\n public has(key: K) {\n return this.map.has(key);\n }\n\n public get(key: K) {\n const entry = this.getEntry(key);\n return entry && entry.value;\n }\n\n private getEntry(key: K): Node | void {\n const entry = this.map.get(key);\n\n if (entry && entry !== this.newest) {\n const { older, newer } = entry;\n\n if (newer) {\n newer.older = older;\n }\n\n if (older) {\n older.newer = newer;\n }\n\n entry.older = this.newest;\n entry.older!.newer = entry;\n\n entry.newer = null;\n this.newest = entry;\n\n if (entry === this.oldest) {\n this.oldest = newer;\n }\n }\n\n return entry;\n }\n\n public set(key: K, value: V) {\n let entry = this.getEntry(key);\n if (entry) {\n return entry.value = value;\n }\n\n entry = {\n key: key,\n value: value,\n newer: null,\n older: this.newest\n };\n\n if (this.newest) {\n this.newest.newer = entry;\n }\n\n this.newest = entry;\n this.oldest = this.oldest || entry;\n\n this.map.set(key, entry);\n\n return entry.value;\n }\n\n public clean() {\n while (this.oldest && this.map.size > this.max) {\n this.delete(this.oldest.key);\n }\n }\n\n public delete(key: K) {\n const entry = this.map.get(key);\n if (entry) {\n if (entry === this.newest) {\n this.newest = entry.older;\n }\n\n if (entry === this.oldest) {\n this.oldest = entry.newer;\n }\n\n if (entry.newer) {\n entry.newer.older = entry.older;\n }\n\n if (entry.older) {\n entry.older.newer = entry.newer;\n }\n\n this.map.delete(key);\n this.dispose(entry.value, key);\n\n return true;\n }\n\n return false;\n }\n}\n","import { AnyEntry } from \"./entry\";\nimport { Slot } from \"@wry/context\";\n\nexport const parentEntrySlot = new Slot();\n\nexport {\n bind as bindContext,\n noContext,\n setTimeout,\n asyncFromGen,\n} from \"@wry/context\";\n","import { parentEntrySlot } from \"./context\";\nimport { OptimisticWrapOptions } from \"./index\";\n\nconst reusableEmptyArray: AnyEntry[] = [];\nconst emptySetPool: Set[] = [];\nconst POOL_TARGET_SIZE = 100;\n\n// Since this package might be used browsers, we should avoid using the\n// Node built-in assert module.\nfunction assert(condition: any, optionalMessage?: string) {\n if (! condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}\n\n// Since exceptions are cached just like normal values, we need an efficient\n// way of representing unknown, ordinary, and exceptional values.\ntype Value =\n | [] // unknown\n | [T] // known value\n | [void, any]; // known exception\n\nfunction valueIs(a: Value, b: Value) {\n const len = a.length;\n return (\n // Unknown values are not equal to each other.\n len > 0 &&\n // Both values must be ordinary (or both exceptional) to be equal.\n len === b.length &&\n // The underlying value or exception must be the same.\n a[len - 1] === b[len - 1]\n );\n}\n\nfunction valueGet(value: Value): T {\n switch (value.length) {\n case 0: throw new Error(\"unknown value\");\n case 1: return value[0];\n case 2: throw value[1];\n }\n}\n\nfunction valueCopy(value: Value): Value {\n return value.slice(0) as Value;\n}\n\nexport type AnyEntry = Entry;\n\nexport class Entry {\n public static count = 0;\n\n public subscribe: OptimisticWrapOptions[\"subscribe\"];\n public unsubscribe?: () => any;\n public reportOrphan?: (this: Entry) => any;\n\n public readonly parents = new Set();\n public readonly childValues = new Map>();\n\n // When this Entry has children that are dirty, this property becomes\n // a Set containing other Entry objects, borrowed from emptySetPool.\n // When the set becomes empty, it gets recycled back to emptySetPool.\n public dirtyChildren: Set | null = null;\n\n public dirty = true;\n public recomputing = false;\n public readonly value: Value = [];\n\n constructor(\n public readonly fn: (...args: TArgs) => TValue,\n public args: TArgs,\n ) {\n ++Entry.count;\n }\n\n // This is the most important method of the Entry API, because it\n // determines whether the cached this.value can be returned immediately,\n // or must be recomputed. The overall performance of the caching system\n // depends on the truth of the following observations: (1) this.dirty is\n // usually false, (2) this.dirtyChildren is usually null/empty, and thus\n // (3) valueGet(this.value) is usually returned without recomputation.\n public recompute(): TValue {\n assert(! this.recomputing, \"already recomputing\");\n\n if (! rememberParent(this) && maybeReportOrphan(this)) {\n // The recipient of the entry.reportOrphan callback decided to dispose\n // of this orphan entry by calling entry.dispose(), so we don't need to\n // (and should not) proceed with the recomputation.\n return void 0 as any;\n }\n\n return mightBeDirty(this)\n ? reallyRecompute(this)\n : valueGet(this.value);\n }\n\n public setDirty() {\n if (this.dirty) return;\n this.dirty = true;\n this.value.length = 0;\n reportDirty(this);\n // We can go ahead and unsubscribe here, since any further dirty\n // notifications we receive will be redundant, and unsubscribing may\n // free up some resources, e.g. file watchers.\n maybeUnsubscribe(this);\n }\n\n public dispose() {\n forgetChildren(this).forEach(maybeReportOrphan);\n maybeUnsubscribe(this);\n\n // Because this entry has been kicked out of the cache (in index.js),\n // we've lost the ability to find out if/when this entry becomes dirty,\n // whether that happens through a subscription, because of a direct call\n // to entry.setDirty(), or because one of its children becomes dirty.\n // Because of this loss of future information, we have to assume the\n // worst (that this entry might have become dirty very soon), so we must\n // immediately mark this entry's parents as dirty. Normally we could\n // just call entry.setDirty() rather than calling parent.setDirty() for\n // each parent, but that would leave this entry in parent.childValues\n // and parent.dirtyChildren, which would prevent the child from being\n // truly forgotten.\n this.parents.forEach(parent => {\n parent.setDirty();\n forgetChild(parent, this);\n });\n }\n}\n\nfunction rememberParent(child: AnyEntry) {\n const parent = parentEntrySlot.getValue();\n if (parent) {\n child.parents.add(parent);\n\n if (! parent.childValues.has(child)) {\n parent.childValues.set(child, []);\n }\n\n if (mightBeDirty(child)) {\n reportDirtyChild(parent, child);\n } else {\n reportCleanChild(parent, child);\n }\n\n return parent;\n }\n}\n\nfunction reallyRecompute(entry: AnyEntry) {\n // Since this recomputation is likely to re-remember some of this\n // entry's children, we forget our children here but do not call\n // maybeReportOrphan until after the recomputation finishes.\n const originalChildren = forgetChildren(entry);\n\n // Set entry as the parent entry while calling recomputeNewValue(entry).\n parentEntrySlot.withValue(entry, recomputeNewValue, [entry]);\n\n if (maybeSubscribe(entry)) {\n // If we successfully recomputed entry.value and did not fail to\n // (re)subscribe, then this Entry is no longer explicitly dirty.\n setClean(entry);\n }\n\n // Now that we've had a chance to re-remember any children that were\n // involved in the recomputation, we can safely report any orphan\n // children that remain.\n originalChildren.forEach(maybeReportOrphan);\n\n return valueGet(entry.value);\n}\n\nfunction recomputeNewValue(entry: AnyEntry) {\n entry.recomputing = true;\n // Set entry.value as unknown.\n entry.value.length = 0;\n try {\n // If entry.fn succeeds, entry.value will become a normal Value.\n entry.value[0] = entry.fn.apply(null, entry.args);\n } catch (e) {\n // If entry.fn throws, entry.value will become exceptional.\n entry.value[1] = e;\n }\n // Either way, this line is always reached.\n entry.recomputing = false;\n}\n\nfunction mightBeDirty(entry: AnyEntry) {\n return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size);\n}\n\nfunction setClean(entry: AnyEntry) {\n entry.dirty = false;\n\n if (mightBeDirty(entry)) {\n // This Entry may still have dirty children, in which case we can't\n // let our parents know we're clean just yet.\n return;\n }\n\n reportClean(entry);\n}\n\nfunction reportDirty(child: AnyEntry) {\n child.parents.forEach(parent => reportDirtyChild(parent, child));\n}\n\nfunction reportClean(child: AnyEntry) {\n child.parents.forEach(parent => reportCleanChild(parent, child));\n}\n\n// Let a parent Entry know that one of its children may be dirty.\nfunction reportDirtyChild(parent: AnyEntry, child: AnyEntry) {\n // Must have called rememberParent(child) before calling\n // reportDirtyChild(parent, child).\n assert(parent.childValues.has(child));\n assert(mightBeDirty(child));\n\n if (! parent.dirtyChildren) {\n parent.dirtyChildren = emptySetPool.pop() || new Set;\n\n } else if (parent.dirtyChildren.has(child)) {\n // If we already know this child is dirty, then we must have already\n // informed our own parents that we are dirty, so we can terminate\n // the recursion early.\n return;\n }\n\n parent.dirtyChildren.add(child);\n reportDirty(parent);\n}\n\n// Let a parent Entry know that one of its children is no longer dirty.\nfunction reportCleanChild(parent: AnyEntry, child: AnyEntry) {\n // Must have called rememberChild(child) before calling\n // reportCleanChild(parent, child).\n assert(parent.childValues.has(child));\n assert(! mightBeDirty(child));\n\n const childValue = parent.childValues.get(child)!;\n if (childValue.length === 0) {\n parent.childValues.set(child, valueCopy(child.value));\n } else if (! valueIs(childValue, child.value)) {\n parent.setDirty();\n }\n\n removeDirtyChild(parent, child);\n\n if (mightBeDirty(parent)) {\n return;\n }\n\n reportClean(parent);\n}\n\nfunction removeDirtyChild(parent: AnyEntry, child: AnyEntry) {\n const dc = parent.dirtyChildren;\n if (dc) {\n dc.delete(child);\n if (dc.size === 0) {\n if (emptySetPool.length < POOL_TARGET_SIZE) {\n emptySetPool.push(dc);\n }\n parent.dirtyChildren = null;\n }\n }\n}\n\n// If the given entry has a reportOrphan method, and no remaining parents,\n// call entry.reportOrphan and return true iff it returns true. The\n// reportOrphan function should return true to indicate entry.dispose()\n// has been called, and the entry has been removed from any other caches\n// (see index.js for the only current example).\nfunction maybeReportOrphan(entry: AnyEntry) {\n return entry.parents.size === 0 &&\n typeof entry.reportOrphan === \"function\" &&\n entry.reportOrphan() === true;\n}\n\n// Removes all children from this entry and returns an array of the\n// removed children.\nfunction forgetChildren(parent: AnyEntry) {\n let children = reusableEmptyArray;\n\n if (parent.childValues.size > 0) {\n children = [];\n parent.childValues.forEach((_value, child) => {\n forgetChild(parent, child);\n children.push(child);\n });\n }\n\n // After we forget all our children, this.dirtyChildren must be empty\n // and therefore must have been reset to null.\n assert(parent.dirtyChildren === null);\n\n return children;\n}\n\nfunction forgetChild(parent: AnyEntry, child: AnyEntry) {\n child.parents.delete(parent);\n parent.childValues.delete(child);\n removeDirtyChild(parent, child);\n}\n\nfunction maybeSubscribe(entry: AnyEntry) {\n if (typeof entry.subscribe === \"function\") {\n try {\n maybeUnsubscribe(entry); // Prevent double subscriptions.\n entry.unsubscribe = entry.subscribe.apply(null, entry.args);\n } catch (e) {\n // If this Entry has a subscribe function and it threw an exception\n // (or an unsubscribe function it previously returned now throws),\n // return false to indicate that we were not able to subscribe (or\n // unsubscribe), and this Entry should remain dirty.\n entry.setDirty();\n return false;\n }\n }\n\n // Returning true indicates either that there was no entry.subscribe\n // function or that it succeeded.\n return true;\n}\n\nfunction maybeUnsubscribe(entry: AnyEntry) {\n const { unsubscribe } = entry;\n if (typeof unsubscribe === \"function\") {\n entry.unsubscribe = void 0;\n unsubscribe();\n }\n}\n","// A trie data structure that holds object keys weakly, yet can also hold\n// non-object keys, unlike the native `WeakMap`.\nexport class KeyTrie {\n // Since a `WeakMap` cannot hold primitive values as keys, we need a\n // backup `Map` instance to hold primitive keys. Both `this._weakMap`\n // and `this._strongMap` are lazily initialized.\n private weak?: WeakMap>;\n private strong?: Map>;\n private data?: K;\n\n constructor(private readonly weakness: boolean) {}\n\n public lookup(...array: T): K {\n return this.lookupArray(array);\n }\n\n public lookupArray(array: T): K {\n let node: KeyTrie = this;\n array.forEach(key => node = node.getChildTrie(key));\n return node.data || (node.data = Object.create(null));\n }\n\n private getChildTrie(key: any) {\n const map = this.weakness && isObjRef(key)\n ? this.weak || (this.weak = new WeakMap>())\n : this.strong || (this.strong = new Map>());\n let child = map.get(key);\n if (!child) map.set(key, child = new KeyTrie(this.weakness));\n return child;\n }\n}\n\nfunction isObjRef(value: any) {\n switch (typeof value) {\n case \"object\":\n if (value === null) break;\n // Fall through to return true...\n case \"function\":\n return true;\n }\n return false;\n}\n","import { Cache } from \"./cache\";\nimport { Entry, AnyEntry } from \"./entry\";\nimport { parentEntrySlot } from \"./context\";\nimport { KeyTrie } from \"./key-trie\";\n\n// These helper functions are important for making optimism work with\n// asynchronous code. In order to register parent-child dependencies,\n// optimism needs to know about any currently active parent computations.\n// In ordinary synchronous code, the parent context is implicit in the\n// execution stack, but asynchronous code requires some extra guidance in\n// order to propagate context from one async task segment to the next.\nexport {\n bindContext,\n noContext,\n setTimeout,\n asyncFromGen,\n} from \"./context\";\n\n// Since the Cache uses a Map internally, any value or object reference can\n// be safely used as a key, though common types include object and string.\nexport type TCacheKey = any;\n\n// The defaultMakeCacheKey function is remarkably powerful, because it gives\n// a unique object for any shallow-identical list of arguments. If you need\n// to implement a custom makeCacheKey function, you may find it helpful to\n// delegate the final work to defaultMakeCacheKey, which is why we export it\n// here. However, you may want to avoid defaultMakeCacheKey if your runtime\n// does not support WeakMap, or you have the ability to return a string key.\n// In those cases, just write your own custom makeCacheKey functions.\nconst keyTrie = new KeyTrie(typeof WeakMap === \"function\");\nexport function defaultMakeCacheKey(...args: any[]) {\n return keyTrie.lookupArray(args);\n}\n\n// If you're paranoid about memory leaks, or you want to avoid using WeakMap\n// under the hood, but you still need the behavior of defaultMakeCacheKey,\n// import this constructor to create your own tries.\nexport { KeyTrie }\n\nexport type OptimisticWrapperFunction<\n TArgs extends any[],\n TResult,\n> = ((...args: TArgs) => TResult) & {\n // The .dirty(...) method of an optimistic function takes exactly the\n // same parameter types as the original function.\n dirty: (...args: TArgs) => void;\n};\n\nexport type OptimisticWrapOptions = {\n // The maximum number of cache entries that should be retained before the\n // cache begins evicting the oldest ones.\n max?: number;\n // If a wrapped function is \"disposable,\" then its creator does not\n // care about its return value, and it should be removed from the cache\n // immediately when it no longer has any parents that depend on it.\n disposable?: boolean;\n // The makeCacheKey function takes the same arguments that were passed to\n // the wrapper function and returns a single value that can be used as a key\n // in a Map to identify the cached result.\n makeCacheKey?: (...args: TArgs) => TCacheKey;\n // If provided, the subscribe function should either return an unsubscribe\n // function or return nothing.\n subscribe?: (...args: TArgs) => (() => any) | undefined;\n};\n\nconst caches = new Set>();\n\nexport function wrap<\n TArgs extends any[],\n TResult,\n>(\n originalFunction: (...args: TArgs) => TResult,\n options: OptimisticWrapOptions = Object.create(null),\n) {\n const cache = new Cache>(\n options.max || Math.pow(2, 16),\n entry => entry.dispose(),\n );\n\n const disposable = !! options.disposable;\n const makeCacheKey = options.makeCacheKey || defaultMakeCacheKey;\n\n function optimistic(): TResult {\n if (disposable && ! parentEntrySlot.hasValue()) {\n // If there's no current parent computation, and this wrapped\n // function is disposable (meaning we don't care about entry.value,\n // just dependency tracking), then we can short-cut everything else\n // in this function, because entry.recompute() is going to recycle\n // the entry object without recomputing anything, anyway.\n return void 0 as any;\n }\n\n const key = makeCacheKey.apply(null, arguments as any);\n if (key === void 0) {\n return originalFunction.apply(null, arguments as any);\n }\n\n const args = Array.prototype.slice.call(arguments) as TArgs;\n\n let entry = cache.get(key);\n if (entry) {\n entry.args = args;\n } else {\n entry = new Entry(originalFunction, args);\n cache.set(key, entry);\n entry.subscribe = options.subscribe;\n if (disposable) {\n entry.reportOrphan = () => cache.delete(key);\n }\n }\n\n const value = entry.recompute();\n\n // Move this entry to the front of the least-recently used queue,\n // since we just finished computing its value.\n cache.set(key, entry);\n\n caches.add(cache);\n\n // Clean up any excess entries in the cache, but only if there is no\n // active parent entry, meaning we're not in the middle of a larger\n // computation that might be flummoxed by the cleaning.\n if (! parentEntrySlot.hasValue()) {\n caches.forEach(cache => cache.clean());\n caches.clear();\n }\n\n // If options.disposable is truthy, the caller of wrap is telling us\n // they don't care about the result of entry.recompute(), so we should\n // avoid returning the value, so it won't be accidentally used.\n return disposable ? void 0 as any : value;\n }\n\n optimistic.dirty = function () {\n const key = makeCacheKey.apply(null, arguments as any);\n const child = key !== void 0 && cache.get(key);\n if (child) {\n child.setDirty();\n }\n };\n\n return optimistic as OptimisticWrapperFunction;\n}\n"],"names":["Slot"],"mappings":";;;;;;AAOA,SAAS,cAAc,MAAK;AAE5B;IAKE,eACU,GAAc,EACf,OAAoD;QADnD,oBAAA,EAAA,cAAc;QACf,wBAAA,EAAA,wBAAoD;QADnD,QAAG,GAAH,GAAG,CAAW;QACf,YAAO,GAAP,OAAO,CAA6C;QANrD,QAAG,GAAG,IAAI,GAAG,EAAiB,CAAC;QAC/B,WAAM,GAAsB,IAAI,CAAC;QACjC,WAAM,GAAsB,IAAI,CAAC;KAKrC;IAEG,mBAAG,GAAV,UAAW,GAAM;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAC1B;IAEM,mBAAG,GAAV,UAAW,GAAM;QACf,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACjC,OAAO,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC;KAC7B;IAEO,wBAAQ,GAAhB,UAAiB,GAAM;QACrB,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEhC,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE;YAC1B,IAAA,mBAAK,EAAE,mBAAK,CA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e,CAAC,QAAQ,EAAE,EAAE;YAChC,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,KAAK,EAAE,GAAA,CAAC,CAAC;YACvC,MAAM,CAAC,KAAK,EAAE,CAAC;SAChB;;;;QAKD,OAAO,UAAU,GAAG,KAAK,CAAQ,GAAG,KAAK,CAAC;KAC3C;IAED,UAAU,CAAC,KAAK,GAAG;QACjB,IAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC,CAAC;QACvD,IAAM,KAAK,GAAG,GAAG,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,QAAQ,EAAE,CAAC;SAClB;KACF,CAAC;IAEF,OAAO,UAAuD,CAAC;CAChE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/optimism/lib/bundle.esm.js b/node_modules/optimism/lib/bundle.esm.js deleted file mode 100644 index d453a2d9..00000000 --- a/node_modules/optimism/lib/bundle.esm.js +++ /dev/null @@ -1,479 +0,0 @@ -import { Slot } from '@wry/context'; -export { asyncFromGen, bind as bindContext, noContext, setTimeout } from '@wry/context'; - -function defaultDispose() { } -var Cache = /** @class */ (function () { - function Cache(max, dispose) { - if (max === void 0) { max = Infinity; } - if (dispose === void 0) { dispose = defaultDispose; } - this.max = max; - this.dispose = dispose; - this.map = new Map(); - this.newest = null; - this.oldest = null; - } - Cache.prototype.has = function (key) { - return this.map.has(key); - }; - Cache.prototype.get = function (key) { - var entry = this.getEntry(key); - return entry && entry.value; - }; - Cache.prototype.getEntry = function (key) { - var entry = this.map.get(key); - if (entry && entry !== this.newest) { - var older = entry.older, newer = entry.newer; - if (newer) { - newer.older = older; - } - if (older) { - older.newer = newer; - } - entry.older = this.newest; - entry.older.newer = entry; - entry.newer = null; - this.newest = entry; - if (entry === this.oldest) { - this.oldest = newer; - } - } - return entry; - }; - Cache.prototype.set = function (key, value) { - var entry = this.getEntry(key); - if (entry) { - return entry.value = value; - } - entry = { - key: key, - value: value, - newer: null, - older: this.newest - }; - if (this.newest) { - this.newest.newer = entry; - } - this.newest = entry; - this.oldest = this.oldest || entry; - this.map.set(key, entry); - return entry.value; - }; - Cache.prototype.clean = function () { - while (this.oldest && this.map.size > this.max) { - this.delete(this.oldest.key); - } - }; - Cache.prototype.delete = function (key) { - var entry = this.map.get(key); - if (entry) { - if (entry === this.newest) { - this.newest = entry.older; - } - if (entry === this.oldest) { - this.oldest = entry.newer; - } - if (entry.newer) { - entry.newer.older = entry.older; - } - if (entry.older) { - entry.older.newer = entry.newer; - } - this.map.delete(key); - this.dispose(entry.value, key); - return true; - } - return false; - }; - return Cache; -}()); - -var parentEntrySlot = new Slot(); - -var reusableEmptyArray = []; -var emptySetPool = []; -var POOL_TARGET_SIZE = 100; -// Since this package might be used browsers, we should avoid using the -// Node built-in assert module. -function assert(condition, optionalMessage) { - if (!condition) { - throw new Error(optionalMessage || "assertion failure"); - } -} -function valueIs(a, b) { - var len = a.length; - return ( - // Unknown values are not equal to each other. - len > 0 && - // Both values must be ordinary (or both exceptional) to be equal. - len === b.length && - // The underlying value or exception must be the same. - a[len - 1] === b[len - 1]); -} -function valueGet(value) { - switch (value.length) { - case 0: throw new Error("unknown value"); - case 1: return value[0]; - case 2: throw value[1]; - } -} -function valueCopy(value) { - return value.slice(0); -} -var Entry = /** @class */ (function () { - function Entry(fn, args) { - this.fn = fn; - this.args = args; - this.parents = new Set(); - this.childValues = new Map(); - // When this Entry has children that are dirty, this property becomes - // a Set containing other Entry objects, borrowed from emptySetPool. - // When the set becomes empty, it gets recycled back to emptySetPool. - this.dirtyChildren = null; - this.dirty = true; - this.recomputing = false; - this.value = []; - ++Entry.count; - } - // This is the most important method of the Entry API, because it - // determines whether the cached this.value can be returned immediately, - // or must be recomputed. The overall performance of the caching system - // depends on the truth of the following observations: (1) this.dirty is - // usually false, (2) this.dirtyChildren is usually null/empty, and thus - // (3) valueGet(this.value) is usually returned without recomputation. - Entry.prototype.recompute = function () { - assert(!this.recomputing, "already recomputing"); - if (!rememberParent(this) && maybeReportOrphan(this)) { - // The recipient of the entry.reportOrphan callback decided to dispose - // of this orphan entry by calling entry.dispose(), so we don't need to - // (and should not) proceed with the recomputation. - return void 0; - } - return mightBeDirty(this) - ? reallyRecompute(this) - : valueGet(this.value); - }; - Entry.prototype.setDirty = function () { - if (this.dirty) - return; - this.dirty = true; - this.value.length = 0; - reportDirty(this); - // We can go ahead and unsubscribe here, since any further dirty - // notifications we receive will be redundant, and unsubscribing may - // free up some resources, e.g. file watchers. - maybeUnsubscribe(this); - }; - Entry.prototype.dispose = function () { - var _this = this; - forgetChildren(this).forEach(maybeReportOrphan); - maybeUnsubscribe(this); - // Because this entry has been kicked out of the cache (in index.js), - // we've lost the ability to find out if/when this entry becomes dirty, - // whether that happens through a subscription, because of a direct call - // to entry.setDirty(), or because one of its children becomes dirty. - // Because of this loss of future information, we have to assume the - // worst (that this entry might have become dirty very soon), so we must - // immediately mark this entry's parents as dirty. Normally we could - // just call entry.setDirty() rather than calling parent.setDirty() for - // each parent, but that would leave this entry in parent.childValues - // and parent.dirtyChildren, which would prevent the child from being - // truly forgotten. - this.parents.forEach(function (parent) { - parent.setDirty(); - forgetChild(parent, _this); - }); - }; - Entry.count = 0; - return Entry; -}()); -function rememberParent(child) { - var parent = parentEntrySlot.getValue(); - if (parent) { - child.parents.add(parent); - if (!parent.childValues.has(child)) { - parent.childValues.set(child, []); - } - if (mightBeDirty(child)) { - reportDirtyChild(parent, child); - } - else { - reportCleanChild(parent, child); - } - return parent; - } -} -function reallyRecompute(entry) { - // Since this recomputation is likely to re-remember some of this - // entry's children, we forget our children here but do not call - // maybeReportOrphan until after the recomputation finishes. - var originalChildren = forgetChildren(entry); - // Set entry as the parent entry while calling recomputeNewValue(entry). - parentEntrySlot.withValue(entry, recomputeNewValue, [entry]); - if (maybeSubscribe(entry)) { - // If we successfully recomputed entry.value and did not fail to - // (re)subscribe, then this Entry is no longer explicitly dirty. - setClean(entry); - } - // Now that we've had a chance to re-remember any children that were - // involved in the recomputation, we can safely report any orphan - // children that remain. - originalChildren.forEach(maybeReportOrphan); - return valueGet(entry.value); -} -function recomputeNewValue(entry) { - entry.recomputing = true; - // Set entry.value as unknown. - entry.value.length = 0; - try { - // If entry.fn succeeds, entry.value will become a normal Value. - entry.value[0] = entry.fn.apply(null, entry.args); - } - catch (e) { - // If entry.fn throws, entry.value will become exceptional. - entry.value[1] = e; - } - // Either way, this line is always reached. - entry.recomputing = false; -} -function mightBeDirty(entry) { - return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); -} -function setClean(entry) { - entry.dirty = false; - if (mightBeDirty(entry)) { - // This Entry may still have dirty children, in which case we can't - // let our parents know we're clean just yet. - return; - } - reportClean(entry); -} -function reportDirty(child) { - child.parents.forEach(function (parent) { return reportDirtyChild(parent, child); }); -} -function reportClean(child) { - child.parents.forEach(function (parent) { return reportCleanChild(parent, child); }); -} -// Let a parent Entry know that one of its children may be dirty. -function reportDirtyChild(parent, child) { - // Must have called rememberParent(child) before calling - // reportDirtyChild(parent, child). - assert(parent.childValues.has(child)); - assert(mightBeDirty(child)); - if (!parent.dirtyChildren) { - parent.dirtyChildren = emptySetPool.pop() || new Set; - } - else if (parent.dirtyChildren.has(child)) { - // If we already know this child is dirty, then we must have already - // informed our own parents that we are dirty, so we can terminate - // the recursion early. - return; - } - parent.dirtyChildren.add(child); - reportDirty(parent); -} -// Let a parent Entry know that one of its children is no longer dirty. -function reportCleanChild(parent, child) { - // Must have called rememberChild(child) before calling - // reportCleanChild(parent, child). - assert(parent.childValues.has(child)); - assert(!mightBeDirty(child)); - var childValue = parent.childValues.get(child); - if (childValue.length === 0) { - parent.childValues.set(child, valueCopy(child.value)); - } - else if (!valueIs(childValue, child.value)) { - parent.setDirty(); - } - removeDirtyChild(parent, child); - if (mightBeDirty(parent)) { - return; - } - reportClean(parent); -} -function removeDirtyChild(parent, child) { - var dc = parent.dirtyChildren; - if (dc) { - dc.delete(child); - if (dc.size === 0) { - if (emptySetPool.length < POOL_TARGET_SIZE) { - emptySetPool.push(dc); - } - parent.dirtyChildren = null; - } - } -} -// If the given entry has a reportOrphan method, and no remaining parents, -// call entry.reportOrphan and return true iff it returns true. The -// reportOrphan function should return true to indicate entry.dispose() -// has been called, and the entry has been removed from any other caches -// (see index.js for the only current example). -function maybeReportOrphan(entry) { - return entry.parents.size === 0 && - typeof entry.reportOrphan === "function" && - entry.reportOrphan() === true; -} -// Removes all children from this entry and returns an array of the -// removed children. -function forgetChildren(parent) { - var children = reusableEmptyArray; - if (parent.childValues.size > 0) { - children = []; - parent.childValues.forEach(function (_value, child) { - forgetChild(parent, child); - children.push(child); - }); - } - // After we forget all our children, this.dirtyChildren must be empty - // and therefore must have been reset to null. - assert(parent.dirtyChildren === null); - return children; -} -function forgetChild(parent, child) { - child.parents.delete(parent); - parent.childValues.delete(child); - removeDirtyChild(parent, child); -} -function maybeSubscribe(entry) { - if (typeof entry.subscribe === "function") { - try { - maybeUnsubscribe(entry); // Prevent double subscriptions. - entry.unsubscribe = entry.subscribe.apply(null, entry.args); - } - catch (e) { - // If this Entry has a subscribe function and it threw an exception - // (or an unsubscribe function it previously returned now throws), - // return false to indicate that we were not able to subscribe (or - // unsubscribe), and this Entry should remain dirty. - entry.setDirty(); - return false; - } - } - // Returning true indicates either that there was no entry.subscribe - // function or that it succeeded. - return true; -} -function maybeUnsubscribe(entry) { - var unsubscribe = entry.unsubscribe; - if (typeof unsubscribe === "function") { - entry.unsubscribe = void 0; - unsubscribe(); - } -} - -// A trie data structure that holds object keys weakly, yet can also hold -// non-object keys, unlike the native `WeakMap`. -var KeyTrie = /** @class */ (function () { - function KeyTrie(weakness) { - this.weakness = weakness; - } - KeyTrie.prototype.lookup = function () { - var array = []; - for (var _i = 0; _i < arguments.length; _i++) { - array[_i] = arguments[_i]; - } - return this.lookupArray(array); - }; - KeyTrie.prototype.lookupArray = function (array) { - var node = this; - array.forEach(function (key) { return node = node.getChildTrie(key); }); - return node.data || (node.data = Object.create(null)); - }; - KeyTrie.prototype.getChildTrie = function (key) { - var map = this.weakness && isObjRef(key) - ? this.weak || (this.weak = new WeakMap()) - : this.strong || (this.strong = new Map()); - var child = map.get(key); - if (!child) - map.set(key, child = new KeyTrie(this.weakness)); - return child; - }; - return KeyTrie; -}()); -function isObjRef(value) { - switch (typeof value) { - case "object": - if (value === null) - break; - // Fall through to return true... - case "function": - return true; - } - return false; -} - -// The defaultMakeCacheKey function is remarkably powerful, because it gives -// a unique object for any shallow-identical list of arguments. If you need -// to implement a custom makeCacheKey function, you may find it helpful to -// delegate the final work to defaultMakeCacheKey, which is why we export it -// here. However, you may want to avoid defaultMakeCacheKey if your runtime -// does not support WeakMap, or you have the ability to return a string key. -// In those cases, just write your own custom makeCacheKey functions. -var keyTrie = new KeyTrie(typeof WeakMap === "function"); -function defaultMakeCacheKey() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return keyTrie.lookupArray(args); -} -var caches = new Set(); -function wrap(originalFunction, options) { - if (options === void 0) { options = Object.create(null); } - var cache = new Cache(options.max || Math.pow(2, 16), function (entry) { return entry.dispose(); }); - var disposable = !!options.disposable; - var makeCacheKey = options.makeCacheKey || defaultMakeCacheKey; - function optimistic() { - if (disposable && !parentEntrySlot.hasValue()) { - // If there's no current parent computation, and this wrapped - // function is disposable (meaning we don't care about entry.value, - // just dependency tracking), then we can short-cut everything else - // in this function, because entry.recompute() is going to recycle - // the entry object without recomputing anything, anyway. - return void 0; - } - var key = makeCacheKey.apply(null, arguments); - if (key === void 0) { - return originalFunction.apply(null, arguments); - } - var args = Array.prototype.slice.call(arguments); - var entry = cache.get(key); - if (entry) { - entry.args = args; - } - else { - entry = new Entry(originalFunction, args); - cache.set(key, entry); - entry.subscribe = options.subscribe; - if (disposable) { - entry.reportOrphan = function () { return cache.delete(key); }; - } - } - var value = entry.recompute(); - // Move this entry to the front of the least-recently used queue, - // since we just finished computing its value. - cache.set(key, entry); - caches.add(cache); - // Clean up any excess entries in the cache, but only if there is no - // active parent entry, meaning we're not in the middle of a larger - // computation that might be flummoxed by the cleaning. - if (!parentEntrySlot.hasValue()) { - caches.forEach(function (cache) { return cache.clean(); }); - caches.clear(); - } - // If options.disposable is truthy, the caller of wrap is telling us - // they don't care about the result of entry.recompute(), so we should - // avoid returning the value, so it won't be accidentally used. - return disposable ? void 0 : value; - } - optimistic.dirty = function () { - var key = makeCacheKey.apply(null, arguments); - var child = key !== void 0 && cache.get(key); - if (child) { - child.setDirty(); - } - }; - return optimistic; -} - -export { KeyTrie, defaultMakeCacheKey, wrap }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/optimism/lib/bundle.esm.js.map b/node_modules/optimism/lib/bundle.esm.js.map deleted file mode 100644 index 5705095c..00000000 --- a/node_modules/optimism/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/cache.ts","../src/context.ts","../src/entry.ts","../src/key-trie.ts","../src/index.ts"],"sourcesContent":["interface Node {\n key: K;\n value: V;\n newer: Node | null;\n older: Node | null;\n}\n\nfunction defaultDispose() {}\n\nexport class Cache {\n private map = new Map>();\n private newest: Node | null = null;\n private oldest: Node | null = null;\n\n constructor(\n private max = Infinity,\n public dispose: (value: V, key: K) => void = defaultDispose,\n ) {}\n\n public has(key: K) {\n return this.map.has(key);\n }\n\n public get(key: K) {\n const entry = this.getEntry(key);\n return entry && entry.value;\n }\n\n private getEntry(key: K): Node | void {\n const entry = this.map.get(key);\n\n if (entry && entry !== this.newest) {\n const { older, newer } = entry;\n\n if (newer) {\n newer.older = older;\n }\n\n if (older) {\n older.newer = newer;\n }\n\n entry.older = this.newest;\n entry.older!.newer = entry;\n\n entry.newer = null;\n this.newest = entry;\n\n if (entry === this.oldest) {\n this.oldest = newer;\n }\n }\n\n return entry;\n }\n\n public set(key: K, value: V) {\n let entry = this.getEntry(key);\n if (entry) {\n return entry.value = value;\n }\n\n entry = {\n key: key,\n value: value,\n newer: null,\n older: this.newest\n };\n\n if (this.newest) {\n this.newest.newer = entry;\n }\n\n this.newest = entry;\n this.oldest = this.oldest || entry;\n\n this.map.set(key, entry);\n\n return entry.value;\n }\n\n public clean() {\n while (this.oldest && this.map.size > this.max) {\n this.delete(this.oldest.key);\n }\n }\n\n public delete(key: K) {\n const entry = this.map.get(key);\n if (entry) {\n if (entry === this.newest) {\n this.newest = entry.older;\n }\n\n if (entry === this.oldest) {\n this.oldest = entry.newer;\n }\n\n if (entry.newer) {\n entry.newer.older = entry.older;\n }\n\n if (entry.older) {\n entry.older.newer = entry.newer;\n }\n\n this.map.delete(key);\n this.dispose(entry.value, key);\n\n return true;\n }\n\n return false;\n }\n}\n","import { AnyEntry } from \"./entry\";\nimport { Slot } from \"@wry/context\";\n\nexport const parentEntrySlot = new Slot();\n\nexport {\n bind as bindContext,\n noContext,\n setTimeout,\n asyncFromGen,\n} from \"@wry/context\";\n","import { parentEntrySlot } from \"./context\";\nimport { OptimisticWrapOptions } from \"./index\";\n\nconst reusableEmptyArray: AnyEntry[] = [];\nconst emptySetPool: Set[] = [];\nconst POOL_TARGET_SIZE = 100;\n\n// Since this package might be used browsers, we should avoid using the\n// Node built-in assert module.\nfunction assert(condition: any, optionalMessage?: string) {\n if (! condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}\n\n// Since exceptions are cached just like normal values, we need an efficient\n// way of representing unknown, ordinary, and exceptional values.\ntype Value =\n | [] // unknown\n | [T] // known value\n | [void, any]; // known exception\n\nfunction valueIs(a: Value, b: Value) {\n const len = a.length;\n return (\n // Unknown values are not equal to each other.\n len > 0 &&\n // Both values must be ordinary (or both exceptional) to be equal.\n len === b.length &&\n // The underlying value or exception must be the same.\n a[len - 1] === b[len - 1]\n );\n}\n\nfunction valueGet(value: Value): T {\n switch (value.length) {\n case 0: throw new Error(\"unknown value\");\n case 1: return value[0];\n case 2: throw value[1];\n }\n}\n\nfunction valueCopy(value: Value): Value {\n return value.slice(0) as Value;\n}\n\nexport type AnyEntry = Entry;\n\nexport class Entry {\n public static count = 0;\n\n public subscribe: OptimisticWrapOptions[\"subscribe\"];\n public unsubscribe?: () => any;\n public reportOrphan?: (this: Entry) => any;\n\n public readonly parents = new Set();\n public readonly childValues = new Map>();\n\n // When this Entry has children that are dirty, this property becomes\n // a Set containing other Entry objects, borrowed from emptySetPool.\n // When the set becomes empty, it gets recycled back to emptySetPool.\n public dirtyChildren: Set | null = null;\n\n public dirty = true;\n public recomputing = false;\n public readonly value: Value = [];\n\n constructor(\n public readonly fn: (...args: TArgs) => TValue,\n public args: TArgs,\n ) {\n ++Entry.count;\n }\n\n // This is the most important method of the Entry API, because it\n // determines whether the cached this.value can be returned immediately,\n // or must be recomputed. The overall performance of the caching system\n // depends on the truth of the following observations: (1) this.dirty is\n // usually false, (2) this.dirtyChildren is usually null/empty, and thus\n // (3) valueGet(this.value) is usually returned without recomputation.\n public recompute(): TValue {\n assert(! this.recomputing, \"already recomputing\");\n\n if (! rememberParent(this) && maybeReportOrphan(this)) {\n // The recipient of the entry.reportOrphan callback decided to dispose\n // of this orphan entry by calling entry.dispose(), so we don't need to\n // (and should not) proceed with the recomputation.\n return void 0 as any;\n }\n\n return mightBeDirty(this)\n ? reallyRecompute(this)\n : valueGet(this.value);\n }\n\n public setDirty() {\n if (this.dirty) return;\n this.dirty = true;\n this.value.length = 0;\n reportDirty(this);\n // We can go ahead and unsubscribe here, since any further dirty\n // notifications we receive will be redundant, and unsubscribing may\n // free up some resources, e.g. file watchers.\n maybeUnsubscribe(this);\n }\n\n public dispose() {\n forgetChildren(this).forEach(maybeReportOrphan);\n maybeUnsubscribe(this);\n\n // Because this entry has been kicked out of the cache (in index.js),\n // we've lost the ability to find out if/when this entry becomes dirty,\n // whether that happens through a subscription, because of a direct call\n // to entry.setDirty(), or because one of its children becomes dirty.\n // Because of this loss of future information, we have to assume the\n // worst (that this entry might have become dirty very soon), so we must\n // immediately mark this entry's parents as dirty. Normally we could\n // just call entry.setDirty() rather than calling parent.setDirty() for\n // each parent, but that would leave this entry in parent.childValues\n // and parent.dirtyChildren, which would prevent the child from being\n // truly forgotten.\n this.parents.forEach(parent => {\n parent.setDirty();\n forgetChild(parent, this);\n });\n }\n}\n\nfunction rememberParent(child: AnyEntry) {\n const parent = parentEntrySlot.getValue();\n if (parent) {\n child.parents.add(parent);\n\n if (! parent.childValues.has(child)) {\n parent.childValues.set(child, []);\n }\n\n if (mightBeDirty(child)) {\n reportDirtyChild(parent, child);\n } else {\n reportCleanChild(parent, child);\n }\n\n return parent;\n }\n}\n\nfunction reallyRecompute(entry: AnyEntry) {\n // Since this recomputation is likely to re-remember some of this\n // entry's children, we forget our children here but do not call\n // maybeReportOrphan until after the recomputation finishes.\n const originalChildren = forgetChildren(entry);\n\n // Set entry as the parent entry while calling recomputeNewValue(entry).\n parentEntrySlot.withValue(entry, recomputeNewValue, [entry]);\n\n if (maybeSubscribe(entry)) {\n // If we successfully recomputed entry.value and did not fail to\n // (re)subscribe, then this Entry is no longer explicitly dirty.\n setClean(entry);\n }\n\n // Now that we've had a chance to re-remember any children that were\n // involved in the recomputation, we can safely report any orphan\n // children that remain.\n originalChildren.forEach(maybeReportOrphan);\n\n return valueGet(entry.value);\n}\n\nfunction recomputeNewValue(entry: AnyEntry) {\n entry.recomputing = true;\n // Set entry.value as unknown.\n entry.value.length = 0;\n try {\n // If entry.fn succeeds, entry.value will become a normal Value.\n entry.value[0] = entry.fn.apply(null, entry.args);\n } catch (e) {\n // If entry.fn throws, entry.value will become exceptional.\n entry.value[1] = e;\n }\n // Either way, this line is always reached.\n entry.recomputing = false;\n}\n\nfunction mightBeDirty(entry: AnyEntry) {\n return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size);\n}\n\nfunction setClean(entry: AnyEntry) {\n entry.dirty = false;\n\n if (mightBeDirty(entry)) {\n // This Entry may still have dirty children, in which case we can't\n // let our parents know we're clean just yet.\n return;\n }\n\n reportClean(entry);\n}\n\nfunction reportDirty(child: AnyEntry) {\n child.parents.forEach(parent => reportDirtyChild(parent, child));\n}\n\nfunction reportClean(child: AnyEntry) {\n child.parents.forEach(parent => reportCleanChild(parent, child));\n}\n\n// Let a parent Entry know that one of its children may be dirty.\nfunction reportDirtyChild(parent: AnyEntry, child: AnyEntry) {\n // Must have called rememberParent(child) before calling\n // reportDirtyChild(parent, child).\n assert(parent.childValues.has(child));\n assert(mightBeDirty(child));\n\n if (! parent.dirtyChildren) {\n parent.dirtyChildren = emptySetPool.pop() || new Set;\n\n } else if (parent.dirtyChildren.has(child)) {\n // If we already know this child is dirty, then we must have already\n // informed our own parents that we are dirty, so we can terminate\n // the recursion early.\n return;\n }\n\n parent.dirtyChildren.add(child);\n reportDirty(parent);\n}\n\n// Let a parent Entry know that one of its children is no longer dirty.\nfunction reportCleanChild(parent: AnyEntry, child: AnyEntry) {\n // Must have called rememberChild(child) before calling\n // reportCleanChild(parent, child).\n assert(parent.childValues.has(child));\n assert(! mightBeDirty(child));\n\n const childValue = parent.childValues.get(child)!;\n if (childValue.length === 0) {\n parent.childValues.set(child, valueCopy(child.value));\n } else if (! valueIs(childValue, child.value)) {\n parent.setDirty();\n }\n\n removeDirtyChild(parent, child);\n\n if (mightBeDirty(parent)) {\n return;\n }\n\n reportClean(parent);\n}\n\nfunction removeDirtyChild(parent: AnyEntry, child: AnyEntry) {\n const dc = parent.dirtyChildren;\n if (dc) {\n dc.delete(child);\n if (dc.size === 0) {\n if (emptySetPool.length < POOL_TARGET_SIZE) {\n emptySetPool.push(dc);\n }\n parent.dirtyChildren = null;\n }\n }\n}\n\n// If the given entry has a reportOrphan method, and no remaining parents,\n// call entry.reportOrphan and return true iff it returns true. The\n// reportOrphan function should return true to indicate entry.dispose()\n// has been called, and the entry has been removed from any other caches\n// (see index.js for the only current example).\nfunction maybeReportOrphan(entry: AnyEntry) {\n return entry.parents.size === 0 &&\n typeof entry.reportOrphan === \"function\" &&\n entry.reportOrphan() === true;\n}\n\n// Removes all children from this entry and returns an array of the\n// removed children.\nfunction forgetChildren(parent: AnyEntry) {\n let children = reusableEmptyArray;\n\n if (parent.childValues.size > 0) {\n children = [];\n parent.childValues.forEach((_value, child) => {\n forgetChild(parent, child);\n children.push(child);\n });\n }\n\n // After we forget all our children, this.dirtyChildren must be empty\n // and therefore must have been reset to null.\n assert(parent.dirtyChildren === null);\n\n return children;\n}\n\nfunction forgetChild(parent: AnyEntry, child: AnyEntry) {\n child.parents.delete(parent);\n parent.childValues.delete(child);\n removeDirtyChild(parent, child);\n}\n\nfunction maybeSubscribe(entry: AnyEntry) {\n if (typeof entry.subscribe === \"function\") {\n try {\n maybeUnsubscribe(entry); // Prevent double subscriptions.\n entry.unsubscribe = entry.subscribe.apply(null, entry.args);\n } catch (e) {\n // If this Entry has a subscribe function and it threw an exception\n // (or an unsubscribe function it previously returned now throws),\n // return false to indicate that we were not able to subscribe (or\n // unsubscribe), and this Entry should remain dirty.\n entry.setDirty();\n return false;\n }\n }\n\n // Returning true indicates either that there was no entry.subscribe\n // function or that it succeeded.\n return true;\n}\n\nfunction maybeUnsubscribe(entry: AnyEntry) {\n const { unsubscribe } = entry;\n if (typeof unsubscribe === \"function\") {\n entry.unsubscribe = void 0;\n unsubscribe();\n }\n}\n","// A trie data structure that holds object keys weakly, yet can also hold\n// non-object keys, unlike the native `WeakMap`.\nexport class KeyTrie {\n // Since a `WeakMap` cannot hold primitive values as keys, we need a\n // backup `Map` instance to hold primitive keys. Both `this._weakMap`\n // and `this._strongMap` are lazily initialized.\n private weak?: WeakMap>;\n private strong?: Map>;\n private data?: K;\n\n constructor(private readonly weakness: boolean) {}\n\n public lookup(...array: T): K {\n return this.lookupArray(array);\n }\n\n public lookupArray(array: T): K {\n let node: KeyTrie = this;\n array.forEach(key => node = node.getChildTrie(key));\n return node.data || (node.data = Object.create(null));\n }\n\n private getChildTrie(key: any) {\n const map = this.weakness && isObjRef(key)\n ? this.weak || (this.weak = new WeakMap>())\n : this.strong || (this.strong = new Map>());\n let child = map.get(key);\n if (!child) map.set(key, child = new KeyTrie(this.weakness));\n return child;\n }\n}\n\nfunction isObjRef(value: any) {\n switch (typeof value) {\n case \"object\":\n if (value === null) break;\n // Fall through to return true...\n case \"function\":\n return true;\n }\n return false;\n}\n","import { Cache } from \"./cache\";\nimport { Entry, AnyEntry } from \"./entry\";\nimport { parentEntrySlot } from \"./context\";\nimport { KeyTrie } from \"./key-trie\";\n\n// These helper functions are important for making optimism work with\n// asynchronous code. In order to register parent-child dependencies,\n// optimism needs to know about any currently active parent computations.\n// In ordinary synchronous code, the parent context is implicit in the\n// execution stack, but asynchronous code requires some extra guidance in\n// order to propagate context from one async task segment to the next.\nexport {\n bindContext,\n noContext,\n setTimeout,\n asyncFromGen,\n} from \"./context\";\n\n// Since the Cache uses a Map internally, any value or object reference can\n// be safely used as a key, though common types include object and string.\nexport type TCacheKey = any;\n\n// The defaultMakeCacheKey function is remarkably powerful, because it gives\n// a unique object for any shallow-identical list of arguments. If you need\n// to implement a custom makeCacheKey function, you may find it helpful to\n// delegate the final work to defaultMakeCacheKey, which is why we export it\n// here. However, you may want to avoid defaultMakeCacheKey if your runtime\n// does not support WeakMap, or you have the ability to return a string key.\n// In those cases, just write your own custom makeCacheKey functions.\nconst keyTrie = new KeyTrie(typeof WeakMap === \"function\");\nexport function defaultMakeCacheKey(...args: any[]) {\n return keyTrie.lookupArray(args);\n}\n\n// If you're paranoid about memory leaks, or you want to avoid using WeakMap\n// under the hood, but you still need the behavior of defaultMakeCacheKey,\n// import this constructor to create your own tries.\nexport { KeyTrie }\n\nexport type OptimisticWrapperFunction<\n TArgs extends any[],\n TResult,\n> = ((...args: TArgs) => TResult) & {\n // The .dirty(...) method of an optimistic function takes exactly the\n // same parameter types as the original function.\n dirty: (...args: TArgs) => void;\n};\n\nexport type OptimisticWrapOptions = {\n // The maximum number of cache entries that should be retained before the\n // cache begins evicting the oldest ones.\n max?: number;\n // If a wrapped function is \"disposable,\" then its creator does not\n // care about its return value, and it should be removed from the cache\n // immediately when it no longer has any parents that depend on it.\n disposable?: boolean;\n // The makeCacheKey function takes the same arguments that were passed to\n // the wrapper function and returns a single value that can be used as a key\n // in a Map to identify the cached result.\n makeCacheKey?: (...args: TArgs) => TCacheKey;\n // If provided, the subscribe function should either return an unsubscribe\n // function or return nothing.\n subscribe?: (...args: TArgs) => (() => any) | undefined;\n};\n\nconst caches = new Set>();\n\nexport function wrap<\n TArgs extends any[],\n TResult,\n>(\n originalFunction: (...args: TArgs) => TResult,\n options: OptimisticWrapOptions = Object.create(null),\n) {\n const cache = new Cache>(\n options.max || Math.pow(2, 16),\n entry => entry.dispose(),\n );\n\n const disposable = !! options.disposable;\n const makeCacheKey = options.makeCacheKey || defaultMakeCacheKey;\n\n function optimistic(): TResult {\n if (disposable && ! parentEntrySlot.hasValue()) {\n // If there's no current parent computation, and this wrapped\n // function is disposable (meaning we don't care about entry.value,\n // just dependency tracking), then we can short-cut everything else\n // in this function, because entry.recompute() is going to recycle\n // the entry object without recomputing anything, anyway.\n return void 0 as any;\n }\n\n const key = makeCacheKey.apply(null, arguments as any);\n if (key === void 0) {\n return originalFunction.apply(null, arguments as any);\n }\n\n const args = Array.prototype.slice.call(arguments) as TArgs;\n\n let entry = cache.get(key);\n if (entry) {\n entry.args = args;\n } else {\n entry = new Entry(originalFunction, args);\n cache.set(key, entry);\n entry.subscribe = options.subscribe;\n if (disposable) {\n entry.reportOrphan = () => cache.delete(key);\n }\n }\n\n const value = entry.recompute();\n\n // Move this entry to the front of the least-recently used queue,\n // since we just finished computing its value.\n cache.set(key, entry);\n\n caches.add(cache);\n\n // Clean up any excess entries in the cache, but only if there is no\n // active parent entry, meaning we're not in the middle of a larger\n // computation that might be flummoxed by the cleaning.\n if (! parentEntrySlot.hasValue()) {\n caches.forEach(cache => cache.clean());\n caches.clear();\n }\n\n // If options.disposable is truthy, the caller of wrap is telling us\n // they don't care about the result of entry.recompute(), so we should\n // avoid returning the value, so it won't be accidentally used.\n return disposable ? void 0 as any : value;\n }\n\n optimistic.dirty = function () {\n const key = makeCacheKey.apply(null, arguments as any);\n const child = key !== void 0 && cache.get(key);\n if (child) {\n child.setDirty();\n }\n };\n\n return optimistic as OptimisticWrapperFunction;\n}\n"],"names":[],"mappings":";;;AAOA,SAAS,cAAc,MAAK;AAE5B;IAKE,eACU,GAAc,EACf,OAAoD;QADnD,oBAAA,EAAA,cAAc;QACf,wBAAA,EAAA,wBAAoD;QADnD,QAAG,GAAH,GAAG,CAAW;QACf,YAAO,GAAP,OAAO,CAA6C;QANrD,QAAG,GAAG,IAAI,GAAG,EAAiB,CAAC;QAC/B,WAAM,GAAsB,IAAI,CAAC;QACjC,WAAM,GAAsB,IAAI,CAAC;KAKrC;IAEG,mBAAG,GAAV,UAAW,GAAM;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAC1B;IAEM,mBAAG,GAAV,UAAW,GAAM;QACf,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACjC,OAAO,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC;KAC7B;IAEO,wBAAQ,GAAhB,UAAiB,GAAM;QACrB,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEhC,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE;YAC1B,IAAA,mBAAK,EAAE,mBAAK,CAAW;YAE/B,IAAI,KAAK,EAAE;gBACT,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;aACrB;YAED,IAAI,KAAK,EAAE;gBACT,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;aACrB;YAED,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;YAC1B,KAAK,CAAC,KAAM,CAAC,KAAK,GAAG,KAAK,CAAC;YAE3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ACjB,IAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC,CAAC;QACvD,IAAM,KAAK,GAAG,GAAG,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,QAAQ,EAAE,CAAC;SAClB;KACF,CAAC;IAEF,OAAO,UAAuD,CAAC;CAChE;;;;"} \ No newline at end of file diff --git a/node_modules/optimism/lib/cache.d.ts b/node_modules/optimism/lib/cache.d.ts deleted file mode 100644 index 5de86122..00000000 --- a/node_modules/optimism/lib/cache.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export declare class Cache { - private max; - dispose: (value: V, key: K) => void; - private map; - private newest; - private oldest; - constructor(max?: number, dispose?: (value: V, key: K) => void); - has(key: K): boolean; - get(key: K): void | V; - private getEntry; - set(key: K, value: V): V; - clean(): void; - delete(key: K): boolean; -} diff --git a/node_modules/optimism/lib/context.d.ts b/node_modules/optimism/lib/context.d.ts deleted file mode 100644 index f41db1df..00000000 --- a/node_modules/optimism/lib/context.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare const parentEntrySlot: { - readonly id: string; - hasValue(): boolean; - getValue(): import("./entry").Entry | undefined; - withValue(value: import("./entry").Entry, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult; -}; -export { bind as bindContext, noContext, setTimeout, asyncFromGen, } from "@wry/context"; diff --git a/node_modules/optimism/lib/entry.d.ts b/node_modules/optimism/lib/entry.d.ts deleted file mode 100644 index b647422e..00000000 --- a/node_modules/optimism/lib/entry.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { OptimisticWrapOptions } from "./index"; -declare type Value = [] | [T] | [void, any]; -export declare type AnyEntry = Entry; -export declare class Entry { - readonly fn: (...args: TArgs) => TValue; - args: TArgs; - static count: number; - subscribe: OptimisticWrapOptions["subscribe"]; - unsubscribe?: () => any; - reportOrphan?: (this: Entry) => any; - readonly parents: Set>; - readonly childValues: Map, Value>; - dirtyChildren: Set | null; - dirty: boolean; - recomputing: boolean; - readonly value: Value; - constructor(fn: (...args: TArgs) => TValue, args: TArgs); - recompute(): TValue; - setDirty(): void; - dispose(): void; -} -export {}; diff --git a/node_modules/optimism/lib/index.d.ts b/node_modules/optimism/lib/index.d.ts deleted file mode 100644 index a8215382..00000000 --- a/node_modules/optimism/lib/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { KeyTrie } from "./key-trie"; -export { bindContext, noContext, setTimeout, asyncFromGen, } from "./context"; -export declare type TCacheKey = any; -export declare function defaultMakeCacheKey(...args: any[]): any; -export { KeyTrie }; -export declare type OptimisticWrapperFunction = ((...args: TArgs) => TResult) & { - dirty: (...args: TArgs) => void; -}; -export declare type OptimisticWrapOptions = { - max?: number; - disposable?: boolean; - makeCacheKey?: (...args: TArgs) => TCacheKey; - subscribe?: (...args: TArgs) => (() => any) | undefined; -}; -export declare function wrap(originalFunction: (...args: TArgs) => TResult, options?: OptimisticWrapOptions): OptimisticWrapperFunction; diff --git a/node_modules/optimism/lib/key-trie.d.ts b/node_modules/optimism/lib/key-trie.d.ts deleted file mode 100644 index ffe171b2..00000000 --- a/node_modules/optimism/lib/key-trie.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export declare class KeyTrie { - private readonly weakness; - private weak?; - private strong?; - private data?; - constructor(weakness: boolean); - lookup(...array: T): K; - lookupArray(array: T): K; - private getChildTrie; -} diff --git a/node_modules/optimism/package.json b/node_modules/optimism/package.json deleted file mode 100644 index 24fc8d40..00000000 --- a/node_modules/optimism/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "_args": [ - [ - "optimism@0.10.3", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "optimism@0.10.3", - "_id": "optimism@0.10.3", - "_inBundle": false, - "_integrity": "sha512-9A5pqGoQk49H6Vhjb9kPgAeeECfUDF6aIICbMDL23kDLStBn1MWk3YvcZ4xWF9CsSf6XEgvRLkXy4xof/56vVw==", - "_location": "/optimism", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "optimism@0.10.3", - "name": "optimism", - "escapedName": "optimism", - "rawSpec": "0.10.3", - "saveSpec": null, - "fetchSpec": "0.10.3" - }, - "_requiredBy": [ - "/apollo-cache-inmemory" - ], - "_resolved": "https://registry.npmjs.org/optimism/-/optimism-0.10.3.tgz", - "_spec": "0.10.3", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Ben Newman", - "email": "ben@benjamn.com" - }, - "bugs": { - "url": "https://github.com/benjamn/optimism/issues" - }, - "dependencies": { - "@wry/context": "^0.4.0" - }, - "description": "Composable reactive caching with efficient invalidation.", - "devDependencies": { - "@types/mocha": "5.2.7", - "@types/node": "12.7.5", - "fibers": "4.0.1", - "mocha": "6.2.0", - "reify": "0.20.12", - "rimraf": "3.0.0", - "rollup": "1.21.2", - "rollup-plugin-typescript2": "0.24.2", - "source-map-support": "0.5.13", - "tslib": "1.10.0", - "typescript": "3.5.2" - }, - "homepage": "https://github.com/benjamn/optimism#readme", - "keywords": [ - "caching", - "cache", - "invalidation", - "reactive", - "reactivity", - "dependency", - "tracking", - "tracker", - "memoization" - ], - "license": "MIT", - "main": "lib/bundle.cjs.js", - "module": "lib/bundle.esm.js", - "name": "optimism", - "repository": { - "type": "git", - "url": "git+https://github.com/benjamn/optimism.git" - }, - "scripts": { - "build": "npm run clean && tsc --emitDeclarationOnly && rollup -c", - "clean": "rimraf lib", - "mocha": "mocha --require source-map-support/register --reporter spec --full-trace test.js", - "prepublish": "npm run build", - "test": "npm run build && npm run mocha" - }, - "types": "lib/index.d.ts", - "version": "0.10.3" -} diff --git a/node_modules/optimism/test.js b/node_modules/optimism/test.js deleted file mode 100644 index 6c909ce8..00000000 --- a/node_modules/optimism/test.js +++ /dev/null @@ -1,8 +0,0 @@ -describe("Compiled to CommonJS", function () { - require("./lib/tests/bundle.cjs.js"); -}); - -describe("Compiled to ECMAScript module syntax", function () { - require("reify/node"); // Enable ESM syntax. - require("./lib/tests/bundle.esm.js"); -}); diff --git a/node_modules/protobufjs/CHANGELOG.md b/node_modules/protobufjs/CHANGELOG.md deleted file mode 100644 index 54513ccd..00000000 --- a/node_modules/protobufjs/CHANGELOG.md +++ /dev/null @@ -1,991 +0,0 @@ -# Changelog - -### [6.10.2](https://www.github.com/protobufjs/protobuf.js/compare/v6.10.1...v6.10.2) (2020-11-13) - - -### Bug Fixes - -* es6 export enum ([#1446](https://www.github.com/protobufjs/protobuf.js/issues/1446)) ([9f33784](https://www.github.com/protobufjs/protobuf.js/commit/9f33784350b1efc2e774bbfc087cbd2c47828748)) -* make parsedOptions appear in method JSON representation ([#1506](https://www.github.com/protobufjs/protobuf.js/issues/1506)) ([3d29969](https://www.github.com/protobufjs/protobuf.js/commit/3d29969865f2119550d9dc88391846469da9fa7f)) -* utf8 -> utf16 decoding bug on surrogate pairs ([#1486](https://www.github.com/protobufjs/protobuf.js/issues/1486)) ([75172cd](https://www.github.com/protobufjs/protobuf.js/commit/75172cd11be137bbabd2fba7a02b15067695ebad)) - -### [6.10.1](https://www.github.com/protobufjs/protobuf.js/compare/v6.10.0...v6.10.1) (2020-07-16) - - -### Bug Fixes - -* make node detection a bit more forgiving ([#1445](https://www.github.com/protobufjs/protobuf.js/issues/1445)) ([4e75f6d](https://www.github.com/protobufjs/protobuf.js/commit/4e75f6de4a2e49f28c24b59107f262d472b68977)) - -## [6.10.0](https://www.github.com/protobufjs/protobuf.js/compare/v6.9.0...v6.10.0) (2020-07-13) - - -### Features - -* add configurable Root.prototype.fetch ([ad3cffd](https://www.github.com/protobufjs/protobuf.js/commit/ad3cffdc5a54a7c94830674270d3386e1a2b58fc)) -* better comment parse ([#1419](https://www.github.com/protobufjs/protobuf.js/issues/1419)) ([7fd2e18](https://www.github.com/protobufjs/protobuf.js/commit/7fd2e182150c9b6be9ba21e6450b6e4668ad9f82)) -* parsed options ([#1256](https://www.github.com/protobufjs/protobuf.js/issues/1256)) ([7a25398](https://www.github.com/protobufjs/protobuf.js/commit/7a2539843055b6daecb9f369c67a6cf588dbb54c)) - - -### Bug Fixes - -* allow Windows unc paths to be resolved and normalized ([#1351](https://www.github.com/protobufjs/protobuf.js/issues/1351)) ([cd4aeda](https://www.github.com/protobufjs/protobuf.js/commit/cd4aeda8036f80cfa3b9f1db4096d856b2fd05fb)) -* do not fail if no process ([#1440](https://www.github.com/protobufjs/protobuf.js/issues/1440)) ([f2faa8c](https://www.github.com/protobufjs/protobuf.js/commit/f2faa8c32e918b3b843005f0419608b8e158998d)) -* fix util.global ([#1441](https://www.github.com/protobufjs/protobuf.js/issues/1441)) ([742b8dc](https://www.github.com/protobufjs/protobuf.js/commit/742b8dcbc750f9c2659088cbd88ea61fd11b24a7)) -* google.protobuf.Any type_url fixes ([#1068](https://www.github.com/protobufjs/protobuf.js/issues/1068)) ([192f5f1](https://www.github.com/protobufjs/protobuf.js/commit/192f5f12d071fa534ac625290d4666c839a46a9e)) -* handling of map entries with omitted key or value ([#1348](https://www.github.com/protobufjs/protobuf.js/issues/1348)) ([b950877](https://www.github.com/protobufjs/protobuf.js/commit/b950877c86676399674821fca4cf444f046b5acb)) -* properly parse empty messages in options ([#1429](https://www.github.com/protobufjs/protobuf.js/issues/1429)) ([7fbc79f](https://www.github.com/protobufjs/protobuf.js/commit/7fbc79f11d89b263dafc8f332ccba59a8d181fca)) -* updated isNode check ([#1221](https://www.github.com/protobufjs/protobuf.js/issues/1221)) ([#1363](https://www.github.com/protobufjs/protobuf.js/issues/1363)) ([5564e7b](https://www.github.com/protobufjs/protobuf.js/commit/5564e7b5f07d3eab99762528e8ce88507af5a5a3)) - -## [6.9.0](https://www.github.com/protobufjs/protobuf.js/compare/6.8.8...v6.9.0) (2020-04-17) - - -### Features - -* add support for buffer configuration ([#1372](https://www.github.com/protobufjs/protobuf.js/issues/1372)) ([101aa1a](https://www.github.com/protobufjs/protobuf.js/commit/101aa1a4f148516fdc83a74f54a229f06e24a5de)) -* update dependencies / general cleanup ([#1356](https://www.github.com/protobufjs/protobuf.js/issues/1356)) ([42f49b4](https://www.github.com/protobufjs/protobuf.js/commit/42f49b43f692c24c2bc1ae081b4d1ad9fa173cd7)) - - -### Bug Fixes - -* allow file-level options everywhere in the file ([b70eebd](https://www.github.com/protobufjs/protobuf.js/commit/b70eebd86e113effaa7d13b24b19ee4a0cb9e1e5)) -* Import Long types ([1d98cb8](https://www.github.com/protobufjs/protobuf.js/commit/1d98cb86fcbc69bd54fb3d3254b348da6ac0a96b)) -* npm audit fixes ([ca52447](https://www.github.com/protobufjs/protobuf.js/commit/ca524478621bd2e08120eb444c7ad8089dba1929)) -* properly iterate and return method descriptors ([d96bb7a](https://www.github.com/protobufjs/protobuf.js/commit/d96bb7ae991ca7d5ef8eea3bca75a2089c6f1212)) -* run npm audit fix ([#1208](https://www.github.com/protobufjs/protobuf.js/issues/1208)) ([b5b6632](https://www.github.com/protobufjs/protobuf.js/commit/b5b66321762a24c5ac2753b68331cbe115969da7)) -* **docs:** update CHANGELOG to match format of release-please ([#1376](https://www.github.com/protobufjs/protobuf.js/issues/1376)) ([15ed8a0](https://www.github.com/protobufjs/protobuf.js/commit/15ed8a0fbe72b2e408b87ba25028f877796cc191)) - -## [6.8.8](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.8) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3001425b0d896d14188307cd0cc84ce195ad9e04) Persist recent index.d.ts changes in JSDoc
    - -## [6.8.7](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.7) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e8449c4bf1269a2cc423708db6f0b47a383d33f0) Fix package browser field descriptor ([#1046](https://github.com/protobufjs/protobuf.js/issues/1046))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/996b3fa0c598ecc73302bfc39208c44830f07b1a) Fix static codegen issues with uglifyjs3
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a06317139b92fdd8c6b3b188fb7b9704dc8ccbf1) Fix lint issues / pbts on windows
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a927a6646e8fdddebcb3e13bc8b28b041b3ee40a) Fix empty 'bytes' field decoding, now using Buffer where applicable ([#1020](https://github.com/protobufjs/protobuf.js/issues/1020))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f13a81fb41fbef2ce9dcee13f23b7276c83fbcfd) Fix circular dependency of Namespace and Enum ([#994](https://github.com/protobufjs/protobuf.js/issues/994))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c05c58fad61c16e5ce20ca19758e4782cdd5d2e3) Ignore optional commas in aggregate options ([#999](https://github.com/protobufjs/protobuf.js/issues/999))
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/36fc964b8db1e4372c76b1baf9f03857cd875b07) Make Message have a default type param ([#1086](https://github.com/protobufjs/protobuf.js/issues/1086))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/996b3fa0c598ecc73302bfc39208c44830f07b1a) Explicitly define service method names when generating static code, see [#857](https://github.com/protobufjs/protobuf.js/issues/857)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/07c5d59e1da8c5533a39007ba332928206281408) Also handle services in ext/descriptor ([#1001](https://github.com/protobufjs/protobuf.js/issues/1001))
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2c5ef95818a310243f88ffba0331cd47ee603c0a) Extend list of ignored ESLint rules for pbjs, fixes [#1085](https://github.com/protobufjs/protobuf.js/issues/1085)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8576b49ad3e55b8beae2a8f044c51040484eef12) Fix declared return type of pbjs/pbts callback ([#1025](https://github.com/protobufjs/protobuf.js/issues/1025))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9fceaa69667895e609a3ed78eb2efa7a0ecfb890) Added an option to pbts to allow custom imports ([#1038](https://github.com/protobufjs/protobuf.js/issues/1038))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/65d113b0079fa2570837f3cf95268ce24714a248) Get node executable path from process.execPath ([#1018](https://github.com/protobufjs/protobuf.js/issues/1018))
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b611875cfbc1f98d8973a2e86f1506de84f00049) Slim down CI testing and remove some not ultimately necesssary dependencies with audit issues
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/812b38ddabb35e154f9ff94f32ad8ce2a70310f1) Move global handling to util, see [#995](https://github.com/protobufjs/protobuf.js/issues/995)
    - -## [6.8.6](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.6) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2ee1028d631a328e152d7e09f2a0e0c5c83dc2aa) Fix typeRefRe being vulnerable to ReDoS
    - -## [6.8.5](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.6) - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/462132f222d8febb8211d839635aad5b82dc6315) Preserve comments when serializing/deserializing with toJSON and fromJSON. ([#983](https://github.com/protobufjs/protobuf.js/issues/983))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d29c0caa715a14214fc755b3cf10ac119cdaf199) Add more details to some frequent error messages ([#962](https://github.com/protobufjs/protobuf.js/issues/962))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8400f87ad8ed2b47e659bc8bb6c3cf2467802425) Add IParseOptions#alternateCommentMode ([#968](https://github.com/protobufjs/protobuf.js/issues/968))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d6e3b9e218896ec1910e02448b5ee87e4d96ede6) Added field_mask to built-in common wrappers ([#982](https://github.com/protobufjs/protobuf.js/issues/982))
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/635fef013fbb3523536d92c690ffd7d84829db35) Remove code climate config in order to use 'in-app' config instead
    - -## [6.8.4](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.4) - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/69440c023e6962c644715a0c95363ddf19db648f) Update jsdoc dependency (pinned vulnerable marked)
    - -## [6.8.3](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.3) - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cc991a058b0636f3454166c76de7b664cf23a8f4) Use correct safeProp in json-module target, see [#956](https://github.com/protobufjs/protobuf.js/issues/956)
    - -## [6.8.2](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.2) - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6fc6481d790648e9e2169a961ad31a732398c911) Include dist files in npm package, see [#955](https://github.com/protobufjs/protobuf.js/issues/955)
    - -## [6.8.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.1) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/db2dd49f6aab6ecd606eee334b95cc0969e483c2) Prevent invalid JSDoc names when generating service methods, see [#870](https://github.com/protobufjs/protobuf.js/issues/870)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/62297998d681357ada70fb370b99bac5573e5054) Prevent parse errors when generating service method names, see [#870](https://github.com/protobufjs/protobuf.js/issues/870)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/478f332e0fc1d0c318a70b1514b1d59c8c200c37) Support parsing nested option-values with or without ':' ([#951](https://github.com/protobufjs/protobuf.js/issues/951), fixes [#946](https://github.com/protobufjs/protobuf.js/issues/946))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/83477ca8e0e1f814ac79a642ea656f047563613a) Add support for reserved keyword in enums ([#950](https://github.com/protobufjs/protobuf.js/issues/950), fixes [#949](https://github.com/protobufjs/protobuf.js/issues/949))
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c482a5b76fd57769eae4308793e3ff8725264664) Unified safe property escapes and added a test for [#834](https://github.com/protobufjs/protobuf.js/issues/834)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1724581c36ecc4fc166ea14a9dd57af5e093a467) Fix codegen if type name starts with "Object"
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/adecd544c5fcbeba28d502645f895024e3552970) Fixed dependency for json-module to use "light".
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2a8dd74fca70d4e6fb41328a7cee81d1d50ad7ad) Basic support for URL prefixes in google.protobuf.Any types.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/be78a3d9bc8d9618950c77f9e261b422670042ce) fixed 'error is not defined linter warning when using static/static-module and es6
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c712447b309ae81134c7afd60f8dfa5ecd3be230) Fixed wrong type_url for any type (no leading '.' allowed).
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/145bda25ee1de2c0678ce7b8a093669ec2526b1d) Fixed fromObject() for google.protobuf.Any types.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7dec43d9d847481ad93fca498fd970b3a4a14b11) Handle case where 'extendee' is undefined in ext/descriptor
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/20a26271423319085d321878edc5166a5449e68a) Sanitize CR-only line endings (coming from jsdoc?)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/19d2af12b5db5a0f668f50b0cae3ee0f8a7affc2) Make sure enum typings become generated ([#884](https://github.com/protobufjs/protobuf.js/issues/884) didn't solve this)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a2c72c08b0265b112d367fa3d33407ff0de955b9) Remove exclude and include patterns from jsdoc config
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9afb8a2ff27c1e0a999d7331f3f65f568f5cced5) Skip defaults when generating proto3
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/952c7d1b478cc7c6de82475a17a1387992e8651f) Wait for both the 'end' and 'close' event to happen before finishing in pbts, see [#863](https://github.com/protobufjs/protobuf.js/issues/863)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ed7e2e71f5cde27c4128f4f2e3f4782cc51fbec7) Accept null for optional fields in generated static code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/27cc66a539251216ef10aea04652d58113949df9) Annotate TS classes with @implements
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/05e7e0636727008c72549459b8594fa0442d346f) Annotate virtual oneofs as string literal unions
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/685adb0e7ef0f50e4b93a105013547884957cc98) Also check for reserved ids and names in enums
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/843d0d5b927968025ca11babff28495dd3bb2863) Also support 'reserved' in enum descriptors
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a8376b57fb0a858adff9dc8a1d1b5372eff9d85c) Include just relevant files in npm package, fixes [#781](https://github.com/protobufjs/protobuf.js/issues/781)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/bda1bc6917c681516f6be8be8f0e84ba1262c4ce) Fix travis build
    - -## [6.8.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.8.0) - -### Breaking -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ff858003f525db542cbb270777b6fab3a230c9bb) Replaced Buffer and Long types with interfaces and removed stubs
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/22f907c49adbbdf09b72bde5299271dbe0ee9cbe) Removed Message#toObject in favor of having just the static version (unnecessary static code otherwise)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c97b61811248df002f1fb93557b982bc0aa27309) Everything uses interfaces now instead of typedefs (SomethingProperties is now ISomething)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b9f179064f3ddf683f13e0d4e17840301be64010) ReflectionObject#toJSON properly omits explicit undefined values
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7a6f98b5e74f9e9142f9be3ba0683caeaff916c4) Initial implementation of TypeScript decorators
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7a6f98b5e74f9e9142f9be3ba0683caeaff916c4) Refactored protobuf.Class away
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7a6f98b5e74f9e9142f9be3ba0683caeaff916c4) TypeScript definitions now have (a lot of) generics
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7a6f98b5e74f9e9142f9be3ba0683caeaff916c4) Removed deprecated features
    - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c306d19d806eb697913ffa2b8613f650127a4c50) Added 'undefined' besides 'null' as a valid value of an optional field, fixes [#826](https://github.com/protobufjs/protobuf.js/issues/826)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c5518c3bac0da9c2045e6f1baf0dee915afb4221) Fixed an issue with codegen typings, see [#819](https://github.com/protobufjs/protobuf.js/issues/819)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/66d149e92ff1baddfdfd4b6a88ca9bcea6fc6195) Ported utf8 chunking mechanism to base64 as well, fixes [#800](https://github.com/protobufjs/protobuf.js/issues/800)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e1f9d9856c98a0f0eb1aa8bdf4ac0df467bee8b9) Also be more verbose when defining properties for ES6, fixes [#820](https://github.com/protobufjs/protobuf.js/issues/820)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cf36097305ab02047be5014eabeccc3154e18bde) Generate more verbose JSDoc comments for ES6 support, fixes [#820](https://github.com/protobufjs/protobuf.js/issues/820)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f2959795330966f13cb65bbb6034c88a01fc0bcc) Emit a maximum of one error var when generating verifiers, fixes [#786](https://github.com/protobufjs/protobuf.js/issues/786)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3b848a10b39c1897ca1ea3b5149ef72ae43fcd11) Fixed missing semicolon after 'extensions' and 'reserved' when generating proto files, fixes [#810](https://github.com/protobufjs/protobuf.js/issues/810)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/eb1b40497e14a09facbc370676f486bed1376f52) Call npm with '--no-bin-links' when installing CLI deps, fixes [#823](https://github.com/protobufjs/protobuf.js/issues/823)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/429de19d851477f1df2804d5bc0be30228cd0924) Fix Reader argument conversion in static module
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/03194c203d6ff61ae825e66f8a29ca204fa503b9) Use JSDoc, they said, it documents code, they said. Fixes [#770](https://github.com/protobufjs/protobuf.js/issues/770)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ec6a133ff541c638517e00f47b772990207c8640) parser should not confuse previous trailing line comments with comments for the next declaration, see [#762](https://github.com/protobufjs/protobuf.js/issues/762)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0589ace4dc9e5c565ff996cf6e6bf94e63f43c4e) Types should not clear constructor with cache (fixes decorators)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/056ecc3834a3b323aaaa676957efcbe3f52365a0) Namespace#lookup should also check in nested namespaces (wtf)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ed34b093839652db2ff7b84db87857fc57d96038) Reader#bytes should also support plain arrays
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/514afcfa890aa598e93254576c4fd6062e0eff3b) Fix markdown for pipe in code in table
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/17c2797592bc4effd9aaae3ba9777c9550bb75ac) Upgrade to codegen 2
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/57d7d35ddbb9e3a28c396b4ef1ae3b150eeb8035) ext/descriptor enables interoperability between reflection and descriptor.proto (experimental), see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3939667ef1f37b025bd7f9476015890496d50e00) Added 'json' conversion option for proto3 JSON mapping compatibility of NaN and Infinity + additional documentation of util.toJSONOptions, see [#351](https://github.com/protobufjs/protobuf.js/issues/351)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4eac28c7d3acefb0af7b82c62cf8d19bf3e7d37b) Use protobuf/minimal when pbjs target is static-module
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3a959453fe63706c38ebbacda208e1f25f27dc99) Added closure wrapper
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/13bf9c2635e6a1a2711670fc8e28ae9d7b8d1c8f) Various improvements to statically generated JSDoc, also fixes [#772](https://github.com/protobufjs/protobuf.js/issues/772)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ffdc93c7cf7c8a716316b00864ea7c510e05b0c8) Check incompatible properties for namespaces only in tsd-jsdoc
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fb3f9c70436d4f81bcd0bf62b71af4d253390e4f) Additional tsd-jsdoc handling of properties inside of namespaces and TS specific API exposure
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2dcae25c99e2ed8afd01e27d21b106633b8c31b9) Several improvements to tsd-jsdoc emitted comments
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ff858003f525db542cbb270777b6fab3a230c9bb) Further TypeScript definition improvements
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/22f907c49adbbdf09b72bde5299271dbe0ee9cbe) Relieved tsd files from unnecessary comments
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/22f907c49adbbdf09b72bde5299271dbe0ee9cbe) Generate TS namespaces for vars and functions with properties
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b355115e619c6595ac9d91897cfe628ef0e46054) Prefer @tstype over @type when generating typedefs (tsd-jsdoc)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/23f4b990375efcac2c144592cf4ca558722dcf2d) Replaced nullable types with explicit type|null for better tooling compatibility, also fixes [#766](https://github.com/protobufjs/protobuf.js/issues/766) and fixes 767
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6493f52013c92a34b8305a25068ec7b8c4c29d54) Added more info to ext/descriptor README, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ef92da3768d8746dbfe72e77232f78b879fc811d) Additional notes on ext/descriptor
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b646cf7499791a41b75eef2de1a80fb558d4159e) Updated CHANGELOG so everyone knows what's going on (and soon, breaking)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/35a663757efe188bea552aef017837bc6c6a481a) Additional docs on TS/decorators usage
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9726be0888a9461721447677e9dece16a682b9f6) Updated dist files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9726be0888a9461721447677e9dece16a682b9f6) Added package-lock.json
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/114f7ea9fa3813003afc3ebb453b2dd2262808e1) Minor formatting
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8a6e464954b472fdbb4d46d9270fe3b4b3c7272d) Generate files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/42f8a97630bcb30d197b0f1d6cbdd96879d27f96) Remove the no-constructor arg
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6446247cd7edbb77f03dc42c557f568811286a39) Remove the ctor option.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2059ee0f6f951575d5c5d2dc5eb06b6fa34e27aa) Add support to generate types for JSON object.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7445da0f8cb2e450eff17723f25f366daaf3bbbb) aspromise performance pass
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3f8b74ba6726567eaf68c4d447c120f75eac042f) codegen 2 performance pass, [#653](https://github.com/protobufjs/protobuf.js/issues/653) might benefit
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d44a7eec2fd393e5cb24196fb5818c8c278a0f34) Fixed minimal library including reflection functionality
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a18e6db9f02696c66032bce7ef4c0eb0568a8048) Minor compression ratio tuning
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b49a4edd38395e209bedac2e0bfb7b9d5c4e980b) Fixed failing test case + coverage
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8f7111cacd236501b7e26791b9747b1974a2d9eb) Improved fromObject wrapper for google.protobuf.Any.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0e471a2516bde3cd3c27b2691afa0dcfbb01f042) Fixed failing tokenize test case
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5867f076d8510fa97e3bd6642bbe61960f7fd196) Removed debug build, made it an extension
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/22f907c49adbbdf09b72bde5299271dbe0ee9cbe) Regenerated dist files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5bc3541d2da19e2857dc884f743d37c27e8e21f2) Even more documentation and typings for ext/descriptor
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/773e6347b57e4a5236b1ef0bb8d361e4b233caf7) ext/descriptor docs
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/773e6347b57e4a5236b1ef0bb8d361e4b233caf7) Decorators coverage
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9a23ded94729ceeea2f87cb7e8460eaaaf1c8269) ext/descriptor support for various standard options, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2d8ce6ec0abd261f9b261a44a0a258fdf57ecec3) ext/descriptor passes descriptor.proto test with no differences, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3a20968c6d676312e4f2a510f7e079e0e0819daf) Properly remove unnecessary (packed) options from JSON descriptors
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2a30df8bd5f20d91143a38c2232dafc3a6f3a7bd) Use typedefs in ext/descriptor (like everywhere else), see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1fc911cef01e081c04fb82ead685f49dde1403bb) Fixed obvious issues with ext/descriptor, does not throw anymore when throwing descriptor.proto itself at it, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6c37dbd14f39dad687f2f89f1558a875f7dcc882) Added still missing root traversal to ext/descriptor, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7ab136daa5eb2769b616b6b7522e45a4e33a59f6) Initial map fields support for ext/descriptor, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/708552bb84508364b6e6fdf73906aa69e83854e1) Added infrastructure for TypeScript support of extensions
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/23f26defa793b371c16b5f920fbacb3fb66bdf22) TypeScript generics improvements
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e49bef863c0fb10257ec1001a3c5561755f2ec6b) More ext/descriptor progress, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6b94336c1e6eec0f2eb1bd5dca73a7a8e71a2153) Just export the relevant namespace in ext/descriptor
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fbb99489ed0c095174feff8f53431d30fb6c34a0) Initial descriptor.proto extension for reflection interoperability, see [#757](https://github.com/protobufjs/protobuf.js/issues/757)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/48e66d975bf7b4e6bdbb68ec24386c98b16c54c5) Moved custom wrappers to its own module instead, also makes the API easier to use manually, see [#677](https://github.com/protobufjs/protobuf.js/issues/677)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0c6e639d08fdf9be12677bf678563ea631bafb2c) Added infrastructure for custom wrapping/unwrapping of special types, see [#677](https://github.com/protobufjs/protobuf.js/issues/677)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0425b584f49841d87a8249fef30c78cc31c1c742) More decorator progress (MapField.d, optional Type.d)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7a6f98b5e74f9e9142f9be3ba0683caeaff916c4) tsd-jsdoc now has limited generics support
    - -## [6.7.3](https://github.com/protobufjs/protobuf.js/releases/tag/6.7.3) - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/57f1da64945f2dc5537c6eaa53e08e8fdd477b67) long, @types/long and @types/node are just dependencies, see [#753](https://github.com/protobufjs/protobuf.js/issues/753)
    - -## [6.7.2](https://github.com/protobufjs/protobuf.js/releases/tag/6.7.2) - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a7621be0a56585defc72d863f4e891e476905692) Split up NamespaceDescriptor to make nested plain namespaces a thing, see [#749](https://github.com/protobufjs/protobuf.js/issues/749)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e980e72ae3d4697ef0426c8a51608d31f516a2c4) More README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1f76749d0b9a780c7b6cb56be304f7327d74ebdb) Replaced 'runtime message' with 'message instance' for clarity
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e6b6dedb550edbd0e54e212799e42aae2f1a87f1) Rephrased the Usage section around the concept of valid messages
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0d8100ba87be768ebdec834ca2759693e0bf4325) Added toolset diagram to README
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3405ae8d1ea775c96c30d1ef5cde666c9c7341b3) Touched benchmark output metrics once more
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e36b228f4bb8b1cd835bf31f8605b759a7f1f501) Fixed failing browser test
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7b3bdb562ee7d30c1a557d7b7851d55de3091da4) Output more human friendly metrics from benchmark
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/59e447889057c4575f383630942fd308a35c12e6) Stripped down static bench code to what's necessary
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f88dad098282ece65f5d6e224ca38305a8431829) Revamped benchmark, now also covers Google's JS implementation
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/45356be81ba7796faee0d4d8ad324abdd9f301fb) Updated dependencies and dist files
    - -## [6.7.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.7.1) - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3d23eed6f7c79007969672f06c1a9ccd691e2411) Made .verify behave more like .encode, see [#710](https://github.com/protobufjs/protobuf.js/issues/710)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/bed514290c105c3b606f760f2abba80510721c77) With null/undefined eliminated by constructors and .create, document message fields as non-optional where applicable (ideally used with TS & strictNullChecks), see [#743](https://github.com/protobufjs/protobuf.js/issues/743)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/007b2329842679ddf994df7ec0f9c70e73ee3caf) Renamed --strict-long/message to --force-long/message with backward compatible aliases, see [#741](https://github.com/protobufjs/protobuf.js/issues/741)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6aae71f75e82ffd899869b0c952daf98991421b8) Keep $Properties with --strict-message but require actual instances within, see [#741](https://github.com/protobufjs/protobuf.js/issues/741)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c812cef0eff26998f14c9d58d4486464ad7b2bbc) Added --strict-message option to pbjs to strictly reference message instances instead of $Properties, see [#741](https://github.com/protobufjs/protobuf.js/issues/741)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/412407de9afb7ec3a999c4c9a3a1f388f971fce7) Restructured README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1c4d9d7f024bfa096ddc24aabbdf39211ed8637a) Added more information on typings usage, see [#744](https://github.com/protobufjs/protobuf.js/issues/744)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/602065e16862751c515c2f3391ee8b880e8140b1) Clarified typescript example in README, see [#744](https://github.com/protobufjs/protobuf.js/issues/744)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/79d0ba2cc71a156910a9d937683af164df694f08) Clarified that the service API targets clients consuming a service, see [#742](https://github.com/protobufjs/protobuf.js/issues/742)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a66f76452ba050088efd1aaebf3c503a55e6287c) Omit copying of undefined or null in constructors and .create, see [#743](https://github.com/protobufjs/protobuf.js/issues/743)
    - -## [6.7.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.7.0) - -### Breaking -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9c1bbf10e445c3495b23a354f9cbee951b4b20f0) Namespace#lookupEnum should actually look up the reflected enum and not just its values
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/44a8d3af5da578c2e6bbe0a1b948d469bbe27ca1) Decoder now throws if required fields are missing, see [#695](https://github.com/protobufjs/protobuf.js/issues/695) / [#696](https://github.com/protobufjs/protobuf.js/issues/696)
    - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d1e3122e326480fdd44e96afd76ee72e9744b246) Added functionality to filter for multiple types at once in lookup(), used by lookupTypeOrEnum(), fixes [#740](https://github.com/protobufjs/protobuf.js/issues/740)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8aa21268aa5e0f568cb39e99a83b99ccb4084381) Ensure that fields have been resolved when looking up js types in static target, see [#731](https://github.com/protobufjs/protobuf.js/issues/731)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f755d36829b9f1effd7960fab3a86a141aeb9fea) Properly copy fields array before sorting in toObject, fixes [#729](https://github.com/protobufjs/protobuf.js/issues/729)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a06691f5b87f7e90fed0115b78ce6febc4479206) Actually emit TS compatible enums in static target if not aliases, see [#720](https://github.com/protobufjs/protobuf.js/issues/720)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b01bb58dec92ebf6950846d9b8d8e3df5442b15d) Hardened tokenize/parse, esp. comment parsing, see [#713](https://github.com/protobufjs/protobuf.js/issues/713)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/bc76ad732fc0689cb0a2aeeb91b06ec5331d7972) Exclude any fields part of some oneof when populating defaults in toObject, see [#710](https://github.com/protobufjs/protobuf.js/issues/710)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/68cdb5f11fdbb950623be089f98e1356cb7b1ea3) Most of the parser is not case insensitive, see [#705](https://github.com/protobufjs/protobuf.js/issues/705)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3e930b907a834a7da759478b8d3f52fef1da22d8) Retain options argument in Root#load when used with promises, see [#684](https://github.com/protobufjs/protobuf.js/issues/684)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3c14ef42b3c8f2fef2d96d65d6e288211f86c9ef) Created a micromodule from (currently still bundled) float support
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7ecae9e9f2e1324ef72bf5073463e01deff50cd6) util.isset(obj, prop) can be used to test if a message property is considered to be set, see [#728](https://github.com/protobufjs/protobuf.js/issues/728)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c04d4a5ab8f91899bd3e1b17fe4407370ef8abb7) Implemented stubs for long.js / node buffers to be used where either one isn't wanted, see [#718](https://github.com/protobufjs/protobuf.js/issues/718)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b9574ad02521a31ebd509cdaa269e7807da78d7c) Simplified reusing / replacing internal constructors
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1f97b7af05b49ef69bd6e9d54906d1b7583f42c4) Constructors/.create always initialize proper mutable objects/arrays, see [#700](https://github.com/protobufjs/protobuf.js/issues/700)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/adb4bb001a894dd8d00bcfe03457497eb994f6ba) Verifiers return an error if multiple fields part of the same oneof are set, see [#710](https://github.com/protobufjs/protobuf.js/issues/710)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fe93d436b430d01b563318bff591e0dd408c06a4) Added `oneofs: true` to ConversionOptions, see [#710](https://github.com/protobufjs/protobuf.js/issues/710)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/228c882410d47a26576f839b15f1601e8aa7914d) Optional fields handle null just like undefined regardless of type see [#709](https://github.com/protobufjs/protobuf.js/issues/709)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/da6af8138afa5343a47c12a8beedb99889c0dd51) Encoders no longer examine virtual oneof properties but encode whatever is present, see [#710](https://github.com/protobufjs/protobuf.js/issues/710)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ac26a7aa60359a37dbddaad139c0134b592b3325) pbjs now generates multiple exports when using ES6 syntax, see [#686](https://github.com/protobufjs/protobuf.js/issues/686)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c1ca65dc6987384af6f9fac2fbd7700fcf5765b2) Sequentially serialize fields ordered by id, as of the spec.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/26d9fadb21a85ca0b5609156c26453ae875e4933) decode throws specific ProtocolError with a reference to the so far decoded message if required fields are missing + example
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2b5577b238a452ae86aa395fb2ad3a3f45d755dc) Reader.create asserts that `buffer` is a valid buffer, see [#695](https://github.com/protobufjs/protobuf.js/issues/695)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6f74d30f059e33a4678f28e7a50dc4878c54bed2) Exclude JSDoc on typedefs from generated d.ts files because typescript@next, see [#737](https://github.com/protobufjs/protobuf.js/issues/737)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2ebb1b781812e77de914cd260e7ab69612ffd99e) Prepare static code with estraverse instead of regular expressions, see [#732](https://github.com/protobufjs/protobuf.js/issues/732)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/29ce6cae0cacc0f1d87ca47e64be6a81325aaa55) Moved tsd-jsdoc to future cli package, see [#716](https://github.com/protobufjs/protobuf.js/issues/716)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8de21e1a947ddb50a167147dd63ad29d37b6a891) $Properties are just a type that's satisfied, not implemented, by classes, see [#723](https://github.com/protobufjs/protobuf.js/issues/723)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4bfe0c239b9c337f8fa64ea64f6a71baf5639b84) More progress on decoupling the CLI
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8a60174932d15198883ac3f07000ab4e7179a695) Fixed computed array indexes not being renamed in static code, see [#726](https://github.com/protobufjs/protobuf.js/issues/726)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8d9981588d17709791846de63f1f3bfd09433b03) Check upfront if key-var is required in static decoders with maps, see [#726](https://github.com/protobufjs/protobuf.js/issues/726)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/16adff0c7b67c69a2133b6aac375365c5f2bdbf7) Fixed handling of stdout if callback is specified, see [#724](https://github.com/protobufjs/protobuf.js/issues/724)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6423a419fe45e648593833bf535ba1736b31ef63) Preparations for moving the CLI to its own package, see [#716](https://github.com/protobufjs/protobuf.js/issues/716)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/afefa3de09620f50346bdcfa04d52952824c3c8d) Properly implement $Properties interface in JSDoc, see [#723](https://github.com/protobufjs/protobuf.js/issues/723)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a1f23e09fb5635275bb7646dfafc70caef74c6b8) Recursively use $Properties inside of $Properties in static code, see [#717](https://github.com/protobufjs/protobuf.js/issues/717)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c3f0a2124c661bb9ba35f92c21a98a4405d30b47) Added --strict-long option to pbjs to always emit 'Long' instead of 'number|Long' (only relevant with long.js), see [#718](https://github.com/protobufjs/protobuf.js/issues/718)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0bc4a14501f84f93afd6ce2933ad00749c82f4df) Statically emitted long type is 'Long' now instead of '$protobuf.Long', see [#718](https://github.com/protobufjs/protobuf.js/issues/718)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a75625d176b7478e0e506f05e2cee5e3d7a0d89a) Decoupled message properties as an interface in static code for TS intellisense support, see [#717](https://github.com/protobufjs/protobuf.js/issues/717)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/23f14a61e8c2f68b06d1bb4ed20b938764c78860) Static code statically resolves types[..], see [#715](https://github.com/protobufjs/protobuf.js/issues/715)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ef71e77726b6bf5978b948d598c18bf8b237ade4) Added type definitions for all possible JSON descriptors
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4bfe0c239b9c337f8fa64ea64f6a71baf5639b84) Explained the JSON structure in README and moved CLI specific information to the CLI package
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3ba3ad762f7486b4806ad1c45764e92a81ca24dd) Added information on how to use the stubs to README, see [#718](https://github.com/protobufjs/protobuf.js/issues/718)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a5dbba41341bf44876cd4226f08044f88148f37d) Added 'What is a valid message' section to README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6f8f2c1fdf92e6f81363d77bc059820b2376fe32) Added a hint on using .create to initial example
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3ad28ec920e0fe8d0223db28804a7b3f8a6880c2) Even more usage for README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5a1f861a0f6b582faae7a4cc5c6ca7e4418086da) Additional information on general usage (README)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/320dea5a1d1387c72759e10a17afd77dc48c3de0) Restructured README to Installation, Usage and Examples sections
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1c9055dd69f7696d2582942b307a1ac8ac0f5533) Added a longish section on the correct use of the toolset to README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/99667c8e1ff0fd3dac83ce8c0cff5d0b1e347310) Added a few additional notes on core methods to README, see [#710](https://github.com/protobufjs/protobuf.js/issues/710)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2130bc97e44567e766ea8efacb365383c909dbd4) Extended traverse-types example, see [#693](https://github.com/protobufjs/protobuf.js/issues/693)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/13e4aa3ff274ab42f1302e16fd59d074c5587b5b) Better explain how .verify, .encode and .decode are connected
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7502dd2dfdaea111e5c1a902c524ad0a51ff9bd4) Documented that Type#encode respectively Message.encode do not implicitly .verify, see [#696](https://github.com/protobufjs/protobuf.js/issues/696) [ci-skip]
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e7e123aa0b6c05eb4156a761739e37c008a3cbc1) Documented throwing behavior of Reader.create and Message.decode
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0fcde32306da77f02cb1ea81ed18a32cee01f17b) Added error handling notes to README, see [#696](https://github.com/protobufjs/protobuf.js/issues/696)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fef924e5f708f14dac5713aedc484535d36bfb47) Use @protobufjs/float
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fef924e5f708f14dac5713aedc484535d36bfb47) Rebuilt dist files for 6.7.0
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ca0dce2d7f34cd45e4c1cc753a97c58e05b3b9d2) Updated deps, ts fixes and regenerated dist files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2c2d4002d6776f3edde608bd813c37d798d87e6b) Manually merged gentests improvements, fixes [#733](https://github.com/protobufjs/protobuf.js/issues/733)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e4a6b6f81fa492a63b12f0da0c381612deff1973) Make sure that util.Long is overridden by AMD loaders only if present, see [#730](https://github.com/protobufjs/protobuf.js/issues/730)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fff1eb297a728ed6d334c591e7d796636859aa9a) Coverage for util.isset and service as a namespace
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8401a47d030214a54b5ee30426ebc7a9d9c3773d) Shortened !== undefined && !== null to equivalent != null in static code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e1dd1bc2667de73bb65d876162131be2a4d9fef4) With stubs in place, 'number|Long' return values can be just 'Long' instead, see [#718](https://github.com/protobufjs/protobuf.js/issues/718)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/404ba8e03a63f708a70a72f0208e0ca9826fe20b) Just alias as the actual ideal type when using stubs, see [#718](https://github.com/protobufjs/protobuf.js/issues/718)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/270cc94c7c4b8ad84d19498672bfc854b55130c9) General cleanup + regenerated dist/test files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/017161ce97ceef3b2d0ce648651a4636f187d78b) Simplified camel case regex, see [#714](https://github.com/protobufjs/protobuf.js/issues/714)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d410fd20f35d2a35eb314783b17b6570a40a99e8) Regenerated dist files and changelog for 6.7.0
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/88ca8f0d1eb334646ca2625c78e63fdd57221408) Retain alias order in static code for what it's worth, see [#712](https://github.com/protobufjs/protobuf.js/issues/712)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2a74fbf551e934b3212273e6a28ad65ac4436faf) Everything can be block- or line-style when parsing, see [#713](https://github.com/protobufjs/protobuf.js/issues/713)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/47bb95a31784b935b9ced52aa773b9d66236105e) Determine necessary aliases depending on config, see [#712](https://github.com/protobufjs/protobuf.js/issues/712)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/588ffd9b129869de0abcef1d69bfa18f2f25d8e1) Use more precise types for message-like plain objects
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/37b39c8d1a5307eea09aa24d7fd9233a8df5b7b6) Regenerated dist files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9c94813f9a5f1eb114d7c6112f7e87cb116fe9da) Regenerated relevant files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d7493efe1a86a60f6cdcf7976523e69523d3f7a3) Moved field comparer to util
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fe917652f88df17d4dbaae1cd74f470385342be2) Updated tests to use new simplified encoder logic
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b69173b4e7b514c40bb4a85b54ca5465492a235b) Updated path to tsd-jsdoc template used by pbts, see [#707](https://github.com/protobufjs/protobuf.js/issues/707)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5041fad9defdb0bc8131560e92f3b454d8e45273) Additional restructuring for moving configuration files out of the root folder
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c0b7c9fa6309d345c4ce8e06fd86f27528f4ea66) Added codegen support for constructor functions, see [#700](https://github.com/protobufjs/protobuf.js/issues/700)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4573f9aabd7e8f883e530f4d0b055e5ec9b75219) Attempted to fix broken custom error test
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4b49f500fce156b164c757d8f17be2338f767c82) Trying out a more aggressive aproach for custom error subclasses
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/95cd64ee514dc60d10daac5180726ff39594e8e8) Moved a few things out of the root folder
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/db1030ed257f9699a0bcf3bad0bbe8acccf5d766) Coverage for encoder compat. / protocolerror
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/948a4caf5092453fa091ac7a594ccd1cc5b503d2) Updated dist and generated test files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3ead13e83ecdc8715fbab916f7ccaf3fbfdf59ed) Added tslint
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/364e7d457ed4c11328e609f600a57b7bc4888554) Exclude dist/ from codeclimate checks
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6e81fcb05f25386e3997399e6596e9d9414f0286) Also lint cli utilities
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e7e123aa0b6c05eb4156a761739e37c008a3cbc1) Cache any regexp instance (perf)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d89c45f8af0293fb34e6f12b37ceca49083e1faa) Use code climate badges
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e70fbe3492c37f009dbaccf910c1e0f81e8f0f44) Updated travis to pipe to codeclimate, coverage
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a7ab1036906bb7638193a9e991cb62c86108880a) More precise linter configuration
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/58688c178257051ceb2dfea8a63eb6be7dcf1cf1) Added codeclimate
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4b21e00adc6fae42e6a88deaeb0b7c077c6ca50e) Moved cli deps placeholder creation to post install script
    - -## [6.6.5](https://github.com/protobufjs/protobuf.js/releases/tag/6.6.5) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/478ee51194878f24be8607e42e5259952607bd44) sfixed64 is not zig-zag encoded, see [#692](https://github.com/protobufjs/protobuf.js/issues/692)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7a944538c89492abbed147915acea611f11c03a2) Added a placeholder to cli deps node_modules folder to make sure node can load from it
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/83142e420eb1167b2162063a092ae8d89c9dd4b2) Restructured a few failing tests
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/367d55523a3ae88f21d47aa96447ec3e943d4620) Traversal example + minimalistic documentation
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8eeffcbcd027c929e2a76accad588c61dfa2e37c) Added a custom getters/setters example for gRPC
    - -## [6.6.4](https://github.com/protobufjs/protobuf.js/releases/tag/6.6.4) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/88eb7a603a21643d5012a374c7d246f4c27620f3) Made sure that LongBits ctor is always called with unsigned 32 bits + static codegen compat., fixes [#690](https://github.com/protobufjs/protobuf.js/issues/690)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/50e82fa7759be035a67c7818a1e3ebe0d6f453b6) Properly handle multiple ../.. in path.normalize, see [#688](https://github.com/protobufjs/protobuf.js/issues/688)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7c3506b3f0c5a08a887e97313828af0c21effc61) Post-merge, also tackles [#683](https://github.com/protobufjs/protobuf.js/issues/683) (packed option for repeated enum values)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7f3f4600bcae6f2e4dadd5cdb055886193a539b7) Verify accepts non-null objects only, see [#685](https://github.com/protobufjs/protobuf.js/issues/685)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d65c22936183d04014d6a8eb880ae0ec33aeba6d) allow_alias enum option was not being honored. This case is now handled and a test case was added
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2ddb76b6e93174787a68f68fb28d26b8ece7cc56) Added an experimental --sparse option to limit pbjs output to actually referenced types within main files
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/33d14c97600ed954193301aecbf8492076dd0179) Added explicit hint on Uint8Array to initial example, see [#670](https://github.com/protobufjs/protobuf.js/issues/670)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cbd4c622912688b47658fea00fd53603049b5104) Ranges and names support for reserved fields, see [#676](https://github.com/protobufjs/protobuf.js/issues/676)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/487f8922d879955ba22f89b036f897b9753b0355) Updated depdendencies / rebuilt dist files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/37536e5fa7a15fbc851040e09beb465bc22d9cf3) Use ?: instead of |undefined in .d.ts files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f8b415a2fc2d1b1eff19333600a010bcaaebf890) Mark optional fields as possibly being undefined
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2ddb76b6e93174787a68f68fb28d26b8ece7cc56) Added a few more common google types from google/api, see [#433](https://github.com/protobufjs/protobuf.js/issues/433)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d246024f4c7d13ca970c91a757e2f47432a619df) Minor optimizations to dependencies, build process and tsd
    - -## [6.6.3](https://github.com/protobufjs/protobuf.js/releases/tag/6.6.3) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0be01a14915e3e510038808fedbc67192a182d9b) Support node 4.2.0 to 4.4.7 buffers + travis case, see [#665](https://github.com/protobufjs/protobuf.js/issues/665)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6a0920b2c32e7963741693f5a773b89f4b262688) Added ES6 syntax flag to pbjs, see [#667](https://github.com/protobufjs/protobuf.js/issues/667)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c365242bdc28a47f5c6ab91bae34c277d1044eb3) Reference Buffer for BufferReader/Writer, see [#668](https://github.com/protobufjs/protobuf.js/issues/668)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/43976072d13bb760a0689b54cc35bdea6817ca0d) Slightly shortened README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e64cf65b09047755899ec2330ca0fc2f4d7932c2) Additional notes on the distinction of different use cases / distributions, see [#666](https://github.com/protobufjs/protobuf.js/issues/666)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/83758c99275c2bbd30f63ea1661284578f5c9d91) Extended README with additional information on JSON format
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fdc3102689e8a3e8345eee5ead07ba3c9c3fe80c) Added extended usage instructions for TypeScript and custom classes to README, see [#666](https://github.com/protobufjs/protobuf.js/issues/666)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3701488cca6bc56ce6b7ad93c7b80e16de2571a7) Updated dist files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/579068a45e285c7d2c69b359716dd6870352f46f) Updated test cases to use new buffer util
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0be01a14915e3e510038808fedbc67192a182d9b) Added fetch test cases + some test cleanup
    - -## [6.6.2](https://github.com/protobufjs/protobuf.js/releases/tag/6.6.2) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3aea1bf3d4920dc01603fda25b86e6436ae45ec2) Properly replace short vars when beautifying static code, see [#663](https://github.com/protobufjs/protobuf.js/issues/663)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b6cf228a82152f72f21b1b307983126395313470) Use custom prelude in order to exclude any module loader code from source (for webpack), see [#658](https://github.com/protobufjs/protobuf.js/issues/658)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2b12fb7db9d4eaa3b76b7198539946e97db684c4) Make sure to check optional inner messages for null when encoding, see [#658](https://github.com/protobufjs/protobuf.js/issues/658)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/276a594771329da8334984771cb536de7322d5b4) Initial attempt on a backwards compatible fetch implementation with binary support, see [#661](https://github.com/protobufjs/protobuf.js/issues/661)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2d81864fa5c4dac75913456d582e0bea9cf0dd80) Root#resolvePath skips files when returning null, see [#368](https://github.com/protobufjs/protobuf.js/issues/368)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/aab3ec1a757aff0f11402c3fb943c003f092c1af) Changes callback on failed response decode in rpc service to pass actual error instead of 'error' string
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9044178c052299670108f10621d6e9b3d56e8a40) Travis should exit with the respective error when running sauce tests
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/73721f12072d77263e72a3b27cd5cf9409db9f8b) Moved checks whether a test case is applicable to parent case
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3fcd88c3f9b1a084b06cab2d5881cb5bb895869d) Added eventemitter tests and updated micromodule dependencies (so far)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2db4305ca67d003d57aa14eb23f25eb6c3672034) Added lib/path tests and updated a few dependencies
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2b12fb7db9d4eaa3b76b7198539946e97db684c4) Moved micro modules to lib so they can have their own tests etc.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b6dfa9f0a4c899b5c217d60d1c2bb835e06b2122) Updated travis
    - -## [6.6.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.6.1) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/039ac77b062ee6ebf4ec84a5e6c6ece221e63401) Properly set up reflection when using light build
    - -## [6.6.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.6.0) ([release](https://github.com/protobufjs/protobuf.js/releases/tag/6.6.0)) - -### Breaking -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cdfe6bfba27fa1a1d0e61887597ad4bb16d7e5ed) Inlined / refactored away .testJSON, see [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6a483a529ef9345ed217a23394a136db0d9f7771) Refactored util.extend away
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/27b16351f3286468e539c2ab382de4b52667cf5e) Reflected and statically generated services use common utility, now work exactly the same
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/dca26badfb843a597f81e98738e2fda3f66c7341) fromObject now throws for entirely bogus values (repeated, map and inner message fields), fixes [#601](https://github.com/protobufjs/protobuf.js/issues/601)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4bff9c356ef5c10b4aa34d1921a3b513e03dbb3d) Cleaned up library distributions, now is full / light / minimal with proper browserify support for each
    - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/301f7762ef724229cd1df51e496eed8cfd2f10eb) Do not randomly remove slashes from comments, fixes [#656](https://github.com/protobufjs/protobuf.js/issues/656)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ef7be352baaec26bdcdce01a71fbee47bbdeec15) Properly parse nested textformat options, also tackles [#655](https://github.com/protobufjs/protobuf.js/issues/655)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b4f4f48f1949876ae92808b0a5ca5f2b29cc011c) Relieved the requirement to call .resolveAll() on roots in order to populate static code-compatible properties, see [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/56c8ec4196d461383c3e1f271da02553d877ae81) Added a (highly experimental) debug build as a starting point for [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c5d291f9bab045385c5938ba0f6cdf50a315461f) Full build depends on light build depends on minimal build, shares all relevant code
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/735da4315a98a6960f3b5089115e308548b91c07) Also reuse specified root in pbjs for JSON modules, see [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3a056244d3acf339722d56549469a8df018e682e) Reuse specified root name in pbjs to be able to split definitions over multiple files more easily, see [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/28ddf756ab83cc890761ef2bd84a0788d2ad040d) Improved pbjs/pbts examples, better covers reflection with definitions for static modules
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6f0b44aea6cf72d23042810f05a7cede85239eb3) Fixed centered formatting on npm
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/dd96dcdacb8eae94942f7016b8dc37a2569fe420) Various other minor improvements / assertions refactored away, see [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3317a76fb56b9b31bb07ad672d6bdda94b79b6c3) Fixed some common reflection deopt sites, see [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6a483a529ef9345ed217a23394a136db0d9f7771) Reflection performance pass, see [#653](https://github.com/protobufjs/protobuf.js/issues/653)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6a483a529ef9345ed217a23394a136db0d9f7771) Added TS definitions to alternative builds' index files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6a483a529ef9345ed217a23394a136db0d9f7771) Removed unnecessary prototype aliases, improves gzip ratio
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/641625fd64aca55b1163845e6787b58054ac36ec) Unified behaviour of and docs on Class constructor / Class.create
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7299929b37267af2100237d4f8b4ed8610b9f7e1) Statically generated services actually inherit from rpc.Service
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f4cf75e4e4192910b52dd5864a32ee138bd4e508) Do not try to run sauce tests for PRs
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/33da148e2b750ce06591c1c66ce4c46ccecc3c8f) Added utility to enable/disable debugging extensions to experimental debug build
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fdb1a729ae5f8ab762c51699bc4bb721102ef0c8) Fixed node 0.12 tests
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6bc5bb4a7649d6b91a5944a9ae20178d004c8856) Fixed coverage
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6f0b44aea6cf72d23042810f05a7cede85239eb3) Added a test case for [#652](https://github.com/protobufjs/protobuf.js/issues/652)
    - -## [6.5.3](https://github.com/protobufjs/protobuf.js/releases/tag/6.5.3) - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/799d0303bf289bb720f2b27af59e44c3197f3fb7) In fromObject, check if object is already a runtime message, see [#652](https://github.com/protobufjs/protobuf.js/issues/652)
    - -## [6.5.2](https://github.com/protobufjs/protobuf.js/releases/tag/6.5.2) - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8cff92fe3b7ddb1930371edb4937cd0db9216e52) Added coverage reporting
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cbaaae99b4e39a859664df0e6d20f0491169f489) Added version scheme warning to everything CLI so that we don't need this overly explicit in README
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6877b3399f1a4c33568221bffb4e298b01b14439) Coverage progress, 100%
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/711a9eb55cb796ec1e51af7d56ef2ebbd5903063) Coverage progress
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e7526283ee4dd82231235afefbfad6af54ba8970) Attempted to fix badges once and for all
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5aa296c901c2b460ee3be4530ede394e2a45e0ea) Coverage progress
    - -## [6.5.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.5.1) - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9719fd2fa8fd97899c54712a238091e8fd1c57b2) Reuse module paths when looking up cli dependencies, see [#648](https://github.com/protobufjs/protobuf.js/issues/648)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6302655d1304cf662f556be5d9fe7a016fcedc3c) Check actual module directories to determine if cli dependencies are present and bootstrap semver, see [#648](https://github.com/protobufjs/protobuf.js/issues/648)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/dfc7c4323bf98fb26ddcfcfbb6896a6d6e8450a4) Added a note on semver-incompatibility, see [#649](https://github.com/protobufjs/protobuf.js/issues/649)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/49053ffa0ea8a4ba5ae048706dba1ab6f3bc803b) Coverage progress
    - -## [6.5.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.5.0) ([release](https://github.com/protobufjs/protobuf.js/releases/tag/6.5.0)) - -### Breaking -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3946e0fefea415f52a16ea7a74109ff40eee9643) Initial upgrade of converters to real generated functions, see [#620](https://github.com/protobufjs/protobuf.js/issues/620)
    - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/08cda241a3e095f3123f8a991bfd80aa3eae9400) An enum's default value present as a string looks up using typeDefault, not defaultValue which is an array if repeated
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c7e14b1d684aaba2080195cc83900288c5019bbc) Use common utility for virtual oneof getters and setters in both reflection and static code, see [#644](https://github.com/protobufjs/protobuf.js/issues/644)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/508984b7ff9529906be282375d36fdbada66b8e6) Properly use Type.toObject/Message.toObject within converters, see [#641](https://github.com/protobufjs/protobuf.js/issues/641)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5bca18f2d32e8687986e23edade7c2aeb6b6bac1) Generate null/undefined assertion in fromObject if actually NOT an enum, see [#620](https://github.com/protobufjs/protobuf.js/issues/620)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/508984b7ff9529906be282375d36fdbada66b8e6) Replace ALL occurencies of types[%d].values in static code, see [#641](https://github.com/protobufjs/protobuf.js/issues/641)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9b090bb1673aeb9b8f1d7162316fce4d7a3348f0) Switched to own property-aware encoders for compatibility, see [#639](https://github.com/protobufjs/protobuf.js/issues/639)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/340d6aa82ac17c4a761c681fa71d5a0955032c8b) Now also parses comments, sets them on reflected objects and re-uses them when generating static code, see [#640](https://github.com/protobufjs/protobuf.js/issues/640)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3cb82628159db4d2aa721b63619b16aadc5f1981) Further improved generated static code style
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cda5c5452fa0797f1e4c375471aef96f844711f1) Removed scoping iifes from generated static code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/def7b45fb9b5e01028cfa3bf2ecd8272575feb4d) Removed even more clutter from generated static code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/dbd19fd9d3a57d033aad1d7173f7f66db8f8db3e) Removed various clutter from generated static code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1cc8a2460c7e161c9bc58fa441ec88e752df409c) Made sure that static target's replacement regexes don't match fields
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d4272dbf5d0b2577af8efb74a94d246e2e0d728e) Also accept (trailing) triple-slash comments for compatibility with protoc-gen-doc, see [#640](https://github.com/protobufjs/protobuf.js/issues/640)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0a3862b75fa60ef732e0cd36d623f025acc2fb45) Use semver to validate that CLI dependencies actually satisfy the required version, see [#637](https://github.com/protobufjs/protobuf.js/issues/637)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9e360ea6a74d41307483e51f18769df7f5b047b9) Added a hint on documenting .proto files for static code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d2a97bb818474645cf7ce1832952b2c3c739b234) Documented internally used codegen partials for what it's worth
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/079388ca65dfd581d74188a6ae49cfa01b103809) Updated converter documentation
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/168e448dba723d98be05c55dd24769dfe3f43d35) Bundler provides useful stuff to uglify and a global var without extra bloat
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/32e0529387ef97182ad0b9ae135fd8b883ed66b4) Cleaned and categorized tests, coverage progress
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3325e86930a3cb70358c689cb3016c1be991628f) Properly removed builtins from bundle
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2c94b641fc5700c8781ac0b9fe796debac8d6893) Call hasOwnProperty builtin as late as possible decreasing the probability of having to call it at all (perf)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/818bcacde267be70a75e689f480a3caad6f80cf7) Slightly hardened codegen sprintf
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/818bcacde267be70a75e689f480a3caad6f80cf7) Significantly improved uint32 write performance
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b5daa272407cb31945fd38c34bbef7c9edd1db1c) Cleaned up test case data and removed unused files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c280a4a18c6d81c3468177b2ea58ae3bc4f25e73) Removed now useless trailing comment checks, see [#640](https://github.com/protobufjs/protobuf.js/issues/640)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/44167db494c49d9e4b561a66ad9ce2d8ed865a21) Ensured that pbjs' beautify does not break regular expressions in generated verify functions
    - -## [6.4.6](https://github.com/protobufjs/protobuf.js/releases/tag/6.4.6) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e11012ce047e8b231ba7d8cc896b8e3a88bcb902) Case-sensitively test for legacy group definitions, fixes [#638](https://github.com/protobufjs/protobuf.js/issues/638)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7e57f4cdd284f886b936511b213a6468e4ddcdce) Properly parse text format options + simple test case, fixes [#636](https://github.com/protobufjs/protobuf.js/issues/636)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fe4d97bbc4d33ce94352dde62ddcd44ead02d7ad) Added SVG logo, see [#629](https://github.com/protobufjs/protobuf.js/issues/629)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/57990f7ed8ad5c512c28ad040908cee23bbf2aa8) Also refactored Service and Type to inherit from NamespaceBase, see [#635](https://github.com/protobufjs/protobuf.js/issues/635)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fe4d97bbc4d33ce94352dde62ddcd44ead02d7ad) Moved TS-compatible Namespace features to a virtual NamespaceBase class, compiles with strictNullChecks by default now, see [#635](https://github.com/protobufjs/protobuf.js/issues/635)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fe4d97bbc4d33ce94352dde62ddcd44ead02d7ad) Minor codegen enhancements
    - -## [6.4.5](https://github.com/protobufjs/protobuf.js/releases/tag/6.4.5) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1154ce0867306e810cf62a5b41bdb0b765aa8ff3) Properly handle empty/noop Writer#ldelim, fixes [#625](https://github.com/protobufjs/protobuf.js/issues/625)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f303049f92c53970619375653be46fbb4e3b7d78) Properly annotate map fields in pbjs, fixes [#624](https://github.com/protobufjs/protobuf.js/issues/624)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4b786282a906387e071a5a28e4842a46df588c7d) Made sure that Writer#bytes is always able to handle plain arrays
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1e6a8d10f291a16631376dd85d5dd385937e6a55) Slightly restructured utility to better support static code default values
    - -## [6.4.4](https://github.com/protobufjs/protobuf.js/releases/tag/6.4.4) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/26d68e36e438b590589e5beaec418c63b8f939cf) Dynamically resolve jsdoc when running pbts, fixes [#622](https://github.com/protobufjs/protobuf.js/issues/622)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/69c04d7d374e70337352cec9b445301cd7fe60d6) Explain 6.4.2 vs 6.4.3 in changelog
    - -## [6.4.3](https://github.com/protobufjs/protobuf.js/releases/tag/6.4.4) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c2c39fc7cec5634ecd1fbaebbe199bf097269097) Fixed invalid definition of Field#packed property, also introduced decoder.compat mode (packed fields, on by default)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/11fb1a66ae31af675d0d9ce0240cd8e920ae75e7) Always decode packed/non-packed based on wire format only, see [#602](https://github.com/protobufjs/protobuf.js/issues/602)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c9a61e574f5a2b06f6b15b14c0c0ff56f8381d1f) Use full library for JSON modules and runtime dependency for static modules, fixes [#621](https://github.com/protobufjs/protobuf.js/issues/621)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e88d13ca7ee971451b57d056f747215f37dfd3d7) Additional workarounds for on demand CLI dependencies, see [#618](https://github.com/protobufjs/protobuf.js/issues/618)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/44f6357557ab3d881310024342bcc1e0d336a20c) Revised automatic setup of cli dependencies, see [#618](https://github.com/protobufjs/protobuf.js/issues/618)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e027a3c7855368837e477ce074ac65f191bf774a) Removed Android 4.0 test (no longer supported by sauce)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8ba3c5efd182bc80fc36f9d5fe5e2b615b358236) Removed some unused utility, slightly more efficient codegen, additional comments
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f22a34a071753bca416732ec4d01892263f543fb) Updated tests for new package.json layout
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f22a34a071753bca416732ec4d01892263f543fb) Added break/continue label support to codegen
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f2ffa0731aea7c431c59e452e0f74247d815a352) Updated dependencies, rebuilt dist files and changed logo to use an absolute url
    - -6.4.2 had been accidentally published as 6.4.3. - -## [6.4.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.4.1) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9035d4872e32d6402c8e4d8c915d4f24d5192ea9) Added more default value checks to converter, fixes [#616](https://github.com/protobufjs/protobuf.js/issues/616)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/62eef58aa3b002115ebded0fa58acc770cd4e4f4) Respect long defaults in converters
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e3170a160079a3a7a99997a2661cdf654cb69e24) Convert inner messages and undefined/null values more thoroughly, fixes [#615](https://github.com/protobufjs/protobuf.js/issues/615)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b52089efcb9827537012bebe83d1a15738e214f4) Always use first defined enum value as field default, fixes [#613](https://github.com/protobufjs/protobuf.js/issues/613)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/64f95f9fa1bbe42717d261aeec5c16d1a7aedcfb) Install correct 'tmp' dependency when running pbts without dev dependencies installed, fixes [#612](https://github.com/protobufjs/protobuf.js/issues/612)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cba46c389ed56737184e5bc2bcce07243d52e5ce) Generate named constructors for runtime messages, see [#588](https://github.com/protobufjs/protobuf.js/issues/588)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ee20b81f9451c56dc106177bbf9758840b99d0f8) pbjs/pbts no longer generate any volatile headers, see [#614](https://github.com/protobufjs/protobuf.js/issues/614)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ec9d517d0b87ebe489f02097c2fc8005fae38904) Attempted to make broken shields less annoying
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5cd4c2f2a94bc3c0f2c580040bce28dd42eaccec) Updated README
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0643f93f5c0d96ed0ece5b47f54993ac3a827f1b) Some cleanup and added a logo
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/169638382de9efe35a1079c5f2045c33b858059a) use $protobuf.Long
    - -## [6.4.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.4.0) ([release](https://github.com/protobufjs/protobuf.js/releases/tag/6.4.0)) - -### Breaking -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a017bf8a2dbdb7f9e7ce4c026bb6845174feb3b1) Dropped IE8 support
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/39bc1031bb502f8b677b3736dd283736ea4d92c1) Removed now unused util.longNeq which was used by early static code
    - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5915ff972482e7db2a73629244ab8a93685b2e55) Do not swallow errors in loadSync, also accept negative enum values in Enum#add, fixes [#609](https://github.com/protobufjs/protobuf.js/issues/609)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fde56c0de69b480343931264a01a1ead1e3156ec) Improved bytes field support, also fixes [#606](https://github.com/protobufjs/protobuf.js/issues/606)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0c03f327115d57c4cd5eea3a9a1fad672ed6bd44) Fall back to browser Reader when passing an Uint8Array under node, fixes [#605](https://github.com/protobufjs/protobuf.js/issues/605)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7eb3d456370d7d66b0856e32b2d2602abf598516) Respect optional properties when writing interfaces in tsd-jsdoc, fixes [#598](https://github.com/protobufjs/protobuf.js/issues/598)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/bcadffecb3a8b98fbbd34b45bae0e6af58f9c810) Instead of protobuf.parse.keepCase, fall back to protobuf.parse.defaults holding all possible defaults, see [#608](https://github.com/protobufjs/protobuf.js/issues/608)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a4d6a2af0d57a2e0cccf31e3462c8b2465239f8b) Added global ParseOptions#keepCase fallback as protobuf.parse.keepCase, see [#608](https://github.com/protobufjs/protobuf.js/issues/608)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a017bf8a2dbdb7f9e7ce4c026bb6845174feb3b1) Converters use code generation and support custom implementations
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/28ce07d9812f5e1743afef95a94532d2c9488a84) Be more verbose when throwing invalid wire type errors, see [#602](https://github.com/protobufjs/protobuf.js/issues/602)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/40074bb69c3ca4fcefe09d4cfe01f3a86844a7e8) Added an asJSON-option to always populate array fields, even if defaults=false, see [#597](https://github.com/protobufjs/protobuf.js/issues/597)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a7d23240a278aac0bf01767b6096d692c09ae1ce) Attempt to improve TypeScript support by using explicit exports
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/cec253fb9a177ac810ec96f4f87186506091fa37) Copy-pasted typescript definitions to micro modules, see [#599](https://github.com/protobufjs/protobuf.js/issues/599)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1f18453c7bfcce65c258fa98a3e3d4577d2e550f) Emit an error on resolveAll() if any extension fields cannot be resolved, see [#595](https://github.com/protobufjs/protobuf.js/issues/595) + test case
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/804739dbb75359b0034db0097fe82081e3870a53) Removed 'not recommend' label for --keep-case, see [#608](https://github.com/protobufjs/protobuf.js/issues/608)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9681854526f1813a6ef08becf130ef2fbc28b638) Added customizable linter configuration to pbjs
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9681854526f1813a6ef08becf130ef2fbc28b638) Added stdin support to pbjs and pbts
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/407223b5ceca3304bc65cb48888abfdc917d5800) Static code no longer uses IE8 support utility
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a017bf8a2dbdb7f9e7ce4c026bb6845174feb3b1) Generated static code now supports asJSON/from
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3c775535517b8385a1d3c1bf056f3da3b4266f8c) Added support for TypeScript enums to pbts
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0cda72a55a1f2567a5d981dc5d924e55b8070513) Added a few helpful comments to static code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/24b293c297feff8bda5ee7a2f8f3f83d77c156d0) Slightly beautify statically generated code
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/65637ffce20099df97ffbcdce50faccc8e97c366) Do not wrap main definition as a module and export directly instead
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/65637ffce20099df97ffbcdce50faccc8e97c366) Generate prettier definitions with --no-comments
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/20d8a2dd93d3bbb6990594286f992e703fc4e334) Added variable arguments support to tsd-jsdoc
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8493dbd9a923693e943f710918937d83ae3c4572) Reference dependency imports as a module to prevent name collisions, see [#596](https://github.com/protobufjs/protobuf.js/issues/596)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/39a2ea361c50d7f4aaa0408a0d55bb13823b906c) Removed now unnecessary comment lines in generated static code
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a4e41b55471d83a8bf265c6641c3c6e0eee82e31) Added notes on CSP-restricted environments to README, see [#593](https://github.com/protobufjs/protobuf.js/issues/593)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1a3effdad171ded0608e8da021ba8f9dd017f2ff) Added test case for asJSON with arrays=true, see [#597](https://github.com/protobufjs/protobuf.js/issues/597)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/751a90f509b68a5f410d1f1844ccff2fc1fc056a) Added a tape adapter to assert message equality accross browsers
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fde56c0de69b480343931264a01a1ead1e3156ec) Refactored some internal utility away
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/805291086f6212d1f108b3d8f36325cf1739c0bd) Reverted previous attempt on [#597](https://github.com/protobufjs/protobuf.js/issues/597)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c5160217ea95996375460c5403dfe37b913d392e) Minor tsd-jsdoc refactor
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/961dd03061fc2c43ab3bf22b3f9f5165504c1002) Removed unused sandbox files
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f625eb8b0762f8f5d35bcd5fc445e52b92d8e77d) Updated package.json of micro modules to reference types, see [#599](https://github.com/protobufjs/protobuf.js/issues/599)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/46ec8209b21cf9ff09ae8674e2a5bbc49fd4991b) Reference dependencies as imports in generated typescript definitions, see [#596](https://github.com/protobufjs/protobuf.js/issues/596)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3bab132b871798c7c50c60a4c14c2effdffa372e) Allow null values on optional long fields, see [#590](https://github.com/protobufjs/protobuf.js/issues/590)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/31da56c177f1e11ffe0072ad5f58a55e3f8008fd) Various jsdoc improvements and a workaround for d.ts generation, see [#592](https://github.com/protobufjs/protobuf.js/issues/592)
    - -## [6.3.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.3.1) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/95ed6e9e8268711db24f44f0d7e58dd278ddac4c) Empty inner messages are always present on the wire + test case + removed now unused Writer#ldelim parameter, see [#585](https://github.com/protobufjs/protobuf.js/issues/585)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e8a4d5373b1a00cc6eafa5b201b91d0e250cc00b) Expose tsd-jsdoc's comments option to pbts as --no-comments, see [#587](https://github.com/protobufjs/protobuf.js/issues/587)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6fe099259b5985d873ba5bec88c049d7491a11cc) Increase child process max buffer when running jsdoc from pbts, see [#587](https://github.com/protobufjs/protobuf.js/issues/587)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3d84ecdb4788d71b5d3928e74db78e8e54695f0a) pbjs now generates more convenient dot-notation property accessors
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1e0ebc064e4f2566cebf525d526d0b701447bd6a) And fixed IE8 again (should probably just drop IE8 for good)
    - -## [6.3.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.3.0) - -### Breaking -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a97956b1322b6ee62d4fc9af885658cd5855e521) Moved camelCase/underScore away from util to where actually used
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c144e7386529b53235a4a5bdd8383bdb322f2825) Renamed asJSON option keys (enum to enums, long to longs) because enum is a reserved keyword
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5b9ade428dca2df6a13277522f2916e22092a98b) Moved JSON/Message conversion to its own source file and added Message/Type.from + test case, see [#575](https://github.com/protobufjs/protobuf.js/issues/575)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0b0de2458a1ade1ccd4ceb789697be13290f856b) Relicensed the library and its components to BSD-3-Clause to match the official implementation (again)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/22a64c641d4897965035cc80e92667bd243f182f) Dropped support for browser buffer entirely (is an Uint8Array anyway), ensures performance and makes things simpler
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/22a64c641d4897965035cc80e92667bd243f182f) Removed dead parts of the Reader API
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/964f65a9dd94ae0a18b8be3d9a9c1b0b1fdf6424) Refactored BufferReader/Writer to their own files and removed unnecessary operations (node always has FloatXXArray and browser buffer uses ieee anyway)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/bfac0ea9afa3dbaf5caf79ddf0600c3c7772a538) Stripped out fallback encoder/decoder/verifier completely (even IE8 supports codegen), significantly reduces bundle size, can use static codegen elsewhere
    - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c3023a2f51fc74547f6c6e53cf75feed60f3a25c) Actually concatenate mixed custom options when parsing
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0d66b839df0acec2aea0566d2c0bbcec46c3cd1d) Fixed a couple of issues with alternative browser builds
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/33706cdc201bc863774c4af6ac2c38ad96a276e6) Properly set long defaults on prototypes
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0ea2740f0774b4c5c349b9c303f3fb2c2743c37b) Fixed reference error in minimal runtime, see [#580](https://github.com/protobufjs/protobuf.js/issues/580)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/741b6d8fde84d9574676a729a29a428d99f0a0a0) Non-repeated empty messages are always present on the wire, see [#581](https://github.com/protobufjs/protobuf.js/issues/581)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7fac9d6a39bf42d316c1676082a2d0804bc55934) Properly check Buffer.prototype.set with node v4
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3ad8108eab57e2b061ee6f1fddf964abe3f4cbc7) Prevent NRE and properly annotate verify signature in tsd-jsdoc, fixed [#572](https://github.com/protobufjs/protobuf.js/issues/572)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6c2415d599847cbdadc17dee3cdf369fc9facade) Fix directly using Buffer instead of util.Buffer
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/19e906c2a15acc6178b3bba6b19c2f021e681176) Added filter type to Namespace#lookup, fixes [#569](https://github.com/protobufjs/protobuf.js/issues/569)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9c9a66bf393d9d6927f35a9c18abf5d1c31db912) Fixed parsing enum inner options, see [#565](https://github.com/protobufjs/protobuf.js/issues/565)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ea7ba8b83890084d61012cb5386dc11dadfb3908) Fixed release links in README files
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/442471363f99e67fa97044f234a47b3c9b929dfa) Added a noparse build for completeness
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/bfee1cc3624d0fa21f9553c2f6ce2fcf7fcc09b7) Now compresses .gz files using zopfli to make them useful beyond being just a reference
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/aed134aa1cd7edd801de77c736cf5efe6fa61cb0) Updated non-bundled google types folder with missing descriptors and added wrappers to core
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0b0de2458a1ade1ccd4ceb789697be13290f856b) Replaced the ieee754 implementation for old browsers with a faster, use-case specific one + simple test case
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/99ad9cc08721b834a197d4bbb67fa152d7ad79aa) Added .create to statically generated types and uppercase nested elements to reflection namespaces, see [#576](https://github.com/protobufjs/protobuf.js/issues/576)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/99ad9cc08721b834a197d4bbb67fa152d7ad79aa) Also added Namespace#getEnum for completeness, see [#576](https://github.com/protobufjs/protobuf.js/issues/576)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ef43acff547c0cd84cfb7a892fe94504a586e491) Added Namespace#getEnum and changed #lookupEnum to the same behavior, see [#576](https://github.com/protobufjs/protobuf.js/issues/576)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1fcfdfe21c1b321d975a8a96d133a452c9a9c0d8) Added a heap of coverage comments for usually unused code paths to open things up
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c234de7f0573ee30ed1ecb15aa82b74c0f994876) Added codegen test to determine if any ancient browsers don't actually support it
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fed2000e7e461efdb1c3a1a1aeefa8b255a7c20b) Added legacy groups support to pbjs, see [#568](https://github.com/protobufjs/protobuf.js/issues/568)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/974a1321da3614832aa0a5b2e7c923f66e4ba8ae) Initial support for legacy groups + test case, see [#568](https://github.com/protobufjs/protobuf.js/issues/568)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9c9a66bf393d9d6927f35a9c18abf5d1c31db912) Added asJSON bytes as Buffer, see [#566](https://github.com/protobufjs/protobuf.js/issues/566)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c60cd397e902ae6851c017f2c298520b8336cbee) Annotated callback types in pbjs-generated services, see [#582](https://github.com/protobufjs/protobuf.js/issues/582)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3e7e4fc59e6d2d6c862410b4b427fbedccdb237b) Removed type/ns alias comment in static target to not confuse jsdoc unnecessarily
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/99ad9cc08721b834a197d4bbb67fa152d7ad79aa) Made pbjs use loadSync for deterministic outputs, see [#573](https://github.com/protobufjs/protobuf.js/issues/573)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4d1f5facfcaaf5f2ab6a70b12443ff1b66e7b94e) Updated documentation on runtime and noparse builds
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c59647a7542cbc4292248787e5f32bb99a9b8d46) Fixed an issue with the changelog generator skipping some commits
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/24f2c03af9f13f5404259866fdc8fed33bfaae25) Added notes on how to use pbjs and pbts programmatically
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3544576116146b209246d71c7f7a9ed687950b26) Manually sorted old changelog entries
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d5812571f335bae68f924aa1098519683a9f3e44) Initial changelog generator, see [#574](https://github.com/protobufjs/protobuf.js/issues/574)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ab3e236a967a032a98267a648f84d129fdb4d4a6) Added static/JSON module interchangeability to README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7939a4bd8baca5f7e07530fc93f27911a6d91c6f) Updated README and bundler according to dynamic require calls
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/93e04f1db4a9ef3accff8d071c75be3d74c0cd4a) Added basic services test case
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b5a068f5b79b6f00c4b05d9ac458878650ffa09a) Just polyfill Buffer.from / .allocUnsafe for good
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4375a485789e14f7bf24bece819001154a03dca2) Added a test case to find out if all the fallbacks are just for IE8
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/deb2e82ed7eda41d065a09d120e91c0f7ecf1e6a) Commented out float assertions in float test including explanation
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d3ebd5745b024033fbc2410ecad4d4e02abd67db) Expose array implementation used with (older) browsers on util for tests
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b1b6a813c93da4c7459755186aa02ef2f3765c94) Updated test cases
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/99dc5faa7b39fdad8ebc102de4463f8deb7f48ff) Added assumptions to float test case
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/948ca2e3c5c62fedcd918d75539c261abf1a7347) Updated travis config to use C++11
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c59647a7542cbc4292248787e5f32bb99a9b8d46) Updated / added additional LICENSE files where appropriate
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/333f0221814be976874862dc83d0b216e07d4012) Integrated changelog into build process, now also has 'npm run make' for everything, see [#574](https://github.com/protobufjs/protobuf.js/issues/574)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ab3e236a967a032a98267a648f84d129fdb4d4a6) Minor optimizations through providing type-hints
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ab3e236a967a032a98267a648f84d129fdb4d4a6) Reverted shortened switch statements in verifier
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ab3e236a967a032a98267a648f84d129fdb4d4a6) Enums can't be map key types
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8ef6975b0bd372b79e9b638f43940424824e7176) Use custom require (now a micromodule) for all optional modules, see [#571](https://github.com/protobufjs/protobuf.js/issues/571)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e226f001e4e4633d64c52be4abc1915d7b7bd515) Support usage when size = 0
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/19e906c2a15acc6178b3bba6b19c2f021e681176) Reverted aliases frequently used in codegen for better gzip ratio
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/47b51ec95a540681cbed0bac1b2f02fc4cf0b73d) Shrinked bundle size - a bit
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f8451f0058fdf7a1fac15ffc529e4e899c6b343c) Can finally run with --trace-deopt again without crashes
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9c9a66bf393d9d6927f35a9c18abf5d1c31db912) Other minor optimizations
    - -## [6.2.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.2.1) - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1a6fdc9a11fb08506d09351f8e853384c2b8be25) Added ParseOptions to protobuf.parse and --keep-case for .proto sources to pbjs, see [#564](https://github.com/protobufjs/protobuf.js/issues/564)
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fc383d0721d83f66b2d941f0d9361621839327e9) Better TypeScript definition support for @property-annotated objects
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4531d75cddee9a99adcac814d52613116ba789f3) Can't just inline longNeq but can be simplified
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8f25377cf99036794ba13b160a5060f312d1a7e7) Array abuse and varint optimization
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/90b201209a03e8022ada0ab9182f338fa0813651) Updated dependencies
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f1110b0993ec86e0a4aee1735bd75b901952cb36) Other minor improvements to short ifs
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c079c900e2d61c63d5508eafacbd00163d377482) Reader/Writer example
    - -## [6.2.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.2.0) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9b7b92a4c7f8caa460d687778dc0628a74cdde37) Fixed reserved names re, also ensure valid service method names, see [#559](https://github.com/protobufjs/protobuf.js/issues/559)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a83425049c9a78c5607bc35e8089e08ce78a741e) Fix d.ts whitespace on empty lines, added tsd-jsdoc LICENSE
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5f9bede280aa998afb7898e8d2718b4a229e8e6f) Fix asJSON defaults option, make it work for repeated fields.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b0aef62191b65cbb305ece84a6652d76f98da259) Inlined any Reader/Writer#tag calls, also fixes [#556](https://github.com/protobufjs/protobuf.js/issues/556)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4d091d41caad9e63cd64003a08210b78878e01dd) Fix building default dist files with explicit runtime=false
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/096dfb686f88db38ed2d8111ed7aac36f8ba658a) Apply asJSON recursively
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/19c269f1dce1b35fa190f264896d0865a54a4fff) Ensure working reflection class names with minified builds
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9c769504e0ffa6cbe0b6f8cdc14f1231bed7ee34) Lazily resolve (some) cyclic dependencies, see [#560](https://github.com/protobufjs/protobuf.js/issues/560)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/da07d8bbbede4175cc45ca46d883210c1082e295) Added protobuf.roots to minimal runtime, see [#554](https://github.com/protobufjs/protobuf.js/issues/554)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8f407a18607334185afcc85ee98dc1478322bd01) Repo now includes a restructured version of tsd-jsdoc with our changes incorporated for issues/prs, see [#550](https://github.com/protobufjs/protobuf.js/issues/550)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1b5e4250415c6169eadb405561242f847d75044b) Updated pbjs arguments
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4750e3111b9fdb107d0fc811e99904fbcdbb6de1) Pipe tsd-jsdoc output (requires dcodeIO/tsd-jsdoc/master) and respect cwd, see [#550](https://github.com/protobufjs/protobuf.js/issues/550)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/75f4b6cb6325a3fc7cd8fed3de5dbe0b6b29c748) tsd-jsdoc progress
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/766171e4c8b6650ea9c6bc3e76c9c96973c2f546) README
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c33835cb1fe1872d823e94b0fff024dc624323e8) Added GH issue template
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6f9ffb6307476d48f45dc4f936744b82982d386b) Path micromodule, dependencies
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0b9b1d8505743995c5328daab1f1e124debc63bd) Test case for [#556](https://github.com/protobufjs/protobuf.js/issues/556)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/74b2c5c5d33a46c3751ebeadc9d934d4ccb8286c) Raw alloc benchmark
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fb74223b7273530d8baa53437ee96c65a387436d) Other minor optimizations
    - -## [6.1.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.1.1) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/baea920fa6bf5746e0a7888cdbb089cd5d94fc90) Properly encode/decode map kv pairs as repeated messages (codegen and fallback), see [#547](https://github.com/protobufjs/protobuf.js/issues/547)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/28a1d26f28daf855c949614ef485237c6bf316e5) Make genVerifyKey actually generate conditions for 32bit values and bool, fixes [#546](https://github.com/protobufjs/protobuf.js/issues/546)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3e9d8ea9a5cbb2e029b5c892714edd6926d2e5a7) Fix to generation of verify methods for bytes
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e7893675ccdf18f0fdaea8f9a054a6b5402b060e) Take special care of oneofs when encoding (i.e. when explicitly set to defaults), see [#542](https://github.com/protobufjs/protobuf.js/issues/542)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/52cd8b5a891ec8e11611127c8cfa6b3a91ff78e3) Added Message#asJSON option for bytes conversion
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/01365ba9116ca1649b682635bb29814657c4133c) Added Namespace#lookupType and Namespace#lookupService (throw instead of returning null), see [#544](https://github.com/protobufjs/protobuf.js/issues/544)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a54fbc918ef6bd627113f05049ff704e07bf33b4) Provide prebuilt browser versions of the static runtime
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3783af7ca9187a1d9b1bb278ca69e0188c7e4c66) Initial pbts CLI for generating TypeScript definitions, see [#550](https://github.com/protobufjs/protobuf.js/issues/550)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b8bce03405196b1779727f246229fd9217b4303d) Refactored json/static-module targets to use common wrappers
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/691231fbc453a243f48a97bfb86794ab5718ef49) Refactor cli to support multiple built-in wrappers, added named roots instead of always using global.root and added additionally necessary eslint comments, see [#540](https://github.com/protobufjs/protobuf.js/issues/540)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e3e77d0c7dc973d3a5948a49d123bdaf8a048030) Annotate namespaces generated by static target, see [#550](https://github.com/protobufjs/protobuf.js/issues/550)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/aff21a71e6bd949647b1b7721ea4e1fe16bcd933) static target: Basic support for oneof fields, see [#542](https://github.com/protobufjs/protobuf.js/issues/542)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b6b00aa7b0cd35e0e8f3c16b322788e9942668d4) Fix to reflection documentation
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ed86f3acbeb6145be5f24dcd05efb287b539e61b) README on minimal runtime / available downloads
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d31590b82d8bafe6657bf877d403f01a034ab4ba) Notes on descriptors vs static modules
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ce41d0ef21cee2d918bdc5c3b542d3b7638b6ead) A lot of minor optimizations to performance and gzip ratio
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ecbb4a52fbab445e63bf23b91539e853efaefa47) Minimized base64 tables
    - -## [6.1.0](https://github.com/protobufjs/protobuf.js/releases/tag/6.1.0) - -### Breaking -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a46cc4934b7e888ae80e06fd7fdf91e5bc7f54f5) Removed as-function overload for Reader/Writer, profiler stub, optimized version of Reader#int32
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7983ee0ba15dc5c1daad82a067616865051848c9) Refactored Prototype and inherits away, is now Class and Message for more intuitive documentation and type refs
    - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/c3c70fe3a47fd4f7c85dc80e1af7d9403fe349cd) Fixed failing test case on node < 6
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/66be5983321dd06460382d045eb87ed72a186776) Fixed serialization order of sfixed64, fixes [#536](https://github.com/protobufjs/protobuf.js/issues/536)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7def340833f9f1cc41f4835bd0d62e203b54d9eb) Fixed serialization order of fixed64, fallback to parseInt with no long lib, see [#534](https://github.com/protobufjs/protobuf.js/issues/534)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/98a58d40ca7ee7afb1f76c5804e82619104644f6) Actually allow undefined as service method type, fixes [#528](https://github.com/protobufjs/protobuf.js/issues/528)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/38d867fc50a4d7eb1ca07525c9e4c71b8782443e) Do not skip optional delimiter after aggregate options, fixes [#520](https://github.com/protobufjs/protobuf.js/issues/520)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/67449db7c7416cbc59ad230c168cf6e6b6dba0c5) Verify empty base64 encoded strings for bytes fields, see [#535](https://github.com/protobufjs/protobuf.js/issues/535)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ef0fcb6d525c5aab13a39b4f393adf03f751c8c9) wrong spell role should be rule
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/55db92e21a26c04f524aeecb2316968c000e744d) decodeDelimited always forks if writer is specified, see [#531](https://github.com/protobufjs/protobuf.js/issues/531)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ebae1e18152617f11ac07827828f5740d4f2eb7e) Mimic spec-compliant behaviour in oneof getVirtual, see [#523](https://github.com/protobufjs/protobuf.js/issues/523)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/a0398f5880c434ff88fd8d420ba07cc29c5d39d3) Initial base64 string support for bytes fields, see [#535](https://github.com/protobufjs/protobuf.js/issues/535)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6a6c00c3e1def5d35c7fcaa1bbb6ce4e0fe67544) Initial type-checking verifier, see [#526](https://github.com/protobufjs/protobuf.js/issues/526), added to bench out of competition
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3aa984e063cd73e4687102b4abd8adc16582dbc4) Initial loadSync (node only), see [#529](https://github.com/protobufjs/protobuf.js/issues/529)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f1370ff5b0db2ebb73b975a3d7c7bd5b901cbfac) Initial RPC service implementaion, see [#529](https://github.com/protobufjs/protobuf.js/issues/529)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/090d8eaf10704a811a73e1becd52f2307cbcad48) added 'defaults' option to Prototype#asJSON, see [#521](https://github.com/protobufjs/protobuf.js/issues/521)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7c28483d65cde148e61fe9993f1716960b39e049) Use Uint8Array pool in browsers, just like node does with buffers
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4157a0ec2e54c4d19794cb16edddcd8d4fbd3e76) Also validate map fields, see [#526](https://github.com/protobufjs/protobuf.js/issues/526) (this really needs some tests)
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0ce099bf4f4666fd00403a2839e6da628b8328a9) Added json-module target to pbjs, renamed static to static-module, see [#522](https://github.com/protobufjs/protobuf.js/issues/522)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1d99442fe65fcaa2f9e33cc0186ef1336057e0cf) updated internals and static target to use immutable objects on prototypes
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e6eaa91b9fe021b3356d4d7e42033a877bc45871) Added a couple of alternative signatures, protobuf.load returns promise or undefined, aliased Reader/Writer-as-function signature with Reader/Writer.create for typed dialects, see [#518](https://github.com/protobufjs/protobuf.js/issues/518)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9df6a3d4a654c3e122f97d9a594574c7bbb412da) Added variations for Root#load, see [#527](https://github.com/protobufjs/protobuf.js/issues/527)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/193e65c006a8df8e9b72e0f23ace14a94952ee36) Added benchmark and profile related information to README
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/228a2027de35238feb867cb0485c78c755c4d17d) Added service example to README, see [#529](https://github.com/protobufjs/protobuf.js/issues/529)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/1a8c720714bf867f1f0195b4690faefa4f65e66a) README on tests
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/014fb668dcf853874c67e3e0aeb7b488a149d35c) Update README/dist to reflect recent changes
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/11d844c010c5a22eff9d5824714fb67feca77b26) Minimal documentation for micromodules
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/47608dd8595b0df2b30dd18fef4b8207f73ed56a) Document all the callbacks, see [#527](https://github.com/protobufjs/protobuf.js/issues/527)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3891ab07bbe20cf84701605aa62453a6dbdb6af2) Documented streaming-rpc example a bit
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5606cb1bc41bc90cb069de676650729186b38640) Removed the need for triple-slash references in .d.ts by providing a minimal Long interface, see [#527](https://github.com/protobufjs/protobuf.js/issues/527), see [#530](https://github.com/protobufjs/protobuf.js/issues/530)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/adf3cc3d340f8b2a596c892c64457b15e42a771b) Transition to micromodules
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f3a9589b74af6a1bf175f2b1994badf703d7abc4) Refactored argument order of utf8 for plausibility
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/14c207ed6e05a61e756fa4192efb2fa219734dd6) Restructured reusable micromodules
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/b510ba258986271f07007aebc5dcfea7cfd90cf4) Can't use Uint8Array#set on node < 6 buffers
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/78952a50ceee8e196b4f156eb01f7f693b5b8aac) Test case for [#531](https://github.com/protobufjs/protobuf.js/issues/531)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/954577c6b421f7d7f4905bcc32f57e4ebaf548da) Safer signaling for synchronous load, see [#529](https://github.com/protobufjs/protobuf.js/issues/529)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9ea3766ff1b8fb7ccad028f44efe27d3b019eeb7) Proper end of stream signaling to rpcImpl, see [#529](https://github.com/protobufjs/protobuf.js/issues/529)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/e4faf7fac9b34d4776f3c15dfef8d2ae54104567) Moved event emitter to util, also accepts listener context, see [#529](https://github.com/protobufjs/protobuf.js/issues/529)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9bdec62793ce77c954774cc19106bde4132f24fc) Probably the worst form of hiding require programmatically, see [#527](https://github.com/protobufjs/protobuf.js/issues/527)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4462d8b05d3aba37c865cf53e09b3199cf051a92) Attempt to hide require('fs') from webpack, see [#527](https://github.com/protobufjs/protobuf.js/issues/527)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/7c3bf8d32cbf831b251730b3876c35c901926300) Trying out jsdoc variations, see [#527](https://github.com/protobufjs/protobuf.js/issues/527)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/bb4059467287fefda8f966de575fd0f8f9690bd3) by the way, why not include the json->proto functionality into "util"?
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f1008e6ee53ee50358e19c10df8608e950be4be3) Update proto.js
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fc9014822d9cdeae8c6e454ccb66ee28f579826c) Automatic profile generation and processing
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/2a2f6dcab5beaaa98e55a005b3d02643c45504d6) Generalized buffer pool and moved it to util
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/53a16bf3ada4a60cc09757712e0046f3f2d9d094) Make shields visible on npm, yey
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/9004b9d0c5135a7f6df208ea658258bf2f9e6fc9) More shields, I love shields, and maybe a workaround for travis timing out when sauce takes forever
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/060a7916a2715a9e4cd4d05d7c331bec33e60b7e) Trying SauceLabs with higher concurrency
    - -## [6.0.2](https://github.com/protobufjs/protobuf.js/releases/tag/6.0.2) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/23d664384900eb65e44910def45f04be996fbba1) Fix packable float/double see [#513](https://github.com/protobufjs/protobuf.js/issues/513)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/54283d39c4c955b6a84f7f53d4940eec39e4df5e) Handle oneofs in prototype ctor, add non-ES5 fallbacks, test case
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/0ae66752362899b8407918a759b09938e82436e1) Be nice to AMD, allow reconfiguration of Reader/Writer interface
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/00f3574ef4ee8b237600e41839bf0066719c4469) Initial static codegen target for reference
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/81e36a7c14d89b487dfe7cfb2f8380fcdf0df392) pbjs static target services support
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4885b8239eb74c72e665787ea0ece3336e493d7f) pbjs static target progress, uses customizable wrapper template
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/ad5abe7bac7885ba4f68df7eeb800d2e3b81750b) Static pbjs target progress, now generates usable CommonJS code, see [#512](https://github.com/protobufjs/protobuf.js/issues/512)
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d9634d218849fb49ff5dfb4597bbb2c2d43bbf08) TypeScript example
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/fce8276193a5a9fabad5e5fbeb2ccd4f0f3294a9) Adjectives, notes on browserify
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/23d664384900eb65e44910def45f04be996fbba1) Refactor runtime util into separate file, reader/writer uses runtime util
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/f91c432a498bebc0adecef1562061b392611f51a) Also optimize reader with what we have learned
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d83f799519fe69808c88e83d9ad66c645d15e963) More (shameless) writer over-optimization
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/8a2dbc610a06fe3a1a2695a3ab032d073b77760d) Trading package size for float speed
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/95c5538cfaf1daf6b4990f6aa7599779aaacf99f) Skip defining getters and setters on IE8 entirely, automate defining fallbacks
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/09865d069303e795e475c82afe2b2267abaa59ea) Unified proto/reflection/classes/static encoding API to always return a writer
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/98d6ae186a48416e4ff3030987caed285f40a4f7) plain js utf8 is faster for short strings
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/79fbbf48b8e4dc9c41dcbdef2b73c5f2608b0318) improve TypeScript support. add simple test script.
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/96fa07adec8b0ae05e07c2c40383267f25f2fc92) Use long.js dependency in tests, reference types instead of paths in .d.ts see [#503](https://github.com/protobufjs/protobuf.js/issues/503)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/5785dee15d07fbcd14025a96686707173bd649a0) Restructured encoder / decoder to better support static code gen
    - -## [6.0.1](https://github.com/protobufjs/protobuf.js/releases/tag/6.0.1) - -### Fixed -[:hash:](https://github.com/protobufjs/protobuf.js/commit/799c1c1a84b255d1831cc84c3d24e61b36fa2530) Add support for long strings, fixes [#509](https://github.com/protobufjs/protobuf.js/issues/509)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6e5fdb67cb34f90932e95a51370e1652acc55b4c) expose zero on LongBits, fixes [#508](https://github.com/protobufjs/protobuf.js/issues/508)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/aa922c07490f185c5f97cf28ebbd65200fc5e377) Fixed issues with Root.fromJSON/#addJSON, search global for Long
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/51fe45656b530efbba6dad92f92db2300aa18761) Properly exclude browserify's annoying _process, again, fixes [#502](https://github.com/protobufjs/protobuf.js/issues/502)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/3c16e462a28c36abbc8a176eab9ac2e10ba68597) Remember loaded files earlier to prevent race conditions, fixes [#501](https://github.com/protobufjs/protobuf.js/issues/501)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4012a00a0578185d92fb6e7d3babd059fee6d6ab) Allow negative enum ids even if super inefficient (encodes as 10 bytes), fixes [#499](https://github.com/protobufjs/protobuf.js/issues/499), fixes [#500](https://github.com/protobufjs/protobuf.js/issues/500)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/96dd8f1729ad72e29dbe08dd01bc0ba08446dbe6) set resolvedResponseType on resolve(), fixes [#497](https://github.com/protobufjs/protobuf.js/issues/497)
    - -### New -[:hash:](https://github.com/protobufjs/protobuf.js/commit/d3ae961765e193ec11227d96d699463de346423f) Initial take on runtime services, see [#507](https://github.com/protobufjs/protobuf.js/issues/507)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/90cd46b3576ddb2d0a6fc6ae55da512db4be3acc) Include dist/ in npm package for frontend use
    - -### CLI -[:hash:](https://github.com/protobufjs/protobuf.js/commit/4affa1b7c0544229fb5f0d3948df6d832f6feadb) pbjs proto target field options, language-level compliance with jspb test.proto
    - -### Docs -[:hash:](https://github.com/protobufjs/protobuf.js/commit/6a06e95222d741c47a51bcec85cd20317de7c0b0) always use Uint8Array in docs for tsd, see [#503](https://github.com/protobufjs/protobuf.js/issues/503)
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/637698316e095fc35f62a304daaca22654974966) Notes on dist files
    - -### Other -[:hash:](https://github.com/protobufjs/protobuf.js/commit/29ff3f10e367d6a2ae15fb4254f4073541559c65) Update eslint env
    -[:hash:](https://github.com/protobufjs/protobuf.js/commit/943be1749c7d37945c11d1ebffbed9112c528d9f) Browser field in package.json isn't required
    diff --git a/node_modules/protobufjs/LICENSE b/node_modules/protobufjs/LICENSE deleted file mode 100644 index 57b7e309..00000000 --- a/node_modules/protobufjs/LICENSE +++ /dev/null @@ -1,39 +0,0 @@ -This license applies to all parts of protobuf.js except those files -either explicitly including or referencing a different license or -located in a directory containing a different LICENSE file. - ---- - -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---- - -Code generated by the command line utilities is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. diff --git a/node_modules/protobufjs/README.md b/node_modules/protobufjs/README.md deleted file mode 100644 index 70f3ae34..00000000 --- a/node_modules/protobufjs/README.md +++ /dev/null @@ -1,905 +0,0 @@ -

    protobuf.js

    -

    donate ❤

    - -**Protocol Buffers** are a language-neutral, platform-neutral, extensible way of serializing structured data for use in communications protocols, data storage, and more, originally designed at Google ([see](https://developers.google.com/protocol-buffers/)). - -**protobuf.js** is a pure JavaScript implementation with [TypeScript](https://www.typescriptlang.org) support for [node.js](https://nodejs.org) and the browser. It's easy to use, blazingly fast and works out of the box with [.proto](https://developers.google.com/protocol-buffers/docs/proto) files! - -Contents --------- - -* [Installation](#installation)
    - How to include protobuf.js in your project. - -* [Usage](#usage)
    - A brief introduction to using the toolset. - - * [Valid Message](#valid-message) - * [Toolset](#toolset)
    - -* [Examples](#examples)
    - A few examples to get you started. - - * [Using .proto files](#using-proto-files) - * [Using JSON descriptors](#using-json-descriptors) - * [Using reflection only](#using-reflection-only) - * [Using custom classes](#using-custom-classes) - * [Using services](#using-services) - * [Usage with TypeScript](#usage-with-typescript)
    - -* [Command line](#command-line)
    - How to use the command line utility. - - * [pbjs for JavaScript](#pbjs-for-javascript) - * [pbts for TypeScript](#pbts-for-typescript) - * [Reflection vs. static code](#reflection-vs-static-code) - * [Command line API](#command-line-api)
    - -* [Additional documentation](#additional-documentation)
    - A list of available documentation resources. - -* [Performance](#performance)
    - A few internals and a benchmark on performance. - -* [Compatibility](#compatibility)
    - Notes on compatibility regarding browsers and optional libraries. - -* [Building](#building)
    - How to build the library and its components yourself. - -Installation ---------------- - -### node.js - -``` -$> npm install protobufjs [--save --save-prefix=~] -``` - -```js -var protobuf = require("protobufjs"); -``` - -**Note** that this library's versioning scheme is not semver-compatible for historical reasons. For guaranteed backward compatibility, always depend on `~6.A.B` instead of `^6.A.B` (hence the `--save-prefix` above). - -### Browsers - -Development: - -``` - -``` - -Production: - -``` - -``` - -**Remember** to replace the version tag with the exact [release](https://github.com/dcodeIO/protobuf.js/tags) your project depends upon. - -The library supports CommonJS and AMD loaders and also exports globally as `protobuf`. - -### Distributions - -Where bundle size is a factor, there are additional stripped-down versions of the [full library][dist-full] (~19kb gzipped) available that exclude certain functionality: - -* When working with JSON descriptors (i.e. generated by [pbjs](#pbjs-for-javascript)) and/or reflection only, see the [light library][dist-light] (~16kb gzipped) that excludes the parser. CommonJS entry point is: - - ```js - var protobuf = require("protobufjs/light"); - ``` - -* When working with statically generated code only, see the [minimal library][dist-minimal] (~6.5kb gzipped) that also excludes reflection. CommonJS entry point is: - - ```js - var protobuf = require("protobufjs/minimal"); - ``` - -[dist-full]: https://github.com/dcodeIO/protobuf.js/tree/master/dist -[dist-light]: https://github.com/dcodeIO/protobuf.js/tree/master/dist/light -[dist-minimal]: https://github.com/dcodeIO/protobuf.js/tree/master/dist/minimal - -Usage ------ - -Because JavaScript is a dynamically typed language, protobuf.js introduces the concept of a **valid message** in order to provide the best possible [performance](#performance) (and, as a side product, proper typings): - -### Valid message - -> A valid message is an object (1) not missing any required fields and (2) exclusively composed of JS types understood by the wire format writer. - -There are two possible types of valid messages and the encoder is able to work with both of these for convenience: - -* **Message instances** (explicit instances of message classes with default values on their prototype) always (have to) satisfy the requirements of a valid message by design and -* **Plain JavaScript objects** that just so happen to be composed in a way satisfying the requirements of a valid message as well. - -In a nutshell, the wire format writer understands the following types: - -| Field type | Expected JS type (create, encode) | Conversion (fromObject) -|------------|-----------------------------------|------------------------ -| s-/u-/int32
    s-/fixed32 | `number` (32 bit integer) | value | 0 if signed
    `value >>> 0` if unsigned -| s-/u-/int64
    s-/fixed64 | `Long`-like (optimal)
    `number` (53 bit integer) | `Long.fromValue(value)` with long.js
    `parseInt(value, 10)` otherwise -| float
    double | `number` | `Number(value)` -| bool | `boolean` | `Boolean(value)` -| string | `string` | `String(value)` -| bytes | `Uint8Array` (optimal)
    `Buffer` (optimal under node)
    `Array.` (8 bit integers) | `base64.decode(value)` if a `string`
    `Object` with non-zero `.length` is assumed to be buffer-like -| enum | `number` (32 bit integer) | Looks up the numeric id if a `string` -| message | Valid message | `Message.fromObject(value)` - -* Explicit `undefined` and `null` are considered as not set if the field is optional. -* Repeated fields are `Array.`. -* Map fields are `Object.` with the key being the string representation of the respective value or an 8 characters long binary hash string for `Long`-likes. -* Types marked as *optimal* provide the best performance because no conversion step (i.e. number to low and high bits or base64 string to buffer) is required. - -### Toolset - -With that in mind and again for performance reasons, each message class provides a distinct set of methods with each method doing just one thing. This avoids unnecessary assertions / redundant operations where performance is a concern but also forces a user to perform verification (of plain JavaScript objects that *might* just so happen to be a valid message) explicitly where necessary - for example when dealing with user input. - -**Note** that `Message` below refers to any message class. - -* **Message.verify**(message: `Object`): `null|string`
    - verifies that a **plain JavaScript object** satisfies the requirements of a valid message and thus can be encoded without issues. Instead of throwing, it returns the error message as a string, if any. - - ```js - var payload = "invalid (not an object)"; - var err = AwesomeMessage.verify(payload); - if (err) - throw Error(err); - ``` - -* **Message.encode**(message: `Message|Object` [, writer: `Writer`]): `Writer`
    - encodes a **message instance** or valid **plain JavaScript object**. This method does not implicitly verify the message and it's up to the user to make sure that the payload is a valid message. - - ```js - var buffer = AwesomeMessage.encode(message).finish(); - ``` - -* **Message.encodeDelimited**(message: `Message|Object` [, writer: `Writer`]): `Writer`
    - works like `Message.encode` but additionally prepends the length of the message as a varint. - -* **Message.decode**(reader: `Reader|Uint8Array`): `Message`
    - decodes a buffer to a **message instance**. If required fields are missing, it throws a `util.ProtocolError` with an `instance` property set to the so far decoded message. If the wire format is invalid, it throws an `Error`. - - ```js - try { - var decodedMessage = AwesomeMessage.decode(buffer); - } catch (e) { - if (e instanceof protobuf.util.ProtocolError) { - // e.instance holds the so far decoded message with missing required fields - } else { - // wire format is invalid - } - } - ``` - -* **Message.decodeDelimited**(reader: `Reader|Uint8Array`): `Message`
    - works like `Message.decode` but additionally reads the length of the message prepended as a varint. - -* **Message.create**(properties: `Object`): `Message`
    - creates a new **message instance** from a set of properties that satisfy the requirements of a valid message. Where applicable, it is recommended to prefer `Message.create` over `Message.fromObject` because it doesn't perform possibly redundant conversion. - - ```js - var message = AwesomeMessage.create({ awesomeField: "AwesomeString" }); - ``` - -* **Message.fromObject**(object: `Object`): `Message`
    - converts any non-valid **plain JavaScript object** to a **message instance** using the conversion steps outlined within the table above. - - ```js - var message = AwesomeMessage.fromObject({ awesomeField: 42 }); - // converts awesomeField to a string - ``` - -* **Message.toObject**(message: `Message` [, options: `ConversionOptions`]): `Object`
    - converts a **message instance** to an arbitrary **plain JavaScript object** for interoperability with other libraries or storage. The resulting plain JavaScript object *might* still satisfy the requirements of a valid message depending on the actual conversion options specified, but most of the time it does not. - - ```js - var object = AwesomeMessage.toObject(message, { - enums: String, // enums as string names - longs: String, // longs as strings (requires long.js) - bytes: String, // bytes as base64 encoded strings - defaults: true, // includes default values - arrays: true, // populates empty arrays (repeated fields) even if defaults=false - objects: true, // populates empty objects (map fields) even if defaults=false - oneofs: true // includes virtual oneof fields set to the present field's name - }); - ``` - -For reference, the following diagram aims to display relationships between the different methods and the concept of a valid message: - -

    Toolset Diagram

    - -> In other words: `verify` indicates that calling `create` or `encode` directly on the plain object will [result in a valid message respectively] succeed. `fromObject`, on the other hand, does conversion from a broader range of plain objects to create valid messages. ([ref](https://github.com/dcodeIO/protobuf.js/issues/748#issuecomment-291925749)) - -Examples --------- - -### Using .proto files - -It is possible to load existing .proto files using the full library, which parses and compiles the definitions to ready to use (reflection-based) message classes: - -```protobuf -// awesome.proto -package awesomepackage; -syntax = "proto3"; - -message AwesomeMessage { - string awesome_field = 1; // becomes awesomeField -} -``` - -```js -protobuf.load("awesome.proto", function(err, root) { - if (err) - throw err; - - // Obtain a message type - var AwesomeMessage = root.lookupType("awesomepackage.AwesomeMessage"); - - // Exemplary payload - var payload = { awesomeField: "AwesomeString" }; - - // Verify the payload if necessary (i.e. when possibly incomplete or invalid) - var errMsg = AwesomeMessage.verify(payload); - if (errMsg) - throw Error(errMsg); - - // Create a new message - var message = AwesomeMessage.create(payload); // or use .fromObject if conversion is necessary - - // Encode a message to an Uint8Array (browser) or Buffer (node) - var buffer = AwesomeMessage.encode(message).finish(); - // ... do something with buffer - - // Decode an Uint8Array (browser) or Buffer (node) to a message - var message = AwesomeMessage.decode(buffer); - // ... do something with message - - // If the application uses length-delimited buffers, there is also encodeDelimited and decodeDelimited. - - // Maybe convert the message back to a plain object - var object = AwesomeMessage.toObject(message, { - longs: String, - enums: String, - bytes: String, - // see ConversionOptions - }); -}); -``` - -Additionally, promise syntax can be used by omitting the callback, if preferred: - -```js -protobuf.load("awesome.proto") - .then(function(root) { - ... - }); -``` - -### Using JSON descriptors - -The library utilizes JSON descriptors that are equivalent to a .proto definition. For example, the following is identical to the .proto definition seen above: - -```json -// awesome.json -{ - "nested": { - "awesomepackage": { - "nested": { - "AwesomeMessage": { - "fields": { - "awesomeField": { - "type": "string", - "id": 1 - } - } - } - } - } - } -} -``` - -JSON descriptors closely resemble the internal reflection structure: - -| Type (T) | Extends | Type-specific properties -|--------------------|--------------------|------------------------- -| *ReflectionObject* | | options -| *Namespace* | *ReflectionObject* | nested -| Root | *Namespace* | **nested** -| Type | *Namespace* | **fields** -| Enum | *ReflectionObject* | **values** -| Field | *ReflectionObject* | rule, **type**, **id** -| MapField | Field | **keyType** -| OneOf | *ReflectionObject* | **oneof** (array of field names) -| Service | *Namespace* | **methods** -| Method | *ReflectionObject* | type, **requestType**, **responseType**, requestStream, responseStream - -* **Bold properties** are required. *Italic types* are abstract. -* `T.fromJSON(name, json)` creates the respective reflection object from a JSON descriptor -* `T#toJSON()` creates a JSON descriptor from the respective reflection object (its name is used as the key within the parent) - -Exclusively using JSON descriptors instead of .proto files enables the use of just the light library (the parser isn't required in this case). - -A JSON descriptor can either be loaded the usual way: - -```js -protobuf.load("awesome.json", function(err, root) { - if (err) throw err; - - // Continue at "Obtain a message type" above -}); -``` - -Or it can be loaded inline: - -```js -var jsonDescriptor = require("./awesome.json"); // exemplary for node - -var root = protobuf.Root.fromJSON(jsonDescriptor); - -// Continue at "Obtain a message type" above -``` - -### Using reflection only - -Both the full and the light library include full reflection support. One could, for example, define the .proto definitions seen in the examples above using just reflection: - -```js -... -var Root = protobuf.Root, - Type = protobuf.Type, - Field = protobuf.Field; - -var AwesomeMessage = new Type("AwesomeMessage").add(new Field("awesomeField", 1, "string")); - -var root = new Root().define("awesomepackage").add(AwesomeMessage); - -// Continue at "Create a new message" above -... -``` - -Detailed information on the reflection structure is available within the [API documentation](#additional-documentation). - -### Using custom classes - -Message classes can also be extended with custom functionality and it is also possible to register a custom constructor with a reflected message type: - -```js -... - -// Define a custom constructor -function AwesomeMessage(properties) { - // custom initialization code - ... -} - -// Register the custom constructor with its reflected type (*) -root.lookupType("awesomepackage.AwesomeMessage").ctor = AwesomeMessage; - -// Define custom functionality -AwesomeMessage.customStaticMethod = function() { ... }; -AwesomeMessage.prototype.customInstanceMethod = function() { ... }; - -// Continue at "Create a new message" above -``` - -(*) Besides referencing its reflected type through `AwesomeMessage.$type` and `AwesomeMesage#$type`, the respective custom class is automatically populated with: - -* `AwesomeMessage.create` -* `AwesomeMessage.encode` and `AwesomeMessage.encodeDelimited` -* `AwesomeMessage.decode` and `AwesomeMessage.decodeDelimited` -* `AwesomeMessage.verify` -* `AwesomeMessage.fromObject`, `AwesomeMessage.toObject` and `AwesomeMessage#toJSON` - -Afterwards, decoded messages of this type are `instanceof AwesomeMessage`. - -Alternatively, it is also possible to reuse and extend the internal constructor if custom initialization code is not required: - -```js -... - -// Reuse the internal constructor -var AwesomeMessage = root.lookupType("awesomepackage.AwesomeMessage").ctor; - -// Define custom functionality -AwesomeMessage.customStaticMethod = function() { ... }; -AwesomeMessage.prototype.customInstanceMethod = function() { ... }; - -// Continue at "Create a new message" above -``` - -### Using services - -The library also supports consuming services but it doesn't make any assumptions about the actual transport channel. Instead, a user must provide a suitable RPC implementation, which is an asynchronous function that takes the reflected service method, the binary request and a node-style callback as its parameters: - -```js -function rpcImpl(method, requestData, callback) { - // perform the request using an HTTP request or a WebSocket for example - var responseData = ...; - // and call the callback with the binary response afterwards: - callback(null, responseData); -} -``` - -Below is a working example with a typescript implementation using grpc npm package. -```ts -const grpc = require('grpc') - -const Client = grpc.makeGenericClientConstructor({}) -const client = new Client( - grpcServerUrl, - grpc.credentials.createInsecure() -) - -const rpcImpl = function(method, requestData, callback) { - client.makeUnaryRequest( - method.name, - arg => arg, - arg => arg, - requestData, - callback - ) -} -``` - -Example: - -```protobuf -// greeter.proto -syntax = "proto3"; - -service Greeter { - rpc SayHello (HelloRequest) returns (HelloReply) {} -} - -message HelloRequest { - string name = 1; -} - -message HelloReply { - string message = 1; -} -``` - -```js -... -var Greeter = root.lookup("Greeter"); -var greeter = Greeter.create(/* see above */ rpcImpl, /* request delimited? */ false, /* response delimited? */ false); - -greeter.sayHello({ name: 'you' }, function(err, response) { - console.log('Greeting:', response.message); -}); -``` - -Services also support promises: - -```js -greeter.sayHello({ name: 'you' }) - .then(function(response) { - console.log('Greeting:', response.message); - }); -``` - -There is also an [example for streaming RPC](https://github.com/dcodeIO/protobuf.js/blob/master/examples/streaming-rpc.js). - -Note that the service API is meant for clients. Implementing a server-side endpoint pretty much always requires transport channel (i.e. http, websocket, etc.) specific code with the only common denominator being that it decodes and encodes messages. - -### Usage with TypeScript - -The library ships with its own [type definitions](https://github.com/dcodeIO/protobuf.js/blob/master/index.d.ts) and modern editors like [Visual Studio Code](https://code.visualstudio.com/) will automatically detect and use them for code completion. - -The npm package depends on [@types/node](https://www.npmjs.com/package/@types/node) because of `Buffer` and [@types/long](https://www.npmjs.com/package/@types/long) because of `Long`. If you are not building for node and/or not using long.js, it should be safe to exclude them manually. - -#### Using the JS API - -The API shown above works pretty much the same with TypeScript. However, because everything is typed, accessing fields on instances of dynamically generated message classes requires either using bracket-notation (i.e. `message["awesomeField"]`) or explicit casts. Alternatively, it is possible to use a [typings file generated for its static counterpart](#pbts-for-typescript). - -```ts -import { load } from "protobufjs"; // respectively "./node_modules/protobufjs" - -load("awesome.proto", function(err, root) { - if (err) - throw err; - - // example code - const AwesomeMessage = root.lookupType("awesomepackage.AwesomeMessage"); - - let message = AwesomeMessage.create({ awesomeField: "hello" }); - console.log(`message = ${JSON.stringify(message)}`); - - let buffer = AwesomeMessage.encode(message).finish(); - console.log(`buffer = ${Array.prototype.toString.call(buffer)}`); - - let decoded = AwesomeMessage.decode(buffer); - console.log(`decoded = ${JSON.stringify(decoded)}`); -}); -``` - -#### Using generated static code - -If you generated static code to `bundle.js` using the CLI and its type definitions to `bundle.d.ts`, then you can just do: - -```ts -import { AwesomeMessage } from "./bundle.js"; - -// example code -let message = AwesomeMessage.create({ awesomeField: "hello" }); -let buffer = AwesomeMessage.encode(message).finish(); -let decoded = AwesomeMessage.decode(buffer); -``` - -#### Using decorators - -The library also includes an early implementation of [decorators](https://www.typescriptlang.org/docs/handbook/decorators.html). - -**Note** that decorators are an experimental feature in TypeScript and that declaration order is important depending on the JS target. For example, `@Field.d(2, AwesomeArrayMessage)` requires that `AwesomeArrayMessage` has been defined earlier when targeting `ES5`. - -```ts -import { Message, Type, Field, OneOf } from "protobufjs/light"; // respectively "./node_modules/protobufjs/light.js" - -export class AwesomeSubMessage extends Message { - - @Field.d(1, "string") - public awesomeString: string; - -} - -export enum AwesomeEnum { - ONE = 1, - TWO = 2 -} - -@Type.d("SuperAwesomeMessage") -export class AwesomeMessage extends Message { - - @Field.d(1, "string", "optional", "awesome default string") - public awesomeField: string; - - @Field.d(2, AwesomeSubMessage) - public awesomeSubMessage: AwesomeSubMessage; - - @Field.d(3, AwesomeEnum, "optional", AwesomeEnum.ONE) - public awesomeEnum: AwesomeEnum; - - @OneOf.d("awesomeSubMessage", "awesomeEnum") - public which: string; - -} - -// example code -let message = new AwesomeMessage({ awesomeField: "hello" }); -let buffer = AwesomeMessage.encode(message).finish(); -let decoded = AwesomeMessage.decode(buffer); -``` - -Supported decorators are: - -* **Type.d(typeName?: `string`)**   *(optional)*
    - annotates a class as a protobuf message type. If `typeName` is not specified, the constructor's runtime function name is used for the reflected type. - -* **Field.d<T>(fieldId: `number`, fieldType: `string | Constructor`, fieldRule?: `"optional" | "required" | "repeated"`, defaultValue?: `T`)**
    - annotates a property as a protobuf field with the specified id and protobuf type. - -* **MapField.d<T extends { [key: string]: any }>(fieldId: `number`, fieldKeyType: `string`, fieldValueType. `string | Constructor<{}>`)**
    - annotates a property as a protobuf map field with the specified id, protobuf key and value type. - -* **OneOf.d<T extends string>(...fieldNames: `string[]`)**
    - annotates a property as a protobuf oneof covering the specified fields. - -Other notes: - -* Decorated types reside in `protobuf.roots["decorated"]` using a flat structure, so no duplicate names. -* Enums are copied to a reflected enum with a generic name on decorator evaluation because referenced enum objects have no runtime name the decorator could use. -* Default values must be specified as arguments to the decorator instead of using a property initializer for proper prototype behavior. -* Property names on decorated classes must not be renamed on compile time (i.e. by a minifier) because decorators just receive the original field name as a string. - -**ProTip!** Not as pretty, but you can [use decorators in plain JavaScript](https://github.com/dcodeIO/protobuf.js/blob/master/examples/js-decorators.js) as well. - -Command line ------------- - -**Note** that moving the CLI to [its own package](./cli) is a work in progress. At the moment, it's still part of the main package. - -The command line interface (CLI) can be used to translate between file formats and to generate static code as well as TypeScript definitions. - -### pbjs for JavaScript - -``` -Translates between file formats and generates static code. - - -t, --target Specifies the target format. Also accepts a path to require a custom target. - - json JSON representation - json-module JSON representation as a module - proto2 Protocol Buffers, Version 2 - proto3 Protocol Buffers, Version 3 - static Static code without reflection (non-functional on its own) - static-module Static code without reflection as a module - - -p, --path Adds a directory to the include path. - - -o, --out Saves to a file instead of writing to stdout. - - --sparse Exports only those types referenced from a main file (experimental). - - Module targets only: - - -w, --wrap Specifies the wrapper to use. Also accepts a path to require a custom wrapper. - - default Default wrapper supporting both CommonJS and AMD - commonjs CommonJS wrapper - amd AMD wrapper - es6 ES6 wrapper (implies --es6) - closure A closure adding to protobuf.roots where protobuf is a global - - -r, --root Specifies an alternative protobuf.roots name. - - -l, --lint Linter configuration. Defaults to protobuf.js-compatible rules: - - eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins - - --es6 Enables ES6 syntax (const/let instead of var) - - Proto sources only: - - --keep-case Keeps field casing instead of converting to camel case. - - Static targets only: - - --no-create Does not generate create functions used for reflection compatibility. - --no-encode Does not generate encode functions. - --no-decode Does not generate decode functions. - --no-verify Does not generate verify functions. - --no-convert Does not generate convert functions like from/toObject - --no-delimited Does not generate delimited encode/decode functions. - --no-beautify Does not beautify generated code. - --no-comments Does not output any JSDoc comments. - - --force-long Enforces the use of 'Long' for s-/u-/int64 and s-/fixed64 fields. - --force-number Enforces the use of 'number' for s-/u-/int64 and s-/fixed64 fields. - --force-message Enforces the use of message instances instead of plain objects. - -usage: pbjs [options] file1.proto file2.json ... (or pipe) other | pbjs [options] - -``` - -For production environments it is recommended to bundle all your .proto files to a single .json file, which minimizes the number of network requests and avoids any parser overhead (hint: works with just the **light** library): - -``` -$> pbjs -t json file1.proto file2.proto > bundle.json -``` - -Now, either include this file in your final bundle: - -```js -var root = protobuf.Root.fromJSON(require("./bundle.json")); -``` - -or load it the usual way: - -```js -protobuf.load("bundle.json", function(err, root) { - ... -}); -``` - -Generated static code, on the other hand, works with just the **minimal** library. For example - -``` -$> pbjs -t static-module -w commonjs -o compiled.js file1.proto file2.proto -``` - -will generate static code for definitions within `file1.proto` and `file2.proto` to a CommonJS module `compiled.js`. - -**ProTip!** Documenting your .proto files with `/** ... */`-blocks or (trailing) `/// ...` lines translates to generated static code. - - -### pbts for TypeScript - -``` -Generates TypeScript definitions from annotated JavaScript files. - - -o, --out Saves to a file instead of writing to stdout. - - -g, --global Name of the global object in browser environments, if any. - - --no-comments Does not output any JSDoc comments. - - Internal flags: - - -n, --name Wraps everything in a module of the specified name. - - -m, --main Whether building the main library without any imports. - -usage: pbts [options] file1.js file2.js ... (or) other | pbts [options] - -``` - -Picking up on the example above, the following not only generates static code to a CommonJS module `compiled.js` but also its respective TypeScript definitions to `compiled.d.ts`: - -``` -$> pbjs -t static-module -w commonjs -o compiled.js file1.proto file2.proto -$> pbts -o compiled.d.ts compiled.js -``` - -Additionally, TypeScript definitions of static modules are compatible with their reflection-based counterparts (i.e. as exported by JSON modules), as long as the following conditions are met: - -1. Instead of using `new SomeMessage(...)`, always use `SomeMessage.create(...)` because reflection objects do not provide a constructor. -2. Types, services and enums must start with an uppercase letter to become available as properties of the reflected types as well (i.e. to be able to use `MyMessage.MyEnum` instead of `root.lookup("MyMessage.MyEnum")`). - -For example, the following generates a JSON module `bundle.js` and a `bundle.d.ts`, but no static code: - -``` -$> pbjs -t json-module -w commonjs -o bundle.js file1.proto file2.proto -$> pbjs -t static-module file1.proto file2.proto | pbts -o bundle.d.ts - -``` - -### Reflection vs. static code - -While using .proto files directly requires the full library respectively pure reflection/JSON the light library, pretty much all code but the relatively short descriptors is shared. - -Static code, on the other hand, requires just the minimal library, but generates additional source code without any reflection features. This also implies that there is a break-even point where statically generated code becomes larger than descriptor-based code once the amount of code generated exceeds the size of the full respectively light library. - -There is no significant difference performance-wise as the code generated statically is pretty much the same as generated at runtime and both are largely interchangeable as seen in the previous section. - -| Source | Library | Advantages | Tradeoffs -|--------|---------|------------|----------- -| .proto | full | Easily editable
    Interoperability with other libraries
    No compile step | Some parsing and possibly network overhead -| JSON | light | Easily editable
    No parsing overhead
    Single bundle (no network overhead) | protobuf.js specific
    Has a compile step -| static | minimal | Works where `eval` access is restricted
    Fully documented
    Small footprint for small protos | Can be hard to edit
    No reflection
    Has a compile step - -### Command line API - -Both utilities can be used programmatically by providing command line arguments and a callback to their respective `main` functions: - -```js -var pbjs = require("protobufjs/cli/pbjs"); // or require("protobufjs/cli").pbjs / .pbts - -pbjs.main([ "--target", "json-module", "path/to/myproto.proto" ], function(err, output) { - if (err) - throw err; - // do something with output -}); -``` - -Additional documentation ------------------------- - -#### Protocol Buffers -* [Google's Developer Guide](https://developers.google.com/protocol-buffers/docs/overview) - -#### protobuf.js -* [API Documentation](https://protobufjs.github.io/protobuf.js) -* [CHANGELOG](https://github.com/dcodeIO/protobuf.js/blob/master/CHANGELOG.md) -* [Frequently asked questions](https://github.com/dcodeIO/protobuf.js/wiki) on our wiki - -#### Community -* [Questions and answers](http://stackoverflow.com/search?tab=newest&q=protobuf.js) on StackOverflow - -Performance ------------ -The package includes a benchmark that compares protobuf.js performance to native JSON (as far as this is possible) and [Google's JS implementation](https://github.com/google/protobuf/tree/master/js). On an i7-2600K running node 6.9.1 it yields: - -``` -benchmarking encoding performance ... - -protobuf.js (reflect) x 541,707 ops/sec ±1.13% (87 runs sampled) -protobuf.js (static) x 548,134 ops/sec ±1.38% (89 runs sampled) -JSON (string) x 318,076 ops/sec ±0.63% (93 runs sampled) -JSON (buffer) x 179,165 ops/sec ±2.26% (91 runs sampled) -google-protobuf x 74,406 ops/sec ±0.85% (86 runs sampled) - - protobuf.js (static) was fastest - protobuf.js (reflect) was 0.9% ops/sec slower (factor 1.0) - JSON (string) was 41.5% ops/sec slower (factor 1.7) - JSON (buffer) was 67.6% ops/sec slower (factor 3.1) - google-protobuf was 86.4% ops/sec slower (factor 7.3) - -benchmarking decoding performance ... - -protobuf.js (reflect) x 1,383,981 ops/sec ±0.88% (93 runs sampled) -protobuf.js (static) x 1,378,925 ops/sec ±0.81% (93 runs sampled) -JSON (string) x 302,444 ops/sec ±0.81% (93 runs sampled) -JSON (buffer) x 264,882 ops/sec ±0.81% (93 runs sampled) -google-protobuf x 179,180 ops/sec ±0.64% (94 runs sampled) - - protobuf.js (reflect) was fastest - protobuf.js (static) was 0.3% ops/sec slower (factor 1.0) - JSON (string) was 78.1% ops/sec slower (factor 4.6) - JSON (buffer) was 80.8% ops/sec slower (factor 5.2) - google-protobuf was 87.0% ops/sec slower (factor 7.7) - -benchmarking combined performance ... - -protobuf.js (reflect) x 275,900 ops/sec ±0.78% (90 runs sampled) -protobuf.js (static) x 290,096 ops/sec ±0.96% (90 runs sampled) -JSON (string) x 129,381 ops/sec ±0.77% (90 runs sampled) -JSON (buffer) x 91,051 ops/sec ±0.94% (90 runs sampled) -google-protobuf x 42,050 ops/sec ±0.85% (91 runs sampled) - - protobuf.js (static) was fastest - protobuf.js (reflect) was 4.7% ops/sec slower (factor 1.0) - JSON (string) was 55.3% ops/sec slower (factor 2.2) - JSON (buffer) was 68.6% ops/sec slower (factor 3.2) - google-protobuf was 85.5% ops/sec slower (factor 6.9) -``` - -These results are achieved by - -* generating type-specific encoders, decoders, verifiers and converters at runtime -* configuring the reader/writer interface according to the environment -* using node-specific functionality where beneficial and, of course -* avoiding unnecessary operations through splitting up [the toolset](#toolset). - -You can also run [the benchmark](https://github.com/dcodeIO/protobuf.js/blob/master/bench/index.js) ... - -``` -$> npm run bench -``` - -and [the profiler](https://github.com/dcodeIO/protobuf.js/blob/master/bench/prof.js) yourself (the latter requires a recent version of node): - -``` -$> npm run prof [iterations=10000000] -``` - -Note that as of this writing, the benchmark suite performs significantly slower on node 7.2.0 compared to 6.9.1 because moths. - -Compatibility -------------- - -* Works in all modern and not-so-modern browsers except IE8. -* Because the internals of this package do not rely on `google/protobuf/descriptor.proto`, options are parsed and presented literally. -* If typed arrays are not supported by the environment, plain arrays will be used instead. -* Support for pre-ES5 environments (except IE8) can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js). -* Support for [Content Security Policy](https://w3c.github.io/webappsec-csp/)-restricted environments (like Chrome extensions without [unsafe-eval](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval)) can be achieved by generating and using static code instead. -* If a proper way to work with 64 bit values (uint64, int64 etc.) is required, just install [long.js](https://github.com/dcodeIO/long.js) alongside this library. All 64 bit numbers will then be returned as a `Long` instance instead of a possibly unsafe JavaScript number ([see](https://github.com/dcodeIO/long.js)). -* For descriptor.proto interoperability, see [ext/descriptor](https://github.com/dcodeIO/protobuf.js/tree/master/ext/descriptor) - -Building --------- - -To build the library or its components yourself, clone it from GitHub and install the development dependencies: - -``` -$> git clone https://github.com/dcodeIO/protobuf.js.git -$> cd protobuf.js -$> npm install -``` - -Building the respective development and production versions with their respective source maps to `dist/`: - -``` -$> npm run build -``` - -Building the documentation to `docs/`: - -``` -$> npm run docs -``` - -Building the TypeScript definition to `index.d.ts`: - -``` -$> npm run types -``` - -### Browserify integration - -By default, protobuf.js integrates into any browserify build-process without requiring any optional modules. Hence: - -* If int64 support is required, explicitly require the `long` module somewhere in your project as it will be excluded otherwise. This assumes that a global `require` function is present that protobuf.js can call to obtain the long module. - - If there is no global `require` function present after bundling, it's also possible to assign the long module programmatically: - - ```js - var Long = ...; - - protobuf.util.Long = Long; - protobuf.configure(); - ``` - -* If you have any special requirements, there is [the bundler](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/bundle.js) for reference. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/protobufjs/bin/pbjs b/node_modules/protobufjs/bin/pbjs deleted file mode 100644 index 6a5d49ad..00000000 --- a/node_modules/protobufjs/bin/pbjs +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -var path = require("path"), - cli = require(path.join(__dirname, "..", "cli", "pbjs.js")); -var ret = cli.main(process.argv.slice(2)); -if (typeof ret === 'number') - process.exit(ret); diff --git a/node_modules/protobufjs/bin/pbts b/node_modules/protobufjs/bin/pbts deleted file mode 100644 index cb1cdaf5..00000000 --- a/node_modules/protobufjs/bin/pbts +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -var path = require("path"), - cli = require(path.join(__dirname, "..", "cli", "pbts.js")); -var ret = cli.main(process.argv.slice(2)); -if (typeof ret === 'number') - process.exit(ret); diff --git a/node_modules/protobufjs/cli/LICENSE b/node_modules/protobufjs/cli/LICENSE deleted file mode 100644 index e5f7a5c9..00000000 --- a/node_modules/protobufjs/cli/LICENSE +++ /dev/null @@ -1,33 +0,0 @@ -Copyright (c) 2016, Daniel Wirtz All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of its author, nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---- - -Code generated by the command line utilities is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. diff --git a/node_modules/protobufjs/cli/README.md b/node_modules/protobufjs/cli/README.md deleted file mode 100644 index 1eb4c868..00000000 --- a/node_modules/protobufjs/cli/README.md +++ /dev/null @@ -1,11 +0,0 @@ -protobufjs-cli -============== -[![npm](https://img.shields.io/npm/v/protobufjscli.svg)](https://www.npmjs.com/package/protobufjs-cli) - -Command line interface (CLI) for [protobuf.js](https://github.com/dcodeIO/protobuf.js). Translates between file formats and generates static code as well as TypeScript definitions. - -* [CLI Documentation](https://github.com/dcodeIO/protobuf.js#command-line) - -**Note** that moving the CLI to its own package is a work in progress. At the moment, it's still part of the main package. - -**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) diff --git a/node_modules/protobufjs/cli/bin/pbjs b/node_modules/protobufjs/cli/bin/pbjs deleted file mode 100644 index 9bfedb31..00000000 --- a/node_modules/protobufjs/cli/bin/pbjs +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -var path = require("path"), - cli = require(path.join(__dirname, "..", "pbjs.js")); -var ret = cli.main(process.argv.slice(2)); -if (typeof ret === 'number') - process.exit(ret); diff --git a/node_modules/protobufjs/cli/bin/pbts b/node_modules/protobufjs/cli/bin/pbts deleted file mode 100644 index 48d392c3..00000000 --- a/node_modules/protobufjs/cli/bin/pbts +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -var path = require("path"), - cli = require(path.join(__dirname, "..", "pbts.js")); -var ret = cli.main(process.argv.slice(2)); -if (typeof ret === 'number') - process.exit(ret); diff --git a/node_modules/protobufjs/cli/index.d.ts b/node_modules/protobufjs/cli/index.d.ts deleted file mode 100644 index 09c20269..00000000 --- a/node_modules/protobufjs/cli/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as pbjs from "./pbjs.js"; -import * as pbts from "./pbts.js"; -export { pbjs, pbts }; diff --git a/node_modules/protobufjs/cli/index.js b/node_modules/protobufjs/cli/index.js deleted file mode 100644 index c565aa6f..00000000 --- a/node_modules/protobufjs/cli/index.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -exports.pbjs = require("./pbjs"); -exports.pbts = require("./pbts"); diff --git a/node_modules/protobufjs/cli/lib/tsd-jsdoc.json b/node_modules/protobufjs/cli/lib/tsd-jsdoc.json deleted file mode 100644 index b5fe1d90..00000000 --- a/node_modules/protobufjs/cli/lib/tsd-jsdoc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "tags": { - "allowUnknownTags": false - }, - "plugins": [ - "./tsd-jsdoc/plugin" - ], - "opts": { - "encoding" : "utf8", - "recurse" : true, - "lenient" : true, - "template" : "./tsd-jsdoc", - - "private" : false, - "comments" : true, - "destination" : false - } -} diff --git a/node_modules/protobufjs/cli/lib/tsd-jsdoc/LICENSE b/node_modules/protobufjs/cli/lib/tsd-jsdoc/LICENSE deleted file mode 100644 index e5aebc9f..00000000 --- a/node_modules/protobufjs/cli/lib/tsd-jsdoc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2016 Chad Engler - -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. \ No newline at end of file diff --git a/node_modules/protobufjs/cli/lib/tsd-jsdoc/README.md b/node_modules/protobufjs/cli/lib/tsd-jsdoc/README.md deleted file mode 100644 index beed748f..00000000 --- a/node_modules/protobufjs/cli/lib/tsd-jsdoc/README.md +++ /dev/null @@ -1,23 +0,0 @@ -protobuf.js fork of tsd-jsdoc -============================= - -This is a modified version of [tsd-jsdoc](https://github.com/englercj/tsd-jsdoc) v1.0.1 for use with protobuf.js, parked here so we can process issues and pull requests. The ultimate goal is to switch back to the a recent version of tsd-jsdoc once it meets our needs. - -Options -------- - -* **module: `string`**
    - Wraps everything in a module of the specified name. - -* **private: `boolean`**
    - Includes private members when set to `true`. - -* **comments: `boolean`**
    - Skips comments when explicitly set to `false`. - -* **destination: `string|boolean`**
    - Saves to the specified destination file or to console when set to `false`. - -Setting options on the command line ------------------------------------ -Providing `-q, --query ` on the command line will set respectively override existing options. Example: `-q module=protobufjs` diff --git a/node_modules/protobufjs/cli/lib/tsd-jsdoc/plugin.js b/node_modules/protobufjs/cli/lib/tsd-jsdoc/plugin.js deleted file mode 100644 index 1bf4f42f..00000000 --- a/node_modules/protobufjs/cli/lib/tsd-jsdoc/plugin.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -exports.defineTags = function(dictionary) { - - dictionary.defineTag("template", { - mustHaveValue: true, - canHaveType: false, - canHaveName: false, - onTagged: function(doclet, tag) { - (doclet.templates || (doclet.templates = [])).push(tag.text); - } - }); - - dictionary.defineTag("tstype", { - mustHaveValue: true, - canHaveType: false, - canHaveName: false, - onTagged: function(doclet, tag) { - doclet.tsType = tag.text; - } - }); -}; diff --git a/node_modules/protobufjs/cli/lib/tsd-jsdoc/publish.js b/node_modules/protobufjs/cli/lib/tsd-jsdoc/publish.js deleted file mode 100644 index 3846a992..00000000 --- a/node_modules/protobufjs/cli/lib/tsd-jsdoc/publish.js +++ /dev/null @@ -1,705 +0,0 @@ -"use strict"; - -var fs = require("fs"); - -// output stream -var out = null; - -// documentation data -var data = null; - -// already handled objects, by name -var seen = {}; - -// indentation level -var indent = 0; - -// whether indent has been written for the current line yet -var indentWritten = false; - -// provided options -var options = {}; - -// queued interfaces -var queuedInterfaces = []; - -// whether writing the first line -var firstLine = true; - -// JSDoc hook -exports.publish = function publish(taffy, opts) { - options = opts || {}; - - // query overrides options - if (options.query) - Object.keys(options.query).forEach(function(key) { - if (key !== "query") - switch (options[key] = options.query[key]) { - case "true": - options[key] = true; - break; - case "false": - options[key] = false; - break; - case "null": - options[key] = null; - break; - } - }); - - // remove undocumented - taffy({ undocumented: true }).remove(); - taffy({ ignore: true }).remove(); - taffy({ inherited: true }).remove(); - - // remove private - if (!options.private) - taffy({ access: "private" }).remove(); - - // setup output - out = options.destination - ? fs.createWriteStream(options.destination) - : process.stdout; - - try { - // setup environment - data = taffy().get(); - indent = 0; - indentWritten = false; - firstLine = true; - - // wrap everything in a module if configured - if (options.module) { - writeln("export = ", options.module, ";"); - writeln(); - writeln("declare namespace ", options.module, " {"); - writeln(); - ++indent; - } - - // handle all - getChildrenOf(undefined).forEach(function(child) { - handleElement(child, null); - }); - - // process queued - while (queuedInterfaces.length) { - var element = queuedInterfaces.shift(); - begin(element); - writeInterface(element); - writeln(";"); - } - - // end wrap - if (options.module) { - --indent; - writeln("}"); - } - - // close file output - if (out !== process.stdout) - out.end(); - - } finally { - // gc environment objects - out = data = null; - seen = options = {}; - queuedInterfaces = []; - } -}; - -// -// Utility -// - -// writes one or multiple strings -function write() { - var s = Array.prototype.slice.call(arguments).join(""); - if (!indentWritten) { - for (var i = 0; i < indent; ++i) - s = " " + s; - indentWritten = true; - } - out.write(s); - firstLine = false; -} - -// writes zero or multiple strings, followed by a new line -function writeln() { - var s = Array.prototype.slice.call(arguments).join(""); - if (s.length) - write(s, "\n"); - else if (!firstLine) - out.write("\n"); - indentWritten = false; -} - -var keepTags = [ - "param", - "returns", - "throws", - "see" -]; - -// parses a comment into text and tags -function parseComment(comment) { - var lines = comment.replace(/^ *\/\*\* *|^ *\*\/| *\*\/ *$|^ *\* */mg, "").trim().split(/\r?\n|\r/g); // property.description has just "\r" ?! - var desc; - var text = []; - var tags = null; - for (var i = 0; i < lines.length; ++i) { - var match = /^@(\w+)\b/.exec(lines[i]); - if (match) { - if (!tags) { - tags = []; - desc = text; - } - text = []; - tags.push({ name: match[1], text: text }); - lines[i] = lines[i].substring(match[1].length + 1).trim(); - } - if (lines[i].length || text.length) - text.push(lines[i]); - } - return { - text: desc || text, - tags: tags || [] - }; -} - -// writes a comment -function writeComment(comment, otherwiseNewline) { - if (!comment || options.comments === false) { - if (otherwiseNewline) - writeln(); - return; - } - if (typeof comment !== "object") - comment = parseComment(comment); - comment.tags = comment.tags.filter(function(tag) { - return keepTags.indexOf(tag.name) > -1 && (tag.name !== "returns" || tag.text[0] !== "{undefined}"); - }); - writeln(); - if (!comment.tags.length && comment.text.length < 2) { - writeln("/** " + comment.text[0] + " */"); - return; - } - writeln("/**"); - comment.text.forEach(function(line) { - if (line.length) - writeln(" * ", line); - else - writeln(" *"); - }); - comment.tags.forEach(function(tag) { - var started = false; - if (tag.text.length) { - tag.text.forEach(function(line, i) { - if (i > 0) - write(" * "); - else if (tag.name !== "throws") - line = line.replace(/^\{[^\s]*} ?/, ""); - if (!line.length) - return; - if (!started) { - write(" * @", tag.name, " "); - started = true; - } - writeln(line); - }); - } - }); - writeln(" */"); -} - -// recursively replaces all occurencies of re's match -function replaceRecursive(name, re, fn) { - var found; - - function replacer() { - found = true; - return fn.apply(null, arguments); - } - - do { - found = false; - name = name.replace(re, replacer); - } while (found); - return name; -} - -// tests if an element is considered to be a class or class-like -function isClassLike(element) { - return isClass(element) || isInterface(element); -} - -// tests if an element is considered to be a class -function isClass(element) { - return element && element.kind === "class"; -} - -// tests if an element is considered to be an interface -function isInterface(element) { - return element && (element.kind === "interface" || element.kind === "mixin"); -} - -// tests if an element is considered to be a namespace -function isNamespace(element) { - return element && (element.kind === "namespace" || element.kind === "module"); -} - -// gets all children of the specified parent -function getChildrenOf(parent) { - var memberof = parent ? parent.longname : undefined; - return data.filter(function(element) { - return element.memberof === memberof; - }); -} - -// gets the literal type of an element -function getTypeOf(element) { - if (element.tsType) - return element.tsType.replace(/\r?\n|\r/g, "\n"); - var name = "any"; - var type = element.type; - if (type && type.names && type.names.length) { - if (type.names.length === 1) - name = element.type.names[0].trim(); - else - name = "(" + element.type.names.join("|") + ")"; - } else - return name; - - // Replace catchalls with any - name = name.replace(/\*|\bmixed\b/g, "any"); - - // Ensure upper case Object for map expressions below - name = name.replace(/\bobject\b/g, "Object"); - - // Correct Something. to Something - name = replaceRecursive(name, /\b(?!Object|Array)([\w$]+)\.<([^>]*)>/gi, function($0, $1, $2) { - return $1 + "<" + $2 + ">"; - }); - - // Replace Array. with string[] - name = replaceRecursive(name, /\bArray\.?<([^>]*)>/gi, function($0, $1) { - return $1 + "[]"; - }); - - // Replace Object. with { [k: string]: number } - name = replaceRecursive(name, /\bObject\.?<([^,]*), *([^>]*)>/gi, function($0, $1, $2) { - return "{ [k: " + $1 + "]: " + $2 + " }"; - }); - - // Replace functions (there are no signatures) with Function - name = name.replace(/\bfunction(?:\(\))?\b/g, "Function"); - - // Convert plain Object back to just object - name = name.replace(/\b(Object\b(?!\.))/g, function($0, $1) { - return $1.toLowerCase(); - }); - - return name; -} - -// begins writing the definition of the specified element -function begin(element, is_interface) { - if (!seen[element.longname]) { - if (isClass(element)) { - var comment = parseComment(element.comment); - var classdesc = comment.tags.find(function(tag) { return tag.name === "classdesc"; }); - if (classdesc) { - comment.text = classdesc.text; - comment.tags = []; - } - writeComment(comment, true); - } else - writeComment(element.comment, is_interface || isClassLike(element) || isNamespace(element) || element.isEnum || element.scope === "global"); - seen[element.longname] = element; - } else - writeln(); - // ????: something changed in JSDoc 3.6.0? so that @exports + @enum does - // no longer yield a 'global' scope, but is some sort of unscoped module - // element now. The additional condition added below works around this. - if ((element.scope === "global" || element.isEnum && element.scope === undefined) && !options.module) - write("export "); -} - -// writes the function signature describing element -function writeFunctionSignature(element, isConstructor, isTypeDef) { - write("("); - - var params = {}; - - // this type - if (element.this) - params["this"] = { - type: element.this.replace(/^{|}$/g, ""), - optional: false - }; - - // parameter types - if (element.params) - element.params.forEach(function(param) { - var path = param.name.split(/\./g); - if (path.length === 1) - params[param.name] = { - type: getTypeOf(param), - variable: param.variable === true, - optional: param.optional === true, - defaultValue: param.defaultvalue // Not used yet (TODO) - }; - else // Property syntax (TODO) - params[path[0]].type = "{ [k: string]: any }"; - }); - - var paramNames = Object.keys(params); - paramNames.forEach(function(name, i) { - var param = params[name]; - var type = param.type; - if (param.variable) { - name = "..." + name; - type = param.type.charAt(0) === "(" ? "any[]" : param.type + "[]"; - } - write(name, !param.variable && param.optional ? "?: " : ": ", type); - if (i < paramNames.length - 1) - write(", "); - }); - - write(")"); - - // return type - if (!isConstructor) { - write(isTypeDef ? " => " : ": "); - var typeName; - if (element.returns && element.returns.length && (typeName = getTypeOf(element.returns[0])) !== "undefined") - write(typeName); - else - write("void"); - } -} - -// writes (a typedef as) an interface -function writeInterface(element) { - write("interface ", element.name); - writeInterfaceBody(element); - writeln(); -} - -function writeInterfaceBody(element) { - writeln("{"); - ++indent; - if (element.tsType) - writeln(element.tsType.replace(/\r?\n|\r/g, "\n")); - else if (element.properties && element.properties.length) - element.properties.forEach(writeProperty); - --indent; - write("}"); -} - -function writeProperty(property, declare) { - writeComment(property.description); - if (declare) - write("let "); - write(property.name); - if (property.optional) - write("?"); - writeln(": ", getTypeOf(property), ";"); -} - -// -// Handlers -// - -// handles a single element of any understood type -function handleElement(element, parent) { - if (element.scope === "inner") - return false; - - if (element.optional !== true && element.type && element.type.names && element.type.names.length) { - for (var i = 0; i < element.type.names.length; i++) { - if (element.type.names[i].toLowerCase() === "undefined") { - // This element is actually optional. Set optional to true and - // remove the 'undefined' type - element.optional = true; - element.type.names.splice(i, 1); - i--; - } - } - } - - if (seen[element.longname]) - return true; - if (isClassLike(element)) - handleClass(element, parent); - else switch (element.kind) { - case "module": - if (element.isEnum) { - handleEnum(element, parent); - break; - } - // eslint-disable-line no-fallthrough - case "namespace": - handleNamespace(element, parent); - break; - case "constant": - case "member": - handleMember(element, parent); - break; - case "function": - handleFunction(element, parent); - break; - case "typedef": - handleTypeDef(element, parent); - break; - case "package": - break; - } - seen[element.longname] = element; - return true; -} - -// handles (just) a namespace -function handleNamespace(element/*, parent*/) { - var children = getChildrenOf(element); - if (!children.length) - return; - var first = true; - if (element.properties) - element.properties.forEach(function(property) { - if (!/^[$\w]+$/.test(property.name)) // incompatible in namespace - return; - if (first) { - begin(element); - writeln("namespace ", element.name, " {"); - ++indent; - first = false; - } - writeProperty(property, true); - }); - children.forEach(function(child) { - if (child.scope === "inner" || seen[child.longname]) - return; - if (first) { - begin(element); - writeln("namespace ", element.name, " {"); - ++indent; - first = false; - } - handleElement(child, element); - }); - if (!first) { - --indent; - writeln("}"); - } -} - -// a filter function to remove any module references -function notAModuleReference(ref) { - return ref.indexOf("module:") === -1; -} - -// handles a class or class-like -function handleClass(element, parent) { - var is_interface = isInterface(element); - begin(element, is_interface); - if (is_interface) - write("interface "); - else { - if (element.virtual) - write("abstract "); - write("class "); - } - write(element.name); - if (element.templates && element.templates.length) - write("<", element.templates.join(", "), ">"); - write(" "); - - // extended classes - if (element.augments) { - var augments = element.augments.filter(notAModuleReference); - if (augments.length) - write("extends ", augments[0], " "); - } - - // implemented interfaces - var impls = []; - if (element.implements) - Array.prototype.push.apply(impls, element.implements); - if (element.mixes) - Array.prototype.push.apply(impls, element.mixes); - impls = impls.filter(notAModuleReference); - if (impls.length) - write("implements ", impls.join(", "), " "); - - writeln("{"); - ++indent; - - if (element.tsType) - writeln(element.tsType.replace(/\r?\n|\r/g, "\n")); - - // constructor - if (!is_interface && !element.virtual) - handleFunction(element, parent, true); - - // properties - if (is_interface && element.properties) - element.properties.forEach(function(property) { - writeProperty(property); - }); - - // class-compatible members - var incompatible = []; - getChildrenOf(element).forEach(function(child) { - if (isClassLike(child) || child.kind === "module" || child.kind === "typedef" || child.isEnum) { - incompatible.push(child); - return; - } - handleElement(child, element); - }); - - --indent; - writeln("}"); - - // class-incompatible members - if (incompatible.length) { - writeln(); - if (element.scope === "global" && !options.module) - write("export "); - writeln("namespace ", element.name, " {"); - ++indent; - incompatible.forEach(function(child) { - handleElement(child, element); - }); - --indent; - writeln("}"); - } -} - -// handles an enum -function handleEnum(element) { - begin(element); - - var stringEnum = false; - element.properties.forEach(function(property) { - if (isNaN(property.defaultvalue)) { - stringEnum = true; - } - }); - if (stringEnum) { - writeln("type ", element.name, " ="); - ++indent; - element.properties.forEach(function(property, i) { - write(i === 0 ? "" : "| ", JSON.stringify(property.defaultvalue)); - }); - --indent; - writeln(";"); - } else { - writeln("enum ", element.name, " {"); - ++indent; - element.properties.forEach(function(property, i) { - write(property.name); - if (property.defaultvalue !== undefined) - write(" = ", JSON.stringify(property.defaultvalue)); - if (i < element.properties.length - 1) - writeln(","); - else - writeln(); - }); - --indent; - writeln("}"); - } -} - -// handles a namespace or class member -function handleMember(element, parent) { - if (element.isEnum) { - handleEnum(element); - return; - } - begin(element); - - var inClass = isClassLike(parent); - if (inClass) { - write(element.access || "public", " "); - if (element.scope === "static") - write("static "); - if (element.readonly) - write("readonly "); - } else - write(element.kind === "constant" ? "const " : "let "); - - write(element.name); - if (element.optional) - write("?"); - write(": "); - - if (element.type && element.type.names && /^Object\b/i.test(element.type.names[0]) && element.properties) { - writeln("{"); - ++indent; - element.properties.forEach(function(property, i) { - writeln(JSON.stringify(property.name), ": ", getTypeOf(property), i < element.properties.length - 1 ? "," : ""); - }); - --indent; - writeln("};"); - } else - writeln(getTypeOf(element), ";"); -} - -// handles a function or method -function handleFunction(element, parent, isConstructor) { - var insideClass = true; - if (isConstructor) { - writeComment(element.comment); - write("constructor"); - } else { - begin(element); - insideClass = isClassLike(parent); - if (insideClass) { - write(element.access || "public", " "); - if (element.scope === "static") - write("static "); - } else - write("function "); - write(element.name); - if (element.templates && element.templates.length) - write("<", element.templates.join(", "), ">"); - } - writeFunctionSignature(element, isConstructor, false); - writeln(";"); - if (!insideClass) - handleNamespace(element); -} - -// handles a type definition (not a real type) -function handleTypeDef(element, parent) { - if (isInterface(element)) { - if (isClassLike(parent)) - queuedInterfaces.push(element); - else { - begin(element); - writeInterface(element); - } - } else { - writeComment(element.comment, true); - write("type ", element.name); - if (element.templates && element.templates.length) - write("<", element.templates.join(", "), ">"); - write(" = "); - if (element.tsType) - write(element.tsType.replace(/\r?\n|\r/g, "\n")); - else { - var type = getTypeOf(element); - if (element.type && element.type.names.length === 1 && element.type.names[0] === "function") - writeFunctionSignature(element, false, true); - else if (type === "object") { - if (element.properties && element.properties.length) - writeInterfaceBody(element); - else - write("{}"); - } else - write(type); - } - writeln(";"); - } -} diff --git a/node_modules/protobufjs/cli/package.json b/node_modules/protobufjs/cli/package.json deleted file mode 100644 index 52a1fbec..00000000 --- a/node_modules/protobufjs/cli/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "6.9.0", - "dependencies": { - "espree": "^7.1.0", - "tmp": "^0.2.1" - } -} diff --git a/node_modules/protobufjs/cli/package.standalone.json b/node_modules/protobufjs/cli/package.standalone.json deleted file mode 100644 index a751ce09..00000000 --- a/node_modules/protobufjs/cli/package.standalone.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "protobufjs-cli", - "description": "Translates between file formats and generates static code as well as TypeScript definitions.", - "version": "6.9.0", - "author": "Daniel Wirtz ", - "repository": { - "type": "git", - "url": "https://github.com/dcodeIO/protobuf.js.git" - }, - "license": "BSD-3-Clause", - "main": "index.js", - "types": "index.d.ts", - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" - }, - "peerDependencies": { - "protobufjs": "~6.9.0" - }, - "dependencies": { - "chalk": "^3.0.0", - "escodegen": "^1.13.0", - "espree": "^6.1.2", - "estraverse": "^4.3.0", - "glob": "^7.1.6", - "jsdoc": "^3.6.3", - "minimist": "^1.2.0", - "semver": "^7.1.2", - "tmp": "^0.1.0", - "uglify-js": "^3.7.7" - } -} diff --git a/node_modules/protobufjs/cli/pbjs.d.ts b/node_modules/protobufjs/cli/pbjs.d.ts deleted file mode 100644 index ead1f3c5..00000000 --- a/node_modules/protobufjs/cli/pbjs.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -type pbjsCallback = (err: Error|null, output?: string) => void; - -/** - * Runs pbjs programmatically. - * @param {string[]} args Command line arguments - * @param {function(?Error, string=)} [callback] Optional completion callback - * @returns {number|undefined} Exit code, if known - */ -export function main(args: string[], callback?: pbjsCallback): number|undefined; diff --git a/node_modules/protobufjs/cli/pbjs.js b/node_modules/protobufjs/cli/pbjs.js deleted file mode 100644 index 76372d86..00000000 --- a/node_modules/protobufjs/cli/pbjs.js +++ /dev/null @@ -1,328 +0,0 @@ -"use strict"; -var path = require("path"), - fs = require("fs"), - pkg = require("./package.json"), - util = require("./util"); - -util.setup(); - -var protobuf = require(util.pathToProtobufJs), - minimist = require("minimist"), - chalk = require("chalk"), - glob = require("glob"); - -var targets = util.requireAll("./targets"); - -/** - * Runs pbjs programmatically. - * @param {string[]} args Command line arguments - * @param {function(?Error, string=)} [callback] Optional completion callback - * @returns {number|undefined} Exit code, if known - */ -exports.main = function main(args, callback) { - var lintDefault = "eslint-disable " + [ - "block-scoped-var", - "id-length", - "no-control-regex", - "no-magic-numbers", - "no-prototype-builtins", - "no-redeclare", - "no-shadow", - "no-var", - "sort-vars" - ].join(", "); - var argv = minimist(args, { - alias: { - target: "t", - out: "o", - path: "p", - wrap: "w", - root: "r", - lint: "l", - // backward compatibility: - "force-long": "strict-long", - "force-message": "strict-message" - }, - string: [ "target", "out", "path", "wrap", "dependency", "root", "lint" ], - boolean: [ "create", "encode", "decode", "verify", "convert", "delimited", "beautify", "comments", "es6", "sparse", "keep-case", "force-long", "force-number", "force-enum-string", "force-message" ], - default: { - target: "json", - create: true, - encode: true, - decode: true, - verify: true, - convert: true, - delimited: true, - beautify: true, - comments: true, - es6: null, - lint: lintDefault, - "keep-case": false, - "force-long": false, - "force-number": false, - "force-enum-string": false, - "force-message": false - } - }); - - var target = targets[argv.target], - files = argv._, - paths = typeof argv.path === "string" ? [ argv.path ] : argv.path || []; - - // alias hyphen args in camel case - Object.keys(argv).forEach(function(key) { - var camelKey = key.replace(/-([a-z])/g, function($0, $1) { return $1.toUpperCase(); }); - if (camelKey !== key) - argv[camelKey] = argv[key]; - }); - - // protobuf.js package directory contains additional, otherwise non-bundled google types - paths.push(path.relative(process.cwd(), path.join(__dirname, "..")) || "."); - - if (!files.length) { - var descs = Object.keys(targets).filter(function(key) { return !targets[key].private; }).map(function(key) { - return " " + util.pad(key, 14, true) + targets[key].description; - }); - if (callback) - callback(Error("usage")); // eslint-disable-line callback-return - else - process.stderr.write([ - "protobuf.js v" + pkg.version + " CLI for JavaScript", - "", - chalk.bold.white("Translates between file formats and generates static code."), - "", - " -t, --target Specifies the target format. Also accepts a path to require a custom target.", - "", - descs.join("\n"), - "", - " -p, --path Adds a directory to the include path.", - "", - " -o, --out Saves to a file instead of writing to stdout.", - "", - " --sparse Exports only those types referenced from a main file (experimental).", - "", - chalk.bold.gray(" Module targets only:"), - "", - " -w, --wrap Specifies the wrapper to use. Also accepts a path to require a custom wrapper.", - "", - " default Default wrapper supporting both CommonJS and AMD", - " commonjs CommonJS wrapper", - " amd AMD wrapper", - " es6 ES6 wrapper (implies --es6)", - " closure A closure adding to protobuf.roots where protobuf is a global", - "", - " --dependency Specifies which version of protobuf to require. Accepts any valid module id", - "", - " -r, --root Specifies an alternative protobuf.roots name.", - "", - " -l, --lint Linter configuration. Defaults to protobuf.js-compatible rules:", - "", - " " + lintDefault, - "", - " --es6 Enables ES6 syntax (const/let instead of var)", - "", - chalk.bold.gray(" Proto sources only:"), - "", - " --keep-case Keeps field casing instead of converting to camel case.", - "", - chalk.bold.gray(" Static targets only:"), - "", - " --no-create Does not generate create functions used for reflection compatibility.", - " --no-encode Does not generate encode functions.", - " --no-decode Does not generate decode functions.", - " --no-verify Does not generate verify functions.", - " --no-convert Does not generate convert functions like from/toObject", - " --no-delimited Does not generate delimited encode/decode functions.", - " --no-beautify Does not beautify generated code.", - " --no-comments Does not output any JSDoc comments.", - "", - " --force-long Enfores the use of 'Long' for s-/u-/int64 and s-/fixed64 fields.", - " --force-number Enfores the use of 'number' for s-/u-/int64 and s-/fixed64 fields.", - " --force-message Enfores the use of message instances instead of plain objects.", - "", - "usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or pipe) ") + "other | " + chalk.bold.green("pbjs") + " [options] -", - "" - ].join("\n")); - return 1; - } - - if (typeof argv["strict-long"] === "boolean") - argv["force-long"] = argv["strict-long"]; - - // Resolve glob expressions - for (var i = 0; i < files.length;) { - if (glob.hasMagic(files[i])) { - var matches = glob.sync(files[i]); - Array.prototype.splice.apply(files, [i, 1].concat(matches)); - i += matches.length; - } else - ++i; - } - - // Require custom target - if (!target) - target = require(path.resolve(process.cwd(), argv.target)); - - var root = new protobuf.Root(); - - var mainFiles = []; - - // Search include paths when resolving imports - root.resolvePath = function pbjsResolvePath(origin, target) { - var normOrigin = protobuf.util.path.normalize(origin), - normTarget = protobuf.util.path.normalize(target); - if (!normOrigin) - mainFiles.push(normTarget); - - var resolved = protobuf.util.path.resolve(normOrigin, normTarget, true); - var idx = resolved.lastIndexOf("google/protobuf/"); - if (idx > -1) { - var altname = resolved.substring(idx); - if (altname in protobuf.common) - resolved = altname; - } - - if (fs.existsSync(resolved)) - return resolved; - - for (var i = 0; i < paths.length; ++i) { - var iresolved = protobuf.util.path.resolve(paths[i] + "/", target); - if (fs.existsSync(iresolved)) - return iresolved; - } - - return resolved; - }; - - // `--wrap es6` implies `--es6` but not the other way around. You can still use e.g. `--es6 --wrap commonjs` - if (argv.wrap === "es6") { - argv.es6 = true; - } - - var parseOptions = { - "keepCase": argv["keep-case"] || false - }; - - // Read from stdin - if (files.length === 1 && files[0] === "-") { - var data = []; - process.stdin.on("data", function(chunk) { - data.push(chunk); - }); - process.stdin.on("end", function() { - var source = Buffer.concat(data).toString("utf8"); - try { - if (source.charAt(0) !== "{") { - protobuf.parse.filename = "-"; - protobuf.parse(source, root, parseOptions); - } else { - var json = JSON.parse(source); - root.setOptions(json.options).addJSON(json); - } - callTarget(); - } catch (err) { - if (callback) { - callback(err); - return; - } - throw err; - } - }); - - // Load from disk - } else { - try { - root.loadSync(files, parseOptions).resolveAll(); // sync is deterministic while async is not - if (argv.sparse) - sparsify(root); - callTarget(); - } catch (err) { - if (callback) { - callback(err); - return undefined; - } - throw err; - } - } - - function markReferenced(tobj) { - tobj.referenced = true; - // also mark a type's fields and oneofs - if (tobj.fieldsArray) - tobj.fieldsArray.forEach(function(fobj) { - fobj.referenced = true; - }); - if (tobj.oneofsArray) - tobj.oneofsArray.forEach(function(oobj) { - oobj.referenced = true; - }); - // also mark an extension field's extended type, but not its (other) fields - if (tobj.extensionField) - tobj.extensionField.parent.referenced = true; - } - - function sparsify(root) { - - // 1. mark directly or indirectly referenced objects - util.traverse(root, function(obj) { - if (!obj.filename) - return; - if (mainFiles.indexOf(obj.filename) > -1) - util.traverseResolved(obj, markReferenced); - }); - - // 2. empty unreferenced objects - util.traverse(root, function(obj) { - var parent = obj.parent; - if (!parent || obj.referenced) // root or referenced - return; - // remove unreferenced namespaces - if (obj instanceof protobuf.Namespace) { - var hasReferenced = false; - util.traverse(obj, function(iobj) { - if (iobj.referenced) - hasReferenced = true; - }); - if (hasReferenced) { // replace with plain namespace if a namespace subclass - if (obj instanceof protobuf.Type || obj instanceof protobuf.Service) { - var robj = new protobuf.Namespace(obj.name, obj.options); - robj.nested = obj.nested; - parent.add(robj); - } - } else // remove completely if nothing inside is referenced - parent.remove(obj); - - // remove everything else unreferenced - } else if (!(obj instanceof protobuf.Namespace)) - parent.remove(obj); - }); - - // 3. validate that everything is fine - root.resolveAll(); - } - - function callTarget() { - target(root, argv, function targetCallback(err, output) { - if (err) { - if (callback) - return callback(err); - throw err; - } - try { - if (argv.out) - fs.writeFileSync(argv.out, output, { encoding: "utf8" }); - else if (!callback) - process.stdout.write(output, "utf8"); - return callback - ? callback(null, output) - : undefined; - } catch (err) { - if (callback) - return callback(err); - throw err; - } - }); - } - - return undefined; -}; diff --git a/node_modules/protobufjs/cli/pbts.d.ts b/node_modules/protobufjs/cli/pbts.d.ts deleted file mode 100644 index 35db28c0..00000000 --- a/node_modules/protobufjs/cli/pbts.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -type pbtsCallback = (err: Error|null, output?: string) => void; - -/** - * Runs pbts programmatically. - * @param {string[]} args Command line arguments - * @param {function(?Error, string=)} [callback] Optional completion callback - * @returns {number|undefined} Exit code, if known - */ -export function main(args: string[], callback?: pbtsCallback): number|undefined; diff --git a/node_modules/protobufjs/cli/pbts.js b/node_modules/protobufjs/cli/pbts.js deleted file mode 100644 index f066964d..00000000 --- a/node_modules/protobufjs/cli/pbts.js +++ /dev/null @@ -1,197 +0,0 @@ -"use strict"; -var child_process = require("child_process"), - path = require("path"), - fs = require("fs"), - pkg = require("./package.json"), - util = require("./util"); - -util.setup(); - -var minimist = require("minimist"), - chalk = require("chalk"), - glob = require("glob"), - tmp = require("tmp"); - -/** - * Runs pbts programmatically. - * @param {string[]} args Command line arguments - * @param {function(?Error, string=)} [callback] Optional completion callback - * @returns {number|undefined} Exit code, if known - */ -exports.main = function(args, callback) { - var argv = minimist(args, { - alias: { - name: "n", - out : "o", - main: "m", - global: "g", - import: "i" - }, - string: [ "name", "out", "global", "import" ], - boolean: [ "comments", "main" ], - default: { - comments: true, - main: false - } - }); - - var files = argv._; - - if (!files.length) { - if (callback) - callback(Error("usage")); // eslint-disable-line callback-return - else - process.stderr.write([ - "protobuf.js v" + pkg.version + " CLI for TypeScript", - "", - chalk.bold.white("Generates TypeScript definitions from annotated JavaScript files."), - "", - " -o, --out Saves to a file instead of writing to stdout.", - "", - " -g, --global Name of the global object in browser environments, if any.", - "", - " -i, --import Comma delimited list of imports. Local names will equal camelCase of the basename.", - "", - " --no-comments Does not output any JSDoc comments.", - "", - chalk.bold.gray(" Internal flags:"), - "", - " -n, --name Wraps everything in a module of the specified name.", - "", - " -m, --main Whether building the main library without any imports.", - "", - "usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." + chalk.bold.gray(" (or) ") + "other | " + chalk.bold.green("pbts") + " [options] -", - "" - ].join("\n")); - return 1; - } - - // Resolve glob expressions - for (var i = 0; i < files.length;) { - if (glob.hasMagic(files[i])) { - var matches = glob.sync(files[i]); - Array.prototype.splice.apply(files, [i, 1].concat(matches)); - i += matches.length; - } else - ++i; - } - - var cleanup = []; - - // Read from stdin (to a temporary file) - if (files.length === 1 && files[0] === "-") { - var data = []; - process.stdin.on("data", function(chunk) { - data.push(chunk); - }); - process.stdin.on("end", function() { - files[0] = tmp.tmpNameSync() + ".js"; - fs.writeFileSync(files[0], Buffer.concat(data)); - cleanup.push(files[0]); - callJsdoc(); - }); - - // Load from disk - } else { - callJsdoc(); - } - - function callJsdoc() { - - // There is no proper API for jsdoc, so this executes the CLI and pipes the output - var basedir = path.join(__dirname, "."); - var moduleName = argv.name || "null"; - var nodePath = process.execPath; - var cmd = "\"" + nodePath + "\" \"" + require.resolve("jsdoc/jsdoc.js") + "\" -c \"" + path.join(basedir, "lib", "tsd-jsdoc.json") + "\" -q \"module=" + encodeURIComponent(moduleName) + "&comments=" + Boolean(argv.comments) + "\" " + files.map(function(file) { return "\"" + file + "\""; }).join(" "); - var child = child_process.exec(cmd, { - cwd: process.cwd(), - argv0: "node", - stdio: "pipe", - maxBuffer: 1 << 24 // 16mb - }); - var out = []; - var ended = false; - var closed = false; - child.stdout.on("data", function(data) { - out.push(data); - }); - child.stdout.on("end", function() { - if (closed) finish(); - else ended = true; - }); - child.stderr.pipe(process.stderr); - child.on("close", function(code) { - // clean up temporary files, no matter what - try { cleanup.forEach(fs.unlinkSync); } catch(e) {/**/} cleanup = []; - - if (code) { - out = out.join("").replace(/\s*JSDoc \d+\.\d+\.\d+ [^$]+/, ""); - process.stderr.write(out); - var err = Error("code " + code); - if (callback) - return callback(err); - throw err; - } - - if (ended) return finish(); - closed = true; - return undefined; - }); - - function getImportName(importItem) { - return path.basename(importItem, ".js").replace(/([-_~.+]\w)/g, function(match) { - return match[1].toUpperCase(); - }); - } - - function finish() { - var output = []; - if (argv.main) - output.push( - "// DO NOT EDIT! This is a generated file. Edit the JSDoc in src/*.js instead and run 'npm run types'.", - "" - ); - if (argv.global) - output.push( - "export as namespace " + argv.global + ";", - "" - ); - - if (!argv.main) { - // Ensure we have a usable array of imports - var importArray = typeof argv.import === "string" ? argv.import.split(",") : argv.import || []; - - // Build an object of imports and paths - var imports = { - $protobuf: "protobufjs" - }; - importArray.forEach(function(importItem) { - imports[getImportName(importItem)] = importItem; - }); - - // Write out the imports - Object.keys(imports).forEach(function(key) { - output.push("import * as " + key + " from \"" + imports[key] + "\";"); - }); - } - - output = output.join("\n") + "\n" + out.join(""); - - try { - if (argv.out) - fs.writeFileSync(argv.out, output, { encoding: "utf8" }); - else if (!callback) - process.stdout.write(output, "utf8"); - return callback - ? callback(null, output) - : undefined; - } catch (err) { - if (callback) - return callback(err); - throw err; - } - } - } - - return undefined; -}; diff --git a/node_modules/protobufjs/cli/targets/json-module.js b/node_modules/protobufjs/cli/targets/json-module.js deleted file mode 100644 index 5255cd99..00000000 --- a/node_modules/protobufjs/cli/targets/json-module.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -module.exports = json_module; - -var util = require("../util"); - -var protobuf = require("../.."); - -json_module.description = "JSON representation as a module"; - -function jsonSafeProp(json) { - return json.replace(/^( +)"(\w+)":/mg, function($0, $1, $2) { - return protobuf.util.safeProp($2).charAt(0) === "." - ? $1 + $2 + ":" - : $0; - }); -} - -function json_module(root, options, callback) { - try { - var rootProp = protobuf.util.safeProp(options.root || "default"); - var output = [ - (options.es6 ? "const" : "var") + " $root = ($protobuf.roots" + rootProp + " || ($protobuf.roots" + rootProp + " = new $protobuf.Root()))\n" - ]; - if (root.options) { - var optionsJson = jsonSafeProp(JSON.stringify(root.options, null, 2)); - output.push(".setOptions(" + optionsJson + ")\n"); - } - var json = jsonSafeProp(JSON.stringify(root.nested, null, 2).trim()); - output.push(".addJSON(" + json + ");"); - output = util.wrap(output.join(""), protobuf.util.merge({ dependency: "protobufjs/light" }, options)); - process.nextTick(function() { - callback(null, output); - }); - } catch (e) { - return callback(e); - } - return undefined; -} diff --git a/node_modules/protobufjs/cli/targets/json.js b/node_modules/protobufjs/cli/targets/json.js deleted file mode 100644 index 70253723..00000000 --- a/node_modules/protobufjs/cli/targets/json.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -module.exports = json_target; - -json_target.description = "JSON representation"; - -function json_target(root, options, callback) { - callback(null, JSON.stringify(root, null, 2)); -} diff --git a/node_modules/protobufjs/cli/targets/proto.js b/node_modules/protobufjs/cli/targets/proto.js deleted file mode 100644 index d633f168..00000000 --- a/node_modules/protobufjs/cli/targets/proto.js +++ /dev/null @@ -1,326 +0,0 @@ -"use strict"; -module.exports = proto_target; - -proto_target.private = true; - -var protobuf = require("../.."); - -var Namespace = protobuf.Namespace, - Enum = protobuf.Enum, - Type = protobuf.Type, - Field = protobuf.Field, - OneOf = protobuf.OneOf, - Service = protobuf.Service, - Method = protobuf.Method, - types = protobuf.types, - util = protobuf.util; - -function underScore(str) { - return str.substring(0,1) - + str.substring(1) - .replace(/([A-Z])(?=[a-z]|$)/g, function($0, $1) { return "_" + $1.toLowerCase(); }); -} - -var out = []; -var indent = 0; -var first = false; -var syntax = 3; - -function proto_target(root, options, callback) { - if (options) { - switch (options.syntax) { - case undefined: - case "proto3": - case "3": - syntax = 3; - break; - case "proto2": - case "2": - syntax = 2; - break; - default: - return callback(Error("invalid syntax: " + options.syntax)); - } - } - indent = 0; - first = false; - try { - buildRoot(root); - return callback(null, out.join("\n")); - } catch (err) { - return callback(err); - } finally { - out = []; - syntax = 3; - } -} - -function push(line) { - if (line === "") - out.push(""); - else { - var ind = ""; - for (var i = 0; i < indent; ++i) - ind += " "; - out.push(ind + line); - } -} - -function escape(str) { - return str.replace(/[\\"']/g, "\\$&") - .replace(/\r/g, "\\r") - .replace(/\n/g, "\\n") - .replace(/\u0000/g, "\\0"); // eslint-disable-line no-control-regex -} - -function value(v) { - switch (typeof v) { - case "boolean": - return v ? "true" : "false"; - case "number": - return v.toString(); - default: - return "\"" + escape(String(v)) + "\""; - } -} - -function buildRoot(root) { - root.resolveAll(); - var pkg = []; - var ptr = root; - var repeat = true; - do { - var nested = ptr.nestedArray; - if (nested.length === 1 && nested[0] instanceof Namespace && !(nested[0] instanceof Type || nested[0] instanceof Service)) { - ptr = nested[0]; - if (ptr !== root) - pkg.push(ptr.name); - } else - repeat = false; - } while (repeat); - out.push("syntax = \"proto" + syntax + "\";"); - if (pkg.length) - out.push("", "package " + pkg.join(".") + ";"); - - buildOptions(ptr); - ptr.nestedArray.forEach(build); -} - -function build(object) { - if (object instanceof Enum) - buildEnum(object); - else if (object instanceof Type) - buildType(object); - else if (object instanceof Field) - buildField(object); - else if (object instanceof OneOf) - buildOneOf(object); - else if (object instanceof Service) - buildService(object); - else if (object instanceof Method) - buildMethod(object); - else - buildNamespace(object); -} - -function buildNamespace(namespace) { // just a namespace, not a type etc. - push(""); - push("message " + namespace.name + " {"); - ++indent; - buildOptions(namespace); - consolidateExtends(namespace.nestedArray).remaining.forEach(build); - --indent; - push("}"); -} - -function buildEnum(enm) { - push(""); - push("enum " + enm.name + " {"); - buildOptions(enm); - ++indent; first = true; - Object.keys(enm.values).forEach(function(name) { - var val = enm.values[name]; - if (first) { - push(""); - first = false; - } - push(name + " = " + val + ";"); - }); - --indent; first = false; - push("}"); -} - -function buildRanges(keyword, ranges) { - if (ranges && ranges.length) { - var parts = []; - ranges.forEach(function(range) { - if (typeof range === "string") - parts.push("\"" + escape(range) + "\""); - else if (range[0] === range[1]) - parts.push(range[0]); - else - parts.push(range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1])); - }); - push(""); - push(keyword + " " + parts.join(", ") + ";"); - } -} - -function buildType(type) { - if (type.group) - return; // built with the sister-field - push(""); - push("message " + type.name + " {"); - ++indent; - buildOptions(type); - type.oneofsArray.forEach(build); - first = true; - type.fieldsArray.forEach(build); - consolidateExtends(type.nestedArray).remaining.forEach(build); - buildRanges("extensions", type.extensions); - buildRanges("reserved", type.reserved); - --indent; - push("}"); -} - -function buildField(field, passExtend) { - if (field.partOf || field.declaringField || field.extend !== undefined && !passExtend) - return; - if (first) { - first = false; - push(""); - } - if (field.resolvedType && field.resolvedType.group) { - buildGroup(field); - return; - } - var sb = []; - if (field.map) - sb.push("map<" + field.keyType + ", " + field.type + ">"); - else if (field.repeated) - sb.push("repeated", field.type); - else if (syntax === 2 || field.parent.group) - sb.push(field.required ? "required" : "optional", field.type); - else - sb.push(field.type); - sb.push(underScore(field.name), "=", field.id); - var opts = buildFieldOptions(field); - if (opts) - sb.push(opts); - push(sb.join(" ") + ";"); -} - -function buildGroup(field) { - push(field.rule + " group " + field.resolvedType.name + " = " + field.id + " {"); - ++indent; - buildOptions(field.resolvedType); - first = true; - field.resolvedType.fieldsArray.forEach(function(field) { - buildField(field); - }); - --indent; - push("}"); -} - -function buildFieldOptions(field) { - var keys; - if (!field.options || !(keys = Object.keys(field.options)).length) - return null; - var sb = []; - keys.forEach(function(key) { - var val = field.options[key]; - var wireType = types.packed[field.resolvedType instanceof Enum ? "int32" : field.type]; - switch (key) { - case "packed": - val = Boolean(val); - // skip when not packable or syntax default - if (wireType === undefined || syntax === 3 === val) - return; - break; - case "default": - if (syntax === 3) - return; - // skip default (resolved) default values - if (field.long && !util.longNeq(field.defaultValue, types.defaults[field.type]) || !field.long && field.defaultValue === types.defaults[field.type]) - return; - // enum defaults specified as strings are type references and not enclosed in quotes - if (field.resolvedType instanceof Enum) - break; - // otherwise fallthrough - default: - val = value(val); - break; - } - sb.push(key + "=" + val); - }); - return sb.length - ? "[" + sb.join(", ") + "]" - : null; -} - -function consolidateExtends(nested) { - var ext = {}; - nested = nested.filter(function(obj) { - if (!(obj instanceof Field) || obj.extend === undefined) - return true; - (ext[obj.extend] || (ext[obj.extend] = [])).push(obj); - return false; - }); - Object.keys(ext).forEach(function(extend) { - push(""); - push("extend " + extend + " {"); - ++indent; first = true; - ext[extend].forEach(function(field) { - buildField(field, true); - }); - --indent; - push("}"); - }); - return { - remaining: nested - }; -} - -function buildOneOf(oneof) { - push(""); - push("oneof " + underScore(oneof.name) + " {"); - ++indent; first = true; - oneof.oneof.forEach(function(fieldName) { - var field = oneof.parent.get(fieldName); - if (first) { - first = false; - push(""); - } - var opts = buildFieldOptions(field); - push(field.type + " " + underScore(field.name) + " = " + field.id + (opts ? " " + opts : "") + ";"); - }); - --indent; - push("}"); -} - -function buildService(service) { - push("service " + service.name + " {"); - ++indent; - service.methodsArray.forEach(build); - consolidateExtends(service.nestedArray).remaining.forEach(build); - --indent; - push("}"); -} - -function buildMethod(method) { - push(method.type + " " + method.name + " (" + (method.requestStream ? "stream " : "") + method.requestType + ") returns (" + (method.responseStream ? "stream " : "") + method.responseType + ");"); -} - -function buildOptions(object) { - if (!object.options) - return; - first = true; - Object.keys(object.options).forEach(function(key) { - if (first) { - first = false; - push(""); - } - var val = object.options[key]; - push("option " + key + " = " + JSON.stringify(val) + ";"); - }); -} diff --git a/node_modules/protobufjs/cli/targets/proto2.js b/node_modules/protobufjs/cli/targets/proto2.js deleted file mode 100644 index 09521e06..00000000 --- a/node_modules/protobufjs/cli/targets/proto2.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -module.exports = proto2_target; - -var protobuf = require("../.."); - -proto2_target.description = "Protocol Buffers, Version 2"; - -function proto2_target(root, options, callback) { - require("./proto")(root, protobuf.util.merge(options, { syntax: "proto2" }), callback); -} diff --git a/node_modules/protobufjs/cli/targets/proto3.js b/node_modules/protobufjs/cli/targets/proto3.js deleted file mode 100644 index 661c916b..00000000 --- a/node_modules/protobufjs/cli/targets/proto3.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -module.exports = proto3_target; - -var protobuf = require("../.."); - -proto3_target.description = "Protocol Buffers, Version 3"; - -function proto3_target(root, options, callback) { - require("./proto")(root, protobuf.util.merge(options, { syntax: "proto3" }), callback); -} diff --git a/node_modules/protobufjs/cli/targets/static-module.js b/node_modules/protobufjs/cli/targets/static-module.js deleted file mode 100644 index b5619476..00000000 --- a/node_modules/protobufjs/cli/targets/static-module.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -module.exports = static_module_target; - -// - The default wrapper supports AMD, CommonJS and the global scope (as window.root), in this order. -// - You can specify a custom wrapper with the --wrap argument. -// - CommonJS modules depend on the minimal build for reduced package size with browserify. -// - AMD and global scope depend on the full library for now. - -var util = require("../util"); - -var protobuf = require("../.."); - -static_module_target.description = "Static code without reflection as a module"; - -function static_module_target(root, options, callback) { - require("./static")(root, options, function(err, output) { - if (err) { - callback(err); - return; - } - try { - output = util.wrap(output, protobuf.util.merge({ dependency: "protobufjs/minimal" }, options)); - } catch (e) { - callback(e); - return; - } - callback(null, output); - }); -} diff --git a/node_modules/protobufjs/cli/targets/static.js b/node_modules/protobufjs/cli/targets/static.js deleted file mode 100644 index d4a061f6..00000000 --- a/node_modules/protobufjs/cli/targets/static.js +++ /dev/null @@ -1,705 +0,0 @@ -"use strict"; -module.exports = static_target; - -var protobuf = require("../.."), - UglifyJS = require("uglify-js"), - espree = require("espree"), - escodegen = require("escodegen"), - estraverse = require("estraverse"); - -var Type = protobuf.Type, - Service = protobuf.Service, - Enum = protobuf.Enum, - Namespace = protobuf.Namespace, - util = protobuf.util; - -var out = []; -var indent = 0; -var config = {}; - -static_target.description = "Static code without reflection (non-functional on its own)"; - -function static_target(root, options, callback) { - config = options; - try { - var aliases = []; - if (config.decode) - aliases.push("Reader"); - if (config.encode) - aliases.push("Writer"); - aliases.push("util"); - if (aliases.length) { - if (config.comments) - push("// Common aliases"); - push((config.es6 ? "const " : "var ") + aliases.map(function(name) { return "$" + name + " = $protobuf." + name; }).join(", ") + ";"); - push(""); - } - if (config.comments) { - if (root.comment) { - pushComment("@fileoverview " + root.comment); - push(""); - } - push("// Exported root namespace"); - } - var rootProp = util.safeProp(config.root || "default"); - push((config.es6 ? "const" : "var") + " $root = $protobuf.roots" + rootProp + " || ($protobuf.roots" + rootProp + " = {});"); - buildNamespace(null, root); - return callback(null, out.join("\n")); - } catch (err) { - return callback(err); - } finally { - out = []; - indent = 0; - config = {}; - } -} - -function push(line) { - if (line === "") - return out.push(""); - var ind = ""; - for (var i = 0; i < indent; ++i) - ind += " "; - return out.push(ind + line); -} - -function pushComment(lines) { - if (!config.comments) - return; - var split = []; - for (var i = 0; i < lines.length; ++i) - if (lines[i] != null && lines[i].substring(0, 8) !== "@exclude") - Array.prototype.push.apply(split, lines[i].split(/\r?\n/g)); - push("/**"); - split.forEach(function(line) { - if (line === null) - return; - push(" * " + line.replace(/\*\//g, "* /")); - }); - push(" */"); -} - -function exportName(object, asInterface) { - if (asInterface) { - if (object.__interfaceName) - return object.__interfaceName; - } else if (object.__exportName) - return object.__exportName; - var parts = object.fullName.substring(1).split("."), - i = 0; - while (i < parts.length) - parts[i] = escapeName(parts[i++]); - if (asInterface) - parts[i - 1] = "I" + parts[i - 1]; - return object[asInterface ? "__interfaceName" : "__exportName"] = parts.join("."); -} - -function escapeName(name) { - if (!name) - return "$root"; - return util.isReserved(name) ? name + "_" : name; -} - -function aOrAn(name) { - return ((/^[hH](?:ou|on|ei)/.test(name) || /^[aeiouAEIOU][a-z]/.test(name)) && !/^us/i.test(name) - ? "an " - : "a ") + name; -} - -function buildNamespace(ref, ns) { - if (!ns) - return; - if (ns.name !== "") { - push(""); - if (!ref && config.es6) - push("export const " + escapeName(ns.name) + " = " + escapeName(ref) + "." + escapeName(ns.name) + " = (() => {"); - else - push(escapeName(ref) + "." + escapeName(ns.name) + " = (function() {"); - ++indent; - } - - if (ns instanceof Type) { - buildType(undefined, ns); - } else if (ns instanceof Service) - buildService(undefined, ns); - else if (ns.name !== "") { - push(""); - pushComment([ - ns.comment || "Namespace " + ns.name + ".", - ns.parent instanceof protobuf.Root ? "@exports " + escapeName(ns.name) : "@memberof " + exportName(ns.parent), - "@namespace" - ]); - push((config.es6 ? "const" : "var") + " " + escapeName(ns.name) + " = {};"); - } - - ns.nestedArray.forEach(function(nested) { - if (nested instanceof Enum) - buildEnum(ns.name, nested); - else if (nested instanceof Namespace) - buildNamespace(ns.name, nested); - }); - if (ns.name !== "") { - push(""); - push("return " + escapeName(ns.name) + ";"); - --indent; - push("})();"); - } -} - -var reduceableBlockStatements = { - IfStatement: true, - ForStatement: true, - WhileStatement: true -}; - -var shortVars = { - "r": "reader", - "w": "writer", - "m": "message", - "t": "tag", - "l": "length", - "c": "end", "c2": "end2", - "k": "key", - "ks": "keys", "ks2": "keys2", - "e": "error", - "f": "impl", - "o": "options", - "d": "object", - "n": "long", - "p": "properties" -}; - -function beautifyCode(code) { - // Add semicolons - code = UglifyJS.minify(code, { - compress: false, - mangle: false, - output: { beautify: true } - }).code; - // Properly beautify - var ast = espree.parse(code); - estraverse.replace(ast, { - enter: function(node, parent) { - // rename short vars - if (node.type === "Identifier" && (parent.property !== node || parent.computed) && shortVars[node.name]) - return { - "type": "Identifier", - "name": shortVars[node.name] - }; - // replace var with let if es6 - if (config.es6 && node.type === "VariableDeclaration" && node.kind === "var") { - node.kind = "let"; - return undefined; - } - // remove braces around block statements with a single child - if (node.type === "BlockStatement" && reduceableBlockStatements[parent.type] && node.body.length === 1) - return node.body[0]; - return undefined; - } - }); - code = escodegen.generate(ast, { - format: { - newline: "\n", - quotes: "double" - } - }); - // Add id, wireType comments - if (config.comments) - code = code.replace(/\.uint32\((\d+)\)/g, function($0, $1) { - var id = $1 >>> 3, - wireType = $1 & 7; - return ".uint32(/* id " + id + ", wireType " + wireType + " =*/" + $1 + ")"; - }); - return code; -} - -var renameVars = { - "Writer": "$Writer", - "Reader": "$Reader", - "util": "$util" -}; - -function buildFunction(type, functionName, gen, scope) { - var code = gen.toString(functionName) - .replace(/((?!\.)types\[\d+])(\.values)/g, "$1"); // enums: use types[N] instead of reflected types[N].values - - var ast = espree.parse(code); - /* eslint-disable no-extra-parens */ - estraverse.replace(ast, { - enter: function(node, parent) { - // rename vars - if ( - node.type === "Identifier" && renameVars[node.name] - && ( - (parent.type === "MemberExpression" && parent.object === node) - || (parent.type === "BinaryExpression" && parent.right === node) - ) - ) - return { - "type": "Identifier", - "name": renameVars[node.name] - }; - // replace this.ctor with the actual ctor - if ( - node.type === "MemberExpression" - && node.object.type === "ThisExpression" - && node.property.type === "Identifier" && node.property.name === "ctor" - ) - return { - "type": "Identifier", - "name": "$root" + type.fullName - }; - // replace types[N] with the field's actual type - if ( - node.type === "MemberExpression" - && node.object.type === "Identifier" && node.object.name === "types" - && node.property.type === "Literal" - ) - return { - "type": "Identifier", - "name": "$root" + type.fieldsArray[node.property.value].resolvedType.fullName - }; - return undefined; - } - }); - /* eslint-enable no-extra-parens */ - code = escodegen.generate(ast, { - format: { - newline: "\n", - quotes: "double" - } - }); - - if (config.beautify) - code = beautifyCode(code); - - code = code.replace(/ {4}/g, "\t"); - - var hasScope = scope && Object.keys(scope).length, - isCtor = functionName === type.name; - - if (hasScope) // remove unused scope vars - Object.keys(scope).forEach(function(key) { - if (!new RegExp("\\b(" + key + ")\\b", "g").test(code)) - delete scope[key]; - }); - - var lines = code.split(/\n/g); - if (isCtor) // constructor - push(lines[0]); - else if (hasScope) // enclose in an iife - push(escapeName(type.name) + "." + escapeName(functionName) + " = (function(" + Object.keys(scope).map(escapeName).join(", ") + ") { return " + lines[0]); - else - push(escapeName(type.name) + "." + escapeName(functionName) + " = " + lines[0]); - lines.slice(1, lines.length - 1).forEach(function(line) { - var prev = indent; - var i = 0; - while (line.charAt(i++) === "\t") - ++indent; - push(line.trim()); - indent = prev; - }); - if (isCtor) - push("}"); - else if (hasScope) - push("};})(" + Object.keys(scope).map(function(key) { return scope[key]; }).join(", ") + ");"); - else - push("};"); -} - -function toJsType(field) { - var type; - - switch (field.type) { - case "double": - case "float": - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": - type = "number"; - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": - type = config.forceLong ? "Long" : config.forceNumber ? "number" : "number|Long"; - break; - case "bool": - type = "boolean"; - break; - case "string": - type = "string"; - break; - case "bytes": - type = "Uint8Array"; - break; - default: - if (field.resolve().resolvedType) - type = exportName(field.resolvedType, !(field.resolvedType instanceof protobuf.Enum || config.forceMessage)); - else - type = "*"; // should not happen - break; - } - if (field.map) - return "Object."; - if (field.repeated) - return "Array.<" + type + ">"; - return type; -} - -function buildType(ref, type) { - - if (config.comments) { - var typeDef = [ - "Properties of " + aOrAn(type.name) + ".", - type.parent instanceof protobuf.Root ? "@exports " + escapeName("I" + type.name) : "@memberof " + exportName(type.parent), - "@interface " + escapeName("I" + type.name) - ]; - type.fieldsArray.forEach(function(field) { - var prop = util.safeProp(field.name); // either .name or ["name"] - prop = prop.substring(1, prop.charAt(0) === "[" ? prop.length - 1 : prop.length); - var jsType = toJsType(field); - if (field.optional) - jsType = jsType + "|null"; - typeDef.push("@property {" + jsType + "} " + (field.optional ? "[" + prop + "]" : prop) + " " + (field.comment || type.name + " " + field.name)); - }); - push(""); - pushComment(typeDef); - } - - // constructor - push(""); - pushComment([ - "Constructs a new " + type.name + ".", - type.parent instanceof protobuf.Root ? "@exports " + escapeName(type.name) : "@memberof " + exportName(type.parent), - "@classdesc " + (type.comment || "Represents " + aOrAn(type.name) + "."), - config.comments ? "@implements " + escapeName("I" + type.name) : null, - "@constructor", - "@param {" + exportName(type, true) + "=} [" + (config.beautify ? "properties" : "p") + "] Properties to set" - ]); - buildFunction(type, type.name, Type.generateConstructor(type)); - - // default values - var firstField = true; - type.fieldsArray.forEach(function(field) { - field.resolve(); - var prop = util.safeProp(field.name); - if (config.comments) { - push(""); - var jsType = toJsType(field); - if (field.optional && !field.map && !field.repeated && field.resolvedType instanceof Type) - jsType = jsType + "|null|undefined"; - pushComment([ - field.comment || type.name + " " + field.name + ".", - "@member {" + jsType + "} " + field.name, - "@memberof " + exportName(type), - "@instance" - ]); - } else if (firstField) { - push(""); - firstField = false; - } - if (field.repeated) - push(escapeName(type.name) + ".prototype" + prop + " = $util.emptyArray;"); // overwritten in constructor - else if (field.map) - push(escapeName(type.name) + ".prototype" + prop + " = $util.emptyObject;"); // overwritten in constructor - else if (field.long) - push(escapeName(type.name) + ".prototype" + prop + " = $util.Long ? $util.Long.fromBits(" - + JSON.stringify(field.typeDefault.low) + "," - + JSON.stringify(field.typeDefault.high) + "," - + JSON.stringify(field.typeDefault.unsigned) - + ") : " + field.typeDefault.toNumber(field.type.charAt(0) === "u") + ";"); - else if (field.bytes) { - push(escapeName(type.name) + ".prototype" + prop + " = $util.newBuffer(" + JSON.stringify(Array.prototype.slice.call(field.typeDefault)) + ");"); - } else - push(escapeName(type.name) + ".prototype" + prop + " = " + JSON.stringify(field.typeDefault) + ";"); - }); - - // virtual oneof fields - var firstOneOf = true; - type.oneofsArray.forEach(function(oneof) { - if (firstOneOf) { - firstOneOf = false; - push(""); - if (config.comments) - push("// OneOf field names bound to virtual getters and setters"); - push((config.es6 ? "let" : "var") + " $oneOfFields;"); - } - oneof.resolve(); - push(""); - pushComment([ - oneof.comment || type.name + " " + oneof.name + ".", - "@member {" + oneof.oneof.map(JSON.stringify).join("|") + "|undefined} " + escapeName(oneof.name), - "@memberof " + exportName(type), - "@instance" - ]); - push("Object.defineProperty(" + escapeName(type.name) + ".prototype, " + JSON.stringify(oneof.name) +", {"); - ++indent; - push("get: $util.oneOfGetter($oneOfFields = [" + oneof.oneof.map(JSON.stringify).join(", ") + "]),"); - push("set: $util.oneOfSetter($oneOfFields)"); - --indent; - push("});"); - }); - - if (config.create) { - push(""); - pushComment([ - "Creates a new " + type.name + " instance using the specified properties.", - "@function create", - "@memberof " + exportName(type), - "@static", - "@param {" + exportName(type, true) + "=} [properties] Properties to set", - "@returns {" + exportName(type) + "} " + type.name + " instance" - ]); - push(escapeName(type.name) + ".create = function create(properties) {"); - ++indent; - push("return new " + escapeName(type.name) + "(properties);"); - --indent; - push("};"); - } - - if (config.encode) { - push(""); - pushComment([ - "Encodes the specified " + type.name + " message. Does not implicitly {@link " + exportName(type) + ".verify|verify} messages.", - "@function encode", - "@memberof " + exportName(type), - "@static", - "@param {" + exportName(type, !config.forceMessage) + "} " + (config.beautify ? "message" : "m") + " " + type.name + " message or plain object to encode", - "@param {$protobuf.Writer} [" + (config.beautify ? "writer" : "w") + "] Writer to encode to", - "@returns {$protobuf.Writer} Writer" - ]); - buildFunction(type, "encode", protobuf.encoder(type)); - - if (config.delimited) { - push(""); - pushComment([ - "Encodes the specified " + type.name + " message, length delimited. Does not implicitly {@link " + exportName(type) + ".verify|verify} messages.", - "@function encodeDelimited", - "@memberof " + exportName(type), - "@static", - "@param {" + exportName(type, !config.forceMessage) + "} message " + type.name + " message or plain object to encode", - "@param {$protobuf.Writer} [writer] Writer to encode to", - "@returns {$protobuf.Writer} Writer" - ]); - push(escapeName(type.name) + ".encodeDelimited = function encodeDelimited(message, writer) {"); - ++indent; - push("return this.encode(message, writer).ldelim();"); - --indent; - push("};"); - } - } - - if (config.decode) { - push(""); - pushComment([ - "Decodes " + aOrAn(type.name) + " message from the specified reader or buffer.", - "@function decode", - "@memberof " + exportName(type), - "@static", - "@param {$protobuf.Reader|Uint8Array} " + (config.beautify ? "reader" : "r") + " Reader or buffer to decode from", - "@param {number} [" + (config.beautify ? "length" : "l") + "] Message length if known beforehand", - "@returns {" + exportName(type) + "} " + type.name, - "@throws {Error} If the payload is not a reader or valid buffer", - "@throws {$protobuf.util.ProtocolError} If required fields are missing" - ]); - buildFunction(type, "decode", protobuf.decoder(type)); - - if (config.delimited) { - push(""); - pushComment([ - "Decodes " + aOrAn(type.name) + " message from the specified reader or buffer, length delimited.", - "@function decodeDelimited", - "@memberof " + exportName(type), - "@static", - "@param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from", - "@returns {" + exportName(type) + "} " + type.name, - "@throws {Error} If the payload is not a reader or valid buffer", - "@throws {$protobuf.util.ProtocolError} If required fields are missing" - ]); - push(escapeName(type.name) + ".decodeDelimited = function decodeDelimited(reader) {"); - ++indent; - push("if (!(reader instanceof $Reader))"); - ++indent; - push("reader = new $Reader(reader);"); - --indent; - push("return this.decode(reader, reader.uint32());"); - --indent; - push("};"); - } - } - - if (config.verify) { - push(""); - pushComment([ - "Verifies " + aOrAn(type.name) + " message.", - "@function verify", - "@memberof " + exportName(type), - "@static", - "@param {Object.} " + (config.beautify ? "message" : "m") + " Plain object to verify", - "@returns {string|null} `null` if valid, otherwise the reason why it is not" - ]); - buildFunction(type, "verify", protobuf.verifier(type)); - } - - if (config.convert) { - push(""); - pushComment([ - "Creates " + aOrAn(type.name) + " message from a plain object. Also converts values to their respective internal types.", - "@function fromObject", - "@memberof " + exportName(type), - "@static", - "@param {Object.} " + (config.beautify ? "object" : "d") + " Plain object", - "@returns {" + exportName(type) + "} " + type.name - ]); - buildFunction(type, "fromObject", protobuf.converter.fromObject(type)); - - push(""); - pushComment([ - "Creates a plain object from " + aOrAn(type.name) + " message. Also converts values to other types if specified.", - "@function toObject", - "@memberof " + exportName(type), - "@static", - "@param {" + exportName(type) + "} " + (config.beautify ? "message" : "m") + " " + type.name, - "@param {$protobuf.IConversionOptions} [" + (config.beautify ? "options" : "o") + "] Conversion options", - "@returns {Object.} Plain object" - ]); - buildFunction(type, "toObject", protobuf.converter.toObject(type)); - - push(""); - pushComment([ - "Converts this " + type.name + " to JSON.", - "@function toJSON", - "@memberof " + exportName(type), - "@instance", - "@returns {Object.} JSON object" - ]); - push(escapeName(type.name) + ".prototype.toJSON = function toJSON() {"); - ++indent; - push("return this.constructor.toObject(this, $protobuf.util.toJSONOptions);"); - --indent; - push("};"); - } -} - -function buildService(ref, service) { - - push(""); - pushComment([ - "Constructs a new " + service.name + " service.", - service.parent instanceof protobuf.Root ? "@exports " + escapeName(service.name) : "@memberof " + exportName(service.parent), - "@classdesc " + (service.comment || "Represents " + aOrAn(service.name)), - "@extends $protobuf.rpc.Service", - "@constructor", - "@param {$protobuf.RPCImpl} rpcImpl RPC implementation", - "@param {boolean} [requestDelimited=false] Whether requests are length-delimited", - "@param {boolean} [responseDelimited=false] Whether responses are length-delimited" - ]); - push("function " + escapeName(service.name) + "(rpcImpl, requestDelimited, responseDelimited) {"); - ++indent; - push("$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);"); - --indent; - push("}"); - push(""); - push("(" + escapeName(service.name) + ".prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = " + escapeName(service.name) + ";"); - - if (config.create) { - push(""); - pushComment([ - "Creates new " + service.name + " service using the specified rpc implementation.", - "@function create", - "@memberof " + exportName(service), - "@static", - "@param {$protobuf.RPCImpl} rpcImpl RPC implementation", - "@param {boolean} [requestDelimited=false] Whether requests are length-delimited", - "@param {boolean} [responseDelimited=false] Whether responses are length-delimited", - "@returns {" + escapeName(service.name) + "} RPC service. Useful where requests and/or responses are streamed." - ]); - push(escapeName(service.name) + ".create = function create(rpcImpl, requestDelimited, responseDelimited) {"); - ++indent; - push("return new this(rpcImpl, requestDelimited, responseDelimited);"); - --indent; - push("};"); - } - - service.methodsArray.forEach(function(method) { - method.resolve(); - var lcName = protobuf.util.lcFirst(method.name), - cbName = escapeName(method.name + "Callback"); - push(""); - pushComment([ - "Callback as used by {@link " + exportName(service) + "#" + escapeName(lcName) + "}.", - // This is a more specialized version of protobuf.rpc.ServiceCallback - "@memberof " + exportName(service), - "@typedef " + cbName, - "@type {function}", - "@param {Error|null} error Error, if any", - "@param {" + exportName(method.resolvedResponseType) + "} [response] " + method.resolvedResponseType.name - ]); - push(""); - pushComment([ - method.comment || "Calls " + method.name + ".", - "@function " + lcName, - "@memberof " + exportName(service), - "@instance", - "@param {" + exportName(method.resolvedRequestType, !config.forceMessage) + "} request " + method.resolvedRequestType.name + " message or plain object", - "@param {" + exportName(service) + "." + cbName + "} callback Node-style callback called with the error, if any, and " + method.resolvedResponseType.name, - "@returns {undefined}", - "@variation 1" - ]); - push("Object.defineProperty(" + escapeName(service.name) + ".prototype" + util.safeProp(lcName) + " = function " + escapeName(lcName) + "(request, callback) {"); - ++indent; - push("return this.rpcCall(" + escapeName(lcName) + ", $root." + exportName(method.resolvedRequestType) + ", $root." + exportName(method.resolvedResponseType) + ", request, callback);"); - --indent; - push("}, \"name\", { value: " + JSON.stringify(method.name) + " });"); - if (config.comments) - push(""); - pushComment([ - method.comment || "Calls " + method.name + ".", - "@function " + lcName, - "@memberof " + exportName(service), - "@instance", - "@param {" + exportName(method.resolvedRequestType, !config.forceMessage) + "} request " + method.resolvedRequestType.name + " message or plain object", - "@returns {Promise<" + exportName(method.resolvedResponseType) + ">} Promise", - "@variation 2" - ]); - }); -} - -function buildEnum(ref, enm) { - - push(""); - var comment = [ - enm.comment || enm.name + " enum.", - enm.parent instanceof protobuf.Root ? "@exports " + escapeName(enm.name) : "@name " + exportName(enm), - config.forceEnumString ? "@enum {string}" : "@enum {number}", - ]; - Object.keys(enm.values).forEach(function(key) { - var val = config.forceEnumString ? key : enm.values[key]; - comment.push((config.forceEnumString ? "@property {string} " : "@property {number} ") + key + "=" + val + " " + (enm.comments[key] || key + " value")); - }); - pushComment(comment); - if (!ref && config.es6) - push("export const " + escapeName(enm.name) + " = " + escapeName(ref) + "." + escapeName(enm.name) + " = (() => {"); - else - push(escapeName(ref) + "." + escapeName(enm.name) + " = (function() {"); - ++indent; - push((config.es6 ? "const" : "var") + " valuesById = {}, values = Object.create(valuesById);"); - var aliased = []; - Object.keys(enm.values).forEach(function(key) { - var valueId = enm.values[key]; - var val = config.forceEnumString ? JSON.stringify(key) : valueId; - if (aliased.indexOf(valueId) > -1) - push("values[" + JSON.stringify(key) + "] = " + val + ";"); - else { - push("values[valuesById[" + valueId + "] = " + JSON.stringify(key) + "] = " + val + ";"); - aliased.push(valueId); - } - }); - push("return values;"); - --indent; - push("})();"); -} diff --git a/node_modules/protobufjs/cli/util.js b/node_modules/protobufjs/cli/util.js deleted file mode 100644 index ffce1ed7..00000000 --- a/node_modules/protobufjs/cli/util.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -var fs = require("fs"), - path = require("path"), - child_process = require("child_process"); - -var semver; - -try { - // installed as a peer dependency - require.resolve("protobufjs"); - exports.pathToProtobufJs = "protobufjs"; -} catch (e) { - // local development, i.e. forked from github - exports.pathToProtobufJs = ".."; -} - -var protobuf = require(exports.pathToProtobufJs); - -function basenameCompare(a, b) { - var aa = String(a).replace(/\.\w+$/, "").split(/(-?\d*\.?\d+)/g), - bb = String(b).replace(/\.\w+$/, "").split(/(-?\d*\.?\d+)/g); - for (var i = 0, k = Math.min(aa.length, bb.length); i < k; i++) { - var x = parseFloat(aa[i]) || aa[i].toLowerCase(), - y = parseFloat(bb[i]) || bb[i].toLowerCase(); - if (x < y) - return -1; - if (x > y) - return 1; - } - return a.length < b.length ? -1 : 0; -} - -exports.requireAll = function requireAll(dirname) { - dirname = path.join(__dirname, dirname); - var files = fs.readdirSync(dirname).sort(basenameCompare), - all = {}; - files.forEach(function(file) { - var basename = path.basename(file, ".js"), - extname = path.extname(file); - if (extname === ".js") - all[basename] = require(path.join(dirname, file)); - }); - return all; -}; - -exports.traverse = function traverse(current, fn) { - fn(current); - if (current.fieldsArray) - current.fieldsArray.forEach(function(field) { - traverse(field, fn); - }); - if (current.oneofsArray) - current.oneofsArray.forEach(function(oneof) { - traverse(oneof, fn); - }); - if (current.methodsArray) - current.methodsArray.forEach(function(method) { - traverse(method, fn); - }); - if (current.nestedArray) - current.nestedArray.forEach(function(nested) { - traverse(nested, fn); - }); -}; - -exports.traverseResolved = function traverseResolved(current, fn) { - fn(current); - if (current.resolvedType) - traverseResolved(current.resolvedType, fn); - if (current.resolvedKeyType) - traverseResolved(current.resolvedKeyType, fn); - if (current.resolvedRequestType) - traverseResolved(current.resolvedRequestType, fn); - if (current.resolvedResponseType) - traverseResolved(current.resolvedResponseType, fn); -}; - -exports.inspect = function inspect(object, indent) { - if (!object) - return ""; - var chalk = require("chalk"); - var sb = []; - if (!indent) - indent = ""; - var ind = indent ? indent.substring(0, indent.length - 2) + "└ " : ""; - sb.push( - ind + chalk.bold(object.toString()) + (object.visible ? " (visible)" : ""), - indent + chalk.gray("parent: ") + object.parent - ); - if (object instanceof protobuf.Field) { - if (object.extend !== undefined) - sb.push(indent + chalk.gray("extend: ") + object.extend); - if (object.partOf) - sb.push(indent + chalk.gray("oneof : ") + object.oneof); - } - sb.push(""); - if (object.fieldsArray) - object.fieldsArray.forEach(function(field) { - sb.push(inspect(field, indent + " ")); - }); - if (object.oneofsArray) - object.oneofsArray.forEach(function(oneof) { - sb.push(inspect(oneof, indent + " ")); - }); - if (object.methodsArray) - object.methodsArray.forEach(function(service) { - sb.push(inspect(service, indent + " ")); - }); - if (object.nestedArray) - object.nestedArray.forEach(function(nested) { - sb.push(inspect(nested, indent + " ")); - }); - return sb.join("\n"); -}; - -function modExists(name, version) { - for (var i = 0; i < module.paths.length; ++i) { - try { - var pkg = JSON.parse(fs.readFileSync(path.join(module.paths[i], name, "package.json"))); - return semver - ? semver.satisfies(pkg.version, version) - : parseInt(pkg.version, 10) === parseInt(version.replace(/^[\^~]/, ""), 10); // used for semver only - } catch (e) {/**/} - } - return false; -} - -function modInstall(install) { - child_process.execSync("npm --silent install " + (typeof install === "string" ? install : install.join(" ")), { - cwd: __dirname, - stdio: "ignore" - }); -} - -exports.setup = function() { - var pkg = require(path.join(__dirname, "..", "package.json")); - var version = pkg.dependencies["semver"] || pkg.devDependencies["semver"]; - if (!modExists("semver", version)) { - process.stderr.write("installing semver@" + version + "\n"); - modInstall("semver@" + version); - } - semver = require("semver"); // used from now on for version comparison - var install = []; - pkg.cliDependencies.forEach(function(name) { - if (name === "semver") - return; - version = pkg.dependencies[name] || pkg.devDependencies[name]; - if (!modExists(name, version)) { - process.stderr.write("installing " + name + "@" + version + "\n"); - install.push(name + "@" + version); - } - }); - require("../scripts/postinstall"); // emit postinstall warning, if any - if (!install.length) - return; - modInstall(install); -}; - -exports.wrap = function(OUTPUT, options) { - var name = options.wrap || "default"; - var wrap; - try { - // try built-in wrappers first - wrap = fs.readFileSync(path.join(__dirname, "wrappers", name + ".js")).toString("utf8"); - } catch (e) { - // otherwise fetch the custom one - wrap = fs.readFileSync(path.resolve(process.cwd(), name)).toString("utf8"); - } - wrap = wrap.replace(/\$DEPENDENCY/g, JSON.stringify(options.dependency || "protobufjs")); - wrap = wrap.replace(/( *)\$OUTPUT;/, function($0, $1) { - return $1.length ? OUTPUT.replace(/^/mg, $1) : OUTPUT; - }); - if (options.lint !== "") - wrap = "/*" + options.lint + "*/\n" + wrap; - return wrap.replace(/\r?\n/g, "\n"); -}; - -exports.pad = function(str, len, l) { - while (str.length < len) - str = l ? str + " " : " " + str; - return str; -}; - diff --git a/node_modules/protobufjs/cli/wrappers/amd.js b/node_modules/protobufjs/cli/wrappers/amd.js deleted file mode 100644 index c43dd73c..00000000 --- a/node_modules/protobufjs/cli/wrappers/amd.js +++ /dev/null @@ -1,7 +0,0 @@ -define([$DEPENDENCY], function($protobuf) { - "use strict"; - - $OUTPUT; - - return $root; -}); diff --git a/node_modules/protobufjs/cli/wrappers/closure.js b/node_modules/protobufjs/cli/wrappers/closure.js deleted file mode 100644 index c94327c5..00000000 --- a/node_modules/protobufjs/cli/wrappers/closure.js +++ /dev/null @@ -1,7 +0,0 @@ -(function($protobuf) { - "use strict"; - - $OUTPUT; - - return $root; -})(protobuf); diff --git a/node_modules/protobufjs/cli/wrappers/commonjs.js b/node_modules/protobufjs/cli/wrappers/commonjs.js deleted file mode 100644 index 6dc91684..00000000 --- a/node_modules/protobufjs/cli/wrappers/commonjs.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -var $protobuf = require($DEPENDENCY); - -$OUTPUT; - -module.exports = $root; diff --git a/node_modules/protobufjs/cli/wrappers/default.js b/node_modules/protobufjs/cli/wrappers/default.js deleted file mode 100644 index 34b29ec7..00000000 --- a/node_modules/protobufjs/cli/wrappers/default.js +++ /dev/null @@ -1,15 +0,0 @@ -(function(global, factory) { /* global define, require, module */ - - /* AMD */ if (typeof define === 'function' && define.amd) - define([$DEPENDENCY], factory); - - /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require($DEPENDENCY)); - -})(this, function($protobuf) { - "use strict"; - - $OUTPUT; - - return $root; -}); diff --git a/node_modules/protobufjs/cli/wrappers/es6.js b/node_modules/protobufjs/cli/wrappers/es6.js deleted file mode 100644 index 5bdc43c6..00000000 --- a/node_modules/protobufjs/cli/wrappers/es6.js +++ /dev/null @@ -1,5 +0,0 @@ -import * as $protobuf from $DEPENDENCY; - -$OUTPUT; - -export { $root as default }; diff --git a/node_modules/protobufjs/dist/README.md b/node_modules/protobufjs/dist/README.md deleted file mode 100644 index 93a54ccd..00000000 --- a/node_modules/protobufjs/dist/README.md +++ /dev/null @@ -1,31 +0,0 @@ -This folder contains prebuilt browser versions of the full library. When sending pull requests, it is not required to update these. - -Prebuilt files are in source control to enable pain-free frontend respectively CDN usage: - -CDN usage ---------- - -Development: -``` - -``` - -Production: -``` - -``` - -**NOTE:** Remember to replace the version tag with the exact [release](https://github.com/dcodeIO/protobuf.js/tags) your project depends upon. - -Frontend usage --------------- - -Development: -``` - -``` - -Production: -``` - -``` diff --git a/node_modules/protobufjs/dist/light/README.md b/node_modules/protobufjs/dist/light/README.md deleted file mode 100644 index 2122c3fd..00000000 --- a/node_modules/protobufjs/dist/light/README.md +++ /dev/null @@ -1,31 +0,0 @@ -This folder contains prebuilt browser versions of the light library suitable for use with reflection, static code and JSON descriptors / modules. When sending pull requests, it is not required to update these. - -Prebuilt files are in source control to enable pain-free frontend respectively CDN usage: - -CDN usage ---------- - -Development: -``` - -``` - -Production: -``` - -``` - -**NOTE:** Remember to replace the version tag with the exact [release](https://github.com/dcodeIO/protobuf.js/tags) your project depends upon. - -Frontend usage --------------- - -Development: -``` - -``` - -Production: -``` - -``` diff --git a/node_modules/protobufjs/dist/light/protobuf.js b/node_modules/protobufjs/dist/light/protobuf.js deleted file mode 100644 index 3cb67d9c..00000000 --- a/node_modules/protobufjs/dist/light/protobuf.js +++ /dev/null @@ -1,7310 +0,0 @@ -/*! - * protobuf.js v6.10.0 (c) 2016, daniel wirtz - * compiled wed, 15 jul 2020 23:34:13 utc - * licensed under the bsd-3-clause license - * see: https://github.com/dcodeio/protobuf.js for details - */ -(function(undefined){"use strict";(function prelude(modules, cache, entries) { - - // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS - // sources through a conflict-free require shim and is again wrapped within an iife that - // provides a minification-friendly `undefined` var plus a global "use strict" directive - // so that minification can remove the directives of each module. - - function $require(name) { - var $module = cache[name]; - if (!$module) - modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports); - return $module.exports; - } - - var protobuf = $require(entries[0]); - - // Expose globally - protobuf.util.global.protobuf = protobuf; - - // Be nice to AMD - if (typeof define === "function" && define.amd) - define(["long"], function(Long) { - if (Long && Long.isLong) { - protobuf.util.Long = Long; - protobuf.configure(); - } - return protobuf; - }); - - // Be nice to CommonJS - if (typeof module === "object" && module && module.exports) - module.exports = protobuf; - -})/* end of prelude */({1:[function(require,module,exports){ -"use strict"; -module.exports = asPromise; - -/** - * Callback as used by {@link util.asPromise}. - * @typedef asPromiseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {...*} params Additional arguments - * @returns {undefined} - */ - -/** - * Returns a promise from a node-style callback function. - * @memberof util - * @param {asPromiseCallback} fn Function to call - * @param {*} ctx Function context - * @param {...*} params Function arguments - * @returns {Promise<*>} Promisified function - */ -function asPromise(fn, ctx/*, varargs */) { - var params = new Array(arguments.length - 1), - offset = 0, - index = 2, - pending = true; - while (index < arguments.length) - params[offset++] = arguments[index++]; - return new Promise(function executor(resolve, reject) { - params[offset] = function callback(err/*, varargs */) { - if (pending) { - pending = false; - if (err) - reject(err); - else { - var params = new Array(arguments.length - 1), - offset = 0; - while (offset < params.length) - params[offset++] = arguments[offset]; - resolve.apply(null, params); - } - } - }; - try { - fn.apply(ctx || null, params); - } catch (err) { - if (pending) { - pending = false; - reject(err); - } - } - }); -} - -},{}],2:[function(require,module,exports){ -"use strict"; - -/** - * A minimal base64 implementation for number arrays. - * @memberof util - * @namespace - */ -var base64 = exports; - -/** - * Calculates the byte length of a base64 encoded string. - * @param {string} string Base64 encoded string - * @returns {number} Byte length - */ -base64.length = function length(string) { - var p = string.length; - if (!p) - return 0; - var n = 0; - while (--p % 4 > 1 && string.charAt(p) === "=") - ++n; - return Math.ceil(string.length * 3) / 4 - n; -}; - -// Base64 encoding table -var b64 = new Array(64); - -// Base64 decoding table -var s64 = new Array(123); - -// 65..90, 97..122, 48..57, 43, 47 -for (var i = 0; i < 64;) - s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; - -/** - * Encodes a buffer to a base64 encoded string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} Base64 encoded string - */ -base64.encode = function encode(buffer, start, end) { - var parts = null, - chunk = []; - var i = 0, // output index - j = 0, // goto index - t; // temporary - while (start < end) { - var b = buffer[start++]; - switch (j) { - case 0: - chunk[i++] = b64[b >> 2]; - t = (b & 3) << 4; - j = 1; - break; - case 1: - chunk[i++] = b64[t | b >> 4]; - t = (b & 15) << 2; - j = 2; - break; - case 2: - chunk[i++] = b64[t | b >> 6]; - chunk[i++] = b64[b & 63]; - j = 0; - break; - } - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (j) { - chunk[i++] = b64[t]; - chunk[i++] = 61; - if (j === 1) - chunk[i++] = 61; - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -var invalidEncoding = "invalid encoding"; - -/** - * Decodes a base64 encoded string to a buffer. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Number of bytes written - * @throws {Error} If encoding is invalid - */ -base64.decode = function decode(string, buffer, offset) { - var start = offset; - var j = 0, // goto index - t; // temporary - for (var i = 0; i < string.length;) { - var c = string.charCodeAt(i++); - if (c === 61 && j > 1) - break; - if ((c = s64[c]) === undefined) - throw Error(invalidEncoding); - switch (j) { - case 0: - t = c; - j = 1; - break; - case 1: - buffer[offset++] = t << 2 | (c & 48) >> 4; - t = c; - j = 2; - break; - case 2: - buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; - t = c; - j = 3; - break; - case 3: - buffer[offset++] = (t & 3) << 6 | c; - j = 0; - break; - } - } - if (j === 1) - throw Error(invalidEncoding); - return offset - start; -}; - -/** - * Tests if the specified string appears to be base64 encoded. - * @param {string} string String to test - * @returns {boolean} `true` if probably base64 encoded, otherwise false - */ -base64.test = function test(string) { - return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); -}; - -},{}],3:[function(require,module,exports){ -"use strict"; -module.exports = codegen; - -/** - * Begins generating a function. - * @memberof util - * @param {string[]} functionParams Function parameter names - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - */ -function codegen(functionParams, functionName) { - - /* istanbul ignore if */ - if (typeof functionParams === "string") { - functionName = functionParams; - functionParams = undefined; - } - - var body = []; - - /** - * Appends code to the function's body or finishes generation. - * @typedef Codegen - * @type {function} - * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any - * @param {...*} [formatParams] Format parameters - * @returns {Codegen|Function} Itself or the generated function if finished - * @throws {Error} If format parameter counts do not match - */ - - function Codegen(formatStringOrScope) { - // note that explicit array handling below makes this ~50% faster - - // finish the function - if (typeof formatStringOrScope !== "string") { - var source = toString(); - if (codegen.verbose) - console.log("codegen: " + source); // eslint-disable-line no-console - source = "return " + source; - if (formatStringOrScope) { - var scopeKeys = Object.keys(formatStringOrScope), - scopeParams = new Array(scopeKeys.length + 1), - scopeValues = new Array(scopeKeys.length), - scopeOffset = 0; - while (scopeOffset < scopeKeys.length) { - scopeParams[scopeOffset] = scopeKeys[scopeOffset]; - scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; - } - scopeParams[scopeOffset] = source; - return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func - } - return Function(source)(); // eslint-disable-line no-new-func - } - - // otherwise append to body - var formatParams = new Array(arguments.length - 1), - formatOffset = 0; - while (formatOffset < formatParams.length) - formatParams[formatOffset] = arguments[++formatOffset]; - formatOffset = 0; - formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) { - var value = formatParams[formatOffset++]; - switch ($1) { - case "d": case "f": return String(Number(value)); - case "i": return String(Math.floor(value)); - case "j": return JSON.stringify(value); - case "s": return String(value); - } - return "%"; - }); - if (formatOffset !== formatParams.length) - throw Error("parameter count mismatch"); - body.push(formatStringOrScope); - return Codegen; - } - - function toString(functionNameOverride) { - return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}"; - } - - Codegen.toString = toString; - return Codegen; -} - -/** - * Begins generating a function. - * @memberof util - * @function codegen - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - * @variation 2 - */ - -/** - * When set to `true`, codegen will log generated code to console. Useful for debugging. - * @name util.codegen.verbose - * @type {boolean} - */ -codegen.verbose = false; - -},{}],4:[function(require,module,exports){ -"use strict"; -module.exports = EventEmitter; - -/** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ -function EventEmitter() { - - /** - * Registered listeners. - * @type {Object.} - * @private - */ - this._listeners = {}; -} - -/** - * Registers an event listener. - * @param {string} evt Event name - * @param {function} fn Listener - * @param {*} [ctx] Listener context - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.on = function on(evt, fn, ctx) { - (this._listeners[evt] || (this._listeners[evt] = [])).push({ - fn : fn, - ctx : ctx || this - }); - return this; -}; - -/** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param {string} [evt] Event name. Removes all listeners if omitted. - * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.off = function off(evt, fn) { - if (evt === undefined) - this._listeners = {}; - else { - if (fn === undefined) - this._listeners[evt] = []; - else { - var listeners = this._listeners[evt]; - for (var i = 0; i < listeners.length;) - if (listeners[i].fn === fn) - listeners.splice(i, 1); - else - ++i; - } - } - return this; -}; - -/** - * Emits an event by calling its listeners with the specified arguments. - * @param {string} evt Event name - * @param {...*} args Arguments - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.emit = function emit(evt) { - var listeners = this._listeners[evt]; - if (listeners) { - var args = [], - i = 1; - for (; i < arguments.length;) - args.push(arguments[i++]); - for (i = 0; i < listeners.length;) - listeners[i].fn.apply(listeners[i++].ctx, args); - } - return this; -}; - -},{}],5:[function(require,module,exports){ -"use strict"; -module.exports = fetch; - -var asPromise = require(1), - inquire = require(7); - -var fs = inquire("fs"); - -/** - * Node-style callback as used by {@link util.fetch}. - * @typedef FetchCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {string} [contents] File contents, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Options as used by {@link util.fetch}. - * @typedef FetchOptions - * @type {Object} - * @property {boolean} [binary=false] Whether expecting a binary response - * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest - */ - -/** - * Fetches the contents of a file. - * @memberof util - * @param {string} filename File path or url - * @param {FetchOptions} options Fetch options - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -function fetch(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = {}; - } else if (!options) - options = {}; - - if (!callback) - return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this - - // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found. - if (!options.xhr && fs && fs.readFile) - return fs.readFile(filename, function fetchReadFileCallback(err, contents) { - return err && typeof XMLHttpRequest !== "undefined" - ? fetch.xhr(filename, options, callback) - : err - ? callback(err) - : callback(null, options.binary ? contents : contents.toString("utf8")); - }); - - // use the XHR version otherwise. - return fetch.xhr(filename, options, callback); -} - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchOptions} [options] Fetch options - * @returns {Promise} Promise - * @variation 3 - */ - -/**/ -fetch.xhr = function fetch_xhr(filename, options, callback) { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() { - - if (xhr.readyState !== 4) - return undefined; - - // local cors security errors return status 0 / empty string, too. afaik this cannot be - // reliably distinguished from an actually empty file for security reasons. feel free - // to send a pull request if you are aware of a solution. - if (xhr.status !== 0 && xhr.status !== 200) - return callback(Error("status " + xhr.status)); - - // if binary data is expected, make sure that some sort of array is returned, even if - // ArrayBuffers are not supported. the binary string fallback, however, is unsafe. - if (options.binary) { - var buffer = xhr.response; - if (!buffer) { - buffer = []; - for (var i = 0; i < xhr.responseText.length; ++i) - buffer.push(xhr.responseText.charCodeAt(i) & 255); - } - return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); - } - return callback(null, xhr.responseText); - }; - - if (options.binary) { - // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers - if ("overrideMimeType" in xhr) - xhr.overrideMimeType("text/plain; charset=x-user-defined"); - xhr.responseType = "arraybuffer"; - } - - xhr.open("GET", filename); - xhr.send(); -}; - -},{"1":1,"7":7}],6:[function(require,module,exports){ -"use strict"; - -module.exports = factory(factory); - -/** - * Reads / writes floats / doubles from / to buffers. - * @name util.float - * @namespace - */ - -/** - * Writes a 32 bit float to a buffer using little endian byte order. - * @name util.float.writeFloatLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 32 bit float to a buffer using big endian byte order. - * @name util.float.writeFloatBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 32 bit float from a buffer using little endian byte order. - * @name util.float.readFloatLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 32 bit float from a buffer using big endian byte order. - * @name util.float.readFloatBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Writes a 64 bit double to a buffer using little endian byte order. - * @name util.float.writeDoubleLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 64 bit double to a buffer using big endian byte order. - * @name util.float.writeDoubleBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 64 bit double from a buffer using little endian byte order. - * @name util.float.readDoubleLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 64 bit double from a buffer using big endian byte order. - * @name util.float.readDoubleBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -// Factory function for the purpose of node-based testing in modified global environments -function factory(exports) { - - // float: typed array - if (typeof Float32Array !== "undefined") (function() { - - var f32 = new Float32Array([ -0 ]), - f8b = new Uint8Array(f32.buffer), - le = f8b[3] === 128; - - function writeFloat_f32_cpy(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - } - - function writeFloat_f32_rev(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[3]; - buf[pos + 1] = f8b[2]; - buf[pos + 2] = f8b[1]; - buf[pos + 3] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; - /* istanbul ignore next */ - exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; - - function readFloat_f32_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - return f32[0]; - } - - function readFloat_f32_rev(buf, pos) { - f8b[3] = buf[pos ]; - f8b[2] = buf[pos + 1]; - f8b[1] = buf[pos + 2]; - f8b[0] = buf[pos + 3]; - return f32[0]; - } - - /* istanbul ignore next */ - exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; - /* istanbul ignore next */ - exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; - - // float: ieee754 - })(); else (function() { - - function writeFloat_ieee754(writeUint, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); - else if (isNaN(val)) - writeUint(2143289344, buf, pos); - else if (val > 3.4028234663852886e+38) // +-Infinity - writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); - else if (val < 1.1754943508222875e-38) // denormal - writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); - else { - var exponent = Math.floor(Math.log(val) / Math.LN2), - mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; - writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); - } - } - - exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); - exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); - - function readFloat_ieee754(readUint, buf, pos) { - var uint = readUint(buf, pos), - sign = (uint >> 31) * 2 + 1, - exponent = uint >>> 23 & 255, - mantissa = uint & 8388607; - return exponent === 255 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 1.401298464324817e-45 * mantissa - : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); - } - - exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); - exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); - - })(); - - // double: typed array - if (typeof Float64Array !== "undefined") (function() { - - var f64 = new Float64Array([-0]), - f8b = new Uint8Array(f64.buffer), - le = f8b[7] === 128; - - function writeDouble_f64_cpy(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - buf[pos + 4] = f8b[4]; - buf[pos + 5] = f8b[5]; - buf[pos + 6] = f8b[6]; - buf[pos + 7] = f8b[7]; - } - - function writeDouble_f64_rev(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[7]; - buf[pos + 1] = f8b[6]; - buf[pos + 2] = f8b[5]; - buf[pos + 3] = f8b[4]; - buf[pos + 4] = f8b[3]; - buf[pos + 5] = f8b[2]; - buf[pos + 6] = f8b[1]; - buf[pos + 7] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; - /* istanbul ignore next */ - exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; - - function readDouble_f64_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - f8b[4] = buf[pos + 4]; - f8b[5] = buf[pos + 5]; - f8b[6] = buf[pos + 6]; - f8b[7] = buf[pos + 7]; - return f64[0]; - } - - function readDouble_f64_rev(buf, pos) { - f8b[7] = buf[pos ]; - f8b[6] = buf[pos + 1]; - f8b[5] = buf[pos + 2]; - f8b[4] = buf[pos + 3]; - f8b[3] = buf[pos + 4]; - f8b[2] = buf[pos + 5]; - f8b[1] = buf[pos + 6]; - f8b[0] = buf[pos + 7]; - return f64[0]; - } - - /* istanbul ignore next */ - exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; - /* istanbul ignore next */ - exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; - - // double: ieee754 - })(); else (function() { - - function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) { - writeUint(0, buf, pos + off0); - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); - } else if (isNaN(val)) { - writeUint(0, buf, pos + off0); - writeUint(2146959360, buf, pos + off1); - } else if (val > 1.7976931348623157e+308) { // +-Infinity - writeUint(0, buf, pos + off0); - writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); - } else { - var mantissa; - if (val < 2.2250738585072014e-308) { // denormal - mantissa = val / 5e-324; - writeUint(mantissa >>> 0, buf, pos + off0); - writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); - } else { - var exponent = Math.floor(Math.log(val) / Math.LN2); - if (exponent === 1024) - exponent = 1023; - mantissa = val * Math.pow(2, -exponent); - writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); - writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); - } - } - } - - exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); - exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); - - function readDouble_ieee754(readUint, off0, off1, buf, pos) { - var lo = readUint(buf, pos + off0), - hi = readUint(buf, pos + off1); - var sign = (hi >> 31) * 2 + 1, - exponent = hi >>> 20 & 2047, - mantissa = 4294967296 * (hi & 1048575) + lo; - return exponent === 2047 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 5e-324 * mantissa - : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); - } - - exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); - exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); - - })(); - - return exports; -} - -// uint helpers - -function writeUintLE(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -function writeUintBE(val, buf, pos) { - buf[pos ] = val >>> 24; - buf[pos + 1] = val >>> 16 & 255; - buf[pos + 2] = val >>> 8 & 255; - buf[pos + 3] = val & 255; -} - -function readUintLE(buf, pos) { - return (buf[pos ] - | buf[pos + 1] << 8 - | buf[pos + 2] << 16 - | buf[pos + 3] << 24) >>> 0; -} - -function readUintBE(buf, pos) { - return (buf[pos ] << 24 - | buf[pos + 1] << 16 - | buf[pos + 2] << 8 - | buf[pos + 3]) >>> 0; -} - -},{}],7:[function(require,module,exports){ -"use strict"; -module.exports = inquire; - -/** - * Requires a module only if available. - * @memberof util - * @param {string} moduleName Module to require - * @returns {?Object} Required module if available and not empty, otherwise `null` - */ -function inquire(moduleName) { - try { - var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval - if (mod && (mod.length || Object.keys(mod).length)) - return mod; - } catch (e) {} // eslint-disable-line no-empty - return null; -} - -},{}],8:[function(require,module,exports){ -"use strict"; - -/** - * A minimal path module to resolve Unix, Windows and URL paths alike. - * @memberof util - * @namespace - */ -var path = exports; - -var isAbsolute = -/** - * Tests if the specified path is absolute. - * @param {string} path Path to test - * @returns {boolean} `true` if path is absolute - */ -path.isAbsolute = function isAbsolute(path) { - return /^(?:\/|\w+:)/.test(path); -}; - -var normalize = -/** - * Normalizes the specified path. - * @param {string} path Path to normalize - * @returns {string} Normalized path - */ -path.normalize = function normalize(path) { - path = path.replace(/\\/g, "/") - .replace(/\/{2,}/g, "/"); - var parts = path.split("/"), - absolute = isAbsolute(path), - prefix = ""; - if (absolute) - prefix = parts.shift() + "/"; - for (var i = 0; i < parts.length;) { - if (parts[i] === "..") { - if (i > 0 && parts[i - 1] !== "..") - parts.splice(--i, 2); - else if (absolute) - parts.splice(i, 1); - else - ++i; - } else if (parts[i] === ".") - parts.splice(i, 1); - else - ++i; - } - return prefix + parts.join("/"); -}; - -/** - * Resolves the specified include path against the specified origin path. - * @param {string} originPath Path to the origin file - * @param {string} includePath Include path relative to origin path - * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized - * @returns {string} Path to the include file - */ -path.resolve = function resolve(originPath, includePath, alreadyNormalized) { - if (!alreadyNormalized) - includePath = normalize(includePath); - if (isAbsolute(includePath)) - return includePath; - if (!alreadyNormalized) - originPath = normalize(originPath); - return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; -}; - -},{}],9:[function(require,module,exports){ -"use strict"; -module.exports = pool; - -/** - * An allocator as used by {@link util.pool}. - * @typedef PoolAllocator - * @type {function} - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ - -/** - * A slicer as used by {@link util.pool}. - * @typedef PoolSlicer - * @type {function} - * @param {number} start Start offset - * @param {number} end End offset - * @returns {Uint8Array} Buffer slice - * @this {Uint8Array} - */ - -/** - * A general purpose buffer pool. - * @memberof util - * @function - * @param {PoolAllocator} alloc Allocator - * @param {PoolSlicer} slice Slicer - * @param {number} [size=8192] Slab size - * @returns {PoolAllocator} Pooled allocator - */ -function pool(alloc, slice, size) { - var SIZE = size || 8192; - var MAX = SIZE >>> 1; - var slab = null; - var offset = SIZE; - return function pool_alloc(size) { - if (size < 1 || size > MAX) - return alloc(size); - if (offset + size > SIZE) { - slab = alloc(SIZE); - offset = 0; - } - var buf = slice.call(slab, offset, offset += size); - if (offset & 7) // align to 32 bit - offset = (offset | 7) + 1; - return buf; - }; -} - -},{}],10:[function(require,module,exports){ -"use strict"; - -/** - * A minimal UTF8 implementation for number arrays. - * @memberof util - * @namespace - */ -var utf8 = exports; - -/** - * Calculates the UTF8 byte length of a string. - * @param {string} string String - * @returns {number} Byte length - */ -utf8.length = function utf8_length(string) { - var len = 0, - c = 0; - for (var i = 0; i < string.length; ++i) { - c = string.charCodeAt(i); - if (c < 128) - len += 1; - else if (c < 2048) - len += 2; - else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { - ++i; - len += 4; - } else - len += 3; - } - return len; -}; - -/** - * Reads UTF8 bytes as a string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} String read - */ -utf8.read = function utf8_read(buffer, start, end) { - var len = end - start; - if (len < 1) - return ""; - var parts = null, - chunk = [], - i = 0, // char offset - t; // temporary - while (start < end) { - t = buffer[start++]; - if (t < 128) - chunk[i++] = t; - else if (t > 191 && t < 224) - chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; - else if (t > 239 && t < 365) { - t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; - chunk[i++] = 0xD800 + (t >> 10); - chunk[i++] = 0xDC00 + (t & 1023); - } else - chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -/** - * Writes a string as UTF8 bytes. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Bytes written - */ -utf8.write = function utf8_write(string, buffer, offset) { - var start = offset, - c1, // character 1 - c2; // character 2 - for (var i = 0; i < string.length; ++i) { - c1 = string.charCodeAt(i); - if (c1 < 128) { - buffer[offset++] = c1; - } else if (c1 < 2048) { - buffer[offset++] = c1 >> 6 | 192; - buffer[offset++] = c1 & 63 | 128; - } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - ++i; - buffer[offset++] = c1 >> 18 | 240; - buffer[offset++] = c1 >> 12 & 63 | 128; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } else { - buffer[offset++] = c1 >> 12 | 224; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } - } - return offset - start; -}; - -},{}],11:[function(require,module,exports){ -"use strict"; -/** - * Runtime message from/to plain object converters. - * @namespace - */ -var converter = exports; - -var Enum = require(14), - util = require(33); - -/** - * Generates a partial value fromObject conveter. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} prop Property reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genValuePartial_fromObject(gen, field, fieldIndex, prop) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(d%s){", prop); - for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) { - if (field.repeated && values[keys[i]] === field.typeDefault) gen - ("default:"); - gen - ("case%j:", keys[i]) - ("case %i:", values[keys[i]]) - ("m%s=%j", prop, values[keys[i]]) - ("break"); - } gen - ("}"); - } else gen - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s=types[%i].fromObject(d%s)", prop, fieldIndex, prop); - } else { - var isUnsigned = false; - switch (field.type) { - case "double": - case "float": gen - ("m%s=Number(d%s)", prop, prop); // also catches "NaN", "Infinity" - break; - case "uint32": - case "fixed32": gen - ("m%s=d%s>>>0", prop, prop); - break; - case "int32": - case "sint32": - case "sfixed32": gen - ("m%s=d%s|0", prop, prop); - break; - case "uint64": - isUnsigned = true; - // eslint-disable-line no-fallthrough - case "int64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(util.Long)") - ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned) - ("else if(typeof d%s===\"string\")", prop) - ("m%s=parseInt(d%s,10)", prop, prop) - ("else if(typeof d%s===\"number\")", prop) - ("m%s=d%s", prop, prop) - ("else if(typeof d%s===\"object\")", prop) - ("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : ""); - break; - case "bytes": gen - ("if(typeof d%s===\"string\")", prop) - ("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop) - ("else if(d%s.length)", prop) - ("m%s=d%s", prop, prop); - break; - case "string": gen - ("m%s=String(d%s)", prop, prop); - break; - case "bool": gen - ("m%s=Boolean(d%s)", prop, prop); - break; - /* default: gen - ("m%s=d%s", prop, prop); - break; */ - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a plain object to runtime message converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.fromObject = function fromObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray; - var gen = util.codegen(["d"], mtype.name + "$fromObject") - ("if(d instanceof this.ctor)") - ("return d"); - if (!fields.length) return gen - ("return new this.ctor"); - gen - ("var m=new this.ctor"); - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - prop = util.safeProp(field.name); - - // Map fields - if (field.map) { gen - ("if(d%s){", prop) - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s={}", prop) - ("for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop); - break; - case "bytes": gen - ("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop); - break; - default: gen - ("d%s=m%s", prop, prop); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a runtime message to plain object converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.toObject = function toObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); - if (!fields.length) - return util.codegen()("return {}"); - var gen = util.codegen(["m", "o"], mtype.name + "$toObject") - ("if(!o)") - ("o={}") - ("var d={}"); - - var repeatedFields = [], - mapFields = [], - normalFields = [], - i = 0; - for (; i < fields.length; ++i) - if (!fields[i].partOf) - ( fields[i].resolve().repeated ? repeatedFields - : fields[i].map ? mapFields - : normalFields).push(fields[i]); - - if (repeatedFields.length) { gen - ("if(o.arrays||o.defaults){"); - for (i = 0; i < repeatedFields.length; ++i) gen - ("d%s=[]", util.safeProp(repeatedFields[i].name)); - gen - ("}"); - } - - if (mapFields.length) { gen - ("if(o.objects||o.defaults){"); - for (i = 0; i < mapFields.length; ++i) gen - ("d%s={}", util.safeProp(mapFields[i].name)); - gen - ("}"); - } - - if (normalFields.length) { gen - ("if(o.defaults){"); - for (i = 0; i < normalFields.length; ++i) { - var field = normalFields[i], - prop = util.safeProp(field.name); - if (field.resolvedType instanceof Enum) gen - ("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault); - else if (field.long) gen - ("if(util.Long){") - ("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned) - ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop) - ("}else") - ("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber()); - else if (field.bytes) { - var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]"; - gen - ("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault)) - ("else{") - ("d%s=%s", prop, arrayDefault) - ("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop) - ("}"); - } else gen - ("d%s=%j", prop, field.typeDefault); // also messages (=null) - } gen - ("}"); - } - var hasKs2 = false; - for (i = 0; i < fields.length; ++i) { - var field = fields[i], - index = mtype._fieldsArray.indexOf(field), - prop = util.safeProp(field.name); - if (field.map) { - if (!hasKs2) { hasKs2 = true; gen - ("var ks2"); - } gen - ("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop) - ("d%s={}", prop) - ("for(var j=0;j>>3){"); - - var i = 0; - for (; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - ref = "m" + util.safeProp(field.name); gen - ("case %i:", field.id); - - // Map fields - if (field.map) { gen - ("if(%s===util.emptyObject)", ref) - ("%s={}", ref) - ("var c2 = r.uint32()+r.pos"); - - if (types.defaults[field.keyType] !== undefined) gen - ("k=%j", types.defaults[field.keyType]); - else gen - ("k=null"); - - if (types.defaults[type] !== undefined) gen - ("value=%j", types.defaults[type]); - else gen - ("value=null"); - - gen - ("while(r.pos>>3){") - ("case 1: k=r.%s(); break", field.keyType) - ("case 2:"); - - if (types.basic[type] === undefined) gen - ("value=types[%i].decode(r,r.uint32())", i); // can't be groups - else gen - ("value=r.%s()", type); - - gen - ("break") - ("default:") - ("r.skipType(tag2&7)") - ("break") - ("}") - ("}"); - - if (types.long[field.keyType] !== undefined) gen - ("%s[typeof k===\"object\"?util.longToHash(k):k]=value", ref); - else gen - ("%s[k]=value", ref); - - // Repeated fields - } else if (field.repeated) { gen - - ("if(!(%s&&%s.length))", ref, ref) - ("%s=[]", ref); - - // Packable (always check for forward and backward compatiblity) - if (types.packed[type] !== undefined) gen - ("if((t&7)===2){") - ("var c2=r.uint32()+r.pos") - ("while(r.pos>> 0, (field.id << 3 | 4) >>> 0) - : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0); -} - -/** - * Generates an encoder specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function encoder(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var gen = util.codegen(["m", "w"], mtype.name + "$encode") - ("if(!w)") - ("w=Writer.create()"); - - var i, ref; - - // "when a message is serialized its known fields should be written sequentially by field number" - var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById); - - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - index = mtype._fieldsArray.indexOf(field), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - wireType = types.basic[type]; - ref = "m" + util.safeProp(field.name); - - // Map fields - if (field.map) { - gen - ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name) // !== undefined && !== null - ("for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType); - if (wireType === undefined) gen - ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups - else gen - (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); - gen - ("}") - ("}"); - - // Repeated fields - } else if (field.repeated) { gen - ("if(%s!=null&&%s.length){", ref, ref); // !== undefined && !== null - - // Packed repeated - if (field.packed && types.packed[type] !== undefined) { gen - - ("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0) - ("for(var i=0;i<%s.length;++i)", ref) - ("w.%s(%s[i])", type, ref) - ("w.ldelim()"); - - // Non-packed - } else { gen - - ("for(var i=0;i<%s.length;++i)", ref); - if (wireType === undefined) - genTypePartial(gen, field, index, ref + "[i]"); - else gen - ("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); - - } gen - ("}"); - - // Non-repeated - } else { - if (field.optional) gen - ("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", ref, field.name); // !== undefined && !== null - - if (wireType === undefined) - genTypePartial(gen, field, index, ref); - else gen - ("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref); - - } - } - - return gen - ("return w"); - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -},{"14":14,"32":32,"33":33}],14:[function(require,module,exports){ -"use strict"; -module.exports = Enum; - -// extends ReflectionObject -var ReflectionObject = require(22); -((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum"; - -var Namespace = require(21), - util = require(33); - -/** - * Constructs a new enum instance. - * @classdesc Reflected enum. - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {Object.} [values] Enum values as an object, by name - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this enum - * @param {Object.} [comments] The value comments for this enum - */ -function Enum(name, values, options, comment, comments) { - ReflectionObject.call(this, name, options); - - if (values && typeof values !== "object") - throw TypeError("values must be an object"); - - /** - * Enum values by id. - * @type {Object.} - */ - this.valuesById = {}; - - /** - * Enum values by name. - * @type {Object.} - */ - this.values = Object.create(this.valuesById); // toJSON, marker - - /** - * Enum comment text. - * @type {string|null} - */ - this.comment = comment; - - /** - * Value comment texts, if any. - * @type {Object.} - */ - this.comments = comments || {}; - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - // Note that values inherit valuesById on their prototype which makes them a TypeScript- - // compatible enum. This is used by pbts to write actual enum definitions that work for - // static and reflection code alike instead of emitting generic object definitions. - - if (values) - for (var keys = Object.keys(values), i = 0; i < keys.length; ++i) - if (typeof values[keys[i]] === "number") // use forward entries only - this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i]; -} - -/** - * Enum descriptor. - * @interface IEnum - * @property {Object.} values Enum values - * @property {Object.} [options] Enum options - */ - -/** - * Constructs an enum from an enum descriptor. - * @param {string} name Enum name - * @param {IEnum} json Enum descriptor - * @returns {Enum} Created enum - * @throws {TypeError} If arguments are invalid - */ -Enum.fromJSON = function fromJSON(name, json) { - var enm = new Enum(name, json.values, json.options, json.comment, json.comments); - enm.reserved = json.reserved; - return enm; -}; - -/** - * Converts this enum to an enum descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IEnum} Enum descriptor - */ -Enum.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "values" , this.values, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "comment" , keepComments ? this.comment : undefined, - "comments" , keepComments ? this.comments : undefined - ]); -}; - -/** - * Adds a value to this enum. - * @param {string} name Value name - * @param {number} id Value id - * @param {string} [comment] Comment, if any - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a value with this name or id - */ -Enum.prototype.add = function add(name, id, comment) { - // utilized by the parser but not by .fromJSON - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (!util.isInteger(id)) - throw TypeError("id must be an integer"); - - if (this.values[name] !== undefined) - throw Error("duplicate name '" + name + "' in " + this); - - if (this.isReservedId(id)) - throw Error("id " + id + " is reserved in " + this); - - if (this.isReservedName(name)) - throw Error("name '" + name + "' is reserved in " + this); - - if (this.valuesById[id] !== undefined) { - if (!(this.options && this.options.allow_alias)) - throw Error("duplicate id " + id + " in " + this); - this.values[name] = id; - } else - this.valuesById[this.values[name] = id] = name; - - this.comments[name] = comment || null; - return this; -}; - -/** - * Removes a value from this enum - * @param {string} name Value name - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `name` is not a name of this enum - */ -Enum.prototype.remove = function remove(name) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - var val = this.values[name]; - if (val == null) - throw Error("name '" + name + "' does not exist in " + this); - - delete this.valuesById[val]; - delete this.values[name]; - delete this.comments[name]; - - return this; -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; - -},{"21":21,"22":22,"33":33}],15:[function(require,module,exports){ -"use strict"; -module.exports = Field; - -// extends ReflectionObject -var ReflectionObject = require(22); -((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field"; - -var Enum = require(14), - types = require(32), - util = require(33); - -var Type; // cyclic - -var ruleRe = /^required|optional|repeated$/; - -/** - * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. - * @name Field - * @classdesc Reflected message field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a field from a field descriptor. - * @param {string} name Field name - * @param {IField} json Field descriptor - * @returns {Field} Created field - * @throws {TypeError} If arguments are invalid - */ -Field.fromJSON = function fromJSON(name, json) { - return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment); -}; - -/** - * Not an actual constructor. Use {@link Field} instead. - * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. - * @exports FieldBase - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function Field(name, id, type, rule, extend, options, comment) { - - if (util.isObject(rule)) { - comment = extend; - options = rule; - rule = extend = undefined; - } else if (util.isObject(extend)) { - comment = options; - options = extend; - extend = undefined; - } - - ReflectionObject.call(this, name, options); - - if (!util.isInteger(id) || id < 0) - throw TypeError("id must be a non-negative integer"); - - if (!util.isString(type)) - throw TypeError("type must be a string"); - - if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase())) - throw TypeError("rule must be a string rule"); - - if (extend !== undefined && !util.isString(extend)) - throw TypeError("extend must be a string"); - - /** - * Field rule, if any. - * @type {string|undefined} - */ - this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON - - /** - * Field type. - * @type {string} - */ - this.type = type; // toJSON - - /** - * Unique field id. - * @type {number} - */ - this.id = id; // toJSON, marker - - /** - * Extended type if different from parent. - * @type {string|undefined} - */ - this.extend = extend || undefined; // toJSON - - /** - * Whether this field is required. - * @type {boolean} - */ - this.required = rule === "required"; - - /** - * Whether this field is optional. - * @type {boolean} - */ - this.optional = !this.required; - - /** - * Whether this field is repeated. - * @type {boolean} - */ - this.repeated = rule === "repeated"; - - /** - * Whether this field is a map or not. - * @type {boolean} - */ - this.map = false; - - /** - * Message this field belongs to. - * @type {Type|null} - */ - this.message = null; - - /** - * OneOf this field belongs to, if any, - * @type {OneOf|null} - */ - this.partOf = null; - - /** - * The field type's default value. - * @type {*} - */ - this.typeDefault = null; - - /** - * The field's default value on prototypes. - * @type {*} - */ - this.defaultValue = null; - - /** - * Whether this field's value should be treated as a long. - * @type {boolean} - */ - this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false; - - /** - * Whether this field's value is a buffer. - * @type {boolean} - */ - this.bytes = type === "bytes"; - - /** - * Resolved type if not a basic type. - * @type {Type|Enum|null} - */ - this.resolvedType = null; - - /** - * Sister-field within the extended type if a declaring extension field. - * @type {Field|null} - */ - this.extensionField = null; - - /** - * Sister-field within the declaring namespace if an extended field. - * @type {Field|null} - */ - this.declaringField = null; - - /** - * Internally remembers whether this field is packed. - * @type {boolean|null} - * @private - */ - this._packed = null; - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Determines whether this field is packed. Only relevant when repeated and working with proto2. - * @name Field#packed - * @type {boolean} - * @readonly - */ -Object.defineProperty(Field.prototype, "packed", { - get: function() { - // defaults to packed=true if not explicity set to false - if (this._packed === null) - this._packed = this.getOption("packed") !== false; - return this._packed; - } -}); - -/** - * @override - */ -Field.prototype.setOption = function setOption(name, value, ifNotSet) { - if (name === "packed") // clear cached before setting - this._packed = null; - return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet); -}; - -/** - * Field descriptor. - * @interface IField - * @property {string} [rule="optional"] Field rule - * @property {string} type Field type - * @property {number} id Field id - * @property {Object.} [options] Field options - */ - -/** - * Extension field descriptor. - * @interface IExtensionField - * @extends IField - * @property {string} extend Extended type - */ - -/** - * Converts this field to a field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IField} Field descriptor - */ -Field.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "rule" , this.rule !== "optional" && this.rule || undefined, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Resolves this field's type references. - * @returns {Field} `this` - * @throws {Error} If any reference cannot be resolved - */ -Field.prototype.resolve = function resolve() { - - if (this.resolved) - return this; - - if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it - this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type); - if (this.resolvedType instanceof Type) - this.typeDefault = null; - else // instanceof Enum - this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined - } - - // use explicitly set default value if present - if (this.options && this.options["default"] != null) { - this.typeDefault = this.options["default"]; - if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string") - this.typeDefault = this.resolvedType.values[this.typeDefault]; - } - - // remove unnecessary options - if (this.options) { - if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum)) - delete this.options.packed; - if (!Object.keys(this.options).length) - this.options = undefined; - } - - // convert to internal data type if necesssary - if (this.long) { - this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"); - - /* istanbul ignore else */ - if (Object.freeze) - Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it) - - } else if (this.bytes && typeof this.typeDefault === "string") { - var buf; - if (util.base64.test(this.typeDefault)) - util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0); - else - util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0); - this.typeDefault = buf; - } - - // take special care of maps and repeated fields - if (this.map) - this.defaultValue = util.emptyObject; - else if (this.repeated) - this.defaultValue = util.emptyArray; - else - this.defaultValue = this.typeDefault; - - // ensure proper value on prototype - if (this.parent instanceof Type) - this.parent.ctor.prototype[this.name] = this.defaultValue; - - return ReflectionObject.prototype.resolve.call(this); -}; - -/** - * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript). - * @typedef FieldDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} fieldName Field name - * @returns {undefined} - */ - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|Object} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @param {T} [defaultValue] Default value - * @returns {FieldDecorator} Decorator function - * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[] - */ -Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) { - - // submessage: decorate the submessage and use its name as the type - if (typeof fieldType === "function") - fieldType = util.decorateType(fieldType).name; - - // enum reference: create a reflected copy of the enum and keep reuseing it - else if (fieldType && typeof fieldType === "object") - fieldType = util.decorateEnum(fieldType).name; - - return function fieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue })); - }; -}; - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {Constructor|string} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @returns {FieldDecorator} Decorator function - * @template T extends Message - * @variation 2 - */ -// like Field.d but without a default value - -// Sets up cyclic dependencies (called in index-light) -Field._configure = function configure(Type_) { - Type = Type_; -}; - -},{"14":14,"22":22,"32":32,"33":33}],16:[function(require,module,exports){ -"use strict"; -var protobuf = module.exports = require(17); - -protobuf.build = "light"; - -/** - * A node-style callback as used by {@link load} and {@link Root#load}. - * @typedef LoadCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Root} [root] Root, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @param {string|string[]} filename One or multiple files to load - * @param {Root} root Root namespace, defaults to create a new one if omitted. - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - */ -function load(filename, root, callback) { - if (typeof root === "function") { - callback = root; - root = new protobuf.Root(); - } else if (!root) - root = new protobuf.Root(); - return root.load(filename, callback); -} - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Promise} Promise - * @see {@link Root#load} - * @variation 3 - */ -// function load(filename:string, [root:Root]):Promise - -protobuf.load = load; - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - * @see {@link Root#loadSync} - */ -function loadSync(filename, root) { - if (!root) - root = new protobuf.Root(); - return root.loadSync(filename); -} - -protobuf.loadSync = loadSync; - -// Serialization -protobuf.encoder = require(13); -protobuf.decoder = require(12); -protobuf.verifier = require(36); -protobuf.converter = require(11); - -// Reflection -protobuf.ReflectionObject = require(22); -protobuf.Namespace = require(21); -protobuf.Root = require(26); -protobuf.Enum = require(14); -protobuf.Type = require(31); -protobuf.Field = require(15); -protobuf.OneOf = require(23); -protobuf.MapField = require(18); -protobuf.Service = require(30); -protobuf.Method = require(20); - -// Runtime -protobuf.Message = require(19); -protobuf.wrappers = require(37); - -// Utility -protobuf.types = require(32); -protobuf.util = require(33); - -// Set up possibly cyclic reflection dependencies -protobuf.ReflectionObject._configure(protobuf.Root); -protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum); -protobuf.Root._configure(protobuf.Type); -protobuf.Field._configure(protobuf.Type); - -},{"11":11,"12":12,"13":13,"14":14,"15":15,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"23":23,"26":26,"30":30,"31":31,"32":32,"33":33,"36":36,"37":37}],17:[function(require,module,exports){ -"use strict"; -var protobuf = exports; - -/** - * Build type, one of `"full"`, `"light"` or `"minimal"`. - * @name build - * @type {string} - * @const - */ -protobuf.build = "minimal"; - -// Serialization -protobuf.Writer = require(38); -protobuf.BufferWriter = require(39); -protobuf.Reader = require(24); -protobuf.BufferReader = require(25); - -// Utility -protobuf.util = require(35); -protobuf.rpc = require(28); -protobuf.roots = require(27); -protobuf.configure = configure; - -/* istanbul ignore next */ -/** - * Reconfigures the library according to the environment. - * @returns {undefined} - */ -function configure() { - protobuf.util._configure(); - protobuf.Writer._configure(protobuf.BufferWriter); - protobuf.Reader._configure(protobuf.BufferReader); -} - -// Set up buffer utility according to the environment -configure(); - -},{"24":24,"25":25,"27":27,"28":28,"35":35,"38":38,"39":39}],18:[function(require,module,exports){ -"use strict"; -module.exports = MapField; - -// extends Field -var Field = require(15); -((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; - -var types = require(32), - util = require(33); - -/** - * Constructs a new map field instance. - * @classdesc Reflected map field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} keyType Key type - * @param {string} type Value type - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function MapField(name, id, keyType, type, options, comment) { - Field.call(this, name, id, type, undefined, undefined, options, comment); - - /* istanbul ignore if */ - if (!util.isString(keyType)) - throw TypeError("keyType must be a string"); - - /** - * Key type. - * @type {string} - */ - this.keyType = keyType; // toJSON, marker - - /** - * Resolved key type if not a basic type. - * @type {ReflectionObject|null} - */ - this.resolvedKeyType = null; - - // Overrides Field#map - this.map = true; -} - -/** - * Map field descriptor. - * @interface IMapField - * @extends {IField} - * @property {string} keyType Key type - */ - -/** - * Extension map field descriptor. - * @interface IExtensionMapField - * @extends IMapField - * @property {string} extend Extended type - */ - -/** - * Constructs a map field from a map field descriptor. - * @param {string} name Field name - * @param {IMapField} json Map field descriptor - * @returns {MapField} Created map field - * @throws {TypeError} If arguments are invalid - */ -MapField.fromJSON = function fromJSON(name, json) { - return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment); -}; - -/** - * Converts this map field to a map field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMapField} Map field descriptor - */ -MapField.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "keyType" , this.keyType, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -MapField.prototype.resolve = function resolve() { - if (this.resolved) - return this; - - // Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes" - if (types.mapKey[this.keyType] === undefined) - throw Error("invalid key type: " + this.keyType); - - return Field.prototype.resolve.call(this); -}; - -/** - * Map field decorator (TypeScript). - * @name MapField.d - * @function - * @param {number} fieldId Field id - * @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type - * @returns {FieldDecorator} Decorator function - * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> } - */ -MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { - - // submessage value: decorate the submessage and use its name as the type - if (typeof fieldValueType === "function") - fieldValueType = util.decorateType(fieldValueType).name; - - // enum reference value: create a reflected copy of the enum and keep reuseing it - else if (fieldValueType && typeof fieldValueType === "object") - fieldValueType = util.decorateEnum(fieldValueType).name; - - return function mapFieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); - }; -}; - -},{"15":15,"32":32,"33":33}],19:[function(require,module,exports){ -"use strict"; -module.exports = Message; - -var util = require(35); - -/** - * Constructs a new message instance. - * @classdesc Abstract runtime message. - * @constructor - * @param {Properties} [properties] Properties to set - * @template T extends object = object - */ -function Message(properties) { - // not used internally - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; -} - -/** - * Reference to the reflected type. - * @name Message.$type - * @type {Type} - * @readonly - */ - -/** - * Reference to the reflected type. - * @name Message#$type - * @type {Type} - * @readonly - */ - -/*eslint-disable valid-jsdoc*/ - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message} Message instance - * @template T extends Message - * @this Constructor - */ -Message.create = function create(properties) { - return this.$type.create(properties); -}; - -/** - * Encodes a message of this type. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encode = function encode(message, writer) { - return this.$type.encode(message, writer); -}; - -/** - * Encodes a message of this type preceeded by its length as a varint. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encodeDelimited = function encodeDelimited(message, writer) { - return this.$type.encodeDelimited(message, writer); -}; - -/** - * Decodes a message of this type. - * @name Message.decode - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decode = function decode(reader) { - return this.$type.decode(reader); -}; - -/** - * Decodes a message of this type preceeded by its length as a varint. - * @name Message.decodeDelimited - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decodeDelimited = function decodeDelimited(reader) { - return this.$type.decodeDelimited(reader); -}; - -/** - * Verifies a message of this type. - * @name Message.verify - * @function - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ -Message.verify = function verify(message) { - return this.$type.verify(message); -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object - * @returns {T} Message instance - * @template T extends Message - * @this Constructor - */ -Message.fromObject = function fromObject(object) { - return this.$type.fromObject(object); -}; - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {T} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @template T extends Message - * @this Constructor - */ -Message.toObject = function toObject(message, options) { - return this.$type.toObject(message, options); -}; - -/** - * Converts this message to JSON. - * @returns {Object.} JSON object - */ -Message.prototype.toJSON = function toJSON() { - return this.$type.toObject(this, util.toJSONOptions); -}; - -/*eslint-enable valid-jsdoc*/ -},{"35":35}],20:[function(require,module,exports){ -"use strict"; -module.exports = Method; - -// extends ReflectionObject -var ReflectionObject = require(22); -((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method"; - -var util = require(33); - -/** - * Constructs a new service method instance. - * @classdesc Reflected service method. - * @extends ReflectionObject - * @constructor - * @param {string} name Method name - * @param {string|undefined} type Method type, usually `"rpc"` - * @param {string} requestType Request message type - * @param {string} responseType Response message type - * @param {boolean|Object.} [requestStream] Whether the request is streamed - * @param {boolean|Object.} [responseStream] Whether the response is streamed - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this method - */ -function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) { - - /* istanbul ignore next */ - if (util.isObject(requestStream)) { - options = requestStream; - requestStream = responseStream = undefined; - } else if (util.isObject(responseStream)) { - options = responseStream; - responseStream = undefined; - } - - /* istanbul ignore if */ - if (!(type === undefined || util.isString(type))) - throw TypeError("type must be a string"); - - /* istanbul ignore if */ - if (!util.isString(requestType)) - throw TypeError("requestType must be a string"); - - /* istanbul ignore if */ - if (!util.isString(responseType)) - throw TypeError("responseType must be a string"); - - ReflectionObject.call(this, name, options); - - /** - * Method type. - * @type {string} - */ - this.type = type || "rpc"; // toJSON - - /** - * Request type. - * @type {string} - */ - this.requestType = requestType; // toJSON, marker - - /** - * Whether requests are streamed or not. - * @type {boolean|undefined} - */ - this.requestStream = requestStream ? true : undefined; // toJSON - - /** - * Response type. - * @type {string} - */ - this.responseType = responseType; // toJSON - - /** - * Whether responses are streamed or not. - * @type {boolean|undefined} - */ - this.responseStream = responseStream ? true : undefined; // toJSON - - /** - * Resolved request type. - * @type {Type|null} - */ - this.resolvedRequestType = null; - - /** - * Resolved response type. - * @type {Type|null} - */ - this.resolvedResponseType = null; - - /** - * Comment for this method - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Method descriptor. - * @interface IMethod - * @property {string} [type="rpc"] Method type - * @property {string} requestType Request type - * @property {string} responseType Response type - * @property {boolean} [requestStream=false] Whether requests are streamed - * @property {boolean} [responseStream=false] Whether responses are streamed - * @property {Object.} [options] Method options - */ - -/** - * Constructs a method from a method descriptor. - * @param {string} name Method name - * @param {IMethod} json Method descriptor - * @returns {Method} Created method - * @throws {TypeError} If arguments are invalid - */ -Method.fromJSON = function fromJSON(name, json) { - return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment); -}; - -/** - * Converts this method to a method descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMethod} Method descriptor - */ -Method.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "type" , this.type !== "rpc" && /* istanbul ignore next */ this.type || undefined, - "requestType" , this.requestType, - "requestStream" , this.requestStream, - "responseType" , this.responseType, - "responseStream" , this.responseStream, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -Method.prototype.resolve = function resolve() { - - /* istanbul ignore if */ - if (this.resolved) - return this; - - this.resolvedRequestType = this.parent.lookupType(this.requestType); - this.resolvedResponseType = this.parent.lookupType(this.responseType); - - return ReflectionObject.prototype.resolve.call(this); -}; - -},{"22":22,"33":33}],21:[function(require,module,exports){ -"use strict"; -module.exports = Namespace; - -// extends ReflectionObject -var ReflectionObject = require(22); -((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace"; - -var Field = require(15), - util = require(33); - -var Type, // cyclic - Service, - Enum; - -/** - * Constructs a new namespace instance. - * @name Namespace - * @classdesc Reflected namespace. - * @extends NamespaceBase - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a namespace from JSON. - * @memberof Namespace - * @function - * @param {string} name Namespace name - * @param {Object.} json JSON object - * @returns {Namespace} Created namespace - * @throws {TypeError} If arguments are invalid - */ -Namespace.fromJSON = function fromJSON(name, json) { - return new Namespace(name, json.options).addJSON(json.nested); -}; - -/** - * Converts an array of reflection objects to JSON. - * @memberof Namespace - * @param {ReflectionObject[]} array Object array - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {Object.|undefined} JSON object or `undefined` when array is empty - */ -function arrayToJSON(array, toJSONOptions) { - if (!(array && array.length)) - return undefined; - var obj = {}; - for (var i = 0; i < array.length; ++i) - obj[array[i].name] = array[i].toJSON(toJSONOptions); - return obj; -} - -Namespace.arrayToJSON = arrayToJSON; - -/** - * Tests if the specified id is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedId = function isReservedId(reserved, id) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] > id) - return true; - return false; -}; - -/** - * Tests if the specified name is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedName = function isReservedName(reserved, name) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (reserved[i] === name) - return true; - return false; -}; - -/** - * Not an actual constructor. Use {@link Namespace} instead. - * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. - * @exports NamespaceBase - * @extends ReflectionObject - * @abstract - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - * @see {@link Namespace} - */ -function Namespace(name, options) { - ReflectionObject.call(this, name, options); - - /** - * Nested objects by name. - * @type {Object.|undefined} - */ - this.nested = undefined; // toJSON - - /** - * Cached nested objects as an array. - * @type {ReflectionObject[]|null} - * @private - */ - this._nestedArray = null; -} - -function clearCache(namespace) { - namespace._nestedArray = null; - return namespace; -} - -/** - * Nested objects of this namespace as an array for iteration. - * @name NamespaceBase#nestedArray - * @type {ReflectionObject[]} - * @readonly - */ -Object.defineProperty(Namespace.prototype, "nestedArray", { - get: function() { - return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); - } -}); - -/** - * Namespace descriptor. - * @interface INamespace - * @property {Object.} [options] Namespace options - * @property {Object.} [nested] Nested object descriptors - */ - -/** - * Any extension field descriptor. - * @typedef AnyExtensionField - * @type {IExtensionField|IExtensionMapField} - */ - -/** - * Any nested object descriptor. - * @typedef AnyNestedObject - * @type {IEnum|IType|IService|AnyExtensionField|INamespace} - */ -// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place) - -/** - * Converts this namespace to a namespace descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {INamespace} Namespace descriptor - */ -Namespace.prototype.toJSON = function toJSON(toJSONOptions) { - return util.toObject([ - "options" , this.options, - "nested" , arrayToJSON(this.nestedArray, toJSONOptions) - ]); -}; - -/** - * Adds nested objects to this namespace from nested object descriptors. - * @param {Object.} nestedJson Any nested object descriptors - * @returns {Namespace} `this` - */ -Namespace.prototype.addJSON = function addJSON(nestedJson) { - var ns = this; - /* istanbul ignore else */ - if (nestedJson) { - for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) { - nested = nestedJson[names[i]]; - ns.add( // most to least likely - ( nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : nested.id !== undefined - ? Field.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - } - return this; -}; - -/** - * Gets the nested object of the specified name. - * @param {string} name Nested object name - * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist - */ -Namespace.prototype.get = function get(name) { - return this.nested && this.nested[name] - || null; -}; - -/** - * Gets the values of the nested {@link Enum|enum} of the specified name. - * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. - * @param {string} name Nested enum name - * @returns {Object.} Enum values - * @throws {Error} If there is no such enum - */ -Namespace.prototype.getEnum = function getEnum(name) { - if (this.nested && this.nested[name] instanceof Enum) - return this.nested[name].values; - throw Error("no such enum: " + name); -}; - -/** - * Adds a nested object to this namespace. - * @param {ReflectionObject} object Nested object to add - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name - */ -Namespace.prototype.add = function add(object) { - - if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace)) - throw TypeError("object must be a valid nested object"); - - if (!this.nested) - this.nested = {}; - else { - var prev = this.get(object.name); - if (prev) { - if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) { - // replace plain namespace but keep existing nested elements and options - var nested = prev.nestedArray; - for (var i = 0; i < nested.length; ++i) - object.add(nested[i]); - this.remove(prev); - if (!this.nested) - this.nested = {}; - object.setOptions(prev.options, true); - - } else - throw Error("duplicate name '" + object.name + "' in " + this); - } - } - this.nested[object.name] = object; - object.onAdd(this); - return clearCache(this); -}; - -/** - * Removes a nested object from this namespace. - * @param {ReflectionObject} object Nested object to remove - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this namespace - */ -Namespace.prototype.remove = function remove(object) { - - if (!(object instanceof ReflectionObject)) - throw TypeError("object must be a ReflectionObject"); - if (object.parent !== this) - throw Error(object + " is not a member of " + this); - - delete this.nested[object.name]; - if (!Object.keys(this.nested).length) - this.nested = undefined; - - object.onRemove(this); - return clearCache(this); -}; - -/** - * Defines additial namespaces within this one if not yet existing. - * @param {string|string[]} path Path to create - * @param {*} [json] Nested types to create from JSON - * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty - */ -Namespace.prototype.define = function define(path, json) { - - if (util.isString(path)) - path = path.split("."); - else if (!Array.isArray(path)) - throw TypeError("illegal path"); - if (path && path.length && path[0] === "") - throw Error("path must be relative"); - - var ptr = this; - while (path.length > 0) { - var part = path.shift(); - if (ptr.nested && ptr.nested[part]) { - ptr = ptr.nested[part]; - if (!(ptr instanceof Namespace)) - throw Error("path conflicts with non-namespace objects"); - } else - ptr.add(ptr = new Namespace(part)); - } - if (json) - ptr.addJSON(json); - return ptr; -}; - -/** - * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost. - * @returns {Namespace} `this` - */ -Namespace.prototype.resolveAll = function resolveAll() { - var nested = this.nestedArray, i = 0; - while (i < nested.length) - if (nested[i] instanceof Namespace) - nested[i++].resolveAll(); - else - nested[i++].resolve(); - return this.resolve(); -}; - -/** - * Recursively looks up the reflection object matching the specified path in the scope of this namespace. - * @param {string|string[]} path Path to look up - * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. - * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - */ -Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) { - - /* istanbul ignore next */ - if (typeof filterTypes === "boolean") { - parentAlreadyChecked = filterTypes; - filterTypes = undefined; - } else if (filterTypes && !Array.isArray(filterTypes)) - filterTypes = [ filterTypes ]; - - if (util.isString(path) && path.length) { - if (path === ".") - return this.root; - path = path.split("."); - } else if (!path.length) - return this; - - // Start at root if path is absolute - if (path[0] === "") - return this.root.lookup(path.slice(1), filterTypes); - - // Test if the first part matches any nested object, and if so, traverse if path contains more - var found = this.get(path[0]); - if (found) { - if (path.length === 1) { - if (!filterTypes || filterTypes.indexOf(found.constructor) > -1) - return found; - } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true))) - return found; - - // Otherwise try each nested namespace - } else - for (var i = 0; i < this.nestedArray.length; ++i) - if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true))) - return found; - - // If there hasn't been a match, try again at the parent - if (this.parent === null || parentAlreadyChecked) - return null; - return this.parent.lookup(path, filterTypes); -}; - -/** - * Looks up the reflection object at the specified path, relative to this namespace. - * @name NamespaceBase#lookup - * @function - * @param {string|string[]} path Path to look up - * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - * @variation 2 - */ -// lookup(path: string, [parentAlreadyChecked: boolean]) - -/** - * Looks up the {@link Type|type} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type - * @throws {Error} If `path` does not point to a type - */ -Namespace.prototype.lookupType = function lookupType(path) { - var found = this.lookup(path, [ Type ]); - if (!found) - throw Error("no such type: " + path); - return found; -}; - -/** - * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Enum} Looked up enum - * @throws {Error} If `path` does not point to an enum - */ -Namespace.prototype.lookupEnum = function lookupEnum(path) { - var found = this.lookup(path, [ Enum ]); - if (!found) - throw Error("no such Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type or enum - * @throws {Error} If `path` does not point to a type or enum - */ -Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) { - var found = this.lookup(path, [ Type, Enum ]); - if (!found) - throw Error("no such Type or Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Service|service} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Service} Looked up service - * @throws {Error} If `path` does not point to a service - */ -Namespace.prototype.lookupService = function lookupService(path) { - var found = this.lookup(path, [ Service ]); - if (!found) - throw Error("no such Service '" + path + "' in " + this); - return found; -}; - -// Sets up cyclic dependencies (called in index-light) -Namespace._configure = function(Type_, Service_, Enum_) { - Type = Type_; - Service = Service_; - Enum = Enum_; -}; - -},{"15":15,"22":22,"33":33}],22:[function(require,module,exports){ -"use strict"; -module.exports = ReflectionObject; - -ReflectionObject.className = "ReflectionObject"; - -var util = require(33); - -var Root; // cyclic - -/** - * Constructs a new reflection object instance. - * @classdesc Base class of all reflection objects. - * @constructor - * @param {string} name Object name - * @param {Object.} [options] Declared options - * @abstract - */ -function ReflectionObject(name, options) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (options && !util.isObject(options)) - throw TypeError("options must be an object"); - - /** - * Options. - * @type {Object.|undefined} - */ - this.options = options; // toJSON - - /** - * Parsed Options. - * @type {Array.>|undefined} - */ - this.parsedOptions = null; - - /** - * Unique name within its namespace. - * @type {string} - */ - this.name = name; - - /** - * Parent namespace. - * @type {Namespace|null} - */ - this.parent = null; - - /** - * Whether already resolved or not. - * @type {boolean} - */ - this.resolved = false; - - /** - * Comment text, if any. - * @type {string|null} - */ - this.comment = null; - - /** - * Defining file name. - * @type {string|null} - */ - this.filename = null; -} - -Object.defineProperties(ReflectionObject.prototype, { - - /** - * Reference to the root namespace. - * @name ReflectionObject#root - * @type {Root} - * @readonly - */ - root: { - get: function() { - var ptr = this; - while (ptr.parent !== null) - ptr = ptr.parent; - return ptr; - } - }, - - /** - * Full name including leading dot. - * @name ReflectionObject#fullName - * @type {string} - * @readonly - */ - fullName: { - get: function() { - var path = [ this.name ], - ptr = this.parent; - while (ptr) { - path.unshift(ptr.name); - ptr = ptr.parent; - } - return path.join("."); - } - } -}); - -/** - * Converts this reflection object to its descriptor representation. - * @returns {Object.} Descriptor - * @abstract - */ -ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() { - throw Error(); // not implemented, shouldn't happen -}; - -/** - * Called when this object is added to a parent. - * @param {ReflectionObject} parent Parent added to - * @returns {undefined} - */ -ReflectionObject.prototype.onAdd = function onAdd(parent) { - if (this.parent && this.parent !== parent) - this.parent.remove(this); - this.parent = parent; - this.resolved = false; - var root = parent.root; - if (root instanceof Root) - root._handleAdd(this); -}; - -/** - * Called when this object is removed from a parent. - * @param {ReflectionObject} parent Parent removed from - * @returns {undefined} - */ -ReflectionObject.prototype.onRemove = function onRemove(parent) { - var root = parent.root; - if (root instanceof Root) - root._handleRemove(this); - this.parent = null; - this.resolved = false; -}; - -/** - * Resolves this objects type references. - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.resolve = function resolve() { - if (this.resolved) - return this; - if (this.root instanceof Root) - this.resolved = true; // only if part of a root - return this; -}; - -/** - * Gets an option value. - * @param {string} name Option name - * @returns {*} Option value or `undefined` if not set - */ -ReflectionObject.prototype.getOption = function getOption(name) { - if (this.options) - return this.options[name]; - return undefined; -}; - -/** - * Sets an option. - * @param {string} name Option name - * @param {*} value Option value - * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) { - if (!ifNotSet || !this.options || this.options[name] === undefined) - (this.options || (this.options = {}))[name] = value; - return this; -}; - -/** - * Sets a parsed option. - * @param {string} name parsed Option name - * @param {*} value Option value - * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) { - if (!this.parsedOptions) { - this.parsedOptions = []; - } - var parsedOptions = this.parsedOptions; - if (propName) { - // If setting a sub property of an option then try to merge it - // with an existing option - var opt = parsedOptions.find(function (opt) { - return Object.prototype.hasOwnProperty.call(opt, name); - }); - if (opt) { - // If we found an existing option - just merge the property value - var newValue = opt[name]; - util.setProperty(newValue, propName, value); - } else { - // otherwise, create a new option, set it's property and add it to the list - opt = {}; - opt[name] = util.setProperty({}, propName, value); - parsedOptions.push(opt); - } - } else { - // Always create a new option when setting the value of the option itself - var newOpt = {}; - newOpt[name] = value; - parsedOptions.push(newOpt); - } - return this; -}; - -/** - * Sets multiple options. - * @param {Object.} options Options to set - * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) { - if (options) - for (var keys = Object.keys(options), i = 0; i < keys.length; ++i) - this.setOption(keys[i], options[keys[i]], ifNotSet); - return this; -}; - -/** - * Converts this instance to its string representation. - * @returns {string} Class name[, space, full name] - */ -ReflectionObject.prototype.toString = function toString() { - var className = this.constructor.className, - fullName = this.fullName; - if (fullName.length) - return className + " " + fullName; - return className; -}; - -// Sets up cyclic dependencies (called in index-light) -ReflectionObject._configure = function(Root_) { - Root = Root_; -}; - -},{"33":33}],23:[function(require,module,exports){ -"use strict"; -module.exports = OneOf; - -// extends ReflectionObject -var ReflectionObject = require(22); -((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf"; - -var Field = require(15), - util = require(33); - -/** - * Constructs a new oneof instance. - * @classdesc Reflected oneof. - * @extends ReflectionObject - * @constructor - * @param {string} name Oneof name - * @param {string[]|Object.} [fieldNames] Field names - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function OneOf(name, fieldNames, options, comment) { - if (!Array.isArray(fieldNames)) { - options = fieldNames; - fieldNames = undefined; - } - ReflectionObject.call(this, name, options); - - /* istanbul ignore if */ - if (!(fieldNames === undefined || Array.isArray(fieldNames))) - throw TypeError("fieldNames must be an Array"); - - /** - * Field names that belong to this oneof. - * @type {string[]} - */ - this.oneof = fieldNames || []; // toJSON, marker - - /** - * Fields that belong to this oneof as an array for iteration. - * @type {Field[]} - * @readonly - */ - this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Oneof descriptor. - * @interface IOneOf - * @property {Array.} oneof Oneof field names - * @property {Object.} [options] Oneof options - */ - -/** - * Constructs a oneof from a oneof descriptor. - * @param {string} name Oneof name - * @param {IOneOf} json Oneof descriptor - * @returns {OneOf} Created oneof - * @throws {TypeError} If arguments are invalid - */ -OneOf.fromJSON = function fromJSON(name, json) { - return new OneOf(name, json.oneof, json.options, json.comment); -}; - -/** - * Converts this oneof to a oneof descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IOneOf} Oneof descriptor - */ -OneOf.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "oneof" , this.oneof, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Adds the fields of the specified oneof to the parent if not already done so. - * @param {OneOf} oneof The oneof - * @returns {undefined} - * @inner - * @ignore - */ -function addFieldsToParent(oneof) { - if (oneof.parent) - for (var i = 0; i < oneof.fieldsArray.length; ++i) - if (!oneof.fieldsArray[i].parent) - oneof.parent.add(oneof.fieldsArray[i]); -} - -/** - * Adds a field to this oneof and removes it from its current parent, if any. - * @param {Field} field Field to add - * @returns {OneOf} `this` - */ -OneOf.prototype.add = function add(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - if (field.parent && field.parent !== this.parent) - field.parent.remove(field); - this.oneof.push(field.name); - this.fieldsArray.push(field); - field.partOf = this; // field.parent remains null - addFieldsToParent(this); - return this; -}; - -/** - * Removes a field from this oneof and puts it back to the oneof's parent. - * @param {Field} field Field to remove - * @returns {OneOf} `this` - */ -OneOf.prototype.remove = function remove(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - var index = this.fieldsArray.indexOf(field); - - /* istanbul ignore if */ - if (index < 0) - throw Error(field + " is not a member of " + this); - - this.fieldsArray.splice(index, 1); - index = this.oneof.indexOf(field.name); - - /* istanbul ignore else */ - if (index > -1) // theoretical - this.oneof.splice(index, 1); - - field.partOf = null; - return this; -}; - -/** - * @override - */ -OneOf.prototype.onAdd = function onAdd(parent) { - ReflectionObject.prototype.onAdd.call(this, parent); - var self = this; - // Collect present fields - for (var i = 0; i < this.oneof.length; ++i) { - var field = parent.get(this.oneof[i]); - if (field && !field.partOf) { - field.partOf = self; - self.fieldsArray.push(field); - } - } - // Add not yet present fields - addFieldsToParent(this); -}; - -/** - * @override - */ -OneOf.prototype.onRemove = function onRemove(parent) { - for (var i = 0, field; i < this.fieldsArray.length; ++i) - if ((field = this.fieldsArray[i]).parent) - field.parent.remove(field); - ReflectionObject.prototype.onRemove.call(this, parent); -}; - -/** - * Decorator function as returned by {@link OneOf.d} (TypeScript). - * @typedef OneOfDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} oneofName OneOf name - * @returns {undefined} - */ - -/** - * OneOf decorator (TypeScript). - * @function - * @param {...string} fieldNames Field names - * @returns {OneOfDecorator} Decorator function - * @template T extends string - */ -OneOf.d = function decorateOneOf() { - var fieldNames = new Array(arguments.length), - index = 0; - while (index < arguments.length) - fieldNames[index] = arguments[index++]; - return function oneOfDecorator(prototype, oneofName) { - util.decorateType(prototype.constructor) - .add(new OneOf(oneofName, fieldNames)); - Object.defineProperty(prototype, oneofName, { - get: util.oneOfGetter(fieldNames), - set: util.oneOfSetter(fieldNames) - }); - }; -}; - -},{"15":15,"22":22,"33":33}],24:[function(require,module,exports){ -"use strict"; -module.exports = Reader; - -var util = require(35); - -var BufferReader; // cyclic - -var LongBits = util.LongBits, - utf8 = util.utf8; - -/* istanbul ignore next */ -function indexOutOfRange(reader, writeLength) { - return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); -} - -/** - * Constructs a new reader instance using the specified buffer. - * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. - * @constructor - * @param {Uint8Array} buffer Buffer to read from - */ -function Reader(buffer) { - - /** - * Read buffer. - * @type {Uint8Array} - */ - this.buf = buffer; - - /** - * Read buffer position. - * @type {number} - */ - this.pos = 0; - - /** - * Read buffer length. - * @type {number} - */ - this.len = buffer.length; -} - -var create_array = typeof Uint8Array !== "undefined" - ? function create_typed_array(buffer) { - if (buffer instanceof Uint8Array || Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - } - /* istanbul ignore next */ - : function create_array(buffer) { - if (Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - }; - -var create = function create() { - return util.Buffer - ? function create_buffer_setup(buffer) { - return (Reader.create = function create_buffer(buffer) { - return util.Buffer.isBuffer(buffer) - ? new BufferReader(buffer) - /* istanbul ignore next */ - : create_array(buffer); - })(buffer); - } - /* istanbul ignore next */ - : create_array; -}; - -/** - * Creates a new reader using the specified buffer. - * @function - * @param {Uint8Array|Buffer} buffer Buffer to read from - * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} - * @throws {Error} If `buffer` is not a valid buffer - */ -Reader.create = create(); - -Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; - -/** - * Reads a varint as an unsigned 32 bit value. - * @function - * @returns {number} Value read - */ -Reader.prototype.uint32 = (function read_uint32_setup() { - var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) - return function read_uint32() { - value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; - - /* istanbul ignore if */ - if ((this.pos += 5) > this.len) { - this.pos = this.len; - throw indexOutOfRange(this, 10); - } - return value; - }; -})(); - -/** - * Reads a varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.int32 = function read_int32() { - return this.uint32() | 0; -}; - -/** - * Reads a zig-zag encoded varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.sint32 = function read_sint32() { - var value = this.uint32(); - return value >>> 1 ^ -(value & 1) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readLongVarint() { - // tends to deopt with local vars for octet etc. - var bits = new LongBits(0, 0); - var i = 0; - if (this.len - this.pos > 4) { // fast route (lo) - for (; i < 4; ++i) { - // 1st..4th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 5th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; - bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - i = 0; - } else { - for (; i < 3; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 1st..3th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 4th - bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; - return bits; - } - if (this.len - this.pos > 4) { // fast route (hi) - for (; i < 5; ++i) { - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } else { - for (; i < 5; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } - /* istanbul ignore next */ - throw Error("invalid varint encoding"); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads a varint as a signed 64 bit value. - * @name Reader#int64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as an unsigned 64 bit value. - * @name Reader#uint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a zig-zag encoded varint as a signed 64 bit value. - * @name Reader#sint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as a boolean. - * @returns {boolean} Value read - */ -Reader.prototype.bool = function read_bool() { - return this.uint32() !== 0; -}; - -function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` - return (buf[end - 4] - | buf[end - 3] << 8 - | buf[end - 2] << 16 - | buf[end - 1] << 24) >>> 0; -} - -/** - * Reads fixed 32 bits as an unsigned 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.fixed32 = function read_fixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4); -}; - -/** - * Reads fixed 32 bits as a signed 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.sfixed32 = function read_sfixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readFixed64(/* this: Reader */) { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 8); - - return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads fixed 64 bits. - * @name Reader#fixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads zig-zag encoded fixed 64 bits. - * @name Reader#sfixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a float (32 bit) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.float = function read_float() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readFloatLE(this.buf, this.pos); - this.pos += 4; - return value; -}; - -/** - * Reads a double (64 bit float) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.double = function read_double() { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readDoubleLE(this.buf, this.pos); - this.pos += 8; - return value; -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns {Uint8Array} Value read - */ -Reader.prototype.bytes = function read_bytes() { - var length = this.uint32(), - start = this.pos, - end = this.pos + length; - - /* istanbul ignore if */ - if (end > this.len) - throw indexOutOfRange(this, length); - - this.pos += length; - if (Array.isArray(this.buf)) // plain array - return this.buf.slice(start, end); - return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1 - ? new this.buf.constructor(0) - : this._slice.call(this.buf, start, end); -}; - -/** - * Reads a string preceeded by its byte length as a varint. - * @returns {string} Value read - */ -Reader.prototype.string = function read_string() { - var bytes = this.bytes(); - return utf8.read(bytes, 0, bytes.length); -}; - -/** - * Skips the specified number of bytes if specified, otherwise skips a varint. - * @param {number} [length] Length if known, otherwise a varint is assumed - * @returns {Reader} `this` - */ -Reader.prototype.skip = function skip(length) { - if (typeof length === "number") { - /* istanbul ignore if */ - if (this.pos + length > this.len) - throw indexOutOfRange(this, length); - this.pos += length; - } else { - do { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - } while (this.buf[this.pos++] & 128); - } - return this; -}; - -/** - * Skips the next element of the specified wire type. - * @param {number} wireType Wire type received - * @returns {Reader} `this` - */ -Reader.prototype.skipType = function(wireType) { - switch (wireType) { - case 0: - this.skip(); - break; - case 1: - this.skip(8); - break; - case 2: - this.skip(this.uint32()); - break; - case 3: - while ((wireType = this.uint32() & 7) !== 4) { - this.skipType(wireType); - } - break; - case 5: - this.skip(4); - break; - - /* istanbul ignore next */ - default: - throw Error("invalid wire type " + wireType + " at offset " + this.pos); - } - return this; -}; - -Reader._configure = function(BufferReader_) { - BufferReader = BufferReader_; - Reader.create = create(); - BufferReader._configure(); - - var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; - util.merge(Reader.prototype, { - - int64: function read_int64() { - return readLongVarint.call(this)[fn](false); - }, - - uint64: function read_uint64() { - return readLongVarint.call(this)[fn](true); - }, - - sint64: function read_sint64() { - return readLongVarint.call(this).zzDecode()[fn](false); - }, - - fixed64: function read_fixed64() { - return readFixed64.call(this)[fn](true); - }, - - sfixed64: function read_sfixed64() { - return readFixed64.call(this)[fn](false); - } - - }); -}; - -},{"35":35}],25:[function(require,module,exports){ -"use strict"; -module.exports = BufferReader; - -// extends Reader -var Reader = require(24); -(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; - -var util = require(35); - -/** - * Constructs a new buffer reader instance. - * @classdesc Wire format reader using node buffers. - * @extends Reader - * @constructor - * @param {Buffer} buffer Buffer to read from - */ -function BufferReader(buffer) { - Reader.call(this, buffer); - - /** - * Read buffer. - * @name BufferReader#buf - * @type {Buffer} - */ -} - -BufferReader._configure = function () { - /* istanbul ignore else */ - if (util.Buffer) - BufferReader.prototype._slice = util.Buffer.prototype.slice; -}; - - -/** - * @override - */ -BufferReader.prototype.string = function read_string_buffer() { - var len = this.uint32(); // modifies pos - return this.buf.utf8Slice - ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) - : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @name BufferReader#bytes - * @function - * @returns {Buffer} Value read - */ - -BufferReader._configure(); - -},{"24":24,"35":35}],26:[function(require,module,exports){ -"use strict"; -module.exports = Root; - -// extends Namespace -var Namespace = require(21); -((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = "Root"; - -var Field = require(15), - Enum = require(14), - OneOf = require(23), - util = require(33); - -var Type, // cyclic - parse, // might be excluded - common; // " - -/** - * Constructs a new root namespace instance. - * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. - * @extends NamespaceBase - * @constructor - * @param {Object.} [options] Top level options - */ -function Root(options) { - Namespace.call(this, "", options); - - /** - * Deferred extension fields. - * @type {Field[]} - */ - this.deferred = []; - - /** - * Resolved file names of loaded files. - * @type {string[]} - */ - this.files = []; -} - -/** - * Loads a namespace descriptor into a root namespace. - * @param {INamespace} json Nameespace descriptor - * @param {Root} [root] Root namespace, defaults to create a new one if omitted - * @returns {Root} Root namespace - */ -Root.fromJSON = function fromJSON(json, root) { - if (!root) - root = new Root(); - if (json.options) - root.setOptions(json.options); - return root.addJSON(json.nested); -}; - -/** - * Resolves the path of an imported file, relative to the importing origin. - * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. - * @function - * @param {string} origin The file name of the importing file - * @param {string} target The file name being imported - * @returns {string|null} Resolved path to `target` or `null` to skip the file - */ -Root.prototype.resolvePath = util.path.resolve; - -/** - * Fetch content from file path or url - * This method exists so you can override it with your own logic. - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -Root.prototype.fetch = util.fetch; - -// A symbol-like function to safely signal synchronous loading -/* istanbul ignore next */ -function SYNC() {} // eslint-disable-line no-empty-function - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} options Parse options - * @param {LoadCallback} callback Callback function - * @returns {undefined} - */ -Root.prototype.load = function load(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = undefined; - } - var self = this; - if (!callback) - return util.asPromise(load, self, filename, options); - - var sync = callback === SYNC; // undocumented - - // Finishes loading by calling the callback (exactly once) - function finish(err, root) { - /* istanbul ignore if */ - if (!callback) - return; - var cb = callback; - callback = null; - if (sync) - throw err; - cb(err, root); - } - - // Bundled definition existence checking - function getBundledFileName(filename) { - var idx = filename.lastIndexOf("google/protobuf/"); - if (idx > -1) { - var altname = filename.substring(idx); - if (altname in common) return altname; - } - return null; - } - - // Processes a single file - function process(filename, source) { - try { - if (util.isString(source) && source.charAt(0) === "{") - source = JSON.parse(source); - if (!util.isString(source)) - self.setOptions(source.options).addJSON(source.nested); - else { - parse.filename = filename; - var parsed = parse(source, self, options), - resolved, - i = 0; - if (parsed.imports) - for (; i < parsed.imports.length; ++i) - if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i])) - fetch(resolved); - if (parsed.weakImports) - for (i = 0; i < parsed.weakImports.length; ++i) - if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i])) - fetch(resolved, true); - } - } catch (err) { - finish(err); - } - if (!sync && !queued) - finish(null, self); // only once anyway - } - - // Fetches a single file - function fetch(filename, weak) { - - // Skip if already loaded / attempted - if (self.files.indexOf(filename) > -1) - return; - self.files.push(filename); - - // Shortcut bundled definitions - if (filename in common) { - if (sync) - process(filename, common[filename]); - else { - ++queued; - setTimeout(function() { - --queued; - process(filename, common[filename]); - }); - } - return; - } - - // Otherwise fetch from disk or network - if (sync) { - var source; - try { - source = util.fs.readFileSync(filename).toString("utf8"); - } catch (err) { - if (!weak) - finish(err); - return; - } - process(filename, source); - } else { - ++queued; - self.fetch(filename, function(err, source) { - --queued; - /* istanbul ignore if */ - if (!callback) - return; // terminated meanwhile - if (err) { - /* istanbul ignore else */ - if (!weak) - finish(err); - else if (!queued) // can't be covered reliably - finish(null, self); - return; - } - process(filename, source); - }); - } - } - var queued = 0; - - // Assembling the root namespace doesn't require working type - // references anymore, so we can load everything in parallel - if (util.isString(filename)) - filename = [ filename ]; - for (var i = 0, resolved; i < filename.length; ++i) - if (resolved = self.resolvePath("", filename[i])) - fetch(resolved); - - if (sync) - return self; - if (!queued) - finish(null, self); - return undefined; -}; -// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Promise} Promise - * @variation 3 - */ -// function load(filename:string, [options:IParseOptions]):Promise - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only). - * @function Root#loadSync - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - */ -Root.prototype.loadSync = function loadSync(filename, options) { - if (!util.isNode) - throw Error("not supported"); - return this.load(filename, options, SYNC); -}; - -/** - * @override - */ -Root.prototype.resolveAll = function resolveAll() { - if (this.deferred.length) - throw Error("unresolvable extensions: " + this.deferred.map(function(field) { - return "'extend " + field.extend + "' in " + field.parent.fullName; - }).join(", ")); - return Namespace.prototype.resolveAll.call(this); -}; - -// only uppercased (and thus conflict-free) children are exposed, see below -var exposeRe = /^[A-Z]/; - -/** - * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type. - * @param {Root} root Root instance - * @param {Field} field Declaring extension field witin the declaring type - * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise - * @inner - * @ignore - */ -function tryHandleExtension(root, field) { - var extendedType = field.parent.lookup(field.extend); - if (extendedType) { - var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options); - sisterField.declaringField = field; - field.extensionField = sisterField; - extendedType.add(sisterField); - return true; - } - return false; -} - -/** - * Called when any object is added to this root or its sub-namespaces. - * @param {ReflectionObject} object Object added - * @returns {undefined} - * @private - */ -Root.prototype._handleAdd = function _handleAdd(object) { - if (object instanceof Field) { - - if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField) - if (!tryHandleExtension(this, object)) - this.deferred.push(object); - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - object.parent[object.name] = object.values; // expose enum values as property of its parent - - } else if (!(object instanceof OneOf)) /* everything else is a namespace */ { - - if (object instanceof Type) // Try to handle any deferred extensions - for (var i = 0; i < this.deferred.length;) - if (tryHandleExtension(this, this.deferred[i])) - this.deferred.splice(i, 1); - else - ++i; - for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace - this._handleAdd(object._nestedArray[j]); - if (exposeRe.test(object.name)) - object.parent[object.name] = object; // expose namespace as property of its parent - } - - // The above also adds uppercased (and thus conflict-free) nested types, services and enums as - // properties of namespaces just like static code does. This allows using a .d.ts generated for - // a static module with reflection-based solutions where the condition is met. -}; - -/** - * Called when any object is removed from this root or its sub-namespaces. - * @param {ReflectionObject} object Object removed - * @returns {undefined} - * @private - */ -Root.prototype._handleRemove = function _handleRemove(object) { - if (object instanceof Field) { - - if (/* an extension field */ object.extend !== undefined) { - if (/* already handled */ object.extensionField) { // remove its sister field - object.extensionField.parent.remove(object.extensionField); - object.extensionField = null; - } else { // cancel the extension - var index = this.deferred.indexOf(object); - /* istanbul ignore else */ - if (index > -1) - this.deferred.splice(index, 1); - } - } - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose enum values - - } else if (object instanceof Namespace) { - - for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace - this._handleRemove(object._nestedArray[i]); - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose namespaces - - } -}; - -// Sets up cyclic dependencies (called in index-light) -Root._configure = function(Type_, parse_, common_) { - Type = Type_; - parse = parse_; - common = common_; -}; - -},{"14":14,"15":15,"21":21,"23":23,"33":33}],27:[function(require,module,exports){ -"use strict"; -module.exports = {}; - -/** - * Named roots. - * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). - * Can also be used manually to make roots available accross modules. - * @name roots - * @type {Object.} - * @example - * // pbjs -r myroot -o compiled.js ... - * - * // in another module: - * require("./compiled.js"); - * - * // in any subsequent module: - * var root = protobuf.roots["myroot"]; - */ - -},{}],28:[function(require,module,exports){ -"use strict"; - -/** - * Streaming RPC helpers. - * @namespace - */ -var rpc = exports; - -/** - * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. - * @typedef RPCImpl - * @type {function} - * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called - * @param {Uint8Array} requestData Request data - * @param {RPCImplCallback} callback Callback function - * @returns {undefined} - * @example - * function rpcImpl(method, requestData, callback) { - * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code - * throw Error("no such method"); - * asynchronouslyObtainAResponse(requestData, function(err, responseData) { - * callback(err, responseData); - * }); - * } - */ - -/** - * Node-style callback as used by {@link RPCImpl}. - * @typedef RPCImplCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error - * @returns {undefined} - */ - -rpc.Service = require(29); - -},{"29":29}],29:[function(require,module,exports){ -"use strict"; -module.exports = Service; - -var util = require(35); - -// Extends EventEmitter -(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; - -/** - * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. - * - * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. - * @typedef rpc.ServiceMethodCallback - * @template TRes extends Message - * @type {function} - * @param {Error|null} error Error, if any - * @param {TRes} [response] Response message - * @returns {undefined} - */ - -/** - * A service method part of a {@link rpc.Service} as created by {@link Service.create}. - * @typedef rpc.ServiceMethod - * @template TReq extends Message - * @template TRes extends Message - * @type {function} - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message - * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` - */ - -/** - * Constructs a new RPC service instance. - * @classdesc An RPC service as returned by {@link Service#create}. - * @exports rpc.Service - * @extends util.EventEmitter - * @constructor - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ -function Service(rpcImpl, requestDelimited, responseDelimited) { - - if (typeof rpcImpl !== "function") - throw TypeError("rpcImpl must be a function"); - - util.EventEmitter.call(this); - - /** - * RPC implementation. Becomes `null` once the service is ended. - * @type {RPCImpl|null} - */ - this.rpcImpl = rpcImpl; - - /** - * Whether requests are length-delimited. - * @type {boolean} - */ - this.requestDelimited = Boolean(requestDelimited); - - /** - * Whether responses are length-delimited. - * @type {boolean} - */ - this.responseDelimited = Boolean(responseDelimited); -} - -/** - * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. - * @param {Method|rpc.ServiceMethod} method Reflected or static method - * @param {Constructor} requestCtor Request constructor - * @param {Constructor} responseCtor Response constructor - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} callback Service callback - * @returns {undefined} - * @template TReq extends Message - * @template TRes extends Message - */ -Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { - - if (!request) - throw TypeError("request must be specified"); - - var self = this; - if (!callback) - return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); - - if (!self.rpcImpl) { - setTimeout(function() { callback(Error("already ended")); }, 0); - return undefined; - } - - try { - return self.rpcImpl( - method, - requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), - function rpcCallback(err, response) { - - if (err) { - self.emit("error", err, method); - return callback(err); - } - - if (response === null) { - self.end(/* endedByRPC */ true); - return undefined; - } - - if (!(response instanceof responseCtor)) { - try { - response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); - } catch (err) { - self.emit("error", err, method); - return callback(err); - } - } - - self.emit("data", response, method); - return callback(null, response); - } - ); - } catch (err) { - self.emit("error", err, method); - setTimeout(function() { callback(err); }, 0); - return undefined; - } -}; - -/** - * Ends this service and emits the `end` event. - * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. - * @returns {rpc.Service} `this` - */ -Service.prototype.end = function end(endedByRPC) { - if (this.rpcImpl) { - if (!endedByRPC) // signal end to rpcImpl - this.rpcImpl(null, null, null); - this.rpcImpl = null; - this.emit("end").off(); - } - return this; -}; - -},{"35":35}],30:[function(require,module,exports){ -"use strict"; -module.exports = Service; - -// extends Namespace -var Namespace = require(21); -((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service"; - -var Method = require(20), - util = require(33), - rpc = require(28); - -/** - * Constructs a new service instance. - * @classdesc Reflected service. - * @extends NamespaceBase - * @constructor - * @param {string} name Service name - * @param {Object.} [options] Service options - * @throws {TypeError} If arguments are invalid - */ -function Service(name, options) { - Namespace.call(this, name, options); - - /** - * Service methods. - * @type {Object.} - */ - this.methods = {}; // toJSON, marker - - /** - * Cached methods as an array. - * @type {Method[]|null} - * @private - */ - this._methodsArray = null; -} - -/** - * Service descriptor. - * @interface IService - * @extends INamespace - * @property {Object.} methods Method descriptors - */ - -/** - * Constructs a service from a service descriptor. - * @param {string} name Service name - * @param {IService} json Service descriptor - * @returns {Service} Created service - * @throws {TypeError} If arguments are invalid - */ -Service.fromJSON = function fromJSON(name, json) { - var service = new Service(name, json.options); - /* istanbul ignore else */ - if (json.methods) - for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i) - service.add(Method.fromJSON(names[i], json.methods[names[i]])); - if (json.nested) - service.addJSON(json.nested); - service.comment = json.comment; - return service; -}; - -/** - * Converts this service to a service descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IService} Service descriptor - */ -Service.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "methods" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {}, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Methods of this service as an array for iteration. - * @name Service#methodsArray - * @type {Method[]} - * @readonly - */ -Object.defineProperty(Service.prototype, "methodsArray", { - get: function() { - return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); - } -}); - -function clearCache(service) { - service._methodsArray = null; - return service; -} - -/** - * @override - */ -Service.prototype.get = function get(name) { - return this.methods[name] - || Namespace.prototype.get.call(this, name); -}; - -/** - * @override - */ -Service.prototype.resolveAll = function resolveAll() { - var methods = this.methodsArray; - for (var i = 0; i < methods.length; ++i) - methods[i].resolve(); - return Namespace.prototype.resolve.call(this); -}; - -/** - * @override - */ -Service.prototype.add = function add(object) { - - /* istanbul ignore if */ - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Method) { - this.methods[object.name] = object; - object.parent = this; - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * @override - */ -Service.prototype.remove = function remove(object) { - if (object instanceof Method) { - - /* istanbul ignore if */ - if (this.methods[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.methods[object.name]; - object.parent = null; - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Creates a runtime service using the specified rpc implementation. - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed. - */ -Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) { - var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited); - for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) { - var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, ""); - rpcService[methodName] = util.codegen(["r","c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({ - m: method, - q: method.resolvedRequestType.ctor, - s: method.resolvedResponseType.ctor - }); - } - return rpcService; -}; - -},{"20":20,"21":21,"28":28,"33":33}],31:[function(require,module,exports){ -"use strict"; -module.exports = Type; - -// extends Namespace -var Namespace = require(21); -((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = "Type"; - -var Enum = require(14), - OneOf = require(23), - Field = require(15), - MapField = require(18), - Service = require(30), - Message = require(19), - Reader = require(24), - Writer = require(38), - util = require(33), - encoder = require(13), - decoder = require(12), - verifier = require(36), - converter = require(11), - wrappers = require(37); - -/** - * Constructs a new reflected message type instance. - * @classdesc Reflected message type. - * @extends NamespaceBase - * @constructor - * @param {string} name Message name - * @param {Object.} [options] Declared options - */ -function Type(name, options) { - Namespace.call(this, name, options); - - /** - * Message fields. - * @type {Object.} - */ - this.fields = {}; // toJSON, marker - - /** - * Oneofs declared within this namespace, if any. - * @type {Object.} - */ - this.oneofs = undefined; // toJSON - - /** - * Extension ranges, if any. - * @type {number[][]} - */ - this.extensions = undefined; // toJSON - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - /*? - * Whether this type is a legacy group. - * @type {boolean|undefined} - */ - this.group = undefined; // toJSON - - /** - * Cached fields by id. - * @type {Object.|null} - * @private - */ - this._fieldsById = null; - - /** - * Cached fields as an array. - * @type {Field[]|null} - * @private - */ - this._fieldsArray = null; - - /** - * Cached oneofs as an array. - * @type {OneOf[]|null} - * @private - */ - this._oneofsArray = null; - - /** - * Cached constructor. - * @type {Constructor<{}>} - * @private - */ - this._ctor = null; -} - -Object.defineProperties(Type.prototype, { - - /** - * Message fields by id. - * @name Type#fieldsById - * @type {Object.} - * @readonly - */ - fieldsById: { - get: function() { - - /* istanbul ignore if */ - if (this._fieldsById) - return this._fieldsById; - - this._fieldsById = {}; - for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) { - var field = this.fields[names[i]], - id = field.id; - - /* istanbul ignore if */ - if (this._fieldsById[id]) - throw Error("duplicate id " + id + " in " + this); - - this._fieldsById[id] = field; - } - return this._fieldsById; - } - }, - - /** - * Fields of this message as an array for iteration. - * @name Type#fieldsArray - * @type {Field[]} - * @readonly - */ - fieldsArray: { - get: function() { - return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); - } - }, - - /** - * Oneofs of this message as an array for iteration. - * @name Type#oneofsArray - * @type {OneOf[]} - * @readonly - */ - oneofsArray: { - get: function() { - return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); - } - }, - - /** - * The registered constructor, if any registered, otherwise a generic constructor. - * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. - * @name Type#ctor - * @type {Constructor<{}>} - */ - ctor: { - get: function() { - return this._ctor || (this.ctor = Type.generateConstructor(this)()); - }, - set: function(ctor) { - - // Ensure proper prototype - var prototype = ctor.prototype; - if (!(prototype instanceof Message)) { - (ctor.prototype = new Message()).constructor = ctor; - util.merge(ctor.prototype, prototype); - } - - // Classes and messages reference their reflected type - ctor.$type = ctor.prototype.$type = this; - - // Mix in static methods - util.merge(ctor, Message, true); - - this._ctor = ctor; - - // Messages have non-enumerable default values on their prototype - var i = 0; - for (; i < /* initializes */ this.fieldsArray.length; ++i) - this._fieldsArray[i].resolve(); // ensures a proper value - - // Messages have non-enumerable getters and setters for each virtual oneof field - var ctorProperties = {}; - for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i) - ctorProperties[this._oneofsArray[i].resolve().name] = { - get: util.oneOfGetter(this._oneofsArray[i].oneof), - set: util.oneOfSetter(this._oneofsArray[i].oneof) - }; - if (i) - Object.defineProperties(ctor.prototype, ctorProperties); - } - } -}); - -/** - * Generates a constructor function for the specified type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -Type.generateConstructor = function generateConstructor(mtype) { - /* eslint-disable no-unexpected-multiline */ - var gen = util.codegen(["p"], mtype.name); - // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype - for (var i = 0, field; i < mtype.fieldsArray.length; ++i) - if ((field = mtype._fieldsArray[i]).map) gen - ("this%s={}", util.safeProp(field.name)); - else if (field.repeated) gen - ("this%s=[]", util.safeProp(field.name)); - return gen - ("if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors - * @property {Object.} fields Field descriptors - * @property {number[][]} [extensions] Extension ranges - * @property {number[][]} [reserved] Reserved ranges - * @property {boolean} [group=false] Whether a legacy group or not - */ - -/** - * Creates a message type from a message type descriptor. - * @param {string} name Message name - * @param {IType} json Message type descriptor - * @returns {Type} Created message type - */ -Type.fromJSON = function fromJSON(name, json) { - var type = new Type(name, json.options); - type.extensions = json.extensions; - type.reserved = json.reserved; - var names = Object.keys(json.fields), - i = 0; - for (; i < names.length; ++i) - type.add( - ( typeof json.fields[names[i]].keyType !== "undefined" - ? MapField.fromJSON - : Field.fromJSON )(names[i], json.fields[names[i]]) - ); - if (json.oneofs) - for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i) - type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]])); - if (json.nested) - for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) { - var nested = json.nested[names[i]]; - type.add( // most to least likely - ( nested.id !== undefined - ? Field.fromJSON - : nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - if (json.extensions && json.extensions.length) - type.extensions = json.extensions; - if (json.reserved && json.reserved.length) - type.reserved = json.reserved; - if (json.group) - type.group = true; - if (json.comment) - type.comment = json.comment; - return type; -}; - -/** - * Converts this message type to a message type descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IType} Message type descriptor - */ -Type.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "oneofs" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions), - "fields" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {}, - "extensions" , this.extensions && this.extensions.length ? this.extensions : undefined, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "group" , this.group || undefined, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -Type.prototype.resolveAll = function resolveAll() { - var fields = this.fieldsArray, i = 0; - while (i < fields.length) - fields[i++].resolve(); - var oneofs = this.oneofsArray; i = 0; - while (i < oneofs.length) - oneofs[i++].resolve(); - return Namespace.prototype.resolveAll.call(this); -}; - -/** - * @override - */ -Type.prototype.get = function get(name) { - return this.fields[name] - || this.oneofs && this.oneofs[name] - || this.nested && this.nested[name] - || null; -}; - -/** - * Adds a nested object to this type. - * @param {ReflectionObject} object Nested object to add - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id - */ -Type.prototype.add = function add(object) { - - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Field && object.extend === undefined) { - // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects. - // The root object takes care of adding distinct sister-fields to the respective extended - // type instead. - - // avoids calling the getter if not absolutely necessary because it's called quite frequently - if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id]) - throw Error("duplicate id " + object.id + " in " + this); - if (this.isReservedId(object.id)) - throw Error("id " + object.id + " is reserved in " + this); - if (this.isReservedName(object.name)) - throw Error("name '" + object.name + "' is reserved in " + this); - - if (object.parent) - object.parent.remove(object); - this.fields[object.name] = object; - object.message = this; - object.onAdd(this); - return clearCache(this); - } - if (object instanceof OneOf) { - if (!this.oneofs) - this.oneofs = {}; - this.oneofs[object.name] = object; - object.onAdd(this); - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * Removes a nested object from this type. - * @param {ReflectionObject} object Nested object to remove - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this type - */ -Type.prototype.remove = function remove(object) { - if (object instanceof Field && object.extend === undefined) { - // See Type#add for the reason why extension fields are excluded here. - - /* istanbul ignore if */ - if (!this.fields || this.fields[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.fields[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - if (object instanceof OneOf) { - - /* istanbul ignore if */ - if (!this.oneofs || this.oneofs[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.oneofs[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message<{}>} Message instance - */ -Type.prototype.create = function create(properties) { - return new this.ctor(properties); -}; - -/** - * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. - * @returns {Type} `this` - */ -Type.prototype.setup = function setup() { - // Sets up everything at once so that the prototype chain does not have to be re-evaluated - // multiple times (V8, soft-deopt prototype-check). - - var fullName = this.fullName, - types = []; - for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i) - types.push(this._fieldsArray[i].resolve().resolvedType); - - // Replace setup methods with type-specific generated functions - this.encode = encoder(this)({ - Writer : Writer, - types : types, - util : util - }); - this.decode = decoder(this)({ - Reader : Reader, - types : types, - util : util - }); - this.verify = verifier(this)({ - types : types, - util : util - }); - this.fromObject = converter.fromObject(this)({ - types : types, - util : util - }); - this.toObject = converter.toObject(this)({ - types : types, - util : util - }); - - // Inject custom wrappers for common types - var wrapper = wrappers[fullName]; - if (wrapper) { - var originalThis = Object.create(this); - // if (wrapper.fromObject) { - originalThis.fromObject = this.fromObject; - this.fromObject = wrapper.fromObject.bind(originalThis); - // } - // if (wrapper.toObject) { - originalThis.toObject = this.toObject; - this.toObject = wrapper.toObject.bind(originalThis); - // } - } - - return this; -}; - -/** - * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encode = function encode_setup(message, writer) { - return this.setup().encode(message, writer); // overrides this method -}; - -/** - * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); -}; - -/** - * Decodes a message of this type. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Length of the message, if known beforehand - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError<{}>} If required fields are missing - */ -Type.prototype.decode = function decode_setup(reader, length) { - return this.setup().decode(reader, length); // overrides this method -}; - -/** - * Decodes a message of this type preceeded by its byte length as a varint. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError} If required fields are missing - */ -Type.prototype.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof Reader)) - reader = Reader.create(reader); - return this.decode(reader, reader.uint32()); -}; - -/** - * Verifies that field values are valid and that required fields are present. - * @param {Object.} message Plain object to verify - * @returns {null|string} `null` if valid, otherwise the reason why it is not - */ -Type.prototype.verify = function verify_setup(message) { - return this.setup().verify(message); // overrides this method -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object to convert - * @returns {Message<{}>} Message instance - */ -Type.prototype.fromObject = function fromObject(object) { - return this.setup().fromObject(object); -}; - -/** - * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. - * @interface IConversionOptions - * @property {Function} [longs] Long conversion type. - * Valid values are `String` and `Number` (the global types). - * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library. - * @property {Function} [enums] Enum value conversion type. - * Only valid value is `String` (the global type). - * Defaults to copy the present value, which is the numeric id. - * @property {Function} [bytes] Bytes value conversion type. - * Valid values are `Array` and (a base64 encoded) `String` (the global types). - * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser. - * @property {boolean} [defaults=false] Also sets default values on the resulting object - * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false` - * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false` - * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any - * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings - */ - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ -Type.prototype.toObject = function toObject(message, options) { - return this.setup().toObject(message, options); -}; - -/** - * Decorator function as returned by {@link Type.d} (TypeScript). - * @typedef TypeDecorator - * @type {function} - * @param {Constructor} target Target constructor - * @returns {undefined} - * @template T extends Message - */ - -/** - * Type decorator (TypeScript). - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {TypeDecorator} Decorator function - * @template T extends Message - */ -Type.d = function decorateType(typeName) { - return function typeDecorator(target) { - util.decorateType(target, typeName); - }; -}; - -},{"11":11,"12":12,"13":13,"14":14,"15":15,"18":18,"19":19,"21":21,"23":23,"24":24,"30":30,"33":33,"36":36,"37":37,"38":38}],32:[function(require,module,exports){ -"use strict"; - -/** - * Common type constants. - * @namespace - */ -var types = exports; - -var util = require(33); - -var s = [ - "double", // 0 - "float", // 1 - "int32", // 2 - "uint32", // 3 - "sint32", // 4 - "fixed32", // 5 - "sfixed32", // 6 - "int64", // 7 - "uint64", // 8 - "sint64", // 9 - "fixed64", // 10 - "sfixed64", // 11 - "bool", // 12 - "string", // 13 - "bytes" // 14 -]; - -function bake(values, offset) { - var i = 0, o = {}; - offset |= 0; - while (i < values.length) o[s[i + offset]] = values[i++]; - return o; -} - -/** - * Basic type wire types. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - * @property {number} bytes=2 Ldelim wire type - */ -types.basic = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2, - /* bytes */ 2 -]); - -/** - * Basic type defaults. - * @type {Object.} - * @const - * @property {number} double=0 Double default - * @property {number} float=0 Float default - * @property {number} int32=0 Int32 default - * @property {number} uint32=0 Uint32 default - * @property {number} sint32=0 Sint32 default - * @property {number} fixed32=0 Fixed32 default - * @property {number} sfixed32=0 Sfixed32 default - * @property {number} int64=0 Int64 default - * @property {number} uint64=0 Uint64 default - * @property {number} sint64=0 Sint32 default - * @property {number} fixed64=0 Fixed64 default - * @property {number} sfixed64=0 Sfixed64 default - * @property {boolean} bool=false Bool default - * @property {string} string="" String default - * @property {Array.} bytes=Array(0) Bytes default - * @property {null} message=null Message default - */ -types.defaults = bake([ - /* double */ 0, - /* float */ 0, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 0, - /* sfixed32 */ 0, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 0, - /* sfixed64 */ 0, - /* bool */ false, - /* string */ "", - /* bytes */ util.emptyArray, - /* message */ null -]); - -/** - * Basic long type wire types. - * @type {Object.} - * @const - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - */ -types.long = bake([ - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1 -], 7); - -/** - * Allowed types for map keys with their associated wire type. - * @type {Object.} - * @const - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - */ -types.mapKey = bake([ - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2 -], 2); - -/** - * Allowed types for packed repeated fields with their associated wire type. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - */ -types.packed = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0 -]); - -},{"33":33}],33:[function(require,module,exports){ -"use strict"; - -/** - * Various utility functions. - * @namespace - */ -var util = module.exports = require(35); - -var roots = require(27); - -var Type, // cyclic - Enum; - -util.codegen = require(3); -util.fetch = require(5); -util.path = require(8); - -/** - * Node's fs module if available. - * @type {Object.} - */ -util.fs = util.inquire("fs"); - -/** - * Converts an object's values to an array. - * @param {Object.} object Object to convert - * @returns {Array.<*>} Converted array - */ -util.toArray = function toArray(object) { - if (object) { - var keys = Object.keys(object), - array = new Array(keys.length), - index = 0; - while (index < keys.length) - array[index] = object[keys[index++]]; - return array; - } - return []; -}; - -/** - * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values. - * @param {Array.<*>} array Array to convert - * @returns {Object.} Converted object - */ -util.toObject = function toObject(array) { - var object = {}, - index = 0; - while (index < array.length) { - var key = array[index++], - val = array[index++]; - if (val !== undefined) - object[key] = val; - } - return object; -}; - -var safePropBackslashRe = /\\/g, - safePropQuoteRe = /"/g; - -/** - * Tests whether the specified name is a reserved word in JS. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -util.isReserved = function isReserved(name) { - return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name); -}; - -/** - * Returns a safe property accessor for the specified property name. - * @param {string} prop Property name - * @returns {string} Safe accessor - */ -util.safeProp = function safeProp(prop) { - if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop)) - return "[\"" + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, "\\\"") + "\"]"; - return "." + prop; -}; - -/** - * Converts the first character of a string to upper case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.ucFirst = function ucFirst(str) { - return str.charAt(0).toUpperCase() + str.substring(1); -}; - -var camelCaseRe = /_([a-z])/g; - -/** - * Converts a string to camel case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.camelCase = function camelCase(str) { - return str.substring(0, 1) - + str.substring(1) - .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); }); -}; - -/** - * Compares reflected fields by id. - * @param {Field} a First field - * @param {Field} b Second field - * @returns {number} Comparison value - */ -util.compareFieldsById = function compareFieldsById(a, b) { - return a.id - b.id; -}; - -/** - * Decorator helper for types (TypeScript). - * @param {Constructor} ctor Constructor function - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {Type} Reflected type - * @template T extends Message - * @property {Root} root Decorators root - */ -util.decorateType = function decorateType(ctor, typeName) { - - /* istanbul ignore if */ - if (ctor.$type) { - if (typeName && ctor.$type.name !== typeName) { - util.decorateRoot.remove(ctor.$type); - ctor.$type.name = typeName; - util.decorateRoot.add(ctor.$type); - } - return ctor.$type; - } - - /* istanbul ignore next */ - if (!Type) - Type = require(31); - - var type = new Type(typeName || ctor.name); - util.decorateRoot.add(type); - type.ctor = ctor; // sets up .encode, .decode etc. - Object.defineProperty(ctor, "$type", { value: type, enumerable: false }); - Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false }); - return type; -}; - -var decorateEnumIndex = 0; - -/** - * Decorator helper for enums (TypeScript). - * @param {Object} object Enum object - * @returns {Enum} Reflected enum - */ -util.decorateEnum = function decorateEnum(object) { - - /* istanbul ignore if */ - if (object.$type) - return object.$type; - - /* istanbul ignore next */ - if (!Enum) - Enum = require(14); - - var enm = new Enum("Enum" + decorateEnumIndex++, object); - util.decorateRoot.add(enm); - Object.defineProperty(object, "$type", { value: enm, enumerable: false }); - return enm; -}; - - -/** - * Sets the value of a property by property path. If a value already exists, it is turned to an array - * @param {Object.} dst Destination object - * @param {string} path dot '.' delimited path of the property to set - * @param {Object} value the value to set - * @returns {Object.} Destination object - */ -util.setProperty = function setProperty(dst, path, value) { - function setProp(dst, path, value) { - var part = path.shift(); - if (path.length > 0) { - dst[part] = setProp(dst[part] || {}, path, value); - } else { - var prevValue = dst[part]; - if (prevValue) - value = [].concat(prevValue).concat(value); - dst[part] = value; - } - return dst; - } - - if (typeof dst !== "object") - throw TypeError("dst must be an object"); - if (!path) - throw TypeError("path must be specified"); - - path = path.split("."); - return setProp(dst, path, value); -}; - -/** - * Decorator root (TypeScript). - * @name util.decorateRoot - * @type {Root} - * @readonly - */ -Object.defineProperty(util, "decorateRoot", { - get: function() { - return roots["decorated"] || (roots["decorated"] = new (require(26))()); - } -}); - -},{"14":14,"26":26,"27":27,"3":3,"31":31,"35":35,"5":5,"8":8}],34:[function(require,module,exports){ -"use strict"; -module.exports = LongBits; - -var util = require(35); - -/** - * Constructs new long bits. - * @classdesc Helper class for working with the low and high bits of a 64 bit value. - * @memberof util - * @constructor - * @param {number} lo Low 32 bits, unsigned - * @param {number} hi High 32 bits, unsigned - */ -function LongBits(lo, hi) { - - // note that the casts below are theoretically unnecessary as of today, but older statically - // generated converter code might still call the ctor with signed 32bits. kept for compat. - - /** - * Low bits. - * @type {number} - */ - this.lo = lo >>> 0; - - /** - * High bits. - * @type {number} - */ - this.hi = hi >>> 0; -} - -/** - * Zero bits. - * @memberof util.LongBits - * @type {util.LongBits} - */ -var zero = LongBits.zero = new LongBits(0, 0); - -zero.toNumber = function() { return 0; }; -zero.zzEncode = zero.zzDecode = function() { return this; }; -zero.length = function() { return 1; }; - -/** - * Zero hash. - * @memberof util.LongBits - * @type {string} - */ -var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; - -/** - * Constructs new long bits from the specified number. - * @param {number} value Value - * @returns {util.LongBits} Instance - */ -LongBits.fromNumber = function fromNumber(value) { - if (value === 0) - return zero; - var sign = value < 0; - if (sign) - value = -value; - var lo = value >>> 0, - hi = (value - lo) / 4294967296 >>> 0; - if (sign) { - hi = ~hi >>> 0; - lo = ~lo >>> 0; - if (++lo > 4294967295) { - lo = 0; - if (++hi > 4294967295) - hi = 0; - } - } - return new LongBits(lo, hi); -}; - -/** - * Constructs new long bits from a number, long or string. - * @param {Long|number|string} value Value - * @returns {util.LongBits} Instance - */ -LongBits.from = function from(value) { - if (typeof value === "number") - return LongBits.fromNumber(value); - if (util.isString(value)) { - /* istanbul ignore else */ - if (util.Long) - value = util.Long.fromString(value); - else - return LongBits.fromNumber(parseInt(value, 10)); - } - return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; -}; - -/** - * Converts this long bits to a possibly unsafe JavaScript number. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {number} Possibly unsafe number - */ -LongBits.prototype.toNumber = function toNumber(unsigned) { - if (!unsigned && this.hi >>> 31) { - var lo = ~this.lo + 1 >>> 0, - hi = ~this.hi >>> 0; - if (!lo) - hi = hi + 1 >>> 0; - return -(lo + hi * 4294967296); - } - return this.lo + this.hi * 4294967296; -}; - -/** - * Converts this long bits to a long. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long} Long - */ -LongBits.prototype.toLong = function toLong(unsigned) { - return util.Long - ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) - /* istanbul ignore next */ - : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; -}; - -var charCodeAt = String.prototype.charCodeAt; - -/** - * Constructs new long bits from the specified 8 characters long hash. - * @param {string} hash Hash - * @returns {util.LongBits} Bits - */ -LongBits.fromHash = function fromHash(hash) { - if (hash === zeroHash) - return zero; - return new LongBits( - ( charCodeAt.call(hash, 0) - | charCodeAt.call(hash, 1) << 8 - | charCodeAt.call(hash, 2) << 16 - | charCodeAt.call(hash, 3) << 24) >>> 0 - , - ( charCodeAt.call(hash, 4) - | charCodeAt.call(hash, 5) << 8 - | charCodeAt.call(hash, 6) << 16 - | charCodeAt.call(hash, 7) << 24) >>> 0 - ); -}; - -/** - * Converts this long bits to a 8 characters long hash. - * @returns {string} Hash - */ -LongBits.prototype.toHash = function toHash() { - return String.fromCharCode( - this.lo & 255, - this.lo >>> 8 & 255, - this.lo >>> 16 & 255, - this.lo >>> 24 , - this.hi & 255, - this.hi >>> 8 & 255, - this.hi >>> 16 & 255, - this.hi >>> 24 - ); -}; - -/** - * Zig-zag encodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzEncode = function zzEncode() { - var mask = this.hi >> 31; - this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; - this.lo = ( this.lo << 1 ^ mask) >>> 0; - return this; -}; - -/** - * Zig-zag decodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzDecode = function zzDecode() { - var mask = -(this.lo & 1); - this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; - this.hi = ( this.hi >>> 1 ^ mask) >>> 0; - return this; -}; - -/** - * Calculates the length of this longbits when encoded as a varint. - * @returns {number} Length - */ -LongBits.prototype.length = function length() { - var part0 = this.lo, - part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, - part2 = this.hi >>> 24; - return part2 === 0 - ? part1 === 0 - ? part0 < 16384 - ? part0 < 128 ? 1 : 2 - : part0 < 2097152 ? 3 : 4 - : part1 < 16384 - ? part1 < 128 ? 5 : 6 - : part1 < 2097152 ? 7 : 8 - : part2 < 128 ? 9 : 10; -}; - -},{"35":35}],35:[function(require,module,exports){ -"use strict"; -var util = exports; - -// used to return a Promise where callback is omitted -util.asPromise = require(1); - -// converts to / from base64 encoded strings -util.base64 = require(2); - -// base class of rpc.Service -util.EventEmitter = require(4); - -// float handling accross browsers -util.float = require(6); - -// requires modules optionally and hides the call from bundlers -util.inquire = require(7); - -// converts to / from utf8 encoded strings -util.utf8 = require(10); - -// provides a node-like buffer pool in the browser -util.pool = require(9); - -// utility to work with the low and high bits of a 64 bit value -util.LongBits = require(34); - -/** - * Whether running within node or not. - * @memberof util - * @type {boolean} - */ -util.isNode = Boolean(typeof global !== "undefined" - && global - && global.process - && global.process.versions - && global.process.versions.node); - -/** - * Global object reference. - * @memberof util - * @type {Object} - */ -util.global = util.isNode && global - || typeof window !== "undefined" && window - || typeof self !== "undefined" && self - || this; // eslint-disable-line no-invalid-this - -/** - * An immuable empty array. - * @memberof util - * @type {Array.<*>} - * @const - */ -util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes - -/** - * An immutable empty object. - * @type {Object} - * @const - */ -util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes - -/** - * Tests if the specified value is an integer. - * @function - * @param {*} value Value to test - * @returns {boolean} `true` if the value is an integer - */ -util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { - return typeof value === "number" && isFinite(value) && Math.floor(value) === value; -}; - -/** - * Tests if the specified value is a string. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a string - */ -util.isString = function isString(value) { - return typeof value === "string" || value instanceof String; -}; - -/** - * Tests if the specified value is a non-null object. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a non-null object - */ -util.isObject = function isObject(value) { - return value && typeof value === "object"; -}; - -/** - * Checks if a property on a message is considered to be present. - * This is an alias of {@link util.isSet}. - * @function - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isset = - -/** - * Checks if a property on a message is considered to be present. - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isSet = function isSet(obj, prop) { - var value = obj[prop]; - if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins - return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; - return false; -}; - -/** - * Any compatible Buffer instance. - * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. - * @interface Buffer - * @extends Uint8Array - */ - -/** - * Node's Buffer class if available. - * @type {Constructor} - */ -util.Buffer = (function() { - try { - var Buffer = util.inquire("buffer").Buffer; - // refuse to use non-node buffers if not explicitly assigned (perf reasons): - return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; - } catch (e) { - /* istanbul ignore next */ - return null; - } -})(); - -// Internal alias of or polyfull for Buffer.from. -util._Buffer_from = null; - -// Internal alias of or polyfill for Buffer.allocUnsafe. -util._Buffer_allocUnsafe = null; - -/** - * Creates a new buffer of whatever type supported by the environment. - * @param {number|number[]} [sizeOrArray=0] Buffer size or number array - * @returns {Uint8Array|Buffer} Buffer - */ -util.newBuffer = function newBuffer(sizeOrArray) { - /* istanbul ignore next */ - return typeof sizeOrArray === "number" - ? util.Buffer - ? util._Buffer_allocUnsafe(sizeOrArray) - : new util.Array(sizeOrArray) - : util.Buffer - ? util._Buffer_from(sizeOrArray) - : typeof Uint8Array === "undefined" - ? sizeOrArray - : new Uint8Array(sizeOrArray); -}; - -/** - * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. - * @type {Constructor} - */ -util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; - -/** - * Any compatible Long instance. - * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. - * @interface Long - * @property {number} low Low bits - * @property {number} high High bits - * @property {boolean} unsigned Whether unsigned or not - */ - -/** - * Long.js's Long class if available. - * @type {Constructor} - */ -util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long - || /* istanbul ignore next */ util.global.Long - || util.inquire("long"); - -/** - * Regular expression used to verify 2 bit (`bool`) map keys. - * @type {RegExp} - * @const - */ -util.key2Re = /^true|false|0|1$/; - -/** - * Regular expression used to verify 32 bit (`int32` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; - -/** - * Regular expression used to verify 64 bit (`int64` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; - -/** - * Converts a number or long to an 8 characters long hash string. - * @param {Long|number} value Value to convert - * @returns {string} Hash - */ -util.longToHash = function longToHash(value) { - return value - ? util.LongBits.from(value).toHash() - : util.LongBits.zeroHash; -}; - -/** - * Converts an 8 characters long hash string to a long or number. - * @param {string} hash Hash - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long|number} Original value - */ -util.longFromHash = function longFromHash(hash, unsigned) { - var bits = util.LongBits.fromHash(hash); - if (util.Long) - return util.Long.fromBits(bits.lo, bits.hi, unsigned); - return bits.toNumber(Boolean(unsigned)); -}; - -/** - * Merges the properties of the source object into the destination object. - * @memberof util - * @param {Object.} dst Destination object - * @param {Object.} src Source object - * @param {boolean} [ifNotSet=false] Merges only if the key is not already set - * @returns {Object.} Destination object - */ -function merge(dst, src, ifNotSet) { // used by converters - for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) - if (dst[keys[i]] === undefined || !ifNotSet) - dst[keys[i]] = src[keys[i]]; - return dst; -} - -util.merge = merge; - -/** - * Converts the first character of a string to lower case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.lcFirst = function lcFirst(str) { - return str.charAt(0).toLowerCase() + str.substring(1); -}; - -/** - * Creates a custom error constructor. - * @memberof util - * @param {string} name Error name - * @returns {Constructor} Custom error constructor - */ -function newError(name) { - - function CustomError(message, properties) { - - if (!(this instanceof CustomError)) - return new CustomError(message, properties); - - // Error.call(this, message); - // ^ just returns a new error instance because the ctor can be called as a function - - Object.defineProperty(this, "message", { get: function() { return message; } }); - - /* istanbul ignore next */ - if (Error.captureStackTrace) // node - Error.captureStackTrace(this, CustomError); - else - Object.defineProperty(this, "stack", { value: new Error().stack || "" }); - - if (properties) - merge(this, properties); - } - - (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; - - Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); - - CustomError.prototype.toString = function toString() { - return this.name + ": " + this.message; - }; - - return CustomError; -} - -util.newError = newError; - -/** - * Constructs a new protocol error. - * @classdesc Error subclass indicating a protocol specifc error. - * @memberof util - * @extends Error - * @template T extends Message - * @constructor - * @param {string} message Error message - * @param {Object.} [properties] Additional properties - * @example - * try { - * MyMessage.decode(someBuffer); // throws if required fields are missing - * } catch (e) { - * if (e instanceof ProtocolError && e.instance) - * console.log("decoded so far: " + JSON.stringify(e.instance)); - * } - */ -util.ProtocolError = newError("ProtocolError"); - -/** - * So far decoded message instance. - * @name util.ProtocolError#instance - * @type {Message} - */ - -/** - * A OneOf getter as returned by {@link util.oneOfGetter}. - * @typedef OneOfGetter - * @type {function} - * @returns {string|undefined} Set field name, if any - */ - -/** - * Builds a getter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfGetter} Unbound getter - */ -util.oneOfGetter = function getOneOf(fieldNames) { - var fieldMap = {}; - for (var i = 0; i < fieldNames.length; ++i) - fieldMap[fieldNames[i]] = 1; - - /** - * @returns {string|undefined} Set field name, if any - * @this Object - * @ignore - */ - return function() { // eslint-disable-line consistent-return - for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) - if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) - return keys[i]; - }; -}; - -/** - * A OneOf setter as returned by {@link util.oneOfSetter}. - * @typedef OneOfSetter - * @type {function} - * @param {string|undefined} value Field name - * @returns {undefined} - */ - -/** - * Builds a setter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfSetter} Unbound setter - */ -util.oneOfSetter = function setOneOf(fieldNames) { - - /** - * @param {string} name Field name - * @returns {undefined} - * @this Object - * @ignore - */ - return function(name) { - for (var i = 0; i < fieldNames.length; ++i) - if (fieldNames[i] !== name) - delete this[fieldNames[i]]; - }; -}; - -/** - * Default conversion options used for {@link Message#toJSON} implementations. - * - * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: - * - * - Longs become strings - * - Enums become string keys - * - Bytes become base64 encoded strings - * - (Sub-)Messages become plain objects - * - Maps become plain objects with all string keys - * - Repeated fields become arrays - * - NaN and Infinity for float and double fields become strings - * - * @type {IConversionOptions} - * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json - */ -util.toJSONOptions = { - longs: String, - enums: String, - bytes: String, - json: true -}; - -// Sets up buffer utility according to the environment (called in index-minimal) -util._configure = function() { - var Buffer = util.Buffer; - /* istanbul ignore if */ - if (!Buffer) { - util._Buffer_from = util._Buffer_allocUnsafe = null; - return; - } - // because node 4.x buffers are incompatible & immutable - // see: https://github.com/dcodeIO/protobuf.js/pull/665 - util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || - /* istanbul ignore next */ - function Buffer_from(value, encoding) { - return new Buffer(value, encoding); - }; - util._Buffer_allocUnsafe = Buffer.allocUnsafe || - /* istanbul ignore next */ - function Buffer_allocUnsafe(size) { - return new Buffer(size); - }; -}; - -},{"1":1,"10":10,"2":2,"34":34,"4":4,"6":6,"7":7,"9":9}],36:[function(require,module,exports){ -"use strict"; -module.exports = verifier; - -var Enum = require(14), - util = require(33); - -function invalid(field, expected) { - return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected"; -} - -/** - * Generates a partial value verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyValue(gen, field, fieldIndex, ref) { - /* eslint-disable no-unexpected-multiline */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(%s){", ref) - ("default:") - ("return%j", invalid(field, "enum value")); - for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen - ("case %i:", field.resolvedType.values[keys[j]]); - gen - ("break") - ("}"); - } else { - gen - ("{") - ("var e=types[%i].verify(%s);", fieldIndex, ref) - ("if(e)") - ("return%j+e", field.name + ".") - ("}"); - } - } else { - switch (field.type) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.isInteger(%s))", ref) - ("return%j", invalid(field, "integer")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", ref, ref, ref, ref) - ("return%j", invalid(field, "integer|Long")); - break; - case "float": - case "double": gen - ("if(typeof %s!==\"number\")", ref) - ("return%j", invalid(field, "number")); - break; - case "bool": gen - ("if(typeof %s!==\"boolean\")", ref) - ("return%j", invalid(field, "boolean")); - break; - case "string": gen - ("if(!util.isString(%s))", ref) - ("return%j", invalid(field, "string")); - break; - case "bytes": gen - ("if(!(%s&&typeof %s.length===\"number\"||util.isString(%s)))", ref, ref, ref) - ("return%j", invalid(field, "buffer")); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a partial key verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyKey(gen, field, ref) { - /* eslint-disable no-unexpected-multiline */ - switch (field.keyType) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.key32Re.test(%s))", ref) - ("return%j", invalid(field, "integer key")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.key64Re.test(%s))", ref) // see comment above: x is ok, d is not - ("return%j", invalid(field, "integer|Long key")); - break; - case "bool": gen - ("if(!util.key2Re.test(%s))", ref) - ("return%j", invalid(field, "boolean key")); - break; - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a verifier specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function verifier(mtype) { - /* eslint-disable no-unexpected-multiline */ - - var gen = util.codegen(["m"], mtype.name + "$verify") - ("if(typeof m!==\"object\"||m===null)") - ("return%j", "object expected"); - var oneofs = mtype.oneofsArray, - seenFirstField = {}; - if (oneofs.length) gen - ("var p={}"); - - for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - ref = "m" + util.safeProp(field.name); - - if (field.optional) gen - ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null - - // map fields - if (field.map) { gen - ("if(!util.isObject(%s))", ref) - ("return%j", invalid(field, "object")) - ("var k=Object.keys(%s)", ref) - ("for(var i=0;i} - * @const - */ -var wrappers = exports; - -var Message = require(19); - -/** - * From object converter part of an {@link IWrapper}. - * @typedef WrapperFromObjectConverter - * @type {function} - * @param {Object.} object Plain object - * @returns {Message<{}>} Message instance - * @this Type - */ - -/** - * To object converter part of an {@link IWrapper}. - * @typedef WrapperToObjectConverter - * @type {function} - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @this Type - */ - -/** - * Common type wrapper part of {@link wrappers}. - * @interface IWrapper - * @property {WrapperFromObjectConverter} [fromObject] From object converter - * @property {WrapperToObjectConverter} [toObject] To object converter - */ - -// Custom wrapper for Any -wrappers[".google.protobuf.Any"] = { - - fromObject: function(object) { - - // unwrap value type if mapped - if (object && object["@type"]) { - // Only use fully qualified type name after the last '/' - var name = object["@type"].substring(object["@type"].lastIndexOf("/") + 1); - var type = this.lookup(name); - /* istanbul ignore else */ - if (type) { - // type_url does not accept leading "." - var type_url = object["@type"].charAt(0) === "." ? - object["@type"].substr(1) : object["@type"]; - // type_url prefix is optional, but path seperator is required - if (type_url.indexOf("/") === -1) { - type_url = "/" + type_url; - } - return this.create({ - type_url: type_url, - value: type.encode(type.fromObject(object)).finish() - }); - } - } - - return this.fromObject(object); - }, - - toObject: function(message, options) { - - // Default prefix - var googleApi = "type.googleapis.com/"; - var prefix = ""; - var name = ""; - - // decode value if requested and unmapped - if (options && options.json && message.type_url && message.value) { - // Only use fully qualified type name after the last '/' - name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1); - // Separate the prefix used - prefix = message.type_url.substring(0, message.type_url.lastIndexOf("/") + 1); - var type = this.lookup(name); - /* istanbul ignore else */ - if (type) - message = type.decode(message.value); - } - - // wrap value if unmapped - if (!(message instanceof this.ctor) && message instanceof Message) { - var object = message.$type.toObject(message, options); - var messageName = message.$type.fullName[0] === "." ? - message.$type.fullName.substr(1) : message.$type.fullName; - // Default to type.googleapis.com prefix if no prefix is used - if (prefix === "") { - prefix = googleApi; - } - name = prefix + messageName; - object["@type"] = name; - return object; - } - - return this.toObject(message, options); - } -}; - -},{"19":19}],38:[function(require,module,exports){ -"use strict"; -module.exports = Writer; - -var util = require(35); - -var BufferWriter; // cyclic - -var LongBits = util.LongBits, - base64 = util.base64, - utf8 = util.utf8; - -/** - * Constructs a new writer operation instance. - * @classdesc Scheduled writer operation. - * @constructor - * @param {function(*, Uint8Array, number)} fn Function to call - * @param {number} len Value byte length - * @param {*} val Value to write - * @ignore - */ -function Op(fn, len, val) { - - /** - * Function to call. - * @type {function(Uint8Array, number, *)} - */ - this.fn = fn; - - /** - * Value byte length. - * @type {number} - */ - this.len = len; - - /** - * Next operation. - * @type {Writer.Op|undefined} - */ - this.next = undefined; - - /** - * Value to write. - * @type {*} - */ - this.val = val; // type varies -} - -/* istanbul ignore next */ -function noop() {} // eslint-disable-line no-empty-function - -/** - * Constructs a new writer state instance. - * @classdesc Copied writer state. - * @memberof Writer - * @constructor - * @param {Writer} writer Writer to copy state from - * @ignore - */ -function State(writer) { - - /** - * Current head. - * @type {Writer.Op} - */ - this.head = writer.head; - - /** - * Current tail. - * @type {Writer.Op} - */ - this.tail = writer.tail; - - /** - * Current buffer length. - * @type {number} - */ - this.len = writer.len; - - /** - * Next state. - * @type {State|null} - */ - this.next = writer.states; -} - -/** - * Constructs a new writer instance. - * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. - * @constructor - */ -function Writer() { - - /** - * Current length. - * @type {number} - */ - this.len = 0; - - /** - * Operations head. - * @type {Object} - */ - this.head = new Op(noop, 0, 0); - - /** - * Operations tail - * @type {Object} - */ - this.tail = this.head; - - /** - * Linked forked states. - * @type {Object|null} - */ - this.states = null; - - // When a value is written, the writer calculates its byte length and puts it into a linked - // list of operations to perform when finish() is called. This both allows us to allocate - // buffers of the exact required size and reduces the amount of work we have to do compared - // to first calculating over objects and then encoding over objects. In our case, the encoding - // part is just a linked list walk calling operations with already prepared values. -} - -var create = function create() { - return util.Buffer - ? function create_buffer_setup() { - return (Writer.create = function create_buffer() { - return new BufferWriter(); - })(); - } - /* istanbul ignore next */ - : function create_array() { - return new Writer(); - }; -}; - -/** - * Creates a new writer. - * @function - * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} - */ -Writer.create = create(); - -/** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ -Writer.alloc = function alloc(size) { - return new util.Array(size); -}; - -// Use Uint8Array buffer pool in the browser, just like node does with buffers -/* istanbul ignore else */ -if (util.Array !== Array) - Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); - -/** - * Pushes a new operation to the queue. - * @param {function(Uint8Array, number, *)} fn Function to call - * @param {number} len Value byte length - * @param {number} val Value to write - * @returns {Writer} `this` - * @private - */ -Writer.prototype._push = function push(fn, len, val) { - this.tail = this.tail.next = new Op(fn, len, val); - this.len += len; - return this; -}; - -function writeByte(val, buf, pos) { - buf[pos] = val & 255; -} - -function writeVarint32(val, buf, pos) { - while (val > 127) { - buf[pos++] = val & 127 | 128; - val >>>= 7; - } - buf[pos] = val; -} - -/** - * Constructs a new varint writer operation instance. - * @classdesc Scheduled varint writer operation. - * @extends Op - * @constructor - * @param {number} len Value byte length - * @param {number} val Value to write - * @ignore - */ -function VarintOp(len, val) { - this.len = len; - this.next = undefined; - this.val = val; -} - -VarintOp.prototype = Object.create(Op.prototype); -VarintOp.prototype.fn = writeVarint32; - -/** - * Writes an unsigned 32 bit value as a varint. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.uint32 = function write_uint32(value) { - // here, the call to this.push has been inlined and a varint specific Op subclass is used. - // uint32 is by far the most frequently used operation and benefits significantly from this. - this.len += (this.tail = this.tail.next = new VarintOp( - (value = value >>> 0) - < 128 ? 1 - : value < 16384 ? 2 - : value < 2097152 ? 3 - : value < 268435456 ? 4 - : 5, - value)).len; - return this; -}; - -/** - * Writes a signed 32 bit value as a varint. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.int32 = function write_int32(value) { - return value < 0 - ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec - : this.uint32(value); -}; - -/** - * Writes a 32 bit value as a varint, zig-zag encoded. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sint32 = function write_sint32(value) { - return this.uint32((value << 1 ^ value >> 31) >>> 0); -}; - -function writeVarint64(val, buf, pos) { - while (val.hi) { - buf[pos++] = val.lo & 127 | 128; - val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; - val.hi >>>= 7; - } - while (val.lo > 127) { - buf[pos++] = val.lo & 127 | 128; - val.lo = val.lo >>> 7; - } - buf[pos++] = val.lo; -} - -/** - * Writes an unsigned 64 bit value as a varint. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.uint64 = function write_uint64(value) { - var bits = LongBits.from(value); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a signed 64 bit value as a varint. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.int64 = Writer.prototype.uint64; - -/** - * Writes a signed 64 bit value as a varint, zig-zag encoded. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sint64 = function write_sint64(value) { - var bits = LongBits.from(value).zzEncode(); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a boolish value as a varint. - * @param {boolean} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.bool = function write_bool(value) { - return this._push(writeByte, 1, value ? 1 : 0); -}; - -function writeFixed32(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -/** - * Writes an unsigned 32 bit value as fixed 32 bits. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.fixed32 = function write_fixed32(value) { - return this._push(writeFixed32, 4, value >>> 0); -}; - -/** - * Writes a signed 32 bit value as fixed 32 bits. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sfixed32 = Writer.prototype.fixed32; - -/** - * Writes an unsigned 64 bit value as fixed 64 bits. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.fixed64 = function write_fixed64(value) { - var bits = LongBits.from(value); - return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); -}; - -/** - * Writes a signed 64 bit value as fixed 64 bits. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sfixed64 = Writer.prototype.fixed64; - -/** - * Writes a float (32 bit). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.float = function write_float(value) { - return this._push(util.float.writeFloatLE, 4, value); -}; - -/** - * Writes a double (64 bit float). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.double = function write_double(value) { - return this._push(util.float.writeDoubleLE, 8, value); -}; - -var writeBytes = util.Array.prototype.set - ? function writeBytes_set(val, buf, pos) { - buf.set(val, pos); // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytes_for(val, buf, pos) { - for (var i = 0; i < val.length; ++i) - buf[pos + i] = val[i]; - }; - -/** - * Writes a sequence of bytes. - * @param {Uint8Array|string} value Buffer or base64 encoded string to write - * @returns {Writer} `this` - */ -Writer.prototype.bytes = function write_bytes(value) { - var len = value.length >>> 0; - if (!len) - return this._push(writeByte, 1, 0); - if (util.isString(value)) { - var buf = Writer.alloc(len = base64.length(value)); - base64.decode(value, buf, 0); - value = buf; - } - return this.uint32(len)._push(writeBytes, len, value); -}; - -/** - * Writes a string. - * @param {string} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.string = function write_string(value) { - var len = utf8.length(value); - return len - ? this.uint32(len)._push(utf8.write, len, value) - : this._push(writeByte, 1, 0); -}; - -/** - * Forks this writer's state by pushing it to a stack. - * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. - * @returns {Writer} `this` - */ -Writer.prototype.fork = function fork() { - this.states = new State(this); - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - return this; -}; - -/** - * Resets this instance to the last state. - * @returns {Writer} `this` - */ -Writer.prototype.reset = function reset() { - if (this.states) { - this.head = this.states.head; - this.tail = this.states.tail; - this.len = this.states.len; - this.states = this.states.next; - } else { - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - } - return this; -}; - -/** - * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. - * @returns {Writer} `this` - */ -Writer.prototype.ldelim = function ldelim() { - var head = this.head, - tail = this.tail, - len = this.len; - this.reset().uint32(len); - if (len) { - this.tail.next = head.next; // skip noop - this.tail = tail; - this.len += len; - } - return this; -}; - -/** - * Finishes the write operation. - * @returns {Uint8Array} Finished buffer - */ -Writer.prototype.finish = function finish() { - var head = this.head.next, // skip noop - buf = this.constructor.alloc(this.len), - pos = 0; - while (head) { - head.fn(head.val, buf, pos); - pos += head.len; - head = head.next; - } - // this.head = this.tail = null; - return buf; -}; - -Writer._configure = function(BufferWriter_) { - BufferWriter = BufferWriter_; - Writer.create = create(); - BufferWriter._configure(); -}; - -},{"35":35}],39:[function(require,module,exports){ -"use strict"; -module.exports = BufferWriter; - -// extends Writer -var Writer = require(38); -(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; - -var util = require(35); - -/** - * Constructs a new buffer writer instance. - * @classdesc Wire format writer using node buffers. - * @extends Writer - * @constructor - */ -function BufferWriter() { - Writer.call(this); -} - -BufferWriter._configure = function () { - /** - * Allocates a buffer of the specified size. - * @function - * @param {number} size Buffer size - * @returns {Buffer} Buffer - */ - BufferWriter.alloc = util._Buffer_allocUnsafe; - - BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" - ? function writeBytesBuffer_set(val, buf, pos) { - buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) - // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytesBuffer_copy(val, buf, pos) { - if (val.copy) // Buffer values - val.copy(buf, pos, 0, val.length); - else for (var i = 0; i < val.length;) // plain array values - buf[pos++] = val[i++]; - }; -}; - - -/** - * @override - */ -BufferWriter.prototype.bytes = function write_bytes_buffer(value) { - if (util.isString(value)) - value = util._Buffer_from(value, "base64"); - var len = value.length >>> 0; - this.uint32(len); - if (len) - this._push(BufferWriter.writeBytesBuffer, len, value); - return this; -}; - -function writeStringBuffer(val, buf, pos) { - if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) - util.utf8.write(val, buf, pos); - else if (buf.utf8Write) - buf.utf8Write(val, pos); - else - buf.write(val, pos); -} - -/** - * @override - */ -BufferWriter.prototype.string = function write_string_buffer(value) { - var len = util.Buffer.byteLength(value); - this.uint32(len); - if (len) - this._push(writeStringBuffer, len, value); - return this; -}; - - -/** - * Finishes the write operation. - * @name BufferWriter#finish - * @function - * @returns {Buffer} Finished buffer - */ - -BufferWriter._configure(); - -},{"35":35,"38":38}]},{},[16]) - -})(); -//# sourceMappingURL=protobuf.js.map diff --git a/node_modules/protobufjs/dist/light/protobuf.js.map b/node_modules/protobufjs/dist/light/protobuf.js.map deleted file mode 100644 index f6538edd..00000000 --- a/node_modules/protobufjs/dist/light/protobuf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["lib/prelude.js","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/codegen/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/fetch/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/path/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/@protobufjs/utf8/index.js","../src/converter.js","../src/decoder.js","../src/encoder.js","../src/enum.js","../src/field.js","../src/index-light","../src/index-minimal.js","../src/mapfield.js","../src/message.js","../src/method.js","../src/namespace.js","../src/object.js","../src/oneof.js","../src/reader.js","../src/reader_buffer.js","../src/root.js","../src/roots.js","../src/rpc.js","../src/rpc/service.js","../src/service.js","../src/type.js","../src/types.js","../src/util.js","../src/util/longbits.js","../src/util/minimal.js","../src/verifier.js","../src/wrappers.js","../src/writer.js","../src/writer_buffer.js"],"names":[],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3WA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7kBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACraA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"protobuf.js","sourcesContent":["(function prelude(modules, cache, entries) {\n\n // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS\n // sources through a conflict-free require shim and is again wrapped within an iife that\n // provides a minification-friendly `undefined` var plus a global \"use strict\" directive\n // so that minification can remove the directives of each module.\n\n function $require(name) {\n var $module = cache[name];\n if (!$module)\n modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);\n return $module.exports;\n }\n\n var protobuf = $require(entries[0]);\n\n // Expose globally\n protobuf.util.global.protobuf = protobuf;\n\n // Be nice to AMD\n if (typeof define === \"function\" && define.amd)\n define([\"long\"], function(Long) {\n if (Long && Long.isLong) {\n protobuf.util.Long = Long;\n protobuf.configure();\n }\n return protobuf;\n });\n\n // Be nice to CommonJS\n if (typeof module === \"object\" && module && module.exports)\n module.exports = protobuf;\n\n})/* end of prelude */","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = codegen;\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @param {string[]} functionParams Function parameter names\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n */\r\nfunction codegen(functionParams, functionName) {\r\n\r\n /* istanbul ignore if */\r\n if (typeof functionParams === \"string\") {\r\n functionName = functionParams;\r\n functionParams = undefined;\r\n }\r\n\r\n var body = [];\r\n\r\n /**\r\n * Appends code to the function's body or finishes generation.\r\n * @typedef Codegen\r\n * @type {function}\r\n * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r\n * @param {...*} [formatParams] Format parameters\r\n * @returns {Codegen|Function} Itself or the generated function if finished\r\n * @throws {Error} If format parameter counts do not match\r\n */\r\n\r\n function Codegen(formatStringOrScope) {\r\n // note that explicit array handling below makes this ~50% faster\r\n\r\n // finish the function\r\n if (typeof formatStringOrScope !== \"string\") {\r\n var source = toString();\r\n if (codegen.verbose)\r\n console.log(\"codegen: \" + source); // eslint-disable-line no-console\r\n source = \"return \" + source;\r\n if (formatStringOrScope) {\r\n var scopeKeys = Object.keys(formatStringOrScope),\r\n scopeParams = new Array(scopeKeys.length + 1),\r\n scopeValues = new Array(scopeKeys.length),\r\n scopeOffset = 0;\r\n while (scopeOffset < scopeKeys.length) {\r\n scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r\n scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r\n }\r\n scopeParams[scopeOffset] = source;\r\n return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r\n }\r\n return Function(source)(); // eslint-disable-line no-new-func\r\n }\r\n\r\n // otherwise append to body\r\n var formatParams = new Array(arguments.length - 1),\r\n formatOffset = 0;\r\n while (formatOffset < formatParams.length)\r\n formatParams[formatOffset] = arguments[++formatOffset];\r\n formatOffset = 0;\r\n formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r\n var value = formatParams[formatOffset++];\r\n switch ($1) {\r\n case \"d\": case \"f\": return String(Number(value));\r\n case \"i\": return String(Math.floor(value));\r\n case \"j\": return JSON.stringify(value);\r\n case \"s\": return String(value);\r\n }\r\n return \"%\";\r\n });\r\n if (formatOffset !== formatParams.length)\r\n throw Error(\"parameter count mismatch\");\r\n body.push(formatStringOrScope);\r\n return Codegen;\r\n }\r\n\r\n function toString(functionNameOverride) {\r\n return \"function \" + (functionNameOverride || functionName || \"\") + \"(\" + (functionParams && functionParams.join(\",\") || \"\") + \"){\\n \" + body.join(\"\\n \") + \"\\n}\";\r\n }\r\n\r\n Codegen.toString = toString;\r\n return Codegen;\r\n}\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @function codegen\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * When set to `true`, codegen will log generated code to console. Useful for debugging.\r\n * @name util.codegen.verbose\r\n * @type {boolean}\r\n */\r\ncodegen.verbose = false;\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\nmodule.exports = fetch;\r\n\r\nvar asPromise = require(1),\r\n inquire = require(7);\r\n\r\nvar fs = inquire(\"fs\");\r\n\r\n/**\r\n * Node-style callback as used by {@link util.fetch}.\r\n * @typedef FetchCallback\r\n * @type {function}\r\n * @param {?Error} error Error, if any, otherwise `null`\r\n * @param {string} [contents] File contents, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Options as used by {@link util.fetch}.\r\n * @typedef FetchOptions\r\n * @type {Object}\r\n * @property {boolean} [binary=false] Whether expecting a binary response\r\n * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @memberof util\r\n * @param {string} filename File path or url\r\n * @param {FetchOptions} options Fetch options\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nfunction fetch(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = {};\r\n } else if (!options)\r\n options = {};\r\n\r\n if (!callback)\r\n return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r\n\r\n // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r\n if (!options.xhr && fs && fs.readFile)\r\n return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r\n return err && typeof XMLHttpRequest !== \"undefined\"\r\n ? fetch.xhr(filename, options, callback)\r\n : err\r\n ? callback(err)\r\n : callback(null, options.binary ? contents : contents.toString(\"utf8\"));\r\n });\r\n\r\n // use the XHR version otherwise.\r\n return fetch.xhr(filename, options, callback);\r\n}\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchOptions} [options] Fetch options\r\n * @returns {Promise} Promise\r\n * @variation 3\r\n */\r\n\r\n/**/\r\nfetch.xhr = function fetch_xhr(filename, options, callback) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r\n\r\n if (xhr.readyState !== 4)\r\n return undefined;\r\n\r\n // local cors security errors return status 0 / empty string, too. afaik this cannot be\r\n // reliably distinguished from an actually empty file for security reasons. feel free\r\n // to send a pull request if you are aware of a solution.\r\n if (xhr.status !== 0 && xhr.status !== 200)\r\n return callback(Error(\"status \" + xhr.status));\r\n\r\n // if binary data is expected, make sure that some sort of array is returned, even if\r\n // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r\n if (options.binary) {\r\n var buffer = xhr.response;\r\n if (!buffer) {\r\n buffer = [];\r\n for (var i = 0; i < xhr.responseText.length; ++i)\r\n buffer.push(xhr.responseText.charCodeAt(i) & 255);\r\n }\r\n return callback(null, typeof Uint8Array !== \"undefined\" ? new Uint8Array(buffer) : buffer);\r\n }\r\n return callback(null, xhr.responseText);\r\n };\r\n\r\n if (options.binary) {\r\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r\n if (\"overrideMimeType\" in xhr)\r\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n xhr.open(\"GET\", filename);\r\n xhr.send();\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal path module to resolve Unix, Windows and URL paths alike.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar path = exports;\r\n\r\nvar isAbsolute =\r\n/**\r\n * Tests if the specified path is absolute.\r\n * @param {string} path Path to test\r\n * @returns {boolean} `true` if path is absolute\r\n */\r\npath.isAbsolute = function isAbsolute(path) {\r\n return /^(?:\\/|\\w+:)/.test(path);\r\n};\r\n\r\nvar normalize =\r\n/**\r\n * Normalizes the specified path.\r\n * @param {string} path Path to normalize\r\n * @returns {string} Normalized path\r\n */\r\npath.normalize = function normalize(path) {\r\n path = path.replace(/\\\\/g, \"/\")\r\n .replace(/\\/{2,}/g, \"/\");\r\n var parts = path.split(\"/\"),\r\n absolute = isAbsolute(path),\r\n prefix = \"\";\r\n if (absolute)\r\n prefix = parts.shift() + \"/\";\r\n for (var i = 0; i < parts.length;) {\r\n if (parts[i] === \"..\") {\r\n if (i > 0 && parts[i - 1] !== \"..\")\r\n parts.splice(--i, 2);\r\n else if (absolute)\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n } else if (parts[i] === \".\")\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n return prefix + parts.join(\"/\");\r\n};\r\n\r\n/**\r\n * Resolves the specified include path against the specified origin path.\r\n * @param {string} originPath Path to the origin file\r\n * @param {string} includePath Include path relative to origin path\r\n * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r\n * @returns {string} Path to the include file\r\n */\r\npath.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r\n if (!alreadyNormalized)\r\n includePath = normalize(includePath);\r\n if (isAbsolute(includePath))\r\n return includePath;\r\n if (!alreadyNormalized)\r\n originPath = normalize(originPath);\r\n return (originPath = originPath.replace(/(?:\\/|^)[^/]+$/, \"\")).length ? normalize(originPath + \"/\" + includePath) : includePath;\r\n};\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\n/**\n * Runtime message from/to plain object converters.\n * @namespace\n */\nvar converter = exports;\n\nvar Enum = require(14),\n util = require(33);\n\n/**\n * Generates a partial value fromObject conveter.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} prop Property reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genValuePartial_fromObject(gen, field, fieldIndex, prop) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(d%s){\", prop);\n for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {\n if (field.repeated && values[keys[i]] === field.typeDefault) gen\n (\"default:\");\n gen\n (\"case%j:\", keys[i])\n (\"case %i:\", values[keys[i]])\n (\"m%s=%j\", prop, values[keys[i]])\n (\"break\");\n } gen\n (\"}\");\n } else gen\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s=types[%i].fromObject(d%s)\", prop, fieldIndex, prop);\n } else {\n var isUnsigned = false;\n switch (field.type) {\n case \"double\":\n case \"float\": gen\n (\"m%s=Number(d%s)\", prop, prop); // also catches \"NaN\", \"Infinity\"\n break;\n case \"uint32\":\n case \"fixed32\": gen\n (\"m%s=d%s>>>0\", prop, prop);\n break;\n case \"int32\":\n case \"sint32\":\n case \"sfixed32\": gen\n (\"m%s=d%s|0\", prop, prop);\n break;\n case \"uint64\":\n isUnsigned = true;\n // eslint-disable-line no-fallthrough\n case \"int64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(util.Long)\")\n (\"(m%s=util.Long.fromValue(d%s)).unsigned=%j\", prop, prop, isUnsigned)\n (\"else if(typeof d%s===\\\"string\\\")\", prop)\n (\"m%s=parseInt(d%s,10)\", prop, prop)\n (\"else if(typeof d%s===\\\"number\\\")\", prop)\n (\"m%s=d%s\", prop, prop)\n (\"else if(typeof d%s===\\\"object\\\")\", prop)\n (\"m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)\", prop, prop, prop, isUnsigned ? \"true\" : \"\");\n break;\n case \"bytes\": gen\n (\"if(typeof d%s===\\\"string\\\")\", prop)\n (\"util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)\", prop, prop, prop)\n (\"else if(d%s.length)\", prop)\n (\"m%s=d%s\", prop, prop);\n break;\n case \"string\": gen\n (\"m%s=String(d%s)\", prop, prop);\n break;\n case \"bool\": gen\n (\"m%s=Boolean(d%s)\", prop, prop);\n break;\n /* default: gen\n (\"m%s=d%s\", prop, prop);\n break; */\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a plain object to runtime message converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.fromObject = function fromObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray;\n var gen = util.codegen([\"d\"], mtype.name + \"$fromObject\")\n (\"if(d instanceof this.ctor)\")\n (\"return d\");\n if (!fields.length) return gen\n (\"return new this.ctor\");\n gen\n (\"var m=new this.ctor\");\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n prop = util.safeProp(field.name);\n\n // Map fields\n if (field.map) { gen\n (\"if(d%s){\", prop)\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s={}\", prop)\n (\"for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s\", prop, prop, prop, prop, isUnsigned ? \"true\": \"\", prop);\n break;\n case \"bytes\": gen\n (\"d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s\", prop, prop, prop, prop, prop);\n break;\n default: gen\n (\"d%s=m%s\", prop, prop);\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a runtime message to plain object converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.toObject = function toObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);\n if (!fields.length)\n return util.codegen()(\"return {}\");\n var gen = util.codegen([\"m\", \"o\"], mtype.name + \"$toObject\")\n (\"if(!o)\")\n (\"o={}\")\n (\"var d={}\");\n\n var repeatedFields = [],\n mapFields = [],\n normalFields = [],\n i = 0;\n for (; i < fields.length; ++i)\n if (!fields[i].partOf)\n ( fields[i].resolve().repeated ? repeatedFields\n : fields[i].map ? mapFields\n : normalFields).push(fields[i]);\n\n if (repeatedFields.length) { gen\n (\"if(o.arrays||o.defaults){\");\n for (i = 0; i < repeatedFields.length; ++i) gen\n (\"d%s=[]\", util.safeProp(repeatedFields[i].name));\n gen\n (\"}\");\n }\n\n if (mapFields.length) { gen\n (\"if(o.objects||o.defaults){\");\n for (i = 0; i < mapFields.length; ++i) gen\n (\"d%s={}\", util.safeProp(mapFields[i].name));\n gen\n (\"}\");\n }\n\n if (normalFields.length) { gen\n (\"if(o.defaults){\");\n for (i = 0; i < normalFields.length; ++i) {\n var field = normalFields[i],\n prop = util.safeProp(field.name);\n if (field.resolvedType instanceof Enum) gen\n (\"d%s=o.enums===String?%j:%j\", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);\n else if (field.long) gen\n (\"if(util.Long){\")\n (\"var n=new util.Long(%i,%i,%j)\", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)\n (\"d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n\", prop)\n (\"}else\")\n (\"d%s=o.longs===String?%j:%i\", prop, field.typeDefault.toString(), field.typeDefault.toNumber());\n else if (field.bytes) {\n var arrayDefault = \"[\" + Array.prototype.slice.call(field.typeDefault).join(\",\") + \"]\";\n gen\n (\"if(o.bytes===String)d%s=%j\", prop, String.fromCharCode.apply(String, field.typeDefault))\n (\"else{\")\n (\"d%s=%s\", prop, arrayDefault)\n (\"if(o.bytes!==Array)d%s=util.newBuffer(d%s)\", prop, prop)\n (\"}\");\n } else gen\n (\"d%s=%j\", prop, field.typeDefault); // also messages (=null)\n } gen\n (\"}\");\n }\n var hasKs2 = false;\n for (i = 0; i < fields.length; ++i) {\n var field = fields[i],\n index = mtype._fieldsArray.indexOf(field),\n prop = util.safeProp(field.name);\n if (field.map) {\n if (!hasKs2) { hasKs2 = true; gen\n (\"var ks2\");\n } gen\n (\"if(m%s&&(ks2=Object.keys(m%s)).length){\", prop, prop)\n (\"d%s={}\", prop)\n (\"for(var j=0;j>>3){\");\n\n var i = 0;\n for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n ref = \"m\" + util.safeProp(field.name); gen\n (\"case %i:\", field.id);\n\n // Map fields\n if (field.map) { gen\n (\"if(%s===util.emptyObject)\", ref)\n (\"%s={}\", ref)\n (\"var c2 = r.uint32()+r.pos\");\n\n if (types.defaults[field.keyType] !== undefined) gen\n (\"k=%j\", types.defaults[field.keyType]);\n else gen\n (\"k=null\");\n\n if (types.defaults[type] !== undefined) gen\n (\"value=%j\", types.defaults[type]);\n else gen\n (\"value=null\");\n\n gen\n (\"while(r.pos>>3){\")\n (\"case 1: k=r.%s(); break\", field.keyType)\n (\"case 2:\");\n\n if (types.basic[type] === undefined) gen\n (\"value=types[%i].decode(r,r.uint32())\", i); // can't be groups\n else gen\n (\"value=r.%s()\", type);\n\n gen\n (\"break\")\n (\"default:\")\n (\"r.skipType(tag2&7)\")\n (\"break\")\n (\"}\")\n (\"}\");\n\n if (types.long[field.keyType] !== undefined) gen\n (\"%s[typeof k===\\\"object\\\"?util.longToHash(k):k]=value\", ref);\n else gen\n (\"%s[k]=value\", ref);\n\n // Repeated fields\n } else if (field.repeated) { gen\n\n (\"if(!(%s&&%s.length))\", ref, ref)\n (\"%s=[]\", ref);\n\n // Packable (always check for forward and backward compatiblity)\n if (types.packed[type] !== undefined) gen\n (\"if((t&7)===2){\")\n (\"var c2=r.uint32()+r.pos\")\n (\"while(r.pos>> 0, (field.id << 3 | 4) >>> 0)\n : gen(\"types[%i].encode(%s,w.uint32(%i).fork()).ldelim()\", fieldIndex, ref, (field.id << 3 | 2) >>> 0);\n}\n\n/**\n * Generates an encoder specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction encoder(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var gen = util.codegen([\"m\", \"w\"], mtype.name + \"$encode\")\n (\"if(!w)\")\n (\"w=Writer.create()\");\n\n var i, ref;\n\n // \"when a message is serialized its known fields should be written sequentially by field number\"\n var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);\n\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n index = mtype._fieldsArray.indexOf(field),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n wireType = types.basic[type];\n ref = \"m\" + util.safeProp(field.name);\n\n // Map fields\n if (field.map) {\n gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j)){\", ref, field.name) // !== undefined && !== null\n (\"for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType);\n if (wireType === undefined) gen\n (\"types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()\", index, ref); // can't be groups\n else gen\n (\".uint32(%i).%s(%s[ks[i]]).ldelim()\", 16 | wireType, type, ref);\n gen\n (\"}\")\n (\"}\");\n\n // Repeated fields\n } else if (field.repeated) { gen\n (\"if(%s!=null&&%s.length){\", ref, ref); // !== undefined && !== null\n\n // Packed repeated\n if (field.packed && types.packed[type] !== undefined) { gen\n\n (\"w.uint32(%i).fork()\", (field.id << 3 | 2) >>> 0)\n (\"for(var i=0;i<%s.length;++i)\", ref)\n (\"w.%s(%s[i])\", type, ref)\n (\"w.ldelim()\");\n\n // Non-packed\n } else { gen\n\n (\"for(var i=0;i<%s.length;++i)\", ref);\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref + \"[i]\");\n else gen\n (\"w.uint32(%i).%s(%s[i])\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n } gen\n (\"}\");\n\n // Non-repeated\n } else {\n if (field.optional) gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j))\", ref, field.name); // !== undefined && !== null\n\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref);\n else gen\n (\"w.uint32(%i).%s(%s)\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n }\n }\n\n return gen\n (\"return w\");\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n","\"use strict\";\nmodule.exports = Enum;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = \"Enum\";\n\nvar Namespace = require(21),\n util = require(33);\n\n/**\n * Constructs a new enum instance.\n * @classdesc Reflected enum.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {Object.} [values] Enum values as an object, by name\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this enum\n * @param {Object.} [comments] The value comments for this enum\n */\nfunction Enum(name, values, options, comment, comments) {\n ReflectionObject.call(this, name, options);\n\n if (values && typeof values !== \"object\")\n throw TypeError(\"values must be an object\");\n\n /**\n * Enum values by id.\n * @type {Object.}\n */\n this.valuesById = {};\n\n /**\n * Enum values by name.\n * @type {Object.}\n */\n this.values = Object.create(this.valuesById); // toJSON, marker\n\n /**\n * Enum comment text.\n * @type {string|null}\n */\n this.comment = comment;\n\n /**\n * Value comment texts, if any.\n * @type {Object.}\n */\n this.comments = comments || {};\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n // Note that values inherit valuesById on their prototype which makes them a TypeScript-\n // compatible enum. This is used by pbts to write actual enum definitions that work for\n // static and reflection code alike instead of emitting generic object definitions.\n\n if (values)\n for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)\n if (typeof values[keys[i]] === \"number\") // use forward entries only\n this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];\n}\n\n/**\n * Enum descriptor.\n * @interface IEnum\n * @property {Object.} values Enum values\n * @property {Object.} [options] Enum options\n */\n\n/**\n * Constructs an enum from an enum descriptor.\n * @param {string} name Enum name\n * @param {IEnum} json Enum descriptor\n * @returns {Enum} Created enum\n * @throws {TypeError} If arguments are invalid\n */\nEnum.fromJSON = function fromJSON(name, json) {\n var enm = new Enum(name, json.values, json.options, json.comment, json.comments);\n enm.reserved = json.reserved;\n return enm;\n};\n\n/**\n * Converts this enum to an enum descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IEnum} Enum descriptor\n */\nEnum.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"values\" , this.values,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"comment\" , keepComments ? this.comment : undefined,\n \"comments\" , keepComments ? this.comments : undefined\n ]);\n};\n\n/**\n * Adds a value to this enum.\n * @param {string} name Value name\n * @param {number} id Value id\n * @param {string} [comment] Comment, if any\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a value with this name or id\n */\nEnum.prototype.add = function add(name, id, comment) {\n // utilized by the parser but not by .fromJSON\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (!util.isInteger(id))\n throw TypeError(\"id must be an integer\");\n\n if (this.values[name] !== undefined)\n throw Error(\"duplicate name '\" + name + \"' in \" + this);\n\n if (this.isReservedId(id))\n throw Error(\"id \" + id + \" is reserved in \" + this);\n\n if (this.isReservedName(name))\n throw Error(\"name '\" + name + \"' is reserved in \" + this);\n\n if (this.valuesById[id] !== undefined) {\n if (!(this.options && this.options.allow_alias))\n throw Error(\"duplicate id \" + id + \" in \" + this);\n this.values[name] = id;\n } else\n this.valuesById[this.values[name] = id] = name;\n\n this.comments[name] = comment || null;\n return this;\n};\n\n/**\n * Removes a value from this enum\n * @param {string} name Value name\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `name` is not a name of this enum\n */\nEnum.prototype.remove = function remove(name) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n var val = this.values[name];\n if (val == null)\n throw Error(\"name '\" + name + \"' does not exist in \" + this);\n\n delete this.valuesById[val];\n delete this.values[name];\n delete this.comments[name];\n\n return this;\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n","\"use strict\";\nmodule.exports = Field;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = \"Field\";\n\nvar Enum = require(14),\n types = require(32),\n util = require(33);\n\nvar Type; // cyclic\n\nvar ruleRe = /^required|optional|repeated$/;\n\n/**\n * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.\n * @name Field\n * @classdesc Reflected message field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a field from a field descriptor.\n * @param {string} name Field name\n * @param {IField} json Field descriptor\n * @returns {Field} Created field\n * @throws {TypeError} If arguments are invalid\n */\nField.fromJSON = function fromJSON(name, json) {\n return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);\n};\n\n/**\n * Not an actual constructor. Use {@link Field} instead.\n * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports FieldBase\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction Field(name, id, type, rule, extend, options, comment) {\n\n if (util.isObject(rule)) {\n comment = extend;\n options = rule;\n rule = extend = undefined;\n } else if (util.isObject(extend)) {\n comment = options;\n options = extend;\n extend = undefined;\n }\n\n ReflectionObject.call(this, name, options);\n\n if (!util.isInteger(id) || id < 0)\n throw TypeError(\"id must be a non-negative integer\");\n\n if (!util.isString(type))\n throw TypeError(\"type must be a string\");\n\n if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase()))\n throw TypeError(\"rule must be a string rule\");\n\n if (extend !== undefined && !util.isString(extend))\n throw TypeError(\"extend must be a string\");\n\n /**\n * Field rule, if any.\n * @type {string|undefined}\n */\n this.rule = rule && rule !== \"optional\" ? rule : undefined; // toJSON\n\n /**\n * Field type.\n * @type {string}\n */\n this.type = type; // toJSON\n\n /**\n * Unique field id.\n * @type {number}\n */\n this.id = id; // toJSON, marker\n\n /**\n * Extended type if different from parent.\n * @type {string|undefined}\n */\n this.extend = extend || undefined; // toJSON\n\n /**\n * Whether this field is required.\n * @type {boolean}\n */\n this.required = rule === \"required\";\n\n /**\n * Whether this field is optional.\n * @type {boolean}\n */\n this.optional = !this.required;\n\n /**\n * Whether this field is repeated.\n * @type {boolean}\n */\n this.repeated = rule === \"repeated\";\n\n /**\n * Whether this field is a map or not.\n * @type {boolean}\n */\n this.map = false;\n\n /**\n * Message this field belongs to.\n * @type {Type|null}\n */\n this.message = null;\n\n /**\n * OneOf this field belongs to, if any,\n * @type {OneOf|null}\n */\n this.partOf = null;\n\n /**\n * The field type's default value.\n * @type {*}\n */\n this.typeDefault = null;\n\n /**\n * The field's default value on prototypes.\n * @type {*}\n */\n this.defaultValue = null;\n\n /**\n * Whether this field's value should be treated as a long.\n * @type {boolean}\n */\n this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false;\n\n /**\n * Whether this field's value is a buffer.\n * @type {boolean}\n */\n this.bytes = type === \"bytes\";\n\n /**\n * Resolved type if not a basic type.\n * @type {Type|Enum|null}\n */\n this.resolvedType = null;\n\n /**\n * Sister-field within the extended type if a declaring extension field.\n * @type {Field|null}\n */\n this.extensionField = null;\n\n /**\n * Sister-field within the declaring namespace if an extended field.\n * @type {Field|null}\n */\n this.declaringField = null;\n\n /**\n * Internally remembers whether this field is packed.\n * @type {boolean|null}\n * @private\n */\n this._packed = null;\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Determines whether this field is packed. Only relevant when repeated and working with proto2.\n * @name Field#packed\n * @type {boolean}\n * @readonly\n */\nObject.defineProperty(Field.prototype, \"packed\", {\n get: function() {\n // defaults to packed=true if not explicity set to false\n if (this._packed === null)\n this._packed = this.getOption(\"packed\") !== false;\n return this._packed;\n }\n});\n\n/**\n * @override\n */\nField.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (name === \"packed\") // clear cached before setting\n this._packed = null;\n return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);\n};\n\n/**\n * Field descriptor.\n * @interface IField\n * @property {string} [rule=\"optional\"] Field rule\n * @property {string} type Field type\n * @property {number} id Field id\n * @property {Object.} [options] Field options\n */\n\n/**\n * Extension field descriptor.\n * @interface IExtensionField\n * @extends IField\n * @property {string} extend Extended type\n */\n\n/**\n * Converts this field to a field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IField} Field descriptor\n */\nField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"rule\" , this.rule !== \"optional\" && this.rule || undefined,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Resolves this field's type references.\n * @returns {Field} `this`\n * @throws {Error} If any reference cannot be resolved\n */\nField.prototype.resolve = function resolve() {\n\n if (this.resolved)\n return this;\n\n if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it\n this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);\n if (this.resolvedType instanceof Type)\n this.typeDefault = null;\n else // instanceof Enum\n this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined\n }\n\n // use explicitly set default value if present\n if (this.options && this.options[\"default\"] != null) {\n this.typeDefault = this.options[\"default\"];\n if (this.resolvedType instanceof Enum && typeof this.typeDefault === \"string\")\n this.typeDefault = this.resolvedType.values[this.typeDefault];\n }\n\n // remove unnecessary options\n if (this.options) {\n if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))\n delete this.options.packed;\n if (!Object.keys(this.options).length)\n this.options = undefined;\n }\n\n // convert to internal data type if necesssary\n if (this.long) {\n this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === \"u\");\n\n /* istanbul ignore else */\n if (Object.freeze)\n Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it)\n\n } else if (this.bytes && typeof this.typeDefault === \"string\") {\n var buf;\n if (util.base64.test(this.typeDefault))\n util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);\n else\n util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);\n this.typeDefault = buf;\n }\n\n // take special care of maps and repeated fields\n if (this.map)\n this.defaultValue = util.emptyObject;\n else if (this.repeated)\n this.defaultValue = util.emptyArray;\n else\n this.defaultValue = this.typeDefault;\n\n // ensure proper value on prototype\n if (this.parent instanceof Type)\n this.parent.ctor.prototype[this.name] = this.defaultValue;\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n\n/**\n * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).\n * @typedef FieldDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} fieldName Field name\n * @returns {undefined}\n */\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"string\"|\"bool\"|\"bytes\"|Object} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @param {T} [defaultValue] Default value\n * @returns {FieldDecorator} Decorator function\n * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]\n */\nField.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {\n\n // submessage: decorate the submessage and use its name as the type\n if (typeof fieldType === \"function\")\n fieldType = util.decorateType(fieldType).name;\n\n // enum reference: create a reflected copy of the enum and keep reuseing it\n else if (fieldType && typeof fieldType === \"object\")\n fieldType = util.decorateEnum(fieldType).name;\n\n return function fieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new Field(fieldName, fieldId, fieldType, fieldRule, { \"default\": defaultValue }));\n };\n};\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {Constructor|string} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @returns {FieldDecorator} Decorator function\n * @template T extends Message\n * @variation 2\n */\n// like Field.d but without a default value\n\n// Sets up cyclic dependencies (called in index-light)\nField._configure = function configure(Type_) {\n Type = Type_;\n};\n","\"use strict\";\nvar protobuf = module.exports = require(17);\n\nprotobuf.build = \"light\";\n\n/**\n * A node-style callback as used by {@link load} and {@link Root#load}.\n * @typedef LoadCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Root} [root] Root, if there hasn't been an error\n * @returns {undefined}\n */\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} root Root namespace, defaults to create a new one if omitted.\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n */\nfunction load(filename, root, callback) {\n if (typeof root === \"function\") {\n callback = root;\n root = new protobuf.Root();\n } else if (!root)\n root = new protobuf.Root();\n return root.load(filename, callback);\n}\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Promise} Promise\n * @see {@link Root#load}\n * @variation 3\n */\n// function load(filename:string, [root:Root]):Promise\n\nprotobuf.load = load;\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n * @see {@link Root#loadSync}\n */\nfunction loadSync(filename, root) {\n if (!root)\n root = new protobuf.Root();\n return root.loadSync(filename);\n}\n\nprotobuf.loadSync = loadSync;\n\n// Serialization\nprotobuf.encoder = require(13);\nprotobuf.decoder = require(12);\nprotobuf.verifier = require(36);\nprotobuf.converter = require(11);\n\n// Reflection\nprotobuf.ReflectionObject = require(22);\nprotobuf.Namespace = require(21);\nprotobuf.Root = require(26);\nprotobuf.Enum = require(14);\nprotobuf.Type = require(31);\nprotobuf.Field = require(15);\nprotobuf.OneOf = require(23);\nprotobuf.MapField = require(18);\nprotobuf.Service = require(30);\nprotobuf.Method = require(20);\n\n// Runtime\nprotobuf.Message = require(19);\nprotobuf.wrappers = require(37);\n\n// Utility\nprotobuf.types = require(32);\nprotobuf.util = require(33);\n\n// Set up possibly cyclic reflection dependencies\nprotobuf.ReflectionObject._configure(protobuf.Root);\nprotobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);\nprotobuf.Root._configure(protobuf.Type);\nprotobuf.Field._configure(protobuf.Type);\n","\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(38);\nprotobuf.BufferWriter = require(39);\nprotobuf.Reader = require(24);\nprotobuf.BufferReader = require(25);\n\n// Utility\nprotobuf.util = require(35);\nprotobuf.rpc = require(28);\nprotobuf.roots = require(27);\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n","\"use strict\";\nmodule.exports = MapField;\n\n// extends Field\nvar Field = require(15);\n((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = \"MapField\";\n\nvar types = require(32),\n util = require(33);\n\n/**\n * Constructs a new map field instance.\n * @classdesc Reflected map field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} keyType Key type\n * @param {string} type Value type\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction MapField(name, id, keyType, type, options, comment) {\n Field.call(this, name, id, type, undefined, undefined, options, comment);\n\n /* istanbul ignore if */\n if (!util.isString(keyType))\n throw TypeError(\"keyType must be a string\");\n\n /**\n * Key type.\n * @type {string}\n */\n this.keyType = keyType; // toJSON, marker\n\n /**\n * Resolved key type if not a basic type.\n * @type {ReflectionObject|null}\n */\n this.resolvedKeyType = null;\n\n // Overrides Field#map\n this.map = true;\n}\n\n/**\n * Map field descriptor.\n * @interface IMapField\n * @extends {IField}\n * @property {string} keyType Key type\n */\n\n/**\n * Extension map field descriptor.\n * @interface IExtensionMapField\n * @extends IMapField\n * @property {string} extend Extended type\n */\n\n/**\n * Constructs a map field from a map field descriptor.\n * @param {string} name Field name\n * @param {IMapField} json Map field descriptor\n * @returns {MapField} Created map field\n * @throws {TypeError} If arguments are invalid\n */\nMapField.fromJSON = function fromJSON(name, json) {\n return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);\n};\n\n/**\n * Converts this map field to a map field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMapField} Map field descriptor\n */\nMapField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"keyType\" , this.keyType,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMapField.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n\n // Besides a value type, map fields have a key type that may be \"any scalar type except for floating point types and bytes\"\n if (types.mapKey[this.keyType] === undefined)\n throw Error(\"invalid key type: \" + this.keyType);\n\n return Field.prototype.resolve.call(this);\n};\n\n/**\n * Map field decorator (TypeScript).\n * @name MapField.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"} fieldKeyType Field key type\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"|\"bytes\"|Object|Constructor<{}>} fieldValueType Field value type\n * @returns {FieldDecorator} Decorator function\n * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }\n */\nMapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {\n\n // submessage value: decorate the submessage and use its name as the type\n if (typeof fieldValueType === \"function\")\n fieldValueType = util.decorateType(fieldValueType).name;\n\n // enum reference value: create a reflected copy of the enum and keep reuseing it\n else if (fieldValueType && typeof fieldValueType === \"object\")\n fieldValueType = util.decorateEnum(fieldValueType).name;\n\n return function mapFieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));\n };\n};\n","\"use strict\";\nmodule.exports = Message;\n\nvar util = require(35);\n\n/**\n * Constructs a new message instance.\n * @classdesc Abstract runtime message.\n * @constructor\n * @param {Properties} [properties] Properties to set\n * @template T extends object = object\n */\nfunction Message(properties) {\n // not used internally\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n this[keys[i]] = properties[keys[i]];\n}\n\n/**\n * Reference to the reflected type.\n * @name Message.$type\n * @type {Type}\n * @readonly\n */\n\n/**\n * Reference to the reflected type.\n * @name Message#$type\n * @type {Type}\n * @readonly\n */\n\n/*eslint-disable valid-jsdoc*/\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.create = function create(properties) {\n return this.$type.create(properties);\n};\n\n/**\n * Encodes a message of this type.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encode = function encode(message, writer) {\n return this.$type.encode(message, writer);\n};\n\n/**\n * Encodes a message of this type preceeded by its length as a varint.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encodeDelimited = function encodeDelimited(message, writer) {\n return this.$type.encodeDelimited(message, writer);\n};\n\n/**\n * Decodes a message of this type.\n * @name Message.decode\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decode = function decode(reader) {\n return this.$type.decode(reader);\n};\n\n/**\n * Decodes a message of this type preceeded by its length as a varint.\n * @name Message.decodeDelimited\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decodeDelimited = function decodeDelimited(reader) {\n return this.$type.decodeDelimited(reader);\n};\n\n/**\n * Verifies a message of this type.\n * @name Message.verify\n * @function\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\nMessage.verify = function verify(message) {\n return this.$type.verify(message);\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object\n * @returns {T} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.fromObject = function fromObject(object) {\n return this.$type.fromObject(object);\n};\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {T} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @template T extends Message\n * @this Constructor\n */\nMessage.toObject = function toObject(message, options) {\n return this.$type.toObject(message, options);\n};\n\n/**\n * Converts this message to JSON.\n * @returns {Object.} JSON object\n */\nMessage.prototype.toJSON = function toJSON() {\n return this.$type.toObject(this, util.toJSONOptions);\n};\n\n/*eslint-enable valid-jsdoc*/","\"use strict\";\nmodule.exports = Method;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = \"Method\";\n\nvar util = require(33);\n\n/**\n * Constructs a new service method instance.\n * @classdesc Reflected service method.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Method name\n * @param {string|undefined} type Method type, usually `\"rpc\"`\n * @param {string} requestType Request message type\n * @param {string} responseType Response message type\n * @param {boolean|Object.} [requestStream] Whether the request is streamed\n * @param {boolean|Object.} [responseStream] Whether the response is streamed\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this method\n */\nfunction Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) {\n\n /* istanbul ignore next */\n if (util.isObject(requestStream)) {\n options = requestStream;\n requestStream = responseStream = undefined;\n } else if (util.isObject(responseStream)) {\n options = responseStream;\n responseStream = undefined;\n }\n\n /* istanbul ignore if */\n if (!(type === undefined || util.isString(type)))\n throw TypeError(\"type must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(requestType))\n throw TypeError(\"requestType must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(responseType))\n throw TypeError(\"responseType must be a string\");\n\n ReflectionObject.call(this, name, options);\n\n /**\n * Method type.\n * @type {string}\n */\n this.type = type || \"rpc\"; // toJSON\n\n /**\n * Request type.\n * @type {string}\n */\n this.requestType = requestType; // toJSON, marker\n\n /**\n * Whether requests are streamed or not.\n * @type {boolean|undefined}\n */\n this.requestStream = requestStream ? true : undefined; // toJSON\n\n /**\n * Response type.\n * @type {string}\n */\n this.responseType = responseType; // toJSON\n\n /**\n * Whether responses are streamed or not.\n * @type {boolean|undefined}\n */\n this.responseStream = responseStream ? true : undefined; // toJSON\n\n /**\n * Resolved request type.\n * @type {Type|null}\n */\n this.resolvedRequestType = null;\n\n /**\n * Resolved response type.\n * @type {Type|null}\n */\n this.resolvedResponseType = null;\n\n /**\n * Comment for this method\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Method descriptor.\n * @interface IMethod\n * @property {string} [type=\"rpc\"] Method type\n * @property {string} requestType Request type\n * @property {string} responseType Response type\n * @property {boolean} [requestStream=false] Whether requests are streamed\n * @property {boolean} [responseStream=false] Whether responses are streamed\n * @property {Object.} [options] Method options\n */\n\n/**\n * Constructs a method from a method descriptor.\n * @param {string} name Method name\n * @param {IMethod} json Method descriptor\n * @returns {Method} Created method\n * @throws {TypeError} If arguments are invalid\n */\nMethod.fromJSON = function fromJSON(name, json) {\n return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment);\n};\n\n/**\n * Converts this method to a method descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMethod} Method descriptor\n */\nMethod.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"type\" , this.type !== \"rpc\" && /* istanbul ignore next */ this.type || undefined,\n \"requestType\" , this.requestType,\n \"requestStream\" , this.requestStream,\n \"responseType\" , this.responseType,\n \"responseStream\" , this.responseStream,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMethod.prototype.resolve = function resolve() {\n\n /* istanbul ignore if */\n if (this.resolved)\n return this;\n\n this.resolvedRequestType = this.parent.lookupType(this.requestType);\n this.resolvedResponseType = this.parent.lookupType(this.responseType);\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n","\"use strict\";\nmodule.exports = Namespace;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = \"Namespace\";\n\nvar Field = require(15),\n util = require(33);\n\nvar Type, // cyclic\n Service,\n Enum;\n\n/**\n * Constructs a new namespace instance.\n * @name Namespace\n * @classdesc Reflected namespace.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a namespace from JSON.\n * @memberof Namespace\n * @function\n * @param {string} name Namespace name\n * @param {Object.} json JSON object\n * @returns {Namespace} Created namespace\n * @throws {TypeError} If arguments are invalid\n */\nNamespace.fromJSON = function fromJSON(name, json) {\n return new Namespace(name, json.options).addJSON(json.nested);\n};\n\n/**\n * Converts an array of reflection objects to JSON.\n * @memberof Namespace\n * @param {ReflectionObject[]} array Object array\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {Object.|undefined} JSON object or `undefined` when array is empty\n */\nfunction arrayToJSON(array, toJSONOptions) {\n if (!(array && array.length))\n return undefined;\n var obj = {};\n for (var i = 0; i < array.length; ++i)\n obj[array[i].name] = array[i].toJSON(toJSONOptions);\n return obj;\n}\n\nNamespace.arrayToJSON = arrayToJSON;\n\n/**\n * Tests if the specified id is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedId = function isReservedId(reserved, id) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (typeof reserved[i] !== \"string\" && reserved[i][0] <= id && reserved[i][1] > id)\n return true;\n return false;\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedName = function isReservedName(reserved, name) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (reserved[i] === name)\n return true;\n return false;\n};\n\n/**\n * Not an actual constructor. Use {@link Namespace} instead.\n * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports NamespaceBase\n * @extends ReflectionObject\n * @abstract\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n * @see {@link Namespace}\n */\nfunction Namespace(name, options) {\n ReflectionObject.call(this, name, options);\n\n /**\n * Nested objects by name.\n * @type {Object.|undefined}\n */\n this.nested = undefined; // toJSON\n\n /**\n * Cached nested objects as an array.\n * @type {ReflectionObject[]|null}\n * @private\n */\n this._nestedArray = null;\n}\n\nfunction clearCache(namespace) {\n namespace._nestedArray = null;\n return namespace;\n}\n\n/**\n * Nested objects of this namespace as an array for iteration.\n * @name NamespaceBase#nestedArray\n * @type {ReflectionObject[]}\n * @readonly\n */\nObject.defineProperty(Namespace.prototype, \"nestedArray\", {\n get: function() {\n return this._nestedArray || (this._nestedArray = util.toArray(this.nested));\n }\n});\n\n/**\n * Namespace descriptor.\n * @interface INamespace\n * @property {Object.} [options] Namespace options\n * @property {Object.} [nested] Nested object descriptors\n */\n\n/**\n * Any extension field descriptor.\n * @typedef AnyExtensionField\n * @type {IExtensionField|IExtensionMapField}\n */\n\n/**\n * Any nested object descriptor.\n * @typedef AnyNestedObject\n * @type {IEnum|IType|IService|AnyExtensionField|INamespace}\n */\n// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)\n\n/**\n * Converts this namespace to a namespace descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {INamespace} Namespace descriptor\n */\nNamespace.prototype.toJSON = function toJSON(toJSONOptions) {\n return util.toObject([\n \"options\" , this.options,\n \"nested\" , arrayToJSON(this.nestedArray, toJSONOptions)\n ]);\n};\n\n/**\n * Adds nested objects to this namespace from nested object descriptors.\n * @param {Object.} nestedJson Any nested object descriptors\n * @returns {Namespace} `this`\n */\nNamespace.prototype.addJSON = function addJSON(nestedJson) {\n var ns = this;\n /* istanbul ignore else */\n if (nestedJson) {\n for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {\n nested = nestedJson[names[i]];\n ns.add( // most to least likely\n ( nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : nested.id !== undefined\n ? Field.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n }\n return this;\n};\n\n/**\n * Gets the nested object of the specified name.\n * @param {string} name Nested object name\n * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist\n */\nNamespace.prototype.get = function get(name) {\n return this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Gets the values of the nested {@link Enum|enum} of the specified name.\n * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`.\n * @param {string} name Nested enum name\n * @returns {Object.} Enum values\n * @throws {Error} If there is no such enum\n */\nNamespace.prototype.getEnum = function getEnum(name) {\n if (this.nested && this.nested[name] instanceof Enum)\n return this.nested[name].values;\n throw Error(\"no such enum: \" + name);\n};\n\n/**\n * Adds a nested object to this namespace.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name\n */\nNamespace.prototype.add = function add(object) {\n\n if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))\n throw TypeError(\"object must be a valid nested object\");\n\n if (!this.nested)\n this.nested = {};\n else {\n var prev = this.get(object.name);\n if (prev) {\n if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {\n // replace plain namespace but keep existing nested elements and options\n var nested = prev.nestedArray;\n for (var i = 0; i < nested.length; ++i)\n object.add(nested[i]);\n this.remove(prev);\n if (!this.nested)\n this.nested = {};\n object.setOptions(prev.options, true);\n\n } else\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n }\n }\n this.nested[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n};\n\n/**\n * Removes a nested object from this namespace.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this namespace\n */\nNamespace.prototype.remove = function remove(object) {\n\n if (!(object instanceof ReflectionObject))\n throw TypeError(\"object must be a ReflectionObject\");\n if (object.parent !== this)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.nested[object.name];\n if (!Object.keys(this.nested).length)\n this.nested = undefined;\n\n object.onRemove(this);\n return clearCache(this);\n};\n\n/**\n * Defines additial namespaces within this one if not yet existing.\n * @param {string|string[]} path Path to create\n * @param {*} [json] Nested types to create from JSON\n * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty\n */\nNamespace.prototype.define = function define(path, json) {\n\n if (util.isString(path))\n path = path.split(\".\");\n else if (!Array.isArray(path))\n throw TypeError(\"illegal path\");\n if (path && path.length && path[0] === \"\")\n throw Error(\"path must be relative\");\n\n var ptr = this;\n while (path.length > 0) {\n var part = path.shift();\n if (ptr.nested && ptr.nested[part]) {\n ptr = ptr.nested[part];\n if (!(ptr instanceof Namespace))\n throw Error(\"path conflicts with non-namespace objects\");\n } else\n ptr.add(ptr = new Namespace(part));\n }\n if (json)\n ptr.addJSON(json);\n return ptr;\n};\n\n/**\n * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.\n * @returns {Namespace} `this`\n */\nNamespace.prototype.resolveAll = function resolveAll() {\n var nested = this.nestedArray, i = 0;\n while (i < nested.length)\n if (nested[i] instanceof Namespace)\n nested[i++].resolveAll();\n else\n nested[i++].resolve();\n return this.resolve();\n};\n\n/**\n * Recursively looks up the reflection object matching the specified path in the scope of this namespace.\n * @param {string|string[]} path Path to look up\n * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc.\n * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n */\nNamespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {\n\n /* istanbul ignore next */\n if (typeof filterTypes === \"boolean\") {\n parentAlreadyChecked = filterTypes;\n filterTypes = undefined;\n } else if (filterTypes && !Array.isArray(filterTypes))\n filterTypes = [ filterTypes ];\n\n if (util.isString(path) && path.length) {\n if (path === \".\")\n return this.root;\n path = path.split(\".\");\n } else if (!path.length)\n return this;\n\n // Start at root if path is absolute\n if (path[0] === \"\")\n return this.root.lookup(path.slice(1), filterTypes);\n\n // Test if the first part matches any nested object, and if so, traverse if path contains more\n var found = this.get(path[0]);\n if (found) {\n if (path.length === 1) {\n if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)\n return found;\n } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))\n return found;\n\n // Otherwise try each nested namespace\n } else\n for (var i = 0; i < this.nestedArray.length; ++i)\n if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))\n return found;\n\n // If there hasn't been a match, try again at the parent\n if (this.parent === null || parentAlreadyChecked)\n return null;\n return this.parent.lookup(path, filterTypes);\n};\n\n/**\n * Looks up the reflection object at the specified path, relative to this namespace.\n * @name NamespaceBase#lookup\n * @function\n * @param {string|string[]} path Path to look up\n * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n * @variation 2\n */\n// lookup(path: string, [parentAlreadyChecked: boolean])\n\n/**\n * Looks up the {@link Type|type} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type\n * @throws {Error} If `path` does not point to a type\n */\nNamespace.prototype.lookupType = function lookupType(path) {\n var found = this.lookup(path, [ Type ]);\n if (!found)\n throw Error(\"no such type: \" + path);\n return found;\n};\n\n/**\n * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Enum} Looked up enum\n * @throws {Error} If `path` does not point to an enum\n */\nNamespace.prototype.lookupEnum = function lookupEnum(path) {\n var found = this.lookup(path, [ Enum ]);\n if (!found)\n throw Error(\"no such Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type or enum\n * @throws {Error} If `path` does not point to a type or enum\n */\nNamespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {\n var found = this.lookup(path, [ Type, Enum ]);\n if (!found)\n throw Error(\"no such Type or Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Service|service} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Service} Looked up service\n * @throws {Error} If `path` does not point to a service\n */\nNamespace.prototype.lookupService = function lookupService(path) {\n var found = this.lookup(path, [ Service ]);\n if (!found)\n throw Error(\"no such Service '\" + path + \"' in \" + this);\n return found;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nNamespace._configure = function(Type_, Service_, Enum_) {\n Type = Type_;\n Service = Service_;\n Enum = Enum_;\n};\n","\"use strict\";\nmodule.exports = ReflectionObject;\n\nReflectionObject.className = \"ReflectionObject\";\n\nvar util = require(33);\n\nvar Root; // cyclic\n\n/**\n * Constructs a new reflection object instance.\n * @classdesc Base class of all reflection objects.\n * @constructor\n * @param {string} name Object name\n * @param {Object.} [options] Declared options\n * @abstract\n */\nfunction ReflectionObject(name, options) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (options && !util.isObject(options))\n throw TypeError(\"options must be an object\");\n\n /**\n * Options.\n * @type {Object.|undefined}\n */\n this.options = options; // toJSON\n\n /**\n * Parsed Options.\n * @type {Array.>|undefined}\n */\n this.parsedOptions = null;\n\n /**\n * Unique name within its namespace.\n * @type {string}\n */\n this.name = name;\n\n /**\n * Parent namespace.\n * @type {Namespace|null}\n */\n this.parent = null;\n\n /**\n * Whether already resolved or not.\n * @type {boolean}\n */\n this.resolved = false;\n\n /**\n * Comment text, if any.\n * @type {string|null}\n */\n this.comment = null;\n\n /**\n * Defining file name.\n * @type {string|null}\n */\n this.filename = null;\n}\n\nObject.defineProperties(ReflectionObject.prototype, {\n\n /**\n * Reference to the root namespace.\n * @name ReflectionObject#root\n * @type {Root}\n * @readonly\n */\n root: {\n get: function() {\n var ptr = this;\n while (ptr.parent !== null)\n ptr = ptr.parent;\n return ptr;\n }\n },\n\n /**\n * Full name including leading dot.\n * @name ReflectionObject#fullName\n * @type {string}\n * @readonly\n */\n fullName: {\n get: function() {\n var path = [ this.name ],\n ptr = this.parent;\n while (ptr) {\n path.unshift(ptr.name);\n ptr = ptr.parent;\n }\n return path.join(\".\");\n }\n }\n});\n\n/**\n * Converts this reflection object to its descriptor representation.\n * @returns {Object.} Descriptor\n * @abstract\n */\nReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {\n throw Error(); // not implemented, shouldn't happen\n};\n\n/**\n * Called when this object is added to a parent.\n * @param {ReflectionObject} parent Parent added to\n * @returns {undefined}\n */\nReflectionObject.prototype.onAdd = function onAdd(parent) {\n if (this.parent && this.parent !== parent)\n this.parent.remove(this);\n this.parent = parent;\n this.resolved = false;\n var root = parent.root;\n if (root instanceof Root)\n root._handleAdd(this);\n};\n\n/**\n * Called when this object is removed from a parent.\n * @param {ReflectionObject} parent Parent removed from\n * @returns {undefined}\n */\nReflectionObject.prototype.onRemove = function onRemove(parent) {\n var root = parent.root;\n if (root instanceof Root)\n root._handleRemove(this);\n this.parent = null;\n this.resolved = false;\n};\n\n/**\n * Resolves this objects type references.\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n if (this.root instanceof Root)\n this.resolved = true; // only if part of a root\n return this;\n};\n\n/**\n * Gets an option value.\n * @param {string} name Option name\n * @returns {*} Option value or `undefined` if not set\n */\nReflectionObject.prototype.getOption = function getOption(name) {\n if (this.options)\n return this.options[name];\n return undefined;\n};\n\n/**\n * Sets an option.\n * @param {string} name Option name\n * @param {*} value Option value\n * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (!ifNotSet || !this.options || this.options[name] === undefined)\n (this.options || (this.options = {}))[name] = value;\n return this;\n};\n\n/**\n * Sets a parsed option.\n * @param {string} name parsed Option name\n * @param {*} value Option value\n * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\\empty, will add a new option with that value\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) {\n if (!this.parsedOptions) {\n this.parsedOptions = [];\n }\n var parsedOptions = this.parsedOptions;\n if (propName) {\n // If setting a sub property of an option then try to merge it\n // with an existing option\n var opt = parsedOptions.find(function (opt) {\n return Object.prototype.hasOwnProperty.call(opt, name);\n });\n if (opt) {\n // If we found an existing option - just merge the property value\n var newValue = opt[name];\n util.setProperty(newValue, propName, value);\n } else {\n // otherwise, create a new option, set it's property and add it to the list\n opt = {};\n opt[name] = util.setProperty({}, propName, value);\n parsedOptions.push(opt);\n }\n } else {\n // Always create a new option when setting the value of the option itself\n var newOpt = {};\n newOpt[name] = value;\n parsedOptions.push(newOpt);\n }\n return this;\n};\n\n/**\n * Sets multiple options.\n * @param {Object.} options Options to set\n * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {\n if (options)\n for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)\n this.setOption(keys[i], options[keys[i]], ifNotSet);\n return this;\n};\n\n/**\n * Converts this instance to its string representation.\n * @returns {string} Class name[, space, full name]\n */\nReflectionObject.prototype.toString = function toString() {\n var className = this.constructor.className,\n fullName = this.fullName;\n if (fullName.length)\n return className + \" \" + fullName;\n return className;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nReflectionObject._configure = function(Root_) {\n Root = Root_;\n};\n","\"use strict\";\nmodule.exports = OneOf;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = \"OneOf\";\n\nvar Field = require(15),\n util = require(33);\n\n/**\n * Constructs a new oneof instance.\n * @classdesc Reflected oneof.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Oneof name\n * @param {string[]|Object.} [fieldNames] Field names\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction OneOf(name, fieldNames, options, comment) {\n if (!Array.isArray(fieldNames)) {\n options = fieldNames;\n fieldNames = undefined;\n }\n ReflectionObject.call(this, name, options);\n\n /* istanbul ignore if */\n if (!(fieldNames === undefined || Array.isArray(fieldNames)))\n throw TypeError(\"fieldNames must be an Array\");\n\n /**\n * Field names that belong to this oneof.\n * @type {string[]}\n */\n this.oneof = fieldNames || []; // toJSON, marker\n\n /**\n * Fields that belong to this oneof as an array for iteration.\n * @type {Field[]}\n * @readonly\n */\n this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Oneof descriptor.\n * @interface IOneOf\n * @property {Array.} oneof Oneof field names\n * @property {Object.} [options] Oneof options\n */\n\n/**\n * Constructs a oneof from a oneof descriptor.\n * @param {string} name Oneof name\n * @param {IOneOf} json Oneof descriptor\n * @returns {OneOf} Created oneof\n * @throws {TypeError} If arguments are invalid\n */\nOneOf.fromJSON = function fromJSON(name, json) {\n return new OneOf(name, json.oneof, json.options, json.comment);\n};\n\n/**\n * Converts this oneof to a oneof descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IOneOf} Oneof descriptor\n */\nOneOf.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"oneof\" , this.oneof,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Adds the fields of the specified oneof to the parent if not already done so.\n * @param {OneOf} oneof The oneof\n * @returns {undefined}\n * @inner\n * @ignore\n */\nfunction addFieldsToParent(oneof) {\n if (oneof.parent)\n for (var i = 0; i < oneof.fieldsArray.length; ++i)\n if (!oneof.fieldsArray[i].parent)\n oneof.parent.add(oneof.fieldsArray[i]);\n}\n\n/**\n * Adds a field to this oneof and removes it from its current parent, if any.\n * @param {Field} field Field to add\n * @returns {OneOf} `this`\n */\nOneOf.prototype.add = function add(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n if (field.parent && field.parent !== this.parent)\n field.parent.remove(field);\n this.oneof.push(field.name);\n this.fieldsArray.push(field);\n field.partOf = this; // field.parent remains null\n addFieldsToParent(this);\n return this;\n};\n\n/**\n * Removes a field from this oneof and puts it back to the oneof's parent.\n * @param {Field} field Field to remove\n * @returns {OneOf} `this`\n */\nOneOf.prototype.remove = function remove(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n var index = this.fieldsArray.indexOf(field);\n\n /* istanbul ignore if */\n if (index < 0)\n throw Error(field + \" is not a member of \" + this);\n\n this.fieldsArray.splice(index, 1);\n index = this.oneof.indexOf(field.name);\n\n /* istanbul ignore else */\n if (index > -1) // theoretical\n this.oneof.splice(index, 1);\n\n field.partOf = null;\n return this;\n};\n\n/**\n * @override\n */\nOneOf.prototype.onAdd = function onAdd(parent) {\n ReflectionObject.prototype.onAdd.call(this, parent);\n var self = this;\n // Collect present fields\n for (var i = 0; i < this.oneof.length; ++i) {\n var field = parent.get(this.oneof[i]);\n if (field && !field.partOf) {\n field.partOf = self;\n self.fieldsArray.push(field);\n }\n }\n // Add not yet present fields\n addFieldsToParent(this);\n};\n\n/**\n * @override\n */\nOneOf.prototype.onRemove = function onRemove(parent) {\n for (var i = 0, field; i < this.fieldsArray.length; ++i)\n if ((field = this.fieldsArray[i]).parent)\n field.parent.remove(field);\n ReflectionObject.prototype.onRemove.call(this, parent);\n};\n\n/**\n * Decorator function as returned by {@link OneOf.d} (TypeScript).\n * @typedef OneOfDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} oneofName OneOf name\n * @returns {undefined}\n */\n\n/**\n * OneOf decorator (TypeScript).\n * @function\n * @param {...string} fieldNames Field names\n * @returns {OneOfDecorator} Decorator function\n * @template T extends string\n */\nOneOf.d = function decorateOneOf() {\n var fieldNames = new Array(arguments.length),\n index = 0;\n while (index < arguments.length)\n fieldNames[index] = arguments[index++];\n return function oneOfDecorator(prototype, oneofName) {\n util.decorateType(prototype.constructor)\n .add(new OneOf(oneofName, fieldNames));\n Object.defineProperty(prototype, oneofName, {\n get: util.oneOfGetter(fieldNames),\n set: util.oneOfSetter(fieldNames)\n });\n };\n};\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(35);\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(24);\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(35);\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n","\"use strict\";\nmodule.exports = Root;\n\n// extends Namespace\nvar Namespace = require(21);\n((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = \"Root\";\n\nvar Field = require(15),\n Enum = require(14),\n OneOf = require(23),\n util = require(33);\n\nvar Type, // cyclic\n parse, // might be excluded\n common; // \"\n\n/**\n * Constructs a new root namespace instance.\n * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together.\n * @extends NamespaceBase\n * @constructor\n * @param {Object.} [options] Top level options\n */\nfunction Root(options) {\n Namespace.call(this, \"\", options);\n\n /**\n * Deferred extension fields.\n * @type {Field[]}\n */\n this.deferred = [];\n\n /**\n * Resolved file names of loaded files.\n * @type {string[]}\n */\n this.files = [];\n}\n\n/**\n * Loads a namespace descriptor into a root namespace.\n * @param {INamespace} json Nameespace descriptor\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted\n * @returns {Root} Root namespace\n */\nRoot.fromJSON = function fromJSON(json, root) {\n if (!root)\n root = new Root();\n if (json.options)\n root.setOptions(json.options);\n return root.addJSON(json.nested);\n};\n\n/**\n * Resolves the path of an imported file, relative to the importing origin.\n * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories.\n * @function\n * @param {string} origin The file name of the importing file\n * @param {string} target The file name being imported\n * @returns {string|null} Resolved path to `target` or `null` to skip the file\n */\nRoot.prototype.resolvePath = util.path.resolve;\n\n/**\n * Fetch content from file path or url\n * This method exists so you can override it with your own logic.\n * @function\n * @param {string} path File path or url\n * @param {FetchCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.fetch = util.fetch;\n\n// A symbol-like function to safely signal synchronous loading\n/* istanbul ignore next */\nfunction SYNC() {} // eslint-disable-line no-empty-function\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} options Parse options\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.load = function load(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = undefined;\n }\n var self = this;\n if (!callback)\n return util.asPromise(load, self, filename, options);\n\n var sync = callback === SYNC; // undocumented\n\n // Finishes loading by calling the callback (exactly once)\n function finish(err, root) {\n /* istanbul ignore if */\n if (!callback)\n return;\n var cb = callback;\n callback = null;\n if (sync)\n throw err;\n cb(err, root);\n }\n\n // Bundled definition existence checking\n function getBundledFileName(filename) {\n var idx = filename.lastIndexOf(\"google/protobuf/\");\n if (idx > -1) {\n var altname = filename.substring(idx);\n if (altname in common) return altname;\n }\n return null;\n }\n\n // Processes a single file\n function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }\n\n // Fetches a single file\n function fetch(filename, weak) {\n\n // Skip if already loaded / attempted\n if (self.files.indexOf(filename) > -1)\n return;\n self.files.push(filename);\n\n // Shortcut bundled definitions\n if (filename in common) {\n if (sync)\n process(filename, common[filename]);\n else {\n ++queued;\n setTimeout(function() {\n --queued;\n process(filename, common[filename]);\n });\n }\n return;\n }\n\n // Otherwise fetch from disk or network\n if (sync) {\n var source;\n try {\n source = util.fs.readFileSync(filename).toString(\"utf8\");\n } catch (err) {\n if (!weak)\n finish(err);\n return;\n }\n process(filename, source);\n } else {\n ++queued;\n self.fetch(filename, function(err, source) {\n --queued;\n /* istanbul ignore if */\n if (!callback)\n return; // terminated meanwhile\n if (err) {\n /* istanbul ignore else */\n if (!weak)\n finish(err);\n else if (!queued) // can't be covered reliably\n finish(null, self);\n return;\n }\n process(filename, source);\n });\n }\n }\n var queued = 0;\n\n // Assembling the root namespace doesn't require working type\n // references anymore, so we can load everything in parallel\n if (util.isString(filename))\n filename = [ filename ];\n for (var i = 0, resolved; i < filename.length; ++i)\n if (resolved = self.resolvePath(\"\", filename[i]))\n fetch(resolved);\n\n if (sync)\n return self;\n if (!queued)\n finish(null, self);\n return undefined;\n};\n// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Promise} Promise\n * @variation 3\n */\n// function load(filename:string, [options:IParseOptions]):Promise\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).\n * @function Root#loadSync\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n */\nRoot.prototype.loadSync = function loadSync(filename, options) {\n if (!util.isNode)\n throw Error(\"not supported\");\n return this.load(filename, options, SYNC);\n};\n\n/**\n * @override\n */\nRoot.prototype.resolveAll = function resolveAll() {\n if (this.deferred.length)\n throw Error(\"unresolvable extensions: \" + this.deferred.map(function(field) {\n return \"'extend \" + field.extend + \"' in \" + field.parent.fullName;\n }).join(\", \"));\n return Namespace.prototype.resolveAll.call(this);\n};\n\n// only uppercased (and thus conflict-free) children are exposed, see below\nvar exposeRe = /^[A-Z]/;\n\n/**\n * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type.\n * @param {Root} root Root instance\n * @param {Field} field Declaring extension field witin the declaring type\n * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise\n * @inner\n * @ignore\n */\nfunction tryHandleExtension(root, field) {\n var extendedType = field.parent.lookup(field.extend);\n if (extendedType) {\n var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);\n sisterField.declaringField = field;\n field.extensionField = sisterField;\n extendedType.add(sisterField);\n return true;\n }\n return false;\n}\n\n/**\n * Called when any object is added to this root or its sub-namespaces.\n * @param {ReflectionObject} object Object added\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleAdd = function _handleAdd(object) {\n if (object instanceof Field) {\n\n if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField)\n if (!tryHandleExtension(this, object))\n this.deferred.push(object);\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n object.parent[object.name] = object.values; // expose enum values as property of its parent\n\n } else if (!(object instanceof OneOf)) /* everything else is a namespace */ {\n\n if (object instanceof Type) // Try to handle any deferred extensions\n for (var i = 0; i < this.deferred.length;)\n if (tryHandleExtension(this, this.deferred[i]))\n this.deferred.splice(i, 1);\n else\n ++i;\n for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace\n this._handleAdd(object._nestedArray[j]);\n if (exposeRe.test(object.name))\n object.parent[object.name] = object; // expose namespace as property of its parent\n }\n\n // The above also adds uppercased (and thus conflict-free) nested types, services and enums as\n // properties of namespaces just like static code does. This allows using a .d.ts generated for\n // a static module with reflection-based solutions where the condition is met.\n};\n\n/**\n * Called when any object is removed from this root or its sub-namespaces.\n * @param {ReflectionObject} object Object removed\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleRemove = function _handleRemove(object) {\n if (object instanceof Field) {\n\n if (/* an extension field */ object.extend !== undefined) {\n if (/* already handled */ object.extensionField) { // remove its sister field\n object.extensionField.parent.remove(object.extensionField);\n object.extensionField = null;\n } else { // cancel the extension\n var index = this.deferred.indexOf(object);\n /* istanbul ignore else */\n if (index > -1)\n this.deferred.splice(index, 1);\n }\n }\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose enum values\n\n } else if (object instanceof Namespace) {\n\n for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace\n this._handleRemove(object._nestedArray[i]);\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose namespaces\n\n }\n};\n\n// Sets up cyclic dependencies (called in index-light)\nRoot._configure = function(Type_, parse_, common_) {\n Type = Type_;\n parse = parse_;\n common = common_;\n};\n","\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n","\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(29);\n","\"use strict\";\nmodule.exports = Service;\n\nvar util = require(35);\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n","\"use strict\";\nmodule.exports = Service;\n\n// extends Namespace\nvar Namespace = require(21);\n((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = \"Service\";\n\nvar Method = require(20),\n util = require(33),\n rpc = require(28);\n\n/**\n * Constructs a new service instance.\n * @classdesc Reflected service.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Service name\n * @param {Object.} [options] Service options\n * @throws {TypeError} If arguments are invalid\n */\nfunction Service(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Service methods.\n * @type {Object.}\n */\n this.methods = {}; // toJSON, marker\n\n /**\n * Cached methods as an array.\n * @type {Method[]|null}\n * @private\n */\n this._methodsArray = null;\n}\n\n/**\n * Service descriptor.\n * @interface IService\n * @extends INamespace\n * @property {Object.} methods Method descriptors\n */\n\n/**\n * Constructs a service from a service descriptor.\n * @param {string} name Service name\n * @param {IService} json Service descriptor\n * @returns {Service} Created service\n * @throws {TypeError} If arguments are invalid\n */\nService.fromJSON = function fromJSON(name, json) {\n var service = new Service(name, json.options);\n /* istanbul ignore else */\n if (json.methods)\n for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)\n service.add(Method.fromJSON(names[i], json.methods[names[i]]));\n if (json.nested)\n service.addJSON(json.nested);\n service.comment = json.comment;\n return service;\n};\n\n/**\n * Converts this service to a service descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IService} Service descriptor\n */\nService.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"methods\" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {},\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Methods of this service as an array for iteration.\n * @name Service#methodsArray\n * @type {Method[]}\n * @readonly\n */\nObject.defineProperty(Service.prototype, \"methodsArray\", {\n get: function() {\n return this._methodsArray || (this._methodsArray = util.toArray(this.methods));\n }\n});\n\nfunction clearCache(service) {\n service._methodsArray = null;\n return service;\n}\n\n/**\n * @override\n */\nService.prototype.get = function get(name) {\n return this.methods[name]\n || Namespace.prototype.get.call(this, name);\n};\n\n/**\n * @override\n */\nService.prototype.resolveAll = function resolveAll() {\n var methods = this.methodsArray;\n for (var i = 0; i < methods.length; ++i)\n methods[i].resolve();\n return Namespace.prototype.resolve.call(this);\n};\n\n/**\n * @override\n */\nService.prototype.add = function add(object) {\n\n /* istanbul ignore if */\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Method) {\n this.methods[object.name] = object;\n object.parent = this;\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * @override\n */\nService.prototype.remove = function remove(object) {\n if (object instanceof Method) {\n\n /* istanbul ignore if */\n if (this.methods[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.methods[object.name];\n object.parent = null;\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Creates a runtime service using the specified rpc implementation.\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed.\n */\nService.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {\n var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);\n for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {\n var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\\w_]/g, \"\");\n rpcService[methodName] = util.codegen([\"r\",\"c\"], util.isReserved(methodName) ? methodName + \"_\" : methodName)(\"return this.rpcCall(m,q,s,r,c)\")({\n m: method,\n q: method.resolvedRequestType.ctor,\n s: method.resolvedResponseType.ctor\n });\n }\n return rpcService;\n};\n","\"use strict\";\nmodule.exports = Type;\n\n// extends Namespace\nvar Namespace = require(21);\n((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = \"Type\";\n\nvar Enum = require(14),\n OneOf = require(23),\n Field = require(15),\n MapField = require(18),\n Service = require(30),\n Message = require(19),\n Reader = require(24),\n Writer = require(38),\n util = require(33),\n encoder = require(13),\n decoder = require(12),\n verifier = require(36),\n converter = require(11),\n wrappers = require(37);\n\n/**\n * Constructs a new reflected message type instance.\n * @classdesc Reflected message type.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Message name\n * @param {Object.} [options] Declared options\n */\nfunction Type(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Message fields.\n * @type {Object.}\n */\n this.fields = {}; // toJSON, marker\n\n /**\n * Oneofs declared within this namespace, if any.\n * @type {Object.}\n */\n this.oneofs = undefined; // toJSON\n\n /**\n * Extension ranges, if any.\n * @type {number[][]}\n */\n this.extensions = undefined; // toJSON\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n /*?\n * Whether this type is a legacy group.\n * @type {boolean|undefined}\n */\n this.group = undefined; // toJSON\n\n /**\n * Cached fields by id.\n * @type {Object.|null}\n * @private\n */\n this._fieldsById = null;\n\n /**\n * Cached fields as an array.\n * @type {Field[]|null}\n * @private\n */\n this._fieldsArray = null;\n\n /**\n * Cached oneofs as an array.\n * @type {OneOf[]|null}\n * @private\n */\n this._oneofsArray = null;\n\n /**\n * Cached constructor.\n * @type {Constructor<{}>}\n * @private\n */\n this._ctor = null;\n}\n\nObject.defineProperties(Type.prototype, {\n\n /**\n * Message fields by id.\n * @name Type#fieldsById\n * @type {Object.}\n * @readonly\n */\n fieldsById: {\n get: function() {\n\n /* istanbul ignore if */\n if (this._fieldsById)\n return this._fieldsById;\n\n this._fieldsById = {};\n for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {\n var field = this.fields[names[i]],\n id = field.id;\n\n /* istanbul ignore if */\n if (this._fieldsById[id])\n throw Error(\"duplicate id \" + id + \" in \" + this);\n\n this._fieldsById[id] = field;\n }\n return this._fieldsById;\n }\n },\n\n /**\n * Fields of this message as an array for iteration.\n * @name Type#fieldsArray\n * @type {Field[]}\n * @readonly\n */\n fieldsArray: {\n get: function() {\n return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));\n }\n },\n\n /**\n * Oneofs of this message as an array for iteration.\n * @name Type#oneofsArray\n * @type {OneOf[]}\n * @readonly\n */\n oneofsArray: {\n get: function() {\n return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));\n }\n },\n\n /**\n * The registered constructor, if any registered, otherwise a generic constructor.\n * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.\n * @name Type#ctor\n * @type {Constructor<{}>}\n */\n ctor: {\n get: function() {\n return this._ctor || (this.ctor = Type.generateConstructor(this)());\n },\n set: function(ctor) {\n\n // Ensure proper prototype\n var prototype = ctor.prototype;\n if (!(prototype instanceof Message)) {\n (ctor.prototype = new Message()).constructor = ctor;\n util.merge(ctor.prototype, prototype);\n }\n\n // Classes and messages reference their reflected type\n ctor.$type = ctor.prototype.$type = this;\n\n // Mix in static methods\n util.merge(ctor, Message, true);\n\n this._ctor = ctor;\n\n // Messages have non-enumerable default values on their prototype\n var i = 0;\n for (; i < /* initializes */ this.fieldsArray.length; ++i)\n this._fieldsArray[i].resolve(); // ensures a proper value\n\n // Messages have non-enumerable getters and setters for each virtual oneof field\n var ctorProperties = {};\n for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i)\n ctorProperties[this._oneofsArray[i].resolve().name] = {\n get: util.oneOfGetter(this._oneofsArray[i].oneof),\n set: util.oneOfSetter(this._oneofsArray[i].oneof)\n };\n if (i)\n Object.defineProperties(ctor.prototype, ctorProperties);\n }\n }\n});\n\n/**\n * Generates a constructor function for the specified type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nType.generateConstructor = function generateConstructor(mtype) {\n /* eslint-disable no-unexpected-multiline */\n var gen = util.codegen([\"p\"], mtype.name);\n // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype\n for (var i = 0, field; i < mtype.fieldsArray.length; ++i)\n if ((field = mtype._fieldsArray[i]).map) gen\n (\"this%s={}\", util.safeProp(field.name));\n else if (field.repeated) gen\n (\"this%s=[]\", util.safeProp(field.name));\n return gen\n (\"if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors\n * @property {Object.} fields Field descriptors\n * @property {number[][]} [extensions] Extension ranges\n * @property {number[][]} [reserved] Reserved ranges\n * @property {boolean} [group=false] Whether a legacy group or not\n */\n\n/**\n * Creates a message type from a message type descriptor.\n * @param {string} name Message name\n * @param {IType} json Message type descriptor\n * @returns {Type} Created message type\n */\nType.fromJSON = function fromJSON(name, json) {\n var type = new Type(name, json.options);\n type.extensions = json.extensions;\n type.reserved = json.reserved;\n var names = Object.keys(json.fields),\n i = 0;\n for (; i < names.length; ++i)\n type.add(\n ( typeof json.fields[names[i]].keyType !== \"undefined\"\n ? MapField.fromJSON\n : Field.fromJSON )(names[i], json.fields[names[i]])\n );\n if (json.oneofs)\n for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)\n type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));\n if (json.nested)\n for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {\n var nested = json.nested[names[i]];\n type.add( // most to least likely\n ( nested.id !== undefined\n ? Field.fromJSON\n : nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n if (json.extensions && json.extensions.length)\n type.extensions = json.extensions;\n if (json.reserved && json.reserved.length)\n type.reserved = json.reserved;\n if (json.group)\n type.group = true;\n if (json.comment)\n type.comment = json.comment;\n return type;\n};\n\n/**\n * Converts this message type to a message type descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IType} Message type descriptor\n */\nType.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"oneofs\" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),\n \"fields\" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {},\n \"extensions\" , this.extensions && this.extensions.length ? this.extensions : undefined,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"group\" , this.group || undefined,\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nType.prototype.resolveAll = function resolveAll() {\n var fields = this.fieldsArray, i = 0;\n while (i < fields.length)\n fields[i++].resolve();\n var oneofs = this.oneofsArray; i = 0;\n while (i < oneofs.length)\n oneofs[i++].resolve();\n return Namespace.prototype.resolveAll.call(this);\n};\n\n/**\n * @override\n */\nType.prototype.get = function get(name) {\n return this.fields[name]\n || this.oneofs && this.oneofs[name]\n || this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Adds a nested object to this type.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id\n */\nType.prototype.add = function add(object) {\n\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Field && object.extend === undefined) {\n // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects.\n // The root object takes care of adding distinct sister-fields to the respective extended\n // type instead.\n\n // avoids calling the getter if not absolutely necessary because it's called quite frequently\n if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id])\n throw Error(\"duplicate id \" + object.id + \" in \" + this);\n if (this.isReservedId(object.id))\n throw Error(\"id \" + object.id + \" is reserved in \" + this);\n if (this.isReservedName(object.name))\n throw Error(\"name '\" + object.name + \"' is reserved in \" + this);\n\n if (object.parent)\n object.parent.remove(object);\n this.fields[object.name] = object;\n object.message = this;\n object.onAdd(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n if (!this.oneofs)\n this.oneofs = {};\n this.oneofs[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * Removes a nested object from this type.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this type\n */\nType.prototype.remove = function remove(object) {\n if (object instanceof Field && object.extend === undefined) {\n // See Type#add for the reason why extension fields are excluded here.\n\n /* istanbul ignore if */\n if (!this.fields || this.fields[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.fields[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n\n /* istanbul ignore if */\n if (!this.oneofs || this.oneofs[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.oneofs[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message<{}>} Message instance\n */\nType.prototype.create = function create(properties) {\n return new this.ctor(properties);\n};\n\n/**\n * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.\n * @returns {Type} `this`\n */\nType.prototype.setup = function setup() {\n // Sets up everything at once so that the prototype chain does not have to be re-evaluated\n // multiple times (V8, soft-deopt prototype-check).\n\n var fullName = this.fullName,\n types = [];\n for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i)\n types.push(this._fieldsArray[i].resolve().resolvedType);\n\n // Replace setup methods with type-specific generated functions\n this.encode = encoder(this)({\n Writer : Writer,\n types : types,\n util : util\n });\n this.decode = decoder(this)({\n Reader : Reader,\n types : types,\n util : util\n });\n this.verify = verifier(this)({\n types : types,\n util : util\n });\n this.fromObject = converter.fromObject(this)({\n types : types,\n util : util\n });\n this.toObject = converter.toObject(this)({\n types : types,\n util : util\n });\n\n // Inject custom wrappers for common types\n var wrapper = wrappers[fullName];\n if (wrapper) {\n var originalThis = Object.create(this);\n // if (wrapper.fromObject) {\n originalThis.fromObject = this.fromObject;\n this.fromObject = wrapper.fromObject.bind(originalThis);\n // }\n // if (wrapper.toObject) {\n originalThis.toObject = this.toObject;\n this.toObject = wrapper.toObject.bind(originalThis);\n // }\n }\n\n return this;\n};\n\n/**\n * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encode = function encode_setup(message, writer) {\n return this.setup().encode(message, writer); // overrides this method\n};\n\n/**\n * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();\n};\n\n/**\n * Decodes a message of this type.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Length of the message, if known beforehand\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError<{}>} If required fields are missing\n */\nType.prototype.decode = function decode_setup(reader, length) {\n return this.setup().decode(reader, length); // overrides this method\n};\n\n/**\n * Decodes a message of this type preceeded by its byte length as a varint.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError} If required fields are missing\n */\nType.prototype.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof Reader))\n reader = Reader.create(reader);\n return this.decode(reader, reader.uint32());\n};\n\n/**\n * Verifies that field values are valid and that required fields are present.\n * @param {Object.} message Plain object to verify\n * @returns {null|string} `null` if valid, otherwise the reason why it is not\n */\nType.prototype.verify = function verify_setup(message) {\n return this.setup().verify(message); // overrides this method\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object to convert\n * @returns {Message<{}>} Message instance\n */\nType.prototype.fromObject = function fromObject(object) {\n return this.setup().fromObject(object);\n};\n\n/**\n * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.\n * @interface IConversionOptions\n * @property {Function} [longs] Long conversion type.\n * Valid values are `String` and `Number` (the global types).\n * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.\n * @property {Function} [enums] Enum value conversion type.\n * Only valid value is `String` (the global type).\n * Defaults to copy the present value, which is the numeric id.\n * @property {Function} [bytes] Bytes value conversion type.\n * Valid values are `Array` and (a base64 encoded) `String` (the global types).\n * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser.\n * @property {boolean} [defaults=false] Also sets default values on the resulting object\n * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false`\n * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false`\n * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any\n * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings\n */\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\nType.prototype.toObject = function toObject(message, options) {\n return this.setup().toObject(message, options);\n};\n\n/**\n * Decorator function as returned by {@link Type.d} (TypeScript).\n * @typedef TypeDecorator\n * @type {function}\n * @param {Constructor} target Target constructor\n * @returns {undefined}\n * @template T extends Message\n */\n\n/**\n * Type decorator (TypeScript).\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {TypeDecorator} Decorator function\n * @template T extends Message\n */\nType.d = function decorateType(typeName) {\n return function typeDecorator(target) {\n util.decorateType(target, typeName);\n };\n};\n","\"use strict\";\n\n/**\n * Common type constants.\n * @namespace\n */\nvar types = exports;\n\nvar util = require(33);\n\nvar s = [\n \"double\", // 0\n \"float\", // 1\n \"int32\", // 2\n \"uint32\", // 3\n \"sint32\", // 4\n \"fixed32\", // 5\n \"sfixed32\", // 6\n \"int64\", // 7\n \"uint64\", // 8\n \"sint64\", // 9\n \"fixed64\", // 10\n \"sfixed64\", // 11\n \"bool\", // 12\n \"string\", // 13\n \"bytes\" // 14\n];\n\nfunction bake(values, offset) {\n var i = 0, o = {};\n offset |= 0;\n while (i < values.length) o[s[i + offset]] = values[i++];\n return o;\n}\n\n/**\n * Basic type wire types.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n * @property {number} bytes=2 Ldelim wire type\n */\ntypes.basic = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2,\n /* bytes */ 2\n]);\n\n/**\n * Basic type defaults.\n * @type {Object.}\n * @const\n * @property {number} double=0 Double default\n * @property {number} float=0 Float default\n * @property {number} int32=0 Int32 default\n * @property {number} uint32=0 Uint32 default\n * @property {number} sint32=0 Sint32 default\n * @property {number} fixed32=0 Fixed32 default\n * @property {number} sfixed32=0 Sfixed32 default\n * @property {number} int64=0 Int64 default\n * @property {number} uint64=0 Uint64 default\n * @property {number} sint64=0 Sint32 default\n * @property {number} fixed64=0 Fixed64 default\n * @property {number} sfixed64=0 Sfixed64 default\n * @property {boolean} bool=false Bool default\n * @property {string} string=\"\" String default\n * @property {Array.} bytes=Array(0) Bytes default\n * @property {null} message=null Message default\n */\ntypes.defaults = bake([\n /* double */ 0,\n /* float */ 0,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 0,\n /* sfixed32 */ 0,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 0,\n /* sfixed64 */ 0,\n /* bool */ false,\n /* string */ \"\",\n /* bytes */ util.emptyArray,\n /* message */ null\n]);\n\n/**\n * Basic long type wire types.\n * @type {Object.}\n * @const\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n */\ntypes.long = bake([\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1\n], 7);\n\n/**\n * Allowed types for map keys with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n */\ntypes.mapKey = bake([\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2\n], 2);\n\n/**\n * Allowed types for packed repeated fields with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n */\ntypes.packed = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0\n]);\n","\"use strict\";\n\n/**\n * Various utility functions.\n * @namespace\n */\nvar util = module.exports = require(35);\n\nvar roots = require(27);\n\nvar Type, // cyclic\n Enum;\n\nutil.codegen = require(3);\nutil.fetch = require(5);\nutil.path = require(8);\n\n/**\n * Node's fs module if available.\n * @type {Object.}\n */\nutil.fs = util.inquire(\"fs\");\n\n/**\n * Converts an object's values to an array.\n * @param {Object.} object Object to convert\n * @returns {Array.<*>} Converted array\n */\nutil.toArray = function toArray(object) {\n if (object) {\n var keys = Object.keys(object),\n array = new Array(keys.length),\n index = 0;\n while (index < keys.length)\n array[index] = object[keys[index++]];\n return array;\n }\n return [];\n};\n\n/**\n * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.\n * @param {Array.<*>} array Array to convert\n * @returns {Object.} Converted object\n */\nutil.toObject = function toObject(array) {\n var object = {},\n index = 0;\n while (index < array.length) {\n var key = array[index++],\n val = array[index++];\n if (val !== undefined)\n object[key] = val;\n }\n return object;\n};\n\nvar safePropBackslashRe = /\\\\/g,\n safePropQuoteRe = /\"/g;\n\n/**\n * Tests whether the specified name is a reserved word in JS.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nutil.isReserved = function isReserved(name) {\n return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);\n};\n\n/**\n * Returns a safe property accessor for the specified property name.\n * @param {string} prop Property name\n * @returns {string} Safe accessor\n */\nutil.safeProp = function safeProp(prop) {\n if (!/^[$\\w_]+$/.test(prop) || util.isReserved(prop))\n return \"[\\\"\" + prop.replace(safePropBackslashRe, \"\\\\\\\\\").replace(safePropQuoteRe, \"\\\\\\\"\") + \"\\\"]\";\n return \".\" + prop;\n};\n\n/**\n * Converts the first character of a string to upper case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.ucFirst = function ucFirst(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nvar camelCaseRe = /_([a-z])/g;\n\n/**\n * Converts a string to camel case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.camelCase = function camelCase(str) {\n return str.substring(0, 1)\n + str.substring(1)\n .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });\n};\n\n/**\n * Compares reflected fields by id.\n * @param {Field} a First field\n * @param {Field} b Second field\n * @returns {number} Comparison value\n */\nutil.compareFieldsById = function compareFieldsById(a, b) {\n return a.id - b.id;\n};\n\n/**\n * Decorator helper for types (TypeScript).\n * @param {Constructor} ctor Constructor function\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {Type} Reflected type\n * @template T extends Message\n * @property {Root} root Decorators root\n */\nutil.decorateType = function decorateType(ctor, typeName) {\n\n /* istanbul ignore if */\n if (ctor.$type) {\n if (typeName && ctor.$type.name !== typeName) {\n util.decorateRoot.remove(ctor.$type);\n ctor.$type.name = typeName;\n util.decorateRoot.add(ctor.$type);\n }\n return ctor.$type;\n }\n\n /* istanbul ignore next */\n if (!Type)\n Type = require(31);\n\n var type = new Type(typeName || ctor.name);\n util.decorateRoot.add(type);\n type.ctor = ctor; // sets up .encode, .decode etc.\n Object.defineProperty(ctor, \"$type\", { value: type, enumerable: false });\n Object.defineProperty(ctor.prototype, \"$type\", { value: type, enumerable: false });\n return type;\n};\n\nvar decorateEnumIndex = 0;\n\n/**\n * Decorator helper for enums (TypeScript).\n * @param {Object} object Enum object\n * @returns {Enum} Reflected enum\n */\nutil.decorateEnum = function decorateEnum(object) {\n\n /* istanbul ignore if */\n if (object.$type)\n return object.$type;\n\n /* istanbul ignore next */\n if (!Enum)\n Enum = require(14);\n\n var enm = new Enum(\"Enum\" + decorateEnumIndex++, object);\n util.decorateRoot.add(enm);\n Object.defineProperty(object, \"$type\", { value: enm, enumerable: false });\n return enm;\n};\n\n\n/**\n * Sets the value of a property by property path. If a value already exists, it is turned to an array\n * @param {Object.} dst Destination object\n * @param {string} path dot '.' delimited path of the property to set\n * @param {Object} value the value to set\n * @returns {Object.} Destination object\n */\nutil.setProperty = function setProperty(dst, path, value) {\n function setProp(dst, path, value) {\n var part = path.shift();\n if (path.length > 0) {\n dst[part] = setProp(dst[part] || {}, path, value);\n } else {\n var prevValue = dst[part];\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n dst[part] = value;\n }\n return dst;\n }\n\n if (typeof dst !== \"object\")\n throw TypeError(\"dst must be an object\");\n if (!path)\n throw TypeError(\"path must be specified\");\n\n path = path.split(\".\");\n return setProp(dst, path, value);\n};\n\n/**\n * Decorator root (TypeScript).\n * @name util.decorateRoot\n * @type {Root}\n * @readonly\n */\nObject.defineProperty(util, \"decorateRoot\", {\n get: function() {\n return roots[\"decorated\"] || (roots[\"decorated\"] = new (require(26))());\n }\n});\n","\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(35);\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n","\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(1);\n\n// converts to / from base64 encoded strings\nutil.base64 = require(2);\n\n// base class of rpc.Service\nutil.EventEmitter = require(4);\n\n// float handling accross browsers\nutil.float = require(6);\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(7);\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(10);\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(9);\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(34);\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n","\"use strict\";\nmodule.exports = verifier;\n\nvar Enum = require(14),\n util = require(33);\n\nfunction invalid(field, expected) {\n return field.name + \": \" + expected + (field.repeated && expected !== \"array\" ? \"[]\" : field.map && expected !== \"object\" ? \"{k:\"+field.keyType+\"}\" : \"\") + \" expected\";\n}\n\n/**\n * Generates a partial value verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyValue(gen, field, fieldIndex, ref) {\n /* eslint-disable no-unexpected-multiline */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(%s){\", ref)\n (\"default:\")\n (\"return%j\", invalid(field, \"enum value\"));\n for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen\n (\"case %i:\", field.resolvedType.values[keys[j]]);\n gen\n (\"break\")\n (\"}\");\n } else {\n gen\n (\"{\")\n (\"var e=types[%i].verify(%s);\", fieldIndex, ref)\n (\"if(e)\")\n (\"return%j+e\", field.name + \".\")\n (\"}\");\n }\n } else {\n switch (field.type) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.isInteger(%s))\", ref)\n (\"return%j\", invalid(field, \"integer\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))\", ref, ref, ref, ref)\n (\"return%j\", invalid(field, \"integer|Long\"));\n break;\n case \"float\":\n case \"double\": gen\n (\"if(typeof %s!==\\\"number\\\")\", ref)\n (\"return%j\", invalid(field, \"number\"));\n break;\n case \"bool\": gen\n (\"if(typeof %s!==\\\"boolean\\\")\", ref)\n (\"return%j\", invalid(field, \"boolean\"));\n break;\n case \"string\": gen\n (\"if(!util.isString(%s))\", ref)\n (\"return%j\", invalid(field, \"string\"));\n break;\n case \"bytes\": gen\n (\"if(!(%s&&typeof %s.length===\\\"number\\\"||util.isString(%s)))\", ref, ref, ref)\n (\"return%j\", invalid(field, \"buffer\"));\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a partial key verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyKey(gen, field, ref) {\n /* eslint-disable no-unexpected-multiline */\n switch (field.keyType) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.key32Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"integer key\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.key64Re.test(%s))\", ref) // see comment above: x is ok, d is not\n (\"return%j\", invalid(field, \"integer|Long key\"));\n break;\n case \"bool\": gen\n (\"if(!util.key2Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"boolean key\"));\n break;\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a verifier specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction verifier(mtype) {\n /* eslint-disable no-unexpected-multiline */\n\n var gen = util.codegen([\"m\"], mtype.name + \"$verify\")\n (\"if(typeof m!==\\\"object\\\"||m===null)\")\n (\"return%j\", \"object expected\");\n var oneofs = mtype.oneofsArray,\n seenFirstField = {};\n if (oneofs.length) gen\n (\"var p={}\");\n\n for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n ref = \"m\" + util.safeProp(field.name);\n\n if (field.optional) gen\n (\"if(%s!=null&&m.hasOwnProperty(%j)){\", ref, field.name); // !== undefined && !== null\n\n // map fields\n if (field.map) { gen\n (\"if(!util.isObject(%s))\", ref)\n (\"return%j\", invalid(field, \"object\"))\n (\"var k=Object.keys(%s)\", ref)\n (\"for(var i=0;i}\n * @const\n */\nvar wrappers = exports;\n\nvar Message = require(19);\n\n/**\n * From object converter part of an {@link IWrapper}.\n * @typedef WrapperFromObjectConverter\n * @type {function}\n * @param {Object.} object Plain object\n * @returns {Message<{}>} Message instance\n * @this Type\n */\n\n/**\n * To object converter part of an {@link IWrapper}.\n * @typedef WrapperToObjectConverter\n * @type {function}\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @this Type\n */\n\n/**\n * Common type wrapper part of {@link wrappers}.\n * @interface IWrapper\n * @property {WrapperFromObjectConverter} [fromObject] From object converter\n * @property {WrapperToObjectConverter} [toObject] To object converter\n */\n\n// Custom wrapper for Any\nwrappers[\".google.protobuf.Any\"] = {\n\n fromObject: function(object) {\n\n // unwrap value type if mapped\n if (object && object[\"@type\"]) {\n // Only use fully qualified type name after the last '/'\n var name = object[\"@type\"].substring(object[\"@type\"].lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type) {\n // type_url does not accept leading \".\"\n var type_url = object[\"@type\"].charAt(0) === \".\" ?\n object[\"@type\"].substr(1) : object[\"@type\"];\n // type_url prefix is optional, but path seperator is required\n if (type_url.indexOf(\"/\") === -1) {\n type_url = \"/\" + type_url;\n }\n return this.create({\n type_url: type_url,\n value: type.encode(type.fromObject(object)).finish()\n });\n }\n }\n\n return this.fromObject(object);\n },\n\n toObject: function(message, options) {\n\n // Default prefix\n var googleApi = \"type.googleapis.com/\";\n var prefix = \"\";\n var name = \"\";\n\n // decode value if requested and unmapped\n if (options && options.json && message.type_url && message.value) {\n // Only use fully qualified type name after the last '/'\n name = message.type_url.substring(message.type_url.lastIndexOf(\"/\") + 1);\n // Separate the prefix used\n prefix = message.type_url.substring(0, message.type_url.lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type)\n message = type.decode(message.value);\n }\n\n // wrap value if unmapped\n if (!(message instanceof this.ctor) && message instanceof Message) {\n var object = message.$type.toObject(message, options);\n var messageName = message.$type.fullName[0] === \".\" ?\n message.$type.fullName.substr(1) : message.$type.fullName;\n // Default to type.googleapis.com prefix if no prefix is used\n if (prefix === \"\") {\n prefix = googleApi;\n }\n name = prefix + messageName;\n object[\"@type\"] = name;\n return object;\n }\n\n return this.toObject(message, options);\n }\n};\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(35);\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(38);\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(35);\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n"],"sourceRoot":"."} \ No newline at end of file diff --git a/node_modules/protobufjs/dist/light/protobuf.min.js b/node_modules/protobufjs/dist/light/protobuf.min.js deleted file mode 100644 index cefb63dc..00000000 --- a/node_modules/protobufjs/dist/light/protobuf.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * protobuf.js v6.10.0 (c) 2016, daniel wirtz - * compiled wed, 15 jul 2020 23:34:14 utc - * licensed under the bsd-3-clause license - * see: https://github.com/dcodeio/protobuf.js for details - */ -!function(g){"use strict";var r,e,t,i;r={1:[function(t,i){i.exports=function(t,i){var n=Array(arguments.length-1),s=0,r=2,u=!0;for(;r>2],r=(3&f)<<4,o=1;break;case 1:s[u++]=h[r|f>>4],r=(15&f)<<2,o=2;break;case 2:s[u++]=h[r|f>>6],s[u++]=h[63&f],o=0}8191>4,r=o,s=2;break;case 2:i[n++]=(15&r)<<4|(60&o)>>2,r=o,s=3;break;case 3:i[n++]=(3&r)<<6|o,s=0}}if(1===s)throw Error(c);return n-e},r.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},{}],3:[function(t,i){function a(i,n){"string"==typeof i&&(n=i,i=g);var f=[];function h(t){if("string"!=typeof t){var i=c();if(a.verbose&&console.log("codegen: "+i),i="return "+i,t){for(var n=Object.keys(t),r=Array(n.length+1),e=Array(n.length),s=0;s>>0,n,r);else if(i<11754943508222875e-54)t((e<<31|Math.round(i/1401298464324817e-60))>>>0,n,r);else{var s=Math.floor(Math.log(i)/Math.LN2);t((e<<31|127+s<<23|8388607&Math.round(i*Math.pow(2,-s)*8388608))>>>0,n,r)}}function n(t,i,n){var r=t(i,n),e=2*(r>>31)+1,s=r>>>23&255,u=8388607&r;return 255==s?u?NaN:1/0*e:0==s?1401298464324817e-60*e*u:e*Math.pow(2,s-150)*(8388608+u)}function r(t,i,n){o[0]=t,i[n]=f[0],i[n+1]=f[1],i[n+2]=f[2],i[n+3]=f[3]}function e(t,i,n){o[0]=t,i[n]=f[3],i[n+1]=f[2],i[n+2]=f[1],i[n+3]=f[0]}function s(t,i){return f[0]=t[i],f[1]=t[i+1],f[2]=t[i+2],f[3]=t[i+3],o[0]}function u(t,i){return f[3]=t[i],f[2]=t[i+1],f[1]=t[i+2],f[0]=t[i+3],o[0]}var o,f,h,c,a,l;function v(t,i,n,r,e,s){var u=r<0?1:0;if(u&&(r=-r),0===r)t(0,e,s+i),t(0<1/r?0:2147483648,e,s+n);else if(isNaN(r))t(0,e,s+i),t(2146959360,e,s+n);else if(17976931348623157e292>>0,e,s+n);else{var o;if(r<22250738585072014e-324)t((o=r/5e-324)>>>0,e,s+i),t((u<<31|o/4294967296)>>>0,e,s+n);else{var f=Math.floor(Math.log(r)/Math.LN2);1024===f&&(f=1023),t(4503599627370496*(o=r*Math.pow(2,-f))>>>0,e,s+i),t((u<<31|f+1023<<20|1048576*o&1048575)>>>0,e,s+n)}}}function d(t,i,n,r,e){var s=t(r,e+i),u=t(r,e+n),o=2*(u>>31)+1,f=u>>>20&2047,h=4294967296*(1048575&u)+s;return 2047==f?h?NaN:1/0*o:0==f?5e-324*o*h:o*Math.pow(2,f-1075)*(h+4503599627370496)}function b(t,i,n){c[0]=t,i[n]=a[0],i[n+1]=a[1],i[n+2]=a[2],i[n+3]=a[3],i[n+4]=a[4],i[n+5]=a[5],i[n+6]=a[6],i[n+7]=a[7]}function y(t,i,n){c[0]=t,i[n]=a[7],i[n+1]=a[6],i[n+2]=a[5],i[n+3]=a[4],i[n+4]=a[3],i[n+5]=a[2],i[n+6]=a[1],i[n+7]=a[0]}function p(t,i){return a[0]=t[i],a[1]=t[i+1],a[2]=t[i+2],a[3]=t[i+3],a[4]=t[i+4],a[5]=t[i+5],a[6]=t[i+6],a[7]=t[i+7],c[0]}function m(t,i){return a[7]=t[i],a[6]=t[i+1],a[5]=t[i+2],a[4]=t[i+3],a[3]=t[i+4],a[2]=t[i+5],a[1]=t[i+6],a[0]=t[i+7],c[0]}return"undefined"!=typeof Float32Array?(o=new Float32Array([-0]),f=new Uint8Array(o.buffer),h=128===f[3],t.writeFloatLE=h?r:e,t.writeFloatBE=h?e:r,t.readFloatLE=h?s:u,t.readFloatBE=h?u:s):(t.writeFloatLE=i.bind(null,w),t.writeFloatBE=i.bind(null,g),t.readFloatLE=n.bind(null,j),t.readFloatBE=n.bind(null,k)),"undefined"!=typeof Float64Array?(c=new Float64Array([-0]),a=new Uint8Array(c.buffer),l=128===a[7],t.writeDoubleLE=l?b:y,t.writeDoubleBE=l?y:b,t.readDoubleLE=l?p:m,t.readDoubleBE=l?m:p):(t.writeDoubleLE=v.bind(null,w,0,4),t.writeDoubleBE=v.bind(null,g,4,0),t.readDoubleLE=d.bind(null,j,0,4),t.readDoubleBE=d.bind(null,k,4,0)),t}function w(t,i,n){i[n]=255&t,i[n+1]=t>>>8&255,i[n+2]=t>>>16&255,i[n+3]=t>>>24}function g(t,i,n){i[n]=t>>>24,i[n+1]=t>>>16&255,i[n+2]=t>>>8&255,i[n+3]=255&t}function j(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16|t[i+3]<<24)>>>0}function k(t,i){return(t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3])>>>0}i.exports=n(n)},{}],7:[function(t,i,n){function r(t){try{var i=eval("require")(t);if(i&&(i.length||Object.keys(i).length))return i}catch(t){}return null}i.exports=r},{}],8:[function(t,i,n){var r=n,s=r.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},e=r.normalize=function(t){var i=(t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=s(t),r="";n&&(r=i.shift()+"/");for(var e=0;e>>1,u=null,o=e;return function(t){if(t<1||s>10),s[u++]=56320+(1023&r)):s[u++]=(15&r)<<12|(63&t[i++])<<6|63&t[i++],8191>6|192:(55296==(64512&r)&&56320==(64512&(e=t.charCodeAt(u+1)))?(r=65536+((1023&r)<<10)+(1023&e),++u,i[n++]=r>>18|240,i[n++]=r>>12&63|128):i[n++]=r>>12|224,i[n++]=r>>6&63|128),i[n++]=63&r|128);return n-s}},{}],11:[function(t,i,n){var r=n,l=t(14),v=t(33);function u(t,i,n,r){if(i.resolvedType)if(i.resolvedType instanceof l){t("switch(d%s){",r);for(var e=i.resolvedType.values,s=Object.keys(e),u=0;u>>0",r,r);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",r,r);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",r,r,o)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,o?"true":"");break;case"bytes":t('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length)",r)("m%s=d%s",r,r);break;case"string":t("m%s=String(d%s)",r,r);break;case"bool":t("m%s=Boolean(d%s)",r,r)}}return t}function d(t,i,n,r){if(i.resolvedType)i.resolvedType instanceof l?t("d%s=o.enums===String?types[%i].values[m%s]:m%s",r,n,r,r):t("d%s=types[%i].toObject(m%s,o)",r,n,r);else{var e=!1;switch(i.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":e=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,r,r,r,e?"true":"",r);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,r,r,r,r);break;default:t("d%s=m%s",r,r)}}return t}r.fromObject=function(t){var i=t.fieldsArray,n=v.codegen(["d"],t.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!i.length)return n("return new this.ctor");n("var m=new this.ctor");for(var r=0;r>>3){");for(var n=0;n>>3){")("case 1: k=r.%s(); break",r.keyType)("case 2:"),f.basic[e]===g?i("value=types[%i].decode(r,r.uint32())",n):i("value=r.%s()",e),i("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),f.long[r.keyType]!==g?i('%s[typeof k==="object"?util.longToHash(k):k]=value',s):i("%s[k]=value",s)):r.repeated?(i("if(!(%s&&%s.length))",s,s)("%s=[]",s),f.packed[e]!==g&&i("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0,8|c.mapKey[s.keyType],s.keyType),f===g?n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,i):n(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|f,o,i),n("}")("}")):s.repeated?(n("if(%s!=null&&%s.length){",i,i),s.packed&&c.packed[o]!==g?n("w.uint32(%i).fork()",(s.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",o,i)("w.ldelim()"):(n("for(var i=0;i<%s.length;++i)",i),f===g?l(n,s,u,i+"[i]"):n("w.uint32(%i).%s(%s[i])",(s.id<<3|f)>>>0,o,i)),n("}")):(s.optional&&n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,s.name),f===g?l(n,s,u,i):n("w.uint32(%i).%s(%s)",(s.id<<3|f)>>>0,o,i))}return n("return w")};var h=t(14),c=t(32),a=t(33);function l(t,i,n,r){return i.resolvedType.group?t("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",n,r,(i.id<<3|3)>>>0,(i.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",n,r,(i.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(t,i){i.exports=e;var o=t(22);((e.prototype=Object.create(o.prototype)).constructor=e).className="Enum";var n=t(21),r=t(33);function e(t,i,n,r,e){if(o.call(this,t,n),i&&"object"!=typeof i)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=r,this.comments=e||{},this.reserved=g,i)for(var s=Object.keys(i),u=0;ui)return!0;return!1},h.isReservedName=function(t,i){if(t)for(var n=0;n "+t.len)}function o(t){this.buf=t,this.pos=0,this.len=t.length}function f(){return r.Buffer?function(t){return(o.create=function(t){return r.Buffer.isBuffer(t)?new n(t):c(t)})(t)}:c}var h,c="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new o(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new o(t);throw Error("illegal buffer")};function a(){var t=new e(0,0),i=0;if(!(4=this.len)throw u(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(i=0,4>>0,this.buf[this.pos++]<128)return t}else for(;i<5;++i){if(this.pos>=this.len)throw u(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function l(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function v(){if(this.pos+8>this.len)throw u(this,8);return new e(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}o.create=f(),o.prototype.f=r.Array.prototype.subarray||r.Array.prototype.slice,o.prototype.uint32=(h=4294967295,function(){if(h=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return h;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return h}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},o.prototype.bool=function(){return 0!==this.uint32()},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return l(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return 0|l(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var t=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},o.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var t=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},o.prototype.bytes=function(){var t=this.uint32(),i=this.pos,n=this.pos+t;if(n>this.len)throw u(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,n):i===n?new this.buf.constructor(0):this.f.call(this.buf,i,n)},o.prototype.string=function(){var t=this.bytes();return s.read(t,0,t.length)},o.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw u(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw u(this)}while(128&this.buf[this.pos++]);return this},o.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},o.r=function(t){n=t,o.create=f(),n.r();var i=r.Long?"toLong":"toNumber";r.merge(o.prototype,{int64:function(){return a.call(this)[i](!1)},uint64:function(){return a.call(this)[i](!0)},sint64:function(){return a.call(this).zzDecode()[i](!1)},fixed64:function(){return v.call(this)[i](!0)},sfixed64:function(){return v.call(this)[i](!1)}})}},{35:35}],25:[function(t,i){i.exports=e;var n=t(24);(e.prototype=Object.create(n.prototype)).constructor=e;var r=t(35);function e(t){n.call(this,t)}e.r=function(){r.Buffer&&(e.prototype.f=r.Buffer.prototype.slice)},e.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},e.r()},{24:24,35:35}],26:[function(t,i){i.exports=n;var r=t(21);((n.prototype=Object.create(r.prototype)).constructor=n).className="Root";var e,v,d,s=t(15),u=t(14),o=t(23),b=t(33);function n(t){r.call(this,"",t),this.deferred=[],this.files=[]}function y(){}n.fromJSON=function(t,i){return i=i||new n,t.options&&i.setOptions(t.options),i.addJSON(t.nested)},n.prototype.resolvePath=b.path.resolve,n.prototype.fetch=b.fetch,n.prototype.load=function t(i,s,e){"function"==typeof s&&(e=s,s=g);var u=this;if(!e)return b.asPromise(t,u,i,s);var o=e===y;function f(t,i){if(e){var n=e;if(e=null,o)throw t;n(t,i)}}function h(t){var i=t.lastIndexOf("google/protobuf/");if(-1>>0,this.hi=i>>>0}var s=e.zero=new e(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var r=e.zeroHash="\0\0\0\0\0\0\0\0";e.fromNumber=function(t){if(0===t)return s;var i=t<0;i&&(t=-t);var n=t>>>0,r=(t-n)/4294967296>>>0;return i&&(r=~r>>>0,n=~n>>>0,4294967295<++n&&(n=0,4294967295<++r&&(r=0))),new e(n,r)},e.from=function(t){if("number"==typeof t)return e.fromNumber(t);if(n.isString(t)){if(!n.Long)return e.fromNumber(parseInt(t,10));t=n.Long.fromString(t)}return t.low||t.high?new e(t.low>>>0,t.high>>>0):s},e.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var i=1+~this.lo>>>0,n=~this.hi>>>0;return i||(n=n+1>>>0),-(i+4294967296*n)}return this.lo+4294967296*this.hi},e.prototype.toLong=function(t){return n.Long?new n.Long(0|this.lo,0|this.hi,!!t):{low:0|this.lo,high:0|this.hi,unsigned:!!t}};var u=String.prototype.charCodeAt;e.fromHash=function(t){return t===r?s:new e((u.call(t,0)|u.call(t,1)<<8|u.call(t,2)<<16|u.call(t,3)<<24)>>>0,(u.call(t,4)|u.call(t,5)<<8|u.call(t,6)<<16|u.call(t,7)<<24)>>>0)},e.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},e.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},e.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},e.prototype.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0==n?0==i?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}},{35:35}],35:[function(t,i,n){var r=n;function e(t,i,n){for(var r=Object.keys(i),e=0;e>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;127>>7;i[n++]=t.lo}function b(t,i,n){i[n]=255&t,i[n+1]=t>>>8&255,i[n+2]=t>>>16&255,i[n+3]=t>>>24}c.create=a(),c.alloc=function(t){return new r.Array(t)},r.Array!==Array&&(c.alloc=r.pool(c.alloc,r.Array.prototype.subarray)),c.prototype.y=function(t,i,n){return this.tail=this.tail.next=new o(t,i,n),this.len+=i,this},(v.prototype=Object.create(o.prototype)).fn=function(t,i,n){for(;127>>=7;i[n]=t},c.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new v((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},c.prototype.int32=function(t){return t<0?this.y(d,10,e.fromNumber(t)):this.uint32(t)},c.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},c.prototype.int64=c.prototype.uint64=function(t){var i=e.from(t);return this.y(d,i.length(),i)},c.prototype.sint64=function(t){var i=e.from(t).zzEncode();return this.y(d,i.length(),i)},c.prototype.bool=function(t){return this.y(l,1,t?1:0)},c.prototype.sfixed32=c.prototype.fixed32=function(t){return this.y(b,4,t>>>0)},c.prototype.sfixed64=c.prototype.fixed64=function(t){var i=e.from(t);return this.y(b,4,i.lo).y(b,4,i.hi)},c.prototype.float=function(t){return this.y(r.float.writeFloatLE,4,t)},c.prototype.double=function(t){return this.y(r.float.writeDoubleLE,8,t)};var y=r.Array.prototype.set?function(t,i,n){i.set(t,n)}:function(t,i,n){for(var r=0;r>>0;if(!i)return this.y(l,1,0);if(r.isString(t)){var n=c.alloc(i=s.length(t));s.decode(t,n,0),t=n}return this.uint32(i).y(y,i,t)},c.prototype.string=function(t){var i=u.length(t);return i?this.uint32(i).y(u.write,i,t):this.y(l,1,0)},c.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new o(f,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(f,0,0),this.len=0),this},c.prototype.ldelim=function(){var t=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=i,this.len+=n),this},c.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,i,n),n+=t.len,t=t.next;return i},c.r=function(t){n=t,c.create=a(),n.r()}},{35:35}],39:[function(t,i){i.exports=e;var n=t(38);(e.prototype=Object.create(n.prototype)).constructor=e;var r=t(35);function e(){n.call(this)}function s(t,i,n){t.length<40?r.utf8.write(t,i,n):i.utf8Write?i.utf8Write(t,n):i.write(t,n)}e.r=function(){e.alloc=r.b,e.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(t,i,n){i.set(t,n)}:function(t,i,n){if(t.copy)t.copy(i,n,0,t.length);else for(var r=0;r>>0;return this.uint32(i),i&&this.y(e.writeBytesBuffer,i,t),this},e.prototype.string=function(t){var i=r.Buffer.byteLength(t);return this.uint32(i),i&&this.y(s,i,t),this},e.r()},{35:35,38:38}]},e={},t=[16],i=function t(i){var n=e[i];return n||r[i][0].call(n=e[i]={exports:{}},t,n,n.exports),n.exports}(t[0]),i.util.global.protobuf=i,"function"==typeof define&&define.amd&&define(["long"],function(t){return t&&t.isLong&&(i.util.Long=t,i.configure()),i}),"object"==typeof module&&module&&module.exports&&(module.exports=i)}(); -//# sourceMappingURL=protobuf.min.js.map diff --git a/node_modules/protobufjs/dist/light/protobuf.min.js.map b/node_modules/protobufjs/dist/light/protobuf.min.js.map deleted file mode 100644 index 7b1576dc..00000000 --- a/node_modules/protobufjs/dist/light/protobuf.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["lib/prelude.js","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/codegen/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/fetch/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/path/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/@protobufjs/utf8/index.js","../src/converter.js","../src/decoder.js","../src/encoder.js","../src/enum.js","../src/field.js","../src/index-light","../src/index-minimal.js","../src/mapfield.js","../src/message.js","../src/method.js","../src/namespace.js","../src/object.js","../src/oneof.js","../src/reader.js","../src/reader_buffer.js","../src/root.js","../src/roots.js","../src/rpc.js","../src/rpc/service.js","../src/service.js","../src/type.js","../src/types.js","../src/util.js","../src/util/longbits.js","../src/util/minimal.js","../src/verifier.js","../src/wrappers.js","../src/writer.js","../src/writer_buffer.js"],"names":["undefined","modules","cache","entries","protobuf","1","require","module","exports","fn","ctx","params","Array","arguments","length","offset","index","pending","Promise","resolve","reject","err","apply","base64","string","p","n","Math","ceil","b64","s64","i","encode","buffer","start","end","t","parts","chunk","j","b","push","String","fromCharCode","slice","join","invalidEncoding","decode","c","charCodeAt","Error","test","codegen","functionParams","functionName","body","Codegen","formatStringOrScope","source","toString","verbose","console","log","scopeKeys","Object","keys","scopeParams","scopeValues","scopeOffset","Function","formatParams","formatOffset","replace","$0","$1","value","floor","JSON","stringify","functionNameOverride","EventEmitter","this","_listeners","prototype","on","evt","off","listeners","splice","emit","args","fetch","asPromise","fs","inquire","filename","options","callback","xhr","readFile","contents","XMLHttpRequest","binary","onreadystatechange","readyState","status","response","responseText","Uint8Array","overrideMimeType","responseType","open","send","factory","writeFloat_ieee754","writeUint","val","buf","pos","sign","isNaN","round","exponent","LN2","pow","readFloat_ieee754","readUint","uint","mantissa","NaN","Infinity","writeFloat_f32_cpy","f32","f8b","writeFloat_f32_rev","readFloat_f32_cpy","readFloat_f32_rev","le","f64","writeDouble_ieee754","off0","off1","readDouble_ieee754","lo","hi","writeDouble_f64_cpy","writeDouble_f64_rev","readDouble_f64_cpy","readDouble_f64_rev","Float32Array","writeFloatLE","writeFloatBE","readFloatLE","readFloatBE","bind","writeUintLE","writeUintBE","readUintLE","readUintBE","Float64Array","writeDoubleLE","writeDoubleBE","readDoubleLE","readDoubleBE","moduleName","mod","eval","e","path","isAbsolute","normalize","split","absolute","prefix","shift","originPath","includePath","alreadyNormalized","alloc","size","SIZE","MAX","slab","call","utf8","len","read","write","c1","c2","converter","Enum","util","genValuePartial_fromObject","gen","field","fieldIndex","prop","resolvedType","values","repeated","typeDefault","fullName","isUnsigned","type","genValuePartial_toObject","fromObject","mtype","fields","fieldsArray","name","safeProp","map","toObject","sort","compareFieldsById","repeatedFields","mapFields","normalFields","partOf","valuesById","long","low","high","unsigned","toNumber","bytes","arrayDefault","hasKs2","_fieldsArray","indexOf","filter","group","ref","id","types","defaults","keyType","basic","packed","rfield","required","wireType","mapKey","genTypePartial","optional","ReflectionObject","create","constructor","className","Namespace","comment","comments","TypeError","reserved","fromJSON","json","enm","toJSON","toJSONOptions","keepComments","add","isString","isInteger","isReservedId","isReservedName","allow_alias","remove","Field","Type","ruleRe","rule","extend","isObject","toLowerCase","message","defaultValue","Long","extensionField","declaringField","_packed","defineProperty","get","getOption","setOption","ifNotSet","resolved","parent","lookupTypeOrEnum","fromNumber","freeze","newBuffer","emptyObject","emptyArray","ctor","d","fieldId","fieldType","fieldRule","decorateType","decorateEnum","fieldName","default","_configure","Type_","build","load","root","Root","loadSync","encoder","decoder","verifier","OneOf","MapField","Service","Method","Message","wrappers","configure","Writer","BufferWriter","Reader","BufferReader","rpc","roots","resolvedKeyType","fieldKeyType","fieldValueType","properties","$type","writer","encodeDelimited","reader","decodeDelimited","verify","object","requestType","requestStream","responseStream","resolvedRequestType","resolvedResponseType","lookupType","arrayToJSON","array","obj","nested","_nestedArray","clearCache","namespace","addJSON","toArray","nestedArray","nestedJson","names","methods","getEnum","prev","setOptions","onAdd","onRemove","define","isArray","ptr","part","resolveAll","lookup","filterTypes","parentAlreadyChecked","found","lookupEnum","lookupService","Service_","Enum_","parsedOptions","defineProperties","unshift","_handleAdd","_handleRemove","setParsedOption","propName","opt","find","hasOwnProperty","newValue","setProperty","newOpt","Root_","fieldNames","oneof","addFieldsToParent","oneofName","oneOfGetter","set","oneOfSetter","LongBits","indexOutOfRange","writeLength","RangeError","Buffer","isBuffer","create_array","readLongVarint","bits","readFixed32_end","readFixed64","_slice","subarray","uint32","int32","sint32","bool","fixed32","sfixed32","float","double","skip","skipType","BufferReader_","merge","int64","uint64","sint64","zzDecode","fixed64","sfixed64","utf8Slice","min","parse","common","deferred","files","SYNC","resolvePath","self","sync","finish","cb","getBundledFileName","idx","lastIndexOf","altname","substring","process","parsed","imports","weakImports","queued","weak","setTimeout","readFileSync","isNode","exposeRe","tryHandleExtension","extendedType","sisterField","parse_","common_","rpcImpl","requestDelimited","responseDelimited","rpcCall","method","requestCtor","responseCtor","request","endedByRPC","_methodsArray","service","inherited","methodsArray","rpcService","methodName","lcFirst","isReserved","m","q","s","oneofs","extensions","_fieldsById","_oneofsArray","_ctor","fieldsById","oneofsArray","generateConstructor","ctorProperties","setup","wrapper","originalThis","fork","ldelim","typeName","target","bake","o","key","safePropBackslashRe","safePropQuoteRe","ucFirst","str","toUpperCase","camelCaseRe","camelCase","a","decorateRoot","enumerable","decorateEnumIndex","dst","setProp","prevValue","concat","zero","zzEncode","zeroHash","from","parseInt","fromString","toLong","fromHash","hash","toHash","mask","part0","part1","part2","src","newError","CustomError","captureStackTrace","stack","pool","global","versions","node","window","Number","isFinite","isset","isSet","utf8Write","_Buffer_from","_Buffer_allocUnsafe","sizeOrArray","dcodeIO","key2Re","key32Re","key64Re","longToHash","longFromHash","fromBits","ProtocolError","fieldMap","longs","enums","encoding","allocUnsafe","seenFirstField","invalid","genVerifyKey","genVerifyValue","oneofProp","expected","type_url","substr","Op","next","noop","State","head","tail","states","writeByte","VarintOp","writeVarint64","writeFixed32","_push","writeBytes","reset","BufferWriter_","writeStringBuffer","writeBytesBuffer","copy","byteLength","$require","$module","amd","isLong"],"mappings":";;;;;;CAAA,SAAAA,GAAA,aAAA,IAAAC,EAAAC,EAAAC,EAcAC,EAdAH,EAiCA,CAAAI,EAAA,CAAA,SAAAC,EAAAC,GChCAA,EAAAC,QAmBA,SAAAC,EAAAC,GACA,IAAAC,EAAAC,MAAAC,UAAAC,OAAA,GACAC,EAAA,EACAC,EAAA,EACAC,GAAA,EACA,KAAAD,EAAAH,UAAAC,QACAH,EAAAI,KAAAF,UAAAG,KACA,OAAA,IAAAE,QAAA,SAAAC,EAAAC,GACAT,EAAAI,GAAA,SAAAM,GACA,GAAAJ,EAEA,GADAA,GAAA,EACAI,EACAD,EAAAC,OACA,CAGA,IAFA,IAAAV,EAAAC,MAAAC,UAAAC,OAAA,GACAC,EAAA,EACAA,EAAAJ,EAAAG,QACAH,EAAAI,KAAAF,UAAAE,GACAI,EAAAG,MAAA,KAAAX,KAIA,IACAF,EAAAa,MAAAZ,GAAA,KAAAC,GACA,MAAAU,GACAJ,IACAA,GAAA,EACAG,EAAAC,gCCxCA,IAAAE,EAAAf,EAOAe,EAAAT,OAAA,SAAAU,GACA,IAAAC,EAAAD,EAAAV,OACA,IAAAW,EACA,OAAA,EAEA,IADA,IAAAC,EAAA,EACA,IAAAD,EAAA,GAAA,KAAAD,EAAAA,EAAAC,MACAC,EACA,OAAAC,KAAAC,KAAA,EAAAJ,EAAAV,QAAA,EAAAY,GAUA,IANA,IAAAG,EAAAjB,MAAA,IAGAkB,EAAAlB,MAAA,KAGAmB,EAAA,EAAAA,EAAA,IACAD,EAAAD,EAAAE,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,EAAAA,E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,MAWAgP,EAAAlB,qBvCpFA7S,KAAAC,OAcAC,EAPA,SAAAokB,EAAAtX,GACA,IAAAuX,EAAAvkB,EAAAgN,GAGA,OAFAuX,GACAxkB,EAAAiN,GAAA,GAAA3B,KAAAkZ,EAAAvkB,EAAAgN,GAAA,CAAA1M,QAAA,IAAAgkB,EAAAC,EAAAA,EAAAjkB,SACAikB,EAAAjkB,QAGAgkB,CAAArkB,EAAA,IAGAC,EAAA4L,KAAAoV,OAAAhhB,SAAAA,EAGA,mBAAAqW,QAAAA,OAAAiO,KACAjO,OAAA,CAAA,QAAA,SAAApF,GAKA,OAJAA,GAAAA,EAAAsT,SACAvkB,EAAA4L,KAAAqF,KAAAA,EACAjR,EAAA2T,aAEA3T,IAIA,iBAAAG,QAAAA,QAAAA,OAAAC,UACAD,OAAAC,QAAAJ,GA/BA","file":"protobuf.min.js","sourcesContent":["(function prelude(modules, cache, entries) {\n\n // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS\n // sources through a conflict-free require shim and is again wrapped within an iife that\n // provides a minification-friendly `undefined` var plus a global \"use strict\" directive\n // so that minification can remove the directives of each module.\n\n function $require(name) {\n var $module = cache[name];\n if (!$module)\n modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);\n return $module.exports;\n }\n\n var protobuf = $require(entries[0]);\n\n // Expose globally\n protobuf.util.global.protobuf = protobuf;\n\n // Be nice to AMD\n if (typeof define === \"function\" && define.amd)\n define([\"long\"], function(Long) {\n if (Long && Long.isLong) {\n protobuf.util.Long = Long;\n protobuf.configure();\n }\n return protobuf;\n });\n\n // Be nice to CommonJS\n if (typeof module === \"object\" && module && module.exports)\n module.exports = protobuf;\n\n})/* end of prelude */","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = codegen;\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @param {string[]} functionParams Function parameter names\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n */\r\nfunction codegen(functionParams, functionName) {\r\n\r\n /* istanbul ignore if */\r\n if (typeof functionParams === \"string\") {\r\n functionName = functionParams;\r\n functionParams = undefined;\r\n }\r\n\r\n var body = [];\r\n\r\n /**\r\n * Appends code to the function's body or finishes generation.\r\n * @typedef Codegen\r\n * @type {function}\r\n * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r\n * @param {...*} [formatParams] Format parameters\r\n * @returns {Codegen|Function} Itself or the generated function if finished\r\n * @throws {Error} If format parameter counts do not match\r\n */\r\n\r\n function Codegen(formatStringOrScope) {\r\n // note that explicit array handling below makes this ~50% faster\r\n\r\n // finish the function\r\n if (typeof formatStringOrScope !== \"string\") {\r\n var source = toString();\r\n if (codegen.verbose)\r\n console.log(\"codegen: \" + source); // eslint-disable-line no-console\r\n source = \"return \" + source;\r\n if (formatStringOrScope) {\r\n var scopeKeys = Object.keys(formatStringOrScope),\r\n scopeParams = new Array(scopeKeys.length + 1),\r\n scopeValues = new Array(scopeKeys.length),\r\n scopeOffset = 0;\r\n while (scopeOffset < scopeKeys.length) {\r\n scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r\n scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r\n }\r\n scopeParams[scopeOffset] = source;\r\n return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r\n }\r\n return Function(source)(); // eslint-disable-line no-new-func\r\n }\r\n\r\n // otherwise append to body\r\n var formatParams = new Array(arguments.length - 1),\r\n formatOffset = 0;\r\n while (formatOffset < formatParams.length)\r\n formatParams[formatOffset] = arguments[++formatOffset];\r\n formatOffset = 0;\r\n formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r\n var value = formatParams[formatOffset++];\r\n switch ($1) {\r\n case \"d\": case \"f\": return String(Number(value));\r\n case \"i\": return String(Math.floor(value));\r\n case \"j\": return JSON.stringify(value);\r\n case \"s\": return String(value);\r\n }\r\n return \"%\";\r\n });\r\n if (formatOffset !== formatParams.length)\r\n throw Error(\"parameter count mismatch\");\r\n body.push(formatStringOrScope);\r\n return Codegen;\r\n }\r\n\r\n function toString(functionNameOverride) {\r\n return \"function \" + (functionNameOverride || functionName || \"\") + \"(\" + (functionParams && functionParams.join(\",\") || \"\") + \"){\\n \" + body.join(\"\\n \") + \"\\n}\";\r\n }\r\n\r\n Codegen.toString = toString;\r\n return Codegen;\r\n}\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @function codegen\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * When set to `true`, codegen will log generated code to console. Useful for debugging.\r\n * @name util.codegen.verbose\r\n * @type {boolean}\r\n */\r\ncodegen.verbose = false;\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\nmodule.exports = fetch;\r\n\r\nvar asPromise = require(1),\r\n inquire = require(7);\r\n\r\nvar fs = inquire(\"fs\");\r\n\r\n/**\r\n * Node-style callback as used by {@link util.fetch}.\r\n * @typedef FetchCallback\r\n * @type {function}\r\n * @param {?Error} error Error, if any, otherwise `null`\r\n * @param {string} [contents] File contents, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Options as used by {@link util.fetch}.\r\n * @typedef FetchOptions\r\n * @type {Object}\r\n * @property {boolean} [binary=false] Whether expecting a binary response\r\n * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @memberof util\r\n * @param {string} filename File path or url\r\n * @param {FetchOptions} options Fetch options\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nfunction fetch(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = {};\r\n } else if (!options)\r\n options = {};\r\n\r\n if (!callback)\r\n return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r\n\r\n // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r\n if (!options.xhr && fs && fs.readFile)\r\n return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r\n return err && typeof XMLHttpRequest !== \"undefined\"\r\n ? fetch.xhr(filename, options, callback)\r\n : err\r\n ? callback(err)\r\n : callback(null, options.binary ? contents : contents.toString(\"utf8\"));\r\n });\r\n\r\n // use the XHR version otherwise.\r\n return fetch.xhr(filename, options, callback);\r\n}\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchOptions} [options] Fetch options\r\n * @returns {Promise} Promise\r\n * @variation 3\r\n */\r\n\r\n/**/\r\nfetch.xhr = function fetch_xhr(filename, options, callback) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r\n\r\n if (xhr.readyState !== 4)\r\n return undefined;\r\n\r\n // local cors security errors return status 0 / empty string, too. afaik this cannot be\r\n // reliably distinguished from an actually empty file for security reasons. feel free\r\n // to send a pull request if you are aware of a solution.\r\n if (xhr.status !== 0 && xhr.status !== 200)\r\n return callback(Error(\"status \" + xhr.status));\r\n\r\n // if binary data is expected, make sure that some sort of array is returned, even if\r\n // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r\n if (options.binary) {\r\n var buffer = xhr.response;\r\n if (!buffer) {\r\n buffer = [];\r\n for (var i = 0; i < xhr.responseText.length; ++i)\r\n buffer.push(xhr.responseText.charCodeAt(i) & 255);\r\n }\r\n return callback(null, typeof Uint8Array !== \"undefined\" ? new Uint8Array(buffer) : buffer);\r\n }\r\n return callback(null, xhr.responseText);\r\n };\r\n\r\n if (options.binary) {\r\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r\n if (\"overrideMimeType\" in xhr)\r\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n xhr.open(\"GET\", filename);\r\n xhr.send();\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal path module to resolve Unix, Windows and URL paths alike.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar path = exports;\r\n\r\nvar isAbsolute =\r\n/**\r\n * Tests if the specified path is absolute.\r\n * @param {string} path Path to test\r\n * @returns {boolean} `true` if path is absolute\r\n */\r\npath.isAbsolute = function isAbsolute(path) {\r\n return /^(?:\\/|\\w+:)/.test(path);\r\n};\r\n\r\nvar normalize =\r\n/**\r\n * Normalizes the specified path.\r\n * @param {string} path Path to normalize\r\n * @returns {string} Normalized path\r\n */\r\npath.normalize = function normalize(path) {\r\n path = path.replace(/\\\\/g, \"/\")\r\n .replace(/\\/{2,}/g, \"/\");\r\n var parts = path.split(\"/\"),\r\n absolute = isAbsolute(path),\r\n prefix = \"\";\r\n if (absolute)\r\n prefix = parts.shift() + \"/\";\r\n for (var i = 0; i < parts.length;) {\r\n if (parts[i] === \"..\") {\r\n if (i > 0 && parts[i - 1] !== \"..\")\r\n parts.splice(--i, 2);\r\n else if (absolute)\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n } else if (parts[i] === \".\")\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n return prefix + parts.join(\"/\");\r\n};\r\n\r\n/**\r\n * Resolves the specified include path against the specified origin path.\r\n * @param {string} originPath Path to the origin file\r\n * @param {string} includePath Include path relative to origin path\r\n * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r\n * @returns {string} Path to the include file\r\n */\r\npath.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r\n if (!alreadyNormalized)\r\n includePath = normalize(includePath);\r\n if (isAbsolute(includePath))\r\n return includePath;\r\n if (!alreadyNormalized)\r\n originPath = normalize(originPath);\r\n return (originPath = originPath.replace(/(?:\\/|^)[^/]+$/, \"\")).length ? normalize(originPath + \"/\" + includePath) : includePath;\r\n};\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\n/**\n * Runtime message from/to plain object converters.\n * @namespace\n */\nvar converter = exports;\n\nvar Enum = require(14),\n util = require(33);\n\n/**\n * Generates a partial value fromObject conveter.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} prop Property reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genValuePartial_fromObject(gen, field, fieldIndex, prop) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(d%s){\", prop);\n for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {\n if (field.repeated && values[keys[i]] === field.typeDefault) gen\n (\"default:\");\n gen\n (\"case%j:\", keys[i])\n (\"case %i:\", values[keys[i]])\n (\"m%s=%j\", prop, values[keys[i]])\n (\"break\");\n } gen\n (\"}\");\n } else gen\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s=types[%i].fromObject(d%s)\", prop, fieldIndex, prop);\n } else {\n var isUnsigned = false;\n switch (field.type) {\n case \"double\":\n case \"float\": gen\n (\"m%s=Number(d%s)\", prop, prop); // also catches \"NaN\", \"Infinity\"\n break;\n case \"uint32\":\n case \"fixed32\": gen\n (\"m%s=d%s>>>0\", prop, prop);\n break;\n case \"int32\":\n case \"sint32\":\n case \"sfixed32\": gen\n (\"m%s=d%s|0\", prop, prop);\n break;\n case \"uint64\":\n isUnsigned = true;\n // eslint-disable-line no-fallthrough\n case \"int64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(util.Long)\")\n (\"(m%s=util.Long.fromValue(d%s)).unsigned=%j\", prop, prop, isUnsigned)\n (\"else if(typeof d%s===\\\"string\\\")\", prop)\n (\"m%s=parseInt(d%s,10)\", prop, prop)\n (\"else if(typeof d%s===\\\"number\\\")\", prop)\n (\"m%s=d%s\", prop, prop)\n (\"else if(typeof d%s===\\\"object\\\")\", prop)\n (\"m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)\", prop, prop, prop, isUnsigned ? \"true\" : \"\");\n break;\n case \"bytes\": gen\n (\"if(typeof d%s===\\\"string\\\")\", prop)\n (\"util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)\", prop, prop, prop)\n (\"else if(d%s.length)\", prop)\n (\"m%s=d%s\", prop, prop);\n break;\n case \"string\": gen\n (\"m%s=String(d%s)\", prop, prop);\n break;\n case \"bool\": gen\n (\"m%s=Boolean(d%s)\", prop, prop);\n break;\n /* default: gen\n (\"m%s=d%s\", prop, prop);\n break; */\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a plain object to runtime message converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.fromObject = function fromObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray;\n var gen = util.codegen([\"d\"], mtype.name + \"$fromObject\")\n (\"if(d instanceof this.ctor)\")\n (\"return d\");\n if (!fields.length) return gen\n (\"return new this.ctor\");\n gen\n (\"var m=new this.ctor\");\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n prop = util.safeProp(field.name);\n\n // Map fields\n if (field.map) { gen\n (\"if(d%s){\", prop)\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s={}\", prop)\n (\"for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s\", prop, prop, prop, prop, isUnsigned ? \"true\": \"\", prop);\n break;\n case \"bytes\": gen\n (\"d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s\", prop, prop, prop, prop, prop);\n break;\n default: gen\n (\"d%s=m%s\", prop, prop);\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a runtime message to plain object converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.toObject = function toObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);\n if (!fields.length)\n return util.codegen()(\"return {}\");\n var gen = util.codegen([\"m\", \"o\"], mtype.name + \"$toObject\")\n (\"if(!o)\")\n (\"o={}\")\n (\"var d={}\");\n\n var repeatedFields = [],\n mapFields = [],\n normalFields = [],\n i = 0;\n for (; i < fields.length; ++i)\n if (!fields[i].partOf)\n ( fields[i].resolve().repeated ? repeatedFields\n : fields[i].map ? mapFields\n : normalFields).push(fields[i]);\n\n if (repeatedFields.length) { gen\n (\"if(o.arrays||o.defaults){\");\n for (i = 0; i < repeatedFields.length; ++i) gen\n (\"d%s=[]\", util.safeProp(repeatedFields[i].name));\n gen\n (\"}\");\n }\n\n if (mapFields.length) { gen\n (\"if(o.objects||o.defaults){\");\n for (i = 0; i < mapFields.length; ++i) gen\n (\"d%s={}\", util.safeProp(mapFields[i].name));\n gen\n (\"}\");\n }\n\n if (normalFields.length) { gen\n (\"if(o.defaults){\");\n for (i = 0; i < normalFields.length; ++i) {\n var field = normalFields[i],\n prop = util.safeProp(field.name);\n if (field.resolvedType instanceof Enum) gen\n (\"d%s=o.enums===String?%j:%j\", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);\n else if (field.long) gen\n (\"if(util.Long){\")\n (\"var n=new util.Long(%i,%i,%j)\", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)\n (\"d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n\", prop)\n (\"}else\")\n (\"d%s=o.longs===String?%j:%i\", prop, field.typeDefault.toString(), field.typeDefault.toNumber());\n else if (field.bytes) {\n var arrayDefault = \"[\" + Array.prototype.slice.call(field.typeDefault).join(\",\") + \"]\";\n gen\n (\"if(o.bytes===String)d%s=%j\", prop, String.fromCharCode.apply(String, field.typeDefault))\n (\"else{\")\n (\"d%s=%s\", prop, arrayDefault)\n (\"if(o.bytes!==Array)d%s=util.newBuffer(d%s)\", prop, prop)\n (\"}\");\n } else gen\n (\"d%s=%j\", prop, field.typeDefault); // also messages (=null)\n } gen\n (\"}\");\n }\n var hasKs2 = false;\n for (i = 0; i < fields.length; ++i) {\n var field = fields[i],\n index = mtype._fieldsArray.indexOf(field),\n prop = util.safeProp(field.name);\n if (field.map) {\n if (!hasKs2) { hasKs2 = true; gen\n (\"var ks2\");\n } gen\n (\"if(m%s&&(ks2=Object.keys(m%s)).length){\", prop, prop)\n (\"d%s={}\", prop)\n (\"for(var j=0;j>>3){\");\n\n var i = 0;\n for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n ref = \"m\" + util.safeProp(field.name); gen\n (\"case %i:\", field.id);\n\n // Map fields\n if (field.map) { gen\n (\"if(%s===util.emptyObject)\", ref)\n (\"%s={}\", ref)\n (\"var c2 = r.uint32()+r.pos\");\n\n if (types.defaults[field.keyType] !== undefined) gen\n (\"k=%j\", types.defaults[field.keyType]);\n else gen\n (\"k=null\");\n\n if (types.defaults[type] !== undefined) gen\n (\"value=%j\", types.defaults[type]);\n else gen\n (\"value=null\");\n\n gen\n (\"while(r.pos>>3){\")\n (\"case 1: k=r.%s(); break\", field.keyType)\n (\"case 2:\");\n\n if (types.basic[type] === undefined) gen\n (\"value=types[%i].decode(r,r.uint32())\", i); // can't be groups\n else gen\n (\"value=r.%s()\", type);\n\n gen\n (\"break\")\n (\"default:\")\n (\"r.skipType(tag2&7)\")\n (\"break\")\n (\"}\")\n (\"}\");\n\n if (types.long[field.keyType] !== undefined) gen\n (\"%s[typeof k===\\\"object\\\"?util.longToHash(k):k]=value\", ref);\n else gen\n (\"%s[k]=value\", ref);\n\n // Repeated fields\n } else if (field.repeated) { gen\n\n (\"if(!(%s&&%s.length))\", ref, ref)\n (\"%s=[]\", ref);\n\n // Packable (always check for forward and backward compatiblity)\n if (types.packed[type] !== undefined) gen\n (\"if((t&7)===2){\")\n (\"var c2=r.uint32()+r.pos\")\n (\"while(r.pos>> 0, (field.id << 3 | 4) >>> 0)\n : gen(\"types[%i].encode(%s,w.uint32(%i).fork()).ldelim()\", fieldIndex, ref, (field.id << 3 | 2) >>> 0);\n}\n\n/**\n * Generates an encoder specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction encoder(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var gen = util.codegen([\"m\", \"w\"], mtype.name + \"$encode\")\n (\"if(!w)\")\n (\"w=Writer.create()\");\n\n var i, ref;\n\n // \"when a message is serialized its known fields should be written sequentially by field number\"\n var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);\n\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n index = mtype._fieldsArray.indexOf(field),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n wireType = types.basic[type];\n ref = \"m\" + util.safeProp(field.name);\n\n // Map fields\n if (field.map) {\n gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j)){\", ref, field.name) // !== undefined && !== null\n (\"for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType);\n if (wireType === undefined) gen\n (\"types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()\", index, ref); // can't be groups\n else gen\n (\".uint32(%i).%s(%s[ks[i]]).ldelim()\", 16 | wireType, type, ref);\n gen\n (\"}\")\n (\"}\");\n\n // Repeated fields\n } else if (field.repeated) { gen\n (\"if(%s!=null&&%s.length){\", ref, ref); // !== undefined && !== null\n\n // Packed repeated\n if (field.packed && types.packed[type] !== undefined) { gen\n\n (\"w.uint32(%i).fork()\", (field.id << 3 | 2) >>> 0)\n (\"for(var i=0;i<%s.length;++i)\", ref)\n (\"w.%s(%s[i])\", type, ref)\n (\"w.ldelim()\");\n\n // Non-packed\n } else { gen\n\n (\"for(var i=0;i<%s.length;++i)\", ref);\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref + \"[i]\");\n else gen\n (\"w.uint32(%i).%s(%s[i])\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n } gen\n (\"}\");\n\n // Non-repeated\n } else {\n if (field.optional) gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j))\", ref, field.name); // !== undefined && !== null\n\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref);\n else gen\n (\"w.uint32(%i).%s(%s)\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n }\n }\n\n return gen\n (\"return w\");\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n","\"use strict\";\nmodule.exports = Enum;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = \"Enum\";\n\nvar Namespace = require(21),\n util = require(33);\n\n/**\n * Constructs a new enum instance.\n * @classdesc Reflected enum.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {Object.} [values] Enum values as an object, by name\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this enum\n * @param {Object.} [comments] The value comments for this enum\n */\nfunction Enum(name, values, options, comment, comments) {\n ReflectionObject.call(this, name, options);\n\n if (values && typeof values !== \"object\")\n throw TypeError(\"values must be an object\");\n\n /**\n * Enum values by id.\n * @type {Object.}\n */\n this.valuesById = {};\n\n /**\n * Enum values by name.\n * @type {Object.}\n */\n this.values = Object.create(this.valuesById); // toJSON, marker\n\n /**\n * Enum comment text.\n * @type {string|null}\n */\n this.comment = comment;\n\n /**\n * Value comment texts, if any.\n * @type {Object.}\n */\n this.comments = comments || {};\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n // Note that values inherit valuesById on their prototype which makes them a TypeScript-\n // compatible enum. This is used by pbts to write actual enum definitions that work for\n // static and reflection code alike instead of emitting generic object definitions.\n\n if (values)\n for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)\n if (typeof values[keys[i]] === \"number\") // use forward entries only\n this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];\n}\n\n/**\n * Enum descriptor.\n * @interface IEnum\n * @property {Object.} values Enum values\n * @property {Object.} [options] Enum options\n */\n\n/**\n * Constructs an enum from an enum descriptor.\n * @param {string} name Enum name\n * @param {IEnum} json Enum descriptor\n * @returns {Enum} Created enum\n * @throws {TypeError} If arguments are invalid\n */\nEnum.fromJSON = function fromJSON(name, json) {\n var enm = new Enum(name, json.values, json.options, json.comment, json.comments);\n enm.reserved = json.reserved;\n return enm;\n};\n\n/**\n * Converts this enum to an enum descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IEnum} Enum descriptor\n */\nEnum.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"values\" , this.values,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"comment\" , keepComments ? this.comment : undefined,\n \"comments\" , keepComments ? this.comments : undefined\n ]);\n};\n\n/**\n * Adds a value to this enum.\n * @param {string} name Value name\n * @param {number} id Value id\n * @param {string} [comment] Comment, if any\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a value with this name or id\n */\nEnum.prototype.add = function add(name, id, comment) {\n // utilized by the parser but not by .fromJSON\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (!util.isInteger(id))\n throw TypeError(\"id must be an integer\");\n\n if (this.values[name] !== undefined)\n throw Error(\"duplicate name '\" + name + \"' in \" + this);\n\n if (this.isReservedId(id))\n throw Error(\"id \" + id + \" is reserved in \" + this);\n\n if (this.isReservedName(name))\n throw Error(\"name '\" + name + \"' is reserved in \" + this);\n\n if (this.valuesById[id] !== undefined) {\n if (!(this.options && this.options.allow_alias))\n throw Error(\"duplicate id \" + id + \" in \" + this);\n this.values[name] = id;\n } else\n this.valuesById[this.values[name] = id] = name;\n\n this.comments[name] = comment || null;\n return this;\n};\n\n/**\n * Removes a value from this enum\n * @param {string} name Value name\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `name` is not a name of this enum\n */\nEnum.prototype.remove = function remove(name) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n var val = this.values[name];\n if (val == null)\n throw Error(\"name '\" + name + \"' does not exist in \" + this);\n\n delete this.valuesById[val];\n delete this.values[name];\n delete this.comments[name];\n\n return this;\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n","\"use strict\";\nmodule.exports = Field;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = \"Field\";\n\nvar Enum = require(14),\n types = require(32),\n util = require(33);\n\nvar Type; // cyclic\n\nvar ruleRe = /^required|optional|repeated$/;\n\n/**\n * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.\n * @name Field\n * @classdesc Reflected message field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a field from a field descriptor.\n * @param {string} name Field name\n * @param {IField} json Field descriptor\n * @returns {Field} Created field\n * @throws {TypeError} If arguments are invalid\n */\nField.fromJSON = function fromJSON(name, json) {\n return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);\n};\n\n/**\n * Not an actual constructor. Use {@link Field} instead.\n * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports FieldBase\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction Field(name, id, type, rule, extend, options, comment) {\n\n if (util.isObject(rule)) {\n comment = extend;\n options = rule;\n rule = extend = undefined;\n } else if (util.isObject(extend)) {\n comment = options;\n options = extend;\n extend = undefined;\n }\n\n ReflectionObject.call(this, name, options);\n\n if (!util.isInteger(id) || id < 0)\n throw TypeError(\"id must be a non-negative integer\");\n\n if (!util.isString(type))\n throw TypeError(\"type must be a string\");\n\n if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase()))\n throw TypeError(\"rule must be a string rule\");\n\n if (extend !== undefined && !util.isString(extend))\n throw TypeError(\"extend must be a string\");\n\n /**\n * Field rule, if any.\n * @type {string|undefined}\n */\n this.rule = rule && rule !== \"optional\" ? rule : undefined; // toJSON\n\n /**\n * Field type.\n * @type {string}\n */\n this.type = type; // toJSON\n\n /**\n * Unique field id.\n * @type {number}\n */\n this.id = id; // toJSON, marker\n\n /**\n * Extended type if different from parent.\n * @type {string|undefined}\n */\n this.extend = extend || undefined; // toJSON\n\n /**\n * Whether this field is required.\n * @type {boolean}\n */\n this.required = rule === \"required\";\n\n /**\n * Whether this field is optional.\n * @type {boolean}\n */\n this.optional = !this.required;\n\n /**\n * Whether this field is repeated.\n * @type {boolean}\n */\n this.repeated = rule === \"repeated\";\n\n /**\n * Whether this field is a map or not.\n * @type {boolean}\n */\n this.map = false;\n\n /**\n * Message this field belongs to.\n * @type {Type|null}\n */\n this.message = null;\n\n /**\n * OneOf this field belongs to, if any,\n * @type {OneOf|null}\n */\n this.partOf = null;\n\n /**\n * The field type's default value.\n * @type {*}\n */\n this.typeDefault = null;\n\n /**\n * The field's default value on prototypes.\n * @type {*}\n */\n this.defaultValue = null;\n\n /**\n * Whether this field's value should be treated as a long.\n * @type {boolean}\n */\n this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false;\n\n /**\n * Whether this field's value is a buffer.\n * @type {boolean}\n */\n this.bytes = type === \"bytes\";\n\n /**\n * Resolved type if not a basic type.\n * @type {Type|Enum|null}\n */\n this.resolvedType = null;\n\n /**\n * Sister-field within the extended type if a declaring extension field.\n * @type {Field|null}\n */\n this.extensionField = null;\n\n /**\n * Sister-field within the declaring namespace if an extended field.\n * @type {Field|null}\n */\n this.declaringField = null;\n\n /**\n * Internally remembers whether this field is packed.\n * @type {boolean|null}\n * @private\n */\n this._packed = null;\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Determines whether this field is packed. Only relevant when repeated and working with proto2.\n * @name Field#packed\n * @type {boolean}\n * @readonly\n */\nObject.defineProperty(Field.prototype, \"packed\", {\n get: function() {\n // defaults to packed=true if not explicity set to false\n if (this._packed === null)\n this._packed = this.getOption(\"packed\") !== false;\n return this._packed;\n }\n});\n\n/**\n * @override\n */\nField.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (name === \"packed\") // clear cached before setting\n this._packed = null;\n return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);\n};\n\n/**\n * Field descriptor.\n * @interface IField\n * @property {string} [rule=\"optional\"] Field rule\n * @property {string} type Field type\n * @property {number} id Field id\n * @property {Object.} [options] Field options\n */\n\n/**\n * Extension field descriptor.\n * @interface IExtensionField\n * @extends IField\n * @property {string} extend Extended type\n */\n\n/**\n * Converts this field to a field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IField} Field descriptor\n */\nField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"rule\" , this.rule !== \"optional\" && this.rule || undefined,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Resolves this field's type references.\n * @returns {Field} `this`\n * @throws {Error} If any reference cannot be resolved\n */\nField.prototype.resolve = function resolve() {\n\n if (this.resolved)\n return this;\n\n if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it\n this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);\n if (this.resolvedType instanceof Type)\n this.typeDefault = null;\n else // instanceof Enum\n this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined\n }\n\n // use explicitly set default value if present\n if (this.options && this.options[\"default\"] != null) {\n this.typeDefault = this.options[\"default\"];\n if (this.resolvedType instanceof Enum && typeof this.typeDefault === \"string\")\n this.typeDefault = this.resolvedType.values[this.typeDefault];\n }\n\n // remove unnecessary options\n if (this.options) {\n if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))\n delete this.options.packed;\n if (!Object.keys(this.options).length)\n this.options = undefined;\n }\n\n // convert to internal data type if necesssary\n if (this.long) {\n this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === \"u\");\n\n /* istanbul ignore else */\n if (Object.freeze)\n Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it)\n\n } else if (this.bytes && typeof this.typeDefault === \"string\") {\n var buf;\n if (util.base64.test(this.typeDefault))\n util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);\n else\n util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);\n this.typeDefault = buf;\n }\n\n // take special care of maps and repeated fields\n if (this.map)\n this.defaultValue = util.emptyObject;\n else if (this.repeated)\n this.defaultValue = util.emptyArray;\n else\n this.defaultValue = this.typeDefault;\n\n // ensure proper value on prototype\n if (this.parent instanceof Type)\n this.parent.ctor.prototype[this.name] = this.defaultValue;\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n\n/**\n * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).\n * @typedef FieldDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} fieldName Field name\n * @returns {undefined}\n */\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"string\"|\"bool\"|\"bytes\"|Object} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @param {T} [defaultValue] Default value\n * @returns {FieldDecorator} Decorator function\n * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]\n */\nField.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {\n\n // submessage: decorate the submessage and use its name as the type\n if (typeof fieldType === \"function\")\n fieldType = util.decorateType(fieldType).name;\n\n // enum reference: create a reflected copy of the enum and keep reuseing it\n else if (fieldType && typeof fieldType === \"object\")\n fieldType = util.decorateEnum(fieldType).name;\n\n return function fieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new Field(fieldName, fieldId, fieldType, fieldRule, { \"default\": defaultValue }));\n };\n};\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {Constructor|string} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @returns {FieldDecorator} Decorator function\n * @template T extends Message\n * @variation 2\n */\n// like Field.d but without a default value\n\n// Sets up cyclic dependencies (called in index-light)\nField._configure = function configure(Type_) {\n Type = Type_;\n};\n","\"use strict\";\nvar protobuf = module.exports = require(17);\n\nprotobuf.build = \"light\";\n\n/**\n * A node-style callback as used by {@link load} and {@link Root#load}.\n * @typedef LoadCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Root} [root] Root, if there hasn't been an error\n * @returns {undefined}\n */\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} root Root namespace, defaults to create a new one if omitted.\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n */\nfunction load(filename, root, callback) {\n if (typeof root === \"function\") {\n callback = root;\n root = new protobuf.Root();\n } else if (!root)\n root = new protobuf.Root();\n return root.load(filename, callback);\n}\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Promise} Promise\n * @see {@link Root#load}\n * @variation 3\n */\n// function load(filename:string, [root:Root]):Promise\n\nprotobuf.load = load;\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n * @see {@link Root#loadSync}\n */\nfunction loadSync(filename, root) {\n if (!root)\n root = new protobuf.Root();\n return root.loadSync(filename);\n}\n\nprotobuf.loadSync = loadSync;\n\n// Serialization\nprotobuf.encoder = require(13);\nprotobuf.decoder = require(12);\nprotobuf.verifier = require(36);\nprotobuf.converter = require(11);\n\n// Reflection\nprotobuf.ReflectionObject = require(22);\nprotobuf.Namespace = require(21);\nprotobuf.Root = require(26);\nprotobuf.Enum = require(14);\nprotobuf.Type = require(31);\nprotobuf.Field = require(15);\nprotobuf.OneOf = require(23);\nprotobuf.MapField = require(18);\nprotobuf.Service = require(30);\nprotobuf.Method = require(20);\n\n// Runtime\nprotobuf.Message = require(19);\nprotobuf.wrappers = require(37);\n\n// Utility\nprotobuf.types = require(32);\nprotobuf.util = require(33);\n\n// Set up possibly cyclic reflection dependencies\nprotobuf.ReflectionObject._configure(protobuf.Root);\nprotobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);\nprotobuf.Root._configure(protobuf.Type);\nprotobuf.Field._configure(protobuf.Type);\n","\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(38);\nprotobuf.BufferWriter = require(39);\nprotobuf.Reader = require(24);\nprotobuf.BufferReader = require(25);\n\n// Utility\nprotobuf.util = require(35);\nprotobuf.rpc = require(28);\nprotobuf.roots = require(27);\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n","\"use strict\";\nmodule.exports = MapField;\n\n// extends Field\nvar Field = require(15);\n((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = \"MapField\";\n\nvar types = require(32),\n util = require(33);\n\n/**\n * Constructs a new map field instance.\n * @classdesc Reflected map field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} keyType Key type\n * @param {string} type Value type\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction MapField(name, id, keyType, type, options, comment) {\n Field.call(this, name, id, type, undefined, undefined, options, comment);\n\n /* istanbul ignore if */\n if (!util.isString(keyType))\n throw TypeError(\"keyType must be a string\");\n\n /**\n * Key type.\n * @type {string}\n */\n this.keyType = keyType; // toJSON, marker\n\n /**\n * Resolved key type if not a basic type.\n * @type {ReflectionObject|null}\n */\n this.resolvedKeyType = null;\n\n // Overrides Field#map\n this.map = true;\n}\n\n/**\n * Map field descriptor.\n * @interface IMapField\n * @extends {IField}\n * @property {string} keyType Key type\n */\n\n/**\n * Extension map field descriptor.\n * @interface IExtensionMapField\n * @extends IMapField\n * @property {string} extend Extended type\n */\n\n/**\n * Constructs a map field from a map field descriptor.\n * @param {string} name Field name\n * @param {IMapField} json Map field descriptor\n * @returns {MapField} Created map field\n * @throws {TypeError} If arguments are invalid\n */\nMapField.fromJSON = function fromJSON(name, json) {\n return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);\n};\n\n/**\n * Converts this map field to a map field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMapField} Map field descriptor\n */\nMapField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"keyType\" , this.keyType,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMapField.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n\n // Besides a value type, map fields have a key type that may be \"any scalar type except for floating point types and bytes\"\n if (types.mapKey[this.keyType] === undefined)\n throw Error(\"invalid key type: \" + this.keyType);\n\n return Field.prototype.resolve.call(this);\n};\n\n/**\n * Map field decorator (TypeScript).\n * @name MapField.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"} fieldKeyType Field key type\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"|\"bytes\"|Object|Constructor<{}>} fieldValueType Field value type\n * @returns {FieldDecorator} Decorator function\n * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }\n */\nMapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {\n\n // submessage value: decorate the submessage and use its name as the type\n if (typeof fieldValueType === \"function\")\n fieldValueType = util.decorateType(fieldValueType).name;\n\n // enum reference value: create a reflected copy of the enum and keep reuseing it\n else if (fieldValueType && typeof fieldValueType === \"object\")\n fieldValueType = util.decorateEnum(fieldValueType).name;\n\n return function mapFieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));\n };\n};\n","\"use strict\";\nmodule.exports = Message;\n\nvar util = require(35);\n\n/**\n * Constructs a new message instance.\n * @classdesc Abstract runtime message.\n * @constructor\n * @param {Properties} [properties] Properties to set\n * @template T extends object = object\n */\nfunction Message(properties) {\n // not used internally\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n this[keys[i]] = properties[keys[i]];\n}\n\n/**\n * Reference to the reflected type.\n * @name Message.$type\n * @type {Type}\n * @readonly\n */\n\n/**\n * Reference to the reflected type.\n * @name Message#$type\n * @type {Type}\n * @readonly\n */\n\n/*eslint-disable valid-jsdoc*/\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.create = function create(properties) {\n return this.$type.create(properties);\n};\n\n/**\n * Encodes a message of this type.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encode = function encode(message, writer) {\n return this.$type.encode(message, writer);\n};\n\n/**\n * Encodes a message of this type preceeded by its length as a varint.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encodeDelimited = function encodeDelimited(message, writer) {\n return this.$type.encodeDelimited(message, writer);\n};\n\n/**\n * Decodes a message of this type.\n * @name Message.decode\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decode = function decode(reader) {\n return this.$type.decode(reader);\n};\n\n/**\n * Decodes a message of this type preceeded by its length as a varint.\n * @name Message.decodeDelimited\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decodeDelimited = function decodeDelimited(reader) {\n return this.$type.decodeDelimited(reader);\n};\n\n/**\n * Verifies a message of this type.\n * @name Message.verify\n * @function\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\nMessage.verify = function verify(message) {\n return this.$type.verify(message);\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object\n * @returns {T} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.fromObject = function fromObject(object) {\n return this.$type.fromObject(object);\n};\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {T} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @template T extends Message\n * @this Constructor\n */\nMessage.toObject = function toObject(message, options) {\n return this.$type.toObject(message, options);\n};\n\n/**\n * Converts this message to JSON.\n * @returns {Object.} JSON object\n */\nMessage.prototype.toJSON = function toJSON() {\n return this.$type.toObject(this, util.toJSONOptions);\n};\n\n/*eslint-enable valid-jsdoc*/","\"use strict\";\nmodule.exports = Method;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = \"Method\";\n\nvar util = require(33);\n\n/**\n * Constructs a new service method instance.\n * @classdesc Reflected service method.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Method name\n * @param {string|undefined} type Method type, usually `\"rpc\"`\n * @param {string} requestType Request message type\n * @param {string} responseType Response message type\n * @param {boolean|Object.} [requestStream] Whether the request is streamed\n * @param {boolean|Object.} [responseStream] Whether the response is streamed\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this method\n */\nfunction Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) {\n\n /* istanbul ignore next */\n if (util.isObject(requestStream)) {\n options = requestStream;\n requestStream = responseStream = undefined;\n } else if (util.isObject(responseStream)) {\n options = responseStream;\n responseStream = undefined;\n }\n\n /* istanbul ignore if */\n if (!(type === undefined || util.isString(type)))\n throw TypeError(\"type must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(requestType))\n throw TypeError(\"requestType must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(responseType))\n throw TypeError(\"responseType must be a string\");\n\n ReflectionObject.call(this, name, options);\n\n /**\n * Method type.\n * @type {string}\n */\n this.type = type || \"rpc\"; // toJSON\n\n /**\n * Request type.\n * @type {string}\n */\n this.requestType = requestType; // toJSON, marker\n\n /**\n * Whether requests are streamed or not.\n * @type {boolean|undefined}\n */\n this.requestStream = requestStream ? true : undefined; // toJSON\n\n /**\n * Response type.\n * @type {string}\n */\n this.responseType = responseType; // toJSON\n\n /**\n * Whether responses are streamed or not.\n * @type {boolean|undefined}\n */\n this.responseStream = responseStream ? true : undefined; // toJSON\n\n /**\n * Resolved request type.\n * @type {Type|null}\n */\n this.resolvedRequestType = null;\n\n /**\n * Resolved response type.\n * @type {Type|null}\n */\n this.resolvedResponseType = null;\n\n /**\n * Comment for this method\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Method descriptor.\n * @interface IMethod\n * @property {string} [type=\"rpc\"] Method type\n * @property {string} requestType Request type\n * @property {string} responseType Response type\n * @property {boolean} [requestStream=false] Whether requests are streamed\n * @property {boolean} [responseStream=false] Whether responses are streamed\n * @property {Object.} [options] Method options\n */\n\n/**\n * Constructs a method from a method descriptor.\n * @param {string} name Method name\n * @param {IMethod} json Method descriptor\n * @returns {Method} Created method\n * @throws {TypeError} If arguments are invalid\n */\nMethod.fromJSON = function fromJSON(name, json) {\n return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment);\n};\n\n/**\n * Converts this method to a method descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMethod} Method descriptor\n */\nMethod.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"type\" , this.type !== \"rpc\" && /* istanbul ignore next */ this.type || undefined,\n \"requestType\" , this.requestType,\n \"requestStream\" , this.requestStream,\n \"responseType\" , this.responseType,\n \"responseStream\" , this.responseStream,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMethod.prototype.resolve = function resolve() {\n\n /* istanbul ignore if */\n if (this.resolved)\n return this;\n\n this.resolvedRequestType = this.parent.lookupType(this.requestType);\n this.resolvedResponseType = this.parent.lookupType(this.responseType);\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n","\"use strict\";\nmodule.exports = Namespace;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = \"Namespace\";\n\nvar Field = require(15),\n util = require(33);\n\nvar Type, // cyclic\n Service,\n Enum;\n\n/**\n * Constructs a new namespace instance.\n * @name Namespace\n * @classdesc Reflected namespace.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a namespace from JSON.\n * @memberof Namespace\n * @function\n * @param {string} name Namespace name\n * @param {Object.} json JSON object\n * @returns {Namespace} Created namespace\n * @throws {TypeError} If arguments are invalid\n */\nNamespace.fromJSON = function fromJSON(name, json) {\n return new Namespace(name, json.options).addJSON(json.nested);\n};\n\n/**\n * Converts an array of reflection objects to JSON.\n * @memberof Namespace\n * @param {ReflectionObject[]} array Object array\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {Object.|undefined} JSON object or `undefined` when array is empty\n */\nfunction arrayToJSON(array, toJSONOptions) {\n if (!(array && array.length))\n return undefined;\n var obj = {};\n for (var i = 0; i < array.length; ++i)\n obj[array[i].name] = array[i].toJSON(toJSONOptions);\n return obj;\n}\n\nNamespace.arrayToJSON = arrayToJSON;\n\n/**\n * Tests if the specified id is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedId = function isReservedId(reserved, id) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (typeof reserved[i] !== \"string\" && reserved[i][0] <= id && reserved[i][1] > id)\n return true;\n return false;\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedName = function isReservedName(reserved, name) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (reserved[i] === name)\n return true;\n return false;\n};\n\n/**\n * Not an actual constructor. Use {@link Namespace} instead.\n * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports NamespaceBase\n * @extends ReflectionObject\n * @abstract\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n * @see {@link Namespace}\n */\nfunction Namespace(name, options) {\n ReflectionObject.call(this, name, options);\n\n /**\n * Nested objects by name.\n * @type {Object.|undefined}\n */\n this.nested = undefined; // toJSON\n\n /**\n * Cached nested objects as an array.\n * @type {ReflectionObject[]|null}\n * @private\n */\n this._nestedArray = null;\n}\n\nfunction clearCache(namespace) {\n namespace._nestedArray = null;\n return namespace;\n}\n\n/**\n * Nested objects of this namespace as an array for iteration.\n * @name NamespaceBase#nestedArray\n * @type {ReflectionObject[]}\n * @readonly\n */\nObject.defineProperty(Namespace.prototype, \"nestedArray\", {\n get: function() {\n return this._nestedArray || (this._nestedArray = util.toArray(this.nested));\n }\n});\n\n/**\n * Namespace descriptor.\n * @interface INamespace\n * @property {Object.} [options] Namespace options\n * @property {Object.} [nested] Nested object descriptors\n */\n\n/**\n * Any extension field descriptor.\n * @typedef AnyExtensionField\n * @type {IExtensionField|IExtensionMapField}\n */\n\n/**\n * Any nested object descriptor.\n * @typedef AnyNestedObject\n * @type {IEnum|IType|IService|AnyExtensionField|INamespace}\n */\n// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)\n\n/**\n * Converts this namespace to a namespace descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {INamespace} Namespace descriptor\n */\nNamespace.prototype.toJSON = function toJSON(toJSONOptions) {\n return util.toObject([\n \"options\" , this.options,\n \"nested\" , arrayToJSON(this.nestedArray, toJSONOptions)\n ]);\n};\n\n/**\n * Adds nested objects to this namespace from nested object descriptors.\n * @param {Object.} nestedJson Any nested object descriptors\n * @returns {Namespace} `this`\n */\nNamespace.prototype.addJSON = function addJSON(nestedJson) {\n var ns = this;\n /* istanbul ignore else */\n if (nestedJson) {\n for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {\n nested = nestedJson[names[i]];\n ns.add( // most to least likely\n ( nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : nested.id !== undefined\n ? Field.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n }\n return this;\n};\n\n/**\n * Gets the nested object of the specified name.\n * @param {string} name Nested object name\n * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist\n */\nNamespace.prototype.get = function get(name) {\n return this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Gets the values of the nested {@link Enum|enum} of the specified name.\n * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`.\n * @param {string} name Nested enum name\n * @returns {Object.} Enum values\n * @throws {Error} If there is no such enum\n */\nNamespace.prototype.getEnum = function getEnum(name) {\n if (this.nested && this.nested[name] instanceof Enum)\n return this.nested[name].values;\n throw Error(\"no such enum: \" + name);\n};\n\n/**\n * Adds a nested object to this namespace.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name\n */\nNamespace.prototype.add = function add(object) {\n\n if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))\n throw TypeError(\"object must be a valid nested object\");\n\n if (!this.nested)\n this.nested = {};\n else {\n var prev = this.get(object.name);\n if (prev) {\n if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {\n // replace plain namespace but keep existing nested elements and options\n var nested = prev.nestedArray;\n for (var i = 0; i < nested.length; ++i)\n object.add(nested[i]);\n this.remove(prev);\n if (!this.nested)\n this.nested = {};\n object.setOptions(prev.options, true);\n\n } else\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n }\n }\n this.nested[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n};\n\n/**\n * Removes a nested object from this namespace.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this namespace\n */\nNamespace.prototype.remove = function remove(object) {\n\n if (!(object instanceof ReflectionObject))\n throw TypeError(\"object must be a ReflectionObject\");\n if (object.parent !== this)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.nested[object.name];\n if (!Object.keys(this.nested).length)\n this.nested = undefined;\n\n object.onRemove(this);\n return clearCache(this);\n};\n\n/**\n * Defines additial namespaces within this one if not yet existing.\n * @param {string|string[]} path Path to create\n * @param {*} [json] Nested types to create from JSON\n * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty\n */\nNamespace.prototype.define = function define(path, json) {\n\n if (util.isString(path))\n path = path.split(\".\");\n else if (!Array.isArray(path))\n throw TypeError(\"illegal path\");\n if (path && path.length && path[0] === \"\")\n throw Error(\"path must be relative\");\n\n var ptr = this;\n while (path.length > 0) {\n var part = path.shift();\n if (ptr.nested && ptr.nested[part]) {\n ptr = ptr.nested[part];\n if (!(ptr instanceof Namespace))\n throw Error(\"path conflicts with non-namespace objects\");\n } else\n ptr.add(ptr = new Namespace(part));\n }\n if (json)\n ptr.addJSON(json);\n return ptr;\n};\n\n/**\n * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.\n * @returns {Namespace} `this`\n */\nNamespace.prototype.resolveAll = function resolveAll() {\n var nested = this.nestedArray, i = 0;\n while (i < nested.length)\n if (nested[i] instanceof Namespace)\n nested[i++].resolveAll();\n else\n nested[i++].resolve();\n return this.resolve();\n};\n\n/**\n * Recursively looks up the reflection object matching the specified path in the scope of this namespace.\n * @param {string|string[]} path Path to look up\n * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc.\n * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n */\nNamespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {\n\n /* istanbul ignore next */\n if (typeof filterTypes === \"boolean\") {\n parentAlreadyChecked = filterTypes;\n filterTypes = undefined;\n } else if (filterTypes && !Array.isArray(filterTypes))\n filterTypes = [ filterTypes ];\n\n if (util.isString(path) && path.length) {\n if (path === \".\")\n return this.root;\n path = path.split(\".\");\n } else if (!path.length)\n return this;\n\n // Start at root if path is absolute\n if (path[0] === \"\")\n return this.root.lookup(path.slice(1), filterTypes);\n\n // Test if the first part matches any nested object, and if so, traverse if path contains more\n var found = this.get(path[0]);\n if (found) {\n if (path.length === 1) {\n if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)\n return found;\n } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))\n return found;\n\n // Otherwise try each nested namespace\n } else\n for (var i = 0; i < this.nestedArray.length; ++i)\n if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))\n return found;\n\n // If there hasn't been a match, try again at the parent\n if (this.parent === null || parentAlreadyChecked)\n return null;\n return this.parent.lookup(path, filterTypes);\n};\n\n/**\n * Looks up the reflection object at the specified path, relative to this namespace.\n * @name NamespaceBase#lookup\n * @function\n * @param {string|string[]} path Path to look up\n * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n * @variation 2\n */\n// lookup(path: string, [parentAlreadyChecked: boolean])\n\n/**\n * Looks up the {@link Type|type} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type\n * @throws {Error} If `path` does not point to a type\n */\nNamespace.prototype.lookupType = function lookupType(path) {\n var found = this.lookup(path, [ Type ]);\n if (!found)\n throw Error(\"no such type: \" + path);\n return found;\n};\n\n/**\n * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Enum} Looked up enum\n * @throws {Error} If `path` does not point to an enum\n */\nNamespace.prototype.lookupEnum = function lookupEnum(path) {\n var found = this.lookup(path, [ Enum ]);\n if (!found)\n throw Error(\"no such Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type or enum\n * @throws {Error} If `path` does not point to a type or enum\n */\nNamespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {\n var found = this.lookup(path, [ Type, Enum ]);\n if (!found)\n throw Error(\"no such Type or Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Service|service} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Service} Looked up service\n * @throws {Error} If `path` does not point to a service\n */\nNamespace.prototype.lookupService = function lookupService(path) {\n var found = this.lookup(path, [ Service ]);\n if (!found)\n throw Error(\"no such Service '\" + path + \"' in \" + this);\n return found;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nNamespace._configure = function(Type_, Service_, Enum_) {\n Type = Type_;\n Service = Service_;\n Enum = Enum_;\n};\n","\"use strict\";\nmodule.exports = ReflectionObject;\n\nReflectionObject.className = \"ReflectionObject\";\n\nvar util = require(33);\n\nvar Root; // cyclic\n\n/**\n * Constructs a new reflection object instance.\n * @classdesc Base class of all reflection objects.\n * @constructor\n * @param {string} name Object name\n * @param {Object.} [options] Declared options\n * @abstract\n */\nfunction ReflectionObject(name, options) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (options && !util.isObject(options))\n throw TypeError(\"options must be an object\");\n\n /**\n * Options.\n * @type {Object.|undefined}\n */\n this.options = options; // toJSON\n\n /**\n * Parsed Options.\n * @type {Array.>|undefined}\n */\n this.parsedOptions = null;\n\n /**\n * Unique name within its namespace.\n * @type {string}\n */\n this.name = name;\n\n /**\n * Parent namespace.\n * @type {Namespace|null}\n */\n this.parent = null;\n\n /**\n * Whether already resolved or not.\n * @type {boolean}\n */\n this.resolved = false;\n\n /**\n * Comment text, if any.\n * @type {string|null}\n */\n this.comment = null;\n\n /**\n * Defining file name.\n * @type {string|null}\n */\n this.filename = null;\n}\n\nObject.defineProperties(ReflectionObject.prototype, {\n\n /**\n * Reference to the root namespace.\n * @name ReflectionObject#root\n * @type {Root}\n * @readonly\n */\n root: {\n get: function() {\n var ptr = this;\n while (ptr.parent !== null)\n ptr = ptr.parent;\n return ptr;\n }\n },\n\n /**\n * Full name including leading dot.\n * @name ReflectionObject#fullName\n * @type {string}\n * @readonly\n */\n fullName: {\n get: function() {\n var path = [ this.name ],\n ptr = this.parent;\n while (ptr) {\n path.unshift(ptr.name);\n ptr = ptr.parent;\n }\n return path.join(\".\");\n }\n }\n});\n\n/**\n * Converts this reflection object to its descriptor representation.\n * @returns {Object.} Descriptor\n * @abstract\n */\nReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {\n throw Error(); // not implemented, shouldn't happen\n};\n\n/**\n * Called when this object is added to a parent.\n * @param {ReflectionObject} parent Parent added to\n * @returns {undefined}\n */\nReflectionObject.prototype.onAdd = function onAdd(parent) {\n if (this.parent && this.parent !== parent)\n this.parent.remove(this);\n this.parent = parent;\n this.resolved = false;\n var root = parent.root;\n if (root instanceof Root)\n root._handleAdd(this);\n};\n\n/**\n * Called when this object is removed from a parent.\n * @param {ReflectionObject} parent Parent removed from\n * @returns {undefined}\n */\nReflectionObject.prototype.onRemove = function onRemove(parent) {\n var root = parent.root;\n if (root instanceof Root)\n root._handleRemove(this);\n this.parent = null;\n this.resolved = false;\n};\n\n/**\n * Resolves this objects type references.\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n if (this.root instanceof Root)\n this.resolved = true; // only if part of a root\n return this;\n};\n\n/**\n * Gets an option value.\n * @param {string} name Option name\n * @returns {*} Option value or `undefined` if not set\n */\nReflectionObject.prototype.getOption = function getOption(name) {\n if (this.options)\n return this.options[name];\n return undefined;\n};\n\n/**\n * Sets an option.\n * @param {string} name Option name\n * @param {*} value Option value\n * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (!ifNotSet || !this.options || this.options[name] === undefined)\n (this.options || (this.options = {}))[name] = value;\n return this;\n};\n\n/**\n * Sets a parsed option.\n * @param {string} name parsed Option name\n * @param {*} value Option value\n * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\\empty, will add a new option with that value\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) {\n if (!this.parsedOptions) {\n this.parsedOptions = [];\n }\n var parsedOptions = this.parsedOptions;\n if (propName) {\n // If setting a sub property of an option then try to merge it\n // with an existing option\n var opt = parsedOptions.find(function (opt) {\n return Object.prototype.hasOwnProperty.call(opt, name);\n });\n if (opt) {\n // If we found an existing option - just merge the property value\n var newValue = opt[name];\n util.setProperty(newValue, propName, value);\n } else {\n // otherwise, create a new option, set it's property and add it to the list\n opt = {};\n opt[name] = util.setProperty({}, propName, value);\n parsedOptions.push(opt);\n }\n } else {\n // Always create a new option when setting the value of the option itself\n var newOpt = {};\n newOpt[name] = value;\n parsedOptions.push(newOpt);\n }\n return this;\n};\n\n/**\n * Sets multiple options.\n * @param {Object.} options Options to set\n * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {\n if (options)\n for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)\n this.setOption(keys[i], options[keys[i]], ifNotSet);\n return this;\n};\n\n/**\n * Converts this instance to its string representation.\n * @returns {string} Class name[, space, full name]\n */\nReflectionObject.prototype.toString = function toString() {\n var className = this.constructor.className,\n fullName = this.fullName;\n if (fullName.length)\n return className + \" \" + fullName;\n return className;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nReflectionObject._configure = function(Root_) {\n Root = Root_;\n};\n","\"use strict\";\nmodule.exports = OneOf;\n\n// extends ReflectionObject\nvar ReflectionObject = require(22);\n((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = \"OneOf\";\n\nvar Field = require(15),\n util = require(33);\n\n/**\n * Constructs a new oneof instance.\n * @classdesc Reflected oneof.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Oneof name\n * @param {string[]|Object.} [fieldNames] Field names\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction OneOf(name, fieldNames, options, comment) {\n if (!Array.isArray(fieldNames)) {\n options = fieldNames;\n fieldNames = undefined;\n }\n ReflectionObject.call(this, name, options);\n\n /* istanbul ignore if */\n if (!(fieldNames === undefined || Array.isArray(fieldNames)))\n throw TypeError(\"fieldNames must be an Array\");\n\n /**\n * Field names that belong to this oneof.\n * @type {string[]}\n */\n this.oneof = fieldNames || []; // toJSON, marker\n\n /**\n * Fields that belong to this oneof as an array for iteration.\n * @type {Field[]}\n * @readonly\n */\n this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Oneof descriptor.\n * @interface IOneOf\n * @property {Array.} oneof Oneof field names\n * @property {Object.} [options] Oneof options\n */\n\n/**\n * Constructs a oneof from a oneof descriptor.\n * @param {string} name Oneof name\n * @param {IOneOf} json Oneof descriptor\n * @returns {OneOf} Created oneof\n * @throws {TypeError} If arguments are invalid\n */\nOneOf.fromJSON = function fromJSON(name, json) {\n return new OneOf(name, json.oneof, json.options, json.comment);\n};\n\n/**\n * Converts this oneof to a oneof descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IOneOf} Oneof descriptor\n */\nOneOf.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"oneof\" , this.oneof,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Adds the fields of the specified oneof to the parent if not already done so.\n * @param {OneOf} oneof The oneof\n * @returns {undefined}\n * @inner\n * @ignore\n */\nfunction addFieldsToParent(oneof) {\n if (oneof.parent)\n for (var i = 0; i < oneof.fieldsArray.length; ++i)\n if (!oneof.fieldsArray[i].parent)\n oneof.parent.add(oneof.fieldsArray[i]);\n}\n\n/**\n * Adds a field to this oneof and removes it from its current parent, if any.\n * @param {Field} field Field to add\n * @returns {OneOf} `this`\n */\nOneOf.prototype.add = function add(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n if (field.parent && field.parent !== this.parent)\n field.parent.remove(field);\n this.oneof.push(field.name);\n this.fieldsArray.push(field);\n field.partOf = this; // field.parent remains null\n addFieldsToParent(this);\n return this;\n};\n\n/**\n * Removes a field from this oneof and puts it back to the oneof's parent.\n * @param {Field} field Field to remove\n * @returns {OneOf} `this`\n */\nOneOf.prototype.remove = function remove(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n var index = this.fieldsArray.indexOf(field);\n\n /* istanbul ignore if */\n if (index < 0)\n throw Error(field + \" is not a member of \" + this);\n\n this.fieldsArray.splice(index, 1);\n index = this.oneof.indexOf(field.name);\n\n /* istanbul ignore else */\n if (index > -1) // theoretical\n this.oneof.splice(index, 1);\n\n field.partOf = null;\n return this;\n};\n\n/**\n * @override\n */\nOneOf.prototype.onAdd = function onAdd(parent) {\n ReflectionObject.prototype.onAdd.call(this, parent);\n var self = this;\n // Collect present fields\n for (var i = 0; i < this.oneof.length; ++i) {\n var field = parent.get(this.oneof[i]);\n if (field && !field.partOf) {\n field.partOf = self;\n self.fieldsArray.push(field);\n }\n }\n // Add not yet present fields\n addFieldsToParent(this);\n};\n\n/**\n * @override\n */\nOneOf.prototype.onRemove = function onRemove(parent) {\n for (var i = 0, field; i < this.fieldsArray.length; ++i)\n if ((field = this.fieldsArray[i]).parent)\n field.parent.remove(field);\n ReflectionObject.prototype.onRemove.call(this, parent);\n};\n\n/**\n * Decorator function as returned by {@link OneOf.d} (TypeScript).\n * @typedef OneOfDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} oneofName OneOf name\n * @returns {undefined}\n */\n\n/**\n * OneOf decorator (TypeScript).\n * @function\n * @param {...string} fieldNames Field names\n * @returns {OneOfDecorator} Decorator function\n * @template T extends string\n */\nOneOf.d = function decorateOneOf() {\n var fieldNames = new Array(arguments.length),\n index = 0;\n while (index < arguments.length)\n fieldNames[index] = arguments[index++];\n return function oneOfDecorator(prototype, oneofName) {\n util.decorateType(prototype.constructor)\n .add(new OneOf(oneofName, fieldNames));\n Object.defineProperty(prototype, oneofName, {\n get: util.oneOfGetter(fieldNames),\n set: util.oneOfSetter(fieldNames)\n });\n };\n};\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(35);\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(24);\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(35);\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n","\"use strict\";\nmodule.exports = Root;\n\n// extends Namespace\nvar Namespace = require(21);\n((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = \"Root\";\n\nvar Field = require(15),\n Enum = require(14),\n OneOf = require(23),\n util = require(33);\n\nvar Type, // cyclic\n parse, // might be excluded\n common; // \"\n\n/**\n * Constructs a new root namespace instance.\n * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together.\n * @extends NamespaceBase\n * @constructor\n * @param {Object.} [options] Top level options\n */\nfunction Root(options) {\n Namespace.call(this, \"\", options);\n\n /**\n * Deferred extension fields.\n * @type {Field[]}\n */\n this.deferred = [];\n\n /**\n * Resolved file names of loaded files.\n * @type {string[]}\n */\n this.files = [];\n}\n\n/**\n * Loads a namespace descriptor into a root namespace.\n * @param {INamespace} json Nameespace descriptor\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted\n * @returns {Root} Root namespace\n */\nRoot.fromJSON = function fromJSON(json, root) {\n if (!root)\n root = new Root();\n if (json.options)\n root.setOptions(json.options);\n return root.addJSON(json.nested);\n};\n\n/**\n * Resolves the path of an imported file, relative to the importing origin.\n * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories.\n * @function\n * @param {string} origin The file name of the importing file\n * @param {string} target The file name being imported\n * @returns {string|null} Resolved path to `target` or `null` to skip the file\n */\nRoot.prototype.resolvePath = util.path.resolve;\n\n/**\n * Fetch content from file path or url\n * This method exists so you can override it with your own logic.\n * @function\n * @param {string} path File path or url\n * @param {FetchCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.fetch = util.fetch;\n\n// A symbol-like function to safely signal synchronous loading\n/* istanbul ignore next */\nfunction SYNC() {} // eslint-disable-line no-empty-function\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} options Parse options\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.load = function load(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = undefined;\n }\n var self = this;\n if (!callback)\n return util.asPromise(load, self, filename, options);\n\n var sync = callback === SYNC; // undocumented\n\n // Finishes loading by calling the callback (exactly once)\n function finish(err, root) {\n /* istanbul ignore if */\n if (!callback)\n return;\n var cb = callback;\n callback = null;\n if (sync)\n throw err;\n cb(err, root);\n }\n\n // Bundled definition existence checking\n function getBundledFileName(filename) {\n var idx = filename.lastIndexOf(\"google/protobuf/\");\n if (idx > -1) {\n var altname = filename.substring(idx);\n if (altname in common) return altname;\n }\n return null;\n }\n\n // Processes a single file\n function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }\n\n // Fetches a single file\n function fetch(filename, weak) {\n\n // Skip if already loaded / attempted\n if (self.files.indexOf(filename) > -1)\n return;\n self.files.push(filename);\n\n // Shortcut bundled definitions\n if (filename in common) {\n if (sync)\n process(filename, common[filename]);\n else {\n ++queued;\n setTimeout(function() {\n --queued;\n process(filename, common[filename]);\n });\n }\n return;\n }\n\n // Otherwise fetch from disk or network\n if (sync) {\n var source;\n try {\n source = util.fs.readFileSync(filename).toString(\"utf8\");\n } catch (err) {\n if (!weak)\n finish(err);\n return;\n }\n process(filename, source);\n } else {\n ++queued;\n self.fetch(filename, function(err, source) {\n --queued;\n /* istanbul ignore if */\n if (!callback)\n return; // terminated meanwhile\n if (err) {\n /* istanbul ignore else */\n if (!weak)\n finish(err);\n else if (!queued) // can't be covered reliably\n finish(null, self);\n return;\n }\n process(filename, source);\n });\n }\n }\n var queued = 0;\n\n // Assembling the root namespace doesn't require working type\n // references anymore, so we can load everything in parallel\n if (util.isString(filename))\n filename = [ filename ];\n for (var i = 0, resolved; i < filename.length; ++i)\n if (resolved = self.resolvePath(\"\", filename[i]))\n fetch(resolved);\n\n if (sync)\n return self;\n if (!queued)\n finish(null, self);\n return undefined;\n};\n// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Promise} Promise\n * @variation 3\n */\n// function load(filename:string, [options:IParseOptions]):Promise\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).\n * @function Root#loadSync\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n */\nRoot.prototype.loadSync = function loadSync(filename, options) {\n if (!util.isNode)\n throw Error(\"not supported\");\n return this.load(filename, options, SYNC);\n};\n\n/**\n * @override\n */\nRoot.prototype.resolveAll = function resolveAll() {\n if (this.deferred.length)\n throw Error(\"unresolvable extensions: \" + this.deferred.map(function(field) {\n return \"'extend \" + field.extend + \"' in \" + field.parent.fullName;\n }).join(\", \"));\n return Namespace.prototype.resolveAll.call(this);\n};\n\n// only uppercased (and thus conflict-free) children are exposed, see below\nvar exposeRe = /^[A-Z]/;\n\n/**\n * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type.\n * @param {Root} root Root instance\n * @param {Field} field Declaring extension field witin the declaring type\n * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise\n * @inner\n * @ignore\n */\nfunction tryHandleExtension(root, field) {\n var extendedType = field.parent.lookup(field.extend);\n if (extendedType) {\n var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);\n sisterField.declaringField = field;\n field.extensionField = sisterField;\n extendedType.add(sisterField);\n return true;\n }\n return false;\n}\n\n/**\n * Called when any object is added to this root or its sub-namespaces.\n * @param {ReflectionObject} object Object added\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleAdd = function _handleAdd(object) {\n if (object instanceof Field) {\n\n if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField)\n if (!tryHandleExtension(this, object))\n this.deferred.push(object);\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n object.parent[object.name] = object.values; // expose enum values as property of its parent\n\n } else if (!(object instanceof OneOf)) /* everything else is a namespace */ {\n\n if (object instanceof Type) // Try to handle any deferred extensions\n for (var i = 0; i < this.deferred.length;)\n if (tryHandleExtension(this, this.deferred[i]))\n this.deferred.splice(i, 1);\n else\n ++i;\n for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace\n this._handleAdd(object._nestedArray[j]);\n if (exposeRe.test(object.name))\n object.parent[object.name] = object; // expose namespace as property of its parent\n }\n\n // The above also adds uppercased (and thus conflict-free) nested types, services and enums as\n // properties of namespaces just like static code does. This allows using a .d.ts generated for\n // a static module with reflection-based solutions where the condition is met.\n};\n\n/**\n * Called when any object is removed from this root or its sub-namespaces.\n * @param {ReflectionObject} object Object removed\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleRemove = function _handleRemove(object) {\n if (object instanceof Field) {\n\n if (/* an extension field */ object.extend !== undefined) {\n if (/* already handled */ object.extensionField) { // remove its sister field\n object.extensionField.parent.remove(object.extensionField);\n object.extensionField = null;\n } else { // cancel the extension\n var index = this.deferred.indexOf(object);\n /* istanbul ignore else */\n if (index > -1)\n this.deferred.splice(index, 1);\n }\n }\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose enum values\n\n } else if (object instanceof Namespace) {\n\n for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace\n this._handleRemove(object._nestedArray[i]);\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose namespaces\n\n }\n};\n\n// Sets up cyclic dependencies (called in index-light)\nRoot._configure = function(Type_, parse_, common_) {\n Type = Type_;\n parse = parse_;\n common = common_;\n};\n","\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n","\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(29);\n","\"use strict\";\nmodule.exports = Service;\n\nvar util = require(35);\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n","\"use strict\";\nmodule.exports = Service;\n\n// extends Namespace\nvar Namespace = require(21);\n((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = \"Service\";\n\nvar Method = require(20),\n util = require(33),\n rpc = require(28);\n\n/**\n * Constructs a new service instance.\n * @classdesc Reflected service.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Service name\n * @param {Object.} [options] Service options\n * @throws {TypeError} If arguments are invalid\n */\nfunction Service(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Service methods.\n * @type {Object.}\n */\n this.methods = {}; // toJSON, marker\n\n /**\n * Cached methods as an array.\n * @type {Method[]|null}\n * @private\n */\n this._methodsArray = null;\n}\n\n/**\n * Service descriptor.\n * @interface IService\n * @extends INamespace\n * @property {Object.} methods Method descriptors\n */\n\n/**\n * Constructs a service from a service descriptor.\n * @param {string} name Service name\n * @param {IService} json Service descriptor\n * @returns {Service} Created service\n * @throws {TypeError} If arguments are invalid\n */\nService.fromJSON = function fromJSON(name, json) {\n var service = new Service(name, json.options);\n /* istanbul ignore else */\n if (json.methods)\n for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)\n service.add(Method.fromJSON(names[i], json.methods[names[i]]));\n if (json.nested)\n service.addJSON(json.nested);\n service.comment = json.comment;\n return service;\n};\n\n/**\n * Converts this service to a service descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IService} Service descriptor\n */\nService.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"methods\" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {},\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Methods of this service as an array for iteration.\n * @name Service#methodsArray\n * @type {Method[]}\n * @readonly\n */\nObject.defineProperty(Service.prototype, \"methodsArray\", {\n get: function() {\n return this._methodsArray || (this._methodsArray = util.toArray(this.methods));\n }\n});\n\nfunction clearCache(service) {\n service._methodsArray = null;\n return service;\n}\n\n/**\n * @override\n */\nService.prototype.get = function get(name) {\n return this.methods[name]\n || Namespace.prototype.get.call(this, name);\n};\n\n/**\n * @override\n */\nService.prototype.resolveAll = function resolveAll() {\n var methods = this.methodsArray;\n for (var i = 0; i < methods.length; ++i)\n methods[i].resolve();\n return Namespace.prototype.resolve.call(this);\n};\n\n/**\n * @override\n */\nService.prototype.add = function add(object) {\n\n /* istanbul ignore if */\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Method) {\n this.methods[object.name] = object;\n object.parent = this;\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * @override\n */\nService.prototype.remove = function remove(object) {\n if (object instanceof Method) {\n\n /* istanbul ignore if */\n if (this.methods[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.methods[object.name];\n object.parent = null;\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Creates a runtime service using the specified rpc implementation.\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed.\n */\nService.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {\n var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);\n for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {\n var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\\w_]/g, \"\");\n rpcService[methodName] = util.codegen([\"r\",\"c\"], util.isReserved(methodName) ? methodName + \"_\" : methodName)(\"return this.rpcCall(m,q,s,r,c)\")({\n m: method,\n q: method.resolvedRequestType.ctor,\n s: method.resolvedResponseType.ctor\n });\n }\n return rpcService;\n};\n","\"use strict\";\nmodule.exports = Type;\n\n// extends Namespace\nvar Namespace = require(21);\n((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = \"Type\";\n\nvar Enum = require(14),\n OneOf = require(23),\n Field = require(15),\n MapField = require(18),\n Service = require(30),\n Message = require(19),\n Reader = require(24),\n Writer = require(38),\n util = require(33),\n encoder = require(13),\n decoder = require(12),\n verifier = require(36),\n converter = require(11),\n wrappers = require(37);\n\n/**\n * Constructs a new reflected message type instance.\n * @classdesc Reflected message type.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Message name\n * @param {Object.} [options] Declared options\n */\nfunction Type(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Message fields.\n * @type {Object.}\n */\n this.fields = {}; // toJSON, marker\n\n /**\n * Oneofs declared within this namespace, if any.\n * @type {Object.}\n */\n this.oneofs = undefined; // toJSON\n\n /**\n * Extension ranges, if any.\n * @type {number[][]}\n */\n this.extensions = undefined; // toJSON\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n /*?\n * Whether this type is a legacy group.\n * @type {boolean|undefined}\n */\n this.group = undefined; // toJSON\n\n /**\n * Cached fields by id.\n * @type {Object.|null}\n * @private\n */\n this._fieldsById = null;\n\n /**\n * Cached fields as an array.\n * @type {Field[]|null}\n * @private\n */\n this._fieldsArray = null;\n\n /**\n * Cached oneofs as an array.\n * @type {OneOf[]|null}\n * @private\n */\n this._oneofsArray = null;\n\n /**\n * Cached constructor.\n * @type {Constructor<{}>}\n * @private\n */\n this._ctor = null;\n}\n\nObject.defineProperties(Type.prototype, {\n\n /**\n * Message fields by id.\n * @name Type#fieldsById\n * @type {Object.}\n * @readonly\n */\n fieldsById: {\n get: function() {\n\n /* istanbul ignore if */\n if (this._fieldsById)\n return this._fieldsById;\n\n this._fieldsById = {};\n for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {\n var field = this.fields[names[i]],\n id = field.id;\n\n /* istanbul ignore if */\n if (this._fieldsById[id])\n throw Error(\"duplicate id \" + id + \" in \" + this);\n\n this._fieldsById[id] = field;\n }\n return this._fieldsById;\n }\n },\n\n /**\n * Fields of this message as an array for iteration.\n * @name Type#fieldsArray\n * @type {Field[]}\n * @readonly\n */\n fieldsArray: {\n get: function() {\n return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));\n }\n },\n\n /**\n * Oneofs of this message as an array for iteration.\n * @name Type#oneofsArray\n * @type {OneOf[]}\n * @readonly\n */\n oneofsArray: {\n get: function() {\n return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));\n }\n },\n\n /**\n * The registered constructor, if any registered, otherwise a generic constructor.\n * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.\n * @name Type#ctor\n * @type {Constructor<{}>}\n */\n ctor: {\n get: function() {\n return this._ctor || (this.ctor = Type.generateConstructor(this)());\n },\n set: function(ctor) {\n\n // Ensure proper prototype\n var prototype = ctor.prototype;\n if (!(prototype instanceof Message)) {\n (ctor.prototype = new Message()).constructor = ctor;\n util.merge(ctor.prototype, prototype);\n }\n\n // Classes and messages reference their reflected type\n ctor.$type = ctor.prototype.$type = this;\n\n // Mix in static methods\n util.merge(ctor, Message, true);\n\n this._ctor = ctor;\n\n // Messages have non-enumerable default values on their prototype\n var i = 0;\n for (; i < /* initializes */ this.fieldsArray.length; ++i)\n this._fieldsArray[i].resolve(); // ensures a proper value\n\n // Messages have non-enumerable getters and setters for each virtual oneof field\n var ctorProperties = {};\n for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i)\n ctorProperties[this._oneofsArray[i].resolve().name] = {\n get: util.oneOfGetter(this._oneofsArray[i].oneof),\n set: util.oneOfSetter(this._oneofsArray[i].oneof)\n };\n if (i)\n Object.defineProperties(ctor.prototype, ctorProperties);\n }\n }\n});\n\n/**\n * Generates a constructor function for the specified type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nType.generateConstructor = function generateConstructor(mtype) {\n /* eslint-disable no-unexpected-multiline */\n var gen = util.codegen([\"p\"], mtype.name);\n // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype\n for (var i = 0, field; i < mtype.fieldsArray.length; ++i)\n if ((field = mtype._fieldsArray[i]).map) gen\n (\"this%s={}\", util.safeProp(field.name));\n else if (field.repeated) gen\n (\"this%s=[]\", util.safeProp(field.name));\n return gen\n (\"if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors\n * @property {Object.} fields Field descriptors\n * @property {number[][]} [extensions] Extension ranges\n * @property {number[][]} [reserved] Reserved ranges\n * @property {boolean} [group=false] Whether a legacy group or not\n */\n\n/**\n * Creates a message type from a message type descriptor.\n * @param {string} name Message name\n * @param {IType} json Message type descriptor\n * @returns {Type} Created message type\n */\nType.fromJSON = function fromJSON(name, json) {\n var type = new Type(name, json.options);\n type.extensions = json.extensions;\n type.reserved = json.reserved;\n var names = Object.keys(json.fields),\n i = 0;\n for (; i < names.length; ++i)\n type.add(\n ( typeof json.fields[names[i]].keyType !== \"undefined\"\n ? MapField.fromJSON\n : Field.fromJSON )(names[i], json.fields[names[i]])\n );\n if (json.oneofs)\n for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)\n type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));\n if (json.nested)\n for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {\n var nested = json.nested[names[i]];\n type.add( // most to least likely\n ( nested.id !== undefined\n ? Field.fromJSON\n : nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n if (json.extensions && json.extensions.length)\n type.extensions = json.extensions;\n if (json.reserved && json.reserved.length)\n type.reserved = json.reserved;\n if (json.group)\n type.group = true;\n if (json.comment)\n type.comment = json.comment;\n return type;\n};\n\n/**\n * Converts this message type to a message type descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IType} Message type descriptor\n */\nType.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"oneofs\" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),\n \"fields\" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {},\n \"extensions\" , this.extensions && this.extensions.length ? this.extensions : undefined,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"group\" , this.group || undefined,\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nType.prototype.resolveAll = function resolveAll() {\n var fields = this.fieldsArray, i = 0;\n while (i < fields.length)\n fields[i++].resolve();\n var oneofs = this.oneofsArray; i = 0;\n while (i < oneofs.length)\n oneofs[i++].resolve();\n return Namespace.prototype.resolveAll.call(this);\n};\n\n/**\n * @override\n */\nType.prototype.get = function get(name) {\n return this.fields[name]\n || this.oneofs && this.oneofs[name]\n || this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Adds a nested object to this type.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id\n */\nType.prototype.add = function add(object) {\n\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Field && object.extend === undefined) {\n // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects.\n // The root object takes care of adding distinct sister-fields to the respective extended\n // type instead.\n\n // avoids calling the getter if not absolutely necessary because it's called quite frequently\n if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id])\n throw Error(\"duplicate id \" + object.id + \" in \" + this);\n if (this.isReservedId(object.id))\n throw Error(\"id \" + object.id + \" is reserved in \" + this);\n if (this.isReservedName(object.name))\n throw Error(\"name '\" + object.name + \"' is reserved in \" + this);\n\n if (object.parent)\n object.parent.remove(object);\n this.fields[object.name] = object;\n object.message = this;\n object.onAdd(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n if (!this.oneofs)\n this.oneofs = {};\n this.oneofs[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * Removes a nested object from this type.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this type\n */\nType.prototype.remove = function remove(object) {\n if (object instanceof Field && object.extend === undefined) {\n // See Type#add for the reason why extension fields are excluded here.\n\n /* istanbul ignore if */\n if (!this.fields || this.fields[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.fields[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n\n /* istanbul ignore if */\n if (!this.oneofs || this.oneofs[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.oneofs[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message<{}>} Message instance\n */\nType.prototype.create = function create(properties) {\n return new this.ctor(properties);\n};\n\n/**\n * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.\n * @returns {Type} `this`\n */\nType.prototype.setup = function setup() {\n // Sets up everything at once so that the prototype chain does not have to be re-evaluated\n // multiple times (V8, soft-deopt prototype-check).\n\n var fullName = this.fullName,\n types = [];\n for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i)\n types.push(this._fieldsArray[i].resolve().resolvedType);\n\n // Replace setup methods with type-specific generated functions\n this.encode = encoder(this)({\n Writer : Writer,\n types : types,\n util : util\n });\n this.decode = decoder(this)({\n Reader : Reader,\n types : types,\n util : util\n });\n this.verify = verifier(this)({\n types : types,\n util : util\n });\n this.fromObject = converter.fromObject(this)({\n types : types,\n util : util\n });\n this.toObject = converter.toObject(this)({\n types : types,\n util : util\n });\n\n // Inject custom wrappers for common types\n var wrapper = wrappers[fullName];\n if (wrapper) {\n var originalThis = Object.create(this);\n // if (wrapper.fromObject) {\n originalThis.fromObject = this.fromObject;\n this.fromObject = wrapper.fromObject.bind(originalThis);\n // }\n // if (wrapper.toObject) {\n originalThis.toObject = this.toObject;\n this.toObject = wrapper.toObject.bind(originalThis);\n // }\n }\n\n return this;\n};\n\n/**\n * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encode = function encode_setup(message, writer) {\n return this.setup().encode(message, writer); // overrides this method\n};\n\n/**\n * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();\n};\n\n/**\n * Decodes a message of this type.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Length of the message, if known beforehand\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError<{}>} If required fields are missing\n */\nType.prototype.decode = function decode_setup(reader, length) {\n return this.setup().decode(reader, length); // overrides this method\n};\n\n/**\n * Decodes a message of this type preceeded by its byte length as a varint.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError} If required fields are missing\n */\nType.prototype.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof Reader))\n reader = Reader.create(reader);\n return this.decode(reader, reader.uint32());\n};\n\n/**\n * Verifies that field values are valid and that required fields are present.\n * @param {Object.} message Plain object to verify\n * @returns {null|string} `null` if valid, otherwise the reason why it is not\n */\nType.prototype.verify = function verify_setup(message) {\n return this.setup().verify(message); // overrides this method\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object to convert\n * @returns {Message<{}>} Message instance\n */\nType.prototype.fromObject = function fromObject(object) {\n return this.setup().fromObject(object);\n};\n\n/**\n * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.\n * @interface IConversionOptions\n * @property {Function} [longs] Long conversion type.\n * Valid values are `String` and `Number` (the global types).\n * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.\n * @property {Function} [enums] Enum value conversion type.\n * Only valid value is `String` (the global type).\n * Defaults to copy the present value, which is the numeric id.\n * @property {Function} [bytes] Bytes value conversion type.\n * Valid values are `Array` and (a base64 encoded) `String` (the global types).\n * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser.\n * @property {boolean} [defaults=false] Also sets default values on the resulting object\n * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false`\n * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false`\n * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any\n * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings\n */\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\nType.prototype.toObject = function toObject(message, options) {\n return this.setup().toObject(message, options);\n};\n\n/**\n * Decorator function as returned by {@link Type.d} (TypeScript).\n * @typedef TypeDecorator\n * @type {function}\n * @param {Constructor} target Target constructor\n * @returns {undefined}\n * @template T extends Message\n */\n\n/**\n * Type decorator (TypeScript).\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {TypeDecorator} Decorator function\n * @template T extends Message\n */\nType.d = function decorateType(typeName) {\n return function typeDecorator(target) {\n util.decorateType(target, typeName);\n };\n};\n","\"use strict\";\n\n/**\n * Common type constants.\n * @namespace\n */\nvar types = exports;\n\nvar util = require(33);\n\nvar s = [\n \"double\", // 0\n \"float\", // 1\n \"int32\", // 2\n \"uint32\", // 3\n \"sint32\", // 4\n \"fixed32\", // 5\n \"sfixed32\", // 6\n \"int64\", // 7\n \"uint64\", // 8\n \"sint64\", // 9\n \"fixed64\", // 10\n \"sfixed64\", // 11\n \"bool\", // 12\n \"string\", // 13\n \"bytes\" // 14\n];\n\nfunction bake(values, offset) {\n var i = 0, o = {};\n offset |= 0;\n while (i < values.length) o[s[i + offset]] = values[i++];\n return o;\n}\n\n/**\n * Basic type wire types.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n * @property {number} bytes=2 Ldelim wire type\n */\ntypes.basic = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2,\n /* bytes */ 2\n]);\n\n/**\n * Basic type defaults.\n * @type {Object.}\n * @const\n * @property {number} double=0 Double default\n * @property {number} float=0 Float default\n * @property {number} int32=0 Int32 default\n * @property {number} uint32=0 Uint32 default\n * @property {number} sint32=0 Sint32 default\n * @property {number} fixed32=0 Fixed32 default\n * @property {number} sfixed32=0 Sfixed32 default\n * @property {number} int64=0 Int64 default\n * @property {number} uint64=0 Uint64 default\n * @property {number} sint64=0 Sint32 default\n * @property {number} fixed64=0 Fixed64 default\n * @property {number} sfixed64=0 Sfixed64 default\n * @property {boolean} bool=false Bool default\n * @property {string} string=\"\" String default\n * @property {Array.} bytes=Array(0) Bytes default\n * @property {null} message=null Message default\n */\ntypes.defaults = bake([\n /* double */ 0,\n /* float */ 0,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 0,\n /* sfixed32 */ 0,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 0,\n /* sfixed64 */ 0,\n /* bool */ false,\n /* string */ \"\",\n /* bytes */ util.emptyArray,\n /* message */ null\n]);\n\n/**\n * Basic long type wire types.\n * @type {Object.}\n * @const\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n */\ntypes.long = bake([\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1\n], 7);\n\n/**\n * Allowed types for map keys with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n */\ntypes.mapKey = bake([\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2\n], 2);\n\n/**\n * Allowed types for packed repeated fields with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n */\ntypes.packed = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0\n]);\n","\"use strict\";\n\n/**\n * Various utility functions.\n * @namespace\n */\nvar util = module.exports = require(35);\n\nvar roots = require(27);\n\nvar Type, // cyclic\n Enum;\n\nutil.codegen = require(3);\nutil.fetch = require(5);\nutil.path = require(8);\n\n/**\n * Node's fs module if available.\n * @type {Object.}\n */\nutil.fs = util.inquire(\"fs\");\n\n/**\n * Converts an object's values to an array.\n * @param {Object.} object Object to convert\n * @returns {Array.<*>} Converted array\n */\nutil.toArray = function toArray(object) {\n if (object) {\n var keys = Object.keys(object),\n array = new Array(keys.length),\n index = 0;\n while (index < keys.length)\n array[index] = object[keys[index++]];\n return array;\n }\n return [];\n};\n\n/**\n * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.\n * @param {Array.<*>} array Array to convert\n * @returns {Object.} Converted object\n */\nutil.toObject = function toObject(array) {\n var object = {},\n index = 0;\n while (index < array.length) {\n var key = array[index++],\n val = array[index++];\n if (val !== undefined)\n object[key] = val;\n }\n return object;\n};\n\nvar safePropBackslashRe = /\\\\/g,\n safePropQuoteRe = /\"/g;\n\n/**\n * Tests whether the specified name is a reserved word in JS.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nutil.isReserved = function isReserved(name) {\n return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);\n};\n\n/**\n * Returns a safe property accessor for the specified property name.\n * @param {string} prop Property name\n * @returns {string} Safe accessor\n */\nutil.safeProp = function safeProp(prop) {\n if (!/^[$\\w_]+$/.test(prop) || util.isReserved(prop))\n return \"[\\\"\" + prop.replace(safePropBackslashRe, \"\\\\\\\\\").replace(safePropQuoteRe, \"\\\\\\\"\") + \"\\\"]\";\n return \".\" + prop;\n};\n\n/**\n * Converts the first character of a string to upper case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.ucFirst = function ucFirst(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nvar camelCaseRe = /_([a-z])/g;\n\n/**\n * Converts a string to camel case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.camelCase = function camelCase(str) {\n return str.substring(0, 1)\n + str.substring(1)\n .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });\n};\n\n/**\n * Compares reflected fields by id.\n * @param {Field} a First field\n * @param {Field} b Second field\n * @returns {number} Comparison value\n */\nutil.compareFieldsById = function compareFieldsById(a, b) {\n return a.id - b.id;\n};\n\n/**\n * Decorator helper for types (TypeScript).\n * @param {Constructor} ctor Constructor function\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {Type} Reflected type\n * @template T extends Message\n * @property {Root} root Decorators root\n */\nutil.decorateType = function decorateType(ctor, typeName) {\n\n /* istanbul ignore if */\n if (ctor.$type) {\n if (typeName && ctor.$type.name !== typeName) {\n util.decorateRoot.remove(ctor.$type);\n ctor.$type.name = typeName;\n util.decorateRoot.add(ctor.$type);\n }\n return ctor.$type;\n }\n\n /* istanbul ignore next */\n if (!Type)\n Type = require(31);\n\n var type = new Type(typeName || ctor.name);\n util.decorateRoot.add(type);\n type.ctor = ctor; // sets up .encode, .decode etc.\n Object.defineProperty(ctor, \"$type\", { value: type, enumerable: false });\n Object.defineProperty(ctor.prototype, \"$type\", { value: type, enumerable: false });\n return type;\n};\n\nvar decorateEnumIndex = 0;\n\n/**\n * Decorator helper for enums (TypeScript).\n * @param {Object} object Enum object\n * @returns {Enum} Reflected enum\n */\nutil.decorateEnum = function decorateEnum(object) {\n\n /* istanbul ignore if */\n if (object.$type)\n return object.$type;\n\n /* istanbul ignore next */\n if (!Enum)\n Enum = require(14);\n\n var enm = new Enum(\"Enum\" + decorateEnumIndex++, object);\n util.decorateRoot.add(enm);\n Object.defineProperty(object, \"$type\", { value: enm, enumerable: false });\n return enm;\n};\n\n\n/**\n * Sets the value of a property by property path. If a value already exists, it is turned to an array\n * @param {Object.} dst Destination object\n * @param {string} path dot '.' delimited path of the property to set\n * @param {Object} value the value to set\n * @returns {Object.} Destination object\n */\nutil.setProperty = function setProperty(dst, path, value) {\n function setProp(dst, path, value) {\n var part = path.shift();\n if (path.length > 0) {\n dst[part] = setProp(dst[part] || {}, path, value);\n } else {\n var prevValue = dst[part];\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n dst[part] = value;\n }\n return dst;\n }\n\n if (typeof dst !== \"object\")\n throw TypeError(\"dst must be an object\");\n if (!path)\n throw TypeError(\"path must be specified\");\n\n path = path.split(\".\");\n return setProp(dst, path, value);\n};\n\n/**\n * Decorator root (TypeScript).\n * @name util.decorateRoot\n * @type {Root}\n * @readonly\n */\nObject.defineProperty(util, \"decorateRoot\", {\n get: function() {\n return roots[\"decorated\"] || (roots[\"decorated\"] = new (require(26))());\n }\n});\n","\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(35);\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n","\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(1);\n\n// converts to / from base64 encoded strings\nutil.base64 = require(2);\n\n// base class of rpc.Service\nutil.EventEmitter = require(4);\n\n// float handling accross browsers\nutil.float = require(6);\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(7);\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(10);\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(9);\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(34);\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n","\"use strict\";\nmodule.exports = verifier;\n\nvar Enum = require(14),\n util = require(33);\n\nfunction invalid(field, expected) {\n return field.name + \": \" + expected + (field.repeated && expected !== \"array\" ? \"[]\" : field.map && expected !== \"object\" ? \"{k:\"+field.keyType+\"}\" : \"\") + \" expected\";\n}\n\n/**\n * Generates a partial value verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyValue(gen, field, fieldIndex, ref) {\n /* eslint-disable no-unexpected-multiline */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(%s){\", ref)\n (\"default:\")\n (\"return%j\", invalid(field, \"enum value\"));\n for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen\n (\"case %i:\", field.resolvedType.values[keys[j]]);\n gen\n (\"break\")\n (\"}\");\n } else {\n gen\n (\"{\")\n (\"var e=types[%i].verify(%s);\", fieldIndex, ref)\n (\"if(e)\")\n (\"return%j+e\", field.name + \".\")\n (\"}\");\n }\n } else {\n switch (field.type) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.isInteger(%s))\", ref)\n (\"return%j\", invalid(field, \"integer\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))\", ref, ref, ref, ref)\n (\"return%j\", invalid(field, \"integer|Long\"));\n break;\n case \"float\":\n case \"double\": gen\n (\"if(typeof %s!==\\\"number\\\")\", ref)\n (\"return%j\", invalid(field, \"number\"));\n break;\n case \"bool\": gen\n (\"if(typeof %s!==\\\"boolean\\\")\", ref)\n (\"return%j\", invalid(field, \"boolean\"));\n break;\n case \"string\": gen\n (\"if(!util.isString(%s))\", ref)\n (\"return%j\", invalid(field, \"string\"));\n break;\n case \"bytes\": gen\n (\"if(!(%s&&typeof %s.length===\\\"number\\\"||util.isString(%s)))\", ref, ref, ref)\n (\"return%j\", invalid(field, \"buffer\"));\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a partial key verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyKey(gen, field, ref) {\n /* eslint-disable no-unexpected-multiline */\n switch (field.keyType) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.key32Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"integer key\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.key64Re.test(%s))\", ref) // see comment above: x is ok, d is not\n (\"return%j\", invalid(field, \"integer|Long key\"));\n break;\n case \"bool\": gen\n (\"if(!util.key2Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"boolean key\"));\n break;\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a verifier specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction verifier(mtype) {\n /* eslint-disable no-unexpected-multiline */\n\n var gen = util.codegen([\"m\"], mtype.name + \"$verify\")\n (\"if(typeof m!==\\\"object\\\"||m===null)\")\n (\"return%j\", \"object expected\");\n var oneofs = mtype.oneofsArray,\n seenFirstField = {};\n if (oneofs.length) gen\n (\"var p={}\");\n\n for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n ref = \"m\" + util.safeProp(field.name);\n\n if (field.optional) gen\n (\"if(%s!=null&&m.hasOwnProperty(%j)){\", ref, field.name); // !== undefined && !== null\n\n // map fields\n if (field.map) { gen\n (\"if(!util.isObject(%s))\", ref)\n (\"return%j\", invalid(field, \"object\"))\n (\"var k=Object.keys(%s)\", ref)\n (\"for(var i=0;i}\n * @const\n */\nvar wrappers = exports;\n\nvar Message = require(19);\n\n/**\n * From object converter part of an {@link IWrapper}.\n * @typedef WrapperFromObjectConverter\n * @type {function}\n * @param {Object.} object Plain object\n * @returns {Message<{}>} Message instance\n * @this Type\n */\n\n/**\n * To object converter part of an {@link IWrapper}.\n * @typedef WrapperToObjectConverter\n * @type {function}\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @this Type\n */\n\n/**\n * Common type wrapper part of {@link wrappers}.\n * @interface IWrapper\n * @property {WrapperFromObjectConverter} [fromObject] From object converter\n * @property {WrapperToObjectConverter} [toObject] To object converter\n */\n\n// Custom wrapper for Any\nwrappers[\".google.protobuf.Any\"] = {\n\n fromObject: function(object) {\n\n // unwrap value type if mapped\n if (object && object[\"@type\"]) {\n // Only use fully qualified type name after the last '/'\n var name = object[\"@type\"].substring(object[\"@type\"].lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type) {\n // type_url does not accept leading \".\"\n var type_url = object[\"@type\"].charAt(0) === \".\" ?\n object[\"@type\"].substr(1) : object[\"@type\"];\n // type_url prefix is optional, but path seperator is required\n if (type_url.indexOf(\"/\") === -1) {\n type_url = \"/\" + type_url;\n }\n return this.create({\n type_url: type_url,\n value: type.encode(type.fromObject(object)).finish()\n });\n }\n }\n\n return this.fromObject(object);\n },\n\n toObject: function(message, options) {\n\n // Default prefix\n var googleApi = \"type.googleapis.com/\";\n var prefix = \"\";\n var name = \"\";\n\n // decode value if requested and unmapped\n if (options && options.json && message.type_url && message.value) {\n // Only use fully qualified type name after the last '/'\n name = message.type_url.substring(message.type_url.lastIndexOf(\"/\") + 1);\n // Separate the prefix used\n prefix = message.type_url.substring(0, message.type_url.lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type)\n message = type.decode(message.value);\n }\n\n // wrap value if unmapped\n if (!(message instanceof this.ctor) && message instanceof Message) {\n var object = message.$type.toObject(message, options);\n var messageName = message.$type.fullName[0] === \".\" ?\n message.$type.fullName.substr(1) : message.$type.fullName;\n // Default to type.googleapis.com prefix if no prefix is used\n if (prefix === \"\") {\n prefix = googleApi;\n }\n name = prefix + messageName;\n object[\"@type\"] = name;\n return object;\n }\n\n return this.toObject(message, options);\n }\n};\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(35);\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(38);\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(35);\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n"],"sourceRoot":"."} \ No newline at end of file diff --git a/node_modules/protobufjs/dist/minimal/README.md b/node_modules/protobufjs/dist/minimal/README.md deleted file mode 100644 index 5eeb5718..00000000 --- a/node_modules/protobufjs/dist/minimal/README.md +++ /dev/null @@ -1,31 +0,0 @@ -This folder contains prebuilt browser versions of the minimal library suitable for use with statically generated code only. When sending pull requests, it is not required to update these. - -Prebuilt files are in source control to enable pain-free frontend respectively CDN usage: - -CDN usage ---------- - -Development: -``` - -``` - -Production: -``` - -``` - -**NOTE:** Remember to replace the version tag with the exact [release](https://github.com/dcodeIO/protobuf.js/tags) your project depends upon. - -Frontend usage --------------- - -Development: -``` - -``` - -Production: -``` - -``` diff --git a/node_modules/protobufjs/dist/minimal/protobuf.js b/node_modules/protobufjs/dist/minimal/protobuf.js deleted file mode 100644 index 6d965d9d..00000000 --- a/node_modules/protobufjs/dist/minimal/protobuf.js +++ /dev/null @@ -1,2714 +0,0 @@ -/*! - * protobuf.js v6.10.0 (c) 2016, daniel wirtz - * compiled wed, 15 jul 2020 23:34:13 utc - * licensed under the bsd-3-clause license - * see: https://github.com/dcodeio/protobuf.js for details - */ -(function(undefined){"use strict";(function prelude(modules, cache, entries) { - - // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS - // sources through a conflict-free require shim and is again wrapped within an iife that - // provides a minification-friendly `undefined` var plus a global "use strict" directive - // so that minification can remove the directives of each module. - - function $require(name) { - var $module = cache[name]; - if (!$module) - modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports); - return $module.exports; - } - - var protobuf = $require(entries[0]); - - // Expose globally - protobuf.util.global.protobuf = protobuf; - - // Be nice to AMD - if (typeof define === "function" && define.amd) - define(["long"], function(Long) { - if (Long && Long.isLong) { - protobuf.util.Long = Long; - protobuf.configure(); - } - return protobuf; - }); - - // Be nice to CommonJS - if (typeof module === "object" && module && module.exports) - module.exports = protobuf; - -})/* end of prelude */({1:[function(require,module,exports){ -"use strict"; -module.exports = asPromise; - -/** - * Callback as used by {@link util.asPromise}. - * @typedef asPromiseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {...*} params Additional arguments - * @returns {undefined} - */ - -/** - * Returns a promise from a node-style callback function. - * @memberof util - * @param {asPromiseCallback} fn Function to call - * @param {*} ctx Function context - * @param {...*} params Function arguments - * @returns {Promise<*>} Promisified function - */ -function asPromise(fn, ctx/*, varargs */) { - var params = new Array(arguments.length - 1), - offset = 0, - index = 2, - pending = true; - while (index < arguments.length) - params[offset++] = arguments[index++]; - return new Promise(function executor(resolve, reject) { - params[offset] = function callback(err/*, varargs */) { - if (pending) { - pending = false; - if (err) - reject(err); - else { - var params = new Array(arguments.length - 1), - offset = 0; - while (offset < params.length) - params[offset++] = arguments[offset]; - resolve.apply(null, params); - } - } - }; - try { - fn.apply(ctx || null, params); - } catch (err) { - if (pending) { - pending = false; - reject(err); - } - } - }); -} - -},{}],2:[function(require,module,exports){ -"use strict"; - -/** - * A minimal base64 implementation for number arrays. - * @memberof util - * @namespace - */ -var base64 = exports; - -/** - * Calculates the byte length of a base64 encoded string. - * @param {string} string Base64 encoded string - * @returns {number} Byte length - */ -base64.length = function length(string) { - var p = string.length; - if (!p) - return 0; - var n = 0; - while (--p % 4 > 1 && string.charAt(p) === "=") - ++n; - return Math.ceil(string.length * 3) / 4 - n; -}; - -// Base64 encoding table -var b64 = new Array(64); - -// Base64 decoding table -var s64 = new Array(123); - -// 65..90, 97..122, 48..57, 43, 47 -for (var i = 0; i < 64;) - s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; - -/** - * Encodes a buffer to a base64 encoded string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} Base64 encoded string - */ -base64.encode = function encode(buffer, start, end) { - var parts = null, - chunk = []; - var i = 0, // output index - j = 0, // goto index - t; // temporary - while (start < end) { - var b = buffer[start++]; - switch (j) { - case 0: - chunk[i++] = b64[b >> 2]; - t = (b & 3) << 4; - j = 1; - break; - case 1: - chunk[i++] = b64[t | b >> 4]; - t = (b & 15) << 2; - j = 2; - break; - case 2: - chunk[i++] = b64[t | b >> 6]; - chunk[i++] = b64[b & 63]; - j = 0; - break; - } - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (j) { - chunk[i++] = b64[t]; - chunk[i++] = 61; - if (j === 1) - chunk[i++] = 61; - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -var invalidEncoding = "invalid encoding"; - -/** - * Decodes a base64 encoded string to a buffer. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Number of bytes written - * @throws {Error} If encoding is invalid - */ -base64.decode = function decode(string, buffer, offset) { - var start = offset; - var j = 0, // goto index - t; // temporary - for (var i = 0; i < string.length;) { - var c = string.charCodeAt(i++); - if (c === 61 && j > 1) - break; - if ((c = s64[c]) === undefined) - throw Error(invalidEncoding); - switch (j) { - case 0: - t = c; - j = 1; - break; - case 1: - buffer[offset++] = t << 2 | (c & 48) >> 4; - t = c; - j = 2; - break; - case 2: - buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; - t = c; - j = 3; - break; - case 3: - buffer[offset++] = (t & 3) << 6 | c; - j = 0; - break; - } - } - if (j === 1) - throw Error(invalidEncoding); - return offset - start; -}; - -/** - * Tests if the specified string appears to be base64 encoded. - * @param {string} string String to test - * @returns {boolean} `true` if probably base64 encoded, otherwise false - */ -base64.test = function test(string) { - return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); -}; - -},{}],3:[function(require,module,exports){ -"use strict"; -module.exports = EventEmitter; - -/** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ -function EventEmitter() { - - /** - * Registered listeners. - * @type {Object.} - * @private - */ - this._listeners = {}; -} - -/** - * Registers an event listener. - * @param {string} evt Event name - * @param {function} fn Listener - * @param {*} [ctx] Listener context - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.on = function on(evt, fn, ctx) { - (this._listeners[evt] || (this._listeners[evt] = [])).push({ - fn : fn, - ctx : ctx || this - }); - return this; -}; - -/** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param {string} [evt] Event name. Removes all listeners if omitted. - * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.off = function off(evt, fn) { - if (evt === undefined) - this._listeners = {}; - else { - if (fn === undefined) - this._listeners[evt] = []; - else { - var listeners = this._listeners[evt]; - for (var i = 0; i < listeners.length;) - if (listeners[i].fn === fn) - listeners.splice(i, 1); - else - ++i; - } - } - return this; -}; - -/** - * Emits an event by calling its listeners with the specified arguments. - * @param {string} evt Event name - * @param {...*} args Arguments - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.emit = function emit(evt) { - var listeners = this._listeners[evt]; - if (listeners) { - var args = [], - i = 1; - for (; i < arguments.length;) - args.push(arguments[i++]); - for (i = 0; i < listeners.length;) - listeners[i].fn.apply(listeners[i++].ctx, args); - } - return this; -}; - -},{}],4:[function(require,module,exports){ -"use strict"; - -module.exports = factory(factory); - -/** - * Reads / writes floats / doubles from / to buffers. - * @name util.float - * @namespace - */ - -/** - * Writes a 32 bit float to a buffer using little endian byte order. - * @name util.float.writeFloatLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 32 bit float to a buffer using big endian byte order. - * @name util.float.writeFloatBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 32 bit float from a buffer using little endian byte order. - * @name util.float.readFloatLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 32 bit float from a buffer using big endian byte order. - * @name util.float.readFloatBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Writes a 64 bit double to a buffer using little endian byte order. - * @name util.float.writeDoubleLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 64 bit double to a buffer using big endian byte order. - * @name util.float.writeDoubleBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 64 bit double from a buffer using little endian byte order. - * @name util.float.readDoubleLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 64 bit double from a buffer using big endian byte order. - * @name util.float.readDoubleBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -// Factory function for the purpose of node-based testing in modified global environments -function factory(exports) { - - // float: typed array - if (typeof Float32Array !== "undefined") (function() { - - var f32 = new Float32Array([ -0 ]), - f8b = new Uint8Array(f32.buffer), - le = f8b[3] === 128; - - function writeFloat_f32_cpy(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - } - - function writeFloat_f32_rev(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[3]; - buf[pos + 1] = f8b[2]; - buf[pos + 2] = f8b[1]; - buf[pos + 3] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; - /* istanbul ignore next */ - exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; - - function readFloat_f32_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - return f32[0]; - } - - function readFloat_f32_rev(buf, pos) { - f8b[3] = buf[pos ]; - f8b[2] = buf[pos + 1]; - f8b[1] = buf[pos + 2]; - f8b[0] = buf[pos + 3]; - return f32[0]; - } - - /* istanbul ignore next */ - exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; - /* istanbul ignore next */ - exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; - - // float: ieee754 - })(); else (function() { - - function writeFloat_ieee754(writeUint, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); - else if (isNaN(val)) - writeUint(2143289344, buf, pos); - else if (val > 3.4028234663852886e+38) // +-Infinity - writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); - else if (val < 1.1754943508222875e-38) // denormal - writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); - else { - var exponent = Math.floor(Math.log(val) / Math.LN2), - mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; - writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); - } - } - - exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); - exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); - - function readFloat_ieee754(readUint, buf, pos) { - var uint = readUint(buf, pos), - sign = (uint >> 31) * 2 + 1, - exponent = uint >>> 23 & 255, - mantissa = uint & 8388607; - return exponent === 255 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 1.401298464324817e-45 * mantissa - : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); - } - - exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); - exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); - - })(); - - // double: typed array - if (typeof Float64Array !== "undefined") (function() { - - var f64 = new Float64Array([-0]), - f8b = new Uint8Array(f64.buffer), - le = f8b[7] === 128; - - function writeDouble_f64_cpy(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - buf[pos + 4] = f8b[4]; - buf[pos + 5] = f8b[5]; - buf[pos + 6] = f8b[6]; - buf[pos + 7] = f8b[7]; - } - - function writeDouble_f64_rev(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[7]; - buf[pos + 1] = f8b[6]; - buf[pos + 2] = f8b[5]; - buf[pos + 3] = f8b[4]; - buf[pos + 4] = f8b[3]; - buf[pos + 5] = f8b[2]; - buf[pos + 6] = f8b[1]; - buf[pos + 7] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; - /* istanbul ignore next */ - exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; - - function readDouble_f64_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - f8b[4] = buf[pos + 4]; - f8b[5] = buf[pos + 5]; - f8b[6] = buf[pos + 6]; - f8b[7] = buf[pos + 7]; - return f64[0]; - } - - function readDouble_f64_rev(buf, pos) { - f8b[7] = buf[pos ]; - f8b[6] = buf[pos + 1]; - f8b[5] = buf[pos + 2]; - f8b[4] = buf[pos + 3]; - f8b[3] = buf[pos + 4]; - f8b[2] = buf[pos + 5]; - f8b[1] = buf[pos + 6]; - f8b[0] = buf[pos + 7]; - return f64[0]; - } - - /* istanbul ignore next */ - exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; - /* istanbul ignore next */ - exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; - - // double: ieee754 - })(); else (function() { - - function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) { - writeUint(0, buf, pos + off0); - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); - } else if (isNaN(val)) { - writeUint(0, buf, pos + off0); - writeUint(2146959360, buf, pos + off1); - } else if (val > 1.7976931348623157e+308) { // +-Infinity - writeUint(0, buf, pos + off0); - writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); - } else { - var mantissa; - if (val < 2.2250738585072014e-308) { // denormal - mantissa = val / 5e-324; - writeUint(mantissa >>> 0, buf, pos + off0); - writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); - } else { - var exponent = Math.floor(Math.log(val) / Math.LN2); - if (exponent === 1024) - exponent = 1023; - mantissa = val * Math.pow(2, -exponent); - writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); - writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); - } - } - } - - exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); - exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); - - function readDouble_ieee754(readUint, off0, off1, buf, pos) { - var lo = readUint(buf, pos + off0), - hi = readUint(buf, pos + off1); - var sign = (hi >> 31) * 2 + 1, - exponent = hi >>> 20 & 2047, - mantissa = 4294967296 * (hi & 1048575) + lo; - return exponent === 2047 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 5e-324 * mantissa - : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); - } - - exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); - exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); - - })(); - - return exports; -} - -// uint helpers - -function writeUintLE(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -function writeUintBE(val, buf, pos) { - buf[pos ] = val >>> 24; - buf[pos + 1] = val >>> 16 & 255; - buf[pos + 2] = val >>> 8 & 255; - buf[pos + 3] = val & 255; -} - -function readUintLE(buf, pos) { - return (buf[pos ] - | buf[pos + 1] << 8 - | buf[pos + 2] << 16 - | buf[pos + 3] << 24) >>> 0; -} - -function readUintBE(buf, pos) { - return (buf[pos ] << 24 - | buf[pos + 1] << 16 - | buf[pos + 2] << 8 - | buf[pos + 3]) >>> 0; -} - -},{}],5:[function(require,module,exports){ -"use strict"; -module.exports = inquire; - -/** - * Requires a module only if available. - * @memberof util - * @param {string} moduleName Module to require - * @returns {?Object} Required module if available and not empty, otherwise `null` - */ -function inquire(moduleName) { - try { - var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval - if (mod && (mod.length || Object.keys(mod).length)) - return mod; - } catch (e) {} // eslint-disable-line no-empty - return null; -} - -},{}],6:[function(require,module,exports){ -"use strict"; -module.exports = pool; - -/** - * An allocator as used by {@link util.pool}. - * @typedef PoolAllocator - * @type {function} - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ - -/** - * A slicer as used by {@link util.pool}. - * @typedef PoolSlicer - * @type {function} - * @param {number} start Start offset - * @param {number} end End offset - * @returns {Uint8Array} Buffer slice - * @this {Uint8Array} - */ - -/** - * A general purpose buffer pool. - * @memberof util - * @function - * @param {PoolAllocator} alloc Allocator - * @param {PoolSlicer} slice Slicer - * @param {number} [size=8192] Slab size - * @returns {PoolAllocator} Pooled allocator - */ -function pool(alloc, slice, size) { - var SIZE = size || 8192; - var MAX = SIZE >>> 1; - var slab = null; - var offset = SIZE; - return function pool_alloc(size) { - if (size < 1 || size > MAX) - return alloc(size); - if (offset + size > SIZE) { - slab = alloc(SIZE); - offset = 0; - } - var buf = slice.call(slab, offset, offset += size); - if (offset & 7) // align to 32 bit - offset = (offset | 7) + 1; - return buf; - }; -} - -},{}],7:[function(require,module,exports){ -"use strict"; - -/** - * A minimal UTF8 implementation for number arrays. - * @memberof util - * @namespace - */ -var utf8 = exports; - -/** - * Calculates the UTF8 byte length of a string. - * @param {string} string String - * @returns {number} Byte length - */ -utf8.length = function utf8_length(string) { - var len = 0, - c = 0; - for (var i = 0; i < string.length; ++i) { - c = string.charCodeAt(i); - if (c < 128) - len += 1; - else if (c < 2048) - len += 2; - else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { - ++i; - len += 4; - } else - len += 3; - } - return len; -}; - -/** - * Reads UTF8 bytes as a string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} String read - */ -utf8.read = function utf8_read(buffer, start, end) { - var len = end - start; - if (len < 1) - return ""; - var parts = null, - chunk = [], - i = 0, // char offset - t; // temporary - while (start < end) { - t = buffer[start++]; - if (t < 128) - chunk[i++] = t; - else if (t > 191 && t < 224) - chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; - else if (t > 239 && t < 365) { - t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; - chunk[i++] = 0xD800 + (t >> 10); - chunk[i++] = 0xDC00 + (t & 1023); - } else - chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -/** - * Writes a string as UTF8 bytes. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Bytes written - */ -utf8.write = function utf8_write(string, buffer, offset) { - var start = offset, - c1, // character 1 - c2; // character 2 - for (var i = 0; i < string.length; ++i) { - c1 = string.charCodeAt(i); - if (c1 < 128) { - buffer[offset++] = c1; - } else if (c1 < 2048) { - buffer[offset++] = c1 >> 6 | 192; - buffer[offset++] = c1 & 63 | 128; - } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - ++i; - buffer[offset++] = c1 >> 18 | 240; - buffer[offset++] = c1 >> 12 & 63 | 128; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } else { - buffer[offset++] = c1 >> 12 | 224; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } - } - return offset - start; -}; - -},{}],8:[function(require,module,exports){ -"use strict"; -var protobuf = exports; - -/** - * Build type, one of `"full"`, `"light"` or `"minimal"`. - * @name build - * @type {string} - * @const - */ -protobuf.build = "minimal"; - -// Serialization -protobuf.Writer = require(16); -protobuf.BufferWriter = require(17); -protobuf.Reader = require(9); -protobuf.BufferReader = require(10); - -// Utility -protobuf.util = require(15); -protobuf.rpc = require(12); -protobuf.roots = require(11); -protobuf.configure = configure; - -/* istanbul ignore next */ -/** - * Reconfigures the library according to the environment. - * @returns {undefined} - */ -function configure() { - protobuf.util._configure(); - protobuf.Writer._configure(protobuf.BufferWriter); - protobuf.Reader._configure(protobuf.BufferReader); -} - -// Set up buffer utility according to the environment -configure(); - -},{"10":10,"11":11,"12":12,"15":15,"16":16,"17":17,"9":9}],9:[function(require,module,exports){ -"use strict"; -module.exports = Reader; - -var util = require(15); - -var BufferReader; // cyclic - -var LongBits = util.LongBits, - utf8 = util.utf8; - -/* istanbul ignore next */ -function indexOutOfRange(reader, writeLength) { - return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); -} - -/** - * Constructs a new reader instance using the specified buffer. - * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. - * @constructor - * @param {Uint8Array} buffer Buffer to read from - */ -function Reader(buffer) { - - /** - * Read buffer. - * @type {Uint8Array} - */ - this.buf = buffer; - - /** - * Read buffer position. - * @type {number} - */ - this.pos = 0; - - /** - * Read buffer length. - * @type {number} - */ - this.len = buffer.length; -} - -var create_array = typeof Uint8Array !== "undefined" - ? function create_typed_array(buffer) { - if (buffer instanceof Uint8Array || Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - } - /* istanbul ignore next */ - : function create_array(buffer) { - if (Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - }; - -var create = function create() { - return util.Buffer - ? function create_buffer_setup(buffer) { - return (Reader.create = function create_buffer(buffer) { - return util.Buffer.isBuffer(buffer) - ? new BufferReader(buffer) - /* istanbul ignore next */ - : create_array(buffer); - })(buffer); - } - /* istanbul ignore next */ - : create_array; -}; - -/** - * Creates a new reader using the specified buffer. - * @function - * @param {Uint8Array|Buffer} buffer Buffer to read from - * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} - * @throws {Error} If `buffer` is not a valid buffer - */ -Reader.create = create(); - -Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; - -/** - * Reads a varint as an unsigned 32 bit value. - * @function - * @returns {number} Value read - */ -Reader.prototype.uint32 = (function read_uint32_setup() { - var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) - return function read_uint32() { - value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; - - /* istanbul ignore if */ - if ((this.pos += 5) > this.len) { - this.pos = this.len; - throw indexOutOfRange(this, 10); - } - return value; - }; -})(); - -/** - * Reads a varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.int32 = function read_int32() { - return this.uint32() | 0; -}; - -/** - * Reads a zig-zag encoded varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.sint32 = function read_sint32() { - var value = this.uint32(); - return value >>> 1 ^ -(value & 1) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readLongVarint() { - // tends to deopt with local vars for octet etc. - var bits = new LongBits(0, 0); - var i = 0; - if (this.len - this.pos > 4) { // fast route (lo) - for (; i < 4; ++i) { - // 1st..4th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 5th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; - bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - i = 0; - } else { - for (; i < 3; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 1st..3th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 4th - bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; - return bits; - } - if (this.len - this.pos > 4) { // fast route (hi) - for (; i < 5; ++i) { - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } else { - for (; i < 5; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } - /* istanbul ignore next */ - throw Error("invalid varint encoding"); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads a varint as a signed 64 bit value. - * @name Reader#int64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as an unsigned 64 bit value. - * @name Reader#uint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a zig-zag encoded varint as a signed 64 bit value. - * @name Reader#sint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as a boolean. - * @returns {boolean} Value read - */ -Reader.prototype.bool = function read_bool() { - return this.uint32() !== 0; -}; - -function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` - return (buf[end - 4] - | buf[end - 3] << 8 - | buf[end - 2] << 16 - | buf[end - 1] << 24) >>> 0; -} - -/** - * Reads fixed 32 bits as an unsigned 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.fixed32 = function read_fixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4); -}; - -/** - * Reads fixed 32 bits as a signed 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.sfixed32 = function read_sfixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readFixed64(/* this: Reader */) { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 8); - - return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads fixed 64 bits. - * @name Reader#fixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads zig-zag encoded fixed 64 bits. - * @name Reader#sfixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a float (32 bit) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.float = function read_float() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readFloatLE(this.buf, this.pos); - this.pos += 4; - return value; -}; - -/** - * Reads a double (64 bit float) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.double = function read_double() { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readDoubleLE(this.buf, this.pos); - this.pos += 8; - return value; -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns {Uint8Array} Value read - */ -Reader.prototype.bytes = function read_bytes() { - var length = this.uint32(), - start = this.pos, - end = this.pos + length; - - /* istanbul ignore if */ - if (end > this.len) - throw indexOutOfRange(this, length); - - this.pos += length; - if (Array.isArray(this.buf)) // plain array - return this.buf.slice(start, end); - return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1 - ? new this.buf.constructor(0) - : this._slice.call(this.buf, start, end); -}; - -/** - * Reads a string preceeded by its byte length as a varint. - * @returns {string} Value read - */ -Reader.prototype.string = function read_string() { - var bytes = this.bytes(); - return utf8.read(bytes, 0, bytes.length); -}; - -/** - * Skips the specified number of bytes if specified, otherwise skips a varint. - * @param {number} [length] Length if known, otherwise a varint is assumed - * @returns {Reader} `this` - */ -Reader.prototype.skip = function skip(length) { - if (typeof length === "number") { - /* istanbul ignore if */ - if (this.pos + length > this.len) - throw indexOutOfRange(this, length); - this.pos += length; - } else { - do { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - } while (this.buf[this.pos++] & 128); - } - return this; -}; - -/** - * Skips the next element of the specified wire type. - * @param {number} wireType Wire type received - * @returns {Reader} `this` - */ -Reader.prototype.skipType = function(wireType) { - switch (wireType) { - case 0: - this.skip(); - break; - case 1: - this.skip(8); - break; - case 2: - this.skip(this.uint32()); - break; - case 3: - while ((wireType = this.uint32() & 7) !== 4) { - this.skipType(wireType); - } - break; - case 5: - this.skip(4); - break; - - /* istanbul ignore next */ - default: - throw Error("invalid wire type " + wireType + " at offset " + this.pos); - } - return this; -}; - -Reader._configure = function(BufferReader_) { - BufferReader = BufferReader_; - Reader.create = create(); - BufferReader._configure(); - - var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; - util.merge(Reader.prototype, { - - int64: function read_int64() { - return readLongVarint.call(this)[fn](false); - }, - - uint64: function read_uint64() { - return readLongVarint.call(this)[fn](true); - }, - - sint64: function read_sint64() { - return readLongVarint.call(this).zzDecode()[fn](false); - }, - - fixed64: function read_fixed64() { - return readFixed64.call(this)[fn](true); - }, - - sfixed64: function read_sfixed64() { - return readFixed64.call(this)[fn](false); - } - - }); -}; - -},{"15":15}],10:[function(require,module,exports){ -"use strict"; -module.exports = BufferReader; - -// extends Reader -var Reader = require(9); -(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; - -var util = require(15); - -/** - * Constructs a new buffer reader instance. - * @classdesc Wire format reader using node buffers. - * @extends Reader - * @constructor - * @param {Buffer} buffer Buffer to read from - */ -function BufferReader(buffer) { - Reader.call(this, buffer); - - /** - * Read buffer. - * @name BufferReader#buf - * @type {Buffer} - */ -} - -BufferReader._configure = function () { - /* istanbul ignore else */ - if (util.Buffer) - BufferReader.prototype._slice = util.Buffer.prototype.slice; -}; - - -/** - * @override - */ -BufferReader.prototype.string = function read_string_buffer() { - var len = this.uint32(); // modifies pos - return this.buf.utf8Slice - ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) - : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @name BufferReader#bytes - * @function - * @returns {Buffer} Value read - */ - -BufferReader._configure(); - -},{"15":15,"9":9}],11:[function(require,module,exports){ -"use strict"; -module.exports = {}; - -/** - * Named roots. - * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). - * Can also be used manually to make roots available accross modules. - * @name roots - * @type {Object.} - * @example - * // pbjs -r myroot -o compiled.js ... - * - * // in another module: - * require("./compiled.js"); - * - * // in any subsequent module: - * var root = protobuf.roots["myroot"]; - */ - -},{}],12:[function(require,module,exports){ -"use strict"; - -/** - * Streaming RPC helpers. - * @namespace - */ -var rpc = exports; - -/** - * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. - * @typedef RPCImpl - * @type {function} - * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called - * @param {Uint8Array} requestData Request data - * @param {RPCImplCallback} callback Callback function - * @returns {undefined} - * @example - * function rpcImpl(method, requestData, callback) { - * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code - * throw Error("no such method"); - * asynchronouslyObtainAResponse(requestData, function(err, responseData) { - * callback(err, responseData); - * }); - * } - */ - -/** - * Node-style callback as used by {@link RPCImpl}. - * @typedef RPCImplCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error - * @returns {undefined} - */ - -rpc.Service = require(13); - -},{"13":13}],13:[function(require,module,exports){ -"use strict"; -module.exports = Service; - -var util = require(15); - -// Extends EventEmitter -(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; - -/** - * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. - * - * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. - * @typedef rpc.ServiceMethodCallback - * @template TRes extends Message - * @type {function} - * @param {Error|null} error Error, if any - * @param {TRes} [response] Response message - * @returns {undefined} - */ - -/** - * A service method part of a {@link rpc.Service} as created by {@link Service.create}. - * @typedef rpc.ServiceMethod - * @template TReq extends Message - * @template TRes extends Message - * @type {function} - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message - * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` - */ - -/** - * Constructs a new RPC service instance. - * @classdesc An RPC service as returned by {@link Service#create}. - * @exports rpc.Service - * @extends util.EventEmitter - * @constructor - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ -function Service(rpcImpl, requestDelimited, responseDelimited) { - - if (typeof rpcImpl !== "function") - throw TypeError("rpcImpl must be a function"); - - util.EventEmitter.call(this); - - /** - * RPC implementation. Becomes `null` once the service is ended. - * @type {RPCImpl|null} - */ - this.rpcImpl = rpcImpl; - - /** - * Whether requests are length-delimited. - * @type {boolean} - */ - this.requestDelimited = Boolean(requestDelimited); - - /** - * Whether responses are length-delimited. - * @type {boolean} - */ - this.responseDelimited = Boolean(responseDelimited); -} - -/** - * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. - * @param {Method|rpc.ServiceMethod} method Reflected or static method - * @param {Constructor} requestCtor Request constructor - * @param {Constructor} responseCtor Response constructor - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} callback Service callback - * @returns {undefined} - * @template TReq extends Message - * @template TRes extends Message - */ -Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { - - if (!request) - throw TypeError("request must be specified"); - - var self = this; - if (!callback) - return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); - - if (!self.rpcImpl) { - setTimeout(function() { callback(Error("already ended")); }, 0); - return undefined; - } - - try { - return self.rpcImpl( - method, - requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), - function rpcCallback(err, response) { - - if (err) { - self.emit("error", err, method); - return callback(err); - } - - if (response === null) { - self.end(/* endedByRPC */ true); - return undefined; - } - - if (!(response instanceof responseCtor)) { - try { - response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); - } catch (err) { - self.emit("error", err, method); - return callback(err); - } - } - - self.emit("data", response, method); - return callback(null, response); - } - ); - } catch (err) { - self.emit("error", err, method); - setTimeout(function() { callback(err); }, 0); - return undefined; - } -}; - -/** - * Ends this service and emits the `end` event. - * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. - * @returns {rpc.Service} `this` - */ -Service.prototype.end = function end(endedByRPC) { - if (this.rpcImpl) { - if (!endedByRPC) // signal end to rpcImpl - this.rpcImpl(null, null, null); - this.rpcImpl = null; - this.emit("end").off(); - } - return this; -}; - -},{"15":15}],14:[function(require,module,exports){ -"use strict"; -module.exports = LongBits; - -var util = require(15); - -/** - * Constructs new long bits. - * @classdesc Helper class for working with the low and high bits of a 64 bit value. - * @memberof util - * @constructor - * @param {number} lo Low 32 bits, unsigned - * @param {number} hi High 32 bits, unsigned - */ -function LongBits(lo, hi) { - - // note that the casts below are theoretically unnecessary as of today, but older statically - // generated converter code might still call the ctor with signed 32bits. kept for compat. - - /** - * Low bits. - * @type {number} - */ - this.lo = lo >>> 0; - - /** - * High bits. - * @type {number} - */ - this.hi = hi >>> 0; -} - -/** - * Zero bits. - * @memberof util.LongBits - * @type {util.LongBits} - */ -var zero = LongBits.zero = new LongBits(0, 0); - -zero.toNumber = function() { return 0; }; -zero.zzEncode = zero.zzDecode = function() { return this; }; -zero.length = function() { return 1; }; - -/** - * Zero hash. - * @memberof util.LongBits - * @type {string} - */ -var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; - -/** - * Constructs new long bits from the specified number. - * @param {number} value Value - * @returns {util.LongBits} Instance - */ -LongBits.fromNumber = function fromNumber(value) { - if (value === 0) - return zero; - var sign = value < 0; - if (sign) - value = -value; - var lo = value >>> 0, - hi = (value - lo) / 4294967296 >>> 0; - if (sign) { - hi = ~hi >>> 0; - lo = ~lo >>> 0; - if (++lo > 4294967295) { - lo = 0; - if (++hi > 4294967295) - hi = 0; - } - } - return new LongBits(lo, hi); -}; - -/** - * Constructs new long bits from a number, long or string. - * @param {Long|number|string} value Value - * @returns {util.LongBits} Instance - */ -LongBits.from = function from(value) { - if (typeof value === "number") - return LongBits.fromNumber(value); - if (util.isString(value)) { - /* istanbul ignore else */ - if (util.Long) - value = util.Long.fromString(value); - else - return LongBits.fromNumber(parseInt(value, 10)); - } - return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; -}; - -/** - * Converts this long bits to a possibly unsafe JavaScript number. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {number} Possibly unsafe number - */ -LongBits.prototype.toNumber = function toNumber(unsigned) { - if (!unsigned && this.hi >>> 31) { - var lo = ~this.lo + 1 >>> 0, - hi = ~this.hi >>> 0; - if (!lo) - hi = hi + 1 >>> 0; - return -(lo + hi * 4294967296); - } - return this.lo + this.hi * 4294967296; -}; - -/** - * Converts this long bits to a long. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long} Long - */ -LongBits.prototype.toLong = function toLong(unsigned) { - return util.Long - ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) - /* istanbul ignore next */ - : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; -}; - -var charCodeAt = String.prototype.charCodeAt; - -/** - * Constructs new long bits from the specified 8 characters long hash. - * @param {string} hash Hash - * @returns {util.LongBits} Bits - */ -LongBits.fromHash = function fromHash(hash) { - if (hash === zeroHash) - return zero; - return new LongBits( - ( charCodeAt.call(hash, 0) - | charCodeAt.call(hash, 1) << 8 - | charCodeAt.call(hash, 2) << 16 - | charCodeAt.call(hash, 3) << 24) >>> 0 - , - ( charCodeAt.call(hash, 4) - | charCodeAt.call(hash, 5) << 8 - | charCodeAt.call(hash, 6) << 16 - | charCodeAt.call(hash, 7) << 24) >>> 0 - ); -}; - -/** - * Converts this long bits to a 8 characters long hash. - * @returns {string} Hash - */ -LongBits.prototype.toHash = function toHash() { - return String.fromCharCode( - this.lo & 255, - this.lo >>> 8 & 255, - this.lo >>> 16 & 255, - this.lo >>> 24 , - this.hi & 255, - this.hi >>> 8 & 255, - this.hi >>> 16 & 255, - this.hi >>> 24 - ); -}; - -/** - * Zig-zag encodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzEncode = function zzEncode() { - var mask = this.hi >> 31; - this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; - this.lo = ( this.lo << 1 ^ mask) >>> 0; - return this; -}; - -/** - * Zig-zag decodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzDecode = function zzDecode() { - var mask = -(this.lo & 1); - this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; - this.hi = ( this.hi >>> 1 ^ mask) >>> 0; - return this; -}; - -/** - * Calculates the length of this longbits when encoded as a varint. - * @returns {number} Length - */ -LongBits.prototype.length = function length() { - var part0 = this.lo, - part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, - part2 = this.hi >>> 24; - return part2 === 0 - ? part1 === 0 - ? part0 < 16384 - ? part0 < 128 ? 1 : 2 - : part0 < 2097152 ? 3 : 4 - : part1 < 16384 - ? part1 < 128 ? 5 : 6 - : part1 < 2097152 ? 7 : 8 - : part2 < 128 ? 9 : 10; -}; - -},{"15":15}],15:[function(require,module,exports){ -"use strict"; -var util = exports; - -// used to return a Promise where callback is omitted -util.asPromise = require(1); - -// converts to / from base64 encoded strings -util.base64 = require(2); - -// base class of rpc.Service -util.EventEmitter = require(3); - -// float handling accross browsers -util.float = require(4); - -// requires modules optionally and hides the call from bundlers -util.inquire = require(5); - -// converts to / from utf8 encoded strings -util.utf8 = require(7); - -// provides a node-like buffer pool in the browser -util.pool = require(6); - -// utility to work with the low and high bits of a 64 bit value -util.LongBits = require(14); - -/** - * Whether running within node or not. - * @memberof util - * @type {boolean} - */ -util.isNode = Boolean(typeof global !== "undefined" - && global - && global.process - && global.process.versions - && global.process.versions.node); - -/** - * Global object reference. - * @memberof util - * @type {Object} - */ -util.global = util.isNode && global - || typeof window !== "undefined" && window - || typeof self !== "undefined" && self - || this; // eslint-disable-line no-invalid-this - -/** - * An immuable empty array. - * @memberof util - * @type {Array.<*>} - * @const - */ -util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes - -/** - * An immutable empty object. - * @type {Object} - * @const - */ -util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes - -/** - * Tests if the specified value is an integer. - * @function - * @param {*} value Value to test - * @returns {boolean} `true` if the value is an integer - */ -util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { - return typeof value === "number" && isFinite(value) && Math.floor(value) === value; -}; - -/** - * Tests if the specified value is a string. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a string - */ -util.isString = function isString(value) { - return typeof value === "string" || value instanceof String; -}; - -/** - * Tests if the specified value is a non-null object. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a non-null object - */ -util.isObject = function isObject(value) { - return value && typeof value === "object"; -}; - -/** - * Checks if a property on a message is considered to be present. - * This is an alias of {@link util.isSet}. - * @function - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isset = - -/** - * Checks if a property on a message is considered to be present. - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isSet = function isSet(obj, prop) { - var value = obj[prop]; - if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins - return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; - return false; -}; - -/** - * Any compatible Buffer instance. - * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. - * @interface Buffer - * @extends Uint8Array - */ - -/** - * Node's Buffer class if available. - * @type {Constructor} - */ -util.Buffer = (function() { - try { - var Buffer = util.inquire("buffer").Buffer; - // refuse to use non-node buffers if not explicitly assigned (perf reasons): - return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; - } catch (e) { - /* istanbul ignore next */ - return null; - } -})(); - -// Internal alias of or polyfull for Buffer.from. -util._Buffer_from = null; - -// Internal alias of or polyfill for Buffer.allocUnsafe. -util._Buffer_allocUnsafe = null; - -/** - * Creates a new buffer of whatever type supported by the environment. - * @param {number|number[]} [sizeOrArray=0] Buffer size or number array - * @returns {Uint8Array|Buffer} Buffer - */ -util.newBuffer = function newBuffer(sizeOrArray) { - /* istanbul ignore next */ - return typeof sizeOrArray === "number" - ? util.Buffer - ? util._Buffer_allocUnsafe(sizeOrArray) - : new util.Array(sizeOrArray) - : util.Buffer - ? util._Buffer_from(sizeOrArray) - : typeof Uint8Array === "undefined" - ? sizeOrArray - : new Uint8Array(sizeOrArray); -}; - -/** - * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. - * @type {Constructor} - */ -util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; - -/** - * Any compatible Long instance. - * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. - * @interface Long - * @property {number} low Low bits - * @property {number} high High bits - * @property {boolean} unsigned Whether unsigned or not - */ - -/** - * Long.js's Long class if available. - * @type {Constructor} - */ -util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long - || /* istanbul ignore next */ util.global.Long - || util.inquire("long"); - -/** - * Regular expression used to verify 2 bit (`bool`) map keys. - * @type {RegExp} - * @const - */ -util.key2Re = /^true|false|0|1$/; - -/** - * Regular expression used to verify 32 bit (`int32` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; - -/** - * Regular expression used to verify 64 bit (`int64` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; - -/** - * Converts a number or long to an 8 characters long hash string. - * @param {Long|number} value Value to convert - * @returns {string} Hash - */ -util.longToHash = function longToHash(value) { - return value - ? util.LongBits.from(value).toHash() - : util.LongBits.zeroHash; -}; - -/** - * Converts an 8 characters long hash string to a long or number. - * @param {string} hash Hash - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long|number} Original value - */ -util.longFromHash = function longFromHash(hash, unsigned) { - var bits = util.LongBits.fromHash(hash); - if (util.Long) - return util.Long.fromBits(bits.lo, bits.hi, unsigned); - return bits.toNumber(Boolean(unsigned)); -}; - -/** - * Merges the properties of the source object into the destination object. - * @memberof util - * @param {Object.} dst Destination object - * @param {Object.} src Source object - * @param {boolean} [ifNotSet=false] Merges only if the key is not already set - * @returns {Object.} Destination object - */ -function merge(dst, src, ifNotSet) { // used by converters - for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) - if (dst[keys[i]] === undefined || !ifNotSet) - dst[keys[i]] = src[keys[i]]; - return dst; -} - -util.merge = merge; - -/** - * Converts the first character of a string to lower case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.lcFirst = function lcFirst(str) { - return str.charAt(0).toLowerCase() + str.substring(1); -}; - -/** - * Creates a custom error constructor. - * @memberof util - * @param {string} name Error name - * @returns {Constructor} Custom error constructor - */ -function newError(name) { - - function CustomError(message, properties) { - - if (!(this instanceof CustomError)) - return new CustomError(message, properties); - - // Error.call(this, message); - // ^ just returns a new error instance because the ctor can be called as a function - - Object.defineProperty(this, "message", { get: function() { return message; } }); - - /* istanbul ignore next */ - if (Error.captureStackTrace) // node - Error.captureStackTrace(this, CustomError); - else - Object.defineProperty(this, "stack", { value: new Error().stack || "" }); - - if (properties) - merge(this, properties); - } - - (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; - - Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); - - CustomError.prototype.toString = function toString() { - return this.name + ": " + this.message; - }; - - return CustomError; -} - -util.newError = newError; - -/** - * Constructs a new protocol error. - * @classdesc Error subclass indicating a protocol specifc error. - * @memberof util - * @extends Error - * @template T extends Message - * @constructor - * @param {string} message Error message - * @param {Object.} [properties] Additional properties - * @example - * try { - * MyMessage.decode(someBuffer); // throws if required fields are missing - * } catch (e) { - * if (e instanceof ProtocolError && e.instance) - * console.log("decoded so far: " + JSON.stringify(e.instance)); - * } - */ -util.ProtocolError = newError("ProtocolError"); - -/** - * So far decoded message instance. - * @name util.ProtocolError#instance - * @type {Message} - */ - -/** - * A OneOf getter as returned by {@link util.oneOfGetter}. - * @typedef OneOfGetter - * @type {function} - * @returns {string|undefined} Set field name, if any - */ - -/** - * Builds a getter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfGetter} Unbound getter - */ -util.oneOfGetter = function getOneOf(fieldNames) { - var fieldMap = {}; - for (var i = 0; i < fieldNames.length; ++i) - fieldMap[fieldNames[i]] = 1; - - /** - * @returns {string|undefined} Set field name, if any - * @this Object - * @ignore - */ - return function() { // eslint-disable-line consistent-return - for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) - if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) - return keys[i]; - }; -}; - -/** - * A OneOf setter as returned by {@link util.oneOfSetter}. - * @typedef OneOfSetter - * @type {function} - * @param {string|undefined} value Field name - * @returns {undefined} - */ - -/** - * Builds a setter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfSetter} Unbound setter - */ -util.oneOfSetter = function setOneOf(fieldNames) { - - /** - * @param {string} name Field name - * @returns {undefined} - * @this Object - * @ignore - */ - return function(name) { - for (var i = 0; i < fieldNames.length; ++i) - if (fieldNames[i] !== name) - delete this[fieldNames[i]]; - }; -}; - -/** - * Default conversion options used for {@link Message#toJSON} implementations. - * - * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: - * - * - Longs become strings - * - Enums become string keys - * - Bytes become base64 encoded strings - * - (Sub-)Messages become plain objects - * - Maps become plain objects with all string keys - * - Repeated fields become arrays - * - NaN and Infinity for float and double fields become strings - * - * @type {IConversionOptions} - * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json - */ -util.toJSONOptions = { - longs: String, - enums: String, - bytes: String, - json: true -}; - -// Sets up buffer utility according to the environment (called in index-minimal) -util._configure = function() { - var Buffer = util.Buffer; - /* istanbul ignore if */ - if (!Buffer) { - util._Buffer_from = util._Buffer_allocUnsafe = null; - return; - } - // because node 4.x buffers are incompatible & immutable - // see: https://github.com/dcodeIO/protobuf.js/pull/665 - util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || - /* istanbul ignore next */ - function Buffer_from(value, encoding) { - return new Buffer(value, encoding); - }; - util._Buffer_allocUnsafe = Buffer.allocUnsafe || - /* istanbul ignore next */ - function Buffer_allocUnsafe(size) { - return new Buffer(size); - }; -}; - -},{"1":1,"14":14,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7}],16:[function(require,module,exports){ -"use strict"; -module.exports = Writer; - -var util = require(15); - -var BufferWriter; // cyclic - -var LongBits = util.LongBits, - base64 = util.base64, - utf8 = util.utf8; - -/** - * Constructs a new writer operation instance. - * @classdesc Scheduled writer operation. - * @constructor - * @param {function(*, Uint8Array, number)} fn Function to call - * @param {number} len Value byte length - * @param {*} val Value to write - * @ignore - */ -function Op(fn, len, val) { - - /** - * Function to call. - * @type {function(Uint8Array, number, *)} - */ - this.fn = fn; - - /** - * Value byte length. - * @type {number} - */ - this.len = len; - - /** - * Next operation. - * @type {Writer.Op|undefined} - */ - this.next = undefined; - - /** - * Value to write. - * @type {*} - */ - this.val = val; // type varies -} - -/* istanbul ignore next */ -function noop() {} // eslint-disable-line no-empty-function - -/** - * Constructs a new writer state instance. - * @classdesc Copied writer state. - * @memberof Writer - * @constructor - * @param {Writer} writer Writer to copy state from - * @ignore - */ -function State(writer) { - - /** - * Current head. - * @type {Writer.Op} - */ - this.head = writer.head; - - /** - * Current tail. - * @type {Writer.Op} - */ - this.tail = writer.tail; - - /** - * Current buffer length. - * @type {number} - */ - this.len = writer.len; - - /** - * Next state. - * @type {State|null} - */ - this.next = writer.states; -} - -/** - * Constructs a new writer instance. - * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. - * @constructor - */ -function Writer() { - - /** - * Current length. - * @type {number} - */ - this.len = 0; - - /** - * Operations head. - * @type {Object} - */ - this.head = new Op(noop, 0, 0); - - /** - * Operations tail - * @type {Object} - */ - this.tail = this.head; - - /** - * Linked forked states. - * @type {Object|null} - */ - this.states = null; - - // When a value is written, the writer calculates its byte length and puts it into a linked - // list of operations to perform when finish() is called. This both allows us to allocate - // buffers of the exact required size and reduces the amount of work we have to do compared - // to first calculating over objects and then encoding over objects. In our case, the encoding - // part is just a linked list walk calling operations with already prepared values. -} - -var create = function create() { - return util.Buffer - ? function create_buffer_setup() { - return (Writer.create = function create_buffer() { - return new BufferWriter(); - })(); - } - /* istanbul ignore next */ - : function create_array() { - return new Writer(); - }; -}; - -/** - * Creates a new writer. - * @function - * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} - */ -Writer.create = create(); - -/** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ -Writer.alloc = function alloc(size) { - return new util.Array(size); -}; - -// Use Uint8Array buffer pool in the browser, just like node does with buffers -/* istanbul ignore else */ -if (util.Array !== Array) - Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); - -/** - * Pushes a new operation to the queue. - * @param {function(Uint8Array, number, *)} fn Function to call - * @param {number} len Value byte length - * @param {number} val Value to write - * @returns {Writer} `this` - * @private - */ -Writer.prototype._push = function push(fn, len, val) { - this.tail = this.tail.next = new Op(fn, len, val); - this.len += len; - return this; -}; - -function writeByte(val, buf, pos) { - buf[pos] = val & 255; -} - -function writeVarint32(val, buf, pos) { - while (val > 127) { - buf[pos++] = val & 127 | 128; - val >>>= 7; - } - buf[pos] = val; -} - -/** - * Constructs a new varint writer operation instance. - * @classdesc Scheduled varint writer operation. - * @extends Op - * @constructor - * @param {number} len Value byte length - * @param {number} val Value to write - * @ignore - */ -function VarintOp(len, val) { - this.len = len; - this.next = undefined; - this.val = val; -} - -VarintOp.prototype = Object.create(Op.prototype); -VarintOp.prototype.fn = writeVarint32; - -/** - * Writes an unsigned 32 bit value as a varint. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.uint32 = function write_uint32(value) { - // here, the call to this.push has been inlined and a varint specific Op subclass is used. - // uint32 is by far the most frequently used operation and benefits significantly from this. - this.len += (this.tail = this.tail.next = new VarintOp( - (value = value >>> 0) - < 128 ? 1 - : value < 16384 ? 2 - : value < 2097152 ? 3 - : value < 268435456 ? 4 - : 5, - value)).len; - return this; -}; - -/** - * Writes a signed 32 bit value as a varint. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.int32 = function write_int32(value) { - return value < 0 - ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec - : this.uint32(value); -}; - -/** - * Writes a 32 bit value as a varint, zig-zag encoded. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sint32 = function write_sint32(value) { - return this.uint32((value << 1 ^ value >> 31) >>> 0); -}; - -function writeVarint64(val, buf, pos) { - while (val.hi) { - buf[pos++] = val.lo & 127 | 128; - val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; - val.hi >>>= 7; - } - while (val.lo > 127) { - buf[pos++] = val.lo & 127 | 128; - val.lo = val.lo >>> 7; - } - buf[pos++] = val.lo; -} - -/** - * Writes an unsigned 64 bit value as a varint. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.uint64 = function write_uint64(value) { - var bits = LongBits.from(value); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a signed 64 bit value as a varint. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.int64 = Writer.prototype.uint64; - -/** - * Writes a signed 64 bit value as a varint, zig-zag encoded. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sint64 = function write_sint64(value) { - var bits = LongBits.from(value).zzEncode(); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a boolish value as a varint. - * @param {boolean} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.bool = function write_bool(value) { - return this._push(writeByte, 1, value ? 1 : 0); -}; - -function writeFixed32(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -/** - * Writes an unsigned 32 bit value as fixed 32 bits. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.fixed32 = function write_fixed32(value) { - return this._push(writeFixed32, 4, value >>> 0); -}; - -/** - * Writes a signed 32 bit value as fixed 32 bits. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sfixed32 = Writer.prototype.fixed32; - -/** - * Writes an unsigned 64 bit value as fixed 64 bits. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.fixed64 = function write_fixed64(value) { - var bits = LongBits.from(value); - return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); -}; - -/** - * Writes a signed 64 bit value as fixed 64 bits. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sfixed64 = Writer.prototype.fixed64; - -/** - * Writes a float (32 bit). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.float = function write_float(value) { - return this._push(util.float.writeFloatLE, 4, value); -}; - -/** - * Writes a double (64 bit float). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.double = function write_double(value) { - return this._push(util.float.writeDoubleLE, 8, value); -}; - -var writeBytes = util.Array.prototype.set - ? function writeBytes_set(val, buf, pos) { - buf.set(val, pos); // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytes_for(val, buf, pos) { - for (var i = 0; i < val.length; ++i) - buf[pos + i] = val[i]; - }; - -/** - * Writes a sequence of bytes. - * @param {Uint8Array|string} value Buffer or base64 encoded string to write - * @returns {Writer} `this` - */ -Writer.prototype.bytes = function write_bytes(value) { - var len = value.length >>> 0; - if (!len) - return this._push(writeByte, 1, 0); - if (util.isString(value)) { - var buf = Writer.alloc(len = base64.length(value)); - base64.decode(value, buf, 0); - value = buf; - } - return this.uint32(len)._push(writeBytes, len, value); -}; - -/** - * Writes a string. - * @param {string} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.string = function write_string(value) { - var len = utf8.length(value); - return len - ? this.uint32(len)._push(utf8.write, len, value) - : this._push(writeByte, 1, 0); -}; - -/** - * Forks this writer's state by pushing it to a stack. - * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. - * @returns {Writer} `this` - */ -Writer.prototype.fork = function fork() { - this.states = new State(this); - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - return this; -}; - -/** - * Resets this instance to the last state. - * @returns {Writer} `this` - */ -Writer.prototype.reset = function reset() { - if (this.states) { - this.head = this.states.head; - this.tail = this.states.tail; - this.len = this.states.len; - this.states = this.states.next; - } else { - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - } - return this; -}; - -/** - * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. - * @returns {Writer} `this` - */ -Writer.prototype.ldelim = function ldelim() { - var head = this.head, - tail = this.tail, - len = this.len; - this.reset().uint32(len); - if (len) { - this.tail.next = head.next; // skip noop - this.tail = tail; - this.len += len; - } - return this; -}; - -/** - * Finishes the write operation. - * @returns {Uint8Array} Finished buffer - */ -Writer.prototype.finish = function finish() { - var head = this.head.next, // skip noop - buf = this.constructor.alloc(this.len), - pos = 0; - while (head) { - head.fn(head.val, buf, pos); - pos += head.len; - head = head.next; - } - // this.head = this.tail = null; - return buf; -}; - -Writer._configure = function(BufferWriter_) { - BufferWriter = BufferWriter_; - Writer.create = create(); - BufferWriter._configure(); -}; - -},{"15":15}],17:[function(require,module,exports){ -"use strict"; -module.exports = BufferWriter; - -// extends Writer -var Writer = require(16); -(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; - -var util = require(15); - -/** - * Constructs a new buffer writer instance. - * @classdesc Wire format writer using node buffers. - * @extends Writer - * @constructor - */ -function BufferWriter() { - Writer.call(this); -} - -BufferWriter._configure = function () { - /** - * Allocates a buffer of the specified size. - * @function - * @param {number} size Buffer size - * @returns {Buffer} Buffer - */ - BufferWriter.alloc = util._Buffer_allocUnsafe; - - BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" - ? function writeBytesBuffer_set(val, buf, pos) { - buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) - // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytesBuffer_copy(val, buf, pos) { - if (val.copy) // Buffer values - val.copy(buf, pos, 0, val.length); - else for (var i = 0; i < val.length;) // plain array values - buf[pos++] = val[i++]; - }; -}; - - -/** - * @override - */ -BufferWriter.prototype.bytes = function write_bytes_buffer(value) { - if (util.isString(value)) - value = util._Buffer_from(value, "base64"); - var len = value.length >>> 0; - this.uint32(len); - if (len) - this._push(BufferWriter.writeBytesBuffer, len, value); - return this; -}; - -function writeStringBuffer(val, buf, pos) { - if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) - util.utf8.write(val, buf, pos); - else if (buf.utf8Write) - buf.utf8Write(val, pos); - else - buf.write(val, pos); -} - -/** - * @override - */ -BufferWriter.prototype.string = function write_string_buffer(value) { - var len = util.Buffer.byteLength(value); - this.uint32(len); - if (len) - this._push(writeStringBuffer, len, value); - return this; -}; - - -/** - * Finishes the write operation. - * @name BufferWriter#finish - * @function - * @returns {Buffer} Finished buffer - */ - -BufferWriter._configure(); - -},{"15":15,"16":16}]},{},[8]) - -})(); -//# sourceMappingURL=protobuf.js.map diff --git a/node_modules/protobufjs/dist/minimal/protobuf.js.map b/node_modules/protobufjs/dist/minimal/protobuf.js.map deleted file mode 100644 index 4554b753..00000000 --- a/node_modules/protobufjs/dist/minimal/protobuf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["lib/prelude.js","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/@protobufjs/utf8/index.js","../src/index-minimal","../src/reader.js","../src/reader_buffer.js","../src/roots.js","../src/rpc.js","../src/rpc/service.js","../src/util/longbits.js","../src/util/minimal.js","../src/writer.js","../src/writer_buffer.js"],"names":[],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACraA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"protobuf.js","sourcesContent":["(function prelude(modules, cache, entries) {\n\n // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS\n // sources through a conflict-free require shim and is again wrapped within an iife that\n // provides a minification-friendly `undefined` var plus a global \"use strict\" directive\n // so that minification can remove the directives of each module.\n\n function $require(name) {\n var $module = cache[name];\n if (!$module)\n modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);\n return $module.exports;\n }\n\n var protobuf = $require(entries[0]);\n\n // Expose globally\n protobuf.util.global.protobuf = protobuf;\n\n // Be nice to AMD\n if (typeof define === \"function\" && define.amd)\n define([\"long\"], function(Long) {\n if (Long && Long.isLong) {\n protobuf.util.Long = Long;\n protobuf.configure();\n }\n return protobuf;\n });\n\n // Be nice to CommonJS\n if (typeof module === \"object\" && module && module.exports)\n module.exports = protobuf;\n\n})/* end of prelude */","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(16);\nprotobuf.BufferWriter = require(17);\nprotobuf.Reader = require(9);\nprotobuf.BufferReader = require(10);\n\n// Utility\nprotobuf.util = require(15);\nprotobuf.rpc = require(12);\nprotobuf.roots = require(11);\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(15);\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(9);\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(15);\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n","\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n","\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(13);\n","\"use strict\";\nmodule.exports = Service;\n\nvar util = require(15);\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n","\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(15);\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n","\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(1);\n\n// converts to / from base64 encoded strings\nutil.base64 = require(2);\n\n// base class of rpc.Service\nutil.EventEmitter = require(3);\n\n// float handling accross browsers\nutil.float = require(4);\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(5);\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(7);\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(6);\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(14);\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(15);\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(16);\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(15);\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n"],"sourceRoot":"."} \ No newline at end of file diff --git a/node_modules/protobufjs/dist/minimal/protobuf.min.js b/node_modules/protobufjs/dist/minimal/protobuf.min.js deleted file mode 100644 index 16dba941..00000000 --- a/node_modules/protobufjs/dist/minimal/protobuf.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * protobuf.js v6.10.0 (c) 2016, daniel wirtz - * compiled wed, 15 jul 2020 23:34:14 utc - * licensed under the bsd-3-clause license - * see: https://github.com/dcodeio/protobuf.js for details - */ -!function(d){"use strict";var r,u,t,n;r={1:[function(t,n){n.exports=function(t,n){var i=Array(arguments.length-1),e=0,r=2,s=!0;for(;r>2],r=(3&f)<<4,h=1;break;case 1:e[s++]=o[r|f>>4],r=(15&f)<<2,h=2;break;case 2:e[s++]=o[r|f>>6],e[s++]=o[63&f],h=0}8191>4,r=h,e=2;break;case 2:n[i++]=(15&r)<<4|(60&h)>>2,r=h,e=3;break;case 3:n[i++]=(3&r)<<6|h,e=0}}if(1===e)throw Error(c);return i-u},r.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},{}],3:[function(t,n){function i(){this.t={}}(n.exports=i).prototype.on=function(t,n,i){return(this.t[t]||(this.t[t]=[])).push({fn:n,ctx:i||this}),this},i.prototype.off=function(t,n){if(t===d)this.t={};else if(n===d)this.t[t]=[];else for(var i=this.t[t],r=0;r>>0,i,r);else if(n<11754943508222875e-54)t((u<<31|Math.round(n/1401298464324817e-60))>>>0,i,r);else{var e=Math.floor(Math.log(n)/Math.LN2);t((u<<31|127+e<<23|8388607&Math.round(n*Math.pow(2,-e)*8388608))>>>0,i,r)}}function i(t,n,i){var r=t(n,i),u=2*(r>>31)+1,e=r>>>23&255,s=8388607&r;return 255==e?s?NaN:1/0*u:0==e?1401298464324817e-60*u*s:u*Math.pow(2,e-150)*(8388608+s)}function r(t,n,i){h[0]=t,n[i]=f[0],n[i+1]=f[1],n[i+2]=f[2],n[i+3]=f[3]}function u(t,n,i){h[0]=t,n[i]=f[3],n[i+1]=f[2],n[i+2]=f[1],n[i+3]=f[0]}function e(t,n){return f[0]=t[n],f[1]=t[n+1],f[2]=t[n+2],f[3]=t[n+3],h[0]}function s(t,n){return f[3]=t[n],f[2]=t[n+1],f[1]=t[n+2],f[0]=t[n+3],h[0]}var h,f,o,c,a,l;function v(t,n,i,r,u,e){var s=r<0?1:0;if(s&&(r=-r),0===r)t(0,u,e+n),t(0<1/r?0:2147483648,u,e+i);else if(isNaN(r))t(0,u,e+n),t(2146959360,u,e+i);else if(17976931348623157e292>>0,u,e+i);else{var h;if(r<22250738585072014e-324)t((h=r/5e-324)>>>0,u,e+n),t((s<<31|h/4294967296)>>>0,u,e+i);else{var f=Math.floor(Math.log(r)/Math.LN2);1024===f&&(f=1023),t(4503599627370496*(h=r*Math.pow(2,-f))>>>0,u,e+n),t((s<<31|f+1023<<20|1048576*h&1048575)>>>0,u,e+i)}}}function w(t,n,i,r,u){var e=t(r,u+n),s=t(r,u+i),h=2*(s>>31)+1,f=s>>>20&2047,o=4294967296*(1048575&s)+e;return 2047==f?o?NaN:1/0*h:0==f?5e-324*h*o:h*Math.pow(2,f-1075)*(o+4503599627370496)}function y(t,n,i){c[0]=t,n[i]=a[0],n[i+1]=a[1],n[i+2]=a[2],n[i+3]=a[3],n[i+4]=a[4],n[i+5]=a[5],n[i+6]=a[6],n[i+7]=a[7]}function b(t,n,i){c[0]=t,n[i]=a[7],n[i+1]=a[6],n[i+2]=a[5],n[i+3]=a[4],n[i+4]=a[3],n[i+5]=a[2],n[i+6]=a[1],n[i+7]=a[0]}function d(t,n){return a[0]=t[n],a[1]=t[n+1],a[2]=t[n+2],a[3]=t[n+3],a[4]=t[n+4],a[5]=t[n+5],a[6]=t[n+6],a[7]=t[n+7],c[0]}function g(t,n){return a[7]=t[n],a[6]=t[n+1],a[5]=t[n+2],a[4]=t[n+3],a[3]=t[n+4],a[2]=t[n+5],a[1]=t[n+6],a[0]=t[n+7],c[0]}return"undefined"!=typeof Float32Array?(h=new Float32Array([-0]),f=new Uint8Array(h.buffer),o=128===f[3],t.writeFloatLE=o?r:u,t.writeFloatBE=o?u:r,t.readFloatLE=o?e:s,t.readFloatBE=o?s:e):(t.writeFloatLE=n.bind(null,A),t.writeFloatBE=n.bind(null,p),t.readFloatLE=i.bind(null,m),t.readFloatBE=i.bind(null,j)),"undefined"!=typeof Float64Array?(c=new Float64Array([-0]),a=new Uint8Array(c.buffer),l=128===a[7],t.writeDoubleLE=l?y:b,t.writeDoubleBE=l?b:y,t.readDoubleLE=l?d:g,t.readDoubleBE=l?g:d):(t.writeDoubleLE=v.bind(null,A,0,4),t.writeDoubleBE=v.bind(null,p,4,0),t.readDoubleLE=w.bind(null,m,0,4),t.readDoubleBE=w.bind(null,j,4,0)),t}function A(t,n,i){n[i]=255&t,n[i+1]=t>>>8&255,n[i+2]=t>>>16&255,n[i+3]=t>>>24}function p(t,n,i){n[i]=t>>>24,n[i+1]=t>>>16&255,n[i+2]=t>>>8&255,n[i+3]=255&t}function m(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0}function j(t,n){return(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3])>>>0}n.exports=i(i)},{}],5:[function(t,n,i){function r(t){try{var n=eval("require")(t);if(n&&(n.length||Object.keys(n).length))return n}catch(t){}return null}n.exports=r},{}],6:[function(t,n){n.exports=function(i,r,t){var u=t||8192,e=u>>>1,s=null,h=u;return function(t){if(t<1||e>10),e[s++]=56320+(1023&r)):e[s++]=(15&r)<<12|(63&t[n++])<<6|63&t[n++],8191>6|192:(55296==(64512&r)&&56320==(64512&(u=t.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&u),++s,n[i++]=r>>18|240,n[i++]=r>>12&63|128):n[i++]=r>>12|224,n[i++]=r>>6&63|128),n[i++]=63&r|128);return i-e}},{}],8:[function(t,n,i){var r=i;function u(){r.util.n(),r.Writer.n(r.BufferWriter),r.Reader.n(r.BufferReader)}r.build="minimal",r.Writer=t(16),r.BufferWriter=t(17),r.Reader=t(9),r.BufferReader=t(10),r.util=t(15),r.rpc=t(12),r.roots=t(11),(r.configure=u)()},{10:10,11:11,12:12,15:15,16:16,17:17,9:9}],9:[function(t,n){n.exports=h;var i,r=t(15),u=r.LongBits,e=r.utf8;function s(t,n){return RangeError("index out of range: "+t.pos+" + "+(n||1)+" > "+t.len)}function h(t){this.buf=t,this.pos=0,this.len=t.length}function f(){return r.Buffer?function(t){return(h.create=function(t){return r.Buffer.isBuffer(t)?new i(t):c(t)})(t)}:c}var o,c="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new h(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new h(t);throw Error("illegal buffer")};function a(){var t=new u(0,0),n=0;if(!(4=this.len)throw s(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*n)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*n)>>>0,t}for(;n<4;++n)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*n)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(n=0,4>>0,this.buf[this.pos++]<128)return t}else for(;n<5;++n){if(this.pos>=this.len)throw s(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*n+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function l(t,n){return(t[n-4]|t[n-3]<<8|t[n-2]<<16|t[n-1]<<24)>>>0}function v(){if(this.pos+8>this.len)throw s(this,8);return new u(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}h.create=f(),h.prototype.i=r.Array.prototype.subarray||r.Array.prototype.slice,h.prototype.uint32=(o=4294967295,function(){if(o=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return o;if(o=(o|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return o;if(o=(o|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return o;if(o=(o|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return o;if(o=(o|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return o;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return o}),h.prototype.int32=function(){return 0|this.uint32()},h.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},h.prototype.bool=function(){return 0!==this.uint32()},h.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return l(this.buf,this.pos+=4)},h.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|l(this.buf,this.pos+=4)},h.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var t=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},h.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var t=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},h.prototype.bytes=function(){var t=this.uint32(),n=this.pos,i=this.pos+t;if(i>this.len)throw s(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(n,i):n===i?new this.buf.constructor(0):this.i.call(this.buf,n,i)},h.prototype.string=function(){var t=this.bytes();return e.read(t,0,t.length)},h.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw s(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},h.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},h.n=function(t){i=t,h.create=f(),i.n();var n=r.Long?"toLong":"toNumber";r.merge(h.prototype,{int64:function(){return a.call(this)[n](!1)},uint64:function(){return a.call(this)[n](!0)},sint64:function(){return a.call(this).zzDecode()[n](!1)},fixed64:function(){return v.call(this)[n](!0)},sfixed64:function(){return v.call(this)[n](!1)}})}},{15:15}],10:[function(t,n){n.exports=u;var i=t(9);(u.prototype=Object.create(i.prototype)).constructor=u;var r=t(15);function u(t){i.call(this,t)}u.n=function(){r.Buffer&&(u.prototype.i=r.Buffer.prototype.slice)},u.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},u.n()},{15:15,9:9}],11:[function(t,n){n.exports={}},{}],12:[function(t,n,i){i.Service=t(13)},{13:13}],13:[function(t,n){n.exports=i;var h=t(15);function i(t,n,i){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");h.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!n,this.responseDelimited=!!i}((i.prototype=Object.create(h.EventEmitter.prototype)).constructor=i).prototype.rpcCall=function t(i,n,r,u,e){if(!u)throw TypeError("request must be specified");var s=this;if(!e)return h.asPromise(t,s,i,n,r,u);if(!s.rpcImpl)return setTimeout(function(){e(Error("already ended"))},0),d;try{return s.rpcImpl(i,n[s.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(t,n){if(t)return s.emit("error",t,i),e(t);if(null===n)return s.end(!0),d;if(!(n instanceof r))try{n=r[s.responseDelimited?"decodeDelimited":"decode"](n)}catch(t){return s.emit("error",t,i),e(t)}return s.emit("data",n,i),e(null,n)})}catch(t){return s.emit("error",t,i),setTimeout(function(){e(t)},0),d}},i.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{15:15}],14:[function(t,n){n.exports=u;var i=t(15);function u(t,n){this.lo=t>>>0,this.hi=n>>>0}var e=u.zero=new u(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=function(t){if(0===t)return e;var n=t<0;n&&(t=-t);var i=t>>>0,r=(t-i)/4294967296>>>0;return n&&(r=~r>>>0,i=~i>>>0,4294967295<++i&&(i=0,4294967295<++r&&(r=0))),new u(i,r)},u.from=function(t){if("number"==typeof t)return u.fromNumber(t);if(i.isString(t)){if(!i.Long)return u.fromNumber(parseInt(t,10));t=i.Long.fromString(t)}return t.low||t.high?new u(t.low>>>0,t.high>>>0):e},u.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=1+~this.lo>>>0,i=~this.hi>>>0;return n||(i=i+1>>>0),-(n+4294967296*i)}return this.lo+4294967296*this.hi},u.prototype.toLong=function(t){return i.Long?new i.Long(0|this.lo,0|this.hi,!!t):{low:0|this.lo,high:0|this.hi,unsigned:!!t}};var s=String.prototype.charCodeAt;u.fromHash=function(t){return t===r?e:new u((s.call(t,0)|s.call(t,1)<<8|s.call(t,2)<<16|s.call(t,3)<<24)>>>0,(s.call(t,4)|s.call(t,5)<<8|s.call(t,6)<<16|s.call(t,7)<<24)>>>0)},u.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},u.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},u.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},u.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0==i?0==n?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:i<128?9:10}},{15:15}],15:[function(t,n,i){var r=i;function u(t,n,i){for(var r=Object.keys(n),u=0;u>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;127>>7;n[i++]=t.lo}function y(t,n,i){n[i]=255&t,n[i+1]=t>>>8&255,n[i+2]=t>>>16&255,n[i+3]=t>>>24}c.create=a(),c.alloc=function(t){return new r.Array(t)},r.Array!==Array&&(c.alloc=r.pool(c.alloc,r.Array.prototype.subarray)),c.prototype.e=function(t,n,i){return this.tail=this.tail.next=new h(t,n,i),this.len+=n,this},(v.prototype=Object.create(h.prototype)).fn=function(t,n,i){for(;127>>=7;n[i]=t},c.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new v((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},c.prototype.int32=function(t){return t<0?this.e(w,10,u.fromNumber(t)):this.uint32(t)},c.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},c.prototype.int64=c.prototype.uint64=function(t){var n=u.from(t);return this.e(w,n.length(),n)},c.prototype.sint64=function(t){var n=u.from(t).zzEncode();return this.e(w,n.length(),n)},c.prototype.bool=function(t){return this.e(l,1,t?1:0)},c.prototype.sfixed32=c.prototype.fixed32=function(t){return this.e(y,4,t>>>0)},c.prototype.sfixed64=c.prototype.fixed64=function(t){var n=u.from(t);return this.e(y,4,n.lo).e(y,4,n.hi)},c.prototype.float=function(t){return this.e(r.float.writeFloatLE,4,t)},c.prototype.double=function(t){return this.e(r.float.writeDoubleLE,8,t)};var b=r.Array.prototype.set?function(t,n,i){n.set(t,i)}:function(t,n,i){for(var r=0;r>>0;if(!n)return this.e(l,1,0);if(r.isString(t)){var i=c.alloc(n=e.length(t));e.decode(t,i,0),t=i}return this.uint32(n).e(b,n,t)},c.prototype.string=function(t){var n=s.length(t);return n?this.uint32(n).e(s.write,n,t):this.e(l,1,0)},c.prototype.fork=function(){return this.states=new o(this),this.head=this.tail=new h(f,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new h(f,0,0),this.len=0),this},c.prototype.ldelim=function(){var t=this.head,n=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=t.next,this.tail=n,this.len+=i),this},c.prototype.finish=function(){for(var t=this.head.next,n=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,n,i),i+=t.len,t=t.next;return n},c.n=function(t){i=t,c.create=a(),i.n()}},{15:15}],17:[function(t,n){n.exports=u;var i=t(16);(u.prototype=Object.create(i.prototype)).constructor=u;var r=t(15);function u(){i.call(this)}function e(t,n,i){t.length<40?r.utf8.write(t,n,i):n.utf8Write?n.utf8Write(t,i):n.write(t,i)}u.n=function(){u.alloc=r.u,u.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(t,n,i){n.set(t,i)}:function(t,n,i){if(t.copy)t.copy(n,i,0,t.length);else for(var r=0;r>>0;return this.uint32(n),n&&this.e(u.writeBytesBuffer,n,t),this},u.prototype.string=function(t){var n=r.Buffer.byteLength(t);return this.uint32(n),n&&this.e(e,n,t),this},u.n()},{15:15,16:16}]},u={},t=[8],n=function t(n){var i=u[n];return i||r[n][0].call(i=u[n]={exports:{}},t,i,i.exports),i.exports}(t[0]),n.util.global.protobuf=n,"function"==typeof define&&define.amd&&define(["long"],function(t){return t&&t.isLong&&(n.util.Long=t,n.configure()),n}),"object"==typeof module&&module&&module.exports&&(module.exports=n)}(); -//# sourceMappingURL=protobuf.min.js.map diff --git a/node_modules/protobufjs/dist/minimal/protobuf.min.js.map b/node_modules/protobufjs/dist/minimal/protobuf.min.js.map deleted file mode 100644 index c373c9a5..00000000 --- a/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["lib/prelude.js","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/@protobufjs/utf8/index.js","../src/index-minimal","../src/reader.js","../src/reader_buffer.js","../src/roots.js","../src/rpc.js","../src/rpc/service.js","../src/util/longbits.js","../src/util/minimal.js","../src/writer.js","../src/writer_buffer.js"],"names":["undefined","modules","cache","entries","protobuf","1","require","module","exports","fn","ctx","params","Array","arguments","length","offset","index","pending","Promise","resolve","reject","err","apply","base64","string","p","n","Math","ceil","b64","s64","i","encode","buffer","start","end","t","parts","chunk","j","b","push","String","fromCharCode","slice","join","invalidEncoding","decode","c","charCodeAt","Error","test","EventEmitter","this","_listeners","prototype","on","evt","off","listeners","splice","emit","args","factory","writeFloat_ieee754","writeUint","val","buf","pos","sign","isNaN","round","exponent","floor","log","LN2","pow","readFloat_ieee754","readUint","uint","mantissa","NaN","Infinity","writeFloat_f32_cpy","f32","f8b","writeFloat_f32_rev","readFloat_f32_cpy","readFloat_f32_rev","le","f64","writeDouble_ieee754","off0","off1","readDouble_ieee754","lo","hi","writeDouble_f64_cpy","writeDouble_f64_rev","readDouble_f64_cpy","readDouble_f64_rev","Float32Array","Uint8Array","writeFloatLE","writeFloatBE","readFloatLE","readFloatBE","bind","writeUintLE","writeUintBE","readUintLE","readUintBE","Float64Array","writeDoubleLE","writeDoubleBE","readDoubleLE","readDoubleBE","inquire","moduleName","mod","eval","Object","keys","e","alloc","size","SIZE","MAX","slab","call","utf8","len","read","write","c1","c2","configure","util","_configure","Writer","BufferWriter","Reader","BufferReader","build","rpc","roots","LongBits","indexOutOfRange","reader","writeLength","RangeError","create","Buffer","isBuffer","create_array","value","isArray","readLongVarint","bits","readFixed32_end","readFixed64","_slice","subarray","uint32","int32","sint32","bool","fixed32","sfixed32","float","double","bytes","constructor","skip","skipType","wireType","BufferReader_","Long","merge","int64","uint64","sint64","zzDecode","fixed64","sfixed64","utf8Slice","min","toString","Service","rpcImpl","requestDelimited","responseDelimited","TypeError","rpcCall","method","requestCtor","responseCtor","request","callback","self","asPromise","setTimeout","finish","response","endedByRPC","zero","toNumber","zzEncode","zeroHash","fromNumber","from","isString","parseInt","fromString","low","high","unsigned","toLong","fromHash","hash","toHash","mask","part0","part1","part2","dst","src","ifNotSet","newError","name","CustomError","message","properties","defineProperty","get","captureStackTrace","stack","pool","isNode","global","process","versions","node","window","emptyArray","freeze","emptyObject","isInteger","Number","isFinite","isObject","isset","isSet","obj","prop","hasOwnProperty","utf8Write","_Buffer_from","_Buffer_allocUnsafe","newBuffer","sizeOrArray","dcodeIO","key2Re","key32Re","key64Re","longToHash","longFromHash","fromBits","lcFirst","str","toLowerCase","substring","ProtocolError","oneOfGetter","fieldNames","fieldMap","oneOfSetter","toJSONOptions","longs","enums","json","encoding","allocUnsafe","Op","next","noop","State","writer","head","tail","states","writeByte","VarintOp","writeVarint64","writeFixed32","_push","writeBytes","set","fork","reset","ldelim","BufferWriter_","writeStringBuffer","writeBytesBuffer","copy","byteLength","$require","$module","define","amd","isLong"],"mappings":";;;;;;CAAA,SAAAA,GAAA,aAAA,IAAAC,EAAAC,EAAAC,EAcAC,EAdAH,EAiCA,CAAAI,EAAA,CAAA,SAAAC,EAAAC,GChCAA,EAAAC,QAmBA,SAAAC,EAAAC,GACA,IAAAC,EAAAC,MAAAC,UAAAC,OAAA,GACAC,EAAA,EACAC,EAAA,EACAC,GAAA,EACA,KAAAD,EAAAH,UAAAC,QACAH,EAAAI,KAAAF,UAAAG,KACA,OAAA,IAAAE,QAAA,SAAAC,EAAAC,GACAT,EAAAI,GAAA,SAAAM,GACA,GAAAJ,EAEA,GADAA,GAAA,EACAI,EACAD,EAAAC,OACA,CAGA,IAFA,IAAAV,EAAAC,MAAAC,UAAAC,OAAA,GACAC,EAAA,EACAA,EAAAJ,EAAAG,QACAH,EAAAI,KAAAF,UAAAE,GACAI,EAAAG,MAAA,KAAAX,KAIA,IACAF,EAAAa,MAAAZ,GAAA,KAAAC,GACA,MAAAU,GACAJ,IACAA,GAAA,EACAG,EAAAC,gCCxCA,IAAAE,EAAAf,EAOAe,EAAAT,OAAA,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GA,mBAAAgT,QAAAA,OAAAC,KACAD,OAAA,CAAA,QAAA,SAAAnI,GAKA,OAJAA,GAAAA,EAAAqI,SACAlT,EAAAqI,KAAAwC,KAAAA,EACA7K,EAAAoI,aAEApI,IAIA,iBAAAG,QAAAA,QAAAA,OAAAC,UACAD,OAAAC,QAAAJ,GA/BA","file":"protobuf.min.js","sourcesContent":["(function prelude(modules, cache, entries) {\n\n // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS\n // sources through a conflict-free require shim and is again wrapped within an iife that\n // provides a minification-friendly `undefined` var plus a global \"use strict\" directive\n // so that minification can remove the directives of each module.\n\n function $require(name) {\n var $module = cache[name];\n if (!$module)\n modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);\n return $module.exports;\n }\n\n var protobuf = $require(entries[0]);\n\n // Expose globally\n protobuf.util.global.protobuf = protobuf;\n\n // Be nice to AMD\n if (typeof define === \"function\" && define.amd)\n define([\"long\"], function(Long) {\n if (Long && Long.isLong) {\n protobuf.util.Long = Long;\n protobuf.configure();\n }\n return protobuf;\n });\n\n // Be nice to CommonJS\n if (typeof module === \"object\" && module && module.exports)\n module.exports = protobuf;\n\n})/* end of prelude */","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(16);\nprotobuf.BufferWriter = require(17);\nprotobuf.Reader = require(9);\nprotobuf.BufferReader = require(10);\n\n// Utility\nprotobuf.util = require(15);\nprotobuf.rpc = require(12);\nprotobuf.roots = require(11);\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(15);\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(9);\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(15);\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n","\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n","\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(13);\n","\"use strict\";\nmodule.exports = Service;\n\nvar util = require(15);\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n","\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(15);\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n","\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(1);\n\n// converts to / from base64 encoded strings\nutil.base64 = require(2);\n\n// base class of rpc.Service\nutil.EventEmitter = require(3);\n\n// float handling accross browsers\nutil.float = require(4);\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(5);\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(7);\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(6);\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(14);\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(15);\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(16);\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(15);\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n"],"sourceRoot":"."} \ No newline at end of file diff --git a/node_modules/protobufjs/dist/protobuf.js b/node_modules/protobufjs/dist/protobuf.js deleted file mode 100644 index 31d83023..00000000 --- a/node_modules/protobufjs/dist/protobuf.js +++ /dev/null @@ -1,8919 +0,0 @@ -/*! - * protobuf.js v6.10.0 (c) 2016, daniel wirtz - * compiled wed, 15 jul 2020 23:34:13 utc - * licensed under the bsd-3-clause license - * see: https://github.com/dcodeio/protobuf.js for details - */ -(function(undefined){"use strict";(function prelude(modules, cache, entries) { - - // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS - // sources through a conflict-free require shim and is again wrapped within an iife that - // provides a minification-friendly `undefined` var plus a global "use strict" directive - // so that minification can remove the directives of each module. - - function $require(name) { - var $module = cache[name]; - if (!$module) - modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports); - return $module.exports; - } - - var protobuf = $require(entries[0]); - - // Expose globally - protobuf.util.global.protobuf = protobuf; - - // Be nice to AMD - if (typeof define === "function" && define.amd) - define(["long"], function(Long) { - if (Long && Long.isLong) { - protobuf.util.Long = Long; - protobuf.configure(); - } - return protobuf; - }); - - // Be nice to CommonJS - if (typeof module === "object" && module && module.exports) - module.exports = protobuf; - -})/* end of prelude */({1:[function(require,module,exports){ -"use strict"; -module.exports = asPromise; - -/** - * Callback as used by {@link util.asPromise}. - * @typedef asPromiseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {...*} params Additional arguments - * @returns {undefined} - */ - -/** - * Returns a promise from a node-style callback function. - * @memberof util - * @param {asPromiseCallback} fn Function to call - * @param {*} ctx Function context - * @param {...*} params Function arguments - * @returns {Promise<*>} Promisified function - */ -function asPromise(fn, ctx/*, varargs */) { - var params = new Array(arguments.length - 1), - offset = 0, - index = 2, - pending = true; - while (index < arguments.length) - params[offset++] = arguments[index++]; - return new Promise(function executor(resolve, reject) { - params[offset] = function callback(err/*, varargs */) { - if (pending) { - pending = false; - if (err) - reject(err); - else { - var params = new Array(arguments.length - 1), - offset = 0; - while (offset < params.length) - params[offset++] = arguments[offset]; - resolve.apply(null, params); - } - } - }; - try { - fn.apply(ctx || null, params); - } catch (err) { - if (pending) { - pending = false; - reject(err); - } - } - }); -} - -},{}],2:[function(require,module,exports){ -"use strict"; - -/** - * A minimal base64 implementation for number arrays. - * @memberof util - * @namespace - */ -var base64 = exports; - -/** - * Calculates the byte length of a base64 encoded string. - * @param {string} string Base64 encoded string - * @returns {number} Byte length - */ -base64.length = function length(string) { - var p = string.length; - if (!p) - return 0; - var n = 0; - while (--p % 4 > 1 && string.charAt(p) === "=") - ++n; - return Math.ceil(string.length * 3) / 4 - n; -}; - -// Base64 encoding table -var b64 = new Array(64); - -// Base64 decoding table -var s64 = new Array(123); - -// 65..90, 97..122, 48..57, 43, 47 -for (var i = 0; i < 64;) - s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; - -/** - * Encodes a buffer to a base64 encoded string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} Base64 encoded string - */ -base64.encode = function encode(buffer, start, end) { - var parts = null, - chunk = []; - var i = 0, // output index - j = 0, // goto index - t; // temporary - while (start < end) { - var b = buffer[start++]; - switch (j) { - case 0: - chunk[i++] = b64[b >> 2]; - t = (b & 3) << 4; - j = 1; - break; - case 1: - chunk[i++] = b64[t | b >> 4]; - t = (b & 15) << 2; - j = 2; - break; - case 2: - chunk[i++] = b64[t | b >> 6]; - chunk[i++] = b64[b & 63]; - j = 0; - break; - } - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (j) { - chunk[i++] = b64[t]; - chunk[i++] = 61; - if (j === 1) - chunk[i++] = 61; - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -var invalidEncoding = "invalid encoding"; - -/** - * Decodes a base64 encoded string to a buffer. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Number of bytes written - * @throws {Error} If encoding is invalid - */ -base64.decode = function decode(string, buffer, offset) { - var start = offset; - var j = 0, // goto index - t; // temporary - for (var i = 0; i < string.length;) { - var c = string.charCodeAt(i++); - if (c === 61 && j > 1) - break; - if ((c = s64[c]) === undefined) - throw Error(invalidEncoding); - switch (j) { - case 0: - t = c; - j = 1; - break; - case 1: - buffer[offset++] = t << 2 | (c & 48) >> 4; - t = c; - j = 2; - break; - case 2: - buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; - t = c; - j = 3; - break; - case 3: - buffer[offset++] = (t & 3) << 6 | c; - j = 0; - break; - } - } - if (j === 1) - throw Error(invalidEncoding); - return offset - start; -}; - -/** - * Tests if the specified string appears to be base64 encoded. - * @param {string} string String to test - * @returns {boolean} `true` if probably base64 encoded, otherwise false - */ -base64.test = function test(string) { - return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); -}; - -},{}],3:[function(require,module,exports){ -"use strict"; -module.exports = codegen; - -/** - * Begins generating a function. - * @memberof util - * @param {string[]} functionParams Function parameter names - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - */ -function codegen(functionParams, functionName) { - - /* istanbul ignore if */ - if (typeof functionParams === "string") { - functionName = functionParams; - functionParams = undefined; - } - - var body = []; - - /** - * Appends code to the function's body or finishes generation. - * @typedef Codegen - * @type {function} - * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any - * @param {...*} [formatParams] Format parameters - * @returns {Codegen|Function} Itself or the generated function if finished - * @throws {Error} If format parameter counts do not match - */ - - function Codegen(formatStringOrScope) { - // note that explicit array handling below makes this ~50% faster - - // finish the function - if (typeof formatStringOrScope !== "string") { - var source = toString(); - if (codegen.verbose) - console.log("codegen: " + source); // eslint-disable-line no-console - source = "return " + source; - if (formatStringOrScope) { - var scopeKeys = Object.keys(formatStringOrScope), - scopeParams = new Array(scopeKeys.length + 1), - scopeValues = new Array(scopeKeys.length), - scopeOffset = 0; - while (scopeOffset < scopeKeys.length) { - scopeParams[scopeOffset] = scopeKeys[scopeOffset]; - scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; - } - scopeParams[scopeOffset] = source; - return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func - } - return Function(source)(); // eslint-disable-line no-new-func - } - - // otherwise append to body - var formatParams = new Array(arguments.length - 1), - formatOffset = 0; - while (formatOffset < formatParams.length) - formatParams[formatOffset] = arguments[++formatOffset]; - formatOffset = 0; - formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) { - var value = formatParams[formatOffset++]; - switch ($1) { - case "d": case "f": return String(Number(value)); - case "i": return String(Math.floor(value)); - case "j": return JSON.stringify(value); - case "s": return String(value); - } - return "%"; - }); - if (formatOffset !== formatParams.length) - throw Error("parameter count mismatch"); - body.push(formatStringOrScope); - return Codegen; - } - - function toString(functionNameOverride) { - return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}"; - } - - Codegen.toString = toString; - return Codegen; -} - -/** - * Begins generating a function. - * @memberof util - * @function codegen - * @param {string} [functionName] Function name if not anonymous - * @returns {Codegen} Appender that appends code to the function's body - * @variation 2 - */ - -/** - * When set to `true`, codegen will log generated code to console. Useful for debugging. - * @name util.codegen.verbose - * @type {boolean} - */ -codegen.verbose = false; - -},{}],4:[function(require,module,exports){ -"use strict"; -module.exports = EventEmitter; - -/** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ -function EventEmitter() { - - /** - * Registered listeners. - * @type {Object.} - * @private - */ - this._listeners = {}; -} - -/** - * Registers an event listener. - * @param {string} evt Event name - * @param {function} fn Listener - * @param {*} [ctx] Listener context - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.on = function on(evt, fn, ctx) { - (this._listeners[evt] || (this._listeners[evt] = [])).push({ - fn : fn, - ctx : ctx || this - }); - return this; -}; - -/** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param {string} [evt] Event name. Removes all listeners if omitted. - * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.off = function off(evt, fn) { - if (evt === undefined) - this._listeners = {}; - else { - if (fn === undefined) - this._listeners[evt] = []; - else { - var listeners = this._listeners[evt]; - for (var i = 0; i < listeners.length;) - if (listeners[i].fn === fn) - listeners.splice(i, 1); - else - ++i; - } - } - return this; -}; - -/** - * Emits an event by calling its listeners with the specified arguments. - * @param {string} evt Event name - * @param {...*} args Arguments - * @returns {util.EventEmitter} `this` - */ -EventEmitter.prototype.emit = function emit(evt) { - var listeners = this._listeners[evt]; - if (listeners) { - var args = [], - i = 1; - for (; i < arguments.length;) - args.push(arguments[i++]); - for (i = 0; i < listeners.length;) - listeners[i].fn.apply(listeners[i++].ctx, args); - } - return this; -}; - -},{}],5:[function(require,module,exports){ -"use strict"; -module.exports = fetch; - -var asPromise = require(1), - inquire = require(7); - -var fs = inquire("fs"); - -/** - * Node-style callback as used by {@link util.fetch}. - * @typedef FetchCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {string} [contents] File contents, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Options as used by {@link util.fetch}. - * @typedef FetchOptions - * @type {Object} - * @property {boolean} [binary=false] Whether expecting a binary response - * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest - */ - -/** - * Fetches the contents of a file. - * @memberof util - * @param {string} filename File path or url - * @param {FetchOptions} options Fetch options - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -function fetch(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = {}; - } else if (!options) - options = {}; - - if (!callback) - return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this - - // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found. - if (!options.xhr && fs && fs.readFile) - return fs.readFile(filename, function fetchReadFileCallback(err, contents) { - return err && typeof XMLHttpRequest !== "undefined" - ? fetch.xhr(filename, options, callback) - : err - ? callback(err) - : callback(null, options.binary ? contents : contents.toString("utf8")); - }); - - // use the XHR version otherwise. - return fetch.xhr(filename, options, callback); -} - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ - -/** - * Fetches the contents of a file. - * @name util.fetch - * @function - * @param {string} path File path or url - * @param {FetchOptions} [options] Fetch options - * @returns {Promise} Promise - * @variation 3 - */ - -/**/ -fetch.xhr = function fetch_xhr(filename, options, callback) { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() { - - if (xhr.readyState !== 4) - return undefined; - - // local cors security errors return status 0 / empty string, too. afaik this cannot be - // reliably distinguished from an actually empty file for security reasons. feel free - // to send a pull request if you are aware of a solution. - if (xhr.status !== 0 && xhr.status !== 200) - return callback(Error("status " + xhr.status)); - - // if binary data is expected, make sure that some sort of array is returned, even if - // ArrayBuffers are not supported. the binary string fallback, however, is unsafe. - if (options.binary) { - var buffer = xhr.response; - if (!buffer) { - buffer = []; - for (var i = 0; i < xhr.responseText.length; ++i) - buffer.push(xhr.responseText.charCodeAt(i) & 255); - } - return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); - } - return callback(null, xhr.responseText); - }; - - if (options.binary) { - // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers - if ("overrideMimeType" in xhr) - xhr.overrideMimeType("text/plain; charset=x-user-defined"); - xhr.responseType = "arraybuffer"; - } - - xhr.open("GET", filename); - xhr.send(); -}; - -},{"1":1,"7":7}],6:[function(require,module,exports){ -"use strict"; - -module.exports = factory(factory); - -/** - * Reads / writes floats / doubles from / to buffers. - * @name util.float - * @namespace - */ - -/** - * Writes a 32 bit float to a buffer using little endian byte order. - * @name util.float.writeFloatLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 32 bit float to a buffer using big endian byte order. - * @name util.float.writeFloatBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 32 bit float from a buffer using little endian byte order. - * @name util.float.readFloatLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 32 bit float from a buffer using big endian byte order. - * @name util.float.readFloatBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Writes a 64 bit double to a buffer using little endian byte order. - * @name util.float.writeDoubleLE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Writes a 64 bit double to a buffer using big endian byte order. - * @name util.float.writeDoubleBE - * @function - * @param {number} val Value to write - * @param {Uint8Array} buf Target buffer - * @param {number} pos Target buffer offset - * @returns {undefined} - */ - -/** - * Reads a 64 bit double from a buffer using little endian byte order. - * @name util.float.readDoubleLE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -/** - * Reads a 64 bit double from a buffer using big endian byte order. - * @name util.float.readDoubleBE - * @function - * @param {Uint8Array} buf Source buffer - * @param {number} pos Source buffer offset - * @returns {number} Value read - */ - -// Factory function for the purpose of node-based testing in modified global environments -function factory(exports) { - - // float: typed array - if (typeof Float32Array !== "undefined") (function() { - - var f32 = new Float32Array([ -0 ]), - f8b = new Uint8Array(f32.buffer), - le = f8b[3] === 128; - - function writeFloat_f32_cpy(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - } - - function writeFloat_f32_rev(val, buf, pos) { - f32[0] = val; - buf[pos ] = f8b[3]; - buf[pos + 1] = f8b[2]; - buf[pos + 2] = f8b[1]; - buf[pos + 3] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; - /* istanbul ignore next */ - exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; - - function readFloat_f32_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - return f32[0]; - } - - function readFloat_f32_rev(buf, pos) { - f8b[3] = buf[pos ]; - f8b[2] = buf[pos + 1]; - f8b[1] = buf[pos + 2]; - f8b[0] = buf[pos + 3]; - return f32[0]; - } - - /* istanbul ignore next */ - exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; - /* istanbul ignore next */ - exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; - - // float: ieee754 - })(); else (function() { - - function writeFloat_ieee754(writeUint, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); - else if (isNaN(val)) - writeUint(2143289344, buf, pos); - else if (val > 3.4028234663852886e+38) // +-Infinity - writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); - else if (val < 1.1754943508222875e-38) // denormal - writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); - else { - var exponent = Math.floor(Math.log(val) / Math.LN2), - mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; - writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); - } - } - - exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); - exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); - - function readFloat_ieee754(readUint, buf, pos) { - var uint = readUint(buf, pos), - sign = (uint >> 31) * 2 + 1, - exponent = uint >>> 23 & 255, - mantissa = uint & 8388607; - return exponent === 255 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 1.401298464324817e-45 * mantissa - : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); - } - - exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); - exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); - - })(); - - // double: typed array - if (typeof Float64Array !== "undefined") (function() { - - var f64 = new Float64Array([-0]), - f8b = new Uint8Array(f64.buffer), - le = f8b[7] === 128; - - function writeDouble_f64_cpy(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[0]; - buf[pos + 1] = f8b[1]; - buf[pos + 2] = f8b[2]; - buf[pos + 3] = f8b[3]; - buf[pos + 4] = f8b[4]; - buf[pos + 5] = f8b[5]; - buf[pos + 6] = f8b[6]; - buf[pos + 7] = f8b[7]; - } - - function writeDouble_f64_rev(val, buf, pos) { - f64[0] = val; - buf[pos ] = f8b[7]; - buf[pos + 1] = f8b[6]; - buf[pos + 2] = f8b[5]; - buf[pos + 3] = f8b[4]; - buf[pos + 4] = f8b[3]; - buf[pos + 5] = f8b[2]; - buf[pos + 6] = f8b[1]; - buf[pos + 7] = f8b[0]; - } - - /* istanbul ignore next */ - exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; - /* istanbul ignore next */ - exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; - - function readDouble_f64_cpy(buf, pos) { - f8b[0] = buf[pos ]; - f8b[1] = buf[pos + 1]; - f8b[2] = buf[pos + 2]; - f8b[3] = buf[pos + 3]; - f8b[4] = buf[pos + 4]; - f8b[5] = buf[pos + 5]; - f8b[6] = buf[pos + 6]; - f8b[7] = buf[pos + 7]; - return f64[0]; - } - - function readDouble_f64_rev(buf, pos) { - f8b[7] = buf[pos ]; - f8b[6] = buf[pos + 1]; - f8b[5] = buf[pos + 2]; - f8b[4] = buf[pos + 3]; - f8b[3] = buf[pos + 4]; - f8b[2] = buf[pos + 5]; - f8b[1] = buf[pos + 6]; - f8b[0] = buf[pos + 7]; - return f64[0]; - } - - /* istanbul ignore next */ - exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; - /* istanbul ignore next */ - exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; - - // double: ieee754 - })(); else (function() { - - function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { - var sign = val < 0 ? 1 : 0; - if (sign) - val = -val; - if (val === 0) { - writeUint(0, buf, pos + off0); - writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); - } else if (isNaN(val)) { - writeUint(0, buf, pos + off0); - writeUint(2146959360, buf, pos + off1); - } else if (val > 1.7976931348623157e+308) { // +-Infinity - writeUint(0, buf, pos + off0); - writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); - } else { - var mantissa; - if (val < 2.2250738585072014e-308) { // denormal - mantissa = val / 5e-324; - writeUint(mantissa >>> 0, buf, pos + off0); - writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); - } else { - var exponent = Math.floor(Math.log(val) / Math.LN2); - if (exponent === 1024) - exponent = 1023; - mantissa = val * Math.pow(2, -exponent); - writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); - writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); - } - } - } - - exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); - exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); - - function readDouble_ieee754(readUint, off0, off1, buf, pos) { - var lo = readUint(buf, pos + off0), - hi = readUint(buf, pos + off1); - var sign = (hi >> 31) * 2 + 1, - exponent = hi >>> 20 & 2047, - mantissa = 4294967296 * (hi & 1048575) + lo; - return exponent === 2047 - ? mantissa - ? NaN - : sign * Infinity - : exponent === 0 // denormal - ? sign * 5e-324 * mantissa - : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); - } - - exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); - exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); - - })(); - - return exports; -} - -// uint helpers - -function writeUintLE(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -function writeUintBE(val, buf, pos) { - buf[pos ] = val >>> 24; - buf[pos + 1] = val >>> 16 & 255; - buf[pos + 2] = val >>> 8 & 255; - buf[pos + 3] = val & 255; -} - -function readUintLE(buf, pos) { - return (buf[pos ] - | buf[pos + 1] << 8 - | buf[pos + 2] << 16 - | buf[pos + 3] << 24) >>> 0; -} - -function readUintBE(buf, pos) { - return (buf[pos ] << 24 - | buf[pos + 1] << 16 - | buf[pos + 2] << 8 - | buf[pos + 3]) >>> 0; -} - -},{}],7:[function(require,module,exports){ -"use strict"; -module.exports = inquire; - -/** - * Requires a module only if available. - * @memberof util - * @param {string} moduleName Module to require - * @returns {?Object} Required module if available and not empty, otherwise `null` - */ -function inquire(moduleName) { - try { - var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval - if (mod && (mod.length || Object.keys(mod).length)) - return mod; - } catch (e) {} // eslint-disable-line no-empty - return null; -} - -},{}],8:[function(require,module,exports){ -"use strict"; - -/** - * A minimal path module to resolve Unix, Windows and URL paths alike. - * @memberof util - * @namespace - */ -var path = exports; - -var isAbsolute = -/** - * Tests if the specified path is absolute. - * @param {string} path Path to test - * @returns {boolean} `true` if path is absolute - */ -path.isAbsolute = function isAbsolute(path) { - return /^(?:\/|\w+:)/.test(path); -}; - -var normalize = -/** - * Normalizes the specified path. - * @param {string} path Path to normalize - * @returns {string} Normalized path - */ -path.normalize = function normalize(path) { - path = path.replace(/\\/g, "/") - .replace(/\/{2,}/g, "/"); - var parts = path.split("/"), - absolute = isAbsolute(path), - prefix = ""; - if (absolute) - prefix = parts.shift() + "/"; - for (var i = 0; i < parts.length;) { - if (parts[i] === "..") { - if (i > 0 && parts[i - 1] !== "..") - parts.splice(--i, 2); - else if (absolute) - parts.splice(i, 1); - else - ++i; - } else if (parts[i] === ".") - parts.splice(i, 1); - else - ++i; - } - return prefix + parts.join("/"); -}; - -/** - * Resolves the specified include path against the specified origin path. - * @param {string} originPath Path to the origin file - * @param {string} includePath Include path relative to origin path - * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized - * @returns {string} Path to the include file - */ -path.resolve = function resolve(originPath, includePath, alreadyNormalized) { - if (!alreadyNormalized) - includePath = normalize(includePath); - if (isAbsolute(includePath)) - return includePath; - if (!alreadyNormalized) - originPath = normalize(originPath); - return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; -}; - -},{}],9:[function(require,module,exports){ -"use strict"; -module.exports = pool; - -/** - * An allocator as used by {@link util.pool}. - * @typedef PoolAllocator - * @type {function} - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ - -/** - * A slicer as used by {@link util.pool}. - * @typedef PoolSlicer - * @type {function} - * @param {number} start Start offset - * @param {number} end End offset - * @returns {Uint8Array} Buffer slice - * @this {Uint8Array} - */ - -/** - * A general purpose buffer pool. - * @memberof util - * @function - * @param {PoolAllocator} alloc Allocator - * @param {PoolSlicer} slice Slicer - * @param {number} [size=8192] Slab size - * @returns {PoolAllocator} Pooled allocator - */ -function pool(alloc, slice, size) { - var SIZE = size || 8192; - var MAX = SIZE >>> 1; - var slab = null; - var offset = SIZE; - return function pool_alloc(size) { - if (size < 1 || size > MAX) - return alloc(size); - if (offset + size > SIZE) { - slab = alloc(SIZE); - offset = 0; - } - var buf = slice.call(slab, offset, offset += size); - if (offset & 7) // align to 32 bit - offset = (offset | 7) + 1; - return buf; - }; -} - -},{}],10:[function(require,module,exports){ -"use strict"; - -/** - * A minimal UTF8 implementation for number arrays. - * @memberof util - * @namespace - */ -var utf8 = exports; - -/** - * Calculates the UTF8 byte length of a string. - * @param {string} string String - * @returns {number} Byte length - */ -utf8.length = function utf8_length(string) { - var len = 0, - c = 0; - for (var i = 0; i < string.length; ++i) { - c = string.charCodeAt(i); - if (c < 128) - len += 1; - else if (c < 2048) - len += 2; - else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { - ++i; - len += 4; - } else - len += 3; - } - return len; -}; - -/** - * Reads UTF8 bytes as a string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} String read - */ -utf8.read = function utf8_read(buffer, start, end) { - var len = end - start; - if (len < 1) - return ""; - var parts = null, - chunk = [], - i = 0, // char offset - t; // temporary - while (start < end) { - t = buffer[start++]; - if (t < 128) - chunk[i++] = t; - else if (t > 191 && t < 224) - chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; - else if (t > 239 && t < 365) { - t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; - chunk[i++] = 0xD800 + (t >> 10); - chunk[i++] = 0xDC00 + (t & 1023); - } else - chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); - } - return String.fromCharCode.apply(String, chunk.slice(0, i)); -}; - -/** - * Writes a string as UTF8 bytes. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Bytes written - */ -utf8.write = function utf8_write(string, buffer, offset) { - var start = offset, - c1, // character 1 - c2; // character 2 - for (var i = 0; i < string.length; ++i) { - c1 = string.charCodeAt(i); - if (c1 < 128) { - buffer[offset++] = c1; - } else if (c1 < 2048) { - buffer[offset++] = c1 >> 6 | 192; - buffer[offset++] = c1 & 63 | 128; - } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - ++i; - buffer[offset++] = c1 >> 18 | 240; - buffer[offset++] = c1 >> 12 & 63 | 128; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } else { - buffer[offset++] = c1 >> 12 | 224; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } - } - return offset - start; -}; - -},{}],11:[function(require,module,exports){ -"use strict"; -module.exports = common; - -var commonRe = /\/|\./; - -/** - * Provides common type definitions. - * Can also be used to provide additional google types or your own custom types. - * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name - * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition - * @returns {undefined} - * @property {INamespace} google/protobuf/any.proto Any - * @property {INamespace} google/protobuf/duration.proto Duration - * @property {INamespace} google/protobuf/empty.proto Empty - * @property {INamespace} google/protobuf/field_mask.proto FieldMask - * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue - * @property {INamespace} google/protobuf/timestamp.proto Timestamp - * @property {INamespace} google/protobuf/wrappers.proto Wrappers - * @example - * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension) - * protobuf.common("descriptor", descriptorJson); - * - * // manually provides a custom definition (uses my.foo namespace) - * protobuf.common("my/foo/bar.proto", myFooBarJson); - */ -function common(name, json) { - if (!commonRe.test(name)) { - name = "google/protobuf/" + name + ".proto"; - json = { nested: { google: { nested: { protobuf: { nested: json } } } } }; - } - common[name] = json; -} - -// Not provided because of limited use (feel free to discuss or to provide yourself): -// -// google/protobuf/descriptor.proto -// google/protobuf/source_context.proto -// google/protobuf/type.proto -// -// Stripped and pre-parsed versions of these non-bundled files are instead available as part of -// the repository or package within the google/protobuf directory. - -common("any", { - - /** - * Properties of a google.protobuf.Any message. - * @interface IAny - * @type {Object} - * @property {string} [typeUrl] - * @property {Uint8Array} [bytes] - * @memberof common - */ - Any: { - fields: { - type_url: { - type: "string", - id: 1 - }, - value: { - type: "bytes", - id: 2 - } - } - } -}); - -var timeType; - -common("duration", { - - /** - * Properties of a google.protobuf.Duration message. - * @interface IDuration - * @type {Object} - * @property {number|Long} [seconds] - * @property {number} [nanos] - * @memberof common - */ - Duration: timeType = { - fields: { - seconds: { - type: "int64", - id: 1 - }, - nanos: { - type: "int32", - id: 2 - } - } - } -}); - -common("timestamp", { - - /** - * Properties of a google.protobuf.Timestamp message. - * @interface ITimestamp - * @type {Object} - * @property {number|Long} [seconds] - * @property {number} [nanos] - * @memberof common - */ - Timestamp: timeType -}); - -common("empty", { - - /** - * Properties of a google.protobuf.Empty message. - * @interface IEmpty - * @memberof common - */ - Empty: { - fields: {} - } -}); - -common("struct", { - - /** - * Properties of a google.protobuf.Struct message. - * @interface IStruct - * @type {Object} - * @property {Object.} [fields] - * @memberof common - */ - Struct: { - fields: { - fields: { - keyType: "string", - type: "Value", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Value message. - * @interface IValue - * @type {Object} - * @property {string} [kind] - * @property {0} [nullValue] - * @property {number} [numberValue] - * @property {string} [stringValue] - * @property {boolean} [boolValue] - * @property {IStruct} [structValue] - * @property {IListValue} [listValue] - * @memberof common - */ - Value: { - oneofs: { - kind: { - oneof: [ - "nullValue", - "numberValue", - "stringValue", - "boolValue", - "structValue", - "listValue" - ] - } - }, - fields: { - nullValue: { - type: "NullValue", - id: 1 - }, - numberValue: { - type: "double", - id: 2 - }, - stringValue: { - type: "string", - id: 3 - }, - boolValue: { - type: "bool", - id: 4 - }, - structValue: { - type: "Struct", - id: 5 - }, - listValue: { - type: "ListValue", - id: 6 - } - } - }, - - NullValue: { - values: { - NULL_VALUE: 0 - } - }, - - /** - * Properties of a google.protobuf.ListValue message. - * @interface IListValue - * @type {Object} - * @property {Array.} [values] - * @memberof common - */ - ListValue: { - fields: { - values: { - rule: "repeated", - type: "Value", - id: 1 - } - } - } -}); - -common("wrappers", { - - /** - * Properties of a google.protobuf.DoubleValue message. - * @interface IDoubleValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - DoubleValue: { - fields: { - value: { - type: "double", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.FloatValue message. - * @interface IFloatValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - FloatValue: { - fields: { - value: { - type: "float", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Int64Value message. - * @interface IInt64Value - * @type {Object} - * @property {number|Long} [value] - * @memberof common - */ - Int64Value: { - fields: { - value: { - type: "int64", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.UInt64Value message. - * @interface IUInt64Value - * @type {Object} - * @property {number|Long} [value] - * @memberof common - */ - UInt64Value: { - fields: { - value: { - type: "uint64", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Int32Value message. - * @interface IInt32Value - * @type {Object} - * @property {number} [value] - * @memberof common - */ - Int32Value: { - fields: { - value: { - type: "int32", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.UInt32Value message. - * @interface IUInt32Value - * @type {Object} - * @property {number} [value] - * @memberof common - */ - UInt32Value: { - fields: { - value: { - type: "uint32", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.BoolValue message. - * @interface IBoolValue - * @type {Object} - * @property {boolean} [value] - * @memberof common - */ - BoolValue: { - fields: { - value: { - type: "bool", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.StringValue message. - * @interface IStringValue - * @type {Object} - * @property {string} [value] - * @memberof common - */ - StringValue: { - fields: { - value: { - type: "string", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.BytesValue message. - * @interface IBytesValue - * @type {Object} - * @property {Uint8Array} [value] - * @memberof common - */ - BytesValue: { - fields: { - value: { - type: "bytes", - id: 1 - } - } - } -}); - -common("field_mask", { - - /** - * Properties of a google.protobuf.FieldMask message. - * @interface IDoubleValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - FieldMask: { - fields: { - paths: { - rule: "repeated", - type: "string", - id: 1 - } - } - } -}); - -/** - * Gets the root definition of the specified common proto file. - * - * Bundled definitions are: - * - google/protobuf/any.proto - * - google/protobuf/duration.proto - * - google/protobuf/empty.proto - * - google/protobuf/field_mask.proto - * - google/protobuf/struct.proto - * - google/protobuf/timestamp.proto - * - google/protobuf/wrappers.proto - * - * @param {string} file Proto file name - * @returns {INamespace|null} Root definition or `null` if not defined - */ -common.get = function get(file) { - return common[file] || null; -}; - -},{}],12:[function(require,module,exports){ -"use strict"; -/** - * Runtime message from/to plain object converters. - * @namespace - */ -var converter = exports; - -var Enum = require(15), - util = require(37); - -/** - * Generates a partial value fromObject conveter. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} prop Property reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genValuePartial_fromObject(gen, field, fieldIndex, prop) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(d%s){", prop); - for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) { - if (field.repeated && values[keys[i]] === field.typeDefault) gen - ("default:"); - gen - ("case%j:", keys[i]) - ("case %i:", values[keys[i]]) - ("m%s=%j", prop, values[keys[i]]) - ("break"); - } gen - ("}"); - } else gen - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s=types[%i].fromObject(d%s)", prop, fieldIndex, prop); - } else { - var isUnsigned = false; - switch (field.type) { - case "double": - case "float": gen - ("m%s=Number(d%s)", prop, prop); // also catches "NaN", "Infinity" - break; - case "uint32": - case "fixed32": gen - ("m%s=d%s>>>0", prop, prop); - break; - case "int32": - case "sint32": - case "sfixed32": gen - ("m%s=d%s|0", prop, prop); - break; - case "uint64": - isUnsigned = true; - // eslint-disable-line no-fallthrough - case "int64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(util.Long)") - ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned) - ("else if(typeof d%s===\"string\")", prop) - ("m%s=parseInt(d%s,10)", prop, prop) - ("else if(typeof d%s===\"number\")", prop) - ("m%s=d%s", prop, prop) - ("else if(typeof d%s===\"object\")", prop) - ("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : ""); - break; - case "bytes": gen - ("if(typeof d%s===\"string\")", prop) - ("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop) - ("else if(d%s.length)", prop) - ("m%s=d%s", prop, prop); - break; - case "string": gen - ("m%s=String(d%s)", prop, prop); - break; - case "bool": gen - ("m%s=Boolean(d%s)", prop, prop); - break; - /* default: gen - ("m%s=d%s", prop, prop); - break; */ - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a plain object to runtime message converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.fromObject = function fromObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray; - var gen = util.codegen(["d"], mtype.name + "$fromObject") - ("if(d instanceof this.ctor)") - ("return d"); - if (!fields.length) return gen - ("return new this.ctor"); - gen - ("var m=new this.ctor"); - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - prop = util.safeProp(field.name); - - // Map fields - if (field.map) { gen - ("if(d%s){", prop) - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s={}", prop) - ("for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop); - break; - case "bytes": gen - ("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop); - break; - default: gen - ("d%s=m%s", prop, prop); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a runtime message to plain object converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.toObject = function toObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); - if (!fields.length) - return util.codegen()("return {}"); - var gen = util.codegen(["m", "o"], mtype.name + "$toObject") - ("if(!o)") - ("o={}") - ("var d={}"); - - var repeatedFields = [], - mapFields = [], - normalFields = [], - i = 0; - for (; i < fields.length; ++i) - if (!fields[i].partOf) - ( fields[i].resolve().repeated ? repeatedFields - : fields[i].map ? mapFields - : normalFields).push(fields[i]); - - if (repeatedFields.length) { gen - ("if(o.arrays||o.defaults){"); - for (i = 0; i < repeatedFields.length; ++i) gen - ("d%s=[]", util.safeProp(repeatedFields[i].name)); - gen - ("}"); - } - - if (mapFields.length) { gen - ("if(o.objects||o.defaults){"); - for (i = 0; i < mapFields.length; ++i) gen - ("d%s={}", util.safeProp(mapFields[i].name)); - gen - ("}"); - } - - if (normalFields.length) { gen - ("if(o.defaults){"); - for (i = 0; i < normalFields.length; ++i) { - var field = normalFields[i], - prop = util.safeProp(field.name); - if (field.resolvedType instanceof Enum) gen - ("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault); - else if (field.long) gen - ("if(util.Long){") - ("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned) - ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop) - ("}else") - ("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber()); - else if (field.bytes) { - var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]"; - gen - ("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault)) - ("else{") - ("d%s=%s", prop, arrayDefault) - ("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop) - ("}"); - } else gen - ("d%s=%j", prop, field.typeDefault); // also messages (=null) - } gen - ("}"); - } - var hasKs2 = false; - for (i = 0; i < fields.length; ++i) { - var field = fields[i], - index = mtype._fieldsArray.indexOf(field), - prop = util.safeProp(field.name); - if (field.map) { - if (!hasKs2) { hasKs2 = true; gen - ("var ks2"); - } gen - ("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop) - ("d%s={}", prop) - ("for(var j=0;j>>3){"); - - var i = 0; - for (; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - ref = "m" + util.safeProp(field.name); gen - ("case %i:", field.id); - - // Map fields - if (field.map) { gen - ("if(%s===util.emptyObject)", ref) - ("%s={}", ref) - ("var c2 = r.uint32()+r.pos"); - - if (types.defaults[field.keyType] !== undefined) gen - ("k=%j", types.defaults[field.keyType]); - else gen - ("k=null"); - - if (types.defaults[type] !== undefined) gen - ("value=%j", types.defaults[type]); - else gen - ("value=null"); - - gen - ("while(r.pos>>3){") - ("case 1: k=r.%s(); break", field.keyType) - ("case 2:"); - - if (types.basic[type] === undefined) gen - ("value=types[%i].decode(r,r.uint32())", i); // can't be groups - else gen - ("value=r.%s()", type); - - gen - ("break") - ("default:") - ("r.skipType(tag2&7)") - ("break") - ("}") - ("}"); - - if (types.long[field.keyType] !== undefined) gen - ("%s[typeof k===\"object\"?util.longToHash(k):k]=value", ref); - else gen - ("%s[k]=value", ref); - - // Repeated fields - } else if (field.repeated) { gen - - ("if(!(%s&&%s.length))", ref, ref) - ("%s=[]", ref); - - // Packable (always check for forward and backward compatiblity) - if (types.packed[type] !== undefined) gen - ("if((t&7)===2){") - ("var c2=r.uint32()+r.pos") - ("while(r.pos>> 0, (field.id << 3 | 4) >>> 0) - : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0); -} - -/** - * Generates an encoder specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function encoder(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var gen = util.codegen(["m", "w"], mtype.name + "$encode") - ("if(!w)") - ("w=Writer.create()"); - - var i, ref; - - // "when a message is serialized its known fields should be written sequentially by field number" - var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById); - - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - index = mtype._fieldsArray.indexOf(field), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - wireType = types.basic[type]; - ref = "m" + util.safeProp(field.name); - - // Map fields - if (field.map) { - gen - ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name) // !== undefined && !== null - ("for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType); - if (wireType === undefined) gen - ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups - else gen - (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); - gen - ("}") - ("}"); - - // Repeated fields - } else if (field.repeated) { gen - ("if(%s!=null&&%s.length){", ref, ref); // !== undefined && !== null - - // Packed repeated - if (field.packed && types.packed[type] !== undefined) { gen - - ("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0) - ("for(var i=0;i<%s.length;++i)", ref) - ("w.%s(%s[i])", type, ref) - ("w.ldelim()"); - - // Non-packed - } else { gen - - ("for(var i=0;i<%s.length;++i)", ref); - if (wireType === undefined) - genTypePartial(gen, field, index, ref + "[i]"); - else gen - ("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); - - } gen - ("}"); - - // Non-repeated - } else { - if (field.optional) gen - ("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", ref, field.name); // !== undefined && !== null - - if (wireType === undefined) - genTypePartial(gen, field, index, ref); - else gen - ("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref); - - } - } - - return gen - ("return w"); - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -},{"15":15,"36":36,"37":37}],15:[function(require,module,exports){ -"use strict"; -module.exports = Enum; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum"; - -var Namespace = require(23), - util = require(37); - -/** - * Constructs a new enum instance. - * @classdesc Reflected enum. - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {Object.} [values] Enum values as an object, by name - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this enum - * @param {Object.} [comments] The value comments for this enum - */ -function Enum(name, values, options, comment, comments) { - ReflectionObject.call(this, name, options); - - if (values && typeof values !== "object") - throw TypeError("values must be an object"); - - /** - * Enum values by id. - * @type {Object.} - */ - this.valuesById = {}; - - /** - * Enum values by name. - * @type {Object.} - */ - this.values = Object.create(this.valuesById); // toJSON, marker - - /** - * Enum comment text. - * @type {string|null} - */ - this.comment = comment; - - /** - * Value comment texts, if any. - * @type {Object.} - */ - this.comments = comments || {}; - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - // Note that values inherit valuesById on their prototype which makes them a TypeScript- - // compatible enum. This is used by pbts to write actual enum definitions that work for - // static and reflection code alike instead of emitting generic object definitions. - - if (values) - for (var keys = Object.keys(values), i = 0; i < keys.length; ++i) - if (typeof values[keys[i]] === "number") // use forward entries only - this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i]; -} - -/** - * Enum descriptor. - * @interface IEnum - * @property {Object.} values Enum values - * @property {Object.} [options] Enum options - */ - -/** - * Constructs an enum from an enum descriptor. - * @param {string} name Enum name - * @param {IEnum} json Enum descriptor - * @returns {Enum} Created enum - * @throws {TypeError} If arguments are invalid - */ -Enum.fromJSON = function fromJSON(name, json) { - var enm = new Enum(name, json.values, json.options, json.comment, json.comments); - enm.reserved = json.reserved; - return enm; -}; - -/** - * Converts this enum to an enum descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IEnum} Enum descriptor - */ -Enum.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "values" , this.values, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "comment" , keepComments ? this.comment : undefined, - "comments" , keepComments ? this.comments : undefined - ]); -}; - -/** - * Adds a value to this enum. - * @param {string} name Value name - * @param {number} id Value id - * @param {string} [comment] Comment, if any - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a value with this name or id - */ -Enum.prototype.add = function add(name, id, comment) { - // utilized by the parser but not by .fromJSON - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (!util.isInteger(id)) - throw TypeError("id must be an integer"); - - if (this.values[name] !== undefined) - throw Error("duplicate name '" + name + "' in " + this); - - if (this.isReservedId(id)) - throw Error("id " + id + " is reserved in " + this); - - if (this.isReservedName(name)) - throw Error("name '" + name + "' is reserved in " + this); - - if (this.valuesById[id] !== undefined) { - if (!(this.options && this.options.allow_alias)) - throw Error("duplicate id " + id + " in " + this); - this.values[name] = id; - } else - this.valuesById[this.values[name] = id] = name; - - this.comments[name] = comment || null; - return this; -}; - -/** - * Removes a value from this enum - * @param {string} name Value name - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `name` is not a name of this enum - */ -Enum.prototype.remove = function remove(name) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - var val = this.values[name]; - if (val == null) - throw Error("name '" + name + "' does not exist in " + this); - - delete this.valuesById[val]; - delete this.values[name]; - delete this.comments[name]; - - return this; -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; - -},{"23":23,"24":24,"37":37}],16:[function(require,module,exports){ -"use strict"; -module.exports = Field; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field"; - -var Enum = require(15), - types = require(36), - util = require(37); - -var Type; // cyclic - -var ruleRe = /^required|optional|repeated$/; - -/** - * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. - * @name Field - * @classdesc Reflected message field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a field from a field descriptor. - * @param {string} name Field name - * @param {IField} json Field descriptor - * @returns {Field} Created field - * @throws {TypeError} If arguments are invalid - */ -Field.fromJSON = function fromJSON(name, json) { - return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment); -}; - -/** - * Not an actual constructor. Use {@link Field} instead. - * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. - * @exports FieldBase - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function Field(name, id, type, rule, extend, options, comment) { - - if (util.isObject(rule)) { - comment = extend; - options = rule; - rule = extend = undefined; - } else if (util.isObject(extend)) { - comment = options; - options = extend; - extend = undefined; - } - - ReflectionObject.call(this, name, options); - - if (!util.isInteger(id) || id < 0) - throw TypeError("id must be a non-negative integer"); - - if (!util.isString(type)) - throw TypeError("type must be a string"); - - if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase())) - throw TypeError("rule must be a string rule"); - - if (extend !== undefined && !util.isString(extend)) - throw TypeError("extend must be a string"); - - /** - * Field rule, if any. - * @type {string|undefined} - */ - this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON - - /** - * Field type. - * @type {string} - */ - this.type = type; // toJSON - - /** - * Unique field id. - * @type {number} - */ - this.id = id; // toJSON, marker - - /** - * Extended type if different from parent. - * @type {string|undefined} - */ - this.extend = extend || undefined; // toJSON - - /** - * Whether this field is required. - * @type {boolean} - */ - this.required = rule === "required"; - - /** - * Whether this field is optional. - * @type {boolean} - */ - this.optional = !this.required; - - /** - * Whether this field is repeated. - * @type {boolean} - */ - this.repeated = rule === "repeated"; - - /** - * Whether this field is a map or not. - * @type {boolean} - */ - this.map = false; - - /** - * Message this field belongs to. - * @type {Type|null} - */ - this.message = null; - - /** - * OneOf this field belongs to, if any, - * @type {OneOf|null} - */ - this.partOf = null; - - /** - * The field type's default value. - * @type {*} - */ - this.typeDefault = null; - - /** - * The field's default value on prototypes. - * @type {*} - */ - this.defaultValue = null; - - /** - * Whether this field's value should be treated as a long. - * @type {boolean} - */ - this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false; - - /** - * Whether this field's value is a buffer. - * @type {boolean} - */ - this.bytes = type === "bytes"; - - /** - * Resolved type if not a basic type. - * @type {Type|Enum|null} - */ - this.resolvedType = null; - - /** - * Sister-field within the extended type if a declaring extension field. - * @type {Field|null} - */ - this.extensionField = null; - - /** - * Sister-field within the declaring namespace if an extended field. - * @type {Field|null} - */ - this.declaringField = null; - - /** - * Internally remembers whether this field is packed. - * @type {boolean|null} - * @private - */ - this._packed = null; - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Determines whether this field is packed. Only relevant when repeated and working with proto2. - * @name Field#packed - * @type {boolean} - * @readonly - */ -Object.defineProperty(Field.prototype, "packed", { - get: function() { - // defaults to packed=true if not explicity set to false - if (this._packed === null) - this._packed = this.getOption("packed") !== false; - return this._packed; - } -}); - -/** - * @override - */ -Field.prototype.setOption = function setOption(name, value, ifNotSet) { - if (name === "packed") // clear cached before setting - this._packed = null; - return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet); -}; - -/** - * Field descriptor. - * @interface IField - * @property {string} [rule="optional"] Field rule - * @property {string} type Field type - * @property {number} id Field id - * @property {Object.} [options] Field options - */ - -/** - * Extension field descriptor. - * @interface IExtensionField - * @extends IField - * @property {string} extend Extended type - */ - -/** - * Converts this field to a field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IField} Field descriptor - */ -Field.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "rule" , this.rule !== "optional" && this.rule || undefined, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Resolves this field's type references. - * @returns {Field} `this` - * @throws {Error} If any reference cannot be resolved - */ -Field.prototype.resolve = function resolve() { - - if (this.resolved) - return this; - - if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it - this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type); - if (this.resolvedType instanceof Type) - this.typeDefault = null; - else // instanceof Enum - this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined - } - - // use explicitly set default value if present - if (this.options && this.options["default"] != null) { - this.typeDefault = this.options["default"]; - if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string") - this.typeDefault = this.resolvedType.values[this.typeDefault]; - } - - // remove unnecessary options - if (this.options) { - if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum)) - delete this.options.packed; - if (!Object.keys(this.options).length) - this.options = undefined; - } - - // convert to internal data type if necesssary - if (this.long) { - this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"); - - /* istanbul ignore else */ - if (Object.freeze) - Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it) - - } else if (this.bytes && typeof this.typeDefault === "string") { - var buf; - if (util.base64.test(this.typeDefault)) - util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0); - else - util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0); - this.typeDefault = buf; - } - - // take special care of maps and repeated fields - if (this.map) - this.defaultValue = util.emptyObject; - else if (this.repeated) - this.defaultValue = util.emptyArray; - else - this.defaultValue = this.typeDefault; - - // ensure proper value on prototype - if (this.parent instanceof Type) - this.parent.ctor.prototype[this.name] = this.defaultValue; - - return ReflectionObject.prototype.resolve.call(this); -}; - -/** - * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript). - * @typedef FieldDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} fieldName Field name - * @returns {undefined} - */ - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|Object} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @param {T} [defaultValue] Default value - * @returns {FieldDecorator} Decorator function - * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[] - */ -Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) { - - // submessage: decorate the submessage and use its name as the type - if (typeof fieldType === "function") - fieldType = util.decorateType(fieldType).name; - - // enum reference: create a reflected copy of the enum and keep reuseing it - else if (fieldType && typeof fieldType === "object") - fieldType = util.decorateEnum(fieldType).name; - - return function fieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue })); - }; -}; - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {Constructor|string} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @returns {FieldDecorator} Decorator function - * @template T extends Message - * @variation 2 - */ -// like Field.d but without a default value - -// Sets up cyclic dependencies (called in index-light) -Field._configure = function configure(Type_) { - Type = Type_; -}; - -},{"15":15,"24":24,"36":36,"37":37}],17:[function(require,module,exports){ -"use strict"; -var protobuf = module.exports = require(18); - -protobuf.build = "light"; - -/** - * A node-style callback as used by {@link load} and {@link Root#load}. - * @typedef LoadCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Root} [root] Root, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @param {string|string[]} filename One or multiple files to load - * @param {Root} root Root namespace, defaults to create a new one if omitted. - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - */ -function load(filename, root, callback) { - if (typeof root === "function") { - callback = root; - root = new protobuf.Root(); - } else if (!root) - root = new protobuf.Root(); - return root.load(filename, callback); -} - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Promise} Promise - * @see {@link Root#load} - * @variation 3 - */ -// function load(filename:string, [root:Root]):Promise - -protobuf.load = load; - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - * @see {@link Root#loadSync} - */ -function loadSync(filename, root) { - if (!root) - root = new protobuf.Root(); - return root.loadSync(filename); -} - -protobuf.loadSync = loadSync; - -// Serialization -protobuf.encoder = require(14); -protobuf.decoder = require(13); -protobuf.verifier = require(40); -protobuf.converter = require(12); - -// Reflection -protobuf.ReflectionObject = require(24); -protobuf.Namespace = require(23); -protobuf.Root = require(29); -protobuf.Enum = require(15); -protobuf.Type = require(35); -protobuf.Field = require(16); -protobuf.OneOf = require(25); -protobuf.MapField = require(20); -protobuf.Service = require(33); -protobuf.Method = require(22); - -// Runtime -protobuf.Message = require(21); -protobuf.wrappers = require(41); - -// Utility -protobuf.types = require(36); -protobuf.util = require(37); - -// Set up possibly cyclic reflection dependencies -protobuf.ReflectionObject._configure(protobuf.Root); -protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum); -protobuf.Root._configure(protobuf.Type); -protobuf.Field._configure(protobuf.Type); - -},{"12":12,"13":13,"14":14,"15":15,"16":16,"18":18,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"29":29,"33":33,"35":35,"36":36,"37":37,"40":40,"41":41}],18:[function(require,module,exports){ -"use strict"; -var protobuf = exports; - -/** - * Build type, one of `"full"`, `"light"` or `"minimal"`. - * @name build - * @type {string} - * @const - */ -protobuf.build = "minimal"; - -// Serialization -protobuf.Writer = require(42); -protobuf.BufferWriter = require(43); -protobuf.Reader = require(27); -protobuf.BufferReader = require(28); - -// Utility -protobuf.util = require(39); -protobuf.rpc = require(31); -protobuf.roots = require(30); -protobuf.configure = configure; - -/* istanbul ignore next */ -/** - * Reconfigures the library according to the environment. - * @returns {undefined} - */ -function configure() { - protobuf.util._configure(); - protobuf.Writer._configure(protobuf.BufferWriter); - protobuf.Reader._configure(protobuf.BufferReader); -} - -// Set up buffer utility according to the environment -configure(); - -},{"27":27,"28":28,"30":30,"31":31,"39":39,"42":42,"43":43}],19:[function(require,module,exports){ -"use strict"; -var protobuf = module.exports = require(17); - -protobuf.build = "full"; - -// Parser -protobuf.tokenize = require(34); -protobuf.parse = require(26); -protobuf.common = require(11); - -// Configure parser -protobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common); - -},{"11":11,"17":17,"26":26,"34":34}],20:[function(require,module,exports){ -"use strict"; -module.exports = MapField; - -// extends Field -var Field = require(16); -((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; - -var types = require(36), - util = require(37); - -/** - * Constructs a new map field instance. - * @classdesc Reflected map field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} keyType Key type - * @param {string} type Value type - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function MapField(name, id, keyType, type, options, comment) { - Field.call(this, name, id, type, undefined, undefined, options, comment); - - /* istanbul ignore if */ - if (!util.isString(keyType)) - throw TypeError("keyType must be a string"); - - /** - * Key type. - * @type {string} - */ - this.keyType = keyType; // toJSON, marker - - /** - * Resolved key type if not a basic type. - * @type {ReflectionObject|null} - */ - this.resolvedKeyType = null; - - // Overrides Field#map - this.map = true; -} - -/** - * Map field descriptor. - * @interface IMapField - * @extends {IField} - * @property {string} keyType Key type - */ - -/** - * Extension map field descriptor. - * @interface IExtensionMapField - * @extends IMapField - * @property {string} extend Extended type - */ - -/** - * Constructs a map field from a map field descriptor. - * @param {string} name Field name - * @param {IMapField} json Map field descriptor - * @returns {MapField} Created map field - * @throws {TypeError} If arguments are invalid - */ -MapField.fromJSON = function fromJSON(name, json) { - return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment); -}; - -/** - * Converts this map field to a map field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMapField} Map field descriptor - */ -MapField.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "keyType" , this.keyType, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -MapField.prototype.resolve = function resolve() { - if (this.resolved) - return this; - - // Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes" - if (types.mapKey[this.keyType] === undefined) - throw Error("invalid key type: " + this.keyType); - - return Field.prototype.resolve.call(this); -}; - -/** - * Map field decorator (TypeScript). - * @name MapField.d - * @function - * @param {number} fieldId Field id - * @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type - * @returns {FieldDecorator} Decorator function - * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> } - */ -MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { - - // submessage value: decorate the submessage and use its name as the type - if (typeof fieldValueType === "function") - fieldValueType = util.decorateType(fieldValueType).name; - - // enum reference value: create a reflected copy of the enum and keep reuseing it - else if (fieldValueType && typeof fieldValueType === "object") - fieldValueType = util.decorateEnum(fieldValueType).name; - - return function mapFieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); - }; -}; - -},{"16":16,"36":36,"37":37}],21:[function(require,module,exports){ -"use strict"; -module.exports = Message; - -var util = require(39); - -/** - * Constructs a new message instance. - * @classdesc Abstract runtime message. - * @constructor - * @param {Properties} [properties] Properties to set - * @template T extends object = object - */ -function Message(properties) { - // not used internally - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; -} - -/** - * Reference to the reflected type. - * @name Message.$type - * @type {Type} - * @readonly - */ - -/** - * Reference to the reflected type. - * @name Message#$type - * @type {Type} - * @readonly - */ - -/*eslint-disable valid-jsdoc*/ - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message} Message instance - * @template T extends Message - * @this Constructor - */ -Message.create = function create(properties) { - return this.$type.create(properties); -}; - -/** - * Encodes a message of this type. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encode = function encode(message, writer) { - return this.$type.encode(message, writer); -}; - -/** - * Encodes a message of this type preceeded by its length as a varint. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encodeDelimited = function encodeDelimited(message, writer) { - return this.$type.encodeDelimited(message, writer); -}; - -/** - * Decodes a message of this type. - * @name Message.decode - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decode = function decode(reader) { - return this.$type.decode(reader); -}; - -/** - * Decodes a message of this type preceeded by its length as a varint. - * @name Message.decodeDelimited - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decodeDelimited = function decodeDelimited(reader) { - return this.$type.decodeDelimited(reader); -}; - -/** - * Verifies a message of this type. - * @name Message.verify - * @function - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ -Message.verify = function verify(message) { - return this.$type.verify(message); -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object - * @returns {T} Message instance - * @template T extends Message - * @this Constructor - */ -Message.fromObject = function fromObject(object) { - return this.$type.fromObject(object); -}; - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {T} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @template T extends Message - * @this Constructor - */ -Message.toObject = function toObject(message, options) { - return this.$type.toObject(message, options); -}; - -/** - * Converts this message to JSON. - * @returns {Object.} JSON object - */ -Message.prototype.toJSON = function toJSON() { - return this.$type.toObject(this, util.toJSONOptions); -}; - -/*eslint-enable valid-jsdoc*/ -},{"39":39}],22:[function(require,module,exports){ -"use strict"; -module.exports = Method; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method"; - -var util = require(37); - -/** - * Constructs a new service method instance. - * @classdesc Reflected service method. - * @extends ReflectionObject - * @constructor - * @param {string} name Method name - * @param {string|undefined} type Method type, usually `"rpc"` - * @param {string} requestType Request message type - * @param {string} responseType Response message type - * @param {boolean|Object.} [requestStream] Whether the request is streamed - * @param {boolean|Object.} [responseStream] Whether the response is streamed - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this method - */ -function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) { - - /* istanbul ignore next */ - if (util.isObject(requestStream)) { - options = requestStream; - requestStream = responseStream = undefined; - } else if (util.isObject(responseStream)) { - options = responseStream; - responseStream = undefined; - } - - /* istanbul ignore if */ - if (!(type === undefined || util.isString(type))) - throw TypeError("type must be a string"); - - /* istanbul ignore if */ - if (!util.isString(requestType)) - throw TypeError("requestType must be a string"); - - /* istanbul ignore if */ - if (!util.isString(responseType)) - throw TypeError("responseType must be a string"); - - ReflectionObject.call(this, name, options); - - /** - * Method type. - * @type {string} - */ - this.type = type || "rpc"; // toJSON - - /** - * Request type. - * @type {string} - */ - this.requestType = requestType; // toJSON, marker - - /** - * Whether requests are streamed or not. - * @type {boolean|undefined} - */ - this.requestStream = requestStream ? true : undefined; // toJSON - - /** - * Response type. - * @type {string} - */ - this.responseType = responseType; // toJSON - - /** - * Whether responses are streamed or not. - * @type {boolean|undefined} - */ - this.responseStream = responseStream ? true : undefined; // toJSON - - /** - * Resolved request type. - * @type {Type|null} - */ - this.resolvedRequestType = null; - - /** - * Resolved response type. - * @type {Type|null} - */ - this.resolvedResponseType = null; - - /** - * Comment for this method - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Method descriptor. - * @interface IMethod - * @property {string} [type="rpc"] Method type - * @property {string} requestType Request type - * @property {string} responseType Response type - * @property {boolean} [requestStream=false] Whether requests are streamed - * @property {boolean} [responseStream=false] Whether responses are streamed - * @property {Object.} [options] Method options - */ - -/** - * Constructs a method from a method descriptor. - * @param {string} name Method name - * @param {IMethod} json Method descriptor - * @returns {Method} Created method - * @throws {TypeError} If arguments are invalid - */ -Method.fromJSON = function fromJSON(name, json) { - return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment); -}; - -/** - * Converts this method to a method descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMethod} Method descriptor - */ -Method.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "type" , this.type !== "rpc" && /* istanbul ignore next */ this.type || undefined, - "requestType" , this.requestType, - "requestStream" , this.requestStream, - "responseType" , this.responseType, - "responseStream" , this.responseStream, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -Method.prototype.resolve = function resolve() { - - /* istanbul ignore if */ - if (this.resolved) - return this; - - this.resolvedRequestType = this.parent.lookupType(this.requestType); - this.resolvedResponseType = this.parent.lookupType(this.responseType); - - return ReflectionObject.prototype.resolve.call(this); -}; - -},{"24":24,"37":37}],23:[function(require,module,exports){ -"use strict"; -module.exports = Namespace; - -// extends ReflectionObject -var ReflectionObject = require(24); -((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace"; - -var Field = require(16), - util = require(37); - -var Type, // cyclic - Service, - Enum; - -/** - * Constructs a new namespace instance. - * @name Namespace - * @classdesc Reflected namespace. - * @extends NamespaceBase - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a namespace from JSON. - * @memberof Namespace - * @function - * @param {string} name Namespace name - * @param {Object.} json JSON object - * @returns {Namespace} Created namespace - * @throws {TypeError} If arguments are invalid - */ -Namespace.fromJSON = function fromJSON(name, json) { - return new Namespace(name, json.options).addJSON(json.nested); -}; - -/** - * Converts an array of reflection objects to JSON. - * @memberof Namespace - * @param {ReflectionObject[]} array Object array - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {Object.|undefined} JSON object or `undefined` when array is empty - */ -function arrayToJSON(array, toJSONOptions) { - if (!(array && array.length)) - return undefined; - var obj = {}; - for (var i = 0; i < array.length; ++i) - obj[array[i].name] = array[i].toJSON(toJSONOptions); - return obj; -} - -Namespace.arrayToJSON = arrayToJSON; - -/** - * Tests if the specified id is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedId = function isReservedId(reserved, id) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] > id) - return true; - return false; -}; - -/** - * Tests if the specified name is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedName = function isReservedName(reserved, name) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (reserved[i] === name) - return true; - return false; -}; - -/** - * Not an actual constructor. Use {@link Namespace} instead. - * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. - * @exports NamespaceBase - * @extends ReflectionObject - * @abstract - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - * @see {@link Namespace} - */ -function Namespace(name, options) { - ReflectionObject.call(this, name, options); - - /** - * Nested objects by name. - * @type {Object.|undefined} - */ - this.nested = undefined; // toJSON - - /** - * Cached nested objects as an array. - * @type {ReflectionObject[]|null} - * @private - */ - this._nestedArray = null; -} - -function clearCache(namespace) { - namespace._nestedArray = null; - return namespace; -} - -/** - * Nested objects of this namespace as an array for iteration. - * @name NamespaceBase#nestedArray - * @type {ReflectionObject[]} - * @readonly - */ -Object.defineProperty(Namespace.prototype, "nestedArray", { - get: function() { - return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); - } -}); - -/** - * Namespace descriptor. - * @interface INamespace - * @property {Object.} [options] Namespace options - * @property {Object.} [nested] Nested object descriptors - */ - -/** - * Any extension field descriptor. - * @typedef AnyExtensionField - * @type {IExtensionField|IExtensionMapField} - */ - -/** - * Any nested object descriptor. - * @typedef AnyNestedObject - * @type {IEnum|IType|IService|AnyExtensionField|INamespace} - */ -// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place) - -/** - * Converts this namespace to a namespace descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {INamespace} Namespace descriptor - */ -Namespace.prototype.toJSON = function toJSON(toJSONOptions) { - return util.toObject([ - "options" , this.options, - "nested" , arrayToJSON(this.nestedArray, toJSONOptions) - ]); -}; - -/** - * Adds nested objects to this namespace from nested object descriptors. - * @param {Object.} nestedJson Any nested object descriptors - * @returns {Namespace} `this` - */ -Namespace.prototype.addJSON = function addJSON(nestedJson) { - var ns = this; - /* istanbul ignore else */ - if (nestedJson) { - for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) { - nested = nestedJson[names[i]]; - ns.add( // most to least likely - ( nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : nested.id !== undefined - ? Field.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - } - return this; -}; - -/** - * Gets the nested object of the specified name. - * @param {string} name Nested object name - * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist - */ -Namespace.prototype.get = function get(name) { - return this.nested && this.nested[name] - || null; -}; - -/** - * Gets the values of the nested {@link Enum|enum} of the specified name. - * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. - * @param {string} name Nested enum name - * @returns {Object.} Enum values - * @throws {Error} If there is no such enum - */ -Namespace.prototype.getEnum = function getEnum(name) { - if (this.nested && this.nested[name] instanceof Enum) - return this.nested[name].values; - throw Error("no such enum: " + name); -}; - -/** - * Adds a nested object to this namespace. - * @param {ReflectionObject} object Nested object to add - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name - */ -Namespace.prototype.add = function add(object) { - - if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace)) - throw TypeError("object must be a valid nested object"); - - if (!this.nested) - this.nested = {}; - else { - var prev = this.get(object.name); - if (prev) { - if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) { - // replace plain namespace but keep existing nested elements and options - var nested = prev.nestedArray; - for (var i = 0; i < nested.length; ++i) - object.add(nested[i]); - this.remove(prev); - if (!this.nested) - this.nested = {}; - object.setOptions(prev.options, true); - - } else - throw Error("duplicate name '" + object.name + "' in " + this); - } - } - this.nested[object.name] = object; - object.onAdd(this); - return clearCache(this); -}; - -/** - * Removes a nested object from this namespace. - * @param {ReflectionObject} object Nested object to remove - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this namespace - */ -Namespace.prototype.remove = function remove(object) { - - if (!(object instanceof ReflectionObject)) - throw TypeError("object must be a ReflectionObject"); - if (object.parent !== this) - throw Error(object + " is not a member of " + this); - - delete this.nested[object.name]; - if (!Object.keys(this.nested).length) - this.nested = undefined; - - object.onRemove(this); - return clearCache(this); -}; - -/** - * Defines additial namespaces within this one if not yet existing. - * @param {string|string[]} path Path to create - * @param {*} [json] Nested types to create from JSON - * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty - */ -Namespace.prototype.define = function define(path, json) { - - if (util.isString(path)) - path = path.split("."); - else if (!Array.isArray(path)) - throw TypeError("illegal path"); - if (path && path.length && path[0] === "") - throw Error("path must be relative"); - - var ptr = this; - while (path.length > 0) { - var part = path.shift(); - if (ptr.nested && ptr.nested[part]) { - ptr = ptr.nested[part]; - if (!(ptr instanceof Namespace)) - throw Error("path conflicts with non-namespace objects"); - } else - ptr.add(ptr = new Namespace(part)); - } - if (json) - ptr.addJSON(json); - return ptr; -}; - -/** - * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost. - * @returns {Namespace} `this` - */ -Namespace.prototype.resolveAll = function resolveAll() { - var nested = this.nestedArray, i = 0; - while (i < nested.length) - if (nested[i] instanceof Namespace) - nested[i++].resolveAll(); - else - nested[i++].resolve(); - return this.resolve(); -}; - -/** - * Recursively looks up the reflection object matching the specified path in the scope of this namespace. - * @param {string|string[]} path Path to look up - * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. - * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - */ -Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) { - - /* istanbul ignore next */ - if (typeof filterTypes === "boolean") { - parentAlreadyChecked = filterTypes; - filterTypes = undefined; - } else if (filterTypes && !Array.isArray(filterTypes)) - filterTypes = [ filterTypes ]; - - if (util.isString(path) && path.length) { - if (path === ".") - return this.root; - path = path.split("."); - } else if (!path.length) - return this; - - // Start at root if path is absolute - if (path[0] === "") - return this.root.lookup(path.slice(1), filterTypes); - - // Test if the first part matches any nested object, and if so, traverse if path contains more - var found = this.get(path[0]); - if (found) { - if (path.length === 1) { - if (!filterTypes || filterTypes.indexOf(found.constructor) > -1) - return found; - } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true))) - return found; - - // Otherwise try each nested namespace - } else - for (var i = 0; i < this.nestedArray.length; ++i) - if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true))) - return found; - - // If there hasn't been a match, try again at the parent - if (this.parent === null || parentAlreadyChecked) - return null; - return this.parent.lookup(path, filterTypes); -}; - -/** - * Looks up the reflection object at the specified path, relative to this namespace. - * @name NamespaceBase#lookup - * @function - * @param {string|string[]} path Path to look up - * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - * @variation 2 - */ -// lookup(path: string, [parentAlreadyChecked: boolean]) - -/** - * Looks up the {@link Type|type} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type - * @throws {Error} If `path` does not point to a type - */ -Namespace.prototype.lookupType = function lookupType(path) { - var found = this.lookup(path, [ Type ]); - if (!found) - throw Error("no such type: " + path); - return found; -}; - -/** - * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Enum} Looked up enum - * @throws {Error} If `path` does not point to an enum - */ -Namespace.prototype.lookupEnum = function lookupEnum(path) { - var found = this.lookup(path, [ Enum ]); - if (!found) - throw Error("no such Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type or enum - * @throws {Error} If `path` does not point to a type or enum - */ -Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) { - var found = this.lookup(path, [ Type, Enum ]); - if (!found) - throw Error("no such Type or Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Service|service} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Service} Looked up service - * @throws {Error} If `path` does not point to a service - */ -Namespace.prototype.lookupService = function lookupService(path) { - var found = this.lookup(path, [ Service ]); - if (!found) - throw Error("no such Service '" + path + "' in " + this); - return found; -}; - -// Sets up cyclic dependencies (called in index-light) -Namespace._configure = function(Type_, Service_, Enum_) { - Type = Type_; - Service = Service_; - Enum = Enum_; -}; - -},{"16":16,"24":24,"37":37}],24:[function(require,module,exports){ -"use strict"; -module.exports = ReflectionObject; - -ReflectionObject.className = "ReflectionObject"; - -var util = require(37); - -var Root; // cyclic - -/** - * Constructs a new reflection object instance. - * @classdesc Base class of all reflection objects. - * @constructor - * @param {string} name Object name - * @param {Object.} [options] Declared options - * @abstract - */ -function ReflectionObject(name, options) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (options && !util.isObject(options)) - throw TypeError("options must be an object"); - - /** - * Options. - * @type {Object.|undefined} - */ - this.options = options; // toJSON - - /** - * Parsed Options. - * @type {Array.>|undefined} - */ - this.parsedOptions = null; - - /** - * Unique name within its namespace. - * @type {string} - */ - this.name = name; - - /** - * Parent namespace. - * @type {Namespace|null} - */ - this.parent = null; - - /** - * Whether already resolved or not. - * @type {boolean} - */ - this.resolved = false; - - /** - * Comment text, if any. - * @type {string|null} - */ - this.comment = null; - - /** - * Defining file name. - * @type {string|null} - */ - this.filename = null; -} - -Object.defineProperties(ReflectionObject.prototype, { - - /** - * Reference to the root namespace. - * @name ReflectionObject#root - * @type {Root} - * @readonly - */ - root: { - get: function() { - var ptr = this; - while (ptr.parent !== null) - ptr = ptr.parent; - return ptr; - } - }, - - /** - * Full name including leading dot. - * @name ReflectionObject#fullName - * @type {string} - * @readonly - */ - fullName: { - get: function() { - var path = [ this.name ], - ptr = this.parent; - while (ptr) { - path.unshift(ptr.name); - ptr = ptr.parent; - } - return path.join("."); - } - } -}); - -/** - * Converts this reflection object to its descriptor representation. - * @returns {Object.} Descriptor - * @abstract - */ -ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() { - throw Error(); // not implemented, shouldn't happen -}; - -/** - * Called when this object is added to a parent. - * @param {ReflectionObject} parent Parent added to - * @returns {undefined} - */ -ReflectionObject.prototype.onAdd = function onAdd(parent) { - if (this.parent && this.parent !== parent) - this.parent.remove(this); - this.parent = parent; - this.resolved = false; - var root = parent.root; - if (root instanceof Root) - root._handleAdd(this); -}; - -/** - * Called when this object is removed from a parent. - * @param {ReflectionObject} parent Parent removed from - * @returns {undefined} - */ -ReflectionObject.prototype.onRemove = function onRemove(parent) { - var root = parent.root; - if (root instanceof Root) - root._handleRemove(this); - this.parent = null; - this.resolved = false; -}; - -/** - * Resolves this objects type references. - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.resolve = function resolve() { - if (this.resolved) - return this; - if (this.root instanceof Root) - this.resolved = true; // only if part of a root - return this; -}; - -/** - * Gets an option value. - * @param {string} name Option name - * @returns {*} Option value or `undefined` if not set - */ -ReflectionObject.prototype.getOption = function getOption(name) { - if (this.options) - return this.options[name]; - return undefined; -}; - -/** - * Sets an option. - * @param {string} name Option name - * @param {*} value Option value - * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) { - if (!ifNotSet || !this.options || this.options[name] === undefined) - (this.options || (this.options = {}))[name] = value; - return this; -}; - -/** - * Sets a parsed option. - * @param {string} name parsed Option name - * @param {*} value Option value - * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) { - if (!this.parsedOptions) { - this.parsedOptions = []; - } - var parsedOptions = this.parsedOptions; - if (propName) { - // If setting a sub property of an option then try to merge it - // with an existing option - var opt = parsedOptions.find(function (opt) { - return Object.prototype.hasOwnProperty.call(opt, name); - }); - if (opt) { - // If we found an existing option - just merge the property value - var newValue = opt[name]; - util.setProperty(newValue, propName, value); - } else { - // otherwise, create a new option, set it's property and add it to the list - opt = {}; - opt[name] = util.setProperty({}, propName, value); - parsedOptions.push(opt); - } - } else { - // Always create a new option when setting the value of the option itself - var newOpt = {}; - newOpt[name] = value; - parsedOptions.push(newOpt); - } - return this; -}; - -/** - * Sets multiple options. - * @param {Object.} options Options to set - * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) { - if (options) - for (var keys = Object.keys(options), i = 0; i < keys.length; ++i) - this.setOption(keys[i], options[keys[i]], ifNotSet); - return this; -}; - -/** - * Converts this instance to its string representation. - * @returns {string} Class name[, space, full name] - */ -ReflectionObject.prototype.toString = function toString() { - var className = this.constructor.className, - fullName = this.fullName; - if (fullName.length) - return className + " " + fullName; - return className; -}; - -// Sets up cyclic dependencies (called in index-light) -ReflectionObject._configure = function(Root_) { - Root = Root_; -}; - -},{"37":37}],25:[function(require,module,exports){ -"use strict"; -module.exports = OneOf; - -// extends ReflectionObject -var ReflectionObject = require(24); -((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf"; - -var Field = require(16), - util = require(37); - -/** - * Constructs a new oneof instance. - * @classdesc Reflected oneof. - * @extends ReflectionObject - * @constructor - * @param {string} name Oneof name - * @param {string[]|Object.} [fieldNames] Field names - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function OneOf(name, fieldNames, options, comment) { - if (!Array.isArray(fieldNames)) { - options = fieldNames; - fieldNames = undefined; - } - ReflectionObject.call(this, name, options); - - /* istanbul ignore if */ - if (!(fieldNames === undefined || Array.isArray(fieldNames))) - throw TypeError("fieldNames must be an Array"); - - /** - * Field names that belong to this oneof. - * @type {string[]} - */ - this.oneof = fieldNames || []; // toJSON, marker - - /** - * Fields that belong to this oneof as an array for iteration. - * @type {Field[]} - * @readonly - */ - this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Oneof descriptor. - * @interface IOneOf - * @property {Array.} oneof Oneof field names - * @property {Object.} [options] Oneof options - */ - -/** - * Constructs a oneof from a oneof descriptor. - * @param {string} name Oneof name - * @param {IOneOf} json Oneof descriptor - * @returns {OneOf} Created oneof - * @throws {TypeError} If arguments are invalid - */ -OneOf.fromJSON = function fromJSON(name, json) { - return new OneOf(name, json.oneof, json.options, json.comment); -}; - -/** - * Converts this oneof to a oneof descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IOneOf} Oneof descriptor - */ -OneOf.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "oneof" , this.oneof, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Adds the fields of the specified oneof to the parent if not already done so. - * @param {OneOf} oneof The oneof - * @returns {undefined} - * @inner - * @ignore - */ -function addFieldsToParent(oneof) { - if (oneof.parent) - for (var i = 0; i < oneof.fieldsArray.length; ++i) - if (!oneof.fieldsArray[i].parent) - oneof.parent.add(oneof.fieldsArray[i]); -} - -/** - * Adds a field to this oneof and removes it from its current parent, if any. - * @param {Field} field Field to add - * @returns {OneOf} `this` - */ -OneOf.prototype.add = function add(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - if (field.parent && field.parent !== this.parent) - field.parent.remove(field); - this.oneof.push(field.name); - this.fieldsArray.push(field); - field.partOf = this; // field.parent remains null - addFieldsToParent(this); - return this; -}; - -/** - * Removes a field from this oneof and puts it back to the oneof's parent. - * @param {Field} field Field to remove - * @returns {OneOf} `this` - */ -OneOf.prototype.remove = function remove(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - var index = this.fieldsArray.indexOf(field); - - /* istanbul ignore if */ - if (index < 0) - throw Error(field + " is not a member of " + this); - - this.fieldsArray.splice(index, 1); - index = this.oneof.indexOf(field.name); - - /* istanbul ignore else */ - if (index > -1) // theoretical - this.oneof.splice(index, 1); - - field.partOf = null; - return this; -}; - -/** - * @override - */ -OneOf.prototype.onAdd = function onAdd(parent) { - ReflectionObject.prototype.onAdd.call(this, parent); - var self = this; - // Collect present fields - for (var i = 0; i < this.oneof.length; ++i) { - var field = parent.get(this.oneof[i]); - if (field && !field.partOf) { - field.partOf = self; - self.fieldsArray.push(field); - } - } - // Add not yet present fields - addFieldsToParent(this); -}; - -/** - * @override - */ -OneOf.prototype.onRemove = function onRemove(parent) { - for (var i = 0, field; i < this.fieldsArray.length; ++i) - if ((field = this.fieldsArray[i]).parent) - field.parent.remove(field); - ReflectionObject.prototype.onRemove.call(this, parent); -}; - -/** - * Decorator function as returned by {@link OneOf.d} (TypeScript). - * @typedef OneOfDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} oneofName OneOf name - * @returns {undefined} - */ - -/** - * OneOf decorator (TypeScript). - * @function - * @param {...string} fieldNames Field names - * @returns {OneOfDecorator} Decorator function - * @template T extends string - */ -OneOf.d = function decorateOneOf() { - var fieldNames = new Array(arguments.length), - index = 0; - while (index < arguments.length) - fieldNames[index] = arguments[index++]; - return function oneOfDecorator(prototype, oneofName) { - util.decorateType(prototype.constructor) - .add(new OneOf(oneofName, fieldNames)); - Object.defineProperty(prototype, oneofName, { - get: util.oneOfGetter(fieldNames), - set: util.oneOfSetter(fieldNames) - }); - }; -}; - -},{"16":16,"24":24,"37":37}],26:[function(require,module,exports){ -"use strict"; -module.exports = parse; - -parse.filename = null; -parse.defaults = { keepCase: false }; - -var tokenize = require(34), - Root = require(29), - Type = require(35), - Field = require(16), - MapField = require(20), - OneOf = require(25), - Enum = require(15), - Service = require(33), - Method = require(22), - types = require(36), - util = require(37); - -var base10Re = /^[1-9][0-9]*$/, - base10NegRe = /^-?[1-9][0-9]*$/, - base16Re = /^0[x][0-9a-fA-F]+$/, - base16NegRe = /^-?0[x][0-9a-fA-F]+$/, - base8Re = /^0[0-7]+$/, - base8NegRe = /^-?0[0-7]+$/, - numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/, - nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/, - typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, - fqTypeRefRe = /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/; - -/** - * Result object returned from {@link parse}. - * @interface IParserResult - * @property {string|undefined} package Package name, if declared - * @property {string[]|undefined} imports Imports, if any - * @property {string[]|undefined} weakImports Weak imports, if any - * @property {string|undefined} syntax Syntax, if specified (either `"proto2"` or `"proto3"`) - * @property {Root} root Populated root instance - */ - -/** - * Options modifying the behavior of {@link parse}. - * @interface IParseOptions - * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case - * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments. - * @property {boolean} [preferTrailingComment=false] Use trailing comment when both leading comment and trailing comment exist. - */ - -/** - * Options modifying the behavior of JSON serialization. - * @interface IToJSONOptions - * @property {boolean} [keepComments=false] Serializes comments. - */ - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @param {string} source Source contents - * @param {Root} root Root to populate - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {IParserResult} Parser result - * @property {string} filename=null Currently processing file name for error reporting, if known - * @property {IParseOptions} defaults Default {@link IParseOptions} - */ -function parse(source, root, options) { - /* eslint-disable callback-return */ - if (!(root instanceof Root)) { - options = root; - root = new Root(); - } - if (!options) - options = parse.defaults; - - var preferTrailingComment = options.preferTrailingComment || false; - var tn = tokenize(source, options.alternateCommentMode || false), - next = tn.next, - push = tn.push, - peek = tn.peek, - skip = tn.skip, - cmnt = tn.cmnt; - - var head = true, - pkg, - imports, - weakImports, - syntax, - isProto3 = false; - - var ptr = root; - - var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase; - - /* istanbul ignore next */ - function illegal(token, name, insideTryCatch) { - var filename = parse.filename; - if (!insideTryCatch) - parse.filename = null; - return Error("illegal " + (name || "token") + " '" + token + "' (" + (filename ? filename + ", " : "") + "line " + tn.line + ")"); - } - - function readString() { - var values = [], - token; - do { - /* istanbul ignore if */ - if ((token = next()) !== "\"" && token !== "'") - throw illegal(token); - - values.push(next()); - skip(token); - token = peek(); - } while (token === "\"" || token === "'"); - return values.join(""); - } - - function readValue(acceptTypeRef) { - var token = next(); - switch (token) { - case "'": - case "\"": - push(token); - return readString(); - case "true": case "TRUE": - return true; - case "false": case "FALSE": - return false; - } - try { - return parseNumber(token, /* insideTryCatch */ true); - } catch (e) { - - /* istanbul ignore else */ - if (acceptTypeRef && typeRefRe.test(token)) - return token; - - /* istanbul ignore next */ - throw illegal(token, "value"); - } - } - - function readRanges(target, acceptStrings) { - var token, start; - do { - if (acceptStrings && ((token = peek()) === "\"" || token === "'")) - target.push(readString()); - else - target.push([ start = parseId(next()), skip("to", true) ? parseId(next()) : start ]); - } while (skip(",", true)); - skip(";"); - } - - function parseNumber(token, insideTryCatch) { - var sign = 1; - if (token.charAt(0) === "-") { - sign = -1; - token = token.substring(1); - } - switch (token) { - case "inf": case "INF": case "Inf": - return sign * Infinity; - case "nan": case "NAN": case "Nan": case "NaN": - return NaN; - case "0": - return 0; - } - if (base10Re.test(token)) - return sign * parseInt(token, 10); - if (base16Re.test(token)) - return sign * parseInt(token, 16); - if (base8Re.test(token)) - return sign * parseInt(token, 8); - - /* istanbul ignore else */ - if (numberRe.test(token)) - return sign * parseFloat(token); - - /* istanbul ignore next */ - throw illegal(token, "number", insideTryCatch); - } - - function parseId(token, acceptNegative) { - switch (token) { - case "max": case "MAX": case "Max": - return 536870911; - case "0": - return 0; - } - - /* istanbul ignore if */ - if (!acceptNegative && token.charAt(0) === "-") - throw illegal(token, "id"); - - if (base10NegRe.test(token)) - return parseInt(token, 10); - if (base16NegRe.test(token)) - return parseInt(token, 16); - - /* istanbul ignore else */ - if (base8NegRe.test(token)) - return parseInt(token, 8); - - /* istanbul ignore next */ - throw illegal(token, "id"); - } - - function parsePackage() { - - /* istanbul ignore if */ - if (pkg !== undefined) - throw illegal("package"); - - pkg = next(); - - /* istanbul ignore if */ - if (!typeRefRe.test(pkg)) - throw illegal(pkg, "name"); - - ptr = ptr.define(pkg); - skip(";"); - } - - function parseImport() { - var token = peek(); - var whichImports; - switch (token) { - case "weak": - whichImports = weakImports || (weakImports = []); - next(); - break; - case "public": - next(); - // eslint-disable-line no-fallthrough - default: - whichImports = imports || (imports = []); - break; - } - token = readString(); - skip(";"); - whichImports.push(token); - } - - function parseSyntax() { - skip("="); - syntax = readString(); - isProto3 = syntax === "proto3"; - - /* istanbul ignore if */ - if (!isProto3 && syntax !== "proto2") - throw illegal(syntax, "syntax"); - - skip(";"); - } - - function parseCommon(parent, token) { - switch (token) { - - case "option": - parseOption(parent, token); - skip(";"); - return true; - - case "message": - parseType(parent, token); - return true; - - case "enum": - parseEnum(parent, token); - return true; - - case "service": - parseService(parent, token); - return true; - - case "extend": - parseExtension(parent, token); - return true; - } - return false; - } - - function ifBlock(obj, fnIf, fnElse) { - var trailingLine = tn.line; - if (obj) { - if(typeof obj.comment !== "string") { - obj.comment = cmnt(); // try block-type comment - } - obj.filename = parse.filename; - } - if (skip("{", true)) { - var token; - while ((token = next()) !== "}") - fnIf(token); - skip(";", true); - } else { - if (fnElse) - fnElse(); - skip(";"); - if (obj && (typeof obj.comment !== "string" || preferTrailingComment)) - obj.comment = cmnt(trailingLine) || obj.comment; // try line-type comment - } - } - - function parseType(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "type name"); - - var type = new Type(token); - ifBlock(type, function parseType_block(token) { - if (parseCommon(type, token)) - return; - - switch (token) { - - case "map": - parseMapField(type, token); - break; - - case "required": - case "optional": - case "repeated": - parseField(type, token); - break; - - case "oneof": - parseOneOf(type, token); - break; - - case "extensions": - readRanges(type.extensions || (type.extensions = [])); - break; - - case "reserved": - readRanges(type.reserved || (type.reserved = []), true); - break; - - default: - /* istanbul ignore if */ - if (!isProto3 || !typeRefRe.test(token)) - throw illegal(token); - - push(token); - parseField(type, "optional"); - break; - } - }); - parent.add(type); - } - - function parseField(parent, rule, extend) { - var type = next(); - if (type === "group") { - parseGroup(parent, rule); - return; - } - - /* istanbul ignore if */ - if (!typeRefRe.test(type)) - throw illegal(type, "type"); - - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - name = applyCase(name); - skip("="); - - var field = new Field(name, parseId(next()), type, rule, extend); - ifBlock(field, function parseField_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(field, token); - skip(";"); - } else - throw illegal(token); - - }, function parseField_line() { - parseInlineOptions(field); - }); - parent.add(field); - - // JSON defaults to packed=true if not set so we have to set packed=false explicity when - // parsing proto2 descriptors without the option, where applicable. This must be done for - // all known packable types and anything that could be an enum (= is not a basic type). - if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined)) - field.setOption("packed", false, /* ifNotSet */ true); - } - - function parseGroup(parent, rule) { - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - var fieldName = util.lcFirst(name); - if (name === fieldName) - name = util.ucFirst(name); - skip("="); - var id = parseId(next()); - var type = new Type(name); - type.group = true; - var field = new Field(fieldName, id, name, rule); - field.filename = parse.filename; - ifBlock(type, function parseGroup_block(token) { - switch (token) { - - case "option": - parseOption(type, token); - skip(";"); - break; - - case "required": - case "optional": - case "repeated": - parseField(type, token); - break; - - /* istanbul ignore next */ - default: - throw illegal(token); // there are no groups with proto3 semantics - } - }); - parent.add(type) - .add(field); - } - - function parseMapField(parent) { - skip("<"); - var keyType = next(); - - /* istanbul ignore if */ - if (types.mapKey[keyType] === undefined) - throw illegal(keyType, "type"); - - skip(","); - var valueType = next(); - - /* istanbul ignore if */ - if (!typeRefRe.test(valueType)) - throw illegal(valueType, "type"); - - skip(">"); - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - skip("="); - var field = new MapField(applyCase(name), parseId(next()), keyType, valueType); - ifBlock(field, function parseMapField_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(field, token); - skip(";"); - } else - throw illegal(token); - - }, function parseMapField_line() { - parseInlineOptions(field); - }); - parent.add(field); - } - - function parseOneOf(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var oneof = new OneOf(applyCase(token)); - ifBlock(oneof, function parseOneOf_block(token) { - if (token === "option") { - parseOption(oneof, token); - skip(";"); - } else { - push(token); - parseField(oneof, "optional"); - } - }); - parent.add(oneof); - } - - function parseEnum(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var enm = new Enum(token); - ifBlock(enm, function parseEnum_block(token) { - switch(token) { - case "option": - parseOption(enm, token); - skip(";"); - break; - - case "reserved": - readRanges(enm.reserved || (enm.reserved = []), true); - break; - - default: - parseEnumValue(enm, token); - } - }); - parent.add(enm); - } - - function parseEnumValue(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token)) - throw illegal(token, "name"); - - skip("="); - var value = parseId(next(), true), - dummy = {}; - ifBlock(dummy, function parseEnumValue_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(dummy, token); // skip - skip(";"); - } else - throw illegal(token); - - }, function parseEnumValue_line() { - parseInlineOptions(dummy); // skip - }); - parent.add(token, value, dummy.comment); - } - - function parseOption(parent, token) { - var isCustom = skip("(", true); - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token, "name"); - - var name = token; - var option = name; - var propName; - - if (isCustom) { - skip(")"); - name = "(" + name + ")"; - option = name; - token = peek(); - if (fqTypeRefRe.test(token)) { - propName = token.substr(1); //remove '.' before property name - name += token; - next(); - } - } - skip("="); - var optionValue = parseOptionValue(parent, name); - setParsedOption(parent, option, optionValue, propName); - } - - function parseOptionValue(parent, name) { - if (skip("{", true)) { // { a: "foo" b { c: "bar" } } - var result = {}; - while (!skip("}", true)) { - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var value; - var propName = token; - if (peek() === "{") - value = parseOptionValue(parent, name + "." + token); - else { - skip(":"); - if (peek() === "{") - value = parseOptionValue(parent, name + "." + token); - else { - value = readValue(true); - setOption(parent, name + "." + token, value); - } - } - var prevValue = result[propName]; - if (prevValue) - value = [].concat(prevValue).concat(value); - result[propName] = value; - skip(",", true); - } - return result; - } - - var simpleValue = readValue(true); - setOption(parent, name, simpleValue); - return simpleValue; - // Does not enforce a delimiter to be universal - } - - function setOption(parent, name, value) { - if (parent.setOption) - parent.setOption(name, value); - } - - function setParsedOption(parent, name, value, propName) { - if (parent.setParsedOption) - parent.setParsedOption(name, value, propName); - } - - function parseInlineOptions(parent) { - if (skip("[", true)) { - do { - parseOption(parent, "option"); - } while (skip(",", true)); - skip("]"); - } - return parent; - } - - function parseService(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "service name"); - - var service = new Service(token); - ifBlock(service, function parseService_block(token) { - if (parseCommon(service, token)) - return; - - /* istanbul ignore else */ - if (token === "rpc") - parseMethod(service, token); - else - throw illegal(token); - }); - parent.add(service); - } - - function parseMethod(parent, token) { - // Get the comment of the preceding line now (if one exists) in case the - // method is defined across multiple lines. - var commentText = cmnt(); - - var type = token; - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var name = token, - requestType, requestStream, - responseType, responseStream; - - skip("("); - if (skip("stream", true)) - requestStream = true; - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token); - - requestType = token; - skip(")"); skip("returns"); skip("("); - if (skip("stream", true)) - responseStream = true; - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token); - - responseType = token; - skip(")"); - - var method = new Method(name, type, requestType, responseType, requestStream, responseStream); - method.comment = commentText; - ifBlock(method, function parseMethod_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(method, token); - skip(";"); - } else - throw illegal(token); - - }); - parent.add(method); - } - - function parseExtension(parent, token) { - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token, "reference"); - - var reference = token; - ifBlock(null, function parseExtension_block(token) { - switch (token) { - - case "required": - case "repeated": - case "optional": - parseField(parent, token, reference); - break; - - default: - /* istanbul ignore if */ - if (!isProto3 || !typeRefRe.test(token)) - throw illegal(token); - push(token); - parseField(parent, "optional", reference); - break; - } - }); - } - - var token; - while ((token = next()) !== null) { - switch (token) { - - case "package": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parsePackage(); - break; - - case "import": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parseImport(); - break; - - case "syntax": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parseSyntax(); - break; - - case "option": - - parseOption(ptr, token); - skip(";"); - break; - - default: - - /* istanbul ignore else */ - if (parseCommon(ptr, token)) { - head = false; - continue; - } - - /* istanbul ignore next */ - throw illegal(token); - } - } - - parse.filename = null; - return { - "package" : pkg, - "imports" : imports, - weakImports : weakImports, - syntax : syntax, - root : root - }; -} - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @name parse - * @function - * @param {string} source Source contents - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {IParserResult} Parser result - * @property {string} filename=null Currently processing file name for error reporting, if known - * @property {IParseOptions} defaults Default {@link IParseOptions} - * @variation 2 - */ - -},{"15":15,"16":16,"20":20,"22":22,"25":25,"29":29,"33":33,"34":34,"35":35,"36":36,"37":37}],27:[function(require,module,exports){ -"use strict"; -module.exports = Reader; - -var util = require(39); - -var BufferReader; // cyclic - -var LongBits = util.LongBits, - utf8 = util.utf8; - -/* istanbul ignore next */ -function indexOutOfRange(reader, writeLength) { - return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); -} - -/** - * Constructs a new reader instance using the specified buffer. - * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. - * @constructor - * @param {Uint8Array} buffer Buffer to read from - */ -function Reader(buffer) { - - /** - * Read buffer. - * @type {Uint8Array} - */ - this.buf = buffer; - - /** - * Read buffer position. - * @type {number} - */ - this.pos = 0; - - /** - * Read buffer length. - * @type {number} - */ - this.len = buffer.length; -} - -var create_array = typeof Uint8Array !== "undefined" - ? function create_typed_array(buffer) { - if (buffer instanceof Uint8Array || Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - } - /* istanbul ignore next */ - : function create_array(buffer) { - if (Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - }; - -var create = function create() { - return util.Buffer - ? function create_buffer_setup(buffer) { - return (Reader.create = function create_buffer(buffer) { - return util.Buffer.isBuffer(buffer) - ? new BufferReader(buffer) - /* istanbul ignore next */ - : create_array(buffer); - })(buffer); - } - /* istanbul ignore next */ - : create_array; -}; - -/** - * Creates a new reader using the specified buffer. - * @function - * @param {Uint8Array|Buffer} buffer Buffer to read from - * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} - * @throws {Error} If `buffer` is not a valid buffer - */ -Reader.create = create(); - -Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; - -/** - * Reads a varint as an unsigned 32 bit value. - * @function - * @returns {number} Value read - */ -Reader.prototype.uint32 = (function read_uint32_setup() { - var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) - return function read_uint32() { - value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; - - /* istanbul ignore if */ - if ((this.pos += 5) > this.len) { - this.pos = this.len; - throw indexOutOfRange(this, 10); - } - return value; - }; -})(); - -/** - * Reads a varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.int32 = function read_int32() { - return this.uint32() | 0; -}; - -/** - * Reads a zig-zag encoded varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.sint32 = function read_sint32() { - var value = this.uint32(); - return value >>> 1 ^ -(value & 1) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readLongVarint() { - // tends to deopt with local vars for octet etc. - var bits = new LongBits(0, 0); - var i = 0; - if (this.len - this.pos > 4) { // fast route (lo) - for (; i < 4; ++i) { - // 1st..4th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 5th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; - bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - i = 0; - } else { - for (; i < 3; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 1st..3th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 4th - bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; - return bits; - } - if (this.len - this.pos > 4) { // fast route (hi) - for (; i < 5; ++i) { - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } else { - for (; i < 5; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } - /* istanbul ignore next */ - throw Error("invalid varint encoding"); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads a varint as a signed 64 bit value. - * @name Reader#int64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as an unsigned 64 bit value. - * @name Reader#uint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a zig-zag encoded varint as a signed 64 bit value. - * @name Reader#sint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as a boolean. - * @returns {boolean} Value read - */ -Reader.prototype.bool = function read_bool() { - return this.uint32() !== 0; -}; - -function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` - return (buf[end - 4] - | buf[end - 3] << 8 - | buf[end - 2] << 16 - | buf[end - 1] << 24) >>> 0; -} - -/** - * Reads fixed 32 bits as an unsigned 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.fixed32 = function read_fixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4); -}; - -/** - * Reads fixed 32 bits as a signed 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.sfixed32 = function read_sfixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readFixed64(/* this: Reader */) { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 8); - - return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads fixed 64 bits. - * @name Reader#fixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads zig-zag encoded fixed 64 bits. - * @name Reader#sfixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a float (32 bit) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.float = function read_float() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readFloatLE(this.buf, this.pos); - this.pos += 4; - return value; -}; - -/** - * Reads a double (64 bit float) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.double = function read_double() { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readDoubleLE(this.buf, this.pos); - this.pos += 8; - return value; -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns {Uint8Array} Value read - */ -Reader.prototype.bytes = function read_bytes() { - var length = this.uint32(), - start = this.pos, - end = this.pos + length; - - /* istanbul ignore if */ - if (end > this.len) - throw indexOutOfRange(this, length); - - this.pos += length; - if (Array.isArray(this.buf)) // plain array - return this.buf.slice(start, end); - return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1 - ? new this.buf.constructor(0) - : this._slice.call(this.buf, start, end); -}; - -/** - * Reads a string preceeded by its byte length as a varint. - * @returns {string} Value read - */ -Reader.prototype.string = function read_string() { - var bytes = this.bytes(); - return utf8.read(bytes, 0, bytes.length); -}; - -/** - * Skips the specified number of bytes if specified, otherwise skips a varint. - * @param {number} [length] Length if known, otherwise a varint is assumed - * @returns {Reader} `this` - */ -Reader.prototype.skip = function skip(length) { - if (typeof length === "number") { - /* istanbul ignore if */ - if (this.pos + length > this.len) - throw indexOutOfRange(this, length); - this.pos += length; - } else { - do { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - } while (this.buf[this.pos++] & 128); - } - return this; -}; - -/** - * Skips the next element of the specified wire type. - * @param {number} wireType Wire type received - * @returns {Reader} `this` - */ -Reader.prototype.skipType = function(wireType) { - switch (wireType) { - case 0: - this.skip(); - break; - case 1: - this.skip(8); - break; - case 2: - this.skip(this.uint32()); - break; - case 3: - while ((wireType = this.uint32() & 7) !== 4) { - this.skipType(wireType); - } - break; - case 5: - this.skip(4); - break; - - /* istanbul ignore next */ - default: - throw Error("invalid wire type " + wireType + " at offset " + this.pos); - } - return this; -}; - -Reader._configure = function(BufferReader_) { - BufferReader = BufferReader_; - Reader.create = create(); - BufferReader._configure(); - - var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; - util.merge(Reader.prototype, { - - int64: function read_int64() { - return readLongVarint.call(this)[fn](false); - }, - - uint64: function read_uint64() { - return readLongVarint.call(this)[fn](true); - }, - - sint64: function read_sint64() { - return readLongVarint.call(this).zzDecode()[fn](false); - }, - - fixed64: function read_fixed64() { - return readFixed64.call(this)[fn](true); - }, - - sfixed64: function read_sfixed64() { - return readFixed64.call(this)[fn](false); - } - - }); -}; - -},{"39":39}],28:[function(require,module,exports){ -"use strict"; -module.exports = BufferReader; - -// extends Reader -var Reader = require(27); -(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; - -var util = require(39); - -/** - * Constructs a new buffer reader instance. - * @classdesc Wire format reader using node buffers. - * @extends Reader - * @constructor - * @param {Buffer} buffer Buffer to read from - */ -function BufferReader(buffer) { - Reader.call(this, buffer); - - /** - * Read buffer. - * @name BufferReader#buf - * @type {Buffer} - */ -} - -BufferReader._configure = function () { - /* istanbul ignore else */ - if (util.Buffer) - BufferReader.prototype._slice = util.Buffer.prototype.slice; -}; - - -/** - * @override - */ -BufferReader.prototype.string = function read_string_buffer() { - var len = this.uint32(); // modifies pos - return this.buf.utf8Slice - ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) - : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @name BufferReader#bytes - * @function - * @returns {Buffer} Value read - */ - -BufferReader._configure(); - -},{"27":27,"39":39}],29:[function(require,module,exports){ -"use strict"; -module.exports = Root; - -// extends Namespace -var Namespace = require(23); -((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = "Root"; - -var Field = require(16), - Enum = require(15), - OneOf = require(25), - util = require(37); - -var Type, // cyclic - parse, // might be excluded - common; // " - -/** - * Constructs a new root namespace instance. - * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. - * @extends NamespaceBase - * @constructor - * @param {Object.} [options] Top level options - */ -function Root(options) { - Namespace.call(this, "", options); - - /** - * Deferred extension fields. - * @type {Field[]} - */ - this.deferred = []; - - /** - * Resolved file names of loaded files. - * @type {string[]} - */ - this.files = []; -} - -/** - * Loads a namespace descriptor into a root namespace. - * @param {INamespace} json Nameespace descriptor - * @param {Root} [root] Root namespace, defaults to create a new one if omitted - * @returns {Root} Root namespace - */ -Root.fromJSON = function fromJSON(json, root) { - if (!root) - root = new Root(); - if (json.options) - root.setOptions(json.options); - return root.addJSON(json.nested); -}; - -/** - * Resolves the path of an imported file, relative to the importing origin. - * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. - * @function - * @param {string} origin The file name of the importing file - * @param {string} target The file name being imported - * @returns {string|null} Resolved path to `target` or `null` to skip the file - */ -Root.prototype.resolvePath = util.path.resolve; - -/** - * Fetch content from file path or url - * This method exists so you can override it with your own logic. - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -Root.prototype.fetch = util.fetch; - -// A symbol-like function to safely signal synchronous loading -/* istanbul ignore next */ -function SYNC() {} // eslint-disable-line no-empty-function - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} options Parse options - * @param {LoadCallback} callback Callback function - * @returns {undefined} - */ -Root.prototype.load = function load(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = undefined; - } - var self = this; - if (!callback) - return util.asPromise(load, self, filename, options); - - var sync = callback === SYNC; // undocumented - - // Finishes loading by calling the callback (exactly once) - function finish(err, root) { - /* istanbul ignore if */ - if (!callback) - return; - var cb = callback; - callback = null; - if (sync) - throw err; - cb(err, root); - } - - // Bundled definition existence checking - function getBundledFileName(filename) { - var idx = filename.lastIndexOf("google/protobuf/"); - if (idx > -1) { - var altname = filename.substring(idx); - if (altname in common) return altname; - } - return null; - } - - // Processes a single file - function process(filename, source) { - try { - if (util.isString(source) && source.charAt(0) === "{") - source = JSON.parse(source); - if (!util.isString(source)) - self.setOptions(source.options).addJSON(source.nested); - else { - parse.filename = filename; - var parsed = parse(source, self, options), - resolved, - i = 0; - if (parsed.imports) - for (; i < parsed.imports.length; ++i) - if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i])) - fetch(resolved); - if (parsed.weakImports) - for (i = 0; i < parsed.weakImports.length; ++i) - if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i])) - fetch(resolved, true); - } - } catch (err) { - finish(err); - } - if (!sync && !queued) - finish(null, self); // only once anyway - } - - // Fetches a single file - function fetch(filename, weak) { - - // Skip if already loaded / attempted - if (self.files.indexOf(filename) > -1) - return; - self.files.push(filename); - - // Shortcut bundled definitions - if (filename in common) { - if (sync) - process(filename, common[filename]); - else { - ++queued; - setTimeout(function() { - --queued; - process(filename, common[filename]); - }); - } - return; - } - - // Otherwise fetch from disk or network - if (sync) { - var source; - try { - source = util.fs.readFileSync(filename).toString("utf8"); - } catch (err) { - if (!weak) - finish(err); - return; - } - process(filename, source); - } else { - ++queued; - self.fetch(filename, function(err, source) { - --queued; - /* istanbul ignore if */ - if (!callback) - return; // terminated meanwhile - if (err) { - /* istanbul ignore else */ - if (!weak) - finish(err); - else if (!queued) // can't be covered reliably - finish(null, self); - return; - } - process(filename, source); - }); - } - } - var queued = 0; - - // Assembling the root namespace doesn't require working type - // references anymore, so we can load everything in parallel - if (util.isString(filename)) - filename = [ filename ]; - for (var i = 0, resolved; i < filename.length; ++i) - if (resolved = self.resolvePath("", filename[i])) - fetch(resolved); - - if (sync) - return self; - if (!queued) - finish(null, self); - return undefined; -}; -// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Promise} Promise - * @variation 3 - */ -// function load(filename:string, [options:IParseOptions]):Promise - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only). - * @function Root#loadSync - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - */ -Root.prototype.loadSync = function loadSync(filename, options) { - if (!util.isNode) - throw Error("not supported"); - return this.load(filename, options, SYNC); -}; - -/** - * @override - */ -Root.prototype.resolveAll = function resolveAll() { - if (this.deferred.length) - throw Error("unresolvable extensions: " + this.deferred.map(function(field) { - return "'extend " + field.extend + "' in " + field.parent.fullName; - }).join(", ")); - return Namespace.prototype.resolveAll.call(this); -}; - -// only uppercased (and thus conflict-free) children are exposed, see below -var exposeRe = /^[A-Z]/; - -/** - * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type. - * @param {Root} root Root instance - * @param {Field} field Declaring extension field witin the declaring type - * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise - * @inner - * @ignore - */ -function tryHandleExtension(root, field) { - var extendedType = field.parent.lookup(field.extend); - if (extendedType) { - var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options); - sisterField.declaringField = field; - field.extensionField = sisterField; - extendedType.add(sisterField); - return true; - } - return false; -} - -/** - * Called when any object is added to this root or its sub-namespaces. - * @param {ReflectionObject} object Object added - * @returns {undefined} - * @private - */ -Root.prototype._handleAdd = function _handleAdd(object) { - if (object instanceof Field) { - - if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField) - if (!tryHandleExtension(this, object)) - this.deferred.push(object); - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - object.parent[object.name] = object.values; // expose enum values as property of its parent - - } else if (!(object instanceof OneOf)) /* everything else is a namespace */ { - - if (object instanceof Type) // Try to handle any deferred extensions - for (var i = 0; i < this.deferred.length;) - if (tryHandleExtension(this, this.deferred[i])) - this.deferred.splice(i, 1); - else - ++i; - for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace - this._handleAdd(object._nestedArray[j]); - if (exposeRe.test(object.name)) - object.parent[object.name] = object; // expose namespace as property of its parent - } - - // The above also adds uppercased (and thus conflict-free) nested types, services and enums as - // properties of namespaces just like static code does. This allows using a .d.ts generated for - // a static module with reflection-based solutions where the condition is met. -}; - -/** - * Called when any object is removed from this root or its sub-namespaces. - * @param {ReflectionObject} object Object removed - * @returns {undefined} - * @private - */ -Root.prototype._handleRemove = function _handleRemove(object) { - if (object instanceof Field) { - - if (/* an extension field */ object.extend !== undefined) { - if (/* already handled */ object.extensionField) { // remove its sister field - object.extensionField.parent.remove(object.extensionField); - object.extensionField = null; - } else { // cancel the extension - var index = this.deferred.indexOf(object); - /* istanbul ignore else */ - if (index > -1) - this.deferred.splice(index, 1); - } - } - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose enum values - - } else if (object instanceof Namespace) { - - for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace - this._handleRemove(object._nestedArray[i]); - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose namespaces - - } -}; - -// Sets up cyclic dependencies (called in index-light) -Root._configure = function(Type_, parse_, common_) { - Type = Type_; - parse = parse_; - common = common_; -}; - -},{"15":15,"16":16,"23":23,"25":25,"37":37}],30:[function(require,module,exports){ -"use strict"; -module.exports = {}; - -/** - * Named roots. - * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). - * Can also be used manually to make roots available accross modules. - * @name roots - * @type {Object.} - * @example - * // pbjs -r myroot -o compiled.js ... - * - * // in another module: - * require("./compiled.js"); - * - * // in any subsequent module: - * var root = protobuf.roots["myroot"]; - */ - -},{}],31:[function(require,module,exports){ -"use strict"; - -/** - * Streaming RPC helpers. - * @namespace - */ -var rpc = exports; - -/** - * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. - * @typedef RPCImpl - * @type {function} - * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called - * @param {Uint8Array} requestData Request data - * @param {RPCImplCallback} callback Callback function - * @returns {undefined} - * @example - * function rpcImpl(method, requestData, callback) { - * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code - * throw Error("no such method"); - * asynchronouslyObtainAResponse(requestData, function(err, responseData) { - * callback(err, responseData); - * }); - * } - */ - -/** - * Node-style callback as used by {@link RPCImpl}. - * @typedef RPCImplCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error - * @returns {undefined} - */ - -rpc.Service = require(32); - -},{"32":32}],32:[function(require,module,exports){ -"use strict"; -module.exports = Service; - -var util = require(39); - -// Extends EventEmitter -(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; - -/** - * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. - * - * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. - * @typedef rpc.ServiceMethodCallback - * @template TRes extends Message - * @type {function} - * @param {Error|null} error Error, if any - * @param {TRes} [response] Response message - * @returns {undefined} - */ - -/** - * A service method part of a {@link rpc.Service} as created by {@link Service.create}. - * @typedef rpc.ServiceMethod - * @template TReq extends Message - * @template TRes extends Message - * @type {function} - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message - * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` - */ - -/** - * Constructs a new RPC service instance. - * @classdesc An RPC service as returned by {@link Service#create}. - * @exports rpc.Service - * @extends util.EventEmitter - * @constructor - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ -function Service(rpcImpl, requestDelimited, responseDelimited) { - - if (typeof rpcImpl !== "function") - throw TypeError("rpcImpl must be a function"); - - util.EventEmitter.call(this); - - /** - * RPC implementation. Becomes `null` once the service is ended. - * @type {RPCImpl|null} - */ - this.rpcImpl = rpcImpl; - - /** - * Whether requests are length-delimited. - * @type {boolean} - */ - this.requestDelimited = Boolean(requestDelimited); - - /** - * Whether responses are length-delimited. - * @type {boolean} - */ - this.responseDelimited = Boolean(responseDelimited); -} - -/** - * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. - * @param {Method|rpc.ServiceMethod} method Reflected or static method - * @param {Constructor} requestCtor Request constructor - * @param {Constructor} responseCtor Response constructor - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} callback Service callback - * @returns {undefined} - * @template TReq extends Message - * @template TRes extends Message - */ -Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { - - if (!request) - throw TypeError("request must be specified"); - - var self = this; - if (!callback) - return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); - - if (!self.rpcImpl) { - setTimeout(function() { callback(Error("already ended")); }, 0); - return undefined; - } - - try { - return self.rpcImpl( - method, - requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), - function rpcCallback(err, response) { - - if (err) { - self.emit("error", err, method); - return callback(err); - } - - if (response === null) { - self.end(/* endedByRPC */ true); - return undefined; - } - - if (!(response instanceof responseCtor)) { - try { - response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); - } catch (err) { - self.emit("error", err, method); - return callback(err); - } - } - - self.emit("data", response, method); - return callback(null, response); - } - ); - } catch (err) { - self.emit("error", err, method); - setTimeout(function() { callback(err); }, 0); - return undefined; - } -}; - -/** - * Ends this service and emits the `end` event. - * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. - * @returns {rpc.Service} `this` - */ -Service.prototype.end = function end(endedByRPC) { - if (this.rpcImpl) { - if (!endedByRPC) // signal end to rpcImpl - this.rpcImpl(null, null, null); - this.rpcImpl = null; - this.emit("end").off(); - } - return this; -}; - -},{"39":39}],33:[function(require,module,exports){ -"use strict"; -module.exports = Service; - -// extends Namespace -var Namespace = require(23); -((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service"; - -var Method = require(22), - util = require(37), - rpc = require(31); - -/** - * Constructs a new service instance. - * @classdesc Reflected service. - * @extends NamespaceBase - * @constructor - * @param {string} name Service name - * @param {Object.} [options] Service options - * @throws {TypeError} If arguments are invalid - */ -function Service(name, options) { - Namespace.call(this, name, options); - - /** - * Service methods. - * @type {Object.} - */ - this.methods = {}; // toJSON, marker - - /** - * Cached methods as an array. - * @type {Method[]|null} - * @private - */ - this._methodsArray = null; -} - -/** - * Service descriptor. - * @interface IService - * @extends INamespace - * @property {Object.} methods Method descriptors - */ - -/** - * Constructs a service from a service descriptor. - * @param {string} name Service name - * @param {IService} json Service descriptor - * @returns {Service} Created service - * @throws {TypeError} If arguments are invalid - */ -Service.fromJSON = function fromJSON(name, json) { - var service = new Service(name, json.options); - /* istanbul ignore else */ - if (json.methods) - for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i) - service.add(Method.fromJSON(names[i], json.methods[names[i]])); - if (json.nested) - service.addJSON(json.nested); - service.comment = json.comment; - return service; -}; - -/** - * Converts this service to a service descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IService} Service descriptor - */ -Service.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "methods" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {}, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Methods of this service as an array for iteration. - * @name Service#methodsArray - * @type {Method[]} - * @readonly - */ -Object.defineProperty(Service.prototype, "methodsArray", { - get: function() { - return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); - } -}); - -function clearCache(service) { - service._methodsArray = null; - return service; -} - -/** - * @override - */ -Service.prototype.get = function get(name) { - return this.methods[name] - || Namespace.prototype.get.call(this, name); -}; - -/** - * @override - */ -Service.prototype.resolveAll = function resolveAll() { - var methods = this.methodsArray; - for (var i = 0; i < methods.length; ++i) - methods[i].resolve(); - return Namespace.prototype.resolve.call(this); -}; - -/** - * @override - */ -Service.prototype.add = function add(object) { - - /* istanbul ignore if */ - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Method) { - this.methods[object.name] = object; - object.parent = this; - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * @override - */ -Service.prototype.remove = function remove(object) { - if (object instanceof Method) { - - /* istanbul ignore if */ - if (this.methods[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.methods[object.name]; - object.parent = null; - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Creates a runtime service using the specified rpc implementation. - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed. - */ -Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) { - var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited); - for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) { - var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, ""); - rpcService[methodName] = util.codegen(["r","c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({ - m: method, - q: method.resolvedRequestType.ctor, - s: method.resolvedResponseType.ctor - }); - } - return rpcService; -}; - -},{"22":22,"23":23,"31":31,"37":37}],34:[function(require,module,exports){ -"use strict"; -module.exports = tokenize; - -var delimRe = /[\s{}=;:[\],'"()<>]/g, - stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, - stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g; - -var setCommentRe = /^ *[*/]+ */, - setCommentAltRe = /^\s*\*?\/*/, - setCommentSplitRe = /\n/g, - whitespaceRe = /\s/, - unescapeRe = /\\(.?)/g; - -var unescapeMap = { - "0": "\0", - "r": "\r", - "n": "\n", - "t": "\t" -}; - -/** - * Unescapes a string. - * @param {string} str String to unescape - * @returns {string} Unescaped string - * @property {Object.} map Special characters map - * @memberof tokenize - */ -function unescape(str) { - return str.replace(unescapeRe, function($0, $1) { - switch ($1) { - case "\\": - case "": - return $1; - default: - return unescapeMap[$1] || ""; - } - }); -} - -tokenize.unescape = unescape; - -/** - * Gets the next token and advances. - * @typedef TokenizerHandleNext - * @type {function} - * @returns {string|null} Next token or `null` on eof - */ - -/** - * Peeks for the next token. - * @typedef TokenizerHandlePeek - * @type {function} - * @returns {string|null} Next token or `null` on eof - */ - -/** - * Pushes a token back to the stack. - * @typedef TokenizerHandlePush - * @type {function} - * @param {string} token Token - * @returns {undefined} - */ - -/** - * Skips the next token. - * @typedef TokenizerHandleSkip - * @type {function} - * @param {string} expected Expected token - * @param {boolean} [optional=false] If optional - * @returns {boolean} Whether the token matched - * @throws {Error} If the token didn't match and is not optional - */ - -/** - * Gets the comment on the previous line or, alternatively, the line comment on the specified line. - * @typedef TokenizerHandleCmnt - * @type {function} - * @param {number} [line] Line number - * @returns {string|null} Comment text or `null` if none - */ - -/** - * Handle object returned from {@link tokenize}. - * @interface ITokenizerHandle - * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof) - * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof) - * @property {TokenizerHandlePush} push Pushes a token back to the stack - * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws - * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any - * @property {number} line Current line number - */ - -/** - * Tokenizes the given .proto source and returns an object with useful utility functions. - * @param {string} source Source contents - * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode. - * @returns {ITokenizerHandle} Tokenizer handle - */ -function tokenize(source, alternateCommentMode) { - /* eslint-disable callback-return */ - source = source.toString(); - - var offset = 0, - length = source.length, - line = 1, - commentType = null, - commentText = null, - commentLine = 0, - commentLineEmpty = false, - commentIsLeading = false; - - var stack = []; - - var stringDelim = null; - - /* istanbul ignore next */ - /** - * Creates an error for illegal syntax. - * @param {string} subject Subject - * @returns {Error} Error created - * @inner - */ - function illegal(subject) { - return Error("illegal " + subject + " (line " + line + ")"); - } - - /** - * Reads a string till its end. - * @returns {string} String read - * @inner - */ - function readString() { - var re = stringDelim === "'" ? stringSingleRe : stringDoubleRe; - re.lastIndex = offset - 1; - var match = re.exec(source); - if (!match) - throw illegal("string"); - offset = re.lastIndex; - push(stringDelim); - stringDelim = null; - return unescape(match[1]); - } - - /** - * Gets the character at `pos` within the source. - * @param {number} pos Position - * @returns {string} Character - * @inner - */ - function charAt(pos) { - return source.charAt(pos); - } - - /** - * Sets the current comment text. - * @param {number} start Start offset - * @param {number} end End offset - * @param {boolean} isLeading set if a leading comment - * @returns {undefined} - * @inner - */ - function setComment(start, end, isLeading) { - commentType = source.charAt(start++); - commentLine = line; - commentLineEmpty = false; - commentIsLeading = isLeading; - var lookback; - if (alternateCommentMode) { - lookback = 2; // alternate comment parsing: "//" or "/*" - } else { - lookback = 3; // "///" or "/**" - } - var commentOffset = start - lookback, - c; - do { - if (--commentOffset < 0 || - (c = source.charAt(commentOffset)) === "\n") { - commentLineEmpty = true; - break; - } - } while (c === " " || c === "\t"); - var lines = source - .substring(start, end) - .split(setCommentSplitRe); - for (var i = 0; i < lines.length; ++i) - lines[i] = lines[i] - .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, "") - .trim(); - commentText = lines - .join("\n") - .trim(); - } - - function isDoubleSlashCommentLine(startOffset) { - var endOffset = findEndOfLine(startOffset); - - // see if remaining line matches comment pattern - var lineText = source.substring(startOffset, endOffset); - // look for 1 or 2 slashes since startOffset would already point past - // the first slash that started the comment. - var isComment = /^\s*\/{1,2}/.test(lineText); - return isComment; - } - - function findEndOfLine(cursor) { - // find end of cursor's line - var endOffset = cursor; - while (endOffset < length && charAt(endOffset) !== "\n") { - endOffset++; - } - return endOffset; - } - - /** - * Obtains the next token. - * @returns {string|null} Next token or `null` on eof - * @inner - */ - function next() { - if (stack.length > 0) - return stack.shift(); - if (stringDelim) - return readString(); - var repeat, - prev, - curr, - start, - isDoc, - isLeadingComment = offset === 0; - do { - if (offset === length) - return null; - repeat = false; - while (whitespaceRe.test(curr = charAt(offset))) { - if (curr === "\n") { - isLeadingComment = true; - ++line; - } - if (++offset === length) - return null; - } - - if (charAt(offset) === "/") { - if (++offset === length) { - throw illegal("comment"); - } - if (charAt(offset) === "/") { // Line - if (!alternateCommentMode) { - // check for triple-slash comment - isDoc = charAt(start = offset + 1) === "/"; - - while (charAt(++offset) !== "\n") { - if (offset === length) { - return null; - } - } - ++offset; - if (isDoc) { - setComment(start, offset - 1, isLeadingComment); - } - ++line; - repeat = true; - } else { - // check for double-slash comments, consolidating consecutive lines - start = offset; - isDoc = false; - if (isDoubleSlashCommentLine(offset)) { - isDoc = true; - do { - offset = findEndOfLine(offset); - if (offset === length) { - break; - } - offset++; - } while (isDoubleSlashCommentLine(offset)); - } else { - offset = Math.min(length, findEndOfLine(offset) + 1); - } - if (isDoc) { - setComment(start, offset, isLeadingComment); - } - line++; - repeat = true; - } - } else if ((curr = charAt(offset)) === "*") { /* Block */ - // check for /** (regular comment mode) or /* (alternate comment mode) - start = offset + 1; - isDoc = alternateCommentMode || charAt(start) === "*"; - do { - if (curr === "\n") { - ++line; - } - if (++offset === length) { - throw illegal("comment"); - } - prev = curr; - curr = charAt(offset); - } while (prev !== "*" || curr !== "/"); - ++offset; - if (isDoc) { - setComment(start, offset - 2, isLeadingComment); - } - repeat = true; - } else { - return "/"; - } - } - } while (repeat); - - // offset !== length if we got here - - var end = offset; - delimRe.lastIndex = 0; - var delim = delimRe.test(charAt(end++)); - if (!delim) - while (end < length && !delimRe.test(charAt(end))) - ++end; - var token = source.substring(offset, offset = end); - if (token === "\"" || token === "'") - stringDelim = token; - return token; - } - - /** - * Pushes a token back to the stack. - * @param {string} token Token - * @returns {undefined} - * @inner - */ - function push(token) { - stack.push(token); - } - - /** - * Peeks for the next token. - * @returns {string|null} Token or `null` on eof - * @inner - */ - function peek() { - if (!stack.length) { - var token = next(); - if (token === null) - return null; - push(token); - } - return stack[0]; - } - - /** - * Skips a token. - * @param {string} expected Expected token - * @param {boolean} [optional=false] Whether the token is optional - * @returns {boolean} `true` when skipped, `false` if not - * @throws {Error} When a required token is not present - * @inner - */ - function skip(expected, optional) { - var actual = peek(), - equals = actual === expected; - if (equals) { - next(); - return true; - } - if (!optional) - throw illegal("token '" + actual + "', '" + expected + "' expected"); - return false; - } - - /** - * Gets a comment. - * @param {number} [trailingLine] Line number if looking for a trailing comment - * @returns {string|null} Comment text - * @inner - */ - function cmnt(trailingLine) { - var ret = null; - if (trailingLine === undefined) { - if (commentLine === line - 1 && (alternateCommentMode || commentType === "*" || commentLineEmpty)) { - ret = commentIsLeading ? commentText : null; - } - } else { - /* istanbul ignore else */ - if (commentLine < trailingLine) { - peek(); - } - if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === "/")) { - ret = commentIsLeading ? null : commentText; - } - } - return ret; - } - - return Object.defineProperty({ - next: next, - peek: peek, - push: push, - skip: skip, - cmnt: cmnt - }, "line", { - get: function() { return line; } - }); - /* eslint-enable callback-return */ -} - -},{}],35:[function(require,module,exports){ -"use strict"; -module.exports = Type; - -// extends Namespace -var Namespace = require(23); -((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = "Type"; - -var Enum = require(15), - OneOf = require(25), - Field = require(16), - MapField = require(20), - Service = require(33), - Message = require(21), - Reader = require(27), - Writer = require(42), - util = require(37), - encoder = require(14), - decoder = require(13), - verifier = require(40), - converter = require(12), - wrappers = require(41); - -/** - * Constructs a new reflected message type instance. - * @classdesc Reflected message type. - * @extends NamespaceBase - * @constructor - * @param {string} name Message name - * @param {Object.} [options] Declared options - */ -function Type(name, options) { - Namespace.call(this, name, options); - - /** - * Message fields. - * @type {Object.} - */ - this.fields = {}; // toJSON, marker - - /** - * Oneofs declared within this namespace, if any. - * @type {Object.} - */ - this.oneofs = undefined; // toJSON - - /** - * Extension ranges, if any. - * @type {number[][]} - */ - this.extensions = undefined; // toJSON - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - /*? - * Whether this type is a legacy group. - * @type {boolean|undefined} - */ - this.group = undefined; // toJSON - - /** - * Cached fields by id. - * @type {Object.|null} - * @private - */ - this._fieldsById = null; - - /** - * Cached fields as an array. - * @type {Field[]|null} - * @private - */ - this._fieldsArray = null; - - /** - * Cached oneofs as an array. - * @type {OneOf[]|null} - * @private - */ - this._oneofsArray = null; - - /** - * Cached constructor. - * @type {Constructor<{}>} - * @private - */ - this._ctor = null; -} - -Object.defineProperties(Type.prototype, { - - /** - * Message fields by id. - * @name Type#fieldsById - * @type {Object.} - * @readonly - */ - fieldsById: { - get: function() { - - /* istanbul ignore if */ - if (this._fieldsById) - return this._fieldsById; - - this._fieldsById = {}; - for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) { - var field = this.fields[names[i]], - id = field.id; - - /* istanbul ignore if */ - if (this._fieldsById[id]) - throw Error("duplicate id " + id + " in " + this); - - this._fieldsById[id] = field; - } - return this._fieldsById; - } - }, - - /** - * Fields of this message as an array for iteration. - * @name Type#fieldsArray - * @type {Field[]} - * @readonly - */ - fieldsArray: { - get: function() { - return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); - } - }, - - /** - * Oneofs of this message as an array for iteration. - * @name Type#oneofsArray - * @type {OneOf[]} - * @readonly - */ - oneofsArray: { - get: function() { - return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); - } - }, - - /** - * The registered constructor, if any registered, otherwise a generic constructor. - * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. - * @name Type#ctor - * @type {Constructor<{}>} - */ - ctor: { - get: function() { - return this._ctor || (this.ctor = Type.generateConstructor(this)()); - }, - set: function(ctor) { - - // Ensure proper prototype - var prototype = ctor.prototype; - if (!(prototype instanceof Message)) { - (ctor.prototype = new Message()).constructor = ctor; - util.merge(ctor.prototype, prototype); - } - - // Classes and messages reference their reflected type - ctor.$type = ctor.prototype.$type = this; - - // Mix in static methods - util.merge(ctor, Message, true); - - this._ctor = ctor; - - // Messages have non-enumerable default values on their prototype - var i = 0; - for (; i < /* initializes */ this.fieldsArray.length; ++i) - this._fieldsArray[i].resolve(); // ensures a proper value - - // Messages have non-enumerable getters and setters for each virtual oneof field - var ctorProperties = {}; - for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i) - ctorProperties[this._oneofsArray[i].resolve().name] = { - get: util.oneOfGetter(this._oneofsArray[i].oneof), - set: util.oneOfSetter(this._oneofsArray[i].oneof) - }; - if (i) - Object.defineProperties(ctor.prototype, ctorProperties); - } - } -}); - -/** - * Generates a constructor function for the specified type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -Type.generateConstructor = function generateConstructor(mtype) { - /* eslint-disable no-unexpected-multiline */ - var gen = util.codegen(["p"], mtype.name); - // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype - for (var i = 0, field; i < mtype.fieldsArray.length; ++i) - if ((field = mtype._fieldsArray[i]).map) gen - ("this%s={}", util.safeProp(field.name)); - else if (field.repeated) gen - ("this%s=[]", util.safeProp(field.name)); - return gen - ("if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors - * @property {Object.} fields Field descriptors - * @property {number[][]} [extensions] Extension ranges - * @property {number[][]} [reserved] Reserved ranges - * @property {boolean} [group=false] Whether a legacy group or not - */ - -/** - * Creates a message type from a message type descriptor. - * @param {string} name Message name - * @param {IType} json Message type descriptor - * @returns {Type} Created message type - */ -Type.fromJSON = function fromJSON(name, json) { - var type = new Type(name, json.options); - type.extensions = json.extensions; - type.reserved = json.reserved; - var names = Object.keys(json.fields), - i = 0; - for (; i < names.length; ++i) - type.add( - ( typeof json.fields[names[i]].keyType !== "undefined" - ? MapField.fromJSON - : Field.fromJSON )(names[i], json.fields[names[i]]) - ); - if (json.oneofs) - for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i) - type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]])); - if (json.nested) - for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) { - var nested = json.nested[names[i]]; - type.add( // most to least likely - ( nested.id !== undefined - ? Field.fromJSON - : nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - if (json.extensions && json.extensions.length) - type.extensions = json.extensions; - if (json.reserved && json.reserved.length) - type.reserved = json.reserved; - if (json.group) - type.group = true; - if (json.comment) - type.comment = json.comment; - return type; -}; - -/** - * Converts this message type to a message type descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IType} Message type descriptor - */ -Type.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "oneofs" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions), - "fields" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {}, - "extensions" , this.extensions && this.extensions.length ? this.extensions : undefined, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "group" , this.group || undefined, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -Type.prototype.resolveAll = function resolveAll() { - var fields = this.fieldsArray, i = 0; - while (i < fields.length) - fields[i++].resolve(); - var oneofs = this.oneofsArray; i = 0; - while (i < oneofs.length) - oneofs[i++].resolve(); - return Namespace.prototype.resolveAll.call(this); -}; - -/** - * @override - */ -Type.prototype.get = function get(name) { - return this.fields[name] - || this.oneofs && this.oneofs[name] - || this.nested && this.nested[name] - || null; -}; - -/** - * Adds a nested object to this type. - * @param {ReflectionObject} object Nested object to add - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id - */ -Type.prototype.add = function add(object) { - - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Field && object.extend === undefined) { - // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects. - // The root object takes care of adding distinct sister-fields to the respective extended - // type instead. - - // avoids calling the getter if not absolutely necessary because it's called quite frequently - if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id]) - throw Error("duplicate id " + object.id + " in " + this); - if (this.isReservedId(object.id)) - throw Error("id " + object.id + " is reserved in " + this); - if (this.isReservedName(object.name)) - throw Error("name '" + object.name + "' is reserved in " + this); - - if (object.parent) - object.parent.remove(object); - this.fields[object.name] = object; - object.message = this; - object.onAdd(this); - return clearCache(this); - } - if (object instanceof OneOf) { - if (!this.oneofs) - this.oneofs = {}; - this.oneofs[object.name] = object; - object.onAdd(this); - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * Removes a nested object from this type. - * @param {ReflectionObject} object Nested object to remove - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this type - */ -Type.prototype.remove = function remove(object) { - if (object instanceof Field && object.extend === undefined) { - // See Type#add for the reason why extension fields are excluded here. - - /* istanbul ignore if */ - if (!this.fields || this.fields[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.fields[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - if (object instanceof OneOf) { - - /* istanbul ignore if */ - if (!this.oneofs || this.oneofs[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.oneofs[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message<{}>} Message instance - */ -Type.prototype.create = function create(properties) { - return new this.ctor(properties); -}; - -/** - * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. - * @returns {Type} `this` - */ -Type.prototype.setup = function setup() { - // Sets up everything at once so that the prototype chain does not have to be re-evaluated - // multiple times (V8, soft-deopt prototype-check). - - var fullName = this.fullName, - types = []; - for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i) - types.push(this._fieldsArray[i].resolve().resolvedType); - - // Replace setup methods with type-specific generated functions - this.encode = encoder(this)({ - Writer : Writer, - types : types, - util : util - }); - this.decode = decoder(this)({ - Reader : Reader, - types : types, - util : util - }); - this.verify = verifier(this)({ - types : types, - util : util - }); - this.fromObject = converter.fromObject(this)({ - types : types, - util : util - }); - this.toObject = converter.toObject(this)({ - types : types, - util : util - }); - - // Inject custom wrappers for common types - var wrapper = wrappers[fullName]; - if (wrapper) { - var originalThis = Object.create(this); - // if (wrapper.fromObject) { - originalThis.fromObject = this.fromObject; - this.fromObject = wrapper.fromObject.bind(originalThis); - // } - // if (wrapper.toObject) { - originalThis.toObject = this.toObject; - this.toObject = wrapper.toObject.bind(originalThis); - // } - } - - return this; -}; - -/** - * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encode = function encode_setup(message, writer) { - return this.setup().encode(message, writer); // overrides this method -}; - -/** - * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); -}; - -/** - * Decodes a message of this type. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Length of the message, if known beforehand - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError<{}>} If required fields are missing - */ -Type.prototype.decode = function decode_setup(reader, length) { - return this.setup().decode(reader, length); // overrides this method -}; - -/** - * Decodes a message of this type preceeded by its byte length as a varint. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError} If required fields are missing - */ -Type.prototype.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof Reader)) - reader = Reader.create(reader); - return this.decode(reader, reader.uint32()); -}; - -/** - * Verifies that field values are valid and that required fields are present. - * @param {Object.} message Plain object to verify - * @returns {null|string} `null` if valid, otherwise the reason why it is not - */ -Type.prototype.verify = function verify_setup(message) { - return this.setup().verify(message); // overrides this method -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object to convert - * @returns {Message<{}>} Message instance - */ -Type.prototype.fromObject = function fromObject(object) { - return this.setup().fromObject(object); -}; - -/** - * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. - * @interface IConversionOptions - * @property {Function} [longs] Long conversion type. - * Valid values are `String` and `Number` (the global types). - * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library. - * @property {Function} [enums] Enum value conversion type. - * Only valid value is `String` (the global type). - * Defaults to copy the present value, which is the numeric id. - * @property {Function} [bytes] Bytes value conversion type. - * Valid values are `Array` and (a base64 encoded) `String` (the global types). - * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser. - * @property {boolean} [defaults=false] Also sets default values on the resulting object - * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false` - * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false` - * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any - * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings - */ - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ -Type.prototype.toObject = function toObject(message, options) { - return this.setup().toObject(message, options); -}; - -/** - * Decorator function as returned by {@link Type.d} (TypeScript). - * @typedef TypeDecorator - * @type {function} - * @param {Constructor} target Target constructor - * @returns {undefined} - * @template T extends Message - */ - -/** - * Type decorator (TypeScript). - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {TypeDecorator} Decorator function - * @template T extends Message - */ -Type.d = function decorateType(typeName) { - return function typeDecorator(target) { - util.decorateType(target, typeName); - }; -}; - -},{"12":12,"13":13,"14":14,"15":15,"16":16,"20":20,"21":21,"23":23,"25":25,"27":27,"33":33,"37":37,"40":40,"41":41,"42":42}],36:[function(require,module,exports){ -"use strict"; - -/** - * Common type constants. - * @namespace - */ -var types = exports; - -var util = require(37); - -var s = [ - "double", // 0 - "float", // 1 - "int32", // 2 - "uint32", // 3 - "sint32", // 4 - "fixed32", // 5 - "sfixed32", // 6 - "int64", // 7 - "uint64", // 8 - "sint64", // 9 - "fixed64", // 10 - "sfixed64", // 11 - "bool", // 12 - "string", // 13 - "bytes" // 14 -]; - -function bake(values, offset) { - var i = 0, o = {}; - offset |= 0; - while (i < values.length) o[s[i + offset]] = values[i++]; - return o; -} - -/** - * Basic type wire types. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - * @property {number} bytes=2 Ldelim wire type - */ -types.basic = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2, - /* bytes */ 2 -]); - -/** - * Basic type defaults. - * @type {Object.} - * @const - * @property {number} double=0 Double default - * @property {number} float=0 Float default - * @property {number} int32=0 Int32 default - * @property {number} uint32=0 Uint32 default - * @property {number} sint32=0 Sint32 default - * @property {number} fixed32=0 Fixed32 default - * @property {number} sfixed32=0 Sfixed32 default - * @property {number} int64=0 Int64 default - * @property {number} uint64=0 Uint64 default - * @property {number} sint64=0 Sint32 default - * @property {number} fixed64=0 Fixed64 default - * @property {number} sfixed64=0 Sfixed64 default - * @property {boolean} bool=false Bool default - * @property {string} string="" String default - * @property {Array.} bytes=Array(0) Bytes default - * @property {null} message=null Message default - */ -types.defaults = bake([ - /* double */ 0, - /* float */ 0, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 0, - /* sfixed32 */ 0, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 0, - /* sfixed64 */ 0, - /* bool */ false, - /* string */ "", - /* bytes */ util.emptyArray, - /* message */ null -]); - -/** - * Basic long type wire types. - * @type {Object.} - * @const - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - */ -types.long = bake([ - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1 -], 7); - -/** - * Allowed types for map keys with their associated wire type. - * @type {Object.} - * @const - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - */ -types.mapKey = bake([ - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2 -], 2); - -/** - * Allowed types for packed repeated fields with their associated wire type. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - */ -types.packed = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0 -]); - -},{"37":37}],37:[function(require,module,exports){ -"use strict"; - -/** - * Various utility functions. - * @namespace - */ -var util = module.exports = require(39); - -var roots = require(30); - -var Type, // cyclic - Enum; - -util.codegen = require(3); -util.fetch = require(5); -util.path = require(8); - -/** - * Node's fs module if available. - * @type {Object.} - */ -util.fs = util.inquire("fs"); - -/** - * Converts an object's values to an array. - * @param {Object.} object Object to convert - * @returns {Array.<*>} Converted array - */ -util.toArray = function toArray(object) { - if (object) { - var keys = Object.keys(object), - array = new Array(keys.length), - index = 0; - while (index < keys.length) - array[index] = object[keys[index++]]; - return array; - } - return []; -}; - -/** - * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values. - * @param {Array.<*>} array Array to convert - * @returns {Object.} Converted object - */ -util.toObject = function toObject(array) { - var object = {}, - index = 0; - while (index < array.length) { - var key = array[index++], - val = array[index++]; - if (val !== undefined) - object[key] = val; - } - return object; -}; - -var safePropBackslashRe = /\\/g, - safePropQuoteRe = /"/g; - -/** - * Tests whether the specified name is a reserved word in JS. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -util.isReserved = function isReserved(name) { - return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name); -}; - -/** - * Returns a safe property accessor for the specified property name. - * @param {string} prop Property name - * @returns {string} Safe accessor - */ -util.safeProp = function safeProp(prop) { - if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop)) - return "[\"" + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, "\\\"") + "\"]"; - return "." + prop; -}; - -/** - * Converts the first character of a string to upper case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.ucFirst = function ucFirst(str) { - return str.charAt(0).toUpperCase() + str.substring(1); -}; - -var camelCaseRe = /_([a-z])/g; - -/** - * Converts a string to camel case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.camelCase = function camelCase(str) { - return str.substring(0, 1) - + str.substring(1) - .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); }); -}; - -/** - * Compares reflected fields by id. - * @param {Field} a First field - * @param {Field} b Second field - * @returns {number} Comparison value - */ -util.compareFieldsById = function compareFieldsById(a, b) { - return a.id - b.id; -}; - -/** - * Decorator helper for types (TypeScript). - * @param {Constructor} ctor Constructor function - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {Type} Reflected type - * @template T extends Message - * @property {Root} root Decorators root - */ -util.decorateType = function decorateType(ctor, typeName) { - - /* istanbul ignore if */ - if (ctor.$type) { - if (typeName && ctor.$type.name !== typeName) { - util.decorateRoot.remove(ctor.$type); - ctor.$type.name = typeName; - util.decorateRoot.add(ctor.$type); - } - return ctor.$type; - } - - /* istanbul ignore next */ - if (!Type) - Type = require(35); - - var type = new Type(typeName || ctor.name); - util.decorateRoot.add(type); - type.ctor = ctor; // sets up .encode, .decode etc. - Object.defineProperty(ctor, "$type", { value: type, enumerable: false }); - Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false }); - return type; -}; - -var decorateEnumIndex = 0; - -/** - * Decorator helper for enums (TypeScript). - * @param {Object} object Enum object - * @returns {Enum} Reflected enum - */ -util.decorateEnum = function decorateEnum(object) { - - /* istanbul ignore if */ - if (object.$type) - return object.$type; - - /* istanbul ignore next */ - if (!Enum) - Enum = require(15); - - var enm = new Enum("Enum" + decorateEnumIndex++, object); - util.decorateRoot.add(enm); - Object.defineProperty(object, "$type", { value: enm, enumerable: false }); - return enm; -}; - - -/** - * Sets the value of a property by property path. If a value already exists, it is turned to an array - * @param {Object.} dst Destination object - * @param {string} path dot '.' delimited path of the property to set - * @param {Object} value the value to set - * @returns {Object.} Destination object - */ -util.setProperty = function setProperty(dst, path, value) { - function setProp(dst, path, value) { - var part = path.shift(); - if (path.length > 0) { - dst[part] = setProp(dst[part] || {}, path, value); - } else { - var prevValue = dst[part]; - if (prevValue) - value = [].concat(prevValue).concat(value); - dst[part] = value; - } - return dst; - } - - if (typeof dst !== "object") - throw TypeError("dst must be an object"); - if (!path) - throw TypeError("path must be specified"); - - path = path.split("."); - return setProp(dst, path, value); -}; - -/** - * Decorator root (TypeScript). - * @name util.decorateRoot - * @type {Root} - * @readonly - */ -Object.defineProperty(util, "decorateRoot", { - get: function() { - return roots["decorated"] || (roots["decorated"] = new (require(29))()); - } -}); - -},{"15":15,"29":29,"3":3,"30":30,"35":35,"39":39,"5":5,"8":8}],38:[function(require,module,exports){ -"use strict"; -module.exports = LongBits; - -var util = require(39); - -/** - * Constructs new long bits. - * @classdesc Helper class for working with the low and high bits of a 64 bit value. - * @memberof util - * @constructor - * @param {number} lo Low 32 bits, unsigned - * @param {number} hi High 32 bits, unsigned - */ -function LongBits(lo, hi) { - - // note that the casts below are theoretically unnecessary as of today, but older statically - // generated converter code might still call the ctor with signed 32bits. kept for compat. - - /** - * Low bits. - * @type {number} - */ - this.lo = lo >>> 0; - - /** - * High bits. - * @type {number} - */ - this.hi = hi >>> 0; -} - -/** - * Zero bits. - * @memberof util.LongBits - * @type {util.LongBits} - */ -var zero = LongBits.zero = new LongBits(0, 0); - -zero.toNumber = function() { return 0; }; -zero.zzEncode = zero.zzDecode = function() { return this; }; -zero.length = function() { return 1; }; - -/** - * Zero hash. - * @memberof util.LongBits - * @type {string} - */ -var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; - -/** - * Constructs new long bits from the specified number. - * @param {number} value Value - * @returns {util.LongBits} Instance - */ -LongBits.fromNumber = function fromNumber(value) { - if (value === 0) - return zero; - var sign = value < 0; - if (sign) - value = -value; - var lo = value >>> 0, - hi = (value - lo) / 4294967296 >>> 0; - if (sign) { - hi = ~hi >>> 0; - lo = ~lo >>> 0; - if (++lo > 4294967295) { - lo = 0; - if (++hi > 4294967295) - hi = 0; - } - } - return new LongBits(lo, hi); -}; - -/** - * Constructs new long bits from a number, long or string. - * @param {Long|number|string} value Value - * @returns {util.LongBits} Instance - */ -LongBits.from = function from(value) { - if (typeof value === "number") - return LongBits.fromNumber(value); - if (util.isString(value)) { - /* istanbul ignore else */ - if (util.Long) - value = util.Long.fromString(value); - else - return LongBits.fromNumber(parseInt(value, 10)); - } - return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; -}; - -/** - * Converts this long bits to a possibly unsafe JavaScript number. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {number} Possibly unsafe number - */ -LongBits.prototype.toNumber = function toNumber(unsigned) { - if (!unsigned && this.hi >>> 31) { - var lo = ~this.lo + 1 >>> 0, - hi = ~this.hi >>> 0; - if (!lo) - hi = hi + 1 >>> 0; - return -(lo + hi * 4294967296); - } - return this.lo + this.hi * 4294967296; -}; - -/** - * Converts this long bits to a long. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long} Long - */ -LongBits.prototype.toLong = function toLong(unsigned) { - return util.Long - ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) - /* istanbul ignore next */ - : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; -}; - -var charCodeAt = String.prototype.charCodeAt; - -/** - * Constructs new long bits from the specified 8 characters long hash. - * @param {string} hash Hash - * @returns {util.LongBits} Bits - */ -LongBits.fromHash = function fromHash(hash) { - if (hash === zeroHash) - return zero; - return new LongBits( - ( charCodeAt.call(hash, 0) - | charCodeAt.call(hash, 1) << 8 - | charCodeAt.call(hash, 2) << 16 - | charCodeAt.call(hash, 3) << 24) >>> 0 - , - ( charCodeAt.call(hash, 4) - | charCodeAt.call(hash, 5) << 8 - | charCodeAt.call(hash, 6) << 16 - | charCodeAt.call(hash, 7) << 24) >>> 0 - ); -}; - -/** - * Converts this long bits to a 8 characters long hash. - * @returns {string} Hash - */ -LongBits.prototype.toHash = function toHash() { - return String.fromCharCode( - this.lo & 255, - this.lo >>> 8 & 255, - this.lo >>> 16 & 255, - this.lo >>> 24 , - this.hi & 255, - this.hi >>> 8 & 255, - this.hi >>> 16 & 255, - this.hi >>> 24 - ); -}; - -/** - * Zig-zag encodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzEncode = function zzEncode() { - var mask = this.hi >> 31; - this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; - this.lo = ( this.lo << 1 ^ mask) >>> 0; - return this; -}; - -/** - * Zig-zag decodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzDecode = function zzDecode() { - var mask = -(this.lo & 1); - this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; - this.hi = ( this.hi >>> 1 ^ mask) >>> 0; - return this; -}; - -/** - * Calculates the length of this longbits when encoded as a varint. - * @returns {number} Length - */ -LongBits.prototype.length = function length() { - var part0 = this.lo, - part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, - part2 = this.hi >>> 24; - return part2 === 0 - ? part1 === 0 - ? part0 < 16384 - ? part0 < 128 ? 1 : 2 - : part0 < 2097152 ? 3 : 4 - : part1 < 16384 - ? part1 < 128 ? 5 : 6 - : part1 < 2097152 ? 7 : 8 - : part2 < 128 ? 9 : 10; -}; - -},{"39":39}],39:[function(require,module,exports){ -"use strict"; -var util = exports; - -// used to return a Promise where callback is omitted -util.asPromise = require(1); - -// converts to / from base64 encoded strings -util.base64 = require(2); - -// base class of rpc.Service -util.EventEmitter = require(4); - -// float handling accross browsers -util.float = require(6); - -// requires modules optionally and hides the call from bundlers -util.inquire = require(7); - -// converts to / from utf8 encoded strings -util.utf8 = require(10); - -// provides a node-like buffer pool in the browser -util.pool = require(9); - -// utility to work with the low and high bits of a 64 bit value -util.LongBits = require(38); - -/** - * Whether running within node or not. - * @memberof util - * @type {boolean} - */ -util.isNode = Boolean(typeof global !== "undefined" - && global - && global.process - && global.process.versions - && global.process.versions.node); - -/** - * Global object reference. - * @memberof util - * @type {Object} - */ -util.global = util.isNode && global - || typeof window !== "undefined" && window - || typeof self !== "undefined" && self - || this; // eslint-disable-line no-invalid-this - -/** - * An immuable empty array. - * @memberof util - * @type {Array.<*>} - * @const - */ -util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes - -/** - * An immutable empty object. - * @type {Object} - * @const - */ -util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes - -/** - * Tests if the specified value is an integer. - * @function - * @param {*} value Value to test - * @returns {boolean} `true` if the value is an integer - */ -util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { - return typeof value === "number" && isFinite(value) && Math.floor(value) === value; -}; - -/** - * Tests if the specified value is a string. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a string - */ -util.isString = function isString(value) { - return typeof value === "string" || value instanceof String; -}; - -/** - * Tests if the specified value is a non-null object. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a non-null object - */ -util.isObject = function isObject(value) { - return value && typeof value === "object"; -}; - -/** - * Checks if a property on a message is considered to be present. - * This is an alias of {@link util.isSet}. - * @function - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isset = - -/** - * Checks if a property on a message is considered to be present. - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isSet = function isSet(obj, prop) { - var value = obj[prop]; - if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins - return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; - return false; -}; - -/** - * Any compatible Buffer instance. - * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. - * @interface Buffer - * @extends Uint8Array - */ - -/** - * Node's Buffer class if available. - * @type {Constructor} - */ -util.Buffer = (function() { - try { - var Buffer = util.inquire("buffer").Buffer; - // refuse to use non-node buffers if not explicitly assigned (perf reasons): - return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; - } catch (e) { - /* istanbul ignore next */ - return null; - } -})(); - -// Internal alias of or polyfull for Buffer.from. -util._Buffer_from = null; - -// Internal alias of or polyfill for Buffer.allocUnsafe. -util._Buffer_allocUnsafe = null; - -/** - * Creates a new buffer of whatever type supported by the environment. - * @param {number|number[]} [sizeOrArray=0] Buffer size or number array - * @returns {Uint8Array|Buffer} Buffer - */ -util.newBuffer = function newBuffer(sizeOrArray) { - /* istanbul ignore next */ - return typeof sizeOrArray === "number" - ? util.Buffer - ? util._Buffer_allocUnsafe(sizeOrArray) - : new util.Array(sizeOrArray) - : util.Buffer - ? util._Buffer_from(sizeOrArray) - : typeof Uint8Array === "undefined" - ? sizeOrArray - : new Uint8Array(sizeOrArray); -}; - -/** - * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. - * @type {Constructor} - */ -util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; - -/** - * Any compatible Long instance. - * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. - * @interface Long - * @property {number} low Low bits - * @property {number} high High bits - * @property {boolean} unsigned Whether unsigned or not - */ - -/** - * Long.js's Long class if available. - * @type {Constructor} - */ -util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long - || /* istanbul ignore next */ util.global.Long - || util.inquire("long"); - -/** - * Regular expression used to verify 2 bit (`bool`) map keys. - * @type {RegExp} - * @const - */ -util.key2Re = /^true|false|0|1$/; - -/** - * Regular expression used to verify 32 bit (`int32` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; - -/** - * Regular expression used to verify 64 bit (`int64` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; - -/** - * Converts a number or long to an 8 characters long hash string. - * @param {Long|number} value Value to convert - * @returns {string} Hash - */ -util.longToHash = function longToHash(value) { - return value - ? util.LongBits.from(value).toHash() - : util.LongBits.zeroHash; -}; - -/** - * Converts an 8 characters long hash string to a long or number. - * @param {string} hash Hash - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long|number} Original value - */ -util.longFromHash = function longFromHash(hash, unsigned) { - var bits = util.LongBits.fromHash(hash); - if (util.Long) - return util.Long.fromBits(bits.lo, bits.hi, unsigned); - return bits.toNumber(Boolean(unsigned)); -}; - -/** - * Merges the properties of the source object into the destination object. - * @memberof util - * @param {Object.} dst Destination object - * @param {Object.} src Source object - * @param {boolean} [ifNotSet=false] Merges only if the key is not already set - * @returns {Object.} Destination object - */ -function merge(dst, src, ifNotSet) { // used by converters - for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) - if (dst[keys[i]] === undefined || !ifNotSet) - dst[keys[i]] = src[keys[i]]; - return dst; -} - -util.merge = merge; - -/** - * Converts the first character of a string to lower case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.lcFirst = function lcFirst(str) { - return str.charAt(0).toLowerCase() + str.substring(1); -}; - -/** - * Creates a custom error constructor. - * @memberof util - * @param {string} name Error name - * @returns {Constructor} Custom error constructor - */ -function newError(name) { - - function CustomError(message, properties) { - - if (!(this instanceof CustomError)) - return new CustomError(message, properties); - - // Error.call(this, message); - // ^ just returns a new error instance because the ctor can be called as a function - - Object.defineProperty(this, "message", { get: function() { return message; } }); - - /* istanbul ignore next */ - if (Error.captureStackTrace) // node - Error.captureStackTrace(this, CustomError); - else - Object.defineProperty(this, "stack", { value: new Error().stack || "" }); - - if (properties) - merge(this, properties); - } - - (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; - - Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); - - CustomError.prototype.toString = function toString() { - return this.name + ": " + this.message; - }; - - return CustomError; -} - -util.newError = newError; - -/** - * Constructs a new protocol error. - * @classdesc Error subclass indicating a protocol specifc error. - * @memberof util - * @extends Error - * @template T extends Message - * @constructor - * @param {string} message Error message - * @param {Object.} [properties] Additional properties - * @example - * try { - * MyMessage.decode(someBuffer); // throws if required fields are missing - * } catch (e) { - * if (e instanceof ProtocolError && e.instance) - * console.log("decoded so far: " + JSON.stringify(e.instance)); - * } - */ -util.ProtocolError = newError("ProtocolError"); - -/** - * So far decoded message instance. - * @name util.ProtocolError#instance - * @type {Message} - */ - -/** - * A OneOf getter as returned by {@link util.oneOfGetter}. - * @typedef OneOfGetter - * @type {function} - * @returns {string|undefined} Set field name, if any - */ - -/** - * Builds a getter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfGetter} Unbound getter - */ -util.oneOfGetter = function getOneOf(fieldNames) { - var fieldMap = {}; - for (var i = 0; i < fieldNames.length; ++i) - fieldMap[fieldNames[i]] = 1; - - /** - * @returns {string|undefined} Set field name, if any - * @this Object - * @ignore - */ - return function() { // eslint-disable-line consistent-return - for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) - if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) - return keys[i]; - }; -}; - -/** - * A OneOf setter as returned by {@link util.oneOfSetter}. - * @typedef OneOfSetter - * @type {function} - * @param {string|undefined} value Field name - * @returns {undefined} - */ - -/** - * Builds a setter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfSetter} Unbound setter - */ -util.oneOfSetter = function setOneOf(fieldNames) { - - /** - * @param {string} name Field name - * @returns {undefined} - * @this Object - * @ignore - */ - return function(name) { - for (var i = 0; i < fieldNames.length; ++i) - if (fieldNames[i] !== name) - delete this[fieldNames[i]]; - }; -}; - -/** - * Default conversion options used for {@link Message#toJSON} implementations. - * - * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: - * - * - Longs become strings - * - Enums become string keys - * - Bytes become base64 encoded strings - * - (Sub-)Messages become plain objects - * - Maps become plain objects with all string keys - * - Repeated fields become arrays - * - NaN and Infinity for float and double fields become strings - * - * @type {IConversionOptions} - * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json - */ -util.toJSONOptions = { - longs: String, - enums: String, - bytes: String, - json: true -}; - -// Sets up buffer utility according to the environment (called in index-minimal) -util._configure = function() { - var Buffer = util.Buffer; - /* istanbul ignore if */ - if (!Buffer) { - util._Buffer_from = util._Buffer_allocUnsafe = null; - return; - } - // because node 4.x buffers are incompatible & immutable - // see: https://github.com/dcodeIO/protobuf.js/pull/665 - util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || - /* istanbul ignore next */ - function Buffer_from(value, encoding) { - return new Buffer(value, encoding); - }; - util._Buffer_allocUnsafe = Buffer.allocUnsafe || - /* istanbul ignore next */ - function Buffer_allocUnsafe(size) { - return new Buffer(size); - }; -}; - -},{"1":1,"10":10,"2":2,"38":38,"4":4,"6":6,"7":7,"9":9}],40:[function(require,module,exports){ -"use strict"; -module.exports = verifier; - -var Enum = require(15), - util = require(37); - -function invalid(field, expected) { - return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected"; -} - -/** - * Generates a partial value verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyValue(gen, field, fieldIndex, ref) { - /* eslint-disable no-unexpected-multiline */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(%s){", ref) - ("default:") - ("return%j", invalid(field, "enum value")); - for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen - ("case %i:", field.resolvedType.values[keys[j]]); - gen - ("break") - ("}"); - } else { - gen - ("{") - ("var e=types[%i].verify(%s);", fieldIndex, ref) - ("if(e)") - ("return%j+e", field.name + ".") - ("}"); - } - } else { - switch (field.type) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.isInteger(%s))", ref) - ("return%j", invalid(field, "integer")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", ref, ref, ref, ref) - ("return%j", invalid(field, "integer|Long")); - break; - case "float": - case "double": gen - ("if(typeof %s!==\"number\")", ref) - ("return%j", invalid(field, "number")); - break; - case "bool": gen - ("if(typeof %s!==\"boolean\")", ref) - ("return%j", invalid(field, "boolean")); - break; - case "string": gen - ("if(!util.isString(%s))", ref) - ("return%j", invalid(field, "string")); - break; - case "bytes": gen - ("if(!(%s&&typeof %s.length===\"number\"||util.isString(%s)))", ref, ref, ref) - ("return%j", invalid(field, "buffer")); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a partial key verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyKey(gen, field, ref) { - /* eslint-disable no-unexpected-multiline */ - switch (field.keyType) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.key32Re.test(%s))", ref) - ("return%j", invalid(field, "integer key")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.key64Re.test(%s))", ref) // see comment above: x is ok, d is not - ("return%j", invalid(field, "integer|Long key")); - break; - case "bool": gen - ("if(!util.key2Re.test(%s))", ref) - ("return%j", invalid(field, "boolean key")); - break; - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a verifier specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function verifier(mtype) { - /* eslint-disable no-unexpected-multiline */ - - var gen = util.codegen(["m"], mtype.name + "$verify") - ("if(typeof m!==\"object\"||m===null)") - ("return%j", "object expected"); - var oneofs = mtype.oneofsArray, - seenFirstField = {}; - if (oneofs.length) gen - ("var p={}"); - - for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - ref = "m" + util.safeProp(field.name); - - if (field.optional) gen - ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null - - // map fields - if (field.map) { gen - ("if(!util.isObject(%s))", ref) - ("return%j", invalid(field, "object")) - ("var k=Object.keys(%s)", ref) - ("for(var i=0;i} - * @const - */ -var wrappers = exports; - -var Message = require(21); - -/** - * From object converter part of an {@link IWrapper}. - * @typedef WrapperFromObjectConverter - * @type {function} - * @param {Object.} object Plain object - * @returns {Message<{}>} Message instance - * @this Type - */ - -/** - * To object converter part of an {@link IWrapper}. - * @typedef WrapperToObjectConverter - * @type {function} - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @this Type - */ - -/** - * Common type wrapper part of {@link wrappers}. - * @interface IWrapper - * @property {WrapperFromObjectConverter} [fromObject] From object converter - * @property {WrapperToObjectConverter} [toObject] To object converter - */ - -// Custom wrapper for Any -wrappers[".google.protobuf.Any"] = { - - fromObject: function(object) { - - // unwrap value type if mapped - if (object && object["@type"]) { - // Only use fully qualified type name after the last '/' - var name = object["@type"].substring(object["@type"].lastIndexOf("/") + 1); - var type = this.lookup(name); - /* istanbul ignore else */ - if (type) { - // type_url does not accept leading "." - var type_url = object["@type"].charAt(0) === "." ? - object["@type"].substr(1) : object["@type"]; - // type_url prefix is optional, but path seperator is required - if (type_url.indexOf("/") === -1) { - type_url = "/" + type_url; - } - return this.create({ - type_url: type_url, - value: type.encode(type.fromObject(object)).finish() - }); - } - } - - return this.fromObject(object); - }, - - toObject: function(message, options) { - - // Default prefix - var googleApi = "type.googleapis.com/"; - var prefix = ""; - var name = ""; - - // decode value if requested and unmapped - if (options && options.json && message.type_url && message.value) { - // Only use fully qualified type name after the last '/' - name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1); - // Separate the prefix used - prefix = message.type_url.substring(0, message.type_url.lastIndexOf("/") + 1); - var type = this.lookup(name); - /* istanbul ignore else */ - if (type) - message = type.decode(message.value); - } - - // wrap value if unmapped - if (!(message instanceof this.ctor) && message instanceof Message) { - var object = message.$type.toObject(message, options); - var messageName = message.$type.fullName[0] === "." ? - message.$type.fullName.substr(1) : message.$type.fullName; - // Default to type.googleapis.com prefix if no prefix is used - if (prefix === "") { - prefix = googleApi; - } - name = prefix + messageName; - object["@type"] = name; - return object; - } - - return this.toObject(message, options); - } -}; - -},{"21":21}],42:[function(require,module,exports){ -"use strict"; -module.exports = Writer; - -var util = require(39); - -var BufferWriter; // cyclic - -var LongBits = util.LongBits, - base64 = util.base64, - utf8 = util.utf8; - -/** - * Constructs a new writer operation instance. - * @classdesc Scheduled writer operation. - * @constructor - * @param {function(*, Uint8Array, number)} fn Function to call - * @param {number} len Value byte length - * @param {*} val Value to write - * @ignore - */ -function Op(fn, len, val) { - - /** - * Function to call. - * @type {function(Uint8Array, number, *)} - */ - this.fn = fn; - - /** - * Value byte length. - * @type {number} - */ - this.len = len; - - /** - * Next operation. - * @type {Writer.Op|undefined} - */ - this.next = undefined; - - /** - * Value to write. - * @type {*} - */ - this.val = val; // type varies -} - -/* istanbul ignore next */ -function noop() {} // eslint-disable-line no-empty-function - -/** - * Constructs a new writer state instance. - * @classdesc Copied writer state. - * @memberof Writer - * @constructor - * @param {Writer} writer Writer to copy state from - * @ignore - */ -function State(writer) { - - /** - * Current head. - * @type {Writer.Op} - */ - this.head = writer.head; - - /** - * Current tail. - * @type {Writer.Op} - */ - this.tail = writer.tail; - - /** - * Current buffer length. - * @type {number} - */ - this.len = writer.len; - - /** - * Next state. - * @type {State|null} - */ - this.next = writer.states; -} - -/** - * Constructs a new writer instance. - * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. - * @constructor - */ -function Writer() { - - /** - * Current length. - * @type {number} - */ - this.len = 0; - - /** - * Operations head. - * @type {Object} - */ - this.head = new Op(noop, 0, 0); - - /** - * Operations tail - * @type {Object} - */ - this.tail = this.head; - - /** - * Linked forked states. - * @type {Object|null} - */ - this.states = null; - - // When a value is written, the writer calculates its byte length and puts it into a linked - // list of operations to perform when finish() is called. This both allows us to allocate - // buffers of the exact required size and reduces the amount of work we have to do compared - // to first calculating over objects and then encoding over objects. In our case, the encoding - // part is just a linked list walk calling operations with already prepared values. -} - -var create = function create() { - return util.Buffer - ? function create_buffer_setup() { - return (Writer.create = function create_buffer() { - return new BufferWriter(); - })(); - } - /* istanbul ignore next */ - : function create_array() { - return new Writer(); - }; -}; - -/** - * Creates a new writer. - * @function - * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} - */ -Writer.create = create(); - -/** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ -Writer.alloc = function alloc(size) { - return new util.Array(size); -}; - -// Use Uint8Array buffer pool in the browser, just like node does with buffers -/* istanbul ignore else */ -if (util.Array !== Array) - Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); - -/** - * Pushes a new operation to the queue. - * @param {function(Uint8Array, number, *)} fn Function to call - * @param {number} len Value byte length - * @param {number} val Value to write - * @returns {Writer} `this` - * @private - */ -Writer.prototype._push = function push(fn, len, val) { - this.tail = this.tail.next = new Op(fn, len, val); - this.len += len; - return this; -}; - -function writeByte(val, buf, pos) { - buf[pos] = val & 255; -} - -function writeVarint32(val, buf, pos) { - while (val > 127) { - buf[pos++] = val & 127 | 128; - val >>>= 7; - } - buf[pos] = val; -} - -/** - * Constructs a new varint writer operation instance. - * @classdesc Scheduled varint writer operation. - * @extends Op - * @constructor - * @param {number} len Value byte length - * @param {number} val Value to write - * @ignore - */ -function VarintOp(len, val) { - this.len = len; - this.next = undefined; - this.val = val; -} - -VarintOp.prototype = Object.create(Op.prototype); -VarintOp.prototype.fn = writeVarint32; - -/** - * Writes an unsigned 32 bit value as a varint. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.uint32 = function write_uint32(value) { - // here, the call to this.push has been inlined and a varint specific Op subclass is used. - // uint32 is by far the most frequently used operation and benefits significantly from this. - this.len += (this.tail = this.tail.next = new VarintOp( - (value = value >>> 0) - < 128 ? 1 - : value < 16384 ? 2 - : value < 2097152 ? 3 - : value < 268435456 ? 4 - : 5, - value)).len; - return this; -}; - -/** - * Writes a signed 32 bit value as a varint. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.int32 = function write_int32(value) { - return value < 0 - ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec - : this.uint32(value); -}; - -/** - * Writes a 32 bit value as a varint, zig-zag encoded. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sint32 = function write_sint32(value) { - return this.uint32((value << 1 ^ value >> 31) >>> 0); -}; - -function writeVarint64(val, buf, pos) { - while (val.hi) { - buf[pos++] = val.lo & 127 | 128; - val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; - val.hi >>>= 7; - } - while (val.lo > 127) { - buf[pos++] = val.lo & 127 | 128; - val.lo = val.lo >>> 7; - } - buf[pos++] = val.lo; -} - -/** - * Writes an unsigned 64 bit value as a varint. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.uint64 = function write_uint64(value) { - var bits = LongBits.from(value); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a signed 64 bit value as a varint. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.int64 = Writer.prototype.uint64; - -/** - * Writes a signed 64 bit value as a varint, zig-zag encoded. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sint64 = function write_sint64(value) { - var bits = LongBits.from(value).zzEncode(); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a boolish value as a varint. - * @param {boolean} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.bool = function write_bool(value) { - return this._push(writeByte, 1, value ? 1 : 0); -}; - -function writeFixed32(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -/** - * Writes an unsigned 32 bit value as fixed 32 bits. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.fixed32 = function write_fixed32(value) { - return this._push(writeFixed32, 4, value >>> 0); -}; - -/** - * Writes a signed 32 bit value as fixed 32 bits. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sfixed32 = Writer.prototype.fixed32; - -/** - * Writes an unsigned 64 bit value as fixed 64 bits. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.fixed64 = function write_fixed64(value) { - var bits = LongBits.from(value); - return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); -}; - -/** - * Writes a signed 64 bit value as fixed 64 bits. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sfixed64 = Writer.prototype.fixed64; - -/** - * Writes a float (32 bit). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.float = function write_float(value) { - return this._push(util.float.writeFloatLE, 4, value); -}; - -/** - * Writes a double (64 bit float). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.double = function write_double(value) { - return this._push(util.float.writeDoubleLE, 8, value); -}; - -var writeBytes = util.Array.prototype.set - ? function writeBytes_set(val, buf, pos) { - buf.set(val, pos); // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytes_for(val, buf, pos) { - for (var i = 0; i < val.length; ++i) - buf[pos + i] = val[i]; - }; - -/** - * Writes a sequence of bytes. - * @param {Uint8Array|string} value Buffer or base64 encoded string to write - * @returns {Writer} `this` - */ -Writer.prototype.bytes = function write_bytes(value) { - var len = value.length >>> 0; - if (!len) - return this._push(writeByte, 1, 0); - if (util.isString(value)) { - var buf = Writer.alloc(len = base64.length(value)); - base64.decode(value, buf, 0); - value = buf; - } - return this.uint32(len)._push(writeBytes, len, value); -}; - -/** - * Writes a string. - * @param {string} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.string = function write_string(value) { - var len = utf8.length(value); - return len - ? this.uint32(len)._push(utf8.write, len, value) - : this._push(writeByte, 1, 0); -}; - -/** - * Forks this writer's state by pushing it to a stack. - * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. - * @returns {Writer} `this` - */ -Writer.prototype.fork = function fork() { - this.states = new State(this); - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - return this; -}; - -/** - * Resets this instance to the last state. - * @returns {Writer} `this` - */ -Writer.prototype.reset = function reset() { - if (this.states) { - this.head = this.states.head; - this.tail = this.states.tail; - this.len = this.states.len; - this.states = this.states.next; - } else { - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - } - return this; -}; - -/** - * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. - * @returns {Writer} `this` - */ -Writer.prototype.ldelim = function ldelim() { - var head = this.head, - tail = this.tail, - len = this.len; - this.reset().uint32(len); - if (len) { - this.tail.next = head.next; // skip noop - this.tail = tail; - this.len += len; - } - return this; -}; - -/** - * Finishes the write operation. - * @returns {Uint8Array} Finished buffer - */ -Writer.prototype.finish = function finish() { - var head = this.head.next, // skip noop - buf = this.constructor.alloc(this.len), - pos = 0; - while (head) { - head.fn(head.val, buf, pos); - pos += head.len; - head = head.next; - } - // this.head = this.tail = null; - return buf; -}; - -Writer._configure = function(BufferWriter_) { - BufferWriter = BufferWriter_; - Writer.create = create(); - BufferWriter._configure(); -}; - -},{"39":39}],43:[function(require,module,exports){ -"use strict"; -module.exports = BufferWriter; - -// extends Writer -var Writer = require(42); -(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; - -var util = require(39); - -/** - * Constructs a new buffer writer instance. - * @classdesc Wire format writer using node buffers. - * @extends Writer - * @constructor - */ -function BufferWriter() { - Writer.call(this); -} - -BufferWriter._configure = function () { - /** - * Allocates a buffer of the specified size. - * @function - * @param {number} size Buffer size - * @returns {Buffer} Buffer - */ - BufferWriter.alloc = util._Buffer_allocUnsafe; - - BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" - ? function writeBytesBuffer_set(val, buf, pos) { - buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) - // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytesBuffer_copy(val, buf, pos) { - if (val.copy) // Buffer values - val.copy(buf, pos, 0, val.length); - else for (var i = 0; i < val.length;) // plain array values - buf[pos++] = val[i++]; - }; -}; - - -/** - * @override - */ -BufferWriter.prototype.bytes = function write_bytes_buffer(value) { - if (util.isString(value)) - value = util._Buffer_from(value, "base64"); - var len = value.length >>> 0; - this.uint32(len); - if (len) - this._push(BufferWriter.writeBytesBuffer, len, value); - return this; -}; - -function writeStringBuffer(val, buf, pos) { - if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) - util.utf8.write(val, buf, pos); - else if (buf.utf8Write) - buf.utf8Write(val, pos); - else - buf.write(val, pos); -} - -/** - * @override - */ -BufferWriter.prototype.string = function write_string_buffer(value) { - var len = util.Buffer.byteLength(value); - this.uint32(len); - if (len) - this._push(writeStringBuffer, len, value); - return this; -}; - - -/** - * Finishes the write operation. - * @name BufferWriter#finish - * @function - * @returns {Buffer} Finished buffer - */ - -BufferWriter._configure(); - -},{"39":39,"42":42}]},{},[19]) - -})(); -//# sourceMappingURL=protobuf.js.map diff --git a/node_modules/protobufjs/dist/protobuf.js.map b/node_modules/protobufjs/dist/protobuf.js.map deleted file mode 100644 index b85d9aa0..00000000 --- a/node_modules/protobufjs/dist/protobuf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["lib/prelude.js","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/codegen/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/fetch/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/path/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/@protobufjs/utf8/index.js","../src/common.js","../src/converter.js","../src/decoder.js","../src/encoder.js","../src/enum.js","../src/field.js","../src/index-light.js","../src/index-minimal.js","../src/index","../src/mapfield.js","../src/message.js","../src/method.js","../src/namespace.js","../src/object.js","../src/oneof.js","../src/parse.js","../src/reader.js","../src/reader_buffer.js","../src/root.js","../src/roots.js","../src/rpc.js","../src/rpc/service.js","../src/service.js","../src/tokenize.js","../src/type.js","../src/types.js","../src/util.js","../src/util/longbits.js","../src/util/minimal.js","../src/verifier.js","../src/wrappers.js","../src/writer.js","../src/writer_buffer.js"],"names":[],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/YA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3WA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7kBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACraA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"protobuf.js","sourcesContent":["(function prelude(modules, cache, entries) {\n\n // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS\n // sources through a conflict-free require shim and is again wrapped within an iife that\n // provides a minification-friendly `undefined` var plus a global \"use strict\" directive\n // so that minification can remove the directives of each module.\n\n function $require(name) {\n var $module = cache[name];\n if (!$module)\n modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);\n return $module.exports;\n }\n\n var protobuf = $require(entries[0]);\n\n // Expose globally\n protobuf.util.global.protobuf = protobuf;\n\n // Be nice to AMD\n if (typeof define === \"function\" && define.amd)\n define([\"long\"], function(Long) {\n if (Long && Long.isLong) {\n protobuf.util.Long = Long;\n protobuf.configure();\n }\n return protobuf;\n });\n\n // Be nice to CommonJS\n if (typeof module === \"object\" && module && module.exports)\n module.exports = protobuf;\n\n})/* end of prelude */","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = codegen;\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @param {string[]} functionParams Function parameter names\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n */\r\nfunction codegen(functionParams, functionName) {\r\n\r\n /* istanbul ignore if */\r\n if (typeof functionParams === \"string\") {\r\n functionName = functionParams;\r\n functionParams = undefined;\r\n }\r\n\r\n var body = [];\r\n\r\n /**\r\n * Appends code to the function's body or finishes generation.\r\n * @typedef Codegen\r\n * @type {function}\r\n * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r\n * @param {...*} [formatParams] Format parameters\r\n * @returns {Codegen|Function} Itself or the generated function if finished\r\n * @throws {Error} If format parameter counts do not match\r\n */\r\n\r\n function Codegen(formatStringOrScope) {\r\n // note that explicit array handling below makes this ~50% faster\r\n\r\n // finish the function\r\n if (typeof formatStringOrScope !== \"string\") {\r\n var source = toString();\r\n if (codegen.verbose)\r\n console.log(\"codegen: \" + source); // eslint-disable-line no-console\r\n source = \"return \" + source;\r\n if (formatStringOrScope) {\r\n var scopeKeys = Object.keys(formatStringOrScope),\r\n scopeParams = new Array(scopeKeys.length + 1),\r\n scopeValues = new Array(scopeKeys.length),\r\n scopeOffset = 0;\r\n while (scopeOffset < scopeKeys.length) {\r\n scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r\n scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r\n }\r\n scopeParams[scopeOffset] = source;\r\n return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r\n }\r\n return Function(source)(); // eslint-disable-line no-new-func\r\n }\r\n\r\n // otherwise append to body\r\n var formatParams = new Array(arguments.length - 1),\r\n formatOffset = 0;\r\n while (formatOffset < formatParams.length)\r\n formatParams[formatOffset] = arguments[++formatOffset];\r\n formatOffset = 0;\r\n formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r\n var value = formatParams[formatOffset++];\r\n switch ($1) {\r\n case \"d\": case \"f\": return String(Number(value));\r\n case \"i\": return String(Math.floor(value));\r\n case \"j\": return JSON.stringify(value);\r\n case \"s\": return String(value);\r\n }\r\n return \"%\";\r\n });\r\n if (formatOffset !== formatParams.length)\r\n throw Error(\"parameter count mismatch\");\r\n body.push(formatStringOrScope);\r\n return Codegen;\r\n }\r\n\r\n function toString(functionNameOverride) {\r\n return \"function \" + (functionNameOverride || functionName || \"\") + \"(\" + (functionParams && functionParams.join(\",\") || \"\") + \"){\\n \" + body.join(\"\\n \") + \"\\n}\";\r\n }\r\n\r\n Codegen.toString = toString;\r\n return Codegen;\r\n}\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @function codegen\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * When set to `true`, codegen will log generated code to console. Useful for debugging.\r\n * @name util.codegen.verbose\r\n * @type {boolean}\r\n */\r\ncodegen.verbose = false;\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\nmodule.exports = fetch;\r\n\r\nvar asPromise = require(1),\r\n inquire = require(7);\r\n\r\nvar fs = inquire(\"fs\");\r\n\r\n/**\r\n * Node-style callback as used by {@link util.fetch}.\r\n * @typedef FetchCallback\r\n * @type {function}\r\n * @param {?Error} error Error, if any, otherwise `null`\r\n * @param {string} [contents] File contents, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Options as used by {@link util.fetch}.\r\n * @typedef FetchOptions\r\n * @type {Object}\r\n * @property {boolean} [binary=false] Whether expecting a binary response\r\n * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @memberof util\r\n * @param {string} filename File path or url\r\n * @param {FetchOptions} options Fetch options\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nfunction fetch(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = {};\r\n } else if (!options)\r\n options = {};\r\n\r\n if (!callback)\r\n return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r\n\r\n // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r\n if (!options.xhr && fs && fs.readFile)\r\n return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r\n return err && typeof XMLHttpRequest !== \"undefined\"\r\n ? fetch.xhr(filename, options, callback)\r\n : err\r\n ? callback(err)\r\n : callback(null, options.binary ? contents : contents.toString(\"utf8\"));\r\n });\r\n\r\n // use the XHR version otherwise.\r\n return fetch.xhr(filename, options, callback);\r\n}\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchOptions} [options] Fetch options\r\n * @returns {Promise} Promise\r\n * @variation 3\r\n */\r\n\r\n/**/\r\nfetch.xhr = function fetch_xhr(filename, options, callback) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r\n\r\n if (xhr.readyState !== 4)\r\n return undefined;\r\n\r\n // local cors security errors return status 0 / empty string, too. afaik this cannot be\r\n // reliably distinguished from an actually empty file for security reasons. feel free\r\n // to send a pull request if you are aware of a solution.\r\n if (xhr.status !== 0 && xhr.status !== 200)\r\n return callback(Error(\"status \" + xhr.status));\r\n\r\n // if binary data is expected, make sure that some sort of array is returned, even if\r\n // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r\n if (options.binary) {\r\n var buffer = xhr.response;\r\n if (!buffer) {\r\n buffer = [];\r\n for (var i = 0; i < xhr.responseText.length; ++i)\r\n buffer.push(xhr.responseText.charCodeAt(i) & 255);\r\n }\r\n return callback(null, typeof Uint8Array !== \"undefined\" ? new Uint8Array(buffer) : buffer);\r\n }\r\n return callback(null, xhr.responseText);\r\n };\r\n\r\n if (options.binary) {\r\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r\n if (\"overrideMimeType\" in xhr)\r\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n xhr.open(\"GET\", filename);\r\n xhr.send();\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal path module to resolve Unix, Windows and URL paths alike.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar path = exports;\r\n\r\nvar isAbsolute =\r\n/**\r\n * Tests if the specified path is absolute.\r\n * @param {string} path Path to test\r\n * @returns {boolean} `true` if path is absolute\r\n */\r\npath.isAbsolute = function isAbsolute(path) {\r\n return /^(?:\\/|\\w+:)/.test(path);\r\n};\r\n\r\nvar normalize =\r\n/**\r\n * Normalizes the specified path.\r\n * @param {string} path Path to normalize\r\n * @returns {string} Normalized path\r\n */\r\npath.normalize = function normalize(path) {\r\n path = path.replace(/\\\\/g, \"/\")\r\n .replace(/\\/{2,}/g, \"/\");\r\n var parts = path.split(\"/\"),\r\n absolute = isAbsolute(path),\r\n prefix = \"\";\r\n if (absolute)\r\n prefix = parts.shift() + \"/\";\r\n for (var i = 0; i < parts.length;) {\r\n if (parts[i] === \"..\") {\r\n if (i > 0 && parts[i - 1] !== \"..\")\r\n parts.splice(--i, 2);\r\n else if (absolute)\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n } else if (parts[i] === \".\")\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n return prefix + parts.join(\"/\");\r\n};\r\n\r\n/**\r\n * Resolves the specified include path against the specified origin path.\r\n * @param {string} originPath Path to the origin file\r\n * @param {string} includePath Include path relative to origin path\r\n * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r\n * @returns {string} Path to the include file\r\n */\r\npath.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r\n if (!alreadyNormalized)\r\n includePath = normalize(includePath);\r\n if (isAbsolute(includePath))\r\n return includePath;\r\n if (!alreadyNormalized)\r\n originPath = normalize(originPath);\r\n return (originPath = originPath.replace(/(?:\\/|^)[^/]+$/, \"\")).length ? normalize(originPath + \"/\" + includePath) : includePath;\r\n};\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\nmodule.exports = common;\n\nvar commonRe = /\\/|\\./;\n\n/**\n * Provides common type definitions.\n * Can also be used to provide additional google types or your own custom types.\n * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name\n * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition\n * @returns {undefined}\n * @property {INamespace} google/protobuf/any.proto Any\n * @property {INamespace} google/protobuf/duration.proto Duration\n * @property {INamespace} google/protobuf/empty.proto Empty\n * @property {INamespace} google/protobuf/field_mask.proto FieldMask\n * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue\n * @property {INamespace} google/protobuf/timestamp.proto Timestamp\n * @property {INamespace} google/protobuf/wrappers.proto Wrappers\n * @example\n * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension)\n * protobuf.common(\"descriptor\", descriptorJson);\n *\n * // manually provides a custom definition (uses my.foo namespace)\n * protobuf.common(\"my/foo/bar.proto\", myFooBarJson);\n */\nfunction common(name, json) {\n if (!commonRe.test(name)) {\n name = \"google/protobuf/\" + name + \".proto\";\n json = { nested: { google: { nested: { protobuf: { nested: json } } } } };\n }\n common[name] = json;\n}\n\n// Not provided because of limited use (feel free to discuss or to provide yourself):\n//\n// google/protobuf/descriptor.proto\n// google/protobuf/source_context.proto\n// google/protobuf/type.proto\n//\n// Stripped and pre-parsed versions of these non-bundled files are instead available as part of\n// the repository or package within the google/protobuf directory.\n\ncommon(\"any\", {\n\n /**\n * Properties of a google.protobuf.Any message.\n * @interface IAny\n * @type {Object}\n * @property {string} [typeUrl]\n * @property {Uint8Array} [bytes]\n * @memberof common\n */\n Any: {\n fields: {\n type_url: {\n type: \"string\",\n id: 1\n },\n value: {\n type: \"bytes\",\n id: 2\n }\n }\n }\n});\n\nvar timeType;\n\ncommon(\"duration\", {\n\n /**\n * Properties of a google.protobuf.Duration message.\n * @interface IDuration\n * @type {Object}\n * @property {number|Long} [seconds]\n * @property {number} [nanos]\n * @memberof common\n */\n Duration: timeType = {\n fields: {\n seconds: {\n type: \"int64\",\n id: 1\n },\n nanos: {\n type: \"int32\",\n id: 2\n }\n }\n }\n});\n\ncommon(\"timestamp\", {\n\n /**\n * Properties of a google.protobuf.Timestamp message.\n * @interface ITimestamp\n * @type {Object}\n * @property {number|Long} [seconds]\n * @property {number} [nanos]\n * @memberof common\n */\n Timestamp: timeType\n});\n\ncommon(\"empty\", {\n\n /**\n * Properties of a google.protobuf.Empty message.\n * @interface IEmpty\n * @memberof common\n */\n Empty: {\n fields: {}\n }\n});\n\ncommon(\"struct\", {\n\n /**\n * Properties of a google.protobuf.Struct message.\n * @interface IStruct\n * @type {Object}\n * @property {Object.} [fields]\n * @memberof common\n */\n Struct: {\n fields: {\n fields: {\n keyType: \"string\",\n type: \"Value\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Value message.\n * @interface IValue\n * @type {Object}\n * @property {string} [kind]\n * @property {0} [nullValue]\n * @property {number} [numberValue]\n * @property {string} [stringValue]\n * @property {boolean} [boolValue]\n * @property {IStruct} [structValue]\n * @property {IListValue} [listValue]\n * @memberof common\n */\n Value: {\n oneofs: {\n kind: {\n oneof: [\n \"nullValue\",\n \"numberValue\",\n \"stringValue\",\n \"boolValue\",\n \"structValue\",\n \"listValue\"\n ]\n }\n },\n fields: {\n nullValue: {\n type: \"NullValue\",\n id: 1\n },\n numberValue: {\n type: \"double\",\n id: 2\n },\n stringValue: {\n type: \"string\",\n id: 3\n },\n boolValue: {\n type: \"bool\",\n id: 4\n },\n structValue: {\n type: \"Struct\",\n id: 5\n },\n listValue: {\n type: \"ListValue\",\n id: 6\n }\n }\n },\n\n NullValue: {\n values: {\n NULL_VALUE: 0\n }\n },\n\n /**\n * Properties of a google.protobuf.ListValue message.\n * @interface IListValue\n * @type {Object}\n * @property {Array.} [values]\n * @memberof common\n */\n ListValue: {\n fields: {\n values: {\n rule: \"repeated\",\n type: \"Value\",\n id: 1\n }\n }\n }\n});\n\ncommon(\"wrappers\", {\n\n /**\n * Properties of a google.protobuf.DoubleValue message.\n * @interface IDoubleValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n DoubleValue: {\n fields: {\n value: {\n type: \"double\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.FloatValue message.\n * @interface IFloatValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n FloatValue: {\n fields: {\n value: {\n type: \"float\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Int64Value message.\n * @interface IInt64Value\n * @type {Object}\n * @property {number|Long} [value]\n * @memberof common\n */\n Int64Value: {\n fields: {\n value: {\n type: \"int64\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.UInt64Value message.\n * @interface IUInt64Value\n * @type {Object}\n * @property {number|Long} [value]\n * @memberof common\n */\n UInt64Value: {\n fields: {\n value: {\n type: \"uint64\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Int32Value message.\n * @interface IInt32Value\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n Int32Value: {\n fields: {\n value: {\n type: \"int32\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.UInt32Value message.\n * @interface IUInt32Value\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n UInt32Value: {\n fields: {\n value: {\n type: \"uint32\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.BoolValue message.\n * @interface IBoolValue\n * @type {Object}\n * @property {boolean} [value]\n * @memberof common\n */\n BoolValue: {\n fields: {\n value: {\n type: \"bool\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.StringValue message.\n * @interface IStringValue\n * @type {Object}\n * @property {string} [value]\n * @memberof common\n */\n StringValue: {\n fields: {\n value: {\n type: \"string\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.BytesValue message.\n * @interface IBytesValue\n * @type {Object}\n * @property {Uint8Array} [value]\n * @memberof common\n */\n BytesValue: {\n fields: {\n value: {\n type: \"bytes\",\n id: 1\n }\n }\n }\n});\n\ncommon(\"field_mask\", {\n\n /**\n * Properties of a google.protobuf.FieldMask message.\n * @interface IDoubleValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n FieldMask: {\n fields: {\n paths: {\n rule: \"repeated\",\n type: \"string\",\n id: 1\n }\n }\n }\n});\n\n/**\n * Gets the root definition of the specified common proto file.\n *\n * Bundled definitions are:\n * - google/protobuf/any.proto\n * - google/protobuf/duration.proto\n * - google/protobuf/empty.proto\n * - google/protobuf/field_mask.proto\n * - google/protobuf/struct.proto\n * - google/protobuf/timestamp.proto\n * - google/protobuf/wrappers.proto\n *\n * @param {string} file Proto file name\n * @returns {INamespace|null} Root definition or `null` if not defined\n */\ncommon.get = function get(file) {\n return common[file] || null;\n};\n","\"use strict\";\n/**\n * Runtime message from/to plain object converters.\n * @namespace\n */\nvar converter = exports;\n\nvar Enum = require(15),\n util = require(37);\n\n/**\n * Generates a partial value fromObject conveter.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} prop Property reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genValuePartial_fromObject(gen, field, fieldIndex, prop) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(d%s){\", prop);\n for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {\n if (field.repeated && values[keys[i]] === field.typeDefault) gen\n (\"default:\");\n gen\n (\"case%j:\", keys[i])\n (\"case %i:\", values[keys[i]])\n (\"m%s=%j\", prop, values[keys[i]])\n (\"break\");\n } gen\n (\"}\");\n } else gen\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s=types[%i].fromObject(d%s)\", prop, fieldIndex, prop);\n } else {\n var isUnsigned = false;\n switch (field.type) {\n case \"double\":\n case \"float\": gen\n (\"m%s=Number(d%s)\", prop, prop); // also catches \"NaN\", \"Infinity\"\n break;\n case \"uint32\":\n case \"fixed32\": gen\n (\"m%s=d%s>>>0\", prop, prop);\n break;\n case \"int32\":\n case \"sint32\":\n case \"sfixed32\": gen\n (\"m%s=d%s|0\", prop, prop);\n break;\n case \"uint64\":\n isUnsigned = true;\n // eslint-disable-line no-fallthrough\n case \"int64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(util.Long)\")\n (\"(m%s=util.Long.fromValue(d%s)).unsigned=%j\", prop, prop, isUnsigned)\n (\"else if(typeof d%s===\\\"string\\\")\", prop)\n (\"m%s=parseInt(d%s,10)\", prop, prop)\n (\"else if(typeof d%s===\\\"number\\\")\", prop)\n (\"m%s=d%s\", prop, prop)\n (\"else if(typeof d%s===\\\"object\\\")\", prop)\n (\"m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)\", prop, prop, prop, isUnsigned ? \"true\" : \"\");\n break;\n case \"bytes\": gen\n (\"if(typeof d%s===\\\"string\\\")\", prop)\n (\"util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)\", prop, prop, prop)\n (\"else if(d%s.length)\", prop)\n (\"m%s=d%s\", prop, prop);\n break;\n case \"string\": gen\n (\"m%s=String(d%s)\", prop, prop);\n break;\n case \"bool\": gen\n (\"m%s=Boolean(d%s)\", prop, prop);\n break;\n /* default: gen\n (\"m%s=d%s\", prop, prop);\n break; */\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a plain object to runtime message converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.fromObject = function fromObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray;\n var gen = util.codegen([\"d\"], mtype.name + \"$fromObject\")\n (\"if(d instanceof this.ctor)\")\n (\"return d\");\n if (!fields.length) return gen\n (\"return new this.ctor\");\n gen\n (\"var m=new this.ctor\");\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n prop = util.safeProp(field.name);\n\n // Map fields\n if (field.map) { gen\n (\"if(d%s){\", prop)\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s={}\", prop)\n (\"for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s\", prop, prop, prop, prop, isUnsigned ? \"true\": \"\", prop);\n break;\n case \"bytes\": gen\n (\"d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s\", prop, prop, prop, prop, prop);\n break;\n default: gen\n (\"d%s=m%s\", prop, prop);\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a runtime message to plain object converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.toObject = function toObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);\n if (!fields.length)\n return util.codegen()(\"return {}\");\n var gen = util.codegen([\"m\", \"o\"], mtype.name + \"$toObject\")\n (\"if(!o)\")\n (\"o={}\")\n (\"var d={}\");\n\n var repeatedFields = [],\n mapFields = [],\n normalFields = [],\n i = 0;\n for (; i < fields.length; ++i)\n if (!fields[i].partOf)\n ( fields[i].resolve().repeated ? repeatedFields\n : fields[i].map ? mapFields\n : normalFields).push(fields[i]);\n\n if (repeatedFields.length) { gen\n (\"if(o.arrays||o.defaults){\");\n for (i = 0; i < repeatedFields.length; ++i) gen\n (\"d%s=[]\", util.safeProp(repeatedFields[i].name));\n gen\n (\"}\");\n }\n\n if (mapFields.length) { gen\n (\"if(o.objects||o.defaults){\");\n for (i = 0; i < mapFields.length; ++i) gen\n (\"d%s={}\", util.safeProp(mapFields[i].name));\n gen\n (\"}\");\n }\n\n if (normalFields.length) { gen\n (\"if(o.defaults){\");\n for (i = 0; i < normalFields.length; ++i) {\n var field = normalFields[i],\n prop = util.safeProp(field.name);\n if (field.resolvedType instanceof Enum) gen\n (\"d%s=o.enums===String?%j:%j\", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);\n else if (field.long) gen\n (\"if(util.Long){\")\n (\"var n=new util.Long(%i,%i,%j)\", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)\n (\"d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n\", prop)\n (\"}else\")\n (\"d%s=o.longs===String?%j:%i\", prop, field.typeDefault.toString(), field.typeDefault.toNumber());\n else if (field.bytes) {\n var arrayDefault = \"[\" + Array.prototype.slice.call(field.typeDefault).join(\",\") + \"]\";\n gen\n (\"if(o.bytes===String)d%s=%j\", prop, String.fromCharCode.apply(String, field.typeDefault))\n (\"else{\")\n (\"d%s=%s\", prop, arrayDefault)\n (\"if(o.bytes!==Array)d%s=util.newBuffer(d%s)\", prop, prop)\n (\"}\");\n } else gen\n (\"d%s=%j\", prop, field.typeDefault); // also messages (=null)\n } gen\n (\"}\");\n }\n var hasKs2 = false;\n for (i = 0; i < fields.length; ++i) {\n var field = fields[i],\n index = mtype._fieldsArray.indexOf(field),\n prop = util.safeProp(field.name);\n if (field.map) {\n if (!hasKs2) { hasKs2 = true; gen\n (\"var ks2\");\n } gen\n (\"if(m%s&&(ks2=Object.keys(m%s)).length){\", prop, prop)\n (\"d%s={}\", prop)\n (\"for(var j=0;j>>3){\");\n\n var i = 0;\n for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n ref = \"m\" + util.safeProp(field.name); gen\n (\"case %i:\", field.id);\n\n // Map fields\n if (field.map) { gen\n (\"if(%s===util.emptyObject)\", ref)\n (\"%s={}\", ref)\n (\"var c2 = r.uint32()+r.pos\");\n\n if (types.defaults[field.keyType] !== undefined) gen\n (\"k=%j\", types.defaults[field.keyType]);\n else gen\n (\"k=null\");\n\n if (types.defaults[type] !== undefined) gen\n (\"value=%j\", types.defaults[type]);\n else gen\n (\"value=null\");\n\n gen\n (\"while(r.pos>>3){\")\n (\"case 1: k=r.%s(); break\", field.keyType)\n (\"case 2:\");\n\n if (types.basic[type] === undefined) gen\n (\"value=types[%i].decode(r,r.uint32())\", i); // can't be groups\n else gen\n (\"value=r.%s()\", type);\n\n gen\n (\"break\")\n (\"default:\")\n (\"r.skipType(tag2&7)\")\n (\"break\")\n (\"}\")\n (\"}\");\n\n if (types.long[field.keyType] !== undefined) gen\n (\"%s[typeof k===\\\"object\\\"?util.longToHash(k):k]=value\", ref);\n else gen\n (\"%s[k]=value\", ref);\n\n // Repeated fields\n } else if (field.repeated) { gen\n\n (\"if(!(%s&&%s.length))\", ref, ref)\n (\"%s=[]\", ref);\n\n // Packable (always check for forward and backward compatiblity)\n if (types.packed[type] !== undefined) gen\n (\"if((t&7)===2){\")\n (\"var c2=r.uint32()+r.pos\")\n (\"while(r.pos>> 0, (field.id << 3 | 4) >>> 0)\n : gen(\"types[%i].encode(%s,w.uint32(%i).fork()).ldelim()\", fieldIndex, ref, (field.id << 3 | 2) >>> 0);\n}\n\n/**\n * Generates an encoder specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction encoder(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var gen = util.codegen([\"m\", \"w\"], mtype.name + \"$encode\")\n (\"if(!w)\")\n (\"w=Writer.create()\");\n\n var i, ref;\n\n // \"when a message is serialized its known fields should be written sequentially by field number\"\n var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);\n\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n index = mtype._fieldsArray.indexOf(field),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n wireType = types.basic[type];\n ref = \"m\" + util.safeProp(field.name);\n\n // Map fields\n if (field.map) {\n gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j)){\", ref, field.name) // !== undefined && !== null\n (\"for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType);\n if (wireType === undefined) gen\n (\"types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()\", index, ref); // can't be groups\n else gen\n (\".uint32(%i).%s(%s[ks[i]]).ldelim()\", 16 | wireType, type, ref);\n gen\n (\"}\")\n (\"}\");\n\n // Repeated fields\n } else if (field.repeated) { gen\n (\"if(%s!=null&&%s.length){\", ref, ref); // !== undefined && !== null\n\n // Packed repeated\n if (field.packed && types.packed[type] !== undefined) { gen\n\n (\"w.uint32(%i).fork()\", (field.id << 3 | 2) >>> 0)\n (\"for(var i=0;i<%s.length;++i)\", ref)\n (\"w.%s(%s[i])\", type, ref)\n (\"w.ldelim()\");\n\n // Non-packed\n } else { gen\n\n (\"for(var i=0;i<%s.length;++i)\", ref);\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref + \"[i]\");\n else gen\n (\"w.uint32(%i).%s(%s[i])\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n } gen\n (\"}\");\n\n // Non-repeated\n } else {\n if (field.optional) gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j))\", ref, field.name); // !== undefined && !== null\n\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref);\n else gen\n (\"w.uint32(%i).%s(%s)\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n }\n }\n\n return gen\n (\"return w\");\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n","\"use strict\";\nmodule.exports = Enum;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = \"Enum\";\n\nvar Namespace = require(23),\n util = require(37);\n\n/**\n * Constructs a new enum instance.\n * @classdesc Reflected enum.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {Object.} [values] Enum values as an object, by name\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this enum\n * @param {Object.} [comments] The value comments for this enum\n */\nfunction Enum(name, values, options, comment, comments) {\n ReflectionObject.call(this, name, options);\n\n if (values && typeof values !== \"object\")\n throw TypeError(\"values must be an object\");\n\n /**\n * Enum values by id.\n * @type {Object.}\n */\n this.valuesById = {};\n\n /**\n * Enum values by name.\n * @type {Object.}\n */\n this.values = Object.create(this.valuesById); // toJSON, marker\n\n /**\n * Enum comment text.\n * @type {string|null}\n */\n this.comment = comment;\n\n /**\n * Value comment texts, if any.\n * @type {Object.}\n */\n this.comments = comments || {};\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n // Note that values inherit valuesById on their prototype which makes them a TypeScript-\n // compatible enum. This is used by pbts to write actual enum definitions that work for\n // static and reflection code alike instead of emitting generic object definitions.\n\n if (values)\n for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)\n if (typeof values[keys[i]] === \"number\") // use forward entries only\n this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];\n}\n\n/**\n * Enum descriptor.\n * @interface IEnum\n * @property {Object.} values Enum values\n * @property {Object.} [options] Enum options\n */\n\n/**\n * Constructs an enum from an enum descriptor.\n * @param {string} name Enum name\n * @param {IEnum} json Enum descriptor\n * @returns {Enum} Created enum\n * @throws {TypeError} If arguments are invalid\n */\nEnum.fromJSON = function fromJSON(name, json) {\n var enm = new Enum(name, json.values, json.options, json.comment, json.comments);\n enm.reserved = json.reserved;\n return enm;\n};\n\n/**\n * Converts this enum to an enum descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IEnum} Enum descriptor\n */\nEnum.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"values\" , this.values,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"comment\" , keepComments ? this.comment : undefined,\n \"comments\" , keepComments ? this.comments : undefined\n ]);\n};\n\n/**\n * Adds a value to this enum.\n * @param {string} name Value name\n * @param {number} id Value id\n * @param {string} [comment] Comment, if any\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a value with this name or id\n */\nEnum.prototype.add = function add(name, id, comment) {\n // utilized by the parser but not by .fromJSON\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (!util.isInteger(id))\n throw TypeError(\"id must be an integer\");\n\n if (this.values[name] !== undefined)\n throw Error(\"duplicate name '\" + name + \"' in \" + this);\n\n if (this.isReservedId(id))\n throw Error(\"id \" + id + \" is reserved in \" + this);\n\n if (this.isReservedName(name))\n throw Error(\"name '\" + name + \"' is reserved in \" + this);\n\n if (this.valuesById[id] !== undefined) {\n if (!(this.options && this.options.allow_alias))\n throw Error(\"duplicate id \" + id + \" in \" + this);\n this.values[name] = id;\n } else\n this.valuesById[this.values[name] = id] = name;\n\n this.comments[name] = comment || null;\n return this;\n};\n\n/**\n * Removes a value from this enum\n * @param {string} name Value name\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `name` is not a name of this enum\n */\nEnum.prototype.remove = function remove(name) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n var val = this.values[name];\n if (val == null)\n throw Error(\"name '\" + name + \"' does not exist in \" + this);\n\n delete this.valuesById[val];\n delete this.values[name];\n delete this.comments[name];\n\n return this;\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n","\"use strict\";\nmodule.exports = Field;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = \"Field\";\n\nvar Enum = require(15),\n types = require(36),\n util = require(37);\n\nvar Type; // cyclic\n\nvar ruleRe = /^required|optional|repeated$/;\n\n/**\n * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.\n * @name Field\n * @classdesc Reflected message field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a field from a field descriptor.\n * @param {string} name Field name\n * @param {IField} json Field descriptor\n * @returns {Field} Created field\n * @throws {TypeError} If arguments are invalid\n */\nField.fromJSON = function fromJSON(name, json) {\n return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);\n};\n\n/**\n * Not an actual constructor. Use {@link Field} instead.\n * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports FieldBase\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction Field(name, id, type, rule, extend, options, comment) {\n\n if (util.isObject(rule)) {\n comment = extend;\n options = rule;\n rule = extend = undefined;\n } else if (util.isObject(extend)) {\n comment = options;\n options = extend;\n extend = undefined;\n }\n\n ReflectionObject.call(this, name, options);\n\n if (!util.isInteger(id) || id < 0)\n throw TypeError(\"id must be a non-negative integer\");\n\n if (!util.isString(type))\n throw TypeError(\"type must be a string\");\n\n if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase()))\n throw TypeError(\"rule must be a string rule\");\n\n if (extend !== undefined && !util.isString(extend))\n throw TypeError(\"extend must be a string\");\n\n /**\n * Field rule, if any.\n * @type {string|undefined}\n */\n this.rule = rule && rule !== \"optional\" ? rule : undefined; // toJSON\n\n /**\n * Field type.\n * @type {string}\n */\n this.type = type; // toJSON\n\n /**\n * Unique field id.\n * @type {number}\n */\n this.id = id; // toJSON, marker\n\n /**\n * Extended type if different from parent.\n * @type {string|undefined}\n */\n this.extend = extend || undefined; // toJSON\n\n /**\n * Whether this field is required.\n * @type {boolean}\n */\n this.required = rule === \"required\";\n\n /**\n * Whether this field is optional.\n * @type {boolean}\n */\n this.optional = !this.required;\n\n /**\n * Whether this field is repeated.\n * @type {boolean}\n */\n this.repeated = rule === \"repeated\";\n\n /**\n * Whether this field is a map or not.\n * @type {boolean}\n */\n this.map = false;\n\n /**\n * Message this field belongs to.\n * @type {Type|null}\n */\n this.message = null;\n\n /**\n * OneOf this field belongs to, if any,\n * @type {OneOf|null}\n */\n this.partOf = null;\n\n /**\n * The field type's default value.\n * @type {*}\n */\n this.typeDefault = null;\n\n /**\n * The field's default value on prototypes.\n * @type {*}\n */\n this.defaultValue = null;\n\n /**\n * Whether this field's value should be treated as a long.\n * @type {boolean}\n */\n this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false;\n\n /**\n * Whether this field's value is a buffer.\n * @type {boolean}\n */\n this.bytes = type === \"bytes\";\n\n /**\n * Resolved type if not a basic type.\n * @type {Type|Enum|null}\n */\n this.resolvedType = null;\n\n /**\n * Sister-field within the extended type if a declaring extension field.\n * @type {Field|null}\n */\n this.extensionField = null;\n\n /**\n * Sister-field within the declaring namespace if an extended field.\n * @type {Field|null}\n */\n this.declaringField = null;\n\n /**\n * Internally remembers whether this field is packed.\n * @type {boolean|null}\n * @private\n */\n this._packed = null;\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Determines whether this field is packed. Only relevant when repeated and working with proto2.\n * @name Field#packed\n * @type {boolean}\n * @readonly\n */\nObject.defineProperty(Field.prototype, \"packed\", {\n get: function() {\n // defaults to packed=true if not explicity set to false\n if (this._packed === null)\n this._packed = this.getOption(\"packed\") !== false;\n return this._packed;\n }\n});\n\n/**\n * @override\n */\nField.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (name === \"packed\") // clear cached before setting\n this._packed = null;\n return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);\n};\n\n/**\n * Field descriptor.\n * @interface IField\n * @property {string} [rule=\"optional\"] Field rule\n * @property {string} type Field type\n * @property {number} id Field id\n * @property {Object.} [options] Field options\n */\n\n/**\n * Extension field descriptor.\n * @interface IExtensionField\n * @extends IField\n * @property {string} extend Extended type\n */\n\n/**\n * Converts this field to a field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IField} Field descriptor\n */\nField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"rule\" , this.rule !== \"optional\" && this.rule || undefined,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Resolves this field's type references.\n * @returns {Field} `this`\n * @throws {Error} If any reference cannot be resolved\n */\nField.prototype.resolve = function resolve() {\n\n if (this.resolved)\n return this;\n\n if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it\n this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);\n if (this.resolvedType instanceof Type)\n this.typeDefault = null;\n else // instanceof Enum\n this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined\n }\n\n // use explicitly set default value if present\n if (this.options && this.options[\"default\"] != null) {\n this.typeDefault = this.options[\"default\"];\n if (this.resolvedType instanceof Enum && typeof this.typeDefault === \"string\")\n this.typeDefault = this.resolvedType.values[this.typeDefault];\n }\n\n // remove unnecessary options\n if (this.options) {\n if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))\n delete this.options.packed;\n if (!Object.keys(this.options).length)\n this.options = undefined;\n }\n\n // convert to internal data type if necesssary\n if (this.long) {\n this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === \"u\");\n\n /* istanbul ignore else */\n if (Object.freeze)\n Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it)\n\n } else if (this.bytes && typeof this.typeDefault === \"string\") {\n var buf;\n if (util.base64.test(this.typeDefault))\n util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);\n else\n util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);\n this.typeDefault = buf;\n }\n\n // take special care of maps and repeated fields\n if (this.map)\n this.defaultValue = util.emptyObject;\n else if (this.repeated)\n this.defaultValue = util.emptyArray;\n else\n this.defaultValue = this.typeDefault;\n\n // ensure proper value on prototype\n if (this.parent instanceof Type)\n this.parent.ctor.prototype[this.name] = this.defaultValue;\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n\n/**\n * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).\n * @typedef FieldDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} fieldName Field name\n * @returns {undefined}\n */\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"string\"|\"bool\"|\"bytes\"|Object} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @param {T} [defaultValue] Default value\n * @returns {FieldDecorator} Decorator function\n * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]\n */\nField.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {\n\n // submessage: decorate the submessage and use its name as the type\n if (typeof fieldType === \"function\")\n fieldType = util.decorateType(fieldType).name;\n\n // enum reference: create a reflected copy of the enum and keep reuseing it\n else if (fieldType && typeof fieldType === \"object\")\n fieldType = util.decorateEnum(fieldType).name;\n\n return function fieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new Field(fieldName, fieldId, fieldType, fieldRule, { \"default\": defaultValue }));\n };\n};\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {Constructor|string} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @returns {FieldDecorator} Decorator function\n * @template T extends Message\n * @variation 2\n */\n// like Field.d but without a default value\n\n// Sets up cyclic dependencies (called in index-light)\nField._configure = function configure(Type_) {\n Type = Type_;\n};\n","\"use strict\";\nvar protobuf = module.exports = require(18);\n\nprotobuf.build = \"light\";\n\n/**\n * A node-style callback as used by {@link load} and {@link Root#load}.\n * @typedef LoadCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Root} [root] Root, if there hasn't been an error\n * @returns {undefined}\n */\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} root Root namespace, defaults to create a new one if omitted.\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n */\nfunction load(filename, root, callback) {\n if (typeof root === \"function\") {\n callback = root;\n root = new protobuf.Root();\n } else if (!root)\n root = new protobuf.Root();\n return root.load(filename, callback);\n}\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Promise} Promise\n * @see {@link Root#load}\n * @variation 3\n */\n// function load(filename:string, [root:Root]):Promise\n\nprotobuf.load = load;\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n * @see {@link Root#loadSync}\n */\nfunction loadSync(filename, root) {\n if (!root)\n root = new protobuf.Root();\n return root.loadSync(filename);\n}\n\nprotobuf.loadSync = loadSync;\n\n// Serialization\nprotobuf.encoder = require(14);\nprotobuf.decoder = require(13);\nprotobuf.verifier = require(40);\nprotobuf.converter = require(12);\n\n// Reflection\nprotobuf.ReflectionObject = require(24);\nprotobuf.Namespace = require(23);\nprotobuf.Root = require(29);\nprotobuf.Enum = require(15);\nprotobuf.Type = require(35);\nprotobuf.Field = require(16);\nprotobuf.OneOf = require(25);\nprotobuf.MapField = require(20);\nprotobuf.Service = require(33);\nprotobuf.Method = require(22);\n\n// Runtime\nprotobuf.Message = require(21);\nprotobuf.wrappers = require(41);\n\n// Utility\nprotobuf.types = require(36);\nprotobuf.util = require(37);\n\n// Set up possibly cyclic reflection dependencies\nprotobuf.ReflectionObject._configure(protobuf.Root);\nprotobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);\nprotobuf.Root._configure(protobuf.Type);\nprotobuf.Field._configure(protobuf.Type);\n","\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(42);\nprotobuf.BufferWriter = require(43);\nprotobuf.Reader = require(27);\nprotobuf.BufferReader = require(28);\n\n// Utility\nprotobuf.util = require(39);\nprotobuf.rpc = require(31);\nprotobuf.roots = require(30);\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n","\"use strict\";\nvar protobuf = module.exports = require(17);\n\nprotobuf.build = \"full\";\n\n// Parser\nprotobuf.tokenize = require(34);\nprotobuf.parse = require(26);\nprotobuf.common = require(11);\n\n// Configure parser\nprotobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common);\n","\"use strict\";\nmodule.exports = MapField;\n\n// extends Field\nvar Field = require(16);\n((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = \"MapField\";\n\nvar types = require(36),\n util = require(37);\n\n/**\n * Constructs a new map field instance.\n * @classdesc Reflected map field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} keyType Key type\n * @param {string} type Value type\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction MapField(name, id, keyType, type, options, comment) {\n Field.call(this, name, id, type, undefined, undefined, options, comment);\n\n /* istanbul ignore if */\n if (!util.isString(keyType))\n throw TypeError(\"keyType must be a string\");\n\n /**\n * Key type.\n * @type {string}\n */\n this.keyType = keyType; // toJSON, marker\n\n /**\n * Resolved key type if not a basic type.\n * @type {ReflectionObject|null}\n */\n this.resolvedKeyType = null;\n\n // Overrides Field#map\n this.map = true;\n}\n\n/**\n * Map field descriptor.\n * @interface IMapField\n * @extends {IField}\n * @property {string} keyType Key type\n */\n\n/**\n * Extension map field descriptor.\n * @interface IExtensionMapField\n * @extends IMapField\n * @property {string} extend Extended type\n */\n\n/**\n * Constructs a map field from a map field descriptor.\n * @param {string} name Field name\n * @param {IMapField} json Map field descriptor\n * @returns {MapField} Created map field\n * @throws {TypeError} If arguments are invalid\n */\nMapField.fromJSON = function fromJSON(name, json) {\n return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);\n};\n\n/**\n * Converts this map field to a map field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMapField} Map field descriptor\n */\nMapField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"keyType\" , this.keyType,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMapField.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n\n // Besides a value type, map fields have a key type that may be \"any scalar type except for floating point types and bytes\"\n if (types.mapKey[this.keyType] === undefined)\n throw Error(\"invalid key type: \" + this.keyType);\n\n return Field.prototype.resolve.call(this);\n};\n\n/**\n * Map field decorator (TypeScript).\n * @name MapField.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"} fieldKeyType Field key type\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"|\"bytes\"|Object|Constructor<{}>} fieldValueType Field value type\n * @returns {FieldDecorator} Decorator function\n * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }\n */\nMapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {\n\n // submessage value: decorate the submessage and use its name as the type\n if (typeof fieldValueType === \"function\")\n fieldValueType = util.decorateType(fieldValueType).name;\n\n // enum reference value: create a reflected copy of the enum and keep reuseing it\n else if (fieldValueType && typeof fieldValueType === \"object\")\n fieldValueType = util.decorateEnum(fieldValueType).name;\n\n return function mapFieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));\n };\n};\n","\"use strict\";\nmodule.exports = Message;\n\nvar util = require(39);\n\n/**\n * Constructs a new message instance.\n * @classdesc Abstract runtime message.\n * @constructor\n * @param {Properties} [properties] Properties to set\n * @template T extends object = object\n */\nfunction Message(properties) {\n // not used internally\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n this[keys[i]] = properties[keys[i]];\n}\n\n/**\n * Reference to the reflected type.\n * @name Message.$type\n * @type {Type}\n * @readonly\n */\n\n/**\n * Reference to the reflected type.\n * @name Message#$type\n * @type {Type}\n * @readonly\n */\n\n/*eslint-disable valid-jsdoc*/\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.create = function create(properties) {\n return this.$type.create(properties);\n};\n\n/**\n * Encodes a message of this type.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encode = function encode(message, writer) {\n return this.$type.encode(message, writer);\n};\n\n/**\n * Encodes a message of this type preceeded by its length as a varint.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encodeDelimited = function encodeDelimited(message, writer) {\n return this.$type.encodeDelimited(message, writer);\n};\n\n/**\n * Decodes a message of this type.\n * @name Message.decode\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decode = function decode(reader) {\n return this.$type.decode(reader);\n};\n\n/**\n * Decodes a message of this type preceeded by its length as a varint.\n * @name Message.decodeDelimited\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decodeDelimited = function decodeDelimited(reader) {\n return this.$type.decodeDelimited(reader);\n};\n\n/**\n * Verifies a message of this type.\n * @name Message.verify\n * @function\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\nMessage.verify = function verify(message) {\n return this.$type.verify(message);\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object\n * @returns {T} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.fromObject = function fromObject(object) {\n return this.$type.fromObject(object);\n};\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {T} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @template T extends Message\n * @this Constructor\n */\nMessage.toObject = function toObject(message, options) {\n return this.$type.toObject(message, options);\n};\n\n/**\n * Converts this message to JSON.\n * @returns {Object.} JSON object\n */\nMessage.prototype.toJSON = function toJSON() {\n return this.$type.toObject(this, util.toJSONOptions);\n};\n\n/*eslint-enable valid-jsdoc*/","\"use strict\";\nmodule.exports = Method;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = \"Method\";\n\nvar util = require(37);\n\n/**\n * Constructs a new service method instance.\n * @classdesc Reflected service method.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Method name\n * @param {string|undefined} type Method type, usually `\"rpc\"`\n * @param {string} requestType Request message type\n * @param {string} responseType Response message type\n * @param {boolean|Object.} [requestStream] Whether the request is streamed\n * @param {boolean|Object.} [responseStream] Whether the response is streamed\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this method\n */\nfunction Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) {\n\n /* istanbul ignore next */\n if (util.isObject(requestStream)) {\n options = requestStream;\n requestStream = responseStream = undefined;\n } else if (util.isObject(responseStream)) {\n options = responseStream;\n responseStream = undefined;\n }\n\n /* istanbul ignore if */\n if (!(type === undefined || util.isString(type)))\n throw TypeError(\"type must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(requestType))\n throw TypeError(\"requestType must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(responseType))\n throw TypeError(\"responseType must be a string\");\n\n ReflectionObject.call(this, name, options);\n\n /**\n * Method type.\n * @type {string}\n */\n this.type = type || \"rpc\"; // toJSON\n\n /**\n * Request type.\n * @type {string}\n */\n this.requestType = requestType; // toJSON, marker\n\n /**\n * Whether requests are streamed or not.\n * @type {boolean|undefined}\n */\n this.requestStream = requestStream ? true : undefined; // toJSON\n\n /**\n * Response type.\n * @type {string}\n */\n this.responseType = responseType; // toJSON\n\n /**\n * Whether responses are streamed or not.\n * @type {boolean|undefined}\n */\n this.responseStream = responseStream ? true : undefined; // toJSON\n\n /**\n * Resolved request type.\n * @type {Type|null}\n */\n this.resolvedRequestType = null;\n\n /**\n * Resolved response type.\n * @type {Type|null}\n */\n this.resolvedResponseType = null;\n\n /**\n * Comment for this method\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Method descriptor.\n * @interface IMethod\n * @property {string} [type=\"rpc\"] Method type\n * @property {string} requestType Request type\n * @property {string} responseType Response type\n * @property {boolean} [requestStream=false] Whether requests are streamed\n * @property {boolean} [responseStream=false] Whether responses are streamed\n * @property {Object.} [options] Method options\n */\n\n/**\n * Constructs a method from a method descriptor.\n * @param {string} name Method name\n * @param {IMethod} json Method descriptor\n * @returns {Method} Created method\n * @throws {TypeError} If arguments are invalid\n */\nMethod.fromJSON = function fromJSON(name, json) {\n return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment);\n};\n\n/**\n * Converts this method to a method descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMethod} Method descriptor\n */\nMethod.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"type\" , this.type !== \"rpc\" && /* istanbul ignore next */ this.type || undefined,\n \"requestType\" , this.requestType,\n \"requestStream\" , this.requestStream,\n \"responseType\" , this.responseType,\n \"responseStream\" , this.responseStream,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMethod.prototype.resolve = function resolve() {\n\n /* istanbul ignore if */\n if (this.resolved)\n return this;\n\n this.resolvedRequestType = this.parent.lookupType(this.requestType);\n this.resolvedResponseType = this.parent.lookupType(this.responseType);\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n","\"use strict\";\nmodule.exports = Namespace;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = \"Namespace\";\n\nvar Field = require(16),\n util = require(37);\n\nvar Type, // cyclic\n Service,\n Enum;\n\n/**\n * Constructs a new namespace instance.\n * @name Namespace\n * @classdesc Reflected namespace.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a namespace from JSON.\n * @memberof Namespace\n * @function\n * @param {string} name Namespace name\n * @param {Object.} json JSON object\n * @returns {Namespace} Created namespace\n * @throws {TypeError} If arguments are invalid\n */\nNamespace.fromJSON = function fromJSON(name, json) {\n return new Namespace(name, json.options).addJSON(json.nested);\n};\n\n/**\n * Converts an array of reflection objects to JSON.\n * @memberof Namespace\n * @param {ReflectionObject[]} array Object array\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {Object.|undefined} JSON object or `undefined` when array is empty\n */\nfunction arrayToJSON(array, toJSONOptions) {\n if (!(array && array.length))\n return undefined;\n var obj = {};\n for (var i = 0; i < array.length; ++i)\n obj[array[i].name] = array[i].toJSON(toJSONOptions);\n return obj;\n}\n\nNamespace.arrayToJSON = arrayToJSON;\n\n/**\n * Tests if the specified id is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedId = function isReservedId(reserved, id) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (typeof reserved[i] !== \"string\" && reserved[i][0] <= id && reserved[i][1] > id)\n return true;\n return false;\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedName = function isReservedName(reserved, name) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (reserved[i] === name)\n return true;\n return false;\n};\n\n/**\n * Not an actual constructor. Use {@link Namespace} instead.\n * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports NamespaceBase\n * @extends ReflectionObject\n * @abstract\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n * @see {@link Namespace}\n */\nfunction Namespace(name, options) {\n ReflectionObject.call(this, name, options);\n\n /**\n * Nested objects by name.\n * @type {Object.|undefined}\n */\n this.nested = undefined; // toJSON\n\n /**\n * Cached nested objects as an array.\n * @type {ReflectionObject[]|null}\n * @private\n */\n this._nestedArray = null;\n}\n\nfunction clearCache(namespace) {\n namespace._nestedArray = null;\n return namespace;\n}\n\n/**\n * Nested objects of this namespace as an array for iteration.\n * @name NamespaceBase#nestedArray\n * @type {ReflectionObject[]}\n * @readonly\n */\nObject.defineProperty(Namespace.prototype, \"nestedArray\", {\n get: function() {\n return this._nestedArray || (this._nestedArray = util.toArray(this.nested));\n }\n});\n\n/**\n * Namespace descriptor.\n * @interface INamespace\n * @property {Object.} [options] Namespace options\n * @property {Object.} [nested] Nested object descriptors\n */\n\n/**\n * Any extension field descriptor.\n * @typedef AnyExtensionField\n * @type {IExtensionField|IExtensionMapField}\n */\n\n/**\n * Any nested object descriptor.\n * @typedef AnyNestedObject\n * @type {IEnum|IType|IService|AnyExtensionField|INamespace}\n */\n// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)\n\n/**\n * Converts this namespace to a namespace descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {INamespace} Namespace descriptor\n */\nNamespace.prototype.toJSON = function toJSON(toJSONOptions) {\n return util.toObject([\n \"options\" , this.options,\n \"nested\" , arrayToJSON(this.nestedArray, toJSONOptions)\n ]);\n};\n\n/**\n * Adds nested objects to this namespace from nested object descriptors.\n * @param {Object.} nestedJson Any nested object descriptors\n * @returns {Namespace} `this`\n */\nNamespace.prototype.addJSON = function addJSON(nestedJson) {\n var ns = this;\n /* istanbul ignore else */\n if (nestedJson) {\n for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {\n nested = nestedJson[names[i]];\n ns.add( // most to least likely\n ( nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : nested.id !== undefined\n ? Field.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n }\n return this;\n};\n\n/**\n * Gets the nested object of the specified name.\n * @param {string} name Nested object name\n * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist\n */\nNamespace.prototype.get = function get(name) {\n return this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Gets the values of the nested {@link Enum|enum} of the specified name.\n * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`.\n * @param {string} name Nested enum name\n * @returns {Object.} Enum values\n * @throws {Error} If there is no such enum\n */\nNamespace.prototype.getEnum = function getEnum(name) {\n if (this.nested && this.nested[name] instanceof Enum)\n return this.nested[name].values;\n throw Error(\"no such enum: \" + name);\n};\n\n/**\n * Adds a nested object to this namespace.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name\n */\nNamespace.prototype.add = function add(object) {\n\n if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))\n throw TypeError(\"object must be a valid nested object\");\n\n if (!this.nested)\n this.nested = {};\n else {\n var prev = this.get(object.name);\n if (prev) {\n if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {\n // replace plain namespace but keep existing nested elements and options\n var nested = prev.nestedArray;\n for (var i = 0; i < nested.length; ++i)\n object.add(nested[i]);\n this.remove(prev);\n if (!this.nested)\n this.nested = {};\n object.setOptions(prev.options, true);\n\n } else\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n }\n }\n this.nested[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n};\n\n/**\n * Removes a nested object from this namespace.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this namespace\n */\nNamespace.prototype.remove = function remove(object) {\n\n if (!(object instanceof ReflectionObject))\n throw TypeError(\"object must be a ReflectionObject\");\n if (object.parent !== this)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.nested[object.name];\n if (!Object.keys(this.nested).length)\n this.nested = undefined;\n\n object.onRemove(this);\n return clearCache(this);\n};\n\n/**\n * Defines additial namespaces within this one if not yet existing.\n * @param {string|string[]} path Path to create\n * @param {*} [json] Nested types to create from JSON\n * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty\n */\nNamespace.prototype.define = function define(path, json) {\n\n if (util.isString(path))\n path = path.split(\".\");\n else if (!Array.isArray(path))\n throw TypeError(\"illegal path\");\n if (path && path.length && path[0] === \"\")\n throw Error(\"path must be relative\");\n\n var ptr = this;\n while (path.length > 0) {\n var part = path.shift();\n if (ptr.nested && ptr.nested[part]) {\n ptr = ptr.nested[part];\n if (!(ptr instanceof Namespace))\n throw Error(\"path conflicts with non-namespace objects\");\n } else\n ptr.add(ptr = new Namespace(part));\n }\n if (json)\n ptr.addJSON(json);\n return ptr;\n};\n\n/**\n * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.\n * @returns {Namespace} `this`\n */\nNamespace.prototype.resolveAll = function resolveAll() {\n var nested = this.nestedArray, i = 0;\n while (i < nested.length)\n if (nested[i] instanceof Namespace)\n nested[i++].resolveAll();\n else\n nested[i++].resolve();\n return this.resolve();\n};\n\n/**\n * Recursively looks up the reflection object matching the specified path in the scope of this namespace.\n * @param {string|string[]} path Path to look up\n * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc.\n * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n */\nNamespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {\n\n /* istanbul ignore next */\n if (typeof filterTypes === \"boolean\") {\n parentAlreadyChecked = filterTypes;\n filterTypes = undefined;\n } else if (filterTypes && !Array.isArray(filterTypes))\n filterTypes = [ filterTypes ];\n\n if (util.isString(path) && path.length) {\n if (path === \".\")\n return this.root;\n path = path.split(\".\");\n } else if (!path.length)\n return this;\n\n // Start at root if path is absolute\n if (path[0] === \"\")\n return this.root.lookup(path.slice(1), filterTypes);\n\n // Test if the first part matches any nested object, and if so, traverse if path contains more\n var found = this.get(path[0]);\n if (found) {\n if (path.length === 1) {\n if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)\n return found;\n } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))\n return found;\n\n // Otherwise try each nested namespace\n } else\n for (var i = 0; i < this.nestedArray.length; ++i)\n if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))\n return found;\n\n // If there hasn't been a match, try again at the parent\n if (this.parent === null || parentAlreadyChecked)\n return null;\n return this.parent.lookup(path, filterTypes);\n};\n\n/**\n * Looks up the reflection object at the specified path, relative to this namespace.\n * @name NamespaceBase#lookup\n * @function\n * @param {string|string[]} path Path to look up\n * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n * @variation 2\n */\n// lookup(path: string, [parentAlreadyChecked: boolean])\n\n/**\n * Looks up the {@link Type|type} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type\n * @throws {Error} If `path` does not point to a type\n */\nNamespace.prototype.lookupType = function lookupType(path) {\n var found = this.lookup(path, [ Type ]);\n if (!found)\n throw Error(\"no such type: \" + path);\n return found;\n};\n\n/**\n * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Enum} Looked up enum\n * @throws {Error} If `path` does not point to an enum\n */\nNamespace.prototype.lookupEnum = function lookupEnum(path) {\n var found = this.lookup(path, [ Enum ]);\n if (!found)\n throw Error(\"no such Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type or enum\n * @throws {Error} If `path` does not point to a type or enum\n */\nNamespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {\n var found = this.lookup(path, [ Type, Enum ]);\n if (!found)\n throw Error(\"no such Type or Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Service|service} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Service} Looked up service\n * @throws {Error} If `path` does not point to a service\n */\nNamespace.prototype.lookupService = function lookupService(path) {\n var found = this.lookup(path, [ Service ]);\n if (!found)\n throw Error(\"no such Service '\" + path + \"' in \" + this);\n return found;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nNamespace._configure = function(Type_, Service_, Enum_) {\n Type = Type_;\n Service = Service_;\n Enum = Enum_;\n};\n","\"use strict\";\nmodule.exports = ReflectionObject;\n\nReflectionObject.className = \"ReflectionObject\";\n\nvar util = require(37);\n\nvar Root; // cyclic\n\n/**\n * Constructs a new reflection object instance.\n * @classdesc Base class of all reflection objects.\n * @constructor\n * @param {string} name Object name\n * @param {Object.} [options] Declared options\n * @abstract\n */\nfunction ReflectionObject(name, options) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (options && !util.isObject(options))\n throw TypeError(\"options must be an object\");\n\n /**\n * Options.\n * @type {Object.|undefined}\n */\n this.options = options; // toJSON\n\n /**\n * Parsed Options.\n * @type {Array.>|undefined}\n */\n this.parsedOptions = null;\n\n /**\n * Unique name within its namespace.\n * @type {string}\n */\n this.name = name;\n\n /**\n * Parent namespace.\n * @type {Namespace|null}\n */\n this.parent = null;\n\n /**\n * Whether already resolved or not.\n * @type {boolean}\n */\n this.resolved = false;\n\n /**\n * Comment text, if any.\n * @type {string|null}\n */\n this.comment = null;\n\n /**\n * Defining file name.\n * @type {string|null}\n */\n this.filename = null;\n}\n\nObject.defineProperties(ReflectionObject.prototype, {\n\n /**\n * Reference to the root namespace.\n * @name ReflectionObject#root\n * @type {Root}\n * @readonly\n */\n root: {\n get: function() {\n var ptr = this;\n while (ptr.parent !== null)\n ptr = ptr.parent;\n return ptr;\n }\n },\n\n /**\n * Full name including leading dot.\n * @name ReflectionObject#fullName\n * @type {string}\n * @readonly\n */\n fullName: {\n get: function() {\n var path = [ this.name ],\n ptr = this.parent;\n while (ptr) {\n path.unshift(ptr.name);\n ptr = ptr.parent;\n }\n return path.join(\".\");\n }\n }\n});\n\n/**\n * Converts this reflection object to its descriptor representation.\n * @returns {Object.} Descriptor\n * @abstract\n */\nReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {\n throw Error(); // not implemented, shouldn't happen\n};\n\n/**\n * Called when this object is added to a parent.\n * @param {ReflectionObject} parent Parent added to\n * @returns {undefined}\n */\nReflectionObject.prototype.onAdd = function onAdd(parent) {\n if (this.parent && this.parent !== parent)\n this.parent.remove(this);\n this.parent = parent;\n this.resolved = false;\n var root = parent.root;\n if (root instanceof Root)\n root._handleAdd(this);\n};\n\n/**\n * Called when this object is removed from a parent.\n * @param {ReflectionObject} parent Parent removed from\n * @returns {undefined}\n */\nReflectionObject.prototype.onRemove = function onRemove(parent) {\n var root = parent.root;\n if (root instanceof Root)\n root._handleRemove(this);\n this.parent = null;\n this.resolved = false;\n};\n\n/**\n * Resolves this objects type references.\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n if (this.root instanceof Root)\n this.resolved = true; // only if part of a root\n return this;\n};\n\n/**\n * Gets an option value.\n * @param {string} name Option name\n * @returns {*} Option value or `undefined` if not set\n */\nReflectionObject.prototype.getOption = function getOption(name) {\n if (this.options)\n return this.options[name];\n return undefined;\n};\n\n/**\n * Sets an option.\n * @param {string} name Option name\n * @param {*} value Option value\n * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (!ifNotSet || !this.options || this.options[name] === undefined)\n (this.options || (this.options = {}))[name] = value;\n return this;\n};\n\n/**\n * Sets a parsed option.\n * @param {string} name parsed Option name\n * @param {*} value Option value\n * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\\empty, will add a new option with that value\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) {\n if (!this.parsedOptions) {\n this.parsedOptions = [];\n }\n var parsedOptions = this.parsedOptions;\n if (propName) {\n // If setting a sub property of an option then try to merge it\n // with an existing option\n var opt = parsedOptions.find(function (opt) {\n return Object.prototype.hasOwnProperty.call(opt, name);\n });\n if (opt) {\n // If we found an existing option - just merge the property value\n var newValue = opt[name];\n util.setProperty(newValue, propName, value);\n } else {\n // otherwise, create a new option, set it's property and add it to the list\n opt = {};\n opt[name] = util.setProperty({}, propName, value);\n parsedOptions.push(opt);\n }\n } else {\n // Always create a new option when setting the value of the option itself\n var newOpt = {};\n newOpt[name] = value;\n parsedOptions.push(newOpt);\n }\n return this;\n};\n\n/**\n * Sets multiple options.\n * @param {Object.} options Options to set\n * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {\n if (options)\n for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)\n this.setOption(keys[i], options[keys[i]], ifNotSet);\n return this;\n};\n\n/**\n * Converts this instance to its string representation.\n * @returns {string} Class name[, space, full name]\n */\nReflectionObject.prototype.toString = function toString() {\n var className = this.constructor.className,\n fullName = this.fullName;\n if (fullName.length)\n return className + \" \" + fullName;\n return className;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nReflectionObject._configure = function(Root_) {\n Root = Root_;\n};\n","\"use strict\";\nmodule.exports = OneOf;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = \"OneOf\";\n\nvar Field = require(16),\n util = require(37);\n\n/**\n * Constructs a new oneof instance.\n * @classdesc Reflected oneof.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Oneof name\n * @param {string[]|Object.} [fieldNames] Field names\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction OneOf(name, fieldNames, options, comment) {\n if (!Array.isArray(fieldNames)) {\n options = fieldNames;\n fieldNames = undefined;\n }\n ReflectionObject.call(this, name, options);\n\n /* istanbul ignore if */\n if (!(fieldNames === undefined || Array.isArray(fieldNames)))\n throw TypeError(\"fieldNames must be an Array\");\n\n /**\n * Field names that belong to this oneof.\n * @type {string[]}\n */\n this.oneof = fieldNames || []; // toJSON, marker\n\n /**\n * Fields that belong to this oneof as an array for iteration.\n * @type {Field[]}\n * @readonly\n */\n this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Oneof descriptor.\n * @interface IOneOf\n * @property {Array.} oneof Oneof field names\n * @property {Object.} [options] Oneof options\n */\n\n/**\n * Constructs a oneof from a oneof descriptor.\n * @param {string} name Oneof name\n * @param {IOneOf} json Oneof descriptor\n * @returns {OneOf} Created oneof\n * @throws {TypeError} If arguments are invalid\n */\nOneOf.fromJSON = function fromJSON(name, json) {\n return new OneOf(name, json.oneof, json.options, json.comment);\n};\n\n/**\n * Converts this oneof to a oneof descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IOneOf} Oneof descriptor\n */\nOneOf.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"oneof\" , this.oneof,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Adds the fields of the specified oneof to the parent if not already done so.\n * @param {OneOf} oneof The oneof\n * @returns {undefined}\n * @inner\n * @ignore\n */\nfunction addFieldsToParent(oneof) {\n if (oneof.parent)\n for (var i = 0; i < oneof.fieldsArray.length; ++i)\n if (!oneof.fieldsArray[i].parent)\n oneof.parent.add(oneof.fieldsArray[i]);\n}\n\n/**\n * Adds a field to this oneof and removes it from its current parent, if any.\n * @param {Field} field Field to add\n * @returns {OneOf} `this`\n */\nOneOf.prototype.add = function add(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n if (field.parent && field.parent !== this.parent)\n field.parent.remove(field);\n this.oneof.push(field.name);\n this.fieldsArray.push(field);\n field.partOf = this; // field.parent remains null\n addFieldsToParent(this);\n return this;\n};\n\n/**\n * Removes a field from this oneof and puts it back to the oneof's parent.\n * @param {Field} field Field to remove\n * @returns {OneOf} `this`\n */\nOneOf.prototype.remove = function remove(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n var index = this.fieldsArray.indexOf(field);\n\n /* istanbul ignore if */\n if (index < 0)\n throw Error(field + \" is not a member of \" + this);\n\n this.fieldsArray.splice(index, 1);\n index = this.oneof.indexOf(field.name);\n\n /* istanbul ignore else */\n if (index > -1) // theoretical\n this.oneof.splice(index, 1);\n\n field.partOf = null;\n return this;\n};\n\n/**\n * @override\n */\nOneOf.prototype.onAdd = function onAdd(parent) {\n ReflectionObject.prototype.onAdd.call(this, parent);\n var self = this;\n // Collect present fields\n for (var i = 0; i < this.oneof.length; ++i) {\n var field = parent.get(this.oneof[i]);\n if (field && !field.partOf) {\n field.partOf = self;\n self.fieldsArray.push(field);\n }\n }\n // Add not yet present fields\n addFieldsToParent(this);\n};\n\n/**\n * @override\n */\nOneOf.prototype.onRemove = function onRemove(parent) {\n for (var i = 0, field; i < this.fieldsArray.length; ++i)\n if ((field = this.fieldsArray[i]).parent)\n field.parent.remove(field);\n ReflectionObject.prototype.onRemove.call(this, parent);\n};\n\n/**\n * Decorator function as returned by {@link OneOf.d} (TypeScript).\n * @typedef OneOfDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} oneofName OneOf name\n * @returns {undefined}\n */\n\n/**\n * OneOf decorator (TypeScript).\n * @function\n * @param {...string} fieldNames Field names\n * @returns {OneOfDecorator} Decorator function\n * @template T extends string\n */\nOneOf.d = function decorateOneOf() {\n var fieldNames = new Array(arguments.length),\n index = 0;\n while (index < arguments.length)\n fieldNames[index] = arguments[index++];\n return function oneOfDecorator(prototype, oneofName) {\n util.decorateType(prototype.constructor)\n .add(new OneOf(oneofName, fieldNames));\n Object.defineProperty(prototype, oneofName, {\n get: util.oneOfGetter(fieldNames),\n set: util.oneOfSetter(fieldNames)\n });\n };\n};\n","\"use strict\";\nmodule.exports = parse;\n\nparse.filename = null;\nparse.defaults = { keepCase: false };\n\nvar tokenize = require(34),\n Root = require(29),\n Type = require(35),\n Field = require(16),\n MapField = require(20),\n OneOf = require(25),\n Enum = require(15),\n Service = require(33),\n Method = require(22),\n types = require(36),\n util = require(37);\n\nvar base10Re = /^[1-9][0-9]*$/,\n base10NegRe = /^-?[1-9][0-9]*$/,\n base16Re = /^0[x][0-9a-fA-F]+$/,\n base16NegRe = /^-?0[x][0-9a-fA-F]+$/,\n base8Re = /^0[0-7]+$/,\n base8NegRe = /^-?0[0-7]+$/,\n numberRe = /^(?![eE])[0-9]*(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,\n nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/,\n typeRefRe = /^(?:\\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,\n fqTypeRefRe = /^(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;\n\n/**\n * Result object returned from {@link parse}.\n * @interface IParserResult\n * @property {string|undefined} package Package name, if declared\n * @property {string[]|undefined} imports Imports, if any\n * @property {string[]|undefined} weakImports Weak imports, if any\n * @property {string|undefined} syntax Syntax, if specified (either `\"proto2\"` or `\"proto3\"`)\n * @property {Root} root Populated root instance\n */\n\n/**\n * Options modifying the behavior of {@link parse}.\n * @interface IParseOptions\n * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case\n * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments.\n * @property {boolean} [preferTrailingComment=false] Use trailing comment when both leading comment and trailing comment exist.\n */\n\n/**\n * Options modifying the behavior of JSON serialization.\n * @interface IToJSONOptions\n * @property {boolean} [keepComments=false] Serializes comments.\n */\n\n/**\n * Parses the given .proto source and returns an object with the parsed contents.\n * @param {string} source Source contents\n * @param {Root} root Root to populate\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {IParserResult} Parser result\n * @property {string} filename=null Currently processing file name for error reporting, if known\n * @property {IParseOptions} defaults Default {@link IParseOptions}\n */\nfunction parse(source, root, options) {\n /* eslint-disable callback-return */\n if (!(root instanceof Root)) {\n options = root;\n root = new Root();\n }\n if (!options)\n options = parse.defaults;\n\n var preferTrailingComment = options.preferTrailingComment || false;\n var tn = tokenize(source, options.alternateCommentMode || false),\n next = tn.next,\n push = tn.push,\n peek = tn.peek,\n skip = tn.skip,\n cmnt = tn.cmnt;\n\n var head = true,\n pkg,\n imports,\n weakImports,\n syntax,\n isProto3 = false;\n\n var ptr = root;\n\n var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase;\n\n /* istanbul ignore next */\n function illegal(token, name, insideTryCatch) {\n var filename = parse.filename;\n if (!insideTryCatch)\n parse.filename = null;\n return Error(\"illegal \" + (name || \"token\") + \" '\" + token + \"' (\" + (filename ? filename + \", \" : \"\") + \"line \" + tn.line + \")\");\n }\n\n function readString() {\n var values = [],\n token;\n do {\n /* istanbul ignore if */\n if ((token = next()) !== \"\\\"\" && token !== \"'\")\n throw illegal(token);\n\n values.push(next());\n skip(token);\n token = peek();\n } while (token === \"\\\"\" || token === \"'\");\n return values.join(\"\");\n }\n\n function readValue(acceptTypeRef) {\n var token = next();\n switch (token) {\n case \"'\":\n case \"\\\"\":\n push(token);\n return readString();\n case \"true\": case \"TRUE\":\n return true;\n case \"false\": case \"FALSE\":\n return false;\n }\n try {\n return parseNumber(token, /* insideTryCatch */ true);\n } catch (e) {\n\n /* istanbul ignore else */\n if (acceptTypeRef && typeRefRe.test(token))\n return token;\n\n /* istanbul ignore next */\n throw illegal(token, \"value\");\n }\n }\n\n function readRanges(target, acceptStrings) {\n var token, start;\n do {\n if (acceptStrings && ((token = peek()) === \"\\\"\" || token === \"'\"))\n target.push(readString());\n else\n target.push([ start = parseId(next()), skip(\"to\", true) ? parseId(next()) : start ]);\n } while (skip(\",\", true));\n skip(\";\");\n }\n\n function parseNumber(token, insideTryCatch) {\n var sign = 1;\n if (token.charAt(0) === \"-\") {\n sign = -1;\n token = token.substring(1);\n }\n switch (token) {\n case \"inf\": case \"INF\": case \"Inf\":\n return sign * Infinity;\n case \"nan\": case \"NAN\": case \"Nan\": case \"NaN\":\n return NaN;\n case \"0\":\n return 0;\n }\n if (base10Re.test(token))\n return sign * parseInt(token, 10);\n if (base16Re.test(token))\n return sign * parseInt(token, 16);\n if (base8Re.test(token))\n return sign * parseInt(token, 8);\n\n /* istanbul ignore else */\n if (numberRe.test(token))\n return sign * parseFloat(token);\n\n /* istanbul ignore next */\n throw illegal(token, \"number\", insideTryCatch);\n }\n\n function parseId(token, acceptNegative) {\n switch (token) {\n case \"max\": case \"MAX\": case \"Max\":\n return 536870911;\n case \"0\":\n return 0;\n }\n\n /* istanbul ignore if */\n if (!acceptNegative && token.charAt(0) === \"-\")\n throw illegal(token, \"id\");\n\n if (base10NegRe.test(token))\n return parseInt(token, 10);\n if (base16NegRe.test(token))\n return parseInt(token, 16);\n\n /* istanbul ignore else */\n if (base8NegRe.test(token))\n return parseInt(token, 8);\n\n /* istanbul ignore next */\n throw illegal(token, \"id\");\n }\n\n function parsePackage() {\n\n /* istanbul ignore if */\n if (pkg !== undefined)\n throw illegal(\"package\");\n\n pkg = next();\n\n /* istanbul ignore if */\n if (!typeRefRe.test(pkg))\n throw illegal(pkg, \"name\");\n\n ptr = ptr.define(pkg);\n skip(\";\");\n }\n\n function parseImport() {\n var token = peek();\n var whichImports;\n switch (token) {\n case \"weak\":\n whichImports = weakImports || (weakImports = []);\n next();\n break;\n case \"public\":\n next();\n // eslint-disable-line no-fallthrough\n default:\n whichImports = imports || (imports = []);\n break;\n }\n token = readString();\n skip(\";\");\n whichImports.push(token);\n }\n\n function parseSyntax() {\n skip(\"=\");\n syntax = readString();\n isProto3 = syntax === \"proto3\";\n\n /* istanbul ignore if */\n if (!isProto3 && syntax !== \"proto2\")\n throw illegal(syntax, \"syntax\");\n\n skip(\";\");\n }\n\n function parseCommon(parent, token) {\n switch (token) {\n\n case \"option\":\n parseOption(parent, token);\n skip(\";\");\n return true;\n\n case \"message\":\n parseType(parent, token);\n return true;\n\n case \"enum\":\n parseEnum(parent, token);\n return true;\n\n case \"service\":\n parseService(parent, token);\n return true;\n\n case \"extend\":\n parseExtension(parent, token);\n return true;\n }\n return false;\n }\n\n function ifBlock(obj, fnIf, fnElse) {\n var trailingLine = tn.line;\n if (obj) {\n if(typeof obj.comment !== \"string\") {\n obj.comment = cmnt(); // try block-type comment\n }\n obj.filename = parse.filename;\n }\n if (skip(\"{\", true)) {\n var token;\n while ((token = next()) !== \"}\")\n fnIf(token);\n skip(\";\", true);\n } else {\n if (fnElse)\n fnElse();\n skip(\";\");\n if (obj && (typeof obj.comment !== \"string\" || preferTrailingComment))\n obj.comment = cmnt(trailingLine) || obj.comment; // try line-type comment\n }\n }\n\n function parseType(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"type name\");\n\n var type = new Type(token);\n ifBlock(type, function parseType_block(token) {\n if (parseCommon(type, token))\n return;\n\n switch (token) {\n\n case \"map\":\n parseMapField(type, token);\n break;\n\n case \"required\":\n case \"optional\":\n case \"repeated\":\n parseField(type, token);\n break;\n\n case \"oneof\":\n parseOneOf(type, token);\n break;\n\n case \"extensions\":\n readRanges(type.extensions || (type.extensions = []));\n break;\n\n case \"reserved\":\n readRanges(type.reserved || (type.reserved = []), true);\n break;\n\n default:\n /* istanbul ignore if */\n if (!isProto3 || !typeRefRe.test(token))\n throw illegal(token);\n\n push(token);\n parseField(type, \"optional\");\n break;\n }\n });\n parent.add(type);\n }\n\n function parseField(parent, rule, extend) {\n var type = next();\n if (type === \"group\") {\n parseGroup(parent, rule);\n return;\n }\n\n /* istanbul ignore if */\n if (!typeRefRe.test(type))\n throw illegal(type, \"type\");\n\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n name = applyCase(name);\n skip(\"=\");\n\n var field = new Field(name, parseId(next()), type, rule, extend);\n ifBlock(field, function parseField_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(field, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseField_line() {\n parseInlineOptions(field);\n });\n parent.add(field);\n\n // JSON defaults to packed=true if not set so we have to set packed=false explicity when\n // parsing proto2 descriptors without the option, where applicable. This must be done for\n // all known packable types and anything that could be an enum (= is not a basic type).\n if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined))\n field.setOption(\"packed\", false, /* ifNotSet */ true);\n }\n\n function parseGroup(parent, rule) {\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n var fieldName = util.lcFirst(name);\n if (name === fieldName)\n name = util.ucFirst(name);\n skip(\"=\");\n var id = parseId(next());\n var type = new Type(name);\n type.group = true;\n var field = new Field(fieldName, id, name, rule);\n field.filename = parse.filename;\n ifBlock(type, function parseGroup_block(token) {\n switch (token) {\n\n case \"option\":\n parseOption(type, token);\n skip(\";\");\n break;\n\n case \"required\":\n case \"optional\":\n case \"repeated\":\n parseField(type, token);\n break;\n\n /* istanbul ignore next */\n default:\n throw illegal(token); // there are no groups with proto3 semantics\n }\n });\n parent.add(type)\n .add(field);\n }\n\n function parseMapField(parent) {\n skip(\"<\");\n var keyType = next();\n\n /* istanbul ignore if */\n if (types.mapKey[keyType] === undefined)\n throw illegal(keyType, \"type\");\n\n skip(\",\");\n var valueType = next();\n\n /* istanbul ignore if */\n if (!typeRefRe.test(valueType))\n throw illegal(valueType, \"type\");\n\n skip(\">\");\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n skip(\"=\");\n var field = new MapField(applyCase(name), parseId(next()), keyType, valueType);\n ifBlock(field, function parseMapField_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(field, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseMapField_line() {\n parseInlineOptions(field);\n });\n parent.add(field);\n }\n\n function parseOneOf(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var oneof = new OneOf(applyCase(token));\n ifBlock(oneof, function parseOneOf_block(token) {\n if (token === \"option\") {\n parseOption(oneof, token);\n skip(\";\");\n } else {\n push(token);\n parseField(oneof, \"optional\");\n }\n });\n parent.add(oneof);\n }\n\n function parseEnum(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var enm = new Enum(token);\n ifBlock(enm, function parseEnum_block(token) {\n switch(token) {\n case \"option\":\n parseOption(enm, token);\n skip(\";\");\n break;\n\n case \"reserved\":\n readRanges(enm.reserved || (enm.reserved = []), true);\n break;\n\n default:\n parseEnumValue(enm, token);\n }\n });\n parent.add(enm);\n }\n\n function parseEnumValue(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token))\n throw illegal(token, \"name\");\n\n skip(\"=\");\n var value = parseId(next(), true),\n dummy = {};\n ifBlock(dummy, function parseEnumValue_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(dummy, token); // skip\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseEnumValue_line() {\n parseInlineOptions(dummy); // skip\n });\n parent.add(token, value, dummy.comment);\n }\n\n function parseOption(parent, token) {\n var isCustom = skip(\"(\", true);\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var name = token;\n var option = name;\n var propName;\n\n if (isCustom) {\n skip(\")\");\n name = \"(\" + name + \")\";\n option = name;\n token = peek();\n if (fqTypeRefRe.test(token)) {\n propName = token.substr(1); //remove '.' before property name\n name += token;\n next();\n }\n }\n skip(\"=\");\n var optionValue = parseOptionValue(parent, name);\n setParsedOption(parent, option, optionValue, propName);\n }\n\n function parseOptionValue(parent, name) {\n if (skip(\"{\", true)) { // { a: \"foo\" b { c: \"bar\" } }\n var result = {};\n while (!skip(\"}\", true)) {\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var value;\n var propName = token;\n if (peek() === \"{\")\n value = parseOptionValue(parent, name + \".\" + token);\n else {\n skip(\":\");\n if (peek() === \"{\")\n value = parseOptionValue(parent, name + \".\" + token);\n else {\n value = readValue(true);\n setOption(parent, name + \".\" + token, value);\n }\n }\n var prevValue = result[propName];\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n result[propName] = value;\n skip(\",\", true);\n }\n return result;\n }\n\n var simpleValue = readValue(true);\n setOption(parent, name, simpleValue);\n return simpleValue;\n // Does not enforce a delimiter to be universal\n }\n\n function setOption(parent, name, value) {\n if (parent.setOption)\n parent.setOption(name, value);\n }\n\n function setParsedOption(parent, name, value, propName) {\n if (parent.setParsedOption)\n parent.setParsedOption(name, value, propName);\n }\n\n function parseInlineOptions(parent) {\n if (skip(\"[\", true)) {\n do {\n parseOption(parent, \"option\");\n } while (skip(\",\", true));\n skip(\"]\");\n }\n return parent;\n }\n\n function parseService(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"service name\");\n\n var service = new Service(token);\n ifBlock(service, function parseService_block(token) {\n if (parseCommon(service, token))\n return;\n\n /* istanbul ignore else */\n if (token === \"rpc\")\n parseMethod(service, token);\n else\n throw illegal(token);\n });\n parent.add(service);\n }\n\n function parseMethod(parent, token) {\n // Get the comment of the preceding line now (if one exists) in case the\n // method is defined across multiple lines.\n var commentText = cmnt();\n\n var type = token;\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var name = token,\n requestType, requestStream,\n responseType, responseStream;\n\n skip(\"(\");\n if (skip(\"stream\", true))\n requestStream = true;\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token);\n\n requestType = token;\n skip(\")\"); skip(\"returns\"); skip(\"(\");\n if (skip(\"stream\", true))\n responseStream = true;\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token);\n\n responseType = token;\n skip(\")\");\n\n var method = new Method(name, type, requestType, responseType, requestStream, responseStream);\n method.comment = commentText;\n ifBlock(method, function parseMethod_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(method, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n });\n parent.add(method);\n }\n\n function parseExtension(parent, token) {\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token, \"reference\");\n\n var reference = token;\n ifBlock(null, function parseExtension_block(token) {\n switch (token) {\n\n case \"required\":\n case \"repeated\":\n case \"optional\":\n parseField(parent, token, reference);\n break;\n\n default:\n /* istanbul ignore if */\n if (!isProto3 || !typeRefRe.test(token))\n throw illegal(token);\n push(token);\n parseField(parent, \"optional\", reference);\n break;\n }\n });\n }\n\n var token;\n while ((token = next()) !== null) {\n switch (token) {\n\n case \"package\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parsePackage();\n break;\n\n case \"import\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parseImport();\n break;\n\n case \"syntax\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parseSyntax();\n break;\n\n case \"option\":\n\n parseOption(ptr, token);\n skip(\";\");\n break;\n\n default:\n\n /* istanbul ignore else */\n if (parseCommon(ptr, token)) {\n head = false;\n continue;\n }\n\n /* istanbul ignore next */\n throw illegal(token);\n }\n }\n\n parse.filename = null;\n return {\n \"package\" : pkg,\n \"imports\" : imports,\n weakImports : weakImports,\n syntax : syntax,\n root : root\n };\n}\n\n/**\n * Parses the given .proto source and returns an object with the parsed contents.\n * @name parse\n * @function\n * @param {string} source Source contents\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {IParserResult} Parser result\n * @property {string} filename=null Currently processing file name for error reporting, if known\n * @property {IParseOptions} defaults Default {@link IParseOptions}\n * @variation 2\n */\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(39);\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(27);\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(39);\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n","\"use strict\";\nmodule.exports = Root;\n\n// extends Namespace\nvar Namespace = require(23);\n((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = \"Root\";\n\nvar Field = require(16),\n Enum = require(15),\n OneOf = require(25),\n util = require(37);\n\nvar Type, // cyclic\n parse, // might be excluded\n common; // \"\n\n/**\n * Constructs a new root namespace instance.\n * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together.\n * @extends NamespaceBase\n * @constructor\n * @param {Object.} [options] Top level options\n */\nfunction Root(options) {\n Namespace.call(this, \"\", options);\n\n /**\n * Deferred extension fields.\n * @type {Field[]}\n */\n this.deferred = [];\n\n /**\n * Resolved file names of loaded files.\n * @type {string[]}\n */\n this.files = [];\n}\n\n/**\n * Loads a namespace descriptor into a root namespace.\n * @param {INamespace} json Nameespace descriptor\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted\n * @returns {Root} Root namespace\n */\nRoot.fromJSON = function fromJSON(json, root) {\n if (!root)\n root = new Root();\n if (json.options)\n root.setOptions(json.options);\n return root.addJSON(json.nested);\n};\n\n/**\n * Resolves the path of an imported file, relative to the importing origin.\n * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories.\n * @function\n * @param {string} origin The file name of the importing file\n * @param {string} target The file name being imported\n * @returns {string|null} Resolved path to `target` or `null` to skip the file\n */\nRoot.prototype.resolvePath = util.path.resolve;\n\n/**\n * Fetch content from file path or url\n * This method exists so you can override it with your own logic.\n * @function\n * @param {string} path File path or url\n * @param {FetchCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.fetch = util.fetch;\n\n// A symbol-like function to safely signal synchronous loading\n/* istanbul ignore next */\nfunction SYNC() {} // eslint-disable-line no-empty-function\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} options Parse options\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.load = function load(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = undefined;\n }\n var self = this;\n if (!callback)\n return util.asPromise(load, self, filename, options);\n\n var sync = callback === SYNC; // undocumented\n\n // Finishes loading by calling the callback (exactly once)\n function finish(err, root) {\n /* istanbul ignore if */\n if (!callback)\n return;\n var cb = callback;\n callback = null;\n if (sync)\n throw err;\n cb(err, root);\n }\n\n // Bundled definition existence checking\n function getBundledFileName(filename) {\n var idx = filename.lastIndexOf(\"google/protobuf/\");\n if (idx > -1) {\n var altname = filename.substring(idx);\n if (altname in common) return altname;\n }\n return null;\n }\n\n // Processes a single file\n function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }\n\n // Fetches a single file\n function fetch(filename, weak) {\n\n // Skip if already loaded / attempted\n if (self.files.indexOf(filename) > -1)\n return;\n self.files.push(filename);\n\n // Shortcut bundled definitions\n if (filename in common) {\n if (sync)\n process(filename, common[filename]);\n else {\n ++queued;\n setTimeout(function() {\n --queued;\n process(filename, common[filename]);\n });\n }\n return;\n }\n\n // Otherwise fetch from disk or network\n if (sync) {\n var source;\n try {\n source = util.fs.readFileSync(filename).toString(\"utf8\");\n } catch (err) {\n if (!weak)\n finish(err);\n return;\n }\n process(filename, source);\n } else {\n ++queued;\n self.fetch(filename, function(err, source) {\n --queued;\n /* istanbul ignore if */\n if (!callback)\n return; // terminated meanwhile\n if (err) {\n /* istanbul ignore else */\n if (!weak)\n finish(err);\n else if (!queued) // can't be covered reliably\n finish(null, self);\n return;\n }\n process(filename, source);\n });\n }\n }\n var queued = 0;\n\n // Assembling the root namespace doesn't require working type\n // references anymore, so we can load everything in parallel\n if (util.isString(filename))\n filename = [ filename ];\n for (var i = 0, resolved; i < filename.length; ++i)\n if (resolved = self.resolvePath(\"\", filename[i]))\n fetch(resolved);\n\n if (sync)\n return self;\n if (!queued)\n finish(null, self);\n return undefined;\n};\n// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Promise} Promise\n * @variation 3\n */\n// function load(filename:string, [options:IParseOptions]):Promise\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).\n * @function Root#loadSync\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n */\nRoot.prototype.loadSync = function loadSync(filename, options) {\n if (!util.isNode)\n throw Error(\"not supported\");\n return this.load(filename, options, SYNC);\n};\n\n/**\n * @override\n */\nRoot.prototype.resolveAll = function resolveAll() {\n if (this.deferred.length)\n throw Error(\"unresolvable extensions: \" + this.deferred.map(function(field) {\n return \"'extend \" + field.extend + \"' in \" + field.parent.fullName;\n }).join(\", \"));\n return Namespace.prototype.resolveAll.call(this);\n};\n\n// only uppercased (and thus conflict-free) children are exposed, see below\nvar exposeRe = /^[A-Z]/;\n\n/**\n * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type.\n * @param {Root} root Root instance\n * @param {Field} field Declaring extension field witin the declaring type\n * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise\n * @inner\n * @ignore\n */\nfunction tryHandleExtension(root, field) {\n var extendedType = field.parent.lookup(field.extend);\n if (extendedType) {\n var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);\n sisterField.declaringField = field;\n field.extensionField = sisterField;\n extendedType.add(sisterField);\n return true;\n }\n return false;\n}\n\n/**\n * Called when any object is added to this root or its sub-namespaces.\n * @param {ReflectionObject} object Object added\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleAdd = function _handleAdd(object) {\n if (object instanceof Field) {\n\n if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField)\n if (!tryHandleExtension(this, object))\n this.deferred.push(object);\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n object.parent[object.name] = object.values; // expose enum values as property of its parent\n\n } else if (!(object instanceof OneOf)) /* everything else is a namespace */ {\n\n if (object instanceof Type) // Try to handle any deferred extensions\n for (var i = 0; i < this.deferred.length;)\n if (tryHandleExtension(this, this.deferred[i]))\n this.deferred.splice(i, 1);\n else\n ++i;\n for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace\n this._handleAdd(object._nestedArray[j]);\n if (exposeRe.test(object.name))\n object.parent[object.name] = object; // expose namespace as property of its parent\n }\n\n // The above also adds uppercased (and thus conflict-free) nested types, services and enums as\n // properties of namespaces just like static code does. This allows using a .d.ts generated for\n // a static module with reflection-based solutions where the condition is met.\n};\n\n/**\n * Called when any object is removed from this root or its sub-namespaces.\n * @param {ReflectionObject} object Object removed\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleRemove = function _handleRemove(object) {\n if (object instanceof Field) {\n\n if (/* an extension field */ object.extend !== undefined) {\n if (/* already handled */ object.extensionField) { // remove its sister field\n object.extensionField.parent.remove(object.extensionField);\n object.extensionField = null;\n } else { // cancel the extension\n var index = this.deferred.indexOf(object);\n /* istanbul ignore else */\n if (index > -1)\n this.deferred.splice(index, 1);\n }\n }\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose enum values\n\n } else if (object instanceof Namespace) {\n\n for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace\n this._handleRemove(object._nestedArray[i]);\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose namespaces\n\n }\n};\n\n// Sets up cyclic dependencies (called in index-light)\nRoot._configure = function(Type_, parse_, common_) {\n Type = Type_;\n parse = parse_;\n common = common_;\n};\n","\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n","\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(32);\n","\"use strict\";\nmodule.exports = Service;\n\nvar util = require(39);\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n","\"use strict\";\nmodule.exports = Service;\n\n// extends Namespace\nvar Namespace = require(23);\n((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = \"Service\";\n\nvar Method = require(22),\n util = require(37),\n rpc = require(31);\n\n/**\n * Constructs a new service instance.\n * @classdesc Reflected service.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Service name\n * @param {Object.} [options] Service options\n * @throws {TypeError} If arguments are invalid\n */\nfunction Service(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Service methods.\n * @type {Object.}\n */\n this.methods = {}; // toJSON, marker\n\n /**\n * Cached methods as an array.\n * @type {Method[]|null}\n * @private\n */\n this._methodsArray = null;\n}\n\n/**\n * Service descriptor.\n * @interface IService\n * @extends INamespace\n * @property {Object.} methods Method descriptors\n */\n\n/**\n * Constructs a service from a service descriptor.\n * @param {string} name Service name\n * @param {IService} json Service descriptor\n * @returns {Service} Created service\n * @throws {TypeError} If arguments are invalid\n */\nService.fromJSON = function fromJSON(name, json) {\n var service = new Service(name, json.options);\n /* istanbul ignore else */\n if (json.methods)\n for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)\n service.add(Method.fromJSON(names[i], json.methods[names[i]]));\n if (json.nested)\n service.addJSON(json.nested);\n service.comment = json.comment;\n return service;\n};\n\n/**\n * Converts this service to a service descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IService} Service descriptor\n */\nService.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"methods\" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {},\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Methods of this service as an array for iteration.\n * @name Service#methodsArray\n * @type {Method[]}\n * @readonly\n */\nObject.defineProperty(Service.prototype, \"methodsArray\", {\n get: function() {\n return this._methodsArray || (this._methodsArray = util.toArray(this.methods));\n }\n});\n\nfunction clearCache(service) {\n service._methodsArray = null;\n return service;\n}\n\n/**\n * @override\n */\nService.prototype.get = function get(name) {\n return this.methods[name]\n || Namespace.prototype.get.call(this, name);\n};\n\n/**\n * @override\n */\nService.prototype.resolveAll = function resolveAll() {\n var methods = this.methodsArray;\n for (var i = 0; i < methods.length; ++i)\n methods[i].resolve();\n return Namespace.prototype.resolve.call(this);\n};\n\n/**\n * @override\n */\nService.prototype.add = function add(object) {\n\n /* istanbul ignore if */\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Method) {\n this.methods[object.name] = object;\n object.parent = this;\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * @override\n */\nService.prototype.remove = function remove(object) {\n if (object instanceof Method) {\n\n /* istanbul ignore if */\n if (this.methods[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.methods[object.name];\n object.parent = null;\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Creates a runtime service using the specified rpc implementation.\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed.\n */\nService.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {\n var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);\n for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {\n var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\\w_]/g, \"\");\n rpcService[methodName] = util.codegen([\"r\",\"c\"], util.isReserved(methodName) ? methodName + \"_\" : methodName)(\"return this.rpcCall(m,q,s,r,c)\")({\n m: method,\n q: method.resolvedRequestType.ctor,\n s: method.resolvedResponseType.ctor\n });\n }\n return rpcService;\n};\n","\"use strict\";\nmodule.exports = tokenize;\n\nvar delimRe = /[\\s{}=;:[\\],'\"()<>]/g,\n stringDoubleRe = /(?:\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\")/g,\n stringSingleRe = /(?:'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)')/g;\n\nvar setCommentRe = /^ *[*/]+ */,\n setCommentAltRe = /^\\s*\\*?\\/*/,\n setCommentSplitRe = /\\n/g,\n whitespaceRe = /\\s/,\n unescapeRe = /\\\\(.?)/g;\n\nvar unescapeMap = {\n \"0\": \"\\0\",\n \"r\": \"\\r\",\n \"n\": \"\\n\",\n \"t\": \"\\t\"\n};\n\n/**\n * Unescapes a string.\n * @param {string} str String to unescape\n * @returns {string} Unescaped string\n * @property {Object.} map Special characters map\n * @memberof tokenize\n */\nfunction unescape(str) {\n return str.replace(unescapeRe, function($0, $1) {\n switch ($1) {\n case \"\\\\\":\n case \"\":\n return $1;\n default:\n return unescapeMap[$1] || \"\";\n }\n });\n}\n\ntokenize.unescape = unescape;\n\n/**\n * Gets the next token and advances.\n * @typedef TokenizerHandleNext\n * @type {function}\n * @returns {string|null} Next token or `null` on eof\n */\n\n/**\n * Peeks for the next token.\n * @typedef TokenizerHandlePeek\n * @type {function}\n * @returns {string|null} Next token or `null` on eof\n */\n\n/**\n * Pushes a token back to the stack.\n * @typedef TokenizerHandlePush\n * @type {function}\n * @param {string} token Token\n * @returns {undefined}\n */\n\n/**\n * Skips the next token.\n * @typedef TokenizerHandleSkip\n * @type {function}\n * @param {string} expected Expected token\n * @param {boolean} [optional=false] If optional\n * @returns {boolean} Whether the token matched\n * @throws {Error} If the token didn't match and is not optional\n */\n\n/**\n * Gets the comment on the previous line or, alternatively, the line comment on the specified line.\n * @typedef TokenizerHandleCmnt\n * @type {function}\n * @param {number} [line] Line number\n * @returns {string|null} Comment text or `null` if none\n */\n\n/**\n * Handle object returned from {@link tokenize}.\n * @interface ITokenizerHandle\n * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof)\n * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof)\n * @property {TokenizerHandlePush} push Pushes a token back to the stack\n * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws\n * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any\n * @property {number} line Current line number\n */\n\n/**\n * Tokenizes the given .proto source and returns an object with useful utility functions.\n * @param {string} source Source contents\n * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode.\n * @returns {ITokenizerHandle} Tokenizer handle\n */\nfunction tokenize(source, alternateCommentMode) {\n /* eslint-disable callback-return */\n source = source.toString();\n\n var offset = 0,\n length = source.length,\n line = 1,\n commentType = null,\n commentText = null,\n commentLine = 0,\n commentLineEmpty = false,\n commentIsLeading = false;\n\n var stack = [];\n\n var stringDelim = null;\n\n /* istanbul ignore next */\n /**\n * Creates an error for illegal syntax.\n * @param {string} subject Subject\n * @returns {Error} Error created\n * @inner\n */\n function illegal(subject) {\n return Error(\"illegal \" + subject + \" (line \" + line + \")\");\n }\n\n /**\n * Reads a string till its end.\n * @returns {string} String read\n * @inner\n */\n function readString() {\n var re = stringDelim === \"'\" ? stringSingleRe : stringDoubleRe;\n re.lastIndex = offset - 1;\n var match = re.exec(source);\n if (!match)\n throw illegal(\"string\");\n offset = re.lastIndex;\n push(stringDelim);\n stringDelim = null;\n return unescape(match[1]);\n }\n\n /**\n * Gets the character at `pos` within the source.\n * @param {number} pos Position\n * @returns {string} Character\n * @inner\n */\n function charAt(pos) {\n return source.charAt(pos);\n }\n\n /**\n * Sets the current comment text.\n * @param {number} start Start offset\n * @param {number} end End offset\n * @param {boolean} isLeading set if a leading comment\n * @returns {undefined}\n * @inner\n */\n function setComment(start, end, isLeading) {\n commentType = source.charAt(start++);\n commentLine = line;\n commentLineEmpty = false;\n commentIsLeading = isLeading;\n var lookback;\n if (alternateCommentMode) {\n lookback = 2; // alternate comment parsing: \"//\" or \"/*\"\n } else {\n lookback = 3; // \"///\" or \"/**\"\n }\n var commentOffset = start - lookback,\n c;\n do {\n if (--commentOffset < 0 ||\n (c = source.charAt(commentOffset)) === \"\\n\") {\n commentLineEmpty = true;\n break;\n }\n } while (c === \" \" || c === \"\\t\");\n var lines = source\n .substring(start, end)\n .split(setCommentSplitRe);\n for (var i = 0; i < lines.length; ++i)\n lines[i] = lines[i]\n .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, \"\")\n .trim();\n commentText = lines\n .join(\"\\n\")\n .trim();\n }\n\n function isDoubleSlashCommentLine(startOffset) {\n var endOffset = findEndOfLine(startOffset);\n\n // see if remaining line matches comment pattern\n var lineText = source.substring(startOffset, endOffset);\n // look for 1 or 2 slashes since startOffset would already point past\n // the first slash that started the comment.\n var isComment = /^\\s*\\/{1,2}/.test(lineText);\n return isComment;\n }\n\n function findEndOfLine(cursor) {\n // find end of cursor's line\n var endOffset = cursor;\n while (endOffset < length && charAt(endOffset) !== \"\\n\") {\n endOffset++;\n }\n return endOffset;\n }\n\n /**\n * Obtains the next token.\n * @returns {string|null} Next token or `null` on eof\n * @inner\n */\n function next() {\n if (stack.length > 0)\n return stack.shift();\n if (stringDelim)\n return readString();\n var repeat,\n prev,\n curr,\n start,\n isDoc,\n isLeadingComment = offset === 0;\n do {\n if (offset === length)\n return null;\n repeat = false;\n while (whitespaceRe.test(curr = charAt(offset))) {\n if (curr === \"\\n\") {\n isLeadingComment = true;\n ++line;\n }\n if (++offset === length)\n return null;\n }\n\n if (charAt(offset) === \"/\") {\n if (++offset === length) {\n throw illegal(\"comment\");\n }\n if (charAt(offset) === \"/\") { // Line\n if (!alternateCommentMode) {\n // check for triple-slash comment\n isDoc = charAt(start = offset + 1) === \"/\";\n\n while (charAt(++offset) !== \"\\n\") {\n if (offset === length) {\n return null;\n }\n }\n ++offset;\n if (isDoc) {\n setComment(start, offset - 1, isLeadingComment);\n }\n ++line;\n repeat = true;\n } else {\n // check for double-slash comments, consolidating consecutive lines\n start = offset;\n isDoc = false;\n if (isDoubleSlashCommentLine(offset)) {\n isDoc = true;\n do {\n offset = findEndOfLine(offset);\n if (offset === length) {\n break;\n }\n offset++;\n } while (isDoubleSlashCommentLine(offset));\n } else {\n offset = Math.min(length, findEndOfLine(offset) + 1);\n }\n if (isDoc) {\n setComment(start, offset, isLeadingComment);\n }\n line++;\n repeat = true;\n }\n } else if ((curr = charAt(offset)) === \"*\") { /* Block */\n // check for /** (regular comment mode) or /* (alternate comment mode)\n start = offset + 1;\n isDoc = alternateCommentMode || charAt(start) === \"*\";\n do {\n if (curr === \"\\n\") {\n ++line;\n }\n if (++offset === length) {\n throw illegal(\"comment\");\n }\n prev = curr;\n curr = charAt(offset);\n } while (prev !== \"*\" || curr !== \"/\");\n ++offset;\n if (isDoc) {\n setComment(start, offset - 2, isLeadingComment);\n }\n repeat = true;\n } else {\n return \"/\";\n }\n }\n } while (repeat);\n\n // offset !== length if we got here\n\n var end = offset;\n delimRe.lastIndex = 0;\n var delim = delimRe.test(charAt(end++));\n if (!delim)\n while (end < length && !delimRe.test(charAt(end)))\n ++end;\n var token = source.substring(offset, offset = end);\n if (token === \"\\\"\" || token === \"'\")\n stringDelim = token;\n return token;\n }\n\n /**\n * Pushes a token back to the stack.\n * @param {string} token Token\n * @returns {undefined}\n * @inner\n */\n function push(token) {\n stack.push(token);\n }\n\n /**\n * Peeks for the next token.\n * @returns {string|null} Token or `null` on eof\n * @inner\n */\n function peek() {\n if (!stack.length) {\n var token = next();\n if (token === null)\n return null;\n push(token);\n }\n return stack[0];\n }\n\n /**\n * Skips a token.\n * @param {string} expected Expected token\n * @param {boolean} [optional=false] Whether the token is optional\n * @returns {boolean} `true` when skipped, `false` if not\n * @throws {Error} When a required token is not present\n * @inner\n */\n function skip(expected, optional) {\n var actual = peek(),\n equals = actual === expected;\n if (equals) {\n next();\n return true;\n }\n if (!optional)\n throw illegal(\"token '\" + actual + \"', '\" + expected + \"' expected\");\n return false;\n }\n\n /**\n * Gets a comment.\n * @param {number} [trailingLine] Line number if looking for a trailing comment\n * @returns {string|null} Comment text\n * @inner\n */\n function cmnt(trailingLine) {\n var ret = null;\n if (trailingLine === undefined) {\n if (commentLine === line - 1 && (alternateCommentMode || commentType === \"*\" || commentLineEmpty)) {\n ret = commentIsLeading ? commentText : null;\n }\n } else {\n /* istanbul ignore else */\n if (commentLine < trailingLine) {\n peek();\n }\n if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === \"/\")) {\n ret = commentIsLeading ? null : commentText;\n }\n }\n return ret;\n }\n\n return Object.defineProperty({\n next: next,\n peek: peek,\n push: push,\n skip: skip,\n cmnt: cmnt\n }, \"line\", {\n get: function() { return line; }\n });\n /* eslint-enable callback-return */\n}\n","\"use strict\";\nmodule.exports = Type;\n\n// extends Namespace\nvar Namespace = require(23);\n((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = \"Type\";\n\nvar Enum = require(15),\n OneOf = require(25),\n Field = require(16),\n MapField = require(20),\n Service = require(33),\n Message = require(21),\n Reader = require(27),\n Writer = require(42),\n util = require(37),\n encoder = require(14),\n decoder = require(13),\n verifier = require(40),\n converter = require(12),\n wrappers = require(41);\n\n/**\n * Constructs a new reflected message type instance.\n * @classdesc Reflected message type.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Message name\n * @param {Object.} [options] Declared options\n */\nfunction Type(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Message fields.\n * @type {Object.}\n */\n this.fields = {}; // toJSON, marker\n\n /**\n * Oneofs declared within this namespace, if any.\n * @type {Object.}\n */\n this.oneofs = undefined; // toJSON\n\n /**\n * Extension ranges, if any.\n * @type {number[][]}\n */\n this.extensions = undefined; // toJSON\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n /*?\n * Whether this type is a legacy group.\n * @type {boolean|undefined}\n */\n this.group = undefined; // toJSON\n\n /**\n * Cached fields by id.\n * @type {Object.|null}\n * @private\n */\n this._fieldsById = null;\n\n /**\n * Cached fields as an array.\n * @type {Field[]|null}\n * @private\n */\n this._fieldsArray = null;\n\n /**\n * Cached oneofs as an array.\n * @type {OneOf[]|null}\n * @private\n */\n this._oneofsArray = null;\n\n /**\n * Cached constructor.\n * @type {Constructor<{}>}\n * @private\n */\n this._ctor = null;\n}\n\nObject.defineProperties(Type.prototype, {\n\n /**\n * Message fields by id.\n * @name Type#fieldsById\n * @type {Object.}\n * @readonly\n */\n fieldsById: {\n get: function() {\n\n /* istanbul ignore if */\n if (this._fieldsById)\n return this._fieldsById;\n\n this._fieldsById = {};\n for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {\n var field = this.fields[names[i]],\n id = field.id;\n\n /* istanbul ignore if */\n if (this._fieldsById[id])\n throw Error(\"duplicate id \" + id + \" in \" + this);\n\n this._fieldsById[id] = field;\n }\n return this._fieldsById;\n }\n },\n\n /**\n * Fields of this message as an array for iteration.\n * @name Type#fieldsArray\n * @type {Field[]}\n * @readonly\n */\n fieldsArray: {\n get: function() {\n return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));\n }\n },\n\n /**\n * Oneofs of this message as an array for iteration.\n * @name Type#oneofsArray\n * @type {OneOf[]}\n * @readonly\n */\n oneofsArray: {\n get: function() {\n return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));\n }\n },\n\n /**\n * The registered constructor, if any registered, otherwise a generic constructor.\n * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.\n * @name Type#ctor\n * @type {Constructor<{}>}\n */\n ctor: {\n get: function() {\n return this._ctor || (this.ctor = Type.generateConstructor(this)());\n },\n set: function(ctor) {\n\n // Ensure proper prototype\n var prototype = ctor.prototype;\n if (!(prototype instanceof Message)) {\n (ctor.prototype = new Message()).constructor = ctor;\n util.merge(ctor.prototype, prototype);\n }\n\n // Classes and messages reference their reflected type\n ctor.$type = ctor.prototype.$type = this;\n\n // Mix in static methods\n util.merge(ctor, Message, true);\n\n this._ctor = ctor;\n\n // Messages have non-enumerable default values on their prototype\n var i = 0;\n for (; i < /* initializes */ this.fieldsArray.length; ++i)\n this._fieldsArray[i].resolve(); // ensures a proper value\n\n // Messages have non-enumerable getters and setters for each virtual oneof field\n var ctorProperties = {};\n for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i)\n ctorProperties[this._oneofsArray[i].resolve().name] = {\n get: util.oneOfGetter(this._oneofsArray[i].oneof),\n set: util.oneOfSetter(this._oneofsArray[i].oneof)\n };\n if (i)\n Object.defineProperties(ctor.prototype, ctorProperties);\n }\n }\n});\n\n/**\n * Generates a constructor function for the specified type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nType.generateConstructor = function generateConstructor(mtype) {\n /* eslint-disable no-unexpected-multiline */\n var gen = util.codegen([\"p\"], mtype.name);\n // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype\n for (var i = 0, field; i < mtype.fieldsArray.length; ++i)\n if ((field = mtype._fieldsArray[i]).map) gen\n (\"this%s={}\", util.safeProp(field.name));\n else if (field.repeated) gen\n (\"this%s=[]\", util.safeProp(field.name));\n return gen\n (\"if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors\n * @property {Object.} fields Field descriptors\n * @property {number[][]} [extensions] Extension ranges\n * @property {number[][]} [reserved] Reserved ranges\n * @property {boolean} [group=false] Whether a legacy group or not\n */\n\n/**\n * Creates a message type from a message type descriptor.\n * @param {string} name Message name\n * @param {IType} json Message type descriptor\n * @returns {Type} Created message type\n */\nType.fromJSON = function fromJSON(name, json) {\n var type = new Type(name, json.options);\n type.extensions = json.extensions;\n type.reserved = json.reserved;\n var names = Object.keys(json.fields),\n i = 0;\n for (; i < names.length; ++i)\n type.add(\n ( typeof json.fields[names[i]].keyType !== \"undefined\"\n ? MapField.fromJSON\n : Field.fromJSON )(names[i], json.fields[names[i]])\n );\n if (json.oneofs)\n for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)\n type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));\n if (json.nested)\n for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {\n var nested = json.nested[names[i]];\n type.add( // most to least likely\n ( nested.id !== undefined\n ? Field.fromJSON\n : nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n if (json.extensions && json.extensions.length)\n type.extensions = json.extensions;\n if (json.reserved && json.reserved.length)\n type.reserved = json.reserved;\n if (json.group)\n type.group = true;\n if (json.comment)\n type.comment = json.comment;\n return type;\n};\n\n/**\n * Converts this message type to a message type descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IType} Message type descriptor\n */\nType.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"oneofs\" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),\n \"fields\" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {},\n \"extensions\" , this.extensions && this.extensions.length ? this.extensions : undefined,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"group\" , this.group || undefined,\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nType.prototype.resolveAll = function resolveAll() {\n var fields = this.fieldsArray, i = 0;\n while (i < fields.length)\n fields[i++].resolve();\n var oneofs = this.oneofsArray; i = 0;\n while (i < oneofs.length)\n oneofs[i++].resolve();\n return Namespace.prototype.resolveAll.call(this);\n};\n\n/**\n * @override\n */\nType.prototype.get = function get(name) {\n return this.fields[name]\n || this.oneofs && this.oneofs[name]\n || this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Adds a nested object to this type.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id\n */\nType.prototype.add = function add(object) {\n\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Field && object.extend === undefined) {\n // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects.\n // The root object takes care of adding distinct sister-fields to the respective extended\n // type instead.\n\n // avoids calling the getter if not absolutely necessary because it's called quite frequently\n if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id])\n throw Error(\"duplicate id \" + object.id + \" in \" + this);\n if (this.isReservedId(object.id))\n throw Error(\"id \" + object.id + \" is reserved in \" + this);\n if (this.isReservedName(object.name))\n throw Error(\"name '\" + object.name + \"' is reserved in \" + this);\n\n if (object.parent)\n object.parent.remove(object);\n this.fields[object.name] = object;\n object.message = this;\n object.onAdd(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n if (!this.oneofs)\n this.oneofs = {};\n this.oneofs[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * Removes a nested object from this type.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this type\n */\nType.prototype.remove = function remove(object) {\n if (object instanceof Field && object.extend === undefined) {\n // See Type#add for the reason why extension fields are excluded here.\n\n /* istanbul ignore if */\n if (!this.fields || this.fields[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.fields[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n\n /* istanbul ignore if */\n if (!this.oneofs || this.oneofs[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.oneofs[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message<{}>} Message instance\n */\nType.prototype.create = function create(properties) {\n return new this.ctor(properties);\n};\n\n/**\n * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.\n * @returns {Type} `this`\n */\nType.prototype.setup = function setup() {\n // Sets up everything at once so that the prototype chain does not have to be re-evaluated\n // multiple times (V8, soft-deopt prototype-check).\n\n var fullName = this.fullName,\n types = [];\n for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i)\n types.push(this._fieldsArray[i].resolve().resolvedType);\n\n // Replace setup methods with type-specific generated functions\n this.encode = encoder(this)({\n Writer : Writer,\n types : types,\n util : util\n });\n this.decode = decoder(this)({\n Reader : Reader,\n types : types,\n util : util\n });\n this.verify = verifier(this)({\n types : types,\n util : util\n });\n this.fromObject = converter.fromObject(this)({\n types : types,\n util : util\n });\n this.toObject = converter.toObject(this)({\n types : types,\n util : util\n });\n\n // Inject custom wrappers for common types\n var wrapper = wrappers[fullName];\n if (wrapper) {\n var originalThis = Object.create(this);\n // if (wrapper.fromObject) {\n originalThis.fromObject = this.fromObject;\n this.fromObject = wrapper.fromObject.bind(originalThis);\n // }\n // if (wrapper.toObject) {\n originalThis.toObject = this.toObject;\n this.toObject = wrapper.toObject.bind(originalThis);\n // }\n }\n\n return this;\n};\n\n/**\n * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encode = function encode_setup(message, writer) {\n return this.setup().encode(message, writer); // overrides this method\n};\n\n/**\n * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();\n};\n\n/**\n * Decodes a message of this type.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Length of the message, if known beforehand\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError<{}>} If required fields are missing\n */\nType.prototype.decode = function decode_setup(reader, length) {\n return this.setup().decode(reader, length); // overrides this method\n};\n\n/**\n * Decodes a message of this type preceeded by its byte length as a varint.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError} If required fields are missing\n */\nType.prototype.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof Reader))\n reader = Reader.create(reader);\n return this.decode(reader, reader.uint32());\n};\n\n/**\n * Verifies that field values are valid and that required fields are present.\n * @param {Object.} message Plain object to verify\n * @returns {null|string} `null` if valid, otherwise the reason why it is not\n */\nType.prototype.verify = function verify_setup(message) {\n return this.setup().verify(message); // overrides this method\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object to convert\n * @returns {Message<{}>} Message instance\n */\nType.prototype.fromObject = function fromObject(object) {\n return this.setup().fromObject(object);\n};\n\n/**\n * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.\n * @interface IConversionOptions\n * @property {Function} [longs] Long conversion type.\n * Valid values are `String` and `Number` (the global types).\n * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.\n * @property {Function} [enums] Enum value conversion type.\n * Only valid value is `String` (the global type).\n * Defaults to copy the present value, which is the numeric id.\n * @property {Function} [bytes] Bytes value conversion type.\n * Valid values are `Array` and (a base64 encoded) `String` (the global types).\n * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser.\n * @property {boolean} [defaults=false] Also sets default values on the resulting object\n * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false`\n * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false`\n * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any\n * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings\n */\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\nType.prototype.toObject = function toObject(message, options) {\n return this.setup().toObject(message, options);\n};\n\n/**\n * Decorator function as returned by {@link Type.d} (TypeScript).\n * @typedef TypeDecorator\n * @type {function}\n * @param {Constructor} target Target constructor\n * @returns {undefined}\n * @template T extends Message\n */\n\n/**\n * Type decorator (TypeScript).\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {TypeDecorator} Decorator function\n * @template T extends Message\n */\nType.d = function decorateType(typeName) {\n return function typeDecorator(target) {\n util.decorateType(target, typeName);\n };\n};\n","\"use strict\";\n\n/**\n * Common type constants.\n * @namespace\n */\nvar types = exports;\n\nvar util = require(37);\n\nvar s = [\n \"double\", // 0\n \"float\", // 1\n \"int32\", // 2\n \"uint32\", // 3\n \"sint32\", // 4\n \"fixed32\", // 5\n \"sfixed32\", // 6\n \"int64\", // 7\n \"uint64\", // 8\n \"sint64\", // 9\n \"fixed64\", // 10\n \"sfixed64\", // 11\n \"bool\", // 12\n \"string\", // 13\n \"bytes\" // 14\n];\n\nfunction bake(values, offset) {\n var i = 0, o = {};\n offset |= 0;\n while (i < values.length) o[s[i + offset]] = values[i++];\n return o;\n}\n\n/**\n * Basic type wire types.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n * @property {number} bytes=2 Ldelim wire type\n */\ntypes.basic = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2,\n /* bytes */ 2\n]);\n\n/**\n * Basic type defaults.\n * @type {Object.}\n * @const\n * @property {number} double=0 Double default\n * @property {number} float=0 Float default\n * @property {number} int32=0 Int32 default\n * @property {number} uint32=0 Uint32 default\n * @property {number} sint32=0 Sint32 default\n * @property {number} fixed32=0 Fixed32 default\n * @property {number} sfixed32=0 Sfixed32 default\n * @property {number} int64=0 Int64 default\n * @property {number} uint64=0 Uint64 default\n * @property {number} sint64=0 Sint32 default\n * @property {number} fixed64=0 Fixed64 default\n * @property {number} sfixed64=0 Sfixed64 default\n * @property {boolean} bool=false Bool default\n * @property {string} string=\"\" String default\n * @property {Array.} bytes=Array(0) Bytes default\n * @property {null} message=null Message default\n */\ntypes.defaults = bake([\n /* double */ 0,\n /* float */ 0,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 0,\n /* sfixed32 */ 0,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 0,\n /* sfixed64 */ 0,\n /* bool */ false,\n /* string */ \"\",\n /* bytes */ util.emptyArray,\n /* message */ null\n]);\n\n/**\n * Basic long type wire types.\n * @type {Object.}\n * @const\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n */\ntypes.long = bake([\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1\n], 7);\n\n/**\n * Allowed types for map keys with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n */\ntypes.mapKey = bake([\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2\n], 2);\n\n/**\n * Allowed types for packed repeated fields with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n */\ntypes.packed = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0\n]);\n","\"use strict\";\n\n/**\n * Various utility functions.\n * @namespace\n */\nvar util = module.exports = require(39);\n\nvar roots = require(30);\n\nvar Type, // cyclic\n Enum;\n\nutil.codegen = require(3);\nutil.fetch = require(5);\nutil.path = require(8);\n\n/**\n * Node's fs module if available.\n * @type {Object.}\n */\nutil.fs = util.inquire(\"fs\");\n\n/**\n * Converts an object's values to an array.\n * @param {Object.} object Object to convert\n * @returns {Array.<*>} Converted array\n */\nutil.toArray = function toArray(object) {\n if (object) {\n var keys = Object.keys(object),\n array = new Array(keys.length),\n index = 0;\n while (index < keys.length)\n array[index] = object[keys[index++]];\n return array;\n }\n return [];\n};\n\n/**\n * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.\n * @param {Array.<*>} array Array to convert\n * @returns {Object.} Converted object\n */\nutil.toObject = function toObject(array) {\n var object = {},\n index = 0;\n while (index < array.length) {\n var key = array[index++],\n val = array[index++];\n if (val !== undefined)\n object[key] = val;\n }\n return object;\n};\n\nvar safePropBackslashRe = /\\\\/g,\n safePropQuoteRe = /\"/g;\n\n/**\n * Tests whether the specified name is a reserved word in JS.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nutil.isReserved = function isReserved(name) {\n return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);\n};\n\n/**\n * Returns a safe property accessor for the specified property name.\n * @param {string} prop Property name\n * @returns {string} Safe accessor\n */\nutil.safeProp = function safeProp(prop) {\n if (!/^[$\\w_]+$/.test(prop) || util.isReserved(prop))\n return \"[\\\"\" + prop.replace(safePropBackslashRe, \"\\\\\\\\\").replace(safePropQuoteRe, \"\\\\\\\"\") + \"\\\"]\";\n return \".\" + prop;\n};\n\n/**\n * Converts the first character of a string to upper case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.ucFirst = function ucFirst(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nvar camelCaseRe = /_([a-z])/g;\n\n/**\n * Converts a string to camel case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.camelCase = function camelCase(str) {\n return str.substring(0, 1)\n + str.substring(1)\n .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });\n};\n\n/**\n * Compares reflected fields by id.\n * @param {Field} a First field\n * @param {Field} b Second field\n * @returns {number} Comparison value\n */\nutil.compareFieldsById = function compareFieldsById(a, b) {\n return a.id - b.id;\n};\n\n/**\n * Decorator helper for types (TypeScript).\n * @param {Constructor} ctor Constructor function\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {Type} Reflected type\n * @template T extends Message\n * @property {Root} root Decorators root\n */\nutil.decorateType = function decorateType(ctor, typeName) {\n\n /* istanbul ignore if */\n if (ctor.$type) {\n if (typeName && ctor.$type.name !== typeName) {\n util.decorateRoot.remove(ctor.$type);\n ctor.$type.name = typeName;\n util.decorateRoot.add(ctor.$type);\n }\n return ctor.$type;\n }\n\n /* istanbul ignore next */\n if (!Type)\n Type = require(35);\n\n var type = new Type(typeName || ctor.name);\n util.decorateRoot.add(type);\n type.ctor = ctor; // sets up .encode, .decode etc.\n Object.defineProperty(ctor, \"$type\", { value: type, enumerable: false });\n Object.defineProperty(ctor.prototype, \"$type\", { value: type, enumerable: false });\n return type;\n};\n\nvar decorateEnumIndex = 0;\n\n/**\n * Decorator helper for enums (TypeScript).\n * @param {Object} object Enum object\n * @returns {Enum} Reflected enum\n */\nutil.decorateEnum = function decorateEnum(object) {\n\n /* istanbul ignore if */\n if (object.$type)\n return object.$type;\n\n /* istanbul ignore next */\n if (!Enum)\n Enum = require(15);\n\n var enm = new Enum(\"Enum\" + decorateEnumIndex++, object);\n util.decorateRoot.add(enm);\n Object.defineProperty(object, \"$type\", { value: enm, enumerable: false });\n return enm;\n};\n\n\n/**\n * Sets the value of a property by property path. If a value already exists, it is turned to an array\n * @param {Object.} dst Destination object\n * @param {string} path dot '.' delimited path of the property to set\n * @param {Object} value the value to set\n * @returns {Object.} Destination object\n */\nutil.setProperty = function setProperty(dst, path, value) {\n function setProp(dst, path, value) {\n var part = path.shift();\n if (path.length > 0) {\n dst[part] = setProp(dst[part] || {}, path, value);\n } else {\n var prevValue = dst[part];\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n dst[part] = value;\n }\n return dst;\n }\n\n if (typeof dst !== \"object\")\n throw TypeError(\"dst must be an object\");\n if (!path)\n throw TypeError(\"path must be specified\");\n\n path = path.split(\".\");\n return setProp(dst, path, value);\n};\n\n/**\n * Decorator root (TypeScript).\n * @name util.decorateRoot\n * @type {Root}\n * @readonly\n */\nObject.defineProperty(util, \"decorateRoot\", {\n get: function() {\n return roots[\"decorated\"] || (roots[\"decorated\"] = new (require(29))());\n }\n});\n","\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(39);\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n","\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(1);\n\n// converts to / from base64 encoded strings\nutil.base64 = require(2);\n\n// base class of rpc.Service\nutil.EventEmitter = require(4);\n\n// float handling accross browsers\nutil.float = require(6);\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(7);\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(10);\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(9);\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(38);\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n","\"use strict\";\nmodule.exports = verifier;\n\nvar Enum = require(15),\n util = require(37);\n\nfunction invalid(field, expected) {\n return field.name + \": \" + expected + (field.repeated && expected !== \"array\" ? \"[]\" : field.map && expected !== \"object\" ? \"{k:\"+field.keyType+\"}\" : \"\") + \" expected\";\n}\n\n/**\n * Generates a partial value verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyValue(gen, field, fieldIndex, ref) {\n /* eslint-disable no-unexpected-multiline */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(%s){\", ref)\n (\"default:\")\n (\"return%j\", invalid(field, \"enum value\"));\n for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen\n (\"case %i:\", field.resolvedType.values[keys[j]]);\n gen\n (\"break\")\n (\"}\");\n } else {\n gen\n (\"{\")\n (\"var e=types[%i].verify(%s);\", fieldIndex, ref)\n (\"if(e)\")\n (\"return%j+e\", field.name + \".\")\n (\"}\");\n }\n } else {\n switch (field.type) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.isInteger(%s))\", ref)\n (\"return%j\", invalid(field, \"integer\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))\", ref, ref, ref, ref)\n (\"return%j\", invalid(field, \"integer|Long\"));\n break;\n case \"float\":\n case \"double\": gen\n (\"if(typeof %s!==\\\"number\\\")\", ref)\n (\"return%j\", invalid(field, \"number\"));\n break;\n case \"bool\": gen\n (\"if(typeof %s!==\\\"boolean\\\")\", ref)\n (\"return%j\", invalid(field, \"boolean\"));\n break;\n case \"string\": gen\n (\"if(!util.isString(%s))\", ref)\n (\"return%j\", invalid(field, \"string\"));\n break;\n case \"bytes\": gen\n (\"if(!(%s&&typeof %s.length===\\\"number\\\"||util.isString(%s)))\", ref, ref, ref)\n (\"return%j\", invalid(field, \"buffer\"));\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a partial key verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyKey(gen, field, ref) {\n /* eslint-disable no-unexpected-multiline */\n switch (field.keyType) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.key32Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"integer key\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.key64Re.test(%s))\", ref) // see comment above: x is ok, d is not\n (\"return%j\", invalid(field, \"integer|Long key\"));\n break;\n case \"bool\": gen\n (\"if(!util.key2Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"boolean key\"));\n break;\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a verifier specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction verifier(mtype) {\n /* eslint-disable no-unexpected-multiline */\n\n var gen = util.codegen([\"m\"], mtype.name + \"$verify\")\n (\"if(typeof m!==\\\"object\\\"||m===null)\")\n (\"return%j\", \"object expected\");\n var oneofs = mtype.oneofsArray,\n seenFirstField = {};\n if (oneofs.length) gen\n (\"var p={}\");\n\n for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n ref = \"m\" + util.safeProp(field.name);\n\n if (field.optional) gen\n (\"if(%s!=null&&m.hasOwnProperty(%j)){\", ref, field.name); // !== undefined && !== null\n\n // map fields\n if (field.map) { gen\n (\"if(!util.isObject(%s))\", ref)\n (\"return%j\", invalid(field, \"object\"))\n (\"var k=Object.keys(%s)\", ref)\n (\"for(var i=0;i}\n * @const\n */\nvar wrappers = exports;\n\nvar Message = require(21);\n\n/**\n * From object converter part of an {@link IWrapper}.\n * @typedef WrapperFromObjectConverter\n * @type {function}\n * @param {Object.} object Plain object\n * @returns {Message<{}>} Message instance\n * @this Type\n */\n\n/**\n * To object converter part of an {@link IWrapper}.\n * @typedef WrapperToObjectConverter\n * @type {function}\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @this Type\n */\n\n/**\n * Common type wrapper part of {@link wrappers}.\n * @interface IWrapper\n * @property {WrapperFromObjectConverter} [fromObject] From object converter\n * @property {WrapperToObjectConverter} [toObject] To object converter\n */\n\n// Custom wrapper for Any\nwrappers[\".google.protobuf.Any\"] = {\n\n fromObject: function(object) {\n\n // unwrap value type if mapped\n if (object && object[\"@type\"]) {\n // Only use fully qualified type name after the last '/'\n var name = object[\"@type\"].substring(object[\"@type\"].lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type) {\n // type_url does not accept leading \".\"\n var type_url = object[\"@type\"].charAt(0) === \".\" ?\n object[\"@type\"].substr(1) : object[\"@type\"];\n // type_url prefix is optional, but path seperator is required\n if (type_url.indexOf(\"/\") === -1) {\n type_url = \"/\" + type_url;\n }\n return this.create({\n type_url: type_url,\n value: type.encode(type.fromObject(object)).finish()\n });\n }\n }\n\n return this.fromObject(object);\n },\n\n toObject: function(message, options) {\n\n // Default prefix\n var googleApi = \"type.googleapis.com/\";\n var prefix = \"\";\n var name = \"\";\n\n // decode value if requested and unmapped\n if (options && options.json && message.type_url && message.value) {\n // Only use fully qualified type name after the last '/'\n name = message.type_url.substring(message.type_url.lastIndexOf(\"/\") + 1);\n // Separate the prefix used\n prefix = message.type_url.substring(0, message.type_url.lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type)\n message = type.decode(message.value);\n }\n\n // wrap value if unmapped\n if (!(message instanceof this.ctor) && message instanceof Message) {\n var object = message.$type.toObject(message, options);\n var messageName = message.$type.fullName[0] === \".\" ?\n message.$type.fullName.substr(1) : message.$type.fullName;\n // Default to type.googleapis.com prefix if no prefix is used\n if (prefix === \"\") {\n prefix = googleApi;\n }\n name = prefix + messageName;\n object[\"@type\"] = name;\n return object;\n }\n\n return this.toObject(message, options);\n }\n};\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(39);\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(42);\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(39);\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n"],"sourceRoot":"."} \ No newline at end of file diff --git a/node_modules/protobufjs/dist/protobuf.min.js b/node_modules/protobufjs/dist/protobuf.min.js deleted file mode 100644 index 6e0f89ef..00000000 --- a/node_modules/protobufjs/dist/protobuf.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * protobuf.js v6.10.0 (c) 2016, daniel wirtz - * compiled wed, 15 jul 2020 23:34:15 utc - * licensed under the bsd-3-clause license - * see: https://github.com/dcodeio/protobuf.js for details - */ -!function(it){"use strict";var r,e,t,i;r={1:[function(t,i){i.exports=function(t,i){var n=Array(arguments.length-1),s=0,r=2,u=!0;for(;r>2],r=(3&f)<<4,o=1;break;case 1:s[u++]=h[r|f>>4],r=(15&f)<<2,o=2;break;case 2:s[u++]=h[r|f>>6],s[u++]=h[63&f],o=0}8191>4,r=o,s=2;break;case 2:i[n++]=(15&r)<<4|(60&o)>>2,r=o,s=3;break;case 3:i[n++]=(3&r)<<6|o,s=0}}if(1===s)throw Error(a);return n-e},r.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},{}],3:[function(t,i){function c(i,n){"string"==typeof i&&(n=i,i=it);var f=[];function h(t){if("string"!=typeof t){var i=a();if(c.verbose&&console.log("codegen: "+i),i="return "+i,t){for(var n=Object.keys(t),r=Array(n.length+1),e=Array(n.length),s=0;s>>0,n,r);else if(i<11754943508222875e-54)t((e<<31|Math.round(i/1401298464324817e-60))>>>0,n,r);else{var s=Math.floor(Math.log(i)/Math.LN2);t((e<<31|127+s<<23|8388607&Math.round(i*Math.pow(2,-s)*8388608))>>>0,n,r)}}function n(t,i,n){var r=t(i,n),e=2*(r>>31)+1,s=r>>>23&255,u=8388607&r;return 255==s?u?NaN:1/0*e:0==s?1401298464324817e-60*e*u:e*Math.pow(2,s-150)*(8388608+u)}function r(t,i,n){o[0]=t,i[n]=f[0],i[n+1]=f[1],i[n+2]=f[2],i[n+3]=f[3]}function e(t,i,n){o[0]=t,i[n]=f[3],i[n+1]=f[2],i[n+2]=f[1],i[n+3]=f[0]}function s(t,i){return f[0]=t[i],f[1]=t[i+1],f[2]=t[i+2],f[3]=t[i+3],o[0]}function u(t,i){return f[3]=t[i],f[2]=t[i+1],f[1]=t[i+2],f[0]=t[i+3],o[0]}var o,f,h,a,c,l;function v(t,i,n,r,e,s){var u=r<0?1:0;if(u&&(r=-r),0===r)t(0,e,s+i),t(0<1/r?0:2147483648,e,s+n);else if(isNaN(r))t(0,e,s+i),t(2146959360,e,s+n);else if(17976931348623157e292>>0,e,s+n);else{var o;if(r<22250738585072014e-324)t((o=r/5e-324)>>>0,e,s+i),t((u<<31|o/4294967296)>>>0,e,s+n);else{var f=Math.floor(Math.log(r)/Math.LN2);1024===f&&(f=1023),t(4503599627370496*(o=r*Math.pow(2,-f))>>>0,e,s+i),t((u<<31|f+1023<<20|1048576*o&1048575)>>>0,e,s+n)}}}function d(t,i,n,r,e){var s=t(r,e+i),u=t(r,e+n),o=2*(u>>31)+1,f=u>>>20&2047,h=4294967296*(1048575&u)+s;return 2047==f?h?NaN:1/0*o:0==f?5e-324*o*h:o*Math.pow(2,f-1075)*(h+4503599627370496)}function p(t,i,n){a[0]=t,i[n]=c[0],i[n+1]=c[1],i[n+2]=c[2],i[n+3]=c[3],i[n+4]=c[4],i[n+5]=c[5],i[n+6]=c[6],i[n+7]=c[7]}function w(t,i,n){a[0]=t,i[n]=c[7],i[n+1]=c[6],i[n+2]=c[5],i[n+3]=c[4],i[n+4]=c[3],i[n+5]=c[2],i[n+6]=c[1],i[n+7]=c[0]}function b(t,i){return c[0]=t[i],c[1]=t[i+1],c[2]=t[i+2],c[3]=t[i+3],c[4]=t[i+4],c[5]=t[i+5],c[6]=t[i+6],c[7]=t[i+7],a[0]}function y(t,i){return c[7]=t[i],c[6]=t[i+1],c[5]=t[i+2],c[4]=t[i+3],c[3]=t[i+4],c[2]=t[i+5],c[1]=t[i+6],c[0]=t[i+7],a[0]}return"undefined"!=typeof Float32Array?(o=new Float32Array([-0]),f=new Uint8Array(o.buffer),h=128===f[3],t.writeFloatLE=h?r:e,t.writeFloatBE=h?e:r,t.readFloatLE=h?s:u,t.readFloatBE=h?u:s):(t.writeFloatLE=i.bind(null,m),t.writeFloatBE=i.bind(null,g),t.readFloatLE=n.bind(null,j),t.readFloatBE=n.bind(null,k)),"undefined"!=typeof Float64Array?(a=new Float64Array([-0]),c=new Uint8Array(a.buffer),l=128===c[7],t.writeDoubleLE=l?p:w,t.writeDoubleBE=l?w:p,t.readDoubleLE=l?b:y,t.readDoubleBE=l?y:b):(t.writeDoubleLE=v.bind(null,m,0,4),t.writeDoubleBE=v.bind(null,g,4,0),t.readDoubleLE=d.bind(null,j,0,4),t.readDoubleBE=d.bind(null,k,4,0)),t}function m(t,i,n){i[n]=255&t,i[n+1]=t>>>8&255,i[n+2]=t>>>16&255,i[n+3]=t>>>24}function g(t,i,n){i[n]=t>>>24,i[n+1]=t>>>16&255,i[n+2]=t>>>8&255,i[n+3]=255&t}function j(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16|t[i+3]<<24)>>>0}function k(t,i){return(t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3])>>>0}i.exports=n(n)},{}],7:[function(t,i,n){function r(t){try{var i=eval("require")(t);if(i&&(i.length||Object.keys(i).length))return i}catch(t){}return null}i.exports=r},{}],8:[function(t,i,n){var r=n,s=r.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},e=r.normalize=function(t){var i=(t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=s(t),r="";n&&(r=i.shift()+"/");for(var e=0;e>>1,u=null,o=e;return function(t){if(t<1||s>10),s[u++]=56320+(1023&r)):s[u++]=(15&r)<<12|(63&t[i++])<<6|63&t[i++],8191>6|192:(55296==(64512&r)&&56320==(64512&(e=t.charCodeAt(u+1)))?(r=65536+((1023&r)<<10)+(1023&e),++u,i[n++]=r>>18|240,i[n++]=r>>12&63|128):i[n++]=r>>12|224,i[n++]=r>>6&63|128),i[n++]=63&r|128);return n-s}},{}],11:[function(t,i){i.exports=e;var n,r=/\/|\./;function e(t,i){r.test(t)||(t="google/protobuf/"+t+".proto",i={nested:{google:{nested:{protobuf:{nested:i}}}}}),e[t]=i}e("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),e("duration",{Duration:n={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),e("timestamp",{Timestamp:n}),e("empty",{Empty:{fields:{}}}),e("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),e("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),e("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),e.get=function(t){return e[t]||null}},{}],12:[function(t,i,n){var r=n,l=t(15),v=t(37);function u(t,i,n,r){if(i.resolvedType)if(i.resolvedType instanceof l){t("switch(d%s){",r);for(var e=i.resolvedType.values,s=Object.keys(e),u=0;u>>0",r,r);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",r,r);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",r,r,o)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,o?"true":"");break;case"bytes":t('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length)",r)("m%s=d%s",r,r);break;case"string":t("m%s=String(d%s)",r,r);break;case"bool":t("m%s=Boolean(d%s)",r,r)}}return t}function d(t,i,n,r){if(i.resolvedType)i.resolvedType instanceof l?t("d%s=o.enums===String?types[%i].values[m%s]:m%s",r,n,r,r):t("d%s=types[%i].toObject(m%s,o)",r,n,r);else{var e=!1;switch(i.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":e=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":t('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,r,r,r,e?"true":"",r);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,r,r,r,r);break;default:t("d%s=m%s",r,r)}}return t}r.fromObject=function(t){var i=t.fieldsArray,n=v.codegen(["d"],t.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!i.length)return n("return new this.ctor");n("var m=new this.ctor");for(var r=0;r>>3){");for(var n=0;n>>3){")("case 1: k=r.%s(); break",r.keyType)("case 2:"),f.basic[e]===it?i("value=types[%i].decode(r,r.uint32())",n):i("value=r.%s()",e),i("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),f.long[r.keyType]!==it?i('%s[typeof k==="object"?util.longToHash(k):k]=value',s):i("%s[k]=value",s)):r.repeated?(i("if(!(%s&&%s.length))",s,s)("%s=[]",s),f.packed[e]!==it&&i("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0,8|a.mapKey[s.keyType],s.keyType),f===it?n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,i):n(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|f,o,i),n("}")("}")):s.repeated?(n("if(%s!=null&&%s.length){",i,i),s.packed&&a.packed[o]!==it?n("w.uint32(%i).fork()",(s.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",o,i)("w.ldelim()"):(n("for(var i=0;i<%s.length;++i)",i),f===it?l(n,s,u,i+"[i]"):n("w.uint32(%i).%s(%s[i])",(s.id<<3|f)>>>0,o,i)),n("}")):(s.optional&&n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,s.name),f===it?l(n,s,u,i):n("w.uint32(%i).%s(%s)",(s.id<<3|f)>>>0,o,i))}return n("return w")};var h=t(15),a=t(36),c=t(37);function l(t,i,n,r){return i.resolvedType.group?t("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",n,r,(i.id<<3|3)>>>0,(i.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",n,r,(i.id<<3|2)>>>0)}},{15:15,36:36,37:37}],15:[function(t,i){i.exports=e;var o=t(24);((e.prototype=Object.create(o.prototype)).constructor=e).className="Enum";var n=t(23),r=t(37);function e(t,i,n,r,e){if(o.call(this,t,n),i&&"object"!=typeof i)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=r,this.comments=e||{},this.reserved=it,i)for(var s=Object.keys(i),u=0;ui)return!0;return!1},h.isReservedName=function(t,i){if(t)for(var n=0;n");var r=l();if(!K.test(r))throw m(r,"name");d("=");var e=new _(y(r),E(l()),i,n);S(e,function(t){if("option"!==t)throw m(t);V(e,t),d(";")},function(){M(e)}),t.add(e)}(n);break;case"required":case"optional":case"repeated":N(n,t);break;case"oneof":!function(t,i){if(!K.test(i=l()))throw m(i,"name");var n=new q(y(i));S(n,function(t){"option"===t?(V(n,t),d(";")):(h(t),N(n,"optional"))}),t.add(n)}(n,t);break;case"extensions":k(n.extensions||(n.extensions=[]));break;case"reserved":k(n.reserved||(n.reserved=[]),!0);break;default:if(!w||!Q.test(t))throw m(t);h(t),N(n,"optional")}}),t.add(n)}(t,i),1;case"enum":return function(t,i){if(!K.test(i=l()))throw m(i,"name");var n=new R(i);S(n,function(t){switch(t){case"option":V(n,t),d(";");break;case"reserved":k(n.reserved||(n.reserved=[]),!0);break;default:!function(t,i){if(!K.test(i))throw m(i,"name");d("=");var n=E(l(),!0),r={};S(r,function(t){if("option"!==t)throw m(t);V(r,t),d(";")},function(){M(r)}),t.add(i,n,r.comment)}(n,t)}}),t.add(n)}(t,i),1;case"service":return function(t,i){if(!K.test(i=l()))throw m(i,"service name");var n=new z(i);S(n,function(t){if(!T(n,t)){if("rpc"!==t)throw m(t);!function(t,i){var n=a(),r=i;if(!K.test(i=l()))throw m(i,"name");var e,s,u,o,f=i;d("("),d("stream",!0)&&(s=!0);if(!Q.test(i=l()))throw m(i);e=i,d(")"),d("returns"),d("("),d("stream",!0)&&(o=!0);if(!Q.test(i=l()))throw m(i);u=i,d(")");var h=new Z(f,r,e,u,s,o);h.comment=n,S(h,function(t){if("option"!==t)throw m(t);V(h,t),d(";")}),t.add(h)}(n,t)}}),t.add(n)}(t,i),1;case"extend":return function(i,t){if(!Q.test(t=l()))throw m(t,"reference");var n=t;S(null,function(t){switch(t){case"required":case"repeated":case"optional":N(i,t,n);break;default:if(!w||!Q.test(t))throw m(t);h(t),N(i,"optional",n)}})}(t,i),1}}function S(t,i,n){var r=f.line;if(t&&("string"!=typeof t.comment&&(t.comment=a()),t.filename=tt.filename),d("{",!0)){for(var e;"}"!==(e=l());)i(e);d(";",!0)}else n&&n(),d(";"),t&&("string"!=typeof t.comment||o)&&(t.comment=a(r)||t.comment)}function N(t,i,n){var r=l();if("group"!==r){if(!Q.test(r))throw m(r,"type");var e=l();if(!K.test(e))throw m(e,"name");e=y(e),d("=");var s=new U(e,E(l()),r,i,n);S(s,function(t){if("option"!==t)throw m(t);V(s,t),d(";")},function(){M(s)}),t.add(s),w||!s.repeated||B.packed[r]===it&&B.basic[r]!==it||s.setOption("packed",!1,!0)}else!function(t,i){var n=l();if(!K.test(n))throw m(n,"name");var r=P.lcFirst(n);n===r&&(n=P.ucFirst(n));d("=");var e=E(l()),s=new L(n);s.group=!0;var u=new U(r,e,n,i);u.filename=tt.filename,S(s,function(t){switch(t){case"option":V(s,t),d(";");break;case"required":case"optional":case"repeated":N(s,t);break;default:throw m(t)}}),t.add(s).add(u)}(t,i)}function V(t,i){var n=d("(",!0);if(!Q.test(i=l()))throw m(i,"name");var r,e=i,s=e;n&&(d(")"),s=e="("+e+")",i=v(),Y.test(i)&&(r=i.substr(1),e+=i,l())),d("=");var u,o,f,h,a=function t(i,n){if(d("{",!0)){for(var r={};!d("}",!0);){if(!K.test(c=l()))throw m(c,"name");var e,s=c;"{"===v()?e=t(i,n+"."+c):(d(":"),"{"===v()?e=t(i,n+"."+c):(e=j(!0),$(i,n+"."+c,e)));var u=r[s];u&&(e=[].concat(u).concat(e)),r[s]=e,d(",",!0)}return r}var o=j(!0);$(i,n,o);return o}(t,e);o=s,f=a,h=r,(u=t).setParsedOption&&u.setParsedOption(o,f,h)}function $(t,i,n){t.setOption&&t.setOption(i,n)}function M(t){if(d("[",!0)){for(;V(t,"option"),d(",",!0););d("]")}return t}for(;null!==(c=l());)switch(c){case"package":if(!p)throw m(c);O();break;case"import":if(!p)throw m(c);A();break;case"syntax":if(!p)throw m(c);x();break;case"option":V(b,c),d(";");break;default:if(T(b,c)){p=!1;continue}throw m(c)}return tt.filename=null,{package:r,imports:e,weakImports:s,syntax:u,root:i}}},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(t,i){i.exports=o;var n,r=t(39),e=r.LongBits,s=r.utf8;function u(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}function o(t){this.buf=t,this.pos=0,this.len=t.length}function f(){return r.Buffer?function(t){return(o.create=function(t){return r.Buffer.isBuffer(t)?new n(t):a(t)})(t)}:a}var h,a="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new o(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new o(t);throw Error("illegal buffer")};function c(){var t=new e(0,0),i=0;if(!(4=this.len)throw u(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(i=0,4>>0,this.buf[this.pos++]<128)return t}else for(;i<5;++i){if(this.pos>=this.len)throw u(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function l(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function v(){if(this.pos+8>this.len)throw u(this,8);return new e(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}o.create=f(),o.prototype.c=r.Array.prototype.subarray||r.Array.prototype.slice,o.prototype.uint32=(h=4294967295,function(){if(h=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return h;if(h=(h|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return h;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return h}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},o.prototype.bool=function(){return 0!==this.uint32()},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return l(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return 0|l(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var t=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},o.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var t=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},o.prototype.bytes=function(){var t=this.uint32(),i=this.pos,n=this.pos+t;if(n>this.len)throw u(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,n):i===n?new this.buf.constructor(0):this.c.call(this.buf,i,n)},o.prototype.string=function(){var t=this.bytes();return s.read(t,0,t.length)},o.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw u(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw u(this)}while(128&this.buf[this.pos++]);return this},o.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},o.o=function(t){n=t,o.create=f(),n.o();var i=r.Long?"toLong":"toNumber";r.merge(o.prototype,{int64:function(){return c.call(this)[i](!1)},uint64:function(){return c.call(this)[i](!0)},sint64:function(){return c.call(this).zzDecode()[i](!1)},fixed64:function(){return v.call(this)[i](!0)},sfixed64:function(){return v.call(this)[i](!1)}})}},{39:39}],28:[function(t,i){i.exports=e;var n=t(27);(e.prototype=Object.create(n.prototype)).constructor=e;var r=t(39);function e(t){n.call(this,t)}e.o=function(){r.Buffer&&(e.prototype.c=r.Buffer.prototype.slice)},e.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},e.o()},{27:27,39:39}],29:[function(t,i){i.exports=n;var r=t(23);((n.prototype=Object.create(r.prototype)).constructor=n).className="Root";var e,v,d,s=t(16),u=t(15),o=t(25),p=t(37);function n(t){r.call(this,"",t),this.deferred=[],this.files=[]}function w(){}n.fromJSON=function(t,i){return i=i||new n,t.options&&i.setOptions(t.options),i.addJSON(t.nested)},n.prototype.resolvePath=p.path.resolve,n.prototype.fetch=p.fetch,n.prototype.load=function t(i,s,e){"function"==typeof s&&(e=s,s=it);var u=this;if(!e)return p.asPromise(t,u,i,s);var o=e===w;function f(t,i){if(e){var n=e;if(e=null,o)throw t;n(t,i)}}function h(t){var i=t.lastIndexOf("google/protobuf/");if(-1]/g,x=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,T=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,S=/^ *[*/]+ */,N=/^\s*\*?\/*/,V=/\n/g,$=/\s/,n=/\\(.?)/g,r={0:"\0",r:"\r",n:"\n",t:"\t"};function M(t){return t.replace(n,function(t,i){switch(i){case"\\":case"":return i;default:return r[i]||""}})}function e(f,h){f=f.toString();var a=0,c=f.length,l=1,o=null,v=null,d=0,p=!1,w=!1,b=[],y=null;function m(t){return Error("illegal "+t+" (line "+l+")")}function g(t){return f[0|t]}function j(t,i,n){o=f[0|t++],d=l,p=!1,w=n;var r,e=t-(h?2:3);do{if(--e<0||"\n"==(r=f[0|e])){p=!0;break}}while(" "===r||"\t"===r);for(var s=f.substring(t,i).split(V),u=0;u>>0,this.hi=i>>>0}var s=e.zero=new e(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var r=e.zeroHash="\0\0\0\0\0\0\0\0";e.fromNumber=function(t){if(0===t)return s;var i=t<0;i&&(t=-t);var n=t>>>0,r=(t-n)/4294967296>>>0;return i&&(r=~r>>>0,n=~n>>>0,4294967295<++n&&(n=0,4294967295<++r&&(r=0))),new e(n,r)},e.from=function(t){if("number"==typeof t)return e.fromNumber(t);if(n.isString(t)){if(!n.Long)return e.fromNumber(parseInt(t,10));t=n.Long.fromString(t)}return t.low||t.high?new e(t.low>>>0,t.high>>>0):s},e.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var i=1+~this.lo>>>0,n=~this.hi>>>0;return i||(n=n+1>>>0),-(i+4294967296*n)}return this.lo+4294967296*this.hi},e.prototype.toLong=function(t){return n.Long?new n.Long(0|this.lo,0|this.hi,!!t):{low:0|this.lo,high:0|this.hi,unsigned:!!t}};var u=String.prototype.charCodeAt;e.fromHash=function(t){return t===r?s:new e((u.call(t,0)|u.call(t,1)<<8|u.call(t,2)<<16|u.call(t,3)<<24)>>>0,(u.call(t,4)|u.call(t,5)<<8|u.call(t,6)<<16|u.call(t,7)<<24)>>>0)},e.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},e.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},e.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},e.prototype.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0==n?0==i?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}},{39:39}],39:[function(t,i,n){var r=n;function e(t,i,n){for(var r=Object.keys(i),e=0;e>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;127>>7;i[n++]=t.lo}function p(t,i,n){i[n]=255&t,i[n+1]=t>>>8&255,i[n+2]=t>>>16&255,i[n+3]=t>>>24}a.create=c(),a.alloc=function(t){return new r.Array(t)},r.Array!==Array&&(a.alloc=r.pool(a.alloc,r.Array.prototype.subarray)),a.prototype.g=function(t,i,n){return this.tail=this.tail.next=new o(t,i,n),this.len+=i,this},(v.prototype=Object.create(o.prototype)).fn=function(t,i,n){for(;127>>=7;i[n]=t},a.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new v((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},a.prototype.int32=function(t){return t<0?this.g(d,10,e.fromNumber(t)):this.uint32(t)},a.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},a.prototype.int64=a.prototype.uint64=function(t){var i=e.from(t);return this.g(d,i.length(),i)},a.prototype.sint64=function(t){var i=e.from(t).zzEncode();return this.g(d,i.length(),i)},a.prototype.bool=function(t){return this.g(l,1,t?1:0)},a.prototype.sfixed32=a.prototype.fixed32=function(t){return this.g(p,4,t>>>0)},a.prototype.sfixed64=a.prototype.fixed64=function(t){var i=e.from(t);return this.g(p,4,i.lo).g(p,4,i.hi)},a.prototype.float=function(t){return this.g(r.float.writeFloatLE,4,t)},a.prototype.double=function(t){return this.g(r.float.writeDoubleLE,8,t)};var w=r.Array.prototype.set?function(t,i,n){i.set(t,n)}:function(t,i,n){for(var r=0;r>>0;if(!i)return this.g(l,1,0);if(r.isString(t)){var n=a.alloc(i=s.length(t));s.decode(t,n,0),t=n}return this.uint32(i).g(w,i,t)},a.prototype.string=function(t){var i=u.length(t);return i?this.uint32(i).g(u.write,i,t):this.g(l,1,0)},a.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new o(f,0,0),this.len=0,this},a.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(f,0,0),this.len=0),this},a.prototype.ldelim=function(){var t=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=i,this.len+=n),this},a.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,i,n),n+=t.len,t=t.next;return i},a.o=function(t){n=t,a.create=c(),n.o()}},{39:39}],43:[function(t,i){i.exports=e;var n=t(42);(e.prototype=Object.create(n.prototype)).constructor=e;var r=t(39);function e(){n.call(this)}function s(t,i,n){t.length<40?r.utf8.write(t,i,n):i.utf8Write?i.utf8Write(t,n):i.write(t,n)}e.o=function(){e.alloc=r.y,e.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(t,i,n){i.set(t,n)}:function(t,i,n){if(t.copy)t.copy(i,n,0,t.length);else for(var r=0;r>>0;return this.uint32(i),i&&this.g(e.writeBytesBuffer,i,t),this},e.prototype.string=function(t){var i=r.Buffer.byteLength(t);return this.uint32(i),i&&this.g(s,i,t),this},e.o()},{39:39,42:42}]},e={},t=[19],i=function t(i){var n=e[i];return n||r[i][0].call(n=e[i]={exports:{}},t,n,n.exports),n.exports}(t[0]),i.util.global.protobuf=i,"function"==typeof define&&define.amd&&define(["long"],function(t){return t&&t.isLong&&(i.util.Long=t,i.configure()),i}),"object"==typeof module&&module&&module.exports&&(module.exports=i)}(); -//# sourceMappingURL=protobuf.min.js.map diff --git a/node_modules/protobufjs/dist/protobuf.min.js.map b/node_modules/protobufjs/dist/protobuf.min.js.map deleted file mode 100644 index 4e3b71d2..00000000 --- a/node_modules/protobufjs/dist/protobuf.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["lib/prelude.js","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/codegen/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/fetch/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/path/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/@protobufjs/utf8/index.js","../src/common.js","../src/converter.js","../src/decoder.js","../src/encoder.js","../src/enum.js","../src/field.js","../src/index-light.js","../src/index-minimal.js","../src/index","../src/mapfield.js","../src/message.js","../src/method.js","../src/namespace.js","../src/object.js","../src/oneof.js","../src/parse.js","../src/reader.js","../src/reader_buffer.js","../src/root.js","../src/roots.js","../src/rpc.js","../src/rpc/service.js","../src/service.js","../src/tokenize.js","../src/type.js","../src/types.js","../src/util.js","../src/util/longbits.js","../src/util/minimal.js","../src/verifier.js","../src/wrappers.js","../src/writer.js","../src/writer_buffer.js"],"names":["undefined","modules","cache","entries","protobuf","1","require","module","exports","fn","ctx","params","Array","arguments","length","offset","index","pending","Promise","resolve","reject","err","apply","base64","string","p","n","Math","ceil","b64","s64","i","encode","buffer","start","end","t","parts","chunk","j","b","push","String","fromCharCode","slice","join","invalidEncoding","decode","c","charCodeAt","Error","test","codegen","functionParams","functionName","body","Codegen","formatStringOrScope","source","toString","verbose","console","log","scopeKeys","Object","keys","scopeParams","scopeValues","scopeOffset","Function","formatParams","formatOffset","replace","$0","$1","value","floor","JSON","stringify","functionNameOverride","EventEmitter","this","_listeners","prototype","on","evt","off","listeners","splice","emit","args","fetch","asPromise","fs","inquire","filename","options","callback","xhr","readFile","contents","XMLHttpRequest","binary","onreadystatechange","readyState","status","response","responseText","Uint8Array","overrideMimeType","responseType","open","send","factory","writeFloat_ieee754","writeUint","val","buf","pos","sign","isNaN","round","exponent","LN2","pow","readFloat_ieee754","readUint","uint","mantissa","NaN","Infinity","writeFloat_f32_cpy","f32","f8b","writeFloat_f32_rev","readFloat_f32_cpy","readFloat_f32_rev","le","f64","writeDouble_ieee754","off0","off1","readDouble_ieee754","lo","hi","writeDouble_f64_cpy","writeDouble_f64_rev","readDouble_f64_cpy","readDouble_f64_rev","Float32Array","writeFloatLE","writeFloatBE","readFloatLE","readFloatBE","bind","writeUintLE","writeUintBE","readUintLE","readUintBE","Float64Array","writeDoubleLE","writeDoubleBE","readDoubleLE","readDoubleBE","moduleName","mod","eval","e","path","isAbsolute","normalize","split","absolute","prefix","shift","originPath","includePath","alreadyNormalized","alloc","size","SIZE","MAX","slab","call","utf8","len","read","write","c1","c2","common","timeType","commonRe","name","json","nested","google","Any","fields","type_url","type","id","Duration","seconds","nanos","Timestamp","Empty","Struct","keyType","Value","oneofs","kind","oneof","nullValue","numberValue","stringValue","boolValue","structValue","listValue","NullValue","values","NULL_VALUE","ListValue","rule","DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue","FieldMask","paths","get","file","converter","Enum","util","genValuePartial_fromObject","gen","field","fieldIndex","prop","resolvedType","repeated","typeDefault","fullName","isUnsigned","genValuePartial_toObject","fromObject","mtype","fieldsArray","safeProp","map","toObject","sort","compareFieldsById","repeatedFields","mapFields","normalFields","partOf","valuesById","long","low","high","unsigned","toNumber","bytes","arrayDefault","hasKs2","_fieldsArray","indexOf","filter","group","ref","types","defaults","basic","packed","rfield","required","wireType","mapKey","genTypePartial","optional","ReflectionObject","create","constructor","className","Namespace","comment","comments","TypeError","reserved","fromJSON","enm","toJSON","toJSONOptions","keepComments","add","isString","isInteger","isReservedId","isReservedName","allow_alias","remove","Field","Type","ruleRe","extend","isObject","toLowerCase","message","defaultValue","Long","extensionField","declaringField","_packed","defineProperty","getOption","setOption","ifNotSet","resolved","parent","lookupTypeOrEnum","fromNumber","freeze","newBuffer","emptyObject","emptyArray","ctor","d","fieldId","fieldType","fieldRule","decorateType","decorateEnum","fieldName","default","_configure","Type_","build","load","root","Root","loadSync","encoder","decoder","verifier","OneOf","MapField","Service","Method","Message","wrappers","configure","Writer","BufferWriter","Reader","BufferReader","rpc","roots","tokenize","parse","resolvedKeyType","fieldKeyType","fieldValueType","properties","$type","writer","encodeDelimited","reader","decodeDelimited","verify","object","requestType","requestStream","responseStream","resolvedRequestType","resolvedResponseType","lookupType","arrayToJSON","array","obj","_nestedArray","clearCache","namespace","addJSON","toArray","nestedArray","nestedJson","names","methods","getEnum","prev","setOptions","onAdd","onRemove","define","isArray","ptr","part","resolveAll","lookup","filterTypes","parentAlreadyChecked","found","lookupEnum","lookupService","Service_","Enum_","parsedOptions","defineProperties","unshift","_handleAdd","_handleRemove","setParsedOption","propName","opt","find","hasOwnProperty","newValue","setProperty","newOpt","Root_","fieldNames","addFieldsToParent","oneofName","oneOfGetter","set","oneOfSetter","keepCase","base10Re","base10NegRe","base16Re","base16NegRe","base8Re","base8NegRe","numberRe","nameRe","typeRefRe","fqTypeRefRe","pkg","imports","weakImports","syntax","token","preferTrailingComment","tn","alternateCommentMode","next","peek","skip","cmnt","head","isProto3","applyCase","camelCase","illegal","insideTryCatch","line","readString","readValue","acceptTypeRef","substring","parseInt","parseFloat","parseNumber","readRanges","target","acceptStrings","parseId","acceptNegative","parsePackage","parseImport","whichImports","parseSyntax","parseCommon","parseOption","ifBlock","valueType","parseInlineOptions","parseMapField","parseField","parseOneOf","extensions","parseType","dummy","parseEnumValue","parseEnum","service","commentText","method","parseMethod","parseService","reference","parseExtension","fnIf","fnElse","trailingLine","lcFirst","ucFirst","parseGroup","isCustom","option","substr","optionValue","parseOptionValue","result","prevValue","concat","simpleValue","package","LongBits","indexOutOfRange","writeLength","RangeError","Buffer","isBuffer","create_array","readLongVarint","bits","readFixed32_end","readFixed64","_slice","subarray","uint32","int32","sint32","bool","fixed32","sfixed32","float","double","skipType","BufferReader_","merge","int64","uint64","sint64","zzDecode","fixed64","sfixed64","utf8Slice","min","deferred","files","SYNC","resolvePath","self","sync","finish","cb","getBundledFileName","idx","lastIndexOf","altname","process","parsed","queued","weak","setTimeout","readFileSync","isNode","exposeRe","tryHandleExtension","extendedType","sisterField","parse_","common_","rpcImpl","requestDelimited","responseDelimited","rpcCall","requestCtor","responseCtor","request","endedByRPC","_methodsArray","inherited","methodsArray","rpcService","methodName","isReserved","m","q","s","delimRe","stringDoubleRe","stringSingleRe","setCommentRe","setCommentAltRe","setCommentSplitRe","whitespaceRe","unescapeRe","unescapeMap","0","r","unescape","str","commentType","commentLine","commentLineEmpty","commentIsLeading","stack","stringDelim","subject","charAt","setComment","isLeading","commentOffset","lines","trim","isDoubleSlashCommentLine","startOffset","endOffset","findEndOfLine","lineText","cursor","re","lastIndex","match","exec","repeat","curr","isDoc","isLeadingComment","expected","actual","ret","_fieldsById","_oneofsArray","_ctor","fieldsById","oneofsArray","generateConstructor","ctorProperties","setup","wrapper","originalThis","fork","ldelim","typeName","bake","o","key","safePropBackslashRe","safePropQuoteRe","toUpperCase","camelCaseRe","a","decorateRoot","enumerable","decorateEnumIndex","dst","setProp","zero","zzEncode","zeroHash","from","fromString","toLong","fromHash","hash","toHash","mask","part0","part1","part2","src","newError","CustomError","captureStackTrace","pool","global","versions","node","window","Number","isFinite","isset","isSet","utf8Write","_Buffer_from","_Buffer_allocUnsafe","sizeOrArray","dcodeIO","key2Re","key32Re","key64Re","longToHash","longFromHash","fromBits","ProtocolError","fieldMap","longs","enums","encoding","allocUnsafe","seenFirstField","invalid","genVerifyKey","genVerifyValue","oneofProp","Op","noop","State","tail","states","writeByte","VarintOp","writeVarint64","writeFixed32","_push","writeBytes","reset","BufferWriter_","writeStringBuffer","writeBytesBuffer","copy","byteLength","$require","$module","amd","isLong"],"mappings":";;;;;;CAAA,SAAAA,IAAA,aAAA,IAAAC,EAAAC,EAAAC,EAcAC,EAdAH,EAiCA,CAAAI,EAAA,CAAA,SAAAC,EAAAC,GChCAA,EAAAC,QAmBA,SAAAC,EAAAC,GACA,IAAAC,EAAAC,MAAAC,UAAAC,OAAA,GACAC,EAAA,EACAC,EAAA,EACAC,GAAA,EACA,KAAAD,EAAAH,UAAAC,QACAH,EAAAI,KAAAF,UAAAG,KACA,OAAA,IAAAE,QAAA,SAAAC,EAAAC,GACAT,EAAAI,GAAA,SAAAM,GACA,GAAAJ,EAEA,GADAA,GAAA,EACAI,EACAD,EAAAC,OACA,CAGA,IAFA,IAAAV,EAAAC,MAAAC,UAAAC,OAAA,GACAC,EAAA,EACAA,EAAAJ,EAAAG,QACAH,EAAAI,KAAAF,UAAAE,GACAI,EAAAG,MAAA,KAAAX,KAIA,IACAF,EAAAa,MAAAZ,GAAA,KAAAC,GACA,MAAAU,GACAJ,IACAA,GAAA,EACAG,EAAAC,gCCxCA,IAAAE,EAAAf,EAOAe,EAAAT,OAAA,SAAAU,GACA,IAAAC,EAAAD,EAAAV,OACA,IAAAW,EACA,OAAA,EAEA,IADA,IAAAC,EAAA,EACA,IAAAD,EAAA,GAAA,KAAAD,EAAAA,EAAAC,MACAC,EACA,OAAAC,KAAAC,KAAA,EAAAJ,EAAAV,QAAA,EAAAY,GAUA,IANA,IAAAG,EAAAjB,MAAA,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CAAA,QAAA,SAAApF,GAKA,OAJAA,GAAAA,EAAA0Z,SACAltB,EAAA2O,KAAA6E,KAAAA,EACAxT,EAAAiW,aAEAjW,IAIA,iBAAAG,QAAAA,QAAAA,OAAAC,UACAD,OAAAC,QAAAJ,GA/BA","file":"protobuf.min.js","sourcesContent":["(function prelude(modules, cache, entries) {\n\n // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS\n // sources through a conflict-free require shim and is again wrapped within an iife that\n // provides a minification-friendly `undefined` var plus a global \"use strict\" directive\n // so that minification can remove the directives of each module.\n\n function $require(name) {\n var $module = cache[name];\n if (!$module)\n modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);\n return $module.exports;\n }\n\n var protobuf = $require(entries[0]);\n\n // Expose globally\n protobuf.util.global.protobuf = protobuf;\n\n // Be nice to AMD\n if (typeof define === \"function\" && define.amd)\n define([\"long\"], function(Long) {\n if (Long && Long.isLong) {\n protobuf.util.Long = Long;\n protobuf.configure();\n }\n return protobuf;\n });\n\n // Be nice to CommonJS\n if (typeof module === \"object\" && module && module.exports)\n module.exports = protobuf;\n\n})/* end of prelude */","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = codegen;\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @param {string[]} functionParams Function parameter names\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n */\r\nfunction codegen(functionParams, functionName) {\r\n\r\n /* istanbul ignore if */\r\n if (typeof functionParams === \"string\") {\r\n functionName = functionParams;\r\n functionParams = undefined;\r\n }\r\n\r\n var body = [];\r\n\r\n /**\r\n * Appends code to the function's body or finishes generation.\r\n * @typedef Codegen\r\n * @type {function}\r\n * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r\n * @param {...*} [formatParams] Format parameters\r\n * @returns {Codegen|Function} Itself or the generated function if finished\r\n * @throws {Error} If format parameter counts do not match\r\n */\r\n\r\n function Codegen(formatStringOrScope) {\r\n // note that explicit array handling below makes this ~50% faster\r\n\r\n // finish the function\r\n if (typeof formatStringOrScope !== \"string\") {\r\n var source = toString();\r\n if (codegen.verbose)\r\n console.log(\"codegen: \" + source); // eslint-disable-line no-console\r\n source = \"return \" + source;\r\n if (formatStringOrScope) {\r\n var scopeKeys = Object.keys(formatStringOrScope),\r\n scopeParams = new Array(scopeKeys.length + 1),\r\n scopeValues = new Array(scopeKeys.length),\r\n scopeOffset = 0;\r\n while (scopeOffset < scopeKeys.length) {\r\n scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r\n scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r\n }\r\n scopeParams[scopeOffset] = source;\r\n return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r\n }\r\n return Function(source)(); // eslint-disable-line no-new-func\r\n }\r\n\r\n // otherwise append to body\r\n var formatParams = new Array(arguments.length - 1),\r\n formatOffset = 0;\r\n while (formatOffset < formatParams.length)\r\n formatParams[formatOffset] = arguments[++formatOffset];\r\n formatOffset = 0;\r\n formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r\n var value = formatParams[formatOffset++];\r\n switch ($1) {\r\n case \"d\": case \"f\": return String(Number(value));\r\n case \"i\": return String(Math.floor(value));\r\n case \"j\": return JSON.stringify(value);\r\n case \"s\": return String(value);\r\n }\r\n return \"%\";\r\n });\r\n if (formatOffset !== formatParams.length)\r\n throw Error(\"parameter count mismatch\");\r\n body.push(formatStringOrScope);\r\n return Codegen;\r\n }\r\n\r\n function toString(functionNameOverride) {\r\n return \"function \" + (functionNameOverride || functionName || \"\") + \"(\" + (functionParams && functionParams.join(\",\") || \"\") + \"){\\n \" + body.join(\"\\n \") + \"\\n}\";\r\n }\r\n\r\n Codegen.toString = toString;\r\n return Codegen;\r\n}\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @function codegen\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * When set to `true`, codegen will log generated code to console. Useful for debugging.\r\n * @name util.codegen.verbose\r\n * @type {boolean}\r\n */\r\ncodegen.verbose = false;\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\nmodule.exports = fetch;\r\n\r\nvar asPromise = require(1),\r\n inquire = require(7);\r\n\r\nvar fs = inquire(\"fs\");\r\n\r\n/**\r\n * Node-style callback as used by {@link util.fetch}.\r\n * @typedef FetchCallback\r\n * @type {function}\r\n * @param {?Error} error Error, if any, otherwise `null`\r\n * @param {string} [contents] File contents, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Options as used by {@link util.fetch}.\r\n * @typedef FetchOptions\r\n * @type {Object}\r\n * @property {boolean} [binary=false] Whether expecting a binary response\r\n * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @memberof util\r\n * @param {string} filename File path or url\r\n * @param {FetchOptions} options Fetch options\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nfunction fetch(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = {};\r\n } else if (!options)\r\n options = {};\r\n\r\n if (!callback)\r\n return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r\n\r\n // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r\n if (!options.xhr && fs && fs.readFile)\r\n return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r\n return err && typeof XMLHttpRequest !== \"undefined\"\r\n ? fetch.xhr(filename, options, callback)\r\n : err\r\n ? callback(err)\r\n : callback(null, options.binary ? contents : contents.toString(\"utf8\"));\r\n });\r\n\r\n // use the XHR version otherwise.\r\n return fetch.xhr(filename, options, callback);\r\n}\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchOptions} [options] Fetch options\r\n * @returns {Promise} Promise\r\n * @variation 3\r\n */\r\n\r\n/**/\r\nfetch.xhr = function fetch_xhr(filename, options, callback) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r\n\r\n if (xhr.readyState !== 4)\r\n return undefined;\r\n\r\n // local cors security errors return status 0 / empty string, too. afaik this cannot be\r\n // reliably distinguished from an actually empty file for security reasons. feel free\r\n // to send a pull request if you are aware of a solution.\r\n if (xhr.status !== 0 && xhr.status !== 200)\r\n return callback(Error(\"status \" + xhr.status));\r\n\r\n // if binary data is expected, make sure that some sort of array is returned, even if\r\n // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r\n if (options.binary) {\r\n var buffer = xhr.response;\r\n if (!buffer) {\r\n buffer = [];\r\n for (var i = 0; i < xhr.responseText.length; ++i)\r\n buffer.push(xhr.responseText.charCodeAt(i) & 255);\r\n }\r\n return callback(null, typeof Uint8Array !== \"undefined\" ? new Uint8Array(buffer) : buffer);\r\n }\r\n return callback(null, xhr.responseText);\r\n };\r\n\r\n if (options.binary) {\r\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r\n if (\"overrideMimeType\" in xhr)\r\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n xhr.open(\"GET\", filename);\r\n xhr.send();\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal path module to resolve Unix, Windows and URL paths alike.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar path = exports;\r\n\r\nvar isAbsolute =\r\n/**\r\n * Tests if the specified path is absolute.\r\n * @param {string} path Path to test\r\n * @returns {boolean} `true` if path is absolute\r\n */\r\npath.isAbsolute = function isAbsolute(path) {\r\n return /^(?:\\/|\\w+:)/.test(path);\r\n};\r\n\r\nvar normalize =\r\n/**\r\n * Normalizes the specified path.\r\n * @param {string} path Path to normalize\r\n * @returns {string} Normalized path\r\n */\r\npath.normalize = function normalize(path) {\r\n path = path.replace(/\\\\/g, \"/\")\r\n .replace(/\\/{2,}/g, \"/\");\r\n var parts = path.split(\"/\"),\r\n absolute = isAbsolute(path),\r\n prefix = \"\";\r\n if (absolute)\r\n prefix = parts.shift() + \"/\";\r\n for (var i = 0; i < parts.length;) {\r\n if (parts[i] === \"..\") {\r\n if (i > 0 && parts[i - 1] !== \"..\")\r\n parts.splice(--i, 2);\r\n else if (absolute)\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n } else if (parts[i] === \".\")\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n return prefix + parts.join(\"/\");\r\n};\r\n\r\n/**\r\n * Resolves the specified include path against the specified origin path.\r\n * @param {string} originPath Path to the origin file\r\n * @param {string} includePath Include path relative to origin path\r\n * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r\n * @returns {string} Path to the include file\r\n */\r\npath.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r\n if (!alreadyNormalized)\r\n includePath = normalize(includePath);\r\n if (isAbsolute(includePath))\r\n return includePath;\r\n if (!alreadyNormalized)\r\n originPath = normalize(originPath);\r\n return (originPath = originPath.replace(/(?:\\/|^)[^/]+$/, \"\")).length ? normalize(originPath + \"/\" + includePath) : includePath;\r\n};\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\nmodule.exports = common;\n\nvar commonRe = /\\/|\\./;\n\n/**\n * Provides common type definitions.\n * Can also be used to provide additional google types or your own custom types.\n * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name\n * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition\n * @returns {undefined}\n * @property {INamespace} google/protobuf/any.proto Any\n * @property {INamespace} google/protobuf/duration.proto Duration\n * @property {INamespace} google/protobuf/empty.proto Empty\n * @property {INamespace} google/protobuf/field_mask.proto FieldMask\n * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue\n * @property {INamespace} google/protobuf/timestamp.proto Timestamp\n * @property {INamespace} google/protobuf/wrappers.proto Wrappers\n * @example\n * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension)\n * protobuf.common(\"descriptor\", descriptorJson);\n *\n * // manually provides a custom definition (uses my.foo namespace)\n * protobuf.common(\"my/foo/bar.proto\", myFooBarJson);\n */\nfunction common(name, json) {\n if (!commonRe.test(name)) {\n name = \"google/protobuf/\" + name + \".proto\";\n json = { nested: { google: { nested: { protobuf: { nested: json } } } } };\n }\n common[name] = json;\n}\n\n// Not provided because of limited use (feel free to discuss or to provide yourself):\n//\n// google/protobuf/descriptor.proto\n// google/protobuf/source_context.proto\n// google/protobuf/type.proto\n//\n// Stripped and pre-parsed versions of these non-bundled files are instead available as part of\n// the repository or package within the google/protobuf directory.\n\ncommon(\"any\", {\n\n /**\n * Properties of a google.protobuf.Any message.\n * @interface IAny\n * @type {Object}\n * @property {string} [typeUrl]\n * @property {Uint8Array} [bytes]\n * @memberof common\n */\n Any: {\n fields: {\n type_url: {\n type: \"string\",\n id: 1\n },\n value: {\n type: \"bytes\",\n id: 2\n }\n }\n }\n});\n\nvar timeType;\n\ncommon(\"duration\", {\n\n /**\n * Properties of a google.protobuf.Duration message.\n * @interface IDuration\n * @type {Object}\n * @property {number|Long} [seconds]\n * @property {number} [nanos]\n * @memberof common\n */\n Duration: timeType = {\n fields: {\n seconds: {\n type: \"int64\",\n id: 1\n },\n nanos: {\n type: \"int32\",\n id: 2\n }\n }\n }\n});\n\ncommon(\"timestamp\", {\n\n /**\n * Properties of a google.protobuf.Timestamp message.\n * @interface ITimestamp\n * @type {Object}\n * @property {number|Long} [seconds]\n * @property {number} [nanos]\n * @memberof common\n */\n Timestamp: timeType\n});\n\ncommon(\"empty\", {\n\n /**\n * Properties of a google.protobuf.Empty message.\n * @interface IEmpty\n * @memberof common\n */\n Empty: {\n fields: {}\n }\n});\n\ncommon(\"struct\", {\n\n /**\n * Properties of a google.protobuf.Struct message.\n * @interface IStruct\n * @type {Object}\n * @property {Object.} [fields]\n * @memberof common\n */\n Struct: {\n fields: {\n fields: {\n keyType: \"string\",\n type: \"Value\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Value message.\n * @interface IValue\n * @type {Object}\n * @property {string} [kind]\n * @property {0} [nullValue]\n * @property {number} [numberValue]\n * @property {string} [stringValue]\n * @property {boolean} [boolValue]\n * @property {IStruct} [structValue]\n * @property {IListValue} [listValue]\n * @memberof common\n */\n Value: {\n oneofs: {\n kind: {\n oneof: [\n \"nullValue\",\n \"numberValue\",\n \"stringValue\",\n \"boolValue\",\n \"structValue\",\n \"listValue\"\n ]\n }\n },\n fields: {\n nullValue: {\n type: \"NullValue\",\n id: 1\n },\n numberValue: {\n type: \"double\",\n id: 2\n },\n stringValue: {\n type: \"string\",\n id: 3\n },\n boolValue: {\n type: \"bool\",\n id: 4\n },\n structValue: {\n type: \"Struct\",\n id: 5\n },\n listValue: {\n type: \"ListValue\",\n id: 6\n }\n }\n },\n\n NullValue: {\n values: {\n NULL_VALUE: 0\n }\n },\n\n /**\n * Properties of a google.protobuf.ListValue message.\n * @interface IListValue\n * @type {Object}\n * @property {Array.} [values]\n * @memberof common\n */\n ListValue: {\n fields: {\n values: {\n rule: \"repeated\",\n type: \"Value\",\n id: 1\n }\n }\n }\n});\n\ncommon(\"wrappers\", {\n\n /**\n * Properties of a google.protobuf.DoubleValue message.\n * @interface IDoubleValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n DoubleValue: {\n fields: {\n value: {\n type: \"double\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.FloatValue message.\n * @interface IFloatValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n FloatValue: {\n fields: {\n value: {\n type: \"float\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Int64Value message.\n * @interface IInt64Value\n * @type {Object}\n * @property {number|Long} [value]\n * @memberof common\n */\n Int64Value: {\n fields: {\n value: {\n type: \"int64\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.UInt64Value message.\n * @interface IUInt64Value\n * @type {Object}\n * @property {number|Long} [value]\n * @memberof common\n */\n UInt64Value: {\n fields: {\n value: {\n type: \"uint64\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.Int32Value message.\n * @interface IInt32Value\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n Int32Value: {\n fields: {\n value: {\n type: \"int32\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.UInt32Value message.\n * @interface IUInt32Value\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n UInt32Value: {\n fields: {\n value: {\n type: \"uint32\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.BoolValue message.\n * @interface IBoolValue\n * @type {Object}\n * @property {boolean} [value]\n * @memberof common\n */\n BoolValue: {\n fields: {\n value: {\n type: \"bool\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.StringValue message.\n * @interface IStringValue\n * @type {Object}\n * @property {string} [value]\n * @memberof common\n */\n StringValue: {\n fields: {\n value: {\n type: \"string\",\n id: 1\n }\n }\n },\n\n /**\n * Properties of a google.protobuf.BytesValue message.\n * @interface IBytesValue\n * @type {Object}\n * @property {Uint8Array} [value]\n * @memberof common\n */\n BytesValue: {\n fields: {\n value: {\n type: \"bytes\",\n id: 1\n }\n }\n }\n});\n\ncommon(\"field_mask\", {\n\n /**\n * Properties of a google.protobuf.FieldMask message.\n * @interface IDoubleValue\n * @type {Object}\n * @property {number} [value]\n * @memberof common\n */\n FieldMask: {\n fields: {\n paths: {\n rule: \"repeated\",\n type: \"string\",\n id: 1\n }\n }\n }\n});\n\n/**\n * Gets the root definition of the specified common proto file.\n *\n * Bundled definitions are:\n * - google/protobuf/any.proto\n * - google/protobuf/duration.proto\n * - google/protobuf/empty.proto\n * - google/protobuf/field_mask.proto\n * - google/protobuf/struct.proto\n * - google/protobuf/timestamp.proto\n * - google/protobuf/wrappers.proto\n *\n * @param {string} file Proto file name\n * @returns {INamespace|null} Root definition or `null` if not defined\n */\ncommon.get = function get(file) {\n return common[file] || null;\n};\n","\"use strict\";\n/**\n * Runtime message from/to plain object converters.\n * @namespace\n */\nvar converter = exports;\n\nvar Enum = require(15),\n util = require(37);\n\n/**\n * Generates a partial value fromObject conveter.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} prop Property reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genValuePartial_fromObject(gen, field, fieldIndex, prop) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(d%s){\", prop);\n for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {\n if (field.repeated && values[keys[i]] === field.typeDefault) gen\n (\"default:\");\n gen\n (\"case%j:\", keys[i])\n (\"case %i:\", values[keys[i]])\n (\"m%s=%j\", prop, values[keys[i]])\n (\"break\");\n } gen\n (\"}\");\n } else gen\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s=types[%i].fromObject(d%s)\", prop, fieldIndex, prop);\n } else {\n var isUnsigned = false;\n switch (field.type) {\n case \"double\":\n case \"float\": gen\n (\"m%s=Number(d%s)\", prop, prop); // also catches \"NaN\", \"Infinity\"\n break;\n case \"uint32\":\n case \"fixed32\": gen\n (\"m%s=d%s>>>0\", prop, prop);\n break;\n case \"int32\":\n case \"sint32\":\n case \"sfixed32\": gen\n (\"m%s=d%s|0\", prop, prop);\n break;\n case \"uint64\":\n isUnsigned = true;\n // eslint-disable-line no-fallthrough\n case \"int64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(util.Long)\")\n (\"(m%s=util.Long.fromValue(d%s)).unsigned=%j\", prop, prop, isUnsigned)\n (\"else if(typeof d%s===\\\"string\\\")\", prop)\n (\"m%s=parseInt(d%s,10)\", prop, prop)\n (\"else if(typeof d%s===\\\"number\\\")\", prop)\n (\"m%s=d%s\", prop, prop)\n (\"else if(typeof d%s===\\\"object\\\")\", prop)\n (\"m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)\", prop, prop, prop, isUnsigned ? \"true\" : \"\");\n break;\n case \"bytes\": gen\n (\"if(typeof d%s===\\\"string\\\")\", prop)\n (\"util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)\", prop, prop, prop)\n (\"else if(d%s.length)\", prop)\n (\"m%s=d%s\", prop, prop);\n break;\n case \"string\": gen\n (\"m%s=String(d%s)\", prop, prop);\n break;\n case \"bool\": gen\n (\"m%s=Boolean(d%s)\", prop, prop);\n break;\n /* default: gen\n (\"m%s=d%s\", prop, prop);\n break; */\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a plain object to runtime message converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.fromObject = function fromObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray;\n var gen = util.codegen([\"d\"], mtype.name + \"$fromObject\")\n (\"if(d instanceof this.ctor)\")\n (\"return d\");\n if (!fields.length) return gen\n (\"return new this.ctor\");\n gen\n (\"var m=new this.ctor\");\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n prop = util.safeProp(field.name);\n\n // Map fields\n if (field.map) { gen\n (\"if(d%s){\", prop)\n (\"if(typeof d%s!==\\\"object\\\")\", prop)\n (\"throw TypeError(%j)\", field.fullName + \": object expected\")\n (\"m%s={}\", prop)\n (\"for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s\", prop, prop, prop, prop, isUnsigned ? \"true\": \"\", prop);\n break;\n case \"bytes\": gen\n (\"d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s\", prop, prop, prop, prop, prop);\n break;\n default: gen\n (\"d%s=m%s\", prop, prop);\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n\n/**\n * Generates a runtime message to plain object converter specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nconverter.toObject = function toObject(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);\n if (!fields.length)\n return util.codegen()(\"return {}\");\n var gen = util.codegen([\"m\", \"o\"], mtype.name + \"$toObject\")\n (\"if(!o)\")\n (\"o={}\")\n (\"var d={}\");\n\n var repeatedFields = [],\n mapFields = [],\n normalFields = [],\n i = 0;\n for (; i < fields.length; ++i)\n if (!fields[i].partOf)\n ( fields[i].resolve().repeated ? repeatedFields\n : fields[i].map ? mapFields\n : normalFields).push(fields[i]);\n\n if (repeatedFields.length) { gen\n (\"if(o.arrays||o.defaults){\");\n for (i = 0; i < repeatedFields.length; ++i) gen\n (\"d%s=[]\", util.safeProp(repeatedFields[i].name));\n gen\n (\"}\");\n }\n\n if (mapFields.length) { gen\n (\"if(o.objects||o.defaults){\");\n for (i = 0; i < mapFields.length; ++i) gen\n (\"d%s={}\", util.safeProp(mapFields[i].name));\n gen\n (\"}\");\n }\n\n if (normalFields.length) { gen\n (\"if(o.defaults){\");\n for (i = 0; i < normalFields.length; ++i) {\n var field = normalFields[i],\n prop = util.safeProp(field.name);\n if (field.resolvedType instanceof Enum) gen\n (\"d%s=o.enums===String?%j:%j\", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);\n else if (field.long) gen\n (\"if(util.Long){\")\n (\"var n=new util.Long(%i,%i,%j)\", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)\n (\"d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n\", prop)\n (\"}else\")\n (\"d%s=o.longs===String?%j:%i\", prop, field.typeDefault.toString(), field.typeDefault.toNumber());\n else if (field.bytes) {\n var arrayDefault = \"[\" + Array.prototype.slice.call(field.typeDefault).join(\",\") + \"]\";\n gen\n (\"if(o.bytes===String)d%s=%j\", prop, String.fromCharCode.apply(String, field.typeDefault))\n (\"else{\")\n (\"d%s=%s\", prop, arrayDefault)\n (\"if(o.bytes!==Array)d%s=util.newBuffer(d%s)\", prop, prop)\n (\"}\");\n } else gen\n (\"d%s=%j\", prop, field.typeDefault); // also messages (=null)\n } gen\n (\"}\");\n }\n var hasKs2 = false;\n for (i = 0; i < fields.length; ++i) {\n var field = fields[i],\n index = mtype._fieldsArray.indexOf(field),\n prop = util.safeProp(field.name);\n if (field.map) {\n if (!hasKs2) { hasKs2 = true; gen\n (\"var ks2\");\n } gen\n (\"if(m%s&&(ks2=Object.keys(m%s)).length){\", prop, prop)\n (\"d%s={}\", prop)\n (\"for(var j=0;j>>3){\");\n\n var i = 0;\n for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n ref = \"m\" + util.safeProp(field.name); gen\n (\"case %i:\", field.id);\n\n // Map fields\n if (field.map) { gen\n (\"if(%s===util.emptyObject)\", ref)\n (\"%s={}\", ref)\n (\"var c2 = r.uint32()+r.pos\");\n\n if (types.defaults[field.keyType] !== undefined) gen\n (\"k=%j\", types.defaults[field.keyType]);\n else gen\n (\"k=null\");\n\n if (types.defaults[type] !== undefined) gen\n (\"value=%j\", types.defaults[type]);\n else gen\n (\"value=null\");\n\n gen\n (\"while(r.pos>>3){\")\n (\"case 1: k=r.%s(); break\", field.keyType)\n (\"case 2:\");\n\n if (types.basic[type] === undefined) gen\n (\"value=types[%i].decode(r,r.uint32())\", i); // can't be groups\n else gen\n (\"value=r.%s()\", type);\n\n gen\n (\"break\")\n (\"default:\")\n (\"r.skipType(tag2&7)\")\n (\"break\")\n (\"}\")\n (\"}\");\n\n if (types.long[field.keyType] !== undefined) gen\n (\"%s[typeof k===\\\"object\\\"?util.longToHash(k):k]=value\", ref);\n else gen\n (\"%s[k]=value\", ref);\n\n // Repeated fields\n } else if (field.repeated) { gen\n\n (\"if(!(%s&&%s.length))\", ref, ref)\n (\"%s=[]\", ref);\n\n // Packable (always check for forward and backward compatiblity)\n if (types.packed[type] !== undefined) gen\n (\"if((t&7)===2){\")\n (\"var c2=r.uint32()+r.pos\")\n (\"while(r.pos>> 0, (field.id << 3 | 4) >>> 0)\n : gen(\"types[%i].encode(%s,w.uint32(%i).fork()).ldelim()\", fieldIndex, ref, (field.id << 3 | 2) >>> 0);\n}\n\n/**\n * Generates an encoder specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction encoder(mtype) {\n /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */\n var gen = util.codegen([\"m\", \"w\"], mtype.name + \"$encode\")\n (\"if(!w)\")\n (\"w=Writer.create()\");\n\n var i, ref;\n\n // \"when a message is serialized its known fields should be written sequentially by field number\"\n var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);\n\n for (var i = 0; i < fields.length; ++i) {\n var field = fields[i].resolve(),\n index = mtype._fieldsArray.indexOf(field),\n type = field.resolvedType instanceof Enum ? \"int32\" : field.type,\n wireType = types.basic[type];\n ref = \"m\" + util.safeProp(field.name);\n\n // Map fields\n if (field.map) {\n gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j)){\", ref, field.name) // !== undefined && !== null\n (\"for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType);\n if (wireType === undefined) gen\n (\"types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()\", index, ref); // can't be groups\n else gen\n (\".uint32(%i).%s(%s[ks[i]]).ldelim()\", 16 | wireType, type, ref);\n gen\n (\"}\")\n (\"}\");\n\n // Repeated fields\n } else if (field.repeated) { gen\n (\"if(%s!=null&&%s.length){\", ref, ref); // !== undefined && !== null\n\n // Packed repeated\n if (field.packed && types.packed[type] !== undefined) { gen\n\n (\"w.uint32(%i).fork()\", (field.id << 3 | 2) >>> 0)\n (\"for(var i=0;i<%s.length;++i)\", ref)\n (\"w.%s(%s[i])\", type, ref)\n (\"w.ldelim()\");\n\n // Non-packed\n } else { gen\n\n (\"for(var i=0;i<%s.length;++i)\", ref);\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref + \"[i]\");\n else gen\n (\"w.uint32(%i).%s(%s[i])\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n } gen\n (\"}\");\n\n // Non-repeated\n } else {\n if (field.optional) gen\n (\"if(%s!=null&&Object.hasOwnProperty.call(m,%j))\", ref, field.name); // !== undefined && !== null\n\n if (wireType === undefined)\n genTypePartial(gen, field, index, ref);\n else gen\n (\"w.uint32(%i).%s(%s)\", (field.id << 3 | wireType) >>> 0, type, ref);\n\n }\n }\n\n return gen\n (\"return w\");\n /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */\n}\n","\"use strict\";\nmodule.exports = Enum;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = \"Enum\";\n\nvar Namespace = require(23),\n util = require(37);\n\n/**\n * Constructs a new enum instance.\n * @classdesc Reflected enum.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {Object.} [values] Enum values as an object, by name\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this enum\n * @param {Object.} [comments] The value comments for this enum\n */\nfunction Enum(name, values, options, comment, comments) {\n ReflectionObject.call(this, name, options);\n\n if (values && typeof values !== \"object\")\n throw TypeError(\"values must be an object\");\n\n /**\n * Enum values by id.\n * @type {Object.}\n */\n this.valuesById = {};\n\n /**\n * Enum values by name.\n * @type {Object.}\n */\n this.values = Object.create(this.valuesById); // toJSON, marker\n\n /**\n * Enum comment text.\n * @type {string|null}\n */\n this.comment = comment;\n\n /**\n * Value comment texts, if any.\n * @type {Object.}\n */\n this.comments = comments || {};\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n // Note that values inherit valuesById on their prototype which makes them a TypeScript-\n // compatible enum. This is used by pbts to write actual enum definitions that work for\n // static and reflection code alike instead of emitting generic object definitions.\n\n if (values)\n for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)\n if (typeof values[keys[i]] === \"number\") // use forward entries only\n this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];\n}\n\n/**\n * Enum descriptor.\n * @interface IEnum\n * @property {Object.} values Enum values\n * @property {Object.} [options] Enum options\n */\n\n/**\n * Constructs an enum from an enum descriptor.\n * @param {string} name Enum name\n * @param {IEnum} json Enum descriptor\n * @returns {Enum} Created enum\n * @throws {TypeError} If arguments are invalid\n */\nEnum.fromJSON = function fromJSON(name, json) {\n var enm = new Enum(name, json.values, json.options, json.comment, json.comments);\n enm.reserved = json.reserved;\n return enm;\n};\n\n/**\n * Converts this enum to an enum descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IEnum} Enum descriptor\n */\nEnum.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"values\" , this.values,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"comment\" , keepComments ? this.comment : undefined,\n \"comments\" , keepComments ? this.comments : undefined\n ]);\n};\n\n/**\n * Adds a value to this enum.\n * @param {string} name Value name\n * @param {number} id Value id\n * @param {string} [comment] Comment, if any\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a value with this name or id\n */\nEnum.prototype.add = function add(name, id, comment) {\n // utilized by the parser but not by .fromJSON\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (!util.isInteger(id))\n throw TypeError(\"id must be an integer\");\n\n if (this.values[name] !== undefined)\n throw Error(\"duplicate name '\" + name + \"' in \" + this);\n\n if (this.isReservedId(id))\n throw Error(\"id \" + id + \" is reserved in \" + this);\n\n if (this.isReservedName(name))\n throw Error(\"name '\" + name + \"' is reserved in \" + this);\n\n if (this.valuesById[id] !== undefined) {\n if (!(this.options && this.options.allow_alias))\n throw Error(\"duplicate id \" + id + \" in \" + this);\n this.values[name] = id;\n } else\n this.valuesById[this.values[name] = id] = name;\n\n this.comments[name] = comment || null;\n return this;\n};\n\n/**\n * Removes a value from this enum\n * @param {string} name Value name\n * @returns {Enum} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `name` is not a name of this enum\n */\nEnum.prototype.remove = function remove(name) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n var val = this.values[name];\n if (val == null)\n throw Error(\"name '\" + name + \"' does not exist in \" + this);\n\n delete this.valuesById[val];\n delete this.values[name];\n delete this.comments[name];\n\n return this;\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nEnum.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n","\"use strict\";\nmodule.exports = Field;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = \"Field\";\n\nvar Enum = require(15),\n types = require(36),\n util = require(37);\n\nvar Type; // cyclic\n\nvar ruleRe = /^required|optional|repeated$/;\n\n/**\n * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.\n * @name Field\n * @classdesc Reflected message field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a field from a field descriptor.\n * @param {string} name Field name\n * @param {IField} json Field descriptor\n * @returns {Field} Created field\n * @throws {TypeError} If arguments are invalid\n */\nField.fromJSON = function fromJSON(name, json) {\n return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);\n};\n\n/**\n * Not an actual constructor. Use {@link Field} instead.\n * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports FieldBase\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} type Value type\n * @param {string|Object.} [rule=\"optional\"] Field rule\n * @param {string|Object.} [extend] Extended type if different from parent\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction Field(name, id, type, rule, extend, options, comment) {\n\n if (util.isObject(rule)) {\n comment = extend;\n options = rule;\n rule = extend = undefined;\n } else if (util.isObject(extend)) {\n comment = options;\n options = extend;\n extend = undefined;\n }\n\n ReflectionObject.call(this, name, options);\n\n if (!util.isInteger(id) || id < 0)\n throw TypeError(\"id must be a non-negative integer\");\n\n if (!util.isString(type))\n throw TypeError(\"type must be a string\");\n\n if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase()))\n throw TypeError(\"rule must be a string rule\");\n\n if (extend !== undefined && !util.isString(extend))\n throw TypeError(\"extend must be a string\");\n\n /**\n * Field rule, if any.\n * @type {string|undefined}\n */\n this.rule = rule && rule !== \"optional\" ? rule : undefined; // toJSON\n\n /**\n * Field type.\n * @type {string}\n */\n this.type = type; // toJSON\n\n /**\n * Unique field id.\n * @type {number}\n */\n this.id = id; // toJSON, marker\n\n /**\n * Extended type if different from parent.\n * @type {string|undefined}\n */\n this.extend = extend || undefined; // toJSON\n\n /**\n * Whether this field is required.\n * @type {boolean}\n */\n this.required = rule === \"required\";\n\n /**\n * Whether this field is optional.\n * @type {boolean}\n */\n this.optional = !this.required;\n\n /**\n * Whether this field is repeated.\n * @type {boolean}\n */\n this.repeated = rule === \"repeated\";\n\n /**\n * Whether this field is a map or not.\n * @type {boolean}\n */\n this.map = false;\n\n /**\n * Message this field belongs to.\n * @type {Type|null}\n */\n this.message = null;\n\n /**\n * OneOf this field belongs to, if any,\n * @type {OneOf|null}\n */\n this.partOf = null;\n\n /**\n * The field type's default value.\n * @type {*}\n */\n this.typeDefault = null;\n\n /**\n * The field's default value on prototypes.\n * @type {*}\n */\n this.defaultValue = null;\n\n /**\n * Whether this field's value should be treated as a long.\n * @type {boolean}\n */\n this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false;\n\n /**\n * Whether this field's value is a buffer.\n * @type {boolean}\n */\n this.bytes = type === \"bytes\";\n\n /**\n * Resolved type if not a basic type.\n * @type {Type|Enum|null}\n */\n this.resolvedType = null;\n\n /**\n * Sister-field within the extended type if a declaring extension field.\n * @type {Field|null}\n */\n this.extensionField = null;\n\n /**\n * Sister-field within the declaring namespace if an extended field.\n * @type {Field|null}\n */\n this.declaringField = null;\n\n /**\n * Internally remembers whether this field is packed.\n * @type {boolean|null}\n * @private\n */\n this._packed = null;\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Determines whether this field is packed. Only relevant when repeated and working with proto2.\n * @name Field#packed\n * @type {boolean}\n * @readonly\n */\nObject.defineProperty(Field.prototype, \"packed\", {\n get: function() {\n // defaults to packed=true if not explicity set to false\n if (this._packed === null)\n this._packed = this.getOption(\"packed\") !== false;\n return this._packed;\n }\n});\n\n/**\n * @override\n */\nField.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (name === \"packed\") // clear cached before setting\n this._packed = null;\n return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);\n};\n\n/**\n * Field descriptor.\n * @interface IField\n * @property {string} [rule=\"optional\"] Field rule\n * @property {string} type Field type\n * @property {number} id Field id\n * @property {Object.} [options] Field options\n */\n\n/**\n * Extension field descriptor.\n * @interface IExtensionField\n * @extends IField\n * @property {string} extend Extended type\n */\n\n/**\n * Converts this field to a field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IField} Field descriptor\n */\nField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"rule\" , this.rule !== \"optional\" && this.rule || undefined,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Resolves this field's type references.\n * @returns {Field} `this`\n * @throws {Error} If any reference cannot be resolved\n */\nField.prototype.resolve = function resolve() {\n\n if (this.resolved)\n return this;\n\n if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it\n this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);\n if (this.resolvedType instanceof Type)\n this.typeDefault = null;\n else // instanceof Enum\n this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined\n }\n\n // use explicitly set default value if present\n if (this.options && this.options[\"default\"] != null) {\n this.typeDefault = this.options[\"default\"];\n if (this.resolvedType instanceof Enum && typeof this.typeDefault === \"string\")\n this.typeDefault = this.resolvedType.values[this.typeDefault];\n }\n\n // remove unnecessary options\n if (this.options) {\n if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))\n delete this.options.packed;\n if (!Object.keys(this.options).length)\n this.options = undefined;\n }\n\n // convert to internal data type if necesssary\n if (this.long) {\n this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === \"u\");\n\n /* istanbul ignore else */\n if (Object.freeze)\n Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it)\n\n } else if (this.bytes && typeof this.typeDefault === \"string\") {\n var buf;\n if (util.base64.test(this.typeDefault))\n util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);\n else\n util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);\n this.typeDefault = buf;\n }\n\n // take special care of maps and repeated fields\n if (this.map)\n this.defaultValue = util.emptyObject;\n else if (this.repeated)\n this.defaultValue = util.emptyArray;\n else\n this.defaultValue = this.typeDefault;\n\n // ensure proper value on prototype\n if (this.parent instanceof Type)\n this.parent.ctor.prototype[this.name] = this.defaultValue;\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n\n/**\n * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).\n * @typedef FieldDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} fieldName Field name\n * @returns {undefined}\n */\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"string\"|\"bool\"|\"bytes\"|Object} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @param {T} [defaultValue] Default value\n * @returns {FieldDecorator} Decorator function\n * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]\n */\nField.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {\n\n // submessage: decorate the submessage and use its name as the type\n if (typeof fieldType === \"function\")\n fieldType = util.decorateType(fieldType).name;\n\n // enum reference: create a reflected copy of the enum and keep reuseing it\n else if (fieldType && typeof fieldType === \"object\")\n fieldType = util.decorateEnum(fieldType).name;\n\n return function fieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new Field(fieldName, fieldId, fieldType, fieldRule, { \"default\": defaultValue }));\n };\n};\n\n/**\n * Field decorator (TypeScript).\n * @name Field.d\n * @function\n * @param {number} fieldId Field id\n * @param {Constructor|string} fieldType Field type\n * @param {\"optional\"|\"required\"|\"repeated\"} [fieldRule=\"optional\"] Field rule\n * @returns {FieldDecorator} Decorator function\n * @template T extends Message\n * @variation 2\n */\n// like Field.d but without a default value\n\n// Sets up cyclic dependencies (called in index-light)\nField._configure = function configure(Type_) {\n Type = Type_;\n};\n","\"use strict\";\nvar protobuf = module.exports = require(18);\n\nprotobuf.build = \"light\";\n\n/**\n * A node-style callback as used by {@link load} and {@link Root#load}.\n * @typedef LoadCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Root} [root] Root, if there hasn't been an error\n * @returns {undefined}\n */\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} root Root namespace, defaults to create a new one if omitted.\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n */\nfunction load(filename, root, callback) {\n if (typeof root === \"function\") {\n callback = root;\n root = new protobuf.Root();\n } else if (!root)\n root = new protobuf.Root();\n return root.load(filename, callback);\n}\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @see {@link Root#load}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise.\n * @name load\n * @function\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Promise} Promise\n * @see {@link Root#load}\n * @variation 3\n */\n// function load(filename:string, [root:Root]):Promise\n\nprotobuf.load = load;\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).\n * @param {string|string[]} filename One or multiple files to load\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n * @see {@link Root#loadSync}\n */\nfunction loadSync(filename, root) {\n if (!root)\n root = new protobuf.Root();\n return root.loadSync(filename);\n}\n\nprotobuf.loadSync = loadSync;\n\n// Serialization\nprotobuf.encoder = require(14);\nprotobuf.decoder = require(13);\nprotobuf.verifier = require(40);\nprotobuf.converter = require(12);\n\n// Reflection\nprotobuf.ReflectionObject = require(24);\nprotobuf.Namespace = require(23);\nprotobuf.Root = require(29);\nprotobuf.Enum = require(15);\nprotobuf.Type = require(35);\nprotobuf.Field = require(16);\nprotobuf.OneOf = require(25);\nprotobuf.MapField = require(20);\nprotobuf.Service = require(33);\nprotobuf.Method = require(22);\n\n// Runtime\nprotobuf.Message = require(21);\nprotobuf.wrappers = require(41);\n\n// Utility\nprotobuf.types = require(36);\nprotobuf.util = require(37);\n\n// Set up possibly cyclic reflection dependencies\nprotobuf.ReflectionObject._configure(protobuf.Root);\nprotobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);\nprotobuf.Root._configure(protobuf.Type);\nprotobuf.Field._configure(protobuf.Type);\n","\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(42);\nprotobuf.BufferWriter = require(43);\nprotobuf.Reader = require(27);\nprotobuf.BufferReader = require(28);\n\n// Utility\nprotobuf.util = require(39);\nprotobuf.rpc = require(31);\nprotobuf.roots = require(30);\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n","\"use strict\";\nvar protobuf = module.exports = require(17);\n\nprotobuf.build = \"full\";\n\n// Parser\nprotobuf.tokenize = require(34);\nprotobuf.parse = require(26);\nprotobuf.common = require(11);\n\n// Configure parser\nprotobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common);\n","\"use strict\";\nmodule.exports = MapField;\n\n// extends Field\nvar Field = require(16);\n((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = \"MapField\";\n\nvar types = require(36),\n util = require(37);\n\n/**\n * Constructs a new map field instance.\n * @classdesc Reflected map field.\n * @extends FieldBase\n * @constructor\n * @param {string} name Unique name within its namespace\n * @param {number} id Unique id within its namespace\n * @param {string} keyType Key type\n * @param {string} type Value type\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction MapField(name, id, keyType, type, options, comment) {\n Field.call(this, name, id, type, undefined, undefined, options, comment);\n\n /* istanbul ignore if */\n if (!util.isString(keyType))\n throw TypeError(\"keyType must be a string\");\n\n /**\n * Key type.\n * @type {string}\n */\n this.keyType = keyType; // toJSON, marker\n\n /**\n * Resolved key type if not a basic type.\n * @type {ReflectionObject|null}\n */\n this.resolvedKeyType = null;\n\n // Overrides Field#map\n this.map = true;\n}\n\n/**\n * Map field descriptor.\n * @interface IMapField\n * @extends {IField}\n * @property {string} keyType Key type\n */\n\n/**\n * Extension map field descriptor.\n * @interface IExtensionMapField\n * @extends IMapField\n * @property {string} extend Extended type\n */\n\n/**\n * Constructs a map field from a map field descriptor.\n * @param {string} name Field name\n * @param {IMapField} json Map field descriptor\n * @returns {MapField} Created map field\n * @throws {TypeError} If arguments are invalid\n */\nMapField.fromJSON = function fromJSON(name, json) {\n return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);\n};\n\n/**\n * Converts this map field to a map field descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMapField} Map field descriptor\n */\nMapField.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"keyType\" , this.keyType,\n \"type\" , this.type,\n \"id\" , this.id,\n \"extend\" , this.extend,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMapField.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n\n // Besides a value type, map fields have a key type that may be \"any scalar type except for floating point types and bytes\"\n if (types.mapKey[this.keyType] === undefined)\n throw Error(\"invalid key type: \" + this.keyType);\n\n return Field.prototype.resolve.call(this);\n};\n\n/**\n * Map field decorator (TypeScript).\n * @name MapField.d\n * @function\n * @param {number} fieldId Field id\n * @param {\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"} fieldKeyType Field key type\n * @param {\"double\"|\"float\"|\"int32\"|\"uint32\"|\"sint32\"|\"fixed32\"|\"sfixed32\"|\"int64\"|\"uint64\"|\"sint64\"|\"fixed64\"|\"sfixed64\"|\"bool\"|\"string\"|\"bytes\"|Object|Constructor<{}>} fieldValueType Field value type\n * @returns {FieldDecorator} Decorator function\n * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }\n */\nMapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {\n\n // submessage value: decorate the submessage and use its name as the type\n if (typeof fieldValueType === \"function\")\n fieldValueType = util.decorateType(fieldValueType).name;\n\n // enum reference value: create a reflected copy of the enum and keep reuseing it\n else if (fieldValueType && typeof fieldValueType === \"object\")\n fieldValueType = util.decorateEnum(fieldValueType).name;\n\n return function mapFieldDecorator(prototype, fieldName) {\n util.decorateType(prototype.constructor)\n .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));\n };\n};\n","\"use strict\";\nmodule.exports = Message;\n\nvar util = require(39);\n\n/**\n * Constructs a new message instance.\n * @classdesc Abstract runtime message.\n * @constructor\n * @param {Properties} [properties] Properties to set\n * @template T extends object = object\n */\nfunction Message(properties) {\n // not used internally\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n this[keys[i]] = properties[keys[i]];\n}\n\n/**\n * Reference to the reflected type.\n * @name Message.$type\n * @type {Type}\n * @readonly\n */\n\n/**\n * Reference to the reflected type.\n * @name Message#$type\n * @type {Type}\n * @readonly\n */\n\n/*eslint-disable valid-jsdoc*/\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.create = function create(properties) {\n return this.$type.create(properties);\n};\n\n/**\n * Encodes a message of this type.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encode = function encode(message, writer) {\n return this.$type.encode(message, writer);\n};\n\n/**\n * Encodes a message of this type preceeded by its length as a varint.\n * @param {T|Object.} message Message to encode\n * @param {Writer} [writer] Writer to use\n * @returns {Writer} Writer\n * @template T extends Message\n * @this Constructor\n */\nMessage.encodeDelimited = function encodeDelimited(message, writer) {\n return this.$type.encodeDelimited(message, writer);\n};\n\n/**\n * Decodes a message of this type.\n * @name Message.decode\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decode = function decode(reader) {\n return this.$type.decode(reader);\n};\n\n/**\n * Decodes a message of this type preceeded by its length as a varint.\n * @name Message.decodeDelimited\n * @function\n * @param {Reader|Uint8Array} reader Reader or buffer to decode\n * @returns {T} Decoded message\n * @template T extends Message\n * @this Constructor\n */\nMessage.decodeDelimited = function decodeDelimited(reader) {\n return this.$type.decodeDelimited(reader);\n};\n\n/**\n * Verifies a message of this type.\n * @name Message.verify\n * @function\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\nMessage.verify = function verify(message) {\n return this.$type.verify(message);\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object\n * @returns {T} Message instance\n * @template T extends Message\n * @this Constructor\n */\nMessage.fromObject = function fromObject(object) {\n return this.$type.fromObject(object);\n};\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {T} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @template T extends Message\n * @this Constructor\n */\nMessage.toObject = function toObject(message, options) {\n return this.$type.toObject(message, options);\n};\n\n/**\n * Converts this message to JSON.\n * @returns {Object.} JSON object\n */\nMessage.prototype.toJSON = function toJSON() {\n return this.$type.toObject(this, util.toJSONOptions);\n};\n\n/*eslint-enable valid-jsdoc*/","\"use strict\";\nmodule.exports = Method;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = \"Method\";\n\nvar util = require(37);\n\n/**\n * Constructs a new service method instance.\n * @classdesc Reflected service method.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Method name\n * @param {string|undefined} type Method type, usually `\"rpc\"`\n * @param {string} requestType Request message type\n * @param {string} responseType Response message type\n * @param {boolean|Object.} [requestStream] Whether the request is streamed\n * @param {boolean|Object.} [responseStream] Whether the response is streamed\n * @param {Object.} [options] Declared options\n * @param {string} [comment] The comment for this method\n */\nfunction Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) {\n\n /* istanbul ignore next */\n if (util.isObject(requestStream)) {\n options = requestStream;\n requestStream = responseStream = undefined;\n } else if (util.isObject(responseStream)) {\n options = responseStream;\n responseStream = undefined;\n }\n\n /* istanbul ignore if */\n if (!(type === undefined || util.isString(type)))\n throw TypeError(\"type must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(requestType))\n throw TypeError(\"requestType must be a string\");\n\n /* istanbul ignore if */\n if (!util.isString(responseType))\n throw TypeError(\"responseType must be a string\");\n\n ReflectionObject.call(this, name, options);\n\n /**\n * Method type.\n * @type {string}\n */\n this.type = type || \"rpc\"; // toJSON\n\n /**\n * Request type.\n * @type {string}\n */\n this.requestType = requestType; // toJSON, marker\n\n /**\n * Whether requests are streamed or not.\n * @type {boolean|undefined}\n */\n this.requestStream = requestStream ? true : undefined; // toJSON\n\n /**\n * Response type.\n * @type {string}\n */\n this.responseType = responseType; // toJSON\n\n /**\n * Whether responses are streamed or not.\n * @type {boolean|undefined}\n */\n this.responseStream = responseStream ? true : undefined; // toJSON\n\n /**\n * Resolved request type.\n * @type {Type|null}\n */\n this.resolvedRequestType = null;\n\n /**\n * Resolved response type.\n * @type {Type|null}\n */\n this.resolvedResponseType = null;\n\n /**\n * Comment for this method\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Method descriptor.\n * @interface IMethod\n * @property {string} [type=\"rpc\"] Method type\n * @property {string} requestType Request type\n * @property {string} responseType Response type\n * @property {boolean} [requestStream=false] Whether requests are streamed\n * @property {boolean} [responseStream=false] Whether responses are streamed\n * @property {Object.} [options] Method options\n */\n\n/**\n * Constructs a method from a method descriptor.\n * @param {string} name Method name\n * @param {IMethod} json Method descriptor\n * @returns {Method} Created method\n * @throws {TypeError} If arguments are invalid\n */\nMethod.fromJSON = function fromJSON(name, json) {\n return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment);\n};\n\n/**\n * Converts this method to a method descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IMethod} Method descriptor\n */\nMethod.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"type\" , this.type !== \"rpc\" && /* istanbul ignore next */ this.type || undefined,\n \"requestType\" , this.requestType,\n \"requestStream\" , this.requestStream,\n \"responseType\" , this.responseType,\n \"responseStream\" , this.responseStream,\n \"options\" , this.options,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nMethod.prototype.resolve = function resolve() {\n\n /* istanbul ignore if */\n if (this.resolved)\n return this;\n\n this.resolvedRequestType = this.parent.lookupType(this.requestType);\n this.resolvedResponseType = this.parent.lookupType(this.responseType);\n\n return ReflectionObject.prototype.resolve.call(this);\n};\n","\"use strict\";\nmodule.exports = Namespace;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = \"Namespace\";\n\nvar Field = require(16),\n util = require(37);\n\nvar Type, // cyclic\n Service,\n Enum;\n\n/**\n * Constructs a new namespace instance.\n * @name Namespace\n * @classdesc Reflected namespace.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n */\n\n/**\n * Constructs a namespace from JSON.\n * @memberof Namespace\n * @function\n * @param {string} name Namespace name\n * @param {Object.} json JSON object\n * @returns {Namespace} Created namespace\n * @throws {TypeError} If arguments are invalid\n */\nNamespace.fromJSON = function fromJSON(name, json) {\n return new Namespace(name, json.options).addJSON(json.nested);\n};\n\n/**\n * Converts an array of reflection objects to JSON.\n * @memberof Namespace\n * @param {ReflectionObject[]} array Object array\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {Object.|undefined} JSON object or `undefined` when array is empty\n */\nfunction arrayToJSON(array, toJSONOptions) {\n if (!(array && array.length))\n return undefined;\n var obj = {};\n for (var i = 0; i < array.length; ++i)\n obj[array[i].name] = array[i].toJSON(toJSONOptions);\n return obj;\n}\n\nNamespace.arrayToJSON = arrayToJSON;\n\n/**\n * Tests if the specified id is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedId = function isReservedId(reserved, id) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (typeof reserved[i] !== \"string\" && reserved[i][0] <= id && reserved[i][1] > id)\n return true;\n return false;\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {Array.|undefined} reserved Array of reserved ranges and names\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nNamespace.isReservedName = function isReservedName(reserved, name) {\n if (reserved)\n for (var i = 0; i < reserved.length; ++i)\n if (reserved[i] === name)\n return true;\n return false;\n};\n\n/**\n * Not an actual constructor. Use {@link Namespace} instead.\n * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions.\n * @exports NamespaceBase\n * @extends ReflectionObject\n * @abstract\n * @constructor\n * @param {string} name Namespace name\n * @param {Object.} [options] Declared options\n * @see {@link Namespace}\n */\nfunction Namespace(name, options) {\n ReflectionObject.call(this, name, options);\n\n /**\n * Nested objects by name.\n * @type {Object.|undefined}\n */\n this.nested = undefined; // toJSON\n\n /**\n * Cached nested objects as an array.\n * @type {ReflectionObject[]|null}\n * @private\n */\n this._nestedArray = null;\n}\n\nfunction clearCache(namespace) {\n namespace._nestedArray = null;\n return namespace;\n}\n\n/**\n * Nested objects of this namespace as an array for iteration.\n * @name NamespaceBase#nestedArray\n * @type {ReflectionObject[]}\n * @readonly\n */\nObject.defineProperty(Namespace.prototype, \"nestedArray\", {\n get: function() {\n return this._nestedArray || (this._nestedArray = util.toArray(this.nested));\n }\n});\n\n/**\n * Namespace descriptor.\n * @interface INamespace\n * @property {Object.} [options] Namespace options\n * @property {Object.} [nested] Nested object descriptors\n */\n\n/**\n * Any extension field descriptor.\n * @typedef AnyExtensionField\n * @type {IExtensionField|IExtensionMapField}\n */\n\n/**\n * Any nested object descriptor.\n * @typedef AnyNestedObject\n * @type {IEnum|IType|IService|AnyExtensionField|INamespace}\n */\n// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)\n\n/**\n * Converts this namespace to a namespace descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {INamespace} Namespace descriptor\n */\nNamespace.prototype.toJSON = function toJSON(toJSONOptions) {\n return util.toObject([\n \"options\" , this.options,\n \"nested\" , arrayToJSON(this.nestedArray, toJSONOptions)\n ]);\n};\n\n/**\n * Adds nested objects to this namespace from nested object descriptors.\n * @param {Object.} nestedJson Any nested object descriptors\n * @returns {Namespace} `this`\n */\nNamespace.prototype.addJSON = function addJSON(nestedJson) {\n var ns = this;\n /* istanbul ignore else */\n if (nestedJson) {\n for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {\n nested = nestedJson[names[i]];\n ns.add( // most to least likely\n ( nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : nested.id !== undefined\n ? Field.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n }\n return this;\n};\n\n/**\n * Gets the nested object of the specified name.\n * @param {string} name Nested object name\n * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist\n */\nNamespace.prototype.get = function get(name) {\n return this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Gets the values of the nested {@link Enum|enum} of the specified name.\n * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`.\n * @param {string} name Nested enum name\n * @returns {Object.} Enum values\n * @throws {Error} If there is no such enum\n */\nNamespace.prototype.getEnum = function getEnum(name) {\n if (this.nested && this.nested[name] instanceof Enum)\n return this.nested[name].values;\n throw Error(\"no such enum: \" + name);\n};\n\n/**\n * Adds a nested object to this namespace.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name\n */\nNamespace.prototype.add = function add(object) {\n\n if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))\n throw TypeError(\"object must be a valid nested object\");\n\n if (!this.nested)\n this.nested = {};\n else {\n var prev = this.get(object.name);\n if (prev) {\n if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {\n // replace plain namespace but keep existing nested elements and options\n var nested = prev.nestedArray;\n for (var i = 0; i < nested.length; ++i)\n object.add(nested[i]);\n this.remove(prev);\n if (!this.nested)\n this.nested = {};\n object.setOptions(prev.options, true);\n\n } else\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n }\n }\n this.nested[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n};\n\n/**\n * Removes a nested object from this namespace.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Namespace} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this namespace\n */\nNamespace.prototype.remove = function remove(object) {\n\n if (!(object instanceof ReflectionObject))\n throw TypeError(\"object must be a ReflectionObject\");\n if (object.parent !== this)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.nested[object.name];\n if (!Object.keys(this.nested).length)\n this.nested = undefined;\n\n object.onRemove(this);\n return clearCache(this);\n};\n\n/**\n * Defines additial namespaces within this one if not yet existing.\n * @param {string|string[]} path Path to create\n * @param {*} [json] Nested types to create from JSON\n * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty\n */\nNamespace.prototype.define = function define(path, json) {\n\n if (util.isString(path))\n path = path.split(\".\");\n else if (!Array.isArray(path))\n throw TypeError(\"illegal path\");\n if (path && path.length && path[0] === \"\")\n throw Error(\"path must be relative\");\n\n var ptr = this;\n while (path.length > 0) {\n var part = path.shift();\n if (ptr.nested && ptr.nested[part]) {\n ptr = ptr.nested[part];\n if (!(ptr instanceof Namespace))\n throw Error(\"path conflicts with non-namespace objects\");\n } else\n ptr.add(ptr = new Namespace(part));\n }\n if (json)\n ptr.addJSON(json);\n return ptr;\n};\n\n/**\n * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.\n * @returns {Namespace} `this`\n */\nNamespace.prototype.resolveAll = function resolveAll() {\n var nested = this.nestedArray, i = 0;\n while (i < nested.length)\n if (nested[i] instanceof Namespace)\n nested[i++].resolveAll();\n else\n nested[i++].resolve();\n return this.resolve();\n};\n\n/**\n * Recursively looks up the reflection object matching the specified path in the scope of this namespace.\n * @param {string|string[]} path Path to look up\n * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc.\n * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n */\nNamespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {\n\n /* istanbul ignore next */\n if (typeof filterTypes === \"boolean\") {\n parentAlreadyChecked = filterTypes;\n filterTypes = undefined;\n } else if (filterTypes && !Array.isArray(filterTypes))\n filterTypes = [ filterTypes ];\n\n if (util.isString(path) && path.length) {\n if (path === \".\")\n return this.root;\n path = path.split(\".\");\n } else if (!path.length)\n return this;\n\n // Start at root if path is absolute\n if (path[0] === \"\")\n return this.root.lookup(path.slice(1), filterTypes);\n\n // Test if the first part matches any nested object, and if so, traverse if path contains more\n var found = this.get(path[0]);\n if (found) {\n if (path.length === 1) {\n if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)\n return found;\n } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))\n return found;\n\n // Otherwise try each nested namespace\n } else\n for (var i = 0; i < this.nestedArray.length; ++i)\n if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))\n return found;\n\n // If there hasn't been a match, try again at the parent\n if (this.parent === null || parentAlreadyChecked)\n return null;\n return this.parent.lookup(path, filterTypes);\n};\n\n/**\n * Looks up the reflection object at the specified path, relative to this namespace.\n * @name NamespaceBase#lookup\n * @function\n * @param {string|string[]} path Path to look up\n * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked\n * @returns {ReflectionObject|null} Looked up object or `null` if none could be found\n * @variation 2\n */\n// lookup(path: string, [parentAlreadyChecked: boolean])\n\n/**\n * Looks up the {@link Type|type} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type\n * @throws {Error} If `path` does not point to a type\n */\nNamespace.prototype.lookupType = function lookupType(path) {\n var found = this.lookup(path, [ Type ]);\n if (!found)\n throw Error(\"no such type: \" + path);\n return found;\n};\n\n/**\n * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Enum} Looked up enum\n * @throws {Error} If `path` does not point to an enum\n */\nNamespace.prototype.lookupEnum = function lookupEnum(path) {\n var found = this.lookup(path, [ Enum ]);\n if (!found)\n throw Error(\"no such Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Type} Looked up type or enum\n * @throws {Error} If `path` does not point to a type or enum\n */\nNamespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {\n var found = this.lookup(path, [ Type, Enum ]);\n if (!found)\n throw Error(\"no such Type or Enum '\" + path + \"' in \" + this);\n return found;\n};\n\n/**\n * Looks up the {@link Service|service} at the specified path, relative to this namespace.\n * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.\n * @param {string|string[]} path Path to look up\n * @returns {Service} Looked up service\n * @throws {Error} If `path` does not point to a service\n */\nNamespace.prototype.lookupService = function lookupService(path) {\n var found = this.lookup(path, [ Service ]);\n if (!found)\n throw Error(\"no such Service '\" + path + \"' in \" + this);\n return found;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nNamespace._configure = function(Type_, Service_, Enum_) {\n Type = Type_;\n Service = Service_;\n Enum = Enum_;\n};\n","\"use strict\";\nmodule.exports = ReflectionObject;\n\nReflectionObject.className = \"ReflectionObject\";\n\nvar util = require(37);\n\nvar Root; // cyclic\n\n/**\n * Constructs a new reflection object instance.\n * @classdesc Base class of all reflection objects.\n * @constructor\n * @param {string} name Object name\n * @param {Object.} [options] Declared options\n * @abstract\n */\nfunction ReflectionObject(name, options) {\n\n if (!util.isString(name))\n throw TypeError(\"name must be a string\");\n\n if (options && !util.isObject(options))\n throw TypeError(\"options must be an object\");\n\n /**\n * Options.\n * @type {Object.|undefined}\n */\n this.options = options; // toJSON\n\n /**\n * Parsed Options.\n * @type {Array.>|undefined}\n */\n this.parsedOptions = null;\n\n /**\n * Unique name within its namespace.\n * @type {string}\n */\n this.name = name;\n\n /**\n * Parent namespace.\n * @type {Namespace|null}\n */\n this.parent = null;\n\n /**\n * Whether already resolved or not.\n * @type {boolean}\n */\n this.resolved = false;\n\n /**\n * Comment text, if any.\n * @type {string|null}\n */\n this.comment = null;\n\n /**\n * Defining file name.\n * @type {string|null}\n */\n this.filename = null;\n}\n\nObject.defineProperties(ReflectionObject.prototype, {\n\n /**\n * Reference to the root namespace.\n * @name ReflectionObject#root\n * @type {Root}\n * @readonly\n */\n root: {\n get: function() {\n var ptr = this;\n while (ptr.parent !== null)\n ptr = ptr.parent;\n return ptr;\n }\n },\n\n /**\n * Full name including leading dot.\n * @name ReflectionObject#fullName\n * @type {string}\n * @readonly\n */\n fullName: {\n get: function() {\n var path = [ this.name ],\n ptr = this.parent;\n while (ptr) {\n path.unshift(ptr.name);\n ptr = ptr.parent;\n }\n return path.join(\".\");\n }\n }\n});\n\n/**\n * Converts this reflection object to its descriptor representation.\n * @returns {Object.} Descriptor\n * @abstract\n */\nReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {\n throw Error(); // not implemented, shouldn't happen\n};\n\n/**\n * Called when this object is added to a parent.\n * @param {ReflectionObject} parent Parent added to\n * @returns {undefined}\n */\nReflectionObject.prototype.onAdd = function onAdd(parent) {\n if (this.parent && this.parent !== parent)\n this.parent.remove(this);\n this.parent = parent;\n this.resolved = false;\n var root = parent.root;\n if (root instanceof Root)\n root._handleAdd(this);\n};\n\n/**\n * Called when this object is removed from a parent.\n * @param {ReflectionObject} parent Parent removed from\n * @returns {undefined}\n */\nReflectionObject.prototype.onRemove = function onRemove(parent) {\n var root = parent.root;\n if (root instanceof Root)\n root._handleRemove(this);\n this.parent = null;\n this.resolved = false;\n};\n\n/**\n * Resolves this objects type references.\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.resolve = function resolve() {\n if (this.resolved)\n return this;\n if (this.root instanceof Root)\n this.resolved = true; // only if part of a root\n return this;\n};\n\n/**\n * Gets an option value.\n * @param {string} name Option name\n * @returns {*} Option value or `undefined` if not set\n */\nReflectionObject.prototype.getOption = function getOption(name) {\n if (this.options)\n return this.options[name];\n return undefined;\n};\n\n/**\n * Sets an option.\n * @param {string} name Option name\n * @param {*} value Option value\n * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {\n if (!ifNotSet || !this.options || this.options[name] === undefined)\n (this.options || (this.options = {}))[name] = value;\n return this;\n};\n\n/**\n * Sets a parsed option.\n * @param {string} name parsed Option name\n * @param {*} value Option value\n * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\\empty, will add a new option with that value\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) {\n if (!this.parsedOptions) {\n this.parsedOptions = [];\n }\n var parsedOptions = this.parsedOptions;\n if (propName) {\n // If setting a sub property of an option then try to merge it\n // with an existing option\n var opt = parsedOptions.find(function (opt) {\n return Object.prototype.hasOwnProperty.call(opt, name);\n });\n if (opt) {\n // If we found an existing option - just merge the property value\n var newValue = opt[name];\n util.setProperty(newValue, propName, value);\n } else {\n // otherwise, create a new option, set it's property and add it to the list\n opt = {};\n opt[name] = util.setProperty({}, propName, value);\n parsedOptions.push(opt);\n }\n } else {\n // Always create a new option when setting the value of the option itself\n var newOpt = {};\n newOpt[name] = value;\n parsedOptions.push(newOpt);\n }\n return this;\n};\n\n/**\n * Sets multiple options.\n * @param {Object.} options Options to set\n * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set\n * @returns {ReflectionObject} `this`\n */\nReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {\n if (options)\n for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)\n this.setOption(keys[i], options[keys[i]], ifNotSet);\n return this;\n};\n\n/**\n * Converts this instance to its string representation.\n * @returns {string} Class name[, space, full name]\n */\nReflectionObject.prototype.toString = function toString() {\n var className = this.constructor.className,\n fullName = this.fullName;\n if (fullName.length)\n return className + \" \" + fullName;\n return className;\n};\n\n// Sets up cyclic dependencies (called in index-light)\nReflectionObject._configure = function(Root_) {\n Root = Root_;\n};\n","\"use strict\";\nmodule.exports = OneOf;\n\n// extends ReflectionObject\nvar ReflectionObject = require(24);\n((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = \"OneOf\";\n\nvar Field = require(16),\n util = require(37);\n\n/**\n * Constructs a new oneof instance.\n * @classdesc Reflected oneof.\n * @extends ReflectionObject\n * @constructor\n * @param {string} name Oneof name\n * @param {string[]|Object.} [fieldNames] Field names\n * @param {Object.} [options] Declared options\n * @param {string} [comment] Comment associated with this field\n */\nfunction OneOf(name, fieldNames, options, comment) {\n if (!Array.isArray(fieldNames)) {\n options = fieldNames;\n fieldNames = undefined;\n }\n ReflectionObject.call(this, name, options);\n\n /* istanbul ignore if */\n if (!(fieldNames === undefined || Array.isArray(fieldNames)))\n throw TypeError(\"fieldNames must be an Array\");\n\n /**\n * Field names that belong to this oneof.\n * @type {string[]}\n */\n this.oneof = fieldNames || []; // toJSON, marker\n\n /**\n * Fields that belong to this oneof as an array for iteration.\n * @type {Field[]}\n * @readonly\n */\n this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent\n\n /**\n * Comment for this field.\n * @type {string|null}\n */\n this.comment = comment;\n}\n\n/**\n * Oneof descriptor.\n * @interface IOneOf\n * @property {Array.} oneof Oneof field names\n * @property {Object.} [options] Oneof options\n */\n\n/**\n * Constructs a oneof from a oneof descriptor.\n * @param {string} name Oneof name\n * @param {IOneOf} json Oneof descriptor\n * @returns {OneOf} Created oneof\n * @throws {TypeError} If arguments are invalid\n */\nOneOf.fromJSON = function fromJSON(name, json) {\n return new OneOf(name, json.oneof, json.options, json.comment);\n};\n\n/**\n * Converts this oneof to a oneof descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IOneOf} Oneof descriptor\n */\nOneOf.prototype.toJSON = function toJSON(toJSONOptions) {\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , this.options,\n \"oneof\" , this.oneof,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Adds the fields of the specified oneof to the parent if not already done so.\n * @param {OneOf} oneof The oneof\n * @returns {undefined}\n * @inner\n * @ignore\n */\nfunction addFieldsToParent(oneof) {\n if (oneof.parent)\n for (var i = 0; i < oneof.fieldsArray.length; ++i)\n if (!oneof.fieldsArray[i].parent)\n oneof.parent.add(oneof.fieldsArray[i]);\n}\n\n/**\n * Adds a field to this oneof and removes it from its current parent, if any.\n * @param {Field} field Field to add\n * @returns {OneOf} `this`\n */\nOneOf.prototype.add = function add(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n if (field.parent && field.parent !== this.parent)\n field.parent.remove(field);\n this.oneof.push(field.name);\n this.fieldsArray.push(field);\n field.partOf = this; // field.parent remains null\n addFieldsToParent(this);\n return this;\n};\n\n/**\n * Removes a field from this oneof and puts it back to the oneof's parent.\n * @param {Field} field Field to remove\n * @returns {OneOf} `this`\n */\nOneOf.prototype.remove = function remove(field) {\n\n /* istanbul ignore if */\n if (!(field instanceof Field))\n throw TypeError(\"field must be a Field\");\n\n var index = this.fieldsArray.indexOf(field);\n\n /* istanbul ignore if */\n if (index < 0)\n throw Error(field + \" is not a member of \" + this);\n\n this.fieldsArray.splice(index, 1);\n index = this.oneof.indexOf(field.name);\n\n /* istanbul ignore else */\n if (index > -1) // theoretical\n this.oneof.splice(index, 1);\n\n field.partOf = null;\n return this;\n};\n\n/**\n * @override\n */\nOneOf.prototype.onAdd = function onAdd(parent) {\n ReflectionObject.prototype.onAdd.call(this, parent);\n var self = this;\n // Collect present fields\n for (var i = 0; i < this.oneof.length; ++i) {\n var field = parent.get(this.oneof[i]);\n if (field && !field.partOf) {\n field.partOf = self;\n self.fieldsArray.push(field);\n }\n }\n // Add not yet present fields\n addFieldsToParent(this);\n};\n\n/**\n * @override\n */\nOneOf.prototype.onRemove = function onRemove(parent) {\n for (var i = 0, field; i < this.fieldsArray.length; ++i)\n if ((field = this.fieldsArray[i]).parent)\n field.parent.remove(field);\n ReflectionObject.prototype.onRemove.call(this, parent);\n};\n\n/**\n * Decorator function as returned by {@link OneOf.d} (TypeScript).\n * @typedef OneOfDecorator\n * @type {function}\n * @param {Object} prototype Target prototype\n * @param {string} oneofName OneOf name\n * @returns {undefined}\n */\n\n/**\n * OneOf decorator (TypeScript).\n * @function\n * @param {...string} fieldNames Field names\n * @returns {OneOfDecorator} Decorator function\n * @template T extends string\n */\nOneOf.d = function decorateOneOf() {\n var fieldNames = new Array(arguments.length),\n index = 0;\n while (index < arguments.length)\n fieldNames[index] = arguments[index++];\n return function oneOfDecorator(prototype, oneofName) {\n util.decorateType(prototype.constructor)\n .add(new OneOf(oneofName, fieldNames));\n Object.defineProperty(prototype, oneofName, {\n get: util.oneOfGetter(fieldNames),\n set: util.oneOfSetter(fieldNames)\n });\n };\n};\n","\"use strict\";\nmodule.exports = parse;\n\nparse.filename = null;\nparse.defaults = { keepCase: false };\n\nvar tokenize = require(34),\n Root = require(29),\n Type = require(35),\n Field = require(16),\n MapField = require(20),\n OneOf = require(25),\n Enum = require(15),\n Service = require(33),\n Method = require(22),\n types = require(36),\n util = require(37);\n\nvar base10Re = /^[1-9][0-9]*$/,\n base10NegRe = /^-?[1-9][0-9]*$/,\n base16Re = /^0[x][0-9a-fA-F]+$/,\n base16NegRe = /^-?0[x][0-9a-fA-F]+$/,\n base8Re = /^0[0-7]+$/,\n base8NegRe = /^-?0[0-7]+$/,\n numberRe = /^(?![eE])[0-9]*(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,\n nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/,\n typeRefRe = /^(?:\\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,\n fqTypeRefRe = /^(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;\n\n/**\n * Result object returned from {@link parse}.\n * @interface IParserResult\n * @property {string|undefined} package Package name, if declared\n * @property {string[]|undefined} imports Imports, if any\n * @property {string[]|undefined} weakImports Weak imports, if any\n * @property {string|undefined} syntax Syntax, if specified (either `\"proto2\"` or `\"proto3\"`)\n * @property {Root} root Populated root instance\n */\n\n/**\n * Options modifying the behavior of {@link parse}.\n * @interface IParseOptions\n * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case\n * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments.\n * @property {boolean} [preferTrailingComment=false] Use trailing comment when both leading comment and trailing comment exist.\n */\n\n/**\n * Options modifying the behavior of JSON serialization.\n * @interface IToJSONOptions\n * @property {boolean} [keepComments=false] Serializes comments.\n */\n\n/**\n * Parses the given .proto source and returns an object with the parsed contents.\n * @param {string} source Source contents\n * @param {Root} root Root to populate\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {IParserResult} Parser result\n * @property {string} filename=null Currently processing file name for error reporting, if known\n * @property {IParseOptions} defaults Default {@link IParseOptions}\n */\nfunction parse(source, root, options) {\n /* eslint-disable callback-return */\n if (!(root instanceof Root)) {\n options = root;\n root = new Root();\n }\n if (!options)\n options = parse.defaults;\n\n var preferTrailingComment = options.preferTrailingComment || false;\n var tn = tokenize(source, options.alternateCommentMode || false),\n next = tn.next,\n push = tn.push,\n peek = tn.peek,\n skip = tn.skip,\n cmnt = tn.cmnt;\n\n var head = true,\n pkg,\n imports,\n weakImports,\n syntax,\n isProto3 = false;\n\n var ptr = root;\n\n var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase;\n\n /* istanbul ignore next */\n function illegal(token, name, insideTryCatch) {\n var filename = parse.filename;\n if (!insideTryCatch)\n parse.filename = null;\n return Error(\"illegal \" + (name || \"token\") + \" '\" + token + \"' (\" + (filename ? filename + \", \" : \"\") + \"line \" + tn.line + \")\");\n }\n\n function readString() {\n var values = [],\n token;\n do {\n /* istanbul ignore if */\n if ((token = next()) !== \"\\\"\" && token !== \"'\")\n throw illegal(token);\n\n values.push(next());\n skip(token);\n token = peek();\n } while (token === \"\\\"\" || token === \"'\");\n return values.join(\"\");\n }\n\n function readValue(acceptTypeRef) {\n var token = next();\n switch (token) {\n case \"'\":\n case \"\\\"\":\n push(token);\n return readString();\n case \"true\": case \"TRUE\":\n return true;\n case \"false\": case \"FALSE\":\n return false;\n }\n try {\n return parseNumber(token, /* insideTryCatch */ true);\n } catch (e) {\n\n /* istanbul ignore else */\n if (acceptTypeRef && typeRefRe.test(token))\n return token;\n\n /* istanbul ignore next */\n throw illegal(token, \"value\");\n }\n }\n\n function readRanges(target, acceptStrings) {\n var token, start;\n do {\n if (acceptStrings && ((token = peek()) === \"\\\"\" || token === \"'\"))\n target.push(readString());\n else\n target.push([ start = parseId(next()), skip(\"to\", true) ? parseId(next()) : start ]);\n } while (skip(\",\", true));\n skip(\";\");\n }\n\n function parseNumber(token, insideTryCatch) {\n var sign = 1;\n if (token.charAt(0) === \"-\") {\n sign = -1;\n token = token.substring(1);\n }\n switch (token) {\n case \"inf\": case \"INF\": case \"Inf\":\n return sign * Infinity;\n case \"nan\": case \"NAN\": case \"Nan\": case \"NaN\":\n return NaN;\n case \"0\":\n return 0;\n }\n if (base10Re.test(token))\n return sign * parseInt(token, 10);\n if (base16Re.test(token))\n return sign * parseInt(token, 16);\n if (base8Re.test(token))\n return sign * parseInt(token, 8);\n\n /* istanbul ignore else */\n if (numberRe.test(token))\n return sign * parseFloat(token);\n\n /* istanbul ignore next */\n throw illegal(token, \"number\", insideTryCatch);\n }\n\n function parseId(token, acceptNegative) {\n switch (token) {\n case \"max\": case \"MAX\": case \"Max\":\n return 536870911;\n case \"0\":\n return 0;\n }\n\n /* istanbul ignore if */\n if (!acceptNegative && token.charAt(0) === \"-\")\n throw illegal(token, \"id\");\n\n if (base10NegRe.test(token))\n return parseInt(token, 10);\n if (base16NegRe.test(token))\n return parseInt(token, 16);\n\n /* istanbul ignore else */\n if (base8NegRe.test(token))\n return parseInt(token, 8);\n\n /* istanbul ignore next */\n throw illegal(token, \"id\");\n }\n\n function parsePackage() {\n\n /* istanbul ignore if */\n if (pkg !== undefined)\n throw illegal(\"package\");\n\n pkg = next();\n\n /* istanbul ignore if */\n if (!typeRefRe.test(pkg))\n throw illegal(pkg, \"name\");\n\n ptr = ptr.define(pkg);\n skip(\";\");\n }\n\n function parseImport() {\n var token = peek();\n var whichImports;\n switch (token) {\n case \"weak\":\n whichImports = weakImports || (weakImports = []);\n next();\n break;\n case \"public\":\n next();\n // eslint-disable-line no-fallthrough\n default:\n whichImports = imports || (imports = []);\n break;\n }\n token = readString();\n skip(\";\");\n whichImports.push(token);\n }\n\n function parseSyntax() {\n skip(\"=\");\n syntax = readString();\n isProto3 = syntax === \"proto3\";\n\n /* istanbul ignore if */\n if (!isProto3 && syntax !== \"proto2\")\n throw illegal(syntax, \"syntax\");\n\n skip(\";\");\n }\n\n function parseCommon(parent, token) {\n switch (token) {\n\n case \"option\":\n parseOption(parent, token);\n skip(\";\");\n return true;\n\n case \"message\":\n parseType(parent, token);\n return true;\n\n case \"enum\":\n parseEnum(parent, token);\n return true;\n\n case \"service\":\n parseService(parent, token);\n return true;\n\n case \"extend\":\n parseExtension(parent, token);\n return true;\n }\n return false;\n }\n\n function ifBlock(obj, fnIf, fnElse) {\n var trailingLine = tn.line;\n if (obj) {\n if(typeof obj.comment !== \"string\") {\n obj.comment = cmnt(); // try block-type comment\n }\n obj.filename = parse.filename;\n }\n if (skip(\"{\", true)) {\n var token;\n while ((token = next()) !== \"}\")\n fnIf(token);\n skip(\";\", true);\n } else {\n if (fnElse)\n fnElse();\n skip(\";\");\n if (obj && (typeof obj.comment !== \"string\" || preferTrailingComment))\n obj.comment = cmnt(trailingLine) || obj.comment; // try line-type comment\n }\n }\n\n function parseType(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"type name\");\n\n var type = new Type(token);\n ifBlock(type, function parseType_block(token) {\n if (parseCommon(type, token))\n return;\n\n switch (token) {\n\n case \"map\":\n parseMapField(type, token);\n break;\n\n case \"required\":\n case \"optional\":\n case \"repeated\":\n parseField(type, token);\n break;\n\n case \"oneof\":\n parseOneOf(type, token);\n break;\n\n case \"extensions\":\n readRanges(type.extensions || (type.extensions = []));\n break;\n\n case \"reserved\":\n readRanges(type.reserved || (type.reserved = []), true);\n break;\n\n default:\n /* istanbul ignore if */\n if (!isProto3 || !typeRefRe.test(token))\n throw illegal(token);\n\n push(token);\n parseField(type, \"optional\");\n break;\n }\n });\n parent.add(type);\n }\n\n function parseField(parent, rule, extend) {\n var type = next();\n if (type === \"group\") {\n parseGroup(parent, rule);\n return;\n }\n\n /* istanbul ignore if */\n if (!typeRefRe.test(type))\n throw illegal(type, \"type\");\n\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n name = applyCase(name);\n skip(\"=\");\n\n var field = new Field(name, parseId(next()), type, rule, extend);\n ifBlock(field, function parseField_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(field, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseField_line() {\n parseInlineOptions(field);\n });\n parent.add(field);\n\n // JSON defaults to packed=true if not set so we have to set packed=false explicity when\n // parsing proto2 descriptors without the option, where applicable. This must be done for\n // all known packable types and anything that could be an enum (= is not a basic type).\n if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined))\n field.setOption(\"packed\", false, /* ifNotSet */ true);\n }\n\n function parseGroup(parent, rule) {\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n var fieldName = util.lcFirst(name);\n if (name === fieldName)\n name = util.ucFirst(name);\n skip(\"=\");\n var id = parseId(next());\n var type = new Type(name);\n type.group = true;\n var field = new Field(fieldName, id, name, rule);\n field.filename = parse.filename;\n ifBlock(type, function parseGroup_block(token) {\n switch (token) {\n\n case \"option\":\n parseOption(type, token);\n skip(\";\");\n break;\n\n case \"required\":\n case \"optional\":\n case \"repeated\":\n parseField(type, token);\n break;\n\n /* istanbul ignore next */\n default:\n throw illegal(token); // there are no groups with proto3 semantics\n }\n });\n parent.add(type)\n .add(field);\n }\n\n function parseMapField(parent) {\n skip(\"<\");\n var keyType = next();\n\n /* istanbul ignore if */\n if (types.mapKey[keyType] === undefined)\n throw illegal(keyType, \"type\");\n\n skip(\",\");\n var valueType = next();\n\n /* istanbul ignore if */\n if (!typeRefRe.test(valueType))\n throw illegal(valueType, \"type\");\n\n skip(\">\");\n var name = next();\n\n /* istanbul ignore if */\n if (!nameRe.test(name))\n throw illegal(name, \"name\");\n\n skip(\"=\");\n var field = new MapField(applyCase(name), parseId(next()), keyType, valueType);\n ifBlock(field, function parseMapField_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(field, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseMapField_line() {\n parseInlineOptions(field);\n });\n parent.add(field);\n }\n\n function parseOneOf(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var oneof = new OneOf(applyCase(token));\n ifBlock(oneof, function parseOneOf_block(token) {\n if (token === \"option\") {\n parseOption(oneof, token);\n skip(\";\");\n } else {\n push(token);\n parseField(oneof, \"optional\");\n }\n });\n parent.add(oneof);\n }\n\n function parseEnum(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var enm = new Enum(token);\n ifBlock(enm, function parseEnum_block(token) {\n switch(token) {\n case \"option\":\n parseOption(enm, token);\n skip(\";\");\n break;\n\n case \"reserved\":\n readRanges(enm.reserved || (enm.reserved = []), true);\n break;\n\n default:\n parseEnumValue(enm, token);\n }\n });\n parent.add(enm);\n }\n\n function parseEnumValue(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token))\n throw illegal(token, \"name\");\n\n skip(\"=\");\n var value = parseId(next(), true),\n dummy = {};\n ifBlock(dummy, function parseEnumValue_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(dummy, token); // skip\n skip(\";\");\n } else\n throw illegal(token);\n\n }, function parseEnumValue_line() {\n parseInlineOptions(dummy); // skip\n });\n parent.add(token, value, dummy.comment);\n }\n\n function parseOption(parent, token) {\n var isCustom = skip(\"(\", true);\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var name = token;\n var option = name;\n var propName;\n\n if (isCustom) {\n skip(\")\");\n name = \"(\" + name + \")\";\n option = name;\n token = peek();\n if (fqTypeRefRe.test(token)) {\n propName = token.substr(1); //remove '.' before property name\n name += token;\n next();\n }\n }\n skip(\"=\");\n var optionValue = parseOptionValue(parent, name);\n setParsedOption(parent, option, optionValue, propName);\n }\n\n function parseOptionValue(parent, name) {\n if (skip(\"{\", true)) { // { a: \"foo\" b { c: \"bar\" } }\n var result = {};\n while (!skip(\"}\", true)) {\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var value;\n var propName = token;\n if (peek() === \"{\")\n value = parseOptionValue(parent, name + \".\" + token);\n else {\n skip(\":\");\n if (peek() === \"{\")\n value = parseOptionValue(parent, name + \".\" + token);\n else {\n value = readValue(true);\n setOption(parent, name + \".\" + token, value);\n }\n }\n var prevValue = result[propName];\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n result[propName] = value;\n skip(\",\", true);\n }\n return result;\n }\n\n var simpleValue = readValue(true);\n setOption(parent, name, simpleValue);\n return simpleValue;\n // Does not enforce a delimiter to be universal\n }\n\n function setOption(parent, name, value) {\n if (parent.setOption)\n parent.setOption(name, value);\n }\n\n function setParsedOption(parent, name, value, propName) {\n if (parent.setParsedOption)\n parent.setParsedOption(name, value, propName);\n }\n\n function parseInlineOptions(parent) {\n if (skip(\"[\", true)) {\n do {\n parseOption(parent, \"option\");\n } while (skip(\",\", true));\n skip(\"]\");\n }\n return parent;\n }\n\n function parseService(parent, token) {\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"service name\");\n\n var service = new Service(token);\n ifBlock(service, function parseService_block(token) {\n if (parseCommon(service, token))\n return;\n\n /* istanbul ignore else */\n if (token === \"rpc\")\n parseMethod(service, token);\n else\n throw illegal(token);\n });\n parent.add(service);\n }\n\n function parseMethod(parent, token) {\n // Get the comment of the preceding line now (if one exists) in case the\n // method is defined across multiple lines.\n var commentText = cmnt();\n\n var type = token;\n\n /* istanbul ignore if */\n if (!nameRe.test(token = next()))\n throw illegal(token, \"name\");\n\n var name = token,\n requestType, requestStream,\n responseType, responseStream;\n\n skip(\"(\");\n if (skip(\"stream\", true))\n requestStream = true;\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token);\n\n requestType = token;\n skip(\")\"); skip(\"returns\"); skip(\"(\");\n if (skip(\"stream\", true))\n responseStream = true;\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token);\n\n responseType = token;\n skip(\")\");\n\n var method = new Method(name, type, requestType, responseType, requestStream, responseStream);\n method.comment = commentText;\n ifBlock(method, function parseMethod_block(token) {\n\n /* istanbul ignore else */\n if (token === \"option\") {\n parseOption(method, token);\n skip(\";\");\n } else\n throw illegal(token);\n\n });\n parent.add(method);\n }\n\n function parseExtension(parent, token) {\n\n /* istanbul ignore if */\n if (!typeRefRe.test(token = next()))\n throw illegal(token, \"reference\");\n\n var reference = token;\n ifBlock(null, function parseExtension_block(token) {\n switch (token) {\n\n case \"required\":\n case \"repeated\":\n case \"optional\":\n parseField(parent, token, reference);\n break;\n\n default:\n /* istanbul ignore if */\n if (!isProto3 || !typeRefRe.test(token))\n throw illegal(token);\n push(token);\n parseField(parent, \"optional\", reference);\n break;\n }\n });\n }\n\n var token;\n while ((token = next()) !== null) {\n switch (token) {\n\n case \"package\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parsePackage();\n break;\n\n case \"import\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parseImport();\n break;\n\n case \"syntax\":\n\n /* istanbul ignore if */\n if (!head)\n throw illegal(token);\n\n parseSyntax();\n break;\n\n case \"option\":\n\n parseOption(ptr, token);\n skip(\";\");\n break;\n\n default:\n\n /* istanbul ignore else */\n if (parseCommon(ptr, token)) {\n head = false;\n continue;\n }\n\n /* istanbul ignore next */\n throw illegal(token);\n }\n }\n\n parse.filename = null;\n return {\n \"package\" : pkg,\n \"imports\" : imports,\n weakImports : weakImports,\n syntax : syntax,\n root : root\n };\n}\n\n/**\n * Parses the given .proto source and returns an object with the parsed contents.\n * @name parse\n * @function\n * @param {string} source Source contents\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {IParserResult} Parser result\n * @property {string} filename=null Currently processing file name for error reporting, if known\n * @property {IParseOptions} defaults Default {@link IParseOptions}\n * @variation 2\n */\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(39);\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(27);\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(39);\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n","\"use strict\";\nmodule.exports = Root;\n\n// extends Namespace\nvar Namespace = require(23);\n((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = \"Root\";\n\nvar Field = require(16),\n Enum = require(15),\n OneOf = require(25),\n util = require(37);\n\nvar Type, // cyclic\n parse, // might be excluded\n common; // \"\n\n/**\n * Constructs a new root namespace instance.\n * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together.\n * @extends NamespaceBase\n * @constructor\n * @param {Object.} [options] Top level options\n */\nfunction Root(options) {\n Namespace.call(this, \"\", options);\n\n /**\n * Deferred extension fields.\n * @type {Field[]}\n */\n this.deferred = [];\n\n /**\n * Resolved file names of loaded files.\n * @type {string[]}\n */\n this.files = [];\n}\n\n/**\n * Loads a namespace descriptor into a root namespace.\n * @param {INamespace} json Nameespace descriptor\n * @param {Root} [root] Root namespace, defaults to create a new one if omitted\n * @returns {Root} Root namespace\n */\nRoot.fromJSON = function fromJSON(json, root) {\n if (!root)\n root = new Root();\n if (json.options)\n root.setOptions(json.options);\n return root.addJSON(json.nested);\n};\n\n/**\n * Resolves the path of an imported file, relative to the importing origin.\n * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories.\n * @function\n * @param {string} origin The file name of the importing file\n * @param {string} target The file name being imported\n * @returns {string|null} Resolved path to `target` or `null` to skip the file\n */\nRoot.prototype.resolvePath = util.path.resolve;\n\n/**\n * Fetch content from file path or url\n * This method exists so you can override it with your own logic.\n * @function\n * @param {string} path File path or url\n * @param {FetchCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.fetch = util.fetch;\n\n// A symbol-like function to safely signal synchronous loading\n/* istanbul ignore next */\nfunction SYNC() {} // eslint-disable-line no-empty-function\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} options Parse options\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n */\nRoot.prototype.load = function load(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = undefined;\n }\n var self = this;\n if (!callback)\n return util.asPromise(load, self, filename, options);\n\n var sync = callback === SYNC; // undocumented\n\n // Finishes loading by calling the callback (exactly once)\n function finish(err, root) {\n /* istanbul ignore if */\n if (!callback)\n return;\n var cb = callback;\n callback = null;\n if (sync)\n throw err;\n cb(err, root);\n }\n\n // Bundled definition existence checking\n function getBundledFileName(filename) {\n var idx = filename.lastIndexOf(\"google/protobuf/\");\n if (idx > -1) {\n var altname = filename.substring(idx);\n if (altname in common) return altname;\n }\n return null;\n }\n\n // Processes a single file\n function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }\n\n // Fetches a single file\n function fetch(filename, weak) {\n\n // Skip if already loaded / attempted\n if (self.files.indexOf(filename) > -1)\n return;\n self.files.push(filename);\n\n // Shortcut bundled definitions\n if (filename in common) {\n if (sync)\n process(filename, common[filename]);\n else {\n ++queued;\n setTimeout(function() {\n --queued;\n process(filename, common[filename]);\n });\n }\n return;\n }\n\n // Otherwise fetch from disk or network\n if (sync) {\n var source;\n try {\n source = util.fs.readFileSync(filename).toString(\"utf8\");\n } catch (err) {\n if (!weak)\n finish(err);\n return;\n }\n process(filename, source);\n } else {\n ++queued;\n self.fetch(filename, function(err, source) {\n --queued;\n /* istanbul ignore if */\n if (!callback)\n return; // terminated meanwhile\n if (err) {\n /* istanbul ignore else */\n if (!weak)\n finish(err);\n else if (!queued) // can't be covered reliably\n finish(null, self);\n return;\n }\n process(filename, source);\n });\n }\n }\n var queued = 0;\n\n // Assembling the root namespace doesn't require working type\n // references anymore, so we can load everything in parallel\n if (util.isString(filename))\n filename = [ filename ];\n for (var i = 0, resolved; i < filename.length; ++i)\n if (resolved = self.resolvePath(\"\", filename[i]))\n fetch(resolved);\n\n if (sync)\n return self;\n if (!queued)\n finish(null, self);\n return undefined;\n};\n// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {LoadCallback} callback Callback function\n * @returns {undefined}\n * @variation 2\n */\n// function load(filename:string, callback:LoadCallback):undefined\n\n/**\n * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.\n * @function Root#load\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Promise} Promise\n * @variation 3\n */\n// function load(filename:string, [options:IParseOptions]):Promise\n\n/**\n * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).\n * @function Root#loadSync\n * @param {string|string[]} filename Names of one or multiple files to load\n * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted.\n * @returns {Root} Root namespace\n * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid\n */\nRoot.prototype.loadSync = function loadSync(filename, options) {\n if (!util.isNode)\n throw Error(\"not supported\");\n return this.load(filename, options, SYNC);\n};\n\n/**\n * @override\n */\nRoot.prototype.resolveAll = function resolveAll() {\n if (this.deferred.length)\n throw Error(\"unresolvable extensions: \" + this.deferred.map(function(field) {\n return \"'extend \" + field.extend + \"' in \" + field.parent.fullName;\n }).join(\", \"));\n return Namespace.prototype.resolveAll.call(this);\n};\n\n// only uppercased (and thus conflict-free) children are exposed, see below\nvar exposeRe = /^[A-Z]/;\n\n/**\n * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type.\n * @param {Root} root Root instance\n * @param {Field} field Declaring extension field witin the declaring type\n * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise\n * @inner\n * @ignore\n */\nfunction tryHandleExtension(root, field) {\n var extendedType = field.parent.lookup(field.extend);\n if (extendedType) {\n var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);\n sisterField.declaringField = field;\n field.extensionField = sisterField;\n extendedType.add(sisterField);\n return true;\n }\n return false;\n}\n\n/**\n * Called when any object is added to this root or its sub-namespaces.\n * @param {ReflectionObject} object Object added\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleAdd = function _handleAdd(object) {\n if (object instanceof Field) {\n\n if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField)\n if (!tryHandleExtension(this, object))\n this.deferred.push(object);\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n object.parent[object.name] = object.values; // expose enum values as property of its parent\n\n } else if (!(object instanceof OneOf)) /* everything else is a namespace */ {\n\n if (object instanceof Type) // Try to handle any deferred extensions\n for (var i = 0; i < this.deferred.length;)\n if (tryHandleExtension(this, this.deferred[i]))\n this.deferred.splice(i, 1);\n else\n ++i;\n for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace\n this._handleAdd(object._nestedArray[j]);\n if (exposeRe.test(object.name))\n object.parent[object.name] = object; // expose namespace as property of its parent\n }\n\n // The above also adds uppercased (and thus conflict-free) nested types, services and enums as\n // properties of namespaces just like static code does. This allows using a .d.ts generated for\n // a static module with reflection-based solutions where the condition is met.\n};\n\n/**\n * Called when any object is removed from this root or its sub-namespaces.\n * @param {ReflectionObject} object Object removed\n * @returns {undefined}\n * @private\n */\nRoot.prototype._handleRemove = function _handleRemove(object) {\n if (object instanceof Field) {\n\n if (/* an extension field */ object.extend !== undefined) {\n if (/* already handled */ object.extensionField) { // remove its sister field\n object.extensionField.parent.remove(object.extensionField);\n object.extensionField = null;\n } else { // cancel the extension\n var index = this.deferred.indexOf(object);\n /* istanbul ignore else */\n if (index > -1)\n this.deferred.splice(index, 1);\n }\n }\n\n } else if (object instanceof Enum) {\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose enum values\n\n } else if (object instanceof Namespace) {\n\n for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace\n this._handleRemove(object._nestedArray[i]);\n\n if (exposeRe.test(object.name))\n delete object.parent[object.name]; // unexpose namespaces\n\n }\n};\n\n// Sets up cyclic dependencies (called in index-light)\nRoot._configure = function(Type_, parse_, common_) {\n Type = Type_;\n parse = parse_;\n common = common_;\n};\n","\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n","\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(32);\n","\"use strict\";\nmodule.exports = Service;\n\nvar util = require(39);\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n","\"use strict\";\nmodule.exports = Service;\n\n// extends Namespace\nvar Namespace = require(23);\n((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = \"Service\";\n\nvar Method = require(22),\n util = require(37),\n rpc = require(31);\n\n/**\n * Constructs a new service instance.\n * @classdesc Reflected service.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Service name\n * @param {Object.} [options] Service options\n * @throws {TypeError} If arguments are invalid\n */\nfunction Service(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Service methods.\n * @type {Object.}\n */\n this.methods = {}; // toJSON, marker\n\n /**\n * Cached methods as an array.\n * @type {Method[]|null}\n * @private\n */\n this._methodsArray = null;\n}\n\n/**\n * Service descriptor.\n * @interface IService\n * @extends INamespace\n * @property {Object.} methods Method descriptors\n */\n\n/**\n * Constructs a service from a service descriptor.\n * @param {string} name Service name\n * @param {IService} json Service descriptor\n * @returns {Service} Created service\n * @throws {TypeError} If arguments are invalid\n */\nService.fromJSON = function fromJSON(name, json) {\n var service = new Service(name, json.options);\n /* istanbul ignore else */\n if (json.methods)\n for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)\n service.add(Method.fromJSON(names[i], json.methods[names[i]]));\n if (json.nested)\n service.addJSON(json.nested);\n service.comment = json.comment;\n return service;\n};\n\n/**\n * Converts this service to a service descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IService} Service descriptor\n */\nService.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"methods\" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {},\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * Methods of this service as an array for iteration.\n * @name Service#methodsArray\n * @type {Method[]}\n * @readonly\n */\nObject.defineProperty(Service.prototype, \"methodsArray\", {\n get: function() {\n return this._methodsArray || (this._methodsArray = util.toArray(this.methods));\n }\n});\n\nfunction clearCache(service) {\n service._methodsArray = null;\n return service;\n}\n\n/**\n * @override\n */\nService.prototype.get = function get(name) {\n return this.methods[name]\n || Namespace.prototype.get.call(this, name);\n};\n\n/**\n * @override\n */\nService.prototype.resolveAll = function resolveAll() {\n var methods = this.methodsArray;\n for (var i = 0; i < methods.length; ++i)\n methods[i].resolve();\n return Namespace.prototype.resolve.call(this);\n};\n\n/**\n * @override\n */\nService.prototype.add = function add(object) {\n\n /* istanbul ignore if */\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Method) {\n this.methods[object.name] = object;\n object.parent = this;\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * @override\n */\nService.prototype.remove = function remove(object) {\n if (object instanceof Method) {\n\n /* istanbul ignore if */\n if (this.methods[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.methods[object.name];\n object.parent = null;\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Creates a runtime service using the specified rpc implementation.\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed.\n */\nService.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {\n var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);\n for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {\n var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\\w_]/g, \"\");\n rpcService[methodName] = util.codegen([\"r\",\"c\"], util.isReserved(methodName) ? methodName + \"_\" : methodName)(\"return this.rpcCall(m,q,s,r,c)\")({\n m: method,\n q: method.resolvedRequestType.ctor,\n s: method.resolvedResponseType.ctor\n });\n }\n return rpcService;\n};\n","\"use strict\";\nmodule.exports = tokenize;\n\nvar delimRe = /[\\s{}=;:[\\],'\"()<>]/g,\n stringDoubleRe = /(?:\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\")/g,\n stringSingleRe = /(?:'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)')/g;\n\nvar setCommentRe = /^ *[*/]+ */,\n setCommentAltRe = /^\\s*\\*?\\/*/,\n setCommentSplitRe = /\\n/g,\n whitespaceRe = /\\s/,\n unescapeRe = /\\\\(.?)/g;\n\nvar unescapeMap = {\n \"0\": \"\\0\",\n \"r\": \"\\r\",\n \"n\": \"\\n\",\n \"t\": \"\\t\"\n};\n\n/**\n * Unescapes a string.\n * @param {string} str String to unescape\n * @returns {string} Unescaped string\n * @property {Object.} map Special characters map\n * @memberof tokenize\n */\nfunction unescape(str) {\n return str.replace(unescapeRe, function($0, $1) {\n switch ($1) {\n case \"\\\\\":\n case \"\":\n return $1;\n default:\n return unescapeMap[$1] || \"\";\n }\n });\n}\n\ntokenize.unescape = unescape;\n\n/**\n * Gets the next token and advances.\n * @typedef TokenizerHandleNext\n * @type {function}\n * @returns {string|null} Next token or `null` on eof\n */\n\n/**\n * Peeks for the next token.\n * @typedef TokenizerHandlePeek\n * @type {function}\n * @returns {string|null} Next token or `null` on eof\n */\n\n/**\n * Pushes a token back to the stack.\n * @typedef TokenizerHandlePush\n * @type {function}\n * @param {string} token Token\n * @returns {undefined}\n */\n\n/**\n * Skips the next token.\n * @typedef TokenizerHandleSkip\n * @type {function}\n * @param {string} expected Expected token\n * @param {boolean} [optional=false] If optional\n * @returns {boolean} Whether the token matched\n * @throws {Error} If the token didn't match and is not optional\n */\n\n/**\n * Gets the comment on the previous line or, alternatively, the line comment on the specified line.\n * @typedef TokenizerHandleCmnt\n * @type {function}\n * @param {number} [line] Line number\n * @returns {string|null} Comment text or `null` if none\n */\n\n/**\n * Handle object returned from {@link tokenize}.\n * @interface ITokenizerHandle\n * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof)\n * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof)\n * @property {TokenizerHandlePush} push Pushes a token back to the stack\n * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws\n * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any\n * @property {number} line Current line number\n */\n\n/**\n * Tokenizes the given .proto source and returns an object with useful utility functions.\n * @param {string} source Source contents\n * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode.\n * @returns {ITokenizerHandle} Tokenizer handle\n */\nfunction tokenize(source, alternateCommentMode) {\n /* eslint-disable callback-return */\n source = source.toString();\n\n var offset = 0,\n length = source.length,\n line = 1,\n commentType = null,\n commentText = null,\n commentLine = 0,\n commentLineEmpty = false,\n commentIsLeading = false;\n\n var stack = [];\n\n var stringDelim = null;\n\n /* istanbul ignore next */\n /**\n * Creates an error for illegal syntax.\n * @param {string} subject Subject\n * @returns {Error} Error created\n * @inner\n */\n function illegal(subject) {\n return Error(\"illegal \" + subject + \" (line \" + line + \")\");\n }\n\n /**\n * Reads a string till its end.\n * @returns {string} String read\n * @inner\n */\n function readString() {\n var re = stringDelim === \"'\" ? stringSingleRe : stringDoubleRe;\n re.lastIndex = offset - 1;\n var match = re.exec(source);\n if (!match)\n throw illegal(\"string\");\n offset = re.lastIndex;\n push(stringDelim);\n stringDelim = null;\n return unescape(match[1]);\n }\n\n /**\n * Gets the character at `pos` within the source.\n * @param {number} pos Position\n * @returns {string} Character\n * @inner\n */\n function charAt(pos) {\n return source.charAt(pos);\n }\n\n /**\n * Sets the current comment text.\n * @param {number} start Start offset\n * @param {number} end End offset\n * @param {boolean} isLeading set if a leading comment\n * @returns {undefined}\n * @inner\n */\n function setComment(start, end, isLeading) {\n commentType = source.charAt(start++);\n commentLine = line;\n commentLineEmpty = false;\n commentIsLeading = isLeading;\n var lookback;\n if (alternateCommentMode) {\n lookback = 2; // alternate comment parsing: \"//\" or \"/*\"\n } else {\n lookback = 3; // \"///\" or \"/**\"\n }\n var commentOffset = start - lookback,\n c;\n do {\n if (--commentOffset < 0 ||\n (c = source.charAt(commentOffset)) === \"\\n\") {\n commentLineEmpty = true;\n break;\n }\n } while (c === \" \" || c === \"\\t\");\n var lines = source\n .substring(start, end)\n .split(setCommentSplitRe);\n for (var i = 0; i < lines.length; ++i)\n lines[i] = lines[i]\n .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, \"\")\n .trim();\n commentText = lines\n .join(\"\\n\")\n .trim();\n }\n\n function isDoubleSlashCommentLine(startOffset) {\n var endOffset = findEndOfLine(startOffset);\n\n // see if remaining line matches comment pattern\n var lineText = source.substring(startOffset, endOffset);\n // look for 1 or 2 slashes since startOffset would already point past\n // the first slash that started the comment.\n var isComment = /^\\s*\\/{1,2}/.test(lineText);\n return isComment;\n }\n\n function findEndOfLine(cursor) {\n // find end of cursor's line\n var endOffset = cursor;\n while (endOffset < length && charAt(endOffset) !== \"\\n\") {\n endOffset++;\n }\n return endOffset;\n }\n\n /**\n * Obtains the next token.\n * @returns {string|null} Next token or `null` on eof\n * @inner\n */\n function next() {\n if (stack.length > 0)\n return stack.shift();\n if (stringDelim)\n return readString();\n var repeat,\n prev,\n curr,\n start,\n isDoc,\n isLeadingComment = offset === 0;\n do {\n if (offset === length)\n return null;\n repeat = false;\n while (whitespaceRe.test(curr = charAt(offset))) {\n if (curr === \"\\n\") {\n isLeadingComment = true;\n ++line;\n }\n if (++offset === length)\n return null;\n }\n\n if (charAt(offset) === \"/\") {\n if (++offset === length) {\n throw illegal(\"comment\");\n }\n if (charAt(offset) === \"/\") { // Line\n if (!alternateCommentMode) {\n // check for triple-slash comment\n isDoc = charAt(start = offset + 1) === \"/\";\n\n while (charAt(++offset) !== \"\\n\") {\n if (offset === length) {\n return null;\n }\n }\n ++offset;\n if (isDoc) {\n setComment(start, offset - 1, isLeadingComment);\n }\n ++line;\n repeat = true;\n } else {\n // check for double-slash comments, consolidating consecutive lines\n start = offset;\n isDoc = false;\n if (isDoubleSlashCommentLine(offset)) {\n isDoc = true;\n do {\n offset = findEndOfLine(offset);\n if (offset === length) {\n break;\n }\n offset++;\n } while (isDoubleSlashCommentLine(offset));\n } else {\n offset = Math.min(length, findEndOfLine(offset) + 1);\n }\n if (isDoc) {\n setComment(start, offset, isLeadingComment);\n }\n line++;\n repeat = true;\n }\n } else if ((curr = charAt(offset)) === \"*\") { /* Block */\n // check for /** (regular comment mode) or /* (alternate comment mode)\n start = offset + 1;\n isDoc = alternateCommentMode || charAt(start) === \"*\";\n do {\n if (curr === \"\\n\") {\n ++line;\n }\n if (++offset === length) {\n throw illegal(\"comment\");\n }\n prev = curr;\n curr = charAt(offset);\n } while (prev !== \"*\" || curr !== \"/\");\n ++offset;\n if (isDoc) {\n setComment(start, offset - 2, isLeadingComment);\n }\n repeat = true;\n } else {\n return \"/\";\n }\n }\n } while (repeat);\n\n // offset !== length if we got here\n\n var end = offset;\n delimRe.lastIndex = 0;\n var delim = delimRe.test(charAt(end++));\n if (!delim)\n while (end < length && !delimRe.test(charAt(end)))\n ++end;\n var token = source.substring(offset, offset = end);\n if (token === \"\\\"\" || token === \"'\")\n stringDelim = token;\n return token;\n }\n\n /**\n * Pushes a token back to the stack.\n * @param {string} token Token\n * @returns {undefined}\n * @inner\n */\n function push(token) {\n stack.push(token);\n }\n\n /**\n * Peeks for the next token.\n * @returns {string|null} Token or `null` on eof\n * @inner\n */\n function peek() {\n if (!stack.length) {\n var token = next();\n if (token === null)\n return null;\n push(token);\n }\n return stack[0];\n }\n\n /**\n * Skips a token.\n * @param {string} expected Expected token\n * @param {boolean} [optional=false] Whether the token is optional\n * @returns {boolean} `true` when skipped, `false` if not\n * @throws {Error} When a required token is not present\n * @inner\n */\n function skip(expected, optional) {\n var actual = peek(),\n equals = actual === expected;\n if (equals) {\n next();\n return true;\n }\n if (!optional)\n throw illegal(\"token '\" + actual + \"', '\" + expected + \"' expected\");\n return false;\n }\n\n /**\n * Gets a comment.\n * @param {number} [trailingLine] Line number if looking for a trailing comment\n * @returns {string|null} Comment text\n * @inner\n */\n function cmnt(trailingLine) {\n var ret = null;\n if (trailingLine === undefined) {\n if (commentLine === line - 1 && (alternateCommentMode || commentType === \"*\" || commentLineEmpty)) {\n ret = commentIsLeading ? commentText : null;\n }\n } else {\n /* istanbul ignore else */\n if (commentLine < trailingLine) {\n peek();\n }\n if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === \"/\")) {\n ret = commentIsLeading ? null : commentText;\n }\n }\n return ret;\n }\n\n return Object.defineProperty({\n next: next,\n peek: peek,\n push: push,\n skip: skip,\n cmnt: cmnt\n }, \"line\", {\n get: function() { return line; }\n });\n /* eslint-enable callback-return */\n}\n","\"use strict\";\nmodule.exports = Type;\n\n// extends Namespace\nvar Namespace = require(23);\n((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = \"Type\";\n\nvar Enum = require(15),\n OneOf = require(25),\n Field = require(16),\n MapField = require(20),\n Service = require(33),\n Message = require(21),\n Reader = require(27),\n Writer = require(42),\n util = require(37),\n encoder = require(14),\n decoder = require(13),\n verifier = require(40),\n converter = require(12),\n wrappers = require(41);\n\n/**\n * Constructs a new reflected message type instance.\n * @classdesc Reflected message type.\n * @extends NamespaceBase\n * @constructor\n * @param {string} name Message name\n * @param {Object.} [options] Declared options\n */\nfunction Type(name, options) {\n Namespace.call(this, name, options);\n\n /**\n * Message fields.\n * @type {Object.}\n */\n this.fields = {}; // toJSON, marker\n\n /**\n * Oneofs declared within this namespace, if any.\n * @type {Object.}\n */\n this.oneofs = undefined; // toJSON\n\n /**\n * Extension ranges, if any.\n * @type {number[][]}\n */\n this.extensions = undefined; // toJSON\n\n /**\n * Reserved ranges, if any.\n * @type {Array.}\n */\n this.reserved = undefined; // toJSON\n\n /*?\n * Whether this type is a legacy group.\n * @type {boolean|undefined}\n */\n this.group = undefined; // toJSON\n\n /**\n * Cached fields by id.\n * @type {Object.|null}\n * @private\n */\n this._fieldsById = null;\n\n /**\n * Cached fields as an array.\n * @type {Field[]|null}\n * @private\n */\n this._fieldsArray = null;\n\n /**\n * Cached oneofs as an array.\n * @type {OneOf[]|null}\n * @private\n */\n this._oneofsArray = null;\n\n /**\n * Cached constructor.\n * @type {Constructor<{}>}\n * @private\n */\n this._ctor = null;\n}\n\nObject.defineProperties(Type.prototype, {\n\n /**\n * Message fields by id.\n * @name Type#fieldsById\n * @type {Object.}\n * @readonly\n */\n fieldsById: {\n get: function() {\n\n /* istanbul ignore if */\n if (this._fieldsById)\n return this._fieldsById;\n\n this._fieldsById = {};\n for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {\n var field = this.fields[names[i]],\n id = field.id;\n\n /* istanbul ignore if */\n if (this._fieldsById[id])\n throw Error(\"duplicate id \" + id + \" in \" + this);\n\n this._fieldsById[id] = field;\n }\n return this._fieldsById;\n }\n },\n\n /**\n * Fields of this message as an array for iteration.\n * @name Type#fieldsArray\n * @type {Field[]}\n * @readonly\n */\n fieldsArray: {\n get: function() {\n return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));\n }\n },\n\n /**\n * Oneofs of this message as an array for iteration.\n * @name Type#oneofsArray\n * @type {OneOf[]}\n * @readonly\n */\n oneofsArray: {\n get: function() {\n return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));\n }\n },\n\n /**\n * The registered constructor, if any registered, otherwise a generic constructor.\n * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.\n * @name Type#ctor\n * @type {Constructor<{}>}\n */\n ctor: {\n get: function() {\n return this._ctor || (this.ctor = Type.generateConstructor(this)());\n },\n set: function(ctor) {\n\n // Ensure proper prototype\n var prototype = ctor.prototype;\n if (!(prototype instanceof Message)) {\n (ctor.prototype = new Message()).constructor = ctor;\n util.merge(ctor.prototype, prototype);\n }\n\n // Classes and messages reference their reflected type\n ctor.$type = ctor.prototype.$type = this;\n\n // Mix in static methods\n util.merge(ctor, Message, true);\n\n this._ctor = ctor;\n\n // Messages have non-enumerable default values on their prototype\n var i = 0;\n for (; i < /* initializes */ this.fieldsArray.length; ++i)\n this._fieldsArray[i].resolve(); // ensures a proper value\n\n // Messages have non-enumerable getters and setters for each virtual oneof field\n var ctorProperties = {};\n for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i)\n ctorProperties[this._oneofsArray[i].resolve().name] = {\n get: util.oneOfGetter(this._oneofsArray[i].oneof),\n set: util.oneOfSetter(this._oneofsArray[i].oneof)\n };\n if (i)\n Object.defineProperties(ctor.prototype, ctorProperties);\n }\n }\n});\n\n/**\n * Generates a constructor function for the specified type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nType.generateConstructor = function generateConstructor(mtype) {\n /* eslint-disable no-unexpected-multiline */\n var gen = util.codegen([\"p\"], mtype.name);\n // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype\n for (var i = 0, field; i < mtype.fieldsArray.length; ++i)\n if ((field = mtype._fieldsArray[i]).map) gen\n (\"this%s={}\", util.safeProp(field.name));\n else if (field.repeated) gen\n (\"this%s=[]\", util.safeProp(field.name));\n return gen\n (\"if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors\n * @property {Object.} fields Field descriptors\n * @property {number[][]} [extensions] Extension ranges\n * @property {number[][]} [reserved] Reserved ranges\n * @property {boolean} [group=false] Whether a legacy group or not\n */\n\n/**\n * Creates a message type from a message type descriptor.\n * @param {string} name Message name\n * @param {IType} json Message type descriptor\n * @returns {Type} Created message type\n */\nType.fromJSON = function fromJSON(name, json) {\n var type = new Type(name, json.options);\n type.extensions = json.extensions;\n type.reserved = json.reserved;\n var names = Object.keys(json.fields),\n i = 0;\n for (; i < names.length; ++i)\n type.add(\n ( typeof json.fields[names[i]].keyType !== \"undefined\"\n ? MapField.fromJSON\n : Field.fromJSON )(names[i], json.fields[names[i]])\n );\n if (json.oneofs)\n for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)\n type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));\n if (json.nested)\n for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {\n var nested = json.nested[names[i]];\n type.add( // most to least likely\n ( nested.id !== undefined\n ? Field.fromJSON\n : nested.fields !== undefined\n ? Type.fromJSON\n : nested.values !== undefined\n ? Enum.fromJSON\n : nested.methods !== undefined\n ? Service.fromJSON\n : Namespace.fromJSON )(names[i], nested)\n );\n }\n if (json.extensions && json.extensions.length)\n type.extensions = json.extensions;\n if (json.reserved && json.reserved.length)\n type.reserved = json.reserved;\n if (json.group)\n type.group = true;\n if (json.comment)\n type.comment = json.comment;\n return type;\n};\n\n/**\n * Converts this message type to a message type descriptor.\n * @param {IToJSONOptions} [toJSONOptions] JSON conversion options\n * @returns {IType} Message type descriptor\n */\nType.prototype.toJSON = function toJSON(toJSONOptions) {\n var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);\n var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;\n return util.toObject([\n \"options\" , inherited && inherited.options || undefined,\n \"oneofs\" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),\n \"fields\" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {},\n \"extensions\" , this.extensions && this.extensions.length ? this.extensions : undefined,\n \"reserved\" , this.reserved && this.reserved.length ? this.reserved : undefined,\n \"group\" , this.group || undefined,\n \"nested\" , inherited && inherited.nested || undefined,\n \"comment\" , keepComments ? this.comment : undefined\n ]);\n};\n\n/**\n * @override\n */\nType.prototype.resolveAll = function resolveAll() {\n var fields = this.fieldsArray, i = 0;\n while (i < fields.length)\n fields[i++].resolve();\n var oneofs = this.oneofsArray; i = 0;\n while (i < oneofs.length)\n oneofs[i++].resolve();\n return Namespace.prototype.resolveAll.call(this);\n};\n\n/**\n * @override\n */\nType.prototype.get = function get(name) {\n return this.fields[name]\n || this.oneofs && this.oneofs[name]\n || this.nested && this.nested[name]\n || null;\n};\n\n/**\n * Adds a nested object to this type.\n * @param {ReflectionObject} object Nested object to add\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id\n */\nType.prototype.add = function add(object) {\n\n if (this.get(object.name))\n throw Error(\"duplicate name '\" + object.name + \"' in \" + this);\n\n if (object instanceof Field && object.extend === undefined) {\n // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects.\n // The root object takes care of adding distinct sister-fields to the respective extended\n // type instead.\n\n // avoids calling the getter if not absolutely necessary because it's called quite frequently\n if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id])\n throw Error(\"duplicate id \" + object.id + \" in \" + this);\n if (this.isReservedId(object.id))\n throw Error(\"id \" + object.id + \" is reserved in \" + this);\n if (this.isReservedName(object.name))\n throw Error(\"name '\" + object.name + \"' is reserved in \" + this);\n\n if (object.parent)\n object.parent.remove(object);\n this.fields[object.name] = object;\n object.message = this;\n object.onAdd(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n if (!this.oneofs)\n this.oneofs = {};\n this.oneofs[object.name] = object;\n object.onAdd(this);\n return clearCache(this);\n }\n return Namespace.prototype.add.call(this, object);\n};\n\n/**\n * Removes a nested object from this type.\n * @param {ReflectionObject} object Nested object to remove\n * @returns {Type} `this`\n * @throws {TypeError} If arguments are invalid\n * @throws {Error} If `object` is not a member of this type\n */\nType.prototype.remove = function remove(object) {\n if (object instanceof Field && object.extend === undefined) {\n // See Type#add for the reason why extension fields are excluded here.\n\n /* istanbul ignore if */\n if (!this.fields || this.fields[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.fields[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n if (object instanceof OneOf) {\n\n /* istanbul ignore if */\n if (!this.oneofs || this.oneofs[object.name] !== object)\n throw Error(object + \" is not a member of \" + this);\n\n delete this.oneofs[object.name];\n object.parent = null;\n object.onRemove(this);\n return clearCache(this);\n }\n return Namespace.prototype.remove.call(this, object);\n};\n\n/**\n * Tests if the specified id is reserved.\n * @param {number} id Id to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedId = function isReservedId(id) {\n return Namespace.isReservedId(this.reserved, id);\n};\n\n/**\n * Tests if the specified name is reserved.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nType.prototype.isReservedName = function isReservedName(name) {\n return Namespace.isReservedName(this.reserved, name);\n};\n\n/**\n * Creates a new message of this type using the specified properties.\n * @param {Object.} [properties] Properties to set\n * @returns {Message<{}>} Message instance\n */\nType.prototype.create = function create(properties) {\n return new this.ctor(properties);\n};\n\n/**\n * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.\n * @returns {Type} `this`\n */\nType.prototype.setup = function setup() {\n // Sets up everything at once so that the prototype chain does not have to be re-evaluated\n // multiple times (V8, soft-deopt prototype-check).\n\n var fullName = this.fullName,\n types = [];\n for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i)\n types.push(this._fieldsArray[i].resolve().resolvedType);\n\n // Replace setup methods with type-specific generated functions\n this.encode = encoder(this)({\n Writer : Writer,\n types : types,\n util : util\n });\n this.decode = decoder(this)({\n Reader : Reader,\n types : types,\n util : util\n });\n this.verify = verifier(this)({\n types : types,\n util : util\n });\n this.fromObject = converter.fromObject(this)({\n types : types,\n util : util\n });\n this.toObject = converter.toObject(this)({\n types : types,\n util : util\n });\n\n // Inject custom wrappers for common types\n var wrapper = wrappers[fullName];\n if (wrapper) {\n var originalThis = Object.create(this);\n // if (wrapper.fromObject) {\n originalThis.fromObject = this.fromObject;\n this.fromObject = wrapper.fromObject.bind(originalThis);\n // }\n // if (wrapper.toObject) {\n originalThis.toObject = this.toObject;\n this.toObject = wrapper.toObject.bind(originalThis);\n // }\n }\n\n return this;\n};\n\n/**\n * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encode = function encode_setup(message, writer) {\n return this.setup().encode(message, writer); // overrides this method\n};\n\n/**\n * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.\n * @param {Message<{}>|Object.} message Message instance or plain object\n * @param {Writer} [writer] Writer to encode to\n * @returns {Writer} writer\n */\nType.prototype.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();\n};\n\n/**\n * Decodes a message of this type.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Length of the message, if known beforehand\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError<{}>} If required fields are missing\n */\nType.prototype.decode = function decode_setup(reader, length) {\n return this.setup().decode(reader, length); // overrides this method\n};\n\n/**\n * Decodes a message of this type preceeded by its byte length as a varint.\n * @param {Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {Message<{}>} Decoded message\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {util.ProtocolError} If required fields are missing\n */\nType.prototype.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof Reader))\n reader = Reader.create(reader);\n return this.decode(reader, reader.uint32());\n};\n\n/**\n * Verifies that field values are valid and that required fields are present.\n * @param {Object.} message Plain object to verify\n * @returns {null|string} `null` if valid, otherwise the reason why it is not\n */\nType.prototype.verify = function verify_setup(message) {\n return this.setup().verify(message); // overrides this method\n};\n\n/**\n * Creates a new message of this type from a plain object. Also converts values to their respective internal types.\n * @param {Object.} object Plain object to convert\n * @returns {Message<{}>} Message instance\n */\nType.prototype.fromObject = function fromObject(object) {\n return this.setup().fromObject(object);\n};\n\n/**\n * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.\n * @interface IConversionOptions\n * @property {Function} [longs] Long conversion type.\n * Valid values are `String` and `Number` (the global types).\n * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.\n * @property {Function} [enums] Enum value conversion type.\n * Only valid value is `String` (the global type).\n * Defaults to copy the present value, which is the numeric id.\n * @property {Function} [bytes] Bytes value conversion type.\n * Valid values are `Array` and (a base64 encoded) `String` (the global types).\n * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser.\n * @property {boolean} [defaults=false] Also sets default values on the resulting object\n * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false`\n * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false`\n * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any\n * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings\n */\n\n/**\n * Creates a plain object from a message of this type. Also converts values to other types if specified.\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\nType.prototype.toObject = function toObject(message, options) {\n return this.setup().toObject(message, options);\n};\n\n/**\n * Decorator function as returned by {@link Type.d} (TypeScript).\n * @typedef TypeDecorator\n * @type {function}\n * @param {Constructor} target Target constructor\n * @returns {undefined}\n * @template T extends Message\n */\n\n/**\n * Type decorator (TypeScript).\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {TypeDecorator} Decorator function\n * @template T extends Message\n */\nType.d = function decorateType(typeName) {\n return function typeDecorator(target) {\n util.decorateType(target, typeName);\n };\n};\n","\"use strict\";\n\n/**\n * Common type constants.\n * @namespace\n */\nvar types = exports;\n\nvar util = require(37);\n\nvar s = [\n \"double\", // 0\n \"float\", // 1\n \"int32\", // 2\n \"uint32\", // 3\n \"sint32\", // 4\n \"fixed32\", // 5\n \"sfixed32\", // 6\n \"int64\", // 7\n \"uint64\", // 8\n \"sint64\", // 9\n \"fixed64\", // 10\n \"sfixed64\", // 11\n \"bool\", // 12\n \"string\", // 13\n \"bytes\" // 14\n];\n\nfunction bake(values, offset) {\n var i = 0, o = {};\n offset |= 0;\n while (i < values.length) o[s[i + offset]] = values[i++];\n return o;\n}\n\n/**\n * Basic type wire types.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n * @property {number} bytes=2 Ldelim wire type\n */\ntypes.basic = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2,\n /* bytes */ 2\n]);\n\n/**\n * Basic type defaults.\n * @type {Object.}\n * @const\n * @property {number} double=0 Double default\n * @property {number} float=0 Float default\n * @property {number} int32=0 Int32 default\n * @property {number} uint32=0 Uint32 default\n * @property {number} sint32=0 Sint32 default\n * @property {number} fixed32=0 Fixed32 default\n * @property {number} sfixed32=0 Sfixed32 default\n * @property {number} int64=0 Int64 default\n * @property {number} uint64=0 Uint64 default\n * @property {number} sint64=0 Sint32 default\n * @property {number} fixed64=0 Fixed64 default\n * @property {number} sfixed64=0 Sfixed64 default\n * @property {boolean} bool=false Bool default\n * @property {string} string=\"\" String default\n * @property {Array.} bytes=Array(0) Bytes default\n * @property {null} message=null Message default\n */\ntypes.defaults = bake([\n /* double */ 0,\n /* float */ 0,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 0,\n /* sfixed32 */ 0,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 0,\n /* sfixed64 */ 0,\n /* bool */ false,\n /* string */ \"\",\n /* bytes */ util.emptyArray,\n /* message */ null\n]);\n\n/**\n * Basic long type wire types.\n * @type {Object.}\n * @const\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n */\ntypes.long = bake([\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1\n], 7);\n\n/**\n * Allowed types for map keys with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n * @property {number} string=2 Ldelim wire type\n */\ntypes.mapKey = bake([\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0,\n /* string */ 2\n], 2);\n\n/**\n * Allowed types for packed repeated fields with their associated wire type.\n * @type {Object.}\n * @const\n * @property {number} double=1 Fixed64 wire type\n * @property {number} float=5 Fixed32 wire type\n * @property {number} int32=0 Varint wire type\n * @property {number} uint32=0 Varint wire type\n * @property {number} sint32=0 Varint wire type\n * @property {number} fixed32=5 Fixed32 wire type\n * @property {number} sfixed32=5 Fixed32 wire type\n * @property {number} int64=0 Varint wire type\n * @property {number} uint64=0 Varint wire type\n * @property {number} sint64=0 Varint wire type\n * @property {number} fixed64=1 Fixed64 wire type\n * @property {number} sfixed64=1 Fixed64 wire type\n * @property {number} bool=0 Varint wire type\n */\ntypes.packed = bake([\n /* double */ 1,\n /* float */ 5,\n /* int32 */ 0,\n /* uint32 */ 0,\n /* sint32 */ 0,\n /* fixed32 */ 5,\n /* sfixed32 */ 5,\n /* int64 */ 0,\n /* uint64 */ 0,\n /* sint64 */ 0,\n /* fixed64 */ 1,\n /* sfixed64 */ 1,\n /* bool */ 0\n]);\n","\"use strict\";\n\n/**\n * Various utility functions.\n * @namespace\n */\nvar util = module.exports = require(39);\n\nvar roots = require(30);\n\nvar Type, // cyclic\n Enum;\n\nutil.codegen = require(3);\nutil.fetch = require(5);\nutil.path = require(8);\n\n/**\n * Node's fs module if available.\n * @type {Object.}\n */\nutil.fs = util.inquire(\"fs\");\n\n/**\n * Converts an object's values to an array.\n * @param {Object.} object Object to convert\n * @returns {Array.<*>} Converted array\n */\nutil.toArray = function toArray(object) {\n if (object) {\n var keys = Object.keys(object),\n array = new Array(keys.length),\n index = 0;\n while (index < keys.length)\n array[index] = object[keys[index++]];\n return array;\n }\n return [];\n};\n\n/**\n * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.\n * @param {Array.<*>} array Array to convert\n * @returns {Object.} Converted object\n */\nutil.toObject = function toObject(array) {\n var object = {},\n index = 0;\n while (index < array.length) {\n var key = array[index++],\n val = array[index++];\n if (val !== undefined)\n object[key] = val;\n }\n return object;\n};\n\nvar safePropBackslashRe = /\\\\/g,\n safePropQuoteRe = /\"/g;\n\n/**\n * Tests whether the specified name is a reserved word in JS.\n * @param {string} name Name to test\n * @returns {boolean} `true` if reserved, otherwise `false`\n */\nutil.isReserved = function isReserved(name) {\n return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);\n};\n\n/**\n * Returns a safe property accessor for the specified property name.\n * @param {string} prop Property name\n * @returns {string} Safe accessor\n */\nutil.safeProp = function safeProp(prop) {\n if (!/^[$\\w_]+$/.test(prop) || util.isReserved(prop))\n return \"[\\\"\" + prop.replace(safePropBackslashRe, \"\\\\\\\\\").replace(safePropQuoteRe, \"\\\\\\\"\") + \"\\\"]\";\n return \".\" + prop;\n};\n\n/**\n * Converts the first character of a string to upper case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.ucFirst = function ucFirst(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nvar camelCaseRe = /_([a-z])/g;\n\n/**\n * Converts a string to camel case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.camelCase = function camelCase(str) {\n return str.substring(0, 1)\n + str.substring(1)\n .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });\n};\n\n/**\n * Compares reflected fields by id.\n * @param {Field} a First field\n * @param {Field} b Second field\n * @returns {number} Comparison value\n */\nutil.compareFieldsById = function compareFieldsById(a, b) {\n return a.id - b.id;\n};\n\n/**\n * Decorator helper for types (TypeScript).\n * @param {Constructor} ctor Constructor function\n * @param {string} [typeName] Type name, defaults to the constructor's name\n * @returns {Type} Reflected type\n * @template T extends Message\n * @property {Root} root Decorators root\n */\nutil.decorateType = function decorateType(ctor, typeName) {\n\n /* istanbul ignore if */\n if (ctor.$type) {\n if (typeName && ctor.$type.name !== typeName) {\n util.decorateRoot.remove(ctor.$type);\n ctor.$type.name = typeName;\n util.decorateRoot.add(ctor.$type);\n }\n return ctor.$type;\n }\n\n /* istanbul ignore next */\n if (!Type)\n Type = require(35);\n\n var type = new Type(typeName || ctor.name);\n util.decorateRoot.add(type);\n type.ctor = ctor; // sets up .encode, .decode etc.\n Object.defineProperty(ctor, \"$type\", { value: type, enumerable: false });\n Object.defineProperty(ctor.prototype, \"$type\", { value: type, enumerable: false });\n return type;\n};\n\nvar decorateEnumIndex = 0;\n\n/**\n * Decorator helper for enums (TypeScript).\n * @param {Object} object Enum object\n * @returns {Enum} Reflected enum\n */\nutil.decorateEnum = function decorateEnum(object) {\n\n /* istanbul ignore if */\n if (object.$type)\n return object.$type;\n\n /* istanbul ignore next */\n if (!Enum)\n Enum = require(15);\n\n var enm = new Enum(\"Enum\" + decorateEnumIndex++, object);\n util.decorateRoot.add(enm);\n Object.defineProperty(object, \"$type\", { value: enm, enumerable: false });\n return enm;\n};\n\n\n/**\n * Sets the value of a property by property path. If a value already exists, it is turned to an array\n * @param {Object.} dst Destination object\n * @param {string} path dot '.' delimited path of the property to set\n * @param {Object} value the value to set\n * @returns {Object.} Destination object\n */\nutil.setProperty = function setProperty(dst, path, value) {\n function setProp(dst, path, value) {\n var part = path.shift();\n if (path.length > 0) {\n dst[part] = setProp(dst[part] || {}, path, value);\n } else {\n var prevValue = dst[part];\n if (prevValue)\n value = [].concat(prevValue).concat(value);\n dst[part] = value;\n }\n return dst;\n }\n\n if (typeof dst !== \"object\")\n throw TypeError(\"dst must be an object\");\n if (!path)\n throw TypeError(\"path must be specified\");\n\n path = path.split(\".\");\n return setProp(dst, path, value);\n};\n\n/**\n * Decorator root (TypeScript).\n * @name util.decorateRoot\n * @type {Root}\n * @readonly\n */\nObject.defineProperty(util, \"decorateRoot\", {\n get: function() {\n return roots[\"decorated\"] || (roots[\"decorated\"] = new (require(29))());\n }\n});\n","\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(39);\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n","\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(1);\n\n// converts to / from base64 encoded strings\nutil.base64 = require(2);\n\n// base class of rpc.Service\nutil.EventEmitter = require(4);\n\n// float handling accross browsers\nutil.float = require(6);\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(7);\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(10);\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(9);\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(38);\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n","\"use strict\";\nmodule.exports = verifier;\n\nvar Enum = require(15),\n util = require(37);\n\nfunction invalid(field, expected) {\n return field.name + \": \" + expected + (field.repeated && expected !== \"array\" ? \"[]\" : field.map && expected !== \"object\" ? \"{k:\"+field.keyType+\"}\" : \"\") + \" expected\";\n}\n\n/**\n * Generates a partial value verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {number} fieldIndex Field index\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyValue(gen, field, fieldIndex, ref) {\n /* eslint-disable no-unexpected-multiline */\n if (field.resolvedType) {\n if (field.resolvedType instanceof Enum) { gen\n (\"switch(%s){\", ref)\n (\"default:\")\n (\"return%j\", invalid(field, \"enum value\"));\n for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen\n (\"case %i:\", field.resolvedType.values[keys[j]]);\n gen\n (\"break\")\n (\"}\");\n } else {\n gen\n (\"{\")\n (\"var e=types[%i].verify(%s);\", fieldIndex, ref)\n (\"if(e)\")\n (\"return%j+e\", field.name + \".\")\n (\"}\");\n }\n } else {\n switch (field.type) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.isInteger(%s))\", ref)\n (\"return%j\", invalid(field, \"integer\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))\", ref, ref, ref, ref)\n (\"return%j\", invalid(field, \"integer|Long\"));\n break;\n case \"float\":\n case \"double\": gen\n (\"if(typeof %s!==\\\"number\\\")\", ref)\n (\"return%j\", invalid(field, \"number\"));\n break;\n case \"bool\": gen\n (\"if(typeof %s!==\\\"boolean\\\")\", ref)\n (\"return%j\", invalid(field, \"boolean\"));\n break;\n case \"string\": gen\n (\"if(!util.isString(%s))\", ref)\n (\"return%j\", invalid(field, \"string\"));\n break;\n case \"bytes\": gen\n (\"if(!(%s&&typeof %s.length===\\\"number\\\"||util.isString(%s)))\", ref, ref, ref)\n (\"return%j\", invalid(field, \"buffer\"));\n break;\n }\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a partial key verifier.\n * @param {Codegen} gen Codegen instance\n * @param {Field} field Reflected field\n * @param {string} ref Variable reference\n * @returns {Codegen} Codegen instance\n * @ignore\n */\nfunction genVerifyKey(gen, field, ref) {\n /* eslint-disable no-unexpected-multiline */\n switch (field.keyType) {\n case \"int32\":\n case \"uint32\":\n case \"sint32\":\n case \"fixed32\":\n case \"sfixed32\": gen\n (\"if(!util.key32Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"integer key\"));\n break;\n case \"int64\":\n case \"uint64\":\n case \"sint64\":\n case \"fixed64\":\n case \"sfixed64\": gen\n (\"if(!util.key64Re.test(%s))\", ref) // see comment above: x is ok, d is not\n (\"return%j\", invalid(field, \"integer|Long key\"));\n break;\n case \"bool\": gen\n (\"if(!util.key2Re.test(%s))\", ref)\n (\"return%j\", invalid(field, \"boolean key\"));\n break;\n }\n return gen;\n /* eslint-enable no-unexpected-multiline */\n}\n\n/**\n * Generates a verifier specific to the specified message type.\n * @param {Type} mtype Message type\n * @returns {Codegen} Codegen instance\n */\nfunction verifier(mtype) {\n /* eslint-disable no-unexpected-multiline */\n\n var gen = util.codegen([\"m\"], mtype.name + \"$verify\")\n (\"if(typeof m!==\\\"object\\\"||m===null)\")\n (\"return%j\", \"object expected\");\n var oneofs = mtype.oneofsArray,\n seenFirstField = {};\n if (oneofs.length) gen\n (\"var p={}\");\n\n for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {\n var field = mtype._fieldsArray[i].resolve(),\n ref = \"m\" + util.safeProp(field.name);\n\n if (field.optional) gen\n (\"if(%s!=null&&m.hasOwnProperty(%j)){\", ref, field.name); // !== undefined && !== null\n\n // map fields\n if (field.map) { gen\n (\"if(!util.isObject(%s))\", ref)\n (\"return%j\", invalid(field, \"object\"))\n (\"var k=Object.keys(%s)\", ref)\n (\"for(var i=0;i}\n * @const\n */\nvar wrappers = exports;\n\nvar Message = require(21);\n\n/**\n * From object converter part of an {@link IWrapper}.\n * @typedef WrapperFromObjectConverter\n * @type {function}\n * @param {Object.} object Plain object\n * @returns {Message<{}>} Message instance\n * @this Type\n */\n\n/**\n * To object converter part of an {@link IWrapper}.\n * @typedef WrapperToObjectConverter\n * @type {function}\n * @param {Message<{}>} message Message instance\n * @param {IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n * @this Type\n */\n\n/**\n * Common type wrapper part of {@link wrappers}.\n * @interface IWrapper\n * @property {WrapperFromObjectConverter} [fromObject] From object converter\n * @property {WrapperToObjectConverter} [toObject] To object converter\n */\n\n// Custom wrapper for Any\nwrappers[\".google.protobuf.Any\"] = {\n\n fromObject: function(object) {\n\n // unwrap value type if mapped\n if (object && object[\"@type\"]) {\n // Only use fully qualified type name after the last '/'\n var name = object[\"@type\"].substring(object[\"@type\"].lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type) {\n // type_url does not accept leading \".\"\n var type_url = object[\"@type\"].charAt(0) === \".\" ?\n object[\"@type\"].substr(1) : object[\"@type\"];\n // type_url prefix is optional, but path seperator is required\n if (type_url.indexOf(\"/\") === -1) {\n type_url = \"/\" + type_url;\n }\n return this.create({\n type_url: type_url,\n value: type.encode(type.fromObject(object)).finish()\n });\n }\n }\n\n return this.fromObject(object);\n },\n\n toObject: function(message, options) {\n\n // Default prefix\n var googleApi = \"type.googleapis.com/\";\n var prefix = \"\";\n var name = \"\";\n\n // decode value if requested and unmapped\n if (options && options.json && message.type_url && message.value) {\n // Only use fully qualified type name after the last '/'\n name = message.type_url.substring(message.type_url.lastIndexOf(\"/\") + 1);\n // Separate the prefix used\n prefix = message.type_url.substring(0, message.type_url.lastIndexOf(\"/\") + 1);\n var type = this.lookup(name);\n /* istanbul ignore else */\n if (type)\n message = type.decode(message.value);\n }\n\n // wrap value if unmapped\n if (!(message instanceof this.ctor) && message instanceof Message) {\n var object = message.$type.toObject(message, options);\n var messageName = message.$type.fullName[0] === \".\" ?\n message.$type.fullName.substr(1) : message.$type.fullName;\n // Default to type.googleapis.com prefix if no prefix is used\n if (prefix === \"\") {\n prefix = googleApi;\n }\n name = prefix + messageName;\n object[\"@type\"] = name;\n return object;\n }\n\n return this.toObject(message, options);\n }\n};\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(39);\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(42);\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(39);\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n"],"sourceRoot":"."} \ No newline at end of file diff --git a/node_modules/protobufjs/ext/debug/README.md b/node_modules/protobufjs/ext/debug/README.md deleted file mode 100644 index a48517e4..00000000 --- a/node_modules/protobufjs/ext/debug/README.md +++ /dev/null @@ -1,4 +0,0 @@ -protobufjs/ext/debug -========================= - -Experimental debugging extension. diff --git a/node_modules/protobufjs/ext/debug/index.js b/node_modules/protobufjs/ext/debug/index.js deleted file mode 100644 index 2b797664..00000000 --- a/node_modules/protobufjs/ext/debug/index.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -var protobuf = require("../.."); - -/** - * Debugging utility functions. Only present in debug builds. - * @namespace - */ -var debug = protobuf.debug = module.exports = {}; - -var codegen = protobuf.util.codegen; - -var debugFnRe = /function ([^(]+)\(([^)]*)\) {/g; - -// Counts number of calls to any generated function -function codegen_debug() { - codegen_debug.supported = codegen.supported; - codegen_debug.verbose = codegen.verbose; - var gen = codegen.apply(null, Array.prototype.slice.call(arguments)); - gen.str = (function(str) { return function str_debug() { - return str.apply(null, Array.prototype.slice.call(arguments)).replace(debugFnRe, "function $1($2) {\n\t$1.calls=($1.calls|0)+1"); - };})(gen.str); - return gen; -} - -/** - * Returns a list of unused types within the specified root. - * @param {NamespaceBase} ns Namespace to search - * @returns {Type[]} Unused types - */ -debug.unusedTypes = function unusedTypes(ns) { - - /* istanbul ignore if */ - if (!(ns instanceof protobuf.Namespace)) - throw TypeError("ns must be a Namespace"); - - /* istanbul ignore if */ - if (!ns.nested) - return []; - - var unused = []; - for (var names = Object.keys(ns.nested), i = 0; i < names.length; ++i) { - var nested = ns.nested[names[i]]; - if (nested instanceof protobuf.Type) { - var calls = (nested.encode.calls|0) - + (nested.decode.calls|0) - + (nested.verify.calls|0) - + (nested.toObject.calls|0) - + (nested.fromObject.calls|0); - if (!calls) - unused.push(nested); - } else if (nested instanceof protobuf.Namespace) - Array.prototype.push.apply(unused, unusedTypes(nested)); - } - return unused; -}; - -/** - * Enables debugging extensions. - * @returns {undefined} - */ -debug.enable = function enable() { - protobuf.util.codegen = codegen_debug; -}; - -/** - * Disables debugging extensions. - * @returns {undefined} - */ -debug.disable = function disable() { - protobuf.util.codegen = codegen; -}; diff --git a/node_modules/protobufjs/ext/descriptor/README.md b/node_modules/protobufjs/ext/descriptor/README.md deleted file mode 100644 index 3bc4c6c9..00000000 --- a/node_modules/protobufjs/ext/descriptor/README.md +++ /dev/null @@ -1,72 +0,0 @@ -protobufjs/ext/descriptor -========================= - -Experimental extension for interoperability with [descriptor.proto](https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto) types. - -Usage ------ - -```js -var protobuf = require("protobufjs"), // requires the full library - descriptor = require("protobufjs/ext/descriptor"); - -var root = ...; - -// convert any existing root instance to the corresponding descriptor type -var descriptorMsg = root.toDescriptor("proto2"); -// ^ returns a FileDescriptorSet message, see table below - -// encode to a descriptor buffer -var buffer = descriptor.FileDescriptorSet.encode(descriptorMsg).finish(); - -// decode from a descriptor buffer -var decodedDescriptor = descriptor.FileDescriptorSet.decode(buffer); - -// convert any existing descriptor to a root instance -root = protobuf.Root.fromDescriptor(decodedDescriptor); -// ^ expects a FileDescriptorSet message or buffer, see table below - -// and start all over again -``` - -API ---- - -The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto: - -| Descriptor type | protobuf.js type | Remarks -|-------------------------------|------------------|--------- -| **FileDescriptorSet** | Root | -| FileDescriptorProto | | dependencies are not supported -| FileOptions | | -| FileOptionsOptimizeMode | | -| SourceCodeInfo | | not supported -| SourceCodeInfoLocation | | -| GeneratedCodeInfo | | not supported -| GeneratedCodeInfoAnnotation | | -| **DescriptorProto** | Type | -| MessageOptions | | -| DescriptorProtoExtensionRange | | -| DescriptorProtoReservedRange | | -| **FieldDescriptorProto** | Field | -| FieldDescriptorProtoLabel | | -| FieldDescriptorProtoType | | -| FieldOptions | | -| FieldOptionsCType | | -| FieldOptionsJSType | | -| **OneofDescriptorProto** | OneOf | -| OneofOptions | | -| **EnumDescriptorProto** | Enum | -| EnumOptions | | -| EnumValueDescriptorProto | | -| EnumValueOptions | | not supported -| **ServiceDescriptorProto** | Service | -| ServiceOptions | | -| **MethodDescriptorProto** | Method | -| MethodOptions | | -| UninterpretedOption | | not supported -| UninterpretedOptionNamePart | | - -Note that not all features of descriptor.proto translate perfectly to a protobuf.js root instance. A root instance has only limited knowlege of packages or individual files for example, which is then compensated by guessing and generating fictional file names. - -When using TypeScript, the respective interface types can be used to reference specific message instances (i.e. `protobuf.Message`). diff --git a/node_modules/protobufjs/ext/descriptor/index.d.ts b/node_modules/protobufjs/ext/descriptor/index.d.ts deleted file mode 100644 index 1df2efcc..00000000 --- a/node_modules/protobufjs/ext/descriptor/index.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -import * as $protobuf from "../.."; -export const FileDescriptorSet: $protobuf.Type; - -export const FileDescriptorProto: $protobuf.Type; - -export const DescriptorProto: $protobuf.Type & { - ExtensionRange: $protobuf.Type, - ReservedRange: $protobuf.Type -}; - -export const FieldDescriptorProto: $protobuf.Type & { - Label: $protobuf.Enum, - Type: $protobuf.Enum -}; - -export const OneofDescriptorProto: $protobuf.Type; - -export const EnumDescriptorProto: $protobuf.Type; - -export const ServiceDescriptorProto: $protobuf.Type; - -export const EnumValueDescriptorProto: $protobuf.Type; - -export const MethodDescriptorProto: $protobuf.Type; - -export const FileOptions: $protobuf.Type & { - OptimizeMode: $protobuf.Enum -}; - -export const MessageOptions: $protobuf.Type; - -export const FieldOptions: $protobuf.Type & { - CType: $protobuf.Enum, - JSType: $protobuf.Enum -}; - -export const OneofOptions: $protobuf.Type; - -export const EnumOptions: $protobuf.Type; - -export const EnumValueOptions: $protobuf.Type; - -export const ServiceOptions: $protobuf.Type; - -export const MethodOptions: $protobuf.Type; - -export const UninterpretedOption: $protobuf.Type & { - NamePart: $protobuf.Type -}; - -export const SourceCodeInfo: $protobuf.Type & { - Location: $protobuf.Type -}; - -export const GeneratedCodeInfo: $protobuf.Type & { - Annotation: $protobuf.Type -}; - -export interface IFileDescriptorSet { - file: IFileDescriptorProto[]; -} - -export interface IFileDescriptorProto { - name?: string; - package?: string; - dependency?: any; - publicDependency?: any; - weakDependency?: any; - messageType?: IDescriptorProto[]; - enumType?: IEnumDescriptorProto[]; - service?: IServiceDescriptorProto[]; - extension?: IFieldDescriptorProto[]; - options?: IFileOptions; - sourceCodeInfo?: any; - syntax?: string; -} - -export interface IFileOptions { - javaPackage?: string; - javaOuterClassname?: string; - javaMultipleFiles?: boolean; - javaGenerateEqualsAndHash?: boolean; - javaStringCheckUtf8?: boolean; - optimizeFor?: IFileOptionsOptimizeMode; - goPackage?: string; - ccGenericServices?: boolean; - javaGenericServices?: boolean; - pyGenericServices?: boolean; - deprecated?: boolean; - ccEnableArenas?: boolean; - objcClassPrefix?: string; - csharpNamespace?: string; -} - -type IFileOptionsOptimizeMode = number; - -export interface IDescriptorProto { - name?: string; - field?: IFieldDescriptorProto[]; - extension?: IFieldDescriptorProto[]; - nestedType?: IDescriptorProto[]; - enumType?: IEnumDescriptorProto[]; - extensionRange?: IDescriptorProtoExtensionRange[]; - oneofDecl?: IOneofDescriptorProto[]; - options?: IMessageOptions; - reservedRange?: IDescriptorProtoReservedRange[]; - reservedName?: string[]; -} - -export interface IMessageOptions { - mapEntry?: boolean; -} - -export interface IDescriptorProtoExtensionRange { - start?: number; - end?: number; -} - -export interface IDescriptorProtoReservedRange { - start?: number; - end?: number; -} - -export interface IFieldDescriptorProto { - name?: string; - number?: number; - label?: IFieldDescriptorProtoLabel; - type?: IFieldDescriptorProtoType; - typeName?: string; - extendee?: string; - defaultValue?: string; - oneofIndex?: number; - jsonName?: any; - options?: IFieldOptions; -} - -type IFieldDescriptorProtoLabel = number; - -type IFieldDescriptorProtoType = number; - -export interface IFieldOptions { - packed?: boolean; - jstype?: IFieldOptionsJSType; -} - -type IFieldOptionsJSType = number; - -export interface IEnumDescriptorProto { - name?: string; - value?: IEnumValueDescriptorProto[]; - options?: IEnumOptions; -} - -export interface IEnumValueDescriptorProto { - name?: string; - number?: number; - options?: any; -} - -export interface IEnumOptions { - allowAlias?: boolean; - deprecated?: boolean; -} - -export interface IOneofDescriptorProto { - name?: string; - options?: any; -} - -export interface IServiceDescriptorProto { - name?: string; - method?: IMethodDescriptorProto[]; - options?: IServiceOptions; -} - -export interface IServiceOptions { - deprecated?: boolean; -} - -export interface IMethodDescriptorProto { - name?: string; - inputType?: string; - outputType?: string; - options?: IMethodOptions; - clientStreaming?: boolean; - serverStreaming?: boolean; -} - -export interface IMethodOptions { - deprecated?: boolean; -} diff --git a/node_modules/protobufjs/ext/descriptor/index.js b/node_modules/protobufjs/ext/descriptor/index.js deleted file mode 100644 index 6aafd2ab..00000000 --- a/node_modules/protobufjs/ext/descriptor/index.js +++ /dev/null @@ -1,1052 +0,0 @@ -"use strict"; -var $protobuf = require("../.."); -module.exports = exports = $protobuf.descriptor = $protobuf.Root.fromJSON(require("../../google/protobuf/descriptor.json")).lookup(".google.protobuf"); - -var Namespace = $protobuf.Namespace, - Root = $protobuf.Root, - Enum = $protobuf.Enum, - Type = $protobuf.Type, - Field = $protobuf.Field, - MapField = $protobuf.MapField, - OneOf = $protobuf.OneOf, - Service = $protobuf.Service, - Method = $protobuf.Method; - -// --- Root --- - -/** - * Properties of a FileDescriptorSet message. - * @interface IFileDescriptorSet - * @property {IFileDescriptorProto[]} file Files - */ - -/** - * Properties of a FileDescriptorProto message. - * @interface IFileDescriptorProto - * @property {string} [name] File name - * @property {string} [package] Package - * @property {*} [dependency] Not supported - * @property {*} [publicDependency] Not supported - * @property {*} [weakDependency] Not supported - * @property {IDescriptorProto[]} [messageType] Nested message types - * @property {IEnumDescriptorProto[]} [enumType] Nested enums - * @property {IServiceDescriptorProto[]} [service] Nested services - * @property {IFieldDescriptorProto[]} [extension] Nested extension fields - * @property {IFileOptions} [options] Options - * @property {*} [sourceCodeInfo] Not supported - * @property {string} [syntax="proto2"] Syntax - */ - -/** - * Properties of a FileOptions message. - * @interface IFileOptions - * @property {string} [javaPackage] - * @property {string} [javaOuterClassname] - * @property {boolean} [javaMultipleFiles] - * @property {boolean} [javaGenerateEqualsAndHash] - * @property {boolean} [javaStringCheckUtf8] - * @property {IFileOptionsOptimizeMode} [optimizeFor=1] - * @property {string} [goPackage] - * @property {boolean} [ccGenericServices] - * @property {boolean} [javaGenericServices] - * @property {boolean} [pyGenericServices] - * @property {boolean} [deprecated] - * @property {boolean} [ccEnableArenas] - * @property {string} [objcClassPrefix] - * @property {string} [csharpNamespace] - */ - -/** - * Values of he FileOptions.OptimizeMode enum. - * @typedef IFileOptionsOptimizeMode - * @type {number} - * @property {number} SPEED=1 - * @property {number} CODE_SIZE=2 - * @property {number} LITE_RUNTIME=3 - */ - -/** - * Creates a root from a descriptor set. - * @param {IFileDescriptorSet|Reader|Uint8Array} descriptor Descriptor - * @returns {Root} Root instance - */ -Root.fromDescriptor = function fromDescriptor(descriptor) { - - // Decode the descriptor message if specified as a buffer: - if (typeof descriptor.length === "number") - descriptor = exports.FileDescriptorSet.decode(descriptor); - - var root = new Root(); - - if (descriptor.file) { - var fileDescriptor, - filePackage; - for (var j = 0, i; j < descriptor.file.length; ++j) { - filePackage = root; - if ((fileDescriptor = descriptor.file[j])["package"] && fileDescriptor["package"].length) - filePackage = root.define(fileDescriptor["package"]); - if (fileDescriptor.name && fileDescriptor.name.length) - root.files.push(filePackage.filename = fileDescriptor.name); - if (fileDescriptor.messageType) - for (i = 0; i < fileDescriptor.messageType.length; ++i) - filePackage.add(Type.fromDescriptor(fileDescriptor.messageType[i], fileDescriptor.syntax)); - if (fileDescriptor.enumType) - for (i = 0; i < fileDescriptor.enumType.length; ++i) - filePackage.add(Enum.fromDescriptor(fileDescriptor.enumType[i])); - if (fileDescriptor.extension) - for (i = 0; i < fileDescriptor.extension.length; ++i) - filePackage.add(Field.fromDescriptor(fileDescriptor.extension[i])); - if (fileDescriptor.service) - for (i = 0; i < fileDescriptor.service.length; ++i) - filePackage.add(Service.fromDescriptor(fileDescriptor.service[i])); - var opts = fromDescriptorOptions(fileDescriptor.options, exports.FileOptions); - if (opts) { - var ks = Object.keys(opts); - for (i = 0; i < ks.length; ++i) - filePackage.setOption(ks[i], opts[ks[i]]); - } - } - } - - return root; -}; - -/** - * Converts a root to a descriptor set. - * @returns {Message} Descriptor - * @param {string} [syntax="proto2"] Syntax - */ -Root.prototype.toDescriptor = function toDescriptor(syntax) { - var set = exports.FileDescriptorSet.create(); - Root_toDescriptorRecursive(this, set.file, syntax); - return set; -}; - -// Traverses a namespace and assembles the descriptor set -function Root_toDescriptorRecursive(ns, files, syntax) { - - // Create a new file - var file = exports.FileDescriptorProto.create({ name: ns.filename || (ns.fullName.substring(1).replace(/\./g, "_") || "root") + ".proto" }); - if (syntax) - file.syntax = syntax; - if (!(ns instanceof Root)) - file["package"] = ns.fullName.substring(1); - - // Add nested types - for (var i = 0, nested; i < ns.nestedArray.length; ++i) - if ((nested = ns._nestedArray[i]) instanceof Type) - file.messageType.push(nested.toDescriptor(syntax)); - else if (nested instanceof Enum) - file.enumType.push(nested.toDescriptor()); - else if (nested instanceof Field) - file.extension.push(nested.toDescriptor(syntax)); - else if (nested instanceof Service) - file.service.push(nested.toDescriptor()); - else if (nested instanceof /* plain */ Namespace) - Root_toDescriptorRecursive(nested, files, syntax); // requires new file - - // Keep package-level options - file.options = toDescriptorOptions(ns.options, exports.FileOptions); - - // And keep the file only if there is at least one nested object - if (file.messageType.length + file.enumType.length + file.extension.length + file.service.length) - files.push(file); -} - -// --- Type --- - -/** - * Properties of a DescriptorProto message. - * @interface IDescriptorProto - * @property {string} [name] Message type name - * @property {IFieldDescriptorProto[]} [field] Fields - * @property {IFieldDescriptorProto[]} [extension] Extension fields - * @property {IDescriptorProto[]} [nestedType] Nested message types - * @property {IEnumDescriptorProto[]} [enumType] Nested enums - * @property {IDescriptorProtoExtensionRange[]} [extensionRange] Extension ranges - * @property {IOneofDescriptorProto[]} [oneofDecl] Oneofs - * @property {IMessageOptions} [options] Not supported - * @property {IDescriptorProtoReservedRange[]} [reservedRange] Reserved ranges - * @property {string[]} [reservedName] Reserved names - */ - -/** - * Properties of a MessageOptions message. - * @interface IMessageOptions - * @property {boolean} [mapEntry=false] Whether this message is a map entry - */ - -/** - * Properties of an ExtensionRange message. - * @interface IDescriptorProtoExtensionRange - * @property {number} [start] Start field id - * @property {number} [end] End field id - */ - -/** - * Properties of a ReservedRange message. - * @interface IDescriptorProtoReservedRange - * @property {number} [start] Start field id - * @property {number} [end] End field id - */ - -var unnamedMessageIndex = 0; - -/** - * Creates a type from a descriptor. - * @param {IDescriptorProto|Reader|Uint8Array} descriptor Descriptor - * @param {string} [syntax="proto2"] Syntax - * @returns {Type} Type instance - */ -Type.fromDescriptor = function fromDescriptor(descriptor, syntax) { - - // Decode the descriptor message if specified as a buffer: - if (typeof descriptor.length === "number") - descriptor = exports.DescriptorProto.decode(descriptor); - - // Create the message type - var type = new Type(descriptor.name.length ? descriptor.name : "Type" + unnamedMessageIndex++, fromDescriptorOptions(descriptor.options, exports.MessageOptions)), - i; - - /* Oneofs */ if (descriptor.oneofDecl) - for (i = 0; i < descriptor.oneofDecl.length; ++i) - type.add(OneOf.fromDescriptor(descriptor.oneofDecl[i])); - /* Fields */ if (descriptor.field) - for (i = 0; i < descriptor.field.length; ++i) { - var field = Field.fromDescriptor(descriptor.field[i], syntax); - type.add(field); - if (descriptor.field[i].hasOwnProperty("oneofIndex")) // eslint-disable-line no-prototype-builtins - type.oneofsArray[descriptor.field[i].oneofIndex].add(field); - } - /* Extension fields */ if (descriptor.extension) - for (i = 0; i < descriptor.extension.length; ++i) - type.add(Field.fromDescriptor(descriptor.extension[i], syntax)); - /* Nested types */ if (descriptor.nestedType) - for (i = 0; i < descriptor.nestedType.length; ++i) { - type.add(Type.fromDescriptor(descriptor.nestedType[i], syntax)); - if (descriptor.nestedType[i].options && descriptor.nestedType[i].options.mapEntry) - type.setOption("map_entry", true); - } - /* Nested enums */ if (descriptor.enumType) - for (i = 0; i < descriptor.enumType.length; ++i) - type.add(Enum.fromDescriptor(descriptor.enumType[i])); - /* Extension ranges */ if (descriptor.extensionRange && descriptor.extensionRange.length) { - type.extensions = []; - for (i = 0; i < descriptor.extensionRange.length; ++i) - type.extensions.push([ descriptor.extensionRange[i].start, descriptor.extensionRange[i].end ]); - } - /* Reserved... */ if (descriptor.reservedRange && descriptor.reservedRange.length || descriptor.reservedName && descriptor.reservedName.length) { - type.reserved = []; - /* Ranges */ if (descriptor.reservedRange) - for (i = 0; i < descriptor.reservedRange.length; ++i) - type.reserved.push([ descriptor.reservedRange[i].start, descriptor.reservedRange[i].end ]); - /* Names */ if (descriptor.reservedName) - for (i = 0; i < descriptor.reservedName.length; ++i) - type.reserved.push(descriptor.reservedName[i]); - } - - return type; -}; - -/** - * Converts a type to a descriptor. - * @returns {Message} Descriptor - * @param {string} [syntax="proto2"] Syntax - */ -Type.prototype.toDescriptor = function toDescriptor(syntax) { - var descriptor = exports.DescriptorProto.create({ name: this.name }), - i; - - /* Fields */ for (i = 0; i < this.fieldsArray.length; ++i) { - var fieldDescriptor; - descriptor.field.push(fieldDescriptor = this._fieldsArray[i].toDescriptor(syntax)); - if (this._fieldsArray[i] instanceof MapField) { // map fields are repeated FieldNameEntry - var keyType = toDescriptorType(this._fieldsArray[i].keyType, this._fieldsArray[i].resolvedKeyType), - valueType = toDescriptorType(this._fieldsArray[i].type, this._fieldsArray[i].resolvedType), - valueTypeName = valueType === /* type */ 11 || valueType === /* enum */ 14 - ? this._fieldsArray[i].resolvedType && shortname(this.parent, this._fieldsArray[i].resolvedType) || this._fieldsArray[i].type - : undefined; - descriptor.nestedType.push(exports.DescriptorProto.create({ - name: fieldDescriptor.typeName, - field: [ - exports.FieldDescriptorProto.create({ name: "key", number: 1, label: 1, type: keyType }), // can't reference a type or enum - exports.FieldDescriptorProto.create({ name: "value", number: 2, label: 1, type: valueType, typeName: valueTypeName }) - ], - options: exports.MessageOptions.create({ mapEntry: true }) - })); - } - } - /* Oneofs */ for (i = 0; i < this.oneofsArray.length; ++i) - descriptor.oneofDecl.push(this._oneofsArray[i].toDescriptor()); - /* Nested... */ for (i = 0; i < this.nestedArray.length; ++i) { - /* Extension fields */ if (this._nestedArray[i] instanceof Field) - descriptor.field.push(this._nestedArray[i].toDescriptor(syntax)); - /* Types */ else if (this._nestedArray[i] instanceof Type) - descriptor.nestedType.push(this._nestedArray[i].toDescriptor(syntax)); - /* Enums */ else if (this._nestedArray[i] instanceof Enum) - descriptor.enumType.push(this._nestedArray[i].toDescriptor()); - // plain nested namespaces become packages instead in Root#toDescriptor - } - /* Extension ranges */ if (this.extensions) - for (i = 0; i < this.extensions.length; ++i) - descriptor.extensionRange.push(exports.DescriptorProto.ExtensionRange.create({ start: this.extensions[i][0], end: this.extensions[i][1] })); - /* Reserved... */ if (this.reserved) - for (i = 0; i < this.reserved.length; ++i) - /* Names */ if (typeof this.reserved[i] === "string") - descriptor.reservedName.push(this.reserved[i]); - /* Ranges */ else - descriptor.reservedRange.push(exports.DescriptorProto.ReservedRange.create({ start: this.reserved[i][0], end: this.reserved[i][1] })); - - descriptor.options = toDescriptorOptions(this.options, exports.MessageOptions); - - return descriptor; -}; - -// --- Field --- - -/** - * Properties of a FieldDescriptorProto message. - * @interface IFieldDescriptorProto - * @property {string} [name] Field name - * @property {number} [number] Field id - * @property {IFieldDescriptorProtoLabel} [label] Field rule - * @property {IFieldDescriptorProtoType} [type] Field basic type - * @property {string} [typeName] Field type name - * @property {string} [extendee] Extended type name - * @property {string} [defaultValue] Literal default value - * @property {number} [oneofIndex] Oneof index if part of a oneof - * @property {*} [jsonName] Not supported - * @property {IFieldOptions} [options] Field options - */ - -/** - * Values of the FieldDescriptorProto.Label enum. - * @typedef IFieldDescriptorProtoLabel - * @type {number} - * @property {number} LABEL_OPTIONAL=1 - * @property {number} LABEL_REQUIRED=2 - * @property {number} LABEL_REPEATED=3 - */ - -/** - * Values of the FieldDescriptorProto.Type enum. - * @typedef IFieldDescriptorProtoType - * @type {number} - * @property {number} TYPE_DOUBLE=1 - * @property {number} TYPE_FLOAT=2 - * @property {number} TYPE_INT64=3 - * @property {number} TYPE_UINT64=4 - * @property {number} TYPE_INT32=5 - * @property {number} TYPE_FIXED64=6 - * @property {number} TYPE_FIXED32=7 - * @property {number} TYPE_BOOL=8 - * @property {number} TYPE_STRING=9 - * @property {number} TYPE_GROUP=10 - * @property {number} TYPE_MESSAGE=11 - * @property {number} TYPE_BYTES=12 - * @property {number} TYPE_UINT32=13 - * @property {number} TYPE_ENUM=14 - * @property {number} TYPE_SFIXED32=15 - * @property {number} TYPE_SFIXED64=16 - * @property {number} TYPE_SINT32=17 - * @property {number} TYPE_SINT64=18 - */ - -/** - * Properties of a FieldOptions message. - * @interface IFieldOptions - * @property {boolean} [packed] Whether packed or not (defaults to `false` for proto2 and `true` for proto3) - * @property {IFieldOptionsJSType} [jstype] JavaScript value type (not used by protobuf.js) - */ - -/** - * Values of the FieldOptions.JSType enum. - * @typedef IFieldOptionsJSType - * @type {number} - * @property {number} JS_NORMAL=0 - * @property {number} JS_STRING=1 - * @property {number} JS_NUMBER=2 - */ - -// copied here from parse.js -var numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/; - -/** - * Creates a field from a descriptor. - * @param {IFieldDescriptorProto|Reader|Uint8Array} descriptor Descriptor - * @param {string} [syntax="proto2"] Syntax - * @returns {Field} Field instance - */ -Field.fromDescriptor = function fromDescriptor(descriptor, syntax) { - - // Decode the descriptor message if specified as a buffer: - if (typeof descriptor.length === "number") - descriptor = exports.DescriptorProto.decode(descriptor); - - if (typeof descriptor.number !== "number") - throw Error("missing field id"); - - // Rewire field type - var fieldType; - if (descriptor.typeName && descriptor.typeName.length) - fieldType = descriptor.typeName; - else - fieldType = fromDescriptorType(descriptor.type); - - // Rewire field rule - var fieldRule; - switch (descriptor.label) { - // 0 is reserved for errors - case 1: fieldRule = undefined; break; - case 2: fieldRule = "required"; break; - case 3: fieldRule = "repeated"; break; - default: throw Error("illegal label: " + descriptor.label); - } - - var extendee = descriptor.extendee; - if (descriptor.extendee !== undefined) { - extendee = extendee.length ? extendee : undefined; - } - var field = new Field( - descriptor.name.length ? descriptor.name : "field" + descriptor.number, - descriptor.number, - fieldType, - fieldRule, - extendee - ); - - field.options = fromDescriptorOptions(descriptor.options, exports.FieldOptions); - - if (descriptor.defaultValue && descriptor.defaultValue.length) { - var defaultValue = descriptor.defaultValue; - switch (defaultValue) { - case "true": case "TRUE": - defaultValue = true; - break; - case "false": case "FALSE": - defaultValue = false; - break; - default: - var match = numberRe.exec(defaultValue); - if (match) - defaultValue = parseInt(defaultValue); // eslint-disable-line radix - break; - } - field.setOption("default", defaultValue); - } - - if (packableDescriptorType(descriptor.type)) { - if (syntax === "proto3") { // defaults to packed=true (internal preset is packed=true) - if (descriptor.options && !descriptor.options.packed) - field.setOption("packed", false); - } else if (!(descriptor.options && descriptor.options.packed)) // defaults to packed=false - field.setOption("packed", false); - } - - return field; -}; - -/** - * Converts a field to a descriptor. - * @returns {Message} Descriptor - * @param {string} [syntax="proto2"] Syntax - */ -Field.prototype.toDescriptor = function toDescriptor(syntax) { - var descriptor = exports.FieldDescriptorProto.create({ name: this.name, number: this.id }); - - if (this.map) { - - descriptor.type = 11; // message - descriptor.typeName = $protobuf.util.ucFirst(this.name); // fieldName -> FieldNameEntry (built in Type#toDescriptor) - descriptor.label = 3; // repeated - - } else { - - // Rewire field type - switch (descriptor.type = toDescriptorType(this.type, this.resolve().resolvedType)) { - case 10: // group - case 11: // type - case 14: // enum - descriptor.typeName = this.resolvedType ? shortname(this.parent, this.resolvedType) : this.type; - break; - } - - // Rewire field rule - switch (this.rule) { - case "repeated": descriptor.label = 3; break; - case "required": descriptor.label = 2; break; - default: descriptor.label = 1; break; - } - - } - - // Handle extension field - descriptor.extendee = this.extensionField ? this.extensionField.parent.fullName : this.extend; - - // Handle part of oneof - if (this.partOf) - if ((descriptor.oneofIndex = this.parent.oneofsArray.indexOf(this.partOf)) < 0) - throw Error("missing oneof"); - - if (this.options) { - descriptor.options = toDescriptorOptions(this.options, exports.FieldOptions); - if (this.options["default"] != null) - descriptor.defaultValue = String(this.options["default"]); - } - - if (syntax === "proto3") { // defaults to packed=true - if (!this.packed) - (descriptor.options || (descriptor.options = exports.FieldOptions.create())).packed = false; - } else if (this.packed) // defaults to packed=false - (descriptor.options || (descriptor.options = exports.FieldOptions.create())).packed = true; - - return descriptor; -}; - -// --- Enum --- - -/** - * Properties of an EnumDescriptorProto message. - * @interface IEnumDescriptorProto - * @property {string} [name] Enum name - * @property {IEnumValueDescriptorProto[]} [value] Enum values - * @property {IEnumOptions} [options] Enum options - */ - -/** - * Properties of an EnumValueDescriptorProto message. - * @interface IEnumValueDescriptorProto - * @property {string} [name] Name - * @property {number} [number] Value - * @property {*} [options] Not supported - */ - -/** - * Properties of an EnumOptions message. - * @interface IEnumOptions - * @property {boolean} [allowAlias] Whether aliases are allowed - * @property {boolean} [deprecated] - */ - -var unnamedEnumIndex = 0; - -/** - * Creates an enum from a descriptor. - * @param {IEnumDescriptorProto|Reader|Uint8Array} descriptor Descriptor - * @returns {Enum} Enum instance - */ -Enum.fromDescriptor = function fromDescriptor(descriptor) { - - // Decode the descriptor message if specified as a buffer: - if (typeof descriptor.length === "number") - descriptor = exports.EnumDescriptorProto.decode(descriptor); - - // Construct values object - var values = {}; - if (descriptor.value) - for (var i = 0; i < descriptor.value.length; ++i) { - var name = descriptor.value[i].name, - value = descriptor.value[i].number || 0; - values[name && name.length ? name : "NAME" + value] = value; - } - - return new Enum( - descriptor.name && descriptor.name.length ? descriptor.name : "Enum" + unnamedEnumIndex++, - values, - fromDescriptorOptions(descriptor.options, exports.EnumOptions) - ); -}; - -/** - * Converts an enum to a descriptor. - * @returns {Message} Descriptor - */ -Enum.prototype.toDescriptor = function toDescriptor() { - - // Values - var values = []; - for (var i = 0, ks = Object.keys(this.values); i < ks.length; ++i) - values.push(exports.EnumValueDescriptorProto.create({ name: ks[i], number: this.values[ks[i]] })); - - return exports.EnumDescriptorProto.create({ - name: this.name, - value: values, - options: toDescriptorOptions(this.options, exports.EnumOptions) - }); -}; - -// --- OneOf --- - -/** - * Properties of a OneofDescriptorProto message. - * @interface IOneofDescriptorProto - * @property {string} [name] Oneof name - * @property {*} [options] Not supported - */ - -var unnamedOneofIndex = 0; - -/** - * Creates a oneof from a descriptor. - * @param {IOneofDescriptorProto|Reader|Uint8Array} descriptor Descriptor - * @returns {OneOf} OneOf instance - */ -OneOf.fromDescriptor = function fromDescriptor(descriptor) { - - // Decode the descriptor message if specified as a buffer: - if (typeof descriptor.length === "number") - descriptor = exports.OneofDescriptorProto.decode(descriptor); - - return new OneOf( - // unnamedOneOfIndex is global, not per type, because we have no ref to a type here - descriptor.name && descriptor.name.length ? descriptor.name : "oneof" + unnamedOneofIndex++ - // fromDescriptorOptions(descriptor.options, exports.OneofOptions) - only uninterpreted_option - ); -}; - -/** - * Converts a oneof to a descriptor. - * @returns {Message} Descriptor - */ -OneOf.prototype.toDescriptor = function toDescriptor() { - return exports.OneofDescriptorProto.create({ - name: this.name - // options: toDescriptorOptions(this.options, exports.OneofOptions) - only uninterpreted_option - }); -}; - -// --- Service --- - -/** - * Properties of a ServiceDescriptorProto message. - * @interface IServiceDescriptorProto - * @property {string} [name] Service name - * @property {IMethodDescriptorProto[]} [method] Methods - * @property {IServiceOptions} [options] Options - */ - -/** - * Properties of a ServiceOptions message. - * @interface IServiceOptions - * @property {boolean} [deprecated] - */ - -var unnamedServiceIndex = 0; - -/** - * Creates a service from a descriptor. - * @param {IServiceDescriptorProto|Reader|Uint8Array} descriptor Descriptor - * @returns {Service} Service instance - */ -Service.fromDescriptor = function fromDescriptor(descriptor) { - - // Decode the descriptor message if specified as a buffer: - if (typeof descriptor.length === "number") - descriptor = exports.ServiceDescriptorProto.decode(descriptor); - - var service = new Service(descriptor.name && descriptor.name.length ? descriptor.name : "Service" + unnamedServiceIndex++, fromDescriptorOptions(descriptor.options, exports.ServiceOptions)); - if (descriptor.method) - for (var i = 0; i < descriptor.method.length; ++i) - service.add(Method.fromDescriptor(descriptor.method[i])); - - return service; -}; - -/** - * Converts a service to a descriptor. - * @returns {Message} Descriptor - */ -Service.prototype.toDescriptor = function toDescriptor() { - - // Methods - var methods = []; - for (var i = 0; i < this.methodsArray.length; ++i) - methods.push(this._methodsArray[i].toDescriptor()); - - return exports.ServiceDescriptorProto.create({ - name: this.name, - method: methods, - options: toDescriptorOptions(this.options, exports.ServiceOptions) - }); -}; - -// --- Method --- - -/** - * Properties of a MethodDescriptorProto message. - * @interface IMethodDescriptorProto - * @property {string} [name] Method name - * @property {string} [inputType] Request type name - * @property {string} [outputType] Response type name - * @property {IMethodOptions} [options] Not supported - * @property {boolean} [clientStreaming=false] Whether requests are streamed - * @property {boolean} [serverStreaming=false] Whether responses are streamed - */ - -/** - * Properties of a MethodOptions message. - * @interface IMethodOptions - * @property {boolean} [deprecated] - */ - -var unnamedMethodIndex = 0; - -/** - * Creates a method from a descriptor. - * @param {IMethodDescriptorProto|Reader|Uint8Array} descriptor Descriptor - * @returns {Method} Reflected method instance - */ -Method.fromDescriptor = function fromDescriptor(descriptor) { - - // Decode the descriptor message if specified as a buffer: - if (typeof descriptor.length === "number") - descriptor = exports.MethodDescriptorProto.decode(descriptor); - - return new Method( - // unnamedMethodIndex is global, not per service, because we have no ref to a service here - descriptor.name && descriptor.name.length ? descriptor.name : "Method" + unnamedMethodIndex++, - "rpc", - descriptor.inputType, - descriptor.outputType, - Boolean(descriptor.clientStreaming), - Boolean(descriptor.serverStreaming), - fromDescriptorOptions(descriptor.options, exports.MethodOptions) - ); -}; - -/** - * Converts a method to a descriptor. - * @returns {Message} Descriptor - */ -Method.prototype.toDescriptor = function toDescriptor() { - return exports.MethodDescriptorProto.create({ - name: this.name, - inputType: this.resolvedRequestType ? this.resolvedRequestType.fullName : this.requestType, - outputType: this.resolvedResponseType ? this.resolvedResponseType.fullName : this.responseType, - clientStreaming: this.requestStream, - serverStreaming: this.responseStream, - options: toDescriptorOptions(this.options, exports.MethodOptions) - }); -}; - -// --- utility --- - -// Converts a descriptor type to a protobuf.js basic type -function fromDescriptorType(type) { - switch (type) { - // 0 is reserved for errors - case 1: return "double"; - case 2: return "float"; - case 3: return "int64"; - case 4: return "uint64"; - case 5: return "int32"; - case 6: return "fixed64"; - case 7: return "fixed32"; - case 8: return "bool"; - case 9: return "string"; - case 12: return "bytes"; - case 13: return "uint32"; - case 15: return "sfixed32"; - case 16: return "sfixed64"; - case 17: return "sint32"; - case 18: return "sint64"; - } - throw Error("illegal type: " + type); -} - -// Tests if a descriptor type is packable -function packableDescriptorType(type) { - switch (type) { - case 1: // double - case 2: // float - case 3: // int64 - case 4: // uint64 - case 5: // int32 - case 6: // fixed64 - case 7: // fixed32 - case 8: // bool - case 13: // uint32 - case 14: // enum (!) - case 15: // sfixed32 - case 16: // sfixed64 - case 17: // sint32 - case 18: // sint64 - return true; - } - return false; -} - -// Converts a protobuf.js basic type to a descriptor type -function toDescriptorType(type, resolvedType) { - switch (type) { - // 0 is reserved for errors - case "double": return 1; - case "float": return 2; - case "int64": return 3; - case "uint64": return 4; - case "int32": return 5; - case "fixed64": return 6; - case "fixed32": return 7; - case "bool": return 8; - case "string": return 9; - case "bytes": return 12; - case "uint32": return 13; - case "sfixed32": return 15; - case "sfixed64": return 16; - case "sint32": return 17; - case "sint64": return 18; - } - if (resolvedType instanceof Enum) - return 14; - if (resolvedType instanceof Type) - return resolvedType.group ? 10 : 11; - throw Error("illegal type: " + type); -} - -// Converts descriptor options to an options object -function fromDescriptorOptions(options, type) { - if (!options) - return undefined; - var out = []; - for (var i = 0, field, key, val; i < type.fieldsArray.length; ++i) - if ((key = (field = type._fieldsArray[i]).name) !== "uninterpretedOption") - if (options.hasOwnProperty(key)) { // eslint-disable-line no-prototype-builtins - val = options[key]; - if (field.resolvedType instanceof Enum && typeof val === "number" && field.resolvedType.valuesById[val] !== undefined) - val = field.resolvedType.valuesById[val]; - out.push(underScore(key), val); - } - return out.length ? $protobuf.util.toObject(out) : undefined; -} - -// Converts an options object to descriptor options -function toDescriptorOptions(options, type) { - if (!options) - return undefined; - var out = []; - for (var i = 0, ks = Object.keys(options), key, val; i < ks.length; ++i) { - val = options[key = ks[i]]; - if (key === "default") - continue; - var field = type.fields[key]; - if (!field && !(field = type.fields[key = $protobuf.util.camelCase(key)])) - continue; - out.push(key, val); - } - return out.length ? type.fromObject($protobuf.util.toObject(out)) : undefined; -} - -// Calculates the shortest relative path from `from` to `to`. -function shortname(from, to) { - var fromPath = from.fullName.split("."), - toPath = to.fullName.split("."), - i = 0, - j = 0, - k = toPath.length - 1; - if (!(from instanceof Root) && to instanceof Namespace) - while (i < fromPath.length && j < k && fromPath[i] === toPath[j]) { - var other = to.lookup(fromPath[i++], true); - if (other !== null && other !== to) - break; - ++j; - } - else - for (; i < fromPath.length && j < k && fromPath[i] === toPath[j]; ++i, ++j); - return toPath.slice(j).join("."); -} - -// copied here from cli/targets/proto.js -function underScore(str) { - return str.substring(0,1) - + str.substring(1) - .replace(/([A-Z])(?=[a-z]|$)/g, function($0, $1) { return "_" + $1.toLowerCase(); }); -} - -// --- exports --- - -/** - * Reflected file descriptor set. - * @name FileDescriptorSet - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected file descriptor proto. - * @name FileDescriptorProto - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected descriptor proto. - * @name DescriptorProto - * @type {Type} - * @property {Type} ExtensionRange - * @property {Type} ReservedRange - * @const - * @tstype $protobuf.Type & { - * ExtensionRange: $protobuf.Type, - * ReservedRange: $protobuf.Type - * } - */ - -/** - * Reflected field descriptor proto. - * @name FieldDescriptorProto - * @type {Type} - * @property {Enum} Label - * @property {Enum} Type - * @const - * @tstype $protobuf.Type & { - * Label: $protobuf.Enum, - * Type: $protobuf.Enum - * } - */ - -/** - * Reflected oneof descriptor proto. - * @name OneofDescriptorProto - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected enum descriptor proto. - * @name EnumDescriptorProto - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected service descriptor proto. - * @name ServiceDescriptorProto - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected enum value descriptor proto. - * @name EnumValueDescriptorProto - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected method descriptor proto. - * @name MethodDescriptorProto - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected file options. - * @name FileOptions - * @type {Type} - * @property {Enum} OptimizeMode - * @const - * @tstype $protobuf.Type & { - * OptimizeMode: $protobuf.Enum - * } - */ - -/** - * Reflected message options. - * @name MessageOptions - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected field options. - * @name FieldOptions - * @type {Type} - * @property {Enum} CType - * @property {Enum} JSType - * @const - * @tstype $protobuf.Type & { - * CType: $protobuf.Enum, - * JSType: $protobuf.Enum - * } - */ - -/** - * Reflected oneof options. - * @name OneofOptions - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected enum options. - * @name EnumOptions - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected enum value options. - * @name EnumValueOptions - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected service options. - * @name ServiceOptions - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected method options. - * @name MethodOptions - * @type {Type} - * @const - * @tstype $protobuf.Type - */ - -/** - * Reflected uninterpretet option. - * @name UninterpretedOption - * @type {Type} - * @property {Type} NamePart - * @const - * @tstype $protobuf.Type & { - * NamePart: $protobuf.Type - * } - */ - -/** - * Reflected source code info. - * @name SourceCodeInfo - * @type {Type} - * @property {Type} Location - * @const - * @tstype $protobuf.Type & { - * Location: $protobuf.Type - * } - */ - -/** - * Reflected generated code info. - * @name GeneratedCodeInfo - * @type {Type} - * @property {Type} Annotation - * @const - * @tstype $protobuf.Type & { - * Annotation: $protobuf.Type - * } - */ diff --git a/node_modules/protobufjs/ext/descriptor/test.js b/node_modules/protobufjs/ext/descriptor/test.js deleted file mode 100644 index ceb80f82..00000000 --- a/node_modules/protobufjs/ext/descriptor/test.js +++ /dev/null @@ -1,54 +0,0 @@ -/*eslint-disable no-console*/ -"use strict"; -var protobuf = require("../../"), - descriptor = require("."); - -/* var proto = { - nested: { - Message: { - fields: { - foo: { - type: "string", - id: 1 - } - }, - nested: { - SubMessage: { - fields: {} - } - } - }, - Enum: { - values: { - ONE: 1, - TWO: 2 - } - } - } -}; */ - -// var root = protobuf.Root.fromJSON(proto).resolveAll(); -var root = protobuf.loadSync("tests/data/google/protobuf/descriptor.proto").resolveAll(); - -// console.log("Original proto", JSON.stringify(root, null, 2)); - -var msg = root.toDescriptor(); - -// console.log("\nDescriptor", JSON.stringify(msg.toObject(), null, 2)); - -var buf = descriptor.FileDescriptorSet.encode(msg).finish(); -var root2 = protobuf.Root.fromDescriptor(buf, "proto2").resolveAll(); - -// console.log("\nDecoded proto", JSON.stringify(root2, null, 2)); - -var diff = require("deep-diff").diff(root.toJSON(), root2.toJSON()); -if (diff) { - diff.forEach(function(diff) { - console.log(diff.kind + " @ " + diff.path.join(".")); - console.log("lhs:", typeof diff.lhs, diff.lhs); - console.log("rhs:", typeof diff.rhs, diff.rhs); - console.log(); - }); - process.exitCode = 1; -} else - console.log("no differences"); diff --git a/node_modules/protobufjs/google/LICENSE b/node_modules/protobufjs/google/LICENSE deleted file mode 100644 index 868bd40d..00000000 --- a/node_modules/protobufjs/google/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2014, Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/protobufjs/google/README.md b/node_modules/protobufjs/google/README.md deleted file mode 100644 index 09e3f230..00000000 --- a/node_modules/protobufjs/google/README.md +++ /dev/null @@ -1 +0,0 @@ -This folder contains stripped and pre-parsed definitions of common Google types. These files are not used by protobuf.js directly but are here so you can use or include them where required. diff --git a/node_modules/protobufjs/google/api/annotations.json b/node_modules/protobufjs/google/api/annotations.json deleted file mode 100644 index 3f13a733..00000000 --- a/node_modules/protobufjs/google/api/annotations.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "api": { - "nested": { - "http": { - "type": "HttpRule", - "id": 72295728, - "extend": "google.protobuf.MethodOptions" - }, - "HttpRule": { - "oneofs": { - "pattern": { - "oneof": [ - "get", - "put", - "post", - "delete", - "patch", - "custom" - ] - } - }, - "fields": { - "get": { - "type": "string", - "id": 2 - }, - "put": { - "type": "string", - "id": 3 - }, - "post": { - "type": "string", - "id": 4 - }, - "delete": { - "type": "string", - "id": 5 - }, - "patch": { - "type": "string", - "id": 6 - }, - "custom": { - "type": "CustomHttpPattern", - "id": 8 - }, - "selector": { - "type": "string", - "id": 1 - }, - "body": { - "type": "string", - "id": 7 - }, - "additionalBindings": { - "rule": "repeated", - "type": "HttpRule", - "id": 11 - } - } - } - } - }, - "protobuf": { - "nested": { - "MethodOptions": { - "fields": {}, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/api/annotations.proto b/node_modules/protobufjs/google/api/annotations.proto deleted file mode 100644 index 63a8eefd..00000000 --- a/node_modules/protobufjs/google/api/annotations.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -package google.api; - -import "google/api/http.proto"; -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.MethodOptions { - - HttpRule http = 72295728; -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/api/http.json b/node_modules/protobufjs/google/api/http.json deleted file mode 100644 index e3a0f4f9..00000000 --- a/node_modules/protobufjs/google/api/http.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "api": { - "nested": { - "Http": { - "fields": { - "rules": { - "rule": "repeated", - "type": "HttpRule", - "id": 1 - } - } - }, - "HttpRule": { - "oneofs": { - "pattern": { - "oneof": [ - "get", - "put", - "post", - "delete", - "patch", - "custom" - ] - } - }, - "fields": { - "get": { - "type": "string", - "id": 2 - }, - "put": { - "type": "string", - "id": 3 - }, - "post": { - "type": "string", - "id": 4 - }, - "delete": { - "type": "string", - "id": 5 - }, - "patch": { - "type": "string", - "id": 6 - }, - "custom": { - "type": "CustomHttpPattern", - "id": 8 - }, - "selector": { - "type": "string", - "id": 1 - }, - "body": { - "type": "string", - "id": 7 - }, - "additionalBindings": { - "rule": "repeated", - "type": "HttpRule", - "id": 11 - } - } - }, - "CustomHttpPattern": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "path": { - "type": "string", - "id": 2 - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/api/http.proto b/node_modules/protobufjs/google/api/http.proto deleted file mode 100644 index e9a7e9de..00000000 --- a/node_modules/protobufjs/google/api/http.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; - -package google.api; - -message Http { - - repeated HttpRule rules = 1; -} - -message HttpRule { - - oneof pattern { - - string get = 2; - string put = 3; - string post = 4; - string delete = 5; - string patch = 6; - CustomHttpPattern custom = 8; - } - - string selector = 1; - string body = 7; - repeated HttpRule additional_bindings = 11; -} - -message CustomHttpPattern { - - string kind = 1; - string path = 2; -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/protobuf/api.json b/node_modules/protobufjs/google/protobuf/api.json deleted file mode 100644 index 5460612f..00000000 --- a/node_modules/protobufjs/google/protobuf/api.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "protobuf": { - "nested": { - "Api": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "methods": { - "rule": "repeated", - "type": "Method", - "id": 2 - }, - "options": { - "rule": "repeated", - "type": "Option", - "id": 3 - }, - "version": { - "type": "string", - "id": 4 - }, - "sourceContext": { - "type": "SourceContext", - "id": 5 - }, - "mixins": { - "rule": "repeated", - "type": "Mixin", - "id": 6 - }, - "syntax": { - "type": "Syntax", - "id": 7 - } - } - }, - "Method": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "requestTypeUrl": { - "type": "string", - "id": 2 - }, - "requestStreaming": { - "type": "bool", - "id": 3 - }, - "responseTypeUrl": { - "type": "string", - "id": 4 - }, - "responseStreaming": { - "type": "bool", - "id": 5 - }, - "options": { - "rule": "repeated", - "type": "Option", - "id": 6 - }, - "syntax": { - "type": "Syntax", - "id": 7 - } - } - }, - "Mixin": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "root": { - "type": "string", - "id": 2 - } - } - }, - "SourceContext": { - "fields": { - "fileName": { - "type": "string", - "id": 1 - } - } - }, - "Option": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "Any", - "id": 2 - } - } - }, - "Syntax": { - "values": { - "SYNTAX_PROTO2": 0, - "SYNTAX_PROTO3": 1 - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/protobuf/api.proto b/node_modules/protobufjs/google/protobuf/api.proto deleted file mode 100644 index cf6ae3f3..00000000 --- a/node_modules/protobufjs/google/protobuf/api.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto3"; - -package google.protobuf; - -import "google/protobuf/source_context.proto"; -import "google/protobuf/type.proto"; - -message Api { - - string name = 1; - repeated Method methods = 2; - repeated Option options = 3; - string version = 4; - SourceContext source_context = 5; - repeated Mixin mixins = 6; - Syntax syntax = 7; -} - -message Method { - - string name = 1; - string request_type_url = 2; - bool request_streaming = 3; - string response_type_url = 4; - bool response_streaming = 5; - repeated Option options = 6; - Syntax syntax = 7; -} - -message Mixin { - - string name = 1; - string root = 2; -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/protobuf/descriptor.json b/node_modules/protobufjs/google/protobuf/descriptor.json deleted file mode 100644 index f6c5c112..00000000 --- a/node_modules/protobufjs/google/protobuf/descriptor.json +++ /dev/null @@ -1,739 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "protobuf": { - "nested": { - "FileDescriptorSet": { - "fields": { - "file": { - "rule": "repeated", - "type": "FileDescriptorProto", - "id": 1 - } - } - }, - "FileDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "package": { - "type": "string", - "id": 2 - }, - "dependency": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "publicDependency": { - "rule": "repeated", - "type": "int32", - "id": 10, - "options": { - "packed": false - } - }, - "weakDependency": { - "rule": "repeated", - "type": "int32", - "id": 11, - "options": { - "packed": false - } - }, - "messageType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 4 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 5 - }, - "service": { - "rule": "repeated", - "type": "ServiceDescriptorProto", - "id": 6 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 7 - }, - "options": { - "type": "FileOptions", - "id": 8 - }, - "sourceCodeInfo": { - "type": "SourceCodeInfo", - "id": 9 - }, - "syntax": { - "type": "string", - "id": 12 - } - } - }, - "DescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "field": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 2 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 6 - }, - "nestedType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 3 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 4 - }, - "extensionRange": { - "rule": "repeated", - "type": "ExtensionRange", - "id": 5 - }, - "oneofDecl": { - "rule": "repeated", - "type": "OneofDescriptorProto", - "id": 8 - }, - "options": { - "type": "MessageOptions", - "id": 7 - }, - "reservedRange": { - "rule": "repeated", - "type": "ReservedRange", - "id": 9 - }, - "reservedName": { - "rule": "repeated", - "type": "string", - "id": 10 - } - }, - "nested": { - "ExtensionRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - }, - "ReservedRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - } - } - }, - "FieldDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 3 - }, - "label": { - "type": "Label", - "id": 4 - }, - "type": { - "type": "Type", - "id": 5 - }, - "typeName": { - "type": "string", - "id": 6 - }, - "extendee": { - "type": "string", - "id": 2 - }, - "defaultValue": { - "type": "string", - "id": 7 - }, - "oneofIndex": { - "type": "int32", - "id": 9 - }, - "jsonName": { - "type": "string", - "id": 10 - }, - "options": { - "type": "FieldOptions", - "id": 8 - } - }, - "nested": { - "Type": { - "values": { - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18 - } - }, - "Label": { - "values": { - "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3 - } - } - } - }, - "OneofDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "options": { - "type": "OneofOptions", - "id": 2 - } - } - }, - "EnumDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "rule": "repeated", - "type": "EnumValueDescriptorProto", - "id": 2 - }, - "options": { - "type": "EnumOptions", - "id": 3 - } - } - }, - "EnumValueDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 2 - }, - "options": { - "type": "EnumValueOptions", - "id": 3 - } - } - }, - "ServiceDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "method": { - "rule": "repeated", - "type": "MethodDescriptorProto", - "id": 2 - }, - "options": { - "type": "ServiceOptions", - "id": 3 - } - } - }, - "MethodDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "inputType": { - "type": "string", - "id": 2 - }, - "outputType": { - "type": "string", - "id": 3 - }, - "options": { - "type": "MethodOptions", - "id": 4 - }, - "clientStreaming": { - "type": "bool", - "id": 5 - }, - "serverStreaming": { - "type": "bool", - "id": 6 - } - } - }, - "FileOptions": { - "fields": { - "javaPackage": { - "type": "string", - "id": 1 - }, - "javaOuterClassname": { - "type": "string", - "id": 8 - }, - "javaMultipleFiles": { - "type": "bool", - "id": 10 - }, - "javaGenerateEqualsAndHash": { - "type": "bool", - "id": 20, - "options": { - "deprecated": true - } - }, - "javaStringCheckUtf8": { - "type": "bool", - "id": 27 - }, - "optimizeFor": { - "type": "OptimizeMode", - "id": 9, - "options": { - "default": "SPEED" - } - }, - "goPackage": { - "type": "string", - "id": 11 - }, - "ccGenericServices": { - "type": "bool", - "id": 16 - }, - "javaGenericServices": { - "type": "bool", - "id": 17 - }, - "pyGenericServices": { - "type": "bool", - "id": 18 - }, - "deprecated": { - "type": "bool", - "id": 23 - }, - "ccEnableArenas": { - "type": "bool", - "id": 31 - }, - "objcClassPrefix": { - "type": "string", - "id": 36 - }, - "csharpNamespace": { - "type": "string", - "id": 37 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 38, - 38 - ] - ], - "nested": { - "OptimizeMode": { - "values": { - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3 - } - } - } - }, - "MessageOptions": { - "fields": { - "messageSetWireFormat": { - "type": "bool", - "id": 1 - }, - "noStandardDescriptorAccessor": { - "type": "bool", - "id": 2 - }, - "deprecated": { - "type": "bool", - "id": 3 - }, - "mapEntry": { - "type": "bool", - "id": 7 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 8, - 8 - ] - ] - }, - "FieldOptions": { - "fields": { - "ctype": { - "type": "CType", - "id": 1, - "options": { - "default": "STRING" - } - }, - "packed": { - "type": "bool", - "id": 2 - }, - "jstype": { - "type": "JSType", - "id": 6, - "options": { - "default": "JS_NORMAL" - } - }, - "lazy": { - "type": "bool", - "id": 5 - }, - "deprecated": { - "type": "bool", - "id": 3 - }, - "weak": { - "type": "bool", - "id": 10 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 4, - 4 - ] - ], - "nested": { - "CType": { - "values": { - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2 - } - }, - "JSType": { - "values": { - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2 - } - } - } - }, - "OneofOptions": { - "fields": { - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "EnumOptions": { - "fields": { - "allowAlias": { - "type": "bool", - "id": 2 - }, - "deprecated": { - "type": "bool", - "id": 3 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "EnumValueOptions": { - "fields": { - "deprecated": { - "type": "bool", - "id": 1 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "ServiceOptions": { - "fields": { - "deprecated": { - "type": "bool", - "id": 33 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "MethodOptions": { - "fields": { - "deprecated": { - "type": "bool", - "id": 33 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "UninterpretedOption": { - "fields": { - "name": { - "rule": "repeated", - "type": "NamePart", - "id": 2 - }, - "identifierValue": { - "type": "string", - "id": 3 - }, - "positiveIntValue": { - "type": "uint64", - "id": 4 - }, - "negativeIntValue": { - "type": "int64", - "id": 5 - }, - "doubleValue": { - "type": "double", - "id": 6 - }, - "stringValue": { - "type": "bytes", - "id": 7 - }, - "aggregateValue": { - "type": "string", - "id": 8 - } - }, - "nested": { - "NamePart": { - "fields": { - "namePart": { - "rule": "required", - "type": "string", - "id": 1 - }, - "isExtension": { - "rule": "required", - "type": "bool", - "id": 2 - } - } - } - } - }, - "SourceCodeInfo": { - "fields": { - "location": { - "rule": "repeated", - "type": "Location", - "id": 1 - } - }, - "nested": { - "Location": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1 - }, - "span": { - "rule": "repeated", - "type": "int32", - "id": 2 - }, - "leadingComments": { - "type": "string", - "id": 3 - }, - "trailingComments": { - "type": "string", - "id": 4 - }, - "leadingDetachedComments": { - "rule": "repeated", - "type": "string", - "id": 6 - } - } - } - } - }, - "GeneratedCodeInfo": { - "fields": { - "annotation": { - "rule": "repeated", - "type": "Annotation", - "id": 1 - } - }, - "nested": { - "Annotation": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1 - }, - "sourceFile": { - "type": "string", - "id": 2 - }, - "begin": { - "type": "int32", - "id": 3 - }, - "end": { - "type": "int32", - "id": 4 - } - } - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/protobuf/descriptor.proto b/node_modules/protobufjs/google/protobuf/descriptor.proto deleted file mode 100644 index 32794926..00000000 --- a/node_modules/protobufjs/google/protobuf/descriptor.proto +++ /dev/null @@ -1,286 +0,0 @@ -syntax = "proto2"; - -package google.protobuf; - -message FileDescriptorSet { - - repeated FileDescriptorProto file = 1; -} - -message FileDescriptorProto { - - optional string name = 1; - optional string package = 2; - repeated string dependency = 3; - repeated int32 public_dependency = 10; - repeated int32 weak_dependency = 11; - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - optional FileOptions options = 8; - optional SourceCodeInfo source_code_info = 9; - optional string syntax = 12; -} - -message DescriptorProto { - - optional string name = 1; - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - repeated ExtensionRange extension_range = 5; - repeated OneofDescriptorProto oneof_decl = 8; - optional MessageOptions options = 7; - repeated ReservedRange reserved_range = 9; - repeated string reserved_name = 10; - - message ExtensionRange { - - optional int32 start = 1; - optional int32 end = 2; - } - - message ReservedRange { - - optional int32 start = 1; - optional int32 end = 2; - } -} - -message FieldDescriptorProto { - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - optional Type type = 5; - optional string type_name = 6; - optional string extendee = 2; - optional string default_value = 7; - optional int32 oneof_index = 9; - optional string json_name = 10; - optional FieldOptions options = 8; - - enum Type { - - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; - TYPE_SINT64 = 18; - } - - enum Label { - - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - } -} - -message OneofDescriptorProto { - - optional string name = 1; - optional OneofOptions options = 2; -} - -message EnumDescriptorProto { - - optional string name = 1; - repeated EnumValueDescriptorProto value = 2; - optional EnumOptions options = 3; -} - -message EnumValueDescriptorProto { - - optional string name = 1; - optional int32 number = 2; - optional EnumValueOptions options = 3; -} - -message ServiceDescriptorProto { - - optional string name = 1; - repeated MethodDescriptorProto method = 2; - optional ServiceOptions options = 3; -} - -message MethodDescriptorProto { - - optional string name = 1; - optional string input_type = 2; - optional string output_type = 3; - optional MethodOptions options = 4; - optional bool client_streaming = 5; - optional bool server_streaming = 6; -} - -message FileOptions { - - optional string java_package = 1; - optional string java_outer_classname = 8; - optional bool java_multiple_files = 10; - optional bool java_generate_equals_and_hash = 20 [deprecated=true]; - optional bool java_string_check_utf8 = 27; - optional OptimizeMode optimize_for = 9 [default=SPEED]; - optional string go_package = 11; - optional bool cc_generic_services = 16; - optional bool java_generic_services = 17; - optional bool py_generic_services = 18; - optional bool deprecated = 23; - optional bool cc_enable_arenas = 31; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - repeated UninterpretedOption uninterpreted_option = 999; - - enum OptimizeMode { - - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - - extensions 1000 to max; - - reserved 38; -} - -message MessageOptions { - - optional bool message_set_wire_format = 1; - optional bool no_standard_descriptor_accessor = 2; - optional bool deprecated = 3; - optional bool map_entry = 7; - repeated UninterpretedOption uninterpreted_option = 999; - - extensions 1000 to max; - - reserved 8; -} - -message FieldOptions { - - optional CType ctype = 1 [default=STRING]; - optional bool packed = 2; - optional JSType jstype = 6 [default=JS_NORMAL]; - optional bool lazy = 5; - optional bool deprecated = 3; - optional bool weak = 10; - repeated UninterpretedOption uninterpreted_option = 999; - - enum CType { - - STRING = 0; - CORD = 1; - STRING_PIECE = 2; - } - - enum JSType { - - JS_NORMAL = 0; - JS_STRING = 1; - JS_NUMBER = 2; - } - - extensions 1000 to max; - - reserved 4; -} - -message OneofOptions { - - repeated UninterpretedOption uninterpreted_option = 999; - - extensions 1000 to max; -} - -message EnumOptions { - - optional bool allow_alias = 2; - optional bool deprecated = 3; - repeated UninterpretedOption uninterpreted_option = 999; - - extensions 1000 to max; -} - -message EnumValueOptions { - - optional bool deprecated = 1; - repeated UninterpretedOption uninterpreted_option = 999; - - extensions 1000 to max; -} - -message ServiceOptions { - - optional bool deprecated = 33; - repeated UninterpretedOption uninterpreted_option = 999; - - extensions 1000 to max; -} - -message MethodOptions { - - optional bool deprecated = 33; - repeated UninterpretedOption uninterpreted_option = 999; - - extensions 1000 to max; -} - -message UninterpretedOption { - - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - - message NamePart { - - required string name_part = 1; - required bool is_extension = 2; - } -} - -message SourceCodeInfo { - - repeated Location location = 1; - - message Location { - - repeated int32 path = 1 [packed=true]; - repeated int32 span = 2 [packed=true]; - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} - -message GeneratedCodeInfo { - - repeated Annotation annotation = 1; - - message Annotation { - - repeated int32 path = 1 [packed=true]; - optional string source_file = 2; - optional int32 begin = 3; - optional int32 end = 4; - } -} diff --git a/node_modules/protobufjs/google/protobuf/source_context.json b/node_modules/protobufjs/google/protobuf/source_context.json deleted file mode 100644 index 51adb63d..00000000 --- a/node_modules/protobufjs/google/protobuf/source_context.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "protobuf": { - "nested": { - "SourceContext": { - "fields": { - "fileName": { - "type": "string", - "id": 1 - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/protobuf/source_context.proto b/node_modules/protobufjs/google/protobuf/source_context.proto deleted file mode 100644 index 584d36ce..00000000 --- a/node_modules/protobufjs/google/protobuf/source_context.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; - -package google.protobuf; - -message SourceContext { - string file_name = 1; -} diff --git a/node_modules/protobufjs/google/protobuf/type.json b/node_modules/protobufjs/google/protobuf/type.json deleted file mode 100644 index fffa70d9..00000000 --- a/node_modules/protobufjs/google/protobuf/type.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "protobuf": { - "nested": { - "Type": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "fields": { - "rule": "repeated", - "type": "Field", - "id": 2 - }, - "oneofs": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "options": { - "rule": "repeated", - "type": "Option", - "id": 4 - }, - "sourceContext": { - "type": "SourceContext", - "id": 5 - }, - "syntax": { - "type": "Syntax", - "id": 6 - } - } - }, - "Field": { - "fields": { - "kind": { - "type": "Kind", - "id": 1 - }, - "cardinality": { - "type": "Cardinality", - "id": 2 - }, - "number": { - "type": "int32", - "id": 3 - }, - "name": { - "type": "string", - "id": 4 - }, - "typeUrl": { - "type": "string", - "id": 6 - }, - "oneofIndex": { - "type": "int32", - "id": 7 - }, - "packed": { - "type": "bool", - "id": 8 - }, - "options": { - "rule": "repeated", - "type": "Option", - "id": 9 - }, - "jsonName": { - "type": "string", - "id": 10 - }, - "defaultValue": { - "type": "string", - "id": 11 - } - }, - "nested": { - "Kind": { - "values": { - "TYPE_UNKNOWN": 0, - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18 - } - }, - "Cardinality": { - "values": { - "CARDINALITY_UNKNOWN": 0, - "CARDINALITY_OPTIONAL": 1, - "CARDINALITY_REQUIRED": 2, - "CARDINALITY_REPEATED": 3 - } - } - } - }, - "Enum": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "enumvalue": { - "rule": "repeated", - "type": "EnumValue", - "id": 2 - }, - "options": { - "rule": "repeated", - "type": "Option", - "id": 3 - }, - "sourceContext": { - "type": "SourceContext", - "id": 4 - }, - "syntax": { - "type": "Syntax", - "id": 5 - } - } - }, - "EnumValue": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 2 - }, - "options": { - "rule": "repeated", - "type": "Option", - "id": 3 - } - } - }, - "Option": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "Any", - "id": 2 - } - } - }, - "Syntax": { - "values": { - "SYNTAX_PROTO2": 0, - "SYNTAX_PROTO3": 1 - } - }, - "Any": { - "fields": { - "type_url": { - "type": "string", - "id": 1 - }, - "value": { - "type": "bytes", - "id": 2 - } - } - }, - "SourceContext": { - "fields": { - "fileName": { - "type": "string", - "id": 1 - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/node_modules/protobufjs/google/protobuf/type.proto b/node_modules/protobufjs/google/protobuf/type.proto deleted file mode 100644 index 8ee445bf..00000000 --- a/node_modules/protobufjs/google/protobuf/type.proto +++ /dev/null @@ -1,89 +0,0 @@ -syntax = "proto3"; - -package google.protobuf; - -import "google/protobuf/any.proto"; -import "google/protobuf/source_context.proto"; - -message Type { - - string name = 1; - repeated Field fields = 2; - repeated string oneofs = 3; - repeated Option options = 4; - SourceContext source_context = 5; - Syntax syntax = 6; -} - -message Field { - - Kind kind = 1; - Cardinality cardinality = 2; - int32 number = 3; - string name = 4; - string type_url = 6; - int32 oneof_index = 7; - bool packed = 8; - repeated Option options = 9; - string json_name = 10; - string default_value = 11; - - enum Kind { - - TYPE_UNKNOWN = 0; - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; - TYPE_SINT64 = 18; - } - - enum Cardinality { - - CARDINALITY_UNKNOWN = 0; - CARDINALITY_OPTIONAL = 1; - CARDINALITY_REQUIRED = 2; - CARDINALITY_REPEATED = 3; - } -} - -message Enum { - - string name = 1; - repeated EnumValue enumvalue = 2; - repeated Option options = 3; - SourceContext source_context = 4; - Syntax syntax = 5; -} - -message EnumValue { - - string name = 1; - int32 number = 2; - repeated Option options = 3; -} - -message Option { - - string name = 1; - Any value = 2; -} - -enum Syntax { - - SYNTAX_PROTO2 = 0; - SYNTAX_PROTO3 = 1; -} diff --git a/node_modules/protobufjs/index.d.ts b/node_modules/protobufjs/index.d.ts deleted file mode 100644 index cb86b61e..00000000 --- a/node_modules/protobufjs/index.d.ts +++ /dev/null @@ -1,2729 +0,0 @@ -// DO NOT EDIT! This is a generated file. Edit the JSDoc in src/*.js instead and run 'npm run types'. - -export as namespace protobuf; - -/** - * Provides common type definitions. - * Can also be used to provide additional google types or your own custom types. - * @param name Short name as in `google/protobuf/[name].proto` or full file name - * @param json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition - */ -export function common(name: string, json: { [k: string]: any }): void; - -export namespace common { - - /** Properties of a google.protobuf.Any message. */ - interface IAny { - typeUrl?: string; - bytes?: Uint8Array; - } - - /** Properties of a google.protobuf.Duration message. */ - interface IDuration { - seconds?: (number|Long); - nanos?: number; - } - - /** Properties of a google.protobuf.Timestamp message. */ - interface ITimestamp { - seconds?: (number|Long); - nanos?: number; - } - - /** Properties of a google.protobuf.Empty message. */ - interface IEmpty { - } - - /** Properties of a google.protobuf.Struct message. */ - interface IStruct { - fields?: { [k: string]: IValue }; - } - - /** Properties of a google.protobuf.Value message. */ - interface IValue { - kind?: string; - nullValue?: 0; - numberValue?: number; - stringValue?: string; - boolValue?: boolean; - structValue?: IStruct; - listValue?: IListValue; - } - - /** Properties of a google.protobuf.ListValue message. */ - interface IListValue { - values?: IValue[]; - } - - /** Properties of a google.protobuf.DoubleValue message. */ - interface IDoubleValue { - value?: number; - } - - /** Properties of a google.protobuf.FloatValue message. */ - interface IFloatValue { - value?: number; - } - - /** Properties of a google.protobuf.Int64Value message. */ - interface IInt64Value { - value?: (number|Long); - } - - /** Properties of a google.protobuf.UInt64Value message. */ - interface IUInt64Value { - value?: (number|Long); - } - - /** Properties of a google.protobuf.Int32Value message. */ - interface IInt32Value { - value?: number; - } - - /** Properties of a google.protobuf.UInt32Value message. */ - interface IUInt32Value { - value?: number; - } - - /** Properties of a google.protobuf.BoolValue message. */ - interface IBoolValue { - value?: boolean; - } - - /** Properties of a google.protobuf.StringValue message. */ - interface IStringValue { - value?: string; - } - - /** Properties of a google.protobuf.BytesValue message. */ - interface IBytesValue { - value?: Uint8Array; - } - - /** - * Gets the root definition of the specified common proto file. - * - * Bundled definitions are: - * - google/protobuf/any.proto - * - google/protobuf/duration.proto - * - google/protobuf/empty.proto - * - google/protobuf/field_mask.proto - * - google/protobuf/struct.proto - * - google/protobuf/timestamp.proto - * - google/protobuf/wrappers.proto - * - * @param file Proto file name - * @returns Root definition or `null` if not defined - */ - function get(file: string): (INamespace|null); -} - -/** Runtime message from/to plain object converters. */ -export namespace converter { - - /** - * Generates a plain object to runtime message converter specific to the specified message type. - * @param mtype Message type - * @returns Codegen instance - */ - function fromObject(mtype: Type): Codegen; - - /** - * Generates a runtime message to plain object converter specific to the specified message type. - * @param mtype Message type - * @returns Codegen instance - */ - function toObject(mtype: Type): Codegen; -} - -/** - * Generates a decoder specific to the specified message type. - * @param mtype Message type - * @returns Codegen instance - */ -export function decoder(mtype: Type): Codegen; - -/** - * Generates an encoder specific to the specified message type. - * @param mtype Message type - * @returns Codegen instance - */ -export function encoder(mtype: Type): Codegen; - -/** Reflected enum. */ -export class Enum extends ReflectionObject { - - /** - * Constructs a new enum instance. - * @param name Unique name within its namespace - * @param [values] Enum values as an object, by name - * @param [options] Declared options - * @param [comment] The comment for this enum - * @param [comments] The value comments for this enum - */ - constructor(name: string, values?: { [k: string]: number }, options?: { [k: string]: any }, comment?: string, comments?: { [k: string]: string }); - - /** Enum values by id. */ - public valuesById: { [k: number]: string }; - - /** Enum values by name. */ - public values: { [k: string]: number }; - - /** Enum comment text. */ - public comment: (string|null); - - /** Value comment texts, if any. */ - public comments: { [k: string]: string }; - - /** Reserved ranges, if any. */ - public reserved: (number[]|string)[]; - - /** - * Constructs an enum from an enum descriptor. - * @param name Enum name - * @param json Enum descriptor - * @returns Created enum - * @throws {TypeError} If arguments are invalid - */ - public static fromJSON(name: string, json: IEnum): Enum; - - /** - * Converts this enum to an enum descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Enum descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): IEnum; - - /** - * Adds a value to this enum. - * @param name Value name - * @param id Value id - * @param [comment] Comment, if any - * @returns `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a value with this name or id - */ - public add(name: string, id: number, comment?: string): Enum; - - /** - * Removes a value from this enum - * @param name Value name - * @returns `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `name` is not a name of this enum - */ - public remove(name: string): Enum; - - /** - * Tests if the specified id is reserved. - * @param id Id to test - * @returns `true` if reserved, otherwise `false` - */ - public isReservedId(id: number): boolean; - - /** - * Tests if the specified name is reserved. - * @param name Name to test - * @returns `true` if reserved, otherwise `false` - */ - public isReservedName(name: string): boolean; -} - -/** Enum descriptor. */ -export interface IEnum { - - /** Enum values */ - values: { [k: string]: number }; - - /** Enum options */ - options?: { [k: string]: any }; -} - -/** Reflected message field. */ -export class Field extends FieldBase { - - /** - * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. - * @param name Unique name within its namespace - * @param id Unique id within its namespace - * @param type Value type - * @param [rule="optional"] Field rule - * @param [extend] Extended type if different from parent - * @param [options] Declared options - */ - constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any }); - - /** - * Constructs a field from a field descriptor. - * @param name Field name - * @param json Field descriptor - * @returns Created field - * @throws {TypeError} If arguments are invalid - */ - public static fromJSON(name: string, json: IField): Field; - - /** Determines whether this field is packed. Only relevant when repeated and working with proto2. */ - public readonly packed: boolean; - - /** - * Field decorator (TypeScript). - * @param fieldId Field id - * @param fieldType Field type - * @param [fieldRule="optional"] Field rule - * @param [defaultValue] Default value - * @returns Decorator function - */ - public static d(fieldId: number, fieldType: ("double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|object), fieldRule?: ("optional"|"required"|"repeated"), defaultValue?: T): FieldDecorator; - - /** - * Field decorator (TypeScript). - * @param fieldId Field id - * @param fieldType Field type - * @param [fieldRule="optional"] Field rule - * @returns Decorator function - */ - public static d>(fieldId: number, fieldType: (Constructor|string), fieldRule?: ("optional"|"required"|"repeated")): FieldDecorator; -} - -/** Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. */ -export class FieldBase extends ReflectionObject { - - /** - * Not an actual constructor. Use {@link Field} instead. - * @param name Unique name within its namespace - * @param id Unique id within its namespace - * @param type Value type - * @param [rule="optional"] Field rule - * @param [extend] Extended type if different from parent - * @param [options] Declared options - * @param [comment] Comment associated with this field - */ - constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string); - - /** Field rule, if any. */ - public rule?: string; - - /** Field type. */ - public type: string; - - /** Unique field id. */ - public id: number; - - /** Extended type if different from parent. */ - public extend?: string; - - /** Whether this field is required. */ - public required: boolean; - - /** Whether this field is optional. */ - public optional: boolean; - - /** Whether this field is repeated. */ - public repeated: boolean; - - /** Whether this field is a map or not. */ - public map: boolean; - - /** Message this field belongs to. */ - public message: (Type|null); - - /** OneOf this field belongs to, if any, */ - public partOf: (OneOf|null); - - /** The field type's default value. */ - public typeDefault: any; - - /** The field's default value on prototypes. */ - public defaultValue: any; - - /** Whether this field's value should be treated as a long. */ - public long: boolean; - - /** Whether this field's value is a buffer. */ - public bytes: boolean; - - /** Resolved type if not a basic type. */ - public resolvedType: (Type|Enum|null); - - /** Sister-field within the extended type if a declaring extension field. */ - public extensionField: (Field|null); - - /** Sister-field within the declaring namespace if an extended field. */ - public declaringField: (Field|null); - - /** Comment for this field. */ - public comment: (string|null); - - /** - * Converts this field to a field descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Field descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): IField; - - /** - * Resolves this field's type references. - * @returns `this` - * @throws {Error} If any reference cannot be resolved - */ - public resolve(): Field; -} - -/** Field descriptor. */ -export interface IField { - - /** Field rule */ - rule?: string; - - /** Field type */ - type: string; - - /** Field id */ - id: number; - - /** Field options */ - options?: { [k: string]: any }; -} - -/** Extension field descriptor. */ -export interface IExtensionField extends IField { - - /** Extended type */ - extend: string; -} - -/** - * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript). - * @param prototype Target prototype - * @param fieldName Field name - */ -type FieldDecorator = (prototype: object, fieldName: string) => void; - -/** - * A node-style callback as used by {@link load} and {@link Root#load}. - * @param error Error, if any, otherwise `null` - * @param [root] Root, if there hasn't been an error - */ -type LoadCallback = (error: (Error|null), root?: Root) => void; - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @param filename One or multiple files to load - * @param root Root namespace, defaults to create a new one if omitted. - * @param callback Callback function - * @see {@link Root#load} - */ -export function load(filename: (string|string[]), root: Root, callback: LoadCallback): void; - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @param filename One or multiple files to load - * @param callback Callback function - * @see {@link Root#load} - */ -export function load(filename: (string|string[]), callback: LoadCallback): void; - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. - * @param filename One or multiple files to load - * @param [root] Root namespace, defaults to create a new one if omitted. - * @returns Promise - * @see {@link Root#load} - */ -export function load(filename: (string|string[]), root?: Root): Promise; - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). - * @param filename One or multiple files to load - * @param [root] Root namespace, defaults to create a new one if omitted. - * @returns Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - * @see {@link Root#loadSync} - */ -export function loadSync(filename: (string|string[]), root?: Root): Root; - -/** Build type, one of `"full"`, `"light"` or `"minimal"`. */ -export const build: string; - -/** Reconfigures the library according to the environment. */ -export function configure(): void; - -/** Reflected map field. */ -export class MapField extends FieldBase { - - /** - * Constructs a new map field instance. - * @param name Unique name within its namespace - * @param id Unique id within its namespace - * @param keyType Key type - * @param type Value type - * @param [options] Declared options - * @param [comment] Comment associated with this field - */ - constructor(name: string, id: number, keyType: string, type: string, options?: { [k: string]: any }, comment?: string); - - /** Key type. */ - public keyType: string; - - /** Resolved key type if not a basic type. */ - public resolvedKeyType: (ReflectionObject|null); - - /** - * Constructs a map field from a map field descriptor. - * @param name Field name - * @param json Map field descriptor - * @returns Created map field - * @throws {TypeError} If arguments are invalid - */ - public static fromJSON(name: string, json: IMapField): MapField; - - /** - * Converts this map field to a map field descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Map field descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): IMapField; - - /** - * Map field decorator (TypeScript). - * @param fieldId Field id - * @param fieldKeyType Field key type - * @param fieldValueType Field value type - * @returns Decorator function - */ - public static d }>(fieldId: number, fieldKeyType: ("int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"), fieldValueType: ("double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|object|Constructor<{}>)): FieldDecorator; -} - -/** Map field descriptor. */ -export interface IMapField extends IField { - - /** Key type */ - keyType: string; -} - -/** Extension map field descriptor. */ -export interface IExtensionMapField extends IMapField { - - /** Extended type */ - extend: string; -} - -/** Abstract runtime message. */ -export class Message { - - /** - * Constructs a new message instance. - * @param [properties] Properties to set - */ - constructor(properties?: Properties); - - /** Reference to the reflected type. */ - public static readonly $type: Type; - - /** Reference to the reflected type. */ - public readonly $type: Type; - - /** - * Creates a new message of this type using the specified properties. - * @param [properties] Properties to set - * @returns Message instance - */ - public static create>(this: Constructor, properties?: { [k: string]: any }): Message; - - /** - * Encodes a message of this type. - * @param message Message to encode - * @param [writer] Writer to use - * @returns Writer - */ - public static encode>(this: Constructor, message: (T|{ [k: string]: any }), writer?: Writer): Writer; - - /** - * Encodes a message of this type preceeded by its length as a varint. - * @param message Message to encode - * @param [writer] Writer to use - * @returns Writer - */ - public static encodeDelimited>(this: Constructor, message: (T|{ [k: string]: any }), writer?: Writer): Writer; - - /** - * Decodes a message of this type. - * @param reader Reader or buffer to decode - * @returns Decoded message - */ - public static decode>(this: Constructor, reader: (Reader|Uint8Array)): T; - - /** - * Decodes a message of this type preceeded by its length as a varint. - * @param reader Reader or buffer to decode - * @returns Decoded message - */ - public static decodeDelimited>(this: Constructor, reader: (Reader|Uint8Array)): T; - - /** - * Verifies a message of this type. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Message instance - */ - public static fromObject>(this: Constructor, object: { [k: string]: any }): T; - - /** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param message Message instance - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject>(this: Constructor, message: T, options?: IConversionOptions): { [k: string]: any }; - - /** - * Converts this message to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; -} - -/** Reflected service method. */ -export class Method extends ReflectionObject { - - /** - * Constructs a new service method instance. - * @param name Method name - * @param type Method type, usually `"rpc"` - * @param requestType Request message type - * @param responseType Response message type - * @param [requestStream] Whether the request is streamed - * @param [responseStream] Whether the response is streamed - * @param [options] Declared options - * @param [comment] The comment for this method - */ - constructor(name: string, type: (string|undefined), requestType: string, responseType: string, requestStream?: (boolean|{ [k: string]: any }), responseStream?: (boolean|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string); - - /** Method type. */ - public type: string; - - /** Request type. */ - public requestType: string; - - /** Whether requests are streamed or not. */ - public requestStream?: boolean; - - /** Response type. */ - public responseType: string; - - /** Whether responses are streamed or not. */ - public responseStream?: boolean; - - /** Resolved request type. */ - public resolvedRequestType: (Type|null); - - /** Resolved response type. */ - public resolvedResponseType: (Type|null); - - /** Comment for this method */ - public comment: (string|null); - - /** - * Constructs a method from a method descriptor. - * @param name Method name - * @param json Method descriptor - * @returns Created method - * @throws {TypeError} If arguments are invalid - */ - public static fromJSON(name: string, json: IMethod): Method; - - /** - * Converts this method to a method descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Method descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): IMethod; -} - -/** Method descriptor. */ -export interface IMethod { - - /** Method type */ - type?: string; - - /** Request type */ - requestType: string; - - /** Response type */ - responseType: string; - - /** Whether requests are streamed */ - requestStream?: boolean; - - /** Whether responses are streamed */ - responseStream?: boolean; - - /** Method options */ - options?: { [k: string]: any }; -} - -/** Reflected namespace. */ -export class Namespace extends NamespaceBase { - - /** - * Constructs a new namespace instance. - * @param name Namespace name - * @param [options] Declared options - */ - constructor(name: string, options?: { [k: string]: any }); - - /** - * Constructs a namespace from JSON. - * @param name Namespace name - * @param json JSON object - * @returns Created namespace - * @throws {TypeError} If arguments are invalid - */ - public static fromJSON(name: string, json: { [k: string]: any }): Namespace; - - /** - * Converts an array of reflection objects to JSON. - * @param array Object array - * @param [toJSONOptions] JSON conversion options - * @returns JSON object or `undefined` when array is empty - */ - public static arrayToJSON(array: ReflectionObject[], toJSONOptions?: IToJSONOptions): ({ [k: string]: any }|undefined); - - /** - * Tests if the specified id is reserved. - * @param reserved Array of reserved ranges and names - * @param id Id to test - * @returns `true` if reserved, otherwise `false` - */ - public static isReservedId(reserved: ((number[]|string)[]|undefined), id: number): boolean; - - /** - * Tests if the specified name is reserved. - * @param reserved Array of reserved ranges and names - * @param name Name to test - * @returns `true` if reserved, otherwise `false` - */ - public static isReservedName(reserved: ((number[]|string)[]|undefined), name: string): boolean; -} - -/** Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. */ -export abstract class NamespaceBase extends ReflectionObject { - - /** Nested objects by name. */ - public nested?: { [k: string]: ReflectionObject }; - - /** Nested objects of this namespace as an array for iteration. */ - public readonly nestedArray: ReflectionObject[]; - - /** - * Converts this namespace to a namespace descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Namespace descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): INamespace; - - /** - * Adds nested objects to this namespace from nested object descriptors. - * @param nestedJson Any nested object descriptors - * @returns `this` - */ - public addJSON(nestedJson: { [k: string]: AnyNestedObject }): Namespace; - - /** - * Gets the nested object of the specified name. - * @param name Nested object name - * @returns The reflection object or `null` if it doesn't exist - */ - public get(name: string): (ReflectionObject|null); - - /** - * Gets the values of the nested {@link Enum|enum} of the specified name. - * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. - * @param name Nested enum name - * @returns Enum values - * @throws {Error} If there is no such enum - */ - public getEnum(name: string): { [k: string]: number }; - - /** - * Adds a nested object to this namespace. - * @param object Nested object to add - * @returns `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name - */ - public add(object: ReflectionObject): Namespace; - - /** - * Removes a nested object from this namespace. - * @param object Nested object to remove - * @returns `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this namespace - */ - public remove(object: ReflectionObject): Namespace; - - /** - * Defines additial namespaces within this one if not yet existing. - * @param path Path to create - * @param [json] Nested types to create from JSON - * @returns Pointer to the last namespace created or `this` if path is empty - */ - public define(path: (string|string[]), json?: any): Namespace; - - /** - * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost. - * @returns `this` - */ - public resolveAll(): Namespace; - - /** - * Recursively looks up the reflection object matching the specified path in the scope of this namespace. - * @param path Path to look up - * @param filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. - * @param [parentAlreadyChecked=false] If known, whether the parent has already been checked - * @returns Looked up object or `null` if none could be found - */ - public lookup(path: (string|string[]), filterTypes: (any|any[]), parentAlreadyChecked?: boolean): (ReflectionObject|null); - - /** - * Looks up the reflection object at the specified path, relative to this namespace. - * @param path Path to look up - * @param [parentAlreadyChecked=false] Whether the parent has already been checked - * @returns Looked up object or `null` if none could be found - */ - public lookup(path: (string|string[]), parentAlreadyChecked?: boolean): (ReflectionObject|null); - - /** - * Looks up the {@link Type|type} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param path Path to look up - * @returns Looked up type - * @throws {Error} If `path` does not point to a type - */ - public lookupType(path: (string|string[])): Type; - - /** - * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param path Path to look up - * @returns Looked up enum - * @throws {Error} If `path` does not point to an enum - */ - public lookupEnum(path: (string|string[])): Enum; - - /** - * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param path Path to look up - * @returns Looked up type or enum - * @throws {Error} If `path` does not point to a type or enum - */ - public lookupTypeOrEnum(path: (string|string[])): Type; - - /** - * Looks up the {@link Service|service} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param path Path to look up - * @returns Looked up service - * @throws {Error} If `path` does not point to a service - */ - public lookupService(path: (string|string[])): Service; -} - -/** Namespace descriptor. */ -export interface INamespace { - - /** Namespace options */ - options?: { [k: string]: any }; - - /** Nested object descriptors */ - nested?: { [k: string]: AnyNestedObject }; -} - -/** Any extension field descriptor. */ -type AnyExtensionField = (IExtensionField|IExtensionMapField); - -/** Any nested object descriptor. */ -type AnyNestedObject = (IEnum|IType|IService|AnyExtensionField|INamespace); - -/** Base class of all reflection objects. */ -export abstract class ReflectionObject { - - /** Options. */ - public options?: { [k: string]: any }; - - /** Parsed Options. */ - public parsedOptions?: { [k: string]: any[] }; - - /** Unique name within its namespace. */ - public name: string; - - /** Parent namespace. */ - public parent: (Namespace|null); - - /** Whether already resolved or not. */ - public resolved: boolean; - - /** Comment text, if any. */ - public comment: (string|null); - - /** Defining file name. */ - public filename: (string|null); - - /** Reference to the root namespace. */ - public readonly root: Root; - - /** Full name including leading dot. */ - public readonly fullName: string; - - /** - * Converts this reflection object to its descriptor representation. - * @returns Descriptor - */ - public toJSON(): { [k: string]: any }; - - /** - * Called when this object is added to a parent. - * @param parent Parent added to - */ - public onAdd(parent: ReflectionObject): void; - - /** - * Called when this object is removed from a parent. - * @param parent Parent removed from - */ - public onRemove(parent: ReflectionObject): void; - - /** - * Resolves this objects type references. - * @returns `this` - */ - public resolve(): ReflectionObject; - - /** - * Gets an option value. - * @param name Option name - * @returns Option value or `undefined` if not set - */ - public getOption(name: string): any; - - /** - * Sets an option. - * @param name Option name - * @param value Option value - * @param [ifNotSet] Sets the option only if it isn't currently set - * @returns `this` - */ - public setOption(name: string, value: any, ifNotSet?: boolean): ReflectionObject; - - /** - * Sets a parsed option. - * @param name parsed Option name - * @param value Option value - * @param propName dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value - * @returns `this` - */ - public setParsedOption(name: string, value: any, propName: string): ReflectionObject; - - /** - * Sets multiple options. - * @param options Options to set - * @param [ifNotSet] Sets an option only if it isn't currently set - * @returns `this` - */ - public setOptions(options: { [k: string]: any }, ifNotSet?: boolean): ReflectionObject; - - /** - * Converts this instance to its string representation. - * @returns Class name[, space, full name] - */ - public toString(): string; -} - -/** Reflected oneof. */ -export class OneOf extends ReflectionObject { - - /** - * Constructs a new oneof instance. - * @param name Oneof name - * @param [fieldNames] Field names - * @param [options] Declared options - * @param [comment] Comment associated with this field - */ - constructor(name: string, fieldNames?: (string[]|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string); - - /** Field names that belong to this oneof. */ - public oneof: string[]; - - /** Fields that belong to this oneof as an array for iteration. */ - public readonly fieldsArray: Field[]; - - /** Comment for this field. */ - public comment: (string|null); - - /** - * Constructs a oneof from a oneof descriptor. - * @param name Oneof name - * @param json Oneof descriptor - * @returns Created oneof - * @throws {TypeError} If arguments are invalid - */ - public static fromJSON(name: string, json: IOneOf): OneOf; - - /** - * Converts this oneof to a oneof descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Oneof descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): IOneOf; - - /** - * Adds a field to this oneof and removes it from its current parent, if any. - * @param field Field to add - * @returns `this` - */ - public add(field: Field): OneOf; - - /** - * Removes a field from this oneof and puts it back to the oneof's parent. - * @param field Field to remove - * @returns `this` - */ - public remove(field: Field): OneOf; - - /** - * OneOf decorator (TypeScript). - * @param fieldNames Field names - * @returns Decorator function - */ - public static d(...fieldNames: string[]): OneOfDecorator; -} - -/** Oneof descriptor. */ -export interface IOneOf { - - /** Oneof field names */ - oneof: string[]; - - /** Oneof options */ - options?: { [k: string]: any }; -} - -/** - * Decorator function as returned by {@link OneOf.d} (TypeScript). - * @param prototype Target prototype - * @param oneofName OneOf name - */ -type OneOfDecorator = (prototype: object, oneofName: string) => void; - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @param source Source contents - * @param [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns Parser result - */ -export function parse(source: string, options?: IParseOptions): IParserResult; - -/** Result object returned from {@link parse}. */ -export interface IParserResult { - - /** Package name, if declared */ - package: (string|undefined); - - /** Imports, if any */ - imports: (string[]|undefined); - - /** Weak imports, if any */ - weakImports: (string[]|undefined); - - /** Syntax, if specified (either `"proto2"` or `"proto3"`) */ - syntax: (string|undefined); - - /** Populated root instance */ - root: Root; -} - -/** Options modifying the behavior of {@link parse}. */ -export interface IParseOptions { - - /** Keeps field casing instead of converting to camel case */ - keepCase?: boolean; - - /** Recognize double-slash comments in addition to doc-block comments. */ - alternateCommentMode?: boolean; - - /** Use trailing comment when both leading comment and trailing comment exist. */ - preferTrailingComment?: boolean; -} - -/** Options modifying the behavior of JSON serialization. */ -export interface IToJSONOptions { - - /** Serializes comments. */ - keepComments?: boolean; -} - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @param source Source contents - * @param root Root to populate - * @param [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns Parser result - */ -export function parse(source: string, root: Root, options?: IParseOptions): IParserResult; - -/** Wire format reader using `Uint8Array` if available, otherwise `Array`. */ -export class Reader { - - /** - * Constructs a new reader instance using the specified buffer. - * @param buffer Buffer to read from - */ - constructor(buffer: Uint8Array); - - /** Read buffer. */ - public buf: Uint8Array; - - /** Read buffer position. */ - public pos: number; - - /** Read buffer length. */ - public len: number; - - /** - * Creates a new reader using the specified buffer. - * @param buffer Buffer to read from - * @returns A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} - * @throws {Error} If `buffer` is not a valid buffer - */ - public static create(buffer: (Uint8Array|Buffer)): (Reader|BufferReader); - - /** - * Reads a varint as an unsigned 32 bit value. - * @returns Value read - */ - public uint32(): number; - - /** - * Reads a varint as a signed 32 bit value. - * @returns Value read - */ - public int32(): number; - - /** - * Reads a zig-zag encoded varint as a signed 32 bit value. - * @returns Value read - */ - public sint32(): number; - - /** - * Reads a varint as a signed 64 bit value. - * @returns Value read - */ - public int64(): Long; - - /** - * Reads a varint as an unsigned 64 bit value. - * @returns Value read - */ - public uint64(): Long; - - /** - * Reads a zig-zag encoded varint as a signed 64 bit value. - * @returns Value read - */ - public sint64(): Long; - - /** - * Reads a varint as a boolean. - * @returns Value read - */ - public bool(): boolean; - - /** - * Reads fixed 32 bits as an unsigned 32 bit integer. - * @returns Value read - */ - public fixed32(): number; - - /** - * Reads fixed 32 bits as a signed 32 bit integer. - * @returns Value read - */ - public sfixed32(): number; - - /** - * Reads fixed 64 bits. - * @returns Value read - */ - public fixed64(): Long; - - /** - * Reads zig-zag encoded fixed 64 bits. - * @returns Value read - */ - public sfixed64(): Long; - - /** - * Reads a float (32 bit) as a number. - * @returns Value read - */ - public float(): number; - - /** - * Reads a double (64 bit float) as a number. - * @returns Value read - */ - public double(): number; - - /** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns Value read - */ - public bytes(): Uint8Array; - - /** - * Reads a string preceeded by its byte length as a varint. - * @returns Value read - */ - public string(): string; - - /** - * Skips the specified number of bytes if specified, otherwise skips a varint. - * @param [length] Length if known, otherwise a varint is assumed - * @returns `this` - */ - public skip(length?: number): Reader; - - /** - * Skips the next element of the specified wire type. - * @param wireType Wire type received - * @returns `this` - */ - public skipType(wireType: number): Reader; -} - -/** Wire format reader using node buffers. */ -export class BufferReader extends Reader { - - /** - * Constructs a new buffer reader instance. - * @param buffer Buffer to read from - */ - constructor(buffer: Buffer); - - /** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns Value read - */ - public bytes(): Buffer; -} - -/** Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. */ -export class Root extends NamespaceBase { - - /** - * Constructs a new root namespace instance. - * @param [options] Top level options - */ - constructor(options?: { [k: string]: any }); - - /** Deferred extension fields. */ - public deferred: Field[]; - - /** Resolved file names of loaded files. */ - public files: string[]; - - /** - * Loads a namespace descriptor into a root namespace. - * @param json Nameespace descriptor - * @param [root] Root namespace, defaults to create a new one if omitted - * @returns Root namespace - */ - public static fromJSON(json: INamespace, root?: Root): Root; - - /** - * Resolves the path of an imported file, relative to the importing origin. - * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. - * @param origin The file name of the importing file - * @param target The file name being imported - * @returns Resolved path to `target` or `null` to skip the file - */ - public resolvePath(origin: string, target: string): (string|null); - - /** - * Fetch content from file path or url - * This method exists so you can override it with your own logic. - * @param path File path or url - * @param callback Callback function - */ - public fetch(path: string, callback: FetchCallback): void; - - /** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @param filename Names of one or multiple files to load - * @param options Parse options - * @param callback Callback function - */ - public load(filename: (string|string[]), options: IParseOptions, callback: LoadCallback): void; - - /** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @param filename Names of one or multiple files to load - * @param callback Callback function - */ - public load(filename: (string|string[]), callback: LoadCallback): void; - - /** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. - * @param filename Names of one or multiple files to load - * @param [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns Promise - */ - public load(filename: (string|string[]), options?: IParseOptions): Promise; - - /** - * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only). - * @param filename Names of one or multiple files to load - * @param [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - */ - public loadSync(filename: (string|string[]), options?: IParseOptions): Root; -} - -/** - * Named roots. - * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). - * Can also be used manually to make roots available accross modules. - */ -export let roots: { [k: string]: Root }; - -/** Streaming RPC helpers. */ -export namespace rpc { - - /** - * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. - * - * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. - * @param error Error, if any - * @param [response] Response message - */ - type ServiceMethodCallback> = (error: (Error|null), response?: TRes) => void; - - /** - * A service method part of a {@link rpc.Service} as created by {@link Service.create}. - * @param request Request message or plain object - * @param [callback] Node-style callback called with the error, if any, and the response message - * @returns Promise if `callback` has been omitted, otherwise `undefined` - */ - type ServiceMethod, TRes extends Message> = (request: (TReq|Properties), callback?: rpc.ServiceMethodCallback) => Promise>; - - /** An RPC service as returned by {@link Service#create}. */ - class Service extends util.EventEmitter { - - /** - * Constructs a new RPC service instance. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** RPC implementation. Becomes `null` once the service is ended. */ - public rpcImpl: (RPCImpl|null); - - /** Whether requests are length-delimited. */ - public requestDelimited: boolean; - - /** Whether responses are length-delimited. */ - public responseDelimited: boolean; - - /** - * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. - * @param method Reflected or static method - * @param requestCtor Request constructor - * @param responseCtor Response constructor - * @param request Request message or plain object - * @param callback Service callback - */ - public rpcCall, TRes extends Message>(method: (Method|rpc.ServiceMethod), requestCtor: Constructor, responseCtor: Constructor, request: (TReq|Properties), callback: rpc.ServiceMethodCallback): void; - - /** - * Ends this service and emits the `end` event. - * @param [endedByRPC=false] Whether the service has been ended by the RPC implementation. - * @returns `this` - */ - public end(endedByRPC?: boolean): rpc.Service; - } -} - -/** - * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. - * @param method Reflected or static method being called - * @param requestData Request data - * @param callback Callback function - */ -type RPCImpl = (method: (Method|rpc.ServiceMethod, Message<{}>>), requestData: Uint8Array, callback: RPCImplCallback) => void; - -/** - * Node-style callback as used by {@link RPCImpl}. - * @param error Error, if any, otherwise `null` - * @param [response] Response data or `null` to signal end of stream, if there hasn't been an error - */ -type RPCImplCallback = (error: (Error|null), response?: (Uint8Array|null)) => void; - -/** Reflected service. */ -export class Service extends NamespaceBase { - - /** - * Constructs a new service instance. - * @param name Service name - * @param [options] Service options - * @throws {TypeError} If arguments are invalid - */ - constructor(name: string, options?: { [k: string]: any }); - - /** Service methods. */ - public methods: { [k: string]: Method }; - - /** - * Constructs a service from a service descriptor. - * @param name Service name - * @param json Service descriptor - * @returns Created service - * @throws {TypeError} If arguments are invalid - */ - public static fromJSON(name: string, json: IService): Service; - - /** - * Converts this service to a service descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Service descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): IService; - - /** Methods of this service as an array for iteration. */ - public readonly methodsArray: Method[]; - - /** - * Creates a runtime service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public create(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service; -} - -/** Service descriptor. */ -export interface IService extends INamespace { - - /** Method descriptors */ - methods: { [k: string]: IMethod }; -} - -/** - * Gets the next token and advances. - * @returns Next token or `null` on eof - */ -type TokenizerHandleNext = () => (string|null); - -/** - * Peeks for the next token. - * @returns Next token or `null` on eof - */ -type TokenizerHandlePeek = () => (string|null); - -/** - * Pushes a token back to the stack. - * @param token Token - */ -type TokenizerHandlePush = (token: string) => void; - -/** - * Skips the next token. - * @param expected Expected token - * @param [optional=false] If optional - * @returns Whether the token matched - * @throws {Error} If the token didn't match and is not optional - */ -type TokenizerHandleSkip = (expected: string, optional?: boolean) => boolean; - -/** - * Gets the comment on the previous line or, alternatively, the line comment on the specified line. - * @param [line] Line number - * @returns Comment text or `null` if none - */ -type TokenizerHandleCmnt = (line?: number) => (string|null); - -/** Handle object returned from {@link tokenize}. */ -export interface ITokenizerHandle { - - /** Gets the next token and advances (`null` on eof) */ - next: TokenizerHandleNext; - - /** Peeks for the next token (`null` on eof) */ - peek: TokenizerHandlePeek; - - /** Pushes a token back to the stack */ - push: TokenizerHandlePush; - - /** Skips a token, returns its presence and advances or, if non-optional and not present, throws */ - skip: TokenizerHandleSkip; - - /** Gets the comment on the previous line or the line comment on the specified line, if any */ - cmnt: TokenizerHandleCmnt; - - /** Current line number */ - line: number; -} - -/** - * Tokenizes the given .proto source and returns an object with useful utility functions. - * @param source Source contents - * @param alternateCommentMode Whether we should activate alternate comment parsing mode. - * @returns Tokenizer handle - */ -export function tokenize(source: string, alternateCommentMode: boolean): ITokenizerHandle; - -export namespace tokenize { - - /** - * Unescapes a string. - * @param str String to unescape - * @returns Unescaped string - */ - function unescape(str: string): string; -} - -/** Reflected message type. */ -export class Type extends NamespaceBase { - - /** - * Constructs a new reflected message type instance. - * @param name Message name - * @param [options] Declared options - */ - constructor(name: string, options?: { [k: string]: any }); - - /** Message fields. */ - public fields: { [k: string]: Field }; - - /** Oneofs declared within this namespace, if any. */ - public oneofs: { [k: string]: OneOf }; - - /** Extension ranges, if any. */ - public extensions: number[][]; - - /** Reserved ranges, if any. */ - public reserved: (number[]|string)[]; - - /** Message fields by id. */ - public readonly fieldsById: { [k: number]: Field }; - - /** Fields of this message as an array for iteration. */ - public readonly fieldsArray: Field[]; - - /** Oneofs of this message as an array for iteration. */ - public readonly oneofsArray: OneOf[]; - - /** - * The registered constructor, if any registered, otherwise a generic constructor. - * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. - */ - public ctor: Constructor<{}>; - - /** - * Generates a constructor function for the specified type. - * @param mtype Message type - * @returns Codegen instance - */ - public static generateConstructor(mtype: Type): Codegen; - - /** - * Creates a message type from a message type descriptor. - * @param name Message name - * @param json Message type descriptor - * @returns Created message type - */ - public static fromJSON(name: string, json: IType): Type; - - /** - * Converts this message type to a message type descriptor. - * @param [toJSONOptions] JSON conversion options - * @returns Message type descriptor - */ - public toJSON(toJSONOptions?: IToJSONOptions): IType; - - /** - * Adds a nested object to this type. - * @param object Nested object to add - * @returns `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id - */ - public add(object: ReflectionObject): Type; - - /** - * Removes a nested object from this type. - * @param object Nested object to remove - * @returns `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this type - */ - public remove(object: ReflectionObject): Type; - - /** - * Tests if the specified id is reserved. - * @param id Id to test - * @returns `true` if reserved, otherwise `false` - */ - public isReservedId(id: number): boolean; - - /** - * Tests if the specified name is reserved. - * @param name Name to test - * @returns `true` if reserved, otherwise `false` - */ - public isReservedName(name: string): boolean; - - /** - * Creates a new message of this type using the specified properties. - * @param [properties] Properties to set - * @returns Message instance - */ - public create(properties?: { [k: string]: any }): Message<{}>; - - /** - * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. - * @returns `this` - */ - public setup(): Type; - - /** - * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages. - * @param message Message instance or plain object - * @param [writer] Writer to encode to - * @returns writer - */ - public encode(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer; - - /** - * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages. - * @param message Message instance or plain object - * @param [writer] Writer to encode to - * @returns writer - */ - public encodeDelimited(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer; - - /** - * Decodes a message of this type. - * @param reader Reader or buffer to decode from - * @param [length] Length of the message, if known beforehand - * @returns Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError<{}>} If required fields are missing - */ - public decode(reader: (Reader|Uint8Array), length?: number): Message<{}>; - - /** - * Decodes a message of this type preceeded by its byte length as a varint. - * @param reader Reader or buffer to decode from - * @returns Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError} If required fields are missing - */ - public decodeDelimited(reader: (Reader|Uint8Array)): Message<{}>; - - /** - * Verifies that field values are valid and that required fields are present. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public verify(message: { [k: string]: any }): (null|string); - - /** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param object Plain object to convert - * @returns Message instance - */ - public fromObject(object: { [k: string]: any }): Message<{}>; - - /** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param message Message instance - * @param [options] Conversion options - * @returns Plain object - */ - public toObject(message: Message<{}>, options?: IConversionOptions): { [k: string]: any }; - - /** - * Type decorator (TypeScript). - * @param [typeName] Type name, defaults to the constructor's name - * @returns Decorator function - */ - public static d>(typeName?: string): TypeDecorator; -} - -/** Message type descriptor. */ -export interface IType extends INamespace { - - /** Oneof descriptors */ - oneofs?: { [k: string]: IOneOf }; - - /** Field descriptors */ - fields: { [k: string]: IField }; - - /** Extension ranges */ - extensions?: number[][]; - - /** Reserved ranges */ - reserved?: number[][]; - - /** Whether a legacy group or not */ - group?: boolean; -} - -/** Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. */ -export interface IConversionOptions { - - /** - * Long conversion type. - * Valid values are `String` and `Number` (the global types). - * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library. - */ - longs?: Function; - - /** - * Enum value conversion type. - * Only valid value is `String` (the global type). - * Defaults to copy the present value, which is the numeric id. - */ - enums?: Function; - - /** - * Bytes value conversion type. - * Valid values are `Array` and (a base64 encoded) `String` (the global types). - * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser. - */ - bytes?: Function; - - /** Also sets default values on the resulting object */ - defaults?: boolean; - - /** Sets empty arrays for missing repeated fields even if `defaults=false` */ - arrays?: boolean; - - /** Sets empty objects for missing map fields even if `defaults=false` */ - objects?: boolean; - - /** Includes virtual oneof properties set to the present field's name, if any */ - oneofs?: boolean; - - /** Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings */ - json?: boolean; -} - -/** - * Decorator function as returned by {@link Type.d} (TypeScript). - * @param target Target constructor - */ -type TypeDecorator> = (target: Constructor) => void; - -/** Common type constants. */ -export namespace types { - - /** Basic type wire types. */ - const basic: { - "double": number, - "float": number, - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": number, - "string": number, - "bytes": number - }; - - /** Basic type defaults. */ - const defaults: { - "double": number, - "float": number, - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": boolean, - "string": string, - "bytes": number[], - "message": null - }; - - /** Basic long type wire types. */ - const long: { - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number - }; - - /** Allowed types for map keys with their associated wire type. */ - const mapKey: { - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": number, - "string": number - }; - - /** Allowed types for packed repeated fields with their associated wire type. */ - const packed: { - "double": number, - "float": number, - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": number - }; -} - -/** Constructor type. */ -export interface Constructor extends Function { - new(...params: any[]): T; prototype: T; -} - -/** Properties type. */ -type Properties = { [P in keyof T]?: T[P] }; - -/** - * Any compatible Buffer instance. - * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. - */ -export interface Buffer extends Uint8Array { -} - -/** - * Any compatible Long instance. - * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. - */ -export interface Long { - - /** Low bits */ - low: number; - - /** High bits */ - high: number; - - /** Whether unsigned or not */ - unsigned: boolean; -} - -/** - * A OneOf getter as returned by {@link util.oneOfGetter}. - * @returns Set field name, if any - */ -type OneOfGetter = () => (string|undefined); - -/** - * A OneOf setter as returned by {@link util.oneOfSetter}. - * @param value Field name - */ -type OneOfSetter = (value: (string|undefined)) => void; - -/** Various utility functions. */ -export namespace util { - - /** Helper class for working with the low and high bits of a 64 bit value. */ - class LongBits { - - /** - * Constructs new long bits. - * @param lo Low 32 bits, unsigned - * @param hi High 32 bits, unsigned - */ - constructor(lo: number, hi: number); - - /** Low bits. */ - public lo: number; - - /** High bits. */ - public hi: number; - - /** Zero bits. */ - public static zero: util.LongBits; - - /** Zero hash. */ - public static zeroHash: string; - - /** - * Constructs new long bits from the specified number. - * @param value Value - * @returns Instance - */ - public static fromNumber(value: number): util.LongBits; - - /** - * Constructs new long bits from a number, long or string. - * @param value Value - * @returns Instance - */ - public static from(value: (Long|number|string)): util.LongBits; - - /** - * Converts this long bits to a possibly unsafe JavaScript number. - * @param [unsigned=false] Whether unsigned or not - * @returns Possibly unsafe number - */ - public toNumber(unsigned?: boolean): number; - - /** - * Converts this long bits to a long. - * @param [unsigned=false] Whether unsigned or not - * @returns Long - */ - public toLong(unsigned?: boolean): Long; - - /** - * Constructs new long bits from the specified 8 characters long hash. - * @param hash Hash - * @returns Bits - */ - public static fromHash(hash: string): util.LongBits; - - /** - * Converts this long bits to a 8 characters long hash. - * @returns Hash - */ - public toHash(): string; - - /** - * Zig-zag encodes this long bits. - * @returns `this` - */ - public zzEncode(): util.LongBits; - - /** - * Zig-zag decodes this long bits. - * @returns `this` - */ - public zzDecode(): util.LongBits; - - /** - * Calculates the length of this longbits when encoded as a varint. - * @returns Length - */ - public length(): number; - } - - /** Whether running within node or not. */ - let isNode: boolean; - - /** Global object reference. */ - let global: object; - - /** An immuable empty array. */ - const emptyArray: any[]; - - /** An immutable empty object. */ - const emptyObject: object; - - /** - * Tests if the specified value is an integer. - * @param value Value to test - * @returns `true` if the value is an integer - */ - function isInteger(value: any): boolean; - - /** - * Tests if the specified value is a string. - * @param value Value to test - * @returns `true` if the value is a string - */ - function isString(value: any): boolean; - - /** - * Tests if the specified value is a non-null object. - * @param value Value to test - * @returns `true` if the value is a non-null object - */ - function isObject(value: any): boolean; - - /** - * Checks if a property on a message is considered to be present. - * This is an alias of {@link util.isSet}. - * @param obj Plain object or message instance - * @param prop Property name - * @returns `true` if considered to be present, otherwise `false` - */ - function isset(obj: object, prop: string): boolean; - - /** - * Checks if a property on a message is considered to be present. - * @param obj Plain object or message instance - * @param prop Property name - * @returns `true` if considered to be present, otherwise `false` - */ - function isSet(obj: object, prop: string): boolean; - - /** Node's Buffer class if available. */ - let Buffer: Constructor; - - /** - * Creates a new buffer of whatever type supported by the environment. - * @param [sizeOrArray=0] Buffer size or number array - * @returns Buffer - */ - function newBuffer(sizeOrArray?: (number|number[])): (Uint8Array|Buffer); - - /** Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. */ - let Array: Constructor; - - /** Long.js's Long class if available. */ - let Long: Constructor; - - /** Regular expression used to verify 2 bit (`bool`) map keys. */ - const key2Re: RegExp; - - /** Regular expression used to verify 32 bit (`int32` etc.) map keys. */ - const key32Re: RegExp; - - /** Regular expression used to verify 64 bit (`int64` etc.) map keys. */ - const key64Re: RegExp; - - /** - * Converts a number or long to an 8 characters long hash string. - * @param value Value to convert - * @returns Hash - */ - function longToHash(value: (Long|number)): string; - - /** - * Converts an 8 characters long hash string to a long or number. - * @param hash Hash - * @param [unsigned=false] Whether unsigned or not - * @returns Original value - */ - function longFromHash(hash: string, unsigned?: boolean): (Long|number); - - /** - * Merges the properties of the source object into the destination object. - * @param dst Destination object - * @param src Source object - * @param [ifNotSet=false] Merges only if the key is not already set - * @returns Destination object - */ - function merge(dst: { [k: string]: any }, src: { [k: string]: any }, ifNotSet?: boolean): { [k: string]: any }; - - /** - * Converts the first character of a string to lower case. - * @param str String to convert - * @returns Converted string - */ - function lcFirst(str: string): string; - - /** - * Creates a custom error constructor. - * @param name Error name - * @returns Custom error constructor - */ - function newError(name: string): Constructor; - - /** Error subclass indicating a protocol specifc error. */ - class ProtocolError> extends Error { - - /** - * Constructs a new protocol error. - * @param message Error message - * @param [properties] Additional properties - */ - constructor(message: string, properties?: { [k: string]: any }); - - /** So far decoded message instance. */ - public instance: Message; - } - - /** - * Builds a getter for a oneof's present field name. - * @param fieldNames Field names - * @returns Unbound getter - */ - function oneOfGetter(fieldNames: string[]): OneOfGetter; - - /** - * Builds a setter for a oneof's present field name. - * @param fieldNames Field names - * @returns Unbound setter - */ - function oneOfSetter(fieldNames: string[]): OneOfSetter; - - /** - * Default conversion options used for {@link Message#toJSON} implementations. - * - * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: - * - * - Longs become strings - * - Enums become string keys - * - Bytes become base64 encoded strings - * - (Sub-)Messages become plain objects - * - Maps become plain objects with all string keys - * - Repeated fields become arrays - * - NaN and Infinity for float and double fields become strings - * - * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json - */ - let toJSONOptions: IConversionOptions; - - /** Node's fs module if available. */ - let fs: { [k: string]: any }; - - /** - * Converts an object's values to an array. - * @param object Object to convert - * @returns Converted array - */ - function toArray(object: { [k: string]: any }): any[]; - - /** - * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values. - * @param array Array to convert - * @returns Converted object - */ - function toObject(array: any[]): { [k: string]: any }; - - /** - * Tests whether the specified name is a reserved word in JS. - * @param name Name to test - * @returns `true` if reserved, otherwise `false` - */ - function isReserved(name: string): boolean; - - /** - * Returns a safe property accessor for the specified property name. - * @param prop Property name - * @returns Safe accessor - */ - function safeProp(prop: string): string; - - /** - * Converts the first character of a string to upper case. - * @param str String to convert - * @returns Converted string - */ - function ucFirst(str: string): string; - - /** - * Converts a string to camel case. - * @param str String to convert - * @returns Converted string - */ - function camelCase(str: string): string; - - /** - * Compares reflected fields by id. - * @param a First field - * @param b Second field - * @returns Comparison value - */ - function compareFieldsById(a: Field, b: Field): number; - - /** - * Decorator helper for types (TypeScript). - * @param ctor Constructor function - * @param [typeName] Type name, defaults to the constructor's name - * @returns Reflected type - */ - function decorateType>(ctor: Constructor, typeName?: string): Type; - - /** - * Decorator helper for enums (TypeScript). - * @param object Enum object - * @returns Reflected enum - */ - function decorateEnum(object: object): Enum; - - /** - * Sets the value of a property by property path. If a value already exists, it is turned to an array - * @param dst Destination object - * @param path dot '.' delimited path of the property to set - * @param value the value to set - * @returns Destination object - */ - function setProperty(dst: { [k: string]: any }, path: string, value: object): { [k: string]: any }; - - /** Decorator root (TypeScript). */ - let decorateRoot: Root; - - /** - * Returns a promise from a node-style callback function. - * @param fn Function to call - * @param ctx Function context - * @param params Function arguments - * @returns Promisified function - */ - function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise; - - /** A minimal base64 implementation for number arrays. */ - namespace base64 { - - /** - * Calculates the byte length of a base64 encoded string. - * @param string Base64 encoded string - * @returns Byte length - */ - function length(string: string): number; - - /** - * Encodes a buffer to a base64 encoded string. - * @param buffer Source buffer - * @param start Source start - * @param end Source end - * @returns Base64 encoded string - */ - function encode(buffer: Uint8Array, start: number, end: number): string; - - /** - * Decodes a base64 encoded string to a buffer. - * @param string Source string - * @param buffer Destination buffer - * @param offset Destination offset - * @returns Number of bytes written - * @throws {Error} If encoding is invalid - */ - function decode(string: string, buffer: Uint8Array, offset: number): number; - - /** - * Tests if the specified string appears to be base64 encoded. - * @param string String to test - * @returns `true` if probably base64 encoded, otherwise false - */ - function test(string: string): boolean; - } - - /** - * Begins generating a function. - * @param functionParams Function parameter names - * @param [functionName] Function name if not anonymous - * @returns Appender that appends code to the function's body - */ - function codegen(functionParams: string[], functionName?: string): Codegen; - - namespace codegen { - - /** When set to `true`, codegen will log generated code to console. Useful for debugging. */ - let verbose: boolean; - } - - /** - * Begins generating a function. - * @param [functionName] Function name if not anonymous - * @returns Appender that appends code to the function's body - */ - function codegen(functionName?: string): Codegen; - - /** A minimal event emitter. */ - class EventEmitter { - - /** Constructs a new event emitter instance. */ - constructor(); - - /** - * Registers an event listener. - * @param evt Event name - * @param fn Listener - * @param [ctx] Listener context - * @returns `this` - */ - public on(evt: string, fn: EventEmitterListener, ctx?: any): this; - - /** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param [evt] Event name. Removes all listeners if omitted. - * @param [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns `this` - */ - public off(evt?: string, fn?: EventEmitterListener): this; - - /** - * Emits an event by calling its listeners with the specified arguments. - * @param evt Event name - * @param args Arguments - * @returns `this` - */ - public emit(evt: string, ...args: any[]): this; - } - - /** Reads / writes floats / doubles from / to buffers. */ - namespace float { - - /** - * Writes a 32 bit float to a buffer using little endian byte order. - * @param val Value to write - * @param buf Target buffer - * @param pos Target buffer offset - */ - function writeFloatLE(val: number, buf: Uint8Array, pos: number): void; - - /** - * Writes a 32 bit float to a buffer using big endian byte order. - * @param val Value to write - * @param buf Target buffer - * @param pos Target buffer offset - */ - function writeFloatBE(val: number, buf: Uint8Array, pos: number): void; - - /** - * Reads a 32 bit float from a buffer using little endian byte order. - * @param buf Source buffer - * @param pos Source buffer offset - * @returns Value read - */ - function readFloatLE(buf: Uint8Array, pos: number): number; - - /** - * Reads a 32 bit float from a buffer using big endian byte order. - * @param buf Source buffer - * @param pos Source buffer offset - * @returns Value read - */ - function readFloatBE(buf: Uint8Array, pos: number): number; - - /** - * Writes a 64 bit double to a buffer using little endian byte order. - * @param val Value to write - * @param buf Target buffer - * @param pos Target buffer offset - */ - function writeDoubleLE(val: number, buf: Uint8Array, pos: number): void; - - /** - * Writes a 64 bit double to a buffer using big endian byte order. - * @param val Value to write - * @param buf Target buffer - * @param pos Target buffer offset - */ - function writeDoubleBE(val: number, buf: Uint8Array, pos: number): void; - - /** - * Reads a 64 bit double from a buffer using little endian byte order. - * @param buf Source buffer - * @param pos Source buffer offset - * @returns Value read - */ - function readDoubleLE(buf: Uint8Array, pos: number): number; - - /** - * Reads a 64 bit double from a buffer using big endian byte order. - * @param buf Source buffer - * @param pos Source buffer offset - * @returns Value read - */ - function readDoubleBE(buf: Uint8Array, pos: number): number; - } - - /** - * Fetches the contents of a file. - * @param filename File path or url - * @param options Fetch options - * @param callback Callback function - */ - function fetch(filename: string, options: IFetchOptions, callback: FetchCallback): void; - - /** - * Fetches the contents of a file. - * @param path File path or url - * @param callback Callback function - */ - function fetch(path: string, callback: FetchCallback): void; - - /** - * Fetches the contents of a file. - * @param path File path or url - * @param [options] Fetch options - * @returns Promise - */ - function fetch(path: string, options?: IFetchOptions): Promise<(string|Uint8Array)>; - - /** - * Requires a module only if available. - * @param moduleName Module to require - * @returns Required module if available and not empty, otherwise `null` - */ - function inquire(moduleName: string): object; - - /** A minimal path module to resolve Unix, Windows and URL paths alike. */ - namespace path { - - /** - * Tests if the specified path is absolute. - * @param path Path to test - * @returns `true` if path is absolute - */ - function isAbsolute(path: string): boolean; - - /** - * Normalizes the specified path. - * @param path Path to normalize - * @returns Normalized path - */ - function normalize(path: string): string; - - /** - * Resolves the specified include path against the specified origin path. - * @param originPath Path to the origin file - * @param includePath Include path relative to origin path - * @param [alreadyNormalized=false] `true` if both paths are already known to be normalized - * @returns Path to the include file - */ - function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string; - } - - /** - * A general purpose buffer pool. - * @param alloc Allocator - * @param slice Slicer - * @param [size=8192] Slab size - * @returns Pooled allocator - */ - function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator; - - /** A minimal UTF8 implementation for number arrays. */ - namespace utf8 { - - /** - * Calculates the UTF8 byte length of a string. - * @param string String - * @returns Byte length - */ - function length(string: string): number; - - /** - * Reads UTF8 bytes as a string. - * @param buffer Source buffer - * @param start Source start - * @param end Source end - * @returns String read - */ - function read(buffer: Uint8Array, start: number, end: number): string; - - /** - * Writes a string as UTF8 bytes. - * @param string Source string - * @param buffer Destination buffer - * @param offset Destination offset - * @returns Bytes written - */ - function write(string: string, buffer: Uint8Array, offset: number): number; - } -} - -/** - * Generates a verifier specific to the specified message type. - * @param mtype Message type - * @returns Codegen instance - */ -export function verifier(mtype: Type): Codegen; - -/** Wrappers for common types. */ -export const wrappers: { [k: string]: IWrapper }; - -/** - * From object converter part of an {@link IWrapper}. - * @param object Plain object - * @returns Message instance - */ -type WrapperFromObjectConverter = (this: Type, object: { [k: string]: any }) => Message<{}>; - -/** - * To object converter part of an {@link IWrapper}. - * @param message Message instance - * @param [options] Conversion options - * @returns Plain object - */ -type WrapperToObjectConverter = (this: Type, message: Message<{}>, options?: IConversionOptions) => { [k: string]: any }; - -/** Common type wrapper part of {@link wrappers}. */ -export interface IWrapper { - - /** From object converter */ - fromObject?: WrapperFromObjectConverter; - - /** To object converter */ - toObject?: WrapperToObjectConverter; -} - -/** Wire format writer using `Uint8Array` if available, otherwise `Array`. */ -export class Writer { - - /** Constructs a new writer instance. */ - constructor(); - - /** Current length. */ - public len: number; - - /** Operations head. */ - public head: object; - - /** Operations tail */ - public tail: object; - - /** Linked forked states. */ - public states: (object|null); - - /** - * Creates a new writer. - * @returns A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} - */ - public static create(): (BufferWriter|Writer); - - /** - * Allocates a buffer of the specified size. - * @param size Buffer size - * @returns Buffer - */ - public static alloc(size: number): Uint8Array; - - /** - * Writes an unsigned 32 bit value as a varint. - * @param value Value to write - * @returns `this` - */ - public uint32(value: number): Writer; - - /** - * Writes a signed 32 bit value as a varint. - * @param value Value to write - * @returns `this` - */ - public int32(value: number): Writer; - - /** - * Writes a 32 bit value as a varint, zig-zag encoded. - * @param value Value to write - * @returns `this` - */ - public sint32(value: number): Writer; - - /** - * Writes an unsigned 64 bit value as a varint. - * @param value Value to write - * @returns `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - public uint64(value: (Long|number|string)): Writer; - - /** - * Writes a signed 64 bit value as a varint. - * @param value Value to write - * @returns `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - public int64(value: (Long|number|string)): Writer; - - /** - * Writes a signed 64 bit value as a varint, zig-zag encoded. - * @param value Value to write - * @returns `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - public sint64(value: (Long|number|string)): Writer; - - /** - * Writes a boolish value as a varint. - * @param value Value to write - * @returns `this` - */ - public bool(value: boolean): Writer; - - /** - * Writes an unsigned 32 bit value as fixed 32 bits. - * @param value Value to write - * @returns `this` - */ - public fixed32(value: number): Writer; - - /** - * Writes a signed 32 bit value as fixed 32 bits. - * @param value Value to write - * @returns `this` - */ - public sfixed32(value: number): Writer; - - /** - * Writes an unsigned 64 bit value as fixed 64 bits. - * @param value Value to write - * @returns `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - public fixed64(value: (Long|number|string)): Writer; - - /** - * Writes a signed 64 bit value as fixed 64 bits. - * @param value Value to write - * @returns `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - public sfixed64(value: (Long|number|string)): Writer; - - /** - * Writes a float (32 bit). - * @param value Value to write - * @returns `this` - */ - public float(value: number): Writer; - - /** - * Writes a double (64 bit float). - * @param value Value to write - * @returns `this` - */ - public double(value: number): Writer; - - /** - * Writes a sequence of bytes. - * @param value Buffer or base64 encoded string to write - * @returns `this` - */ - public bytes(value: (Uint8Array|string)): Writer; - - /** - * Writes a string. - * @param value Value to write - * @returns `this` - */ - public string(value: string): Writer; - - /** - * Forks this writer's state by pushing it to a stack. - * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. - * @returns `this` - */ - public fork(): Writer; - - /** - * Resets this instance to the last state. - * @returns `this` - */ - public reset(): Writer; - - /** - * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. - * @returns `this` - */ - public ldelim(): Writer; - - /** - * Finishes the write operation. - * @returns Finished buffer - */ - public finish(): Uint8Array; -} - -/** Wire format writer using node buffers. */ -export class BufferWriter extends Writer { - - /** Constructs a new buffer writer instance. */ - constructor(); - - /** - * Allocates a buffer of the specified size. - * @param size Buffer size - * @returns Buffer - */ - public static alloc(size: number): Buffer; - - /** - * Finishes the write operation. - * @returns Finished buffer - */ - public finish(): Buffer; -} - -/** - * Callback as used by {@link util.asPromise}. - * @param error Error, if any - * @param params Additional arguments - */ -type asPromiseCallback = (error: (Error|null), ...params: any[]) => void; - -/** - * Appends code to the function's body or finishes generation. - * @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any - * @param [formatParams] Format parameters - * @returns Itself or the generated function if finished - * @throws {Error} If format parameter counts do not match - */ -type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function); - -/** - * Event listener as used by {@link util.EventEmitter}. - * @param args Arguments - */ -type EventEmitterListener = (...args: any[]) => void; - -/** - * Node-style callback as used by {@link util.fetch}. - * @param error Error, if any, otherwise `null` - * @param [contents] File contents, if there hasn't been an error - */ -type FetchCallback = (error: Error, contents?: string) => void; - -/** Options as used by {@link util.fetch}. */ -export interface IFetchOptions { - - /** Whether expecting a binary response */ - binary?: boolean; - - /** If `true`, forces the use of XMLHttpRequest */ - xhr?: boolean; -} - -/** - * An allocator as used by {@link util.pool}. - * @param size Buffer size - * @returns Buffer - */ -type PoolAllocator = (size: number) => Uint8Array; - -/** - * A slicer as used by {@link util.pool}. - * @param start Start offset - * @param end End offset - * @returns Buffer slice - */ -type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array; diff --git a/node_modules/protobufjs/index.js b/node_modules/protobufjs/index.js deleted file mode 100644 index 042042ae..00000000 --- a/node_modules/protobufjs/index.js +++ /dev/null @@ -1,4 +0,0 @@ -// full library entry point. - -"use strict"; -module.exports = require("./src/index"); diff --git a/node_modules/protobufjs/light.d.ts b/node_modules/protobufjs/light.d.ts deleted file mode 100644 index d83e7f99..00000000 --- a/node_modules/protobufjs/light.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export as namespace protobuf; -export * from "./index"; diff --git a/node_modules/protobufjs/light.js b/node_modules/protobufjs/light.js deleted file mode 100644 index 1209e64c..00000000 --- a/node_modules/protobufjs/light.js +++ /dev/null @@ -1,4 +0,0 @@ -// light library entry point. - -"use strict"; -module.exports = require("./src/index-light"); \ No newline at end of file diff --git a/node_modules/protobufjs/minimal.d.ts b/node_modules/protobufjs/minimal.d.ts deleted file mode 100644 index d83e7f99..00000000 --- a/node_modules/protobufjs/minimal.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export as namespace protobuf; -export * from "./index"; diff --git a/node_modules/protobufjs/minimal.js b/node_modules/protobufjs/minimal.js deleted file mode 100644 index 1f35ec99..00000000 --- a/node_modules/protobufjs/minimal.js +++ /dev/null @@ -1,4 +0,0 @@ -// minimal library entry point. - -"use strict"; -module.exports = require("./src/index-minimal"); diff --git a/node_modules/protobufjs/node_modules/@types/node/LICENSE b/node_modules/protobufjs/node_modules/@types/node/LICENSE deleted file mode 100644 index 9e841e7a..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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 diff --git a/node_modules/protobufjs/node_modules/@types/node/README.md b/node_modules/protobufjs/node_modules/@types/node/README.md deleted file mode 100644 index cabbda33..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/node` - -# Summary -This package contains type definitions for Node.js (http://nodejs.org/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v13. - -### Additional Details - * Last updated: Wed, 25 Nov 2020 06:26:15 GMT - * Dependencies: none - * Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout` - -# Credits -These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [Christian Vaagland Tellnes](https://github.com/tellnes), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Jason Kwok](https://github.com/JasonHK). diff --git a/node_modules/protobufjs/node_modules/@types/node/assert.d.ts b/node_modules/protobufjs/node_modules/@types/node/assert.d.ts deleted file mode 100644 index ec0c775a..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/assert.d.ts +++ /dev/null @@ -1,100 +0,0 @@ -declare module 'assert' { - function assert(value: any, message?: string | Error): asserts value; - namespace assert { - class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - code: 'ERR_ASSERTION'; - - constructor(options?: { - message?: string; - actual?: any; - expected?: any; - operator?: string; - stackStartFn?: Function; - }); - } - - type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error; - - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: any, - expected: any, - message?: string | Error, - operator?: string, - stackStartFn?: Function, - ): never; - function ok(value: any, message?: string | Error): asserts value; - /** @deprecated since v9.9.0 - use strictEqual() instead. */ - function equal(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notStrictEqual() instead. */ - function notEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */ - function deepEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */ - function notDeepEqual(actual: any, expected: any, message?: string | Error): void; - function strictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - function notStrictEqual(actual: any, expected: any, message?: string | Error): void; - function deepStrictEqual(actual: any, expected: T, message?: string | Error): asserts actual is T; - function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; - - function throws(block: () => any, message?: string | Error): void; - function throws(block: () => any, error: AssertPredicate, message?: string | Error): void; - function doesNotThrow(block: () => any, message?: string | Error): void; - function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void; - - function ifError(value: any): asserts value is null | undefined; - - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: RegExp | Function, - message?: string | Error, - ): Promise; - - function match(value: string, regExp: RegExp, message?: string | Error): void; - function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; - - const strict: Omit< - typeof assert, - | 'equal' - | 'notEqual' - | 'deepEqual' - | 'notDeepEqual' - | 'ok' - | 'strictEqual' - | 'deepStrictEqual' - | 'ifError' - | 'strict' - > & { - (value: any, message?: string | Error): asserts value; - equal: typeof strictEqual; - notEqual: typeof notStrictEqual; - deepEqual: typeof deepStrictEqual; - notDeepEqual: typeof notDeepStrictEqual; - - // Mapped types and assertion functions are incompatible? - // TS2775: Assertions require every name in the call target - // to be declared with an explicit type annotation. - ok: typeof ok; - strictEqual: typeof strictEqual; - deepStrictEqual: typeof deepStrictEqual; - ifError: typeof ifError; - strict: typeof strict; - }; - } - - export = assert; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/async_hooks.d.ts b/node_modules/protobufjs/node_modules/@types/node/async_hooks.d.ts deleted file mode 100644 index a32036a1..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/async_hooks.d.ts +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Async Hooks module: https://nodejs.org/api/async_hooks.html - */ -declare module "async_hooks" { - /** - * Returns the asyncId of the current execution context. - */ - function executionAsyncId(): number; - - /** - * The resource representing the current execution. - * Useful to store data within the resource. - * - * Resource objects returned by `executionAsyncResource()` are most often internal - * Node.js handle objects with undocumented APIs. Using any functions or properties - * on the object is likely to crash your application and should be avoided. - * - * Using `executionAsyncResource()` in the top-level execution context will - * return an empty object as there is no handle or request object to use, - * but having an object representing the top-level can be helpful. - */ - function executionAsyncResource(): object; - - /** - * Returns the ID of the resource responsible for calling the callback that is currently being executed. - */ - function triggerAsyncId(): number; - - interface HookCallbacks { - /** - * Called when a class is constructed that has the possibility to emit an asynchronous event. - * @param asyncId a unique ID for the async resource - * @param type the type of the async resource - * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created - * @param resource reference to the resource representing the async operation, needs to be released during destroy - */ - init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; - - /** - * When an asynchronous operation is initiated or completes a callback is called to notify the user. - * The before callback is called just before said callback is executed. - * @param asyncId the unique identifier assigned to the resource about to execute the callback. - */ - before?(asyncId: number): void; - - /** - * Called immediately after the callback specified in before is completed. - * @param asyncId the unique identifier assigned to the resource which has executed the callback. - */ - after?(asyncId: number): void; - - /** - * Called when a promise has resolve() called. This may not be in the same execution id - * as the promise itself. - * @param asyncId the unique id for the promise that was resolve()d. - */ - promiseResolve?(asyncId: number): void; - - /** - * Called after the resource corresponding to asyncId is destroyed - * @param asyncId a unique ID for the async resource - */ - destroy?(asyncId: number): void; - } - - interface AsyncHook { - /** - * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. - */ - enable(): this; - - /** - * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. - */ - disable(): this; - } - - /** - * Registers functions to be called for different lifetime events of each async operation. - * @param options the callbacks to register - * @return an AsyncHooks instance used for disabling and enabling hooks - */ - function createHook(options: HookCallbacks): AsyncHook; - - interface AsyncResourceOptions { - /** - * The ID of the execution context that created this async event. - * Default: `executionAsyncId()` - */ - triggerAsyncId?: number; - - /** - * Disables automatic `emitDestroy` when the object is garbage collected. - * This usually does not need to be set (even if `emitDestroy` is called - * manually), unless the resource's `asyncId` is retrieved and the - * sensitive API's `emitDestroy` is called with it. - * Default: `false` - */ - requireManualDestroy?: boolean; - } - - /** - * The class AsyncResource was designed to be extended by the embedder's async resources. - * Using this users can easily trigger the lifetime events of their own resources. - */ - class AsyncResource { - /** - * AsyncResource() is meant to be extended. Instantiating a - * new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * async_hook.executionAsyncId() is used. - * @param type The type of async event. - * @param triggerAsyncId The ID of the execution context that created - * this async event (default: `executionAsyncId()`), or an - * AsyncResourceOptions object (since 9.3) - */ - constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); - - /** - * Call the provided function with the provided arguments in the - * execution context of the async resource. This will establish the - * context, trigger the AsyncHooks before callbacks, call the function, - * trigger the AsyncHooks after callbacks, and then restore the original - * execution context. - * @param fn The function to call in the execution context of this - * async resource. - * @param thisArg The receiver to be used for the function call. - * @param args Optional arguments to pass to the function. - */ - runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; - - /** - * Call AsyncHooks destroy callbacks. - */ - emitDestroy(): void; - - /** - * @return the unique ID assigned to this AsyncResource instance. - */ - asyncId(): number; - - /** - * @return the trigger ID for this AsyncResource instance. - */ - triggerAsyncId(): number; - } - - /** - * When having multiple instances of `AsyncLocalStorage`, they are independent - * from each other. It is safe to instantiate this class multiple times. - */ - class AsyncLocalStorage { - /** - * This method disables the instance of `AsyncLocalStorage`. All subsequent calls - * to `asyncLocalStorage.getStore()` will return `undefined` until - * `asyncLocalStorage.run()` or `asyncLocalStorage.runSyncAndReturn()` - * is called again. - * - * When calling `asyncLocalStorage.disable()`, all current contexts linked to the - * instance will be exited. - * - * Calling `asyncLocalStorage.disable()` is required before the - * `asyncLocalStorage` can be garbage collected. This does not apply to stores - * provided by the `asyncLocalStorage`, as those objects are garbage collected - * along with the corresponding async resources. - * - * This method is to be used when the `asyncLocalStorage` is not in use anymore - * in the current process. - */ - disable(): void; - - /** - * This method returns the current store. - * If this method is called outside of an asynchronous context initialized by - * calling `asyncLocalStorage.run` or `asyncLocalStorage.runAndReturn`, it will - * return `undefined`. - */ - getStore(): T | undefined; - - /** - * Calling `asyncLocalStorage.run(callback)` will create a new asynchronous - * context. - * Within the callback function and the asynchronous operations from the callback, - * `asyncLocalStorage.getStore()` will return an instance of `Map` known as - * "the store". This store will be persistent through the following - * asynchronous calls. - * - * The callback will be ran asynchronously. Optionally, arguments can be passed - * to the function. They will be passed to the callback function. - * - * If an error is thrown by the callback function, it will not be caught by - * a `try/catch` block as the callback is ran in a new asynchronous resource. - * Also, the stacktrace will be impacted by the asynchronous call. - */ - // TODO: Apply generic vararg once available - run(store: T, callback: (...args: any[]) => void, ...args: any[]): void; - - /** - * Calling `asyncLocalStorage.exit(callback)` will create a new asynchronous - * context. - * Within the callback function and the asynchronous operations from the callback, - * `asyncLocalStorage.getStore()` will return `undefined`. - * - * The callback will be ran asynchronously. Optionally, arguments can be passed - * to the function. They will be passed to the callback function. - * - * If an error is thrown by the callback function, it will not be caught by - * a `try/catch` block as the callback is ran in a new asynchronous resource. - * Also, the stacktrace will be impacted by the asynchronous call. - */ - exit(callback: (...args: any[]) => void, ...args: any[]): void; - - /** - * This methods runs a function synchronously within a context and return its - * return value. The store is not accessible outside of the callback function or - * the asynchronous operations created within the callback. - * - * Optionally, arguments can be passed to the function. They will be passed to - * the callback function. - * - * If the callback function throws an error, it will be thrown by - * `runSyncAndReturn` too. The stacktrace will not be impacted by this call and - * the context will be exited. - */ - runSyncAndReturn(store: T, callback: (...args: any[]) => R, ...args: any[]): R; - - /** - * This methods runs a function synchronously outside of a context and return its - * return value. The store is not accessible within the callback function or - * the asynchronous operations created within the callback. - * - * Optionally, arguments can be passed to the function. They will be passed to - * the callback function. - * - * If the callback function throws an error, it will be thrown by - * `exitSyncAndReturn` too. The stacktrace will not be impacted by this call and - * the context will be re-entered. - */ - exitSyncAndReturn(callback: (...args: any[]) => R, ...args: any[]): R; - - /** - * Calling `asyncLocalStorage.enterWith(store)` will transition into the context - * for the remainder of the current synchronous execution and will persist - * through any following asynchronous calls. - */ - enterWith(store: T): void; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/base.d.ts b/node_modules/protobufjs/node_modules/@types/node/base.d.ts deleted file mode 100644 index fa671790..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/base.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.7. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7 -// - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// - -// TypeScript 3.7-specific augmentations: -/// diff --git a/node_modules/protobufjs/node_modules/@types/node/buffer.d.ts b/node_modules/protobufjs/node_modules/@types/node/buffer.d.ts deleted file mode 100644 index 7eb1061b..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/buffer.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module "buffer" { - export const INSPECT_MAX_BYTES: number; - export const kMaxLength: number; - export const kStringMaxLength: number; - export const constants: { - MAX_LENGTH: number; - MAX_STRING_LENGTH: number; - }; - const BuffType: typeof Buffer; - - export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary"; - - export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; - - export const SlowBuffer: { - /** @deprecated since v6.0.0, use Buffer.allocUnsafeSlow() */ - new(size: number): Buffer; - prototype: Buffer; - }; - - export { BuffType as Buffer }; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/child_process.d.ts b/node_modules/protobufjs/node_modules/@types/node/child_process.d.ts deleted file mode 100644 index 66b3ef2a..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/child_process.d.ts +++ /dev/null @@ -1,504 +0,0 @@ -declare module "child_process" { - import * as events from "events"; - import * as net from "net"; - import { Writable, Readable, Stream, Pipe } from "stream"; - - type Serializable = string | object | number | boolean; - type SendHandle = net.Socket | net.Server; - - interface ChildProcess extends events.EventEmitter { - stdin: Writable | null; - stdout: Readable | null; - stderr: Readable | null; - readonly channel?: Pipe | null; - readonly stdio: [ - Writable | null, // stdin - Readable | null, // stdout - Readable | null, // stderr - Readable | Writable | null | undefined, // extra - Readable | Writable | null | undefined // extra - ]; - readonly killed: boolean; - readonly pid: number; - readonly connected: boolean; - readonly exitCode: number | null; - readonly signalCode: number | null; - readonly spawnargs: string[]; - readonly spawnfile: string; - kill(signal?: NodeJS.Signals | number): boolean; - send(message: Serializable, callback?: (error: Error | null) => void): boolean; - send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; - send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean; - disconnect(): void; - unref(): void; - ref(): void; - - /** - * events.EventEmitter - * 1. close - * 2. disconnect - * 3. error - * 4. exit - * 5. message - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", code: number, signal: NodeJS.Signals): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - } - - // return this object when stdio option is undefined or not specified - interface ChildProcessWithoutNullStreams extends ChildProcess { - stdin: Writable; - stdout: Readable; - stderr: Readable; - readonly stdio: [ - Writable, // stdin - Readable, // stdout - Readable, // stderr - Readable | Writable | null | undefined, // extra, no modification - Readable | Writable | null | undefined // extra, no modification - ]; - } - - // return this object when stdio option is a tuple of 3 - interface ChildProcessByStdio< - I extends null | Writable, - O extends null | Readable, - E extends null | Readable, - > extends ChildProcess { - stdin: I; - stdout: O; - stderr: E; - readonly stdio: [ - I, - O, - E, - Readable | Writable | null | undefined, // extra, no modification - Readable | Writable | null | undefined // extra, no modification - ]; - } - - interface MessageOptions { - keepOpen?: boolean; - } - - type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>; - - type SerializationType = 'json' | 'advanced'; - - interface MessagingOptions { - /** - * Specify the kind of serialization used for sending messages between processes. - * @default 'json' - */ - serialization?: SerializationType; - } - - interface ProcessEnvOptions { - uid?: number; - gid?: number; - cwd?: string; - env?: NodeJS.ProcessEnv; - } - - interface CommonOptions extends ProcessEnvOptions { - /** - * @default true - */ - windowsHide?: boolean; - /** - * @default 0 - */ - timeout?: number; - } - - interface CommonSpawnOptions extends CommonOptions, MessagingOptions { - argv0?: string; - stdio?: StdioOptions; - shell?: boolean | string; - windowsVerbatimArguments?: boolean; - } - - interface SpawnOptions extends CommonSpawnOptions { - detached?: boolean; - } - - interface SpawnOptionsWithoutStdio extends SpawnOptions { - stdio?: 'pipe' | Array; - } - - type StdioNull = 'inherit' | 'ignore' | Stream; - type StdioPipe = undefined | null | 'pipe'; - - interface SpawnOptionsWithStdioTuple< - Stdin extends StdioNull | StdioPipe, - Stdout extends StdioNull | StdioPipe, - Stderr extends StdioNull | StdioPipe, - > extends SpawnOptions { - stdio: [Stdin, Stdout, Stderr]; - } - - // overloads of spawn without 'args' - function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - - function spawn(command: string, options: SpawnOptions): ChildProcess; - - // overloads of spawn with 'args' - function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: ReadonlyArray, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - - function spawn(command: string, args: ReadonlyArray, options: SpawnOptions): ChildProcess; - - interface ExecOptions extends CommonOptions { - shell?: string; - maxBuffer?: number; - killSignal?: NodeJS.Signals | number; - } - - interface ExecOptionsWithStringEncoding extends ExecOptions { - encoding: BufferEncoding; - } - - interface ExecOptionsWithBufferEncoding extends ExecOptions { - encoding: string | null; // specify `null`. - } - - interface ExecException extends Error { - cmd?: string; - killed?: boolean; - code?: number; - signal?: NodeJS.Signals; - } - - // no `options` definitely means stdout/stderr are `string`. - function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function exec(command: string, options: { encoding: string } & ExecOptions, callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; - - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function exec( - command: string, - options: ({ encoding?: string | null } & ExecOptions) | undefined | null, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - - interface PromiseWithChild extends Promise { - child: ChildProcess; - } - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace exec { - function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - } - - interface ExecFileOptions extends CommonOptions { - maxBuffer?: number; - killSignal?: NodeJS.Signals | number; - windowsVerbatimArguments?: boolean; - shell?: boolean | string; - } - interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { - encoding: 'buffer' | null; - } - interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { - encoding: string; - } - - function execFile(file: string): ChildProcess; - function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; - function execFile(file: string, args?: ReadonlyArray | null): ChildProcess; - function execFile(file: string, args: ReadonlyArray | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; - - // no `options` definitely means stdout/stderr are `string`. - function execFile(file: string, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithStringEncoding, - callback: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function execFile( - file: string, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function execFile(file: string, options: ExecFileOptions, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptions, - callback: (error: ExecException | null, stdout: string, stderr: string) => void - ): ChildProcess; - - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function execFile( - file: string, - options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, - callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, - ): ChildProcess; - function execFile( - file: string, - args: ReadonlyArray | undefined | null, - options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, - callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, - ): ChildProcess; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace execFile { - function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; - function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__( - file: string, - args: ReadonlyArray | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; - function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - function __promisify__( - file: string, - args: ReadonlyArray | undefined | null, - options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, - ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; - } - - interface ForkOptions extends ProcessEnvOptions, MessagingOptions { - execPath?: string; - execArgv?: string[]; - silent?: boolean; - stdio?: StdioOptions; - detached?: boolean; - windowsVerbatimArguments?: boolean; - } - function fork(modulePath: string, options?: ForkOptions): ChildProcess; - function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; - - interface SpawnSyncOptions extends CommonSpawnOptions { - input?: string | NodeJS.ArrayBufferView; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: string; - } - interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { - encoding: BufferEncoding; - } - interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { - encoding: string; // specify `null`. - } - interface SpawnSyncReturns { - pid: number; - output: string[]; - stdout: T; - stderr: T; - status: number | null; - signal: NodeJS.Signals | null; - error?: Error; - } - function spawnSync(command: string): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns; - - interface ExecSyncOptions extends CommonOptions { - input?: string | Uint8Array; - stdio?: StdioOptions; - shell?: string; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: string; - } - interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { - encoding: BufferEncoding; - } - interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { - encoding: string; // specify `null`. - } - function execSync(command: string): Buffer; - function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string; - function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer; - function execSync(command: string, options?: ExecSyncOptions): Buffer; - - interface ExecFileSyncOptions extends CommonOptions { - input?: string | NodeJS.ArrayBufferView; - stdio?: StdioOptions; - killSignal?: NodeJS.Signals | number; - maxBuffer?: number; - encoding?: string; - shell?: boolean | string; - } - interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { - encoding: BufferEncoding; - } - interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { - encoding: string; // specify `null`. - } - function execFileSync(command: string): Buffer; - function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): Buffer; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/cluster.d.ts b/node_modules/protobufjs/node_modules/@types/node/cluster.d.ts deleted file mode 100644 index 0ef6c2a0..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/cluster.d.ts +++ /dev/null @@ -1,262 +0,0 @@ -declare module "cluster" { - import * as child from "child_process"; - import * as events from "events"; - import * as net from "net"; - - // interfaces - interface ClusterSettings { - execArgv?: string[]; // default: process.execArgv - exec?: string; - args?: string[]; - silent?: boolean; - stdio?: any[]; - uid?: number; - gid?: number; - inspectPort?: number | (() => number); - } - - interface Address { - address: string; - port: number; - addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6" - } - - class Worker extends events.EventEmitter { - id: number; - process: child.ChildProcess; - send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean; - kill(signal?: string): void; - destroy(signal?: string): void; - disconnect(): void; - isConnected(): boolean; - isDead(): boolean; - exitedAfterDisconnect: boolean; - - /** - * events.EventEmitter - * 1. disconnect - * 2. error - * 3. exit - * 4. listening - * 5. message - * 6. online - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "exit", listener: (code: number, signal: string) => void): this; - addListener(event: "listening", listener: (address: Address) => void): this; - addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "exit", code: number, signal: string): boolean; - emit(event: "listening", address: Address): boolean; - emit(event: "message", message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "exit", listener: (code: number, signal: string) => void): this; - on(event: "listening", listener: (address: Address) => void): this; - on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "exit", listener: (code: number, signal: string) => void): this; - once(event: "listening", listener: (address: Address) => void): this; - once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependListener(event: "listening", listener: (address: Address) => void): this; - prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependOnceListener(event: "listening", listener: (address: Address) => void): this; - prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "online", listener: () => void): this; - } - - interface Cluster extends events.EventEmitter { - Worker: Worker; - disconnect(callback?: () => void): void; - fork(env?: any): Worker; - isMaster: boolean; - isWorker: boolean; - schedulingPolicy: number; - settings: ClusterSettings; - setupMaster(settings?: ClusterSettings): void; - worker?: Worker; - workers?: NodeJS.Dict; - - readonly SCHED_NONE: number; - readonly SCHED_RR: number; - - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: (worker: Worker) => void): this; - addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - addListener(event: "fork", listener: (worker: Worker) => void): this; - addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: (worker: Worker) => void): this; - addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect", worker: Worker): boolean; - emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - emit(event: "fork", worker: Worker): boolean; - emit(event: "listening", worker: Worker, address: Address): boolean; - emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online", worker: Worker): boolean; - emit(event: "setup", settings: ClusterSettings): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: (worker: Worker) => void): this; - on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - on(event: "fork", listener: (worker: Worker) => void): this; - on(event: "listening", listener: (worker: Worker, address: Address) => void): this; - on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: (worker: Worker) => void): this; - on(event: "setup", listener: (settings: ClusterSettings) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: (worker: Worker) => void): this; - once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - once(event: "fork", listener: (worker: Worker) => void): this; - once(event: "listening", listener: (worker: Worker, address: Address) => void): this; - once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: (worker: Worker) => void): this; - once(event: "setup", listener: (settings: ClusterSettings) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependListener(event: "fork", listener: (worker: Worker) => void): this; - prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: (worker: Worker) => void): this; - prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependOnceListener(event: "fork", listener: (worker: Worker) => void): this; - prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; - prependOnceListener(event: "online", listener: (worker: Worker) => void): this; - prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - } - - const SCHED_NONE: number; - const SCHED_RR: number; - - function disconnect(callback?: () => void): void; - function fork(env?: any): Worker; - const isMaster: boolean; - const isWorker: boolean; - let schedulingPolicy: number; - const settings: ClusterSettings; - function setupMaster(settings?: ClusterSettings): void; - const worker: Worker; - const workers: NodeJS.Dict; - - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - function addListener(event: string, listener: (...args: any[]) => void): Cluster; - function addListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function addListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function addListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function addListener(event: "online", listener: (worker: Worker) => void): Cluster; - function addListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function emit(event: string | symbol, ...args: any[]): boolean; - function emit(event: "disconnect", worker: Worker): boolean; - function emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - function emit(event: "fork", worker: Worker): boolean; - function emit(event: "listening", worker: Worker, address: Address): boolean; - function emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - function emit(event: "online", worker: Worker): boolean; - function emit(event: "setup", settings: ClusterSettings): boolean; - - function on(event: string, listener: (...args: any[]) => void): Cluster; - function on(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function on(event: "fork", listener: (worker: Worker) => void): Cluster; - function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. - function on(event: "online", listener: (worker: Worker) => void): Cluster; - function on(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function once(event: string, listener: (...args: any[]) => void): Cluster; - function once(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function once(event: "fork", listener: (worker: Worker) => void): Cluster; - function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. - function once(event: "online", listener: (worker: Worker) => void): Cluster; - function once(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function removeListener(event: string, listener: (...args: any[]) => void): Cluster; - function removeAllListeners(event?: string): Cluster; - function setMaxListeners(n: number): Cluster; - function getMaxListeners(): number; - function listeners(event: string): Function[]; - function listenerCount(type: string): number; - - function prependListener(event: string, listener: (...args: any[]) => void): Cluster; - function prependListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function prependListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function prependListener(event: "online", listener: (worker: Worker) => void): Cluster; - function prependListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function prependOnceListener(event: string, listener: (...args: any[]) => void): Cluster; - function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; - function prependOnceListener(event: "fork", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; - // the handle is a net.Socket or net.Server object, or undefined. - function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; - function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster; - function prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; - - function eventNames(): string[]; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/console.d.ts b/node_modules/protobufjs/node_modules/@types/node/console.d.ts deleted file mode 100644 index d30d13f8..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/console.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "console" { - export = console; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/constants.d.ts b/node_modules/protobufjs/node_modules/@types/node/constants.d.ts deleted file mode 100644 index d124ae66..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/constants.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ -declare module "constants" { - import { constants as osConstants, SignalConstants } from 'os'; - import { constants as cryptoConstants } from 'crypto'; - import { constants as fsConstants } from 'fs'; - const exp: typeof osConstants.errno & typeof osConstants.priority & SignalConstants & typeof cryptoConstants & typeof fsConstants; - export = exp; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/crypto.d.ts b/node_modules/protobufjs/node_modules/@types/node/crypto.d.ts deleted file mode 100644 index 498f82bb..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/crypto.d.ts +++ /dev/null @@ -1,616 +0,0 @@ -declare module "crypto" { - import * as stream from "stream"; - - interface Certificate { - exportChallenge(spkac: BinaryLike): Buffer; - exportPublicKey(spkac: BinaryLike): Buffer; - verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - } - const Certificate: { - new(): Certificate; - (): Certificate; - }; - - namespace constants { // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants - const OPENSSL_VERSION_NUMBER: number; - - /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ - const SSL_OP_ALL: number; - /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_CIPHER_SERVER_PREFERENCE: number; - /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */ - const SSL_OP_CISCO_ANYCONNECT: number; - /** Instructs OpenSSL to turn on cookie exchange. */ - const SSL_OP_COOKIE_EXCHANGE: number; - /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ - const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ - const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - /** Instructs OpenSSL to always use the tmp_rsa key when performing RSA operations. */ - const SSL_OP_EPHEMERAL_RSA: number; - /** Allows initial connection to servers that do not support RI. */ - const SSL_OP_LEGACY_SERVER_CONNECT: number; - const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; - const SSL_OP_MICROSOFT_SESS_ID_BUG: number; - /** Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. */ - const SSL_OP_MSIE_SSLV2_RSA_PADDING: number; - const SSL_OP_NETSCAPE_CA_DN_BUG: number; - const SSL_OP_NETSCAPE_CHALLENGE_BUG: number; - const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; - const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; - /** Instructs OpenSSL to disable support for SSL/TLS compression. */ - const SSL_OP_NO_COMPRESSION: number; - const SSL_OP_NO_QUERY_MTU: number; - /** Instructs OpenSSL to always start a new session when performing renegotiation. */ - const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - const SSL_OP_NO_SSLv2: number; - const SSL_OP_NO_SSLv3: number; - const SSL_OP_NO_TICKET: number; - const SSL_OP_NO_TLSv1: number; - const SSL_OP_NO_TLSv1_1: number; - const SSL_OP_NO_TLSv1_2: number; - const SSL_OP_PKCS1_CHECK_1: number; - const SSL_OP_PKCS1_CHECK_2: number; - /** Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. */ - const SSL_OP_SINGLE_DH_USE: number; - /** Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. */ - const SSL_OP_SINGLE_ECDH_USE: number; - const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; - const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; - const SSL_OP_TLS_BLOCK_PADDING_BUG: number; - const SSL_OP_TLS_D5_BUG: number; - /** Instructs OpenSSL to disable version rollback attack detection. */ - const SSL_OP_TLS_ROLLBACK_BUG: number; - - const ENGINE_METHOD_RSA: number; - const ENGINE_METHOD_DSA: number; - const ENGINE_METHOD_DH: number; - const ENGINE_METHOD_RAND: number; - const ENGINE_METHOD_EC: number; - const ENGINE_METHOD_CIPHERS: number; - const ENGINE_METHOD_DIGESTS: number; - const ENGINE_METHOD_PKEY_METHS: number; - const ENGINE_METHOD_PKEY_ASN1_METHS: number; - const ENGINE_METHOD_ALL: number; - const ENGINE_METHOD_NONE: number; - - const DH_CHECK_P_NOT_SAFE_PRIME: number; - const DH_CHECK_P_NOT_PRIME: number; - const DH_UNABLE_TO_CHECK_GENERATOR: number; - const DH_NOT_SUITABLE_GENERATOR: number; - - const ALPN_ENABLED: number; - - const RSA_PKCS1_PADDING: number; - const RSA_SSLV23_PADDING: number; - const RSA_NO_PADDING: number; - const RSA_PKCS1_OAEP_PADDING: number; - const RSA_X931_PADDING: number; - const RSA_PKCS1_PSS_PADDING: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ - const RSA_PSS_SALTLEN_DIGEST: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ - const RSA_PSS_SALTLEN_MAX_SIGN: number; - /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ - const RSA_PSS_SALTLEN_AUTO: number; - - const POINT_CONVERSION_COMPRESSED: number; - const POINT_CONVERSION_UNCOMPRESSED: number; - const POINT_CONVERSION_HYBRID: number; - - /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ - const defaultCoreCipherList: string; - /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ - const defaultCipherList: string; - } - - interface HashOptions extends stream.TransformOptions { - /** - * For XOF hash functions such as `shake256`, the - * outputLength option can be used to specify the desired output length in bytes. - */ - outputLength?: number; - } - - /** @deprecated since v10.0.0 */ - const fips: boolean; - - function createHash(algorithm: string, options?: HashOptions): Hash; - function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; - - type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1"; - type HexBase64Latin1Encoding = "latin1" | "hex" | "base64"; - type Utf8AsciiBinaryEncoding = "utf8" | "ascii" | "binary"; - type HexBase64BinaryEncoding = "binary" | "base64" | "hex"; - type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; - - class Hash extends stream.Transform { - private constructor(); - copy(): Hash; - update(data: BinaryLike): Hash; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash; - digest(): Buffer; - digest(encoding: HexBase64Latin1Encoding): string; - } - class Hmac extends stream.Transform { - private constructor(); - update(data: BinaryLike): Hmac; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac; - digest(): Buffer; - digest(encoding: HexBase64Latin1Encoding): string; - } - - type KeyObjectType = 'secret' | 'public' | 'private'; - - interface KeyExportOptions { - type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1'; - format: T; - cipher?: string; - passphrase?: string | Buffer; - } - - class KeyObject { - private constructor(); - asymmetricKeyType?: KeyType; - /** - * For asymmetric keys, this property represents the size of the embedded key in - * bytes. This property is `undefined` for symmetric keys. - */ - asymmetricKeySize?: number; - export(options: KeyExportOptions<'pem'>): string | Buffer; - export(options?: KeyExportOptions<'der'>): Buffer; - symmetricKeySize?: number; - type: KeyObjectType; - } - - type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305'; - type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm'; - - type BinaryLike = string | NodeJS.ArrayBufferView; - - type CipherKey = BinaryLike | KeyObject; - - interface CipherCCMOptions extends stream.TransformOptions { - authTagLength: number; - } - interface CipherGCMOptions extends stream.TransformOptions { - authTagLength?: number; - } - /** @deprecated since v10.0.0 use createCipheriv() */ - function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; - /** @deprecated since v10.0.0 use createCipheriv() */ - function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM; - /** @deprecated since v10.0.0 use createCipheriv() */ - function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher; - - function createCipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options: CipherCCMOptions - ): CipherCCM; - function createCipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options?: CipherGCMOptions - ): CipherGCM; - function createCipheriv( - algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions - ): Cipher; - - class Cipher extends stream.Transform { - private constructor(); - update(data: BinaryLike): Buffer; - update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer; - update(data: NodeJS.ArrayBufferView, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string; - update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string; - final(): Buffer; - final(output_encoding: string): string; - setAutoPadding(auto_padding?: boolean): this; - // getAuthTag(): Buffer; - // setAAD(buffer: Buffer): this; // docs only say buffer - } - interface CipherCCM extends Cipher { - setAAD(buffer: Buffer, options: { plaintextLength: number }): this; - getAuthTag(): Buffer; - } - interface CipherGCM extends Cipher { - setAAD(buffer: Buffer, options?: { plaintextLength: number }): this; - getAuthTag(): Buffer; - } - /** @deprecated since v10.0.0 use createDecipheriv() */ - function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; - /** @deprecated since v10.0.0 use createDecipheriv() */ - function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; - /** @deprecated since v10.0.0 use createDecipheriv() */ - function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; - - function createDecipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options: CipherCCMOptions, - ): DecipherCCM; - function createDecipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike | null, - options?: CipherGCMOptions, - ): DecipherGCM; - function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher; - - class Decipher extends stream.Transform { - private constructor(); - update(data: NodeJS.ArrayBufferView): Buffer; - update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer; - update(data: NodeJS.ArrayBufferView, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string; - update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string; - final(): Buffer; - final(output_encoding: string): string; - setAutoPadding(auto_padding?: boolean): this; - // setAuthTag(tag: NodeJS.ArrayBufferView): this; - // setAAD(buffer: NodeJS.ArrayBufferView): this; - } - interface DecipherCCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this; - } - interface DecipherGCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this; - } - - interface PrivateKeyInput { - key: string | Buffer; - format?: KeyFormat; - type?: 'pkcs1' | 'pkcs8' | 'sec1'; - passphrase?: string | Buffer; - } - - interface PublicKeyInput { - key: string | Buffer; - format?: KeyFormat; - type?: 'pkcs1' | 'spki'; - } - - function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject; - function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject; - function createSecretKey(key: Buffer): KeyObject; - - function createSign(algorithm: string, options?: stream.WritableOptions): Signer; - - interface SigningOptions { - /** - * @See crypto.constants.RSA_PKCS1_PADDING - */ - padding?: number; - saltLength?: number; - } - - interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions { - } - - type KeyLike = string | Buffer | KeyObject; - - class Signer extends stream.Writable { - private constructor(); - - update(data: BinaryLike): Signer; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: SignPrivateKeyInput | KeyLike): Buffer; - sign(private_key: SignPrivateKeyInput | KeyLike, output_format: HexBase64Latin1Encoding): string; - } - - function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; - class Verify extends stream.Writable { - private constructor(); - - update(data: BinaryLike): Verify; - update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify; - verify(object: object | KeyLike, signature: NodeJS.ArrayBufferView): boolean; - verify(object: object | KeyLike, signature: string, signature_format?: HexBase64Latin1Encoding): boolean; - // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format - // The signature field accepts a TypedArray type, but it is only available starting ES2017 - } - function createDiffieHellman(prime_length: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman; - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman; - class DiffieHellman { - private constructor(); - generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; - computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; - getPrime(): Buffer; - getPrime(encoding: HexBase64Latin1Encoding): string; - getGenerator(): Buffer; - getGenerator(encoding: HexBase64Latin1Encoding): string; - getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: HexBase64Latin1Encoding): string; - setPublicKey(public_key: NodeJS.ArrayBufferView): void; - setPublicKey(public_key: string, encoding: string): void; - setPrivateKey(private_key: NodeJS.ArrayBufferView): void; - setPrivateKey(private_key: string, encoding: string): void; - verifyError: number; - } - function getDiffieHellman(group_name: string): DiffieHellman; - function pbkdf2( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - callback: (err: Error | null, derivedKey: Buffer) => any, - ): void; - function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer; - - function randomBytes(size: number): Buffer; - function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - function pseudoRandomBytes(size: number): Buffer; - function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - - function randomFillSync(buffer: T, offset?: number, size?: number): T; - function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void; - function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void; - function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void; - - interface ScryptOptions { - N?: number; - r?: number; - p?: number; - maxmem?: number; - } - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - options: ScryptOptions, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; - - interface RsaPublicKey { - key: KeyLike; - padding?: number; - } - interface RsaPrivateKey { - key: KeyLike; - passphrase?: string; - /** - * @default 'sha1' - */ - oaepHash?: string; - oaepLabel?: NodeJS.TypedArray; - padding?: number; - } - function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - function getCiphers(): string[]; - function getCurves(): string[]; - function getFips(): 1 | 0; - function getHashes(): string[]; - class ECDH { - private constructor(); - static convertKey( - key: BinaryLike, - curve: string, - inputEncoding?: HexBase64Latin1Encoding, - outputEncoding?: "latin1" | "hex" | "base64", - format?: "uncompressed" | "compressed" | "hybrid", - ): Buffer | string; - generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; - computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; - computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string; - computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: HexBase64Latin1Encoding): string; - getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; - setPrivateKey(private_key: NodeJS.ArrayBufferView): void; - setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void; - } - function createECDH(curve_name: string): ECDH; - function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; - /** @deprecated since v10.0.0 */ - const DEFAULT_ENCODING: string; - - type KeyType = 'rsa' | 'dsa' | 'ec'; - type KeyFormat = 'pem' | 'der'; - - interface BasePrivateKeyEncodingOptions { - format: T; - cipher?: string; - passphrase?: string; - } - - interface KeyPairKeyObjectResult { - publicKey: KeyObject; - privateKey: KeyObject; - } - - interface ECKeyPairKeyObjectOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - } - - interface RSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - - /** - * @default 0x10001 - */ - publicExponent?: number; - } - - interface DSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - - /** - * Size of q in bits - */ - divisorLength: number; - } - - interface RSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * @default 0x10001 - */ - publicExponent?: number; - - publicKeyEncoding: { - type: 'pkcs1' | 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs1' | 'pkcs8'; - }; - } - - interface DSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - - publicKeyEncoding: { - type: 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'pkcs8'; - }; - } - - interface ECKeyPairOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - - publicKeyEncoding: { - type: 'pkcs1' | 'spki'; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: 'sec1' | 'pkcs8'; - }; - } - - interface KeyPairSyncResult { - publicKey: T1; - privateKey: T2; - } - - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult; - function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; - function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; - - namespace generateKeyPair { - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; - - function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; - function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; - function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; - } - - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been - * passed to [`crypto.createPrivateKey()`][]. - */ - function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignPrivateKeyInput): Buffer; - - interface VerifyKeyWithOptions extends KeyObject, SigningOptions { - } - - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been - * passed to [`crypto.createPublicKey()`][]. - */ - function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyWithOptions, signature: NodeJS.ArrayBufferView): boolean; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/dgram.d.ts b/node_modules/protobufjs/node_modules/@types/node/dgram.d.ts deleted file mode 100644 index 73f2aa71..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/dgram.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -declare module "dgram" { - import { AddressInfo } from "net"; - import * as dns from "dns"; - import * as events from "events"; - - interface RemoteInfo { - address: string; - family: 'IPv4' | 'IPv6'; - port: number; - size: number; - } - - interface BindOptions { - port?: number; - address?: string; - exclusive?: boolean; - fd?: number; - } - - type SocketType = "udp4" | "udp6"; - - interface SocketOptions { - type: SocketType; - reuseAddr?: boolean; - /** - * @default false - */ - ipv6Only?: boolean; - recvBufferSize?: number; - sendBufferSize?: number; - lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; - } - - function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - - class Socket extends events.EventEmitter { - addMembership(multicastAddress: string, multicastInterface?: string): void; - address(): AddressInfo; - bind(port?: number, address?: string, callback?: () => void): void; - bind(port?: number, callback?: () => void): void; - bind(callback?: () => void): void; - bind(options: BindOptions, callback?: () => void): void; - close(callback?: () => void): void; - connect(port: number, address?: string, callback?: () => void): void; - connect(port: number, callback: () => void): void; - disconnect(): void; - dropMembership(multicastAddress: string, multicastInterface?: string): void; - getRecvBufferSize(): number; - getSendBufferSize(): number; - ref(): this; - remoteAddress(): AddressInfo; - send(msg: string | Uint8Array | ReadonlyArray, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array | ReadonlyArray, port?: number, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array | ReadonlyArray, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void; - send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void; - setBroadcast(flag: boolean): void; - setMulticastInterface(multicastInterface: string): void; - setMulticastLoopback(flag: boolean): void; - setMulticastTTL(ttl: number): void; - setRecvBufferSize(size: number): void; - setSendBufferSize(size: number): void; - setTTL(ttl: number): void; - unref(): this; - /** - * Tells the kernel to join a source-specific multicast channel at the given - * `sourceAddress` and `groupAddress`, using the `multicastInterface` with the - * `IP_ADD_SOURCE_MEMBERSHIP` socket option. - * If the `multicastInterface` argument - * is not specified, the operating system will choose one interface and will add - * membership to it. - * To add membership to every available interface, call - * `socket.addSourceSpecificMembership()` multiple times, once per interface. - */ - addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - - /** - * Instructs the kernel to leave a source-specific multicast channel at the given - * `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` - * socket option. This method is automatically called by the kernel when the - * socket is closed or the process terminates, so most apps will never have - * reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - */ - dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. error - * 4. listening - * 5. message - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/dns.d.ts b/node_modules/protobufjs/node_modules/@types/node/dns.d.ts deleted file mode 100644 index 32cba611..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/dns.d.ts +++ /dev/null @@ -1,371 +0,0 @@ -declare module "dns" { - // Supported getaddrinfo flags. - const ADDRCONFIG: number; - const V4MAPPED: number; - /** - * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as - * well as IPv4 mapped IPv6 addresses. - */ - const ALL: number; - - interface LookupOptions { - family?: number; - hints?: number; - all?: boolean; - verbatim?: boolean; - } - - interface LookupOneOptions extends LookupOptions { - all?: false; - } - - interface LookupAllOptions extends LookupOptions { - all: true; - } - - interface LookupAddress { - address: string; - family: number; - } - - function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; - function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; - function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lookup { - function __promisify__(hostname: string, options: LookupAllOptions): Promise; - function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; - function __promisify__(hostname: string, options: LookupOptions): Promise; - } - - function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; - - namespace lookupService { - function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; - } - - interface ResolveOptions { - ttl: boolean; - } - - interface ResolveWithTtlOptions extends ResolveOptions { - ttl: true; - } - - interface RecordWithTtl { - address: string; - ttl: number; - } - - /** @deprecated Use AnyARecord or AnyAaaaRecord instead. */ - type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; - - interface AnyARecord extends RecordWithTtl { - type: "A"; - } - - interface AnyAaaaRecord extends RecordWithTtl { - type: "AAAA"; - } - - interface MxRecord { - priority: number; - exchange: string; - } - - interface AnyMxRecord extends MxRecord { - type: "MX"; - } - - interface NaptrRecord { - flags: string; - service: string; - regexp: string; - replacement: string; - order: number; - preference: number; - } - - interface AnyNaptrRecord extends NaptrRecord { - type: "NAPTR"; - } - - interface SoaRecord { - nsname: string; - hostmaster: string; - serial: number; - refresh: number; - retry: number; - expire: number; - minttl: number; - } - - interface AnySoaRecord extends SoaRecord { - type: "SOA"; - } - - interface SrvRecord { - priority: number; - weight: number; - port: number; - name: string; - } - - interface AnySrvRecord extends SrvRecord { - type: "SRV"; - } - - interface AnyTxtRecord { - type: "TXT"; - entries: string[]; - } - - interface AnyNsRecord { - type: "NS"; - value: string; - } - - interface AnyPtrRecord { - type: "PTR"; - value: string; - } - - interface AnyCnameRecord { - type: "CNAME"; - value: string; - } - - type AnyRecord = AnyARecord | - AnyAaaaRecord | - AnyCnameRecord | - AnyMxRecord | - AnyNaptrRecord | - AnyNsRecord | - AnyPtrRecord | - AnySoaRecord | - AnySrvRecord | - AnyTxtRecord; - - function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; - function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; - function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; - function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; - function resolve( - hostname: string, - rrtype: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, - ): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve { - function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - function __promisify__(hostname: string, rrtype: "ANY"): Promise; - function __promisify__(hostname: string, rrtype: "MX"): Promise; - function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; - function __promisify__(hostname: string, rrtype: "SOA"): Promise; - function __promisify__(hostname: string, rrtype: "SRV"): Promise; - function __promisify__(hostname: string, rrtype: "TXT"): Promise; - function __promisify__(hostname: string, rrtype: string): Promise; - } - - function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; - function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve4 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - - function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; - function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace resolve6 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - - function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolveCname { - function __promisify__(hostname: string): Promise; - } - - function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; - namespace resolveMx { - function __promisify__(hostname: string): Promise; - } - - function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; - namespace resolveNaptr { - function __promisify__(hostname: string): Promise; - } - - function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolveNs { - function __promisify__(hostname: string): Promise; - } - - function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; - namespace resolvePtr { - function __promisify__(hostname: string): Promise; - } - - function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; - namespace resolveSoa { - function __promisify__(hostname: string): Promise; - } - - function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; - namespace resolveSrv { - function __promisify__(hostname: string): Promise; - } - - function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; - namespace resolveTxt { - function __promisify__(hostname: string): Promise; - } - - function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; - namespace resolveAny { - function __promisify__(hostname: string): Promise; - } - - function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; - function setServers(servers: ReadonlyArray): void; - function getServers(): string[]; - - // Error codes - const NODATA: string; - const FORMERR: string; - const SERVFAIL: string; - const NOTFOUND: string; - const NOTIMP: string; - const REFUSED: string; - const BADQUERY: string; - const BADNAME: string; - const BADFAMILY: string; - const BADRESP: string; - const CONNREFUSED: string; - const TIMEOUT: string; - const EOF: string; - const FILE: string; - const NOMEM: string; - const DESTRUCTION: string; - const BADSTR: string; - const BADFLAGS: string; - const NONAME: string; - const BADHINTS: string; - const NOTINITIALIZED: string; - const LOADIPHLPAPI: string; - const ADDRGETNETWORKPARAMS: string; - const CANCELLED: string; - - class Resolver { - getServers: typeof getServers; - setServers: typeof setServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - cancel(): void; - } - - namespace promises { - function getServers(): string[]; - - function lookup(hostname: string, family: number): Promise; - function lookup(hostname: string, options: LookupOneOptions): Promise; - function lookup(hostname: string, options: LookupAllOptions): Promise; - function lookup(hostname: string, options: LookupOptions): Promise; - function lookup(hostname: string): Promise; - - function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>; - - function resolve(hostname: string): Promise; - function resolve(hostname: string, rrtype: "A"): Promise; - function resolve(hostname: string, rrtype: "AAAA"): Promise; - function resolve(hostname: string, rrtype: "ANY"): Promise; - function resolve(hostname: string, rrtype: "CNAME"): Promise; - function resolve(hostname: string, rrtype: "MX"): Promise; - function resolve(hostname: string, rrtype: "NAPTR"): Promise; - function resolve(hostname: string, rrtype: "NS"): Promise; - function resolve(hostname: string, rrtype: "PTR"): Promise; - function resolve(hostname: string, rrtype: "SOA"): Promise; - function resolve(hostname: string, rrtype: "SRV"): Promise; - function resolve(hostname: string, rrtype: "TXT"): Promise; - function resolve(hostname: string, rrtype: string): Promise; - - function resolve4(hostname: string): Promise; - function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve4(hostname: string, options: ResolveOptions): Promise; - - function resolve6(hostname: string): Promise; - function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve6(hostname: string, options: ResolveOptions): Promise; - - function resolveAny(hostname: string): Promise; - - function resolveCname(hostname: string): Promise; - - function resolveMx(hostname: string): Promise; - - function resolveNaptr(hostname: string): Promise; - - function resolveNs(hostname: string): Promise; - - function resolvePtr(hostname: string): Promise; - - function resolveSoa(hostname: string): Promise; - - function resolveSrv(hostname: string): Promise; - - function resolveTxt(hostname: string): Promise; - - function reverse(ip: string): Promise; - - function setServers(servers: ReadonlyArray): void; - - class Resolver { - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - setServers: typeof setServers; - } - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/domain.d.ts b/node_modules/protobufjs/node_modules/@types/node/domain.d.ts deleted file mode 100644 index c7fa9b85..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/domain.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module "domain" { - import { EventEmitter } from "events"; - - class Domain extends EventEmitter implements NodeJS.Domain { - run(fn: (...args: any[]) => T, ...args: any[]): T; - add(emitter: EventEmitter | NodeJS.Timer): void; - remove(emitter: EventEmitter | NodeJS.Timer): void; - bind(cb: T): T; - intercept(cb: T): T; - members: Array; - enter(): void; - exit(): void; - } - - function create(): Domain; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/events.d.ts b/node_modules/protobufjs/node_modules/@types/node/events.d.ts deleted file mode 100644 index b07defc0..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/events.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -declare module "events" { - interface EventEmitterOptions { - /** - * Enables automatic capturing of promise rejection. - */ - captureRejections?: boolean; - } - - interface NodeEventTarget { - once(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface DOMEventTarget { - addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any; - } - - namespace EventEmitter { - function once(emitter: NodeEventTarget, event: string | symbol): Promise; - function once(emitter: DOMEventTarget, event: string): Promise; - function on(emitter: EventEmitter, event: string): AsyncIterableIterator; - const captureRejectionSymbol: unique symbol; - - /** - * This symbol shall be used to install a listener for only monitoring `'error'` - * events. Listeners installed using this symbol are called before the regular - * `'error'` listeners are called. - * - * Installing a listener using this symbol does not change the behavior once an - * `'error'` event is emitted, therefore the process will still crash if no - * regular `'error'` listener is installed. - */ - const errorMonitor: unique symbol; - /** - * Sets or gets the default captureRejection value for all emitters. - */ - let captureRejections: boolean; - - interface EventEmitter extends NodeJS.EventEmitter { - } - - class EventEmitter { - constructor(options?: EventEmitterOptions); - /** @deprecated since v4.0.0 */ - static listenerCount(emitter: EventEmitter, event: string | symbol): number; - static defaultMaxListeners: number; - } - } - - export = EventEmitter; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/fs.d.ts b/node_modules/protobufjs/node_modules/@types/node/fs.d.ts deleted file mode 100644 index c81c5fdd..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/fs.d.ts +++ /dev/null @@ -1,2665 +0,0 @@ -declare module "fs" { - import * as stream from "stream"; - import * as events from "events"; - import { URL } from "url"; - - /** - * Valid types for path values in "fs". - */ - type PathLike = string | Buffer | URL; - - type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; - - interface StatsBase { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - - dev: T; - ino: T; - mode: T; - nlink: T; - uid: T; - gid: T; - rdev: T; - size: T; - blksize: T; - blocks: T; - atimeMs: T; - mtimeMs: T; - ctimeMs: T; - birthtimeMs: T; - atime: Date; - mtime: Date; - ctime: Date; - birthtime: Date; - } - - interface Stats extends StatsBase { - } - - class Stats { - } - - class Dirent { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - name: string; - } - - /** - * A class representing a directory stream. - */ - class Dir { - readonly path: string; - - /** - * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. - */ - [Symbol.asyncIterator](): AsyncIterableIterator; - - /** - * Asynchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - */ - close(): Promise; - close(cb: NoParamCallback): void; - - /** - * Synchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - */ - closeSync(): void; - - /** - * Asynchronously read the next directory entry via `readdir(3)` as an `Dirent`. - * After the read is completed, a value is returned that will be resolved with an `Dirent`, or `null` if there are no more directory entries to read. - * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. - */ - read(): Promise; - read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; - - /** - * Synchronously read the next directory entry via `readdir(3)` as a `Dirent`. - * If there are no more directory entries to read, null will be returned. - * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. - */ - readSync(): Dirent; - } - - interface FSWatcher extends events.EventEmitter { - close(): void; - - /** - * events.EventEmitter - * 1. change - * 2. error - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "close", listener: () => void): this; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "close", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "close", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "close", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - } - - class ReadStream extends stream.Readable { - close(): void; - bytesRead: number; - path: string | Buffer; - pending: boolean; - - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "ready", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "ready", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - class WriteStream extends stream.Writable { - close(): void; - bytesWritten: number; - path: string | Buffer; - pending: boolean; - - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "ready", listener: () => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "ready", listener: () => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace rename { - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; - } - - /** - * Synchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function renameSync(oldPath: PathLike, newPath: PathLike): void; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function truncate(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace truncate { - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(path: PathLike, len?: number | null): Promise; - } - - /** - * Synchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncateSync(path: PathLike, len?: number | null): void; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - */ - function ftruncate(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace ftruncate { - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(fd: number, len?: number | null): Promise; - } - - /** - * Synchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function ftruncateSync(fd: number, len?: number | null): void; - - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace chown { - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - - /** - * Synchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chownSync(path: PathLike, uid: number, gid: number): void; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fchown { - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function __promisify__(fd: number, uid: number, gid: number): Promise; - } - - /** - * Synchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function fchownSync(fd: number, uid: number, gid: number): void; - - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lchown { - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - - /** - * Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchownSync(path: PathLike, uid: number, gid: number): void; - - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmod(path: PathLike, mode: string | number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace chmod { - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: string | number): Promise; - } - - /** - * Synchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmodSync(path: PathLike, mode: string | number): void; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmod(fd: number, mode: string | number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fchmod { - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(fd: number, mode: string | number): Promise; - } - - /** - * Synchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmodSync(fd: number, mode: string | number): void; - - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmod(path: PathLike, mode: string | number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lchmod { - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: string | number): Promise; - } - - /** - * Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmodSync(path: PathLike, mode: string | number): void; - - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function stat(path: PathLike, options: BigIntOptions, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void; - function stat(path: PathLike, options: StatOptions, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; - function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace stat { - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options: BigIntOptions): Promise; - function __promisify__(path: PathLike, options: StatOptions): Promise; - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function statSync(path: PathLike, options: BigIntOptions): BigIntStats; - function statSync(path: PathLike, options: StatOptions): Stats | BigIntStats; - function statSync(path: PathLike): Stats; - - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fstat { - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function fstatSync(fd: number): Stats; - - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace lstat { - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstatSync(path: PathLike): Stats; - - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace link { - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; - } - - /** - * Synchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function linkSync(existingPath: PathLike, newPath: PathLike): void; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - */ - function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace symlink { - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; - - type Type = "dir" | "file" | "junction"; - } - - /** - * Synchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink( - path: PathLike, - options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void - ): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace readlink { - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - } - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlinkSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlinkSync(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer; - - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlinkSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath( - path: PathLike, - options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void - ): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace realpath { - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - function native( - path: PathLike, - options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void - ): void; - function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; - function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; - function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; - } - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpathSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpathSync(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer; - - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpathSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer; - - namespace realpathSync { - function native(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - function native(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer; - function native(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer; - } - - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlink(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace unlink { - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlinkSync(path: PathLike): void; - - interface RmDirOptions { - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number; - /** - * If `true`, perform a recursive directory removal. In - * recursive mode, errors are not reported if `path` does not exist, and - * operations are retried on failure. - * @experimental - * @default false - */ - recursive?: boolean; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number; - } - - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdir(path: PathLike, callback: NoParamCallback): void; - function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace rmdir { - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options?: RmDirOptions): Promise; - } - - /** - * Synchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdirSync(path: PathLike, options?: RmDirOptions): void; - - interface MakeDirectoryOptions { - /** - * Indicates whether parent folders should be created. - * If a folder was created, the path to the first created folder will be returned. - * @default false - */ - recursive?: boolean; - /** - * A file mode. If a string is passed, it is parsed as an octal integer. If not specified - * @default 0o777 - */ - mode?: number | string; - } - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path: string) => void): void; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null | undefined, callback: NoParamCallback): void; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path: string | undefined) => void): void; - - /** - * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function mkdir(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace mkdir { - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise; - } - - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string; - - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdirSync(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): void; - - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdirSync(path: PathLike, options?: number | string | MakeDirectoryOptions | null): string | undefined; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - */ - function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace mkdtemp { - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: { encoding?: string | null } | string | null): Promise; - } - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtempSync(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string; - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtempSync(prefix: string, options: { encoding: "buffer" } | "buffer"): Buffer; - - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtempSync(prefix: string, options?: { encoding?: string | null } | string | null): string | Buffer; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null, - callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, - ): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace readdir { - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent - */ - function __promisify__(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise; - } - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdirSync(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): string[] | Buffer[]; - - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdirSync(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Dirent[]; - - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function close(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace close { - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function closeSync(fd: number): void; - - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace open { - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function __promisify__(path: PathLike, flags: string | number, mode?: string | number | null): Promise; - } - - /** - * Synchronous open(2) - open and possibly create a file, returning a file descriptor.. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function openSync(path: PathLike, flags: string | number, mode?: string | number | null): number; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace utimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Synchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace futimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(fd: number, atime: string | number | Date, mtime: string | number | Date): Promise; - } - - /** - * Synchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function fsync(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fsync { - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function fsyncSync(fd: number): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - */ - function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - */ - function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void - ): void; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - */ - function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function write( - fd: number, - string: any, - position: number | undefined | null, - encoding: string | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - */ - function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace write { - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function __promisify__( - fd: number, - buffer?: TBuffer, - offset?: number, - length?: number, - position?: number | null, - ): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function __promisify__(fd: number, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; - } - - /** - * Synchronously writes `buffer` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number; - - /** - * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function writeSync(fd: number, string: any, position?: number | null, encoding?: string | null): number; - - /** - * Asynchronously reads data from the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace read { - /** - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function __promisify__( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null - ): Promise<{ bytesRead: number, buffer: TBuffer }>; - } - - interface ReadSyncOptions { - /** - * @default 0 - */ - offset?: number; - /** - * @default `length of buffer` - */ - length?: number; - /** - * @default null - */ - position?: number | null; - } - - /** - * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read. - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number; - - /** - * Similar to the above `fs.readSync` function, this version takes an optional `options` object. - * If no `options` object is specified, it will default with the above values. - */ - function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | number, - options: { encoding?: string | null; flag?: string; } | string | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, - ): void; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - */ - function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace readFile { - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options: { encoding: string; flag?: string; } | string): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): Promise; - } - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`. - */ - function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer; - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFileSync(path: PathLike | number, options: { encoding: string; flag?: string; } | string): string; - - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFileSync(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): string | Buffer; - - type WriteFileOptions = { encoding?: string | null; mode?: number | string; flag?: string; } | string | null; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback): void; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - function writeFile(path: PathLike | number, data: any, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace writeFile { - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function __promisify__(path: PathLike | number, data: any, options?: WriteFileOptions): Promise; - } - - /** - * Synchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFileSync(path: PathLike | number, data: any, options?: WriteFileOptions): void; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback): void; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - function appendFile(file: PathLike | number, data: any, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace appendFile { - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function __promisify__(file: PathLike | number, data: any, options?: WriteFileOptions): Promise; - } - - /** - * Synchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFileSync(file: PathLike | number, data: any, options?: WriteFileOptions): void; - - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - */ - function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void; - - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void; - - /** - * Stop watching for changes on `filename`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch( - filename: PathLike, - options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null, - listener?: (event: string, filename: string) => void, - ): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch(filename: PathLike, options: { encoding: "buffer", persistent?: boolean, recursive?: boolean } | "buffer", listener?: (event: string, filename: Buffer) => void): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch( - filename: PathLike, - options: { encoding?: string | null, persistent?: boolean, recursive?: boolean } | string | null, - listener?: (event: string, filename: string | Buffer) => void, - ): FSWatcher; - - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function watch(filename: PathLike, listener?: (event: string, filename: string) => any): FSWatcher; - - /** - * Asynchronously tests whether or not the given path exists by checking with the file system. - * @deprecated - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function exists(path: PathLike, callback: (exists: boolean) => void): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace exists { - /** - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike): Promise; - } - - /** - * Synchronously tests whether or not the given path exists by checking with the file system. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function existsSync(path: PathLike): boolean; - - namespace constants { - // File Access Constants - - /** Constant for fs.access(). File is visible to the calling process. */ - const F_OK: number; - - /** Constant for fs.access(). File can be read by the calling process. */ - const R_OK: number; - - /** Constant for fs.access(). File can be written by the calling process. */ - const W_OK: number; - - /** Constant for fs.access(). File can be executed by the calling process. */ - const X_OK: number; - - // File Copy Constants - - /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ - const COPYFILE_EXCL: number; - - /** - * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. - */ - const COPYFILE_FICLONE: number; - - /** - * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then the operation will fail with an error. - */ - const COPYFILE_FICLONE_FORCE: number; - - // File Open Constants - - /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ - const O_RDONLY: number; - - /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ - const O_WRONLY: number; - - /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ - const O_RDWR: number; - - /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ - const O_CREAT: number; - - /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ - const O_EXCL: number; - - /** - * Constant for fs.open(). Flag indicating that if path identifies a terminal device, - * opening the path shall not cause that terminal to become the controlling terminal for the process - * (if the process does not already have one). - */ - const O_NOCTTY: number; - - /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ - const O_TRUNC: number; - - /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ - const O_APPEND: number; - - /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ - const O_DIRECTORY: number; - - /** - * constant for fs.open(). - * Flag indicating reading accesses to the file system will no longer result in - * an update to the atime information associated with the file. - * This flag is available on Linux operating systems only. - */ - const O_NOATIME: number; - - /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ - const O_NOFOLLOW: number; - - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ - const O_SYNC: number; - - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ - const O_DSYNC: number; - - /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ - const O_SYMLINK: number; - - /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ - const O_DIRECT: number; - - /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ - const O_NONBLOCK: number; - - // File Type Constants - - /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ - const S_IFMT: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ - const S_IFREG: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ - const S_IFDIR: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ - const S_IFCHR: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ - const S_IFBLK: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ - const S_IFIFO: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ - const S_IFLNK: number; - - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ - const S_IFSOCK: number; - - // File Mode Constants - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ - const S_IRWXU: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ - const S_IRUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ - const S_IWUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ - const S_IXUSR: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ - const S_IRWXG: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ - const S_IRGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ - const S_IWGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ - const S_IXGRP: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ - const S_IRWXO: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ - const S_IROTH: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ - const S_IWOTH: number; - - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ - const S_IXOTH: number; - - /** - * When set, a memory file mapping is used to access the file. This flag - * is available on Windows operating systems only. On other operating systems, - * this flag is ignored. - */ - const UV_FS_O_FILEMAP: number; - } - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace access { - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike, mode?: number): Promise; - } - - /** - * Synchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function accessSync(path: PathLike, mode?: number): void; - - /** - * Returns a new `ReadStream` object. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function createReadStream(path: PathLike, options?: string | { - flags?: string; - encoding?: string; - fd?: number; - mode?: number; - autoClose?: boolean; - /** - * @default false - */ - emitClose?: boolean; - start?: number; - end?: number; - highWaterMark?: number; - }): ReadStream; - - /** - * Returns a new `WriteStream` object. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function createWriteStream(path: PathLike, options?: string | { - flags?: string; - encoding?: string; - fd?: number; - mode?: number; - autoClose?: boolean; - emitClose?: boolean; - start?: number; - highWaterMark?: number; - }): WriteStream; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function fdatasync(fd: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace fdatasync { - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - - /** - * Synchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function fdatasyncSync(fd: number): void; - - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - */ - function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. - */ - function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): void; - - // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. - namespace copyFile { - /** - * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. - * No arguments other than a possible exception are given to the callback function. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. - * The only supported flag is fs.constants.COPYFILE_EXCL, - * which causes the copy operation to fail if dest already exists. - */ - function __promisify__(src: PathLike, dst: PathLike, flags?: number): Promise; - } - - /** - * Synchronously copies src to dest. By default, dest is overwritten if it already exists. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. - * The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. - */ - function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void; - - /** - * Write an array of ArrayBufferViews to the file specified by fd using writev(). - * position is the offset from the beginning of the file where this data should be written. - * It is unsafe to use fs.writev() multiple times on the same file without waiting for the callback. For this scenario, use fs.createWriteStream(). - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to the end of the file. - */ - function writev( - fd: number, - buffers: ReadonlyArray, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - function writev( - fd: number, - buffers: ReadonlyArray, - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - - interface WriteVResult { - bytesWritten: number; - buffers: NodeJS.ArrayBufferView[]; - } - - namespace writev { - function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; - } - - /** - * See `writev`. - */ - function writevSync(fd: number, buffers: ReadonlyArray, position?: number): number; - - function readv( - fd: number, - buffers: ReadonlyArray, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - function readv( - fd: number, - buffers: ReadonlyArray, - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void - ): void; - - interface ReadVResult { - bytesRead: number; - buffers: NodeJS.ArrayBufferView[]; - } - - namespace readv { - function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; - } - - /** - * See `readv`. - */ - function readvSync(fd: number, buffers: ReadonlyArray, position?: number): number; - - interface OpenDirOptions { - encoding?: BufferEncoding; - /** - * Number of directory entries that are buffered - * internally when reading from the directory. Higher values lead to better - * performance but higher memory usage. - * @default 32 - */ - bufferSize?: number; - } - - function opendirSync(path: string, options?: OpenDirOptions): Dir; - - function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - - namespace opendir { - function __promisify__(path: string, options?: OpenDirOptions): Promise; - } - - namespace promises { - interface FileHandle { - /** - * Gets the file descriptor for this file handle. - */ - readonly fd: number; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for appending. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - */ - chown(uid: number, gid: number): Promise; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - chmod(mode: string | number): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - */ - datasync(): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - */ - sync(): Promise; - - /** - * Asynchronously reads data from the file. - * The `FileHandle` must have been opened for reading. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - read(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: { encoding?: null, flag?: string | number } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - */ - stat(): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param len If not specified, defaults to `0`. - */ - truncate(len?: number): Promise; - - /** - * Asynchronously change file timestamps of the file. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - utimes(atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously writes `buffer` to the file. - * The `FileHandle` must have been opened for writing. - * @param buffer The buffer that the data will be written to. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - write(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * See `fs.writev` promisified version. - */ - writev(buffers: ReadonlyArray, position?: number): Promise; - - /** - * See `fs.readv` promisified version. - */ - readv(buffers: ReadonlyArray, position?: number): Promise; - - /** - * Asynchronous close(2) - close a `FileHandle`. - */ - close(): Promise; - } - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, mode?: number): Promise; - - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. The only - * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if - * `dest` already exists. - */ - function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise; - - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not - * supplied, defaults to `0o666`. - */ - function open(path: PathLike, flags: string | number, mode?: string | number): Promise; - - /** - * Asynchronously reads data from the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If - * `null`, data will be read from the current position. - */ - function read( - handle: FileHandle, - buffer: TBuffer, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise<{ bytesRead: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write( - handle: FileHandle, - buffer: TBuffer, - offset?: number | null, - length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` - * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; - - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function rename(oldPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncate(path: PathLike, len?: number): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param handle A `FileHandle`. - * @param len If not specified, defaults to `0`. - */ - function ftruncate(handle: FileHandle, len?: number): Promise; - - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdir(path: PathLike, options?: RmDirOptions): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param handle A `FileHandle`. - */ - function fdatasync(handle: FileHandle): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param handle A `FileHandle`. - */ - function fsync(handle: FileHandle): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - * @param handle A `FileHandle`. - */ - function fstat(handle: FileHandle): Promise; - - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstat(path: PathLike): Promise; - - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function stat(path: PathLike): Promise; - - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function link(existingPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlink(path: PathLike): Promise; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param handle A `FileHandle`. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmod(handle: FileHandle, mode: string | number): Promise; - - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmod(path: PathLike, mode: string | number): Promise; - - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmod(path: PathLike, mode: string | number): Promise; - - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param handle A `FileHandle`. - */ - function fchown(handle: FileHandle, uid: number, gid: number): Promise; - - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; - - function opendir(path: string, options?: OpenDirOptions): Promise; - } - - interface BigIntStats extends StatsBase { - } - - class BigIntStats { - atimeNs: bigint; - mtimeNs: bigint; - ctimeNs: bigint; - birthtimeNs: bigint; - } - - interface BigIntOptions { - bigint: true; - } - - interface StatOptions { - bigint: boolean; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/globals.d.ts b/node_modules/protobufjs/node_modules/@types/node/globals.d.ts deleted file mode 100644 index b45bbf35..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/globals.d.ts +++ /dev/null @@ -1,1147 +0,0 @@ -// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build -interface Console { - Console: NodeJS.ConsoleConstructor; - /** - * A simple assertion test that verifies whether `value` is truthy. - * If it is not, an `AssertionError` is thrown. - * If provided, the error `message` is formatted using `util.format()` and used as the error message. - */ - assert(value: any, message?: string, ...optionalParams: any[]): void; - /** - * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY. - * When `stdout` is not a TTY, this method does nothing. - */ - clear(): void; - /** - * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`. - */ - count(label?: string): void; - /** - * Resets the internal counter specific to `label`. - */ - countReset(label?: string): void; - /** - * The `console.debug()` function is an alias for {@link console.log()}. - */ - debug(message?: any, ...optionalParams: any[]): void; - /** - * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`. - * This function bypasses any custom `inspect()` function defined on `obj`. - */ - dir(obj: any, options?: NodeJS.InspectOptions): void; - /** - * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting - */ - dirxml(...data: any[]): void; - /** - * Prints to `stderr` with newline. - */ - error(message?: any, ...optionalParams: any[]): void; - /** - * Increases indentation of subsequent lines by two spaces. - * If one or more `label`s are provided, those are printed first without the additional indentation. - */ - group(...label: any[]): void; - /** - * The `console.groupCollapsed()` function is an alias for {@link console.group()}. - */ - groupCollapsed(...label: any[]): void; - /** - * Decreases indentation of subsequent lines by two spaces. - */ - groupEnd(): void; - /** - * The {@link console.info()} function is an alias for {@link console.log()}. - */ - info(message?: any, ...optionalParams: any[]): void; - /** - * Prints to `stdout` with newline. - */ - log(message?: any, ...optionalParams: any[]): void; - /** - * This method does not display anything unless used in the inspector. - * Prints to `stdout` the array `array` formatted as a table. - */ - table(tabularData: any, properties?: ReadonlyArray): void; - /** - * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`. - */ - time(label?: string): void; - /** - * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`. - */ - timeEnd(label?: string): void; - /** - * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`. - */ - timeLog(label?: string, ...data: any[]): void; - /** - * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code. - */ - trace(message?: any, ...optionalParams: any[]): void; - /** - * The {@link console.warn()} function is an alias for {@link console.error()}. - */ - warn(message?: any, ...optionalParams: any[]): void; - - // --- Inspector mode only --- - /** - * This method does not display anything unless used in the inspector. - * Starts a JavaScript CPU profile with an optional label. - */ - profile(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. - */ - profileEnd(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Adds an event with the label `label` to the Timeline panel of the inspector. - */ - timeStamp(label?: string): void; -} - -// Declare "static" methods in Error -interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces - */ - prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any; - - stackTraceLimit: number; -} - -// Node.js ESNEXT support -interface String { - /** Removes whitespace from the left end of a string. */ - trimLeft(): string; - /** Removes whitespace from the right end of a string. */ - trimRight(): string; - - /** Returns a copy with leading whitespace removed. */ - trimStart(): string; - /** Returns a copy with trailing whitespace removed. */ - trimEnd(): string; -} - -interface ImportMeta { - url: string; -} - -/*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ - -// For backwards compability -interface NodeRequire extends NodeJS.Require {} -interface RequireResolve extends NodeJS.RequireResolve {} -interface NodeModule extends NodeJS.Module {} - -declare var process: NodeJS.Process; -declare var console: Console; - -declare var __filename: string; -declare var __dirname: string; - -declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; -declare namespace setTimeout { - function __promisify__(ms: number): Promise; - function __promisify__(ms: number, value: T): Promise; -} -declare function clearTimeout(timeoutId: NodeJS.Timeout): void; -declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; -declare function clearInterval(intervalId: NodeJS.Timeout): void; -declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; -declare namespace setImmediate { - function __promisify__(): Promise; - function __promisify__(value: T): Promise; -} -declare function clearImmediate(immediateId: NodeJS.Immediate): void; - -declare function queueMicrotask(callback: () => void): void; - -declare var require: NodeRequire; -declare var module: NodeModule; - -// Same as module.exports -declare var exports: any; - -// Buffer class -type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; - -/** - * Raw data is stored in instances of the Buffer class. - * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. - * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - */ -declare class Buffer extends Uint8Array { - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. - */ - constructor(str: string, encoding?: BufferEncoding); - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). - */ - constructor(size: number); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - constructor(array: Uint8Array); - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}/{SharedArrayBuffer}. - * - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. - */ - constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - constructor(array: ReadonlyArray); - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. - */ - constructor(buffer: Buffer); - /** - * When passed a reference to the .buffer property of a TypedArray instance, - * the newly created Buffer will share the same allocated memory as the TypedArray. - * The optional {byteOffset} and {length} arguments specify a memory range - * within the {arrayBuffer} that will be shared by the Buffer. - * - * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer() - */ - static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param data data to create a new Buffer - */ - static from(data: ReadonlyArray): Buffer; - static from(data: Uint8Array): Buffer; - /** - * Creates a new buffer containing the coerced value of an object - * A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants. - * @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`. - */ - static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - */ - static from(str: string, encoding?: BufferEncoding): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param values to create a new Buffer - */ - static of(...items: number[]): Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - static isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - static isEncoding(encoding: string): encoding is BufferEncoding; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - static byteLength( - string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, - encoding?: BufferEncoding - ): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - static concat(list: ReadonlyArray, totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - static compare(buf1: Uint8Array, buf2: Uint8Array): number; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @param fill if specified, buffer will be initialized by calling buf.fill(fill). - * If parameter is omitted, buffer will be filled with zeros. - * @param encoding encoding used for call to buf.fill while initalizing - */ - static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafe(size: number): Buffer; - /** - * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafeSlow(size: number): Buffer; - /** - * This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified. - */ - static poolSize: number; - - write(string: string, encoding?: BufferEncoding): number; - write(string: string, offset: number, encoding?: BufferEncoding): number; - write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; - toString(encoding?: string, start?: number, end?: number): string; - toJSON(): { type: 'Buffer'; data: number[] }; - equals(otherBuffer: Uint8Array): boolean; - compare( - otherBuffer: Uint8Array, - targetStart?: number, - targetEnd?: number, - sourceStart?: number, - sourceEnd?: number - ): number; - copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - /** - * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices. - * - * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory. - * - * @param begin Where the new `Buffer` will start. Default: `0`. - * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`. - */ - slice(begin?: number, end?: number): Buffer; - /** - * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices. - * - * This method is compatible with `Uint8Array#subarray()`. - * - * @param begin Where the new `Buffer` will start. Default: `0`. - * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`. - */ - subarray(begin?: number, end?: number): Buffer; - writeUIntLE(value: number, offset: number, byteLength: number): number; - writeUIntBE(value: number, offset: number, byteLength: number): number; - writeIntLE(value: number, offset: number, byteLength: number): number; - writeIntBE(value: number, offset: number, byteLength: number): number; - readUIntLE(offset: number, byteLength: number): number; - readUIntBE(offset: number, byteLength: number): number; - readIntLE(offset: number, byteLength: number): number; - readIntBE(offset: number, byteLength: number): number; - readUInt8(offset?: number): number; - readUInt16LE(offset?: number): number; - readUInt16BE(offset?: number): number; - readUInt32LE(offset?: number): number; - readUInt32BE(offset?: number): number; - readInt8(offset?: number): number; - readInt16LE(offset?: number): number; - readInt16BE(offset?: number): number; - readInt32LE(offset?: number): number; - readInt32BE(offset?: number): number; - readFloatLE(offset?: number): number; - readFloatBE(offset?: number): number; - readDoubleLE(offset?: number): number; - readDoubleBE(offset?: number): number; - reverse(): this; - swap16(): Buffer; - swap32(): Buffer; - swap64(): Buffer; - writeUInt8(value: number, offset?: number): number; - writeUInt16LE(value: number, offset?: number): number; - writeUInt16BE(value: number, offset?: number): number; - writeUInt32LE(value: number, offset?: number): number; - writeUInt32BE(value: number, offset?: number): number; - writeInt8(value: number, offset?: number): number; - writeInt16LE(value: number, offset?: number): number; - writeInt16BE(value: number, offset?: number): number; - writeInt32LE(value: number, offset?: number): number; - writeInt32BE(value: number, offset?: number): number; - writeFloatLE(value: number, offset?: number): number; - writeFloatBE(value: number, offset?: number): number; - writeDoubleLE(value: number, offset?: number): number; - writeDoubleBE(value: number, offset?: number): number; - - fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; - - indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - entries(): IterableIterator<[number, number]>; - includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface Buffer extends Uint8Array { - readBigUInt64BE(offset?: number): bigint; - readBigUInt64LE(offset?: number): bigint; - readBigInt64BE(offset?: number): bigint; - readBigInt64LE(offset?: number): bigint; - writeBigInt64BE(value: bigint, offset?: number): number; - writeBigInt64LE(value: bigint, offset?: number): number; - writeBigUInt64BE(value: bigint, offset?: number): number; - writeBigUInt64LE(value: bigint, offset?: number): number; -} - -/*----------------------------------------------* -* * -* GLOBAL INTERFACES * -* * -*-----------------------------------------------*/ -declare namespace NodeJS { - interface InspectOptions { - /** - * If set to `true`, getters are going to be - * inspected as well. If set to `'get'` only getters without setter are going - * to be inspected. If set to `'set'` only getters having a corresponding - * setter are going to be inspected. This might cause side effects depending on - * the getter function. - * @default `false` - */ - getters?: 'get' | 'set' | boolean; - showHidden?: boolean; - /** - * @default 2 - */ - depth?: number | null; - colors?: boolean; - customInspect?: boolean; - showProxy?: boolean; - maxArrayLength?: number | null; - /** - * Specifies the maximum number of characters to - * include when formatting. Set to `null` or `Infinity` to show all elements. - * Set to `0` or negative to show no characters. - * @default Infinity - */ - maxStringLength?: number | null; - breakLength?: number; - /** - * Setting this to `false` causes each object key - * to be displayed on a new line. It will also add new lines to text that is - * longer than `breakLength`. If set to a number, the most `n` inner elements - * are united on a single line as long as all properties fit into - * `breakLength`. Short array elements are also grouped together. Note that no - * text will be reduced below 16 characters, no matter the `breakLength` size. - * For more information, see the example below. - * @default `true` - */ - compact?: boolean | number; - sorted?: boolean | ((a: string, b: string) => number); - } - - interface ConsoleConstructorOptions { - stdout: WritableStream; - stderr?: WritableStream; - ignoreErrors?: boolean; - colorMode?: boolean | 'auto'; - inspectOptions?: InspectOptions; - } - - interface ConsoleConstructor { - prototype: Console; - new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console; - new(options: ConsoleConstructorOptions): Console; - } - - interface CallSite { - /** - * Value of "this" - */ - getThis(): any; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ - getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ - getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | null; - - /** - * Current line number [if this function was defined in a script] - */ - getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ - isEval(): boolean; - - /** - * Is this call in native V8 code? - */ - isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; - } - - interface ErrnoException extends Error { - errno?: number; - code?: string; - path?: string; - syscall?: string; - stack?: string; - } - - interface EventEmitter { - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - removeAllListeners(event?: string | symbol): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: string | symbol): Function[]; - rawListeners(event: string | symbol): Function[]; - emit(event: string | symbol, ...args: any[]): boolean; - listenerCount(type: string | symbol): number; - // Added in Node 6... - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - eventNames(): Array; - } - - interface ReadableStream extends EventEmitter { - readable: boolean; - read(size?: number): string | Buffer; - setEncoding(encoding: string): this; - pause(): this; - resume(): this; - isPaused(): boolean; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: WritableStream): this; - unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; - wrap(oldStream: ReadableStream): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableStream extends EventEmitter { - writable: boolean; - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; - write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean; - end(cb?: () => void): void; - end(data: string | Uint8Array, cb?: () => void): void; - end(str: string, encoding?: string, cb?: () => void): void; - } - - interface ReadWriteStream extends ReadableStream, WritableStream { } - - interface Domain extends EventEmitter { - run(fn: (...args: any[]) => T, ...args: any[]): T; - add(emitter: EventEmitter | Timer): void; - remove(emitter: EventEmitter | Timer): void; - bind(cb: T): T; - intercept(cb: T): T; - - addListener(event: string, listener: (...args: any[]) => void): this; - on(event: string, listener: (...args: any[]) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - removeListener(event: string, listener: (...args: any[]) => void): this; - removeAllListeners(event?: string): this; - } - - interface MemoryUsage { - rss: number; - heapTotal: number; - heapUsed: number; - external: number; - arrayBuffers: number; - } - - interface CpuUsage { - user: number; - system: number; - } - - interface ProcessRelease { - name: string; - sourceUrl?: string; - headersUrl?: string; - libUrl?: string; - lts?: string; - } - - interface ProcessVersions { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - modules: string; - openssl: string; - } - - type Platform = 'aix' - | 'android' - | 'darwin' - | 'freebsd' - | 'linux' - | 'openbsd' - | 'sunos' - | 'win32' - | 'cygwin' - | 'netbsd'; - - type Signals = - "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | - "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | - "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | - "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO"; - - type MultipleResolveType = 'resolve' | 'reject'; - - type BeforeExitListener = (code: number) => void; - type DisconnectListener = () => void; - type ExitListener = (code: number) => void; - type RejectionHandledListener = (promise: Promise) => void; - type UncaughtExceptionListener = (error: Error) => void; - type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise) => void; - type WarningListener = (warning: Error) => void; - type MessageListener = (message: any, sendHandle: any) => void; - type SignalsListener = (signal: Signals) => void; - type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; - type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; - type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: any) => void; - - interface Socket extends ReadWriteStream { - isTTY?: true; - } - - // Alias for compatibility - interface ProcessEnv extends Dict {} - - interface HRTime { - (time?: [number, number]): [number, number]; - bigint(): bigint; - } - - interface ProcessReport { - /** - * Directory where the report is written. - * working directory of the Node.js process. - * @default '' indicating that reports are written to the current - */ - directory: string; - - /** - * Filename where the report is written. - * The default value is the empty string. - * @default '' the output filename will be comprised of a timestamp, - * PID, and sequence number. - */ - filename: string; - - /** - * Returns a JSON-formatted diagnostic report for the running process. - * The report's JavaScript stack trace is taken from err, if present. - */ - getReport(err?: Error): string; - - /** - * If true, a diagnostic report is generated on fatal errors, - * such as out of memory errors or failed C++ assertions. - * @default false - */ - reportOnFatalError: boolean; - - /** - * If true, a diagnostic report is generated when the process - * receives the signal specified by process.report.signal. - * @defaul false - */ - reportOnSignal: boolean; - - /** - * If true, a diagnostic report is generated on uncaught exception. - * @default false - */ - reportOnUncaughtException: boolean; - - /** - * The signal used to trigger the creation of a diagnostic report. - * @default 'SIGUSR2' - */ - signal: Signals; - - /** - * Writes a diagnostic report to a file. If filename is not provided, the default filename - * includes the date, time, PID, and a sequence number. - * The report's JavaScript stack trace is taken from err, if present. - * - * @param fileName Name of the file where the report is written. - * This should be a relative path, that will be appended to the directory specified in - * `process.report.directory`, or the current working directory of the Node.js process, - * if unspecified. - * @param error A custom error used for reporting the JavaScript stack. - * @return Filename of the generated report. - */ - writeReport(fileName?: string): string; - writeReport(error?: Error): string; - writeReport(fileName?: string, err?: Error): string; - } - - interface ResourceUsage { - fsRead: number; - fsWrite: number; - involuntaryContextSwitches: number; - ipcReceived: number; - ipcSent: number; - majorPageFault: number; - maxRSS: number; - minorPageFault: number; - sharedMemorySize: number; - signalsCount: number; - swappedOut: number; - systemCPUTime: number; - unsharedDataSize: number; - unsharedStackSize: number; - userCPUTime: number; - voluntaryContextSwitches: number; - } - - interface Process extends EventEmitter { - /** - * Can also be a tty.WriteStream, not typed due to limitation.s - */ - stdout: WriteStream; - /** - * Can also be a tty.WriteStream, not typed due to limitation.s - */ - stderr: WriteStream; - stdin: ReadStream; - openStdin(): Socket; - argv: string[]; - argv0: string; - execArgv: string[]; - execPath: string; - abort(): never; - chdir(directory: string): void; - cwd(): string; - debugPort: number; - emitWarning(warning: string | Error, name?: string, ctor?: Function): void; - env: ProcessEnv; - exit(code?: number): never; - exitCode?: number; - getgid(): number; - setgid(id: number | string): void; - getuid(): number; - setuid(id: number | string): void; - geteuid(): number; - seteuid(id: number | string): void; - getegid(): number; - setegid(id: number | string): void; - getgroups(): number[]; - setgroups(groups: ReadonlyArray): void; - setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; - hasUncaughtExceptionCaptureCallback(): boolean; - version: string; - versions: ProcessVersions; - config: { - target_defaults: { - cflags: any[]; - default_configuration: string; - defines: string[]; - include_dirs: string[]; - libraries: string[]; - }; - variables: { - clang: number; - host_arch: string; - node_install_npm: boolean; - node_install_waf: boolean; - node_prefix: string; - node_shared_openssl: boolean; - node_shared_v8: boolean; - node_shared_zlib: boolean; - node_use_dtrace: boolean; - node_use_etw: boolean; - node_use_openssl: boolean; - target_arch: string; - v8_no_strict_aliasing: number; - v8_use_snapshot: boolean; - visibility: string; - }; - }; - kill(pid: number, signal?: string | number): void; - pid: number; - ppid: number; - title: string; - arch: string; - platform: Platform; - mainModule?: Module; - memoryUsage(): MemoryUsage; - cpuUsage(previousValue?: CpuUsage): CpuUsage; - nextTick(callback: Function, ...args: any[]): void; - release: ProcessRelease; - features: { - inspector: boolean; - debug: boolean; - uv: boolean; - ipv6: boolean; - tls_alpn: boolean; - tls_sni: boolean; - tls_ocsp: boolean; - tls: boolean; - }; - /** - * Can only be set if not in worker thread. - */ - umask(mask?: string | number): number; - uptime(): number; - hrtime: HRTime; - domain: Domain; - - // Worker - send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean; - disconnect(): void; - connected: boolean; - - /** - * The `process.allowedNodeEnvironmentFlags` property is a special, - * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][] - * environment variable. - */ - allowedNodeEnvironmentFlags: ReadonlySet; - - /** - * Only available with `--experimental-report` - */ - report?: ProcessReport; - - resourceUsage(): ResourceUsage; - - /* EventEmitter */ - addListener(event: "beforeExit", listener: BeforeExitListener): this; - addListener(event: "disconnect", listener: DisconnectListener): this; - addListener(event: "exit", listener: ExitListener): this; - addListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - addListener(event: "warning", listener: WarningListener): this; - addListener(event: "message", listener: MessageListener): this; - addListener(event: Signals, listener: SignalsListener): this; - addListener(event: "newListener", listener: NewListenerListener): this; - addListener(event: "removeListener", listener: RemoveListenerListener): this; - addListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - emit(event: "beforeExit", code: number): boolean; - emit(event: "disconnect"): boolean; - emit(event: "exit", code: number): boolean; - emit(event: "rejectionHandled", promise: Promise): boolean; - emit(event: "uncaughtException", error: Error): boolean; - emit(event: "uncaughtExceptionMonitor", error: Error): boolean; - emit(event: "unhandledRejection", reason: any, promise: Promise): boolean; - emit(event: "warning", warning: Error): boolean; - emit(event: "message", message: any, sendHandle: any): this; - emit(event: Signals, signal: Signals): boolean; - emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this; - emit(event: "multipleResolves", listener: MultipleResolveListener): this; - - on(event: "beforeExit", listener: BeforeExitListener): this; - on(event: "disconnect", listener: DisconnectListener): this; - on(event: "exit", listener: ExitListener): this; - on(event: "rejectionHandled", listener: RejectionHandledListener): this; - on(event: "uncaughtException", listener: UncaughtExceptionListener): this; - on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - on(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - on(event: "warning", listener: WarningListener): this; - on(event: "message", listener: MessageListener): this; - on(event: Signals, listener: SignalsListener): this; - on(event: "newListener", listener: NewListenerListener): this; - on(event: "removeListener", listener: RemoveListenerListener): this; - on(event: "multipleResolves", listener: MultipleResolveListener): this; - - once(event: "beforeExit", listener: BeforeExitListener): this; - once(event: "disconnect", listener: DisconnectListener): this; - once(event: "exit", listener: ExitListener): this; - once(event: "rejectionHandled", listener: RejectionHandledListener): this; - once(event: "uncaughtException", listener: UncaughtExceptionListener): this; - once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - once(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - once(event: "warning", listener: WarningListener): this; - once(event: "message", listener: MessageListener): this; - once(event: Signals, listener: SignalsListener): this; - once(event: "newListener", listener: NewListenerListener): this; - once(event: "removeListener", listener: RemoveListenerListener): this; - once(event: "multipleResolves", listener: MultipleResolveListener): this; - - prependListener(event: "beforeExit", listener: BeforeExitListener): this; - prependListener(event: "disconnect", listener: DisconnectListener): this; - prependListener(event: "exit", listener: ExitListener): this; - prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependListener(event: "warning", listener: WarningListener): this; - prependListener(event: "message", listener: MessageListener): this; - prependListener(event: Signals, listener: SignalsListener): this; - prependListener(event: "newListener", listener: NewListenerListener): this; - prependListener(event: "removeListener", listener: RemoveListenerListener): this; - prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; - prependOnceListener(event: "disconnect", listener: DisconnectListener): this; - prependOnceListener(event: "exit", listener: ExitListener): this; - prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependOnceListener(event: "warning", listener: WarningListener): this; - prependOnceListener(event: "message", listener: MessageListener): this; - prependOnceListener(event: Signals, listener: SignalsListener): this; - prependOnceListener(event: "newListener", listener: NewListenerListener): this; - prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this; - prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; - - listeners(event: "beforeExit"): BeforeExitListener[]; - listeners(event: "disconnect"): DisconnectListener[]; - listeners(event: "exit"): ExitListener[]; - listeners(event: "rejectionHandled"): RejectionHandledListener[]; - listeners(event: "uncaughtException"): UncaughtExceptionListener[]; - listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[]; - listeners(event: "unhandledRejection"): UnhandledRejectionListener[]; - listeners(event: "warning"): WarningListener[]; - listeners(event: "message"): MessageListener[]; - listeners(event: Signals): SignalsListener[]; - listeners(event: "newListener"): NewListenerListener[]; - listeners(event: "removeListener"): RemoveListenerListener[]; - listeners(event: "multipleResolves"): MultipleResolveListener[]; - } - - interface Global { - Array: typeof Array; - ArrayBuffer: typeof ArrayBuffer; - Boolean: typeof Boolean; - Buffer: typeof Buffer; - DataView: typeof DataView; - Date: typeof Date; - Error: typeof Error; - EvalError: typeof EvalError; - Float32Array: typeof Float32Array; - Float64Array: typeof Float64Array; - Function: typeof Function; - GLOBAL: Global; - Infinity: typeof Infinity; - Int16Array: typeof Int16Array; - Int32Array: typeof Int32Array; - Int8Array: typeof Int8Array; - Intl: typeof Intl; - JSON: typeof JSON; - Map: MapConstructor; - Math: typeof Math; - NaN: typeof NaN; - Number: typeof Number; - Object: typeof Object; - Promise: typeof Promise; - RangeError: typeof RangeError; - ReferenceError: typeof ReferenceError; - RegExp: typeof RegExp; - Set: SetConstructor; - String: typeof String; - Symbol: Function; - SyntaxError: typeof SyntaxError; - TypeError: typeof TypeError; - URIError: typeof URIError; - Uint16Array: typeof Uint16Array; - Uint32Array: typeof Uint32Array; - Uint8Array: typeof Uint8Array; - Uint8ClampedArray: typeof Uint8ClampedArray; - WeakMap: WeakMapConstructor; - WeakSet: WeakSetConstructor; - clearImmediate: (immediateId: Immediate) => void; - clearInterval: (intervalId: Timeout) => void; - clearTimeout: (timeoutId: Timeout) => void; - console: typeof console; - decodeURI: typeof decodeURI; - decodeURIComponent: typeof decodeURIComponent; - encodeURI: typeof encodeURI; - encodeURIComponent: typeof encodeURIComponent; - escape: (str: string) => string; - eval: typeof eval; - global: Global; - isFinite: typeof isFinite; - isNaN: typeof isNaN; - parseFloat: typeof parseFloat; - parseInt: typeof parseInt; - process: Process; - /** - * @deprecated Use `global`. - */ - root: Global; - setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate; - setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; - setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; - queueMicrotask: typeof queueMicrotask; - undefined: typeof undefined; - unescape: (str: string) => string; - gc: () => void; - v8debug?: any; - } - - interface RefCounted { - ref(): this; - unref(): this; - } - - // compatibility with older typings - interface Timer extends RefCounted { - hasRef(): boolean; - refresh(): this; - } - - interface Immediate extends RefCounted { - hasRef(): boolean; - _onImmediate: Function; // to distinguish it from the Timeout class - } - - interface Timeout extends Timer { - hasRef(): boolean; - refresh(): this; - } - - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float32Array - | Float64Array; - type ArrayBufferView = TypedArray | DataView; - - interface Require { - (id: string): any; - resolve: RequireResolve; - cache: Dict; - /** - * @deprecated - */ - extensions: RequireExtensions; - main: Module | undefined; - } - - interface RequireResolve { - (id: string, options?: { paths?: string[]; }): string; - paths(request: string): string[] | null; - } - - interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { - '.js': (m: Module, filename: string) => any; - '.json': (m: Module, filename: string) => any; - '.node': (m: Module, filename: string) => any; - } - interface Module { - exports: any; - require: Require; - id: string; - filename: string; - loaded: boolean; - /** - * @since 11.14.0 - * - * The directory name of the module. This is usually the same as the path.dirname() of the module.id. - */ - path: string; - parent: Module | null; - children: Module[]; - paths: string[]; - } - - interface Dict { - [key: string]: T | undefined; - } - - interface ReadOnlyDict { - readonly [key: string]: T | undefined; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/globals.global.d.ts b/node_modules/protobufjs/node_modules/@types/node/globals.global.d.ts deleted file mode 100644 index d66acba6..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: NodeJS.Global & typeof globalThis; diff --git a/node_modules/protobufjs/node_modules/@types/node/http.d.ts b/node_modules/protobufjs/node_modules/@types/node/http.d.ts deleted file mode 100644 index dda11679..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/http.d.ts +++ /dev/null @@ -1,403 +0,0 @@ -declare module "http" { - import * as events from "events"; - import * as stream from "stream"; - import { URL } from "url"; - import { Socket, Server as NetServer } from "net"; - - // incoming headers will never contain number - interface IncomingHttpHeaders extends NodeJS.Dict { - 'accept'?: string; - 'accept-language'?: string; - 'accept-patch'?: string; - 'accept-ranges'?: string; - 'access-control-allow-credentials'?: string; - 'access-control-allow-headers'?: string; - 'access-control-allow-methods'?: string; - 'access-control-allow-origin'?: string; - 'access-control-expose-headers'?: string; - 'access-control-max-age'?: string; - 'access-control-request-headers'?: string; - 'access-control-request-method'?: string; - 'age'?: string; - 'allow'?: string; - 'alt-svc'?: string; - 'authorization'?: string; - 'cache-control'?: string; - 'connection'?: string; - 'content-disposition'?: string; - 'content-encoding'?: string; - 'content-language'?: string; - 'content-length'?: string; - 'content-location'?: string; - 'content-range'?: string; - 'content-type'?: string; - 'cookie'?: string; - 'date'?: string; - 'expect'?: string; - 'expires'?: string; - 'forwarded'?: string; - 'from'?: string; - 'host'?: string; - 'if-match'?: string; - 'if-modified-since'?: string; - 'if-none-match'?: string; - 'if-unmodified-since'?: string; - 'last-modified'?: string; - 'location'?: string; - 'origin'?: string; - 'pragma'?: string; - 'proxy-authenticate'?: string; - 'proxy-authorization'?: string; - 'public-key-pins'?: string; - 'range'?: string; - 'referer'?: string; - 'retry-after'?: string; - 'set-cookie'?: string[]; - 'strict-transport-security'?: string; - 'tk'?: string; - 'trailer'?: string; - 'transfer-encoding'?: string; - 'upgrade'?: string; - 'user-agent'?: string; - 'vary'?: string; - 'via'?: string; - 'warning'?: string; - 'www-authenticate'?: string; - } - - // outgoing headers allows numbers (as they are converted internally to strings) - interface OutgoingHttpHeaders extends NodeJS.Dict { - } - - interface ClientRequestArgs { - protocol?: string | null; - host?: string | null; - hostname?: string | null; - family?: number; - port?: number | string | null; - defaultPort?: number | string; - localAddress?: string; - socketPath?: string; - /** - * @default 8192 - */ - maxHeaderSize?: number; - method?: string; - path?: string | null; - headers?: OutgoingHttpHeaders; - auth?: string | null; - agent?: Agent | boolean; - _defaultAgent?: Agent; - timeout?: number; - setHost?: boolean; - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 - createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket; - } - - interface ServerOptions { - IncomingMessage?: typeof IncomingMessage; - ServerResponse?: typeof ServerResponse; - /** - * Optionally overrides the value of - * [`--max-http-header-size`][] for requests received by this server, i.e. - * the maximum length of request headers in bytes. - * @default 8192 - */ - maxHeaderSize?: number; - /** - * Use an insecure HTTP parser that accepts invalid HTTP headers when true. - * Using the insecure parser should be avoided. - * See --insecure-http-parser for more information. - * @default false - */ - insecureHTTPParser?: boolean; - } - - type RequestListener = (req: IncomingMessage, res: ServerResponse) => void; - - interface HttpBase { - setTimeout(msecs?: number, callback?: () => void): this; - setTimeout(callback: () => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @default 2000 - * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount} - */ - maxHeadersCount: number | null; - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP headers. - * @default 60000 - * {@link https://nodejs.org/api/http.html#http_server_headerstimeout} - */ - headersTimeout: number; - keepAliveTimeout: number; - } - - interface Server extends HttpBase {} - class Server extends NetServer { - constructor(requestListener?: RequestListener); - constructor(options: ServerOptions, requestListener?: RequestListener); - } - - // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js - class OutgoingMessage extends stream.Writable { - upgrading: boolean; - chunkedEncoding: boolean; - shouldKeepAlive: boolean; - useChunkedEncodingByDefault: boolean; - sendDate: boolean; - /** - * @deprecated Use `writableEnded` instead. - */ - finished: boolean; - headersSent: boolean; - /** - * @deprecate Use `socket` instead. - */ - connection: Socket; - socket: Socket; - - constructor(); - - setTimeout(msecs: number, callback?: () => void): this; - setHeader(name: string, value: number | string | ReadonlyArray): void; - getHeader(name: string): number | string | string[] | undefined; - getHeaders(): OutgoingHttpHeaders; - getHeaderNames(): string[]; - hasHeader(name: string): boolean; - removeHeader(name: string): void; - addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; - flushHeaders(): void; - } - - // https://github.com/nodejs/node/blob/master/lib/_http_server.js#L108-L256 - class ServerResponse extends OutgoingMessage { - statusCode: number; - statusMessage: string; - - constructor(req: IncomingMessage); - - assignSocket(socket: Socket): void; - detachSocket(socket: Socket): void; - // https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53 - // no args in writeContinue callback - writeContinue(callback?: () => void): void; - writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeProcessing(): void; - } - - interface InformationEvent { - statusCode: number; - statusMessage: string; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - } - - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77 - class ClientRequest extends OutgoingMessage { - /** - * @deprecate Use `socket` instead. - */ - connection: Socket; - socket: Socket; - aborted: boolean; - - constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); - - method: string; - path: string; - abort(): void; - onSocket(socket: Socket): void; - setTimeout(timeout: number, callback?: () => void): this; - setNoDelay(noDelay?: boolean): void; - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - - addListener(event: 'abort', listener: () => void): this; - addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - addListener(event: 'continue', listener: () => void): this; - addListener(event: 'information', listener: (info: InformationEvent) => void): this; - addListener(event: 'response', listener: (response: IncomingMessage) => void): this; - addListener(event: 'socket', listener: (socket: Socket) => void): this; - addListener(event: 'timeout', listener: () => void): this; - addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - addListener(event: 'close', listener: () => void): this; - addListener(event: 'drain', listener: () => void): this; - addListener(event: 'error', listener: (err: Error) => void): this; - addListener(event: 'finish', listener: () => void): this; - addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - on(event: 'abort', listener: () => void): this; - on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: 'continue', listener: () => void): this; - on(event: 'information', listener: (info: InformationEvent) => void): this; - on(event: 'response', listener: (response: IncomingMessage) => void): this; - on(event: 'socket', listener: (socket: Socket) => void): this; - on(event: 'timeout', listener: () => void): this; - on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: 'close', listener: () => void): this; - on(event: 'drain', listener: () => void): this; - on(event: 'error', listener: (err: Error) => void): this; - on(event: 'finish', listener: () => void): this; - on(event: 'pipe', listener: (src: stream.Readable) => void): this; - on(event: 'unpipe', listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: 'abort', listener: () => void): this; - once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: 'continue', listener: () => void): this; - once(event: 'information', listener: (info: InformationEvent) => void): this; - once(event: 'response', listener: (response: IncomingMessage) => void): this; - once(event: 'socket', listener: (socket: Socket) => void): this; - once(event: 'timeout', listener: () => void): this; - once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: 'close', listener: () => void): this; - once(event: 'drain', listener: () => void): this; - once(event: 'error', listener: (err: Error) => void): this; - once(event: 'finish', listener: () => void): this; - once(event: 'pipe', listener: (src: stream.Readable) => void): this; - once(event: 'unpipe', listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: 'abort', listener: () => void): this; - prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependListener(event: 'continue', listener: () => void): this; - prependListener(event: 'information', listener: (info: InformationEvent) => void): this; - prependListener(event: 'response', listener: (response: IncomingMessage) => void): this; - prependListener(event: 'socket', listener: (socket: Socket) => void): this; - prependListener(event: 'timeout', listener: () => void): this; - prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependListener(event: 'close', listener: () => void): this; - prependListener(event: 'drain', listener: () => void): this; - prependListener(event: 'error', listener: (err: Error) => void): this; - prependListener(event: 'finish', listener: () => void): this; - prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: 'abort', listener: () => void): this; - prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependOnceListener(event: 'continue', listener: () => void): this; - prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this; - prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this; - prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this; - prependOnceListener(event: 'timeout', listener: () => void): this; - prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - prependOnceListener(event: 'close', listener: () => void): this; - prependOnceListener(event: 'drain', listener: () => void): this; - prependOnceListener(event: 'error', listener: (err: Error) => void): this; - prependOnceListener(event: 'finish', listener: () => void): this; - prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; - prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - class IncomingMessage extends stream.Readable { - constructor(socket: Socket); - - aborted: boolean; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - complete: boolean; - /** - * @deprecate Use `socket` instead. - */ - connection: Socket; - socket: Socket; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - trailers: NodeJS.Dict; - rawTrailers: string[]; - setTimeout(msecs: number, callback?: () => void): this; - /** - * Only valid for request obtained from http.Server. - */ - method?: string; - /** - * Only valid for request obtained from http.Server. - */ - url?: string; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusCode?: number; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusMessage?: string; - destroy(error?: Error): void; - } - - interface AgentOptions { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number; - /** - * Socket timeout in milliseconds. This will set the timeout after the socket is connected. - */ - timeout?: number; - } - - class Agent { - maxFreeSockets: number; - maxSockets: number; - readonly sockets: NodeJS.ReadOnlyDict; - readonly requests: NodeJS.ReadOnlyDict; - - constructor(opts?: AgentOptions); - - /** - * Destroy any sockets that are currently in use by the agent. - * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, - * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, - * sockets may hang open for quite a long time before the server terminates them. - */ - destroy(): void; - } - - const METHODS: string[]; - - const STATUS_CODES: { - [errorCode: number]: string | undefined; - [errorCode: string]: string | undefined; - }; - - function createServer(requestListener?: RequestListener): Server; - function createServer(options: ServerOptions, requestListener?: RequestListener): Server; - - // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, - // create interface RequestOptions would make the naming more clear to developers - interface RequestOptions extends ClientRequestArgs { } - function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - let globalAgent: Agent; - - /** - * Read-only property specifying the maximum allowed size of HTTP headers in bytes. - * Defaults to 16KB. Configurable using the [`--max-http-header-size`][] CLI option. - */ - const maxHeaderSize: number; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/http2.d.ts b/node_modules/protobufjs/node_modules/@types/node/http2.d.ts deleted file mode 100644 index 2ac1c31f..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/http2.d.ts +++ /dev/null @@ -1,948 +0,0 @@ -declare module "http2" { - import * as events from "events"; - import * as fs from "fs"; - import * as net from "net"; - import * as stream from "stream"; - import * as tls from "tls"; - import * as url from "url"; - - import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from "http"; - export { OutgoingHttpHeaders } from "http"; - - export interface IncomingHttpStatusHeader { - ":status"?: number; - } - - export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { - ":path"?: string; - ":method"?: string; - ":authority"?: string; - ":scheme"?: string; - } - - // Http2Stream - - export interface StreamPriorityOptions { - exclusive?: boolean; - parent?: number; - weight?: number; - silent?: boolean; - } - - export interface StreamState { - localWindowSize?: number; - state?: number; - localClose?: number; - remoteClose?: number; - sumDependencyWeight?: number; - weight?: number; - } - - export interface ServerStreamResponseOptions { - endStream?: boolean; - waitForTrailers?: boolean; - } - - export interface StatOptions { - offset: number; - length: number; - } - - export interface ServerStreamFileResponseOptions { - statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; - waitForTrailers?: boolean; - offset?: number; - length?: number; - } - - export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { - onError?(err: NodeJS.ErrnoException): void; - } - - export interface Http2Stream extends stream.Duplex { - readonly aborted: boolean; - readonly bufferSize: number; - readonly closed: boolean; - readonly destroyed: boolean; - /** - * Set the true if the END_STREAM flag was set in the request or response HEADERS frame received, - * indicating that no additional data should be received and the readable side of the Http2Stream will be closed. - */ - readonly endAfterHeaders: boolean; - readonly id?: number; - readonly pending: boolean; - readonly rstCode: number; - readonly sentHeaders: OutgoingHttpHeaders; - readonly sentInfoHeaders?: OutgoingHttpHeaders[]; - readonly sentTrailers?: OutgoingHttpHeaders; - readonly session: Http2Session; - readonly state: StreamState; - - close(code?: number, callback?: () => void): void; - priority(options: StreamPriorityOptions): void; - setTimeout(msecs: number, callback?: () => void): void; - sendTrailers(headers: OutgoingHttpHeaders): void; - - addListener(event: "aborted", listener: () => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: "streamClosed", listener: (code: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "wantTrailers", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "aborted"): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "frameError", frameType: number, errorCode: number): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: "streamClosed", code: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "wantTrailers"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "aborted", listener: () => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: "streamClosed", listener: (code: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "wantTrailers", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "aborted", listener: () => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: "streamClosed", listener: (code: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "wantTrailers", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "aborted", listener: () => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "streamClosed", listener: (code: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "wantTrailers", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "aborted", listener: () => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "wantTrailers", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ClientHttp2Stream extends Http2Stream { - addListener(event: "continue", listener: () => {}): this; - addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "continue"): boolean; - emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "continue", listener: () => {}): this; - on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "continue", listener: () => {}): this; - once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "continue", listener: () => {}): this; - prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "continue", listener: () => {}): this; - prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ServerHttp2Stream extends Http2Stream { - readonly headersSent: boolean; - readonly pushAllowed: boolean; - additionalHeaders(headers: OutgoingHttpHeaders): void; - pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; - pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; - respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; - respondWithFD(fd: number | fs.promises.FileHandle, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; - respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; - } - - // Http2Session - - export interface Settings { - headerTableSize?: number; - enablePush?: boolean; - initialWindowSize?: number; - maxFrameSize?: number; - maxConcurrentStreams?: number; - maxHeaderListSize?: number; - enableConnectProtocol?: boolean; - } - - export interface ClientSessionRequestOptions { - endStream?: boolean; - exclusive?: boolean; - parent?: number; - weight?: number; - waitForTrailers?: boolean; - } - - export interface SessionState { - effectiveLocalWindowSize?: number; - effectiveRecvDataLength?: number; - nextStreamID?: number; - localWindowSize?: number; - lastProcStreamID?: number; - remoteWindowSize?: number; - outboundQueueSize?: number; - deflateDynamicTableSize?: number; - inflateDynamicTableSize?: number; - } - - export interface Http2Session extends events.EventEmitter { - readonly alpnProtocol?: string; - readonly closed: boolean; - readonly connecting: boolean; - readonly destroyed: boolean; - readonly encrypted?: boolean; - readonly localSettings: Settings; - readonly originSet?: string[]; - readonly pendingSettingsAck: boolean; - readonly remoteSettings: Settings; - readonly socket: net.Socket | tls.TLSSocket; - readonly state: SessionState; - readonly type: number; - - close(callback?: () => void): void; - destroy(error?: Error, code?: number): void; - goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; - ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ping(payload: NodeJS.ArrayBufferView, callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ref(): void; - setTimeout(msecs: number, callback?: () => void): void; - settings(settings: Settings): void; - unref(): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - addListener(event: "localSettings", listener: (settings: Settings) => void): this; - addListener(event: "ping", listener: () => void): this; - addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; - emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; - emit(event: "localSettings", settings: Settings): boolean; - emit(event: "ping"): boolean; - emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - on(event: "localSettings", listener: (settings: Settings) => void): this; - on(event: "ping", listener: () => void): this; - on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - once(event: "localSettings", listener: (settings: Settings) => void): this; - once(event: "ping", listener: () => void): this; - once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - prependListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependListener(event: "ping", listener: () => void): this; - prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; - prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "ping", listener: () => void): this; - prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface ClientHttp2Session extends Http2Session { - request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; - - addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - addListener(event: "origin", listener: (origins: string[]) => void): this; - addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; - emit(event: "origin", origins: ReadonlyArray): boolean; - emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - on(event: "origin", listener: (origins: string[]) => void): this; - on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - once(event: "origin", listener: (origins: string[]) => void): this; - once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependListener(event: "origin", listener: (origins: string[]) => void): this; - prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependOnceListener(event: "origin", listener: (origins: string[]) => void): this; - prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export interface AlternativeServiceOptions { - origin: number | string | url.URL; - } - - export interface ServerHttp2Session extends Http2Session { - readonly server: Http2Server | Http2SecureServer; - - altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; - origin(...args: Array): void; - - addListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - // Http2Server - - export interface SessionOptions { - maxDeflateDynamicTableSize?: number; - maxSessionMemory?: number; - maxHeaderListPairs?: number; - maxOutstandingPings?: number; - maxSendHeaderBlockLength?: number; - paddingStrategy?: number; - peerMaxConcurrentStreams?: number; - settings?: Settings; - - selectPadding?(frameLen: number, maxFrameLen: number): number; - createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex; - } - - export interface ClientSessionOptions extends SessionOptions { - maxReservedRemoteStreams?: number; - createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex; - protocol?: 'http:' | 'https:'; - } - - export interface ServerSessionOptions extends SessionOptions { - Http1IncomingMessage?: typeof IncomingMessage; - Http1ServerResponse?: typeof ServerResponse; - Http2ServerRequest?: typeof Http2ServerRequest; - Http2ServerResponse?: typeof Http2ServerResponse; - } - - export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { } - export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { } - - export interface ServerOptions extends ServerSessionOptions { } - - export interface SecureServerOptions extends SecureServerSessionOptions { - allowHTTP1?: boolean; - origins?: string[]; - } - - export interface Http2Server extends net.Server { - addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - setTimeout(msec?: number, callback?: () => void): this; - } - - export interface Http2SecureServer extends tls.Server { - addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - setTimeout(msec?: number, callback?: () => void): this; - } - - export class Http2ServerRequest extends stream.Readable { - constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray); - - readonly aborted: boolean; - readonly authority: string; - readonly headers: IncomingHttpHeaders; - readonly httpVersion: string; - readonly method: string; - readonly rawHeaders: string[]; - readonly rawTrailers: string[]; - readonly scheme: string; - readonly socket: net.Socket | tls.TLSSocket; - readonly stream: ServerHttp2Stream; - readonly trailers: IncomingHttpHeaders; - readonly url: string; - - setTimeout(msecs: number, callback?: () => void): void; - read(size?: number): Buffer | string | null; - - addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "aborted", hadError: boolean, code: number): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "end"): boolean; - emit(event: "readable"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - export class Http2ServerResponse extends stream.Stream { - constructor(stream: ServerHttp2Stream); - - readonly connection: net.Socket | tls.TLSSocket; - readonly finished: boolean; - readonly headersSent: boolean; - readonly socket: net.Socket | tls.TLSSocket; - readonly stream: ServerHttp2Stream; - sendDate: boolean; - statusCode: number; - statusMessage: ''; - addTrailers(trailers: OutgoingHttpHeaders): void; - end(callback?: () => void): void; - end(data: string | Uint8Array, callback?: () => void): void; - end(data: string | Uint8Array, encoding: string, callback?: () => void): void; - getHeader(name: string): string; - getHeaderNames(): string[]; - getHeaders(): OutgoingHttpHeaders; - hasHeader(name: string): boolean; - removeHeader(name: string): void; - setHeader(name: string, value: number | string | ReadonlyArray): void; - setTimeout(msecs: number, callback?: () => void): void; - write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; - write(chunk: string | Uint8Array, encoding: string, callback?: (err: Error) => void): boolean; - writeContinue(): void; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; - createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - // Public API - - export namespace constants { - const NGHTTP2_SESSION_SERVER: number; - const NGHTTP2_SESSION_CLIENT: number; - const NGHTTP2_STREAM_STATE_IDLE: number; - const NGHTTP2_STREAM_STATE_OPEN: number; - const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; - const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; - const NGHTTP2_STREAM_STATE_CLOSED: number; - const NGHTTP2_NO_ERROR: number; - const NGHTTP2_PROTOCOL_ERROR: number; - const NGHTTP2_INTERNAL_ERROR: number; - const NGHTTP2_FLOW_CONTROL_ERROR: number; - const NGHTTP2_SETTINGS_TIMEOUT: number; - const NGHTTP2_STREAM_CLOSED: number; - const NGHTTP2_FRAME_SIZE_ERROR: number; - const NGHTTP2_REFUSED_STREAM: number; - const NGHTTP2_CANCEL: number; - const NGHTTP2_COMPRESSION_ERROR: number; - const NGHTTP2_CONNECT_ERROR: number; - const NGHTTP2_ENHANCE_YOUR_CALM: number; - const NGHTTP2_INADEQUATE_SECURITY: number; - const NGHTTP2_HTTP_1_1_REQUIRED: number; - const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; - const NGHTTP2_FLAG_NONE: number; - const NGHTTP2_FLAG_END_STREAM: number; - const NGHTTP2_FLAG_END_HEADERS: number; - const NGHTTP2_FLAG_ACK: number; - const NGHTTP2_FLAG_PADDED: number; - const NGHTTP2_FLAG_PRIORITY: number; - const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; - const DEFAULT_SETTINGS_ENABLE_PUSH: number; - const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; - const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; - const MAX_MAX_FRAME_SIZE: number; - const MIN_MAX_FRAME_SIZE: number; - const MAX_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_DEFAULT_WEIGHT: number; - const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; - const NGHTTP2_SETTINGS_ENABLE_PUSH: number; - const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; - const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; - const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; - const PADDING_STRATEGY_NONE: number; - const PADDING_STRATEGY_MAX: number; - const PADDING_STRATEGY_CALLBACK: number; - const HTTP2_HEADER_STATUS: string; - const HTTP2_HEADER_METHOD: string; - const HTTP2_HEADER_AUTHORITY: string; - const HTTP2_HEADER_SCHEME: string; - const HTTP2_HEADER_PATH: string; - const HTTP2_HEADER_ACCEPT_CHARSET: string; - const HTTP2_HEADER_ACCEPT_ENCODING: string; - const HTTP2_HEADER_ACCEPT_LANGUAGE: string; - const HTTP2_HEADER_ACCEPT_RANGES: string; - const HTTP2_HEADER_ACCEPT: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; - const HTTP2_HEADER_AGE: string; - const HTTP2_HEADER_ALLOW: string; - const HTTP2_HEADER_AUTHORIZATION: string; - const HTTP2_HEADER_CACHE_CONTROL: string; - const HTTP2_HEADER_CONNECTION: string; - const HTTP2_HEADER_CONTENT_DISPOSITION: string; - const HTTP2_HEADER_CONTENT_ENCODING: string; - const HTTP2_HEADER_CONTENT_LANGUAGE: string; - const HTTP2_HEADER_CONTENT_LENGTH: string; - const HTTP2_HEADER_CONTENT_LOCATION: string; - const HTTP2_HEADER_CONTENT_MD5: string; - const HTTP2_HEADER_CONTENT_RANGE: string; - const HTTP2_HEADER_CONTENT_TYPE: string; - const HTTP2_HEADER_COOKIE: string; - const HTTP2_HEADER_DATE: string; - const HTTP2_HEADER_ETAG: string; - const HTTP2_HEADER_EXPECT: string; - const HTTP2_HEADER_EXPIRES: string; - const HTTP2_HEADER_FROM: string; - const HTTP2_HEADER_HOST: string; - const HTTP2_HEADER_IF_MATCH: string; - const HTTP2_HEADER_IF_MODIFIED_SINCE: string; - const HTTP2_HEADER_IF_NONE_MATCH: string; - const HTTP2_HEADER_IF_RANGE: string; - const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; - const HTTP2_HEADER_LAST_MODIFIED: string; - const HTTP2_HEADER_LINK: string; - const HTTP2_HEADER_LOCATION: string; - const HTTP2_HEADER_MAX_FORWARDS: string; - const HTTP2_HEADER_PREFER: string; - const HTTP2_HEADER_PROXY_AUTHENTICATE: string; - const HTTP2_HEADER_PROXY_AUTHORIZATION: string; - const HTTP2_HEADER_RANGE: string; - const HTTP2_HEADER_REFERER: string; - const HTTP2_HEADER_REFRESH: string; - const HTTP2_HEADER_RETRY_AFTER: string; - const HTTP2_HEADER_SERVER: string; - const HTTP2_HEADER_SET_COOKIE: string; - const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; - const HTTP2_HEADER_TRANSFER_ENCODING: string; - const HTTP2_HEADER_TE: string; - const HTTP2_HEADER_UPGRADE: string; - const HTTP2_HEADER_USER_AGENT: string; - const HTTP2_HEADER_VARY: string; - const HTTP2_HEADER_VIA: string; - const HTTP2_HEADER_WWW_AUTHENTICATE: string; - const HTTP2_HEADER_HTTP2_SETTINGS: string; - const HTTP2_HEADER_KEEP_ALIVE: string; - const HTTP2_HEADER_PROXY_CONNECTION: string; - const HTTP2_METHOD_ACL: string; - const HTTP2_METHOD_BASELINE_CONTROL: string; - const HTTP2_METHOD_BIND: string; - const HTTP2_METHOD_CHECKIN: string; - const HTTP2_METHOD_CHECKOUT: string; - const HTTP2_METHOD_CONNECT: string; - const HTTP2_METHOD_COPY: string; - const HTTP2_METHOD_DELETE: string; - const HTTP2_METHOD_GET: string; - const HTTP2_METHOD_HEAD: string; - const HTTP2_METHOD_LABEL: string; - const HTTP2_METHOD_LINK: string; - const HTTP2_METHOD_LOCK: string; - const HTTP2_METHOD_MERGE: string; - const HTTP2_METHOD_MKACTIVITY: string; - const HTTP2_METHOD_MKCALENDAR: string; - const HTTP2_METHOD_MKCOL: string; - const HTTP2_METHOD_MKREDIRECTREF: string; - const HTTP2_METHOD_MKWORKSPACE: string; - const HTTP2_METHOD_MOVE: string; - const HTTP2_METHOD_OPTIONS: string; - const HTTP2_METHOD_ORDERPATCH: string; - const HTTP2_METHOD_PATCH: string; - const HTTP2_METHOD_POST: string; - const HTTP2_METHOD_PRI: string; - const HTTP2_METHOD_PROPFIND: string; - const HTTP2_METHOD_PROPPATCH: string; - const HTTP2_METHOD_PUT: string; - const HTTP2_METHOD_REBIND: string; - const HTTP2_METHOD_REPORT: string; - const HTTP2_METHOD_SEARCH: string; - const HTTP2_METHOD_TRACE: string; - const HTTP2_METHOD_UNBIND: string; - const HTTP2_METHOD_UNCHECKOUT: string; - const HTTP2_METHOD_UNLINK: string; - const HTTP2_METHOD_UNLOCK: string; - const HTTP2_METHOD_UPDATE: string; - const HTTP2_METHOD_UPDATEREDIRECTREF: string; - const HTTP2_METHOD_VERSION_CONTROL: string; - const HTTP_STATUS_CONTINUE: number; - const HTTP_STATUS_SWITCHING_PROTOCOLS: number; - const HTTP_STATUS_PROCESSING: number; - const HTTP_STATUS_OK: number; - const HTTP_STATUS_CREATED: number; - const HTTP_STATUS_ACCEPTED: number; - const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; - const HTTP_STATUS_NO_CONTENT: number; - const HTTP_STATUS_RESET_CONTENT: number; - const HTTP_STATUS_PARTIAL_CONTENT: number; - const HTTP_STATUS_MULTI_STATUS: number; - const HTTP_STATUS_ALREADY_REPORTED: number; - const HTTP_STATUS_IM_USED: number; - const HTTP_STATUS_MULTIPLE_CHOICES: number; - const HTTP_STATUS_MOVED_PERMANENTLY: number; - const HTTP_STATUS_FOUND: number; - const HTTP_STATUS_SEE_OTHER: number; - const HTTP_STATUS_NOT_MODIFIED: number; - const HTTP_STATUS_USE_PROXY: number; - const HTTP_STATUS_TEMPORARY_REDIRECT: number; - const HTTP_STATUS_PERMANENT_REDIRECT: number; - const HTTP_STATUS_BAD_REQUEST: number; - const HTTP_STATUS_UNAUTHORIZED: number; - const HTTP_STATUS_PAYMENT_REQUIRED: number; - const HTTP_STATUS_FORBIDDEN: number; - const HTTP_STATUS_NOT_FOUND: number; - const HTTP_STATUS_METHOD_NOT_ALLOWED: number; - const HTTP_STATUS_NOT_ACCEPTABLE: number; - const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; - const HTTP_STATUS_REQUEST_TIMEOUT: number; - const HTTP_STATUS_CONFLICT: number; - const HTTP_STATUS_GONE: number; - const HTTP_STATUS_LENGTH_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_FAILED: number; - const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; - const HTTP_STATUS_URI_TOO_LONG: number; - const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; - const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; - const HTTP_STATUS_EXPECTATION_FAILED: number; - const HTTP_STATUS_TEAPOT: number; - const HTTP_STATUS_MISDIRECTED_REQUEST: number; - const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; - const HTTP_STATUS_LOCKED: number; - const HTTP_STATUS_FAILED_DEPENDENCY: number; - const HTTP_STATUS_UNORDERED_COLLECTION: number; - const HTTP_STATUS_UPGRADE_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_REQUIRED: number; - const HTTP_STATUS_TOO_MANY_REQUESTS: number; - const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; - const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; - const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; - const HTTP_STATUS_NOT_IMPLEMENTED: number; - const HTTP_STATUS_BAD_GATEWAY: number; - const HTTP_STATUS_SERVICE_UNAVAILABLE: number; - const HTTP_STATUS_GATEWAY_TIMEOUT: number; - const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; - const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; - const HTTP_STATUS_INSUFFICIENT_STORAGE: number; - const HTTP_STATUS_LOOP_DETECTED: number; - const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; - const HTTP_STATUS_NOT_EXTENDED: number; - const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; - } - - export function getDefaultSettings(): Settings; - export function getPackedSettings(settings: Settings): Buffer; - export function getUnpackedSettings(buf: Uint8Array): Settings; - - export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; - export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; - - export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; - export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; - - export function connect(authority: string | url.URL, listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session; - export function connect( - authority: string | url.URL, - options?: ClientSessionOptions | SecureClientSessionOptions, - listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void - ): ClientHttp2Session; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/https.d.ts b/node_modules/protobufjs/node_modules/@types/node/https.d.ts deleted file mode 100644 index 24326c9d..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/https.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare module "https" { - import * as tls from "tls"; - import * as events from "events"; - import * as http from "http"; - import { URL } from "url"; - - type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; - - type RequestOptions = http.RequestOptions & tls.SecureContextOptions & { - rejectUnauthorized?: boolean; // Defaults to true - servername?: string; // SNI TLS Extension - }; - - interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { - rejectUnauthorized?: boolean; - maxCachedSessions?: number; - } - - class Agent extends http.Agent { - constructor(options?: AgentOptions); - options: AgentOptions; - } - - interface Server extends http.HttpBase {} - class Server extends tls.Server { - constructor(requestListener?: http.RequestListener); - constructor(options: ServerOptions, requestListener?: http.RequestListener); - } - - function createServer(requestListener?: http.RequestListener): Server; - function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server; - function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - let globalAgent: Agent; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/index.d.ts b/node_modules/protobufjs/node_modules/@types/node/index.d.ts deleted file mode 100644 index 5b09a1d5..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Type definitions for non-npm package Node.js 13.13 -// Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped -// Alberto Schiabel -// Alexander T. -// Alvis HT Tang -// Andrew Makarov -// Benjamin Toueg -// Bruno Scheufler -// Chigozirim C. -// Christian Vaagland Tellnes -// David Junger -// Deividas Bakanas -// Eugene Y. Q. Shen -// Flarna -// Hannes Magnusson -// Hoàng Văn Khải -// Huw -// Kelvin Jin -// Klaus Meinhardt -// Lishude -// Mariusz Wiktorczyk -// Mohsen Azimi -// Nicolas Even -// Nikita Galkin -// Parambir Singh -// Sebastian Silbermann -// Simon Schick -// Thomas den Hollander -// Wilco Bakker -// wwwy3y3 -// Samuel Ainsworth -// Kyle Uehlein -// Jordi Oliveras Rovira -// Thanik Bhongbhibhat -// Marcin Kopacz -// Trivikram Kamat -// Minh Son Nguyen -// Junxiao Shi -// Ilia Baryshnikov -// ExE Boss -// Surasak Chaisurin -// Piotr Błażejewicz -// Jason Kwok -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// NOTE: These definitions support NodeJS and TypeScript 3.7. -// This isn't strictly needed since 3.7 has the assert module, but this way we're consistent. -// Typically type modificatons should be made in base.d.ts instead of here - -/// diff --git a/node_modules/protobufjs/node_modules/@types/node/inspector.d.ts b/node_modules/protobufjs/node_modules/@types/node/inspector.d.ts deleted file mode 100644 index b14aed2b..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/inspector.d.ts +++ /dev/null @@ -1,3034 +0,0 @@ -// tslint:disable-next-line:dt-header -// Type definitions for inspector - -// These definitions are auto-generated. -// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330 -// for more information. - -// tslint:disable:max-line-length - -/** - * The inspector module provides an API for interacting with the V8 inspector. - */ -declare module "inspector" { - import { EventEmitter } from 'events'; - - interface InspectorNotification { - method: string; - params: T; - } - - namespace Schema { - /** - * Description of the protocol domain. - */ - interface Domain { - /** - * Domain name. - */ - name: string; - /** - * Domain version. - */ - version: string; - } - - interface GetDomainsReturnType { - /** - * List of supported domains. - */ - domains: Domain[]; - } - } - - namespace Runtime { - /** - * Unique script identifier. - */ - type ScriptId = string; - - /** - * Unique object identifier. - */ - type RemoteObjectId = string; - - /** - * Primitive value which cannot be JSON-stringified. - */ - type UnserializableValue = string; - - /** - * Mirror object referencing original JavaScript object. - */ - interface RemoteObject { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - /** - * Object class (constructor) name. Specified for object type values only. - */ - className?: string; - /** - * Remote object value in case of primitive values or JSON values (if it was requested). - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified does not have value, but gets this property. - */ - unserializableValue?: UnserializableValue; - /** - * String representation of the object. - */ - description?: string; - /** - * Unique object identifier (for non-primitive values). - */ - objectId?: RemoteObjectId; - /** - * Preview containing abbreviated property values. Specified for object type values only. - * @experimental - */ - preview?: ObjectPreview; - /** - * @experimental - */ - customPreview?: CustomPreview; - } - - /** - * @experimental - */ - interface CustomPreview { - header: string; - hasBody: boolean; - formatterObjectId: RemoteObjectId; - bindRemoteObjectFunctionId: RemoteObjectId; - configObjectId?: RemoteObjectId; - } - - /** - * Object containing abbreviated remote object value. - * @experimental - */ - interface ObjectPreview { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - /** - * String representation of the object. - */ - description?: string; - /** - * True iff some of the properties or entries of the original object did not fit. - */ - overflow: boolean; - /** - * List of the properties. - */ - properties: PropertyPreview[]; - /** - * List of the entries. Specified for map and set subtype values only. - */ - entries?: EntryPreview[]; - } - - /** - * @experimental - */ - interface PropertyPreview { - /** - * Property name. - */ - name: string; - /** - * Object type. Accessor means that the property itself is an accessor property. - */ - type: string; - /** - * User-friendly property value string. - */ - value?: string; - /** - * Nested value preview. - */ - valuePreview?: ObjectPreview; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string; - } - - /** - * @experimental - */ - interface EntryPreview { - /** - * Preview of the key. Specified for map-like collection entries. - */ - key?: ObjectPreview; - /** - * Preview of the value. - */ - value: ObjectPreview; - } - - /** - * Object property descriptor. - */ - interface PropertyDescriptor { - /** - * Property name or symbol description. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject; - /** - * True if the value associated with the property may be changed (data descriptors only). - */ - writable?: boolean; - /** - * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). - */ - get?: RemoteObject; - /** - * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). - */ - set?: RemoteObject; - /** - * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. - */ - configurable: boolean; - /** - * True if this property shows up during enumeration of the properties on the corresponding object. - */ - enumerable: boolean; - /** - * True if the result was thrown during the evaluation. - */ - wasThrown?: boolean; - /** - * True if the property is owned for the object. - */ - isOwn?: boolean; - /** - * Property symbol object, if the property is of the symbol type. - */ - symbol?: RemoteObject; - } - - /** - * Object internal property descriptor. This property isn't normally visible in JavaScript code. - */ - interface InternalPropertyDescriptor { - /** - * Conventional property name. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject; - } - - /** - * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. - */ - interface CallArgument { - /** - * Primitive value or serializable javascript object. - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified. - */ - unserializableValue?: UnserializableValue; - /** - * Remote object handle. - */ - objectId?: RemoteObjectId; - } - - /** - * Id of an execution context. - */ - type ExecutionContextId = number; - - /** - * Description of an isolated world. - */ - interface ExecutionContextDescription { - /** - * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. - */ - id: ExecutionContextId; - /** - * Execution context origin. - */ - origin: string; - /** - * Human readable name describing given context. - */ - name: string; - /** - * Embedder-specific auxiliary data. - */ - auxData?: {}; - } - - /** - * Detailed information about exception (or error) that was thrown during script compilation or execution. - */ - interface ExceptionDetails { - /** - * Exception id. - */ - exceptionId: number; - /** - * Exception text, which should be used together with exception object when available. - */ - text: string; - /** - * Line number of the exception location (0-based). - */ - lineNumber: number; - /** - * Column number of the exception location (0-based). - */ - columnNumber: number; - /** - * Script ID of the exception location. - */ - scriptId?: ScriptId; - /** - * URL of the exception location, to be used when the script was not reported. - */ - url?: string; - /** - * JavaScript stack trace if available. - */ - stackTrace?: StackTrace; - /** - * Exception object if available. - */ - exception?: RemoteObject; - /** - * Identifier of the context where exception happened. - */ - executionContextId?: ExecutionContextId; - } - - /** - * Number of milliseconds since epoch. - */ - type Timestamp = number; - - /** - * Stack entry for runtime errors and assertions. - */ - interface CallFrame { - /** - * JavaScript function name. - */ - functionName: string; - /** - * JavaScript script id. - */ - scriptId: ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * JavaScript script line number (0-based). - */ - lineNumber: number; - /** - * JavaScript script column number (0-based). - */ - columnNumber: number; - } - - /** - * Call frames for assertions or error messages. - */ - interface StackTrace { - /** - * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. - */ - description?: string; - /** - * JavaScript function name. - */ - callFrames: CallFrame[]; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - */ - parent?: StackTrace; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - * @experimental - */ - parentId?: StackTraceId; - } - - /** - * Unique identifier of current debugger. - * @experimental - */ - type UniqueDebuggerId = string; - - /** - * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. - * @experimental - */ - interface StackTraceId { - id: string; - debuggerId?: UniqueDebuggerId; - } - - interface EvaluateParameterType { - /** - * Expression to evaluate. - */ - expression: string; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - contextId?: ExecutionContextId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - } - - interface AwaitPromiseParameterType { - /** - * Identifier of the promise. - */ - promiseObjectId: RemoteObjectId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean; - } - - interface CallFunctionOnParameterType { - /** - * Declaration of the function to call. - */ - functionDeclaration: string; - /** - * Identifier of the object to call function on. Either objectId or executionContextId should be specified. - */ - objectId?: RemoteObjectId; - /** - * Call arguments. All call arguments must belong to the same JavaScript world as the target object. - */ - arguments?: CallArgument[]; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - /** - * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. - */ - executionContextId?: ExecutionContextId; - /** - * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. - */ - objectGroup?: string; - } - - interface GetPropertiesParameterType { - /** - * Identifier of the object to return properties for. - */ - objectId: RemoteObjectId; - /** - * If true, returns properties belonging only to the element itself, not to its prototype chain. - */ - ownProperties?: boolean; - /** - * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - * @experimental - */ - accessorPropertiesOnly?: boolean; - /** - * Whether preview should be generated for the results. - * @experimental - */ - generatePreview?: boolean; - } - - interface ReleaseObjectParameterType { - /** - * Identifier of the object to release. - */ - objectId: RemoteObjectId; - } - - interface ReleaseObjectGroupParameterType { - /** - * Symbolic object group name. - */ - objectGroup: string; - } - - interface SetCustomObjectFormatterEnabledParameterType { - enabled: boolean; - } - - interface CompileScriptParameterType { - /** - * Expression to compile. - */ - expression: string; - /** - * Source url to be set for the script. - */ - sourceURL: string; - /** - * Specifies whether the compiled script should be persisted. - */ - persistScript: boolean; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId; - } - - interface RunScriptParameterType { - /** - * Id of the script to run. - */ - scriptId: ScriptId; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean; - } - - interface QueryObjectsParameterType { - /** - * Identifier of the prototype to return objects for. - */ - prototypeObjectId: RemoteObjectId; - } - - interface GlobalLexicalScopeNamesParameterType { - /** - * Specifies in which execution context to lookup global scope variables. - */ - executionContextId?: ExecutionContextId; - } - - interface EvaluateReturnType { - /** - * Evaluation result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface AwaitPromiseReturnType { - /** - * Promise result. Will contain rejected value if promise was rejected. - */ - result: RemoteObject; - /** - * Exception details if stack strace is available. - */ - exceptionDetails?: ExceptionDetails; - } - - interface CallFunctionOnReturnType { - /** - * Call result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface GetPropertiesReturnType { - /** - * Object properties. - */ - result: PropertyDescriptor[]; - /** - * Internal object properties (only of the element itself). - */ - internalProperties?: InternalPropertyDescriptor[]; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface CompileScriptReturnType { - /** - * Id of the script. - */ - scriptId?: ScriptId; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface RunScriptReturnType { - /** - * Run result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails; - } - - interface QueryObjectsReturnType { - /** - * Array with objects. - */ - objects: RemoteObject; - } - - interface GlobalLexicalScopeNamesReturnType { - names: string[]; - } - - interface ExecutionContextCreatedEventDataType { - /** - * A newly created execution context. - */ - context: ExecutionContextDescription; - } - - interface ExecutionContextDestroyedEventDataType { - /** - * Id of the destroyed context - */ - executionContextId: ExecutionContextId; - } - - interface ExceptionThrownEventDataType { - /** - * Timestamp of the exception. - */ - timestamp: Timestamp; - exceptionDetails: ExceptionDetails; - } - - interface ExceptionRevokedEventDataType { - /** - * Reason describing why exception was revoked. - */ - reason: string; - /** - * The id of revoked exception, as reported in exceptionThrown. - */ - exceptionId: number; - } - - interface ConsoleAPICalledEventDataType { - /** - * Type of the call. - */ - type: string; - /** - * Call arguments. - */ - args: RemoteObject[]; - /** - * Identifier of the context where the call was made. - */ - executionContextId: ExecutionContextId; - /** - * Call timestamp. - */ - timestamp: Timestamp; - /** - * Stack trace captured when the call was made. - */ - stackTrace?: StackTrace; - /** - * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. - * @experimental - */ - context?: string; - } - - interface InspectRequestedEventDataType { - object: RemoteObject; - hints: {}; - } - } - - namespace Debugger { - /** - * Breakpoint identifier. - */ - type BreakpointId = string; - - /** - * Call frame identifier. - */ - type CallFrameId = string; - - /** - * Location in the source code. - */ - interface Location { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - } - - /** - * Location in the source code. - * @experimental - */ - interface ScriptPosition { - lineNumber: number; - columnNumber: number; - } - - /** - * JavaScript call frame. Array of call frames form the call stack. - */ - interface CallFrame { - /** - * Call frame identifier. This identifier is only valid while the virtual machine is paused. - */ - callFrameId: CallFrameId; - /** - * Name of the JavaScript function called on this call frame. - */ - functionName: string; - /** - * Location in the source code. - */ - functionLocation?: Location; - /** - * Location in the source code. - */ - location: Location; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Scope chain for this call frame. - */ - scopeChain: Scope[]; - /** - * this object for this call frame. - */ - this: Runtime.RemoteObject; - /** - * The value being returned, if the function is at return point. - */ - returnValue?: Runtime.RemoteObject; - } - - /** - * Scope description. - */ - interface Scope { - /** - * Scope type. - */ - type: string; - /** - * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. - */ - object: Runtime.RemoteObject; - name?: string; - /** - * Location in the source code where scope starts - */ - startLocation?: Location; - /** - * Location in the source code where scope ends - */ - endLocation?: Location; - } - - /** - * Search match for resource. - */ - interface SearchMatch { - /** - * Line number in resource content. - */ - lineNumber: number; - /** - * Line with match content. - */ - lineContent: string; - } - - interface BreakLocation { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - type?: string; - } - - interface SetBreakpointsActiveParameterType { - /** - * New value for breakpoints active state. - */ - active: boolean; - } - - interface SetSkipAllPausesParameterType { - /** - * New value for skip pauses state. - */ - skip: boolean; - } - - interface SetBreakpointByUrlParameterType { - /** - * Line number to set breakpoint at. - */ - lineNumber: number; - /** - * URL of the resources to set breakpoint on. - */ - url?: string; - /** - * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. - */ - urlRegex?: string; - /** - * Script hash of the resources to set breakpoint on. - */ - scriptHash?: string; - /** - * Offset in the line to set breakpoint at. - */ - columnNumber?: number; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - interface SetBreakpointParameterType { - /** - * Location to set breakpoint in. - */ - location: Location; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - interface RemoveBreakpointParameterType { - breakpointId: BreakpointId; - } - - interface GetPossibleBreakpointsParameterType { - /** - * Start of range to search possible breakpoint locations in. - */ - start: Location; - /** - * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. - */ - end?: Location; - /** - * Only consider locations which are in the same (non-nested) function as start. - */ - restrictToFunction?: boolean; - } - - interface ContinueToLocationParameterType { - /** - * Location to continue to. - */ - location: Location; - targetCallFrames?: string; - } - - interface PauseOnAsyncCallParameterType { - /** - * Debugger will pause when async call with given stack trace is started. - */ - parentStackTraceId: Runtime.StackTraceId; - } - - interface StepIntoParameterType { - /** - * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. - * @experimental - */ - breakOnAsyncCall?: boolean; - } - - interface GetStackTraceParameterType { - stackTraceId: Runtime.StackTraceId; - } - - interface SearchInContentParameterType { - /** - * Id of the script to search in. - */ - scriptId: Runtime.ScriptId; - /** - * String to search for. - */ - query: string; - /** - * If true, search is case sensitive. - */ - caseSensitive?: boolean; - /** - * If true, treats string parameter as regex. - */ - isRegex?: boolean; - } - - interface SetScriptSourceParameterType { - /** - * Id of the script to edit. - */ - scriptId: Runtime.ScriptId; - /** - * New content of the script. - */ - scriptSource: string; - /** - * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. - */ - dryRun?: boolean; - } - - interface RestartFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - } - - interface GetScriptSourceParameterType { - /** - * Id of the script to get source for. - */ - scriptId: Runtime.ScriptId; - } - - interface SetPauseOnExceptionsParameterType { - /** - * Pause on exceptions mode. - */ - state: string; - } - - interface EvaluateOnCallFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - /** - * Expression to evaluate. - */ - expression: string; - /** - * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). - */ - objectGroup?: string; - /** - * Specifies whether command line API should be available to the evaluated expression, defaults to false. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether to throw an exception if side effect cannot be ruled out during evaluation. - */ - throwOnSideEffect?: boolean; - } - - interface SetVariableValueParameterType { - /** - * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. - */ - scopeNumber: number; - /** - * Variable name. - */ - variableName: string; - /** - * New variable value. - */ - newValue: Runtime.CallArgument; - /** - * Id of callframe that holds variable. - */ - callFrameId: CallFrameId; - } - - interface SetReturnValueParameterType { - /** - * New return value. - */ - newValue: Runtime.CallArgument; - } - - interface SetAsyncCallStackDepthParameterType { - /** - * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). - */ - maxDepth: number; - } - - interface SetBlackboxPatternsParameterType { - /** - * Array of regexps that will be used to check script url for blackbox state. - */ - patterns: string[]; - } - - interface SetBlackboxedRangesParameterType { - /** - * Id of the script. - */ - scriptId: Runtime.ScriptId; - positions: ScriptPosition[]; - } - - interface EnableReturnType { - /** - * Unique identifier of the debugger. - * @experimental - */ - debuggerId: Runtime.UniqueDebuggerId; - } - - interface SetBreakpointByUrlReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * List of the locations this breakpoint resolved into upon addition. - */ - locations: Location[]; - } - - interface SetBreakpointReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * Location this breakpoint resolved into. - */ - actualLocation: Location; - } - - interface GetPossibleBreakpointsReturnType { - /** - * List of the possible breakpoint locations. - */ - locations: BreakLocation[]; - } - - interface GetStackTraceReturnType { - stackTrace: Runtime.StackTrace; - } - - interface SearchInContentReturnType { - /** - * List of search matches. - */ - result: SearchMatch[]; - } - - interface SetScriptSourceReturnType { - /** - * New stack trace in case editing has happened while VM was stopped. - */ - callFrames?: CallFrame[]; - /** - * Whether current call stack was modified after applying the changes. - */ - stackChanged?: boolean; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - /** - * Exception details if any. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - interface RestartFrameReturnType { - /** - * New stack trace. - */ - callFrames: CallFrame[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - } - - interface GetScriptSourceReturnType { - /** - * Script source. - */ - scriptSource: string; - } - - interface EvaluateOnCallFrameReturnType { - /** - * Object wrapper for the evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - interface ScriptParsedEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * True, if this script is generated as a result of the live edit operation. - * @experimental - */ - isLiveEdit?: boolean; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean; - /** - * This script length. - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - interface ScriptFailedToParseEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean; - /** - * This script length. - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - interface BreakpointResolvedEventDataType { - /** - * Breakpoint unique identifier. - */ - breakpointId: BreakpointId; - /** - * Actual breakpoint location. - */ - location: Location; - } - - interface PausedEventDataType { - /** - * Call stack the virtual machine stopped on. - */ - callFrames: CallFrame[]; - /** - * Pause reason. - */ - reason: string; - /** - * Object containing break-specific auxiliary properties. - */ - data?: {}; - /** - * Hit breakpoints IDs - */ - hitBreakpoints?: string[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId; - /** - * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. - * @experimental - */ - asyncCallStackTraceId?: Runtime.StackTraceId; - } - } - - namespace Console { - /** - * Console message. - */ - interface ConsoleMessage { - /** - * Message source. - */ - source: string; - /** - * Message severity. - */ - level: string; - /** - * Message text. - */ - text: string; - /** - * URL of the message origin. - */ - url?: string; - /** - * Line number in the resource that generated this message (1-based). - */ - line?: number; - /** - * Column number in the resource that generated this message (1-based). - */ - column?: number; - } - - interface MessageAddedEventDataType { - /** - * Console message that has been added. - */ - message: ConsoleMessage; - } - } - - namespace Profiler { - /** - * Profile node. Holds callsite information, execution statistics and child nodes. - */ - interface ProfileNode { - /** - * Unique id of the node. - */ - id: number; - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Number of samples where this node was on top of the call stack. - */ - hitCount?: number; - /** - * Child node ids. - */ - children?: number[]; - /** - * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. - */ - deoptReason?: string; - /** - * An array of source position ticks. - */ - positionTicks?: PositionTickInfo[]; - } - - /** - * Profile. - */ - interface Profile { - /** - * The list of profile nodes. First item is the root node. - */ - nodes: ProfileNode[]; - /** - * Profiling start timestamp in microseconds. - */ - startTime: number; - /** - * Profiling end timestamp in microseconds. - */ - endTime: number; - /** - * Ids of samples top nodes. - */ - samples?: number[]; - /** - * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. - */ - timeDeltas?: number[]; - } - - /** - * Specifies a number of samples attributed to a certain source position. - */ - interface PositionTickInfo { - /** - * Source line number (1-based). - */ - line: number; - /** - * Number of samples attributed to the source line. - */ - ticks: number; - } - - /** - * Coverage data for a source range. - */ - interface CoverageRange { - /** - * JavaScript script source offset for the range start. - */ - startOffset: number; - /** - * JavaScript script source offset for the range end. - */ - endOffset: number; - /** - * Collected execution count of the source range. - */ - count: number; - } - - /** - * Coverage data for a JavaScript function. - */ - interface FunctionCoverage { - /** - * JavaScript function name. - */ - functionName: string; - /** - * Source ranges inside the function with coverage data. - */ - ranges: CoverageRange[]; - /** - * Whether coverage data for this function has block granularity. - */ - isBlockCoverage: boolean; - } - - /** - * Coverage data for a JavaScript script. - */ - interface ScriptCoverage { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Functions contained in the script that has coverage data. - */ - functions: FunctionCoverage[]; - } - - /** - * Describes a type collected during runtime. - * @experimental - */ - interface TypeObject { - /** - * Name of a type collected with type profiling. - */ - name: string; - } - - /** - * Source offset and types for a parameter or return value. - * @experimental - */ - interface TypeProfileEntry { - /** - * Source offset of the parameter or end of function for return values. - */ - offset: number; - /** - * The types for this parameter or return value. - */ - types: TypeObject[]; - } - - /** - * Type profile data collected during runtime for a JavaScript script. - * @experimental - */ - interface ScriptTypeProfile { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Type profile entries for parameters and return values of the functions in the script. - */ - entries: TypeProfileEntry[]; - } - - interface SetSamplingIntervalParameterType { - /** - * New sampling interval in microseconds. - */ - interval: number; - } - - interface StartPreciseCoverageParameterType { - /** - * Collect accurate call counts beyond simple 'covered' or 'not covered'. - */ - callCount?: boolean; - /** - * Collect block-based coverage. - */ - detailed?: boolean; - } - - interface StopReturnType { - /** - * Recorded profile. - */ - profile: Profile; - } - - interface TakePreciseCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - - interface GetBestEffortCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - - interface TakeTypeProfileReturnType { - /** - * Type profile for all scripts since startTypeProfile() was turned on. - */ - result: ScriptTypeProfile[]; - } - - interface ConsoleProfileStartedEventDataType { - id: string; - /** - * Location of console.profile(). - */ - location: Debugger.Location; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - - interface ConsoleProfileFinishedEventDataType { - id: string; - /** - * Location of console.profileEnd(). - */ - location: Debugger.Location; - profile: Profile; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - } - - namespace HeapProfiler { - /** - * Heap snapshot object id. - */ - type HeapSnapshotObjectId = string; - - /** - * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - */ - interface SamplingHeapProfileNode { - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Allocations size in bytes for the node excluding children. - */ - selfSize: number; - /** - * Child nodes. - */ - children: SamplingHeapProfileNode[]; - } - - /** - * Profile. - */ - interface SamplingHeapProfile { - head: SamplingHeapProfileNode; - } - - interface StartTrackingHeapObjectsParameterType { - trackAllocations?: boolean; - } - - interface StopTrackingHeapObjectsParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. - */ - reportProgress?: boolean; - } - - interface TakeHeapSnapshotParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - */ - reportProgress?: boolean; - } - - interface GetObjectByHeapObjectIdParameterType { - objectId: HeapSnapshotObjectId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - } - - interface AddInspectedHeapObjectParameterType { - /** - * Heap snapshot object id to be accessible by means of $x command line API. - */ - heapObjectId: HeapSnapshotObjectId; - } - - interface GetHeapObjectIdParameterType { - /** - * Identifier of the object to get heap object id for. - */ - objectId: Runtime.RemoteObjectId; - } - - interface StartSamplingParameterType { - /** - * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. - */ - samplingInterval?: number; - } - - interface GetObjectByHeapObjectIdReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - } - - interface GetHeapObjectIdReturnType { - /** - * Id of the heap snapshot object corresponding to the passed remote object id. - */ - heapSnapshotObjectId: HeapSnapshotObjectId; - } - - interface StopSamplingReturnType { - /** - * Recorded sampling heap profile. - */ - profile: SamplingHeapProfile; - } - - interface GetSamplingProfileReturnType { - /** - * Return the sampling profile being collected. - */ - profile: SamplingHeapProfile; - } - - interface AddHeapSnapshotChunkEventDataType { - chunk: string; - } - - interface ReportHeapSnapshotProgressEventDataType { - done: number; - total: number; - finished?: boolean; - } - - interface LastSeenObjectIdEventDataType { - lastSeenObjectId: number; - timestamp: number; - } - - interface HeapStatsUpdateEventDataType { - /** - * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. - */ - statsUpdate: number[]; - } - } - - namespace NodeTracing { - interface TraceConfig { - /** - * Controls how the trace buffer stores data. - */ - recordMode?: string; - /** - * Included category filters. - */ - includedCategories: string[]; - } - - interface StartParameterType { - traceConfig: TraceConfig; - } - - interface GetCategoriesReturnType { - /** - * A list of supported tracing categories. - */ - categories: string[]; - } - - interface DataCollectedEventDataType { - value: Array<{}>; - } - } - - namespace NodeWorker { - type WorkerID = string; - - /** - * Unique identifier of attached debugging session. - */ - type SessionID = string; - - interface WorkerInfo { - workerId: WorkerID; - type: string; - title: string; - url: string; - } - - interface SendMessageToWorkerParameterType { - message: string; - /** - * Identifier of the session. - */ - sessionId: SessionID; - } - - interface EnableParameterType { - /** - * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - * message to run them. - */ - waitForDebuggerOnStart: boolean; - } - - interface DetachParameterType { - sessionId: SessionID; - } - - interface AttachedToWorkerEventDataType { - /** - * Identifier assigned to the session used to send/receive messages. - */ - sessionId: SessionID; - workerInfo: WorkerInfo; - waitingForDebugger: boolean; - } - - interface DetachedFromWorkerEventDataType { - /** - * Detached session identifier. - */ - sessionId: SessionID; - } - - interface ReceivedMessageFromWorkerEventDataType { - /** - * Identifier of a session which sends a message. - */ - sessionId: SessionID; - message: string; - } - } - - namespace NodeRuntime { - interface NotifyWhenWaitingForDisconnectParameterType { - enabled: boolean; - } - } - - /** - * The inspector.Session is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications. - */ - class Session extends EventEmitter { - /** - * Create a new instance of the inspector.Session class. - * The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend. - */ - constructor(); - - /** - * Connects a session to the inspector back-end. - * An exception will be thrown if there is already a connected session established either - * through the API or by a front-end connected to the Inspector WebSocket port. - */ - connect(): void; - - /** - * Immediately close the session. All pending message callbacks will be called with an error. - * session.connect() will need to be called to be able to send messages again. - * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. - */ - disconnect(): void; - - /** - * Posts a message to the inspector back-end. callback will be notified when a response is received. - * callback is a function that accepts two optional arguments - error and message-specific result. - */ - post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void; - post(method: string, callback?: (err: Error | null, params?: {}) => void): void; - - /** - * Returns supported domains. - */ - post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; - - /** - * Evaluates expression on global object. - */ - post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - post(method: "Runtime.evaluate", callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - - /** - * Add handler to promise with given promise object id. - */ - post(method: "Runtime.awaitPromise", params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - post(method: "Runtime.awaitPromise", callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - - /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.callFunctionOn", params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - post(method: "Runtime.callFunctionOn", callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - - /** - * Returns properties of a given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.getProperties", params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - post(method: "Runtime.getProperties", callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - - /** - * Releases remote object with given id. - */ - post(method: "Runtime.releaseObject", params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObject", callback?: (err: Error | null) => void): void; - - /** - * Releases all remote objects that belong to a given group. - */ - post(method: "Runtime.releaseObjectGroup", params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObjectGroup", callback?: (err: Error | null) => void): void; - - /** - * Tells inspected instance to run if it was waiting for debugger to attach. - */ - post(method: "Runtime.runIfWaitingForDebugger", callback?: (err: Error | null) => void): void; - - /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. - */ - post(method: "Runtime.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables reporting of execution contexts creation. - */ - post(method: "Runtime.disable", callback?: (err: Error | null) => void): void; - - /** - * Discards collected exceptions and console API calls. - */ - post(method: "Runtime.discardConsoleEntries", callback?: (err: Error | null) => void): void; - - /** - * @experimental - */ - post(method: "Runtime.setCustomObjectFormatterEnabled", params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.setCustomObjectFormatterEnabled", callback?: (err: Error | null) => void): void; - - /** - * Compiles expression. - */ - post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - post(method: "Runtime.compileScript", callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - - /** - * Runs script with given id in a given context. - */ - post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - - post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - - /** - * Returns all let, const and class variables from global scope. - */ - post( - method: "Runtime.globalLexicalScopeNames", - params?: Runtime.GlobalLexicalScopeNamesParameterType, - callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void - ): void; - post(method: "Runtime.globalLexicalScopeNames", callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; - - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: "Debugger.enable", callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; - - /** - * Disables debugger for given page. - */ - post(method: "Debugger.disable", callback?: (err: Error | null) => void): void; - - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBreakpointsActive", callback?: (err: Error | null) => void): void; - - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setSkipAllPauses", callback?: (err: Error | null) => void): void; - - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - post(method: "Debugger.setBreakpointByUrl", callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - post(method: "Debugger.setBreakpoint", callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - - /** - * Removes JavaScript breakpoint. - */ - post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.removeBreakpoint", callback?: (err: Error | null) => void): void; - - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. - */ - post( - method: "Debugger.getPossibleBreakpoints", - params?: Debugger.GetPossibleBreakpointsParameterType, - callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void - ): void; - post(method: "Debugger.getPossibleBreakpoints", callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - - /** - * Continues execution until specific location is reached. - */ - post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.continueToLocation", callback?: (err: Error | null) => void): void; - - /** - * @experimental - */ - post(method: "Debugger.pauseOnAsyncCall", params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.pauseOnAsyncCall", callback?: (err: Error | null) => void): void; - - /** - * Steps over the statement. - */ - post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void; - - /** - * Steps into the function call. - */ - post(method: "Debugger.stepInto", params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.stepInto", callback?: (err: Error | null) => void): void; - - /** - * Steps out of the function call. - */ - post(method: "Debugger.stepOut", callback?: (err: Error | null) => void): void; - - /** - * Stops on the next JavaScript statement. - */ - post(method: "Debugger.pause", callback?: (err: Error | null) => void): void; - - /** - * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: "Debugger.scheduleStepIntoAsync", callback?: (err: Error | null) => void): void; - - /** - * Resumes JavaScript execution. - */ - post(method: "Debugger.resume", callback?: (err: Error | null) => void): void; - - /** - * Returns stack trace with given stackTraceId. - * @experimental - */ - post(method: "Debugger.getStackTrace", params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - post(method: "Debugger.getStackTrace", callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - - /** - * Searches for given string in script content. - */ - post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - post(method: "Debugger.searchInContent", callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - - /** - * Edits JavaScript source live. - */ - post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - post(method: "Debugger.setScriptSource", callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - - /** - * Restarts particular call frame from the beginning. - */ - post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - post(method: "Debugger.restartFrame", callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - - /** - * Returns source for the script with given id. - */ - post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - post(method: "Debugger.getScriptSource", callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setPauseOnExceptions", callback?: (err: Error | null) => void): void; - - /** - * Evaluates expression on a given call frame. - */ - post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - post(method: "Debugger.evaluateOnCallFrame", callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setVariableValue", callback?: (err: Error | null) => void): void; - - /** - * Changes return value in top frame. Available only at return break position. - * @experimental - */ - post(method: "Debugger.setReturnValue", params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setReturnValue", callback?: (err: Error | null) => void): void; - - /** - * Enables or disables async call stacks tracking. - */ - post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setAsyncCallStackDepth", callback?: (err: Error | null) => void): void; - - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxPatterns", callback?: (err: Error | null) => void): void; - - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxedRanges", callback?: (err: Error | null) => void): void; - - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: "Console.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: "Console.disable", callback?: (err: Error | null) => void): void; - - /** - * Does nothing. - */ - post(method: "Console.clearMessages", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.disable", callback?: (err: Error | null) => void): void; - - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.setSamplingInterval", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.start", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.stop", callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; - - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - */ - post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.startPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - */ - post(method: "Profiler.stopPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - */ - post(method: "Profiler.takePreciseCoverage", callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; - - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - */ - post(method: "Profiler.getBestEffortCoverage", callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; - - /** - * Enable type profile. - * @experimental - */ - post(method: "Profiler.startTypeProfile", callback?: (err: Error | null) => void): void; - - /** - * Disable type profile. Disabling releases type profile data collected so far. - * @experimental - */ - post(method: "Profiler.stopTypeProfile", callback?: (err: Error | null) => void): void; - - /** - * Collect type profile. - * @experimental - */ - post(method: "Profiler.takeTypeProfile", callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; - - post(method: "HeapProfiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.disable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.stopTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.collectGarbage", callback?: (err: Error | null) => void): void; - - post( - method: "HeapProfiler.getObjectByHeapObjectId", - params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, - callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void - ): void; - post(method: "HeapProfiler.getObjectByHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.addInspectedHeapObject", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: "HeapProfiler.getHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - - post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startSampling", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; - - post(method: "HeapProfiler.getSamplingProfile", callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; - - /** - * Gets supported tracing categories. - */ - post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; - - /** - * Start trace events collection. - */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void; - - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void; - - /** - * Sends protocol message over session with given id. - */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void; - - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void; - - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void; - - /** - * Detached from the worker with given sessionId. - */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void; - - /** - * Enable the `NodeRuntime.waitingForDisconnect`. - */ - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", callback?: (err: Error | null) => void): void; - - // Events - - addListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - addListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - addListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - addListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - addListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - addListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - addListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "inspectorNotification", message: InspectorNotification<{}>): boolean; - emit(event: "Runtime.executionContextCreated", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextsCleared"): boolean; - emit(event: "Runtime.exceptionThrown", message: InspectorNotification): boolean; - emit(event: "Runtime.exceptionRevoked", message: InspectorNotification): boolean; - emit(event: "Runtime.consoleAPICalled", message: InspectorNotification): boolean; - emit(event: "Runtime.inspectRequested", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptParsed", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification): boolean; - emit(event: "Debugger.breakpointResolved", message: InspectorNotification): boolean; - emit(event: "Debugger.paused", message: InspectorNotification): boolean; - emit(event: "Debugger.resumed"): boolean; - emit(event: "Console.messageAdded", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.addHeapSnapshotChunk", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.resetProfiles"): boolean; - emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; - emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; - emit(event: "NodeTracing.tracingComplete"): boolean; - emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeRuntime.waitingForDisconnect"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - on(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - on(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - on(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - on(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - on(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - on(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.resetProfiles", listener: () => void): this; - on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - on(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - once(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - once(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - once(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - once(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - once(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - once(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.resetProfiles", listener: () => void): this; - once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - once(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - prependListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependOnceListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; - - /** - * Issued when new execution context is created. - */ - prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependOnceListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependOnceListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when the virtual machine resumed execution. - */ - prependOnceListener(event: "Debugger.resumed", listener: () => void): this; - - /** - * Issued when new console message is added. - */ - prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependOnceListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - - prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependOnceListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - } - - // Top Level API - - /** - * Activate inspector on host and port. Equivalent to node --inspect=[[host:]port], but can be done programatically after node has started. - * If wait is true, will block until a client has connected to the inspect port and flow control has been passed to the debugger client. - * @param port Port to listen on for inspector connections. Optional, defaults to what was specified on the CLI. - * @param host Host to listen on for inspector connections. Optional, defaults to what was specified on the CLI. - * @param wait Block until a client has connected. Optional, defaults to false. - */ - function open(port?: number, host?: string, wait?: boolean): void; - - /** - * Deactivate the inspector. Blocks until there are no active connections. - */ - function close(): void; - - /** - * Return the URL of the active inspector, or `undefined` if there is none. - */ - function url(): string | undefined; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/module.d.ts b/node_modules/protobufjs/node_modules/@types/node/module.d.ts deleted file mode 100644 index 2654f421..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/module.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -declare module "module" { - import { URL } from "url"; - namespace Module { - /** - * Updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports. - * It does not add or remove exported names from the ES Modules. - */ - function syncBuiltinESMExports(): void; - - /** - * @experimental - */ - function findSourceMap(path: string, error?: Error): SourceMap; - interface SourceMapPayload { - file: string; - version: number; - sources: string[]; - sourcesContent: string[]; - names: string[]; - mappings: string; - sourceRoot: string; - } - - interface SourceMapping { - generatedLine: number; - generatedColumn: number; - originalSource: string; - originalLine: number; - originalColumn: number; - } - - /** - * @experimental - */ - class SourceMap { - readonly payload: SourceMapPayload; - constructor(payload: SourceMapPayload); - findEntry(line: number, column: number): SourceMapping; - } - } - interface Module extends NodeModule {} - class Module { - static runMain(): void; - static wrap(code: string): string; - - /** - * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead. - */ - static createRequireFromPath(path: string): NodeRequire; - static createRequire(path: string | URL): NodeRequire; - static builtinModules: string[]; - - static Module: typeof Module; - - constructor(id: string, parent?: Module); - } - export = Module; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/net.d.ts b/node_modules/protobufjs/node_modules/@types/node/net.d.ts deleted file mode 100644 index 8eb5c7b1..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/net.d.ts +++ /dev/null @@ -1,268 +0,0 @@ -declare module "net" { - import * as stream from "stream"; - import * as events from "events"; - import * as dns from "dns"; - - type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; - - interface AddressInfo { - address: string; - family: string; - port: number; - } - - interface SocketConstructorOpts { - fd?: number; - allowHalfOpen?: boolean; - readable?: boolean; - writable?: boolean; - } - - interface OnReadOpts { - buffer: Uint8Array | (() => Uint8Array); - /** - * This function is called for every chunk of incoming data. - * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer. - * Return false from this function to implicitly pause() the socket. - */ - callback(bytesWritten: number, buf: Uint8Array): boolean; - } - - interface ConnectOpts { - /** - * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket. - * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will - * still be emitted as normal and methods like pause() and resume() will also behave as expected. - */ - onread?: OnReadOpts; - } - - interface TcpSocketConnectOpts extends ConnectOpts { - port: number; - host?: string; - localAddress?: string; - localPort?: number; - hints?: number; - family?: number; - lookup?: LookupFunction; - } - - interface IpcSocketConnectOpts extends ConnectOpts { - path: string; - } - - type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; - - class Socket extends stream.Duplex { - constructor(options?: SocketConstructorOpts); - - // Extended base methods - write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; - write(str: Uint8Array | string, encoding?: string, cb?: (err?: Error) => void): boolean; - - connect(options: SocketConnectOpts, connectionListener?: () => void): this; - connect(port: number, host: string, connectionListener?: () => void): this; - connect(port: number, connectionListener?: () => void): this; - connect(path: string, connectionListener?: () => void): this; - - setEncoding(encoding?: string): this; - pause(): this; - resume(): this; - setTimeout(timeout: number, callback?: () => void): this; - setNoDelay(noDelay?: boolean): this; - setKeepAlive(enable?: boolean, initialDelay?: number): this; - address(): AddressInfo | string; - unref(): this; - ref(): this; - - readonly bufferSize: number; - readonly bytesRead: number; - readonly bytesWritten: number; - readonly connecting: boolean; - readonly destroyed: boolean; - readonly localAddress: string; - readonly localPort: number; - readonly remoteAddress?: string; - readonly remoteFamily?: string; - readonly remotePort?: number; - - // Extended base methods - end(cb?: () => void): void; - end(buffer: Uint8Array | string, cb?: () => void): void; - end(str: Uint8Array | string, encoding?: string, cb?: () => void): void; - - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. data - * 4. drain - * 5. end - * 6. error - * 7. lookup - * 8. timeout - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (had_error: boolean) => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "data", listener: (data: Buffer) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - addListener(event: "timeout", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", had_error: boolean): boolean; - emit(event: "connect"): boolean; - emit(event: "data", data: Buffer): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean; - emit(event: "timeout"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (had_error: boolean) => void): this; - on(event: "connect", listener: () => void): this; - on(event: "data", listener: (data: Buffer) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - on(event: "timeout", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (had_error: boolean) => void): this; - once(event: "connect", listener: () => void): this; - once(event: "data", listener: (data: Buffer) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - once(event: "timeout", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (had_error: boolean) => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "data", listener: (data: Buffer) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - prependListener(event: "timeout", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (had_error: boolean) => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "data", listener: (data: Buffer) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - } - - interface ListenOptions { - port?: number; - host?: string; - backlog?: number; - path?: string; - exclusive?: boolean; - readableAll?: boolean; - writableAll?: boolean; - /** - * @default false - */ - ipv6Only?: boolean; - } - - // https://github.com/nodejs/node/blob/master/lib/net.js - class Server extends events.EventEmitter { - constructor(connectionListener?: (socket: Socket) => void); - constructor(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void); - - listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, hostname?: string, listeningListener?: () => void): this; - listen(port?: number, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, listeningListener?: () => void): this; - listen(path: string, backlog?: number, listeningListener?: () => void): this; - listen(path: string, listeningListener?: () => void): this; - listen(options: ListenOptions, listeningListener?: () => void): this; - listen(handle: any, backlog?: number, listeningListener?: () => void): this; - listen(handle: any, listeningListener?: () => void): this; - close(callback?: (err?: Error) => void): this; - address(): AddressInfo | string | null; - getConnections(cb: (error: Error | null, count: number) => void): void; - ref(): this; - unref(): this; - maxConnections: number; - connections: number; - listening: boolean; - - /** - * events.EventEmitter - * 1. close - * 2. connection - * 3. error - * 4. listening - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - } - - interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { - timeout?: number; - } - - interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { - timeout?: number; - } - - type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; - - function createServer(connectionListener?: (socket: Socket) => void): Server; - function createServer(options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean }, connectionListener?: (socket: Socket) => void): Server; - function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; - function connect(port: number, host?: string, connectionListener?: () => void): Socket; - function connect(path: string, connectionListener?: () => void): Socket; - function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; - function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; - function createConnection(path: string, connectionListener?: () => void): Socket; - function isIP(input: string): number; - function isIPv4(input: string): boolean; - function isIPv6(input: string): boolean; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/os.d.ts b/node_modules/protobufjs/node_modules/@types/node/os.d.ts deleted file mode 100644 index d98a145f..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/os.d.ts +++ /dev/null @@ -1,239 +0,0 @@ -declare module "os" { - interface CpuInfo { - model: string; - speed: number; - times: { - user: number; - nice: number; - sys: number; - idle: number; - irq: number; - }; - } - - interface NetworkInterfaceBase { - address: string; - netmask: string; - mac: string; - internal: boolean; - cidr: string | null; - } - - interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { - family: "IPv4"; - } - - interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { - family: "IPv6"; - scopeid: number; - } - - interface UserInfo { - username: T; - uid: number; - gid: number; - shell: T; - homedir: T; - } - - type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; - - function hostname(): string; - function loadavg(): number[]; - function uptime(): number; - function freemem(): number; - function totalmem(): number; - function cpus(): CpuInfo[]; - function type(): string; - function release(): string; - function networkInterfaces(): NodeJS.Dict; - function homedir(): string; - function userInfo(options: { encoding: 'buffer' }): UserInfo; - function userInfo(options?: { encoding: string }): UserInfo; - - type SignalConstants = { - [key in NodeJS.Signals]: number; - }; - - namespace constants { - const UV_UDP_REUSEADDR: number; - namespace signals {} - const signals: SignalConstants; - namespace errno { - const E2BIG: number; - const EACCES: number; - const EADDRINUSE: number; - const EADDRNOTAVAIL: number; - const EAFNOSUPPORT: number; - const EAGAIN: number; - const EALREADY: number; - const EBADF: number; - const EBADMSG: number; - const EBUSY: number; - const ECANCELED: number; - const ECHILD: number; - const ECONNABORTED: number; - const ECONNREFUSED: number; - const ECONNRESET: number; - const EDEADLK: number; - const EDESTADDRREQ: number; - const EDOM: number; - const EDQUOT: number; - const EEXIST: number; - const EFAULT: number; - const EFBIG: number; - const EHOSTUNREACH: number; - const EIDRM: number; - const EILSEQ: number; - const EINPROGRESS: number; - const EINTR: number; - const EINVAL: number; - const EIO: number; - const EISCONN: number; - const EISDIR: number; - const ELOOP: number; - const EMFILE: number; - const EMLINK: number; - const EMSGSIZE: number; - const EMULTIHOP: number; - const ENAMETOOLONG: number; - const ENETDOWN: number; - const ENETRESET: number; - const ENETUNREACH: number; - const ENFILE: number; - const ENOBUFS: number; - const ENODATA: number; - const ENODEV: number; - const ENOENT: number; - const ENOEXEC: number; - const ENOLCK: number; - const ENOLINK: number; - const ENOMEM: number; - const ENOMSG: number; - const ENOPROTOOPT: number; - const ENOSPC: number; - const ENOSR: number; - const ENOSTR: number; - const ENOSYS: number; - const ENOTCONN: number; - const ENOTDIR: number; - const ENOTEMPTY: number; - const ENOTSOCK: number; - const ENOTSUP: number; - const ENOTTY: number; - const ENXIO: number; - const EOPNOTSUPP: number; - const EOVERFLOW: number; - const EPERM: number; - const EPIPE: number; - const EPROTO: number; - const EPROTONOSUPPORT: number; - const EPROTOTYPE: number; - const ERANGE: number; - const EROFS: number; - const ESPIPE: number; - const ESRCH: number; - const ESTALE: number; - const ETIME: number; - const ETIMEDOUT: number; - const ETXTBSY: number; - const EWOULDBLOCK: number; - const EXDEV: number; - const WSAEINTR: number; - const WSAEBADF: number; - const WSAEACCES: number; - const WSAEFAULT: number; - const WSAEINVAL: number; - const WSAEMFILE: number; - const WSAEWOULDBLOCK: number; - const WSAEINPROGRESS: number; - const WSAEALREADY: number; - const WSAENOTSOCK: number; - const WSAEDESTADDRREQ: number; - const WSAEMSGSIZE: number; - const WSAEPROTOTYPE: number; - const WSAENOPROTOOPT: number; - const WSAEPROTONOSUPPORT: number; - const WSAESOCKTNOSUPPORT: number; - const WSAEOPNOTSUPP: number; - const WSAEPFNOSUPPORT: number; - const WSAEAFNOSUPPORT: number; - const WSAEADDRINUSE: number; - const WSAEADDRNOTAVAIL: number; - const WSAENETDOWN: number; - const WSAENETUNREACH: number; - const WSAENETRESET: number; - const WSAECONNABORTED: number; - const WSAECONNRESET: number; - const WSAENOBUFS: number; - const WSAEISCONN: number; - const WSAENOTCONN: number; - const WSAESHUTDOWN: number; - const WSAETOOMANYREFS: number; - const WSAETIMEDOUT: number; - const WSAECONNREFUSED: number; - const WSAELOOP: number; - const WSAENAMETOOLONG: number; - const WSAEHOSTDOWN: number; - const WSAEHOSTUNREACH: number; - const WSAENOTEMPTY: number; - const WSAEPROCLIM: number; - const WSAEUSERS: number; - const WSAEDQUOT: number; - const WSAESTALE: number; - const WSAEREMOTE: number; - const WSASYSNOTREADY: number; - const WSAVERNOTSUPPORTED: number; - const WSANOTINITIALISED: number; - const WSAEDISCON: number; - const WSAENOMORE: number; - const WSAECANCELLED: number; - const WSAEINVALIDPROCTABLE: number; - const WSAEINVALIDPROVIDER: number; - const WSAEPROVIDERFAILEDINIT: number; - const WSASYSCALLFAILURE: number; - const WSASERVICE_NOT_FOUND: number; - const WSATYPE_NOT_FOUND: number; - const WSA_E_NO_MORE: number; - const WSA_E_CANCELLED: number; - const WSAEREFUSED: number; - } - namespace priority { - const PRIORITY_LOW: number; - const PRIORITY_BELOW_NORMAL: number; - const PRIORITY_NORMAL: number; - const PRIORITY_ABOVE_NORMAL: number; - const PRIORITY_HIGH: number; - const PRIORITY_HIGHEST: number; - } - } - - function arch(): string; - /** - * Returns a string identifying the kernel version. - * On POSIX systems, the operating system release is determined by calling - * [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available, - * `GetVersionExW()` will be used. See - * https://en.wikipedia.org/wiki/Uname#Examples for more information. - */ - function version(): string; - function platform(): NodeJS.Platform; - function tmpdir(): string; - const EOL: string; - function endianness(): "BE" | "LE"; - /** - * Gets the priority of a process. - * Defaults to current process. - */ - function getPriority(pid?: number): number; - /** - * Sets the priority of the current process. - * @param priority Must be in range of -20 to 19 - */ - function setPriority(priority: number): void; - /** - * Sets the priority of the process specified process. - * @param priority Must be in range of -20 to 19 - */ - function setPriority(pid: number, priority: number): void; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/package.json b/node_modules/protobufjs/node_modules/@types/node/package.json deleted file mode 100644 index e97cacf4..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/package.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "_from": "@types/node@^13.7.0", - "_id": "@types/node@13.13.33", - "_inBundle": false, - "_integrity": "sha512-1B3GM1yuYsFyEvBb+ljBqWBOylsWDYioZ5wpu8AhXdIhq20neXS7eaSC8GkwHE0yQYGiOIV43lMsgRYTgKZefQ==", - "_location": "/protobufjs/@types/node", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@types/node@^13.7.0", - "name": "@types/node", - "escapedName": "@types%2fnode", - "scope": "@types", - "rawSpec": "^13.7.0", - "saveSpec": null, - "fetchSpec": "^13.7.0" - }, - "_requiredBy": [ - "/protobufjs" - ], - "_resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.33.tgz", - "_shasum": "300e65e0b465bda102b9845d172d8d45726a2dd8", - "_spec": "@types/node@^13.7.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/protobufjs", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Microsoft TypeScript", - "url": "https://github.com/Microsoft" - }, - { - "name": "DefinitelyTyped", - "url": "https://github.com/DefinitelyTyped" - }, - { - "name": "Alberto Schiabel", - "url": "https://github.com/jkomyno" - }, - { - "name": "Alexander T.", - "url": "https://github.com/a-tarasyuk" - }, - { - "name": "Alvis HT Tang", - "url": "https://github.com/alvis" - }, - { - "name": "Andrew Makarov", - "url": "https://github.com/r3nya" - }, - { - "name": "Benjamin Toueg", - "url": "https://github.com/btoueg" - }, - { - "name": "Bruno Scheufler", - "url": "https://github.com/brunoscheufler" - }, - { - "name": "Chigozirim C.", - "url": "https://github.com/smac89" - }, - { - "name": "Christian Vaagland Tellnes", - "url": "https://github.com/tellnes" - }, - { - "name": "David Junger", - "url": "https://github.com/touffy" - }, - { - "name": "Deividas Bakanas", - "url": "https://github.com/DeividasBakanas" - }, - { - "name": "Eugene Y. Q. Shen", - "url": "https://github.com/eyqs" - }, - { - "name": "Flarna", - "url": "https://github.com/Flarna" - }, - { - "name": "Hannes Magnusson", - "url": "https://github.com/Hannes-Magnusson-CK" - }, - { - "name": "Hoàng Văn Khải", - "url": "https://github.com/KSXGitHub" - }, - { - "name": "Huw", - "url": "https://github.com/hoo29" - }, - { - "name": "Kelvin Jin", - "url": "https://github.com/kjin" - }, - { - "name": "Klaus Meinhardt", - "url": "https://github.com/ajafff" - }, - { - "name": "Lishude", - "url": "https://github.com/islishude" - }, - { - "name": "Mariusz Wiktorczyk", - "url": "https://github.com/mwiktorczyk" - }, - { - "name": "Mohsen Azimi", - "url": "https://github.com/mohsen1" - }, - { - "name": "Nicolas Even", - "url": "https://github.com/n-e" - }, - { - "name": "Nikita Galkin", - "url": "https://github.com/galkin" - }, - { - "name": "Parambir Singh", - "url": "https://github.com/parambirs" - }, - { - "name": "Sebastian Silbermann", - "url": "https://github.com/eps1lon" - }, - { - "name": "Simon Schick", - "url": "https://github.com/SimonSchick" - }, - { - "name": "Thomas den Hollander", - "url": "https://github.com/ThomasdenH" - }, - { - "name": "Wilco Bakker", - "url": "https://github.com/WilcoBakker" - }, - { - "name": "wwwy3y3", - "url": "https://github.com/wwwy3y3" - }, - { - "name": "Samuel Ainsworth", - "url": "https://github.com/samuela" - }, - { - "name": "Kyle Uehlein", - "url": "https://github.com/kuehlein" - }, - { - "name": "Jordi Oliveras Rovira", - "url": "https://github.com/j-oliveras" - }, - { - "name": "Thanik Bhongbhibhat", - "url": "https://github.com/bhongy" - }, - { - "name": "Marcin Kopacz", - "url": "https://github.com/chyzwar" - }, - { - "name": "Trivikram Kamat", - "url": "https://github.com/trivikr" - }, - { - "name": "Minh Son Nguyen", - "url": "https://github.com/nguymin4" - }, - { - "name": "Junxiao Shi", - "url": "https://github.com/yoursunny" - }, - { - "name": "Ilia Baryshnikov", - "url": "https://github.com/qwelias" - }, - { - "name": "ExE Boss", - "url": "https://github.com/ExE-Boss" - }, - { - "name": "Surasak Chaisurin", - "url": "https://github.com/Ryan-Willpower" - }, - { - "name": "Piotr Błażejewicz", - "url": "https://github.com/peterblazejewicz" - }, - { - "name": "Jason Kwok", - "url": "https://github.com/JasonHK" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for Node.js", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/node", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/node" - }, - "scripts": {}, - "typeScriptVersion": "3.3", - "types": "index.d.ts", - "typesPublisherContentHash": "3cb6c9b6c845929226282279c56d9d07072cfd7e01b3cca1f65948a277b4f6f8", - "typesVersions": { - "<=3.4": { - "*": [ - "ts3.4/*" - ] - }, - "<=3.6": { - "*": [ - "ts3.6/*" - ] - } - }, - "version": "13.13.33" -} diff --git a/node_modules/protobufjs/node_modules/@types/node/path.d.ts b/node_modules/protobufjs/node_modules/@types/node/path.d.ts deleted file mode 100644 index 0273d58e..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/path.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -declare module "path" { - namespace path { - /** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ - interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; - } - - interface FormatInputPathObject { - /** - * The root of the path such as '/' or 'c:\' - */ - root?: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir?: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base?: string; - /** - * The file extension (if any) such as '.html' - */ - ext?: string; - /** - * The file name without extension (if any) such as 'index' - */ - name?: string; - } - - interface PlatformPath { - /** - * Normalize a string path, reducing '..' and '.' parts. - * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. - * - * @param p string path to normalize. - */ - normalize(p: string): string; - /** - * Join all arguments together and normalize the resulting path. - * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. - * - * @param paths paths to join. - */ - join(...paths: string[]): string; - /** - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - * - * Starting from leftmost {from} parameter, resolves {to} to an absolute path. - * - * If {to} isn't already absolute, {from} arguments are prepended in right to left order, - * until an absolute path is found. If after using all {from} paths still no absolute path is found, - * the current working directory is used as well. The resulting path is normalized, - * and trailing slashes are removed unless the path gets resolved to the root directory. - * - * @param pathSegments string paths to join. Non-string arguments are ignored. - */ - resolve(...pathSegments: string[]): string; - /** - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - * - * @param path path to test. - */ - isAbsolute(p: string): boolean; - /** - * Solve the relative path from {from} to {to}. - * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. - */ - relative(from: string, to: string): string; - /** - * Return the directory name of a path. Similar to the Unix dirname command. - * - * @param p the path to evaluate. - */ - dirname(p: string): string; - /** - * Return the last portion of a path. Similar to the Unix basename command. - * Often used to extract the file name from a fully qualified path. - * - * @param p the path to evaluate. - * @param ext optionally, an extension to remove from the result. - */ - basename(p: string, ext?: string): string; - /** - * Return the extension of the path, from the last '.' to end of string in the last portion of the path. - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string - * - * @param p the path to evaluate. - */ - extname(p: string): string; - /** - * The platform-specific file separator. '\\' or '/'. - */ - readonly sep: string; - /** - * The platform-specific file delimiter. ';' or ':'. - */ - readonly delimiter: string; - /** - * Returns an object from a path string - the opposite of format(). - * - * @param pathString path to evaluate. - */ - parse(p: string): ParsedPath; - /** - * Returns a path string from an object - the opposite of parse(). - * - * @param pathString path to evaluate. - */ - format(pP: FormatInputPathObject): string; - /** - * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. - * If path is not a string, path will be returned without modifications. - * This method is meaningful only on Windows system. - * On POSIX systems, the method is non-operational and always returns path without modifications. - */ - toNamespacedPath(path: string): string; - /** - * Posix specific pathing. - * Same as parent object on posix. - */ - readonly posix: PlatformPath; - /** - * Windows specific pathing. - * Same as parent object on windows - */ - readonly win32: PlatformPath; - } - } - const path: path.PlatformPath; - export = path; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/perf_hooks.d.ts b/node_modules/protobufjs/node_modules/@types/node/perf_hooks.d.ts deleted file mode 100644 index a12082e3..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/perf_hooks.d.ts +++ /dev/null @@ -1,255 +0,0 @@ -declare module 'perf_hooks' { - import { AsyncResource } from 'async_hooks'; - - type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http'; - - interface PerformanceEntry { - /** - * The total number of milliseconds elapsed for this entry. - * This value will not be meaningful for all Performance Entry types. - */ - readonly duration: number; - - /** - * The name of the performance entry. - */ - readonly name: string; - - /** - * The high resolution millisecond timestamp marking the starting time of the Performance Entry. - */ - readonly startTime: number; - - /** - * The type of the performance entry. - * Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'. - */ - readonly entryType: EntryType; - - /** - * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies - * the type of garbage collection operation that occurred. - * See perf_hooks.constants for valid values. - */ - readonly kind?: number; - - /** - * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` - * property contains additional information about garbage collection operation. - * See perf_hooks.constants for valid values. - */ - readonly flags?: number; - } - - interface PerformanceNodeTiming extends PerformanceEntry { - /** - * The high resolution millisecond timestamp at which the Node.js process completed bootstrap. - * If bootstrapping has not yet finished, the property has the value of -1. - */ - readonly bootstrapComplete: number; - - /** - * The high resolution millisecond timestamp at which the Node.js process completed bootstrapping. - * If bootstrapping has not yet finished, the property has the value of -1. - */ - readonly environment: number; - - /** - * The high resolution millisecond timestamp at which the Node.js event loop exited. - * If the event loop has not yet exited, the property has the value of -1. - * It can only have a value of not -1 in a handler of the 'exit' event. - */ - readonly loopExit: number; - - /** - * The high resolution millisecond timestamp at which the Node.js event loop started. - * If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of -1. - */ - readonly loopStart: number; - - /** - * The high resolution millisecond timestamp at which the Node.js process was initialized. - */ - readonly nodeStart: number; - - /** - * The high resolution millisecond timestamp at which the V8 platform was initialized. - */ - readonly v8Start: number; - } - - interface Performance { - /** - * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. - * If name is provided, removes only the named mark. - * @param name - */ - clearMarks(name?: string): void; - - /** - * Creates a new PerformanceMark entry in the Performance Timeline. - * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', - * and whose performanceEntry.duration is always 0. - * Performance marks are used to mark specific significant moments in the Performance Timeline. - * @param name - */ - mark(name?: string): void; - - /** - * Creates a new PerformanceMeasure entry in the Performance Timeline. - * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', - * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. - * - * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify - * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, - * then startMark is set to timeOrigin by default. - * - * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp - * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. - * @param name - * @param startMark - * @param endMark - */ - measure(name: string, startMark: string, endMark: string): void; - - /** - * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. - */ - readonly nodeTiming: PerformanceNodeTiming; - - /** - * @return the current high resolution millisecond timestamp - */ - now(): number; - - /** - * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. - */ - readonly timeOrigin: number; - - /** - * Wraps a function within a new function that measures the running time of the wrapped function. - * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. - * @param fn - */ - timerify any>(fn: T): T; - } - - interface PerformanceObserverEntryList { - /** - * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime. - */ - getEntries(): PerformanceEntry[]; - - /** - * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type. - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - - /** - * @return Returns a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime - * whose performanceEntry.entryType is equal to type. - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - } - - type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; - - class PerformanceObserver extends AsyncResource { - constructor(callback: PerformanceObserverCallback); - - /** - * Disconnects the PerformanceObserver instance from all notifications. - */ - disconnect(): void; - - /** - * Subscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified by options.entryTypes. - * When options.buffered is false, the callback will be invoked once for every PerformanceEntry instance. - * Property buffered defaults to false. - * @param options - */ - observe(options: { entryTypes: ReadonlyArray; buffered?: boolean }): void; - } - - namespace constants { - const NODE_PERFORMANCE_GC_MAJOR: number; - const NODE_PERFORMANCE_GC_MINOR: number; - const NODE_PERFORMANCE_GC_INCREMENTAL: number; - const NODE_PERFORMANCE_GC_WEAKCB: number; - - const NODE_PERFORMANCE_GC_FLAGS_NO: number; - const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; - const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; - const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; - const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; - } - - const performance: Performance; - - interface EventLoopMonitorOptions { - /** - * The sampling rate in milliseconds. - * Must be greater than zero. - * @default 10 - */ - resolution?: number; - } - - interface EventLoopDelayMonitor { - /** - * Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started. - */ - enable(): boolean; - /** - * Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped. - */ - disable(): boolean; - - /** - * Resets the collected histogram data. - */ - reset(): void; - - /** - * Returns the value at the given percentile. - * @param percentile A percentile value between 1 and 100. - */ - percentile(percentile: number): number; - - /** - * A `Map` object detailing the accumulated percentile distribution. - */ - readonly percentiles: Map; - - /** - * The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold. - */ - readonly exceeds: number; - - /** - * The minimum recorded event loop delay. - */ - readonly min: number; - - /** - * The maximum recorded event loop delay. - */ - readonly max: number; - - /** - * The mean of the recorded event loop delays. - */ - readonly mean: number; - - /** - * The standard deviation of the recorded event loop delays. - */ - readonly stddev: number; - } - - function monitorEventLoopDelay(options?: EventLoopMonitorOptions): EventLoopDelayMonitor; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/process.d.ts b/node_modules/protobufjs/node_modules/@types/node/process.d.ts deleted file mode 100644 index d007d4e0..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/process.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare module "process" { - import * as tty from "tty"; - - global { - namespace NodeJS { - // this namespace merge is here because these are specifically used - // as the type for process.stdin, process.stdout, and process.stderr. - // they can't live in tty.d.ts because we need to disambiguate the imported name. - interface ReadStream extends tty.ReadStream {} - interface WriteStream extends tty.WriteStream {} - } - } - - export = process; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/punycode.d.ts b/node_modules/protobufjs/node_modules/@types/node/punycode.d.ts deleted file mode 100644 index 2b771d45..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/punycode.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -declare module "punycode" { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function decode(string: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function encode(string: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function toUnicode(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - function toASCII(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const ucs2: ucs2; - interface ucs2 { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - decode(string: string): number[]; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - encode(codePoints: ReadonlyArray): string; - } - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const version: string; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/querystring.d.ts b/node_modules/protobufjs/node_modules/@types/node/querystring.d.ts deleted file mode 100644 index be1bbf90..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/querystring.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -declare module "querystring" { - interface StringifyOptions { - encodeURIComponent?: (str: string) => string; - } - - interface ParseOptions { - maxKeys?: number; - decodeURIComponent?: (str: string) => string; - } - - interface ParsedUrlQuery extends NodeJS.Dict { } - - interface ParsedUrlQueryInput extends NodeJS.Dict { - } - - function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; - function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; - /** - * The querystring.encode() function is an alias for querystring.stringify(). - */ - const encode: typeof stringify; - /** - * The querystring.decode() function is an alias for querystring.parse(). - */ - const decode: typeof parse; - function escape(str: string): string; - function unescape(str: string): string; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/readline.d.ts b/node_modules/protobufjs/node_modules/@types/node/readline.d.ts deleted file mode 100644 index fbe4836f..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/readline.d.ts +++ /dev/null @@ -1,171 +0,0 @@ -declare module "readline" { - import * as events from "events"; - import * as stream from "stream"; - - interface Key { - sequence?: string; - name?: string; - ctrl?: boolean; - meta?: boolean; - shift?: boolean; - } - - class Interface extends events.EventEmitter { - readonly terminal: boolean; - - // Need direct access to line/cursor data, for use in external processes - // see: https://github.com/nodejs/node/issues/30347 - /** The current input data */ - readonly line: string; - /** The current cursor position in the input line */ - readonly cursor: number; - - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface - */ - protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface - */ - protected constructor(options: ReadLineOptions); - - setPrompt(prompt: string): void; - prompt(preserveCursor?: boolean): void; - question(query: string, callback: (answer: string) => void): void; - pause(): this; - resume(): this; - close(): void; - write(data: string | Buffer, key?: Key): void; - - /** - * Returns the real position of the cursor in relation to the input - * prompt + string. Long input (wrapping) strings, as well as multiple - * line prompts are included in the calculations. - */ - getCursorPos(): CursorPos; - - /** - * events.EventEmitter - * 1. close - * 2. line - * 3. pause - * 4. resume - * 5. SIGCONT - * 6. SIGINT - * 7. SIGTSTP - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - type ReadLine = Interface; // type forwarded for backwards compatiblity - - type Completer = (line: string) => CompleterResult; - type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any; - - type CompleterResult = [string[], string]; - - interface ReadLineOptions { - input: NodeJS.ReadableStream; - output?: NodeJS.WritableStream; - completer?: Completer | AsyncCompleter; - terminal?: boolean; - historySize?: number; - prompt?: string; - crlfDelay?: number; - removeHistoryDuplicates?: boolean; - escapeCodeTimeout?: number; - tabSize?: number; - } - - function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; - function createInterface(options: ReadLineOptions): Interface; - function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; - - type Direction = -1 | 0 | 1; - - interface CursorPos { - rows: number; - cols: number; - } - - /** - * Clears the current line of this WriteStream in a direction identified by `dir`. - */ - function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; - /** - * Clears this `WriteStream` from the current cursor down. - */ - function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor to the specified position. - */ - function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor relative to its current position. - */ - function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/repl.d.ts b/node_modules/protobufjs/node_modules/@types/node/repl.d.ts deleted file mode 100644 index 2515625c..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/repl.d.ts +++ /dev/null @@ -1,395 +0,0 @@ -declare module "repl" { - import { Interface, Completer, AsyncCompleter } from "readline"; - import { Context } from "vm"; - import { InspectOptions } from "util"; - - interface ReplOptions { - /** - * The input prompt to display. - * Default: `"> "` - */ - prompt?: string; - /** - * The `Readable` stream from which REPL input will be read. - * Default: `process.stdin` - */ - input?: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - * Default: `process.stdout` - */ - output?: NodeJS.WritableStream; - /** - * If `true`, specifies that the output should be treated as a TTY terminal, and have - * ANSI/VT100 escape codes written to it. - * Default: checking the value of the `isTTY` property on the output stream upon - * instantiation. - */ - terminal?: boolean; - /** - * The function to be used when evaluating each given line of input. - * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can - * error with `repl.Recoverable` to indicate the input was incomplete and prompt for - * additional lines. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions - */ - eval?: REPLEval; - /** - * Defines if the repl prints output previews or not. - * @default `true` Always `false` in case `terminal` is falsy. - */ - preview?: boolean; - /** - * If `true`, specifies that the default `writer` function should include ANSI color - * styling to REPL output. If a custom `writer` function is provided then this has no - * effect. - * Default: the REPL instance's `terminal` value. - */ - useColors?: boolean; - /** - * If `true`, specifies that the default evaluation function will use the JavaScript - * `global` as the context as opposed to creating a new separate context for the REPL - * instance. The node CLI REPL sets this value to `true`. - * Default: `false`. - */ - useGlobal?: boolean; - /** - * If `true`, specifies that the default writer will not output the return value of a - * command if it evaluates to `undefined`. - * Default: `false`. - */ - ignoreUndefined?: boolean; - /** - * The function to invoke to format the output of each command before writing to `output`. - * Default: a wrapper for `util.inspect`. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output - */ - writer?: REPLWriter; - /** - * An optional function used for custom Tab auto completion. - * - * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function - */ - completer?: Completer | AsyncCompleter; - /** - * A flag that specifies whether the default evaluator executes all JavaScript commands in - * strict mode or default (sloppy) mode. - * Accepted values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - /** - * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is - * pressed. This cannot be used together with a custom `eval` function. - * Default: `false`. - */ - breakEvalOnSigint?: boolean; - } - - type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; - type REPLWriter = (this: REPLServer, obj: any) => string; - - /** - * This is the default "writer" value, if none is passed in the REPL options, - * and it can be overridden by custom print functions. - */ - const writer: REPLWriter & { options: InspectOptions }; - - type REPLCommandAction = (this: REPLServer, text: string) => void; - - interface REPLCommand { - /** - * Help text to be displayed when `.help` is entered. - */ - help?: string; - /** - * The function to execute, optionally accepting a single string argument. - */ - action: REPLCommandAction; - } - - /** - * Provides a customizable Read-Eval-Print-Loop (REPL). - * - * Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those - * according to a user-defined evaluation function, then output the result. Input and output - * may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`. - * - * Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style - * line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session - * state, error recovery, and customizable evaluation functions. - * - * Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_ - * be created directly using the JavaScript `new` keyword. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl - */ - class REPLServer extends Interface { - /** - * The `vm.Context` provided to the `eval` function to be used for JavaScript - * evaluation. - */ - readonly context: Context; - /** - * Outdated alias for `input`. - */ - readonly inputStream: NodeJS.ReadableStream; - /** - * Outdated alias for `output`. - */ - readonly outputStream: NodeJS.WritableStream; - /** - * The `Readable` stream from which REPL input will be read. - */ - readonly input: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - */ - readonly output: NodeJS.WritableStream; - /** - * The commands registered via `replServer.defineCommand()`. - */ - readonly commands: NodeJS.ReadOnlyDict; - /** - * A value indicating whether the REPL is currently in "editor mode". - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys - */ - readonly editorMode: boolean; - /** - * A value indicating whether the `_` variable has been assigned. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreAssigned: boolean; - /** - * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly last: any; - /** - * A value indicating whether the `_error` variable has been assigned. - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreErrAssigned: boolean; - /** - * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly lastError: any; - /** - * Specified in the REPL options, this is the function to be used when evaluating each - * given line of input. If not specified in the REPL options, this is an async wrapper - * for the JavaScript `eval()` function. - */ - readonly eval: REPLEval; - /** - * Specified in the REPL options, this is a value indicating whether the default - * `writer` function should include ANSI color styling to REPL output. - */ - readonly useColors: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `eval` - * function will use the JavaScript `global` as the context as opposed to creating a new - * separate context for the REPL instance. - */ - readonly useGlobal: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `writer` - * function should output the result of a command if it evaluates to `undefined`. - */ - readonly ignoreUndefined: boolean; - /** - * Specified in the REPL options, this is the function to invoke to format the output of - * each command before writing to `outputStream`. If not specified in the REPL options, - * this will be a wrapper for `util.inspect`. - */ - readonly writer: REPLWriter; - /** - * Specified in the REPL options, this is the function to use for custom Tab auto-completion. - */ - readonly completer: Completer | AsyncCompleter; - /** - * Specified in the REPL options, this is a flag that specifies whether the default `eval` - * function should execute all JavaScript commands in strict mode or default (sloppy) mode. - * Possible values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - - /** - * NOTE: According to the documentation: - * - * > Instances of `repl.REPLServer` are created using the `repl.start()` method and - * > _should not_ be created directly using the JavaScript `new` keyword. - * - * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver - */ - private constructor(); - - /** - * Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked - * by typing a `.` followed by the `keyword`. - * - * @param keyword The command keyword (_without_ a leading `.` character). - * @param cmd The function to invoke when the command is processed. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd - */ - defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; - /** - * Readies the REPL instance for input from the user, printing the configured `prompt` to a - * new line in the `output` and resuming the `input` to accept new input. - * - * When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'. - * - * This method is primarily intended to be called from within the action function for - * commands registered using the `replServer.defineCommand()` method. - * - * @param preserveCursor When `true`, the cursor placement will not be reset to `0`. - */ - displayPrompt(preserveCursor?: boolean): void; - /** - * Clears any command that has been buffered but not yet executed. - * - * This method is primarily intended to be called from within the action function for - * commands registered using the `replServer.defineCommand()` method. - * - * @since v9.0.0 - */ - clearBufferedCommand(): void; - - /** - * Initializes a history log file for the REPL instance. When executing the - * Node.js binary and using the command line REPL, a history file is initialized - * by default. However, this is not the case when creating a REPL - * programmatically. Use this method to initialize a history log file when working - * with REPL instances programmatically. - * @param path The path to the history file - */ - setupHistory(path: string, cb: (err: Error | null, repl: this) => void): void; - - /** - * events.EventEmitter - * 1. close - inherited from `readline.Interface` - * 2. line - inherited from `readline.Interface` - * 3. pause - inherited from `readline.Interface` - * 4. resume - inherited from `readline.Interface` - * 5. SIGCONT - inherited from `readline.Interface` - * 6. SIGINT - inherited from `readline.Interface` - * 7. SIGTSTP - inherited from `readline.Interface` - * 8. exit - * 9. reset - */ - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (context: Context) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "exit"): boolean; - emit(event: "reset", context: Context): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (context: Context) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (context: Context) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (context: Context) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (context: Context) => void): this; - } - - /** - * A flag passed in the REPL options. Evaluates expressions in sloppy mode. - */ - const REPL_MODE_SLOPPY: unique symbol; - - /** - * A flag passed in the REPL options. Evaluates expressions in strict mode. - * This is equivalent to prefacing every repl statement with `'use strict'`. - */ - const REPL_MODE_STRICT: unique symbol; - - /** - * Creates and starts a `repl.REPLServer` instance. - * - * @param options The options for the `REPLServer`. If `options` is a string, then it specifies - * the input prompt. - */ - function start(options?: string | ReplOptions): REPLServer; - - /** - * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. - * - * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors - */ - class Recoverable extends SyntaxError { - err: Error; - - constructor(err: Error); - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/stream.d.ts b/node_modules/protobufjs/node_modules/@types/node/stream.d.ts deleted file mode 100644 index 574bfef2..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/stream.d.ts +++ /dev/null @@ -1,354 +0,0 @@ -declare module "stream" { - import * as events from "events"; - - class internal extends events.EventEmitter { - pipe(destination: T, options?: { end?: boolean; }): T; - } - - namespace internal { - class Stream extends internal { - constructor(opts?: ReadableOptions); - } - - interface ReadableOptions { - highWaterMark?: number; - encoding?: string; - objectMode?: boolean; - read?(this: Readable, size: number): void; - destroy?(this: Readable, error: Error | null, callback: (error: Error | null) => void): void; - autoDestroy?: boolean; - } - - class Readable extends Stream implements NodeJS.ReadableStream { - /** - * A utility method for creating Readable Streams out of iterators. - */ - static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; - - readable: boolean; - readonly readableEncoding: BufferEncoding | null; - readonly readableEnded: boolean; - readonly readableFlowing: boolean | null; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableObjectMode: boolean; - destroyed: boolean; - constructor(opts?: ReadableOptions); - _read(size: number): void; - read(size?: number): any; - setEncoding(encoding: string): this; - pause(): this; - resume(): this; - isPaused(): boolean; - unpipe(destination?: NodeJS.WritableStream): this; - unshift(chunk: any, encoding?: BufferEncoding): void; - wrap(oldStream: NodeJS.ReadableStream): this; - push(chunk: any, encoding?: string): boolean; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - destroy(error?: Error): void; - - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. end - * 4. error - * 5. pause - * 6. readable - * 7. resume - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "pause"): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableOptions { - highWaterMark?: number; - decodeStrings?: boolean; - defaultEncoding?: string; - objectMode?: boolean; - emitClose?: boolean; - write?(this: Writable, chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - writev?(this: Writable, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void; - final?(this: Writable, callback: (error?: Error | null) => void): void; - autoDestroy?: boolean; - } - - class Writable extends Stream implements NodeJS.WritableStream { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - readonly writableCorked: number; - destroyed: boolean; - constructor(opts?: WritableOptions); - _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, encoding: string, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: string): this; - end(cb?: () => void): void; - end(chunk: any, cb?: () => void): void; - end(chunk: any, encoding: string, cb?: () => void): void; - cork(): void; - uncork(): void; - destroy(error?: Error): void; - - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. drain - * 3. error - * 4. finish - * 5. pipe - * 6. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean; - readableObjectMode?: boolean; - writableObjectMode?: boolean; - readableHighWaterMark?: number; - writableHighWaterMark?: number; - writableCorked?: number; - read?(this: Duplex, size: number): void; - write?(this: Duplex, chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - writev?(this: Duplex, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - final?(this: Duplex, callback: (error?: Error | null) => void): void; - destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void; - } - - // Note: Duplex extends both Readable and Writable. - class Duplex extends Readable implements Writable { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - readonly writableCorked: number; - constructor(opts?: DuplexOptions); - _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: string): this; - end(cb?: () => void): void; - end(chunk: any, cb?: () => void): void; - end(chunk: any, encoding?: string, cb?: () => void): void; - cork(): void; - uncork(): void; - } - - type TransformCallback = (error?: Error | null, data?: any) => void; - - interface TransformOptions extends DuplexOptions { - read?(this: Transform, size: number): void; - write?(this: Transform, chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - writev?(this: Transform, chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; - final?(this: Transform, callback: (error?: Error | null) => void): void; - destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void; - transform?(this: Transform, chunk: any, encoding: string, callback: TransformCallback): void; - flush?(this: Transform, callback: TransformCallback): void; - } - - class Transform extends Duplex { - constructor(opts?: TransformOptions); - _transform(chunk: any, encoding: string, callback: TransformCallback): void; - _flush(callback: TransformCallback): void; - } - - class PassThrough extends Transform { } - - interface FinishedOptions { - error?: boolean; - readable?: boolean; - writable?: boolean; - } - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; - namespace finished { - function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise; - } - - function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; - function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: T, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): T; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: NodeJS.ReadWriteStream, - stream5: T, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): T; - function pipeline( - streams: ReadonlyArray, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): NodeJS.WritableStream; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array void)>, - ): NodeJS.WritableStream; - namespace pipeline { - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise; - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.WritableStream): Promise; - function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: NodeJS.WritableStream): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream, - stream3: NodeJS.ReadWriteStream, - stream4: NodeJS.ReadWriteStream, - stream5: NodeJS.WritableStream, - ): Promise; - function __promisify__(streams: ReadonlyArray): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array, - ): Promise; - } - - interface Pipe { - close(): void; - hasRef(): boolean; - ref(): void; - unref(): void; - } - } - - export = internal; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/string_decoder.d.ts b/node_modules/protobufjs/node_modules/@types/node/string_decoder.d.ts deleted file mode 100644 index fe0e0b4d..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/string_decoder.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module "string_decoder" { - class StringDecoder { - constructor(encoding?: string); - write(buffer: Buffer): string; - end(buffer?: Buffer): string; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/timers.d.ts b/node_modules/protobufjs/node_modules/@types/node/timers.d.ts deleted file mode 100644 index e64a6735..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/timers.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module "timers" { - function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; - namespace setTimeout { - function __promisify__(ms: number): Promise; - function __promisify__(ms: number, value: T): Promise; - } - function clearTimeout(timeoutId: NodeJS.Timeout): void; - function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; - function clearInterval(intervalId: NodeJS.Timeout): void; - function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; - namespace setImmediate { - function __promisify__(): Promise; - function __promisify__(value: T): Promise; - } - function clearImmediate(immediateId: NodeJS.Immediate): void; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/tls.d.ts b/node_modules/protobufjs/node_modules/@types/node/tls.d.ts deleted file mode 100644 index 1c129232..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/tls.d.ts +++ /dev/null @@ -1,768 +0,0 @@ -declare module "tls" { - import * as crypto from "crypto"; - import * as dns from "dns"; - import * as net from "net"; - import * as stream from "stream"; - - const CLIENT_RENEG_LIMIT: number; - const CLIENT_RENEG_WINDOW: number; - - interface Certificate { - /** - * Country code. - */ - C: string; - /** - * Street. - */ - ST: string; - /** - * Locality. - */ - L: string; - /** - * Organization. - */ - O: string; - /** - * Organizational unit. - */ - OU: string; - /** - * Common name. - */ - CN: string; - } - - interface PeerCertificate { - subject: Certificate; - issuer: Certificate; - subjectaltname: string; - infoAccess: NodeJS.Dict; - modulus: string; - exponent: string; - valid_from: string; - valid_to: string; - fingerprint: string; - fingerprint256: string; - ext_key_usage: string[]; - serialNumber: string; - raw: Buffer; - } - - interface DetailedPeerCertificate extends PeerCertificate { - issuerCertificate: DetailedPeerCertificate; - } - - interface CipherNameAndProtocol { - /** - * The cipher name. - */ - name: string; - /** - * SSL/TLS protocol version. - */ - version: string; - - /** - * IETF name for the cipher suite. - */ - standardName: string; - } - - interface EphemeralKeyInfo { - /** - * The supported types are 'DH' and 'ECDH'. - */ - type: string; - /** - * The name property is available only when type is 'ECDH'. - */ - name?: string; - /** - * The size of parameter of an ephemeral key exchange. - */ - size: number; - } - - interface KeyObject { - /** - * Private keys in PEM format. - */ - pem: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string; - } - - interface PxfObject { - /** - * PFX or PKCS12 encoded private key and certificate chain. - */ - buf: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string; - } - - interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * If true the TLS socket will be instantiated in server-mode. - * Defaults to false. - */ - isServer?: boolean; - /** - * An optional net.Server instance. - */ - server?: net.Server; - - /** - * An optional Buffer instance containing a TLS session. - */ - session?: Buffer; - /** - * If true, specifies that the OCSP status request extension will be - * added to the client hello and an 'OCSPResponse' event will be - * emitted on the socket before establishing a secure communication - */ - requestOCSP?: boolean; - } - - class TLSSocket extends net.Socket { - /** - * Construct a new tls.TLSSocket object from an existing TCP socket. - */ - constructor(socket: net.Socket, options?: TLSSocketOptions); - - /** - * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false. - */ - authorized: boolean; - /** - * The reason why the peer's certificate has not been verified. - * This property becomes available only when tlsSocket.authorized === false. - */ - authorizationError: Error; - /** - * Static boolean value, always true. - * May be used to distinguish TLS sockets from regular ones. - */ - encrypted: boolean; - - /** - * String containing the selected ALPN protocol. - * When ALPN has no selected protocol, tlsSocket.alpnProtocol equals false. - */ - alpnProtocol?: string; - - /** - * Returns an object representing the local certificate. The returned - * object has some properties corresponding to the fields of the - * certificate. - * - * See tls.TLSSocket.getPeerCertificate() for an example of the - * certificate structure. - * - * If there is no local certificate, an empty object will be returned. - * If the socket has been destroyed, null will be returned. - */ - getCertificate(): PeerCertificate | object | null; - /** - * Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection. - * @returns Returns an object representing the cipher name - * and the SSL/TLS protocol version of the current connection. - */ - getCipher(): CipherNameAndProtocol; - /** - * Returns an object representing the type, name, and size of parameter - * of an ephemeral key exchange in Perfect Forward Secrecy on a client - * connection. It returns an empty object when the key exchange is not - * ephemeral. As this is only supported on a client socket; null is - * returned if called on a server socket. The supported types are 'DH' - * and 'ECDH'. The name property is available only when type is 'ECDH'. - * - * For example: { type: 'ECDH', name: 'prime256v1', size: 256 }. - */ - getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; - /** - * Returns the latest Finished message that has - * been sent to the socket as part of a SSL/TLS handshake, or undefined - * if no Finished message has been sent yet. - * - * As the Finished messages are message digests of the complete - * handshake (with a total of 192 bits for TLS 1.0 and more for SSL - * 3.0), they can be used for external authentication procedures when - * the authentication provided by SSL/TLS is not desired or is not - * enough. - * - * Corresponds to the SSL_get_finished routine in OpenSSL and may be - * used to implement the tls-unique channel binding from RFC 5929. - */ - getFinished(): Buffer | undefined; - /** - * Returns an object representing the peer's certificate. - * The returned object has some properties corresponding to the field of the certificate. - * If detailed argument is true the full chain with issuer property will be returned, - * if false only the top certificate without issuer property. - * If the peer does not provide a certificate, it returns null or an empty object. - * @param detailed - If true; the full chain with issuer property will be returned. - * @returns An object representing the peer's certificate. - */ - getPeerCertificate(detailed: true): DetailedPeerCertificate; - getPeerCertificate(detailed?: false): PeerCertificate; - getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; - /** - * Returns the latest Finished message that is expected or has actually - * been received from the socket as part of a SSL/TLS handshake, or - * undefined if there is no Finished message so far. - * - * As the Finished messages are message digests of the complete - * handshake (with a total of 192 bits for TLS 1.0 and more for SSL - * 3.0), they can be used for external authentication procedures when - * the authentication provided by SSL/TLS is not desired or is not - * enough. - * - * Corresponds to the SSL_get_peer_finished routine in OpenSSL and may - * be used to implement the tls-unique channel binding from RFC 5929. - */ - getPeerFinished(): Buffer | undefined; - /** - * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. - * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. - * The value `null` will be returned for server sockets or disconnected client sockets. - * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. - * @returns negotiated SSL/TLS protocol version of the current connection - */ - getProtocol(): string | null; - /** - * Could be used to speed up handshake establishment when reconnecting to the server. - * @returns ASN.1 encoded TLS session or undefined if none was negotiated. - */ - getSession(): Buffer | undefined; - /** - * Returns a list of signature algorithms shared between the server and - * the client in the order of decreasing preference. - */ - getSharedSigalgs(): string[]; - /** - * NOTE: Works only with client TLS sockets. - * Useful only for debugging, for session reuse provide session option to tls.connect(). - * @returns TLS session ticket or undefined if none was negotiated. - */ - getTLSTicket(): Buffer | undefined; - /** - * Returns true if the session was reused, false otherwise. - */ - isSessionReused(): boolean; - /** - * Initiate TLS renegotiation process. - * - * NOTE: Can be used to request peer's certificate after the secure connection has been established. - * ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout. - * @param options - The options may contain the following fields: rejectUnauthorized, - * requestCert (See tls.createServer() for details). - * @param callback - callback(err) will be executed with null as err, once the renegotiation - * is successfully completed. - * @return `undefined` when socket is destroy, `false` if negotiaion can't be initiated. - */ - renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): undefined | boolean; - /** - * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). - * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by - * the TLS layer until the entire fragment is received and its integrity is verified; - * large fragments can span multiple roundtrips, and their processing can be delayed due to packet - * loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, - * which may decrease overall server throughput. - * @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512). - * @returns Returns true on success, false otherwise. - */ - setMaxSendFragment(size: number): boolean; - - /** - * Disables TLS renegotiation for this TLSSocket instance. Once called, - * attempts to renegotiate will trigger an 'error' event on the - * TLSSocket. - */ - disableRenegotiation(): void; - - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * - * Note: The format of the output is identical to the output of `openssl s_client - * -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's - * `SSL_trace()` function, the format is undocumented, can change without notice, - * and should not be relied on. - */ - enableTrace(): void; - - /** - * @param length number of bytes to retrieve from keying material - * @param label an application specific label, typically this will be a value from the - * [IANA Exporter Label Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). - * @param context optionally provide a context. - */ - exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - addListener(event: "secureConnect", listener: () => void): this; - addListener(event: "session", listener: (session: Buffer) => void): this; - addListener(event: "keylog", listener: (line: Buffer) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "OCSPResponse", response: Buffer): boolean; - emit(event: "secureConnect"): boolean; - emit(event: "session", session: Buffer): boolean; - emit(event: "keylog", line: Buffer): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "OCSPResponse", listener: (response: Buffer) => void): this; - on(event: "secureConnect", listener: () => void): this; - on(event: "session", listener: (session: Buffer) => void): this; - on(event: "keylog", listener: (line: Buffer) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "OCSPResponse", listener: (response: Buffer) => void): this; - once(event: "secureConnect", listener: () => void): this; - once(event: "session", listener: (session: Buffer) => void): this; - once(event: "keylog", listener: (line: Buffer) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependListener(event: "secureConnect", listener: () => void): this; - prependListener(event: "session", listener: (session: Buffer) => void): this; - prependListener(event: "keylog", listener: (line: Buffer) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependOnceListener(event: "secureConnect", listener: () => void): this; - prependOnceListener(event: "session", listener: (session: Buffer) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this; - } - - interface CommonConnectionOptions { - /** - * An optional TLS context object from tls.createSecureContext() - */ - secureContext?: SecureContext; - - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * @default false - */ - enableTrace?: boolean; - /** - * If true the server will request a certificate from clients that - * connect and attempt to verify that certificate. Defaults to - * false. - */ - requestCert?: boolean; - /** - * An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) - */ - ALPNProtocols?: string[] | Uint8Array[] | Uint8Array; - /** - * SNICallback(servername, cb) A function that will be - * called if the client supports SNI TLS extension. Two arguments - * will be passed when called: servername and cb. SNICallback should - * invoke cb(null, ctx), where ctx is a SecureContext instance. - * (tls.createSecureContext(...) can be used to get a proper - * SecureContext.) If SNICallback wasn't provided the default callback - * with high-level API will be used (see below). - */ - SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - /** - * If true the server will reject any connection which is not - * authorized with the list of supplied CAs. This option only has an - * effect if requestCert is true. - * @default true - */ - rejectUnauthorized?: boolean; - } - - interface TlsOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * Abort the connection if the SSL/TLS handshake does not finish in the - * specified number of milliseconds. A 'tlsClientError' is emitted on - * the tls.Server object whenever a handshake times out. Default: - * 120000 (120 seconds). - */ - handshakeTimeout?: number; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number; - /** - * 48-bytes of cryptographically strong pseudo-random data. - */ - ticketKeys?: Buffer; - - /** - * - * @param socket - * @param identity identity parameter sent from the client. - * @return pre-shared key that must either be - * a buffer or `null` to stop the negotiation process. Returned PSK must be - * compatible with the selected cipher's digest. - * - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with the identity provided by the client. - * If the return value is `null` the negotiation process will stop and an - * "unknown_psk_identity" alert message will be sent to the other party. - * If the server wishes to hide the fact that the PSK identity was not known, - * the callback must provide some random data as `psk` to make the connection - * fail with "decrypt_error" before negotiation is finished. - * PSK ciphers are disabled by default, and using TLS-PSK thus - * requires explicitly specifying a cipher suite with the `ciphers` option. - * More information can be found in the RFC 4279. - */ - - pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; - /** - * hint to send to a client to help - * with selecting the identity during TLS-PSK negotiation. Will be ignored - * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be - * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. - */ - pskIdentityHint?: string; - } - - interface PSKCallbackNegotation { - psk: DataView | NodeJS.TypedArray; - identitty: string; - } - - interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { - host?: string; - port?: number; - path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. - socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket - checkServerIdentity?: typeof checkServerIdentity; - servername?: string; // SNI TLS Extension - session?: Buffer; - minDHSize?: number; - lookup?: net.LookupFunction; - timeout?: number; - /** - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with optional identity `hint` provided by the server or `null` - * in case of TLS 1.3 where `hint` was removed. - * It will be necessary to provide a custom `tls.checkServerIdentity()` - * for the connection as the default one will try to check hostname/IP - * of the server against the certificate but that's not applicable for PSK - * because there won't be a certificate present. - * More information can be found in the RFC 4279. - * - * @param hint message sent from the server to help client - * decide which identity to use during negotiation. - * Always `null` if TLS 1.3 is used. - * @returns Return `null` to stop the negotiation process. `psk` must be - * compatible with the selected cipher's digest. - * `identity` must use UTF-8 encoding. - */ - pskCallback?(hint: string | null): PSKCallbackNegotation | null; - } - - class Server extends net.Server { - /** - * The server.addContext() method adds a secure context that will be - * used if the client request's SNI name matches the supplied hostname - * (or wildcard). - */ - addContext(hostName: string, credentials: SecureContextOptions): void; - /** - * Returns the session ticket keys. - */ - getTicketKeys(): Buffer; - /** - * - * The server.setSecureContext() method replaces the - * secure context of an existing server. Existing connections to the - * server are not interrupted. - */ - setSecureContext(details: SecureContextOptions): void; - /** - * The server.setSecureContext() method replaces the secure context of - * an existing server. Existing connections to the server are not - * interrupted. - */ - setTicketKeys(keys: Buffer): void; - - /** - * events.EventEmitter - * 1. tlsClientError - * 2. newSession - * 3. OCSPRequest - * 4. resumeSession - * 5. secureConnection - * 6. keylog - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - addListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean; - emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; - emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; - emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - once(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; - prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; - prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - } - - interface SecurePair { - encrypted: TLSSocket; - cleartext: TLSSocket; - } - - type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; - - interface SecureContextOptions { - /** - * Optionally override the trusted CA certificates. Default is to trust - * the well-known CAs curated by Mozilla. Mozilla's CAs are completely - * replaced when CAs are explicitly specified using this option. - */ - ca?: string | Buffer | Array; - /** - * Cert chains in PEM format. One cert chain should be provided per - * private key. Each cert chain should consist of the PEM formatted - * certificate for a provided private key, followed by the PEM - * formatted intermediate certificates (if any), in order, and not - * including the root CA (the root CA must be pre-known to the peer, - * see ca). When providing multiple cert chains, they do not have to - * be in the same order as their private keys in key. If the - * intermediate certificates are not provided, the peer will not be - * able to validate the certificate, and the handshake will fail. - */ - cert?: string | Buffer | Array; - /** - * Colon-separated list of supported signature algorithms. The list - * can contain digest algorithms (SHA256, MD5 etc.), public key - * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g - * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). - */ - sigalgs?: string; - /** - * Cipher suite specification, replacing the default. For more - * information, see modifying the default cipher suite. Permitted - * ciphers can be obtained via tls.getCiphers(). Cipher names must be - * uppercased in order for OpenSSL to accept them. - */ - ciphers?: string; - /** - * Name of an OpenSSL engine which can provide the client certificate. - */ - clientCertEngine?: string; - /** - * PEM formatted CRLs (Certificate Revocation Lists). - */ - crl?: string | Buffer | Array; - /** - * Diffie Hellman parameters, required for Perfect Forward Secrecy. Use - * openssl dhparam to create the parameters. The key length must be - * greater than or equal to 1024 bits or else an error will be thrown. - * Although 1024 bits is permissible, use 2048 bits or larger for - * stronger security. If omitted or invalid, the parameters are - * silently discarded and DHE ciphers will not be available. - */ - dhparam?: string | Buffer; - /** - * A string describing a named curve or a colon separated list of curve - * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key - * agreement. Set to auto to select the curve automatically. Use - * crypto.getCurves() to obtain a list of available curve names. On - * recent releases, openssl ecparam -list_curves will also display the - * name and description of each available elliptic curve. Default: - * tls.DEFAULT_ECDH_CURVE. - */ - ecdhCurve?: string; - /** - * Attempt to use the server's cipher suite preferences instead of the - * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be - * set in secureOptions - */ - honorCipherOrder?: boolean; - /** - * Private keys in PEM format. PEM allows the option of private keys - * being encrypted. Encrypted keys will be decrypted with - * options.passphrase. Multiple keys using different algorithms can be - * provided either as an array of unencrypted key strings or buffers, - * or an array of objects in the form {pem: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted keys will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - key?: string | Buffer | Array; - /** - * Name of an OpenSSL engine to get private key from. Should be used - * together with privateKeyIdentifier. - */ - privateKeyEngine?: string; - /** - * Identifier of a private key managed by an OpenSSL engine. Should be - * used together with privateKeyEngine. Should not be set together with - * key, because both options define a private key in different ways. - */ - privateKeyIdentifier?: string; - /** - * Optionally set the maximum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. - * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using - * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to - * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. - */ - maxVersion?: SecureVersion; - /** - * Optionally set the minimum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. It is not recommended to use - * less than TLSv1.2, but it may be required for interoperability. - * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using - * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to - * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. - */ - minVersion?: SecureVersion; - /** - * Shared passphrase used for a single private key and/or a PFX. - */ - passphrase?: string; - /** - * PFX or PKCS12 encoded private key and certificate chain. pfx is an - * alternative to providing key and cert individually. PFX is usually - * encrypted, if it is, passphrase will be used to decrypt it. Multiple - * PFX can be provided either as an array of unencrypted PFX buffers, - * or an array of objects in the form {buf: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted PFX will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - pfx?: string | Buffer | Array; - /** - * Optionally affect the OpenSSL protocol behavior, which is not - * usually necessary. This should be used carefully if at all! Value is - * a numeric bitmask of the SSL_OP_* options from OpenSSL Options - */ - secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options - /** - * Legacy mechanism to select the TLS protocol version to use, it does - * not support independent control of the minimum and maximum version, - * and does not support limiting the protocol to TLSv1.3. Use - * minVersion and maxVersion instead. The possible values are listed as - * SSL_METHODS, use the function names as strings. For example, use - * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow - * any TLS protocol version up to TLSv1.3. It is not recommended to use - * TLS versions less than 1.2, but it may be required for - * interoperability. Default: none, see minVersion. - */ - secureProtocol?: string; - /** - * Opaque identifier used by servers to ensure session state is not - * shared between applications. Unused by clients. - */ - sessionIdContext?: string; - } - - interface SecureContext { - context: any; - } - - /* - * Verifies the certificate `cert` is issued to host `host`. - * @host The hostname to verify the certificate against - * @cert PeerCertificate representing the peer's certificate - * - * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined. - */ - function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined; - function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; - function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; - function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - /** - * @deprecated - */ - function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; - function createSecureContext(options?: SecureContextOptions): SecureContext; - function getCiphers(): string[]; - - /** - * The default curve name to use for ECDH key agreement in a tls server. - * The default value is 'auto'. See tls.createSecureContext() for further - * information. - */ - let DEFAULT_ECDH_CURVE: string; - /** - * The default value of the maxVersion option of - * tls.createSecureContext(). It can be assigned any of the supported TLS - * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: - * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets - * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the highest maximum - * is used. - */ - let DEFAULT_MAX_VERSION: SecureVersion; - /** - * The default value of the minVersion option of tls.createSecureContext(). - * It can be assigned any of the supported TLS protocol versions, - * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless - * changed using CLI options. Using --tls-min-v1.0 sets the default to - * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using - * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options - * are provided, the lowest minimum is used. - */ - let DEFAULT_MIN_VERSION: SecureVersion; - - /** - * An immutable array of strings representing the root certificates (in PEM - * format) used for verifying peer certificates. This is the default value - * of the ca option to tls.createSecureContext(). - */ - const rootCertificates: ReadonlyArray; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/trace_events.d.ts b/node_modules/protobufjs/node_modules/@types/node/trace_events.d.ts deleted file mode 100644 index 1f3a89c4..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/trace_events.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -declare module "trace_events" { - /** - * The `Tracing` object is used to enable or disable tracing for sets of - * categories. Instances are created using the - * `trace_events.createTracing()` method. - * - * When created, the `Tracing` object is disabled. Calling the - * `tracing.enable()` method adds the categories to the set of enabled trace - * event categories. Calling `tracing.disable()` will remove the categories - * from the set of enabled trace event categories. - */ - interface Tracing { - /** - * A comma-separated list of the trace event categories covered by this - * `Tracing` object. - */ - readonly categories: string; - - /** - * Disables this `Tracing` object. - * - * Only trace event categories _not_ covered by other enabled `Tracing` - * objects and _not_ specified by the `--trace-event-categories` flag - * will be disabled. - */ - disable(): void; - - /** - * Enables this `Tracing` object for the set of categories covered by - * the `Tracing` object. - */ - enable(): void; - - /** - * `true` only if the `Tracing` object has been enabled. - */ - readonly enabled: boolean; - } - - interface CreateTracingOptions { - /** - * An array of trace category names. Values included in the array are - * coerced to a string when possible. An error will be thrown if the - * value cannot be coerced. - */ - categories: string[]; - } - - /** - * Creates and returns a Tracing object for the given set of categories. - */ - function createTracing(options: CreateTracingOptions): Tracing; - - /** - * Returns a comma-separated list of all currently-enabled trace event - * categories. The current set of enabled trace event categories is - * determined by the union of all currently-enabled `Tracing` objects and - * any categories enabled using the `--trace-event-categories` flag. - */ - function getEnabledCategories(): string | undefined; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/ts3.4/assert.d.ts b/node_modules/protobufjs/node_modules/@types/node/ts3.4/assert.d.ts deleted file mode 100644 index b3a9989f..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/ts3.4/assert.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -declare module 'assert' { - function assert(value: any, message?: string | Error): void; - namespace assert { - class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - code: 'ERR_ASSERTION'; - - constructor(options?: { - message?: string; - actual?: any; - expected?: any; - operator?: string; - stackStartFn?: Function; - }); - } - - type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error; - - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: any, - expected: any, - message?: string | Error, - operator?: string, - stackStartFn?: Function, - ): never; - function ok(value: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use strictEqual() instead. */ - function equal(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notStrictEqual() instead. */ - function notEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */ - function deepEqual(actual: any, expected: any, message?: string | Error): void; - /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */ - function notDeepEqual(actual: any, expected: any, message?: string | Error): void; - function strictEqual(actual: any, expected: any, message?: string | Error): void; - function notStrictEqual(actual: any, expected: any, message?: string | Error): void; - function deepStrictEqual(actual: any, expected: any, message?: string | Error): void; - function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void; - - function throws(block: () => any, message?: string | Error): void; - function throws(block: () => any, error: AssertPredicate, message?: string | Error): void; - function doesNotThrow(block: () => any, message?: string | Error): void; - function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void; - - function ifError(value: any): void; - - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: RegExp | Function, - message?: string | Error, - ): Promise; - - function match(value: string, regExp: RegExp, message?: string | Error): void; - function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; - - const strict: typeof assert; - } - - export = assert; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/ts3.4/base.d.ts b/node_modules/protobufjs/node_modules/@types/node/ts3.4/base.d.ts deleted file mode 100644 index b0b20075..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/ts3.4/base.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.2. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.2/base.d.ts - Definitions specific to TypeScript 3.2 -// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with global and assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// base definitions for all NodeJS modules that are not specific to any version of TypeScript -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/node_modules/protobufjs/node_modules/@types/node/ts3.4/globals.global.d.ts b/node_modules/protobufjs/node_modules/@types/node/ts3.4/globals.global.d.ts deleted file mode 100644 index 8e854665..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/ts3.4/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: NodeJS.Global; diff --git a/node_modules/protobufjs/node_modules/@types/node/ts3.4/index.d.ts b/node_modules/protobufjs/node_modules/@types/node/ts3.4/index.d.ts deleted file mode 100644 index f0691708..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/ts3.4/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.2. -// This is requried to enable globalThis support for global in ts3.5 without causing errors -// This is requried to enable typing assert in ts3.7 without causing errors -// Typically type modifiations should be made in base.d.ts instead of here - -/// -/// -/// diff --git a/node_modules/protobufjs/node_modules/@types/node/ts3.6/base.d.ts b/node_modules/protobufjs/node_modules/@types/node/ts3.6/base.d.ts deleted file mode 100644 index 93567d61..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/ts3.6/base.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.5. - -// NOTE: TypeScript version-specific augmentations can be found in the following paths: -// - ~/base.d.ts - Shared definitions common to all TypeScript versions -// - ~/index.d.ts - Definitions specific to TypeScript 2.1 -// - ~/ts3.5/base.d.ts - Definitions specific to TypeScript 3.5 -// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5 with assert pulled in - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// - -// TypeScript 3.4-specific augmentations: -/// - -// TypeScript 3.5-specific augmentations: -/// diff --git a/node_modules/protobufjs/node_modules/@types/node/ts3.6/index.d.ts b/node_modules/protobufjs/node_modules/@types/node/ts3.6/index.d.ts deleted file mode 100644 index 7f947fa6..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/ts3.6/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// NOTE: These definitions support NodeJS and TypeScript 3.5. -// This is requried to enable typing assert in ts3.7 without causing errors -// Typically type modifiations should be made in base.d.ts instead of here - -/// - -/// diff --git a/node_modules/protobufjs/node_modules/@types/node/tty.d.ts b/node_modules/protobufjs/node_modules/@types/node/tty.d.ts deleted file mode 100644 index 78543663..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/tty.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -declare module "tty" { - import * as net from "net"; - - function isatty(fd: number): boolean; - class ReadStream extends net.Socket { - constructor(fd: number, options?: net.SocketConstructorOpts); - isRaw: boolean; - setRawMode(mode: boolean): this; - isTTY: boolean; - } - /** - * -1 - to the left from cursor - * 0 - the entire line - * 1 - to the right from cursor - */ - type Direction = -1 | 0 | 1; - class WriteStream extends net.Socket { - constructor(fd: number); - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "resize", listener: () => void): this; - - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "resize"): boolean; - - on(event: string, listener: (...args: any[]) => void): this; - on(event: "resize", listener: () => void): this; - - once(event: string, listener: (...args: any[]) => void): this; - once(event: "resize", listener: () => void): this; - - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "resize", listener: () => void): this; - - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "resize", listener: () => void): this; - - /** - * Clears the current line of this WriteStream in a direction identified by `dir`. - */ - clearLine(dir: Direction, callback?: () => void): boolean; - /** - * Clears this `WriteStream` from the current cursor down. - */ - clearScreenDown(callback?: () => void): boolean; - /** - * Moves this WriteStream's cursor to the specified position. - */ - cursorTo(x: number, y?: number, callback?: () => void): boolean; - cursorTo(x: number, callback: () => void): boolean; - /** - * Moves this WriteStream's cursor relative to its current position. - */ - moveCursor(dx: number, dy: number, callback?: () => void): boolean; - /** - * @default `process.env` - */ - getColorDepth(env?: {}): number; - hasColors(depth?: number): boolean; - hasColors(env?: {}): boolean; - hasColors(depth: number, env?: {}): boolean; - getWindowSize(): [number, number]; - columns: number; - rows: number; - isTTY: boolean; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/url.d.ts b/node_modules/protobufjs/node_modules/@types/node/url.d.ts deleted file mode 100644 index 2490c352..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/url.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -declare module "url" { - import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring'; - - // Input to `url.format` - interface UrlObject { - auth?: string | null; - hash?: string | null; - host?: string | null; - hostname?: string | null; - href?: string | null; - pathname?: string | null; - protocol?: string | null; - search?: string | null; - slashes?: boolean | null; - port?: string | number | null; - query?: string | null | ParsedUrlQueryInput; - } - - // Output of `url.parse` - interface Url { - auth: string | null; - hash: string | null; - host: string | null; - hostname: string | null; - href: string; - path: string | null; - pathname: string | null; - protocol: string | null; - search: string | null; - slashes: boolean | null; - port: string | null; - query: string | null | ParsedUrlQuery; - } - - interface UrlWithParsedQuery extends Url { - query: ParsedUrlQuery; - } - - interface UrlWithStringQuery extends Url { - query: string | null; - } - - function parse(urlStr: string): UrlWithStringQuery; - function parse(urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery; - function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; - function parse(urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; - - function format(URL: URL, options?: URLFormatOptions): string; - function format(urlObject: UrlObject | string): string; - function resolve(from: string, to: string): string; - - function domainToASCII(domain: string): string; - function domainToUnicode(domain: string): string; - - /** - * This function ensures the correct decodings of percent-encoded characters as - * well as ensuring a cross-platform valid absolute path string. - * @param url The file URL string or URL object to convert to a path. - */ - function fileURLToPath(url: string | URL): string; - - /** - * This function ensures that path is resolved absolutely, and that the URL - * control characters are correctly encoded when converting into a File URL. - * @param url The path to convert to a File URL. - */ - function pathToFileURL(url: string): URL; - - interface URLFormatOptions { - auth?: boolean; - fragment?: boolean; - search?: boolean; - unicode?: boolean; - } - - class URL { - constructor(input: string, base?: string | URL); - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - readonly searchParams: URLSearchParams; - username: string; - toString(): string; - toJSON(): string; - } - - class URLSearchParams implements Iterable<[string, string]> { - constructor(init?: URLSearchParams | string | NodeJS.Dict> | Iterable<[string, string]> | ReadonlyArray<[string, string]>); - append(name: string, value: string): void; - delete(name: string): void; - entries(): IterableIterator<[string, string]>; - forEach(callback: (value: string, name: string, searchParams: this) => void): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - keys(): IterableIterator; - set(name: string, value: string): void; - sort(): void; - toString(): string; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[string, string]>; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/util.d.ts b/node_modules/protobufjs/node_modules/@types/node/util.d.ts deleted file mode 100644 index 4360a3b8..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/util.d.ts +++ /dev/null @@ -1,209 +0,0 @@ -declare module "util" { - interface InspectOptions extends NodeJS.InspectOptions { } - type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module'; - type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string; - interface InspectOptionsStylized extends InspectOptions { - stylize(text: string, styleType: Style): string; - } - function format(format: any, ...param: any[]): string; - function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string; - /** @deprecated since v0.11.3 - use a third party module instead. */ - function log(string: string): void; - function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - function inspect(object: any, options: InspectOptions): string; - namespace inspect { - let colors: NodeJS.Dict<[number, number]>; - let styles: { - [K in Style]: string - }; - let defaultOptions: InspectOptions; - /** - * Allows changing inspect settings from the repl. - */ - let replDefaults: InspectOptions; - const custom: unique symbol; - } - /** @deprecated since v4.0.0 - use `Array.isArray()` instead. */ - function isArray(object: any): object is any[]; - /** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */ - function isRegExp(object: any): object is RegExp; - /** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */ - function isDate(object: any): object is Date; - /** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */ - function isError(object: any): object is Error; - function inherits(constructor: any, superConstructor: any): void; - function debuglog(key: string): (msg: string, ...param: any[]) => void; - /** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */ - function isBoolean(object: any): object is boolean; - /** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */ - function isBuffer(object: any): object is Buffer; - /** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */ - function isFunction(object: any): boolean; - /** @deprecated since v4.0.0 - use `value === null` instead. */ - function isNull(object: any): object is null; - /** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */ - function isNullOrUndefined(object: any): object is null | undefined; - /** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */ - function isNumber(object: any): object is number; - /** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */ - function isObject(object: any): boolean; - /** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */ - function isPrimitive(object: any): boolean; - /** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */ - function isString(object: any): object is string; - /** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */ - function isSymbol(object: any): object is symbol; - /** @deprecated since v4.0.0 - use `value === undefined` instead. */ - function isUndefined(object: any): object is undefined; - function deprecate(fn: T, message: string, code?: string): T; - function isDeepStrictEqual(val1: any, val2: any): boolean; - - function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - - interface CustomPromisifyLegacy extends Function { - __promisify__: TCustom; - } - - interface CustomPromisifySymbol extends Function { - [promisify.custom]: TCustom; - } - - type CustomPromisify = CustomPromisifySymbol | CustomPromisifyLegacy; - - function promisify(fn: CustomPromisify): TCustom; - function promisify(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise; - function promisify(fn: (callback: (err?: any) => void) => void): () => Promise; - function promisify(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void): - (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void): - (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - function promisify(fn: Function): Function; - namespace promisify { - const custom: unique symbol; - } - - namespace types { - function isAnyArrayBuffer(object: any): object is ArrayBufferLike; - function isArgumentsObject(object: any): object is IArguments; - function isArrayBuffer(object: any): object is ArrayBuffer; - function isArrayBufferView(object: any): object is NodeJS.ArrayBufferView; - function isAsyncFunction(object: any): boolean; - function isBigInt64Array(value: any): value is BigInt64Array; - function isBigUint64Array(value: any): value is BigUint64Array; - function isBooleanObject(object: any): object is Boolean; - function isBoxedPrimitive(object: any): object is String | Number | BigInt | Boolean | Symbol; - function isDataView(object: any): object is DataView; - function isDate(object: any): object is Date; - function isExternal(object: any): boolean; - function isFloat32Array(object: any): object is Float32Array; - function isFloat64Array(object: any): object is Float64Array; - function isGeneratorFunction(object: any): object is GeneratorFunction; - function isGeneratorObject(object: any): object is Generator; - function isInt8Array(object: any): object is Int8Array; - function isInt16Array(object: any): object is Int16Array; - function isInt32Array(object: any): object is Int32Array; - function isMap( - object: T | {}, - ): object is T extends ReadonlyMap - ? unknown extends T - ? never - : ReadonlyMap - : Map; - function isMapIterator(object: any): boolean; - function isModuleNamespaceObject(value: any): boolean; - function isNativeError(object: any): object is Error; - function isNumberObject(object: any): object is Number; - function isPromise(object: any): object is Promise; - function isProxy(object: any): boolean; - function isRegExp(object: any): object is RegExp; - function isSet( - object: T | {}, - ): object is T extends ReadonlySet - ? unknown extends T - ? never - : ReadonlySet - : Set; - function isSetIterator(object: any): boolean; - function isSharedArrayBuffer(object: any): object is SharedArrayBuffer; - function isStringObject(object: any): object is String; - function isSymbolObject(object: any): object is Symbol; - function isTypedArray(object: any): object is NodeJS.TypedArray; - function isUint8Array(object: any): object is Uint8Array; - function isUint8ClampedArray(object: any): object is Uint8ClampedArray; - function isUint16Array(object: any): object is Uint16Array; - function isUint32Array(object: any): object is Uint32Array; - function isWeakMap(object: any): object is WeakMap; - function isWeakSet(object: any): object is WeakSet; - /** @deprecated Removed in v14.0.0 */ - function isWebAssemblyCompiledModule(object: any): boolean; - } - - class TextDecoder { - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; - constructor( - encoding?: string, - options?: { fatal?: boolean; ignoreBOM?: boolean } - ); - decode( - input?: NodeJS.ArrayBufferView | ArrayBuffer | null, - options?: { stream?: boolean } - ): string; - } - - interface EncodeIntoResult { - /** - * The read Unicode code units of input. - */ - - read: number; - /** - * The written UTF-8 bytes of output. - */ - written: number; - } - - class TextEncoder { - readonly encoding: string; - encode(input?: string): Uint8Array; - encodeInto(input: string, output: Uint8Array): EncodeIntoResult; - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/v8.d.ts b/node_modules/protobufjs/node_modules/@types/node/v8.d.ts deleted file mode 100644 index 7d950824..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/v8.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -declare module "v8" { - import { Readable } from "stream"; - - interface HeapSpaceInfo { - space_name: string; - space_size: number; - space_used_size: number; - space_available_size: number; - physical_space_size: number; - } - - // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ - type DoesZapCodeSpaceFlag = 0 | 1; - - interface HeapInfo { - total_heap_size: number; - total_heap_size_executable: number; - total_physical_size: number; - total_available_size: number; - used_heap_size: number; - heap_size_limit: number; - malloced_memory: number; - peak_malloced_memory: number; - does_zap_garbage: DoesZapCodeSpaceFlag; - number_of_native_contexts: number; - number_of_detached_contexts: number; - } - - interface HeapCodeStatistics { - code_and_metadata_size: number; - bytecode_and_metadata_size: number; - external_script_source_size: number; - } - - /** - * Returns an integer representing a "version tag" derived from the V8 version, command line flags and detected CPU features. - * This is useful for determining whether a vm.Script cachedData buffer is compatible with this instance of V8. - */ - function cachedDataVersionTag(): number; - - function getHeapStatistics(): HeapInfo; - function getHeapSpaceStatistics(): HeapSpaceInfo[]; - function setFlagsFromString(flags: string): void; - /** - * Generates a snapshot of the current V8 heap and returns a Readable - * Stream that may be used to read the JSON serialized representation. - * This conversation was marked as resolved by joyeecheung - * This JSON stream format is intended to be used with tools such as - * Chrome DevTools. The JSON schema is undocumented and specific to the - * V8 engine, and may change from one version of V8 to the next. - */ - function getHeapSnapshot(): Readable; - - /** - * - * @param fileName The file path where the V8 heap snapshot is to be - * saved. If not specified, a file name with the pattern - * `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be - * generated, where `{pid}` will be the PID of the Node.js process, - * `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from - * the main Node.js thread or the id of a worker thread. - */ - function writeHeapSnapshot(fileName?: string): string; - - function getHeapCodeStatistics(): HeapCodeStatistics; - - class Serializer { - /** - * Writes out a header, which includes the serialization format version. - */ - writeHeader(): void; - - /** - * Serializes a JavaScript value and adds the serialized representation to the internal buffer. - * This throws an error if value cannot be serialized. - */ - writeValue(val: any): boolean; - - /** - * Returns the stored internal buffer. - * This serializer should not be used once the buffer is released. - * Calling this method results in undefined behavior if a previous write has failed. - */ - releaseBuffer(): Buffer; - - /** - * Marks an ArrayBuffer as having its contents transferred out of band.\ - * Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer(). - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - - /** - * Write a raw 32-bit unsigned integer. - */ - writeUint32(value: number): void; - - /** - * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. - */ - writeUint64(hi: number, lo: number): void; - - /** - * Write a JS number value. - */ - writeDouble(value: number): void; - - /** - * Write raw bytes into the serializer’s internal buffer. - * The deserializer will require a way to compute the length of the buffer. - */ - writeRawBytes(buffer: NodeJS.TypedArray): void; - } - - /** - * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, - * and only stores the part of their underlying `ArrayBuffers` that they are referring to. - */ - class DefaultSerializer extends Serializer { - } - - class Deserializer { - constructor(data: NodeJS.TypedArray); - /** - * Reads and validates a header (including the format version). - * May, for example, reject an invalid or unsupported wire format. - * In that case, an Error is thrown. - */ - readHeader(): boolean; - - /** - * Deserializes a JavaScript value from the buffer and returns it. - */ - readValue(): any; - - /** - * Marks an ArrayBuffer as having its contents transferred out of band. - * Pass the corresponding `ArrayBuffer` in the serializing context to serializer.transferArrayBuffer() - * (or return the id from serializer._getSharedArrayBufferId() in the case of SharedArrayBuffers). - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - - /** - * Reads the underlying wire format version. - * Likely mostly to be useful to legacy code reading old wire format versions. - * May not be called before .readHeader(). - */ - getWireFormatVersion(): number; - - /** - * Read a raw 32-bit unsigned integer and return it. - */ - readUint32(): number; - - /** - * Read a raw 64-bit unsigned integer and return it as an array [hi, lo] with two 32-bit unsigned integer entries. - */ - readUint64(): [number, number]; - - /** - * Read a JS number value. - */ - readDouble(): number; - - /** - * Read raw bytes from the deserializer’s internal buffer. - * The length parameter must correspond to the length of the buffer that was passed to serializer.writeRawBytes(). - */ - readRawBytes(length: number): Buffer; - } - - /** - * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, - * and only stores the part of their underlying `ArrayBuffers` that they are referring to. - */ - class DefaultDeserializer extends Deserializer { - } - - /** - * Uses a `DefaultSerializer` to serialize value into a buffer. - */ - function serialize(value: any): Buffer; - - /** - * Uses a `DefaultDeserializer` with default options to read a JS value from a buffer. - */ - function deserialize(data: NodeJS.TypedArray): any; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/vm.d.ts b/node_modules/protobufjs/node_modules/@types/node/vm.d.ts deleted file mode 100644 index 66bea639..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/vm.d.ts +++ /dev/null @@ -1,142 +0,0 @@ -declare module "vm" { - interface Context extends NodeJS.Dict { } - interface BaseOptions { - /** - * Specifies the filename used in stack traces produced by this script. - * Default: `''`. - */ - filename?: string; - /** - * Specifies the line number offset that is displayed in stack traces produced by this script. - * Default: `0`. - */ - lineOffset?: number; - /** - * Specifies the column number offset that is displayed in stack traces produced by this script. - * Default: `0` - */ - columnOffset?: number; - } - interface ScriptOptions extends BaseOptions { - displayErrors?: boolean; - timeout?: number; - cachedData?: Buffer; - produceCachedData?: boolean; - } - interface RunningScriptOptions extends BaseOptions { - /** - * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * Default: `true`. - */ - displayErrors?: boolean; - /** - * Specifies the number of milliseconds to execute code before terminating execution. - * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer. - */ - timeout?: number; - /** - * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. - * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that. - * If execution is terminated, an `Error` will be thrown. - * Default: `false`. - */ - breakOnSigint?: boolean; - } - interface CompileFunctionOptions extends BaseOptions { - /** - * Provides an optional data with V8's code cache data for the supplied source. - */ - cachedData?: Buffer; - /** - * Specifies whether to produce new cache data. - * Default: `false`, - */ - produceCachedData?: boolean; - /** - * The sandbox/context in which the said function should be compiled in. - */ - parsingContext?: Context; - - /** - * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling - */ - contextExtensions?: Object[]; - } - - interface CreateContextOptions { - /** - * Human-readable name of the newly created context. - * @default 'VM Context i' Where i is an ascending numerical index of the created context. - */ - name?: string; - /** - * Corresponds to the newly created context for display purposes. - * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary), - * like the value of the `url.origin` property of a URL object. - * Most notably, this string should omit the trailing slash, as that denotes a path. - * @default '' - */ - origin?: string; - codeGeneration?: { - /** - * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc) - * will throw an EvalError. - * @default true - */ - strings?: boolean; - /** - * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError. - * @default true - */ - wasm?: boolean; - }; - } - - type MeasureMemoryMode = 'summary' | 'detailed'; - - interface MeasureMemoryOptions { - /** - * @default 'summary' - */ - mode?: MeasureMemoryMode; - context?: Context; - } - - interface MemoryMeasurement { - total: { - jsMemoryEstimate: number; - jsMemoryRange: [number, number]; - }; - } - - class Script { - constructor(code: string, options?: ScriptOptions); - runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any; - runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any; - runInThisContext(options?: RunningScriptOptions): any; - createCachedData(): Buffer; - } - function createContext(sandbox?: Context, options?: CreateContextOptions): Context; - function isContext(sandbox: Context): boolean; - function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any; - function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any; - function runInThisContext(code: string, options?: RunningScriptOptions | string): any; - function compileFunction(code: string, params?: ReadonlyArray, options?: CompileFunctionOptions): Function; - - /** - * Measure the memory known to V8 and used by the current execution context or a specified context. - * - * The format of the object that the returned Promise may resolve with is - * specific to the V8 engine and may change from one version of V8 to the next. - * - * The returned result is different from the statistics returned by - * `v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measures - * the memory reachable by V8 from a specific context, while - * `v8.getHeapSpaceStatistics()` measures the memory used by an instance - * of V8 engine, which can switch among multiple contexts that reference - * objects in the heap of one engine. - * - * @experimental - */ - function measureMemory(options?: MeasureMemoryOptions): Promise; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/wasi.d.ts b/node_modules/protobufjs/node_modules/@types/node/wasi.d.ts deleted file mode 100644 index 21f64fa3..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/wasi.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -declare module 'wasi' { - interface WASIOptions { - /** - * An array of strings that the WebAssembly application will - * see as command line arguments. The first argument is the virtual path to the - * WASI command itself. - */ - args?: string[]; - - /** - * An object similar to `process.env` that the WebAssembly - * application will see as its environment. - */ - env?: object; - - /** - * This object represents the WebAssembly application's - * sandbox directory structure. The string keys of `preopens` are treated as - * directories within the sandbox. The corresponding values in `preopens` are - * the real paths to those directories on the host machine. - */ - preopens?: NodeJS.Dict; - - /** - * By default, WASI applications terminate the Node.js - * process via the `__wasi_proc_exit()` function. Setting this option to `true` - * causes `wasi.start()` to return the exit code rather than terminate the - * process. - * @default false - */ - returnOnExit?: boolean; - } - - class WASI { - constructor(options?: WASIOptions); - /** - * - * Attempt to begin execution of `instance` by invoking its `_start()` export. - * If `instance` does not contain a `_start()` export, then `start()` attempts to - * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports - * is present on `instance`, then `start()` does nothing. - * - * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named - * `memory`. If `instance` does not have a `memory` export an exception is thrown. - */ - start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib. - - /** - * Is an object that implements the WASI system call API. This object - * should be passed as the `wasi_snapshot_preview1` import during the instantiation of a - * [`WebAssembly.Instance`][]. - */ - readonly wasiImport: NodeJS.Dict; // TODO: Narrow to DOM types - } -} diff --git a/node_modules/protobufjs/node_modules/@types/node/worker_threads.d.ts b/node_modules/protobufjs/node_modules/@types/node/worker_threads.d.ts deleted file mode 100644 index 8a54db67..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/worker_threads.d.ts +++ /dev/null @@ -1,209 +0,0 @@ -declare module "worker_threads" { - import { Context } from "vm"; - import { EventEmitter } from "events"; - import { Readable, Writable } from "stream"; - import { URL } from "url"; - - const isMainThread: boolean; - const parentPort: null | MessagePort; - const resourceLimits: ResourceLimits; - const SHARE_ENV: unique symbol; - const threadId: number; - const workerData: any; - - class MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; - } - - type TransferListItem = ArrayBuffer | MessagePort; - - class MessagePort extends EventEmitter { - close(): void; - postMessage(value: any, transferList?: ReadonlyArray): void; - ref(): void; - unref(): void; - start(): void; - - addListener(event: "close", listener: () => void): this; - addListener(event: "message", listener: (value: any) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "close"): boolean; - emit(event: "message", value: any): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "close", listener: () => void): this; - on(event: "message", listener: (value: any) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "close", listener: () => void): this; - once(event: "message", listener: (value: any) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "close", listener: () => void): this; - prependListener(event: "message", listener: (value: any) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "message", listener: (value: any) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "close", listener: () => void): this; - removeListener(event: "message", listener: (value: any) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - off(event: "close", listener: () => void): this; - off(event: "message", listener: (value: any) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - } - - interface WorkerOptions { - /** - * List of arguments which would be stringified and appended to - * `process.argv` in the worker. This is mostly similar to the `workerData` - * but the values will be available on the global `process.argv` as if they - * were passed as CLI options to the script. - */ - argv?: any[]; - env?: NodeJS.Dict | typeof SHARE_ENV; - eval?: boolean; - workerData?: any; - stdin?: boolean; - stdout?: boolean; - stderr?: boolean; - execArgv?: string[]; - resourceLimits?: ResourceLimits; - /** - * Additional data to send in the first worker message. - */ - transferList?: TransferListItem[]; - } - - interface ResourceLimits { - maxYoungGenerationSizeMb?: number; - maxOldGenerationSizeMb?: number; - codeRangeSizeMb?: number; - } - - interface ResourceLimits { - /** - * The maximum size of a heap space for recently created objects. - */ - maxYoungGenerationSizeMb?: number; - /** - * The maximum size of the main heap in MB. - */ - maxOldGenerationSizeMb?: number; - /** - * The size of a pre-allocated memory range used for generated code. - */ - codeRangeSizeMb?: number; - } - - class Worker extends EventEmitter { - readonly stdin: Writable | null; - readonly stdout: Readable; - readonly stderr: Readable; - readonly threadId: number; - readonly resourceLimits?: ResourceLimits; - - /** - * @param filename The path to the Worker’s main script or module. - * Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../, - * or a WHATWG URL object using file: protocol. If options.eval is true, this is a string containing JavaScript code rather than a path. - */ - constructor(filename: string | URL, options?: WorkerOptions); - - postMessage(value: any, transferList?: ReadonlyArray): void; - ref(): void; - unref(): void; - /** - * Stop all JavaScript execution in the worker thread as soon as possible. - * Returns a Promise for the exit code that is fulfilled when the `exit` event is emitted. - */ - terminate(): Promise; - - /** - * Returns a readable stream for a V8 snapshot of the current state of the Worker. - * See [`v8.getHeapSnapshot()`][] for more details. - * - * If the Worker thread is no longer running, which may occur before the - * [`'exit'` event][] is emitted, the returned `Promise` will be rejected - * immediately with an [`ERR_WORKER_NOT_RUNNING`][] error - */ - getHeapSnapshot(): Promise; - - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (exitCode: number) => void): this; - addListener(event: "message", listener: (value: any) => void): this; - addListener(event: "online", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: "error", err: Error): boolean; - emit(event: "exit", exitCode: number): boolean; - emit(event: "message", value: any): boolean; - emit(event: "online"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (exitCode: number) => void): this; - on(event: "message", listener: (value: any) => void): this; - on(event: "online", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (exitCode: number) => void): this; - once(event: "message", listener: (value: any) => void): this; - once(event: "online", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (exitCode: number) => void): this; - prependListener(event: "message", listener: (value: any) => void): this; - prependListener(event: "online", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "exit", listener: (exitCode: number) => void): this; - prependOnceListener(event: "message", listener: (value: any) => void): this; - prependOnceListener(event: "online", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "exit", listener: (exitCode: number) => void): this; - removeListener(event: "message", listener: (value: any) => void): this; - removeListener(event: "online", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - off(event: "error", listener: (err: Error) => void): this; - off(event: "exit", listener: (exitCode: number) => void): this; - off(event: "message", listener: (value: any) => void): this; - off(event: "online", listener: () => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - } - - /** - * Transfer a `MessagePort` to a different `vm` Context. The original `port` - * object will be rendered unusable, and the returned `MessagePort` instance will - * take its place. - * - * The returned `MessagePort` will be an object in the target context, and will - * inherit from its global `Object` class. Objects passed to the - * `port.onmessage()` listener will also be created in the target context - * and inherit from its global `Object` class. - * - * However, the created `MessagePort` will no longer inherit from - * `EventEmitter`, and only `port.onmessage()` can be used to receive - * events using it. - */ - function moveMessagePortToContext(port: MessagePort, context: Context): MessagePort; - - /** - * Receive a single message from a given `MessagePort`. If no message is available, - * `undefined` is returned, otherwise an object with a single `message` property - * that contains the message payload, corresponding to the oldest message in the - * `MessagePort`’s queue. - */ - function receiveMessageOnPort(port: MessagePort): { message: any } | undefined; -} diff --git a/node_modules/protobufjs/node_modules/@types/node/zlib.d.ts b/node_modules/protobufjs/node_modules/@types/node/zlib.d.ts deleted file mode 100644 index 95ba18f8..00000000 --- a/node_modules/protobufjs/node_modules/@types/node/zlib.d.ts +++ /dev/null @@ -1,353 +0,0 @@ -declare module "zlib" { - import * as stream from "stream"; - - interface ZlibOptions { - /** - * @default constants.Z_NO_FLUSH - */ - flush?: number; - /** - * @default constants.Z_FINISH - */ - finishFlush?: number; - /** - * @default 16*1024 - */ - chunkSize?: number; - windowBits?: number; - level?: number; // compression only - memLevel?: number; // compression only - strategy?: number; // compression only - dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default - info?: boolean; - } - - interface BrotliOptions { - /** - * @default constants.BROTLI_OPERATION_PROCESS - */ - flush?: number; - /** - * @default constants.BROTLI_OPERATION_FINISH - */ - finishFlush?: number; - /** - * @default 16*1024 - */ - chunkSize?: number; - params?: { - /** - * Each key is a `constants.BROTLI_*` constant. - */ - [key: number]: boolean | number; - }; - } - - interface Zlib { - /** @deprecated Use bytesWritten instead. */ - readonly bytesRead: number; - readonly bytesWritten: number; - shell?: boolean | string; - close(callback?: () => void): void; - flush(kind?: number | (() => void), callback?: () => void): void; - } - - interface ZlibParams { - params(level: number, strategy: number, callback: () => void): void; - } - - interface ZlibReset { - reset(): void; - } - - interface BrotliCompress extends stream.Transform, Zlib { } - interface BrotliDecompress extends stream.Transform, Zlib { } - interface Gzip extends stream.Transform, Zlib { } - interface Gunzip extends stream.Transform, Zlib { } - interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams { } - interface Inflate extends stream.Transform, Zlib, ZlibReset { } - interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams { } - interface InflateRaw extends stream.Transform, Zlib, ZlibReset { } - interface Unzip extends stream.Transform, Zlib { } - - function createBrotliCompress(options?: BrotliOptions): BrotliCompress; - function createBrotliDecompress(options?: BrotliOptions): BrotliDecompress; - function createGzip(options?: ZlibOptions): Gzip; - function createGunzip(options?: ZlibOptions): Gunzip; - function createDeflate(options?: ZlibOptions): Deflate; - function createInflate(options?: ZlibOptions): Inflate; - function createDeflateRaw(options?: ZlibOptions): DeflateRaw; - function createInflateRaw(options?: ZlibOptions): InflateRaw; - function createUnzip(options?: ZlibOptions): Unzip; - - type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView; - - type CompressCallback = (error: Error | null, result: Buffer) => void; - - function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; - function brotliCompress(buf: InputType, callback: CompressCallback): void; - function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer; - function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; - function brotliDecompress(buf: InputType, callback: CompressCallback): void; - function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer; - function deflate(buf: InputType, callback: CompressCallback): void; - function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - function deflateSync(buf: InputType, options?: ZlibOptions): Buffer; - function deflateRaw(buf: InputType, callback: CompressCallback): void; - function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; - function gzip(buf: InputType, callback: CompressCallback): void; - function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - function gzipSync(buf: InputType, options?: ZlibOptions): Buffer; - function gunzip(buf: InputType, callback: CompressCallback): void; - function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer; - function inflate(buf: InputType, callback: CompressCallback): void; - function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - function inflateSync(buf: InputType, options?: ZlibOptions): Buffer; - function inflateRaw(buf: InputType, callback: CompressCallback): void; - function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer; - function unzip(buf: InputType, callback: CompressCallback): void; - function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; - function unzipSync(buf: InputType, options?: ZlibOptions): Buffer; - - namespace constants { - const BROTLI_DECODE: number; - const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number; - const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number; - const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number; - const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number; - const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number; - const BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number; - const BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number; - const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number; - const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number; - const BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number; - const BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number; - const BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number; - const BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number; - const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number; - const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number; - const BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number; - const BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number; - const BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number; - const BROTLI_DECODER_ERROR_FORMAT_RESERVED: number; - const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number; - const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number; - const BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number; - const BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number; - const BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number; - const BROTLI_DECODER_ERROR_UNREACHABLE: number; - const BROTLI_DECODER_NEEDS_MORE_INPUT: number; - const BROTLI_DECODER_NEEDS_MORE_OUTPUT: number; - const BROTLI_DECODER_NO_ERROR: number; - const BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number; - const BROTLI_DECODER_PARAM_LARGE_WINDOW: number; - const BROTLI_DECODER_RESULT_ERROR: number; - const BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number; - const BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number; - const BROTLI_DECODER_RESULT_SUCCESS: number; - const BROTLI_DECODER_SUCCESS: number; - - const BROTLI_DEFAULT_MODE: number; - const BROTLI_DEFAULT_QUALITY: number; - const BROTLI_DEFAULT_WINDOW: number; - const BROTLI_ENCODE: number; - const BROTLI_LARGE_MAX_WINDOW_BITS: number; - const BROTLI_MAX_INPUT_BLOCK_BITS: number; - const BROTLI_MAX_QUALITY: number; - const BROTLI_MAX_WINDOW_BITS: number; - const BROTLI_MIN_INPUT_BLOCK_BITS: number; - const BROTLI_MIN_QUALITY: number; - const BROTLI_MIN_WINDOW_BITS: number; - - const BROTLI_MODE_FONT: number; - const BROTLI_MODE_GENERIC: number; - const BROTLI_MODE_TEXT: number; - - const BROTLI_OPERATION_EMIT_METADATA: number; - const BROTLI_OPERATION_FINISH: number; - const BROTLI_OPERATION_FLUSH: number; - const BROTLI_OPERATION_PROCESS: number; - - const BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number; - const BROTLI_PARAM_LARGE_WINDOW: number; - const BROTLI_PARAM_LGBLOCK: number; - const BROTLI_PARAM_LGWIN: number; - const BROTLI_PARAM_MODE: number; - const BROTLI_PARAM_NDIRECT: number; - const BROTLI_PARAM_NPOSTFIX: number; - const BROTLI_PARAM_QUALITY: number; - const BROTLI_PARAM_SIZE_HINT: number; - - const DEFLATE: number; - const DEFLATERAW: number; - const GUNZIP: number; - const GZIP: number; - const INFLATE: number; - const INFLATERAW: number; - const UNZIP: number; - - const Z_BEST_COMPRESSION: number; - const Z_BEST_SPEED: number; - const Z_BLOCK: number; - const Z_BUF_ERROR: number; - const Z_DATA_ERROR: number; - - const Z_DEFAULT_CHUNK: number; - const Z_DEFAULT_COMPRESSION: number; - const Z_DEFAULT_LEVEL: number; - const Z_DEFAULT_MEMLEVEL: number; - const Z_DEFAULT_STRATEGY: number; - const Z_DEFAULT_WINDOWBITS: number; - - const Z_ERRNO: number; - const Z_FILTERED: number; - const Z_FINISH: number; - const Z_FIXED: number; - const Z_FULL_FLUSH: number; - const Z_HUFFMAN_ONLY: number; - const Z_MAX_CHUNK: number; - const Z_MAX_LEVEL: number; - const Z_MAX_MEMLEVEL: number; - const Z_MAX_WINDOWBITS: number; - const Z_MEM_ERROR: number; - const Z_MIN_CHUNK: number; - const Z_MIN_LEVEL: number; - const Z_MIN_MEMLEVEL: number; - const Z_MIN_WINDOWBITS: number; - const Z_NEED_DICT: number; - const Z_NO_COMPRESSION: number; - const Z_NO_FLUSH: number; - const Z_OK: number; - const Z_PARTIAL_FLUSH: number; - const Z_RLE: number; - const Z_STREAM_END: number; - const Z_STREAM_ERROR: number; - const Z_SYNC_FLUSH: number; - const Z_VERSION_ERROR: number; - const ZLIB_VERNUM: number; - } - - /** - * @deprecated - */ - const Z_NO_FLUSH: number; - /** - * @deprecated - */ - const Z_PARTIAL_FLUSH: number; - /** - * @deprecated - */ - const Z_SYNC_FLUSH: number; - /** - * @deprecated - */ - const Z_FULL_FLUSH: number; - /** - * @deprecated - */ - const Z_FINISH: number; - /** - * @deprecated - */ - const Z_BLOCK: number; - /** - * @deprecated - */ - const Z_TREES: number; - /** - * @deprecated - */ - const Z_OK: number; - /** - * @deprecated - */ - const Z_STREAM_END: number; - /** - * @deprecated - */ - const Z_NEED_DICT: number; - /** - * @deprecated - */ - const Z_ERRNO: number; - /** - * @deprecated - */ - const Z_STREAM_ERROR: number; - /** - * @deprecated - */ - const Z_DATA_ERROR: number; - /** - * @deprecated - */ - const Z_MEM_ERROR: number; - /** - * @deprecated - */ - const Z_BUF_ERROR: number; - /** - * @deprecated - */ - const Z_VERSION_ERROR: number; - /** - * @deprecated - */ - const Z_NO_COMPRESSION: number; - /** - * @deprecated - */ - const Z_BEST_SPEED: number; - /** - * @deprecated - */ - const Z_BEST_COMPRESSION: number; - /** - * @deprecated - */ - const Z_DEFAULT_COMPRESSION: number; - /** - * @deprecated - */ - const Z_FILTERED: number; - /** - * @deprecated - */ - const Z_HUFFMAN_ONLY: number; - /** - * @deprecated - */ - const Z_RLE: number; - /** - * @deprecated - */ - const Z_FIXED: number; - /** - * @deprecated - */ - const Z_DEFAULT_STRATEGY: number; - /** - * @deprecated - */ - const Z_BINARY: number; - /** - * @deprecated - */ - const Z_TEXT: number; - /** - * @deprecated - */ - const Z_ASCII: number; - /** - * @deprecated - */ - const Z_UNKNOWN: number; - /** - * @deprecated - */ - const Z_DEFLATED: number; -} diff --git a/node_modules/protobufjs/package-lock.json b/node_modules/protobufjs/package-lock.json deleted file mode 100644 index 6224c884..00000000 --- a/node_modules/protobufjs/package-lock.json +++ /dev/null @@ -1,8922 +0,0 @@ -{ - "name": "protobufjs", - "version": "6.10.2", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.8.3" - } - }, - "@babel/core": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.0.tgz", - "integrity": "sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.0", - "@babel/helper-module-transforms": "^7.9.0", - "@babel/helpers": "^7.9.0", - "@babel/parser": "^7.9.0", - "@babel/template": "^7.8.6", - "@babel/traverse": "^7.9.0", - "@babel/types": "^7.9.0", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.13", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.5.tgz", - "integrity": "sha512-GbNIxVB3ZJe3tLeDm1HSn2AhuD/mVcyLDpgtLXa5tplmWrJdF/elxB56XNqCuD6szyNkDi6wuoKXln3QeBmCHQ==", - "dev": true, - "requires": { - "@babel/types": "^7.9.5", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" - } - }, - "@babel/helper-function-name": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz", - "integrity": "sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.8.3", - "@babel/template": "^7.8.3", - "@babel/types": "^7.9.5" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", - "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", - "integrity": "sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-module-imports": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", - "integrity": "sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-module-transforms": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz", - "integrity": "sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.8.3", - "@babel/helper-replace-supers": "^7.8.6", - "@babel/helper-simple-access": "^7.8.3", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/template": "^7.8.6", - "@babel/types": "^7.9.0", - "lodash": "^4.17.13" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", - "integrity": "sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-replace-supers": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz", - "integrity": "sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA==", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.8.3", - "@babel/helper-optimise-call-expression": "^7.8.3", - "@babel/traverse": "^7.8.6", - "@babel/types": "^7.8.6" - } - }, - "@babel/helper-simple-access": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", - "integrity": "sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw==", - "dev": true, - "requires": { - "@babel/template": "^7.8.3", - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", - "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", - "dev": true, - "requires": { - "@babel/types": "^7.8.3" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", - "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", - "dev": true - }, - "@babel/helpers": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.9.2.tgz", - "integrity": "sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA==", - "dev": true, - "requires": { - "@babel/template": "^7.8.3", - "@babel/traverse": "^7.9.0", - "@babel/types": "^7.9.0" - } - }, - "@babel/highlight": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", - "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", - "dev": true, - "requires": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@babel/parser": { - "version": "7.9.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", - "integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==", - "dev": true - }, - "@babel/template": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", - "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/parser": "^7.8.6", - "@babel/types": "^7.8.6" - } - }, - "@babel/traverse": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.5.tgz", - "integrity": "sha512-c4gH3jsvSuGUezlP6rzSJ6jf8fYjLj3hsMZRx/nX0h+fmHN0w+ekubRrHPqnMec0meycA2nwCsJ7dC8IPem2FQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.5", - "@babel/helper-function-name": "^7.9.5", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/parser": "^7.9.0", - "@babel/types": "^7.9.5", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "@babel/types": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.5.tgz", - "integrity": "sha512-XjnvNqenk818r5zMaba+sLQjnbda31UfUURv3ei0qPQw4u+j2jMyJ5b11y8ZHYTRSI3NnInQkkkRT4fLqqPdHg==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.9.5", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - } - }, - "@gulp-sourcemaps/identity-map": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/identity-map/-/identity-map-1.0.2.tgz", - "integrity": "sha512-ciiioYMLdo16ShmfHBXJBOFm3xPC4AuwO4xeRpFeHz7WK9PYsWCmigagG2XyzZpubK4a3qNKoUBDhbzHfa50LQ==", - "dev": true, - "requires": { - "acorn": "^5.0.3", - "css": "^2.2.1", - "normalize-path": "^2.1.1", - "source-map": "^0.6.0", - "through2": "^2.0.3" - }, - "dependencies": { - "acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "@gulp-sourcemaps/map-sources": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/map-sources/-/map-sources-1.0.0.tgz", - "integrity": "sha1-iQrnxdjId/bThIYCFazp1+yUW9o=", - "dev": true, - "requires": { - "normalize-path": "^2.0.1", - "through2": "^2.0.3" - } - }, - "@istanbuljs/load-nyc-config": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", - "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - } - }, - "@istanbuljs/schema": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", - "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", - "dev": true - }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" - }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", - "dev": true - }, - "@types/long": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", - "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" - }, - "@types/minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=", - "dev": true - }, - "@types/node": { - "version": "13.11.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.1.tgz", - "integrity": "sha512-eWQGP3qtxwL8FGneRrC5DwrJLGN4/dH1clNTuLfN81HCrxVtxRjygDTUoZJ5ASlDEeo0ppYFQjQIlXhtXpOn6g==" - }, - "@types/normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", - "dev": true - }, - "JSONStream": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", - "integrity": "sha1-wQI3G27Dp887hHygDCC7D85Mbeo=", - "dev": true, - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, - "acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", - "dev": true - }, - "acorn-jsx": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", - "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", - "dev": true - }, - "acorn-node": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", - "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", - "dev": true, - "requires": { - "acorn": "^7.0.0", - "acorn-walk": "^7.0.0", - "xtend": "^4.0.2" - }, - "dependencies": { - "acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", - "dev": true - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true - } - } - }, - "acorn-walk": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.0.0.tgz", - "integrity": "sha512-7Bv1We7ZGuU79zZbb6rRqcpxo3OY+zrdtloZWoyD8fmGX+FeXRjE+iuGkZjSXLVovLzrsvMGMy0EkwA0E0umxg==", - "dev": true - }, - "aggregate-error": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", - "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", - "dev": true, - "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - } - }, - "ajv": { - "version": "6.12.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", - "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-colors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", - "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", - "dev": true, - "requires": { - "ansi-wrap": "^0.1.0" - } - }, - "ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - }, - "dependencies": { - "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true - } - } - }, - "ansi-gray": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", - "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", - "dev": true, - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", - "dev": true - }, - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "append-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz", - "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", - "dev": true, - "requires": { - "buffer-equal": "^1.0.0" - } - }, - "append-transform": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", - "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", - "dev": true, - "requires": { - "default-require-extensions": "^3.0.0" - } - }, - "archy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-filter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/arr-filter/-/arr-filter-1.1.2.tgz", - "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=", - "dev": true, - "requires": { - "make-iterator": "^1.0.0" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/arr-map/-/arr-map-2.0.2.tgz", - "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=", - "dev": true, - "requires": { - "make-iterator": "^1.0.0" - } - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", - "dev": true - }, - "array-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", - "dev": true - }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true - }, - "array-initial": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", - "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=", - "dev": true, - "requires": { - "array-slice": "^1.0.0", - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } - } - }, - "array-last": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array-last/-/array-last-1.3.0.tgz", - "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==", - "dev": true, - "requires": { - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } - } - }, - "array-slice": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", - "dev": true - }, - "array-sort": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-1.0.0.tgz", - "integrity": "sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg==", - "dev": true, - "requires": { - "default-compare": "^1.0.0", - "get-value": "^2.0.6", - "kind-of": "^5.0.2" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } - } - }, - "assert": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", - "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", - "dev": true, - "requires": { - "object-assign": "^4.1.1", - "util": "0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - } - } - } - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true - }, - "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } - }, - "async-done": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.2.tgz", - "integrity": "sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.2", - "process-nextick-args": "^2.0.0", - "stream-exhaust": "^1.0.1" - } - }, - "async-each": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", - "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", - "dev": true - }, - "async-settle": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", - "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=", - "dev": true, - "requires": { - "async-done": "^1.2.2" - } - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true - }, - "available-typed-arrays": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", - "integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==", - "dev": true, - "requires": { - "array-filter": "^1.0.0" - } - }, - "bach": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", - "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=", - "dev": true, - "requires": { - "arr-filter": "^1.1.1", - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "array-each": "^1.0.0", - "array-initial": "^1.0.0", - "array-last": "^1.1.1", - "async-done": "^1.2.2", - "async-settle": "^1.0.0", - "now-and-later": "^2.0.0" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", - "dev": true - }, - "benchmark": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", - "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", - "dev": true, - "requires": { - "lodash": "^4.17.4", - "platform": "^1.3.3" - } - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true - }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, - "bl": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", - "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", - "dev": true, - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true - }, - "bn.js": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", - "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true - }, - "browser-pack": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", - "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "combine-source-map": "~0.8.0", - "defined": "^1.0.0", - "safe-buffer": "^5.1.1", - "through2": "^2.0.0", - "umd": "^3.0.0" - } - }, - "browser-resolve": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", - "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", - "dev": true, - "requires": { - "resolve": "^1.17.0" - }, - "dependencies": { - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - } - } - }, - "browser-unpack": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/browser-unpack/-/browser-unpack-1.4.2.tgz", - "integrity": "sha512-uHkiY4bmXjjBBWoKH1aRnEGTQxUUCCcVtoJfH9w1lmGGjETY4u93Zk+GRYkCE/SRMrdoMTINQ/1/manr/3aMVA==", - "dev": true, - "requires": { - "acorn-node": "^1.5.2", - "concat-stream": "^1.5.0", - "minimist": "^1.1.1" - } - }, - "browserify": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/browserify/-/browserify-17.0.0.tgz", - "integrity": "sha512-SaHqzhku9v/j6XsQMRxPyBrSP3gnwmE27gLJYZgMT2GeK3J0+0toN+MnuNYDfHwVGQfLiMZ7KSNSIXHemy905w==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "assert": "^1.4.0", - "browser-pack": "^6.0.1", - "browser-resolve": "^2.0.0", - "browserify-zlib": "~0.2.0", - "buffer": "~5.2.1", - "cached-path-relative": "^1.0.0", - "concat-stream": "^1.6.0", - "console-browserify": "^1.1.0", - "constants-browserify": "~1.0.0", - "crypto-browserify": "^3.0.0", - "defined": "^1.0.0", - "deps-sort": "^2.0.1", - "domain-browser": "^1.2.0", - "duplexer2": "~0.1.2", - "events": "^3.0.0", - "glob": "^7.1.0", - "has": "^1.0.0", - "htmlescape": "^1.1.0", - "https-browserify": "^1.0.0", - "inherits": "~2.0.1", - "insert-module-globals": "^7.2.1", - "labeled-stream-splicer": "^2.0.0", - "mkdirp-classic": "^0.5.2", - "module-deps": "^6.2.3", - "os-browserify": "~0.3.0", - "parents": "^1.0.1", - "path-browserify": "^1.0.0", - "process": "~0.11.0", - "punycode": "^1.3.2", - "querystring-es3": "~0.2.0", - "read-only-stream": "^2.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.1.4", - "shasum-object": "^1.0.0", - "shell-quote": "^1.6.1", - "stream-browserify": "^3.0.0", - "stream-http": "^3.0.0", - "string_decoder": "^1.1.1", - "subarg": "^1.0.0", - "syntax-error": "^1.1.1", - "through2": "^2.0.0", - "timers-browserify": "^1.0.1", - "tty-browserify": "0.0.1", - "url": "~0.11.0", - "util": "~0.12.0", - "vm-browserify": "^1.0.0", - "xtend": "^4.0.0" - } - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } - } - }, - "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", - "dev": true, - "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - } - } - }, - "browserify-wrap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-wrap/-/browserify-wrap-1.0.2.tgz", - "integrity": "sha1-DvJ3xnxplAkVnt8hraPchQF/lqo=", - "dev": true - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", - "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", - "dev": true, - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "buffer-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", - "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", - "dev": true - }, - "buffer-from": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", - "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==", - "dev": true - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", - "dev": true - }, - "bundle-collapser": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/bundle-collapser/-/bundle-collapser-1.4.0.tgz", - "integrity": "sha512-Gd3K3+3KI1Utuk+gwAvuOVOjT/2XLGL8tU6FwDKk04LlOZkYfT0pwQllsG1Dv8RRhgcjNxZSDmmSXb0AOkwSwg==", - "dev": true, - "requires": { - "browser-pack": "^6.0.2", - "browser-unpack": "^1.1.0", - "concat-stream": "^1.5.0", - "falafel": "^2.1.0", - "minimist": "^1.1.1", - "through2": "^2.0.0" - } - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "cached-path-relative": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.2.tgz", - "integrity": "sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg==", - "dev": true - }, - "caching-transform": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", - "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", - "dev": true, - "requires": { - "hasha": "^5.0.0", - "make-dir": "^3.0.0", - "package-hash": "^4.0.0", - "write-file-atomic": "^3.0.0" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "camelcase-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", - "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - } - } - }, - "catharsis": { - "version": "0.8.11", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.11.tgz", - "integrity": "sha512-a+xUyMV7hD1BrDQA/3iPV7oc+6W26BgVJO05PGEoatMyIuPScQKsde6i3YorWX1qs+AZjnJ18NqdKoCtKiNh1g==", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } - }, - "chalk": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", - "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, - "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "dependencies": { - "fsevents": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz", - "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==", - "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1", - "node-pre-gyp": "*" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "debug": { - "version": "3.2.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "^2.1.1" - } - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.6.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "bundled": true, - "dev": true, - "optional": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "bundled": true, - "dev": true, - "optional": true - }, - "minipass": { - "version": "2.9.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.3.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.9.0" - } - }, - "mkdirp": { - "version": "0.5.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.3.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.14.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4.4.2" - } - }, - "nopt": { - "version": "4.0.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-normalize-package-bin": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.4.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - } - }, - "readable-stream": { - "version": "2.3.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.7.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.7.1", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.13", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "yallist": { - "version": "3.1.1", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - } - } - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true - }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "clone-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", - "dev": true - }, - "cloneable-readable": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz", - "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "collection-map": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-map/-/collection-map-1.0.0.tgz", - "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=", - "dev": true, - "requires": { - "arr-map": "^2.0.2", - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true - }, - "combine-source-map": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", - "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", - "dev": true, - "requires": { - "convert-source-map": "~1.1.0", - "inline-source-map": "~0.6.0", - "lodash.memoize": "~3.0.3", - "source-map": "~0.5.3" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "concat-with-sourcemaps": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", - "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", - "dev": true - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "convert-source-map": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", - "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", - "dev": true - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "copy-props": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz", - "integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==", - "dev": true, - "requires": { - "each-props": "^1.3.0", - "is-plain-object": "^2.0.1" - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "dependencies": { - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "css": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", - "integrity": "sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "source-map": "^0.6.1", - "source-map-resolve": "^0.5.2", - "urix": "^0.1.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true, - "requires": { - "array-find-index": "^1.0.1" - } - }, - "d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "dev": true, - "requires": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, - "dargs": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/dargs/-/dargs-4.1.0.tgz", - "integrity": "sha1-A6nbtLXC8Tm/FK5T8LiipqhvThc=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "dash-ast": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", - "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "debug-fabulous": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-1.1.0.tgz", - "integrity": "sha512-GZqvGIgKNlUnHUPQhepnUZFIMoi3dgZKQBzKDeL2g7oJF9SNAji/AAu36dusFUas0O+pae74lNeoIPHqXWDkLg==", - "dev": true, - "requires": { - "debug": "3.X", - "memoizee": "0.4.X", - "object-assign": "4.X" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decamelize-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", - "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", - "dev": true, - "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "dependencies": { - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - } - } - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "deep-equal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.3.tgz", - "integrity": "sha512-Spqdl4H+ky45I9ByyJtXteOm9CaIrPmnIPmOhrkKGNYWeDgCvJ8jNYVCTjChxW4FqGuZnLHADc8EKRMX6+CgvA==", - "dev": true, - "requires": { - "es-abstract": "^1.17.5", - "es-get-iterator": "^1.1.0", - "is-arguments": "^1.0.4", - "is-date-object": "^1.0.2", - "is-regex": "^1.0.5", - "isarray": "^2.0.5", - "object-is": "^1.1.2", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "regexp.prototype.flags": "^1.3.0", - "side-channel": "^1.0.2", - "which-boxed-primitive": "^1.0.1", - "which-collection": "^1.0.1", - "which-typed-array": "^1.1.2" - }, - "dependencies": { - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "default-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", - "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==", - "dev": true, - "requires": { - "kind-of": "^5.0.2" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "default-require-extensions": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", - "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", - "dev": true, - "requires": { - "strip-bom": "^4.0.0" - } - }, - "default-resolution": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", - "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", - "dev": true - }, - "define-properties": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", - "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", - "dev": true, - "requires": { - "foreach": "^2.0.5", - "object-keys": "^1.0.8" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "defined": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", - "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", - "dev": true - }, - "deps-sort": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.1.tgz", - "integrity": "sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "shasum-object": "^1.0.0", - "subarg": "^1.0.0", - "through2": "^2.0.0" - } - }, - "des.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", - "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", - "dev": true - }, - "detect-newline": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", - "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", - "dev": true - }, - "detective": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz", - "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==", - "dev": true, - "requires": { - "acorn-node": "^1.6.1", - "defined": "^1.0.0", - "minimist": "^1.1.1" - } - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, - "dotignore": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", - "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", - "dev": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - } - }, - "duplexify": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", - "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", - "dev": true, - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - }, - "dependencies": { - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - } - } - }, - "each-props": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz", - "integrity": "sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.1", - "object.defaults": "^1.1.0" - } - }, - "elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", - "dev": true, - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } - } - }, - "email-addresses": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", - "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", - "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==", - "dev": true - }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", - "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" - }, - "dependencies": { - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "es-get-iterator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz", - "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==", - "dev": true, - "requires": { - "es-abstract": "^1.17.4", - "has-symbols": "^1.0.1", - "is-arguments": "^1.0.4", - "is-map": "^2.0.1", - "is-set": "^2.0.1", - "is-string": "^1.0.5", - "isarray": "^2.0.5" - }, - "dependencies": { - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - } - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es5-ext": { - "version": "0.10.53", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", - "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==", - "dev": true, - "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.3", - "next-tick": "~1.0.0" - } - }, - "es6-error": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", - "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", - "dev": true - }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", - "dev": true, - "requires": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "es6-weak-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", - "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.46", - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true - } - } - }, - "eslint": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.1.0.tgz", - "integrity": "sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0", - "eslint-visitor-keys": "^1.1.0", - "espree": "^7.0.0", - "esquery": "^1.2.0", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - } - } - }, - "eslint-scope": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", - "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - }, - "dependencies": { - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - } - } - }, - "eslint-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", - "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "eslint-visitor-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", - "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", - "dev": true - }, - "espree": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.0.0.tgz", - "integrity": "sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw==", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - } - }, - "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", - "dev": true, - "requires": { - "estraverse": "^4.1.0" - }, - "dependencies": { - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - } - } - }, - "estraverse": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", - "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, - "events": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", - "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, - "ext": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", - "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", - "dev": true, - "requires": { - "type": "^2.0.0" - }, - "dependencies": { - "type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/type/-/type-2.0.0.tgz", - "integrity": "sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow==", - "dev": true - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "dependencies": { - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "falafel": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", - "integrity": "sha512-0HXjo8XASWRmsS0X1EkhwEMZaD3Qvp7FfURwjLKjG1ghfRm/MGZl2r4cWUTv41KdNghTw4OUMmVtdGQp3+H+uQ==", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "foreach": "^2.0.5", - "isarray": "^2.0.1", - "object-keys": "^1.0.6" - }, - "dependencies": { - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - } - } - }, - "fancy-log": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", - "integrity": "sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==", - "dev": true, - "requires": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "parse-node-version": "^1.0.0", - "time-stamp": "^1.0.0" - } - }, - "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fast-safe-stringify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", - "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==", - "dev": true - }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", - "dev": true, - "requires": { - "flat-cache": "^2.0.1" - } - }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, - "filename-reserved-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", - "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=", - "dev": true - }, - "filenamify": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-1.2.1.tgz", - "integrity": "sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=", - "dev": true, - "requires": { - "filename-reserved-regex": "^1.0.0", - "strip-outer": "^1.0.0", - "trim-repeated": "^1.0.0" - } - }, - "filenamify-url": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/filenamify-url/-/filenamify-url-1.0.0.tgz", - "integrity": "sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A=", - "dev": true, - "requires": { - "filenamify": "^1.0.0", - "humanize-url": "^1.0.0" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "findup-sync": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz", - "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - }, - "dependencies": { - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - } - } - }, - "fined": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz", - "integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^2.0.3", - "object.defaults": "^1.1.0", - "object.pick": "^1.2.0", - "parse-filepath": "^1.0.1" - } - }, - "flagged-respawn": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", - "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", - "dev": true - }, - "flat-cache": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", - "dev": true, - "requires": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" - }, - "dependencies": { - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, - "flatted": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", - "dev": true - }, - "flush-write-stream": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", - "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.4" - } - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "requires": { - "is-callable": "^1.1.3" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true - }, - "foreground-child": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", - "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "signal-exit": "^3.0.2" - } - }, - "fork-stream": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz", - "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=", - "dev": true - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fromentries": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.2.0.tgz", - "integrity": "sha512-33X7H/wdfO99GdRLLgkjUrD4geAFdq/Uv0kl3HD4da6HDixd2GUg8Mw7dahLCV9r/EARkmtYBB6Tch4EEokFTQ==", - "dev": true - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", - "dev": true - } - } - }, - "fs-mkdirp-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", - "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "through2": "^2.0.3" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", - "dev": true - }, - "get-assigned-identifiers": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", - "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==", - "dev": true - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "gh-pages": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-3.0.0.tgz", - "integrity": "sha512-oaOfVcrSwnqoWUgZ6cmCDM6mUuWyOSG+SHjqxGBawN0F3SKaF5NwbeYDG+w2RNXO2HJ/5Iam4o7dP5NAtoHuwQ==", - "dev": true, - "requires": { - "async": "^2.6.1", - "commander": "^2.18.0", - "email-addresses": "^3.0.1", - "filenamify-url": "^1.0.0", - "fs-extra": "^8.1.0", - "globby": "^6.1.0" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - } - } - }, - "git-raw-commits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.3.tgz", - "integrity": "sha512-SoSsFL5lnixVzctGEi2uykjA7B5I0AhO9x6kdzvGRHbxsa6JSEgrgy1esRKsfOKE1cgyOJ/KDR2Trxu157sb8w==", - "dev": true, - "requires": { - "dargs": "^4.0.1", - "lodash.template": "^4.0.2", - "meow": "^5.0.0", - "split2": "^2.0.0", - "through2": "^3.0.0" - }, - "dependencies": { - "through2": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", - "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", - "dev": true, - "requires": { - "readable-stream": "2 || 3" - } - } - } - }, - "git-semver-tags": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-4.0.0.tgz", - "integrity": "sha512-LajaAWLYVBff+1NVircURJFL8TQ3EMIcLAfHisWYX/nPoMwnTYfWAznQDmMujlLqoD12VtLmoSrF1sQ5MhimEQ==", - "dev": true, - "requires": { - "meow": "^7.0.0", - "semver": "^6.0.0" - }, - "dependencies": { - "arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "dev": true - }, - "camelcase": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.0.0.tgz", - "integrity": "sha512-8KMDF1Vz2gzOq54ONPJS65IvTUaB1cHJ2DMM7MbPmLZljDH1qpzzLsWdiN9pHh6qvkRVDTi/07+eNGch/oLU4w==", - "dev": true - }, - "camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - } - } - }, - "map-obj": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz", - "integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g==", - "dev": true - }, - "meow": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/meow/-/meow-7.0.1.tgz", - "integrity": "sha512-tBKIQqVrAHqwit0vfuFPY3LlzJYkEOFyKa3bPgxzNl6q/RtN8KQ+ALYEASYuFayzSAsjlhXj/JZ10rH85Q6TUw==", - "dev": true, - "requires": { - "@types/minimist": "^1.2.0", - "arrify": "^2.0.1", - "camelcase": "^6.0.0", - "camelcase-keys": "^6.2.2", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "^4.0.2", - "normalize-package-data": "^2.5.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.13.1", - "yargs-parser": "^18.1.3" - } - }, - "minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "dependencies": { - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - } - } - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "parse-json": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", - "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1", - "lines-and-columns": "^1.1.6" - } - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true - }, - "read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "dependencies": { - "type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true - } - } - }, - "read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "requires": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "dependencies": { - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - } - } - }, - "redent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", - "dev": true, - "requires": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" - } - }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "strip-indent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", - "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", - "dev": true, - "requires": { - "min-indent": "^1.0.0" - } - }, - "trim-newlines": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.0.tgz", - "integrity": "sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA==", - "dev": true - }, - "type-fest": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", - "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", - "dev": true - }, - "yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - } - } - } - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "glob-stream": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", - "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", - "dev": true, - "requires": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" - }, - "dependencies": { - "to-absolute-glob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", - "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - } - } - } - }, - "glob-watcher": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.3.tgz", - "integrity": "sha512-8tWsULNEPHKQ2MR4zXuzSmqbdyV5PtwwCaWSGQ1WwHsJ07ilNeN1JB8ntxhckbnpSHaf9dXFUHzIWvm1I13dsg==", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-done": "^1.2.0", - "chokidar": "^2.0.0", - "is-negated-glob": "^1.0.0", - "just-debounce": "^1.0.0", - "object.defaults": "^1.1.0" - } - }, - "global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dev": true, - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - } - }, - "global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "glogg": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.2.tgz", - "integrity": "sha512-5mwUoSuBk44Y4EshyiqcH95ZntbDdTQqA3QYSrxmzj28Ai0vXBGMH1ApSANH14j2sIRtqCEyg6PfsuP7ElOEDA==", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, - "google-protobuf": { - "version": "3.11.4", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.11.4.tgz", - "integrity": "sha512-lL6b04rDirurUBOgsY2+LalI6Evq8eH5TcNzi7TYQ3BsIWelT0KSOQSBsXuavEkNf+odQU6c0lgz3UsZXeNX9Q==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "gulp": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz", - "integrity": "sha512-dvEs27SCZt2ibF29xYgmnwwCYZxdxhQ/+LFWlbAW8y7jt68L/65402Lz3+CKy0Ov4rOs+NERmDq7YlZaDqUIfA==", - "dev": true, - "requires": { - "glob-watcher": "^5.0.3", - "gulp-cli": "^2.2.0", - "undertaker": "^1.2.1", - "vinyl-fs": "^3.0.0" - }, - "dependencies": { - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "gulp-cli": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.2.0.tgz", - "integrity": "sha512-rGs3bVYHdyJpLqR0TUBnlcZ1O5O++Zs4bA0ajm+zr3WFCfiSLjGwoCBqFs18wzN+ZxahT9DkOK5nDf26iDsWjA==", - "dev": true, - "requires": { - "ansi-colors": "^1.0.1", - "archy": "^1.0.0", - "array-sort": "^1.0.0", - "color-support": "^1.1.3", - "concat-stream": "^1.6.0", - "copy-props": "^2.0.1", - "fancy-log": "^1.3.2", - "gulplog": "^1.0.0", - "interpret": "^1.1.0", - "isobject": "^3.0.1", - "liftoff": "^3.1.0", - "matchdep": "^2.0.0", - "mute-stdout": "^1.0.0", - "pretty-hrtime": "^1.0.0", - "replace-homedir": "^1.0.0", - "semver-greatest-satisfied-range": "^1.1.0", - "v8flags": "^3.0.1", - "yargs": "^7.1.0" - } - } - } - }, - "gulp-header": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-2.0.9.tgz", - "integrity": "sha512-LMGiBx+qH8giwrOuuZXSGvswcIUh0OiioNkUpLhNyvaC6/Ga8X6cfAeme2L5PqsbXMhL8o8b/OmVqIQdxprhcQ==", - "dev": true, - "requires": { - "concat-with-sourcemaps": "^1.1.0", - "lodash.template": "^4.5.0", - "map-stream": "0.0.7", - "through2": "^2.0.0" - }, - "dependencies": { - "lodash.template": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", - "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" - } - } - } - }, - "gulp-if": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz", - "integrity": "sha512-fCUEngzNiEZEK2YuPm+sdMpO6ukb8+/qzbGfJBXyNOXz85bCG7yBI+pPSl+N90d7gnLvMsarthsAImx0qy7BAw==", - "dev": true, - "requires": { - "gulp-match": "^1.1.0", - "ternary-stream": "^3.0.0", - "through2": "^3.0.1" - }, - "dependencies": { - "through2": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", - "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", - "dev": true, - "requires": { - "readable-stream": "2 || 3" - } - } - } - }, - "gulp-match": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.1.0.tgz", - "integrity": "sha512-DlyVxa1Gj24DitY2OjEsS+X6tDpretuxD6wTfhXE/Rw2hweqc1f6D/XtsJmoiCwLWfXgR87W9ozEityPCVzGtQ==", - "dev": true, - "requires": { - "minimatch": "^3.0.3" - } - }, - "gulp-sourcemaps": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-2.6.5.tgz", - "integrity": "sha512-SYLBRzPTew8T5Suh2U8jCSDKY+4NARua4aqjj8HOysBh2tSgT9u4jc1FYirAdPx1akUxxDeK++fqw6Jg0LkQRg==", - "dev": true, - "requires": { - "@gulp-sourcemaps/identity-map": "1.X", - "@gulp-sourcemaps/map-sources": "1.X", - "acorn": "5.X", - "convert-source-map": "1.X", - "css": "2.X", - "debug-fabulous": "1.X", - "detect-newline": "2.X", - "graceful-fs": "4.X", - "source-map": "~0.6.0", - "strip-bom-string": "1.X", - "through2": "2.X" - }, - "dependencies": { - "acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "gulp-uglify": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gulp-uglify/-/gulp-uglify-3.0.2.tgz", - "integrity": "sha512-gk1dhB74AkV2kzqPMQBLA3jPoIAPd/nlNzP2XMDSG8XZrqnlCiDGAqC+rZOumzFvB5zOphlFh6yr3lgcAb/OOg==", - "dev": true, - "requires": { - "array-each": "^1.0.1", - "extend-shallow": "^3.0.2", - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "isobject": "^3.0.1", - "make-error-cause": "^1.1.1", - "safe-buffer": "^5.1.2", - "through2": "^2.0.0", - "uglify-js": "^3.0.5", - "vinyl-sourcemaps-apply": "^0.2.0" - } - }, - "gulplog": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", - "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", - "dev": true, - "requires": { - "glogg": "^1.0.0" - } - }, - "hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dev": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - } - } - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hasha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.0.tgz", - "integrity": "sha512-2W+jKdQbAdSIrggA8Q35Br8qKadTrqCTC8+XZvBWepKDK6m9XkX6Iz1a2yh2KP01kzAR/dpuMeUnocoLYDcskw==", - "dev": true, - "requires": { - "is-stream": "^2.0.0", - "type-fest": "^0.8.0" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "homedir-polyfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", - "dev": true, - "requires": { - "parse-passwd": "^1.0.0" - } - }, - "hosted-git-info": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.0.tgz", - "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", - "dev": true - }, - "html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "htmlescape": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", - "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", - "dev": true - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, - "humanize-url": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/humanize-url/-/humanize-url-1.0.1.tgz", - "integrity": "sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8=", - "dev": true, - "requires": { - "normalize-url": "^1.0.0", - "strip-url-auth": "^1.0.0" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", - "dev": true - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - } - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true - }, - "inline-source-map": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", - "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", - "dev": true, - "requires": { - "source-map": "~0.5.3" - } - }, - "inquirer": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", - "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "cli-cursor": "^3.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.15", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.5.3", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "insert-module-globals": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz", - "integrity": "sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "acorn-node": "^1.5.2", - "combine-source-map": "^0.8.0", - "concat-stream": "^1.6.1", - "is-buffer": "^1.1.0", - "path-is-absolute": "^1.0.1", - "process": "~0.11.0", - "through2": "^2.0.0", - "undeclared-identifiers": "^1.1.2", - "xtend": "^4.0.0" - } - }, - "interpret": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", - "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", - "dev": true - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dev": true, - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-arguments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", - "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.0.tgz", - "integrity": "sha512-t5mGUXC/xRheCK431ylNiSkGGpBp8bHENBcENTkDT6ppwPzEVxNGZRvgvmOEfbWkFhA7D2GEuE2mmQTr78sl2g==", - "dev": true - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-boolean-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.0.1.tgz", - "integrity": "sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ==", - "dev": true - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, - "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", - "dev": true - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-generator-function": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz", - "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw==", - "dev": true - }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - }, - "is-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", - "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", - "dev": true - }, - "is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", - "dev": true - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-number-object": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", - "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", - "dev": true - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dev": true, - "requires": { - "is-unc-path": "^1.0.0" - } - }, - "is-set": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", - "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", - "dev": true - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", - "dev": true - }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - }, - "dependencies": { - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - } - } - }, - "is-typed-array": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.3.tgz", - "integrity": "sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.0", - "es-abstract": "^1.17.4", - "foreach": "^2.0.5", - "has-symbols": "^1.0.1" - }, - "dependencies": { - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - } - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dev": true, - "requires": { - "unc-path-regex": "^0.1.2" - } - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "is-valid-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", - "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", - "dev": true - }, - "is-weakmap": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", - "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", - "dev": true - }, - "is-weakset": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.1.tgz", - "integrity": "sha512-pi4vhbhVHGLxohUw7PhGsueT4vRGFoXhP7+RGN0jKIv9+8PWYCQTqtADngrxOm2g46hoH0+g8uZZBzMrvVGDmw==", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "istanbul-lib-coverage": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", - "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", - "dev": true - }, - "istanbul-lib-hook": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", - "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", - "dev": true, - "requires": { - "append-transform": "^2.0.0" - } - }, - "istanbul-lib-instrument": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz", - "integrity": "sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg==", - "dev": true, - "requires": { - "@babel/core": "^7.7.5", - "@babel/parser": "^7.7.5", - "@babel/template": "^7.7.4", - "@babel/traverse": "^7.7.4", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "istanbul-lib-processinfo": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", - "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", - "dev": true, - "requires": { - "archy": "^1.0.0", - "cross-spawn": "^7.0.0", - "istanbul-lib-coverage": "^3.0.0-alpha.1", - "make-dir": "^3.0.0", - "p-map": "^3.0.0", - "rimraf": "^3.0.0", - "uuid": "^3.3.3" - } - }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - } - }, - "istanbul-lib-source-maps": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", - "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jaguarjs-jsdoc": { - "version": "github:dcodeIO/jaguarjs-jsdoc#ade85ac841f5ca8be40c60d506102039a036a8fa", - "from": "github:dcodeIO/jaguarjs-jsdoc", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "dependencies": { - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - } - } - }, - "js2xmlparser": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.1.tgz", - "integrity": "sha512-KrPTolcw6RocpYjdC7pL7v62e55q7qOMHvLX1UCLc5AAS8qeJ6nukarEJAF2KL2PZxlbGueEbINqZR2bDe/gUw==", - "dev": true, - "requires": { - "xmlcreate": "^2.0.3" - } - }, - "jsdoc": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.4.tgz", - "integrity": "sha512-3G9d37VHv7MFdheviDCjUfQoIjdv4TC5zTTf5G9VODLtOnVS6La1eoYBDlbWfsRT3/Xo+j2MIqki2EV12BZfwA==", - "dev": true, - "requires": { - "@babel/parser": "^7.9.4", - "bluebird": "^3.7.2", - "catharsis": "^0.8.11", - "escape-string-regexp": "^2.0.0", - "js2xmlparser": "^4.0.1", - "klaw": "^3.0.0", - "markdown-it": "^10.0.0", - "markdown-it-anchor": "^5.2.7", - "marked": "^0.8.2", - "mkdirp": "^1.0.4", - "requizzle": "^0.2.3", - "strip-json-comments": "^3.1.0", - "taffydb": "2.6.2", - "underscore": "~1.10.2" - }, - "dependencies": { - "escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true - }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true - } - } - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json5": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", - "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, - "jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", - "dev": true - }, - "just-debounce": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", - "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - }, - "klaw": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", - "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, - "labeled-stream-splicer": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz", - "integrity": "sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "stream-splicer": "^2.0.0" - } - }, - "last-run": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", - "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=", - "dev": true, - "requires": { - "default-resolution": "^2.0.0", - "es6-weak-map": "^2.0.1" - } - }, - "lazystream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", - "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", - "dev": true, - "requires": { - "readable-stream": "^2.0.5" - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, - "lead": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", - "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", - "dev": true, - "requires": { - "flush-write-stream": "^1.0.2" - } - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "liftoff": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-3.1.0.tgz", - "integrity": "sha512-DlIPlJUkCV0Ips2zf2pJP0unEoT1kwYhiiPUGF3s/jtxTCjziNLoiVVh+jqWOWeFi6mmwQ5fNxvAUyPad4Dfog==", - "dev": true, - "requires": { - "extend": "^3.0.0", - "findup-sync": "^3.0.0", - "fined": "^1.0.1", - "flagged-respawn": "^1.0.0", - "is-plain-object": "^2.0.4", - "object.map": "^1.0.0", - "rechoir": "^0.6.2", - "resolve": "^1.1.7" - } - }, - "lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", - "dev": true - }, - "linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", - "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", - "dev": true, - "requires": { - "uc.micro": "^1.0.1" - } - }, - "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - } - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", - "dev": true - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, - "lodash.flattendeep": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", - "dev": true - }, - "lodash.memoize": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", - "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", - "dev": true - }, - "lodash.template": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", - "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "lodash.templatesettings": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", - "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", - "dev": true, - "requires": { - "lodash._reinterpolate": "~3.0.0" - } - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dev": true, - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, - "lru-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", - "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=", - "dev": true, - "requires": { - "es5-ext": "~0.10.2" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "make-error": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", - "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", - "dev": true - }, - "make-error-cause": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-1.2.2.tgz", - "integrity": "sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=", - "dev": true, - "requires": { - "make-error": "^1.2.0" - } - }, - "make-iterator": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", - "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", - "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", - "dev": true - }, - "map-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", - "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "markdown-it": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", - "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "entities": "~2.0.0", - "linkify-it": "^2.0.0", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - } - }, - "markdown-it-anchor": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.2.7.tgz", - "integrity": "sha512-REFmIaSS6szaD1bye80DMbp7ePwsPNvLTR5HunsUcZ0SG0rWJQ+Pz24R4UlTKtjKBPhxo0v0tOBDYjZQQknW8Q==", - "dev": true - }, - "marked": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.2.tgz", - "integrity": "sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==", - "dev": true - }, - "matchdep": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", - "integrity": "sha1-xvNINKDY28OzfCfui7yyfHd1WC4=", - "dev": true, - "requires": { - "findup-sync": "^2.0.0", - "micromatch": "^3.0.4", - "resolve": "^1.4.0", - "stack-trace": "0.0.10" - }, - "dependencies": { - "findup-sync": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", - "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^3.1.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - } - } - } - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", - "dev": true - }, - "memoizee": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.14.tgz", - "integrity": "sha512-/SWFvWegAIYAO4NQMpcX+gcra0yEZu4OntmUdrBaWrJncxOqAziGFlHxc7yjKVK2uu3lpPW27P27wkR82wA8mg==", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.45", - "es6-weak-map": "^2.0.2", - "event-emitter": "^0.3.5", - "is-promise": "^2.1", - "lru-queue": "0.1", - "next-tick": "1", - "timers-ext": "^0.1.5" - } - }, - "meow": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", - "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", - "dev": true, - "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0", - "yargs-parser": "^10.0.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "yargs-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", - "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } - } - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "min-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, - "minimist-options": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", - "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - } - }, - "mixin-deep": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", - "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true - }, - "module-deps": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.3.tgz", - "integrity": "sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "browser-resolve": "^2.0.0", - "cached-path-relative": "^1.0.2", - "concat-stream": "~1.6.0", - "defined": "^1.0.0", - "detective": "^5.2.0", - "duplexer2": "^0.1.2", - "inherits": "^2.0.1", - "parents": "^1.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.4.0", - "stream-combiner2": "^1.1.1", - "subarg": "^1.0.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "mute-stdout": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.1.tgz", - "integrity": "sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg==", - "dev": true - }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true - }, - "nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "next-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", - "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", - "dev": true - }, - "node-preload": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", - "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", - "dev": true, - "requires": { - "process-on-spawn": "^1.0.0" - } - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "normalize-url": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz", - "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", - "dev": true, - "requires": { - "object-assign": "^4.0.1", - "prepend-http": "^1.0.0", - "query-string": "^4.1.0", - "sort-keys": "^1.0.0" - } - }, - "now-and-later": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz", - "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", - "dev": true, - "requires": { - "once": "^1.3.2" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "nyc": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.0.1.tgz", - "integrity": "sha512-n0MBXYBYRqa67IVt62qW1r/d9UH/Qtr7SF1w/nQLJ9KxvWF6b2xCHImRAixHN9tnMMYHC2P14uo6KddNGwMgGg==", - "dev": true, - "requires": { - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "caching-transform": "^4.0.0", - "convert-source-map": "^1.7.0", - "decamelize": "^1.2.0", - "find-cache-dir": "^3.2.0", - "find-up": "^4.1.0", - "foreground-child": "^2.0.0", - "glob": "^7.1.6", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-hook": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", - "istanbul-lib-processinfo": "^2.0.2", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.2", - "make-dir": "^3.0.0", - "node-preload": "^0.2.1", - "p-map": "^3.0.0", - "process-on-spawn": "^1.0.0", - "resolve-from": "^5.0.0", - "rimraf": "^3.0.0", - "signal-exit": "^3.0.2", - "spawn-wrap": "^2.0.0", - "test-exclude": "^6.0.0", - "yargs": "^15.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, - "yargs": { - "version": "15.3.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", - "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.1" - } - }, - "yargs-parser": { - "version": "18.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.2.tgz", - "integrity": "sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", - "dev": true - }, - "object-is": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.2.tgz", - "integrity": "sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "object-keys": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", - "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", - "dev": true - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.defaults": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", - "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", - "dev": true, - "requires": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "object.map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", - "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", - "dev": true, - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "object.reduce": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.reduce/-/object.reduce-1.0.1.tgz", - "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=", - "dev": true, - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "ordered-read-streams": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", - "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "dev": true - }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "dev": true, - "requires": { - "lcid": "^1.0.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-map": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", - "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", - "dev": true, - "requires": { - "aggregate-error": "^3.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "package-hash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", - "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.15", - "hasha": "^5.0.0", - "lodash.flattendeep": "^4.4.0", - "release-zalgo": "^1.0.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - } - } - }, - "pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parents": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", - "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", - "dev": true, - "requires": { - "path-platform": "~0.11.15" - } - }, - "parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dev": true, - "requires": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "parse-filepath": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", - "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - } - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "parse-node-version": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", - "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", - "dev": true - }, - "parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", - "dev": true - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", - "dev": true - }, - "path-platform": { - "version": "0.11.15", - "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", - "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", - "dev": true - }, - "path-root": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", - "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", - "dev": true, - "requires": { - "path-root-regex": "^0.1.0" - } - }, - "path-root-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", - "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", - "dev": true - }, - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } - } - }, - "pbkdf2": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", - "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "platform": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.5.tgz", - "integrity": "sha512-TuvHS8AOIZNAlE77WUDiR4rySV/VMptyMfcfeoMgs4P8apaZM3JrnbzBiixKUv+XR6i+BXrQh8WAnjaSPFO65Q==", - "dev": true - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", - "dev": true - }, - "pretty-hrtime": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", - "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", - "dev": true - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "process-on-spawn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", - "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", - "dev": true, - "requires": { - "fromentries": "^1.2.0" - } - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } - } - }, - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.0.tgz", - "integrity": "sha512-UWi0klDoq8xtVzlMRgENV9F7iCTZExaJQSQL187UXsxpk9NnrKGqTqqUNYAKGOzucSOxs2+jUnRNI+rLviPhJg==", - "dev": true, - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "query-string": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", - "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", - "dev": true, - "requires": { - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "quick-lru": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", - "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "read-only-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", - "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - } - }, - "read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - } - }, - "read-pkg-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", - "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" - }, - "dependencies": { - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "redent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", - "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", - "dev": true, - "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - }, - "dependencies": { - "indent-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", - "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", - "dev": true - } - } - }, - "reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", - "dev": true - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexp.prototype.flags": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", - "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", - "dev": true - }, - "release-zalgo": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", - "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", - "dev": true, - "requires": { - "es6-error": "^4.0.1" - } - }, - "remove-bom-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", - "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", - "dev": true, - "requires": { - "is-buffer": "^1.1.5", - "is-utf8": "^0.2.1" - } - }, - "remove-bom-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz", - "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", - "dev": true, - "requires": { - "remove-bom-buffer": "^3.0.0", - "safe-buffer": "^5.1.0", - "through2": "^2.0.3" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "replace-homedir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-1.0.0.tgz", - "integrity": "sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw=", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1", - "is-absolute": "^1.0.0", - "remove-trailing-separator": "^1.1.0" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "requizzle": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.3.tgz", - "integrity": "sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ==", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } - }, - "resolve": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", - "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - }, - "resolve-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true - }, - "resolve-options": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz", - "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", - "dev": true, - "requires": { - "value-or-function": "^3.0.0" - } - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "resumer": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", - "integrity": "sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=", - "dev": true, - "requires": { - "through": "~2.3.4" - } - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true - }, - "rxjs": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", - "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", - "dev": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true - }, - "semver-greatest-satisfied-range": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz", - "integrity": "sha1-E+jCZYq5aRywzXEJMkAoDTb3els=", - "dev": true, - "requires": { - "sver-compat": "^1.5.0" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "set-value": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", - "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shasum-object": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shasum-object/-/shasum-object-1.0.0.tgz", - "integrity": "sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg==", - "dev": true, - "requires": { - "fast-safe-stringify": "^2.0.7" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "shell-quote": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", - "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==", - "dev": true - }, - "side-channel": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.2.tgz", - "integrity": "sha512-7rL9YlPHg7Ancea1S96Pa8/QWb4BtXL/TZvS6B8XFetGBeuhAsfmUspK6DokBeZ64+Kj9TCNRD/30pVz1BvQNA==", - "dev": true, - "requires": { - "es-abstract": "^1.17.0-next.1", - "object-inspect": "^1.7.0" - } - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, - "simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "dev": true - }, - "slice-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } - } - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "sort-keys": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", - "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", - "dev": true, - "requires": { - "is-plain-obj": "^1.0.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", - "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", - "dev": true, - "requires": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "sparkles": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", - "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==", - "dev": true - }, - "spawn-wrap": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", - "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", - "dev": true, - "requires": { - "foreground-child": "^2.0.0", - "is-windows": "^1.0.2", - "make-dir": "^3.0.0", - "rimraf": "^3.0.0", - "signal-exit": "^3.0.2", - "which": "^2.0.1" - }, - "dependencies": { - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "spdx-correct": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", - "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", - "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "split2": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", - "dev": true, - "requires": { - "through2": "^2.0.2" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", - "dev": true, - "requires": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "stream-combiner2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", - "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", - "dev": true, - "requires": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" - } - }, - "stream-exhaust": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", - "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", - "dev": true - }, - "stream-http": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.1.1.tgz", - "integrity": "sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg==", - "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "xtend": "^4.0.2" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true - } - } - }, - "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", - "dev": true - }, - "stream-splicer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.1.tgz", - "integrity": "sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" - } - }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string.prototype.trim": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.1.tgz", - "integrity": "sha512-MjGFEeqixw47dAMFMtgUro/I0+wNqZB5GKXGt1fFr24u3TzDXCPu7J9Buppzoe3r/LqkSDLDDJzE15RGWDGAVw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "string.prototype.trimend": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", - "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "string.prototype.trimleft": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", - "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimstart": "^1.0.0" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "string.prototype.trimright": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", - "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimend": "^1.0.0" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - } - } - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", - "dev": true - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true - }, - "strip-bom-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", - "integrity": "sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI=", - "dev": true - }, - "strip-indent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", - "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", - "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", - "dev": true - }, - "strip-outer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", - "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, - "strip-url-auth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-url-auth/-/strip-url-auth-1.0.1.tgz", - "integrity": "sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=", - "dev": true - }, - "subarg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", - "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", - "dev": true, - "requires": { - "minimist": "^1.1.0" - } - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "sver-compat": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz", - "integrity": "sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg=", - "dev": true, - "requires": { - "es6-iterator": "^2.0.1", - "es6-symbol": "^3.1.1" - } - }, - "syntax-error": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", - "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", - "dev": true, - "requires": { - "acorn-node": "^1.2.0" - } - }, - "table": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", - "dev": true, - "requires": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", - "dev": true - }, - "tape": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/tape/-/tape-5.0.1.tgz", - "integrity": "sha512-wVsOl2shKPcjdJdc8a+PwacvrOdJZJ57cLUXlxW4TQ2R6aihXwG0m0bKm4mA4wjtQNTaLMCrYNEb4f9fjHKUYQ==", - "dev": true, - "requires": { - "deep-equal": "^2.0.3", - "defined": "^1.0.0", - "dotignore": "^0.1.2", - "for-each": "^0.3.3", - "function-bind": "^1.1.1", - "glob": "^7.1.6", - "has": "^1.0.3", - "inherits": "^2.0.4", - "is-regex": "^1.0.5", - "minimist": "^1.2.5", - "object-inspect": "^1.7.0", - "object-is": "^1.1.2", - "object.assign": "^4.1.0", - "resolve": "^1.17.0", - "resumer": "^0.0.0", - "string.prototype.trim": "^1.2.1", - "through": "^2.3.8" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - } - } - }, - "ternary-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-3.0.0.tgz", - "integrity": "sha512-oIzdi+UL/JdktkT+7KU5tSIQjj8pbShj3OASuvDEhm0NT5lppsm7aXWAmAq4/QMaBIyfuEcNLbAQA+HpaISobQ==", - "dev": true, - "requires": { - "duplexify": "^4.1.1", - "fork-stream": "^0.0.4", - "merge-stream": "^2.0.0", - "through2": "^3.0.1" - }, - "dependencies": { - "duplexify": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz", - "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==", - "dev": true, - "requires": { - "end-of-stream": "^1.4.1", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1", - "stream-shift": "^1.0.0" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "through2": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", - "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", - "dev": true, - "requires": { - "readable-stream": "2 || 3" - } - } - } - }, - "test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "requires": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "dev": true, - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - }, - "through2-filter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", - "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", - "dev": true, - "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - } - }, - "time-stamp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", - "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", - "dev": true - }, - "timers-browserify": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", - "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", - "dev": true, - "requires": { - "process": "~0.11.0" - } - }, - "timers-ext": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", - "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", - "dev": true, - "requires": { - "es5-ext": "~0.10.46", - "next-tick": "1" - } - }, - "tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, - "requires": { - "rimraf": "^3.0.0" - } - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "to-through": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-through/-/to-through-2.0.0.tgz", - "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", - "dev": true, - "requires": { - "through2": "^2.0.3" - } - }, - "trim-newlines": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", - "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", - "dev": true - }, - "trim-repeated": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, - "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", - "dev": true - }, - "tslint": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", - "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.3", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.13.0", - "tsutils": "^2.29.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", - "dev": true - } - } - }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, - "tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", - "dev": true - }, - "type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", - "dev": true - }, - "uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, - "uglify-js": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.1.tgz", - "integrity": "sha512-JUPoL1jHsc9fOjVFHdQIhqEEJsQvfKDjlubcCilu8U26uZ73qOg8VsN8O1jbuei44ZPlwL7kmbAdM4tzaUvqnA==", - "dev": true, - "requires": { - "commander": "~2.20.3" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - } - } - }, - "umd": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", - "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", - "dev": true - }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", - "dev": true - }, - "undeclared-identifiers": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz", - "integrity": "sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==", - "dev": true, - "requires": { - "acorn-node": "^1.3.0", - "dash-ast": "^1.0.0", - "get-assigned-identifiers": "^1.2.0", - "simple-concat": "^1.0.0", - "xtend": "^4.0.1" - } - }, - "underscore": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.10.2.tgz", - "integrity": "sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==", - "dev": true - }, - "undertaker": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.1.tgz", - "integrity": "sha512-71WxIzDkgYk9ZS+spIB8iZXchFhAdEo2YU8xYqBYJ39DIUIqziK78ftm26eecoIY49X0J2MLhG4hr18Yp6/CMA==", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "bach": "^1.0.0", - "collection-map": "^1.0.0", - "es6-weak-map": "^2.0.1", - "last-run": "^1.1.0", - "object.defaults": "^1.0.0", - "object.reduce": "^1.0.0", - "undertaker-registry": "^1.0.0" - } - }, - "undertaker-registry": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-1.0.1.tgz", - "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=", - "dev": true - }, - "union-value": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", - "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - } - }, - "unique-stream": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", - "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", - "dev": true, - "requires": { - "json-stable-stringify": "^1.0.0", - "through2-filter": "^2.0.0" - }, - "dependencies": { - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - } - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - } - } - }, - "upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "dev": true - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - } - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } - } - }, - "use": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true - }, - "util": { - "version": "0.12.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", - "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true - }, - "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", - "dev": true - }, - "v8flags": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz", - "integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, - "validate-npm-package-license": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", - "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "value-or-function": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", - "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", - "dev": true - }, - "vinyl": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.1.0.tgz", - "integrity": "sha1-Ah+cLPlR1rk5lDyJ617lrdT9kkw=", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - }, - "dependencies": { - "clone": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", - "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", - "dev": true - }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true - } - } - }, - "vinyl-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/vinyl-buffer/-/vinyl-buffer-1.0.1.tgz", - "integrity": "sha1-lsGjR5uMU5JULGEgKQE7Wyf4i78=", - "dev": true, - "requires": { - "bl": "^1.2.1", - "through2": "^2.0.3" - } - }, - "vinyl-fs": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz", - "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==", - "dev": true, - "requires": { - "fs-mkdirp-stream": "^1.0.0", - "glob-stream": "^6.1.0", - "graceful-fs": "^4.0.0", - "is-valid-glob": "^1.0.0", - "lazystream": "^1.0.0", - "lead": "^1.0.0", - "object.assign": "^4.0.4", - "pumpify": "^1.3.5", - "readable-stream": "^2.3.3", - "remove-bom-buffer": "^3.0.0", - "remove-bom-stream": "^1.2.0", - "resolve-options": "^1.1.0", - "through2": "^2.0.0", - "to-through": "^2.0.0", - "value-or-function": "^3.0.0", - "vinyl": "^2.0.0", - "vinyl-sourcemap": "^1.1.0" - } - }, - "vinyl-source-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-source-stream/-/vinyl-source-stream-2.0.0.tgz", - "integrity": "sha1-84pa+53R6Ttl1VBGmsYYKsT1S44=", - "dev": true, - "requires": { - "through2": "^2.0.3", - "vinyl": "^2.1.0" - } - }, - "vinyl-sourcemap": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz", - "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", - "dev": true, - "requires": { - "append-buffer": "^1.0.2", - "convert-source-map": "^1.5.0", - "graceful-fs": "^4.1.6", - "normalize-path": "^2.1.1", - "now-and-later": "^2.0.0", - "remove-bom-buffer": "^3.0.0", - "vinyl": "^2.0.0" - }, - "dependencies": { - "convert-source-map": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", - "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", - "dev": true - } - } - }, - "vinyl-sourcemaps-apply": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", - "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", - "dev": true, - "requires": { - "source-map": "^0.5.1" - } - }, - "vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", - "dev": true - }, - "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-boxed-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz", - "integrity": "sha512-7BT4TwISdDGBgaemWU0N0OU7FeAEJ9Oo2P1PHRm/FCWoEi2VLWC9b6xvxAA3C/NMpxg3HXVgi0sMmGbNUbNepQ==", - "dev": true, - "requires": { - "is-bigint": "^1.0.0", - "is-boolean-object": "^1.0.0", - "is-number-object": "^1.0.3", - "is-string": "^1.0.4", - "is-symbol": "^1.0.2" - } - }, - "which-collection": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", - "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", - "dev": true, - "requires": { - "is-map": "^2.0.1", - "is-set": "^2.0.1", - "is-weakmap": "^2.0.1", - "is-weakset": "^2.0.1" - } - }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, - "which-typed-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.2.tgz", - "integrity": "sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.2", - "es-abstract": "^1.17.5", - "foreach": "^2.0.5", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.1", - "is-typed-array": "^1.1.3" - }, - "dependencies": { - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - } - } - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } - }, - "write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "xmlcreate": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.3.tgz", - "integrity": "sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ==", - "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yargs": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", - "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", - "dev": true, - "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^5.0.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - } - } - }, - "yargs-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", - "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", - "dev": true, - "requires": { - "camelcase": "^3.0.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - } - } - } - } -} diff --git a/node_modules/protobufjs/package.json b/node_modules/protobufjs/package.json deleted file mode 100644 index 7c01e694..00000000 --- a/node_modules/protobufjs/package.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "_from": "protobufjs@^6.8.6", - "_id": "protobufjs@6.10.2", - "_inBundle": false, - "_integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", - "_location": "/protobufjs", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "protobufjs@^6.8.6", - "name": "protobufjs", - "escapedName": "protobufjs", - "rawSpec": "^6.8.6", - "saveSpec": null, - "fetchSpec": "^6.8.6" - }, - "_requiredBy": [ - "/@grpc/proto-loader" - ], - "_resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", - "_shasum": "b9cb6bd8ec8f87514592ba3fdfd28e93f33a469b", - "_spec": "protobufjs@^6.8.6", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/@grpc/proto-loader", - "author": { - "name": "Daniel Wirtz", - "email": "dcode+protobufjs@dcode.io" - }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" - }, - "bugs": { - "url": "https://github.com/dcodeIO/protobuf.js/issues" - }, - "bundleDependencies": false, - "cliDependencies": [ - "semver", - "chalk", - "glob", - "jsdoc", - "minimist", - "tmp", - "uglify-js", - "espree", - "escodegen", - "estraverse" - ], - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", - "@types/node": "^13.7.0", - "long": "^4.0.0" - }, - "deprecated": false, - "description": "Protocol Buffers for JavaScript (& TypeScript).", - "devDependencies": { - "benchmark": "^2.1.4", - "browserify": "^17.0.0", - "browserify-wrap": "^1.0.2", - "bundle-collapser": "^1.3.0", - "chalk": "^4.0.0", - "escodegen": "^2.0.0", - "eslint": "^7.0.0", - "espree": "^7.0.0", - "estraverse": "^5.1.0", - "gh-pages": "^3.0.0", - "git-raw-commits": "^2.0.3", - "git-semver-tags": "^4.0.0", - "glob": "^7.1.6", - "google-protobuf": "^3.11.3", - "gulp": "^4.0.2", - "gulp-header": "^2.0.9", - "gulp-if": "^3.0.0", - "gulp-sourcemaps": "^2.6.5", - "gulp-uglify": "^3.0.2", - "jaguarjs-jsdoc": "github:dcodeIO/jaguarjs-jsdoc", - "jsdoc": "^3.6.3", - "minimist": "^1.2.0", - "nyc": "^15.0.0", - "reflect-metadata": "^0.1.13", - "semver": "^7.1.2", - "tape": "^5.0.0", - "tmp": "^0.2.0", - "tslint": "^6.0.0", - "typescript": "^3.7.5", - "uglify-js": "^3.7.7", - "vinyl-buffer": "^1.0.1", - "vinyl-fs": "^3.0.3", - "vinyl-source-stream": "^2.0.0" - }, - "files": [ - "index.js", - "index.d.ts", - "light.d.ts", - "light.js", - "minimal.d.ts", - "minimal.js", - "package-lock.json", - "tsconfig.json", - "scripts/postinstall.js", - "bin/**", - "cli/**", - "dist/**", - "ext/**", - "google/**", - "src/**" - ], - "homepage": "https://protobufjs.github.io/protobuf.js/", - "keywords": [ - "protobuf", - "protocol-buffers", - "serialization", - "typescript" - ], - "license": "BSD-3-Clause", - "main": "index.js", - "name": "protobufjs", - "repository": { - "type": "git", - "url": "git+https://github.com/protobufjs/protobuf.js.git" - }, - "scripts": { - "bench": "node bench", - "build": "npm run build:bundle && npm run build:types", - "build:bundle": "gulp --gulpfile scripts/gulpfile.js", - "build:types": "node bin/pbts --main --global protobuf --out index.d.ts src/ lib/aspromise/index.js lib/base64/index.js lib/codegen/index.js lib/eventemitter/index.js lib/float/index.js lib/fetch/index.js lib/inquire/index.js lib/path/index.js lib/pool/index.js lib/utf8/index.js", - "changelog": "node scripts/changelog -w", - "coverage": "nyc tape -r ./lib/tape-adapter tests/*.js tests/node/*.js", - "docs": "jsdoc -c config/jsdoc.json -R README.md --verbose --pedantic", - "lint": "npm run lint:sources && npm run lint:types", - "lint:sources": "eslint \"**/*.js\" -c config/eslint.json", - "lint:types": "tslint \"**/*.d.ts\" -e \"**/node_modules/**\" -t stylish -c config/tslint.json", - "make": "npm run lint:sources && npm run build && npm run lint:types && node ./scripts/gentests.js && npm test", - "pages": "node scripts/pages", - "postinstall": "node scripts/postinstall", - "prepublish": "node scripts/prepublish", - "prof": "node bench/prof", - "test": "npm run test:sources && npm run test:types", - "test:sources": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js", - "test:types": "tsc tests/comp_typescript.ts --lib es2015 --strictNullChecks --experimentalDecorators --emitDecoratorMetadata && tsc tests/data/test.js.ts --lib es2015 --noEmit --strictNullChecks && tsc tests/data/*.ts --lib es2015 --noEmit --strictNullChecks" - }, - "types": "index.d.ts", - "version": "6.10.2", - "versionScheme": "~" -} diff --git a/node_modules/protobufjs/scripts/changelog.js b/node_modules/protobufjs/scripts/changelog.js deleted file mode 100644 index 7cc7ac44..00000000 --- a/node_modules/protobufjs/scripts/changelog.js +++ /dev/null @@ -1,150 +0,0 @@ -"use strict"; - -var path = require("path"), - fs = require("fs"); - -var gitSemverTags = require("git-semver-tags"), - gitRawCommits = require("git-raw-commits"), - minimist = require("minimist"); - -var basedir = path.join(__dirname, ".."); -var pkg = require(basedir + "/package.json"); - -var argv = minimist(process.argv, { - alias: { - tag : "t", - write : "w" - }, - string: [ "tag" ], - boolean: [ "write" ], - default: { - tag: null, - write: false - } -}); - -// categories to be used in the future and regexes for lazy / older subjects -var validCategories = { - "Breaking": null, - "Fixed": /fix|properly|prevent|correctly/i, - "New": /added|initial/i, - "CLI": /pbjs|pbts|CLI/, - "Docs": /README/i, - "Other": null -}; -var breakingFallback = /removed|stripped|dropped/i; - -var repo = "https://github.com/protobufjs/protobuf.js"; - -gitSemverTags(function(err, tags) { - if (err) - throw err; - - var categories = {}; - Object.keys(validCategories).forEach(function(category) { - categories[category] = []; - }); - var output = []; - - var from = tags[0]; - var to = "HEAD"; - var tag; - if (argv.tag) { - var idx = tags.indexOf(argv.tag); - if (idx < 0) - throw Error("no such tag: " + argv.tag); - from = tags[idx + 1]; - tag = to = tags[idx]; - } else - tag = pkg.version; - - var commits = gitRawCommits({ - from: from, - to: to, - merges: false, - format: "%B%n#%H" - }); - - commits.on("error", function(err) { - throw err; - }); - - commits.on("data", function(chunk) { - var message = chunk.toString("utf8").trim(); - var match = /##([0-9a-f]{40})$/.exec(message); - var hash; - if (match) { - message = message.substring(0, message.length - match[1].length).trim(); - hash = match[1]; - } - message.split(";").forEach(function(message) { - if (/^(Merge pull request |Post-merge)/.test(message)) - return; - var match = /^(\w+):/i.exec(message = message.trim()); - var category; - if (match && match[1] in validCategories) { - category = match[1]; - message = message.substring(match[1].length + 1).trim(); - } else { - var keys = Object.keys(validCategories); - for (var i = 0; i < keys.length; ++i) { - var re = validCategories[keys[i]]; - if (re && re.test(message)) { - category = keys[i]; - break; - } - } - message = message.replace(/^(\w+):/i, "").trim(); - } - if (!category) { - if (breakingFallback.test(message)) - category = "Breaking"; - else - category = "Other"; - } - var nl = message.indexOf("\n"); - if (nl > -1) - message = message.substring(0, nl).trim(); - if (!hash || message.length < 12) - return; - message = message.replace(/\[ci skip\]/, "").trim(); - categories[category].push({ - text: message, - hash: hash - }); - }); - }); - - commits.on("end", function() { - output.push("## [" + tag + "](" + repo + "/releases/tag/" + tag + ")\n"); - Object.keys(categories).forEach(function(category) { - var messages = categories[category]; - if (!messages.length) - return; - output.push("\n### " + category + "\n"); - messages.forEach(function(message) { - var text = message.text.replace(/#(\d+)/g, "[#$1](" + repo + "/issues/$1)"); - output.push("[:hash:](" + repo + "/commit/" + message.hash + ") " + text + "
    \n"); - }); - }); - var current; - try { - current = fs.readFileSync(basedir + "/CHANGELOG.md").toString("utf8"); - } catch (e) { - current = ""; - } - var re = new RegExp("^## \\[" + tag + "\\]"); - if (re.test(current)) { // regenerated, replace - var pos = current.indexOf("## [", 1); - if (pos > -1) - current = current.substring(pos).trim(); - else - current = ""; - } - var contents = output.join("") + "\n" + current; - if (argv.write) - fs.writeFileSync(basedir + "/CHANGELOG.md", contents, "utf8"); - else - process.stdout.write(contents); - }); -}); diff --git a/node_modules/protobufjs/scripts/postinstall.js b/node_modules/protobufjs/scripts/postinstall.js deleted file mode 100644 index 37898b6d..00000000 --- a/node_modules/protobufjs/scripts/postinstall.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -var path = require("path"), - fs = require("fs"), - pkg = require(path.join(__dirname, "..", "package.json")); - -// ensure that there is a node_modules folder for cli dependencies -try { fs.mkdirSync(path.join(__dirname, "..", "cli", "node_modules")); } catch (e) {/**/} - -// check version scheme used by dependents -if (!pkg.versionScheme) - return; - -var warn = process.stderr.isTTY - ? "\x1b[30m\x1b[43mWARN\x1b[0m \x1b[35m" + path.basename(process.argv[1], ".js") + "\x1b[0m" - : "WARN " + path.basename(process.argv[1], ".js"); - -var basePkg; -try { - basePkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "package.json"))); -} catch (e) { - return; -} - -[ - "dependencies", - "devDependencies", - "optionalDependencies", - "peerDependencies" -] -.forEach(function(check) { - var version = basePkg && basePkg[check] && basePkg[check][pkg.name]; - if (typeof version === "string" && version.charAt(0) !== pkg.versionScheme) - process.stderr.write(pkg.name + " " + warn + " " + pkg.name + "@" + version + " is configured as a dependency of " + basePkg.name + ". use " + pkg.name + "@" + pkg.versionScheme + version.substring(1) + " instead for API compatibility.\n"); -}); diff --git a/node_modules/protobufjs/src/common.js b/node_modules/protobufjs/src/common.js deleted file mode 100644 index 489ee1c6..00000000 --- a/node_modules/protobufjs/src/common.js +++ /dev/null @@ -1,399 +0,0 @@ -"use strict"; -module.exports = common; - -var commonRe = /\/|\./; - -/** - * Provides common type definitions. - * Can also be used to provide additional google types or your own custom types. - * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name - * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition - * @returns {undefined} - * @property {INamespace} google/protobuf/any.proto Any - * @property {INamespace} google/protobuf/duration.proto Duration - * @property {INamespace} google/protobuf/empty.proto Empty - * @property {INamespace} google/protobuf/field_mask.proto FieldMask - * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue - * @property {INamespace} google/protobuf/timestamp.proto Timestamp - * @property {INamespace} google/protobuf/wrappers.proto Wrappers - * @example - * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension) - * protobuf.common("descriptor", descriptorJson); - * - * // manually provides a custom definition (uses my.foo namespace) - * protobuf.common("my/foo/bar.proto", myFooBarJson); - */ -function common(name, json) { - if (!commonRe.test(name)) { - name = "google/protobuf/" + name + ".proto"; - json = { nested: { google: { nested: { protobuf: { nested: json } } } } }; - } - common[name] = json; -} - -// Not provided because of limited use (feel free to discuss or to provide yourself): -// -// google/protobuf/descriptor.proto -// google/protobuf/source_context.proto -// google/protobuf/type.proto -// -// Stripped and pre-parsed versions of these non-bundled files are instead available as part of -// the repository or package within the google/protobuf directory. - -common("any", { - - /** - * Properties of a google.protobuf.Any message. - * @interface IAny - * @type {Object} - * @property {string} [typeUrl] - * @property {Uint8Array} [bytes] - * @memberof common - */ - Any: { - fields: { - type_url: { - type: "string", - id: 1 - }, - value: { - type: "bytes", - id: 2 - } - } - } -}); - -var timeType; - -common("duration", { - - /** - * Properties of a google.protobuf.Duration message. - * @interface IDuration - * @type {Object} - * @property {number|Long} [seconds] - * @property {number} [nanos] - * @memberof common - */ - Duration: timeType = { - fields: { - seconds: { - type: "int64", - id: 1 - }, - nanos: { - type: "int32", - id: 2 - } - } - } -}); - -common("timestamp", { - - /** - * Properties of a google.protobuf.Timestamp message. - * @interface ITimestamp - * @type {Object} - * @property {number|Long} [seconds] - * @property {number} [nanos] - * @memberof common - */ - Timestamp: timeType -}); - -common("empty", { - - /** - * Properties of a google.protobuf.Empty message. - * @interface IEmpty - * @memberof common - */ - Empty: { - fields: {} - } -}); - -common("struct", { - - /** - * Properties of a google.protobuf.Struct message. - * @interface IStruct - * @type {Object} - * @property {Object.} [fields] - * @memberof common - */ - Struct: { - fields: { - fields: { - keyType: "string", - type: "Value", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Value message. - * @interface IValue - * @type {Object} - * @property {string} [kind] - * @property {0} [nullValue] - * @property {number} [numberValue] - * @property {string} [stringValue] - * @property {boolean} [boolValue] - * @property {IStruct} [structValue] - * @property {IListValue} [listValue] - * @memberof common - */ - Value: { - oneofs: { - kind: { - oneof: [ - "nullValue", - "numberValue", - "stringValue", - "boolValue", - "structValue", - "listValue" - ] - } - }, - fields: { - nullValue: { - type: "NullValue", - id: 1 - }, - numberValue: { - type: "double", - id: 2 - }, - stringValue: { - type: "string", - id: 3 - }, - boolValue: { - type: "bool", - id: 4 - }, - structValue: { - type: "Struct", - id: 5 - }, - listValue: { - type: "ListValue", - id: 6 - } - } - }, - - NullValue: { - values: { - NULL_VALUE: 0 - } - }, - - /** - * Properties of a google.protobuf.ListValue message. - * @interface IListValue - * @type {Object} - * @property {Array.} [values] - * @memberof common - */ - ListValue: { - fields: { - values: { - rule: "repeated", - type: "Value", - id: 1 - } - } - } -}); - -common("wrappers", { - - /** - * Properties of a google.protobuf.DoubleValue message. - * @interface IDoubleValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - DoubleValue: { - fields: { - value: { - type: "double", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.FloatValue message. - * @interface IFloatValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - FloatValue: { - fields: { - value: { - type: "float", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Int64Value message. - * @interface IInt64Value - * @type {Object} - * @property {number|Long} [value] - * @memberof common - */ - Int64Value: { - fields: { - value: { - type: "int64", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.UInt64Value message. - * @interface IUInt64Value - * @type {Object} - * @property {number|Long} [value] - * @memberof common - */ - UInt64Value: { - fields: { - value: { - type: "uint64", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.Int32Value message. - * @interface IInt32Value - * @type {Object} - * @property {number} [value] - * @memberof common - */ - Int32Value: { - fields: { - value: { - type: "int32", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.UInt32Value message. - * @interface IUInt32Value - * @type {Object} - * @property {number} [value] - * @memberof common - */ - UInt32Value: { - fields: { - value: { - type: "uint32", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.BoolValue message. - * @interface IBoolValue - * @type {Object} - * @property {boolean} [value] - * @memberof common - */ - BoolValue: { - fields: { - value: { - type: "bool", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.StringValue message. - * @interface IStringValue - * @type {Object} - * @property {string} [value] - * @memberof common - */ - StringValue: { - fields: { - value: { - type: "string", - id: 1 - } - } - }, - - /** - * Properties of a google.protobuf.BytesValue message. - * @interface IBytesValue - * @type {Object} - * @property {Uint8Array} [value] - * @memberof common - */ - BytesValue: { - fields: { - value: { - type: "bytes", - id: 1 - } - } - } -}); - -common("field_mask", { - - /** - * Properties of a google.protobuf.FieldMask message. - * @interface IDoubleValue - * @type {Object} - * @property {number} [value] - * @memberof common - */ - FieldMask: { - fields: { - paths: { - rule: "repeated", - type: "string", - id: 1 - } - } - } -}); - -/** - * Gets the root definition of the specified common proto file. - * - * Bundled definitions are: - * - google/protobuf/any.proto - * - google/protobuf/duration.proto - * - google/protobuf/empty.proto - * - google/protobuf/field_mask.proto - * - google/protobuf/struct.proto - * - google/protobuf/timestamp.proto - * - google/protobuf/wrappers.proto - * - * @param {string} file Proto file name - * @returns {INamespace|null} Root definition or `null` if not defined - */ -common.get = function get(file) { - return common[file] || null; -}; diff --git a/node_modules/protobufjs/src/converter.js b/node_modules/protobufjs/src/converter.js deleted file mode 100644 index 44d952e6..00000000 --- a/node_modules/protobufjs/src/converter.js +++ /dev/null @@ -1,293 +0,0 @@ -"use strict"; -/** - * Runtime message from/to plain object converters. - * @namespace - */ -var converter = exports; - -var Enum = require("./enum"), - util = require("./util"); - -/** - * Generates a partial value fromObject conveter. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} prop Property reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genValuePartial_fromObject(gen, field, fieldIndex, prop) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(d%s){", prop); - for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) { - if (field.repeated && values[keys[i]] === field.typeDefault) gen - ("default:"); - gen - ("case%j:", keys[i]) - ("case %i:", values[keys[i]]) - ("m%s=%j", prop, values[keys[i]]) - ("break"); - } gen - ("}"); - } else gen - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s=types[%i].fromObject(d%s)", prop, fieldIndex, prop); - } else { - var isUnsigned = false; - switch (field.type) { - case "double": - case "float": gen - ("m%s=Number(d%s)", prop, prop); // also catches "NaN", "Infinity" - break; - case "uint32": - case "fixed32": gen - ("m%s=d%s>>>0", prop, prop); - break; - case "int32": - case "sint32": - case "sfixed32": gen - ("m%s=d%s|0", prop, prop); - break; - case "uint64": - isUnsigned = true; - // eslint-disable-line no-fallthrough - case "int64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(util.Long)") - ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned) - ("else if(typeof d%s===\"string\")", prop) - ("m%s=parseInt(d%s,10)", prop, prop) - ("else if(typeof d%s===\"number\")", prop) - ("m%s=d%s", prop, prop) - ("else if(typeof d%s===\"object\")", prop) - ("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : ""); - break; - case "bytes": gen - ("if(typeof d%s===\"string\")", prop) - ("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop) - ("else if(d%s.length)", prop) - ("m%s=d%s", prop, prop); - break; - case "string": gen - ("m%s=String(d%s)", prop, prop); - break; - case "bool": gen - ("m%s=Boolean(d%s)", prop, prop); - break; - /* default: gen - ("m%s=d%s", prop, prop); - break; */ - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a plain object to runtime message converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.fromObject = function fromObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray; - var gen = util.codegen(["d"], mtype.name + "$fromObject") - ("if(d instanceof this.ctor)") - ("return d"); - if (!fields.length) return gen - ("return new this.ctor"); - gen - ("var m=new this.ctor"); - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - prop = util.safeProp(field.name); - - // Map fields - if (field.map) { gen - ("if(d%s){", prop) - ("if(typeof d%s!==\"object\")", prop) - ("throw TypeError(%j)", field.fullName + ": object expected") - ("m%s={}", prop) - ("for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop); - break; - case "bytes": gen - ("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop); - break; - default: gen - ("d%s=m%s", prop, prop); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} - -/** - * Generates a runtime message to plain object converter specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -converter.toObject = function toObject(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); - if (!fields.length) - return util.codegen()("return {}"); - var gen = util.codegen(["m", "o"], mtype.name + "$toObject") - ("if(!o)") - ("o={}") - ("var d={}"); - - var repeatedFields = [], - mapFields = [], - normalFields = [], - i = 0; - for (; i < fields.length; ++i) - if (!fields[i].partOf) - ( fields[i].resolve().repeated ? repeatedFields - : fields[i].map ? mapFields - : normalFields).push(fields[i]); - - if (repeatedFields.length) { gen - ("if(o.arrays||o.defaults){"); - for (i = 0; i < repeatedFields.length; ++i) gen - ("d%s=[]", util.safeProp(repeatedFields[i].name)); - gen - ("}"); - } - - if (mapFields.length) { gen - ("if(o.objects||o.defaults){"); - for (i = 0; i < mapFields.length; ++i) gen - ("d%s={}", util.safeProp(mapFields[i].name)); - gen - ("}"); - } - - if (normalFields.length) { gen - ("if(o.defaults){"); - for (i = 0; i < normalFields.length; ++i) { - var field = normalFields[i], - prop = util.safeProp(field.name); - if (field.resolvedType instanceof Enum) gen - ("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault); - else if (field.long) gen - ("if(util.Long){") - ("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned) - ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop) - ("}else") - ("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber()); - else if (field.bytes) { - var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]"; - gen - ("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault)) - ("else{") - ("d%s=%s", prop, arrayDefault) - ("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop) - ("}"); - } else gen - ("d%s=%j", prop, field.typeDefault); // also messages (=null) - } gen - ("}"); - } - var hasKs2 = false; - for (i = 0; i < fields.length; ++i) { - var field = fields[i], - index = mtype._fieldsArray.indexOf(field), - prop = util.safeProp(field.name); - if (field.map) { - if (!hasKs2) { hasKs2 = true; gen - ("var ks2"); - } gen - ("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop) - ("d%s={}", prop) - ("for(var j=0;j>>3){"); - - var i = 0; - for (; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - ref = "m" + util.safeProp(field.name); gen - ("case %i:", field.id); - - // Map fields - if (field.map) { gen - ("if(%s===util.emptyObject)", ref) - ("%s={}", ref) - ("var c2 = r.uint32()+r.pos"); - - if (types.defaults[field.keyType] !== undefined) gen - ("k=%j", types.defaults[field.keyType]); - else gen - ("k=null"); - - if (types.defaults[type] !== undefined) gen - ("value=%j", types.defaults[type]); - else gen - ("value=null"); - - gen - ("while(r.pos>>3){") - ("case 1: k=r.%s(); break", field.keyType) - ("case 2:"); - - if (types.basic[type] === undefined) gen - ("value=types[%i].decode(r,r.uint32())", i); // can't be groups - else gen - ("value=r.%s()", type); - - gen - ("break") - ("default:") - ("r.skipType(tag2&7)") - ("break") - ("}") - ("}"); - - if (types.long[field.keyType] !== undefined) gen - ("%s[typeof k===\"object\"?util.longToHash(k):k]=value", ref); - else gen - ("%s[k]=value", ref); - - // Repeated fields - } else if (field.repeated) { gen - - ("if(!(%s&&%s.length))", ref, ref) - ("%s=[]", ref); - - // Packable (always check for forward and backward compatiblity) - if (types.packed[type] !== undefined) gen - ("if((t&7)===2){") - ("var c2=r.uint32()+r.pos") - ("while(r.pos>> 0, (field.id << 3 | 4) >>> 0) - : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0); -} - -/** - * Generates an encoder specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function encoder(mtype) { - /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ - var gen = util.codegen(["m", "w"], mtype.name + "$encode") - ("if(!w)") - ("w=Writer.create()"); - - var i, ref; - - // "when a message is serialized its known fields should be written sequentially by field number" - var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById); - - for (var i = 0; i < fields.length; ++i) { - var field = fields[i].resolve(), - index = mtype._fieldsArray.indexOf(field), - type = field.resolvedType instanceof Enum ? "int32" : field.type, - wireType = types.basic[type]; - ref = "m" + util.safeProp(field.name); - - // Map fields - if (field.map) { - gen - ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name) // !== undefined && !== null - ("for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType); - if (wireType === undefined) gen - ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups - else gen - (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); - gen - ("}") - ("}"); - - // Repeated fields - } else if (field.repeated) { gen - ("if(%s!=null&&%s.length){", ref, ref); // !== undefined && !== null - - // Packed repeated - if (field.packed && types.packed[type] !== undefined) { gen - - ("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0) - ("for(var i=0;i<%s.length;++i)", ref) - ("w.%s(%s[i])", type, ref) - ("w.ldelim()"); - - // Non-packed - } else { gen - - ("for(var i=0;i<%s.length;++i)", ref); - if (wireType === undefined) - genTypePartial(gen, field, index, ref + "[i]"); - else gen - ("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); - - } gen - ("}"); - - // Non-repeated - } else { - if (field.optional) gen - ("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", ref, field.name); // !== undefined && !== null - - if (wireType === undefined) - genTypePartial(gen, field, index, ref); - else gen - ("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref); - - } - } - - return gen - ("return w"); - /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ -} diff --git a/node_modules/protobufjs/src/enum.js b/node_modules/protobufjs/src/enum.js deleted file mode 100644 index b11014be..00000000 --- a/node_modules/protobufjs/src/enum.js +++ /dev/null @@ -1,181 +0,0 @@ -"use strict"; -module.exports = Enum; - -// extends ReflectionObject -var ReflectionObject = require("./object"); -((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum"; - -var Namespace = require("./namespace"), - util = require("./util"); - -/** - * Constructs a new enum instance. - * @classdesc Reflected enum. - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {Object.} [values] Enum values as an object, by name - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this enum - * @param {Object.} [comments] The value comments for this enum - */ -function Enum(name, values, options, comment, comments) { - ReflectionObject.call(this, name, options); - - if (values && typeof values !== "object") - throw TypeError("values must be an object"); - - /** - * Enum values by id. - * @type {Object.} - */ - this.valuesById = {}; - - /** - * Enum values by name. - * @type {Object.} - */ - this.values = Object.create(this.valuesById); // toJSON, marker - - /** - * Enum comment text. - * @type {string|null} - */ - this.comment = comment; - - /** - * Value comment texts, if any. - * @type {Object.} - */ - this.comments = comments || {}; - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - // Note that values inherit valuesById on their prototype which makes them a TypeScript- - // compatible enum. This is used by pbts to write actual enum definitions that work for - // static and reflection code alike instead of emitting generic object definitions. - - if (values) - for (var keys = Object.keys(values), i = 0; i < keys.length; ++i) - if (typeof values[keys[i]] === "number") // use forward entries only - this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i]; -} - -/** - * Enum descriptor. - * @interface IEnum - * @property {Object.} values Enum values - * @property {Object.} [options] Enum options - */ - -/** - * Constructs an enum from an enum descriptor. - * @param {string} name Enum name - * @param {IEnum} json Enum descriptor - * @returns {Enum} Created enum - * @throws {TypeError} If arguments are invalid - */ -Enum.fromJSON = function fromJSON(name, json) { - var enm = new Enum(name, json.values, json.options, json.comment, json.comments); - enm.reserved = json.reserved; - return enm; -}; - -/** - * Converts this enum to an enum descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IEnum} Enum descriptor - */ -Enum.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "values" , this.values, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "comment" , keepComments ? this.comment : undefined, - "comments" , keepComments ? this.comments : undefined - ]); -}; - -/** - * Adds a value to this enum. - * @param {string} name Value name - * @param {number} id Value id - * @param {string} [comment] Comment, if any - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a value with this name or id - */ -Enum.prototype.add = function add(name, id, comment) { - // utilized by the parser but not by .fromJSON - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (!util.isInteger(id)) - throw TypeError("id must be an integer"); - - if (this.values[name] !== undefined) - throw Error("duplicate name '" + name + "' in " + this); - - if (this.isReservedId(id)) - throw Error("id " + id + " is reserved in " + this); - - if (this.isReservedName(name)) - throw Error("name '" + name + "' is reserved in " + this); - - if (this.valuesById[id] !== undefined) { - if (!(this.options && this.options.allow_alias)) - throw Error("duplicate id " + id + " in " + this); - this.values[name] = id; - } else - this.valuesById[this.values[name] = id] = name; - - this.comments[name] = comment || null; - return this; -}; - -/** - * Removes a value from this enum - * @param {string} name Value name - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `name` is not a name of this enum - */ -Enum.prototype.remove = function remove(name) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - var val = this.values[name]; - if (val == null) - throw Error("name '" + name + "' does not exist in " + this); - - delete this.valuesById[val]; - delete this.values[name]; - delete this.comments[name]; - - return this; -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Enum.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; diff --git a/node_modules/protobufjs/src/field.js b/node_modules/protobufjs/src/field.js deleted file mode 100644 index 788c773b..00000000 --- a/node_modules/protobufjs/src/field.js +++ /dev/null @@ -1,371 +0,0 @@ -"use strict"; -module.exports = Field; - -// extends ReflectionObject -var ReflectionObject = require("./object"); -((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field"; - -var Enum = require("./enum"), - types = require("./types"), - util = require("./util"); - -var Type; // cyclic - -var ruleRe = /^required|optional|repeated$/; - -/** - * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. - * @name Field - * @classdesc Reflected message field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a field from a field descriptor. - * @param {string} name Field name - * @param {IField} json Field descriptor - * @returns {Field} Created field - * @throws {TypeError} If arguments are invalid - */ -Field.fromJSON = function fromJSON(name, json) { - return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment); -}; - -/** - * Not an actual constructor. Use {@link Field} instead. - * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. - * @exports FieldBase - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function Field(name, id, type, rule, extend, options, comment) { - - if (util.isObject(rule)) { - comment = extend; - options = rule; - rule = extend = undefined; - } else if (util.isObject(extend)) { - comment = options; - options = extend; - extend = undefined; - } - - ReflectionObject.call(this, name, options); - - if (!util.isInteger(id) || id < 0) - throw TypeError("id must be a non-negative integer"); - - if (!util.isString(type)) - throw TypeError("type must be a string"); - - if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase())) - throw TypeError("rule must be a string rule"); - - if (extend !== undefined && !util.isString(extend)) - throw TypeError("extend must be a string"); - - /** - * Field rule, if any. - * @type {string|undefined} - */ - this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON - - /** - * Field type. - * @type {string} - */ - this.type = type; // toJSON - - /** - * Unique field id. - * @type {number} - */ - this.id = id; // toJSON, marker - - /** - * Extended type if different from parent. - * @type {string|undefined} - */ - this.extend = extend || undefined; // toJSON - - /** - * Whether this field is required. - * @type {boolean} - */ - this.required = rule === "required"; - - /** - * Whether this field is optional. - * @type {boolean} - */ - this.optional = !this.required; - - /** - * Whether this field is repeated. - * @type {boolean} - */ - this.repeated = rule === "repeated"; - - /** - * Whether this field is a map or not. - * @type {boolean} - */ - this.map = false; - - /** - * Message this field belongs to. - * @type {Type|null} - */ - this.message = null; - - /** - * OneOf this field belongs to, if any, - * @type {OneOf|null} - */ - this.partOf = null; - - /** - * The field type's default value. - * @type {*} - */ - this.typeDefault = null; - - /** - * The field's default value on prototypes. - * @type {*} - */ - this.defaultValue = null; - - /** - * Whether this field's value should be treated as a long. - * @type {boolean} - */ - this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false; - - /** - * Whether this field's value is a buffer. - * @type {boolean} - */ - this.bytes = type === "bytes"; - - /** - * Resolved type if not a basic type. - * @type {Type|Enum|null} - */ - this.resolvedType = null; - - /** - * Sister-field within the extended type if a declaring extension field. - * @type {Field|null} - */ - this.extensionField = null; - - /** - * Sister-field within the declaring namespace if an extended field. - * @type {Field|null} - */ - this.declaringField = null; - - /** - * Internally remembers whether this field is packed. - * @type {boolean|null} - * @private - */ - this._packed = null; - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Determines whether this field is packed. Only relevant when repeated and working with proto2. - * @name Field#packed - * @type {boolean} - * @readonly - */ -Object.defineProperty(Field.prototype, "packed", { - get: function() { - // defaults to packed=true if not explicity set to false - if (this._packed === null) - this._packed = this.getOption("packed") !== false; - return this._packed; - } -}); - -/** - * @override - */ -Field.prototype.setOption = function setOption(name, value, ifNotSet) { - if (name === "packed") // clear cached before setting - this._packed = null; - return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet); -}; - -/** - * Field descriptor. - * @interface IField - * @property {string} [rule="optional"] Field rule - * @property {string} type Field type - * @property {number} id Field id - * @property {Object.} [options] Field options - */ - -/** - * Extension field descriptor. - * @interface IExtensionField - * @extends IField - * @property {string} extend Extended type - */ - -/** - * Converts this field to a field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IField} Field descriptor - */ -Field.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "rule" , this.rule !== "optional" && this.rule || undefined, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Resolves this field's type references. - * @returns {Field} `this` - * @throws {Error} If any reference cannot be resolved - */ -Field.prototype.resolve = function resolve() { - - if (this.resolved) - return this; - - if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it - this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type); - if (this.resolvedType instanceof Type) - this.typeDefault = null; - else // instanceof Enum - this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined - } - - // use explicitly set default value if present - if (this.options && this.options["default"] != null) { - this.typeDefault = this.options["default"]; - if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string") - this.typeDefault = this.resolvedType.values[this.typeDefault]; - } - - // remove unnecessary options - if (this.options) { - if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum)) - delete this.options.packed; - if (!Object.keys(this.options).length) - this.options = undefined; - } - - // convert to internal data type if necesssary - if (this.long) { - this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"); - - /* istanbul ignore else */ - if (Object.freeze) - Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it) - - } else if (this.bytes && typeof this.typeDefault === "string") { - var buf; - if (util.base64.test(this.typeDefault)) - util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0); - else - util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0); - this.typeDefault = buf; - } - - // take special care of maps and repeated fields - if (this.map) - this.defaultValue = util.emptyObject; - else if (this.repeated) - this.defaultValue = util.emptyArray; - else - this.defaultValue = this.typeDefault; - - // ensure proper value on prototype - if (this.parent instanceof Type) - this.parent.ctor.prototype[this.name] = this.defaultValue; - - return ReflectionObject.prototype.resolve.call(this); -}; - -/** - * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript). - * @typedef FieldDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} fieldName Field name - * @returns {undefined} - */ - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|Object} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @param {T} [defaultValue] Default value - * @returns {FieldDecorator} Decorator function - * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[] - */ -Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) { - - // submessage: decorate the submessage and use its name as the type - if (typeof fieldType === "function") - fieldType = util.decorateType(fieldType).name; - - // enum reference: create a reflected copy of the enum and keep reuseing it - else if (fieldType && typeof fieldType === "object") - fieldType = util.decorateEnum(fieldType).name; - - return function fieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue })); - }; -}; - -/** - * Field decorator (TypeScript). - * @name Field.d - * @function - * @param {number} fieldId Field id - * @param {Constructor|string} fieldType Field type - * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule - * @returns {FieldDecorator} Decorator function - * @template T extends Message - * @variation 2 - */ -// like Field.d but without a default value - -// Sets up cyclic dependencies (called in index-light) -Field._configure = function configure(Type_) { - Type = Type_; -}; diff --git a/node_modules/protobufjs/src/index-light.js b/node_modules/protobufjs/src/index-light.js deleted file mode 100644 index 32c6a05c..00000000 --- a/node_modules/protobufjs/src/index-light.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -var protobuf = module.exports = require("./index-minimal"); - -protobuf.build = "light"; - -/** - * A node-style callback as used by {@link load} and {@link Root#load}. - * @typedef LoadCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Root} [root] Root, if there hasn't been an error - * @returns {undefined} - */ - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @param {string|string[]} filename One or multiple files to load - * @param {Root} root Root namespace, defaults to create a new one if omitted. - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - */ -function load(filename, root, callback) { - if (typeof root === "function") { - callback = root; - root = new protobuf.Root(); - } else if (!root) - root = new protobuf.Root(); - return root.load(filename, callback); -} - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @see {@link Root#load} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Promise} Promise - * @see {@link Root#load} - * @variation 3 - */ -// function load(filename:string, [root:Root]):Promise - -protobuf.load = load; - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - * @see {@link Root#loadSync} - */ -function loadSync(filename, root) { - if (!root) - root = new protobuf.Root(); - return root.loadSync(filename); -} - -protobuf.loadSync = loadSync; - -// Serialization -protobuf.encoder = require("./encoder"); -protobuf.decoder = require("./decoder"); -protobuf.verifier = require("./verifier"); -protobuf.converter = require("./converter"); - -// Reflection -protobuf.ReflectionObject = require("./object"); -protobuf.Namespace = require("./namespace"); -protobuf.Root = require("./root"); -protobuf.Enum = require("./enum"); -protobuf.Type = require("./type"); -protobuf.Field = require("./field"); -protobuf.OneOf = require("./oneof"); -protobuf.MapField = require("./mapfield"); -protobuf.Service = require("./service"); -protobuf.Method = require("./method"); - -// Runtime -protobuf.Message = require("./message"); -protobuf.wrappers = require("./wrappers"); - -// Utility -protobuf.types = require("./types"); -protobuf.util = require("./util"); - -// Set up possibly cyclic reflection dependencies -protobuf.ReflectionObject._configure(protobuf.Root); -protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum); -protobuf.Root._configure(protobuf.Type); -protobuf.Field._configure(protobuf.Type); diff --git a/node_modules/protobufjs/src/index-minimal.js b/node_modules/protobufjs/src/index-minimal.js deleted file mode 100644 index 1f4aaea6..00000000 --- a/node_modules/protobufjs/src/index-minimal.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -var protobuf = exports; - -/** - * Build type, one of `"full"`, `"light"` or `"minimal"`. - * @name build - * @type {string} - * @const - */ -protobuf.build = "minimal"; - -// Serialization -protobuf.Writer = require("./writer"); -protobuf.BufferWriter = require("./writer_buffer"); -protobuf.Reader = require("./reader"); -protobuf.BufferReader = require("./reader_buffer"); - -// Utility -protobuf.util = require("./util/minimal"); -protobuf.rpc = require("./rpc"); -protobuf.roots = require("./roots"); -protobuf.configure = configure; - -/* istanbul ignore next */ -/** - * Reconfigures the library according to the environment. - * @returns {undefined} - */ -function configure() { - protobuf.util._configure(); - protobuf.Writer._configure(protobuf.BufferWriter); - protobuf.Reader._configure(protobuf.BufferReader); -} - -// Set up buffer utility according to the environment -configure(); diff --git a/node_modules/protobufjs/src/index.js b/node_modules/protobufjs/src/index.js deleted file mode 100644 index 56bd3d5d..00000000 --- a/node_modules/protobufjs/src/index.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -var protobuf = module.exports = require("./index-light"); - -protobuf.build = "full"; - -// Parser -protobuf.tokenize = require("./tokenize"); -protobuf.parse = require("./parse"); -protobuf.common = require("./common"); - -// Configure parser -protobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common); diff --git a/node_modules/protobufjs/src/mapfield.js b/node_modules/protobufjs/src/mapfield.js deleted file mode 100644 index 67c70978..00000000 --- a/node_modules/protobufjs/src/mapfield.js +++ /dev/null @@ -1,126 +0,0 @@ -"use strict"; -module.exports = MapField; - -// extends Field -var Field = require("./field"); -((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; - -var types = require("./types"), - util = require("./util"); - -/** - * Constructs a new map field instance. - * @classdesc Reflected map field. - * @extends FieldBase - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} keyType Key type - * @param {string} type Value type - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function MapField(name, id, keyType, type, options, comment) { - Field.call(this, name, id, type, undefined, undefined, options, comment); - - /* istanbul ignore if */ - if (!util.isString(keyType)) - throw TypeError("keyType must be a string"); - - /** - * Key type. - * @type {string} - */ - this.keyType = keyType; // toJSON, marker - - /** - * Resolved key type if not a basic type. - * @type {ReflectionObject|null} - */ - this.resolvedKeyType = null; - - // Overrides Field#map - this.map = true; -} - -/** - * Map field descriptor. - * @interface IMapField - * @extends {IField} - * @property {string} keyType Key type - */ - -/** - * Extension map field descriptor. - * @interface IExtensionMapField - * @extends IMapField - * @property {string} extend Extended type - */ - -/** - * Constructs a map field from a map field descriptor. - * @param {string} name Field name - * @param {IMapField} json Map field descriptor - * @returns {MapField} Created map field - * @throws {TypeError} If arguments are invalid - */ -MapField.fromJSON = function fromJSON(name, json) { - return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment); -}; - -/** - * Converts this map field to a map field descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMapField} Map field descriptor - */ -MapField.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "keyType" , this.keyType, - "type" , this.type, - "id" , this.id, - "extend" , this.extend, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -MapField.prototype.resolve = function resolve() { - if (this.resolved) - return this; - - // Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes" - if (types.mapKey[this.keyType] === undefined) - throw Error("invalid key type: " + this.keyType); - - return Field.prototype.resolve.call(this); -}; - -/** - * Map field decorator (TypeScript). - * @name MapField.d - * @function - * @param {number} fieldId Field id - * @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type - * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type - * @returns {FieldDecorator} Decorator function - * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> } - */ -MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { - - // submessage value: decorate the submessage and use its name as the type - if (typeof fieldValueType === "function") - fieldValueType = util.decorateType(fieldValueType).name; - - // enum reference value: create a reflected copy of the enum and keep reuseing it - else if (fieldValueType && typeof fieldValueType === "object") - fieldValueType = util.decorateEnum(fieldValueType).name; - - return function mapFieldDecorator(prototype, fieldName) { - util.decorateType(prototype.constructor) - .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); - }; -}; diff --git a/node_modules/protobufjs/src/message.js b/node_modules/protobufjs/src/message.js deleted file mode 100644 index 3f94bf6a..00000000 --- a/node_modules/protobufjs/src/message.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; -module.exports = Message; - -var util = require("./util/minimal"); - -/** - * Constructs a new message instance. - * @classdesc Abstract runtime message. - * @constructor - * @param {Properties} [properties] Properties to set - * @template T extends object = object - */ -function Message(properties) { - // not used internally - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; -} - -/** - * Reference to the reflected type. - * @name Message.$type - * @type {Type} - * @readonly - */ - -/** - * Reference to the reflected type. - * @name Message#$type - * @type {Type} - * @readonly - */ - -/*eslint-disable valid-jsdoc*/ - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message} Message instance - * @template T extends Message - * @this Constructor - */ -Message.create = function create(properties) { - return this.$type.create(properties); -}; - -/** - * Encodes a message of this type. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encode = function encode(message, writer) { - return this.$type.encode(message, writer); -}; - -/** - * Encodes a message of this type preceeded by its length as a varint. - * @param {T|Object.} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - * @template T extends Message - * @this Constructor - */ -Message.encodeDelimited = function encodeDelimited(message, writer) { - return this.$type.encodeDelimited(message, writer); -}; - -/** - * Decodes a message of this type. - * @name Message.decode - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decode = function decode(reader) { - return this.$type.decode(reader); -}; - -/** - * Decodes a message of this type preceeded by its length as a varint. - * @name Message.decodeDelimited - * @function - * @param {Reader|Uint8Array} reader Reader or buffer to decode - * @returns {T} Decoded message - * @template T extends Message - * @this Constructor - */ -Message.decodeDelimited = function decodeDelimited(reader) { - return this.$type.decodeDelimited(reader); -}; - -/** - * Verifies a message of this type. - * @name Message.verify - * @function - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ -Message.verify = function verify(message) { - return this.$type.verify(message); -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object - * @returns {T} Message instance - * @template T extends Message - * @this Constructor - */ -Message.fromObject = function fromObject(object) { - return this.$type.fromObject(object); -}; - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {T} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @template T extends Message - * @this Constructor - */ -Message.toObject = function toObject(message, options) { - return this.$type.toObject(message, options); -}; - -/** - * Converts this message to JSON. - * @returns {Object.} JSON object - */ -Message.prototype.toJSON = function toJSON() { - return this.$type.toObject(this, util.toJSONOptions); -}; - -/*eslint-enable valid-jsdoc*/ \ No newline at end of file diff --git a/node_modules/protobufjs/src/method.js b/node_modules/protobufjs/src/method.js deleted file mode 100644 index 18a6ab2c..00000000 --- a/node_modules/protobufjs/src/method.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; -module.exports = Method; - -// extends ReflectionObject -var ReflectionObject = require("./object"); -((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method"; - -var util = require("./util"); - -/** - * Constructs a new service method instance. - * @classdesc Reflected service method. - * @extends ReflectionObject - * @constructor - * @param {string} name Method name - * @param {string|undefined} type Method type, usually `"rpc"` - * @param {string} requestType Request message type - * @param {string} responseType Response message type - * @param {boolean|Object.} [requestStream] Whether the request is streamed - * @param {boolean|Object.} [responseStream] Whether the response is streamed - * @param {Object.} [options] Declared options - * @param {string} [comment] The comment for this method - * @param {Object.} [parsedOptions] Declared options, properly parsed into an object - */ -function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment, parsedOptions) { - - /* istanbul ignore next */ - if (util.isObject(requestStream)) { - options = requestStream; - requestStream = responseStream = undefined; - } else if (util.isObject(responseStream)) { - options = responseStream; - responseStream = undefined; - } - - /* istanbul ignore if */ - if (!(type === undefined || util.isString(type))) - throw TypeError("type must be a string"); - - /* istanbul ignore if */ - if (!util.isString(requestType)) - throw TypeError("requestType must be a string"); - - /* istanbul ignore if */ - if (!util.isString(responseType)) - throw TypeError("responseType must be a string"); - - ReflectionObject.call(this, name, options); - - /** - * Method type. - * @type {string} - */ - this.type = type || "rpc"; // toJSON - - /** - * Request type. - * @type {string} - */ - this.requestType = requestType; // toJSON, marker - - /** - * Whether requests are streamed or not. - * @type {boolean|undefined} - */ - this.requestStream = requestStream ? true : undefined; // toJSON - - /** - * Response type. - * @type {string} - */ - this.responseType = responseType; // toJSON - - /** - * Whether responses are streamed or not. - * @type {boolean|undefined} - */ - this.responseStream = responseStream ? true : undefined; // toJSON - - /** - * Resolved request type. - * @type {Type|null} - */ - this.resolvedRequestType = null; - - /** - * Resolved response type. - * @type {Type|null} - */ - this.resolvedResponseType = null; - - /** - * Comment for this method - * @type {string|null} - */ - this.comment = comment; - - /** - * Options properly parsed into an object - */ - this.parsedOptions = parsedOptions; -} - -/** - * Method descriptor. - * @interface IMethod - * @property {string} [type="rpc"] Method type - * @property {string} requestType Request type - * @property {string} responseType Response type - * @property {boolean} [requestStream=false] Whether requests are streamed - * @property {boolean} [responseStream=false] Whether responses are streamed - * @property {Object.} [options] Method options - * @property {string} comment Method comments - * @property {Object.} [parsedOptions] Method options properly parsed into an object - */ - -/** - * Constructs a method from a method descriptor. - * @param {string} name Method name - * @param {IMethod} json Method descriptor - * @returns {Method} Created method - * @throws {TypeError} If arguments are invalid - */ -Method.fromJSON = function fromJSON(name, json) { - return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment, json.parsedOptions); -}; - -/** - * Converts this method to a method descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IMethod} Method descriptor - */ -Method.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "type" , this.type !== "rpc" && /* istanbul ignore next */ this.type || undefined, - "requestType" , this.requestType, - "requestStream" , this.requestStream, - "responseType" , this.responseType, - "responseStream" , this.responseStream, - "options" , this.options, - "comment" , keepComments ? this.comment : undefined, - "parsedOptions" , this.parsedOptions, - ]); -}; - -/** - * @override - */ -Method.prototype.resolve = function resolve() { - - /* istanbul ignore if */ - if (this.resolved) - return this; - - this.resolvedRequestType = this.parent.lookupType(this.requestType); - this.resolvedResponseType = this.parent.lookupType(this.responseType); - - return ReflectionObject.prototype.resolve.call(this); -}; diff --git a/node_modules/protobufjs/src/namespace.js b/node_modules/protobufjs/src/namespace.js deleted file mode 100644 index de9f4cdb..00000000 --- a/node_modules/protobufjs/src/namespace.js +++ /dev/null @@ -1,433 +0,0 @@ -"use strict"; -module.exports = Namespace; - -// extends ReflectionObject -var ReflectionObject = require("./object"); -((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace"; - -var Field = require("./field"), - util = require("./util"); - -var Type, // cyclic - Service, - Enum; - -/** - * Constructs a new namespace instance. - * @name Namespace - * @classdesc Reflected namespace. - * @extends NamespaceBase - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - */ - -/** - * Constructs a namespace from JSON. - * @memberof Namespace - * @function - * @param {string} name Namespace name - * @param {Object.} json JSON object - * @returns {Namespace} Created namespace - * @throws {TypeError} If arguments are invalid - */ -Namespace.fromJSON = function fromJSON(name, json) { - return new Namespace(name, json.options).addJSON(json.nested); -}; - -/** - * Converts an array of reflection objects to JSON. - * @memberof Namespace - * @param {ReflectionObject[]} array Object array - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {Object.|undefined} JSON object or `undefined` when array is empty - */ -function arrayToJSON(array, toJSONOptions) { - if (!(array && array.length)) - return undefined; - var obj = {}; - for (var i = 0; i < array.length; ++i) - obj[array[i].name] = array[i].toJSON(toJSONOptions); - return obj; -} - -Namespace.arrayToJSON = arrayToJSON; - -/** - * Tests if the specified id is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedId = function isReservedId(reserved, id) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] > id) - return true; - return false; -}; - -/** - * Tests if the specified name is reserved. - * @param {Array.|undefined} reserved Array of reserved ranges and names - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Namespace.isReservedName = function isReservedName(reserved, name) { - if (reserved) - for (var i = 0; i < reserved.length; ++i) - if (reserved[i] === name) - return true; - return false; -}; - -/** - * Not an actual constructor. Use {@link Namespace} instead. - * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. - * @exports NamespaceBase - * @extends ReflectionObject - * @abstract - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - * @see {@link Namespace} - */ -function Namespace(name, options) { - ReflectionObject.call(this, name, options); - - /** - * Nested objects by name. - * @type {Object.|undefined} - */ - this.nested = undefined; // toJSON - - /** - * Cached nested objects as an array. - * @type {ReflectionObject[]|null} - * @private - */ - this._nestedArray = null; -} - -function clearCache(namespace) { - namespace._nestedArray = null; - return namespace; -} - -/** - * Nested objects of this namespace as an array for iteration. - * @name NamespaceBase#nestedArray - * @type {ReflectionObject[]} - * @readonly - */ -Object.defineProperty(Namespace.prototype, "nestedArray", { - get: function() { - return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); - } -}); - -/** - * Namespace descriptor. - * @interface INamespace - * @property {Object.} [options] Namespace options - * @property {Object.} [nested] Nested object descriptors - */ - -/** - * Any extension field descriptor. - * @typedef AnyExtensionField - * @type {IExtensionField|IExtensionMapField} - */ - -/** - * Any nested object descriptor. - * @typedef AnyNestedObject - * @type {IEnum|IType|IService|AnyExtensionField|INamespace} - */ -// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place) - -/** - * Converts this namespace to a namespace descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {INamespace} Namespace descriptor - */ -Namespace.prototype.toJSON = function toJSON(toJSONOptions) { - return util.toObject([ - "options" , this.options, - "nested" , arrayToJSON(this.nestedArray, toJSONOptions) - ]); -}; - -/** - * Adds nested objects to this namespace from nested object descriptors. - * @param {Object.} nestedJson Any nested object descriptors - * @returns {Namespace} `this` - */ -Namespace.prototype.addJSON = function addJSON(nestedJson) { - var ns = this; - /* istanbul ignore else */ - if (nestedJson) { - for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) { - nested = nestedJson[names[i]]; - ns.add( // most to least likely - ( nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : nested.id !== undefined - ? Field.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - } - return this; -}; - -/** - * Gets the nested object of the specified name. - * @param {string} name Nested object name - * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist - */ -Namespace.prototype.get = function get(name) { - return this.nested && this.nested[name] - || null; -}; - -/** - * Gets the values of the nested {@link Enum|enum} of the specified name. - * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. - * @param {string} name Nested enum name - * @returns {Object.} Enum values - * @throws {Error} If there is no such enum - */ -Namespace.prototype.getEnum = function getEnum(name) { - if (this.nested && this.nested[name] instanceof Enum) - return this.nested[name].values; - throw Error("no such enum: " + name); -}; - -/** - * Adds a nested object to this namespace. - * @param {ReflectionObject} object Nested object to add - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name - */ -Namespace.prototype.add = function add(object) { - - if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace)) - throw TypeError("object must be a valid nested object"); - - if (!this.nested) - this.nested = {}; - else { - var prev = this.get(object.name); - if (prev) { - if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) { - // replace plain namespace but keep existing nested elements and options - var nested = prev.nestedArray; - for (var i = 0; i < nested.length; ++i) - object.add(nested[i]); - this.remove(prev); - if (!this.nested) - this.nested = {}; - object.setOptions(prev.options, true); - - } else - throw Error("duplicate name '" + object.name + "' in " + this); - } - } - this.nested[object.name] = object; - object.onAdd(this); - return clearCache(this); -}; - -/** - * Removes a nested object from this namespace. - * @param {ReflectionObject} object Nested object to remove - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this namespace - */ -Namespace.prototype.remove = function remove(object) { - - if (!(object instanceof ReflectionObject)) - throw TypeError("object must be a ReflectionObject"); - if (object.parent !== this) - throw Error(object + " is not a member of " + this); - - delete this.nested[object.name]; - if (!Object.keys(this.nested).length) - this.nested = undefined; - - object.onRemove(this); - return clearCache(this); -}; - -/** - * Defines additial namespaces within this one if not yet existing. - * @param {string|string[]} path Path to create - * @param {*} [json] Nested types to create from JSON - * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty - */ -Namespace.prototype.define = function define(path, json) { - - if (util.isString(path)) - path = path.split("."); - else if (!Array.isArray(path)) - throw TypeError("illegal path"); - if (path && path.length && path[0] === "") - throw Error("path must be relative"); - - var ptr = this; - while (path.length > 0) { - var part = path.shift(); - if (ptr.nested && ptr.nested[part]) { - ptr = ptr.nested[part]; - if (!(ptr instanceof Namespace)) - throw Error("path conflicts with non-namespace objects"); - } else - ptr.add(ptr = new Namespace(part)); - } - if (json) - ptr.addJSON(json); - return ptr; -}; - -/** - * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost. - * @returns {Namespace} `this` - */ -Namespace.prototype.resolveAll = function resolveAll() { - var nested = this.nestedArray, i = 0; - while (i < nested.length) - if (nested[i] instanceof Namespace) - nested[i++].resolveAll(); - else - nested[i++].resolve(); - return this.resolve(); -}; - -/** - * Recursively looks up the reflection object matching the specified path in the scope of this namespace. - * @param {string|string[]} path Path to look up - * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. - * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - */ -Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) { - - /* istanbul ignore next */ - if (typeof filterTypes === "boolean") { - parentAlreadyChecked = filterTypes; - filterTypes = undefined; - } else if (filterTypes && !Array.isArray(filterTypes)) - filterTypes = [ filterTypes ]; - - if (util.isString(path) && path.length) { - if (path === ".") - return this.root; - path = path.split("."); - } else if (!path.length) - return this; - - // Start at root if path is absolute - if (path[0] === "") - return this.root.lookup(path.slice(1), filterTypes); - - // Test if the first part matches any nested object, and if so, traverse if path contains more - var found = this.get(path[0]); - if (found) { - if (path.length === 1) { - if (!filterTypes || filterTypes.indexOf(found.constructor) > -1) - return found; - } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true))) - return found; - - // Otherwise try each nested namespace - } else - for (var i = 0; i < this.nestedArray.length; ++i) - if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true))) - return found; - - // If there hasn't been a match, try again at the parent - if (this.parent === null || parentAlreadyChecked) - return null; - return this.parent.lookup(path, filterTypes); -}; - -/** - * Looks up the reflection object at the specified path, relative to this namespace. - * @name NamespaceBase#lookup - * @function - * @param {string|string[]} path Path to look up - * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked - * @returns {ReflectionObject|null} Looked up object or `null` if none could be found - * @variation 2 - */ -// lookup(path: string, [parentAlreadyChecked: boolean]) - -/** - * Looks up the {@link Type|type} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type - * @throws {Error} If `path` does not point to a type - */ -Namespace.prototype.lookupType = function lookupType(path) { - var found = this.lookup(path, [ Type ]); - if (!found) - throw Error("no such type: " + path); - return found; -}; - -/** - * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Enum} Looked up enum - * @throws {Error} If `path` does not point to an enum - */ -Namespace.prototype.lookupEnum = function lookupEnum(path) { - var found = this.lookup(path, [ Enum ]); - if (!found) - throw Error("no such Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type or enum - * @throws {Error} If `path` does not point to a type or enum - */ -Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) { - var found = this.lookup(path, [ Type, Enum ]); - if (!found) - throw Error("no such Type or Enum '" + path + "' in " + this); - return found; -}; - -/** - * Looks up the {@link Service|service} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Service} Looked up service - * @throws {Error} If `path` does not point to a service - */ -Namespace.prototype.lookupService = function lookupService(path) { - var found = this.lookup(path, [ Service ]); - if (!found) - throw Error("no such Service '" + path + "' in " + this); - return found; -}; - -// Sets up cyclic dependencies (called in index-light) -Namespace._configure = function(Type_, Service_, Enum_) { - Type = Type_; - Service = Service_; - Enum = Enum_; -}; diff --git a/node_modules/protobufjs/src/object.js b/node_modules/protobufjs/src/object.js deleted file mode 100644 index bd04ceca..00000000 --- a/node_modules/protobufjs/src/object.js +++ /dev/null @@ -1,243 +0,0 @@ -"use strict"; -module.exports = ReflectionObject; - -ReflectionObject.className = "ReflectionObject"; - -var util = require("./util"); - -var Root; // cyclic - -/** - * Constructs a new reflection object instance. - * @classdesc Base class of all reflection objects. - * @constructor - * @param {string} name Object name - * @param {Object.} [options] Declared options - * @abstract - */ -function ReflectionObject(name, options) { - - if (!util.isString(name)) - throw TypeError("name must be a string"); - - if (options && !util.isObject(options)) - throw TypeError("options must be an object"); - - /** - * Options. - * @type {Object.|undefined} - */ - this.options = options; // toJSON - - /** - * Parsed Options. - * @type {Array.>|undefined} - */ - this.parsedOptions = null; - - /** - * Unique name within its namespace. - * @type {string} - */ - this.name = name; - - /** - * Parent namespace. - * @type {Namespace|null} - */ - this.parent = null; - - /** - * Whether already resolved or not. - * @type {boolean} - */ - this.resolved = false; - - /** - * Comment text, if any. - * @type {string|null} - */ - this.comment = null; - - /** - * Defining file name. - * @type {string|null} - */ - this.filename = null; -} - -Object.defineProperties(ReflectionObject.prototype, { - - /** - * Reference to the root namespace. - * @name ReflectionObject#root - * @type {Root} - * @readonly - */ - root: { - get: function() { - var ptr = this; - while (ptr.parent !== null) - ptr = ptr.parent; - return ptr; - } - }, - - /** - * Full name including leading dot. - * @name ReflectionObject#fullName - * @type {string} - * @readonly - */ - fullName: { - get: function() { - var path = [ this.name ], - ptr = this.parent; - while (ptr) { - path.unshift(ptr.name); - ptr = ptr.parent; - } - return path.join("."); - } - } -}); - -/** - * Converts this reflection object to its descriptor representation. - * @returns {Object.} Descriptor - * @abstract - */ -ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() { - throw Error(); // not implemented, shouldn't happen -}; - -/** - * Called when this object is added to a parent. - * @param {ReflectionObject} parent Parent added to - * @returns {undefined} - */ -ReflectionObject.prototype.onAdd = function onAdd(parent) { - if (this.parent && this.parent !== parent) - this.parent.remove(this); - this.parent = parent; - this.resolved = false; - var root = parent.root; - if (root instanceof Root) - root._handleAdd(this); -}; - -/** - * Called when this object is removed from a parent. - * @param {ReflectionObject} parent Parent removed from - * @returns {undefined} - */ -ReflectionObject.prototype.onRemove = function onRemove(parent) { - var root = parent.root; - if (root instanceof Root) - root._handleRemove(this); - this.parent = null; - this.resolved = false; -}; - -/** - * Resolves this objects type references. - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.resolve = function resolve() { - if (this.resolved) - return this; - if (this.root instanceof Root) - this.resolved = true; // only if part of a root - return this; -}; - -/** - * Gets an option value. - * @param {string} name Option name - * @returns {*} Option value or `undefined` if not set - */ -ReflectionObject.prototype.getOption = function getOption(name) { - if (this.options) - return this.options[name]; - return undefined; -}; - -/** - * Sets an option. - * @param {string} name Option name - * @param {*} value Option value - * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) { - if (!ifNotSet || !this.options || this.options[name] === undefined) - (this.options || (this.options = {}))[name] = value; - return this; -}; - -/** - * Sets a parsed option. - * @param {string} name parsed Option name - * @param {*} value Option value - * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) { - if (!this.parsedOptions) { - this.parsedOptions = []; - } - var parsedOptions = this.parsedOptions; - if (propName) { - // If setting a sub property of an option then try to merge it - // with an existing option - var opt = parsedOptions.find(function (opt) { - return Object.prototype.hasOwnProperty.call(opt, name); - }); - if (opt) { - // If we found an existing option - just merge the property value - var newValue = opt[name]; - util.setProperty(newValue, propName, value); - } else { - // otherwise, create a new option, set it's property and add it to the list - opt = {}; - opt[name] = util.setProperty({}, propName, value); - parsedOptions.push(opt); - } - } else { - // Always create a new option when setting the value of the option itself - var newOpt = {}; - newOpt[name] = value; - parsedOptions.push(newOpt); - } - return this; -}; - -/** - * Sets multiple options. - * @param {Object.} options Options to set - * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ -ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) { - if (options) - for (var keys = Object.keys(options), i = 0; i < keys.length; ++i) - this.setOption(keys[i], options[keys[i]], ifNotSet); - return this; -}; - -/** - * Converts this instance to its string representation. - * @returns {string} Class name[, space, full name] - */ -ReflectionObject.prototype.toString = function toString() { - var className = this.constructor.className, - fullName = this.fullName; - if (fullName.length) - return className + " " + fullName; - return className; -}; - -// Sets up cyclic dependencies (called in index-light) -ReflectionObject._configure = function(Root_) { - Root = Root_; -}; diff --git a/node_modules/protobufjs/src/oneof.js b/node_modules/protobufjs/src/oneof.js deleted file mode 100644 index ba0e9027..00000000 --- a/node_modules/protobufjs/src/oneof.js +++ /dev/null @@ -1,203 +0,0 @@ -"use strict"; -module.exports = OneOf; - -// extends ReflectionObject -var ReflectionObject = require("./object"); -((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf"; - -var Field = require("./field"), - util = require("./util"); - -/** - * Constructs a new oneof instance. - * @classdesc Reflected oneof. - * @extends ReflectionObject - * @constructor - * @param {string} name Oneof name - * @param {string[]|Object.} [fieldNames] Field names - * @param {Object.} [options] Declared options - * @param {string} [comment] Comment associated with this field - */ -function OneOf(name, fieldNames, options, comment) { - if (!Array.isArray(fieldNames)) { - options = fieldNames; - fieldNames = undefined; - } - ReflectionObject.call(this, name, options); - - /* istanbul ignore if */ - if (!(fieldNames === undefined || Array.isArray(fieldNames))) - throw TypeError("fieldNames must be an Array"); - - /** - * Field names that belong to this oneof. - * @type {string[]} - */ - this.oneof = fieldNames || []; // toJSON, marker - - /** - * Fields that belong to this oneof as an array for iteration. - * @type {Field[]} - * @readonly - */ - this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent - - /** - * Comment for this field. - * @type {string|null} - */ - this.comment = comment; -} - -/** - * Oneof descriptor. - * @interface IOneOf - * @property {Array.} oneof Oneof field names - * @property {Object.} [options] Oneof options - */ - -/** - * Constructs a oneof from a oneof descriptor. - * @param {string} name Oneof name - * @param {IOneOf} json Oneof descriptor - * @returns {OneOf} Created oneof - * @throws {TypeError} If arguments are invalid - */ -OneOf.fromJSON = function fromJSON(name, json) { - return new OneOf(name, json.oneof, json.options, json.comment); -}; - -/** - * Converts this oneof to a oneof descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IOneOf} Oneof descriptor - */ -OneOf.prototype.toJSON = function toJSON(toJSONOptions) { - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , this.options, - "oneof" , this.oneof, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Adds the fields of the specified oneof to the parent if not already done so. - * @param {OneOf} oneof The oneof - * @returns {undefined} - * @inner - * @ignore - */ -function addFieldsToParent(oneof) { - if (oneof.parent) - for (var i = 0; i < oneof.fieldsArray.length; ++i) - if (!oneof.fieldsArray[i].parent) - oneof.parent.add(oneof.fieldsArray[i]); -} - -/** - * Adds a field to this oneof and removes it from its current parent, if any. - * @param {Field} field Field to add - * @returns {OneOf} `this` - */ -OneOf.prototype.add = function add(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - if (field.parent && field.parent !== this.parent) - field.parent.remove(field); - this.oneof.push(field.name); - this.fieldsArray.push(field); - field.partOf = this; // field.parent remains null - addFieldsToParent(this); - return this; -}; - -/** - * Removes a field from this oneof and puts it back to the oneof's parent. - * @param {Field} field Field to remove - * @returns {OneOf} `this` - */ -OneOf.prototype.remove = function remove(field) { - - /* istanbul ignore if */ - if (!(field instanceof Field)) - throw TypeError("field must be a Field"); - - var index = this.fieldsArray.indexOf(field); - - /* istanbul ignore if */ - if (index < 0) - throw Error(field + " is not a member of " + this); - - this.fieldsArray.splice(index, 1); - index = this.oneof.indexOf(field.name); - - /* istanbul ignore else */ - if (index > -1) // theoretical - this.oneof.splice(index, 1); - - field.partOf = null; - return this; -}; - -/** - * @override - */ -OneOf.prototype.onAdd = function onAdd(parent) { - ReflectionObject.prototype.onAdd.call(this, parent); - var self = this; - // Collect present fields - for (var i = 0; i < this.oneof.length; ++i) { - var field = parent.get(this.oneof[i]); - if (field && !field.partOf) { - field.partOf = self; - self.fieldsArray.push(field); - } - } - // Add not yet present fields - addFieldsToParent(this); -}; - -/** - * @override - */ -OneOf.prototype.onRemove = function onRemove(parent) { - for (var i = 0, field; i < this.fieldsArray.length; ++i) - if ((field = this.fieldsArray[i]).parent) - field.parent.remove(field); - ReflectionObject.prototype.onRemove.call(this, parent); -}; - -/** - * Decorator function as returned by {@link OneOf.d} (TypeScript). - * @typedef OneOfDecorator - * @type {function} - * @param {Object} prototype Target prototype - * @param {string} oneofName OneOf name - * @returns {undefined} - */ - -/** - * OneOf decorator (TypeScript). - * @function - * @param {...string} fieldNames Field names - * @returns {OneOfDecorator} Decorator function - * @template T extends string - */ -OneOf.d = function decorateOneOf() { - var fieldNames = new Array(arguments.length), - index = 0; - while (index < arguments.length) - fieldNames[index] = arguments[index++]; - return function oneOfDecorator(prototype, oneofName) { - util.decorateType(prototype.constructor) - .add(new OneOf(oneofName, fieldNames)); - Object.defineProperty(prototype, oneofName, { - get: util.oneOfGetter(fieldNames), - set: util.oneOfSetter(fieldNames) - }); - }; -}; diff --git a/node_modules/protobufjs/src/parse.js b/node_modules/protobufjs/src/parse.js deleted file mode 100644 index 918d7c2e..00000000 --- a/node_modules/protobufjs/src/parse.js +++ /dev/null @@ -1,787 +0,0 @@ -"use strict"; -module.exports = parse; - -parse.filename = null; -parse.defaults = { keepCase: false }; - -var tokenize = require("./tokenize"), - Root = require("./root"), - Type = require("./type"), - Field = require("./field"), - MapField = require("./mapfield"), - OneOf = require("./oneof"), - Enum = require("./enum"), - Service = require("./service"), - Method = require("./method"), - types = require("./types"), - util = require("./util"); - -var base10Re = /^[1-9][0-9]*$/, - base10NegRe = /^-?[1-9][0-9]*$/, - base16Re = /^0[x][0-9a-fA-F]+$/, - base16NegRe = /^-?0[x][0-9a-fA-F]+$/, - base8Re = /^0[0-7]+$/, - base8NegRe = /^-?0[0-7]+$/, - numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/, - nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/, - typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, - fqTypeRefRe = /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/; - -/** - * Result object returned from {@link parse}. - * @interface IParserResult - * @property {string|undefined} package Package name, if declared - * @property {string[]|undefined} imports Imports, if any - * @property {string[]|undefined} weakImports Weak imports, if any - * @property {string|undefined} syntax Syntax, if specified (either `"proto2"` or `"proto3"`) - * @property {Root} root Populated root instance - */ - -/** - * Options modifying the behavior of {@link parse}. - * @interface IParseOptions - * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case - * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments. - * @property {boolean} [preferTrailingComment=false] Use trailing comment when both leading comment and trailing comment exist. - */ - -/** - * Options modifying the behavior of JSON serialization. - * @interface IToJSONOptions - * @property {boolean} [keepComments=false] Serializes comments. - */ - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @param {string} source Source contents - * @param {Root} root Root to populate - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {IParserResult} Parser result - * @property {string} filename=null Currently processing file name for error reporting, if known - * @property {IParseOptions} defaults Default {@link IParseOptions} - */ -function parse(source, root, options) { - /* eslint-disable callback-return */ - if (!(root instanceof Root)) { - options = root; - root = new Root(); - } - if (!options) - options = parse.defaults; - - var preferTrailingComment = options.preferTrailingComment || false; - var tn = tokenize(source, options.alternateCommentMode || false), - next = tn.next, - push = tn.push, - peek = tn.peek, - skip = tn.skip, - cmnt = tn.cmnt; - - var head = true, - pkg, - imports, - weakImports, - syntax, - isProto3 = false; - - var ptr = root; - - var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase; - - /* istanbul ignore next */ - function illegal(token, name, insideTryCatch) { - var filename = parse.filename; - if (!insideTryCatch) - parse.filename = null; - return Error("illegal " + (name || "token") + " '" + token + "' (" + (filename ? filename + ", " : "") + "line " + tn.line + ")"); - } - - function readString() { - var values = [], - token; - do { - /* istanbul ignore if */ - if ((token = next()) !== "\"" && token !== "'") - throw illegal(token); - - values.push(next()); - skip(token); - token = peek(); - } while (token === "\"" || token === "'"); - return values.join(""); - } - - function readValue(acceptTypeRef) { - var token = next(); - switch (token) { - case "'": - case "\"": - push(token); - return readString(); - case "true": case "TRUE": - return true; - case "false": case "FALSE": - return false; - } - try { - return parseNumber(token, /* insideTryCatch */ true); - } catch (e) { - - /* istanbul ignore else */ - if (acceptTypeRef && typeRefRe.test(token)) - return token; - - /* istanbul ignore next */ - throw illegal(token, "value"); - } - } - - function readRanges(target, acceptStrings) { - var token, start; - do { - if (acceptStrings && ((token = peek()) === "\"" || token === "'")) - target.push(readString()); - else - target.push([ start = parseId(next()), skip("to", true) ? parseId(next()) : start ]); - } while (skip(",", true)); - skip(";"); - } - - function parseNumber(token, insideTryCatch) { - var sign = 1; - if (token.charAt(0) === "-") { - sign = -1; - token = token.substring(1); - } - switch (token) { - case "inf": case "INF": case "Inf": - return sign * Infinity; - case "nan": case "NAN": case "Nan": case "NaN": - return NaN; - case "0": - return 0; - } - if (base10Re.test(token)) - return sign * parseInt(token, 10); - if (base16Re.test(token)) - return sign * parseInt(token, 16); - if (base8Re.test(token)) - return sign * parseInt(token, 8); - - /* istanbul ignore else */ - if (numberRe.test(token)) - return sign * parseFloat(token); - - /* istanbul ignore next */ - throw illegal(token, "number", insideTryCatch); - } - - function parseId(token, acceptNegative) { - switch (token) { - case "max": case "MAX": case "Max": - return 536870911; - case "0": - return 0; - } - - /* istanbul ignore if */ - if (!acceptNegative && token.charAt(0) === "-") - throw illegal(token, "id"); - - if (base10NegRe.test(token)) - return parseInt(token, 10); - if (base16NegRe.test(token)) - return parseInt(token, 16); - - /* istanbul ignore else */ - if (base8NegRe.test(token)) - return parseInt(token, 8); - - /* istanbul ignore next */ - throw illegal(token, "id"); - } - - function parsePackage() { - - /* istanbul ignore if */ - if (pkg !== undefined) - throw illegal("package"); - - pkg = next(); - - /* istanbul ignore if */ - if (!typeRefRe.test(pkg)) - throw illegal(pkg, "name"); - - ptr = ptr.define(pkg); - skip(";"); - } - - function parseImport() { - var token = peek(); - var whichImports; - switch (token) { - case "weak": - whichImports = weakImports || (weakImports = []); - next(); - break; - case "public": - next(); - // eslint-disable-line no-fallthrough - default: - whichImports = imports || (imports = []); - break; - } - token = readString(); - skip(";"); - whichImports.push(token); - } - - function parseSyntax() { - skip("="); - syntax = readString(); - isProto3 = syntax === "proto3"; - - /* istanbul ignore if */ - if (!isProto3 && syntax !== "proto2") - throw illegal(syntax, "syntax"); - - skip(";"); - } - - function parseCommon(parent, token) { - switch (token) { - - case "option": - parseOption(parent, token); - skip(";"); - return true; - - case "message": - parseType(parent, token); - return true; - - case "enum": - parseEnum(parent, token); - return true; - - case "service": - parseService(parent, token); - return true; - - case "extend": - parseExtension(parent, token); - return true; - } - return false; - } - - function ifBlock(obj, fnIf, fnElse) { - var trailingLine = tn.line; - if (obj) { - if(typeof obj.comment !== "string") { - obj.comment = cmnt(); // try block-type comment - } - obj.filename = parse.filename; - } - if (skip("{", true)) { - var token; - while ((token = next()) !== "}") - fnIf(token); - skip(";", true); - } else { - if (fnElse) - fnElse(); - skip(";"); - if (obj && (typeof obj.comment !== "string" || preferTrailingComment)) - obj.comment = cmnt(trailingLine) || obj.comment; // try line-type comment - } - } - - function parseType(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "type name"); - - var type = new Type(token); - ifBlock(type, function parseType_block(token) { - if (parseCommon(type, token)) - return; - - switch (token) { - - case "map": - parseMapField(type, token); - break; - - case "required": - case "optional": - case "repeated": - parseField(type, token); - break; - - case "oneof": - parseOneOf(type, token); - break; - - case "extensions": - readRanges(type.extensions || (type.extensions = [])); - break; - - case "reserved": - readRanges(type.reserved || (type.reserved = []), true); - break; - - default: - /* istanbul ignore if */ - if (!isProto3 || !typeRefRe.test(token)) - throw illegal(token); - - push(token); - parseField(type, "optional"); - break; - } - }); - parent.add(type); - } - - function parseField(parent, rule, extend) { - var type = next(); - if (type === "group") { - parseGroup(parent, rule); - return; - } - - /* istanbul ignore if */ - if (!typeRefRe.test(type)) - throw illegal(type, "type"); - - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - name = applyCase(name); - skip("="); - - var field = new Field(name, parseId(next()), type, rule, extend); - ifBlock(field, function parseField_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(field, token); - skip(";"); - } else - throw illegal(token); - - }, function parseField_line() { - parseInlineOptions(field); - }); - parent.add(field); - - // JSON defaults to packed=true if not set so we have to set packed=false explicity when - // parsing proto2 descriptors without the option, where applicable. This must be done for - // all known packable types and anything that could be an enum (= is not a basic type). - if (!isProto3 && field.repeated && (types.packed[type] !== undefined || types.basic[type] === undefined)) - field.setOption("packed", false, /* ifNotSet */ true); - } - - function parseGroup(parent, rule) { - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - var fieldName = util.lcFirst(name); - if (name === fieldName) - name = util.ucFirst(name); - skip("="); - var id = parseId(next()); - var type = new Type(name); - type.group = true; - var field = new Field(fieldName, id, name, rule); - field.filename = parse.filename; - ifBlock(type, function parseGroup_block(token) { - switch (token) { - - case "option": - parseOption(type, token); - skip(";"); - break; - - case "required": - case "optional": - case "repeated": - parseField(type, token); - break; - - /* istanbul ignore next */ - default: - throw illegal(token); // there are no groups with proto3 semantics - } - }); - parent.add(type) - .add(field); - } - - function parseMapField(parent) { - skip("<"); - var keyType = next(); - - /* istanbul ignore if */ - if (types.mapKey[keyType] === undefined) - throw illegal(keyType, "type"); - - skip(","); - var valueType = next(); - - /* istanbul ignore if */ - if (!typeRefRe.test(valueType)) - throw illegal(valueType, "type"); - - skip(">"); - var name = next(); - - /* istanbul ignore if */ - if (!nameRe.test(name)) - throw illegal(name, "name"); - - skip("="); - var field = new MapField(applyCase(name), parseId(next()), keyType, valueType); - ifBlock(field, function parseMapField_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(field, token); - skip(";"); - } else - throw illegal(token); - - }, function parseMapField_line() { - parseInlineOptions(field); - }); - parent.add(field); - } - - function parseOneOf(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var oneof = new OneOf(applyCase(token)); - ifBlock(oneof, function parseOneOf_block(token) { - if (token === "option") { - parseOption(oneof, token); - skip(";"); - } else { - push(token); - parseField(oneof, "optional"); - } - }); - parent.add(oneof); - } - - function parseEnum(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var enm = new Enum(token); - ifBlock(enm, function parseEnum_block(token) { - switch(token) { - case "option": - parseOption(enm, token); - skip(";"); - break; - - case "reserved": - readRanges(enm.reserved || (enm.reserved = []), true); - break; - - default: - parseEnumValue(enm, token); - } - }); - parent.add(enm); - } - - function parseEnumValue(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token)) - throw illegal(token, "name"); - - skip("="); - var value = parseId(next(), true), - dummy = {}; - ifBlock(dummy, function parseEnumValue_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(dummy, token); // skip - skip(";"); - } else - throw illegal(token); - - }, function parseEnumValue_line() { - parseInlineOptions(dummy); // skip - }); - parent.add(token, value, dummy.comment); - } - - function parseOption(parent, token) { - var isCustom = skip("(", true); - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token, "name"); - - var name = token; - var option = name; - var propName; - - if (isCustom) { - skip(")"); - name = "(" + name + ")"; - option = name; - token = peek(); - if (fqTypeRefRe.test(token)) { - propName = token.substr(1); //remove '.' before property name - name += token; - next(); - } - } - skip("="); - var optionValue = parseOptionValue(parent, name); - setParsedOption(parent, option, optionValue, propName); - } - - function parseOptionValue(parent, name) { - if (skip("{", true)) { // { a: "foo" b { c: "bar" } } - var result = {}; - while (!skip("}", true)) { - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var value; - var propName = token; - if (peek() === "{") - value = parseOptionValue(parent, name + "." + token); - else { - skip(":"); - if (peek() === "{") - value = parseOptionValue(parent, name + "." + token); - else { - value = readValue(true); - setOption(parent, name + "." + token, value); - } - } - var prevValue = result[propName]; - if (prevValue) - value = [].concat(prevValue).concat(value); - result[propName] = value; - skip(",", true); - } - return result; - } - - var simpleValue = readValue(true); - setOption(parent, name, simpleValue); - return simpleValue; - // Does not enforce a delimiter to be universal - } - - function setOption(parent, name, value) { - if (parent.setOption) - parent.setOption(name, value); - } - - function setParsedOption(parent, name, value, propName) { - if (parent.setParsedOption) - parent.setParsedOption(name, value, propName); - } - - function parseInlineOptions(parent) { - if (skip("[", true)) { - do { - parseOption(parent, "option"); - } while (skip(",", true)); - skip("]"); - } - return parent; - } - - function parseService(parent, token) { - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "service name"); - - var service = new Service(token); - ifBlock(service, function parseService_block(token) { - if (parseCommon(service, token)) - return; - - /* istanbul ignore else */ - if (token === "rpc") - parseMethod(service, token); - else - throw illegal(token); - }); - parent.add(service); - } - - function parseMethod(parent, token) { - // Get the comment of the preceding line now (if one exists) in case the - // method is defined across multiple lines. - var commentText = cmnt(); - - var type = token; - - /* istanbul ignore if */ - if (!nameRe.test(token = next())) - throw illegal(token, "name"); - - var name = token, - requestType, requestStream, - responseType, responseStream; - - skip("("); - if (skip("stream", true)) - requestStream = true; - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token); - - requestType = token; - skip(")"); skip("returns"); skip("("); - if (skip("stream", true)) - responseStream = true; - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token); - - responseType = token; - skip(")"); - - var method = new Method(name, type, requestType, responseType, requestStream, responseStream); - method.comment = commentText; - ifBlock(method, function parseMethod_block(token) { - - /* istanbul ignore else */ - if (token === "option") { - parseOption(method, token); - skip(";"); - } else - throw illegal(token); - - }); - parent.add(method); - } - - function parseExtension(parent, token) { - - /* istanbul ignore if */ - if (!typeRefRe.test(token = next())) - throw illegal(token, "reference"); - - var reference = token; - ifBlock(null, function parseExtension_block(token) { - switch (token) { - - case "required": - case "repeated": - case "optional": - parseField(parent, token, reference); - break; - - default: - /* istanbul ignore if */ - if (!isProto3 || !typeRefRe.test(token)) - throw illegal(token); - push(token); - parseField(parent, "optional", reference); - break; - } - }); - } - - var token; - while ((token = next()) !== null) { - switch (token) { - - case "package": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parsePackage(); - break; - - case "import": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parseImport(); - break; - - case "syntax": - - /* istanbul ignore if */ - if (!head) - throw illegal(token); - - parseSyntax(); - break; - - case "option": - - parseOption(ptr, token); - skip(";"); - break; - - default: - - /* istanbul ignore else */ - if (parseCommon(ptr, token)) { - head = false; - continue; - } - - /* istanbul ignore next */ - throw illegal(token); - } - } - - parse.filename = null; - return { - "package" : pkg, - "imports" : imports, - weakImports : weakImports, - syntax : syntax, - root : root - }; -} - -/** - * Parses the given .proto source and returns an object with the parsed contents. - * @name parse - * @function - * @param {string} source Source contents - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {IParserResult} Parser result - * @property {string} filename=null Currently processing file name for error reporting, if known - * @property {IParseOptions} defaults Default {@link IParseOptions} - * @variation 2 - */ diff --git a/node_modules/protobufjs/src/reader.js b/node_modules/protobufjs/src/reader.js deleted file mode 100644 index 1b6ae13f..00000000 --- a/node_modules/protobufjs/src/reader.js +++ /dev/null @@ -1,411 +0,0 @@ -"use strict"; -module.exports = Reader; - -var util = require("./util/minimal"); - -var BufferReader; // cyclic - -var LongBits = util.LongBits, - utf8 = util.utf8; - -/* istanbul ignore next */ -function indexOutOfRange(reader, writeLength) { - return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); -} - -/** - * Constructs a new reader instance using the specified buffer. - * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. - * @constructor - * @param {Uint8Array} buffer Buffer to read from - */ -function Reader(buffer) { - - /** - * Read buffer. - * @type {Uint8Array} - */ - this.buf = buffer; - - /** - * Read buffer position. - * @type {number} - */ - this.pos = 0; - - /** - * Read buffer length. - * @type {number} - */ - this.len = buffer.length; -} - -var create_array = typeof Uint8Array !== "undefined" - ? function create_typed_array(buffer) { - if (buffer instanceof Uint8Array || Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - } - /* istanbul ignore next */ - : function create_array(buffer) { - if (Array.isArray(buffer)) - return new Reader(buffer); - throw Error("illegal buffer"); - }; - -var create = function create() { - return util.Buffer - ? function create_buffer_setup(buffer) { - return (Reader.create = function create_buffer(buffer) { - return util.Buffer.isBuffer(buffer) - ? new BufferReader(buffer) - /* istanbul ignore next */ - : create_array(buffer); - })(buffer); - } - /* istanbul ignore next */ - : create_array; -}; - -/** - * Creates a new reader using the specified buffer. - * @function - * @param {Uint8Array|Buffer} buffer Buffer to read from - * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} - * @throws {Error} If `buffer` is not a valid buffer - */ -Reader.create = create(); - -Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; - -/** - * Reads a varint as an unsigned 32 bit value. - * @function - * @returns {number} Value read - */ -Reader.prototype.uint32 = (function read_uint32_setup() { - var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) - return function read_uint32() { - value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; - value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; - - /* istanbul ignore if */ - if ((this.pos += 5) > this.len) { - this.pos = this.len; - throw indexOutOfRange(this, 10); - } - return value; - }; -})(); - -/** - * Reads a varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.int32 = function read_int32() { - return this.uint32() | 0; -}; - -/** - * Reads a zig-zag encoded varint as a signed 32 bit value. - * @returns {number} Value read - */ -Reader.prototype.sint32 = function read_sint32() { - var value = this.uint32(); - return value >>> 1 ^ -(value & 1) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readLongVarint() { - // tends to deopt with local vars for octet etc. - var bits = new LongBits(0, 0); - var i = 0; - if (this.len - this.pos > 4) { // fast route (lo) - for (; i < 4; ++i) { - // 1st..4th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 5th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; - bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - i = 0; - } else { - for (; i < 3; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 1st..3th - bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - // 4th - bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; - return bits; - } - if (this.len - this.pos > 4) { // fast route (hi) - for (; i < 5; ++i) { - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } else { - for (; i < 5; ++i) { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - // 6th..10th - bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; - if (this.buf[this.pos++] < 128) - return bits; - } - } - /* istanbul ignore next */ - throw Error("invalid varint encoding"); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads a varint as a signed 64 bit value. - * @name Reader#int64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as an unsigned 64 bit value. - * @name Reader#uint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a zig-zag encoded varint as a signed 64 bit value. - * @name Reader#sint64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a varint as a boolean. - * @returns {boolean} Value read - */ -Reader.prototype.bool = function read_bool() { - return this.uint32() !== 0; -}; - -function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` - return (buf[end - 4] - | buf[end - 3] << 8 - | buf[end - 2] << 16 - | buf[end - 1] << 24) >>> 0; -} - -/** - * Reads fixed 32 bits as an unsigned 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.fixed32 = function read_fixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4); -}; - -/** - * Reads fixed 32 bits as a signed 32 bit integer. - * @returns {number} Value read - */ -Reader.prototype.sfixed32 = function read_sfixed32() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - return readFixed32_end(this.buf, this.pos += 4) | 0; -}; - -/* eslint-disable no-invalid-this */ - -function readFixed64(/* this: Reader */) { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 8); - - return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); -} - -/* eslint-enable no-invalid-this */ - -/** - * Reads fixed 64 bits. - * @name Reader#fixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads zig-zag encoded fixed 64 bits. - * @name Reader#sfixed64 - * @function - * @returns {Long} Value read - */ - -/** - * Reads a float (32 bit) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.float = function read_float() { - - /* istanbul ignore if */ - if (this.pos + 4 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readFloatLE(this.buf, this.pos); - this.pos += 4; - return value; -}; - -/** - * Reads a double (64 bit float) as a number. - * @function - * @returns {number} Value read - */ -Reader.prototype.double = function read_double() { - - /* istanbul ignore if */ - if (this.pos + 8 > this.len) - throw indexOutOfRange(this, 4); - - var value = util.float.readDoubleLE(this.buf, this.pos); - this.pos += 8; - return value; -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns {Uint8Array} Value read - */ -Reader.prototype.bytes = function read_bytes() { - var length = this.uint32(), - start = this.pos, - end = this.pos + length; - - /* istanbul ignore if */ - if (end > this.len) - throw indexOutOfRange(this, length); - - this.pos += length; - if (Array.isArray(this.buf)) // plain array - return this.buf.slice(start, end); - return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1 - ? new this.buf.constructor(0) - : this._slice.call(this.buf, start, end); -}; - -/** - * Reads a string preceeded by its byte length as a varint. - * @returns {string} Value read - */ -Reader.prototype.string = function read_string() { - var bytes = this.bytes(); - return utf8.read(bytes, 0, bytes.length); -}; - -/** - * Skips the specified number of bytes if specified, otherwise skips a varint. - * @param {number} [length] Length if known, otherwise a varint is assumed - * @returns {Reader} `this` - */ -Reader.prototype.skip = function skip(length) { - if (typeof length === "number") { - /* istanbul ignore if */ - if (this.pos + length > this.len) - throw indexOutOfRange(this, length); - this.pos += length; - } else { - do { - /* istanbul ignore if */ - if (this.pos >= this.len) - throw indexOutOfRange(this); - } while (this.buf[this.pos++] & 128); - } - return this; -}; - -/** - * Skips the next element of the specified wire type. - * @param {number} wireType Wire type received - * @returns {Reader} `this` - */ -Reader.prototype.skipType = function(wireType) { - switch (wireType) { - case 0: - this.skip(); - break; - case 1: - this.skip(8); - break; - case 2: - this.skip(this.uint32()); - break; - case 3: - while ((wireType = this.uint32() & 7) !== 4) { - this.skipType(wireType); - } - break; - case 5: - this.skip(4); - break; - - /* istanbul ignore next */ - default: - throw Error("invalid wire type " + wireType + " at offset " + this.pos); - } - return this; -}; - -Reader._configure = function(BufferReader_) { - BufferReader = BufferReader_; - Reader.create = create(); - BufferReader._configure(); - - var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; - util.merge(Reader.prototype, { - - int64: function read_int64() { - return readLongVarint.call(this)[fn](false); - }, - - uint64: function read_uint64() { - return readLongVarint.call(this)[fn](true); - }, - - sint64: function read_sint64() { - return readLongVarint.call(this).zzDecode()[fn](false); - }, - - fixed64: function read_fixed64() { - return readFixed64.call(this)[fn](true); - }, - - sfixed64: function read_sfixed64() { - return readFixed64.call(this)[fn](false); - } - - }); -}; diff --git a/node_modules/protobufjs/src/reader_buffer.js b/node_modules/protobufjs/src/reader_buffer.js deleted file mode 100644 index e5474241..00000000 --- a/node_modules/protobufjs/src/reader_buffer.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -module.exports = BufferReader; - -// extends Reader -var Reader = require("./reader"); -(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; - -var util = require("./util/minimal"); - -/** - * Constructs a new buffer reader instance. - * @classdesc Wire format reader using node buffers. - * @extends Reader - * @constructor - * @param {Buffer} buffer Buffer to read from - */ -function BufferReader(buffer) { - Reader.call(this, buffer); - - /** - * Read buffer. - * @name BufferReader#buf - * @type {Buffer} - */ -} - -BufferReader._configure = function () { - /* istanbul ignore else */ - if (util.Buffer) - BufferReader.prototype._slice = util.Buffer.prototype.slice; -}; - - -/** - * @override - */ -BufferReader.prototype.string = function read_string_buffer() { - var len = this.uint32(); // modifies pos - return this.buf.utf8Slice - ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) - : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); -}; - -/** - * Reads a sequence of bytes preceeded by its length as a varint. - * @name BufferReader#bytes - * @function - * @returns {Buffer} Value read - */ - -BufferReader._configure(); diff --git a/node_modules/protobufjs/src/root.js b/node_modules/protobufjs/src/root.js deleted file mode 100644 index df6f11fa..00000000 --- a/node_modules/protobufjs/src/root.js +++ /dev/null @@ -1,363 +0,0 @@ -"use strict"; -module.exports = Root; - -// extends Namespace -var Namespace = require("./namespace"); -((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = "Root"; - -var Field = require("./field"), - Enum = require("./enum"), - OneOf = require("./oneof"), - util = require("./util"); - -var Type, // cyclic - parse, // might be excluded - common; // " - -/** - * Constructs a new root namespace instance. - * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. - * @extends NamespaceBase - * @constructor - * @param {Object.} [options] Top level options - */ -function Root(options) { - Namespace.call(this, "", options); - - /** - * Deferred extension fields. - * @type {Field[]} - */ - this.deferred = []; - - /** - * Resolved file names of loaded files. - * @type {string[]} - */ - this.files = []; -} - -/** - * Loads a namespace descriptor into a root namespace. - * @param {INamespace} json Nameespace descriptor - * @param {Root} [root] Root namespace, defaults to create a new one if omitted - * @returns {Root} Root namespace - */ -Root.fromJSON = function fromJSON(json, root) { - if (!root) - root = new Root(); - if (json.options) - root.setOptions(json.options); - return root.addJSON(json.nested); -}; - -/** - * Resolves the path of an imported file, relative to the importing origin. - * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. - * @function - * @param {string} origin The file name of the importing file - * @param {string} target The file name being imported - * @returns {string|null} Resolved path to `target` or `null` to skip the file - */ -Root.prototype.resolvePath = util.path.resolve; - -/** - * Fetch content from file path or url - * This method exists so you can override it with your own logic. - * @function - * @param {string} path File path or url - * @param {FetchCallback} callback Callback function - * @returns {undefined} - */ -Root.prototype.fetch = util.fetch; - -// A symbol-like function to safely signal synchronous loading -/* istanbul ignore next */ -function SYNC() {} // eslint-disable-line no-empty-function - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} options Parse options - * @param {LoadCallback} callback Callback function - * @returns {undefined} - */ -Root.prototype.load = function load(filename, options, callback) { - if (typeof options === "function") { - callback = options; - options = undefined; - } - var self = this; - if (!callback) - return util.asPromise(load, self, filename, options); - - var sync = callback === SYNC; // undocumented - - // Finishes loading by calling the callback (exactly once) - function finish(err, root) { - /* istanbul ignore if */ - if (!callback) - return; - var cb = callback; - callback = null; - if (sync) - throw err; - cb(err, root); - } - - // Bundled definition existence checking - function getBundledFileName(filename) { - var idx = filename.lastIndexOf("google/protobuf/"); - if (idx > -1) { - var altname = filename.substring(idx); - if (altname in common) return altname; - } - return null; - } - - // Processes a single file - function process(filename, source) { - try { - if (util.isString(source) && source.charAt(0) === "{") - source = JSON.parse(source); - if (!util.isString(source)) - self.setOptions(source.options).addJSON(source.nested); - else { - parse.filename = filename; - var parsed = parse(source, self, options), - resolved, - i = 0; - if (parsed.imports) - for (; i < parsed.imports.length; ++i) - if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i])) - fetch(resolved); - if (parsed.weakImports) - for (i = 0; i < parsed.weakImports.length; ++i) - if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i])) - fetch(resolved, true); - } - } catch (err) { - finish(err); - } - if (!sync && !queued) - finish(null, self); // only once anyway - } - - // Fetches a single file - function fetch(filename, weak) { - - // Skip if already loaded / attempted - if (self.files.indexOf(filename) > -1) - return; - self.files.push(filename); - - // Shortcut bundled definitions - if (filename in common) { - if (sync) - process(filename, common[filename]); - else { - ++queued; - setTimeout(function() { - --queued; - process(filename, common[filename]); - }); - } - return; - } - - // Otherwise fetch from disk or network - if (sync) { - var source; - try { - source = util.fs.readFileSync(filename).toString("utf8"); - } catch (err) { - if (!weak) - finish(err); - return; - } - process(filename, source); - } else { - ++queued; - self.fetch(filename, function(err, source) { - --queued; - /* istanbul ignore if */ - if (!callback) - return; // terminated meanwhile - if (err) { - /* istanbul ignore else */ - if (!weak) - finish(err); - else if (!queued) // can't be covered reliably - finish(null, self); - return; - } - process(filename, source); - }); - } - } - var queued = 0; - - // Assembling the root namespace doesn't require working type - // references anymore, so we can load everything in parallel - if (util.isString(filename)) - filename = [ filename ]; - for (var i = 0, resolved; i < filename.length; ++i) - if (resolved = self.resolvePath("", filename[i])) - fetch(resolved); - - if (sync) - return self; - if (!queued) - finish(null, self); - return undefined; -}; -// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @variation 2 - */ -// function load(filename:string, callback:LoadCallback):undefined - -/** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. - * @function Root#load - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Promise} Promise - * @variation 3 - */ -// function load(filename:string, [options:IParseOptions]):Promise - -/** - * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only). - * @function Root#loadSync - * @param {string|string[]} filename Names of one or multiple files to load - * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - */ -Root.prototype.loadSync = function loadSync(filename, options) { - if (!util.isNode) - throw Error("not supported"); - return this.load(filename, options, SYNC); -}; - -/** - * @override - */ -Root.prototype.resolveAll = function resolveAll() { - if (this.deferred.length) - throw Error("unresolvable extensions: " + this.deferred.map(function(field) { - return "'extend " + field.extend + "' in " + field.parent.fullName; - }).join(", ")); - return Namespace.prototype.resolveAll.call(this); -}; - -// only uppercased (and thus conflict-free) children are exposed, see below -var exposeRe = /^[A-Z]/; - -/** - * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type. - * @param {Root} root Root instance - * @param {Field} field Declaring extension field witin the declaring type - * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise - * @inner - * @ignore - */ -function tryHandleExtension(root, field) { - var extendedType = field.parent.lookup(field.extend); - if (extendedType) { - var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options); - sisterField.declaringField = field; - field.extensionField = sisterField; - extendedType.add(sisterField); - return true; - } - return false; -} - -/** - * Called when any object is added to this root or its sub-namespaces. - * @param {ReflectionObject} object Object added - * @returns {undefined} - * @private - */ -Root.prototype._handleAdd = function _handleAdd(object) { - if (object instanceof Field) { - - if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField) - if (!tryHandleExtension(this, object)) - this.deferred.push(object); - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - object.parent[object.name] = object.values; // expose enum values as property of its parent - - } else if (!(object instanceof OneOf)) /* everything else is a namespace */ { - - if (object instanceof Type) // Try to handle any deferred extensions - for (var i = 0; i < this.deferred.length;) - if (tryHandleExtension(this, this.deferred[i])) - this.deferred.splice(i, 1); - else - ++i; - for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace - this._handleAdd(object._nestedArray[j]); - if (exposeRe.test(object.name)) - object.parent[object.name] = object; // expose namespace as property of its parent - } - - // The above also adds uppercased (and thus conflict-free) nested types, services and enums as - // properties of namespaces just like static code does. This allows using a .d.ts generated for - // a static module with reflection-based solutions where the condition is met. -}; - -/** - * Called when any object is removed from this root or its sub-namespaces. - * @param {ReflectionObject} object Object removed - * @returns {undefined} - * @private - */ -Root.prototype._handleRemove = function _handleRemove(object) { - if (object instanceof Field) { - - if (/* an extension field */ object.extend !== undefined) { - if (/* already handled */ object.extensionField) { // remove its sister field - object.extensionField.parent.remove(object.extensionField); - object.extensionField = null; - } else { // cancel the extension - var index = this.deferred.indexOf(object); - /* istanbul ignore else */ - if (index > -1) - this.deferred.splice(index, 1); - } - } - - } else if (object instanceof Enum) { - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose enum values - - } else if (object instanceof Namespace) { - - for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace - this._handleRemove(object._nestedArray[i]); - - if (exposeRe.test(object.name)) - delete object.parent[object.name]; // unexpose namespaces - - } -}; - -// Sets up cyclic dependencies (called in index-light) -Root._configure = function(Type_, parse_, common_) { - Type = Type_; - parse = parse_; - common = common_; -}; diff --git a/node_modules/protobufjs/src/roots.js b/node_modules/protobufjs/src/roots.js deleted file mode 100644 index 19212115..00000000 --- a/node_modules/protobufjs/src/roots.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -module.exports = {}; - -/** - * Named roots. - * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). - * Can also be used manually to make roots available accross modules. - * @name roots - * @type {Object.} - * @example - * // pbjs -r myroot -o compiled.js ... - * - * // in another module: - * require("./compiled.js"); - * - * // in any subsequent module: - * var root = protobuf.roots["myroot"]; - */ diff --git a/node_modules/protobufjs/src/rpc.js b/node_modules/protobufjs/src/rpc.js deleted file mode 100644 index 894e5c7c..00000000 --- a/node_modules/protobufjs/src/rpc.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -/** - * Streaming RPC helpers. - * @namespace - */ -var rpc = exports; - -/** - * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. - * @typedef RPCImpl - * @type {function} - * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called - * @param {Uint8Array} requestData Request data - * @param {RPCImplCallback} callback Callback function - * @returns {undefined} - * @example - * function rpcImpl(method, requestData, callback) { - * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code - * throw Error("no such method"); - * asynchronouslyObtainAResponse(requestData, function(err, responseData) { - * callback(err, responseData); - * }); - * } - */ - -/** - * Node-style callback as used by {@link RPCImpl}. - * @typedef RPCImplCallback - * @type {function} - * @param {Error|null} error Error, if any, otherwise `null` - * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error - * @returns {undefined} - */ - -rpc.Service = require("./rpc/service"); diff --git a/node_modules/protobufjs/src/rpc/service.js b/node_modules/protobufjs/src/rpc/service.js deleted file mode 100644 index 757f382e..00000000 --- a/node_modules/protobufjs/src/rpc/service.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; -module.exports = Service; - -var util = require("../util/minimal"); - -// Extends EventEmitter -(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; - -/** - * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. - * - * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. - * @typedef rpc.ServiceMethodCallback - * @template TRes extends Message - * @type {function} - * @param {Error|null} error Error, if any - * @param {TRes} [response] Response message - * @returns {undefined} - */ - -/** - * A service method part of a {@link rpc.Service} as created by {@link Service.create}. - * @typedef rpc.ServiceMethod - * @template TReq extends Message - * @template TRes extends Message - * @type {function} - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message - * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` - */ - -/** - * Constructs a new RPC service instance. - * @classdesc An RPC service as returned by {@link Service#create}. - * @exports rpc.Service - * @extends util.EventEmitter - * @constructor - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ -function Service(rpcImpl, requestDelimited, responseDelimited) { - - if (typeof rpcImpl !== "function") - throw TypeError("rpcImpl must be a function"); - - util.EventEmitter.call(this); - - /** - * RPC implementation. Becomes `null` once the service is ended. - * @type {RPCImpl|null} - */ - this.rpcImpl = rpcImpl; - - /** - * Whether requests are length-delimited. - * @type {boolean} - */ - this.requestDelimited = Boolean(requestDelimited); - - /** - * Whether responses are length-delimited. - * @type {boolean} - */ - this.responseDelimited = Boolean(responseDelimited); -} - -/** - * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. - * @param {Method|rpc.ServiceMethod} method Reflected or static method - * @param {Constructor} requestCtor Request constructor - * @param {Constructor} responseCtor Response constructor - * @param {TReq|Properties} request Request message or plain object - * @param {rpc.ServiceMethodCallback} callback Service callback - * @returns {undefined} - * @template TReq extends Message - * @template TRes extends Message - */ -Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { - - if (!request) - throw TypeError("request must be specified"); - - var self = this; - if (!callback) - return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); - - if (!self.rpcImpl) { - setTimeout(function() { callback(Error("already ended")); }, 0); - return undefined; - } - - try { - return self.rpcImpl( - method, - requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), - function rpcCallback(err, response) { - - if (err) { - self.emit("error", err, method); - return callback(err); - } - - if (response === null) { - self.end(/* endedByRPC */ true); - return undefined; - } - - if (!(response instanceof responseCtor)) { - try { - response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); - } catch (err) { - self.emit("error", err, method); - return callback(err); - } - } - - self.emit("data", response, method); - return callback(null, response); - } - ); - } catch (err) { - self.emit("error", err, method); - setTimeout(function() { callback(err); }, 0); - return undefined; - } -}; - -/** - * Ends this service and emits the `end` event. - * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. - * @returns {rpc.Service} `this` - */ -Service.prototype.end = function end(endedByRPC) { - if (this.rpcImpl) { - if (!endedByRPC) // signal end to rpcImpl - this.rpcImpl(null, null, null); - this.rpcImpl = null; - this.emit("end").off(); - } - return this; -}; diff --git a/node_modules/protobufjs/src/service.js b/node_modules/protobufjs/src/service.js deleted file mode 100644 index bc2c3080..00000000 --- a/node_modules/protobufjs/src/service.js +++ /dev/null @@ -1,167 +0,0 @@ -"use strict"; -module.exports = Service; - -// extends Namespace -var Namespace = require("./namespace"); -((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service"; - -var Method = require("./method"), - util = require("./util"), - rpc = require("./rpc"); - -/** - * Constructs a new service instance. - * @classdesc Reflected service. - * @extends NamespaceBase - * @constructor - * @param {string} name Service name - * @param {Object.} [options] Service options - * @throws {TypeError} If arguments are invalid - */ -function Service(name, options) { - Namespace.call(this, name, options); - - /** - * Service methods. - * @type {Object.} - */ - this.methods = {}; // toJSON, marker - - /** - * Cached methods as an array. - * @type {Method[]|null} - * @private - */ - this._methodsArray = null; -} - -/** - * Service descriptor. - * @interface IService - * @extends INamespace - * @property {Object.} methods Method descriptors - */ - -/** - * Constructs a service from a service descriptor. - * @param {string} name Service name - * @param {IService} json Service descriptor - * @returns {Service} Created service - * @throws {TypeError} If arguments are invalid - */ -Service.fromJSON = function fromJSON(name, json) { - var service = new Service(name, json.options); - /* istanbul ignore else */ - if (json.methods) - for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i) - service.add(Method.fromJSON(names[i], json.methods[names[i]])); - if (json.nested) - service.addJSON(json.nested); - service.comment = json.comment; - return service; -}; - -/** - * Converts this service to a service descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IService} Service descriptor - */ -Service.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "methods" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {}, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * Methods of this service as an array for iteration. - * @name Service#methodsArray - * @type {Method[]} - * @readonly - */ -Object.defineProperty(Service.prototype, "methodsArray", { - get: function() { - return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); - } -}); - -function clearCache(service) { - service._methodsArray = null; - return service; -} - -/** - * @override - */ -Service.prototype.get = function get(name) { - return this.methods[name] - || Namespace.prototype.get.call(this, name); -}; - -/** - * @override - */ -Service.prototype.resolveAll = function resolveAll() { - var methods = this.methodsArray; - for (var i = 0; i < methods.length; ++i) - methods[i].resolve(); - return Namespace.prototype.resolve.call(this); -}; - -/** - * @override - */ -Service.prototype.add = function add(object) { - - /* istanbul ignore if */ - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Method) { - this.methods[object.name] = object; - object.parent = this; - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * @override - */ -Service.prototype.remove = function remove(object) { - if (object instanceof Method) { - - /* istanbul ignore if */ - if (this.methods[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.methods[object.name]; - object.parent = null; - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Creates a runtime service using the specified rpc implementation. - * @param {RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed. - */ -Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) { - var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited); - for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) { - var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, ""); - rpcService[methodName] = util.codegen(["r","c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({ - m: method, - q: method.resolvedRequestType.ctor, - s: method.resolvedResponseType.ctor - }); - } - return rpcService; -}; diff --git a/node_modules/protobufjs/src/tokenize.js b/node_modules/protobufjs/src/tokenize.js deleted file mode 100644 index b55b2927..00000000 --- a/node_modules/protobufjs/src/tokenize.js +++ /dev/null @@ -1,403 +0,0 @@ -"use strict"; -module.exports = tokenize; - -var delimRe = /[\s{}=;:[\],'"()<>]/g, - stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, - stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g; - -var setCommentRe = /^ *[*/]+ */, - setCommentAltRe = /^\s*\*?\/*/, - setCommentSplitRe = /\n/g, - whitespaceRe = /\s/, - unescapeRe = /\\(.?)/g; - -var unescapeMap = { - "0": "\0", - "r": "\r", - "n": "\n", - "t": "\t" -}; - -/** - * Unescapes a string. - * @param {string} str String to unescape - * @returns {string} Unescaped string - * @property {Object.} map Special characters map - * @memberof tokenize - */ -function unescape(str) { - return str.replace(unescapeRe, function($0, $1) { - switch ($1) { - case "\\": - case "": - return $1; - default: - return unescapeMap[$1] || ""; - } - }); -} - -tokenize.unescape = unescape; - -/** - * Gets the next token and advances. - * @typedef TokenizerHandleNext - * @type {function} - * @returns {string|null} Next token or `null` on eof - */ - -/** - * Peeks for the next token. - * @typedef TokenizerHandlePeek - * @type {function} - * @returns {string|null} Next token or `null` on eof - */ - -/** - * Pushes a token back to the stack. - * @typedef TokenizerHandlePush - * @type {function} - * @param {string} token Token - * @returns {undefined} - */ - -/** - * Skips the next token. - * @typedef TokenizerHandleSkip - * @type {function} - * @param {string} expected Expected token - * @param {boolean} [optional=false] If optional - * @returns {boolean} Whether the token matched - * @throws {Error} If the token didn't match and is not optional - */ - -/** - * Gets the comment on the previous line or, alternatively, the line comment on the specified line. - * @typedef TokenizerHandleCmnt - * @type {function} - * @param {number} [line] Line number - * @returns {string|null} Comment text or `null` if none - */ - -/** - * Handle object returned from {@link tokenize}. - * @interface ITokenizerHandle - * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof) - * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof) - * @property {TokenizerHandlePush} push Pushes a token back to the stack - * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws - * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any - * @property {number} line Current line number - */ - -/** - * Tokenizes the given .proto source and returns an object with useful utility functions. - * @param {string} source Source contents - * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode. - * @returns {ITokenizerHandle} Tokenizer handle - */ -function tokenize(source, alternateCommentMode) { - /* eslint-disable callback-return */ - source = source.toString(); - - var offset = 0, - length = source.length, - line = 1, - commentType = null, - commentText = null, - commentLine = 0, - commentLineEmpty = false, - commentIsLeading = false; - - var stack = []; - - var stringDelim = null; - - /* istanbul ignore next */ - /** - * Creates an error for illegal syntax. - * @param {string} subject Subject - * @returns {Error} Error created - * @inner - */ - function illegal(subject) { - return Error("illegal " + subject + " (line " + line + ")"); - } - - /** - * Reads a string till its end. - * @returns {string} String read - * @inner - */ - function readString() { - var re = stringDelim === "'" ? stringSingleRe : stringDoubleRe; - re.lastIndex = offset - 1; - var match = re.exec(source); - if (!match) - throw illegal("string"); - offset = re.lastIndex; - push(stringDelim); - stringDelim = null; - return unescape(match[1]); - } - - /** - * Gets the character at `pos` within the source. - * @param {number} pos Position - * @returns {string} Character - * @inner - */ - function charAt(pos) { - return source.charAt(pos); - } - - /** - * Sets the current comment text. - * @param {number} start Start offset - * @param {number} end End offset - * @param {boolean} isLeading set if a leading comment - * @returns {undefined} - * @inner - */ - function setComment(start, end, isLeading) { - commentType = source.charAt(start++); - commentLine = line; - commentLineEmpty = false; - commentIsLeading = isLeading; - var lookback; - if (alternateCommentMode) { - lookback = 2; // alternate comment parsing: "//" or "/*" - } else { - lookback = 3; // "///" or "/**" - } - var commentOffset = start - lookback, - c; - do { - if (--commentOffset < 0 || - (c = source.charAt(commentOffset)) === "\n") { - commentLineEmpty = true; - break; - } - } while (c === " " || c === "\t"); - var lines = source - .substring(start, end) - .split(setCommentSplitRe); - for (var i = 0; i < lines.length; ++i) - lines[i] = lines[i] - .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, "") - .trim(); - commentText = lines - .join("\n") - .trim(); - } - - function isDoubleSlashCommentLine(startOffset) { - var endOffset = findEndOfLine(startOffset); - - // see if remaining line matches comment pattern - var lineText = source.substring(startOffset, endOffset); - // look for 1 or 2 slashes since startOffset would already point past - // the first slash that started the comment. - var isComment = /^\s*\/{1,2}/.test(lineText); - return isComment; - } - - function findEndOfLine(cursor) { - // find end of cursor's line - var endOffset = cursor; - while (endOffset < length && charAt(endOffset) !== "\n") { - endOffset++; - } - return endOffset; - } - - /** - * Obtains the next token. - * @returns {string|null} Next token or `null` on eof - * @inner - */ - function next() { - if (stack.length > 0) - return stack.shift(); - if (stringDelim) - return readString(); - var repeat, - prev, - curr, - start, - isDoc, - isLeadingComment = offset === 0; - do { - if (offset === length) - return null; - repeat = false; - while (whitespaceRe.test(curr = charAt(offset))) { - if (curr === "\n") { - isLeadingComment = true; - ++line; - } - if (++offset === length) - return null; - } - - if (charAt(offset) === "/") { - if (++offset === length) { - throw illegal("comment"); - } - if (charAt(offset) === "/") { // Line - if (!alternateCommentMode) { - // check for triple-slash comment - isDoc = charAt(start = offset + 1) === "/"; - - while (charAt(++offset) !== "\n") { - if (offset === length) { - return null; - } - } - ++offset; - if (isDoc) { - setComment(start, offset - 1, isLeadingComment); - } - ++line; - repeat = true; - } else { - // check for double-slash comments, consolidating consecutive lines - start = offset; - isDoc = false; - if (isDoubleSlashCommentLine(offset)) { - isDoc = true; - do { - offset = findEndOfLine(offset); - if (offset === length) { - break; - } - offset++; - } while (isDoubleSlashCommentLine(offset)); - } else { - offset = Math.min(length, findEndOfLine(offset) + 1); - } - if (isDoc) { - setComment(start, offset, isLeadingComment); - } - line++; - repeat = true; - } - } else if ((curr = charAt(offset)) === "*") { /* Block */ - // check for /** (regular comment mode) or /* (alternate comment mode) - start = offset + 1; - isDoc = alternateCommentMode || charAt(start) === "*"; - do { - if (curr === "\n") { - ++line; - } - if (++offset === length) { - throw illegal("comment"); - } - prev = curr; - curr = charAt(offset); - } while (prev !== "*" || curr !== "/"); - ++offset; - if (isDoc) { - setComment(start, offset - 2, isLeadingComment); - } - repeat = true; - } else { - return "/"; - } - } - } while (repeat); - - // offset !== length if we got here - - var end = offset; - delimRe.lastIndex = 0; - var delim = delimRe.test(charAt(end++)); - if (!delim) - while (end < length && !delimRe.test(charAt(end))) - ++end; - var token = source.substring(offset, offset = end); - if (token === "\"" || token === "'") - stringDelim = token; - return token; - } - - /** - * Pushes a token back to the stack. - * @param {string} token Token - * @returns {undefined} - * @inner - */ - function push(token) { - stack.push(token); - } - - /** - * Peeks for the next token. - * @returns {string|null} Token or `null` on eof - * @inner - */ - function peek() { - if (!stack.length) { - var token = next(); - if (token === null) - return null; - push(token); - } - return stack[0]; - } - - /** - * Skips a token. - * @param {string} expected Expected token - * @param {boolean} [optional=false] Whether the token is optional - * @returns {boolean} `true` when skipped, `false` if not - * @throws {Error} When a required token is not present - * @inner - */ - function skip(expected, optional) { - var actual = peek(), - equals = actual === expected; - if (equals) { - next(); - return true; - } - if (!optional) - throw illegal("token '" + actual + "', '" + expected + "' expected"); - return false; - } - - /** - * Gets a comment. - * @param {number} [trailingLine] Line number if looking for a trailing comment - * @returns {string|null} Comment text - * @inner - */ - function cmnt(trailingLine) { - var ret = null; - if (trailingLine === undefined) { - if (commentLine === line - 1 && (alternateCommentMode || commentType === "*" || commentLineEmpty)) { - ret = commentIsLeading ? commentText : null; - } - } else { - /* istanbul ignore else */ - if (commentLine < trailingLine) { - peek(); - } - if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === "/")) { - ret = commentIsLeading ? null : commentText; - } - } - return ret; - } - - return Object.defineProperty({ - next: next, - peek: peek, - push: push, - skip: skip, - cmnt: cmnt - }, "line", { - get: function() { return line; } - }); - /* eslint-enable callback-return */ -} diff --git a/node_modules/protobufjs/src/type.js b/node_modules/protobufjs/src/type.js deleted file mode 100644 index 2e7bda49..00000000 --- a/node_modules/protobufjs/src/type.js +++ /dev/null @@ -1,589 +0,0 @@ -"use strict"; -module.exports = Type; - -// extends Namespace -var Namespace = require("./namespace"); -((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = "Type"; - -var Enum = require("./enum"), - OneOf = require("./oneof"), - Field = require("./field"), - MapField = require("./mapfield"), - Service = require("./service"), - Message = require("./message"), - Reader = require("./reader"), - Writer = require("./writer"), - util = require("./util"), - encoder = require("./encoder"), - decoder = require("./decoder"), - verifier = require("./verifier"), - converter = require("./converter"), - wrappers = require("./wrappers"); - -/** - * Constructs a new reflected message type instance. - * @classdesc Reflected message type. - * @extends NamespaceBase - * @constructor - * @param {string} name Message name - * @param {Object.} [options] Declared options - */ -function Type(name, options) { - Namespace.call(this, name, options); - - /** - * Message fields. - * @type {Object.} - */ - this.fields = {}; // toJSON, marker - - /** - * Oneofs declared within this namespace, if any. - * @type {Object.} - */ - this.oneofs = undefined; // toJSON - - /** - * Extension ranges, if any. - * @type {number[][]} - */ - this.extensions = undefined; // toJSON - - /** - * Reserved ranges, if any. - * @type {Array.} - */ - this.reserved = undefined; // toJSON - - /*? - * Whether this type is a legacy group. - * @type {boolean|undefined} - */ - this.group = undefined; // toJSON - - /** - * Cached fields by id. - * @type {Object.|null} - * @private - */ - this._fieldsById = null; - - /** - * Cached fields as an array. - * @type {Field[]|null} - * @private - */ - this._fieldsArray = null; - - /** - * Cached oneofs as an array. - * @type {OneOf[]|null} - * @private - */ - this._oneofsArray = null; - - /** - * Cached constructor. - * @type {Constructor<{}>} - * @private - */ - this._ctor = null; -} - -Object.defineProperties(Type.prototype, { - - /** - * Message fields by id. - * @name Type#fieldsById - * @type {Object.} - * @readonly - */ - fieldsById: { - get: function() { - - /* istanbul ignore if */ - if (this._fieldsById) - return this._fieldsById; - - this._fieldsById = {}; - for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) { - var field = this.fields[names[i]], - id = field.id; - - /* istanbul ignore if */ - if (this._fieldsById[id]) - throw Error("duplicate id " + id + " in " + this); - - this._fieldsById[id] = field; - } - return this._fieldsById; - } - }, - - /** - * Fields of this message as an array for iteration. - * @name Type#fieldsArray - * @type {Field[]} - * @readonly - */ - fieldsArray: { - get: function() { - return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); - } - }, - - /** - * Oneofs of this message as an array for iteration. - * @name Type#oneofsArray - * @type {OneOf[]} - * @readonly - */ - oneofsArray: { - get: function() { - return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); - } - }, - - /** - * The registered constructor, if any registered, otherwise a generic constructor. - * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. - * @name Type#ctor - * @type {Constructor<{}>} - */ - ctor: { - get: function() { - return this._ctor || (this.ctor = Type.generateConstructor(this)()); - }, - set: function(ctor) { - - // Ensure proper prototype - var prototype = ctor.prototype; - if (!(prototype instanceof Message)) { - (ctor.prototype = new Message()).constructor = ctor; - util.merge(ctor.prototype, prototype); - } - - // Classes and messages reference their reflected type - ctor.$type = ctor.prototype.$type = this; - - // Mix in static methods - util.merge(ctor, Message, true); - - this._ctor = ctor; - - // Messages have non-enumerable default values on their prototype - var i = 0; - for (; i < /* initializes */ this.fieldsArray.length; ++i) - this._fieldsArray[i].resolve(); // ensures a proper value - - // Messages have non-enumerable getters and setters for each virtual oneof field - var ctorProperties = {}; - for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i) - ctorProperties[this._oneofsArray[i].resolve().name] = { - get: util.oneOfGetter(this._oneofsArray[i].oneof), - set: util.oneOfSetter(this._oneofsArray[i].oneof) - }; - if (i) - Object.defineProperties(ctor.prototype, ctorProperties); - } - } -}); - -/** - * Generates a constructor function for the specified type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -Type.generateConstructor = function generateConstructor(mtype) { - /* eslint-disable no-unexpected-multiline */ - var gen = util.codegen(["p"], mtype.name); - // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype - for (var i = 0, field; i < mtype.fieldsArray.length; ++i) - if ((field = mtype._fieldsArray[i]).map) gen - ("this%s={}", util.safeProp(field.name)); - else if (field.repeated) gen - ("this%s=[]", util.safeProp(field.name)); - return gen - ("if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors - * @property {Object.} fields Field descriptors - * @property {number[][]} [extensions] Extension ranges - * @property {number[][]} [reserved] Reserved ranges - * @property {boolean} [group=false] Whether a legacy group or not - */ - -/** - * Creates a message type from a message type descriptor. - * @param {string} name Message name - * @param {IType} json Message type descriptor - * @returns {Type} Created message type - */ -Type.fromJSON = function fromJSON(name, json) { - var type = new Type(name, json.options); - type.extensions = json.extensions; - type.reserved = json.reserved; - var names = Object.keys(json.fields), - i = 0; - for (; i < names.length; ++i) - type.add( - ( typeof json.fields[names[i]].keyType !== "undefined" - ? MapField.fromJSON - : Field.fromJSON )(names[i], json.fields[names[i]]) - ); - if (json.oneofs) - for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i) - type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]])); - if (json.nested) - for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) { - var nested = json.nested[names[i]]; - type.add( // most to least likely - ( nested.id !== undefined - ? Field.fromJSON - : nested.fields !== undefined - ? Type.fromJSON - : nested.values !== undefined - ? Enum.fromJSON - : nested.methods !== undefined - ? Service.fromJSON - : Namespace.fromJSON )(names[i], nested) - ); - } - if (json.extensions && json.extensions.length) - type.extensions = json.extensions; - if (json.reserved && json.reserved.length) - type.reserved = json.reserved; - if (json.group) - type.group = true; - if (json.comment) - type.comment = json.comment; - return type; -}; - -/** - * Converts this message type to a message type descriptor. - * @param {IToJSONOptions} [toJSONOptions] JSON conversion options - * @returns {IType} Message type descriptor - */ -Type.prototype.toJSON = function toJSON(toJSONOptions) { - var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); - var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; - return util.toObject([ - "options" , inherited && inherited.options || undefined, - "oneofs" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions), - "fields" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {}, - "extensions" , this.extensions && this.extensions.length ? this.extensions : undefined, - "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, - "group" , this.group || undefined, - "nested" , inherited && inherited.nested || undefined, - "comment" , keepComments ? this.comment : undefined - ]); -}; - -/** - * @override - */ -Type.prototype.resolveAll = function resolveAll() { - var fields = this.fieldsArray, i = 0; - while (i < fields.length) - fields[i++].resolve(); - var oneofs = this.oneofsArray; i = 0; - while (i < oneofs.length) - oneofs[i++].resolve(); - return Namespace.prototype.resolveAll.call(this); -}; - -/** - * @override - */ -Type.prototype.get = function get(name) { - return this.fields[name] - || this.oneofs && this.oneofs[name] - || this.nested && this.nested[name] - || null; -}; - -/** - * Adds a nested object to this type. - * @param {ReflectionObject} object Nested object to add - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id - */ -Type.prototype.add = function add(object) { - - if (this.get(object.name)) - throw Error("duplicate name '" + object.name + "' in " + this); - - if (object instanceof Field && object.extend === undefined) { - // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects. - // The root object takes care of adding distinct sister-fields to the respective extended - // type instead. - - // avoids calling the getter if not absolutely necessary because it's called quite frequently - if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id]) - throw Error("duplicate id " + object.id + " in " + this); - if (this.isReservedId(object.id)) - throw Error("id " + object.id + " is reserved in " + this); - if (this.isReservedName(object.name)) - throw Error("name '" + object.name + "' is reserved in " + this); - - if (object.parent) - object.parent.remove(object); - this.fields[object.name] = object; - object.message = this; - object.onAdd(this); - return clearCache(this); - } - if (object instanceof OneOf) { - if (!this.oneofs) - this.oneofs = {}; - this.oneofs[object.name] = object; - object.onAdd(this); - return clearCache(this); - } - return Namespace.prototype.add.call(this, object); -}; - -/** - * Removes a nested object from this type. - * @param {ReflectionObject} object Nested object to remove - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this type - */ -Type.prototype.remove = function remove(object) { - if (object instanceof Field && object.extend === undefined) { - // See Type#add for the reason why extension fields are excluded here. - - /* istanbul ignore if */ - if (!this.fields || this.fields[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.fields[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - if (object instanceof OneOf) { - - /* istanbul ignore if */ - if (!this.oneofs || this.oneofs[object.name] !== object) - throw Error(object + " is not a member of " + this); - - delete this.oneofs[object.name]; - object.parent = null; - object.onRemove(this); - return clearCache(this); - } - return Namespace.prototype.remove.call(this, object); -}; - -/** - * Tests if the specified id is reserved. - * @param {number} id Id to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedId = function isReservedId(id) { - return Namespace.isReservedId(this.reserved, id); -}; - -/** - * Tests if the specified name is reserved. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -Type.prototype.isReservedName = function isReservedName(name) { - return Namespace.isReservedName(this.reserved, name); -}; - -/** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message<{}>} Message instance - */ -Type.prototype.create = function create(properties) { - return new this.ctor(properties); -}; - -/** - * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. - * @returns {Type} `this` - */ -Type.prototype.setup = function setup() { - // Sets up everything at once so that the prototype chain does not have to be re-evaluated - // multiple times (V8, soft-deopt prototype-check). - - var fullName = this.fullName, - types = []; - for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i) - types.push(this._fieldsArray[i].resolve().resolvedType); - - // Replace setup methods with type-specific generated functions - this.encode = encoder(this)({ - Writer : Writer, - types : types, - util : util - }); - this.decode = decoder(this)({ - Reader : Reader, - types : types, - util : util - }); - this.verify = verifier(this)({ - types : types, - util : util - }); - this.fromObject = converter.fromObject(this)({ - types : types, - util : util - }); - this.toObject = converter.toObject(this)({ - types : types, - util : util - }); - - // Inject custom wrappers for common types - var wrapper = wrappers[fullName]; - if (wrapper) { - var originalThis = Object.create(this); - // if (wrapper.fromObject) { - originalThis.fromObject = this.fromObject; - this.fromObject = wrapper.fromObject.bind(originalThis); - // } - // if (wrapper.toObject) { - originalThis.toObject = this.toObject; - this.toObject = wrapper.toObject.bind(originalThis); - // } - } - - return this; -}; - -/** - * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encode = function encode_setup(message, writer) { - return this.setup().encode(message, writer); // overrides this method -}; - -/** - * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages. - * @param {Message<{}>|Object.} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ -Type.prototype.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); -}; - -/** - * Decodes a message of this type. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Length of the message, if known beforehand - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError<{}>} If required fields are missing - */ -Type.prototype.decode = function decode_setup(reader, length) { - return this.setup().decode(reader, length); // overrides this method -}; - -/** - * Decodes a message of this type preceeded by its byte length as a varint. - * @param {Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {Message<{}>} Decoded message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {util.ProtocolError} If required fields are missing - */ -Type.prototype.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof Reader)) - reader = Reader.create(reader); - return this.decode(reader, reader.uint32()); -}; - -/** - * Verifies that field values are valid and that required fields are present. - * @param {Object.} message Plain object to verify - * @returns {null|string} `null` if valid, otherwise the reason why it is not - */ -Type.prototype.verify = function verify_setup(message) { - return this.setup().verify(message); // overrides this method -}; - -/** - * Creates a new message of this type from a plain object. Also converts values to their respective internal types. - * @param {Object.} object Plain object to convert - * @returns {Message<{}>} Message instance - */ -Type.prototype.fromObject = function fromObject(object) { - return this.setup().fromObject(object); -}; - -/** - * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. - * @interface IConversionOptions - * @property {Function} [longs] Long conversion type. - * Valid values are `String` and `Number` (the global types). - * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library. - * @property {Function} [enums] Enum value conversion type. - * Only valid value is `String` (the global type). - * Defaults to copy the present value, which is the numeric id. - * @property {Function} [bytes] Bytes value conversion type. - * Valid values are `Array` and (a base64 encoded) `String` (the global types). - * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser. - * @property {boolean} [defaults=false] Also sets default values on the resulting object - * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false` - * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false` - * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any - * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings - */ - -/** - * Creates a plain object from a message of this type. Also converts values to other types if specified. - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ -Type.prototype.toObject = function toObject(message, options) { - return this.setup().toObject(message, options); -}; - -/** - * Decorator function as returned by {@link Type.d} (TypeScript). - * @typedef TypeDecorator - * @type {function} - * @param {Constructor} target Target constructor - * @returns {undefined} - * @template T extends Message - */ - -/** - * Type decorator (TypeScript). - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {TypeDecorator} Decorator function - * @template T extends Message - */ -Type.d = function decorateType(typeName) { - return function typeDecorator(target) { - util.decorateType(target, typeName); - }; -}; diff --git a/node_modules/protobufjs/src/types.js b/node_modules/protobufjs/src/types.js deleted file mode 100644 index 5fda19a6..00000000 --- a/node_modules/protobufjs/src/types.js +++ /dev/null @@ -1,196 +0,0 @@ -"use strict"; - -/** - * Common type constants. - * @namespace - */ -var types = exports; - -var util = require("./util"); - -var s = [ - "double", // 0 - "float", // 1 - "int32", // 2 - "uint32", // 3 - "sint32", // 4 - "fixed32", // 5 - "sfixed32", // 6 - "int64", // 7 - "uint64", // 8 - "sint64", // 9 - "fixed64", // 10 - "sfixed64", // 11 - "bool", // 12 - "string", // 13 - "bytes" // 14 -]; - -function bake(values, offset) { - var i = 0, o = {}; - offset |= 0; - while (i < values.length) o[s[i + offset]] = values[i++]; - return o; -} - -/** - * Basic type wire types. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - * @property {number} bytes=2 Ldelim wire type - */ -types.basic = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2, - /* bytes */ 2 -]); - -/** - * Basic type defaults. - * @type {Object.} - * @const - * @property {number} double=0 Double default - * @property {number} float=0 Float default - * @property {number} int32=0 Int32 default - * @property {number} uint32=0 Uint32 default - * @property {number} sint32=0 Sint32 default - * @property {number} fixed32=0 Fixed32 default - * @property {number} sfixed32=0 Sfixed32 default - * @property {number} int64=0 Int64 default - * @property {number} uint64=0 Uint64 default - * @property {number} sint64=0 Sint32 default - * @property {number} fixed64=0 Fixed64 default - * @property {number} sfixed64=0 Sfixed64 default - * @property {boolean} bool=false Bool default - * @property {string} string="" String default - * @property {Array.} bytes=Array(0) Bytes default - * @property {null} message=null Message default - */ -types.defaults = bake([ - /* double */ 0, - /* float */ 0, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 0, - /* sfixed32 */ 0, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 0, - /* sfixed64 */ 0, - /* bool */ false, - /* string */ "", - /* bytes */ util.emptyArray, - /* message */ null -]); - -/** - * Basic long type wire types. - * @type {Object.} - * @const - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - */ -types.long = bake([ - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1 -], 7); - -/** - * Allowed types for map keys with their associated wire type. - * @type {Object.} - * @const - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - */ -types.mapKey = bake([ - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0, - /* string */ 2 -], 2); - -/** - * Allowed types for packed repeated fields with their associated wire type. - * @type {Object.} - * @const - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - */ -types.packed = bake([ - /* double */ 1, - /* float */ 5, - /* int32 */ 0, - /* uint32 */ 0, - /* sint32 */ 0, - /* fixed32 */ 5, - /* sfixed32 */ 5, - /* int64 */ 0, - /* uint64 */ 0, - /* sint64 */ 0, - /* fixed64 */ 1, - /* sfixed64 */ 1, - /* bool */ 0 -]); diff --git a/node_modules/protobufjs/src/typescript.jsdoc b/node_modules/protobufjs/src/typescript.jsdoc deleted file mode 100644 index 9a671016..00000000 --- a/node_modules/protobufjs/src/typescript.jsdoc +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Constructor type. - * @interface Constructor - * @extends Function - * @template T - * @tstype new(...params: any[]): T; prototype: T; - */ - -/** - * Properties type. - * @typedef Properties - * @template T - * @type {Object.} - * @tstype { [P in keyof T]?: T[P] } - */ diff --git a/node_modules/protobufjs/src/util.js b/node_modules/protobufjs/src/util.js deleted file mode 100644 index 5ae88cc7..00000000 --- a/node_modules/protobufjs/src/util.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; - -/** - * Various utility functions. - * @namespace - */ -var util = module.exports = require("./util/minimal"); - -var roots = require("./roots"); - -var Type, // cyclic - Enum; - -util.codegen = require("@protobufjs/codegen"); -util.fetch = require("@protobufjs/fetch"); -util.path = require("@protobufjs/path"); - -/** - * Node's fs module if available. - * @type {Object.} - */ -util.fs = util.inquire("fs"); - -/** - * Converts an object's values to an array. - * @param {Object.} object Object to convert - * @returns {Array.<*>} Converted array - */ -util.toArray = function toArray(object) { - if (object) { - var keys = Object.keys(object), - array = new Array(keys.length), - index = 0; - while (index < keys.length) - array[index] = object[keys[index++]]; - return array; - } - return []; -}; - -/** - * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values. - * @param {Array.<*>} array Array to convert - * @returns {Object.} Converted object - */ -util.toObject = function toObject(array) { - var object = {}, - index = 0; - while (index < array.length) { - var key = array[index++], - val = array[index++]; - if (val !== undefined) - object[key] = val; - } - return object; -}; - -var safePropBackslashRe = /\\/g, - safePropQuoteRe = /"/g; - -/** - * Tests whether the specified name is a reserved word in JS. - * @param {string} name Name to test - * @returns {boolean} `true` if reserved, otherwise `false` - */ -util.isReserved = function isReserved(name) { - return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name); -}; - -/** - * Returns a safe property accessor for the specified property name. - * @param {string} prop Property name - * @returns {string} Safe accessor - */ -util.safeProp = function safeProp(prop) { - if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop)) - return "[\"" + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, "\\\"") + "\"]"; - return "." + prop; -}; - -/** - * Converts the first character of a string to upper case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.ucFirst = function ucFirst(str) { - return str.charAt(0).toUpperCase() + str.substring(1); -}; - -var camelCaseRe = /_([a-z])/g; - -/** - * Converts a string to camel case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.camelCase = function camelCase(str) { - return str.substring(0, 1) - + str.substring(1) - .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); }); -}; - -/** - * Compares reflected fields by id. - * @param {Field} a First field - * @param {Field} b Second field - * @returns {number} Comparison value - */ -util.compareFieldsById = function compareFieldsById(a, b) { - return a.id - b.id; -}; - -/** - * Decorator helper for types (TypeScript). - * @param {Constructor} ctor Constructor function - * @param {string} [typeName] Type name, defaults to the constructor's name - * @returns {Type} Reflected type - * @template T extends Message - * @property {Root} root Decorators root - */ -util.decorateType = function decorateType(ctor, typeName) { - - /* istanbul ignore if */ - if (ctor.$type) { - if (typeName && ctor.$type.name !== typeName) { - util.decorateRoot.remove(ctor.$type); - ctor.$type.name = typeName; - util.decorateRoot.add(ctor.$type); - } - return ctor.$type; - } - - /* istanbul ignore next */ - if (!Type) - Type = require("./type"); - - var type = new Type(typeName || ctor.name); - util.decorateRoot.add(type); - type.ctor = ctor; // sets up .encode, .decode etc. - Object.defineProperty(ctor, "$type", { value: type, enumerable: false }); - Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false }); - return type; -}; - -var decorateEnumIndex = 0; - -/** - * Decorator helper for enums (TypeScript). - * @param {Object} object Enum object - * @returns {Enum} Reflected enum - */ -util.decorateEnum = function decorateEnum(object) { - - /* istanbul ignore if */ - if (object.$type) - return object.$type; - - /* istanbul ignore next */ - if (!Enum) - Enum = require("./enum"); - - var enm = new Enum("Enum" + decorateEnumIndex++, object); - util.decorateRoot.add(enm); - Object.defineProperty(object, "$type", { value: enm, enumerable: false }); - return enm; -}; - - -/** - * Sets the value of a property by property path. If a value already exists, it is turned to an array - * @param {Object.} dst Destination object - * @param {string} path dot '.' delimited path of the property to set - * @param {Object} value the value to set - * @returns {Object.} Destination object - */ -util.setProperty = function setProperty(dst, path, value) { - function setProp(dst, path, value) { - var part = path.shift(); - if (path.length > 0) { - dst[part] = setProp(dst[part] || {}, path, value); - } else { - var prevValue = dst[part]; - if (prevValue) - value = [].concat(prevValue).concat(value); - dst[part] = value; - } - return dst; - } - - if (typeof dst !== "object") - throw TypeError("dst must be an object"); - if (!path) - throw TypeError("path must be specified"); - - path = path.split("."); - return setProp(dst, path, value); -}; - -/** - * Decorator root (TypeScript). - * @name util.decorateRoot - * @type {Root} - * @readonly - */ -Object.defineProperty(util, "decorateRoot", { - get: function() { - return roots["decorated"] || (roots["decorated"] = new (require("./root"))()); - } -}); diff --git a/node_modules/protobufjs/src/util/longbits.js b/node_modules/protobufjs/src/util/longbits.js deleted file mode 100644 index 11bfb1c0..00000000 --- a/node_modules/protobufjs/src/util/longbits.js +++ /dev/null @@ -1,200 +0,0 @@ -"use strict"; -module.exports = LongBits; - -var util = require("../util/minimal"); - -/** - * Constructs new long bits. - * @classdesc Helper class for working with the low and high bits of a 64 bit value. - * @memberof util - * @constructor - * @param {number} lo Low 32 bits, unsigned - * @param {number} hi High 32 bits, unsigned - */ -function LongBits(lo, hi) { - - // note that the casts below are theoretically unnecessary as of today, but older statically - // generated converter code might still call the ctor with signed 32bits. kept for compat. - - /** - * Low bits. - * @type {number} - */ - this.lo = lo >>> 0; - - /** - * High bits. - * @type {number} - */ - this.hi = hi >>> 0; -} - -/** - * Zero bits. - * @memberof util.LongBits - * @type {util.LongBits} - */ -var zero = LongBits.zero = new LongBits(0, 0); - -zero.toNumber = function() { return 0; }; -zero.zzEncode = zero.zzDecode = function() { return this; }; -zero.length = function() { return 1; }; - -/** - * Zero hash. - * @memberof util.LongBits - * @type {string} - */ -var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; - -/** - * Constructs new long bits from the specified number. - * @param {number} value Value - * @returns {util.LongBits} Instance - */ -LongBits.fromNumber = function fromNumber(value) { - if (value === 0) - return zero; - var sign = value < 0; - if (sign) - value = -value; - var lo = value >>> 0, - hi = (value - lo) / 4294967296 >>> 0; - if (sign) { - hi = ~hi >>> 0; - lo = ~lo >>> 0; - if (++lo > 4294967295) { - lo = 0; - if (++hi > 4294967295) - hi = 0; - } - } - return new LongBits(lo, hi); -}; - -/** - * Constructs new long bits from a number, long or string. - * @param {Long|number|string} value Value - * @returns {util.LongBits} Instance - */ -LongBits.from = function from(value) { - if (typeof value === "number") - return LongBits.fromNumber(value); - if (util.isString(value)) { - /* istanbul ignore else */ - if (util.Long) - value = util.Long.fromString(value); - else - return LongBits.fromNumber(parseInt(value, 10)); - } - return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; -}; - -/** - * Converts this long bits to a possibly unsafe JavaScript number. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {number} Possibly unsafe number - */ -LongBits.prototype.toNumber = function toNumber(unsigned) { - if (!unsigned && this.hi >>> 31) { - var lo = ~this.lo + 1 >>> 0, - hi = ~this.hi >>> 0; - if (!lo) - hi = hi + 1 >>> 0; - return -(lo + hi * 4294967296); - } - return this.lo + this.hi * 4294967296; -}; - -/** - * Converts this long bits to a long. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long} Long - */ -LongBits.prototype.toLong = function toLong(unsigned) { - return util.Long - ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) - /* istanbul ignore next */ - : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; -}; - -var charCodeAt = String.prototype.charCodeAt; - -/** - * Constructs new long bits from the specified 8 characters long hash. - * @param {string} hash Hash - * @returns {util.LongBits} Bits - */ -LongBits.fromHash = function fromHash(hash) { - if (hash === zeroHash) - return zero; - return new LongBits( - ( charCodeAt.call(hash, 0) - | charCodeAt.call(hash, 1) << 8 - | charCodeAt.call(hash, 2) << 16 - | charCodeAt.call(hash, 3) << 24) >>> 0 - , - ( charCodeAt.call(hash, 4) - | charCodeAt.call(hash, 5) << 8 - | charCodeAt.call(hash, 6) << 16 - | charCodeAt.call(hash, 7) << 24) >>> 0 - ); -}; - -/** - * Converts this long bits to a 8 characters long hash. - * @returns {string} Hash - */ -LongBits.prototype.toHash = function toHash() { - return String.fromCharCode( - this.lo & 255, - this.lo >>> 8 & 255, - this.lo >>> 16 & 255, - this.lo >>> 24 , - this.hi & 255, - this.hi >>> 8 & 255, - this.hi >>> 16 & 255, - this.hi >>> 24 - ); -}; - -/** - * Zig-zag encodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzEncode = function zzEncode() { - var mask = this.hi >> 31; - this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; - this.lo = ( this.lo << 1 ^ mask) >>> 0; - return this; -}; - -/** - * Zig-zag decodes this long bits. - * @returns {util.LongBits} `this` - */ -LongBits.prototype.zzDecode = function zzDecode() { - var mask = -(this.lo & 1); - this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; - this.hi = ( this.hi >>> 1 ^ mask) >>> 0; - return this; -}; - -/** - * Calculates the length of this longbits when encoded as a varint. - * @returns {number} Length - */ -LongBits.prototype.length = function length() { - var part0 = this.lo, - part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, - part2 = this.hi >>> 24; - return part2 === 0 - ? part1 === 0 - ? part0 < 16384 - ? part0 < 128 ? 1 : 2 - : part0 < 2097152 ? 3 : 4 - : part1 < 16384 - ? part1 < 128 ? 5 : 6 - : part1 < 2097152 ? 7 : 8 - : part2 < 128 ? 9 : 10; -}; diff --git a/node_modules/protobufjs/src/util/minimal.js b/node_modules/protobufjs/src/util/minimal.js deleted file mode 100644 index 3c406dee..00000000 --- a/node_modules/protobufjs/src/util/minimal.js +++ /dev/null @@ -1,421 +0,0 @@ -"use strict"; -var util = exports; - -// used to return a Promise where callback is omitted -util.asPromise = require("@protobufjs/aspromise"); - -// converts to / from base64 encoded strings -util.base64 = require("@protobufjs/base64"); - -// base class of rpc.Service -util.EventEmitter = require("@protobufjs/eventemitter"); - -// float handling accross browsers -util.float = require("@protobufjs/float"); - -// requires modules optionally and hides the call from bundlers -util.inquire = require("@protobufjs/inquire"); - -// converts to / from utf8 encoded strings -util.utf8 = require("@protobufjs/utf8"); - -// provides a node-like buffer pool in the browser -util.pool = require("@protobufjs/pool"); - -// utility to work with the low and high bits of a 64 bit value -util.LongBits = require("./longbits"); - -/** - * Whether running within node or not. - * @memberof util - * @type {boolean} - */ -util.isNode = Boolean(typeof global !== "undefined" - && global - && global.process - && global.process.versions - && global.process.versions.node); - -/** - * Global object reference. - * @memberof util - * @type {Object} - */ -util.global = util.isNode && global - || typeof window !== "undefined" && window - || typeof self !== "undefined" && self - || this; // eslint-disable-line no-invalid-this - -/** - * An immuable empty array. - * @memberof util - * @type {Array.<*>} - * @const - */ -util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes - -/** - * An immutable empty object. - * @type {Object} - * @const - */ -util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes - -/** - * Tests if the specified value is an integer. - * @function - * @param {*} value Value to test - * @returns {boolean} `true` if the value is an integer - */ -util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { - return typeof value === "number" && isFinite(value) && Math.floor(value) === value; -}; - -/** - * Tests if the specified value is a string. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a string - */ -util.isString = function isString(value) { - return typeof value === "string" || value instanceof String; -}; - -/** - * Tests if the specified value is a non-null object. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a non-null object - */ -util.isObject = function isObject(value) { - return value && typeof value === "object"; -}; - -/** - * Checks if a property on a message is considered to be present. - * This is an alias of {@link util.isSet}. - * @function - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isset = - -/** - * Checks if a property on a message is considered to be present. - * @param {Object} obj Plain object or message instance - * @param {string} prop Property name - * @returns {boolean} `true` if considered to be present, otherwise `false` - */ -util.isSet = function isSet(obj, prop) { - var value = obj[prop]; - if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins - return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; - return false; -}; - -/** - * Any compatible Buffer instance. - * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. - * @interface Buffer - * @extends Uint8Array - */ - -/** - * Node's Buffer class if available. - * @type {Constructor} - */ -util.Buffer = (function() { - try { - var Buffer = util.inquire("buffer").Buffer; - // refuse to use non-node buffers if not explicitly assigned (perf reasons): - return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; - } catch (e) { - /* istanbul ignore next */ - return null; - } -})(); - -// Internal alias of or polyfull for Buffer.from. -util._Buffer_from = null; - -// Internal alias of or polyfill for Buffer.allocUnsafe. -util._Buffer_allocUnsafe = null; - -/** - * Creates a new buffer of whatever type supported by the environment. - * @param {number|number[]} [sizeOrArray=0] Buffer size or number array - * @returns {Uint8Array|Buffer} Buffer - */ -util.newBuffer = function newBuffer(sizeOrArray) { - /* istanbul ignore next */ - return typeof sizeOrArray === "number" - ? util.Buffer - ? util._Buffer_allocUnsafe(sizeOrArray) - : new util.Array(sizeOrArray) - : util.Buffer - ? util._Buffer_from(sizeOrArray) - : typeof Uint8Array === "undefined" - ? sizeOrArray - : new Uint8Array(sizeOrArray); -}; - -/** - * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. - * @type {Constructor} - */ -util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; - -/** - * Any compatible Long instance. - * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. - * @interface Long - * @property {number} low Low bits - * @property {number} high High bits - * @property {boolean} unsigned Whether unsigned or not - */ - -/** - * Long.js's Long class if available. - * @type {Constructor} - */ -util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long - || /* istanbul ignore next */ util.global.Long - || util.inquire("long"); - -/** - * Regular expression used to verify 2 bit (`bool`) map keys. - * @type {RegExp} - * @const - */ -util.key2Re = /^true|false|0|1$/; - -/** - * Regular expression used to verify 32 bit (`int32` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; - -/** - * Regular expression used to verify 64 bit (`int64` etc.) map keys. - * @type {RegExp} - * @const - */ -util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; - -/** - * Converts a number or long to an 8 characters long hash string. - * @param {Long|number} value Value to convert - * @returns {string} Hash - */ -util.longToHash = function longToHash(value) { - return value - ? util.LongBits.from(value).toHash() - : util.LongBits.zeroHash; -}; - -/** - * Converts an 8 characters long hash string to a long or number. - * @param {string} hash Hash - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long|number} Original value - */ -util.longFromHash = function longFromHash(hash, unsigned) { - var bits = util.LongBits.fromHash(hash); - if (util.Long) - return util.Long.fromBits(bits.lo, bits.hi, unsigned); - return bits.toNumber(Boolean(unsigned)); -}; - -/** - * Merges the properties of the source object into the destination object. - * @memberof util - * @param {Object.} dst Destination object - * @param {Object.} src Source object - * @param {boolean} [ifNotSet=false] Merges only if the key is not already set - * @returns {Object.} Destination object - */ -function merge(dst, src, ifNotSet) { // used by converters - for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) - if (dst[keys[i]] === undefined || !ifNotSet) - dst[keys[i]] = src[keys[i]]; - return dst; -} - -util.merge = merge; - -/** - * Converts the first character of a string to lower case. - * @param {string} str String to convert - * @returns {string} Converted string - */ -util.lcFirst = function lcFirst(str) { - return str.charAt(0).toLowerCase() + str.substring(1); -}; - -/** - * Creates a custom error constructor. - * @memberof util - * @param {string} name Error name - * @returns {Constructor} Custom error constructor - */ -function newError(name) { - - function CustomError(message, properties) { - - if (!(this instanceof CustomError)) - return new CustomError(message, properties); - - // Error.call(this, message); - // ^ just returns a new error instance because the ctor can be called as a function - - Object.defineProperty(this, "message", { get: function() { return message; } }); - - /* istanbul ignore next */ - if (Error.captureStackTrace) // node - Error.captureStackTrace(this, CustomError); - else - Object.defineProperty(this, "stack", { value: new Error().stack || "" }); - - if (properties) - merge(this, properties); - } - - (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; - - Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); - - CustomError.prototype.toString = function toString() { - return this.name + ": " + this.message; - }; - - return CustomError; -} - -util.newError = newError; - -/** - * Constructs a new protocol error. - * @classdesc Error subclass indicating a protocol specifc error. - * @memberof util - * @extends Error - * @template T extends Message - * @constructor - * @param {string} message Error message - * @param {Object.} [properties] Additional properties - * @example - * try { - * MyMessage.decode(someBuffer); // throws if required fields are missing - * } catch (e) { - * if (e instanceof ProtocolError && e.instance) - * console.log("decoded so far: " + JSON.stringify(e.instance)); - * } - */ -util.ProtocolError = newError("ProtocolError"); - -/** - * So far decoded message instance. - * @name util.ProtocolError#instance - * @type {Message} - */ - -/** - * A OneOf getter as returned by {@link util.oneOfGetter}. - * @typedef OneOfGetter - * @type {function} - * @returns {string|undefined} Set field name, if any - */ - -/** - * Builds a getter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfGetter} Unbound getter - */ -util.oneOfGetter = function getOneOf(fieldNames) { - var fieldMap = {}; - for (var i = 0; i < fieldNames.length; ++i) - fieldMap[fieldNames[i]] = 1; - - /** - * @returns {string|undefined} Set field name, if any - * @this Object - * @ignore - */ - return function() { // eslint-disable-line consistent-return - for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) - if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) - return keys[i]; - }; -}; - -/** - * A OneOf setter as returned by {@link util.oneOfSetter}. - * @typedef OneOfSetter - * @type {function} - * @param {string|undefined} value Field name - * @returns {undefined} - */ - -/** - * Builds a setter for a oneof's present field name. - * @param {string[]} fieldNames Field names - * @returns {OneOfSetter} Unbound setter - */ -util.oneOfSetter = function setOneOf(fieldNames) { - - /** - * @param {string} name Field name - * @returns {undefined} - * @this Object - * @ignore - */ - return function(name) { - for (var i = 0; i < fieldNames.length; ++i) - if (fieldNames[i] !== name) - delete this[fieldNames[i]]; - }; -}; - -/** - * Default conversion options used for {@link Message#toJSON} implementations. - * - * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: - * - * - Longs become strings - * - Enums become string keys - * - Bytes become base64 encoded strings - * - (Sub-)Messages become plain objects - * - Maps become plain objects with all string keys - * - Repeated fields become arrays - * - NaN and Infinity for float and double fields become strings - * - * @type {IConversionOptions} - * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json - */ -util.toJSONOptions = { - longs: String, - enums: String, - bytes: String, - json: true -}; - -// Sets up buffer utility according to the environment (called in index-minimal) -util._configure = function() { - var Buffer = util.Buffer; - /* istanbul ignore if */ - if (!Buffer) { - util._Buffer_from = util._Buffer_allocUnsafe = null; - return; - } - // because node 4.x buffers are incompatible & immutable - // see: https://github.com/dcodeIO/protobuf.js/pull/665 - util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || - /* istanbul ignore next */ - function Buffer_from(value, encoding) { - return new Buffer(value, encoding); - }; - util._Buffer_allocUnsafe = Buffer.allocUnsafe || - /* istanbul ignore next */ - function Buffer_allocUnsafe(size) { - return new Buffer(size); - }; -}; diff --git a/node_modules/protobufjs/src/verifier.js b/node_modules/protobufjs/src/verifier.js deleted file mode 100644 index d58e27ab..00000000 --- a/node_modules/protobufjs/src/verifier.js +++ /dev/null @@ -1,177 +0,0 @@ -"use strict"; -module.exports = verifier; - -var Enum = require("./enum"), - util = require("./util"); - -function invalid(field, expected) { - return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected"; -} - -/** - * Generates a partial value verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {number} fieldIndex Field index - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyValue(gen, field, fieldIndex, ref) { - /* eslint-disable no-unexpected-multiline */ - if (field.resolvedType) { - if (field.resolvedType instanceof Enum) { gen - ("switch(%s){", ref) - ("default:") - ("return%j", invalid(field, "enum value")); - for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen - ("case %i:", field.resolvedType.values[keys[j]]); - gen - ("break") - ("}"); - } else { - gen - ("{") - ("var e=types[%i].verify(%s);", fieldIndex, ref) - ("if(e)") - ("return%j+e", field.name + ".") - ("}"); - } - } else { - switch (field.type) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.isInteger(%s))", ref) - ("return%j", invalid(field, "integer")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", ref, ref, ref, ref) - ("return%j", invalid(field, "integer|Long")); - break; - case "float": - case "double": gen - ("if(typeof %s!==\"number\")", ref) - ("return%j", invalid(field, "number")); - break; - case "bool": gen - ("if(typeof %s!==\"boolean\")", ref) - ("return%j", invalid(field, "boolean")); - break; - case "string": gen - ("if(!util.isString(%s))", ref) - ("return%j", invalid(field, "string")); - break; - case "bytes": gen - ("if(!(%s&&typeof %s.length===\"number\"||util.isString(%s)))", ref, ref, ref) - ("return%j", invalid(field, "buffer")); - break; - } - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a partial key verifier. - * @param {Codegen} gen Codegen instance - * @param {Field} field Reflected field - * @param {string} ref Variable reference - * @returns {Codegen} Codegen instance - * @ignore - */ -function genVerifyKey(gen, field, ref) { - /* eslint-disable no-unexpected-multiline */ - switch (field.keyType) { - case "int32": - case "uint32": - case "sint32": - case "fixed32": - case "sfixed32": gen - ("if(!util.key32Re.test(%s))", ref) - ("return%j", invalid(field, "integer key")); - break; - case "int64": - case "uint64": - case "sint64": - case "fixed64": - case "sfixed64": gen - ("if(!util.key64Re.test(%s))", ref) // see comment above: x is ok, d is not - ("return%j", invalid(field, "integer|Long key")); - break; - case "bool": gen - ("if(!util.key2Re.test(%s))", ref) - ("return%j", invalid(field, "boolean key")); - break; - } - return gen; - /* eslint-enable no-unexpected-multiline */ -} - -/** - * Generates a verifier specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance - */ -function verifier(mtype) { - /* eslint-disable no-unexpected-multiline */ - - var gen = util.codegen(["m"], mtype.name + "$verify") - ("if(typeof m!==\"object\"||m===null)") - ("return%j", "object expected"); - var oneofs = mtype.oneofsArray, - seenFirstField = {}; - if (oneofs.length) gen - ("var p={}"); - - for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) { - var field = mtype._fieldsArray[i].resolve(), - ref = "m" + util.safeProp(field.name); - - if (field.optional) gen - ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null - - // map fields - if (field.map) { gen - ("if(!util.isObject(%s))", ref) - ("return%j", invalid(field, "object")) - ("var k=Object.keys(%s)", ref) - ("for(var i=0;i} - * @const - */ -var wrappers = exports; - -var Message = require("./message"); - -/** - * From object converter part of an {@link IWrapper}. - * @typedef WrapperFromObjectConverter - * @type {function} - * @param {Object.} object Plain object - * @returns {Message<{}>} Message instance - * @this Type - */ - -/** - * To object converter part of an {@link IWrapper}. - * @typedef WrapperToObjectConverter - * @type {function} - * @param {Message<{}>} message Message instance - * @param {IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - * @this Type - */ - -/** - * Common type wrapper part of {@link wrappers}. - * @interface IWrapper - * @property {WrapperFromObjectConverter} [fromObject] From object converter - * @property {WrapperToObjectConverter} [toObject] To object converter - */ - -// Custom wrapper for Any -wrappers[".google.protobuf.Any"] = { - - fromObject: function(object) { - - // unwrap value type if mapped - if (object && object["@type"]) { - // Only use fully qualified type name after the last '/' - var name = object["@type"].substring(object["@type"].lastIndexOf("/") + 1); - var type = this.lookup(name); - /* istanbul ignore else */ - if (type) { - // type_url does not accept leading "." - var type_url = object["@type"].charAt(0) === "." ? - object["@type"].substr(1) : object["@type"]; - // type_url prefix is optional, but path seperator is required - if (type_url.indexOf("/") === -1) { - type_url = "/" + type_url; - } - return this.create({ - type_url: type_url, - value: type.encode(type.fromObject(object)).finish() - }); - } - } - - return this.fromObject(object); - }, - - toObject: function(message, options) { - - // Default prefix - var googleApi = "type.googleapis.com/"; - var prefix = ""; - var name = ""; - - // decode value if requested and unmapped - if (options && options.json && message.type_url && message.value) { - // Only use fully qualified type name after the last '/' - name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1); - // Separate the prefix used - prefix = message.type_url.substring(0, message.type_url.lastIndexOf("/") + 1); - var type = this.lookup(name); - /* istanbul ignore else */ - if (type) - message = type.decode(message.value); - } - - // wrap value if unmapped - if (!(message instanceof this.ctor) && message instanceof Message) { - var object = message.$type.toObject(message, options); - var messageName = message.$type.fullName[0] === "." ? - message.$type.fullName.substr(1) : message.$type.fullName; - // Default to type.googleapis.com prefix if no prefix is used - if (prefix === "") { - prefix = googleApi; - } - name = prefix + messageName; - object["@type"] = name; - return object; - } - - return this.toObject(message, options); - } -}; diff --git a/node_modules/protobufjs/src/writer.js b/node_modules/protobufjs/src/writer.js deleted file mode 100644 index cc84a00e..00000000 --- a/node_modules/protobufjs/src/writer.js +++ /dev/null @@ -1,465 +0,0 @@ -"use strict"; -module.exports = Writer; - -var util = require("./util/minimal"); - -var BufferWriter; // cyclic - -var LongBits = util.LongBits, - base64 = util.base64, - utf8 = util.utf8; - -/** - * Constructs a new writer operation instance. - * @classdesc Scheduled writer operation. - * @constructor - * @param {function(*, Uint8Array, number)} fn Function to call - * @param {number} len Value byte length - * @param {*} val Value to write - * @ignore - */ -function Op(fn, len, val) { - - /** - * Function to call. - * @type {function(Uint8Array, number, *)} - */ - this.fn = fn; - - /** - * Value byte length. - * @type {number} - */ - this.len = len; - - /** - * Next operation. - * @type {Writer.Op|undefined} - */ - this.next = undefined; - - /** - * Value to write. - * @type {*} - */ - this.val = val; // type varies -} - -/* istanbul ignore next */ -function noop() {} // eslint-disable-line no-empty-function - -/** - * Constructs a new writer state instance. - * @classdesc Copied writer state. - * @memberof Writer - * @constructor - * @param {Writer} writer Writer to copy state from - * @ignore - */ -function State(writer) { - - /** - * Current head. - * @type {Writer.Op} - */ - this.head = writer.head; - - /** - * Current tail. - * @type {Writer.Op} - */ - this.tail = writer.tail; - - /** - * Current buffer length. - * @type {number} - */ - this.len = writer.len; - - /** - * Next state. - * @type {State|null} - */ - this.next = writer.states; -} - -/** - * Constructs a new writer instance. - * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. - * @constructor - */ -function Writer() { - - /** - * Current length. - * @type {number} - */ - this.len = 0; - - /** - * Operations head. - * @type {Object} - */ - this.head = new Op(noop, 0, 0); - - /** - * Operations tail - * @type {Object} - */ - this.tail = this.head; - - /** - * Linked forked states. - * @type {Object|null} - */ - this.states = null; - - // When a value is written, the writer calculates its byte length and puts it into a linked - // list of operations to perform when finish() is called. This both allows us to allocate - // buffers of the exact required size and reduces the amount of work we have to do compared - // to first calculating over objects and then encoding over objects. In our case, the encoding - // part is just a linked list walk calling operations with already prepared values. -} - -var create = function create() { - return util.Buffer - ? function create_buffer_setup() { - return (Writer.create = function create_buffer() { - return new BufferWriter(); - })(); - } - /* istanbul ignore next */ - : function create_array() { - return new Writer(); - }; -}; - -/** - * Creates a new writer. - * @function - * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} - */ -Writer.create = create(); - -/** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ -Writer.alloc = function alloc(size) { - return new util.Array(size); -}; - -// Use Uint8Array buffer pool in the browser, just like node does with buffers -/* istanbul ignore else */ -if (util.Array !== Array) - Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); - -/** - * Pushes a new operation to the queue. - * @param {function(Uint8Array, number, *)} fn Function to call - * @param {number} len Value byte length - * @param {number} val Value to write - * @returns {Writer} `this` - * @private - */ -Writer.prototype._push = function push(fn, len, val) { - this.tail = this.tail.next = new Op(fn, len, val); - this.len += len; - return this; -}; - -function writeByte(val, buf, pos) { - buf[pos] = val & 255; -} - -function writeVarint32(val, buf, pos) { - while (val > 127) { - buf[pos++] = val & 127 | 128; - val >>>= 7; - } - buf[pos] = val; -} - -/** - * Constructs a new varint writer operation instance. - * @classdesc Scheduled varint writer operation. - * @extends Op - * @constructor - * @param {number} len Value byte length - * @param {number} val Value to write - * @ignore - */ -function VarintOp(len, val) { - this.len = len; - this.next = undefined; - this.val = val; -} - -VarintOp.prototype = Object.create(Op.prototype); -VarintOp.prototype.fn = writeVarint32; - -/** - * Writes an unsigned 32 bit value as a varint. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.uint32 = function write_uint32(value) { - // here, the call to this.push has been inlined and a varint specific Op subclass is used. - // uint32 is by far the most frequently used operation and benefits significantly from this. - this.len += (this.tail = this.tail.next = new VarintOp( - (value = value >>> 0) - < 128 ? 1 - : value < 16384 ? 2 - : value < 2097152 ? 3 - : value < 268435456 ? 4 - : 5, - value)).len; - return this; -}; - -/** - * Writes a signed 32 bit value as a varint. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.int32 = function write_int32(value) { - return value < 0 - ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec - : this.uint32(value); -}; - -/** - * Writes a 32 bit value as a varint, zig-zag encoded. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sint32 = function write_sint32(value) { - return this.uint32((value << 1 ^ value >> 31) >>> 0); -}; - -function writeVarint64(val, buf, pos) { - while (val.hi) { - buf[pos++] = val.lo & 127 | 128; - val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; - val.hi >>>= 7; - } - while (val.lo > 127) { - buf[pos++] = val.lo & 127 | 128; - val.lo = val.lo >>> 7; - } - buf[pos++] = val.lo; -} - -/** - * Writes an unsigned 64 bit value as a varint. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.uint64 = function write_uint64(value) { - var bits = LongBits.from(value); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a signed 64 bit value as a varint. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.int64 = Writer.prototype.uint64; - -/** - * Writes a signed 64 bit value as a varint, zig-zag encoded. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sint64 = function write_sint64(value) { - var bits = LongBits.from(value).zzEncode(); - return this._push(writeVarint64, bits.length(), bits); -}; - -/** - * Writes a boolish value as a varint. - * @param {boolean} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.bool = function write_bool(value) { - return this._push(writeByte, 1, value ? 1 : 0); -}; - -function writeFixed32(val, buf, pos) { - buf[pos ] = val & 255; - buf[pos + 1] = val >>> 8 & 255; - buf[pos + 2] = val >>> 16 & 255; - buf[pos + 3] = val >>> 24; -} - -/** - * Writes an unsigned 32 bit value as fixed 32 bits. - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.fixed32 = function write_fixed32(value) { - return this._push(writeFixed32, 4, value >>> 0); -}; - -/** - * Writes a signed 32 bit value as fixed 32 bits. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.sfixed32 = Writer.prototype.fixed32; - -/** - * Writes an unsigned 64 bit value as fixed 64 bits. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.fixed64 = function write_fixed64(value) { - var bits = LongBits.from(value); - return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); -}; - -/** - * Writes a signed 64 bit value as fixed 64 bits. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ -Writer.prototype.sfixed64 = Writer.prototype.fixed64; - -/** - * Writes a float (32 bit). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.float = function write_float(value) { - return this._push(util.float.writeFloatLE, 4, value); -}; - -/** - * Writes a double (64 bit float). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.double = function write_double(value) { - return this._push(util.float.writeDoubleLE, 8, value); -}; - -var writeBytes = util.Array.prototype.set - ? function writeBytes_set(val, buf, pos) { - buf.set(val, pos); // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytes_for(val, buf, pos) { - for (var i = 0; i < val.length; ++i) - buf[pos + i] = val[i]; - }; - -/** - * Writes a sequence of bytes. - * @param {Uint8Array|string} value Buffer or base64 encoded string to write - * @returns {Writer} `this` - */ -Writer.prototype.bytes = function write_bytes(value) { - var len = value.length >>> 0; - if (!len) - return this._push(writeByte, 1, 0); - if (util.isString(value)) { - var buf = Writer.alloc(len = base64.length(value)); - base64.decode(value, buf, 0); - value = buf; - } - return this.uint32(len)._push(writeBytes, len, value); -}; - -/** - * Writes a string. - * @param {string} value Value to write - * @returns {Writer} `this` - */ -Writer.prototype.string = function write_string(value) { - var len = utf8.length(value); - return len - ? this.uint32(len)._push(utf8.write, len, value) - : this._push(writeByte, 1, 0); -}; - -/** - * Forks this writer's state by pushing it to a stack. - * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. - * @returns {Writer} `this` - */ -Writer.prototype.fork = function fork() { - this.states = new State(this); - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - return this; -}; - -/** - * Resets this instance to the last state. - * @returns {Writer} `this` - */ -Writer.prototype.reset = function reset() { - if (this.states) { - this.head = this.states.head; - this.tail = this.states.tail; - this.len = this.states.len; - this.states = this.states.next; - } else { - this.head = this.tail = new Op(noop, 0, 0); - this.len = 0; - } - return this; -}; - -/** - * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. - * @returns {Writer} `this` - */ -Writer.prototype.ldelim = function ldelim() { - var head = this.head, - tail = this.tail, - len = this.len; - this.reset().uint32(len); - if (len) { - this.tail.next = head.next; // skip noop - this.tail = tail; - this.len += len; - } - return this; -}; - -/** - * Finishes the write operation. - * @returns {Uint8Array} Finished buffer - */ -Writer.prototype.finish = function finish() { - var head = this.head.next, // skip noop - buf = this.constructor.alloc(this.len), - pos = 0; - while (head) { - head.fn(head.val, buf, pos); - pos += head.len; - head = head.next; - } - // this.head = this.tail = null; - return buf; -}; - -Writer._configure = function(BufferWriter_) { - BufferWriter = BufferWriter_; - Writer.create = create(); - BufferWriter._configure(); -}; diff --git a/node_modules/protobufjs/src/writer_buffer.js b/node_modules/protobufjs/src/writer_buffer.js deleted file mode 100644 index 09a4a912..00000000 --- a/node_modules/protobufjs/src/writer_buffer.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; -module.exports = BufferWriter; - -// extends Writer -var Writer = require("./writer"); -(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; - -var util = require("./util/minimal"); - -/** - * Constructs a new buffer writer instance. - * @classdesc Wire format writer using node buffers. - * @extends Writer - * @constructor - */ -function BufferWriter() { - Writer.call(this); -} - -BufferWriter._configure = function () { - /** - * Allocates a buffer of the specified size. - * @function - * @param {number} size Buffer size - * @returns {Buffer} Buffer - */ - BufferWriter.alloc = util._Buffer_allocUnsafe; - - BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" - ? function writeBytesBuffer_set(val, buf, pos) { - buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) - // also works for plain array values - } - /* istanbul ignore next */ - : function writeBytesBuffer_copy(val, buf, pos) { - if (val.copy) // Buffer values - val.copy(buf, pos, 0, val.length); - else for (var i = 0; i < val.length;) // plain array values - buf[pos++] = val[i++]; - }; -}; - - -/** - * @override - */ -BufferWriter.prototype.bytes = function write_bytes_buffer(value) { - if (util.isString(value)) - value = util._Buffer_from(value, "base64"); - var len = value.length >>> 0; - this.uint32(len); - if (len) - this._push(BufferWriter.writeBytesBuffer, len, value); - return this; -}; - -function writeStringBuffer(val, buf, pos) { - if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) - util.utf8.write(val, buf, pos); - else if (buf.utf8Write) - buf.utf8Write(val, pos); - else - buf.write(val, pos); -} - -/** - * @override - */ -BufferWriter.prototype.string = function write_string_buffer(value) { - var len = util.Buffer.byteLength(value); - this.uint32(len); - if (len) - this._push(writeStringBuffer, len, value); - return this; -}; - - -/** - * Finishes the write operation. - * @name BufferWriter#finish - * @function - * @returns {Buffer} Finished buffer - */ - -BufferWriter._configure(); diff --git a/node_modules/protobufjs/tsconfig.json b/node_modules/protobufjs/tsconfig.json deleted file mode 100644 index 22852fa6..00000000 --- a/node_modules/protobufjs/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "target": "ES5", - "experimentalDecorators": true, - "emitDecoratorMetadata": true - } -} \ No newline at end of file diff --git a/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/readable-stream/CONTRIBUTING.md deleted file mode 100644 index f478d58d..00000000 --- a/node_modules/readable-stream/CONTRIBUTING.md +++ /dev/null @@ -1,38 +0,0 @@ -# Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -* (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -* (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -* (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - -## Moderation Policy - -The [Node.js Moderation Policy] applies to this WG. - -## Code of Conduct - -The [Node.js Code of Conduct][] applies to this WG. - -[Node.js Code of Conduct]: -https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md -[Node.js Moderation Policy]: -https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/node_modules/readable-stream/GOVERNANCE.md b/node_modules/readable-stream/GOVERNANCE.md deleted file mode 100644 index 16ffb93f..00000000 --- a/node_modules/readable-stream/GOVERNANCE.md +++ /dev/null @@ -1,136 +0,0 @@ -### Streams Working Group - -The Node.js Streams is jointly governed by a Working Group -(WG) -that is responsible for high-level guidance of the project. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Conduct guidelines -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project -[README.md](./README.md#current-project-team-members). - -### Collaborators - -The readable-stream GitHub repository is -maintained by the WG and additional Collaborators who are added by the -WG on an ongoing basis. - -Individuals making significant and valuable contributions are made -Collaborators and given commit-access to the project. These -individuals are identified by the WG and their addition as -Collaborators is discussed during the WG meeting. - -_Note:_ If you make a significant contribution and are not considered -for commit-access log an issue or contact a WG member directly and it -will be brought up in the next WG meeting. - -Modifications of the contents of the readable-stream repository are -made on -a collaborative basis. Anybody with a GitHub account may propose a -modification via pull request and it will be considered by the project -Collaborators. All pull requests must be reviewed and accepted by a -Collaborator with sufficient expertise who is able to take full -responsibility for the change. In the case of pull requests proposed -by an existing Collaborator, an additional Collaborator is required -for sign-off. Consensus should be sought if additional Collaborators -participate and there is disagreement around a particular -modification. See _Consensus Seeking Process_ below for further detail -on the consensus model used for governance. - -Collaborators may opt to elevate significant or controversial -modifications, or modifications that have not found consensus to the -WG for discussion by assigning the ***WG-agenda*** tag to a pull -request or issue. The WG should serve as the final arbiter where -required. - -For the current list of Collaborators, see the project -[README.md](./README.md#members). - -### WG Membership - -WG seats are not time-limited. There is no fixed size of the WG. -However, the expected target is between 6 and 12, to ensure adequate -coverage of important areas of expertise, balanced with the ability to -make decisions efficiently. - -There is no specific set of requirements or qualifications for WG -membership beyond these rules. - -The WG may add additional members to the WG by unanimous consensus. - -A WG member may be removed from the WG by voluntary resignation, or by -unanimous consensus of all other WG members. - -Changes to WG membership should be posted in the agenda, and may be -suggested as any other agenda item (see "WG Meetings" below). - -If an addition or removal is proposed during a meeting, and the full -WG is not in attendance to participate, then the addition or removal -is added to the agenda for the subsequent meeting. This is to ensure -that all members are given the opportunity to participate in all -membership decisions. If a WG member is unable to attend a meeting -where a planned membership decision is being made, then their consent -is assumed. - -No more than 1/3 of the WG members may be affiliated with the same -employer. If removal or resignation of a WG member, or a change of -employment by a WG member, creates a situation where more than 1/3 of -the WG membership shares an employer, then the situation must be -immediately remedied by the resignation or removal of one or more WG -members affiliated with the over-represented employer(s). - -### WG Meetings - -The WG meets occasionally on a Google Hangout On Air. A designated moderator -approved by the WG runs the meeting. Each meeting should be -published to YouTube. - -Items are added to the WG agenda that are considered contentious or -are modifications of governance, contribution policy, WG membership, -or release process. - -The intention of the agenda is not to approve or review all patches; -that should happen continuously on GitHub and be handled by the larger -group of Collaborators. - -Any community member or contributor can ask that something be added to -the next meeting's agenda by logging a GitHub Issue. Any Collaborator, -WG member or the moderator can add the item to the agenda by adding -the ***WG-agenda*** tag to the issue. - -Prior to each WG meeting the moderator will share the Agenda with -members of the WG. WG members can add any items they like to the -agenda at the beginning of each meeting. The moderator and the WG -cannot veto or remove items. - -The WG may invite persons or representatives from certain projects to -participate in a non-voting capacity. - -The moderator is responsible for summarizing the discussion of each -agenda item and sends it as a pull request after the meeting. - -### Consensus Seeking Process - -The WG follows a -[Consensus -Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) -decision-making model. - -When an agenda item has appeared to reach a consensus the moderator -will ask "Does anyone object?" as a final call for dissent from the -consensus. - -If an agenda item cannot reach a consensus a WG member can call for -either a closing vote or a vote to table the issue to the next -meeting. The call for a vote must be seconded by a majority of the WG -or else the discussion will continue. Simple majority wins. - -Note that changes to WG membership require a majority consensus. See -"WG Membership" above. diff --git a/node_modules/readable-stream/LICENSE b/node_modules/readable-stream/LICENSE deleted file mode 100644 index 2873b3b2..00000000 --- a/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Node.js is licensed for use as follows: - -""" -Copyright Node.js contributors. All rights reserved. - -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. -""" - -This license applies to parts of Node.js originating from the -https://github.com/joyent/node repository: - -""" -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -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. -""" diff --git a/node_modules/readable-stream/README.md b/node_modules/readable-stream/README.md deleted file mode 100644 index 6f035ab1..00000000 --- a/node_modules/readable-stream/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# readable-stream - -***Node.js core streams for userland*** [![Build Status](https://travis-ci.com/nodejs/readable-stream.svg?branch=master)](https://travis-ci.com/nodejs/readable-stream) - - -[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) -[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) - - -[![Sauce Test Status](https://saucelabs.com/browser-matrix/readabe-stream.svg)](https://saucelabs.com/u/readabe-stream) - -```bash -npm install --save readable-stream -``` - -This package is a mirror of the streams implementations in Node.js. - -Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.19.0/docs/api/stream.html). - -If you want to guarantee a stable streams base, regardless of what version of -Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). - -As of version 2.0.0 **readable-stream** uses semantic versioning. - -## Version 3.x.x - -v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows: - -1. Error codes: https://github.com/nodejs/node/pull/13310, - https://github.com/nodejs/node/pull/13291, - https://github.com/nodejs/node/pull/16589, - https://github.com/nodejs/node/pull/15042, - https://github.com/nodejs/node/pull/15665, - https://github.com/nodejs/readable-stream/pull/344 -2. 'readable' have precedence over flowing - https://github.com/nodejs/node/pull/18994 -3. make virtual methods errors consistent - https://github.com/nodejs/node/pull/18813 -4. updated streams error handling - https://github.com/nodejs/node/pull/18438 -5. writable.end should return this. - https://github.com/nodejs/node/pull/18780 -6. readable continues to read when push('') - https://github.com/nodejs/node/pull/18211 -7. add custom inspect to BufferList - https://github.com/nodejs/node/pull/17907 -8. always defer 'readable' with nextTick - https://github.com/nodejs/node/pull/17979 - -## Version 2.x.x -v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11. - -### Big Thanks - -Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce] - -# Usage - -You can swap your `require('stream')` with `require('readable-stream')` -without any changes, if you are just using one of the main classes and -functions. - -```js -const { - Readable, - Writable, - Transform, - Duplex, - pipeline, - finished -} = require('readable-stream') -```` - -Note that `require('stream')` will return `Stream`, while -`require('readable-stream')` will return `Readable`. We discourage using -whatever is exported directly, but rather use one of the properties as -shown in the example above. - -# Streams Working Group - -`readable-stream` is maintained by the Streams Working Group, which -oversees the development and maintenance of the Streams API within -Node.js. The responsibilities of the Streams Working Group include: - -* Addressing stream issues on the Node.js issue tracker. -* Authoring and editing stream documentation within the Node.js project. -* Reviewing changes to stream subclasses within the Node.js project. -* Redirecting changes to streams from the Node.js project to this - project. -* Assisting in the implementation of stream providers within Node.js. -* Recommending versions of `readable-stream` to be included in Node.js. -* Messaging about the future of streams to give the community advance - notice of changes. - - -## Team Members - -* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> - - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 -* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> -* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> - - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E -* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> -* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com> - -[sauce]: https://saucelabs.com diff --git a/node_modules/readable-stream/errors-browser.js b/node_modules/readable-stream/errors-browser.js deleted file mode 100644 index fb8e73e1..00000000 --- a/node_modules/readable-stream/errors-browser.js +++ /dev/null @@ -1,127 +0,0 @@ -'use strict'; - -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - -var codes = {}; - -function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - - function getMessage(arg1, arg2, arg3) { - if (typeof message === 'string') { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - - var NodeError = - /*#__PURE__*/ - function (_Base) { - _inheritsLoose(NodeError, _Base); - - function NodeError(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - - return NodeError; - }(Base); - - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; -} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js - - -function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function (i) { - return String(i); - }); - - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith - - -function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith - - -function endsWith(str, search, this_len) { - if (this_len === undefined || this_len > str.length) { - this_len = str.length; - } - - return str.substring(this_len - search.length, this_len) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes - - -function includes(str, search, start) { - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } -} - -createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; -}, TypeError); -createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { - // determiner: 'must be' or 'must not be' - var determiner; - - if (typeof expected === 'string' && startsWith(expected, 'not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); - } else { - determiner = 'must be'; - } - - var msg; - - if (endsWith(name, ' argument')) { - // For cases like 'first argument' - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } else { - var type = includes(name, '.') ? 'property' : 'argument'; - msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } - - msg += ". Received type ".concat(typeof actual); - return msg; -}, TypeError); -createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); -createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { - return 'The ' + name + ' method is not implemented'; -}); -createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); -createErrorType('ERR_STREAM_DESTROYED', function (name) { - return 'Cannot call ' + name + ' after a stream was destroyed'; -}); -createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); -createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); -createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); -createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); -createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { - return 'Unknown encoding: ' + arg; -}, TypeError); -createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); -module.exports.codes = codes; diff --git a/node_modules/readable-stream/errors.js b/node_modules/readable-stream/errors.js deleted file mode 100644 index 8471526d..00000000 --- a/node_modules/readable-stream/errors.js +++ /dev/null @@ -1,116 +0,0 @@ -'use strict'; - -const codes = {}; - -function createErrorType(code, message, Base) { - if (!Base) { - Base = Error - } - - function getMessage (arg1, arg2, arg3) { - if (typeof message === 'string') { - return message - } else { - return message(arg1, arg2, arg3) - } - } - - class NodeError extends Base { - constructor (arg1, arg2, arg3) { - super(getMessage(arg1, arg2, arg3)); - } - } - - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - - codes[code] = NodeError; -} - -// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js -function oneOf(expected, thing) { - if (Array.isArray(expected)) { - const len = expected.length; - expected = expected.map((i) => String(i)); - if (len > 2) { - return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + - expected[len - 1]; - } else if (len === 2) { - return `one of ${thing} ${expected[0]} or ${expected[1]}`; - } else { - return `of ${thing} ${expected[0]}`; - } - } else { - return `of ${thing} ${String(expected)}`; - } -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith -function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith -function endsWith(str, search, this_len) { - if (this_len === undefined || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes -function includes(str, search, start) { - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } -} - -createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"' -}, TypeError); -createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { - // determiner: 'must be' or 'must not be' - let determiner; - if (typeof expected === 'string' && startsWith(expected, 'not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); - } else { - determiner = 'must be'; - } - - let msg; - if (endsWith(name, ' argument')) { - // For cases like 'first argument' - msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; - } else { - const type = includes(name, '.') ? 'property' : 'argument'; - msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; - } - - msg += `. Received type ${typeof actual}`; - return msg; -}, TypeError); -createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); -createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { - return 'The ' + name + ' method is not implemented' -}); -createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); -createErrorType('ERR_STREAM_DESTROYED', function (name) { - return 'Cannot call ' + name + ' after a stream was destroyed'; -}); -createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); -createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); -createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); -createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); -createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { - return 'Unknown encoding: ' + arg -}, TypeError); -createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); - -module.exports.codes = codes; diff --git a/node_modules/readable-stream/experimentalWarning.js b/node_modules/readable-stream/experimentalWarning.js deleted file mode 100644 index 78e84149..00000000 --- a/node_modules/readable-stream/experimentalWarning.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -var experimentalWarnings = new Set(); - -function emitExperimentalWarning(feature) { - if (experimentalWarnings.has(feature)) return; - var msg = feature + ' is an experimental feature. This feature could ' + - 'change at any time'; - experimentalWarnings.add(feature); - process.emitWarning(msg, 'ExperimentalWarning'); -} - -function noop() {} - -module.exports.emitExperimentalWarning = process.emitWarning - ? emitExperimentalWarning - : noop; diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index 67525192..00000000 --- a/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. -'use strict'; -/**/ - -var objectKeys = Object.keys || function (obj) { - var keys = []; - - for (var key in obj) { - keys.push(key); - } - - return keys; -}; -/**/ - - -module.exports = Duplex; - -var Readable = require('./_stream_readable'); - -var Writable = require('./_stream_writable'); - -require('inherits')(Duplex, Readable); - -{ - // Allow the keys array to be GC'ed. - var keys = objectKeys(Writable.prototype); - - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - - if (options) { - if (options.readable === false) this.readable = false; - if (options.writable === false) this.writable = false; - - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once('end', onend); - } - } -} - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); -Object.defineProperty(Duplex.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); -Object.defineProperty(Duplex.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); // the no-half-open enforcer - -function onend() { - // If the writable side ended, then we're ok. - if (this._writableState.ended) return; // no more data can be written. - // But allow more writes to happen in this tick. - - process.nextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js deleted file mode 100644 index 32e7414c..00000000 --- a/node_modules/readable-stream/lib/_stream_passthrough.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -require('inherits')(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index 192d4514..00000000 --- a/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,1124 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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'; - -module.exports = Readable; -/**/ - -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; -/**/ - -var EE = require('events').EventEmitter; - -var EElistenerCount = function EElistenerCount(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ - - -var Stream = require('./internal/streams/stream'); -/**/ - - -var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} - -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} -/**/ - - -var debugUtil = require('util'); - -var debug; - -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function debug() {}; -} -/**/ - - -var BufferList = require('./internal/streams/buffer_list'); - -var destroyImpl = require('./internal/streams/destroy'); - -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. - - -var StringDecoder; -var createReadableStreamAsyncIterator; -var from; - -require('inherits')(Readable, Stream); - -var errorOrDestroy = destroyImpl.errorOrDestroy; -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - - this.sync = true; // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') - - this.autoDestroy = !!options.autoDestroy; // has it been destroyed - - this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s - - this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled - - this.readingMore = false; - this.decoder = null; - this.encoding = null; - - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 - - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); // legacy - - this.readable = true; - - if (options) { - if (typeof options.read === 'function') this._read = options.read; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined) { - return false; - } - - return this._readableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - } -}); -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; - -Readable.prototype._destroy = function (err, cb) { - cb(err); -}; // Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. - - -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; // Unshift should *always* be something directly out of read() - - -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; - -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug('readableAddChunk', chunk); - var state = stream._readableState; - - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (addToFront) { - if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - - - return !state.ended && (state.length < state.highWaterMark || state.length === 0); -} - -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit('data', chunk); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); - } - - maybeReadMore(stream, state); -} - -function chunkInvalid(state, chunk) { - var er; - - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); - } - - return er; -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; // backwards compatibility. - - -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 - - this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: - - var p = this._readableState.buffer.head; - var content = ''; - - while (p !== null) { - content += decoder.write(p.data); - p = p.next; - } - - this._readableState.buffer.clear(); - - if (content !== '') this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; -}; // Don't raise the hwm > 1GB - - -var MAX_HWM = 0x40000000; - -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - - return n; -} // This function is designed to be inlinable, so please take care when making -// changes to the function body. - - -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } // If we're asking for more than the current hwm, then raise the hwm. - - - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; // Don't have enough - - if (!state.ended) { - state.needReadable = true; - return 0; - } - - return state.length; -} // you can override either this method, or the async _read(n) below. - - -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. - - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. - - - var doRead = state.needReadable; - debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - - - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; // if the length is currently zero, then we *need* a readable event. - - if (state.length === 0) state.needReadable = true; // call internal read method - - this._read(state.highWaterMark); - - state.sync = false; // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. - - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - return ret; -}; - -function onEofChunk(stream, state) { - debug('onEofChunk'); - if (state.ended) return; - - if (state.decoder) { - var chunk = state.decoder.end(); - - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - - state.ended = true; - - if (state.sync) { - // if we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call - emitReadable(stream); - } else { - // emit 'readable' now to make sure it gets picked up. - state.needReadable = false; - - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } -} // Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. - - -function emitReadable(stream) { - var state = stream._readableState; - debug('emitReadable', state.needReadable, state.emittedReadable); - state.needReadable = false; - - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } -} - -function emitReadable_(stream) { - var state = stream._readableState; - debug('emitReadable_', state.destroyed, state.length, state.ended); - - if (!state.destroyed && (state.length || state.ended)) { - stream.emit('readable'); - state.emittedReadable = false; - } // The stream needs another readable event if - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - - - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); -} // at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. - - -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) // didn't get any data, stop spinning. - break; - } - - state.readingMore = false; -} // abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. - - -Readable.prototype._read = function (n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - - case 1: - state.pipes = [state.pipes, dest]; - break; - - default: - state.pipes.push(dest); - break; - } - - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); - dest.on('unpipe', onunpipe); - - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - - function onend() { - debug('onend'); - dest.end(); - } // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - - - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; - - function cleanup() { - debug('cleanup'); // cleanup event handlers once the pipe is broken - - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - src.on('data', ondata); - - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - debug('dest.write', ret); - - if (ret === false) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - } - - src.pause(); - } - } // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - - - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); - } // Make sure our error handler is attached before userland ones. - - - prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. - - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - - dest.once('close', onclose); - - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } // tell the dest that it's being piped to - - - dest.emit('pipe', src); // start the flow if it hasn't been started already. - - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; // if we're not piping anywhere, then do nothing. - - if (state.pipesCount === 0) return this; // just one destination. most common case. - - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; // got a match. - - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } // slow case. multiple pipe destinations. - - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - } - - return this; - } // try to find the right one. - - - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; -}; // set up data events if they are asked for -// Ensure readable listeners eventually get something - - -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - - if (ev === 'data') { - // update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused - - if (state.flowing !== false) this.resume(); - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug('on readable', state.length, state.reading); - - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - - return res; -}; - -Readable.prototype.addListener = Readable.prototype.on; - -Readable.prototype.removeListener = function (ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - - return res; -}; - -Readable.prototype.removeAllListeners = function (ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - - return res; -}; - -function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount('readable') > 0; - - if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true; // crude way to check if we should resume - } else if (self.listenerCount('data') > 0) { - self.resume(); - } -} - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} // pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. - - -Readable.prototype.resume = function () { - var state = this._readableState; - - if (!state.flowing) { - debug('resume'); // we flow only if there is no one listening - // for readable, but we still have to call - // resume() - - state.flowing = !state.readableListening; - resume(this, state); - } - - state.paused = false; - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - debug('resume', state.reading); - - if (!state.reading) { - stream.read(0); - } - - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - - if (this._readableState.flowing !== false) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - - this._readableState.paused = true; - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - - while (state.flowing && stream.read() !== null) { - ; - } -} // wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. - - -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - stream.on('end', function () { - debug('wrapped end'); - - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - - _this.push(null); - }); - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = _this.push(chunk); - - if (!ret) { - paused = true; - stream.pause(); - } - }); // proxy all the other methods. - // important when wrapping filters and duplexes. - - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } // proxy certain important events. - - - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } // when we try to consume some more bytes, simply unpause the - // underlying stream. - - - this._read = function (n) { - debug('wrapped _read', n); - - if (paused) { - paused = false; - stream.resume(); - } - }; - - return this; -}; - -if (typeof Symbol === 'function') { - Readable.prototype[Symbol.asyncIterator] = function () { - if (createReadableStreamAsyncIterator === undefined) { - createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); - } - - return createReadableStreamAsyncIterator(this); - }; -} - -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.highWaterMark; - } -}); -Object.defineProperty(Readable.prototype, 'readableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState && this._readableState.buffer; - } -}); -Object.defineProperty(Readable.prototype, 'readableFlowing', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } -}); // exposed for testing purposes only. - -Readable._fromList = fromList; -Object.defineProperty(Readable.prototype, 'readableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.length; - } -}); // Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. - -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = state.buffer.consume(n, state.decoder); - } - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - debug('endReadable', state.endEmitted); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. - - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well - var wState = stream._writableState; - - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } - } - } -} - -if (typeof Symbol === 'function') { - Readable.from = function (iterable, opts) { - if (from === undefined) { - from = require('./internal/streams/from'); - } - - return from(Readable, iterable, opts); - }; -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - - return -1; -} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index 41a738c4..00000000 --- a/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. -'use strict'; - -module.exports = Transform; - -var _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - -var Duplex = require('./_stream_duplex'); - -require('inherits')(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - - if (cb === null) { - return this.emit('error', new ERR_MULTIPLE_CALLBACK()); - } - - ts.writechunk = null; - ts.writecb = null; - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; // start out asking for a readable event once data is transformed. - - this._readableState.needReadable = true; // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - if (typeof options.flush === 'function') this._flush = options.flush; - } // When the writable side finishes, then flush out anything remaining. - - - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function' && !this._readableState.destroyed) { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; // This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. - - -Transform.prototype._transform = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; // Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. - - -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); // TODO(BridgeAR): Write a test for these two error cases - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); -} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index a2634d7c..00000000 --- a/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,697 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. -'use strict'; - -module.exports = Writable; -/* */ - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} // It seems a linked list but it is not -// there will be only 2 of these for each stream - - -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ - - -var Duplex; -/**/ - -Writable.WritableState = WritableState; -/**/ - -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ - -var Stream = require('./internal/streams/stream'); -/**/ - - -var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} - -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -var destroyImpl = require('./internal/streams/destroy'); - -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - -var errorOrDestroy = destroyImpl.errorOrDestroy; - -require('inherits')(Writable, Stream); - -function nop() {} - -function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream - // contains buffers or objects. - - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - - this.finalCalled = false; // drain event flag. - - this.needDrain = false; // at the start of calling end() - - this.ending = false; // when end() has been called, and returned - - this.ended = false; // when 'finish' is emitted - - this.finished = false; // has it been destroyed - - this.destroyed = false; // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - - this.length = 0; // a flag to see when we're in the middle of a write. - - this.writing = false; // when true all writes will be buffered until .uncork() call - - this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - - this.sync = true; // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - - this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) - - this.onwrite = function (er) { - onwrite(stream, er); - }; // the callback that the user supplies to write(chunk,encoding,cb) - - - this.writecb = null; // the amount that is being written when _write is called. - - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - - this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - - this.prefinished = false; // True if the error was already emitted and should not be thrown again - - this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') - - this.autoDestroy = !!options.autoDestroy; // count buffered requests - - this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - - while (current) { - out.push(current); - current = current.next; - } - - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); // Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. - - -var realHasInstance; - -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function realHasInstance(object) { - return object instanceof this; - }; -} - -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5 - - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); // legacy. - - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') this._writev = options.writev; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - if (typeof options.final === 'function') this._final = options.final; - } - - Stream.call(this); -} // Otherwise people can pipe Writable streams, which is just wrong. - - -Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); -}; - -function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb - - errorOrDestroy(stream, er); - process.nextTick(cb, er); -} // Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. - - -function validChunk(stream, state, chunk, cb) { - var er; - - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== 'string' && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); - } - - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } - - return true; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; -}; - -Writable.prototype.cork = function () { - this._writableState.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -Object.defineProperty(Writable.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - - return chunk; -} - -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); // if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. - -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. - - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); // this can emit finish, and it will always happen - // after error - - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); // this can emit finish, but finish must - // always follow error - - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state) || stream.destroyed; - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} // Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. - - -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} // if there's something in the buffer waiting, then process it - - -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - - state.pendingcb++; - state.lastBufferedRequest = null; - - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks - - if (state.corked) { - state.corked = 1; - this.uncork(); - } // ignore unnecessary end() calls. - - - if (!state.ending) endWritable(this, state, cb); - return this; -}; - -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} - -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - - if (err) { - errorOrDestroy(stream, err); - } - - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} - -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - - if (need) { - prefinish(stream, state); - - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well - var rState = stream._readableState; - - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } - - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); - } - - state.ended = true; - stream.writable = false; -} - -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } // reuse the free corkReq. - - - state.corkedRequestsFree.next = corkReq; -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; - } - - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._writableState.destroyed = value; - } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; - -Writable.prototype._destroy = function (err, cb) { - cb(err); -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/node_modules/readable-stream/lib/internal/streams/async_iterator.js deleted file mode 100644 index 9fb615a2..00000000 --- a/node_modules/readable-stream/lib/internal/streams/async_iterator.js +++ /dev/null @@ -1,207 +0,0 @@ -'use strict'; - -var _Object$setPrototypeO; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var finished = require('./end-of-stream'); - -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); - -function createIterResult(value, done) { - return { - value: value, - done: done - }; -} - -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; - - if (resolve !== null) { - var data = iter[kStream].read(); // we defer if data is null - // we can be expecting either 'end' or - // 'error' - - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); - } - } -} - -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); -} - -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } - - iter[kHandlePromise](resolve, reject); - }, reject); - }; -} - -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - - next: function next() { - var _this = this; - - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; - - if (error !== null) { - return Promise.reject(error); - } - - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } - - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time - - - var lastPromise = this[kLastPromise]; - var promise; - - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); - } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); - - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - - promise = new Promise(this[kHandlePromise]); - } - - this[kLastPromise] = promise; - return promise; - } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } - - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); - -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; - - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); - - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise - // returned by next() and store the error - - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - - iterator[kError] = err; - return; - } - - var resolve = iterator[kLastResolve]; - - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); - } - - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; -}; - -module.exports = createReadableStreamAsyncIterator; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/node_modules/readable-stream/lib/internal/streams/buffer_list.js deleted file mode 100644 index cdea425f..00000000 --- a/node_modules/readable-stream/lib/internal/streams/buffer_list.js +++ /dev/null @@ -1,210 +0,0 @@ -'use strict'; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('buffer'), - Buffer = _require.Buffer; - -var _require2 = require('util'), - inspect = _require2.inspect; - -var custom = inspect && inspect.custom || 'inspect'; - -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); -} - -module.exports = -/*#__PURE__*/ -function () { - function BufferList() { - _classCallCheck(this, BufferList); - - this.head = null; - this.tail = null; - this.length = 0; - } - - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - - while (p = p.next) { - ret += s + p.data; - } - - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - - return ret; - } // Consumes a specified amount of bytes or characters from the buffered data. - - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } // Consumes a specified amount of characters from the buffered data. - - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - - break; - } - - ++c; - } - - this.length -= c; - return ret; - } // Consumes a specified amount of bytes from the buffered data. - - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } - - break; - } - - ++c; - } - - this.length -= c; - return ret; - } // Make sure the linked list only shows the minimal necessary information. - - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); - } - }]); - - return BufferList; -}(); \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/destroy.js b/node_modules/readable-stream/lib/internal/streams/destroy.js deleted file mode 100644 index 3268a16f..00000000 --- a/node_modules/readable-stream/lib/internal/streams/destroy.js +++ /dev/null @@ -1,105 +0,0 @@ -'use strict'; // undocumented cb() API, needed for core, not for public API - -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - - return this; - } // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - - if (this._readableState) { - this._readableState.destroyed = true; - } // if this is a duplex stream mark the writable part as destroyed as well - - - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - - return this; -} - -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); -} - -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -function errorOrDestroy(stream, err) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy, - errorOrDestroy: errorOrDestroy -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/node_modules/readable-stream/lib/internal/streams/end-of-stream.js deleted file mode 100644 index 831f286d..00000000 --- a/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +++ /dev/null @@ -1,104 +0,0 @@ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; - -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; - -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - callback.apply(this, args); - }; -} - -function noop() {} - -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} - -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; - - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; - - var writableEnded = stream._writableState && stream._writableState.finished; - - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; - - var readableEnded = stream._readableState && stream._readableState.endEmitted; - - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; - - var onerror = function onerror(err) { - callback.call(stream, err); - }; - - var onclose = function onclose() { - var err; - - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; - - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); - } - - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; -} - -module.exports = eos; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/from-browser.js b/node_modules/readable-stream/lib/internal/streams/from-browser.js deleted file mode 100644 index a4ce56f3..00000000 --- a/node_modules/readable-stream/lib/internal/streams/from-browser.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function () { - throw new Error('Readable.from is not available in the browser') -}; diff --git a/node_modules/readable-stream/lib/internal/streams/from.js b/node_modules/readable-stream/lib/internal/streams/from.js deleted file mode 100644 index 6c412844..00000000 --- a/node_modules/readable-stream/lib/internal/streams/from.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE; - -function from(Readable, iterable, opts) { - var iterator; - - if (iterable && typeof iterable.next === 'function') { - iterator = iterable; - } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); - - var readable = new Readable(_objectSpread({ - objectMode: true - }, opts)); // Reading boolean to protect against _read - // being called before last iteration completion. - - var reading = false; - - readable._read = function () { - if (!reading) { - reading = true; - next(); - } - }; - - function next() { - return _next2.apply(this, arguments); - } - - function _next2() { - _next2 = _asyncToGenerator(function* () { - try { - var _ref = yield iterator.next(), - value = _ref.value, - done = _ref.done; - - if (done) { - readable.push(null); - } else if (readable.push((yield value))) { - next(); - } else { - reading = false; - } - } catch (err) { - readable.destroy(err); - } - }); - return _next2.apply(this, arguments); - } - - return readable; -} - -module.exports = from; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/pipeline.js b/node_modules/readable-stream/lib/internal/streams/pipeline.js deleted file mode 100644 index 65899098..00000000 --- a/node_modules/readable-stream/lib/internal/streams/pipeline.js +++ /dev/null @@ -1,97 +0,0 @@ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; - -var eos; - -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); - }; -} - -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; -} - -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} - -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; // request.destroy just do .end - .abort is what we want - - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); - }; -} - -function call(fn) { - fn(); -} - -function pipe(from, to) { - return from.pipe(to); -} - -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); -} - -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; - - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); - } - - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); -} - -module.exports = pipeline; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/state.js b/node_modules/readable-stream/lib/internal/streams/state.js deleted file mode 100644 index 19887eb8..00000000 --- a/node_modules/readable-stream/lib/internal/streams/state.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; - -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; -} - -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - - return Math.floor(hwm); - } // Default value - - - return state.objectMode ? 16 : 16 * 1024; -} - -module.exports = { - getHighWaterMark: getHighWaterMark -}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/node_modules/readable-stream/lib/internal/streams/stream-browser.js deleted file mode 100644 index 9332a3fd..00000000 --- a/node_modules/readable-stream/lib/internal/streams/stream-browser.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('events').EventEmitter; diff --git a/node_modules/readable-stream/lib/internal/streams/stream.js b/node_modules/readable-stream/lib/internal/streams/stream.js deleted file mode 100644 index ce2ad5b6..00000000 --- a/node_modules/readable-stream/lib/internal/streams/stream.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('stream'); diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json deleted file mode 100644 index 004232d7..00000000 --- a/node_modules/readable-stream/package.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "_from": "readable-stream@^3.6.0", - "_id": "readable-stream@3.6.0", - "_inBundle": false, - "_integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "_location": "/readable-stream", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "readable-stream@^3.6.0", - "name": "readable-stream", - "escapedName": "readable-stream", - "rawSpec": "^3.6.0", - "saveSpec": null, - "fetchSpec": "^3.6.0" - }, - "_requiredBy": [ - "/concat-stream", - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "_shasum": "337bbda3adc0706bd3e024426a286d4b4b2c9198", - "_spec": "readable-stream@^3.6.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "browser": { - "util": false, - "worker_threads": false, - "./errors": "./errors-browser.js", - "./readable.js": "./readable-browser.js", - "./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js", - "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" - }, - "bugs": { - "url": "https://github.com/nodejs/readable-stream/issues" - }, - "bundleDependencies": false, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "deprecated": false, - "description": "Streams3, a user-land copy of the stream library from Node.js", - "devDependencies": { - "@babel/cli": "^7.2.0", - "@babel/core": "^7.2.0", - "@babel/polyfill": "^7.0.0", - "@babel/preset-env": "^7.2.0", - "airtap": "0.0.9", - "assert": "^1.4.0", - "bl": "^2.0.0", - "deep-strict-equal": "^0.2.0", - "events.once": "^2.0.2", - "glob": "^7.1.2", - "gunzip-maybe": "^1.4.1", - "hyperquest": "^2.1.3", - "lolex": "^2.6.0", - "nyc": "^11.0.0", - "pump": "^3.0.0", - "rimraf": "^2.6.2", - "tap": "^12.0.0", - "tape": "^4.9.0", - "tar-fs": "^1.16.2", - "util-promisify": "^2.1.0" - }, - "engines": { - "node": ">= 6" - }, - "homepage": "https://github.com/nodejs/readable-stream#readme", - "keywords": [ - "readable", - "stream", - "pipe" - ], - "license": "MIT", - "main": "readable.js", - "name": "readable-stream", - "nyc": { - "include": [ - "lib/**.js" - ] - }, - "repository": { - "type": "git", - "url": "git://github.com/nodejs/readable-stream.git" - }, - "scripts": { - "ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap", - "cover": "nyc npm test", - "report": "nyc report --reporter=lcov", - "test": "tap -J --no-esm test/parallel/*.js test/ours/*.js", - "test-browser-local": "airtap --open --local -- test/browser.js", - "test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js", - "update-browser-errors": "babel -o errors-browser.js errors.js" - }, - "version": "3.6.0" -} diff --git a/node_modules/readable-stream/readable-browser.js b/node_modules/readable-stream/readable-browser.js deleted file mode 100644 index adbf60de..00000000 --- a/node_modules/readable-stream/readable-browser.js +++ /dev/null @@ -1,9 +0,0 @@ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); -exports.finished = require('./lib/internal/streams/end-of-stream.js'); -exports.pipeline = require('./lib/internal/streams/pipeline.js'); diff --git a/node_modules/readable-stream/readable.js b/node_modules/readable-stream/readable.js deleted file mode 100644 index 9e0ca120..00000000 --- a/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,16 +0,0 @@ -var Stream = require('stream'); -if (process.env.READABLE_STREAM === 'disable' && Stream) { - module.exports = Stream.Readable; - Object.assign(module.exports, Stream); - module.exports.Stream = Stream; -} else { - exports = module.exports = require('./lib/_stream_readable.js'); - exports.Stream = Stream || exports; - exports.Readable = exports; - exports.Writable = require('./lib/_stream_writable.js'); - exports.Duplex = require('./lib/_stream_duplex.js'); - exports.Transform = require('./lib/_stream_transform.js'); - exports.PassThrough = require('./lib/_stream_passthrough.js'); - exports.finished = require('./lib/internal/streams/end-of-stream.js'); - exports.pipeline = require('./lib/internal/streams/pipeline.js'); -} diff --git a/node_modules/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE deleted file mode 100644 index 0c068cee..00000000 --- a/node_modules/safe-buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Feross Aboukhadijeh - -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. diff --git a/node_modules/safe-buffer/README.md b/node_modules/safe-buffer/README.md deleted file mode 100644 index e9a81afd..00000000 --- a/node_modules/safe-buffer/README.md +++ /dev/null @@ -1,584 +0,0 @@ -# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] - -[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg -[travis-url]: https://travis-ci.org/feross/safe-buffer -[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg -[npm-url]: https://npmjs.org/package/safe-buffer -[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg -[downloads-url]: https://npmjs.org/package/safe-buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com - -#### Safer Node.js Buffer API - -**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, -`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** - -**Uses the built-in implementation when available.** - -## install - -``` -npm install safe-buffer -``` - -## usage - -The goal of this package is to provide a safe replacement for the node.js `Buffer`. - -It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to -the top of your node.js modules: - -```js -var Buffer = require('safe-buffer').Buffer - -// Existing buffer code will continue to work without issues: - -new Buffer('hey', 'utf8') -new Buffer([1, 2, 3], 'utf8') -new Buffer(obj) -new Buffer(16) // create an uninitialized buffer (potentially unsafe) - -// But you can use these new explicit APIs to make clear what you want: - -Buffer.from('hey', 'utf8') // convert from many types to a Buffer -Buffer.alloc(16) // create a zero-filled buffer (safe) -Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) -``` - -## api - -### Class Method: Buffer.from(array) - - -* `array` {Array} - -Allocates a new `Buffer` using an `array` of octets. - -```js -const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); - // creates a new Buffer containing ASCII bytes - // ['b','u','f','f','e','r'] -``` - -A `TypeError` will be thrown if `array` is not an `Array`. - -### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) - - -* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or - a `new ArrayBuffer()` -* `byteOffset` {Number} Default: `0` -* `length` {Number} Default: `arrayBuffer.length - byteOffset` - -When passed a reference to the `.buffer` property of a `TypedArray` instance, -the newly created `Buffer` will share the same allocated memory as the -TypedArray. - -```js -const arr = new Uint16Array(2); -arr[0] = 5000; -arr[1] = 4000; - -const buf = Buffer.from(arr.buffer); // shares the memory with arr; - -console.log(buf); - // Prints: - -// changing the TypedArray changes the Buffer also -arr[1] = 6000; - -console.log(buf); - // Prints: -``` - -The optional `byteOffset` and `length` arguments specify a memory range within -the `arrayBuffer` that will be shared by the `Buffer`. - -```js -const ab = new ArrayBuffer(10); -const buf = Buffer.from(ab, 0, 2); -console.log(buf.length); - // Prints: 2 -``` - -A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. - -### Class Method: Buffer.from(buffer) - - -* `buffer` {Buffer} - -Copies the passed `buffer` data onto a new `Buffer` instance. - -```js -const buf1 = Buffer.from('buffer'); -const buf2 = Buffer.from(buf1); - -buf1[0] = 0x61; -console.log(buf1.toString()); - // 'auffer' -console.log(buf2.toString()); - // 'buffer' (copy is not changed) -``` - -A `TypeError` will be thrown if `buffer` is not a `Buffer`. - -### Class Method: Buffer.from(str[, encoding]) - - -* `str` {String} String to encode. -* `encoding` {String} Encoding to use, Default: `'utf8'` - -Creates a new `Buffer` containing the given JavaScript string `str`. If -provided, the `encoding` parameter identifies the character encoding. -If not provided, `encoding` defaults to `'utf8'`. - -```js -const buf1 = Buffer.from('this is a tést'); -console.log(buf1.toString()); - // prints: this is a tést -console.log(buf1.toString('ascii')); - // prints: this is a tC)st - -const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); -console.log(buf2.toString()); - // prints: this is a tést -``` - -A `TypeError` will be thrown if `str` is not a string. - -### Class Method: Buffer.alloc(size[, fill[, encoding]]) - - -* `size` {Number} -* `fill` {Value} Default: `undefined` -* `encoding` {String} Default: `utf8` - -Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the -`Buffer` will be *zero-filled*. - -```js -const buf = Buffer.alloc(5); -console.log(buf); - // -``` - -The `size` must be less than or equal to the value of -`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is -`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will -be created if a `size` less than or equal to 0 is specified. - -If `fill` is specified, the allocated `Buffer` will be initialized by calling -`buf.fill(fill)`. See [`buf.fill()`][] for more information. - -```js -const buf = Buffer.alloc(5, 'a'); -console.log(buf); - // -``` - -If both `fill` and `encoding` are specified, the allocated `Buffer` will be -initialized by calling `buf.fill(fill, encoding)`. For example: - -```js -const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); -console.log(buf); - // -``` - -Calling `Buffer.alloc(size)` can be significantly slower than the alternative -`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance -contents will *never contain sensitive data*. - -A `TypeError` will be thrown if `size` is not a number. - -### Class Method: Buffer.allocUnsafe(size) - - -* `size` {Number} - -Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must -be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit -architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is -thrown. A zero-length Buffer will be created if a `size` less than or equal to -0 is specified. - -The underlying memory for `Buffer` instances created in this way is *not -initialized*. The contents of the newly created `Buffer` are unknown and -*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such -`Buffer` instances to zeroes. - -```js -const buf = Buffer.allocUnsafe(5); -console.log(buf); - // - // (octets will be different, every time) -buf.fill(0); -console.log(buf); - // -``` - -A `TypeError` will be thrown if `size` is not a number. - -Note that the `Buffer` module pre-allocates an internal `Buffer` instance of -size `Buffer.poolSize` that is used as a pool for the fast allocation of new -`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated -`new Buffer(size)` constructor) only when `size` is less than or equal to -`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default -value of `Buffer.poolSize` is `8192` but can be modified. - -Use of this pre-allocated internal memory pool is a key difference between -calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. -Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer -pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal -Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The -difference is subtle but can be important when an application requires the -additional performance that `Buffer.allocUnsafe(size)` provides. - -### Class Method: Buffer.allocUnsafeSlow(size) - - -* `size` {Number} - -Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The -`size` must be less than or equal to the value of -`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is -`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will -be created if a `size` less than or equal to 0 is specified. - -The underlying memory for `Buffer` instances created in this way is *not -initialized*. The contents of the newly created `Buffer` are unknown and -*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such -`Buffer` instances to zeroes. - -When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, -allocations under 4KB are, by default, sliced from a single pre-allocated -`Buffer`. This allows applications to avoid the garbage collection overhead of -creating many individually allocated Buffers. This approach improves both -performance and memory usage by eliminating the need to track and cleanup as -many `Persistent` objects. - -However, in the case where a developer may need to retain a small chunk of -memory from a pool for an indeterminate amount of time, it may be appropriate -to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then -copy out the relevant bits. - -```js -// need to keep around a few small chunks of memory -const store = []; - -socket.on('readable', () => { - const data = socket.read(); - // allocate for retained data - const sb = Buffer.allocUnsafeSlow(10); - // copy the data into the new allocation - data.copy(sb, 0, 0, 10); - store.push(sb); -}); -``` - -Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* -a developer has observed undue memory retention in their applications. - -A `TypeError` will be thrown if `size` is not a number. - -### All the Rest - -The rest of the `Buffer` API is exactly the same as in node.js. -[See the docs](https://nodejs.org/api/buffer.html). - - -## Related links - -- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) -- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) - -## Why is `Buffer` unsafe? - -Today, the node.js `Buffer` constructor is overloaded to handle many different argument -types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), -`ArrayBuffer`, and also `Number`. - -The API is optimized for convenience: you can throw any type at it, and it will try to do -what you want. - -Because the Buffer constructor is so powerful, you often see code like this: - -```js -// Convert UTF-8 strings to hex -function toHex (str) { - return new Buffer(str).toString('hex') -} -``` - -***But what happens if `toHex` is called with a `Number` argument?*** - -### Remote Memory Disclosure - -If an attacker can make your program call the `Buffer` constructor with a `Number` -argument, then they can make it allocate uninitialized memory from the node.js process. -This could potentially disclose TLS private keys, user data, or database passwords. - -When the `Buffer` constructor is passed a `Number` argument, it returns an -**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like -this, you **MUST** overwrite the contents before returning it to the user. - -From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): - -> `new Buffer(size)` -> -> - `size` Number -> -> The underlying memory for `Buffer` instances created in this way is not initialized. -> **The contents of a newly created `Buffer` are unknown and could contain sensitive -> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. - -(Emphasis our own.) - -Whenever the programmer intended to create an uninitialized `Buffer` you often see code -like this: - -```js -var buf = new Buffer(16) - -// Immediately overwrite the uninitialized buffer with data from another buffer -for (var i = 0; i < buf.length; i++) { - buf[i] = otherBuf[i] -} -``` - - -### Would this ever be a problem in real code? - -Yes. It's surprisingly common to forget to check the type of your variables in a -dynamically-typed language like JavaScript. - -Usually the consequences of assuming the wrong type is that your program crashes with an -uncaught exception. But the failure mode for forgetting to check the type of arguments to -the `Buffer` constructor is more catastrophic. - -Here's an example of a vulnerable service that takes a JSON payload and converts it to -hex: - -```js -// Take a JSON payload {str: "some string"} and convert it to hex -var server = http.createServer(function (req, res) { - var data = '' - req.setEncoding('utf8') - req.on('data', function (chunk) { - data += chunk - }) - req.on('end', function () { - var body = JSON.parse(data) - res.end(new Buffer(body.str).toString('hex')) - }) -}) - -server.listen(8080) -``` - -In this example, an http client just has to send: - -```json -{ - "str": 1000 -} -``` - -and it will get back 1,000 bytes of uninitialized memory from the server. - -This is a very serious bug. It's similar in severity to the -[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process -memory by remote attackers. - - -### Which real-world packages were vulnerable? - -#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) - -[Mathias Buus](https://github.com/mafintosh) and I -([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, -[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow -anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get -them to reveal 20 bytes at a time of uninitialized memory from the node.js process. - -Here's -[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) -that fixed it. We released a new fixed version, created a -[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all -vulnerable versions on npm so users will get a warning to upgrade to a newer version. - -#### [`ws`](https://www.npmjs.com/package/ws) - -That got us wondering if there were other vulnerable packages. Sure enough, within a short -period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the -most popular WebSocket implementation in node.js. - -If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as -expected, then uninitialized server memory would be disclosed to the remote peer. - -These were the vulnerable methods: - -```js -socket.send(number) -socket.ping(number) -socket.pong(number) -``` - -Here's a vulnerable socket server with some echo functionality: - -```js -server.on('connection', function (socket) { - socket.on('message', function (message) { - message = JSON.parse(message) - if (message.type === 'echo') { - socket.send(message.data) // send back the user's message - } - }) -}) -``` - -`socket.send(number)` called on the server, will disclose server memory. - -Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue -was fixed, with a more detailed explanation. Props to -[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the -[Node Security Project disclosure](https://nodesecurity.io/advisories/67). - - -### What's the solution? - -It's important that node.js offers a fast way to get memory otherwise performance-critical -applications would needlessly get a lot slower. - -But we need a better way to *signal our intent* as programmers. **When we want -uninitialized memory, we should request it explicitly.** - -Sensitive functionality should not be packed into a developer-friendly API that loosely -accepts many different types. This type of API encourages the lazy practice of passing -variables in without checking the type very carefully. - -#### A new API: `Buffer.allocUnsafe(number)` - -The functionality of creating buffers with uninitialized memory should be part of another -API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that -frequently gets user input of all sorts of different types passed into it. - -```js -var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! - -// Immediately overwrite the uninitialized buffer with data from another buffer -for (var i = 0; i < buf.length; i++) { - buf[i] = otherBuf[i] -} -``` - - -### How do we fix node.js core? - -We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as -`semver-major`) which defends against one case: - -```js -var str = 16 -new Buffer(str, 'utf8') -``` - -In this situation, it's implied that the programmer intended the first argument to be a -string, since they passed an encoding as a second argument. Today, node.js will allocate -uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not -what the programmer intended. - -But this is only a partial solution, since if the programmer does `new Buffer(variable)` -(without an `encoding` parameter) there's no way to know what they intended. If `variable` -is sometimes a number, then uninitialized memory will sometimes be returned. - -### What's the real long-term fix? - -We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when -we need uninitialized memory. But that would break 1000s of packages. - -~~We believe the best solution is to:~~ - -~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ - -~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ - -#### Update - -We now support adding three new APIs: - -- `Buffer.from(value)` - convert from any type to a buffer -- `Buffer.alloc(size)` - create a zero-filled buffer -- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size - -This solves the core problem that affected `ws` and `bittorrent-dht` which is -`Buffer(variable)` getting tricked into taking a number argument. - -This way, existing code continues working and the impact on the npm ecosystem will be -minimal. Over time, npm maintainers can migrate performance-critical code to use -`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. - - -### Conclusion - -We think there's a serious design issue with the `Buffer` API as it exists today. It -promotes insecure software by putting high-risk functionality into a convenient API -with friendly "developer ergonomics". - -This wasn't merely a theoretical exercise because we found the issue in some of the -most popular npm packages. - -Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of -`buffer`. - -```js -var Buffer = require('safe-buffer').Buffer -``` - -Eventually, we hope that node.js core can switch to this new, safer behavior. We believe -the impact on the ecosystem would be minimal since it's not a breaking change. -Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while -older, insecure packages would magically become safe from this attack vector. - - -## links - -- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) -- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) -- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) - - -## credit - -The original issues in `bittorrent-dht` -([disclosure](https://nodesecurity.io/advisories/68)) and -`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by -[Mathias Buus](https://github.com/mafintosh) and -[Feross Aboukhadijeh](http://feross.org/). - -Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues -and for his work running the [Node Security Project](https://nodesecurity.io/). - -Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and -auditing the code. - - -## license - -MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/node_modules/safe-buffer/index.d.ts b/node_modules/safe-buffer/index.d.ts deleted file mode 100644 index e9fed809..00000000 --- a/node_modules/safe-buffer/index.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -declare module "safe-buffer" { - export class Buffer { - length: number - write(string: string, offset?: number, length?: number, encoding?: string): number; - toString(encoding?: string, start?: number, end?: number): string; - toJSON(): { type: 'Buffer', data: any[] }; - equals(otherBuffer: Buffer): boolean; - compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; - copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - slice(start?: number, end?: number): Buffer; - writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readUInt8(offset: number, noAssert?: boolean): number; - readUInt16LE(offset: number, noAssert?: boolean): number; - readUInt16BE(offset: number, noAssert?: boolean): number; - readUInt32LE(offset: number, noAssert?: boolean): number; - readUInt32BE(offset: number, noAssert?: boolean): number; - readInt8(offset: number, noAssert?: boolean): number; - readInt16LE(offset: number, noAssert?: boolean): number; - readInt16BE(offset: number, noAssert?: boolean): number; - readInt32LE(offset: number, noAssert?: boolean): number; - readInt32BE(offset: number, noAssert?: boolean): number; - readFloatLE(offset: number, noAssert?: boolean): number; - readFloatBE(offset: number, noAssert?: boolean): number; - readDoubleLE(offset: number, noAssert?: boolean): number; - readDoubleBE(offset: number, noAssert?: boolean): number; - swap16(): Buffer; - swap32(): Buffer; - swap64(): Buffer; - writeUInt8(value: number, offset: number, noAssert?: boolean): number; - writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeInt8(value: number, offset: number, noAssert?: boolean): number; - writeInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeFloatLE(value: number, offset: number, noAssert?: boolean): number; - writeFloatBE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; - fill(value: any, offset?: number, end?: number): this; - indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; - - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - */ - constructor (str: string, encoding?: string); - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - */ - constructor (size: number); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: Uint8Array); - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}. - * - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - */ - constructor (arrayBuffer: ArrayBuffer); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: any[]); - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - */ - constructor (buffer: Buffer); - prototype: Buffer; - /** - * Allocates a new Buffer using an {array} of octets. - * - * @param array - */ - static from(array: any[]): Buffer; - /** - * When passed a reference to the .buffer property of a TypedArray instance, - * the newly created Buffer will share the same allocated memory as the TypedArray. - * The optional {byteOffset} and {length} arguments specify a memory range - * within the {arrayBuffer} that will be shared by the Buffer. - * - * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() - * @param byteOffset - * @param length - */ - static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * Copies the passed {buffer} data onto a new Buffer instance. - * - * @param buffer - */ - static from(buffer: Buffer): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - * - * @param str - */ - static from(str: string, encoding?: string): Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - static isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - static isEncoding(encoding: string): boolean; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - static byteLength(string: string, encoding?: string): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - static concat(list: Buffer[], totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - static compare(buf1: Buffer, buf2: Buffer): number; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @param fill if specified, buffer will be initialized by calling buf.fill(fill). - * If parameter is omitted, buffer will be filled with zeros. - * @param encoding encoding used for call to buf.fill while initalizing - */ - static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; - /** - * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafe(size: number): Buffer; - /** - * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafeSlow(size: number): Buffer; - } -} \ No newline at end of file diff --git a/node_modules/safe-buffer/index.js b/node_modules/safe-buffer/index.js deleted file mode 100644 index f8d3ec98..00000000 --- a/node_modules/safe-buffer/index.js +++ /dev/null @@ -1,65 +0,0 @@ -/*! safe-buffer. MIT License. Feross Aboukhadijeh */ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.prototype = Object.create(Buffer.prototype) - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} diff --git a/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json deleted file mode 100644 index 224f01b1..00000000 --- a/node_modules/safe-buffer/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "_from": "safe-buffer@~5.2.0", - "_id": "safe-buffer@5.2.1", - "_inBundle": false, - "_integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "_location": "/safe-buffer", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "safe-buffer@~5.2.0", - "name": "safe-buffer", - "escapedName": "safe-buffer", - "rawSpec": "~5.2.0", - "saveSpec": null, - "fetchSpec": "~5.2.0" - }, - "_requiredBy": [ - "/string_decoder" - ], - "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "_shasum": "1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6", - "_spec": "safe-buffer@~5.2.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/string_decoder", - "author": { - "name": "Feross Aboukhadijeh", - "email": "feross@feross.org", - "url": "https://feross.org" - }, - "bugs": { - "url": "https://github.com/feross/safe-buffer/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Safer Node.js Buffer API", - "devDependencies": { - "standard": "*", - "tape": "^5.0.0" - }, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "homepage": "https://github.com/feross/safe-buffer", - "keywords": [ - "buffer", - "buffer allocate", - "node security", - "safe", - "safe-buffer", - "security", - "uninitialized" - ], - "license": "MIT", - "main": "index.js", - "name": "safe-buffer", - "repository": { - "type": "git", - "url": "git://github.com/feross/safe-buffer.git" - }, - "scripts": { - "test": "standard && tape test/*.js" - }, - "types": "index.d.ts", - "version": "5.2.1" -} diff --git a/node_modules/semver/CHANGELOG.md b/node_modules/semver/CHANGELOG.md deleted file mode 100644 index 66304fdd..00000000 --- a/node_modules/semver/CHANGELOG.md +++ /dev/null @@ -1,39 +0,0 @@ -# changes log - -## 5.7 - -* Add `minVersion` method - -## 5.6 - -* Move boolean `loose` param to an options object, with - backwards-compatibility protection. -* Add ability to opt out of special prerelease version handling with - the `includePrerelease` option flag. - -## 5.5 - -* Add version coercion capabilities - -## 5.4 - -* Add intersection checking - -## 5.3 - -* Add `minSatisfying` method - -## 5.2 - -* Add `prerelease(v)` that returns prerelease components - -## 5.1 - -* Add Backus-Naur for ranges -* Remove excessively cute inspection methods - -## 5.0 - -* Remove AMD/Browserified build artifacts -* Fix ltr and gtr when using the `*` range -* Fix for range `*` with a prerelease identifier diff --git a/node_modules/semver/LICENSE b/node_modules/semver/LICENSE deleted file mode 100644 index 19129e31..00000000 --- a/node_modules/semver/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md deleted file mode 100644 index f8dfa5a0..00000000 --- a/node_modules/semver/README.md +++ /dev/null @@ -1,412 +0,0 @@ -semver(1) -- The semantic versioner for npm -=========================================== - -## Install - -```bash -npm install --save semver -```` - -## Usage - -As a node module: - -```js -const semver = require('semver') - -semver.valid('1.2.3') // '1.2.3' -semver.valid('a.b.c') // null -semver.clean(' =v1.2.3 ') // '1.2.3' -semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true -semver.gt('1.2.3', '9.8.7') // false -semver.lt('1.2.3', '9.8.7') // true -semver.minVersion('>=1.0.0') // '1.0.0' -semver.valid(semver.coerce('v2')) // '2.0.0' -semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' -``` - -As a command-line utility: - -``` -$ semver -h - -A JavaScript implementation of the https://semver.org/ specification -Copyright Isaac Z. Schlueter - -Usage: semver [options] [ [...]] -Prints valid versions sorted by SemVer precedence - -Options: --r --range - Print versions that match the specified range. - --i --increment [] - Increment a version by the specified level. Level can - be one of: major, minor, patch, premajor, preminor, - prepatch, or prerelease. Default level is 'patch'. - Only one version may be specified. - ---preid - Identifier to be used to prefix premajor, preminor, - prepatch or prerelease version increments. - --l --loose - Interpret versions and ranges loosely - --p --include-prerelease - Always include prerelease versions in range matching - --c --coerce - Coerce a string into SemVer if possible - (does not imply --loose) - -Program exits successfully if any valid version satisfies -all supplied ranges, and prints all satisfying versions. - -If no satisfying versions are found, then exits failure. - -Versions are printed in ascending order, so supplying -multiple versions to the utility will just sort them. -``` - -## Versions - -A "version" is described by the `v2.0.0` specification found at -. - -A leading `"="` or `"v"` character is stripped off and ignored. - -## Ranges - -A `version range` is a set of `comparators` which specify versions -that satisfy the range. - -A `comparator` is composed of an `operator` and a `version`. The set -of primitive `operators` is: - -* `<` Less than -* `<=` Less than or equal to -* `>` Greater than -* `>=` Greater than or equal to -* `=` Equal. If no operator is specified, then equality is assumed, - so this operator is optional, but MAY be included. - -For example, the comparator `>=1.2.7` would match the versions -`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` -or `1.1.0`. - -Comparators can be joined by whitespace to form a `comparator set`, -which is satisfied by the **intersection** of all of the comparators -it includes. - -A range is composed of one or more comparator sets, joined by `||`. A -version matches a range if and only if every comparator in at least -one of the `||`-separated comparator sets is satisfied by the version. - -For example, the range `>=1.2.7 <1.3.0` would match the versions -`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, -or `1.1.0`. - -The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, -`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. - -### Prerelease Tags - -If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then -it will only be allowed to satisfy comparator sets if at least one -comparator with the same `[major, minor, patch]` tuple also has a -prerelease tag. - -For example, the range `>1.2.3-alpha.3` would be allowed to match the -version `1.2.3-alpha.7`, but it would *not* be satisfied by -`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater -than" `1.2.3-alpha.3` according to the SemVer sort rules. The version -range only accepts prerelease tags on the `1.2.3` version. The -version `3.4.5` *would* satisfy the range, because it does not have a -prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. - -The purpose for this behavior is twofold. First, prerelease versions -frequently are updated very quickly, and contain many breaking changes -that are (by the author's design) not yet fit for public consumption. -Therefore, by default, they are excluded from range matching -semantics. - -Second, a user who has opted into using a prerelease version has -clearly indicated the intent to use *that specific* set of -alpha/beta/rc versions. By including a prerelease tag in the range, -the user is indicating that they are aware of the risk. However, it -is still not appropriate to assume that they have opted into taking a -similar risk on the *next* set of prerelease versions. - -Note that this behavior can be suppressed (treating all prerelease -versions as if they were normal versions, for the purpose of range -matching) by setting the `includePrerelease` flag on the options -object to any -[functions](https://github.com/npm/node-semver#functions) that do -range matching. - -#### Prerelease Identifiers - -The method `.inc` takes an additional `identifier` string argument that -will append the value of the string as a prerelease identifier: - -```javascript -semver.inc('1.2.3', 'prerelease', 'beta') -// '1.2.4-beta.0' -``` - -command-line example: - -```bash -$ semver 1.2.3 -i prerelease --preid beta -1.2.4-beta.0 -``` - -Which then can be used to increment further: - -```bash -$ semver 1.2.4-beta.0 -i prerelease -1.2.4-beta.1 -``` - -### Advanced Range Syntax - -Advanced range syntax desugars to primitive comparators in -deterministic ways. - -Advanced ranges may be combined in the same way as primitive -comparators using white space or `||`. - -#### Hyphen Ranges `X.Y.Z - A.B.C` - -Specifies an inclusive set. - -* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` - -If a partial version is provided as the first version in the inclusive -range, then the missing pieces are replaced with zeroes. - -* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` - -If a partial version is provided as the second version in the -inclusive range, then all versions that start with the supplied parts -of the tuple are accepted, but nothing that would be greater than the -provided tuple parts. - -* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` -* `1.2.3 - 2` := `>=1.2.3 <3.0.0` - -#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` - -Any of `X`, `x`, or `*` may be used to "stand in" for one of the -numeric values in the `[major, minor, patch]` tuple. - -* `*` := `>=0.0.0` (Any version satisfies) -* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) -* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) - -A partial version range is treated as an X-Range, so the special -character is in fact optional. - -* `""` (empty string) := `*` := `>=0.0.0` -* `1` := `1.x.x` := `>=1.0.0 <2.0.0` -* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` - -#### Tilde Ranges `~1.2.3` `~1.2` `~1` - -Allows patch-level changes if a minor version is specified on the -comparator. Allows minor-level changes if not. - -* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` -* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) -* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) -* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` -* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) -* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) -* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. - -#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` - -Allows changes that do not modify the left-most non-zero digit in the -`[major, minor, patch]` tuple. In other words, this allows patch and -minor updates for versions `1.0.0` and above, patch updates for -versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. - -Many authors treat a `0.x` version as if the `x` were the major -"breaking-change" indicator. - -Caret ranges are ideal when an author may make breaking changes -between `0.2.4` and `0.3.0` releases, which is a common practice. -However, it presumes that there will *not* be breaking changes between -`0.2.4` and `0.2.5`. It allows for changes that are presumed to be -additive (but non-breaking), according to commonly observed practices. - -* `^1.2.3` := `>=1.2.3 <2.0.0` -* `^0.2.3` := `>=0.2.3 <0.3.0` -* `^0.0.3` := `>=0.0.3 <0.0.4` -* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. -* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the - `0.0.3` version *only* will be allowed, if they are greater than or - equal to `beta`. So, `0.0.3-pr.2` would be allowed. - -When parsing caret ranges, a missing `patch` value desugars to the -number `0`, but will allow flexibility within that value, even if the -major and minor versions are both `0`. - -* `^1.2.x` := `>=1.2.0 <2.0.0` -* `^0.0.x` := `>=0.0.0 <0.1.0` -* `^0.0` := `>=0.0.0 <0.1.0` - -A missing `minor` and `patch` values will desugar to zero, but also -allow flexibility within those values, even if the major version is -zero. - -* `^1.x` := `>=1.0.0 <2.0.0` -* `^0.x` := `>=0.0.0 <1.0.0` - -### Range Grammar - -Putting all this together, here is a Backus-Naur grammar for ranges, -for the benefit of parser authors: - -```bnf -range-set ::= range ( logical-or range ) * -logical-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' - ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '.' part ) * -part ::= nr | [-0-9A-Za-z]+ -``` - -## Functions - -All methods and classes take a final `options` object argument. All -options in this object are `false` by default. The options supported -are: - -- `loose` Be more forgiving about not-quite-valid semver strings. - (Any resulting output will always be 100% strict compliant, of - course.) For backwards compatibility reasons, if the `options` - argument is a boolean value instead of an object, it is interpreted - to be the `loose` param. -- `includePrerelease` Set to suppress the [default - behavior](https://github.com/npm/node-semver#prerelease-tags) of - excluding prerelease tagged versions from ranges unless they are - explicitly opted into. - -Strict-mode Comparators and Ranges will be strict about the SemVer -strings that they parse. - -* `valid(v)`: Return the parsed version, or null if it's not valid. -* `inc(v, release)`: Return the version incremented by the release - type (`major`, `premajor`, `minor`, `preminor`, `patch`, - `prepatch`, or `prerelease`), or null if it's not valid - * `premajor` in one call will bump the version up to the next major - version and down to a prerelease of that major version. - `preminor`, and `prepatch` work the same way. - * If called from a non-prerelease version, the `prerelease` will work the - same as `prepatch`. It increments the patch version, then makes a - prerelease. If the input version is already a prerelease it simply - increments it. -* `prerelease(v)`: Returns an array of prerelease components, or null - if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` -* `major(v)`: Return the major version number. -* `minor(v)`: Return the minor version number. -* `patch(v)`: Return the patch version number. -* `intersects(r1, r2, loose)`: Return true if the two supplied ranges - or comparators intersect. -* `parse(v)`: Attempt to parse a string as a semantic version, returning either - a `SemVer` object or `null`. - -### Comparison - -* `gt(v1, v2)`: `v1 > v2` -* `gte(v1, v2)`: `v1 >= v2` -* `lt(v1, v2)`: `v1 < v2` -* `lte(v1, v2)`: `v1 <= v2` -* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, - even if they're not the exact same string. You already know how to - compare strings. -* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. -* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call - the corresponding function above. `"==="` and `"!=="` do simple - string comparison, but are included for completeness. Throws if an - invalid comparison string is provided. -* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions - in descending order when passed to `Array.sort()`. -* `diff(v1, v2)`: Returns difference between two versions by the release type - (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), - or null if the versions are the same. - -### Comparators - -* `intersects(comparator)`: Return true if the comparators intersect - -### Ranges - -* `validRange(range)`: Return the valid range or null if it's not valid -* `satisfies(version, range)`: Return true if the version satisfies the - range. -* `maxSatisfying(versions, range)`: Return the highest version in the list - that satisfies the range, or `null` if none of them do. -* `minSatisfying(versions, range)`: Return the lowest version in the list - that satisfies the range, or `null` if none of them do. -* `minVersion(range)`: Return the lowest version that can possibly match - the given range. -* `gtr(version, range)`: Return `true` if version is greater than all the - versions possible in the range. -* `ltr(version, range)`: Return `true` if version is less than all the - versions possible in the range. -* `outside(version, range, hilo)`: Return true if the version is outside - the bounds of the range in either the high or low direction. The - `hilo` argument must be either the string `'>'` or `'<'`. (This is - the function called by `gtr` and `ltr`.) -* `intersects(range)`: Return true if any of the ranges comparators intersect - -Note that, since ranges may be non-contiguous, a version might not be -greater than a range, less than a range, *or* satisfy a range! For -example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` -until `2.0.0`, so the version `1.2.10` would not be greater than the -range (because `2.0.1` satisfies, which is higher), nor less than the -range (since `1.2.8` satisfies, which is lower), and it also does not -satisfy the range. - -If you want to know if a version satisfies or does not satisfy a -range, use the `satisfies(version, range)` function. - -### Coercion - -* `coerce(version)`: Coerces a string to semver if possible - -This aims to provide a very forgiving translation of a non-semver string to -semver. It looks for the first digit in a string, and consumes all -remaining characters which satisfy at least a partial semver (e.g., `1`, -`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer -versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All -surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes -`3.4.0`). Only text which lacks digits will fail coercion (`version one` -is not valid). The maximum length for any semver component considered for -coercion is 16 characters; longer components will be ignored -(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any -semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value -components are invalid (`9999999999999999.4.7.4` is likely invalid). diff --git a/node_modules/semver/bin/semver b/node_modules/semver/bin/semver deleted file mode 100644 index 801e77f1..00000000 --- a/node_modules/semver/bin/semver +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env node -// Standalone semver comparison program. -// Exits successfully and prints matching version(s) if -// any supplied version is valid and passes all tests. - -var argv = process.argv.slice(2) - -var versions = [] - -var range = [] - -var inc = null - -var version = require('../package.json').version - -var loose = false - -var includePrerelease = false - -var coerce = false - -var identifier - -var semver = require('../semver') - -var reverse = false - -var options = {} - -main() - -function main () { - if (!argv.length) return help() - while (argv.length) { - var a = argv.shift() - var indexOfEqualSign = a.indexOf('=') - if (indexOfEqualSign !== -1) { - a = a.slice(0, indexOfEqualSign) - argv.unshift(a.slice(indexOfEqualSign + 1)) - } - switch (a) { - case '-rv': case '-rev': case '--rev': case '--reverse': - reverse = true - break - case '-l': case '--loose': - loose = true - break - case '-p': case '--include-prerelease': - includePrerelease = true - break - case '-v': case '--version': - versions.push(argv.shift()) - break - case '-i': case '--inc': case '--increment': - switch (argv[0]) { - case 'major': case 'minor': case 'patch': case 'prerelease': - case 'premajor': case 'preminor': case 'prepatch': - inc = argv.shift() - break - default: - inc = 'patch' - break - } - break - case '--preid': - identifier = argv.shift() - break - case '-r': case '--range': - range.push(argv.shift()) - break - case '-c': case '--coerce': - coerce = true - break - case '-h': case '--help': case '-?': - return help() - default: - versions.push(a) - break - } - } - - var options = { loose: loose, includePrerelease: includePrerelease } - - versions = versions.map(function (v) { - return coerce ? (semver.coerce(v) || { version: v }).version : v - }).filter(function (v) { - return semver.valid(v) - }) - if (!versions.length) return fail() - if (inc && (versions.length !== 1 || range.length)) { return failInc() } - - for (var i = 0, l = range.length; i < l; i++) { - versions = versions.filter(function (v) { - return semver.satisfies(v, range[i], options) - }) - if (!versions.length) return fail() - } - return success(versions) -} - -function failInc () { - console.error('--inc can only be used on a single version with no range') - fail() -} - -function fail () { process.exit(1) } - -function success () { - var compare = reverse ? 'rcompare' : 'compare' - versions.sort(function (a, b) { - return semver[compare](a, b, options) - }).map(function (v) { - return semver.clean(v, options) - }).map(function (v) { - return inc ? semver.inc(v, inc, options, identifier) : v - }).forEach(function (v, i, _) { console.log(v) }) -} - -function help () { - console.log(['SemVer ' + version, - '', - 'A JavaScript implementation of the https://semver.org/ specification', - 'Copyright Isaac Z. Schlueter', - '', - 'Usage: semver [options] [ [...]]', - 'Prints valid versions sorted by SemVer precedence', - '', - 'Options:', - '-r --range ', - ' Print versions that match the specified range.', - '', - '-i --increment []', - ' Increment a version by the specified level. Level can', - ' be one of: major, minor, patch, premajor, preminor,', - " prepatch, or prerelease. Default level is 'patch'.", - ' Only one version may be specified.', - '', - '--preid ', - ' Identifier to be used to prefix premajor, preminor,', - ' prepatch or prerelease version increments.', - '', - '-l --loose', - ' Interpret versions and ranges loosely', - '', - '-p --include-prerelease', - ' Always include prerelease versions in range matching', - '', - '-c --coerce', - ' Coerce a string into SemVer if possible', - ' (does not imply --loose)', - '', - 'Program exits successfully if any valid version satisfies', - 'all supplied ranges, and prints all satisfying versions.', - '', - 'If no satisfying versions are found, then exits failure.', - '', - 'Versions are printed in ascending order, so supplying', - 'multiple versions to the utility will just sort them.' - ].join('\n')) -} diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json deleted file mode 100644 index ec59e321..00000000 --- a/node_modules/semver/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_from": "semver@^5.3.0", - "_id": "semver@5.7.1", - "_inBundle": false, - "_integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "_location": "/semver", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "semver@^5.3.0", - "name": "semver", - "escapedName": "semver", - "rawSpec": "^5.3.0", - "saveSpec": null, - "fetchSpec": "^5.3.0" - }, - "_requiredBy": [ - "/@newrelic/native-metrics", - "/newrelic" - ], - "_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "_shasum": "a954f931aeba508d307bbf069eff0c01c96116f7", - "_spec": "semver@^5.3.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/newrelic", - "bin": { - "semver": "bin/semver" - }, - "bugs": { - "url": "https://github.com/npm/node-semver/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "The semantic version parser used by npm.", - "devDependencies": { - "tap": "^13.0.0-rc.18" - }, - "files": [ - "bin", - "range.bnf", - "semver.js" - ], - "homepage": "https://github.com/npm/node-semver#readme", - "license": "ISC", - "main": "semver.js", - "name": "semver", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/node-semver.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap" - }, - "tap": { - "check-coverage": true - }, - "version": "5.7.1" -} diff --git a/node_modules/semver/range.bnf b/node_modules/semver/range.bnf deleted file mode 100644 index d4c6ae0d..00000000 --- a/node_modules/semver/range.bnf +++ /dev/null @@ -1,16 +0,0 @@ -range-set ::= range ( logical-or range ) * -logical-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' - ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | [1-9] ( [0-9] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '.' part ) * -part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/semver/semver.js b/node_modules/semver/semver.js deleted file mode 100644 index d315d5d6..00000000 --- a/node_modules/semver/semver.js +++ /dev/null @@ -1,1483 +0,0 @@ -exports = module.exports = SemVer - -var debug -/* istanbul ignore next */ -if (typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG)) { - debug = function () { - var args = Array.prototype.slice.call(arguments, 0) - args.unshift('SEMVER') - console.log.apply(console, args) - } -} else { - debug = function () {} -} - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0' - -var MAX_LENGTH = 256 -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16 - -// The actual regexps go on exports.re -var re = exports.re = [] -var src = exports.src = [] -var R = 0 - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -var NUMERICIDENTIFIER = R++ -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' -var NUMERICIDENTIFIERLOOSE = R++ -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -var NONNUMERICIDENTIFIER = R++ -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' - -// ## Main Version -// Three dot-separated numeric identifiers. - -var MAINVERSION = R++ -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')' - -var MAINVERSIONLOOSE = R++ -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')' - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -var PRERELEASEIDENTIFIER = R++ -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')' - -var PRERELEASEIDENTIFIERLOOSE = R++ -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')' - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -var PRERELEASE = R++ -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' - -var PRERELEASELOOSE = R++ -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -var BUILDIDENTIFIER = R++ -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -var BUILD = R++ -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -var FULL = R++ -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?' - -src[FULL] = '^' + FULLPLAIN + '$' - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?' - -var LOOSE = R++ -src[LOOSE] = '^' + LOOSEPLAIN + '$' - -var GTLT = R++ -src[GTLT] = '((?:<|>)?=?)' - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++ -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' -var XRANGEIDENTIFIER = R++ -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' - -var XRANGEPLAIN = R++ -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?' - -var XRANGEPLAINLOOSE = R++ -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?' - -var XRANGE = R++ -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' -var XRANGELOOSE = R++ -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -var COERCE = R++ -src[COERCE] = '(?:^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])' - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++ -src[LONETILDE] = '(?:~>?)' - -var TILDETRIM = R++ -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') -var tildeTrimReplace = '$1~' - -var TILDE = R++ -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' -var TILDELOOSE = R++ -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++ -src[LONECARET] = '(?:\\^)' - -var CARETTRIM = R++ -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') -var caretTrimReplace = '$1^' - -var CARET = R++ -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' -var CARETLOOSE = R++ -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -var COMPARATORLOOSE = R++ -src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' -var COMPARATOR = R++ -src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -var COMPARATORTRIM = R++ -src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + - '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' - -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') -var comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++ -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$' - -var HYPHENRANGELOOSE = R++ -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$' - -// Star ranges basically just allow anything at all. -var STAR = R++ -src[STAR] = '(<|>)?=?\\s*\\*' - -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]) - if (!re[i]) { - re[i] = new RegExp(src[i]) - } -} - -exports.parse = parse -function parse (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - var r = options.loose ? re[LOOSE] : re[FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} - -exports.valid = valid -function valid (version, options) { - var v = parse(version, options) - return v ? v.version : null -} - -exports.clean = clean -function clean (version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} - -exports.SemVer = SemVer - -function SemVer (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === options.loose) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - - var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) - - if (!m) { - throw new TypeError('Invalid Version: ' + version) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() -} - -SemVer.prototype.format = function () { - this.version = this.major + '.' + this.minor + '.' + this.patch - if (this.prerelease.length) { - this.version += '-' + this.prerelease.join('.') - } - return this.version -} - -SemVer.prototype.toString = function () { - return this.version -} - -SemVer.prototype.compare = function (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return this.compareMain(other) || this.comparePre(other) -} - -SemVer.prototype.compareMain = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) -} - -SemVer.prototype.comparePre = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - var i = 0 - do { - var a = this.prerelease[i] - var b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} - -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - var i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } - } - break - - default: - throw new Error('invalid increment argument: ' + release) - } - this.format() - this.raw = this.version - return this -} - -exports.inc = inc -function inc (version, release, loose, identifier) { - if (typeof (loose) === 'string') { - identifier = loose - loose = undefined - } - - try { - return new SemVer(version, loose).inc(release, identifier).version - } catch (er) { - return null - } -} - -exports.diff = diff -function diff (version1, version2) { - if (eq(version1, version2)) { - return null - } else { - var v1 = parse(version1) - var v2 = parse(version2) - var prefix = '' - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre' - var defaultResult = 'prerelease' - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} - -exports.compareIdentifiers = compareIdentifiers - -var numeric = /^[0-9]+$/ -function compareIdentifiers (a, b) { - var anum = numeric.test(a) - var bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -exports.rcompareIdentifiers = rcompareIdentifiers -function rcompareIdentifiers (a, b) { - return compareIdentifiers(b, a) -} - -exports.major = major -function major (a, loose) { - return new SemVer(a, loose).major -} - -exports.minor = minor -function minor (a, loose) { - return new SemVer(a, loose).minor -} - -exports.patch = patch -function patch (a, loose) { - return new SemVer(a, loose).patch -} - -exports.compare = compare -function compare (a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)) -} - -exports.compareLoose = compareLoose -function compareLoose (a, b) { - return compare(a, b, true) -} - -exports.rcompare = rcompare -function rcompare (a, b, loose) { - return compare(b, a, loose) -} - -exports.sort = sort -function sort (list, loose) { - return list.sort(function (a, b) { - return exports.compare(a, b, loose) - }) -} - -exports.rsort = rsort -function rsort (list, loose) { - return list.sort(function (a, b) { - return exports.rcompare(a, b, loose) - }) -} - -exports.gt = gt -function gt (a, b, loose) { - return compare(a, b, loose) > 0 -} - -exports.lt = lt -function lt (a, b, loose) { - return compare(a, b, loose) < 0 -} - -exports.eq = eq -function eq (a, b, loose) { - return compare(a, b, loose) === 0 -} - -exports.neq = neq -function neq (a, b, loose) { - return compare(a, b, loose) !== 0 -} - -exports.gte = gte -function gte (a, b, loose) { - return compare(a, b, loose) >= 0 -} - -exports.lte = lte -function lte (a, b, loose) { - return compare(a, b, loose) <= 0 -} - -exports.cmp = cmp -function cmp (a, op, b, loose) { - switch (op) { - case '===': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a === b - - case '!==': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) - - default: - throw new TypeError('Invalid operator: ' + op) - } -} - -exports.Comparator = Comparator -function Comparator (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - if (!(this instanceof Comparator)) { - return new Comparator(comp, options) - } - - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) -} - -var ANY = {} -Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var m = comp.match(r) - - if (!m) { - throw new TypeError('Invalid comparator: ' + comp) - } - - this.operator = m[1] - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } -} - -Comparator.prototype.toString = function () { - return this.value -} - -Comparator.prototype.test = function (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY) { - return true - } - - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } - - return cmp(version, this.operator, this.semver, this.options) -} - -Comparator.prototype.intersects = function (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - var rangeTmp - - if (this.operator === '') { - rangeTmp = new Range(comp.value, options) - return satisfies(this.value, rangeTmp, options) - } else if (comp.operator === '') { - rangeTmp = new Range(this.value, options) - return satisfies(comp.semver, rangeTmp, options) - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - var sameSemVer = this.semver.version === comp.semver.version - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')) - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')) - - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan -} - -exports.Range = Range -function Range (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (range instanceof Range) { - if (range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - return new Range(range.value, options) - } - - if (!(this instanceof Range)) { - return new Range(range, options) - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First, split based on boolean or || - this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { - return this.parseRange(range.trim()) - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length - }) - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) - } - - this.format() -} - -Range.prototype.format = function () { - this.range = this.set.map(function (comps) { - return comps.join(' ').trim() - }).join('||').trim() - return this.range -} - -Range.prototype.toString = function () { - return this.range -} - -Range.prototype.parseRange = function (range) { - var loose = this.options.loose - range = range.trim() - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] - range = range.replace(hr, hyphenReplace) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[COMPARATORTRIM]) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var set = range.split(' ').map(function (comp) { - return parseComparator(comp, this.options) - }, this).join(' ').split(/\s+/) - if (this.options.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function (comp) { - return !!comp.match(compRe) - }) - } - set = set.map(function (comp) { - return new Comparator(comp, this.options) - }, this) - - return set -} - -Range.prototype.intersects = function (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some(function (thisComparators) { - return thisComparators.every(function (thisComparator) { - return range.set.some(function (rangeComparators) { - return rangeComparators.every(function (rangeComparator) { - return thisComparator.intersects(rangeComparator, options) - }) - }) - }) - }) -} - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators -function toComparators (range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value - }).join(' ').trim().split(' ') - }) -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator (comp, options) { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp -} - -function isX (id) { - return !id || id.toLowerCase() === 'x' || id === '*' -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceTilde(comp, options) - }).join(' ') -} - -function replaceTilde (comp, options) { - var r = options.loose ? re[TILDELOOSE] : re[TILDE] - return comp.replace(r, function (_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else if (pr) { - debug('replaceTilde pr', pr) - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } else { - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceCaret(comp, options) - }).join(' ') -} - -function replaceCaret (comp, options) { - debug('caret', comp, options) - var r = options.loose ? re[CARETLOOSE] : re[CARET] - return comp.replace(r, function (_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - if (M === '0') { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else { - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + (+M + 1) + '.0.0' - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0' - } - } - - debug('caret return', ret) - return ret - }) -} - -function replaceXRanges (comp, options) { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map(function (comp) { - return replaceXRange(comp, options) - }).join(' ') -} - -function replaceXRange (comp, options) { - comp = comp.trim() - var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] - return comp.replace(r, function (ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - var xM = isX(M) - var xm = xM || isX(m) - var xp = xm || isX(p) - var anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' - } - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - ret = gtlt + M + '.' + m + '.' + p - } else if (xm) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (xp) { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars (comp, options) { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], '') -} - -// This function is passed to string.replace(re[HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = '>=' + fM + '.0.0' - } else if (isX(fp)) { - from = '>=' + fM + '.' + fm + '.0' - } else { - from = '>=' + from - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = '<' + (+tM + 1) + '.0.0' - } else if (isX(tp)) { - to = '<' + tM + '.' + (+tm + 1) + '.0' - } else if (tpr) { - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr - } else { - to = '<=' + to - } - - return (from + ' ' + to).trim() -} - -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false -} - -function testSet (set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} - -exports.satisfies = satisfies -function satisfies (version, range, options) { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} - -exports.maxSatisfying = maxSatisfying -function maxSatisfying (versions, range, options) { - var max = null - var maxSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} - -exports.minSatisfying = minSatisfying -function minSatisfying (versions, range, options) { - var min = null - var minSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} - -exports.minVersion = minVersion -function minVersion (range, loose) { - range = new Range(range, loose) - - var minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error('Unexpected operation: ' + comparator.operator) - } - }) - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} - -exports.validRange = validRange -function validRange (range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} - -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr -function ltr (version, range, options) { - return outside(version, range, '<', options) -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr -function gtr (version, range, options) { - return outside(version, range, '>', options) -} - -exports.outside = outside -function outside (version, range, hilo, options) { - version = new SemVer(version, options) - range = new Range(range, options) - - var gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - var high = null - var low = null - - comparators.forEach(function (comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} - -exports.prerelease = prerelease -function prerelease (version, options) { - var parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} - -exports.intersects = intersects -function intersects (r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} - -exports.coerce = coerce -function coerce (version) { - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - var match = version.match(re[COERCE]) - - if (match == null) { - return null - } - - return parse(match[1] + - '.' + (match[2] || '0') + - '.' + (match[3] || '0')) -} diff --git a/node_modules/string_decoder/LICENSE b/node_modules/string_decoder/LICENSE deleted file mode 100644 index 778edb20..00000000 --- a/node_modules/string_decoder/LICENSE +++ /dev/null @@ -1,48 +0,0 @@ -Node.js is licensed for use as follows: - -""" -Copyright Node.js contributors. All rights reserved. - -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. -""" - -This license applies to parts of Node.js originating from the -https://github.com/joyent/node repository: - -""" -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -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. -""" - diff --git a/node_modules/string_decoder/README.md b/node_modules/string_decoder/README.md deleted file mode 100644 index 5fd58315..00000000 --- a/node_modules/string_decoder/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# string_decoder - -***Node-core v8.9.4 string_decoder for userland*** - - -[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/) -[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/) - - -```bash -npm install --save string_decoder -``` - -***Node-core string_decoder for userland*** - -This package is a mirror of the string_decoder implementation in Node-core. - -Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/). - -As of version 1.0.0 **string_decoder** uses semantic versioning. - -## Previous versions - -Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. - -## Update - -The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version. - -## Streams Working Group - -`string_decoder` is maintained by the Streams Working Group, which -oversees the development and maintenance of the Streams API within -Node.js. The responsibilities of the Streams Working Group include: - -* Addressing stream issues on the Node.js issue tracker. -* Authoring and editing stream documentation within the Node.js project. -* Reviewing changes to stream subclasses within the Node.js project. -* Redirecting changes to streams from the Node.js project to this - project. -* Assisting in the implementation of stream providers within Node.js. -* Recommending versions of `readable-stream` to be included in Node.js. -* Messaging about the future of streams to give the community advance - notice of changes. - -See [readable-stream](https://github.com/nodejs/readable-stream) for -more details. diff --git a/node_modules/string_decoder/lib/string_decoder.js b/node_modules/string_decoder/lib/string_decoder.js deleted file mode 100644 index 2e89e63f..00000000 --- a/node_modules/string_decoder/lib/string_decoder.js +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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'; - -/**/ - -var Buffer = require('safe-buffer').Buffer; -/**/ - -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; - -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; - -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} - -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; - -StringDecoder.prototype.end = utf8End; - -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; - -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; - -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} - -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; - } - return 0; -} - -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} - -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} - -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} - -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} - -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} - -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} - -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} - -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} - -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} - -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} \ No newline at end of file diff --git a/node_modules/string_decoder/package.json b/node_modules/string_decoder/package.json deleted file mode 100644 index 563f07f7..00000000 --- a/node_modules/string_decoder/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "string_decoder@^1.1.1", - "_id": "string_decoder@1.3.0", - "_inBundle": false, - "_integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "_location": "/string_decoder", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "string_decoder@^1.1.1", - "name": "string_decoder", - "escapedName": "string_decoder", - "rawSpec": "^1.1.1", - "saveSpec": null, - "fetchSpec": "^1.1.1" - }, - "_requiredBy": [ - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "_shasum": "42f114594a46cf1a8e30b0a84f56c78c3edac21e", - "_spec": "string_decoder@^1.1.1", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/readable-stream", - "bugs": { - "url": "https://github.com/nodejs/string_decoder/issues" - }, - "bundleDependencies": false, - "dependencies": { - "safe-buffer": "~5.2.0" - }, - "deprecated": false, - "description": "The string_decoder module from Node core", - "devDependencies": { - "babel-polyfill": "^6.23.0", - "core-util-is": "^1.0.2", - "inherits": "^2.0.3", - "tap": "~0.4.8" - }, - "files": [ - "lib" - ], - "homepage": "https://github.com/nodejs/string_decoder", - "keywords": [ - "string", - "decoder", - "browser", - "browserify" - ], - "license": "MIT", - "main": "lib/string_decoder.js", - "name": "string_decoder", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/string_decoder.git" - }, - "scripts": { - "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", - "test": "tap test/parallel/*.js && node test/verify-dependencies" - }, - "version": "1.3.0" -} diff --git a/node_modules/subscriptions-transport-ws/AUTHORS b/node_modules/subscriptions-transport-ws/AUTHORS deleted file mode 100644 index d1aea998..00000000 --- a/node_modules/subscriptions-transport-ws/AUTHORS +++ /dev/null @@ -1,14 +0,0 @@ -Authors - -Jonas Helfer -Jonas Helfer -Amanda Jin Liu -Robin Ricard -Sashko Stubailo -Sashko Stubailo -Hagai Cohen -Kamil Kisiela -Francois Valdy -Daniel Rinehart -Lukas Fittl - diff --git a/node_modules/subscriptions-transport-ws/CHANGELOG.md b/node_modules/subscriptions-transport-ws/CHANGELOG.md deleted file mode 100644 index 8cd39677..00000000 --- a/node_modules/subscriptions-transport-ws/CHANGELOG.md +++ /dev/null @@ -1,224 +0,0 @@ -# Changelog - -## v0.9.18 (2020-08-17) - -### Bug Fixes - -- Do not send GQL_STOP when unsubscribing after GQL_COMPLETE is received.
    - [@onhate](https://github.com/onhate) in [#775](https://github.com/apollographql/subscriptions-transport-ws/pull/775) -- Clear WebSocket event listeners on close.
    - [@tretne](https://github.com/tretne) in [#615](https://github.com/apollographql/subscriptions-transport-ws/pull/615) -- Fix `MessageTypes` TS import errors.
    - [@sneko](https://github.com/sneko) in [#412](https://github.com/apollographql/subscriptions-transport-ws/issues/412) -- Ensure `promisedParams` errors are not handled twice.
    - [@benjie](https://github.com/benjie) in [#514](https://github.com/apollographql/subscriptions-transport-ws/pull/514) -- Fix invalid `formatResponse` console error.
    - [@renatorib](https://github.com/renatorib) in [#761](https://github.com/apollographql/subscriptions-transport-ws/pull/761) -- Destructure the correct error object in `MessageTypes.GQL_START`.
    - [@gregbty](https://github.com/gregbty) in [#588](https://github.com/apollographql/subscriptions-transport-ws/pull/588) -- Inline source in sourcemap files to fix broken source lookups.
    - [@alexkirsz](https://github.com/alexkirsz) in [#513](https://github.com/apollographql/subscriptions-transport-ws/pull/513) - -### New Features - -- Add `minTimeout` option for client.
    - [@jedwards1211](https://github.com/jedwards1211) in [#675](https://github.com/apollographql/subscriptions-transport-ws/pull/675) -- Accept extra WebSocket client arguments.
    - [@GingerBear](https://github.com/GingerBear) in [#561](https://github.com/apollographql/subscriptions-transport-ws/pull/561) -- Support server-defined payload in GQL_CONNECTION_ACK message.
    - [@mattkrick](https://github.com/mattkrick) in [#347](https://github.com/apollographql/subscriptions-transport-ws/pull/347) - -## v0.9.17 - -- Bump `graphql` peer/dev deps.
    - [@hwillson](https://github.com/hwillson) in [#778](https://github.com/apollographql/subscriptions-transport-ws/pull/778) - -## v0.9.16 -- Add ability to set custom WebSocket protocols for client.
    - [@pkosiec](https://github.com/pkosiec) in [#477](https://github.com/apollographql/subscriptions-transport-ws/pull/477) - -## v0.9.15 - -- Add support for `graphql` and `@types/graphql` 14.
    - [@caiquecastro](https://github.com/caiquecastro) in [#464](https://github.com/apollographql/subscriptions-transport-ws/pull/464) - -## v0.9.14 -- Allow dynamically specifying/overriding the schema in the object returned from `onOperation` [PR #447](https://github.com/apollographql/subscriptions-transport-ws/pull/447) - -## v0.9.13 -- Allow connectionParams to be a Promise [PR #443](https://github.com/apollographql/subscriptions-transport-ws/pull/443) - -## v0.9.12 -- use lightweight lodash alternatives [Issue #430](https://github.com/apollographql/subscriptions-transport-ws/issues/430) -- applies fix suggested by @pandemosth regarding "No subscription is made on reconnect" and "Duplicate subscription made on reconnect" described in [Issue #295](https://github.com/apollographql/subscriptions-transport-ws/issues/295#issuecomment-398184429) - -## v0.9.11 -- allow using custom WebSocket server implementation [PR #374](https://github.com/apollographql/subscriptions-transport-ws/pull/374) - -## v0.9.10 -- upgrade ws and eventemitter3 - -## v0.9.9 -- fix issue with @types/graphql@0.13 - -## v0.9.8 -- added `error` event to handle connection errors and debug network troubles [PR #341](https://github.com/apollographql/subscriptions-transport-ws/pull/341). -- added feature inactivityTimeout [PR #390](https://github.com/apollographql/subscriptions-transport-ws/pull/390) - -## v0.9.7 -- change default timeout from 10s to 30s [PR #368](https://github.com/apollographql/subscriptions-transport-ws/pull/368) -- pass `request` (`upgradeReq`) to `ConnectionContext` [PR #369](https://github.com/apollographql/subscriptions-transport-ws/pull/369) -- pass `ConnectionContext` to `onDisconnect()` as second argument [PR #369](https://github.com/apollographql/subscriptions-transport-ws/pull/369) - -## v0.9.6 -- fix shallow cloning on contexts which are classes -- upgrade to support graphql 0.13.X -- bump iterall version [PR #362](https://github.com/apollographql/subscriptions-transport-ws/pull/362) - -## v0.9.5 -- docs(setup): Fix dead link to subscriptions-to-schema -- upgrade to support graphql 0.12.X - -## v0.9.4 -- fix unhandledRejection error in GQL_START handling if initPromise rejected [PR #310](https://github.com/apollographql/subscriptions-transport-ws/pull/310) - -## v0.9.3 -- fix unhandledRejection error in GQL_STOP handling if initPromise rejected [PR #309](https://github.com/apollographql/subscriptions-transport-ws/pull/309) -- fix return of init error message to legacy clients [PR #309](https://github.com/apollographql/subscriptions-transport-ws/pull/309) - -## v0.9.2 -- fix format of keep alive message sent to legacy clients. [PR #297](https://github.com/apollographql/subscriptions-transport-ws/pull/297) -- fix(isPromise): Made checks for promises in server.ts loose to allow for augmented and polyfilled promises. [PR #304](https://github.com/apollographql/subscriptions-transport-ws/pull/304) - -## v0.9.1 -- docs(KEEP_ALIVE): Updated protocol docs to explain the correct server implementation of `GQL_CONNECTION_INIT`, `GQL_CONNECTION_ACK` and `GQL_CONNECTION_KEEP_ALIVE` [PR #279](https://github.com/apollographql/subscriptions-transport-ws/pull/279) -- docs(language-typos): Update documentation to remove some language typos [PR #282](https://github.com/apollographql/subscriptions-transport-ws/pull/282) -- fix(typescript-2.5.x-typings): Fix a couple of typing changes required by latest typing files with TypeScript 2.5.X. [PR #285](https://github.com/apollographql/subscriptions-transport-ws/pull/285) -- test(NA): fixed run condition on tests for gql_data with errors [PR #289](https://github.com/apollographql/subscriptions-transport-ws/pull/289) - -## v0.9.0 -- docs(README): Fix example for subscribe and subscribeToMore [PR #273](https://github.com/apollographql/subscriptions-transport-ws/pull/273) -- Add support for GraphQL 0.11.0 [PR #261](https://github.com/apollographql/subscriptions-transport-ws/pull/261) -- **BREAKING CHANGE**: Remove support for Subscription Manager [PR #261](https://github.com/apollographql/subscriptions-transport-ws/pull/261) -- **BREAKING CHANGE**: Remove support for all deprecated API [PR #272](https://github.com/apollographql/subscriptions-transport-ws/pull/272) - -## v0.8.3 -- docs(README): Fix options example for subscribe methods [PR #266](https://github.com/apollographql/subscriptions-transport-ws/pull/266) -- Gracefully unsubscribe to all pending operations before a requested close by the user [PR #245](https://github.com/apollographql/subscriptions-transport-ws/pull/245) -- Add `close` method to server [PR #257](https://github.com/apollographql/subscriptions-transport-ws/pull/257) -- Bugfix: Observer callbacks should be optional [PR #256](https://github.com/apollographql/subscriptions-transport-ws/pull/256) - -## v0.8.2 -- Add request interface as a preparation for Apollo 2.0 [PR #242](https://github.com/apollographql/subscriptions-transport-ws/pull/242) -- Add Validation step to server [PR #241](https://github.com/apollographql/subscriptions-transport-ws/pull/241) -- Call operation handler before delete the operation on operation complete [PR #239](https://github.com/apollographql/subscriptions-transport-ws/pull/239) - -## v0.8.1 -- Send first keep alive message right after the ack [PR #223](https://github.com/apollographql/subscriptions-transport-ws/pull/223) -- Return after first post-install when it should install dev dependencies [PR #218](https://github.com/apollographql/subscriptions-transport-ws/pull/218) -- On installing from branch install dev dependencies only if dist folder isn't found [PR #219](https://github.com/apollographql/subscriptions-transport-ws/pull/219) - -## v0.8.0 -- Expose opId `onOperationComplete` method [PR #211](https://github.com/apollographql/subscriptions-transport-ws/pull/211) -- Fix to make library able to be installed from a branch [PR #208](https://github.com/apollographql/subscriptions-transport-ws/pull/208) -- Fix for non forced closes (now it wont send connection_terminate) [PR #197](https://github.com/apollographql/subscriptions-transport-ws/pull/197) -- A lot of connection's flow improvements (on connect, on disconnect and on reconnect) [PR #197](https://github.com/apollographql/subscriptions-transport-ws/pull/197) -- Require specific lodash/assign module instead of entire package, so memory impact is reduced [PR #196](https://github.com/apollographql/subscriptions-transport-ws/pull/196) -- docs(README): Fix onEvent(eventName, callback, thisContext) list of eventName [PR #205](https://github.com/apollographql/subscriptions-transport-ws/pull/205) - -## v0.7.3 -- Fix for first subscription is never unsubscribed [PR #179](https://github.com/apollographql/subscriptions-transport-ws/pull/179) - -## v0.7.2 -- Increase default keep-alive timeout to 30s [PR #177](https://github.com/apollographql/subscriptions-transport-ws/pull/177) -- Operation key is now `string` instead of `number` [PR #176](https://github.com/apollographql/subscriptions-transport-ws/pull/176) - -## v0.7.1 -- Fix for reconnect after manual close [PR #164](https://github.com/apollographql/subscriptions-transport-ws/pull/164) -- test(disconnect): added tests for client-server flow for unsubscribe and disconnect [PR #163](https://github.com/apollographql/subscriptions-transport-ws/pull/163) -- Various dependencies updates [PR #152](https://github.com/apollographql/subscriptions-transport-ws/pull/152) [PR #162](https://github.com/apollographql/subscriptions-transport-ws/pull/162) -- docs(README): fix docs [PR #151](https://github.com/apollographql/subscriptions-transport-ws/pull/151) - -## v0.7.0 -- Client exposes new asyncronous middleware to modify `OperationOptions` [PR #78](https://github.com/apollographql/subscriptions-transport-ws/pull/78) -- Added `WebSocketServer` error handler to prevent uncaught exceptions. Fixes [Issue #94](https://github.com/apollographql/subscriptions-transport-ws/issues/94) -- Updated `ws` dependency to the lastest. -- Introduce lazy mode for connection, and accept function as `connectionParams` [PR #131](https://github.com/apollographql/subscriptions-transport-ws/pull/131) -- Extend transport protocol to support GraphQL queries and mutations over WebSocket [PR #108](https://github.com/apollographql/subscriptions-transport-ws/pull/108) -- Added built-in support for `subscribe` from `graphql-js` [PR #133](https://github.com/apollographql/subscriptions-transport-ws/pull/133) -- Fixed infinity reconnects when server accepts connections but its in an error state. [PR #135](https://github.com/apollographql/subscriptions-transport-ws/pull/135) -- Force close client-side socket when using `close()`, and ignore reconnect logic. [PR #137](https://github.com/apollographql/subscriptions-transport-ws/pull/137) -- Added new connection events to give a more accurate control over the connection state [PR #139](https://github.com/apollographql/subscriptions-transport-ws/pull/139). Fixes [Issue #136](https://github.com/apollographql/subscriptions-transport-ws/issues/136). -- Replaced `Object.assign` by `lodash.assign` to extend browser support [PR #144](https://github.com/apollographql/subscriptions-transport-ws/pull/144). Fixes [Issue #141](https://github.com/apollographql/subscriptions-transport-ws/issues/141) - -## v0.6.0 - -- Enabled Greenkeeper and updated dependencies, includes major version bump of ws [PR #90](https://github.com/apollographql/subscriptions-transport-ws/pull/90) - -## v0.6.0 -- Protocol update to support queries, mutations and also subscriptions. [PR #108](https://github.com/apollographql/subscriptions-transport-ws/pull/108) -- Added support in the server for GraphQL Executor. [PR #108](https://github.com/apollographql/subscriptions-transport-ws/pull/108) -- Added support in the server executor for `graphql-js subscribe`. [PR #846](https://github.com/graphql/graphql-js/pull/846) - -## v0.5.5 -- Remove dependency on `graphql-tag/printer` per [graphql-tag#54](https://github.com/apollographql/graphql-tag/issues/54) [PR #98](https://github.com/apollographql/subscriptions-transport-ws/pull/98) - -## v0.5.4 -- Ensure INIT is sent before SUBSCRIPTION_START even when client reconnects [PR #85](https://github.com/apollographql/subscriptions-transport-ws/pull/85) -- Allow data and errors in payload of SUBSCRIPTION_DATA [PR #84](https://github.com/apollographql/subscriptions-transport-ws/pull/84) -- Expose `index.js` as entrypoint for server/NodeJS application to allow NodeJS clients to use `SubscriptionClient` [PR #91](https://github.com/apollographql/subscriptions-transport-ws/pull/91) -- Fixed a bug with missing error message on `INIT_FAIL` message [#88](https://github.com/apollographql/subscriptions-transport-ws/issues/88) - -## v0.5.3 -- Fixed a bug with `browser` declaration on package.json ([Issue #79](https://github.com/apollographql/subscriptions-transport-ws/issues/79)) - -## v0.5.2 -- Updated dependencies versions -- Fixed typings issue with missing `index.d.ts` file. [PR #73](https://github.com/apollographql/subscriptions-transport-ws/pull/73) -- Transpiling client.js to target browsers using webpack. [PR #77](https://github.com/apollographql/subscriptions-transport-ws/pull/77) - -## v0.5.1 -- Only attempt reconnect on closed connection. Fixes [Issue #70](https://github.com/apollographql/subscriptions-transport-ws/issues/70) - -## v0.5.0 - -- Updated `graphql-subscriptions@0.3.0`. -- Added `addGraphQLSubscriptions` - use it to extend your network interface to work with `SubscriptionsClient` instance. [PR #64](https://github.com/apollographql/subscriptions-transport-ws/pull/64) -- Client now uses native WebSocket by default, and has optional field to provide another implementation (for NodeJS clients)[PR #53](https://github.com/apollographql/subscriptions-transport-ws/pull/53) -- Client now support INIT with custom object, so you can use if for authorization, or any other init params. [PR #53](https://github.com/apollographql/subscriptions-transport-ws/pull/53) -- Server and client are now separated with `browser` and `main` fields of `package.json`. [PR #53](https://github.com/apollographql/subscriptions-transport-ws/pull/53) -- Client exposes workflow events for connect, disconnect and reconnect. [PR #53](https://github.com/apollographql/subscriptions-transport-ws/pull/53) -- Server exposes new events: `onUnsubscribe`, `onSubscribe`, `onConnect` and `onDisconnect`. [PR #53](https://github.com/apollographql/subscriptions-transport-ws/pull/53) -- Use `ws` package on server side, and expose it's options from server constructor. [PR #53](https://github.com/apollographql/subscriptions-transport-ws/pull/53) - -## v0.4.0 - -- Don't throw in the server on certain unsub messages. -[PR #54](https://github.com/apollostack/subscriptions-transport-ws/pull/54) -- Moved typings to `@types/graphql`. -[PR #60](https://github.com/apollostack/subscriptions-transport-ws/pull/60) - -## v0.3.1 - -- Server now passes back subscriptionManager errors encountered during publish. -[PR #42](https://github.com/apollostack/subscriptions-transport-ws/pull/42) - -## v0.3.0 - -- (SEMVER-MINOR) Bump graphql-subscriptions dependency to ^0.2.0 which changes the setupFunctions format -- Fix missing unsubscription from first (id = 0) subscription - -## v0.2.6 - -- Add `reconnect` and `reconnectionAttempts` options to the constructor which will enable reconnection with exponential backoff. - -## v0.2.5 - -- Pass WebSocketRequest to onSubscribe to support reading HTTP headers when creating a subscription - -## v0.2.4 - -- Server reports back an error on an unparsable client message -- Server reports back an error on an unsupported client message type -- Fix intermittent failure in timeout test case -- Standardize server and client errors handling to always create an array of errors with a message property diff --git a/node_modules/subscriptions-transport-ws/CONTRIBUTING.md b/node_modules/subscriptions-transport-ws/CONTRIBUTING.md deleted file mode 100644 index 651c0717..00000000 --- a/node_modules/subscriptions-transport-ws/CONTRIBUTING.md +++ /dev/null @@ -1,82 +0,0 @@ -# Apollo Contributor Guide - -Excited about Apollo and want to make it better? We’re excited too! - -Apollo is a community of developers just like you, striving to create the best tools and libraries around GraphQL. We welcome anyone who wants to contribute or provide constructive feedback, no matter the age or level of experience. If you want to help but don't know where to start, let us know, and we'll find something for you. - -Oh, and if you haven't already, sign up for the [Apollo Slack](http://www.apollodata.com/#slack). - -Here are some ways to contribute to the project, from easiest to most difficult: - -* [Reporting bugs](#reporting-bugs) -* [Improving the documentation](#improving-the-documentation) -* [Responding to issues](#responding-to-issues) -* [Small bug fixes](#small-bug-fixes) -* [Suggesting features](#suggesting-features) -* [Big pull requests](#big-prs) - -## Issues - -### Reporting bugs - -If you encounter a bug, please file an issue on GitHub via the repository of the sub-project you think contains the bug. If an issue you have is already reported, please add additional information or add a 👍 reaction to indicate your agreement. - -While we will try to be as helpful as we can on any issue reported, please include the following to maximize the chances of a quick fix: - -1. **Intended outcome:** What you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem. -2. **Actual outcome:** A description of what actually happened, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. Please avoid non-specific phrases like “didn’t work” or “broke”. -3. **How to reproduce the issue:** Instructions for how the issue can be reproduced by a maintainer or contributor. Be as specific as possible, and only mention what is necessary to reproduce the bug. If possible, try to isolate the exact circumstances in which the bug occurs and avoid speculation over what the cause might be. - -Creating a good reproduction really helps contributors investigate and resolve your issue quickly. In many cases, the act of creating a minimal reproduction illuminates that the source of the bug was somewhere outside the library in question, saving time and effort for everyone. - -### Improving the documentation - -Improving the documentation, examples, and other open source content can be the easiest way to contribute to the library. If you see a piece of content that can be better, open a PR with an improvement, no matter how small! If you would like to suggest a big change or major rewrite, we’d love to hear your ideas but please open an issue for discussion before writing the PR. - -### Responding to issues - -In addition to reporting issues, a great way to contribute to Apollo is to respond to other peoples' issues and try to identify the problem or help them work around it. If you’re interested in taking a more active role in this process, please go ahead and respond to issues. And don't forget to say "Hi" on Apollo Slack! - -### Small bug fixes - -For a small bug fix change (less than 20 lines of code changed), feel free to open a pull request. We’ll try to merge it as fast as possible and ideally publish a new release on the same day. The only requirement is, make sure you also add a test that verifies the bug you are trying to fix. - -### Suggesting features - -Most of the features in Apollo came from suggestions by you, the community! We welcome any ideas about how to make Apollo better for your use case. Unless there is overwhelming demand for a feature, it might not get implemented immediately, but please include as much information as possible that will help people have a discussion about your proposal: - -1. **Use case:** What are you trying to accomplish, in specific terms? Often, there might already be a good way to do what you need and a new feature is unnecessary, but it’s hard to know without information about the specific use case. -2. **Could this be a plugin?** In many cases, a feature might be too niche to be included in the core of a library, and is better implemented as a companion package. If there isn’t a way to extend the library to do what you want, could we add additional plugin APIs? It’s important to make the case for why a feature should be part of the core functionality of the library. -3. **Is there a workaround?** Is this a more convenient way to do something that is already possible, or is there some blocker that makes a workaround unfeasible? - -Feature requests will be labeled as such, and we encourage using GitHub issues as a place to discuss new features and possible implementation designs. Please refrain from submitting a pull request to implement a proposed feature until there is consensus that it should be included. This way, you can avoid putting in work that can’t be merged in. - -Once there is a consensus on the need for a new feature, proceed as listed below under “Big PRs”. - -## Big PRs - -This includes: - -- Big bug fixes -- New features - -For significant changes to a repository, it’s important to settle on a design before starting on the implementation. This way, we can make sure that major improvements get the care and attention they deserve. Since big changes can be risky and might not always get merged, it’s good to reduce the amount of possible wasted effort by agreeing on an implementation design/plan first. - -1. **Open an issue.** Open an issue about your bug or feature, as described above. -2. **Reach consensus.** Some contributors and community members should reach an agreement that this feature or bug is important, and that someone should work on implementing or fixing it. -3. **Agree on intended behavior.** On the issue, reach an agreement about the desired behavior. In the case of a bug fix, it should be clear what it means for the bug to be fixed, and in the case of a feature, it should be clear what it will be like for developers to use the new feature. -4. **Agree on implementation plan.** Write a plan for how this feature or bug fix should be implemented. What modules need to be added or rewritten? Should this be one pull request or multiple incremental improvements? Who is going to do each part? -5. **Submit PR.** In the case where multiple dependent patches need to be made to implement the change, only submit one at a time. Otherwise, the others might get stale while the first is reviewed and merged. Make sure to avoid “while we’re here” type changes - if something isn’t relevant to the improvement at hand, it should be in a separate PR; this especially includes code style changes of unrelated code. -6. **Review.** At least one core contributor should sign off on the change before it’s merged. Look at the “code review” section below to learn about factors are important in the code review. If you want to expedite the code being merged, try to review your own code first! -7. **Merge and release!** - -### Code review guidelines - -It’s important that every piece of code in Apollo packages is reviewed by at least one core contributor familiar with that codebase. Here are some things we look for: - -1. **Required CI checks pass.** This is a prerequisite for the review, and it is the PR author's responsibility. As long as the tests don’t pass, the PR won't get reviewed. -2. **Simplicity.** Is this the simplest way to achieve the intended goal? If there are too many files, redundant functions, or complex lines of code, suggest a simpler way to do the same thing. In particular, avoid implementing an overly general solution when a simple, small, and pragmatic fix will do. -3. **Testing.** Do the tests ensure this code won’t break when other stuff changes around it? When it does break, will the tests added help us identify which part of the library has the problem? Did we cover an appropriate set of edge cases? Look at the test coverage report if there is one. Are all significant code paths in the new code exercised at least once? -4. **No unnecessary or unrelated changes.** PRs shouldn’t come with random formatting changes, especially in unrelated parts of the code. If there is some refactoring that needs to be done, it should be in a separate PR from a bug fix or feature, if possible. -5. **Code has appropriate comments.** Code should be commented, or written in a clear “self-documenting” way. -6. **Idiomatic use of the language.** In TypeScript, make sure the typings are specific and correct. In ES2015, make sure to use imports rather than require and const instead of var, etc. Ideally a linter enforces a lot of this, but use your common sense and follow the style of the surrounding code. diff --git a/node_modules/subscriptions-transport-ws/LICENSE b/node_modules/subscriptions-transport-ws/LICENSE deleted file mode 100644 index 69526e1f..00000000 --- a/node_modules/subscriptions-transport-ws/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 - 2016 Meteor Development Group, Inc. - -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. - diff --git a/node_modules/subscriptions-transport-ws/PROTOCOL.md b/node_modules/subscriptions-transport-ws/PROTOCOL.md deleted file mode 100644 index 9401d7b2..00000000 --- a/node_modules/subscriptions-transport-ws/PROTOCOL.md +++ /dev/null @@ -1,110 +0,0 @@ -# GraphQL over WebSocket Protocol - -## Client-server communication - -Each message has a `type` field, which defined in the protocol of this package, as well as associated fields inside `payload` field, depending on the message type, and `id` field so the client can identify each response from the server. - -Each WebSocket message is represented in JSON structure, and being stringified before sending it over the network. - -This is the structure of each message: - -```typescript -export interface OperationMessage { - payload?: any; - id?: string; - type: string; -} -``` - -### Client -> Server - -#### GQL_CONNECTION_INIT -Client sends this message after plain websocket connection to start the communication with the server - -The server will response only with `GQL_CONNECTION_ACK` + `GQL_CONNECTION_KEEP_ALIVE` (if used) or `GQL_CONNECTION_ERROR` to this message. - -- `payload: Object` : optional parameters that the client specifies in `connectionParams` - -#### GQL_START -Client sends this message to execute GraphQL operation -- `id: string` : The id of the GraphQL operation to start -- `payload: Object`: - * `query: string` : GraphQL operation as string or parsed GraphQL document node - * `variables?: Object` : Object with GraphQL variables - * `operationName?: string` : GraphQL operation name - -#### GQL_STOP -Client sends this message in order to stop a running GraphQL operation execution (for example: unsubscribe) -- `id: string` : operation id - -#### GQL_CONNECTION_TERMINATE -Client sends this message to terminate the connection. - -### Server -> Client - -#### GQL_CONNECTION_ERROR -The server may responses with this message to the `GQL_CONNECTION_INIT` from client, indicates the server rejected the connection. - -It server also respond with this message in case of a parsing errors of the message (which does not disconnect the client, just ignore the message). - -- `payload: Object`: the server side error - -#### GQL_CONNECTION_ACK -The server may responses with this message to the `GQL_CONNECTION_INIT` from client, indicates the server accepted the connection. -May optionally include a payload. - - -#### GQL_DATA -The server sends this message to transfter the GraphQL execution result from the server to the client, this message is a response for `GQL_START` message. - -For each GraphQL operation send with `GQL_START`, the server will respond with at least one `GQL_DATA` message. - -- `id: string` : ID of the operation that was successfully set up -- `payload: Object` : - * `data: any`: Execution result - * `errors?: Error[]` : Array of resolvers errors - -#### GQL_ERROR -Server sends this message upon a failing operation, before the GraphQL execution, usually due to GraphQL validation errors (resolver errors are part of `GQL_DATA` message, and will be added as `errors` array) -- `payload: Error` : payload with the error attributed to the operation failing on the server -- `id: string` : operation ID of the operation that failed on the server - -#### GQL_COMPLETE -Server sends this message to indicate that a GraphQL operation is done, and no more data will arrive for the specific operation. - -- `id: string` : operation ID of the operation that completed - -#### GQL_CONNECTION_KEEP_ALIVE -Server message that should be sent right after each `GQL_CONNECTION_ACK` processed and then periodically to keep the client connection alive. - -The client starts to consider the keep alive message only upon the first received keep alive message from the server. - -### Messages Flow - -This is a demonstration of client-server communication, in order to get a better understanding of the protocol flow: - -#### Session Init Phase - -The phase initializes the connection between the client and server, and usually will also build the server-side `context` for the execution. - -- Client connected immediately, or stops and wait if using lazy mode (until first operation execution) -- Client sends `GQL_CONNECTION_INIT` message to the server. -- Server calls `onConnect` callback with the init arguments, waits for init to finish and returns it's return value with `GQL_CONNECTION_ACK` + `GQL_CONNECTION_KEEP_ALIVE` (if used), or `GQL_CONNECTION_ERROR` in case of `false` or thrown exception from `onConnect` callback. -- Client gets `GQL_CONNECTION_ACK` + `GQL_CONNECTION_KEEP_ALIVE` (if used) and waits for the client's app to create subscriptions. - -#### Connected Phase - -This phase called per each operation the client request to execute: - -- App creates a subscription using `subscribe` or `query` client's API, and the `GQL_START` message sent to the server. -- Server calls `onOperation` callback, and responds with `GQL_DATA` in case of zero errors, or `GQL_ERROR` if there is a problem with the operation (is might also return `GQL_ERROR` with `errors` array, in case of resolvers errors). -- Client get `GQL_DATA` and handles it. -- Server calls `onOperationDone` if the operation is a query or mutation (for subscriptions, this called when unsubscribing) -- Server sends `GQL_COMPLETE` if the operation is a query or mutation (for subscriptions, this sent when unsubscribing) - -For subscriptions: -- App triggers `PubSub`'s publication method, and the server publishes the event, passing it through the `subscribe` executor to create GraphQL execution result -- Client receives `GQL_DATA` with the data, and handles it. -- When client unsubscribe, the server triggers `onOperationDone` and sends `GQL_COMPLETE` message to the client. - -When client done with executing GraphQL, it should close the connection and terminate the session using `GQL_CONNECTION_TERMINATE` message. diff --git a/node_modules/subscriptions-transport-ws/README.md b/node_modules/subscriptions-transport-ws/README.md deleted file mode 100644 index 61247d65..00000000 --- a/node_modules/subscriptions-transport-ws/README.md +++ /dev/null @@ -1,331 +0,0 @@ -[![npm version](https://badge.fury.io/js/subscriptions-transport-ws.svg)](https://badge.fury.io/js/subscriptions-transport-ws) [![GitHub license](https://img.shields.io/github/license/apollostack/subscriptions-transport-ws.svg)](https://github.com/apollostack/subscriptions-transport-ws/blob/license/LICENSE) - -# subscriptions-transport-ws - -**(Work in progress!)** - -A GraphQL WebSocket server and client to facilitate GraphQL queries, mutations and subscriptions over WebSocket. - -> `subscriptions-transport-ws` is an extension for GraphQL, and you can use it with any GraphQL client and server (not only Apollo). - -See [GitHunt-API](https://github.com/apollostack/GitHunt-API) and [GitHunt-React](https://github.com/apollostack/GitHunt-React) for an example server and client integration. - -# Getting Started - -Start by installing the package, using Yarn or NPM. - - Using Yarn: - $ yarn add subscriptions-transport-ws - - Or, using NPM: - $ npm install --save subscriptions-transport-ws - -> Note that you need to use this package on both GraphQL client and server. - -> This command also installs this package's dependencies, including `graphql-subscriptions`. - -## Server - -Starting with the server, create a new simple `PubSub` instance. We will later use this `PubSub` to publish and subscribe to data changes. - -```js -import { PubSub } from 'graphql-subscriptions'; - -export const pubsub = new PubSub(); -``` - -Now, create `SubscriptionServer` instance, with your GraphQL `schema`, `execute` and `subscribe` (from `graphql-js` package): - -```js -import { createServer } from 'http'; -import { SubscriptionServer } from 'subscriptions-transport-ws'; -import { execute, subscribe } from 'graphql'; -import { schema } from './my-schema'; - -const WS_PORT = 5000; - -// Create WebSocket listener server -const websocketServer = createServer((request, response) => { - response.writeHead(404); - response.end(); -}); - -// Bind it to port and start listening -websocketServer.listen(WS_PORT, () => console.log( - `Websocket Server is now running on http://localhost:${WS_PORT}` -)); - -const subscriptionServer = SubscriptionServer.create( - { - schema, - execute, - subscribe, - }, - { - server: websocketServer, - path: '/graphql', - }, -); -``` - -### Creating Your Subscriptions - -Please refer to [`graphql-subscriptions`](https://github.com/apollographql/graphql-subscriptions) documentation for how to create your GraphQL subscriptions, and how to publish data. - - - -## Client (browser) - -When using this package for client side, you can choose either use HTTP request for Queries and Mutation and use the WebSocket for subscriptions only, or create a full transport that handles all type of GraphQL operations over the socket. - -### Full WebSocket Transport - -To start with a full WebSocket transport, that handles all types of GraphQL operations, import and create an instance of `SubscriptionClient`. - -Then, create your `ApolloClient` instance and use the `SubscriptionsClient` instance as network interface: - -```js -import { SubscriptionClient } from 'subscriptions-transport-ws'; -import ApolloClient from 'apollo-client'; - -const GRAPHQL_ENDPOINT = 'ws://localhost:3000/graphql'; - -const client = new SubscriptionClient(GRAPHQL_ENDPOINT, { - reconnect: true, -}); - -const apolloClient = new ApolloClient({ - networkInterface: client, -}); - -``` - -### Hybrid WebSocket Transport - -To start with a hybrid WebSocket transport, that handles only `subscription`s over WebSocket, create your `SubscriptionClient` and a regular HTTP network interface, then extend your network interface to use the WebSocket client for GraphQL subscriptions: - -```js -import {SubscriptionClient, addGraphQLSubscriptions} from 'subscriptions-transport-ws'; -import ApolloClient, {createNetworkInterface} from 'apollo-client'; - -// Create regular NetworkInterface by using apollo-client's API: -const networkInterface = createNetworkInterface({ - uri: 'http://localhost:3000' // Your GraphQL endpoint -}); - -// Create WebSocket client -const wsClient = new SubscriptionClient(`ws://localhost:5000/`, { - reconnect: true, - connectionParams: { - // Pass any arguments you want for initialization - } -}); - -// Extend the network interface with the WebSocket -const networkInterfaceWithSubscriptions = addGraphQLSubscriptions( - networkInterface, - wsClient -); - -// Finally, create your ApolloClient instance with the modified network interface -const apolloClient = new ApolloClient({ - networkInterface: networkInterfaceWithSubscriptions -}); -``` - -Now, when you want to use subscriptions in client side, use your `ApolloClient` instance, with [`subscribe`](https://www.apollographql.com/docs/react/api/apollo-client#ApolloClient.subscribe) or `query` [`subscribeToMore`](https://www.apollographql.com/docs/react/api/apollo-client#ObservableQuery.subscribeToMore): - -```js -apolloClient.subscribe({ - query: gql` - subscription onNewItem { - newItemCreated { - id - } - }`, - variables: {} -}).subscribe({ - next (data) { - // Notify your application with the new arrived data - } -}); -``` - -```js -apolloClient.query({ - query: ITEM_LIST_QUERY, - variables: {} -}).subscribeToMore({ - document: gql` - subscription onNewItem { - newItemCreated { - id - } - }`, - variables: {}, - updateQuery: (prev, { subscriptionData, variables }) => { - // Perform updates on previousResult with subscriptionData - return updatedResult; - } -}); -``` - -If you don't use any package/modules loader, you can still use this package, by using `unpkg` service, and get the client side package from: - -``` -https://unpkg.com/subscriptions-transport-ws@VERSION/browser/client.js -``` - -> Replace VERSION with the latest version of the package. - - -## Use it with GraphiQL - -You can use this package's power with GraphiQL, and subscribe to live-data stream inside GraphiQL. - -If you are using the latest version of `graphql-server` flavors (`graphql-server-express`, `graphql-server-koa`, etc...), you already can use it! Make sure to specify `subscriptionsEndpoint` in GraphiQL configuration, and that's it! - -For example, `graphql-server-express` users need to add the following: - -```js -app.use('/graphiql', graphiqlExpress({ - endpointURL: '/graphql', - subscriptionsEndpoint: `YOUR_SUBSCRIPTION_ENDPOINT_HERE`, -})); -``` - -If you are using older version, or another GraphQL server, start by modifying GraphiQL static HTML, and add this package and it's fetcher from CDN: - -```html - - -``` - -Then, create `SubscriptionClient` and define the fetcher: - -```js -let subscriptionsClient = new window.SubscriptionsTransportWs.SubscriptionClient('SUBSCRIPTION_WS_URL_HERE', { - reconnect: true -}); -let myCustomFetcher = window.GraphiQLSubscriptionsFetcher.graphQLFetcher(subscriptionsClient, graphQLFetcher); -``` - -> `graphQLFetcher` is the default fetcher, and we use it as fallback for non-subscription GraphQL operations. - -And replace your GraphiQL creation logic to use the new fetcher: - -```js -ReactDOM.render( - React.createElement(GraphiQL, { - fetcher: myCustomFetcher, // <-- here - onEditQuery: onEditQuery, - onEditVariables: onEditVariables, - onEditOperationName: onEditOperationName, - query: ${safeSerialize(queryString)}, - response: ${safeSerialize(resultString)}, - variables: ${safeSerialize(variablesString)}, - operationName: ${safeSerialize(operationName)}, - }), - document.body -); -``` - -# API Docs - -## SubscriptionClient -### `Constructor(url, options, webSocketImpl)` -- `url: string` : url that the client will connect to, starts with `ws://` or `wss://` -- `options?: Object` : optional, object to modify default client behavior - * `timeout?: number` : how long the client should wait in ms for a keep-alive message from the server (default 30000 ms), this parameter is ignored if the server does not send keep-alive messages. This will also be used to calculate the max connection time per connect/reconnect - * `minTimeout?: number`: the minimum amount of time the client should wait for a connection to be made (default 1000 ms) - * `lazy?: boolean` : use to set lazy mode - connects only when first subscription created, and delay the socket initialization - * `connectionParams?: Object | Function | Promise` : object that will be available as first argument of `onConnect` (in server side), if passed a function - it will call it and send the return value, if function returns as promise - it will wait until it resolves and send the resolved value. - * `reconnect?: boolean` : automatic reconnect in case of connection error - * `reconnectionAttempts?: number` : how much reconnect attempts - * `connectionCallback?: (error) => {}` : optional, callback that called after the first init message, with the error (if there is one) - * `inactivityTimeout?: number` : how long the client should wait in ms, when there are no active subscriptions, before disconnecting from the server. Set to 0 to disable this behavior. (default 0) -- `webSocketImpl?: Object` - optional, constructor for W3C compliant WebSocket implementation. Use this when your environment does not have a built-in native WebSocket (for example, with NodeJS client) - -### Methods -#### `request(options) => Observable`: returns observable to execute the operation. -- `options: {OperationOptions}` - * `query: string` : GraphQL subscription - * `variables: Object` : GraphQL subscription variables - * `operationName: string` : operation name of the subscription - * `context: Object` : use to override context for a specific call - -#### `unsubscribeAll() => void` - unsubscribes from all active subscriptions. - -#### `on(eventName, callback, thisContext) => Function` -- `eventName: string`: the name of the event, available events are: `connecting`, `connected`, `reconnecting`, `reconnected`, `disconnected` and `error` -- `callback: Function`: function to be called when websocket connects and initialized. -- `thisContext: any`: `this` context to use when calling the callback function. -- => Returns an `off` method to cancel the event subscription. - -#### `onConnected(callback, thisContext) => Function` - shorthand for `.on('connected', ...)` -- `callback: Function(payload)`: function to be called when websocket connects and initialized, after ACK message returned from the server. Includes payload from server, if any. -- `thisContext: any`: `this` context to use when calling the callback function. -- => Returns an `off` method to cancel the event subscription. - -#### `onReconnected(callback, thisContext) => Function` - shorthand for `.on('reconnected', ...)` -- `callback: Function(payload)`: function to be called when websocket reconnects and initialized, after ACK message returned from the server. Includes payload from server, if any. -- `thisContext: any`: `this` context to use when calling the callback function. -- => Returns an `off` method to cancel the event subscription. - -#### `onConnecting(callback, thisContext) => Function` - shorthand for `.on('connecting', ...)` -- `callback: Function`: function to be called when websocket starts it's connection -- `thisContext: any`: `this` context to use when calling the callback function. -- => Returns an `off` method to cancel the event subscription. - -#### `onReconnecting(callback, thisContext) => Function` - shorthand for `.on('reconnecting', ...)` -- `callback: Function`: function to be called when websocket starts it's reconnection -- `thisContext: any`: `this` context to use when calling the callback function. -- => Returns an `off` method to cancel the event subscription. - -#### `onDisconnected(callback, thisContext) => Function` - shorthand for `.on('disconnected', ...)` -- `callback: Function`: function to be called when websocket disconnected. -- `thisContext: any`: `this` context to use when calling the callback function. -- => Returns an `off` method to cancel the event subscription. - -#### `onError(callback, thisContext) => Function` - shorthand for `.on('error', ...)` -- `callback: Function`: function to be called when an error occurs. -- `thisContext: any`: `this` context to use when calling the callback function. -- => Returns an `off` method to cancel the event subscription. - -### `close() => void` - closes the WebSocket connection manually, and ignores `reconnect` logic if it was set to `true`. - -### `use(middlewares: MiddlewareInterface[]) => SubscriptionClient` - adds middleware to modify `OperationOptions` per each request -- `middlewares: MiddlewareInterface[]` - Array contains list of middlewares (implemented `applyMiddleware` method) implementation, the `SubscriptionClient` will use the middlewares to modify `OperationOptions` for every operation - -### `status: number` : returns the current socket's `readyState` - - -## SubscriptionServer -### `Constructor(options, socketOptions | socketServer)` -- `options: {ServerOptions}` - * `rootValue?: any` : Root value to use when executing GraphQL root operations - * `schema?: GraphQLSchema` : GraphQL schema object. If not provided, you have to return the schema as a property on the object returned from `onOperation`. - * `execute?: (schema, document, rootValue, contextValue, variableValues, operationName) => Promise | AsyncIterator` : GraphQL `execute` function, provide the default one from `graphql` package. Return value of `AsyncItrator` is also valid since this package also support reactive `execute` methods. - * `subscribe?: (schema, document, rootValue, contextValue, variableValues, operationName) => Promise>` : GraphQL `subscribe` function, provide the default one from `graphql` package. - * `onOperation?: (message: SubscribeMessage, params: ExecutionParams, webSocket: WebSocket)` : optional method to create custom params that will be used when resolving this operation. It can also be used to dynamically resolve the schema that will be used for the particular operation. - * `onOperationComplete?: (webSocket: WebSocket, opId: string)` : optional method that called when a GraphQL operation is done (for query and mutation it's immediately, and for subscriptions when unsubscribing) - * `onConnect?: (connectionParams: Object, webSocket: WebSocket, context: ConnectionContext)` : optional method that called when a client connects to the socket, called with the `connectionParams` from the client, if the return value is an object, its elements will be added to the context. return `false` or throw an exception to reject the connection. May return a Promise. - * `onDisconnect?: (webSocket: WebSocket, context: ConnectionContext)` : optional method that called when a client disconnects - * `keepAlive?: number` : optional interval in ms to send `KEEPALIVE` messages to all clients - -- `socketOptions: {WebSocket.IServerOptions}` : options to pass to the WebSocket object (full docs [here](https://github.com/websockets/ws/blob/master/doc/ws.md)) - * `server?: HttpServer` - existing HTTP server to use (use without `host`/`port`) - * `host?: string` - server host - * `port?: number` - server port - * `path?: string` - endpoint path - -- `socketServer: {WebSocket.Server}` : a configured server if you need more control. Can be used for integration testing with in-memory WebSocket implementation. - -## How it works? - -* For GraphQL WebSocket protocol docs, [click here](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md) -* This package also uses `AsyncIterator` internally using [iterall](https://github.com/leebyron/iterall), for more information [click here](https://github.com/ReactiveX/IxJS), or [the proposal](https://github.com/tc39/proposal-async-iteration) - -The current version of this transport, also support a previous version of the protocol. - -[You can find the old protocol docs here](https://github.com/apollographql/subscriptions-transport-ws/blob/cacb8692f3601344a4101d802443d046d73f8b23/README.md#client-server-communication) diff --git a/node_modules/subscriptions-transport-ws/browser/client.js b/node_modules/subscriptions-transport-ws/browser/client.js deleted file mode 100644 index 746f554c..00000000 --- a/node_modules/subscriptions-transport-ws/browser/client.js +++ /dev/null @@ -1,2590 +0,0 @@ -var SubscriptionsTransportWs = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 2); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') -var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; -var _default = nodejsCustomInspectSymbol; -exports.default = _default; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) { -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -var __awaiter = (this && this.__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()); - }); -}; -var __generator = (this && this.__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 }; - } -}; -var __spreadArrays = (this && this.__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; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SubscriptionClient = void 0; -var _global = typeof global !== 'undefined' ? global : (typeof window !== 'undefined' ? window : {}); -var NativeWebSocket = _global.WebSocket || _global.MozWebSocket; -var Backoff = __webpack_require__(3); -var eventemitter3_1 = __webpack_require__(4); -var is_string_1 = __webpack_require__(5); -var is_object_1 = __webpack_require__(6); -var printer_1 = __webpack_require__(7); -var getOperationAST_1 = __webpack_require__(14); -var symbol_observable_1 = __webpack_require__(16); -var protocol_1 = __webpack_require__(19); -var defaults_1 = __webpack_require__(20); -var message_types_1 = __webpack_require__(21); -var SubscriptionClient = (function () { - function SubscriptionClient(url, options, webSocketImpl, webSocketProtocols) { - var _a = (options || {}), _b = _a.connectionCallback, connectionCallback = _b === void 0 ? undefined : _b, _c = _a.connectionParams, connectionParams = _c === void 0 ? {} : _c, _d = _a.minTimeout, minTimeout = _d === void 0 ? defaults_1.MIN_WS_TIMEOUT : _d, _e = _a.timeout, timeout = _e === void 0 ? defaults_1.WS_TIMEOUT : _e, _f = _a.reconnect, reconnect = _f === void 0 ? false : _f, _g = _a.reconnectionAttempts, reconnectionAttempts = _g === void 0 ? Infinity : _g, _h = _a.lazy, lazy = _h === void 0 ? false : _h, _j = _a.inactivityTimeout, inactivityTimeout = _j === void 0 ? 0 : _j, _k = _a.wsOptionArguments, wsOptionArguments = _k === void 0 ? [] : _k; - this.wsImpl = webSocketImpl || NativeWebSocket; - if (!this.wsImpl) { - throw new Error('Unable to find native implementation, or alternative implementation for WebSocket!'); - } - this.wsProtocols = webSocketProtocols || protocol_1.GRAPHQL_WS; - this.connectionCallback = connectionCallback; - this.url = url; - this.operations = {}; - this.nextOperationId = 0; - this.minWsTimeout = minTimeout; - this.wsTimeout = timeout; - this.unsentMessagesQueue = []; - this.reconnect = reconnect; - this.reconnecting = false; - this.reconnectionAttempts = reconnectionAttempts; - this.lazy = !!lazy; - this.inactivityTimeout = inactivityTimeout; - this.closedByUser = false; - this.backoff = new Backoff({ jitter: 0.5 }); - this.eventEmitter = new eventemitter3_1.EventEmitter(); - this.middlewares = []; - this.client = null; - this.maxConnectTimeGenerator = this.createMaxConnectTimeGenerator(); - this.connectionParams = this.getConnectionParams(connectionParams); - this.wsOptionArguments = wsOptionArguments; - if (!this.lazy) { - this.connect(); - } - } - Object.defineProperty(SubscriptionClient.prototype, "status", { - get: function () { - if (this.client === null) { - return this.wsImpl.CLOSED; - } - return this.client.readyState; - }, - enumerable: false, - configurable: true - }); - SubscriptionClient.prototype.close = function (isForced, closedByUser) { - if (isForced === void 0) { isForced = true; } - if (closedByUser === void 0) { closedByUser = true; } - this.clearInactivityTimeout(); - if (this.client !== null) { - this.closedByUser = closedByUser; - if (isForced) { - this.clearCheckConnectionInterval(); - this.clearMaxConnectTimeout(); - this.clearTryReconnectTimeout(); - this.unsubscribeAll(); - this.sendMessage(undefined, message_types_1.default.GQL_CONNECTION_TERMINATE, null); - } - this.client.close(); - this.client.onopen = null; - this.client.onclose = null; - this.client.onerror = null; - this.client.onmessage = null; - this.client = null; - this.eventEmitter.emit('disconnected'); - if (!isForced) { - this.tryReconnect(); - } - } - }; - SubscriptionClient.prototype.request = function (request) { - var _a; - var getObserver = this.getObserver.bind(this); - var executeOperation = this.executeOperation.bind(this); - var unsubscribe = this.unsubscribe.bind(this); - var opId; - this.clearInactivityTimeout(); - return _a = {}, - _a[symbol_observable_1.default] = function () { - return this; - }, - _a.subscribe = function (observerOrNext, onError, onComplete) { - var observer = getObserver(observerOrNext, onError, onComplete); - opId = executeOperation(request, function (error, result) { - if (error === null && result === null) { - if (observer.complete) { - observer.complete(); - } - } - else if (error) { - if (observer.error) { - observer.error(error[0]); - } - } - else { - if (observer.next) { - observer.next(result); - } - } - }); - return { - unsubscribe: function () { - if (opId) { - unsubscribe(opId); - opId = null; - } - }, - }; - }, - _a; - }; - SubscriptionClient.prototype.on = function (eventName, callback, context) { - var handler = this.eventEmitter.on(eventName, callback, context); - return function () { - handler.off(eventName, callback, context); - }; - }; - SubscriptionClient.prototype.onConnected = function (callback, context) { - return this.on('connected', callback, context); - }; - SubscriptionClient.prototype.onConnecting = function (callback, context) { - return this.on('connecting', callback, context); - }; - SubscriptionClient.prototype.onDisconnected = function (callback, context) { - return this.on('disconnected', callback, context); - }; - SubscriptionClient.prototype.onReconnected = function (callback, context) { - return this.on('reconnected', callback, context); - }; - SubscriptionClient.prototype.onReconnecting = function (callback, context) { - return this.on('reconnecting', callback, context); - }; - SubscriptionClient.prototype.onError = function (callback, context) { - return this.on('error', callback, context); - }; - SubscriptionClient.prototype.unsubscribeAll = function () { - var _this = this; - Object.keys(this.operations).forEach(function (subId) { - _this.unsubscribe(subId); - }); - }; - SubscriptionClient.prototype.applyMiddlewares = function (options) { - var _this = this; - return new Promise(function (resolve, reject) { - var queue = function (funcs, scope) { - var next = function (error) { - if (error) { - reject(error); - } - else { - if (funcs.length > 0) { - var f = funcs.shift(); - if (f) { - f.applyMiddleware.apply(scope, [options, next]); - } - } - else { - resolve(options); - } - } - }; - next(); - }; - queue(__spreadArrays(_this.middlewares), _this); - }); - }; - SubscriptionClient.prototype.use = function (middlewares) { - var _this = this; - middlewares.map(function (middleware) { - if (typeof middleware.applyMiddleware === 'function') { - _this.middlewares.push(middleware); - } - else { - throw new Error('Middleware must implement the applyMiddleware function.'); - } - }); - return this; - }; - SubscriptionClient.prototype.getConnectionParams = function (connectionParams) { - return function () { return new Promise(function (resolve, reject) { - if (typeof connectionParams === 'function') { - try { - return resolve(connectionParams.call(null)); - } - catch (error) { - return reject(error); - } - } - resolve(connectionParams); - }); }; - }; - SubscriptionClient.prototype.executeOperation = function (options, handler) { - var _this = this; - if (this.client === null) { - this.connect(); - } - var opId = this.generateOperationId(); - this.operations[opId] = { options: options, handler: handler }; - this.applyMiddlewares(options) - .then(function (processedOptions) { - _this.checkOperationOptions(processedOptions, handler); - if (_this.operations[opId]) { - _this.operations[opId] = { options: processedOptions, handler: handler }; - _this.sendMessage(opId, message_types_1.default.GQL_START, processedOptions); - } - }) - .catch(function (error) { - _this.unsubscribe(opId); - handler(_this.formatErrors(error)); - }); - return opId; - }; - SubscriptionClient.prototype.getObserver = function (observerOrNext, error, complete) { - if (typeof observerOrNext === 'function') { - return { - next: function (v) { return observerOrNext(v); }, - error: function (e) { return error && error(e); }, - complete: function () { return complete && complete(); }, - }; - } - return observerOrNext; - }; - SubscriptionClient.prototype.createMaxConnectTimeGenerator = function () { - var minValue = this.minWsTimeout; - var maxValue = this.wsTimeout; - return new Backoff({ - min: minValue, - max: maxValue, - factor: 1.2, - }); - }; - SubscriptionClient.prototype.clearCheckConnectionInterval = function () { - if (this.checkConnectionIntervalId) { - clearInterval(this.checkConnectionIntervalId); - this.checkConnectionIntervalId = null; - } - }; - SubscriptionClient.prototype.clearMaxConnectTimeout = function () { - if (this.maxConnectTimeoutId) { - clearTimeout(this.maxConnectTimeoutId); - this.maxConnectTimeoutId = null; - } - }; - SubscriptionClient.prototype.clearTryReconnectTimeout = function () { - if (this.tryReconnectTimeoutId) { - clearTimeout(this.tryReconnectTimeoutId); - this.tryReconnectTimeoutId = null; - } - }; - SubscriptionClient.prototype.clearInactivityTimeout = function () { - if (this.inactivityTimeoutId) { - clearTimeout(this.inactivityTimeoutId); - this.inactivityTimeoutId = null; - } - }; - SubscriptionClient.prototype.setInactivityTimeout = function () { - var _this = this; - if (this.inactivityTimeout > 0 && Object.keys(this.operations).length === 0) { - this.inactivityTimeoutId = setTimeout(function () { - if (Object.keys(_this.operations).length === 0) { - _this.close(); - } - }, this.inactivityTimeout); - } - }; - SubscriptionClient.prototype.checkOperationOptions = function (options, handler) { - var query = options.query, variables = options.variables, operationName = options.operationName; - if (!query) { - throw new Error('Must provide a query.'); - } - if (!handler) { - throw new Error('Must provide an handler.'); - } - if ((!is_string_1.default(query) && !getOperationAST_1.getOperationAST(query, operationName)) || - (operationName && !is_string_1.default(operationName)) || - (variables && !is_object_1.default(variables))) { - throw new Error('Incorrect option types. query must be a string or a document,' + - '`operationName` must be a string, and `variables` must be an object.'); - } - }; - SubscriptionClient.prototype.buildMessage = function (id, type, payload) { - var payloadToReturn = payload && payload.query ? __assign(__assign({}, payload), { query: typeof payload.query === 'string' ? payload.query : printer_1.print(payload.query) }) : - payload; - return { - id: id, - type: type, - payload: payloadToReturn, - }; - }; - SubscriptionClient.prototype.formatErrors = function (errors) { - if (Array.isArray(errors)) { - return errors; - } - if (errors && errors.errors) { - return this.formatErrors(errors.errors); - } - if (errors && errors.message) { - return [errors]; - } - return [{ - name: 'FormatedError', - message: 'Unknown error', - originalError: errors, - }]; - }; - SubscriptionClient.prototype.sendMessage = function (id, type, payload) { - this.sendMessageRaw(this.buildMessage(id, type, payload)); - }; - SubscriptionClient.prototype.sendMessageRaw = function (message) { - switch (this.status) { - case this.wsImpl.OPEN: - var serializedMessage = JSON.stringify(message); - try { - JSON.parse(serializedMessage); - } - catch (e) { - this.eventEmitter.emit('error', new Error("Message must be JSON-serializable. Got: " + message)); - } - this.client.send(serializedMessage); - break; - case this.wsImpl.CONNECTING: - this.unsentMessagesQueue.push(message); - break; - default: - if (!this.reconnecting) { - this.eventEmitter.emit('error', new Error('A message was not sent because socket is not connected, is closing or ' + - 'is already closed. Message was: ' + JSON.stringify(message))); - } - } - }; - SubscriptionClient.prototype.generateOperationId = function () { - return String(++this.nextOperationId); - }; - SubscriptionClient.prototype.tryReconnect = function () { - var _this = this; - if (!this.reconnect || this.backoff.attempts >= this.reconnectionAttempts) { - return; - } - if (!this.reconnecting) { - Object.keys(this.operations).forEach(function (key) { - _this.unsentMessagesQueue.push(_this.buildMessage(key, message_types_1.default.GQL_START, _this.operations[key].options)); - }); - this.reconnecting = true; - } - this.clearTryReconnectTimeout(); - var delay = this.backoff.duration(); - this.tryReconnectTimeoutId = setTimeout(function () { - _this.connect(); - }, delay); - }; - SubscriptionClient.prototype.flushUnsentMessagesQueue = function () { - var _this = this; - this.unsentMessagesQueue.forEach(function (message) { - _this.sendMessageRaw(message); - }); - this.unsentMessagesQueue = []; - }; - SubscriptionClient.prototype.checkConnection = function () { - if (this.wasKeepAliveReceived) { - this.wasKeepAliveReceived = false; - return; - } - if (!this.reconnecting) { - this.close(false, true); - } - }; - SubscriptionClient.prototype.checkMaxConnectTimeout = function () { - var _this = this; - this.clearMaxConnectTimeout(); - this.maxConnectTimeoutId = setTimeout(function () { - if (_this.status !== _this.wsImpl.OPEN) { - _this.reconnecting = true; - _this.close(false, true); - } - }, this.maxConnectTimeGenerator.duration()); - }; - SubscriptionClient.prototype.connect = function () { - var _a; - var _this = this; - this.client = new ((_a = this.wsImpl).bind.apply(_a, __spreadArrays([void 0, this.url, this.wsProtocols], this.wsOptionArguments)))(); - this.checkMaxConnectTimeout(); - this.client.onopen = function () { return __awaiter(_this, void 0, void 0, function () { - var connectionParams, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(this.status === this.wsImpl.OPEN)) return [3, 4]; - this.clearMaxConnectTimeout(); - this.closedByUser = false; - this.eventEmitter.emit(this.reconnecting ? 'reconnecting' : 'connecting'); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4, this.connectionParams()]; - case 2: - connectionParams = _a.sent(); - this.sendMessage(undefined, message_types_1.default.GQL_CONNECTION_INIT, connectionParams); - this.flushUnsentMessagesQueue(); - return [3, 4]; - case 3: - error_1 = _a.sent(); - this.sendMessage(undefined, message_types_1.default.GQL_CONNECTION_ERROR, error_1); - this.flushUnsentMessagesQueue(); - return [3, 4]; - case 4: return [2]; - } - }); - }); }; - this.client.onclose = function () { - if (!_this.closedByUser) { - _this.close(false, false); - } - }; - this.client.onerror = function (err) { - _this.eventEmitter.emit('error', err); - }; - this.client.onmessage = function (_a) { - var data = _a.data; - _this.processReceivedData(data); - }; - }; - SubscriptionClient.prototype.processReceivedData = function (receivedData) { - var parsedMessage; - var opId; - try { - parsedMessage = JSON.parse(receivedData); - opId = parsedMessage.id; - } - catch (e) { - throw new Error("Message must be JSON-parseable. Got: " + receivedData); - } - if ([message_types_1.default.GQL_DATA, - message_types_1.default.GQL_COMPLETE, - message_types_1.default.GQL_ERROR, - ].indexOf(parsedMessage.type) !== -1 && !this.operations[opId]) { - this.unsubscribe(opId); - return; - } - switch (parsedMessage.type) { - case message_types_1.default.GQL_CONNECTION_ERROR: - if (this.connectionCallback) { - this.connectionCallback(parsedMessage.payload); - } - break; - case message_types_1.default.GQL_CONNECTION_ACK: - this.eventEmitter.emit(this.reconnecting ? 'reconnected' : 'connected', parsedMessage.payload); - this.reconnecting = false; - this.backoff.reset(); - this.maxConnectTimeGenerator.reset(); - if (this.connectionCallback) { - this.connectionCallback(); - } - break; - case message_types_1.default.GQL_COMPLETE: - var handler = this.operations[opId].handler; - delete this.operations[opId]; - handler.call(this, null, null); - break; - case message_types_1.default.GQL_ERROR: - this.operations[opId].handler(this.formatErrors(parsedMessage.payload), null); - delete this.operations[opId]; - break; - case message_types_1.default.GQL_DATA: - var parsedPayload = !parsedMessage.payload.errors ? - parsedMessage.payload : __assign(__assign({}, parsedMessage.payload), { errors: this.formatErrors(parsedMessage.payload.errors) }); - this.operations[opId].handler(null, parsedPayload); - break; - case message_types_1.default.GQL_CONNECTION_KEEP_ALIVE: - var firstKA = typeof this.wasKeepAliveReceived === 'undefined'; - this.wasKeepAliveReceived = true; - if (firstKA) { - this.checkConnection(); - } - if (this.checkConnectionIntervalId) { - clearInterval(this.checkConnectionIntervalId); - this.checkConnection(); - } - this.checkConnectionIntervalId = setInterval(this.checkConnection.bind(this), this.wsTimeout); - break; - default: - throw new Error('Invalid message type!'); - } - }; - SubscriptionClient.prototype.unsubscribe = function (opId) { - if (this.operations[opId]) { - delete this.operations[opId]; - this.setInactivityTimeout(); - this.sendMessage(opId, message_types_1.default.GQL_STOP, undefined); - } - }; - return SubscriptionClient; -}()); -exports.SubscriptionClient = SubscriptionClient; -//# sourceMappingURL=client.js.map -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - -/** - * Expose `Backoff`. - */ - -module.exports = Backoff; - -/** - * Initialize backoff timer with `opts`. - * - * - `min` initial timeout in milliseconds [100] - * - `max` max timeout [10000] - * - `jitter` [0] - * - `factor` [2] - * - * @param {Object} opts - * @api public - */ - -function Backoff(opts) { - opts = opts || {}; - this.ms = opts.min || 100; - this.max = opts.max || 10000; - this.factor = opts.factor || 2; - this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; - this.attempts = 0; -} - -/** - * Return the backoff duration. - * - * @return {Number} - * @api public - */ - -Backoff.prototype.duration = function(){ - var ms = this.ms * Math.pow(this.factor, this.attempts++); - if (this.jitter) { - var rand = Math.random(); - var deviation = Math.floor(rand * this.jitter * ms); - ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; - } - return Math.min(ms, this.max) | 0; -}; - -/** - * Reset the number of attempts. - * - * @api public - */ - -Backoff.prototype.reset = function(){ - this.attempts = 0; -}; - -/** - * Set the minimum duration - * - * @api public - */ - -Backoff.prototype.setMin = function(min){ - this.ms = min; -}; - -/** - * Set the maximum duration - * - * @api public - */ - -Backoff.prototype.setMax = function(max){ - this.max = max; -}; - -/** - * Set the jitter - * - * @api public - */ - -Backoff.prototype.setJitter = function(jitter){ - this.jitter = jitter; -}; - - - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var has = Object.prototype.hasOwnProperty - , prefix = '~'; - -/** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ -function Events() {} - -// -// We try to not inherit from `Object.prototype`. In some engines creating an -// instance in this way is faster than calling `Object.create(null)` directly. -// If `Object.create(null)` is not supported we prefix the event names with a -// character to make sure that the built-in object properties are not -// overridden or used as an attack vector. -// -if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; -} - -/** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ -function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; -} - -/** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ -function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; -} - -/** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ -function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; -} - -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ -function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; -} - -/** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ -EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; -}; - -/** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ -EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; -}; - -/** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ -EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; -}; - -/** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ -EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; -}; - -/** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); -}; - -/** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); -}; - -/** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; -}; - -/** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; -}; - -// -// Alias methods names because people roll like that. -// -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -// -// Expose the prefix. -// -EventEmitter.prefixed = prefix; - -// -// Allow `EventEmitter` to be imported as module namespace. -// -EventEmitter.EventEmitter = EventEmitter; - -// -// Expose the module. -// -if (true) { - module.exports = EventEmitter; -} - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -function isString(value) { - return typeof value === 'string'; -} -exports.default = isString; -//# sourceMappingURL=is-string.js.map - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -function isObject(value) { - return ((value !== null) && (typeof value === 'object')); -} -exports.default = isObject; -//# sourceMappingURL=is-object.js.map - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.print = print; - -var _visitor = __webpack_require__(8); - -var _blockString = __webpack_require__(13); - -/** - * Converts an AST into a string, using one set of reasonable - * formatting rules. - */ -function print(ast) { - return (0, _visitor.visit)(ast, { - leave: printDocASTReducer - }); -} // TODO: provide better type coverage in future - - -var printDocASTReducer = { - Name: function Name(node) { - return node.value; - }, - Variable: function Variable(node) { - return '$' + node.name; - }, - // Document - Document: function Document(node) { - return join(node.definitions, '\n\n') + '\n'; - }, - OperationDefinition: function OperationDefinition(node) { - var op = node.operation; - var name = node.name; - var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); - var directives = join(node.directives, ' '); - var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use - // the query short form. - - return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' '); - }, - VariableDefinition: function VariableDefinition(_ref) { - var variable = _ref.variable, - type = _ref.type, - defaultValue = _ref.defaultValue, - directives = _ref.directives; - return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' ')); - }, - SelectionSet: function SelectionSet(_ref2) { - var selections = _ref2.selections; - return block(selections); - }, - Field: function Field(_ref3) { - var alias = _ref3.alias, - name = _ref3.name, - args = _ref3.arguments, - directives = _ref3.directives, - selectionSet = _ref3.selectionSet; - return join([wrap('', alias, ': ') + name + wrap('(', join(args, ', '), ')'), join(directives, ' '), selectionSet], ' '); - }, - Argument: function Argument(_ref4) { - var name = _ref4.name, - value = _ref4.value; - return name + ': ' + value; - }, - // Fragments - FragmentSpread: function FragmentSpread(_ref5) { - var name = _ref5.name, - directives = _ref5.directives; - return '...' + name + wrap(' ', join(directives, ' ')); - }, - InlineFragment: function InlineFragment(_ref6) { - var typeCondition = _ref6.typeCondition, - directives = _ref6.directives, - selectionSet = _ref6.selectionSet; - return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); - }, - FragmentDefinition: function FragmentDefinition(_ref7) { - var name = _ref7.name, - typeCondition = _ref7.typeCondition, - variableDefinitions = _ref7.variableDefinitions, - directives = _ref7.directives, - selectionSet = _ref7.selectionSet; - return (// Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet - ); - }, - // Value - IntValue: function IntValue(_ref8) { - var value = _ref8.value; - return value; - }, - FloatValue: function FloatValue(_ref9) { - var value = _ref9.value; - return value; - }, - StringValue: function StringValue(_ref10, key) { - var value = _ref10.value, - isBlockString = _ref10.block; - return isBlockString ? (0, _blockString.printBlockString)(value, key === 'description' ? '' : ' ') : JSON.stringify(value); - }, - BooleanValue: function BooleanValue(_ref11) { - var value = _ref11.value; - return value ? 'true' : 'false'; - }, - NullValue: function NullValue() { - return 'null'; - }, - EnumValue: function EnumValue(_ref12) { - var value = _ref12.value; - return value; - }, - ListValue: function ListValue(_ref13) { - var values = _ref13.values; - return '[' + join(values, ', ') + ']'; - }, - ObjectValue: function ObjectValue(_ref14) { - var fields = _ref14.fields; - return '{' + join(fields, ', ') + '}'; - }, - ObjectField: function ObjectField(_ref15) { - var name = _ref15.name, - value = _ref15.value; - return name + ': ' + value; - }, - // Directive - Directive: function Directive(_ref16) { - var name = _ref16.name, - args = _ref16.arguments; - return '@' + name + wrap('(', join(args, ', '), ')'); - }, - // Type - NamedType: function NamedType(_ref17) { - var name = _ref17.name; - return name; - }, - ListType: function ListType(_ref18) { - var type = _ref18.type; - return '[' + type + ']'; - }, - NonNullType: function NonNullType(_ref19) { - var type = _ref19.type; - return type + '!'; - }, - // Type System Definitions - SchemaDefinition: addDescription(function (_ref20) { - var directives = _ref20.directives, - operationTypes = _ref20.operationTypes; - return join(['schema', join(directives, ' '), block(operationTypes)], ' '); - }), - OperationTypeDefinition: function OperationTypeDefinition(_ref21) { - var operation = _ref21.operation, - type = _ref21.type; - return operation + ': ' + type; - }, - ScalarTypeDefinition: addDescription(function (_ref22) { - var name = _ref22.name, - directives = _ref22.directives; - return join(['scalar', name, join(directives, ' ')], ' '); - }), - ObjectTypeDefinition: addDescription(function (_ref23) { - var name = _ref23.name, - interfaces = _ref23.interfaces, - directives = _ref23.directives, - fields = _ref23.fields; - return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }), - FieldDefinition: addDescription(function (_ref24) { - var name = _ref24.name, - args = _ref24.arguments, - type = _ref24.type, - directives = _ref24.directives; - return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' ')); - }), - InputValueDefinition: addDescription(function (_ref25) { - var name = _ref25.name, - type = _ref25.type, - defaultValue = _ref25.defaultValue, - directives = _ref25.directives; - return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '); - }), - InterfaceTypeDefinition: addDescription(function (_ref26) { - var name = _ref26.name, - interfaces = _ref26.interfaces, - directives = _ref26.directives, - fields = _ref26.fields; - return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }), - UnionTypeDefinition: addDescription(function (_ref27) { - var name = _ref27.name, - directives = _ref27.directives, - types = _ref27.types; - return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); - }), - EnumTypeDefinition: addDescription(function (_ref28) { - var name = _ref28.name, - directives = _ref28.directives, - values = _ref28.values; - return join(['enum', name, join(directives, ' '), block(values)], ' '); - }), - EnumValueDefinition: addDescription(function (_ref29) { - var name = _ref29.name, - directives = _ref29.directives; - return join([name, join(directives, ' ')], ' '); - }), - InputObjectTypeDefinition: addDescription(function (_ref30) { - var name = _ref30.name, - directives = _ref30.directives, - fields = _ref30.fields; - return join(['input', name, join(directives, ' '), block(fields)], ' '); - }), - DirectiveDefinition: addDescription(function (_ref31) { - var name = _ref31.name, - args = _ref31.arguments, - repeatable = _ref31.repeatable, - locations = _ref31.locations; - return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | '); - }), - SchemaExtension: function SchemaExtension(_ref32) { - var directives = _ref32.directives, - operationTypes = _ref32.operationTypes; - return join(['extend schema', join(directives, ' '), block(operationTypes)], ' '); - }, - ScalarTypeExtension: function ScalarTypeExtension(_ref33) { - var name = _ref33.name, - directives = _ref33.directives; - return join(['extend scalar', name, join(directives, ' ')], ' '); - }, - ObjectTypeExtension: function ObjectTypeExtension(_ref34) { - var name = _ref34.name, - interfaces = _ref34.interfaces, - directives = _ref34.directives, - fields = _ref34.fields; - return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }, - InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) { - var name = _ref35.name, - interfaces = _ref35.interfaces, - directives = _ref35.directives, - fields = _ref35.fields; - return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); - }, - UnionTypeExtension: function UnionTypeExtension(_ref36) { - var name = _ref36.name, - directives = _ref36.directives, - types = _ref36.types; - return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); - }, - EnumTypeExtension: function EnumTypeExtension(_ref37) { - var name = _ref37.name, - directives = _ref37.directives, - values = _ref37.values; - return join(['extend enum', name, join(directives, ' '), block(values)], ' '); - }, - InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) { - var name = _ref38.name, - directives = _ref38.directives, - fields = _ref38.fields; - return join(['extend input', name, join(directives, ' '), block(fields)], ' '); - } -}; - -function addDescription(cb) { - return function (node) { - return join([node.description, cb(node)], '\n'); - }; -} -/** - * Given maybeArray, print an empty string if it is null or empty, otherwise - * print all items together separated by separator if provided - */ - - -function join(maybeArray) { - var _maybeArray$filter$jo; - - var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) { - return x; - }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ''; -} -/** - * Given array, print each item on its own line, wrapped in an - * indented "{ }" block. - */ - - -function block(array) { - return array && array.length !== 0 ? '{\n' + indent(join(array, '\n')) + '\n}' : ''; -} -/** - * If maybeString is not null or empty, then wrap with start and end, otherwise - * print an empty string. - */ - - -function wrap(start, maybeString) { - var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - return maybeString ? start + maybeString + end : ''; -} - -function indent(maybeString) { - return maybeString && ' ' + maybeString.replace(/\n/g, '\n '); -} - -function isMultiline(string) { - return string.indexOf('\n') !== -1; -} - -function hasMultilineItems(maybeArray) { - return maybeArray && maybeArray.some(isMultiline); -} - - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.visit = visit; -exports.visitInParallel = visitInParallel; -exports.getVisitFn = getVisitFn; -exports.BREAK = exports.QueryDocumentKeys = void 0; - -var _inspect = _interopRequireDefault(__webpack_require__(9)); - -var _ast = __webpack_require__(10); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var QueryDocumentKeys = { - Name: [], - Document: ['definitions'], - OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'], - VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], - Variable: ['name'], - SelectionSet: ['selections'], - Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], - Argument: ['name', 'value'], - FragmentSpread: ['name', 'directives'], - InlineFragment: ['typeCondition', 'directives', 'selectionSet'], - FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'], - IntValue: [], - FloatValue: [], - StringValue: [], - BooleanValue: [], - NullValue: [], - EnumValue: [], - ListValue: ['values'], - ObjectValue: ['fields'], - ObjectField: ['name', 'value'], - Directive: ['name', 'arguments'], - NamedType: ['name'], - ListType: ['type'], - NonNullType: ['type'], - SchemaDefinition: ['description', 'directives', 'operationTypes'], - OperationTypeDefinition: ['type'], - ScalarTypeDefinition: ['description', 'name', 'directives'], - ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], - FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], - InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'], - InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], - UnionTypeDefinition: ['description', 'name', 'directives', 'types'], - EnumTypeDefinition: ['description', 'name', 'directives', 'values'], - EnumValueDefinition: ['description', 'name', 'directives'], - InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], - DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], - SchemaExtension: ['directives', 'operationTypes'], - ScalarTypeExtension: ['name', 'directives'], - ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], - UnionTypeExtension: ['name', 'directives', 'types'], - EnumTypeExtension: ['name', 'directives', 'values'], - InputObjectTypeExtension: ['name', 'directives', 'fields'] -}; -exports.QueryDocumentKeys = QueryDocumentKeys; -var BREAK = Object.freeze({}); -/** - * visit() will walk through an AST using a depth-first traversal, calling - * the visitor's enter function at each node in the traversal, and calling the - * leave function after visiting that node and all of its child nodes. - * - * By returning different values from the enter and leave functions, the - * behavior of the visitor can be altered, including skipping over a sub-tree of - * the AST (by returning false), editing the AST by returning a value or null - * to remove the value, or to stop the whole traversal by returning BREAK. - * - * When using visit() to edit an AST, the original AST will not be modified, and - * a new version of the AST with the changes applied will be returned from the - * visit function. - * - * const editedAST = visit(ast, { - * enter(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: skip visiting this node - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * }, - * leave(node, key, parent, path, ancestors) { - * // @return - * // undefined: no action - * // false: no action - * // visitor.BREAK: stop visiting altogether - * // null: delete this node - * // any value: replace this node with the returned value - * } - * }); - * - * Alternatively to providing enter() and leave() functions, a visitor can - * instead provide functions named the same as the kinds of AST nodes, or - * enter/leave visitors at a named key, leading to four permutations of the - * visitor API: - * - * 1) Named visitors triggered when entering a node of a specific kind. - * - * visit(ast, { - * Kind(node) { - * // enter the "Kind" node - * } - * }) - * - * 2) Named visitors that trigger upon entering and leaving a node of - * a specific kind. - * - * visit(ast, { - * Kind: { - * enter(node) { - * // enter the "Kind" node - * } - * leave(node) { - * // leave the "Kind" node - * } - * } - * }) - * - * 3) Generic visitors that trigger upon entering and leaving any node. - * - * visit(ast, { - * enter(node) { - * // enter any node - * }, - * leave(node) { - * // leave any node - * } - * }) - * - * 4) Parallel visitors for entering and leaving nodes of a specific kind. - * - * visit(ast, { - * enter: { - * Kind(node) { - * // enter the "Kind" node - * } - * }, - * leave: { - * Kind(node) { - * // leave the "Kind" node - * } - * } - * }) - */ - -exports.BREAK = BREAK; - -function visit(root, visitor) { - var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys; - - /* eslint-disable no-undef-init */ - var stack = undefined; - var inArray = Array.isArray(root); - var keys = [root]; - var index = -1; - var edits = []; - var node = undefined; - var key = undefined; - var parent = undefined; - var path = []; - var ancestors = []; - var newRoot = root; - /* eslint-enable no-undef-init */ - - do { - index++; - var isLeaving = index === keys.length; - var isEdited = isLeaving && edits.length !== 0; - - if (isLeaving) { - key = ancestors.length === 0 ? undefined : path[path.length - 1]; - node = parent; - parent = ancestors.pop(); - - if (isEdited) { - if (inArray) { - node = node.slice(); - } else { - var clone = {}; - - for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) { - var k = _Object$keys2[_i2]; - clone[k] = node[k]; - } - - node = clone; - } - - var editOffset = 0; - - for (var ii = 0; ii < edits.length; ii++) { - var editKey = edits[ii][0]; - var editValue = edits[ii][1]; - - if (inArray) { - editKey -= editOffset; - } - - if (inArray && editValue === null) { - node.splice(editKey, 1); - editOffset++; - } else { - node[editKey] = editValue; - } - } - } - - index = stack.index; - keys = stack.keys; - edits = stack.edits; - inArray = stack.inArray; - stack = stack.prev; - } else { - key = parent ? inArray ? index : keys[index] : undefined; - node = parent ? parent[key] : newRoot; - - if (node === null || node === undefined) { - continue; - } - - if (parent) { - path.push(key); - } - } - - var result = void 0; - - if (!Array.isArray(node)) { - if (!(0, _ast.isNode)(node)) { - throw new Error("Invalid AST Node: ".concat((0, _inspect.default)(node), ".")); - } - - var visitFn = getVisitFn(visitor, node.kind, isLeaving); - - if (visitFn) { - result = visitFn.call(visitor, node, key, parent, path, ancestors); - - if (result === BREAK) { - break; - } - - if (result === false) { - if (!isLeaving) { - path.pop(); - continue; - } - } else if (result !== undefined) { - edits.push([key, result]); - - if (!isLeaving) { - if ((0, _ast.isNode)(result)) { - node = result; - } else { - path.pop(); - continue; - } - } - } - } - } - - if (result === undefined && isEdited) { - edits.push([key, node]); - } - - if (isLeaving) { - path.pop(); - } else { - var _visitorKeys$node$kin; - - stack = { - inArray: inArray, - index: index, - keys: keys, - edits: edits, - prev: stack - }; - inArray = Array.isArray(node); - keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : []; - index = -1; - edits = []; - - if (parent) { - ancestors.push(parent); - } - - parent = node; - } - } while (stack !== undefined); - - if (edits.length !== 0) { - newRoot = edits[edits.length - 1][1]; - } - - return newRoot; -} -/** - * Creates a new visitor instance which delegates to many visitors to run in - * parallel. Each visitor will be visited for each node before moving on. - * - * If a prior visitor edits a node, no following visitors will see that node. - */ - - -function visitInParallel(visitors) { - var skipping = new Array(visitors.length); - return { - enter: function enter(node) { - for (var i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - var fn = getVisitFn(visitors[i], node.kind, - /* isLeaving */ - false); - - if (fn) { - var result = fn.apply(visitors[i], arguments); - - if (result === false) { - skipping[i] = node; - } else if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined) { - return result; - } - } - } - } - }, - leave: function leave(node) { - for (var i = 0; i < visitors.length; i++) { - if (skipping[i] == null) { - var fn = getVisitFn(visitors[i], node.kind, - /* isLeaving */ - true); - - if (fn) { - var result = fn.apply(visitors[i], arguments); - - if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== undefined && result !== false) { - return result; - } - } - } else if (skipping[i] === node) { - skipping[i] = null; - } - } - } - }; -} -/** - * Given a visitor instance, if it is leaving or not, and a node kind, return - * the function the visitor runtime should call. - */ - - -function getVisitFn(visitor, kind, isLeaving) { - var kindVisitor = visitor[kind]; - - if (kindVisitor) { - if (!isLeaving && typeof kindVisitor === 'function') { - // { Kind() {} } - return kindVisitor; - } - - var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter; - - if (typeof kindSpecificVisitor === 'function') { - // { Kind: { enter() {}, leave() {} } } - return kindSpecificVisitor; - } - } else { - var specificVisitor = isLeaving ? visitor.leave : visitor.enter; - - if (specificVisitor) { - if (typeof specificVisitor === 'function') { - // { enter() {}, leave() {} } - return specificVisitor; - } - - var specificKindVisitor = specificVisitor[kind]; - - if (typeof specificKindVisitor === 'function') { - // { enter: { Kind() {} }, leave: { Kind() {} } } - return specificKindVisitor; - } - } - } -} - - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = inspect; - -var _nodejsCustomInspectSymbol = _interopRequireDefault(__webpack_require__(1)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var MAX_ARRAY_LENGTH = 10; -var MAX_RECURSIVE_DEPTH = 2; -/** - * Used to print values in error messages. - */ - -function inspect(value) { - return formatValue(value, []); -} - -function formatValue(value, seenValues) { - switch (_typeof(value)) { - case 'string': - return JSON.stringify(value); - - case 'function': - return value.name ? "[function ".concat(value.name, "]") : '[function]'; - - case 'object': - if (value === null) { - return 'null'; - } - - return formatObjectValue(value, seenValues); - - default: - return String(value); - } -} - -function formatObjectValue(value, previouslySeenValues) { - if (previouslySeenValues.indexOf(value) !== -1) { - return '[Circular]'; - } - - var seenValues = [].concat(previouslySeenValues, [value]); - var customInspectFn = getCustomFn(value); - - if (customInspectFn !== undefined) { - // $FlowFixMe(>=0.90.0) - var customValue = customInspectFn.call(value); // check for infinite recursion - - if (customValue !== value) { - return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); - } - } else if (Array.isArray(value)) { - return formatArray(value, seenValues); - } - - return formatObject(value, seenValues); -} - -function formatObject(object, seenValues) { - var keys = Object.keys(object); - - if (keys.length === 0) { - return '{}'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[' + getObjectTag(object) + ']'; - } - - var properties = keys.map(function (key) { - var value = formatValue(object[key], seenValues); - return key + ': ' + value; - }); - return '{ ' + properties.join(', ') + ' }'; -} - -function formatArray(array, seenValues) { - if (array.length === 0) { - return '[]'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[Array]'; - } - - var len = Math.min(MAX_ARRAY_LENGTH, array.length); - var remaining = array.length - len; - var items = []; - - for (var i = 0; i < len; ++i) { - items.push(formatValue(array[i], seenValues)); - } - - if (remaining === 1) { - items.push('... 1 more item'); - } else if (remaining > 1) { - items.push("... ".concat(remaining, " more items")); - } - - return '[' + items.join(', ') + ']'; -} - -function getCustomFn(object) { - var customInspectFn = object[String(_nodejsCustomInspectSymbol.default)]; - - if (typeof customInspectFn === 'function') { - return customInspectFn; - } - - if (typeof object.inspect === 'function') { - return object.inspect; - } -} - -function getObjectTag(object) { - var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); - - if (tag === 'Object' && typeof object.constructor === 'function') { - var name = object.constructor.name; - - if (typeof name === 'string' && name !== '') { - return name; - } - } - - return tag; -} - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isNode = isNode; -exports.Token = exports.Location = void 0; - -var _defineInspect = _interopRequireDefault(__webpack_require__(11)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Contains a range of UTF-8 character offsets and token references that - * identify the region of the source from which the AST derived. - */ -var Location = /*#__PURE__*/function () { - /** - * The character offset at which this Node begins. - */ - - /** - * The character offset at which this Node ends. - */ - - /** - * The Token at which this Node begins. - */ - - /** - * The Token at which this Node ends. - */ - - /** - * The Source document the AST represents. - */ - function Location(startToken, endToken, source) { - this.start = startToken.start; - this.end = endToken.end; - this.startToken = startToken; - this.endToken = endToken; - this.source = source; - } - - var _proto = Location.prototype; - - _proto.toJSON = function toJSON() { - return { - start: this.start, - end: this.end - }; - }; - - return Location; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.Location = Location; -(0, _defineInspect.default)(Location); -/** - * Represents a range of characters represented by a lexical token - * within a Source. - */ - -var Token = /*#__PURE__*/function () { - /** - * The kind of Token. - */ - - /** - * The character offset at which this Node begins. - */ - - /** - * The character offset at which this Node ends. - */ - - /** - * The 1-indexed line number on which this Token appears. - */ - - /** - * The 1-indexed column number at which this Token begins. - */ - - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - function Token(kind, start, end, line, column, prev, value) { - this.kind = kind; - this.start = start; - this.end = end; - this.line = line; - this.column = column; - this.value = value; - this.prev = prev; - this.next = null; - } - - var _proto2 = Token.prototype; - - _proto2.toJSON = function toJSON() { - return { - kind: this.kind, - value: this.value, - line: this.line, - column: this.column - }; - }; - - return Token; -}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. - - -exports.Token = Token; -(0, _defineInspect.default)(Token); -/** - * @internal - */ - -function isNode(maybeNode) { - return maybeNode != null && typeof maybeNode.kind === 'string'; -} -/** - * The list of all possible AST node types. - */ - - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = defineInspect; - -var _invariant = _interopRequireDefault(__webpack_require__(12)); - -var _nodejsCustomInspectSymbol = _interopRequireDefault(__webpack_require__(1)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` - */ -function defineInspect(classObject) { - var fn = classObject.prototype.toJSON; - typeof fn === 'function' || (0, _invariant.default)(0); - classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') - - if (_nodejsCustomInspectSymbol.default) { - classObject.prototype[_nodejsCustomInspectSymbol.default] = fn; - } -} - - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = invariant; - -function invariant(condition, message) { - var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') - - if (!booleanCondition) { - throw new Error(message != null ? message : 'Unexpected invariant triggered.'); - } -} - - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.dedentBlockStringValue = dedentBlockStringValue; -exports.getBlockStringIndentation = getBlockStringIndentation; -exports.printBlockString = printBlockString; - -/** - * Produces the value of a block string from its parsed raw value, similar to - * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. - * - * This implements the GraphQL spec's BlockStringValue() static algorithm. - * - * @internal - */ -function dedentBlockStringValue(rawString) { - // Expand a block string's raw value into independent lines. - var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. - - var commonIndent = getBlockStringIndentation(lines); - - if (commonIndent !== 0) { - for (var i = 1; i < lines.length; i++) { - lines[i] = lines[i].slice(commonIndent); - } - } // Remove leading and trailing blank lines. - - - while (lines.length > 0 && isBlank(lines[0])) { - lines.shift(); - } - - while (lines.length > 0 && isBlank(lines[lines.length - 1])) { - lines.pop(); - } // Return a string of the lines joined with U+000A. - - - return lines.join('\n'); -} -/** - * @internal - */ - - -function getBlockStringIndentation(lines) { - var commonIndent = null; - - for (var i = 1; i < lines.length; i++) { - var line = lines[i]; - var indent = leadingWhitespace(line); - - if (indent === line.length) { - continue; // skip empty lines - } - - if (commonIndent === null || indent < commonIndent) { - commonIndent = indent; - - if (commonIndent === 0) { - break; - } - } - } - - return commonIndent === null ? 0 : commonIndent; -} - -function leadingWhitespace(str) { - var i = 0; - - while (i < str.length && (str[i] === ' ' || str[i] === '\t')) { - i++; - } - - return i; -} - -function isBlank(str) { - return leadingWhitespace(str) === str.length; -} -/** - * Print a block string in the indented block form by adding a leading and - * trailing blank line. However, if a block string starts with whitespace and is - * a single-line, adding a leading blank line would strip that whitespace. - * - * @internal - */ - - -function printBlockString(value) { - var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var isSingleLine = value.indexOf('\n') === -1; - var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; - var hasTrailingQuote = value[value.length - 1] === '"'; - var hasTrailingSlash = value[value.length - 1] === '\\'; - var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines; - var result = ''; // Format a multi-line block quote to account for leading space. - - if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { - result += '\n' + indentation; - } - - result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; - - if (printAsMultipleLines) { - result += '\n'; - } - - return '"""' + result.replace(/"""/g, '\\"""') + '"""'; -} - - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getOperationAST = getOperationAST; - -var _kinds = __webpack_require__(15); - -/** - * Returns an operation AST given a document AST and optionally an operation - * name. If a name is not provided, an operation is only returned if only one is - * provided in the document. - */ -function getOperationAST(documentAST, operationName) { - var operation = null; - - for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) { - var definition = _documentAST$definiti2[_i2]; - - if (definition.kind === _kinds.Kind.OPERATION_DEFINITION) { - var _definition$name; - - if (operationName == null) { - // If no operation name was provided, only return an Operation if there - // is one defined in the document. Upon encountering the second, return - // null. - if (operation) { - return null; - } - - operation = definition; - } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { - return definition; - } - } - } - - return operation; -} - - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Kind = void 0; - -/** - * The set of allowed kind values for AST nodes. - */ -var Kind = Object.freeze({ - // Name - NAME: 'Name', - // Document - DOCUMENT: 'Document', - OPERATION_DEFINITION: 'OperationDefinition', - VARIABLE_DEFINITION: 'VariableDefinition', - SELECTION_SET: 'SelectionSet', - FIELD: 'Field', - ARGUMENT: 'Argument', - // Fragments - FRAGMENT_SPREAD: 'FragmentSpread', - INLINE_FRAGMENT: 'InlineFragment', - FRAGMENT_DEFINITION: 'FragmentDefinition', - // Values - VARIABLE: 'Variable', - INT: 'IntValue', - FLOAT: 'FloatValue', - STRING: 'StringValue', - BOOLEAN: 'BooleanValue', - NULL: 'NullValue', - ENUM: 'EnumValue', - LIST: 'ListValue', - OBJECT: 'ObjectValue', - OBJECT_FIELD: 'ObjectField', - // Directives - DIRECTIVE: 'Directive', - // Types - NAMED_TYPE: 'NamedType', - LIST_TYPE: 'ListType', - NON_NULL_TYPE: 'NonNullType', - // Type System Definitions - SCHEMA_DEFINITION: 'SchemaDefinition', - OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', - // Type Definitions - SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', - OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', - FIELD_DEFINITION: 'FieldDefinition', - INPUT_VALUE_DEFINITION: 'InputValueDefinition', - INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', - UNION_TYPE_DEFINITION: 'UnionTypeDefinition', - ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', - ENUM_VALUE_DEFINITION: 'EnumValueDefinition', - INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', - // Directive Definitions - DIRECTIVE_DEFINITION: 'DirectiveDefinition', - // Type System Extensions - SCHEMA_EXTENSION: 'SchemaExtension', - // Type Extensions - SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', - OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', - INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', - UNION_TYPE_EXTENSION: 'UnionTypeExtension', - ENUM_TYPE_EXTENSION: 'EnumTypeExtension', - INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' -}); -/** - * The enum type representing the possible kind values of AST nodes. - */ - -exports.Kind = Kind; - - -/***/ }), -/* 16 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ponyfill_js__ = __webpack_require__(18); -/* global window */ - - -var root; - -if (typeof self !== 'undefined') { - root = self; -} else if (typeof window !== 'undefined') { - root = window; -} else if (typeof global !== 'undefined') { - root = global; -} else if (true) { - root = module; -} else { - root = Function('return this')(); -} - -var result = Object(__WEBPACK_IMPORTED_MODULE_0__ponyfill_js__["a" /* default */])(root); -/* harmony default export */ __webpack_exports__["default"] = (result); - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(0), __webpack_require__(17)(module))) - -/***/ }), -/* 17 */ -/***/ (function(module, exports) { - -module.exports = function(originalModule) { - if(!originalModule.webpackPolyfill) { - var module = Object.create(originalModule); - // module.parent = undefined by default - if(!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - Object.defineProperty(module, "exports", { - enumerable: true, - }); - module.webpackPolyfill = 1; - } - return module; -}; - - -/***/ }), -/* 18 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = symbolObservablePonyfill; -function symbolObservablePonyfill(root) { - var result; - var Symbol = root.Symbol; - - if (typeof Symbol === 'function') { - if (Symbol.observable) { - result = Symbol.observable; - } else { - result = Symbol('observable'); - Symbol.observable = result; - } - } else { - result = '@@observable'; - } - - return result; -}; - - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GRAPHQL_SUBSCRIPTIONS = exports.GRAPHQL_WS = void 0; -var GRAPHQL_WS = 'graphql-ws'; -exports.GRAPHQL_WS = GRAPHQL_WS; -var GRAPHQL_SUBSCRIPTIONS = 'graphql-subscriptions'; -exports.GRAPHQL_SUBSCRIPTIONS = GRAPHQL_SUBSCRIPTIONS; -//# sourceMappingURL=protocol.js.map - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WS_TIMEOUT = exports.MIN_WS_TIMEOUT = void 0; -var MIN_WS_TIMEOUT = 1000; -exports.MIN_WS_TIMEOUT = MIN_WS_TIMEOUT; -var WS_TIMEOUT = 30000; -exports.WS_TIMEOUT = WS_TIMEOUT; -//# sourceMappingURL=defaults.js.map - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var MessageTypes = (function () { - function MessageTypes() { - throw new Error('Static Class'); - } - MessageTypes.GQL_CONNECTION_INIT = 'connection_init'; - MessageTypes.GQL_CONNECTION_ACK = 'connection_ack'; - MessageTypes.GQL_CONNECTION_ERROR = 'connection_error'; - MessageTypes.GQL_CONNECTION_KEEP_ALIVE = 'ka'; - MessageTypes.GQL_CONNECTION_TERMINATE = 'connection_terminate'; - MessageTypes.GQL_START = 'start'; - MessageTypes.GQL_DATA = 'data'; - MessageTypes.GQL_ERROR = 'error'; - MessageTypes.GQL_COMPLETE = 'complete'; - MessageTypes.GQL_STOP = 'stop'; - MessageTypes.SUBSCRIPTION_START = 'subscription_start'; - MessageTypes.SUBSCRIPTION_DATA = 'subscription_data'; - MessageTypes.SUBSCRIPTION_SUCCESS = 'subscription_success'; - MessageTypes.SUBSCRIPTION_FAIL = 'subscription_fail'; - MessageTypes.SUBSCRIPTION_END = 'subscription_end'; - MessageTypes.INIT = 'init'; - MessageTypes.INIT_SUCCESS = 'init_success'; - MessageTypes.INIT_FAIL = 'init_fail'; - MessageTypes.KEEP_ALIVE = 'keepalive'; - return MessageTypes; -}()); -exports.default = MessageTypes; -//# sourceMappingURL=message-types.js.map - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/client.d.ts b/node_modules/subscriptions-transport-ws/dist/client.d.ts deleted file mode 100644 index c50cb806..00000000 --- a/node_modules/subscriptions-transport-ws/dist/client.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { ListenerFn } from 'eventemitter3'; -import { ExecutionResult } from 'graphql/execution/execute'; -import { DocumentNode } from 'graphql/language/ast'; -export interface Observer { - next?: (value: T) => void; - error?: (error: Error) => void; - complete?: () => void; -} -export interface Observable { - subscribe(observer: Observer): { - unsubscribe: () => void; - }; -} -export interface OperationOptions { - query?: string | DocumentNode; - variables?: Object; - operationName?: string; - [key: string]: any; -} -export declare type FormatedError = Error & { - originalError?: any; -}; -export interface Operation { - options: OperationOptions; - handler: (error: Error[], result?: any) => void; -} -export interface Operations { - [id: string]: Operation; -} -export interface Middleware { - applyMiddleware(options: OperationOptions, next: Function): void; -} -export declare type ConnectionParams = { - [paramName: string]: any; -}; -export declare type ConnectionParamsOptions = ConnectionParams | Function | Promise; -export interface ClientOptions { - connectionParams?: ConnectionParamsOptions; - minTimeout?: number; - timeout?: number; - reconnect?: boolean; - reconnectionAttempts?: number; - connectionCallback?: (error: Error[], result?: any) => void; - lazy?: boolean; - inactivityTimeout?: number; - wsOptionArguments?: any[]; -} -export declare class SubscriptionClient { - client: any; - operations: Operations; - private url; - private nextOperationId; - private connectionParams; - private minWsTimeout; - private wsTimeout; - private unsentMessagesQueue; - private reconnect; - private reconnecting; - private reconnectionAttempts; - private backoff; - private connectionCallback; - private eventEmitter; - private lazy; - private inactivityTimeout; - private inactivityTimeoutId; - private closedByUser; - private wsImpl; - private wsProtocols; - private wasKeepAliveReceived; - private tryReconnectTimeoutId; - private checkConnectionIntervalId; - private maxConnectTimeoutId; - private middlewares; - private maxConnectTimeGenerator; - private wsOptionArguments; - constructor(url: string, options?: ClientOptions, webSocketImpl?: any, webSocketProtocols?: string | string[]); - get status(): any; - close(isForced?: boolean, closedByUser?: boolean): void; - request(request: OperationOptions): Observable; - on(eventName: string, callback: ListenerFn, context?: any): Function; - onConnected(callback: ListenerFn, context?: any): Function; - onConnecting(callback: ListenerFn, context?: any): Function; - onDisconnected(callback: ListenerFn, context?: any): Function; - onReconnected(callback: ListenerFn, context?: any): Function; - onReconnecting(callback: ListenerFn, context?: any): Function; - onError(callback: ListenerFn, context?: any): Function; - unsubscribeAll(): void; - applyMiddlewares(options: OperationOptions): Promise; - use(middlewares: Middleware[]): SubscriptionClient; - private getConnectionParams; - private executeOperation; - private getObserver; - private createMaxConnectTimeGenerator; - private clearCheckConnectionInterval; - private clearMaxConnectTimeout; - private clearTryReconnectTimeout; - private clearInactivityTimeout; - private setInactivityTimeout; - private checkOperationOptions; - private buildMessage; - private formatErrors; - private sendMessage; - private sendMessageRaw; - private generateOperationId; - private tryReconnect; - private flushUnsentMessagesQueue; - private checkConnection; - private checkMaxConnectTimeout; - private connect; - private processReceivedData; - private unsubscribe; -} diff --git a/node_modules/subscriptions-transport-ws/dist/client.js b/node_modules/subscriptions-transport-ws/dist/client.js deleted file mode 100644 index 3202dcd6..00000000 --- a/node_modules/subscriptions-transport-ws/dist/client.js +++ /dev/null @@ -1,560 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -var __awaiter = (this && this.__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()); - }); -}; -var __generator = (this && this.__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 }; - } -}; -var __spreadArrays = (this && this.__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; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SubscriptionClient = void 0; -var _global = typeof global !== 'undefined' ? global : (typeof window !== 'undefined' ? window : {}); -var NativeWebSocket = _global.WebSocket || _global.MozWebSocket; -var Backoff = require("backo2"); -var eventemitter3_1 = require("eventemitter3"); -var is_string_1 = require("./utils/is-string"); -var is_object_1 = require("./utils/is-object"); -var printer_1 = require("graphql/language/printer"); -var getOperationAST_1 = require("graphql/utilities/getOperationAST"); -var symbol_observable_1 = require("symbol-observable"); -var protocol_1 = require("./protocol"); -var defaults_1 = require("./defaults"); -var message_types_1 = require("./message-types"); -var SubscriptionClient = (function () { - function SubscriptionClient(url, options, webSocketImpl, webSocketProtocols) { - var _a = (options || {}), _b = _a.connectionCallback, connectionCallback = _b === void 0 ? undefined : _b, _c = _a.connectionParams, connectionParams = _c === void 0 ? {} : _c, _d = _a.minTimeout, minTimeout = _d === void 0 ? defaults_1.MIN_WS_TIMEOUT : _d, _e = _a.timeout, timeout = _e === void 0 ? defaults_1.WS_TIMEOUT : _e, _f = _a.reconnect, reconnect = _f === void 0 ? false : _f, _g = _a.reconnectionAttempts, reconnectionAttempts = _g === void 0 ? Infinity : _g, _h = _a.lazy, lazy = _h === void 0 ? false : _h, _j = _a.inactivityTimeout, inactivityTimeout = _j === void 0 ? 0 : _j, _k = _a.wsOptionArguments, wsOptionArguments = _k === void 0 ? [] : _k; - this.wsImpl = webSocketImpl || NativeWebSocket; - if (!this.wsImpl) { - throw new Error('Unable to find native implementation, or alternative implementation for WebSocket!'); - } - this.wsProtocols = webSocketProtocols || protocol_1.GRAPHQL_WS; - this.connectionCallback = connectionCallback; - this.url = url; - this.operations = {}; - this.nextOperationId = 0; - this.minWsTimeout = minTimeout; - this.wsTimeout = timeout; - this.unsentMessagesQueue = []; - this.reconnect = reconnect; - this.reconnecting = false; - this.reconnectionAttempts = reconnectionAttempts; - this.lazy = !!lazy; - this.inactivityTimeout = inactivityTimeout; - this.closedByUser = false; - this.backoff = new Backoff({ jitter: 0.5 }); - this.eventEmitter = new eventemitter3_1.EventEmitter(); - this.middlewares = []; - this.client = null; - this.maxConnectTimeGenerator = this.createMaxConnectTimeGenerator(); - this.connectionParams = this.getConnectionParams(connectionParams); - this.wsOptionArguments = wsOptionArguments; - if (!this.lazy) { - this.connect(); - } - } - Object.defineProperty(SubscriptionClient.prototype, "status", { - get: function () { - if (this.client === null) { - return this.wsImpl.CLOSED; - } - return this.client.readyState; - }, - enumerable: false, - configurable: true - }); - SubscriptionClient.prototype.close = function (isForced, closedByUser) { - if (isForced === void 0) { isForced = true; } - if (closedByUser === void 0) { closedByUser = true; } - this.clearInactivityTimeout(); - if (this.client !== null) { - this.closedByUser = closedByUser; - if (isForced) { - this.clearCheckConnectionInterval(); - this.clearMaxConnectTimeout(); - this.clearTryReconnectTimeout(); - this.unsubscribeAll(); - this.sendMessage(undefined, message_types_1.default.GQL_CONNECTION_TERMINATE, null); - } - this.client.close(); - this.client.onopen = null; - this.client.onclose = null; - this.client.onerror = null; - this.client.onmessage = null; - this.client = null; - this.eventEmitter.emit('disconnected'); - if (!isForced) { - this.tryReconnect(); - } - } - }; - SubscriptionClient.prototype.request = function (request) { - var _a; - var getObserver = this.getObserver.bind(this); - var executeOperation = this.executeOperation.bind(this); - var unsubscribe = this.unsubscribe.bind(this); - var opId; - this.clearInactivityTimeout(); - return _a = {}, - _a[symbol_observable_1.default] = function () { - return this; - }, - _a.subscribe = function (observerOrNext, onError, onComplete) { - var observer = getObserver(observerOrNext, onError, onComplete); - opId = executeOperation(request, function (error, result) { - if (error === null && result === null) { - if (observer.complete) { - observer.complete(); - } - } - else if (error) { - if (observer.error) { - observer.error(error[0]); - } - } - else { - if (observer.next) { - observer.next(result); - } - } - }); - return { - unsubscribe: function () { - if (opId) { - unsubscribe(opId); - opId = null; - } - }, - }; - }, - _a; - }; - SubscriptionClient.prototype.on = function (eventName, callback, context) { - var handler = this.eventEmitter.on(eventName, callback, context); - return function () { - handler.off(eventName, callback, context); - }; - }; - SubscriptionClient.prototype.onConnected = function (callback, context) { - return this.on('connected', callback, context); - }; - SubscriptionClient.prototype.onConnecting = function (callback, context) { - return this.on('connecting', callback, context); - }; - SubscriptionClient.prototype.onDisconnected = function (callback, context) { - return this.on('disconnected', callback, context); - }; - SubscriptionClient.prototype.onReconnected = function (callback, context) { - return this.on('reconnected', callback, context); - }; - SubscriptionClient.prototype.onReconnecting = function (callback, context) { - return this.on('reconnecting', callback, context); - }; - SubscriptionClient.prototype.onError = function (callback, context) { - return this.on('error', callback, context); - }; - SubscriptionClient.prototype.unsubscribeAll = function () { - var _this = this; - Object.keys(this.operations).forEach(function (subId) { - _this.unsubscribe(subId); - }); - }; - SubscriptionClient.prototype.applyMiddlewares = function (options) { - var _this = this; - return new Promise(function (resolve, reject) { - var queue = function (funcs, scope) { - var next = function (error) { - if (error) { - reject(error); - } - else { - if (funcs.length > 0) { - var f = funcs.shift(); - if (f) { - f.applyMiddleware.apply(scope, [options, next]); - } - } - else { - resolve(options); - } - } - }; - next(); - }; - queue(__spreadArrays(_this.middlewares), _this); - }); - }; - SubscriptionClient.prototype.use = function (middlewares) { - var _this = this; - middlewares.map(function (middleware) { - if (typeof middleware.applyMiddleware === 'function') { - _this.middlewares.push(middleware); - } - else { - throw new Error('Middleware must implement the applyMiddleware function.'); - } - }); - return this; - }; - SubscriptionClient.prototype.getConnectionParams = function (connectionParams) { - return function () { return new Promise(function (resolve, reject) { - if (typeof connectionParams === 'function') { - try { - return resolve(connectionParams.call(null)); - } - catch (error) { - return reject(error); - } - } - resolve(connectionParams); - }); }; - }; - SubscriptionClient.prototype.executeOperation = function (options, handler) { - var _this = this; - if (this.client === null) { - this.connect(); - } - var opId = this.generateOperationId(); - this.operations[opId] = { options: options, handler: handler }; - this.applyMiddlewares(options) - .then(function (processedOptions) { - _this.checkOperationOptions(processedOptions, handler); - if (_this.operations[opId]) { - _this.operations[opId] = { options: processedOptions, handler: handler }; - _this.sendMessage(opId, message_types_1.default.GQL_START, processedOptions); - } - }) - .catch(function (error) { - _this.unsubscribe(opId); - handler(_this.formatErrors(error)); - }); - return opId; - }; - SubscriptionClient.prototype.getObserver = function (observerOrNext, error, complete) { - if (typeof observerOrNext === 'function') { - return { - next: function (v) { return observerOrNext(v); }, - error: function (e) { return error && error(e); }, - complete: function () { return complete && complete(); }, - }; - } - return observerOrNext; - }; - SubscriptionClient.prototype.createMaxConnectTimeGenerator = function () { - var minValue = this.minWsTimeout; - var maxValue = this.wsTimeout; - return new Backoff({ - min: minValue, - max: maxValue, - factor: 1.2, - }); - }; - SubscriptionClient.prototype.clearCheckConnectionInterval = function () { - if (this.checkConnectionIntervalId) { - clearInterval(this.checkConnectionIntervalId); - this.checkConnectionIntervalId = null; - } - }; - SubscriptionClient.prototype.clearMaxConnectTimeout = function () { - if (this.maxConnectTimeoutId) { - clearTimeout(this.maxConnectTimeoutId); - this.maxConnectTimeoutId = null; - } - }; - SubscriptionClient.prototype.clearTryReconnectTimeout = function () { - if (this.tryReconnectTimeoutId) { - clearTimeout(this.tryReconnectTimeoutId); - this.tryReconnectTimeoutId = null; - } - }; - SubscriptionClient.prototype.clearInactivityTimeout = function () { - if (this.inactivityTimeoutId) { - clearTimeout(this.inactivityTimeoutId); - this.inactivityTimeoutId = null; - } - }; - SubscriptionClient.prototype.setInactivityTimeout = function () { - var _this = this; - if (this.inactivityTimeout > 0 && Object.keys(this.operations).length === 0) { - this.inactivityTimeoutId = setTimeout(function () { - if (Object.keys(_this.operations).length === 0) { - _this.close(); - } - }, this.inactivityTimeout); - } - }; - SubscriptionClient.prototype.checkOperationOptions = function (options, handler) { - var query = options.query, variables = options.variables, operationName = options.operationName; - if (!query) { - throw new Error('Must provide a query.'); - } - if (!handler) { - throw new Error('Must provide an handler.'); - } - if ((!is_string_1.default(query) && !getOperationAST_1.getOperationAST(query, operationName)) || - (operationName && !is_string_1.default(operationName)) || - (variables && !is_object_1.default(variables))) { - throw new Error('Incorrect option types. query must be a string or a document,' + - '`operationName` must be a string, and `variables` must be an object.'); - } - }; - SubscriptionClient.prototype.buildMessage = function (id, type, payload) { - var payloadToReturn = payload && payload.query ? __assign(__assign({}, payload), { query: typeof payload.query === 'string' ? payload.query : printer_1.print(payload.query) }) : - payload; - return { - id: id, - type: type, - payload: payloadToReturn, - }; - }; - SubscriptionClient.prototype.formatErrors = function (errors) { - if (Array.isArray(errors)) { - return errors; - } - if (errors && errors.errors) { - return this.formatErrors(errors.errors); - } - if (errors && errors.message) { - return [errors]; - } - return [{ - name: 'FormatedError', - message: 'Unknown error', - originalError: errors, - }]; - }; - SubscriptionClient.prototype.sendMessage = function (id, type, payload) { - this.sendMessageRaw(this.buildMessage(id, type, payload)); - }; - SubscriptionClient.prototype.sendMessageRaw = function (message) { - switch (this.status) { - case this.wsImpl.OPEN: - var serializedMessage = JSON.stringify(message); - try { - JSON.parse(serializedMessage); - } - catch (e) { - this.eventEmitter.emit('error', new Error("Message must be JSON-serializable. Got: " + message)); - } - this.client.send(serializedMessage); - break; - case this.wsImpl.CONNECTING: - this.unsentMessagesQueue.push(message); - break; - default: - if (!this.reconnecting) { - this.eventEmitter.emit('error', new Error('A message was not sent because socket is not connected, is closing or ' + - 'is already closed. Message was: ' + JSON.stringify(message))); - } - } - }; - SubscriptionClient.prototype.generateOperationId = function () { - return String(++this.nextOperationId); - }; - SubscriptionClient.prototype.tryReconnect = function () { - var _this = this; - if (!this.reconnect || this.backoff.attempts >= this.reconnectionAttempts) { - return; - } - if (!this.reconnecting) { - Object.keys(this.operations).forEach(function (key) { - _this.unsentMessagesQueue.push(_this.buildMessage(key, message_types_1.default.GQL_START, _this.operations[key].options)); - }); - this.reconnecting = true; - } - this.clearTryReconnectTimeout(); - var delay = this.backoff.duration(); - this.tryReconnectTimeoutId = setTimeout(function () { - _this.connect(); - }, delay); - }; - SubscriptionClient.prototype.flushUnsentMessagesQueue = function () { - var _this = this; - this.unsentMessagesQueue.forEach(function (message) { - _this.sendMessageRaw(message); - }); - this.unsentMessagesQueue = []; - }; - SubscriptionClient.prototype.checkConnection = function () { - if (this.wasKeepAliveReceived) { - this.wasKeepAliveReceived = false; - return; - } - if (!this.reconnecting) { - this.close(false, true); - } - }; - SubscriptionClient.prototype.checkMaxConnectTimeout = function () { - var _this = this; - this.clearMaxConnectTimeout(); - this.maxConnectTimeoutId = setTimeout(function () { - if (_this.status !== _this.wsImpl.OPEN) { - _this.reconnecting = true; - _this.close(false, true); - } - }, this.maxConnectTimeGenerator.duration()); - }; - SubscriptionClient.prototype.connect = function () { - var _a; - var _this = this; - this.client = new ((_a = this.wsImpl).bind.apply(_a, __spreadArrays([void 0, this.url, this.wsProtocols], this.wsOptionArguments)))(); - this.checkMaxConnectTimeout(); - this.client.onopen = function () { return __awaiter(_this, void 0, void 0, function () { - var connectionParams, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(this.status === this.wsImpl.OPEN)) return [3, 4]; - this.clearMaxConnectTimeout(); - this.closedByUser = false; - this.eventEmitter.emit(this.reconnecting ? 'reconnecting' : 'connecting'); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4, this.connectionParams()]; - case 2: - connectionParams = _a.sent(); - this.sendMessage(undefined, message_types_1.default.GQL_CONNECTION_INIT, connectionParams); - this.flushUnsentMessagesQueue(); - return [3, 4]; - case 3: - error_1 = _a.sent(); - this.sendMessage(undefined, message_types_1.default.GQL_CONNECTION_ERROR, error_1); - this.flushUnsentMessagesQueue(); - return [3, 4]; - case 4: return [2]; - } - }); - }); }; - this.client.onclose = function () { - if (!_this.closedByUser) { - _this.close(false, false); - } - }; - this.client.onerror = function (err) { - _this.eventEmitter.emit('error', err); - }; - this.client.onmessage = function (_a) { - var data = _a.data; - _this.processReceivedData(data); - }; - }; - SubscriptionClient.prototype.processReceivedData = function (receivedData) { - var parsedMessage; - var opId; - try { - parsedMessage = JSON.parse(receivedData); - opId = parsedMessage.id; - } - catch (e) { - throw new Error("Message must be JSON-parseable. Got: " + receivedData); - } - if ([message_types_1.default.GQL_DATA, - message_types_1.default.GQL_COMPLETE, - message_types_1.default.GQL_ERROR, - ].indexOf(parsedMessage.type) !== -1 && !this.operations[opId]) { - this.unsubscribe(opId); - return; - } - switch (parsedMessage.type) { - case message_types_1.default.GQL_CONNECTION_ERROR: - if (this.connectionCallback) { - this.connectionCallback(parsedMessage.payload); - } - break; - case message_types_1.default.GQL_CONNECTION_ACK: - this.eventEmitter.emit(this.reconnecting ? 'reconnected' : 'connected', parsedMessage.payload); - this.reconnecting = false; - this.backoff.reset(); - this.maxConnectTimeGenerator.reset(); - if (this.connectionCallback) { - this.connectionCallback(); - } - break; - case message_types_1.default.GQL_COMPLETE: - var handler = this.operations[opId].handler; - delete this.operations[opId]; - handler.call(this, null, null); - break; - case message_types_1.default.GQL_ERROR: - this.operations[opId].handler(this.formatErrors(parsedMessage.payload), null); - delete this.operations[opId]; - break; - case message_types_1.default.GQL_DATA: - var parsedPayload = !parsedMessage.payload.errors ? - parsedMessage.payload : __assign(__assign({}, parsedMessage.payload), { errors: this.formatErrors(parsedMessage.payload.errors) }); - this.operations[opId].handler(null, parsedPayload); - break; - case message_types_1.default.GQL_CONNECTION_KEEP_ALIVE: - var firstKA = typeof this.wasKeepAliveReceived === 'undefined'; - this.wasKeepAliveReceived = true; - if (firstKA) { - this.checkConnection(); - } - if (this.checkConnectionIntervalId) { - clearInterval(this.checkConnectionIntervalId); - this.checkConnection(); - } - this.checkConnectionIntervalId = setInterval(this.checkConnection.bind(this), this.wsTimeout); - break; - default: - throw new Error('Invalid message type!'); - } - }; - SubscriptionClient.prototype.unsubscribe = function (opId) { - if (this.operations[opId]) { - delete this.operations[opId]; - this.setInactivityTimeout(); - this.sendMessage(opId, message_types_1.default.GQL_STOP, undefined); - } - }; - return SubscriptionClient; -}()); -exports.SubscriptionClient = SubscriptionClient; -//# sourceMappingURL=client.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/client.js.map b/node_modules/subscriptions-transport-ws/dist/client.js.map deleted file mode 100644 index a43f4615..00000000 --- a/node_modules/subscriptions-transport-ws/dist/client.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,OAAO,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACvG,IAAM,eAAe,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;AAElE,gCAAkC;AAClC,+CAAsF;AACtF,+CAAyC;AACzC,+CAAyC;AAEzC,oDAAiD;AAEjD,qEAAoE;AACpE,uDAA6C;AAE7C,uCAAwC;AACxC,uCAAwD;AACxD,iDAA2C;AAwD3C;IA6BE,4BACE,GAAW,EACX,OAAuB,EACvB,aAAmB,EACnB,kBAAsC;QAEhC,IAAA,KAUF,CAAC,OAAO,IAAI,EAAE,CAAC,EATjB,0BAA8B,EAA9B,kBAAkB,mBAAG,SAAS,KAAA,EAC9B,wBAAqB,EAArB,gBAAgB,mBAAG,EAAE,KAAA,EACrB,kBAA2B,EAA3B,UAAU,mBAAG,yBAAc,KAAA,EAC3B,eAAoB,EAApB,OAAO,mBAAG,qBAAU,KAAA,EACpB,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,4BAA+B,EAA/B,oBAAoB,mBAAG,QAAQ,KAAA,EAC/B,YAAY,EAAZ,IAAI,mBAAG,KAAK,KAAA,EACZ,yBAAqB,EAArB,iBAAiB,mBAAG,CAAC,KAAA,EACrB,yBAAsB,EAAtB,iBAAiB,mBAAG,EAAE,KACL,CAAC;QAEpB,IAAI,CAAC,MAAM,GAAG,aAAa,IAA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AS,CAAC,CAAC;gBAC9F,MAAM;YAER;gBACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;SAC5C;IACH,CAAC;IAEO,wCAAW,GAAnB,UAAoB,IAAY;QAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACzB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,uBAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;SAC1D;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AAhmBD,IAgmBC;AAhmBY,gDAAkB","sourcesContent":["declare let window: any;\nconst _global = typeof global !== 'undefined' ? global : (typeof window !== 'undefined' ? window : {});\nconst NativeWebSocket = _global.WebSocket || _global.MozWebSocket;\n\nimport * as Backoff from 'backo2';\nimport { default as EventEmitterType, EventEmitter, ListenerFn } from 'eventemitter3';\nimport isString from './utils/is-string';\nimport isObject from './utils/is-object';\nimport { ExecutionResult } from 'graphql/execution/execute';\nimport { print } from 'graphql/language/printer';\nimport { DocumentNode } from 'graphql/language/ast';\nimport { getOperationAST } from 'graphql/utilities/getOperationAST';\nimport $$observable from 'symbol-observable';\n\nimport { GRAPHQL_WS } from './protocol';\nimport { MIN_WS_TIMEOUT, WS_TIMEOUT } from './defaults';\nimport MessageTypes from './message-types';\n\nexport interface Observer {\n next?: (value: T) => void;\n error?: (error: Error) => void;\n complete?: () => void;\n}\n\nexport interface Observable {\n subscribe(observer: Observer): {\n unsubscribe: () => void;\n };\n}\n\nexport interface OperationOptions {\n query?: string | DocumentNode;\n variables?: Object;\n operationName?: string;\n [key: string]: any;\n}\n\nexport type FormatedError = Error & {\n originalError?: any;\n};\n\nexport interface Operation {\n options: OperationOptions;\n handler: (error: Error[], result?: any) => void;\n}\n\nexport interface Operations {\n [id: string]: Operation;\n}\n\nexport interface Middleware {\n applyMiddleware(options: OperationOptions, next: Function): void;\n}\n\nexport type ConnectionParams = {\n [paramName: string]: any,\n};\n\nexport type ConnectionParamsOptions = ConnectionParams | Function | Promise;\n\nexport interface ClientOptions {\n connectionParams?: ConnectionParamsOptions;\n minTimeout?: number;\n timeout?: number;\n reconnect?: boolean;\n reconnectionAttempts?: number;\n connectionCallback?: (error: Error[], result?: any) => void;\n lazy?: boolean;\n inactivityTimeout?: number;\n wsOptionArguments?: any[];\n}\n\nexport class SubscriptionClient {\n public client: any;\n public operations: Operations;\n private url: string;\n private nextOperationId: number;\n private connectionParams: Function;\n private minWsTimeout: number;\n private wsTimeout: number;\n private unsentMessagesQueue: Array; // queued messages while websocket is opening.\n private reconnect: boolean;\n private reconnecting: boolean;\n private reconnectionAttempts: number;\n private backoff: any;\n private connectionCallback: any;\n private eventEmitter: EventEmitterType;\n private lazy: boolean;\n private inactivityTimeout: number;\n private inactivityTimeoutId: any;\n private closedByUser: boolean;\n private wsImpl: any;\n private wsProtocols: string | string[];\n private wasKeepAliveReceived: boolean;\n private tryReconnectTimeoutId: any;\n private checkConnectionIntervalId: any;\n private maxConnectTimeoutId: any;\n private middlewares: Middleware[];\n private maxConnectTimeGenerator: any;\n private wsOptionArguments: any[];\n\n constructor(\n url: string,\n options?: ClientOptions,\n webSocketImpl?: any,\n webSocketProtocols?: string | string[],\n ) {\n const {\n connectionCallback = undefined,\n connectionParams = {},\n minTimeout = MIN_WS_TIMEOUT,\n timeout = WS_TIMEOUT,\n reconnect = false,\n reconnectionAttempts = Infinity,\n lazy = false,\n inactivityTimeout = 0,\n wsOptionArguments = [],\n } = (options || {});\n\n this.wsImpl = webSocketImpl || NativeWebSocket;\n if (!this.wsImpl) {\n throw new Error('Unable to find native implementation, or alternative implementation for WebSocket!');\n }\n\n this.wsProtocols = webSocketProtocols || GRAPHQL_WS;\n this.connectionCallback = connectionCallback;\n this.url = url;\n this.operations = {};\n this.nextOperationId = 0;\n this.minWsTimeout = minTimeout;\n this.wsTimeout = timeout;\n this.unsentMessagesQueue = [];\n this.reconnect = reconnect;\n this.reconnecting = false;\n this.reconnectionAttempts = reconnectionAttempts;\n this.lazy = !!lazy;\n this.inactivityTimeout = inactivityTimeout;\n this.closedByUser = false;\n this.backoff = new Backoff({ jitter: 0.5 });\n this.eventEmitter = new EventEmitter();\n this.middlewares = [];\n this.client = null;\n this.maxConnectTimeGenerator = this.createMaxConnectTimeGenerator();\n this.connectionParams = this.getConnectionParams(connectionParams);\n this.wsOptionArguments = wsOptionArguments;\n\n if (!this.lazy) {\n this.connect();\n }\n }\n\n public get status() {\n if (this.client === null) {\n return this.wsImpl.CLOSED;\n }\n\n return this.client.readyState;\n }\n\n public close(isForced = true, closedByUser = true) {\n this.clearInactivityTimeout();\n if (this.client !== null) {\n this.closedByUser = closedByUser;\n\n if (isForced) {\n this.clearCheckConnectionInterval();\n this.clearMaxConnectTimeout();\n this.clearTryReconnectTimeout();\n this.unsubscribeAll();\n this.sendMessage(undefined, MessageTypes.GQL_CONNECTION_TERMINATE, null);\n }\n\n this.client.close();\n this.client.onopen = null;\n this.client.onclose = null;\n this.client.onerror = null;\n this.client.onmessage = null;\n this.client = null;\n this.eventEmitter.emit('disconnected');\n\n if (!isForced) {\n this.tryReconnect();\n }\n }\n }\n\n public request(request: OperationOptions): Observable {\n const getObserver = this.getObserver.bind(this);\n const executeOperation = this.executeOperation.bind(this);\n const unsubscribe = this.unsubscribe.bind(this);\n\n let opId: string;\n\n this.clearInactivityTimeout();\n\n return {\n [$$observable]() {\n return this;\n },\n subscribe(\n observerOrNext: ((Observer) | ((v: ExecutionResult) => void)),\n onError?: (error: Error) => void,\n onComplete?: () => void,\n ) {\n const observer = getObserver(observerOrNext, onError, onComplete);\n\n opId = executeOperation(request, (error: Error[], result: any) => {\n if ( error === null && result === null ) {\n if ( observer.complete ) {\n observer.complete();\n }\n } else if (error) {\n if ( observer.error ) {\n observer.error(error[0]);\n }\n } else {\n if ( observer.next ) {\n observer.next(result);\n }\n }\n });\n\n return {\n unsubscribe: () => {\n if ( opId ) {\n unsubscribe(opId);\n opId = null;\n }\n },\n };\n },\n };\n }\n\n public on(eventName: string, callback: ListenerFn, context?: any): Function {\n const handler = this.eventEmitter.on(eventName, callback, context);\n\n return () => {\n handler.off(eventName, callback, context);\n };\n }\n\n public onConnected(callback: ListenerFn, context?: any): Function {\n return this.on('connected', callback, context);\n }\n\n public onConnecting(callback: ListenerFn, context?: any): Function {\n return this.on('connecting', callback, context);\n }\n\n public onDisconnected(callback: ListenerFn, context?: any): Function {\n return this.on('disconnected', callback, context);\n }\n\n public onReconnected(callback: ListenerFn, context?: any): Function {\n return this.on('reconnected', callback, context);\n }\n\n public onReconnecting(callback: ListenerFn, context?: any): Function {\n return this.on('reconnecting', callback, context);\n }\n\n public onError(callback: ListenerFn, context?: any): Function {\n return this.on('error', callback, context);\n }\n\n public unsubscribeAll() {\n Object.keys(this.operations).forEach( subId => {\n this.unsubscribe(subId);\n });\n }\n\n public applyMiddlewares(options: OperationOptions): Promise {\n return new Promise((resolve, reject) => {\n const queue = (funcs: Middleware[], scope: any) => {\n const next = (error?: any) => {\n if (error) {\n reject(error);\n } else {\n if (funcs.length > 0) {\n const f = funcs.shift();\n if (f) {\n f.applyMiddleware.apply(scope, [options, next]);\n }\n } else {\n resolve(options);\n }\n }\n };\n next();\n };\n\n queue([...this.middlewares], this);\n });\n }\n\n public use(middlewares: Middleware[]): SubscriptionClient {\n middlewares.map((middleware) => {\n if (typeof middleware.applyMiddleware === 'function') {\n this.middlewares.push(middleware);\n } else {\n throw new Error('Middleware must implement the applyMiddleware function.');\n }\n });\n\n return this;\n }\n\n private getConnectionParams(connectionParams: ConnectionParamsOptions): Function {\n return (): Promise => new Promise((resolve, reject) => {\n if (typeof connectionParams === 'function') {\n try {\n return resolve(connectionParams.call(null));\n } catch (error) {\n return reject(error);\n }\n }\n\n resolve(connectionParams);\n });\n }\n\n private executeOperation(options: OperationOptions, handler: (error: Error[], result?: any) => void): string {\n if (this.client === null) {\n this.connect();\n }\n\n const opId = this.generateOperationId();\n this.operations[opId] = { options: options, handler };\n\n this.applyMiddlewares(options)\n .then(processedOptions => {\n this.checkOperationOptions(processedOptions, handler);\n if (this.operations[opId]) {\n this.operations[opId] = { options: processedOptions, handler };\n this.sendMessage(opId, MessageTypes.GQL_START, processedOptions);\n }\n })\n .catch(error => {\n this.unsubscribe(opId);\n handler(this.formatErrors(error));\n });\n\n return opId;\n }\n\n private getObserver(\n observerOrNext: ((Observer) | ((v: T) => void)),\n error?: (e: Error) => void,\n complete?: () => void,\n ) {\n if ( typeof observerOrNext === 'function' ) {\n return {\n next: (v: T) => observerOrNext(v),\n error: (e: Error) => error && error(e),\n complete: () => complete && complete(),\n };\n }\n\n return observerOrNext;\n }\n\n private createMaxConnectTimeGenerator() {\n const minValue = this.minWsTimeout;\n const maxValue = this.wsTimeout;\n\n return new Backoff({\n min: minValue,\n max: maxValue,\n factor: 1.2,\n });\n }\n\n private clearCheckConnectionInterval() {\n if (this.checkConnectionIntervalId) {\n clearInterval(this.checkConnectionIntervalId);\n this.checkConnectionIntervalId = null;\n }\n }\n\n private clearMaxConnectTimeout() {\n if (this.maxConnectTimeoutId) {\n clearTimeout(this.maxConnectTimeoutId);\n this.maxConnectTimeoutId = null;\n }\n }\n\n private clearTryReconnectTimeout() {\n if (this.tryReconnectTimeoutId) {\n clearTimeout(this.tryReconnectTimeoutId);\n this.tryReconnectTimeoutId = null;\n }\n }\n\n private clearInactivityTimeout() {\n if (this.inactivityTimeoutId) {\n clearTimeout(this.inactivityTimeoutId);\n this.inactivityTimeoutId = null;\n }\n }\n\n private setInactivityTimeout() {\n if (this.inactivityTimeout > 0 && Object.keys(this.operations).length === 0) {\n this.inactivityTimeoutId = setTimeout(() => {\n if (Object.keys(this.operations).length === 0) {\n this.close();\n }\n }, this.inactivityTimeout);\n }\n }\n\n private checkOperationOptions(options: OperationOptions, handler: (error: Error[], result?: any) => void) {\n const { query, variables, operationName } = options;\n\n if (!query) {\n throw new Error('Must provide a query.');\n }\n\n if (!handler) {\n throw new Error('Must provide an handler.');\n }\n\n if (\n ( !isString(query) && !getOperationAST(query, operationName)) ||\n ( operationName && !isString(operationName)) ||\n ( variables && !isObject(variables))\n ) {\n throw new Error('Incorrect option types. query must be a string or a document,' +\n '`operationName` must be a string, and `variables` must be an object.');\n }\n }\n\n private buildMessage(id: string, type: string, payload: any) {\n const payloadToReturn = payload && payload.query ?\n {\n ...payload,\n query: typeof payload.query === 'string' ? payload.query : print(payload.query),\n } :\n payload;\n\n return {\n id,\n type,\n payload: payloadToReturn,\n };\n }\n\n // ensure we have an array of errors\n private formatErrors(errors: any): FormatedError[] {\n if (Array.isArray(errors)) {\n return errors;\n }\n\n // TODO we should not pass ValidationError to callback in the future.\n // ValidationError\n if (errors && errors.errors) {\n return this.formatErrors(errors.errors);\n }\n\n if (errors && errors.message) {\n return [errors];\n }\n\n return [{\n name: 'FormatedError',\n message: 'Unknown error',\n originalError: errors,\n }];\n }\n\n private sendMessage(id: string, type: string, payload: any) {\n this.sendMessageRaw(this.buildMessage(id, type, payload));\n }\n\n // send message, or queue it if connection is not open\n private sendMessageRaw(message: Object) {\n switch (this.status) {\n case this.wsImpl.OPEN:\n let serializedMessage: string = JSON.stringify(message);\n try {\n JSON.parse(serializedMessage);\n } catch (e) {\n this.eventEmitter.emit('error', new Error(`Message must be JSON-serializable. Got: ${message}`));\n }\n\n this.client.send(serializedMessage);\n break;\n case this.wsImpl.CONNECTING:\n this.unsentMessagesQueue.push(message);\n\n break;\n default:\n if (!this.reconnecting) {\n this.eventEmitter.emit('error', new Error('A message was not sent because socket is not connected, is closing or ' +\n 'is already closed. Message was: ' + JSON.stringify(message)));\n }\n }\n }\n\n private generateOperationId(): string {\n return String(++this.nextOperationId);\n }\n\n private tryReconnect() {\n if (!this.reconnect || this.backoff.attempts >= this.reconnectionAttempts) {\n return;\n }\n\n if (!this.reconnecting) {\n Object.keys(this.operations).forEach((key) => {\n this.unsentMessagesQueue.push(\n this.buildMessage(key, MessageTypes.GQL_START, this.operations[key].options),\n );\n });\n this.reconnecting = true;\n }\n\n this.clearTryReconnectTimeout();\n\n const delay = this.backoff.duration();\n this.tryReconnectTimeoutId = setTimeout(() => {\n this.connect();\n }, delay);\n }\n\n private flushUnsentMessagesQueue() {\n this.unsentMessagesQueue.forEach((message) => {\n this.sendMessageRaw(message);\n });\n this.unsentMessagesQueue = [];\n }\n\n private checkConnection() {\n if (this.wasKeepAliveReceived) {\n this.wasKeepAliveReceived = false;\n return;\n }\n\n if (!this.reconnecting) {\n this.close(false, true);\n }\n }\n\n private checkMaxConnectTimeout() {\n this.clearMaxConnectTimeout();\n\n // Max timeout trying to connect\n this.maxConnectTimeoutId = setTimeout(() => {\n if (this.status !== this.wsImpl.OPEN) {\n this.reconnecting = true;\n this.close(false, true);\n }\n }, this.maxConnectTimeGenerator.duration());\n }\n\n private connect() {\n this.client = new this.wsImpl(this.url, this.wsProtocols, ...this.wsOptionArguments);\n\n this.checkMaxConnectTimeout();\n\n this.client.onopen = async () => {\n if (this.status === this.wsImpl.OPEN) {\n this.clearMaxConnectTimeout();\n this.closedByUser = false;\n this.eventEmitter.emit(this.reconnecting ? 'reconnecting' : 'connecting');\n\n try {\n const connectionParams: ConnectionParams = await this.connectionParams();\n\n // Send CONNECTION_INIT message, no need to wait for connection to success (reduce roundtrips)\n this.sendMessage(undefined, MessageTypes.GQL_CONNECTION_INIT, connectionParams);\n this.flushUnsentMessagesQueue();\n } catch (error) {\n this.sendMessage(undefined, MessageTypes.GQL_CONNECTION_ERROR, error);\n this.flushUnsentMessagesQueue();\n }\n }\n };\n\n this.client.onclose = () => {\n if (!this.closedByUser) {\n this.close(false, false);\n }\n };\n\n this.client.onerror = (err: Error) => {\n // Capture and ignore errors to prevent unhandled exceptions, wait for\n // onclose to fire before attempting a reconnect.\n this.eventEmitter.emit('error', err);\n };\n\n this.client.onmessage = ({ data }: {data: any}) => {\n this.processReceivedData(data);\n };\n }\n\n private processReceivedData(receivedData: any) {\n let parsedMessage: any;\n let opId: string;\n\n try {\n parsedMessage = JSON.parse(receivedData);\n opId = parsedMessage.id;\n } catch (e) {\n throw new Error(`Message must be JSON-parseable. Got: ${receivedData}`);\n }\n\n if (\n [ MessageTypes.GQL_DATA,\n MessageTypes.GQL_COMPLETE,\n MessageTypes.GQL_ERROR,\n ].indexOf(parsedMessage.type) !== -1 && !this.operations[opId]\n ) {\n this.unsubscribe(opId);\n\n return;\n }\n\n switch (parsedMessage.type) {\n case MessageTypes.GQL_CONNECTION_ERROR:\n if (this.connectionCallback) {\n this.connectionCallback(parsedMessage.payload);\n }\n break;\n\n case MessageTypes.GQL_CONNECTION_ACK:\n this.eventEmitter.emit(this.reconnecting ? 'reconnected' : 'connected', parsedMessage.payload);\n this.reconnecting = false;\n this.backoff.reset();\n this.maxConnectTimeGenerator.reset();\n\n if (this.connectionCallback) {\n this.connectionCallback();\n }\n break;\n\n case MessageTypes.GQL_COMPLETE:\n const handler = this.operations[opId].handler;\n delete this.operations[opId];\n handler.call(this, null, null);\n break;\n\n case MessageTypes.GQL_ERROR:\n this.operations[opId].handler(this.formatErrors(parsedMessage.payload), null);\n delete this.operations[opId];\n break;\n\n case MessageTypes.GQL_DATA:\n const parsedPayload = !parsedMessage.payload.errors ?\n parsedMessage.payload : {...parsedMessage.payload, errors: this.formatErrors(parsedMessage.payload.errors)};\n this.operations[opId].handler(null, parsedPayload);\n break;\n\n case MessageTypes.GQL_CONNECTION_KEEP_ALIVE:\n const firstKA = typeof this.wasKeepAliveReceived === 'undefined';\n this.wasKeepAliveReceived = true;\n\n if (firstKA) {\n this.checkConnection();\n }\n\n if (this.checkConnectionIntervalId) {\n clearInterval(this.checkConnectionIntervalId);\n this.checkConnection();\n }\n this.checkConnectionIntervalId = setInterval(this.checkConnection.bind(this), this.wsTimeout);\n break;\n\n default:\n throw new Error('Invalid message type!');\n }\n }\n\n private unsubscribe(opId: string) {\n if (this.operations[opId]) {\n delete this.operations[opId];\n this.setInactivityTimeout();\n this.sendMessage(opId, MessageTypes.GQL_STOP, undefined);\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/defaults.d.ts b/node_modules/subscriptions-transport-ws/dist/defaults.d.ts deleted file mode 100644 index f6ee351e..00000000 --- a/node_modules/subscriptions-transport-ws/dist/defaults.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const MIN_WS_TIMEOUT = 1000; -declare const WS_TIMEOUT = 30000; -export { MIN_WS_TIMEOUT, WS_TIMEOUT, }; diff --git a/node_modules/subscriptions-transport-ws/dist/defaults.js b/node_modules/subscriptions-transport-ws/dist/defaults.js deleted file mode 100644 index e5ce1219..00000000 --- a/node_modules/subscriptions-transport-ws/dist/defaults.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WS_TIMEOUT = exports.MIN_WS_TIMEOUT = void 0; -var MIN_WS_TIMEOUT = 1000; -exports.MIN_WS_TIMEOUT = MIN_WS_TIMEOUT; -var WS_TIMEOUT = 30000; -exports.WS_TIMEOUT = WS_TIMEOUT; -//# sourceMappingURL=defaults.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/defaults.js.map b/node_modules/subscriptions-transport-ws/dist/defaults.js.map deleted file mode 100644 index 535b6682..00000000 --- a/node_modules/subscriptions-transport-ws/dist/defaults.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":";;;AAAA,IAAM,cAAc,GAAG,IAAI,CAAC;AAI1B,wCAAc;AAHhB,IAAM,UAAU,GAAG,KAAK,CAAC;AAIvB,gCAAU","sourcesContent":["const MIN_WS_TIMEOUT = 1000;\nconst WS_TIMEOUT = 30000;\n\nexport {\n MIN_WS_TIMEOUT,\n WS_TIMEOUT,\n};\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/index.d.ts b/node_modules/subscriptions-transport-ws/dist/index.d.ts deleted file mode 100644 index 0701ef28..00000000 --- a/node_modules/subscriptions-transport-ws/dist/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './client'; -export * from './server'; -export { default as MessageTypes } from './message-types'; -export * from './protocol'; diff --git a/node_modules/subscriptions-transport-ws/dist/index.js b/node_modules/subscriptions-transport-ws/dist/index.js deleted file mode 100644 index 1060303a..00000000 --- a/node_modules/subscriptions-transport-ws/dist/index.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./client"), exports); -__exportStar(require("./server"), exports); -var message_types_1 = require("./message-types"); -Object.defineProperty(exports, "MessageTypes", { enumerable: true, get: function () { return message_types_1.default; } }); -__exportStar(require("./protocol"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/index.js.map b/node_modules/subscriptions-transport-ws/dist/index.js.map deleted file mode 100644 index 15922dcf..00000000 --- a/node_modules/subscriptions-transport-ws/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,iDAA0D;AAAjD,6GAAA,OAAO,OAAgB;AAChC,6CAA2B","sourcesContent":["export * from './client';\nexport * from './server';\nexport { default as MessageTypes } from './message-types';\nexport * from './protocol';\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.d.ts b/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.d.ts deleted file mode 100644 index 3df2cb5d..00000000 --- a/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ConnectionContext } from '../server'; -export declare const parseLegacyProtocolMessage: (connectionContext: ConnectionContext, message: any) => any; diff --git a/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.js b/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.js deleted file mode 100644 index 71c535d8..00000000 --- a/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __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; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseLegacyProtocolMessage = void 0; -var message_types_1 = require("../message-types"); -exports.parseLegacyProtocolMessage = function (connectionContext, message) { - var messageToReturn = message; - switch (message.type) { - case message_types_1.default.INIT: - connectionContext.isLegacy = true; - messageToReturn = __assign(__assign({}, message), { type: message_types_1.default.GQL_CONNECTION_INIT }); - break; - case message_types_1.default.SUBSCRIPTION_START: - messageToReturn = { - id: message.id, - type: message_types_1.default.GQL_START, - payload: { - query: message.query, - operationName: message.operationName, - variables: message.variables, - }, - }; - break; - case message_types_1.default.SUBSCRIPTION_END: - messageToReturn = __assign(__assign({}, message), { type: message_types_1.default.GQL_STOP }); - break; - case message_types_1.default.GQL_CONNECTION_ACK: - if (connectionContext.isLegacy) { - messageToReturn = __assign(__assign({}, message), { type: message_types_1.default.INIT_SUCCESS }); - } - break; - case message_types_1.default.GQL_CONNECTION_ERROR: - if (connectionContext.isLegacy) { - messageToReturn = __assign(__assign({}, message), { type: message_types_1.default.INIT_FAIL, payload: message.payload.message ? { error: message.payload.message } : message.payload }); - } - break; - case message_types_1.default.GQL_ERROR: - if (connectionContext.isLegacy) { - messageToReturn = __assign(__assign({}, message), { type: message_types_1.default.SUBSCRIPTION_FAIL }); - } - break; - case message_types_1.default.GQL_DATA: - if (connectionContext.isLegacy) { - messageToReturn = __assign(__assign({}, message), { type: message_types_1.default.SUBSCRIPTION_DATA }); - } - break; - case message_types_1.default.GQL_COMPLETE: - if (connectionContext.isLegacy) { - messageToReturn = null; - } - break; - case message_types_1.default.SUBSCRIPTION_SUCCESS: - if (!connectionContext.isLegacy) { - messageToReturn = null; - } - break; - default: - break; - } - return messageToReturn; -}; -//# sourceMappingURL=parse-legacy-protocol.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.js.map b/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.js.map deleted file mode 100644 index c1563e1e..00000000 --- a/node_modules/subscriptions-transport-ws/dist/legacy/parse-legacy-protocol.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse-legacy-protocol.js","sourceRoot":"","sources":["../../src/legacy/parse-legacy-protocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,kDAA4C;AAE/B,QAAA,0BAA0B,GAAG,UAAC,iBAAoC,EAAE,OAAY;IAC3F,IAAI,eAAe,GAAG,OAAO,CAAC;IAE9B,QAAQ,OAAO,CAAC,IAAI,EAAE;QACpB,KAAK,uBAAY,CAAC,IAAI;YACpB,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC;YAClC,eAAe,yBAAQ,OAAO,KAAE,IAAI,EAAE,uBAAY,CAAC,mBAAmB,GAAE,CAAC;YACzE,MAAM;QACR,KAAK,uBAAY,CAAC,kBAAkB;YAClC,eAAe,GAAG;gBAChB,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,uBAAY,CAAC,SAAS;gBAC5B,OAAO,EAAE;oBACP,KAAK,EAAE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I,CAAC,iBAAiB,CAAC,QAAQ,EAAE;gBAC/B,eAAe,GAAG,IAAI,CAAC;aACxB;YACD,MAAM;QACR;YACE,MAAM;KACT;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { ConnectionContext } from '../server';\nimport MessageTypes from '../message-types';\n\nexport const parseLegacyProtocolMessage = (connectionContext: ConnectionContext, message: any) => {\n let messageToReturn = message;\n\n switch (message.type) {\n case MessageTypes.INIT:\n connectionContext.isLegacy = true;\n messageToReturn = { ...message, type: MessageTypes.GQL_CONNECTION_INIT };\n break;\n case MessageTypes.SUBSCRIPTION_START:\n messageToReturn = {\n id: message.id,\n type: MessageTypes.GQL_START,\n payload: {\n query: message.query,\n operationName: message.operationName,\n variables: message.variables,\n },\n };\n break;\n case MessageTypes.SUBSCRIPTION_END:\n messageToReturn = { ...message, type: MessageTypes.GQL_STOP };\n break;\n case MessageTypes.GQL_CONNECTION_ACK:\n if (connectionContext.isLegacy) {\n messageToReturn = { ...message, type: MessageTypes.INIT_SUCCESS };\n }\n break;\n case MessageTypes.GQL_CONNECTION_ERROR:\n if (connectionContext.isLegacy) {\n messageToReturn = {\n ...message, type: MessageTypes.INIT_FAIL,\n payload: message.payload.message ? { error: message.payload.message } : message.payload,\n };\n }\n break;\n case MessageTypes.GQL_ERROR:\n if (connectionContext.isLegacy) {\n messageToReturn = { ...message, type: MessageTypes.SUBSCRIPTION_FAIL };\n }\n break;\n case MessageTypes.GQL_DATA:\n if (connectionContext.isLegacy) {\n messageToReturn = { ...message, type: MessageTypes.SUBSCRIPTION_DATA };\n }\n break;\n case MessageTypes.GQL_COMPLETE:\n if (connectionContext.isLegacy) {\n messageToReturn = null;\n }\n break;\n case MessageTypes.SUBSCRIPTION_SUCCESS:\n if (!connectionContext.isLegacy) {\n messageToReturn = null;\n }\n break;\n default:\n break;\n }\n\n return messageToReturn;\n};\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/message-types.d.ts b/node_modules/subscriptions-transport-ws/dist/message-types.d.ts deleted file mode 100644 index 65d37a00..00000000 --- a/node_modules/subscriptions-transport-ws/dist/message-types.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default class MessageTypes { - static GQL_CONNECTION_INIT: string; - static GQL_CONNECTION_ACK: string; - static GQL_CONNECTION_ERROR: string; - static GQL_CONNECTION_KEEP_ALIVE: string; - static GQL_CONNECTION_TERMINATE: string; - static GQL_START: string; - static GQL_DATA: string; - static GQL_ERROR: string; - static GQL_COMPLETE: string; - static GQL_STOP: string; - static SUBSCRIPTION_START: string; - static SUBSCRIPTION_DATA: string; - static SUBSCRIPTION_SUCCESS: string; - static SUBSCRIPTION_FAIL: string; - static SUBSCRIPTION_END: string; - static INIT: string; - static INIT_SUCCESS: string; - static INIT_FAIL: string; - static KEEP_ALIVE: string; - constructor(); -} diff --git a/node_modules/subscriptions-transport-ws/dist/message-types.js b/node_modules/subscriptions-transport-ws/dist/message-types.js deleted file mode 100644 index b35e917e..00000000 --- a/node_modules/subscriptions-transport-ws/dist/message-types.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var MessageTypes = (function () { - function MessageTypes() { - throw new Error('Static Class'); - } - MessageTypes.GQL_CONNECTION_INIT = 'connection_init'; - MessageTypes.GQL_CONNECTION_ACK = 'connection_ack'; - MessageTypes.GQL_CONNECTION_ERROR = 'connection_error'; - MessageTypes.GQL_CONNECTION_KEEP_ALIVE = 'ka'; - MessageTypes.GQL_CONNECTION_TERMINATE = 'connection_terminate'; - MessageTypes.GQL_START = 'start'; - MessageTypes.GQL_DATA = 'data'; - MessageTypes.GQL_ERROR = 'error'; - MessageTypes.GQL_COMPLETE = 'complete'; - MessageTypes.GQL_STOP = 'stop'; - MessageTypes.SUBSCRIPTION_START = 'subscription_start'; - MessageTypes.SUBSCRIPTION_DATA = 'subscription_data'; - MessageTypes.SUBSCRIPTION_SUCCESS = 'subscription_success'; - MessageTypes.SUBSCRIPTION_FAIL = 'subscription_fail'; - MessageTypes.SUBSCRIPTION_END = 'subscription_end'; - MessageTypes.INIT = 'init'; - MessageTypes.INIT_SUCCESS = 'init_success'; - MessageTypes.INIT_FAIL = 'init_fail'; - MessageTypes.KEEP_ALIVE = 'keepalive'; - return MessageTypes; -}()); -exports.default = MessageTypes; -//# sourceMappingURL=message-types.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/message-types.js.map b/node_modules/subscriptions-transport-ws/dist/message-types.js.map deleted file mode 100644 index f45e471b..00000000 --- a/node_modules/subscriptions-transport-ws/dist/message-types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message-types.js","sourceRoot":"","sources":["../src/message-types.ts"],"names":[],"mappings":";;AAAA;IAqDE;QACE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAtDa,gCAAmB,GAAG,iBAAiB,CAAC;IACxC,+BAAkB,GAAG,gBAAgB,CAAC;IACtC,iCAAoB,GAAG,kBAAkB,CAAC;IAG1C,sCAAyB,GAAG,IAAI,CAAC;IAEjC,qCAAwB,GAAG,sBAAsB,CAAC;IAClD,sBAAS,GAAG,OAAO,CAAC;IACpB,qBAAQ,GAAG,MAAM,CAAC;IAClB,sBAAS,GAAG,OAAO,CAAC;IACpB,yBAAY,GAAG,UAAU,CAAC;IAC1B,qBAAQ,GAAG,MAAM,CAAC;IAMlB,+BAAkB,GAAG,oBAAoB,CAAC;IAI1C,8BAAiB,GAAG,mBAAmB,CAAC;IAIxC,iCAAoB,GAAG,sBAAsB,CAAC;IAI9C,8BAAiB,GAAG,mBAAmB,CAAC;IAIxC,6BAAgB,GAAG,kBAAkB,CAAC;IAItC,iBAAI,GAAG,MAAM,CAAC;IAId,yBAAY,GAAG,cAAc,CAAC;IAI9B,sBAAS,GAAG,WAAW,CAAC;IAIxB,uBAAU,GAAG,WAAW,CAAC;IAKzC,mBAAC;CAAA,AAxDD,IAwDC;kBAxDoB,YAAY","sourcesContent":["export default class MessageTypes {\n public static GQL_CONNECTION_INIT = 'connection_init'; // Client -> Server\n public static GQL_CONNECTION_ACK = 'connection_ack'; // Server -> Client\n public static GQL_CONNECTION_ERROR = 'connection_error'; // Server -> Client\n\n // NOTE: The keep alive message type does not follow the standard due to connection optimizations\n public static GQL_CONNECTION_KEEP_ALIVE = 'ka'; // Server -> Client\n\n public static GQL_CONNECTION_TERMINATE = 'connection_terminate'; // Client -> Server\n public static GQL_START = 'start'; // Client -> Server\n public static GQL_DATA = 'data'; // Server -> Client\n public static GQL_ERROR = 'error'; // Server -> Client\n public static GQL_COMPLETE = 'complete'; // Server -> Client\n public static GQL_STOP = 'stop'; // Client -> Server\n\n // NOTE: The following message types are deprecated and will be removed soon.\n /**\n * @deprecated\n */\n public static SUBSCRIPTION_START = 'subscription_start';\n /**\n * @deprecated\n */\n public static SUBSCRIPTION_DATA = 'subscription_data';\n /**\n * @deprecated\n */\n public static SUBSCRIPTION_SUCCESS = 'subscription_success';\n /**\n * @deprecated\n */\n public static SUBSCRIPTION_FAIL = 'subscription_fail';\n /**\n * @deprecated\n */\n public static SUBSCRIPTION_END = 'subscription_end';\n /**\n * @deprecated\n */\n public static INIT = 'init';\n /**\n * @deprecated\n */\n public static INIT_SUCCESS = 'init_success';\n /**\n * @deprecated\n */\n public static INIT_FAIL = 'init_fail';\n /**\n * @deprecated\n */\n public static KEEP_ALIVE = 'keepalive';\n\n constructor() {\n throw new Error('Static Class');\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/protocol.d.ts b/node_modules/subscriptions-transport-ws/dist/protocol.d.ts deleted file mode 100644 index 626d8a4e..00000000 --- a/node_modules/subscriptions-transport-ws/dist/protocol.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const GRAPHQL_WS = "graphql-ws"; -declare const GRAPHQL_SUBSCRIPTIONS = "graphql-subscriptions"; -export { GRAPHQL_WS, GRAPHQL_SUBSCRIPTIONS, }; diff --git a/node_modules/subscriptions-transport-ws/dist/protocol.js b/node_modules/subscriptions-transport-ws/dist/protocol.js deleted file mode 100644 index d34da9bc..00000000 --- a/node_modules/subscriptions-transport-ws/dist/protocol.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GRAPHQL_SUBSCRIPTIONS = exports.GRAPHQL_WS = void 0; -var GRAPHQL_WS = 'graphql-ws'; -exports.GRAPHQL_WS = GRAPHQL_WS; -var GRAPHQL_SUBSCRIPTIONS = 'graphql-subscriptions'; -exports.GRAPHQL_SUBSCRIPTIONS = GRAPHQL_SUBSCRIPTIONS; -//# sourceMappingURL=protocol.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/protocol.js.map b/node_modules/subscriptions-transport-ws/dist/protocol.js.map deleted file mode 100644 index c5ed6829..00000000 --- a/node_modules/subscriptions-transport-ws/dist/protocol.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":";;;AAAA,IAAM,UAAU,GAAG,YAAY,CAAC;AAQ9B,gCAAU;AAHZ,IAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAIpD,sDAAqB","sourcesContent":["const GRAPHQL_WS = 'graphql-ws';\n// NOTE: This protocol is deprecated and will be removed soon.\n/**\n * @deprecated\n */\nconst GRAPHQL_SUBSCRIPTIONS = 'graphql-subscriptions';\n\nexport {\n GRAPHQL_WS,\n GRAPHQL_SUBSCRIPTIONS,\n};\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/server.d.ts b/node_modules/subscriptions-transport-ws/dist/server.d.ts deleted file mode 100644 index 6953367b..00000000 --- a/node_modules/subscriptions-transport-ws/dist/server.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/// -import * as WebSocket from 'ws'; -import { ExecutionResult, GraphQLSchema, DocumentNode, ValidationContext, GraphQLFieldResolver } from 'graphql'; -import { IncomingMessage } from 'http'; -export declare type ExecutionIterator = AsyncIterator; -export interface ExecutionParams { - query: string | DocumentNode; - variables: { - [key: string]: any; - }; - operationName: string; - context: TContext; - formatResponse?: Function; - formatError?: Function; - callback?: Function; - schema?: GraphQLSchema; -} -export declare type ConnectionContext = { - initPromise?: Promise; - isLegacy: boolean; - socket: WebSocket; - request: IncomingMessage; - operations: { - [opId: string]: ExecutionIterator; - }; -}; -export interface OperationMessagePayload { - [key: string]: any; - query?: string; - variables?: { - [key: string]: any; - }; - operationName?: string; -} -export interface OperationMessage { - payload?: OperationMessagePayload; - id?: string; - type: string; -} -export declare type ExecuteFunction = (schema: GraphQLSchema, document: DocumentNode, rootValue?: any, contextValue?: any, variableValues?: { - [key: string]: any; -}, operationName?: string, fieldResolver?: GraphQLFieldResolver) => ExecutionResult | Promise | AsyncIterator; -export declare type SubscribeFunction = (schema: GraphQLSchema, document: DocumentNode, rootValue?: any, contextValue?: any, variableValues?: { - [key: string]: any; -}, operationName?: string, fieldResolver?: GraphQLFieldResolver, subscribeFieldResolver?: GraphQLFieldResolver) => AsyncIterator | Promise | ExecutionResult>; -export interface ServerOptions { - rootValue?: any; - schema?: GraphQLSchema; - execute?: ExecuteFunction; - subscribe?: SubscribeFunction; - validationRules?: Array<(context: ValidationContext) => any> | ReadonlyArray; - onOperation?: Function; - onOperationComplete?: Function; - onConnect?: Function; - onDisconnect?: Function; - keepAlive?: number; -} -export declare class SubscriptionServer { - private onOperation; - private onOperationComplete; - private onConnect; - private onDisconnect; - private wsServer; - private execute; - private subscribe; - private schema; - private rootValue; - private keepAlive; - private closeHandler; - private specifiedRules; - static create(options: ServerOptions, socketOptionsOrServer: WebSocket.ServerOptions | WebSocket.Server): SubscriptionServer; - constructor(options: ServerOptions, socketOptionsOrServer: WebSocket.ServerOptions | WebSocket.Server); - get server(): WebSocket.Server; - close(): void; - private loadExecutor; - private unsubscribe; - private onClose; - private onMessage; - private sendKeepAlive; - private sendMessage; - private sendError; -} diff --git a/node_modules/subscriptions-transport-ws/dist/server.js b/node_modules/subscriptions-transport-ws/dist/server.js deleted file mode 100644 index fa8d628e..00000000 --- a/node_modules/subscriptions-transport-ws/dist/server.js +++ /dev/null @@ -1,299 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SubscriptionServer = void 0; -var WebSocket = require("ws"); -var message_types_1 = require("./message-types"); -var protocol_1 = require("./protocol"); -var is_object_1 = require("./utils/is-object"); -var graphql_1 = require("graphql"); -var empty_iterable_1 = require("./utils/empty-iterable"); -var iterall_1 = require("iterall"); -var is_subscriptions_1 = require("./utils/is-subscriptions"); -var parse_legacy_protocol_1 = require("./legacy/parse-legacy-protocol"); -var isWebSocketServer = function (socket) { return socket.on; }; -var SubscriptionServer = (function () { - function SubscriptionServer(options, socketOptionsOrServer) { - var _this = this; - var onOperation = options.onOperation, onOperationComplete = options.onOperationComplete, onConnect = options.onConnect, onDisconnect = options.onDisconnect, keepAlive = options.keepAlive; - this.specifiedRules = options.validationRules || graphql_1.specifiedRules; - this.loadExecutor(options); - this.onOperation = onOperation; - this.onOperationComplete = onOperationComplete; - this.onConnect = onConnect; - this.onDisconnect = onDisconnect; - this.keepAlive = keepAlive; - if (isWebSocketServer(socketOptionsOrServer)) { - this.wsServer = socketOptionsOrServer; - } - else { - this.wsServer = new WebSocket.Server(socketOptionsOrServer || {}); - } - var connectionHandler = (function (socket, request) { - socket.upgradeReq = request; - if (socket.protocol === undefined || - (socket.protocol.indexOf(protocol_1.GRAPHQL_WS) === -1 && socket.protocol.indexOf(protocol_1.GRAPHQL_SUBSCRIPTIONS) === -1)) { - socket.close(1002); - return; - } - var connectionContext = Object.create(null); - connectionContext.initPromise = Promise.resolve(true); - connectionContext.isLegacy = false; - connectionContext.socket = socket; - connectionContext.request = request; - connectionContext.operations = {}; - var connectionClosedHandler = function (error) { - if (error) { - _this.sendError(connectionContext, '', { message: error.message ? error.message : error }, message_types_1.default.GQL_CONNECTION_ERROR); - setTimeout(function () { - connectionContext.socket.close(1011); - }, 10); - } - _this.onClose(connectionContext); - if (_this.onDisconnect) { - _this.onDisconnect(socket, connectionContext); - } - }; - socket.on('error', connectionClosedHandler); - socket.on('close', connectionClosedHandler); - socket.on('message', _this.onMessage(connectionContext)); - }); - this.wsServer.on('connection', connectionHandler); - this.closeHandler = function () { - _this.wsServer.removeListener('connection', connectionHandler); - _this.wsServer.close(); - }; - } - SubscriptionServer.create = function (options, socketOptionsOrServer) { - return new SubscriptionServer(options, socketOptionsOrServer); - }; - Object.defineProperty(SubscriptionServer.prototype, "server", { - get: function () { - return this.wsServer; - }, - enumerable: false, - configurable: true - }); - SubscriptionServer.prototype.close = function () { - this.closeHandler(); - }; - SubscriptionServer.prototype.loadExecutor = function (options) { - var execute = options.execute, subscribe = options.subscribe, schema = options.schema, rootValue = options.rootValue; - if (!execute) { - throw new Error('Must provide `execute` for websocket server constructor.'); - } - this.schema = schema; - this.rootValue = rootValue; - this.execute = execute; - this.subscribe = subscribe; - }; - SubscriptionServer.prototype.unsubscribe = function (connectionContext, opId) { - if (connectionContext.operations && connectionContext.operations[opId]) { - if (connectionContext.operations[opId].return) { - connectionContext.operations[opId].return(); - } - delete connectionContext.operations[opId]; - if (this.onOperationComplete) { - this.onOperationComplete(connectionContext.socket, opId); - } - } - }; - SubscriptionServer.prototype.onClose = function (connectionContext) { - var _this = this; - Object.keys(connectionContext.operations).forEach(function (opId) { - _this.unsubscribe(connectionContext, opId); - }); - }; - SubscriptionServer.prototype.onMessage = function (connectionContext) { - var _this = this; - return function (message) { - var parsedMessage; - try { - parsedMessage = parse_legacy_protocol_1.parseLegacyProtocolMessage(connectionContext, JSON.parse(message)); - } - catch (e) { - _this.sendError(connectionContext, null, { message: e.message }, message_types_1.default.GQL_CONNECTION_ERROR); - return; - } - var opId = parsedMessage.id; - switch (parsedMessage.type) { - case message_types_1.default.GQL_CONNECTION_INIT: - if (_this.onConnect) { - connectionContext.initPromise = new Promise(function (resolve, reject) { - try { - resolve(_this.onConnect(parsedMessage.payload, connectionContext.socket, connectionContext)); - } - catch (e) { - reject(e); - } - }); - } - connectionContext.initPromise.then(function (result) { - if (result === false) { - throw new Error('Prohibited connection!'); - } - _this.sendMessage(connectionContext, undefined, message_types_1.default.GQL_CONNECTION_ACK, undefined); - if (_this.keepAlive) { - _this.sendKeepAlive(connectionContext); - var keepAliveTimer_1 = setInterval(function () { - if (connectionContext.socket.readyState === WebSocket.OPEN) { - _this.sendKeepAlive(connectionContext); - } - else { - clearInterval(keepAliveTimer_1); - } - }, _this.keepAlive); - } - }).catch(function (error) { - _this.sendError(connectionContext, opId, { message: error.message }, message_types_1.default.GQL_CONNECTION_ERROR); - setTimeout(function () { - connectionContext.socket.close(1011); - }, 10); - }); - break; - case message_types_1.default.GQL_CONNECTION_TERMINATE: - connectionContext.socket.close(); - break; - case message_types_1.default.GQL_START: - connectionContext.initPromise.then(function (initResult) { - if (connectionContext.operations && connectionContext.operations[opId]) { - _this.unsubscribe(connectionContext, opId); - } - var baseParams = { - query: parsedMessage.payload.query, - variables: parsedMessage.payload.variables, - operationName: parsedMessage.payload.operationName, - context: is_object_1.default(initResult) ? Object.assign(Object.create(Object.getPrototypeOf(initResult)), initResult) : {}, - formatResponse: undefined, - formatError: undefined, - callback: undefined, - schema: _this.schema, - }; - var promisedParams = Promise.resolve(baseParams); - connectionContext.operations[opId] = empty_iterable_1.createEmptyIterable(); - if (_this.onOperation) { - var messageForCallback = parsedMessage; - promisedParams = Promise.resolve(_this.onOperation(messageForCallback, baseParams, connectionContext.socket)); - } - return promisedParams.then(function (params) { - if (typeof params !== 'object') { - var error = "Invalid params returned from onOperation! return values must be an object!"; - _this.sendError(connectionContext, opId, { message: error }); - throw new Error(error); - } - if (!params.schema) { - var error = 'Missing schema information. The GraphQL schema should be provided either statically in' + - ' the `SubscriptionServer` constructor or as a property on the object returned from onOperation!'; - _this.sendError(connectionContext, opId, { message: error }); - throw new Error(error); - } - var document = typeof baseParams.query !== 'string' ? baseParams.query : graphql_1.parse(baseParams.query); - var executionPromise; - var validationErrors = graphql_1.validate(params.schema, document, _this.specifiedRules); - if (validationErrors.length > 0) { - executionPromise = Promise.resolve({ errors: validationErrors }); - } - else { - var executor = _this.execute; - if (_this.subscribe && is_subscriptions_1.isASubscriptionOperation(document, params.operationName)) { - executor = _this.subscribe; - } - executionPromise = Promise.resolve(executor(params.schema, document, _this.rootValue, params.context, params.variables, params.operationName)); - } - return executionPromise.then(function (executionResult) { return ({ - executionIterable: iterall_1.isAsyncIterable(executionResult) ? - executionResult : iterall_1.createAsyncIterator([executionResult]), - params: params, - }); }); - }).then(function (_a) { - var executionIterable = _a.executionIterable, params = _a.params; - iterall_1.forAwaitEach(executionIterable, function (value) { - var result = value; - if (params.formatResponse) { - try { - result = params.formatResponse(value, params); - } - catch (err) { - console.error('Error in formatResponse function:', err); - } - } - _this.sendMessage(connectionContext, opId, message_types_1.default.GQL_DATA, result); - }) - .then(function () { - _this.sendMessage(connectionContext, opId, message_types_1.default.GQL_COMPLETE, null); - }) - .catch(function (e) { - var error = e; - if (params.formatError) { - try { - error = params.formatError(e, params); - } - catch (err) { - console.error('Error in formatError function: ', err); - } - } - if (Object.keys(error).length === 0) { - error = { name: error.name, message: error.message }; - } - _this.sendError(connectionContext, opId, error); - }); - return executionIterable; - }).then(function (subscription) { - connectionContext.operations[opId] = subscription; - }).then(function () { - _this.sendMessage(connectionContext, opId, message_types_1.default.SUBSCRIPTION_SUCCESS, undefined); - }).catch(function (e) { - if (e.errors) { - _this.sendMessage(connectionContext, opId, message_types_1.default.GQL_DATA, { errors: e.errors }); - } - else { - _this.sendError(connectionContext, opId, { message: e.message }); - } - _this.unsubscribe(connectionContext, opId); - return; - }); - }).catch(function (error) { - _this.sendError(connectionContext, opId, { message: error.message }); - _this.unsubscribe(connectionContext, opId); - }); - break; - case message_types_1.default.GQL_STOP: - _this.unsubscribe(connectionContext, opId); - break; - default: - _this.sendError(connectionContext, opId, { message: 'Invalid message type!' }); - } - }; - }; - SubscriptionServer.prototype.sendKeepAlive = function (connectionContext) { - if (connectionContext.isLegacy) { - this.sendMessage(connectionContext, undefined, message_types_1.default.KEEP_ALIVE, undefined); - } - else { - this.sendMessage(connectionContext, undefined, message_types_1.default.GQL_CONNECTION_KEEP_ALIVE, undefined); - } - }; - SubscriptionServer.prototype.sendMessage = function (connectionContext, opId, type, payload) { - var parsedMessage = parse_legacy_protocol_1.parseLegacyProtocolMessage(connectionContext, { - type: type, - id: opId, - payload: payload, - }); - if (parsedMessage && connectionContext.socket.readyState === WebSocket.OPEN) { - connectionContext.socket.send(JSON.stringify(parsedMessage)); - } - }; - SubscriptionServer.prototype.sendError = function (connectionContext, opId, errorPayload, overrideDefaultErrorType) { - var sanitizedOverrideDefaultErrorType = overrideDefaultErrorType || message_types_1.default.GQL_ERROR; - if ([ - message_types_1.default.GQL_CONNECTION_ERROR, - message_types_1.default.GQL_ERROR, - ].indexOf(sanitizedOverrideDefaultErrorType) === -1) { - throw new Error('overrideDefaultErrorType should be one of the allowed error messages' + - ' GQL_CONNECTION_ERROR or GQL_ERROR'); - } - this.sendMessage(connectionContext, opId, sanitizedOverrideDefaultErrorType, errorPayload); - }; - return SubscriptionServer; -}()); -exports.SubscriptionServer = SubscriptionServer; -//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/server.js.map b/node_modules/subscriptions-transport-ws/dist/server.js.map deleted file mode 100644 index 634ad201..00000000 --- a/node_modules/subscriptions-transport-ws/dist/server.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;AAAA,8BAAgC;AAEhC,iDAA2C;AAC3C,uCAA+D;AAC/D,+CAAyC;AACzC,mCASiB;AACjB,yDAA6D;AAC7D,mCAA6E;AAC7E,6DAAoE;AACpE,wEAA4E;AA2E5E,IAAM,iBAAiB,GAAG,UAAC,MAAW,IAAK,OAAA,MAAM,CAAC,EAAE,EAAT,CAAS,CAAC;AAErD;IA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EACjC,YAAY,CACb,CAAC;IACJ,CAAC;IACH,yBAAC;AAAD,CAAC,AApYD,IAoYC;AApYY,gDAAkB","sourcesContent":["import * as WebSocket from 'ws';\n\nimport MessageTypes from './message-types';\nimport { GRAPHQL_WS, GRAPHQL_SUBSCRIPTIONS } from './protocol';\nimport isObject from './utils/is-object';\nimport {\n parse,\n ExecutionResult,\n GraphQLSchema,\n DocumentNode,\n validate,\n ValidationContext,\n specifiedRules,\n GraphQLFieldResolver,\n} from 'graphql';\nimport { createEmptyIterable } from './utils/empty-iterable';\nimport { createAsyncIterator, forAwaitEach, isAsyncIterable } from 'iterall';\nimport { isASubscriptionOperation } from './utils/is-subscriptions';\nimport { parseLegacyProtocolMessage } from './legacy/parse-legacy-protocol';\nimport { IncomingMessage } from 'http';\n\nexport type ExecutionIterator = AsyncIterator;\n\nexport interface ExecutionParams {\n query: string | DocumentNode;\n variables: { [key: string]: any };\n operationName: string;\n context: TContext;\n formatResponse?: Function;\n formatError?: Function;\n callback?: Function;\n schema?: GraphQLSchema;\n}\n\nexport type ConnectionContext = {\n initPromise?: Promise,\n isLegacy: boolean,\n socket: WebSocket,\n request: IncomingMessage,\n operations: {\n [opId: string]: ExecutionIterator,\n },\n};\n\nexport interface OperationMessagePayload {\n [key: string]: any; // this will support for example any options sent in init like the auth token\n query?: string;\n variables?: { [key: string]: any };\n operationName?: string;\n}\n\nexport interface OperationMessage {\n payload?: OperationMessagePayload;\n id?: string;\n type: string;\n}\n\nexport type ExecuteFunction = (schema: GraphQLSchema,\n document: DocumentNode,\n rootValue?: any,\n contextValue?: any,\n variableValues?: { [key: string]: any },\n operationName?: string,\n fieldResolver?: GraphQLFieldResolver) =>\n ExecutionResult |\n Promise |\n AsyncIterator;\n\nexport type SubscribeFunction = (schema: GraphQLSchema,\n document: DocumentNode,\n rootValue?: any,\n contextValue?: any,\n variableValues?: { [key: string]: any },\n operationName?: string,\n fieldResolver?: GraphQLFieldResolver,\n subscribeFieldResolver?: GraphQLFieldResolver) =>\n AsyncIterator |\n Promise | ExecutionResult>;\n\nexport interface ServerOptions {\n rootValue?: any;\n schema?: GraphQLSchema;\n execute?: ExecuteFunction;\n subscribe?: SubscribeFunction;\n validationRules?:\n Array<(context: ValidationContext) => any> | ReadonlyArray;\n onOperation?: Function;\n onOperationComplete?: Function;\n onConnect?: Function;\n onDisconnect?: Function;\n keepAlive?: number;\n}\n\nconst isWebSocketServer = (socket: any) => socket.on;\n\nexport class SubscriptionServer {\n private onOperation: Function;\n private onOperationComplete: Function;\n private onConnect: Function;\n private onDisconnect: Function;\n\n private wsServer: WebSocket.Server;\n private execute: ExecuteFunction;\n private subscribe: SubscribeFunction;\n private schema: GraphQLSchema;\n private rootValue: any;\n private keepAlive: number;\n private closeHandler: () => void;\n private specifiedRules:\n Array<(context: ValidationContext) => any> |\n ReadonlyArray;\n\n public static create(options: ServerOptions, socketOptionsOrServer: WebSocket.ServerOptions | WebSocket.Server) {\n return new SubscriptionServer(options, socketOptionsOrServer);\n }\n\n constructor(options: ServerOptions, socketOptionsOrServer: WebSocket.ServerOptions | WebSocket.Server) {\n const {\n onOperation, onOperationComplete, onConnect, onDisconnect, keepAlive,\n } = options;\n\n this.specifiedRules = options.validationRules || specifiedRules;\n this.loadExecutor(options);\n\n this.onOperation = onOperation;\n this.onOperationComplete = onOperationComplete;\n this.onConnect = onConnect;\n this.onDisconnect = onDisconnect;\n this.keepAlive = keepAlive;\n\n if (isWebSocketServer(socketOptionsOrServer)) {\n this.wsServer = socketOptionsOrServer;\n } else {\n // Init and connect WebSocket server to http\n this.wsServer = new WebSocket.Server(socketOptionsOrServer || {});\n }\n\n const connectionHandler = ((socket: WebSocket, request: IncomingMessage) => {\n // Add `upgradeReq` to the socket object to support old API, without creating a memory leak\n // See: https://github.com/websockets/ws/pull/1099\n (socket as any).upgradeReq = request;\n // NOTE: the old GRAPHQL_SUBSCRIPTIONS protocol support should be removed in the future\n if (socket.protocol === undefined ||\n (socket.protocol.indexOf(GRAPHQL_WS) === -1 && socket.protocol.indexOf(GRAPHQL_SUBSCRIPTIONS) === -1)) {\n // Close the connection with an error code, ws v2 ensures that the\n // connection is cleaned up even when the closing handshake fails.\n // 1002: protocol error\n socket.close(1002);\n\n return;\n }\n\n const connectionContext: ConnectionContext = Object.create(null);\n connectionContext.initPromise = Promise.resolve(true);\n connectionContext.isLegacy = false;\n connectionContext.socket = socket;\n connectionContext.request = request;\n connectionContext.operations = {};\n\n const connectionClosedHandler = (error: any) => {\n if (error) {\n this.sendError(\n connectionContext,\n '',\n { message: error.message ? error.message : error },\n MessageTypes.GQL_CONNECTION_ERROR,\n );\n\n setTimeout(() => {\n // 1011 is an unexpected condition prevented the request from being fulfilled\n connectionContext.socket.close(1011);\n }, 10);\n }\n this.onClose(connectionContext);\n\n if (this.onDisconnect) {\n this.onDisconnect(socket, connectionContext);\n }\n };\n\n socket.on('error', connectionClosedHandler);\n socket.on('close', connectionClosedHandler);\n socket.on('message', this.onMessage(connectionContext));\n });\n\n this.wsServer.on('connection', connectionHandler);\n this.closeHandler = () => {\n this.wsServer.removeListener('connection', connectionHandler);\n this.wsServer.close();\n };\n }\n\n public get server(): WebSocket.Server {\n return this.wsServer;\n }\n\n public close(): void {\n this.closeHandler();\n }\n\n private loadExecutor(options: ServerOptions) {\n const { execute, subscribe, schema, rootValue } = options;\n\n if (!execute) {\n throw new Error('Must provide `execute` for websocket server constructor.');\n }\n\n this.schema = schema;\n this.rootValue = rootValue;\n this.execute = execute;\n this.subscribe = subscribe;\n }\n\n private unsubscribe(connectionContext: ConnectionContext, opId: string) {\n if (connectionContext.operations && connectionContext.operations[opId]) {\n if (connectionContext.operations[opId].return) {\n connectionContext.operations[opId].return();\n }\n\n delete connectionContext.operations[opId];\n\n if (this.onOperationComplete) {\n this.onOperationComplete(connectionContext.socket, opId);\n }\n }\n }\n\n private onClose(connectionContext: ConnectionContext) {\n Object.keys(connectionContext.operations).forEach((opId) => {\n this.unsubscribe(connectionContext, opId);\n });\n }\n\n private onMessage(connectionContext: ConnectionContext) {\n return (message: any) => {\n let parsedMessage: OperationMessage;\n try {\n parsedMessage = parseLegacyProtocolMessage(connectionContext, JSON.parse(message));\n } catch (e) {\n this.sendError(connectionContext, null, { message: e.message }, MessageTypes.GQL_CONNECTION_ERROR);\n return;\n }\n\n const opId = parsedMessage.id;\n switch (parsedMessage.type) {\n case MessageTypes.GQL_CONNECTION_INIT:\n if (this.onConnect) {\n connectionContext.initPromise = new Promise((resolve, reject) => {\n try {\n // TODO - this should become a function call with just 2 arguments in the future\n // when we release the breaking change api: parsedMessage.payload and connectionContext\n resolve(this.onConnect(parsedMessage.payload, connectionContext.socket, connectionContext));\n } catch (e) {\n reject(e);\n }\n });\n }\n\n connectionContext.initPromise.then((result) => {\n if (result === false) {\n throw new Error('Prohibited connection!');\n }\n\n this.sendMessage(\n connectionContext,\n undefined,\n MessageTypes.GQL_CONNECTION_ACK,\n undefined,\n );\n\n if (this.keepAlive) {\n this.sendKeepAlive(connectionContext);\n // Regular keep alive messages if keepAlive is set\n const keepAliveTimer = setInterval(() => {\n if (connectionContext.socket.readyState === WebSocket.OPEN) {\n this.sendKeepAlive(connectionContext);\n } else {\n clearInterval(keepAliveTimer);\n }\n }, this.keepAlive);\n }\n }).catch((error: Error) => {\n this.sendError(\n connectionContext,\n opId,\n { message: error.message },\n MessageTypes.GQL_CONNECTION_ERROR,\n );\n\n // Close the connection with an error code, ws v2 ensures that the\n // connection is cleaned up even when the closing handshake fails.\n // 1011: an unexpected condition prevented the operation from being fulfilled\n // We are using setTimeout because we want the message to be flushed before\n // disconnecting the client\n setTimeout(() => {\n connectionContext.socket.close(1011);\n }, 10);\n });\n break;\n\n case MessageTypes.GQL_CONNECTION_TERMINATE:\n connectionContext.socket.close();\n break;\n\n case MessageTypes.GQL_START:\n connectionContext.initPromise.then((initResult) => {\n // if we already have a subscription with this id, unsubscribe from it first\n if (connectionContext.operations && connectionContext.operations[opId]) {\n this.unsubscribe(connectionContext, opId);\n }\n\n const baseParams: ExecutionParams = {\n query: parsedMessage.payload.query,\n variables: parsedMessage.payload.variables,\n operationName: parsedMessage.payload.operationName,\n context: isObject(initResult) ? Object.assign(Object.create(Object.getPrototypeOf(initResult)), initResult) : {},\n formatResponse: undefined,\n formatError: undefined,\n callback: undefined,\n schema: this.schema,\n };\n let promisedParams = Promise.resolve(baseParams);\n\n // set an initial mock subscription to only registering opId\n connectionContext.operations[opId] = createEmptyIterable();\n\n if (this.onOperation) {\n let messageForCallback: any = parsedMessage;\n promisedParams = Promise.resolve(this.onOperation(messageForCallback, baseParams, connectionContext.socket));\n }\n\n return promisedParams.then((params) => {\n if (typeof params !== 'object') {\n const error = `Invalid params returned from onOperation! return values must be an object!`;\n this.sendError(connectionContext, opId, { message: error });\n\n throw new Error(error);\n }\n\n if (!params.schema) {\n const error = 'Missing schema information. The GraphQL schema should be provided either statically in' +\n ' the `SubscriptionServer` constructor or as a property on the object returned from onOperation!';\n this.sendError(connectionContext, opId, { message: error });\n\n throw new Error(error);\n }\n\n const document = typeof baseParams.query !== 'string' ? baseParams.query : parse(baseParams.query);\n let executionPromise: Promise | ExecutionResult>;\n const validationErrors = validate(params.schema, document, this.specifiedRules);\n\n if ( validationErrors.length > 0 ) {\n executionPromise = Promise.resolve({ errors: validationErrors });\n } else {\n let executor: SubscribeFunction | ExecuteFunction = this.execute;\n if (this.subscribe && isASubscriptionOperation(document, params.operationName)) {\n executor = this.subscribe;\n }\n executionPromise = Promise.resolve(executor(params.schema,\n document,\n this.rootValue,\n params.context,\n params.variables,\n params.operationName));\n }\n\n return executionPromise.then((executionResult) => ({\n executionIterable: isAsyncIterable(executionResult) ?\n executionResult : createAsyncIterator([ executionResult ]),\n params,\n }));\n }).then(({ executionIterable, params }) => {\n forAwaitEach(\n executionIterable as any,\n (value: ExecutionResult) => {\n let result = value;\n\n if (params.formatResponse) {\n try {\n result = params.formatResponse(value, params);\n } catch (err) {\n console.error('Error in formatResponse function:', err);\n }\n }\n\n this.sendMessage(connectionContext, opId, MessageTypes.GQL_DATA, result);\n })\n .then(() => {\n this.sendMessage(connectionContext, opId, MessageTypes.GQL_COMPLETE, null);\n })\n .catch((e: Error) => {\n let error = e;\n\n if (params.formatError) {\n try {\n error = params.formatError(e, params);\n } catch (err) {\n console.error('Error in formatError function: ', err);\n }\n }\n\n // plain Error object cannot be JSON stringified.\n if (Object.keys(error).length === 0) {\n error = { name: error.name, message: error.message };\n }\n\n this.sendError(connectionContext, opId, error);\n });\n\n return executionIterable;\n }).then((subscription: ExecutionIterator) => {\n connectionContext.operations[opId] = subscription;\n }).then(() => {\n // NOTE: This is a temporary code to support the legacy protocol.\n // As soon as the old protocol has been removed, this coode should also be removed.\n this.sendMessage(connectionContext, opId, MessageTypes.SUBSCRIPTION_SUCCESS, undefined);\n }).catch((e: any) => {\n if (e.errors) {\n this.sendMessage(connectionContext, opId, MessageTypes.GQL_DATA, { errors: e.errors });\n } else {\n this.sendError(connectionContext, opId, { message: e.message });\n }\n\n // Remove the operation on the server side as it will be removed also in the client\n this.unsubscribe(connectionContext, opId);\n return;\n });\n }).catch((error) => {\n // Handle initPromise rejected\n this.sendError(connectionContext, opId, { message: error.message });\n this.unsubscribe(connectionContext, opId);\n });\n break;\n\n case MessageTypes.GQL_STOP:\n // Find subscription id. Call unsubscribe.\n this.unsubscribe(connectionContext, opId);\n break;\n\n default:\n this.sendError(connectionContext, opId, { message: 'Invalid message type!' });\n }\n };\n }\n\n private sendKeepAlive(connectionContext: ConnectionContext): void {\n if (connectionContext.isLegacy) {\n this.sendMessage(connectionContext, undefined, MessageTypes.KEEP_ALIVE, undefined);\n } else {\n this.sendMessage(connectionContext, undefined, MessageTypes.GQL_CONNECTION_KEEP_ALIVE, undefined);\n }\n }\n\n private sendMessage(connectionContext: ConnectionContext, opId: string, type: string, payload: any): void {\n const parsedMessage = parseLegacyProtocolMessage(connectionContext, {\n type,\n id: opId,\n payload,\n });\n\n if (parsedMessage && connectionContext.socket.readyState === WebSocket.OPEN) {\n connectionContext.socket.send(JSON.stringify(parsedMessage));\n }\n }\n\n private sendError(connectionContext: ConnectionContext, opId: string, errorPayload: any,\n overrideDefaultErrorType?: string): void {\n const sanitizedOverrideDefaultErrorType = overrideDefaultErrorType || MessageTypes.GQL_ERROR;\n if ([\n MessageTypes.GQL_CONNECTION_ERROR,\n MessageTypes.GQL_ERROR,\n ].indexOf(sanitizedOverrideDefaultErrorType) === -1) {\n throw new Error('overrideDefaultErrorType should be one of the allowed error messages' +\n ' GQL_CONNECTION_ERROR or GQL_ERROR');\n }\n\n this.sendMessage(\n connectionContext,\n opId,\n sanitizedOverrideDefaultErrorType,\n errorPayload,\n );\n }\n}\n\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.d.ts b/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.d.ts deleted file mode 100644 index 11a034ee..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { $$asyncIterator } from 'iterall'; -declare type EmptyIterable = AsyncIterator & { - [$$asyncIterator]: any; -}; -export declare const createEmptyIterable: () => EmptyIterable; -export {}; diff --git a/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.js b/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.js deleted file mode 100644 index bdc9a9b3..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createEmptyIterable = void 0; -var iterall_1 = require("iterall"); -exports.createEmptyIterable = function () { - var _a; - return _a = { - next: function () { - return Promise.resolve({ value: undefined, done: true }); - }, - return: function () { - return Promise.resolve({ value: undefined, done: true }); - }, - throw: function (e) { - return Promise.reject(e); - } - }, - _a[iterall_1.$$asyncIterator] = function () { - return this; - }, - _a; -}; -//# sourceMappingURL=empty-iterable.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.js.map b/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.js.map deleted file mode 100644 index a93f9521..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/empty-iterable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"empty-iterable.js","sourceRoot":"","sources":["../../src/utils/empty-iterable.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAI7B,QAAA,mBAAmB,GAAG;;IACjC,OAAO;YACL,IAAI;gBACF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3D,CAAC;YACD,MAAM;gBACJ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3D,CAAC;YACD,KAAK,EAAL,UAAM,CAAQ;gBACZ,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;;QACD,GAAC,yBAAe,IAAhB;YACE,OAAO,IAAI,CAAC;QACd,CAAC;UACK,CAAC;AACX,CAAC,CAAC","sourcesContent":["import { $$asyncIterator } from 'iterall';\n\ntype EmptyIterable = AsyncIterator & { [$$asyncIterator]: any };\n\nexport const createEmptyIterable = (): EmptyIterable => {\n return {\n next() {\n return Promise.resolve({ value: undefined, done: true });\n },\n return() {\n return Promise.resolve({ value: undefined, done: true });\n },\n throw(e: Error) {\n return Promise.reject(e);\n },\n [$$asyncIterator]() {\n return this;\n },\n } as any;\n};\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-object.d.ts b/node_modules/subscriptions-transport-ws/dist/utils/is-object.d.ts deleted file mode 100644 index 4218171c..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-object.d.ts +++ /dev/null @@ -1 +0,0 @@ -export default function isObject(value?: any): boolean; diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-object.js b/node_modules/subscriptions-transport-ws/dist/utils/is-object.js deleted file mode 100644 index f59b4874..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-object.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function isObject(value) { - return ((value !== null) && (typeof value === 'object')); -} -exports.default = isObject; -//# sourceMappingURL=is-object.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-object.js.map b/node_modules/subscriptions-transport-ws/dist/utils/is-object.js.map deleted file mode 100644 index 661b982f..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-object.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"is-object.js","sourceRoot":"","sources":["../../src/utils/is-object.ts"],"names":[],"mappings":";;AAAA,SAAwB,QAAQ,CAAC,KAAW;IAC1C,OAAO,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;AAC3D,CAAC;AAFD,2BAEC","sourcesContent":["export default function isObject(value?: any): boolean {\n return ((value !== null) && (typeof value === 'object'));\n}\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-string.d.ts b/node_modules/subscriptions-transport-ws/dist/utils/is-string.d.ts deleted file mode 100644 index 4f89da71..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-string.d.ts +++ /dev/null @@ -1 +0,0 @@ -export default function isString(value?: any): value is string; diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-string.js b/node_modules/subscriptions-transport-ws/dist/utils/is-string.js deleted file mode 100644 index 96990fe6..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-string.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function isString(value) { - return typeof value === 'string'; -} -exports.default = isString; -//# sourceMappingURL=is-string.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-string.js.map b/node_modules/subscriptions-transport-ws/dist/utils/is-string.js.map deleted file mode 100644 index 3e550f2f..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-string.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"is-string.js","sourceRoot":"","sources":["../../src/utils/is-string.ts"],"names":[],"mappings":";;AAAA,SAAwB,QAAQ,CAAC,KAAW;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAFD,2BAEC","sourcesContent":["export default function isString(value?: any): value is string {\n return typeof value === 'string';\n}\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.d.ts b/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.d.ts deleted file mode 100644 index 85a9e0ff..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { DocumentNode } from 'graphql'; -export declare const isASubscriptionOperation: (document: DocumentNode, operationName: string) => boolean; diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.js b/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.js deleted file mode 100644 index 673152f4..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isASubscriptionOperation = void 0; -var graphql_1 = require("graphql"); -exports.isASubscriptionOperation = function (document, operationName) { - var operationAST = graphql_1.getOperationAST(document, operationName); - return !!operationAST && operationAST.operation === 'subscription'; -}; -//# sourceMappingURL=is-subscriptions.js.map \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.js.map b/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.js.map deleted file mode 100644 index be4d477c..00000000 --- a/node_modules/subscriptions-transport-ws/dist/utils/is-subscriptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"is-subscriptions.js","sourceRoot":"","sources":["../../src/utils/is-subscriptions.ts"],"names":[],"mappings":";;;AAAA,mCAAwD;AAE3C,QAAA,wBAAwB,GAAG,UAAC,QAAsB,EAAE,aAAqB;IACpF,IAAM,YAAY,GAAG,yBAAe,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAE9D,OAAO,CAAC,CAAC,YAAY,IAAI,YAAY,CAAC,SAAS,KAAK,cAAc,CAAC;AACrE,CAAC,CAAC","sourcesContent":["import { DocumentNode, getOperationAST } from 'graphql';\n\nexport const isASubscriptionOperation = (document: DocumentNode, operationName: string): boolean => {\n const operationAST = getOperationAST(document, operationName);\n\n return !!operationAST && operationAST.operation === 'subscription';\n};\n"]} \ No newline at end of file diff --git a/node_modules/subscriptions-transport-ws/netlify.toml b/node_modules/subscriptions-transport-ws/netlify.toml deleted file mode 100644 index f7093bfb..00000000 --- a/node_modules/subscriptions-transport-ws/netlify.toml +++ /dev/null @@ -1,6 +0,0 @@ -[build] - base = "docs/" - publish = "docs/public/" - command = "gatsby build --prefix-paths && mkdir -p docs/graphql-subscriptions && mv public/* docs/graphql-subscriptions && mv docs public/ && mv public/docs/graphql-subscriptions/_redirects public" -[build.environment] - NPM_VERSION = "6" diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/LICENSE b/node_modules/subscriptions-transport-ws/node_modules/ws/LICENSE deleted file mode 100644 index a145cd1d..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2011 Einar Otto Stangvik - -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. diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/README.md b/node_modules/subscriptions-transport-ws/node_modules/ws/README.md deleted file mode 100644 index 3fd9a8cc..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/README.md +++ /dev/null @@ -1,417 +0,0 @@ -# ws: a Node.js WebSocket library - -[![Version npm](https://img.shields.io/npm/v/ws.svg)](https://www.npmjs.com/package/ws) -[![Linux Build](https://img.shields.io/travis/websockets/ws/master.svg)](https://travis-ci.org/websockets/ws) -[![Windows Build](https://ci.appveyor.com/api/projects/status/github/websockets/ws?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/ws) -[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg)](https://coveralls.io/r/websockets/ws?branch=master) - -ws is a simple to use, blazing fast, and thoroughly tested WebSocket client -and server implementation. - -Passes the quite extensive Autobahn test suite: [server][server-report], -[client][client-report]. - -**Note**: This module does not work in the browser. The client in the docs is a -reference to a back end with the role of a client in the WebSocket -communication. Browser clients must use the native -[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) object. -To make the same code work seamlessly on Node.js and the browser, you can use -one of the many wrappers available on npm, like -[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). - -## Table of Contents - -* [Protocol support](#protocol-support) -* [Installing](#installing) - + [Opt-in for performance and spec compliance](#opt-in-for-performance-and-spec-compliance) -* [API docs](#api-docs) -* [WebSocket compression](#websocket-compression) -* [Usage examples](#usage-examples) - + [Sending and receiving text data](#sending-and-receiving-text-data) - + [Sending binary data](#sending-binary-data) - + [Simple server](#simple-server) - + [External HTTP/S server](#external-https-server) - + [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) - + [Server broadcast](#server-broadcast) - + [echo.websocket.org demo](#echowebsocketorg-demo) - + [Other examples](#other-examples) -* [Error handling best practices](#error-handling-best-practices) -* [FAQ](#faq) - + [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) - + [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) - + [How to connect via a proxy?](#how-to-connect-via-a-proxy) -* [Changelog](#changelog) -* [License](#license) - -## Protocol support - -* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) -* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`) - -## Installing - -``` -npm install --save ws -``` - -### Opt-in for performance and spec compliance - -There are 2 optional modules that can be installed along side with the ws -module. These modules are binary addons which improve certain operations. -Prebuilt binaries are available for the most popular platforms so you don't -necessarily need to have a C++ compiler installed on your machine. - -- `npm install --save-optional bufferutil`: Allows to efficiently perform - operations such as masking and unmasking the data payload of the WebSocket - frames. -- `npm install --save-optional utf-8-validate`: Allows to efficiently check - if a message contains valid UTF-8 as required by the spec. - -## API docs - -See [`/doc/ws.md`](./doc/ws.md) for Node.js-like docs for the ws classes. - -## WebSocket compression - -ws supports the [permessage-deflate extension][permessage-deflate] which -enables the client and server to negotiate a compression algorithm and its -parameters, and then selectively apply it to the data payloads of each -WebSocket message. - -The extension is disabled by default on the server and enabled by default on -the client. It adds a significant overhead in terms of performance and memory -consumption so we suggest to enable it only if it is really needed. - -Note that Node.js has a variety of issues with high-performance compression, -where increased concurrency, especially on Linux, can lead to -[catastrophic memory fragmentation][node-zlib-bug] and slow performance. -If you intend to use permessage-deflate in production, it is worthwhile to set -up a test representative of your workload and ensure Node.js/zlib will handle -it with acceptable performance and memory usage. - -Tuning of permessage-deflate can be done via the options defined below. You can -also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly -into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. - -See [the docs][ws-server-options] for more options. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ - port: 8080, - perMessageDeflate: { - zlibDeflateOptions: { // See zlib defaults. - chunkSize: 1024, - memLevel: 7, - level: 3, - }, - zlibInflateOptions: { - chunkSize: 10 * 1024 - }, - // Other options settable: - clientNoContextTakeover: true, // Defaults to negotiated value. - serverNoContextTakeover: true, // Defaults to negotiated value. - clientMaxWindowBits: 10, // Defaults to negotiated value. - serverMaxWindowBits: 10, // Defaults to negotiated value. - // Below options specified as default values. - concurrencyLimit: 10, // Limits zlib concurrency for perf. - threshold: 1024, // Size (in bytes) below which messages - // should not be compressed. - } -}); -``` - -The client will only use the extension if it is supported and enabled on the -server. To always disable the extension on the client set the -`perMessageDeflate` option to `false`. - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path', { - perMessageDeflate: false -}); -``` - -## Usage examples - -### Sending and receiving text data - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - ws.send('something'); -}); - -ws.on('message', function incoming(data) { - console.log(data); -}); -``` - -### Sending binary data - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - const array = new Float32Array(5); - - for (var i = 0; i < array.length; ++i) { - array[i] = i / 2; - } - - ws.send(array); -}); -``` - -### Simple server - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(message) { - console.log('received: %s', message); - }); - - ws.send('something'); -}); -``` - -### External HTTP/S server - -```js -const fs = require('fs'); -const https = require('https'); -const WebSocket = require('ws'); - -const server = new https.createServer({ - cert: fs.readFileSync('/path/to/cert.pem'), - key: fs.readFileSync('/path/to/key.pem') -}); -const wss = new WebSocket.Server({ server }); - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(message) { - console.log('received: %s', message); - }); - - ws.send('something'); -}); - -server.listen(8080); -``` - -### Multiple servers sharing a single HTTP/S server - -```js -const http = require('http'); -const WebSocket = require('ws'); - -const server = http.createServer(); -const wss1 = new WebSocket.Server({ noServer: true }); -const wss2 = new WebSocket.Server({ noServer: true }); - -wss1.on('connection', function connection(ws) { - // ... -}); - -wss2.on('connection', function connection(ws) { - // ... -}); - -server.on('upgrade', function upgrade(request, socket, head) { - const pathname = url.parse(request.url).pathname; - - if (pathname === '/foo') { - wss1.handleUpgrade(request, socket, head, function done(ws) { - wss1.emit('connection', ws, request); - }); - } else if (pathname === '/bar') { - wss2.handleUpgrade(request, socket, head, function done(ws) { - wss2.emit('connection', ws, request); - }); - } else { - socket.destroy(); - } -}); - -server.listen(8080); -``` - -### Server broadcast - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -// Broadcast to all. -wss.broadcast = function broadcast(data) { - wss.clients.forEach(function each(client) { - if (client.readyState === WebSocket.OPEN) { - client.send(data); - } - }); -}; - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(data) { - // Broadcast to everyone else. - wss.clients.forEach(function each(client) { - if (client !== ws && client.readyState === WebSocket.OPEN) { - client.send(data); - } - }); - }); -}); -``` - -### echo.websocket.org demo - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('wss://echo.websocket.org/', { - origin: 'https://websocket.org' -}); - -ws.on('open', function open() { - console.log('connected'); - ws.send(Date.now()); -}); - -ws.on('close', function close() { - console.log('disconnected'); -}); - -ws.on('message', function incoming(data) { - console.log(`Roundtrip time: ${Date.now() - data} ms`); - - setTimeout(function timeout() { - ws.send(Date.now()); - }, 500); -}); -``` - -### Other examples - -For a full example with a browser client communicating with a ws server, see the -examples folder. - -Otherwise, see the test cases. - -## Error handling best practices - -```js -// If the WebSocket is closed before the following send is attempted -ws.send('something'); - -// Errors (both immediate and async write errors) can be detected in an optional -// callback. The callback is also the only way of being notified that data has -// actually been sent. -ws.send('something', function ack(error) { - // If error is not defined, the send has been completed, otherwise the error - // object will indicate what failed. -}); - -// Immediate errors can also be handled with `try...catch`, but **note** that -// since sends are inherently asynchronous, socket write failures will *not* be -// captured when this technique is used. -try { ws.send('something'); } -catch (e) { /* handle error */ } -``` - -## FAQ - -### How to get the IP address of the client? - -The remote IP address can be obtained from the raw socket. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -wss.on('connection', function connection(ws, req) { - const ip = req.connection.remoteAddress; -}); -``` - -When the server runs behind a proxy like NGINX, the de-facto standard is to use -the `X-Forwarded-For` header. - -```js -wss.on('connection', function connection(ws, req) { - const ip = req.headers['x-forwarded-for'].split(/\s*,\s*/)[0]; -}); -``` - -### How to detect and close broken connections? - -Sometimes the link between the server and the client can be interrupted in a -way that keeps both the server and the client unaware of the broken state of the -connection (e.g. when pulling the cord). - -In these cases ping messages can be used as a means to verify that the remote -endpoint is still responsive. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -function noop() {} - -function heartbeat() { - this.isAlive = true; -} - -wss.on('connection', function connection(ws) { - ws.isAlive = true; - ws.on('pong', heartbeat); -}); - -const interval = setInterval(function ping() { - wss.clients.forEach(function each(ws) { - if (ws.isAlive === false) return ws.terminate(); - - ws.isAlive = false; - ws.ping(noop); - }); -}, 30000); -``` - -Pong messages are automatically sent in response to ping messages as required -by the spec. - -### How to connect via a proxy? - -Use a custom `http.Agent` implementation like [https-proxy-agent][] or -[socks-proxy-agent][]. - -## Changelog - -We're using the GitHub [releases][changelog] for changelog entries. - -## License - -[MIT](LICENSE) - -[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent -[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent -[client-report]: http://websockets.github.io/ws/autobahn/clients/ -[server-report]: http://websockets.github.io/ws/autobahn/servers/ -[permessage-deflate]: https://tools.ietf.org/html/rfc7692 -[changelog]: https://github.com/websockets/ws/releases -[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 -[node-zlib-deflaterawdocs]: https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options -[ws-server-options]: https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/index.js b/node_modules/subscriptions-transport-ws/node_modules/ws/index.js deleted file mode 100644 index b8d6be1c..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -const WebSocket = require('./lib/websocket'); - -WebSocket.Server = require('./lib/websocket-server'); -WebSocket.Receiver = require('./lib/receiver'); -WebSocket.Sender = require('./lib/sender'); - -module.exports = WebSocket; diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/buffer-util.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/buffer-util.js deleted file mode 100644 index 6974dd6a..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/buffer-util.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -/** - * Merges an array of buffers into a new buffer. - * - * @param {Buffer[]} list The array of buffers to concat - * @param {Number} totalLength The total length of buffers in the list - * @return {Buffer} The resulting buffer - * @public - */ -function concat (list, totalLength) { - const target = Buffer.allocUnsafe(totalLength); - var offset = 0; - - for (var i = 0; i < list.length; i++) { - const buf = list[i]; - buf.copy(target, offset); - offset += buf.length; - } - - return target; -} - -/** - * Masks a buffer using the given mask. - * - * @param {Buffer} source The buffer to mask - * @param {Buffer} mask The mask to use - * @param {Buffer} output The buffer where to store the result - * @param {Number} offset The offset at which to start writing - * @param {Number} length The number of bytes to mask. - * @public - */ -function _mask (source, mask, output, offset, length) { - for (var i = 0; i < length; i++) { - output[offset + i] = source[i] ^ mask[i & 3]; - } -} - -/** - * Unmasks a buffer using the given mask. - * - * @param {Buffer} buffer The buffer to unmask - * @param {Buffer} mask The mask to use - * @public - */ -function _unmask (buffer, mask) { - // Required until https://github.com/nodejs/node/issues/9006 is resolved. - const length = buffer.length; - for (var i = 0; i < length; i++) { - buffer[i] ^= mask[i & 3]; - } -} - -try { - const bufferUtil = require('bufferutil'); - const bu = bufferUtil.BufferUtil || bufferUtil; - - module.exports = { - mask (source, mask, output, offset, length) { - if (length < 48) _mask(source, mask, output, offset, length); - else bu.mask(source, mask, output, offset, length); - }, - unmask (buffer, mask) { - if (buffer.length < 32) _unmask(buffer, mask); - else bu.unmask(buffer, mask); - }, - concat - }; -} catch (e) /* istanbul ignore next */ { - module.exports = { concat, mask: _mask, unmask: _unmask }; -} diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/constants.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/constants.js deleted file mode 100644 index 4082981f..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/constants.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = { - BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], - GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', - kStatusCode: Symbol('status-code'), - kWebSocket: Symbol('websocket'), - EMPTY_BUFFER: Buffer.alloc(0), - NOOP: () => {} -}; diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/event-target.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/event-target.js deleted file mode 100644 index 574e9080..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/event-target.js +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -/** - * Class representing an event. - * - * @private - */ -class Event { - /** - * Create a new `Event`. - * - * @param {String} type The name of the event - * @param {Object} target A reference to the target to which the event was dispatched - */ - constructor (type, target) { - this.target = target; - this.type = type; - } -} - -/** - * Class representing a message event. - * - * @extends Event - * @private - */ -class MessageEvent extends Event { - /** - * Create a new `MessageEvent`. - * - * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (data, target) { - super('message', target); - - this.data = data; - } -} - -/** - * Class representing a close event. - * - * @extends Event - * @private - */ -class CloseEvent extends Event { - /** - * Create a new `CloseEvent`. - * - * @param {Number} code The status code explaining why the connection is being closed - * @param {String} reason A human-readable string explaining why the connection is closing - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (code, reason, target) { - super('close', target); - - this.wasClean = target._closeFrameReceived && target._closeFrameSent; - this.reason = reason; - this.code = code; - } -} - -/** - * Class representing an open event. - * - * @extends Event - * @private - */ -class OpenEvent extends Event { - /** - * Create a new `OpenEvent`. - * - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (target) { - super('open', target); - } -} - -/** - * Class representing an error event. - * - * @extends Event - * @private - */ -class ErrorEvent extends Event { - /** - * Create a new `ErrorEvent`. - * - * @param {Object} error The error that generated this event - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (error, target) { - super('error', target); - - this.message = error.message; - this.error = error; - } -} - -/** - * This provides methods for emulating the `EventTarget` interface. It's not - * meant to be used directly. - * - * @mixin - */ -const EventTarget = { - /** - * Register an event listener. - * - * @param {String} method A string representing the event type to listen for - * @param {Function} listener The listener to add - * @public - */ - addEventListener (method, listener) { - if (typeof listener !== 'function') return; - - function onMessage (data) { - listener.call(this, new MessageEvent(data, this)); - } - - function onClose (code, message) { - listener.call(this, new CloseEvent(code, message, this)); - } - - function onError (error) { - listener.call(this, new ErrorEvent(error, this)); - } - - function onOpen () { - listener.call(this, new OpenEvent(this)); - } - - if (method === 'message') { - onMessage._listener = listener; - this.on(method, onMessage); - } else if (method === 'close') { - onClose._listener = listener; - this.on(method, onClose); - } else if (method === 'error') { - onError._listener = listener; - this.on(method, onError); - } else if (method === 'open') { - onOpen._listener = listener; - this.on(method, onOpen); - } else { - this.on(method, listener); - } - }, - - /** - * Remove an event listener. - * - * @param {String} method A string representing the event type to remove - * @param {Function} listener The listener to remove - * @public - */ - removeEventListener (method, listener) { - const listeners = this.listeners(method); - - for (var i = 0; i < listeners.length; i++) { - if (listeners[i] === listener || listeners[i]._listener === listener) { - this.removeListener(method, listeners[i]); - } - } - } -}; - -module.exports = EventTarget; diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/extension.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/extension.js deleted file mode 100644 index 3f48d751..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/extension.js +++ /dev/null @@ -1,211 +0,0 @@ -'use strict'; - -// -// Allowed token characters: -// -// '!', '#', '$', '%', '&', ''', '*', '+', '-', -// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' -// -// tokenChars[32] === 0 // ' ' -// tokenChars[33] === 1 // '!' -// tokenChars[34] === 0 // '"' -// ... -// -const tokenChars = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 - 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 -]; - -/** - * Adds an offer to the map of extension offers or a parameter to the map of - * parameters. - * - * @param {Object} dest The map of extension offers or parameters - * @param {String} name The extension or parameter name - * @param {(Object|Boolean|String)} elem The extension parameters or the - * parameter value - * @private - */ -function push (dest, name, elem) { - if (Object.prototype.hasOwnProperty.call(dest, name)) dest[name].push(elem); - else dest[name] = [elem]; -} - -/** - * Parses the `Sec-WebSocket-Extensions` header into an object. - * - * @param {String} header The field value of the header - * @return {Object} The parsed object - * @public - */ -function parse (header) { - const offers = {}; - - if (header === undefined || header === '') return offers; - - var params = {}; - var mustUnescape = false; - var isEscaping = false; - var inQuotes = false; - var extensionName; - var paramName; - var start = -1; - var end = -1; - - for (var i = 0; i < header.length; i++) { - const code = header.charCodeAt(i); - - if (extensionName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x20/* ' ' */|| code === 0x09/* '\t' */) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b/* ';' */ || code === 0x2c/* ',' */) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - const name = header.slice(start, end); - if (code === 0x2c) { - push(offers, name, params); - params = {}; - } else { - extensionName = name; - } - - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (paramName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x20 || code === 0x09) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - push(params, header.slice(start, end), true); - if (code === 0x2c) { - push(offers, extensionName, params); - params = {}; - extensionName = undefined; - } - - start = end = -1; - } else if (code === 0x3d/* '=' */&& start !== -1 && end === -1) { - paramName = header.slice(start, i); - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else { - // - // The value of a quoted-string after unescaping must conform to the - // token ABNF, so only token characters are valid. - // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 - // - if (isEscaping) { - if (tokenChars[code] !== 1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - if (start === -1) start = i; - else if (!mustUnescape) mustUnescape = true; - isEscaping = false; - } else if (inQuotes) { - if (tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x22/* '"' */ && start !== -1) { - inQuotes = false; - end = i; - } else if (code === 0x5c/* '\' */) { - isEscaping = true; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { - inQuotes = true; - } else if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (start !== -1 && (code === 0x20 || code === 0x09)) { - if (end === -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - var value = header.slice(start, end); - if (mustUnescape) { - value = value.replace(/\\/g, ''); - mustUnescape = false; - } - push(params, paramName, value); - if (code === 0x2c) { - push(offers, extensionName, params); - params = {}; - extensionName = undefined; - } - - paramName = undefined; - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } - } - - if (start === -1 || inQuotes) { - throw new SyntaxError('Unexpected end of input'); - } - - if (end === -1) end = i; - const token = header.slice(start, end); - if (extensionName === undefined) { - push(offers, token, {}); - } else { - if (paramName === undefined) { - push(params, token, true); - } else if (mustUnescape) { - push(params, paramName, token.replace(/\\/g, '')); - } else { - push(params, paramName, token); - } - push(offers, extensionName, params); - } - - return offers; -} - -/** - * Builds the `Sec-WebSocket-Extensions` header field value. - * - * @param {Object} extensions The map of extensions and parameters to format - * @return {String} A string representing the given object - * @public - */ -function format (extensions) { - return Object.keys(extensions).map((extension) => { - var configurations = extensions[extension]; - if (!Array.isArray(configurations)) configurations = [configurations]; - return configurations.map((params) => { - return [extension].concat(Object.keys(params).map((k) => { - var values = params[k]; - if (!Array.isArray(values)) values = [values]; - return values.map((v) => v === true ? k : `${k}=${v}`).join('; '); - })).join('; '); - }).join(', '); - }).join(', '); -} - -module.exports = { format, parse }; diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/permessage-deflate.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/permessage-deflate.js deleted file mode 100644 index 0d54f035..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/permessage-deflate.js +++ /dev/null @@ -1,516 +0,0 @@ -'use strict'; - -const Limiter = require('async-limiter'); -const zlib = require('zlib'); - -const bufferUtil = require('./buffer-util'); -const constants = require('./constants'); - -const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); -const EMPTY_BLOCK = Buffer.from([0x00]); - -const kPerMessageDeflate = Symbol('permessage-deflate'); -const kWriteInProgress = Symbol('write-in-progress'); -const kPendingClose = Symbol('pending-close'); -const kTotalLength = Symbol('total-length'); -const kCallback = Symbol('callback'); -const kBuffers = Symbol('buffers'); -const kError = Symbol('error'); - -// -// We limit zlib concurrency, which prevents severe memory fragmentation -// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 -// and https://github.com/websockets/ws/issues/1202 -// -// Intentionally global; it's the global thread pool that's an issue. -// -let zlibLimiter; - -/** - * permessage-deflate implementation. - */ -class PerMessageDeflate { - /** - * Creates a PerMessageDeflate instance. - * - * @param {Object} options Configuration options - * @param {Boolean} options.serverNoContextTakeover Request/accept disabling - * of server context takeover - * @param {Boolean} options.clientNoContextTakeover Advertise/acknowledge - * disabling of client context takeover - * @param {(Boolean|Number)} options.serverMaxWindowBits Request/confirm the - * use of a custom server window size - * @param {(Boolean|Number)} options.clientMaxWindowBits Advertise support - * for, or request, a custom client window size - * @param {Object} options.zlibDeflateOptions Options to pass to zlib on deflate - * @param {Object} options.zlibInflateOptions Options to pass to zlib on inflate - * @param {Number} options.threshold Size (in bytes) below which messages - * should not be compressed - * @param {Number} options.concurrencyLimit The number of concurrent calls to - * zlib - * @param {Boolean} isServer Create the instance in either server or client - * mode - * @param {Number} maxPayload The maximum allowed message length - */ - constructor (options, isServer, maxPayload) { - this._maxPayload = maxPayload | 0; - this._options = options || {}; - this._threshold = this._options.threshold !== undefined - ? this._options.threshold - : 1024; - this._isServer = !!isServer; - this._deflate = null; - this._inflate = null; - - this.params = null; - - if (!zlibLimiter) { - const concurrency = this._options.concurrencyLimit !== undefined - ? this._options.concurrencyLimit - : 10; - zlibLimiter = new Limiter({ concurrency }); - } - } - - /** - * @type {String} - */ - static get extensionName () { - return 'permessage-deflate'; - } - - /** - * Create an extension negotiation offer. - * - * @return {Object} Extension parameters - * @public - */ - offer () { - const params = {}; - - if (this._options.serverNoContextTakeover) { - params.server_no_context_takeover = true; - } - if (this._options.clientNoContextTakeover) { - params.client_no_context_takeover = true; - } - if (this._options.serverMaxWindowBits) { - params.server_max_window_bits = this._options.serverMaxWindowBits; - } - if (this._options.clientMaxWindowBits) { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } else if (this._options.clientMaxWindowBits == null) { - params.client_max_window_bits = true; - } - - return params; - } - - /** - * Accept an extension negotiation offer/response. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Object} Accepted configuration - * @public - */ - accept (configurations) { - configurations = this.normalizeParams(configurations); - - this.params = this._isServer - ? this.acceptAsServer(configurations) - : this.acceptAsClient(configurations); - - return this.params; - } - - /** - * Releases all resources used by the extension. - * - * @public - */ - cleanup () { - if (this._inflate) { - if (this._inflate[kWriteInProgress]) { - this._inflate[kPendingClose] = true; - } else { - this._inflate.close(); - this._inflate = null; - } - } - if (this._deflate) { - if (this._deflate[kWriteInProgress]) { - this._deflate[kPendingClose] = true; - } else { - this._deflate.close(); - this._deflate = null; - } - } - } - - /** - * Accept an extension negotiation offer. - * - * @param {Array} offers The extension negotiation offers - * @return {Object} Accepted configuration - * @private - */ - acceptAsServer (offers) { - const opts = this._options; - const accepted = offers.find((params) => { - if ( - (opts.serverNoContextTakeover === false && - params.server_no_context_takeover) || - (params.server_max_window_bits && - (opts.serverMaxWindowBits === false || - (typeof opts.serverMaxWindowBits === 'number' && - opts.serverMaxWindowBits > params.server_max_window_bits))) || - (typeof opts.clientMaxWindowBits === 'number' && - !params.client_max_window_bits) - ) { - return false; - } - - return true; - }); - - if (!accepted) { - throw new Error('None of the extension offers can be accepted'); - } - - if (opts.serverNoContextTakeover) { - accepted.server_no_context_takeover = true; - } - if (opts.clientNoContextTakeover) { - accepted.client_no_context_takeover = true; - } - if (typeof opts.serverMaxWindowBits === 'number') { - accepted.server_max_window_bits = opts.serverMaxWindowBits; - } - if (typeof opts.clientMaxWindowBits === 'number') { - accepted.client_max_window_bits = opts.clientMaxWindowBits; - } else if ( - accepted.client_max_window_bits === true || - opts.clientMaxWindowBits === false - ) { - delete accepted.client_max_window_bits; - } - - return accepted; - } - - /** - * Accept the extension negotiation response. - * - * @param {Array} response The extension negotiation response - * @return {Object} Accepted configuration - * @private - */ - acceptAsClient (response) { - const params = response[0]; - - if ( - this._options.clientNoContextTakeover === false && - params.client_no_context_takeover - ) { - throw new Error('Unexpected parameter "client_no_context_takeover"'); - } - - if (!params.client_max_window_bits) { - if (typeof this._options.clientMaxWindowBits === 'number') { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } - } else if ( - this._options.clientMaxWindowBits === false || - (typeof this._options.clientMaxWindowBits === 'number' && - params.client_max_window_bits > this._options.clientMaxWindowBits) - ) { - throw new Error( - 'Unexpected or invalid parameter "client_max_window_bits"' - ); - } - - return params; - } - - /** - * Normalize parameters. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Array} The offers/response with normalized parameters - * @private - */ - normalizeParams (configurations) { - configurations.forEach((params) => { - Object.keys(params).forEach((key) => { - var value = params[key]; - - if (value.length > 1) { - throw new Error(`Parameter "${key}" must have only a single value`); - } - - value = value[0]; - - if (key === 'client_max_window_bits') { - if (value !== true) { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if (!this._isServer) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else if (key === 'server_max_window_bits') { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if ( - key === 'client_no_context_takeover' || - key === 'server_no_context_takeover' - ) { - if (value !== true) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else { - throw new Error(`Unknown parameter "${key}"`); - } - - params[key] = value; - }); - }); - - return configurations; - } - - /** - * Decompress data. Concurrency limited by async-limiter. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - decompress (data, fin, callback) { - zlibLimiter.push((done) => { - this._decompress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Compress data. Concurrency limited by async-limiter. - * - * @param {Buffer} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - compress (data, fin, callback) { - zlibLimiter.push((done) => { - this._compress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Decompress data. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _decompress (data, fin, callback) { - const endpoint = this._isServer ? 'client' : 'server'; - - if (!this._inflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._inflate = zlib.createInflateRaw( - Object.assign({}, this._options.zlibInflateOptions, { windowBits }) - ); - this._inflate[kPerMessageDeflate] = this; - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - this._inflate.on('error', inflateOnError); - this._inflate.on('data', inflateOnData); - } - - this._inflate[kCallback] = callback; - this._inflate[kWriteInProgress] = true; - - this._inflate.write(data); - if (fin) this._inflate.write(TRAILER); - - this._inflate.flush(() => { - const err = this._inflate[kError]; - - if (err) { - this._inflate.close(); - this._inflate = null; - callback(err); - return; - } - - const data = bufferUtil.concat( - this._inflate[kBuffers], - this._inflate[kTotalLength] - ); - - if ( - (fin && this.params[`${endpoint}_no_context_takeover`]) || - this._inflate[kPendingClose] - ) { - this._inflate.close(); - this._inflate = null; - } else { - this._inflate[kWriteInProgress] = false; - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - } - - callback(null, data); - }); - } - - /** - * Compress data. - * - * @param {Buffer} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _compress (data, fin, callback) { - if (!data || data.length === 0) { - process.nextTick(callback, null, EMPTY_BLOCK); - return; - } - - const endpoint = this._isServer ? 'server' : 'client'; - - if (!this._deflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._deflate = zlib.createDeflateRaw( - Object.assign( - // TODO deprecate memLevel/level and recommend zlibDeflateOptions instead - { - memLevel: this._options.memLevel, - level: this._options.level - }, - this._options.zlibDeflateOptions, - { windowBits } - ) - ); - - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - - // - // `zlib.DeflateRaw` emits an `'error'` event only when an attempt to use - // it is made after it has already been closed. This cannot happen here, - // so we only add a listener for the `'data'` event. - // - this._deflate.on('data', deflateOnData); - } - - this._deflate[kWriteInProgress] = true; - - this._deflate.write(data); - this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { - var data = bufferUtil.concat( - this._deflate[kBuffers], - this._deflate[kTotalLength] - ); - - if (fin) data = data.slice(0, data.length - 4); - - if ( - (fin && this.params[`${endpoint}_no_context_takeover`]) || - this._deflate[kPendingClose] - ) { - this._deflate.close(); - this._deflate = null; - } else { - this._deflate[kWriteInProgress] = false; - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - } - - callback(null, data); - }); - } -} - -module.exports = PerMessageDeflate; - -/** - * The listener of the `zlib.DeflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function deflateOnData (chunk) { - this[kBuffers].push(chunk); - this[kTotalLength] += chunk.length; -} - -/** - * The listener of the `zlib.InflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function inflateOnData (chunk) { - this[kTotalLength] += chunk.length; - - if ( - this[kPerMessageDeflate]._maxPayload < 1 || - this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload - ) { - this[kBuffers].push(chunk); - return; - } - - this[kError] = new RangeError('Max payload size exceeded'); - this[kError][constants.kStatusCode] = 1009; - this.removeListener('data', inflateOnData); - this.reset(); -} - -/** - * The listener of the `zlib.InflateRaw` stream `'error'` event. - * - * @param {Error} err The emitted error - * @private - */ -function inflateOnError (err) { - // - // There is no need to call `Zlib#close()` as the handle is automatically - // closed when an error is emitted. - // - this[kPerMessageDeflate]._inflate = null; - err[constants.kStatusCode] = 1007; - this[kCallback](err); -} diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/receiver.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/receiver.js deleted file mode 100644 index 81dc0bf8..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/receiver.js +++ /dev/null @@ -1,513 +0,0 @@ -'use strict'; - -const stream = require('stream'); - -const PerMessageDeflate = require('./permessage-deflate'); -const bufferUtil = require('./buffer-util'); -const validation = require('./validation'); -const constants = require('./constants'); - -const GET_INFO = 0; -const GET_PAYLOAD_LENGTH_16 = 1; -const GET_PAYLOAD_LENGTH_64 = 2; -const GET_MASK = 3; -const GET_DATA = 4; -const INFLATING = 5; - -/** - * HyBi Receiver implementation. - * - * @extends stream.Writable - */ -class Receiver extends stream.Writable { - /** - * Creates a Receiver instance. - * - * @param {String} binaryType The type for binary data - * @param {Object} extensions An object containing the negotiated extensions - * @param {Number} maxPayload The maximum allowed message length - */ - constructor (binaryType, extensions, maxPayload) { - super(); - - this._binaryType = binaryType || constants.BINARY_TYPES[0]; - this[constants.kWebSocket] = undefined; - this._extensions = extensions || {}; - this._maxPayload = maxPayload | 0; - - this._bufferedBytes = 0; - this._buffers = []; - - this._compressed = false; - this._payloadLength = 0; - this._mask = undefined; - this._fragmented = 0; - this._masked = false; - this._fin = false; - this._opcode = 0; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragments = []; - - this._state = GET_INFO; - this._loop = false; - } - - /** - * Implements `Writable.prototype._write()`. - * - * @param {Buffer} chunk The chunk of data to write - * @param {String} encoding The character encoding of `chunk` - * @param {Function} cb Callback - */ - _write (chunk, encoding, cb) { - if (this._opcode === 0x08) return cb(); - - this._bufferedBytes += chunk.length; - this._buffers.push(chunk); - this.startLoop(cb); - } - - /** - * Consumes `n` bytes from the buffered data. - * - * @param {Number} n The number of bytes to consume - * @return {Buffer} The consumed bytes - * @private - */ - consume (n) { - this._bufferedBytes -= n; - - if (n === this._buffers[0].length) return this._buffers.shift(); - - if (n < this._buffers[0].length) { - const buf = this._buffers[0]; - this._buffers[0] = buf.slice(n); - return buf.slice(0, n); - } - - const dst = Buffer.allocUnsafe(n); - - do { - const buf = this._buffers[0]; - - if (n >= buf.length) { - this._buffers.shift().copy(dst, dst.length - n); - } else { - buf.copy(dst, dst.length - n, 0, n); - this._buffers[0] = buf.slice(n); - } - - n -= buf.length; - } while (n > 0); - - return dst; - } - - /** - * Starts the parsing loop. - * - * @param {Function} cb Callback - * @private - */ - startLoop (cb) { - var err; - this._loop = true; - - do { - switch (this._state) { - case GET_INFO: - err = this.getInfo(); - break; - case GET_PAYLOAD_LENGTH_16: - err = this.getPayloadLength16(); - break; - case GET_PAYLOAD_LENGTH_64: - err = this.getPayloadLength64(); - break; - case GET_MASK: - this.getMask(); - break; - case GET_DATA: - err = this.getData(cb); - break; - default: // `INFLATING` - this._loop = false; - return; - } - } while (this._loop); - - cb(err); - } - - /** - * Reads the first two bytes of a frame. - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getInfo () { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - const buf = this.consume(2); - - if ((buf[0] & 0x30) !== 0x00) { - this._loop = false; - return error(RangeError, 'RSV2 and RSV3 must be clear', true, 1002); - } - - const compressed = (buf[0] & 0x40) === 0x40; - - if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - this._fin = (buf[0] & 0x80) === 0x80; - this._opcode = buf[0] & 0x0f; - this._payloadLength = buf[1] & 0x7f; - - if (this._opcode === 0x00) { - if (compressed) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - if (!this._fragmented) { - this._loop = false; - return error(RangeError, 'invalid opcode 0', true, 1002); - } - - this._opcode = this._fragmented; - } else if (this._opcode === 0x01 || this._opcode === 0x02) { - if (this._fragmented) { - this._loop = false; - return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); - } - - this._compressed = compressed; - } else if (this._opcode > 0x07 && this._opcode < 0x0b) { - if (!this._fin) { - this._loop = false; - return error(RangeError, 'FIN must be set', true, 1002); - } - - if (compressed) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - if (this._payloadLength > 0x7d) { - this._loop = false; - return error( - RangeError, - `invalid payload length ${this._payloadLength}`, - true, - 1002 - ); - } - } else { - this._loop = false; - return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); - } - - if (!this._fin && !this._fragmented) this._fragmented = this._opcode; - this._masked = (buf[1] & 0x80) === 0x80; - - if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; - else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; - else return this.haveLength(); - } - - /** - * Gets extended payload length (7+16). - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getPayloadLength16 () { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - this._payloadLength = this.consume(2).readUInt16BE(0); - return this.haveLength(); - } - - /** - * Gets extended payload length (7+64). - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getPayloadLength64 () { - if (this._bufferedBytes < 8) { - this._loop = false; - return; - } - - const buf = this.consume(8); - const num = buf.readUInt32BE(0); - - // - // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned - // if payload length is greater than this number. - // - if (num > Math.pow(2, 53 - 32) - 1) { - this._loop = false; - return error( - RangeError, - 'Unsupported WebSocket frame: payload length > 2^53 - 1', - false, - 1009 - ); - } - - this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); - return this.haveLength(); - } - - /** - * Payload length has been read. - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - haveLength () { - if (this._payloadLength && this._opcode < 0x08) { - this._totalPayloadLength += this._payloadLength; - if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { - this._loop = false; - return error(RangeError, 'Max payload size exceeded', false, 1009); - } - } - - if (this._masked) this._state = GET_MASK; - else this._state = GET_DATA; - } - - /** - * Reads mask bytes. - * - * @private - */ - getMask () { - if (this._bufferedBytes < 4) { - this._loop = false; - return; - } - - this._mask = this.consume(4); - this._state = GET_DATA; - } - - /** - * Reads data bytes. - * - * @param {Function} cb Callback - * @return {(Error|RangeError|undefined)} A possible error - * @private - */ - getData (cb) { - var data = constants.EMPTY_BUFFER; - - if (this._payloadLength) { - if (this._bufferedBytes < this._payloadLength) { - this._loop = false; - return; - } - - data = this.consume(this._payloadLength); - if (this._masked) bufferUtil.unmask(data, this._mask); - } - - if (this._opcode > 0x07) return this.controlMessage(data); - - if (this._compressed) { - this._state = INFLATING; - this.decompress(data, cb); - return; - } - - if (data.length) { - // - // This message is not compressed so its lenght is the sum of the payload - // length of all fragments. - // - this._messageLength = this._totalPayloadLength; - this._fragments.push(data); - } - - return this.dataMessage(); - } - - /** - * Decompresses data. - * - * @param {Buffer} data Compressed data - * @param {Function} cb Callback - * @private - */ - decompress (data, cb) { - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - perMessageDeflate.decompress(data, this._fin, (err, buf) => { - if (err) return cb(err); - - if (buf.length) { - this._messageLength += buf.length; - if (this._messageLength > this._maxPayload && this._maxPayload > 0) { - return cb(error(RangeError, 'Max payload size exceeded', false, 1009)); - } - - this._fragments.push(buf); - } - - const er = this.dataMessage(); - if (er) return cb(er); - - this.startLoop(cb); - }); - } - - /** - * Handles a data message. - * - * @return {(Error|undefined)} A possible error - * @private - */ - dataMessage () { - if (this._fin) { - const messageLength = this._messageLength; - const fragments = this._fragments; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragmented = 0; - this._fragments = []; - - if (this._opcode === 2) { - var data; - - if (this._binaryType === 'nodebuffer') { - data = toBuffer(fragments, messageLength); - } else if (this._binaryType === 'arraybuffer') { - data = toArrayBuffer(toBuffer(fragments, messageLength)); - } else { - data = fragments; - } - - this.emit('message', data); - } else { - const buf = toBuffer(fragments, messageLength); - - if (!validation.isValidUTF8(buf)) { - this._loop = false; - return error(Error, 'invalid UTF-8 sequence', true, 1007); - } - - this.emit('message', buf.toString()); - } - } - - this._state = GET_INFO; - } - - /** - * Handles a control message. - * - * @param {Buffer} data Data to handle - * @return {(Error|RangeError|undefined)} A possible error - * @private - */ - controlMessage (data) { - if (this._opcode === 0x08) { - this._loop = false; - - if (data.length === 0) { - this.emit('conclude', 1005, ''); - this.end(); - } else if (data.length === 1) { - return error(RangeError, 'invalid payload length 1', true, 1002); - } else { - const code = data.readUInt16BE(0); - - if (!validation.isValidStatusCode(code)) { - return error(RangeError, `invalid status code ${code}`, true, 1002); - } - - const buf = data.slice(2); - - if (!validation.isValidUTF8(buf)) { - return error(Error, 'invalid UTF-8 sequence', true, 1007); - } - - this.emit('conclude', code, buf.toString()); - this.end(); - } - - return; - } - - if (this._opcode === 0x09) this.emit('ping', data); - else this.emit('pong', data); - - this._state = GET_INFO; - } -} - -module.exports = Receiver; - -/** - * Builds an error object. - * - * @param {(Error|RangeError)} ErrorCtor The error constructor - * @param {String} message The error message - * @param {Boolean} prefix Specifies whether or not to add a default prefix to - * `message` - * @param {Number} statusCode The status code - * @return {(Error|RangeError)} The error - * @private - */ -function error (ErrorCtor, message, prefix, statusCode) { - const err = new ErrorCtor( - prefix ? `Invalid WebSocket frame: ${message}` : message - ); - - Error.captureStackTrace(err, error); - err[constants.kStatusCode] = statusCode; - return err; -} - -/** - * Makes a buffer from a list of fragments. - * - * @param {Buffer[]} fragments The list of fragments composing the message - * @param {Number} messageLength The length of the message - * @return {Buffer} - * @private - */ -function toBuffer (fragments, messageLength) { - if (fragments.length === 1) return fragments[0]; - if (fragments.length > 1) return bufferUtil.concat(fragments, messageLength); - return constants.EMPTY_BUFFER; -} - -/** - * Converts a buffer to an `ArrayBuffer`. - * - * @param {Buffer} The buffer to convert - * @return {ArrayBuffer} Converted buffer - */ -function toArrayBuffer (buf) { - if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { - return buf.buffer; - } - - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); -} diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/sender.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/sender.js deleted file mode 100644 index 060e5539..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/sender.js +++ /dev/null @@ -1,401 +0,0 @@ -'use strict'; - -const crypto = require('crypto'); - -const PerMessageDeflate = require('./permessage-deflate'); -const bufferUtil = require('./buffer-util'); -const validation = require('./validation'); -const constants = require('./constants'); - -/** - * HyBi Sender implementation. - */ -class Sender { - /** - * Creates a Sender instance. - * - * @param {net.Socket} socket The connection socket - * @param {Object} extensions An object containing the negotiated extensions - */ - constructor (socket, extensions) { - this._extensions = extensions || {}; - this._socket = socket; - - this._firstFragment = true; - this._compress = false; - - this._bufferedBytes = 0; - this._deflating = false; - this._queue = []; - } - - /** - * Frames a piece of data according to the HyBi WebSocket protocol. - * - * @param {Buffer} data The data to frame - * @param {Object} options Options object - * @param {Number} options.opcode The opcode - * @param {Boolean} options.readOnly Specifies whether `data` can be modified - * @param {Boolean} options.fin Specifies whether or not to set the FIN bit - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit - * @return {Buffer[]} The framed data as a list of `Buffer` instances - * @public - */ - static frame (data, options) { - const merge = data.length < 1024 || (options.mask && options.readOnly); - var offset = options.mask ? 6 : 2; - var payloadLength = data.length; - - if (data.length >= 65536) { - offset += 8; - payloadLength = 127; - } else if (data.length > 125) { - offset += 2; - payloadLength = 126; - } - - const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); - - target[0] = options.fin ? options.opcode | 0x80 : options.opcode; - if (options.rsv1) target[0] |= 0x40; - - if (payloadLength === 126) { - target.writeUInt16BE(data.length, 2); - } else if (payloadLength === 127) { - target.writeUInt32BE(0, 2); - target.writeUInt32BE(data.length, 6); - } - - if (!options.mask) { - target[1] = payloadLength; - if (merge) { - data.copy(target, offset); - return [target]; - } - - return [target, data]; - } - - const mask = crypto.randomBytes(4); - - target[1] = payloadLength | 0x80; - target[offset - 4] = mask[0]; - target[offset - 3] = mask[1]; - target[offset - 2] = mask[2]; - target[offset - 1] = mask[3]; - - if (merge) { - bufferUtil.mask(data, mask, target, offset, data.length); - return [target]; - } - - bufferUtil.mask(data, mask, data, 0, data.length); - return [target, data]; - } - - /** - * Sends a close message to the other peer. - * - * @param {(Number|undefined)} code The status code component of the body - * @param {String} data The message component of the body - * @param {Boolean} mask Specifies whether or not to mask the message - * @param {Function} cb Callback - * @public - */ - close (code, data, mask, cb) { - var buf; - - if (code === undefined) { - buf = constants.EMPTY_BUFFER; - } else if (typeof code !== 'number' || !validation.isValidStatusCode(code)) { - throw new TypeError('First argument must be a valid error code number'); - } else if (data === undefined || data === '') { - buf = Buffer.allocUnsafe(2); - buf.writeUInt16BE(code, 0); - } else { - buf = Buffer.allocUnsafe(2 + Buffer.byteLength(data)); - buf.writeUInt16BE(code, 0); - buf.write(data, 2); - } - - if (this._deflating) { - this.enqueue([this.doClose, buf, mask, cb]); - } else { - this.doClose(buf, mask, cb); - } - } - - /** - * Frames and sends a close message. - * - * @param {Buffer} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @private - */ - doClose (data, mask, cb) { - this.sendFrame(Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x08, - mask, - readOnly: false - }), cb); - } - - /** - * Sends a ping message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - ping (data, mask, cb) { - var readOnly = true; - - if (!Buffer.isBuffer(data)) { - if (data instanceof ArrayBuffer) { - data = Buffer.from(data); - } else if (ArrayBuffer.isView(data)) { - data = viewToBuffer(data); - } else { - data = Buffer.from(data); - readOnly = false; - } - } - - if (this._deflating) { - this.enqueue([this.doPing, data, mask, readOnly, cb]); - } else { - this.doPing(data, mask, readOnly, cb); - } - } - - /** - * Frames and sends a ping message. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Boolean} readOnly Specifies whether `data` can be modified - * @param {Function} cb Callback - * @private - */ - doPing (data, mask, readOnly, cb) { - this.sendFrame(Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x09, - mask, - readOnly - }), cb); - } - - /** - * Sends a pong message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - pong (data, mask, cb) { - var readOnly = true; - - if (!Buffer.isBuffer(data)) { - if (data instanceof ArrayBuffer) { - data = Buffer.from(data); - } else if (ArrayBuffer.isView(data)) { - data = viewToBuffer(data); - } else { - data = Buffer.from(data); - readOnly = false; - } - } - - if (this._deflating) { - this.enqueue([this.doPong, data, mask, readOnly, cb]); - } else { - this.doPong(data, mask, readOnly, cb); - } - } - - /** - * Frames and sends a pong message. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Boolean} readOnly Specifies whether `data` can be modified - * @param {Function} cb Callback - * @private - */ - doPong (data, mask, readOnly, cb) { - this.sendFrame(Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x0a, - mask, - readOnly - }), cb); - } - - /** - * Sends a data message to the other peer. - * - * @param {*} data The message to send - * @param {Object} options Options object - * @param {Boolean} options.compress Specifies whether or not to compress `data` - * @param {Boolean} options.binary Specifies whether `data` is binary or text - * @param {Boolean} options.fin Specifies whether the fragment is the last one - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - send (data, options, cb) { - var opcode = options.binary ? 2 : 1; - var rsv1 = options.compress; - var readOnly = true; - - if (!Buffer.isBuffer(data)) { - if (data instanceof ArrayBuffer) { - data = Buffer.from(data); - } else if (ArrayBuffer.isView(data)) { - data = viewToBuffer(data); - } else { - data = Buffer.from(data); - readOnly = false; - } - } - - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - if (this._firstFragment) { - this._firstFragment = false; - if (rsv1 && perMessageDeflate) { - rsv1 = data.length >= perMessageDeflate._threshold; - } - this._compress = rsv1; - } else { - rsv1 = false; - opcode = 0; - } - - if (options.fin) this._firstFragment = true; - - if (perMessageDeflate) { - const opts = { - fin: options.fin, - rsv1, - opcode, - mask: options.mask, - readOnly - }; - - if (this._deflating) { - this.enqueue([this.dispatch, data, this._compress, opts, cb]); - } else { - this.dispatch(data, this._compress, opts, cb); - } - } else { - this.sendFrame(Sender.frame(data, { - fin: options.fin, - rsv1: false, - opcode, - mask: options.mask, - readOnly - }), cb); - } - } - - /** - * Dispatches a data message. - * - * @param {Buffer} data The message to send - * @param {Boolean} compress Specifies whether or not to compress `data` - * @param {Object} options Options object - * @param {Number} options.opcode The opcode - * @param {Boolean} options.readOnly Specifies whether `data` can be modified - * @param {Boolean} options.fin Specifies whether or not to set the FIN bit - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit - * @param {Function} cb Callback - * @private - */ - dispatch (data, compress, options, cb) { - if (!compress) { - this.sendFrame(Sender.frame(data, options), cb); - return; - } - - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - this._deflating = true; - perMessageDeflate.compress(data, options.fin, (_, buf) => { - options.readOnly = false; - this.sendFrame(Sender.frame(buf, options), cb); - this._deflating = false; - this.dequeue(); - }); - } - - /** - * Executes queued send operations. - * - * @private - */ - dequeue () { - while (!this._deflating && this._queue.length) { - const params = this._queue.shift(); - - this._bufferedBytes -= params[1].length; - params[0].apply(this, params.slice(1)); - } - } - - /** - * Enqueues a send operation. - * - * @param {Array} params Send operation parameters. - * @private - */ - enqueue (params) { - this._bufferedBytes += params[1].length; - this._queue.push(params); - } - - /** - * Sends a frame. - * - * @param {Buffer[]} list The frame to send - * @param {Function} cb Callback - * @private - */ - sendFrame (list, cb) { - if (list.length === 2) { - this._socket.write(list[0]); - this._socket.write(list[1], cb); - } else { - this._socket.write(list[0], cb); - } - } -} - -module.exports = Sender; - -/** - * Converts an `ArrayBuffer` view into a buffer. - * - * @param {(DataView|TypedArray)} view The view to convert - * @return {Buffer} Converted view - * @private - */ -function viewToBuffer (view) { - const buf = Buffer.from(view.buffer); - - if (view.byteLength !== view.buffer.byteLength) { - return buf.slice(view.byteOffset, view.byteOffset + view.byteLength); - } - - return buf; -} diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/validation.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/validation.js deleted file mode 100644 index 06269fcf..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/validation.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -try { - const isValidUTF8 = require('utf-8-validate'); - - exports.isValidUTF8 = typeof isValidUTF8 === 'object' - ? isValidUTF8.Validation.isValidUTF8 // utf-8-validate@<3.0.0 - : isValidUTF8; -} catch (e) /* istanbul ignore next */ { - exports.isValidUTF8 = () => true; -} - -/** - * Checks if a status code is allowed in a close frame. - * - * @param {Number} code The status code - * @return {Boolean} `true` if the status code is valid, else `false` - * @public - */ -exports.isValidStatusCode = (code) => { - return ( - (code >= 1000 && - code <= 1013 && - code !== 1004 && - code !== 1005 && - code !== 1006) || - (code >= 3000 && code <= 4999) - ); -}; diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket-server.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket-server.js deleted file mode 100644 index 70513edf..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket-server.js +++ /dev/null @@ -1,357 +0,0 @@ -'use strict'; - -const EventEmitter = require('events'); -const crypto = require('crypto'); -const http = require('http'); -const url = require('url'); - -const PerMessageDeflate = require('./permessage-deflate'); -const extension = require('./extension'); -const constants = require('./constants'); -const WebSocket = require('./websocket'); - -/** - * Class representing a WebSocket server. - * - * @extends EventEmitter - */ -class WebSocketServer extends EventEmitter { - /** - * Create a `WebSocketServer` instance. - * - * @param {Object} options Configuration options - * @param {String} options.host The hostname where to bind the server - * @param {Number} options.port The port where to bind the server - * @param {http.Server} options.server A pre-created HTTP/S server to use - * @param {Function} options.verifyClient An hook to reject connections - * @param {Function} options.handleProtocols An hook to handle protocols - * @param {String} options.path Accept only connections matching this path - * @param {Boolean} options.noServer Enable no server mode - * @param {Boolean} options.clientTracking Specifies whether or not to track clients - * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate - * @param {Number} options.maxPayload The maximum allowed message size - * @param {Function} callback A listener for the `listening` event - */ - constructor (options, callback) { - super(); - - options = Object.assign({ - maxPayload: 100 * 1024 * 1024, - perMessageDeflate: false, - handleProtocols: null, - clientTracking: true, - verifyClient: null, - noServer: false, - backlog: null, // use default (511 as implemented in net.js) - server: null, - host: null, - path: null, - port: null - }, options); - - if (options.port == null && !options.server && !options.noServer) { - throw new TypeError( - 'One of the "port", "server", or "noServer" options must be specified' - ); - } - - if (options.port != null) { - this._server = http.createServer((req, res) => { - const body = http.STATUS_CODES[426]; - - res.writeHead(426, { - 'Content-Length': body.length, - 'Content-Type': 'text/plain' - }); - res.end(body); - }); - this._server.listen(options.port, options.host, options.backlog, callback); - } else if (options.server) { - this._server = options.server; - } - - if (this._server) { - this._removeListeners = addListeners(this._server, { - listening: this.emit.bind(this, 'listening'), - error: this.emit.bind(this, 'error'), - upgrade: (req, socket, head) => { - this.handleUpgrade(req, socket, head, (ws) => { - this.emit('connection', ws, req); - }); - } - }); - } - - if (options.perMessageDeflate === true) options.perMessageDeflate = {}; - if (options.clientTracking) this.clients = new Set(); - this.options = options; - } - - /** - * Returns the bound address, the address family name, and port of the server - * as reported by the operating system if listening on an IP socket. - * If the server is listening on a pipe or UNIX domain socket, the name is - * returned as a string. - * - * @return {(Object|String|null)} The address of the server - * @public - */ - address () { - if (this.options.noServer) { - throw new Error('The server is operating in "noServer" mode'); - } - - if (!this._server) return null; - return this._server.address(); - } - - /** - * Close the server. - * - * @param {Function} cb Callback - * @public - */ - close (cb) { - // - // Terminate all associated clients. - // - if (this.clients) { - for (const client of this.clients) client.terminate(); - } - - const server = this._server; - - if (server) { - this._removeListeners(); - this._removeListeners = this._server = null; - - // - // Close the http server if it was internally created. - // - if (this.options.port != null) return server.close(cb); - } - - if (cb) cb(); - } - - /** - * See if a given request should be handled by this server instance. - * - * @param {http.IncomingMessage} req Request object to inspect - * @return {Boolean} `true` if the request is valid, else `false` - * @public - */ - shouldHandle (req) { - if (this.options.path && url.parse(req.url).pathname !== this.options.path) { - return false; - } - - return true; - } - - /** - * Handle a HTTP Upgrade request. - * - * @param {http.IncomingMessage} req The request object - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @public - */ - handleUpgrade (req, socket, head, cb) { - socket.on('error', socketOnError); - - const version = +req.headers['sec-websocket-version']; - const extensions = {}; - - if ( - req.method !== 'GET' || req.headers.upgrade.toLowerCase() !== 'websocket' || - !req.headers['sec-websocket-key'] || (version !== 8 && version !== 13) || - !this.shouldHandle(req) - ) { - return abortHandshake(socket, 400); - } - - if (this.options.perMessageDeflate) { - const perMessageDeflate = new PerMessageDeflate( - this.options.perMessageDeflate, - true, - this.options.maxPayload - ); - - try { - const offers = extension.parse( - req.headers['sec-websocket-extensions'] - ); - - if (offers[PerMessageDeflate.extensionName]) { - perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); - extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - } catch (err) { - return abortHandshake(socket, 400); - } - } - - // - // Optionally call external client verification handler. - // - if (this.options.verifyClient) { - const info = { - origin: req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], - secure: !!(req.connection.authorized || req.connection.encrypted), - req - }; - - if (this.options.verifyClient.length === 2) { - this.options.verifyClient(info, (verified, code, message, headers) => { - if (!verified) { - return abortHandshake(socket, code || 401, message, headers); - } - - this.completeUpgrade(extensions, req, socket, head, cb); - }); - return; - } - - if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); - } - - this.completeUpgrade(extensions, req, socket, head, cb); - } - - /** - * Upgrade the connection to WebSocket. - * - * @param {Object} extensions The accepted extensions - * @param {http.IncomingMessage} req The request object - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @private - */ - completeUpgrade (extensions, req, socket, head, cb) { - // - // Destroy the socket if the client has already sent a FIN packet. - // - if (!socket.readable || !socket.writable) return socket.destroy(); - - const key = crypto.createHash('sha1') - .update(req.headers['sec-websocket-key'] + constants.GUID, 'binary') - .digest('base64'); - - const headers = [ - 'HTTP/1.1 101 Switching Protocols', - 'Upgrade: websocket', - 'Connection: Upgrade', - `Sec-WebSocket-Accept: ${key}` - ]; - - const ws = new WebSocket(null); - var protocol = req.headers['sec-websocket-protocol']; - - if (protocol) { - protocol = protocol.trim().split(/ *, */); - - // - // Optionally call external protocol selection handler. - // - if (this.options.handleProtocols) { - protocol = this.options.handleProtocols(protocol, req); - } else { - protocol = protocol[0]; - } - - if (protocol) { - headers.push(`Sec-WebSocket-Protocol: ${protocol}`); - ws.protocol = protocol; - } - } - - if (extensions[PerMessageDeflate.extensionName]) { - const params = extensions[PerMessageDeflate.extensionName].params; - const value = extension.format({ - [PerMessageDeflate.extensionName]: [params] - }); - headers.push(`Sec-WebSocket-Extensions: ${value}`); - ws._extensions = extensions; - } - - // - // Allow external modification/inspection of handshake headers. - // - this.emit('headers', headers, req); - - socket.write(headers.concat('\r\n').join('\r\n')); - socket.removeListener('error', socketOnError); - - ws.setSocket(socket, head, this.options.maxPayload); - - if (this.clients) { - this.clients.add(ws); - ws.on('close', () => this.clients.delete(ws)); - } - - cb(ws); - } -} - -module.exports = WebSocketServer; - -/** - * Add event listeners on an `EventEmitter` using a map of - * pairs. - * - * @param {EventEmitter} server The event emitter - * @param {Object.} map The listeners to add - * @return {Function} A function that will remove the added listeners when called - * @private - */ -function addListeners (server, map) { - for (const event of Object.keys(map)) server.on(event, map[event]); - - return function removeListeners () { - for (const event of Object.keys(map)) { - server.removeListener(event, map[event]); - } - }; -} - -/** - * Handle premature socket errors. - * - * @private - */ -function socketOnError () { - this.destroy(); -} - -/** - * Close the connection when preconditions are not fulfilled. - * - * @param {net.Socket} socket The socket of the upgrade request - * @param {Number} code The HTTP response status code - * @param {String} [message] The HTTP response body - * @param {Object} [headers] Additional HTTP response headers - * @private - */ -function abortHandshake (socket, code, message, headers) { - if (socket.writable) { - message = message || http.STATUS_CODES[code]; - headers = Object.assign({ - 'Connection': 'close', - 'Content-type': 'text/html', - 'Content-Length': Buffer.byteLength(message) - }, headers); - - socket.write( - `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + - Object.keys(headers).map(h => `${h}: ${headers[h]}`).join('\r\n') + - '\r\n\r\n' + - message - ); - } - - socket.removeListener('error', socketOnError); - socket.destroy(); -} diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket.js b/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket.js deleted file mode 100644 index f2bdf0d7..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket.js +++ /dev/null @@ -1,828 +0,0 @@ -'use strict'; - -const EventEmitter = require('events'); -const crypto = require('crypto'); -const https = require('https'); -const http = require('http'); -const net = require('net'); -const tls = require('tls'); -const url = require('url'); - -const PerMessageDeflate = require('./permessage-deflate'); -const EventTarget = require('./event-target'); -const extension = require('./extension'); -const constants = require('./constants'); -const Receiver = require('./receiver'); -const Sender = require('./sender'); - -const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; -const kWebSocket = constants.kWebSocket; -const protocolVersions = [8, 13]; -const closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly. - -/** - * Class representing a WebSocket. - * - * @extends EventEmitter - */ -class WebSocket extends EventEmitter { - /** - * Create a new `WebSocket`. - * - * @param {(String|url.Url|url.URL)} address The URL to which to connect - * @param {(String|String[])} protocols The subprotocols - * @param {Object} options Connection options - */ - constructor (address, protocols, options) { - super(); - - this.readyState = WebSocket.CONNECTING; - this.protocol = ''; - - this._binaryType = constants.BINARY_TYPES[0]; - this._closeFrameReceived = false; - this._closeFrameSent = false; - this._closeMessage = ''; - this._closeTimer = null; - this._closeCode = 1006; - this._extensions = {}; - this._isServer = true; - this._receiver = null; - this._sender = null; - this._socket = null; - - if (address !== null) { - if (Array.isArray(protocols)) { - protocols = protocols.join(', '); - } else if (typeof protocols === 'object' && protocols !== null) { - options = protocols; - protocols = undefined; - } - - initAsClient.call(this, address, protocols, options); - } - } - - get CONNECTING () { return WebSocket.CONNECTING; } - get CLOSING () { return WebSocket.CLOSING; } - get CLOSED () { return WebSocket.CLOSED; } - get OPEN () { return WebSocket.OPEN; } - - /** - * This deviates from the WHATWG interface since ws doesn't support the required - * default "blob" type (instead we define a custom "nodebuffer" type). - * - * @type {String} - */ - get binaryType () { - return this._binaryType; - } - - set binaryType (type) { - if (constants.BINARY_TYPES.indexOf(type) < 0) return; - - this._binaryType = type; - - // - // Allow to change `binaryType` on the fly. - // - if (this._receiver) this._receiver._binaryType = type; - } - - /** - * @type {Number} - */ - get bufferedAmount () { - if (!this._socket) return 0; - - // - // `socket.bufferSize` is `undefined` if the socket is closed. - // - return (this._socket.bufferSize || 0) + this._sender._bufferedBytes; - } - - /** - * @type {String} - */ - get extensions () { - return Object.keys(this._extensions).join(); - } - - /** - * Set up the socket and the internal resources. - * - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Number} maxPayload The maximum allowed message size - * @private - */ - setSocket (socket, head, maxPayload) { - const receiver = new Receiver( - this._binaryType, - this._extensions, - maxPayload - ); - - this._sender = new Sender(socket, this._extensions); - this._receiver = receiver; - this._socket = socket; - - receiver[kWebSocket] = this; - socket[kWebSocket] = this; - - receiver.on('conclude', receiverOnConclude); - receiver.on('drain', receiverOnDrain); - receiver.on('error', receiverOnError); - receiver.on('message', receiverOnMessage); - receiver.on('ping', receiverOnPing); - receiver.on('pong', receiverOnPong); - - socket.setTimeout(0); - socket.setNoDelay(); - - if (head.length > 0) socket.unshift(head); - - socket.on('close', socketOnClose); - socket.on('data', socketOnData); - socket.on('end', socketOnEnd); - socket.on('error', socketOnError); - - this.readyState = WebSocket.OPEN; - this.emit('open'); - } - - /** - * Emit the `'close'` event. - * - * @private - */ - emitClose () { - this.readyState = WebSocket.CLOSED; - - if (!this._socket) { - this.emit('close', this._closeCode, this._closeMessage); - return; - } - - if (this._extensions[PerMessageDeflate.extensionName]) { - this._extensions[PerMessageDeflate.extensionName].cleanup(); - } - - this._receiver.removeAllListeners(); - this.emit('close', this._closeCode, this._closeMessage); - } - - /** - * Start a closing handshake. - * - * +----------+ +-----------+ +----------+ - * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - - * | +----------+ +-----------+ +----------+ | - * +----------+ +-----------+ | - * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING - * +----------+ +-----------+ | - * | | | +---+ | - * +------------------------+-->|fin| - - - - - * | +---+ | +---+ - * - - - - -|fin|<---------------------+ - * +---+ - * - * @param {Number} code Status code explaining why the connection is closing - * @param {String} data A string explaining why the connection is closing - * @public - */ - close (code, data) { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - return abortHandshake(this, this._req, msg); - } - - if (this.readyState === WebSocket.CLOSING) { - if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); - return; - } - - this.readyState = WebSocket.CLOSING; - this._sender.close(code, data, !this._isServer, (err) => { - // - // This error is handled by the `'error'` listener on the socket. We only - // want to know if the close frame has been sent here. - // - if (err) return; - - this._closeFrameSent = true; - - if (this._socket.writable) { - if (this._closeFrameReceived) this._socket.end(); - - // - // Ensure that the connection is closed even if the closing handshake - // fails. - // - this._closeTimer = setTimeout( - this._socket.destroy.bind(this._socket), - closeTimeout - ); - } - }); - } - - /** - * Send a ping. - * - * @param {*} data The data to send - * @param {Boolean} mask Indicates whether or not to mask `data` - * @param {Function} cb Callback which is executed when the ping is sent - * @public - */ - ping (data, mask, cb) { - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - if (mask === undefined) mask = !this._isServer; - this._sender.ping(data || constants.EMPTY_BUFFER, mask, cb); - } - - /** - * Send a pong. - * - * @param {*} data The data to send - * @param {Boolean} mask Indicates whether or not to mask `data` - * @param {Function} cb Callback which is executed when the pong is sent - * @public - */ - pong (data, mask, cb) { - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - if (mask === undefined) mask = !this._isServer; - this._sender.pong(data || constants.EMPTY_BUFFER, mask, cb); - } - - /** - * Send a data message. - * - * @param {*} data The message to send - * @param {Object} options Options object - * @param {Boolean} options.compress Specifies whether or not to compress `data` - * @param {Boolean} options.binary Specifies whether `data` is binary or text - * @param {Boolean} options.fin Specifies whether the fragment is the last one - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Function} cb Callback which is executed when data is written out - * @public - */ - send (data, options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - - const opts = Object.assign({ - binary: typeof data !== 'string', - mask: !this._isServer, - compress: true, - fin: true - }, options); - - if (!this._extensions[PerMessageDeflate.extensionName]) { - opts.compress = false; - } - - this._sender.send(data || constants.EMPTY_BUFFER, opts, cb); - } - - /** - * Forcibly close the connection. - * - * @public - */ - terminate () { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - return abortHandshake(this, this._req, msg); - } - - if (this._socket) { - this.readyState = WebSocket.CLOSING; - this._socket.destroy(); - } - } -} - -readyStates.forEach((readyState, i) => { - WebSocket[readyStates[i]] = i; -}); - -// -// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. -// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface -// -['open', 'error', 'close', 'message'].forEach((method) => { - Object.defineProperty(WebSocket.prototype, `on${method}`, { - /** - * Return the listener of the event. - * - * @return {(Function|undefined)} The event listener or `undefined` - * @public - */ - get () { - const listeners = this.listeners(method); - for (var i = 0; i < listeners.length; i++) { - if (listeners[i]._listener) return listeners[i]._listener; - } - }, - /** - * Add a listener for the event. - * - * @param {Function} listener The listener to add - * @public - */ - set (listener) { - const listeners = this.listeners(method); - for (var i = 0; i < listeners.length; i++) { - // - // Remove only the listeners added via `addEventListener`. - // - if (listeners[i]._listener) this.removeListener(method, listeners[i]); - } - this.addEventListener(method, listener); - } - }); -}); - -WebSocket.prototype.addEventListener = EventTarget.addEventListener; -WebSocket.prototype.removeEventListener = EventTarget.removeEventListener; - -module.exports = WebSocket; - -/** - * Initialize a WebSocket client. - * - * @param {(String|url.Url|url.URL)} address The URL to which to connect - * @param {String} protocols The subprotocols - * @param {Object} options Connection options - * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate - * @param {Number} options.handshakeTimeout Timeout in milliseconds for the handshake request - * @param {Number} options.protocolVersion Value of the `Sec-WebSocket-Version` header - * @param {String} options.origin Value of the `Origin` or `Sec-WebSocket-Origin` header - * @private - */ -function initAsClient (address, protocols, options) { - options = Object.assign({ - protocolVersion: protocolVersions[1], - perMessageDeflate: true - }, options, { - createConnection: undefined, - socketPath: undefined, - hostname: undefined, - protocol: undefined, - timeout: undefined, - method: undefined, - auth: undefined, - host: undefined, - path: undefined, - port: undefined - }); - - if (protocolVersions.indexOf(options.protocolVersion) === -1) { - throw new RangeError( - `Unsupported protocol version: ${options.protocolVersion} ` + - `(supported versions: ${protocolVersions.join(', ')})` - ); - } - - this._isServer = false; - - var parsedUrl; - - if (typeof address === 'object' && address.href !== undefined) { - parsedUrl = address; - this.url = address.href; - } else { - parsedUrl = url.parse(address); - this.url = address; - } - - const isUnixSocket = parsedUrl.protocol === 'ws+unix:'; - - if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { - throw new Error(`Invalid URL: ${this.url}`); - } - - const isSecure = parsedUrl.protocol === 'wss:' || parsedUrl.protocol === 'https:'; - const key = crypto.randomBytes(16).toString('base64'); - const httpObj = isSecure ? https : http; - const path = parsedUrl.search - ? `${parsedUrl.pathname || '/'}${parsedUrl.search}` - : parsedUrl.pathname || '/'; - var perMessageDeflate; - - options.createConnection = isSecure ? tlsConnect : netConnect; - options.port = parsedUrl.port || (isSecure ? 443 : 80); - options.host = parsedUrl.hostname.startsWith('[') - ? parsedUrl.hostname.slice(1, -1) - : parsedUrl.hostname; - options.headers = Object.assign({ - 'Sec-WebSocket-Version': options.protocolVersion, - 'Sec-WebSocket-Key': key, - 'Connection': 'Upgrade', - 'Upgrade': 'websocket' - }, options.headers); - options.path = path; - - if (options.perMessageDeflate) { - perMessageDeflate = new PerMessageDeflate( - options.perMessageDeflate !== true ? options.perMessageDeflate : {}, - false - ); - options.headers['Sec-WebSocket-Extensions'] = extension.format({ - [PerMessageDeflate.extensionName]: perMessageDeflate.offer() - }); - } - if (protocols) { - options.headers['Sec-WebSocket-Protocol'] = protocols; - } - if (options.origin) { - if (options.protocolVersion < 13) { - options.headers['Sec-WebSocket-Origin'] = options.origin; - } else { - options.headers.Origin = options.origin; - } - } - if (parsedUrl.auth) { - options.auth = parsedUrl.auth; - } else if (parsedUrl.username || parsedUrl.password) { - options.auth = `${parsedUrl.username}:${parsedUrl.password}`; - } - - if (isUnixSocket) { - const parts = path.split(':'); - - if (options.agent == null && process.versions.modules < 57) { - // - // Setting `socketPath` in conjunction with `createConnection` without an - // agent throws an error on Node.js < 8. Work around the issue by using a - // different property. - // - options._socketPath = parts[0]; - } else { - options.socketPath = parts[0]; - } - - options.path = parts[1]; - } - - var req = this._req = httpObj.get(options); - - if (options.handshakeTimeout) { - req.setTimeout( - options.handshakeTimeout, - () => abortHandshake(this, req, 'Opening handshake has timed out') - ); - } - - req.on('error', (err) => { - if (this._req.aborted) return; - - req = this._req = null; - this.readyState = WebSocket.CLOSING; - this.emit('error', err); - this.emitClose(); - }); - - req.on('response', (res) => { - if (this.emit('unexpected-response', req, res)) return; - - abortHandshake(this, req, `Unexpected server response: ${res.statusCode}`); - }); - - req.on('upgrade', (res, socket, head) => { - this.emit('upgrade', res); - - // - // The user may have closed the connection from a listener of the `upgrade` - // event. - // - if (this.readyState !== WebSocket.CONNECTING) return; - - req = this._req = null; - - const digest = crypto.createHash('sha1') - .update(key + constants.GUID, 'binary') - .digest('base64'); - - if (res.headers['sec-websocket-accept'] !== digest) { - abortHandshake(this, socket, 'Invalid Sec-WebSocket-Accept header'); - return; - } - - const serverProt = res.headers['sec-websocket-protocol']; - const protList = (protocols || '').split(/, */); - var protError; - - if (!protocols && serverProt) { - protError = 'Server sent a subprotocol but none was requested'; - } else if (protocols && !serverProt) { - protError = 'Server sent no subprotocol'; - } else if (serverProt && protList.indexOf(serverProt) === -1) { - protError = 'Server sent an invalid subprotocol'; - } - - if (protError) { - abortHandshake(this, socket, protError); - return; - } - - if (serverProt) this.protocol = serverProt; - - if (perMessageDeflate) { - try { - const extensions = extension.parse( - res.headers['sec-websocket-extensions'] - ); - - if (extensions[PerMessageDeflate.extensionName]) { - perMessageDeflate.accept( - extensions[PerMessageDeflate.extensionName] - ); - this._extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - } catch (err) { - abortHandshake(this, socket, 'Invalid Sec-WebSocket-Extensions header'); - return; - } - } - - this.setSocket(socket, head, 0); - }); -} - -/** - * Create a `net.Socket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {net.Socket} The newly created socket used to start the connection - * @private - */ -function netConnect (options) { - options.path = options.socketPath || options._socketPath || undefined; - return net.connect(options); -} - -/** - * Create a `tls.TLSSocket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {tls.TLSSocket} The newly created socket used to start the connection - * @private - */ -function tlsConnect (options) { - options.path = options.socketPath || options._socketPath || undefined; - options.servername = options.servername || options.host; - return tls.connect(options); -} - -/** - * Abort the handshake and emit an error. - * - * @param {WebSocket} websocket The WebSocket instance - * @param {(http.ClientRequest|net.Socket)} stream The request to abort or the - * socket to destroy - * @param {String} message The error message - * @private - */ -function abortHandshake (websocket, stream, message) { - websocket.readyState = WebSocket.CLOSING; - - const err = new Error(message); - Error.captureStackTrace(err, abortHandshake); - - if (stream.setHeader) { - stream.abort(); - stream.once('abort', websocket.emitClose.bind(websocket)); - websocket.emit('error', err); - } else { - stream.destroy(err); - stream.once('error', websocket.emit.bind(websocket, 'error')); - stream.once('close', websocket.emitClose.bind(websocket)); - } -} - -/** - * The listener of the `Receiver` `'conclude'` event. - * - * @param {Number} code The status code - * @param {String} reason The reason for closing - * @private - */ -function receiverOnConclude (code, reason) { - const websocket = this[kWebSocket]; - - websocket._socket.removeListener('data', socketOnData); - websocket._socket.resume(); - - websocket._closeFrameReceived = true; - websocket._closeMessage = reason; - websocket._closeCode = code; - - if (code === 1005) websocket.close(); - else websocket.close(code, reason); -} - -/** - * The listener of the `Receiver` `'drain'` event. - * - * @private - */ -function receiverOnDrain () { - this[kWebSocket]._socket.resume(); -} - -/** - * The listener of the `Receiver` `'error'` event. - * - * @param {(RangeError|Error)} err The emitted error - * @private - */ -function receiverOnError (err) { - const websocket = this[kWebSocket]; - - websocket._socket.removeListener('data', socketOnData); - - websocket.readyState = WebSocket.CLOSING; - websocket._closeCode = err[constants.kStatusCode]; - websocket.emit('error', err); - websocket._socket.destroy(); -} - -/** - * The listener of the `Receiver` `'finish'` event. - * - * @private - */ -function receiverOnFinish () { - this[kWebSocket].emitClose(); -} - -/** - * The listener of the `Receiver` `'message'` event. - * - * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The message - * @private - */ -function receiverOnMessage (data) { - this[kWebSocket].emit('message', data); -} - -/** - * The listener of the `Receiver` `'ping'` event. - * - * @param {Buffer} data The data included in the ping frame - * @private - */ -function receiverOnPing (data) { - const websocket = this[kWebSocket]; - - websocket.pong(data, !websocket._isServer, constants.NOOP); - websocket.emit('ping', data); -} - -/** - * The listener of the `Receiver` `'pong'` event. - * - * @param {Buffer} data The data included in the pong frame - * @private - */ -function receiverOnPong (data) { - this[kWebSocket].emit('pong', data); -} - -/** - * The listener of the `net.Socket` `'close'` event. - * - * @private - */ -function socketOnClose () { - const websocket = this[kWebSocket]; - - this.removeListener('close', socketOnClose); - this.removeListener('end', socketOnEnd); - - websocket.readyState = WebSocket.CLOSING; - - // - // The close frame might not have been received or the `'end'` event emitted, - // for example, if the socket was destroyed due to an error. Ensure that the - // `receiver` stream is closed after writing any remaining buffered data to - // it. If the readable side of the socket is in flowing mode then there is no - // buffered data as everything has been already written and `readable.read()` - // will return `null`. If instead, the socket is paused, any possible buffered - // data will be read as a single chunk and emitted synchronously in a single - // `'data'` event. - // - websocket._socket.read(); - websocket._receiver.end(); - - this.removeListener('data', socketOnData); - this[kWebSocket] = undefined; - - clearTimeout(websocket._closeTimer); - - if ( - websocket._receiver._writableState.finished || - websocket._receiver._writableState.errorEmitted - ) { - websocket.emitClose(); - } else { - websocket._receiver.on('error', receiverOnFinish); - websocket._receiver.on('finish', receiverOnFinish); - } -} - -/** - * The listener of the `net.Socket` `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function socketOnData (chunk) { - if (!this[kWebSocket]._receiver.write(chunk)) { - this.pause(); - } -} - -/** - * The listener of the `net.Socket` `'end'` event. - * - * @private - */ -function socketOnEnd () { - const websocket = this[kWebSocket]; - - websocket.readyState = WebSocket.CLOSING; - websocket._receiver.end(); - this.end(); -} - -/** - * The listener of the `net.Socket` `'error'` event. - * - * @private - */ -function socketOnError () { - const websocket = this[kWebSocket]; - - this.removeListener('error', socketOnError); - this.on('error', constants.NOOP); - - if (websocket) { - websocket.readyState = WebSocket.CLOSING; - this.destroy(); - } -} diff --git a/node_modules/subscriptions-transport-ws/node_modules/ws/package.json b/node_modules/subscriptions-transport-ws/node_modules/ws/package.json deleted file mode 100644 index caaf7da0..00000000 --- a/node_modules/subscriptions-transport-ws/node_modules/ws/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "_args": [ - [ - "ws@5.2.2", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "ws@5.2.2", - "_id": "ws@5.2.2", - "_inBundle": false, - "_integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", - "_location": "/subscriptions-transport-ws/ws", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "ws@5.2.2", - "name": "ws", - "escapedName": "ws", - "rawSpec": "5.2.2", - "saveSpec": null, - "fetchSpec": "5.2.2" - }, - "_requiredBy": [ - "/subscriptions-transport-ws" - ], - "_resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "_spec": "5.2.2", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "bugs": { - "url": "https://github.com/websockets/ws/issues" - }, - "dependencies": { - "async-limiter": "~1.0.0" - }, - "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", - "devDependencies": { - "benchmark": "~2.1.2", - "bufferutil": "~3.0.0", - "eslint": "~4.19.0", - "eslint-config-standard": "~11.0.0", - "eslint-plugin-import": "~2.12.0", - "eslint-plugin-node": "~6.0.0", - "eslint-plugin-promise": "~3.8.0", - "eslint-plugin-standard": "~3.0.0", - "mocha": "~5.2.0", - "nyc": "~12.0.2", - "utf-8-validate": "~4.0.0" - }, - "files": [ - "index.js", - "lib" - ], - "homepage": "https://github.com/websockets/ws", - "keywords": [ - "HyBi", - "Push", - "RFC-6455", - "WebSocket", - "WebSockets", - "real-time" - ], - "license": "MIT", - "main": "index.js", - "name": "ws", - "repository": { - "type": "git", - "url": "git+https://github.com/websockets/ws.git" - }, - "scripts": { - "integration": "eslint . && mocha test/*.integration.js", - "lint": "eslint .", - "test": "eslint . && nyc --reporter=html --reporter=text mocha test/*.test.js" - }, - "version": "5.2.2" -} diff --git a/node_modules/subscriptions-transport-ws/package.json b/node_modules/subscriptions-transport-ws/package.json deleted file mode 100644 index b165172a..00000000 --- a/node_modules/subscriptions-transport-ws/package.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "_from": "subscriptions-transport-ws@latest", - "_id": "subscriptions-transport-ws@0.9.18", - "_inBundle": false, - "_integrity": "sha512-tztzcBTNoEbuErsVQpTN2xUNN/efAZXyCyL5m3x4t6SKrEiTL2N8SaKWBFWM4u56pL79ULif3zjyeq+oV+nOaA==", - "_location": "/subscriptions-transport-ws", - "_phantomChildren": { - "async-limiter": "1.0.0" - }, - "_requested": { - "type": "tag", - "registry": true, - "raw": "subscriptions-transport-ws@latest", - "name": "subscriptions-transport-ws", - "escapedName": "subscriptions-transport-ws", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.18.tgz", - "_shasum": "bcf02320c911fbadb054f7f928e51c6041a37b97", - "_spec": "subscriptions-transport-ws@latest", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom", - "browser": "dist/client.js", - "bugs": { - "url": "https://github.com/apollostack/subscriptions-transport-ws/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Authors" - }, - { - "name": "Jonas Helfer", - "email": "helfer@users.noreply.github.com" - }, - { - "name": "Jonas Helfer", - "email": "jonas@helfer.email" - }, - { - "name": "Amanda Jin Liu", - "email": "ajliu72@gmail.com" - }, - { - "name": "Robin Ricard", - "email": "ricard.robin@gmail.com" - }, - { - "name": "Sashko Stubailo", - "email": "s.stubailo@gmail.com" - }, - { - "name": "Sashko Stubailo", - "email": "sashko@stubailo.com" - }, - { - "name": "Hagai Cohen", - "email": "DxCx@users.noreply.github.com" - }, - { - "name": "Kamil Kisiela", - "email": "kamil.kisiela@gmail.com" - }, - { - "name": "Francois Valdy", - "email": "gluck@users.noreply.github.com" - }, - { - "name": "Daniel Rinehart", - "email": "NeoPhi@users.noreply.github.com" - }, - { - "name": "Lukas Fittl", - "email": "lfittl@users.noreply.github.com" - } - ], - "dependencies": { - "backo2": "^1.0.2", - "eventemitter3": "^3.1.0", - "iterall": "^1.2.1", - "symbol-observable": "^1.0.4", - "ws": "^5.2.0" - }, - "deprecated": false, - "description": "A websocket transport for GraphQL subscriptions", - "devDependencies": { - "@types/chai": "^4.0.0", - "@types/graphql": "^14.0.0", - "@types/is-promise": "^2.1.0", - "@types/lodash": "^4.14.109", - "@types/mocha": "^5.2.5", - "@types/node": "^8.0.8", - "@types/sinon": "^5.0.1", - "@types/ws": "^5.1.2", - "chai": "^4.0.2", - "graphql": "^15.3.0", - "graphql-subscriptions": "^1.0.0", - "istanbul": "^1.0.0-alpha.2", - "lodash": "^4.17.1", - "mocha": "^5.2.0", - "mock-socket-with-protocol": "^7.1.0", - "remap-istanbul": "^0.11.1", - "rimraf": "^2.6.1", - "sinon": "^6.1.4", - "tslint": "^5.10.0", - "typescript": "^3.9.6", - "webpack": "^3.1.0" - }, - "homepage": "https://github.com/apollostack/subscriptions-transport-ws#readme", - "license": "MIT", - "main": "dist/index.js", - "name": "subscriptions-transport-ws", - "peerDependencies": { - "graphql": ">=0.10.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/apollostack/subscriptions-transport-ws.git" - }, - "scripts": { - "browser-compile": "webpack --config \"./unpkg-webpack.config.js\"", - "clean": "rimraf browser dist coverage", - "compile": "tsc", - "coverage": "node ./node_modules/istanbul/lib/cli.js cover _mocha -- --exit --full-trace ./dist/test/tests.js", - "lint": "tslint --format stylish --project ./tsconfig.json", - "postcoverage": "remap-istanbul --input coverage/coverage.raw.json --type lcovonly --output coverage/lcov.info", - "posttest": "npm run lint", - "prepublishOnly": "npm run clean && npm run compile && npm run browser-compile", - "pretest": "npm run compile", - "test": "npm run testonly --", - "testonly": "mocha --exit --reporter spec --full-trace ./dist/test/**/*.js", - "watch": "tsc -w" - }, - "typescript": { - "definition": "dist/index.d.ts" - }, - "typings": "dist/index.d.ts", - "version": "0.9.18" -} diff --git a/node_modules/subscriptions-transport-ws/renovate.json b/node_modules/subscriptions-transport-ws/renovate.json deleted file mode 100644 index 3df09aa8..00000000 --- a/node_modules/subscriptions-transport-ws/renovate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "packageFiles": ["docs/package.json"], - "extends": [ - "apollo-docs" - ] -} diff --git a/node_modules/subscriptions-transport-ws/tsconfig.json b/node_modules/subscriptions-transport-ws/tsconfig.json deleted file mode 100644 index 4fee7fea..00000000 --- a/node_modules/subscriptions-transport-ws/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "sourceMap": true, - "inlineSources": true, - "noImplicitAny": true, - "rootDir": "./src", - "outDir": "./dist", - "allowSyntheticDefaultImports": true, - "removeComments": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "pretty": true, - "declaration": true, - "skipLibCheck": true, - "lib": ["es6", "esnext.asynciterable"], - "types": [ - "node" - ] - }, - "exclude": [ - "node_modules", - "dist" - ] -} diff --git a/node_modules/subscriptions-transport-ws/tslint.json b/node_modules/subscriptions-transport-ws/tslint.json deleted file mode 100644 index f55b765d..00000000 --- a/node_modules/subscriptions-transport-ws/tslint.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "rules": { - "align": [ - false, - "parameters", - "arguments", - "statements" - ], - "ban": false, - "class-name": true, - "curly": true, - "eofline": true, - "forin": true, - "indent": [ - true, - "spaces" - ], - "interface-name": false, - "jsdoc-format": true, - "label-position": true, - "max-line-length": [ - true, - 140 - ], - "member-access": true, - "member-ordering": [ - true, - "public-before-private", - "static-before-instance", - "variables-before-functions" - ], - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": [ - true, - "log", - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-null-keyword": false, - "no-require-imports": false, - "no-shadowed-variable": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-var-keyword": true, - "no-var-requires": false, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "quotemark": [ - true, - "single", - "avoid-escape" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "switch-default": true, - "trailing-comma": [ - true, - { - "multiline": "always", - "singleline": "never" - } - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef": [ - false, - "call-signature", - "parameter", - "arrow-parameter", - "property-declaration", - "variable-declaration", - "member-variable-declaration" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/node_modules/subscriptions-transport-ws/typings.d.ts b/node_modules/subscriptions-transport-ws/typings.d.ts deleted file mode 100644 index c5e42807..00000000 --- a/node_modules/subscriptions-transport-ws/typings.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -interface Array { - indexOfField : (propertyName: string, value: any) => number; -} - -declare module 'lodash.assign' { - import {assign} from 'lodash'; - export = assign; -} - -declare module 'lodash.isobject' { - import {isObject} from 'lodash'; - export = isObject; -} - -declare module 'lodash.isstring' { - import {isString} from 'lodash'; - export = isString; -} - -declare module 'backo2'; diff --git a/node_modules/subscriptions-transport-ws/unpkg-webpack.config.js b/node_modules/subscriptions-transport-ws/unpkg-webpack.config.js deleted file mode 100644 index 04e6d007..00000000 --- a/node_modules/subscriptions-transport-ws/unpkg-webpack.config.js +++ /dev/null @@ -1,11 +0,0 @@ -var path = require('path'); - -module.exports = { - context: path.join(__dirname, '/dist'), - entry: './client.js', - output: { - path: path.join(__dirname, '/browser'), - filename: 'client.js', - library: 'SubscriptionsTransportWs' - } -}; diff --git a/node_modules/symbol-observable/CHANGELOG.md b/node_modules/symbol-observable/CHANGELOG.md deleted file mode 100644 index d6f13d87..00000000 --- a/node_modules/symbol-observable/CHANGELOG.md +++ /dev/null @@ -1,136 +0,0 @@ - -# [1.2.0](https://github.com/blesh/symbol-observable/compare/1.1.0...v1.2.0) (2018-01-26) - - -### Bug Fixes - -* **TypeScript:** Remove global Symbol declaration ([427c3d7](https://github.com/blesh/symbol-observable/commit/427c3d7)) -* common js usage example (#30) ([42c2ffa](https://github.com/blesh/symbol-observable/commit/42c2ffa)) - - -### Features - -* **bundlers:** Add module and main entries in package.json (#33) ([97673e1](https://github.com/blesh/symbol-observable/commit/97673e1)) - - - - -# [1.1.0](https://github.com/blesh/symbol-observable/compare/1.0.4...v1.1.0) (2017-11-28) - - -### Bug Fixes - -* **TypeScript:** update TS to 2.0, fix typings ([e08474e](https://github.com/blesh/symbol-observable/commit/e08474e)), closes [#27](https://github.com/blesh/symbol-observable/issues/27) - - -### Features - -* **browser:** Fully qualified import for native esm browser support (#31) ([8ae5f8e](https://github.com/blesh/symbol-observable/commit/8ae5f8e)) -* **index.d.ts:** add type info to Symbol.observable ([e4be157](https://github.com/blesh/symbol-observable/commit/e4be157)) - - - - -## [1.0.4](https://github.com/blesh/symbol-observable/compare/1.0.3...v1.0.4) (2016-10-13) - - -### Bug Fixes - -* **global:** global variable location no longer assumes `module` exists ([4f85ede](https://github.com/blesh/symbol-observable/commit/4f85ede)), closes [#24](https://github.com/blesh/symbol-observable/issues/24) - - - - -## [1.0.3](https://github.com/blesh/symbol-observable/compare/1.0.2...v1.0.3) (2016-10-11) - - -### Bug Fixes - -* **mozilla addons support:** fix obtaining global object (#23) ([38da34d](https://github.com/blesh/symbol-observable/commit/38da34d)), closes [#23](https://github.com/blesh/symbol-observable/issues/23) - - - - -## [1.0.2](https://github.com/blesh/symbol-observable/compare/1.0.1...v1.0.2) (2016-08-09) - -### Bug Fixes - -* **ECMAScript 3**: ensure output is ES3 compatible ([3f37af3](https://github.com/blesh/symbol-observable/commit/3f37af3)) - - - - -## [1.0.1](https://github.com/blesh/symbol-observable/compare/1.0.0...v1.0.1) (2016-06-15) - - -### Bug Fixes - -* **bundlers:** fix issue that caused some bundlers not to be able to locate `/lib` (#19) ([dd8fdfe](https://github.com/blesh/symbol-observable/commit/dd8fdfe)), closes [(#19](https://github.com/(/issues/19) [#17](https://github.com/blesh/symbol-observable/issues/17) - - - - -# [1.0.0](https://github.com/blesh/symbol-observable/compare/0.2.4...v1.0.0) (2016-06-13) - - -### Bug Fixes - -* **index.js:** use typeof to check for global or window definitions (#8) ([5f4c2c6](https://github.com/blesh/symbol-observable/commit/5f4c2c6)) -* **types:** use default syntax for typedef ([240e3a6](https://github.com/blesh/symbol-observable/commit/240e3a6)) -* **TypeScript:** exported ponyfill now works with TypeScript ([c0b894e](https://github.com/blesh/symbol-observable/commit/c0b894e)) - -### Features - -* **es2015:** add es2015 implementation to support rollup (#10) ([7a41de9](https://github.com/blesh/symbol-observable/commit/7a41de9)) - - -### BREAKING CHANGES - -* TypeScript: CJS users will now have to `require('symbol-observable').default` rather than just `require('symbol-observable')` this was done to better support ES6 module bundlers. - - - - -## [0.2.4](https://github.com/blesh/symbol-observable/compare/0.2.2...v0.2.4) (2016-04-25) - - -### Bug Fixes - -* **IE8 support:** Ensure ES3 support so IE8 is happy ([9aaa7c3](https://github.com/blesh/symbol-observable/commit/9aaa7c3)) -* **Symbol.observable:** should NOT equal `Symbol.for('observable')`. ([3b0fdee](https://github.com/blesh/symbol-observable/commit/3b0fdee)), closes [#7](https://github.com/blesh/symbol-observable/issues/7) - - - - -## [0.2.3](https://github.com/blesh/symbol-observable/compare/0.2.3...v0.2.3) (2016-04-24) - -### Bug Fixes - -- **IE8/ECMAScript 3**: Make sure legacy browsers don't choke on a property named `for`. ([9aaa7c](https://github.com/blesh/symbol-observable/9aaa7c)) - - - -## [0.2.2](https://github.com/sindresorhus/symbol-observable/compare/0.2.1...v0.2.2) (2016-04-19) - -### Features - -* **TypeScript:** add TypeScript typings file ([befd7a](https://github.com/sindresorhus/symbol-observable/commit/befd7a)) - - - -## [0.2.1](https://github.com/sindresorhus/symbol-observable/compare/0.2.0...v0.2.1) (2016-04-19) - - -### Bug Fixes - -* **publish:** publish all required files ([5f26c3a](https://github.com/sindresorhus/symbol-observable/commit/5f26c3a)) - - - - -# [0.2.0](https://github.com/sindresorhus/symbol-observable/compare/v0.1.0...v0.2.0) (2016-04-19) - - -### Bug Fixes - -* **Symbol.observable:** ensure Symbol.for(\'observable\') matches Symbol.observable ([ada343f](https://github.com/sindresorhus/symbol-observable/commit/ada343f)), closes [#1](https://github.com/sindresorhus/symbol-observable/issues/1) [#2](https://github.com/sindresorhus/symbol-observable/issues/2) diff --git a/node_modules/symbol-observable/es/index.js b/node_modules/symbol-observable/es/index.js deleted file mode 100644 index 4ed892d2..00000000 --- a/node_modules/symbol-observable/es/index.js +++ /dev/null @@ -1,19 +0,0 @@ -/* global window */ -import ponyfill from './ponyfill.js'; - -var root; - -if (typeof self !== 'undefined') { - root = self; -} else if (typeof window !== 'undefined') { - root = window; -} else if (typeof global !== 'undefined') { - root = global; -} else if (typeof module !== 'undefined') { - root = module; -} else { - root = Function('return this')(); -} - -var result = ponyfill(root); -export default result; diff --git a/node_modules/symbol-observable/es/ponyfill.js b/node_modules/symbol-observable/es/ponyfill.js deleted file mode 100644 index 95dedc2e..00000000 --- a/node_modules/symbol-observable/es/ponyfill.js +++ /dev/null @@ -1,17 +0,0 @@ -export default function symbolObservablePonyfill(root) { - var result; - var Symbol = root.Symbol; - - if (typeof Symbol === 'function') { - if (Symbol.observable) { - result = Symbol.observable; - } else { - result = Symbol('observable'); - Symbol.observable = result; - } - } else { - result = '@@observable'; - } - - return result; -}; diff --git a/node_modules/symbol-observable/index.d.ts b/node_modules/symbol-observable/index.d.ts deleted file mode 100644 index 7426c522..00000000 --- a/node_modules/symbol-observable/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare const observableSymbol: symbol; -export default observableSymbol; - -declare global { - export interface SymbolConstructor { - readonly observable: symbol; - } -} - -export interface Symbol { - readonly [Symbol.observable]: symbol; -} diff --git a/node_modules/symbol-observable/index.js b/node_modules/symbol-observable/index.js deleted file mode 100644 index b58e228f..00000000 --- a/node_modules/symbol-observable/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/index'); diff --git a/node_modules/symbol-observable/lib/index.js b/node_modules/symbol-observable/lib/index.js deleted file mode 100644 index de74e784..00000000 --- a/node_modules/symbol-observable/lib/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _ponyfill = require('./ponyfill.js'); - -var _ponyfill2 = _interopRequireDefault(_ponyfill); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var root; /* global window */ - - -if (typeof self !== 'undefined') { - root = self; -} else if (typeof window !== 'undefined') { - root = window; -} else if (typeof global !== 'undefined') { - root = global; -} else if (typeof module !== 'undefined') { - root = module; -} else { - root = Function('return this')(); -} - -var result = (0, _ponyfill2['default'])(root); -exports['default'] = result; \ No newline at end of file diff --git a/node_modules/symbol-observable/lib/ponyfill.js b/node_modules/symbol-observable/lib/ponyfill.js deleted file mode 100644 index be68acaa..00000000 --- a/node_modules/symbol-observable/lib/ponyfill.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports['default'] = symbolObservablePonyfill; -function symbolObservablePonyfill(root) { - var result; - var _Symbol = root.Symbol; - - if (typeof _Symbol === 'function') { - if (_Symbol.observable) { - result = _Symbol.observable; - } else { - result = _Symbol('observable'); - _Symbol.observable = result; - } - } else { - result = '@@observable'; - } - - return result; -}; \ No newline at end of file diff --git a/node_modules/symbol-observable/license b/node_modules/symbol-observable/license deleted file mode 100644 index 0239f473..00000000 --- a/node_modules/symbol-observable/license +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) -Copyright (c) Ben Lesh - -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. diff --git a/node_modules/symbol-observable/package.json b/node_modules/symbol-observable/package.json deleted file mode 100644 index 70df88a9..00000000 --- a/node_modules/symbol-observable/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_args": [ - [ - "symbol-observable@1.2.0", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "symbol-observable@1.2.0", - "_id": "symbol-observable@1.2.0", - "_inBundle": false, - "_integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", - "_location": "/symbol-observable", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "symbol-observable@1.2.0", - "name": "symbol-observable", - "escapedName": "symbol-observable", - "rawSpec": "1.2.0", - "saveSpec": null, - "fetchSpec": "1.2.0" - }, - "_requiredBy": [ - "/apollo-client", - "/subscriptions-transport-ws" - ], - "_resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "_spec": "1.2.0", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Ben Lesh", - "email": "ben@benlesh.com" - }, - "bugs": { - "url": "https://github.com/blesh/symbol-observable/issues" - }, - "description": "Symbol.observable ponyfill", - "devDependencies": { - "babel-cli": "^6.9.0", - "babel-preset-es2015": "^6.9.0", - "babel-preset-es3": "^1.0.0", - "chai": "^3.5.0", - "check-es3-syntax-cli": "^0.1.0", - "mocha": "^2.4.5", - "typescript": "^2.1.4" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js", - "ponyfill.js", - "index.d.ts", - "es/index.js", - "es/ponyfill/js", - "lib/index.js", - "lib/ponyfill.js" - ], - "homepage": "https://github.com/blesh/symbol-observable#readme", - "jsnext:main": "es/index.js", - "keywords": [ - "symbol", - "observable", - "observables", - "ponyfill", - "polyfill", - "shim" - ], - "license": "MIT", - "main": "lib/index.js", - "module": "es/index.js", - "name": "symbol-observable", - "repository": { - "type": "git", - "url": "git+https://github.com/blesh/symbol-observable.git" - }, - "scripts": { - "build": "babel es --out-dir lib", - "prepublish": "npm test", - "test": "npm run build && mocha && tsc && node ./ts-test/test.js && check-es3-syntax -p lib/ --kill" - }, - "typings": "index.d.ts", - "version": "1.2.0" -} diff --git a/node_modules/symbol-observable/readme.md b/node_modules/symbol-observable/readme.md deleted file mode 100644 index 153a1ca0..00000000 --- a/node_modules/symbol-observable/readme.md +++ /dev/null @@ -1,31 +0,0 @@ -# symbol-observable [![Build Status](https://travis-ci.org/benlesh/symbol-observable.svg?branch=master)](https://travis-ci.org/benlesh/symbol-observable) - -> [`Symbol.observable`](https://github.com/zenparsing/es-observable) [ponyfill](https://ponyfill.com) - - -## Install - -``` -$ npm install --save symbol-observable -``` - - -## Usage - -```js -const symbolObservable = require('symbol-observable').default; - -console.log(symbolObservable); -//=> Symbol(observable) -``` - - -## Related - -- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable -- [observable-to-promise](https://github.com/sindresorhus/observable-to-promise) - Convert an Observable to a Promise - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) and [Ben Lesh](https://github.com/benlesh) diff --git a/node_modules/ts-invariant/LICENSE b/node_modules/ts-invariant/LICENSE deleted file mode 100644 index 3033d000..00000000 --- a/node_modules/ts-invariant/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Apollo GraphQL - -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. diff --git a/node_modules/ts-invariant/README.md b/node_modules/ts-invariant/README.md deleted file mode 100644 index b4c1c9bc..00000000 --- a/node_modules/ts-invariant/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# ts-invariant - -[TypeScript](https://www.typescriptlang.org) implementation of -[`invariant(condition, message)`](https://www.npmjs.com/package/invariant). diff --git a/node_modules/ts-invariant/lib/invariant.d.ts b/node_modules/ts-invariant/lib/invariant.d.ts deleted file mode 100644 index 7bdd2a70..00000000 --- a/node_modules/ts-invariant/lib/invariant.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// -export declare class InvariantError extends Error { - framesToPop: number; - name: string; - constructor(message?: string | number); -} -export declare function invariant(condition: any, message?: string | number): void; -export declare namespace invariant { - const warn: (...args: any[]) => void; - const error: (...args: any[]) => void; -} -declare let processStub: NodeJS.Process; -export { processStub as process }; -export default invariant; diff --git a/node_modules/ts-invariant/lib/invariant.esm.js b/node_modules/ts-invariant/lib/invariant.esm.js deleted file mode 100644 index 5b5cc07f..00000000 --- a/node_modules/ts-invariant/lib/invariant.esm.js +++ /dev/null @@ -1,62 +0,0 @@ -import { __extends } from 'tslib'; - -var genericMessage = "Invariant Violation"; -var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { - obj.__proto__ = proto; - return obj; -} : _a; -var InvariantError = /** @class */ (function (_super) { - __extends(InvariantError, _super); - function InvariantError(message) { - if (message === void 0) { message = genericMessage; } - var _this = _super.call(this, typeof message === "number" - ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" - : message) || this; - _this.framesToPop = 1; - _this.name = genericMessage; - setPrototypeOf(_this, InvariantError.prototype); - return _this; - } - return InvariantError; -}(Error)); -function invariant(condition, message) { - if (!condition) { - throw new InvariantError(message); - } -} -function wrapConsoleMethod(method) { - return function () { - return console[method].apply(console, arguments); - }; -} -(function (invariant) { - invariant.warn = wrapConsoleMethod("warn"); - invariant.error = wrapConsoleMethod("error"); -})(invariant || (invariant = {})); -// Code that uses ts-invariant with rollup-plugin-invariant may want to -// import this process stub to avoid errors evaluating process.env.NODE_ENV. -// However, because most ESM-to-CJS compilers will rewrite the process import -// as tsInvariant.process, which prevents proper replacement by minifiers, we -// also attempt to define the stub globally when it is not already defined. -var processStub = { env: {} }; -if (typeof process === "object") { - processStub = process; -} -else - try { - // Using Function to evaluate this assignment in global scope also escapes - // the strict mode of the current module, thereby allowing the assignment. - // Inspired by https://github.com/facebook/regenerator/pull/369. - Function("stub", "process = stub")(processStub); - } - catch (atLeastWeTried) { - // The assignment can fail if a Content Security Policy heavy-handedly - // forbids Function usage. In those environments, developers should take - // extra care to replace process.env.NODE_ENV in their production builds, - // or define an appropriate global.process polyfill. - } -var invariant$1 = invariant; - -export default invariant$1; -export { InvariantError, invariant, processStub as process }; -//# sourceMappingURL=invariant.esm.js.map diff --git a/node_modules/ts-invariant/lib/invariant.esm.js.map b/node_modules/ts-invariant/lib/invariant.esm.js.map deleted file mode 100644 index a1931f28..00000000 --- a/node_modules/ts-invariant/lib/invariant.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invariant.esm.js","sources":["../src/invariant.ts"],"sourcesContent":["const genericMessage = \"Invariant Violation\";\nconst {\n setPrototypeOf = function (obj: any, proto: any) {\n obj.__proto__ = proto;\n return obj;\n },\n} = Object as any;\n\nexport class InvariantError extends Error {\n framesToPop = 1;\n name = genericMessage;\n constructor(message: string | number = genericMessage) {\n super(\n typeof message === \"number\"\n ? `${genericMessage}: ${message} (see https://github.com/apollographql/invariant-packages)`\n : message\n );\n setPrototypeOf(this, InvariantError.prototype);\n }\n}\n\nexport function invariant(condition: any, message?: string | number) {\n if (!condition) {\n throw new InvariantError(message);\n }\n}\n\nfunction wrapConsoleMethod(method: \"warn\" | \"error\") {\n return function () {\n return console[method].apply(console, arguments as any);\n } as (...args: any[]) => void;\n}\n\nexport namespace invariant {\n export const warn = wrapConsoleMethod(\"warn\");\n export const error = wrapConsoleMethod(\"error\");\n}\n\n// Code that uses ts-invariant with rollup-plugin-invariant may want to\n// import this process stub to avoid errors evaluating process.env.NODE_ENV.\n// However, because most ESM-to-CJS compilers will rewrite the process import\n// as tsInvariant.process, which prevents proper replacement by minifiers, we\n// also attempt to define the stub globally when it is not already defined.\nlet processStub: NodeJS.Process = { env: {} } as any;\nexport { processStub as process };\nif (typeof process === \"object\") {\n processStub = process;\n} else try {\n // Using Function to evaluate this assignment in global scope also escapes\n // the strict mode of the current module, thereby allowing the assignment.\n // Inspired by https://github.com/facebook/regenerator/pull/369.\n Function(\"stub\", \"process = stub\")(processStub);\n} catch (atLeastWeTried) {\n // The assignment can fail if a Content Security Policy heavy-handedly\n // forbids Function usage. In those environments, developers should take\n // extra care to replace process.env.NODE_ENV in their production builds,\n // or define an appropriate global.process polyfill.\n}\n\nexport default invariant;\n"],"names":["tslib_1.__extends"],"mappings":";;AAAA,IAAM,cAAc,GAAG,qBAAqB,CAAC;AAE3C,IAAA,0BAGC,EAHD;;;MAGC,CACe;AAElB;IAAoCA,kCAAK;IAGvC,wBAAY,OAAyC;QAAzC,wBAAA,EAAA,wBAAyC;QAArD,YACE,kBACE,OAAO,OAAO,KAAK,QAAQ;cACpB,cAAc,UAAK,OAAO,+DAA4D;cACzF,OAAO,CACZ,SAEF;QATD,iBAAW,GAAG,CAAC,CAAC;QAChB,UAAI,GAAG,cAAc,CAAC;QAOpB,cAAc,CAAC,KAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;;KAChD;IACH,qBAAC;CAXD,CAAoC,KAAK,GAWxC;SAEe,SAAS,CAAC,SAAc,EAAE,OAAyB;IACjE,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;KACnC;CACF;AAED,SAAS,iBAAiB,CAAC,MAAwB;IACjD,OAAO;QACL,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,SAAgB,CAAC,CAAC;KAC7B,CAAC;CAC/B;AAED,WAAiB,SAAS;IACX,cAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjC,eAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;CACjD,EAHgB,SAAS,KAAT,SAAS,QAGzB;;;;;;AAOD,IAAI,WAAW,GAAmB,EAAE,GAAG,EAAE,EAAE,EAAS,CAAC;AACrD,AACA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;IAC/B,WAAW,GAAG,OAAO,CAAC;CACvB;;IAAM,IAAI;;;;QAIT,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,WAAW,CAAC,CAAC;KACjD;IAAC,OAAO,cAAc,EAAE;;;;;KAKxB;AAED,kBAAe,SAAS,CAAC;;;;;"} \ No newline at end of file diff --git a/node_modules/ts-invariant/lib/invariant.js b/node_modules/ts-invariant/lib/invariant.js deleted file mode 100644 index df611e27..00000000 --- a/node_modules/ts-invariant/lib/invariant.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var tslib = require('tslib'); - -var genericMessage = "Invariant Violation"; -var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { - obj.__proto__ = proto; - return obj; -} : _a; -var InvariantError = /** @class */ (function (_super) { - tslib.__extends(InvariantError, _super); - function InvariantError(message) { - if (message === void 0) { message = genericMessage; } - var _this = _super.call(this, typeof message === "number" - ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" - : message) || this; - _this.framesToPop = 1; - _this.name = genericMessage; - setPrototypeOf(_this, InvariantError.prototype); - return _this; - } - return InvariantError; -}(Error)); -function invariant(condition, message) { - if (!condition) { - throw new InvariantError(message); - } -} -function wrapConsoleMethod(method) { - return function () { - return console[method].apply(console, arguments); - }; -} -(function (invariant) { - invariant.warn = wrapConsoleMethod("warn"); - invariant.error = wrapConsoleMethod("error"); -})(invariant || (invariant = {})); -// Code that uses ts-invariant with rollup-plugin-invariant may want to -// import this process stub to avoid errors evaluating process.env.NODE_ENV. -// However, because most ESM-to-CJS compilers will rewrite the process import -// as tsInvariant.process, which prevents proper replacement by minifiers, we -// also attempt to define the stub globally when it is not already defined. -exports.process = { env: {} }; -if (typeof process === "object") { - exports.process = process; -} -else - try { - // Using Function to evaluate this assignment in global scope also escapes - // the strict mode of the current module, thereby allowing the assignment. - // Inspired by https://github.com/facebook/regenerator/pull/369. - Function("stub", "process = stub")(exports.process); - } - catch (atLeastWeTried) { - // The assignment can fail if a Content Security Policy heavy-handedly - // forbids Function usage. In those environments, developers should take - // extra care to replace process.env.NODE_ENV in their production builds, - // or define an appropriate global.process polyfill. - } -var invariant$1 = invariant; - -exports.default = invariant$1; -exports.InvariantError = InvariantError; -exports.invariant = invariant; -//# sourceMappingURL=invariant.js.map diff --git a/node_modules/ts-invariant/lib/invariant.js.map b/node_modules/ts-invariant/lib/invariant.js.map deleted file mode 100644 index 4f451522..00000000 --- a/node_modules/ts-invariant/lib/invariant.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invariant.js","sources":["invariant.esm.js"],"sourcesContent":["import { __extends } from 'tslib';\n\nvar genericMessage = \"Invariant Violation\";\r\nvar _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) {\r\n obj.__proto__ = proto;\r\n return obj;\r\n} : _a;\r\nvar InvariantError = /** @class */ (function (_super) {\r\n __extends(InvariantError, _super);\r\n function InvariantError(message) {\r\n if (message === void 0) { message = genericMessage; }\r\n var _this = _super.call(this, typeof message === \"number\"\r\n ? genericMessage + \": \" + message + \" (see https://github.com/apollographql/invariant-packages)\"\r\n : message) || this;\r\n _this.framesToPop = 1;\r\n _this.name = genericMessage;\r\n setPrototypeOf(_this, InvariantError.prototype);\r\n return _this;\r\n }\r\n return InvariantError;\r\n}(Error));\r\nfunction invariant(condition, message) {\r\n if (!condition) {\r\n throw new InvariantError(message);\r\n }\r\n}\r\nfunction wrapConsoleMethod(method) {\r\n return function () {\r\n return console[method].apply(console, arguments);\r\n };\r\n}\r\n(function (invariant) {\r\n invariant.warn = wrapConsoleMethod(\"warn\");\r\n invariant.error = wrapConsoleMethod(\"error\");\r\n})(invariant || (invariant = {}));\r\n// Code that uses ts-invariant with rollup-plugin-invariant may want to\r\n// import this process stub to avoid errors evaluating process.env.NODE_ENV.\r\n// However, because most ESM-to-CJS compilers will rewrite the process import\r\n// as tsInvariant.process, which prevents proper replacement by minifiers, we\r\n// also attempt to define the stub globally when it is not already defined.\r\nvar processStub = { env: {} };\r\nif (typeof process === \"object\") {\r\n processStub = process;\r\n}\r\nelse\r\n try {\r\n // Using Function to evaluate this assignment in global scope also escapes\r\n // the strict mode of the current module, thereby allowing the assignment.\r\n // Inspired by https://github.com/facebook/regenerator/pull/369.\r\n Function(\"stub\", \"process = stub\")(processStub);\r\n }\r\n catch (atLeastWeTried) {\r\n // The assignment can fail if a Content Security Policy heavy-handedly\r\n // forbids Function usage. In those environments, developers should take\r\n // extra care to replace process.env.NODE_ENV in their production builds,\r\n // or define an appropriate global.process polyfill.\r\n }\r\nvar invariant$1 = invariant;\n\nexport default invariant$1;\nexport { InvariantError, invariant, processStub as process };\n//# sourceMappingURL=invariant.esm.js.map\n"],"names":["__extends","processStub"],"mappings":";;;;;;AAEA,IAAI,cAAc,GAAG,qBAAqB,CAAC;AAC3C,IAAI,EAAE,GAAG,MAAM,CAAC,cAAc,EAAE,cAAc,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,UAAU,GAAG,EAAE,KAAK,EAAE;IACnF,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,GAAG,CAAC;CACd,GAAG,EAAE,CAAC;AACP,AAAG,IAAC,cAAc,kBAAkB,UAAU,MAAM,EAAE;IAClDA,eAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,cAAc,CAAC,OAAO,EAAE;QAC7B,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,cAAc,CAAC,EAAE;QACrD,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,OAAO,KAAK,QAAQ;cACnD,cAAc,GAAG,IAAI,GAAG,OAAO,GAAG,4DAA4D;cAC9F,OAAO,CAAC,IAAI,IAAI,CAAC;QACvB,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;QACtB,KAAK,CAAC,IAAI,GAAG,cAAc,CAAC;QAC5B,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,cAAc,CAAC;CACzB,CAAC,KAAK,CAAC,CAAC,CAAC;AACV,SAAS,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE;IACnC,IAAI,CAAC,SAAS,EAAE;QACZ,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;KACrC;CACJ;AACD,SAAS,iBAAiB,CAAC,MAAM,EAAE;IAC/B,OAAO,YAAY;QACf,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;KACpD,CAAC;CACL;AACD,CAAC,UAAU,SAAS,EAAE;IAClB,SAAS,CAAC,IAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAChD,EAAE,SAAS,KAAK,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC;;;;;;AAMlC,AAAIC,eAAW,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAC9B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;IAC7BA,eAAW,GAAG,OAAO,CAAC;CACzB;;IAEG,IAAI;;;;QAIA,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAACA,eAAW,CAAC,CAAC;KACnD;IACD,OAAO,cAAc,EAAE;;;;;KAKtB;AACL,IAAI,WAAW,GAAG,SAAS,CAAC;;;;;;"} \ No newline at end of file diff --git a/node_modules/ts-invariant/package.json b/node_modules/ts-invariant/package.json deleted file mode 100644 index b9635618..00000000 --- a/node_modules/ts-invariant/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "_args": [ - [ - "ts-invariant@0.4.4", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "ts-invariant@0.4.4", - "_id": "ts-invariant@0.4.4", - "_inBundle": false, - "_integrity": "sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA==", - "_location": "/ts-invariant", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "ts-invariant@0.4.4", - "name": "ts-invariant", - "escapedName": "ts-invariant", - "rawSpec": "0.4.4", - "saveSpec": null, - "fetchSpec": "0.4.4" - }, - "_requiredBy": [ - "/apollo-cache-inmemory", - "/apollo-client", - "/apollo-link", - "/apollo-utilities" - ], - "_resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz", - "_spec": "0.4.4", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Ben Newman", - "email": "ben@apollographql.com" - }, - "bugs": { - "url": "https://github.com/apollographql/invariant-packages/issues" - }, - "dependencies": { - "tslib": "^1.9.3" - }, - "description": "TypeScript implementation of invariant(condition, message)", - "devDependencies": { - "@types/invariant": "^2.2.29", - "invariant": "^2.2.4", - "mocha": "^5.2.0", - "rollup": "^1.1.2", - "rollup-plugin-typescript2": "^0.19.2" - }, - "gitHead": "c83c2aeb7917b93751d17706d800a7ea16d8fe3e", - "homepage": "https://github.com/apollographql/invariant-packages", - "keywords": [ - "invariant", - "assertion", - "precondition", - "TypeScript" - ], - "license": "MIT", - "main": "lib/invariant.js", - "module": "lib/invariant.esm.js", - "name": "ts-invariant", - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/invariant-packages.git" - }, - "scripts": { - "build": "tsc && rollup -c", - "mocha": "mocha --reporter spec --full-trace lib/tests.js", - "prepublish": "npm run build", - "test": "npm run build && npm run mocha" - }, - "types": "lib/invariant.d.ts", - "version": "0.4.4" -} diff --git a/node_modules/ts-invariant/rollup.config.js b/node_modules/ts-invariant/rollup.config.js deleted file mode 100644 index 97f09f44..00000000 --- a/node_modules/ts-invariant/rollup.config.js +++ /dev/null @@ -1,40 +0,0 @@ -import typescriptPlugin from 'rollup-plugin-typescript2'; -import typescript from 'typescript'; - -const globals = { - __proto__: null, - tslib: "tslib", -}; - -function external(id) { - return id in globals; -} - -export default [{ - input: "src/invariant.ts", - external, - output: { - file: "lib/invariant.esm.js", - format: "esm", - sourcemap: true, - globals, - }, - plugins: [ - typescriptPlugin({ - typescript, - tsconfig: "./tsconfig.rollup.json", - }), - ], -}, { - input: "lib/invariant.esm.js", - external, - output: { - // Intentionally overwrite the invariant.js file written by tsc: - file: "lib/invariant.js", - format: "cjs", - exports: "named", - sourcemap: true, - name: "ts-invariant", - globals, - }, -}]; diff --git a/node_modules/ts-invariant/tsconfig.json b/node_modules/ts-invariant/tsconfig.json deleted file mode 100644 index 1a79ad1e..00000000 --- a/node_modules/ts-invariant/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./lib" - } -} diff --git a/node_modules/ts-invariant/tsconfig.rollup.json b/node_modules/ts-invariant/tsconfig.rollup.json deleted file mode 100644 index 02085be6..00000000 --- a/node_modules/ts-invariant/tsconfig.rollup.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "es2015", - }, -} diff --git a/node_modules/tslib/CopyrightNotice.txt b/node_modules/tslib/CopyrightNotice.txt deleted file mode 100644 index 884a0313..00000000 --- a/node_modules/tslib/CopyrightNotice.txt +++ /dev/null @@ -1,15 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - diff --git a/node_modules/tslib/LICENSE.txt b/node_modules/tslib/LICENSE.txt deleted file mode 100644 index edc24fd6..00000000 --- a/node_modules/tslib/LICENSE.txt +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS diff --git a/node_modules/tslib/README.md b/node_modules/tslib/README.md deleted file mode 100644 index da212651..00000000 --- a/node_modules/tslib/README.md +++ /dev/null @@ -1,134 +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 2.3.3 or later -npm install --save tslib - -# TypeScript 2.3.2 or earlier -npm install --save tslib@1.6.1 -``` - -## bower - -```sh -# TypeScript 2.3.3 or later -bower install tslib - -# TypeScript 2.3.2 or earlier -bower install tslib@1.6.1 -``` - -## JSPM - -```sh -# TypeScript 2.3.3 or later -jspm install tslib - -# 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@1.10.0/tslib.d.ts"] - } - } -} -``` - - -# 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). -* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)). - -# Documentation - -* [Quick tutorial](http://www.typescriptlang.org/Tutorial) -* [Programming handbook](http://www.typescriptlang.org/Handbook) -* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) -* [Homepage](http://www.typescriptlang.org/) diff --git a/node_modules/tslib/package.json b/node_modules/tslib/package.json deleted file mode 100644 index 50c7a93d..00000000 --- a/node_modules/tslib/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_args": [ - [ - "tslib@1.10.0", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "tslib@1.10.0", - "_id": "tslib@1.10.0", - "_inBundle": false, - "_integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", - "_location": "/tslib", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "tslib@1.10.0", - "name": "tslib", - "escapedName": "tslib", - "rawSpec": "1.10.0", - "saveSpec": null, - "fetchSpec": "1.10.0" - }, - "_requiredBy": [ - "/@wry/context", - "/@wry/equality", - "/apollo-cache", - "/apollo-cache-inmemory", - "/apollo-client", - "/apollo-link", - "/apollo-link-ws", - "/apollo-utilities", - "/ts-invariant", - "/zen-observable-ts" - ], - "_resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "_spec": "1.10.0", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "author": { - "name": "Microsoft Corp." - }, - "bugs": { - "url": "https://github.com/Microsoft/TypeScript/issues" - }, - "description": "Runtime library for TypeScript helper functions", - "homepage": "http://typescriptlang.org/", - "jsnext:main": "tslib.es6.js", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript", - "tslib", - "runtime" - ], - "license": "Apache-2.0", - "main": "tslib.js", - "module": "tslib.es6.js", - "name": "tslib", - "repository": { - "type": "git", - "url": "git+https://github.com/Microsoft/tslib.git" - }, - "typings": "tslib.d.ts", - "version": "1.10.0" -} diff --git a/node_modules/tslib/tslib.d.ts b/node_modules/tslib/tslib.d.ts deleted file mode 100644 index e5bfc963..00000000 --- a/node_modules/tslib/tslib.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -export declare function __extends(d: Function, b: Function): void; -export declare function __assign(t: any, ...sources: any[]): any; -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; -export declare function __param(paramIndex: number, decorator: Function): Function; -export declare function __metadata(metadataKey: any, metadataValue: any): Function; -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; -export declare function __generator(thisArg: any, body: Function): any; -export declare function __exportStar(m: any, exports: any): void; -export declare function __values(o: any): any; -export declare function __read(o: any, n?: number): any[]; -export declare function __spread(...args: any[][]): any[]; -export declare function __spreadArrays(...args: any[][]): any[]; -export declare function __await(v: any): any; -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; -export declare function __asyncDelegator(o: any): any; -export declare function __asyncValues(o: any): any; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; -export declare function __importStar(mod: T): T; -export declare function __importDefault(mod: T): T | { default: T }; diff --git a/node_modules/tslib/tslib.es6.html b/node_modules/tslib/tslib.es6.html deleted file mode 100644 index b122e41b..00000000 --- a/node_modules/tslib/tslib.es6.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/tslib/tslib.es6.js b/node_modules/tslib/tslib.es6.js deleted file mode 100644 index 4294ef28..00000000 --- a/node_modules/tslib/tslib.es6.js +++ /dev/null @@ -1,196 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -/* 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 (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - 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) { - 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) : new P(function (resolve) { resolve(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 function __exportStar(m, exports) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -export function __values(o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) return m.call(o); - return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; -} - -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; -} - -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -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 __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; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} diff --git a/node_modules/tslib/tslib.html b/node_modules/tslib/tslib.html deleted file mode 100644 index 44c9ba51..00000000 --- a/node_modules/tslib/tslib.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/tslib/tslib.js b/node_modules/tslib/tslib.js deleted file mode 100644 index 89f00d65..00000000 --- a/node_modules/tslib/tslib.js +++ /dev/null @@ -1,255 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -/* 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 __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -(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 (b.hasOwnProperty(p)) d[p] = b[p]; }; - - __extends = function (d, b) { - 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) { - 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) : new P(function (resolve) { resolve(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, exports) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; - }; - - __values = function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) return m.call(o); - return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - }; - - __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; - }; - - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - __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; - }; - - __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; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - 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("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); -}); diff --git a/node_modules/typedarray/.travis.yml b/node_modules/typedarray/.travis.yml deleted file mode 100644 index cc4dba29..00000000 --- a/node_modules/typedarray/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/node_modules/typedarray/LICENSE b/node_modules/typedarray/LICENSE deleted file mode 100644 index 11adfaec..00000000 --- a/node_modules/typedarray/LICENSE +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (c) 2010, Linden Research, Inc. - Copyright (c) 2012, Joshua Bell - - 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. - $/LicenseInfo$ - */ - -// Original can be found at: -// https://bitbucket.org/lindenlab/llsd -// Modifications by Joshua Bell inexorabletash@gmail.com -// https://github.com/inexorabletash/polyfill - -// ES3/ES5 implementation of the Krhonos Typed Array Specification -// Ref: http://www.khronos.org/registry/typedarray/specs/latest/ -// Date: 2011-02-01 -// -// Variations: -// * Allows typed_array.get/set() as alias for subscripts (typed_array[]) diff --git a/node_modules/typedarray/example/tarray.js b/node_modules/typedarray/example/tarray.js deleted file mode 100644 index 8423d7c9..00000000 --- a/node_modules/typedarray/example/tarray.js +++ /dev/null @@ -1,4 +0,0 @@ -var Uint8Array = require('../').Uint8Array; -var ua = new Uint8Array(5); -ua[1] = 256 + 55; -console.log(ua[1]); diff --git a/node_modules/typedarray/index.js b/node_modules/typedarray/index.js deleted file mode 100644 index 5e540841..00000000 --- a/node_modules/typedarray/index.js +++ /dev/null @@ -1,630 +0,0 @@ -var undefined = (void 0); // Paranoia - -// Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to -// create, and consume so much memory, that the browser appears frozen. -var MAX_ARRAY_LENGTH = 1e5; - -// Approximations of internal ECMAScript conversion functions -var ECMAScript = (function() { - // Stash a copy in case other scripts modify these - var opts = Object.prototype.toString, - ophop = Object.prototype.hasOwnProperty; - - return { - // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues: - Class: function(v) { return opts.call(v).replace(/^\[object *|\]$/g, ''); }, - HasProperty: function(o, p) { return p in o; }, - HasOwnProperty: function(o, p) { return ophop.call(o, p); }, - IsCallable: function(o) { return typeof o === 'function'; }, - ToInt32: function(v) { return v >> 0; }, - ToUint32: function(v) { return v >>> 0; } - }; -}()); - -// Snapshot intrinsics -var LN2 = Math.LN2, - abs = Math.abs, - floor = Math.floor, - log = Math.log, - min = Math.min, - pow = Math.pow, - round = Math.round; - -// ES5: lock down object properties -function configureProperties(obj) { - if (getOwnPropNames && defineProp) { - var props = getOwnPropNames(obj), i; - for (i = 0; i < props.length; i += 1) { - defineProp(obj, props[i], { - value: obj[props[i]], - writable: false, - enumerable: false, - configurable: false - }); - } - } -} - -// emulate ES5 getter/setter API using legacy APIs -// http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx -// (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but -// note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless) -var defineProp -if (Object.defineProperty && (function() { - try { - Object.defineProperty({}, 'x', {}); - return true; - } catch (e) { - return false; - } - })()) { - defineProp = Object.defineProperty; -} else { - defineProp = function(o, p, desc) { - if (!o === Object(o)) throw new TypeError("Object.defineProperty called on non-object"); - if (ECMAScript.HasProperty(desc, 'get') && Object.prototype.__defineGetter__) { Object.prototype.__defineGetter__.call(o, p, desc.get); } - if (ECMAScript.HasProperty(desc, 'set') && Object.prototype.__defineSetter__) { Object.prototype.__defineSetter__.call(o, p, desc.set); } - if (ECMAScript.HasProperty(desc, 'value')) { o[p] = desc.value; } - return o; - }; -} - -var getOwnPropNames = Object.getOwnPropertyNames || function (o) { - if (o !== Object(o)) throw new TypeError("Object.getOwnPropertyNames called on non-object"); - var props = [], p; - for (p in o) { - if (ECMAScript.HasOwnProperty(o, p)) { - props.push(p); - } - } - return props; -}; - -// ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value) -// for index in 0 ... obj.length -function makeArrayAccessors(obj) { - if (!defineProp) { return; } - - if (obj.length > MAX_ARRAY_LENGTH) throw new RangeError("Array too large for polyfill"); - - function makeArrayAccessor(index) { - defineProp(obj, index, { - 'get': function() { return obj._getter(index); }, - 'set': function(v) { obj._setter(index, v); }, - enumerable: true, - configurable: false - }); - } - - var i; - for (i = 0; i < obj.length; i += 1) { - makeArrayAccessor(i); - } -} - -// Internal conversion functions: -// pack() - take a number (interpreted as Type), output a byte array -// unpack() - take a byte array, output a Type-like number - -function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; } -function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; } - -function packI8(n) { return [n & 0xff]; } -function unpackI8(bytes) { return as_signed(bytes[0], 8); } - -function packU8(n) { return [n & 0xff]; } -function unpackU8(bytes) { return as_unsigned(bytes[0], 8); } - -function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; } - -function packI16(n) { return [(n >> 8) & 0xff, n & 0xff]; } -function unpackI16(bytes) { return as_signed(bytes[0] << 8 | bytes[1], 16); } - -function packU16(n) { return [(n >> 8) & 0xff, n & 0xff]; } -function unpackU16(bytes) { return as_unsigned(bytes[0] << 8 | bytes[1], 16); } - -function packI32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } -function unpackI32(bytes) { return as_signed(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } - -function packU32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } -function unpackU32(bytes) { return as_unsigned(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } - -function packIEEE754(v, ebits, fbits) { - - var bias = (1 << (ebits - 1)) - 1, - s, e, f, ln, - i, bits, str, bytes; - - function roundToEven(n) { - var w = floor(n), f = n - w; - if (f < 0.5) - return w; - if (f > 0.5) - return w + 1; - return w % 2 ? w + 1 : w; - } - - // Compute sign, exponent, fraction - if (v !== v) { - // NaN - // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping - e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0; - } else if (v === Infinity || v === -Infinity) { - e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0; - } else if (v === 0) { - e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0; - } else { - s = v < 0; - v = abs(v); - - if (v >= pow(2, 1 - bias)) { - e = min(floor(log(v) / LN2), 1023); - f = roundToEven(v / pow(2, e) * pow(2, fbits)); - if (f / pow(2, fbits) >= 2) { - e = e + 1; - f = 1; - } - if (e > bias) { - // Overflow - e = (1 << ebits) - 1; - f = 0; - } else { - // Normalized - e = e + bias; - f = f - pow(2, fbits); - } - } else { - // Denormalized - e = 0; - f = roundToEven(v / pow(2, 1 - bias - fbits)); - } - } - - // Pack sign, exponent, fraction - bits = []; - for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); } - for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); } - bits.push(s ? 1 : 0); - bits.reverse(); - str = bits.join(''); - - // Bits to bytes - bytes = []; - while (str.length) { - bytes.push(parseInt(str.substring(0, 8), 2)); - str = str.substring(8); - } - return bytes; -} - -function unpackIEEE754(bytes, ebits, fbits) { - - // Bytes to bits - var bits = [], i, j, b, str, - bias, s, e, f; - - for (i = bytes.length; i; i -= 1) { - b = bytes[i - 1]; - for (j = 8; j; j -= 1) { - bits.push(b % 2 ? 1 : 0); b = b >> 1; - } - } - bits.reverse(); - str = bits.join(''); - - // Unpack sign, exponent, fraction - bias = (1 << (ebits - 1)) - 1; - s = parseInt(str.substring(0, 1), 2) ? -1 : 1; - e = parseInt(str.substring(1, 1 + ebits), 2); - f = parseInt(str.substring(1 + ebits), 2); - - // Produce number - if (e === (1 << ebits) - 1) { - return f !== 0 ? NaN : s * Infinity; - } else if (e > 0) { - // Normalized - return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); - } else if (f !== 0) { - // Denormalized - return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); - } else { - return s < 0 ? -0 : 0; - } -} - -function unpackF64(b) { return unpackIEEE754(b, 11, 52); } -function packF64(v) { return packIEEE754(v, 11, 52); } -function unpackF32(b) { return unpackIEEE754(b, 8, 23); } -function packF32(v) { return packIEEE754(v, 8, 23); } - - -// -// 3 The ArrayBuffer Type -// - -(function() { - - /** @constructor */ - var ArrayBuffer = function ArrayBuffer(length) { - length = ECMAScript.ToInt32(length); - if (length < 0) throw new RangeError('ArrayBuffer size is not a small enough positive integer'); - - this.byteLength = length; - this._bytes = []; - this._bytes.length = length; - - var i; - for (i = 0; i < this.byteLength; i += 1) { - this._bytes[i] = 0; - } - - configureProperties(this); - }; - - exports.ArrayBuffer = exports.ArrayBuffer || ArrayBuffer; - - // - // 4 The ArrayBufferView Type - // - - // NOTE: this constructor is not exported - /** @constructor */ - var ArrayBufferView = function ArrayBufferView() { - //this.buffer = null; - //this.byteOffset = 0; - //this.byteLength = 0; - }; - - // - // 5 The Typed Array View Types - // - - function makeConstructor(bytesPerElement, pack, unpack) { - // Each TypedArray type requires a distinct constructor instance with - // identical logic, which this produces. - - var ctor; - ctor = function(buffer, byteOffset, length) { - var array, sequence, i, s; - - if (!arguments.length || typeof arguments[0] === 'number') { - // Constructor(unsigned long length) - this.length = ECMAScript.ToInt32(arguments[0]); - if (length < 0) throw new RangeError('ArrayBufferView size is not a small enough positive integer'); - - this.byteLength = this.length * this.BYTES_PER_ELEMENT; - this.buffer = new ArrayBuffer(this.byteLength); - this.byteOffset = 0; - } else if (typeof arguments[0] === 'object' && arguments[0].constructor === ctor) { - // Constructor(TypedArray array) - array = arguments[0]; - - this.length = array.length; - this.byteLength = this.length * this.BYTES_PER_ELEMENT; - this.buffer = new ArrayBuffer(this.byteLength); - this.byteOffset = 0; - - for (i = 0; i < this.length; i += 1) { - this._setter(i, array._getter(i)); - } - } else if (typeof arguments[0] === 'object' && - !(arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { - // Constructor(sequence array) - sequence = arguments[0]; - - this.length = ECMAScript.ToUint32(sequence.length); - this.byteLength = this.length * this.BYTES_PER_ELEMENT; - this.buffer = new ArrayBuffer(this.byteLength); - this.byteOffset = 0; - - for (i = 0; i < this.length; i += 1) { - s = sequence[i]; - this._setter(i, Number(s)); - } - } else if (typeof arguments[0] === 'object' && - (arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { - // Constructor(ArrayBuffer buffer, - // optional unsigned long byteOffset, optional unsigned long length) - this.buffer = buffer; - - this.byteOffset = ECMAScript.ToUint32(byteOffset); - if (this.byteOffset > this.buffer.byteLength) { - throw new RangeError("byteOffset out of range"); - } - - if (this.byteOffset % this.BYTES_PER_ELEMENT) { - // The given byteOffset must be a multiple of the element - // size of the specific type, otherwise an exception is raised. - throw new RangeError("ArrayBuffer length minus the byteOffset is not a multiple of the element size."); - } - - if (arguments.length < 3) { - this.byteLength = this.buffer.byteLength - this.byteOffset; - - if (this.byteLength % this.BYTES_PER_ELEMENT) { - throw new RangeError("length of buffer minus byteOffset not a multiple of the element size"); - } - this.length = this.byteLength / this.BYTES_PER_ELEMENT; - } else { - this.length = ECMAScript.ToUint32(length); - this.byteLength = this.length * this.BYTES_PER_ELEMENT; - } - - if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { - throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); - } - } else { - throw new TypeError("Unexpected argument type(s)"); - } - - this.constructor = ctor; - - configureProperties(this); - makeArrayAccessors(this); - }; - - ctor.prototype = new ArrayBufferView(); - ctor.prototype.BYTES_PER_ELEMENT = bytesPerElement; - ctor.prototype._pack = pack; - ctor.prototype._unpack = unpack; - ctor.BYTES_PER_ELEMENT = bytesPerElement; - - // getter type (unsigned long index); - ctor.prototype._getter = function(index) { - if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); - - index = ECMAScript.ToUint32(index); - if (index >= this.length) { - return undefined; - } - - var bytes = [], i, o; - for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; - i < this.BYTES_PER_ELEMENT; - i += 1, o += 1) { - bytes.push(this.buffer._bytes[o]); - } - return this._unpack(bytes); - }; - - // NONSTANDARD: convenience alias for getter: type get(unsigned long index); - ctor.prototype.get = ctor.prototype._getter; - - // setter void (unsigned long index, type value); - ctor.prototype._setter = function(index, value) { - if (arguments.length < 2) throw new SyntaxError("Not enough arguments"); - - index = ECMAScript.ToUint32(index); - if (index >= this.length) { - return undefined; - } - - var bytes = this._pack(value), i, o; - for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; - i < this.BYTES_PER_ELEMENT; - i += 1, o += 1) { - this.buffer._bytes[o] = bytes[i]; - } - }; - - // void set(TypedArray array, optional unsigned long offset); - // void set(sequence array, optional unsigned long offset); - ctor.prototype.set = function(index, value) { - if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); - var array, sequence, offset, len, - i, s, d, - byteOffset, byteLength, tmp; - - if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) { - // void set(TypedArray array, optional unsigned long offset); - array = arguments[0]; - offset = ECMAScript.ToUint32(arguments[1]); - - if (offset + array.length > this.length) { - throw new RangeError("Offset plus length of array is out of range"); - } - - byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT; - byteLength = array.length * this.BYTES_PER_ELEMENT; - - if (array.buffer === this.buffer) { - tmp = []; - for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) { - tmp[i] = array.buffer._bytes[s]; - } - for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) { - this.buffer._bytes[d] = tmp[i]; - } - } else { - for (i = 0, s = array.byteOffset, d = byteOffset; - i < byteLength; i += 1, s += 1, d += 1) { - this.buffer._bytes[d] = array.buffer._bytes[s]; - } - } - } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') { - // void set(sequence array, optional unsigned long offset); - sequence = arguments[0]; - len = ECMAScript.ToUint32(sequence.length); - offset = ECMAScript.ToUint32(arguments[1]); - - if (offset + len > this.length) { - throw new RangeError("Offset plus length of array is out of range"); - } - - for (i = 0; i < len; i += 1) { - s = sequence[i]; - this._setter(offset + i, Number(s)); - } - } else { - throw new TypeError("Unexpected argument type(s)"); - } - }; - - // TypedArray subarray(long begin, optional long end); - ctor.prototype.subarray = function(start, end) { - function clamp(v, min, max) { return v < min ? min : v > max ? max : v; } - - start = ECMAScript.ToInt32(start); - end = ECMAScript.ToInt32(end); - - if (arguments.length < 1) { start = 0; } - if (arguments.length < 2) { end = this.length; } - - if (start < 0) { start = this.length + start; } - if (end < 0) { end = this.length + end; } - - start = clamp(start, 0, this.length); - end = clamp(end, 0, this.length); - - var len = end - start; - if (len < 0) { - len = 0; - } - - return new this.constructor( - this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len); - }; - - return ctor; - } - - var Int8Array = makeConstructor(1, packI8, unpackI8); - var Uint8Array = makeConstructor(1, packU8, unpackU8); - var Uint8ClampedArray = makeConstructor(1, packU8Clamped, unpackU8); - var Int16Array = makeConstructor(2, packI16, unpackI16); - var Uint16Array = makeConstructor(2, packU16, unpackU16); - var Int32Array = makeConstructor(4, packI32, unpackI32); - var Uint32Array = makeConstructor(4, packU32, unpackU32); - var Float32Array = makeConstructor(4, packF32, unpackF32); - var Float64Array = makeConstructor(8, packF64, unpackF64); - - exports.Int8Array = exports.Int8Array || Int8Array; - exports.Uint8Array = exports.Uint8Array || Uint8Array; - exports.Uint8ClampedArray = exports.Uint8ClampedArray || Uint8ClampedArray; - exports.Int16Array = exports.Int16Array || Int16Array; - exports.Uint16Array = exports.Uint16Array || Uint16Array; - exports.Int32Array = exports.Int32Array || Int32Array; - exports.Uint32Array = exports.Uint32Array || Uint32Array; - exports.Float32Array = exports.Float32Array || Float32Array; - exports.Float64Array = exports.Float64Array || Float64Array; -}()); - -// -// 6 The DataView View Type -// - -(function() { - function r(array, index) { - return ECMAScript.IsCallable(array.get) ? array.get(index) : array[index]; - } - - var IS_BIG_ENDIAN = (function() { - var u16array = new(exports.Uint16Array)([0x1234]), - u8array = new(exports.Uint8Array)(u16array.buffer); - return r(u8array, 0) === 0x12; - }()); - - // Constructor(ArrayBuffer buffer, - // optional unsigned long byteOffset, - // optional unsigned long byteLength) - /** @constructor */ - var DataView = function DataView(buffer, byteOffset, byteLength) { - if (arguments.length === 0) { - buffer = new exports.ArrayBuffer(0); - } else if (!(buffer instanceof exports.ArrayBuffer || ECMAScript.Class(buffer) === 'ArrayBuffer')) { - throw new TypeError("TypeError"); - } - - this.buffer = buffer || new exports.ArrayBuffer(0); - - this.byteOffset = ECMAScript.ToUint32(byteOffset); - if (this.byteOffset > this.buffer.byteLength) { - throw new RangeError("byteOffset out of range"); - } - - if (arguments.length < 3) { - this.byteLength = this.buffer.byteLength - this.byteOffset; - } else { - this.byteLength = ECMAScript.ToUint32(byteLength); - } - - if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { - throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); - } - - configureProperties(this); - }; - - function makeGetter(arrayType) { - return function(byteOffset, littleEndian) { - - byteOffset = ECMAScript.ToUint32(byteOffset); - - if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { - throw new RangeError("Array index out of range"); - } - byteOffset += this.byteOffset; - - var uint8Array = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT), - bytes = [], i; - for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { - bytes.push(r(uint8Array, i)); - } - - if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { - bytes.reverse(); - } - - return r(new arrayType(new exports.Uint8Array(bytes).buffer), 0); - }; - } - - DataView.prototype.getUint8 = makeGetter(exports.Uint8Array); - DataView.prototype.getInt8 = makeGetter(exports.Int8Array); - DataView.prototype.getUint16 = makeGetter(exports.Uint16Array); - DataView.prototype.getInt16 = makeGetter(exports.Int16Array); - DataView.prototype.getUint32 = makeGetter(exports.Uint32Array); - DataView.prototype.getInt32 = makeGetter(exports.Int32Array); - DataView.prototype.getFloat32 = makeGetter(exports.Float32Array); - DataView.prototype.getFloat64 = makeGetter(exports.Float64Array); - - function makeSetter(arrayType) { - return function(byteOffset, value, littleEndian) { - - byteOffset = ECMAScript.ToUint32(byteOffset); - if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { - throw new RangeError("Array index out of range"); - } - - // Get bytes - var typeArray = new arrayType([value]), - byteArray = new exports.Uint8Array(typeArray.buffer), - bytes = [], i, byteView; - - for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { - bytes.push(r(byteArray, i)); - } - - // Flip if necessary - if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { - bytes.reverse(); - } - - // Write them - byteView = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT); - byteView.set(bytes); - }; - } - - DataView.prototype.setUint8 = makeSetter(exports.Uint8Array); - DataView.prototype.setInt8 = makeSetter(exports.Int8Array); - DataView.prototype.setUint16 = makeSetter(exports.Uint16Array); - DataView.prototype.setInt16 = makeSetter(exports.Int16Array); - DataView.prototype.setUint32 = makeSetter(exports.Uint32Array); - DataView.prototype.setInt32 = makeSetter(exports.Int32Array); - DataView.prototype.setFloat32 = makeSetter(exports.Float32Array); - DataView.prototype.setFloat64 = makeSetter(exports.Float64Array); - - exports.DataView = exports.DataView || DataView; - -}()); diff --git a/node_modules/typedarray/package.json b/node_modules/typedarray/package.json deleted file mode 100644 index 5b865896..00000000 --- a/node_modules/typedarray/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "_from": "typedarray@^0.0.6", - "_id": "typedarray@0.0.6", - "_inBundle": false, - "_integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "_location": "/typedarray", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "typedarray@^0.0.6", - "name": "typedarray", - "escapedName": "typedarray", - "rawSpec": "^0.0.6", - "saveSpec": null, - "fetchSpec": "^0.0.6" - }, - "_requiredBy": [ - "/concat-stream" - ], - "_resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "_shasum": "867ac74e3864187b1d3d47d996a78ec5c8830777", - "_spec": "typedarray@^0.0.6", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/concat-stream", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/substack/typedarray/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "TypedArray polyfill for old browsers", - "devDependencies": { - "tape": "~2.3.2" - }, - "homepage": "https://github.com/substack/typedarray", - "keywords": [ - "ArrayBuffer", - "DataView", - "Float32Array", - "Float64Array", - "Int8Array", - "Int16Array", - "Int32Array", - "Uint8Array", - "Uint8ClampedArray", - "Uint16Array", - "Uint32Array", - "typed", - "array", - "polyfill" - ], - "license": "MIT", - "main": "index.js", - "name": "typedarray", - "repository": { - "type": "git", - "url": "git://github.com/substack/typedarray.git" - }, - "scripts": { - "test": "tape test/*.js test/server/*.js" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/6..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "0.0.6" -} diff --git a/node_modules/typedarray/readme.markdown b/node_modules/typedarray/readme.markdown deleted file mode 100644 index d18f6f71..00000000 --- a/node_modules/typedarray/readme.markdown +++ /dev/null @@ -1,61 +0,0 @@ -# typedarray - -TypedArray polyfill ripped from [this -module](https://raw.github.com/inexorabletash/polyfill). - -[![build status](https://secure.travis-ci.org/substack/typedarray.png)](http://travis-ci.org/substack/typedarray) - -[![testling badge](https://ci.testling.com/substack/typedarray.png)](https://ci.testling.com/substack/typedarray) - -# example - -``` js -var Uint8Array = require('typedarray').Uint8Array; -var ua = new Uint8Array(5); -ua[1] = 256 + 55; -console.log(ua[1]); -``` - -output: - -``` -55 -``` - -# methods - -``` js -var TA = require('typedarray') -``` - -The `TA` object has the following constructors: - -* TA.ArrayBuffer -* TA.DataView -* TA.Float32Array -* TA.Float64Array -* TA.Int8Array -* TA.Int16Array -* TA.Int32Array -* TA.Uint8Array -* TA.Uint8ClampedArray -* TA.Uint16Array -* TA.Uint32Array - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install typedarray -``` - -To use this module in the browser, compile with -[browserify](http://browserify.org) -or download a UMD build from browserify CDN: - -http://wzrd.in/standalone/typedarray@latest - -# license - -MIT diff --git a/node_modules/typedarray/test/server/undef_globals.js b/node_modules/typedarray/test/server/undef_globals.js deleted file mode 100644 index 425950f9..00000000 --- a/node_modules/typedarray/test/server/undef_globals.js +++ /dev/null @@ -1,19 +0,0 @@ -var test = require('tape'); -var vm = require('vm'); -var fs = require('fs'); -var src = fs.readFileSync(__dirname + '/../../index.js', 'utf8'); - -test('u8a without globals', function (t) { - var c = { - module: { exports: {} }, - }; - c.exports = c.module.exports; - vm.runInNewContext(src, c); - var TA = c.module.exports; - var ua = new(TA.Uint8Array)(5); - - t.equal(ua.length, 5); - ua[1] = 256 + 55; - t.equal(ua[1], 55); - t.end(); -}); diff --git a/node_modules/typedarray/test/tarray.js b/node_modules/typedarray/test/tarray.js deleted file mode 100644 index df596a34..00000000 --- a/node_modules/typedarray/test/tarray.js +++ /dev/null @@ -1,10 +0,0 @@ -var TA = require('../'); -var test = require('tape'); - -test('tiny u8a test', function (t) { - var ua = new(TA.Uint8Array)(5); - t.equal(ua.length, 5); - ua[1] = 256 + 55; - t.equal(ua[1], 55); - t.end(); -}); diff --git a/node_modules/util-deprecate/History.md b/node_modules/util-deprecate/History.md deleted file mode 100644 index acc86753..00000000 --- a/node_modules/util-deprecate/History.md +++ /dev/null @@ -1,16 +0,0 @@ - -1.0.2 / 2015-10-07 -================== - - * use try/catch when checking `localStorage` (#3, @kumavis) - -1.0.1 / 2014-11-25 -================== - - * browser: use `console.warn()` for deprecation calls - * browser: more jsdocs - -1.0.0 / 2014-04-30 -================== - - * initial commit diff --git a/node_modules/util-deprecate/LICENSE b/node_modules/util-deprecate/LICENSE deleted file mode 100644 index 6a60e8c2..00000000 --- a/node_modules/util-deprecate/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -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. diff --git a/node_modules/util-deprecate/README.md b/node_modules/util-deprecate/README.md deleted file mode 100644 index 75622fa7..00000000 --- a/node_modules/util-deprecate/README.md +++ /dev/null @@ -1,53 +0,0 @@ -util-deprecate -============== -### The Node.js `util.deprecate()` function with browser support - -In Node.js, this module simply re-exports the `util.deprecate()` function. - -In the web browser (i.e. via browserify), a browser-specific implementation -of the `util.deprecate()` function is used. - - -## API - -A `deprecate()` function is the only thing exposed by this module. - -``` javascript -// setup: -exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); - - -// users see: -foo(); -// foo() is deprecated, use bar() instead -foo(); -foo(); -``` - - -## License - -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -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. diff --git a/node_modules/util-deprecate/browser.js b/node_modules/util-deprecate/browser.js deleted file mode 100644 index 549ae2f0..00000000 --- a/node_modules/util-deprecate/browser.js +++ /dev/null @@ -1,67 +0,0 @@ - -/** - * Module exports. - */ - -module.exports = deprecate; - -/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ - -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -} - -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ - -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} diff --git a/node_modules/util-deprecate/node.js b/node_modules/util-deprecate/node.js deleted file mode 100644 index 5e6fcff5..00000000 --- a/node_modules/util-deprecate/node.js +++ /dev/null @@ -1,6 +0,0 @@ - -/** - * For Node.js, simply re-export the core `util.deprecate` function. - */ - -module.exports = require('util').deprecate; diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json deleted file mode 100644 index 35e62b6d..00000000 --- a/node_modules/util-deprecate/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_from": "util-deprecate@^1.0.1", - "_id": "util-deprecate@1.0.2", - "_inBundle": false, - "_integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "_location": "/util-deprecate", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "util-deprecate@^1.0.1", - "name": "util-deprecate", - "escapedName": "util-deprecate", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", - "_spec": "util-deprecate@^1.0.1", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/readable-stream", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "browser": "browser.js", - "bugs": { - "url": "https://github.com/TooTallNate/util-deprecate/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "The Node.js `util.deprecate()` function with browser support", - "homepage": "https://github.com/TooTallNate/util-deprecate", - "keywords": [ - "util", - "deprecate", - "browserify", - "browser", - "node" - ], - "license": "MIT", - "main": "node.js", - "name": "util-deprecate", - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/util-deprecate.git" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "1.0.2" -} diff --git a/node_modules/ws/LICENSE b/node_modules/ws/LICENSE deleted file mode 100644 index a145cd1d..00000000 --- a/node_modules/ws/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2011 Einar Otto Stangvik - -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. diff --git a/node_modules/ws/README.md b/node_modules/ws/README.md deleted file mode 100644 index 2b5c6115..00000000 --- a/node_modules/ws/README.md +++ /dev/null @@ -1,449 +0,0 @@ -# ws: a Node.js WebSocket library - -[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws) -[![Linux Build](https://img.shields.io/travis/websockets/ws/master.svg?logo=travis)](https://travis-ci.org/websockets/ws) -[![Windows Build](https://img.shields.io/appveyor/ci/lpinca/ws/master.svg?logo=appveyor)](https://ci.appveyor.com/project/lpinca/ws) -[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg)](https://coveralls.io/github/websockets/ws) - -ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and -server implementation. - -Passes the quite extensive Autobahn test suite: [server][server-report], -[client][client-report]. - -**Note**: This module does not work in the browser. The client in the docs is a -reference to a back end with the role of a client in the WebSocket -communication. Browser clients must use the native -[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) -object. To make the same code work seamlessly on Node.js and the browser, you -can use one of the many wrappers available on npm, like -[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). - -## Table of Contents - -- [Protocol support](#protocol-support) -- [Installing](#installing) - - [Opt-in for performance and spec compliance](#opt-in-for-performance-and-spec-compliance) -- [API docs](#api-docs) -- [WebSocket compression](#websocket-compression) -- [Usage examples](#usage-examples) - - [Sending and receiving text data](#sending-and-receiving-text-data) - - [Sending binary data](#sending-binary-data) - - [Simple server](#simple-server) - - [External HTTP/S server](#external-https-server) - - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) - - [Server broadcast](#server-broadcast) - - [echo.websocket.org demo](#echowebsocketorg-demo) - - [Other examples](#other-examples) -- [Error handling best practices](#error-handling-best-practices) -- [FAQ](#faq) - - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) - - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) - - [How to connect via a proxy?](#how-to-connect-via-a-proxy) -- [Changelog](#changelog) -- [License](#license) - -## Protocol support - -- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) -- **HyBi drafts 13-17** (Current default, alternatively option - `protocolVersion: 13`) - -## Installing - -``` -npm install ws -``` - -### Opt-in for performance and spec compliance - -There are 2 optional modules that can be installed along side with the ws -module. These modules are binary addons which improve certain operations. -Prebuilt binaries are available for the most popular platforms so you don't -necessarily need to have a C++ compiler installed on your machine. - -- `npm install --save-optional bufferutil`: Allows to efficiently perform - operations such as masking and unmasking the data payload of the WebSocket - frames. -- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a - message contains valid UTF-8 as required by the spec. - -## API docs - -See [`/doc/ws.md`](./doc/ws.md) for Node.js-like docs for the ws classes. - -## WebSocket compression - -ws supports the [permessage-deflate extension][permessage-deflate] which enables -the client and server to negotiate a compression algorithm and its parameters, -and then selectively apply it to the data payloads of each WebSocket message. - -The extension is disabled by default on the server and enabled by default on the -client. It adds a significant overhead in terms of performance and memory -consumption so we suggest to enable it only if it is really needed. - -Note that Node.js has a variety of issues with high-performance compression, -where increased concurrency, especially on Linux, can lead to [catastrophic -memory fragmentation][node-zlib-bug] and slow performance. If you intend to use -permessage-deflate in production, it is worthwhile to set up a test -representative of your workload and ensure Node.js/zlib will handle it with -acceptable performance and memory usage. - -Tuning of permessage-deflate can be done via the options defined below. You can -also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly -into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. - -See [the docs][ws-server-options] for more options. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ - port: 8080, - perMessageDeflate: { - zlibDeflateOptions: { - // See zlib defaults. - chunkSize: 1024, - memLevel: 7, - level: 3 - }, - zlibInflateOptions: { - chunkSize: 10 * 1024 - }, - // Other options settable: - clientNoContextTakeover: true, // Defaults to negotiated value. - serverNoContextTakeover: true, // Defaults to negotiated value. - serverMaxWindowBits: 10, // Defaults to negotiated value. - // Below options specified as default values. - concurrencyLimit: 10, // Limits zlib concurrency for perf. - threshold: 1024 // Size (in bytes) below which messages - // should not be compressed. - } -}); -``` - -The client will only use the extension if it is supported and enabled on the -server. To always disable the extension on the client set the -`perMessageDeflate` option to `false`. - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path', { - perMessageDeflate: false -}); -``` - -## Usage examples - -### Sending and receiving text data - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - ws.send('something'); -}); - -ws.on('message', function incoming(data) { - console.log(data); -}); -``` - -### Sending binary data - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - const array = new Float32Array(5); - - for (var i = 0; i < array.length; ++i) { - array[i] = i / 2; - } - - ws.send(array); -}); -``` - -### Simple server - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(message) { - console.log('received: %s', message); - }); - - ws.send('something'); -}); -``` - -### External HTTP/S server - -```js -const fs = require('fs'); -const https = require('https'); -const WebSocket = require('ws'); - -const server = new https.createServer({ - cert: fs.readFileSync('/path/to/cert.pem'), - key: fs.readFileSync('/path/to/key.pem') -}); -const wss = new WebSocket.Server({ server }); - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(message) { - console.log('received: %s', message); - }); - - ws.send('something'); -}); - -server.listen(8080); -``` - -### Multiple servers sharing a single HTTP/S server - -```js -const http = require('http'); -const WebSocket = require('ws'); - -const server = http.createServer(); -const wss1 = new WebSocket.Server({ noServer: true }); -const wss2 = new WebSocket.Server({ noServer: true }); - -wss1.on('connection', function connection(ws) { - // ... -}); - -wss2.on('connection', function connection(ws) { - // ... -}); - -server.on('upgrade', function upgrade(request, socket, head) { - const pathname = url.parse(request.url).pathname; - - if (pathname === '/foo') { - wss1.handleUpgrade(request, socket, head, function done(ws) { - wss1.emit('connection', ws, request); - }); - } else if (pathname === '/bar') { - wss2.handleUpgrade(request, socket, head, function done(ws) { - wss2.emit('connection', ws, request); - }); - } else { - socket.destroy(); - } -}); - -server.listen(8080); -``` - -### Server broadcast - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -// Broadcast to all. -wss.broadcast = function broadcast(data) { - wss.clients.forEach(function each(client) { - if (client.readyState === WebSocket.OPEN) { - client.send(data); - } - }); -}; - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(data) { - // Broadcast to everyone else. - wss.clients.forEach(function each(client) { - if (client !== ws && client.readyState === WebSocket.OPEN) { - client.send(data); - } - }); - }); -}); -``` - -### echo.websocket.org demo - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('wss://echo.websocket.org/', { - origin: 'https://websocket.org' -}); - -ws.on('open', function open() { - console.log('connected'); - ws.send(Date.now()); -}); - -ws.on('close', function close() { - console.log('disconnected'); -}); - -ws.on('message', function incoming(data) { - console.log(`Roundtrip time: ${Date.now() - data} ms`); - - setTimeout(function timeout() { - ws.send(Date.now()); - }, 500); -}); -``` - -### Other examples - -For a full example with a browser client communicating with a ws server, see the -examples folder. - -Otherwise, see the test cases. - -## Error handling best practices - -```js -// If the WebSocket is closed before the following send is attempted -ws.send('something'); - -// Errors (both immediate and async write errors) can be detected in an optional -// callback. The callback is also the only way of being notified that data has -// actually been sent. -ws.send('something', function ack(error) { - // If error is not defined, the send has been completed, otherwise the error - // object will indicate what failed. -}); - -// Immediate errors can also be handled with `try...catch`, but **note** that -// since sends are inherently asynchronous, socket write failures will *not* be -// captured when this technique is used. -try { - ws.send('something'); -} catch (e) { - /* handle error */ -} -``` - -## FAQ - -### How to get the IP address of the client? - -The remote IP address can be obtained from the raw socket. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -wss.on('connection', function connection(ws, req) { - const ip = req.connection.remoteAddress; -}); -``` - -When the server runs behind a proxy like NGINX, the de-facto standard is to use -the `X-Forwarded-For` header. - -```js -wss.on('connection', function connection(ws, req) { - const ip = req.headers['x-forwarded-for'].split(/\s*,\s*/)[0]; -}); -``` - -### How to detect and close broken connections? - -Sometimes the link between the server and the client can be interrupted in a way -that keeps both the server and the client unaware of the broken state of the -connection (e.g. when pulling the cord). - -In these cases ping messages can be used as a means to verify that the remote -endpoint is still responsive. - -```js -const WebSocket = require('ws'); - -function noop() {} - -function heartbeat() { - this.isAlive = true; -} - -const wss = new WebSocket.Server({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.isAlive = true; - ws.on('pong', heartbeat); -}); - -const interval = setInterval(function ping() { - wss.clients.forEach(function each(ws) { - if (ws.isAlive === false) return ws.terminate(); - - ws.isAlive = false; - ws.ping(noop); - }); -}, 30000); -``` - -Pong messages are automatically sent in response to ping messages as required by -the spec. - -Just like the server example above your clients might as well lose connection -without knowing it. You might want to add a ping listener on your clients to -prevent that. A simple implementation would be: - -```js -const WebSocket = require('ws'); - -function heartbeat() { - clearTimeout(this.pingTimeout); - - // Use `WebSocket#terminate()` and not `WebSocket#close()`. Delay should be - // equal to the interval at which your server sends out pings plus a - // conservative assumption of the latency. - this.pingTimeout = setTimeout(() => { - this.terminate(); - }, 30000 + 1000); -} - -const client = new WebSocket('wss://echo.websocket.org/'); - -client.on('open', heartbeat); -client.on('ping', heartbeat); -client.on('close', function clear() { - clearTimeout(this.pingTimeout); -}); -``` - -### How to connect via a proxy? - -Use a custom `http.Agent` implementation like [https-proxy-agent][] or -[socks-proxy-agent][]. - -## Changelog - -We're using the GitHub [releases][changelog] for changelog entries. - -## License - -[MIT](LICENSE) - -[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent -[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent -[client-report]: http://websockets.github.io/ws/autobahn/clients/ -[server-report]: http://websockets.github.io/ws/autobahn/servers/ -[permessage-deflate]: https://tools.ietf.org/html/rfc7692 -[changelog]: https://github.com/websockets/ws/releases -[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 -[node-zlib-deflaterawdocs]: - https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options -[ws-server-options]: - https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback diff --git a/node_modules/ws/browser.js b/node_modules/ws/browser.js deleted file mode 100644 index 78207796..00000000 --- a/node_modules/ws/browser.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -module.exports = function() { - throw new Error( - 'ws does not work in the browser. Browser clients must use the native ' + - 'WebSocket object' - ); -}; diff --git a/node_modules/ws/index.js b/node_modules/ws/index.js deleted file mode 100644 index b8d6be1c..00000000 --- a/node_modules/ws/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -const WebSocket = require('./lib/websocket'); - -WebSocket.Server = require('./lib/websocket-server'); -WebSocket.Receiver = require('./lib/receiver'); -WebSocket.Sender = require('./lib/sender'); - -module.exports = WebSocket; diff --git a/node_modules/ws/lib/buffer-util.js b/node_modules/ws/lib/buffer-util.js deleted file mode 100644 index 8fcb88f4..00000000 --- a/node_modules/ws/lib/buffer-util.js +++ /dev/null @@ -1,144 +0,0 @@ -'use strict'; - -const { EMPTY_BUFFER } = require('./constants'); - -/** - * Merges an array of buffers into a new buffer. - * - * @param {Buffer[]} list The array of buffers to concat - * @param {Number} totalLength The total length of buffers in the list - * @return {Buffer} The resulting buffer - * @public - */ -function concat(list, totalLength) { - if (list.length === 0) return EMPTY_BUFFER; - if (list.length === 1) return list[0]; - - const target = Buffer.allocUnsafe(totalLength); - var offset = 0; - - for (var i = 0; i < list.length; i++) { - const buf = list[i]; - buf.copy(target, offset); - offset += buf.length; - } - - return target; -} - -/** - * Masks a buffer using the given mask. - * - * @param {Buffer} source The buffer to mask - * @param {Buffer} mask The mask to use - * @param {Buffer} output The buffer where to store the result - * @param {Number} offset The offset at which to start writing - * @param {Number} length The number of bytes to mask. - * @public - */ -function _mask(source, mask, output, offset, length) { - for (var i = 0; i < length; i++) { - output[offset + i] = source[i] ^ mask[i & 3]; - } -} - -/** - * Unmasks a buffer using the given mask. - * - * @param {Buffer} buffer The buffer to unmask - * @param {Buffer} mask The mask to use - * @public - */ -function _unmask(buffer, mask) { - // Required until https://github.com/nodejs/node/issues/9006 is resolved. - const length = buffer.length; - for (var i = 0; i < length; i++) { - buffer[i] ^= mask[i & 3]; - } -} - -/** - * Converts a buffer to an `ArrayBuffer`. - * - * @param {Buffer} buf The buffer to convert - * @return {ArrayBuffer} Converted buffer - * @public - */ -function toArrayBuffer(buf) { - if (buf.byteLength === buf.buffer.byteLength) { - return buf.buffer; - } - - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); -} - -/** - * Converts `data` to a `Buffer`. - * - * @param {*} data The data to convert - * @return {Buffer} The buffer - * @throws {TypeError} - * @public - */ -function toBuffer(data) { - toBuffer.readOnly = true; - - if (Buffer.isBuffer(data)) return data; - - var buf; - - if (data instanceof ArrayBuffer) { - buf = Buffer.from(data); - } else if (ArrayBuffer.isView(data)) { - buf = viewToBuffer(data); - } else { - buf = Buffer.from(data); - toBuffer.readOnly = false; - } - - return buf; -} - -/** - * Converts an `ArrayBuffer` view into a buffer. - * - * @param {(DataView|TypedArray)} view The view to convert - * @return {Buffer} Converted view - * @private - */ -function viewToBuffer(view) { - const buf = Buffer.from(view.buffer); - - if (view.byteLength !== view.buffer.byteLength) { - return buf.slice(view.byteOffset, view.byteOffset + view.byteLength); - } - - return buf; -} - -try { - const bufferUtil = require('bufferutil'); - const bu = bufferUtil.BufferUtil || bufferUtil; - - module.exports = { - concat, - mask(source, mask, output, offset, length) { - if (length < 48) _mask(source, mask, output, offset, length); - else bu.mask(source, mask, output, offset, length); - }, - toArrayBuffer, - toBuffer, - unmask(buffer, mask) { - if (buffer.length < 32) _unmask(buffer, mask); - else bu.unmask(buffer, mask); - } - }; -} catch (e) /* istanbul ignore next */ { - module.exports = { - concat, - mask: _mask, - toArrayBuffer, - toBuffer, - unmask: _unmask - }; -} diff --git a/node_modules/ws/lib/constants.js b/node_modules/ws/lib/constants.js deleted file mode 100644 index 4082981f..00000000 --- a/node_modules/ws/lib/constants.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = { - BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], - GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', - kStatusCode: Symbol('status-code'), - kWebSocket: Symbol('websocket'), - EMPTY_BUFFER: Buffer.alloc(0), - NOOP: () => {} -}; diff --git a/node_modules/ws/lib/event-target.js b/node_modules/ws/lib/event-target.js deleted file mode 100644 index 44c81d99..00000000 --- a/node_modules/ws/lib/event-target.js +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -/** - * Class representing an event. - * - * @private - */ -class Event { - /** - * Create a new `Event`. - * - * @param {String} type The name of the event - * @param {Object} target A reference to the target to which the event was dispatched - */ - constructor(type, target) { - this.target = target; - this.type = type; - } -} - -/** - * Class representing a message event. - * - * @extends Event - * @private - */ -class MessageEvent extends Event { - /** - * Create a new `MessageEvent`. - * - * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor(data, target) { - super('message', target); - - this.data = data; - } -} - -/** - * Class representing a close event. - * - * @extends Event - * @private - */ -class CloseEvent extends Event { - /** - * Create a new `CloseEvent`. - * - * @param {Number} code The status code explaining why the connection is being closed - * @param {String} reason A human-readable string explaining why the connection is closing - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor(code, reason, target) { - super('close', target); - - this.wasClean = target._closeFrameReceived && target._closeFrameSent; - this.reason = reason; - this.code = code; - } -} - -/** - * Class representing an open event. - * - * @extends Event - * @private - */ -class OpenEvent extends Event { - /** - * Create a new `OpenEvent`. - * - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor(target) { - super('open', target); - } -} - -/** - * Class representing an error event. - * - * @extends Event - * @private - */ -class ErrorEvent extends Event { - /** - * Create a new `ErrorEvent`. - * - * @param {Object} error The error that generated this event - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor(error, target) { - super('error', target); - - this.message = error.message; - this.error = error; - } -} - -/** - * This provides methods for emulating the `EventTarget` interface. It's not - * meant to be used directly. - * - * @mixin - */ -const EventTarget = { - /** - * Register an event listener. - * - * @param {String} method A string representing the event type to listen for - * @param {Function} listener The listener to add - * @public - */ - addEventListener(method, listener) { - if (typeof listener !== 'function') return; - - function onMessage(data) { - listener.call(this, new MessageEvent(data, this)); - } - - function onClose(code, message) { - listener.call(this, new CloseEvent(code, message, this)); - } - - function onError(error) { - listener.call(this, new ErrorEvent(error, this)); - } - - function onOpen() { - listener.call(this, new OpenEvent(this)); - } - - if (method === 'message') { - onMessage._listener = listener; - this.on(method, onMessage); - } else if (method === 'close') { - onClose._listener = listener; - this.on(method, onClose); - } else if (method === 'error') { - onError._listener = listener; - this.on(method, onError); - } else if (method === 'open') { - onOpen._listener = listener; - this.on(method, onOpen); - } else { - this.on(method, listener); - } - }, - - /** - * Remove an event listener. - * - * @param {String} method A string representing the event type to remove - * @param {Function} listener The listener to remove - * @public - */ - removeEventListener(method, listener) { - const listeners = this.listeners(method); - - for (var i = 0; i < listeners.length; i++) { - if (listeners[i] === listener || listeners[i]._listener === listener) { - this.removeListener(method, listeners[i]); - } - } - } -}; - -module.exports = EventTarget; diff --git a/node_modules/ws/lib/extension.js b/node_modules/ws/lib/extension.js deleted file mode 100644 index 47096b97..00000000 --- a/node_modules/ws/lib/extension.js +++ /dev/null @@ -1,222 +0,0 @@ -'use strict'; - -// -// Allowed token characters: -// -// '!', '#', '$', '%', '&', ''', '*', '+', '-', -// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' -// -// tokenChars[32] === 0 // ' ' -// tokenChars[33] === 1 // '!' -// tokenChars[34] === 0 // '"' -// ... -// -// prettier-ignore -const tokenChars = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 - 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 -]; - -/** - * Adds an offer to the map of extension offers or a parameter to the map of - * parameters. - * - * @param {Object} dest The map of extension offers or parameters - * @param {String} name The extension or parameter name - * @param {(Object|Boolean|String)} elem The extension parameters or the - * parameter value - * @private - */ -function push(dest, name, elem) { - if (Object.prototype.hasOwnProperty.call(dest, name)) dest[name].push(elem); - else dest[name] = [elem]; -} - -/** - * Parses the `Sec-WebSocket-Extensions` header into an object. - * - * @param {String} header The field value of the header - * @return {Object} The parsed object - * @public - */ -function parse(header) { - const offers = {}; - - if (header === undefined || header === '') return offers; - - var params = {}; - var mustUnescape = false; - var isEscaping = false; - var inQuotes = false; - var extensionName; - var paramName; - var start = -1; - var end = -1; - - for (var i = 0; i < header.length; i++) { - const code = header.charCodeAt(i); - - if (extensionName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x20 /* ' ' */ || code === 0x09 /* '\t' */) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - const name = header.slice(start, end); - if (code === 0x2c) { - push(offers, name, params); - params = {}; - } else { - extensionName = name; - } - - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (paramName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x20 || code === 0x09) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - push(params, header.slice(start, end), true); - if (code === 0x2c) { - push(offers, extensionName, params); - params = {}; - extensionName = undefined; - } - - start = end = -1; - } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { - paramName = header.slice(start, i); - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else { - // - // The value of a quoted-string after unescaping must conform to the - // token ABNF, so only token characters are valid. - // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 - // - if (isEscaping) { - if (tokenChars[code] !== 1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - if (start === -1) start = i; - else if (!mustUnescape) mustUnescape = true; - isEscaping = false; - } else if (inQuotes) { - if (tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x22 /* '"' */ && start !== -1) { - inQuotes = false; - end = i; - } else if (code === 0x5c /* '\' */) { - isEscaping = true; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { - inQuotes = true; - } else if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (start !== -1 && (code === 0x20 || code === 0x09)) { - if (end === -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - var value = header.slice(start, end); - if (mustUnescape) { - value = value.replace(/\\/g, ''); - mustUnescape = false; - } - push(params, paramName, value); - if (code === 0x2c) { - push(offers, extensionName, params); - params = {}; - extensionName = undefined; - } - - paramName = undefined; - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } - } - - if (start === -1 || inQuotes) { - throw new SyntaxError('Unexpected end of input'); - } - - if (end === -1) end = i; - const token = header.slice(start, end); - if (extensionName === undefined) { - push(offers, token, {}); - } else { - if (paramName === undefined) { - push(params, token, true); - } else if (mustUnescape) { - push(params, paramName, token.replace(/\\/g, '')); - } else { - push(params, paramName, token); - } - push(offers, extensionName, params); - } - - return offers; -} - -/** - * Builds the `Sec-WebSocket-Extensions` header field value. - * - * @param {Object} extensions The map of extensions and parameters to format - * @return {String} A string representing the given object - * @public - */ -function format(extensions) { - return Object.keys(extensions) - .map((extension) => { - var configurations = extensions[extension]; - if (!Array.isArray(configurations)) configurations = [configurations]; - return configurations - .map((params) => { - return [extension] - .concat( - Object.keys(params).map((k) => { - var values = params[k]; - if (!Array.isArray(values)) values = [values]; - return values - .map((v) => (v === true ? k : `${k}=${v}`)) - .join('; '); - }) - ) - .join('; '); - }) - .join(', '); - }) - .join(', '); -} - -module.exports = { format, parse }; diff --git a/node_modules/ws/lib/permessage-deflate.js b/node_modules/ws/lib/permessage-deflate.js deleted file mode 100644 index 9c887647..00000000 --- a/node_modules/ws/lib/permessage-deflate.js +++ /dev/null @@ -1,502 +0,0 @@ -'use strict'; - -const Limiter = require('async-limiter'); -const zlib = require('zlib'); - -const bufferUtil = require('./buffer-util'); -const { kStatusCode, NOOP } = require('./constants'); - -const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); -const EMPTY_BLOCK = Buffer.from([0x00]); - -const kPerMessageDeflate = Symbol('permessage-deflate'); -const kTotalLength = Symbol('total-length'); -const kCallback = Symbol('callback'); -const kBuffers = Symbol('buffers'); -const kError = Symbol('error'); - -// -// We limit zlib concurrency, which prevents severe memory fragmentation -// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 -// and https://github.com/websockets/ws/issues/1202 -// -// Intentionally global; it's the global thread pool that's an issue. -// -let zlibLimiter; - -/** - * permessage-deflate implementation. - */ -class PerMessageDeflate { - /** - * Creates a PerMessageDeflate instance. - * - * @param {Object} options Configuration options - * @param {Boolean} options.serverNoContextTakeover Request/accept disabling - * of server context takeover - * @param {Boolean} options.clientNoContextTakeover Advertise/acknowledge - * disabling of client context takeover - * @param {(Boolean|Number)} options.serverMaxWindowBits Request/confirm the - * use of a custom server window size - * @param {(Boolean|Number)} options.clientMaxWindowBits Advertise support - * for, or request, a custom client window size - * @param {Object} options.zlibDeflateOptions Options to pass to zlib on deflate - * @param {Object} options.zlibInflateOptions Options to pass to zlib on inflate - * @param {Number} options.threshold Size (in bytes) below which messages - * should not be compressed - * @param {Number} options.concurrencyLimit The number of concurrent calls to - * zlib - * @param {Boolean} isServer Create the instance in either server or client - * mode - * @param {Number} maxPayload The maximum allowed message length - */ - constructor(options, isServer, maxPayload) { - this._maxPayload = maxPayload | 0; - this._options = options || {}; - this._threshold = - this._options.threshold !== undefined ? this._options.threshold : 1024; - this._isServer = !!isServer; - this._deflate = null; - this._inflate = null; - - this.params = null; - - if (!zlibLimiter) { - const concurrency = - this._options.concurrencyLimit !== undefined - ? this._options.concurrencyLimit - : 10; - zlibLimiter = new Limiter({ concurrency }); - } - } - - /** - * @type {String} - */ - static get extensionName() { - return 'permessage-deflate'; - } - - /** - * Create an extension negotiation offer. - * - * @return {Object} Extension parameters - * @public - */ - offer() { - const params = {}; - - if (this._options.serverNoContextTakeover) { - params.server_no_context_takeover = true; - } - if (this._options.clientNoContextTakeover) { - params.client_no_context_takeover = true; - } - if (this._options.serverMaxWindowBits) { - params.server_max_window_bits = this._options.serverMaxWindowBits; - } - if (this._options.clientMaxWindowBits) { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } else if (this._options.clientMaxWindowBits == null) { - params.client_max_window_bits = true; - } - - return params; - } - - /** - * Accept an extension negotiation offer/response. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Object} Accepted configuration - * @public - */ - accept(configurations) { - configurations = this.normalizeParams(configurations); - - this.params = this._isServer - ? this.acceptAsServer(configurations) - : this.acceptAsClient(configurations); - - return this.params; - } - - /** - * Releases all resources used by the extension. - * - * @public - */ - cleanup() { - if (this._inflate) { - this._inflate.close(); - this._inflate = null; - } - - if (this._deflate) { - this._deflate.close(); - this._deflate = null; - } - } - - /** - * Accept an extension negotiation offer. - * - * @param {Array} offers The extension negotiation offers - * @return {Object} Accepted configuration - * @private - */ - acceptAsServer(offers) { - const opts = this._options; - const accepted = offers.find((params) => { - if ( - (opts.serverNoContextTakeover === false && - params.server_no_context_takeover) || - (params.server_max_window_bits && - (opts.serverMaxWindowBits === false || - (typeof opts.serverMaxWindowBits === 'number' && - opts.serverMaxWindowBits > params.server_max_window_bits))) || - (typeof opts.clientMaxWindowBits === 'number' && - !params.client_max_window_bits) - ) { - return false; - } - - return true; - }); - - if (!accepted) { - throw new Error('None of the extension offers can be accepted'); - } - - if (opts.serverNoContextTakeover) { - accepted.server_no_context_takeover = true; - } - if (opts.clientNoContextTakeover) { - accepted.client_no_context_takeover = true; - } - if (typeof opts.serverMaxWindowBits === 'number') { - accepted.server_max_window_bits = opts.serverMaxWindowBits; - } - if (typeof opts.clientMaxWindowBits === 'number') { - accepted.client_max_window_bits = opts.clientMaxWindowBits; - } else if ( - accepted.client_max_window_bits === true || - opts.clientMaxWindowBits === false - ) { - delete accepted.client_max_window_bits; - } - - return accepted; - } - - /** - * Accept the extension negotiation response. - * - * @param {Array} response The extension negotiation response - * @return {Object} Accepted configuration - * @private - */ - acceptAsClient(response) { - const params = response[0]; - - if ( - this._options.clientNoContextTakeover === false && - params.client_no_context_takeover - ) { - throw new Error('Unexpected parameter "client_no_context_takeover"'); - } - - if (!params.client_max_window_bits) { - if (typeof this._options.clientMaxWindowBits === 'number') { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } - } else if ( - this._options.clientMaxWindowBits === false || - (typeof this._options.clientMaxWindowBits === 'number' && - params.client_max_window_bits > this._options.clientMaxWindowBits) - ) { - throw new Error( - 'Unexpected or invalid parameter "client_max_window_bits"' - ); - } - - return params; - } - - /** - * Normalize parameters. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Array} The offers/response with normalized parameters - * @private - */ - normalizeParams(configurations) { - configurations.forEach((params) => { - Object.keys(params).forEach((key) => { - var value = params[key]; - - if (value.length > 1) { - throw new Error(`Parameter "${key}" must have only a single value`); - } - - value = value[0]; - - if (key === 'client_max_window_bits') { - if (value !== true) { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if (!this._isServer) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else if (key === 'server_max_window_bits') { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if ( - key === 'client_no_context_takeover' || - key === 'server_no_context_takeover' - ) { - if (value !== true) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else { - throw new Error(`Unknown parameter "${key}"`); - } - - params[key] = value; - }); - }); - - return configurations; - } - - /** - * Decompress data. Concurrency limited by async-limiter. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - decompress(data, fin, callback) { - zlibLimiter.push((done) => { - this._decompress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Compress data. Concurrency limited by async-limiter. - * - * @param {Buffer} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - compress(data, fin, callback) { - zlibLimiter.push((done) => { - this._compress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Decompress data. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _decompress(data, fin, callback) { - const endpoint = this._isServer ? 'client' : 'server'; - - if (!this._inflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = - typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._inflate = zlib.createInflateRaw( - Object.assign({}, this._options.zlibInflateOptions, { windowBits }) - ); - this._inflate[kPerMessageDeflate] = this; - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - this._inflate.on('error', inflateOnError); - this._inflate.on('data', inflateOnData); - } - - this._inflate[kCallback] = callback; - - this._inflate.write(data); - if (fin) this._inflate.write(TRAILER); - - this._inflate.flush(() => { - const err = this._inflate[kError]; - - if (err) { - this._inflate.close(); - this._inflate = null; - callback(err); - return; - } - - const data = bufferUtil.concat( - this._inflate[kBuffers], - this._inflate[kTotalLength] - ); - - if (fin && this.params[`${endpoint}_no_context_takeover`]) { - this._inflate.close(); - this._inflate = null; - } else { - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - } - - callback(null, data); - }); - } - - /** - * Compress data. - * - * @param {Buffer} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _compress(data, fin, callback) { - if (!data || data.length === 0) { - process.nextTick(callback, null, EMPTY_BLOCK); - return; - } - - const endpoint = this._isServer ? 'server' : 'client'; - - if (!this._deflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = - typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._deflate = zlib.createDeflateRaw( - Object.assign({}, this._options.zlibDeflateOptions, { windowBits }) - ); - - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - - // - // An `'error'` event is emitted, only on Node.js < 10.0.0, if the - // `zlib.DeflateRaw` instance is closed while data is being processed. - // This can happen if `PerMessageDeflate#cleanup()` is called at the wrong - // time due to an abnormal WebSocket closure. - // - this._deflate.on('error', NOOP); - this._deflate.on('data', deflateOnData); - } - - this._deflate.write(data); - this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { - if (!this._deflate) { - // - // This `if` statement is only needed for Node.js < 10.0.0 because as of - // commit https://github.com/nodejs/node/commit/5e3f5164, the flush - // callback is no longer called if the deflate stream is closed while - // data is being processed. - // - return; - } - - var data = bufferUtil.concat( - this._deflate[kBuffers], - this._deflate[kTotalLength] - ); - - if (fin) data = data.slice(0, data.length - 4); - - if (fin && this.params[`${endpoint}_no_context_takeover`]) { - this._deflate.close(); - this._deflate = null; - } else { - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - } - - callback(null, data); - }); - } -} - -module.exports = PerMessageDeflate; - -/** - * The listener of the `zlib.DeflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function deflateOnData(chunk) { - this[kBuffers].push(chunk); - this[kTotalLength] += chunk.length; -} - -/** - * The listener of the `zlib.InflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function inflateOnData(chunk) { - this[kTotalLength] += chunk.length; - - if ( - this[kPerMessageDeflate]._maxPayload < 1 || - this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload - ) { - this[kBuffers].push(chunk); - return; - } - - this[kError] = new RangeError('Max payload size exceeded'); - this[kError][kStatusCode] = 1009; - this.removeListener('data', inflateOnData); - this.reset(); -} - -/** - * The listener of the `zlib.InflateRaw` stream `'error'` event. - * - * @param {Error} err The emitted error - * @private - */ -function inflateOnError(err) { - // - // There is no need to call `Zlib#close()` as the handle is automatically - // closed when an error is emitted. - // - this[kPerMessageDeflate]._inflate = null; - err[kStatusCode] = 1007; - this[kCallback](err); -} diff --git a/node_modules/ws/lib/receiver.js b/node_modules/ws/lib/receiver.js deleted file mode 100644 index 0a8d76df..00000000 --- a/node_modules/ws/lib/receiver.js +++ /dev/null @@ -1,492 +0,0 @@ -'use strict'; - -const { Writable } = require('stream'); - -const PerMessageDeflate = require('./permessage-deflate'); -const { - BINARY_TYPES, - EMPTY_BUFFER, - kStatusCode, - kWebSocket -} = require('./constants'); -const { concat, toArrayBuffer, unmask } = require('./buffer-util'); -const { isValidStatusCode, isValidUTF8 } = require('./validation'); - -const GET_INFO = 0; -const GET_PAYLOAD_LENGTH_16 = 1; -const GET_PAYLOAD_LENGTH_64 = 2; -const GET_MASK = 3; -const GET_DATA = 4; -const INFLATING = 5; - -/** - * HyBi Receiver implementation. - * - * @extends stream.Writable - */ -class Receiver extends Writable { - /** - * Creates a Receiver instance. - * - * @param {String} binaryType The type for binary data - * @param {Object} extensions An object containing the negotiated extensions - * @param {Number} maxPayload The maximum allowed message length - */ - constructor(binaryType, extensions, maxPayload) { - super(); - - this._binaryType = binaryType || BINARY_TYPES[0]; - this[kWebSocket] = undefined; - this._extensions = extensions || {}; - this._maxPayload = maxPayload | 0; - - this._bufferedBytes = 0; - this._buffers = []; - - this._compressed = false; - this._payloadLength = 0; - this._mask = undefined; - this._fragmented = 0; - this._masked = false; - this._fin = false; - this._opcode = 0; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragments = []; - - this._state = GET_INFO; - this._loop = false; - } - - /** - * Implements `Writable.prototype._write()`. - * - * @param {Buffer} chunk The chunk of data to write - * @param {String} encoding The character encoding of `chunk` - * @param {Function} cb Callback - */ - _write(chunk, encoding, cb) { - if (this._opcode === 0x08 && this._state == GET_INFO) return cb(); - - this._bufferedBytes += chunk.length; - this._buffers.push(chunk); - this.startLoop(cb); - } - - /** - * Consumes `n` bytes from the buffered data. - * - * @param {Number} n The number of bytes to consume - * @return {Buffer} The consumed bytes - * @private - */ - consume(n) { - this._bufferedBytes -= n; - - if (n === this._buffers[0].length) return this._buffers.shift(); - - if (n < this._buffers[0].length) { - const buf = this._buffers[0]; - this._buffers[0] = buf.slice(n); - return buf.slice(0, n); - } - - const dst = Buffer.allocUnsafe(n); - - do { - const buf = this._buffers[0]; - - if (n >= buf.length) { - this._buffers.shift().copy(dst, dst.length - n); - } else { - buf.copy(dst, dst.length - n, 0, n); - this._buffers[0] = buf.slice(n); - } - - n -= buf.length; - } while (n > 0); - - return dst; - } - - /** - * Starts the parsing loop. - * - * @param {Function} cb Callback - * @private - */ - startLoop(cb) { - var err; - this._loop = true; - - do { - switch (this._state) { - case GET_INFO: - err = this.getInfo(); - break; - case GET_PAYLOAD_LENGTH_16: - err = this.getPayloadLength16(); - break; - case GET_PAYLOAD_LENGTH_64: - err = this.getPayloadLength64(); - break; - case GET_MASK: - this.getMask(); - break; - case GET_DATA: - err = this.getData(cb); - break; - default: - // `INFLATING` - this._loop = false; - return; - } - } while (this._loop); - - cb(err); - } - - /** - * Reads the first two bytes of a frame. - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getInfo() { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - const buf = this.consume(2); - - if ((buf[0] & 0x30) !== 0x00) { - this._loop = false; - return error(RangeError, 'RSV2 and RSV3 must be clear', true, 1002); - } - - const compressed = (buf[0] & 0x40) === 0x40; - - if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - this._fin = (buf[0] & 0x80) === 0x80; - this._opcode = buf[0] & 0x0f; - this._payloadLength = buf[1] & 0x7f; - - if (this._opcode === 0x00) { - if (compressed) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - if (!this._fragmented) { - this._loop = false; - return error(RangeError, 'invalid opcode 0', true, 1002); - } - - this._opcode = this._fragmented; - } else if (this._opcode === 0x01 || this._opcode === 0x02) { - if (this._fragmented) { - this._loop = false; - return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); - } - - this._compressed = compressed; - } else if (this._opcode > 0x07 && this._opcode < 0x0b) { - if (!this._fin) { - this._loop = false; - return error(RangeError, 'FIN must be set', true, 1002); - } - - if (compressed) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - if (this._payloadLength > 0x7d) { - this._loop = false; - return error( - RangeError, - `invalid payload length ${this._payloadLength}`, - true, - 1002 - ); - } - } else { - this._loop = false; - return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); - } - - if (!this._fin && !this._fragmented) this._fragmented = this._opcode; - this._masked = (buf[1] & 0x80) === 0x80; - - if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; - else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; - else return this.haveLength(); - } - - /** - * Gets extended payload length (7+16). - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getPayloadLength16() { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - this._payloadLength = this.consume(2).readUInt16BE(0); - return this.haveLength(); - } - - /** - * Gets extended payload length (7+64). - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getPayloadLength64() { - if (this._bufferedBytes < 8) { - this._loop = false; - return; - } - - const buf = this.consume(8); - const num = buf.readUInt32BE(0); - - // - // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned - // if payload length is greater than this number. - // - if (num > Math.pow(2, 53 - 32) - 1) { - this._loop = false; - return error( - RangeError, - 'Unsupported WebSocket frame: payload length > 2^53 - 1', - false, - 1009 - ); - } - - this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); - return this.haveLength(); - } - - /** - * Payload length has been read. - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - haveLength() { - if (this._payloadLength && this._opcode < 0x08) { - this._totalPayloadLength += this._payloadLength; - if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { - this._loop = false; - return error(RangeError, 'Max payload size exceeded', false, 1009); - } - } - - if (this._masked) this._state = GET_MASK; - else this._state = GET_DATA; - } - - /** - * Reads mask bytes. - * - * @private - */ - getMask() { - if (this._bufferedBytes < 4) { - this._loop = false; - return; - } - - this._mask = this.consume(4); - this._state = GET_DATA; - } - - /** - * Reads data bytes. - * - * @param {Function} cb Callback - * @return {(Error|RangeError|undefined)} A possible error - * @private - */ - getData(cb) { - var data = EMPTY_BUFFER; - - if (this._payloadLength) { - if (this._bufferedBytes < this._payloadLength) { - this._loop = false; - return; - } - - data = this.consume(this._payloadLength); - if (this._masked) unmask(data, this._mask); - } - - if (this._opcode > 0x07) return this.controlMessage(data); - - if (this._compressed) { - this._state = INFLATING; - this.decompress(data, cb); - return; - } - - if (data.length) { - // - // This message is not compressed so its lenght is the sum of the payload - // length of all fragments. - // - this._messageLength = this._totalPayloadLength; - this._fragments.push(data); - } - - return this.dataMessage(); - } - - /** - * Decompresses data. - * - * @param {Buffer} data Compressed data - * @param {Function} cb Callback - * @private - */ - decompress(data, cb) { - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - perMessageDeflate.decompress(data, this._fin, (err, buf) => { - if (err) return cb(err); - - if (buf.length) { - this._messageLength += buf.length; - if (this._messageLength > this._maxPayload && this._maxPayload > 0) { - return cb( - error(RangeError, 'Max payload size exceeded', false, 1009) - ); - } - - this._fragments.push(buf); - } - - const er = this.dataMessage(); - if (er) return cb(er); - - this.startLoop(cb); - }); - } - - /** - * Handles a data message. - * - * @return {(Error|undefined)} A possible error - * @private - */ - dataMessage() { - if (this._fin) { - const messageLength = this._messageLength; - const fragments = this._fragments; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragmented = 0; - this._fragments = []; - - if (this._opcode === 2) { - var data; - - if (this._binaryType === 'nodebuffer') { - data = concat(fragments, messageLength); - } else if (this._binaryType === 'arraybuffer') { - data = toArrayBuffer(concat(fragments, messageLength)); - } else { - data = fragments; - } - - this.emit('message', data); - } else { - const buf = concat(fragments, messageLength); - - if (!isValidUTF8(buf)) { - this._loop = false; - return error(Error, 'invalid UTF-8 sequence', true, 1007); - } - - this.emit('message', buf.toString()); - } - } - - this._state = GET_INFO; - } - - /** - * Handles a control message. - * - * @param {Buffer} data Data to handle - * @return {(Error|RangeError|undefined)} A possible error - * @private - */ - controlMessage(data) { - if (this._opcode === 0x08) { - this._loop = false; - - if (data.length === 0) { - this.emit('conclude', 1005, ''); - this.end(); - } else if (data.length === 1) { - return error(RangeError, 'invalid payload length 1', true, 1002); - } else { - const code = data.readUInt16BE(0); - - if (!isValidStatusCode(code)) { - return error(RangeError, `invalid status code ${code}`, true, 1002); - } - - const buf = data.slice(2); - - if (!isValidUTF8(buf)) { - return error(Error, 'invalid UTF-8 sequence', true, 1007); - } - - this.emit('conclude', code, buf.toString()); - this.end(); - } - } else if (this._opcode === 0x09) { - this.emit('ping', data); - } else { - this.emit('pong', data); - } - - this._state = GET_INFO; - } -} - -module.exports = Receiver; - -/** - * Builds an error object. - * - * @param {(Error|RangeError)} ErrorCtor The error constructor - * @param {String} message The error message - * @param {Boolean} prefix Specifies whether or not to add a default prefix to - * `message` - * @param {Number} statusCode The status code - * @return {(Error|RangeError)} The error - * @private - */ -function error(ErrorCtor, message, prefix, statusCode) { - const err = new ErrorCtor( - prefix ? `Invalid WebSocket frame: ${message}` : message - ); - - Error.captureStackTrace(err, error); - err[kStatusCode] = statusCode; - return err; -} diff --git a/node_modules/ws/lib/sender.js b/node_modules/ws/lib/sender.js deleted file mode 100644 index 51158b15..00000000 --- a/node_modules/ws/lib/sender.js +++ /dev/null @@ -1,358 +0,0 @@ -'use strict'; - -const { randomBytes } = require('crypto'); - -const PerMessageDeflate = require('./permessage-deflate'); -const { EMPTY_BUFFER } = require('./constants'); -const { isValidStatusCode } = require('./validation'); -const { mask: applyMask, toBuffer } = require('./buffer-util'); - -/** - * HyBi Sender implementation. - */ -class Sender { - /** - * Creates a Sender instance. - * - * @param {net.Socket} socket The connection socket - * @param {Object} extensions An object containing the negotiated extensions - */ - constructor(socket, extensions) { - this._extensions = extensions || {}; - this._socket = socket; - - this._firstFragment = true; - this._compress = false; - - this._bufferedBytes = 0; - this._deflating = false; - this._queue = []; - } - - /** - * Frames a piece of data according to the HyBi WebSocket protocol. - * - * @param {Buffer} data The data to frame - * @param {Object} options Options object - * @param {Number} options.opcode The opcode - * @param {Boolean} options.readOnly Specifies whether `data` can be modified - * @param {Boolean} options.fin Specifies whether or not to set the FIN bit - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit - * @return {Buffer[]} The framed data as a list of `Buffer` instances - * @public - */ - static frame(data, options) { - const merge = options.mask && options.readOnly; - var offset = options.mask ? 6 : 2; - var payloadLength = data.length; - - if (data.length >= 65536) { - offset += 8; - payloadLength = 127; - } else if (data.length > 125) { - offset += 2; - payloadLength = 126; - } - - const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); - - target[0] = options.fin ? options.opcode | 0x80 : options.opcode; - if (options.rsv1) target[0] |= 0x40; - - target[1] = payloadLength; - - if (payloadLength === 126) { - target.writeUInt16BE(data.length, 2); - } else if (payloadLength === 127) { - target.writeUInt32BE(0, 2); - target.writeUInt32BE(data.length, 6); - } - - if (!options.mask) return [target, data]; - - const mask = randomBytes(4); - - target[1] |= 0x80; - target[offset - 4] = mask[0]; - target[offset - 3] = mask[1]; - target[offset - 2] = mask[2]; - target[offset - 1] = mask[3]; - - if (merge) { - applyMask(data, mask, target, offset, data.length); - return [target]; - } - - applyMask(data, mask, data, 0, data.length); - return [target, data]; - } - - /** - * Sends a close message to the other peer. - * - * @param {(Number|undefined)} code The status code component of the body - * @param {String} data The message component of the body - * @param {Boolean} mask Specifies whether or not to mask the message - * @param {Function} cb Callback - * @public - */ - close(code, data, mask, cb) { - var buf; - - if (code === undefined) { - buf = EMPTY_BUFFER; - } else if (typeof code !== 'number' || !isValidStatusCode(code)) { - throw new TypeError('First argument must be a valid error code number'); - } else if (data === undefined || data === '') { - buf = Buffer.allocUnsafe(2); - buf.writeUInt16BE(code, 0); - } else { - buf = Buffer.allocUnsafe(2 + Buffer.byteLength(data)); - buf.writeUInt16BE(code, 0); - buf.write(data, 2); - } - - if (this._deflating) { - this.enqueue([this.doClose, buf, mask, cb]); - } else { - this.doClose(buf, mask, cb); - } - } - - /** - * Frames and sends a close message. - * - * @param {Buffer} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @private - */ - doClose(data, mask, cb) { - this.sendFrame( - Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x08, - mask, - readOnly: false - }), - cb - ); - } - - /** - * Sends a ping message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - ping(data, mask, cb) { - const buf = toBuffer(data); - - if (this._deflating) { - this.enqueue([this.doPing, buf, mask, toBuffer.readOnly, cb]); - } else { - this.doPing(buf, mask, toBuffer.readOnly, cb); - } - } - - /** - * Frames and sends a ping message. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Boolean} readOnly Specifies whether `data` can be modified - * @param {Function} cb Callback - * @private - */ - doPing(data, mask, readOnly, cb) { - this.sendFrame( - Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x09, - mask, - readOnly - }), - cb - ); - } - - /** - * Sends a pong message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - pong(data, mask, cb) { - const buf = toBuffer(data); - - if (this._deflating) { - this.enqueue([this.doPong, buf, mask, toBuffer.readOnly, cb]); - } else { - this.doPong(buf, mask, toBuffer.readOnly, cb); - } - } - - /** - * Frames and sends a pong message. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Boolean} readOnly Specifies whether `data` can be modified - * @param {Function} cb Callback - * @private - */ - doPong(data, mask, readOnly, cb) { - this.sendFrame( - Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x0a, - mask, - readOnly - }), - cb - ); - } - - /** - * Sends a data message to the other peer. - * - * @param {*} data The message to send - * @param {Object} options Options object - * @param {Boolean} options.compress Specifies whether or not to compress `data` - * @param {Boolean} options.binary Specifies whether `data` is binary or text - * @param {Boolean} options.fin Specifies whether the fragment is the last one - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - send(data, options, cb) { - const buf = toBuffer(data); - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - var opcode = options.binary ? 2 : 1; - var rsv1 = options.compress; - - if (this._firstFragment) { - this._firstFragment = false; - if (rsv1 && perMessageDeflate) { - rsv1 = buf.length >= perMessageDeflate._threshold; - } - this._compress = rsv1; - } else { - rsv1 = false; - opcode = 0; - } - - if (options.fin) this._firstFragment = true; - - if (perMessageDeflate) { - const opts = { - fin: options.fin, - rsv1, - opcode, - mask: options.mask, - readOnly: toBuffer.readOnly - }; - - if (this._deflating) { - this.enqueue([this.dispatch, buf, this._compress, opts, cb]); - } else { - this.dispatch(buf, this._compress, opts, cb); - } - } else { - this.sendFrame( - Sender.frame(buf, { - fin: options.fin, - rsv1: false, - opcode, - mask: options.mask, - readOnly: toBuffer.readOnly - }), - cb - ); - } - } - - /** - * Dispatches a data message. - * - * @param {Buffer} data The message to send - * @param {Boolean} compress Specifies whether or not to compress `data` - * @param {Object} options Options object - * @param {Number} options.opcode The opcode - * @param {Boolean} options.readOnly Specifies whether `data` can be modified - * @param {Boolean} options.fin Specifies whether or not to set the FIN bit - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit - * @param {Function} cb Callback - * @private - */ - dispatch(data, compress, options, cb) { - if (!compress) { - this.sendFrame(Sender.frame(data, options), cb); - return; - } - - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - this._deflating = true; - perMessageDeflate.compress(data, options.fin, (_, buf) => { - this._deflating = false; - options.readOnly = false; - this.sendFrame(Sender.frame(buf, options), cb); - this.dequeue(); - }); - } - - /** - * Executes queued send operations. - * - * @private - */ - dequeue() { - while (!this._deflating && this._queue.length) { - const params = this._queue.shift(); - - this._bufferedBytes -= params[1].length; - params[0].apply(this, params.slice(1)); - } - } - - /** - * Enqueues a send operation. - * - * @param {Array} params Send operation parameters. - * @private - */ - enqueue(params) { - this._bufferedBytes += params[1].length; - this._queue.push(params); - } - - /** - * Sends a frame. - * - * @param {Buffer[]} list The frame to send - * @param {Function} cb Callback - * @private - */ - sendFrame(list, cb) { - if (list.length === 2) { - this._socket.cork(); - this._socket.write(list[0]); - this._socket.write(list[1], cb); - this._socket.uncork(); - } else { - this._socket.write(list[0], cb); - } - } -} - -module.exports = Sender; diff --git a/node_modules/ws/lib/validation.js b/node_modules/ws/lib/validation.js deleted file mode 100644 index 479a7db0..00000000 --- a/node_modules/ws/lib/validation.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -try { - const isValidUTF8 = require('utf-8-validate'); - - exports.isValidUTF8 = - typeof isValidUTF8 === 'object' - ? isValidUTF8.Validation.isValidUTF8 // utf-8-validate@<3.0.0 - : isValidUTF8; -} catch (e) /* istanbul ignore next */ { - exports.isValidUTF8 = () => true; -} - -/** - * Checks if a status code is allowed in a close frame. - * - * @param {Number} code The status code - * @return {Boolean} `true` if the status code is valid, else `false` - * @public - */ -exports.isValidStatusCode = (code) => { - return ( - (code >= 1000 && - code <= 1013 && - code !== 1004 && - code !== 1005 && - code !== 1006) || - (code >= 3000 && code <= 4999) - ); -}; diff --git a/node_modules/ws/lib/websocket-server.js b/node_modules/ws/lib/websocket-server.js deleted file mode 100644 index db02f4d0..00000000 --- a/node_modules/ws/lib/websocket-server.js +++ /dev/null @@ -1,413 +0,0 @@ -'use strict'; - -const EventEmitter = require('events'); -const crypto = require('crypto'); -const http = require('http'); - -const PerMessageDeflate = require('./permessage-deflate'); -const extension = require('./extension'); -const WebSocket = require('./websocket'); -const { GUID } = require('./constants'); - -const keyRegex = /^[+/0-9A-Za-z]{22}==$/; - -/** - * Class representing a WebSocket server. - * - * @extends EventEmitter - */ -class WebSocketServer extends EventEmitter { - /** - * Create a `WebSocketServer` instance. - * - * @param {Object} options Configuration options - * @param {Number} options.backlog The maximum length of the queue of pending - * connections - * @param {Boolean} options.clientTracking Specifies whether or not to track - * clients - * @param {Function} options.handleProtocols An hook to handle protocols - * @param {String} options.host The hostname where to bind the server - * @param {Number} options.maxPayload The maximum allowed message size - * @param {Boolean} options.noServer Enable no server mode - * @param {String} options.path Accept only connections matching this path - * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable - * permessage-deflate - * @param {Number} options.port The port where to bind the server - * @param {http.Server} options.server A pre-created HTTP/S server to use - * @param {Function} options.verifyClient An hook to reject connections - * @param {Function} callback A listener for the `listening` event - */ - constructor(options, callback) { - super(); - - options = Object.assign( - { - maxPayload: 100 * 1024 * 1024, - perMessageDeflate: false, - handleProtocols: null, - clientTracking: true, - verifyClient: null, - noServer: false, - backlog: null, // use default (511 as implemented in net.js) - server: null, - host: null, - path: null, - port: null - }, - options - ); - - if (options.port == null && !options.server && !options.noServer) { - throw new TypeError( - 'One of the "port", "server", or "noServer" options must be specified' - ); - } - - if (options.port != null) { - this._server = http.createServer((req, res) => { - const body = http.STATUS_CODES[426]; - - res.writeHead(426, { - 'Content-Length': body.length, - 'Content-Type': 'text/plain' - }); - res.end(body); - }); - this._server.listen( - options.port, - options.host, - options.backlog, - callback - ); - } else if (options.server) { - this._server = options.server; - } - - if (this._server) { - this._removeListeners = addListeners(this._server, { - listening: this.emit.bind(this, 'listening'), - error: this.emit.bind(this, 'error'), - upgrade: (req, socket, head) => { - this.handleUpgrade(req, socket, head, (ws) => { - this.emit('connection', ws, req); - }); - } - }); - } - - if (options.perMessageDeflate === true) options.perMessageDeflate = {}; - if (options.clientTracking) this.clients = new Set(); - this.options = options; - } - - /** - * Returns the bound address, the address family name, and port of the server - * as reported by the operating system if listening on an IP socket. - * If the server is listening on a pipe or UNIX domain socket, the name is - * returned as a string. - * - * @return {(Object|String|null)} The address of the server - * @public - */ - address() { - if (this.options.noServer) { - throw new Error('The server is operating in "noServer" mode'); - } - - if (!this._server) return null; - return this._server.address(); - } - - /** - * Close the server. - * - * @param {Function} cb Callback - * @public - */ - close(cb) { - if (cb) this.once('close', cb); - - // - // Terminate all associated clients. - // - if (this.clients) { - for (const client of this.clients) client.terminate(); - } - - const server = this._server; - - if (server) { - this._removeListeners(); - this._removeListeners = this._server = null; - - // - // Close the http server if it was internally created. - // - if (this.options.port != null) { - server.close(() => this.emit('close')); - return; - } - } - - process.nextTick(emitClose, this); - } - - /** - * See if a given request should be handled by this server instance. - * - * @param {http.IncomingMessage} req Request object to inspect - * @return {Boolean} `true` if the request is valid, else `false` - * @public - */ - shouldHandle(req) { - if (this.options.path) { - const index = req.url.indexOf('?'); - const pathname = index !== -1 ? req.url.slice(0, index) : req.url; - - if (pathname !== this.options.path) return false; - } - - return true; - } - - /** - * Handle a HTTP Upgrade request. - * - * @param {http.IncomingMessage} req The request object - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @public - */ - handleUpgrade(req, socket, head, cb) { - socket.on('error', socketOnError); - - const key = - req.headers['sec-websocket-key'] !== undefined - ? req.headers['sec-websocket-key'].trim() - : false; - const version = +req.headers['sec-websocket-version']; - const extensions = {}; - - if ( - req.method !== 'GET' || - req.headers.upgrade.toLowerCase() !== 'websocket' || - !key || - !keyRegex.test(key) || - (version !== 8 && version !== 13) || - !this.shouldHandle(req) - ) { - return abortHandshake(socket, 400); - } - - if (this.options.perMessageDeflate) { - const perMessageDeflate = new PerMessageDeflate( - this.options.perMessageDeflate, - true, - this.options.maxPayload - ); - - try { - const offers = extension.parse(req.headers['sec-websocket-extensions']); - - if (offers[PerMessageDeflate.extensionName]) { - perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); - extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - } catch (err) { - return abortHandshake(socket, 400); - } - } - - // - // Optionally call external client verification handler. - // - if (this.options.verifyClient) { - const info = { - origin: - req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], - secure: !!(req.connection.authorized || req.connection.encrypted), - req - }; - - if (this.options.verifyClient.length === 2) { - this.options.verifyClient(info, (verified, code, message, headers) => { - if (!verified) { - return abortHandshake(socket, code || 401, message, headers); - } - - this.completeUpgrade(key, extensions, req, socket, head, cb); - }); - return; - } - - if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); - } - - this.completeUpgrade(key, extensions, req, socket, head, cb); - } - - /** - * Upgrade the connection to WebSocket. - * - * @param {String} key The value of the `Sec-WebSocket-Key` header - * @param {Object} extensions The accepted extensions - * @param {http.IncomingMessage} req The request object - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @private - */ - completeUpgrade(key, extensions, req, socket, head, cb) { - // - // Destroy the socket if the client has already sent a FIN packet. - // - if (!socket.readable || !socket.writable) return socket.destroy(); - - const digest = crypto - .createHash('sha1') - .update(key + GUID) - .digest('base64'); - - const headers = [ - 'HTTP/1.1 101 Switching Protocols', - 'Upgrade: websocket', - 'Connection: Upgrade', - `Sec-WebSocket-Accept: ${digest}` - ]; - - const ws = new WebSocket(null); - var protocol = req.headers['sec-websocket-protocol']; - - if (protocol) { - protocol = protocol.split(',').map(trim); - - // - // Optionally call external protocol selection handler. - // - if (this.options.handleProtocols) { - protocol = this.options.handleProtocols(protocol, req); - } else { - protocol = protocol[0]; - } - - if (protocol) { - headers.push(`Sec-WebSocket-Protocol: ${protocol}`); - ws.protocol = protocol; - } - } - - if (extensions[PerMessageDeflate.extensionName]) { - const params = extensions[PerMessageDeflate.extensionName].params; - const value = extension.format({ - [PerMessageDeflate.extensionName]: [params] - }); - headers.push(`Sec-WebSocket-Extensions: ${value}`); - ws._extensions = extensions; - } - - // - // Allow external modification/inspection of handshake headers. - // - this.emit('headers', headers, req); - - socket.write(headers.concat('\r\n').join('\r\n')); - socket.removeListener('error', socketOnError); - - ws.setSocket(socket, head, this.options.maxPayload); - - if (this.clients) { - this.clients.add(ws); - ws.on('close', () => this.clients.delete(ws)); - } - - cb(ws); - } -} - -module.exports = WebSocketServer; - -/** - * Add event listeners on an `EventEmitter` using a map of - * pairs. - * - * @param {EventEmitter} server The event emitter - * @param {Object.} map The listeners to add - * @return {Function} A function that will remove the added listeners when called - * @private - */ -function addListeners(server, map) { - for (const event of Object.keys(map)) server.on(event, map[event]); - - return function removeListeners() { - for (const event of Object.keys(map)) { - server.removeListener(event, map[event]); - } - }; -} - -/** - * Emit a `'close'` event on an `EventEmitter`. - * - * @param {EventEmitter} server The event emitter - * @private - */ -function emitClose(server) { - server.emit('close'); -} - -/** - * Handle premature socket errors. - * - * @private - */ -function socketOnError() { - this.destroy(); -} - -/** - * Close the connection when preconditions are not fulfilled. - * - * @param {net.Socket} socket The socket of the upgrade request - * @param {Number} code The HTTP response status code - * @param {String} [message] The HTTP response body - * @param {Object} [headers] Additional HTTP response headers - * @private - */ -function abortHandshake(socket, code, message, headers) { - if (socket.writable) { - message = message || http.STATUS_CODES[code]; - headers = Object.assign( - { - Connection: 'close', - 'Content-type': 'text/html', - 'Content-Length': Buffer.byteLength(message) - }, - headers - ); - - socket.write( - `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + - Object.keys(headers) - .map((h) => `${h}: ${headers[h]}`) - .join('\r\n') + - '\r\n\r\n' + - message - ); - } - - socket.removeListener('error', socketOnError); - socket.destroy(); -} - -/** - * Remove whitespace characters from both ends of a string. - * - * @param {String} str The string - * @return {String} A new string representing `str` stripped of whitespace - * characters from both its beginning and end - * @private - */ -function trim(str) { - return str.trim(); -} diff --git a/node_modules/ws/lib/websocket.js b/node_modules/ws/lib/websocket.js deleted file mode 100644 index af810840..00000000 --- a/node_modules/ws/lib/websocket.js +++ /dev/null @@ -1,895 +0,0 @@ -'use strict'; - -const EventEmitter = require('events'); -const crypto = require('crypto'); -const https = require('https'); -const http = require('http'); -const net = require('net'); -const tls = require('tls'); -const url = require('url'); - -const PerMessageDeflate = require('./permessage-deflate'); -const EventTarget = require('./event-target'); -const extension = require('./extension'); -const Receiver = require('./receiver'); -const Sender = require('./sender'); -const { - BINARY_TYPES, - EMPTY_BUFFER, - GUID, - kStatusCode, - kWebSocket, - NOOP -} = require('./constants'); - -const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; -const protocolVersions = [8, 13]; -const closeTimeout = 30 * 1000; - -/** - * Class representing a WebSocket. - * - * @extends EventEmitter - */ -class WebSocket extends EventEmitter { - /** - * Create a new `WebSocket`. - * - * @param {(String|url.Url|url.URL)} address The URL to which to connect - * @param {(String|String[])} protocols The subprotocols - * @param {Object} options Connection options - */ - constructor(address, protocols, options) { - super(); - - this.readyState = WebSocket.CONNECTING; - this.protocol = ''; - - this._binaryType = BINARY_TYPES[0]; - this._closeFrameReceived = false; - this._closeFrameSent = false; - this._closeMessage = ''; - this._closeTimer = null; - this._closeCode = 1006; - this._extensions = {}; - this._receiver = null; - this._sender = null; - this._socket = null; - - if (address !== null) { - this._isServer = false; - this._redirects = 0; - - if (Array.isArray(protocols)) { - protocols = protocols.join(', '); - } else if (typeof protocols === 'object' && protocols !== null) { - options = protocols; - protocols = undefined; - } - - initAsClient(this, address, protocols, options); - } else { - this._isServer = true; - } - } - - get CONNECTING() { - return WebSocket.CONNECTING; - } - get CLOSING() { - return WebSocket.CLOSING; - } - get CLOSED() { - return WebSocket.CLOSED; - } - get OPEN() { - return WebSocket.OPEN; - } - - /** - * This deviates from the WHATWG interface since ws doesn't support the - * required default "blob" type (instead we define a custom "nodebuffer" - * type). - * - * @type {String} - */ - get binaryType() { - return this._binaryType; - } - - set binaryType(type) { - if (!BINARY_TYPES.includes(type)) return; - - this._binaryType = type; - - // - // Allow to change `binaryType` on the fly. - // - if (this._receiver) this._receiver._binaryType = type; - } - - /** - * @type {Number} - */ - get bufferedAmount() { - if (!this._socket) return 0; - - // - // `socket.bufferSize` is `undefined` if the socket is closed. - // - return (this._socket.bufferSize || 0) + this._sender._bufferedBytes; - } - - /** - * @type {String} - */ - get extensions() { - return Object.keys(this._extensions).join(); - } - - /** - * Set up the socket and the internal resources. - * - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Number} maxPayload The maximum allowed message size - * @private - */ - setSocket(socket, head, maxPayload) { - const receiver = new Receiver( - this._binaryType, - this._extensions, - maxPayload - ); - - this._sender = new Sender(socket, this._extensions); - this._receiver = receiver; - this._socket = socket; - - receiver[kWebSocket] = this; - socket[kWebSocket] = this; - - receiver.on('conclude', receiverOnConclude); - receiver.on('drain', receiverOnDrain); - receiver.on('error', receiverOnError); - receiver.on('message', receiverOnMessage); - receiver.on('ping', receiverOnPing); - receiver.on('pong', receiverOnPong); - - socket.setTimeout(0); - socket.setNoDelay(); - - if (head.length > 0) socket.unshift(head); - - socket.on('close', socketOnClose); - socket.on('data', socketOnData); - socket.on('end', socketOnEnd); - socket.on('error', socketOnError); - - this.readyState = WebSocket.OPEN; - this.emit('open'); - } - - /** - * Emit the `'close'` event. - * - * @private - */ - emitClose() { - this.readyState = WebSocket.CLOSED; - - if (!this._socket) { - this.emit('close', this._closeCode, this._closeMessage); - return; - } - - if (this._extensions[PerMessageDeflate.extensionName]) { - this._extensions[PerMessageDeflate.extensionName].cleanup(); - } - - this._receiver.removeAllListeners(); - this.emit('close', this._closeCode, this._closeMessage); - } - - /** - * Start a closing handshake. - * - * +----------+ +-----------+ +----------+ - * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - - * | +----------+ +-----------+ +----------+ | - * +----------+ +-----------+ | - * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING - * +----------+ +-----------+ | - * | | | +---+ | - * +------------------------+-->|fin| - - - - - * | +---+ | +---+ - * - - - - -|fin|<---------------------+ - * +---+ - * - * @param {Number} code Status code explaining why the connection is closing - * @param {String} data A string explaining why the connection is closing - * @public - */ - close(code, data) { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - return abortHandshake(this, this._req, msg); - } - - if (this.readyState === WebSocket.CLOSING) { - if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); - return; - } - - this.readyState = WebSocket.CLOSING; - this._sender.close(code, data, !this._isServer, (err) => { - // - // This error is handled by the `'error'` listener on the socket. We only - // want to know if the close frame has been sent here. - // - if (err) return; - - this._closeFrameSent = true; - if (this._closeFrameReceived) this._socket.end(); - }); - - // - // Specify a timeout for the closing handshake to complete. - // - this._closeTimer = setTimeout( - this._socket.destroy.bind(this._socket), - closeTimeout - ); - } - - /** - * Send a ping. - * - * @param {*} data The data to send - * @param {Boolean} mask Indicates whether or not to mask `data` - * @param {Function} cb Callback which is executed when the ping is sent - * @public - */ - ping(data, mask, cb) { - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - if (mask === undefined) mask = !this._isServer; - this._sender.ping(data || EMPTY_BUFFER, mask, cb); - } - - /** - * Send a pong. - * - * @param {*} data The data to send - * @param {Boolean} mask Indicates whether or not to mask `data` - * @param {Function} cb Callback which is executed when the pong is sent - * @public - */ - pong(data, mask, cb) { - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - if (mask === undefined) mask = !this._isServer; - this._sender.pong(data || EMPTY_BUFFER, mask, cb); - } - - /** - * Send a data message. - * - * @param {*} data The message to send - * @param {Object} options Options object - * @param {Boolean} options.compress Specifies whether or not to compress `data` - * @param {Boolean} options.binary Specifies whether `data` is binary or text - * @param {Boolean} options.fin Specifies whether the fragment is the last one - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Function} cb Callback which is executed when data is written out - * @public - */ - send(data, options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - - const opts = Object.assign( - { - binary: typeof data !== 'string', - mask: !this._isServer, - compress: true, - fin: true - }, - options - ); - - if (!this._extensions[PerMessageDeflate.extensionName]) { - opts.compress = false; - } - - this._sender.send(data || EMPTY_BUFFER, opts, cb); - } - - /** - * Forcibly close the connection. - * - * @public - */ - terminate() { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - return abortHandshake(this, this._req, msg); - } - - if (this._socket) { - this.readyState = WebSocket.CLOSING; - this._socket.destroy(); - } - } -} - -readyStates.forEach((readyState, i) => { - WebSocket[readyState] = i; -}); - -// -// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. -// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface -// -['open', 'error', 'close', 'message'].forEach((method) => { - Object.defineProperty(WebSocket.prototype, `on${method}`, { - /** - * Return the listener of the event. - * - * @return {(Function|undefined)} The event listener or `undefined` - * @public - */ - get() { - const listeners = this.listeners(method); - for (var i = 0; i < listeners.length; i++) { - if (listeners[i]._listener) return listeners[i]._listener; - } - - return undefined; - }, - /** - * Add a listener for the event. - * - * @param {Function} listener The listener to add - * @public - */ - set(listener) { - const listeners = this.listeners(method); - for (var i = 0; i < listeners.length; i++) { - // - // Remove only the listeners added via `addEventListener`. - // - if (listeners[i]._listener) this.removeListener(method, listeners[i]); - } - this.addEventListener(method, listener); - } - }); -}); - -WebSocket.prototype.addEventListener = EventTarget.addEventListener; -WebSocket.prototype.removeEventListener = EventTarget.removeEventListener; - -module.exports = WebSocket; - -/** - * Initialize a WebSocket client. - * - * @param {WebSocket} websocket The client to initialize - * @param {(String|url.Url|url.URL)} address The URL to which to connect - * @param {String} protocols The subprotocols - * @param {Object} options Connection options - * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable - * permessage-deflate - * @param {Number} options.handshakeTimeout Timeout in milliseconds for the - * handshake request - * @param {Number} options.protocolVersion Value of the `Sec-WebSocket-Version` - * header - * @param {String} options.origin Value of the `Origin` or - * `Sec-WebSocket-Origin` header - * @param {Number} options.maxPayload The maximum allowed message size - * @param {Boolean} options.followRedirects Whether or not to follow redirects - * @param {Number} options.maxRedirects The maximum number of redirects allowed - * @private - */ -function initAsClient(websocket, address, protocols, options) { - const opts = Object.assign( - { - protocolVersion: protocolVersions[1], - maxPayload: 100 * 1024 * 1024, - perMessageDeflate: true, - followRedirects: false, - maxRedirects: 10 - }, - options, - { - createConnection: undefined, - socketPath: undefined, - hostname: undefined, - protocol: undefined, - timeout: undefined, - method: undefined, - auth: undefined, - host: undefined, - path: undefined, - port: undefined - } - ); - - if (!protocolVersions.includes(opts.protocolVersion)) { - throw new RangeError( - `Unsupported protocol version: ${opts.protocolVersion} ` + - `(supported versions: ${protocolVersions.join(', ')})` - ); - } - - var parsedUrl; - - if (typeof address === 'object' && address.href !== undefined) { - parsedUrl = address; - websocket.url = address.href; - } else { - // - // The WHATWG URL constructor is not available on Node.js < 6.13.0 - // - parsedUrl = url.URL ? new url.URL(address) : url.parse(address); - websocket.url = address; - } - - const isUnixSocket = parsedUrl.protocol === 'ws+unix:'; - - if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { - throw new Error(`Invalid URL: ${websocket.url}`); - } - - const isSecure = - parsedUrl.protocol === 'wss:' || parsedUrl.protocol === 'https:'; - const defaultPort = isSecure ? 443 : 80; - const key = crypto.randomBytes(16).toString('base64'); - const get = isSecure ? https.get : http.get; - const path = parsedUrl.search - ? `${parsedUrl.pathname || '/'}${parsedUrl.search}` - : parsedUrl.pathname || '/'; - var perMessageDeflate; - - opts.createConnection = isSecure ? tlsConnect : netConnect; - opts.defaultPort = opts.defaultPort || defaultPort; - opts.port = parsedUrl.port || defaultPort; - opts.host = parsedUrl.hostname.startsWith('[') - ? parsedUrl.hostname.slice(1, -1) - : parsedUrl.hostname; - opts.headers = Object.assign( - { - 'Sec-WebSocket-Version': opts.protocolVersion, - 'Sec-WebSocket-Key': key, - Connection: 'Upgrade', - Upgrade: 'websocket' - }, - opts.headers - ); - opts.path = path; - opts.timeout = opts.handshakeTimeout; - - if (opts.perMessageDeflate) { - perMessageDeflate = new PerMessageDeflate( - opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, - false, - opts.maxPayload - ); - opts.headers['Sec-WebSocket-Extensions'] = extension.format({ - [PerMessageDeflate.extensionName]: perMessageDeflate.offer() - }); - } - if (protocols) { - opts.headers['Sec-WebSocket-Protocol'] = protocols; - } - if (opts.origin) { - if (opts.protocolVersion < 13) { - opts.headers['Sec-WebSocket-Origin'] = opts.origin; - } else { - opts.headers.Origin = opts.origin; - } - } - if (parsedUrl.auth) { - opts.auth = parsedUrl.auth; - } else if (parsedUrl.username || parsedUrl.password) { - opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; - } - - if (isUnixSocket) { - const parts = path.split(':'); - - opts.socketPath = parts[0]; - opts.path = parts[1]; - } - - var req = (websocket._req = get(opts)); - - if (opts.timeout) { - req.on('timeout', () => { - abortHandshake(websocket, req, 'Opening handshake has timed out'); - }); - } - - req.on('error', (err) => { - if (websocket._req.aborted) return; - - req = websocket._req = null; - websocket.readyState = WebSocket.CLOSING; - websocket.emit('error', err); - websocket.emitClose(); - }); - - req.on('response', (res) => { - const location = res.headers.location; - const statusCode = res.statusCode; - - if ( - location && - opts.followRedirects && - statusCode >= 300 && - statusCode < 400 - ) { - if (++websocket._redirects > opts.maxRedirects) { - abortHandshake(websocket, req, 'Maximum redirects exceeded'); - return; - } - - req.abort(); - - const addr = url.URL - ? new url.URL(location, address) - : url.resolve(address, location); - - initAsClient(websocket, addr, protocols, options); - } else if (!websocket.emit('unexpected-response', req, res)) { - abortHandshake( - websocket, - req, - `Unexpected server response: ${res.statusCode}` - ); - } - }); - - req.on('upgrade', (res, socket, head) => { - websocket.emit('upgrade', res); - - // - // The user may have closed the connection from a listener of the `upgrade` - // event. - // - if (websocket.readyState !== WebSocket.CONNECTING) return; - - req = websocket._req = null; - - const digest = crypto - .createHash('sha1') - .update(key + GUID) - .digest('base64'); - - if (res.headers['sec-websocket-accept'] !== digest) { - abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header'); - return; - } - - const serverProt = res.headers['sec-websocket-protocol']; - const protList = (protocols || '').split(/, */); - var protError; - - if (!protocols && serverProt) { - protError = 'Server sent a subprotocol but none was requested'; - } else if (protocols && !serverProt) { - protError = 'Server sent no subprotocol'; - } else if (serverProt && !protList.includes(serverProt)) { - protError = 'Server sent an invalid subprotocol'; - } - - if (protError) { - abortHandshake(websocket, socket, protError); - return; - } - - if (serverProt) websocket.protocol = serverProt; - - if (perMessageDeflate) { - try { - const extensions = extension.parse( - res.headers['sec-websocket-extensions'] - ); - - if (extensions[PerMessageDeflate.extensionName]) { - perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); - websocket._extensions[ - PerMessageDeflate.extensionName - ] = perMessageDeflate; - } - } catch (err) { - abortHandshake( - websocket, - socket, - 'Invalid Sec-WebSocket-Extensions header' - ); - return; - } - } - - websocket.setSocket(socket, head, opts.maxPayload); - }); -} - -/** - * Create a `net.Socket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {net.Socket} The newly created socket used to start the connection - * @private - */ -function netConnect(options) { - // - // Override `options.path` only if `options` is a copy of the original options - // object. This is always true on Node.js >= 8 but not on Node.js 6 where - // `options.socketPath` might be `undefined` even if the `socketPath` option - // was originally set. - // - if (options.protocolVersion) options.path = options.socketPath; - return net.connect(options); -} - -/** - * Create a `tls.TLSSocket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {tls.TLSSocket} The newly created socket used to start the connection - * @private - */ -function tlsConnect(options) { - options.path = undefined; - options.servername = options.servername || options.host; - return tls.connect(options); -} - -/** - * Abort the handshake and emit an error. - * - * @param {WebSocket} websocket The WebSocket instance - * @param {(http.ClientRequest|net.Socket)} stream The request to abort or the - * socket to destroy - * @param {String} message The error message - * @private - */ -function abortHandshake(websocket, stream, message) { - websocket.readyState = WebSocket.CLOSING; - - const err = new Error(message); - Error.captureStackTrace(err, abortHandshake); - - if (stream.setHeader) { - stream.abort(); - stream.once('abort', websocket.emitClose.bind(websocket)); - websocket.emit('error', err); - } else { - stream.destroy(err); - stream.once('error', websocket.emit.bind(websocket, 'error')); - stream.once('close', websocket.emitClose.bind(websocket)); - } -} - -/** - * The listener of the `Receiver` `'conclude'` event. - * - * @param {Number} code The status code - * @param {String} reason The reason for closing - * @private - */ -function receiverOnConclude(code, reason) { - const websocket = this[kWebSocket]; - - websocket._socket.removeListener('data', socketOnData); - websocket._socket.resume(); - - websocket._closeFrameReceived = true; - websocket._closeMessage = reason; - websocket._closeCode = code; - - if (code === 1005) websocket.close(); - else websocket.close(code, reason); -} - -/** - * The listener of the `Receiver` `'drain'` event. - * - * @private - */ -function receiverOnDrain() { - this[kWebSocket]._socket.resume(); -} - -/** - * The listener of the `Receiver` `'error'` event. - * - * @param {(RangeError|Error)} err The emitted error - * @private - */ -function receiverOnError(err) { - const websocket = this[kWebSocket]; - - websocket._socket.removeListener('data', socketOnData); - - websocket.readyState = WebSocket.CLOSING; - websocket._closeCode = err[kStatusCode]; - websocket.emit('error', err); - websocket._socket.destroy(); -} - -/** - * The listener of the `Receiver` `'finish'` event. - * - * @private - */ -function receiverOnFinish() { - this[kWebSocket].emitClose(); -} - -/** - * The listener of the `Receiver` `'message'` event. - * - * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The message - * @private - */ -function receiverOnMessage(data) { - this[kWebSocket].emit('message', data); -} - -/** - * The listener of the `Receiver` `'ping'` event. - * - * @param {Buffer} data The data included in the ping frame - * @private - */ -function receiverOnPing(data) { - const websocket = this[kWebSocket]; - - websocket.pong(data, !websocket._isServer, NOOP); - websocket.emit('ping', data); -} - -/** - * The listener of the `Receiver` `'pong'` event. - * - * @param {Buffer} data The data included in the pong frame - * @private - */ -function receiverOnPong(data) { - this[kWebSocket].emit('pong', data); -} - -/** - * The listener of the `net.Socket` `'close'` event. - * - * @private - */ -function socketOnClose() { - const websocket = this[kWebSocket]; - - this.removeListener('close', socketOnClose); - this.removeListener('end', socketOnEnd); - - websocket.readyState = WebSocket.CLOSING; - - // - // The close frame might not have been received or the `'end'` event emitted, - // for example, if the socket was destroyed due to an error. Ensure that the - // `receiver` stream is closed after writing any remaining buffered data to - // it. If the readable side of the socket is in flowing mode then there is no - // buffered data as everything has been already written and `readable.read()` - // will return `null`. If instead, the socket is paused, any possible buffered - // data will be read as a single chunk and emitted synchronously in a single - // `'data'` event. - // - websocket._socket.read(); - websocket._receiver.end(); - - this.removeListener('data', socketOnData); - this[kWebSocket] = undefined; - - clearTimeout(websocket._closeTimer); - - if ( - websocket._receiver._writableState.finished || - websocket._receiver._writableState.errorEmitted - ) { - websocket.emitClose(); - } else { - websocket._receiver.on('error', receiverOnFinish); - websocket._receiver.on('finish', receiverOnFinish); - } -} - -/** - * The listener of the `net.Socket` `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function socketOnData(chunk) { - if (!this[kWebSocket]._receiver.write(chunk)) { - this.pause(); - } -} - -/** - * The listener of the `net.Socket` `'end'` event. - * - * @private - */ -function socketOnEnd() { - const websocket = this[kWebSocket]; - - websocket.readyState = WebSocket.CLOSING; - websocket._receiver.end(); - this.end(); -} - -/** - * The listener of the `net.Socket` `'error'` event. - * - * @private - */ -function socketOnError() { - const websocket = this[kWebSocket]; - - this.removeListener('error', socketOnError); - this.on('error', NOOP); - - websocket.readyState = WebSocket.CLOSING; - this.destroy(); -} diff --git a/node_modules/ws/package.json b/node_modules/ws/package.json deleted file mode 100644 index fb9fe13c..00000000 --- a/node_modules/ws/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "_from": "ws@6.2.2", - "_id": "ws@6.2.2", - "_inBundle": false, - "_integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", - "_location": "/ws", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "ws@6.2.2", - "name": "ws", - "escapedName": "ws", - "rawSpec": "6.2.2", - "saveSpec": null, - "fetchSpec": "6.2.2" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", - "_shasum": "dd5cdbd57a9979916097652d78f1cc5faea0c32e", - "_spec": "ws@6.2.2", - "_where": "/home/jstaro/dev/com.tibber.athom", - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "browser": "browser.js", - "bugs": { - "url": "https://github.com/websockets/ws/issues" - }, - "bundleDependencies": false, - "dependencies": { - "async-limiter": "~1.0.0" - }, - "deprecated": false, - "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", - "devDependencies": { - "benchmark": "~2.1.4", - "bufferutil": "~4.0.0", - "coveralls": "~3.0.3", - "eslint": "~5.15.0", - "eslint-config-prettier": "~4.1.0", - "eslint-plugin-prettier": "~3.0.0", - "mocha": "~6.0.0", - "nyc": "~13.3.0", - "prettier": "~1.16.1", - "utf-8-validate": "~5.0.0" - }, - "files": [ - "browser.js", - "index.js", - "lib/*.js" - ], - "homepage": "https://github.com/websockets/ws", - "keywords": [ - "HyBi", - "Push", - "RFC-6455", - "WebSocket", - "WebSockets", - "real-time" - ], - "license": "MIT", - "main": "index.js", - "name": "ws", - "repository": { - "type": "git", - "url": "git+https://github.com/websockets/ws.git" - }, - "scripts": { - "integration": "npm run lint && mocha test/*.integration.js", - "lint": "eslint --ignore-path .gitignore . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yml}\"", - "test": "npm run lint && nyc --reporter=html --reporter=text mocha test/*.test.js" - }, - "version": "6.2.2" -} diff --git a/node_modules/yallist/LICENSE b/node_modules/yallist/LICENSE deleted file mode 100644 index 19129e31..00000000 --- a/node_modules/yallist/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -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. diff --git a/node_modules/yallist/README.md b/node_modules/yallist/README.md deleted file mode 100644 index f5861018..00000000 --- a/node_modules/yallist/README.md +++ /dev/null @@ -1,204 +0,0 @@ -# yallist - -Yet Another Linked List - -There are many doubly-linked list implementations like it, but this -one is mine. - -For when an array would be too big, and a Map can't be iterated in -reverse order. - - -[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist) - -## basic usage - -```javascript -var yallist = require('yallist') -var myList = yallist.create([1, 2, 3]) -myList.push('foo') -myList.unshift('bar') -// of course pop() and shift() are there, too -console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] -myList.forEach(function (k) { - // walk the list head to tail -}) -myList.forEachReverse(function (k, index, list) { - // walk the list tail to head -}) -var myDoubledList = myList.map(function (k) { - return k + k -}) -// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] -// mapReverse is also a thing -var myDoubledListReverse = myList.mapReverse(function (k) { - return k + k -}) // ['foofoo', 6, 4, 2, 'barbar'] - -var reduced = myList.reduce(function (set, entry) { - set += entry - return set -}, 'start') -console.log(reduced) // 'startfoo123bar' -``` - -## api - -The whole API is considered "public". - -Functions with the same name as an Array method work more or less the -same way. - -There's reverse versions of most things because that's the point. - -### Yallist - -Default export, the class that holds and manages a list. - -Call it with either a forEach-able (like an array) or a set of -arguments, to initialize the list. - -The Array-ish methods all act like you'd expect. No magic length, -though, so if you change that it won't automatically prune or add -empty spots. - -### Yallist.create(..) - -Alias for Yallist function. Some people like factories. - -#### yallist.head - -The first node in the list - -#### yallist.tail - -The last node in the list - -#### yallist.length - -The number of nodes in the list. (Change this at your peril. It is -not magic like Array length.) - -#### yallist.toArray() - -Convert the list to an array. - -#### yallist.forEach(fn, [thisp]) - -Call a function on each item in the list. - -#### yallist.forEachReverse(fn, [thisp]) - -Call a function on each item in the list, in reverse order. - -#### yallist.get(n) - -Get the data at position `n` in the list. If you use this a lot, -probably better off just using an Array. - -#### yallist.getReverse(n) - -Get the data at position `n`, counting from the tail. - -#### yallist.map(fn, thisp) - -Create a new Yallist with the result of calling the function on each -item. - -#### yallist.mapReverse(fn, thisp) - -Same as `map`, but in reverse. - -#### yallist.pop() - -Get the data from the list tail, and remove the tail from the list. - -#### yallist.push(item, ...) - -Insert one or more items to the tail of the list. - -#### yallist.reduce(fn, initialValue) - -Like Array.reduce. - -#### yallist.reduceReverse - -Like Array.reduce, but in reverse. - -#### yallist.reverse - -Reverse the list in place. - -#### yallist.shift() - -Get the data from the list head, and remove the head from the list. - -#### yallist.slice([from], [to]) - -Just like Array.slice, but returns a new Yallist. - -#### yallist.sliceReverse([from], [to]) - -Just like yallist.slice, but the result is returned in reverse. - -#### yallist.toArray() - -Create an array representation of the list. - -#### yallist.toArrayReverse() - -Create a reversed array representation of the list. - -#### yallist.unshift(item, ...) - -Insert one or more items to the head of the list. - -#### yallist.unshiftNode(node) - -Move a Node object to the front of the list. (That is, pull it out of -wherever it lives, and make it the new head.) - -If the node belongs to a different list, then that list will remove it -first. - -#### yallist.pushNode(node) - -Move a Node object to the end of the list. (That is, pull it out of -wherever it lives, and make it the new tail.) - -If the node belongs to a list already, then that list will remove it -first. - -#### yallist.removeNode(node) - -Remove a node from the list, preserving referential integrity of head -and tail and other nodes. - -Will throw an error if you try to have a list remove a node that -doesn't belong to it. - -### Yallist.Node - -The class that holds the data and is actually the list. - -Call with `var n = new Node(value, previousNode, nextNode)` - -Note that if you do direct operations on Nodes themselves, it's very -easy to get into weird states where the list is broken. Be careful :) - -#### node.next - -The next node in the list. - -#### node.prev - -The previous node in the list. - -#### node.value - -The data the node contains. - -#### node.list - -The list to which this node belongs. (Null if it does not belong to -any list.) diff --git a/node_modules/yallist/iterator.js b/node_modules/yallist/iterator.js deleted file mode 100644 index d41c97a1..00000000 --- a/node_modules/yallist/iterator.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -module.exports = function (Yallist) { - Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } - } -} diff --git a/node_modules/yallist/package.json b/node_modules/yallist/package.json deleted file mode 100644 index 602c75b7..00000000 --- a/node_modules/yallist/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "yallist@^4.0.0", - "_id": "yallist@4.0.0", - "_inBundle": false, - "_integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "_location": "/yallist", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "yallist@^4.0.0", - "name": "yallist", - "escapedName": "yallist", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/lru-cache" - ], - "_resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "_shasum": "9bb92790d9c0effec63be73519e11a35019a3a72", - "_spec": "yallist@^4.0.0", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/lru-cache", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/yallist/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Yet Another Linked List", - "devDependencies": { - "tap": "^12.1.0" - }, - "directories": { - "test": "test" - }, - "files": [ - "yallist.js", - "iterator.js" - ], - "homepage": "https://github.com/isaacs/yallist#readme", - "license": "ISC", - "main": "yallist.js", - "name": "yallist", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/yallist.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100" - }, - "version": "4.0.0" -} diff --git a/node_modules/yallist/yallist.js b/node_modules/yallist/yallist.js deleted file mode 100644 index 4e83ab1c..00000000 --- a/node_modules/yallist/yallist.js +++ /dev/null @@ -1,426 +0,0 @@ -'use strict' -module.exports = Yallist - -Yallist.Node = Node -Yallist.create = Yallist - -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } - - self.tail = null - self.head = null - self.length = 0 - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } - } - - return self -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') - } - - var next = node.next - var prev = node.prev - - if (next) { - next.prev = prev - } - - if (prev) { - prev.next = next - } - - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } - - node.list.length-- - node.next = null - node.prev = null - node.list = null - - return next -} - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node - } - - this.head = node - if (!this.tail) { - this.tail = node - } - this.length++ -} - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } - - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } - - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } - - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next - } -} - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res -} - -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } - - return acc -} - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } - - return acc -} - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next - } - return arr -} - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev - } - return arr -} - -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next - } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.splice = function (start, deleteCount, ...nodes) { - if (start > this.length) { - start = this.length - 1 - } - if (start < 0) { - start = this.length + start; - } - - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { - walker = walker.next - } - - var ret = [] - for (var i = 0; walker && i < deleteCount; i++) { - ret.push(walker.value) - walker = this.removeNode(walker) - } - if (walker === null) { - walker = this.tail - } - - if (walker !== this.head && walker !== this.tail) { - walker = walker.prev - } - - for (var i = 0; i < nodes.length; i++) { - walker = insert(this, walker, nodes[i]) - } - return ret; -} - -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} - -function insert (self, node, value) { - var inserted = node === self.head ? - new Node(value, null, node, self) : - new Node(value, node, node.next, self) - - if (inserted.next === null) { - self.tail = inserted - } - if (inserted.prev === null) { - self.head = inserted - } - - self.length++ - - return inserted -} - -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} - -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} - -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) - } - - this.list = list - this.value = value - - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null - } - - if (next) { - next.prev = this - this.next = next - } else { - this.next = null - } -} - -try { - // add if support for Symbol.iterator is present - require('./iterator.js')(Yallist) -} catch (er) {} diff --git a/node_modules/zen-observable-ts/CHANGELOG.md b/node_modules/zen-observable-ts/CHANGELOG.md deleted file mode 100644 index 116b7d96..00000000 --- a/node_modules/zen-observable-ts/CHANGELOG.md +++ /dev/null @@ -1,28 +0,0 @@ -# Change log - ----- - -**NOTE:** This changelog is no longer maintained. Changes are now tracked in -the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md). - ----- - -### 0.8.11 - -- No changes - -### 0.8.10 -- Added `graphql` 14 to peer and dev deps; Updated `@types/graphql` to 14
    - [@hwillson](http://github.com/hwillson) in [#789](https://github.com/apollographql/apollo-link/pull/789) - -### 0.8.9 -- fix to stop combining require and export [PR#559](https://github.com/apollographql/apollo-link/pull/559) - -### 0.8.8 -- revert to zen-observable 0.7 - -### 0.8.7 -- fixed typings - -### 0.8.6 -- initial publishing mirrors `zen-observable`'s versioning diff --git a/node_modules/zen-observable-ts/LICENSE b/node_modules/zen-observable-ts/LICENSE deleted file mode 100644 index 84df9059..00000000 --- a/node_modules/zen-observable-ts/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 zenparsing (Kevin Smith) -Copyright (c) 2016 - 2018 Meteor Development Group, Inc. - -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. diff --git a/node_modules/zen-observable-ts/lib/bundle.cjs.js b/node_modules/zen-observable-ts/lib/bundle.cjs.js deleted file mode 100644 index 4edc07af..00000000 --- a/node_modules/zen-observable-ts/lib/bundle.cjs.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var zenObservable = _interopDefault(require('zen-observable')); - -var Observable = zenObservable; - -exports.Observable = Observable; -exports.default = Observable; -//# sourceMappingURL=bundle.cjs.js.map diff --git a/node_modules/zen-observable-ts/lib/bundle.cjs.js.map b/node_modules/zen-observable-ts/lib/bundle.cjs.js.map deleted file mode 100644 index cb4d0b74..00000000 --- a/node_modules/zen-observable-ts/lib/bundle.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.cjs.js","sources":["bundle.esm.js"],"sourcesContent":["import zenObservable from 'zen-observable';\n\nvar Observable = zenObservable;\n\nexport default Observable;\nexport { Observable };\n//# sourceMappingURL=bundle.esm.js.map\n"],"names":[],"mappings":";;;;;;;;AAEG,IAAC,UAAU,GAAG;;;;;"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/bundle.esm.js b/node_modules/zen-observable-ts/lib/bundle.esm.js deleted file mode 100644 index b00615b4..00000000 --- a/node_modules/zen-observable-ts/lib/bundle.esm.js +++ /dev/null @@ -1,7 +0,0 @@ -import zenObservable from 'zen-observable'; - -var Observable = zenObservable; - -export default Observable; -export { Observable }; -//# sourceMappingURL=bundle.esm.js.map diff --git a/node_modules/zen-observable-ts/lib/bundle.esm.js.map b/node_modules/zen-observable-ts/lib/bundle.esm.js.map deleted file mode 100644 index f3af6e23..00000000 --- a/node_modules/zen-observable-ts/lib/bundle.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/zenObservable.ts"],"sourcesContent":["/* tslint:disable */\n\nimport zenObservable from 'zen-observable';\n\nnamespace Observable {\n\n}\n\nimport { ZenObservable } from './types';\n\nexport { ZenObservable };\n\nexport type Observer = ZenObservable.Observer;\nexport type Subscriber = ZenObservable.Subscriber;\nexport type ObservableLike = ZenObservable.ObservableLike;\n\nexport const Observable: {\n new (subscriber: Subscriber): Observable;\n from(\n observable: Observable | ZenObservable.ObservableLike | ArrayLike,\n ): Observable;\n of(...args: Array): Observable;\n} = zenObservable;\n\nexport interface Observable {\n subscribe(\n observerOrNext: ((value: T) => void) | ZenObservable.Observer,\n error?: (error: any) => void,\n complete?: () => void,\n ): ZenObservable.Subscription;\n\n forEach(fn: (value: T) => void): Promise;\n\n map(fn: (value: T) => R): Observable;\n\n filter(fn: (value: T) => boolean): Observable;\n\n reduce(\n fn: (previousValue: R | T, currentValue: T) => R | T,\n initialValue?: R | T,\n ): Observable;\n\n flatMap(fn: (value: T) => ZenObservable.ObservableLike): Observable;\n\n from(\n observable: Observable | ZenObservable.ObservableLike | ArrayLike,\n ): Observable;\n of(...args: Array): Observable;\n}\n"],"names":[],"mappings":";;IAgBa,UAAU,GAMd;;;;;"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/bundle.umd.js b/node_modules/zen-observable-ts/lib/bundle.umd.js deleted file mode 100644 index 6697a282..00000000 --- a/node_modules/zen-observable-ts/lib/bundle.umd.js +++ /dev/null @@ -1,17 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('zen-observable')) : - typeof define === 'function' && define.amd ? define(['exports', 'zen-observable'], factory) : - (global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.zenObservable = {}), global.Observable)); -}(this, (function (exports, zenObservable) { 'use strict'; - - zenObservable = zenObservable && zenObservable.hasOwnProperty('default') ? zenObservable['default'] : zenObservable; - - var Observable = zenObservable; - - exports.Observable = Observable; - exports.default = Observable; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=bundle.umd.js.map diff --git a/node_modules/zen-observable-ts/lib/bundle.umd.js.map b/node_modules/zen-observable-ts/lib/bundle.umd.js.map deleted file mode 100644 index 02267622..00000000 --- a/node_modules/zen-observable-ts/lib/bundle.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.umd.js","sources":["../src/zenObservable.ts"],"sourcesContent":["/* tslint:disable */\n\nimport zenObservable from 'zen-observable';\n\nnamespace Observable {\n\n}\n\nimport { ZenObservable } from './types';\n\nexport { ZenObservable };\n\nexport type Observer = ZenObservable.Observer;\nexport type Subscriber = ZenObservable.Subscriber;\nexport type ObservableLike = ZenObservable.ObservableLike;\n\nexport const Observable: {\n new (subscriber: Subscriber): Observable;\n from(\n observable: Observable | ZenObservable.ObservableLike | ArrayLike,\n ): Observable;\n of(...args: Array): Observable;\n} = zenObservable;\n\nexport interface Observable {\n subscribe(\n observerOrNext: ((value: T) => void) | ZenObservable.Observer,\n error?: (error: any) => void,\n complete?: () => void,\n ): ZenObservable.Subscription;\n\n forEach(fn: (value: T) => void): Promise;\n\n map(fn: (value: T) => R): Observable;\n\n filter(fn: (value: T) => boolean): Observable;\n\n reduce(\n fn: (previousValue: R | T, currentValue: T) => R | T,\n initialValue?: R | T,\n ): Observable;\n\n flatMap(fn: (value: T) => ZenObservable.ObservableLike): Observable;\n\n from(\n observable: Observable | ZenObservable.ObservableLike | ArrayLike,\n ): Observable;\n of(...args: Array): Observable;\n}\n"],"names":[],"mappings":";;;;;;;;MAgBa,UAAU,GAMd;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/index.d.ts b/node_modules/zen-observable-ts/lib/index.d.ts deleted file mode 100644 index 6b55561e..00000000 --- a/node_modules/zen-observable-ts/lib/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Observable } from './zenObservable'; -export * from './zenObservable'; -export default Observable; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/index.d.ts.map b/node_modules/zen-observable-ts/lib/index.d.ts.map deleted file mode 100644 index 7f791724..00000000 --- a/node_modules/zen-observable-ts/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,cAAc,iBAAiB,CAAC;AAChC,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/index.js b/node_modules/zen-observable-ts/lib/index.js deleted file mode 100644 index 86761b08..00000000 --- a/node_modules/zen-observable-ts/lib/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var zenObservable_1 = require("./zenObservable"); -tslib_1.__exportStar(require("./zenObservable"), exports); -exports.default = zenObservable_1.Observable; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/index.js.map b/node_modules/zen-observable-ts/lib/index.js.map deleted file mode 100644 index c2112a7d..00000000 --- a/node_modules/zen-observable-ts/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAE7C,0DAAgC;AAChC,kBAAe,0BAAU,CAAC"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/types.d.ts b/node_modules/zen-observable-ts/lib/types.d.ts deleted file mode 100644 index 80bfde6a..00000000 --- a/node_modules/zen-observable-ts/lib/types.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export declare namespace ZenObservable { - interface SubscriptionObserver { - closed: boolean; - next(value: T): void; - error(errorValue: any): void; - complete(): void; - } - interface Subscription { - closed: boolean; - unsubscribe(): void; - } - interface Observer { - start?(subscription: Subscription): any; - next?(value: T): void; - error?(errorValue: any): void; - complete?(): void; - } - type Subscriber = (observer: SubscriptionObserver) => void | (() => void) | Subscription; - interface ObservableLike { - subscribe?: Subscriber; - } -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/types.d.ts.map b/node_modules/zen-observable-ts/lib/types.d.ts.map deleted file mode 100644 index 1494bc53..00000000 --- a/node_modules/zen-observable-ts/lib/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,oBAAoB,CAAC,CAAC;QACrC,MAAM,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;QACrB,KAAK,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI,CAAC;QAC7B,QAAQ,IAAI,IAAI,CAAC;KAClB;IAED,UAAiB,YAAY;QAC3B,MAAM,EAAE,OAAO,CAAC;QAChB,WAAW,IAAI,IAAI,CAAC;KACrB;IAED,UAAiB,QAAQ,CAAC,CAAC;QACzB,KAAK,CAAC,CAAC,YAAY,EAAE,YAAY,GAAG,GAAG,CAAC;QACxC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI,CAAC;QAC9B,QAAQ,CAAC,IAAI,IAAI,CAAC;KACnB;IAED,KAAY,UAAU,CAAC,CAAC,IAAI,CAC1B,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAC9B,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,YAAY,CAAC;IAExC,UAAiB,cAAc,CAAC,CAAC;QAC/B,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;KAC3B;CACF"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/types.js b/node_modules/zen-observable-ts/lib/types.js deleted file mode 100644 index 11e638d1..00000000 --- a/node_modules/zen-observable-ts/lib/types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/types.js.map b/node_modules/zen-observable-ts/lib/types.js.map deleted file mode 100644 index c768b790..00000000 --- a/node_modules/zen-observable-ts/lib/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/zenObservable.d.ts b/node_modules/zen-observable-ts/lib/zenObservable.d.ts deleted file mode 100644 index 2142733f..00000000 --- a/node_modules/zen-observable-ts/lib/zenObservable.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ZenObservable } from './types'; -export { ZenObservable }; -export declare type Observer = ZenObservable.Observer; -export declare type Subscriber = ZenObservable.Subscriber; -export declare type ObservableLike = ZenObservable.ObservableLike; -export declare const Observable: { - new (subscriber: Subscriber): Observable; - from(observable: Observable | ZenObservable.ObservableLike | ArrayLike): Observable; - of(...args: Array): Observable; -}; -export interface Observable { - subscribe(observerOrNext: ((value: T) => void) | ZenObservable.Observer, error?: (error: any) => void, complete?: () => void): ZenObservable.Subscription; - forEach(fn: (value: T) => void): Promise; - map(fn: (value: T) => R): Observable; - filter(fn: (value: T) => boolean): Observable; - reduce(fn: (previousValue: R | T, currentValue: T) => R | T, initialValue?: R | T): Observable; - flatMap(fn: (value: T) => ZenObservable.ObservableLike): Observable; - from(observable: Observable | ZenObservable.ObservableLike | ArrayLike): Observable; - of(...args: Array): Observable; -} -//# sourceMappingURL=zenObservable.d.ts.map \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/zenObservable.d.ts.map b/node_modules/zen-observable-ts/lib/zenObservable.d.ts.map deleted file mode 100644 index 54855d1e..00000000 --- a/node_modules/zen-observable-ts/lib/zenObservable.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zenObservable.d.ts","sourceRoot":"","sources":["src/zenObservable.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,oBAAY,QAAQ,CAAC,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACpD,oBAAY,UAAU,CAAC,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACxD,oBAAY,cAAc,CAAC,CAAC,IAAI,aAAa,CAAC,cAAc,CAA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,GACnB,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAErB,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAE7E,IAAI,CAAC,CAAC,EACJ,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GACzE,UAAU,CAAC,CAAC,CAAC,CAAC;IACjB,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;CACzC"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/zenObservable.js b/node_modules/zen-observable-ts/lib/zenObservable.js deleted file mode 100644 index 747d83d2..00000000 --- a/node_modules/zen-observable-ts/lib/zenObservable.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var zen_observable_1 = tslib_1.__importDefault(require("zen-observable")); -exports.Observable = zen_observable_1.default; -//# sourceMappingURL=zenObservable.js.map \ No newline at end of file diff --git a/node_modules/zen-observable-ts/lib/zenObservable.js.map b/node_modules/zen-observable-ts/lib/zenObservable.js.map deleted file mode 100644 index 86e8589d..00000000 --- a/node_modules/zen-observable-ts/lib/zenObservable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zenObservable.js","sourceRoot":"","sources":["../src/zenObservable.ts"],"names":[],"mappings":";;;AAEA,0EAA2C;AAc9B,QAAA,UAAU,GAMd,wBAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/zen-observable-ts/package.json b/node_modules/zen-observable-ts/package.json deleted file mode 100644 index daaca52d..00000000 --- a/node_modules/zen-observable-ts/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "_from": "zen-observable-ts@^0.8.21", - "_id": "zen-observable-ts@0.8.21", - "_inBundle": false, - "_integrity": "sha512-Yj3yXweRc8LdRMrCC8nIc4kkjWecPAUVh0TI0OUrWXx6aX790vLcDlWca6I4vsyCGH3LpWxq0dJRcMOFoVqmeg==", - "_location": "/zen-observable-ts", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "zen-observable-ts@^0.8.21", - "name": "zen-observable-ts", - "escapedName": "zen-observable-ts", - "rawSpec": "^0.8.21", - "saveSpec": null, - "fetchSpec": "^0.8.21" - }, - "_requiredBy": [ - "/apollo-link" - ], - "_resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz", - "_shasum": "85d0031fbbde1eba3cd07d3ba90da241215f421d", - "_spec": "zen-observable-ts@^0.8.21", - "_where": "/mnt/c/Users/tonij/Source/Repos/com.tibber.athom/node_modules/apollo-link", - "author": { - "name": "Evans Hauser", - "email": "evanshauser@gmail.com" - }, - "bugs": { - "url": "https://github.com/apollographql/apollo-link/issues" - }, - "bundleDependencies": false, - "contributors": [], - "dependencies": { - "tslib": "^1.9.3", - "zen-observable": "^0.8.0" - }, - "deprecated": false, - "description": "An Implementation of ES Observables in Typescript", - "devDependencies": { - "@types/jest": "24.9.0", - "jest": "24.9.0", - "rimraf": "2.7.1", - "rollup": "1.29.1", - "ts-jest": "22.4.6", - "tslint": "5.20.1", - "typescript": "3.0.3" - }, - "gitHead": "1012934b4fd9ab436c4fdcd5e9b1bb1e4c1b0d98", - "homepage": "https://github.com/zenparsing/zen-observable", - "jest": { - "transform": { - ".(ts|tsx)": "ts-jest" - }, - "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ], - "testURL": "http://localhost" - }, - "license": "MIT", - "main": "./lib/index.js", - "module": "./lib/bundle.esm.js", - "name": "zen-observable-ts", - "repository": { - "type": "git", - "url": "git+https://github.com/apollographql/apollo-link.git" - }, - "scripts": { - "build": "tsc && rollup -c", - "clean": "rimraf lib/* && rimraf coverage/*", - "coverage": "jest --coverage", - "filesize": "../../scripts/minify", - "lint": "tslint -c \"../../tslint.json\" -p tsconfig.json -c ../../tslint.json src/*.ts", - "prebuild": "npm run clean", - "prepare": "npm run build", - "test": "npm run lint && jest", - "watch": "tsc -w -p ." - }, - "sideEffects": false, - "typings": "./lib/index.d.ts", - "version": "0.8.21" -} diff --git a/node_modules/zen-observable/.editorconfig b/node_modules/zen-observable/.editorconfig deleted file mode 100644 index d4eed840..00000000 --- a/node_modules/zen-observable/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -root = true - -[*] -end_of_line = lf -insert_final_newline = false -indent_style = space -indent_size = 2 diff --git a/node_modules/zen-observable/.eslintrc.js b/node_modules/zen-observable/.eslintrc.js deleted file mode 100644 index 3def7dc8..00000000 --- a/node_modules/zen-observable/.eslintrc.js +++ /dev/null @@ -1,47 +0,0 @@ -module.exports = { - "extends": ["eslint:recommended"], - - "env": { - "es6": true, - "node": true - }, - - "globals": { - "setTimeout": true - }, - - "parserOptions": { - "sourceType": "module" - }, - - "rules": { - "no-console": ["error", { "allow": ["warn", "error"] }], - "no-unsafe-finally": ["off"], - "camelcase": ["error", { "properties": "always" }], - "brace-style": ["off"], - "eqeqeq": ["error", "smart"], - "indent": ["error", 2, { "SwitchCase": 1 }], - "no-throw-literal": ["error"], - "comma-spacing": ["error", { "before": false, "after": true }], - "comma-style": ["error", "last"], - "comma-dangle": ["error", "always-multiline"], - "keyword-spacing": ["error"], - "no-trailing-spaces": ["error"], - "no-multi-spaces": ["error"], - "no-spaced-func": ["error"], - "no-whitespace-before-property": ["error"], - "space-before-blocks": ["error"], - "space-before-function-paren": ["error", "never"], - "space-in-parens": ["error", "never"], - "eol-last": ["error"], - "quotes": ["error", "single", { "avoidEscape": true }], - "no-implicit-globals": ["error"], - "no-useless-concat": ["error"], - "space-infix-ops": ["error", { "int32Hint": true }], - "semi-spacing": ["error", { "before": false, "after": true }], - "semi": ["error", "always", { "omitLastInOneLineBlock": true }], - "object-curly-spacing": ["error", "always"], - "array-bracket-spacing": ["error"], - "max-len": ["error", 100] - } -}; diff --git a/node_modules/zen-observable/LICENSE b/node_modules/zen-observable/LICENSE deleted file mode 100644 index d850f527..00000000 --- a/node_modules/zen-observable/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (c) 2018 zenparsing (Kevin Smith) - -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. diff --git a/node_modules/zen-observable/README.md b/node_modules/zen-observable/README.md deleted file mode 100644 index eff7a5c5..00000000 --- a/node_modules/zen-observable/README.md +++ /dev/null @@ -1,176 +0,0 @@ -# zen-observable - -An implementation of Observables for JavaScript. Requires Promises or a Promise polyfill. - -## Install - -```sh -npm install zen-observable -``` - -## Usage - -```js -import Observable from 'zen-observable'; - -Observable.of(1, 2, 3).subscribe(x => console.log(x)); -``` - -## API - -### new Observable(subscribe) - -```js -let observable = new Observable(observer => { - // Emit a single value after 1 second - let timer = setTimeout(() => { - observer.next('hello'); - observer.complete(); - }, 1000); - - // On unsubscription, cancel the timer - return () => clearTimeout(timer); -}); -``` - -Creates a new Observable object using the specified subscriber function. The subscriber function is called whenever the `subscribe` method of the observable object is invoked. The subscriber function is passed an *observer* object which has the following methods: - -- `next(value)` Sends the next value in the sequence. -- `error(exception)` Terminates the sequence with an exception. -- `complete()` Terminates the sequence successfully. -- `closed` A boolean property whose value is `true` if the observer's subscription is closed. - -The subscriber function can optionally return either a cleanup function or a subscription object. If it returns a cleanup function, that function will be called when the subscription has closed. If it returns a subscription object, then the subscription's `unsubscribe` method will be invoked when the subscription has closed. - -### Observable.of(...items) - -```js -// Logs 1, 2, 3 -Observable.of(1, 2, 3).subscribe(x => { - console.log(x); -}); -``` - -Returns an observable which will emit each supplied argument. - -### Observable.from(value) - -```js -let list = [1, 2, 3]; - -// Iterate over an object -Observable.from(list).subscribe(x => { - console.log(x); -}); -``` - -```js -// Convert something 'observable' to an Observable instance -Observable.from(otherObservable).subscribe(x => { - console.log(x); -}); -``` - -Converts `value` to an Observable. - -- If `value` is an implementation of Observable, then it is converted to an instance of Observable as defined by this library. -- Otherwise, it is converted to an Observable which synchronously iterates over `value`. - -### observable.subscribe([observer]) - -```js -let subscription = observable.subscribe({ - next(x) { console.log(x) }, - error(err) { console.log(`Finished with error: ${ err }`) }, - complete() { console.log('Finished') } -}); -``` - -Subscribes to the observable. Observer objects may have any of the following methods: - -- `next(value)` Receives the next value of the sequence. -- `error(exception)` Receives the terminating error of the sequence. -- `complete()` Called when the stream has completed successfully. - -Returns a subscription object that can be used to cancel the stream. - -### observable.subscribe(nextCallback[, errorCallback, completeCallback]) - -```js -let subscription = observable.subscribe( - x => console.log(x), - err => console.log(`Finished with error: ${ err }`), - () => console.log('Finished') -); -``` - -Subscribes to the observable with callback functions. Returns a subscription object that can be used to cancel the stream. - -### observable.forEach(callback) - -```js -observable.forEach(x => { - console.log(`Received value: ${ x }`); -}).then(() => { - console.log('Finished successfully') -}).catch(err => { - console.log(`Finished with error: ${ err }`); -}) -``` - -Subscribes to the observable and returns a Promise for the completion value of the stream. The `callback` argument is called once for each value in the stream. - -### observable.filter(callback) - -```js -Observable.of(1, 2, 3).filter(value => { - return value > 2; -}).subscribe(value => { - console.log(value); -}); -// 3 -``` - -Returns a new Observable that emits all values which pass the test implemented by the `callback` argument. - -### observable.map(callback) - -Returns a new Observable that emits the results of calling the `callback` argument for every value in the stream. - -```js -Observable.of(1, 2, 3).map(value => { - return value * 2; -}).subscribe(value => { - console.log(value); -}); -// 2 -// 4 -// 6 -``` - -### observable.reduce(callback [,initialValue]) - -```js -Observable.of(0, 1, 2, 3, 4).reduce((previousValue, currentValue) => { - return previousValue + currentValue; -}).subscribe(result => { - console.log(result); -}); -// 10 -``` - -Returns a new Observable that applies a function against an accumulator and each value of the stream to reduce it to a single value. - -### observable.concat(...sources) - -```js -Observable.of(1, 2, 3).concat( - Observable.of(4, 5, 6), - Observable.of(7, 8, 9) -).subscribe(result => { - console.log(result); -}); -// 1, 2, 3, 4, 5, 6, 7, 8, 9 -``` - -Merges the current observable with additional observables. diff --git a/node_modules/zen-observable/extras.js b/node_modules/zen-observable/extras.js deleted file mode 100644 index ab87de36..00000000 --- a/node_modules/zen-observable/extras.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/extras.js'); diff --git a/node_modules/zen-observable/index.js b/node_modules/zen-observable/index.js deleted file mode 100644 index 25c8a63c..00000000 --- a/node_modules/zen-observable/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/Observable.js').Observable; diff --git a/node_modules/zen-observable/lib/Observable.js b/node_modules/zen-observable/lib/Observable.js deleted file mode 100644 index 952d3d78..00000000 --- a/node_modules/zen-observable/lib/Observable.js +++ /dev/null @@ -1,610 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// === Symbol Support === - -var hasSymbols = function () { - return typeof Symbol === 'function'; -}; -var hasSymbol = function (name) { - return hasSymbols() && Boolean(Symbol[name]); -}; -var getSymbol = function (name) { - return hasSymbol(name) ? Symbol[name] : '@@' + name; -}; - -if (hasSymbols() && !hasSymbol('observable')) { - Symbol.observable = Symbol('observable'); -} - -var SymbolIterator = getSymbol('iterator'); -var SymbolObservable = getSymbol('observable'); -var SymbolSpecies = getSymbol('species'); - -// === Abstract Operations === - -function getMethod(obj, key) { - var value = obj[key]; - - if (value == null) return undefined; - - if (typeof value !== 'function') throw new TypeError(value + ' is not a function'); - - return value; -} - -function getSpecies(obj) { - var ctor = obj.constructor; - if (ctor !== undefined) { - ctor = ctor[SymbolSpecies]; - if (ctor === null) { - ctor = undefined; - } - } - return ctor !== undefined ? ctor : Observable; -} - -function isObservable(x) { - return x instanceof Observable; // SPEC: Brand check -} - -function hostReportError(e) { - if (hostReportError.log) { - hostReportError.log(e); - } else { - setTimeout(function () { - throw e; - }); - } -} - -function enqueue(fn) { - Promise.resolve().then(function () { - try { - fn(); - } catch (e) { - hostReportError(e); - } - }); -} - -function cleanupSubscription(subscription) { - var cleanup = subscription._cleanup; - if (cleanup === undefined) return; - - subscription._cleanup = undefined; - - if (!cleanup) { - return; - } - - try { - if (typeof cleanup === 'function') { - cleanup(); - } else { - var unsubscribe = getMethod(cleanup, 'unsubscribe'); - if (unsubscribe) { - unsubscribe.call(cleanup); - } - } - } catch (e) { - hostReportError(e); - } -} - -function closeSubscription(subscription) { - subscription._observer = undefined; - subscription._queue = undefined; - subscription._state = 'closed'; -} - -function flushSubscription(subscription) { - var queue = subscription._queue; - if (!queue) { - return; - } - subscription._queue = undefined; - subscription._state = 'ready'; - for (var i = 0; i < queue.length; ++i) { - notifySubscription(subscription, queue[i].type, queue[i].value); - if (subscription._state === 'closed') break; - } -} - -function notifySubscription(subscription, type, value) { - subscription._state = 'running'; - - var observer = subscription._observer; - - try { - var m = getMethod(observer, type); - switch (type) { - case 'next': - if (m) m.call(observer, value); - break; - case 'error': - closeSubscription(subscription); - if (m) m.call(observer, value);else throw value; - break; - case 'complete': - closeSubscription(subscription); - if (m) m.call(observer); - break; - } - } catch (e) { - hostReportError(e); - } - - if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready'; -} - -function onNotify(subscription, type, value) { - if (subscription._state === 'closed') return; - - if (subscription._state === 'buffering') { - subscription._queue.push({ type: type, value: value }); - return; - } - - if (subscription._state !== 'ready') { - subscription._state = 'buffering'; - subscription._queue = [{ type: type, value: value }]; - enqueue(function () { - return flushSubscription(subscription); - }); - return; - } - - notifySubscription(subscription, type, value); -} - -var Subscription = function () { - function Subscription(observer, subscriber) { - _classCallCheck(this, Subscription); - - // ASSERT: observer is an object - // ASSERT: subscriber is callable - - this._cleanup = undefined; - this._observer = observer; - this._queue = undefined; - this._state = 'initializing'; - - var subscriptionObserver = new SubscriptionObserver(this); - - try { - this._cleanup = subscriber.call(undefined, subscriptionObserver); - } catch (e) { - subscriptionObserver.error(e); - } - - if (this._state === 'initializing') this._state = 'ready'; - } - - _createClass(Subscription, [{ - key: 'unsubscribe', - value: function unsubscribe() { - if (this._state !== 'closed') { - closeSubscription(this); - cleanupSubscription(this); - } - } - }, { - key: 'closed', - get: function () { - return this._state === 'closed'; - } - }]); - - return Subscription; -}(); - -var SubscriptionObserver = function () { - function SubscriptionObserver(subscription) { - _classCallCheck(this, SubscriptionObserver); - - this._subscription = subscription; - } - - _createClass(SubscriptionObserver, [{ - key: 'next', - value: function next(value) { - onNotify(this._subscription, 'next', value); - } - }, { - key: 'error', - value: function error(value) { - onNotify(this._subscription, 'error', value); - } - }, { - key: 'complete', - value: function complete() { - onNotify(this._subscription, 'complete'); - } - }, { - key: 'closed', - get: function () { - return this._subscription._state === 'closed'; - } - }]); - - return SubscriptionObserver; -}(); - -var Observable = exports.Observable = function () { - function Observable(subscriber) { - _classCallCheck(this, Observable); - - if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function'); - - if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function'); - - this._subscriber = subscriber; - } - - _createClass(Observable, [{ - key: 'subscribe', - value: function subscribe(observer) { - if (typeof observer !== 'object' || observer === null) { - observer = { - next: observer, - error: arguments[1], - complete: arguments[2] - }; - } - return new Subscription(observer, this._subscriber); - } - }, { - key: 'forEach', - value: function forEach(fn) { - var _this = this; - - return new Promise(function (resolve, reject) { - if (typeof fn !== 'function') { - reject(new TypeError(fn + ' is not a function')); - return; - } - - function done() { - subscription.unsubscribe(); - resolve(); - } - - var subscription = _this.subscribe({ - next: function (value) { - try { - fn(value, done); - } catch (e) { - reject(e); - subscription.unsubscribe(); - } - }, - - error: reject, - complete: resolve - }); - }); - } - }, { - key: 'map', - value: function map(fn) { - var _this2 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - - var C = getSpecies(this); - - return new C(function (observer) { - return _this2.subscribe({ - next: function (value) { - try { - value = fn(value); - } catch (e) { - return observer.error(e); - } - observer.next(value); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - observer.complete(); - } - }); - }); - } - }, { - key: 'filter', - value: function filter(fn) { - var _this3 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - - var C = getSpecies(this); - - return new C(function (observer) { - return _this3.subscribe({ - next: function (value) { - try { - if (!fn(value)) return; - } catch (e) { - return observer.error(e); - } - observer.next(value); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - observer.complete(); - } - }); - }); - } - }, { - key: 'reduce', - value: function reduce(fn) { - var _this4 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - - var C = getSpecies(this); - var hasSeed = arguments.length > 1; - var hasValue = false; - var seed = arguments[1]; - var acc = seed; - - return new C(function (observer) { - return _this4.subscribe({ - next: function (value) { - var first = !hasValue; - hasValue = true; - - if (!first || hasSeed) { - try { - acc = fn(acc, value); - } catch (e) { - return observer.error(e); - } - } else { - acc = value; - } - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence')); - - observer.next(acc); - observer.complete(); - } - }); - }); - } - }, { - key: 'concat', - value: function concat() { - var _this5 = this; - - for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; - } - - var C = getSpecies(this); - - return new C(function (observer) { - var subscription = void 0; - var index = 0; - - function startNext(next) { - subscription = next.subscribe({ - next: function (v) { - observer.next(v); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - if (index === sources.length) { - subscription = undefined; - observer.complete(); - } else { - startNext(C.from(sources[index++])); - } - } - }); - } - - startNext(_this5); - - return function () { - if (subscription) { - subscription.unsubscribe(); - subscription = undefined; - } - }; - }); - } - }, { - key: 'flatMap', - value: function flatMap(fn) { - var _this6 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - - var C = getSpecies(this); - - return new C(function (observer) { - var subscriptions = []; - - var outer = _this6.subscribe({ - next: function (value) { - if (fn) { - try { - value = fn(value); - } catch (e) { - return observer.error(e); - } - } - - var inner = C.from(value).subscribe({ - next: function (value) { - observer.next(value); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - var i = subscriptions.indexOf(inner); - if (i >= 0) subscriptions.splice(i, 1); - completeIfDone(); - } - }); - - subscriptions.push(inner); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - completeIfDone(); - } - }); - - function completeIfDone() { - if (outer.closed && subscriptions.length === 0) observer.complete(); - } - - return function () { - subscriptions.forEach(function (s) { - return s.unsubscribe(); - }); - outer.unsubscribe(); - }; - }); - } - }, { - key: SymbolObservable, - value: function () { - return this; - } - }], [{ - key: 'from', - value: function from(x) { - var C = typeof this === 'function' ? this : Observable; - - if (x == null) throw new TypeError(x + ' is not an object'); - - var method = getMethod(x, SymbolObservable); - if (method) { - var observable = method.call(x); - - if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object'); - - if (isObservable(observable) && observable.constructor === C) return observable; - - return new C(function (observer) { - return observable.subscribe(observer); - }); - } - - if (hasSymbol('iterator')) { - method = getMethod(x, SymbolIterator); - if (method) { - return new C(function (observer) { - enqueue(function () { - if (observer.closed) return; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = method.call(x)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var item = _step.value; - - observer.next(item); - if (observer.closed) return; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - observer.complete(); - }); - }); - } - } - - if (Array.isArray(x)) { - return new C(function (observer) { - enqueue(function () { - if (observer.closed) return; - for (var i = 0; i < x.length; ++i) { - observer.next(x[i]); - if (observer.closed) return; - } - observer.complete(); - }); - }); - } - - throw new TypeError(x + ' is not observable'); - } - }, { - key: 'of', - value: function of() { - for (var _len2 = arguments.length, items = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - items[_key2] = arguments[_key2]; - } - - var C = typeof this === 'function' ? this : Observable; - - return new C(function (observer) { - enqueue(function () { - if (observer.closed) return; - for (var i = 0; i < items.length; ++i) { - observer.next(items[i]); - if (observer.closed) return; - } - observer.complete(); - }); - }); - } - }, { - key: SymbolSpecies, - get: function () { - return this; - } - }]); - - return Observable; -}(); - -if (hasSymbols()) { - Object.defineProperty(Observable, Symbol('extensions'), { - value: { - symbol: SymbolObservable, - hostReportError: hostReportError - }, - configurable: true - }); -} \ No newline at end of file diff --git a/node_modules/zen-observable/lib/extras.js b/node_modules/zen-observable/lib/extras.js deleted file mode 100644 index 42a2eecf..00000000 --- a/node_modules/zen-observable/lib/extras.js +++ /dev/null @@ -1,140 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.merge = merge; -exports.combineLatest = combineLatest; -exports.zip = zip; - -var _Observable = require('./Observable.js'); - -// Emits all values from all inputs in parallel -function merge() { - for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; - } - - return new _Observable.Observable(function (observer) { - if (sources.length === 0) return _Observable.Observable.from([]); - - var count = sources.length; - - var subscriptions = sources.map(function (source) { - return _Observable.Observable.from(source).subscribe({ - next: function (v) { - observer.next(v); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - if (--count === 0) observer.complete(); - } - }); - }); - - return function () { - return subscriptions.forEach(function (s) { - return s.unsubscribe(); - }); - }; - }); -} - -// Emits arrays containing the most current values from each input -function combineLatest() { - for (var _len2 = arguments.length, sources = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - sources[_key2] = arguments[_key2]; - } - - return new _Observable.Observable(function (observer) { - if (sources.length === 0) return _Observable.Observable.from([]); - - var count = sources.length; - var seen = new Set(); - var seenAll = false; - var values = sources.map(function () { - return undefined; - }); - - var subscriptions = sources.map(function (source, index) { - return _Observable.Observable.from(source).subscribe({ - next: function (v) { - values[index] = v; - - if (!seenAll) { - seen.add(index); - if (seen.size !== sources.length) return; - - seen = null; - seenAll = true; - } - - observer.next(Array.from(values)); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - if (--count === 0) observer.complete(); - } - }); - }); - - return function () { - return subscriptions.forEach(function (s) { - return s.unsubscribe(); - }); - }; - }); -} - -// Emits arrays containing the matching index values from each input -function zip() { - for (var _len3 = arguments.length, sources = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - sources[_key3] = arguments[_key3]; - } - - return new _Observable.Observable(function (observer) { - if (sources.length === 0) return _Observable.Observable.from([]); - - var queues = sources.map(function () { - return []; - }); - - function done() { - return queues.some(function (q, i) { - return q.length === 0 && subscriptions[i].closed; - }); - } - - var subscriptions = sources.map(function (source, index) { - return _Observable.Observable.from(source).subscribe({ - next: function (v) { - queues[index].push(v); - if (queues.every(function (q) { - return q.length > 0; - })) { - observer.next(queues.map(function (q) { - return q.shift(); - })); - if (done()) observer.complete(); - } - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - if (done()) observer.complete(); - } - }); - }); - - return function () { - return subscriptions.forEach(function (s) { - return s.unsubscribe(); - }); - }; - }); -} \ No newline at end of file diff --git a/node_modules/zen-observable/package.json b/node_modules/zen-observable/package.json deleted file mode 100644 index 7bcb5c0b..00000000 --- a/node_modules/zen-observable/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_args": [ - [ - "zen-observable@0.8.14", - "/c/Users/tonij/Source/Repos/com.tibber.athom" - ] - ], - "_from": "zen-observable@0.8.14", - "_id": "zen-observable@0.8.14", - "_inBundle": false, - "_integrity": "sha512-kQz39uonEjEESwh+qCi83kcC3rZJGh4mrZW7xjkSQYXkq//JZHTtKo+6yuVloTgMtzsIWOJrjIrKvk/dqm0L5g==", - "_location": "/zen-observable", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "zen-observable@0.8.14", - "name": "zen-observable", - "escapedName": "zen-observable", - "rawSpec": "0.8.14", - "saveSpec": null, - "fetchSpec": "0.8.14" - }, - "_requiredBy": [ - "/apollo-client", - "/zen-observable-ts" - ], - "_resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.14.tgz", - "_spec": "0.8.14", - "_where": "/c/Users/tonij/Source/Repos/com.tibber.athom", - "bugs": { - "url": "https://github.com/zenparsing/zen-observable/issues" - }, - "dependencies": {}, - "description": "An Implementation of ES Observables", - "devDependencies": { - "babel-cli": "^6.26.0", - "babel-preset-es2015": "^6.24.1", - "eslint": "^5.16.0", - "mocha": "^6.1.2" - }, - "homepage": "https://github.com/zenparsing/zen-observable", - "license": "MIT", - "name": "zen-observable", - "repository": { - "type": "git", - "url": "git+https://github.com/zenparsing/zen-observable.git" - }, - "scripts": { - "build": "git clean -dfX ./lib && node ./scripts/build", - "lint": "eslint src/*", - "prepublishOnly": "eslint src/* && npm test && npm run build", - "test": "mocha --recursive --require ./scripts/mocha-require" - }, - "version": "0.8.14" -} diff --git a/node_modules/zen-observable/scripts/babel-plugins.js b/node_modules/zen-observable/scripts/babel-plugins.js deleted file mode 100644 index 144266cd..00000000 --- a/node_modules/zen-observable/scripts/babel-plugins.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = [ - 'transform-es2015-arrow-functions', - 'transform-es2015-block-scoped-functions', - 'transform-es2015-block-scoping', - 'transform-es2015-classes', - 'transform-es2015-computed-properties', - 'transform-es2015-destructuring', - 'transform-es2015-duplicate-keys', - 'transform-es2015-for-of', - 'transform-es2015-literals', - 'transform-es2015-modules-commonjs', - 'transform-es2015-parameters', - 'transform-es2015-shorthand-properties', - 'transform-es2015-spread', - 'transform-es2015-template-literals', -]; diff --git a/node_modules/zen-observable/scripts/build.js b/node_modules/zen-observable/scripts/build.js deleted file mode 100644 index f4c8fa63..00000000 --- a/node_modules/zen-observable/scripts/build.js +++ /dev/null @@ -1,7 +0,0 @@ -const { execSync } = require('child_process'); -const plugins = require('./babel-plugins'); - -execSync('babel src --out-dir lib --plugins=' + plugins.join(','), { - env: process.env, - stdio: 'inherit', -}); diff --git a/node_modules/zen-observable/scripts/mocha-require.js b/node_modules/zen-observable/scripts/mocha-require.js deleted file mode 100644 index c93f68cc..00000000 --- a/node_modules/zen-observable/scripts/mocha-require.js +++ /dev/null @@ -1,3 +0,0 @@ -require('babel-core/register')({ - plugins: require('./babel-plugins'), -}); diff --git a/node_modules/zen-observable/src/Observable.js b/node_modules/zen-observable/src/Observable.js deleted file mode 100644 index 9364bc0a..00000000 --- a/node_modules/zen-observable/src/Observable.js +++ /dev/null @@ -1,476 +0,0 @@ -// === Symbol Support === - -const hasSymbols = () => typeof Symbol === 'function'; -const hasSymbol = name => hasSymbols() && Boolean(Symbol[name]); -const getSymbol = name => hasSymbol(name) ? Symbol[name] : '@@' + name; - -if (hasSymbols() && !hasSymbol('observable')) { - Symbol.observable = Symbol('observable'); -} - -const SymbolIterator = getSymbol('iterator'); -const SymbolObservable = getSymbol('observable'); -const SymbolSpecies = getSymbol('species'); - -// === Abstract Operations === - -function getMethod(obj, key) { - let value = obj[key]; - - if (value == null) - return undefined; - - if (typeof value !== 'function') - throw new TypeError(value + ' is not a function'); - - return value; -} - -function getSpecies(obj) { - let ctor = obj.constructor; - if (ctor !== undefined) { - ctor = ctor[SymbolSpecies]; - if (ctor === null) { - ctor = undefined; - } - } - return ctor !== undefined ? ctor : Observable; -} - -function isObservable(x) { - return x instanceof Observable; // SPEC: Brand check -} - -function hostReportError(e) { - if (hostReportError.log) { - hostReportError.log(e); - } else { - setTimeout(() => { throw e }); - } -} - -function enqueue(fn) { - Promise.resolve().then(() => { - try { fn() } - catch (e) { hostReportError(e) } - }); -} - -function cleanupSubscription(subscription) { - let cleanup = subscription._cleanup; - if (cleanup === undefined) - return; - - subscription._cleanup = undefined; - - if (!cleanup) { - return; - } - - try { - if (typeof cleanup === 'function') { - cleanup(); - } else { - let unsubscribe = getMethod(cleanup, 'unsubscribe'); - if (unsubscribe) { - unsubscribe.call(cleanup); - } - } - } catch (e) { - hostReportError(e); - } -} - -function closeSubscription(subscription) { - subscription._observer = undefined; - subscription._queue = undefined; - subscription._state = 'closed'; -} - -function flushSubscription(subscription) { - let queue = subscription._queue; - if (!queue) { - return; - } - subscription._queue = undefined; - subscription._state = 'ready'; - for (let i = 0; i < queue.length; ++i) { - notifySubscription(subscription, queue[i].type, queue[i].value); - if (subscription._state === 'closed') - break; - } -} - -function notifySubscription(subscription, type, value) { - subscription._state = 'running'; - - let observer = subscription._observer; - - try { - let m = getMethod(observer, type); - switch (type) { - case 'next': - if (m) m.call(observer, value); - break; - case 'error': - closeSubscription(subscription); - if (m) m.call(observer, value); - else throw value; - break; - case 'complete': - closeSubscription(subscription); - if (m) m.call(observer); - break; - } - } catch (e) { - hostReportError(e); - } - - if (subscription._state === 'closed') - cleanupSubscription(subscription); - else if (subscription._state === 'running') - subscription._state = 'ready'; -} - -function onNotify(subscription, type, value) { - if (subscription._state === 'closed') - return; - - if (subscription._state === 'buffering') { - subscription._queue.push({ type, value }); - return; - } - - if (subscription._state !== 'ready') { - subscription._state = 'buffering'; - subscription._queue = [{ type, value }]; - enqueue(() => flushSubscription(subscription)); - return; - } - - notifySubscription(subscription, type, value); -} - - -class Subscription { - - constructor(observer, subscriber) { - // ASSERT: observer is an object - // ASSERT: subscriber is callable - - this._cleanup = undefined; - this._observer = observer; - this._queue = undefined; - this._state = 'initializing'; - - let subscriptionObserver = new SubscriptionObserver(this); - - try { - this._cleanup = subscriber.call(undefined, subscriptionObserver); - } catch (e) { - subscriptionObserver.error(e); - } - - if (this._state === 'initializing') - this._state = 'ready'; - } - - get closed() { - return this._state === 'closed'; - } - - unsubscribe() { - if (this._state !== 'closed') { - closeSubscription(this); - cleanupSubscription(this); - } - } -} - -class SubscriptionObserver { - constructor(subscription) { this._subscription = subscription } - get closed() { return this._subscription._state === 'closed' } - next(value) { onNotify(this._subscription, 'next', value) } - error(value) { onNotify(this._subscription, 'error', value) } - complete() { onNotify(this._subscription, 'complete') } -} - -export class Observable { - - constructor(subscriber) { - if (!(this instanceof Observable)) - throw new TypeError('Observable cannot be called as a function'); - - if (typeof subscriber !== 'function') - throw new TypeError('Observable initializer must be a function'); - - this._subscriber = subscriber; - } - - subscribe(observer) { - if (typeof observer !== 'object' || observer === null) { - observer = { - next: observer, - error: arguments[1], - complete: arguments[2], - }; - } - return new Subscription(observer, this._subscriber); - } - - forEach(fn) { - return new Promise((resolve, reject) => { - if (typeof fn !== 'function') { - reject(new TypeError(fn + ' is not a function')); - return; - } - - function done() { - subscription.unsubscribe(); - resolve(); - } - - let subscription = this.subscribe({ - next(value) { - try { - fn(value, done); - } catch (e) { - reject(e); - subscription.unsubscribe(); - } - }, - error: reject, - complete: resolve, - }); - }); - } - - map(fn) { - if (typeof fn !== 'function') - throw new TypeError(fn + ' is not a function'); - - let C = getSpecies(this); - - return new C(observer => this.subscribe({ - next(value) { - try { value = fn(value) } - catch (e) { return observer.error(e) } - observer.next(value); - }, - error(e) { observer.error(e) }, - complete() { observer.complete() }, - })); - } - - filter(fn) { - if (typeof fn !== 'function') - throw new TypeError(fn + ' is not a function'); - - let C = getSpecies(this); - - return new C(observer => this.subscribe({ - next(value) { - try { if (!fn(value)) return; } - catch (e) { return observer.error(e) } - observer.next(value); - }, - error(e) { observer.error(e) }, - complete() { observer.complete() }, - })); - } - - reduce(fn) { - if (typeof fn !== 'function') - throw new TypeError(fn + ' is not a function'); - - let C = getSpecies(this); - let hasSeed = arguments.length > 1; - let hasValue = false; - let seed = arguments[1]; - let acc = seed; - - return new C(observer => this.subscribe({ - - next(value) { - let first = !hasValue; - hasValue = true; - - if (!first || hasSeed) { - try { acc = fn(acc, value) } - catch (e) { return observer.error(e) } - } else { - acc = value; - } - }, - - error(e) { observer.error(e) }, - - complete() { - if (!hasValue && !hasSeed) - return observer.error(new TypeError('Cannot reduce an empty sequence')); - - observer.next(acc); - observer.complete(); - }, - - })); - } - - concat(...sources) { - let C = getSpecies(this); - - return new C(observer => { - let subscription; - let index = 0; - - function startNext(next) { - subscription = next.subscribe({ - next(v) { observer.next(v) }, - error(e) { observer.error(e) }, - complete() { - if (index === sources.length) { - subscription = undefined; - observer.complete(); - } else { - startNext(C.from(sources[index++])); - } - }, - }); - } - - startNext(this); - - return () => { - if (subscription) { - subscription.unsubscribe(); - subscription = undefined; - } - }; - }); - } - - flatMap(fn) { - if (typeof fn !== 'function') - throw new TypeError(fn + ' is not a function'); - - let C = getSpecies(this); - - return new C(observer => { - let subscriptions = []; - - let outer = this.subscribe({ - next(value) { - if (fn) { - try { value = fn(value) } - catch (e) { return observer.error(e) } - } - - let inner = C.from(value).subscribe({ - next(value) { observer.next(value) }, - error(e) { observer.error(e) }, - complete() { - let i = subscriptions.indexOf(inner); - if (i >= 0) subscriptions.splice(i, 1); - completeIfDone(); - }, - }); - - subscriptions.push(inner); - }, - error(e) { observer.error(e) }, - complete() { completeIfDone() }, - }); - - function completeIfDone() { - if (outer.closed && subscriptions.length === 0) - observer.complete(); - } - - return () => { - subscriptions.forEach(s => s.unsubscribe()); - outer.unsubscribe(); - }; - }); - } - - [SymbolObservable]() { return this } - - static from(x) { - let C = typeof this === 'function' ? this : Observable; - - if (x == null) - throw new TypeError(x + ' is not an object'); - - let method = getMethod(x, SymbolObservable); - if (method) { - let observable = method.call(x); - - if (Object(observable) !== observable) - throw new TypeError(observable + ' is not an object'); - - if (isObservable(observable) && observable.constructor === C) - return observable; - - return new C(observer => observable.subscribe(observer)); - } - - if (hasSymbol('iterator')) { - method = getMethod(x, SymbolIterator); - if (method) { - return new C(observer => { - enqueue(() => { - if (observer.closed) return; - for (let item of method.call(x)) { - observer.next(item); - if (observer.closed) return; - } - observer.complete(); - }); - }); - } - } - - if (Array.isArray(x)) { - return new C(observer => { - enqueue(() => { - if (observer.closed) return; - for (let i = 0; i < x.length; ++i) { - observer.next(x[i]); - if (observer.closed) return; - } - observer.complete(); - }); - }); - } - - throw new TypeError(x + ' is not observable'); - } - - static of(...items) { - let C = typeof this === 'function' ? this : Observable; - - return new C(observer => { - enqueue(() => { - if (observer.closed) return; - for (let i = 0; i < items.length; ++i) { - observer.next(items[i]); - if (observer.closed) return; - } - observer.complete(); - }); - }); - } - - static get [SymbolSpecies]() { return this } - -} - -if (hasSymbols()) { - Object.defineProperty(Observable, Symbol('extensions'), { - value: { - symbol: SymbolObservable, - hostReportError, - }, - configurable: true, - }); -} diff --git a/node_modules/zen-observable/src/extras.js b/node_modules/zen-observable/src/extras.js deleted file mode 100644 index ca6b6f7b..00000000 --- a/node_modules/zen-observable/src/extras.js +++ /dev/null @@ -1,99 +0,0 @@ -import { Observable } from './Observable.js'; - -// Emits all values from all inputs in parallel -export function merge(...sources) { - return new Observable(observer => { - if (sources.length === 0) - return Observable.from([]); - - let count = sources.length; - - let subscriptions = sources.map(source => Observable.from(source).subscribe({ - next(v) { - observer.next(v); - }, - error(e) { - observer.error(e); - }, - complete() { - if (--count === 0) - observer.complete(); - }, - })); - - return () => subscriptions.forEach(s => s.unsubscribe()); - }); -} - -// Emits arrays containing the most current values from each input -export function combineLatest(...sources) { - return new Observable(observer => { - if (sources.length === 0) - return Observable.from([]); - - let count = sources.length; - let seen = new Set(); - let seenAll = false; - let values = sources.map(() => undefined); - - let subscriptions = sources.map((source, index) => Observable.from(source).subscribe({ - next(v) { - values[index] = v; - - if (!seenAll) { - seen.add(index); - if (seen.size !== sources.length) - return; - - seen = null; - seenAll = true; - } - - observer.next(Array.from(values)); - }, - error(e) { - observer.error(e); - }, - complete() { - if (--count === 0) - observer.complete(); - }, - })); - - return () => subscriptions.forEach(s => s.unsubscribe()); - }); -} - -// Emits arrays containing the matching index values from each input -export function zip(...sources) { - return new Observable(observer => { - if (sources.length === 0) - return Observable.from([]); - - let queues = sources.map(() => []); - - function done() { - return queues.some((q, i) => q.length === 0 && subscriptions[i].closed); - } - - let subscriptions = sources.map((source, index) => Observable.from(source).subscribe({ - next(v) { - queues[index].push(v); - if (queues.every(q => q.length > 0)) { - observer.next(queues.map(q => q.shift())); - if (done()) - observer.complete(); - } - }, - error(e) { - observer.error(e); - }, - complete() { - if (done()) - observer.complete(); - }, - })); - - return () => subscriptions.forEach(s => s.unsubscribe()); - }); -} diff --git a/node_modules/zen-observable/test/concat.js b/node_modules/zen-observable/test/concat.js deleted file mode 100644 index 30079d48..00000000 --- a/node_modules/zen-observable/test/concat.js +++ /dev/null @@ -1,30 +0,0 @@ -import assert from 'assert'; - -describe('concat', () => { - it('concatenates the supplied Observable arguments', async () => { - let list = []; - - await Observable - .from([1, 2, 3, 4]) - .concat(Observable.of(5, 6, 7)) - .forEach(x => list.push(x)); - - assert.deepEqual(list, [1, 2, 3, 4, 5, 6, 7]); - }); - - it('can be used multiple times to produce the same results', async () => { - const list1 = []; - const list2 = []; - - const concatenated = Observable.from([1, 2, 3, 4]) - .concat(Observable.of(5, 6, 7)); - - await concatenated - .forEach(x => list1.push(x)); - await concatenated - .forEach(x => list2.push(x)); - - assert.deepEqual(list1, [1, 2, 3, 4, 5, 6, 7]); - assert.deepEqual(list2, [1, 2, 3, 4, 5, 6, 7]); - }); -}); diff --git a/node_modules/zen-observable/test/constructor.js b/node_modules/zen-observable/test/constructor.js deleted file mode 100644 index 4d93b7fd..00000000 --- a/node_modules/zen-observable/test/constructor.js +++ /dev/null @@ -1,36 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('constructor', () => { - it('throws if called as a function', () => { - assert.throws(() => Observable(() => {})); - assert.throws(() => Observable.call({}, () => {})); - }); - - it('throws if the argument is not callable', () => { - assert.throws(() => new Observable({})); - assert.throws(() => new Observable()); - assert.throws(() => new Observable(1)); - assert.throws(() => new Observable('string')); - }); - - it('accepts a function argument', () => { - let result = new Observable(() => {}); - assert.ok(result instanceof Observable); - }); - - it('is the value of Observable.prototype.constructor', () => { - testMethodProperty(Observable.prototype, 'constructor', { - configurable: true, - writable: true, - length: 1, - }); - }); - - it('does not call the subscriber function', () => { - let called = 0; - new Observable(() => { called++ }); - assert.equal(called, 0); - }); - -}); diff --git a/node_modules/zen-observable/test/extras/combine-latest.js b/node_modules/zen-observable/test/extras/combine-latest.js deleted file mode 100644 index ec2c920e..00000000 --- a/node_modules/zen-observable/test/extras/combine-latest.js +++ /dev/null @@ -1,43 +0,0 @@ -import assert from 'assert'; -import { parse } from './parse.js'; -import { combineLatest } from '../../src/extras.js'; - -describe('extras/combineLatest', () => { - it('should emit arrays containing the most recent values', async () => { - let output = []; - await combineLatest( - parse('a-b-c-d'), - parse('-A-B-C-D') - ).forEach( - value => output.push(value.join('')) - ); - assert.deepEqual(output, [ - 'aA', - 'bA', - 'bB', - 'cB', - 'cC', - 'dC', - 'dD', - ]); - }); - - it('should emit values in the correct order', async () => { - let output = []; - await combineLatest( - parse('-a-b-c-d'), - parse('A-B-C-D') - ).forEach( - value => output.push(value.join('')) - ); - assert.deepEqual(output, [ - 'aA', - 'aB', - 'bB', - 'bC', - 'cC', - 'cD', - 'dD', - ]); - }); -}); diff --git a/node_modules/zen-observable/test/extras/merge.js b/node_modules/zen-observable/test/extras/merge.js deleted file mode 100644 index 4b637ca4..00000000 --- a/node_modules/zen-observable/test/extras/merge.js +++ /dev/null @@ -1,16 +0,0 @@ -import assert from 'assert'; -import { parse } from './parse.js'; -import { merge } from '../../src/extras.js'; - -describe('extras/merge', () => { - it('should emit all data from each input in parallel', async () => { - let output = ''; - await merge( - parse('a-b-c-d'), - parse('-A-B-C-D') - ).forEach( - value => output += value - ); - assert.equal(output, 'aAbBcCdD'); - }); -}); diff --git a/node_modules/zen-observable/test/extras/parse.js b/node_modules/zen-observable/test/extras/parse.js deleted file mode 100644 index f22de31d..00000000 --- a/node_modules/zen-observable/test/extras/parse.js +++ /dev/null @@ -1,11 +0,0 @@ -export function parse(string) { - return new Observable(async observer => { - await null; - for (let char of string) { - if (observer.closed) return; - else if (char !== '-') observer.next(char); - await null; - } - observer.complete(); - }); -} diff --git a/node_modules/zen-observable/test/extras/zip.js b/node_modules/zen-observable/test/extras/zip.js deleted file mode 100644 index 94225d24..00000000 --- a/node_modules/zen-observable/test/extras/zip.js +++ /dev/null @@ -1,21 +0,0 @@ -import assert from 'assert'; -import { parse } from './parse.js'; -import { zip } from '../../src/extras.js'; - -describe('extras/zip', () => { - it('should emit pairs of corresponding index values', async () => { - let output = []; - await zip( - parse('a-b-c-d'), - parse('-A-B-C-D') - ).forEach( - value => output.push(value.join('')) - ); - assert.deepEqual(output, [ - 'aA', - 'bB', - 'cC', - 'dD', - ]); - }); -}); diff --git a/node_modules/zen-observable/test/filter.js b/node_modules/zen-observable/test/filter.js deleted file mode 100644 index 36ad88fe..00000000 --- a/node_modules/zen-observable/test/filter.js +++ /dev/null @@ -1,14 +0,0 @@ -import assert from 'assert'; - -describe('filter', () => { - it('filters the results using the supplied callback', async () => { - let list = []; - - await Observable - .from([1, 2, 3, 4]) - .filter(x => x > 2) - .forEach(x => list.push(x)); - - assert.deepEqual(list, [3, 4]); - }); -}); diff --git a/node_modules/zen-observable/test/flat-map.js b/node_modules/zen-observable/test/flat-map.js deleted file mode 100644 index 64cca896..00000000 --- a/node_modules/zen-observable/test/flat-map.js +++ /dev/null @@ -1,23 +0,0 @@ -import assert from 'assert'; - -describe('flatMap', () => { - it('maps and flattens the results using the supplied callback', async () => { - let list = []; - - await Observable.of('a', 'b', 'c').flatMap(x => - Observable.of(1, 2, 3).map(y => [x, y]) - ).forEach(x => list.push(x)); - - assert.deepEqual(list, [ - ['a', 1], - ['a', 2], - ['a', 3], - ['b', 1], - ['b', 2], - ['b', 3], - ['c', 1], - ['c', 2], - ['c', 3], - ]); - }); -}); diff --git a/node_modules/zen-observable/test/for-each.js b/node_modules/zen-observable/test/for-each.js deleted file mode 100644 index 69c55907..00000000 --- a/node_modules/zen-observable/test/for-each.js +++ /dev/null @@ -1,70 +0,0 @@ -import assert from 'assert'; - -describe('forEach', () => { - - it('rejects if the argument is not a function', async () => { - let promise = Observable.of(1, 2, 3).forEach(); - try { - await promise; - assert.ok(false); - } catch (err) { - assert.equal(err.name, 'TypeError'); - } - }); - - it('rejects if the callback throws', async () => { - let error = {}; - try { - await Observable.of(1, 2, 3).forEach(x => { throw error }); - assert.ok(false); - } catch (err) { - assert.equal(err, error); - } - }); - - it('does not execute callback after callback throws', async () => { - let calls = []; - try { - await Observable.of(1, 2, 3).forEach(x => { - calls.push(x); - throw {}; - }); - assert.ok(false); - } catch (err) { - assert.deepEqual(calls, [1]); - } - }); - - it('rejects if the producer calls error', async () => { - let error = {}; - try { - let observer; - let promise = new Observable(x => { observer = x }).forEach(() => {}); - observer.error(error); - await promise; - assert.ok(false); - } catch (err) { - assert.equal(err, error); - } - }); - - it('resolves with undefined if the producer calls complete', async () => { - let observer; - let promise = new Observable(x => { observer = x }).forEach(() => {}); - observer.complete(); - assert.equal(await promise, undefined); - }); - - it('provides a cancellation function as the second argument', async () => { - let observer; - let results = []; - await Observable.of(1, 2, 3).forEach((value, cancel) => { - results.push(value); - if (value > 1) { - return cancel(); - } - }); - assert.deepEqual(results, [1, 2]); - }); - -}); diff --git a/node_modules/zen-observable/test/from.js b/node_modules/zen-observable/test/from.js deleted file mode 100644 index cc7378e8..00000000 --- a/node_modules/zen-observable/test/from.js +++ /dev/null @@ -1,95 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('from', () => { - const iterable = { - *[Symbol.iterator]() { - yield 1; - yield 2; - yield 3; - }, - }; - - it('is a method on Observable', () => { - testMethodProperty(Observable, 'from', { - configurable: true, - writable: true, - length: 1, - }); - }); - - it('throws if the argument is null', () => { - assert.throws(() => Observable.from(null)); - }); - - it('throws if the argument is undefined', () => { - assert.throws(() => Observable.from(undefined)); - }); - - it('throws if the argument is not observable or iterable', () => { - assert.throws(() => Observable.from({})); - }); - - describe('observables', () => { - it('returns the input if the constructor matches "this"', () => { - let ctor = function() {}; - let observable = new Observable(() => {}); - observable.constructor = ctor; - assert.equal(Observable.from.call(ctor, observable), observable); - }); - - it('wraps the input if it is not an instance of Observable', () => { - let obj = { - 'constructor': Observable, - [Symbol.observable]() { return this }, - }; - assert.ok(Observable.from(obj) !== obj); - }); - - it('throws if @@observable property is not a method', () => { - assert.throws(() => Observable.from({ - [Symbol.observable]: 1 - })); - }); - - it('returns an observable wrapping @@observable result', () => { - let inner = { - subscribe(x) { - observer = x; - return () => { cleanupCalled = true }; - }, - }; - let observer; - let cleanupCalled = true; - let observable = Observable.from({ - [Symbol.observable]() { return inner }, - }); - observable.subscribe(); - assert.equal(typeof observer.next, 'function'); - observer.complete(); - assert.equal(cleanupCalled, true); - }); - }); - - describe('iterables', () => { - it('throws if @@iterator is not a method', () => { - assert.throws(() => Observable.from({ [Symbol.iterator]: 1 })); - }); - - it('returns an observable wrapping iterables', async () => { - let calls = []; - let subscription = Observable.from(iterable).subscribe({ - next(v) { calls.push(['next', v]) }, - complete() { calls.push(['complete']) }, - }); - assert.deepEqual(calls, []); - await null; - assert.deepEqual(calls, [ - ['next', 1], - ['next', 2], - ['next', 3], - ['complete'], - ]); - }); - }); -}); diff --git a/node_modules/zen-observable/test/map.js b/node_modules/zen-observable/test/map.js deleted file mode 100644 index 22d25d84..00000000 --- a/node_modules/zen-observable/test/map.js +++ /dev/null @@ -1,13 +0,0 @@ -import assert from 'assert'; - -describe('map', () => { - it('maps the results using the supplied callback', async () => { - let list = []; - - await Observable.from([1, 2, 3]) - .map(x => x * 2) - .forEach(x => list.push(x)); - - assert.deepEqual(list, [2, 4, 6]); - }); -}); diff --git a/node_modules/zen-observable/test/observer-closed.js b/node_modules/zen-observable/test/observer-closed.js deleted file mode 100644 index b39db546..00000000 --- a/node_modules/zen-observable/test/observer-closed.js +++ /dev/null @@ -1,35 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('observer.closed', () => { - it('is a getter on SubscriptionObserver.prototype', () => { - let observer; - new Observable(x => { observer = x }).subscribe(); - testMethodProperty(Object.getPrototypeOf(observer), 'closed', { - get: true, - configurable: true, - writable: true, - length: 1 - }); - }); - - it('returns false when the subscription is open', () => { - new Observable(observer => { - assert.equal(observer.closed, false); - }).subscribe(); - }); - - it('returns true when the subscription is completed', () => { - let observer; - new Observable(x => { observer = x; }).subscribe(); - observer.complete(); - assert.equal(observer.closed, true); - }); - - it('returns true when the subscription is errored', () => { - let observer; - new Observable(x => { observer = x; }).subscribe(null, () => {}); - observer.error(); - assert.equal(observer.closed, true); - }); -}); diff --git a/node_modules/zen-observable/test/observer-complete.js b/node_modules/zen-observable/test/observer-complete.js deleted file mode 100644 index 77ff824f..00000000 --- a/node_modules/zen-observable/test/observer-complete.js +++ /dev/null @@ -1,143 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('observer.complete', () => { - - function getObserver(inner) { - let observer; - new Observable(x => { observer = x }).subscribe(inner); - return observer; - } - - it('is a method of SubscriptionObserver', () => { - let observer = getObserver(); - testMethodProperty(Object.getPrototypeOf(observer), 'complete', { - configurable: true, - writable: true, - length: 0, - }); - }); - - it('does not forward arguments', () => { - let args; - let observer = getObserver({ complete(...a) { args = a } }); - observer.complete(1); - assert.deepEqual(args, []); - }); - - it('does not return a value', () => { - let observer = getObserver({ complete() { return 1 } }); - assert.equal(observer.complete(), undefined); - }); - - it('does not forward when the subscription is complete', () => { - let count = 0; - let observer = getObserver({ complete() { count++ } }); - observer.complete(); - observer.complete(); - assert.equal(count, 1); - }); - - it('does not forward when the subscription is cancelled', () => { - let count = 0; - let observer; - let subscription = new Observable(x => { observer = x }).subscribe({ - complete() { count++ }, - }); - subscription.unsubscribe(); - observer.complete(); - assert.equal(count, 0); - }); - - it('queues if the subscription is not initialized', async () => { - let completed = false; - new Observable(x => { x.complete() }).subscribe({ - complete() { completed = true }, - }); - assert.equal(completed, false); - await null; - assert.equal(completed, true); - }); - - it('queues if the observer is running', async () => { - let observer; - let completed = false - new Observable(x => { observer = x }).subscribe({ - next() { observer.complete() }, - complete() { completed = true }, - }); - observer.next(); - assert.equal(completed, false); - await null; - assert.equal(completed, true); - }); - - it('closes the subscription before invoking inner observer', () => { - let closed; - let observer = getObserver({ - complete() { closed = observer.closed }, - }); - observer.complete(); - assert.equal(closed, true); - }); - - it('reports error if "complete" is not a method', () => { - let observer = getObserver({ complete: 1 }); - observer.complete(); - assert.ok(hostError instanceof Error); - }); - - it('does not report error if "complete" is undefined', () => { - let observer = getObserver({ complete: undefined }); - observer.complete(); - assert.ok(!hostError); - }); - - it('does not report error if "complete" is null', () => { - let observer = getObserver({ complete: null }); - observer.complete(); - assert.ok(!hostError); - }); - - it('reports error if "complete" throws', () => { - let error = {}; - let observer = getObserver({ complete() { throw error } }); - observer.complete(); - assert.equal(hostError, error); - }); - - it('calls the cleanup method after "complete"', () => { - let calls = []; - let observer; - new Observable(x => { - observer = x; - return () => { calls.push('cleanup') }; - }).subscribe({ - complete() { calls.push('complete') }, - }); - observer.complete(); - assert.deepEqual(calls, ['complete', 'cleanup']); - }); - - it('calls the cleanup method if there is no "complete"', () => { - let calls = []; - let observer; - new Observable(x => { - observer = x; - return () => { calls.push('cleanup') }; - }).subscribe({}); - observer.complete(); - assert.deepEqual(calls, ['cleanup']); - }); - - it('reports error if the cleanup function throws', () => { - let error = {}; - let observer; - new Observable(x => { - observer = x; - return () => { throw error }; - }).subscribe(); - observer.complete(); - assert.equal(hostError, error); - }); -}); diff --git a/node_modules/zen-observable/test/observer-error.js b/node_modules/zen-observable/test/observer-error.js deleted file mode 100644 index 0a1d9f1b..00000000 --- a/node_modules/zen-observable/test/observer-error.js +++ /dev/null @@ -1,145 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('observer.error', () => { - - function getObserver(inner) { - let observer; - new Observable(x => { observer = x }).subscribe(inner); - return observer; - } - - it('is a method of SubscriptionObserver', () => { - let observer = getObserver(); - testMethodProperty(Object.getPrototypeOf(observer), 'error', { - configurable: true, - writable: true, - length: 1, - }); - }); - - it('forwards the argument', () => { - let args; - let observer = getObserver({ error(...a) { args = a } }); - observer.error(1); - assert.deepEqual(args, [1]); - }); - - it('does not return a value', () => { - let observer = getObserver({ error() { return 1 } }); - assert.equal(observer.error(), undefined); - }); - - it('does not throw when the subscription is complete', () => { - let observer = getObserver({ error() {} }); - observer.complete(); - observer.error('error'); - }); - - it('does not throw when the subscription is cancelled', () => { - let observer; - let subscription = new Observable(x => { observer = x }).subscribe({ - error() {}, - }); - subscription.unsubscribe(); - observer.error(1); - assert.ok(!hostError); - }); - - it('queues if the subscription is not initialized', async () => { - let error; - new Observable(x => { x.error({}) }).subscribe({ - error(err) { error = err }, - }); - assert.equal(error, undefined); - await null; - assert.ok(error); - }); - - it('queues if the observer is running', async () => { - let observer; - let error; - new Observable(x => { observer = x }).subscribe({ - next() { observer.error({}) }, - error(e) { error = e }, - }); - observer.next(); - assert.ok(!error); - await null; - assert.ok(error); - }); - - it('closes the subscription before invoking inner observer', () => { - let closed; - let observer = getObserver({ - error() { closed = observer.closed }, - }); - observer.error(1); - assert.equal(closed, true); - }); - - it('reports an error if "error" is not a method', () => { - let observer = getObserver({ error: 1 }); - observer.error(1); - assert.ok(hostError); - }); - - it('reports an error if "error" is undefined', () => { - let error = {}; - let observer = getObserver({ error: undefined }); - observer.error(error); - assert.equal(hostError, error); - }); - - it('reports an error if "error" is null', () => { - let error = {}; - let observer = getObserver({ error: null }); - observer.error(error); - assert.equal(hostError, error); - }); - - it('reports error if "error" throws', () => { - let error = {}; - let observer = getObserver({ error() { throw error } }); - observer.error(1); - assert.equal(hostError, error); - }); - - it('calls the cleanup method after "error"', () => { - let calls = []; - let observer; - new Observable(x => { - observer = x; - return () => { calls.push('cleanup') }; - }).subscribe({ - error() { calls.push('error') }, - }); - observer.error(); - assert.deepEqual(calls, ['error', 'cleanup']); - }); - - it('calls the cleanup method if there is no "error"', () => { - let calls = []; - let observer; - new Observable(x => { - observer = x; - return () => { calls.push('cleanup') }; - }).subscribe({}); - try { - observer.error(); - } catch (err) {} - assert.deepEqual(calls, ['cleanup']); - }); - - it('reports error if the cleanup function throws', () => { - let error = {}; - let observer; - new Observable(x => { - observer = x; - return () => { throw error }; - }).subscribe(); - observer.error(1); - assert.equal(hostError, error); - }); - -}); diff --git a/node_modules/zen-observable/test/observer-next.js b/node_modules/zen-observable/test/observer-next.js deleted file mode 100644 index abe1b851..00000000 --- a/node_modules/zen-observable/test/observer-next.js +++ /dev/null @@ -1,137 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('observer.next', () => { - - function getObserver(inner) { - let observer; - new Observable(x => { observer = x }).subscribe(inner); - return observer; - } - - it('is a method of SubscriptionObserver', () => { - let observer = getObserver(); - testMethodProperty(Object.getPrototypeOf(observer), 'next', { - configurable: true, - writable: true, - length: 1, - }); - }); - - it('forwards the first argument', () => { - let args; - let observer = getObserver({ next(...a) { args = a } }); - observer.next(1, 2); - assert.deepEqual(args, [1]); - }); - - it('does not return a value', () => { - let observer = getObserver({ next() { return 1 } }); - assert.equal(observer.next(), undefined); - }); - - it('does not forward when the subscription is complete', () => { - let count = 0; - let observer = getObserver({ next() { count++ } }); - observer.complete(); - observer.next(); - assert.equal(count, 0); - }); - - it('does not forward when the subscription is cancelled', () => { - let count = 0; - let observer; - let subscription = new Observable(x => { observer = x }).subscribe({ - next() { count++ }, - }); - subscription.unsubscribe(); - observer.next(); - assert.equal(count, 0); - }); - - it('remains closed if the subscription is cancelled from "next"', () => { - let observer; - let subscription = new Observable(x => { observer = x }).subscribe({ - next() { subscription.unsubscribe() }, - }); - observer.next(); - assert.equal(observer.closed, true); - }); - - it('queues if the subscription is not initialized', async () => { - let values = []; - let observer; - new Observable(x => { observer = x, x.next(1) }).subscribe({ - next(val) { - values.push(val); - if (val === 1) { - observer.next(3); - } - }, - }); - observer.next(2); - assert.deepEqual(values, []); - await null; - assert.deepEqual(values, [1, 2]); - await null; - assert.deepEqual(values, [1, 2, 3]); - }); - - it('drops queue if subscription is closed', async () => { - let values = []; - let subscription = new Observable(x => { x.next(1) }).subscribe({ - next(val) { values.push(val) }, - }); - assert.deepEqual(values, []); - subscription.unsubscribe(); - await null; - assert.deepEqual(values, []); - }); - - it('queues if the observer is running', async () => { - let observer; - let values = []; - new Observable(x => { observer = x }).subscribe({ - next(val) { - values.push(val); - if (val === 1) observer.next(2); - }, - }); - observer.next(1); - assert.deepEqual(values, [1]); - await null; - assert.deepEqual(values, [1, 2]); - }); - - it('reports error if "next" is not a method', () => { - let observer = getObserver({ next: 1 }); - observer.next(); - assert.ok(hostError); - }); - - it('does not report error if "next" is undefined', () => { - let observer = getObserver({ next: undefined }); - observer.next(); - assert.ok(!hostError); - }); - - it('does not report error if "next" is null', () => { - let observer = getObserver({ next: null }); - observer.next(); - assert.ok(!hostError); - }); - - it('reports error if "next" throws', () => { - let error = {}; - let observer = getObserver({ next() { throw error } }); - observer.next(); - assert.equal(hostError, error); - }); - - it('does not close the subscription on error', () => { - let observer = getObserver({ next() { throw {} } }); - observer.next(); - assert.equal(observer.closed, false); - }); - -}); diff --git a/node_modules/zen-observable/test/of.js b/node_modules/zen-observable/test/of.js deleted file mode 100644 index 6e4558cd..00000000 --- a/node_modules/zen-observable/test/of.js +++ /dev/null @@ -1,32 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('of', () => { - it('is a method on Observable', () => { - testMethodProperty(Observable, 'of', { - configurable: true, - writable: true, - length: 0, - }); - }); - - it('uses the this value if it is a function', () => { - let usesThis = false; - Observable.of.call(function() { usesThis = true; }); - assert.ok(usesThis); - }); - - it('uses Observable if the this value is not a function', () => { - let result = Observable.of.call({}, 1, 2, 3, 4); - assert.ok(result instanceof Observable); - }); - - it('delivers arguments to next in a job', async () => { - let values = []; - let turns = 0; - Observable.of(1, 2, 3, 4).subscribe(v => values.push(v)); - assert.equal(values.length, 0); - await null; - assert.deepEqual(values, [1, 2, 3, 4]); - }); -}); diff --git a/node_modules/zen-observable/test/properties.js b/node_modules/zen-observable/test/properties.js deleted file mode 100644 index 5c530227..00000000 --- a/node_modules/zen-observable/test/properties.js +++ /dev/null @@ -1,31 +0,0 @@ -import assert from 'assert'; - -export function testMethodProperty(object, key, options) { - let desc = Object.getOwnPropertyDescriptor(object, key); - let { enumerable = false, configurable = false, writable = false, length } = options; - - assert.ok(desc, `Property ${ key.toString() } exists`); - - if (options.get || options.set) { - if (options.get) { - assert.equal(typeof desc.get, 'function', 'Getter is a function'); - assert.equal(desc.get.length, 0, 'Getter length is 0'); - } else { - assert.equal(desc.get, undefined, 'Getter is undefined'); - } - - if (options.set) { - assert.equal(typeof desc.set, 'function', 'Setter is a function'); - assert.equal(desc.set.length, 1, 'Setter length is 1'); - } else { - assert.equal(desc.set, undefined, 'Setter is undefined'); - } - } else { - assert.equal(typeof desc.value, 'function', 'Value is a function'); - assert.equal(desc.value.length, length, `Function length is ${ length }`); - assert.equal(desc.writable, writable, `Writable property is correct ${ writable }`); - } - - assert.equal(desc.enumerable, enumerable, `Enumerable property is ${ enumerable }`); - assert.equal(desc.configurable, configurable, `Configurable property is ${ configurable }`); -} diff --git a/node_modules/zen-observable/test/reduce.js b/node_modules/zen-observable/test/reduce.js deleted file mode 100644 index a40023a5..00000000 --- a/node_modules/zen-observable/test/reduce.js +++ /dev/null @@ -1,38 +0,0 @@ -import assert from 'assert'; - -describe('reduce', () => { - it('reduces without a seed', async () => { - await Observable.from([1, 2, 3, 4, 5, 6]).reduce((a, b) => { - return a + b; - }).forEach(x => { - assert.equal(x, 21); - }); - }); - - it('errors if empty and no seed', async () => { - try { - await Observable.from([]).reduce((a, b) => { - return a + b; - }).forEach(() => null); - assert.ok(false); - } catch (err) { - assert.ok(true); - } - }); - - it('reduces with a seed', async () => { - Observable.from([1, 2, 3, 4, 5, 6]).reduce((a, b) => { - return a + b; - }, 100).forEach(x => { - assert.equal(x, 121); - }); - }); - - it('reduces an empty list with a seed', async () => { - await Observable.from([]).reduce((a, b) => { - return a + b; - }, 100).forEach(x => { - assert.equal(x, 100); - }); - }); -}); diff --git a/node_modules/zen-observable/test/setup.js b/node_modules/zen-observable/test/setup.js deleted file mode 100644 index 1cb73328..00000000 --- a/node_modules/zen-observable/test/setup.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Observable } from '../src/Observable.js'; - -beforeEach(() => { - global.Observable = Observable; - global.hostError = null; - let $extensions = Object.getOwnPropertySymbols(Observable)[1]; - let { hostReportError } = Observable[$extensions]; - hostReportError.log = (e => global.hostError = e); -}); diff --git a/node_modules/zen-observable/test/species.js b/node_modules/zen-observable/test/species.js deleted file mode 100644 index 3774029b..00000000 --- a/node_modules/zen-observable/test/species.js +++ /dev/null @@ -1,28 +0,0 @@ -import assert from 'assert'; - -describe('species', () => { - it('uses Observable when constructor is undefined', () => { - let instance = new Observable(() => {}); - instance.constructor = undefined; - assert.ok(instance.map(x => x) instanceof Observable); - }); - - it('uses Observable if species is null', () => { - let instance = new Observable(() => {}); - instance.constructor = { [Symbol.species]: null }; - assert.ok(instance.map(x => x) instanceof Observable); - }); - - it('uses Observable if species is undefined', () => { - let instance = new Observable(() => {}); - instance.constructor = { [Symbol.species]: undefined }; - assert.ok(instance.map(x => x) instanceof Observable); - }); - - it('uses value of Symbol.species', () => { - function ctor() {} - let instance = new Observable(() => {}); - instance.constructor = { [Symbol.species]: ctor }; - assert.ok(instance.map(x => x) instanceof ctor); - }); -}); diff --git a/node_modules/zen-observable/test/subscribe.js b/node_modules/zen-observable/test/subscribe.js deleted file mode 100644 index 4ed4aa34..00000000 --- a/node_modules/zen-observable/test/subscribe.js +++ /dev/null @@ -1,137 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('subscribe', () => { - - it('is a method of Observable.prototype', () => { - testMethodProperty(Observable.prototype, 'subscribe', { - configurable: true, - writable: true, - length: 1, - }); - }); - - it('accepts an observer argument', () => { - let observer; - let nextValue; - new Observable(x => observer = x).subscribe({ - next(v) { nextValue = v }, - }); - observer.next(1); - assert.equal(nextValue, 1); - }); - - it('accepts a next function argument', () => { - let observer; - let nextValue; - new Observable(x => observer = x).subscribe( - v => nextValue = v - ); - observer.next(1); - assert.equal(nextValue, 1); - }); - - it('accepts an error function argument', () => { - let observer; - let errorValue; - let error = {}; - new Observable(x => observer = x).subscribe( - null, - e => errorValue = e - ); - observer.error(error); - assert.equal(errorValue, error); - }); - - it('accepts a complete function argument', () => { - let observer; - let completed = false; - new Observable(x => observer = x).subscribe( - null, - null, - () => completed = true - ); - observer.complete(); - assert.equal(completed, true); - }); - - it('uses function overload if first argument is null', () => { - let observer; - let completed = false; - new Observable(x => observer = x).subscribe( - null, - null, - () => completed = true - ); - observer.complete(); - assert.equal(completed, true); - }); - - it('uses function overload if first argument is undefined', () => { - let observer; - let completed = false; - new Observable(x => observer = x).subscribe( - undefined, - null, - () => completed = true - ); - observer.complete(); - assert.equal(completed, true); - }); - - it('uses function overload if first argument is a primative', () => { - let observer; - let completed = false; - new Observable(x => observer = x).subscribe( - 'abc', - null, - () => completed = true - ); - observer.complete(); - assert.equal(completed, true); - }); - - it('enqueues a job to send error if subscriber throws', async () => { - let error = {}; - let errorValue = undefined; - new Observable(() => { throw error }).subscribe({ - error(e) { errorValue = e }, - }); - assert.equal(errorValue, undefined); - await null; - assert.equal(errorValue, error); - }); - - it('does not send error if unsubscribed', async () => { - let error = {}; - let errorValue = undefined; - let subscription = new Observable(() => { throw error }).subscribe({ - error(e) { errorValue = e }, - }); - subscription.unsubscribe(); - assert.equal(errorValue, undefined); - await null; - assert.equal(errorValue, undefined); - }); - - it('accepts a cleanup function from the subscriber function', () => { - let cleanupCalled = false; - let subscription = new Observable(() => { - return () => cleanupCalled = true; - }).subscribe(); - subscription.unsubscribe(); - assert.equal(cleanupCalled, true); - }); - - it('accepts a subscription object from the subscriber function', () => { - let cleanupCalled = false; - let subscription = new Observable(() => { - return { - unsubscribe() { cleanupCalled = true }, - }; - }).subscribe(); - subscription.unsubscribe(); - assert.equal(cleanupCalled, true); - }); - -}); diff --git a/node_modules/zen-observable/test/subscription.js b/node_modules/zen-observable/test/subscription.js deleted file mode 100644 index 5d3f41fd..00000000 --- a/node_modules/zen-observable/test/subscription.js +++ /dev/null @@ -1,41 +0,0 @@ -import assert from 'assert'; -import { testMethodProperty } from './properties.js'; - -describe('subscription', () => { - - function getSubscription(subscriber = () => {}) { - return new Observable(subscriber).subscribe(); - } - - describe('unsubscribe', () => { - it('is a method on Subscription.prototype', () => { - let subscription = getSubscription(); - testMethodProperty(Object.getPrototypeOf(subscription), 'unsubscribe', { - configurable: true, - writable: true, - length: 0, - }); - }); - - it('reports an error if the cleanup function throws', () => { - let error = {}; - let subscription = getSubscription(() => { - return () => { throw error }; - }); - subscription.unsubscribe(); - assert.equal(hostError, error); - }); - }); - - describe('closed', () => { - it('is a getter on Subscription.prototype', () => { - let subscription = getSubscription(); - testMethodProperty(Object.getPrototypeOf(subscription), 'closed', { - configurable: true, - writable: true, - get: true, - }); - }); - }); - -}); diff --git a/package-lock.json b/package-lock.json index 34b64a4b..bfa3b683 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,69 +1,166 @@ { "name": "com.tibber", - "version": "1.4.0", + "version": "1.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", + "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.0" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "dev": true + }, + "@babel/highlight": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", + "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.15.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@eslint/eslintrc": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.4.tgz", + "integrity": "sha512-h8Vx6MdxwWI2WM8/zREHMoqdgLNXEL4QX3MWSVMdyNJGvXVOs+6lp+m2hc3FnuMHDc4poxFNI20vCk0OmI4G0Q==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.0.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + } + } + }, "@grpc/grpc-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.2.0.tgz", - "integrity": "sha512-09H50V7rmz0gFrGz6IbP49z9A8+2p4yZYcNDEb7bytr90vWn52VBQE1a+LMBlrucmNN0wSsiCr3TJx+dStHTng==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.4.4.tgz", + "integrity": "sha512-a6222b7Dl6fIlMgzVl7e+NiRoLiZFbpcwvBH2Oli56Bn7W4/3Ld+86hK4ffPn5rx2DlDidmIcvIJiOQXyhv9gA==", "requires": { - "@types/node": "^12.12.47", - "google-auth-library": "^6.1.1", - "semver": "^6.2.0" + "@grpc/proto-loader": "^0.6.4", + "@types/node": ">=12.12.47" }, "dependencies": { - "@types/node": { - "version": "12.19.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.7.tgz", - "integrity": "sha512-zvjOU1g4CpPilbTDUATnZCUb/6lARMRAqzT7ILwl1P3YvU2leEcZ2+fw9+Jrw/paXB1CgQyXTrN4hWDtqT9O2A==" - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + "@grpc/proto-loader": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.6.tgz", + "integrity": "sha512-cdMaPZ8AiFz6ua6PUbP+LKbhwJbFXnrQ/mlnKGUyzDUZ3wp7vPLksnmLCBX6SHgSmjX7CbNVNLFYD5GmmjO4GQ==", + "requires": { + "@types/long": "^4.0.1", + "lodash.camelcase": "^4.3.0", + "long": "^4.0.0", + "protobufjs": "^6.10.0", + "yargs": "^16.1.1" + } } } }, "@grpc/proto-loader": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz", - "integrity": "sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.6.tgz", + "integrity": "sha512-DT14xgw3PSzPxwS13auTEwxhMMOoz33DPUKNtmYK/QYbBSpLXJy78FGGs5yVoxVobEqPm4iW9MOIoz0A3bLTRQ==", "requires": { "lodash.camelcase": "^4.3.0", "protobufjs": "^6.8.6" } }, + "@humanwhocodes/config-array": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.6.0.tgz", + "integrity": "sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, "@newrelic/aws-sdk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@newrelic/aws-sdk/-/aws-sdk-3.0.0.tgz", - "integrity": "sha512-8sS0MBrvmdCOVsCe7NpNReKU06fhNnvsT60+VmzZNbv1nqPNbtOuUVERzukF/85XWU7Lk/r+ikUyGHX+Emlb4w==" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@newrelic/aws-sdk/-/aws-sdk-4.0.1.tgz", + "integrity": "sha512-6pjPHKODTMItaO6zHDSR3HH7ohvUP9zzQf2pKMKdU4lB/1HV2+Xf6r92X96zPmGQsAnCP9xhgbseUklHD00a1Q==" }, "@newrelic/koa": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@newrelic/koa/-/koa-5.0.0.tgz", - "integrity": "sha512-4jzRXnUe38gQkZI8K4tWQ6CNdCNTi5uKILf1dTkyT6LpGxzDSLPwVyJ6xtMSMzr8SjIPG7lyNoWe42q8wFA7jg==", - "requires": { - "methods": "^1.1.2" - } + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@newrelic/koa/-/koa-6.0.1.tgz", + "integrity": "sha512-LrM0wLBcdngkL6gfAyqlBciqncZJ/Z2DhHCvKQbYSqwG0UxUZ5EZyYqkmU28UIFAdC6ag/6QDEFwYg3PXwJbzQ==" }, "@newrelic/native-metrics": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@newrelic/native-metrics/-/native-metrics-6.0.0.tgz", - "integrity": "sha512-EUdlsv25dEMT+8SOV02Xfk2E3UTo2fH33lVmnv/CSllH6+ljJDAfG0Ib5zY92Qmaj+oiThbfRpSYOlUfH+Uuiw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@newrelic/native-metrics/-/native-metrics-7.0.2.tgz", + "integrity": "sha512-r/V9AuQ3svcYWYDbRMIqy36guO3871b0/26e/Bx5SvfR1E/2uy6sHvtvzYIF5kOl+46AFuzR1C9ZfCe2ofCtgg==", "optional": true, "requires": { - "nan": "^2.14.1", + "nan": "^2.14.2", "semver": "^5.5.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "optional": true + } } }, "@newrelic/superagent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@newrelic/superagent/-/superagent-4.0.0.tgz", - "integrity": "sha512-n4iNrsV0908yHNZPNof7rm/mffclHaIxprCCWk15b4IRJik2VrtuIrK3mboUgNdv5pX4P7EZytY/D6kJgFkDGw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@newrelic/superagent/-/superagent-5.0.1.tgz", + "integrity": "sha512-Efn/G0OohcjDkNEgH/eqiie8boWYMFVT++zxHquIj7I8FdTd2ZoKzcxS2lbkbEAKKXO54o8+cShJTwpptkAdGg==" + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, "requires": { - "methods": "^1.1.2" + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" } }, "@protobufjs/aspromise": { @@ -120,20 +217,185 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@types/bluebird": { + "version": "3.5.36", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.36.tgz", + "integrity": "sha512-HBNx4lhkxN7bx6P0++W8E289foSu8kO8GCk2unhuVggO+cE7rh9DhZUyPhUxNRG9m+5B5BTKxZQ5ZP92x/mx9Q==", + "dev": true + }, + "@types/homey": { + "version": "npm:homey-apps-sdk-v3-types@0.2.2", + "resolved": "https://registry.npmjs.org/homey-apps-sdk-v3-types/-/homey-apps-sdk-v3-types-0.2.2.tgz", + "integrity": "sha512-FS0ahnOTs3e5BBlL/q8dD/mFcoCZeqH+BIrjZ4krQjybpAvyDA0cqQm9ROUxNbcUoVVNStCEBJEooSvJR1HSmg==", + "dev": true, + "requires": { + "@types/node": "^14.14.20" + }, + "dependencies": { + "@types/node": { + "version": "14.17.33", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.33.tgz", + "integrity": "sha512-noEeJ06zbn3lOh4gqe2v7NMGS33jrulfNqYFDjjEbhpDEHR5VTxgYNQSBqBlJIsBJW3uEYDgD6kvMnrrhGzq8g==", + "dev": true + } + } + }, + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "@types/lodash": { + "version": "4.14.176", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.176.tgz", + "integrity": "sha512-xZmuPTa3rlZoIbtDUyJKZQimJV3bxCmzMIO2c9Pz9afyDro6kr7R79GwcB6mRhuoPmV2p1Vb66WOJH7F886WKQ==", + "dev": true + }, "@types/long": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" }, + "@types/minimist": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", + "dev": true + }, + "@types/newrelic": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/newrelic/-/newrelic-7.0.2.tgz", + "integrity": "sha512-+PPoS4y66YypF2tvTdJD2aXSGPpOWaDsJ5vPs/e3ejfrOB4bKSCrpH6nnxIeV12pv1upRsKfuXNFtaH1pGQ0MA==" + }, "@types/node": { - "version": "14.14.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.7.tgz", - "integrity": "sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg==" + "version": "16.11.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.7.tgz", + "integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==" + }, + "@types/normalize-package-data": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", + "dev": true + }, + "@types/source-map-support": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.5.4.tgz", + "integrity": "sha512-9zGujX1sOPg32XLyfgEB/0G9ZnrjthL/Iv1ZfuAjj8LEilHZEpQSQs1scpRXPhHzGYgWiLz9ldF1cI8JhL+yMw==", + "dev": true, + "requires": { + "source-map": "^0.6.0" + } + }, + "@types/ws": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz", + "integrity": "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==", + "dev": true, + "requires": { + "@types/node": "*" + } }, "@types/zen-observable": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.1.tgz", - "integrity": "sha512-wmk0xQI6Yy7Fs/il4EpOcflG4uonUpYGqvZARESLc2oy4u69fkatFLbJOeW4Q6awO15P4rduAe6xkwHevpXcUQ==" + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.3.tgz", + "integrity": "sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw==" + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.3.1.tgz", + "integrity": "sha512-cFImaoIr5Ojj358xI/SDhjog57OK2NqlpxwdcgyxDA3bJlZcJq5CPzUXtpD7CxI2Hm6ATU7w5fQnnkVnmwpHqw==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "5.3.1", + "@typescript-eslint/scope-manager": "5.3.1", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.3.1.tgz", + "integrity": "sha512-RgFn5asjZ5daUhbK5Sp0peq0SSMytqcrkNfU4pnDma2D8P3ElZ6JbYjY8IMSFfZAJ0f3x3tnO3vXHweYg0g59w==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.3.1", + "@typescript-eslint/types": "5.3.1", + "@typescript-eslint/typescript-estree": "5.3.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.3.1.tgz", + "integrity": "sha512-TD+ONlx5c+Qhk21x9gsJAMRohWAUMavSOmJgv3JGy9dgPhuBd5Wok0lmMClZDyJNLLZK1JRKiATzCKZNUmoyfw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.3.1", + "@typescript-eslint/types": "5.3.1", + "@typescript-eslint/typescript-estree": "5.3.1", + "debug": "^4.3.2" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.3.1.tgz", + "integrity": "sha512-XksFVBgAq0Y9H40BDbuPOTUIp7dn4u8oOuhcgGq7EoDP50eqcafkMVGrypyVGvDYHzjhdUCUwuwVUK4JhkMAMg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.3.1", + "@typescript-eslint/visitor-keys": "5.3.1" + } + }, + "@typescript-eslint/types": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.3.1.tgz", + "integrity": "sha512-bG7HeBLolxKHtdHG54Uac750eXuQQPpdJfCYuw4ZI3bZ7+GgKClMWM8jExBtp7NSP4m8PmLRM8+lhzkYnSmSxQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.1.tgz", + "integrity": "sha512-PwFbh/PKDVo/Wct6N3w+E4rLZxUDgsoII/GrWM2A62ETOzJd4M6s0Mu7w4CWsZraTbaC5UQI+dLeyOIFF1PquQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.3.1", + "@typescript-eslint/visitor-keys": "5.3.1", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.1.tgz", + "integrity": "sha512-3cHUzUuVTuNHx0Gjjt5pEHa87+lzyqOiHXy/Gz+SJOCW1mpw9xQHIIEwnKn+Thph1mgWyZ90nboOcSuZr/jTTQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.3.1", + "eslint-visitor-keys": "^3.0.0" + } }, "@tyriar/fibonacci-heap": { "version": "2.0.9", @@ -150,9 +412,9 @@ } }, "@wry/equality": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.1.9.tgz", - "integrity": "sha512-mB6ceGjpMGz1ZTza8HYnrPGos2mC6So4NhS1PtZ8s4Qt0K7fBiIGhpSxUbQmhwcSWE3no+bYxmI2OL6KuXYmoQ==", + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.1.11.tgz", + "integrity": "sha512-mwEVBDUVODlsQQ5dfuLUS5/Tf7jqUKyhKYHmVi4fPB6bDMOfWvUPJmKgS1Z7Za/sOI3vzWt4+O7yCiL/70MogA==", "requires": { "tslib": "^1.9.3" } @@ -165,10 +427,67 @@ "event-target-shim": "^5.0.0" } }, + "acorn": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", + "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true + }, "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==" + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "apollo-cache": { "version": "1.3.5", @@ -177,19 +496,6 @@ "requires": { "apollo-utilities": "^1.3.4", "tslib": "^1.10.0" - }, - "dependencies": { - "apollo-utilities": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "requires": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - } - } } }, "apollo-cache-inmemory": { @@ -202,28 +508,6 @@ "optimism": "^0.10.0", "ts-invariant": "^0.4.0", "tslib": "^1.10.0" - }, - "dependencies": { - "apollo-cache": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/apollo-cache/-/apollo-cache-1.3.5.tgz", - "integrity": "sha512-1XoDy8kJnyWY/i/+gLTEbYLnoiVtS8y7ikBr/IfmML4Qb+CM7dEEbIUOjnY716WqmZ/UpXIxTfJsY7rMcqiCXA==", - "requires": { - "apollo-utilities": "^1.3.4", - "tslib": "^1.10.0" - } - }, - "apollo-utilities": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "requires": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - } - } } }, "apollo-client": { @@ -239,19 +523,6 @@ "ts-invariant": "^0.4.0", "tslib": "^1.10.0", "zen-observable": "^0.8.0" - }, - "dependencies": { - "apollo-utilities": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "requires": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - } - } } }, "apollo-link": { @@ -266,11 +537,11 @@ } }, "apollo-link-ws": { - "version": "1.0.19", - "resolved": "https://registry.npmjs.org/apollo-link-ws/-/apollo-link-ws-1.0.19.tgz", - "integrity": "sha512-mRXmeUkc55ixOdYRtfq5rq3o9sboKghKABKroDVhJnkdS56zthBEWMAD+phajujOUbqByxjok0te8ABqByBdeQ==", + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/apollo-link-ws/-/apollo-link-ws-1.0.20.tgz", + "integrity": "sha512-mjSFPlQxmoLArpHBeUb2Xj+2HDYeTaJqFGOqQ+I8NVJxgL9lJe84PDWcPah/yMLv3rB7QgBDSuZ0xoRFBPlySw==", "requires": { - "apollo-link": "^1.2.13", + "apollo-link": "^1.2.14", "tslib": "^1.9.3" } }, @@ -285,20 +556,56 @@ "tslib": "^1.10.0" } }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "array-includes": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", + "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "array.prototype.flat": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", + "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0" + } + }, "arrify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" }, "async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz", + "integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==" }, "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" }, "asynckit": { "version": "0.4.0", @@ -310,10 +617,16 @@ "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "bignumber.js": { "version": "9.0.1", @@ -321,9 +634,28 @@ "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==" }, "bluebird": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.1.tgz", - "integrity": "sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==" + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } }, "buffer-equal-constant-time": { "version": "1.0.1", @@ -331,9 +663,85 @@ "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "camelcase-keys": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-7.0.1.tgz", + "integrity": "sha512-P331lEls98pW8JLyodNWfzuz91BEDVA4VpW2/SwXnyv2K495tq1N777xzDbFgnEigfA7UIY0xa6PwR/H9jijjA==", + "dev": true, + "requires": { + "camelcase": "^6.2.0", + "map-obj": "^4.1.0", + "quick-lru": "^5.1.1", + "type-fest": "^1.2.1" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true }, "combined-stream": { "version": "1.0.8", @@ -343,6 +751,12 @@ "delayed-stream": "~1.0.0" } }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, "concat-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", @@ -354,27 +768,140 @@ "typedarray": "^0.0.6" } }, + "confusing-browser-globals": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz", + "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==", + "dev": true + }, "cross-fetch": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.0.6.tgz", - "integrity": "sha512-KBPUbqgFjzWlVcURG+Svp9TlhA5uliYtiNx/0r8nv0pdypeQCRJ9IaSIc3q/x3q8t3F75cHuwxVql1HFGHCNJQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", + "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", "requires": { "node-fetch": "2.6.1" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + } + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "requires": { "ms": "2.1.2" } }, + "decamelize": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-5.0.1.tgz", + "integrity": "sha512-VfxadyCECXgQlkoEAjeghAr5gY3Hf+IKjKb+X8tGVDtveCjN+USwprd2q3QXBR9T1+x2DG0XZF5/w+7HAtSaXA==", + "dev": true + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "del": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-6.0.0.tgz", + "integrity": "sha512-1shh9DQ23L16oXSZKB2JxpL7iMy2E0S9d517ptA1P8iw0alkPtQcrKH7ru31rYtKwF499HkTu+DRzq3TCKDFRQ==", + "dev": true, + "requires": { + "globby": "^11.0.1", + "graceful-fs": "^4.2.4", + "is-glob": "^4.0.1", + "is-path-cwd": "^2.2.0", + "is-path-inside": "^3.0.2", + "p-map": "^4.0.0", + "rimraf": "^3.0.2", + "slash": "^3.0.0" + } + }, + "del-cli": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/del-cli/-/del-cli-4.0.1.tgz", + "integrity": "sha512-KtR/6cBfZkGDAP2NA7z+bP4p1OMob3wjN9mq13+SWvExx6jT9gFWfLgXEeX8J2B47OKeNCq9yTONmtryQ+m+6g==", + "dev": true, + "requires": { + "del": "^6.0.0", + "meow": "^10.1.0" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -383,124 +910,775 @@ "safe-buffer": "^5.0.1" } }, - "event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" - }, - "eventemitter3": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, - "extract-files": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", - "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==" + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } }, - "fast-text-encoding": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", - "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" + "es-abstract": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" + } }, - "form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" } }, - "gaxios": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-3.2.0.tgz", - "integrity": "sha512-+6WPeVzPvOshftpxJwRi2Ozez80tn/hdtOUag7+gajDHRJvAblKxTFSSMPtr2hmnLy7p0mvYz0rMXLBl8pSO7Q==", + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.2.0.tgz", + "integrity": "sha512-erw7XmM+CLxTOickrimJ1SiF55jiNlVSp2qqm0NuBWPtHYQCegD5ZMaW0c3i5ytPqL+SSLaCxdvQXFPLJn+ABw==", + "dev": true, "requires": { - "abort-controller": "^3.0.0", - "extend": "^3.0.2", - "https-proxy-agent": "^5.0.0", - "is-stream": "^2.0.0", - "node-fetch": "^2.3.0" + "@eslint/eslintrc": "^1.0.4", + "@humanwhocodes/config-array": "^0.6.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^6.0.0", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.2.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" }, "dependencies": { - "agent-base": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.1.tgz", - "integrity": "sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg==", + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "requires": { - "debug": "4" + "color-convert": "^2.0.1" } }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "requires": { - "agent-base": "6", - "debug": "4" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" } }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-scope": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz", + "integrity": "sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, - "gcp-metadata": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.0.tgz", - "integrity": "sha512-vQZD57cQkqIA6YPGXM/zc+PIZfNRFdukWGsGZ5+LcJzesi5xp6Gn7a02wRJi4eXPyArNMIYpPET4QMxGqtlk6Q==", + "eslint-config-airbnb-base": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz", + "integrity": "sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==", + "dev": true, "requires": { - "gaxios": "^3.0.0", - "json-bigint": "^1.0.0" - } + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", + "object.entries": "^1.1.5", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "eslint-config-airbnb-typescript": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-15.0.0.tgz", + "integrity": "sha512-DTWGwqytbTnB8kSKtmkrGkRf3xwTs2l15shSH0w/3Img47AQwCCrIA/ON/Uj0XXBxP31LHyEItPXeuH3mqCNLA==", + "dev": true, + "requires": { + "eslint-config-airbnb-base": "^14.2.1" + }, + "dependencies": { + "eslint-config-airbnb-base": { + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz", + "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==", + "dev": true, + "requires": { + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", + "object.entries": "^1.1.2" + } + } + } + }, + "eslint-config-prettier": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", + "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", + "dev": true + }, + "eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-module-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", + "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "find-up": "^2.1.0", + "pkg-dir": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.2.tgz", + "integrity": "sha512-qCwQr9TYfoBHOFcVGKY9C9unq05uOxxdklmBXLVvcwo68y5Hta6/GzCZEMx2zQiu0woKNEER0LE7ZgaOfBU14g==", + "dev": true, + "requires": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.0", + "has": "^1.0.3", + "is-core-module": "^2.7.0", + "is-glob": "^4.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.5", + "resolve": "^1.20.0", + "tsconfig-paths": "^3.11.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-plugin-prettier": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz", + "integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz", + "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==", + "dev": true + }, + "espree": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.0.0.tgz", + "integrity": "sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ==", + "dev": true, + "requires": { + "acorn": "^8.5.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.0.0" + } + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extract-files": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", + "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, + "fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fast-text-encoding": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", + "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", + "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", + "dev": true + }, + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "gaxios": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.3.2.tgz", + "integrity": "sha512-T+ap6GM6UZ0c4E6yb1y/hy2UB6hTrqhglp3XfmU9qbLCGRYhLVV5aRPpC4EmoG8N8zOnkYCgoBz+ScvGAARY6Q==", + "requires": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^5.0.0", + "is-stream": "^2.0.0", + "node-fetch": "^2.6.1" + } + }, + "gcp-metadata": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.3.1.tgz", + "integrity": "sha512-x850LS5N7V1F3UcV7PoupzGsyD6iVwTVvsh3tbXfkctZnBnjW5yu5z1/3k3SehF7TyoTIe78rJs02GMMy+LF+A==", + "requires": { + "gaxios": "^4.0.0", + "json-bigint": "^1.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + }, + "dependencies": { + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } }, "google-auth-library": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.1.1.tgz", - "integrity": "sha512-0WfExOx3FrLYnY88RICQxvpaNzdwjz44OsHqHkIoAJfjY6Jck6CZRl1ASWadk+wbJ0LhkQ8rNY4zZebKml4Ghg==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.1.6.tgz", + "integrity": "sha512-Q+ZjUEvLQj/lrVHF/IQwRo6p3s8Nc44Zk/DALsN+ac3T4HY/g/3rrufkgtl+nZ1TW7DNAw5cTChdVp4apUXVgQ==", "requires": { "arrify": "^2.0.0", "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", "fast-text-encoding": "^1.0.0", - "gaxios": "^3.0.0", - "gcp-metadata": "^4.1.0", + "gaxios": "^4.0.0", + "gcp-metadata": "^4.2.0", "gtoken": "^5.0.4", "jws": "^4.0.0", "lru-cache": "^6.0.0" } }, "google-p12-pem": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.3.tgz", - "integrity": "sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.1.2.tgz", + "integrity": "sha512-tjf3IQIt7tWCDsa0ofDQ1qqSCNzahXDxdAGJDbruWqu3eCg5CKLYKN+hi0s6lfvzYZ1GDVr+oDF9OOWlDSdf0A==", "requires": { "node-forge": "^0.10.0" } }, + "graceful-fs": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "dev": true + }, "graphql": { - "version": "15.4.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.4.0.tgz", - "integrity": "sha512-EB3zgGchcabbsU9cFe1j+yxdzKQKAbGUWRb13DsrsMN1yyfmmIq+2+L5MqVWcDCE4V89R5AyUOi7sMOGxdsYtA==" + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.7.2.tgz", + "integrity": "sha512-AnnKk7hFQFmU/2I9YSQf3xw44ctnSFCfp3zE0N6W174gqe9fWG/2rKaKxROK7CcI3XtERpjEKFqts8o319Kf7A==" }, "graphql-request": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-3.3.0.tgz", - "integrity": "sha512-NHj65WSIUh8j7TBYgzWU0fqvLfxrqFDrLG8nZUh+IREZw50ljR6JXlXRkr52/fL/46wpItiQNLDrG+UZI+KmzA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-3.6.1.tgz", + "integrity": "sha512-Nm1EasrAQVZllyNTlHDLnLZjlhC6eRWnWP6KH//ytnAL08pjlLkdI2K+s6OV92p45hn5b/kUlLbDwACmRoLwrQ==", "requires": { "cross-fetch": "^3.0.6", "extract-files": "^9.0.0", @@ -508,19 +1686,79 @@ } }, "graphql-tag": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.11.0.tgz", - "integrity": "sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA==" + "version": "2.12.6", + "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", + "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", + "requires": { + "tslib": "^2.1.0" + }, + "dependencies": { + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + } + } }, "gtoken": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.4.tgz", - "integrity": "sha512-U9wnSp4GZ7ov6zRdPuRHG4TuqEWqRRgT1gfXGNArhzBUn9byrPeH8uTmBWU/ZiWJJvTEmkjhDIC3mqHWdVi3xQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.3.1.tgz", + "integrity": "sha512-yqOREjzLHcbzz1UrQoxhBtpk8KjrVhuqPE7od1K2uhyxG2BHjKZetlbLw/SPZak/QqTIQW+addS+EcjqQsZbwQ==", "requires": { - "gaxios": "^3.0.0", + "gaxios": "^4.0.0", "google-p12-pem": "^3.0.3", - "jws": "^4.0.0", - "mime": "^2.2.0" + "jws": "^4.0.0" + } + }, + "hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "hosted-git-info": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", + "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" } }, "http.min": { @@ -529,29 +1767,250 @@ "integrity": "sha1-I833FAQnp8W+F01m96n776267Nc=" }, "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", "requires": { - "agent-base": "5", + "agent-base": "6", "debug": "4" } }, + "ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true + }, + "is-core-module": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-number-object": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "dev": true + }, "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-weakref": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", + "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0" + } + }, + "isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "iterall": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==" }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, "json-bigint": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", @@ -560,11 +2019,38 @@ "bignumber.js": "^9.0.0" } }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "jwa": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", @@ -575,13 +2061,44 @@ "safe-buffer": "^5.0.1" } }, - "jws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "requires": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, "requires": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" + "p-locate": "^5.0.0" } }, "lodash": { @@ -594,6 +2111,12 @@ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "long": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", @@ -607,38 +2130,110 @@ "yallist": "^4.0.0" } }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + "map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true + }, + "meow": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-10.1.1.tgz", + "integrity": "sha512-uzOAEBTGujHAD6bVzIQQk5kDTgatxmpVmr1pj9QhwsHLEG2AiB+9F08/wmjrZIk4h5pWxERd7+jqGZywYx3ZFw==", + "dev": true, + "requires": { + "@types/minimist": "^1.2.2", + "camelcase-keys": "^7.0.0", + "decamelize": "^5.0.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.2", + "read-pkg-up": "^8.0.0", + "redent": "^4.0.0", + "trim-newlines": "^4.0.2", + "type-fest": "^1.2.2", + "yargs-parser": "^20.2.9" + } }, - "mime": { - "version": "2.4.6", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", - "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==" + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } }, "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==" }, "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "requires": { + "mime-db": "1.51.0" + } + }, + "min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, "requires": { - "mime-db": "1.44.0" + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "dependencies": { + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + } } }, "moment": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, "moment-timezone": { - "version": "0.5.27", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.27.tgz", - "integrity": "sha512-EIKQs7h5sAsjhPCqN6ggx6cEbs94GK050254TIJySD1bzoM5JTYDwAU1IoVOeTOL6Gm27kYJ51/uuvq1kIlrbw==", + "version": "0.5.33", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.33.tgz", + "integrity": "sha512-PTc2vcT8K9J5/9rDEPe5czSIKgLoGsH8UNpA4qZTVw0Vd/Uz19geE9abbIOQKaAQFcnQ3v5YEXrbSc5BpshH+w==", "requires": { "moment": ">= 2.9.0" } @@ -649,41 +2244,124 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "nan": { - "version": "2.14.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", - "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", "optional": true }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "newrelic": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/newrelic/-/newrelic-7.0.1.tgz", - "integrity": "sha512-DMuznXjT4Eh4nXpM5CIxnuY+3Lv6imVdsjOwgPSPD6aKzrPuXg1qpqhh07WjGkUA3XpuAaiwDmxjz4WHrSfJUg==", - "requires": { - "@grpc/grpc-js": "1.2.0", - "@grpc/proto-loader": "^0.5.5", - "@newrelic/aws-sdk": "^3.0.0", - "@newrelic/koa": "^5.0.0", - "@newrelic/native-metrics": "^6.0.0", - "@newrelic/superagent": "^4.0.0", + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/newrelic/-/newrelic-8.5.2.tgz", + "integrity": "sha512-gVEqMi6HIxnkFFsDPcx7cffPFNMOz1tcRHn9OTEQx4+diM1V2zjV76bJ33uVeEg1dyzezwaBXQjowq5C4dkH7g==", + "requires": { + "@grpc/grpc-js": "^1.2.11", + "@grpc/proto-loader": "^0.5.6", + "@newrelic/aws-sdk": "^4.0.1", + "@newrelic/koa": "^6.0.1", + "@newrelic/native-metrics": "^7.0.1", + "@newrelic/superagent": "^5.0.1", "@tyriar/fibonacci-heap": "^2.0.7", "async": "^3.2.0", "concat-stream": "^2.0.0", - "https-proxy-agent": "^4.0.0", + "https-proxy-agent": "^5.0.0", "json-stringify-safe": "^5.0.0", "readable-stream": "^3.6.0", "semver": "^5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } } }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.6", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", + "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", + "requires": { + "whatwg-url": "^5.0.0" + } }, "node-forge": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" }, + "normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "requires": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + } + }, + "object-inspect": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", + "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.entries": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz", + "integrity": "sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + } + }, + "object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, "optimism": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.10.3.tgz", @@ -692,10 +2370,195 @@ "@wry/context": "^0.4.0" } }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", + "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==", + "dev": true + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "protobufjs": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", - "integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz", + "integrity": "sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==", "requires": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -708,15 +2571,49 @@ "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", "@types/long": "^4.0.1", - "@types/node": "^13.7.0", + "@types/node": ">=13.7.0", "long": "^4.0.0" - }, - "dependencies": { - "@types/node": { - "version": "13.13.33", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.33.tgz", - "integrity": "sha512-1B3GM1yuYsFyEvBb+ljBqWBOylsWDYioZ5wpu8AhXdIhq20neXS7eaSC8GkwHE0yQYGiOIV43lMsgRYTgKZefQ==" - } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true + }, + "read-pkg": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-6.0.0.tgz", + "integrity": "sha512-X1Fu3dPuk/8ZLsMhEj5f4wFAF0DWoK7qhGJvgaijocXxBmSToKfbFtqbxMO7bVjNA1dmE5huAzjXj/ey86iw9Q==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^3.0.2", + "parse-json": "^5.2.0", + "type-fest": "^1.0.1" + } + }, + "read-pkg-up": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-8.0.0.tgz", + "integrity": "sha512-snVCqPczksT0HS2EC+SxUndvSzn6LRCwpfSvLrIfR5BKDQQZMaI6jPRC9dYvYFDRAuFEAnkwww8kBBNE/3VvzQ==", + "dev": true, + "requires": { + "find-up": "^5.0.0", + "read-pkg": "^6.0.0", + "type-fest": "^1.0.1" } }, "readable-stream": { @@ -729,15 +2626,196 @@ "util-deprecate": "^1.0.1" } }, + "redent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-4.0.0.tgz", + "integrity": "sha512-tYkDkVVtYkSVhuQ4zBgfvciymHaeuel+zFKXShfDnFP5SyVEP7qo70Rf1jTOTCx3vGNAbnEi/xFkcfQVMIBWag==", + "dev": true, + "requires": { + "indent-string": "^5.0.0", + "strip-indent": "^4.0.0" + }, + "dependencies": { + "indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true + } + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "source-map-support": { + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", + "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", + "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } }, "string_decoder": { "version": "1.3.0", @@ -747,26 +2825,54 @@ "safe-buffer": "~5.2.0" } }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-4.0.0.tgz", + "integrity": "sha512-mnVSV2l+Zv6BLpSD/8V87CW/y9EmmbYzGCIavsnsI6/nwn26DwffM/yztm30Z/I2DY9wdS3vXVCMnHDgZaVNoA==", + "dev": true, + "requires": { + "min-indent": "^1.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, "subscriptions-transport-ws": { - "version": "0.9.18", - "resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.18.tgz", - "integrity": "sha512-tztzcBTNoEbuErsVQpTN2xUNN/efAZXyCyL5m3x4t6SKrEiTL2N8SaKWBFWM4u56pL79ULif3zjyeq+oV+nOaA==", + "version": "0.9.19", + "resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.19.tgz", + "integrity": "sha512-dxdemxFFB0ppCLg10FTtRqH/31FNRL1y1BQv8209MK5I4CwALb7iihQg+7p65lFcIl8MHatINWBLOqpgU4Kyyw==", "requires": { "backo2": "^1.0.2", "eventemitter3": "^3.1.0", "iterall": "^1.2.1", "symbol-observable": "^1.0.4", - "ws": "^5.2.0" - }, - "dependencies": { - "ws": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", - "requires": { - "async-limiter": "~1.0.0" - } - } + "ws": "^5.2.0 || ^6.0.0 || ^7.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" } }, "symbol-observable": { @@ -774,6 +2880,32 @@ "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "trim-newlines": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-4.0.2.tgz", + "integrity": "sha512-GJtWyq9InR/2HRiLZgpIKv+ufIKrVrvjQWEj7PxAXNc5dwbNJkqhAUoAGgzRmULAnoOM5EIpveYd3J2VeSAIew==", + "dev": true + }, "ts-invariant": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz", @@ -782,21 +2914,181 @@ "tslib": "^1.9.3" } }, + "tsconfig-paths": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz", + "integrity": "sha512-7ecdYDnIdmv639mmDwslG6KQg1Z9STTz1j7Gcz0xa+nshh/gKDAHcPxRbWOsA3SPp0tXP2leTcY9Kw+NAkfZzA==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "dev": true }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true + }, + "unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, "ws": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", @@ -805,15 +3097,45 @@ "async-limiter": "~1.0.0" } }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==" + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + }, "zen-observable": { - "version": "0.8.14", - "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.14.tgz", - "integrity": "sha512-kQz39uonEjEESwh+qCi83kcC3rZJGh4mrZW7xjkSQYXkq//JZHTtKo+6yuVloTgMtzsIWOJrjIrKvk/dqm0L5g==" + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", + "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" }, "zen-observable-ts": { "version": "0.8.21", diff --git a/package.json b/package.json index af965ec6..fdb00ebf 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,12 @@ { "name": "com.tibber", - "version": "1.4.0", + "version": "1.5.5", "description": "Integration with Tibber", - "main": "app.js", + "main": "app.ts", "scripts": { + "clean": "del-cli ./build/**", + "lint": "eslint . --ext .js,.ts", + "build": "tsc", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { @@ -13,20 +16,42 @@ "author": "Tibber AS", "license": "ISC", "dependencies": { + "@types/newrelic": "^7.0.2", "apollo-cache-inmemory": "^1.6.6", "apollo-client": "^2.6.10", "apollo-link": "^1.2.14", "apollo-link-ws": "^1.0.19", - "bluebird": "^3.7.1", + "bluebird": "^3.7.2", "google-auth-library": "^6.1.1", "graphql": "^15.4.0", "graphql-request": "^3.3.0", "graphql-tag": "^2.11.0", "http.min": "^1.3.2", "lodash": "^4.17.21", - "moment-timezone": "^0.5.27", - "newrelic": "^7.0.1", + "moment-timezone": "^0.5.33", + "newrelic": "^8.5.2", + "source-map-support": "^0.5.20", "subscriptions-transport-ws": "^0.9.18", "ws": "^6.2.2" + }, + "devDependencies": { + "@tsconfig/node12": "^1.0.9", + "@types/bluebird": "^3.5.36", + "@types/homey": "npm:homey-apps-sdk-v3-types@^0.2.2", + "@types/lodash": "^4.14.176", + "@types/node": "^16.11.6", + "@types/source-map-support": "^0.5.4", + "@types/ws": "^8.2.0", + "@typescript-eslint/eslint-plugin": "^5.3.0", + "@typescript-eslint/parser": "^5.3.0", + "del-cli": "^4.0.1", + "eslint": "^8.2.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-airbnb-typescript": "^15.0.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-prettier": "^4.0.0", + "prettier": "^2.4.1", + "typescript": "^4.4.4" } } diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 00000000..3ebdf756 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,6 @@ +// eslint-disable-next-line no-undef +module.exports = { + singleQuote: true, + trailingComma: 'all', + endOfLine: 'auto', +}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..8403eb45 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "@tsconfig/node12/tsconfig.json", + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "outDir": "build/", + "sourceMap": true, + "removeComments": true, + "typeRoots": ["./@types", "./node_modules/@types"] + }, + "include": [ + "./globals.d.ts", + "./**/*.ts", + "./**/*.js", + "/**/*.json", + "./.eslintrc.js", + "./newrelic.js", + "package.json" + ], + "exclude": ["./build", "./app.json", "./package-lock.json"] +}